Index: itignore
===================================================================
--- .gitignore	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-/build
-/build_all
-/doxygen/html
-/doxygen/latex
-/tools/*.pyc
-/tools/__pycache__
-tags
-tools/sycek/
-tools/xcw/demo/viewer
-/.cache
-/PKG
-/downloads
-/amd64-helenos
Index: ravis.yml
===================================================================
--- .travis.yml	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#
-# Travis CI configuration notes
-# -----------------------------
-#
-# * HelenOS is always built for all architectures
-#   * that is done using matrix environmental variables
-#   * the list of architectures has to be kept manually in sync with
-#     HelenOS.config
-#   * the actual architecture is specified via H_ARCH variable
-#
-# * ported software is built when H_HARBOURS is set to true for given
-#   configuration
-#   * building ported software takes a lot of time, it is thus impossible
-#     to build for all architectures
-#   * some ports are known to fail for certain architectures: because that
-#     would make the whole build failing, we currently build only for ia32
-#     that seems to be in the best condition with respect to ported software
-#   * list of harbours is also maintained manually, look for a variable
-#     H_DEFAULT_HARBOURS_LIST to allow overriding from within this file
-#
-# * since the setup is rather complicated we use a dedicated shell script to
-#   run the actual build process and installation of the cross-compiler
-#   toolchain
-#
-# * if you have enabled Travis in your feature branch you may want to change
-#   some of the settings to better suite your needs
-#   * reduce number of built architectures (probably not needed)
-#   * built ported software for a different architecture
-#     * specify H_HARBOURS=true
-#     * optionally specify H_HARBOUR_LIST="..." to a list of harbours to be
-#       built
-#     * optionally specify H_HARBOURS_REPOSITORY="..." to point to your repo
-#       with HARBOUR files
-#
-
-language: c
-dist: xenial
-sudo: required
-env:
-  global:
-    - CROSS_PREFIX=/usr/local/cross
-  matrix:
-    - H_CCHECK=true
-    - H_ARCH=amd64
-    - H_ARCH=arm32/beagleboardxm
-    - H_ARCH=arm32/beaglebone
-    - H_ARCH=arm32/gta02
-    - H_ARCH=arm32/integratorcp
-    - H_ARCH=arm32/raspberrypi
-    - H_ARCH=arm64/virt
-    - H_ARCH=ia32 H_HARBOURS=true H_HARBOUR_LIST="fdlibm zlib binutils"
-    - H_ARCH=ia64/i460GX
-    - H_ARCH=ia64/ski
-    - H_ARCH=mips32/malta-be
-    - H_ARCH=mips32/malta-le
-    - H_ARCH=mips32/msim
-    - H_ARCH=ppc32
-    - H_ARCH=sparc64/niagara
-    - H_ARCH=sparc64/ultra
-before_install:
-  - sudo apt-get update -qq
-  - sudo apt-get install -qq genisoimage
-  - sudo apt-get install -qq python3-pip
-  - sudo apt-get install -qq python3-setuptools
-  - pip3 install ninja
-  - pip3 install --force-reinstall meson==0.50.1
-  - ./tools/travis.sh install
-script:
-  - ./tools/travis.sh run
-os:
-  - linux
-notifications:
-  irc:
-    channels:
-      - "chat.freenode.net#helenos"
-    use_notice: false
-    skip_join: true
-    template:
-      - "%{repository_name} (%{commit_message}): %{message}"
-      - "Build details : %{build_url}"
Index: scode/settings.json
===================================================================
--- .vscode/settings.json	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-{
-    "cmake.ignoreCMakeListsMissing": true
-}
Index: lenOS.config
===================================================================
--- HelenOS.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,704 +1,0 @@
-#
-# Copyright (c) 2006 Ondrej Palkovsky
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-## General platform options
-
-% Platform
-@ "abs32le" abstract 32-bit little endian
-@ "amd64" AMD64/EM64T 64-bit (PC)
-@ "arm32" ARM 32-bit
-@ "arm64" ARM 64-bit (AArch64)
-@ "ia32" IA-32 32-bit (PC)
-@ "ia64" IA-64 64-bit
-@ "mips32" MIPS 32-bit
-@ "ppc32" PowerPC 32-bit
-@ "riscv64" RISC-V 64-bit
-@ "sparc64" SPARCv9 64-bit
-! PLATFORM (choice)
-
-% Machine type
-@ "msim" MSIM
-@ "bmalta" MIPS Malta Development Board big endian
-@ "lmalta" MIPS Malta Development Board little endian
-! [PLATFORM=mips32] MACHINE (choice)
-
-% Machine type
-@ "i460GX" i460GX chipset machine
-@ "ski" Ski ia64 simulator
-! [PLATFORM=ia64] MACHINE (choice)
-
-% Machine type
-@ "generic" Generic Sun workstation or server
-! [PLATFORM=sparc64] MACHINE (choice)
-
-% Machine type
-@ "gta02" GTA02 / Neo FreeRunner
-@ "integratorcp" Integratorcp
-@ "beagleboardxm" BeagleBoard-xM
-@ "beaglebone" BeagleBone
-@ "raspberrypi" Raspberry Pi
-! [PLATFORM=arm32] MACHINE (choice)
-
-% Machine type
-@ "virt" QEMU virt
-@ "hikey960" HiKey 960
-! [PLATFORM=arm64] MACHINE (choice)
-
-% CPU type
-@ "pentium4" Pentium 4
-@ "pentium3" Pentium 3
-@ "core" Core Solo/Duo
-@ "athlon_xp" Athlon XP
-@ "athlon_mp" Athlon MP
-@ "i486" i486
-! [PLATFORM=ia32] PROCESSOR (choice)
-
-% CPU type
-@ "opteron" Opteron
-! [PLATFORM=amd64] PROCESSOR (choice)
-
-% CPU type
-@ "us" UltraSPARC I-II subarchitecture
-@ "us3" UltraSPARC III-IV subarchitecture
-@ "sun4v" Niagara (sun4v)
-! [PLATFORM=sparc64&MACHINE=generic] PROCESSOR (choice)
-
-% Quad float type
-@ "hard" Hardware
-@ "soft" Software
-! [PLATFORM=sparc64] QUADFLOAT (choice)
-
-% CPU type
-@ "cortex_a8" ARM Cortex A-8
-! [PLATFORM=arm32&(MACHINE=beagleboardxm|MACHINE=beaglebone)] PROCESSOR (choice)
-
-% CPU type
-@ "arm920t" ARM920T
-! [PLATFORM=arm32&MACHINE=gta02] PROCESSOR (choice)
-
-% CPU type
-@ "arm926ej_s" ARM926EJ-S
-! [PLATFORM=arm32&MACHINE=integratorcp] PROCESSOR (choice)
-
-% CPU type
-@ "arm1176jzf_s" ARM1176JZF-S
-! [PLATFORM=arm32&MACHINE=raspberrypi] PROCESSOR (choice)
-
-# Add more ARMv4 CPUs
-% CPU arch
-@ "armv4" ARMv4
-! [PLATFORM=arm32&(PROCESSOR=arm920t)] PROCESSOR_ARCH (choice)
-
-# Add more ARMv5 CPUs
-% CPU arch
-@ "armv5" ARMv5
-! [PLATFORM=arm32&(PROCESSOR=arm926ej_s)] PROCESSOR_ARCH (choice)
-
-# Add more ARMv6 CPUs
-% CPU arch
-@ "armv6" ARMv6
-! [PLATFORM=arm32&(PROCESSOR=arm1176jzf_s)] PROCESSOR_ARCH (choice)
-
-# Add more ARMv7-A CPUs
-% CPU arch
-@ "armv7_a" ARMv7-A
-! [PLATFORM=arm32&(PROCESSOR=cortex_a8)] PROCESSOR_ARCH (choice)
-
-% CPU type
-@ "R4000" MIPS R4000
-! [PLATFORM=mips32&MACHINE=msim] PROCESSOR (choice)
-
-% CPU type
-@ "4Kc" MIPS 4Kc
-! [PLATFORM=mips32&(MACHINE=bmalta|MACHINE=lmalta)] PROCESSOR (choice)
-
-% Kernel memory model
-@ "kernel" Kernel
-@ "large" Large
-! [PLATFORM=amd64] MEMORY_MODEL (choice)
-
-% RAM disk format
-@ "tmpfs" TMPFS image
-@ "fat" FAT16 image
-@ "ext4fs" ext4 image
-! RDFMT (choice)
-
-
-## Mapping between platform and kernel architecture
-
-% Kernel architecture
-@ "abs32le"
-! [PLATFORM=abs32le] KARCH (choice)
-
-% Kernel architecture
-@ "amd64"
-! [PLATFORM=amd64] KARCH (choice)
-
-% Kernel architecture
-@ "arm32"
-! [PLATFORM=arm32] KARCH (choice)
-
-% Kernel architecture
-@ "arm64"
-! [PLATFORM=arm64] KARCH (choice)
-
-% Kernel architecture
-@ "ia32"
-! [PLATFORM=ia32] KARCH (choice)
-
-% Kernel architecture
-@ "ia32xen"
-! [PLATFORM=ia32xen] KARCH (choice)
-
-% Kernel architecture
-@ "ia64"
-! [PLATFORM=ia64] KARCH (choice)
-
-% Kernel architecture
-@ "mips32"
-! [PLATFORM=mips32] KARCH (choice)
-
-% Kernel architecture
-@ "ppc32"
-! [PLATFORM=ppc32] KARCH (choice)
-
-% Kernel architecture
-@ "ppc64"
-! [PLATFORM=ppc64] KARCH (choice)
-
-% Kernel architecture
-@ "riscv64"
-! [PLATFORM=riscv64] KARCH (choice)
-
-% Kernel architecture
-@ "sparc64"
-! [PLATFORM=sparc64] KARCH (choice)
-
-
-## Mapping between platform and user space architecture
-
-% User space architecture
-@ "abs32le"
-! [PLATFORM=abs32le] UARCH (choice)
-
-% User space architecture
-@ "amd64"
-! [PLATFORM=amd64] UARCH (choice)
-
-% User space architecture
-@ "arm32"
-! [PLATFORM=arm32] UARCH (choice)
-
-% User space architecture
-@ "arm64"
-! [PLATFORM=arm64] UARCH (choice)
-
-% User space architecture
-@ "ia32"
-! [PLATFORM=ia32|PLATFORM=ia32xen] UARCH (choice)
-
-% User space architecture
-@ "ia64"
-! [PLATFORM=ia64] UARCH (choice)
-
-% User space architecture
-@ "mips32"
-! [PLATFORM=mips32] UARCH (choice)
-
-% User space architecture
-@ "ppc32"
-! [PLATFORM=ppc32] UARCH (choice)
-
-% User space architecture
-@ "ppc64"
-! [PLATFORM=ppc64] UARCH (choice)
-
-% User space architecture
-@ "riscv64"
-! [PLATFORM=riscv64] UARCH (choice)
-
-% User space architecture
-@ "sparc64"
-! [PLATFORM=sparc64] UARCH (choice)
-
-
-## Mapping between platform and boot architecture
-
-% Boot architecture
-@ "abs32le"
-! [PLATFORM=abs32le] BARCH (choice)
-
-% Boot architecture
-@ "amd64"
-! [PLATFORM=amd64] BARCH (choice)
-
-% Boot architecture
-@ "arm32"
-! [PLATFORM=arm32] BARCH (choice)
-
-% Boot architecture
-@ "arm64"
-! [PLATFORM=arm64] BARCH (choice)
-
-% Boot architecture
-@ "ia32"
-! [PLATFORM=ia32] BARCH (choice)
-
-% Boot architecture
-@ "ia32xen"
-! [PLATFORM=ia32xen] BARCH (choice)
-
-% Boot architecture
-@ "ia64"
-! [PLATFORM=ia64] BARCH (choice)
-
-% Boot architecture
-@ "mips32"
-! [PLATFORM=mips32] BARCH (choice)
-
-% Boot architecture
-@ "ppc32"
-! [PLATFORM=ppc32] BARCH (choice)
-
-% Boot architecture
-@ "ppc64"
-! [PLATFORM=ppc64] BARCH (choice)
-
-% Boot architecture
-@ "riscv64"
-! [PLATFORM=riscv64] BARCH (choice)
-
-% Boot architecture
-@ "sparc64"
-! [PLATFORM=sparc64] BARCH (choice)
-
-
-## Mapping between platform and image format
-
-% Image format
-@ "binary"
-! [PLATFORM=mips32&MACHINE=msim] IMAGE (choice)
-
-% Image format
-@ "elf"
-! [PLATFORM=mips32&(MACHINE=bmalta|MACHINE=lmalta)] IMAGE (choice)
-
-
-## Compiler options
-
-% Compiler
-@ "gcc_cross" GNU C Compiler (HelenOS-specific cross-compiler)
-@ "clang" Clang
-! COMPILER (choice)
-
-% Clang Integrated Assembler
-@ "default" Use architecture default.
-@ "yes" Use integrated assembler.
-@ "no" Use GNU Assembler.
-! [COMPILER=clang] INTEGRATED_AS (choice)
-
-## Cross-compiler target for abstract architecture
-
-% Cross-compiler target
-@ "arm32" ARM 32-bit
-@ "ia32" Intel IA-32
-@ "mips32" MIPS 32-bit
-! [PLATFORM=abs32le&COMPILER=gcc_cross] CROSS_TARGET (choice)
-
-
-## Kernel configuration
-
-% Fences
-! [PLATFORM=ia32&(PROCESSOR=athlon_xp|PROCESSOR=athlon_mp|PROCESSOR=pentium3)] CONFIG_FENCES_P3 (y)
-
-% Fences
-! [PLATFORM=ia32&(PROCESSOR=pentium4|PROCESSOR=core)] CONFIG_FENCES_P4 (y)
-
-% Fences
-! [PLATFORM=amd64] CONFIG_FENCES_P4 (y)
-
-% IOMAP bitmap support
-! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_IOMAP_BITMAP (y)
-
-% IOMAP dummy support
-! [PLATFORM=abs32le|PLATFORM=arm32|PLATFORM=arm64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=riscv64|PLATFORM=sparc64] CONFIG_IOMAP_DUMMY (y)
-
-% ACPI support
-! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_ACPI (y)
-
-% Hierarchical page tables support
-! [PLATFORM=abs32le|PLATFORM=ia32|PLATFORM=amd64|PLATFORM=arm32|PLATFORM=arm64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=riscv64] CONFIG_PAGE_PT (y)
-
-% Page hash table support
-! [PLATFORM=ia64|PLATFORM=sparc64] CONFIG_PAGE_HT (y)
-
-% Software integer division support
-! [PLATFORM=abs32le|PLATFORM=ia32|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32] CONFIG_SOFTINT (y)
-
-% ASID support
-! [PLATFORM=arm64|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID (y)
-
-% ASID FIFO support
-! [PLATFORM=arm64|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID_FIFO (y)
-
-% OpenFirmware tree support
-! [PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_OFW_TREE (y)
-
-% OpenFirmware PCI bus support
-! [PLATFORM=sparc64] CONFIG_OFW_PCI (y)
-
-% Multiboot standard support
-! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_MULTIBOOT (y)
-
-% FPU support
-! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=arm64|PLATFORM=ia64|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_FPU (y)
-
-## ARMv7 made FPU hardware compulsory
-% FPU support
-! [PLATFORM=arm32&PROCESSOR_ARCH=armv7_a] CONFIG_FPU (y)
-
-% FPU support
-! [PLATFORM=arm32&MACHINE=integratorcp] CONFIG_FPU (y)
-
-
-## Kernel features options
-
-% Support for SMP
-! [(PLATFORM=ia32&PROCESSOR!=athlon_xp)|PLATFORM=amd64|PLATFORM=arm64|PLATFORM=sparc64|PLATFORM=ia64|(PLATFORM=mips32&MACHINE=msim)|PLATFORM=abs32le] CONFIG_SMP (y/n)
-
-% Debug build
-! CONFIG_DEBUG (y/n)
-
-% Early debugging print
-! [CONFIG_DEBUG=y] CONFIG_DEBUG_EARLY_PRINT (n/y)
-
-% Sanitize undefined behavior (userspace)
-! CONFIG_UBSAN (n/y)
-
-% Sanitize undefined behavior (kernel)
-! CONFIG_UBSAN_KERNEL (n/y)
-
-% Track owner for futexes in userspace.
-! CONFIG_DEBUG_FUTEX (y/n)
-
-% Deadlock detection support for spinlocks
-! [CONFIG_DEBUG=y&CONFIG_SMP=y] CONFIG_DEBUG_SPINLOCK (y/n)
-
-% Lazy FPU context switching
-! [CONFIG_FPU=y] CONFIG_FPU_LAZY (y/n)
-
-% Use VHPT
-! [PLATFORM=ia64] CONFIG_VHPT (n/y)
-
-% Use TSB
-! [PLATFORM=sparc64] CONFIG_TSB (y/n)
-
-% IO SAPIC on default address support
-! [PLATFORM=ia64&MACHINE!=ski] CONFIG_IOSAPIC (y/n)
-
-% Support for Intel i8259 PIC
-! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=mips32&MACHINE=bmalta)|(PLATFORM=mips32&MACHINE=lmalta)] CONFIG_I8259 (y)
-
-% Virtually indexed D-cache support
-! [PLATFORM=sparc64] CONFIG_VIRT_IDX_DCACHE (y/n)
-
-% Support for userspace debuggers
-! CONFIG_UDEBUG (y/n)
-
-% Kernel console support
-! CONFIG_KCONSOLE (y/n)
-
-% Kernel symbol information
-! CONFIG_SYMTAB (y/n)
-
-% Detailed kernel logging
-! CONFIG_LOG (n/y)
-
-% Kernel function tracing
-! CONFIG_TRACE (n/y)
-
-% Compile kernel tests
-! CONFIG_TEST (y/n)
-
-% Use link-time optimization
-! [COMPILER=gcc_cross] CONFIG_LTO (n/y)
-
-% Compress init data
-! CONFIG_COMPRESSED_INIT (y/n)
-
-## User space features options
-
-## Hardware support
-
-% Input device class
-@ "generic" Keyboard or serial line
-! [(PLATFORM=arm32&MACHINE=integratorcp)|PLATFORM=arm64] CONFIG_HID_IN (choice)
-
-% Input device class
-@ "generic" Keyboard or serial line
-@ "none" No input device
-! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=riscv64|PLATFORM=sparc64] CONFIG_HID_IN (choice)
-
-% Input device class
-@ "generic" Keyboard or serial line
-@ "keyboard" Keyboard
-@ "serial" Serial line
-@ "none" No input device
-! [PLATFORM=ia64&MACHINE=i460GX] CONFIG_HID_IN (choice)
-
-% Output device class
-@ "generic" Monitor or serial line
-! [(PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp|MACHINE=beagleboardxm|MACHINE=beaglebone|MACHINE=raspberrypi))|PLATFORM=arm64] CONFIG_HID_OUT (choice)
-
-% Output device class
-@ "generic" Monitor or serial line
-@ "none" No output device
-! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=sparc64|PLATFORM=ppc32|(PLATFORM=ia64&MACHINE=i460GX)|(PLATFORM=mips32&(MACHINE=msim|MACHINE=bmalta|MACHINE=lmalta))|PLATFORM=riscv64] CONFIG_HID_OUT (choice)
-
-% PC keyboard support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_PC_KBD (y/n)
-
-% PC keyboard support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_PC_KBD (y/n)
-
-% PC keyboard support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_AT_KBD (y/n)
-
-% Support for msim keyboard
-! [CONFIG_HID_IN=generic&MACHINE=msim] CONFIG_MSIM_KBD (y/n)
-
-% Support for msim printer
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&MACHINE=msim] CONFIG_MSIM_PRN (y/n)
-
-% Support for VIA CUDA controller
-! [CONFIG_HID_IN=generic&PLATFORM=ppc32] CONFIG_VIA_CUDA (y/n)
-
-% Support for NS16550 controller
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic] CONFIG_NS16550 (y/n)
-
-% Support for NS16550 controller
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_NS16550 (y/n)
-
-% Support for NS16550 controller
-! [CONFIG_HID_IN=generic&PLATFORM=mips32&(MACHINE=lmalta|MACHINE=bmalta)] CONFIG_NS16550 (y)
-
-% Support for PL011 UART
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=arm32&(MACHINE=integratorcp|MACHINE=raspberrypi))] CONFIG_PL011_UART (y/n)
-
-% Support for PL011 UART
-! [CONFIG_HID_OUT=generic|(PLATFORM=arm64&(MACHINE=virt|MACHINE=hikey960))] CONFIG_PL011_UART (y)
-
-% Support for NS16550 controller (kernel console)
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial|CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_NS16550_KCON (y/n)
-
-% Use NS16550 controller as serial input (kernel console)
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_NS16550_KCON=y] CONFIG_NS16550 (y)
-
-% Use NS16550 controller as dummy serial output (kernel console)
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_NS16550_KCON=y] CONFIG_NS16550_OUT (y)
-
-% Use NS16550 controller as dummy serial output (kernel console)
-! [CONFIG_HID_OUT=generic&PLATFORM=mips32&(MACHINE=lmalta|MACHINE=bmalta)] CONFIG_NS16550_OUT (y)
-
-% Support for Samsung S3C24XX on-chip UART
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)
-
-% Support for Samsung S3C24XX on-chip interrupt controller
-! [PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_IRQC (y)
-
-% Support for TI AM335x timers support
-! [PLATFORM=arm32&MACHINE=beaglebone] CONFIG_AM335X_TIMERS (y)
-
-% Support for OMAP on-chip UART
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&(MACHINE=beagleboardxm|MACHINE=beaglebone)] CONFIG_OMAP_UART (y/n)
-
-% Support for BCM2835 mailbox
-! [PLATFORM=arm32&MACHINE=raspberrypi] CONFIG_BCM2835_MAILBOX (y/n)
-
-% Support for ARM GICv2
-! [PLATFORM=arm64&(MACHINE=virt|MACHINE=hikey960)] CONFIG_GICV2 (y)
-
-% Support for i8042 controller
-! [CONFIG_PC_KBD=y] CONFIG_I8042 (y)
-
-% Support for pl050 controller
-! [CONFIG_HID_IN=generic&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_PL050 (y)
-
-% Sun keyboard support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic&CONFIG_NS16550=y] CONFIG_SUN_KBD (y)
-
-% Sun serial console support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic&CONFIG_NS16550=y] CONFIG_SUN_TTY (y)
-
-% Macintosh ADB keyboard support
-! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ppc32&(CONFIG_VIA_CUDA=y)] CONFIG_MAC_KBD (y)
-
-% Dummy serial line input
-! [CONFIG_MSIM_KBD=y|CONFIG_ARM_KBD=y] CONFIG_DSRLNIN (y)
-
-% Dummy serial line output
-! [CONFIG_MSIM_PRN=y|CONFIG_ARM_PRN=y] CONFIG_DSRLNOUT (y)
-
-% Serial line input module
-! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_PL011_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_OMAP_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_OMAP_UART=y)|(PLATFORM=arm64&CONFIG_PL011_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_PL011_UART=y)|(PLATFORM=ia32&CONFIG_NS16550=y)|(PLATFORM=amd64&CONFIG_NS16550=y)|(PLATFORM=mips32&CONFIG_NS16550=y)|(PLATFORM=sparc64&CONFIG_SUN_TTY=y)] CONFIG_SRLN (y)
-
-% L4Re uvmm print hypercall support
-! [PLATFORM=amd64] CONFIG_L4RE_UVMM_EARLY_PRINT (n/y)
-
-% EGA support
-! [CONFIG_HID_OUT=generic&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_EGA (y/n)
-
-% EGA support
-! [CONFIG_HID_OUT=generic&PLATFORM=ia64&MACHINE=i460GX] CONFIG_EGA (y/n)
-
-% Framebuffer support
-! [CONFIG_HID_OUT=generic&(PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ppc32)] CONFIG_FB (y/n)
-
-% Framebuffer support
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=monitor)&PLATFORM=arm32] CONFIG_FB (y/n)
-
-% Framebuffer support
-! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=monitor)&PLATFORM=sparc64&MACHINE=generic] CONFIG_FB (y/n)
-
-% Default framebuffer mode
-@ "640x480"
-@ "800x600"
-@ "1024x768"
-@ "1152x720"
-@ "1152x864"
-@ "1280x720"
-@ "1280x800"
-@ "1280x960"
-@ "1280x1024"
-@ "1400x1050"
-@ "1440x900"
-@ "1440x1050"
-@ "1600x1200"
-@ "1920x1080"
-@ "1920x1200"
-! [(PLATFORM=ia32|PLATFORM=amd64|MACHINE=beagleboardxm)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_MODE (choice)
-
-% Default framebuffer depth
-@ "8"
-@ "16"
-@ "24"
-@ "32"
-! [(PLATFORM=ia32|PLATFORM=amd64|MACHINE=beagleboardxm)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_BPP (choice)
-
-% Window system
-! [CONFIG_FB=y] CONFIG_WINSYS (y/n)
-
-% Display double buffering
-! [CONFIG_WINSYS=y] CONFIG_DISP_DOUBLE_BUF (y/n)
-
-% Client-side UI rendering
-! CONFIG_UI_CS_RENDER (y/n)
-
-% Window double buffering
-! [CONFIG_UI_CS_RENDER=y] CONFIG_WIN_DOUBLE_BUF (n/y)
-
-% Start AP processors by the loader
-! [PLATFORM=sparc64&CONFIG_SMP=y] CONFIG_AP (y/n)
-
-% Dynamic linking support
-! [PLATFORM=amd64|PLATFORM=arm32|PLATFORM=ia32|PLATFORM=ia64|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_RTLD (y/n)
-! [PLATFORM=abs32le|PLATFORM=arm64|PLATFORM=mips32|PLATFORM=riscv64] CONFIG_RTLD (n)
-
-% Build shared libraries
-! [CONFIG_RTLD=y] CONFIG_BUILD_SHARED_LIBS (n/y)
-! [CONFIG_RTLD=n] CONFIG_BUILD_SHARED_LIBS (n)
-
-% Link against shared libraries
-! [CONFIG_BUILD_SHARED_LIBS=y] CONFIG_USE_SHARED_LIBS (n/y)
-! [CONFIG_BUILD_SHARED_LIBS=n] CONFIG_USE_SHARED_LIBS (n)
-
-% Launch (devman) test drivers
-! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)
-
-% Write core files
-! CONFIG_WRITE_CORE_FILES (n/y)
-
-% Include userspace unit tests (PCUT)
-! CONFIG_PCUT_TESTS (n/y)
-
-% Include PCUT self-tests
-! CONFIG_PCUT_SELF_TESTS (n/y)
-
-% Include development files (headers, libraries)
-! CONFIG_DEVEL_FILES (n/y)
-
-% Strip binaries
-! CONFIG_STRIP_BINARIES (n/y)
-
-% Strip revision information (helpful when comparing outputs)
-! CONFIG_STRIP_REVISION_INFO (n/y)
-
-% Optimization level
-@ "3" Level 3 (recommended).
-@ "2" Level 2.
-@ "1" Level 1.
-@ "0" Disable optimizations.
-@ "s" Optimize for size.
-@ "g" Enable only optimizations that don't harm debugging.
-@ "fast" Level 3 + aggressive optimizations that can affect adherence to standards.
-! OPTIMIZATION (choice)
-
-% Barebone build with essential binaries only
-! CONFIG_BAREBONE (n/y)
-
-% Line debugging information
-! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)
-
-# USB settings
-
-% Start virtual USB host controller
-! CONFIG_RUN_VIRTUAL_USB_HC (n/y)
-
-% OHCI root hub port power switching
-@ "no" All root hub ports are always powered.
-@ "ganged" Root hub ports are all powered or all off.
-@ "per_port" Powered status of every root hub port is independent.
-! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ppc32] OHCI_POWER_SWITCH (choice)
-
-% GRUB boot loader architecture
-@ "pc" GRUB for PC
-@ "efi" GRUB for UEFI
-! [PLATFORM=ia32|PLATFORM=amd64] GRUB_ARCH (choice)
-
-% GRUB boot loader architecture
-@ "efi" GRUB for UEFI
-! [PLATFORM=arm64&MACHINE=virt] GRUB_ARCH (choice)
-
-% uImage OS type
-@ "2" NetBSD stage 2 boot loader
-! [PLATFORM=arm32&(MACHINE=beagleboardxm|MACHINE=beaglebone)] UIMAGE_OS (choice)
-
-% uImage OS type
-@ "5" Linux kernel
-! [PLATFORM=arm32&MACHINE!=beagleboardxm&MACHINE!=beaglebone] UIMAGE_OS (choice)
Index: kefile
===================================================================
--- Makefile	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CSCOPE = cscope
-FORMAT = clang-format
-
-ERRNO_HEADER = abi/include/abi/errno.h
-ERRNO_INPUT = abi/include/abi/errno.in
-
-.PHONY: nothing cscope cscope_parts format ccheck ccheck-fix space check_errno
-
-nothing:
-
-cscope:
-	find abi kernel boot uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE).out
-
-cscope_parts:
-	find abi -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_abi.out
-	find kernel -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_kernel.out
-	find boot -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_boot.out
-	find uspace -type f -regex '^.*\.[chsS]$$' | xargs $(CSCOPE) -b -k -u -f$(CSCOPE)_uspace.out
-
-format:
-	find abi kernel boot uspace -type f -regex '^.*\.[ch]$$' | xargs $(FORMAT) -i -sort-includes -style=file
-
-ccheck:
-	cd tools && ./build-ccheck.sh
-	tools/ccheck.sh
-
-ccheck-fix:
-	cd tools && ./build-ccheck.sh
-	tools/ccheck.sh --fix
-
-space:
-	tools/srepl '[ \t]\+$$' ''
-
-# `sed` pulls a list of "compatibility-only" error codes from `errno.in`,
-# the following grep finds instances of those error codes in HelenOS code.
-check_errno:
-	@ ! cat abi/include/abi/errno.in | \
-	sed -n -e '1,/COMPAT_START/d' -e 's/__errno_entry(\([A-Z0-9]\+\).*/\\b\1\\b/p' | \
-	git grep -n -f - -- ':(exclude)abi' ':(exclude)uspace/lib/posix'
-
-$(ERRNO_HEADER): $(ERRNO_INPUT)
-	echo '/* Generated file. Edit errno.in instead. */' > $@.new
-	sed 's/__errno_entry(\([^,]*\),\([^,]*\),.*/#define \1 __errno_t(\2)/' < $< >> $@.new
-	mv $@.new $@
Index: ADME.md
===================================================================
--- README.md	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-# HelenOS
-
-HelenOS is a portable microkernel-based multiserver operating
-system designed and implemented from scratch. It decomposes key
-operating system functionality such as file systems, networking,
-device drivers and graphical user interface into a collection of
-fine-grained user space components that interact with each other
-via message passing. A failure or crash of one component does not
-directly harm others. HelenOS is therefore flexible, modular,
-extensible, fault tolerant and easy to understand.
-
-![screenshot](https://www.helenos.org/raw-attachment/wiki/Screenshots/gui-14.1-aio.png "Screenshot")
-
-HelenOS aims to be compatible with the C11 and C++14 standards, but does not
-aspire to be a clone of any existing operating system and trades compatibility
-with legacy APIs for cleaner design. Most of HelenOS components have been made
-to order specifically for HelenOS so that its essential parts can stay free of
-adaptation layers, glue code, franken-components and the maintenance burden
-incurred by them.
-
-* [Website](https://helenos.org)
-* [Wiki](https://helenos.org/wiki)
-* [Tickets](https://www.helenos.org/report/1)
-* [How to contribute](https://www.helenos.org/wiki/HowToContribute)
-
-## Portability
-
-HelenOS runs on eight different processor architectures and machines ranging
-from embedded ARM devices and single-board computers through multicore 32-bit
-and 64-bit desktop PCs to 64-bit Itanium and SPARC rack-mount servers.
-
-## Building
-
-### Building the toolchain
-
-In order to build HelenOS, one must first build the cross-compiler toolchain
-(the default installation location can be overridden by specifying the
-`CROSS_PREFIX` environment variable) by running (example for the amd64
-architecture, further list of targets can be found in the `default` directory):
-
-```
-$ cd HelenOS/tools
-$ ./toolchain.sh amd64
-```
-
-The toolchain script will print a list of software packages that are required
-for the toolchain to correctly build. Make sure you install all the dependencies.
-Unfortunately, the script cannot install the required dependencies for you automatically
-since the host environments are very diverse. In case the compilation of the toolchain
-fails half way through, try to analyze the error message(s), add appropriate missing
-dependencies and try again.
-
-As an example, here are some of the packages you will need for Ubuntu 16.04:
-
-```
-$ sudo apt install build-essential wget texinfo flex bison dialog python-yaml genisoimage
-```
-
-Whereas for CentOS/Fedora, you will need:
-
-```
-# sudo dnf group install 'Development Tools'
-# sudo dnf install wget texinfo PyYAML genisoimage flex bison
-```
-
-In case the toolchain script won't work no matter how hard you try, let us know.
-Please supply as many relevant information (your OS and distribution, list of
-installed packages with version information, the output of the toolchain script, etc.) as
-possible.
-
-### Configuring the build
-
-Since the summer of 2019, HelenOS uses the Meson build system.
-Make sure you have a recent-enough version of Meson and Ninja.
-The safest bet is installing both using `pip3` tool.
-
-```sh
-$ pip3 install ninja
-$ pip3 install meson
-```
-
-Meson does not support in-tree builds, so you have to create a directory
-for your build. You can have as many build directories as you want, each with
-its own configuration. `cd` into your build directory and run `configure.sh`
-script which exists in the source root. `configure.sh` can be run with a profile
-name, to use one of the predefined profiles, or without arguments for interactive
-configuration.
-
-```sh
-$ git clone https://github.com/HelenOS/helenos.git
-$ mkdir -p build/amd64
-$ cd build/amd64
-$ ../../helenos/configure.sh amd64
-```
-
-Note: If you installed the toolchain to a custom directory, make sure `CROSS_PREFIX`
-environment variable is correctly set.
-
-Once configuration is finished, use `ninja` to build HelenOS.
-Invoking `ninja` without arguments builds all binaries and
-debug files, but not bootable image. This is because during
-development, most builds are incremental and only meant to check
-that code builds properly. In this case, the time-consuming process of
-creating a boot image is not useful and takes most time. This behavior
-might change in the future.
-
-In case you want to rebuild the bootable image, you must invoke
-`ninja image_path`. This also emits the name of the bootable image into the
-file `image_path` in build directory.
-
-```
-$ ninja
-$ ninja image_path
-```
-
-Now HelenOS should automatically start building.
-
-### Running the OS
-
-When you get the command line back, there should be an `image.iso` file in the build
-root directory. If you have QEMU, you should be able to start HelenOS by running:
-
-```
-$ ./tools/ew.py
-```
-
-For additional information about running HelenOS, see
-[UsersGuide/RunningInQEMU](https://www.helenos.org/wiki/UsersGuide/RunningInQEMU) or
-[UsersGuide/RunningInVirtualBox](https://www.helenos.org/wiki/UsersGuide/RunningInVirtualBox) or
-see the files in tools/conf.
-
-## Contributing
-
-There is a whole section of our wiki devoted to
-[how to contribute to HelenOS](https://www.helenos.org/wiki/HowToContribute).
-But to highlight the most important points, you should subscribe to
-our mailing list and if you have an idea for contributing, discuss it
-with us first so that we can agree upon the design.
-
-Especially if you are a first time contributor, blindingly shooting
-a pull request may result in it being closed on the grounds that it
-does not fit well within the grand scheme of things. That would not
-be efficient use of time.
-
-Communicating early and often is the key to successful acceptance of
-your patch/PR.
-
-## License
-
-HelenOS is open source, free software. Its source code is available under
-the BSD license. Some third-party components are licensed under GPL.
Index: i/arch/abs32le/include/abi/arch/elf.h
===================================================================
--- abi/arch/abs32le/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_abs32le_ELF_H_
-#define _ABI_abs32le_ELF_H_
-
-#define ELF_MACHINE        EM_NO
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS32
-
-#endif
-
-/** @}
- */
Index: i/arch/amd64/include/abi/arch/elf.h
===================================================================
--- abi/arch/amd64/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_amd64_ELF_H_
-#define _ABI_amd64_ELF_H_
-
-#define ELF_MACHINE        EM_X86_64
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS64
-
-#endif
-
-/** @}
- */
Index: i/arch/arm32/include/abi/arch/elf.h
===================================================================
--- abi/arch/arm32/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_arm32
- * @{
- */
-/** @file
- *  @brief ARM ELF constants.
- */
-
-#ifndef _ABI_arm32_ELF_H_
-#define _ABI_arm32_ELF_H_
-
-#define ELF_MACHINE  EM_ARM
-
-#ifdef __BE__
-#define ELF_DATA_ENCODING  ELFDATA2MSB
-#else
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#endif
-
-#define ELF_CLASS  ELFCLASS32
-
-#endif
-
-/** @}
- */
Index: i/arch/arm64/include/abi/arch/elf.h
===================================================================
--- abi/arch/arm64/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_arm64
- * @{
- */
-/** @file
- * @brief ARM64 ELF constants.
- */
-
-#ifndef _ABI_arm64_ELF_H_
-#define _ABI_arm64_ELF_H_
-
-#define ELF_MACHINE        EM_AARCH64
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS64
-
-#define R_AARCH64_RELATIVE  1027
-
-#endif
-
-/** @}
- */
Index: i/arch/ia32/include/abi/arch/elf.h
===================================================================
--- abi/arch/ia32/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_ia32_ELF_H_
-#define _ABI_ia32_ELF_H_
-
-#define ELF_MACHINE        EM_386
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS32
-
-#endif
-
-/** @}
- */
Index: i/arch/ia64/include/abi/arch/elf.h
===================================================================
--- abi/arch/ia64/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_ia64_ELF_H_
-#define _ABI_ia64_ELF_H_
-
-#define ELF_MACHINE        EM_IA_64
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS64
-
-#endif
-
-/** @}
- */
Index: i/arch/mips32/include/abi/arch/elf.h
===================================================================
--- abi/arch/mips32/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_mips32_ELF_H_
-#define _ABI_mips32_ELF_H_
-
-#define ELF_MACHINE  EM_MIPS
-
-#ifdef __BE__
-#define ELF_DATA_ENCODING  ELFDATA2MSB
-#else
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#endif
-
-#define ELF_CLASS  ELFCLASS32
-
-#endif
-
-/** @}
- */
Index: i/arch/ppc32/include/abi/arch/elf.h
===================================================================
--- abi/arch/ppc32/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_ppc32_ELF_H_
-#define _ABI_ppc32_ELF_H_
-
-#define ELF_MACHINE        EM_PPC
-#define ELF_DATA_ENCODING  ELFDATA2MSB
-#define ELF_CLASS          ELFCLASS32
-
-#endif
-
-/** @}
- */
Index: i/arch/riscv64/include/abi/arch/elf.h
===================================================================
--- abi/arch/riscv64/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_riscv64_ELF_H_
-#define _ABI_riscv64_ELF_H_
-
-#define ELF_MACHINE        EM_RISCV
-#define ELF_DATA_ENCODING  ELFDATA2LSB
-#define ELF_CLASS          ELFCLASS64
-
-#endif
-
-/** @}
- */
Index: i/arch/sparc64/include/abi/arch/elf.h
===================================================================
--- abi/arch/sparc64/include/abi/arch/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_sparc64_ELF_H_
-#define _ABI_sparc64_ELF_H_
-
-#define ELF_MACHINE        EM_SPARCV9
-#define ELF_DATA_ENCODING  ELFDATA2MSB
-#define ELF_CLASS          ELFCLASS64
-
-#endif
-
-/** @}
- */
Index: i/doc/doxygroups.h
===================================================================
--- abi/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/* Definitions of modules and its relations for generating Doxygen documentation */
-
-/** @defgroup abi abi
- * @brief Header files shared by the kernel and uspace
- */
-
-/** @addtogroup bits _bits
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_generic generic
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_abs32le abs32le
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_amd64 amd64
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_arm32 arm32
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_arm64 arm64
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_ia32 ia32
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_ia64 ia64
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_mips32 mips32
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_ppc32 ppc32
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_riscv64 riscv64
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_sparc64 sparc64
- * @ingroup abi
- */
-
-/**
- * @defgroup abi_genarch genarch
- * @ingroup abi
- */
Index: i/include/_bits/NULL.h
===================================================================
--- abi/include/_bits/NULL.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- * Definition of constant NULL.
- */
-
-#ifndef _BITS_NULL_H_
-#define _BITS_NULL_H_
-
-#define __need_NULL
-#include <stddef.h>
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/WEOF.h
===================================================================
--- abi/include/_bits/WEOF.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WEOF_H_
-#define _BITS_WEOF_H_
-
-/* wint_t is always int */
-
-#define WEOF  (-1)
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/__noreturn.h
===================================================================
--- abi/include/_bits/__noreturn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- * Definition of __noreturn.
- *
- * Expands to the most appropriate noreturn attribute for a given language.
- */
-
-#ifndef _BITS_NORETURN_H_
-#define _BITS_NORETURN_H_
-
-#ifndef __noreturn
-
-#if (__GNUC__ >= 3) || (defined(__clang__) && __has_attribute(noreturn))
-#define __noreturn __attribute__((noreturn))
-#else
-#define __noreturn
-#endif
-
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/__opaque_handle.h
===================================================================
--- abi/include/_bits/__opaque_handle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-
-#ifndef _BITS_OPAQUE_HANDLE_H_
-#define _BITS_OPAQUE_HANDLE_H_
-
-#define __opaque_handle(__name) typedef struct __opaque_##__name *__name
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/all.h
===================================================================
--- abi/include/_bits/all.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_ALL_H_
-#define _BITS_ALL_H_
-
-#include <inttypes.h>
-#include <limits.h>
-#include <stddef.h>
-
-#include <_bits/native.h>
-#include <_bits/ssize_t.h>
-#include <_bits/wint_t.h>
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/decls.h
===================================================================
--- abi/include/_bits/decls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2019 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_DECLS_H_
-#define _BITS_DECLS_H_
-
-#ifdef __cplusplus
-
-#define __HELENOS_DECLS_BEGIN \
-	namespace helenos { \
-	extern "C" {
-
-#define __HELENOS_DECLS_END \
-	} \
-	}
-
-#define __C_DECLS_BEGIN \
-	extern "C" {
-
-#define __C_DECLS_END \
-	}
-
-#else  /* !__cplusplus */
-
-#define __HELENOS_DECLS_BEGIN
-#define __HELENOS_DECLS_END
-#define __C_DECLS_BEGIN
-#define __C_DECLS_END
-
-#endif  /* __cplusplus */
-
-/*
- * __CONSTEXPR for headers shared by C and C++. Headers that are purely for
- * C++ sources should use constexpr directly.
- */
-#ifdef __cplusplus
-#define __CONSTEXPR constexpr
-#else
-#define __CONSTEXPR
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/errno.h
===================================================================
--- abi/include/_bits/errno.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_ERRNO_H_
-#define _BITS_ERRNO_H_
-
-#include <_bits/native.h>
-#include <_bits/decls.h>
-
-#ifdef __OPAQUE_ERRNO__
-#include <_bits/__opaque_handle.h>
-
-__HELENOS_DECLS_BEGIN;
-__opaque_handle(errno_t);
-typedef errno_t sys_errno_t;
-__HELENOS_DECLS_END;
-
-#define __errno_t(val) ((errno_t) val)
-
-#else
-
-__HELENOS_DECLS_BEGIN;
-
-/**
- * The type of <errno.h> constants. Normally, this is an alias for `int`,
- * but we support an alternative definition that allows us to verify
- * integrity of error handling without using external tools.
- */
-typedef int errno_t;
-
-/**
- * Same as `errno_t`, except represented as `sysarg_t`. Used in kernel in
- * places where error number is always passed, but the type must be `sysarg_t`.
- */
-typedef sysarg_t sys_errno_t;
-
-__HELENOS_DECLS_END;
-
-/**
- * A C++-style "cast" to `errno_t`.
- * Used in <abi/errno.h> to define error constants. Normally, it doesn't do
- * anything at all.
- */
-#define __errno_t(val) val
-
-#endif
-
-#endif
Index: i/include/_bits/int128_t.h
===================================================================
--- abi/include/_bits/int128_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- * Define nonstandard 128-bit types if they are supported by the compiler.
- * GCC only provides this on some architectures. We use it on IA-64.
- */
-
-#ifndef _BITS_INT128_T_H_
-#define _BITS_INT128_T_H_
-
-#ifdef __SIZEOF_INT128__
-typedef __int128 int128_t;
-typedef unsigned __int128 uint128_t;
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/mbstate_t.h
===================================================================
--- abi/include/_bits/mbstate_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_MBSTATE_T_H_
-#define _BITS_MBSTATE_T_H_
-
-typedef struct {
-	unsigned short state;
-} mbstate_t;
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/native.h
===================================================================
--- abi/include/_bits/native.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- * A bunch of type aliases HelenOS code uses.
- *
- * They were originally defined as either u/int32_t or u/int64_t,
- * specifically for each architecture, but in practice they are
- * currently assumed to be identical to u/intptr_t, so we do just that.
- */
-
-#ifndef _BITS_NATIVE_H_
-#define _BITS_NATIVE_H_
-
-#include <inttypes.h>
-#include <_bits/decls.h>
-
-__HELENOS_DECLS_BEGIN;
-
-typedef uintptr_t pfn_t;
-typedef uintptr_t ipl_t;
-typedef uintptr_t sysarg_t;
-typedef intptr_t  native_t;
-
-#ifdef KERNEL
-
-typedef sysarg_t uspace_addr_t;
-/* We might implement a way to check validity of the type some day. */
-#define uspace_ptr(type) uspace_addr_t
-#define USPACE_NULL 0
-
-#else /* !KERNEL */
-
-typedef void *uspace_addr_t;
-#define uspace_ptr(type) type *
-
-#endif
-
-// TODO: Put this in a better location.
-#define uspace_ptr_as_area_info_t uspace_ptr(as_area_info_t)
-#define uspace_ptr_as_area_pager_info_t uspace_ptr(as_area_pager_info_t)
-#define uspace_ptr_cap_irq_handle_t uspace_ptr(cap_irq_handle_t)
-#define uspace_ptr_cap_phone_handle_t uspace_ptr(cap_phone_handle_t)
-#define uspace_ptr_cap_waitq_handle_t uspace_ptr(cap_waitq_handle_t)
-#define uspace_ptr_char uspace_ptr(char)
-#define uspace_ptr_const_char uspace_ptr(const char)
-#define uspace_ptr_ddi_ioarg_t uspace_ptr(ddi_ioarg_t)
-#define uspace_ptr_ipc_data_t uspace_ptr(ipc_data_t)
-#define uspace_ptr_irq_code_t uspace_ptr(irq_code_t)
-#define uspace_ptr_size_t uspace_ptr(size_t)
-#define uspace_ptr_struct_uspace_arg uspace_ptr(struct uspace_arg)
-#define uspace_ptr_sysarg64_t uspace_ptr(sysarg64_t)
-#define uspace_ptr_task_id_t uspace_ptr(task_id_t)
-#define uspace_ptr_thread_id_t uspace_ptr(thread_id_t)
-#define uspace_ptr_uintptr_t uspace_ptr(uintptr_t)
-#define uspace_ptr_uspace_arg_t uspace_ptr(uspace_arg_t)
-#define uspace_ptr_uspace_thread_function_t uspace_ptr(uspace_thread_function_t)
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/off64_t.h
===================================================================
--- abi/include/_bits/off64_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_OFF64_T_H_
-#define _BITS_OFF64_T_H_
-
-#include <stdint.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-typedef int64_t off64_t;
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/ptrdiff_t.h
===================================================================
--- abi/include/_bits/ptrdiff_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_PTRDIFF_T_H_
-#define _BITS_PTRDIFF_T_H_
-
-#define __need_ptrdiff_t
-#include <stddef.h>
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/size_t.h
===================================================================
--- abi/include/_bits/size_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_SIZE_T_H_
-#define _BITS_SIZE_T_H_
-
-#define __need_size_t
-#include <stddef.h>
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/ssize_t.h
===================================================================
--- abi/include/_bits/ssize_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_SSIZE_T_H_
-#define _BITS_SSIZE_T_H_
-
-#include <stdint.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-typedef intptr_t ssize_t;
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/uchar.h
===================================================================
--- abi/include/_bits/uchar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2020 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_UCHAR_H_
-#define _BITS_UCHAR_H_
-
-#include <stdint.h>
-
-/*
- * char8_t became part of C++ with C++20.
- * It is part of C23 hence we define it for C compilations only.
- */
-#ifndef __cplusplus
-typedef uint8_t char8_t;
-#endif
-
-typedef uint_least16_t char16_t;
-typedef uint_least32_t char32_t;
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/wchar_limits.h
===================================================================
--- abi/include/_bits/wchar_limits.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WCHAR_LIMITS_H_
-#define _BITS_WCHAR_LIMITS_H_
-
-/* wchar_t should always be int32_t in HelenOS. */
-
-#include <_bits/wchar_t.h>
-
-#ifndef __cplusplus
-_Static_assert(((wchar_t) -1) < 0, "wchar_t is not int32_t");
-_Static_assert(sizeof(wchar_t) == 4, "wchar_t is not int32_t");
-#endif
-
-#ifndef WCHAR_MAX
-#define WCHAR_MAX  0x7fffffff
-#endif
-#ifndef WCHAR_MIN
-#define WCHAR_MIN  (-WCHAR_MIN - 1)
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/wchar_t.h
===================================================================
--- abi/include/_bits/wchar_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WCHAR_T_H_
-#define _BITS_WCHAR_T_H_
-
-#define __need_wchar_t
-#include <stddef.h>
-
-#endif
-
-/** @}
- */
Index: i/include/_bits/wint_t.h
===================================================================
--- abi/include/_bits/wint_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_WINT_T_H_
-#define _BITS_WINT_T_H_
-
-#define __need_wint_t
-#include <stddef.h>
-
-#endif
-
-/** @}
- */
Index: i/include/abi/asmtool.h
===================================================================
--- abi/include/abi/asmtool.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_ASMTOOL_H_
-#define _ABI_ASMTOOL_H_
-
-#define SYMBOL(sym) \
-	.global sym; \
-	sym:
-#define SYMBOL_BEGIN(sym) \
-	SYMBOL(sym)
-#define SYMBOL_END(sym) \
-	.size sym, . - sym
-
-#define OBJECT_BEGIN(obj) \
-	.type obj STT_OBJECT; \
-	SYMBOL_BEGIN(obj)
-#define OBJECT_END(obj) \
-	SYMBOL_END(obj)
-
-#define FUNCTION_BEGIN(func) \
-	.type func STT_FUNC; \
-	SYMBOL_BEGIN(func)
-#define FUNCTION_END(func) \
-	SYMBOL_END(func)
-
-#ifdef __PIC__
-#define FUNCTION_REF(func) func@PLT
-#else
-#define FUNCTION_REF(func) func
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/abi/cap.h
===================================================================
--- abi/include/abi/cap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_CAP_H_
-#define _ABI_CAP_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-typedef void *cap_handle_t;
-
-typedef struct {
-} *cap_call_handle_t;
-
-typedef struct {
-} *cap_phone_handle_t;
-
-typedef struct {
-} *cap_irq_handle_t;
-
-typedef struct {
-} *cap_waitq_handle_t;
-
-static cap_handle_t const CAP_NIL = 0;
-
-static inline bool cap_handle_valid(cap_handle_t handle)
-{
-	return handle != CAP_NIL;
-}
-
-static inline intptr_t cap_handle_raw(cap_handle_t handle)
-{
-	return (intptr_t) handle;
-}
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ddi/arg.h
===================================================================
--- abi/include/abi/ddi/arg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_DDI_ARG_H_
-#define _ABI_DDI_ARG_H_
-
-#include <stdint.h>
-
-enum {
-	DMAMEM_FLAGS_ANONYMOUS = 0x01,
-};
-
-/** Structure encapsulating arguments for SYS_PHYSMEM_MAP syscall. */
-typedef struct {
-	/** ID of the destination task. */
-	uint64_t task_id;
-	/** Physical address of starting frame. */
-	void *phys_base;
-	/** Virtual address of starting page. */
-	void *virt_base;
-	/** Number of pages to map. */
-	size_t pages;
-	/** Address space area flags for the mapping. */
-	unsigned int flags;
-} ddi_memarg_t;
-
-/** Structure encapsulating arguments for SYS_ENABLE_IOSPACE syscall. */
-typedef struct {
-	uint64_t task_id;  /**< ID of the destination task. */
-	void *ioaddr;      /**< Starting I/O space address. */
-	size_t size;       /**< Number of bytes. */
-} ddi_ioarg_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ddi/irq.h
===================================================================
--- abi/include/abi/ddi/irq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_DDI_IRQ_H_
-#define _ABI_DDI_IRQ_H_
-
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t base;
-	size_t size;
-} irq_pio_range_t;
-
-typedef enum {
-	/** Read 1 byte from the I/O space.
-	 *
-	 * *addr(8) -> scratch[dstarg]
-	 */
-	CMD_PIO_READ_8 = 1,
-
-	/** Read 2 bytes from the I/O space.
-	 *
-	 * *addr(16) -> scratch[dstarg]
-	 */
-	CMD_PIO_READ_16,
-
-	/** Read 4 bytes from the I/O space.
-	 *
-	 * *addr(32) -> scratch[dstarg]
-	 */
-	CMD_PIO_READ_32,
-
-	/** Write 1 byte to the I/O space.
-	 *
-	 * value(8) -> *addr
-	 */
-	CMD_PIO_WRITE_8,
-
-	/** Write 2 bytes to the I/O space.
-	 *
-	 * value(16) -> *addr
-	 */
-	CMD_PIO_WRITE_16,
-
-	/** Write 4 bytes to the I/O space.
-	 *
-	 * value(32) -> *addr
-	 */
-	CMD_PIO_WRITE_32,
-
-	/** Write 1 byte to the I/O space.
-	 *
-	 * scratch[srcarg](8) -> *addr
-	 */
-	CMD_PIO_WRITE_A_8,
-
-	/** Write 2 bytes to the I/O space.
-	 *
-	 * scratch[srcarg](16) -> *addr
-	 */
-	CMD_PIO_WRITE_A_16,
-
-	/** Write 4 bytes to the I/O space.
-	 *
-	 * scratch[srcarg](32) -> *addr
-	 */
-	CMD_PIO_WRITE_A_32,
-
-	/** Load value.
-	 *
-	 * value -> scratch[dstarg]
-	 */
-	CMD_LOAD,
-
-	/** Perform bitwise conjunction.
-	 *
-	 * scratch[srcarg] & value -> scratch[dstarg]
-	 */
-	CMD_AND,
-
-	/** Predicate the execution of the following commands.
-	 *
-	 * if (scratch[srcarg] == 0)
-	 *  (skip the following 'value' commands)
-	 */
-	CMD_PREDICATE,
-
-	/** Accept the interrupt. */
-	CMD_ACCEPT,
-
-	/** Decline the interrupt. */
-	CMD_DECLINE,
-	CMD_LAST
-} irq_cmd_type;
-
-typedef struct {
-	irq_cmd_type cmd;
-	void *addr;
-	uint32_t value;
-	uintptr_t srcarg;
-	uintptr_t dstarg;
-} irq_cmd_t;
-
-typedef struct {
-	size_t rangecount;
-	irq_pio_range_t *ranges;
-	size_t cmdcount;
-	irq_cmd_t *cmds;
-} irq_code_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/elf.h
===================================================================
--- abi/include/abi/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,536 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_ELF_H_
-#define _ABI_ELF_H_
-
-#include <stdint.h>
-#include <abi/arch/elf.h>
-
-/**
- * Current ELF version
- */
-enum {
-	EV_CURRENT = 1,
-};
-
-/**
- * ELF types
- */
-enum elf_type {
-	ET_NONE   = 0,       /* No type */
-	ET_REL    = 1,       /* Relocatable file */
-	ET_EXEC   = 2,       /* Executable */
-	ET_DYN    = 3,       /* Shared object */
-	ET_CORE   = 4,       /* Core */
-};
-
-enum {
-	ET_LOPROC = 0xff00,  /* Lowest processor specific */
-	ET_HIPROC = 0xffff,  /* Highest processor specific */
-};
-
-/**
- * ELF machine types
- */
-enum elf_machine {
-	EM_NO          = 0,    /* No machine */
-	EM_SPARC       = 2,    /* SPARC */
-	EM_386         = 3,    /* i386 */
-	EM_MIPS        = 8,    /* MIPS RS3000 */
-	EM_MIPS_RS3_LE = 10,   /* MIPS RS3000 LE */
-	EM_PPC         = 20,   /* PPC32 */
-	EM_PPC64       = 21,   /* PPC64 */
-	EM_ARM         = 40,   /* ARM */
-	EM_SPARCV9     = 43,   /* SPARC64 */
-	EM_IA_64       = 50,   /* IA-64 */
-	EM_X86_64      = 62,   /* AMD64/EMT64 */
-	EM_AARCH64     = 183,  /* ARM 64-bit architecture */
-	EM_RISCV       = 243,  /* RISC-V */
-};
-
-/**
- * ELF identification indexes
- */
-enum {
-	EI_MAG0       = 0,
-	EI_MAG1       = 1,
-	EI_MAG2       = 2,
-	EI_MAG3       = 3,
-	EI_CLASS      = 4,   /* File class */
-	EI_DATA       = 5,   /* Data encoding */
-	EI_VERSION    = 6,   /* File version */
-	EI_OSABI      = 7,
-	EI_ABIVERSION = 8,
-	EI_PAD        = 9,   /* Start of padding bytes */
-	EI_NIDENT     = 16,  /* ELF identification table size */
-};
-
-/**
- * ELF magic number
- */
-enum {
-	ELFMAG0 = 0x7f,
-	ELFMAG1 = 'E',
-	ELFMAG2 = 'L',
-	ELFMAG3 = 'F',
-};
-
-/**
- * ELF file classes
- */
-enum elf_class {
-	ELFCLASSNONE = 0,
-	ELFCLASS32   = 1,
-	ELFCLASS64   = 2,
-};
-
-/**
- * ELF data encoding types
- */
-enum elf_data_encoding {
-	ELFDATANONE = 0,
-	ELFDATA2LSB = 1,  /* Least significant byte first (little endian) */
-	ELFDATA2MSB = 2,  /* Most signigicant byte first (big endian) */
-};
-
-/**
- * ELF section types
- */
-enum elf_section_type {
-	SHT_NULL     = 0,
-	SHT_PROGBITS = 1,
-	SHT_SYMTAB   = 2,
-	SHT_STRTAB   = 3,
-	SHT_RELA     = 4,
-	SHT_HASH     = 5,
-	SHT_DYNAMIC  = 6,
-	SHT_NOTE     = 7,
-	SHT_NOBITS   = 8,
-	SHT_REL      = 9,
-	SHT_SHLIB    = 10,
-	SHT_DYNSYM   = 11,
-};
-
-enum {
-	SHT_LOOS     = 0x60000000,
-	SHT_HIOS     = 0x6fffffff,
-	SHT_LOPROC   = 0x70000000,
-	SHT_HIPROC   = 0x7fffffff,
-	SHT_LOUSER   = 0x80000000,
-	SHT_HIUSER   = 0xffffffff,
-};
-
-/**
- * ELF section flags
- */
-enum {
-	SHF_WRITE     = 0x1,
-	SHF_ALLOC     = 0x2,
-	SHF_EXECINSTR = 0x4,
-	SHF_TLS       = 0x400,
-	SHF_MASKPROC  = 0xf0000000,
-};
-
-/** Functions for decomposing elf_symbol.st_info into binding and type */
-static inline uint8_t elf_st_bind(uint8_t info)
-{
-	return info >> 4;
-}
-
-static inline uint8_t elf_st_type(uint8_t info)
-{
-	return info & 0x0f;
-}
-
-static inline uint8_t elf_st_info(uint8_t bind, uint8_t type)
-{
-	return (bind << 4) | (type & 0x0f);
-}
-
-/**
- * Symbol binding
- */
-enum elf_symbol_binding {
-	STB_LOCAL  = 0,
-	STB_GLOBAL = 1,
-	STB_WEAK   = 2,
-};
-
-enum {
-	STB_LOPROC = 13,
-	STB_HIPROC = 15,
-};
-
-/**
- * Symbol types
- */
-enum elf_symbol_type {
-	STT_NOTYPE  = 0,
-	STT_OBJECT  = 1,
-	STT_FUNC    = 2,
-	STT_SECTION = 3,
-	STT_FILE    = 4,
-	STT_TLS     = 6,
-};
-
-enum {
-	STT_LOPROC  = 13,
-	STT_HIPROC  = 15,
-};
-
-/**
- * Program segment types
- */
-enum elf_segment_type {
-	PT_NULL         = 0,
-	PT_LOAD         = 1,
-	PT_DYNAMIC      = 2,
-	PT_INTERP       = 3,
-	PT_NOTE         = 4,
-	PT_SHLIB        = 5,
-	PT_PHDR         = 6,
-	PT_TLS          = 7,
-
-	PT_GNU_EH_FRAME = 0x6474e550,
-	PT_GNU_STACK    = 0x6474e551,
-	PT_GNU_RELRO    = 0x6474e552,
-};
-
-enum {
-	PT_LOOS   = 0x60000000,
-	PT_HIOS   = 0x6fffffff,
-	PT_LOPROC = 0x70000000,
-	PT_HIPROC = 0x7fffffff,
-};
-
-/**
- * Program segment attributes.
- */
-enum elf_segment_access {
-	PF_X = 1,
-	PF_W = 2,
-	PF_R = 4,
-};
-
-/**
- * Dynamic array tags
- */
-enum elf_dynamic_tag {
-	DT_NULL     = 0,
-	DT_NEEDED   = 1,
-	DT_PLTRELSZ = 2,
-	DT_PLTGOT   = 3,
-	DT_HASH     = 4,
-	DT_STRTAB   = 5,
-	DT_SYMTAB   = 6,
-	DT_RELA     = 7,
-	DT_RELASZ   = 8,
-	DT_RELAENT  = 9,
-	DT_STRSZ    = 10,
-	DT_SYMENT   = 11,
-	DT_INIT     = 12,
-	DT_FINI     = 13,
-	DT_SONAME   = 14,
-	DT_RPATH    = 15,
-	DT_SYMBOLIC = 16,
-	DT_REL      = 17,
-	DT_RELSZ    = 18,
-	DT_RELENT   = 19,
-	DT_PLTREL   = 20,
-	DT_DEBUG    = 21,
-	DT_TEXTREL  = 22,
-	DT_JMPREL   = 23,
-	DT_BIND_NOW = 24,
-	DT_LOPROC   = 0x70000000,
-	DT_HIPROC   = 0x7fffffff,
-};
-
-/**
- * Special section indexes
- */
-enum {
-	SHN_UNDEF     = 0,
-	SHN_LORESERVE = 0xff00,
-	SHN_LOPROC    = 0xff00,
-	SHN_HIPROC    = 0xff1f,
-	SHN_ABS       = 0xfff1,
-	SHN_COMMON    = 0xfff2,
-	SHN_HIRESERVE = 0xffff,
-};
-
-/**
- * Special symbol table index
- */
-enum {
-	STN_UNDEF = 0,
-};
-
-/**
- * ELF data types
- *
- * These types are found to be identical in both 32-bit and 64-bit
- * ELF object file specifications. They are the only types used
- * in ELF header.
- */
-typedef uint64_t elf_xword;
-typedef int64_t elf_sxword;
-typedef uint32_t elf_word;
-typedef int32_t elf_sword;
-typedef uint16_t elf_half;
-
-/**
- * 32-bit ELF data types.
- *
- * These types are specific for 32-bit format.
- */
-typedef uint32_t elf32_addr;
-typedef uint32_t elf32_off;
-
-/**
- * 64-bit ELF data types.
- *
- * These types are specific for 64-bit format.
- */
-typedef uint64_t elf64_addr;
-typedef uint64_t elf64_off;
-
-/** ELF header */
-struct elf32_header {
-	uint8_t e_ident[EI_NIDENT];
-	elf_half e_type;
-	elf_half e_machine;
-	elf_word e_version;
-	elf32_addr e_entry;
-	elf32_off e_phoff;
-	elf32_off e_shoff;
-	elf_word e_flags;
-	elf_half e_ehsize;
-	elf_half e_phentsize;
-	elf_half e_phnum;
-	elf_half e_shentsize;
-	elf_half e_shnum;
-	elf_half e_shstrndx;
-};
-
-struct elf64_header {
-	uint8_t e_ident[EI_NIDENT];
-	elf_half e_type;
-	elf_half e_machine;
-	elf_word e_version;
-	elf64_addr e_entry;
-	elf64_off e_phoff;
-	elf64_off e_shoff;
-	elf_word e_flags;
-	elf_half e_ehsize;
-	elf_half e_phentsize;
-	elf_half e_phnum;
-	elf_half e_shentsize;
-	elf_half e_shnum;
-	elf_half e_shstrndx;
-};
-
-/**
- * ELF segment header.
- * Segments headers are also known as program headers.
- */
-struct elf32_segment_header {
-	elf_word p_type;
-	elf32_off p_offset;
-	elf32_addr p_vaddr;
-	elf32_addr p_paddr;
-	elf_word p_filesz;
-	elf_word p_memsz;
-	elf_word p_flags;
-	elf_word p_align;
-};
-
-struct elf64_segment_header {
-	elf_word p_type;
-	elf_word p_flags;
-	elf64_off p_offset;
-	elf64_addr p_vaddr;
-	elf64_addr p_paddr;
-	elf_xword p_filesz;
-	elf_xword p_memsz;
-	elf_xword p_align;
-};
-
-/**
- * ELF section header
- */
-struct elf32_section_header {
-	elf_word sh_name;
-	elf_word sh_type;
-	elf_word sh_flags;
-	elf32_addr sh_addr;
-	elf32_off sh_offset;
-	elf_word sh_size;
-	elf_word sh_link;
-	elf_word sh_info;
-	elf_word sh_addralign;
-	elf_word sh_entsize;
-};
-
-struct elf64_section_header {
-	elf_word sh_name;
-	elf_word sh_type;
-	elf_xword sh_flags;
-	elf64_addr sh_addr;
-	elf64_off sh_offset;
-	elf_xword sh_size;
-	elf_word sh_link;
-	elf_word sh_info;
-	elf_xword sh_addralign;
-	elf_xword sh_entsize;
-};
-
-/**
- * ELF symbol table entry
- */
-struct elf32_symbol {
-	elf_word st_name;
-	elf32_addr st_value;
-	elf_word st_size;
-	uint8_t st_info;
-	uint8_t st_other;
-	elf_half st_shndx;
-};
-
-struct elf64_symbol {
-	elf_word st_name;
-	uint8_t st_info;
-	uint8_t st_other;
-	elf_half st_shndx;
-	elf64_addr st_value;
-	elf_xword st_size;
-};
-
-/*
- * ELF note segment entry
- */
-struct elf32_note {
-	elf_word namesz;
-	elf_word descsz;
-	elf_word type;
-};
-
-/*
- * NOTE: namesz, descsz and type should be 64-bits wide (elf_xword)
- * per the 64-bit ELF spec. The Linux kernel however screws up and
- * defines them as Elf64_Word, which is 32-bits wide(!). We are trying
- * to make our core files compatible with Linux GDB target so we copy
- * the blunder here.
- */
-struct elf64_note {
-	elf_word namesz;
-	elf_word descsz;
-	elf_word type;
-};
-
-/**
- * Dynamic structure
- */
-struct elf32_dyn {
-	elf_sword d_tag;
-	union {
-		elf_word d_val;
-		elf32_addr d_ptr;
-	} d_un;
-};
-
-struct elf64_dyn {
-	elf_sxword d_tag;
-	union {
-		elf_xword d_val;
-		elf64_addr d_ptr;
-	} d_un;
-};
-
-struct elf32_rel {
-	elf32_addr r_offset;
-	elf_word r_info;
-};
-
-struct elf32_rela {
-	elf32_addr r_offset;
-	elf_word r_info;
-	elf_sword r_addend;
-};
-
-struct elf64_rel {
-	elf64_addr r_offset;
-	elf_xword r_info;
-};
-
-struct elf64_rela {
-	elf64_addr r_offset;
-	elf_xword r_info;
-	elf_sxword r_addend;
-};
-
-#define ELF32_R_SYM(i) ((i) >> 8)
-#define ELF32_R_TYPE(i) ((unsigned char)(i))
-
-#define ELF64_R_SYM(i) ((i) >> 32)
-#define ELF64_R_TYPE(i) ((i) & 0xffffffffL)
-
-#ifdef __32_BITS__
-typedef struct elf32_header elf_header_t;
-typedef struct elf32_segment_header elf_segment_header_t;
-typedef struct elf32_section_header elf_section_header_t;
-typedef struct elf32_symbol elf_symbol_t;
-typedef struct elf32_note elf_note_t;
-typedef struct elf32_dyn elf_dyn_t;
-typedef struct elf32_rel elf_rel_t;
-typedef struct elf32_rela elf_rela_t;
-#define ELF_R_TYPE(i)  ELF32_R_TYPE(i)
-#endif
-
-#ifdef __64_BITS__
-typedef struct elf64_header elf_header_t;
-typedef struct elf64_segment_header elf_segment_header_t;
-typedef struct elf64_section_header elf_section_header_t;
-typedef struct elf64_symbol elf_symbol_t;
-typedef struct elf64_note elf_note_t;
-typedef struct elf64_dyn elf_dyn_t;
-typedef struct elf64_rel elf_rel_t;
-typedef struct elf64_rela elf_rela_t;
-#define ELF_R_TYPE(i)  ELF64_R_TYPE(i)
-#endif
-
-#endif
-
-/** @}
- */
Index: i/include/abi/errno.h
===================================================================
--- abi/include/abi/errno.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/* Generated file. Edit errno.in instead. */
-#define EOK             __errno_t(      0)
-#define ENOENT          __errno_t(      1)
-#define ENOMEM          __errno_t(      2)
-#define ELIMIT          __errno_t(      3)
-#define EREFUSED        __errno_t(      4)
-#define EFORWARD        __errno_t(      5)
-#define EPERM           __errno_t(      6)
-#define EHANGUP         __errno_t(      7)
-#define EPARTY          __errno_t(      8)
-#define EEXIST          __errno_t(      9)
-#define EBADMEM         __errno_t(     10)
-#define ENOTSUP         __errno_t(     11)
-#define EADDRNOTAVAIL   __errno_t(     12)
-#define ETIMEOUT        __errno_t(     13)
-#define EINVAL          __errno_t(     14)
-#define EBUSY           __errno_t(     15)
-#define EOVERFLOW       __errno_t(     16)
-#define EINTR           __errno_t(     17)
-#define EMFILE          __errno_t(     18)
-#define ENAMETOOLONG    __errno_t(     19)
-#define EISDIR          __errno_t(     20)
-#define ENOTDIR         __errno_t(     21)
-#define ENOSPC          __errno_t(     22)
-#define ENOTEMPTY       __errno_t(     23)
-#define EBADF           __errno_t(     24)
-#define EDOM            __errno_t(     25)
-#define ERANGE          __errno_t(     26)
-#define EXDEV           __errno_t(     27)
-#define EIO             __errno_t(     28)
-#define EMLINK          __errno_t(     29)
-#define ENXIO           __errno_t(     30)
-#define ENOFS           __errno_t(     31)
-#define EBADCHECKSUM    __errno_t(     32)
-#define ESTALL          __errno_t(     33)
-#define EEMPTY          __errno_t(     34)
-#define ENAK            __errno_t(     35)
-#define EAGAIN          __errno_t(     36)
-
-/* libhttp error codes. Defining them here is a temporary hack. */
-
-#define HTTP_EMULTIPLE_HEADERS  __errno_t(  50)
-#define HTTP_EMISSING_HEADER    __errno_t(  51)
-#define HTTP_EPARSE             __errno_t(  52)
-
-/* libext4 error codes. Same as above. */
-
-#define EXT4_ERR_BAD_DX_DIR     __errno_t(  60)
-
-/*
- * POSIX error codes + whatever nonstandard names crop up in third-party
- * software. These are not used in HelenOS code, but are defined here in
- * order to avoid nasty hacks in libposix.
- *
- * If you decide to use one of these in native HelenOS code,
- * move it up to the first group.
- */
-
-/* COMPAT_START -- do not remove or edit this comment */
-
-#define E2BIG             __errno_t(  101)
-#define EACCES            __errno_t(  102)
-#define EADDRINUSE        __errno_t(  103)
-#define EAFNOSUPPORT      __errno_t(  105)
-#define EALREADY          __errno_t(  107)
-#define EBADMSG           __errno_t(  109)
-#define ECANCELED         __errno_t(  111)
-#define ECHILD            __errno_t(  112)
-#define ECONNABORTED      __errno_t(  113)
-#define ECONNREFUSED      __errno_t(  114)
-#define ECONNRESET        __errno_t(  115)
-#define EDEADLK           __errno_t(  116)
-#define EDESTADDRREQ      __errno_t(  117)
-#define EDQUOT            __errno_t(  119)
-#define EFAULT            __errno_t(  121)
-#define EFBIG             __errno_t(  122)
-#define EHOSTUNREACH      __errno_t(  123)
-#define EIDRM             __errno_t(  124)
-#define EILSEQ            __errno_t(  125)
-#define EINPROGRESS       __errno_t(  126)
-#define EISCONN           __errno_t(  130)
-#define ELOOP             __errno_t(  132)
-#define EMSGSIZE          __errno_t(  135)
-#define EMULTIHOP         __errno_t(  136)
-#define ENETDOWN          __errno_t(  138)
-#define ENETRESET         __errno_t(  139)
-#define ENETUNREACH       __errno_t(  140)
-#define ENFILE            __errno_t(  141)
-#define ENOBUFS           __errno_t(  142)
-#define ENODATA           __errno_t(  143)
-#define ENODEV            __errno_t(  144)
-#define ENOEXEC           __errno_t(  146)
-#define ENOLCK            __errno_t(  147)
-#define ENOLINK           __errno_t(  148)
-#define ENOMSG            __errno_t(  150)
-#define ENOPROTOOPT       __errno_t(  151)
-#define ENOSR             __errno_t(  153)
-#define ENOSTR            __errno_t(  154)
-#define ENOSYS            __errno_t(  155)
-#define ENOTCONN          __errno_t(  156)
-#define ENOTRECOVERABLE   __errno_t(  159)
-#define ENOTSOCK          __errno_t(  160)
-#define ENOTTY            __errno_t(  162)
-#define EOPNOTSUPP        __errno_t(  164)
-#define EOWNERDEAD        __errno_t(  166)
-#define EPIPE             __errno_t(  168)
-#define EPROTO            __errno_t(  169)
-#define EPROTONOSUPPORT   __errno_t(  170)
-#define EPROTOTYPE        __errno_t(  171)
-#define EROFS             __errno_t(  173)
-#define ESPIPE            __errno_t(  174)
-#define ESRCH             __errno_t(  175)
-#define ESTALE            __errno_t(  176)
-#define ETIME             __errno_t(  177)
-#define ETIMEDOUT         __errno_t(  178)
-#define ETXTBSY           __errno_t(  179)
-#define EWOULDBLOCK       __errno_t(  180)
Index: i/include/abi/errno.in
===================================================================
--- abi/include/abi/errno.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-__errno_entry(EOK            ,      0, "No error")
-__errno_entry(ENOENT         ,      1, "No such entry")
-__errno_entry(ENOMEM         ,      2, "Not enough memory")
-__errno_entry(ELIMIT         ,      3, "Limit exceeded")
-__errno_entry(EREFUSED       ,      4, "Connection refused")
-__errno_entry(EFORWARD       ,      5, "Forwarding error")
-__errno_entry(EPERM          ,      6, "Permission denied")
-__errno_entry(EHANGUP        ,      7, "Answerbox closed connection")
-__errno_entry(EPARTY         ,      8, "Other party encountered an error")
-__errno_entry(EEXIST         ,      9, "Entry already exists")
-__errno_entry(EBADMEM        ,     10, "Bad memory pointer")
-__errno_entry(ENOTSUP        ,     11, "Operation not supported")
-__errno_entry(EADDRNOTAVAIL  ,     12, "Address not available")
-__errno_entry(ETIMEOUT       ,     13, "Timeout expired")
-__errno_entry(EINVAL         ,     14, "Invalid value")
-__errno_entry(EBUSY          ,     15, "Resource is busy")
-__errno_entry(EOVERFLOW      ,     16, "Result does not fit its size")
-__errno_entry(EINTR          ,     17, "Operation interrupted")
-__errno_entry(EMFILE         ,     18, "Too many open files")
-__errno_entry(ENAMETOOLONG   ,     19, "Name is too long")
-__errno_entry(EISDIR         ,     20, "Entry is a directory")
-__errno_entry(ENOTDIR        ,     21, "Entry is not a directory")
-__errno_entry(ENOSPC         ,     22, "No space left")
-__errno_entry(ENOTEMPTY      ,     23, "Directory is not empty")
-__errno_entry(EBADF          ,     24, "Bad object handle")
-__errno_entry(EDOM           ,     25, "Mathematics argument out of domain of function")
-__errno_entry(ERANGE         ,     26, "Value out of range")
-__errno_entry(EXDEV          ,     27, "Prohibited cross-device link")
-__errno_entry(EIO            ,     28, "Input/output error")
-__errno_entry(EMLINK         ,     29, "Too many links")
-__errno_entry(ENXIO          ,     30, "Device or address does not exist")
-__errno_entry(ENOFS          ,     31, "No such file system type")
-__errno_entry(EBADCHECKSUM   ,     32, "Bad checksum")
-__errno_entry(ESTALL         ,     33, "USB: Operation stalled")
-__errno_entry(EEMPTY         ,     34, "Resource is empty")
-__errno_entry(ENAK           ,     35, "Negative acknowledgement")
-__errno_entry(EAGAIN         ,     36, "Operation could not proceed, try again")
-
-/* libhttp error codes. Defining them here is a temporary hack. */
-
-__errno_entry(HTTP_EMULTIPLE_HEADERS ,  50, "HTTP: Multiple headers")
-__errno_entry(HTTP_EMISSING_HEADER   ,  51, "HTTP: Missing header")
-__errno_entry(HTTP_EPARSE            ,  52, "HTTP: Parse error")
-
-/* libext4 error codes. Same as above. */
-
-__errno_entry(EXT4_ERR_BAD_DX_DIR    ,  60, "EXT4: Filesystem corrupted")
-
-/*
- * POSIX error codes + whatever nonstandard names crop up in third-party
- * software. These are not used in HelenOS code, but are defined here in
- * order to avoid nasty hacks in libposix.
- *
- * If you decide to use one of these in native HelenOS code,
- * move it up to the first group.
- */
-
-/* COMPAT_START -- do not remove or edit this comment */
-
-__errno_entry(E2BIG            ,  101, "Argument list too long")
-__errno_entry(EACCES           ,  102, "Permission denied")
-__errno_entry(EADDRINUSE       ,  103, "Address in use")
-__errno_entry(EAFNOSUPPORT     ,  105, "Address family not supported")
-__errno_entry(EALREADY         ,  107, "Connection already in progress")
-__errno_entry(EBADMSG          ,  109, "Bad message")
-__errno_entry(ECANCELED        ,  111, "Operation canceled")
-__errno_entry(ECHILD           ,  112, "No child processes")
-__errno_entry(ECONNABORTED     ,  113, "Connection aborted")
-__errno_entry(ECONNREFUSED     ,  114, "Connection refused")
-__errno_entry(ECONNRESET       ,  115, "Connection reset")
-__errno_entry(EDEADLK          ,  116, "Resource deadlock would occur")
-__errno_entry(EDESTADDRREQ     ,  117, "Destination address required")
-__errno_entry(EDQUOT           ,  119, "Reserved")
-__errno_entry(EFAULT           ,  121, "Bad address")
-__errno_entry(EFBIG            ,  122, "File too large")
-__errno_entry(EHOSTUNREACH     ,  123, "Host is unreachable")
-__errno_entry(EIDRM            ,  124, "Identifier removed")
-__errno_entry(EILSEQ           ,  125, "Illegal byte sequence")
-__errno_entry(EINPROGRESS      ,  126, "Operation in progress")
-__errno_entry(EISCONN          ,  130, "Socket is connected")
-__errno_entry(ELOOP            ,  132, "Too many levels of symbolic links")
-__errno_entry(EMSGSIZE         ,  135, "Message too large")
-__errno_entry(EMULTIHOP        ,  136, "Reserved")
-__errno_entry(ENETDOWN         ,  138, "Network is down")
-__errno_entry(ENETRESET        ,  139, "Connection aborted by network")
-__errno_entry(ENETUNREACH      ,  140, "Network unreachable")
-__errno_entry(ENFILE           ,  141, "Too many files open in system")
-__errno_entry(ENOBUFS          ,  142, "No buffer space available")
-__errno_entry(ENODATA          ,  143, "No message is available on the STREAM head read queue")
-__errno_entry(ENODEV           ,  144, "No such device")
-__errno_entry(ENOEXEC          ,  146, "Executable file format error")
-__errno_entry(ENOLCK           ,  147, "No locks available")
-__errno_entry(ENOLINK          ,  148, "Reserved")
-__errno_entry(ENOMSG           ,  150, "No message of the desired type")
-__errno_entry(ENOPROTOOPT      ,  151, "Protocol not available")
-__errno_entry(ENOSR            ,  153, "No STREAM resources.")
-__errno_entry(ENOSTR           ,  154, "Not a STREAM")
-__errno_entry(ENOSYS           ,  155, "Function not supported")
-__errno_entry(ENOTCONN         ,  156, "The socket is not connected")
-__errno_entry(ENOTRECOVERABLE  ,  159, "State not recoverable")
-__errno_entry(ENOTSOCK         ,  160, "Not a socket")
-__errno_entry(ENOTTY           ,  162, "Inappropriate I/O control operation")
-__errno_entry(EOPNOTSUPP       ,  164, "Operation not supported")
-__errno_entry(EOWNERDEAD       ,  166, "Previous owned died")
-__errno_entry(EPIPE            ,  168, "Broken pipe")
-__errno_entry(EPROTO           ,  169, "Protocol error")
-__errno_entry(EPROTONOSUPPORT  ,  170, "Protocol not supported")
-__errno_entry(EPROTOTYPE       ,  171, "Protocol wrong type for socket")
-__errno_entry(EROFS            ,  173, "Read-only file system")
-__errno_entry(ESPIPE           ,  174, "Invalid seek")
-__errno_entry(ESRCH            ,  175, "No such process")
-__errno_entry(ESTALE           ,  176, "Reserved")
-__errno_entry(ETIME            ,  177, "Stream ioctl() timeout")
-__errno_entry(ETIMEDOUT        ,  178, "Connection timed out")
-__errno_entry(ETXTBSY          ,  179, "Text file busy")
-__errno_entry(EWOULDBLOCK      ,  180, "Operation would block")
Index: i/include/abi/fb/visuals.h
===================================================================
--- abi/include/abi/fb/visuals.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_VISUALS_H_
-#define _ABI_VISUALS_H_
-
-typedef enum {
-	VISUAL_UNKNOWN = 0,
-	VISUAL_INDIRECT_8,
-	VISUAL_RGB_5_5_5_LE,
-	VISUAL_RGB_5_5_5_BE,
-	VISUAL_RGB_5_6_5_LE,
-	VISUAL_RGB_5_6_5_BE,
-	VISUAL_BGR_8_8_8,
-	VISUAL_BGR_0_8_8_8,
-	VISUAL_BGR_8_8_8_0,
-	VISUAL_ABGR_8_8_8_8,
-	VISUAL_BGRA_8_8_8_8,
-	VISUAL_RGB_8_8_8,
-	VISUAL_RGB_0_8_8_8,
-	VISUAL_RGB_8_8_8_0,
-	VISUAL_ARGB_8_8_8_8,
-	VISUAL_RGBA_8_8_8_8
-} visual_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/fourcc.h
===================================================================
--- abi/include/abi/fourcc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_FOURCC_H_
-#define _ABI_FOURCC_H_
-
-#include <stdint.h>
-
-#define FOURCC(a, b, c, d) \
-	(((uint32_t) (a)) | (((uint32_t) (b)) << 8) | \
-	    (((uint32_t) (c)) << 16) | (((uint32_t) (d)) << 24))
-
-#define CC_COMPACT(a) \
-	((uint32_t) (a) & 0x7f)
-
-#define FOURCC_COMPACT(a, b, c, d) \
-	((CC_COMPACT(a) << 4) | (CC_COMPACT(b) << 11) | \
-	    (CC_COMPACT(c) << 18) | (CC_COMPACT(d) << 25))
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ipc/event.h
===================================================================
--- abi/include/abi/ipc/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_IPC_EVENT_H_
-#define _ABI_IPC_EVENT_H_
-
-/** Global events */
-typedef enum event_type {
-	/** New data available in kernel character buffer */
-	EVENT_KIO = 0,
-	/** Returning from kernel console to uspace */
-	EVENT_KCONSOLE,
-	/** A task/thread has faulted and will be terminated */
-	EVENT_FAULT,
-	/** New data available in kernel log */
-	EVENT_KLOG,
-	EVENT_END
-} event_type_t;
-
-/** Per-task events. */
-typedef enum event_task_type {
-	EVENT_TASK_STATE_CHANGE = EVENT_END,
-	EVENT_TASK_END
-} event_task_type_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ipc/interfaces.h
===================================================================
--- abi/include/abi/ipc/interfaces.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/**
- * @file interface.h
- * @brief List of all known interfaces and their codes.
- */
-
-#ifndef _ABI_IPC_INTERFACES_H_
-#define _ABI_IPC_INTERFACES_H_
-
-#include <abi/fourcc.h>
-
-enum {
-	IFACE_EXCHANGE_MASK = 0x03,
-	IFACE_MOD_MASK      = 0x04,
-};
-
-/** Interface exchange management style
- *
- */
-typedef enum {
-	/** No explicit exchange management
-	 *
-	 * Suitable for protocols which use a single
-	 * IPC message per exchange only.
-	 */
-	IFACE_EXCHANGE_ATOMIC = 0x00,
-
-	/** Exchange management via mutual exclusion
-	 *
-	 * Suitable for any kind of client/server
-	 * communication, but with possibly limited
-	 * parallelism.
-	 */
-	IFACE_EXCHANGE_SERIALIZE = 0x01,
-
-	/** Exchange management via connection cloning
-	 *
-	 * Suitable for servers which support client
-	 * connection tracking and connection cloning.
-	 */
-	IFACE_EXCHANGE_PARALLEL = 0x02
-} iface_exch_mgmt_t;
-
-/** Interface modifiers
- *
- */
-typedef enum {
-	IFACE_MOD_NONE = 0x00,
-	IFACE_MOD_CALLBACK = 0x04
-} iface_mod_t;
-
-typedef enum {
-	INTERFACE_ANY = 0,
-	INTERFACE_LOADER =
-	    FOURCC_COMPACT('l', 'o', 'a', 'd') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_PAGER =
-	    FOURCC_COMPACT('p', 'a', 'g', 'e') | IFACE_EXCHANGE_ATOMIC,
-	INTERFACE_LOGGER_WRITER =
-	    FOURCC_COMPACT('l', 'o', 'g', 'w') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_LOGGER_CONTROL =
-	    FOURCC_COMPACT('l', 'o', 'g', 'c') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_CORECFG =
-	    FOURCC_COMPACT('c', 'c', 'f', 'g') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_FS =
-	    FOURCC_COMPACT('f', 's', ' ', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_VFS =
-	    FOURCC_COMPACT('v', 'f', 's', ' ') | IFACE_EXCHANGE_PARALLEL,
-	INTERFACE_VFS_DRIVER =
-	    FOURCC_COMPACT('v', 'f', 's', 'd') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_VFS_DRIVER_CB =
-	    FOURCC_COMPACT('v', 'f', 's', 'd') | IFACE_EXCHANGE_PARALLEL | IFACE_MOD_CALLBACK,
-	INTERFACE_BLOCK =
-	    FOURCC_COMPACT('b', 'l', 'd', 'v') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_BLOCK_CB =
-	    FOURCC_COMPACT('b', 'l', 'd', 'v') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_CONSOLE =
-	    FOURCC_COMPACT('c', 'o', 'n', 's') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_INPUT =
-	    FOURCC_COMPACT('i', 'n', 'd', 'v') | IFACE_EXCHANGE_ATOMIC,
-	INTERFACE_INPUT_CB =
-	    FOURCC_COMPACT('i', 'n', 'd', 'v') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_OUTPUT =
-	    FOURCC_COMPACT('o', 'u', 'd', 'v') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_HOUND =
-	    FOURCC_COMPACT('h', 'o', 'u', 'n') | IFACE_EXCHANGE_PARALLEL,
-	INTERFACE_LOC_SUPPLIER =
-	    FOURCC_COMPACT('l', 'o', 'c', 's') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_LOC_CONSUMER =
-	    FOURCC_COMPACT('l', 'o', 'c', 'c') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_LOC_CB =
-	    FOURCC_COMPACT('l', 'o', 'c', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_DEVMAN_DEVICE =
-	    FOURCC_COMPACT('d', 'v', 'd', 'v') | IFACE_EXCHANGE_PARALLEL,
-	INTERFACE_DEVMAN_PARENT =
-	    FOURCC_COMPACT('d', 'v', 'p', 't') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_IRC =
-	    FOURCC_COMPACT('i', 'r', 'c', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DDF =
-	    FOURCC_COMPACT('d', 'd', 'f', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DDF_DEVMAN =
-	    FOURCC_COMPACT('d', 'd', 'f', 'm') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DDF_CLIENT =
-	    FOURCC_COMPACT('d', 'd', 'f', 'c') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DDF_DRIVER =
-	    FOURCC_COMPACT('d', 'd', 'f', 'd') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_INET =
-	    FOURCC_COMPACT('i', 'n', 'e', 't') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_INET_CB =
-	    FOURCC_COMPACT('i', 'n', 'e', 't') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_INETCFG =
-	    FOURCC_COMPACT('i', 'c', 'f', 'g') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_INETPING =
-	    FOURCC_COMPACT('i', 'p', 'n', 'g') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_INETPING_CB =
-	    FOURCC_COMPACT('i', 'p', 'n', 'g') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_DHCP =
-	    FOURCC_COMPACT('d', 'h', 'c', 'p') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DNSR =
-	    FOURCC_COMPACT('d', 'n', 's', 'r') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_IPLINK =
-	    FOURCC_COMPACT('i', 'p', 'l', 'k') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_IPLINK_CB =
-	    FOURCC_COMPACT('i', 'p', 'l', 'k') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_TCP =
-	    FOURCC_COMPACT('t', 'c', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_TCP_CB =
-	    FOURCC_COMPACT('t', 'c', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_UDP =
-	    FOURCC_COMPACT('u', 'd', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_UDP_CB =
-	    FOURCC_COMPACT('u', 'd', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_CLIPBOARD =
-	    FOURCC_COMPACT('c', 'l', 'i', 'p') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_CHAR_CB =
-	    FOURCC_COMPACT('b', 'l', 'd', 'v') | IFACE_EXCHANGE_PARALLEL | IFACE_MOD_CALLBACK,
-	INTERFACE_AUDIO_PCM_CB =
-	    FOURCC_COMPACT('a', 'p', 'c', 'm') | IFACE_EXCHANGE_PARALLEL | IFACE_MOD_CALLBACK,
-	INTERFACE_NIC_CB =
-	    FOURCC_COMPACT('n', 'i', 'c', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_USBVIRT_CB =
-	    FOURCC_COMPACT('u', 's', 'b', 'v') | IFACE_EXCHANGE_PARALLEL | IFACE_MOD_CALLBACK,
-	INTERFACE_ADB_CB =
-	    FOURCC_COMPACT('a', 'd', 'b', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_MOUSE_CB =
-	    FOURCC_COMPACT('m', 'o', 'u', 's') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_KBD_CB =
-	    FOURCC_COMPACT('k', 'b', 'd', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_VOL =
-	    FOURCC_COMPACT('v', 'o', 'l', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_VBD =
-	    FOURCC_COMPACT('v', 'b', 'd', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_IPC_TEST =
-	    FOURCC_COMPACT('i', 'p', 'c', 't') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_PCI =
-	    FOURCC_COMPACT('p', 'c', 'i', ' ') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DDEV =
-	    FOURCC_COMPACT('d', 'd', 'e', 'v') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DISPCFG =
-	    FOURCC_COMPACT('d', 'c', 'f', 'g') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DISPCFG_CB =
-	    FOURCC_COMPACT('d', 'c', 'f', 'g') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_DISPLAY =
-	    FOURCC_COMPACT('d', 's', 'p', 'l') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_DISPLAY_CB =
-	    FOURCC_COMPACT('d', 's', 'p', 'l') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_GC =
-	    FOURCC_COMPACT('g', 'f', 'x', 'c') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_WNDMGT =
-	    FOURCC_COMPACT('w', 'm', 'g', 't') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_WNDMGT_CB =
-	    FOURCC_COMPACT('w', 'm', 'g', 't') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
-	INTERFACE_TBARCFG_NOTIFY =
-	    FOURCC_COMPACT('t', 'b', 'c', 'f') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_SYSTEM =
-	    FOURCC_COMPACT('s', 's', 't', 'm') | IFACE_EXCHANGE_SERIALIZE,
-	INTERFACE_SYSTEM_CB =
-	    FOURCC_COMPACT('s', 's', 't', 'm') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK
-} iface_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ipc/ipc.h
===================================================================
--- abi/include/abi/ipc/ipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_IPC_IPC_H_
-#define _ABI_IPC_IPC_H_
-
-#include <stdint.h>
-#include <abi/proc/task.h>
-#include <abi/cap.h>
-#include <_bits/errno.h>
-
-/* Miscellaneous constants */
-enum {
-	/** Length of data being transferred with IPC call
-	 *
-	 * The uspace may not be able to utilize the full length
-	 *
-	 */
-	IPC_CALL_LEN = 6,
-
-	/** Maximum active async calls per phone */
-	IPC_MAX_ASYNC_CALLS = 64,
-
-	/**
-	 * Maximum buffer size allowed for IPC_M_DATA_WRITE and
-	 * IPC_M_DATA_READ requests.
-	 */
-	DATA_XFER_LIMIT = 64 * 1024,
-};
-
-/* Flags for calls */
-enum {
-	/** This is answer to a call */
-	IPC_CALL_ANSWERED       = 1 << 0,
-
-	/** Answer will not be passed to userspace, will be discarded */
-	IPC_CALL_DISCARD_ANSWER = 1 << 1,
-
-	/** Call was forwarded */
-	IPC_CALL_FORWARDED      = 1 << 2,
-
-	/** Interrupt notification */
-	IPC_CALL_NOTIF          = 1 << 3,
-
-	/** The call was automatically answered by the kernel due to error */
-	IPC_CALL_AUTO_REPLY     = 1 << 4,
-};
-
-/* Forwarding flags. */
-enum {
-	IPC_FF_NONE = 0,
-
-	/**
-	 * The call will be routed as though it was initially sent via the phone
-	 * used to forward it. This feature is intended to support the situation
-	 * in which the forwarded call needs to be handled by the same
-	 * connection fibril as any other calls that were initially sent by
-	 * the forwarder to the same destination.
-	 * This flag has no imapct on routing replies.
-	 */
-	IPC_FF_ROUTE_FROM_ME = 1 << 0,
-};
-
-/* Data transfer flags. */
-enum {
-	IPC_XF_NONE = 0,
-
-	/** Restrict the transfer size if necessary. */
-	IPC_XF_RESTRICT = 1 << 0,
-};
-
-/** User-defined IPC methods */
-enum {
-	IPC_FIRST_USER_METHOD = 1024,
-};
-
-typedef struct {
-	sysarg_t args[IPC_CALL_LEN];
-	/**
-	 * Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME,
-	 * or the task which answered the call.
-	 */
-	task_id_t task_id;
-	/** Flags */
-	unsigned flags;
-	/** User-defined label associated with requests */
-	sysarg_t request_label;
-	/** User-defined label associated with answers */
-	sysarg_t answer_label;
-	/** Capability handle */
-	cap_call_handle_t cap_handle;
-} ipc_data_t;
-
-/* Functions for manipulating calling data */
-
-static inline void ipc_set_retval(ipc_data_t *data, errno_t retval)
-{
-	data->args[0] = (sysarg_t) retval;
-}
-
-static inline void ipc_set_imethod(ipc_data_t *data, sysarg_t val)
-{
-	data->args[0] = val;
-}
-
-static inline void ipc_set_arg1(ipc_data_t *data, sysarg_t val)
-{
-	data->args[1] = val;
-}
-
-static inline void ipc_set_arg2(ipc_data_t *data, sysarg_t val)
-{
-	data->args[2] = val;
-}
-
-static inline void ipc_set_arg3(ipc_data_t *data, sysarg_t val)
-{
-	data->args[3] = val;
-}
-
-static inline void ipc_set_arg4(ipc_data_t *data, sysarg_t val)
-{
-	data->args[4] = val;
-}
-
-static inline void ipc_set_arg5(ipc_data_t *data, sysarg_t val)
-{
-	data->args[5] = val;
-}
-
-static inline sysarg_t ipc_get_imethod(ipc_data_t *data)
-{
-	return data->args[0];
-}
-static inline errno_t ipc_get_retval(ipc_data_t *data)
-{
-	return (errno_t) data->args[0];
-}
-
-static inline sysarg_t ipc_get_arg1(ipc_data_t *data)
-{
-	return data->args[1];
-}
-
-static inline sysarg_t ipc_get_arg2(ipc_data_t *data)
-{
-	return data->args[2];
-}
-
-static inline sysarg_t ipc_get_arg3(ipc_data_t *data)
-{
-	return data->args[3];
-}
-
-static inline sysarg_t ipc_get_arg4(ipc_data_t *data)
-{
-	return data->args[4];
-}
-
-static inline sysarg_t ipc_get_arg5(ipc_data_t *data)
-{
-	return data->args[5];
-}
-
-#endif
-
-/** @}
- */
Index: i/include/abi/ipc/methods.h
===================================================================
--- abi/include/abi/ipc/methods.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,227 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_IPC_METHODS_H_
-#define _ABI_IPC_METHODS_H_
-
-#include <abi/cap.h>
-
-/* Well known phone descriptors */
-static cap_phone_handle_t const PHONE_NS = (cap_phone_handle_t) (CAP_NIL + 1);
-
-/** Kernel IPC interfaces
- *
- */
-enum {
-	IPC_IF_KERNEL = 0,
-};
-
-/** System-specific IPC methods
- *
- * These methods have special behaviour. These methods also
- * have the implicit kernel interface zero (0).
- *
- */
-enum {
-	/** This message is sent to answerbox when the phone is hung up
-	 *
-	 * The numerical value zero (0) of this method is important,
-	 * so as the value can be easily tested in conditions.
-	 */
-	IPC_M_PHONE_HUNGUP = 0,
-
-	/** Protocol for initializing new callback connections.
-	 *
-	 * Sender asks the recipient to create a new connection from
-	 * the recipient to the sender.
-	 *
-	 * Sender:
-	 *  - uspace: arg1 .. callback iface
-	 *            arg2 .. <custom>
-	 *            arg3 .. <custom>
-	 *            arg4 .. <unused>
-	 *            arg5 .. sender-assigned label
-	 *  - kernel: arg5 .. new recipient's connection phone capability
-	 *
-	 * recipient:
-	 *  - uspace: arg1 .. <unused>
-	 *            arg2 .. <unused>
-	 *            arg3 .. <unused>
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 */
-	IPC_M_CONNECT_TO_ME,
-
-	/** Protocol for initializing new forward connections.
-	 *
-	 * Sender asks the recipient to create a new connection from
-	 * the sender to the recipient. The message can be forwarded,
-	 * thus the immediate recipient acts as a broker and the connection
-	 * is created to the final recipient.
-	 *
-	 * Sender:
-	 *  - uspace: arg1 .. iface
-	 *            arg2 .. <custom>
-	 *            arg3 .. <custom>
-	 *            arg4 .. flags (e.g. IPC_FLAG_BLOCKING)
-	 *            arg5 .. unused
-	 *
-	 * Recipient:
-	 *  - uspace: arg1 .. <unused>
-	 *            arg2 .. <unused>
-	 *            arg3 .. <unused>
-	 *            arg4 .. <unused>
-	 *            arg5 .. recipient-assigned label
-	 *  - kernel: arg5 .. new sender's connection phone capability
-	 *
-	 */
-	IPC_M_CONNECT_ME_TO,
-
-	/** Share a single page over IPC.
-	 *
-	 * - ARG1 - page-aligned offset from the beginning of the memory object
-	 * - ARG2 - page size
-	 * - ARG3 - user defined memory object ID
-	 * - ARG4 - user defined memory object ID
-	 * - ARG5 - user defined memory object ID
-	 *
-	 * on answer, the recipient must set:
-	 *
-	 * - ARG1 - source user page address
-	 */
-	IPC_M_PAGE_IN,
-
-	/** Receive an address space area over IPC.
-	 *
-	 * Sender:
-	 *  - uspace: arg1 .. address space area size
-	 *            arg2 .. sender's address space area starting address
-	 *                    lower bound
-	 *            arg3 .. <custom>
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 * Recipient:
-	 *  - uspace: arg1 .. recipient's address space area starting address
-	 *            arg2 .. shared address space areas sharing flags
-	 *            arg3 .. <unused>
-	 *            arg4 .. <unused>
-	 *  - kernel: arg5 .. new sender's address space area starting address
-	 *
-	 */
-	IPC_M_SHARE_IN,
-
-	/** Send as_area over IPC.
-	 *
-	 * - ARG1 - source as_area base address
-	 * - ARG2 - size of source as_area (filled automatically by kernel)
-	 * - ARG3 - flags of the as_area being sent
-	 *
-	 * on answer, the recipient must set:
-	 *
-	 * - ARG1 - dst as_area lower bound
-	 * - ARG2 - dst as_area base address pointer
-	 *          (filled automatically by the kernel)
-	 */
-	IPC_M_SHARE_OUT,
-
-	/** Receive data from another address space over IPC.
-	 *
-	 * Sender:
-	 *  - uspace: arg1 .. sender's destination buffer address
-	 *            arg2 .. sender's destination buffer size
-	 *            arg3 .. flags (IPC_XF_RESTRICT)
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 * Recipient:
-	 *  - uspace: arg1 .. recipient's source buffer address
-	 *            arg2 .. recipient's source buffer size
-	 *            arg3 .. <unused>
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 */
-	IPC_M_DATA_READ,
-
-	/** Send data to another address space over IPC.
-	 *
-	 * Sender:
-	 *  - uspace: arg1 .. sender's source buffer address
-	 *            arg2 .. sender's source buffer size
-	 *            arg3 .. flags (IPC_XF_RESTRICT)
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 * Recipient:
-	 *  - uspace: arg1 .. recipient's destination buffer address
-	 *            arg2 .. recipient's destination buffer size
-	 *            arg3 .. <unused>
-	 *            arg4 .. <unused>
-	 *            arg5 .. <unused>
-	 *
-	 */
-	IPC_M_DATA_WRITE,
-
-	/** Authorize change of recipient's state in a third party task.
-	 *
-	 * - ARG1 - user protocol defined data
-	 * - ARG2 - user protocol defined data
-	 * - ARG3 - user protocol defined data
-	 * - ARG5 - sender's phone to the third party task
-	 *
-	 * on EOK answer, the recipient must set:
-	 *
-	 * - ARG1 - recipient's phone to the third party task
-	 */
-	IPC_M_STATE_CHANGE_AUTHORIZE,
-
-	/** Debug the recipient.
-	 *
-	 * - ARG1 - specifies the debug method (from udebug_method_t)
-	 * - other arguments are specific to the debug method
-	 */
-	IPC_M_DEBUG,
-};
-
-/** Last system IPC method */
-enum {
-	IPC_M_LAST_SYSTEM = 511,
-};
-
-#endif
-
-/** @}
- */
Index: i/include/abi/kio.h
===================================================================
--- abi/include/abi/kio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_KIO_H_
-#define _ABI_KIO_H_
-
-enum {
-	KIO_UNKNOWN,
-	KIO_WRITE,
-	KIO_UPDATE,
-	KIO_COMMAND
-};
-
-#endif
-
-/** @}
- */
Index: i/include/abi/klog.h
===================================================================
--- abi/include/abi/klog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_KLOG_H_
-#define _ABI_KLOG_H_
-
-typedef enum {
-	KLOG_WRITE,
-	KLOG_READ
-} klog_operation_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/log.h
===================================================================
--- abi/include/abi/log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_LOG_H_
-#define _ABI_LOG_H_
-
-/** Log message level. */
-typedef enum {
-	/** Fatal error, program is not able to recover at all. */
-	LVL_FATAL,
-	/** Serious error but the program can recover from it. */
-	LVL_ERROR,
-	/** Easily recoverable problem. */
-	LVL_WARN,
-	/** Information message that ought to be printed by default. */
-	LVL_NOTE,
-	/** Debugging purpose message. */
-	LVL_DEBUG,
-	/** More detailed debugging message. */
-	LVL_DEBUG2,
-
-	/** For checking range of values */
-	LVL_LIMIT
-} log_level_t;
-
-/* Who is the source of the message? */
-typedef enum {
-	LF_OTHER = 0,
-	LF_USPACE,
-	LF_ARCH
-} log_facility_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/mm/as.h
===================================================================
--- abi/include/abi/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_AS_H_
-#define _ABI_AS_H_
-
-#include <abi/cap.h>
-
-/** Address space area flags. */
-enum {
-	AS_AREA_READ         = 0x01,
-	AS_AREA_WRITE        = 0x02,
-	AS_AREA_EXEC         = 0x04,
-	AS_AREA_CACHEABLE    = 0x08,
-	AS_AREA_GUARD        = 0x10,
-	AS_AREA_LATE_RESERVE = 0x20,
-};
-
-static void *const AS_AREA_ANY = (void *) -1;
-static void *const AS_MAP_FAILED = (void *) -1;
-static void *const AS_AREA_UNPAGED = NULL;
-
-/** Address space area info exported to uspace. */
-typedef struct {
-	/** Starting address */
-	uintptr_t start_addr;
-
-	/** Area size */
-	size_t size;
-
-	/** Area flags */
-	unsigned int flags;
-} as_area_info_t;
-
-typedef struct {
-	cap_phone_handle_t pager;
-	sysarg_t id1;
-	sysarg_t id2;
-	sysarg_t id3;
-} as_area_pager_info_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/proc/task.h
===================================================================
--- abi/include/abi/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_PROC_TASK_H_
-#define _ABI_PROC_TASK_H_
-
-#include <stdint.h>
-
-typedef uint64_t task_id_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/proc/thread.h
===================================================================
--- abi/include/abi/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_PROC_THREAD_H_
-#define _ABI_PROC_THREAD_H_
-
-#include <stdint.h>
-
-typedef uint64_t thread_id_t;
-
-/** Thread states */
-typedef enum {
-	/** It is an error, if thread is found in this state. */
-	Invalid,
-	/** State of a thread that is currently executing on some CPU. */
-	Running,
-	/** Thread in this state is waiting for an event. */
-	Sleeping,
-	/** State of threads in a run queue. */
-	Ready,
-	/** Threads are in this state before they are first readied. */
-	Entering,
-	/** After a thread calls thread_exit(), it is put into Exiting state. */
-	Exiting,
-	/** Threads that were not detached but exited are Lingering. */
-	Lingering
-} state_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/synch.h
===================================================================
--- abi/include/abi/synch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_SYNCH_H_
-#define _ABI_SYNCH_H_
-
-enum {
-	/** Request with no timeout. */
-	SYNCH_NO_TIMEOUT = 0,
-};
-
-enum {
-	/** No flags specified. */
-	SYNCH_FLAGS_NONE          = 0,
-	/** Non-blocking operation request. */
-	SYNCH_FLAGS_NON_BLOCKING  = 1 << 0,
-	/** Interruptible operation. */
-	SYNCH_FLAGS_INTERRUPTIBLE = 1 << 1,
-	/** Futex operation (makes sleep with timeout composable). */
-	SYNCH_FLAGS_FUTEX         = 1 << 2,
-};
-
-#endif
-
-/** @}
- */
Index: i/include/abi/syscall.h
===================================================================
--- abi/include/abi/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_SYSCALL_H_
-#define _ABI_SYSCALL_H_
-
-/** System calls.
- *
- * If you are adding or removing syscalls, or changing the number of
- * their arguments, please update syscall description table
- * in @c uspace/app/trace/syscalls.c
- */
-typedef enum {
-	SYS_KIO = 0,
-	SYS_REBOOT,
-
-	SYS_THREAD_CREATE,
-	SYS_THREAD_EXIT,
-	SYS_THREAD_GET_ID,
-	SYS_THREAD_USLEEP,
-	SYS_THREAD_UDELAY,
-
-	SYS_TASK_GET_ID,
-	SYS_TASK_SET_NAME,
-	SYS_TASK_KILL,
-	SYS_TASK_EXIT,
-	SYS_PROGRAM_SPAWN_LOADER,
-
-	SYS_WAITQ_CREATE,
-	SYS_WAITQ_SLEEP,
-	SYS_WAITQ_WAKEUP,
-	SYS_WAITQ_DESTROY,
-	SYS_SMC_COHERENCE,
-
-	SYS_AS_AREA_CREATE,
-	SYS_AS_AREA_RESIZE,
-	SYS_AS_AREA_CHANGE_FLAGS,
-	SYS_AS_AREA_GET_INFO,
-	SYS_AS_AREA_DESTROY,
-
-	SYS_PAGE_FIND_MAPPING,
-
-	SYS_IPC_CALL_ASYNC_FAST,
-	SYS_IPC_CALL_ASYNC_SLOW,
-	SYS_IPC_ANSWER_FAST,
-	SYS_IPC_ANSWER_SLOW,
-	SYS_IPC_FORWARD_FAST,
-	SYS_IPC_FORWARD_SLOW,
-	SYS_IPC_WAIT,
-	SYS_IPC_POKE,
-	SYS_IPC_HANGUP,
-	SYS_IPC_CONNECT_KBOX,
-
-	SYS_IPC_EVENT_SUBSCRIBE,
-	SYS_IPC_EVENT_UNSUBSCRIBE,
-	SYS_IPC_EVENT_UNMASK,
-
-	SYS_PERM_GRANT,
-	SYS_PERM_REVOKE,
-
-	SYS_PHYSMEM_MAP,
-	SYS_PHYSMEM_UNMAP,
-	SYS_DMAMEM_MAP,
-	SYS_DMAMEM_UNMAP,
-	SYS_IOSPACE_ENABLE,
-	SYS_IOSPACE_DISABLE,
-
-	SYS_IPC_IRQ_SUBSCRIBE,
-	SYS_IPC_IRQ_UNSUBSCRIBE,
-
-	SYS_SYSINFO_GET_KEYS_SIZE,
-	SYS_SYSINFO_GET_KEYS,
-	SYS_SYSINFO_GET_VAL_TYPE,
-	SYS_SYSINFO_GET_VALUE,
-	SYS_SYSINFO_GET_DATA_SIZE,
-	SYS_SYSINFO_GET_DATA,
-
-	SYS_DEBUG_CONSOLE,
-
-	SYS_KLOG,
-	SYS_KIO_READ,
-} syscall_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/sysinfo.h
===================================================================
--- abi/include/abi/sysinfo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- * Data structures passed between kernel sysinfo and user space.
- */
-
-#ifndef _ABI_SYSINFO_H_
-#define _ABI_SYSINFO_H_
-
-#include <_bits/size_t.h>
-#include <stdbool.h>
-#include <abi/proc/task.h>
-#include <abi/proc/thread.h>
-#include <stdint.h>
-
-enum {
-	/** Number of load components */
-	LOAD_STEPS = 3,
-
-	/** Maximum name sizes */
-	TASK_NAME_BUFLEN = 64,
-	EXC_NAME_BUFLEN  = 20,
-};
-
-/** Item value type
- *
- */
-typedef enum {
-	SYSINFO_VAL_UNDEFINED = 0,     /**< Undefined value */
-	SYSINFO_VAL_VAL = 1,           /**< Constant numeric value */
-	SYSINFO_VAL_DATA = 2,          /**< Constant binary data */
-	SYSINFO_VAL_FUNCTION_VAL = 3,  /**< Generated numeric value */
-	SYSINFO_VAL_FUNCTION_DATA = 4  /**< Generated binary data */
-} sysinfo_item_val_type_t;
-
-/** Statistics about a single CPU
- *
- */
-typedef struct {
-	unsigned int id;         /**< CPU ID as stored by kernel */
-	bool active;             /**< CPU is activate */
-	uint16_t frequency_mhz;  /**< Frequency in MHz */
-	uint64_t idle_cycles;    /**< Number of idle cycles */
-	uint64_t busy_cycles;    /**< Number of busy cycles */
-} stats_cpu_t;
-
-/** Physical memory statistics
- *
- */
-typedef struct {
-	uint64_t total;    /**< Total physical memory (bytes) */
-	uint64_t unavail;  /**< Unavailable (reserved, firmware) bytes */
-	uint64_t used;     /**< Allocated physical memory (bytes) */
-	uint64_t free;     /**< Free physical memory (bytes) */
-} stats_physmem_t;
-
-/** IPC statistics
- *
- * Associated with a task.
- *
- */
-typedef struct {
-	uint64_t call_sent;           /**< IPC calls sent */
-	uint64_t call_received;       /**< IPC calls received */
-	uint64_t answer_sent;         /**< IPC answers sent */
-	uint64_t answer_received;     /**< IPC answers received */
-	uint64_t irq_notif_received;  /**< IPC IRQ notifications */
-	uint64_t forwarded;           /**< IPC messages forwarded */
-} stats_ipc_t;
-
-/** Statistics about a single task
- *
- */
-typedef struct {
-	task_id_t task_id;            /**< Task ID */
-	char name[TASK_NAME_BUFLEN];  /**< Task name (in kernel) */
-	size_t virtmem;               /**< Size of VAS (bytes) */
-	size_t resmem;                /**< Size of resident (used) memory (bytes) */
-	size_t threads;               /**< Number of threads */
-	uint64_t ucycles;             /**< Number of CPU cycles in user space */
-	uint64_t kcycles;             /**< Number of CPU cycles in kernel */
-	stats_ipc_t ipc_info;         /**< IPC statistics */
-} stats_task_t;
-
-/** Statistics about a single thread
- *
- */
-typedef struct {
-	thread_id_t thread_id;  /**< Thread ID */
-	task_id_t task_id;      /**< Associated task ID */
-	state_t state;          /**< Thread state */
-	int priority;           /**< Thread priority */
-	uint64_t ucycles;       /**< Number of CPU cycles in user space */
-	uint64_t kcycles;       /**< Number of CPU cycles in kernel */
-	bool on_cpu;            /**< Associated with a CPU */
-	unsigned int cpu;       /**< Associated CPU ID (if on_cpu is true) */
-} stats_thread_t;
-
-/** Statistics about a single IPC connection
- *
- */
-typedef struct {
-	task_id_t caller;  /**< Source task ID */
-	task_id_t callee;  /**< Target task ID */
-} stats_ipcc_t;
-
-/** Statistics about a single exception
- *
- */
-typedef struct {
-	unsigned int id;             /**< Exception ID */
-	char desc[EXC_NAME_BUFLEN];  /**< Description */
-	bool hot;                    /**< Active or inactive exception */
-	uint64_t cycles;             /**< Number of CPU cycles in the handler */
-	uint64_t count;              /**< Number of handled exceptions */
-} stats_exc_t;
-
-/** Load fixed-point value */
-typedef uint32_t load_t;
-
-#endif
-
-/** @}
- */
Index: i/include/abi/udebug.h
===================================================================
--- abi/include/abi/udebug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup abi_generic
- * @{
- */
-/** @file
- */
-
-#ifndef _ABI_UDEBUG_H_
-#define _ABI_UDEBUG_H_
-
-#define UDEBUG_EVMASK(event)  (1 << ((event) - 1))
-
-typedef enum { /* udebug_method_t */
-
-	/** Start debugging the recipient.
-	 *
-	 * Causes all threads in the receiving task to stop. When they
-	 * are all stoped, an answer with retval 0 is generated.
-	 *
-	 */
-	UDEBUG_M_BEGIN = 1,
-
-	/** Finish debugging the recipient.
-	 *
-	 * Answers all pending GO and GUARD messages.
-	 *
-	 */
-	UDEBUG_M_END,
-
-	/** Set which events should be captured. */
-	UDEBUG_M_SET_EVMASK,
-
-	/** Make sure the debugged task is still there.
-	 *
-	 * This message is answered when the debugged task dies
-	 * or the debugging session ends.
-	 *
-	 */
-	UDEBUG_M_GUARD,
-
-	/** Run a thread until a debugging event occurs.
-	 *
-	 * This message is answered when the thread stops
-	 * in a debugging event.
-	 *
-	 * - ARG2 - id of the thread to run
-	 *
-	 */
-	UDEBUG_M_GO,
-
-	/** Stop a thread being debugged.
-	 *
-	 * Creates a special STOP event in the thread, causing
-	 * it to answer a pending GO message (if any).
-	 *
-	 */
-	UDEBUG_M_STOP,
-
-	/** Read arguments of a syscall.
-	 *
-	 * - ARG2 - thread identification
-	 * - ARG3 - destination address in the caller's address space
-	 *
-	 */
-	UDEBUG_M_ARGS_READ,
-
-	/** Read thread's userspace register state (istate_t).
-	 *
-	 * - ARG2 - thread identification
-	 * - ARG3 - destination address in the caller's address space
-	 *
-	 * or, on error, retval will be
-	 * - ENOENT - thread does not exist
-	 * - EBUSY - register state not available
-	 */
-	UDEBUG_M_REGS_READ,
-
-	/** Read the list of the debugged tasks's threads.
-	 *
-	 * - ARG2 - destination address in the caller's address space
-	 * - ARG3 - size of receiving buffer in bytes
-	 *
-	 * The kernel fills the buffer with a series of sysarg_t values
-	 * (thread ids). On answer, the kernel will set:
-	 *
-	 * - ARG2 - number of bytes that were actually copied
-	 * - ARG3 - number of bytes of the complete data
-	 *
-	 */
-	UDEBUG_M_THREAD_READ,
-
-	/** Read the name of the debugged task.
-	 *
-	 * - ARG2 - destination address in the caller's address space
-	 * - ARG3 - size of receiving buffer in bytes
-	 *
-	 * The kernel fills the buffer with a non-terminated string.
-	 *
-	 * - ARG2 - number of bytes that were actually copied
-	 * - ARG3 - number of bytes of the complete data
-	 *
-	 */
-	UDEBUG_M_NAME_READ,
-
-	/** Read the list of the debugged task's address space areas.
-	 *
-	 * - ARG2 - destination address in the caller's address space
-	 * - ARG3 - size of receiving buffer in bytes
-	 *
-	 * The kernel fills the buffer with a series of as_area_info_t structures.
-	 * Upon answer, the kernel will set:
-	 *
-	 * - ARG2 - number of bytes that were actually copied
-	 * - ARG3 - number of bytes of the complete data
-	 *
-	 */
-	UDEBUG_M_AREAS_READ,
-
-	/** Read the debugged tasks's memory.
-	 *
-	 * - ARG2 - destination address in the caller's address space
-	 * - ARG3 - source address in the recipient's address space
-	 * - ARG4 - size of receiving buffer in bytes
-	 *
-	 */
-	UDEBUG_M_MEM_READ
-} udebug_method_t;
-
-typedef enum {
-	UDEBUG_EVENT_FINISHED = 1,  /**< Debuging session has finished */
-	UDEBUG_EVENT_STOP,          /**< Stopped on DEBUG_STOP request */
-	UDEBUG_EVENT_SYSCALL_B,     /**< Before beginning syscall execution */
-	UDEBUG_EVENT_SYSCALL_E,     /**< After finishing syscall execution */
-	UDEBUG_EVENT_THREAD_B,      /**< The task created a new thread */
-	UDEBUG_EVENT_THREAD_E       /**< A thread exited */
-} udebug_event_t;
-
-typedef enum {
-	UDEBUG_EM_FINISHED = UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED),
-	UDEBUG_EM_STOP = UDEBUG_EVMASK(UDEBUG_EVENT_STOP),
-	UDEBUG_EM_SYSCALL_B = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B),
-	UDEBUG_EM_SYSCALL_E = UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E),
-	UDEBUG_EM_THREAD_B = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B),
-	UDEBUG_EM_THREAD_E = UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E),
-	UDEBUG_EM_ALL =
-	    (UDEBUG_EVMASK(UDEBUG_EVENT_FINISHED) |
-	    UDEBUG_EVMASK(UDEBUG_EVENT_STOP) |
-	    UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_B) |
-	    UDEBUG_EVMASK(UDEBUG_EVENT_SYSCALL_E) |
-	    UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_B) |
-	    UDEBUG_EVMASK(UDEBUG_EVENT_THREAD_E))
-} udebug_evmask_t;
-
-#endif
-
-/** @}
- */
Index: i/include/inttypes.h
===================================================================
--- abi/include/inttypes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,354 +1,0 @@
-/*
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/** @addtogroup bits
- * @{
- */
-/** @file
- */
-
-#ifndef _BITS_INTTYPES_H_
-#define _BITS_INTTYPES_H_
-
-#include <stdint.h>
-#include <_bits/wchar_t.h>
-#include <_bits/uchar.h>
-#include <_bits/decls.h>
-
-/*
- * We assume the -helenos target is in use, which means the following assignment:
- *
- *            32b             64b
- * int8_t     unsigned char   unsigned char
- * int16_t    short           short
- * int32_t    int             int
- * int64_t    long long       long
- * intptr_t   int             long
- * size_t     unsigned int    unsigned long
- * ptrdiff_t  int             long
- * intmax_t   long long       long long
- *
- * intleast*_t    same as int*_t
- * intfast*_t     at least int, otherwise same as int*_t
- */
-
-#define PRId8       "hhd"
-#define PRIdLEAST8  "hhd"
-#define PRIdFAST8   "d"
-
-#define PRIi8       "hhi"
-#define PRIiLEAST8  "hhi"
-#define PRIiFAST8   "i"
-
-#define PRIo8       "hho"
-#define PRIoLEAST8  "hho"
-#define PRIoFAST8   "o"
-
-#define PRIu8       "hhu"
-#define PRIuLEAST8  "hhu"
-#define PRIuFAST8   "u"
-
-#define PRIx8       "hhx"
-#define PRIxLEAST8  "hhx"
-#define PRIxFAST8   "x"
-
-#define PRIX8       "hhX"
-#define PRIXLEAST8  "hhX"
-#define PRIXFAST8   "X"
-
-#define SCNd8       "hhd"
-#define SCNdLEAST8  "hhd"
-#define SCNdFAST8   "d"
-
-#define SCNi8       "hhi"
-#define SCNiLEAST8  "hhi"
-#define SCNiFAST8   "i"
-
-#define SCNo8       "hho"
-#define SCNoLEAST8  "hho"
-#define SCNoFAST8   "o"
-
-#define SCNu8       "hhu"
-#define SCNuLEAST8  "hhu"
-#define SCNuFAST8   "u"
-
-#define SCNx8       "hhx"
-#define SCNxLEAST8  "hhx"
-#define SCNxFAST8   "x"
-
-#define PRId16       "hd"
-#define PRIdLEAST16  "hd"
-#define PRIdFAST16   "d"
-
-#define PRIi16       "hi"
-#define PRIiLEAST16  "hi"
-#define PRIiFAST16   "i"
-
-#define PRIo16       "ho"
-#define PRIoLEAST16  "ho"
-#define PRIoFAST16   "o"
-
-#define PRIu16       "hu"
-#define PRIuLEAST16  "hu"
-#define PRIuFAST16   "u"
-
-#define PRIx16       "hx"
-#define PRIxLEAST16  "hx"
-#define PRIxFAST16   "x"
-
-#define PRIX16       "hX"
-#define PRIXLEAST16  "hX"
-#define PRIXFAST16   "X"
-
-#define SCNd16       "hd"
-#define SCNdLEAST16  "hd"
-#define SCNdFAST16   "d"
-
-#define SCNi16       "hi"
-#define SCNiLEAST16  "hi"
-#define SCNiFAST16   "i"
-
-#define SCNo16       "ho"
-#define SCNoLEAST16  "ho"
-#define SCNoFAST16   "o"
-
-#define SCNu16       "hu"
-#define SCNuLEAST16  "hu"
-#define SCNuFAST16   "u"
-
-#define SCNx16       "hx"
-#define SCNxLEAST16  "hx"
-#define SCNxFAST16   "x"
-
-#define PRId32       "d"
-#define PRIdLEAST32  "d"
-#define PRIdFAST32   "d"
-
-#define PRIi32       "i"
-#define PRIiLEAST32  "i"
-#define PRIiFAST32   "i"
-
-#define PRIo32       "o"
-#define PRIoLEAST32  "o"
-#define PRIoFAST32   "o"
-
-#define PRIu32       "u"
-#define PRIuLEAST32  "u"
-#define PRIuFAST32   "u"
-
-#define PRIx32       "x"
-#define PRIxLEAST32  "x"
-#define PRIxFAST32   "x"
-
-#define PRIX32       "X"
-#define PRIXLEAST32  "X"
-#define PRIXFAST32   "X"
-
-#define SCNd32       "d"
-#define SCNdLEAST32  "d"
-#define SCNdFAST32   "d"
-
-#define SCNi32       "i"
-#define SCNiLEAST32  "i"
-#define SCNiFAST32   "i"
-
-#define SCNo32       "o"
-#define SCNoLEAST32  "o"
-#define SCNoFAST32   "o"
-
-#define SCNu32       "u"
-#define SCNuLEAST32  "u"
-#define SCNuFAST32   "u"
-
-#define SCNx32       "x"
-#define SCNxLEAST32  "x"
-#define SCNxFAST32   "x"
-
-#if INTPTR_MAX == 0x7fffffff
-
-#define PRIdPTR  "d"
-#define PRIiPTR  "i"
-#define PRIoPTR  "o"
-#define PRIuPTR  "u"
-#define PRIxPTR  "x"
-#define PRIXPTR  "X"
-#define SCNdPTR  "d"
-#define SCNiPTR  "i"
-#define SCNoPTR  "o"
-#define SCNuPTR  "u"
-#define SCNxPTR  "x"
-
-#define PRId64       "lld"
-#define PRIdLEAST64  "lld"
-#define PRIdFAST64   "lld"
-
-#define PRIi64       "lli"
-#define PRIiLEAST64  "lli"
-#define PRIiFAST64   "lli"
-
-#define PRIo64       "llo"
-#define PRIoLEAST64  "llo"
-#define PRIoFAST64   "llo"
-
-#define PRIu64       "llu"
-#define PRIuLEAST64  "llu"
-#define PRIuFAST64   "llu"
-
-#define PRIx64       "llx"
-#define PRIxLEAST64  "llx"
-#define PRIxFAST64   "llx"
-
-#define PRIX64       "llX"
-#define PRIXLEAST64  "llX"
-#define PRIXFAST64   "llX"
-
-#define SCNd64       "lld"
-#define SCNdLEAST64  "lld"
-#define SCNdFAST64   "lld"
-
-#define SCNi64       "lli"
-#define SCNiLEAST64  "lli"
-#define SCNiFAST64   "lli"
-
-#define SCNo64       "llo"
-#define SCNoLEAST64  "llo"
-#define SCNoFAST64   "llo"
-
-#define SCNu64       "llu"
-#define SCNuLEAST64  "llu"
-#define SCNuFAST64   "llu"
-
-#define SCNx64       "llx"
-#define SCNxLEAST64  "llx"
-#define SCNxFAST64   "llx"
-
-#else
-
-#define PRIdPTR  "ld"
-#define PRIiPTR  "li"
-#define PRIoPTR  "lo"
-#define PRIuPTR  "lu"
-#define PRIxPTR  "lx"
-#define PRIXPTR  "lX"
-#define SCNdPTR  "ld"
-#define SCNiPTR  "li"
-#define SCNoPTR  "lo"
-#define SCNuPTR  "lu"
-#define SCNxPTR  "lx"
-
-#define PRId64       "ld"
-#define PRIdLEAST64  "ld"
-#define PRIdFAST64   "ld"
-
-#define PRIi64       "li"
-#define PRIiLEAST64  "li"
-#define PRIiFAST64   "li"
-
-#define PRIo64       "lo"
-#define PRIoLEAST64  "lo"
-#define PRIoFAST64   "lo"
-
-#define PRIu64       "lu"
-#define PRIuLEAST64  "lu"
-#define PRIuFAST64   "lu"
-
-#define PRIx64       "lx"
-#define PRIxLEAST64  "lx"
-#define PRIxFAST64   "lx"
-
-#define PRIX64       "lX"
-#define PRIXLEAST64  "lX"
-#define PRIXFAST64   "lX"
-
-#define SCNd64       "ld"
-#define SCNdLEAST64  "ld"
-#define SCNdFAST64   "ld"
-
-#define SCNi64       "li"
-#define SCNiLEAST64  "li"
-#define SCNiFAST64   "li"
-
-#define SCNo64       "lo"
-#define SCNoLEAST64  "lo"
-#define SCNoFAST64   "lo"
-
-#define SCNu64       "lu"
-#define SCNuLEAST64  "lu"
-#define SCNuFAST64   "lu"
-
-#define SCNx64       "lx"
-#define SCNxLEAST64  "lx"
-#define SCNxFAST64   "lx"
-
-#endif
-
-#define PRIdMAX  "lld"
-#define PRIiMAX  "lli"
-#define PRIoMAX  "llo"
-#define PRIuMAX  "llu"
-#define PRIxMAX  "llx"
-#define PRIXMAX  "llX"
-#define SCNdMAX  "lld"
-#define SCNiMAX  "lli"
-#define SCNoMAX  "llo"
-#define SCNuMAX  "llu"
-#define SCNxMAX  "llx"
-
-#if defined(_HELENOS_SOURCE) && !defined(__cplusplus)
-#define PRIdn  PRIdPTR  /**< Format for native_t. */
-#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
-#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
-#endif
-
-__C_DECLS_BEGIN;
-
-typedef struct {
-	intmax_t quot;
-	intmax_t rem;
-} imaxdiv_t;
-
-extern intmax_t imaxabs(intmax_t);
-extern imaxdiv_t imaxdiv(intmax_t, intmax_t);
-extern intmax_t strtoimax(const char *__restrict__, char **__restrict__, int);
-extern uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int);
-extern intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__,
-    int);
-extern uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__,
-    int);
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: i/include/limits.h
===================================================================
--- abi/include/limits.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_LIMITS_H_
-#define _LIBC_LIMITS_H_
-
-#ifdef __GNUC__
-/*
- * Default to compiler's version of limits.h, so we don't have to care about
- * language version and whatnot.
- */
-#include_next <limits.h>
-#else
-
-/* HelenOS requires 8-bit char and two's complement arithmetic. */
-#define CHAR_BIT    8
-#define SCHAR_MAX   0x7f
-#define SCHAR_MIN   (-SCHAR_MAX - 1)
-#define SHRT_MAX    0x7fff
-#define SHRT_MIN    (-SHRT_MAX - 1)
-#define INT_MAX     0x7fffffff
-#define INT_MIN     (-INT_MAX - 1)
-#define LLONG_MAX   0x7fffffffffffffffll
-#define LLONG_MIN   (-LLONG_MAX - 1)
-
-#define UCHAR_MAX   0xff
-#define USHRT_MAX   0xffff
-#define UINT_MAX    0xffffffffu
-#define ULLONG_MAX  0xffffffffffffffffull
-
-#if __STDC_VERSION__ >= 201112L
-_Static_assert(((char)-1) < 0, "char should be signed");
-#endif
-
-#define CHAR_MAX  SCHAR_MAX
-#define CHAR_MIN  SCHAR_MIN
-
-#ifdef __32_BITS__
-#define LONG_MAX   0x7fffffffl
-#define LONG_MIN   (-LONG_MAX - 1)
-#define ULONG_MAX  0xfffffffful
-#endif
-
-#ifdef __64_BITS__
-#define LONG_MAX   0x7fffffffffffffffl
-#define LONG_MIN   (-LONG_MAX - 1)
-#define ULONG_MAX  0xfffffffffffffffful
-#endif
-
-#endif  /* !defined(__GNUC__) */
-
-#undef MB_LEN_MAX
-#define MB_LEN_MAX 4
-
-#ifdef _HELENOS_SOURCE
-#define UCHAR_MIN   0
-#define USHRT_MIN   0
-#define UINT_MIN    (0u)
-#define ULONG_MIN   (0ul)
-#define ULLONG_MIN  (0ull)
-#define SSIZE_MIN   INTPTR_MIN
-#define UINT8_MIN   0
-#define UINT16_MIN  0
-#define UINT32_MIN  0
-#define UINT64_MIN  0
-#endif
-
-#if defined(_HELENOS_SOURCE) || defined(_POSIX_SOURCE) || \
-    defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-
-#define SSIZE_MAX  INTPTR_MAX
-#define NAME_MAX   255
-
-#endif
-
-/* GCC's <limits.h> doesn't define these for C++11, even though it should. */
-#if __cplusplus >= 201103L
-#ifndef LLONG_MAX
-#define LLONG_MAX  0x7fffffffffffffffll
-#endif
-#ifndef LLONG_MIN
-#define LLONG_MIN  (-LLONG_MAX - 1)
-#endif
-#ifndef ULLONG_MAX
-#define ULLONG_MAX  0xffffffffffffffffull
-#endif
-#endif
-
-#endif
-
-/** @}
- */
Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,43 @@
+CC=gcc
+AS=as
+LD=ld
+
+DEFS:=-DARCH=$(ARCH)
+
+ifdef SMP
+DEFS+=-D$(SMP)
+endif
+
+ifdef HT
+DEFS+=-D$(HT)
+endif
+
+CPPFLAGS=$(DEFS) -nostdinc -I../include
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Wmissing-prototypes -Werror -O3
+LFLAGS=-M -no-check-sections -T ../arch/ia32/_link.ld
+
+arch_sources= \
+	arch/context.s \
+	arch/debug/panic.s \
+	arch/cpuid.s \
+	arch/delay.s \
+	arch/asm.s \
+	arch/smp/ap.S \
+	arch/smp/apic.c \
+	arch/smp/mp.c \
+	arch/smp/atomic.S \
+	arch/ia32.c \
+	arch/interrupt.c \
+	arch/pm.c \
+	arch/userspace.c \
+	arch/cpu/cpu.c \
+	arch/mm/frame.c \
+	arch/mm/page.c \
+	arch/mm/tlb.c \
+	arch/drivers/i8042.c \
+	arch/drivers/i8254.c \
+	arch/drivers/i8259.c \
+	arch/drivers/ega.c \
+	arch/boot/boot.S
+
+
Index: arch/ia32/_link.ld
===================================================================
--- arch/ia32/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,44 @@
+/*
+ *  i386 linker script
+ *  
+ *  kernel text
+ *  kernel data
+ *  
+ */
+
+OUTPUT_FORMAT(binary)
+ENTRY(kernel_image_start)
+
+SECTIONS {
+    .image 0x8000: AT (0x8000) { 
+	ktext_start = .;
+	*(K_TEXT_START);
+	*(.text);
+	ktext_end = .;
+
+	kdata_start = .;
+	*(K_DATA_START);
+	*(.data);		/* initialized data */
+	*(.rodata*);		/* string literals */
+	*(COMMON);		/* global variables */
+	*(.bss);		/* uninitialized static variables */
+	*(K_DATA_END);
+	kdata_end = .;
+    }
+
+    . = ABSOLUTE(hardcoded_ktext_size);
+    .patch_1 : {
+        LONG(ktext_end - ktext_start);
+    }
+
+    . = ABSOLUTE(hardcoded_kdata_size);
+    .patch_2 : {
+        LONG(kdata_end - kdata_start);
+    }
+
+    . = ABSOLUTE(hardcoded_load_address);
+    .patch_3 : {
+        LONG(0x8000);
+    }
+
+}
Index: arch/ia32/boot/Makefile
===================================================================
--- arch/ia32/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,18 @@
+.PHONY: nothing build clean
+
+nothing:
+
+build: boot.bin
+	dd if=boot.bin of=../../../src/image.bin bs=512 conv=sync
+	-cat ../../../src/kernel.bin >>../../../src/image.bin
+
+boot.bin: boot.o
+	ld -T boot.ld -entry _start_0x7c00 --oformat binary boot.o -o $@
+
+boot.o: boot.S
+	gcc -E -DKERNEL_SIZE=$(KERNEL_SIZE) boot.S >boot.s
+	as boot.s -o $@
+	rm boot.s
+
+clean:
+	-rm *.o *.bin
Index: arch/ia32/boot/boot.S
===================================================================
--- arch/ia32/boot/boot.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/boot/boot.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,152 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# This is a very primitive boot.s
+
+# It assumes that the first sector of the kernel image is found
+# on head 0, track 0, sector 2 of the first floppy drive (1440K).
+# Next kernel sectors follow on disk sector 3, 4, ...
+#
+
+
+.text
+.global _start_0x7c00
+
+.code16
+_start_0x7c00:
+	xorw %ax,%ax		# reset, %al will be used below
+	movw %ax,%dx		# fd0, %dh and %dl will be used below
+	int $0x13
+	jc stop_trying
+
+	movb $2,%ah		# read
+	incb %al		# one sector
+	movb %ah,%cl		# from disk sector 2
+	movw %dx,%es
+	movw $0x8000,%bx	# at %es:%bx
+	int $0x13
+	jc stop_trying
+
+	pushw $('.')
+	call echo_mark
+	add $2,%sp
+    
+    	movw %dx,%ds
+	
+	# KERNEL_SIZE is passed from the outside to the preprocessor
+	movl $(KERNEL_SIZE),%edi
+	
+	shrl $9,%edi		# number of sectors that kernel occupies (%edi div 512)
+    
+read_next:
+	test %edi,%edi
+	jnz read_sectors
+
+	movb $12,%al
+	movw $0x3f2,%dx
+	outb %al,%dx
+
+	pushw $('$')
+	call echo_mark
+	add $2,%sp	
+	
+	jmpl $0,$0x8000
+
+read_sectors:
+	pushw $('.')
+	call echo_mark
+	add $2,%sp
+
+	decl %edi
+	incw logical_sector
+	movw %es,%si
+	addw $0x20,%si
+	movw %si,%es
+
+	movw logical_sector,%ax
+	divb sectors
+    
+	movb %ah,%cl
+        incb %cl			# sector
+    
+	movb %al,%ch
+	shrb $1,%ch			# track
+    
+	movb %al,%dh
+	andb $1,%dh			# head
+
+	movw $0x0201,%ax
+	int $0x13
+	jnc read_next
+
+	pushw $('R')
+	call echo_mark
+	add $2,%sp
+
+	xorw %ax,%ax			# try to reset
+	movw %ax,%dx			# fd0
+	int $0x13
+	jnc read_next
+
+stop_trying:
+	pushw $('F')
+	call echo_mark
+	add $2,%sp
+
+	cli
+	hlt
+
+CH=4
+echo_mark:
+	push %bp
+	movw %sp,%bp
+	pusha
+    
+	movw CH(%bp),%ax
+	movb $0xe,%ah
+	movb $7,%bl
+	int $0x10
+    
+	popa
+	pop %bp
+	ret
+
+# current logical sector from the beginning of the disk
+logical_sector:
+	.word 1
+
+# number of sectors per track on 1440 floppy
+sectors:
+	.byte 18
+
+
+# boot floppy signature
+.org 0x1fe
+boot_floppy_signature:
+	.byte 0x55
+	.byte 0xaa
Index: arch/ia32/boot/boot.ld
===================================================================
--- arch/ia32/boot/boot.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/boot/boot.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,3 @@
+SECTIONS {
+    .text 0x7c00 : AT (0x0) { *(.text) }
+}
Index: arch/ia32/include/ap.h
===================================================================
--- arch/ia32/include/ap.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/ap.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __AP_H__
+#define __AP_H__
+
+extern void ap_boot(void);
+
+#endif
Index: arch/ia32/include/apic.h
===================================================================
--- arch/ia32/include/apic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/apic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __APIC_H__
+#define __APIC_H__
+
+#include <arch/types.h>
+#include <cpu.h>
+
+#define FIXED		(0<<0)
+#define LOPRI		(1<<0)
+
+/* local APIC macros */
+#define IPI_INIT 	0
+#define IPI_STARTUP	0
+
+#define DLVRMODE_INIT	(5<<8)
+#define DLVRMODE_STUP	(6<<8)
+#define DESTMODE_PHYS	(0<<11)
+#define DESTMODE_LOGIC	(1<<11)
+#define LEVEL_ASSERT	(1<<14)
+#define LEVEL_DEASSERT	(0<<14)
+#define TRGRMODE_LEVEL	(1<<15)
+#define TRGRMODE_EDGE	(0<<15)
+#define SHORTHAND_DEST	(0<<18)
+#define SHORTHAND_INCL	(2<<18)
+#define SHORTHAND_EXCL	(3<<18)
+
+#define SEND_PENDING	(1<<12)
+
+/* Interrupt Command Register */
+#define ICRlo		(0x300/sizeof(__u32))
+#define ICRhi		(0x310/sizeof(__u32))
+#define ICRloClear	((0xff<<0)|(1<<13)|(3<<16)|(0xfff<<20))
+#define ICRhiClear	(0xffffff<<0)
+
+/* End Of Interrupt */
+#define EOI		(0x0b0/sizeof(__u32))
+
+/* Error Status Register */
+#define ESR		(0x280/sizeof(__u32))
+#define ESRClear	((0xffffff<<8)|(1<<4))
+
+/* Task Priority Register */
+#define TPR		(0x080/sizeof(__u32))
+#define TPRClear	0xffffff00
+
+/* Spurious Vector Register */
+#define SVR		(0x0f0/sizeof(__u32))
+#define SVRClear	(~0x3f0)
+
+/* Time Divide Configuratio Register */
+#define TDCR		(0x3e0/sizeof(__u32))
+#define TDCRClear	(~0xb)
+
+/* Initial Count Register for Timer */
+#define ICRT		(0x380/sizeof(__u32))
+
+/* Current Count Register for Timer */
+#define CCRT		(0x390/sizeof(__u32))
+
+/* LVT */
+#define LVT_Tm		(0x320/sizeof(__u32))
+#define LVT_LINT0	(0x350/sizeof(__u32))
+#define LVT_LINT1	(0x360/sizeof(__u32))
+#define LVT_Err		(0x370/sizeof(__u32))
+#define LVT_PCINT	(0x340/sizeof(__u32))
+
+/* Local APIC ID Register */
+#define L_APIC_ID	(0x020/sizeof(__u32))
+#define L_APIC_IDClear	(~(0xf<<24))
+
+/* IO APIC */
+#define IOREGSEL	(0x00/sizeof(__u32))
+#define IOWIN		(0x10/sizeof(__u32))
+
+#define IOAPICID	0x00
+#define IOAPICVER	0x01
+#define IOAPICARB	0x02
+#define IOREDTBL	0x10
+
+
+extern volatile __u32 *l_apic;
+extern volatile __u32 *io_apic;
+
+extern __u32 apic_id_mask;
+
+extern void apic_init(void);
+extern void apic_spurious(__u8 n, __u32 stack[]);
+
+extern void l_apic_init(void);
+extern void l_apic_eoi(void);
+extern int l_apic_send_init_ipi(__u8 apicid);
+extern void l_apic_debug(void);
+extern void l_apic_timer_interrupt(__u8 n, __u32 stack[]);
+
+extern __u32 io_apic_read(__u8 address);
+extern void io_apic_write(__u8 address , __u32 x);
+extern void io_apic_change_ioredtbl(int signal, int dest, __u8 v, int flags);
+extern void io_apic_disable_irqs(__u16 irqmask);
+extern void io_apic_enable_irqs(__u16 irqmask);
+
+#endif
Index: arch/ia32/include/asm.h
===================================================================
--- arch/ia32/include/asm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/asm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_ASM_H__
+#define __i386_ASM_H__
+
+#include <cpu.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <mm/page.h>
+#include <synch/spinlock.h>
+
+extern __u32 interrupt_handler_size;
+
+extern void paging_on(void);
+extern __address cpu_read_dba(void);
+extern void cpu_write_dba(__address dba);
+
+extern __address cpu_read_cr2(void);
+
+extern void interrupt_handlers(void);
+
+extern __u8 inb(int port);
+extern __u16 inw(int port);
+extern __u32 inl(int port);
+
+extern void outb(int port, __u8 b);
+extern void outw(int port, __u16 w);
+extern void outl(int port, __u32 l);
+
+extern void enable_l_apic_in_msr(void);
+
+extern void halt_cpu(void);
+extern void cpu_sleep(void);
+
+#endif
Index: arch/ia32/include/atomic.h
===================================================================
--- arch/ia32/include/atomic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/atomic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_ATOMIC_H__
+#define __i386_ATOMIC_H__
+
+#include <arch/types.h>
+
+extern void atomic_inc(int *val);
+extern void atomic_dec(int *val);
+
+extern int test_and_set(int *val);
+extern void spinlock_arch(int *val);
+
+#endif
Index: arch/ia32/include/context.h
===================================================================
--- arch/ia32/include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_CONTEXT_H__
+#define __i386_CONTEXT_H__
+
+#include <arch/types.h>
+
+struct context {
+	__u32 sp;
+	__u32 pc;
+	__u32 ebx;
+	__u32 ecx;
+	__u32 edx;
+	__u32 esi;
+	__u32 edi;
+	__u32 ebp;
+	__u32 pri;	
+} __attribute__ ((packed));
+
+#endif
Index: arch/ia32/include/cpu.h
===================================================================
--- arch/ia32/include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_CPU_H__
+#define __i386_CPU_H__
+
+#include <typedefs.h>
+#include <arch/pm.h>
+
+struct cpu_arch {
+        int vendor;
+        int family;
+        int model;
+        int stepping;
+	struct tss *tss;
+};
+
+
+#endif
Index: arch/ia32/include/cpuid.h
===================================================================
--- arch/ia32/include/cpuid.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/cpuid.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CPUID_H__
+#define __CPUID_H__
+
+#include <arch/types.h>
+
+struct cpu_info {
+	__u32 cpuid_eax;
+	__u32 cpuid_ebx;
+	__u32 cpuid_ecx;
+	__u32 cpuid_edx;
+} __attribute__ ((packed));
+
+extern int has_cpuid(void);
+extern void cpuid(__u32 cmd, cpu_info_t *info);
+
+extern __u64 rdtsc(void);
+
+#endif
Index: arch/ia32/include/ega.h
===================================================================
--- arch/ia32/include/ega.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/ega.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __EGA_H__
+#define __EGA_H__
+
+#define VIDEORAM	0xb8000
+#define ROW		80
+#define ROWS		25
+#define SCREEN		(ROW*ROWS)
+
+extern void ega_init(void);
+extern void ega_putchar(char ch);
+
+static void ega_check_cursor(void);
+static void ega_display_char(char ch);
+
+#endif
Index: arch/ia32/include/i8042.h
===================================================================
--- arch/ia32/include/i8042.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/i8042.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __I8042_H__
+#define __I8042_H__
+
+#include <arch/types.h>
+
+extern void i8042_init(void);
+extern void i8042_interrupt(__u8 n, __u32 stack[]);
+
+#endif
Index: arch/ia32/include/i8254.h
===================================================================
--- arch/ia32/include/i8254.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/i8254.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i8254_H__
+#define __i8254_H__
+
+#include <arch/types.h>
+
+extern void i8254_init(void);
+extern void i8254_interrupt(__u8 n, __u32 stack[]);
+extern void i8254_calibrate_delay_loop(void);
+extern void i8254_normal_operation(void);
+
+#endif
Index: arch/ia32/include/i8259.h
===================================================================
--- arch/ia32/include/i8259.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/i8259.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __I8259_H__
+#define __I8259_H__
+
+#include <arch/types.h>
+#include <arch/interrupt.h>
+
+#define PIC_PIC0PORT1	0x20
+#define PIC_PIC0PORT2	0x21
+#define PIC_PIC1PORT1	0xa0
+#define PIC_PIC1PORT2	0xa1
+
+#define PIC_NEEDICW4	(1<<0)
+#define	PIC_ICW1	(1<<4)
+
+#define PIC_PIC1ID	1
+
+extern void i8259_init(void);
+extern void pic_enable_irqs(__u16 irqmask);
+extern void pic_disable_irqs(__u16 irqmask);
+extern void pic_eoi(void);
+extern void pic_spurious(__u8 n, __u32 stack[]);
+
+#endif
Index: arch/ia32/include/interrupt.h
===================================================================
--- arch/ia32/include/interrupt.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/interrupt.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INTERRUPT_H__
+#define __INTERRUPT_H__
+
+#include <arch/types.h>
+#include <arch/pm.h>
+
+#define IVT_ITEMS		IDT_ITEMS
+
+#define IVT_EXCBASE		0
+#define EXCLAST			31
+
+#define IVT_IRQBASE		(IVT_EXCBASE+EXCLAST+1)
+#define IRQLAST			15
+
+#define IVT_FREEBASE		(IVT_IRQBASE+IRQLAST+1)
+
+#define IRQ_CLK		0
+#define IRQ_KBD		1
+#define IRQ_PIC1	2
+#define IRQ_PIC_SPUR	7
+
+/* this one must have four least significant bits set to ones */
+#define VECTOR_APIC_SPUR	(IVT_ITEMS-1)
+
+#if (((VECTOR_APIC_SPUR + 1)%16) || VECTOR_APIC_SPUR >= IVT_ITEMS)
+#error Wrong definition of VECTOR_APIC_SPUR
+#endif
+
+#define VECTOR_PIC_SPUR		(IVT_IRQBASE+IRQ_PIC_SPUR)
+#define VECTOR_CLK		(IVT_IRQBASE+IRQ_CLK)
+#define VECTOR_KBD		(IVT_IRQBASE+IRQ_KBD)
+
+#define VECTOR_SYSCALL		(IVT_FREEBASE+0)
+
+typedef void (* iroutine)(__u8 n, __u32 stack[]);
+
+extern iroutine ivt[IVT_ITEMS];
+
+extern void (* disable_irqs_function)(__u16 irqmask);
+extern void (* enable_irqs_function)(__u16 irqmask);
+extern void (* eoi_function)(void);
+
+extern iroutine trap_register(__u8 n, iroutine f);
+
+extern void trap_dispatcher(__u8 n, __u32 stack[]);
+
+extern void null_interrupt(__u8 n, __u32 stack[]);
+extern void gp_fault(__u8 n, __u32 stack[]);
+extern void page_fault(__u8 n, __u32 stack[]);
+extern void syscall(__u8 n, __u32 stack[]);
+
+extern void trap_virtual_enable_irqs(__u16 irqmask);
+extern void trap_virtual_disable_irqs(__u16 irqmask);
+extern void trap_virtual_eoi(void);
+
+#endif
Index: arch/ia32/include/mm/frame.h
===================================================================
--- arch/ia32/include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_FRAME_H__
+#define __i386_FRAME_H__
+
+#include <arch/types.h>
+
+#define FRAME_SIZE	4096
+
+extern __address bootstrap_dba;
+
+extern void frame_arch_init(void);
+
+#endif
Index: arch/ia32/include/mm/page.h
===================================================================
--- arch/ia32/include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_PAGE_H__
+#define __i386_PAGE_H__
+
+#include <arch/types.h>
+#include <arch/mm/frame.h>
+
+#define PAGE_SIZE	FRAME_SIZE
+
+#define KA2PA(x)	(x)
+#define PA2KA(x)	(x)
+
+struct page_specifier {
+	unsigned present : 1;
+	unsigned writeable : 1;
+	unsigned uaccessible : 1;
+	unsigned page_write_through : 1;
+	unsigned page_cache_disable : 1;
+	unsigned accessed : 1;
+	unsigned dirty : 1;
+	unsigned : 2;
+	unsigned avl : 3;
+	unsigned frame_address : 20;
+} __attribute__ ((packed));
+
+extern void page_arch_init(void);
+
+#endif
Index: arch/ia32/include/mm/vm.h
===================================================================
--- arch/ia32/include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_VM_H__
+#define __i386_VM_H__
+
+#include <arch/types.h>
+
+#define KERNEL_ADDRESS_SPACE_START_ARCH		(__address) 0x0
+#define KERNEL_ADDRESS_SPACE_END_ARCH		(__address) 0x3fffffff
+#define USER_ADDRESS_SPACE_START_ARCH		(__address) 0x40000000
+#define USER_ADDRESS_SPACE_END_ARCH		(__address) 0xffffffff	
+
+#define UTEXT_ADDRESS_ARCH	0x40000000
+#define USTACK_ADDRESS_ARCH	0xfffff000
+#define UDATA_ADDRESS_ARCH	0x41000000
+
+#endif
Index: arch/ia32/include/mp.h
===================================================================
--- arch/ia32/include/mp.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/mp.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MP_H__
+#define __MP_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/waitq.h>
+#include <config.h>
+
+struct __mpfs {
+	__u32 signature;
+	struct __mpct *configuration_table;
+	__u8 length;
+	__u8 revision;
+	__u8 checksum;
+	__u8 config_type;
+	__u8 mpfib2;
+	__u8 mpfib3;
+	__u8 mpfib4;
+	__u8 mpfib5;
+} __attribute__ ((packed));
+
+struct __mpct {
+	__u32 signature;
+	__u16 base_table_length;
+	__u8 revision;
+	__u8 checksum;
+	__u8 oem_id[8];
+	__u8 product_id[12];
+	__u8 *oem_table;
+	__u16 oem_table_size;
+	__u16 entry_count;
+	__u32 *l_apic;
+	__u16 ext_table_length;
+	__u8 ext_table_checksum;
+	__u8 xxx;
+	__u8 base_table[0];
+} __attribute__ ((packed));
+
+struct __processor_entry {
+	__u8 type;
+	__u8 l_apic_id;
+	__u8 l_apic_version;
+	__u8 cpu_flags;
+	__u8 cpu_signature[4];
+	__u32 feature_flags;
+	__u32 xxx[2];
+} __attribute__ ((packed));
+
+struct __bus_entry {
+	__u8 type;
+	__u8 bus_id;
+	__u8 bus_type[6];
+} __attribute__ ((packed));
+
+struct __io_apic_entry {
+	__u8 type;
+	__u8 io_apic_id;
+	__u8 io_apic_version;
+	__u8 io_apic_flags;
+	__u32 *io_apic;
+} __attribute__ ((packed));
+
+struct __io_intr_entry {
+	__u8 type;
+	__u8 intr_type;
+	__u8 poel;
+	__u8 xxx;
+	__u8 src_bus_id;
+	__u8 src_bus_irq;
+	__u8 dst_io_apic_id;
+	__u8 dst_io_apic_pin;
+} __attribute__ ((packed));
+
+struct __l_intr_entry {
+	__u8 type;
+	__u8 intr_type;
+	__u8 poel;
+	__u8 xxx;
+	__u8 src_bus_id;
+	__u8 src_bus_irq;
+	__u8 dst_l_apic_id;
+	__u8 dst_l_apic_pin;
+} __attribute__ ((packed));
+
+
+extern waitq_t ap_completion_wq;
+extern waitq_t kmp_completion_wq;
+
+extern int mp_irq_to_pin(int irq);
+
+extern void mp_init(void);
+extern void kmp(void *arg);
+
+#endif
Index: arch/ia32/include/pm.h
===================================================================
--- arch/ia32/include/pm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/pm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PM_H__
+#define __PM_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <arch/context.h>
+
+#define IDT_ITEMS 64
+#define GDT_ITEMS 6
+
+#define NULL_DES	0
+#define KTEXT_DES	1
+#define	KDATA_DES	2
+#define UTEXT_DES	3
+#define UDATA_DES	4
+#define TSS_DES		5
+
+#define selector(des)	((des)<<3)
+
+#define PL_KERNEL	0
+#define PL_USER		3
+
+#define AR_PRESENT	(1<<7)
+#define AR_DATA		(2<<3)
+#define AR_CODE		(3<<3)
+#define AR_WRITABLE	(1<<1)
+#define AR_INTERRUPT	(0xe)
+#define AR_TSS		(0x9)
+
+#define DPL_KERNEL	(PL_KERNEL<<5)
+#define DPL_USER	(PL_USER<<5)
+
+#define IO_MAP_BASE	(104)
+
+struct ptr_16_32 {
+	__u16 limit;
+	__u32 base;
+} __attribute__ ((packed));
+
+struct descriptor {
+	unsigned limit_0_15: 16;
+	unsigned base_0_15: 16;
+	unsigned base_16_23: 8;
+	unsigned access: 8;
+	unsigned limit_16_19: 4;
+	unsigned available: 1;
+	unsigned unused: 1;
+	unsigned special: 1;
+	unsigned granularity : 1;
+	unsigned base_24_31: 8;
+} __attribute__ ((packed));
+
+struct idescriptor {
+	unsigned offset_0_15: 16;
+	unsigned selector: 16;
+	unsigned unused: 8;
+	unsigned access: 8;
+	unsigned offset_16_31: 16;
+} __attribute__ ((packed));
+
+
+struct tss {
+	__u16 link;
+	unsigned : 16;
+	__u32 esp0;
+	__u16 ss0;
+	unsigned : 16;
+	__u32 esp1;
+	__u16 ss1;
+	unsigned : 16;
+	__u32 esp2;
+	__u16 ss2;
+	unsigned : 16;
+	__u32 cr3;
+	__u32 eip;
+	__u32 eflags;
+	__u32 eax;
+	__u32 ecx;
+	__u32 edx;
+	__u32 ebx;
+	__u32 esp;
+	__u32 ebp;
+	__u32 esi;
+	__u32 edi;
+	__u16 es;
+	unsigned : 16;
+	__u16 cs;
+	unsigned : 16;
+	__u16 ss;
+	unsigned : 16;
+	__u16 ds;
+	unsigned : 16;
+	__u16 fs;
+	unsigned : 16;
+	__u16 gs;
+	unsigned : 16;
+	__u16 ldtr;
+	unsigned : 16;
+	unsigned : 16;
+	__u16 io_map_base;
+} __attribute__ ((packed));
+
+extern struct ptr_16_32 gdtr;
+extern struct tss *tss_p;
+
+extern struct descriptor gdt[];
+extern struct idescriptor idt[];
+
+extern void pm_init(void);
+
+extern void gdt_setbase(struct descriptor *d, __address base);
+extern void gdt_setlimit(struct descriptor *d, __address limit);
+
+extern void idt_init(void);
+extern void idt_setoffset(struct idescriptor *d, __address offset);
+
+extern void tss_initialize(struct tss *t);
+
+#endif
Index: arch/ia32/include/thread.h
===================================================================
--- arch/ia32/include/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __i386_THREAD_H__
+#define __i386_THREAD_H__
+
+#define ARCH_THREAD_DATA
+
+#endif
Index: arch/ia32/include/types.h
===================================================================
--- arch/ia32/include/types.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/include/types.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TYPES_H__
+#define __TYPES_H__
+
+#define NULL 0
+
+typedef signed char __s8;
+
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned long __u32;
+typedef long long __u64;
+
+typedef __u32 __address;
+
+typedef __u32 pri_t;
+
+#endif
Index: arch/ia32/src/asm.s
===================================================================
--- arch/ia32/src/asm.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/asm.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,332 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# very low and hardware-level functions
+
+.text
+
+.global cpu_priority_high
+.global cpu_priority_low
+.global cpu_priority_restore
+.global cpu_priority_read
+.global cpu_halt
+.global cpu_sleep
+.global paging_on
+.global cpu_read_dba
+.global cpu_write_dba
+.global cpu_read_cr2
+.global enable_l_apic_in_msr
+.global interrupt_handlers
+.global inb
+.global inw
+.global inl
+.global outb
+.global outw
+.global outl
+.global memcopy
+.global memsetb
+.global memsetw
+.global memcmp
+
+#
+# set priority level high
+cpu_priority_high:
+	pushf
+	pop %eax
+	cli
+	ret
+    
+#
+# set priority level low
+cpu_priority_low:
+        pushf
+	pop %eax
+	sti
+	ret
+
+#
+# restore priority level
+cpu_priority_restore:
+	push 4(%esp)
+	popf
+	ret
+
+# return raw priority level
+cpu_priority_read:
+	pushf
+	pop %eax
+	ret
+
+cpu_halt:
+cpu_sleep:
+	hlt
+	ret
+
+paging_on:
+	pushl %eax
+	movl %cr0,%eax
+	orl $(1<<31),%eax		# paging on
+	andl $~((1<<30)|(1<<29)),%eax	# clear Cache Disable and not Write Though
+	movl %eax,%cr0
+	jmp 0f
+0:
+	popl %eax
+	ret
+
+cpu_read_dba:
+	movl %cr3,%eax
+	ret
+
+cpu_write_dba:
+	pushl %eax
+	movl 8(%esp),%eax
+	movl %eax,%cr3
+	popl %eax
+	ret
+
+cpu_read_cr2:
+	movl %cr2,%eax
+	ret
+
+enable_l_apic_in_msr:
+	pusha
+	
+	movl $0x1b, %ecx
+	rdmsr
+	orl $(1<<11),%eax
+	orl $(0xfee00000),%eax
+	wrmsr
+	
+	popa
+	ret
+
+.macro handler i n
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	# we must fill the data segment registers
+	movw $16,%ax
+	movw %ax,%ds
+	movw %ax,%es
+    
+	movl $(\i),%edi
+	pushl %ebp
+	addl $4,(%esp)
+	pushl %edi
+	call trap_dispatcher
+	addl $8,%esp
+
+	popa
+	pop %ebp
+    
+        iret
+    
+	.if (\n-\i)-1
+	handler "(\i+1)",\n
+	.endif
+.endm
+
+# keep in sync with pm.h !!!
+IDT_ITEMS=64
+interrupt_handlers:
+h_start:
+	handler 0 64
+#	handler 64 128	
+#	handler 128 192
+#	handler 192 256
+h_end:
+
+
+inb:
+	push %edx
+	xorl %eax,%eax
+	movl 8(%esp),%edx
+	inb %dx,%al
+	pop %edx
+	ret
+
+inw:
+	push %edx
+	xorl %eax,%eax
+	movl 8(%esp),%edx
+	inw %dx,%ax
+	pop %edx
+	ret
+
+inl:
+	push %edx
+	xorl %eax,%eax
+	movl 8(%esp),%edx
+	inl %dx,%eax
+	pop %edx
+	ret
+
+outb:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	movl 8(%ebp),%edx
+	movl 12(%ebp),%eax
+	outb %al,%dx
+    
+	popa
+	pop %ebp
+	ret
+
+outw:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	movl 8(%ebp),%edx
+	movl 12(%ebp),%eax
+	outw %ax,%dx
+    
+	popa
+	pop %ebp
+	ret
+
+outl:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	movl 8(%ebp),%edx
+	movl 12(%ebp),%eax
+	outl %eax,%dx
+    
+	popa
+	pop %ebp
+	ret
+
+SRC=8
+DST=12
+CNT=16
+memcopy:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	cld
+	movl CNT(%ebp),%ecx
+	movl DST(%ebp),%edi
+	movl SRC(%ebp),%esi    
+    
+	rep movsb %ds:(%esi),%es:(%edi)
+    
+	popa
+	pop %ebp
+	ret
+
+DST=8
+CNT=12
+X=16
+memsetw:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	cld
+	movl CNT(%ebp),%ecx
+	movl DST(%ebp),%edi
+	movl X(%ebp),%eax
+    
+	rep stosw %ax,%es:(%edi)
+    
+        popa
+	pop %ebp
+	ret
+
+DST=8
+CNT=12
+X=16
+memsetb:
+	push %ebp
+	movl %esp,%ebp
+	pusha
+    
+	cld
+	movl CNT(%ebp),%ecx
+	movl DST(%ebp),%edi
+	movl X(%ebp),%eax
+    
+	rep stosb %al,%es:(%edi)
+    
+        popa
+	pop %ebp
+	ret
+
+SRC=12
+DST=16
+CNT=20
+memcmp:
+	push %ebp
+	subl $4,%esp	
+	movl %esp,%ebp
+
+	pusha
+    
+	cld
+	movl CNT(%ebp),%ecx
+	movl DST(%ebp),%edi
+	movl SRC(%ebp),%esi    
+    
+	repe cmpsb %es:(%edi),%ds:(%esi)
+	movl %ecx,(%ebp)
+
+	popa
+	
+	movl (%ebp),%eax	# return value => %eax (zero on success)
+	addl $4,%esp
+	pop %ebp
+	
+	ret
+
+
+# THIS IS USERSPACE CODE
+.global utext
+utext:
+0:
+	movl $0xdeadbeaf, %eax
+	int $48
+	jmp 0b
+	# not reached
+utext_end:
+
+.data
+.global utext_size
+utext_size:
+	.long utext_end - utext 
+
+
+.section K_DATA_START
+.global interrupt_handler_size
+
+interrupt_handler_size: .long (h_end-h_start)/IDT_ITEMS
Index: arch/ia32/src/boot/boot.S
===================================================================
--- arch/ia32/src/boot/boot.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/boot/boot.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.section K_TEXT_START
+.global kernel_image_start
+
+.code16
+#
+# This is where we require any SPARTAN-kernel-compatible boot loader
+# to pass control in real mode.
+#
+# Protected mode tables are statically initialised during compile
+# time. So we can just load the respective table registers and
+# switch to protected mode.
+#
+kernel_image_start:
+	cli
+	xorw %ax,%ax
+	movw %ax,%ds
+	lgdt gdtr
+	movl %cr0,%eax
+	orl $0x1,%eax
+	movl %eax,%cr0
+	jmp 0f
+0:
+	movw $16,%ax
+	movw %ax,%es
+	movw %ax,%gs
+	movw %ax,%fs
+	movw %ax,%ds			# kernel data + stack
+        movw %ax,%ss
+	movl $0x7c00,%esp
+	jmpl $8,$meeting_point
+meeting_point:
+.code32
+
+	lidt idtr
+
+	call main_bsp			# never returns
+	
+
+	cli
+	hlt
Index: arch/ia32/src/context.s
===================================================================
--- arch/ia32/src/context.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/context.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,75 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.global context_save
+.global context_restore
+
+#
+# save context of this CPU
+context_save:
+	push %ebx
+
+	movl 4(%esp),%eax	# the caller's return %eip
+	movl 8(%esp),%ebx	# address of the kernel_context variable to save context to
+        movl %eax,4(%ebx)	# %eip -> ctx->pc
+	movl %esp,(%ebx)	# %esp -> ctx->sp
+
+	movl %ebx,%eax
+	pop %ebx
+
+	movl %ebx,8(%eax)
+	movl %ecx,12(%eax)
+	movl %edx,16(%eax)
+	movl %esi,20(%eax)
+	movl %edi,24(%eax)
+	movl %ebp,28(%eax)    
+    
+	xorl %eax,%eax		# context_save returns 1
+	incl %eax
+	ret
+    
+#
+# restore saved context on this CPU
+context_restore:
+	movl 4(%esp),%eax	# address of the kernel_context variable to restore context from
+	movl (%eax),%esp	# ctx->sp -> %esp
+	addl $4,%esp		# this is for the pop we don't do
+
+	movl 8(%eax),%ebx
+	movl 12(%eax),%ecx
+	movl 16(%eax),%edx
+	movl 20(%eax),%esi
+	movl 24(%eax),%edi
+	movl 28(%eax),%ebp
+
+	movl 4(%eax),%eax
+	movl %eax,(%esp)	# ctx->pc -> saver's return %eip
+        xorl %eax,%eax		# context_restore returns 0
+	ret
Index: arch/ia32/src/cpu/cpu.c
===================================================================
--- arch/ia32/src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/cpu.h>
+#include <arch/cpuid.h>
+#include <arch/pm.h>
+
+#include <arch.h>
+#include <arch/types.h>
+#include <print.h>
+#include <typedefs.h>
+
+/*
+ * Identification of CPUs.
+ * Contains only non-MP-Specification specific SMP code.
+ */
+#define AMD_CPUID_EBX	0x68747541
+#define AMD_CPUID_ECX 	0x444d4163
+#define AMD_CPUID_EDX 	0x69746e65
+
+#define INTEL_CPUID_EBX	0x756e6547
+#define INTEL_CPUID_ECX 0x6c65746e
+#define INTEL_CPUID_EDX 0x49656e69
+
+enum vendor {
+	VendorUnknown=0,
+	VendorAMD,
+	VendorIntel
+};
+
+static char *vendor_str[] = {
+	"Unknown Vendor",
+	"AuthenticAMD",
+	"GenuineIntel"
+};
+
+void cpu_arch_init(void)
+{
+	the->cpu->arch.tss = tss_p;
+}
+
+
+void cpu_identify(void)
+{
+	cpu_info_t info;
+	int i;
+
+	the->cpu->arch.vendor = VendorUnknown;
+	if (has_cpuid()) {
+		cpuid(0, &info);
+
+		/*
+		 * Check for AMD processor.
+		 */
+		if (info.cpuid_ebx==AMD_CPUID_EBX && 
+		    info.cpuid_ecx==AMD_CPUID_ECX &&
+		    info.cpuid_edx==AMD_CPUID_EDX) {
+			
+			the->cpu->arch.vendor = VendorAMD;
+		}
+
+		/*
+		 * Check for Intel processor.
+		 */		
+		if (info.cpuid_ebx==INTEL_CPUID_EBX && 
+		    info.cpuid_ecx==INTEL_CPUID_ECX &&
+		    info.cpuid_edx==INTEL_CPUID_EDX) {
+
+			the->cpu->arch.vendor = VendorIntel;
+
+		}
+				
+		cpuid(1, &info);
+		the->cpu->arch.family = (info.cpuid_eax>>8)&0xf;
+		the->cpu->arch.model = (info.cpuid_eax>>4)&0xf;
+		the->cpu->arch.stepping = (info.cpuid_eax>>0)&0xf;						
+	}
+}
+
+void cpu_print_report(struct cpu* m)
+{
+	printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n",
+		m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, m->arch.stepping,
+		m->frequency_mhz);
+}
Index: arch/ia32/src/cpuid.s
===================================================================
--- arch/ia32/src/cpuid.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/cpuid.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,79 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# CPU identification functions.
+# The code below just interfaces the CPUID instruction.
+# CPU recognition logic is contained in higher-level functions.
+
+.text
+
+.global has_cpuid
+.global cpuid
+.global rdtsc
+
+has_cpuid:
+	push %ebx
+	
+	pushf			# store flags
+	popl %eax		# read flags
+	movl %eax,%ebx		# copy flags
+	btcl $21,%ebx		# swap the ID bit
+	pushl %ebx
+	popf			# propagate the change into flags
+	pushf
+	popl %ebx		# read flags	
+	andl $(1<<21),%eax	# interested only in ID bit
+	andl $(1<<21),%ebx
+	xorl %ebx,%eax		# 0 if not supported, 1 if supported
+	
+	pop %ebx
+	ret
+
+# cpuid(__u32 cmd, struct cpu_info *info)
+cpuid:
+	pushl %ebp
+	movl %esp,%ebp
+	pusha
+
+	movl 8(%ebp),%eax	# load the command into %eax
+	movl 12(%ebp),%esi	# laod the address of the info struct
+
+	cpuid	
+	movl %eax,0(%esi)
+	movl %ebx,4(%esi)
+	movl %ecx,8(%esi)
+	movl %edx,12(%esi)
+    
+	popa
+	popl %ebp
+	ret
+
+rdtsc:
+	rdtsc
+	ret
Index: arch/ia32/src/debug/panic.s
===================================================================
--- arch/ia32/src/debug/panic.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/debug/panic.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+.global panic
+
+panic:
+	movl $halt,(%esp)	# fake stack to make printf return to halt
+	jmp printf
Index: arch/ia32/src/delay.s
===================================================================
--- arch/ia32/src/delay.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/delay.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,54 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Micro second delay loop functions.
+#
+
+.text
+
+.global asm_delay_loop
+.global asm_fake_loop
+
+asm_delay_loop:
+	pushl %ecx
+	movl 8(%esp),%ecx	# move argument to %ecx
+0:	lahf
+	dec %ecx
+	jnz 0b
+	popl %ecx
+	ret
+
+asm_fake_loop:
+	pushl %ecx
+	movl 8(%esp),%ecx	# move argument to %ecx
+0:	lahf
+	dec %ecx
+	jz 0b
+	popl %ecx
+	ret
Index: arch/ia32/src/drivers/ega.c
===================================================================
--- arch/ia32/src/drivers/ega.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/drivers/ega.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/ega.h>
+#include <putchar.h>
+#include <mm/page.h>
+#include <synch/spinlock.h>
+#include <arch/types.h>
+#include <arch/asm.h>
+
+/*
+ * The EGA driver.
+ * Simple and short. Function for displaying characters and "scrolling".
+ */
+
+static spinlock_t egalock;
+static __u32 ega_cursor;
+
+void ega_move_cursor(void);
+
+void ega_init(void)
+{
+	__u8 hi, lo;
+
+	map_page_to_frame(VIDEORAM, VIDEORAM, PAGE_NOT_CACHEABLE, 0);
+	outb(0x3d4,0xe);
+	hi = inb(0x3d5);
+	outb(0x3d4,0xf);
+	lo = inb(0x3d5);
+	ega_cursor = (hi<<8)|lo;
+	ega_putchar('\n');
+}
+
+void ega_display_char(char ch)
+{
+	__u8 *vram = (__u8 *) VIDEORAM;
+	
+	vram[ega_cursor*2] = ch;
+}
+
+/*
+ * This function takes care of scrolling.
+ */
+void ega_check_cursor(void)
+{
+	if (ega_cursor < SCREEN)
+	    return;
+
+	memcopy(VIDEORAM + ROW*2, VIDEORAM, (SCREEN - ROW)*2);
+	memsetw(VIDEORAM + (SCREEN - ROW)*2, ROW, 0x0720);
+	ega_cursor = ega_cursor - ROW;
+}
+
+void ega_putchar(char ch)
+{
+	pri_t pri;
+
+	pri = cpu_priority_high();
+	spinlock_lock(&egalock);
+
+	switch (ch) {
+	    case '\n':
+		    ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW;
+		    break;
+	    case '\t':
+		    ega_cursor = (ega_cursor + 8) - ega_cursor % 8;
+		    break; 
+	    default:
+		    ega_display_char(ch);
+		    ega_cursor++;
+		    break;
+        }
+	ega_check_cursor();
+	ega_move_cursor();
+        
+	spinlock_unlock(&egalock);
+	cpu_priority_restore(pri);
+}
+
+void ega_move_cursor(void)
+{
+	outb(0x3d4,0xe);
+	outb(0x3d5,(ega_cursor>>8)&0xff);
+	outb(0x3d4,0xf);
+	outb(0x3d5,ega_cursor&0xff);	
+}
+
+void putchar(char ch)
+{
+	ega_putchar(ch);
+}
Index: arch/ia32/src/drivers/i8042.c
===================================================================
--- arch/ia32/src/drivers/i8042.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/drivers/i8042.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/i8042.h>
+#include <arch/i8259.h>
+#include <arch/interrupt.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <arch.h>
+#include <print.h>
+
+/*
+ * i8042 processor driver.
+ * Its very essential function is enabling the A20.
+ */
+
+void i8042_init(void)
+{
+	/* A20: deadly if not enabled */
+	outb(0x64,0xd1);
+	outb(0x60,0xdf);
+	
+	trap_register(VECTOR_KBD, i8042_interrupt);
+}
+
+void i8042_interrupt(__u8 n, __u32 stack[])
+{
+	__u8 x;
+
+	trap_virtual_eoi();
+	x = inb(0x60);
+	printf("%d", the->cpu->id);;
+}
Index: arch/ia32/src/drivers/i8254.c
===================================================================
--- arch/ia32/src/drivers/i8254.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/drivers/i8254.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/types.h>
+#include <time/clock.h>
+#include <time/delay.h>
+#include <arch/interrupt.h>
+#include <arch/i8259.h>
+#include <arch/i8254.h>
+#include <cpu.h>
+#include <config.h>
+#include <arch/pm.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+/*
+ * i8254 chip driver.
+ * Low level time functions.
+ */
+
+#define CLK_PORT1	0x40
+#define CLK_PORT4	0x43
+
+
+#define CLK_CONST	1193180
+#define MAGIC_NUMBER	1194
+
+void i8254_init(void)
+{
+	i8254_normal_operation();
+}
+
+void i8254_normal_operation(void)
+{
+	outb(CLK_PORT4, 0x36);
+	trap_virtual_disable_irqs(1<<IRQ_CLK);
+	outb(CLK_PORT1, (CLK_CONST/HZ) & 0xf);
+	outb(CLK_PORT1, (CLK_CONST/HZ) >> 8);
+	trap_virtual_enable_irqs(1<<IRQ_CLK);
+	trap_register(VECTOR_CLK, i8254_interrupt);
+}
+
+#define LOOPS 150000
+#define SHIFT 11
+void i8254_calibrate_delay_loop(void)
+{
+	__u64 clk1, clk2;
+	__u32 t1, t2, o1, o2;
+	__u8 not_ok;
+
+
+	/*
+	 * One-shot timer. Count-down from 0xffff at 1193180Hz
+	 * MAGIC_NUMBER is the magic value for 1ms.
+	 */
+	outb(CLK_PORT4, 0x30);
+	outb(CLK_PORT1, 0xff);
+	outb(CLK_PORT1, 0xff);
+
+	do {
+	        /* will read both status and count */
+		outb(CLK_PORT4, 0xc2);
+		not_ok = (inb(CLK_PORT1)>>6)&1;
+		t1 = inb(CLK_PORT1);
+		t1 |= inb(CLK_PORT1) << 8;
+	} while (not_ok);
+
+	asm_delay_loop(LOOPS);
+
+	outb(CLK_PORT4, 0xd2);
+	t2 = inb(CLK_PORT1);
+	t2 |= inb(CLK_PORT1) << 8;
+
+	/*
+	 * We want to determine the overhead of the calibrating mechanism.
+	 */
+	outb(CLK_PORT4, 0xd2);
+	o1 = inb(CLK_PORT1);
+	o1 |= inb(CLK_PORT1) << 8;
+
+	asm_fake_loop(LOOPS);
+
+	outb(CLK_PORT4, 0xd2);
+	o2 = inb(CLK_PORT1);
+	o2 |= inb(CLK_PORT1) << 8;
+
+
+	the->cpu->delay_loop_const = ((MAGIC_NUMBER*LOOPS)/1000) / ((t1-t2)-(o1-o2)) + 
+				    (((MAGIC_NUMBER*LOOPS)/1000) % ((t1-t2)-(o1-o2)) ? 1 : 0);
+	
+
+	clk1 = rdtsc();
+	delay(1<<SHIFT);
+	clk2 = rdtsc();
+	
+	the->cpu->frequency_mhz = (clk2-clk1)>>SHIFT;
+
+	return;
+}
+
+void i8254_interrupt(__u8 n, __u32 stack[])
+{
+	trap_virtual_eoi();
+	clock();
+}
Index: arch/ia32/src/drivers/i8259.c
===================================================================
--- arch/ia32/src/drivers/i8259.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/drivers/i8259.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/i8259.h>
+#include <cpu.h>
+#include <arch/types.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+/*
+ * This is the PIC driver.
+ * Programmable Interrupt Controller for UP systems.
+ */
+
+void i8259_init(void)
+{
+	/* ICW1: this is ICW1, ICW4 to follow */
+	outb(PIC_PIC0PORT1, PIC_ICW1 | PIC_NEEDICW4);
+
+	/* ICW2: IRQ 0 maps to INT IRQBASE */
+	outb(PIC_PIC0PORT2, IVT_IRQBASE);
+    
+	/* ICW3: pic1 using IRQ IRQ_PIC1 */
+	outb(PIC_PIC0PORT2, 1 << IRQ_PIC1);
+    
+	/* ICW4: i8086 mode */    
+	outb(PIC_PIC0PORT2, 1);
+
+	/* ICW1: ICW1, ICW4 to follow */
+	outb(PIC_PIC1PORT1, PIC_ICW1 | PIC_NEEDICW4);
+
+	/* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */    
+	outb(PIC_PIC1PORT2, IVT_IRQBASE + 8);
+
+	/* ICW3: pic1 is known as PIC_PIC1ID */
+	outb(PIC_PIC1PORT2, PIC_PIC1ID);
+
+	/* ICW4: i8086 mode */    
+	outb(PIC_PIC1PORT2, 1);
+
+	/*
+	 * Register interrupt handler for the PIC spurious interrupt.
+	 */
+	trap_register(VECTOR_PIC_SPUR, pic_spurious);	
+
+	/*
+	 * Set the enable/disable IRQs handlers.
+	 * Set the End-of-Interrupt handler.
+	 */
+	enable_irqs_function = pic_enable_irqs;
+	disable_irqs_function = pic_disable_irqs;
+	eoi_function = pic_eoi;
+    
+	pic_disable_irqs(0xffff);		/* disable all irq's */
+	pic_enable_irqs(1<<IRQ_PIC1);		/* but enable pic1 */
+}
+
+void pic_enable_irqs(__u16 irqmask)
+{
+	__u8 x;
+    
+	if (irqmask & 0xff) {
+    		x = inb(PIC_PIC0PORT2);
+		outb(PIC_PIC0PORT2, x & (~(irqmask & 0xff)));
+	}
+	if (irqmask >> 8) {
+    		x = inb(PIC_PIC1PORT2);
+		outb(PIC_PIC1PORT2, x & (~(irqmask >> 8)));
+	}
+}
+
+void pic_disable_irqs(__u16 irqmask)
+{
+	__u8 x;
+    
+	if (irqmask & 0xff) {
+    		x = inb(PIC_PIC0PORT2);
+		outb(PIC_PIC0PORT2, x | (irqmask & 0xff));
+	}
+	if (irqmask >> 8) {
+    		x = inb(PIC_PIC1PORT2);
+		outb(PIC_PIC1PORT2, x | (irqmask >> 8));
+	}
+}
+
+void pic_eoi(void)
+{
+	outb(0x20,0x20);
+        outb(0xa0,0x20);
+}
+
+void pic_spurious(__u8 n, __u32 stack[])
+{
+	printf("cpu%d: PIC spurious interrupt\n", the->cpu->id);
+}
Index: arch/ia32/src/ia32.c
===================================================================
--- arch/ia32/src/ia32.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/ia32.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch.h>
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+#include <arch/pm.h>
+
+#include <arch/ega.h>
+#include <arch/i8042.h>
+#include <arch/i8254.h>
+#include <arch/i8259.h>
+
+#include <arch/context.h>
+
+#include <config.h>
+
+#include <arch/interrupt.h>
+
+
+void arch_init(void)
+{
+	pm_init();
+
+	if (config.cpu_active == 1) {
+		ega_init();	/* video */
+		i8042_init();	/* a20 bit */
+		i8259_init();	/* PIC */
+		i8254_init();	/* hard clock */
+		
+		trap_register(VECTOR_SYSCALL, syscall);
+	}
+}
+
+void calibrate_delay_loop(void)
+{
+	i8254_calibrate_delay_loop();
+	i8254_normal_operation();
+}
Index: arch/ia32/src/interrupt.c
===================================================================
--- arch/ia32/src/interrupt.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/interrupt.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/interrupt.h>
+#include <print.h>
+#include <panic.h>
+#include <arch/i8259.h>
+#include <func.h>
+#include <cpu.h>
+#include <arch/asm.h>
+
+/*
+ * Interrupt and exception dispatching.
+ */
+
+static iroutine ivt[IVT_ITEMS];
+
+void (* disable_irqs_function)(__u16 irqmask) = NULL;
+void (* enable_irqs_function)(__u16 irqmask) = NULL;
+void (* eoi_function)(void) = NULL;
+
+iroutine trap_register(__u8 n, iroutine f)
+{
+	iroutine old;
+    
+	old = ivt[n];
+	ivt[n] = f;
+    
+    	return old;
+}
+
+/*
+ * Called directly from the assembler code.
+ * CPU is cpu_priority_high().
+ */
+void trap_dispatcher(__u8 n, __u32 stack[])
+{
+	ivt[n](n,stack);
+}
+
+void null_interrupt(__u8 n, __u32 stack[])
+{
+	printf("int %d: null_interrupt\n", n);
+	printf("stack: %L, %L, %L, %L\n", stack[0], stack[1], stack[2], stack[3]);
+	panic("unserviced interrupt\n");
+}
+
+void gp_fault(__u8 n, __u32 stack[])
+{
+	printf("stack[0]=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
+	printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
+	printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
+	panic("general protection fault\n");
+}
+
+void page_fault(__u8 n, __u32 stack[])
+{
+	printf("page fault address: %X\n", cpu_read_cr2());
+	printf("stack[0]=%X, %%eip=%X, %%cs=%X, flags=%X\n", stack[0], stack[1], stack[2], stack[3]);
+	printf("%%eax=%L, %%ebx=%L, %%ecx=%L, %%edx=%L,\n%%edi=%L, %%esi=%L, %%ebp=%L, %%esp=%L\n", stack[-2], stack[-5], stack[-3], stack[-4], stack[-9], stack[-8], stack[-1], stack);
+	printf("stack: %X, %X, %X, %X\n", stack[4], stack[5], stack[6], stack[7]);
+	panic("page fault\n");
+}
+
+void syscall(__u8 n, __u32 stack[])
+{
+	printf("syscall... ");
+	thread_sleep(1);
+}
+
+void trap_virtual_enable_irqs(__u16 irqmask)
+{
+	if (enable_irqs_function)
+		enable_irqs_function(irqmask);
+	else
+		panic(PANIC "no enable_irqs_function\n");
+}
+
+void trap_virtual_disable_irqs(__u16 irqmask)
+{
+	if (disable_irqs_function)
+		disable_irqs_function(irqmask);
+	else
+		panic(PANIC "no disable_irqs_function\n");
+}
+
+void trap_virtual_eoi(void)
+{
+	if (eoi_function)
+		eoi_function();
+	else
+		panic(PANIC "no eoi_function\n");
+
+}
Index: arch/ia32/src/mm/frame.c
===================================================================
--- arch/ia32/src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/frame.h>
+#include <arch/mm/frame.h>
+#include <mm/vm.h>
+#include <config.h>
+
+/*
+ * TODO: use the memory map obtained from BIOS
+ */
+void frame_arch_init(void)
+{
+	if (config.cpu_active == 1) {
+		__u32 kernel_frames_max;
+		
+		kernel_frames_max = ((KERNEL_ADDRESS_SPACE_END+1)/FRAME_SIZE);
+		
+		kernel_frames_free = kernel_frames = frames < kernel_frames_max ? frames : kernel_frames_max;
+		frame_kernel_bitmap = frame_bitmap;
+
+		frame_not_free(0x0);
+
+                frame_region_not_free(0xa0000,0xff000);
+                frame_region_not_free(0xfec00000,0xffffffff);
+	}
+}
Index: arch/ia32/src/mm/page.c
===================================================================
--- arch/ia32/src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/types.h>
+#include <config.h>
+#include <func.h>
+#include <mm/frame.h>
+#include <mm/page.h>
+#include <arch/mm/page.h>
+#include <arch/interrupt.h>
+#include <arch/asm.h>
+#include <synch/spinlock.h>
+
+/*
+ * Note.
+ * This is the preliminary code for controlling paging mechanism on i386. It is
+ * needed by other parts of the kernel for its ability to map virtual addresses
+ * to physical. SMP code relies on this feature. Other than that, this code is
+ * by no means meant to implement virtual memory in terms of swapping pages in
+ * and out.
+ */
+
+__address bootstrap_dba; 
+
+void page_arch_init(void)
+{
+	__address dba;
+	__u32 i;
+
+	if (config.cpu_active == 1) {
+		dba = frame_alloc(FRAME_KA | FRAME_PANIC);
+		memsetb(dba, PAGE_SIZE, 0);
+		cpu_write_dba(dba);
+	    
+		bootstrap_dba = dba;
+
+		/*
+		 * Identity mapping for all but 0th page.
+		 */
+		for (i = 1; i < frames; i++)
+			map_page_to_frame(i * PAGE_SIZE, i * PAGE_SIZE, PAGE_CACHEABLE, 0);
+
+		trap_register(14, page_fault);
+	}
+	else {
+
+		/*
+		 * Application processors need to create their own view of the
+		 * virtual address space. Because of that, each AP copies
+		 * already-initialized paging information from the bootstrap
+		 * processor and adjusts it to fulfill its needs.
+		 */
+
+		dba = frame_alloc(FRAME_KA | FRAME_PANIC);
+		memcopy(bootstrap_dba, dba, PAGE_SIZE);
+		cpu_write_dba(dba);
+	}
+
+	paging_on();
+}
+
+/*
+ * Besides mapping pages to frames, this function also sets the present bit of
+ * the page's specifier in both page directory and respective page table. If
+ * the page table for this page has not been allocated so far, it will take
+ * care of it and allocate the necessary frame.
+ *
+ * When the copy parameter is positive, map_page_to_frame will not overwrite
+ * the current mapping. It will allocate a new frame and do the mapping on it
+ * instead.
+ *
+ * PAGE_CACHEABLE flag: when set, it turns caches for that page on
+ * PAGE_NOT_PRESENT flag: when set, it marks the page not present
+ * PAGE_USER flag: when set, the page is accessible from userspace
+ */
+void map_page_to_frame(__address page, __address frame, int flags, int copy)
+{
+	struct page_specifier *pd, *pt;
+	__address dba, newpt;
+	int pde, pte;
+
+	dba = cpu_read_dba();
+
+	pde = page >> 22;		/* page directory entry */
+	pte = (page >> 12) & 0x3ff;	/* page table entry */
+	
+	pd = (struct page_specifier *) dba;
+	
+	if (!pd[pde].present) {
+		/*
+		 * There is currently no page table for this address. Allocate
+		 * frame for the page table and clean it.
+		 */
+		newpt = frame_alloc(FRAME_KA);
+		pd[pde].frame_address = newpt >> 12;
+		memsetb(newpt, PAGE_SIZE, 0);
+		pd[pde].present = 1;
+		pd[pde].uaccessible = 1;
+	}
+	if (copy) {
+		newpt = frame_alloc(FRAME_KA);
+		memcopy(pd[pde].frame_address << 12, newpt, PAGE_SIZE);
+		pd[pde].frame_address = newpt >> 12;
+	}
+	pt = (struct page_specifier *) (pd[pde].frame_address << 12);
+
+	pt[pte].frame_address = frame >> 12;
+	pt[pte].present = !(flags & PAGE_NOT_PRESENT);
+	pt[pte].page_cache_disable = !(flags & PAGE_CACHEABLE);
+	pt[pte].uaccessible = (flags & PAGE_USER) != 0;
+	pt[pte].writeable = (flags & PAGE_WRITE) != 0;	
+	
+	tlb_invalidate(0);
+}
Index: arch/ia32/src/mm/tlb.c
===================================================================
--- arch/ia32/src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/tlb.h>
+#include <arch/asm.h>
+
+void tlb_invalidate(int asid)
+{
+	cpu_write_dba(cpu_read_dba());
+}
Index: arch/ia32/src/pm.c
===================================================================
--- arch/ia32/src/pm.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/pm.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/pm.h>
+#include <config.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <arch/interrupt.h>
+#include <arch/asm.h>
+#include <arch/context.h>
+#include <panic.h>
+
+/*
+ * Early i386 configuration functions and data structures.
+ */
+
+/*
+ * We have no use for segmentation so we set up flat mode. In this
+ * mode, we use, for each privilege level, two segments spanning the
+ * whole memory. One is for code and one is for data.
+ */
+struct descriptor gdt[GDT_ITEMS] = {
+    /* NULL descriptor */
+    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+    /* KTEXT descriptor */
+    { 0xffff, 0, 0, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 1, 1, 0 },
+    /* KDATA descriptor */
+    { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL, 0xf, 0, 0, 1, 1, 0 },
+    /* UTEXT descriptor */
+    { 0xffff, 0, 0, AR_PRESENT | AR_CODE | DPL_USER, 0xf, 0, 0, 1, 1, 0 },
+    /* UDATA descriptor */
+    { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 },
+    /* TSS descriptor - set up will be completed later */
+    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+};
+
+static struct idescriptor idt[IDT_ITEMS];
+
+static struct tss tss;
+
+struct tss *tss_p = NULL;
+
+/* gdtr changes everytime new CPU is initialized */
+struct ptr_16_32 gdtr = { .limit = sizeof(gdt), .base = (__address) gdt };
+struct ptr_16_32 idtr = { .limit = sizeof(idt), .base = (__address) idt };
+
+void gdt_setbase(struct descriptor *d, __address base)
+{
+        d->base_0_15 = base & 0xffff;
+        d->base_16_23 = (base >> 16) & 0xff;
+        d->base_24_31 = (base >> 24) & 0xff;
+}
+
+void gdt_setlimit(struct descriptor *d, __address limit)
+{
+        d->limit_0_15 = limit & 0xffff;
+        d->limit_16_19 = (limit >> 16) & 0xf;
+}
+
+void idt_setoffset(struct idescriptor *d, __address offset)
+{
+	d->offset_0_15 = offset & 0xffff;
+	d->offset_16_31 = offset >> 16;
+}
+
+void tss_initialize(struct tss *t)
+{
+	memsetb((__address) t, sizeof(struct tss), 0);
+}
+
+/*
+ * This function takes care of proper setup of IDT and IDTR.
+ */
+void idt_init(void)
+{
+	struct idescriptor *d;
+	int i;
+    
+	for (i = 0; i < IDT_ITEMS; i++) {
+		d = &idt[i];
+
+		d->unused = 0;
+		d->selector = selector(KTEXT_DES);
+
+		d->access = AR_PRESENT | AR_INTERRUPT;	/* masking interrupt */
+
+		if (i == VECTOR_SYSCALL) {
+			/*
+			 * The syscall interrupt gate must be calleable from userland.
+			 */
+			d->access |= DPL_USER;
+		}
+		
+		idt_setoffset(d, ((__address) interrupt_handlers) + i*interrupt_handler_size);
+		trap_register(i, null_interrupt);
+	}
+	trap_register(13, gp_fault);
+}
+
+
+void pm_init(void)
+{
+	struct descriptor *gdt_p = (struct descriptor *) gdtr.base;
+
+	/*
+	 * Each CPU has its private GDT and TSS.
+	 * All CPUs share one IDT.
+	 */
+
+	if (config.cpu_active == 1) {
+		idt_init();
+		/*
+		 * NOTE: bootstrap CPU has statically allocated TSS, because
+		 * the heap hasn't been initialized so far.
+		 */
+		tss_p = &tss;
+	}
+	else {
+		tss_p = (struct tss *) malloc(sizeof(struct tss));
+		if (!tss_p)
+			panic(PANIC "could not allocate TSS\n");
+	}
+
+	tss_initialize(tss_p);
+	
+	gdt_p[TSS_DES].access = AR_PRESENT | AR_TSS | DPL_KERNEL;
+	gdt_p[TSS_DES].special = 1;
+	gdt_p[TSS_DES].granularity = 1;
+	
+	gdt_setbase(&gdt_p[TSS_DES], (__address) tss_p);
+	gdt_setlimit(&gdt_p[TSS_DES], sizeof(struct tss) - 1);
+
+	/*
+	 * As of this moment, the current CPU has its own GDT pointing
+	 * to its own TSS. We just need to load the TR register.
+	 */
+	__asm__("ltr %0" : : "r" ((__u16) selector(TSS_DES)));
+}
Index: arch/ia32/src/smp/ap.S
===================================================================
--- arch/ia32/src/smp/ap.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/smp/ap.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Init code for application processors.
+#
+
+.text
+
+#ifdef __SMP__
+
+.global ap_boot
+
+KTEXT=8
+KDATA=16
+
+# This piece of code is real-mode and is meant to be alligned at 4K boundary.
+# The requirement for such an alignment comes from MP Specification's STARTUP IPI
+# requirements.
+
+.align 4096
+ap_boot:
+.code16
+	cli
+
+	xorw %ax,%ax
+	movw %ax,%ds
+
+	lgdt gdtr
+	movl %cr0,%eax
+	orl $1,%eax
+	movl %eax,%cr0
+	ljmp $KTEXT,$jump_to_kernel
+
+# this is where the AP enters the kernel space
+jump_to_kernel:
+.code32
+	movw $KDATA,%ax
+	movw %ax,%ds
+	movw %ax,%es
+	movw %ax,%ss
+	movl $ctx,%eax
+	movl (%eax),%esp
+
+	lidt idtr
+
+	ljmp $KTEXT,$main_ap
+
+#endif /* __SMP__ */
Index: arch/ia32/src/smp/apic.c
===================================================================
--- arch/ia32/src/smp/apic.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/smp/apic.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __SMP__
+
+#include <arch/types.h>
+#include <arch/apic.h>
+#include <arch/ap.h>
+#include <mm/page.h>
+#include <time/delay.h>
+#include <arch/interrupt.h>
+#include <print.h>
+#include <arch/mp.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+/*
+ * This is functional, far-from-general-enough interface to the APIC.
+ * Advanced Programmable Interrupt Controller for MP systems.
+ * Tested on:
+ *	Bochs 2.0.2 with 2-8 CPUs
+ *	ASUS P/I-P65UP5 + ASUS C-P55T2D REV. 1.41 with 2x 200Mhz Pentium CPUs
+ */
+
+/*
+ * These variables either stay configured as initilalized, or are changed by
+ * the MP configuration code.
+ *
+ * Pay special attention to the volatile keyword. Without it, gcc -O2 would
+ * optimize the code too much and accesses to l_apic and io_apic, that must
+ * always be 32-bit, would use byte oriented instructions.
+ */
+volatile __u32 *l_apic = (__u32 *) 0xfee00000;
+volatile __u32 *io_apic = (__u32 *) 0xfec00000;
+
+__u32 apic_id_mask = 0;
+
+int apic_poll_errors(void);
+
+void apic_init(void)
+{
+	__u32 tmp, id, i;
+
+	trap_register(VECTOR_APIC_SPUR, apic_spurious);
+
+	enable_irqs_function = io_apic_enable_irqs;
+	disable_irqs_function = io_apic_disable_irqs;
+	eoi_function = l_apic_eoi;
+	
+	/*
+	 * Configure interrupt routing.
+	 * IRQ 0 remains masked as the time signal is generated by l_apic's themselves.
+	 * Other interrupts will be forwarded to the lowest priority CPU.
+	 */
+	io_apic_disable_irqs(0xffff);
+	trap_register(VECTOR_CLK, l_apic_timer_interrupt);
+	for (i=1; i<16; i++) {
+		int pin;
+	
+		if ((pin = mp_irq_to_pin(i)) != -1)
+	    		io_apic_change_ioredtbl(pin,0xf,IVT_IRQBASE+i,LOPRI);
+	}
+	
+
+	/*
+	 * Ensure that io_apic has unique ID.
+	 */
+	tmp = io_apic_read(IOAPICID);
+	id = (tmp >> 24) & 0xf;
+	if ((1<<id) & apic_id_mask) {
+		int i;
+		
+		for (i=0; i<15; i++) {
+			if (!((1<<i) & apic_id_mask)) {
+				io_apic_write(IOAPICID, (tmp & (~(0xf<<24))) | (i<<24));
+				break;
+			}
+		}
+	}
+
+
+
+	/*
+	 * Configure the BSP's lapic.
+	 */
+	l_apic_init();
+	l_apic_debug();	
+}
+
+void apic_spurious(__u8 n, __u32 stack[])
+{
+	printf("cpu%d: APIC spurious interrupt\n", the->cpu->id);
+}
+
+int apic_poll_errors(void)
+{
+	__u32 esr;
+	
+	esr = l_apic[ESR] & ~ESRClear;
+	
+	if ((esr>>0) & 1)
+		printf("Send CS Error\n");
+	if ((esr>>1) & 1)
+		printf("Receive CS Error\n");
+	if ((esr>>2) & 1)
+		printf("Send Accept Error\n");
+	if ((esr>>3) & 1)
+		printf("Receive Accept Error\n");
+	if ((esr>>5) & 1)
+		printf("Send Illegal Vector\n");
+	if ((esr>>6) & 1)
+		printf("Received Illegal Vector\n");
+	if ((esr>>7) & 1)
+		printf("Illegal Register Address\n");
+    
+	return !esr;
+}
+
+/*
+ * Universal Start-up Algorithm for bringing up the AP processors.
+ */
+int l_apic_send_init_ipi(__u8 apicid)
+{
+	__u32 lo, hi;
+	int i;
+
+	/*
+	 * Read the ICR register in and zero all non-reserved fields.
+	 */
+	lo = l_apic[ICRlo] & ICRloClear;
+	hi = l_apic[ICRhi] & ICRhiClear;
+	
+	lo |= DLVRMODE_INIT | DESTMODE_PHYS | LEVEL_ASSERT | SHORTHAND_DEST | TRGRMODE_LEVEL;
+	hi |= apicid << 24;
+	
+	l_apic[ICRhi] = hi;
+	l_apic[ICRlo] = lo;
+	
+	/*
+	 * According to MP Specification, 20us should be enough to
+	 * deliver the IPI.
+	 */
+	delay(20);
+
+	if (!apic_poll_errors()) return 0;
+
+	lo = l_apic[ICRlo] & ICRloClear;
+	if (lo & SEND_PENDING)
+		printf("IPI is pending.\n");
+	
+	l_apic[ICRlo] = lo | DLVRMODE_INIT | DESTMODE_PHYS | LEVEL_DEASSERT | SHORTHAND_DEST | TRGRMODE_LEVEL;
+
+	/*
+	 * Wait 10ms as MP Specification specifies.
+	 */
+	delay(10000);
+
+	/*
+	 * MP specification says this should not be done for 82489DX-based
+	 * l_apic's. However, everything is ok as long as STARTUP IPI is ignored
+	 * by 8249DX.
+	 */
+	for (i = 0; i < 2; i++) {
+		lo = l_apic[ICRlo] & ICRloClear;
+		lo |= ((__address) ap_boot) / 4096; /* calculate the reset vector */
+		l_apic[ICRlo] = lo | DLVRMODE_STUP | DESTMODE_PHYS | LEVEL_ASSERT | SHORTHAND_DEST |  TRGRMODE_LEVEL;
+		delay(200);
+	}
+	
+	return apic_poll_errors();
+}
+
+void l_apic_init(void)
+{
+	__u32 tmp, t1, t2;
+	
+
+	l_apic[LVT_Err] |= (1<<16);
+	l_apic[LVT_LINT0] |= (1<<16);
+	l_apic[LVT_LINT1] |= (1<<16);
+
+	tmp = l_apic[SVR] & SVRClear;
+	l_apic[SVR] = tmp | (1<<8) | (VECTOR_APIC_SPUR);
+
+	l_apic[TPR] &= TPRClear;
+
+	if (the->cpu->arch.family >= 6)
+		enable_l_apic_in_msr();
+	
+	tmp = l_apic[ICRlo] & ICRloClear;
+	l_apic[ICRlo] = tmp | DLVRMODE_INIT | DESTMODE_PHYS | LEVEL_DEASSERT | SHORTHAND_INCL | TRGRMODE_LEVEL;
+	
+	/*
+	 * Program the timer for periodic mode and respective vector.
+	 */
+
+	l_apic[TDCR] &= TDCRClear;
+	l_apic[TDCR] |= 0xb;
+	tmp = l_apic[LVT_Tm] | (1<<17) | (VECTOR_CLK);
+	l_apic[LVT_Tm] = tmp & ~(1<<16);
+
+	t1 = l_apic[CCRT];
+	l_apic[ICRT] = 0xffffffff;
+
+	while (l_apic[CCRT] == t1)
+		;
+		
+	t1 = l_apic[CCRT];
+	delay(1000);
+	t2 = l_apic[CCRT];
+	
+	l_apic[ICRT] = t1-t2;
+}
+
+void l_apic_eoi(void)
+{
+	l_apic[EOI] = 0;
+}
+
+void l_apic_debug(void)
+{
+#ifdef LAPIC_VERBOSE
+	int i, lint;
+
+	printf("LVT on cpu%d, LAPIC ID: %d\n", the->cpu->id, (l_apic[L_APIC_ID] >> 24)&0xf);
+
+	printf("LVT_Tm: ");
+	if (l_apic[LVT_Tm] & (1<<17)) printf("periodic"); else printf("one-shot"); putchar(',');	
+	if (l_apic[LVT_Tm] & (1<<16)) printf("masked");	else printf("not masked"); putchar(',');
+	if (l_apic[LVT_Tm] & (1<<12)) printf("send pending"); else printf("idle"); putchar(',');
+	printf("%B\n", l_apic[LVT_Tm] & 0xff);
+	
+	for (i=0; i<2; i++) {
+		lint = i ? LVT_LINT1 : LVT_LINT0;
+		printf("LVT_LINT%d: ", i);
+		if (l_apic[lint] & (1<<16)) printf("masked"); else printf("not masked"); putchar(',');
+		if (l_apic[lint] & (1<<15)) printf("level"); else printf("edge"); putchar(',');
+		printf("%d", l_apic[lint] & (1<<14)); putchar(',');
+		printf("%d", l_apic[lint] & (1<<13)); putchar(',');
+		if (l_apic[lint] & (1<<12)) printf("send pending"); else printf("idle"); putchar(',');
+	
+		switch ((l_apic[lint]>>8)&7) {
+		    case 0: printf("fixed"); break;
+		    case 4: printf("NMI"); break;
+		    case 7: printf("ExtINT"); break;
+		}
+		putchar(',');
+		printf("%B\n", l_apic[lint] & 0xff);	
+	}
+
+	printf("LVT_Err: ");
+	if (l_apic[LVT_Err] & (1<<16)) printf("masked"); else printf("not masked"); putchar(',');
+	if (l_apic[LVT_Err] & (1<<12)) printf("send pending"); else printf("idle"); putchar(',');
+	printf("%B\n", l_apic[LVT_Err] & 0xff);	
+
+	/*
+	 * This register is supported only on P6 and higher.
+	 */
+	if (the->cpu->family > 5) {
+		printf("LVT_PCINT: ");
+		if (l_apic[LVT_PCINT] & (1<<16)) printf("masked"); else printf("not masked"); putchar(',');
+		if (l_apic[LVT_PCINT] & (1<<12)) printf("send pending"); else printf("idle"); putchar(',');
+		switch ((l_apic[LVT_PCINT] >> 8)&7) {
+		    case 0: printf("fixed"); break;
+		    case 4: printf("NMI"); break;
+		    case 7: printf("ExtINT"); break;
+		}
+		putchar(',');
+		printf("%B\n", l_apic[LVT_PCINT] & 0xff);
+	}
+#endif
+}
+
+void l_apic_timer_interrupt(__u8 n, __u32 stack[])
+{
+	l_apic_eoi();
+	clock();
+}
+
+__u32 io_apic_read(__u8 address)
+{
+	__u32 tmp;
+	
+	tmp = io_apic[IOREGSEL] & ~0xf;
+	io_apic[IOREGSEL] = tmp | address;
+	return io_apic[IOWIN];
+}
+
+void io_apic_write(__u8 address, __u32 x)
+{
+	__u32 tmp;
+
+	tmp = io_apic[IOREGSEL] & ~0xf;
+	io_apic[IOREGSEL] = tmp | address;
+	io_apic[IOWIN] = x;
+}
+
+void io_apic_change_ioredtbl(int signal, int dest, __u8 v, int flags)
+{
+	__u32 reglo, reghi;
+	int dlvr = 0;
+	
+	if (flags & LOPRI)
+		dlvr = 1;
+	
+	reglo = io_apic_read(IOREDTBL + signal*2);
+	reghi = io_apic_read(IOREDTBL + signal*2 + 1);
+	
+	reghi &= ~0x0f000000;
+	reghi |= (dest<<24);
+
+	reglo &= (~0x1ffff) | (1<<16); /* don't touch the mask */
+	reglo |= (0<<15) | (0<<13) | (0<<11) | (dlvr<<8) | v;
+
+	io_apic_write(IOREDTBL + signal*2, reglo);		
+	io_apic_write(IOREDTBL + signal*2 + 1, reghi);
+}
+
+void io_apic_disable_irqs(__u16 irqmask)
+{
+	int i,pin;
+	__u32 reglo;
+	
+	for (i=0;i<16;i++) {
+		if ((irqmask>>i) & 1) {
+			/*
+			 * Mask the signal input in IO APIC if there is a
+			 * mapping for the respective IRQ number.
+			 */
+			pin = mp_irq_to_pin(i);
+			if (pin != -1) {
+				reglo = io_apic_read(IOREDTBL + pin*2);
+				reglo |= (1<<16);
+				io_apic_write(IOREDTBL + pin*2,reglo);
+			}
+			
+		}
+	}
+}
+
+void io_apic_enable_irqs(__u16 irqmask)
+{
+	int i,pin;
+	__u32 reglo;
+	
+	for (i=0;i<16;i++) {
+		if ((irqmask>>i) & 1) {
+			/*
+			 * Unmask the signal input in IO APIC if there is a
+			 * mapping for the respective IRQ number.
+			 */
+			pin = mp_irq_to_pin(i);
+			if (pin != -1) {
+				reglo = io_apic_read(IOREDTBL + pin*2);
+				reglo &= ~(1<<16);
+				io_apic_write(IOREDTBL + pin*2,reglo);
+			}
+			
+		}
+	}
+
+}
+
+#endif /* __SMP__ */
Index: arch/ia32/src/smp/atomic.S
===================================================================
--- arch/ia32/src/smp/atomic.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/smp/atomic.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.global atomic_inc
+atomic_inc:
+	pushl %ebx
+	movl 8(%esp),%ebx
+	lock incl (%ebx)
+	popl %ebx
+	ret
+
+.global atomic_dec
+atomic_dec:
+	pushl %ebx
+	movl 8(%esp),%ebx
+	lock decl (%ebx)
+	popl %ebx
+	ret
+	
+
+#ifdef __SMP__
+
+
+.global test_and_set
+.global spinlock_arch
+
+test_and_set:
+	pushl %ebx
+    
+	movl 8(%esp),%ebx
+	movl $1,%eax
+	xchgl %eax,(%ebx)	# xchg implicitly turns on the LOCK signal
+    
+	popl %ebx
+	ret
+
+
+#
+# This is a bus-and-hyperthreading-friendly implementation of spinlock 
+#
+spinlock_arch:
+	pushl %eax
+	pushl %ebx
+	
+	movl 12(%esp),%ebx
+
+0:	
+	#ifdef __HT__
+	pause			# Pentium 4's with HT love this instruction
+	#endif
+	movl (%ebx),%eax
+	testl %eax,%eax
+	jnz 0b			# lightweight looping while it is locked
+	incl %eax
+	xchgl %eax,(%ebx)	# now use the atomic operation
+	testl %eax,%eax
+	jnz 0b
+
+	popl %ebx
+	popl %eax
+	ret
+	
+#endif
Index: arch/ia32/src/smp/mp.c
===================================================================
--- arch/ia32/src/smp/mp.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/smp/mp.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,533 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef __SMP__
+
+#include <arch/mp.h>
+#include <arch/ap.h>
+#include <arch/pm.h>
+#include <config.h>
+#include <print.h>
+#include <panic.h>
+#include <arch/apic.h>
+#include <func.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/waitq.h>
+#include <time/delay.h>
+#include <mm/heap.h>
+#include <mm/page.h>
+#include <mm/frame.h>
+#include <cpu.h>
+#include <arch/i8259.h>
+#include <arch/asm.h>
+
+/*
+ * Multi-Processor Specification detection code.
+ */
+
+#define	FS_SIGNATURE	0x5f504d5f
+#define CT_SIGNATURE 	0x504d4350
+
+int mp_fs_check(__u8 *base);
+int mp_ct_check(void);
+
+int configure_via_ct(void);
+int configure_via_default(__u8 n);
+
+int ct_processor_entry(struct __processor_entry *pr);
+void ct_bus_entry(struct __bus_entry *bus);
+void ct_io_apic_entry(struct __io_apic_entry *ioa);
+void ct_io_intr_entry(struct __io_intr_entry *iointr);
+void ct_l_intr_entry(struct __l_intr_entry *lintr);
+
+void ct_extended_entries(void);
+
+static struct __mpfs *fs;
+static struct __mpct *ct;
+
+struct __processor_entry *processor_entries = NULL;
+struct __bus_entry *bus_entries = NULL;
+struct __io_apic_entry *io_apic_entries = NULL;
+struct __io_intr_entry *io_intr_entries = NULL;
+struct __l_intr_entry *l_intr_entries = NULL;
+
+int processor_entry_cnt = 0;
+int bus_entry_cnt = 0;
+int io_apic_entry_cnt = 0;
+int io_intr_entry_cnt = 0;
+int l_intr_entry_cnt = 0;
+
+waitq_t ap_completion_wq;
+waitq_t kmp_completion_wq;
+
+/*
+ * Used to check the integrity of the MP Floating Structure.
+ */
+int mp_fs_check(__u8 *base)
+{
+	int i;
+	__u8 sum;
+	
+	for (i = 0, sum = 0; i < 16; i++)
+		sum += base[i];
+	
+	return !sum;
+}
+
+/*
+ * Used to check the integrity of the MP Configuration Table.
+ */
+int mp_ct_check(void)
+{
+	__u8 *base = (__u8 *) ct;
+	__u8 *ext = base + ct->base_table_length;
+	__u8 sum;
+	int i;	
+	
+	/* count the checksum for the base table */
+	for (i=0,sum=0; i < ct->base_table_length; i++)
+		sum += base[i];
+		
+	if (sum)
+		return 0;
+		
+	/* count the checksum for the extended table */
+	for (i=0,sum=0; i < ct->ext_table_length; i++)
+		sum += ext[i];
+		
+	return !sum;
+}
+
+void mp_init(void)
+{
+	__address addr, frame;
+	int cnt, n;
+	
+
+	/*
+	 * First place to search the MP Floating Pointer Structure is the Extended
+	 * BIOS Data Area. We have to read EBDA segment address from the BIOS Data
+	 * Area. Unfortunatelly, this memory is in page 0, which has intentionally no
+	 * mapping.
+	 */
+	frame = frame_alloc(FRAME_KA);
+	map_page_to_frame(frame,0,PAGE_CACHEABLE,0);
+	addr = *((__u16 *) (frame + 0x40e)) * 16;
+	map_page_to_frame(frame,frame,PAGE_CACHEABLE,0);
+	frame_free(frame);	
+
+	/*
+	 * EBDA can be undefined. In that case addr would be 0. 
+	 */
+	if (addr >= 0x1000) {
+		cnt = 1024;
+		while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
+			if (mp_fs_check((__u8 *) addr))
+				goto fs_found;
+			addr++;
+			cnt--;
+		}
+	}
+	
+	/*
+	 * Second place where the MP Floating Pointer Structure may live is the last
+	 * kilobyte of base memory.
+	 */
+	addr = 639*1024;
+	cnt = 1024;
+	while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
+		if (mp_fs_check((__u8 *) addr))
+			goto fs_found;
+		addr++;
+		cnt--;
+	}
+
+	/*
+	 * As the last resort, MP Floating Pointer Structure is searched in the BIOS
+	 * ROM.
+	 */
+	addr = 0xf0000;
+	cnt = 64*1024;
+	while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
+		if (mp_fs_check((__u8 *) addr))
+			goto fs_found;
+		addr++;
+		cnt--;
+	}
+
+	return;
+	
+fs_found:
+	printf("%L: MP Floating Pointer Structure\n", addr);
+
+	fs = (struct __mpfs *) addr;
+	frame_not_free((__address) fs);
+	
+	if (fs->config_type == 0 && fs->configuration_table) {
+		if (fs->mpfib2 >> 7) {
+			printf("mp_init: PIC mode not supported\n");
+			return;
+		}
+
+		ct = fs->configuration_table;
+		frame_not_free((__address) ct);
+		config.cpu_count = configure_via_ct();
+	} 
+	else
+		config.cpu_count = configure_via_default(fs->config_type);
+
+	if (config.cpu_count > 1) {
+		map_page_to_frame((__address) l_apic, (__address) l_apic, PAGE_NOT_CACHEABLE, 0);
+ 	}		
+	
+	
+	/*
+	 * Must be initialized outside the kmp thread, since it is waited
+	 * on before the kmp thread is created.
+	 */
+	waitq_initialize(&kmp_completion_wq);
+	return;
+}
+
+int configure_via_ct(void)
+{
+	__u8 *cur;
+	int i, cnt;
+		
+	if (ct->signature != CT_SIGNATURE) {
+		printf("configure_via_ct: bad ct->signature\n");
+		return 1;
+	}
+	if (!mp_ct_check()) {
+		printf("configure_via_ct: bad ct checksum\n");
+		return 1;
+	}
+	if (ct->oem_table) {
+		printf("configure_via_ct: ct->oem_table not supported\n");
+		return 1;
+	}
+	
+	l_apic = ct->l_apic;
+
+	cnt = 0;
+	cur = &ct->base_table[0];
+	for (i=0; i < ct->entry_count; i++) {
+		switch (*cur) {
+			/* Processor entry */
+			case 0:	
+				processor_entries = processor_entries ? processor_entries : (struct __processor_entry *) cur;
+				processor_entry_cnt++;
+				cnt += ct_processor_entry((struct __processor_entry *) cur);
+				cur += 20;
+				break;
+
+			/* Bus entry */
+			case 1:
+				bus_entries = bus_entries ? bus_entries : (struct __bus_entry *) cur;
+				bus_entry_cnt++;
+				ct_bus_entry((struct __bus_entry *) cur);
+				cur += 8;
+				break;
+				
+			/* I/O Apic */
+			case 2:
+				io_apic_entries = io_apic_entries ? io_apic_entries : (struct __io_apic_entry *) cur;
+				io_apic_entry_cnt++;
+				ct_io_apic_entry((struct __io_apic_entry *) cur);
+				cur += 8;
+				break;
+				
+			/* I/O Interrupt Assignment */
+			case 3:
+				io_intr_entries = io_intr_entries ? io_intr_entries : (struct __io_intr_entry *) cur;
+				io_intr_entry_cnt++;
+				ct_io_intr_entry((struct __io_intr_entry *) cur);
+				cur += 8;
+				break;
+
+			/* Local Interrupt Assignment */
+			case 4:
+				l_intr_entries = l_intr_entries ? l_intr_entries : (struct __l_intr_entry *) cur;
+				l_intr_entry_cnt++;
+				ct_l_intr_entry((struct __l_intr_entry *) cur);
+		    		cur += 8;
+				break;
+	    
+			default:
+				/*
+				 * Something is wrong. Fallback to UP mode.
+				 */
+				 
+				printf("configure_via_ct: ct badness\n");
+				return 1;
+		}
+	}
+	
+	/*
+	 * Process extended entries.
+	 */
+	ct_extended_entries();
+	return cnt;
+}
+
+int configure_via_default(__u8 n)
+{
+	/*
+	 * Not yet implemented.
+	 */
+	printf("configure_via_default: not supported\n");
+	return 1;
+}
+
+
+int ct_processor_entry(struct __processor_entry *pr)
+{
+	/*
+	 * Ignore processors which are not marked enabled.
+	 */
+	if ((pr->cpu_flags & (1<<0)) == 0)
+		return 0;
+	
+	apic_id_mask |= (1<<pr->l_apic_id); 
+	return 1;
+}
+
+void ct_bus_entry(struct __bus_entry *bus)
+{
+#ifdef MPCT_VERBOSE
+	char buf[7];
+	memcopy((__address) bus->bus_type, (__address) buf,6);
+	buf[6] = 0;
+	printf("bus%d: %s\n", bus->bus_id, buf);
+#endif
+}
+
+void ct_io_apic_entry(struct __io_apic_entry *ioa)
+{
+	static int io_apic_count = 0;
+
+	/* this ioapic is marked unusable */
+	if (ioa->io_apic_flags & 1 == 0)
+		return;
+	
+	if (io_apic_count++ > 0) {
+		/*
+		 * Multiple IO APIC's are currently not supported.
+		 */
+		return;
+	}
+	
+	map_page_to_frame((__address) ioa->io_apic, (__address) ioa->io_apic, PAGE_NOT_CACHEABLE, 0);
+	
+	io_apic = ioa->io_apic;
+}
+
+//#define MPCT_VERBOSE
+void ct_io_intr_entry(struct __io_intr_entry *iointr)
+{
+#ifdef MPCT_VERBOSE
+	switch (iointr->intr_type) {
+	    case 0: printf("INT"); break;
+	    case 1: printf("NMI"); break;
+	    case 2: printf("SMI"); break;
+	    case 3: printf("ExtINT"); break;
+	}
+	putchar(',');
+	switch (iointr->poel&3) {
+	    case 0: printf("bus-like"); break;
+	    case 1: printf("active high"); break;
+	    case 2: printf("reserved"); break;
+	    case 3: printf("active low"); break;
+	}
+	putchar(',');
+	switch ((iointr->poel>>2)&3) {
+	    case 0: printf("bus-like"); break;
+	    case 1: printf("edge-triggered"); break;
+	    case 2: printf("reserved"); break;
+	    case 3: printf("level-triggered"); break;
+	}
+	putchar(',');
+	printf("bus%d,irq%d", iointr->src_bus_id, iointr->src_bus_irq);
+	putchar(',');
+	printf("io_apic%d,pin%d", iointr->dst_io_apic_id, iointr->dst_io_apic_pin);
+	putchar('\n');	
+#endif
+}
+
+void ct_l_intr_entry(struct __l_intr_entry *lintr)
+{
+#ifdef MPCT_VERBOSE
+	switch (lintr->intr_type) {
+	    case 0: printf("INT"); break;
+	    case 1: printf("NMI"); break;
+	    case 2: printf("SMI"); break;
+	    case 3: printf("ExtINT"); break;
+	}
+	putchar(',');
+	switch (lintr->poel&3) {
+	    case 0: printf("bus-like"); break;
+	    case 1: printf("active high"); break;
+	    case 2: printf("reserved"); break;
+	    case 3: printf("active low"); break;
+	}
+	putchar(',');
+	switch ((lintr->poel>>2)&3) {
+	    case 0: printf("bus-like"); break;
+	    case 1: printf("edge-triggered"); break;
+	    case 2: printf("reserved"); break;
+	    case 3: printf("level-triggered"); break;
+	}
+	putchar(',');
+	printf("bus%d,irq%d", lintr->src_bus_id, lintr->src_bus_irq);
+	putchar(',');
+	printf("l_apic%d,pin%d", lintr->dst_l_apic_id, lintr->dst_l_apic_pin);
+	putchar('\n');
+#endif
+}
+
+void ct_extended_entries(void)
+{
+	/*
+	 * Not yet implemented.
+	 */
+	if (ct->ext_table_length)
+		panic("ct_extended_entries: not supported\n");
+}
+
+/*
+ * Kernel thread for bringing up application processors. It becomes clear
+ * that we need an arrangement like this (AP's being initialized by a kernel
+ * thread), for a thread has its dedicated stack. (The stack used during the
+ * BSP initialization (prior the very first call to scheduler()) will be used
+ * as an initialization stack for each AP.)
+ */
+void kmp(void *arg)
+{
+	struct __processor_entry *pr;
+	__address src, dst;
+	__address frame;
+	int i;
+
+	waitq_initialize(&ap_completion_wq);
+
+	/*
+	 * Processor entries immediately follow the configuration table header.
+	 */
+	pr = processor_entries;
+
+	/*
+	 * Grab a frame and map its address to page 0. This is a hack which
+	 * accesses data in frame 0. Note that page 0 is not present because
+	 * of nil reference bug catching.
+	 */
+	frame = frame_alloc(FRAME_KA);
+	map_page_to_frame(frame,0,PAGE_CACHEABLE,0);
+
+	/*
+	 * Set the warm-reset vector to the real-mode address of 4K-aligned ap_boot()
+	 */
+	*((__u16 *) (frame + 0x467+0)) =  ((__address) ap_boot) >> 4;	/* segment */
+	*((__u16 *) (frame + 0x467+2)) =  0x0;	/* offset */
+	
+	/*
+	 * Give back the borrowed frame and restore identity mapping for it.
+	 */
+	map_page_to_frame(frame,frame,PAGE_CACHEABLE,0);
+	frame_free(frame);
+
+	/*
+	 * Save 0xa to address 0xf of the CMOS RAM.
+	 * BIOS will not do the POST after the INIT signal.
+	 */
+	outb(0x70,0xf);
+	outb(0x71,0xa);
+
+	cpu_priority_high();
+
+	pic_disable_irqs(0xffff);
+	apic_init();
+
+	for (i = 0; i < processor_entry_cnt; i++) {
+		struct descriptor *gdt_new;
+	
+		/*
+		 * Skip processors marked unusable.
+		 */
+		if (pr[i].cpu_flags & (1<<0) == 0)
+			continue;
+	
+		/*
+		 * The bootstrap processor is already up.
+		 */
+		if (pr[i].cpu_flags & (1<<1))
+			continue;
+		
+		/*
+		 * Prepare new GDT for CPU in question.
+		 */
+		if (!(gdt_new = (struct descriptor *) malloc(GDT_ITEMS*sizeof(struct descriptor))))
+			panic(PANIC "couldn't allocate memory for GDT\n");
+
+		memcopy(gdt, gdt_new, GDT_ITEMS*sizeof(struct descriptor));
+		gdtr.base = (__address) gdt_new;
+		
+		if (l_apic_send_init_ipi(pr[i].l_apic_id)) {
+			/*
+		         * There may be just one AP being initialized at
+			 * the time. After it comes completely up, it is
+			 * supposed to wake us up.
+		         */
+			waitq_sleep(&ap_completion_wq);
+			cpu_priority_high();
+		}
+		else {
+			printf("INIT IPI for l_apic%d failed\n", pr[i].l_apic_id);
+		}
+	}
+
+	/*
+	 * Wakeup the kinit thread so that
+	 * system initialization can go on.
+	 */
+	waitq_wakeup(&kmp_completion_wq, WAKEUP_FIRST);
+}
+
+int mp_irq_to_pin(int irq)
+{
+	int i;
+	
+	for(i=0;i<io_intr_entry_cnt;i++) {
+		if (io_intr_entries[i].src_bus_irq == irq && io_intr_entries[i].intr_type == 0)
+			return io_intr_entries[i].dst_io_apic_pin;
+	}
+	
+	return -1;
+}
+
+#endif /* __SMP__ */
Index: arch/ia32/src/userspace.c
===================================================================
--- arch/ia32/src/userspace.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/ia32/src/userspace.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <userspace.h>
+#include <arch/pm.h>
+#include <arch/types.h>
+#include <arch.h>
+#include <proc/thread.h>
+#include <mm/vm.h>
+
+void userspace(void)
+{
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	
+	/*
+	 * Prepare TSS stack selector and pointers for next syscall.
+	 */
+	the->cpu->arch.tss->esp0 = (__address) &the->thread->kstack[THREAD_STACK_SIZE-8];
+	the->cpu->arch.tss->ss0 = selector(KDATA_DES);
+	
+	__asm__ volatile (""
+	    "pushl %0\n"
+	    "pushl %1\n"
+	    "pushl %2\n"
+	    "pushl %3\n"
+	    "pushl %4\n"
+	    "iret"
+	    : : "i" (selector(UDATA_DES) | PL_USER), "i" (USTACK_ADDRESS+THREAD_STACK_SIZE-1000), "r" (pri), "i" (selector(UTEXT_DES) | PL_USER), "i" (UTEXT_ADDRESS));
+	/* NOT REACHED */
+
+	for(;;);
+}
Index: arch/mips/Makefile.inc
===================================================================
--- arch/mips/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,33 @@
+# decstation-ultrix target has been obsoleted in recent gcc compilers (3.1) and removed in (3.3)
+MIPS_TARGET=decstation-ultrix
+
+MIPS_CC_DIR=/usr/local/mips/bin
+MIPS_BINUTILS_DIR=/usr/local/mips/bin
+
+CC=$(MIPS_CC_DIR)/$(MIPS_TARGET)-gcc
+AS=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-as
+LD=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-ld
+
+ASFLAGS=-EL -mips3
+
+DEFS=-DARCH=$(ARCH)
+CPPFLAGS=$(DEFS) -nostdinc -I../include
+CFLAGS=$(CPPFLAGS) -EL -mips2 -G 0 -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O2
+LFLAGS=-EL -mips2 -M -no-check-sections -T ../arch/mips/_link.ld
+
+arch_sources= \
+	arch/start.S \
+	arch/context.S \
+	arch/panic.s \
+	arch/mips.c \
+	arch/fake.s \
+	arch/putchar.c \
+	arch/asm.s \
+	arch/exception.c \
+	arch/interrupt.c \
+	arch/cache.c \
+	arch/lib/memstr.c \
+	arch/cpu/cpu.c \
+	arch/mm/frame.c \
+	arch/mm/page.c \
+	arch/mm/tlb.c
Index: arch/mips/_link.ld
===================================================================
--- arch/mips/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,47 @@
+/*
+ *  MIPS linker script
+ *  
+ *  kernel text
+ *  kernel data
+ *  
+ */
+
+OUTPUT_FORMAT(binary)
+ENTRY(kernel_image_start)
+
+SECTIONS {
+    .image 0x80000000: AT (0x80000000) { 
+	ktext_start = .;
+	*(.text);
+	ktext_end = .;
+
+	kdata_start = .;
+	*(.rdata);
+	*(.data);		/* initialized data */
+	*(.lit8);
+	*(.lit4);
+	*(.sdata);
+	*(.sbss);
+	*(.bss);		/* uninitialized static variables */	
+	*(.scommon);
+	*(COMMON); 		/* global variables */
+	kdata_end = .;
+
+    } = 0x00000000
+
+    . = ABSOLUTE(hardcoded_ktext_size);
+    .patch_1 : {
+        LONG(ktext_end - ktext_start);
+    }
+
+    . = ABSOLUTE(hardcoded_kdata_size);
+    .patch_2 : {
+        LONG(kdata_end - kdata_start);
+    }
+
+    . = ABSOLUTE(hardcoded_load_address);
+    .patch_3 : {
+        LONG(0x80000000);
+    }
+
+}
Index: arch/mips/boot/Makefile
===================================================================
--- arch/mips/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,24 @@
+MIPS_BINUTILS_DIR=/usr/local/mips/bin
+MIPS_TARGET=decstation-ultrix
+
+.PHONY: nothing build
+
+nothing:
+
+build: boot.bin
+	cp boot.bin ../../../src/load.bin
+
+AS=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-as
+LD=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-ld
+
+ASFLAGS=-mips2 -EL
+LFLAGS=--oformat=binary -mips2 -EL -e start
+
+boot.bin: boot.o
+	$(LD) $(LFLAGS) boot.o -o $@
+
+boot.o:
+	$(AS) boot.s -o $@
+
+clean:
+	-rm *.o *.bin
Index: arch/mips/boot/boot.s
===================================================================
--- arch/mips/boot/boot.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/boot/boot.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.set noat
+.set noreorder
+.set nomacro
+
+start:
+    # move 0x80000000 to reg $8
+    lui $8, 0x8000
+    
+    # prepare stack
+    lui $29, 0x8100
+    
+    j $8
+    nop
Index: arch/mips/include/asm.h
===================================================================
--- arch/mips/include/asm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/asm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MIPS_ASM_H__
+#define __MIPS_ASM_H__
+
+#define cpu_sleep()	;
+
+#endif
Index: arch/mips/include/asm/macro.h
===================================================================
--- arch/mips/include/asm/macro.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/asm/macro.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * MIPS assembler macros
+ */
+
+.macro REGISTERS_STORE r
+	sw $0,0(\r)
+	sw $1,4(\r)
+	sw $2,8(\r)	# meaningless
+	sw $3,12(\r)
+	sw $4,16(\r)
+	sw $5,20(\r)
+	sw $6,24(\r)
+	sw $7,28(\r)
+	sw $8,32(\r)
+	sw $9,36(\r)
+	sw $10,40(\r)
+	sw $11,44(\r)
+	sw $12,48(\r)
+	sw $13,52(\r)
+	sw $14,56(\r)
+	sw $15,60(\r)
+	sw $16,64(\r)
+	sw $17,68(\r)
+	sw $18,72(\r)
+	sw $19,76(\r)
+	sw $20,80(\r)
+	sw $21,84(\r)
+	sw $22,88(\r)
+	sw $23,92(\r)
+	sw $24,96(\r)
+	sw $25,100(\r)
+	sw $26,104(\r)
+	sw $27,108(\r)
+	sw $28,112(\r)
+	sw $29,116(\r)
+	sw $30,120(\r)
+	sw $31,124(\r)
+.endm
+
+.macro REGISTERS_LOAD r
+	lw $0,0(\r)
+	lw $1,4(\r)
+	lw $2,8(\r)  # meaningless
+	lw $3,12(\r)
+	lw $4,16(\r) # this is ok, $4 == 16(\r)
+	lw $5,20(\r)
+	lw $6,24(\r)
+	lw $7,28(\r)
+	lw $8,32(\r)
+	lw $9,36(\r)
+	lw $10,40(\r)
+	lw $11,44(\r)
+	lw $12,48(\r)
+	lw $13,52(\r)
+	lw $14,56(\r)
+	lw $15,60(\r)
+	lw $16,64(\r)
+	lw $17,68(\r)
+	lw $18,72(\r)
+	lw $19,76(\r)
+	lw $20,80(\r)
+	lw $21,84(\r)
+	lw $22,88(\r)
+	lw $23,92(\r)
+	lw $24,96(\r)
+	lw $25,100(\r)
+	lw $26,104(\r)
+	lw $27,108(\r)
+	lw $28,112(\r)
+	lw $29,116(\r)
+	lw $30,120(\r)
+	lw $31,124(\r)
+.endm
Index: arch/mips/include/atomic.h
===================================================================
--- arch/mips/include/atomic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/atomic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MIPS_ATOMIC_H__
+#define __MIPS_ATOMIC_H__
+
+#define atomic_inc(x)	((*x)++)
+#define atomic_dec(x)	((*x)--)
+
+#endif
Index: arch/mips/include/cache.h
===================================================================
--- arch/mips/include/cache.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/cache.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CACHE_H__
+#define __CACHE_H__
+
+extern void cache_error(void);
+
+#endif
Index: arch/mips/include/context.h
===================================================================
--- arch/mips/include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_CONTEXT_H__
+#define __mips_CONTEXT_H__
+
+#include <arch/types.h>
+
+struct context {
+    __u32 r0;
+    __u32 r1;
+    __u32 r2;
+    __u32 r3;    
+    __u32 r4;
+    __u32 r5;
+    __u32 r6;
+    __u32 r7;    
+    __u32 r8;
+    __u32 r9;
+    __u32 r10;
+    __u32 r11;    
+    __u32 r12;
+    __u32 r13;
+    __u32 r14;
+    __u32 r15;    
+    __u32 r16;
+    __u32 r17;
+    __u32 r18;
+    __u32 r19;    
+    __u32 r20;
+    __u32 r21;
+    __u32 r22;
+    __u32 r23;    
+    __u32 r24;
+    __u32 r25;
+    __u32 r26;
+    __u32 r27;    
+    __u32 r28;
+    __u32 sp;
+    __u32 r30;
+    __u32 pc;
+    __u32 pri;
+};
+
+#endif
Index: arch/mips/include/cp0.h
===================================================================
--- arch/mips/include/cp0.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/cp0.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CP0_H__
+#define __CP0_H__
+
+#include <arch/types.h>
+
+#define cp0_status_ie_enabled_bit	(1<<0)
+#define cp0_status_exl_exception_bit	(1<<1)
+#define cp0_status_erl_error_bit	(1<<2)
+#define cp0_status_bev_bootstrap_bit	(1<<22)
+
+#define cp0_status_im7_shift		15
+/*
+ * Magic value for use in msim.
+ * On AMD Duron 800Mhz, this roughly seems like one us.
+ */
+#define cp0_compare_value 		10000
+
+extern  __u32 cp0_index_read(void);
+extern void cp0_idnex_write(__u32 val);
+
+extern __u32 cp0_random_read(void);
+
+extern __u32 cp0_entry_lo0_read(void);
+extern void cp0_entry_lo0_write(__u32 val);
+
+extern __u32 cp0_entry_lo1_read(void);
+extern void cp0_entry_lo1_write(__u32 val);
+
+extern __u32 cp0_context_read(void);
+extern void cp0_context_write(__u32 val);
+
+extern __u32 cp0_pagemask_read(void);
+extern void cp0_pagemask_write(__u32 val);
+
+extern __u32 cp0_wired_read(void);
+extern void cp0_wired_write(__u32 val);
+
+extern __u32 cp0_badvaddr_read(void);
+
+extern volatile __u32 cp0_count_read(void);
+extern void cp0_count_write(__u32 val);
+
+extern volatile __u32 cp0_entry_hi_read(void);
+extern void cp0_entry_hi_write(__u32 val);
+
+extern volatile __u32 cp0_compare_read(void);
+extern void cp0_compare_write(__u32 val);
+
+extern __u32 cp0_status_read(void);
+extern void cp0_status_write(__u32 val);
+
+extern __u32 cp0_cause_read(void);
+extern void cp0_cause_write(__u32 val);
+
+extern __u32 cp0_epc_read(void);
+extern void cp0_epc_write(__u32 val);
+
+extern __u32 cp0_prid_read(void);
+
+extern void tlbp(void);
+extern void tlbr(void);
+extern void tlbwi(void);
+extern void tlbwr(void);
+
+#endif
Index: arch/mips/include/cpu.h
===================================================================
--- arch/mips/include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_CPU_H__
+#define __mips_CPU_H__
+
+#include <typedefs.h>
+
+struct cpu_arch {
+        int imp_num;
+        int rev_num;
+};
+	
+#endif
Index: arch/mips/include/exception.h
===================================================================
--- arch/mips/include/exception.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/exception.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __EXCEPTION_H__
+#define __EXCEPTION_H__
+
+#define EXC_Int		0
+#define EXC_MOD		1
+#define EXC_TLBL	2
+#define EXC_TLBS	3
+
+extern void exception(void);
+
+#endif
Index: arch/mips/include/interrupt.h
===================================================================
--- arch/mips/include/interrupt.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/interrupt.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __INTERRUPT_H__
+#define __INTERRUPT_H__
+
+extern void interrupt(void);
+
+#endif
Index: arch/mips/include/mm/frame.h
===================================================================
--- arch/mips/include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_FRAME_H__
+#define __mips_FRAME_H__
+
+#define FRAME_SIZE		4096
+
+extern void frame_arch_init(void);
+
+#endif
Index: arch/mips/include/mm/page.h
===================================================================
--- arch/mips/include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_PAGE_H__
+#define __mips_PAGE_H__
+
+#include <arch/mm/frame.h>
+
+#define PAGE_SIZE	FRAME_SIZE
+
+#define KA2PA(x)	((x) - 0x80000000)
+#define PA2KA(x)	((x) + 0x80000000)
+
+#define page_arch_init()	;
+
+#endif
Index: arch/mips/include/mm/tlb.h
===================================================================
--- arch/mips/include/mm/tlb.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/mm/tlb.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_TLB_H__
+#define __mips_TLB_H__
+
+struct entry_lo {
+	unsigned g : 1;
+	unsigned v : 1;
+	unsigned d : 1;
+	unsigned c : 3;
+	unsigned pfn : 24;
+	unsigned : 2;
+} __attribute__ ((packed));
+
+struct entry_hi {
+	unsigned asid : 8;
+	unsigned : 4;
+	unsigned g : 1;
+	unsigned vpn2 : 19;
+} __attribute__ ((packed));
+
+struct page_mask {
+	unsigned : 13;
+	unsigned mask : 12;
+	unsigned : 7;
+} __attribute__ ((packed));
+
+struct tlb_entry {
+	struct entry_lo lo0;
+	struct entry_lo lo1;
+	struct entry_hi hi;
+	struct page_mask mask;
+} __attribute__ ((packed));
+
+extern void tlb_refill(void);
+extern void tlb_invalid(void);
+
+#endif
Index: arch/mips/include/mm/vm.h
===================================================================
--- arch/mips/include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_VM_H__
+#define __mips_VM_H__
+
+#include <arch/types.h>
+
+#define KERNEL_ADDRESS_SPACE_START_ARCH		(__address) 0x80000000
+#define KERNEL_ADDRESS_SPACE_END_ARCH		(__address) 0xffffffff
+#define USER_ADDRESS_SPACE_START_ARCH		(__address) 0x00000000
+#define USER_ADDRESS_SPACE_END_ARCH		(__address) 0x7fffffff	
+
+#define UTEXT_ADDRESS_ARCH	0x00001000
+#define USTACK_ADDRESS_ARCH	0x7ffff000
+#define UDATA_ADDRESS_ARCH	0x01001000
+
+#endif
Index: arch/mips/include/thread.h
===================================================================
--- arch/mips/include/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __mips_THREAD_H__
+#define __mips_THREAD_H__
+
+#define ARCH_THREAD_DATA \
+	pri_t	saved_pri; \
+	__u32	saved_epc;
+
+#endif
Index: arch/mips/include/types.h
===================================================================
--- arch/mips/include/types.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/include/types.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TYPES_H__
+#define __TYPES_H__
+
+#define NULL	0
+
+typedef signed char __s8;
+
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned long __u32;
+typedef long long __u64;
+
+typedef __u32 __address;
+
+typedef __u32 pri_t;
+
+#endif
Index: arch/mips/src/asm.s
===================================================================
--- arch/mips/src/asm.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/asm.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,157 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+
+.macro cp0_read reg
+    mfc0 $2,\reg
+    j $31
+    nop
+.endm
+
+.macro cp0_write reg
+    mtc0 $4,\reg
+    j $31
+    nop
+.endm
+
+.set noat
+.set noreorder
+.set nomacro
+
+.global cp0_index_read
+.global cp0_index_write
+.global cp0_random_read
+.global cp0_entry_lo0_read
+.global cp0_entry_lo0_write
+.global cp0_entry_lo1_read
+.global cp0_entry_lo1_write
+.global cp0_context_read
+.global cp0_context_write
+.global cp0_pagemask_read
+.global cp0_pagemask_write
+.global cp0_wired_read
+.global cp0_wired_write
+.global cp0_badvaddr_read
+.global cp0_count_read
+.global cp0_count_write
+.global cp0_hi_read
+.global cp0_hi_write
+.global cp0_compare_read
+.global cp0_compare_write
+.global cp0_status_read
+.global cp0_status_write
+.global cp0_cause_read
+.global cp0_epc_read
+.global cp0_epc_write
+.global cp0_prid_read
+
+cp0_index_read:		cp0_read $0
+cp0_index_write:	cp0_write $0
+
+cp0_random_read:	cp0_read $1
+
+cp0_entry_lo0_read:	cp0_read $2
+cp0_entry_lo0_write:	cp0_write $2
+
+cp0_entry_lo1_read:	cp0_read $3
+cp0_entry_lo1_write:	cp0_write $3
+
+cp0_context_read:	cp0_read $4
+cp0_context_write:	cp0_write $4
+
+cp0_pagemask_read:	cp0_read $5
+cp0_pagemask_write:	cp0_write $5
+
+cp0_wired_read:		cp0_read $6
+cp0_wired_write:	cp0_write $6
+
+cp0_badvaddr_read:	cp0_read $8
+
+cp0_count_read:		cp0_read $9
+cp0_count_write:	cp0_write $9
+
+cp0_entry_hi_read:	cp0_read $10
+cp0_entry_hi_write:	cp0_write $10
+
+cp0_compare_read:	cp0_read $11
+cp0_compare_write:	cp0_write $11
+
+cp0_status_read:	cp0_read $12
+cp0_status_write:	cp0_write $12
+
+cp0_cause_read:		cp0_read $13
+
+cp0_epc_read:		cp0_read $14
+cp0_epc_write:		cp0_write $14
+
+cp0_prid_read:		cp0_read $15
+
+
+.global tlbp
+tlbp:
+	tlbp
+	j $31
+	nop
+
+.global tlbr
+tlbr:
+	tlbr
+	j $31
+	nop
+
+.global tlbwi
+tlbwi:
+	tlbwi
+	j $31
+	nop
+
+.global tlbwr
+tlbwr:
+	tlbwr
+	j $31
+	nop
+
+.global cpu_halt
+cpu_halt:
+	j cpu_halt
+	nop
+
+
+# THIS IS USERSPACE CODE
+.global utext
+utext:
+	j $31
+	nop
+utext_end:
+
+.data
+.global utext_size
+utext_size:
+	.long utext_end-utext
+ 
Index: arch/mips/src/cache.c
===================================================================
--- arch/mips/src/cache.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/cache.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/cache.h>
+#include <panic.h>
+
+void cache_error(void)
+{
+	panic(PANIC "cache_error exception\n");
+}
Index: arch/mips/src/context.S
===================================================================
--- arch/mips/src/context.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/context.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#include <arch/asm/macro.h>
+
+.text   
+
+.set noat
+.set noreorder
+.set nomacro
+
+.global context_save
+.global context_restore
+
+context_save:
+	REGISTERS_STORE $4
+
+	# context_save returns 1
+	j $31
+	li $2, 1	
+	
+context_restore:
+	REGISTERS_LOAD $4
+
+	# context_restore returns 0
+	j $31
+	xor $2, $2	
Index: arch/mips/src/cpu/cpu.c
===================================================================
--- arch/mips/src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/cpu.h>
+#include <cpu.h>
+
+#include <arch.h>
+
+#include <arch/cp0.h>
+
+#include <typedefs.h>
+
+struct {
+	char *vendor;
+	char *model;
+} imp_data[] = {
+    { "Invalid", "Invalid" },	/* 0x00 */
+    { "MIPS", "R2000" },	/* 0x01 */
+    { "MIPS", "R3000" },	/* 0x02 */
+    { "MIPS", "R6000" },	/* 0x03 */
+    { "MIPS", " R4000/R4400" }, /* 0x04 */
+    { "LSI Logic", "R3000" },	/* 0x05 */
+    { "MIPS", "R6000A" },	/* 0x06 */
+    { "IDT", "3051/3052" },	/* 0x07 */
+    { "Invalid", "Invalid" },	/* 0x08 */
+    { "MIPS", "R10000/T5" },	/* 0x09 */
+    { "MIPS", "R4200" },	/* 0x0a */
+    { "Unknown", "Unknown" },	/* 0x0b */
+    { "Unknown", "Unknown" },	/* 0x0c */
+    { "Invalid", "Invalid" },	/* 0x0d */
+    { "Invalid", "Invalid" },	/* 0x0e */
+    { "Invalid", "Invalid" },	/* 0x0f */
+    { "MIPS", "R8000" },	/* 0x10 */
+    { "Invalid", "Invalid" },	/* 0x11 */
+    { "Invalid", "Invalid" },	/* 0x12 */
+    { "Invalid", "Invalid" },	/* 0x13 */
+    { "Invalid", "Invalid" },	/* 0x14 */
+    { "Invalid", "Invalid" },	/* 0x15 */
+    { "Invalid", "Invalid" },	/* 0x16 */
+    { "Invalid", "Invalid" },	/* 0x17 */
+    { "Invalid", "Invalid" },	/* 0x18 */
+    { "Invalid", "Invalid" },	/* 0x19 */
+    { "Invalid", "Invalid" },  	/* 0x1a */
+    { "Invalid", "Invalid" },	/* 0x1b */
+    { "Invalid", "Invalid" },	/* 0x1c */
+    { "Invalid", "Invalid" },	/* 0x1d */
+    { "Invalid", "Invalid" },	/* 0x1e */
+    { "Invalid", "Invalid" },	/* 0x1f */
+    { "QED", "R4600" },		/* 0x20 */
+    { "Sony", "R3000" },	/* 0x21 */
+    { "Toshiba", "R3000" },	/* 0x22 */
+    { "NKK", "R3000" }		/* 0x23 */
+};
+
+void cpu_arch_init(void)
+{
+}
+
+void cpu_identify(void)
+{
+	the->cpu->arch.rev_num = cp0_prid_read() & 0xff;
+	the->cpu->arch.imp_num = (cp0_prid_read() >> 8) & 0xff;
+}
+
+void cpu_print_report(cpu_t *m)
+{
+	printf("cpu%d: %s %s (rev=%d.%d, imp=%d)\n",
+		m->id, imp_data[m->arch.imp_num].vendor, imp_data[m->arch.imp_num].model, m->arch.rev_num >> 4, m->arch.rev_num & 0xf, m->arch.imp_num);
+}
Index: arch/mips/src/exception.c
===================================================================
--- arch/mips/src/exception.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/exception.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/exception.h>
+#include <panic.h>
+#include <arch/cp0.h>
+#include <arch/types.h>
+#include <arch.h>
+
+void exception(void)
+{
+	int excno;
+	__u32 epc;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	epc = cp0_epc_read();
+	cp0_status_write(cp0_status_read() & ~ cp0_status_exl_exception_bit);
+
+	if (the->thread) {
+		the->thread->saved_pri = pri;
+		the->thread->saved_epc = epc;
+	}
+	/* decode exception number and process the exception */
+	switch(excno = (cp0_cause_read()>>2)&0x1f) {
+		case EXC_Int: interrupt(); break;
+		case EXC_TLBL:
+		case EXC_TLBS: tlb_invalid(); break;
+		default: panic(PANIC "unhandled exception %d\n", excno); break;
+	}
+	
+	if (the->thread) {
+		pri = the->thread->saved_pri;
+		epc = the->thread->saved_epc;
+	}
+
+	cp0_epc_write(epc);
+	cp0_status_write(cp0_status_read() | cp0_status_exl_exception_bit);
+	cpu_priority_restore(pri);
+}
Index: arch/mips/src/fake.s
===================================================================
--- arch/mips/src/fake.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/fake.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text
+.set noat
+
+.global calibrate_delay_loop
+.global asm_delay_loop
+.global userspace
+
+userspace:
+calibrate_delay_loop:
+asm_delay_loop:
+    j $31
+    nop
Index: arch/mips/src/interrupt.c
===================================================================
--- arch/mips/src/interrupt.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/interrupt.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/interrupt.h>
+#include <arch/types.h>
+#include <arch.h>
+#include <arch/cp0.h>
+#include <time/clock.h>
+#include <panic.h>
+
+pri_t cpu_priority_high(void)
+{
+    pri_t pri = (pri_t) cp0_status_read();
+    cp0_status_write(pri & ~cp0_status_ie_enabled_bit);
+    return pri;
+}
+
+pri_t cpu_priority_low(void)
+{
+    pri_t pri = (pri_t) cp0_status_read();
+    cp0_status_write(pri | cp0_status_ie_enabled_bit);
+    return pri;
+}
+
+void cpu_priority_restore(pri_t pri)
+{
+    cp0_status_write(cp0_status_read() | (pri & cp0_status_ie_enabled_bit));
+}
+
+pri_t cpu_priority_read(void)
+{
+    return cp0_status_read();
+}
+
+
+void interrupt(void)
+{
+	__u32 cause;
+        int i;
+
+	/* decode interrupt number and process the interrupt */
+        cause = (cp0_cause_read()>>8)&0xff;
+
+        for (i=0; i<8; i++) {
+                if (cause & (1<<i)) {
+                        switch (i) {
+			    case 0x0:
+			    case 0x1:
+			    case 0x2:
+			    case 0x3:
+			    case 0x4:
+			    case 0x5:
+                            case 0x6: panic(PANIC "unhandled interrupt %d\n", i); break;
+                            case 0x7:
+                                    /* clear timer interrupt */
+                                    cp0_compare_write(cp0_compare_value);
+				    /* start counting over again */
+				    cp0_count_write(0);				    
+                                    clock();
+                                    break;
+                        }
+                }
+        }
+
+}
Index: arch/mips/src/lib/memstr.c
===================================================================
--- arch/mips/src/lib/memstr.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/lib/memstr.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <memstr.h>
+#include <arch/types.h>
+
+void memcopy(__address src, __address dst, int cnt)
+{
+	int i;
+	
+	for (i=0; i<cnt; i++)
+		*((__u8 *) (dst + i)) = *((__u8 *) (src + i));
+}
+
+void memsetb(__address dst, int cnt, __u8 x)
+{
+	int i;
+	__u8 *p = (__u8 *) dst;
+	
+	for(i=0; i<cnt; i++)
+		p[i] = x;
+}
Index: arch/mips/src/mips.c
===================================================================
--- arch/mips/src/mips.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/mips.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch.h>
+#include <arch/cp0.h>
+#include <arch/exception.h>
+
+void arch_init(void)
+{
+	/*
+	 * Switch to BEV normal level so that exception vectors point to the kernel.
+	 * Clear the error level.
+	 */
+	cp0_status_write(cp0_status_read() & ~(cp0_status_bev_bootstrap_bit|cp0_status_erl_error_bit));
+    
+	/*
+	 * Unmask hardware clock interrupt.
+	 */
+	cp0_status_write(cp0_status_read() | (1<<cp0_status_im7_shift));
+    
+	/*
+	 * Start hardware clock.
+	 */
+	cp0_compare_write(cp0_compare_value);
+	cp0_count_write(0);
+}
Index: arch/mips/src/mm/frame.c
===================================================================
--- arch/mips/src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/mm/frame.h>
+#include <mm/frame.h>
+
+void frame_arch_init(void)
+{
+	kernel_frames = frames;
+	kernel_frames_free = frames_free;
+	frame_kernel_bitmap = frame_bitmap;
+}
Index: arch/mips/src/mm/page.c
===================================================================
--- arch/mips/src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/types.h>
+#include <mm/page.h>
+
+void map_page_to_frame(__address page, __address frame, int flags, int copy)
+{
+	/* TODO !!! */
+}
Index: arch/mips/src/mm/tlb.c
===================================================================
--- arch/mips/src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/mm/tlb.h>
+#include <mm/tlb.h>
+#include <arch/cp0.h>
+#include <panic.h>
+#include <arch.h>
+
+int bootstrap = 1;
+
+void tlb_refill(void)
+{
+	if (bootstrap) {
+		bootstrap = 0;
+		main_bsp();
+	}
+	
+	panic(PANIC "tlb_refill exception\n");
+}
+
+void tlb_invalid(void)
+{
+	panic(PANIC "%X: TLB exception at %X", cp0_badvaddr_read(), the->thread ? the->thread->saved_epc : 0);
+}
+
+void tlb_invalidate(int asid)
+{
+}
Index: arch/mips/src/panic.s
===================================================================
--- arch/mips/src/panic.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/panic.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+.text   
+
+.set noat
+.set noreorder
+.set nomacro
+
+.global panic
+	
+panic:
+	jal printf
+	nop
+	j cpu_halt
+	nop
+
Index: arch/mips/src/putchar.c
===================================================================
--- arch/mips/src/putchar.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/putchar.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <putchar.h>
+#include <arch/types.h>
+#include <arch/cp0.h>
+
+#define VIDEORAM	0xA000000
+
+void putchar(char ch)
+{
+	__u32 status = cp0_status_read();
+	
+	cp0_status_write(cp0_status_read() | cp0_status_erl_error_bit);
+	*((char *) VIDEORAM) = ch;
+	cp0_status_write(status);
+}
Index: arch/mips/src/start.S
===================================================================
--- arch/mips/src/start.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/mips/src/start.S	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#include <arch/asm/macro.h>
+
+#define STACK_SPACE	128
+
+.text
+
+.set noat
+.set noreorder
+.set nomacro
+
+.global kernel_image_start
+.global tlb_refill_entry
+.global cache_error_entry
+.global exception_entry
+
+.org 0x0
+kernel_image_start:
+tlb_refill_entry:
+    j tlb_refill_handler
+    nop
+
+.org 0x100
+cache_error_entry:
+    j cache_error_handler
+    nop
+    
+.org 0x180
+exception_entry:
+exception_handler:
+    sub $29, STACK_SPACE
+    REGISTERS_STORE $29
+    
+    jal exception
+    nop
+    
+    REGISTERS_LOAD $29
+    add $29, STACK_SPACE
+
+    eret
+
+tlb_refill_handler:
+    sub $29, STACK_SPACE
+    REGISTERS_STORE $29
+    
+    jal tlb_refill
+    nop
+    
+    REGISTERS_LOAD $29
+    add $29, STACK_SPACE
+    
+    eret
+
+cache_error_handler:
+    sub $29, STACK_SPACE
+    REGISTERS_STORE $29
+
+    jal cache_error
+    nop
+    
+    REGISTERS_LOAD $29
+    add $29, STACK_SPACE
+
+    eret
Index: arch/powerpc/Makefile.inc
===================================================================
--- arch/powerpc/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/powerpc/Makefile.inc	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,14 @@
+MIPS_CC_DIR=/usr/local/powerpc/bin
+CC=$(MIPS_CC_DIR)/powerpc-linux-gcc
+AS=$(MIPS_CC_DIR)/powerpc-linux-as
+LD=$(MIPS_CC_DIR)/powerpc-linux-ld
+
+ASFLAGS=
+
+DEFS=-DARCH=$(ARCH)
+CPPFLAGS=$(DEFS) -nostdinc -I../include
+CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -Wmissing-prototypes -Werror -O2
+LFLAGS=-M -no-check-sections -T ../arch/mips/_link.ld
+
+arch_sources= \
+	arch/powerpc.c
Index: arch/powerpc/_link.ld
===================================================================
--- arch/powerpc/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/powerpc/_link.ld	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,38 @@
+/*
+ *  PowerPC linker script
+ *  
+ *  kernel text
+ *  kernel data
+ *  
+ */
+
+OUTPUT_FORMAT(binary)
+ENTRY(kernel_image_start)
+
+SECTIONS {
+    .image 0x80000000: AT (0x80000000) { 
+	ktext_start = .;
+	*(.text);
+	ktext_end = .;
+
+	kdata_start = .;
+	kdata_end = .;
+
+    } = 0x00000000
+
+    . = ABSOLUTE(hardcoded_ktext_size);
+    .patch_1 : {
+        LONG(ktext_end - ktext_start);
+    }
+
+    . = ABSOLUTE(hardcoded_kdata_size);
+    .patch_2 : {
+        LONG(kdata_end - kdata_start);
+    }
+
+    . = ABSOLUTE(hardcoded_load_address);
+    .patch_3 : {
+        LONG(0x80000000);
+    }
+
+}
Index: arch/powerpc/boot/Makefile
===================================================================
--- arch/powerpc/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/powerpc/boot/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,21 @@
+.PHONY: nothing build
+
+nothing:
+
+build: boot.bin
+	cp boot.bin ../../../src/load.bin
+
+AS=/usr/local/mips/bin/decstation-ultrix-as
+LD=/usr/local/mips/bin/decstation-ultrix-ld
+
+ASFLAGS=-mips2 -EL
+LFLAGS=--oformat=binary -mips2 -EL -e start
+
+boot.bin: boot.o
+	$(LD) $(LFLAGS) boot.o -o $@
+
+boot.o:
+	$(AS) boot.s -o $@
+
+clean:
+	-rm *.o *.bin
Index: arch/powerpc/boot/boot.s
===================================================================
--- arch/powerpc/boot/boot.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/powerpc/boot/boot.s	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2001-2004 Jakub Jermar
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
Index: arch/powerpc/src/powerpc.c
===================================================================
--- arch/powerpc/src/powerpc.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ arch/powerpc/src/powerpc.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
Index: ot/arch/abs32le/meson.build
===================================================================
--- boot/arch/abs32le/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = false
-POSTBUILD = 'none'
-POST_OUTPUT = ''
Index: ot/arch/amd64/meson.build
===================================================================
--- boot/arch/amd64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-POST_OUTPUT = 'image.iso'
-BUILD = false
-POSTBUILD = 'grub'
-GRUB_LOADER = 'multiboot'
Index: ot/arch/arm32/_link.ld.in
===================================================================
--- boot/arch/arm32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#include <arch/arch.h>
-
-ENTRY(start)
-
-SECTIONS {
-	. = BOOT_BASE;
-	.text : {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-	}
-	. = BOOT_BASE + 0x8000;
-	.data : {
-		*(BOOTPT);      /* bootstrap page table */
-		*(BOOTSTACK);   /* bootstrap stack */
-		*(.data .data.*);       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.gnu.*);
-		*(.ARM.*);
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note.*);
-	}
-}
Index: ot/arch/arm32/include/arch/arch.h
===================================================================
--- boot/arch/arm32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_arm32_ARCH_H
-#define BOOT_arm32_ARCH_H
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define PTL0_ENTRIES     4096
-#define PTL0_ENTRY_SIZE  4
-
-/*
- * Address where the boot stage image starts (beginning of usable physical
- * memory).
- */
-#ifdef MACHINE_gta02
-#define BOOT_BASE	0x30008000
-#elif defined MACHINE_beagleboardxm
-#define BOOT_BASE	0x80000000
-#elif defined MACHINE_beaglebone
-#define BOOT_BASE       0x80000000
-#elif defined MACHINE_raspberrypi
-#define BOOT_BASE	0x00008000
-#else
-#define BOOT_BASE	0x00000000
-#endif
-
-#define BOOT_OFFSET	(BOOT_BASE + 0xa00000)
-
-#ifdef MACHINE_beagleboardxm
-#define PA_OFFSET 0
-#elif defined MACHINE_beaglebone
-#define PA_OFFSET 0
-#else
-#define PA_OFFSET 0x80000000
-#endif
-
-#ifndef __ASSEMBLER__
-#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
-#else
-#define PA2KA(addr)  ((addr) + PA_OFFSET)
-#endif
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/arch/asm.h
===================================================================
--- boot/arch/arm32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Functions implemented in assembly.
- */
-
-#ifndef BOOT_arm32_ASM_H
-#define BOOT_arm32_ASM_H
-
-#include <arch/arch.h>
-#include <arch/mm.h>
-
-extern pte_level0_section_t boot_pt[PTL0_ENTRIES];
-extern void *boot_stack;
-
-/** Jump to the kernel entry point.
- *
- * @param entry    Kernel entry point.
- * @param bootinfo Structure holding information about loaded tasks.
- *
- */
-extern void jump_to_kernel(void *entry, void *bootinfo)
-    __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/arch/cp15.h
===================================================================
--- boot/arch/arm32/include/arch/cp15.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../kernel/arch/arm32/include/arch/cp15.h
Index: ot/arch/arm32/include/arch/main.h
===================================================================
--- boot/arch/arm32/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Boot related declarations.
- */
-
-#ifndef BOOT_arm32_MAIN_H
-#define BOOT_arm32_MAIN_H
-
-/** Address where characters to be printed are expected. */
-
-/** BeagleBoard-xM UART register address
- *
- * This is UART3 of AM/DM37x CPU
- */
-#define BBXM_SCONS_THR          0x49020000
-#define BBXM_SCONS_SSR          0x49020044
-
-/* Check this bit before writing (tx fifo full) */
-#define BBXM_THR_FULL           0x00000001
-
-/** Beaglebone UART register addresses
- *
- * This is UART0 of AM335x CPU
- */
-#define BBONE_SCONS_THR         0x44E09000
-#define BBONE_SCONS_SSR         0x44E09044
-
-/** Check this bit before writing (tx fifo full) */
-#define BBONE_TXFIFO_FULL       0x00000001
-
-/** GTA02 serial console UART register addresses.
- *
- * This is UART channel 2 of the S3C24xx CPU
- */
-#define GTA02_SCONS_UTRSTAT	0x50008010
-#define GTA02_SCONS_UTXH	0x50008020
-
-/* Bits in UTXH register */
-#define S3C24XX_UTXH_TX_EMPTY	0x00000004
-
-/** IntegratorCP serial console output register */
-#define ICP_SCONS_ADDR		0x16000000
-
-/** Raspberry PI serial console registers */
-#define BCM2835_UART0_BASE	0x20201000
-#define BCM2835_UART0_DR	(BCM2835_UART0_BASE + 0x00)
-#define BCM2835_UART0_FR	(BCM2835_UART0_BASE + 0x18)
-#define BCM2835_UART0_ILPR	(BCM2835_UART0_BASE + 0x20)
-#define BCM2835_UART0_IBRD	(BCM2835_UART0_BASE + 0x24)
-#define BCM2835_UART0_FBRD	(BCM2835_UART0_BASE + 0x28)
-#define BCM2835_UART0_LCRH	(BCM2835_UART0_BASE + 0x2C)
-#define BCM2835_UART0_CR	(BCM2835_UART0_BASE + 0x30)
-#define BCM2835_UART0_ICR	(BCM2835_UART0_BASE + 0x44)
-
-#define BCM2835_UART0_FR_TXFF	(1 << 5)
-#define BCM2835_UART0_LCRH_FEN	(1 << 4)
-#define BCM2835_UART0_LCRH_WL8	((1 << 5) | (1 << 6))
-#define BCM2835_UART0_CR_UARTEN	(1 << 0)
-#define BCM2835_UART0_CR_TXE	(1 << 8)
-#define BCM2835_UART0_CR_RXE	(1 << 9)
-
-extern void bootstrap(void);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/arch/mm.h
===================================================================
--- boot/arch/arm32/include/arch/mm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Memory management used while booting the kernel.
- *
- * So called "section" paging is used while booting the kernel. The term
- * "section" comes from the ARM architecture specification and stands for the
- * following: one-level paging, 1MB sized pages, 4096 entries in the page
- * table.
- */
-
-#ifndef BOOT_arm32__MM_H
-#define BOOT_arm32__MM_H
-
-/** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
-#define PTE_DESCRIPTOR_SECTION  0x02
-/** Shift of memory address in section descriptor */
-#define PTE_SECTION_SHIFT  20
-
-/** Page table access rights: user - no access, kernel - read/write. */
-#define PTE_AP_USER_NO_KERNEL_RW  0x01
-
-/** Start of memory mapped I/O area for GTA02 */
-#define GTA02_IOMEM_START  0x48000000
-/** End of memory mapped I/O area for GTA02 */
-#define GTA02_IOMEM_END  0x60000000
-
-/** Start of ram memory on BBxM */
-#define BBXM_RAM_START   0x80000000
-/** Start of ram memory on BBxM */
-#define BBXM_RAM_END   0xc0000000
-
-/** Start of ram memory on AM335x */
-#define AM335x_RAM_START   0x80000000
-/** End of ram memory on AM335x */
-#define AM335x_RAM_END     0xC0000000
-
-/** Start of ram memory on BCM2835 */
-#define BCM2835_RAM_START   0
-/** End of ram memory on BCM2835 */
-#define BCM2835_RAM_END     0x20000000
-
-/** Page table level 0 entry
- *
- * "section" format is used (one-level paging, 1 MB sized pages).
- * Used only while booting the kernel.
- */
-typedef struct {
-	unsigned int descriptor_type : 2;
-	unsigned int bufferable : 1;
-	unsigned int cacheable : 1;
-	unsigned int xn : 1;
-	unsigned int domain : 4;
-	unsigned int should_be_zero_1 : 1;
-	unsigned int access_permission_0 : 2;
-	unsigned int tex : 3;
-	unsigned int access_permission_1 : 1;
-	unsigned int shareable : 1;
-	unsigned int non_global : 1;
-	unsigned int should_be_zero_2 : 1;
-	unsigned int non_secure : 1;
-	unsigned int section_base_addr : 12;
-} __attribute__((packed)) pte_level0_section_t;
-
-extern void mmu_start(void);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/include/arch/types.h
===================================================================
--- boot/arch/arm32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Definitions of basic types like #uintptr_t.
- */
-
-#ifndef BOOT_arm32_TYPES_H
-#define BOOT_arm32_TYPES_H
-
-#include <_bits/all.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	taskmap_t taskmap;
-} bootinfo_t;
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm32/meson.build
===================================================================
--- boot/arch/arm32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-
-boot_image_format = 'elf'
-
-if MACHINE == 'gta02'
-	LADDR = '0x30008000'
-	SADDR = '0x30008000'
-	POSTBUILD = 'uboot'
-	POST_OUTPUT = 'uImage.bin'
-endif
-
-if MACHINE == 'beagleboardxm' or MACHINE == 'beaglebone'
-	LADDR = '0x80000000'
-	SADDR = '0x80000000'
-	POSTBUILD = 'uboot'
-	POST_OUTPUT = 'uImage.bin'
-endif
-
-if MACHINE == 'raspberrypi'
-	LADDR = '0x00008000'
-	SADDR = '0x00008000'
-	POSTBUILD = 'uboot'
-	POST_OUTPUT = 'uImage.bin'
-endif
-
-if MACHINE == 'integratorcp'
-	POSTBUILD = 'raw'
-	POST_OUTPUT = 'image.boot'
-endif
-
-
-
-boot_src = files(
-	'src/asm.S',
-	'src/eabi.S',
-	'src/main.c',
-	'src/mm.c',
-	'src/putchar.c',
-	'../../../common/stdc/mem.c',
-	'../../../common/printf/printf_core.c',
-	'../../genarch/src/division.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
Index: ot/arch/arm32/src/asm.S
===================================================================
--- boot/arch/arm32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-
-.section BOOTSTRAP
-
-#define CP15_C1_U		22
-#define CP15_C1_IC		12
-#define CP15_C1_BP		11
-#define CP15_C1_DC		2
-
-SYMBOL(start)
-
-#ifdef PROCESSOR_ARCH_armv6
-	/*
-	 * Enable unaligned doubleword memory accesses (STRD/LDRD) if the
-	 * processor supports it. Note that that boils down to ARMv6 processors
-	 * only as the older architectures require doubleword alignment and
-	 * ARMv7 always assumes the U bit is 1.
-	 */
-	mrc	p15, 0, r0, c1, c0, 0
-	orr	r0, r0, #(1 << CP15_C1_U)
-	mcr	p15, 0, r0, c1, c0, 0
-#endif
-
-	ldr sp, =boot_stack
-	b bootstrap
-
-.section BOOTPT
-SYMBOL(boot_pt)
-	.space PTL0_ENTRIES * PTL0_ENTRY_SIZE
-
-.section BOOTSTACK
-	.space 4096
-SYMBOL(boot_stack)
-
-.text
-
-FUNCTION_BEGIN(halt)
-	b halt
-FUNCTION_END(halt)
-
-FUNCTION_BEGIN(jump_to_kernel)
-	#
-	# Make sure that the I-cache, D-cache and memory are mutually coherent
-	# before passing control to the copied code.
-	#
-
-	#
-	# r0 is kernel entry point
-	# r1 is pointer to the bootinfo structure
-
-#ifndef PROCESSOR_ARCH_armv7_a
-	mrc	p15, 0, r4, c1, c0, 0
-
-	# Disable D-cache before the kernel is started.
-	bic	r4, r4, #(1 << CP15_C1_DC)
-
-	# Disable I-cache and Branch predictors.
-	bic	r4, r4, #(1 << CP15_C1_IC)
-#ifdef PROCESSOR_ARCH_armv6
-	bic	r4, r4, #(1 << CP15_C1_BP)
-#endif
-
-	mcr	p15, 0, r4, c1, c0, 0
-#endif
-
-	# Wait for the operations to complete
-#ifdef PROCESSOR_ARCH_armv7_a
-	dsb
-#else
-	# cp15 dsb, r4 is ignored (should be zero)
-	mov r4, #0
-	mcr p15, 0, r4, c7, c10, 4
-#endif
-
-	# Clean ICache and BPredictors, r4 ignored (SBZ)
-	mov r4, #0
-	mcr p15, 0, r4, c7, c5, 0
-	nop
-
-	# Wait for the operations to complete
-#ifdef PROCESSOR_ARCH_armv7_a
-	isb
-	nop
-#elif defined(PROCESSOR_ARCH_armv6)
-	# cp15 isb
-	mcr p15, 0, r4, c7, c5, 4
-	nop
-#endif
-	mov pc, r0
-FUNCTION_END(jump_to_kernel)
-
Index: ot/arch/arm32/src/eabi.S
===================================================================
--- boot/arch/arm32/src/eabi.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-# Copyright (c) 2012 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(__aeabi_idiv)
-	push {lr}
-	bl __divsi3
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_idiv)
-
-FUNCTION_BEGIN(__aeabi_uidiv)
-	push {lr}
-	bl __udivsi3
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uidiv)
-
-FUNCTION_BEGIN(__aeabi_idivmod)
-	push {lr}
-	sub sp, sp, #12
-	add r2, sp, #4
-	bl __udivmodsi3
-	ldr r1, [sp, #4]
-	add sp, sp, #12
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_idivmod)
-
-FUNCTION_BEGIN(__aeabi_uidivmod)
-	push {lr}
-	sub sp, sp, #12
-	add r2, sp, #4
-	bl __udivmodsi3
-	ldr r1, [sp, #4]
-	add sp, sp, #12
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uidivmod)
-
-FUNCTION_BEGIN(__aeabi_ldivmod)
-	push {lr}
-	sub sp, sp, #24
-	push {sp}
-	bl __divmoddi3
-	add sp, sp, #4
-	pop {r2, r3}
-	add sp, sp, #16
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_ldivmod)
-
-FUNCTION_BEGIN(__aeabi_uldivmod)
-	push {lr}
-	sub sp, sp, #24
-	push {sp}
-	bl __udivmoddi3
-	add sp, sp, #4
-	pop {r2, r3}
-	add sp, sp, #16
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uldivmod)
-
Index: ot/arch/arm32/src/main.c
===================================================================
--- boot/arch/arm32/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Bootstrap.
- */
-
-#include <arch/main.h>
-#include <arch/types.h>
-#include <arch/asm.h>
-#include <arch/mm.h>
-#include <halt.h>
-#include <printf.h>
-#include <mem.h>
-#include <version.h>
-#include <macros.h>
-#include <align.h>
-#include <stdbool.h>
-#include <str.h>
-#include <errno.h>
-#include <inflate.h>
-#include <arch/cp15.h>
-#include <payload.h>
-#include <kernel.h>
-
-static void clean_dcache_poc(void *address, size_t size)
-{
-	const uintptr_t addr = (uintptr_t) address;
-
-#if !defined(PROCESSOR_ARCH_armv7_a)
-	bool sep;
-	if (MIDR_read() != CTR_read()) {
-		sep = (CTR_read() & CTR_SEP_FLAG) == CTR_SEP_FLAG;
-	} else {
-		printf("Unknown cache type.\n");
-		halt();
-	}
-#endif
-
-	for (uintptr_t a = ALIGN_DOWN(addr, CP15_C7_MVA_ALIGN); a < addr + size;
-	    a += CP15_C7_MVA_ALIGN) {
-#if defined(PROCESSOR_ARCH_armv7_a)
-		DCCMVAC_write(a);
-#else
-		if (sep)
-			DCCMVA_write(a);
-		else
-			CCMVA_write(a);
-#endif
-	}
-}
-
-static bootinfo_t bootinfo;
-
-void bootstrap(void)
-{
-	/* Enable MMU and caches */
-	mmu_start();
-	version_print();
-
-	printf("Boot loader: %p -> %p\n", loader_start, loader_end);
-	printf("\nMemory statistics\n");
-	printf(" %p|%p: bootstrap stack\n", &boot_stack, &boot_stack);
-	printf(" %p|%p: bootstrap page table\n", &boot_pt, &boot_pt);
-	printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
-	printf(" %p|%p: kernel entry point\n",
-	    (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET);
-
-	// FIXME: Use the correct value.
-	uint8_t *kernel_dest = (uint8_t *) BOOT_OFFSET;
-	uint8_t *ram_end = kernel_dest + (1 << 24);
-
-	extract_payload(&bootinfo.taskmap, kernel_dest, ram_end,
-	    PA2KA(kernel_dest), clean_dcache_poc);
-
-	/* Flush PT too. We need this if we disable caches later */
-	clean_dcache_poc(boot_pt, PTL0_ENTRIES * PTL0_ENTRY_SIZE);
-
-	uintptr_t entry = check_kernel((void *) PA2KA(BOOT_OFFSET));
-
-	printf("Booting the kernel...\n");
-	jump_to_kernel((void *) entry, &bootinfo);
-}
-
-/** @}
- */
Index: ot/arch/arm32/src/mm.c
===================================================================
--- boot/arch/arm32/src/mm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,279 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief Memory management used while booting the kernel.
- */
-
-#include <stdint.h>
-#include <arch/asm.h>
-#include <arch/mm.h>
-#include <arch/cp15.h>
-#include <arch/types.h>
-
-#ifdef PROCESSOR_ARCH_armv7_a
-static unsigned log2(unsigned val)
-{
-	unsigned log = 0;
-	while (val >> log++)
-		;
-	return log - 2;
-}
-
-static void dcache_invalidate_level(unsigned level)
-{
-	CSSELR_write(level << 1);
-	const uint32_t ccsidr = CCSIDR_read();
-	const unsigned sets = CCSIDR_SETS(ccsidr);
-	const unsigned ways = CCSIDR_WAYS(ccsidr);
-	const unsigned line_log = CCSIDR_LINESIZE_LOG(ccsidr);
-	const unsigned set_shift = line_log;
-	const unsigned way_shift = 32 - log2(ways);
-
-	for (unsigned k = 0; k < ways; ++k)
-		for (unsigned j = 0; j < sets; ++j) {
-			const uint32_t val = (level << 1) |
-			    (j << set_shift) | (k << way_shift);
-			DCISW_write(val);
-		}
-}
-
-/** invalidate all dcaches -- armv7 */
-static void cache_invalidate(void)
-{
-	const uint32_t cinfo = CLIDR_read();
-	for (unsigned i = 0; i < 7; ++i) {
-		switch (CLIDR_CACHE(i, cinfo)) {
-		case CLIDR_DCACHE_ONLY:
-		case CLIDR_SEP_CACHE:
-		case CLIDR_UNI_CACHE:
-			dcache_invalidate_level(i);
-		}
-	}
-	asm volatile ("dsb\n");
-	ICIALLU_write(0);
-	asm volatile ("isb\n");
-}
-#endif
-
-/** Disable the MMU */
-static void disable_paging(void)
-{
-	asm volatile (
-	    "mrc p15, 0, r0, c1, c0, 0\n"
-	    "bic r0, r0, #1\n"
-	    "mcr p15, 0, r0, c1, c0, 0\n"
-	    ::: "r0"
-	);
-}
-
-/** Check if caching can be enabled for a given memory section.
- *
- * Memory areas used for I/O are excluded from caching.
- *
- * @param section	The section number.
- *
- * @return	1 if the given section can be mapped as cacheable, 0 otherwise.
- */
-static inline int section_cacheable(pfn_t section)
-{
-	const unsigned long address = section << PTE_SECTION_SHIFT;
-#ifdef MACHINE_gta02
-	if (address < GTA02_IOMEM_START || address >= GTA02_IOMEM_END)
-		return 1;
-#elif defined MACHINE_beagleboardxm
-	if (address >= BBXM_RAM_START && address < BBXM_RAM_END)
-		return 1;
-#elif defined MACHINE_beaglebone
-	if (address >= AM335x_RAM_START && address < AM335x_RAM_END)
-		return 1;
-#elif defined MACHINE_raspberrypi
-	if (address < BCM2835_RAM_END)
-		return 1;
-#endif
-	return address * 0;
-}
-
-/** Initialize "section" page table entry.
- *
- * Will be readable/writable by kernel with no access from user mode.
- * Will belong to domain 0. No cache or buffering is enabled.
- *
- * @param pte   Section entry to initialize.
- * @param frame First frame in the section (frame number).
- *
- * @note If frame is not 1 MB aligned, first lower 1 MB aligned frame will be
- *       used.
- *
- */
-static void init_ptl0_section(pte_level0_section_t *pte,
-    pfn_t frame)
-{
-	pte->descriptor_type = PTE_DESCRIPTOR_SECTION;
-	pte->xn = 0;
-	pte->domain = 0;
-	pte->should_be_zero_1 = 0;
-	pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	/*
-	 * Keeps this setting in sync with memory type attributes in:
-	 * init_boot_pt (boot/arch/arm32/src/mm.c)
-	 * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
-	 * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
-	 */
-	pte->tex = section_cacheable(frame) ? 5 : 0;
-	pte->cacheable = section_cacheable(frame) ? 0 : 0;
-	pte->bufferable = section_cacheable(frame) ? 1 : 1;
-#else
-	pte->bufferable = section_cacheable(frame);
-	pte->cacheable = section_cacheable(frame);
-	pte->tex = 0;
-#endif
-	pte->access_permission_1 = 0;
-	pte->shareable = 0;
-	pte->non_global = 0;
-	pte->should_be_zero_2 = 0;
-	pte->non_secure = 0;
-	pte->section_base_addr = frame;
-}
-
-/** Initialize page table used while booting the kernel. */
-static void init_boot_pt(void)
-{
-	/*
-	 * Our goal is to create page tables that serve two purposes:
-	 *
-	 * 1. Allow the loader to run in identity-mapped virtual memory and use
-	 *    I/O devices (e.g. an UART for logging).
-	 * 2. Allow the kernel to start running in virtual memory from addresses
-	 *    above 2G.
-	 *
-	 * The matters are slightly complicated by the different locations of
-	 * physical memory and I/O devices on the various boards that we
-	 * support. We see two cases (but other are still possible):
-	 *
-	 * a) Both RAM and I/O is in memory below 2G
-	 *    For instance, this is the case of GTA02, Integrator/CP
-	 *    and RaspberryPi
-	 * b) RAM starts at 2G and I/O devices are below 2G
-	 *    For example, this is the case of BeagleBone and BeagleBoard XM
-	 *
-	 * This leads to two possible setups of boot page tables:
-	 *
-	 * A) To arrange for a), split the virtual address space into two
-	 *    halves, both identity-mapping the first 2G of physical address
-	 *    space.
-	 * B) To accommodate b), create one larger virtual address space
-	 *    identity-mapping the entire physical address space.
-	 */
-
-	for (pfn_t page = 0; page < PTL0_ENTRIES; page++) {
-		pfn_t frame = page;
-		if (BOOT_BASE < 0x80000000UL && page >= PTL0_ENTRIES / 2)
-			frame -= PTL0_ENTRIES / 2;
-		init_ptl0_section(&boot_pt[page], frame);
-	}
-
-	/*
-	 * Tell MMU page might be cached. Keeps this setting in sync
-	 * with memory type attributes in:
-	 * init_ptl0_section (boot/arch/arm32/src/mm.c)
-	 * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
-	 * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
-	 */
-	uint32_t val = (uint32_t)boot_pt & TTBR_ADDR_MASK;
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	// FIXME: TTBR_RGN_WBWA_CACHE is unpredictable on ARMv6
-	val |= TTBR_RGN_WBWA_CACHE | TTBR_C_FLAG;
-#endif
-	TTBR0_write(val);
-}
-
-static void enable_paging(void)
-{
-	/*
-	 * c3   - each two bits controls access to the one of domains (16)
-	 * 0b01 - behave as a client (user) of a domain
-	 */
-	asm volatile (
-	    /* Behave as a client of domains */
-	    "ldr r0, =0x55555555\n"
-	    "mcr p15, 0, r0, c3, c0, 0\n"
-
-	    /* Current settings */
-	    "mrc p15, 0, r0, c1, c0, 0\n"
-
-	    /*
-	     * Enable ICache, DCache, BPredictors and MMU,
-	     * we disable caches before jumping to kernel
-	     * so this is safe for all archs.
-	     * Enable VMSAv6 the bit (23) is only writable on ARMv6.
-	     * (and QEMU)
-	     */
-#ifdef PROCESSOR_ARCH_armv6
-	    "ldr r1, =0x00801805\n"
-#else
-	    "ldr r1, =0x00001805\n"
-#endif
-
-	    "orr r0, r0, r1\n"
-
-	    /*
-	     * Invalidate the TLB content before turning on the MMU.
-	     * ARMv7-A Reference manual, B3.10.3
-	     */
-	    "mcr p15, 0, r0, c8, c7, 0\n"
-
-	    /* Store settings, enable the MMU */
-	    "mcr p15, 0, r0, c1, c0, 0\n"
-	    ::: "r0", "r1"
-	);
-}
-
-/** Start the MMU - initialize page table and enable paging. */
-void mmu_start(void)
-{
-	disable_paging();
-#ifdef PROCESSOR_ARCH_armv7_a
-	/*
-	 * Make sure we run in memory code when caches are enabled,
-	 * make sure we read memory data too. This part is ARMv7 specific as
-	 * ARMv7 no longer invalidates caches on restart.
-	 * See chapter B2.2.2 of ARM Architecture Reference Manual p. B2-1263
-	 */
-	cache_invalidate();
-#endif
-	init_boot_pt();
-	enable_paging();
-}
-
-/** @}
- */
Index: ot/arch/arm32/src/putchar.c
===================================================================
--- boot/arch/arm32/src/putchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,210 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2009 Vineeth Pillai
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm32
- * @{
- */
-/** @file
- * @brief bootloader output logic
- */
-
-#include <arch/main.h>
-#include <putchar.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <str.h>
-
-#ifdef MACHINE_beaglebone
-
-/** Send a byte to the am335x serial console.
- *
- * @param byte		Byte to send.
- */
-static void scons_sendb_bbone(uint8_t byte)
-{
-	volatile uint32_t *thr =
-	    (volatile uint32_t *) BBONE_SCONS_THR;
-	volatile uint32_t *ssr =
-	    (volatile uint32_t *) BBONE_SCONS_SSR;
-
-	/* Wait until transmitter is empty */
-	while (*ssr & BBONE_TXFIFO_FULL)
-		;
-
-	/* Transmit byte */
-	*thr = (uint32_t) byte;
-}
-
-#endif
-
-#ifdef MACHINE_beagleboardxm
-
-/** Send a byte to the amdm37x serial console.
- *
- * @param byte		Byte to send.
- */
-static void scons_sendb_bbxm(uint8_t byte)
-{
-	volatile uint32_t *thr =
-	    (volatile uint32_t *)BBXM_SCONS_THR;
-	volatile uint32_t *ssr =
-	    (volatile uint32_t *)BBXM_SCONS_SSR;
-
-	/* Wait until transmitter is empty. */
-	while ((*ssr & BBXM_THR_FULL) == 1)
-		;
-
-	/* Transmit byte. */
-	*thr = (uint32_t) byte;
-}
-
-#endif
-
-#ifdef MACHINE_gta02
-
-/** Send a byte to the gta02 serial console.
- *
- * @param byte		Byte to send.
- */
-static void scons_sendb_gta02(uint8_t byte)
-{
-	volatile uint32_t *utrstat;
-	volatile uint32_t *utxh;
-
-	utrstat = (volatile uint32_t *) GTA02_SCONS_UTRSTAT;
-	utxh    = (volatile uint32_t *) GTA02_SCONS_UTXH;
-
-	/* Wait until transmitter is empty. */
-	while ((*utrstat & S3C24XX_UTXH_TX_EMPTY) == 0)
-		;
-
-	/* Transmit byte. */
-	*utxh = (uint32_t) byte;
-}
-
-#endif
-
-#ifdef MACHINE_integratorcp
-
-/** Send a byte to the IntegratorCP serial console.
- *
- * @param byte		Byte to send.
- */
-static void scons_sendb_icp(uint8_t byte)
-{
-	*((volatile uint8_t *) ICP_SCONS_ADDR) = byte;
-}
-
-#endif
-
-#ifdef MACHINE_raspberrypi
-
-static int raspi_init;
-
-static inline void write32(uint32_t addr, uint32_t data)
-{
-	*(volatile uint32_t *)(addr) = data;
-}
-
-static inline uint32_t read32(uint32_t addr)
-{
-	return *(volatile uint32_t *)(addr);
-}
-
-static void scons_init_raspi(void)
-{
-	write32(BCM2835_UART0_CR, 0x0);		/* Disable UART */
-	write32(BCM2835_UART0_ICR, 0x7f);	/* Clear interrupts */
-	write32(BCM2835_UART0_IBRD, 1);		/* Set integer baud rate */
-	write32(BCM2835_UART0_FBRD, 40);	/* Set fractional baud rate */
-	write32(BCM2835_UART0_LCRH,
-	    BCM2835_UART0_LCRH_FEN |		/* Enable FIFOs */
-	    BCM2835_UART0_LCRH_WL8);		/* Word length: 8 */
-	write32(BCM2835_UART0_CR,
-	    BCM2835_UART0_CR_UARTEN |		/* Enable UART */
-	    BCM2835_UART0_CR_TXE |		/* Enable TX */
-	    BCM2835_UART0_CR_RXE);		/* Enable RX */
-}
-
-static void scons_sendb_raspi(uint8_t byte)
-{
-	if (!raspi_init) {
-		scons_init_raspi();
-		raspi_init = 1;
-	}
-
-	while (read32(BCM2835_UART0_FR) & BCM2835_UART0_FR_TXFF)
-		;
-
-	write32(BCM2835_UART0_DR, byte);
-}
-#endif
-
-/** Send a byte to the serial console.
- *
- * @param byte		Byte to send.
- */
-static void scons_sendb(uint8_t byte)
-{
-#ifdef MACHINE_beaglebone
-	scons_sendb_bbone(byte);
-#endif
-#ifdef MACHINE_beagleboardxm
-	scons_sendb_bbxm(byte);
-#endif
-#ifdef MACHINE_gta02
-	scons_sendb_gta02(byte);
-#endif
-#ifdef MACHINE_integratorcp
-	scons_sendb_icp(byte);
-#endif
-#ifdef MACHINE_raspberrypi
-	scons_sendb_raspi(byte);
-#endif
-}
-
-/** Display a character
- *
- * @param ch Character to display
- *
- */
-void putuchar(const char32_t ch)
-{
-	if (ch == '\n')
-		scons_sendb('\r');
-
-	if (ascii_check(ch))
-		scons_sendb((uint8_t) ch);
-	else
-		scons_sendb('?');
-}
-
-/** @}
- */
Index: ot/arch/arm64/_link.ld.in
===================================================================
--- boot/arch/arm64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#include <arch/arch.h>
-
-ENTRY(start)
-
-SECTIONS {
-	. = 0x0;
-	.text : {
-		HIDDEN(loader_start = .);
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-	}
-	.dynamic : { *(.dynamic); }
-	.rela.got : { *(.rela.got); }
-	.hash : { *(.hash); }
-	.dynsym : { *(.dynsym); }
-	.dynstr : { *(.dynstr); }
-	. = 0x8000;
-	.data : {
-		*(.data .data.*);      /* initialized data */
-		*(.rodata .rodata.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		*(.got .got.*);
-		HIDDEN(loader_end = .);
-		HIDDEN(payload_start = .);
-		KEEP(*(.payload));
-		HIDDEN(payload_end = .);
-	}
-
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: ot/arch/arm64/include/arch/arch.h
===================================================================
--- boot/arch/arm64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Various ARM64-specific macros.
- */
-
-#ifndef BOOT_arm64_ARCH_H
-#define BOOT_arm64_ARCH_H
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define BOOT_OFFSET  0x80000
-
-#ifndef __ASSEMBLER__
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffffffff00000000))
-#endif
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/include/arch/asm.h
===================================================================
--- boot/arch/arm64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Functions implemented in assembly.
- */
-
-#ifndef BOOT_arm64_ASM_H
-#define BOOT_arm64_ASM_H
-
-/** Jump to the kernel entry point.
- *
- * @param entry    Kernel entry point.
- * @param bootinfo Structure holding information about loaded tasks.
- */
-extern void jump_to_kernel(void *entry, void *bootinfo)
-    __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/include/arch/barrier.h
===================================================================
--- boot/arch/arm64/include/arch/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Memory barriers.
- */
-
-#ifndef BOOT_arm64_BARRIER_H_
-#define BOOT_arm64_BARRIER_H_
-
-#include <stddef.h>
-
-extern void smc_coherence(void *, size_t);
-extern void dcache_flush(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/include/arch/boot.h
===================================================================
--- boot/arch/arm64/include/arch/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../kernel/arch/arm64/include/arch/boot/boot.h
Index: ot/arch/arm64/include/arch/main.h
===================================================================
--- boot/arch/arm64/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Boot related declarations.
- */
-
-#ifndef BOOT_arm64_MAIN_H
-#define BOOT_arm64_MAIN_H
-
-#include <genarch/efi.h>
-
-extern efi_status_t bootstrap(void *efi_handle_in,
-    efi_system_table_t *efi_system_table_in, void *load_address);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/include/arch/regutils.h
===================================================================
--- boot/arch/arm64/include/arch/regutils.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../kernel/arch/arm64/include/arch/regutils.h
Index: ot/arch/arm64/include/arch/relocate.h
===================================================================
--- boot/arch/arm64/include/arch/relocate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Image self-relocation support.
- */
-
-#ifndef BOOT_arm64_RELOCATE_H
-#define BOOT_arm64_RELOCATE_H
-
-#include <abi/elf.h>
-#include <genarch/efi.h>
-#include <stdint.h>
-
-extern efi_status_t self_relocate(uintptr_t base, const elf_dyn_t *dyn);
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/include/arch/types.h
===================================================================
--- boot/arch/arm64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Definitions of basic types like #uintptr_t.
- */
-
-#ifndef BOOT_arm64_TYPES_H
-#define BOOT_arm64_TYPES_H
-
-#include <_bits/all.h>
-
-#include <arch/boot.h>
-#define task_t utask_t
-
-#endif
-
-/** @}
- */
Index: ot/arch/arm64/meson.build
===================================================================
--- boot/arch/arm64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-
-if MACHINE == 'virt'
-	POST_OUTPUT = 'image.iso'
-	POSTBUILD = 'grub'
-	GRUB_LOADER = 'chainloader'
-endif
-
-if MACHINE == 'hikey960'
-	POSTBUILD = 'raw'
-	POST_OUTPUT = 'image.boot'
-endif
-
-# Request binary output. The ARM64 port manually prepares the .text
-# section to look as a PE file than can be loaded on EFI systems.
-boot_image_format = 'binary'
-
-boot_src = files(
-	'src/asm.S',
-	'src/main.c',
-	'src/relocate.c',
-	'../../../common/stdc/mem.c',
-	'../../../common/printf/printf_core.c',
-	'../../genarch/src/efi.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/version.c',
-	'../../generic/src/vprintf.c',
-)
Index: ot/arch/arm64/src/asm.S
===================================================================
--- boot/arch/arm64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,311 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/regutils.h>
-
-.section BOOTSTRAP
-
-#define DIRECTORY_ENTRIES 16
-
-/* MS-DOS stub */
-msdos_stub:
-	.ascii "MZ"                     /* MS-DOS signature */
-	.space 0x3a                     /* Ignore fields up to byte at 0x3c */
-	.long pe_header - msdos_stub    /* Offset to the PE header */
-
-/* Portable Executable header */
-pe_header:
-	/* PE signature */
-	.ascii "PE\x0\x0"
-
-	/* COFF File Header */
-	.short 0xaa64                   /* Machine = IMAGE_FILE_MACHINE_ARM64 */
-	.short 1                        /* Number of sections */
-	.long 0                         /* Time date stamp */
-	.long 0                         /* Pointer to symbol table */
-	.long 0                         /* Number of symbols */
-	.short sec_table - opt_header   /* Size of optional header */
-	/*
-	 * Characteristics = IMAGE_FILE_EXECUTABLE_IMAGE |
-	 *   IMAGE_FILE_LARGE_ADDRESS_AWARE
-	 */
-	.short 0x22
-
-	/* Optional header standard fields */
-opt_header:
-	.short 0x20b                    /* Magic = PE32+ */
-	.byte 0                         /* Major linker version */
-	.byte 0                         /* Minor linker version */
-	.long payload_end - msdos_stub  /* Size of code */
-	.long 0                         /* Size of initialized data */
-	.long 0                         /* Size of uninitialized data */
-	.long start - msdos_stub        /* Address of entry point */
-	.long start - msdos_stub        /* Base of code */
-
-	/* Optional header Windows-specific fields */
-	.quad 0                         /* Image base */
-	.long 4                         /* Section alignment */
-	.long 4                         /* File alignment */
-	.short 0                        /* Major operating system version */
-	.short 0                        /* Minor operating system version */
-	.short 0                        /* Major image version */
-	.short 0                        /* Minor image version */
-	.short 0                        /* Major subsystem version */
-	.short 0                        /* Minor subsystem version */
-	.long 0                         /* Win32 version value */
-	.long payload_end - msdos_stub  /* Size of image */
-	.long start - msdos_stub        /* Size of headers */
-	.long 0                         /* Checksum */
-	.short 10                       /* Subsystem = EFI application */
-	.short 0                        /* DLL characteristics */
-	.quad 0                         /* Size of stack reserve */
-	.quad 0                         /* Size of stack commit */
-	.quad 0                         /* Size of heap reserve */
-	.quad 0                         /* Size of heap commit */
-	.long 0                         /* Loader flags */
-	.long DIRECTORY_ENTRIES         /* Number of RVA and sizes */
-	.space DIRECTORY_ENTRIES * 8    /* Directory entries */
-
-sec_table:
-	.ascii ".text\x0\x0\x0"         /* Name */
-	.long payload_end - start       /* Virtual size */
-	.long start - msdos_stub        /* Virtual address */
-	.long payload_end - start       /* Size of raw data */
-	.long start - msdos_stub        /* Pointer to raw data */
-	.long 0                         /* Pointer to relocations */
-	.long 0                         /* Pointer to line numbers */
-	.short 0                        /* Number of relocations */
-	.short 0                        /* Number of line numbers */
-	/*
-	 * Characteristics = IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE |
-	 *   IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE
-	 */
-	.long 0xe0000020
-
-/** Boot loader entry point
- *
- * @param x0 UEFI image handle.
- * @param x1 Pointer to the UEFI system table.
- *
- */
-SYMBOL(start)
-	.hidden start
-
-	/*
-	 * Stay on the UEFI stack. Its size is at least 128 KiB, plenty for this
-	 * boot loader.
-	 */
-	stp x29, x30, [sp, #-32]!
-	mov x29, sp
-	stp x0, x1, [sp, #16]
-
-	/*
-	 * Self-relocate the image. Pass a load address of the image (x0) and a
-	 * pointer to the dynamic array (x1).
-	 */
-	adr x0, msdos_stub
-	adrp x1, _DYNAMIC
-	add x1, x1, #:lo12:_DYNAMIC
-	bl self_relocate
-	cbnz x0, __uefi_exit
-
-	/*
-	 * Flush the instruction cache of the relocated boot loader image.
-	 */
-	adr x0, msdos_stub
-	adrp x1, payload_end
-	sub x1, x1, x0
-	bl smc_coherence
-
-	/*
-	 * Pass the image handle (x0), a pointer to the UEFI system table (x1),
-	 * and the image load address (x2) to the boostrap function.
-	 */
-	ldp x0, x1, [sp, #16]
-	adr x2, msdos_stub
-	bl bootstrap
-
-	__uefi_exit:
-		ldp x29, x30, [sp], #32
-		ret
-
-FUNCTION_BEGIN(halt)
-	.hidden halt
-
-	b halt
-FUNCTION_END(halt)
-
-/** Flush instruction caches
- *
- * @param x0 Starting address of the flushing.
- * @param x1 Number of bytes to flush.
- *
- */
-FUNCTION_BEGIN(smc_coherence)
-	.hidden smc_coherence
-
-	/* Initialize loop */
-	mov x9, x0
-	mov x10, xzr
-
-	__dc_loop:
-		/* Data or Unified Cache Line Clean */
-		dc cvau, x9
-		add x9, x9, #4
-		add x10, x10, #4
-		cmp x10, x1
-		blo __dc_loop
-
-	dsb ish
-
-	/* Initialize loop */
-	mov x9, x0
-	mov x10, xzr
-
-	__ic_loop:
-		/* Instruction Cache Line Invalidate */
-		ic ivau, x9
-		add x9, x9, #4
-		add x10, x10, #4
-		cmp x10, x1
-		blo __ic_loop
-
-	dsb ish
-	isb
-	ret
-FUNCTION_END(smc_coherence)
-
-/** Flush data caches
- *
- * @param x0 Starting address of the flushing.
- * @param x1 Number of bytes to flush.
- *
- */
-FUNCTION_BEGIN(dcache_flush)
-	.hidden dcache_flush
-
-	mov x9, x0
-	mov x10, xzr
-
-	__dc_flush_loop:
-		/* Data or Unified Cache Line Clean */
-		dc cvau, x9
-		add x9, x9, #4
-		add x10, x10, #4
-		cmp x10, x1
-		blo __dc_flush_loop
-
-	dsb ish
-	isb
-	ret
-FUNCTION_END(dcache_flush)
-
-/** Kernel entry
- *
- * @param x0 Kernel entry point.
- * @param x1 Pointer to the bootinfo structure.
- *
- */
-FUNCTION_BEGIN(jump_to_kernel)
-	.hidden jump_to_kernel
-
-	mrs x9, CurrentEL
-	lsr x9, x9, 2
-
-	cmp x9, #3
-	b.eq __el3
-
-	cmp x9, #2
-	b.eq __el2
-
-	cmp x9, #1
-	b.eq __el1
-
-	b halt
-
-	__el3:
-		msr sctlr_el2, xzr
-		msr hcr_el2, xzr
-		isb
-
-		/* EL2 is AArch64, EL1 is Non-secure World */
-		mov x9, #(1 << 10)
-		orr x9, x9, #(1 << 0)
-		msr scr_el3, x9
-		isb
-
-		/* EL2h */
-		mov x9, #0x9
-		msr spsr_el3, x9
-		isb
-
-		adr x9, __el2
-		msr elr_el3, x9
-		isb
-
-		/* Switch to EL2 */
-		eret
-
-	__el2:
-		msr sctlr_el1, xzr
-		isb
-
-		/* EL1 is AArch64 */
-		mov x9, #(1 << 31)
-		msr hcr_el2, x9
-		isb
-
-		/* EL1h */
-		mov x9, #0x5
-		msr spsr_el2, x9
-		isb
-
-		adr x9, __el1
-		msr elr_el2, x9
-		isb
-
-		/* Switch to EL1 */
-		eret
-
-	__el1:
-		/* Do not trap on FPU instructions */
-		mrs x9, cpacr_el1
-		orr x9, x9, #(3 << 20)
-		msr cpacr_el1, x9
-		dmb ish
-
-		/* Disable MMU (removes the identity mapping provided by UEFI) */
-		mrs x9, sctlr_el1
-		bic x9, x9, #SCTLR_M_FLAG
-		msr sctlr_el1, x9
-		isb
-
-		br x0
-FUNCTION_END(jump_to_kernel)
Index: ot/arch/arm64/src/main.c
===================================================================
--- boot/arch/arm64/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,320 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Bootstrap.
- */
-
-#include <stddef.h>
-#include <align.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/barrier.h>
-#include <arch/main.h>
-#include <arch/regutils.h>
-#include <arch/types.h>
-#include <errno.h>
-#include <inflate.h>
-#include <kernel.h>
-#include <macros.h>
-#include <mem.h>
-#include <payload.h>
-#include <printf.h>
-#include <putchar.h>
-#include <str.h>
-#include <version.h>
-
-static efi_system_table_t *efi_system_table;
-
-/** Translate given UEFI memory type to the bootinfo memory type.
- *
- * @param type UEFI memory type.
- */
-static memtype_t get_memtype(uint32_t type)
-{
-	switch (type) {
-	case EFI_RESERVED:
-	case EFI_RUNTIME_SERVICES_CODE:
-	case EFI_RUNTIME_SERVICES_DATA:
-	case EFI_UNUSABLE_MEMORY:
-	case EFI_ACPI_MEMORY_NVS:
-	case EFI_MEMORY_MAPPED_IO:
-	case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
-	case EFI_PAL_CODE:
-		return MEMTYPE_UNUSABLE;
-	case EFI_LOADER_CODE:
-	case EFI_LOADER_DATA:
-	case EFI_BOOT_SERVICES_CODE:
-	case EFI_BOOT_SERVICES_DATA:
-	case EFI_CONVENTIONAL_MEMORY:
-	case EFI_PERSISTENT_MEMORY:
-		return MEMTYPE_AVAILABLE;
-	case EFI_ACPI_RECLAIM_MEMORY:
-		return MEMTYPE_ACPI_RECLAIM;
-	}
-
-	return MEMTYPE_UNUSABLE;
-}
-
-/** Send a byte to the UEFI console output.
- *
- * @param byte Byte to send.
- */
-static void scons_sendb(uint8_t byte)
-{
-	int16_t out[2] = { byte, '\0' };
-	efi_system_table->cons_out->output_string(efi_system_table->cons_out,
-	    out);
-}
-
-/** Display a character.
- *
- * @param ch Character to display.
- *
- */
-void putuchar(char32_t ch)
-{
-	if (ch == '\n')
-		scons_sendb('\r');
-
-	if (ascii_check(ch))
-		scons_sendb((uint8_t) ch);
-	else
-		scons_sendb('?');
-}
-
-efi_status_t bootstrap(void *efi_handle_in,
-    efi_system_table_t *efi_system_table_in, void *load_address)
-{
-	efi_status_t status;
-	uint64_t memmap = 0;
-	sysarg_t memmap_size;
-	sysarg_t memmap_key;
-	sysarg_t memmap_descriptor_size;
-	uint32_t memmap_descriptor_version;
-	uint64_t alloc_addr = 0;
-	sysarg_t alloc_pages = 0;
-
-	/*
-	 * Bootinfo structure is dynamically allocated in the ARM64 port. It is
-	 * placed directly after the inflated components. This assures that if
-	 * the kernel identity maps the first gigabyte of the main memory in the
-	 * kernel/upper address space then it can access the bootinfo because
-	 * the inflated components and bootinfo can always fit in this area.
-	 */
-	bootinfo_t *bootinfo;
-
-	efi_system_table = efi_system_table_in;
-
-	version_print();
-
-	printf("Boot loader: %p -> %p\n", loader_start, loader_end);
-	printf("\nMemory statistics\n");
-	printf(" %p|%p: loader\n", load_address, load_address);
-	printf(" %p|%p: UEFI system table\n", efi_system_table_in,
-	    efi_system_table_in);
-
-	/* Obtain memory map. */
-	status = efi_get_memory_map(efi_system_table, &memmap_size,
-	    (efi_v1_memdesc_t **) &memmap, &memmap_key, &memmap_descriptor_size,
-	    &memmap_descriptor_version);
-	if (status != EFI_SUCCESS) {
-		printf("Error: Unable to obtain initial memory map, status "
-		    "code: %" PRIx64 ".\n", status);
-		goto fail;
-	}
-
-	/* Find start of usable RAM. */
-	uint64_t memory_base = (uint64_t) -1;
-	for (sysarg_t i = 0; i < memmap_size / memmap_descriptor_size; i++) {
-		efi_v1_memdesc_t *desc = (void *) memmap +
-		    (i * memmap_descriptor_size);
-		if (get_memtype(desc->type) != MEMTYPE_AVAILABLE ||
-		    !(desc->attribute & EFI_MEMORY_WB))
-			continue;
-
-		if (desc->phys_start < memory_base)
-			memory_base = desc->phys_start;
-	}
-
-	/* Deallocate memory holding the map. */
-	efi_system_table->boot_services->free_pool((void *) memmap);
-	memmap = 0;
-
-	if (memory_base == (uint64_t) -1) {
-		printf("Error: Memory map does not contain any usable RAM.\n");
-		status = EFI_UNSUPPORTED;
-		goto fail;
-	}
-
-	/*
-	 * Check that everything is aligned on a 4 KiB boundary and the kernel can
-	 * be placed by the decompression code at a correct address.
-	 */
-
-	/* Statically check PAGE_SIZE and BOOT_OFFSET. */
-	_Static_assert(PAGE_SIZE == 4096, "PAGE_SIZE must be equal to 4096");
-	_Static_assert(IS_ALIGNED(BOOT_OFFSET, PAGE_SIZE),
-	    "BOOT_OFFSET must be a multiple of PAGE_SIZE");
-
-	/*
-	 * Dynamically check the memory base. The condition should be always
-	 * true because UEFI guarantees each physical/virtual address in the
-	 * memory map is aligned on a 4 KiB boundary.
-	 */
-	if (!IS_ALIGNED(memory_base, PAGE_SIZE)) {
-		printf("Error: Start of usable RAM (%p) is not aligned on a "
-		    "4 KiB boundary.\n", (void *) memory_base);
-		status = EFI_UNSUPPORTED;
-		goto fail;
-	}
-
-	/*
-	 * Calculate where the components (including the kernel) will get
-	 * placed.
-	 */
-	uint64_t decompress_base = memory_base + BOOT_OFFSET;
-	printf(" %p|%p: kernel entry point\n", (void *) decompress_base,
-	    (void *) decompress_base);
-
-	/*
-	 * Allocate memory for the decompressed components and for the bootinfo.
-	 */
-	uint64_t component_pages =
-	    ALIGN_UP(payload_unpacked_size(), EFI_PAGE_SIZE) / EFI_PAGE_SIZE;
-	uint64_t bootinfo_pages = ALIGN_UP(sizeof(*bootinfo), EFI_PAGE_SIZE) /
-	    EFI_PAGE_SIZE;
-	alloc_pages = component_pages + bootinfo_pages;
-	alloc_addr = decompress_base;
-	status = efi_system_table->boot_services->allocate_pages(
-	    EFI_ALLOCATE_ADDRESS, EFI_LOADER_CODE, alloc_pages, &alloc_addr);
-	if (status != EFI_SUCCESS) {
-		printf("Error: Unable to allocate memory for inflated "
-		    "components and bootinfo, status code: %" PRIx64 ".\n",
-		    status);
-		goto fail;
-	}
-
-	bootinfo = (void *) alloc_addr + component_pages * EFI_PAGE_SIZE;
-	printf(" %p|%p: boot info structure\n", bootinfo, bootinfo);
-	memset(bootinfo, 0, sizeof(*bootinfo));
-
-	/* Decompress the components. */
-	uint8_t *kernel_dest = (uint8_t *) alloc_addr;
-	uint8_t *ram_end = kernel_dest + component_pages * EFI_PAGE_SIZE;
-
-	extract_payload(&bootinfo->taskmap, kernel_dest, ram_end,
-	    (uintptr_t) kernel_dest, smc_coherence);
-
-	/* Get final memory map. */
-	status = efi_get_memory_map(efi_system_table, &memmap_size,
-	    (efi_v1_memdesc_t **) &memmap, &memmap_key, &memmap_descriptor_size,
-	    &memmap_descriptor_version);
-	if (status != EFI_SUCCESS) {
-		printf("Error: Unable to obtain final memory map, status code: "
-		    "%" PRIx64 ".\n", status);
-		goto fail;
-	}
-
-	/* Convert the UEFI memory map to the bootinfo representation. */
-	size_t cnt = 0;
-	memtype_t current_type = MEMTYPE_UNUSABLE;
-	void *current_start = 0;
-	size_t current_size = 0;
-	sysarg_t memmap_items_count = memmap_size / memmap_descriptor_size;
-	for (sysarg_t i = 0; i < memmap_items_count; i++) {
-		efi_v1_memdesc_t *desc = (void *) memmap +
-		    (i * memmap_descriptor_size);
-
-		/* Get type of the new area. */
-		memtype_t type;
-		if (!(desc->attribute & EFI_MEMORY_WB))
-			type = MEMTYPE_UNUSABLE;
-		else
-			type = get_memtype(desc->type);
-
-		/* Try to merge the new area with the previous one. */
-		if (type == current_type &&
-		    (uint64_t)current_start + current_size == desc->phys_start) {
-			current_size += desc->pages * EFI_PAGE_SIZE;
-			if (i != memmap_items_count - 1)
-				continue;
-		}
-
-		/* Record the previous area. */
-		if (current_type != MEMTYPE_UNUSABLE) {
-			if (cnt >= MEMMAP_MAX_RECORDS) {
-				printf("Error: Too many usable memory "
-				    "areas.\n");
-				status = EFI_UNSUPPORTED;
-				goto fail;
-			}
-			bootinfo->memmap.zones[cnt].type = current_type;
-			bootinfo->memmap.zones[cnt].start = current_start;
-			bootinfo->memmap.zones[cnt].size = current_size;
-			cnt++;
-		}
-
-		/* Remember the new area. */
-		current_type = type;
-		current_start = (void *) desc->phys_start;
-		current_size = desc->pages * EFI_PAGE_SIZE;
-	}
-	bootinfo->memmap.cnt = cnt;
-
-	/* Flush the data cache containing bootinfo. */
-	dcache_flush(bootinfo, sizeof(*bootinfo));
-
-	uintptr_t entry = check_kernel_translated((void *) decompress_base,
-	    BOOT_OFFSET);
-
-	printf("Booting the kernel...\n");
-
-	/* Exit boot services. This is a point of no return. */
-	efi_system_table->boot_services->exit_boot_services(efi_handle_in,
-	    memmap_key);
-
-	entry = memory_base + KA2PA(entry);
-	jump_to_kernel((void *) entry, bootinfo);
-
-fail:
-	if (memmap != 0)
-		efi_system_table->boot_services->free_pool((void *) memmap);
-
-	if (alloc_addr != 0)
-		efi_system_table->boot_services->free_pages(alloc_addr,
-		    alloc_pages);
-
-	return status;
-}
-
-/** @}
- */
Index: ot/arch/arm64/src/relocate.c
===================================================================
--- boot/arch/arm64/src/relocate.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2019 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_arm64
- * @{
- */
-/** @file
- * @brief Image self-relocation support.
- */
-
-#include <arch/relocate.h>
-#include <printf.h>
-
-/** Self-relocate the bootloader.
- *
- * Note: This code is responsible for self-relocating the bootloader when it is
- * started. As such, it is required that it is written in a way that it itself
- * does not need any dynamic relocation.
- */
-efi_status_t self_relocate(uintptr_t base, const elf_dyn_t *dyn)
-{
-	const elf_rela_t *rela = NULL;
-	uint64_t relasz = 0;
-	uint64_t relaent = 0;
-
-	/* Parse the dynamic array. */
-	while (dyn->d_tag != DT_NULL) {
-		switch (dyn->d_tag) {
-		case DT_RELA:
-			rela = (const elf_rela_t *) (base + dyn->d_un.d_ptr);
-			break;
-		case DT_RELASZ:
-			relasz = dyn->d_un.d_val;
-			break;
-		case DT_RELAENT:
-			relaent = dyn->d_un.d_val;
-			break;
-		}
-		dyn++;
-	}
-
-	/* Validate obtained information. */
-	if (rela == NULL)
-		return EFI_SUCCESS;
-	if (relaent == 0 || relasz % relaent != 0)
-		return EFI_UNSUPPORTED;
-
-	/* Process relocations in the image. */
-	while (relasz > 0) {
-		switch (ELF_R_TYPE(rela->r_info)) {
-		case R_AARCH64_RELATIVE:
-			*(uint64_t *) (base + rela->r_offset) =
-			    base + rela->r_addend;
-			break;
-		default:
-			return EFI_UNSUPPORTED;
-		}
-
-		rela = (const elf_rela_t *) ((const char *) rela + relaent);
-		relasz -= relaent;
-	}
-	return EFI_SUCCESS;
-}
-
-/** @}
- */
Index: ot/arch/ia32/meson.build
===================================================================
--- boot/arch/ia32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-POST_OUTPUT = 'image.iso'
-BUILD = false
-POSTBUILD = 'grub'
-GRUB_LOADER = 'multiboot'
Index: ot/arch/ia64/_link.ld.in
===================================================================
--- boot/arch/ia64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,27 +1,0 @@
-OUTPUT_FORMAT("elf64-ia64-little")
-ENTRY(start)
-
-SECTIONS {
-	.boot 0x4400000: AT (0x4400000) {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-		*(.sdata .sdata.*);
-		*(.sdata2 .sdata2.*);
-		*(.sbss .sbss.*);
-		*(.rodata .rodata.*);
-		*(.data .data.*);       /* initialized data */
-		__gp = . ;
-		*(.got .got.*);
-		*(.bss .bss.*);                /* uninitialized static variables */
-		*(COMMON);
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.*);
-	}
-}
Index: ot/arch/ia64/include/arch/arch.h
===================================================================
--- boot/arch/ia64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_ARCH_H_
-#define BOOT_ia64_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define LOADER_ADDRESS  0x4400000
-#define KERNEL_ADDRESS  0x4800000
-#define KERNEL_VADDRESS 0xe000000004800000
-
-#define STACK_SIZE                   8192
-#define STACK_ALIGNMENT              16
-
-#endif
Index: ot/arch/ia64/include/arch/asm.h
===================================================================
--- boot/arch/ia64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_ASM_H_
-#define BOOT_ia64_ASM_H_
-
-extern void jump_to_kernel(void *, void *) __attribute__((noreturn));
-
-#endif
Index: ot/arch/ia64/include/arch/main.h
===================================================================
--- boot/arch/ia64/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_MAIN_H_
-#define BOOT_ia64_MAIN_H_
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/ia64/include/arch/pal.h
===================================================================
--- boot/arch/ia64/include/arch/pal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_PAL_H_
-#define BOOT_ia64_PAL_H_
-
-#include <arch/types.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Essential PAL procedures' IDs
- */
-#define PAL_FREQ_RATIOS		14
-
-extern uint64_t pal_proc_freq_ratio(void);
-
-#define pal_static_call_0_1(id, ret1) \
-	pal_static_call((id), 0, 0, 0, (ret1), NULL, NULL)
-
-extern uint64_t pal_static_call(uint64_t, uint64_t, uint64_t, uint64_t,
-    uint64_t *, uint64_t *, uint64_t *);
-
-#endif
Index: ot/arch/ia64/include/arch/sal.h
===================================================================
--- boot/arch/ia64/include/arch/sal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_SAL_H_
-#define BOOT_ia64_SAL_H_
-
-#include <arch/types.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Essential SAL procedures' IDs
- */
-#define SAL_FREQ_BASE	0x1000012
-
-typedef struct {
-	uint8_t signature[4];
-	uint32_t total_length;
-	uint16_t sal_revision;
-	uint16_t entry_count;
-	uint8_t checksum;
-	uint8_t reserved1[7];
-	uint16_t sal_a_version;
-	uint16_t sal_b_version;
-	uint8_t oem_id[32];
-	uint8_t product_id[32];
-	uint8_t reserved2[8];
-} sal_system_table_header_t;
-
-typedef enum {
-	SSTT_ENTRYPOINT_DESC,
-	SSTT_MEMORY_DESC,
-	SSTT_PLATFORM_FEATURES_DESC,
-	SSTT_TR_DESC,
-	SSTT_PTC_COHERENCE_DOMAIN_DESC,
-	SSTT_AP_WAKEUP_DESC
-} sal_sst_type_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t reserved1[7];
-	uint64_t pal_proc;
-	uint64_t sal_proc;
-	uint64_t sal_proc_gp;
-	uint8_t reserved2[16];
-} sal_entrypoint_desc_t;
-
-/* This descriptor is unused on Itanium systems. */
-typedef struct {
-	uint8_t type;
-	uint8_t unused[31];
-} sal_memory_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t features;
-	uint8_t reserved[14];
-} sal_platform_features_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t tr_type;
-	uint8_t tr_number;
-	uint8_t reserved1[5];
-	uint64_t va;
-	uint64_t psc;
-	uint8_t reserved2[8];
-} sal_tr_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t reserved[3];
-	uint32_t coherence_domains;
-	uint64_t coherence_domain_info;
-} sal_ptc_coherence_domain_desc_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t mechanism;
-	uint8_t reserved[6];
-	uint64_t vector;
-} sal_ap_wakeup_desc_t;
-
-extern void sal_system_table_parse(sal_system_table_header_t *);
-
-extern uint64_t sal_base_clock_frequency(void);
-
-#define sal_call_1_1(id, arg1, ret1) \
-	sal_call((id), (arg1), 0, 0, 0, 0, 0, 0, (ret1), NULL, NULL)
-
-extern uint64_t sal_call(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t,
-    uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *, uint64_t *);
-
-#endif
Index: ot/arch/ia64/include/arch/ski.h
===================================================================
--- boot/arch/ia64/include/arch/ski.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_SKI_H_
-#define BOOT_ia64_SKI_H_
-
-extern void ski_putchar(char);
-
-#endif
Index: ot/arch/ia64/include/arch/types.h
===================================================================
--- boot/arch/ia64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ia64_TYPES_H_
-#define BOOT_ia64_TYPES_H_
-
-#include <_bits/all.h>
-
-#define TASKMAP_MAX_RECORDS		32
-#define BOOTINFO_TASK_NAME_BUFLEN	32
-#define MEMMAP_ITEMS			128
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	unsigned int type;
-	unsigned long base;
-	unsigned long size;
-} memmap_item_t;
-
-typedef struct {
-	taskmap_t taskmap;
-
-	memmap_item_t memmap[MEMMAP_ITEMS];
-	unsigned int memmap_items;
-
-	sysarg_t *sapic;
-	unsigned long sys_freq;
-	unsigned long freq_scale;
-	unsigned int wakeup_intno;
-} bootinfo_t;
-
-/** This is a minimal ELILO-compatible boot parameter structure. */
-typedef struct {
-	uint64_t cmd_line;
-	uint64_t efi_system_table;
-	uint64_t efi_memmap;
-	uint64_t efi_memmap_sz;
-	uint64_t efi_memdesc_sz;
-} boot_param_t;
-
-#endif
Index: ot/arch/ia64/meson.build
===================================================================
--- boot/arch/ia64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-POSTBUILD = 'raw'
-boot_image_format = 'elf'
-POST_OUTPUT = 'image.boot'
-
-boot_src = files(
-	'src/boot.S',
-	'src/asm.S',
-	'src/main.c',
-	'src/sal.c',
-	'src/sal_asm.S',
-	'src/pal.c',
-	'src/pal_asm.S',
-	'src/putchar.c',
-	'../../../common/stdc/mem.c',
-	'../../genarch/src/efi.c',
-	'../../genarch/src/division.c',
-	'../../generic/src/balloc.c',
-	'../../../common/printf/printf_core.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
-
-if MACHINE == 'ski'
-	boot_src += files('src/ski.c')
-endif
Index: ot/arch/ia64/src/asm.S
===================================================================
--- boot/arch/ia64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-
-.text
-
-FUNCTION_BEGIN(halt)
-	br halt
-FUNCTION_END(halt)
-
-FUNCTION_BEGIN(jump_to_kernel)
-	alloc loc0 = ar.pfs, 2, 1, 0, 0
-	mov r2 = in0 ;;			# Pass bootinfo address
-	mov b1 = in1 ;;                 # Entry point address
-	br.call.sptk.many b0 = b1;;
-FUNCTION_END(jump_to_kernel)
-
Index: ot/arch/ia64/src/boot.S
===================================================================
--- boot/arch/ia64/src/boot.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-
-.section BOOTSTRAP, "ax"
-
-SYMBOL(start)
-	movl gp = __gp
-
-	#
-	# Save the boot parameter structure address passed from the
-	# ELILO-compatible EFI loader.
-	#
-	movl r8 = bootpar ;;
-	st8 [r8] = r28
-
-	#
-	# Initialize the register stack to some sane value.
-	#
-	mov ar.rsc = r0
-	movl r8 = initial_stack ;;
-	mov ar.bspstore = r8
-	loadrs
-
-	#
-	# Initialize memory stack to some sane value and allocate a scratch area
-	# on it.
-	#
-	movl r12 = initial_stack_top ;;
-	add r12 = -16, r12
-
-	#
-	# Disable Floating-point High register set (f32 - f127)
-	#
-	ssm (1 << 19) ;;
-	srlz.i
-	srlz.d ;;
-
-	br.call.sptk.many rp = bootstrap
-
-.bss
-
-SYMBOL(bootpar)
-	.quad 0
-
-.align STACK_SIZE
-initial_stack:
-	.space STACK_SIZE
-initial_stack_top:
Index: ot/arch/ia64/src/main.c
===================================================================
--- boot/arch/ia64/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/main.h>
-#include <arch/types.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <genarch/efi.h>
-#include <arch/sal.h>
-#include <arch/pal.h>
-#include <halt.h>
-#include <printf.h>
-#include <mem.h>
-#include <version.h>
-#include <macros.h>
-#include <align.h>
-#include <str.h>
-#include <errno.h>
-#include <payload.h>
-#include <kernel.h>
-
-#define DEFAULT_MEMORY_BASE		0x4000000ULL
-#define DEFAULT_MEMORY_SIZE		(256 * 1024 * 1024)
-#define DEFAULT_LEGACY_IO_BASE		0x00000FFFFC000000ULL
-#define DEFAULT_LEGACY_IO_SIZE		0x4000000ULL
-
-#define DEFAULT_FREQ_SCALE		0x0000000100000001ULL	/* 1/1 */
-#define DEFAULT_SYS_FREQ		100000000ULL		/* 100MHz */
-
-#define MEMMAP_FREE_MEM		0
-#define MEMMAP_IO		1
-#define MEMMAP_IO_PORTS		2
-
-extern boot_param_t *bootpar;
-
-static bootinfo_t bootinfo;
-
-static void read_efi_memmap(void)
-{
-	memmap_item_t *memmap = bootinfo.memmap;
-	size_t items = 0;
-
-	if (!bootpar) {
-		/* Fake-up a memory map for simulators. */
-		memmap[items].base = DEFAULT_MEMORY_BASE;
-		memmap[items].size = DEFAULT_MEMORY_SIZE;
-		memmap[items].type = MEMMAP_FREE_MEM;
-		items++;
-
-		memmap[items].base = DEFAULT_LEGACY_IO_BASE;
-		memmap[items].size = DEFAULT_LEGACY_IO_SIZE;
-		memmap[items].type = MEMMAP_IO_PORTS;
-		items++;
-	} else {
-		char *cur, *mm_base = (char *) bootpar->efi_memmap;
-		size_t mm_size = bootpar->efi_memmap_sz;
-		size_t md_size = bootpar->efi_memdesc_sz;
-
-		/*
-		 * Walk the EFI memory map using the V1 memory descriptor
-		 * format. The actual memory descriptor can use newer format,
-		 * but it must always be backwards compatible with the V1
-		 * format.
-		 */
-		for (cur = mm_base;
-		    (cur < mm_base + (mm_size - md_size)) &&
-		    (items < MEMMAP_ITEMS);
-		    cur += md_size) {
-			efi_v1_memdesc_t *md = (efi_v1_memdesc_t *) cur;
-			memmap_item_t *o = NULL;
-
-			if (items)
-				o = &memmap[items - 1];
-
-			switch ((efi_memory_type_t) md->type) {
-			case EFI_LOADER_CODE:
-			case EFI_LOADER_DATA:
-			case EFI_BOOT_SERVICES_CODE:
-			case EFI_BOOT_SERVICES_DATA:
-			case EFI_CONVENTIONAL_MEMORY:
-				if (o && o->type == MEMMAP_FREE_MEM &&
-				    o->base + o->size == md->phys_start) {
-					o->size += md->pages * EFI_PAGE_SIZE;
-					continue;
-				}
-				memmap[items].type = MEMMAP_FREE_MEM;
-				break;
-			case EFI_MEMORY_MAPPED_IO:
-				memmap[items].type = MEMMAP_IO;
-				break;
-			case EFI_MEMORY_MAPPED_IO_PORT_SPACE:
-				memmap[items].type = MEMMAP_IO_PORTS;
-				break;
-			default:
-				continue;
-			}
-
-			memmap[items].base = md->phys_start;
-			memmap[items].size = md->pages * EFI_PAGE_SIZE;
-			items++;
-		}
-	}
-
-	bootinfo.memmap_items = items;
-}
-
-static void read_pal_configuration(void)
-{
-	if (bootpar) {
-		bootinfo.freq_scale = pal_proc_freq_ratio();
-	} else {
-		/* Configure default values for simulators. */
-		bootinfo.freq_scale = DEFAULT_FREQ_SCALE;
-	}
-}
-
-static void read_sal_configuration(void)
-{
-	if (bootpar && bootpar->efi_system_table) {
-		efi_guid_t sal_guid = SAL_SYSTEM_TABLE_GUID;
-		sal_system_table_header_t *sal_st;
-
-		sal_st = efi_vendor_table_find(
-		    (efi_system_table_t *) bootpar->efi_system_table, sal_guid);
-
-		sal_system_table_parse(sal_st);
-
-		bootinfo.sys_freq = sal_base_clock_frequency();
-	} else {
-		/* Configure default values for simulators. */
-		bootinfo.sys_freq = DEFAULT_SYS_FREQ;
-	}
-}
-
-void bootstrap(void)
-{
-	version_print();
-
-	printf("Boot loader: %p -> %p\n", loader_start, loader_end);
-	printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo);
-	printf(" %p|%p: kernel entry point\n",
-	    (void *) KERNEL_ADDRESS, (void *) KERNEL_ADDRESS);
-	printf(" %p|%p: loader entry point\n",
-	    (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS);
-
-	read_efi_memmap();
-	read_sal_configuration();
-	read_pal_configuration();
-
-	uint8_t *kernel_start = (uint8_t *) KERNEL_ADDRESS;
-	uint8_t *ram_end = NULL;
-
-	/* Find the end of the memory area occupied by the kernel. */
-	for (unsigned i = 0; i < bootinfo.memmap_items; i++) {
-		memmap_item_t m = bootinfo.memmap[i];
-		if (m.type == MEMMAP_FREE_MEM &&
-		    m.base <= (uintptr_t) kernel_start &&
-		    m.base + m.size > (uintptr_t) kernel_start) {
-			ram_end = (uint8_t *) (m.base + m.size);
-		}
-	}
-
-	if (ram_end == NULL) {
-		printf("Memory map doesn't contain usable area at kernel's address.\n");
-		halt();
-	}
-
-	// FIXME: Correct kernel's logical address.
-	extract_payload(&bootinfo.taskmap, kernel_start, ram_end,
-	    (uintptr_t) kernel_start, NULL);
-
-	uintptr_t entry = check_kernel(kernel_start);
-
-	// FIXME: kernel's entry point is linked at a different address than
-	//        where it is run from.
-	entry = entry - KERNEL_VADDRESS + KERNEL_ADDRESS;
-
-	printf("Booting the kernel at %p...\n", (void *) entry);
-	jump_to_kernel(&bootinfo, (void *) entry);
-}
Index: ot/arch/ia64/src/pal.c
===================================================================
--- boot/arch/ia64/src/pal.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/pal.h>
-#include <arch/types.h>
-
-uint64_t pal_proc = 0;
-
-uint64_t pal_proc_freq_ratio(void)
-{
-	uint64_t proc_ratio;
-
-	pal_static_call_0_1(PAL_FREQ_RATIOS, &proc_ratio);
-
-	return proc_ratio;
-}
Index: ot/arch/ia64/src/pal_asm.S
===================================================================
--- boot/arch/ia64/src/pal_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-#
-# Copyright (c) 2011 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.explicit
-
-FUNCTION_BEGIN(pal_static_call)
-	alloc loc0 = ar.pfs, 7, 6, 0, 0
-
-	mov loc1 = psr ;;
-	mov psr.l = r0 ;;
-	srlz.i
-	srlz.d
-
-	mov loc2 = gp
-	mov loc3 = rp
-
-	addl loc4 = @gprel(pal_proc), gp
-
-	mov r28 = in0
-	mov r29 = in1
-	mov r30 = in2
-	mov r31 = in3 ;;
-
-	ld8 loc4 = [loc4]
-	movl loc5 = 0f ;;
-
-	mov b6 = loc4
-	mov rp = loc5 ;;
-	br.cond.sptk.many b6
-
-0:
-	mov psr.l = loc1 ;;
-	srlz.i
-	srlz.d
-
-	cmp.ne p7,p0 = 0, in4
-	cmp.ne p8,p0 = 0, in5
-	cmp.ne p9,p0 = 0, in6 ;;
-
-(p7)	st8 [in4] = r9
-(p8)	st8 [in5] = r10
-(p9)	st8 [in6] = r11
-
-	mov gp = loc2
-	mov rp = loc3 ;;
-
-	mov ar.pfs = loc0
-	br.ret.sptk.many rp
-FUNCTION_END(pal_static_call)
-
Index: ot/arch/ia64/src/putchar.c
===================================================================
--- boot/arch/ia64/src/putchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/arch.h>
-#include <putchar.h>
-#include <stddef.h>
-#include <str.h>
-#include <arch/ski.h>
-
-void putuchar(const char32_t ch)
-{
-#ifdef MACHINE_ski
-	if (ascii_check(ch))
-		ski_putchar(ch);
-	else
-		ski_putchar('?');
-#endif
-}
Index: ot/arch/ia64/src/sal.c
===================================================================
--- boot/arch/ia64/src/sal.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/sal.h>
-#include <arch/types.h>
-
-static sal_ap_wakeup_desc_t *sal_ap_wakeup;
-
-extern uint64_t pal_proc;
-
-uint64_t sal_proc = 0;
-uint64_t sal_proc_gp = 0;
-
-void sal_system_table_parse(sal_system_table_header_t *sst)
-{
-	uint8_t *cur = (uint8_t *) &sst[1];
-	uint16_t entry;
-
-	for (entry = 0; entry < sst->entry_count; entry++) {
-		switch ((sal_sst_type_t) *cur) {
-		case SSTT_ENTRYPOINT_DESC:
-			pal_proc = ((sal_entrypoint_desc_t *) cur)->pal_proc;
-			sal_proc = ((sal_entrypoint_desc_t *) cur)->sal_proc;
-			sal_proc_gp = ((sal_entrypoint_desc_t *) cur)->sal_proc_gp;
-			cur += sizeof(sal_entrypoint_desc_t);
-			break;
-		case SSTT_MEMORY_DESC:
-			cur += sizeof(sal_memory_desc_t);
-			break;
-		case SSTT_PLATFORM_FEATURES_DESC:
-			cur += sizeof(sal_platform_features_desc_t);
-			break;
-		case SSTT_TR_DESC:
-			cur += sizeof(sal_tr_desc_t);
-			break;
-		case SSTT_PTC_COHERENCE_DOMAIN_DESC:
-			cur += sizeof(sal_ptc_coherence_domain_desc_t);
-			break;
-		case SSTT_AP_WAKEUP_DESC:
-			sal_ap_wakeup = (sal_ap_wakeup_desc_t *) cur;
-			cur += sizeof(sal_ap_wakeup_desc_t);
-			break;
-		default:
-			return;
-		}
-	}
-}
-
-uint64_t sal_base_clock_frequency(void)
-{
-	uint64_t freq;
-
-	sal_call_1_1(SAL_FREQ_BASE, 0, &freq);
-
-	return freq;
-}
Index: ot/arch/ia64/src/sal_asm.S
===================================================================
--- boot/arch/ia64/src/sal_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-#
-# Copyright (c) 2011 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.explicit
-
-#define STACK_SCRATCH_AREA	16
-#define STACK_IN8		(0 + STACK_SCRATCH_AREA)
-#define STACK_IN9		(8 + STACK_SCRATCH_AREA)
-#define STACK_IN10		(16 + STACK_SCRATCH_AREA)
-
-#
-# Assume the following PSR bits are already 0, as expected by SAL:
-#
-#  be, cpl, is, da, dd, ss, ri, ed, ia
-#
-# Assume PSR.bn is 1, as expected by SAL.
-#
-FUNCTION_BEGIN(sal_call)
-	alloc loc0 = ar.pfs, 8, 8, 8, 0
-
-	adds sp = -STACK_SCRATCH_AREA, sp
-
-	mov loc1 = gp
-	mov loc2 = rp
-
-	addl loc3 = @gprel(sal_proc), gp
-	addl loc4 = @gprel(sal_proc_gp), gp
-
-	mov out0 = in0
-	mov out1 = in1
-	mov out2 = in2
-	mov out3 = in3
-	mov out4 = in4
-	mov out5 = in5
-	mov out6 = in6
-	mov out7 = in7 ;;
-
-	ld8 loc3 = [loc3]
-	ld8 gp = [loc4]
-
-	adds r14 = STACK_IN8 + STACK_SCRATCH_AREA, sp
-	adds r15 = STACK_IN9 + STACK_SCRATCH_AREA, sp
-	adds r16 = STACK_IN10 + STACK_SCRATCH_AREA, sp ;;
-
-	ld8 loc5 = [r14]
-	ld8 loc6 = [r15]
-	ld8 loc7 = [r16]
-
-	mov b6 = loc3 ;;
-	br.call.sptk.many rp = b6
-
-	cmp.ne p7,p0 = 0, loc5
-	cmp.ne p8,p0 = 0, loc6
-	cmp.ne p9,p0 = 0, loc7 ;;
-
-(p7)	st8 [loc5] = r9
-(p8)	st8 [loc6] = r10
-(p9)	st8 [loc7] = r11
-
-	mov gp = loc1
-	mov rp = loc2
-
-	adds sp = STACK_SCRATCH_AREA, sp ;;
-
-	mov ar.pfs = loc0
-	br.ret.sptk.many rp
-FUNCTION_END(sal_call)
-
Index: ot/arch/ia64/src/ski.c
===================================================================
--- boot/arch/ia64/src/ski.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/ski.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-#define SKI_INIT_CONSOLE	20
-#define	SKI_PUTCHAR		31
-
-static void ski_console_init(void)
-{
-	static bool initialized = false;
-
-	if (initialized)
-		return;
-
-	asm volatile (
-	    "mov r15 = %[cmd]\n"
-	    "break 0x80000\n"
-	    :
-	    : [cmd] "i" (SKI_INIT_CONSOLE)
-	    : "r15", "r8"
-	);
-
-	initialized = true;
-}
-
-void ski_putchar(char ch)
-{
-	ski_console_init();
-
-	if (ch == '\n')
-		ski_putchar('\r');
-
-	asm volatile (
-	    "mov r15 = %[cmd]\n"
-	    "mov r32 = %[ch]\n"   /* r32 is in0 */
-	    "break 0x80000\n"     /* modifies r8 */
-	    :
-	    : [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch)
-	    : "r15", "in0", "r8"
-	);
-}
Index: ot/arch/mips32/_link.ld.in
===================================================================
--- boot/arch/mips32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-ENTRY(start)
-
-SECTIONS {
-#if defined(MACHINE_msim)
-	. = 0xbfc00000;
-#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	. = 0x80103000;
-#endif
-	.text : {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-	}
-	.data : {
-		*(.data .data.*);       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.reginfo);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.gnu.*);
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note);
-	}
-}
Index: ot/arch/mips32/include/arch/arch.h
===================================================================
--- boot/arch/mips32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_ARCH_H_
-#define BOOT_mips32_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#if defined(MACHINE_msim)
-#define CPUMAP_OFFSET    0x00001000
-#define STACK_OFFSET     0x00002000
-#define BOOTINFO_OFFSET  0x00003000
-#define BOOT_OFFSET      0x00100000
-#define LOADER_OFFSET    0x1fc00000
-
-#define MSIM_VIDEORAM_ADDRESS  0xb0000000
-#define MSIM_DORDER_ADDRESS    0xb0000100
-#endif
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-#define CPUMAP_OFFSET    0x00100000
-#define STACK_OFFSET     0x00101000
-#define BOOTINFO_OFFSET  0x00102000
-#define BOOT_OFFSET      0x00200000
-#define LOADER_OFFSET    0x00103000
-
-#define YAMON_SUBR_BASE		PA2KA(0x1fc00500)
-#define YAMON_SUBR_PRINT_COUNT	(YAMON_SUBR_BASE + 0x4)
-#endif
-
-#ifndef __ASSEMBLER__
-#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
-#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
-#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
-#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
-#else
-#define PA2KA(addr)    ((addr) + 0x80000000)
-#define KSEG2PA(addr)  ((addr) - 0xa0000000)
-#endif
-
-#endif
Index: ot/arch/mips32/include/arch/asm.h
===================================================================
--- boot/arch/mips32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_ASM_H_
-#define BOOT_mips32_ASM_H_
-
-extern void jump_to_kernel(void *, void *) __attribute__((noreturn));
-
-#endif
Index: ot/arch/mips32/include/arch/main.h
===================================================================
--- boot/arch/mips32/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_MAIN_H_
-#define BOOT_mips32_MAIN_H_
-
-extern void bootstrap(int, char **);
-
-#endif
Index: ot/arch/mips32/include/arch/regname.h
===================================================================
--- boot/arch/mips32/include/arch/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_REGNAME_H_
-#define BOOT_mips32_REGNAME_H_
-
-#define zero    0
-#define at      1
-#define v0      2
-#define v1      3
-#define a0      4
-#define a1      5
-#define a2      6
-#define a3      7
-#define t0      8
-#define t1      9
-#define t2      10
-#define t3      11
-#define t4      12
-#define t5      13
-#define t6      14
-#define t7      15
-#define s0      16
-#define s1      17
-#define s2      18
-#define s3      19
-#define s4      20
-#define s5      21
-#define s6      22
-#define s7      23
-#define t8      24
-#define t9      25
-#define k0      26
-#define k1      27
-#define gp      28
-#define sp      29
-#define s8      30
-#define ra      31
-
-#define rindex    0
-#define rrandom   1
-#define entrylo0  2
-#define entrylo1  3
-#define context   4
-#define pagemask  5
-#define wired     6
-#define badvaddr  8
-#define count     9
-#define entryhi   10
-#define compare   11
-#define status    12
-#define cause     13
-#define epc       14
-#define rconfig   16
-#define lladdr    17
-#define watchlo   18
-#define watchhi   19
-#define xcontext  20
-#define rdebug    23
-#define depc      24
-#define eepc      30
-
-#endif
Index: ot/arch/mips32/include/arch/types.h
===================================================================
--- boot/arch/mips32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_TYPES_H_
-#define BOOT_mips32_TYPES_H_
-
-#include <_bits/all.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define CPUMAP_MAX_RECORDS         32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-#define BOOTINFO_BOOTARGS_BUFLEN   256
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	uint32_t sdram_size;
-#endif
-	uint32_t cpumap;
-	taskmap_t taskmap;
-	char bootargs[BOOTINFO_BOOTARGS_BUFLEN];
-} bootinfo_t;
-
-#endif
Index: ot/arch/mips32/meson.build
===================================================================
--- boot/arch/mips32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-POSTBUILD = 'raw'
-POST_OUTPUT = 'image.boot'
-
-if MACHINE == 'msim'
-	boot_image_format = 'binary'
-elif MACHINE == 'lmalta' or MACHINE == 'bmalta'
-	boot_image_format = 'elf'
-endif
-
-
-boot_src = files(
-	'src/asm.S',
-	'src/main.c',
-	'src/putchar.c',
-	'../../../common/stdc/mem.c',
-	'../../genarch/src/division.c',
-	'../../genarch/src/multiplication.c',
-	'../../../common/printf/printf_core.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
Index: ot/arch/mips32/src/asm.S
===================================================================
--- boot/arch/mips32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/regname.h>
-
-.set noat
-.set noreorder
-
-.section BOOTSTRAP
-
-/*
- * Registers on entry:
- *
- *   a0: kernel argument count (kargc)
- *   a1: kernel argument vector (kargv) of kargc elements
- *   a2: unused here (kenvp on Malta)
- *   a3: RAM size on Malta
- *
- * This is the case on Malta.
- * msim clears these registers, so it is de facto correct as well.
- */
-SYMBOL(start)
-	/*
-	 * Setup the CP0 configuration
-	 *  - Disable 64-bit kernel addressing mode
-	 *  - Disable 64-bit supervisor adressing mode
-	 *  - Disable 64-bit user addressing mode
-	 */
-	mfc0 $t0, $status
-	la $t1, 0xffffff1f
-	and $t0, $t1, $t0
-	mtc0 $t0, $status
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	/*
-	 * Remember the size of the SDRAM in bootinfo.
-	 */
-	la $t0, PA2KA(BOOTINFO_OFFSET)
-	sw $a3, 0($t0)
-#endif
-
-	/*
-	 * Setup CPU map (on msim this code
-	 * is executed in parallel on all CPUs,
-	 * but it not an issue).
-	 */
-	la $t0, PA2KA(CPUMAP_OFFSET)
-
-	sw $zero, 0($t0)
-	sw $zero, 4($t0)
-	sw $zero, 8($t0)
-	sw $zero, 12($t0)
-
-	sw $zero, 16($t0)
-	sw $zero, 20($t0)
-	sw $zero, 24($t0)
-	sw $zero, 28($t0)
-
-	sw $zero, 32($t0)
-	sw $zero, 36($t0)
-	sw $zero, 40($t0)
-	sw $zero, 44($t0)
-
-	sw $zero, 48($t0)
-	sw $zero, 52($t0)
-	sw $zero, 56($t0)
-	sw $zero, 60($t0)
-
-	sw $zero, 64($t0)
-	sw $zero, 68($t0)
-	sw $zero, 72($t0)
-	sw $zero, 76($t0)
-
-	sw $zero, 80($t0)
-	sw $zero, 84($t0)
-	sw $zero, 88($t0)
-	sw $zero, 92($t0)
-
-	sw $zero, 96($t0)
-	sw $zero, 100($t0)
-	sw $zero, 104($t0)
-	sw $zero, 108($t0)
-
-	sw $zero, 112($t0)
-	sw $zero, 116($t0)
-	sw $zero, 120($t0)
-	sw $zero, 124($t0)
-
-	lui $t1, 1
-
-#ifdef MACHINE_msim
-
-	/* Read dorder value */
-	la $k0, MSIM_DORDER_ADDRESS
-	lw $k1, ($k0)
-
-	/*
-	 * If we are not running on BSP
-	 * then end in an infinite loop.
-	 */
-	beq $k1, $zero, bsp
-	nop
-
-	/* Record CPU presence */
-	sll $t2, $k1, 2
-	addu $t2, $t2, $t0
-	sw $t1, ($t2)
-
-	loop:
-		j loop
-		nop
-
-#endif
-
-	bsp:
-		/* Record CPU presence */
-		sw $t1, ($t0)
-
-		/* Setup initial stack */
-		la $sp, PA2KA(STACK_OFFSET)
-
-		/* a0=kargc, a1=kargv */
-		j bootstrap
-		nop
-
-.text
-
-FUNCTION_BEGIN(halt)
-	j halt
-	nop
-FUNCTION_END(halt)
-
-FUNCTION_BEGIN(jump_to_kernel)
-	j $a0
-	nop
-FUNCTION_END(jump_to_kernel)
Index: ot/arch/mips32/src/main.c
===================================================================
--- boot/arch/mips32/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/main.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/types.h>
-#include <halt.h>
-#include <printf.h>
-#include <mem.h>
-#include <version.h>
-#include <macros.h>
-#include <align.h>
-#include <str.h>
-#include <errno.h>
-#include <payload.h>
-#include <kernel.h>
-
-static bootinfo_t *bootinfo = (bootinfo_t *) PA2KA(BOOTINFO_OFFSET);
-static uint32_t *cpumap = (uint32_t *) PA2KA(CPUMAP_OFFSET);
-
-void bootstrap(int kargc, char **kargv)
-{
-	version_print();
-
-	printf("\nMemory statistics\n");
-	printf(" %p|%p: CPU map\n", (void *) PA2KA(CPUMAP_OFFSET),
-	    (void *) CPUMAP_OFFSET);
-	printf(" %p|%p: bootstrap stack\n", (void *) PA2KA(STACK_OFFSET),
-	    (void *) STACK_OFFSET);
-	printf(" %p|%p: boot info structure\n",
-	    (void *) PA2KA(BOOTINFO_OFFSET), (void *) BOOTINFO_OFFSET);
-	printf(" %p|%p: kernel entry point\n", (void *) PA2KA(BOOT_OFFSET),
-	    (void *) BOOT_OFFSET);
-	printf(" %p|%p: bootloader entry point\n",
-	    (void *) PA2KA(LOADER_OFFSET), (void *) LOADER_OFFSET);
-
-	uint8_t *kernel_start = (uint8_t *) PA2KA(BOOT_OFFSET);
-	// FIXME: Use the correct value.
-	uint8_t *ram_end = kernel_start + (1 << 24);
-
-	// TODO: Make sure that the I-cache, D-cache and memory are coherent.
-	//       (i.e. provide the clear_cache callback)
-
-	extract_payload(&bootinfo->taskmap, kernel_start, ram_end,
-	    (uintptr_t) kernel_start, NULL);
-
-	printf("Copying CPU map ... \n");
-
-	bootinfo->cpumap = 0;
-	for (int i = 0; i < CPUMAP_MAX_RECORDS; i++) {
-		if (cpumap[i] != 0)
-			bootinfo->cpumap |= (1 << i);
-	}
-
-	str_cpy(bootinfo->bootargs, sizeof(bootinfo->bootargs),
-	    (kargc > 1) ? kargv[1] : "");
-
-	uintptr_t entry = check_kernel(kernel_start);
-
-	printf("Booting the kernel...\n");
-	jump_to_kernel((void *) entry, bootinfo);
-}
Index: ot/arch/mips32/src/msim.h
===================================================================
--- boot/arch/mips32/src/msim.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_mips32_MSIM_H_
-#define BOOT_mips32_MSIM_H_
-
-extern void init(void);
-extern void halt(void);
-
-extern void *translate(void *addr);
-
-#endif
Index: ot/arch/mips32/src/putchar.c
===================================================================
--- boot/arch/mips32/src/putchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include <arch/arch.h>
-#include <putchar.h>
-#include <str.h>
-
-#ifdef PUTCHAR_ADDRESS
-#undef PUTCHAR_ADDRESS
-#endif
-
-#if defined(MACHINE_msim)
-#define _putchar(ch)	msim_putchar((ch))
-static void msim_putchar(char ch)
-{
-	*((char *) MSIM_VIDEORAM_ADDRESS) = ch;
-}
-#endif
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-#define _putchar(ch)	yamon_putchar((ch))
-typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t);
-yamon_print_count_ptr_t yamon_print_count =
-    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
-
-static void yamon_putchar(char ch)
-{
-	(*yamon_print_count)(0, &ch, 1);
-}
-#endif
-
-void putuchar(const char32_t ch)
-{
-	if (ascii_check(ch))
-		_putchar(ch);
-	else
-		_putchar('?');
-}
Index: ot/arch/ppc32/_link.ld.in
===================================================================
--- boot/arch/ppc32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-ENTRY(start)
-
-SECTIONS {
-	. = 0x08000000;
-	.text : {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-	}
-	.data : {
-		*(.data .data.*);       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.gnu.*);
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note.*);
-	}
-}
Index: ot/arch/ppc32/include/arch/arch.h
===================================================================
--- boot/arch/ppc32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_ARCH_H_
-#define BOOT_ppc32_ARCH_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define BOOT_OFFSET  0x8000
-
-#define LOADER_ADDRESS  0x08000000
-
-#ifndef __ASSEMBLER__
-#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
-#else
-#define PA2KA(addr)  ((addr) + 0x80000000)
-#endif
-
-#endif
Index: ot/arch/ppc32/include/arch/asm.h
===================================================================
--- boot/arch/ppc32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_ASM_H_
-#define BOOT_ppc32_ASM_H_
-
-#include <stddef.h>
-#include <arch/main.h>
-
-extern void jump_to_kernel(void *, void *, size_t, void *, uintptr_t)
-    __attribute__((noreturn));
-extern void real_mode(void);
-
-#endif
Index: ot/arch/ppc32/include/arch/main.h
===================================================================
--- boot/arch/ppc32/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_MAIN_H_
-#define BOOT_ppc32_MAIN_H_
-
-#include <stddef.h>
-#include <balloc.h>
-#include <genarch/ofw_tree.h>
-#include <arch/types.h>
-
-typedef struct {
-	memmap_t memmap;
-	taskmap_t taskmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/ppc32/include/arch/ofw.h
===================================================================
--- boot/arch/ppc32/include/arch/ofw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_OFWARCH_H_
-#define BOOT_ppc32_OFWARCH_H_
-
-#define OFW_ADDRESS_CELLS  1
-#define OFW_SIZE_CELLS     1
-
-#endif
Index: ot/arch/ppc32/include/arch/regname.h
===================================================================
--- boot/arch/ppc32/include/arch/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,226 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_REGNAME_H_
-#define BOOT_ppc32_REGNAME_H_
-
-/* Condition Register Bit Fields */
-#define cr0  0
-#define cr1  1
-#define cr2  2
-#define cr3  3
-#define cr4  4
-#define cr5  5
-#define cr6  6
-#define cr7  7
-
-/* General Purpose Registers (GPRs) */
-#define r0   0
-#define r1   1
-#define r2   2
-#define r3   3
-#define r4   4
-#define r5   5
-#define r6   6
-#define r7   7
-#define r8   8
-#define r9   9
-#define r10  10
-#define r11  11
-#define r12  12
-#define r13  13
-#define r14  14
-#define r15  15
-#define r16  16
-#define r17  17
-#define r18  18
-#define r19  19
-#define r20  20
-#define r21  21
-#define r22  22
-#define r23  23
-#define r24  24
-#define r25  25
-#define r26  26
-#define r27  27
-#define r28  28
-#define r29  29
-#define r30  30
-#define r31  31
-
-/* GPR Aliases */
-#define sp  1
-
-/* Floating Point Registers (FPRs) */
-#define fr0   0
-#define fr1   1
-#define fr2   2
-#define fr3   3
-#define fr4   4
-#define fr5   5
-#define fr6   6
-#define fr7   7
-#define fr8   8
-#define fr9   9
-#define fr10  10
-#define fr11  11
-#define fr12  12
-#define fr13  13
-#define fr14  14
-#define fr15  15
-#define fr16  16
-#define fr17  17
-#define fr18  18
-#define fr19  19
-#define fr20  20
-#define fr21  21
-#define fr22  22
-#define fr23  23
-#define fr24  24
-#define fr25  25
-#define fr26  26
-#define fr27  27
-#define fr28  28
-#define fr29  29
-#define fr30  30
-#define fr31  31
-
-#define vr0   0
-#define vr1   1
-#define vr2   2
-#define vr3   3
-#define vr4   4
-#define vr5   5
-#define vr6   6
-#define vr7   7
-#define vr8   8
-#define vr9   9
-#define vr10  10
-#define vr11  11
-#define vr12  12
-#define vr13  13
-#define vr14  14
-#define vr15  15
-#define vr16  16
-#define vr17  17
-#define vr18  18
-#define vr19  19
-#define vr20  20
-#define vr21  21
-#define vr22  22
-#define vr23  23
-#define vr24  24
-#define vr25  25
-#define vr26  26
-#define vr27  27
-#define vr28  28
-#define vr29  29
-#define vr30  30
-#define vr31  31
-
-#define evr0   0
-#define evr1   1
-#define evr2   2
-#define evr3   3
-#define evr4   4
-#define evr5   5
-#define evr6   6
-#define evr7   7
-#define evr8   8
-#define evr9   9
-#define evr10  10
-#define evr11  11
-#define evr12  12
-#define evr13  13
-#define evr14  14
-#define evr15  15
-#define evr16  16
-#define evr17  17
-#define evr18  18
-#define evr19  19
-#define evr20  20
-#define evr21  21
-#define evr22  22
-#define evr23  23
-#define evr24  24
-#define evr25  25
-#define evr26  26
-#define evr27  27
-#define evr28  28
-#define evr29  29
-#define evr30  30
-#define evr31  31
-
-/* Special Purpose Registers (SPRs) */
-#define xer      1
-#define lr       8
-#define ctr      9
-#define dec      22
-#define sdr1     25
-#define srr0     26
-#define srr1     27
-#define sprg0    272
-#define sprg1    273
-#define sprg2    274
-#define sprg3    275
-#define prv      287
-#define ibat0u   528
-#define ibat0l   529
-#define ibat1u   530
-#define ibat1l   531
-#define ibat2u   532
-#define ibat2l   533
-#define ibat3u   534
-#define ibat3l   535
-#define dbat0u   536
-#define dbat0l   537
-#define dbat1u   538
-#define dbat1l   539
-#define dbat2u   540
-#define dbat2l   541
-#define dbat3u   542
-#define dbat3l   543
-#define tlbmiss  980
-#define ptehi    981
-#define ptelo    982
-#define hid0     1008
-
-/* MSR bits */
-#define msr_dr  (1 << 4)
-#define msr_ir  (1 << 5)
-#define msr_pr  (1 << 14)
-#define msr_ee  (1 << 15)
-
-/* HID0 bits */
-#define hid0_sten  (1 << 24)
-#define hid0_ice   (1 << 15)
-#define hid0_dce   (1 << 14)
-#define hid0_icfi  (1 << 11)
-#define hid0_dci   (1 << 10)
-
-#endif
Index: ot/arch/ppc32/include/arch/types.h
===================================================================
--- boot/arch/ppc32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ppc32_TYPES_H_
-#define BOOT_ppc32_TYPES_H_
-
-#include <_bits/all.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-#endif
Index: ot/arch/ppc32/meson.build
===================================================================
--- boot/arch/ppc32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-POSTBUILD = 'yaboot'
-POST_OUTPUT = 'image.iso'
-boot_image_format = 'elf'
-
-boot_src = files(
-	'src/asm.S',
-	'src/main.c',
-	'src/ofw.c',
-
-	'../../../common/stdc/mem.c',
-	'../../genarch/src/ofw.c',
-	'../../genarch/src/ofw_tree.c',
-	'../../genarch/src/division.c',
-	'../../genarch/src/multiplication.c',
-	'../../generic/src/balloc.c',
-	'../../../common/printf/printf_core.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
Index: ot/arch/ppc32/src/asm.S
===================================================================
--- boot/arch/ppc32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,426 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/regname.h>
-
-.macro SMC_COHERENCY addr
-	dcbst 0, \addr
-	sync
-	icbi 0, \addr
-	sync
-	isync
-.endm
-
-.macro FLUSH_DCACHE addr
-	dcbst 0, \addr
-	sync
-	isync
-.endm
-
-.macro TLB_FLUSH reg
-	li \reg, 0
-	sync
-
-	.rept 64
-		tlbie \reg
-		addi \reg, \reg, 0x1000
-	.endr
-
-	eieio
-	tlbsync
-	sync
-.endm
-
-.macro BAT_COMPUTE base size mask lower upper
-	# less than 128 KB -> no BAT
-
-	lis \upper, 0x0002
-	cmpw \size, \upper
-	blt no_bat
-
-	# mask = total >> 18
-
-	li \upper, 18
-	srw \mask, \size, \upper
-
-	# create Block Length mask by replicating
-	# the leading logical one 14 times
-
-	li \upper, 14
-	mtctr \mask
-	li \upper, 1
-
-	0:
-		# mask = (mask >> 1) | mask
-
-		srw \lower, \mask, \upper
-		or \mask, \mask, \lower
-
-		bdnz 0b
-
-	# mask = mask & 0x07ff
-	# (BAT can map up to 256 MB)
-
-	andi. \mask, \mask, 0x07ff
-
-	# mask = (mask << 2) | 0x0002
-	# (priviledged access only)
-
-	li \upper, 2
-	slw \mask, \mask, \upper
-	ori \mask, \mask, 0x0002
-
-	lis \upper, (0x8000 + \base)
-	or \upper, \upper, \mask
-
-	lis \lower, \base
-	ori \lower, \lower, 0x0002
-.endm
-
-.section BOOTSTRAP, "ax"
-
-SYMBOL(start)
-	lis r4, ofw_cif@ha
-	addi r4, r4, ofw_cif@l
-	stw r5, 0(r4)
-
-	bl ofw_init
-	b bootstrap
-
-.text
-
-FUNCTION_BEGIN(halt)
-	b halt
-FUNCTION_END(halt)
-
-FUNCTION_BEGIN(jump_to_kernel)
-	# arguments:
-	# r3 = bootinfo (physical address)
-	# r4 = translate table (physical address)
-	# r5 = pages to translate
-	# r6 = real mode meeting point (physical address)
-	# r7 = kernel entry point (virtual address in kernel's address space)
-
-	# disable interrupts
-
-	mfmsr r31
-	rlwinm r31, r31, 0, 17, 15
-	mtmsr r31
-
-	# set real mode meeting point physical address
-
-	mtspr srr0, r6
-
-	# jump to real_mode
-
-	mfmsr r31
-	lis r30, ~0@h
-	ori r30, r30, ~(msr_ir | msr_dr | msr_ee)@l
-	and r31, r31, r30
-	mtspr srr1, r31
-
-	sync
-	isync
-	rfi
-FUNCTION_END(jump_to_kernel)
-
-SYMBOL(real_mode)
-
-	# arguments:
-	# r3 = bootinfo (physical address)
-	# r4 = translate table (physical address)
-	# r5 = pages to translate
-	# r7 = kernel entry point (virtual address in kernel's address space)
-
-	# move the images of components to the proper
-	# location using the translate table
-
-	li r31, PAGE_SIZE >> 2
-	li r30, 0
-
-	page_copy:
-
-		cmpwi r5, 0
-		beq copy_end
-
-		mtctr r31
-		lwz r29, 0(r4)
-
-		copy_loop:
-
-			lwz r28, 0(r29)
-			stw r28, 0(r30)
-
-			SMC_COHERENCY r30
-
-			addi r29, r29, 4
-			addi r30, r30, 4
-
-			bdnz copy_loop
-
-		addi r4, r4, 4
-		subi r5, r5, 1
-		b page_copy
-
-	copy_end:
-
-	# initially fill segment registers
-
-	li r31, 0
-
-	li r29, 8
-	mtctr r29
-	li r30, 0                     # ASID 0 (VSIDs 0 .. 7)
-
-	seg_fill_uspace:
-
-		mtsrin r30, r31
-		addi r30, r30, 1
-		addis r31, r31, 0x1000    # move to next SR
-
-		bdnz seg_fill_uspace
-
-	li r29, 8
-	mtctr r29
-	lis r30, 0x4000               # priviledged access only
-	ori r30, r30, 8               # ASID 0 (VSIDs 8 .. 15)
-
-	seg_fill_kernel:
-
-		mtsrin r30, r31
-		addi r30, r30, 1
-		addis r31, r31, 0x1000    # move to next SR
-
-		bdnz seg_fill_kernel
-
-	# invalidate block address translation registers
-
-	li r30, 0
-
-	mtspr ibat0u, r30
-	mtspr ibat0l, r30
-
-	mtspr ibat1u, r30
-	mtspr ibat1l, r30
-
-	mtspr ibat2u, r30
-	mtspr ibat2l, r30
-
-	mtspr ibat3u, r30
-	mtspr ibat3l, r30
-
-	mtspr dbat0u, r30
-	mtspr dbat0l, r30
-
-	mtspr dbat1u, r30
-	mtspr dbat1l, r30
-
-	mtspr dbat2u, r30
-	mtspr dbat2l, r30
-
-	mtspr dbat3u, r30
-	mtspr dbat3l, r30
-
-	# create empty Page Hash Table
-	# on top of memory, size 64 KB
-
-	lwz r31, 4(r3)                # r31 = memory size
-
-	lis r30, 65536@h
-	ori r30, r30, 65536@l         # r30 = 65536
-
-	subi r29, r30, 1              # r29 = 65535
-
-	sub r31, r31, r30
-	andc r31, r31, r29            # pht = ALIGN_DOWN(memory_size - 65536, 65536)
-
-	mtsdr1 r31
-
-	li r29, 2
-	srw r30, r30, r29             # r30 = 16384
-	li r29, 0
-
-	pht_clear:
-
-		# write zeroes
-
-		stw r29, 0(r31)
-		FLUSH_DCACHE r31
-
-		addi r31, r31, 4
-		subi r30, r30, 4
-
-		cmpwi r30, 0
-		beq clear_end
-
-		bdnz pht_clear
-
-	clear_end:
-
-	# create BAT identity mapping
-
-	lwz r31, 4(r3)                # r31 = memory size
-
-	lis r30, 268435456@h
-	ori r30, r30, 268435456@l     # r30 = 256 MB
-
-	# BAT0
-
-	# r29 = min(r31, r30)
-
-	cmpw r31, r30
-	blt bat0_r31
-
-		mr r29, r30
-		b bat0_r30
-
-	bat0_r31:
-
-		mr r29, r31
-
-	bat0_r30:
-
-	BAT_COMPUTE 0x0000 r29 r28 r27 r26
-	mtspr ibat0u, r26
-	mtspr ibat0l, r27
-
-	mtspr dbat0u, r26
-	mtspr dbat0l, r27
-
-	# BAT1
-
-	sub r31, r31, r29             # r31 = r31 - r29
-
-	# r29 = min(r31, r30)
-
-	cmpw r31, r30
-	blt bat1_r31
-
-		mr r29, r30
-		b bat1_r30
-
-	bat1_r31:
-
-		mr r29, r31
-
-	bat1_r30:
-
-	BAT_COMPUTE 0x1000 r29 r28 r27 r26
-	mtspr ibat1u, r26
-	mtspr ibat1l, r27
-
-	mtspr dbat1u, r26
-	mtspr dbat1l, r27
-
-	# BAT2
-
-	sub r31, r31, r29             # r31 = r31 - r29
-
-	# r29 = min(r31, r30)
-
-	cmpw r31, r30
-	blt bat2_r31
-
-		mr r29, r30
-		b bat2_r30
-
-	bat2_r31:
-
-		mr r29, r31
-
-	bat2_r30:
-
-	BAT_COMPUTE 0x2000 r29 r28 r27 r26
-	mtspr ibat2u, r26
-	mtspr ibat2l, r27
-
-	mtspr dbat2u, r26
-	mtspr dbat2l, r27
-
-	# BAT3
-
-	sub r31, r31, r29             # r31 = r31 - r29
-
-	# r29 = min(r31, r30)
-
-	cmpw r31, r30
-	blt bat3_r31
-
-		mr r29, r30
-		b bat3_r30
-
-	bat3_r31:
-
-		mr r29, r31
-
-	bat3_r30:
-
-	BAT_COMPUTE 0x3000 r29 r28 r27 r26
-	mtspr ibat3u, r26
-	mtspr ibat3l, r27
-
-	mtspr dbat3u, r26
-	mtspr dbat3l, r27
-
-	no_bat:
-
-	# flush TLB
-
-	TLB_FLUSH r31
-
-	# start the kernel
-	#
-	# pc = kernel's entry point (r7)
-	# r3 = bootinfo (physical address)
-	# sprg3 = physical memory size
-	# sp = 0 (enforces the usage of sprg0 as exception stack)
-
-	mtspr srr0, r7
-
-	# Clear sprg0. Kernel will set it.
-	li r31, 0
-	mtsprg0 r31
-
-	# bootinfo starts with a 64 bit integer containing
-	# the physical memory size, get the lower 4 bytes
-
-	// FIXME: unchecked magic offset
-	lwz r31, 4(r3)
-	mtsprg3 r31
-
-	li sp, 0
-
-	mfmsr r31
-	ori r31, r31, (msr_ir | msr_dr)@l
-	mtspr srr1, r31
-
-	sync
-	isync
-	rfi
Index: ot/arch/ppc32/src/main.c
===================================================================
--- boot/arch/ppc32/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/main.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/types.h>
-#include <genarch/ofw.h>
-#include <genarch/ofw_tree.h>
-#include <halt.h>
-#include <printf.h>
-#include <mem.h>
-#include <version.h>
-#include <macros.h>
-#include <align.h>
-#include <str.h>
-#include <errno.h>
-#include <payload.h>
-#include <kernel.h>
-
-#define BALLOC_MAX_SIZE  131072
-
-static bootinfo_t bootinfo;
-
-static void check_overlap(const char *dest, void *phys, size_t pages)
-{
-	if ((pages << PAGE_WIDTH) > (uintptr_t) phys) {
-		printf("Error: Image (%u pages) overlaps %s at %p, halting.\n",
-		    pages, dest, phys);
-		halt();
-	}
-}
-
-void bootstrap(void)
-{
-	version_print();
-	ofw_memmap(&bootinfo.memmap);
-
-	void *bootinfo_pa = ofw_translate(&bootinfo);
-	void *real_mode_pa = ofw_translate(&real_mode);
-	void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
-
-	printf("\nMemory statistics (total %llu MB)\n", bootinfo.memmap.total >> 20);
-	printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa);
-	printf(" %p|%p: boot info structure\n", &bootinfo, bootinfo_pa);
-	printf(" %p|%p: loader entry point\n",
-	    (void *) LOADER_ADDRESS, loader_address_pa);
-
-	size_t unpacked_size = payload_unpacked_size();
-	printf("Payload uncompressed size: %d bytes\n", unpacked_size);
-
-	if (unpacked_size >= (size_t) loader_address_pa) {
-		printf("Inflated components overlap loader area.\n");
-		printf("The boot image is too large. Halting.\n");
-		halt();
-	}
-
-	void *balloc_base;
-	void *balloc_base_pa;
-	ofw_alloc("boot allocator area", &balloc_base, &balloc_base_pa,
-	    BALLOC_MAX_SIZE, loader_address_pa);
-	printf(" %p|%p: boot allocator area\n", balloc_base, balloc_base_pa);
-
-	void *inflate_base;
-	void *inflate_base_pa;
-	ofw_alloc("inflate area", &inflate_base, &inflate_base_pa,
-	    unpacked_size, loader_address_pa);
-	printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa);
-
-	uintptr_t balloc_start = ALIGN_UP(unpacked_size, PAGE_SIZE);
-	size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE)) >>
-	    PAGE_WIDTH;
-
-	printf(" Boot allocations area: %p - %p\n", (void *) balloc_start,
-	    (void *) (pages << PAGE_WIDTH));
-
-	if ((pages << PAGE_WIDTH) >= (uintptr_t) loader_address_pa) {
-		printf("Boot allocations overlap loader area.\n");
-		printf("The boot image is too large. Halting.\n");
-		halt();
-	}
-
-	void *transtable;
-	void *transtable_pa;
-	ofw_alloc("translate table", &transtable, &transtable_pa,
-	    pages * sizeof(void *), loader_address_pa);
-	printf(" %p|%p: translate table\n", transtable, transtable_pa);
-
-	check_overlap("boot allocator area", balloc_base_pa, pages);
-	check_overlap("inflate area", inflate_base_pa, pages);
-	check_overlap("translate table", transtable_pa, pages);
-
-	/* Inflate components. */
-	extract_payload(&bootinfo.taskmap, inflate_base,
-	    inflate_base + unpacked_size, PA2KA(0), NULL);
-
-	printf("Setting up boot allocator ...\n");
-	balloc_init(&bootinfo.ballocs, balloc_base, PA2KA(balloc_start),
-	    BALLOC_MAX_SIZE);
-
-	printf("Setting up screens ...\n");
-	ofw_setup_screens();
-
-	printf("Canonizing OpenFirmware device tree ...\n");
-	bootinfo.ofw_root = ofw_tree_build();
-
-	printf("Setting up translate table ...\n");
-	for (size_t i = 0; i < pages; i++) {
-		uintptr_t off = i << PAGE_WIDTH;
-		void *phys;
-
-		if (off < balloc_start)
-			phys = ofw_translate(inflate_base + off);
-		else
-			phys = ofw_translate(balloc_base + off - balloc_start);
-
-		((void **) transtable)[i] = phys;
-	}
-
-	uintptr_t entry = check_kernel_translated(inflate_base, 0);
-
-	printf("Booting the kernel...\n");
-	jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa, entry);
-}
Index: ot/arch/ppc32/src/ofw.c
===================================================================
--- boot/arch/ppc32/src/ofw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <genarch/ofw.h>
-#include <stddef.h>
-#include <putchar.h>
-#include <str.h>
-
-typedef int (*ofw_entry_t)(ofw_args_t *args);
-
-ofw_arg_t ofw(ofw_args_t *args)
-{
-	return ((ofw_entry_t) ofw_cif)(args);
-}
-
-void putuchar(char32_t ch)
-{
-	if (ch == '\n')
-		ofw_putchar('\r');
-
-	if (ascii_check(ch))
-		ofw_putchar(ch);
-	else
-		ofw_putchar('?');
-}
Index: ot/arch/riscv64/_link.ld.in
===================================================================
--- boot/arch/riscv64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#include <arch/arch.h>
-
-ENTRY(start)
-
-SECTIONS {
-	. = PHYSMEM_START;
-
-	.text : {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-	}
-
-	. = ALIGN(0x1000);
-	.htif : {
-		htif_page = .;
-		*(.htif)
-	}
-	. = ALIGN(0x1000);
-
-	. = ALIGN(0x1000);
-	.pt : {
-		pt_page = .;
-		*(.pt)
-	}
-	. = ALIGN(0x1000);
-
-	.data : {
-		*(.data .data.*);       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.gnu.*);
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note);
-	}
-}
Index: ot/arch/riscv64/include/arch/arch.h
===================================================================
--- boot/arch/riscv64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_ARCH_H_
-#define BOOT_riscv64_ARCH_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define BOOT_STACK_SIZE  PAGE_SIZE
-
-#define PHYSMEM_START  0x40000000
-#define PHYSMEM_SIZE   1073741824
-#define BOOT_OFFSET    0x48000000
-
-#define DEFAULT_MTVEC      0x00000100
-#define TRAP_VECTOR_RESET  0x0100
-
-#endif
Index: ot/arch/riscv64/include/arch/asm.h
===================================================================
--- boot/arch/riscv64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_ASM_H_
-#define BOOT_riscv64_ASM_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-extern char htif_page[];
-extern char pt_page[];
-
-extern _Noreturn void jump_to_kernel(uintptr_t, uintptr_t);
-
-#endif
Index: ot/arch/riscv64/include/arch/main.h
===================================================================
--- boot/arch/riscv64/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_MAIN_H_
-#define BOOT_riscv64_MAIN_H_
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/riscv64/include/arch/mm.h
===================================================================
--- boot/arch/riscv64/include/arch/mm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2017 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_riscv64_MM_H_
-#define BOOT_riscv64_MM_H_
-
-#ifndef __ASSEMBLER__
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
-#else
-#define KA2PA(x)  ((x) - 0xffff800000000000)
-#define PA2KA(x)  ((x) + 0xffff800000000000)
-#endif
-
-#define PTL_DIRTY       (1 << 7)
-#define PTL_ACCESSED    (1 << 6)
-#define PTL_GLOBAL      (1 << 5)
-#define PTL_USER        (1 << 4)
-#define PTL_EXECUTABLE  (1 << 3)
-#define PTL_WRITABLE    (1 << 2)
-#define PTL_READABLE    (1 << 1)
-#define PTL_VALID       1
-
-#endif
-
-/** @}
- */
Index: ot/arch/riscv64/include/arch/types.h
===================================================================
--- boot/arch/riscv64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_TYPES_H_
-#define BOOT_riscv64_TYPES_H_
-
-#include <_bits/all.h>
-
-#define MEMMAP_MAX_RECORDS         32
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef struct {
-	volatile uint64_t *tohost;
-	volatile uint64_t *fromhost;
-} ucbinfo_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	ucbinfo_t ucbinfo;
-	uintptr_t physmem_start;
-	uintptr_t htif_frame;
-	uintptr_t pt_frame;
-	memmap_t memmap;
-	taskmap_t taskmap;
-} bootinfo_t;
-
-#endif
Index: ot/arch/riscv64/include/arch/ucb.h
===================================================================
--- boot/arch/riscv64/include/arch/ucb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_riscv64_UCB_H_
-#define BOOT_riscv64_UCB_H_
-
-/** University of California, Berkeley extensions to RISC-V
- *
- * Non-standard host-target interface extension targeting
- * primarily the Spike ISA Simulator.
- */
-
-#include <stddef.h>
-#include <stdint.h>
-
-extern volatile uint64_t tohost;
-extern volatile uint64_t fromhost;
-
-#define HTIF_DEVICE_CONSOLE  1
-
-#define HTIF_CONSOLE_PUTC  1
-
-extern void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload);
-
-#endif
Index: ot/arch/riscv64/meson.build
===================================================================
--- boot/arch/riscv64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-POSTBUILD = 'raw'
-boot_image_format = 'elf'
-POST_OUTPUT = 'image.boot'
-
-boot_src = files(
-	'src/asm.S',
-	'src/main.c',
-	'src/ucb.c',
-	'src/putchar.c',
-
-	'../../../common/stdc/mem.c',
-	'../../../common/printf/printf_core.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
Index: ot/arch/riscv64/src/asm.S
===================================================================
--- boot/arch/riscv64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/mm.h>
-
-#define MCOUNTEREN_CY_MASK  0x00000001
-#define MCOUNTEREN_TM_MASK  0x00000002
-#define MCOUNTEREN_IR_MASK  0x00000004
-
-#define MSTATUS_MPP_MASK        0x00001800
-#define MSTATUS_MPP_USER        0x00000000
-#define MSTATUS_MPP_SUPERVISOR  0x00000800
-#define MSTATUS_MPP_MACHINE     0x00001800
-
-#define MSTATUS_SUM_MASK        0x00040000
-
-#define SATP_PFN_MASK  0x00000fffffffffff
-
-#define SATP_MODE_MASK  0xf000000000000000
-#define SATP_MODE_BARE  0x0000000000000000
-#define SATP_MODE_SV39  0x8000000000000000
-#define SATP_MODE_SV48  0x9000000000000000
-
-.section BOOTSTRAP
-
-.org DEFAULT_MTVEC + TRAP_VECTOR_RESET
-SYMBOL(start)
-	/* Set up machine state */
-	li x1, 0
-	li x2, 0
-	li x3, 0
-	li x4, 0
-	li x5, 0
-	li x6, 0
-	li x7, 0
-	li x8, 0
-	li x9, 0
-	li x10, 0
-	li x11, 0
-	li x12, 0
-	li x13, 0
-	li x14, 0
-	li x15, 0
-	li x16, 0
-	li x17, 0
-	li x18, 0
-	li x19, 0
-	li x20, 0
-	li x21, 0
-	li x22, 0
-	li x23, 0
-	li x24, 0
-	li x25, 0
-	li x26, 0
-	li x27, 0
-	li x28, 0
-	li x29, 0
-	li x30, 0
-	li x31, 0
-
-	/* Set up stack, create stack frame */
-	la sp, boot_stack + BOOT_STACK_SIZE
-	addi sp, sp, -16
-
-	j bootstrap
-
-.text
-
-FUNCTION_BEGIN(jump_to_kernel)
-	/* Enable performance counters access in supervisor mode */
-	csrsi mcounteren, MCOUNTEREN_CY_MASK | MCOUNTEREN_TM_MASK | MCOUNTEREN_IR_MASK
-
-	/* Setup SV48 paging for supervisor mode */
-	la t0, ptl_0
-	srli t0, t0, 12
-
-	li t1, SATP_PFN_MASK
-	and t0, t0, t1
-
-	li t1, SATP_MODE_SV48
-	or t0, t0, t1
-
-	csrw satp, t0
-
-	/* Jump to supervisor mode */
-	csrr t0, mstatus
-
-	li t1, ~MSTATUS_MPP_MASK
-	and t0, t0, t1
-
-	/*
-	 * TODO: Enable running with Supervisor User Mode
-	 * access disabled.
-	 */
-	li t1, MSTATUS_MPP_SUPERVISOR | MSTATUS_SUM_MASK
-	or t0, t0, t1
-
-	csrw mstatus, t0
-
-	/* Entry point address is in a1. */
-	mv ra, a1
-	csrw mepc, ra
-
-	mret
-FUNCTION_END(jump_to_kernel)
-
-FUNCTION_BEGIN(halt)
-	j halt
-FUNCTION_END(halt)
-
-.data
-
-.align PAGE_WIDTH
-SYMBOL(boot_stack)
-	.space BOOT_STACK_SIZE
-
-.section .pt, "aw", @progbits
-
-.align PAGE_WIDTH
-SYMBOL(ptl_0)
-	.fill 256, 8, 0
-	/* Identity mapping for [0; 512G) */
-	.quad 0 + (PTL_DIRTY | PTL_ACCESSED | PTL_EXECUTABLE | PTL_WRITABLE | PTL_READABLE | PTL_VALID)
-	.fill 255, 8, 0
Index: ot/arch/riscv64/src/main.c
===================================================================
--- boot/arch/riscv64/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/main.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/ucb.h>
-#include <arch/mm.h>
-#include <arch/types.h>
-#include <version.h>
-#include <stddef.h>
-#include <printf.h>
-#include <macros.h>
-#include <errno.h>
-#include <align.h>
-#include <str.h>
-#include <halt.h>
-#include <payload.h>
-#include <kernel.h>
-
-static bootinfo_t bootinfo;
-
-void bootstrap(void)
-{
-	version_print();
-
-	bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH;
-	bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH;
-
-	bootinfo.ucbinfo.tohost =
-	    (volatile uint64_t *) PA2KA((uintptr_t) &tohost);
-	bootinfo.ucbinfo.fromhost =
-	    (volatile uint64_t *) PA2KA((uintptr_t) &fromhost);
-
-	// FIXME TODO: read from device tree
-	bootinfo.physmem_start = PHYSMEM_START;
-	bootinfo.memmap.total = PHYSMEM_SIZE;
-	bootinfo.memmap.cnt = 1;
-	bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START;
-	bootinfo.memmap.zones[0].size = PHYSMEM_SIZE;
-
-	printf("\nMemory statistics (total %" PRIu64 " MB, starting at %p)\n\n",
-	    bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
-	printf(" %p: boot info structure\n", &bootinfo);
-
-	uint8_t *load_addr = (uint8_t *) BOOT_OFFSET;
-	uintptr_t kernel_addr = PA2KA(load_addr);
-
-	printf(" %p: inflate area\n", load_addr);
-	printf(" %p: kernel entry point\n", (void *) kernel_addr);
-
-	/* Find the end of the memory zone containing the load address. */
-	uint8_t *end = NULL;
-	for (size_t i = 0; i < bootinfo.memmap.cnt; i++) {
-		memzone_t z = bootinfo.memmap.zones[i];
-
-		if (z.start <= (void *) load_addr &&
-		    z.start + z.size > (void *) load_addr) {
-			end = z.start + z.size;
-		}
-	}
-
-	// TODO: Cache-coherence callback?
-	extract_payload(&bootinfo.taskmap, load_addr, end, kernel_addr, NULL);
-
-	uintptr_t entry = check_kernel(load_addr);
-
-	printf("Booting the kernel...\n");
-	jump_to_kernel(PA2KA(&bootinfo), entry);
-}
Index: ot/arch/riscv64/src/putchar.c
===================================================================
--- boot/arch/riscv64/src/putchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <arch/arch.h>
-#include <putchar.h>
-#include <str.h>
-#include <arch/ucb.h>
-
-void putuchar(char32_t ch)
-{
-	if (ascii_check(ch))
-		htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, ch);
-	else
-		htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, '?');
-}
Index: ot/arch/riscv64/src/ucb.c
===================================================================
--- boot/arch/riscv64/src/ucb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/ucb.h>
-#include <arch/arch.h>
-#include <macros.h>
-
-volatile uint64_t tohost __attribute__((section(".htif")));
-volatile uint64_t fromhost __attribute__((section(".htif")));
-
-static void poll_fromhost()
-{
-	uint64_t val = fromhost;
-	if (!val)
-		return;
-
-	fromhost = 0;
-}
-
-void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
-{
-	uint64_t val = (((uint64_t) device) << 56) |
-	    (((uint64_t) cmd) << 48) |
-	    (payload & UINT64_C(0xffffffffffff));
-
-	while (tohost)
-		poll_fromhost();
-
-	tohost = val;
-}
Index: ot/arch/sparc64/_link.ld.in
===================================================================
--- boot/arch/sparc64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-ENTRY(start)
-
-SECTIONS {
-	. = 0x4000;
-	.boot : {
-		loader_start = .;
-		KEEP(*(BOOTSTRAP));
-		*(.text .text.*);
-
-		*(.data .data.*);       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		loader_end = .;
-		payload_start = .;
-		KEEP(*(.payload));
-		payload_end = .;
-	}
-
-	/DISCARD/ : {
-		*(.gnu.*);
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note.*);
-	}
-}
Index: ot/arch/sparc64/include/arch/arch.h
===================================================================
--- boot/arch/sparc64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_ARCH_H_
-#define BOOT_sparc64_ARCH_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define LOADER_ADDRESS  0x004000
-#define KERNEL_ADDRESS  0x400000
-
-#define STACK_SIZE                   8192
-#define STACK_ALIGNMENT              16
-#define STACK_BIAS                   2047
-#define STACK_WINDOW_SAVE_AREA_SIZE  (16 * 8)
-#define STACK_ARG_SAVE_AREA_SIZE     (6 * 8)
-
-#define NWINDOWS  8
-
-#define PSTATE_IE_BIT    2
-#define PSTATE_PRIV_BIT  4
-#define PSTATE_AM_BIT    8
-
-#define ASI_ICBUS_CONFIG        0x4a
-#define ICBUS_CONFIG_MID_SHIFT  17
-
-/** Constants to distinguish particular UltraSPARC architecture */
-#define ARCH_SUN4U  10
-#define ARCH_SUN4V  20
-
-/** Constants to distinguish particular UltraSPARC subarchitecture */
-#define SUBARCH_UNKNOWN  0
-#define SUBARCH_US       1
-#define SUBARCH_US3      3
-
-#define BSP_PROCESSOR  1
-#define AP_PROCESSOR   0
-
-#endif
Index: ot/arch/sparc64/include/arch/asm.h
===================================================================
--- boot/arch/sparc64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_ASM_H_
-#define BOOT_sparc64_ASM_H_
-
-#include <stdint.h>
-
-extern void jump_to_kernel(uintptr_t physmem_start, bootinfo_t *bootinfo,
-    uint8_t subarch, void *entry) __attribute__((noreturn));
-
-#endif
Index: ot/arch/sparc64/include/arch/main.h
===================================================================
--- boot/arch/sparc64/include/arch/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_MAIN_H_
-#define BOOT_sparc64_MAIN_H_
-
-#include <stdint.h>
-#include <balloc.h>
-#include <genarch/ofw_tree.h>
-#include <arch/types.h>
-
-typedef struct {
-	uintptr_t physmem_start;
-	taskmap_t taskmap;
-	memmap_t memmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern void bootstrap(void);
-
-#endif
Index: ot/arch/sparc64/include/arch/ofw.h
===================================================================
--- boot/arch/sparc64/include/arch/ofw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_OFW_H_
-#define BOOT_sparc64_OFW_H_
-
-#include <stdint.h>
-
-#define OFW_ADDRESS_CELLS  2
-#define OFW_SIZE_CELLS     2
-
-extern uintptr_t ofw_get_physmem_start(void);
-extern void ofw_cpu(uint16_t, uintptr_t);
-
-#endif
Index: ot/arch/sparc64/include/arch/types.h
===================================================================
--- boot/arch/sparc64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_sparc64_TYPES_H_
-#define BOOT_sparc64_TYPES_H_
-
-#include <_bits/all.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} task_t;
-
-typedef struct {
-	size_t cnt;
-	task_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-#endif
Index: ot/arch/sparc64/meson.build
===================================================================
--- boot/arch/sparc64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BUILD = true
-POSTBUILD = 'silo'
-POST_OUTPUT = 'image.iso'
-boot_image_format = 'elf'
-
-boot_src = files(
-	'src/asm.S',
-	'src/main.c',
-	'src/ofw.c',
-
-	'../../../common/stdc/mem.c',
-	'../../genarch/src/ofw.c',
-	'../../genarch/src/ofw_tree.c',
-	'../../generic/src/balloc.c',
-	'../../../common/printf/printf_core.c',
-	'../../generic/src/vprintf.c',
-	'../../generic/src/printf.c',
-	'../../../common/str.c',
-	'../../generic/src/version.c',
-	'../../generic/src/inflate.c',
-	'../../generic/src/gzip.c',
-	'../../generic/src/tar.c',
-	'../../generic/src/kernel.c',
-	'../../generic/src/payload.c',
-)
Index: ot/arch/sparc64/src/asm.S
===================================================================
--- boot/arch/sparc64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-
-#if defined(PROCESSOR_us) || defined(PROCESSOR_us3)
-#define ICACHE_SIZE       8192
-#define ICACHE_LINE_SIZE  32
-#define ICACHE_SET_BIT    (1 << 13)
-#define ASI_ICACHE_TAG    0x67
-#endif	/* PROCESSOR_us || PROCESSOR_us3 */
-
-.register %g2, #scratch
-.register %g3, #scratch
-.register %g6, #scratch
-.register %g7, #scratch
-
-.section BOOTSTRAP, "ax"
-
-SYMBOL(start)
-	ba %xcc, 1f
-	nop
-
-/*
- * This header forces SILO to load the image at 0x4000.
- * More precisely, SILO will think this is an old version of Linux.
- */
-.ascii "HdrS"
-.word 0
-.half 0
-.half 0
-.half 0
-.half 0
-.word 0
-.word 0
-
-.align 8
-1:
-	! Disable interrupts and disable address masking.
-
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate
-
-	wrpr %g0, NWINDOWS - 2, %cansave   ! Set maximum saveable windows
-	wrpr %g0, 0, %canrestore           ! Get rid of windows we will never need again
-	wrpr %g0, 0, %otherwin             ! Make sure the window state is consistent
-	wrpr %g0, NWINDOWS - 1, %cleanwin  ! Prevent needless clean_window traps for kernel
-
-	set initial_stack, %sp
-	add %sp, -STACK_BIAS, %sp
-
-	set ofw_cif, %l0
-
-	! Initialize OpenFirmware
-
-	call ofw_init
-	stx %o4, [%l0]
-
-	ba %xcc, bootstrap
-	nop
-
-.align STACK_ALIGNMENT
-	.space STACK_SIZE
-initial_stack:
-	.space STACK_WINDOW_SAVE_AREA_SIZE
-
-.text
-
-FUNCTION_BEGIN(halt)
-	ba %xcc, halt
-	nop
-FUNCTION_END(halt)
-
-FUNCTION_BEGIN(jump_to_kernel)
-	/*
-	 * Guarantee cache coherence:
-	 * 1. Make sure that the code we have moved has drained to main memory.
-	 * 2. Invalidate I-cache.
-	 * 3. Flush instruction pipeline.
-	 */
-
-	/*
-	 * US3 processors have a write-invalidate cache, so explicitly
-	 * invalidating it is not required. Whether to invalidate I-cache
-	 * or not is decided according to the value of the 3rd argument
-	 * (subarch).
-	 */
-	cmp %o2, SUBARCH_US3
-	be %xcc, 1f
-	nop
-
-	0:
-		call icache_flush
-		nop
-
-	1:
-		membar #StoreStore
-
-	/*
-	 * Flush the instruction pipeline.
-	 */
-	flush %i7
-
-	! Jump to kernel
-	jmp %o3
-	nop
-FUNCTION_END(jump_to_kernel)
-
-# Flush I-cache
-icache_flush:
-#if defined(PROCESSOR_us) || defined(PROCESSOR_us3)
-	set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
-	stxa %g0, [%g1] ASI_ICACHE_TAG
-
-	0:
-		membar #Sync
-		subcc %g1, ICACHE_LINE_SIZE, %g1
-		bnz,pt %xcc, 0b
-
-	stxa %g0, [%g1] ASI_ICACHE_TAG
-	membar #Sync
-	retl
-
-	! SF Erratum #51
-
-	nop
-#else
-	// TODO: sun4v
-	retl
-	nop
-#endif	/* PROCESSOR_us || PROCESSOR_us3 */
-
-FUNCTION_BEGIN(ofw)
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
-	set ofw_cif, %l0
-	ldx [%l0], %l0
-
-	rdpr %pstate, %l1
-	and %l1, ~PSTATE_AM_BIT, %l2
-	wrpr %l2, 0, %pstate
-
-	jmpl %l0, %o7
-	mov %i0, %o0
-
-	wrpr %l1, 0, %pstate
-
-	ret
-	restore %o0, 0, %o0
-FUNCTION_END(ofw)
Index: ot/arch/sparc64/src/main.c
===================================================================
--- boot/arch/sparc64/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/main.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/ofw.h>
-#include <genarch/ofw.h>
-#include <genarch/ofw_tree.h>
-#include <halt.h>
-#include <printf.h>
-#include <mem.h>
-#include <version.h>
-#include <macros.h>
-#include <align.h>
-#include <str.h>
-#include <errno.h>
-#include <payload.h>
-#include <kernel.h>
-
-/* The lowest ID (read from the VER register) of some US3 CPU model */
-#define FIRST_US3_CPU  0x14
-
-/* The greatest ID (read from the VER register) of some US3 CPU model */
-#define LAST_US3_CPU  0x19
-
-/* UltraSPARC IIIi processor implementation code */
-#define US_IIIi_CODE  0x15
-
-#define OBP_BIAS  0x400000
-
-#define BALLOC_MAX_SIZE  131072
-
-#define TOP2ADDR(top)  (((void *) KERNEL_ADDRESS) + (top))
-
-/** UltraSPARC architecture */
-static uint8_t arch;
-
-/** UltraSPARC subarchitecture */
-static uint8_t subarch;
-
-/** Mask of the MID field inside the ICBUS_CONFIG register
- *
- * Shifted by MID_SHIFT bits to the right
- *
- */
-static uint16_t mid_mask;
-
-static bootinfo_t bootinfo;
-
-/** Detect the UltraSPARC architecture
- *
- * Detection is done by inspecting the property called "compatible"
- * in the OBP root node. Currently sun4u and sun4v are supported.
- * Set global variable "arch" to the correct value.
- *
- */
-static void arch_detect(void)
-{
-	phandle root = ofw_find_device("/");
-	char compatible[OFW_TREE_PROPERTY_MAX_VALUELEN];
-
-	if (ofw_get_property(root, "compatible", compatible,
-	    OFW_TREE_PROPERTY_MAX_VALUELEN) <= 0) {
-		printf("Warning: Unable to determine architecture, assuming sun4u.\n");
-		arch = ARCH_SUN4U;
-		return;
-	}
-
-	if (str_cmp(compatible, "sun4v") != 0) {
-		/*
-		 * As not all sun4u machines have "sun4u" in their "compatible"
-		 * OBP property (e.g. Serengeti's OBP "compatible" property is
-		 * "SUNW,Serengeti"), we will by default fallback to sun4u if
-		 * an unknown value of the "compatible" property is encountered.
-		 */
-		if (str_cmp(compatible, "sun4u") != 0)
-			printf("Warning: Unknown architecture, assuming sun4u.\n");
-		arch = ARCH_SUN4U;
-	} else
-		arch = ARCH_SUN4V;
-}
-
-/** Detect the subarchitecture (US, US3) of sun4u
- *
- * Set the global variables "subarch" and "mid_mask" to
- * correct values.
- *
- */
-static void sun4u_subarch_detect(void)
-{
-	uint64_t ver;
-	asm volatile (
-	    "rdpr %%ver, %[ver]\n"
-	    : [ver] "=r" (ver)
-	);
-
-	ver = (ver << 16) >> 48;
-
-	if ((ver >= FIRST_US3_CPU) && (ver <= LAST_US3_CPU)) {
-		subarch = SUBARCH_US3;
-
-		if (ver == US_IIIi_CODE)
-			mid_mask = (1 << 5) - 1;
-		else
-			mid_mask = (1 << 10) - 1;
-
-	} else if (ver < FIRST_US3_CPU) {
-		subarch = SUBARCH_US;
-		mid_mask = (1 << 5) - 1;
-	} else {
-		printf("Warning: This CPU is not supported.");
-		subarch = SUBARCH_UNKNOWN;
-	}
-}
-
-/** Perform sun4u-specific SMP initialization.
- *
- */
-static void sun4u_smp(void)
-{
-#ifdef CONFIG_AP
-	printf("Checking for secondary processors ...\n");
-	ofw_cpu(mid_mask, bootinfo.physmem_start);
-#endif
-}
-
-/** Perform sun4v-specific fixups.
- *
- */
-static void sun4v_fixups(void)
-{
-	/*
-	 * When SILO booted, the OBP had established a virtual to physical
-	 * memory mapping. This mapping is not an identity since the
-	 * physical memory starts at non-zero address.
-	 *
-	 * However, the mapping even does not map virtual address 0
-	 * onto the starting address of the physical memory, but onto an
-	 * address which is 0x400000 (OBP_BIAS) bytes higher.
-	 *
-	 * The reason is that the OBP had already used the memory just
-	 * at the beginning of the physical memory. Thus that memory cannot
-	 * be used by SILO (nor the bootloader).
-	 *
-	 * So far, we solve it by a nasty workaround:
-	 *
-	 * We pretend that the physical memory starts 0x400000 (OBP_BIAS)
-	 * bytes further than it actually does (and hence pretend that the
-	 * physical memory is 0x400000 bytes smaller). Of course, the value
-	 * 0x400000 will most probably depend on the machine and OBP version
-	 * (the workaround works on Simics).
-	 *
-	 * A proper solution would be to inspect the "available" property
-	 * of the "/memory" node to find out which parts of memory
-	 * are used by OBP and redesign the algorithm of copying
-	 * kernel/init tasks/ramdisk from the bootable image to memory.
-	 */
-	bootinfo.physmem_start += OBP_BIAS;
-	bootinfo.memmap.zones[0].start += OBP_BIAS;
-	bootinfo.memmap.zones[0].size -= OBP_BIAS;
-	bootinfo.memmap.total -= OBP_BIAS;
-}
-
-void bootstrap(void)
-{
-	version_print();
-
-	arch_detect();
-	if (arch == ARCH_SUN4U)
-		sun4u_subarch_detect();
-	else
-		subarch = SUBARCH_UNKNOWN;
-
-	bootinfo.physmem_start = ofw_get_physmem_start();
-	ofw_memmap(&bootinfo.memmap);
-
-	if (arch == ARCH_SUN4V)
-		sun4v_fixups();
-
-	void *bootinfo_pa = ofw_translate(&bootinfo);
-	void *kernel_address_pa = ofw_translate((void *) KERNEL_ADDRESS);
-	void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS);
-
-	printf("\nMemory statistics (total %" PRIu64 " MB, starting at %p)\n",
-	    bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start);
-	printf(" %p|%p: boot info structure\n", &bootinfo, (void *) bootinfo_pa);
-	printf(" %p|%p: kernel entry point\n",
-	    (void *) KERNEL_ADDRESS, (void *) kernel_address_pa);
-	printf(" %p|%p: loader entry point\n",
-	    (void *) LOADER_ADDRESS, (void *) loader_address_pa);
-
-	/*
-	 * At this point, we claim and map the physical memory that we
-	 * are going to use. We should be safe in case of the virtual
-	 * address space because the OpenFirmware, according to its
-	 * SPARC binding, should restrict its use of virtual memory to
-	 * addresses from [0xffd00000; 0xffefffff] and [0xfe000000;
-	 * 0xfeffffff].
-	 */
-
-	size_t sz = ALIGN_UP(payload_unpacked_size(), PAGE_SIZE);
-	ofw_claim_phys((void *) (bootinfo.physmem_start + KERNEL_ADDRESS), sz);
-	ofw_map((void *) (bootinfo.physmem_start + KERNEL_ADDRESS),
-	    (void *) KERNEL_ADDRESS, sz, -1);
-
-	/* Extract components. */
-
-	// TODO: Cache-coherence callback?
-	extract_payload(&bootinfo.taskmap, (void *) KERNEL_ADDRESS,
-	    (void *) KERNEL_ADDRESS + sz, KERNEL_ADDRESS, NULL);
-
-	/*
-	 * Claim and map the physical memory for the boot allocator.
-	 * Initialize the boot allocator.
-	 */
-	printf("Setting up boot allocator ...\n");
-	void *balloc_base = (void *) KERNEL_ADDRESS + sz;
-	ofw_claim_phys(bootinfo.physmem_start + balloc_base, BALLOC_MAX_SIZE);
-	ofw_map(bootinfo.physmem_start + balloc_base, balloc_base,
-	    BALLOC_MAX_SIZE, -1);
-	balloc_init(&bootinfo.ballocs, balloc_base, (uintptr_t) balloc_base,
-	    BALLOC_MAX_SIZE);
-
-	printf("Setting up screens ...\n");
-	ofw_setup_screens();
-
-	printf("Canonizing OpenFirmware device tree ...\n");
-	bootinfo.ofw_root = ofw_tree_build();
-
-	if (arch == ARCH_SUN4U)
-		sun4u_smp();
-
-	uintptr_t entry = check_kernel((void *) KERNEL_ADDRESS);
-
-	printf("Booting the kernel ...\n");
-	jump_to_kernel(bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,
-	    subarch, (void *) entry);
-}
Index: ot/arch/sparc64/src/ofw.c
===================================================================
--- boot/arch/sparc64/src/ofw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief Architecture dependent parts of OpenFirmware interface.
- */
-
-#include <arch/arch.h>
-#include <arch/ofw.h>
-#include <genarch/ofw.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <printf.h>
-#include <halt.h>
-#include <putchar.h>
-#include <str.h>
-
-void putuchar(char32_t ch)
-{
-	if (ch == '\n')
-		ofw_putchar('\r');
-
-	if (ascii_check(ch))
-		ofw_putchar(ch);
-	else
-		ofw_putchar('?');
-}
-
-/** Start all CPUs represented by following siblings of the given node.
- *
- * Except for the current CPU.
- *
- * @param child         The first child of the OFW tree node whose children
- *                      represent CPUs to be woken up.
- * @param current_mid   MID of the current CPU, the current CPU will
- *                      (of course) not be woken up.
- * @param physmem_start Starting address of the physical memory.
- *
- * @return Number of CPUs which have the same parent node as
- *         "child".
- *
- */
-static size_t wake_cpus_in_node(phandle child, uint64_t current_mid,
-    uintptr_t physmem_start)
-{
-	size_t cpus;
-
-	for (cpus = 0; (child != 0) && (child != (phandle) -1);
-	    child = ofw_get_peer_node(child), cpus++) {
-		char type_name[OFW_TREE_PROPERTY_MAX_VALUELEN];
-
-		if (ofw_get_property(child, "device_type", type_name,
-		    OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) {
-			type_name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0;
-
-			if (str_cmp(type_name, "cpu") == 0) {
-				uint32_t mid;
-
-				/*
-				 * "upa-portid" for US, "portid" for US-III,
-				 * "cpuid" for US-IV
-				 */
-				if ((ofw_get_property(child, "upa-portid", &mid, sizeof(mid)) <= 0) &&
-				    (ofw_get_property(child, "portid", &mid, sizeof(mid)) <= 0) &&
-				    (ofw_get_property(child, "cpuid", &mid, sizeof(mid)) <= 0))
-					continue;
-
-				if (current_mid != mid) {
-					/*
-					 * Start secondary processor.
-					 */
-					(void) ofw_call("SUNW,start-cpu", 3, 1,
-					    NULL, child, KERNEL_ADDRESS,
-					    physmem_start | AP_PROCESSOR);
-				}
-			}
-		}
-	}
-
-	return cpus;
-}
-
-/** Find out the current CPU's MID and wake up all AP processors.
- *
- */
-void ofw_cpu(uint16_t mid_mask, uintptr_t physmem_start)
-{
-	/* Get the current CPU MID */
-	uint64_t current_mid;
-
-	asm volatile (
-	    "ldxa [%[zero]] %[asi], %[current_mid]\n"
-	    : [current_mid] "=r" (current_mid)
-	    : [zero] "r" (0),
-	      [asi] "i" (ASI_ICBUS_CONFIG)
-	);
-
-	current_mid >>= ICBUS_CONFIG_MID_SHIFT;
-	current_mid &= mid_mask;
-
-	/* Wake up the CPUs */
-
-	phandle cpus_parent = ofw_find_device("/ssm@0,0");
-	if ((cpus_parent == 0) || (cpus_parent == (phandle) -1))
-		cpus_parent = ofw_find_device("/");
-
-	phandle node = ofw_get_child_node(cpus_parent);
-	size_t cpus = wake_cpus_in_node(node, current_mid, physmem_start);
-
-	while ((node != 0) && (node != (phandle) -1)) {
-		char name[OFW_TREE_PROPERTY_MAX_VALUELEN];
-
-		if (ofw_get_property(node, "name", name,
-		    OFW_TREE_PROPERTY_MAX_VALUELEN) > 0) {
-			name[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = 0;
-
-			if (str_cmp(name, "cmp") == 0) {
-				phandle subnode = ofw_get_child_node(node);
-				cpus += wake_cpus_in_node(subnode,
-				    current_mid, physmem_start);
-			}
-		}
-
-		node = ofw_get_peer_node(node);
-	}
-
-	if (cpus == 0)
-		printf("Warning: Unable to get CPU properties.\n");
-}
-
-/** Get physical memory starting address.
- *
- * @return Physical memory starting address.
- *
- */
-uintptr_t ofw_get_physmem_start(void)
-{
-	uint32_t memreg[4];
-	if ((ofw_ret_t) ofw_get_property(ofw_memory, "reg", &memreg,
-	    sizeof(memreg)) <= 0) {
-		printf("Error: Unable to get physical memory starting address, halting.\n");
-		halt();
-	}
-
-	return ((((uintptr_t) memreg[0]) << 32) | memreg[1]);
-}
Index: ot/doc/doxygroups.h
===================================================================
--- boot/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,16 +1,0 @@
-/** @addtogroup boot boot
- * @brief HelenOS boot infrastructure
- */
-
-/**
- *     @addtogroup boot_generic generic
- *     @ingroup boot
- */
-
-/**    @addtogroup boot_arm32 arm32
- *     @ingroup boot
- */
-
-/**    @addtogroup boot_arm64 arm64
- *     @ingroup boot
- */
Index: ot/genarch/include/genarch/division.h
===================================================================
--- boot/genarch/include/genarch/division.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_DIVISION_H_
-#define BOOT_DIVISION_H_
-
-extern int __divsi3(int, int);
-extern long long __divdi3(long long, long long);
-
-extern unsigned int __udivsi3(unsigned int, unsigned int);
-extern unsigned long long __udivdi3(unsigned long long, unsigned long long);
-
-extern int __modsi3(int, int);
-extern long long __moddi3(long long, long long);
-
-extern unsigned int __umodsi3(unsigned int, unsigned int);
-extern unsigned long long __umoddi3(unsigned long long, unsigned long long);
-
-extern int __divmodsi3(int, int, int *);
-extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *);
-
-extern long long __divmoddi3(long long, long long, long long *);
-extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long,
-    unsigned long long *);
-
-#endif
-
-/** @}
- */
Index: ot/genarch/include/genarch/efi.h
===================================================================
--- boot/genarch/include/genarch/efi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_EFI_H_
-#define BOOT_EFI_H_
-
-#include <arch/types.h>
-
-#define EFI_SUCCESS  0
-#define EFI_ERROR(code) (((sysarg_t) 1 << (sizeof(sysarg_t) * 8 - 1)) | (code))
-#define EFI_LOAD_ERROR  EFI_ERROR(1)
-#define EFI_UNSUPPORTED  EFI_ERROR(3)
-#define EFI_BUFFER_TOO_SMALL  EFI_ERROR(5)
-
-typedef uint64_t efi_status_t;
-
-typedef struct {
-	uint64_t signature;
-	uint32_t revision;
-	uint32_t header_size;
-	uint32_t crc32;
-	uint32_t reserved;
-} efi_table_header_t;
-
-#define SAL_SYSTEM_TABLE_GUID \
-	{ \
-		{ \
-			0x32, 0x2d, 0x9d, 0xeb, 0x88, 0x2d, 0xd3, 0x11, \
-			0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d \
-		} \
-	}
-
-typedef union {
-	uint8_t bytes[16];
-	struct {
-		uint64_t low;
-		uint64_t high;
-	};
-} efi_guid_t;
-
-typedef enum {
-	EFI_ALLOCATE_ANY_PAGES,
-	EFI_ALLOCATE_MAX_ADDRESS,
-	EFI_ALLOCATE_ADDRESS
-} efi_allocate_type_t;
-
-typedef enum {
-	EFI_RESERVED,
-	EFI_LOADER_CODE,
-	EFI_LOADER_DATA,
-	EFI_BOOT_SERVICES_CODE,
-	EFI_BOOT_SERVICES_DATA,
-	EFI_RUNTIME_SERVICES_CODE,
-	EFI_RUNTIME_SERVICES_DATA,
-	EFI_CONVENTIONAL_MEMORY,
-	EFI_UNUSABLE_MEMORY,
-	EFI_ACPI_RECLAIM_MEMORY,
-	EFI_ACPI_MEMORY_NVS,
-	EFI_MEMORY_MAPPED_IO,
-	EFI_MEMORY_MAPPED_IO_PORT_SPACE,
-	EFI_PAL_CODE,
-	EFI_PERSISTENT_MEMORY
-} efi_memory_type_t;
-
-#define EFI_MEMORY_UC             UINT64_C(0x0000000000000001)
-#define EFI_MEMORY_WC             UINT64_C(0x0000000000000002)
-#define EFI_MEMORY_WT             UINT64_C(0x0000000000000004)
-#define EFI_MEMORY_WB             UINT64_C(0x0000000000000008)
-#define EFI_MEMORY_UCE            UINT64_C(0x0000000000000010)
-#define EFI_MEMORY_WP             UINT64_C(0x0000000000001000)
-#define EFI_MEMORY_RP             UINT64_C(0x0000000000002000)
-#define EFI_MEMORY_XP             UINT64_C(0x0000000000004000)
-#define EFI_MEMORY_NV             UINT64_C(0x0000000000008000)
-#define EFI_MEMORY_MORE_RELIABLE  UINT64_C(0x0000000000010000)
-#define EFI_MEMORY_RO             UINT64_C(0x0000000000020000)
-#define EFI_MEMORY_RUNTIME        UINT64_C(0x8000000000000000)
-
-typedef struct {
-	uint32_t type;
-	uint64_t phys_start;
-	uint64_t virt_start;
-	uint64_t pages;
-	uint64_t attribute;
-} efi_v1_memdesc_t;
-
-typedef struct {
-	efi_guid_t guid;
-	void *table;
-} efi_configuration_table_t;
-
-typedef struct efi_simple_text_output_protocol {
-	void *reset;
-	efi_status_t (*output_string)(struct efi_simple_text_output_protocol *,
-	    int16_t *);
-	void *test_string;
-	void *query_mode;
-	void *set_mode;
-	void *set_attribute;
-	void *clear_screen;
-	void *set_cursor_position;
-	void *enable_cursor;
-	void *mode;
-} efi_simple_text_output_protocol_t;
-
-typedef struct {
-	efi_table_header_t hdr;
-	void *raise_TPL;
-	void *restore_TPL;
-	efi_status_t (*allocate_pages)(efi_allocate_type_t, efi_memory_type_t,
-	    sysarg_t, uint64_t *);
-	efi_status_t (*free_pages)(uint64_t, sysarg_t);
-	efi_status_t (*get_memory_map)(sysarg_t *, efi_v1_memdesc_t *,
-	    sysarg_t *, sysarg_t *, uint32_t *);
-	efi_status_t (*allocate_pool)(efi_memory_type_t, sysarg_t, void **);
-	efi_status_t (*free_pool)(void *);
-	void *create_event;
-	void *set_timer;
-	void *wait_for_event;
-	void *signal_event;
-	void *close_event;
-	void *check_event;
-	void *install_protocol_interface;
-	void *reinstall_protocol_interface;
-	void *uninstall_protocol_interface;
-	void *handle_protocol;
-	void *reserved;
-	void *register_protocol_notify;
-	void *locate_handle;
-	void *locate_device_path;
-	void *install_configuration_table;
-	void *load_image;
-	void *start_image;
-	void *exit;
-	void *unload_image;
-	efi_status_t (*exit_boot_services)(void *, sysarg_t);
-	void *get_next_monotonic_count;
-	void *stall;
-	void *set_watchdog_timer;
-	void *connect_controller;
-	void *disconnect_controller;
-	void *open_protocol;
-	void *close_protocol;
-	void *open_protocol_information;
-	void *protocols_per_handle;
-	void *locate_handle_buffer;
-	void *locate_protocol;
-	void *install_multiple_protocol_interfaces;
-	void *uninstall_multiple_protocol_intefaces;
-	void *calculate_crc32;
-	void *copy_mem;
-	void *set_mem;
-	void *create_event_ex;
-} efi_boot_services_t;
-
-typedef struct {
-	efi_table_header_t hdr;
-	char *fw_vendor;
-	uint32_t fw_revision;
-	void *cons_in_handle;
-	void *cons_in;
-	void *cons_out_handle;
-	efi_simple_text_output_protocol_t *cons_out;
-	void *cons_err_handle;
-	efi_simple_text_output_protocol_t *cons_err;
-	void *runtime_services;
-	efi_boot_services_t *boot_services;
-	sysarg_t conf_table_entries;
-	efi_configuration_table_t *conf_table;
-} efi_system_table_t;
-
-#define EFI_PAGE_SIZE	4096
-
-extern void *efi_vendor_table_find(efi_system_table_t *, efi_guid_t);
-extern efi_status_t efi_get_memory_map(efi_system_table_t *, sysarg_t *,
-    efi_v1_memdesc_t **, sysarg_t *, sysarg_t *, uint32_t *);
-
-#endif
Index: ot/genarch/include/genarch/multiplication.h
===================================================================
--- boot/genarch/include/genarch/multiplication.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2009 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- */
-
-#ifndef BOOT_MULTIPLICATION_H__
-#define BOOT_MULTIPLICATION_H__
-
-/* 64 bit multiplication */
-extern long long __muldi3(long long, long long);
-
-#endif
-
-/** @}
- */
Index: ot/genarch/include/genarch/ofw.h
===================================================================
--- boot/genarch/include/genarch/ofw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_OFW_H_
-#define BOOT_OFW_H_
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <_bits/native.h>
-
-#define MEMMAP_MAX_RECORDS  32
-#define MAX_OFW_ARGS        12
-
-#define OFW_TREE_PATH_MAX_LEN           256
-#define OFW_TREE_PROPERTY_MAX_NAMELEN   32
-#define OFW_TREE_PROPERTY_MAX_VALUELEN  64
-
-typedef sysarg_t ofw_arg_t;
-typedef native_t ofw_ret_t;
-typedef uint32_t ofw_prop_t;
-typedef uint32_t ihandle;
-typedef uint32_t phandle;
-
-/** OpenFirmware command structure
- *
- */
-typedef struct {
-	ofw_arg_t service;             /**< Command name. */
-	ofw_arg_t nargs;               /**< Number of in arguments. */
-	ofw_arg_t nret;                /**< Number of out arguments. */
-	ofw_arg_t args[MAX_OFW_ARGS];  /**< List of arguments. */
-} ofw_args_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	uint32_t info;
-	uint32_t addr_hi;
-	uint32_t addr_lo;
-} pci_addr_t;
-
-typedef struct {
-	pci_addr_t addr;
-	uint32_t size_hi;
-	uint32_t size_lo;
-} pci_reg_t;
-
-extern uintptr_t ofw_cif;
-
-extern phandle ofw_chosen;
-extern ihandle ofw_stdout;
-extern phandle ofw_root;
-extern ihandle ofw_mmu;
-extern phandle ofw_memory;
-
-extern void ofw_init(void);
-
-extern void ofw_putchar(char);
-
-extern ofw_arg_t ofw_get_property(const phandle, const char *, void *,
-    const size_t);
-extern ofw_arg_t ofw_get_proplen(const phandle, const char *);
-extern ofw_arg_t ofw_next_property(const phandle, char *, char *);
-
-extern phandle ofw_get_child_node(const phandle);
-extern phandle ofw_get_peer_node(const phandle);
-extern phandle ofw_find_device(const char *);
-
-extern ofw_arg_t ofw_package_to_path(const phandle, char *, const size_t);
-
-extern ofw_arg_t ofw(ofw_args_t *);
-extern ofw_arg_t ofw_call(const char *, const size_t, const size_t, ofw_arg_t *,
-    ...);
-
-extern size_t ofw_get_address_cells(const phandle);
-extern size_t ofw_get_size_cells(const phandle);
-
-extern void *ofw_translate(const void *);
-
-extern void ofw_claim_virt(const void *, const size_t);
-extern void *ofw_claim_virt_any(const size_t, const size_t);
-
-extern void ofw_claim_phys(const void *, const size_t);
-extern void *ofw_claim_phys_any(const size_t, const size_t);
-
-extern void ofw_map(const void *, const void *, const size_t,
-    const ofw_arg_t);
-
-extern void ofw_alloc(const char *, void **, void **, const size_t, void *);
-
-extern void ofw_memmap(memmap_t *);
-extern void ofw_setup_screens(void);
-extern void ofw_quiesce(void);
-
-#endif
Index: ot/genarch/include/genarch/ofw_tree.h
===================================================================
--- boot/genarch/include/genarch/ofw_tree.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_OFW_TREE_H_
-#define BOOT_OFW_TREE_H_
-
-#include <stddef.h>
-#include <genarch/ofw.h>
-
-/** Memory representation of OpenFirmware device tree node property. */
-typedef struct {
-	char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
-	size_t size;
-	void *value;
-} ofw_tree_property_t;
-
-/** Memory representation of OpenFirmware device tree node. */
-typedef struct ofw_tree_node {
-	struct ofw_tree_node *parent;
-	struct ofw_tree_node *peer;
-	struct ofw_tree_node *child;
-
-	phandle node_handle;            /**< Old OpenFirmware node handle. */
-
-	char *da_name;                  /**< Disambigued name. */
-
-	size_t properties;              /**< Number of properties. */
-	ofw_tree_property_t *property;
-
-	void *device;                   /**< Member used solely by the kernel. */
-} ofw_tree_node_t;
-
-extern ofw_tree_node_t *ofw_tree_build(void);
-
-#endif
Index: ot/genarch/src/division.c
===================================================================
--- boot/genarch/src/division.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,226 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <genarch/division.h>
-
-#define ABSVAL(x)  ((x) > 0 ? (x) : -(x))
-#define SGN(x)     ((x) >= 0 ? 1 : 0)
-
-static unsigned int divandmod32(unsigned int a, unsigned int b,
-    unsigned int *remainder)
-{
-	unsigned int result;
-	int steps = sizeof(unsigned int) * 8;
-
-	*remainder = 0;
-	result = 0;
-
-	if (b == 0) {
-		/* FIXME: division by zero */
-		return 0;
-	}
-
-	if (a < b) {
-		*remainder = a;
-		return 0;
-	}
-
-	for (; steps > 0; steps--) {
-		/* shift one bit to remainder */
-		*remainder = ((*remainder) << 1) | ((a >> 31) & 0x1);
-		result <<= 1;
-
-		if (*remainder >= b) {
-			*remainder -= b;
-			result |= 0x1;
-		}
-		a <<= 1;
-	}
-
-	return result;
-}
-
-static unsigned long long divandmod64(unsigned long long a,
-    unsigned long long b, unsigned long long *remainder)
-{
-	unsigned long long result;
-	int steps = sizeof(unsigned long long) * 8;
-
-	*remainder = 0;
-	result = 0;
-
-	if (b == 0) {
-		/* FIXME: division by zero */
-		return 0;
-	}
-
-	if (a < b) {
-		*remainder = a;
-		return 0;
-	}
-
-	for (; steps > 0; steps--) {
-		/* shift one bit to remainder */
-		*remainder = ((*remainder) << 1) | ((a >> 63) & 0x1);
-		result <<= 1;
-
-		if (*remainder >= b) {
-			*remainder -= b;
-			result |= 0x1;
-		}
-		a <<= 1;
-	}
-
-	return result;
-}
-
-/* 32bit integer division */
-int __divsi3(int a, int b)
-{
-	unsigned int rem;
-	int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b))
-		return result;
-
-	return -result;
-}
-
-/* 64bit integer division */
-long long __divdi3(long long a, long long b)
-{
-	unsigned long long rem;
-	long long result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b))
-		return result;
-
-	return -result;
-}
-
-/* 32bit unsigned integer division */
-unsigned int __udivsi3(unsigned int a, unsigned int b)
-{
-	unsigned int rem;
-	return divandmod32(a, b, &rem);
-}
-
-/* 64bit unsigned integer division */
-unsigned long long __udivdi3(unsigned long long a, unsigned long long b)
-{
-	unsigned long long rem;
-	return divandmod64(a, b, &rem);
-}
-
-/* 32bit remainder of the signed division */
-int __modsi3(int a, int b)
-{
-	unsigned int rem;
-	divandmod32(a, b, &rem);
-
-	/* if divident is negative, remainder must be too */
-	if (!(SGN(a)))
-		return -((int) rem);
-
-	return (int) rem;
-}
-
-/* 64bit remainder of the signed division */
-long long __moddi3(long long a, long long b)
-{
-	unsigned long long rem;
-	divandmod64(a, b, &rem);
-
-	/* if divident is negative, remainder must be too */
-	if (!(SGN(a)))
-		return -((long long) rem);
-
-	return (long long) rem;
-}
-
-/* 32bit remainder of the unsigned division */
-unsigned int __umodsi3(unsigned int a, unsigned int b)
-{
-	unsigned int rem;
-	divandmod32(a, b, &rem);
-	return rem;
-}
-
-/* 64bit remainder of the unsigned division */
-unsigned long long __umoddi3(unsigned long long a, unsigned long long b)
-{
-	unsigned long long rem;
-	divandmod64(a, b, &rem);
-	return rem;
-}
-
-int __divmodsi3(int a, int b, int *c)
-{
-	unsigned int rem;
-	int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b)) {
-		*c = rem;
-		return result;
-	}
-
-	*c = -rem;
-	return -result;
-}
-
-unsigned int __udivmodsi3(unsigned int a, unsigned int b,
-    unsigned int *c)
-{
-	return divandmod32(a, b, c);
-}
-
-long long __divmoddi3(long long a, long long b, long long *c)
-{
-	unsigned long long rem;
-	long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b)) {
-		*c = rem;
-		return result;
-	}
-
-	*c = -rem;
-	return -result;
-}
-
-unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b,
-    unsigned long long *c)
-{
-	return divandmod64(a, b, c);
-}
-
-/** @}
- */
Index: ot/genarch/src/efi.c
===================================================================
--- boot/genarch/src/efi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <genarch/efi.h>
-#include <arch/types.h>
-#include <stddef.h>
-
-void *efi_vendor_table_find(efi_system_table_t *st, efi_guid_t guid)
-{
-	sysarg_t i;
-
-	for (i = 0; i < st->conf_table_entries; i++)
-		if ((st->conf_table[i].guid.low == guid.low) &&
-		    (st->conf_table[i].guid.high == guid.high))
-			return st->conf_table[i].table;
-
-	return NULL;
-}
-
-efi_status_t efi_get_memory_map(efi_system_table_t *st,
-    sysarg_t *memory_map_size, efi_v1_memdesc_t **memory_map, sysarg_t *map_key,
-    sysarg_t *descriptor_size, uint32_t *descriptor_version)
-{
-	efi_status_t status;
-
-	*memory_map_size = 8 * sizeof(**memory_map);
-
-	do {
-		/* Allocate space for the memory map. */
-		status = st->boot_services->allocate_pool(EFI_LOADER_DATA,
-		    *memory_map_size, (void **) memory_map);
-		if (status != EFI_SUCCESS)
-			return status;
-
-		/* Try to obtain the map. */
-		status = st->boot_services->get_memory_map(memory_map_size,
-		    *memory_map, map_key, descriptor_size, descriptor_version);
-		if (status == EFI_SUCCESS)
-			return status;
-
-		/* An error occurred, release the allocated memory. */
-		st->boot_services->free_pool(*memory_map);
-	} while (status == EFI_BUFFER_TOO_SMALL);
-
-	return status;
-}
Index: ot/genarch/src/multiplication.c
===================================================================
--- boot/genarch/src/multiplication.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2009 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * SW implementation of 32 and 64 bit multiplication.
- */
-
-#include <genarch/multiplication.h>
-#include <stdint.h>
-
-/** Set 1 to return INT64_MAX or INT64_MIN on overflow */
-#ifndef SOFTINT_CHECK_OF
-#define SOFTINT_CHECK_OF  0
-#endif
-
-/** Multiply two integers and return long long as result.
- *
- * This function is overflow safe.
- *
- */
-static unsigned long long mul(unsigned int a, unsigned int b)
-{
-	unsigned int a1 = a >> 16;
-	unsigned int a2 = a & UINT16_MAX;
-	unsigned int b1 = b >> 16;
-	unsigned int b2 = b & UINT16_MAX;
-
-	unsigned long long t1 = a1 * b1;
-	unsigned long long t2 = a1 * b2;
-	t2 += a2 * b1;
-	unsigned long long t3 = a2 * b2;
-
-	t3 = (((t1 << 16) + t2) << 16) + t3;
-
-	return t3;
-}
-
-/** Emulate multiplication of two 64-bit long long integers.
- *
- */
-long long __muldi3 (long long a, long long b)
-{
-	char neg = 0;
-
-	if (a < 0) {
-		neg = !neg;
-		a = -a;
-	}
-
-	if (b < 0) {
-		neg = !neg;
-		b = -b;
-	}
-
-	unsigned long long a1 = a >> 32;
-	unsigned long long b1 = b >> 32;
-
-	unsigned long long a2 = a & (UINT32_MAX);
-	unsigned long long b2 = b & (UINT32_MAX);
-
-	if (SOFTINT_CHECK_OF && (a1 != 0) && (b1 != 0)) {
-		/* Error (overflow) */
-		return (neg ? INT64_MIN : INT64_MAX);
-	}
-
-	/*
-	 * (if OF checked) a1 or b1 is zero => result fits in 64 bits,
-	 * no need to another overflow check
-	 */
-	unsigned long long t1 = mul(a1, b2) + mul(b1, a2);
-
-	if ((SOFTINT_CHECK_OF) && (t1 > UINT32_MAX)) {
-		/* Error (overflow) */
-		return (neg ? INT64_MIN : INT64_MAX);
-	}
-
-	t1 = t1 << 32;
-	unsigned long long t2 = mul(a2, b2);
-	t2 += t1;
-
-	/*
-	 * t2 & (1ull << 63) - if this bit is set in unsigned long long,
-	 * result does not fit in signed one
-	 */
-	if ((SOFTINT_CHECK_OF) && ((t2 < t1) || (t2 & (1ull << 63)))) {
-		/* Error (overflow) */
-		return (neg ? INT64_MIN : INT64_MAX);
-	}
-
-	long long result = t2;
-	if (neg)
-		result = -result;
-
-	return result;
-}
-
-/** @}
- */
Index: ot/genarch/src/ofw.c
===================================================================
--- boot/genarch/src/ofw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,519 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/arch.h>
-#include <arch/ofw.h>
-#include <genarch/ofw.h>
-#include <printf.h>
-#include <stddef.h>
-#include <str.h>
-#include <align.h>
-#include <halt.h>
-
-#define RED(i)    (((i) >> 5) & ((1 << 3) - 1))
-#define GREEN(i)  (((i) >> 3) & ((1 << 2) - 1))
-#define BLUE(i)   ((i) & ((1 << 3) - 1))
-#define CLIP(i)   ((i) <= 255 ? (i) : 255)
-
-uintptr_t ofw_cif;
-
-phandle ofw_chosen;
-ihandle ofw_stdout;
-phandle ofw_root;
-ihandle ofw_mmu;
-ihandle ofw_memory_prop;
-phandle ofw_memory;
-
-static char path[OFW_TREE_PATH_MAX_LEN + 1];
-
-static ihandle ofw_open(const char *name)
-{
-	return (ihandle) ofw_call("open", 1, 1, NULL, name);
-}
-
-void ofw_init(void)
-{
-	ofw_chosen = ofw_find_device("/chosen");
-	if (ofw_chosen == (phandle) -1)
-		halt();
-
-	if ((ofw_ret_t) ofw_get_property(ofw_chosen, "stdout", &ofw_stdout,
-	    sizeof(ofw_stdout)) <= 0)
-		ofw_stdout = 0;
-
-	ofw_root = ofw_find_device("/");
-	if (ofw_root == (phandle) -1) {
-		printf("Error: Unable to find / device, halting.\n");
-		halt();
-	}
-
-	if ((ofw_ret_t) ofw_get_property(ofw_chosen, "mmu", &ofw_mmu,
-	    sizeof(ofw_mmu)) <= 0) {
-		printf("Error: Unable to get mmu property, halting.\n");
-		halt();
-	}
-	if ((ofw_ret_t) ofw_get_property(ofw_chosen, "memory", &ofw_memory_prop,
-	    sizeof(ofw_memory_prop)) <= 0) {
-		printf("Error: Unable to get memory property, halting.\n");
-		halt();
-	}
-
-	ofw_memory = ofw_find_device("/memory");
-	if (ofw_memory == (phandle) -1) {
-		printf("Error: Unable to find /memory device, halting.\n");
-		halt();
-	}
-}
-
-/** Perform a call to OpenFirmware client interface.
- *
- * @param service String identifying the service requested.
- * @param nargs   Number of input arguments.
- * @param nret    Number of output arguments. This includes the return
- *                value.
- * @param rets    Buffer for output arguments or NULL. The buffer must
- *                accommodate nret - 1 items.
- *
- * @return Return value returned by the client interface.
- *
- */
-ofw_arg_t ofw_call(const char *service, const size_t nargs,
-    const size_t nret, ofw_arg_t *rets, ...)
-{
-	ofw_args_t args;
-	args.service = (ofw_arg_t) service;
-	args.nargs = nargs;
-	args.nret = nret;
-
-	va_list list;
-	va_start(list, rets);
-
-	size_t i;
-	for (i = 0; i < nargs; i++)
-		args.args[i] = va_arg(list, ofw_arg_t);
-
-	va_end(list);
-
-	for (i = 0; i < nret; i++)
-		args.args[i + nargs] = 0;
-
-	(void) ofw(&args);
-
-	for (i = 1; i < nret; i++)
-		rets[i - 1] = args.args[i + nargs];
-
-	return args.args[nargs];
-}
-
-phandle ofw_find_device(const char *name)
-{
-	return (phandle) ofw_call("finddevice", 1, 1, NULL, name);
-}
-
-ofw_arg_t ofw_get_property(const phandle device, const char *name, void *buf,
-    const size_t buflen)
-{
-	return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen);
-}
-
-ofw_arg_t ofw_get_proplen(const phandle device, const char *name)
-{
-	return ofw_call("getproplen", 2, 1, NULL, device, name);
-}
-
-ofw_arg_t ofw_next_property(const phandle device, char *previous, char *buf)
-{
-	return ofw_call("nextprop", 3, 1, NULL, device, previous, buf);
-}
-
-ofw_arg_t ofw_package_to_path(const phandle device, char *buf,
-    const size_t buflen)
-{
-	return ofw_call("package-to-path", 3, 1, NULL, device, buf, buflen);
-}
-
-size_t ofw_get_address_cells(const phandle device)
-{
-	ofw_prop_t ret = 1;
-
-	if ((ofw_ret_t) ofw_get_property(device, "#address-cells", &ret,
-	    sizeof(ret)) <= 0)
-		if ((ofw_ret_t) ofw_get_property(ofw_root, "#address-cells", &ret,
-		    sizeof(ret)) <= 0)
-			ret = OFW_ADDRESS_CELLS;
-
-	return (size_t) ret;
-}
-
-size_t ofw_get_size_cells(const phandle device)
-{
-	ofw_prop_t ret = 1;
-
-	if ((ofw_ret_t) ofw_get_property(device, "#size-cells", &ret,
-	    sizeof(ret)) <= 0)
-		if ((ofw_ret_t) ofw_get_property(ofw_root, "#size-cells", &ret,
-		    sizeof(ret)) <= 0)
-			ret = OFW_SIZE_CELLS;
-
-	return (size_t) ret;
-}
-
-phandle ofw_get_child_node(const phandle node)
-{
-	return (phandle) ofw_call("child", 1, 1, NULL, node);
-}
-
-phandle ofw_get_peer_node(const phandle node)
-{
-	return (phandle) ofw_call("peer", 1, 1, NULL, node);
-}
-
-void ofw_putchar(char ch)
-{
-	if (ofw_stdout == 0)
-		return;
-
-	ofw_call("write", 3, 1, NULL, ofw_stdout, &ch, 1);
-}
-
-void *ofw_translate(const void *virt)
-{
-	ofw_arg_t result[4];
-	if (ofw_call("call-method", 4, 5, result, "translate", ofw_mmu,
-	    virt, 0) != 0) {
-		printf("Error: mmu method translate failed, halting.\n");
-		halt();
-	}
-
-	if (result[0] == false) {
-		printf("Error: Unable to translate virtual address %p, halting.\n",
-		    virt);
-		halt();
-	}
-
-#ifdef __32_BITS__
-	return (void *) result[2];
-#endif
-
-#ifdef __64_BITS__
-	return (void *) ((result[2] << 32) | result[3]);
-#endif
-}
-
-static void *ofw_claim_virt_internal(const void *virt, const size_t len,
-    const size_t alignment)
-{
-	ofw_arg_t addr;
-	if ((ofw_ret_t) ofw_call("call-method", 5, 2, &addr, "claim", ofw_mmu,
-	    alignment, len, (ofw_arg_t) virt) != 0) {
-		printf("Error: mmu method claim failed, halting.\n");
-		halt();
-	}
-
-	return (void *) addr;
-}
-
-void ofw_claim_virt(const void *virt, const size_t len)
-{
-	void *addr = ofw_claim_virt_internal(virt, len, 0);
-	if (addr != virt) {
-		printf("Error: Unable to claim virtual memory %p (size %zu), halting.\n",
-		    virt, len);
-		halt();
-	}
-}
-
-void *ofw_claim_virt_any(const size_t len, const size_t alignment)
-{
-	void *addr = ofw_claim_virt_internal(NULL, len, alignment);
-
-	if (addr == NULL) {
-		printf("Error: Unable to claim %zu bytes in virtual memory, halting.\n",
-		    len);
-		halt();
-	}
-
-	return addr;
-}
-
-static void *ofw_claim_phys_internal(const void *phys, const size_t len,
-    const size_t alignment)
-{
-	/*
-	 * Note that the return value check will help
-	 * us to discover conflicts between OpenFirmware
-	 * allocations and our use of physical memory.
-	 * It is better to detect collisions here
-	 * than to cope with weird errors later.
-	 *
-	 * So this is really not to make the loader
-	 * more generic; it is here for debugging
-	 * purposes.
-	 */
-
-#ifdef __32_BITS__
-	ofw_arg_t retaddr[1];
-	if (ofw_call("call-method", 5, 2, retaddr, "claim",
-	    ofw_memory_prop, alignment, len, (ofw_arg_t) phys) != 0) {
-		printf("Error: memory method claim failed, halting.\n");
-		halt();
-	}
-
-	return (void *) retaddr[0];
-#endif
-
-#ifdef __64_BITS__
-	ofw_arg_t retaddr[2];
-	if (ofw_call("call-method", 6, 3, retaddr, "claim",
-	    ofw_memory_prop, alignment, len, ((ofw_arg_t) phys) >> 32,
-	    ((ofw_arg_t) phys) & 0xffffffff) != 0) {
-		printf("Error: memory method claim failed, halting.\n");
-		halt();
-	}
-
-	return (void *) ((retaddr[0] << 32) | retaddr[1]);
-#endif
-}
-
-void ofw_claim_phys(const void *phys, const size_t len)
-{
-	void *addr = ofw_claim_phys_internal(phys, len, 0);
-	if (addr != phys) {
-		printf("Error: Unable to claim physical memory %p (size %zu), halting.\n",
-		    phys, len);
-		halt();
-	}
-}
-
-void *ofw_claim_phys_any(const size_t len, const size_t alignment)
-{
-	void *addr = ofw_claim_phys_internal(NULL, len, alignment);
-	if (addr == NULL) {
-		printf("Error: Unable to claim %zu bytes in physical memory, halting.\n",
-		    len);
-		halt();
-	}
-
-	return addr;
-}
-
-void ofw_map(const void *phys, const void *virt, const size_t size,
-    const ofw_arg_t mode)
-{
-	ofw_arg_t phys_hi;
-	ofw_arg_t phys_lo;
-
-#ifdef __32_BITS__
-	phys_hi = (ofw_arg_t) phys;
-	phys_lo = 0;
-#endif
-
-#ifdef __64_BITS__
-	phys_hi = (ofw_arg_t) phys >> 32;
-	phys_lo = (ofw_arg_t) phys & 0xffffffff;
-#endif
-
-	ofw_arg_t ret = ofw_call("call-method", 7, 1, NULL, "map", ofw_mmu, mode,
-	    ALIGN_UP(size, PAGE_SIZE), virt, phys_hi, phys_lo);
-
-	if (ret != 0) {
-		printf("Error: Unable to map %p to %p (size %zu), halting.\n",
-		    virt, phys, size);
-		halt();
-	}
-}
-
-/** Save OpenFirmware physical memory map.
- *
- * @param map Memory map structure where the map will be saved.
- *
- */
-void ofw_memmap(memmap_t *map)
-{
-	size_t ac = ofw_get_address_cells(ofw_memory) /
-	    (sizeof(uintptr_t) / sizeof(uint32_t));
-	size_t sc = ofw_get_size_cells(ofw_memory) /
-	    (sizeof(uintptr_t) / sizeof(uint32_t));
-
-	uintptr_t buf[((ac + sc) * MEMMAP_MAX_RECORDS)];
-
-	/* The number of bytes read */
-	ofw_ret_t ret = (ofw_ret_t) ofw_get_property(ofw_memory, "reg", buf,
-	    sizeof(buf));
-	if (ret <= 0) {
-		printf("Error: Unable to get physical memory information, halting.\n");
-		halt();
-	}
-
-	size_t pos;
-	map->total = 0;
-	map->cnt = 0;
-	for (pos = 0; (pos < ret / sizeof(uintptr_t)) &&
-	    (map->cnt < MEMMAP_MAX_RECORDS); pos += ac + sc) {
-		void *start = (void *) (buf[pos + ac - 1]);
-		uintptr_t size = buf[pos + ac + sc - 1];
-
-		/*
-		 * This is a hot fix of the issue which occurs on machines
-		 * where there are holes in the physical memory (such as
-		 * SunBlade 1500). Should we detect a hole in the physical
-		 * memory, we will ignore any memory detected behind
-		 * the hole and pretend the hole does not exist.
-		 */
-		if ((map->cnt > 0) && (map->zones[map->cnt - 1].start +
-		    map->zones[map->cnt - 1].size < start))
-			break;
-
-		if (size > 0) {
-			map->zones[map->cnt].start = start;
-			map->zones[map->cnt].size = size;
-			map->cnt++;
-			map->total += size;
-		}
-	}
-
-	if (map->total == 0) {
-		printf("Error: No physical memory detected, halting.\n");
-		halt();
-	}
-}
-
-/** Allocate physical and virtual memory area and map it
- *
- * The allocated memory is always page-aligned.
- *
- * @param name    Description of the memory area.
- * @param base    Virtual memory area address.
- * @param base_pa Physical memory area address.
- * @param size    Requested size in bytes.
- * @param min_pa  Minimal allowed physical address.
- *
- */
-void ofw_alloc(const char *name, void **base, void **base_pa, const size_t size,
-    void *min_pa)
-{
-	do {
-		*base_pa = ofw_claim_phys_any(size, PAGE_SIZE);
-	} while (*base_pa <= min_pa);
-
-	*base = ofw_claim_virt_any(size, PAGE_SIZE);
-	ofw_map(*base_pa, *base, ALIGN_UP(size, PAGE_SIZE), (ofw_arg_t) -1);
-}
-
-static void ofw_setup_screen(phandle handle)
-{
-	/* Check for device type */
-	char device_type[OFW_TREE_PROPERTY_MAX_VALUELEN];
-	if ((ofw_ret_t) ofw_get_property(handle, "device_type", device_type,
-	    OFW_TREE_PROPERTY_MAX_VALUELEN) <= 0)
-		return;
-
-	device_type[OFW_TREE_PROPERTY_MAX_VALUELEN - 1] = '\0';
-	if (str_cmp(device_type, "display") != 0)
-		return;
-
-	/* Check for 8 bit depth */
-	ofw_prop_t depth;
-	if ((ofw_ret_t) ofw_get_property(handle, "depth", &depth,
-	    sizeof(depth)) <= 0)
-		depth = 0;
-
-	/* Get device path */
-	ofw_arg_t len = ofw_package_to_path(handle, path, OFW_TREE_PATH_MAX_LEN);
-	if (len == (ofw_arg_t) -1)
-		return;
-
-	path[len] = '\0';
-
-	/* Open the display to initialize it */
-	ihandle screen = ofw_open(path);
-	if (screen == (ihandle) -1)
-		return;
-
-	if (depth == 8) {
-		/* Setup the palette so that the (inverted) 3:2:3 scheme is usable */
-		size_t i;
-		for (i = 0; i < 256; i++) {
-			ofw_call("call-method", 6, 1, NULL, "color!", screen,
-			    255 - i, CLIP(BLUE(i) * 37), GREEN(i) * 85, CLIP(RED(i) * 37));
-		}
-	}
-}
-
-static void ofw_setup_screens_internal(phandle current)
-{
-	while ((current != 0) && (current != (phandle) -1)) {
-		ofw_setup_screen(current);
-
-		/*
-		 * Recursively process the potential child node.
-		 */
-		phandle child = ofw_get_child_node(current);
-		if ((child != 0) && (child != (phandle) -1))
-			ofw_setup_screens_internal(child);
-
-		/*
-		 * Iteratively process the next peer node.
-		 * Note that recursion is a bad idea here.
-		 * Due to the topology of the OpenFirmware device tree,
-		 * the nesting of peer nodes could be to wide and the
-		 * risk of overflowing the stack is too real.
-		 */
-		phandle peer = ofw_get_peer_node(current);
-		if ((peer != 0) && (peer != (phandle) -1)) {
-			current = peer;
-			/*
-			 * Process the peer in next iteration.
-			 */
-			continue;
-		}
-
-		/*
-		 * No more peers on this level.
-		 */
-		break;
-	}
-}
-
-/** Setup all screens which can be detected.
- *
- * Open all screens which can be detected and set up the palette for the 8-bit
- * color depth configuration so that the 3:2:3 color scheme can be used.
- * Check that setting the palette makes sense (the color depth is not greater
- * than 8).
- *
- */
-void ofw_setup_screens(void)
-{
-	ofw_setup_screens_internal(ofw_root);
-}
-
-void ofw_quiesce(void)
-{
-	ofw_call("quiesce", 0, 0, NULL);
-}
Index: ot/genarch/src/ofw_tree.c
===================================================================
--- boot/genarch/src/ofw_tree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <genarch/ofw_tree.h>
-#include <genarch/ofw.h>
-#include <arch/ofw.h>
-#include <stddef.h>
-#include <str.h>
-#include <balloc.h>
-#include <mem.h>
-
-static char path[OFW_TREE_PATH_MAX_LEN + 1];
-static char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
-static char name2[OFW_TREE_PROPERTY_MAX_NAMELEN];
-
-static ofw_tree_node_t *ofw_tree_node_alloc(void)
-{
-	return balloc(sizeof(ofw_tree_node_t), sizeof(ofw_tree_node_t));
-}
-
-static ofw_tree_property_t *ofw_tree_properties_alloc(size_t count)
-{
-	return balloc(count * sizeof(ofw_tree_property_t),
-	    sizeof(ofw_tree_property_t));
-}
-
-static void *ofw_tree_space_alloc(size_t size)
-{
-	/*
-	 * What we do here is a nasty hack :-)
-	 * Problem: string property values that are allocated via this
-	 * function typically do not contain the trailing '\0'. This
-	 * is very uncomfortable for kernel, which is supposed to deal
-	 * with the properties.
-	 * Solution: when allocating space via this function, we always
-	 * allocate space for the extra '\0' character that we store
-	 * behind the requested memory.
-	 */
-	char *addr = balloc(size + 1, 4);
-	if (addr)
-		addr[size] = '\0';
-
-	return addr;
-}
-
-/** Transfer information from one OpenFirmware node into its memory
- * representation.
- *
- * Transfer entire information from the OpenFirmware device tree 'current' node
- * to its memory representation in 'current_node'. This function recursively
- * processes all node's children. Node's peers are processed iteratively in
- * order to prevent stack from overflowing.
- *
- * @param current_node Pointer to uninitialized ofw_tree_node structure that
- *                     will become the memory represenation of 'current'.
- * @param parent_node  Parent ofw_tree_node structure or NULL in case of root
- *                     node.
- * @param current      OpenFirmware phandle to the current device tree node.
- *
- */
-static void ofw_tree_node_process(ofw_tree_node_t *current_node,
-    ofw_tree_node_t *parent_node, phandle current)
-{
-	while (current_node) {
-		/*
-		 * Initialize node.
-		 */
-		current_node->parent = (ofw_tree_node_t *) balloc_rebase(parent_node);
-		current_node->peer = NULL;
-		current_node->child = NULL;
-		current_node->node_handle = current;
-		current_node->properties = 0;
-		current_node->property = NULL;
-		current_node->device = NULL;
-
-		/*
-		 * Get the disambigued name.
-		 */
-		size_t len = ofw_package_to_path(current, path, OFW_TREE_PATH_MAX_LEN);
-		if (len == (size_t) -1)
-			return;
-
-		path[len] = '\0';
-
-		/* Find last slash */
-		size_t i;
-		i = len;
-		while (i > 0 && path[i - 1] != '/')
-			i--;
-
-		/* Do not include the slash */
-		len -= i;
-
-		/* Add space for trailing '\0' */
-		char *da_name = ofw_tree_space_alloc(len + 1);
-		if (!da_name)
-			return;
-
-		memcpy(da_name, &path[i], len);
-		da_name[len] = '\0';
-		current_node->da_name = (char *) balloc_rebase(da_name);
-
-		/*
-		 * Recursively process the potential child node.
-		 */
-		phandle child = ofw_get_child_node(current);
-		if ((child != 0) && (child != (phandle) -1)) {
-			ofw_tree_node_t *child_node = ofw_tree_node_alloc();
-			if (child_node) {
-				ofw_tree_node_process(child_node, current_node,
-				    child);
-				current_node->child =
-				    (ofw_tree_node_t *) balloc_rebase(child_node);
-			}
-		}
-
-		/*
-		 * Count properties.
-		 */
-		name[0] = '\0';
-		while (ofw_next_property(current, name, name2) == 1) {
-			current_node->properties++;
-			memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN);
-		}
-
-		if (!current_node->properties)
-			return;
-
-		/*
-		 * Copy properties.
-		 */
-		ofw_tree_property_t *property =
-		    ofw_tree_properties_alloc(current_node->properties);
-		if (!property)
-			return;
-
-		name[0] = '\0';
-		for (i = 0; ofw_next_property(current, name, name2) == 1; i++) {
-			if (i == current_node->properties)
-				break;
-
-			memcpy(name, name2, OFW_TREE_PROPERTY_MAX_NAMELEN);
-			memcpy(property[i].name, name, OFW_TREE_PROPERTY_MAX_NAMELEN);
-			property[i].name[OFW_TREE_PROPERTY_MAX_NAMELEN - 1] = '\0';
-
-			size_t size = ofw_get_proplen(current, name);
-			property[i].size = size;
-
-			if (size) {
-				void *buf = ofw_tree_space_alloc(size);
-				if (buf) {
-					/*
-					 * Copy property value to memory node.
-					 */
-					(void) ofw_get_property(current, name, buf, size);
-					property[i].value = balloc_rebase(buf);
-				}
-			} else
-				property[i].value = NULL;
-		}
-
-		/* Just in case we ran out of memory. */
-		current_node->properties = i;
-		current_node->property = (ofw_tree_property_t *) balloc_rebase(property);
-
-		/*
-		 * Iteratively process the next peer node.
-		 * Note that recursion is a bad idea here.
-		 * Due to the topology of the OpenFirmware device tree,
-		 * the nesting of peer nodes could be to wide and the
-		 * risk of overflowing the stack is too real.
-		 */
-		phandle peer = ofw_get_peer_node(current);
-		if ((peer != 0) && (peer != (phandle) -1)) {
-			ofw_tree_node_t *peer_node = ofw_tree_node_alloc();
-			if (peer_node) {
-				current_node->peer = (ofw_tree_node_t *) balloc_rebase(peer_node);
-				current_node = peer_node;
-				current = peer;
-				/*
-				 * Process the peer in next iteration.
-				 */
-				continue;
-			}
-		}
-
-		/*
-		 * No more peers on this level.
-		 */
-		break;
-	}
-}
-
-/** Construct memory representation of OpenFirmware device tree.
- *
- * @return NULL on failure or kernel pointer to the root node.
- *
- */
-ofw_tree_node_t *ofw_tree_build(void)
-{
-	ofw_tree_node_t *root = ofw_tree_node_alloc();
-	if (root)
-		ofw_tree_node_process(root, NULL, ofw_root);
-
-	/*
-	 * The firmware client interface does not automatically include the
-	 * "ssm" node in the list of children of "/". A nasty yet working
-	 * solution is to explicitly stick "ssm" to the OFW tree.
-	 */
-	phandle ssm_node = ofw_find_device("/ssm@0,0");
-	if (ssm_node != (phandle) -1) {
-		ofw_tree_node_t *ssm = ofw_tree_node_alloc();
-		if (ssm) {
-			ofw_tree_node_process(ssm, root,
-			    ofw_find_device("/ssm@0,0"));
-			ssm->peer = root->child;
-			root->child = (ofw_tree_node_t *) balloc_rebase(ssm);
-		}
-	}
-
-	return (ofw_tree_node_t *) balloc_rebase(root);
-}
Index: ot/generic/include/align.h
===================================================================
--- boot/generic/include/align.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief Macros for making values and addresses aligned.
- */
-
-#ifndef BOOT_ALIGN_H_
-#define BOOT_ALIGN_H_
-
-/** Align to the nearest lower address.
- *
- * @param s Address or size to be aligned.
- * @param a Size of alignment, must be power of 2.
- */
-#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
-
-/** Align to the nearest higher address.
- *
- * @param s Address or size to be aligned.
- * @param a Size of alignment, must be power of 2.
- */
-#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((a) - 1))
-
-/** Check alignment.
- *
- * @param s Address or size to be checked for alignment.
- * @param a Size of alignment, must be a power of 2.
- */
-#define IS_ALIGNED(s, a)  (ALIGN_UP((s), (a)) == (s))
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/assert.h
===================================================================
--- boot/generic/include/assert.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ASSERT_H_
-#define BOOT_ASSERT_H_
-
-#define assert(expr) ((void) (expr))
-
-#endif /* BOOT_ASSERT_H_ */
Index: ot/generic/include/balloc.h
===================================================================
--- boot/generic/include/balloc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_BALLOC_H_
-#define BOOT_BALLOC_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t base;
-	size_t size;
-} ballocs_t;
-
-extern void balloc_init(ballocs_t *, void *, uintptr_t, size_t);
-extern void *balloc(size_t, size_t);
-extern void *balloc_rebase(void *);
-
-#endif
Index: ot/generic/include/byteorder.h
===================================================================
--- boot/generic/include/byteorder.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_BYTEORDER_H_
-#define _LIBC_BYTEORDER_H_
-
-#include <stdint.h>
-
-#if !(defined(__BE__) ^ defined(__LE__))
-#error The architecture must be either big-endian or little-endian.
-#endif
-
-#ifdef __BE__
-
-#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
-
-#define uint16_t_be2host(n)  (n)
-#define uint32_t_be2host(n)  (n)
-#define uint64_t_be2host(n)  (n)
-
-#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_be(n)  (n)
-#define host2uint32_t_be(n)  (n)
-#define host2uint64_t_be(n)  (n)
-
-#else
-
-#define uint16_t_le2host(n)  (n)
-#define uint32_t_le2host(n)  (n)
-#define uint64_t_le2host(n)  (n)
-
-#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_le(n)  (n)
-#define host2uint32_t_le(n)  (n)
-#define host2uint64_t_le(n)  (n)
-
-#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
-
-#endif
-
-#define htons(n)  host2uint16_t_be((n))
-#define htonl(n)  host2uint32_t_be((n))
-#define ntohs(n)  uint16_t_be2host((n))
-#define ntohl(n)  uint32_t_be2host((n))
-
-#define uint8_t_be2host(n)  (n)
-#define uint8_t_le2host(n)  (n)
-#define host2uint8_t_be(n)  (n)
-#define host2uint8_t_le(n)  (n)
-#define host2uint8_t_le(n)  (n)
-
-#define  int8_t_le2host(n)  uint8_t_le2host(n)
-#define int16_t_le2host(n) uint16_t_le2host(n)
-#define int32_t_le2host(n) uint32_t_le2host(n)
-#define int64_t_le2host(n) uint64_t_le2host(n)
-
-#define  int8_t_be2host(n)  uint8_t_be2host(n)
-#define int16_t_be2host(n) uint16_t_be2host(n)
-#define int32_t_be2host(n) uint32_t_be2host(n)
-#define int64_t_be2host(n) uint64_t_be2host(n)
-
-#define  host2int8_t_le(n)  host2uint8_t_le(n)
-#define host2int16_t_le(n) host2uint16_t_le(n)
-#define host2int32_t_le(n) host2uint32_t_le(n)
-#define host2int64_t_le(n) host2uint64_t_le(n)
-
-#define  host2int8_t_be(n)  host2uint8_t_be(n)
-#define host2int16_t_be(n) host2uint16_t_be(n)
-#define host2int32_t_be(n) host2uint32_t_be(n)
-#define host2int64_t_be(n) host2uint64_t_be(n)
-
-static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
-{
-	return ((n & 0xff) << 56) |
-	    ((n & 0xff00) << 40) |
-	    ((n & 0xff0000) << 24) |
-	    ((n & 0xff000000LL) << 8) |
-	    ((n & 0xff00000000LL) >> 8) |
-	    ((n & 0xff0000000000LL) >> 24) |
-	    ((n & 0xff000000000000LL) >> 40) |
-	    ((n & 0xff00000000000000LL) >> 56);
-}
-
-static inline uint32_t uint32_t_byteorder_swap(uint32_t n)
-{
-	return ((n & 0xff) << 24) |
-	    ((n & 0xff00) << 8) |
-	    ((n & 0xff0000) >> 8) |
-	    ((n & 0xff000000) >> 24);
-}
-
-static inline uint16_t uint16_t_byteorder_swap(uint16_t n)
-{
-	return ((n & 0xff) << 8) |
-	    ((n & 0xff00) >> 8);
-}
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/errno.h
===================================================================
--- boot/generic/include/errno.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_ERRNO_H_
-#define BOOT_ERRNO_H_
-
-#define EOK        0    /* No error. */
-#define ENOENT     -1   /* No such entry. */
-#define ENOMEM     -2   /* Not enough memory. */
-#define ELIMIT     -3   /* Limit exceeded. */
-#define EINVAL     -14  /* Invalid value. */
-#define EOVERFLOW  -16  /* The result does not fit its size. */
-#define EIO        -17
-
-typedef int errno_t;
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/gzip.h
===================================================================
--- boot/generic/include/gzip.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCOMPRESS_GZIP_H_
-#define LIBCOMPRESS_GZIP_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-
-extern bool gzip_check(const void *, size_t);
-extern size_t gzip_size(const void *, size_t);
-extern int gzip_expand(const void *, size_t, void *, size_t);
-
-#endif
Index: ot/generic/include/halt.h
===================================================================
--- boot/generic/include/halt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_HALT_H_
-#define BOOT_HALT_H_
-
-extern void halt(void) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/inflate.h
===================================================================
--- boot/generic/include/inflate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_INFLATE_H_
-#define BOOT_INFLATE_H_
-
-#include <stddef.h>
-
-extern int inflate(const void *, size_t, void *, size_t);
-
-#endif
Index: ot/generic/include/kernel.h
===================================================================
--- boot/generic/include/kernel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_ELF_H_
-#define BOOT_ELF_H_
-
-#include <stdint.h>
-
-uintptr_t check_kernel_translated(void *, uintptr_t);
-uintptr_t check_kernel(void *);
-
-#endif
Index: ot/generic/include/macros.h
===================================================================
--- boot/generic/include/macros.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_MACROS_H_
-#define BOOT_MACROS_H_
-
-#define min(a, b)  ((a) < (b) ? (a) : (b))
-#define max(a, b)  ((a) > (b) ? (a) : (b))
-
-#define isdigit(d)  (((d) >= '0') && ((d) <= '9'))
-
-#define STRING(arg)      STRING_ARG(arg)
-#define STRING_ARG(arg)  #arg
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/payload.h
===================================================================
--- boot/generic/include/payload.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BOOT_PAYLOAD_H_
-#define BOOT_PAYLOAD_H_
-
-#include <arch/types.h>
-#include <stddef.h>
-#include <stdint.h>
-
-extern uint8_t payload_start[];
-extern uint8_t payload_end[];
-
-extern uint8_t loader_start[];
-extern uint8_t loader_end[];
-
-size_t payload_unpacked_size(void);
-void extract_payload(taskmap_t *, uint8_t *, uint8_t *, uintptr_t,
-    void (*)(void *, size_t));
-
-#endif
Index: ot/generic/include/printf.h
===================================================================
--- boot/generic/include/printf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_PRINT_H_
-#define BOOT_PRINT_H_
-
-#include <stddef.h>
-#include <stdarg.h>
-#include <printf_verify.h>
-
-#define EOF  (-1)
-
-extern int puts(const char *);
-extern int printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int vprintf(const char *, va_list);
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/printf_verify.h
===================================================================
--- boot/generic/include/printf_verify.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_PRINTF_VERIFY_H_
-#define BOOT_PRINTF_VERIFY_H_
-
-#ifdef __clang__
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(__printf__, start, end)))
-#else
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(gnu_printf, start, end)))
-#endif
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/putchar.h
===================================================================
--- boot/generic/include/putchar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup boot_generic
- * @{
- */
-/** @file
- */
-
-#ifndef BOOT_PUTCHAR_H_
-#define BOOT_PUTCHAR_H_
-
-#include <stddef.h>
-#include <uchar.h>
-
-extern void putuchar(char32_t);
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/tar.h
===================================================================
--- boot/generic/include/tar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libuntar
- * @{
- */
-/** @file
- */
-
-#ifndef BOOT_TAR_H_
-#define BOOT_TAR_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define TAR_BLOCK_SIZE 512
-
-typedef struct tar_header_raw {
-	char filename[100];
-	char permissions[8];
-	char owner[8];
-	char group[8];
-	char size[12];
-	char modification_time[12];
-	char checksum[8];
-	char type;
-	char name[100];
-	char ustar_magic[6];
-	char ustar_version[2];
-	char ustar_owner_name[32];
-	char ustar_group_name[32];
-	char ustar_device_major[8];
-	char ustar_device_minor[8];
-	char ustar_prefix[155];
-	char ignored[12];
-} tar_header_raw_t;
-
-_Static_assert(sizeof(tar_header_raw_t) == TAR_BLOCK_SIZE, "Wrong size for tar header.");
-
-enum {
-	TAR_TYPE_NORMAL = '0',
-	TAR_TYPE_DIRECTORY = '5',
-};
-
-typedef struct {
-	const uint8_t *ptr;
-	size_t length;
-	size_t next;
-} tar_t;
-
-bool tar_info(const uint8_t *, const uint8_t *, const char **, size_t *);
-
-#endif
-
-/** @}
- */
Index: ot/generic/include/version.h
===================================================================
--- boot/generic/include/version.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef BOOT_VERSION_H_
-#define BOOT_VERSION_H_
-
-extern void version_print(void);
-
-#endif
-
-/** @}
- */
Index: ot/generic/src/balloc.c
===================================================================
--- boot/generic/src/balloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <balloc.h>
-#include <stdalign.h>
-#include <stddef.h>
-#include <align.h>
-
-static ballocs_t *ballocs;
-static uintptr_t phys_base;
-static size_t max_size;
-
-void balloc_init(ballocs_t *ball, void *base, uintptr_t kernel_base,
-    size_t size)
-{
-	ballocs = ball;
-	phys_base = (uintptr_t) base;
-	max_size = size;
-	ballocs->base = kernel_base;
-	ballocs->size = 0;
-}
-
-void *balloc(size_t size, size_t alignment)
-{
-	if (alignment == 0)
-		return NULL;
-
-	/* Enforce minimal alignment. */
-	alignment = ALIGN_UP(alignment, alignof(max_align_t));
-
-	uintptr_t addr = phys_base + ALIGN_UP(ballocs->size, alignment);
-
-	if (ALIGN_UP(ballocs->size, alignment) + size >= max_size)
-		return NULL;
-
-	ballocs->size = ALIGN_UP(ballocs->size, alignment) + size;
-
-	return (void *) addr;
-}
-
-void *balloc_rebase(void *ptr)
-{
-	return (void *) (((uintptr_t) ptr - phys_base) + ballocs->base);
-}
Index: ot/generic/src/gzip.c
===================================================================
--- boot/generic/src/gzip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,219 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// XXX: This file is a duplicate of the same in uspace/lib/compress
-
-#include <stdint.h>
-#include <stddef.h>
-#include <errno.h>
-#include <mem.h>
-#include <byteorder.h>
-#include <gzip.h>
-#include <inflate.h>
-
-#define GZIP_ID1  UINT8_C(0x1f)
-#define GZIP_ID2  UINT8_C(0x8b)
-
-#define GZIP_METHOD_DEFLATE  UINT8_C(0x08)
-
-#define GZIP_FLAGS_MASK     UINT8_C(0x1f)
-#define GZIP_FLAG_FHCRC     UINT8_C(1 << 1)
-#define GZIP_FLAG_FEXTRA    UINT8_C(1 << 2)
-#define GZIP_FLAG_FNAME     UINT8_C(1 << 3)
-#define GZIP_FLAG_FCOMMENT  UINT8_C(1 << 4)
-
-typedef struct {
-	uint8_t id1;
-	uint8_t id2;
-	uint8_t method;
-	uint8_t flags;
-	uint32_t mtime;
-	uint8_t extra_flags;
-	uint8_t os;
-} __attribute__((packed)) gzip_header_t;
-
-typedef struct {
-	uint32_t crc32;
-	uint32_t size;
-} __attribute__((packed)) gzip_footer_t;
-
-/** Check GZIP signature
- *
- * Checks whether the source buffer start with a GZIP signature.
- *
- * @param[in] src    Source data buffer.
- * @param[in] srclen Source buffer size (bytes).
- *
- * @return True if GZIP signature found.
- * @return False if no GZIP signature found.
- *
- */
-bool gzip_check(const void *src, size_t srclen)
-{
-	if ((srclen < (sizeof(gzip_header_t) + sizeof(gzip_footer_t))))
-		return false;
-
-	gzip_header_t header;
-	memcpy(&header, src, sizeof(header));
-
-	if ((header.id1 != GZIP_ID1) ||
-	    (header.id2 != GZIP_ID2) ||
-	    (header.method != GZIP_METHOD_DEFLATE) ||
-	    ((header.flags & (~GZIP_FLAGS_MASK)) != 0))
-		return false;
-
-	return true;
-}
-
-/** Get uncompressed size
- *
- * Note that the uncompressed size is read from the GZIP footer
- * (and not calculated by acutally decompressing the GZip archive).
- * Thus the source of the GZip archive needs to be trusted.
- *
- * @param[in]  src    Source data buffer.
- * @param[out] srclen Source buffer size (bytes).
- *
- * @return Uncompressed size.
- *
- */
-size_t gzip_size(const void *src, size_t srclen)
-{
-	if (!gzip_check(src, srclen))
-		return 0;
-
-	gzip_footer_t footer;
-	memcpy(&footer, src + srclen - sizeof(footer), sizeof(footer));
-
-	return uint32_t_le2host(footer.size);
-}
-
-/** Expand GZIP compressed data
- *
- * The routine compares the output buffer size with
- * the size encoded in the input stream. This
- * effectively limits the size of the uncompressed
- * data to 4 GiB (expanding input streams that actually
- * encode more data will always fail).
- *
- * So far, no CRC is perfomed.
- *
- * @param[in]  src     Source data buffer.
- * @param[in]  srclen  Source buffer size (bytes).
- * @param[out] dest    Destination data buffer.
- * @param[out] destlen Destination buffer size (bytes).
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code, invalid deflate data,
- *                   invalid compression method or invalid stream.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-int gzip_expand(const void *src, size_t srclen, void *dest, size_t destlen)
-{
-	if (!gzip_check(src, srclen))
-		return EINVAL;
-
-	/* Decode header and footer */
-
-	gzip_header_t header;
-	memcpy(&header, src, sizeof(header));
-
-	gzip_footer_t footer;
-	memcpy(&footer, src + srclen - sizeof(footer), sizeof(footer));
-
-	if (destlen != uint32_t_le2host(footer.size))
-		return EINVAL;
-
-	/* Ignore extra metadata */
-
-	const void *stream = src + sizeof(header);
-	size_t stream_length = srclen - sizeof(header) - sizeof(footer);
-
-	if ((header.flags & GZIP_FLAG_FEXTRA) != 0) {
-		uint16_t extra_length;
-
-		if (stream_length < sizeof(extra_length))
-			return EINVAL;
-
-		memcpy(&extra_length, stream, sizeof(extra_length));
-		stream += sizeof(extra_length);
-		stream_length -= sizeof(extra_length);
-
-		if (stream_length < extra_length)
-			return EINVAL;
-
-		stream += extra_length;
-		stream_length -= extra_length;
-	}
-
-	if ((header.flags & GZIP_FLAG_FNAME) != 0) {
-		while (*((uint8_t *) stream) != 0) {
-			if (stream_length == 0)
-				return EINVAL;
-
-			stream++;
-			stream_length--;
-		}
-
-		if (stream_length == 0)
-			return EINVAL;
-
-		stream++;
-		stream_length--;
-	}
-
-	if ((header.flags & GZIP_FLAG_FCOMMENT) != 0) {
-		while (*((uint8_t *) stream) != 0) {
-			if (stream_length == 0)
-				return EINVAL;
-
-			stream++;
-			stream_length--;
-		}
-
-		if (stream_length == 0)
-			return EINVAL;
-
-		stream++;
-		stream_length--;
-	}
-
-	if ((header.flags & GZIP_FLAG_FHCRC) != 0) {
-		if (stream_length < 2)
-			return EINVAL;
-
-		stream += 2;
-		stream_length -= 2;
-	}
-
-	/* Inflate the data */
-	return inflate(stream, stream_length, dest, destlen);
-}
Index: ot/generic/src/inflate.c
===================================================================
--- boot/generic/src/inflate.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,675 +1,0 @@
-/*
- * Copyright (c) 2010 Mark Adler
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief Implementation of inflate decompression
- *
- * A simple inflate implementation (decompression of `deflate' stream as
- * described by RFC 1951) based on puff.c by Mark Adler. It is not optimized
- * for speed but for readability as it is used as part of the bootloader and
- * any miss-optimization might be hard to debug.
- *
- * All dynamically allocated memory memory is taken from the stack. The
- * stack usage should be typically bounded by 2 KB.
- *
- * Original copyright notice:
- *
- *  Copyright (C) 2002-2010 Mark Adler, all rights reserved
- *  version 2.1, 4 Apr 2010
- *
- *  This software is provided 'as-is', without any express or implied
- *  warranty. In no event will the author be held liable for any damages
- *  arising from the use of this software.
- *
- *  Permission is granted to anyone to use this software for any purpose,
- *  including commercial applications, and to alter it and redistribute it
- *  freely, subject to the following restrictions:
- *
- *  1. The origin of this software must not be misrepresented; you must not
- *     claim that you wrote the original software. If you use this software
- *     in a product, an acknowledgment in the product documentation would be
- *     appreciated but is not required.
- *  2. Altered source versions must be plainly marked as such, and must not
- *     be misrepresented as being the original software.
- *  3. This notice may not be removed or altered from any source
- *     distribution.
- *
- *   Mark Adler <madler@alumni.caltech.edu>
- *
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <mem.h>
-#include <inflate.h>
-
-/** Maximum bits in the Huffman code */
-#define MAX_HUFFMAN_BIT  15
-
-/** Number of length codes */
-#define MAX_LEN           29
-/** Number of distance codes */
-#define MAX_DIST          30
-/** Number of order codes */
-#define MAX_ORDER         19
-/** Number of literal/length codes */
-#define MAX_LITLEN        286
-/** Number of fixed literal/length codes */
-#define MAX_FIXED_LITLEN  288
-
-/** Number of all codes */
-#define MAX_CODE  (MAX_LITLEN + MAX_DIST)
-
-/** Check for input buffer overrun condition */
-#define CHECK_OVERRUN(state) \
-	do { \
-		if ((state).overrun) \
-			return ELIMIT; \
-	} while (false)
-
-/** Inflate algorithm state
- *
- */
-typedef struct {
-	uint8_t *dest;    /**< Output buffer */
-	size_t destlen;   /**< Output buffer size */
-	size_t destcnt;   /**< Position in the output buffer */
-
-	const uint8_t *src;     /**< Input buffer */
-	size_t srclen;    /**< Input buffer size */
-	size_t srccnt;    /**< Position in the input buffer */
-
-	uint16_t bitbuf;  /**< Bit buffer */
-	size_t bitlen;    /**< Number of bits in the bit buffer */
-
-	bool overrun;     /**< Overrun condition */
-} inflate_state_t;
-
-/** Huffman code description
- *
- */
-typedef struct {
-	uint16_t *count;   /**< Array of symbol counts */
-	uint16_t *symbol;  /**< Array of symbols */
-} huffman_t;
-
-/** Length codes
- *
- */
-static const uint16_t lens[MAX_LEN] = {
-	3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
-	35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258
-};
-
-/** Extended length codes
- *
- */
-static const uint16_t lens_ext[MAX_LEN] = {
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
-	3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
-};
-
-/** Distance codes
- *
- */
-static const uint16_t dists[MAX_DIST] = {
-	1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
-	257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
-	8193, 12289, 16385, 24577
-};
-
-/** Extended distance codes
- *
- */
-static const uint16_t dists_ext[MAX_DIST] = {
-	0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
-	7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
-	12, 12, 13, 13
-};
-
-/** Order codes
- *
- */
-static const short order[MAX_ORDER] = {
-	16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
-};
-
-/** Static length symbol counts
- *
- */
-static uint16_t len_count[MAX_HUFFMAN_BIT + 1] = {
-	0, 0, 0, 0, 0, 0, 0, 24, 152, 112, 0, 0, 0, 0, 0, 0
-};
-
-/** Static length symbols
- *
- */
-static uint16_t len_symbol[MAX_FIXED_LITLEN] = {
-	256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
-	269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 0, 1, 2,
-	3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-	21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
-	37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
-	53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
-	69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
-	85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
-	101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
-	114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
-	127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
-	140, 141, 142, 143, 280, 281, 282, 283, 284, 285, 286, 287, 144,
-	145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
-	158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
-	171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
-	184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
-	197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
-	210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
-	223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
-	236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
-	249, 250, 251, 252, 253, 254, 255
-};
-
-/** Static distance symbol counts
- *
- */
-static uint16_t dist_count[MAX_HUFFMAN_BIT + 1] = {
-	0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/** Static distance symbols
- *
- */
-static uint16_t dist_symbol[MAX_DIST] = {
-	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-	16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
-};
-
-/** Huffman code for lengths
- *
- */
-static huffman_t len_code = {
-	.count = len_count,
-	.symbol = len_symbol
-};
-
-/** Huffman code for distances
- *
- */
-static huffman_t dist_code = {
-	.count = dist_count,
-	.symbol = dist_symbol
-};
-
-/** Get bits from the bit buffer
- *
- * @param state Inflate state.
- * @param cnt   Number of bits to return (at most 16).
- *
- * @return Returned bits.
- *
- */
-static inline uint16_t get_bits(inflate_state_t *state, size_t cnt)
-{
-	/* Bit accumulator for at least 20 bits */
-	uint32_t val = state->bitbuf;
-
-	while (state->bitlen < cnt) {
-		if (state->srccnt == state->srclen) {
-			state->overrun = true;
-			return 0;
-		}
-
-		/* Load 8 more bits */
-		val |= ((uint32_t) state->src[state->srccnt]) << state->bitlen;
-		state->srccnt++;
-		state->bitlen += 8;
-	}
-
-	/* Update bits in the buffer */
-	state->bitbuf = (uint16_t) (val >> cnt);
-	state->bitlen -= cnt;
-
-	return ((uint16_t) (val & ((1 << cnt) - 1)));
-}
-
-/** Decode `stored' block
- *
- * @param state Inflate state.
- *
- * @return EOK on success.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- * @return EINVAL on invalid data.
- *
- */
-static int inflate_stored(inflate_state_t *state)
-{
-	/* Discard bits in the bit buffer */
-	state->bitbuf = 0;
-	state->bitlen = 0;
-
-	if (state->srccnt + 4 > state->srclen)
-		return ELIMIT;
-
-	uint16_t len =
-	    state->src[state->srccnt] | (state->src[state->srccnt + 1] << 8);
-	uint16_t len_compl =
-	    state->src[state->srccnt + 2] | (state->src[state->srccnt + 3] << 8);
-
-	/* Check block length and its complement */
-	if (((int16_t) len) != ~((int16_t) len_compl))
-		return EINVAL;
-
-	state->srccnt += 4;
-
-	/* Check input buffer size */
-	if (state->srccnt + len > state->srclen)
-		return ELIMIT;
-
-	/* Check output buffer size */
-	if (state->destcnt + len > state->destlen)
-		return ENOMEM;
-
-	/* Copy data */
-	memcpy(state->dest + state->destcnt, state->src + state->srccnt, len);
-	state->srccnt += len;
-	state->destcnt += len;
-
-	return EOK;
-}
-
-/** Decode a symbol using the Huffman code
- *
- * @param state   Inflate state.
- * @param huffman Huffman code.
- * @param symbol  Decoded symbol.
- *
- * @param EOK on success.
- * @param EINVAL on invalid Huffman code.
- *
- */
-static int huffman_decode(inflate_state_t *state, huffman_t *huffman,
-    uint16_t *symbol)
-{
-	/* Decode bits */
-	uint16_t code = 0;
-
-	/* First code of the given length */
-	size_t first = 0;
-
-	/*
-	 * Index of the first code of the given length
-	 * in the symbol table
-	 */
-	size_t index = 0;
-
-	/* Current number of bits in the code */
-	size_t len;
-
-	for (len = 1; len <= MAX_HUFFMAN_BIT; len++) {
-		/* Get next bit */
-		code |= get_bits(state, 1);
-		CHECK_OVERRUN(*state);
-
-		uint16_t count = huffman->count[len];
-		if (code < first + count) {
-			/* Return decoded symbol */
-			*symbol = huffman->symbol[index + code - first];
-			return EOK;
-		}
-
-		/* Update for next length */
-		index += count;
-		first += count;
-		first <<= 1;
-		code <<= 1;
-	}
-
-	return EINVAL;
-}
-
-/** Construct Huffman tables from canonical Huffman code
- *
- * @param huffman Constructed Huffman tables.
- * @param length  Lengths of the canonical Huffman code.
- * @param n       Number of lengths.
- *
- * @return 0 if the Huffman code set is complete.
- * @return Negative value for an over-subscribed code set.
- * @return Positive value for an incomplete code set.
- *
- */
-static int16_t huffman_construct(huffman_t *huffman, uint16_t *length, size_t n)
-{
-	/* Count number of codes for each length */
-	size_t len;
-	for (len = 0; len <= MAX_HUFFMAN_BIT; len++)
-		huffman->count[len] = 0;
-
-	/* We assume that the lengths are within bounds */
-	size_t symbol;
-	for (symbol = 0; symbol < n; symbol++)
-		huffman->count[length[symbol]]++;
-
-	if (huffman->count[0] == n) {
-		/* The code is complete, but decoding will fail */
-		return 0;
-	}
-
-	/* Check for an over-subscribed or incomplete set of lengths */
-	int16_t left = 1;
-	for (len = 1; len <= MAX_HUFFMAN_BIT; len++) {
-		left <<= 1;
-		left -= huffman->count[len];
-		if (left < 0) {
-			/* Over-subscribed */
-			return left;
-		}
-	}
-
-	/* Generate offsets into symbol table */
-	uint16_t offs[MAX_HUFFMAN_BIT + 1];
-
-	offs[1] = 0;
-	for (len = 1; len < MAX_HUFFMAN_BIT; len++)
-		offs[len + 1] = offs[len] + huffman->count[len];
-
-	for (symbol = 0; symbol < n; symbol++) {
-		if (length[symbol] != 0) {
-			huffman->symbol[offs[length[symbol]]] = symbol;
-			offs[length[symbol]]++;
-		}
-	}
-
-	return left;
-}
-
-/** Decode literal/length and distance codes
- *
- * Decode until end-of-block code.
- *
- * @param state     Inflate state.
- * @param len_code  Huffman code for literal/length.
- * @param dist_code Huffman code for distance.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static int inflate_codes(inflate_state_t *state, huffman_t *len_code,
-    huffman_t *dist_code)
-{
-	uint16_t symbol;
-
-	do {
-		int err = huffman_decode(state, len_code, &symbol);
-		if (err != EOK) {
-			/* Error decoding */
-			return err;
-		}
-
-		if (symbol < 256) {
-			/* Write out literal */
-			if (state->destcnt == state->destlen)
-				return ENOMEM;
-
-			state->dest[state->destcnt] = (uint8_t) symbol;
-			state->destcnt++;
-		} else if (symbol > 256) {
-			/* Compute length */
-			symbol -= 257;
-			if (symbol >= 29)
-				return EINVAL;
-
-			size_t len = lens[symbol] + get_bits(state, lens_ext[symbol]);
-			CHECK_OVERRUN(*state);
-
-			/* Get distance */
-			err = huffman_decode(state, dist_code, &symbol);
-			if (err != EOK)
-				return err;
-
-			size_t dist = dists[symbol] + get_bits(state, dists_ext[symbol]);
-			if (dist > state->destcnt)
-				return ENOENT;
-
-			if (state->destcnt + len > state->destlen)
-				return ENOMEM;
-
-			while (len > 0) {
-				/* Copy len bytes from distance bytes back */
-				state->dest[state->destcnt] =
-				    state->dest[state->destcnt - dist];
-				state->destcnt++;
-				len--;
-			}
-		}
-	} while (symbol != 256);
-
-	return EOK;
-}
-
-/** Decode `fixed codes' block
- *
- * @param state     Inflate state.
- * @param len_code  Huffman code for literal/length.
- * @param dist_code Huffman code for distance.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static int inflate_fixed(inflate_state_t *state, huffman_t *len_code,
-    huffman_t *dist_code)
-{
-	return inflate_codes(state, len_code, dist_code);
-}
-
-/** Decode `dynamic codes' block
- *
- * @param state     Inflate state.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static int inflate_dynamic(inflate_state_t *state)
-{
-	uint16_t length[MAX_CODE];
-	uint16_t dyn_len_count[MAX_HUFFMAN_BIT + 1];
-	uint16_t dyn_len_symbol[MAX_LITLEN];
-	uint16_t dyn_dist_count[MAX_HUFFMAN_BIT + 1];
-	uint16_t dyn_dist_symbol[MAX_DIST];
-	huffman_t dyn_len_code;
-	huffman_t dyn_dist_code;
-
-	dyn_len_code.count = dyn_len_count;
-	dyn_len_code.symbol = dyn_len_symbol;
-
-	dyn_dist_code.count = dyn_dist_count;
-	dyn_dist_code.symbol = dyn_dist_symbol;
-
-	/* Get number of bits in each table */
-	uint16_t nlen = get_bits(state, 5) + 257;
-	CHECK_OVERRUN(*state);
-
-	uint16_t ndist = get_bits(state, 5) + 1;
-	CHECK_OVERRUN(*state);
-
-	uint16_t ncode = get_bits(state, 4) + 4;
-	CHECK_OVERRUN(*state);
-
-	if ((nlen > MAX_LITLEN) || (ndist > MAX_DIST) ||
-	    (ncode > MAX_ORDER))
-		return EINVAL;
-
-	/* Read code length code lengths */
-	uint16_t index;
-	for (index = 0; index < ncode; index++) {
-		length[order[index]] = get_bits(state, 3);
-		CHECK_OVERRUN(*state);
-	}
-
-	/* Set missing lengths to zero */
-	for (index = ncode; index < MAX_ORDER; index++)
-		length[order[index]] = 0;
-
-	/* Build Huffman code */
-	int16_t rc = huffman_construct(&dyn_len_code, length, MAX_ORDER);
-	if (rc != 0)
-		return EINVAL;
-
-	/* Read length/literal and distance code length tables */
-	index = 0;
-	while (index < nlen + ndist) {
-		uint16_t symbol;
-		int err = huffman_decode(state, &dyn_len_code, &symbol);
-		if (err != EOK)
-			return EOK;
-
-		if (symbol < 16) {
-			length[index] = symbol;
-			index++;
-		} else {
-			uint16_t len = 0;
-
-			if (symbol == 16) {
-				if (index == 0)
-					return EINVAL;
-
-				len = length[index - 1];
-				symbol = get_bits(state, 2) + 3;
-				CHECK_OVERRUN(*state);
-			} else if (symbol == 17) {
-				symbol = get_bits(state, 3) + 3;
-				CHECK_OVERRUN(*state);
-			} else {
-				symbol = get_bits(state, 7) + 11;
-				CHECK_OVERRUN(*state);
-			}
-
-			if (index + symbol > nlen + ndist)
-				return EINVAL;
-
-			while (symbol > 0) {
-				length[index] = len;
-				index++;
-				symbol--;
-			}
-		}
-	}
-
-	/* Check for end-of-block code */
-	if (length[256] == 0)
-		return EINVAL;
-
-	/* Build Huffman tables for literal/length codes */
-	rc = huffman_construct(&dyn_len_code, length, nlen);
-	if ((rc < 0) || ((rc > 0) && (dyn_len_code.count[0] + 1 != nlen)))
-		return EINVAL;
-
-	/* Build Huffman tables for distance codes */
-	rc = huffman_construct(&dyn_dist_code, length + nlen, ndist);
-	if ((rc < 0) || ((rc > 0) && (dyn_dist_code.count[0] + 1 != ndist)))
-		return EINVAL;
-
-	return inflate_codes(state, &dyn_len_code, &dyn_dist_code);
-}
-
-/** Inflate data
- *
- * @param src     Source data buffer.
- * @param srclen  Source buffer size (bytes).
- * @param dest    Destination data buffer.
- * @param destlen Destination buffer size (bytes).
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code or invalid deflate data.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-int inflate(const void *src, size_t srclen, void *dest, size_t destlen)
-{
-	/* Initialize the state */
-	inflate_state_t state;
-
-	state.dest = (uint8_t *) dest;
-	state.destlen = destlen;
-	state.destcnt = 0;
-
-	state.src = (const uint8_t *) src;
-	state.srclen = srclen;
-	state.srccnt = 0;
-
-	state.bitbuf = 0;
-	state.bitlen = 0;
-
-	state.overrun = false;
-
-	uint16_t last;
-	int ret = 0;
-
-	do {
-		/* Last block is indicated by a non-zero bit */
-		last = get_bits(&state, 1);
-		CHECK_OVERRUN(state);
-
-		/* Block type */
-		uint16_t type = get_bits(&state, 2);
-		CHECK_OVERRUN(state);
-
-		switch (type) {
-		case 0:
-			ret = inflate_stored(&state);
-			break;
-		case 1:
-			ret = inflate_fixed(&state, &len_code, &dist_code);
-			break;
-		case 2:
-			ret = inflate_dynamic(&state);
-			break;
-		default:
-			ret = EINVAL;
-		}
-	} while ((!last) && (ret == 0));
-
-	return ret;
-}
Index: ot/generic/src/kernel.c
===================================================================
--- boot/generic/src/kernel.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/elf.h>
-#include <halt.h>
-#include <printf.h>
-#include <kernel.h>
-#include <stdbool.h>
-
-// FIXME: elf_is_valid is a duplicate of the same-named libc function.
-
-// TODO: better kernel ELF loading
-//
-// Currently the boot loader is very primitive. It loads the ELF file as
-// a contiguous span starting at a predefined offset, and then checks load
-// segments in it to make sure they are correctly positioned. Ideally, this
-// should change to a more flexible loader that actually loads based on the
-// kernel's ELF segments. There would still be some restrictions however.
-// ELF vaddr and paddr fields offer some flexibility in their interpretation,
-// so I propose the following scheme, to correctly express everything various
-// architectures require:
-//
-//     - in vaddr and paddr fields, addresses numerically in the lower half are
-//       interpreted as physical addresses, addresses in the upper half are
-//       interpreted as virtual addresses.
-//
-//     - If vaddr is a virtual address, the segment is mapped into the kernel's
-//       virtual address space at vaddr.
-//
-//     - If vaddr is a physical address, it must be the same as paddr.
-//       Loader loads the segment at the given physical address, but does not
-//       map it into the kernel's virtual address space. Symbols defined in this
-//       segment are only accessible with paging disabled.
-//
-//     - If paddr is a physical address, the loader must load the segment at
-//       physical address paddr, or die trying.
-//
-//     - If paddr is a virtual address, it must be the same as vaddr.
-//       Loader may allocate the physical location arbitrarily.
-//
-//     - If the kernel is a Position Independent Executable, all this is
-//       irrelevant, paddr must be the same as vaddr, vaddr is always the
-//       virtual address offset, and loader can choose the virtual address
-//       base arbitrarily within some predefined constraints. We might want
-//       to support PIE kernel on architectures that need some code at fixed
-//       physical address. In that case, the "real mode" code should probably
-//       be in a separate ELF file from the rest of kernel.
-//
-
-/**
- * Checks that the ELF header is valid for the running system.
- */
-static bool elf_is_valid(const elf_header_t *header)
-{
-	// TODO: check more things
-	// TODO: debug output
-
-	if (header->e_ident[EI_MAG0] != ELFMAG0 ||
-	    header->e_ident[EI_MAG1] != ELFMAG1 ||
-	    header->e_ident[EI_MAG2] != ELFMAG2 ||
-	    header->e_ident[EI_MAG3] != ELFMAG3) {
-		return false;
-	}
-
-	if (header->e_ident[EI_DATA] != ELF_DATA_ENCODING ||
-	    header->e_machine != ELF_MACHINE ||
-	    header->e_ident[EI_VERSION] != EV_CURRENT ||
-	    header->e_version != EV_CURRENT ||
-	    header->e_ident[EI_CLASS] != ELF_CLASS) {
-		return false;
-	}
-
-	if (header->e_phentsize != sizeof(elf_segment_header_t)) {
-		return false;
-	}
-
-	if (header->e_type != ET_EXEC && header->e_type != ET_DYN) {
-		return false;
-	}
-
-	if (header->e_phoff == 0) {
-		return false;
-	}
-
-	return true;
-}
-
-uintptr_t check_kernel(void *start)
-{
-	return check_kernel_translated(start, (uintptr_t) start);
-}
-
-/**
- * Checks that the kernel ELF image is valid, and returns the entry point
- * address. We check that the image's load addresses match the actual location.
- *
- * @param start  Pointer to the start of the ELF file in memory.
- * @param actual_addr  Start address where the kernel is moved after the check
- *                     but before it is executed.
- *
- * @return  Entry point address in *kernel's* address space.
- */
-uintptr_t check_kernel_translated(void *start, uintptr_t actual_addr)
-{
-	elf_header_t *header = (elf_header_t *) start;
-
-	if (!elf_is_valid(header)) {
-		printf("Kernel is not a valid ELF image.\n");
-		halt();
-	}
-
-	elf_segment_header_t *phdr =
-	    (elf_segment_header_t *) ((uintptr_t) start + header->e_phoff);
-
-	/* Walk through PT_LOAD headers, to find out the size of the module. */
-	for (int i = 0; i < header->e_phnum; i++) {
-		if (phdr[i].p_type != PT_LOAD)
-			continue;
-
-		uintptr_t expected = actual_addr + phdr[i].p_offset;
-		uintptr_t got = phdr[i].p_paddr;
-		if (expected != got) {
-			printf("Incorrect kernel load address. "
-			    "Expected: %p, got %p\n",
-			    (void *) expected, (void *) got);
-			halt();
-		}
-
-		if (phdr[i].p_filesz != phdr[i].p_memsz) {
-			printf("Kernel's memory size is greater than its file"
-			    " size. We don't currently support that.\n");
-			halt();
-		}
-	}
-
-	return (uintptr_t) header->e_entry;
-}
Index: ot/generic/src/payload.c
===================================================================
--- boot/generic/src/payload.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,263 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <payload.h>
-
-#include <align.h>
-#include <printf.h>
-#include <arch/arch.h>
-#include <tar.h>
-#include <gzip.h>
-#include <stdbool.h>
-#include <mem.h>
-#include <errno.h>
-#include <str.h>
-#include <halt.h>
-
-static const char *ext(const char *s)
-{
-	const char *last = s;
-
-	while (*s) {
-		if (*s == '.')
-			last = s;
-
-		s++;
-	}
-
-	if (*last == '.')
-		return last;
-
-	return NULL;
-}
-
-static void basename(char *s)
-{
-	char *e = (char *) ext(s);
-	if ((e != NULL) && (str_cmp(e, ".gz") == 0))
-		*e = '\0';
-}
-
-static bool overlaps(uint8_t *start1, uint8_t *end1,
-    uint8_t *start2, uint8_t *end2)
-{
-	return !(end1 <= start2 || end2 <= start1);
-}
-
-static bool extract_component(uint8_t **cstart, uint8_t *cend,
-    uint8_t *ustart, uint8_t *uend, uintptr_t actual_ustart,
-    void (*clear_cache)(void *, size_t), task_t *task)
-{
-	const char *name;
-	size_t packed_size;
-
-	if (!tar_info(*cstart, cend, &name, &packed_size))
-		return false;
-
-	const uint8_t *data = *cstart + TAR_BLOCK_SIZE;
-	*cstart += TAR_BLOCK_SIZE + ALIGN_UP(packed_size, TAR_BLOCK_SIZE);
-
-	bool gz = gzip_check(data, packed_size);
-	size_t unpacked_size = gz ? gzip_size(data, packed_size) : packed_size;
-
-	/* Components must be page-aligned. */
-	uint8_t *new_ustart = (uint8_t *) ALIGN_UP((uintptr_t) ustart, PAGE_SIZE);
-	actual_ustart += new_ustart - ustart;
-	ustart = new_ustart;
-	uint8_t *comp_end = ustart + unpacked_size;
-
-	/* Check limits and overlap. */
-	if (overlaps(ustart, comp_end, loader_start, loader_end)) {
-		/* Move the component after bootloader. */
-		printf("%s would overlap bootloader, moving to %p.\n", name, loader_end);
-		uint8_t *new_ustart = (uint8_t *) ALIGN_UP((uintptr_t) loader_end, PAGE_SIZE);
-		actual_ustart += new_ustart - ustart;
-		ustart = new_ustart;
-		comp_end = ustart + unpacked_size;
-	}
-
-	if (comp_end > uend) {
-		printf("Not enough available memory for remaining components"
-		    " (at least %zd more required).\n", comp_end - uend);
-		halt();
-	}
-
-	printf(" %p|%p: %s image (%zu/%zu bytes)\n", (void *) actual_ustart,
-	    ustart, name, unpacked_size, packed_size);
-
-	if (task) {
-		task->addr = (void *) actual_ustart;
-		task->size = unpacked_size;
-		str_cpy(task->name, BOOTINFO_TASK_NAME_BUFLEN, name);
-		/* Remove .gz extension */
-		if (gz)
-			basename(task->name);
-	}
-
-	if (gz) {
-		int rc = gzip_expand(data, packed_size, ustart, unpacked_size);
-		if (rc != EOK) {
-			printf("\n%s: Inflating error %d\n", name, rc);
-			halt();
-		}
-	} else {
-		memcpy(ustart, data, unpacked_size);
-	}
-
-	if (clear_cache)
-		clear_cache(ustart, unpacked_size);
-
-	return true;
-}
-
-/* @return Bytes needed for unpacked payload. */
-size_t payload_unpacked_size(void)
-{
-	size_t sz = 0;
-	uint8_t *start = payload_start;
-	const char *name;
-	size_t packed_size;
-
-	while (tar_info(start, payload_end, &name, &packed_size)) {
-		sz = ALIGN_UP(sz, PAGE_SIZE);
-		if (gzip_check(start + TAR_BLOCK_SIZE, packed_size))
-			sz += gzip_size(start + TAR_BLOCK_SIZE, packed_size);
-		else
-			sz += packed_size;
-
-		start += TAR_BLOCK_SIZE + ALIGN_UP(packed_size, TAR_BLOCK_SIZE);
-	}
-
-	return sz;
-}
-
-/**
- * Extract the payload (kernel, loader, init binaries and the initrd image).
- *
- * @param bootinfo      Pointer to the structure where the actual placement
- *                      of components is recorded.
- *
- * @param kernel_dest   Address of the kernel in the bootloader's address space.
- *                      Kernel is the only part of the payload that has a fixed
- *                      location and cannot be moved. If the kernel doesn't fit
- *                      or would overlap bootloader, bootloader halts.
- *
- * @param mem_end       End of usable contiguous memory.
- *                      The caller guarantees that the entire area between
- *                      kernel_start and mem_end is free and safe to write to,
- *                      save possibly for the interval [loader_start, loader_end).
- *                      All components are placed in this area. If there is not
- *                      enough space for all components, bootloader halts.
- *
- * @param kernel_start  Address the kernel will have in the kernel's own
- *                      address space.
- *
- * @param clear_cache   Caller-provided function for assuring cache coherence,
- *                      whatever that means for a given platform. May be NULL.
- */
-void extract_payload(taskmap_t *tmap, uint8_t *kernel_dest, uint8_t *mem_end,
-    uintptr_t kernel_start, void (*clear_cache)(void *, size_t))
-{
-	task_t task;
-	memset(&task, 0, sizeof(task));
-
-	printf("Boot loader: %p -> %p\n", loader_start, loader_end);
-	printf("Payload: %p -> %p\n", payload_start, payload_end);
-	printf("Kernel load address: %p\n", kernel_dest);
-	printf("Kernel start: %p\n", (void *) kernel_start);
-	printf("RAM end: %p (%zd bytes available)\n", mem_end,
-	    mem_end - kernel_dest);
-
-	size_t payload_size = payload_end - payload_start;
-	uint8_t *real_payload_start;
-	uint8_t *real_payload_end;
-
-	if (overlaps(kernel_dest, mem_end, payload_start, payload_end)) {
-		/*
-		 * First, move the payload to the very end of available memory,
-		 * to make space for the unpacked data.
-		 */
-		real_payload_start = (uint8_t *) ALIGN_DOWN((uintptr_t)(mem_end - payload_size), PAGE_SIZE);
-		real_payload_end = real_payload_start + payload_size;
-		memmove(real_payload_start, payload_start, payload_size);
-
-		printf("Moved payload: %p -> %p\n", real_payload_start, real_payload_end);
-	} else {
-		real_payload_start = payload_start;
-		real_payload_end = payload_end;
-	}
-
-	printf("\nInflating components ... \n");
-
-	uint8_t *end = mem_end;
-
-	if (real_payload_end > kernel_dest && real_payload_start < mem_end)
-		end = real_payload_start;
-
-	/* Kernel is always first. */
-	if (!extract_component(&real_payload_start, real_payload_end,
-	    kernel_dest, end, kernel_start, clear_cache, &task)) {
-		printf("There is no kernel.\n");
-		halt();
-	}
-
-	if ((uintptr_t) task.addr != kernel_start) {
-		printf("Couldn't load kernel at the requested address.\n");
-		halt();
-	}
-
-	tmap->cnt = 0;
-
-	for (int i = 0; i <= TASKMAP_MAX_RECORDS; i++) {
-		/*
-		 * `task` holds the location and size of the previous component.
-		 */
-		uintptr_t actual_dest =
-		    ALIGN_UP((uintptr_t) task.addr + task.size, PAGE_SIZE);
-		uint8_t *dest = kernel_dest + (actual_dest - kernel_start);
-
-		if (real_payload_end > dest && real_payload_start < mem_end)
-			end = real_payload_start;
-
-		if (!extract_component(&real_payload_start, real_payload_end,
-		    dest, end, actual_dest, clear_cache, &task))
-			break;
-
-		if (i >= TASKMAP_MAX_RECORDS) {
-			printf("More components than the maximum of %d.\n",
-			    TASKMAP_MAX_RECORDS);
-			halt();
-		}
-
-		tmap->tasks[i] = task;
-		tmap->cnt = i + 1;
-	}
-
-	printf("Done.\n");
-}
Index: ot/generic/src/printf.c
===================================================================
--- boot/generic/src/printf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <printf.h>
-#include <stdarg.h>
-
-int printf(const char *fmt, ...)
-{
-	int ret;
-	va_list args;
-
-	va_start(args, fmt);
-
-	ret = vprintf(fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-/** @}
- */
Index: ot/generic/src/tar.c
===================================================================
--- boot/generic/src/tar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <align.h>
-#include <tar.h>
-
-static int _digit_val(char c)
-{
-	if (c >= '0' && c <= '9') {
-		return c - '0';
-	}
-	if (c >= 'a' && c <= 'z') {
-		return c - 'a' + 10;
-	}
-	if (c >= 'A' && c <= 'Z') {
-		return c - 'A' + 10;
-	}
-
-	// TODO: error message
-	return 0;
-}
-
-static int64_t _parse_size(const char *s, size_t len, int base)
-{
-	int64_t val = 0;
-
-	for (size_t i = 0; i < len; i++) {
-		if (*s == 0)
-			return val;
-
-		if (*s == ' ') {
-			s++;
-			continue;
-		}
-
-		if ((INT64_MAX - 64) / base <= val) {
-			// TODO: error message
-			return INT64_MAX;
-		}
-
-		val *= base;
-		val += _digit_val(*s);
-		s++;
-	}
-
-	return val;
-}
-
-bool tar_info(const uint8_t *start, const uint8_t *end,
-    const char **name, size_t *length)
-{
-	if (end - start < TAR_BLOCK_SIZE) {
-		// TODO: error message
-		return false;
-	}
-
-	const tar_header_raw_t *h = (const tar_header_raw_t *) start;
-	if (h->filename[0] == '\0')
-		return false;
-
-	ptrdiff_t len = _parse_size(h->size, sizeof(h->size), 8);
-
-	if (end - start < TAR_BLOCK_SIZE + len) {
-		// TODO: error message
-		return false;
-	}
-
-	*name = h->filename;
-	*length = len;
-	return true;
-}
Index: ot/generic/src/version.c
===================================================================
--- boot/generic/src/version.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <version.h>
-#include <printf.h>
-#include <macros.h>
-
-static const char *project = "HelenOS bootloader";
-static const char *copyright = STRING(HELENOS_COPYRIGHT);
-static const char *release = STRING(HELENOS_RELEASE);
-static const char *name = STRING(HELENOS_CODENAME);
-static const char *arch = STRING(KARCH);
-
-#ifdef REVISION
-static const char *revision = ", revision " STRING(REVISION);
-#else
-static const char *revision = "";
-#endif
-
-#ifdef TIMESTAMP
-static const char *timestamp = " on " STRING(TIMESTAMP);
-#else
-static const char *timestamp = "";
-#endif
-
-void version_print(void)
-{
-	printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n",
-	    project, release, name, revision, timestamp, arch, copyright);
-}
Index: ot/generic/src/vprintf.c
===================================================================
--- boot/generic/src/vprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stddef.h>
-#include <printf.h>
-#include <printf_core.h>
-#include <putchar.h>
-#include <str.h>
-
-static errno_t vprintf_str_write(const char *str, size_t size, void *data)
-{
-	size_t offset = 0;
-
-	while (offset < size)
-		putuchar(str_decode(str, &offset, size));
-
-	return EOK;
-}
-
-int puts(const char *str)
-{
-	size_t offset = 0;
-	size_t chars = 0;
-	char32_t uc;
-
-	while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) {
-		putuchar(uc);
-		chars++;
-	}
-
-	putuchar('\n');
-	return chars;
-}
-
-int vprintf(const char *fmt, va_list ap)
-{
-	printf_spec_t ps = {
-		vprintf_str_write,
-		NULL
-	};
-
-	return printf_core(fmt, &ps, ap);
-}
-
-/** @}
- */
Index: ot/grub/amd64-efi
===================================================================
--- boot/grub/amd64-efi	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-ia32-efi
Index: ot/grub/amd64-pc
===================================================================
--- boot/grub/amd64-pc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-ia32-pc
Index: ot/grub/arm64-efi/COPYING
===================================================================
--- boot/grub/arm64-efi/COPYING	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,674 +1,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: ot/grub/arm64-efi/README
===================================================================
--- boot/grub/arm64-efi/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-The binary files of GRUB boot loader in this directory have been created
-by compiling GRUB for the 'arm64-efi' target and then using the grub-mkrescue
-script to create the El Torito boot image.
-
-For licensing terms of GRUB boot loader see the file COPYING contained
-in this directory. Full version of GRUB, including its source code,
-can be downloaded from GRUB's project page:
-
-http://www.gnu.org/software/grub/
Index: ot/grub/arm64-efi/REVISION
===================================================================
--- boot/grub/arm64-efi/REVISION	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bc220962e366b1b46769ed6f9fa5be603ba58ab5
Index: ot/grub/arm64-efi/arm64-efi/command.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/command.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-*acpi: acpi
-*all_functional_test: functional_test
-*background_image: gfxterm_background
-*cat: cat
-*crc: hashsum
-*cryptomount: cryptodisk
-*echo: echo
-*extract_syslinux_entries_configfile: syslinuxcfg
-*extract_syslinux_entries_source: syslinuxcfg
-*file: file
-*functional_test: functional_test
-*gettext: gettext
-*hashsum: hashsum
-*hello: hello
-*help: help
-*hexdump: hexdump
-*keystatus: keystatus
-*list_env: loadenv
-*load_env: loadenv
-*loopback: loopback
-*ls: ls
-*lsacpi: lsacpi
-*md5sum: hashsum
-*menuentry: normal
-*probe: probe
-*read_byte: memrw
-*read_dword: memrw
-*read_word: memrw
-*regexp: regexp
-*save_env: loadenv
-*search: search
-*serial: serial
-*sha1sum: hashsum
-*sha256sum: hashsum
-*sha512sum: hashsum
-*sleep: sleep
-*submenu: normal
-*syslinux_configfile: syslinuxcfg
-*syslinux_source: syslinuxcfg
-*terminfo: terminfo
-*test_blockarg: test_blockarg
-*testspeed: testspeed
-*tr: tr
-*trust: verify
-*verify_detached: verify
-*zfskey: zfscrypt
-.: configfile
-[: test
-authenticate: normal
-background_color: gfxterm_background
-badram: mmap
-blocklist: blocklist
-boot: boot
-break: normal
-cat: minicmd
-chainloader: chain
-clear: normal
-cmp: cmp
-configfile: configfile
-continue: normal
-cutmem: mmap
-date: date
-devicetree: fdt
-distrust: verify
-dump: minicmd
-eval: eval
-exit: minicmd
-export: normal
-extract_entries_configfile: configfile
-extract_entries_source: configfile
-false: true
-fwsetup: efifwsetup
-gptsync: gptsync
-halt: halt
-help: minicmd
-initrd: linux
-linux: linux
-list_trusted: verify
-loadfont: font
-lsefi: lsefi
-lsefimmap: lsefimmap
-lsefisystab: lsefisystab
-lsfonts: font
-lsmmap: lsmmap
-lsmod: minicmd
-lssal: lssal
-macppcbless: macbless
-mactelbless: macbless
-net_add_addr: net
-net_add_dns: net
-net_add_route: net
-net_bootp: net
-net_del_addr: net
-net_del_dns: net
-net_del_route: net
-net_get_dhcp_option: net
-net_ipv6_autoconf: net
-net_ls_addr: net
-net_ls_cards: net
-net_ls_dns: net
-net_ls_routes: net
-net_nslookup: net
-normal: normal
-normal_exit: normal
-parttool: parttool
-password: password
-password_pbkdf2: password_pbkdf2
-read: read
-reboot: reboot
-return: normal
-rmmod: minicmd
-search.file: search_fs_file
-search.fs_label: search_label
-search.fs_uuid: search_fs_uuid
-setparams: normal
-shift: normal
-source: configfile
-terminal_input: terminal
-terminal_output: terminal
-test: test
-testload: testload
-time: time
-true: true
-videoinfo: videoinfo
-videotest: videotest
-write_byte: memrw
-write_dword: memrw
-write_word: memrw
-xen_hypervisor: xen_boot
-xen_module: xen_boot
-xnu_uuid: xnu_uuid
-zfs-bootfs: zfsinfo
-zfsinfo: zfsinfo
Index: ot/grub/arm64-efi/arm64-efi/crypto.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/crypto.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-RIJNDAEL: gcry_rijndael
-RIJNDAEL192: gcry_rijndael
-RIJNDAEL256: gcry_rijndael
-AES128: gcry_rijndael
-AES-128: gcry_rijndael
-AES-192: gcry_rijndael
-AES-256: gcry_rijndael
-ADLER32: adler32
-CRC64: crc64
-ARCFOUR: gcry_arcfour
-BLOWFISH: gcry_blowfish
-CAMELLIA128: gcry_camellia
-CAMELLIA192: gcry_camellia
-CAMELLIA256: gcry_camellia
-CAST5: gcry_cast5
-CRC32: gcry_crc
-CRC32RFC1510: gcry_crc
-CRC24RFC2440: gcry_crc
-DES: gcry_des
-3DES: gcry_des
-DSA: gcry_dsa
-IDEA: gcry_idea
-MD4: gcry_md4
-MD5: gcry_md5
-RFC2268_40: gcry_rfc2268
-AES: gcry_rijndael
-AES192: gcry_rijndael
-AES256: gcry_rijndael
-RIPEMD160: gcry_rmd160
-RSA: gcry_rsa
-SEED: gcry_seed
-SERPENT128: gcry_serpent
-SERPENT192: gcry_serpent
-SERPENT256: gcry_serpent
-SHA1: gcry_sha1
-SHA224: gcry_sha256
-SHA256: gcry_sha256
-SHA512: gcry_sha512
-SHA384: gcry_sha512
-TIGER192: gcry_tiger
-TIGER: gcry_tiger
-TIGER2: gcry_tiger
-TWOFISH: gcry_twofish
-TWOFISH128: gcry_twofish
-WHIRLPOOL: gcry_whirlpool
Index: ot/grub/arm64-efi/arm64-efi/fs.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/fs.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-affs
-afs
-bfs
-btrfs
-cbfs
-cpio
-cpio_be
-exfat
-ext2
-fat
-hfs
-hfsplus
-iso9660
-jfs
-minix
-minix2
-minix2_be
-minix3
-minix3_be
-minix_be
-newc
-nilfs2
-ntfs
-odc
-procfs
-reiserfs
-romfs
-sfs
-squash4
-tar
-udf
-ufs1
-ufs1_be
-ufs2
-xfs
-zfs
Index: ot/grub/arm64-efi/arm64-efi/gdb_grub
===================================================================
--- boot/grub/arm64-efi/arm64-efi/gdb_grub	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-###
-### Load debuging information about GNU GRUB 2 modules into GDB
-### automatically. Needs readelf, Perl and gmodule.pl script
-###
-### Has to be launched from the writable and trusted
-### directory containing *.image and *.module
-###
-### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-# Add section numbers and addresses to .segments.tmp
-define dump_module_sections
-	set $mod = $arg0
-
-	# FIXME: save logging status
-	set logging file .segments.tmp
-	set logging redirect on
-	set logging overwrite off
-	set logging on
-
-	printf "%s", $mod->name
-	set $segment = $mod->segment
-	while ($segment)
-		printf " %i 0x%lx", $segment->section, $segment->addr
-		set $segment = $segment->next
-	end
-	printf "\n"
-
-	set logging off
-	# FIXME: restore logging status
-end
-document dump_module_sections
-	Gather information about module whose mod structure was
-	given for use with match_and_load_symbols
-end
-
-# Generate and execute GDB commands and delete temporary files
-# afterwards
-define match_and_load_symbols
-	shell perl gmodule.pl <.segments.tmp >.loadsym.gdb
-	source .loadsym.gdb
-	shell rm -f .segments.tmp .loadsym.gdb
-end
-document match_and_load_symbols
-	Launch script, that matches section names with information
-	generated by dump_module_sections and load debugging info
-	apropriately
-end
-
-###
-
-define load_module
-	dump_module_sections $arg0
-	match_and_load_symbols
-end
-document load_module
-	Load debugging information for module given as argument.
-end
-
-define load_all_modules
-	set $this = grub_dl_head
-	while ($this != 0)
-		dump_module_sections $this
-		set $this = $this->next
-	end
-	match_and_load_symbols
-end
-document load_all_modules
-	Load debugging information for all loaded modules.
-end
-
-###
-
-set confirm off
-file kernel.exec
-target remote :1234
-
-# inform when module is loaded
-break grub_dl_add
-commands
-	silent
-	load_module mod
-	cont
-end
Index: ot/grub/arm64-efi/arm64-efi/gmodule.pl
===================================================================
--- boot/grub/arm64-efi/arm64-efi/gmodule.pl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-###
-### Generate GDB commands, that load symbols for specified module,
-### with proper section relocations. See .gdbinit
-###
-### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-use strict;
-
-while (<>) {
-	my ($name, %sections) = split;
-
-	print "add-symbol-file $name.module";
-
-	open (READELF, "readelf -S $name.mod |") or die;
-	while (<READELF>) {
-		/\[\s*(\d+)\]\s+(\.\S+)/ or next;
-
-		if ($2 eq '.text') {
-			print " $sections{$1}";
-			next;
-		}
-
-		print " -s $2 $sections{$1}"
-			if ($sections{$1} ne '0x0' and $sections{$1} ne '');
-	};
-	close (READELF);
-	print "\n";
-}
Index: ot/grub/arm64-efi/arm64-efi/moddep.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/moddep.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,210 +1,0 @@
-videotest: font video gfxmenu
-odc: archelp
-loopback: extcmd
-macho:
-gcry_des: crypto
-memrw: extcmd
-terminfo: extcmd
-part_gpt:
-romfs: fshelp
-read:
-lsefimmap:
-gcry_arcfour: crypto
-tftp: net priority_queue
-newc: archelp
-minix2_be:
-elf:
-videotest_checksum: font functional_test video_fb
-password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
-gcry_seed: crypto
-sfs: fshelp
-reiserfs: fshelp
-part_sunpc:
-gfxmenu: video_colors trig bitmap_scale gfxterm font normal video bitmap
-jfs:
-help: extcmd normal
-configfile: normal
-gfxterm_menu: font functional_test procfs normal video_fb
-gcry_idea: crypto
-tr: extcmd
-shift_test: functional_test
-afs: fshelp
-xzio: crypto
-syslinuxcfg: extcmd normal
-search_fs_file:
-test_blockarg: extcmd normal
-xen_boot: linux boot fdt
-true:
-affs: fshelp
-iso9660: fshelp
-exfat: fshelp
-setjmp_test: functional_test setjmp
-gfxterm: font video
-fdt:
-efinet: net
-disk:
-xfs: fshelp
-testspeed: extcmd normal
-cpio_be: archelp
-functional_test: btrfs extcmd video video_fb
-bswap_test: functional_test
-sleep: extcmd normal
-memdisk:
-gcry_rijndael: crypto
-mdraid09_be: diskfilter
-gettext:
-gcry_sha1: crypto
-hfspluscomp: gzio hfsplus
-cmp:
-offsetio:
-file: macho elf extcmd offsetio
-video_colors:
-hashsum: crypto extcmd normal
-halt:
-gfxterm_background: video_colors bitmap_scale gfxterm extcmd video bitmap
-search_fs_uuid:
-gcry_dsa: verify mpi
-keystatus: extcmd
-linux: boot fdt
-geli: cryptodisk crypto gcry_sha512 pbkdf2 gcry_sha256
-cmdline_cat_test: font functional_test procfs normal video_fb
-part_sun:
-pbkdf2_test: functional_test pbkdf2 gcry_sha1
-bufio:
-bfs: fshelp
-gcry_blowfish: crypto
-test:
-nilfs2: fshelp
-gcry_rsa: verify mpi
-cryptodisk: crypto extcmd procfs
-minicmd:
-signature_test: functional_test procfs
-udf: fshelp
-gzio:
-xnu_uuid: gcry_md5
-mul_test: functional_test
-adler32: crypto
-terminal:
-div:
-crypto:
-part_bsd: part_msdos
-gcry_sha512: crypto
-password: crypto normal
-fshelp:
-sleep_test: functional_test datetime
-mmap:
-exfctest: functional_test
-zfsinfo: zfs
-ldm: part_gpt diskfilter part_msdos
-eval: normal
-part_dvh:
-lssal:
-ext2: fshelp
-blocklist:
-net: priority_queue bufio datetime boot
-part_acorn:
-videoinfo: video
-btrfs: lzopio gzio
-lsmmap: mmap
-bitmap:
-ntfs: fshelp
-gcry_crc: crypto
-png: bufio bitmap
-jpeg: bufio bitmap
-macbless: disk
-div_test: functional_test div
-regexp: extcmd normal
-parttool: normal
-cpio: archelp
-gcry_rmd160: crypto
-fat: fshelp
-ufs1_be:
-archelp:
-raid6rec: diskfilter
-http: net
-zfs: gzio
-lsefisystab:
-minix2:
-lsacpi: extcmd acpi
-datehook: datetime normal
-loadenv: disk extcmd
-bitmap_scale: bitmap
-probe: extcmd
-minix3:
-tar: archelp
-hfs: fshelp
-procfs: archelp
-boot:
-progress: normal
-kernel:
-acpi: extcmd mmap
-tga: bufio bitmap
-reboot:
-serial: extcmd terminfo
-zfscrypt: crypto pbkdf2 zfs extcmd gcry_sha1 gcry_rijndael
-dm_nv: diskfilter
-cmp_test: functional_test
-luks: cryptodisk crypto pbkdf2
-font: bufio video
-raid5rec: diskfilter
-crc64: crypto
-datetime:
-efifwsetup: reboot
-ctz_test: functional_test
-video:
-hfsplus: fshelp
-gcry_cast5: crypto
-extcmd:
-squash4: fshelp lzopio xzio gzio
-part_plan:
-minix_be:
-gcry_whirlpool: crypto
-gcry_tiger: crypto
-search: search_fs_uuid search_fs_file extcmd search_label
-video_fb:
-verify: crypto extcmd mpi gcry_sha1
-minix3_be:
-trig:
-msdospart: disk parttool
-priority_queue:
-gcry_twofish: crypto
-part_dfly:
-xnu_uuid_test: functional_test
-diskfilter:
-testload:
-part_apple:
-hexdump: extcmd
-date: datetime normal
-pbkdf2: crypto
-gcry_sha256: crypto
-ls: extcmd normal
-ntfscomp: ntfs
-lzopio: crypto
-hello: extcmd
-scsi:
-cat: extcmd
-normal: terminal crypto bufio extcmd boot gettext
-ufs1:
-mdraid09: diskfilter
-lvm: diskfilter
-chain: net efinet boot
-cbfs: archelp
-ufs2:
-time:
-gptsync: disk
-search_label:
-setjmp:
-gcry_rfc2268: crypto
-mdraid1x: diskfilter
-mpi: crypto
-part_amiga:
-efi_gop: video video_fb
-minix:
-echo: extcmd
-lsefi:
-gcry_serpent: crypto
-gcry_md4: crypto
-gcry_md5: crypto
-part_msdos:
-gcry_camellia: crypto
-all_video: efi_gop
Index: ot/grub/arm64-efi/arm64-efi/modinfo.sh
===================================================================
--- boot/grub/arm64-efi/arm64-efi/modinfo.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#!/bin/sh
-
-# User-controllable options
-grub_modinfo_target_cpu=arm64
-grub_modinfo_platform=efi
-grub_disk_cache_stats=0
-grub_boot_time_stats=0
-grub_have_font_source=1
-
-# Autodetected config
-grub_have_asm_uscore=0
-grub_bss_start_symbol=""
-grub_end_symbol=""
-
-# Build environment
-grub_target_cc='aarch64-linux-gnu-gcc'
-grub_target_cc_version='aarch64-linux-gnu-gcc (Linaro GCC 6.3-2017.02) 6.3.1 20170109'
-grub_target_cflags=' -Os -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wcast-align  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -freg-struct-return -mgeneral-regs-only -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables -fno-unwind-tables -Qn -fno-stack-protector -Wtrampolines'
-grub_target_cppflags=' -Wall -W  -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=ARM64_EFI -nostdinc -isystem /home/setup/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../lib/gcc/aarch64-linux-gnu/6.3.1/include -I$(top_srcdir)/include -I$(top_builddir)/include'
-grub_target_ccasflags=' -g  -mgeneral-regs-only'
-grub_target_ldflags=' -Wl,--build-id=none'
-grub_cflags=''
-grub_cppflags=' -D_FILE_OFFSET_BITS=64'
-grub_ccasflags=''
-grub_ldflags=''
-grub_target_strip='aarch64-linux-gnu-strip'
-grub_target_nm='aarch64-linux-gnu-nm'
-grub_target_ranlib='aarch64-linux-gnu-ranlib'
-grub_target_objconf=''
-grub_target_obj2elf=''
-grub_target_img_base_ldopt='-Wl,-Ttext'
-grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@'
-
-# Version
-grub_version="2.02~beta2"
-grub_package="grub"
-grub_package_string="GRUB 2.02~beta2"
-grub_package_version="2.02~beta2"
-grub_package_name="GRUB"
-grub_package_bugreport="bug-grub@gnu.org"
Index: ot/grub/arm64-efi/arm64-efi/partmap.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/partmap.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-part_acorn
-part_amiga
-part_apple
-part_bsd
-part_dfly
-part_dvh
-part_gpt
-part_msdos
-part_plan
-part_sun
-part_sunpc
Index: ot/grub/arm64-efi/arm64-efi/parttool.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/parttool.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-msdos: msdospart
Index: ot/grub/arm64-efi/arm64-efi/terminal.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/terminal.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-iserial_*: serial
-ogfxterm: gfxterm
-oserial_*: serial
Index: ot/grub/arm64-efi/arm64-efi/video.lst
===================================================================
--- boot/grub/arm64-efi/arm64-efi/video.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-efi_gop
Index: ot/grub/build_dist.sh.in
===================================================================
--- boot/grub/build_dist.sh.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-DIST_DIR="$1"
-GRUB_DIR="$2"
-GRUB_CFG="$3"
-
-# TODO: keep the original and compare them
-rm -rf ${DIST_DIR}
-
-mkdir -p ${DIST_DIR}/boot/grub
-cp -r -L -t ${DIST_DIR}/boot/grub ${GRUB_DIR}/*
-cp ${GRUB_CFG} ${DIST_DIR}/boot/grub
-
-gunzip -q ${DIST_DIR}/boot/grub/*.gz || true
-
-@text@
Index: ot/grub/grub.cfg.in
===================================================================
--- boot/grub/grub.cfg.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-set default=0
-set timeout=10
-
-@INSMODS@
-
-menuentry 'HelenOS @RELEASE@' --class helenos --class os {
-	@LOADS@
-}
Index: ot/grub/ia32-efi/COPYING
===================================================================
--- boot/grub/ia32-efi/COPYING	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,674 +1,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: ot/grub/ia32-efi/README
===================================================================
--- boot/grub/ia32-efi/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,12 +1,0 @@
-The binary files of GRUB boot loader in this directory have been created
-by compiling GRUB for the 'i386-efi' and 'x86_64-efi' targets. The combined
-32bit and 64bit EFI boot floppy image was created by modifying the
-i386-grub-mkrescue and x86_64-grub-mkrescue scripts to create EFI payloads
-which search for the bootable ISO image with the volume label
-'HelenOS boot ISO'.
-
-For licensing terms of GRUB boot loader see the file COPYING contained
-in this directory. Full version of GRUB, including its source code,
-can be downloaded from GRUB's project page:
-
-http://www.gnu.org/software/grub/
Index: ot/grub/ia32-efi/REVISION
===================================================================
--- boot/grub/ia32-efi/REVISION	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bc220962e366b1b46769ed6f9fa5be603ba58ab5
Index: ot/grub/ia32-efi/i386-efi/command.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/command.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-*acpi: acpi
-*all_functional_test: functional_test
-*background_image: gfxterm_background
-*cat: cat
-*cpuid: cpuid
-*crc: hashsum
-*cryptomount: cryptodisk
-*echo: echo
-*extract_syslinux_entries_configfile: syslinuxcfg
-*extract_syslinux_entries_source: syslinuxcfg
-*file: file
-*functional_test: functional_test
-*gettext: gettext
-*hashsum: hashsum
-*hdparm: hdparm
-*hello: hello
-*help: help
-*hexdump: hexdump
-*inb: iorw
-*inl: iorw
-*inw: iorw
-*keystatus: keystatus
-*kfreebsd: bsd
-*knetbsd: bsd
-*kopenbsd: bsd
-*list_env: loadenv
-*load_env: loadenv
-*loopback: loopback
-*ls: ls
-*lsacpi: lsacpi
-*lspci: lspci
-*md5sum: hashsum
-*menuentry: normal
-*pcidump: pcidump
-*probe: probe
-*read_byte: memrw
-*read_dword: memrw
-*read_word: memrw
-*regexp: regexp
-*save_env: loadenv
-*search: search
-*serial: serial
-*setpci: setpci
-*sha1sum: hashsum
-*sha256sum: hashsum
-*sha512sum: hashsum
-*sleep: sleep
-*submenu: normal
-*syslinux_configfile: syslinuxcfg
-*syslinux_source: syslinuxcfg
-*terminfo: terminfo
-*test_blockarg: test_blockarg
-*testspeed: testspeed
-*tr: tr
-*trust: verify
-*verify_detached: verify
-*xnu_splash: xnu
-*zfskey: zfscrypt
-.: configfile
-[: test
-appleloader: appleldr
-authenticate: normal
-background_color: gfxterm_background
-backtrace: backtrace
-badram: mmap
-blocklist: blocklist
-boot: boot
-break: normal
-cat: minicmd
-cbmemc: cbmemc
-chainloader: chain
-clear: normal
-cmp: cmp
-configfile: configfile
-continue: normal
-coreboot_boottime: cbtime
-cutmem: mmap
-date: date
-distrust: verify
-dump: minicmd
-eval: eval
-exit: minicmd
-export: normal
-extract_entries_configfile: configfile
-extract_entries_source: configfile
-extract_legacy_entries_configfile: legacycfg
-extract_legacy_entries_source: legacycfg
-fakebios: loadbios
-false: true
-fix_video: fixvideo
-fwsetup: efifwsetup
-gdbstub: gdb
-gdbstub_break: gdb
-gdbstub_stop: gdb
-gptsync: gptsync
-halt: halt
-help: minicmd
-hexdump_random: random
-initrd16: linux16
-initrd: linux
-keymap: keylayouts
-kfreebsd_loadenv: bsd
-kfreebsd_module: bsd
-kfreebsd_module_elf: bsd
-knetbsd_module: bsd
-knetbsd_module_elf: bsd
-kopenbsd_ramdisk: bsd
-legacy_check_password: legacycfg
-legacy_configfile: legacycfg
-legacy_initrd: legacycfg
-legacy_initrd_nounzip: legacycfg
-legacy_kernel: legacycfg
-legacy_password: legacycfg
-legacy_source: legacycfg
-linux16: linux16
-linux: linux
-list_trusted: verify
-loadbios: loadbios
-loadfont: font
-lscoreboot: cbls
-lsefi: lsefi
-lsefimmap: lsefimmap
-lsefisystab: lsefisystab
-lsfonts: font
-lsmmap: lsmmap
-lsmod: minicmd
-lssal: lssal
-macppcbless: macbless
-mactelbless: macbless
-module2: multiboot2
-module: multiboot
-multiboot2: multiboot2
-multiboot: multiboot
-nativedisk: nativedisk
-net_add_addr: net
-net_add_dns: net
-net_add_route: net
-net_bootp: net
-net_del_addr: net
-net_del_dns: net
-net_del_route: net
-net_get_dhcp_option: net
-net_ipv6_autoconf: net
-net_ls_addr: net
-net_ls_cards: net
-net_ls_dns: net
-net_ls_routes: net
-net_nslookup: net
-normal: normal
-normal_exit: normal
-outb: iorw
-outl: iorw
-outw: iorw
-parttool: parttool
-password: password
-password_pbkdf2: password_pbkdf2
-play: play
-read: read
-reboot: reboot
-return: normal
-rmmod: minicmd
-search.file: search_fs_file
-search.fs_label: search_label
-search.fs_uuid: search_fs_uuid
-setparams: normal
-shift: normal
-source: configfile
-terminal_input: terminal
-terminal_output: terminal
-test: test
-testload: testload
-time: time
-true: true
-usb: usbtest
-videoinfo: videoinfo
-videotest: videotest
-write_byte: memrw
-write_dword: memrw
-write_word: memrw
-xnu_devprop_load: xnu
-xnu_kernel64: xnu
-xnu_kernel: xnu
-xnu_kext: xnu
-xnu_kextdir: xnu
-xnu_mkext: xnu
-xnu_ramdisk: xnu
-xnu_resume: xnu
-xnu_uuid: xnu_uuid
-zfs-bootfs: zfsinfo
-zfsinfo: zfsinfo
Index: ot/grub/ia32-efi/i386-efi/crypto.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/crypto.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-RIJNDAEL: gcry_rijndael
-RIJNDAEL192: gcry_rijndael
-RIJNDAEL256: gcry_rijndael
-AES128: gcry_rijndael
-AES-128: gcry_rijndael
-AES-192: gcry_rijndael
-AES-256: gcry_rijndael
-ADLER32: adler32
-CRC64: crc64
-ARCFOUR: gcry_arcfour
-BLOWFISH: gcry_blowfish
-CAMELLIA128: gcry_camellia
-CAMELLIA192: gcry_camellia
-CAMELLIA256: gcry_camellia
-CAST5: gcry_cast5
-CRC32: gcry_crc
-CRC32RFC1510: gcry_crc
-CRC24RFC2440: gcry_crc
-DES: gcry_des
-3DES: gcry_des
-DSA: gcry_dsa
-IDEA: gcry_idea
-MD4: gcry_md4
-MD5: gcry_md5
-RFC2268_40: gcry_rfc2268
-AES: gcry_rijndael
-AES192: gcry_rijndael
-AES256: gcry_rijndael
-RIPEMD160: gcry_rmd160
-RSA: gcry_rsa
-SEED: gcry_seed
-SERPENT128: gcry_serpent
-SERPENT192: gcry_serpent
-SERPENT256: gcry_serpent
-SHA1: gcry_sha1
-SHA224: gcry_sha256
-SHA256: gcry_sha256
-SHA512: gcry_sha512
-SHA384: gcry_sha512
-TIGER192: gcry_tiger
-TIGER: gcry_tiger
-TIGER2: gcry_tiger
-TWOFISH: gcry_twofish
-TWOFISH128: gcry_twofish
-WHIRLPOOL: gcry_whirlpool
Index: ot/grub/ia32-efi/i386-efi/fs.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/fs.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-affs
-afs
-bfs
-btrfs
-cbfs
-cpio
-cpio_be
-exfat
-ext2
-fat
-hfs
-hfsplus
-iso9660
-jfs
-minix
-minix2
-minix2_be
-minix3
-minix3_be
-minix_be
-newc
-nilfs2
-ntfs
-odc
-procfs
-reiserfs
-romfs
-sfs
-squash4
-tar
-udf
-ufs1
-ufs1_be
-ufs2
-xfs
-zfs
Index: ot/grub/ia32-efi/i386-efi/gdb_grub
===================================================================
--- boot/grub/ia32-efi/i386-efi/gdb_grub	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-###
-### Load debuging information about GNU GRUB 2 modules into GDB
-### automatically. Needs readelf, Perl and gmodule.pl script
-###
-### Has to be launched from the writable and trusted
-### directory containing *.image and *.module
-###
-### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-# Add section numbers and addresses to .segments.tmp
-define dump_module_sections
-	set $mod = $arg0
-
-	# FIXME: save logging status
-	set logging file .segments.tmp
-	set logging redirect on
-	set logging overwrite off
-	set logging on
-
-	printf "%s", $mod->name
-	set $segment = $mod->segment
-	while ($segment)
-		printf " %i 0x%lx", $segment->section, $segment->addr
-		set $segment = $segment->next
-	end
-	printf "\n"
-
-	set logging off
-	# FIXME: restore logging status
-end
-document dump_module_sections
-	Gather information about module whose mod structure was
-	given for use with match_and_load_symbols
-end
-
-# Generate and execute GDB commands and delete temporary files
-# afterwards
-define match_and_load_symbols
-	shell perl gmodule.pl <.segments.tmp >.loadsym.gdb
-	source .loadsym.gdb
-	shell rm -f .segments.tmp .loadsym.gdb
-end
-document match_and_load_symbols
-	Launch script, that matches section names with information
-	generated by dump_module_sections and load debugging info
-	apropriately
-end
-
-###
-
-define load_module
-	dump_module_sections $arg0
-	match_and_load_symbols
-end
-document load_module
-	Load debugging information for module given as argument.
-end
-
-define load_all_modules
-	set $this = grub_dl_head
-	while ($this != 0)
-		dump_module_sections $this
-		set $this = $this->next
-	end
-	match_and_load_symbols
-end
-document load_all_modules
-	Load debugging information for all loaded modules.
-end
-
-###
-
-set confirm off
-file kernel.exec
-target remote :1234
-
-# inform when module is loaded
-break grub_dl_add
-commands
-	silent
-	load_module mod
-	cont
-end
Index: ot/grub/ia32-efi/i386-efi/gmodule.pl
===================================================================
--- boot/grub/ia32-efi/i386-efi/gmodule.pl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-###
-### Generate GDB commands, that load symbols for specified module,
-### with proper section relocations. See .gdbinit
-###
-### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-use strict;
-
-while (<>) {
-	my ($name, %sections) = split;
-
-	print "add-symbol-file $name.module";
-
-	open (READELF, "readelf -S $name.mod |") or die;
-	while (<READELF>) {
-		/\[\s*(\d+)\]\s+(\.\S+)/ or next;
-
-		if ($2 eq '.text') {
-			print " $sections{$1}";
-			next;
-		}
-
-		print " -s $2 $sections{$1}"
-			if ($sections{$1} ne '0x0' and $sections{$1} ne '');
-	};
-	close (READELF);
-	print "\n";
-}
Index: ot/grub/ia32-efi/i386-efi/moddep.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/moddep.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-videotest: font video gfxmenu
-odc: archelp
-loopback: extcmd
-macho:
-gcry_des: crypto
-memrw: extcmd
-terminfo: extcmd
-part_gpt:
-romfs: fshelp
-read:
-lsefimmap:
-aout:
-gcry_arcfour: crypto
-tftp: net priority_queue
-newc: archelp
-minix2_be:
-elf:
-videotest_checksum: font functional_test video_fb
-password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
-gcry_seed: crypto
-pcidump: extcmd
-bsd: elf serial crypto gcry_md5 extcmd video boot aout cpuid relocator mmap
-sfs: fshelp
-reiserfs: fshelp
-part_sunpc:
-gfxmenu: video_colors trig bitmap_scale gfxterm font normal video bitmap
-backtrace:
-jfs:
-help: extcmd normal
-configfile: normal
-cbls: cbtable
-gfxterm_menu: font functional_test procfs normal video_fb
-gcry_idea: crypto
-tr: extcmd
-shift_test: functional_test
-ohci: cs5536 usb boot
-afs: fshelp
-spkmodem: terminfo
-usb_keyboard: usb keylayouts
-xzio: crypto
-syslinuxcfg: extcmd normal
-search_fs_file:
-usbms: scsi usb
-test_blockarg: extcmd normal
-true:
-affs: fshelp
-iso9660: fshelp
-exfat: fshelp
-setjmp_test: functional_test setjmp
-gfxterm: font video
-efinet: net
-disk:
-appleldr: boot
-xfs: fshelp
-testspeed: extcmd normal
-cpio_be: archelp
-functional_test: btrfs extcmd video video_fb
-bswap_test: functional_test
-sleep: extcmd normal
-memdisk:
-gcry_rijndael: crypto
-mdraid09_be: diskfilter
-gettext:
-gcry_sha1: crypto
-hfspluscomp: gzio hfsplus
-cmp:
-random: hexdump
-offsetio:
-file: macho elf extcmd offsetio
-usbserial_usbdebug: serial usb usbserial_common
-video_colors:
-morse:
-hashsum: crypto extcmd normal
-usb:
-halt: acpi
-gdb: serial backtrace
-gfxterm_background: video_colors bitmap_scale gfxterm extcmd video bitmap
-search_fs_uuid:
-gcry_dsa: verify mpi
-keystatus: extcmd
-linux: video boot relocator mmap
-geli: cryptodisk crypto gcry_sha512 pbkdf2 gcry_sha256
-cmdline_cat_test: font functional_test procfs normal video_fb
-part_sun:
-cbtable:
-pbkdf2_test: functional_test pbkdf2 gcry_sha1
-video_bochs: video video_fb
-bufio:
-usbserial_ftdi: serial usb usbserial_common
-legacy_password_test: functional_test legacycfg
-cpuid: extcmd
-bfs: fshelp
-hdparm: extcmd
-gcry_blowfish: crypto
-test:
-nilfs2: fshelp
-gcry_rsa: verify mpi
-cryptodisk: crypto extcmd procfs
-nativedisk:
-minicmd:
-signature_test: functional_test procfs
-ata: scsi
-udf: fshelp
-gzio:
-xnu_uuid: gcry_md5
-uhci: usb
-pata: ata
-mul_test: functional_test
-adler32: crypto
-terminal:
-div:
-ehci: cs5536 usb boot
-crypto:
-part_bsd: part_msdos
-cs5536:
-gcry_sha512: crypto
-password: crypto normal
-fshelp:
-sleep_test: functional_test datetime
-iorw: extcmd
-xnu: macho bitmap_scale random extcmd video bitmap boot relocator mmap
-mmap:
-exfctest: functional_test
-zfsinfo: zfs
-ldm: part_gpt diskfilter part_msdos
-eval: normal
-part_dvh:
-lssal:
-ext2: fshelp
-blocklist:
-net: priority_queue bufio datetime boot
-part_acorn:
-videoinfo: video
-btrfs: lzopio gzio
-lsmmap: mmap
-bitmap:
-ntfs: fshelp
-multiboot: net video boot relocator mmap
-gcry_crc: crypto
-png: bufio bitmap
-jpeg: bufio bitmap
-macbless: disk
-div_test: functional_test div
-regexp: extcmd normal
-parttool: normal
-usbserial_pl2303: serial usb usbserial_common
-cpio: archelp
-gcry_rmd160: crypto
-fat: fshelp
-ufs1_be:
-archelp:
-raid6rec: diskfilter
-http: net
-zfs: gzio
-lsefisystab:
-minix2:
-lsacpi: extcmd acpi
-datehook: datetime normal
-loadenv: disk extcmd
-bitmap_scale: bitmap
-probe: extcmd
-minix3:
-tar: archelp
-loadbios:
-hfs: fshelp
-procfs: archelp
-boot:
-keylayouts:
-progress: normal
-kernel:
-usbtest: usb
-relocator: mmap
-acpi: extcmd mmap
-tga: bufio bitmap
-reboot: relocator
-serial: extcmd terminfo
-zfscrypt: crypto pbkdf2 zfs extcmd gcry_sha1 gcry_rijndael
-efi_uga: video video_fb
-dm_nv: diskfilter
-cmp_test: functional_test
-luks: cryptodisk crypto pbkdf2
-font: bufio video
-raid5rec: diskfilter
-crc64: crypto
-datetime:
-efifwsetup: reboot
-ctz_test: functional_test
-video:
-cbmemc: normal cbtable terminfo
-hfsplus: fshelp
-gcry_cast5: crypto
-extcmd:
-squash4: fshelp lzopio xzio gzio
-part_plan:
-minix_be:
-gcry_whirlpool: crypto
-gcry_tiger: crypto
-fixvideo:
-search: search_fs_uuid search_fs_file extcmd search_label
-lspci: extcmd
-cbtime: cbtable
-video_fb:
-verify: crypto extcmd mpi gcry_sha1
-minix3_be:
-trig:
-msdospart: disk parttool
-priority_queue:
-gcry_twofish: crypto
-part_dfly:
-xnu_uuid_test: functional_test
-diskfilter:
-testload:
-part_apple:
-hexdump: extcmd
-date: datetime normal
-pbkdf2: crypto
-gcry_sha256: crypto
-ls: extcmd normal
-usbserial_common: serial usb
-ntfscomp: ntfs
-lzopio: crypto
-video_cirrus: video video_fb
-hello: extcmd
-scsi:
-cat: extcmd
-ahci: ata boot
-normal: terminal crypto bufio extcmd boot gettext
-linux16: video boot relocator mmap
-ufs1:
-mdraid09: diskfilter
-lvm: diskfilter
-chain: net efinet boot
-cbfs: archelp
-ufs2:
-time:
-setpci: extcmd
-gptsync: disk
-search_label:
-setjmp:
-multiboot2: net video boot relocator mmap acpi
-gcry_rfc2268: crypto
-mdraid1x: diskfilter
-mpi: crypto
-legacycfg: password crypto gcry_md5 normal
-play:
-part_amiga:
-efi_gop: video video_fb
-minix:
-echo: extcmd
-lsefi:
-gcry_serpent: crypto
-gcry_md4: crypto
-gcry_md5: crypto
-part_msdos:
-gcry_camellia: crypto
-at_keyboard: keylayouts boot
-all_video: efi_gop efi_uga video_bochs video_cirrus
Index: ot/grub/ia32-efi/i386-efi/modinfo.sh
===================================================================
--- boot/grub/ia32-efi/i386-efi/modinfo.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#!/bin/sh
-
-# User-controllable options
-grub_modinfo_target_cpu=i386
-grub_modinfo_platform=efi
-grub_disk_cache_stats=0
-grub_boot_time_stats=0
-grub_have_font_source=1
-
-# Autodetected config
-grub_have_asm_uscore=0
-grub_bss_start_symbol="__bss_start"
-grub_end_symbol="end"
-
-# Build environment
-grub_target_cc='gcc'
-grub_target_cc_version='gcc (SUSE Linux) 4.8.5'
-grub_target_cflags=' -Os -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -march=i386 -m32 -falign-jumps=1 -falign-loops=1 -falign-functions=1 -freg-struct-return -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -Qn -fno-stack-protector -Wtrampolines -Werror'
-grub_target_cppflags=' -Wall -W  -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=I386_EFI -m32 -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.8/include -I$(top_srcdir)/include -I$(top_builddir)/include'
-grub_target_ccasflags=' -g  -m32 -msoft-float'
-grub_target_ldflags=' -m32 -Wl,-melf_i386 -Wl,--build-id=none'
-grub_cflags=''
-grub_cppflags=' -D_FILE_OFFSET_BITS=64'
-grub_ccasflags=''
-grub_ldflags=''
-grub_target_strip='strip'
-grub_target_nm='nm'
-grub_target_ranlib='ranlib'
-grub_target_objconf=''
-grub_target_obj2elf=''
-grub_target_img_base_ldopt='-Wl,-Ttext'
-grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@'
-
-# Version
-grub_version="2.02~beta2"
-grub_package="grub"
-grub_package_string="GRUB 2.02~beta2"
-grub_package_version="2.02~beta2"
-grub_package_name="GRUB"
-grub_package_bugreport="bug-grub@gnu.org"
Index: ot/grub/ia32-efi/i386-efi/partmap.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/partmap.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-part_acorn
-part_amiga
-part_apple
-part_bsd
-part_dfly
-part_dvh
-part_gpt
-part_msdos
-part_plan
-part_sun
-part_sunpc
Index: ot/grub/ia32-efi/i386-efi/parttool.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/parttool.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-msdos: msdospart
Index: ot/grub/ia32-efi/i386-efi/terminal.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/terminal.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-iat_keyboard: at_keyboard
-iserial: serial
-iserial_*: serial
-oaudio: morse
-ocbmemc: cbmemc
-ogfxterm: gfxterm
-oserial: serial
-oserial_*: serial
-ospkmodem: spkmodem
Index: ot/grub/ia32-efi/i386-efi/video.lst
===================================================================
--- boot/grub/ia32-efi/i386-efi/video.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-efi_gop
-efi_uga
-video_bochs
-video_cirrus
Index: ot/grub/ia32-efi/x86_64-efi/command.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/command.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,187 +1,0 @@
-*acpi: acpi
-*all_functional_test: functional_test
-*background_image: gfxterm_background
-*cat: cat
-*cpuid: cpuid
-*crc: hashsum
-*cryptomount: cryptodisk
-*echo: echo
-*extract_syslinux_entries_configfile: syslinuxcfg
-*extract_syslinux_entries_source: syslinuxcfg
-*file: file
-*functional_test: functional_test
-*gettext: gettext
-*hashsum: hashsum
-*hdparm: hdparm
-*hello: hello
-*help: help
-*hexdump: hexdump
-*inb: iorw
-*inl: iorw
-*inw: iorw
-*keystatus: keystatus
-*kfreebsd: bsd
-*knetbsd: bsd
-*kopenbsd: bsd
-*list_env: loadenv
-*load_env: loadenv
-*loopback: loopback
-*ls: ls
-*lsacpi: lsacpi
-*lspci: lspci
-*md5sum: hashsum
-*menuentry: normal
-*pcidump: pcidump
-*probe: probe
-*read_byte: memrw
-*read_dword: memrw
-*read_word: memrw
-*regexp: regexp
-*save_env: loadenv
-*search: search
-*serial: serial
-*setpci: setpci
-*sha1sum: hashsum
-*sha256sum: hashsum
-*sha512sum: hashsum
-*sleep: sleep
-*submenu: normal
-*syslinux_configfile: syslinuxcfg
-*syslinux_source: syslinuxcfg
-*terminfo: terminfo
-*test_blockarg: test_blockarg
-*testspeed: testspeed
-*tr: tr
-*trust: verify
-*verify_detached: verify
-*xnu_splash: xnu
-*zfskey: zfscrypt
-.: configfile
-[: test
-appleloader: appleldr
-authenticate: normal
-background_color: gfxterm_background
-backtrace: backtrace
-badram: mmap
-blocklist: blocklist
-boot: boot
-break: normal
-cat: minicmd
-cbmemc: cbmemc
-chainloader: chain
-clear: normal
-cmp: cmp
-configfile: configfile
-continue: normal
-coreboot_boottime: cbtime
-cutmem: mmap
-date: date
-distrust: verify
-dump: minicmd
-eval: eval
-exit: minicmd
-export: normal
-extract_entries_configfile: configfile
-extract_entries_source: configfile
-extract_legacy_entries_configfile: legacycfg
-extract_legacy_entries_source: legacycfg
-fakebios: loadbios
-false: true
-fix_video: fixvideo
-fwsetup: efifwsetup
-gptsync: gptsync
-halt: halt
-help: minicmd
-hexdump_random: random
-initrd16: linux16
-initrd: linux
-keymap: keylayouts
-kfreebsd_loadenv: bsd
-kfreebsd_module: bsd
-kfreebsd_module_elf: bsd
-knetbsd_module: bsd
-knetbsd_module_elf: bsd
-kopenbsd_ramdisk: bsd
-legacy_check_password: legacycfg
-legacy_configfile: legacycfg
-legacy_initrd: legacycfg
-legacy_initrd_nounzip: legacycfg
-legacy_kernel: legacycfg
-legacy_password: legacycfg
-legacy_source: legacycfg
-linux16: linux16
-linux: linux
-list_trusted: verify
-loadbios: loadbios
-loadfont: font
-lscoreboot: cbls
-lsefi: lsefi
-lsefimmap: lsefimmap
-lsefisystab: lsefisystab
-lsfonts: font
-lsmmap: lsmmap
-lsmod: minicmd
-lssal: lssal
-macppcbless: macbless
-mactelbless: macbless
-module2: multiboot2
-module: multiboot
-multiboot2: multiboot2
-multiboot: multiboot
-nativedisk: nativedisk
-net_add_addr: net
-net_add_dns: net
-net_add_route: net
-net_bootp: net
-net_del_addr: net
-net_del_dns: net
-net_del_route: net
-net_get_dhcp_option: net
-net_ipv6_autoconf: net
-net_ls_addr: net
-net_ls_cards: net
-net_ls_dns: net
-net_ls_routes: net
-net_nslookup: net
-normal: normal
-normal_exit: normal
-outb: iorw
-outl: iorw
-outw: iorw
-parttool: parttool
-password: password
-password_pbkdf2: password_pbkdf2
-play: play
-read: read
-reboot: reboot
-return: normal
-rmmod: minicmd
-search.file: search_fs_file
-search.fs_label: search_label
-search.fs_uuid: search_fs_uuid
-setparams: normal
-shift: normal
-source: configfile
-terminal_input: terminal
-terminal_output: terminal
-test: test
-testload: testload
-time: time
-true: true
-usb: usbtest
-videoinfo: videoinfo
-videotest: videotest
-write_byte: memrw
-write_dword: memrw
-write_word: memrw
-xnu_devprop_load: xnu
-xnu_kernel64: xnu
-xnu_kernel: xnu
-xnu_kext: xnu
-xnu_kextdir: xnu
-xnu_mkext: xnu
-xnu_ramdisk: xnu
-xnu_resume: xnu
-xnu_uuid: xnu_uuid
-zfs-bootfs: zfsinfo
-zfsinfo: zfsinfo
Index: ot/grub/ia32-efi/x86_64-efi/crypto.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/crypto.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-RIJNDAEL: gcry_rijndael
-RIJNDAEL192: gcry_rijndael
-RIJNDAEL256: gcry_rijndael
-AES128: gcry_rijndael
-AES-128: gcry_rijndael
-AES-192: gcry_rijndael
-AES-256: gcry_rijndael
-ADLER32: adler32
-CRC64: crc64
-ARCFOUR: gcry_arcfour
-BLOWFISH: gcry_blowfish
-CAMELLIA128: gcry_camellia
-CAMELLIA192: gcry_camellia
-CAMELLIA256: gcry_camellia
-CAST5: gcry_cast5
-CRC32: gcry_crc
-CRC32RFC1510: gcry_crc
-CRC24RFC2440: gcry_crc
-DES: gcry_des
-3DES: gcry_des
-DSA: gcry_dsa
-IDEA: gcry_idea
-MD4: gcry_md4
-MD5: gcry_md5
-RFC2268_40: gcry_rfc2268
-AES: gcry_rijndael
-AES192: gcry_rijndael
-AES256: gcry_rijndael
-RIPEMD160: gcry_rmd160
-RSA: gcry_rsa
-SEED: gcry_seed
-SERPENT128: gcry_serpent
-SERPENT192: gcry_serpent
-SERPENT256: gcry_serpent
-SHA1: gcry_sha1
-SHA224: gcry_sha256
-SHA256: gcry_sha256
-SHA512: gcry_sha512
-SHA384: gcry_sha512
-TIGER192: gcry_tiger
-TIGER: gcry_tiger
-TIGER2: gcry_tiger
-TWOFISH: gcry_twofish
-TWOFISH128: gcry_twofish
-WHIRLPOOL: gcry_whirlpool
Index: ot/grub/ia32-efi/x86_64-efi/fs.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/fs.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-affs
-afs
-bfs
-btrfs
-cbfs
-cpio
-cpio_be
-exfat
-ext2
-fat
-hfs
-hfsplus
-iso9660
-jfs
-minix
-minix2
-minix2_be
-minix3
-minix3_be
-minix_be
-newc
-nilfs2
-ntfs
-odc
-procfs
-reiserfs
-romfs
-sfs
-squash4
-tar
-udf
-ufs1
-ufs1_be
-ufs2
-xfs
-zfs
Index: ot/grub/ia32-efi/x86_64-efi/gdb_grub
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/gdb_grub	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-###
-### Load debuging information about GNU GRUB 2 modules into GDB
-### automatically. Needs readelf, Perl and gmodule.pl script
-###
-### Has to be launched from the writable and trusted
-### directory containing *.image and *.module
-###
-### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-# Add section numbers and addresses to .segments.tmp
-define dump_module_sections
-	set $mod = $arg0
-
-	# FIXME: save logging status
-	set logging file .segments.tmp
-	set logging redirect on
-	set logging overwrite off
-	set logging on
-
-	printf "%s", $mod->name
-	set $segment = $mod->segment
-	while ($segment)
-		printf " %i 0x%lx", $segment->section, $segment->addr
-		set $segment = $segment->next
-	end
-	printf "\n"
-
-	set logging off
-	# FIXME: restore logging status
-end
-document dump_module_sections
-	Gather information about module whose mod structure was
-	given for use with match_and_load_symbols
-end
-
-# Generate and execute GDB commands and delete temporary files
-# afterwards
-define match_and_load_symbols
-	shell perl gmodule.pl <.segments.tmp >.loadsym.gdb
-	source .loadsym.gdb
-	shell rm -f .segments.tmp .loadsym.gdb
-end
-document match_and_load_symbols
-	Launch script, that matches section names with information
-	generated by dump_module_sections and load debugging info
-	apropriately
-end
-
-###
-
-define load_module
-	dump_module_sections $arg0
-	match_and_load_symbols
-end
-document load_module
-	Load debugging information for module given as argument.
-end
-
-define load_all_modules
-	set $this = grub_dl_head
-	while ($this != 0)
-		dump_module_sections $this
-		set $this = $this->next
-	end
-	match_and_load_symbols
-end
-document load_all_modules
-	Load debugging information for all loaded modules.
-end
-
-###
-
-set confirm off
-file kernel.exec
-target remote :1234
-
-# inform when module is loaded
-break grub_dl_add
-commands
-	silent
-	load_module mod
-	cont
-end
Index: ot/grub/ia32-efi/x86_64-efi/gmodule.pl
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/gmodule.pl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-###
-### Generate GDB commands, that load symbols for specified module,
-### with proper section relocations. See .gdbinit
-###
-### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-use strict;
-
-while (<>) {
-	my ($name, %sections) = split;
-
-	print "add-symbol-file $name.module";
-
-	open (READELF, "readelf -S $name.mod |") or die;
-	while (<READELF>) {
-		/\[\s*(\d+)\]\s+(\.\S+)/ or next;
-
-		if ($2 eq '.text') {
-			print " $sections{$1}";
-			next;
-		}
-
-		print " -s $2 $sections{$1}"
-			if ($sections{$1} ne '0x0' and $sections{$1} ne '');
-	};
-	close (READELF);
-	print "\n";
-}
Index: ot/grub/ia32-efi/x86_64-efi/moddep.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/moddep.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-videotest: font video gfxmenu
-odc: archelp
-loopback: extcmd
-macho:
-gcry_des: crypto
-memrw: extcmd
-terminfo: extcmd
-part_gpt:
-romfs: fshelp
-read:
-lsefimmap:
-aout:
-gcry_arcfour: crypto
-tftp: net priority_queue
-newc: archelp
-minix2_be:
-elf:
-videotest_checksum: font functional_test video_fb
-password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
-gcry_seed: crypto
-pcidump: extcmd
-bsd: elf serial crypto gcry_md5 extcmd video boot aout cpuid relocator mmap
-sfs: fshelp
-reiserfs: fshelp
-part_sunpc:
-gfxmenu: video_colors trig bitmap_scale gfxterm font normal video bitmap
-backtrace:
-jfs:
-help: extcmd normal
-configfile: normal
-cbls: cbtable
-gfxterm_menu: font functional_test procfs normal video_fb
-gcry_idea: crypto
-tr: extcmd
-shift_test: functional_test
-ohci: cs5536 usb boot
-afs: fshelp
-spkmodem: terminfo
-usb_keyboard: usb keylayouts
-xzio: crypto
-syslinuxcfg: extcmd normal
-search_fs_file:
-usbms: scsi usb
-test_blockarg: extcmd normal
-true:
-affs: fshelp
-iso9660: fshelp
-exfat: fshelp
-setjmp_test: functional_test setjmp
-gfxterm: font video
-efinet: net
-disk:
-appleldr: boot
-xfs: fshelp
-testspeed: extcmd normal
-cpio_be: archelp
-functional_test: btrfs extcmd video video_fb
-bswap_test: functional_test
-sleep: extcmd normal
-memdisk:
-gcry_rijndael: crypto
-mdraid09_be: diskfilter
-gettext:
-gcry_sha1: crypto
-hfspluscomp: gzio hfsplus
-cmp:
-random: hexdump
-offsetio:
-file: macho elf extcmd offsetio
-usbserial_usbdebug: serial usb usbserial_common
-video_colors:
-morse:
-hashsum: crypto extcmd normal
-usb:
-halt: acpi
-gfxterm_background: video_colors bitmap_scale gfxterm extcmd video bitmap
-search_fs_uuid:
-gcry_dsa: verify mpi
-keystatus: extcmd
-linux: video boot relocator mmap
-geli: cryptodisk crypto gcry_sha512 pbkdf2 gcry_sha256
-cmdline_cat_test: font functional_test procfs normal video_fb
-part_sun:
-cbtable:
-pbkdf2_test: functional_test pbkdf2 gcry_sha1
-video_bochs: video video_fb
-bufio:
-usbserial_ftdi: serial usb usbserial_common
-legacy_password_test: functional_test legacycfg
-cpuid: extcmd
-bfs: fshelp
-hdparm: extcmd
-gcry_blowfish: crypto
-test:
-nilfs2: fshelp
-gcry_rsa: verify mpi
-cryptodisk: crypto extcmd procfs
-nativedisk:
-minicmd:
-signature_test: functional_test procfs
-ata: scsi
-udf: fshelp
-gzio:
-xnu_uuid: gcry_md5
-uhci: usb
-pata: ata
-mul_test: functional_test
-adler32: crypto
-terminal:
-div:
-ehci: cs5536 usb boot
-crypto:
-part_bsd: part_msdos
-cs5536:
-gcry_sha512: crypto
-password: crypto normal
-fshelp:
-sleep_test: functional_test datetime
-iorw: extcmd
-xnu: macho bitmap_scale random extcmd video bitmap boot relocator mmap
-mmap:
-exfctest: functional_test
-zfsinfo: zfs
-ldm: part_gpt diskfilter part_msdos
-eval: normal
-part_dvh:
-lssal:
-ext2: fshelp
-blocklist:
-net: priority_queue bufio datetime boot
-part_acorn:
-videoinfo: video
-btrfs: lzopio gzio
-lsmmap: mmap
-bitmap:
-ntfs: fshelp
-multiboot: net video boot relocator mmap
-gcry_crc: crypto
-png: bufio bitmap
-jpeg: bufio bitmap
-macbless: disk
-div_test: functional_test div
-regexp: extcmd normal
-parttool: normal
-usbserial_pl2303: serial usb usbserial_common
-cpio: archelp
-gcry_rmd160: crypto
-fat: fshelp
-ufs1_be:
-archelp:
-raid6rec: diskfilter
-http: net
-zfs: gzio
-lsefisystab:
-minix2:
-lsacpi: extcmd acpi
-datehook: datetime normal
-loadenv: disk extcmd
-bitmap_scale: bitmap
-probe: extcmd
-minix3:
-tar: archelp
-loadbios:
-hfs: fshelp
-procfs: archelp
-boot:
-keylayouts:
-progress: normal
-kernel:
-usbtest: usb
-relocator: mmap
-acpi: extcmd mmap
-tga: bufio bitmap
-reboot:
-serial: extcmd terminfo
-zfscrypt: crypto pbkdf2 zfs extcmd gcry_sha1 gcry_rijndael
-efi_uga: video video_fb
-dm_nv: diskfilter
-cmp_test: functional_test
-luks: cryptodisk crypto pbkdf2
-font: bufio video
-raid5rec: diskfilter
-crc64: crypto
-datetime:
-efifwsetup: reboot
-ctz_test: functional_test
-video:
-cbmemc: normal cbtable terminfo
-hfsplus: fshelp
-gcry_cast5: crypto
-extcmd:
-squash4: fshelp lzopio xzio gzio
-part_plan:
-minix_be:
-gcry_whirlpool: crypto
-gcry_tiger: crypto
-fixvideo:
-search: search_fs_uuid search_fs_file extcmd search_label
-lspci: extcmd
-cbtime: cbtable
-video_fb:
-verify: crypto extcmd mpi gcry_sha1
-minix3_be:
-trig:
-msdospart: disk parttool
-priority_queue:
-gcry_twofish: crypto
-part_dfly:
-xnu_uuid_test: functional_test
-diskfilter:
-testload:
-part_apple:
-hexdump: extcmd
-date: datetime normal
-pbkdf2: crypto
-gcry_sha256: crypto
-ls: extcmd normal
-usbserial_common: serial usb
-ntfscomp: ntfs
-lzopio: crypto
-video_cirrus: video video_fb
-hello: extcmd
-scsi:
-cat: extcmd
-ahci: ata boot
-normal: terminal crypto bufio extcmd boot gettext
-linux16: video boot relocator mmap
-ufs1:
-mdraid09: diskfilter
-lvm: diskfilter
-chain: net efinet boot
-cbfs: archelp
-ufs2:
-time:
-setpci: extcmd
-gptsync: disk
-search_label:
-setjmp:
-multiboot2: net video boot relocator mmap acpi
-gcry_rfc2268: crypto
-mdraid1x: diskfilter
-mpi: crypto
-legacycfg: password crypto gcry_md5 normal
-play:
-part_amiga:
-efi_gop: video video_fb
-minix:
-echo: extcmd
-lsefi:
-gcry_serpent: crypto
-gcry_md4: crypto
-gcry_md5: crypto
-part_msdos:
-gcry_camellia: crypto
-at_keyboard: keylayouts boot
-all_video: efi_gop efi_uga video_bochs video_cirrus
Index: ot/grub/ia32-efi/x86_64-efi/modinfo.sh
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/modinfo.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#!/bin/sh
-
-# User-controllable options
-grub_modinfo_target_cpu=x86_64
-grub_modinfo_platform=efi
-grub_disk_cache_stats=0
-grub_boot_time_stats=0
-grub_have_font_source=1
-
-# Autodetected config
-grub_have_asm_uscore=0
-grub_bss_start_symbol=""
-grub_end_symbol=""
-
-# Build environment
-grub_target_cc='gcc'
-grub_target_cc_version='gcc (SUSE Linux) 4.8.5'
-grub_target_cflags=' -Os -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -m64 -freg-struct-return -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -mcmodel=large -mno-red-zone -Qn -fno-stack-protector -Wtrampolines -Werror'
-grub_target_cppflags=' -Wall -W  -DGRUB_MACHINE_EFI=1 -DGRUB_MACHINE=X86_64_EFI -m64 -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.8/include -I$(top_srcdir)/include -I$(top_builddir)/include'
-grub_target_ccasflags=' -g  -m64 -msoft-float'
-grub_target_ldflags=' -m64 -Wl,-melf_x86_64 -Wl,--build-id=none'
-grub_cflags=''
-grub_cppflags=' -D_FILE_OFFSET_BITS=64'
-grub_ccasflags=''
-grub_ldflags=''
-grub_target_strip='strip'
-grub_target_nm='nm'
-grub_target_ranlib='ranlib'
-grub_target_objconf=''
-grub_target_obj2elf=''
-grub_target_img_base_ldopt='-Wl,-Ttext'
-grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@'
-
-# Version
-grub_version="2.02~beta2"
-grub_package="grub"
-grub_package_string="GRUB 2.02~beta2"
-grub_package_version="2.02~beta2"
-grub_package_name="GRUB"
-grub_package_bugreport="bug-grub@gnu.org"
Index: ot/grub/ia32-efi/x86_64-efi/partmap.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/partmap.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-part_acorn
-part_amiga
-part_apple
-part_bsd
-part_dfly
-part_dvh
-part_gpt
-part_msdos
-part_plan
-part_sun
-part_sunpc
Index: ot/grub/ia32-efi/x86_64-efi/parttool.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/parttool.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-msdos: msdospart
Index: ot/grub/ia32-efi/x86_64-efi/terminal.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/terminal.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-iat_keyboard: at_keyboard
-iserial: serial
-iserial_*: serial
-oaudio: morse
-ocbmemc: cbmemc
-ogfxterm: gfxterm
-oserial: serial
-oserial_*: serial
-ospkmodem: spkmodem
Index: ot/grub/ia32-efi/x86_64-efi/video.lst
===================================================================
--- boot/grub/ia32-efi/x86_64-efi/video.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-efi_gop
-efi_uga
-video_bochs
-video_cirrus
Index: ot/grub/ia32-pc/COPYING
===================================================================
--- boot/grub/ia32-pc/COPYING	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,674 +1,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: ot/grub/ia32-pc/README
===================================================================
--- boot/grub/ia32-pc/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-The binary files of GRUB boot loader in this directory have been created
-by compiling GRUB for the 'i386-pc' target and then using the grub-mkrescue
-script to create the El Torito boot image.
-
-For licensing terms of GRUB boot loader see the file COPYING contained
-in this directory. Full version of GRUB, including its source code,
-can be downloaded from GRUB's project page:
-
-http://www.gnu.org/software/grub/
Index: ot/grub/ia32-pc/REVISION
===================================================================
--- boot/grub/ia32-pc/REVISION	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bc220962e366b1b46769ed6f9fa5be603ba58ab5
Index: ot/grub/ia32-pc/i386-pc/command.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/command.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,198 +1,0 @@
-*acpi: acpi
-*all_functional_test: functional_test
-*background_image: gfxterm_background
-*cat: cat
-*cpuid: cpuid
-*crc: hashsum
-*cryptomount: cryptodisk
-*drivemap: drivemap
-*echo: echo
-*extract_syslinux_entries_configfile: syslinuxcfg
-*extract_syslinux_entries_source: syslinuxcfg
-*file: file
-*functional_test: functional_test
-*gettext: gettext
-*halt: halt
-*hashsum: hashsum
-*hdparm: hdparm
-*hello: hello
-*help: help
-*hexdump: hexdump
-*inb: iorw
-*inl: iorw
-*inw: iorw
-*keystatus: keystatus
-*kfreebsd: bsd
-*knetbsd: bsd
-*kopenbsd: bsd
-*list_env: loadenv
-*load_env: loadenv
-*loopback: loopback
-*ls: ls
-*lsacpi: lsacpi
-*lspci: lspci
-*md5sum: hashsum
-*menuentry: normal
-*pcidump: pcidump
-*plan9: plan9
-*probe: probe
-*read_byte: memrw
-*read_dword: memrw
-*read_word: memrw
-*regexp: regexp
-*save_env: loadenv
-*search: search
-*sendkey: sendkey
-*serial: serial
-*setpci: setpci
-*sha1sum: hashsum
-*sha256sum: hashsum
-*sha512sum: hashsum
-*sleep: sleep
-*submenu: normal
-*syslinux_configfile: syslinuxcfg
-*syslinux_source: syslinuxcfg
-*terminfo: terminfo
-*test_blockarg: test_blockarg
-*testspeed: testspeed
-*tr: tr
-*trust: verify
-*verify_detached: verify
-*xnu_splash: xnu
-*zfskey: zfscrypt
-.: configfile
-[: test
-authenticate: normal
-background_color: gfxterm_background
-backtrace: backtrace
-badram: mmap
-blocklist: blocklist
-boot: boot
-break: normal
-cat: minicmd
-cbmemc: cbmemc
-chainloader: chain
-clear: normal
-cmosclean: cmostest
-cmosdump: cmosdump
-cmosset: cmostest
-cmostest: cmostest
-cmp: cmp
-configfile: configfile
-continue: normal
-coreboot_boottime: cbtime
-cutmem: mmap
-date: date
-distrust: verify
-dump: minicmd
-efiemu_loadcore: efiemu
-efiemu_prepare: efiemu
-efiemu_unload: efiemu
-eval: eval
-exit: minicmd
-export: normal
-extract_entries_configfile: configfile
-extract_entries_source: configfile
-extract_legacy_entries_configfile: legacycfg
-extract_legacy_entries_source: legacycfg
-false: true
-freedos: freedos
-gdbstub: gdb
-gdbstub_break: gdb
-gdbstub_stop: gdb
-gptsync: gptsync
-help: minicmd
-hexdump_random: random
-initrd16: linux16
-initrd: linux
-keymap: keylayouts
-kfreebsd_loadenv: bsd
-kfreebsd_module: bsd
-kfreebsd_module_elf: bsd
-knetbsd_module: bsd
-knetbsd_module_elf: bsd
-kopenbsd_ramdisk: bsd
-legacy_check_password: legacycfg
-legacy_configfile: legacycfg
-legacy_initrd: legacycfg
-legacy_initrd_nounzip: legacycfg
-legacy_kernel: legacycfg
-legacy_password: legacycfg
-legacy_source: legacycfg
-linux16: linux16
-linux: linux
-list_trusted: verify
-loadfont: font
-lsapm: lsapm
-lscoreboot: cbls
-lsfonts: font
-lsmmap: lsmmap
-lsmod: minicmd
-macppcbless: macbless
-mactelbless: macbless
-module2: multiboot2
-module: multiboot
-multiboot2: multiboot2
-multiboot: multiboot
-nativedisk: nativedisk
-net_add_addr: net
-net_add_dns: net
-net_add_route: net
-net_bootp: net
-net_del_addr: net
-net_del_dns: net
-net_del_route: net
-net_get_dhcp_option: net
-net_ipv6_autoconf: net
-net_ls_addr: net
-net_ls_cards: net
-net_ls_dns: net
-net_ls_routes: net
-net_nslookup: net
-normal: normal
-normal_exit: normal
-ntldr: ntldr
-outb: iorw
-outl: iorw
-outw: iorw
-parttool: parttool
-password: password
-password_pbkdf2: password_pbkdf2
-play: play
-pxechainloader: pxechain
-read: read
-reboot: reboot
-return: normal
-rmmod: minicmd
-search.file: search_fs_file
-search.fs_label: search_label
-search.fs_uuid: search_fs_uuid
-setparams: normal
-shift: normal
-source: configfile
-terminal_input: terminal
-terminal_output: terminal
-test: test
-testload: testload
-time: time
-true: true
-truecrypt: truecrypt
-usb: usbtest
-vbeinfo: videoinfo
-vbetest: videotest
-videoinfo: videoinfo
-videotest: videotest
-write_byte: memrw
-write_dword: memrw
-write_word: memrw
-xnu_devprop_load: xnu
-xnu_kernel64: xnu
-xnu_kernel: xnu
-xnu_kext: xnu
-xnu_kextdir: xnu
-xnu_mkext: xnu
-xnu_ramdisk: xnu
-xnu_resume: xnu
-xnu_uuid: xnu_uuid
-zfs-bootfs: zfsinfo
-zfsinfo: zfsinfo
Index: ot/grub/ia32-pc/i386-pc/crypto.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/crypto.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-RIJNDAEL: gcry_rijndael
-RIJNDAEL192: gcry_rijndael
-RIJNDAEL256: gcry_rijndael
-AES128: gcry_rijndael
-AES-128: gcry_rijndael
-AES-192: gcry_rijndael
-AES-256: gcry_rijndael
-ADLER32: adler32
-CRC64: crc64
-ARCFOUR: gcry_arcfour
-BLOWFISH: gcry_blowfish
-CAMELLIA128: gcry_camellia
-CAMELLIA192: gcry_camellia
-CAMELLIA256: gcry_camellia
-CAST5: gcry_cast5
-CRC32: gcry_crc
-CRC32RFC1510: gcry_crc
-CRC24RFC2440: gcry_crc
-DES: gcry_des
-3DES: gcry_des
-DSA: gcry_dsa
-IDEA: gcry_idea
-MD4: gcry_md4
-MD5: gcry_md5
-RFC2268_40: gcry_rfc2268
-AES: gcry_rijndael
-AES192: gcry_rijndael
-AES256: gcry_rijndael
-RIPEMD160: gcry_rmd160
-RSA: gcry_rsa
-SEED: gcry_seed
-SERPENT128: gcry_serpent
-SERPENT192: gcry_serpent
-SERPENT256: gcry_serpent
-SHA1: gcry_sha1
-SHA224: gcry_sha256
-SHA256: gcry_sha256
-SHA512: gcry_sha512
-SHA384: gcry_sha512
-TIGER192: gcry_tiger
-TIGER: gcry_tiger
-TIGER2: gcry_tiger
-TWOFISH: gcry_twofish
-TWOFISH128: gcry_twofish
-WHIRLPOOL: gcry_whirlpool
Index: ot/grub/ia32-pc/i386-pc/fs.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/fs.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-affs
-afs
-bfs
-btrfs
-cbfs
-cpio
-cpio_be
-exfat
-ext2
-fat
-hfs
-hfsplus
-iso9660
-jfs
-minix
-minix2
-minix2_be
-minix3
-minix3_be
-minix_be
-newc
-nilfs2
-ntfs
-odc
-procfs
-reiserfs
-romfs
-sfs
-squash4
-tar
-udf
-ufs1
-ufs1_be
-ufs2
-xfs
-zfs
Index: ot/grub/ia32-pc/i386-pc/gdb_grub
===================================================================
--- boot/grub/ia32-pc/i386-pc/gdb_grub	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-###
-### Load debuging information about GNU GRUB 2 modules into GDB
-### automatically. Needs readelf, Perl and gmodule.pl script
-###
-### Has to be launched from the writable and trusted
-### directory containing *.image and *.module
-###
-### $Id: .gdbinit,v 1.1 2006/05/14 11:38:08 lkundrak Exp $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-# Add section numbers and addresses to .segments.tmp
-define dump_module_sections
-	set $mod = $arg0
-
-	# FIXME: save logging status
-	set logging file .segments.tmp
-	set logging redirect on
-	set logging overwrite off
-	set logging on
-
-	printf "%s", $mod->name
-	set $segment = $mod->segment
-	while ($segment)
-		printf " %i 0x%lx", $segment->section, $segment->addr
-		set $segment = $segment->next
-	end
-	printf "\n"
-
-	set logging off
-	# FIXME: restore logging status
-end
-document dump_module_sections
-	Gather information about module whose mod structure was
-	given for use with match_and_load_symbols
-end
-
-# Generate and execute GDB commands and delete temporary files
-# afterwards
-define match_and_load_symbols
-	shell perl gmodule.pl <.segments.tmp >.loadsym.gdb
-	source .loadsym.gdb
-	shell rm -f .segments.tmp .loadsym.gdb
-end
-document match_and_load_symbols
-	Launch script, that matches section names with information
-	generated by dump_module_sections and load debugging info
-	apropriately
-end
-
-###
-
-define load_module
-	dump_module_sections $arg0
-	match_and_load_symbols
-end
-document load_module
-	Load debugging information for module given as argument.
-end
-
-define load_all_modules
-	set $this = grub_dl_head
-	while ($this != 0)
-		dump_module_sections $this
-		set $this = $this->next
-	end
-	match_and_load_symbols
-end
-document load_all_modules
-	Load debugging information for all loaded modules.
-end
-
-###
-
-set confirm off
-file kernel.exec
-target remote :1234
-
-# inform when module is loaded
-break grub_dl_add
-commands
-	silent
-	load_module mod
-	cont
-end
Index: ot/grub/ia32-pc/i386-pc/gmodule.pl
===================================================================
--- boot/grub/ia32-pc/i386-pc/gmodule.pl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-###
-### Generate GDB commands, that load symbols for specified module,
-### with proper section relocations. See .gdbinit
-###
-### $Id: gmodule.pl,v 1.2 2006/05/14 11:38:42 lkundrak Exp lkundrak $
-### Lubomir Kundrak <lkudrak@skosi.org>
-###
-
-use strict;
-
-while (<>) {
-	my ($name, %sections) = split;
-
-	print "add-symbol-file $name.module";
-
-	open (READELF, "readelf -S $name.mod |") or die;
-	while (<READELF>) {
-		/\[\s*(\d+)\]\s+(\.\S+)/ or next;
-
-		if ($2 eq '.text') {
-			print " $sections{$1}";
-			next;
-		}
-
-		print " -s $2 $sections{$1}"
-			if ($sections{$1} ne '0x0' and $sections{$1} ne '');
-	};
-	close (READELF);
-	print "\n";
-}
Index: ot/grub/ia32-pc/i386-pc/moddep.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/moddep.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,264 +1,0 @@
-videotest: font video gfxmenu
-odc: archelp
-loopback: extcmd
-macho:
-gcry_des: crypto
-memrw: extcmd
-terminfo: extcmd
-part_gpt:
-romfs: fshelp
-read:
-aout:
-gcry_arcfour: crypto
-vga_text:
-tftp: net priority_queue
-newc: archelp
-minix2_be:
-elf:
-videotest_checksum: font functional_test video_fb
-password_pbkdf2: crypto gcry_sha512 pbkdf2 normal
-gcry_seed: crypto
-pcidump: extcmd pci
-bsd: elf serial crypto gcry_md5 extcmd vbe video boot aout cpuid relocator mmap
-sfs: fshelp
-reiserfs: fshelp
-part_sunpc:
-gfxmenu: video_colors trig bitmap_scale gfxterm font normal video bitmap
-backtrace:
-jfs:
-help: extcmd normal
-configfile: normal
-cbls: cbtable
-gfxterm_menu: font functional_test procfs normal video_fb
-gcry_idea: crypto
-tr: extcmd
-shift_test: functional_test
-ohci: cs5536 usb boot pci
-afs: fshelp
-spkmodem: terminfo
-usb_keyboard: usb keylayouts
-xzio: crypto
-syslinuxcfg: extcmd normal
-search_fs_file:
-vga: video video_fb
-usbms: scsi usb
-test_blockarg: extcmd normal
-true:
-affs: fshelp
-iso9660: fshelp
-exfat: fshelp
-setjmp_test: functional_test setjmp
-gfxterm: font video
-disk:
-xfs: fshelp
-testspeed: extcmd normal
-cpio_be: archelp
-functional_test: btrfs extcmd video video_fb
-pxechain: pxe video boot relocator
-bswap_test: functional_test
-sleep: extcmd normal
-memdisk:
-gcry_rijndael: crypto
-mdraid09_be: diskfilter
-gettext:
-gcry_sha1: crypto
-hfspluscomp: gzio hfsplus
-cmp:
-random: hexdump acpi
-offsetio:
-file: macho elf extcmd offsetio
-usbserial_usbdebug: serial usb usbserial_common
-video_colors:
-morse:
-hashsum: crypto extcmd normal
-usb: pci
-halt: extcmd acpi
-gdb: serial backtrace
-gfxterm_background: video_colors bitmap_scale gfxterm extcmd video bitmap
-search_fs_uuid:
-gcry_dsa: verify mpi
-keystatus: extcmd
-linux: normal vbe video boot relocator mmap
-geli: cryptodisk crypto gcry_sha512 pbkdf2 gcry_sha256
-cmdline_cat_test: font functional_test procfs normal video_fb
-part_sun:
-cbtable:
-plan9: extcmd video boot relocator
-sendkey: extcmd boot
-pbkdf2_test: functional_test pbkdf2 gcry_sha1
-video_bochs: video pci video_fb
-bufio:
-usbserial_ftdi: serial usb usbserial_common
-legacy_password_test: functional_test legacycfg
-cpuid: extcmd
-bfs: fshelp
-hdparm: extcmd
-gcry_blowfish: crypto
-test:
-nilfs2: fshelp
-gcry_rsa: verify mpi
-cryptodisk: crypto extcmd procfs
-nativedisk:
-minicmd:
-signature_test: functional_test procfs
-ata: scsi
-udf: fshelp
-gzio:
-xnu_uuid: gcry_md5
-uhci: usb pci
-pata: ata pci
-mul_test: functional_test
-adler32: crypto
-terminal:
-div:
-ehci: cs5536 usb boot pci
-crypto:
-part_bsd: part_msdos
-cs5536: pci
-biosdisk:
-lsapm:
-gcry_sha512: crypto
-password: crypto normal
-efiemu: gcry_crc crypto cpuid acpi
-fshelp:
-sleep_test: functional_test datetime
-iorw: extcmd
-xnu: macho bitmap_scale random extcmd video bitmap boot efiemu relocator mmap
-mmap: boot
-exfctest: functional_test
-zfsinfo: zfs
-ldm: part_gpt diskfilter part_msdos
-cmostest:
-eval: normal
-part_dvh:
-ext2: fshelp
-blocklist:
-net: priority_queue bufio datetime boot
-drivemap: extcmd boot mmap
-part_acorn:
-videoinfo: video
-btrfs: lzopio gzio
-lsmmap:
-bitmap:
-vbe: video video_fb
-ntfs: fshelp
-multiboot: net vbe video boot relocator mmap lsapm
-gcry_crc: crypto
-png: bufio bitmap
-jpeg: bufio bitmap
-macbless: disk
-div_test: functional_test div
-regexp: extcmd normal
-parttool: normal
-usbserial_pl2303: serial usb usbserial_common
-cpio: archelp
-gcry_rmd160: crypto
-fat: fshelp
-ufs1_be:
-truecrypt: video boot relocator mmap gzio
-archelp:
-raid6rec: diskfilter
-ntldr: chain video boot relocator
-http: net
-zfs: gzio
-minix2:
-mda_text:
-lsacpi: extcmd acpi
-datehook: datetime normal
-loadenv: disk extcmd
-bitmap_scale: bitmap
-probe: extcmd
-minix3:
-tar: archelp
-hfs: fshelp
-procfs: archelp
-boot:
-keylayouts:
-progress: normal
-kernel:
-usbtest: usb
-relocator: mmap
-acpi: extcmd mmap
-tga: bufio bitmap
-reboot: relocator
-serial: extcmd terminfo
-zfscrypt: crypto pbkdf2 zfs extcmd gcry_sha1 gcry_rijndael
-dm_nv: diskfilter
-cmp_test: functional_test
-luks: cryptodisk crypto pbkdf2
-font: bufio video
-raid5rec: diskfilter
-crc64: crypto
-datetime:
-ctz_test: functional_test
-video:
-pci:
-cbmemc: normal cbtable terminfo
-cmosdump:
-hfsplus: fshelp
-gcry_cast5: crypto
-extcmd:
-squash4: fshelp lzopio xzio gzio
-part_plan:
-minix_be:
-gcry_whirlpool: crypto
-pxe: net boot
-gcry_tiger: crypto
-search: search_fs_uuid search_fs_file extcmd search_label
-lspci: extcmd pci
-cbtime: cbtable
-video_fb:
-verify: crypto extcmd mpi gcry_sha1
-minix3_be:
-trig:
-msdospart: disk parttool
-priority_queue:
-gcry_twofish: crypto
-part_dfly:
-xnu_uuid_test: functional_test
-diskfilter:
-testload:
-part_apple:
-hexdump: extcmd
-date: datetime normal
-pbkdf2: crypto
-gcry_sha256: crypto
-ls: extcmd normal
-usbserial_common: serial usb
-ntfscomp: ntfs
-lzopio: crypto
-video_cirrus: video pci video_fb
-hello: extcmd
-scsi:
-cat: extcmd
-ahci: ata boot pci
-normal: terminal crypto bufio extcmd boot gettext
-linux16: video boot relocator mmap
-ufs1:
-mdraid09: diskfilter
-lvm: diskfilter
-cbfs: archelp
-chain: video boot relocator
-ufs2:
-time:
-setpci: extcmd pci
-gptsync: disk
-freedos: chain video boot relocator
-search_label:
-setjmp:
-multiboot2: net vbe video boot relocator mmap lsapm acpi
-gcry_rfc2268: crypto
-mdraid1x: diskfilter
-mpi: crypto
-legacycfg: linux password crypto gcry_md5 normal
-play:
-part_amiga:
-minix:
-echo: extcmd
-gcry_serpent: crypto
-gcry_md4: crypto
-gcry_md5: crypto
-part_msdos:
-gcry_camellia: crypto
-at_keyboard: keylayouts boot
-all_video: vbe vga video_bochs video_cirrus
Index: ot/grub/ia32-pc/i386-pc/modinfo.sh
===================================================================
--- boot/grub/ia32-pc/i386-pc/modinfo.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#!/bin/sh
-
-# User-controllable options
-grub_modinfo_target_cpu=i386
-grub_modinfo_platform=pc
-grub_disk_cache_stats=0
-grub_boot_time_stats=0
-grub_have_font_source=1
-
-# Autodetected config
-grub_have_asm_uscore=0
-grub_bss_start_symbol="__bss_start"
-grub_end_symbol="end"
-
-# Build environment
-grub_target_cc='gcc'
-grub_target_cc_version='gcc (SUSE Linux) 4.8.5'
-grub_target_cflags=' -Os -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value  -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations  -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -march=i386 -m32 -mrtd -mregparm=3 -falign-jumps=1 -falign-loops=1 -falign-functions=1 -freg-struct-return -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -Qn -fno-stack-protector -Wtrampolines -Werror'
-grub_target_cppflags=' -Wall -W  -DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -m32 -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.8/include -I$(top_srcdir)/include -I$(top_builddir)/include'
-grub_target_ccasflags=' -g  -m32 -msoft-float'
-grub_target_ldflags=' -m32 -Wl,-melf_i386 -Wl,--build-id=none'
-grub_cflags=''
-grub_cppflags=' -D_FILE_OFFSET_BITS=64'
-grub_ccasflags=''
-grub_ldflags=''
-grub_target_strip='strip'
-grub_target_nm='nm'
-grub_target_ranlib='ranlib'
-grub_target_objconf=''
-grub_target_obj2elf=''
-grub_target_img_base_ldopt='-Wl,-Ttext'
-grub_target_img_ldflags='@TARGET_IMG_BASE_LDFLAGS@'
-
-# Version
-grub_version="2.02~beta2"
-grub_package="grub"
-grub_package_string="GRUB 2.02~beta2"
-grub_package_version="2.02~beta2"
-grub_package_name="GRUB"
-grub_package_bugreport="bug-grub@gnu.org"
Index: ot/grub/ia32-pc/i386-pc/partmap.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/partmap.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-part_acorn
-part_amiga
-part_apple
-part_bsd
-part_dfly
-part_dvh
-part_gpt
-part_msdos
-part_plan
-part_sun
-part_sunpc
Index: ot/grub/ia32-pc/i386-pc/parttool.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/parttool.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-msdos: msdospart
Index: ot/grub/ia32-pc/i386-pc/terminal.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/terminal.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-iat_keyboard: at_keyboard
-iserial: serial
-iserial_*: serial
-oaudio: morse
-ocbmemc: cbmemc
-ogfxterm: gfxterm
-omda_text: mda_text
-oserial: serial
-oserial_*: serial
-ospkmodem: spkmodem
-ovga_text: vga_text
Index: ot/grub/ia32-pc/i386-pc/video.lst
===================================================================
--- boot/grub/ia32-pc/i386-pc/video.lst	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-vbe
-vga
-video_bochs
-video_cirrus
Index: ot/grub/meson.build
===================================================================
--- boot/grub/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-if GRUB_ARCH == 'pc'
-	MULTIBOOT_CMD = 'multiboot'
-	MODULE_CMD = 'module'
-	INSMODS = [ 'insmod vbe', 'insmod vga' ]
-elif GRUB_ARCH == 'efi'
-	MULTIBOOT_CMD = 'multiboot2'
-	MODULE_CMD = 'module2'
-	INSMODS = [ 'insmod efi_gop', 'insmod efi_uga' ]
-endif
-
-# TODO
-install_snippet = 'mkdir -p ${DIST_DIR}/`dirname @1@`; cp @0@ ${DIST_DIR}/@1@'
-dist_dirname = 'grub_dist'
-
-if GRUB_LOADER == 'multiboot'
-	build_dist_text = []
-	build_dist_deps = []
-	foreach init : rd_init_binaries
-		target = 'boot/' + run_command(basename, init[1], check: true).stdout().strip()
-
-		build_dist_text += install_snippet.format(init[0].full_path(), target)
-		build_dist_deps += init[0]
-	endforeach
-
-	LOADS = [ 'echo \'Loading kernel\'' ]
-	LOADS += [ MULTIBOOT_CMD + ' /boot/kernel.elf' ]
-
-	MODULES = rd_init + [ 'boot/initrd.img' ]
-
-	foreach module : MODULES
-		module = '/boot/' + run_command(basename, module, check: true).stdout().strip()
-		LOADS += 'echo \'Loading @0@\''.format(module)
-		LOADS += '@0@ @1@ @1@'.format(MODULE_CMD, module)
-	endforeach
-endif
-
-if GRUB_LOADER == 'chainloader'
-	# init binaries are already part of the chainloaded boot image.
-	build_dist_text = [ install_snippet.format(boot_image.full_path(), 'boot/' + boot_image_name) ]
-	build_dist_deps = [ boot_image ]
-
-	LOADS = [
-		'echo \'Loading ' + boot_image_name + '\'',
-		'chainloader /boot/' + boot_image_name,
-		'boot',
-	]
-endif
-
-build_dist_sh = configure_file(
-	input: 'build_dist.sh.in',
-	output: 'build_dist.sh',
-	configuration: { 'text' : '\n'.join(build_dist_text) },
-)
-
-
-grub_cfg = configure_file(
-	input: 'grub.cfg.in',
-	output: 'grub.cfg',
-	configuration: {
-		'INSMODS' : '\n'.join(INSMODS),
-		'RELEASE' : HELENOS_RELEASE,
-		'LOADS'   : '\n'.join(LOADS),
-	},
-)
-
-grub_dir = meson.current_source_dir() / BARCH + '-' + GRUB_ARCH
-
-dist_dir = custom_target(dist_dirname,
-	output: dist_dirname,
-	input: [ build_dist_sh, grub_cfg, build_dist_deps ],
-	command: [ sh, '@INPUT0@', '@OUTPUT@', grub_dir, '@INPUT1@' ],
-)
-
-
-# Create .iso image.
-
-grub_image = 'boot/grub' / GRUB_ARCH + '.img'
-
-if GRUB_ARCH == 'pc'
-	genisoimage_args = [ '-eltorito-boot', grub_image, '-no-emul-boot', '-boot-info-table' ]
-elif GRUB_ARCH == 'efi'
-	if genisoimage_type == 'mkisofs'
-		genisoimage_args = [ '-eltorito-platform', 'efi', '-eltorito-boot', grub_image, '-no-emul-boot' ]
-	else
-		genisoimage_args = [ '--efi-boot', grub_image ]
-	endif
-endif
-
-image_iso = custom_target('image.iso',
-	output: 'image.iso',
-	input: dist_dir,
-	command: [
-		genisoimage,
-		'-J',
-		'-r',
-		'-input-charset', 'utf-8',
-		'-V', 'HelenOS-CD',
-		genisoimage_args,
-		'-o', '@OUTPUT@',
-		'@INPUT@',
-	],
-)
-
-POST_INPUT = image_iso
Index: ot/meson.build
===================================================================
--- boot/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-subdir('arch' / BARCH)
-
-if POSTBUILD == 'uboot'
-	boot_image_format = 'binary'
-endif
-
-if BUILD
-	# Order matters.
-	modules = [ 'boot/kernel.elf' ] + rd_init + [ 'boot/initrd.img' ]
-	moddeps = []
-	name_transform = ''
-
-	# Collect binary references in the correct order.
-	foreach m : modules
-		found = false
-		foreach bin : rd_init_binaries
-			if bin[1] == m
-				_dep = bin[0]
-				_newname = run_command(basename, bin[1], check: true).stdout().strip()
-				_oldname = run_command(basename, bin[0].full_path(), check: true).stdout().strip()
-
-				if CONFIG_COMPRESSED_INIT
-					_dep = custom_target(_newname + '.gz',
-						output: _newname + '.gz',
-						input: _dep,
-						command: gzip,
-						capture: true,
-					)
-					_newname += '.gz'
-					_oldname = _newname
-				endif
-
-				moddeps += _dep
-				name_transform += 's:.*/@0@:@1@:;'.format(_oldname, _newname)
-				found = true
-				break
-			endif
-		endforeach
-
-		if not found
-			error('Could not find dependency ' + m)
-		endif
-	endforeach
-
-
-	boot_include_dirs = include_directories(
-		'generic/include',
-		'arch'/BARCH/'include',
-		'genarch/include',
-		'../abi/arch'/BARCH/'include',
-		'../abi/include',
-		'../common/include',
-	)
-
-	boot_defs = [
-		'-imacros', meson.build_root() / 'config.h',
-		'-D_HELENOS_SOURCE',
-		'-DBOOT',
-		'-DHELENOS_RELEASE=' + HELENOS_RELEASE,
-		'-DHELENOS_COPYRIGHT=' + HELENOS_COPYRIGHT,
-		'-DHELENOS_CODENAME=' + HELENOS_CODENAME,
-		'-D__@0@_BITS__'.format(meson.get_cross_property('bits')),
-	]
-
-	boot_c_args = arch_boot_c_args + boot_defs + [
-		'-ffreestanding',
-	]
-
-	boot_link_args = arch_boot_link_args + [
-		'-nostdlib',
-		'-Wl,--nmagic',
-		'-T', meson.current_build_dir()/'_link.ld',
-	]
-
-	if cc.get_id() == 'clang'
-		boot_c_args += [
-			'-fno-stack-protector',
-			'-fno-PIC',
-		#	'-mllvm', '-asm-macro-max-nesting-depth=1000',
-		]
-	endif
-
-	boot_files = static_library('bootfiles', boot_src,
-		include_directories: boot_include_dirs,
-		implicit_include_directories: false,
-		c_args: boot_c_args,
-		pic: false,
-		build_by_default: true,
-	)
-
-	# Preprocess linker script using C preprocessor.
-	boot_ldscript = custom_target('_link.ld',
-		input: 'arch'/KARCH/'_link.ld.in',
-		output: '_link.ld',
-		command: [
-			cc.cmd_array(),
-			boot_c_args,
-			'-I' + meson.current_source_dir()/'arch'/KARCH/'include',
-			'-D__ASSEMBLER__',
-			'-D__LINKER__',
-			'-E',
-			'-P',
-			'-x', 'c',
-			'@INPUT@',
-		],
-		capture: true,
-		build_by_default: true
-	)
-
-	# Create empty object file.
-	boot_empty_o = custom_target('empty.o',
-		output: 'empty.o',
-		command: [
-			cc.cmd_array(),
-			boot_c_args,
-			'-x', 'c',
-			'-c',
-			'-o', '@OUTPUT@',
-			'-',
-		],
-	)
-
-	boot_comps_tar = custom_target('components.tar',
-		input: moddeps,
-		output: 'components.tar',
-		command: [ tar, '--transform', name_transform ],
-	)
-
-	# Add .payload section to the empty object.
-	boot_comps_o = custom_target('components.o',
-		output: 'components.o',
-		input: [ boot_comps_tar, boot_empty_o ],
-		command: [
-			objcopy,
-			'--add-section', '.payload=@INPUT0@',
-			'@INPUT1@',
-			'@OUTPUT@',
-		],
-	)
-
-	boot_image_name = 'image.boot'
-	boot_image_map_path = meson.current_build_dir()/boot_image_name + '.map'
-
-	boot_elf = executable(boot_image_name + '.elf', boot_comps_o,
-		include_directories: boot_include_dirs,
-		c_args: boot_c_args,
-		link_args: boot_c_args + boot_link_args + [
-			'-Wl,-Map,' + boot_image_map_path,
-		],
-		link_depends: boot_ldscript,
-		link_whole: boot_files,
-		pie: false,
-		build_by_default: false,
-	)
-
-	if boot_image_format == 'elf'
-		boot_image = boot_elf
-	endif
-
-	if boot_image_format == 'binary'
-		# Some platforms can't ELF.
-		boot_image = custom_target(boot_image_name + '.bin',
-			input: boot_elf,
-			output: boot_image_name + '.bin',
-			command: [ objcopy, '-O', 'binary', '@INPUT@', '@OUTPUT@' ],
-		)
-	endif
-endif
-
-if POSTBUILD == 'raw'
-	POST_INPUT = boot_image
-endif
-
-if POSTBUILD == 'grub'
-	subdir('grub')
-endif
-
-if POSTBUILD == 'yaboot'
-	subdir('yaboot')
-endif
-
-if POSTBUILD == 'silo'
-	subdir('silo')
-endif
-
-if POSTBUILD == 'uboot'
-	IMAGE_NAME = 'HelenOS-' + HELENOS_RELEASE
-
-	POST_INPUT = custom_target('uboot-image',
-		output: 'uboot-image.bin',
-		input: boot_image,
-		command: [
-			mkuimage,
-			'-name', IMAGE_NAME,
-			'-laddr', LADDR,
-			'-saddr', SADDR,
-			'-ostype', UIMAGE_OS,
-			'@INPUT@',
-			'@OUTPUT@',
-		],
-	)
-endif
Index: ot/silo/COPYING
===================================================================
--- boot/silo/COPYING	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,345 +1,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
Index: ot/silo/README
===================================================================
--- boot/silo/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-For licensing terms of SILO boot loader see the file COPYING contained
-in this directory. Full version of SILO, including its source code,
-can be downloaded from SILO's project page:
-
-http://www.sparc-boot.org/
Index: ot/silo/build_dist.sh
===================================================================
--- boot/silo/build_dist.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BOOT_OUTPUT="$1"
-SRCDIR="$2"
-DESTDIR="$3"
-
-rm -rf ${DESTDIR}
-
-mkdir -p ${DESTDIR}/boot
-cp -t ${DESTDIR}/boot \
-	${SRCDIR}/a.out/isofs.b \
-	${SRCDIR}/a.out/second.b \
-	${SRCDIR}/silo.conf
-
-mkdir -p ${DESTDIR}/HelenOS
-cp ${BOOT_OUTPUT} ${DESTDIR}/HelenOS/image.boot
Index: ot/silo/meson.build
===================================================================
--- boot/silo/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-distdir = custom_target('distdir',
-	output: 'distdir',
-	input: [
-		'build_dist.sh',
-		boot_image,
-		'a.out/isofs.b',
-		'a.out/second.b',
-		'silo.conf'
-
-	],
-	command: [ sh, '@INPUT0@', '@INPUT1@', meson.current_source_dir(), '@OUTPUT@' ],
-)
-
-image_iso = custom_target('image.iso',
-	output: 'image.iso',
-	input: [ distdir, 'a.out/isofs.b' ],
-	command: [
-		genisoimage,
-		'-f',
-		'-G', '@INPUT1@',
-		'-B', '...',
-		'-r',
-		'-o', '@OUTPUT@',
-		'@INPUT0@',
-	],
-)
-
-POST_INPUT = image_iso
Index: ot/silo/silo.conf
===================================================================
--- boot/silo/silo.conf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-timeout = 0
-image = /HelenOS/image.boot
-	label = HelenOS
Index: ot/yaboot/COPYING
===================================================================
--- boot/yaboot/COPYING	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,345 +1,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year  name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
Index: ot/yaboot/README
===================================================================
--- boot/yaboot/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-For licensing terms of Yaboot boot loader see the file COPYING contained
-in this directory. Full version of Yaboot, including its source code,
-can be downloaded from Yaboot's project page:
-
-http://yaboot.ozlabs.org/
Index: ot/yaboot/bootinfo.txt
===================================================================
--- boot/yaboot/bootinfo.txt	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-<chrp-boot>
-<description>HelenOS</description>
-<os-name>HelenOS</os-name>
-<boot-script>boot cd:,\boot\yaboot</boot-script>
-</chrp-boot>
Index: ot/yaboot/build_dist.sh
===================================================================
--- boot/yaboot/build_dist.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BOOT_OUTPUT="$1"
-SRCDIR="$2"
-DESTDIR="$3"
-
-rm -rf ${DESTDIR}
-
-mkdir -p ${DESTDIR}/boot
-cp -t ${DESTDIR}/boot \
-	${SRCDIR}/ofboot.b \
-	${SRCDIR}/yaboot \
-	${SRCDIR}/yaboot.conf
-cp ${BOOT_OUTPUT} ${DESTDIR}/boot/image.boot
-
-mkdir -p ${DESTDIR}/ppc
-cp -t ${DESTDIR}/ppc \
-	${SRCDIR}/bootinfo.txt
Index: ot/yaboot/maps
===================================================================
--- boot/yaboot/maps	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-# EXTN          XLate   CREATOR   TYPE     Comment
-.b              Raw     'UNIX'    'tbxi'   "bootstrap"
-yaboot          Raw     'UNIX'    'boot'   "bootstrap"
-image.boot      Raw     'UNIX'    'boot'   "kernel"
-.conf           Raw     'UNIX'    'conf'   "bootstrap"
-*               Raw     'UNIX     'UNIX'   "unix"
Index: ot/yaboot/meson.build
===================================================================
--- boot/yaboot/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-distdir = custom_target('distdir',
-	output: 'distdir',
-	input: [
-		'build_dist.sh',
-		boot_image,
-		'ofboot.b',
-		'bootinfo.txt',
-		'yaboot',
-		'yaboot.conf',
-	],
-	command: [ sh, '@INPUT0@', '@INPUT1@', meson.current_source_dir(), '@OUTPUT@' ],
-)
-
-image_iso = custom_target('image.iso',
-	output: 'image.iso',
-	input: [ distdir, 'maps' ],
-	command: [
-		genisoimage,
-		'-hfs',
-		'-part',
-		'-map', '@INPUT1@',
-		'-no-desktop',
-		'-hfs-volid', 'HelenOS',
-		'-hfs-bless', '@INPUT0@/boot',
-		'-r',
-		'-o', '@OUTPUT@',
-		'@INPUT0@',
-	],
-)
-
-POST_INPUT = image_iso
Index: ot/yaboot/ofboot.b
===================================================================
--- boot/yaboot/ofboot.b	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-<CHRP-BOOT>
-<COMPATIBLE>
-MacRISC
-</COMPATIBLE>
-<DESCRIPTION>
-HelenOS
-</DESCRIPTION>
-<BOOT-SCRIPT>
-" screen" output
-load-base release-load-area
-boot cd:,\boot\yaboot
-</BOOT-SCRIPT>
-</CHRP-BOOT>
Index: ot/yaboot/yaboot.conf
===================================================================
--- boot/yaboot/yaboot.conf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-device=cd:
-timeout=0
-
-image=/boot/image.boot
-	label=HelenOS
Index: mmon/adt/bitmap.c
===================================================================
--- common/adt/bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Implementation of bitmap ADT.
- *
- * This file implements bitmap ADT and provides functions for
- * setting and clearing ranges of bits and for finding ranges
- * of unset bits.
- */
-
-#include <adt/bitmap.h>
-#include <align.h>
-#include <assert.h>
-#include <macros.h>
-
-#define ALL_ONES    0xff
-#define ALL_ZEROES  0x00
-
-/** Unchecked version of bitmap_get()
- *
- * This version of bitmap_get() does not do any boundary checks.
- *
- * @param bitmap  Bitmap to access.
- * @param element Element to access.
- *
- * @return Bit value of the element in the bitmap.
- *
- */
-static unsigned int bitmap_get_fast(bitmap_t *bitmap, size_t element)
-{
-	size_t byte = element / BITMAP_ELEMENT;
-	uint8_t mask = 1 << (element & BITMAP_REMAINER);
-
-	return !!((bitmap->bits)[byte] & mask);
-}
-
-/** Get bitmap size
- *
- * Return the size (in bytes) required for the bitmap.
- *
- * @param elements   Number bits stored in bitmap.
- *
- * @return Size (in bytes) required for the bitmap.
- *
- */
-size_t bitmap_size(size_t elements)
-{
-	size_t size = elements / BITMAP_ELEMENT;
-
-	if ((elements % BITMAP_ELEMENT) != 0)
-		size++;
-
-	return size;
-}
-
-/** Initialize bitmap.
- *
- * No portion of the bitmap is set or cleared by this function.
- *
- * @param bitmap     Bitmap structure.
- * @param elements   Number of bits stored in bitmap.
- * @param data       Address of the memory used to hold the map.
- *                   The optional 2nd level bitmap follows the 1st
- *                   level bitmap.
- *
- */
-void bitmap_initialize(bitmap_t *bitmap, size_t elements, void *data)
-{
-	bitmap->elements = elements;
-	bitmap->bits = (uint8_t *) data;
-	bitmap->next_fit = 0;
-}
-
-/** Set range of bits.
- *
- * @param bitmap Bitmap structure.
- * @param start  Starting bit.
- * @param count  Number of bits to set.
- *
- */
-void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t count)
-{
-	assert(start + count <= bitmap->elements);
-
-	if (count == 0)
-		return;
-
-	size_t start_byte = start / BITMAP_ELEMENT;
-	size_t aligned_start = ALIGN_UP(start, BITMAP_ELEMENT);
-
-	/* Leading unaligned bits */
-	size_t lub = min(aligned_start - start, count);
-
-	/* Aligned middle bits */
-	size_t amb = (count > lub) ? (count - lub) : 0;
-
-	/* Trailing aligned bits */
-	size_t tab = amb % BITMAP_ELEMENT;
-
-	if (start + count < aligned_start) {
-		/* Set bits in the middle of byte. */
-		bitmap->bits[start_byte] |=
-		    ((1 << lub) - 1) << (start & BITMAP_REMAINER);
-		return;
-	}
-
-	if (lub) {
-		/* Make sure to set any leading unaligned bits. */
-		bitmap->bits[start_byte] |=
-		    ~((1 << (BITMAP_ELEMENT - lub)) - 1);
-	}
-
-	size_t i;
-
-	for (i = 0; i < amb / BITMAP_ELEMENT; i++) {
-		/* The middle bits can be set byte by byte. */
-		bitmap->bits[aligned_start / BITMAP_ELEMENT + i] =
-		    ALL_ONES;
-	}
-
-	if (tab) {
-		/* Make sure to set any trailing aligned bits. */
-		bitmap->bits[aligned_start / BITMAP_ELEMENT + i] |=
-		    (1 << tab) - 1;
-	}
-}
-
-/** Clear range of bits.
- *
- * @param bitmap Bitmap structure.
- * @param start  Starting bit.
- * @param count  Number of bits to clear.
- *
- */
-void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t count)
-{
-	assert(start + count <= bitmap->elements);
-
-	if (count == 0)
-		return;
-
-	size_t start_byte = start / BITMAP_ELEMENT;
-	size_t aligned_start = ALIGN_UP(start, BITMAP_ELEMENT);
-
-	/* Leading unaligned bits */
-	size_t lub = min(aligned_start - start, count);
-
-	/* Aligned middle bits */
-	size_t amb = (count > lub) ? (count - lub) : 0;
-
-	/* Trailing aligned bits */
-	size_t tab = amb % BITMAP_ELEMENT;
-
-	if (start + count < aligned_start) {
-		/* Set bits in the middle of byte */
-		bitmap->bits[start_byte] &=
-		    ~(((1 << lub) - 1) << (start & BITMAP_REMAINER));
-		return;
-	}
-
-	if (lub) {
-		/* Make sure to clear any leading unaligned bits. */
-		bitmap->bits[start_byte] &=
-		    (1 << (BITMAP_ELEMENT - lub)) - 1;
-	}
-
-	size_t i;
-
-	for (i = 0; i < amb / BITMAP_ELEMENT; i++) {
-		/* The middle bits can be cleared byte by byte. */
-		bitmap->bits[aligned_start / BITMAP_ELEMENT + i] =
-		    ALL_ZEROES;
-	}
-
-	if (tab) {
-		/* Make sure to clear any trailing aligned bits. */
-		bitmap->bits[aligned_start / BITMAP_ELEMENT + i] &=
-		    ~((1 << tab) - 1);
-	}
-
-	bitmap->next_fit = start_byte;
-}
-
-/** Copy portion of one bitmap into another bitmap.
- *
- * @param dst   Destination bitmap.
- * @param src   Source bitmap.
- * @param count Number of bits to copy.
- *
- */
-void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t count)
-{
-	assert(count <= dst->elements);
-	assert(count <= src->elements);
-
-	size_t i;
-
-	for (i = 0; i < count / BITMAP_ELEMENT; i++)
-		dst->bits[i] = src->bits[i];
-
-	if (count % BITMAP_ELEMENT) {
-		bitmap_clear_range(dst, i * BITMAP_ELEMENT,
-		    count % BITMAP_ELEMENT);
-		dst->bits[i] |= src->bits[i] &
-		    ((1 << (count % BITMAP_ELEMENT)) - 1);
-	}
-}
-
-static int constraint_satisfy(size_t index, size_t base, size_t constraint)
-{
-	return (((base + index) & constraint) == 0);
-}
-
-/** Find a continuous zero bit range
- *
- * Find a continuous zero bit range in the bitmap. The address
- * computed as the sum of the index of the first zero bit and
- * the base argument needs to be compliant with the constraint
- * (those bits that are set in the constraint cannot be set in
- * the address).
- *
- * If the index argument is non-NULL, the continuous zero range
- * is set and the index of the first bit is stored to index.
- * Otherwise the bitmap stays untouched.
- *
- * @param bitmap     Bitmap structure.
- * @param count      Number of continuous zero bits to find.
- * @param base       Address of the first bit in the bitmap.
- * @param prefered   Prefered address to start searching from.
- * @param constraint Constraint for the address of the first zero bit.
- * @param index      Place to store the index of the first zero
- *                   bit. Can be NULL (in which case the bitmap
- *                   is not modified).
- *
- * @return Non-zero if a continuous range of zero bits satisfying
- *         the constraint has been found.
- * @return Zero otherwise.
- *
- */
-bool bitmap_allocate_range(bitmap_t *bitmap, size_t count, size_t base,
-    size_t prefered, size_t constraint, size_t *index)
-{
-	if (count == 0)
-		return false;
-
-	size_t size = bitmap_size(bitmap->elements);
-	size_t next_fit = bitmap->next_fit;
-
-	/*
-	 * Adjust the next-fit value according to the address
-	 * the caller prefers to start the search at.
-	 */
-	if ((prefered > base) && (prefered < base + bitmap->elements)) {
-		size_t prefered_fit = (prefered - base) / BITMAP_ELEMENT;
-
-		if (prefered_fit > next_fit)
-			next_fit = prefered_fit;
-	}
-
-	for (size_t pos = 0; pos < size; pos++) {
-		size_t byte = (next_fit + pos) % size;
-
-		/* Skip if the current byte has all bits set */
-		if (bitmap->bits[byte] == ALL_ONES)
-			continue;
-
-		size_t byte_bit = byte * BITMAP_ELEMENT;
-
-		for (size_t bit = 0; bit < BITMAP_ELEMENT; bit++) {
-			size_t i = byte_bit + bit;
-
-			if (i >= bitmap->elements)
-				break;
-
-			if (!constraint_satisfy(i, base, constraint))
-				continue;
-
-			if (!bitmap_get_fast(bitmap, i)) {
-				size_t continuous = 1;
-
-				for (size_t j = 1; j < count; j++) {
-					if ((i + j < bitmap->elements) &&
-					    (!bitmap_get_fast(bitmap, i + j)))
-						continuous++;
-					else
-						break;
-				}
-
-				if (continuous == count) {
-					if (index != NULL) {
-						bitmap_set_range(bitmap, i, count);
-						bitmap->next_fit = i / BITMAP_ELEMENT;
-						*index = i;
-					}
-
-					return true;
-				} else
-					i += continuous;
-			}
-		}
-	}
-
-	return false;
-}
-
-/** @}
- */
Index: mmon/adt/checksum.c
===================================================================
--- common/adt/checksum.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2012 Dominik Taborsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <adt/checksum.h>
-
-/**
- * 256-value table of precomputed polynomials for CRC32. Note
- * the values depend on the selected divisor polynomial (currently
- * 0xedb88320) and whether the CRC computation is reflected or not.
- * See http://www.repairfaq.org/filipg/LINK/F_crc_v3.html for a perfect
- * source of info about this.
- */
-uint32_t poly_table[256] = {
-	0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
-	0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
-	0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
-	0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
-	0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
-	0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-	0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
-	0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
-	0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
-	0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-	0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
-	0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-	0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
-	0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
-	0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-	0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
-	0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
-	0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-	0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
-	0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-	0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
-	0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
-	0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
-	0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-	0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
-	0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
-	0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
-	0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
-	0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
-	0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-	0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
-	0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
-	0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
-	0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
-	0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
-	0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-	0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
-	0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
-	0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
-	0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-	0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
-	0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-	0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
-	0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
-	0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-	0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
-	0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
-	0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-	0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
-	0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-	0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
-	0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
-	0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
-	0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-	0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
-	0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
-	0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
-	0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
-	0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
-	0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-	0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
-	0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
-	0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
-	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/** Compute CRC32 value.
- *
- * See wiki.osdev.org/CRC32 for reference.
- *
- * @param[in] data   Data to process.
- * @param[in] length Length of the data in bytes.
- *
- * @return Computed CRC32 of the data.
- *
- */
-uint32_t compute_crc32(uint8_t *data, size_t length)
-{
-	return compute_crc32_seed(data, length, 0);
-}
-
-/** Compute CRC32 value with initial seed.
- *
- * Use this when checksumming non-continous data (linked lists, trees,
- * etc.). On the first data block call compute_crc32() and use the result
- * as the seed for the following call of compute_crc32_seed() on the next
- * block. Then use the result of that call as the seed of the following
- * call, etc.
- *
- * @param[in] data   Fata to process.
- * @param[in] length Length of the data in bytes.
- * @param[in] seed   The starting value of the CRC.
- *
- * @return Computed CRC32 of the data of all the previous blocks.
- *
- */
-uint32_t compute_crc32_seed(uint8_t *data, size_t length, uint32_t seed)
-{
-	uint32_t crc;
-
-	for (crc = ~seed; length > 0; length--)
-		crc = poly_table[((uint8_t) crc ^ *(data++))] ^ (crc >> 8);
-
-	return (~crc);
-}
-
-/** @}
- */
Index: mmon/adt/circ_buf.c
===================================================================
--- common/adt/circ_buf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/** @file Circular buffer
- */
-
-#include <adt/circ_buf.h>
-#include <errno.h>
-#include <mem.h>
-#include <stddef.h>
-
-/** Initialize circular buffer.
- *
- * @param cbuf Circular buffer
- * @param buf Buffer for storing data
- * @param nmemb Number of entries in @a buf
- * @param size Size of individual buffer entry
- */
-void circ_buf_init(circ_buf_t *cbuf, void *buf, size_t nmemb, size_t size)
-{
-	cbuf->buf = buf;
-	cbuf->nmemb = nmemb;
-	cbuf->size = size;
-	cbuf->rp = 0;
-	cbuf->wp = 0;
-	cbuf->nused = 0;
-}
-
-/** Return number of free buffer entries.
- *
- * @param cbuf Circular buffer
- * @return Number of free buffer entries
- */
-size_t circ_buf_nfree(circ_buf_t *cbuf)
-{
-	return cbuf->nmemb - cbuf->nused;
-}
-
-/** Return number of used buffer entries.
- *
- * @param cbuf Circular buffer
- * @return Number of used buffer entries
- */
-size_t circ_buf_nused(circ_buf_t *cbuf)
-{
-	return cbuf->nused;
-}
-
-/** Push new entry into circular buffer.
- *
- * @param cbuf Circular buffer
- * @param data Pointer to entry data
- * @return EOK on success, EAGAIN if circular buffer is full
- */
-errno_t circ_buf_push(circ_buf_t *cbuf, const void *data)
-{
-	if (circ_buf_nfree(cbuf) == 0)
-		return EAGAIN;
-
-	memcpy(cbuf->buf + cbuf->size * cbuf->wp, data, cbuf->size);
-	cbuf->wp = (cbuf->wp + 1) % cbuf->nmemb;
-	cbuf->nused++;
-	return EOK;
-}
-
-/** Pop entry from circular buffer.
- *
- * @param cbuf Circular buffer
- * @param datab Pointer to data buffer for storing entry
- * @return EOK on success, EAGAIN if circular buffer is full
- */
-errno_t circ_buf_pop(circ_buf_t *cbuf, void *datab)
-{
-	if (cbuf->nused == 0)
-		return EAGAIN;
-
-	memcpy(datab, cbuf->buf + cbuf->size * cbuf->rp, cbuf->size);
-	cbuf->rp = (cbuf->rp + 1) % cbuf->nmemb;
-	cbuf->nused--;
-	return EOK;
-}
-
-/** @}
- */
Index: mmon/adt/hash_table.c
===================================================================
--- common/adt/hash_table.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,460 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2012 Adam Hraska
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-/*
- * This is an implementation of a generic resizable chained hash table.
- *
- * The table grows to 2*n+1 buckets each time, starting at n == 89,
- * per Thomas Wang's recommendation:
- * http://www.concentric.net/~Ttwang/tech/hashsize.htm
- *
- * This policy produces prime table sizes for the first five resizes
- * and generally produces table sizes which are either prime or
- * have fairly large (prime/odd) divisors. Having a prime table size
- * mitigates the use of suboptimal hash functions and distributes
- * items over the whole table.
- */
-
-#include <adt/hash_table.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <str.h>
-
-/* Optimal initial bucket count. See comment above. */
-#define HT_MIN_BUCKETS  89
-/* The table is resized when the average load per bucket exceeds this number. */
-#define HT_MAX_LOAD     2
-
-static size_t round_up_size(size_t);
-static bool alloc_table(size_t, list_t **);
-static void clear_items(hash_table_t *);
-static void resize(hash_table_t *, size_t);
-static void grow_if_needed(hash_table_t *);
-static void shrink_if_needed(hash_table_t *);
-
-/* Dummy do nothing callback to invoke in place of remove_callback == NULL. */
-static void nop_remove_callback(ht_link_t *item)
-{
-	/* no-op */
-}
-
-/** Create chained hash table.
- *
- * @param h        Hash table structure. Will be initialized by this call.
- * @param init_size Initial desired number of hash table buckets. Pass zero
- *                 if you want the default initial size.
- * @param max_load The table is resized when the average load per bucket
- *                 exceeds this number. Pass zero if you want the default.
- * @param op       Hash table operations structure. remove_callback()
- *                 is optional and can be NULL if no action is to be taken
- *                 upon removal. equal() is optional if and only if
- *                 hash_table_insert_unique() will never be invoked.
- *                 All other operations are mandatory.
- *
- * @return True on success
- *
- */
-bool hash_table_create(hash_table_t *h, size_t init_size, size_t max_load,
-    const hash_table_ops_t *op)
-{
-	assert(h);
-	assert(op && op->hash && op->key_hash && op->key_equal);
-
-	/* Check for compulsory ops. */
-	if (!op || !op->hash || !op->key_hash || !op->key_equal)
-		return false;
-
-	h->bucket_cnt = round_up_size(init_size);
-
-	if (!alloc_table(h->bucket_cnt, &h->bucket))
-		return false;
-
-	h->max_load = (max_load == 0) ? HT_MAX_LOAD : max_load;
-	h->item_cnt = 0;
-	h->op = op;
-	h->full_item_cnt = h->max_load * h->bucket_cnt;
-	h->apply_ongoing = false;
-
-	return true;
-}
-
-/** Destroy a hash table instance.
- *
- * @param h Hash table to be destroyed.
- *
- */
-void hash_table_destroy(hash_table_t *h)
-{
-	assert(h && h->bucket);
-	assert(!h->apply_ongoing);
-
-	clear_items(h);
-
-	free(h->bucket);
-
-	h->bucket = NULL;
-	h->bucket_cnt = 0;
-}
-
-/** Returns true if there are no items in the table. */
-bool hash_table_empty(hash_table_t *h)
-{
-	assert(h && h->bucket);
-	return h->item_cnt == 0;
-}
-
-/** Returns the number of items in the table. */
-size_t hash_table_size(hash_table_t *h)
-{
-	assert(h && h->bucket);
-	return h->item_cnt;
-}
-
-/** Remove all elements from the hash table
- *
- * @param h Hash table to be cleared
- */
-void hash_table_clear(hash_table_t *h)
-{
-	assert(h && h->bucket);
-	assert(!h->apply_ongoing);
-
-	clear_items(h);
-
-	/* Shrink the table to its minimum size if possible. */
-	if (HT_MIN_BUCKETS < h->bucket_cnt) {
-		resize(h, HT_MIN_BUCKETS);
-	}
-}
-
-/** Unlinks and removes all items but does not resize. */
-static void clear_items(hash_table_t *h)
-{
-	if (h->item_cnt == 0)
-		return;
-
-	void (*remove_cb)(ht_link_t *) = h->op->remove_callback ? h->op->remove_callback : nop_remove_callback;
-
-	for (size_t idx = 0; idx < h->bucket_cnt; ++idx) {
-		list_foreach_safe(h->bucket[idx], cur, next) {
-			assert(cur);
-			ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
-
-			list_remove(cur);
-			remove_cb(cur_link);
-		}
-	}
-
-	h->item_cnt = 0;
-}
-
-/** Insert item into a hash table.
- *
- * @param h    Hash table.
- * @param item Item to be inserted into the hash table.
- */
-void hash_table_insert(hash_table_t *h, ht_link_t *item)
-{
-	assert(item);
-	assert(h && h->bucket);
-	assert(!h->apply_ongoing);
-
-	size_t idx = h->op->hash(item) % h->bucket_cnt;
-
-	list_append(&item->link, &h->bucket[idx]);
-	++h->item_cnt;
-	grow_if_needed(h);
-}
-
-/** Insert item into a hash table if not already present.
- *
- * @param h    Hash table.
- * @param item Item to be inserted into the hash table.
- *
- * @return False if such an item had already been inserted.
- * @return True if the inserted item was the only item with such a lookup key.
- */
-bool hash_table_insert_unique(hash_table_t *h, ht_link_t *item)
-{
-	assert(item);
-	assert(h && h->bucket && h->bucket_cnt);
-	assert(h->op && h->op->hash && h->op->equal);
-	assert(!h->apply_ongoing);
-
-	size_t idx = h->op->hash(item) % h->bucket_cnt;
-
-	/* Check for duplicates. */
-	list_foreach(h->bucket[idx], link, ht_link_t, cur_link) {
-		/*
-		 * We could filter out items using their hashes first, but
-		 * calling equal() might very well be just as fast.
-		 */
-		if (h->op->equal(cur_link, item))
-			return false;
-	}
-
-	list_append(&item->link, &h->bucket[idx]);
-	++h->item_cnt;
-	grow_if_needed(h);
-
-	return true;
-}
-
-/** Search hash table for an item matching keys.
- *
- * @param h   Hash table.
- * @param key Array of all keys needed to compute hash index.
- *
- * @return Matching item on success, NULL if there is no such item.
- *
- */
-ht_link_t *hash_table_find(const hash_table_t *h, const void *key)
-{
-	assert(h && h->bucket);
-
-	size_t hash = h->op->key_hash(key);
-	size_t idx = hash % h->bucket_cnt;
-
-	list_foreach(h->bucket[idx], link, ht_link_t, cur_link) {
-		if (h->op->key_equal(key, hash, cur_link))
-			return cur_link;
-	}
-
-	return NULL;
-}
-
-/** Find the next item equal to item. */
-ht_link_t *
-hash_table_find_next(const hash_table_t *h, ht_link_t *item)
-{
-	assert(item);
-	assert(h && h->bucket);
-
-	size_t idx = h->op->hash(item) % h->bucket_cnt;
-	list_t *list = &h->bucket[idx];
-	link_t *cur = list_next(&item->link, list);
-
-	/* Traverse the list until we reach its end. */
-	for (; cur != NULL; cur = list_next(cur, list)) {
-		ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
-
-		if (h->op->equal(cur_link, item))
-			return cur_link;
-	}
-
-	return NULL;
-}
-
-/** Remove all matching items from hash table.
- *
- * For each removed item, h->remove_callback() is called.
- *
- * @param h    Hash table.
- * @param key  Array of keys that will be compared against items of
- *             the hash table.
- *
- * @return Returns the number of removed items.
- */
-size_t hash_table_remove(hash_table_t *h, const void *key)
-{
-	assert(h && h->bucket);
-	assert(!h->apply_ongoing);
-
-	size_t hash = h->op->key_hash(key);
-	size_t idx = hash % h->bucket_cnt;
-
-	size_t removed = 0;
-
-	list_foreach_safe(h->bucket[idx], cur, next) {
-		ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
-
-		if (h->op->key_equal(key, hash, cur_link)) {
-			++removed;
-			list_remove(cur);
-
-			if (h->op->remove_callback)
-				h->op->remove_callback(cur_link);
-		}
-	}
-
-	h->item_cnt -= removed;
-	shrink_if_needed(h);
-
-	return removed;
-}
-
-/** Removes an item already present in the table. The item must be in the table. */
-void hash_table_remove_item(hash_table_t *h, ht_link_t *item)
-{
-	assert(item);
-	assert(h && h->bucket);
-	assert(link_in_use(&item->link));
-
-	list_remove(&item->link);
-	--h->item_cnt;
-
-	if (h->op->remove_callback)
-		h->op->remove_callback(item);
-	shrink_if_needed(h);
-}
-
-/** Apply function to all items in hash table.
- *
- * @param h   Hash table.
- * @param f   Function to be applied. Return false if no more items
- *            should be visited. The functor may only delete the supplied
- *            item. It must not delete the successor of the item passed
- *            in the first argument.
- * @param arg Argument to be passed to the function.
- */
-void hash_table_apply(hash_table_t *h, bool (*f)(ht_link_t *, void *), void *arg)
-{
-	assert(f);
-	assert(h && h->bucket);
-
-	if (h->item_cnt == 0)
-		return;
-
-	h->apply_ongoing = true;
-
-	for (size_t idx = 0; idx < h->bucket_cnt; ++idx) {
-		list_foreach_safe(h->bucket[idx], cur, next) {
-			ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
-			/*
-			 * The next pointer had already been saved. f() may safely
-			 * delete cur (but not next!).
-			 */
-			if (!f(cur_link, arg))
-				goto out;
-		}
-	}
-out:
-	h->apply_ongoing = false;
-
-	shrink_if_needed(h);
-	grow_if_needed(h);
-}
-
-/** Rounds up size to the nearest suitable table size. */
-static size_t round_up_size(size_t size)
-{
-	size_t rounded_size = HT_MIN_BUCKETS;
-
-	while (rounded_size < size) {
-		rounded_size = 2 * rounded_size + 1;
-	}
-
-	return rounded_size;
-}
-
-/** Allocates and initializes the desired number of buckets. True if successful. */
-static bool alloc_table(size_t bucket_cnt, list_t **pbuckets)
-{
-	assert(pbuckets && HT_MIN_BUCKETS <= bucket_cnt);
-
-	list_t *buckets = malloc(bucket_cnt * sizeof(list_t));
-	if (!buckets)
-		return false;
-
-	for (size_t i = 0; i < bucket_cnt; i++)
-		list_initialize(&buckets[i]);
-
-	*pbuckets = buckets;
-	return true;
-}
-
-/** Shrinks the table if the table is only sparely populated. */
-static inline void shrink_if_needed(hash_table_t *h)
-{
-	if (h->item_cnt <= h->full_item_cnt / 4 && HT_MIN_BUCKETS < h->bucket_cnt) {
-		/*
-		 * Keep the bucket_cnt odd (possibly also prime).
-		 * Shrink from 2n + 1 to n. Integer division discards the +1.
-		 */
-		size_t new_bucket_cnt = h->bucket_cnt / 2;
-		resize(h, new_bucket_cnt);
-	}
-}
-
-/** Grows the table if table load exceeds the maximum allowed. */
-static inline void grow_if_needed(hash_table_t *h)
-{
-	/* Grow the table if the average bucket load exceeds the maximum. */
-	if (h->full_item_cnt < h->item_cnt) {
-		/* Keep the bucket_cnt odd (possibly also prime). */
-		size_t new_bucket_cnt = 2 * h->bucket_cnt + 1;
-		resize(h, new_bucket_cnt);
-	}
-}
-
-/** Allocates and rehashes items to a new table. Frees the old table. */
-static void resize(hash_table_t *h, size_t new_bucket_cnt)
-{
-	assert(h && h->bucket);
-	assert(HT_MIN_BUCKETS <= new_bucket_cnt);
-
-	/* We are traversing the table and resizing would mess up the buckets. */
-	if (h->apply_ongoing)
-		return;
-
-	list_t *new_buckets;
-
-	/* Leave the table as is if we cannot resize. */
-	if (!alloc_table(new_bucket_cnt, &new_buckets))
-		return;
-
-	if (0 < h->item_cnt) {
-		/* Rehash all the items to the new table. */
-		for (size_t old_idx = 0; old_idx < h->bucket_cnt; ++old_idx) {
-			list_foreach_safe(h->bucket[old_idx], cur, next) {
-				ht_link_t *cur_link = member_to_inst(cur, ht_link_t, link);
-
-				size_t new_idx = h->op->hash(cur_link) % new_bucket_cnt;
-				list_remove(cur);
-				list_append(cur, &new_buckets[new_idx]);
-			}
-		}
-	}
-
-	free(h->bucket);
-	h->bucket = new_buckets;
-	h->bucket_cnt = new_bucket_cnt;
-	h->full_item_cnt = h->max_load * h->bucket_cnt;
-}
-
-/** @}
- */
Index: mmon/adt/list.c
===================================================================
--- common/adt/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief	Functions completing doubly linked circular list implementation.
- *
- * This file contains some of the functions implementing doubly linked circular lists.
- * However, this ADT is mostly implemented in @ref list.h.
- */
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-/** Check for membership
- *
- * Check whether link is contained in a list.
- * Membership is defined as pointer equivalence.
- *
- * @param link	Item to look for.
- * @param list	List to look in.
- *
- * @return true if link is contained in list, false otherwise.
- *
- */
-bool list_member(const link_t *link, const list_t *list)
-{
-	bool found = false;
-	link_t *hlp = list->head.next;
-
-	while (hlp != &list->head) {
-		if (hlp == link) {
-			found = true;
-			break;
-		}
-		hlp = hlp->next;
-	}
-
-	return found;
-}
-
-/** Moves items of one list into another after the specified item.
- *
- * Inserts all items of @a list after item at @a pos in another list.
- * Both lists may be empty.
- *
- * @param list Source list to move after pos. Empty afterwards.
- * @param pos Source items will be placed after this item.
- */
-void list_splice(list_t *list, link_t *pos)
-{
-	if (list_empty(list))
-		return;
-
-	/* Attach list to destination. */
-	list->head.next->prev = pos;
-	list->head.prev->next = pos->next;
-
-	/* Link destination list to the added list. */
-	pos->next->prev = list->head.prev;
-	pos->next = list->head.next;
-
-	list_initialize(list);
-}
-
-/** Count list items
- *
- * Return the number of items in the list.
- *
- * @param list		List to count.
- * @return		Number of items in the list.
- */
-size_t list_count(const list_t *list)
-{
-	size_t count = 0;
-
-	link_t *link = list_first(list);
-	while (link != NULL) {
-		count++;
-		link = list_next(link, list);
-	}
-
-	return count;
-}
-
-/** @}
- */
Index: mmon/adt/odict.c
===================================================================
--- common/adt/odict.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1144 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_adt
- * @{
- */
-
-/** @file Ordered dictionary.
- *
- * Implementation based on red-black trees.
- * Note that non-data ('leaf') nodes are implemented as NULLs, not
- * as actual nodes.
- */
-
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-
-static void odict_pgu(odlink_t *, odlink_t **, odict_child_sel_t *,
-    odlink_t **, odict_child_sel_t *, odlink_t **);
-
-static void odict_rotate_left(odlink_t *);
-static void odict_rotate_right(odlink_t *);
-static void odict_swap_node(odlink_t *, odlink_t *);
-static void odict_replace_subtree(odlink_t *, odlink_t *);
-static void odict_unlink(odlink_t *);
-static void odict_link_child_a(odlink_t *, odlink_t *);
-static void odict_link_child_b(odlink_t *, odlink_t *);
-static void odict_sibling(odlink_t *, odlink_t *, odict_child_sel_t *,
-    odlink_t **);
-static odlink_t *odict_search_start_node(odict_t *, void *, odlink_t *);
-
-/** Print subtree.
- *
- * Print subtree rooted at @a cur
- *
- * @param cur Root of tree to print
- */
-static void odict_print_tree(odlink_t *cur)
-{
-	if (cur == NULL) {
-		printf("0");
-		return;
-	}
-
-	printf("[%p/%c", cur, cur->color == odc_red ? 'r' : 'b');
-	if (cur->a != NULL || cur->b != NULL) {
-		printf(" ");
-		odict_print_tree(cur->a);
-		printf(" ");
-		odict_print_tree(cur->b);
-	}
-	printf("]");
-}
-
-/** Validate ordered dictionary subtree.
- *
- * Verify that red-black tree properties are satisfied.
- *
- * @param cur Root of tree to verify
- * @param rbd Place to store black depth of the subtree
- *
- * @return EOK on success, EINVAL on failure
- */
-static errno_t odict_validate_tree(odlink_t *cur, int *rbd)
-{
-	errno_t rc;
-	int bd_a, bd_b;
-	int cur_d;
-
-	if (cur->up == NULL) {
-		/* Verify root pointer */
-		if (cur->odict->root != cur) {
-			printf("cur->up == NULL and yet cur != root\n");
-			return EINVAL;
-		}
-
-		/* Verify root color */
-		if (cur->color != odc_black) {
-			printf("Root is not black\n");
-			return EINVAL;
-		}
-	}
-
-	if (cur->a != NULL) {
-		/* Verify symmetry of a - up links */
-		if (cur->a->up != cur) {
-			printf("cur->a->up != cur\n");
-			return EINVAL;
-		}
-
-		/* Verify that if a node is red, its left child is red */
-		if (cur->a->color == odc_red && cur->color == odc_red) {
-			printf("cur->a is red, cur is red\n");
-			return EINVAL;
-		}
-
-		/* Recurse to left child */
-		rc = odict_validate_tree(cur->a, &bd_a);
-		if (rc != EOK)
-			return rc;
-	} else {
-		bd_a = -1;
-	}
-
-	if (cur->b != NULL) {
-		/* Verify symmetry of b - up links */
-		if (cur->b->up != cur) {
-			printf("cur->b->up != cur\n");
-			return EINVAL;
-		}
-
-		/* Verify that if a node is red, its right child is red */
-		if (cur->b->color == odc_red && cur->color == odc_red) {
-			printf("cur->b is red, cur is red\n");
-			return EINVAL;
-		}
-
-		/* Recurse to right child */
-		rc = odict_validate_tree(cur->b, &bd_b);
-		if (rc != EOK)
-			return rc;
-	} else {
-		bd_b = -1;
-	}
-
-	/* Verify that black depths of both children are equal */
-	if (bd_a >= 0 && bd_b >= 0) {
-		if (bd_a != bd_b) {
-			printf("Black depth %d != %d\n", bd_a, bd_b);
-			return EINVAL;
-		}
-	}
-
-	cur_d = cur->color == odc_black ? 1 : 0;
-	if (bd_a >= 0)
-		*rbd = bd_a + cur_d;
-	else if (bd_b >= 0)
-		*rbd = bd_b + cur_d;
-	else
-		*rbd = cur_d;
-
-	return EOK;
-}
-
-/** Validate ordered dictionary properties.
- *
- * @param odict Ordered dictionary
- */
-errno_t odict_validate(odict_t *odict)
-{
-	int bd;
-	errno_t rc;
-
-	if (odict->root == NULL)
-		return EOK;
-
-	rc = odict_validate_tree(odict->root, &bd);
-	if (rc != EOK)
-		odict_print_tree(odict->root);
-
-	return rc;
-}
-
-/** Initialize ordered dictionary.
- *
- * @param odict Ordered dictionary
- * @param getkey Function to get key
- * @param cmp Function to compare entries
- */
-void odict_initialize(odict_t *odict, odgetkey_t getkey, odcmp_t cmp)
-{
-	odict->root = NULL;
-	list_initialize(&odict->entries);
-	odict->getkey = getkey;
-	odict->cmp = cmp;
-}
-
-/** Finalize ordered dictionary.
- *
- * @param odict Ordered dictionary (must be empty)
- */
-void odict_finalize(odict_t *odict)
-{
-	assert(odict->root == NULL);
-}
-
-/** Initialize ordered dictionary link.
- *
- * @param odlink Ordered dictionary link
- */
-void odlink_initialize(odlink_t *odlink)
-{
-	odlink->odict = NULL;
-	odlink->up = NULL;
-	odlink->a = NULL;
-	odlink->b = NULL;
-	link_initialize(&odlink->lentries);
-}
-
-/** Insert entry in ordered dictionary.
- *
- * Insert entry in ordered dictionary, placing it after other entries
- * with the same key.
- *
- * @param odlink New entry
- * @param odict Ordered dictionary
- * @param hint An entry that might be near the new entry or @c NULL
- */
-void odict_insert(odlink_t *odlink, odict_t *odict, odlink_t *hint)
-{
-	int d;
-	odlink_t *cur;
-	odlink_t *p;
-	odlink_t *g;
-	odlink_t *u;
-	odict_child_sel_t pcs, gcs;
-
-	assert(!odlink_used(odlink));
-
-	if (odict->root == NULL) {
-		/* odlink is the root node */
-		odict->root = odlink;
-		odlink->odict = odict;
-		odlink->color = odc_black;
-		list_append(&odlink->lentries, &odict->entries);
-		return;
-	}
-
-	cur = odict_search_start_node(odict, odict->getkey(odlink), hint);
-	while (true) {
-		d = odict->cmp(odict->getkey(odlink), odict->getkey(cur));
-		if (d < 0) {
-			if (cur->a == NULL) {
-				odict_link_child_a(odlink, cur);
-				break;
-			}
-			cur = cur->a;
-		} else {
-			if (cur->b == NULL) {
-				odict_link_child_b(odlink, cur);
-				break;
-			}
-			cur = cur->b;
-		}
-	}
-
-	odlink->color = odc_red;
-
-	while (true) {
-		/* Fix up odlink and its parent potentially being red */
-		if (odlink->up == NULL) {
-			odlink->color = odc_black;
-			break;
-		}
-
-		if (odlink->up->color == odc_black)
-			break;
-
-		/* Get parent, grandparent, uncle */
-		odict_pgu(odlink, &p, &pcs, &g, &gcs, &u);
-
-		if (g == NULL) {
-			p->color = odc_black;
-			break;
-		}
-
-		if (p->color == odc_red && u != NULL && u->color == odc_red) {
-			/* Parent and uncle are both red */
-			p->color = odc_black;
-			u->color = odc_black;
-			g->color = odc_red;
-			odlink = g;
-			continue;
-		}
-
-		/* Parent is red but uncle is black, odlink-P-G is trans */
-		if (pcs != gcs) {
-			if (gcs == odcs_a) {
-				/* odlink is right child of P */
-				/* P is left child of G */
-				odict_rotate_left(p);
-			} else {
-				/* odlink is left child of P */
-				/* P is right child of G */
-				odict_rotate_right(p);
-			}
-
-			odlink = p;
-			odict_pgu(odlink, &p, &pcs, &g, &gcs, &u);
-		}
-
-		/* odlink-P-G is now cis */
-		assert(pcs == gcs);
-		if (pcs == odcs_a) {
-			/* odlink is left child of P */
-			/* P is left child of G */
-			odict_rotate_right(g);
-		} else {
-			/* odlink is right child of P */
-			/* P is right child of G */
-			odict_rotate_left(g);
-		}
-
-		p->color = odc_black;
-		g->color = odc_red;
-		break;
-	}
-}
-
-/** Remove entry from ordered dictionary.
- *
- * @param odlink Ordered dictionary link
- */
-void odict_remove(odlink_t *odlink)
-{
-	odlink_t *n;
-	odlink_t *c;
-	odlink_t *p;
-	odlink_t *s;
-	odlink_t *sc, *st;
-	odict_child_sel_t pcs;
-
-	if (odlink->a != NULL && odlink->b != NULL) {
-		n = odict_next(odlink, odlink->odict);
-		assert(n != NULL);
-
-		odict_swap_node(odlink, n);
-	}
-
-	/* odlink has at most one child */
-	if (odlink->a != NULL) {
-		assert(odlink->b == NULL);
-		c = odlink->a;
-	} else {
-		c = odlink->b;
-	}
-
-	if (odlink->color == odc_red) {
-		/* We can remove it harmlessly */
-		assert(c == NULL);
-		odict_unlink(odlink);
-		return;
-	}
-
-	/* odlink->color == odc_black */
-	if (c != NULL && c->color == odc_red) {
-		/* Child is red: swap colors of S and C */
-		c->color = odc_black;
-		odict_replace_subtree(c, odlink);
-		odlink->up = odlink->a = odlink->b = NULL;
-		odlink->odict = NULL;
-		list_remove(&odlink->lentries);
-		return;
-	}
-
-	/* There cannot be one black child */
-	assert(c == NULL);
-
-	n = NULL;
-	p = odlink->up;
-	odict_unlink(odlink);
-	/* We removed one black node, creating imbalance */
-again:
-	/* Case 1: N is the new root */
-	if (p == NULL)
-		return;
-
-	odict_sibling(n, p, &pcs, &s);
-
-	/* Paths through N have one less black node than paths through S */
-
-	/* Case 2: S is red */
-	if (s->color == odc_red) {
-		assert(p->color == odc_black);
-		p->color = odc_red;
-		s->color = odc_black;
-		if (n == p->a)
-			odict_rotate_left(p);
-		else
-			odict_rotate_right(p);
-		odict_sibling(n, p, &pcs, &s);
-		/* Now S is black */
-		assert(s->color == odc_black);
-	}
-
-	/* Case 3: P, S and S's children are black */
-	if (p->color == odc_black &&
-	    s->color == odc_black &&
-	    (s->a == NULL || s->a->color == odc_black) &&
-	    (s->b == NULL || s->b->color == odc_black)) {
-		/*
-		 * Changing S to red means all paths through S or N have one
-		 * less black node than they should. So redo the same for P.
-		 */
-		s->color = odc_red;
-		n = p;
-		p = n->up;
-		goto again;
-	}
-
-	/* Case 4: P is red, S and S's children are black */
-	if (p->color == odc_red &&
-	    s->color == odc_black &&
-	    (s->a == NULL || s->a->color == odc_black) &&
-	    (s->b == NULL || s->b->color == odc_black)) {
-		/* Swap colors of S and P */
-		s->color = odc_red;
-		p->color = odc_black;
-		return;
-	}
-
-	/* N is the left child */
-	if (pcs == odcs_a) {
-		st = s->a;
-		sc = s->b;
-	} else {
-		st = s->b;
-		sc = s->a;
-	}
-
-	/* Case 5: S is black and S's trans child is red, S's cis child is black */
-	if (s->color == odc_black &&
-	    (st != NULL && st->color == odc_red) &&
-	    (sc == NULL || sc->color == odc_black)) {
-		/* N is the left child */
-		if (pcs == odcs_a)
-			odict_rotate_right(s);
-		else
-			odict_rotate_left(s);
-		s->color = odc_red;
-		s->up->color = odc_black;
-		/* Now N has a black sibling whose cis child is red */
-		odict_sibling(n, p, &pcs, &s);
-		/* N is the left child */
-		if (pcs == odcs_a) {
-			st = s->a;
-			sc = s->b;
-		} else {
-			st = s->b;
-			sc = s->a;
-		}
-	}
-
-	/* Case 6: S is black, S's cis child is red */
-	assert(s->color == odc_black);
-	assert(sc != NULL);
-	assert(sc->color == odc_red);
-
-	if (pcs == odcs_a)
-		odict_rotate_left(p);
-	else
-		odict_rotate_right(p);
-
-	s->color = p->color;
-	p->color = odc_black;
-	sc->color = odc_black;
-}
-
-/** Update dictionary after entry key has been changed.
- *
- * After the caller modifies the key of an entry, they need to call
- * this function so that the dictionary can update itself accordingly.
- *
- * @param odlink Ordered dictionary entry
- * @param odict Ordered dictionary
- */
-void odict_key_update(odlink_t *odlink, odict_t *odict)
-{
-	odlink_t *n;
-
-	n = odict_next(odlink, odict);
-	odict_remove(odlink);
-	odict_insert(odlink, odict, n);
-}
-
-/** Return true if entry is in a dictionary.
- *
- * @param odlink Ordered dictionary entry
- * @return @c true if entry is in a dictionary, @c false otherwise
- */
-bool odlink_used(odlink_t *odlink)
-{
-	return odlink->odict != NULL;
-}
-
-/** Return true if ordered dictionary is empty.
- *
- * @param odict Ordered dictionary
- * @return @c true if @a odict is emptry, @c false otherwise
- */
-bool odict_empty(odict_t *odict)
-{
-	return odict->root == NULL;
-}
-
-/** Return the number of entries in @a odict.
- *
- * @param odict Ordered dictionary
- */
-unsigned long odict_count(odict_t *odict)
-{
-	unsigned long cnt;
-	odlink_t *cur;
-
-	cnt = 0;
-	cur = odict_first(odict);
-	while (cur != NULL) {
-		++cnt;
-		cur = odict_next(cur, odict);
-	}
-
-	return cnt;
-}
-
-/** Return first entry in a list or @c NULL if list is empty.
- *
- * @param odict Ordered dictionary
- * @return First entry
- */
-odlink_t *odict_first(odict_t *odict)
-{
-	link_t *link;
-
-	link = list_first(&odict->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, odlink_t, lentries);
-}
-
-/** Return last entry in a list or @c NULL if list is empty
- *
- * @param odict Ordered dictionary
- * @return Last entry
- */
-odlink_t *odict_last(odict_t *odict)
-{
-	link_t *link;
-
-	link = list_last(&odict->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, odlink_t, lentries);
-}
-
-/** Return previous entry in list or @c NULL if @a link is the first one.
- *
- * @param odlink Entry
- * @param odict Ordered dictionary
- * @return Previous entry
- */
-odlink_t *odict_prev(odlink_t *odlink, odict_t *odict)
-{
-	link_t *link;
-
-	link = list_prev(&odlink->lentries, &odlink->odict->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, odlink_t, lentries);
-}
-
-/** Return next entry in dictionary or @c NULL if @a odlink is the last one
- *
- * @param odlink Entry
- * @param odict Ordered dictionary
- * @return Next entry
- */
-odlink_t *odict_next(odlink_t *odlink, odict_t *odict)
-{
-	link_t *link;
-
-	link = list_next(&odlink->lentries, &odlink->odict->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, odlink_t, lentries);
-}
-
-/** Find first entry whose key is equal to @a key/
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_eq(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *geq;
-
-	geq = odict_find_geq(odict, key, hint);
-	if (geq == NULL)
-		return NULL;
-
-	if (odict->cmp(odict->getkey(geq), key) == 0)
-		return geq;
-	else
-		return NULL;
-}
-
-/** Find last entry whose key is equal to @a key/
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_eq_last(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *leq;
-
-	leq = odict_find_leq(odict, key, hint);
-	if (leq == NULL)
-		return NULL;
-
-	if (odict->cmp(odict->getkey(leq), key) == 0)
-		return leq;
-	else
-		return NULL;
-}
-
-/** Find first entry whose key is greater than or equal to @a key
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_geq(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *cur;
-	odlink_t *next;
-	int d;
-
-	cur = odict_search_start_node(odict, key, hint);
-	if (cur == NULL)
-		return NULL;
-
-	while (true) {
-		d = odict->cmp(odict->getkey(cur), key);
-		if (d >= 0)
-			next = cur->a;
-		else
-			next = cur->b;
-
-		if (next == NULL)
-			break;
-
-		cur = next;
-	}
-
-	if (d >= 0) {
-		return cur;
-	} else {
-		return odict_next(cur, odict);
-	}
-}
-
-/** Find last entry whose key is greater than @a key.
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_gt(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *leq;
-
-	leq = odict_find_leq(odict, key, hint);
-	if (leq != NULL)
-		return odict_next(leq, odict);
-	else
-		return odict_first(odict);
-}
-
-/** Find last entry whose key is less than or equal to @a key
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_leq(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *cur;
-	odlink_t *next;
-	int d;
-
-	cur = odict_search_start_node(odict, key, hint);
-	if (cur == NULL)
-		return NULL;
-
-	while (true) {
-		d = odict->cmp(key, odict->getkey(cur));
-		if (d >= 0)
-			next = cur->b;
-		else
-			next = cur->a;
-
-		if (next == NULL)
-			break;
-
-		cur = next;
-	}
-
-	if (d >= 0) {
-		return cur;
-	} else {
-		return odict_prev(cur, odict);
-	}
-}
-
-/** Find last entry whose key is less than @a key.
- *
- * @param odict Ordered dictionary
- * @param key Key
- * @param hint Nearby entry
- * @return Pointer to entry on success, @c NULL on failure
- */
-odlink_t *odict_find_lt(odict_t *odict, void *key, odlink_t *hint)
-{
-	odlink_t *geq;
-
-	geq = odict_find_geq(odict, key, hint);
-	if (geq != NULL)
-		return odict_prev(geq, odict);
-	else
-		return odict_last(odict);
-}
-
-/** Return parent, grandparent and uncle.
- *
- * @param n Node
- * @param p Place to store pointer to parent of @a n
- * @param pcs Place to store position of @a n w.r.t. @a p
- * @param g Place to store pointer to grandparent of @a n
- * @param gcs Place to store position of @a p w.r.t. @a g
- * @param u Place to store pointer to uncle of @a n
- */
-static void odict_pgu(odlink_t *n, odlink_t **p, odict_child_sel_t *pcs,
-    odlink_t **g, odict_child_sel_t *gcs, odlink_t **u)
-{
-	*p = n->up;
-
-	if (*p == NULL) {
-		/* No parent */
-		*g = NULL;
-		*u = NULL;
-		return;
-	}
-
-	if ((*p)->a == n) {
-		*pcs = odcs_a;
-	} else {
-		assert((*p)->b == n);
-		*pcs = odcs_b;
-	}
-
-	*g = (*p)->up;
-	if (*g == NULL) {
-		/* No grandparent */
-		*u = NULL;
-		return;
-	}
-
-	if ((*g)->a == *p) {
-		*gcs = odcs_a;
-		*u = (*g)->b;
-	} else {
-		assert((*g)->b == *p);
-		*gcs = odcs_b;
-		*u = (*g)->a;
-	}
-}
-
-/** Return sibling and parent w.r.t. parent.
- *
- * @param n Node
- * @param p Parent of @ an
- * @param pcs Place to store position of @a n w.r.t. @a p.
- * @param rs Place to strore pointer to sibling
- */
-static void odict_sibling(odlink_t *n, odlink_t *p, odict_child_sel_t *pcs,
-    odlink_t **rs)
-{
-	if (p->a == n) {
-		*pcs = odcs_a;
-		*rs = p->b;
-	} else {
-		*pcs = odcs_b;
-		*rs = p->a;
-	}
-}
-
-/** Ordered dictionary left rotation.
- *
- *    Q           P
- *  P   C   <- A    Q
- * A B             B C
- *
- */
-static void odict_rotate_left(odlink_t *p)
-{
-	odlink_t *q;
-
-	q = p->b;
-	assert(q != NULL);
-
-	/* Replace P with Q as the root of the subtree */
-	odict_replace_subtree(q, p);
-
-	/* Relink P under Q, B under P */
-	p->up = q;
-	p->b = q->a;
-	if (p->b != NULL)
-		p->b->up = p;
-	q->a = p;
-
-	/* Fix odict root */
-	if (p->odict->root == p)
-		p->odict->root = q;
-}
-
-/** Ordered dictionary right rotation.
- *
- *    Q           P
- *  P   C   -> A    Q
- * A B             B C
- *
- */
-static void odict_rotate_right(odlink_t *q)
-{
-	odlink_t *p;
-
-	p = q->a;
-	assert(p != NULL);
-
-	/* Replace Q with P as the root of the subtree */
-	odict_replace_subtree(p, q);
-
-	/* Relink Q under P, B under Q */
-	q->up = p;
-	q->a = p->b;
-	if (q->a != NULL)
-		q->a->up = q;
-	p->b = q;
-
-	/* Fix odict root */
-	if (q->odict->root == q)
-		q->odict->root = p;
-}
-
-/** Swap two nodes.
- *
- * Swap position of two nodes in the tree, keeping their identity.
- * This means we don't copy the contents, instead we shuffle around pointers
- * from and to the nodes.
- *
- * @param a First node
- * @param b Second node
- */
-static void odict_swap_node(odlink_t *a, odlink_t *b)
-{
-	odlink_t *n;
-	odict_color_t c;
-
-	/* Backlink from A's parent */
-	if (a->up != NULL && a->up != b) {
-		if (a->up->a == a) {
-			a->up->a = b;
-		} else {
-			assert(a->up->b == a);
-			a->up->b = b;
-		}
-	}
-
-	/* Backlink from A's left child */
-	if (a->a != NULL && a->a != b)
-		a->a->up = b;
-	/* Backling from A's right child */
-	if (a->b != NULL && a->b != b)
-		a->b->up = b;
-
-	/* Backlink from B's parent */
-	if (b->up != NULL && b->up != a) {
-		if (b->up->a == b) {
-			b->up->a = a;
-		} else {
-			assert(b->up->b == b);
-			b->up->b = a;
-		}
-	}
-
-	/* Backlink from B's left child */
-	if (b->a != NULL && b->a != a)
-		b->a->up = a;
-	/* Backling from B's right child */
-	if (b->b != NULL && b->b != a)
-		b->b->up = a;
-
-	/*
-	 * Swap links going out of A and out of B
-	 */
-	n = a->up;
-	a->up = b->up;
-	b->up = n;
-
-	n = a->a;
-	a->a = b->a;
-	b->a = n;
-
-	n = a->b;
-	a->b = b->b;
-	b->b = n;
-
-	c = a->color;
-	a->color = b->color;
-	b->color = c;
-
-	/* When A and B are adjacent, fix self-loops that might have arisen */
-	if (a->up == a)
-		a->up = b;
-	if (a->a == a)
-		a->a = b;
-	if (a->b == a)
-		a->b = b;
-	if (b->up == b)
-		b->up = a;
-	if (b->a == b)
-		b->a = a;
-	if (b->b == b)
-		b->b = a;
-
-	/* Fix odict root */
-	if (a == a->odict->root)
-		a->odict->root = b;
-	else if (b == a->odict->root)
-		a->odict->root = a;
-}
-
-/** Replace subtree.
- *
- * Replace subtree @a old with another subtree @a n. This makes the parent
- * point to the new subtree root and the up pointer of @a n to point to
- * the parent.
- *
- * @param old Subtree to be replaced
- * @param n New subtree
- */
-static void odict_replace_subtree(odlink_t *n, odlink_t *old)
-{
-	if (old->up != NULL) {
-		if (old->up->a == old) {
-			old->up->a = n;
-		} else {
-			assert(old->up->b == old);
-			old->up->b = n;
-		}
-	} else {
-		assert(old->odict->root == old);
-		old->odict->root = n;
-	}
-
-	n->up = old->up;
-}
-
-/** Unlink node.
- *
- * @param n Ordered dictionary node
- */
-static void odict_unlink(odlink_t *n)
-{
-	if (n->up != NULL) {
-		if (n->up->a == n) {
-			n->up->a = NULL;
-		} else {
-			assert(n->up->b == n);
-			n->up->b = NULL;
-		}
-
-		n->up = NULL;
-	} else {
-		assert(n->odict->root == n);
-		n->odict->root = NULL;
-	}
-
-	if (n->a != NULL) {
-		n->a->up = NULL;
-		n->a = NULL;
-	}
-
-	if (n->b != NULL) {
-		n->b->up = NULL;
-		n->b = NULL;
-	}
-
-	n->odict = NULL;
-	list_remove(&n->lentries);
-}
-
-/** Link node as left child.
- *
- * Append new node @a n as left child of existing node @a old.
- *
- * @param n New node
- * @param old Old node
- */
-static void odict_link_child_a(odlink_t *n, odlink_t *old)
-{
-	old->a = n;
-	n->up = old;
-	n->odict = old->odict;
-	list_insert_before(&n->lentries, &old->lentries);
-}
-
-/** Link node as right child.
- *
- * Append new node @a n as right child of existing node @a old.
- *
- * @param n New node
- * @param old Old node
- */
-static void odict_link_child_b(odlink_t *n, odlink_t *old)
-{
-	old->b = n;
-	n->up = old;
-	n->odict = old->odict;
-	list_insert_after(&n->lentries, &old->lentries);
-}
-
-/** Get node where search should be started.
- *
- * @param odict Ordered dictionary
- * @param key Key being searched for
- * @param hint Node that might be near the search target or @c NULL
- *
- * @return Node from where search should be started
- */
-static odlink_t *odict_search_start_node(odict_t *odict, void *key,
-    odlink_t *hint)
-{
-	odlink_t *a;
-	odlink_t *b;
-	odlink_t *cur;
-	int d, da, db;
-
-	assert(hint == NULL || hint->odict == odict);
-
-	/* If the key is greater than the maximum, start search in the maximum */
-	b = odict_last(odict);
-	if (b != NULL) {
-		d = odict->cmp(odict->getkey(b), key);
-		if (d < 0)
-			return b;
-	}
-
-	/* If the key is less tna the minimum, start search in the minimum */
-	a = odict_first(odict);
-	if (a != NULL) {
-		d = odict->cmp(key, odict->getkey(a));
-		if (d < 0)
-			return a;
-	}
-
-	/*
-	 * Proposition: Let A, B be two BST nodes such that B is a descendant
-	 * of A. Let N be a node such that either key(A) < key(N) < key(B)
-	 * Then N is a descendant of A.
-	 * Corollary: We can start searching for N from A, instead from
-	 * the root.
-	 *
-	 * Proof: When walking the BST in order, visit_tree(A) does a
-	 * visit_tree(A->a), visit(A), visit(A->b). If key(A) < key(B),
-	 * we will first visit A, then while visiting all nodes with values
-	 * between A and B we will not leave subtree A->b.
-	 */
-
-	/* If there is no hint, start search from the root */
-	if (hint == NULL)
-		return odict->root;
-
-	/*
-	 * Start from hint and walk up to the root, keeping track of
-	 * minimum and maximum. Once key is strictly between them,
-	 * we can return the current node, which we've proven to be
-	 * an ancestor of a potential node with the given key
-	 */
-	a = b = cur = hint;
-	while (cur->up != NULL) {
-		cur = cur->up;
-
-		d = odict->cmp(odict->getkey(cur), odict->getkey(a));
-		if (d < 0)
-			a = cur;
-
-		d = odict->cmp(odict->getkey(b), odict->getkey(cur));
-		if (d < 0)
-			b = cur;
-
-		da = odict->cmp(odict->getkey(a), key);
-		db = odict->cmp(key, odict->getkey(b));
-		if (da < 0 && db < 0) {
-			/* Both a and b are descendants of cur */
-			return cur;
-		}
-	}
-
-	return odict->root;
-}
-
-/** @}
- */
Index: mmon/gsort.c
===================================================================
--- common/gsort.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2005 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief Gnome Sort.
- *
- * This file contains an implementation of gnome sort
- *
- */
-
-#include <gsort.h>
-#include <inttypes.h>
-#include <mem.h>
-#include <stdlib.h>
-
-/** Immediate buffer size.
- *
- * For small buffer sizes avoid doing malloc()
- * and use the stack.
- *
- */
-#define IBUF_SIZE  32
-
-/** Array accessor.
- *
- */
-#define INDEX(buf, i, elem_size)  ((buf) + (i) * (elem_size))
-
-/** Gnome sort
- *
- * Apply generic gnome sort algorithm on supplied data,
- * using pre-allocated buffer.
- *
- * @param data      Pointer to data to be sorted.
- * @param cnt       Number of elements to be sorted.
- * @param elem_size Size of one element.
- * @param cmp       Comparator function.
- * @param arg       3rd argument passed to cmp.
- * @param slot      Pointer to scratch memory buffer
- *                  elem_size bytes long.
- *
- */
-static void _gsort(void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp,
-    void *arg, void *slot)
-{
-	size_t i = 0;
-
-	while (i < cnt) {
-		if ((i != 0) &&
-		    (cmp(INDEX(data, i, elem_size),
-		    INDEX(data, i - 1, elem_size), arg) < 0)) {
-			memcpy(slot, INDEX(data, i, elem_size), elem_size);
-			memcpy(INDEX(data, i, elem_size), INDEX(data, i - 1, elem_size),
-			    elem_size);
-			memcpy(INDEX(data, i - 1, elem_size), slot, elem_size);
-			i--;
-		} else
-			i++;
-	}
-}
-
-/** Gnome sort wrapper
- *
- * This is only a wrapper that takes care of memory
- * allocations for storing the slot element for generic
- * gnome sort algorithm.
- *
- * @param data      Pointer to data to be sorted.
- * @param cnt       Number of elements to be sorted.
- * @param elem_size Size of one element.
- * @param cmp       Comparator function.
- * @param arg       3rd argument passed to cmp.
- *
- * @return True if sorting succeeded.
- *
- */
-bool gsort(void *data, size_t cnt, size_t elem_size, sort_cmp_t cmp, void *arg)
-{
-	uint8_t ibuf_slot[IBUF_SIZE];
-	void *slot;
-
-	if (elem_size > IBUF_SIZE) {
-		slot = (void *) malloc(elem_size);
-		if (!slot)
-			return false;
-	} else
-		slot = (void *) ibuf_slot;
-
-	_gsort(data, cnt, elem_size, cmp, arg, slot);
-
-	if (elem_size > IBUF_SIZE)
-		free(slot);
-
-	return true;
-}
-
-/** @}
- */
Index: mmon/include/adt/bitmap.h
===================================================================
--- common/include/adt/bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_BITMAP_H_
-#define _LIBC_BITMAP_H_
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#define BITMAP_ELEMENT   8
-#define BITMAP_REMAINER  7
-
-typedef struct {
-	size_t elements;
-	uint8_t *bits;
-	size_t next_fit;
-} bitmap_t;
-
-static inline void bitmap_set(bitmap_t *bitmap, size_t element,
-    unsigned int value)
-{
-	if (element >= bitmap->elements)
-		return;
-
-	size_t byte = element / BITMAP_ELEMENT;
-	uint8_t mask = 1 << (element & BITMAP_REMAINER);
-
-	if (value) {
-		bitmap->bits[byte] |= mask;
-	} else {
-		bitmap->bits[byte] &= ~mask;
-		bitmap->next_fit = byte;
-	}
-}
-
-static inline unsigned int bitmap_get(bitmap_t *bitmap, size_t element)
-{
-	if (element >= bitmap->elements)
-		return 0;
-
-	size_t byte = element / BITMAP_ELEMENT;
-	uint8_t mask = 1 << (element & BITMAP_REMAINER);
-
-	return !!((bitmap->bits)[byte] & mask);
-}
-
-extern size_t bitmap_size(size_t);
-extern void bitmap_initialize(bitmap_t *, size_t, void *);
-
-extern void bitmap_set_range(bitmap_t *, size_t, size_t);
-extern void bitmap_clear_range(bitmap_t *, size_t, size_t);
-
-extern bool bitmap_allocate_range(bitmap_t *, size_t, size_t, size_t, size_t,
-    size_t *);
-extern void bitmap_copy(bitmap_t *, bitmap_t *, size_t);
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/checksum.h
===================================================================
--- common/include/adt/checksum.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Dominik Taborsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_CHECKSUM_H_
-#define _LIBC_CHECKSUM_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-extern uint32_t compute_crc32(uint8_t *, size_t);
-extern uint32_t compute_crc32_seed(uint8_t *, size_t, uint32_t);
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/circ_buf.h
===================================================================
--- common/include/adt/circ_buf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file Circular buffer
- */
-
-#ifndef _LIBC_CIRC_BUF_H_
-#define _LIBC_CIRC_BUF_H_
-
-#include <errno.h>
-#include <stddef.h>
-
-/** Circular buffer */
-typedef struct {
-	/** Buffer */
-	void *buf;
-	/** Number of buffer members */
-	size_t nmemb;
-	/** Member size */
-	size_t size;
-	/** Read position */
-	size_t rp;
-	/** Write position */
-	size_t wp;
-	/** Number of used entries */
-	size_t nused;
-} circ_buf_t;
-
-extern void circ_buf_init(circ_buf_t *, void *, size_t, size_t);
-extern size_t circ_buf_nfree(circ_buf_t *);
-extern size_t circ_buf_nused(circ_buf_t *);
-extern errno_t circ_buf_push(circ_buf_t *, const void *);
-extern errno_t circ_buf_pop(circ_buf_t *, void *);
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/fifo.h
===================================================================
--- common/include/adt/fifo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-/*
- * This implementation of FIFO stores values in an array
- * (static or dynamic). As such, these FIFOs have upper bound
- * on number of values they can store. Push and pop operations
- * are done via accessing the array through head and tail indices.
- * Because of better operation ordering in fifo_pop(), the access
- * policy for these two indices is to 'increment (mod size of FIFO)
- * and use'.
- */
-
-#ifndef _LIBC_FIFO_H_
-#define _LIBC_FIFO_H_
-
-#include <stdlib.h>
-
-typedef unsigned long fifo_count_t;
-typedef unsigned long fifo_index_t;
-
-#define FIFO_CREATE_STATIC(name, t, itms) \
-	struct { \
-		t fifo[(itms)]; \
-		fifo_count_t items; \
-		fifo_index_t head; \
-		fifo_index_t tail; \
-	} name
-
-/** Create and initialize static FIFO.
- *
- * FIFO is allocated statically.
- * This macro is suitable for creating smaller FIFOs.
- *
- * @param name Name of FIFO.
- * @param t Type of values stored in FIFO.
- * @param itms Number of items that can be stored in FIFO.
- */
-#define FIFO_INITIALIZE_STATIC(name, t, itms)		\
-	FIFO_CREATE_STATIC(name, t, itms) = {		\
-		.items = (itms),			\
-		.head = 0,				\
-		.tail = 0				\
-	}
-
-/** Create and prepare dynamic FIFO.
- *
- * FIFO is allocated dynamically.
- * This macro is suitable for creating larger FIFOs.
- *
- * @param name Name of FIFO.
- * @param t Type of values stored in FIFO.
- * @param itms Number of items that can be stored in FIFO.
- */
-#define FIFO_INITIALIZE_DYNAMIC(name, t, itms)		\
-	struct {					\
-		t *fifo;				\
-		fifo_count_t items;			\
-		fifo_index_t head;			\
-		fifo_index_t tail;			\
-	} name = {					\
-		.fifo = NULL,				\
-		.items = (itms),			\
-		.head = 0,				\
-		.tail = 0				\
-	}
-
-/** Pop value from head of FIFO.
- *
- * @param name FIFO name.
- *
- * @return Leading value in FIFO.
- */
-#define fifo_pop(name) \
-	name.fifo[name.head = (name.head + 1) < name.items ? (name.head + 1) : 0]
-
-/** Push value to tail of FIFO.
- *
- * @param name FIFO name.
- * @param value Value to be appended to FIFO.
- *
- */
-#define fifo_push(name, value) \
-	name.fifo[name.tail = (name.tail + 1) < name.items ? (name.tail + 1) : 0] = (value)
-
-/** Allocate memory for dynamic FIFO.
- *
- * @param name FIFO name.
- */
-#define fifo_create(name) \
-	name.fifo = malloc(sizeof(*name.fifo) * name.items)
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/gcdlcm.h
===================================================================
--- common/include/adt/gcdlcm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_GCDLCM_H_
-#define _LIBC_GCDLCM_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#define DECLARE_GCD(type, name) \
-	static inline type name(type a, type b) \
-	{ \
-		if (a == 0) \
-			return b; \
-		 \
-		while (b != 0) { \
-			if (a > b) \
-				a -= b; \
-			else \
-				b -= a; \
-		} \
-		 \
-		return a; \
-	}
-
-#define DECLARE_LCM(type, name, gcd) \
-	static inline type name(type a, type b) \
-	{ \
-		return (a * b) / gcd(a, b); \
-	}
-
-DECLARE_GCD(uint32_t, gcd32);
-DECLARE_GCD(uint64_t, gcd64);
-DECLARE_GCD(size_t, gcd);
-
-DECLARE_LCM(uint32_t, lcm32, gcd32);
-DECLARE_LCM(uint64_t, lcm64, gcd64);
-DECLARE_LCM(size_t, lcm, gcd);
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/hash.h
===================================================================
--- common/include/adt/hash.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-#ifndef _LIBC_ADT_HASH_H_
-#define _LIBC_ADT_HASH_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-/** Produces a uniform hash affecting all output bits from the skewed input. */
-static inline uint32_t hash_mix32(uint32_t hash)
-{
-	/*
-	 * Thomas Wang's modification of Bob Jenkin's hash mixing function:
-	 * http://www.concentric.net/~Ttwang/tech/inthash.htm
-	 * Public domain.
-	 */
-	hash = ~hash + (hash << 15);
-	hash = hash ^ (hash >> 12);
-	hash = hash + (hash << 2);
-	hash = hash ^ (hash >> 4);
-	hash = hash * 2057;
-	hash = hash ^ (hash >> 16);
-	return hash;
-}
-
-/** Produces a uniform hash affecting all output bits from the skewed input. */
-static inline uint64_t hash_mix64(uint64_t hash)
-{
-	/*
-	 * Thomas Wang's public domain 64-bit hash mixing function:
-	 * http://www.concentric.net/~Ttwang/tech/inthash.htm
-	 */
-	hash = (hash ^ 61) ^ (hash >> 16);
-	hash = hash + (hash << 3);
-	hash = hash ^ (hash >> 4);
-	hash = hash * 0x27d4eb2d;
-	hash = hash ^ (hash >> 15);
-	/*
-	 * Lower order bits are mixed more thoroughly. Swap them with
-	 * the higher order bits and make the resulting higher order bits
-	 * more usable.
-	 */
-	return (hash << 32) | (hash >> 32);
-}
-
-/** Produces a uniform hash affecting all output bits from the skewed input. */
-static inline size_t hash_mix(size_t hash)
-{
-	if (sizeof(long) == 4)
-		return hash_mix32(hash);
-	else
-		return hash_mix64(hash);
-}
-
-/** Use to create a hash from multiple values.
- *
- * Typical usage:
- * @code
- * int car_id;
- * bool car_convertible;
- * // ..
- * size_t hash = 0;
- * hash = hash_combine(hash, car_id);
- * hash = hash_combine(hash, car_convertible);
- * // Now use hash as a hash of both car_id and car_convertible.
- * @endcode
- */
-static inline size_t hash_combine(size_t seed, size_t hash)
-{
-	/*
-	 * todo: use Bob Jenkin's proper mixing hash pass:
-	 * http://burtleburtle.net/bob/c/lookup3.c
-	 */
-	seed ^= hash + 0x9e3779b9 +
-	    ((seed << 5) | (seed >> (sizeof(size_t) * 8 - 5)));
-	return seed;
-}
-
-/** Hash a NUL-terminated string.
- * The algorithm may change in the future, so never use it for hashes
- * that will be stored to a file or sent over a network.
- */
-static inline size_t hash_string(const char *str)
-{
-	/* djb2 hash + extra mixing at the end */
-
-	char c;
-	size_t hash = 5381;
-
-	while ((c = *(str++)))
-		hash = (hash << 5) + hash + c;
-
-	return hash_mix(hash);
-}
-
-/** Hash an arbitrarily sized sequence of bytes.
- * The algorithm may change in the future, so never use it for hashes
- * that will be stored to a file or sent over a network.
- */
-static inline size_t hash_bytes(const void *b, size_t len)
-{
-	/* djb2 hash + extra mixing at the end */
-
-	// TODO: work in bigger chunks for faster hashing
-
-	const char *str = b;
-
-	size_t hash = 5381;
-
-	for (size_t i = 0; i < len; i++)
-		hash = (hash << 5) + hash + str[i];
-
-	return hash_mix(hash);
-}
-
-#endif
Index: mmon/include/adt/hash_table.h
===================================================================
--- common/include/adt/hash_table.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2012 Adam Hraska
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_HASH_TABLE_H_
-#define _LIBC_HASH_TABLE_H_
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <macros.h>
-#include <member.h>
-
-/** Opaque hash table link type. */
-typedef struct ht_link {
-	link_t link;
-} ht_link_t;
-
-/** Set of operations for hash table. */
-typedef struct {
-	/** Returns the hash of the key stored in the item (ie its lookup key). */
-	size_t (*hash)(const ht_link_t *item);
-
-	/** Returns the hash of the key. */
-	size_t (*key_hash)(const void *key);
-
-	/** True if the items are equal (have the same lookup keys). */
-	bool (*equal)(const ht_link_t *item1, const ht_link_t *item2);
-
-	/** Returns true if the key is equal to the item's lookup key. */
-	bool (*key_equal)(const void *key, size_t hash, const ht_link_t *item);
-
-	/** Hash table item removal callback.
-	 *
-	 * Must not invoke any mutating functions of the hash table.
-	 *
-	 * @param item Item that was removed from the hash table.
-	 */
-	void (*remove_callback)(ht_link_t *item);
-} hash_table_ops_t;
-
-/** Hash table structure. */
-typedef struct {
-	const hash_table_ops_t *op;
-	list_t *bucket;
-	size_t bucket_cnt;
-	size_t full_item_cnt;
-	size_t item_cnt;
-	size_t max_load;
-	bool apply_ongoing;
-} hash_table_t;
-
-#define hash_table_get_inst(item, type, member) \
-	member_to_inst((item), type, member)
-
-/** Iterate over all entries associated with a given key.
- * For iterating over all entries regardless of key, use hash_table_apply().
- *
- * Example:
- * struct ht_entry {
- *     ht_link_t my_link_member;
- *     void *data;
- *     int my_key;
- * }
- *
- * hash_table_t *table = ...;
- * int key = ...;
- *
- * hash_table_foreach(table, &key, my_link_member, struct ht_entry, item) {
- *     _print_entry_data(item->data);
- * }
- */
-#define hash_table_foreach(ht, key, member, itype, iterator) \
-	for (itype *iterator = NULL; \
-	    iterator == NULL; iterator = (itype *) INTPTR_MAX) \
-		for (ht_link_t *__link = hash_table_find((ht), (key)); \
-		    __link != NULL && ((iterator = member_to_inst(__link, itype, member))); \
-			__link = hash_table_find_next((ht), __link))
-
-extern bool hash_table_create(hash_table_t *, size_t, size_t,
-    const hash_table_ops_t *);
-extern void hash_table_destroy(hash_table_t *);
-
-extern bool hash_table_empty(hash_table_t *);
-extern size_t hash_table_size(hash_table_t *);
-
-extern void hash_table_clear(hash_table_t *);
-extern void hash_table_insert(hash_table_t *, ht_link_t *);
-extern bool hash_table_insert_unique(hash_table_t *, ht_link_t *);
-extern ht_link_t *hash_table_find(const hash_table_t *, const void *);
-extern ht_link_t *hash_table_find_next(const hash_table_t *, ht_link_t *);
-extern size_t hash_table_remove(hash_table_t *, const void *);
-extern void hash_table_remove_item(hash_table_t *, ht_link_t *);
-extern void hash_table_apply(hash_table_t *, bool (*)(ht_link_t *, void *),
-    void *);
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/list.h
===================================================================
--- common/include/adt/list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,473 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_LIST_H_
-#define _LIBC_LIST_H_
-
-#include <assert.h>
-#include <member.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <trace.h>
-#include <_bits/decls.h>
-
-#ifndef __cplusplus
-
-/**
- * We don't define the macros in C++ to avoid polluting headers with
- * namespaceless names. We don't actually need them, so this is fine.
- * We still allow including the rest of the file (in `helenos` namespace)
- * so that we can expose publicly visible types that have list_t members.
- */
-
-/** Declare and initialize statically allocated list.
- *
- * @param name Name of the new statically allocated list.
- *
- */
-#define LIST_INITIALIZE(name) \
-	list_t name = LIST_INITIALIZER(name)
-
-/** Initializer for statically allocated list.
- *
- * @code
- * struct named_list {
- *     const char *name;
- *     list_t list;
- * } var = {
- *     .name = "default name",
- *     .list = LIST_INITIALIZER(name_list.list)
- * };
- * @endcode
- *
- * @param name Name of the new statically allocated list.
- *
- */
-#define LIST_INITIALIZER(name) \
-	{ \
-		.head = { \
-			.prev = &(name).head, \
-			.next = &(name).head \
-		} \
-	}
-
-#define list_get_instance(link, type, member) \
-	member_to_inst(link, type, member)
-
-#define list_foreach(list, member, itype, iterator) \
-	for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) sizeof(itype)) \
-		for (link_t *_link = (list).head.next; \
-		    iterator = list_get_instance(_link, itype, member), \
-		    _link != &(list).head; _link = _link->next)
-
-#define list_foreach_rev(list, member, itype, iterator) \
-	for (itype *iterator = NULL; iterator == NULL; iterator = (itype *) sizeof(itype)) \
-		for (link_t *_link = (list).head.prev; \
-		    iterator = list_get_instance(_link, itype, member), \
-		    _link != &(list).head; _link = _link->prev)
-
-/** Unlike list_foreach(), allows removing items while traversing a list.
- *
- * @code
- * list_t mylist;
- * typedef struct item {
- *     int value;
- *     link_t item_link;
- * } item_t;
- *
- * //..
- *
- * // Print each list element's value and remove the element from the list.
- * list_foreach_safe(mylist, cur_link, next_link) {
- *     item_t *cur_item = list_get_instance(cur_link, item_t, item_link);
- *     printf("%d\n", cur_item->value);
- *     list_remove(cur_link);
- * }
- * @endcode
- *
- * @param list List to traverse.
- * @param iterator Iterator to the current element of the list.
- *             The item this iterator points may be safely removed
- *             from the list.
- * @param next_iter Iterator to the next element of the list.
- */
-#define list_foreach_safe(list, iterator, next_iter) \
-	for (link_t *iterator = (list).head.next, \
-	    *next_iter = iterator->next; \
-	    iterator != &(list).head; \
-	    iterator = next_iter, next_iter = iterator->next)
-
-#define assert_link_not_used(link) \
-	assert(!link_used(link))
-
-#define list_pop(list, type, member) \
-	((type *) list_pop_internal(list, \
-	    (list_link_to_void(&((type) {}).member), offsetof(type, member))))
-
-#endif  /* !__cplusplus */
-
-__HELENOS_DECLS_BEGIN;
-
-/** Doubly linked list link. */
-typedef struct __adt_list_link {
-	struct __adt_list_link *prev;  /**< Pointer to the previous item in the list. */
-	struct __adt_list_link *next;  /**< Pointer to the next item in the list. */
-} link_t;
-
-/** Doubly linked list. */
-typedef struct {
-	link_t head;  /**< List head. Does not have any data. */
-} list_t;
-
-extern bool list_member(const link_t *, const list_t *);
-extern void list_splice(list_t *, link_t *);
-extern size_t list_count(const list_t *);
-
-/** Returns true if the link is definitely part of a list. False if not sure. */
-static inline bool link_in_use(const link_t *link)
-{
-	return link->prev != NULL && link->next != NULL;
-}
-
-/** Initialize doubly-linked circular list link
- *
- * Initialize doubly-linked list link.
- *
- * @param link Pointer to link_t structure to be initialized.
- *
- */
-_NO_TRACE static inline void link_initialize(link_t *link)
-{
-	link->prev = NULL;
-	link->next = NULL;
-}
-
-/** Initialize doubly-linked circular list
- *
- * Initialize doubly-linked circular list.
- *
- * @param list Pointer to list_t structure.
- *
- */
-_NO_TRACE static inline __CONSTEXPR void list_initialize(list_t *list)
-{
-	list->head.prev = &list->head;
-	list->head.next = &list->head;
-}
-
-/** Insert item before another item in doubly-linked circular list.
- *
- */
-static inline void list_insert_before(link_t *lnew, link_t *lold)
-{
-	lnew->next = lold;
-	lnew->prev = lold->prev;
-	lold->prev->next = lnew;
-	lold->prev = lnew;
-}
-
-/** Insert item after another item in doubly-linked circular list.
- *
- */
-static inline void list_insert_after(link_t *lnew, link_t *lold)
-{
-	lnew->prev = lold;
-	lnew->next = lold->next;
-	lold->next->prev = lnew;
-	lold->next = lnew;
-}
-
-/** Add item to the beginning of doubly-linked circular list
- *
- * Add item to the beginning of doubly-linked circular list.
- *
- * @param link Pointer to link_t structure to be added.
- * @param list Pointer to list_t structure.
- *
- */
-_NO_TRACE static inline void list_prepend(link_t *link, list_t *list)
-{
-	list_insert_after(link, &list->head);
-}
-
-/** Add item to the end of doubly-linked circular list
- *
- * Add item to the end of doubly-linked circular list.
- *
- * @param link Pointer to link_t structure to be added.
- * @param list Pointer to list_t structure.
- *
- */
-_NO_TRACE static inline void list_append(link_t *link, list_t *list)
-{
-	list_insert_before(link, &list->head);
-}
-
-/** Remove item from doubly-linked circular list
- *
- * Remove item from doubly-linked circular list.
- *
- * @param link Pointer to link_t structure to be removed from the list
- *             it is contained in.
- *
- */
-_NO_TRACE static inline void list_remove(link_t *link)
-{
-	if ((link->prev != NULL) && (link->next != NULL)) {
-		link->next->prev = link->prev;
-		link->prev->next = link->next;
-	}
-
-	link_initialize(link);
-}
-
-/** Query emptiness of doubly-linked circular list
- *
- * Query emptiness of doubly-linked circular list.
- *
- * @param list Pointer to lins_t structure.
- *
- */
-_NO_TRACE static inline bool list_empty(const list_t *list)
-{
-	return (list->head.next == &list->head);
-}
-
-/** Get first item in list.
- *
- * @param list Pointer to list_t structure.
- *
- * @return Head item of the list.
- * @return NULL if the list is empty.
- *
- */
-static inline link_t *list_first(const list_t *list)
-{
-	return ((list->head.next == &list->head) ? NULL : list->head.next);
-}
-
-/** Get last item in list.
- *
- * @param list Pointer to list_t structure.
- *
- * @return Head item of the list.
- * @return NULL if the list is empty.
- *
- */
-static inline link_t *list_last(const list_t *list)
-{
-	return (list->head.prev == &list->head) ? NULL : list->head.prev;
-}
-
-/** Get next item in list.
- *
- * @param link Current item link
- * @param list List containing @a link
- *
- * @return Next item or NULL if @a link is the last item.
- */
-static inline link_t *list_next(const link_t *link, const list_t *list)
-{
-	return (link->next == &list->head) ? NULL : link->next;
-}
-
-/** Get previous item in list.
- *
- * @param link Current item link
- * @param list List containing @a link
- *
- * @return Previous item or NULL if @a link is the first item.
- */
-static inline link_t *list_prev(const link_t *link, const list_t *list)
-{
-	return (link->prev == &list->head) ? NULL : link->prev;
-}
-
-/** Split or concatenate headless doubly-linked circular list
- *
- * Split or concatenate headless doubly-linked circular list.
- *
- * Note that the algorithm works both directions:
- * concatenates splitted lists and splits concatenated lists.
- *
- * @param part1 Pointer to link_t structure leading the first
- *              (half of the headless) list.
- * @param part2 Pointer to link_t structure leading the second
- *              (half of the headless) list.
- *
- */
-_NO_TRACE static inline void headless_list_split_or_concat(link_t *part1, link_t *part2)
-{
-	if (part1 == NULL || part2 == NULL)
-		return;
-
-	part1->prev->next = part2;
-	part2->prev->next = part1;
-
-	link_t *hlp = part1->prev;
-
-	part1->prev = part2->prev;
-	part2->prev = hlp;
-}
-
-/** Split headless doubly-linked circular list
- *
- * Split headless doubly-linked circular list.
- *
- * @param part1 Pointer to link_t structure leading
- *              the first half of the headless list.
- * @param part2 Pointer to link_t structure leading
- *              the second half of the headless list.
- *
- */
-_NO_TRACE static inline void headless_list_split(link_t *part1, link_t *part2)
-{
-	headless_list_split_or_concat(part1, part2);
-}
-
-/** Concatenate two headless doubly-linked circular lists
- *
- * Concatenate two headless doubly-linked circular lists.
- *
- * @param part1 Pointer to link_t structure leading
- *              the first headless list.
- * @param part2 Pointer to link_t structure leading
- *              the second headless list.
- *
- */
-_NO_TRACE static inline void headless_list_concat(link_t *part1, link_t *part2)
-{
-	headless_list_split_or_concat(part1, part2);
-}
-
-/** Swap the contents of two lists.
- *
- * @param list1
- * @param list2
- */
-static inline void list_swap(list_t *list1, list_t *list2)
-{
-	link_t *first1 = list_first(list1);
-	link_t *first2 = list_first(list2);
-
-	/* Detach both lists from their heads. */
-	headless_list_split(&list1->head, first1);
-	headless_list_split(&list2->head, first2);
-
-	/* Attach both lists to their new heads. */
-	headless_list_concat(&list1->head, first2);
-	headless_list_concat(&list2->head, first1);
-}
-
-/** Concatenate two lists
- *
- * Concatenate lists @a list1 and @a list2, producing a single
- * list @a list1 containing items from both (in @a list1, @a list2
- * order) and empty list @a list2.
- *
- * @param list1		First list and concatenated output
- * @param list2 	Second list and empty output.
- *
- */
-_NO_TRACE static inline void list_concat(list_t *list1, list_t *list2)
-{
-	list_splice(list2, list1->head.prev);
-}
-
-/** Get n-th item in a list.
- *
- * @param list Pointer to link_t structure representing the list.
- * @param n    Item number (indexed from zero).
- *
- * @return n-th item of the list.
- * @return NULL if no n-th item found.
- *
- */
-static inline link_t *list_nth(const list_t *list, size_t n)
-{
-	size_t cnt = 0;
-
-	link_t *link = list_first(list);
-	while (link != NULL) {
-		if (cnt == n)
-			return link;
-
-		cnt++;
-		link = list_next(link, list);
-	}
-
-	return NULL;
-}
-
-/** Verify that argument type is a pointer to link_t (at compile time).
- *
- * This can be used to check argument type in a macro.
- */
-static inline const void *list_link_to_void(const link_t *link)
-{
-	return link;
-}
-
-/** Determine if link is used.
- *
- * @param link Link
- * @return @c true if link is used, @c false if not.
- */
-static inline bool link_used(link_t *link)
-{
-	if (link->prev == NULL && link->next == NULL)
-		return false;
-
-	assert(link->prev != NULL && link->next != NULL);
-	return true;
-}
-
-static inline void *list_pop_internal(list_t *list, ptrdiff_t offset)
-{
-	link_t *tmp = list_first(list);
-	if (tmp == NULL)
-		return NULL;
-
-	list_remove(tmp);
-	return (void *) (((uint8_t *) tmp) - offset);
-}
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: mmon/include/adt/odict.h
===================================================================
--- common/include/adt/odict.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_adt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ODICT_H_
-#define _LIBC_ODICT_H_
-
-#include <errno.h>
-#include <member.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <types/adt/odict.h>
-
-#define odict_get_instance(odlink, type, member) \
-	member_to_inst(odlink, type, member)
-
-extern void odict_initialize(odict_t *, odgetkey_t, odcmp_t);
-extern void odict_finalize(odict_t *);
-extern void odlink_initialize(odlink_t *);
-extern void odict_insert(odlink_t *, odict_t *, odlink_t *);
-extern void odict_remove(odlink_t *);
-extern void odict_key_update(odlink_t *, odict_t *);
-extern bool odlink_used(odlink_t *);
-extern bool odict_empty(odict_t *);
-extern unsigned long odict_count(odict_t *);
-extern odlink_t *odict_first(odict_t *);
-extern odlink_t *odict_last(odict_t *);
-extern odlink_t *odict_prev(odlink_t *, odict_t *);
-extern odlink_t *odict_next(odlink_t *, odict_t *);
-extern odlink_t *odict_find_eq(odict_t *, void *, odlink_t *);
-extern odlink_t *odict_find_eq_last(odict_t *, void *, odlink_t *);
-extern odlink_t *odict_find_geq(odict_t *, void *, odlink_t *);
-extern odlink_t *odict_find_gt(odict_t *, void *, odlink_t *);
-extern odlink_t *odict_find_leq(odict_t *, void *, odlink_t *);
-extern odlink_t *odict_find_lt(odict_t *, void *, odlink_t *);
-extern errno_t odict_validate(odict_t *);
-
-#endif
-
-/** @}
- */
Index: mmon/include/bsearch.h
===================================================================
--- common/include/bsearch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_BSEARCH_H_
-#define _LIBC_BSEARCH_H_
-
-#include <stddef.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-extern void *bsearch(const void *, const void *, size_t, size_t,
-    int (*)(const void *, const void *));
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: mmon/include/ctype.h
===================================================================
--- common/include/ctype.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_CTYPE_H_
-#define _LIBC_CTYPE_H_
-
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-int islower(int);
-int isupper(int);
-int isalpha(int);
-int isdigit(int);
-int isalnum(int);
-int isblank(int);
-int iscntrl(int);
-int isprint(int);
-int isgraph(int);
-int isspace(int);
-int ispunct(int);
-int isxdigit(int);
-int tolower(int);
-int toupper(int);
-__C_DECLS_END;
-
-#endif
Index: mmon/include/gsort.h
===================================================================
--- common/include/gsort.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_SORT_H_
-#define _LIBC_SORT_H_
-
-#include <stddef.h>
-#include <stdbool.h>
-
-typedef int (*sort_cmp_t)(void *, void *, void *);
-
-extern bool gsort(void *, size_t, size_t, sort_cmp_t, void *);
-
-#endif
-
-/** @}
- */
Index: mmon/include/mem.h
===================================================================
--- common/include/mem.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_MEM_H_
-#define _LIBC_MEM_H_
-
-#include <stddef.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-extern void *memset(void *, int, size_t)
-    __attribute__((nonnull(1)));
-extern void *memcpy(void *, const void *, size_t)
-    __attribute__((nonnull(1, 2)));
-extern void *memmove(void *, const void *, size_t)
-    __attribute__((nonnull(1, 2)));
-extern int memcmp(const void *, const void *, size_t)
-    __attribute__((nonnull(1, 2)));
-extern void *memchr(const void *, int, size_t)
-    __attribute__((nonnull(1)));
-
-__C_DECLS_END;
-
-#if !__STDC_HOSTED__
-#define memset(dst, val, cnt)  __builtin_memset((dst), (val), (cnt))
-#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
-#define memcmp(s1, s2, cnt)    __builtin_memcmp((s1), (s2), (cnt))
-#define memmove(dst, src, cnt)  __builtin_memmove((dst), (src), (cnt))
-#define memchr(s, c, cnt)  __builtin_memchr((s), (c), (cnt))
-#endif
-
-#endif
-
-/** @}
- */
Index: mmon/include/printf_core.h
===================================================================
--- common/include/printf_core.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRINTF_CORE_H_
-#define _LIBC_PRINTF_CORE_H_
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <uchar.h>
-
-/** Structure for specifying output methods for different printf clones. */
-typedef struct {
-	/*
-	 * String output function, returns EOK on success.
-	 * Only returns an error when an irrecoverable failure occurs and
-	 * the string cannot be fully output.
-	 */
-	errno_t (*write)(const char *, size_t, void *);
-
-	/* User data - output stream specification, state, locks, etc. */
-	void *data;
-} printf_spec_t;
-
-extern int printf_core(const char *, printf_spec_t *, va_list);
-
-#endif
-
-/** @}
- */
Index: mmon/include/qsort.h
===================================================================
--- common/include/qsort.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_QSORT_H_
-#define _LIBC_QSORT_H_
-
-#include <stddef.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-extern void qsort(void *, size_t, size_t, int (*)(const void *,
-    const void *));
-__C_DECLS_END;
-
-#ifdef _HELENOS_SOURCE
-__HELENOS_DECLS_BEGIN;
-extern void qsort_r(void *, size_t, size_t, int (*)(const void *,
-    const void *, void *), void *);
-__HELENOS_DECLS_END;
-#endif
-
-#endif
-
-/** @}
- */
Index: mmon/include/stdlib.h
===================================================================
--- common/include/stdlib.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STDLIB_H_
-#define _LIBC_STDLIB_H_
-
-#include <_bits/size_t.h>
-#include <_bits/wchar_t.h>
-#include <_bits/uchar.h>
-#include <_bits/decls.h>
-#include <bsearch.h>
-#include <qsort.h>
-
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-
-#define RAND_MAX  714025
-
-#define MB_CUR_MAX 4
-
-__C_DECLS_BEGIN;
-
-/** Type returned by the div function */
-typedef struct {
-	/** Quotient */
-	int quot;
-	/** Remainder */
-	int rem;
-} div_t;
-
-/** Type returned by the ldiv function */
-typedef struct {
-	/** Quotient */
-	long quot;
-	/** Remainder */
-	long rem;
-} ldiv_t;
-
-/** Type returned by the lldiv function */
-typedef struct {
-	/** Quotient */
-	long long quot;
-	/** Remainder */
-	long long rem;
-} lldiv_t;
-
-extern long double strtold(const char *, char **);
-
-extern int rand(void);
-extern void srand(unsigned int);
-
-extern void abort(void) __attribute__((noreturn));
-extern int atexit(void (*)(void));
-extern void exit(int) __attribute__((noreturn));
-extern void _Exit(int) __attribute__((noreturn));
-extern int at_quick_exit(void (*)(void));
-extern void quick_exit(int);
-
-extern char *getenv(const char *);
-extern int system(const char *);
-
-extern int abs(int);
-extern long labs(long);
-extern long long llabs(long long);
-
-extern int atoi(const char *);
-extern long atol(const char *);
-extern long long atoll(const char *);
-
-extern long strtol(const char *__restrict__, char **__restrict__, int);
-extern long long strtoll(const char *__restrict__, char **__restrict__, int);
-extern unsigned long strtoul(const char *__restrict__, char **__restrict__, int);
-extern unsigned long long strtoull(const char *__restrict__, char **__restrict__, int);
-
-extern div_t div(int, int);
-extern ldiv_t ldiv(long, long);
-extern lldiv_t lldiv(long long, long long);
-
-extern void *malloc(size_t size)
-    __attribute__((malloc));
-extern void *calloc(size_t nmemb, size_t size)
-    __attribute__((malloc));
-extern void *realloc(void *addr, size_t size)
-    __attribute__((warn_unused_result));
-extern void free(void *addr);
-
-#ifdef _HELENOS_SOURCE
-__HELENOS_DECLS_BEGIN;
-
-extern void *memalign(size_t align, size_t size)
-    __attribute__((malloc));
-
-extern void *reallocarray(void *ptr, size_t nelem, size_t elsize)
-    __attribute__((warn_unused_result));
-
-__HELENOS_DECLS_END;
-#endif
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: mmon/include/str.h
===================================================================
--- common/include/str.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STR_H_
-#define _LIBC_STR_H_
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <mem.h>
-#include <_bits/decls.h>
-#include <_bits/mbstate_t.h>
-#include <_bits/uchar.h>
-
-#ifndef __cplusplus
-
-/* Common Unicode characters */
-#define U_SPECIAL      '?'
-
-#define U_LEFT_ARROW   0x2190
-#define U_UP_ARROW     0x2191
-#define U_RIGHT_ARROW  0x2192
-#define U_DOWN_ARROW   0x2193
-
-#define U_PAGE_UP      0x21de
-#define U_PAGE_DOWN    0x21df
-
-#define U_HOME_ARROW   0x21f1
-#define U_END_ARROW    0x21f2
-
-#define U_NULL         0x2400
-#define U_ESCAPE       0x241b
-#define U_DELETE       0x2421
-
-#define U_CURSOR       0x2588
-
-/** No size limit constant */
-#define STR_NO_LIMIT  ((size_t) -1)
-
-/** Maximum size of a string containing @c length characters */
-#define STR_BOUNDS(length)  ((length) << 2)
-
-/**
- * Maximum size of a buffer needed to a string converted from space-padded
- * ASCII of size @a spa_size using spascii_to_str().
- */
-#define SPASCII_STR_BUFSIZE(spa_size) ((spa_size) + 1)
-
-#endif
-
-__HELENOS_DECLS_BEGIN;
-
-extern char32_t str_decode(const char *str, size_t *offset, size_t sz);
-extern char32_t str_decode_r(const char *str, size_t *offset, size_t sz,
-	char32_t replacement, mbstate_t *mbstate);
-extern char32_t str_decode_reverse(const char *str, size_t *offset, size_t sz);
-extern errno_t chr_encode(char32_t ch, char *str, size_t *offset, size_t sz);
-
-extern size_t str_size(const char *str);
-extern size_t wstr_size(const char32_t *str);
-
-extern size_t str_nsize(const char *str, size_t max_size);
-extern size_t wstr_nsize(const char32_t *str, size_t max_size);
-
-extern size_t str_lsize(const char *str, size_t max_len);
-extern size_t wstr_lsize(const char32_t *str, size_t max_len);
-
-extern size_t str_length(const char *str);
-extern size_t wstr_length(const char32_t *wstr);
-
-extern size_t str_nlength(const char *str, size_t size);
-extern size_t wstr_nlength(const char32_t *str, size_t size);
-
-extern size_t chr_width(char32_t ch);
-extern size_t str_width(const char *str);
-
-extern bool ascii_check(char32_t ch);
-extern bool chr_check(char32_t ch);
-
-extern int str_cmp(const char *s1, const char *s2);
-extern int str_lcmp(const char *s1, const char *s2, size_t max_len);
-extern int str_casecmp(const char *s1, const char *s2);
-extern int str_lcasecmp(const char *s1, const char *s2, size_t max_len);
-
-extern bool str_test_prefix(const char *s, const char *p);
-extern const char *str_suffix(const char *s, size_t prefix_length);
-
-extern void str_cpy(char *dest, size_t size, const char *src);
-extern void str_ncpy(char *dest, size_t size, const char *src, size_t n);
-extern void str_append(char *dest, size_t size, const char *src);
-
-extern errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
-extern void wstr_to_str(char *dest, size_t size, const char32_t *src);
-extern char *wstr_to_astr(const char32_t *src);
-extern void str_to_wstr(char32_t *dest, size_t dlen, const char *src);
-extern char32_t *str_to_awstr(const char *src);
-extern errno_t utf16_to_str(char *dest, size_t size, const uint16_t *src);
-extern errno_t str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
-extern size_t utf16_wsize(const uint16_t *ustr);
-
-extern char *str_chr(const char *str, char32_t ch);
-extern char *str_rchr(const char *str, char32_t ch);
-extern char *str_str(const char *hs, const char *n);
-
-extern void str_rtrim(char *str, char32_t ch);
-extern void str_ltrim(char *str, char32_t ch);
-
-extern bool wstr_linsert(char32_t *str, char32_t ch, size_t pos, size_t max_pos);
-extern bool wstr_remove(char32_t *str, size_t pos);
-
-extern char *str_dup(const char *src);
-extern char *str_ndup(const char *src, size_t n);
-
-extern char *str_tok(char *, const char *, char **);
-
-extern size_t str_sanitize(char *, size_t, uint8_t);
-
-extern errno_t str_uint8_t(const char *, const char **, unsigned int, bool,
-    uint8_t *);
-extern errno_t str_uint16_t(const char *, const char **, unsigned int, bool,
-    uint16_t *);
-extern errno_t str_uint32_t(const char *, const char **, unsigned int, bool,
-    uint32_t *);
-extern errno_t str_uint64_t(const char *, const char **, unsigned int, bool,
-    uint64_t *);
-extern errno_t str_size_t(const char *, const char **, unsigned int, bool,
-    size_t *);
-extern errno_t str_int64_t(const char *, const char **, unsigned int, bool,
-    int64_t *);
-
-extern void order_suffix(const uint64_t, uint64_t *, char *);
-extern void bin_order_suffix(const uint64_t, uint64_t *, const char **, bool);
-
-/*
- * TODO: Get rid of this.
- */
-
-extern long int strtol(const char *, char **, int);
-extern unsigned long strtoul(const char *, char **, int);
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: mmon/include/str_error.h
===================================================================
--- common/include/str_error.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STRERROR_H_
-#define _LIBC_STRERROR_H_
-
-#include <errno.h>
-
-const char *str_error(errno_t);
-const char *str_error_name(errno_t);
-
-#endif
-
-/** @}
- */
Index: mmon/include/types/adt/odict.h
===================================================================
--- common/include/types/adt/odict.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_adt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_ODICT_H_
-#define _LIBC_TYPES_ODICT_H_
-
-#include <adt/list.h>
-
-typedef struct odlink odlink_t;
-typedef struct odict odict_t;
-
-typedef void *(*odgetkey_t)(odlink_t *);
-typedef int (*odcmp_t)(void *, void *);
-
-typedef enum {
-	odc_black,
-	odc_red
-} odict_color_t;
-
-typedef enum {
-	/** Child A */
-	odcs_a,
-	/** Child B */
-	odcs_b
-} odict_child_sel_t;
-
-/** Ordered dictionary link */
-struct odlink {
-	/** Containing dictionary */
-	odict_t *odict;
-	/** Parent node */
-	odlink_t *up;
-	/** First child */
-	odlink_t *a;
-	/** Second child */
-	odlink_t *b;
-	/** Node color */
-	odict_color_t color;
-	/** Link to odict->entries */
-	link_t lentries;
-};
-
-/** Ordered dictionary */
-struct odict {
-	/** Root of the tree */
-	odlink_t *root;
-	/** List of entries in ascending order */
-	list_t entries;
-	/** Get key operation */
-	odgetkey_t getkey;
-	/** Compare operation */
-	odcmp_t cmp;
-};
-
-#endif
-
-/** @}
- */
Index: mmon/include/uchar.h
===================================================================
--- common/include/uchar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_UCHAR_H_
-#define _LIBC_UCHAR_H_
-
-#include <_bits/mbstate_t.h>
-#include <_bits/size_t.h>
-#include <_bits/uchar.h>
-#include <stdint.h>
-
-size_t mbrtoc8(char8_t *__restrict pc8, const char *__restrict s, size_t n,
-    mbstate_t *__restrict ps);
-size_t c8rtomb(char *__restrict s, char8_t c8, mbstate_t *__restrict ps);
-size_t mbrtoc16(char16_t *__restrict pc16, const char *__restrict s, size_t n,
-    mbstate_t *__restrict ps);
-size_t c16rtomb(char *__restrict s, char16_t c16, mbstate_t *__restrict ps);
-size_t mbrtoc32(char32_t *__restrict pc32, const char *__restrict s, size_t n,
-    mbstate_t *__restrict ps);
-size_t c32rtomb(char *__restrict s, char32_t c32, mbstate_t *__restrict ps);
-
-#ifdef _HELENOS_SOURCE
-#define UCHAR_ILSEQ      ((size_t) -1)
-#define UCHAR_INCOMPLETE ((size_t) -2)
-#define UCHAR_CONTINUED  ((size_t) -3)
-#endif
-
-#endif
-
-/** @}
- */
Index: mmon/include/wchar.h
===================================================================
--- common/include/wchar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_WCHAR_H_
-#define _LIBC_WCHAR_H_
-
-#include <_bits/NULL.h>
-#include <_bits/WEOF.h>
-#include <_bits/mbstate_t.h>
-#include <_bits/size_t.h>
-#include <_bits/wchar_limits.h>
-#include <_bits/wchar_t.h>
-#include <_bits/wint_t.h>
-#include <stdarg.h>
-
-/* Forward declarations for types. */
-typedef struct _IO_FILE FILE;
-struct tm;
-
-/*
- * Complete list of functions straight out of ISO/IEC 9899:2023 (N3096 draft).
- * Only some of these are implemented, but keep all standard prototypes here
- * for less pain in libposix etc.
- */
-
-int fputws(const wchar_t *__restrict__, FILE *__restrict__);
-int fwide(FILE *, int mode);
-int fwprintf(FILE *__restrict__, const wchar_t *__restrict__, ...);
-int fwscanf(FILE *__restrict__, const wchar_t *__restrict__, ...);
-int mbsinit(const mbstate_t *);
-int swprintf(wchar_t *__restrict__, size_t, const wchar_t *__restrict__, ...);
-int swscanf(const wchar_t *__restrict__, const wchar_t *__restrict__, ...);
-int vfwprintf(FILE *__restrict__, const wchar_t *__restrict__, va_list);
-int vfwscanf(FILE *__restrict__, const wchar_t *__restrict__, va_list);
-int vswprintf(wchar_t *__restrict__, size_t, const wchar_t *__restrict__, va_list);
-int vswscanf(const wchar_t *__restrict__, const wchar_t *__restrict__, va_list);
-int vwprintf(const wchar_t *__restrict__, va_list);
-int vwscanf(const wchar_t *__restrict__, va_list);
-int wcscmp(const wchar_t *, const wchar_t *);
-int wcscoll(const wchar_t *, const wchar_t *);
-int wcsncmp(const wchar_t *, const wchar_t *, size_t);
-int wctob(wint_t);
-int wmemcmp(const wchar_t *, const wchar_t *, size_t);
-int wprintf(const wchar_t *__restrict__, ...);
-int wscanf(const wchar_t *__restrict__, ...);
-long int wcstol(const wchar_t *__restrict__, wchar_t **__restrict__, int);
-long long int wcstoll(const wchar_t *__restrict__, wchar_t **__restrict__, int);
-size_t mbrlen(const char *__restrict__, size_t, mbstate_t *__restrict__);
-size_t mbrtowc(wchar_t *__restrict__ pwc, const char *__restrict__, size_t, mbstate_t *__restrict__);
-size_t mbsrtowcs(wchar_t *__restrict__ dst, const char **__restrict__ src, size_t, mbstate_t *__restrict__);
-size_t wcrtomb(char *__restrict__, wchar_t wc, mbstate_t *__restrict__);
-size_t wcscspn(const wchar_t *, const wchar_t *);
-size_t wcsftime(wchar_t *__restrict__, size_t maxsize, const wchar_t *__restrict__, const struct tm *__restrict__ timeptr);
-size_t wcslen(const wchar_t *);
-size_t wcsrtombs(char *__restrict__ dst, const wchar_t **__restrict__ src, size_t, mbstate_t *__restrict__);
-size_t wcsspn(const wchar_t *, const wchar_t *);
-size_t wcsxfrm(wchar_t *__restrict__, const wchar_t *__restrict__, size_t);
-unsigned long int wcstoul(const wchar_t *__restrict__, wchar_t **__restrict__, int);
-unsigned long long int wcstoull(const wchar_t *__restrict__, wchar_t **__restrict__, int);
-wchar_t *fgetws(wchar_t *__restrict__, int, FILE *__restrict__);
-wchar_t *wcscat(wchar_t *__restrict__, const wchar_t *__restrict__);
-wchar_t *wcscpy(wchar_t *__restrict__, const wchar_t *__restrict__);
-wchar_t *wcsncat(wchar_t *__restrict__, const wchar_t *__restrict__, size_t);
-wchar_t *wcsncpy(wchar_t *__restrict__, const wchar_t *__restrict__, size_t);
-wchar_t *wcstok(wchar_t *__restrict__, const wchar_t *__restrict__, wchar_t **__restrict__);
-wchar_t *wmemcpy(wchar_t *__restrict__, const wchar_t *__restrict__, size_t);
-wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
-wchar_t *wmemset(wchar_t *, wchar_t, size_t);
-wint_t btowc(int);
-wint_t fgetwc(FILE *);
-wint_t fputwc(wchar_t, FILE *);
-wint_t getwc(FILE *);
-wint_t getwchar(void);
-wint_t putwc(wchar_t, FILE *);
-wint_t putwchar(wchar_t);
-wint_t ungetwc(wint_t, FILE *);
-
-// TODO: In C23, these functions have generic macro definitions for correct
-//       const handling.
-wchar_t *wcschr(const wchar_t *, wchar_t);
-wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
-wchar_t *wcsrchr(const wchar_t *, wchar_t);
-wchar_t *wcsstr(const wchar_t *, const wchar_t *);
-wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
-
-#endif /* _LIBC_WCHAR_H_ */
Index: mmon/printf/printf_core.c
===================================================================
--- common/printf/printf_core.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1479 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Printing functions.
- */
-
-#include <_bits/uchar.h>
-#include <_bits/wint_t.h>
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <macros.h>
-#include <printf_core.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <str.h>
-
-/* Disable float support in kernel, because we usually disable floating operations there. */
-#if __STDC_HOSTED__
-#define HAS_FLOAT
-#endif
-
-#ifdef HAS_FLOAT
-#include <double_to_str.h>
-#include <ieee_double.h>
-#endif
-
-/** show prefixes 0x or 0 */
-#define __PRINTF_FLAG_PREFIX       0x00000001
-
-/** show the decimal point even if no fractional digits present */
-#define __PRINTF_FLAG_DECIMALPT    0x00000001
-
-/** signed / unsigned number */
-#define __PRINTF_FLAG_SIGNED       0x00000002
-
-/** print leading zeroes */
-#define __PRINTF_FLAG_ZEROPADDED   0x00000004
-
-/** align to left */
-#define __PRINTF_FLAG_LEFTALIGNED  0x00000010
-
-/** always show + sign */
-#define __PRINTF_FLAG_SHOWPLUS     0x00000020
-
-/** print space instead of plus */
-#define __PRINTF_FLAG_SPACESIGN    0x00000040
-
-/** show big characters */
-#define __PRINTF_FLAG_BIGCHARS     0x00000080
-
-/** number has - sign */
-#define __PRINTF_FLAG_NEGATIVE     0x00000100
-
-/** don't print trailing zeros in the fractional part */
-#define __PRINTF_FLAG_NOFRACZEROS  0x00000200
-
-/**
- * Buffer big enough for 64-bit number printed in base 2.
- */
-#define PRINT_NUMBER_BUFFER_SIZE  64
-
-/** Get signed or unsigned integer argument */
-#define PRINTF_GET_INT_ARGUMENT(type, ap, flags) \
-	({ \
-		unsigned type res; \
-		\
-		if ((flags) & __PRINTF_FLAG_SIGNED) { \
-			signed type arg = va_arg((ap), signed type); \
-			\
-			if (arg < 0) { \
-				res = -arg; \
-				(flags) |= __PRINTF_FLAG_NEGATIVE; \
-			} else \
-				res = arg; \
-		} else \
-			res = va_arg((ap), unsigned type); \
-		\
-		res; \
-	})
-
-/** Enumeration of possible arguments types.
- */
-typedef enum {
-	PrintfQualifierByte = 0,
-	PrintfQualifierShort,
-	PrintfQualifierInt,
-	PrintfQualifierLong,
-	PrintfQualifierLongLong,
-	PrintfQualifierPointer,
-} qualifier_t;
-
-static const char _digits_small[] = "0123456789abcdef";
-static const char _digits_big[] = "0123456789ABCDEF";
-
-static const char _nullstr[] = "(NULL)";
-static const char _replacement[] = u8"�";
-static const char _spaces[] = "                                               ";
-static const char _zeros[] = "000000000000000000000000000000000000000000000000";
-
-static void _set_errno(errno_t rc)
-{
-	#ifdef errno
-	errno = rc;
-	#endif
-}
-
-static size_t _utf8_bytes(char32_t c)
-{
-	if (c < 0x80)
-		return 1;
-
-	if (c < 0x800)
-		return 2;
-
-	if (c < 0xD800)
-		return 3;
-
-	/* Surrogate code points, invalid in UTF-32. */
-	if (c < 0xE000)
-		return sizeof(_replacement) - 1;
-
-	if (c < 0x10000)
-		return 3;
-
-	if (c < 0x110000)
-		return 4;
-
-	/* Invalid character. */
-	return sizeof(_replacement) - 1;
-}
-
-/** Counts characters and utf8 bytes in a wide string up to a byte limit.
- * @param max_bytes    Byte length limit for string's utf8 conversion.
- * @param[out] len     The number of wide characters
- * @return  Number of utf8 bytes that the first *len characters in the string
- *          will convert to. Will always be less than max_bytes.
- */
-static size_t _utf8_wstr_bytes_len(char32_t *s, size_t max_bytes, size_t *len)
-{
-	size_t bytes = 0;
-	size_t i;
-
-	for (i = 0; bytes < max_bytes && s[i]; i++) {
-		size_t next = _utf8_bytes(s[i]);
-		if (max_bytes - bytes < next)
-			break;
-
-		bytes += next;
-	}
-
-	*len = i;
-	return bytes;
-}
-
-#define TRY(expr) ({ errno_t rc = (expr); if (rc != EOK) return rc; })
-
-static inline void _saturating_add(size_t *a, size_t b)
-{
-	size_t s = *a + b;
-	/* Only works because size_t is unsigned. */
-	*a = (s < b) ? SIZE_MAX : s;
-}
-
-static errno_t _write_bytes(const char *buf, size_t n, printf_spec_t *ps,
-    size_t *written_bytes)
-{
-	errno_t rc = ps->write(buf, n, ps->data);
-	if (rc != EOK)
-		return rc;
-
-	_saturating_add(written_bytes, n);
-	return EOK;
-}
-
-/** Write one UTF-32 character. */
-static errno_t _write_uchar(char32_t ch, printf_spec_t *ps,
-    size_t *written_bytes)
-{
-	char utf8[4];
-	size_t offset = 0;
-
-	if (chr_encode(ch, utf8, &offset, sizeof(utf8)) == EOK)
-		return _write_bytes(utf8, offset, ps, written_bytes);
-
-	/* Invalid character. */
-	return _write_bytes(_replacement, sizeof(_replacement) - 1, ps, written_bytes);
-}
-
-/** Write n UTF-32 characters. */
-static errno_t _write_chars(const char32_t *buf, size_t n, printf_spec_t *ps,
-    size_t *written_bytes)
-{
-	for (size_t i = 0; i < n; i++)
-		TRY(_write_uchar(buf[i], ps, written_bytes));
-
-	return EOK;
-}
-
-static errno_t _write_char(char c, printf_spec_t *ps, size_t *written_bytes)
-{
-	return _write_bytes(&c, 1, ps, written_bytes);
-}
-
-static errno_t _write_spaces(size_t n, printf_spec_t *ps, size_t *written_bytes)
-{
-	size_t max_spaces = sizeof(_spaces) - 1;
-
-	while (n > max_spaces) {
-		TRY(_write_bytes(_spaces, max_spaces, ps, written_bytes));
-		n -= max_spaces;
-	}
-
-	return _write_bytes(_spaces, n, ps, written_bytes);
-}
-
-static errno_t _write_zeros(size_t n, printf_spec_t *ps, size_t *written_bytes)
-{
-	size_t max_zeros = sizeof(_zeros) - 1;
-
-	while (n > max_zeros) {
-		TRY(_write_bytes(_zeros, max_zeros, ps, written_bytes));
-		n -= max_zeros;
-	}
-
-	return _write_bytes(_zeros, n, ps, written_bytes);
-}
-
-/** Print one formatted ASCII character.
- *
- * @param ch    Character to print.
- * @param width Width modifier.
- * @param flags Flags that change the way the character is printed.
- */
-static errno_t _format_char(const char c, size_t width, uint32_t flags,
-    printf_spec_t *ps, size_t *written_bytes)
-{
-	size_t bytes = 1;
-
-	if (width <= bytes)
-		return _write_char(c, ps, written_bytes);
-
-	if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-		TRY(_write_char(c, ps, written_bytes));
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-	} else {
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-		TRY(_write_char(c, ps, written_bytes));
-	}
-
-	return EOK;
-}
-
-/** Print one formatted wide character.
- *
- * @param ch    Character to print.
- * @param width Width modifier.
- * @param flags Flags that change the way the character is printed.
- */
-static errno_t _format_uchar(const char32_t ch, size_t width, uint32_t flags,
-    printf_spec_t *ps, size_t *written_bytes)
-{
-	/*
-	 * All widths in printf() are specified in bytes. It might seem nonsensical
-	 * with unicode text, but that's the way the function is defined. The width
-     * is barely useful if you want column alignment in terminal, but keep in
-     * mind that counting code points is only marginally better for that.
-     * Characters can span more than one unicode code point, even in languages
-     * based on latin alphabet, and a single unicode code point can occupy two
-     * spaces in east asian scripts.
-     *
-     * What the width can actually be useful for is padding, when you need the
-     * output to fill an exact number of bytes in a file. That use would break
-     * if we did our own thing here.
-     */
-
-    size_t bytes = _utf8_bytes(ch);
-
-	if (width <= bytes)
-		return _write_uchar(ch, ps, written_bytes);
-
-	if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-		TRY(_write_uchar(ch, ps, written_bytes));
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-	} else {
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-		TRY(_write_uchar(ch, ps, written_bytes));
-	}
-
-	return EOK;
-}
-
-/** Print string.
- *
- * @param str       String to be printed.
- * @param width     Width modifier.
- * @param precision Precision modifier.
- * @param flags     Flags that modify the way the string is printed.
- */
-static errno_t _format_cstr(const char *str, size_t width, int precision,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	if (str == NULL)
-		str = _nullstr;
-
-	/* Negative precision == unspecified. */
-	size_t max_bytes = (precision < 0) ? SIZE_MAX : (size_t) precision;
-	size_t bytes = str_nsize(str, max_bytes);
-
-	if (width <= bytes)
-		return _write_bytes(str, bytes, ps, written_bytes);
-
-	if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-		TRY(_write_bytes(str, bytes, ps, written_bytes));
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-	} else {
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-		TRY(_write_bytes(str, bytes, ps, written_bytes));
-	}
-
-	return EOK;
-}
-
-/** Print wide string.
- *
- * @param str       Wide string to be printed.
- * @param width     Width modifier.
- * @param precision Precision modifier.
- * @param flags     Flags that modify the way the string is printed.
- */
-static errno_t _format_wstr(char32_t *str, size_t width, int precision,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	if (!str)
-		return _format_cstr(_nullstr, width, precision, flags, ps, written_bytes);
-
-	/* Width and precision are always byte-based. See _format_uchar() */
-	/* Negative precision == unspecified. */
-	size_t max_bytes = (precision < 0) ? SIZE_MAX : (size_t) precision;
-
-	size_t len;
-	size_t bytes = _utf8_wstr_bytes_len(str, max_bytes, &len);
-
-	if (width <= bytes)
-		return _write_chars(str, len, ps, written_bytes);
-
-	if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-		TRY(_write_chars(str, len, ps, written_bytes));
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-	} else {
-		TRY(_write_spaces(width - bytes, ps, written_bytes));
-		TRY(_write_chars(str, len, ps, written_bytes));
-	}
-
-	return EOK;
-}
-
-static char _sign(uint32_t flags)
-{
-	if (!(flags & __PRINTF_FLAG_SIGNED))
-		return 0;
-
-	if (flags & __PRINTF_FLAG_NEGATIVE)
-		return '-';
-
-	if (flags & __PRINTF_FLAG_SHOWPLUS)
-		return '+';
-
-	if (flags & __PRINTF_FLAG_SPACESIGN)
-		return ' ';
-
-	return 0;
-}
-
-/** Print a number in a given base.
- *
- * Print significant digits of a number in given base.
- *
- * @param num       Number to print.
- * @param width     Width modifier.
- * @param precision Precision modifier.
- * @param base      Base to print the number in (must be between 2 and 16).
- * @param flags     Flags that modify the way the number is printed.
- */
-static errno_t _format_number(uint64_t num, size_t width, int precision, int base,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	assert(base >= 2 && base <= 16);
-
-	/* Default precision for numeric output is 1. */
-	size_t min_digits = (precision < 0) ? 1 : precision;
-
-	bool bigchars = flags & __PRINTF_FLAG_BIGCHARS;
-	bool prefix = flags & __PRINTF_FLAG_PREFIX;
-	bool left_aligned = flags & __PRINTF_FLAG_LEFTALIGNED;
-	bool zero_padded = flags & __PRINTF_FLAG_ZEROPADDED;
-
-	const char *digits = bigchars ? _digits_big : _digits_small;
-
-	char buffer[PRINT_NUMBER_BUFFER_SIZE];
-	char *end = &buffer[PRINT_NUMBER_BUFFER_SIZE];
-
-	/* Write number to the buffer. */
-	int offset = 0;
-	while (num > 0) {
-		end[--offset] = digits[num % base];
-		num /= base;
-	}
-
-	char *number = &end[offset];
-	size_t number_len = end - number;
-	char sign = _sign(flags);
-
-	if (left_aligned) {
-		/* Space padded right-aligned. */
-		size_t real_size = max(number_len, min_digits);
-
-		if (sign) {
-			TRY(_write_char(sign, ps, written_bytes));
-			real_size++;
-		}
-
-		if (prefix && base == 2 && number_len > 0) {
-			TRY(_write_bytes(bigchars ? "0B" : "0b", 2, ps, written_bytes));
-			real_size += 2;
-		}
-
-		if (prefix && base == 16 && number_len > 0) {
-			TRY(_write_bytes(bigchars ? "0X" : "0x", 2, ps, written_bytes));
-			real_size += 2;
-		}
-
-		if (min_digits > number_len) {
-			TRY(_write_zeros(min_digits - number_len, ps, written_bytes));
-		} else if (prefix && base == 8) {
-			TRY(_write_zeros(1, ps, written_bytes));
-			real_size++;
-		}
-
-		TRY(_write_bytes(number, number_len, ps, written_bytes));
-
-		if (width > real_size)
-			TRY(_write_spaces(width - real_size, ps, written_bytes));
-
-		return EOK;
-	}
-
-	/* Zero padded number (ignored when left aligned or if precision is specified). */
-	if (precision < 0 && zero_padded) {
-		size_t real_size = number_len;
-
-		if (sign) {
-			TRY(_write_char(sign, ps, written_bytes));
-			real_size++;
-		}
-
-		if (prefix && base == 2 && number_len > 0) {
-			TRY(_write_bytes(bigchars ? "0B" : "0b", 2, ps, written_bytes));
-			real_size += 2;
-		}
-
-		if (prefix && base == 16 && number_len > 0) {
-			TRY(_write_bytes(bigchars ? "0X" : "0x", 2, ps, written_bytes));
-			real_size += 2;
-		}
-
-		if (width > real_size)
-			TRY(_write_zeros(width - real_size, ps, written_bytes));
-		else if (number_len == 0 || (prefix && base == 8))
-			TRY(_write_char('0', ps, written_bytes));
-
-		return _write_bytes(number, number_len, ps, written_bytes);
-	}
-
-	/* Space padded right-aligned. */
-	size_t real_size = max(number_len, min_digits);
-	if (sign)
-		real_size++;
-
-	if (prefix && (base == 2 || base == 16) && number_len > 0)
-		real_size += 2;
-
-	if (prefix && base == 8 && number_len >= min_digits)
-		real_size += 1;
-
-	if (width > real_size)
-		TRY(_write_spaces(width - real_size, ps, written_bytes));
-
-	if (sign)
-		TRY(_write_char(sign, ps, written_bytes));
-
-	if (prefix && base == 2 && number_len > 0)
-		TRY(_write_bytes(bigchars ? "0B" : "0b", 2, ps, written_bytes));
-
-	if (prefix && base == 16 && number_len > 0)
-		TRY(_write_bytes(bigchars ? "0X" : "0x", 2, ps, written_bytes));
-
-	if (min_digits > number_len)
-		TRY(_write_zeros(min_digits - number_len, ps, written_bytes));
-	else if (prefix && base == 8)
-		TRY(_write_char('0', ps, written_bytes));
-
-	return _write_bytes(number, number_len, ps, written_bytes);
-}
-
-#ifdef HAS_FLOAT
-
-/** Unformatted double number string representation. */
-typedef struct {
-	/** Buffer with len digits, no sign or leading zeros. */
-	char *str;
-	/** Number of digits in str. */
-	int len;
-	/** Decimal exponent, ie number = str * 10^dec_exp */
-	int dec_exp;
-	/** True if negative. */
-	bool neg;
-} double_str_t;
-
-/** Returns the sign character or 0 if no sign should be printed. */
-static char _get_sign_char(bool negative, uint32_t flags)
-{
-	if (negative) {
-		return '-';
-	} else if (flags & __PRINTF_FLAG_SHOWPLUS) {
-		return '+';
-	} else if (flags & __PRINTF_FLAG_SPACESIGN) {
-		return ' ';
-	} else {
-		return 0;
-	}
-}
-
-/** Prints a special double (ie NaN, infinity) padded to width characters. */
-static errno_t _format_special(ieee_double_t val, int width, uint32_t flags,
-    printf_spec_t *ps, size_t *written_bytes)
-{
-	assert(val.is_special);
-
-	char sign = _get_sign_char(val.is_negative, flags);
-
-	const int str_len = 3;
-	const char *str;
-
-	if (flags & __PRINTF_FLAG_BIGCHARS) {
-		str = val.is_infinity ? "INF" : "NAN";
-	} else {
-		str = val.is_infinity ? "inf" : "nan";
-	}
-
-	int padding_len = max(0, width - ((sign ? 1 : 0) + str_len));
-
-	/* Leading padding. */
-	if (!(flags & __PRINTF_FLAG_LEFTALIGNED))
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	if (sign)
-		TRY(_write_char(sign, ps, written_bytes));
-
-	TRY(_write_bytes(str, str_len, ps, written_bytes));
-
-	/* Trailing padding. */
-	if (flags & __PRINTF_FLAG_LEFTALIGNED)
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	return EOK;
-}
-
-/** Trims trailing zeros but leaves a single "0" intact. */
-static void _fp_trim_trailing_zeros(char *buf, int *len, int *dec_exp)
-{
-	/* Cut the zero off by adjusting the exponent. */
-	while (2 <= *len && '0' == buf[*len - 1]) {
-		--*len;
-		++*dec_exp;
-	}
-}
-
-/** Textually round up the last digit thereby eliminating it. */
-static void _fp_round_up(char *buf, int *len, int *dec_exp)
-{
-	assert(1 <= *len);
-
-	char *last_digit = &buf[*len - 1];
-
-	int carry = ('5' <= *last_digit);
-
-	/* Cut the digit off by adjusting the exponent. */
-	--*len;
-	++*dec_exp;
-	--last_digit;
-
-	if (carry) {
-		/* Skip all the digits to cut off/round to zero. */
-		while (buf <= last_digit && '9' == *last_digit) {
-			--last_digit;
-		}
-
-		/* last_digit points to the last digit to round but not '9' */
-		if (buf <= last_digit) {
-			*last_digit += 1;
-			int new_len = last_digit - buf + 1;
-			*dec_exp += *len - new_len;
-			*len = new_len;
-		} else {
-			/* All len digits rounded to 0. */
-			buf[0] = '1';
-			*dec_exp += *len;
-			*len = 1;
-		}
-	} else {
-		/* The only digit was rounded to 0. */
-		if (last_digit < buf) {
-			buf[0] = '0';
-			*dec_exp = 0;
-			*len = 1;
-		}
-	}
-}
-
-/** Format and print the double string repressentation according
- *  to the %f specifier.
- */
-static errno_t _format_double_str_fixed(double_str_t *val_str, int precision, int width,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	int len = val_str->len;
-	char *buf = val_str->str;
-	int dec_exp = val_str->dec_exp;
-
-	assert(0 < len);
-	assert(0 <= precision);
-	assert(0 <= dec_exp || -dec_exp <= precision);
-
-	/* Number of integral digits to print (at least leading zero). */
-	int int_len = max(1, len + dec_exp);
-
-	char sign = _get_sign_char(val_str->neg, flags);
-
-	/* Fractional portion lengths. */
-	int last_frac_signif_pos = max(0, -dec_exp);
-	int leading_frac_zeros = max(0, last_frac_signif_pos - len);
-	int signif_frac_figs = min(last_frac_signif_pos, len);
-	int trailing_frac_zeros = precision - last_frac_signif_pos;
-	char *buf_frac = buf + len - signif_frac_figs;
-
-	if (flags & __PRINTF_FLAG_NOFRACZEROS)
-		trailing_frac_zeros = 0;
-
-	int frac_len = leading_frac_zeros + signif_frac_figs + trailing_frac_zeros;
-
-	bool has_decimal_pt = (0 < frac_len) || (flags & __PRINTF_FLAG_DECIMALPT);
-
-	/* Number of non-padding chars to print. */
-	int num_len = (sign ? 1 : 0) + int_len + (has_decimal_pt ? 1 : 0) + frac_len;
-
-	int padding_len = max(0, width - num_len);
-
-	/* Leading padding and sign. */
-
-	if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED)))
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	if (sign)
-		TRY(_write_char(sign, ps, written_bytes));
-
-	if (flags & __PRINTF_FLAG_ZEROPADDED)
-		TRY(_write_zeros(padding_len, ps, written_bytes));
-
-	/* Print the intergral part of the buffer. */
-
-	int buf_int_len = min(len, len + dec_exp);
-
-	if (0 < buf_int_len) {
-		TRY(_write_bytes(buf, buf_int_len, ps, written_bytes));
-
-		/* Print trailing zeros of the integral part of the number. */
-		TRY(_write_zeros(int_len - buf_int_len, ps, written_bytes));
-	} else {
-		/* Single leading integer 0. */
-		TRY(_write_char('0', ps, written_bytes));
-	}
-
-	/* Print the decimal point and the fractional part. */
-	if (has_decimal_pt) {
-		TRY(_write_char('.', ps, written_bytes));
-
-		/* Print leading zeros of the fractional part of the number. */
-		TRY(_write_zeros(leading_frac_zeros, ps, written_bytes));
-
-		/* Print significant digits of the fractional part of the number. */
-		if (0 < signif_frac_figs)
-			TRY(_write_bytes(buf_frac, signif_frac_figs, ps, written_bytes));
-
-		/* Print trailing zeros of the fractional part of the number. */
-		TRY(_write_zeros(trailing_frac_zeros, ps, written_bytes));
-	}
-
-	/* Trailing padding. */
-	if (flags & __PRINTF_FLAG_LEFTALIGNED)
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	return EOK;
-}
-
-/** Convert, format and print a double according to the %f specifier.
- *
- * @param g     Double to print.
- * @param precision Number of fractional digits to print. If 0 no
- *              decimal point will be printed unless the flag
- *              __PRINTF_FLAG_DECIMALPT is specified.
- * @param width Minimum number of characters to display. Pads
- *              with '0' or ' ' depending on the set flags;
- * @param flags Printf flags.
- * @param ps    Printing functions.
- */
-static errno_t _format_double_fixed(double g, int precision, int width,
-	uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-		flags &= ~__PRINTF_FLAG_ZEROPADDED;
-	}
-
-	if (flags & __PRINTF_FLAG_DECIMALPT) {
-		flags &= ~__PRINTF_FLAG_NOFRACZEROS;
-	}
-
-	ieee_double_t val = extract_ieee_double(g);
-
-	if (val.is_special) {
-		return _format_special(val, width, flags, ps, written_bytes);
-	}
-
-	char buf[MAX_DOUBLE_STR_BUF_SIZE];
-	const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE;
-	double_str_t val_str;
-
-	val_str.str = buf;
-	val_str.neg = val.is_negative;
-
-	if (0 <= precision) {
-		/*
-		 * Request one more digit so we can round the result. The last
-		 * digit it returns may have an error of at most +/- 1.
-		 */
-		val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size,
-		    &val_str.dec_exp);
-
-		/*
-		 * Round using the last digit to produce precision fractional digits.
-		 * If less than precision+1 fractional digits were output the last
-		 * digit is definitely inaccurate so also round to get rid of it.
-		 */
-		_fp_round_up(buf, &val_str.len, &val_str.dec_exp);
-
-		/* Rounding could have introduced trailing zeros. */
-		if (flags & __PRINTF_FLAG_NOFRACZEROS) {
-			_fp_trim_trailing_zeros(buf, &val_str.len, &val_str.dec_exp);
-		}
-	} else {
-		/* Let the implementation figure out the proper precision. */
-		val_str.len = double_to_short_str(val, buf, buf_size, &val_str.dec_exp);
-
-		/* Precision needed for the last significant digit. */
-		precision = max(0, -val_str.dec_exp);
-	}
-
-	return _format_double_str_fixed(&val_str, precision, width, flags, ps, written_bytes);
-}
-
-/** Prints the decimal exponent part of a %e specifier formatted number. */
-static errno_t _format_exponent(int exp_val, uint32_t flags, printf_spec_t *ps,
-    size_t *written_bytes)
-{
-	char exp_ch = (flags & __PRINTF_FLAG_BIGCHARS) ? 'E' : 'e';
-	TRY(_write_char(exp_ch, ps, written_bytes));
-
-	char exp_sign = (exp_val < 0) ? '-' : '+';
-	TRY(_write_char(exp_sign, ps, written_bytes));
-
-	/* Print the exponent. */
-	exp_val = abs(exp_val);
-
-	char exp_str[4] = { 0 };
-
-	exp_str[0] = '0' + exp_val / 100;
-	exp_str[1] = '0' + (exp_val % 100) / 10;
-	exp_str[2] = '0' + (exp_val % 10);
-
-	int exp_len = (exp_str[0] == '0') ? 2 : 3;
-	const char *exp_str_start = &exp_str[3] - exp_len;
-
-	return _write_bytes(exp_str_start, exp_len, ps, written_bytes);
-}
-
-/** Format and print the double string repressentation according
- *  to the %e specifier.
- */
-static errno_t _format_double_str_scient(double_str_t *val_str, int precision,
-    int width, uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	int len = val_str->len;
-	int dec_exp = val_str->dec_exp;
-	char *buf  = val_str->str;
-
-	assert(0 < len);
-
-	char sign = _get_sign_char(val_str->neg, flags);
-	bool has_decimal_pt = (0 < precision) || (flags & __PRINTF_FLAG_DECIMALPT);
-	int dec_pt_len = has_decimal_pt ? 1 : 0;
-
-	/* Fractional part lengths. */
-	int signif_frac_figs = len - 1;
-	int trailing_frac_zeros = precision - signif_frac_figs;
-
-	if (flags & __PRINTF_FLAG_NOFRACZEROS) {
-		trailing_frac_zeros = 0;
-	}
-
-	int frac_len = signif_frac_figs + trailing_frac_zeros;
-
-	int exp_val = dec_exp + len - 1;
-	/* Account for exponent sign and 'e'; minimum 2 digits. */
-	int exp_len = 2 + (abs(exp_val) >= 100 ? 3 : 2);
-
-	/* Number of non-padding chars to print. */
-	int num_len = (sign ? 1 : 0) + 1 + dec_pt_len + frac_len + exp_len;
-
-	int padding_len = max(0, width - num_len);
-
-	if (!(flags & (__PRINTF_FLAG_LEFTALIGNED | __PRINTF_FLAG_ZEROPADDED)))
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	if (sign)
-		TRY(_write_char(sign, ps, written_bytes));
-
-	if (flags & __PRINTF_FLAG_ZEROPADDED)
-		TRY(_write_zeros(padding_len, ps, written_bytes));
-
-	/* Single leading integer. */
-	TRY(_write_char(buf[0], ps, written_bytes));
-
-	/* Print the decimal point and the fractional part. */
-	if (has_decimal_pt) {
-		TRY(_write_char('.', ps, written_bytes));
-
-		/* Print significant digits of the fractional part of the number. */
-		if (0 < signif_frac_figs)
-			TRY(_write_bytes(buf + 1, signif_frac_figs, ps, written_bytes));
-
-		/* Print trailing zeros of the fractional part of the number. */
-		TRY(_write_zeros(trailing_frac_zeros, ps, written_bytes));
-	}
-
-	/* Print the exponent. */
-	TRY(_format_exponent(exp_val, flags, ps, written_bytes));
-
-	if (flags & __PRINTF_FLAG_LEFTALIGNED)
-		TRY(_write_spaces(padding_len, ps, written_bytes));
-
-	return EOK;
-}
-
-/** Convert, format and print a double according to the %e specifier.
- *
- * Note that if g is large, the output may be huge (3e100 prints
- * with at least 100 digits).
- *
- * %e style: [-]d.dddde+dd
- *  left-justified:  [-]d.dddde+dd[space_pad]
- *  right-justified: [space_pad][-][zero_pad]d.dddde+dd
- *
- * @param g     Double to print.
- * @param precision Number of fractional digits to print, ie
- *              precision + 1 significant digits to display. If 0 no
- *              decimal point will be printed unless the flag
- *              __PRINTF_FLAG_DECIMALPT is specified. If negative
- *              the shortest accurate number will be printed.
- * @param width Minimum number of characters to display. Pads
- *              with '0' or ' ' depending on the set flags;
- * @param flags Printf flags.
- * @param ps    Printing functions.
- */
-static errno_t _format_double_scientific(double g, int precision, int width,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	if (flags & __PRINTF_FLAG_LEFTALIGNED)
-		flags &= ~__PRINTF_FLAG_ZEROPADDED;
-
-	ieee_double_t val = extract_ieee_double(g);
-
-	if (val.is_special)
-		return _format_special(val, width, flags, ps, written_bytes);
-
-	char buf[MAX_DOUBLE_STR_BUF_SIZE];
-	const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE;
-	double_str_t val_str;
-
-	val_str.str = buf;
-	val_str.neg = val.is_negative;
-
-	if (0 <= precision) {
-		/*
-		 * Request one more digit (in addition to the leading integer)
-		 * so we can round the result. The last digit it returns may
-		 * have an error of at most +/- 1.
-		 */
-		val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size,
-		    &val_str.dec_exp);
-
-		/*
-		 * Round the extra digit to produce precision+1 significant digits.
-		 * If less than precision+2 significant digits were returned the last
-		 * digit is definitely inaccurate so also round to get rid of it.
-		 */
-		_fp_round_up(buf, &val_str.len, &val_str.dec_exp);
-
-		/* Rounding could have introduced trailing zeros. */
-		if (flags & __PRINTF_FLAG_NOFRACZEROS) {
-			_fp_trim_trailing_zeros(buf, &val_str.len, &val_str.dec_exp);
-		}
-	} else {
-		/* Let the implementation figure out the proper precision. */
-		val_str.len = double_to_short_str(val, buf, buf_size, &val_str.dec_exp);
-
-		/* Use all produced digits. */
-		precision = val_str.len - 1;
-	}
-
-	return _format_double_str_scient(&val_str, precision, width, flags, ps, written_bytes);
-}
-
-/** Convert, format and print a double according to the %g specifier.
- *
- * %g style chooses between %f and %e.
- *
- * @param g     Double to print.
- * @param precision Number of significant digits to display; excluding
- *              any leading zeros from this count. If negative
- *              the shortest accurate number will be printed.
- * @param width Minimum number of characters to display. Pads
- *              with '0' or ' ' depending on the set flags;
- * @param flags Printf flags.
- * @param ps    Printing functions.
- *
- * @return The number of characters printed; negative on failure.
- */
-static errno_t _format_double_generic(double g, int precision, int width,
-    uint32_t flags, printf_spec_t *ps, size_t *written_bytes)
-{
-	ieee_double_t val = extract_ieee_double(g);
-
-	if (val.is_special)
-		return _format_special(val, width, flags, ps, written_bytes);
-
-	char buf[MAX_DOUBLE_STR_BUF_SIZE];
-	const size_t buf_size = MAX_DOUBLE_STR_BUF_SIZE;
-	int dec_exp;
-	int len;
-
-	/* Honor the user requested number of significant digits. */
-	if (0 <= precision) {
-		/*
-		 * Do a quick and dirty conversion of a single digit to determine
-		 * the decimal exponent.
-		 */
-		len = double_to_fixed_str(val, 1, -1, buf, buf_size, &dec_exp);
-		assert(0 < len);
-
-		precision = max(1, precision);
-
-		if (-4 <= dec_exp && dec_exp < precision) {
-			precision = precision - (dec_exp + 1);
-			return _format_double_fixed(g, precision, width,
-			    flags | __PRINTF_FLAG_NOFRACZEROS, ps, written_bytes);
-		} else {
-			--precision;
-			return _format_double_scientific(g, precision, width,
-			    flags | __PRINTF_FLAG_NOFRACZEROS, ps, written_bytes);
-		}
-	} else {
-		/* Convert to get the decimal exponent and digit count. */
-		len = double_to_short_str(val, buf, buf_size, &dec_exp);
-		assert(0 < len);
-
-		if (flags & __PRINTF_FLAG_LEFTALIGNED) {
-			flags &= ~__PRINTF_FLAG_ZEROPADDED;
-		}
-
-		double_str_t val_str;
-		val_str.str = buf;
-		val_str.len = len;
-		val_str.neg = val.is_negative;
-		val_str.dec_exp = dec_exp;
-
-		int first_digit_pos = len + dec_exp;
-		int last_digit_pos = dec_exp;
-
-		/* The whole number (15 digits max) fits between dec places 15 .. -6 */
-		if (len <= 15 && -6 <= last_digit_pos && first_digit_pos <= 15) {
-			/* Precision needed for the last significant digit. */
-			precision = max(0, -val_str.dec_exp);
-			return _format_double_str_fixed(&val_str, precision, width, flags, ps, written_bytes);
-		} else {
-			/* Use all produced digits. */
-			precision = val_str.len - 1;
-			return _format_double_str_scient(&val_str, precision, width, flags, ps, written_bytes);
-		}
-	}
-}
-
-/** Convert, format and print a double according to the specifier.
- *
- * Depending on the specifier it prints the double using the styles
- * %g, %f or %e by means of print_double_generic(), print_double_fixed(),
- * print_double_scientific().
- *
- * @param g     Double to print.
- * @param spec  Specifier of the style to print in; one of: 'g','G','f','F',
- *              'e','E'.
- * @param precision Number of fractional digits to display. If negative
- *              the shortest accurate number will be printed for style %g;
- *              negative precision defaults to 6 for styles %f, %e.
- * @param width Minimum number of characters to display. Pads
- *              with '0' or ' ' depending on the set flags;
- * @param flags Printf flags.
- * @param ps    Printing functions.
- */
-static errno_t _format_double(double g, char spec, int precision, int width,
-    uint32_t flags, printf_spec_t *ps, size_t *written_chars)
-{
-	switch (spec) {
-	case 'F':
-		flags |= __PRINTF_FLAG_BIGCHARS;
-		/* Fallthrough */
-	case 'f':
-		precision = (precision < 0) ? 6 : precision;
-		return _format_double_fixed(g, precision, width, flags, ps, written_chars);
-
-	case 'E':
-		flags |= __PRINTF_FLAG_BIGCHARS;
-		/* Fallthrough */
-	case 'e':
-		precision = (precision < 0) ? 6 : precision;
-		return _format_double_scientific(g, precision, width, flags, ps, written_chars);
-
-	case 'G':
-		flags |= __PRINTF_FLAG_BIGCHARS;
-		/* Fallthrough */
-	case 'g':
-		return _format_double_generic(g, precision, width, flags, ps, written_chars);
-
-	default:
-		assert(false);
-		return -1;
-	}
-}
-
-#endif
-
-static const char *_strchrnul(const char *s, int c)
-{
-	while (*s != c && *s != 0)
-		s++;
-	return s;
-}
-
-/** Read a sequence of digits from the format string as a number.
- * If the number has too many digits to fit in int, returns INT_MAX.
- */
-static int _read_num(const char *fmt, size_t *i)
-{
-	const char *s;
-	unsigned n = 0;
-
-	for (s = &fmt[*i]; isdigit(*s); s++) {
-		unsigned digit = (*s - '0');
-
-		/* Check for overflow */
-		if (n > INT_MAX / 10 || n * 10 > INT_MAX - digit) {
-			n = INT_MAX;
-			while (isdigit(*s))
-				s++;
-			break;
-		}
-
-		n = n * 10 + digit;
-	}
-
-	*i = s - fmt;
-	return n;
-}
-
-static uint32_t _parse_flags(const char *fmt, size_t *i)
-{
-	uint32_t flags = 0;
-
-	while (true) {
-		switch (fmt[(*i)++]) {
-		case '#':
-			flags |= __PRINTF_FLAG_PREFIX;
-			flags |= __PRINTF_FLAG_DECIMALPT;
-			continue;
-		case '-':
-			flags |= __PRINTF_FLAG_LEFTALIGNED;
-			continue;
-		case '+':
-			flags |= __PRINTF_FLAG_SHOWPLUS;
-			continue;
-		case ' ':
-			flags |= __PRINTF_FLAG_SPACESIGN;
-			continue;
-		case '0':
-			flags |= __PRINTF_FLAG_ZEROPADDED;
-			continue;
-		}
-
-		--*i;
-		break;
-	}
-
-	return flags;
-}
-
-static bool _eat_char(const char *s, size_t *idx, int c)
-{
-	if (s[*idx] != c)
-		return false;
-
-	(*idx)++;
-	return true;
-}
-
-static qualifier_t _read_qualifier(const char *s, size_t *idx)
-{
-	switch (s[(*idx)++]) {
-	case 't': /* ptrdiff_t */
-	case 'z': /* size_t */
-		if (sizeof(ptrdiff_t) == sizeof(int))
-			return PrintfQualifierInt;
-		else
-			return PrintfQualifierLong;
-
-	case 'h':
-		if (_eat_char(s, idx, 'h'))
-			return PrintfQualifierByte;
-		else
-			return PrintfQualifierShort;
-
-	case 'l':
-		if (_eat_char(s, idx, 'l'))
-			return PrintfQualifierLongLong;
-		else
-			return PrintfQualifierLong;
-
-	case 'j':
-		return PrintfQualifierLongLong;
-
-	default:
-		--*idx;
-
-		/* Unspecified */
-		return PrintfQualifierInt;
-	}
-}
-
-/** Print formatted string.
- *
- * Print string formatted according to the fmt parameter and variadic arguments.
- * Each formatting directive must have the following form:
- *
- *  \% [ FLAGS ] [ WIDTH ] [ .PRECISION ] [ TYPE ] CONVERSION
- *
- * FLAGS:@n
- *  - "#" Force to print prefix. For \%o conversion, the prefix is 0, for
- *        \%x and \%X prefixes are 0x and 0X and for conversion \%b the
- *        prefix is 0b.
- *
- *  - "-" Align to left.
- *
- *  - "+" Print positive sign just as negative.
- *
- *  - " " If the printed number is positive and "+" flag is not set,
- *        print space in place of sign.
- *
- *  - "0" Print 0 as padding instead of spaces. Zeroes are placed between
- *        sign and the rest of the number. This flag is ignored if "-"
- *        flag is specified.
- *
- * WIDTH:@n
- *  - Specify the minimal width of a printed argument. If it is bigger,
- *    width is ignored. If width is specified with a "*" character instead of
- *    number, width is taken from parameter list. And integer parameter is
- *    expected before parameter for processed conversion specification. If
- *    this value is negative its absolute value is taken and the "-" flag is
- *    set.
- *
- * PRECISION:@n
- *  - Value precision. For numbers it specifies minimum valid numbers.
- *    Smaller numbers are printed with leading zeroes. Bigger numbers are not
- *    affected. Strings with more than precision characters are cut off. Just
- *    as with width, an "*" can be used used instead of a number. An integer
- *    value is then expected in parameters. When both width and precision are
- *    specified using "*", the first parameter is used for width and the
- *    second one for precision.
- *
- * TYPE:@n
- *  - "hh" Signed or unsigned char.@n
- *  - "h"  Signed or unsigned short.@n
- *  - ""   Signed or unsigned int (default value).@n
- *  - "l"  Signed or unsigned long int.@n
- *         If conversion is "c", the character is wint_t (wide character).@n
- *         If conversion is "s", the string is char32_t * (wide string).@n
- *  - "ll" Signed or unsigned long long int.@n
- *  - "z"  Signed or unsigned ssize_t or site_t.@n
- *
- * CONVERSION:@n
- *  - % Print percentile character itself.
- *
- *  - c Print single character. The character is expected to be plain
- *      ASCII (e.g. only values 0 .. 127 are valid).@n
- *      If type is "l", then the character is expected to be wide character
- *      (e.g. values 0 .. 0x10ffff are valid).
- *
- *  - s Print zero terminated string. If a NULL value is passed as
- *      value, "(NULL)" is printed instead.@n
- *      If type is "l", then the string is expected to be wide string.
- *
- *  - P, p Print value of a pointer. Void * value is expected and it is
- *         printed in hexadecimal notation with prefix (as with
- *         \%#0.8X / \%#0.8x for 32-bit or \%#0.16lX / \%#0.16lx for 64-bit
- *         long pointers).
- *
- *  - b Print value as unsigned binary number. Prefix is not printed by
- *      default. (Nonstandard extension.)
- *
- *  - o Print value as unsigned octal number. Prefix is not printed by
- *      default.
- *
- *  - d, i Print signed decimal number. There is no difference between d
- *         and i conversion.
- *
- *  - u Print unsigned decimal number.
- *
- *  - X, x Print hexadecimal number with upper- or lower-case. Prefix is
- *         not printed by default.
- *
- * All other characters from fmt except the formatting directives are printed
- * verbatim.
- *
- * @param fmt Format NULL-terminated string.
- *
- * @return Number of characters printed, negative value on failure.
- *
- */
-int printf_core(const char *fmt, printf_spec_t *ps, va_list ap)
-{
-	errno_t rc = EOK;
-	size_t nxt = 0;  /* Index of the next character from fmt */
-
-	size_t counter = 0;   /* Number of characters printed */
-
-	while (rc == EOK) {
-		/* Find the next specifier and write all the bytes before it. */
-		const char *s = _strchrnul(&fmt[nxt], '%');
-		size_t bytes = s - &fmt[nxt];
-		rc = _write_bytes(&fmt[nxt], bytes, ps, &counter);
-		if (rc != EOK)
-			break;
-
-		nxt += bytes;
-
-		/* Check for end of string. */
-		if (_eat_char(fmt, &nxt, 0))
-			break;
-
-		/* We must be at the start of a specifier. */
-		bool spec = _eat_char(fmt, &nxt, '%');
-		assert(spec);
-
-		/* Parse modifiers */
-		uint32_t flags = _parse_flags(fmt, &nxt);
-
-		/* Width & '*' operator */
-		int width = -1;
-		if (_eat_char(fmt, &nxt, '*')) {
-			/* Get width value from argument list */
-			width = va_arg(ap, int);
-
-			if (width < 0) {
-				/* Negative width sets '-' flag */
-				width = (width == INT_MIN) ? INT_MAX : -width;
-				flags |= __PRINTF_FLAG_LEFTALIGNED;
-			}
-		} else {
-			width = _read_num(fmt, &nxt);
-		}
-
-		/* Precision and '*' operator */
-		int precision = -1;
-		if (_eat_char(fmt, &nxt, '.')) {
-			if (_eat_char(fmt, &nxt, '*')) {
-				/* Get precision value from the argument list */
-				precision = va_arg(ap, int);
-
-				/* Negative is treated as omitted. */
-				if (precision < 0)
-					precision = -1;
-			} else {
-				precision = _read_num(fmt, &nxt);
-			}
-		}
-
-		qualifier_t qualifier = _read_qualifier(fmt, &nxt);
-		unsigned int base = 10;
-		char specifier = fmt[nxt++];
-
-		switch (specifier) {
-		/*
-		 * String and character conversions.
-		 */
-		case 's':
-			if (qualifier == PrintfQualifierLong)
-				rc = _format_wstr(va_arg(ap, char32_t *), width, precision, flags, ps, &counter);
-			else
-				rc = _format_cstr(va_arg(ap, char *), width, precision, flags, ps, &counter);
-			continue;
-
-		case 'c':
-			if (qualifier == PrintfQualifierLong)
-				rc = _format_uchar(va_arg(ap, wint_t), width, flags, ps, &counter);
-			else
-				rc = _format_char(va_arg(ap, int), width, flags, ps, &counter);
-			continue;
-
-		/*
-		 * Floating point values
-		 */
-		case 'G':
-		case 'g':
-		case 'F':
-		case 'f':
-		case 'E':
-		case 'e':;
-#ifdef HAS_FLOAT
-			rc = _format_double(va_arg(ap, double), specifier, precision,
-			    width, flags, ps, &counter);
-#else
-			rc = _format_cstr("<float unsupported>", width, -1, 0, ps, &counter);
-#endif
-			continue;
-
-		/*
-		 * Integer values
-		 */
-		case 'P':
-			/* Pointer */
-			flags |= __PRINTF_FLAG_BIGCHARS;
-			/* Fallthrough */
-		case 'p':
-			flags |= __PRINTF_FLAG_PREFIX;
-			flags |= __PRINTF_FLAG_ZEROPADDED;
-			base = 16;
-			qualifier = PrintfQualifierPointer;
-			break;
-		case 'b':
-			base = 2;
-			break;
-		case 'o':
-			base = 8;
-			break;
-		case 'd':
-		case 'i':
-			flags |= __PRINTF_FLAG_SIGNED;
-			break;
-		case 'u':
-			break;
-		case 'X':
-			flags |= __PRINTF_FLAG_BIGCHARS;
-			/* Fallthrough */
-		case 'x':
-			base = 16;
-			break;
-
-		case '%':
-			/* Percentile itself */
-			rc = _write_char('%', ps, &counter);
-			continue;
-
-		/*
-		 * Bad formatting.
-		 */
-		default:
-			rc = EINVAL;
-			continue;
-		}
-
-		/* Print integers */
-		uint64_t number;
-
-		switch (qualifier) {
-		case PrintfQualifierByte:
-			number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
-			break;
-		case PrintfQualifierShort:
-			number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
-			break;
-		case PrintfQualifierInt:
-			number = PRINTF_GET_INT_ARGUMENT(int, ap, flags);
-			break;
-		case PrintfQualifierLong:
-			number = PRINTF_GET_INT_ARGUMENT(long, ap, flags);
-			break;
-		case PrintfQualifierLongLong:
-			number = PRINTF_GET_INT_ARGUMENT(long long, ap, flags);
-			break;
-		case PrintfQualifierPointer:
-			precision = sizeof(void *) << 1;
-			number = (uint64_t) (uintptr_t) va_arg(ap, void *);
-			break;
-		default:
-			/* Unknown qualifier */
-			rc = EINVAL;
-			continue;
-		}
-
-		rc = _format_number(number, width, precision, base, flags, ps, &counter);
-	}
-
-	if (rc != EOK) {
-		_set_errno(rc);
-		return -1;
-	}
-
-	if (counter > INT_MAX) {
-		_set_errno(EOVERFLOW);
-		return -1;
-	}
-
-	return (int) counter;
-}
-
-/** @}
- */
Index: mmon/stdc/bsearch.c
===================================================================
--- common/stdc/bsearch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief Binary search.
- */
-
-#include <bsearch.h>
-#include <stddef.h>
-
-/** Binary search.
- *
- * @param key Key to search for
- * @param base Array of objects
- * @param nmemb Number of objects in array
- * @param size Size of each object
- * @param compar Comparison function
- */
-void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
-    int (*compar)(const void *, const void *))
-{
-	size_t pividx;
-	const void *pivot;
-	int r;
-
-	while (nmemb != 0) {
-		pividx = nmemb / 2;
-		pivot = base + size * pividx;
-
-		r = compar(key, pivot);
-		if (r == 0)
-			return (void *)pivot;
-
-		if (r < 0) {
-			/* Now only look at members preceding pivot */
-			nmemb = pividx;
-		} else {
-			/* Now only look at members following pivot */
-			nmemb = nmemb - pividx - 1;
-			base += size * (pividx + 1);
-		}
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: mmon/stdc/calloc.c
===================================================================
--- common/stdc/calloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Petr Tuma
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-
-#include <mem.h>
-
-/** Allocate memory by number of elements
- *
- * @param nmemb Number of members to allocate.
- * @param size  Size of one member in bytes.
- *
- * @return Allocated memory or NULL.
- *
- */
-void *calloc(const size_t nmemb, const size_t size)
-{
-	// Check for overflow
-	if (SIZE_MAX / size < nmemb)
-		return NULL;
-
-	void *block = malloc(nmemb * size);
-	if (block == NULL)
-		return NULL;
-
-	memset(block, 0, nmemb * size);
-	return block;
-}
Index: mmon/stdc/cc.h
===================================================================
--- common/stdc/cc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * Macros related to used compiler (such as GCC-specific attributes).
- */
-
-#ifndef _LIBC_CC_H_
-#define _LIBC_CC_H_
-
-#ifndef __clang__
-#define ATTRIBUTE_OPTIMIZE(opt) \
-    __attribute__ ((optimize(opt)))
-#else
-#define ATTRIBUTE_OPTIMIZE(opt)
-#endif
-
-#define ATTRIBUTE_OPTIMIZE_NO_TLDP \
-    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns")
-
-#ifdef CONFIG_LTO
-#define DO_NOT_DISCARD __attribute__ ((used))
-#else
-#define DO_NOT_DISCARD
-#endif
-
-#endif
-
-/** @}
- */
Index: mmon/stdc/ctype.c
===================================================================
--- common/stdc/ctype.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <ctype.h>
-
-int islower(int c)
-{
-	return ((c >= 'a') && (c <= 'z'));
-}
-
-int isupper(int c)
-{
-	return ((c >= 'A') && (c <= 'Z'));
-}
-
-int isalpha(int c)
-{
-	return (islower(c) || isupper(c));
-}
-
-int isdigit(int c)
-{
-	return ((c >= '0') && (c <= '9'));
-}
-
-int isalnum(int c)
-{
-	return (isalpha(c) || isdigit(c));
-}
-
-int isblank(int c)
-{
-	return c == ' ' || c == '\t';
-}
-
-int iscntrl(int c)
-{
-	return (c >= 0 && c < 0x20) || c == 0x7E;
-}
-
-int isprint(int c)
-{
-	return c >= 0 && c < 0x80 && !iscntrl(c);
-}
-
-int isgraph(int c)
-{
-	return isprint(c) && c != ' ';
-}
-
-int isspace(int c)
-{
-	switch (c) {
-	case ' ':
-	case '\n':
-	case '\t':
-	case '\f':
-	case '\r':
-	case '\v':
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-int ispunct(int c)
-{
-	return !isspace(c) && !isalnum(c) && isprint(c);
-}
-
-int isxdigit(int c)
-{
-	return isdigit(c) ||
-	    (c >= 'a' && c <= 'f') ||
-	    (c >= 'A' && c <= 'F');
-}
-
-int tolower(int c)
-{
-	if (isupper(c))
-		return (c + ('a' - 'A'));
-	else
-		return c;
-}
-
-int toupper(int c)
-{
-	if (islower(c))
-		return (c + ('A' - 'a'));
-	else
-		return c;
-}
-
-/** @}
- */
Index: mmon/stdc/mem.c
===================================================================
--- common/stdc/mem.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,297 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include "../include/mem.h"
-
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "cc.h"
-
-#undef memset
-#undef memcpy
-#undef memcmp
-#undef memmove
-#undef memchr
-
-/** Fill memory block with a constant value. */
-DO_NOT_DISCARD
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-    void *memset(void *dest, int b, size_t n)
-{
-	char *pb;
-	unsigned long *pw;
-	size_t word_size;
-	size_t n_words;
-
-	unsigned long pattern;
-	size_t i;
-	size_t fill;
-
-	/* Fill initial segment. */
-	word_size = sizeof(unsigned long);
-	fill = word_size - ((uintptr_t) dest & (word_size - 1));
-	if (fill > n)
-		fill = n;
-
-	pb = dest;
-
-	i = fill;
-	while (i-- != 0)
-		*pb++ = b;
-
-	/* Compute remaining size. */
-	n -= fill;
-	if (n == 0)
-		return dest;
-
-	n_words = n / word_size;
-	n = n % word_size;
-	pw = (unsigned long *) pb;
-
-	/* Create word-sized pattern for aligned segment. */
-	pattern = 0;
-	i = word_size;
-	while (i-- != 0)
-		pattern = (pattern << 8) | (uint8_t) b;
-
-	/* Fill aligned segment. */
-	i = n_words;
-	while (i-- != 0)
-		*pw++ = pattern;
-
-	pb = (char *) pw;
-
-	/* Fill final segment. */
-	i = n;
-	while (i-- != 0)
-		*pb++ = b;
-
-	return dest;
-}
-
-struct along {
-	unsigned long n;
-} __attribute__((packed));
-
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-    static void *unaligned_memcpy(void *dst, const void *src, size_t n)
-{
-	size_t i, j;
-	struct along *adst = dst;
-	const struct along *asrc = src;
-
-	for (i = 0; i < n / sizeof(unsigned long); i++)
-		adst[i].n = asrc[i].n;
-
-	for (j = 0; j < n % sizeof(unsigned long); j++)
-		((unsigned char *) (((unsigned long *) dst) + i))[j] =
-		    ((unsigned char *) (((unsigned long *) src) + i))[j];
-
-	return (char *) dst;
-}
-
-/** Copy memory block. */
-DO_NOT_DISCARD
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-    void *memcpy(void *dst, const void *src, size_t n)
-{
-	size_t i;
-	size_t mod, fill;
-	size_t word_size;
-	size_t n_words;
-
-	const unsigned long *srcw;
-	unsigned long *dstw;
-	const uint8_t *srcb;
-	uint8_t *dstb;
-
-	word_size = sizeof(unsigned long);
-
-	/*
-	 * Are source and destination addresses congruent modulo word_size?
-	 * If not, use unaligned_memcpy().
-	 */
-
-	if (((uintptr_t) dst & (word_size - 1)) !=
-	    ((uintptr_t) src & (word_size - 1)))
-		return unaligned_memcpy(dst, src, n);
-
-	/*
-	 * mod is the address modulo word size. fill is the length of the
-	 * initial buffer segment before the first word boundary.
-	 * If the buffer is very short, use unaligned_memcpy(), too.
-	 */
-
-	mod = (uintptr_t) dst & (word_size - 1);
-	fill = word_size - mod;
-	if (fill > n)
-		fill = n;
-
-	/* Copy the initial segment. */
-
-	srcb = src;
-	dstb = dst;
-
-	i = fill;
-	while (i-- != 0)
-		*dstb++ = *srcb++;
-
-	/* Compute remaining length. */
-
-	n -= fill;
-	if (n == 0)
-		return dst;
-
-	/* Pointers to aligned segment. */
-
-	dstw = (unsigned long *) dstb;
-	srcw = (const unsigned long *) srcb;
-
-	n_words = n / word_size;	/* Number of whole words to copy. */
-	n -= n_words * word_size;	/* Remaining bytes at the end. */
-
-	/* "Fast" copy. */
-	i = n_words;
-	while (i-- != 0)
-		*dstw++ = *srcw++;
-
-	/*
-	 * Copy the rest.
-	 */
-
-	srcb = (const uint8_t *) srcw;
-	dstb = (uint8_t *) dstw;
-
-	i = n;
-	while (i-- != 0)
-		*dstb++ = *srcb++;
-
-	return dst;
-}
-
-/** Move memory block with possible overlapping. */
-DO_NOT_DISCARD
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-void *memmove(void *dst, const void *src, size_t n)
-{
-	const uint8_t *sp;
-	uint8_t *dp;
-
-	/* Nothing to do? */
-	if (src == dst)
-		return dst;
-
-	/* Non-overlapping? */
-	if (dst >= src + n || src >= dst + n) {
-		return memcpy(dst, src, n);
-	}
-
-	/* Which direction? */
-	if (src > dst) {
-		/* Forwards. */
-		sp = src;
-		dp = dst;
-
-		while (n-- != 0)
-			*dp++ = *sp++;
-	} else {
-		/* Backwards. */
-		sp = src + (n - 1);
-		dp = dst + (n - 1);
-
-		while (n-- != 0)
-			*dp-- = *sp--;
-	}
-
-	return dst;
-}
-
-/** Compare two memory areas.
- *
- * @param s1  Pointer to the first area to compare.
- * @param s2  Pointer to the second area to compare.
- * @param len Size of the areas in bytes.
- *
- * @return Zero if areas have the same contents. If they differ,
- *	   the sign of the result is the same as the sign of the
- *	   difference of the first pair of different bytes.
- *
- */
-DO_NOT_DISCARD
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-    int memcmp(const void *s1, const void *s2, size_t len)
-{
-	uint8_t *u1 = (uint8_t *) s1;
-	uint8_t *u2 = (uint8_t *) s2;
-	size_t i;
-
-	for (i = 0; i < len; i++) {
-		if (*u1 != *u2)
-			return (int)(*u1) - (int)(*u2);
-		++u1;
-		++u2;
-	}
-
-	return 0;
-}
-
-/** Search memory area.
- *
- * @param s Memory area
- * @param c Character (byte) to search for
- * @param n Size of memory area in bytes
- *
- * @return Pointer to the first occurrence of @a c in the first @a n
- *         bytes of @a s or @c NULL if not found.
- */
-DO_NOT_DISCARD
-ATTRIBUTE_OPTIMIZE_NO_TLDP
-void *memchr(const void *s, int c, size_t n)
-{
-	uint8_t *u = (uint8_t *) s;
-	unsigned char uc = (unsigned char) c;
-	size_t i;
-
-	for (i = 0; i < n; i++) {
-		if (u[i] == uc)
-			return (void *) &u[i];
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: mmon/stdc/qsort.c
===================================================================
--- common/stdc/qsort.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief Quicksort.
- */
-
-#include <qsort.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-/** Quicksort spec */
-typedef struct {
-	void *base;
-	size_t nmemb;
-	size_t size;
-	int (*compar)(const void *, const void *, void *);
-	void *arg;
-} qs_spec_t;
-
-/** Comparison function wrapper.
- *
- * Performs qsort_r comparison using qsort comparison function
- *
- * @param a First element
- * @param b Second element
- * @param arg qsort comparison function
- */
-static int compar_wrap(const void *a, const void *b, void *arg)
-{
-	int (*compar)(const void *, const void *) =
-	    (int (*)(const void *, const void *))arg;
-
-	return compar(a, b);
-}
-
-/** Determine if one element is less-than another element.
- *
- * @param qs Quicksort spec
- * @param i First element index
- * @param j Second element index
- */
-static bool elem_lt(qs_spec_t *qs, size_t i, size_t j)
-{
-	const void *a;
-	const void *b;
-	int r;
-
-	a = qs->base + i * qs->size;
-	b = qs->base + j * qs->size;
-
-	r = qs->compar(a, b, qs->arg);
-
-	return r < 0;
-}
-
-/** Swap two elements.
- *
- * @param qs Quicksort spec
- * @param i First element index
- * @param j Second element index
- */
-static void elem_swap(qs_spec_t *qs, size_t i, size_t j)
-{
-	char *a;
-	char *b;
-	char t;
-	size_t k;
-
-	a = qs->base + i * qs->size;
-	b = qs->base + j * qs->size;
-
-	for (k = 0; k < qs->size; k++) {
-		t = a[k];
-		a[k] = b[k];
-		b[k] = t;
-	}
-}
-
-/** Partition a range of indices.
- *
- * @param qs Quicksort spec
- * @param lo Lower bound (inclusive)
- * @param hi Upper bound (inclusive)
- * @return Pivot index
- */
-static size_t partition(qs_spec_t *qs, size_t lo, size_t hi)
-{
-	size_t pivot;
-	size_t i, j;
-
-	pivot = lo + (hi - lo) / 2;
-	i = lo;
-	j = hi;
-	while (true) {
-		while (elem_lt(qs, i, pivot))
-			++i;
-		while (elem_lt(qs, pivot, j))
-			--j;
-
-		if (i >= j)
-			return j;
-
-		elem_swap(qs, i, j);
-
-		/* Need to follow pivot movement */
-		if (i == pivot)
-			pivot = j;
-		else if (j == pivot)
-			pivot = i;
-
-		i++;
-		j--;
-	}
-}
-
-/** Sort a range of indices.
- *
- * @param qs Quicksort spec
- * @param lo Lower bound (inclusive)
- * @param hi Upper bound (inclusive)
- */
-static void quicksort(qs_spec_t *qs, size_t lo, size_t hi)
-{
-	size_t p;
-
-	if (lo < hi) {
-		p = partition(qs, lo, hi);
-		quicksort(qs, lo, p);
-		quicksort(qs, p + 1, hi);
-	}
-}
-
-/** Quicksort.
- *
- * @param base Array to sort
- * @param nmemb Number of array members
- * @param size Size of member in bytes
- * @param compar Comparison function
- */
-void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *,
-    const void *))
-{
-	qs_spec_t qs;
-
-	if (nmemb == 0)
-		return;
-
-	qs.base = base;
-	qs.nmemb = nmemb;
-	qs.size = size;
-	qs.compar = compar_wrap;
-	qs.arg = compar;
-
-	quicksort(&qs, 0, nmemb - 1);
-}
-
-/** Quicksort with extra argument to comparison function.
- *
- * @param base Array to sort
- * @param nmemb Number of array members
- * @param size Size of member in bytes
- * @param compar Comparison function
- * @param arg Argument to comparison function
- */
-void qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void *,
-    const void *, void *), void *arg)
-{
-	qs_spec_t qs;
-
-	if (nmemb == 0)
-		return;
-
-	qs.base = base;
-	qs.nmemb = nmemb;
-	qs.size = size;
-	qs.compar = compar;
-	qs.arg = arg;
-
-	quicksort(&qs, 0, nmemb - 1);
-}
-
-/** @}
- */
Index: mmon/stdc/snprintf.c
===================================================================
--- common/stdc/snprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-
-/** Print formatted to the given buffer with limited size.
- *
- * @param str  Buffer
- * @param size Buffer size
- * @param fmt  Format string
- *
- * \see For more details about format string see printf_core.
- *
- */
-int snprintf(char *str, size_t size, const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-
-	int ret = vsnprintf(str, size, fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-/** @}
- */
Index: mmon/stdc/uchar.c
===================================================================
--- common/stdc/uchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <uchar.h>
-
-#if __STDC_HOSTED__
-#include <fibril.h>
-#endif
-
-static void _set_ilseq()
-{
-#ifdef errno
-	errno = EILSEQ;
-#endif
-}
-
-static bool _is_low_surrogate(char16_t c)
-{
-	return c >= 0xDC00 && c < 0xE000;
-}
-
-static bool _is_high_surrogate(char16_t c)
-{
-	return c >= 0xD800 && c < 0xDC00;
-}
-
-static bool _is_surrogate(char16_t c)
-{
-	return c >= 0xD800 && c < 0xE000;
-}
-
-#define UTF8_CONT(c, shift) (0x80 | (((c) >> (shift)) & 0x3F))
-
-size_t c32rtomb(char *s, char32_t c, mbstate_t *mb)
-{
-	if (!s) {
-		// Equivalent to c32rtomb(buf, L’\0’, mb).
-		return 1;
-	}
-
-	/* 1 byte encoding */
-	if (c < 0x80) {
-		s[0] = c;
-		return 1;
-	}
-
-	/* 2 byte encoding */
-	if (c < 0x800) {
-		s[0] = 0b11000000 | (c >> 6);
-		s[1] = UTF8_CONT(c, 0);
-		return 2;
-	}
-
-	/* 3 byte encoding */
-	if (c < 0x10000) {
-		if (_is_surrogate(c)) {
-			/* illegal range for an unicode code point */
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		}
-
-		s[0] = 0b11100000 | (c >> 12);
-		s[1] = UTF8_CONT(c, 6);
-		s[2] = UTF8_CONT(c, 0);
-		return 3;
-	}
-
-	/* 4 byte encoding */
-	if (c < 0x110000) {
-		s[0] = 0b11110000 | (c >> 18);
-		s[1] = UTF8_CONT(c, 12);
-		s[2] = UTF8_CONT(c, 6);
-		s[3] = UTF8_CONT(c, 0);
-		return 4;
-	}
-
-	_set_ilseq();
-	return UCHAR_ILSEQ;
-}
-
-size_t mbrtoc16(char16_t *c, const char *s, size_t n, mbstate_t *mb)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state = { };
-
-	if (!mb)
-		mb = &global_state;
-#else
-	assert(mb);
-#endif
-
-	char16_t dummy;
-
-	if (!c)
-		c = &dummy;
-
-	if (!s) {
-		/* Equivalent to mbrtoc16(NULL, "", 1, mb). */
-		if (mb->state) {
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		} else {
-			return 0;
-		}
-	}
-
-	if ((mb->state & 0xD000) == 0xD000) {
-		/* mbstate_t contains the second surrogate character. */
-		/* mbrtoc32() will never set it to such value.        */
-		*c = mb->state;
-		mb->state = 0;
-		return UCHAR_CONTINUED;
-	}
-
-	char32_t c32 = 0;
-	size_t ret = mbrtoc32(&c32, s, n, mb);
-	if (ret < INT_MAX) {
-		if (c32 < 0x10000) {
-			*c = c32;
-		} else {
-			/* Encode UTF-16 surrogates. */
-			mb->state = (c32 & 0x3FF) + 0xDC00;
-			*c = (c32 >> 10) + 0xD7C0;
-		}
-		return ret;
-	}
-
-	return ret;
-}
-
-size_t c16rtomb(char *s, char16_t c, mbstate_t *mb)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state = { };
-
-	if (!mb)
-		mb = &global_state;
-#else
-	assert(mb);
-#endif
-
-	if (!s) {
-		// Equivalent to c16rtomb(buf, L’\0’, mb).
-		if (mb->state) {
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		} else {
-			return 1;
-		}
-	}
-
-	if (!_is_surrogate(c)) {
-		if (mb->state) {
-			_set_ilseq();
-			return UCHAR_ILSEQ;
-		}
-
-		return c32rtomb(s, c, mb);
-	}
-
-	if (!mb->state) {
-		mb->state = c;
-		return 0;
-	}
-
-	char32_t c32;
-
-	/* Decode UTF-16 surrogates. */
-	if (_is_low_surrogate(mb->state) && _is_high_surrogate(c)) {
-		c32 = ((c - 0xD7C0) << 10) | (mb->state - 0xDC00);
-	} else if (_is_high_surrogate(mb->state) && _is_low_surrogate(c)) {
-		c32 = ((mb->state - 0xD7C0) << 10) | (c - 0xDC00);
-	} else {
-		_set_ilseq();
-		return UCHAR_ILSEQ;
-	}
-
-	mb->state = 0;
-	return c32rtomb(s, c32, mb);
-}
Index: mmon/stdc/vsnprintf.c
===================================================================
--- common/stdc/vsnprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <macros.h>
-#include <printf_core.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <str.h>
-
-typedef struct {
-	char *dst;      /* Destination */
-	size_t left;
-} vsnprintf_data_t;
-
-static int vsnprintf_str_write(const char *str, size_t size, void *data)
-{
-	vsnprintf_data_t *d = data;
-	size_t left = min(size, d->left);
-	if (left > 0) {
-		memcpy(d->dst, str, left);
-		d->dst += left;
-		d->left -= left;
-	}
-	return EOK;
-}
-
-int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
-{
-	vsnprintf_data_t data = {
-		.dst = str,
-		.left = size ? size - 1 : 0,
-	};
-
-	printf_spec_t ps = {
-		vsnprintf_str_write,
-		&data
-	};
-
-	int written = printf_core(fmt, &ps, ap);
-	if (written < 0)
-		return written;
-
-	/* Write the terminating NUL character. */
-	if (size > 0)
-		data.dst[0] = 0;
-
-	return written;
-}
-
-/** @}
- */
Index: mmon/stdc/wchar.c
===================================================================
--- common/stdc/wchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <uchar.h>
-#include <wchar.h>
-
-#if __STDC_HOSTED__
-#include <fibril.h>
-#endif
-
-wint_t btowc(int c)
-{
-	return (c < 0x80) ? c : WEOF;
-}
-
-int wctob(wint_t c)
-{
-	return c;
-}
-
-int mbsinit(const mbstate_t *ps)
-{
-	return ps == NULL || ps->state == 0;
-}
-
-size_t mbrlen(const char *s, size_t n, mbstate_t *ps)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state;
-	if (!ps)
-		ps = &global_state;
-#endif
-
-	return mbrtowc(NULL, s, n, ps);
-}
-
-_Static_assert(sizeof(wchar_t) == sizeof(char16_t) || sizeof(wchar_t) == sizeof(char32_t));
-
-size_t mbrtowc(wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state;
-	if (!ps)
-		ps = &global_state;
-#endif
-
-	if (sizeof(wchar_t) == sizeof(char16_t))
-		return mbrtoc16((char16_t *) pwc, s, n, ps);
-	else
-		return mbrtoc32((char32_t *) pwc, s, n, ps);
-}
-
-size_t wcrtomb(char *s, wchar_t wc, mbstate_t * ps)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state;
-	if (!ps)
-		ps = &global_state;
-#endif
-
-	if (sizeof(wchar_t) == sizeof(char16_t))
-		return c16rtomb(s, (char16_t) wc, ps);
-	else
-		return c32rtomb(s, (char32_t) wc, ps);
-}
Index: mmon/str.c
===================================================================
--- common/str.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1971 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2008 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2011 Oleg Romanenko
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief String functions.
- *
- * Strings and characters use the Universal Character Set (UCS). The standard
- * strings, called just strings are encoded in UTF-8. Wide strings (encoded
- * in UTF-32) are supported to a limited degree. A single character is
- * represented as char32_t.@n
- *
- * Overview of the terminology:@n
- *
- *  Term                  Meaning
- *  --------------------  ----------------------------------------------------
- *  byte                  8 bits stored in uint8_t (unsigned 8 bit integer)
- *
- *  character             UTF-32 encoded Unicode character, stored in char32_t
- *                        (unsigned 32 bit integer), code points 0 .. 1114111
- *                        are valid
- *
- *                        Note that Unicode characters do not match
- *                        one-to-one with displayed characters or glyphs on
- *                        screen. For that level of precision, look up
- *                        Grapheme Clusters.
- *
- *  ASCII character       7 bit encoded ASCII character, stored in char
- *                        (usually signed 8 bit integer), code points 0 .. 127
- *                        are valid
- *
- *  string                UTF-8 encoded NULL-terminated Unicode string, char *
- *
- *  wide string           UTF-32 encoded NULL-terminated Unicode string,
- *                        char32_t *
- *
- *  [wide] string size    number of BYTES in a [wide] string (excluding
- *                        the NULL-terminator), size_t
- *
- *  [wide] string length  number of CHARACTERS in a [wide] string (excluding
- *                        the NULL-terminator), size_t
- *
- *  [wide] string width   number of display cells on a monospace display taken
- *                        by a [wide] string, size_t
- *
- *                        This is virtually impossible to determine exactly for
- *                        all strings without knowing specifics of the display
- *                        device, due to various factors affecting text output.
- *                        If you have the option to query the terminal for
- *                        position change caused by outputting the string,
- *                        it is preferrable to determine width that way.
- *
- *
- * Overview of string metrics:@n
- *
- *  Metric  Abbrev.  Type     Meaning
- *  ------  ------   ------   -------------------------------------------------
- *  size    n        size_t   number of BYTES in a string (excluding the
- *                            NULL-terminator)
- *
- *  length  l        size_t   number of CHARACTERS in a string (excluding the
- *                            null terminator)
- *
- *  width  w         size_t   number of display cells on a monospace display
- *                            taken by a string
- *
- *
- * Function naming prefixes:@n
- *
- *  chr_    operate on characters
- *  ascii_  operate on ASCII characters
- *  str_    operate on strings
- *  wstr_   operate on wide strings
- *
- *  [w]str_[n|l|w]  operate on a prefix limited by size, length
- *                  or width
- *
- *
- * A specific character inside a [wide] string can be referred to by:@n
- *
- *  pointer (char *, char32_t *)
- *  byte offset (size_t)
- *  character index (size_t)
- *
- */
-
-#include <str.h>
-
-#include <align.h>
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <uchar.h>
-
-#if __STDC_HOSTED__
-#include <fibril.h>
-#endif
-
-static void _set_ilseq()
-{
-#ifdef errno
-	errno = EILSEQ;
-#endif
-}
-
-/** Byte mask consisting of lowest @n bits (out of 8) */
-#define LO_MASK_8(n)  ((uint8_t) ((1 << (n)) - 1))
-
-/** Byte mask consisting of lowest @n bits (out of 32) */
-#define LO_MASK_32(n)  ((uint32_t) ((1 << (n)) - 1))
-
-/** Byte mask consisting of highest @n bits (out of 8) */
-#define HI_MASK_8(n)  (~LO_MASK_8(8 - (n)))
-
-/** Number of data bits in a UTF-8 continuation byte */
-#define CONT_BITS  6
-
-#define UTF8_MASK_INITIAL2  0b00011111
-#define UTF8_MASK_INITIAL3  0b00001111
-#define UTF8_MASK_INITIAL4  0b00000111
-#define UTF8_MASK_CONT      0b00111111
-
-#define CHAR_INVALID ((char32_t) UINT_MAX)
-
-static inline bool _is_ascii(uint8_t b)
-{
-	return b < 0x80;
-}
-
-static inline bool _is_continuation(uint8_t b)
-{
-	return (b & 0xC0) == 0x80;
-}
-
-static inline bool _is_2_byte(uint8_t c)
-{
-	return (c & 0xE0) == 0xC0;
-}
-
-static inline bool _is_3_byte(uint8_t c)
-{
-	return (c & 0xF0) == 0xE0;
-}
-
-static inline bool _is_4_byte(uint8_t c)
-{
-	return (c & 0xF8) == 0xF0;
-}
-
-static inline int _char_continuation_bytes(char32_t c)
-{
-	if ((c & ~LO_MASK_32(7)) == 0)
-		return 0;
-
-	if ((c & ~LO_MASK_32(11)) == 0)
-		return 1;
-
-	if ((c & ~LO_MASK_32(16)) == 0)
-		return 2;
-
-	if ((c & ~LO_MASK_32(21)) == 0)
-		return 3;
-
-	/* Codes longer than 21 bits are not supported */
-	return -1;
-}
-
-static inline int _continuation_bytes(uint8_t b)
-{
-	/* 0xxxxxxx */
-	if (_is_ascii(b))
-		return 0;
-
-	/* 110xxxxx 10xxxxxx */
-	if (_is_2_byte(b))
-		return 1;
-
-	/* 1110xxxx 10xxxxxx 10xxxxxx */
-	if (_is_3_byte(b))
-		return 2;
-
-	/* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
-	if (_is_4_byte(b))
-		return 3;
-
-	return -1;
-}
-
-static bool _is_non_shortest(const mbstate_t *mb, uint8_t b)
-{
-	return (mb->state == 0b1111110000000000 && !(b & 0b00100000)) ||
-	    (mb->state == 0b1111111111110000 && !(b & 0b00110000));
-}
-
-static bool _is_surrogate(const mbstate_t *mb, uint8_t b)
-{
-	return (mb->state == 0b1111110000001101 && b >= 0xa0);
-}
-
-#define _likely(expr) __builtin_expect((expr), true)
-#define _unlikely(expr) __builtin_expect((expr), false)
-
-#define FAST_PATHS 1
-
-static char32_t _str_decode(const char *s, size_t *offset, size_t size, mbstate_t *mb)
-{
-	assert(s);
-	assert(offset);
-	assert(*offset <= size);
-	assert(size == STR_NO_LIMIT || s + size >= s);
-	assert(mb);
-
-	if (*offset == size)
-		return 0;
-
-	if (_likely(!mb->state)) {
-		/* Clean slate, read initial byte. */
-		uint8_t b = s[(*offset)++];
-
-		/* Fast exit for the most common case. */
-		if (_likely(_is_ascii(b)))
-			return b;
-
-		/* unexpected continuation byte */
-		if (_unlikely(_is_continuation(b)))
-			return CHAR_INVALID;
-
-		/*
-		 * The value stored into `continuation` is designed to have
-		 * just enough leading ones that after shifting in one less than
-		 * the expected number of continuation bytes, the most significant
-		 * bit becomes zero. (The field is 16b wide.)
-		 */
-
-		if (_is_2_byte(b)) {
-			/* Reject non-shortest form. */
-			if (_unlikely(!(b & 0b00011110)))
-				return CHAR_INVALID;
-
-#if FAST_PATHS
-			/* We can usually take this exit. */
-			if (_likely(*offset < size && _is_continuation(s[*offset])))
-				return (b & UTF8_MASK_INITIAL2) << 6 |
-				    (s[(*offset)++] & UTF8_MASK_CONT);
-#endif
-
-			/* 2 byte continuation    110xxxxx */
-			mb->state = b ^ 0b0000000011000000;
-
-		} else if (_is_3_byte(b)) {
-#if FAST_PATHS
-			/* We can usually take this exit. */
-			if (_likely(*offset + 1 < size && _is_continuation(s[*offset]) && _is_continuation(s[*offset + 1]))) {
-
-				char32_t ch = (b & UTF8_MASK_INITIAL3) << 12 |
-				    (s[(*offset)] & UTF8_MASK_CONT) << 6 |
-				    (s[(*offset) + 1] & UTF8_MASK_CONT);
-
-				*offset += 2;
-
-				/* Reject non-shortest form. */
-				if (_unlikely(!(ch & 0xFFFFF800)))
-					return CHAR_INVALID;
-
-				/* Reject surrogates */
-				if (_unlikely(ch >= 0xD800 && ch < 0xE000))
-					return CHAR_INVALID;
-
-				return ch;
-			}
-#endif
-
-			/* 3 byte continuation    1110xxxx */
-			mb->state = b ^ 0b1111110011100000;
-
-		} else if (_is_4_byte(b)) {
-#if FAST_PATHS
-			/* We can usually take this exit. */
-			if (_likely(*offset + 2 < size && _is_continuation(s[*offset]) &&
-			    _is_continuation(s[*offset + 1]) && _is_continuation(s[*offset + 2]))) {
-
-				char32_t ch = (b & UTF8_MASK_INITIAL4) << 18 |
-				    (s[(*offset)] & UTF8_MASK_CONT) << 12 |
-				    (s[(*offset) + 1] & UTF8_MASK_CONT) << 6 |
-				    (s[(*offset) + 2] & UTF8_MASK_CONT);
-
-				*offset += 3;
-
-				/* Reject non-shortest form. */
-				if (_unlikely(!(ch & 0xFFFF0000)))
-					return CHAR_INVALID;
-
-				/* Reject out-of-range characters. */
-				if (_unlikely(ch >= 0x110000))
-					return CHAR_INVALID;
-
-				return ch;
-			}
-#endif
-
-			/* 4 byte continuation    11110xxx */
-			mb->state = b ^ 0b1111111100000000;
-		} else {
-			return CHAR_INVALID;
-		}
-	}
-
-	/* Deal with the remaining edge and invalid cases. */
-	for (; *offset < size; (*offset)++) {
-		/* Read continuation bytes. */
-		uint8_t b = s[*offset];
-
-		if (!_is_continuation(b) || _is_non_shortest(mb, b) || _is_surrogate(mb, b)) {
-			mb->state = 0;
-			return CHAR_INVALID;
-		}
-
-		/* Top bit becomes zero when shifting in the second to last byte. */
-		if (!(mb->state & 0x8000)) {
-			char32_t c = ((char32_t) mb->state) << 6 | (b & UTF8_MASK_CONT);
-			mb->state = 0;
-			(*offset)++;
-			return c;
-		}
-
-		mb->state = mb->state << 6 | (b & UTF8_MASK_CONT);
-	}
-
-	/* Incomplete character. */
-	assert(mb->state);
-	return 0;
-}
-
-/** Standard <uchar.h> function since C11. */
-size_t mbrtoc32(char32_t *c, const char *s, size_t n, mbstate_t *mb)
-{
-#if __STDC_HOSTED__
-	static fibril_local mbstate_t global_state = { };
-
-	if (!mb)
-		mb = &global_state;
-#endif
-
-	if (!s) {
-		/* Equivalent to mbrtoc32(NULL, "", 1, mb); */
-		c = NULL;
-		s = "";
-		n = 1;
-	}
-
-	size_t offset = 0;
-	char32_t ret = _str_decode(s, &offset, n, mb);
-	if (ret == CHAR_INVALID) {
-		assert(!mb->state);
-		_set_ilseq();
-		return UCHAR_ILSEQ;
-	}
-	if (mb->state) {
-		assert(ret == 0);
-		return UCHAR_INCOMPLETE;
-	}
-
-	if (c)
-		*c = ret;
-	return ret ? offset : 0;
-}
-
-/** Decode a single character from a string.
- *
- * Decode a single character from a string of size @a size. Decoding starts
- * at @a offset and this offset is moved to the beginning of the next
- * character. In case of decoding error, offset generally advances at least
- * by one. However, offset is never moved beyond size.
- *
- * @param str    String (not necessarily NULL-terminated).
- * @param offset Byte offset in string where to start decoding.
- * @param size   Size of the string (in bytes).
- *
- * @return Value of decoded character, U_SPECIAL on decoding error or
- *         NULL if attempt to decode beyond @a size.
- *
- */
-char32_t str_decode(const char *str, size_t *offset, size_t size)
-{
-	mbstate_t mb = { };
-	char32_t ch = _str_decode(str, offset, size, &mb);
-
-	if (ch == CHAR_INVALID || mb.state)
-		return U_SPECIAL;
-
-	return ch;
-}
-
-char32_t str_decode_r(const char *str, size_t *offset, size_t size,
-	char32_t replacement, mbstate_t *mb)
-{
-	char32_t ch = _str_decode(str, offset, size, mb);
-	return (ch == CHAR_INVALID) ? replacement : ch;
-}
-
-/** Decode a single character from a string to the left.
- *
- * Decode a single character from a string of size @a size. Decoding starts
- * at @a offset and this offset is moved to the beginning of the previous
- * character. In case of decoding error, offset generally decreases at least
- * by one. However, offset is never moved before 0.
- *
- * @param str    String (not necessarily NULL-terminated).
- * @param offset Byte offset in string where to start decoding.
- * @param size   Size of the string (in bytes).
- *
- * @return Value of decoded character, U_SPECIAL on decoding error or
- *         NULL if attempt to decode beyond @a start of str.
- *
- */
-char32_t str_decode_reverse(const char *str, size_t *offset, size_t size)
-{
-	if (*offset == 0)
-		return 0;
-
-	int cbytes = 0;
-	/* Continue while continuation bytes found */
-	while (*offset > 0 && cbytes < 4) {
-		uint8_t b = (uint8_t) str[--(*offset)];
-
-		if (_is_continuation(b)) {
-			cbytes++;
-			continue;
-		}
-
-		/* Reject non-shortest form encoding. */
-		if (cbytes != _continuation_bytes(b))
-			return U_SPECIAL;
-
-		/* Start byte */
-		size_t start_offset = *offset;
-		return str_decode(str, &start_offset, size);
-	}
-
-	/* Too many continuation bytes */
-	return U_SPECIAL;
-}
-
-/** Encode a single character to string representation.
- *
- * Encode a single character to string representation (i.e. UTF-8) and store
- * it into a buffer at @a offset. Encoding starts at @a offset and this offset
- * is moved to the position where the next character can be written to.
- *
- * @param ch     Input character.
- * @param str    Output buffer.
- * @param offset Byte offset where to start writing.
- * @param size   Size of the output buffer (in bytes).
- *
- * @return EOK if the character was encoded successfully, EOVERFLOW if there
- *         was not enough space in the output buffer or EINVAL if the character
- *         code was invalid.
- */
-errno_t chr_encode(char32_t ch, char *str, size_t *offset, size_t size)
-{
-	// TODO: merge with c32rtomb()
-
-	if (*offset >= size)
-		return EOVERFLOW;
-
-	/* Fast exit for the most common case. */
-	if (ch < 0x80) {
-		str[(*offset)++] = (char) ch;
-		return EOK;
-	}
-
-	/* Codes longer than 21 bits are not supported */
-	if (!chr_check(ch))
-		return EINVAL;
-
-	/* Determine how many continuation bytes are needed */
-
-	unsigned int cbytes = _char_continuation_bytes(ch);
-	unsigned int b0_bits = 6 - cbytes;  /* Data bits in first byte */
-
-	/* Check for available space in buffer */
-	if (*offset + cbytes >= size)
-		return EOVERFLOW;
-
-	/* Encode continuation bytes */
-	unsigned int i;
-	for (i = cbytes; i > 0; i--) {
-		str[*offset + i] = 0x80 | (ch & LO_MASK_32(CONT_BITS));
-		ch >>= CONT_BITS;
-	}
-
-	/* Encode first byte */
-	str[*offset] = (ch & LO_MASK_32(b0_bits)) | HI_MASK_8(8 - b0_bits - 1);
-
-	/* Advance offset */
-	*offset += cbytes + 1;
-
-	return EOK;
-}
-
-/* Convert in place any bytes that don't form a valid character into replacement. */
-static size_t _str_sanitize(char *str, size_t n, uint8_t replacement)
-{
-	uint8_t *b = (uint8_t *) str;
-	size_t count = 0;
-
-	for (; n > 0 && b[0]; b++, n--) {
-		if (b[0] < ' ') {
-			/* C0 control codes */
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		int cont = _continuation_bytes(b[0]);
-		if (__builtin_expect(cont, 0) == 0)
-			continue;
-
-		if (cont < 0 || n <= (size_t) cont) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/* Check continuation bytes. */
-		bool valid = true;
-		for (int i = 1; i <= cont; i++) {
-			if (!_is_continuation(b[i])) {
-				valid = false;
-				break;
-			}
-		}
-
-		if (!valid) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/*
-		 * Check for non-shortest form encoding.
-		 * See https://www.unicode.org/versions/corrigendum1.html
-		 */
-
-		/* 0b110!!!!x 0b10xxxxxx */
-		if (cont == 1 && !(b[0] & 0b00011110)) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		bool c1_control = (b[0] == 0b11000010 && b[1] < 0b10100000);
-		if (cont == 1 && c1_control) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/* 0b1110!!!! 0b10!xxxxx 0b10xxxxxx */
-		if (cont == 2 && !(b[0] & 0b00001111) && !(b[1] & 0b00100000)) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/* 0b11110!!! 0b10!!xxxx 0b10xxxxxx 0b10xxxxxx */
-		if (cont == 3 && !(b[0] & 0b00000111) && !(b[1] & 0b00110000)) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/* Check for surrogate character encoding. */
-		if (cont == 2 && b[0] == 0xED && b[1] >= 0xA0) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		/* Check for out-of-range code points. */
-		if (cont == 3 && (b[0] > 0xF4 || (b[0] == 0xF4 && b[1] >= 0x90))) {
-			b[0] = replacement;
-			count++;
-			continue;
-		}
-
-		b += cont;
-		n -= cont;
-	}
-
-	return count;
-}
-
-/** Replaces any byte that's not part of a complete valid UTF-8 character
- * encoding with a replacement byte.
- * Also replaces C0 and C1 control codes.
- */
-size_t str_sanitize(char *str, size_t n, uint8_t replacement)
-{
-	return _str_sanitize(str, n, replacement);
-}
-
-static size_t _str_size(const char *str)
-{
-	size_t size = 0;
-
-	while (*str++ != 0)
-		size++;
-
-	return size;
-}
-
-/** Get size of string.
- *
- * Get the number of bytes which are used by the string @a str (excluding the
- * NULL-terminator).
- *
- * @param str String to consider.
- *
- * @return Number of bytes used by the string
- *
- */
-size_t str_size(const char *str)
-{
-	return _str_size(str);
-}
-
-/** Get size of wide string.
- *
- * Get the number of bytes which are used by the wide string @a str (excluding the
- * NULL-terminator).
- *
- * @param str Wide string to consider.
- *
- * @return Number of bytes used by the wide string
- *
- */
-size_t wstr_size(const char32_t *str)
-{
-	return (wstr_length(str) * sizeof(char32_t));
-}
-
-/** Get size of string with length limit.
- *
- * Get the number of bytes which are used by up to @a max_len first
- * characters in the string @a str. If @a max_len is greater than
- * the length of @a str, the entire string is measured (excluding the
- * NULL-terminator).
- *
- * @param str     String to consider.
- * @param max_len Maximum number of characters to measure.
- *
- * @return Number of bytes used by the characters.
- *
- */
-size_t str_lsize(const char *str, size_t max_len)
-{
-	size_t len = 0;
-	size_t offset = 0;
-
-	while (len < max_len) {
-		if (str_decode(str, &offset, STR_NO_LIMIT) == 0)
-			break;
-
-		len++;
-	}
-
-	return offset;
-}
-
-static size_t _str_nsize(const char *str, size_t max_size)
-{
-	size_t size = 0;
-
-	while ((*str++ != 0) && (size < max_size))
-		size++;
-
-	return size;
-}
-
-/** Get size of string with size limit.
- *
- * Get the number of bytes which are used by the string @a str
- * (excluding the NULL-terminator), but no more than @max_size bytes.
- *
- * @param str      String to consider.
- * @param max_size Maximum number of bytes to measure.
- *
- * @return Number of bytes used by the string
- *
- */
-size_t str_nsize(const char *str, size_t max_size)
-{
-	return _str_nsize(str, max_size);
-}
-
-/** Get size of wide string with size limit.
- *
- * Get the number of bytes which are used by the wide string @a str
- * (excluding the NULL-terminator), but no more than @max_size bytes.
- *
- * @param str      Wide string to consider.
- * @param max_size Maximum number of bytes to measure.
- *
- * @return Number of bytes used by the wide string
- *
- */
-size_t wstr_nsize(const char32_t *str, size_t max_size)
-{
-	return (wstr_nlength(str, max_size) * sizeof(char32_t));
-}
-
-/** Get size of wide string with length limit.
- *
- * Get the number of bytes which are used by up to @a max_len first
- * wide characters in the wide string @a str. If @a max_len is greater than
- * the length of @a str, the entire wide string is measured (excluding the
- * NULL-terminator).
- *
- * @param str     Wide string to consider.
- * @param max_len Maximum number of wide characters to measure.
- *
- * @return Number of bytes used by the wide characters.
- *
- */
-size_t wstr_lsize(const char32_t *str, size_t max_len)
-{
-	return (wstr_nlength(str, max_len * sizeof(char32_t)) * sizeof(char32_t));
-}
-
-/** Get number of characters in a string.
- *
- * @param str NULL-terminated string.
- *
- * @return Number of characters in string.
- *
- */
-size_t str_length(const char *str)
-{
-	size_t len = 0;
-	size_t offset = 0;
-
-	while (str_decode(str, &offset, STR_NO_LIMIT) != 0)
-		len++;
-
-	return len;
-}
-
-/** Get number of characters in a wide string.
- *
- * @param str NULL-terminated wide string.
- *
- * @return Number of characters in @a str.
- *
- */
-size_t wstr_length(const char32_t *wstr)
-{
-	size_t len = 0;
-
-	while (*wstr++ != 0)
-		len++;
-
-	return len;
-}
-
-/** Get number of characters in a string with size limit.
- *
- * @param str  NULL-terminated string.
- * @param size Maximum number of bytes to consider.
- *
- * @return Number of characters in string.
- *
- */
-size_t str_nlength(const char *str, size_t size)
-{
-	size_t len = 0;
-	size_t offset = 0;
-
-	while (str_decode(str, &offset, size) != 0)
-		len++;
-
-	return len;
-}
-
-/** Get number of characters in a string with size limit.
- *
- * @param str  NULL-terminated string.
- * @param size Maximum number of bytes to consider.
- *
- * @return Number of characters in string.
- *
- */
-size_t wstr_nlength(const char32_t *str, size_t size)
-{
-	size_t len = 0;
-	size_t limit = ALIGN_DOWN(size, sizeof(char32_t));
-	size_t offset = 0;
-
-	while ((offset < limit) && (*str++ != 0)) {
-		len++;
-		offset += sizeof(char32_t);
-	}
-
-	return len;
-}
-
-/** Get character display width on a character cell display.
- *
- * @param ch	Character
- * @return	Width of character in cells.
- */
-size_t chr_width(char32_t ch)
-{
-	return 1;
-}
-
-/** Get string display width on a character cell display.
- *
- * @param str	String
- * @return	Width of string in cells.
- */
-size_t str_width(const char *str)
-{
-	size_t width = 0;
-	size_t offset = 0;
-	char32_t ch;
-
-	while ((ch = str_decode(str, &offset, STR_NO_LIMIT)) != 0)
-		width += chr_width(ch);
-
-	return width;
-}
-
-/** Check whether character is plain ASCII.
- *
- * @return True if character is plain ASCII.
- *
- */
-bool ascii_check(char32_t ch)
-{
-	if (ch <= 127)
-		return true;
-
-	return false;
-}
-
-/** Check whether character is valid
- *
- * @return True if character is a valid Unicode code point.
- *
- */
-bool chr_check(char32_t ch)
-{
-	if (ch <= 1114111)
-		return true;
-
-	return false;
-}
-
-/** Compare two NULL terminated strings.
- *
- * Do a char-by-char comparison of two NULL-terminated strings.
- * The strings are considered equal iff their length is equal
- * and both strings consist of the same sequence of characters.
- *
- * A string S1 is less than another string S2 if it has a character with
- * lower value at the first character position where the strings differ.
- * If the strings differ in length, the shorter one is treated as if
- * padded by characters with a value of zero.
- *
- * @param s1 First string to compare.
- * @param s2 Second string to compare.
- *
- * @return 0 if the strings are equal, -1 if the first is less than the second,
- *         1 if the second is less than the first.
- *
- */
-int str_cmp(const char *s1, const char *s2)
-{
-	/*
-	 * UTF-8 has the nice property that lexicographic ordering on bytes is
-	 * the same as the lexicographic ordering of the character sequences.
-	 */
-	while (*s1 == *s2 && *s1 != 0) {
-		s1++;
-		s2++;
-	}
-
-	if (*s1 == *s2)
-		return 0;
-
-	return (*s1 < *s2) ? -1 : 1;
-}
-
-/** Compare two NULL terminated strings with length limit.
- *
- * Do a char-by-char comparison of two NULL-terminated strings.
- * The strings are considered equal iff
- * min(str_length(s1), max_len) == min(str_length(s2), max_len)
- * and both strings consist of the same sequence of characters,
- * up to max_len characters.
- *
- * A string S1 is less than another string S2 if it has a character with
- * lower value at the first character position where the strings differ.
- * If the strings differ in length, the shorter one is treated as if
- * padded by characters with a value of zero. Only the first max_len
- * characters are considered.
- *
- * @param s1      First string to compare.
- * @param s2      Second string to compare.
- * @param max_len Maximum number of characters to consider.
- *
- * @return 0 if the strings are equal, -1 if the first is less than the second,
- *         1 if the second is less than the first.
- *
- */
-int str_lcmp(const char *s1, const char *s2, size_t max_len)
-{
-	char32_t c1 = 0;
-	char32_t c2 = 0;
-
-	size_t off1 = 0;
-	size_t off2 = 0;
-
-	size_t len = 0;
-
-	while (true) {
-		if (len >= max_len)
-			break;
-
-		c1 = str_decode(s1, &off1, STR_NO_LIMIT);
-		c2 = str_decode(s2, &off2, STR_NO_LIMIT);
-
-		if (c1 < c2)
-			return -1;
-
-		if (c1 > c2)
-			return 1;
-
-		if (c1 == 0 || c2 == 0)
-			break;
-
-		++len;
-	}
-
-	return 0;
-
-}
-
-/** Compare two NULL terminated strings in case-insensitive manner.
- *
- * Do a char-by-char comparison of two NULL-terminated strings.
- * The strings are considered equal iff their length is equal
- * and both strings consist of the same sequence of characters
- * when converted to lower case.
- *
- * A string S1 is less than another string S2 if it has a character with
- * lower value at the first character position where the strings differ.
- * If the strings differ in length, the shorter one is treated as if
- * padded by characters with a value of zero.
- *
- * @param s1 First string to compare.
- * @param s2 Second string to compare.
- *
- * @return 0 if the strings are equal, -1 if the first is less than the second,
- *         1 if the second is less than the first.
- *
- */
-int str_casecmp(const char *s1, const char *s2)
-{
-	// FIXME: doesn't work for non-ASCII caseful characters
-
-	char32_t c1 = 0;
-	char32_t c2 = 0;
-
-	size_t off1 = 0;
-	size_t off2 = 0;
-
-	while (true) {
-		c1 = tolower(str_decode(s1, &off1, STR_NO_LIMIT));
-		c2 = tolower(str_decode(s2, &off2, STR_NO_LIMIT));
-
-		if (c1 < c2)
-			return -1;
-
-		if (c1 > c2)
-			return 1;
-
-		if (c1 == 0 || c2 == 0)
-			break;
-	}
-
-	return 0;
-}
-
-/** Compare two NULL terminated strings with length limit in case-insensitive
- * manner.
- *
- * Do a char-by-char comparison of two NULL-terminated strings.
- * The strings are considered equal iff
- * min(str_length(s1), max_len) == min(str_length(s2), max_len)
- * and both strings consist of the same sequence of characters,
- * up to max_len characters.
- *
- * A string S1 is less than another string S2 if it has a character with
- * lower value at the first character position where the strings differ.
- * If the strings differ in length, the shorter one is treated as if
- * padded by characters with a value of zero. Only the first max_len
- * characters are considered.
- *
- * @param s1      First string to compare.
- * @param s2      Second string to compare.
- * @param max_len Maximum number of characters to consider.
- *
- * @return 0 if the strings are equal, -1 if the first is less than the second,
- *         1 if the second is less than the first.
- *
- */
-int str_lcasecmp(const char *s1, const char *s2, size_t max_len)
-{
-	// FIXME: doesn't work for non-ASCII caseful characters
-
-	char32_t c1 = 0;
-	char32_t c2 = 0;
-
-	size_t off1 = 0;
-	size_t off2 = 0;
-
-	size_t len = 0;
-
-	while (true) {
-		if (len >= max_len)
-			break;
-
-		c1 = tolower(str_decode(s1, &off1, STR_NO_LIMIT));
-		c2 = tolower(str_decode(s2, &off2, STR_NO_LIMIT));
-
-		if (c1 < c2)
-			return -1;
-
-		if (c1 > c2)
-			return 1;
-
-		if (c1 == 0 || c2 == 0)
-			break;
-
-		++len;
-	}
-
-	return 0;
-
-}
-
-static bool _test_prefix(const char *s, const char *p)
-{
-	while (*s == *p && *s != 0) {
-		s++;
-		p++;
-	}
-
-	return *p == 0;
-}
-
-/** Test whether p is a prefix of s.
- *
- * Do a char-by-char comparison of two NULL-terminated strings
- * and determine if p is a prefix of s.
- *
- * @param s The string in which to look
- * @param p The string to check if it is a prefix of s
- *
- * @return true iff p is prefix of s else false
- *
- */
-bool str_test_prefix(const char *s, const char *p)
-{
-	return _test_prefix(s, p);
-}
-
-/** Get a string suffix.
- *
- * Return a string suffix defined by the prefix length.
- *
- * @param s             The string to get the suffix from.
- * @param prefix_length Number of prefix characters to ignore.
- *
- * @return String suffix.
- *
- */
-const char *str_suffix(const char *s, size_t prefix_length)
-{
-	size_t off = 0;
-	size_t i = 0;
-
-	while (true) {
-		str_decode(s, &off, STR_NO_LIMIT);
-		i++;
-
-		if (i >= prefix_length)
-			break;
-	}
-
-	return s + off;
-}
-
-/** Copy string as a sequence of bytes. */
-static void _str_cpy(char *dest, const char *src)
-{
-	while (*src)
-		*(dest++) = *(src++);
-
-	*dest = 0;
-}
-
-/** Copy string as a sequence of bytes. */
-static void _str_cpyn(char *dest, size_t size, const char *src)
-{
-	assert(dest && src && size);
-
-	if (!dest || !src || !size)
-		return;
-
-	if (size == STR_NO_LIMIT)
-		return _str_cpy(dest, src);
-
-	char *dest_top = dest + size - 1;
-	assert(size == 1 || dest < dest_top);
-
-	while (*src && dest < dest_top)
-		*(dest++) = *(src++);
-
-	*dest = 0;
-}
-
-/** Copy string.
- *
- * Copy source string @a src to destination buffer @a dest.
- * No more than @a size bytes are written. If the size of the output buffer
- * is at least one byte, the output string will always be well-formed, i.e.
- * null-terminated and containing only complete characters.
- *
- * @param dest  Destination buffer.
- * @param count Size of the destination buffer (must be > 0).
- * @param src   Source string.
- *
- */
-void str_cpy(char *dest, size_t size, const char *src)
-{
-	/* There must be space for a null terminator in the buffer. */
-	assert(size > 0);
-	assert(src != NULL);
-	assert(dest != NULL);
-	assert(size == STR_NO_LIMIT || dest + size > dest);
-
-	/* Copy data. */
-	_str_cpyn(dest, size, src);
-
-	/* In-place translate invalid bytes to U_SPECIAL. */
-	_str_sanitize(dest, size, U_SPECIAL);
-}
-
-/** Copy size-limited substring.
- *
- * Copy prefix of string @a src of max. size @a size to destination buffer
- * @a dest. No more than @a size bytes are written. The output string will
- * always be well-formed, i.e. null-terminated and containing only complete
- * characters.
- *
- * No more than @a n bytes are read from the input string, so it does not
- * have to be null-terminated.
- *
- * @param dest  Destination buffer.
- * @param count Size of the destination buffer (must be > 0).
- * @param src   Source string.
- * @param n     Maximum number of bytes to read from @a src.
- *
- */
-void str_ncpy(char *dest, size_t size, const char *src, size_t n)
-{
-	/* There must be space for a null terminator in the buffer. */
-	assert(size > 0);
-	assert(src != NULL);
-
-	/* Copy data. */
-	_str_cpyn(dest, min(size, n + 1), src);
-
-	/* In-place translate invalid bytes to U_SPECIAL. */
-	_str_sanitize(dest, size, U_SPECIAL);
-}
-
-/** Append one string to another.
- *
- * Append source string @a src to string in destination buffer @a dest.
- * Size of the destination buffer is @a dest. If the size of the output buffer
- * is at least one byte, the output string will always be well-formed, i.e.
- * null-terminated and containing only complete characters.
- *
- * @param dest   Destination buffer.
- * @param count Size of the destination buffer.
- * @param src   Source string.
- */
-void str_append(char *dest, size_t size, const char *src)
-{
-	assert(src != NULL);
-	assert(dest != NULL);
-	assert(size > 0);
-	assert(size == STR_NO_LIMIT || dest + size > dest);
-
-	size_t dstr_size = _str_nsize(dest, size);
-	if (dstr_size < size) {
-		_str_cpyn(dest + dstr_size, size - dstr_size, src);
-		_str_sanitize(dest + dstr_size, size - dstr_size, U_SPECIAL);
-	}
-}
-
-/** Convert space-padded ASCII to string.
- *
- * Common legacy text encoding in hardware is 7-bit ASCII fitted into
- * a fixed-width byte buffer (bit 7 always zero), right-padded with spaces
- * (ASCII 0x20). Convert space-padded ascii to string representation.
- *
- * If the text does not fit into the destination buffer, the function converts
- * as many characters as possible and returns EOVERFLOW.
- *
- * If the text contains non-ASCII bytes (with bit 7 set), the whole string is
- * converted anyway and invalid characters are replaced with question marks
- * (U_SPECIAL) and the function returns EIO.
- *
- * Regardless of return value upon return @a dest will always be well-formed.
- *
- * @param dest		Destination buffer
- * @param size		Size of destination buffer
- * @param src		Space-padded ASCII.
- * @param n		Size of the source buffer in bytes.
- *
- * @return		EOK on success, EOVERFLOW if the text does not fit
- *			destination buffer, EIO if the text contains
- *			non-ASCII bytes.
- */
-errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n)
-{
-	size_t len = 0;
-
-	/* Determine the length of the source string. */
-	for (size_t i = 0; i < n; i++) {
-		if (src[i] == 0)
-			break;
-
-		if (src[i] != ' ')
-			len = i + 1;
-	}
-
-	errno_t result = EOK;
-	size_t out_len = min(len, size - 1);
-
-	/* Copy characters */
-	for (size_t i = 0; i < out_len; i++) {
-		dest[i] = src[i];
-
-		if (dest[i] < 0) {
-			dest[i] = U_SPECIAL;
-			result = EIO;
-		}
-	}
-
-	dest[out_len] = 0;
-
-	if (out_len < len)
-		return EOVERFLOW;
-
-	return result;
-}
-
-/** Convert wide string to string.
- *
- * Convert wide string @a src to string. The output is written to the buffer
- * specified by @a dest and @a size. @a size must be non-zero and the string
- * written will always be well-formed.
- *
- * @param dest	Destination buffer.
- * @param size	Size of the destination buffer.
- * @param src	Source wide string.
- */
-void wstr_to_str(char *dest, size_t size, const char32_t *src)
-{
-	char32_t ch;
-	size_t src_idx;
-	size_t dest_off;
-
-	/* There must be space for a null terminator in the buffer. */
-	assert(size > 0);
-
-	src_idx = 0;
-	dest_off = 0;
-
-	while ((ch = src[src_idx++]) != 0) {
-		if (chr_encode(ch, dest, &dest_off, size - 1) != EOK)
-			break;
-	}
-
-	dest[dest_off] = '\0';
-}
-
-/** Convert UTF16 string to string.
- *
- * Convert utf16 string @a src to string. The output is written to the buffer
- * specified by @a dest and @a size. @a size must be non-zero and the string
- * written will always be well-formed. Surrogate pairs also supported.
- *
- * @param dest	Destination buffer.
- * @param size	Size of the destination buffer.
- * @param src	Source utf16 string.
- *
- * @return EOK, if success, an error code otherwise.
- */
-errno_t utf16_to_str(char *dest, size_t size, const uint16_t *src)
-{
-	size_t idx = 0, dest_off = 0;
-	char32_t ch;
-	errno_t rc = EOK;
-
-	/* There must be space for a null terminator in the buffer. */
-	assert(size > 0);
-
-	while (src[idx]) {
-		if ((src[idx] & 0xfc00) == 0xd800) {
-			if (src[idx + 1] && (src[idx + 1] & 0xfc00) == 0xdc00) {
-				ch = 0x10000;
-				ch += (src[idx] & 0x03FF) << 10;
-				ch += (src[idx + 1] & 0x03FF);
-				idx += 2;
-			} else
-				break;
-		} else {
-			ch = src[idx];
-			idx++;
-		}
-		rc = chr_encode(ch, dest, &dest_off, size - 1);
-		if (rc != EOK)
-			break;
-	}
-	dest[dest_off] = '\0';
-	return rc;
-}
-
-/** Convert string to UTF16 string.
- *
- * Convert string @a src to utf16 string. The output is written to the buffer
- * specified by @a dest and @a dlen. @a dlen must be non-zero and the string
- * written will always be well-formed. Surrogate pairs also supported.
- *
- * @param dest	Destination buffer.
- * @param dlen	Number of utf16 characters that fit in the destination buffer.
- * @param src	Source string.
- *
- * @return EOK, if success, an error code otherwise.
- */
-errno_t str_to_utf16(uint16_t *dest, size_t dlen, const char *src)
-{
-	errno_t rc = EOK;
-	size_t offset = 0;
-	size_t idx = 0;
-	char32_t c;
-
-	assert(dlen > 0);
-
-	while ((c = str_decode(src, &offset, STR_NO_LIMIT)) != 0) {
-		if (c > 0x10000) {
-			if (idx + 2 >= dlen - 1) {
-				rc = EOVERFLOW;
-				break;
-			}
-			c = (c - 0x10000);
-			dest[idx] = 0xD800 | (c >> 10);
-			dest[idx + 1] = 0xDC00 | (c & 0x3FF);
-			idx++;
-		} else {
-			dest[idx] = c;
-		}
-
-		idx++;
-		if (idx >= dlen - 1) {
-			rc = EOVERFLOW;
-			break;
-		}
-	}
-
-	dest[idx] = '\0';
-	return rc;
-}
-
-/** Get size of UTF-16 string.
- *
- * Get the number of words which are used by the UTF-16 string @a ustr
- * (excluding the NULL-terminator).
- *
- * @param ustr UTF-16 string to consider.
- *
- * @return Number of words used by the UTF-16 string
- *
- */
-size_t utf16_wsize(const uint16_t *ustr)
-{
-	size_t wsize = 0;
-
-	while (*ustr++ != 0)
-		wsize++;
-
-	return wsize;
-}
-
-/** Convert wide string to new string.
- *
- * Convert wide string @a src to string. Space for the new string is allocated
- * on the heap.
- *
- * @param src	Source wide string.
- * @return	New string.
- */
-char *wstr_to_astr(const char32_t *src)
-{
-	char dbuf[STR_BOUNDS(1)];
-	char *str;
-	char32_t ch;
-
-	size_t src_idx;
-	size_t dest_off;
-	size_t dest_size;
-
-	/* Compute size of encoded string. */
-
-	src_idx = 0;
-	dest_size = 0;
-
-	while ((ch = src[src_idx++]) != 0) {
-		dest_off = 0;
-		if (chr_encode(ch, dbuf, &dest_off, STR_BOUNDS(1)) != EOK)
-			break;
-		dest_size += dest_off;
-	}
-
-	str = malloc(dest_size + 1);
-	if (str == NULL)
-		return NULL;
-
-	/* Encode string. */
-
-	src_idx = 0;
-	dest_off = 0;
-
-	while ((ch = src[src_idx++]) != 0) {
-		if (chr_encode(ch, str, &dest_off, dest_size) != EOK)
-			break;
-	}
-
-	str[dest_size] = '\0';
-	return str;
-}
-
-/** Convert string to wide string.
- *
- * Convert string @a src to wide string. The output is written to the
- * buffer specified by @a dest and @a dlen. @a dlen must be non-zero
- * and the wide string written will always be null-terminated.
- *
- * @param dest	Destination buffer.
- * @param dlen	Length of destination buffer (number of wchars).
- * @param src	Source string.
- */
-void str_to_wstr(char32_t *dest, size_t dlen, const char *src)
-{
-	size_t offset;
-	size_t di;
-	char32_t c;
-
-	assert(dlen > 0);
-
-	offset = 0;
-	di = 0;
-
-	do {
-		if (di >= dlen - 1)
-			break;
-
-		c = str_decode(src, &offset, STR_NO_LIMIT);
-		dest[di++] = c;
-	} while (c != '\0');
-
-	dest[dlen - 1] = '\0';
-}
-
-/** Convert string to wide string.
- *
- * Convert string @a src to wide string. A new wide NULL-terminated
- * string will be allocated on the heap.
- *
- * @param src	Source string.
- */
-char32_t *str_to_awstr(const char *str)
-{
-	size_t len = str_length(str);
-
-	char32_t *wstr = calloc(len + 1, sizeof(char32_t));
-	if (wstr == NULL)
-		return NULL;
-
-	str_to_wstr(wstr, len + 1, str);
-	return wstr;
-}
-
-static char *_strchr(const char *str, char c)
-{
-	while (*str != 0 && *str != c)
-		str++;
-
-	return (*str == c) ? (char *) str : NULL;
-}
-
-/** Find first occurence of character in string.
- *
- * @param str String to search.
- * @param ch  Character to look for.
- *
- * @return Pointer to character in @a str or NULL if not found.
- */
-char *str_chr(const char *str, char32_t ch)
-{
-	/* Fast path for an ASCII character. */
-	if (ascii_check(ch))
-		return _strchr(str, ch);
-
-	/* Convert character to UTF-8. */
-	char utf8[STR_BOUNDS(1) + 1];
-	size_t offset = 0;
-
-	if (chr_encode(ch, utf8, &offset, sizeof(utf8)) != EOK || offset == 0)
-		return NULL;
-
-	utf8[offset] = '\0';
-
-	/* Find the first byte, then check if all of them are correct. */
-	while (*str != 0) {
-		str = _strchr(str, utf8[0]);
-		if (!str)
-			return NULL;
-
-		if (_test_prefix(str, utf8))
-			return (char *) str;
-
-		str++;
-	}
-
-	return NULL;
-}
-
-/** Find first occurence of substring in string.
- *
- * @param hs  Haystack (string)
- * @param n   Needle (substring to look for)
- *
- * @return Pointer to character in @a hs or @c NULL if not found.
- */
-char *str_str(const char *hs, const char *n)
-{
-	size_t hsize = _str_size(hs);
-	size_t nsize = _str_size(n);
-
-	while (hsize >= nsize) {
-		if (_test_prefix(hs, n))
-			return (char *) hs;
-
-		hs++;
-		hsize--;
-	}
-
-	return NULL;
-}
-
-static void _str_rtrim(char *str, char c)
-{
-	char *last = str;
-
-	while (*str) {
-		if (*str != c)
-			last = str;
-
-		str++;
-	}
-
-	/* Truncate string. */
-	last[1] = 0;
-}
-
-/** Removes specified trailing characters from a string.
- *
- * @param str String to remove from.
- * @param ch  Character to remove.
- */
-void str_rtrim(char *str, char32_t ch)
-{
-	/* Fast path for the ASCII case. */
-	if (ascii_check(ch)) {
-		_str_rtrim(str, ch);
-		return;
-	}
-
-	size_t off = 0;
-	size_t pos = 0;
-	char32_t c;
-	bool update_last_chunk = true;
-	char *last_chunk = NULL;
-
-	while ((c = str_decode(str, &off, STR_NO_LIMIT))) {
-		if (c != ch) {
-			update_last_chunk = true;
-			last_chunk = NULL;
-		} else if (update_last_chunk) {
-			update_last_chunk = false;
-			last_chunk = (str + pos);
-		}
-		pos = off;
-	}
-
-	if (last_chunk)
-		*last_chunk = '\0';
-}
-
-static void _str_ltrim(char *str, char c)
-{
-	char *p = str;
-
-	while (*p == c)
-		p++;
-
-	if (str != p)
-		_str_cpy(str, p);
-}
-
-/** Removes specified leading characters from a string.
- *
- * @param str String to remove from.
- * @param ch  Character to remove.
- */
-void str_ltrim(char *str, char32_t ch)
-{
-	/* Fast path for the ASCII case. */
-	if (ascii_check(ch)) {
-		_str_ltrim(str, ch);
-		return;
-	}
-
-	char32_t acc;
-	size_t off = 0;
-	size_t pos = 0;
-	size_t str_sz = str_size(str);
-
-	while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) {
-		if (acc != ch)
-			break;
-		else
-			pos = off;
-	}
-
-	if (pos > 0) {
-		memmove(str, &str[pos], str_sz - pos);
-		pos = str_sz - pos;
-		str[pos] = '\0';
-	}
-}
-
-static char *_str_rchr(const char *str, char c)
-{
-	const char *last = NULL;
-
-	while (*str) {
-		if (*str == c)
-			last = str;
-
-		str++;
-	}
-
-	return (char *) last;
-}
-
-/** Find last occurence of character in string.
- *
- * @param str String to search.
- * @param ch  Character to look for.
- *
- * @return Pointer to character in @a str or NULL if not found.
- */
-char *str_rchr(const char *str, char32_t ch)
-{
-	if (ascii_check(ch))
-		return _str_rchr(str, ch);
-
-	char32_t acc;
-	size_t off = 0;
-	size_t last = 0;
-	const char *res = NULL;
-
-	while ((acc = str_decode(str, &off, STR_NO_LIMIT)) != 0) {
-		if (acc == ch)
-			res = (str + last);
-		last = off;
-	}
-
-	return (char *) res;
-}
-
-/** Insert a wide character into a wide string.
- *
- * Insert a wide character into a wide string at position
- * @a pos. The characters after the position are shifted.
- *
- * @param str     String to insert to.
- * @param ch      Character to insert to.
- * @param pos     Character index where to insert.
- * @param max_pos Characters in the buffer.
- *
- * @return True if the insertion was sucessful, false if the position
- *         is out of bounds.
- *
- */
-bool wstr_linsert(char32_t *str, char32_t ch, size_t pos, size_t max_pos)
-{
-	size_t len = wstr_length(str);
-
-	if ((pos > len) || (pos + 1 > max_pos))
-		return false;
-
-	size_t i;
-	for (i = len; i + 1 > pos; i--)
-		str[i + 1] = str[i];
-
-	str[pos] = ch;
-
-	return true;
-}
-
-/** Remove a wide character from a wide string.
- *
- * Remove a wide character from a wide string at position
- * @a pos. The characters after the position are shifted.
- *
- * @param str String to remove from.
- * @param pos Character index to remove.
- *
- * @return True if the removal was sucessful, false if the position
- *         is out of bounds.
- *
- */
-bool wstr_remove(char32_t *str, size_t pos)
-{
-	size_t len = wstr_length(str);
-
-	if (pos >= len)
-		return false;
-
-	size_t i;
-	for (i = pos + 1; i <= len; i++)
-		str[i - 1] = str[i];
-
-	return true;
-}
-
-/** Duplicate string.
- *
- * Allocate a new string and copy characters from the source
- * string into it. The duplicate string is allocated via sleeping
- * malloc(), thus this function can sleep in no memory conditions.
- *
- * The allocation cannot fail and the return value is always
- * a valid pointer. The duplicate string is always a well-formed
- * null-terminated UTF-8 string, but it can differ from the source
- * string on the byte level.
- *
- * @param src Source string.
- *
- * @return Duplicate string.
- *
- */
-char *str_dup(const char *src)
-{
-	size_t size = _str_size(src) + 1;
-	char *dest = malloc(size);
-	if (!dest)
-		return NULL;
-
-	memcpy(dest, src, size);
-	_str_sanitize(dest, size, U_SPECIAL);
-	return dest;
-}
-
-/** Duplicate string with size limit.
- *
- * Allocate a new string and copy up to @max_size bytes from the source
- * string into it. The duplicate string is allocated via sleeping
- * malloc(), thus this function can sleep in no memory conditions.
- * No more than @max_size + 1 bytes is allocated, but if the size
- * occupied by the source string is smaller than @max_size + 1,
- * less is allocated.
- *
- * The allocation cannot fail and the return value is always
- * a valid pointer. The duplicate string is always a well-formed
- * null-terminated UTF-8 string, but it can differ from the source
- * string on the byte level.
- *
- * @param src Source string.
- * @param n   Maximum number of bytes to duplicate.
- *
- * @return Duplicate string.
- *
- */
-char *str_ndup(const char *src, size_t n)
-{
-	size_t size = _str_nsize(src, n);
-
-	char *dest = malloc(size + 1);
-	if (!dest)
-		return NULL;
-
-	memcpy(dest, src, size);
-	_str_sanitize(dest, size, U_SPECIAL);
-	dest[size] = 0;
-	return dest;
-}
-
-/** Split string by delimiters.
- *
- * @param s             String to be tokenized. May not be NULL.
- * @param delim		String with the delimiters.
- * @param next		Variable which will receive the pointer to the
- *                      continuation of the string following the first
- *                      occurrence of any of the delimiter characters.
- *                      May be NULL.
- * @return              Pointer to the prefix of @a s before the first
- *                      delimiter character. NULL if no such prefix
- *                      exists.
- */
-char *str_tok(char *s, const char *delim, char **next)
-{
-	char *start, *end;
-
-	if (!s)
-		return NULL;
-
-	size_t len = str_size(s);
-	size_t cur;
-	size_t tmp;
-	char32_t ch;
-
-	/* Skip over leading delimiters. */
-	tmp = 0;
-	cur = 0;
-	while ((ch = str_decode(s, &tmp, len)) && str_chr(delim, ch))
-		cur = tmp;
-	start = &s[cur];
-
-	/* Skip over token characters. */
-	tmp = cur;
-	while ((ch = str_decode(s, &tmp, len)) && !str_chr(delim, ch))
-		cur = tmp;
-	end = &s[cur];
-	if (next)
-		*next = (ch ? &s[tmp] : &s[cur]);
-
-	if (start == end)
-		return NULL;	/* No more tokens. */
-
-	/* Overwrite delimiter with NULL terminator. */
-	*end = '\0';
-	return start;
-}
-
-void order_suffix(const uint64_t val, uint64_t *rv, char *suffix)
-{
-	if (val > UINT64_C(10000000000000000000)) {
-		*rv = val / UINT64_C(1000000000000000000);
-		*suffix = 'Z';
-	} else if (val > UINT64_C(1000000000000000000)) {
-		*rv = val / UINT64_C(1000000000000000);
-		*suffix = 'E';
-	} else if (val > UINT64_C(1000000000000000)) {
-		*rv = val / UINT64_C(1000000000000);
-		*suffix = 'T';
-	} else if (val > UINT64_C(1000000000000)) {
-		*rv = val / UINT64_C(1000000000);
-		*suffix = 'G';
-	} else if (val > UINT64_C(1000000000)) {
-		*rv = val / UINT64_C(1000000);
-		*suffix = 'M';
-	} else if (val > UINT64_C(1000000)) {
-		*rv = val / UINT64_C(1000);
-		*suffix = 'k';
-	} else {
-		*rv = val;
-		*suffix = ' ';
-	}
-}
-
-void bin_order_suffix(const uint64_t val, uint64_t *rv, const char **suffix,
-    bool fixed)
-{
-	if (val > UINT64_C(1152921504606846976)) {
-		*rv = val / UINT64_C(1125899906842624);
-		*suffix = "EiB";
-	} else if (val > UINT64_C(1125899906842624)) {
-		*rv = val / UINT64_C(1099511627776);
-		*suffix = "TiB";
-	} else if (val > UINT64_C(1099511627776)) {
-		*rv = val / UINT64_C(1073741824);
-		*suffix = "GiB";
-	} else if (val > UINT64_C(1073741824)) {
-		*rv = val / UINT64_C(1048576);
-		*suffix = "MiB";
-	} else if (val > UINT64_C(1048576)) {
-		*rv = val / UINT64_C(1024);
-		*suffix = "KiB";
-	} else {
-		*rv = val;
-		if (fixed)
-			*suffix = "B  ";
-		else
-			*suffix = "B";
-	}
-}
-
-/** @}
- */
Index: mmon/str_error.c
===================================================================
--- common/str_error.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * Copyright (c) 2017 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <str_error.h>
-
-#include <errno.h>
-#include <stddef.h>
-
-
-/*
- * The arrays below are automatically generated from the same file that
- * errno.h constants are generated from. Triple-include of the same list
- * with redefinitions of __errno() macro are used to ensure that the
- * information cannot get out of synch. This is inpired by musl libc.
- */
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) name,
-
-static const errno_t err_num[] = {
-#include <abi/errno.in>
-};
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) #name,
-
-static const char *err_name[] = {
-#include <abi/errno.in>
-};
-
-#undef __errno_entry
-#define __errno_entry(name, num, desc) "[" #name "] " desc,
-
-static const char *err_desc[] = {
-#include <abi/errno.in>
-};
-
-/* Returns index corresponding to the given errno, or -1 if not found. */
-static int find_errno(errno_t e)
-{
-	/*
-	 * Just a dumb linear search.
-	 * There are too few entries to warrant anything smarter.
-	 */
-
-	int len = sizeof(err_num) / sizeof(errno_t);
-
-	for (int i = 0; i < len; i++) {
-		if (err_num[i] == e) {
-			return i;
-		}
-	}
-
-	return -1;
-}
-
-const char *str_error_name(errno_t e)
-{
-	int i = find_errno(e);
-
-	if (i >= 0) {
-		return err_name[i];
-	}
-
-	return NULL;
-}
-
-const char *str_error(errno_t e)
-{
-	int i = find_errno(e);
-
-	if (i >= 0) {
-		return err_desc[i];
-	}
-
-	return NULL;
-}
Index: mmon/strtol.c
===================================================================
--- common/strtol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,562 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2008 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2011 Oleg Romanenko
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-
-// FIXME: The original HelenOS functions return EOVERFLOW instead
-//        of ERANGE. It's a pointless distinction from standard functions,
-//        so we should change that. Beware the callers though.
-
-// TODO: more unit tests
-
-static inline int _digit_value(int c)
-{
-	if (isdigit(c)) {
-		return c - '0';
-	} else if (islower(c)) {
-		return c - 'a' + 10;
-	} else if (isupper(c)) {
-		return c - 'A' + 10;
-	}
-	return INT_MAX;
-}
-
-/*
- * FIXME: workaround for GCC "optimizing" the overflow check
- * into soft-emulated 128b multiplication using `__multi3`,
- * which we don't currently implement.
- */
-__attribute__((noinline)) static uintmax_t _max_value(int base)
-{
-	return UINTMAX_MAX / base;
-}
-
-static inline int _prefixbase(const char *restrict *nptrptr, bool nonstd)
-{
-	const char *nptr = *nptrptr;
-
-	if (nptr[0] != '0')
-		return 10;
-
-	if (nptr[1] == 'x' || nptr[1] == 'X') {
-		if (_digit_value(nptr[2]) < 16) {
-			*nptrptr += 2;
-			return 16;
-		}
-	}
-
-	if (nonstd) {
-		switch (nptr[1]) {
-		case 'b':
-		case 'B':
-			if (_digit_value(nptr[2]) < 2) {
-				*nptrptr += 2;
-				return 2;
-			}
-			break;
-		case 'o':
-		case 'O':
-			if (_digit_value(nptr[2]) < 8) {
-				*nptrptr += 2;
-				return 8;
-			}
-			break;
-		case 'd':
-		case 'D':
-		case 't':
-		case 'T':
-			if (_digit_value(nptr[2]) < 10) {
-				*nptrptr += 2;
-				return 10;
-			}
-			break;
-		}
-	}
-
-	return 8;
-}
-
-static inline uintmax_t _strtoumax(
-    const char *restrict nptr, char **restrict endptr, int base,
-    bool *restrict sgn, errno_t *err, bool nonstd)
-{
-	assert(nptr != NULL);
-	assert(sgn != NULL);
-
-	const char *first = nptr;
-
-	/* Skip leading whitespace. */
-
-	while (isspace(*nptr)) {
-		nptr++;
-	}
-
-	/* Parse sign, if any. */
-
-	switch (*nptr) {
-	case '-':
-		*sgn = true;
-		nptr++;
-		break;
-	case '+':
-		nptr++;
-		break;
-	}
-
-	/* Figure out the base. */
-
-	if (base == 0)
-		base = _prefixbase(&nptr, nonstd);
-
-	if (base == 16 && !nonstd) {
-		/*
-		 * Standard strto* functions allow hexadecimal prefix to be
-		 * present when base is explicitly set to 16.
-		 * Our nonstandard str_* functions don't allow it.
-		 * I don't know if that is intended, just matching the original
-		 * functionality here.
-		 */
-
-		if (nptr[0] == '0' && (nptr[1] == 'x' || nptr[1] == 'X') &&
-		    _digit_value(nptr[2]) < base)
-			nptr += 2;
-	}
-
-	if (base < 2 || base > 36) {
-		*err = EINVAL;
-		return 0;
-	}
-
-	/* Must be at least one digit. */
-
-	if (_digit_value(*nptr) >= base) {
-		/* No digits on input. */
-		if (endptr != NULL)
-			*endptr = (char *) first;
-		return 0;
-	}
-
-	/* Read the value.  */
-
-	uintmax_t result = 0;
-	uintmax_t max = _max_value(base);
-	int digit;
-
-	while (digit = _digit_value(*nptr), digit < base) {
-		if (result > max ||
-		    __builtin_add_overflow(result * base, digit, &result)) {
-
-			*err = nonstd ? EOVERFLOW : ERANGE;
-			result = UINTMAX_MAX;
-			break;
-		}
-
-		nptr++;
-	}
-
-	/* Set endptr. */
-
-	if (endptr != NULL) {
-		/*
-		 * Move the pointer to the end of the number,
-		 * in case it isn't there already.
-		 * This can happen when the number has legal formatting,
-		 * but is out of range of the target type.
-		 */
-		while (_digit_value(*nptr) < base) {
-			nptr++;
-		}
-
-		*endptr = (char *) nptr;
-	}
-
-	return result;
-}
-
-static inline intmax_t _strtosigned(const char *nptr, char **endptr, int base,
-    intmax_t min, intmax_t max, errno_t *err, bool nonstd)
-{
-	bool sgn = false;
-	uintmax_t number = _strtoumax(nptr, endptr, base, &sgn, err, nonstd);
-
-	if (number > (uintmax_t) max) {
-		if (sgn && (number - 1 == (uintmax_t) max)) {
-			return min;
-		}
-
-		*err = nonstd ? EOVERFLOW : ERANGE;
-		return (sgn ? min : max);
-	}
-
-	return (sgn ? -number : number);
-}
-
-static inline uintmax_t _strtounsigned(const char *nptr, char **endptr, int base,
-    uintmax_t max, errno_t *err, bool nonstd)
-{
-	bool sgn = false;
-	uintmax_t number = _strtoumax(nptr, endptr, base, &sgn, err, nonstd);
-
-	if (nonstd && sgn) {
-		/* Do not allow negative values */
-		*err = EINVAL;
-		return 0;
-	}
-
-	if (number > max) {
-		*err = nonstd ? EOVERFLOW : ERANGE;
-		return max;
-	}
-
-	return (sgn ? -number : number);
-}
-
-/** Convert initial part of string to long int according to given base.
- * The number may begin with an arbitrary number of whitespaces followed by
- * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
- * inserted and the number will be taken as hexadecimal one. If the base is 0
- * and the number begin with a zero, number will be taken as octal one (as with
- * base 8). Otherwise the base 0 is taken as decimal.
- *
- * @param nptr		Pointer to string.
- * @param[out] endptr	If not NULL, function stores here pointer to the first
- * 			invalid character.
- * @param base		Zero or number between 2 and 36 inclusive.
- * @return		Result of conversion.
- */
-long strtol(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtosigned(nptr, endptr, base, LONG_MIN, LONG_MAX, &errno, false);
-}
-
-/** Convert initial part of string to unsigned long according to given base.
- * The number may begin with an arbitrary number of whitespaces followed by
- * optional sign (`+' or `-'). If the base is 0 or 16, the prefix `0x' may be
- * inserted and the number will be taken as hexadecimal one. If the base is 0
- * and the number begin with a zero, number will be taken as octal one (as with
- * base 8). Otherwise the base 0 is taken as decimal.
- *
- * @param nptr		Pointer to string.
- * @param[out] endptr	If not NULL, function stores here pointer to the first
- * 			invalid character
- * @param base		Zero or number between 2 and 36 inclusive.
- * @return		Result of conversion.
- */
-unsigned long strtoul(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtounsigned(nptr, endptr, base, ULONG_MAX, &errno, false);
-}
-
-long long strtoll(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtosigned(nptr, endptr, base, LLONG_MIN, LLONG_MAX, &errno, false);
-}
-
-unsigned long long strtoull(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtounsigned(nptr, endptr, base, ULLONG_MAX, &errno, false);
-}
-
-intmax_t strtoimax(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtosigned(nptr, endptr, base, INTMAX_MIN, INTMAX_MAX, &errno, false);
-}
-
-uintmax_t strtoumax(const char *nptr, char **endptr, int base)
-{
-#if !__STDC_HOSTED__
-	errno_t errno;
-#endif
-
-	return _strtounsigned(nptr, endptr, base, UINTMAX_MAX, &errno, false);
-}
-
-int atoi(const char *nptr)
-{
-	return (int)strtol(nptr, NULL, 10);
-}
-
-long atol(const char *nptr)
-{
-	return strtol(nptr, NULL, 10);
-}
-
-long long atoll(const char *nptr)
-{
-	return strtoll(nptr, NULL, 10);
-}
-
-/** Convert string to uint8_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_uint8_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, uint8_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	uintmax_t r = _strtounsigned(nptr, &lendptr, base, UINT8_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** Convert string to uint16_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_uint16_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, uint16_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	uintmax_t r = _strtounsigned(nptr, &lendptr, base, UINT16_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** Convert string to uint32_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_uint32_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, uint32_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	uintmax_t r = _strtounsigned(nptr, &lendptr, base, UINT32_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** Convert string to uint64_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_uint64_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, uint64_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	uintmax_t r = _strtounsigned(nptr, &lendptr, base, UINT64_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** Convert string to int64_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_int64_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, int64_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	intmax_t r = _strtosigned(nptr, &lendptr, base, INT64_MIN, INT64_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** Convert string to size_t.
- *
- * @param nptr   Pointer to string.
- * @param endptr If not NULL, pointer to the first invalid character
- *               is stored here.
- * @param base   Zero or number between 2 and 36 inclusive.
- * @param strict Do not allow any trailing characters.
- * @param result Result of the conversion.
- *
- * @return EOK if conversion was successful.
- *
- */
-errno_t str_size_t(const char *nptr, const char **endptr, unsigned int base,
-    bool strict, size_t *result)
-{
-	assert(result != NULL);
-
-	errno_t rc = EOK;
-	char *lendptr = (char *) nptr;
-
-	uintmax_t r = _strtounsigned(nptr, &lendptr, base, SIZE_MAX, &rc, true);
-
-	if (endptr)
-		*endptr = lendptr;
-
-	if (rc != EOK)
-		return rc;
-
-	if (strict && *lendptr != '\0')
-		return EINVAL;
-
-	*result = r;
-	return EOK;
-}
-
-/** @}
- */
Index: nfigure.sh
===================================================================
--- configure.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Find out the path to the script.
-SOURCE_DIR=`which -- "$0" 2>/dev/null`
-# Maybe we are running bash.
-[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
-[ -z "$SOURCE_DIR" ] && exit 1
-SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
-SOURCE_DIR=`cd $SOURCE_DIR && echo $PWD`
-
-CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
-CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
-
-test "$#" -eq 1 && { test "$1" = "-h" || test "$1" = "--help"; }
-want_help="$?"
-
-if [ "$#" -gt 1 ] || [ "$want_help" -eq 0 ]; then
-
-	# Find all the leaf subdirectories in the defaults directory.
-	PROFILES=`find ${CONFIG_DEFAULTS} -type d -links 2 -printf "%P\n" | sort`
-
-	echo "Configures the current working directory as a HelenOS build directory."
-	echo "In-tree build is not supported, you must create a separate directory for build."
-	echo
-	echo "Usage:"
-	echo "	$0 -h|--help"
-	echo "	$0 [PROFILE]"
-	echo
-	echo "If profile is not specified, a graphical configuration utility is launched."
-	echo
-	echo "Possible profiles:"
-	printf "\t%s\n" $PROFILES
-	echo
-
-	exit "$want_help"
-fi
-
-if [ "$PWD" = "$SOURCE_DIR" ]; then
-	echo "We don't support in-tree build."
-	echo "Please create a build directory, cd into it, and run this script from there."
-	echo "Or run \`$0 --help\` to see usage."
-	exit 1
-fi
-
-ninja_help() {
-	echo 'Run  `ninja config`      to adjust configuration.'
-	echo 'Run  `ninja`             to build all program and library binaries, but not bootable image.'
-	echo 'Run  `ninja image_path`  to build boot image. The file image_path will contain path to the boot image file.'
-}
-
-if [ -f build.ninja ]; then
-	echo "This build directory was already configured."
-	echo
-	ninja_help
-	exit 0
-fi
-
-if ! which meson >/dev/null 2>/dev/null; then
-	echo "Your system does not have Meson installed."
-	echo 'Please use `pip3 install meson`'
-	exit 1
-fi
-
-if ! which ninja >/dev/null 2>/dev/null; then
-	echo "Your system does not have ninja installed."
-	echo 'Please use `pip3 install ninja`'
-	exit 1
-fi
-
-# Link tools directory for convenience.
-if [ ! -e tools ]; then
-	ln -s "${SOURCE_DIR}/tools" tools
-fi
-
-# Run HelenOS config tool.
-if [ "$#" -eq 1 ]; then
-	"${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" hands-off "$1" || exit 1
-else
-	"${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" || exit 1
-fi
-
-PLATFORM=`sed -n '/^PLATFORM\b/p' Makefile.config | sed 's:[^=]*= ::'`
-MACHINE=`sed -n '/^MACHINE\b/p' Makefile.config | sed 's:[^=]*= ::'`
-COMPILER=`sed -n '/^COMPILER\b/p' Makefile.config | sed 's:[^=]*= ::'`
-
-cross_target="$PLATFORM"
-if [ "$PLATFORM" = 'abs32le' ]; then
-	cross_target='ia32'
-fi
-if [ "$MACHINE" = 'bmalta' ]; then
-	cross_target='mips32eb'
-fi
-
-if [ "$COMPILER" = 'clang' ]; then
-    cross_target="${cross_target}_clang"
-fi
-
-cross_def="${SOURCE_DIR}/meson/cross/${cross_target}"
-cc_arch=`sed -n "s:cc_arch = '\(.*\)':\1:p" "$cross_def"`
-
-if [ "$COMPILER" = 'clang' ]; then
-    compname="$cc_arch-helenos-clang"
-else
-    compname="$cc_arch-helenos-gcc"
-fi
-unset compprefix
-
-if which "$compname" >/dev/null 2>/dev/null; then
-	# Compiler is in PATH
-	compprefix="$cc_arch-helenos-"
-
-elif [ -n "$CROSS_PREFIX" ]; then
-	if which "$CROSS_PREFIX/bin/$compname" >/dev/null 2>/dev/null; then
-		compprefix="$CROSS_PREFIX/bin/$cc_arch-helenos-"
-	fi
-
-	if [ -z "$compprefix" ]; then
-		echo "ERROR: \$CROSS_PREFIX defined but $compname is not present in $CROSS_PREFIX/bin."
-		echo "Run tools/toolchain.sh to build cross-compiling toolchain."
-		exit 1
-	fi
-else
-	if [ -z "$XDG_DATA_HOME" ]; then
-			XDG_DATA_HOME="$HOME/.local/share"
-	fi
-
-	if which "$XDG_DATA_HOME/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
-		compprefix="$XDG_DATA_HOME/HelenOS/cross/bin/$cc_arch-helenos-"
-	elif which "/opt/HelenOS/cross/bin/$compname" >/dev/null 2>/dev/null; then
-		compprefix="/opt/HelenOS/cross/bin/$cc_arch-helenos-"
-	elif which "/usr/local/cross/bin/$compname" >/dev/null 2>/dev/null; then
-		compprefix="/usr/local/cross/bin/$cc_arch-helenos-"
-	fi
-
-	if [ -z "$compprefix" ]; then
-		echo "ERROR: \$CROSS_PREFIX is not defined and $compname is not present in any of the following standard locations."
-		echo " * $XDG_DATA_HOME/HelenOS/cross/bin"
-		echo " * /opt/HelenOS/cross/bin"
-		echo " * /usr/local/cross/bin"
-		echo "Run tools/toolchain.sh to build cross-compiling toolchain."
-		exit 1
-	fi
-fi
-
-sed "s:@COMPPREFIX@:$compprefix:g" "$cross_def" > crossfile || exit 1
-
-meson setup "${SOURCE_DIR}" '.' --cross-file crossfile || exit 1
-
-echo
-echo "Configuration for platform $PLATFORM finished."
-echo
-ninja_help
Index: ntrib/arch/HelenOS.adl
===================================================================
--- contrib/arch/HelenOS.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-system architecture HelenOS version 0.5.0 {
-	/* SPARTAN kernel */
-	inst kernel kernel;
-
-	/* Naming Service */
-	inst ns ns;
-
-	/* Loader (clonable service) */
-	inst loader loader;
-
-	/* Device mapper */
-	inst devmap devmap;
-
-	/* Block device */
-	inst bd bd;
-
-	/* VFS server */
-	inst vfs vfs;
-
-	/* Console */
-	inst console console;
-
-	/* Kernel log */
-	inst kio kio;
-
-	[/uspace/lib/libc/bind%ns]
-	[/uspace/lib/libc/bind%loader]
-	[/uspace/lib/libc/bind%devmap]
-	[/uspace/lib/libc/bind%bd]
-	[/uspace/lib/libc/bind%vfs]
-	[/uspace/lib/libc/bind%console]
-	[/uspace/lib/libc/bind%kio]
-
-	bind ns:kbd to console:kbd;
-	bind ns:fb to console:fb;
-	bind ns:console to console:console;
-	bind ns:vfs to vfs:vfs;
-	bind ns:devmap_driver to devmap:devmap_driver;
-	bind ns:devmap_client to devmap:devmap_client;
-	bind ns:loader to loader:loader;
-
-	bind loader:ns to ns:ns;
-
-	bind devmap:ns to ns:ns;
-	bind devmap:rd to bd:rd;
-	bind devmap:console to console:console;
-
-	bind bd:ns to ns:ns;
-	bind bd:devmap_driver to devmap:devmap_driver;
-
-	bind vfs:ns to ns:ns;
-	bind vfs:rd to bd:rd;
-	bind vfs:devmap_client to devmap:devmap_client;
-	bind vfs:device to console:console;
-
-	bind console:ns to ns:ns;
-	bind console:devmap_driver to devmap:devmap_driver;
-	bind console:sys_console to kernel:sys_console;
-
-	bind kio:ns to ns:ns;
-};
Index: ntrib/arch/hadlbppp.py
===================================================================
--- contrib/arch/hadlbppp.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1849 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-HelenOS Architecture Description Language and Behavior Protocols preprocessor
-"""
-
-import sys
-import os
-
-INC, POST_INC, BLOCK_COMMENT, LINE_COMMENT, SYSTEM, ARCH, HEAD, BODY, NULL, \
-	INST, VAR, FIN, BIND, TO, SUBSUME, DELEGATE, IFACE, EXTENDS, PRE_BODY, \
-	PROTOTYPE, PAR_LEFT, PAR_RIGHT, SIGNATURE, PROTOCOL, INITIALIZATION, \
-	FINALIZATION, FRAME, PROVIDES, REQUIRES = range(29)
-
-def usage(prname):
-	"Print usage syntax"
-
-	print("%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname)
-	print()
-	print("--bp   Dump original Behavior Protocols (dChecker, BPSlicer)")
-	print("--ebp  Dump Extended Behavior Protocols (bp2promela)")
-	print("--adl  Dump Architecture Description Language (modified SOFA ADL/CDL)")
-	print("--dot  Dump Dot architecture diagram (GraphViz)")
-	print("--nop  Do not dump anything (just input files syntax check)")
-	print()
-
-def tabs(cnt):
-	"Return given number of tabs"
-
-	return ("\t" * cnt)
-
-def cond_append(tokens, token, trim):
-	"Conditionally append token to tokens with trim"
-
-	if (trim):
-		token = token.strip(" \t")
-
-	if (token != ""):
-		tokens.append(token)
-
-	return tokens
-
-def split_tokens(string, delimiters, trim = False, separate = False):
-	"Split string to tokens by delimiters, keep the delimiters"
-
-	tokens = []
-	last = 0
-	i = 0
-
-	while (i < len(string)):
-		for delim in delimiters:
-			if (len(delim) > 0):
-
-				if (string[i:(i + len(delim))] == delim):
-					if (separate):
-						tokens = cond_append(tokens, string[last:i], trim)
-						tokens = cond_append(tokens, delim, trim)
-						last = i + len(delim)
-					elif (i > 0):
-						tokens = cond_append(tokens, string[last:i], trim)
-						last = i
-
-					i += len(delim) - 1
-					break
-
-		i += 1
-
-	tokens = cond_append(tokens, string[last:len(string)], trim)
-
-	return tokens
-
-def identifier(token):
-	"Check whether the token is an identifier"
-
-	if (len(token) == 0):
-		return False
-
-	for i, char in enumerate(token):
-		if (i == 0):
-			if ((not char.isalpha()) and (char != "_")):
-				return False
-		else:
-			if ((not char.isalnum()) and (char != "_")):
-				return False
-
-	return True
-
-def descriptor(token):
-	"Check whether the token is an interface descriptor"
-
-	parts = token.split(":")
-	if (len(parts) != 2):
-		return False
-
-	return (identifier(parts[0]) and identifier(parts[1]))
-
-def word(token):
-	"Check whether the token is a word"
-
-	if (len(token) == 0):
-		return False
-
-	for i, char in enumerate(token):
-		if ((not char.isalnum()) and (char != "_") and (char != ".")):
-			return False
-
-	return True
-
-def tentative_bp(name, tokens):
-	"Preprocess tentative statements in Behavior Protocol"
-
-	result = []
-	i = 0
-
-	while (i < len(tokens)):
-		if (tokens[i] == "tentative"):
-			if ((i + 1 < len(tokens)) and (tokens[i + 1] == "{")):
-				i += 2
-				start = i
-				level = 1
-
-				while ((i < len(tokens)) and (level > 0)):
-					if (tokens[i] == "{"):
-						level += 1
-					elif (tokens[i] == "}"):
-						level -= 1
-
-					i += 1
-
-				if (level == 0):
-					result.append("(")
-					result.extend(tentative_bp(name, tokens[start:(i - 1)]))
-					result.append(")")
-					result.append("+")
-					result.append("NULL")
-					if (i < len(tokens)):
-						result.append(tokens[i])
-				else:
-					print("%s: Syntax error in tentative statement" % name)
-			else:
-				print("%s: Expected '{' for tentative statement" % name)
-		else:
-			result.append(tokens[i])
-
-		i += 1
-
-	return result
-
-def alternative_bp(name, tokens):
-	"Preprocess alternative statements in Behavior Protocol"
-
-	result = []
-	i = 0
-
-	while (i < len(tokens)):
-		if (tokens[i] == "alternative"):
-			if ((i + 1 < len(tokens)) and (tokens[i + 1] == "(")):
-				i += 2
-				reps = []
-
-				while ((i < len(tokens)) and (tokens[i] != ")")):
-					reps.append(tokens[i])
-					if ((i + 1 < len(tokens)) and (tokens[i + 1] == ";")):
-						i += 2
-					else:
-						i += 1
-
-				if (len(reps) >= 2):
-					if ((i + 1 < len(tokens)) and (tokens[i + 1] == "{")):
-						i += 2
-
-						start = i
-						level = 1
-
-						while ((i < len(tokens)) and (level > 0)):
-							if (tokens[i] == "{"):
-								level += 1
-							elif (tokens[i] == "}"):
-								level -= 1
-
-							i += 1
-
-						if (level == 0):
-							first = True
-
-							for rep in reps[1:]:
-								retokens = []
-								for token in tokens[start:(i - 1)]:
-									parts = token.split(".")
-									if ((len(parts) == 2) and (parts[0] == reps[0])):
-										retokens.append("%s.%s" % (rep, parts[1]))
-									else:
-										retokens.append(token)
-
-								if (first):
-									first = False
-								else:
-									result.append("+")
-
-								result.append("(")
-								result.extend(alternative_bp(name, retokens))
-								result.append(")")
-
-							if (i < len(tokens)):
-								result.append(tokens[i])
-						else:
-							print("%s: Syntax error in alternative statement" % name)
-					else:
-						print("%s: Expected '{' for alternative statement body" % name)
-				else:
-					print("%s: At least one pattern and one replacement required for alternative statement" % name)
-			else:
-				print("%s: Expected '(' for alternative statement head" % name)
-		else:
-			result.append(tokens[i])
-
-		i += 1
-
-	return result
-
-def split_bp(protocol):
-	"Convert Behavior Protocol to tokens"
-
-	return split_tokens(protocol, ["\n", " ", "\t", "(", ")", "{", "}", "*", ";", "+", "||", "|", "!", "?"], True, True)
-
-def extend_bp(name, tokens, iface):
-	"Convert interface Behavior Protocol to generic protocol"
-
-	result = []
-	i = 0
-
-	while (i < len(tokens)):
-		result.append(tokens[i])
-
-		if (tokens[i] == "?"):
-			if (i + 1 < len(tokens)):
-				i += 1
-				parts = tokens[i].split(".")
-
-				if (len(parts) == 1):
-					result.append("%s.%s" % (iface, tokens[i]))
-				else:
-					result.append(tokens[i])
-			else:
-				print("%s: Unexpected end of protocol" % name)
-
-		i += 1
-
-	return result
-
-def merge_bp(initialization, finalization, protocols):
-	"Merge several Behavior Protocols"
-
-	indep = []
-
-	if (len(protocols) > 1):
-		first = True
-
-		for protocol in protocols:
-			if (first):
-				first = False
-			else:
-				indep.append("|")
-
-			indep.append("(")
-			indep.extend(protocol)
-			indep.append(")")
-	elif (len(protocols) == 1):
-		indep = protocols[0]
-
-	inited = []
-
-	if (initialization != None):
-		if (len(indep) > 0):
-			inited.append("(")
-			inited.extend(initialization)
-			inited.append(")")
-			inited.append(";")
-			inited.append("(")
-			inited.extend(indep)
-			inited.append(")")
-		else:
-			inited = initialization
-	else:
-		inited = indep
-
-	finited = []
-
-	if (finalization != None):
-		if (len(inited) > 0):
-			finited.append("(")
-			finited.extend(inited)
-			finited.append(")")
-			finited.append(";")
-			finited.append("(")
-			finited.extend(finalization)
-			finited.append(")")
-		else:
-			finited = finalization
-	else:
-		finited = inited
-
-	return finited
-
-def parse_bp(name, tokens, base_indent):
-	"Parse Behavior Protocol"
-
-	tokens = tentative_bp(name, tokens)
-	tokens = alternative_bp(name, tokens)
-
-	indent = base_indent
-	output = ""
-
-	for token in tokens:
-		if (token == "\n"):
-			continue
-
-		if ((token == ";") or (token == "+") or (token == "||") or (token == "|")):
-			output += " %s" % token
-		elif (token == "("):
-			output += "\n%s%s" % (tabs(indent), token)
-			indent += 1
-		elif (token == ")"):
-			if (indent < base_indent):
-				print("%s: Too many parentheses" % name)
-
-			indent -= 1
-			output += "\n%s%s" % (tabs(indent), token)
-		elif (token == "{"):
-			output += " %s" % token
-			indent += 1
-		elif (token == "}"):
-			if (indent < base_indent):
-				print("%s: Too many parentheses" % name)
-
-			indent -= 1
-			output += "\n%s%s" % (tabs(indent), token)
-		elif (token == "*"):
-			output += "%s" % token
-		elif ((token == "!") or (token == "?") or (token == "NULL")):
-			output += "\n%s%s" % (tabs(indent), token)
-		else:
-			output += "%s" % token
-
-	if (indent > base_indent):
-		print("%s: Missing parentheses" % name)
-
-	output = output.strip()
-	if (output == ""):
-		return "NULL"
-
-	return output
-
-def parse_ebp(component, name, tokens, base_indent):
-	"Parse Behavior Protocol and generate Extended Behavior Protocol output"
-
-	return "component %s {\n\tbehavior {\n\t\t%s\n\t}\n}" % (component, parse_bp(name, tokens, base_indent + 2))
-
-def get_iface(name):
-	"Get interface by name"
-
-	global iface_properties
-
-	if (name in iface_properties):
-		return iface_properties[name]
-
-	return None
-
-def inherited_protocols(iface):
-	"Get protocols inherited by an interface"
-
-	result = []
-
-	if ('extends' in iface):
-		supiface = get_iface(iface['extends'])
-		if (not supiface is None):
-			if ('protocol' in supiface):
-				result.append(supiface['protocol'])
-			result.extend(inherited_protocols(supiface))
-		else:
-			print("%s: Extends unknown interface '%s'" % (iface['name'], iface['extends']))
-
-	return result
-
-def dump_frame(directed_binds, frame, outdir, var, archf):
-	"Dump Behavior Protocol of a given frame"
-
-	global opt_bp
-	global opt_ebp
-
-	if (opt_ebp):
-		fname = "%s.ebp" % frame['name']
-	else:
-		fname = "%s.bp" % frame['name']
-
-	if (archf != None):
-		archf.write("instantiate %s from \"%s\"\n" % (var, fname))
-
-	outname = os.path.join(outdir, fname)
-
-	protocols = []
-	if ('protocol' in frame):
-		protocols.append(frame['protocol'])
-
-	if ('initialization' in frame):
-		initialization = frame['initialization']
-	else:
-		initialization = None
-
-	if ('finalization' in frame):
-		finalization = frame['finalization']
-	else:
-		finalization = None
-
-	if ('provides' in frame):
-		for provides in frame['provides']:
-			iface = get_iface(provides['iface'])
-			if (not iface is None):
-				binds = directed_binds['%s.%s' % (var, provides['iface'])]
-				if (not binds is None):
-					cnt = len(binds)
-				else:
-					cnt = 1
-
-				if ('protocol' in iface):
-					proto = extend_bp(outname, iface['protocol'], iface['name'])
-					for _ in range(0, cnt):
-						protocols.append(proto)
-
-				for protocol in inherited_protocols(iface):
-					proto = extend_bp(outname, protocol, iface['name'])
-					for _ in range(0, cnt):
-						protocols.append(proto)
-			else:
-				print("%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']))
-
-	if (opt_bp):
-		outf = open(outname, "w")
-		outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0))
-		outf.close()
-
-	if (opt_ebp):
-		outf = open(outname, "w")
-		outf.write(parse_ebp(frame['name'], outname, merge_bp(initialization, finalization, protocols), 0))
-		outf.close()
-
-def get_system_arch():
-	"Get system architecture"
-
-	global arch_properties
-
-	for arch, properties in arch_properties.items():
-		if ('system' in properties):
-			return properties
-
-	return None
-
-def get_arch(name):
-	"Get architecture by name"
-
-	global arch_properties
-
-	if (name in arch_properties):
-		return arch_properties[name]
-
-	return None
-
-def get_frame(name):
-	"Get frame by name"
-
-	global frame_properties
-
-	if (name in frame_properties):
-		return frame_properties[name]
-
-	return None
-
-def create_null_bp(fname, outdir, archf):
-	"Create null frame protocol"
-
-	global opt_bp
-	global opt_ebp
-
-	if (archf != None):
-		archf.write("frame \"%s\"\n" % fname)
-
-	outname = os.path.join(outdir, fname)
-
-	if (opt_bp):
-		outf = open(outname, "w")
-		outf.write("NULL")
-		outf.close()
-
-	if (opt_ebp):
-		outf = open(outname, "w")
-		outf.write("component null {\n\tbehavior {\n\t\tNULL\n\t}\n}")
-		outf.close()
-
-def flatten_binds(binds, delegates, subsumes):
-	"Remove bindings which are replaced by delegation or subsumption"
-
-	result = []
-	stable = True
-
-	for bind in binds:
-		keep = True
-
-		for delegate in delegates:
-			if (bind['to'] == delegate['to']):
-				keep = False
-				result.append({'from': bind['from'], 'to': delegate['rep']})
-
-		for subsume in subsumes:
-			if (bind['from'] == subsume['from']):
-				keep = False
-				result.append({'from': subsume['rep'], 'to': bind['to']})
-
-		if (keep):
-			result.append(bind)
-		else:
-			stable = False
-
-	if (stable):
-		return result
-	else:
-		return flatten_binds(result, delegates, subsumes)
-
-def direct_binds(binds):
-	"Convert bindings matrix to set of sources by destination"
-
-	result = {}
-
-	for bind in binds:
-		if (not bind['to'] in result):
-			result[bind['to']] = set()
-
-		result[bind['to']].add(bind['from'])
-
-	return result
-
-def merge_arch(prefix, arch, outdir):
-	"Merge subarchitecture into architecture"
-
-	insts = []
-	binds = []
-	delegates = []
-	subsumes = []
-
-	if ('inst' in arch):
-		for inst in arch['inst']:
-			subarch = get_arch(inst['type'])
-			if (not subarch is None):
-				(subinsts, subbinds, subdelegates, subsubsumes) = merge_arch("%s_%s" % (prefix, subarch['name']), subarch, outdir)
-				insts.extend(subinsts)
-				binds.extend(subbinds)
-				delegates.extend(subdelegates)
-				subsumes.extend(subsubsumes)
-			else:
-				subframe = get_frame(inst['type'])
-				if (not subframe is None):
-					insts.append({'var': "%s_%s" % (prefix, inst['var']), 'frame': subframe})
-				else:
-					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
-
-	if ('bind' in arch):
-		for bind in arch['bind']:
-			binds.append({'from': "%s_%s.%s" % (prefix, bind['from'][0], bind['from'][1]), 'to': "%s_%s.%s" % (prefix, bind['to'][0], bind['to'][1])})
-
-	if ('delegate' in arch):
-		for delegate in arch['delegate']:
-			delegates.append({'to': "%s.%s" % (prefix, delegate['from']), 'rep': "%s_%s.%s" % (prefix, delegate['to'][0], delegate['to'][1])})
-
-	if ('subsume' in arch):
-		for subsume in arch['subsume']:
-			subsumes.append({'from': "%s.%s" % (prefix, subsume['to']), 'rep': "%s_%s.%s" % (prefix, subsume['from'][0], subsume['from'][1])})
-
-	return (insts, binds, delegates, subsumes)
-
-def dump_archbp(outdir):
-	"Dump system architecture Behavior Protocol"
-
-	global opt_bp
-	global opt_ebp
-
-	arch = get_system_arch()
-
-	if (arch is None):
-		print("Unable to find system architecture")
-		return
-
-	insts = []
-	binds = []
-	delegates = []
-	subsumes = []
-
-	if ('inst' in arch):
-		for inst in arch['inst']:
-			subarch = get_arch(inst['type'])
-			if (not subarch is None):
-				(subinsts, subbinds, subdelegates, subsubsumes) = merge_arch(subarch['name'], subarch, outdir)
-				insts.extend(subinsts)
-				binds.extend(subbinds)
-				delegates.extend(subdelegates)
-				subsumes.extend(subsubsumes)
-			else:
-				subframe = get_frame(inst['type'])
-				if (not subframe is None):
-					insts.append({'var': inst['var'], 'frame': subframe})
-				else:
-					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
-
-	if ('bind' in arch):
-		for bind in arch['bind']:
-			binds.append({'from': "%s.%s" % (bind['from'][0], bind['from'][1]), 'to': "%s.%s" % (bind['to'][0], bind['to'][1])})
-
-	if ('delegate' in arch):
-		for delegate in arch['delegate']:
-			print("Unable to delegate interface in system architecture")
-			break
-
-	if ('subsume' in arch):
-		for subsume in arch['subsume']:
-			print("Unable to subsume interface in system architecture")
-			break
-
-	directed_binds = direct_binds(flatten_binds(binds, delegates, subsumes))
-
-	outname = os.path.join(outdir, "%s.archbp" % arch['name'])
-	if ((opt_bp) or (opt_ebp)):
-		outf = open(outname, "w")
-	else:
-		outf = None
-
-	create_null_bp("null.bp", outdir, outf)
-
-	for inst in insts:
-		dump_frame(directed_binds, inst['frame'], outdir, inst['var'], outf)
-
-	for dst, src in directed_binds.items():
-		if (outf != None):
-			outf.write("bind %s to %s\n" % (", ".join(src), dst))
-
-	if (outf != None):
-		outf.close()
-
-def preproc_adl(raw, inarg):
-	"Preprocess %% statements in ADL"
-
-	return raw.replace("%%", inarg)
-
-def parse_adl(base, root, inname, nested, indent):
-	"Parse Architecture Description Language"
-
-	global output
-	global context
-	global architecture
-	global interface
-	global frame
-	global protocol
-	global initialization
-	global finalization
-
-	global iface_properties
-	global frame_properties
-	global arch_properties
-
-	global arg0
-
-	if (nested):
-		parts = inname.split("%")
-
-		if (len(parts) > 1):
-			inarg = parts[1]
-		else:
-			inarg = "%%"
-
-		if (parts[0][0:1] == "/"):
-			path = os.path.join(base, ".%s" % parts[0])
-			nested_root = os.path.dirname(path)
-		else:
-			path = os.path.join(root, parts[0])
-			nested_root = root
-
-		if (not os.path.isfile(path)):
-			print("%s: Unable to include file %s" % (inname, path))
-			return ""
-	else:
-		inarg = "%%"
-		path = inname
-		nested_root = root
-
-	inf = open(path, "r")
-
-	raw = preproc_adl(inf.read(), inarg)
-	tokens = split_tokens(raw, ["\n", " ", "\t", "(", ")", "{", "}", "[", "]", "/*", "*/", "#", ";"], True, True)
-
-	for token in tokens:
-
-		# Includes
-
-		if (INC in context):
-			context.remove(INC)
-			parse_adl(base, nested_root, token, True, indent)
-			context.add(POST_INC)
-			continue
-
-		if (POST_INC in context):
-			if (token != "]"):
-				print("%s: Expected ]" % inname)
-
-			context.remove(POST_INC)
-			continue
-
-		# Comments and newlines
-
-		if (BLOCK_COMMENT in context):
-			if (token == "*/"):
-				context.remove(BLOCK_COMMENT)
-
-			continue
-
-		if (LINE_COMMENT in context):
-			if (token == "\n"):
-				context.remove(LINE_COMMENT)
-
-			continue
-
-		# Any context
-
-		if (token == "/*"):
-			context.add(BLOCK_COMMENT)
-			continue
-
-		if (token == "#"):
-			context.add(LINE_COMMENT)
-			continue
-
-		if (token == "["):
-			context.add(INC)
-			continue
-
-		if (token == "\n"):
-			continue
-
-		# "frame"
-
-		if (FRAME in context):
-			if (NULL in context):
-				if (token != ";"):
-					print("%s: Expected ';' in frame '%s'" % (inname, frame))
-				else:
-					output += "%s\n" % token
-
-				context.remove(NULL)
-				context.remove(FRAME)
-				frame = None
-				continue
-
-			if (BODY in context):
-				if (FINALIZATION in context):
-					if (token == "{"):
-						indent += 1
-					elif (token == "}"):
-						indent -= 1
-
-					if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
-						bp = split_bp(finalization)
-						finalization = None
-
-						if (not frame in frame_properties):
-							frame_properties[frame] = {}
-
-						if ('finalization' in frame_properties[frame]):
-							print("%s: Finalization protocol for frame '%s' already defined" % (inname, frame))
-						else:
-							frame_properties[frame]['finalization'] = bp
-
-						output += "\n%s" % tabs(2)
-						output += parse_bp(inname, bp, 2)
-
-						context.remove(FINALIZATION)
-						if (indent == -1):
-							output += "\n%s" % token
-							context.remove(BODY)
-							context.add(NULL)
-							indent = 0
-							continue
-						else:
-							indent = 2
-					else:
-						finalization += token
-						continue
-
-				if (INITIALIZATION in context):
-					if (token == "{"):
-						indent += 1
-					elif (token == "}"):
-						indent -= 1
-
-					if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
-						bp = split_bp(initialization)
-						initialization = None
-
-						if (not frame in frame_properties):
-							frame_properties[frame] = {}
-
-						if ('initialization' in frame_properties[frame]):
-							print("%s: Initialization protocol for frame '%s' already defined" % (inname, frame))
-						else:
-							frame_properties[frame]['initialization'] = bp
-
-						output += "\n%s" % tabs(2)
-						output += parse_bp(inname, bp, 2)
-
-						context.remove(INITIALIZATION)
-						if (indent == -1):
-							output += "\n%s" % token
-							context.remove(BODY)
-							context.add(NULL)
-							indent = 0
-							continue
-						else:
-							indent = 2
-					else:
-						initialization += token
-						continue
-
-				if (PROTOCOL in context):
-					if (token == "{"):
-						indent += 1
-					elif (token == "}"):
-						indent -= 1
-
-					if (((token[-1] == ":") and (indent == 0)) or (indent == -1)):
-						bp = split_bp(protocol)
-						protocol = None
-
-						if (not frame in frame_properties):
-							frame_properties[frame] = {}
-
-						if ('protocol' in frame_properties[frame]):
-							print("%s: Protocol for frame '%s' already defined" % (inname, frame))
-						else:
-							frame_properties[frame]['protocol'] = bp
-
-						output += "\n%s" % tabs(2)
-						output += parse_bp(inname, bp, 2)
-
-						context.remove(PROTOCOL)
-						if (indent == -1):
-							output += "\n%s" % token
-							context.remove(BODY)
-							context.add(NULL)
-							indent = 0
-							continue
-						else:
-							indent = 2
-					else:
-						protocol += token
-						continue
-
-				if (REQUIRES in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in frame '%s'" % (inname, frame))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						continue
-
-					if (VAR in context):
-						if (not identifier(token)):
-							print("%s: Variable name expected in frame '%s'" % (inname, frame))
-						else:
-							if (not frame in frame_properties):
-								frame_properties[frame] = {}
-
-							if (not 'requires' in frame_properties[frame]):
-								frame_properties[frame]['requires'] = []
-
-							frame_properties[frame]['requires'].append({'iface': arg0, 'var': token})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.remove(VAR)
-						context.add(FIN)
-						continue
-
-					if ((token == "}") or (token[-1] == ":")):
-						context.remove(REQUIRES)
-					else:
-						if (not identifier(token)):
-							print("%s: Interface name expected in frame '%s'" % (inname, frame))
-						else:
-							arg0 = token
-							output += "\n%s%s " % (tabs(indent), token)
-
-						context.add(VAR)
-						continue
-
-				if (PROVIDES in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in frame '%s'" % (inname, frame))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						continue
-
-					if (VAR in context):
-						if (not identifier(token)):
-							print("%s: Variable name expected in frame '%s'" % (inname, frame))
-						else:
-							if (not frame in frame_properties):
-								frame_properties[frame] = {}
-
-							if (not 'provides' in frame_properties[frame]):
-								frame_properties[frame]['provides'] = []
-
-							frame_properties[frame]['provides'].append({'iface': arg0, 'var': token})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.remove(VAR)
-						context.add(FIN)
-						continue
-
-					if ((token == "}") or (token[-1] == ":")):
-						context.remove(PROVIDES)
-					else:
-						if (not identifier(token)):
-							print("%s: Interface name expected in frame '%s'" % (inname, frame))
-						else:
-							arg0 = token
-							output += "\n%s%s " % (tabs(indent), token)
-
-						context.add(VAR)
-						continue
-
-				if (token == "}"):
-					if (indent != 2):
-						print("%s: Wrong number of parentheses in frame '%s'" % (inname, frame))
-					else:
-						indent = 0
-						output += "\n%s" % token
-
-					context.remove(BODY)
-					context.add(NULL)
-					continue
-
-				if (token == "provides:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					context.add(PROVIDES)
-					continue
-
-				if (token == "requires:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					context.add(REQUIRES)
-					continue
-
-				if (token == "initialization:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					indent = 0
-					context.add(INITIALIZATION)
-					initialization = ""
-					continue
-
-				if (token == "finalization:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					indent = 0
-					context.add(FINALIZATION)
-					finalization = ""
-					continue
-
-				if (token == "protocol:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					indent = 0
-					context.add(PROTOCOL)
-					protocol = ""
-					continue
-
-				print("%s: Unknown token '%s' in frame '%s'" % (inname, token, frame))
-				continue
-
-			if (HEAD in context):
-				if (token == "{"):
-					output += "%s" % token
-					indent += 2
-					context.remove(HEAD)
-					context.add(BODY)
-					continue
-
-				if (token == ";"):
-					output += "%s\n" % token
-					context.remove(HEAD)
-					context.remove(FRAME)
-					continue
-
-				print("%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame))
-
-				continue
-
-			if (not identifier(token)):
-				print("%s: Expected frame name" % inname)
-			else:
-				frame = token
-				output += "%s " % token
-
-				if (not frame in frame_properties):
-					frame_properties[frame] = {}
-
-				frame_properties[frame]['name'] = frame
-
-			context.add(HEAD)
-			continue
-
-		# "interface"
-
-		if (IFACE in context):
-			if (NULL in context):
-				if (token != ";"):
-					print("%s: Expected ';' in interface '%s'" % (inname, interface))
-				else:
-					output += "%s\n" % token
-
-				context.remove(NULL)
-				context.remove(IFACE)
-				interface = None
-				continue
-
-			if (BODY in context):
-				if (PROTOCOL in context):
-					if (token == "{"):
-						indent += 1
-					elif (token == "}"):
-						indent -= 1
-
-					if (indent == -1):
-						bp = split_bp(protocol)
-						protocol = None
-
-						if (not interface in iface_properties):
-							iface_properties[interface] = {}
-
-						if ('protocol' in iface_properties[interface]):
-							print("%s: Protocol for interface '%s' already defined" % (inname, interface))
-						else:
-							iface_properties[interface]['protocol'] = bp
-
-						output += "\n%s" % tabs(2)
-						output += parse_bp(inname, bp, 2)
-						output += "\n%s" % token
-						indent = 0
-
-						context.remove(PROTOCOL)
-						context.remove(BODY)
-						context.add(NULL)
-					else:
-						protocol += token
-
-					continue
-
-				if (PROTOTYPE in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in interface '%s'" % (inname, interface))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						context.remove(PROTOTYPE)
-						continue
-
-					if (PAR_RIGHT in context):
-						if (token == ")"):
-							output += "%s" % token
-							context.remove(PAR_RIGHT)
-							context.add(FIN)
-						else:
-							output += " %s" % token
-
-						continue
-
-					if (SIGNATURE in context):
-						output += "%s" % token
-						if (token == ")"):
-							context.remove(SIGNATURE)
-							context.add(FIN)
-
-						context.remove(SIGNATURE)
-						context.add(PAR_RIGHT)
-						continue
-
-					if (PAR_LEFT in context):
-						if (token != "("):
-							print("%s: Expected '(' in interface '%s'" % (inname, interface))
-						else:
-							output += "%s" % token
-
-						context.remove(PAR_LEFT)
-						context.add(SIGNATURE)
-						continue
-
-					if (not identifier(token)):
-						print("%s: Method identifier expected in interface '%s'" % (inname, interface))
-					else:
-						output += "%s" % token
-
-					context.add(PAR_LEFT)
-					continue
-
-				if (token == "}"):
-					if (indent != 2):
-						print("%s: Wrong number of parentheses in interface '%s'" % (inname, interface))
-					else:
-						indent = 0
-						output += "\n%s" % token
-
-					context.remove(BODY)
-					context.add(NULL)
-					continue
-
-				if (token == "sysarg_t"):
-					output += "\n%s%s " % (tabs(indent), token)
-					context.add(PROTOTYPE)
-					continue
-
-				if (token == "protocol:"):
-					output += "\n%s%s" % (tabs(indent - 1), token)
-					indent = 0
-					context.add(PROTOCOL)
-					protocol = ""
-					continue
-
-				print("%s: Unknown token '%s' in interface '%s'" % (inname, token, interface))
-				continue
-
-			if (HEAD in context):
-				if (PRE_BODY in context):
-					if (token == "{"):
-						output += "%s" % token
-						indent += 2
-						context.remove(PRE_BODY)
-						context.remove(HEAD)
-						context.add(BODY)
-						continue
-
-					if (token == ";"):
-						output += "%s\n" % token
-						context.remove(PRE_BODY)
-						context.remove(HEAD)
-						context.remove(IFACE)
-						continue
-
-					print("%s: Expected '{' or ';' in interface head '%s'" % (inname, interface))
-					continue
-
-				if (EXTENDS in context):
-					if (not identifier(token)):
-						print("%s: Expected inherited interface name in interface head '%s'" % (inname, interface))
-					else:
-						output += "%s " % token
-						if (not interface in iface_properties):
-							iface_properties[interface] = {}
-
-						iface_properties[interface]['extends'] = token
-
-					context.remove(EXTENDS)
-					context.add(PRE_BODY)
-					continue
-
-				if (token == "extends"):
-					output += "%s " % token
-					context.add(EXTENDS)
-					continue
-
-				if (token == "{"):
-					output += "%s" % token
-					indent += 2
-					context.remove(HEAD)
-					context.add(BODY)
-					continue
-
-				if (token == ";"):
-					output += "%s\n" % token
-					context.remove(HEAD)
-					context.remove(IFACE)
-					continue
-
-				print("%s: Expected 'extends', '{' or ';' in interface head '%s'" % (inname, interface))
-				continue
-
-			if (not identifier(token)):
-				print("%s: Expected interface name" % inname)
-			else:
-				interface = token
-				output += "%s " % token
-
-				if (not interface in iface_properties):
-					iface_properties[interface] = {}
-
-				iface_properties[interface]['name'] = interface
-
-			context.add(HEAD)
-			continue
-
-		# "architecture"
-
-		if (ARCH in context):
-			if (NULL in context):
-				if (token != ";"):
-					print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
-				else:
-					output += "%s\n" % token
-
-				context.remove(NULL)
-				context.remove(ARCH)
-				context.discard(SYSTEM)
-				architecture = None
-				continue
-
-			if (BODY in context):
-				if (DELEGATE in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						context.remove(DELEGATE)
-						continue
-
-					if (VAR in context):
-						if (not descriptor(token)):
-							print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
-						else:
-							if (not architecture in arch_properties):
-								arch_properties[architecture] = {}
-
-							if (not 'delegate' in arch_properties[architecture]):
-								arch_properties[architecture]['delegate'] = []
-
-							arch_properties[architecture]['delegate'].append({'from': arg0, 'to': token.split(":")})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.add(FIN)
-						context.remove(VAR)
-						continue
-
-					if (TO in context):
-						if (token != "to"):
-							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s " % token
-
-						context.add(VAR)
-						context.remove(TO)
-						continue
-
-					if (not identifier(token)):
-						print("%s: Expected interface name in architecture '%s'" % (inname, architecture))
-					else:
-						output += "%s " % token
-						arg0 = token
-
-					context.add(TO)
-					continue
-
-				if (SUBSUME in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						context.remove(SUBSUME)
-						continue
-
-					if (VAR in context):
-						if (not identifier(token)):
-							print("%s: Expected interface name in architecture '%s'" % (inname, architecture))
-						else:
-							if (not architecture in arch_properties):
-								arch_properties[architecture] = {}
-
-							if (not 'subsume' in arch_properties[architecture]):
-								arch_properties[architecture]['subsume'] = []
-
-							arch_properties[architecture]['subsume'].append({'from': arg0.split(":"), 'to': token})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.add(FIN)
-						context.remove(VAR)
-						continue
-
-					if (TO in context):
-						if (token != "to"):
-							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s " % token
-
-						context.add(VAR)
-						context.remove(TO)
-						continue
-
-					if (not descriptor(token)):
-						print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
-					else:
-						output += "%s " % token
-						arg0 = token
-
-					context.add(TO)
-					continue
-
-				if (BIND in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						context.remove(BIND)
-						continue
-
-					if (VAR in context):
-						if (not descriptor(token)):
-							print("%s: Expected second interface descriptor in architecture '%s'" % (inname, architecture))
-						else:
-							if (not architecture in arch_properties):
-								arch_properties[architecture] = {}
-
-							if (not 'bind' in arch_properties[architecture]):
-								arch_properties[architecture]['bind'] = []
-
-							arch_properties[architecture]['bind'].append({'from': arg0.split(":"), 'to': token.split(":")})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.add(FIN)
-						context.remove(VAR)
-						continue
-
-					if (TO in context):
-						if (token != "to"):
-							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s " % token
-
-						context.add(VAR)
-						context.remove(TO)
-						continue
-
-					if (not descriptor(token)):
-						print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
-					else:
-						output += "%s " % token
-						arg0 = token
-
-					context.add(TO)
-					continue
-
-				if (INST in context):
-					if (FIN in context):
-						if (token != ";"):
-							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
-						else:
-							output += "%s" % token
-
-						context.remove(FIN)
-						context.remove(INST)
-						continue
-
-					if (VAR in context):
-						if (not identifier(token)):
-							print("%s: Expected instance name in architecture '%s'" % (inname, architecture))
-						else:
-							if (not architecture in arch_properties):
-								arch_properties[architecture] = {}
-
-							if (not 'inst' in arch_properties[architecture]):
-								arch_properties[architecture]['inst'] = []
-
-							arch_properties[architecture]['inst'].append({'type': arg0, 'var': token})
-							arg0 = None
-
-							output += "%s" % token
-
-						context.add(FIN)
-						context.remove(VAR)
-						continue
-
-					if (not identifier(token)):
-						print("%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture))
-					else:
-						output += "%s " % token
-						arg0 = token
-
-					context.add(VAR)
-					continue
-
-				if (token == "}"):
-					if (indent != 1):
-						print("%s: Wrong number of parentheses in architecture '%s'" % (inname, architecture))
-					else:
-						indent -= 1
-						output += "\n%s" % token
-
-					context.remove(BODY)
-					context.add(NULL)
-					continue
-
-				if (token == "inst"):
-					output += "\n%s%s " % (tabs(indent), token)
-					context.add(INST)
-					continue
-
-				if (token == "bind"):
-					output += "\n%s%s " % (tabs(indent), token)
-					context.add(BIND)
-					continue
-
-				if (token == "subsume"):
-					output += "\n%s%s " % (tabs(indent), token)
-					context.add(SUBSUME)
-					continue
-
-				if (token == "delegate"):
-					output += "\n%s%s " % (tabs(indent), token)
-					context.add(DELEGATE)
-					continue
-
-				print("%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture))
-				continue
-
-			if (HEAD in context):
-				if (token == "{"):
-					output += "%s" % token
-					indent += 1
-					context.remove(HEAD)
-					context.add(BODY)
-					continue
-
-				if (token == ";"):
-					output += "%s\n" % token
-					context.remove(HEAD)
-					context.remove(ARCH)
-					context.discard(SYSTEM)
-					continue
-
-				if (not word(token)):
-					print("%s: Expected word in architecture head '%s'" % (inname, architecture))
-				else:
-					output += "%s " % token
-
-				continue
-
-			if (not identifier(token)):
-				print("%s: Expected architecture name" % inname)
-			else:
-				architecture = token
-				output += "%s " % token
-
-				if (not architecture in arch_properties):
-					arch_properties[architecture] = {}
-
-				arch_properties[architecture]['name'] = architecture
-
-				if (SYSTEM in context):
-					arch_properties[architecture]['system'] = True
-
-			context.add(HEAD)
-			continue
-
-		# "system architecture"
-
-		if (SYSTEM in context):
-			if (token != "architecture"):
-				print("%s: Expected 'architecture'" % inname)
-			else:
-				output += "%s " % token
-
-			context.add(ARCH)
-			continue
-
-		if (token == "frame"):
-			output += "\n%s " % token
-			context.add(FRAME)
-			continue
-
-		if (token == "interface"):
-			output += "\n%s " % token
-			context.add(IFACE)
-			continue
-
-		if (token == "system"):
-			output += "\n%s " % token
-			context.add(SYSTEM)
-			continue
-
-		if (token == "architecture"):
-			output += "\n%s " % token
-			context.add(ARCH)
-			continue
-
-		print("%s: Unknown token '%s'" % (inname, token))
-
-	inf.close()
-
-def open_adl(base, root, inname, outdir, outname):
-	"Open Architecture Description file"
-
-	global output
-	global context
-	global architecture
-	global interface
-	global frame
-	global protocol
-	global initialization
-	global finalization
-
-	global arg0
-
-	global opt_adl
-
-	output = ""
-	context = set()
-	architecture = None
-	interface = None
-	frame = None
-	protocol = None
-	initialization = None
-	finalization = None
-	arg0 = None
-
-	parse_adl(base, root, inname, False, 0)
-	output = output.strip()
-
-	if ((output != "") and (opt_adl)):
-		outf = open(outname, "w")
-		outf.write(output)
-		outf.close()
-
-def recursion(base, root, output, level):
-	"Recursive directory walk"
-
-	for name in os.listdir(root):
-		canon = os.path.join(root, name)
-
-		if (os.path.isfile(canon)):
-			fcomp = split_tokens(canon, ["."])
-			cname = canon.split("/")
-
-			if (fcomp[-1] == ".adl"):
-				output_path = os.path.join(output, cname[-1])
-				open_adl(base, root, canon, output, output_path)
-
-		if (os.path.isdir(canon)):
-			recursion(base, canon, output, level + 1)
-
-def merge_dot_frame(prefix, name, frame, outf, indent):
-	"Dump Dot frame"
-
-	outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix))
-	outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name))
-	outf.write("%s\tstyle=filled;\n" % tabs(indent))
-	outf.write("%s\tcolor=red;\n" % tabs(indent))
-	outf.write("%s\tfillcolor=yellow;\n" % tabs(indent))
-	outf.write("%s\t\n" % tabs(indent))
-
-	if ('provides' in frame):
-		outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, style=filled, color=green, fillcolor=yellow];\n" % (tabs(indent), prefix))
-
-	if ('requires' in frame):
-		outf.write("%s\t%s__requires [label=\"\", shape=circle, style=filled, color=red, fillcolor=yellow];\n" % (tabs(indent), prefix))
-
-	outf.write("%s}\n" % tabs(indent))
-	outf.write("%s\n" % tabs(indent))
-
-def merge_dot_arch(prefix, name, arch, outf, indent):
-	"Dump Dot subarchitecture"
-
-	outf.write("%ssubgraph cluster_%s {\n" % (tabs(indent), prefix))
-	outf.write("%s\tlabel=\"%s\";\n" % (tabs(indent), name))
-	outf.write("%s\tcolor=red;\n" % tabs(indent))
-	outf.write("%s\t\n" % tabs(indent))
-
-	if ('inst' in arch):
-		for inst in arch['inst']:
-			subarch = get_arch(inst['type'])
-			if (not subarch is None):
-				merge_dot_arch("%s_%s" % (prefix, inst['var']), inst['var'], subarch, outf, indent + 1)
-			else:
-				subframe = get_frame(inst['type'])
-				if (not subframe is None):
-					merge_dot_frame("%s_%s" % (prefix, inst['var']), inst['var'], subframe, outf, indent + 1)
-				else:
-					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
-
-	if ('bind' in arch):
-		labels = {}
-		for bind in arch['bind']:
-			if (bind['from'][1] != bind['to'][1]):
-				label = "%s:%s" % (bind['from'][1], bind['to'][1])
-			else:
-				label = bind['from'][1]
-
-			if (not (bind['from'][0], bind['to'][0]) in labels):
-				labels[(bind['from'][0], bind['to'][0])] = []
-
-			labels[(bind['from'][0], bind['to'][0])].append(label)
-
-		for bind in arch['bind']:
-			if (not (bind['from'][0], bind['to'][0]) in labels):
-				continue
-
-			attrs = []
-
-			if (bind['from'][0] != bind['to'][0]):
-				attrs.append("ltail=cluster_%s_%s" % (prefix, bind['from'][0]))
-				attrs.append("lhead=cluster_%s_%s" % (prefix, bind['to'][0]))
-
-			attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])]))
-			del labels[(bind['from'][0], bind['to'][0])]
-
-			outf.write("%s\t%s_%s__requires -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, bind['from'][0], prefix, bind['to'][0], ", ".join(attrs)))
-
-	if ('delegate' in arch):
-		outf.write("%s\t%s__provides [label=\"\", shape=doublecircle, color=green];\n" % (tabs(indent), prefix))
-
-		labels = {}
-		for delegate in arch['delegate']:
-			if (delegate['from'] != delegate['to'][1]):
-				label = "%s:%s" % (delegate['from'], delegate['to'][1])
-			else:
-				label = delegate['from']
-
-			if (not delegate['to'][0] in labels):
-				labels[delegate['to'][0]] = []
-
-			labels[delegate['to'][0]].append(label)
-
-		for delegate in arch['delegate']:
-			if (not delegate['to'][0] in labels):
-				continue
-
-			attrs = []
-			attrs.append("color=gray")
-			attrs.append("lhead=cluster_%s_%s" % (prefix, delegate['to'][0]))
-			attrs.append("label=\"%s\"" % "\\n".join(labels[delegate['to'][0]]))
-			del labels[delegate['to'][0]]
-
-			outf.write("%s\t%s__provides -> %s_%s__provides [%s];\n" % (tabs(indent), prefix, prefix, delegate['to'][0], ", ".join(attrs)))
-
-	if ('subsume' in arch):
-		outf.write("%s\t%s__requires [label=\"\", shape=circle, color=red];\n" % (tabs(indent), prefix))
-
-		labels = {}
-		for subsume in arch['subsume']:
-			if (subsume['from'][1] != subsume['to']):
-				label = "%s:%s" % (subsume['from'][1], subsume['to'])
-			else:
-				label = subsume['to']
-
-			if (not subsume['from'][0] in labels):
-				labels[subsume['from'][0]] = []
-
-			labels[subsume['from'][0]].append(label)
-
-		for subsume in arch['subsume']:
-			if (not subsume['from'][0] in labels):
-				continue
-
-			attrs = []
-			attrs.append("color=gray")
-			attrs.append("ltail=cluster_%s_%s" % (prefix, subsume['from'][0]))
-			attrs.append("label=\"%s\"" % "\\n".join(labels[subsume['from'][0]]))
-			del labels[subsume['from'][0]]
-
-			outf.write("%s\t%s_%s__requires -> %s__requires [%s];\n" % (tabs(indent), prefix, subsume['from'][0], prefix, ", ".join(attrs)))
-
-	outf.write("%s}\n" % tabs(indent))
-	outf.write("%s\n" % tabs(indent))
-
-def dump_dot(outdir):
-	"Dump Dot architecture"
-
-	global opt_dot
-
-	arch = get_system_arch()
-
-	if (arch is None):
-		print("Unable to find system architecture")
-		return
-
-	if (opt_dot):
-		outname = os.path.join(outdir, "%s.dot" % arch['name'])
-		outf = open(outname, "w")
-
-		outf.write("digraph {\n")
-		outf.write("\tlabel=\"%s\";\n" % arch['name'])
-		outf.write("\tcompound=true;\n")
-		outf.write("\tsplines=\"polyline\";\n")
-		outf.write("\tedge [fontsize=8];\n")
-		outf.write("\t\n")
-
-		if ('inst' in arch):
-			for inst in arch['inst']:
-				subarch = get_arch(inst['type'])
-				if (not subarch is None):
-					merge_dot_arch(inst['var'], inst['var'], subarch, outf, 1)
-				else:
-					subframe = get_frame(inst['type'])
-					if (not subframe is None):
-						merge_dot_frame("%s" % inst['var'], inst['var'], subframe, outf, 1)
-					else:
-						print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
-
-		if ('bind' in arch):
-			labels = {}
-			for bind in arch['bind']:
-				if (bind['from'][1] != bind['to'][1]):
-					label = "%s:%s" % (bind['from'][1], bind['to'][1])
-				else:
-					label = bind['from'][1]
-
-				if (not (bind['from'][0], bind['to'][0]) in labels):
-					labels[(bind['from'][0], bind['to'][0])] = []
-
-				labels[(bind['from'][0], bind['to'][0])].append(label)
-
-			for bind in arch['bind']:
-				if (not (bind['from'][0], bind['to'][0]) in labels):
-					continue
-
-				attrs = []
-
-				if (bind['from'][0] != bind['to'][0]):
-					attrs.append("ltail=cluster_%s" % bind['from'][0])
-					attrs.append("lhead=cluster_%s" % bind['to'][0])
-
-				attrs.append("label=\"%s\"" % "\\n".join(labels[(bind['from'][0], bind['to'][0])]))
-				del labels[(bind['from'][0], bind['to'][0])]
-
-				outf.write("\t%s__requires -> %s__provides [%s];\n" % (bind['from'][0], bind['to'][0], ", ".join(attrs)))
-
-		if ('delegate' in arch):
-			for delegate in arch['delegate']:
-				print("Unable to delegate interface in system architecture")
-				break
-
-		if ('subsume' in arch):
-			for subsume in arch['subsume']:
-				print("Unable to subsume interface in system architecture")
-				break
-
-		outf.write("}\n")
-
-		outf.close()
-
-def main():
-	global iface_properties
-	global frame_properties
-	global arch_properties
-	global opt_bp
-	global opt_ebp
-	global opt_adl
-	global opt_dot
-
-	if (len(sys.argv) < 3):
-		usage(sys.argv[0])
-		return
-
-	opt_bp = False
-	opt_ebp = False
-	opt_adl = False
-	opt_dot = False
-
-	for arg in sys.argv[1:(len(sys.argv) - 1)]:
-		if (arg == "--bp"):
-			opt_bp = True
-		elif (arg == "--ebp"):
-			opt_ebp = True
-		elif (arg == "--adl"):
-			opt_adl = True
-		elif (arg == "--dot"):
-			opt_dot = True
-		elif (arg == "--nop"):
-			pass
-		else:
-			print("Error: Unknown command line option '%s'" % arg)
-			return
-
-	if ((opt_bp) and (opt_ebp)):
-		print("Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols")
-		return
-
-	path = os.path.abspath(sys.argv[-1])
-	if (not os.path.isdir(path)):
-		print("Error: <OUTPUT> is not a directory")
-		return
-
-	iface_properties = {}
-	frame_properties = {}
-	arch_properties = {}
-
-	recursion(".", ".", path, 0)
-	dump_archbp(path)
-	dump_dot(path)
-
-if __name__ == '__main__':
-	main()
Index: ntrib/arch/kernel/kernel.adl
===================================================================
--- contrib/arch/kernel/kernel.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,326 +1,0 @@
-/*****************************
- * Kernel syscall interfaces *
- *****************************/
-
-interface sys_kio {
-		/* Print using kernel facility */
-		sysarg_t sys_kio(int fd, const void *buf, size_t size);
-	protocol:
-		?sys_kio*
-};
-
-interface sys_console {
-		/* Enable kernel console */
-		sysarg_t sys_debug_enable_console(void);
-
-		/* Disable kernel console */
-		sysarg_t sys_debug_disable_console(void);
-	protocol:
-		(
-			?sys_debug_enable_console +
-			?sys_debug_disable_console
-		)*
-};
-
-interface sys_thread {
-		/* Create new thread */
-		sysarg_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id);
-
-		/* Terminate current thread */
-		sysarg_t sys_thread_exit(int uspace_status);
-
-		/* Get current thread id */
-		sysarg_t sys_thread_get_id(thread_id_t *uspace_thread_id);
-	protocol:
-		(
-			?sys_thread_create +
-			?sys_thread_get_id +
-			?sys_thread_exit
-		)*
-};
-
-interface sys_task {
-		/* Set name fo the current task */
-		sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len);
-
-		/* Get current task id */
-		sysarg_t sys_task_get_id(task_id_t *uspace_task_id);
-	protocol:
-		(
-			?sys_task_set_name +
-			?sys_task_get_id
-		)*
-};
-
-interface sys_program {
-		/* Spawn a new instance of clonable loader service */
-		sysarg_t sys_program_spawn_loader(char *uspace_name, size_t name_len);
-	protocol:
-		?sys_program_spawn_loader*
-};
-
-interface sys_futex {
-		/* Sleep in a futex wait queue */
-		sysarg_t sys_futex_sleep_timeout(uintptr_t uaddr, uint32_t usec, int flags);
-
-		/* Wakeup one thread waiting in futex wait queue */
-		sysarg_t sys_futex_wakeup(uintptr_t uaddr);
-	protocol:
-		(
-			?sys_futex_sleep_timeout +
-			?sys_futex_wakeup
-		)*
-};
-
-interface sys_smc {
-		/* Enforce self-modifying code cache coherency */
-		sysarg_t sys_smc_coherence(uintptr_t va, size_t size);
-	protocol:
-		?sys_smc_coherence*
-};
-
-interface sys_as {
-		/* Create new address space area */
-		sysarg_t sys_as_area_create(uintptr_t address, size_t size, int flags);
-
-		/* Resize an address space area */
-		sysarg_t sys_as_area_resize(uinptr_t address, size_t size, int flags);
-
-		/* Change flags of an address space area */
-		sysarg_t sys_as_area_change_flags(uintptr_t address, int flags);
-
-		/* Destroy an address space area */
-		sysarg_t sys_as_area_destroy(uintptr_t address);
-	protocol:
-		(
-			?sys_as_area_create +
-			?sys_as_area_resize +
-			?sys_as_area_change_flags +
-			?sys_as_area_destroy
-		)*
-};
-
-interface sys_ipc {
-		/* Fast synchronous IPC call */
-		sysarg_t sys_ipc_call_sync_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_data_t *data);
-
-		/* Slow synchronous IPC call */
-		sysarg_t sys_ipc_call_sync_slow(sysarg_t phoneid, ipc_data_t *question, ipc_data_t *answer);
-
-		/* Fast asynchronous IPC call */
-		sysarg_t sys_ipc_call_async_fast(sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
-
-		/* Slow asynchronous IPC call */
-		sysarg_t sys_ipc_call_async_slow(sysarg_t phoneid, ipc_data_t *data);
-
-		/* Fast forward a received IPC call to another destination */
-		sysarg_t sys_ipc_forward_fast(sysarg_t chandle, sysarg_t phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2, int mode);
-
-		/* Slow forward a received IPC call to another destination */
-		sysarg_t sys_ipc_forward_slow(sysarg_t chandle, sysarg_t phoneid, ipc_data_t *data, int mode);
-
-		/* Fast answer an IPC call */
-		sysarg_t sys_ipc_answer_fast(sysarg_t chandle, sysarg_t retval, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4);
-
-		/* Slow answer an IPC call */
-		sysarg_t sys_ipc_answer_slow(sysarg_t chandle, ipc_data_t *data);
-
-		/* Hang up a phone */
-		sysarg_t sys_ipc_hangup(int phoneid);
-
-		/* Wait for an incoming IPC call or answer */
-		sysarg_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags);
-
-		/* Interrupt one thread of the current task from waiting on IPC call */
-		sysarg_t sys_ipc_poke(void);
-	protocol:
-		(
-			?sys_ipc_call_sync_fast +
-			?sys_ipc_call_sync_slow +
-			?sys_ipc_call_async_fast +
-			?sys_ipc_call_async_slow +
-			?sys_ipc_forward_fast +
-			?sys_ipc_forward_slow +
-			?sys_ipc_answer_fast +
-			?sys_ipc_answer_slow +
-			?sys_ipc_hangup +
-			?sys_ipc_wait_for_call +
-			?sys_ipc_poke
-		)*
-};
-
-interface sys_event {
-		/* Subscribe to kernel event notifications */
-		sysarg_t sys_event_subscribe(sysarg_t evno, sysarg_t method);
-	protocol:
-		?sys_event_subscribe*
-};
-
-interface sys_cap {
-		/* Grant capabilities to a task */
-#ifdef __32_BITS__
-		sysarg_t sys_cap_grant(sysarg64_t *uspace_taskid, cap_t caps);
-#endif
-
-#ifdef __64_BITS__
-		sysarg_t sys_cap_grant(sysarg_t taskid, cap_t caps);
-#endif
-
-		/* Revoke capabilities from a task */
-#ifdef __32_BITS__
-		sysarg_t sys_cap_revoke(sysarg64_t *uspace_taskid, cap_t caps);
-#endif
-
-#ifdef __64_BITS__
-		sysarg_t sys_cap_revoke(sysarg_t taskid, cap_t caps);
-#endif
-	protocol:
-		(
-			?sys_cap_grant +
-			?sys_cap_rewoke
-		)*
-};
-
-interface sys_ddi {
-		/* Enable access I/O address space for the current task */
-		sysarg_t sys_enable_iospace(ddi_ioarg_t *uspace_io_arg);
-
-		/* Map physical memory to the current task's address space */
-		sysarg_t sys_physmem_map(sysarg_t phys_base, sysarg_t virt_base, sysarg_t pages, sysarg_t flags);
-
-		/* Enable or disable preemption */
-		sysarg_t sys_preempt_control(int enable);
-
-		/* Assign unique device number */
-		sysarg_t sys_device_assign_devno(void);
-
-		/* Connect an IRQ handler to the current task */
-		sysarg_t sys_register_irq(inr_t inr, devno_t devno, sysarg_t method, irq_code_t *ucode);
-
-		/* Disconnect an IRQ handler from the current task */
-		sysarg_t sys_unregister_irq(inr_t inr, devno_t devno);
-	protocol:
-		(
-			?sys_enable_iospace +
-			?sys_physmem_map +
-			?sys_device_assign_devno +
-			?sys_preempt_control +
-			?sys_register_irq +
-			?sys_unregister_irq
-		)*
-};
-
-interface sys_sysinfo {
-		/* Check for sysinfo key validity */
-		sysarg_t sys_sysinfo_valid(sysarg_t ptr, sysarg_t len);
-
-		/* Get sysinfo key value */
-		sysarg_t sys_sysinfo_value(unatice_t ptr, sysarg_t len);
-	protocol:
-		(
-			?sys_sysinfo_valid +
-			?sys_sysinfo_value
-		)*
-};
-
-interface sys_debug {
-		/* Connect to the kernel debugging answerbox of a given task */
-#ifdef __32_BITS__
-		sysarg_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid);
-#endif
-
-#ifdef __64_BITS__
-		sysarg_t sys_ipc_connect_kbox(sysarg_t taskid);
-#endif
-	protocol:
-		?sys_ipc_connect_kbox*
-};
-
-
-/*****************************************************
- * Primitive kernel components (exported subsystems) *
- *****************************************************/
-
-frame sys_console {
-	provides:
-		sys_kio sys_kio;
-		sys_console sys_console;
-};
-
-frame sys_proc {
-	provides:
-		sys_tls sys_tls;
-		sys_thread sys_thread;
-		sys_task sys_task;
-		sys_program sys_program;
-};
-
-frame sys_synch {
-	provides:
-		sys_futex sys_futex;
-		sys_smc sys_smc;
-};
-
-frame sys_mm {
-	provides:
-		sys_as sys_as;
-};
-
-frame sys_ipc {
-	provides:
-		sys_ipc sys_ipc;
-		sys_event sys_event;
-};
-
-frame sys_security {
-	provides:
-		sys_cap sys_cap;
-};
-
-frame sys_ddi {
-	provides:
-		sys_ddi sys_ddi;
-};
-
-frame sys_sysinfo {
-	provides:
-		sys_sysinfo sys_sysinfo;
-};
-
-frame sys_debug {
-	provides:
-		sys_debug sys_debug;
-};
-
-
-/******************************
- * Composite kernel component *
- ******************************/
-
-architecture kernel {
-	inst sys_console sys_console;
-	inst sys_proc sys_proc;
-	inst sys_synch sys_synch;
-	inst sys_mm sys_mm;
-	inst sys_ipc sys_ipc;
-	inst sys_security sys_security;
-	inst sys_ddi sys_ddi;
-	inst sys_sysinfo sys_sysinfo;
-	inst sys_debug sys_debug;
-
-	delegate sys_kio to sys_console:sys_kio;
-	delegate sys_console to sys_console:sys_console;
-	delegate sys_tls to sys_proc:sys_tls;
-	delegate sys_thread to sys_proc:sys_thread;
-	delegate sys_task to sys_proc:sys_task;
-	delegate sys_program to sys_proc:sys_program;
-	delegate sys_futex to sys_synch:sys_futex;
-	delegate sys_smc to sys_synch:sys_smc;
-	delegate sys_as to sys_mm:sys_as;
-	delegate sys_ipc to sys_ipc:sys_ipc;
-	delegate sys_event to sys_ipc:sys_event;
-	delegate sys_cap to sys_security:sys_cap;
-	delegate sys_ddi to sys_ddi:sys_ddi;
-	delegate sys_sysinfo to sys_sysinfo:sys_sysinfo;
-	delegate sys_debug to sys_debug:sys_debug;
-};
Index: ntrib/arch/uspace/app/kio/kio.adl
===================================================================
--- contrib/arch/uspace/app/kio/kio.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-frame kio {
-	requires:
-		naming_service ns;
-		[/uspace/lib/libc/requires]
-	initialization:
-		!ns.ipc_m_share_in /* SERVICE_MEM_KIO */
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/lib/libblock/fnc.block_fini
===================================================================
--- contrib/arch/uspace/lib/libblock/fnc.block_fini	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!%%.ipc_m_phone_hungup
-)
Index: ntrib/arch/uspace/lib/libblock/fnc.block_init
===================================================================
--- contrib/arch/uspace/lib/libblock/fnc.block_init	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-(
-	[/uspace/lib/libc/fnc.devmap_device_connect] ;
-	tentative {
-		!%%.ipc_m_share_out ;
-		tentative {
-			!%%.get_block_size
-		}
-	}
-)
Index: ntrib/arch/uspace/lib/libblock/fnc.block_seqread
===================================================================
--- contrib/arch/uspace/lib/libblock/fnc.block_seqread	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	tentative {
-		!%%.read_blocks*
-	}
-)
Index: ntrib/arch/uspace/lib/libc/bind
===================================================================
--- contrib/arch/uspace/lib/libc/bind	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-/* Bind %% to kernel interfaces */
-bind %%:sys_kio to kernel:sys_kio;
-bind %%:sys_tls to kernel:sys_tls;
-bind %%:sys_thread to kernel:sys_thread;
-bind %%:sys_task to kernel:sys_task;
-bind %%:sys_program to kernel:sys_program;
-bind %%:sys_futex to kernel:sys_futex;
-bind %%:sys_smc to kernel:sys_smc;
-bind %%:sys_as to kernel:sys_as;
-bind %%:sys_ipc to kernel:sys_ipc;
-bind %%:sys_event to kernel:sys_event;
-bind %%:sys_cap to kernel:sys_cap;
-bind %%:sys_ddi to kernel:sys_ddi;
-bind %%:sys_sysinfo to kernel:sys_sysinfo;
-bind %%:sys_debug to kernel:sys_debug;
Index: ntrib/arch/uspace/lib/libc/devmap_device_connect
===================================================================
--- contrib/arch/uspace/lib/libc/devmap_device_connect	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-[devmap_get_phone] ;
-!dev.IPC_M_CONNECT_ME_TO
Index: ntrib/arch/uspace/lib/libc/devmap_device_get_count
===================================================================
--- contrib/arch/uspace/lib/libc/devmap_device_get_count	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-[devmap_get_phone] ;
-!devmap.DEVMAP_DEVICE_GET_COUNT
Index: ntrib/arch/uspace/lib/libc/devmap_device_get_devices
===================================================================
--- contrib/arch/uspace/lib/libc/devmap_device_get_devices	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-[devmap_get_phone] ;
-!devmap.DEVMAP_DEVICE_GET_DEVICES ;
-!devmap.IPC_M_DATA_READ
Index: ntrib/arch/uspace/lib/libc/devmap_device_get_handle
===================================================================
--- contrib/arch/uspace/lib/libc/devmap_device_get_handle	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-[devmap_get_phone] ;
-!devmap.DEVMAP_DEVICE_GET_HANDLE ;
-!devmap.IPC_M_DATA_WRITE /* name */
Index: ntrib/arch/uspace/lib/libc/devmap_get_phone
===================================================================
--- contrib/arch/uspace/lib/libc/devmap_get_phone	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-!ns.IPC_M_CONNECT_ME_TO /* devmap */ +
-NULL
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_device_connect
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_device_connect	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!ns.ipc_m_connect_me_to /* device via devmap */
-)
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_device_get_count
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_device_get_count	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	[fnc.devmap_get_phone] ;
-	tentative {
-		!devmap_client.device_get_count
-	}
-)
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_device_get_devices
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_device_get_devices	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-(
-	[fnc.devmap_get_phone] ;
-	tentative {
-		!devmap_client.device_get_devices {
-			!devmap_client.ipc_m_data_read /* buffer */
-		}
-	}
-)
-
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_device_get_handle
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_device_get_handle	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-(
-	[fnc.devmap_get_phone] ;
-	tentative {
-		!devmap_client.device_get_handle {
-			!devmap_client.ipc_m_data_write /* name */
-		}
-	}
-)
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_device_register
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_device_register	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-(
-	[fnc.devmap_get_phone] ;
-	tentative {
-		!devmap_driver.device_register {
-			!devmap_driver.ipc_m_data_write /* name */
-		}
-	}
-)
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_driver_register
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_driver_register	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-(
-	[fnc.devmap_get_phone] ;
-	tentative {
-		!devmap_driver.driver_register {
-			!devmap_driver.ipc_m_data_write /* name */
-		} ;
-		tentative {
-			!devmap_driver.ipc_m_connect_to_me
-		}
-	}
-)
Index: ntrib/arch/uspace/lib/libc/fnc.devmap_get_phone
===================================================================
--- contrib/arch/uspace/lib/libc/fnc.devmap_get_phone	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	tentative {
-		!ns.ipc_m_connect_me_to /* devmap */
-	}
-)
Index: ntrib/arch/uspace/lib/libc/protocol
===================================================================
--- contrib/arch/uspace/lib/libc/protocol	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/* Protocol according to which libc uses kernel syscalls */
-(
-	!sys_kio.sys_kio +
-	!sys_thread.sys_thread_create +
-	!sys_thread.sys_thread_get_id +
-	!sys_thread.sys_thread_exit +
-	!sys_task.sys_task_set_name +
-	!sys_task.sys_task_get_id +
-	!sys_program.sys_program_spawn_loader +
-	!sys_futex.sys_futex_sleep_timeout +
-	!sys_futex.sys_futex_wakeup +
-	!sys_smc.sys_smc_coherence +
-	!sys_as.sys_as_area_create +
-	!sys_as.sys_as_area_resize +
-	!sys_as.sys_as_area_change_flags +
-	!sys_as.sys_as_area_destroy +
-	!sys_ipc.sys_ipc_call_sync_fast +
-	!sys_ipc.sys_ipc_call_sync_slow +
-	!sys_ipc.sys_ipc_call_async_fast +
-	!sys_ipc.sys_ipc_call_async_slow +
-	!sys_ipc.sys_ipc_forward_fast +
-	!sys_ipc.sys_ipc_forward_slow +
-	!sys_ipc.sys_ipc_answer_fast +
-	!sys_ipc.sys_ipc_answer_slow +
-	!sys_ipc.sys_ipc_hangup +
-	!sys_ipc.sys_ipc_wait_for_call +
-	!sys_ipc.sys_ipc_poke +
-	!sys_event.sys_event_subscribe +
-	!sys_cap.sys_cap_grant +
-	!sys_cap.sys_cap_rewoke +
-	!sys_ddi.sys_enable_iospace +
-	!sys_ddi.sys_physmem_map +
-	!sys_ddi.sys_device_assign_devno +
-	!sys_ddi.sys_preempt_control +
-	!sys_ddi.sys_register_irq +
-	!sys_ddi.sys_unregister_irq +
-	!sys_sysinfo.sys_sysinfo_valid +
-	!sys_sysinfo.sys_sysinfo_value +
-	!sys_debug.sys_ipc_connect_kbox
-)*
Index: ntrib/arch/uspace/lib/libc/requires
===================================================================
--- contrib/arch/uspace/lib/libc/requires	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-/* Kernel interfaces required by libc */
-sys_kio sys_kio;
-sys_tls sys_tls;
-sys_thread sys_thread;
-sys_task sys_task;
-sys_program sys_program;
-sys_futex sys_futex;
-sys_smc sys_smc;
-sys_as sys_as;
-sys_ipc sys_ipc;
-sys_event sys_event;
-sys_cap sys_cap;
-sys_ddi sys_ddi;
-sys_sysinfo sys_sysinfo;
-sys_debug sys_debug;
Index: ntrib/arch/uspace/lib/libc/subsume
===================================================================
--- contrib/arch/uspace/lib/libc/subsume	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-/* Subsume %% to kernel interfaces */
-subsume %%:sys_kio to sys_kio;
-subsume %%:sys_tls to sys_tls;
-subsume %%:sys_thread to sys_thread;
-subsume %%:sys_task to sys_task;
-subsume %%:sys_program to sys_program;
-subsume %%:sys_futex to sys_futex;
-subsume %%:sys_smc to sys_smc;
-subsume %%:sys_as to sys_as;
-subsume %%:sys_ipc to sys_ipc;
-subsume %%:sys_event to sys_event;
-subsume %%:sys_cap to sys_cap;
-subsume %%:sys_ddi to sys_ddi;
-subsume %%:sys_sysinfo to sys_sysinfo;
-subsume %%:sys_debug to sys_debug;
Index: ntrib/arch/uspace/lib/libfs/fnc.fs_register
===================================================================
--- contrib/arch/uspace/lib/libfs/fnc.fs_register	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-(
-	!vfs.register {
-		!vfs.ipc_m_data_write /* vfs_into_t */
-	} ;
-	!vfs.ipc_m_connect_to_me ;
-	!vfs.ipc_m_share_in
-)
Index: ntrib/arch/uspace/lib/libfs/fnc.libfs_lookup
===================================================================
--- contrib/arch/uspace/lib/libfs/fnc.libfs_lookup	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	alternative (fs; tmpfs_nested; fat_nested; devfs_nested) {
-		!fs.lookup
-	}
-)*
Index: ntrib/arch/uspace/lib/libfs/fnc.libfs_mount
===================================================================
--- contrib/arch/uspace/lib/libfs/fnc.libfs_mount	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-(
-	?ipc_m_connection_clone ;
-	?ipc_m_data_write /* mount options */ {
-		alternative (fs; tmpfs_nested; fat_nested; devfs_nested) {
-			!fs.ipc_m_connect_to_me ;
-			!fs.mounted {
-				!fs.ipc_m_data_write /* forward */
-			}
-		}
-	}
-)
Index: ntrib/arch/uspace/lib/libfs/fnc.libfs_open_node
===================================================================
--- contrib/arch/uspace/lib/libfs/fnc.libfs_open_node	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	NULL
-)
Index: ntrib/arch/uspace/lib/libfs/fnc.libfs_stat
===================================================================
--- contrib/arch/uspace/lib/libfs/fnc.libfs_stat	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	?ipc_m_data_read
-)
Index: ntrib/arch/uspace/srv/bd/bd.adl
===================================================================
--- contrib/arch/uspace/srv/bd/bd.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,26 +1,0 @@
-interface bd extends service {
-		/* Share out data buffer */
-		sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t flags, out sysarg_t dst_as_area_base);
-
-		/* Get block size */
-		sysarg_t get_block_size(out sysarg_t block_size);
-
-		/* Read blocks via shared data buffer */
-		sysarg_t read_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
-
-		/* Write blocks via shared data buffer */
-		sysarg_t write_blocks(in sysarg_t index_lower, in sysarg_t index_upper, in sysarg_t count);
-	protocol:
-		[bd.bp]
-};
-
-architecture bd {
-	inst rd rd;
-
-	[/uspace/lib/libc/subsume%rd]
-
-	delegate rd to rd:rd;
-
-	subsume rd:ns to ns;
-	subsume rd:devmap_driver to devmap_driver;
-};
Index: ntrib/arch/uspace/srv/bd/bd.bp
===================================================================
--- contrib/arch/uspace/srv/bd/bd.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-?ipc_m_connect_me_to ;
-?ipc_m_share_out ;
-(
-	?get_block_size +
-	?read_blocks +
-	?write_blocks
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/bd/rd/rd.adl
===================================================================
--- contrib/arch/uspace/srv/bd/rd/rd.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-interface rd extends bd;
-
-frame rd {
-	provides:
-		rd rd;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		devmap_driver devmap_driver;
-	initialization:
-		[/uspace/lib/libc/fnc.devmap_driver_register] ;
-		[/uspace/lib/libc/fnc.devmap_device_register]
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/console/console.adl
===================================================================
--- contrib/arch/uspace/srv/console/console.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-interface console extends service {
-		/* Read characters from console */
-		sysarg_t read(out_copy stream data);
-
-		/* Write characters to console */
-		sysarg_t write(in_copy stream data);
-
-		/* Get last event from event queue */
-		sysarg_t get_event(out sysarg_t type, out sysarg_t key, out sysarg_t mods, out sysarg_t char);
-
-		/* Flush output buffer */
-		sysarg_t sync(void);
-
-		/* Clear console */
-		sysarg_t clear(void);
-
-		/* Move cursor to given position */
-		sysarg_t goto(in sysarg_t col, in sysarg_t row);
-
-		/* Get console dimensions (in character cells) */
-		sysarg_t get_size(out sysarg_t cols, in sysarg_t rows);
-
-		/* Get color capabilities */
-		sysarg_t get_color_cap(void);
-
-		/* Set abstract text style */
-		sysarg_t set_style(in sysarg_t style);
-
-		/* Set EGA-based text color */
-		sysarg_t set_color(in sysarg_t fb_color, in sysarg_t bg_color, in sysarg_t attr);
-
-		/* Set RGB-based text color */
-		sysarg_t set_rgb_color(in sysarg_t fb_color, in sysarg_t bg_color);
-
-		/* Set cursor visibility */
-		sysarg_t cursor_visibility(in sysarg_t visible);
-
-		/* Switch to kernel debugging console (if available) */
-		sysarg_t kcon_enable(void);
-	protocol:
-		[console.bp]
-};
-
-frame ui_dispatcher {
-	provides:
-		console console;
-		event event;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		devmap_driver devmap_driver;
-		sys_console sys_console;
-		kbd kbd;
-		fb fb;
-	initialization:
-		!ns.ipc_m_connect_me_to /* kbd */ ;
-		!kbd.ipc_m_connect_to_me ;
-		!ns.ipc_m_connect_me_to /* fb */ ;
-		[/uspace/lib/libc/fnc.devmap_driver_register] ;
-		!fb.get_resolution ;
-		(
-			[fnc.vp_create] +
-			[fnc.vp_switch]
-		)* ;
-		[fnc.make_pixmap]* ;
-		[fnc.make_anim] ;
-		[fnc.vp_switch] ;
-		!fb.flush ;
-		!fb.get_csize ;
-		!fb.get_color_cap ;
-		!fb.ipc_m_share_out ;
-		[/uspace/lib/libc/fnc.devmap_device_register]* ;
-		!sys_console.sys_debug_disable_console ;
-		[fnc.gcons_redraw_console] ;
-		[fnc.set_rgb_color] ;
-		[fnc.screen_clear] ;
-		[fnc.curs_goto] ;
-		[fnc.curs_visibility]
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
-
-architecture console {
-	inst ui_dispatcher ui_dispatcher;
-	inst kbd kbd;
-	inst fb fb;
-
-	bind ui_dispatcher:kbd to kbd:kbd;
-	bind ui_dispatcher:fb to fb:fb;
-
-	bind kbd:event to ui_dispatcher:event;
-
-	delegate console to ui_dispatcher:console;
-	delegate kbd to kbd:kbd;
-	delegate fb to fb:fb;
-
-	[/uspace/lib/libc/subsume%ui_dispatcher]
-	[/uspace/lib/libc/subsume%kbd]
-	[/uspace/lib/libc/subsume%fb]
-
-	subsume ui_dispatcher:ns to ns;
-	subsume ui_dispatcher:devmap_driver to devmap_driver;
-	subsume ui_dispatcher:sys_console to sys_console;
-
-	subsume kbd:ns to ns;
-	subsume fb:ns to ns;
-};
Index: ntrib/arch/uspace/srv/console/console.bp
===================================================================
--- contrib/arch/uspace/srv/console/console.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-?ipc_m_connect_me_to ;
-[fnc.gcons_notify_connect] ;
-(
-	?read {
-		[fnc.cons_read]
-	} +
-
-	?write {
-		[fnc.cons_write]
-	} +
-
-	?sync {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			!fb.flush ;
-			[fnc.curs_goto]
-		}
-	} +
-
-	?clear {
-		tentative {
-			!fb.flush
-		}
-	} +
-
-	?goto {
-		tentative {
-			!fb.curs_goto
-		}
-	} +
-
-	?set_style {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			[fnc.set_style]
-		}
-	} +
-
-	?set_color {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			[fnc.set_color]
-		}
-	} +
-
-	?set_rgb_color {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			[fnc.set_rgb_color]
-		}
-	} +
-
-	?cursor_visibility {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			[fnc.curs_visibility]
-		}
-	} +
-
-	?kcon_enable {
-		!sys_console.sys_debug_enable_console
-	} +
-
-	?get_event +
-	?get_size +
-	?get_color_cap
-)* ;
-?ipc_m_phone_hungup {
-	[fnc.gcons_notify_disconnect]
-}
Index: ntrib/arch/uspace/srv/console/fnc.cell_mark_changed
===================================================================
--- contrib/arch/uspace/srv/console/fnc.cell_mark_changed	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	tentative {
-		[fnc.fb_pending_flush]
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.clear
===================================================================
--- contrib/arch/uspace/srv/console/fnc.clear	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.clear
-)
Index: ntrib/arch/uspace/srv/console/fnc.cons_read
===================================================================
--- contrib/arch/uspace/srv/console/fnc.cons_read	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	?ipc_m_data_read
-)
Index: ntrib/arch/uspace/srv/console/fnc.cons_write
===================================================================
--- contrib/arch/uspace/srv/console/fnc.cons_write	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	?ipc_m_data_write ;
-	[fnc.write_char]* ;
-	[fnc.gcons_notify_char]
-)
Index: ntrib/arch/uspace/srv/console/fnc.curs_goto
===================================================================
--- contrib/arch/uspace/srv/console/fnc.curs_goto	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.cursor_goto
-)
Index: ntrib/arch/uspace/srv/console/fnc.curs_visibility
===================================================================
--- contrib/arch/uspace/srv/console/fnc.curs_visibility	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.cursor_visibility
-)
Index: ntrib/arch/uspace/srv/console/fnc.draw_pixmap
===================================================================
--- contrib/arch/uspace/srv/console/fnc.draw_pixmap	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	!fb.prepare_shm ;
-	!fb.ipc_m_share_out ;
-	!fb.draw_ppm ;
-	!fb.drop_shm
-)
Index: ntrib/arch/uspace/srv/console/fnc.fb_pending_flush
===================================================================
--- contrib/arch/uspace/srv/console/fnc.fb_pending_flush	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.draw_text_data
-)
Index: ntrib/arch/uspace/srv/console/fnc.gcons_notify_char
===================================================================
--- contrib/arch/uspace/srv/console/fnc.gcons_notify_char	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	tentative {
-		[fnc.redraw_state] ;
-		[fnc.vp_switch]
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.gcons_notify_connect
===================================================================
--- contrib/arch/uspace/srv/console/fnc.gcons_notify_connect	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	tentative {
-		[fnc.redraw_state] ;
-		[fnc.vp_switch]
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.gcons_notify_disconnect
===================================================================
--- contrib/arch/uspace/srv/console/fnc.gcons_notify_disconnect	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	tentative {
-		[fnc.redraw_state] ;
-		[fnc.vp_switch]
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.gcons_redraw_console
===================================================================
--- contrib/arch/uspace/srv/console/fnc.gcons_redraw_console	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-(
-	tentative {
-		[fnc.vp_switch] ;
-		[fnc.set_rgb_color] ;
-		[fnc.clear] ;
-		[fnc.draw_pixmap] ;
-		[fnc.draw_pixmap] ;
-		[fnc.redraw_state]* ;
-		[fnc.vp_switch]
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.make_anim
===================================================================
--- contrib/arch/uspace/srv/console/fnc.make_anim	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	!fb.anim_create ;
-	[fnc.make_pixmap]* ;
-	!fb.anim_add_pixmap ;
-	!fb.anim_start
-)
Index: ntrib/arch/uspace/srv/console/fnc.make_pixmap
===================================================================
--- contrib/arch/uspace/srv/console/fnc.make_pixmap	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-(
-	!fb.prepare_shm ;
-	!fb.ipc_m_share_out ;
-	!fb.shm2pixmap ;
-	!fb.drop_shm
-)
Index: ntrib/arch/uspace/srv/console/fnc.redraw_state
===================================================================
--- contrib/arch/uspace/srv/console/fnc.redraw_state	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-(
-	[fnc.vp_switch] ;
-	tentative {
-		!fb.vp_draw_pixmap
-	} ;
-	tentative {
-		!fb.putchar*
-	}
-)
Index: ntrib/arch/uspace/srv/console/fnc.screen_clear
===================================================================
--- contrib/arch/uspace/srv/console/fnc.screen_clear	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.clear
-)
Index: ntrib/arch/uspace/srv/console/fnc.set_color
===================================================================
--- contrib/arch/uspace/srv/console/fnc.set_color	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.set_color
-)
Index: ntrib/arch/uspace/srv/console/fnc.set_rgb_color
===================================================================
--- contrib/arch/uspace/srv/console/fnc.set_rgb_color	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.set_rgb_color
-)
Index: ntrib/arch/uspace/srv/console/fnc.set_style
===================================================================
--- contrib/arch/uspace/srv/console/fnc.set_style	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.set_style
-)
Index: ntrib/arch/uspace/srv/console/fnc.vp_create
===================================================================
--- contrib/arch/uspace/srv/console/fnc.vp_create	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.viewport_create
-)
Index: ntrib/arch/uspace/srv/console/fnc.vp_switch
===================================================================
--- contrib/arch/uspace/srv/console/fnc.vp_switch	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fb.viewport_switch
-)
Index: ntrib/arch/uspace/srv/console/fnc.write_char
===================================================================
--- contrib/arch/uspace/srv/console/fnc.write_char	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-(
-	(
-		[fnc.fb_pending_flush] +
-		[fnc.cell_mark_changed]
-	) ;
-	tentative {
-		[fnc.fb_pending_flush] ;
-		tentative {
-			!fb.scroll
-		}
-	} ;
-	tentative {
-		[fnc.curs_goto]
-	}
-)
Index: ntrib/arch/uspace/srv/devmap/devmap.adl
===================================================================
--- contrib/arch/uspace/srv/devmap/devmap.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-interface devmap_driver {
-		/* Establish connection (iface is DEVMAP_DRIVER) */
-		sysarg_t ipc_m_connect_me_to(in sysarg_t iface);
-
-		/* Register as a new driver */
-		sysarg_t driver_register(in_copy string name);
-
-		/* Unregister all devices and the driver itself */
-		sysarg_t driver_unregister(void);
-
-		/* Register new device and return handle */
-		sysarg_t device_register(in_copy string name, out sysarg_t handle);
-
-		/* Unregister device */
-		sysarg_t device_unregister(in sysarg_t handle);
-
-		/* Resolve device name to handle */
-		sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
-
-		/* Get device name for a given handle */
-		sysarg_t device_get_name(in sysarg_t handle);
-
-		/* Close connection */
-		sysarg_t ipc_m_phone_hungup(void);
-	protocol:
-		[devmap_driver.bp]
-};
-
-interface devmap_client {
-		/* Establish connection (iface is DEVMAP_CLIENT) or forward to device (iface is DEVMAP_CONNECT_TO_DEVICE) */
-		sysarg_t ipc_m_connect_me_to(in sysarg_t iface, in sysarg_t handle);
-
-		/* Resolve device name to handle */
-		sysarg_t device_get_handle(in sysarg_t flags, in_copy string name);
-
-		/* Get device name for a given handle */
-		sysarg_t device_get_name(in sysarg_t handle);
-
-		/* Clone NULL device */
-		sysarg_t device_null_create(out sysarg_t index);
-
-		/* Destroy NULL device */
-		sysarg_t device_null_destroy(in sysarg_t index);
-
-		/* Get number of devices */
-		sysarg_t device_get_count(out sysarg_t count);
-
-		/* Get an array of (device_name, handle) pairs */
-		sysarg_t device_get_devices(out_copy stream data);
-
-		/* Close connection */
-		sysarg_t ipc_m_phone_hungup(void);
-	protocol:
-		[devmap_client.bp]
-
-};
-
-frame devmap {
-	provides:
-		devmap_driver devmap_driver;
-		devmap_client devmap_client;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		rd rd;
-		console console;
-	initialization:
-		!ns.ipc_m_connect_to_me /* devmap */
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/devmap/devmap_client.bp
===================================================================
--- contrib/arch/uspace/srv/devmap/devmap_client.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-?ipc_m_connect_me_to ;
-
-alternative (service; rd; console) {
-	!service.ipc_m_connect_me_to /* forward */
-}
-+
-(
-	(
-		?device_get_handle {
-			?ipc_m_data_write /* device name */
-		} +
-
-		?device_get_name +
-		?device_null_create +
-		?device_null_destroy +
-		?device_get_count +
-
-		?device_get_devices {
-			?ipc_m_data_read /* buffer */
-		}
-	)*
-) ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/devmap/devmap_driver.bp
===================================================================
--- contrib/arch/uspace/srv/devmap/devmap_driver.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-?ipc_m_connect_me_to ;
-?driver_register {
-	tentative {
-		?ipc_m_data_write /* driver name */
-	}
-} ;
-(
-	?device_register {
-		tentative {
-			?ipc_m_data_write /* device name */
-		} ;
-		tentative {
-			?ipc_m_connect_to_me /* callback */
-		}
-	} +
-
-	?device_get_handle {
-		?ipc_m_data_write /* device name */
-	} +
-
-	?device_get_name +
-	?device_unregister +
-	?driver_unregister
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/fb/fb.adl
===================================================================
--- contrib/arch/uspace/srv/fb/fb.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-interface fb extends service {
-		/* Get screen resolution */
-		sysarg_t get_resolution(out sysarg_t width, out sysarg_t height);
-
-		/* Yield screen */
-		sysarg_t screen_yield(void);
-
-		/* Reclaim screen */
-		sysarg_t screen_reclaim(void);
-
-		/* Set mouse cursor position on screen */
-		sysarg_t pointer_move(in sysarg_t x, in sysarg_t y);
-
-		/* Create new viewport */
-		sysarg_t viewport_create(in sysarg_t origin, in sysarg_t dimension);
-
-		/* Get viewport size in character cells */
-		sysarg_t get_csize(out sysarg_t width, out sysarg_t height);
-
-		/* Clear viewport character buffer */
-		sysarg_t clear(void);
-
-		/* Scroll viewport character buffer */
-		sysarg_t scroll(in sysarg_t lines);
-
-		/* Set active viewport */
-		sysarg_t viewport_switch(in sysarg_t index);
-
-		/* Delete viewport */
-		sysarg_t viewport_delete(in sysarg_t index);
-
-		/* Get color capabilities of the screen */
-		sysarg_t get_color_cap(void);
-
-		/* Set abstract text style */
-		sysarg_t set_style(in sysarg_t style);
-
-		/* Set EGA-based text color */
-		sysarg_t set_color(in sysarg_t fg_color, in sysarg_t bg_color, in sysarg_t atrr);
-
-		/* Set RGB-based text color */
-		sysarg_t set_rgb_color(in sysarg_t fg_color, in sysarg_t bg_color);
-
-		/* Put a character to a given position in viewport character buffer */
-		sysarg_t putchar(in sysarg_t char, in sysarg_t col, in sysarg_t row);
-
-		/* Set character cursor visibility in viewport */
-		sysarg_t cursor_visibility(in sysarg_t visible);
-
-		/* Set character cursor position in viewport */
-		sysarg_t cursor_goto(in sysarg_t col, in sysarg_t row);
-
-		/* Prepare memory sharing of bitmaps */
-		sysarg_t prepare_shm(in sysarg_t as_area_base);
-
-		/* Share bitmap or text data */
-		sysarg_t ipc_m_share_out(in sysarg_t as_area_base, in sysarg_t as_area_size, out sysarg_t dst_as_area);
-
-		/* Drop memory sharing */
-		sysarg_t drop_shm(void);
-
-		/* Draw PPM data from shared memory to viewport */
-		sysarg_t draw_ppm(in sysarg_t x, in sysarg_t y);
-
-		/* Put characters from shared memory to viewport */
-		sysarg_t draw_text_data(in sysarg_t x, in sysarg_t y, in sysarg_t width, in sysarg_t height);
-
-		/* Convert PPM data from shared memory to pixmap */
-		sysarg_t shm2pixmap(void);
-
-		/* Save viewport contents to a pixmap */
-		sysarg_t vp2pixmap(in sysarg_t vp_index);
-
-		/* Draw pixmap to viewport */
-		sysarg_t vp_draw_pixmap(in sysarg_t vp_index, in sysarg_t pm_index);
-
-		/* Discard pixmap */
-		sysarg_t drop_pixmap(in sysarg_t pm_index);
-
-		/* Create new (empty) animation for a viewport */
-		sysarg_t anim_create(in sysarg_t vp_index);
-
-		/* Append a pixmap to an animation */
-		sysarg_t anim_addpixmap(in sysarg_t anim_index, in sysarg_t pm_index);
-
-		/* Change a viewport associated with an animation */
-		sysarg_t anim_chgvp(in sysarg_t anim_index, in sysarg_t vp_index);
-
-		/* Start animation playback */
-		sysarg_t anim_start(in sysarg_t anim_index);
-
-		/* Stop animation playback */
-		sysarg_t anim_stop(in sysarg_t anim_index);
-
-		/* Delete animation */
-		sysarg_t anim_drop(in sysarg_t anim_index);
-	protocol:
-		[fb.bp]
-};
-
-frame fb {
-	provides:
-		fb fb;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-	initialization:
-		!ns.ipc_m_connect_to_me /* fb */
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/fb/fb.bp
===================================================================
--- contrib/arch/uspace/srv/fb/fb.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-?ipc_m_connect_me_to ;
-(
-	(
-		?prepare_shm ;
-		?ipc_m_share_out
-	) +
-	?ipc_m_share_out +
-	?drop_shm +
-	?get_resolution +
-	?screen_yield +
-	?screen_reclaim +
-	?pointer_move +
-	?viewport_create +
-	?get_csize +
-	?clear +
-	?scroll +
-	?viewport_switch +
-	?viewport_delete +
-	?get_color_cap +
-	?set_style +
-	?set_color +
-	?set_rgb_color +
-	?putchar +
-	?cursor_visibility +
-	?cursor_goto +
-	?draw_ppm +
-	?draw_text_data +
-	?shm2pixmap +
-	?vp2pixmap +
-	?vp_draw_pixmap +
-	?drop_pixmap +
-	?anim_create +
-	?anim_addpixmap +
-	?anim_chgvp +
-	?anim_start +
-	?anim_stop +
-	?anim_drop
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/fs/devfs/devfs.adl
===================================================================
--- contrib/arch/uspace/srv/fs/devfs/devfs.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,21 +1,0 @@
-interface devfs extends fs {
-	protocol:
-		[devfs.bp]
-};
-
-frame devfs {
-	provides:
-		devfs devfs;
-	requires:
-		[/uspace/lib/libc/requires]
-		vfs vfs;
-		ns ns;
-		devmap_client devmap_client;
-		service device;
-	initialization:
-		[/uspace/lib/libc/fnc.devmap_get_phone] ;
-		!ns.ipc_m_connect_me_to /* vfs */ ;
-		[/uspace/lib/libfs/fnc.fs_register]
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/fs/devfs/devfs.bp
===================================================================
--- contrib/arch/uspace/srv/fs/devfs/devfs.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-(
-	?ipc_m_connect_me_to ;
-	(
-		?mounted {
-			?ipc_m_data_write /* mount options */
-		} +
-
-		?lookup {
-			tentative {
-				[/uspace/lib/libc/fnc.devmap_device_get_handle] ;
-				tentative {
-					[/uspace/lib/libc/fnc.devmap_device_connect]
-				}
-			}
-		} +
-
-		?open_node {
-			tentative {
-				[/uspace/lib/libc/fnc.devmap_device_connect]
-			}
-		} +
-
-		?read {
-			tentative {
-				?ipc_m_data_read /* payload */ {
-					!device.read {
-						!device.ipc_m_data_read /* forward */
-					}
-				} +
-				(
-					[/uspace/lib/libc/fnc.devmap_device_get_count] ;
-					[/uspace/lib/libc/fnc.devmap_device_get_devices]
-				)
-			}
-		} +
-
-		?write {
-			tentative {
-				?ipc_m_data_write /* payload */ {
-					!device.write {
-						!device.ipc_m_data_write /* forward */
-					}
-				}
-			}
-		} +
-
-		?stat {
-			?ipc_m_data_read /* struct data */
-		} +
-
-		?close {
-			!device.ipc_m_phone_hungup
-		} +
-
-		?mount +
-		?truncate +
-		?destroy +
-		?sync
-	)* ;
-	?ipc_m_phone_hungup
-)* ;
-!vfs.ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/fs/fat/fat.adl
===================================================================
--- contrib/arch/uspace/srv/fs/fat/fat.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-interface fat extends fs {
-	protocol:
-		[fat.bp]
-};
-
-frame fat {
-	provides:
-		fat fat;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		rd rd;
-		vfs vfs;
-		tmpfs tmpfs_nested;
-		fat fat_nested;
-		devfs devfs_nested;
-	initialization:
-		!ns.ipc_m_connect_me_to /* vfs */ ;
-		[/uspace/lib/libfs/fnc.fs_register]
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/fs/fat/fat.bp
===================================================================
--- contrib/arch/uspace/srv/fs/fat/fat.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-!ns.ipc_m_connect_me_to /* vfs */ ;
-[/uspace/lib/libfs/fnc.fs_register] ;
-(
-	?ipc_m_connect_me_to ;
-	(
-		?mounted {
-			?ipc_m_data_write /* mount options */ ;
-			tentative {
-				[/uspace/lib/block/fnc.block_init%rd]
-			}
-		} +
-
-		?mount {
-			[/uspace/lib/libfs/fnc.libfs_mount]
-		} +
-
-		?lookup {
-			[/uspace/lib/libfs/fnc.libfs_lookup]
-		} +
-
-		?open_node {
-			[/uspace/lib/libfs/fnc.libfs_open_node]
-		} +
-
-		?read {
-			tentative {
-				?ipc_m_data_read /* payload */
-			}
-		} +
-
-		?write {
-			tentative {
-				?ipc_m_data_write /* payload */
-			}
-		} +
-
-		?stat {
-			[/uspace/lib/libfs/fnc.libfs_stat]
-		} +
-
-		?truncate +
-		?close +
-		?destroy +
-		?sync
-	)* ;
-	?ipc_m_phone_hungup
-)* ;
-!vfs.ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/fs/tmpfs/fnc.tmpfs_restore
===================================================================
--- contrib/arch/uspace/srv/fs/tmpfs/fnc.tmpfs_restore	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-(
-	[/uspace/lib/libblock/fnc.block_init%rd] ;
-	tentative {
-		[/uspace/lib/libblock/fnc.block_seqread%rd]* ;
-		[/uspace/lib/libblock/fnc.block_fini%rd]
-	}
-)
Index: ntrib/arch/uspace/srv/fs/tmpfs/tmpfs.adl
===================================================================
--- contrib/arch/uspace/srv/fs/tmpfs/tmpfs.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-interface tmpfs extends fs {
-	protocol:
-		[tmpfs.bp]
-};
-
-frame tmpfs {
-	provides:
-		tmpfs tmpfs;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		rd rd;
-		vfs vfs;
-		tmpfs tmpfs_nested;
-		fat fat_nested;
-		devfs devfs_nested;
-	initialization:
-		!ns.ipc_m_connect_me_to /* vfs */ ;
-		[/uspace/lib/libfs/fnc.fs_register]
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/fs/tmpfs/tmpfs.bp
===================================================================
--- contrib/arch/uspace/srv/fs/tmpfs/tmpfs.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-(
-	?ipc_m_connect_me_to ;
-	(
-		?mounted {
-			?ipc_m_data_write /* mount options */ ;
-			tentative {
-				[fnc.tmpfs_restore]
-			}
-		} +
-
-		?mount {
-			[/uspace/lib/libfs/fnc.libfs_mount]
-		} +
-
-		?lookup {
-			[/uspace/lib/libfs/fnc.libfs_lookup]
-		} +
-
-		?open_node {
-			[/uspace/lib/libfs/fnc.libfs_open_node]
-		} +
-
-		?read {
-			tentative {
-				?ipc_m_data_read /* payload */
-			}
-		} +
-
-		?write {
-			tentative {
-				?ipc_m_data_write /* payload */
-			}
-		} +
-
-		?stat {
-			[/uspace/lib/libfs/fnc.libfs_stat]
-		} +
-
-		?truncate +
-		?close +
-		?destroy +
-		?sync
-	)* ;
-	?ipc_m_phone_hungup
-)* ;
-!vfs.ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/kbd/event.bp
===================================================================
--- contrib/arch/uspace/srv/kbd/event.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-?ipc_m_connect_me_to ;
-?event {
-	tentative {
-		!sys_console.sys_enable_console
-	}
-}* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/kbd/kbd.adl
===================================================================
--- contrib/arch/uspace/srv/kbd/kbd.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-interface kbd extends service {
-		/* Callback connection */
-		sysarg_t ipc_m_connect_to_me(void);
-
-		/* Yield hardware */
-		sysarg_t yield(void);
-
-		/* Reclaim hardware */
-		sysarg_t reclaim(void);
-	protocol:
-		[kbd.bp]
-};
-
-interface event {
-		/* Send keyboard event */
-		sysarg_t event(in sysarg_t type, in sysarg_t key, in sysarg_t mods, in sysarg_t char);
-	protocol:
-		[event.bp]
-};
-
-frame kbd {
-	provides:
-		kbd kbd;
-	requires:
-		[/uspace/lib/libc/requires]
-		event event;
-		ns ns;
-	initialization:
-		!ns.ipc_m_connect_to_me /* kbd */ ;
-		!event.event*
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/kbd/kbd.bp
===================================================================
--- contrib/arch/uspace/srv/kbd/kbd.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-?ipc_m_connect_me_to ;
-(
-	?ipc_m_connect_to_me +
-	?yield +
-	?reclam
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/loader/loader.adl
===================================================================
--- contrib/arch/uspace/srv/loader/loader.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-interface loader extends service {
-		/* Set task pathname */
-		sysarg_t set_pathname(in_copy string pathname);
-
-		/* Set task arguments */
-		sysarg_t set_args(in_copy stream args);
-
-		/* Set task initial files */
-		sysarg_t set_files(in_copy stream files);
-
-		/* Get task ID */
-		sysarg_t get_taskid(out_copy stream id);
-
-		/* Load binary */
-		sysarg_t load(void);
-
-		/* Run binary */
-		sysarg_t run(void);
-	protocol:
-		[loader.bp]
-};
-
-frame loader {
-	provides:
-		loader loader;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-	initialization:
-		!ns.id_intro ;
-		!ns.ipc_m_connect_to_me /* loader */
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/loader/loader.bp
===================================================================
--- contrib/arch/uspace/srv/loader/loader.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-(
-	?get_taskid {
-		?ipc_m_data_read /* task ID */
-	} +
-
-	?set_pathname {
-		?ipc_m_data_write /* pathname */
-	} +
-
-	?set_args {
-		?ipc_m_data_write /* arguments */
-	} +
-
-	?set_files {
-		?ipc_m_data_write /* files */
-	} +
-
-	?load
-)* ;
-(
-	?run +
-	?ipc_m_phone_hungup
-)
Index: ntrib/arch/uspace/srv/ns/ns.adl
===================================================================
--- contrib/arch/uspace/srv/ns/ns.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-interface ns {
-		/* Register a clonable service or a generic service */
-		sysarg_t ipc_m_connect_to_me(in sysarg_t service);
-
-		/* Connect to a clonable service or a generic service */
-		sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags);
-
-		/* Share real-time clock page or kio page */
-		sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service);
-
-		/* For IPC testing purposes */
-		sysarg_t ping(void);
-
-		/* Wait for task exit and get exit status and return value */
-		sysarg_t task_wait(in sysarg_t id_lower, in sysarg_t id_upper, out sysarg_t status, out sysarg_t retval);
-
-		/* Introduce a new loader task id in such a way it cannot be spoofed */
-		sysarg_t id_intro(in sysarg_t id_lower, in sysarg_t id_upper);
-
-		/* Set task return value */
-		sysarg_t retval(in sysarg_t retval);
-
-		/* Implicit connection close */
-		sysarg_t ipc_m_phone_hungup(void);
-	protocol:
-		[ns.bp]
-};
-
-frame ns {
-	provides:
-		ns ns;
-	requires:
-		[/uspace/lib/libc/requires]
-		kbd kbd;
-		fb fb;
-		console console;
-		vfs vfs;
-		devmap_driver devmap_driver;
-		devmap_client devmap_client;
-		loader loader;
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
Index: ntrib/arch/uspace/srv/ns/ns.bp
===================================================================
--- contrib/arch/uspace/srv/ns/ns.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/* Every task has an implicit connection to the Naming Service,
-   thus there is no explicit ?ipc_m_connect_me_to */
-
-(
-	?ipc_m_connect_to_me {
-		tentative {
-			!loader.ipc_m_connect_to_me /* forward */
-		}
-	} +
-
-	?ipc_m_connect_me_to {
-		tentative {
-			alternative (service; kbd; fb; console; vfs; devmap_driver; devmap_client) {
-				!service.ipc_m_connect_me_to /* forward */
-			}
-		}
-	} +
-
-	?ipc_m_share_in +
-	?ping +
-	?task_wait +
-	?id_intro +
-	?retval
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/arch/uspace/srv/ns/service.adl
===================================================================
--- contrib/arch/uspace/srv/ns/service.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-interface service {
-		/* Establish connection with the service
-		   (this call is forwarded from Naming Service or Device Mapper) */
-		sysarg_t ipc_m_connect_me_to(void);
-
-		/* Close connection */
-		sysarg_t ipc_m_phone_hungup(void);
-};
Index: ntrib/arch/uspace/srv/vfs/fnc.vfs_grab_phone
===================================================================
--- contrib/arch/uspace/srv/vfs/fnc.vfs_grab_phone	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fs.ipc_m_connect_me_to
-)
Index: ntrib/arch/uspace/srv/vfs/fnc.vfs_lookup_internal
===================================================================
--- contrib/arch/uspace/srv/vfs/fnc.vfs_lookup_internal	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	[fnc.vfs_grab_phone] ;
-	!fs.lookup ;
-	[fnc.vfs_release_phone]
-)
Index: ntrib/arch/uspace/srv/vfs/fnc.vfs_open_node_internal
===================================================================
--- contrib/arch/uspace/srv/vfs/fnc.vfs_open_node_internal	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-(
-	[fnc.vfs_grab_phone] ;
-	!fs.open_node ;
-	[fnc.vfs_release_phone]
-)
Index: ntrib/arch/uspace/srv/vfs/fnc.vfs_release_phone
===================================================================
--- contrib/arch/uspace/srv/vfs/fnc.vfs_release_phone	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-(
-	!fs.ipc_m_phone_hungup
-)
Index: ntrib/arch/uspace/srv/vfs/vfs.adl
===================================================================
--- contrib/arch/uspace/srv/vfs/vfs.adl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-interface vfs extends service {
-		/* Register a filesystem driver */
-		sysarg_t register(in_copy string name);
-
-		/* Mount filesystem */
-		sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, in_copy string fs);
-
-		/* Open file */
-		sysarg_t open(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, in_copy string path, out sysarg_t fd);
-
-		/* Open file using node */
-		sysarg_t open_node(in sysarg_t fs_handle, in sysarg_t dev_handle, in sysarg_t index, in sysarg_t oflag, out sysarg_t fd);
-
-		/* Read data from file */
-		sysarg_t read(in sysarg_t fd, out_copy stream data);
-
-		/* Write data to file */
-		sysarg_t write(in sysarg_t fd, in_copy stream data);
-
-		/* Seek in file */
-		sysarg_t seek(in sysarg_t fd, in sysarg_t offset, in sysarg_t whence);
-
-		/* Truncate file */
-		sysarg_t truncate(in sysarg_t fd, in sysarg_t size);
-
-		/* Get file metadata */
-		sysarg_t fstat(in sysarg_t fd, out_copy stream stat);
-
-		/* Get directory entry metadata */
-		sysarg_t stat(in_copy string path, out_copy stream stat);
-
-		/* Create directory */
-		sysarg_t mkdir(in sysarg_t mode, in_copy string path);
-
-		/* Delete directory entry */
-		sysarg_t unlink(in sysarg_t lflag, in_copy string path);
-
-		/* Rename directory entry */
-		sysarg_t rename(in_copy string old, in_copy string new);
-
-		/* Flush file buffers */
-		sysarg_t sync(in sysarg_t fd);
-
-		/* In-protocol status value */
-		sysarg_t ipc_m_ping(void);
-
-		/* Close connection */
-		sysarg_t ipc_m_phone_hungup(void);
-	protocol:
-		[vfs.bp]
-};
-
-interface fs extends service {
-		/* Notify filesystem that it was mounted */
-		sysarg_t mounted(in sysarg_t dev_handle, in_copy string opts);
-
-		/* Mount filesystem */
-		sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, ...);
-
-		/* Open file by node */
-		sysarg_t open_node(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
-
-		/* Lookup file */
-		sysarg_t lookup(in sysarg_t lflag, in sysarg_t oflag, in sysarg_t mode, ...);
-
-		/* Read data from file */
-		sysarg_t read(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, out_copy stream data);
-
-		/* Write data to file */
-		sysarg_t write(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t offset, in_copy stream data);
-
-		/* Truncate file */
-		sysarg_t truncate(in sysarg_t dev_handle, in sysarg_t fs_index, in sysarg_t size);
-
-		/* Get directory entry metadata */
-		sysarg_t stat(in sysarg_t dev_handle, in sysarg_t fs_index, out_copy stream stat);
-
-		/* Flush file buffers */
-		sysarg_t sync(in sysarg_t dev_handle, in sysarg_t fs_index);
-
-		/* Notify on file close */
-		sysarg_t close(in sysarg_t dev_handle, in sysarg_t fs_index);
-};
-
-frame io_dispatcher {
-	provides:
-		vfs vfs;
-	requires:
-		[/uspace/lib/libc/requires]
-		ns ns;
-		tmpfs tmpfs;
-		fat fat;
-		devfs devfs;
-	initialization:
-		!ns.ipc_m_connect_to_me /* vfs */
-	protocol:
-		[/uspace/lib/libc/protocol]
-};
-
-architecture vfs {
-	inst io_dispatcher io_dispatcher;
-	inst tmpfs tmpfs;
-	inst fat fat;
-	inst devfs devfs;
-
-	bind io_dispatcher:tmpfs to tmpfs:tmpfs;
-	bind io_dispatcher:fat to fat:fat;
-	bind io_dispatcher:devfs to devfs:devfs;
-
-	bind tmpfs:vfs to io_dispatcher:vfs;
-	bind fat:vfs to io_dispatcher:vfs;
-	bind devfs:vfs to io_dispatcher:vfs;
-
-	bind tmpfs:tmpfs_nested to tmpfs:tmpfs;
-	bind tmpfs:fat_nested to fat:fat;
-	bind tmpfs:devfs_nested to devfs:devfs;
-
-	bind fat:tmpfs_nested to tmpfs:tmpfs;
-	bind fat:fat_nested to fat:fat;
-	bind fat:devfs_nested to devfs:devfs;
-
-	delegate vfs to io_dispatcher:vfs;
-
-	[/uspace/lib/libc/subsume%io_dispatcher]
-	[/uspace/lib/libc/subsume%tmpfs]
-	[/uspace/lib/libc/subsume%fat]
-	[/uspace/lib/libc/subsume%devfs]
-
-	subsume io_dispatcher:ns to ns;
-	subsume tmpfs:ns to ns;
-	subsume fat:ns to ns;
-	subsume devfs:ns to ns;
-
-	subsume tmpfs:rd to rd;
-	subsume fat:rd to rd;
-
-	subsume devfs:devmap_client to devmap_client;
-	subsume devfs:device to device;
-};
Index: ntrib/arch/uspace/srv/vfs/vfs.bp
===================================================================
--- contrib/arch/uspace/srv/vfs/vfs.bp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-?ipc_m_connect_me_to ;
-(
-	?register {
-		?ipc_m_data_write /* fs name */ ;
-		tentative {
-			/* callback connection */
-			?ipc_m_connect_to_me ;
-			?ipc_m_share_in
-		}
-	} +
-
-	?mount {
-		?ipc_m_data_write /* mount point */ ;
-		tentative {
-			?ipc_m_data_write /* mount options */ ;
-			tentative {
-				?ipc_m_data_write /* fs name */ ;
-				tentative {
-					?ipc_m_ping ;
-					tentative {
-						(
-							/* root fs */
-							alternative (fs; tmpfs; fat; devfs) {
-								!fs.mounted {
-									!fs.ipc_m_data_write /* mount options */
-								}
-							}
-						) +
-						(
-							/* non-root fs */
-							tentative {
-								alternative (fs; tmpfs; fat; devfs) {
-									[fnc.vfs_lookup_internal] ;
-									tentative {
-										[fnc.vfs_grab_phone] ;
-										[fnc.vfs_grab_phone] ;
-										!fs.mount ;
-										!fs.ipc_m_connection_clone ;
-										[fnc.vfs_release_phone] ;
-										tentative {
-											!fs.vfs_m_data_write /* mount options */
-										} ;
-										[fnc.vfs_release_phone]
-									}
-								}
-							}
-						)
-					}
-				}
-			}
-		}
-	} +
-
-	?open {
-		tentative {
-			?ipc_m_data_write /* path */ ;
-			tentative {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_lookup_internal] ;
-					tentative {
-						[fnc.vfs_grab_phone] ;
-						!fs.truncate ;
-						[fnc.vfs_release_phone]
-					}
-				}
-			}
-		}
-	} +
-
-	?open_node {
-		alternative (fs; tmpfs; fat; devfs) {
-			[fnc.vfs_open_node_internal] ;
-			tentative {
-				[fnc.vfs_grab_phone] ;
-				!fs.truncate ;
-				[fnc.vfs_release_phone]
-			}
-		}
-	} +
-
-	?close {
-		tentative {
-			alternative (fs; tmpfs; fat; devfs) {
-				[fnc.vfs_grab_phone] ;
-				!fs.close ;
-				[fnc.vfs_release_phone]
-			}
-		}
-	} +
-
-	?read {
-		tentative {
-			?ipc_m_data_read {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_grab_phone] ;
-					!fs.read {
-						!fs.ipc_m_data_read /* forward payload */
-					} ;
-					[fnc.vfs_release_phone]
-				}
-			}
-		}
-	} +
-
-	?write {
-		tentative {
-			?ipc_m_data_write {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_grab_phone] ;
-					!fs.write {
-						!fs.ipc_m_data_write /* forward payload */
-					} ;
-					[fnc.vfs_release_phone]
-				}
-			}
-		}
-	} +
-
-	?truncate {
-		tentative {
-			alternative (fs; tmpfs; fat; devfs) {
-				[fnc.vfs_grab_phone] ;
-				!fs.truncate ;
-				[fnc.vfs_release_phone]
-			}
-		}
-	} +
-
-	?fstat {
-		tentative {
-			?ipc_m_data_read /* vfs_stat_t */ {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_grab_phone] ;
-					!fs.stat {
-						!fs.ipc_m_data_read /* forward vfs_stat_t */
-					} ;
-					[fnc.vfs_release_phone]
-				}
-			}
-		}
-	} +
-
-	?stat {
-		?ipc_m_data_write /* path */ ;
-		tentative {
-			?ipc_m_data_read /* vfs_stat_t */ {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_lookup_internal] ;
-					tentative {
-						!fs.stat {
-							!fs.ipc_m_data_read /* forward vfs_stat_t */
-						}
-					}
-				}
-			}
-		}
-	} +
-
-	?mkdir {
-		?ipc_m_data_write /* path */ ;
-		tentative {
-			alternative (fs; tmpfs; fat; devfs) {
-				[fnc.vfs_lookup_internal]
-			}
-		}
-	} +
-
-	?unlink {
-		?ipc_m_data_write /* path */ ;
-		tentative {
-			alternative (fs; tmpfs; fat; devfs) {
-				[fnc.vfs_lookup_internal]
-			}
-		}
-	} +
-
-	?rename {
-		?ipc_m_data_write /* old path */ ;
-		tentative {
-			?ipc_m_data_write /* new path */ ;
-			tentative {
-				alternative (fs; tmpfs; fat; devfs) {
-					[fnc.vfs_lookup_internal] /* lookup old path */ ;
-					tentative {
-						[fnc.vfs_lookup_internal] /* lookup parent of new path */ ;
-						tentative {
-							[fnc.vfs_lookup_internal] /* destroy old link for the new path */ ;
-							tentative {
-								[fnc.vfs_lookup_internal] /* create new link for the new path */ ;
-								tentative {
-									[fnc.vfs_lookup_internal] /* destroy link for the old path */
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	} +
-
-	?sync {
-		tentative {
-			alternative (fs; tmpfs; fat; devfs) {
-				!fs.sync
-			}
-		}
-	} +
-
-	?seek
-
-)* ;
-?ipc_m_phone_hungup
Index: ntrib/artwork/HelenOS-bw.svg
===================================================================
--- contrib/artwork/HelenOS-bw.svg	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,290 +1,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   id="svg3437"
-   version="1.1"
-   inkscape:version="0.48.4 r9939"
-   width="259.225"
-   height="231.9"
-   xml:space="preserve"
-   sodipodi:docname="HelenOS-bw.svg"><metadata
-     id="metadata3443"><rdf:RDF><cc:Work
-         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
-     id="defs3441"><linearGradient
-       id="linearGradient7208"><stop
-         style="stop-color:#ebeef1;stop-opacity:1;"
-         offset="0"
-         id="stop7210" /><stop
-         style="stop-color:#cad0d4;stop-opacity:1"
-         offset="1"
-         id="stop7212" /></linearGradient><clipPath
-       clipPathUnits="userSpaceOnUse"
-       id="clipPath3475"><path
-         d="m 816.738,689.309 c -41.34,0 -80.386,25.441 -96.019,66.679 L 477.898,1395.8 c -4.722,12.45 -6.89,25.24 -6.765,37.79 0.418,40.99 25.34,79.39 65.719,94.69 l 635.128,241.02 c 11.89,4.52 24.1,6.66 36.11,6.66 41.36,0 80.39,-25.4 96.01,-66.69 l 242.82,-639.72 c 4.72,-12.46 6.89,-25.27 6.76,-37.84 -0.41,-41.026 -25.35,-79.433 -65.8,-94.73 L 852.75,695.961 c -11.848,-4.512 -24.031,-6.652 -36.012,-6.652"
-         id="path3477" /></clipPath><linearGradient
-       x1="0"
-       y1="0"
-       x2="1"
-       y2="0"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(39.659,-85.0491,-85.0491,-39.659,81.4102,165.789)"
-       spreadMethod="pad"
-       id="linearGradient3479"><stop
-         style="stop-opacity:1;stop-color:#ffffff"
-         offset="0"
-         id="stop3481" /><stop
-         style="stop-opacity:1;stop-color:#cac9ca"
-         offset="1"
-         id="stop3483" /></linearGradient><filter
-       id="filter4590"
-       inkscape:label="Inner Shadow"
-       inkscape:menu="Shadows and Glows"
-       inkscape:menu-tooltip="Adds a colorizable drop shadow inside"
-       color-interpolation-filters="sRGB"><feGaussianBlur
-         id="feGaussianBlur4592"
-         stdDeviation="4"
-         result="result8" /><feOffset
-         id="feOffset4594"
-         dx="4"
-         dy="4"
-         result="result11" /><feComposite
-         id="feComposite4596"
-         in2="result11"
-         result="result6"
-         in="SourceGraphic"
-         operator="in" /><feFlood
-         id="feFlood4598"
-         result="result10"
-         in="result6"
-         flood-opacity="1"
-         flood-color="rgb(76,76,76)" /><feBlend
-         id="feBlend4600"
-         in2="result10"
-         mode="normal"
-         in="result6"
-         result="result12" /><feComposite
-         id="feComposite4602"
-         in2="SourceGraphic"
-         result="result2"
-         operator="in" /></filter><filter
-       id="filter4738"
-       style="color-interpolation-filters:sRGB;"
-       inkscape:label="Drop Shadow"><feFlood
-         id="feFlood4740"
-         flood-opacity="0.8909657320872274"
-         flood-color="rgb(0,0,0)"
-         result="flood" /><feComposite
-         id="feComposite4742"
-         in2="SourceGraphic"
-         in="flood"
-         operator="in"
-         result="composite1" /><feGaussianBlur
-         id="feGaussianBlur4744"
-         in="composite"
-         stdDeviation="2.5738461538461532"
-         result="blur" /><feOffset
-         id="feOffset4746"
-         dx="0"
-         dy="2"
-         result="offset" /><feComposite
-         id="feComposite4748"
-         in2="offset"
-         in="SourceGraphic"
-         operator="over"
-         result="composite2" /></filter><filter
-       id="filter4768"
-       inkscape:label="Drop Shadow"
-       inkscape:menu="Shadows and Glows"
-       inkscape:menu-tooltip="Adds a colorizable drop shadow inside"
-       color-interpolation-filters="sRGB"
-       style="color-interpolation-filters:sRGB;"><feGaussianBlur
-         id="feGaussianBlur4770"
-         stdDeviation="1"
-         result="result8" /><feOffset
-         id="feOffset4772"
-         dx="1"
-         dy="1"
-         result="result11" /><feComposite
-         id="feComposite4774"
-         in2="result11"
-         result="result6"
-         in="SourceGraphic"
-         operator="in" /><feFlood
-         id="feFlood4776"
-         result="result10"
-         in="result6"
-         flood-opacity="1"
-         flood-color="rgb(60,62,63)" /><feBlend
-         id="feBlend4778"
-         in2="result10"
-         mode="normal"
-         in="result6"
-         result="result12" /><feComposite
-         id="feComposite4780"
-         in2="SourceGraphic"
-         result="fbSourceGraphic"
-         operator="in" /><feColorMatrix
-         result="fbSourceGraphicAlpha"
-         in="fbSourceGraphic"
-         values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
-         id="feColorMatrix4924" /><feFlood
-         id="feFlood4926"
-         flood-opacity="0.90537634408602152"
-         flood-color="rgb(255,255,255)"
-         result="flood"
-         in="fbSourceGraphic" /><feComposite
-         id="feComposite4928"
-         in2="fbSourceGraphic"
-         in="flood"
-         operator="in"
-         result="composite1" /><feGaussianBlur
-         id="feGaussianBlur4930"
-         in="composite"
-         stdDeviation="0.24978417266187047"
-         result="blur" /><feOffset
-         id="feOffset4932"
-         dx="1"
-         dy="1"
-         result="offset" /><feComposite
-         id="feComposite4934"
-         in2="offset"
-         in="fbSourceGraphic"
-         operator="over"
-         result="composite2" /></filter></defs><sodipodi:namedview
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1"
-     objecttolerance="10"
-     gridtolerance="10"
-     guidetolerance="10"
-     inkscape:pageopacity="0"
-     inkscape:pageshadow="2"
-     inkscape:window-width="1276"
-     inkscape:window-height="761"
-     id="namedview3439"
-     showgrid="false"
-     inkscape:zoom="1.9910926"
-     inkscape:cx="112.16509"
-     inkscape:cy="118.08751"
-     inkscape:window-x="0"
-     inkscape:window-y="18"
-     inkscape:window-maximized="0"
-     inkscape:current-layer="layer3"
-     showguides="true"
-     inkscape:guide-bbox="true" /><g
-     inkscape:groupmode="layer"
-     id="layer2"
-     inkscape:label="Logo"
-     style="display:inline"
-     sodipodi:insensitive="true"><g
-       id="g4604"><g
-         id="g7230"
-         style="fill:#ffffff;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"><path
-           style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"
-           d="m 154.40625,8.03125 c -3.44489,0.1085783 -7.07954,0.887883 -10.34375,2 l -82.875,28.25 c -4.345046,1.480356 -8.907838,5.34982 -11.0625,10.4375 l -1.28125,0 0,6.25 c 0.03146,1.842787 0.416614,3.783702 1.21875,5.75 l 34.5,84.53125 c 2.357198,5.77826 9.727781,11.07791 19.8125,7.5 l 92.5,-32.8125 c 3.85958,-1.36932 8.8395,-5.83824 8.78125,-12.5 l 0.0312,0 0,-5.875 -1.3125,0 c -0.013,-0.0312 -0.018,-0.0625 -0.0312,-0.0937 l -36.625,-86.375 c -2.32772,-5.4895321 -7.57102,-7.2434638 -13.3125,-7.0625 z"
-           id="path5035"
-           inkscape:connector-curvature="0" /></g><path
-         sodipodi:nodetypes="sssssssss"
-         inkscape:connector-curvature="0"
-         id="path4485"
-         d="M 144.06902,4.0450664 61.198812,32.278932 C 53.834625,34.787909 45.731809,44.10879 50.057881,54.713409 L 84.548982,139.2624 c 2.357198,5.77826 9.755299,11.05606 19.840018,7.47815 l 92.48498,-32.81233 c 4.92096,-1.74588 11.69893,-8.51248 7.47816,-18.466475 L 167.72442,9.0813775 C 164.00007,0.29812656 152.77359,1.0794208 144.06902,4.0450664 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" /><path
-         sodipodi:type="inkscape:offset"
-         inkscape:radius="-6.7012396"
-         inkscape:original="M 157.75 2.15625 C 153.38977 1.6243729 148.41478 2.5484272 144.0625 4.03125 L 61.1875 32.28125 C 53.823313 34.790227 45.736428 44.114131 50.0625 54.71875 L 84.5625 139.25 C 86.919698 145.02826 94.290281 150.32791 104.375 146.75 L 196.875 113.9375 C 201.79596 112.19162 208.56452 105.42275 204.34375 95.46875 L 167.71875 9.09375 C 165.85657 4.7021245 162.11023 2.6881271 157.75 2.15625 z "
-         style="fill:#ffffff;fill-opacity:1;stroke:none"
-         id="path7206"
-         d="m 156.9375,8.8125 c -2.82602,-0.3447281 -7.03762,0.3083377 -10.71875,1.5625 l -82.875,28.25 c -1.992244,0.678757 -4.857585,2.803885 -6.375,5.3125 -1.517415,2.508615 -2.039469,4.935882 -0.6875,8.25 l 34.5,84.53125 c 1.053105,2.5815 4.193953,6.25539 11.34375,3.71875 l 92.5,-32.8125 c 0.80096,-0.28417 2.6915,-1.58104 3.5625,-3.125 0.871,-1.54396 1.39467,-3.11714 0,-6.40625 l -36.625,-86.375 c -0.8886,-2.0956068 -1.82512,-2.5647104 -4.625,-2.90625 z" /><g
-         id="g4542"
-         style="fill:#ffffff;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"><path
-           inkscape:connector-curvature="0"
-           id="path4473"
-           d="m 135.03125,34.78125 a 6.750675,6.750675 0 0 0 -6.21875,9.375 l 6.4375,15.9375 -23.78125,9.5625 L 105.03125,53.75 A 6.750675,6.750675 0 0 0 98.75,49.4375 6.750675,6.750675 0 0 0 92.53125,58.8125 L 110,102.03125 a 6.7576093,6.7576093 0 1 0 12.53125,-5.0625 l -6.5625,-16.1875 23.78125,-9.5625 6.53125,16.15625 a 6.7576093,6.7576093 0 1 0 12.53125,-5.0625 l -17.5,-43.21875 a 6.750675,6.750675 0 0 0 -6.28125,-4.3125 z"
-           style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /></g><g
-         id="g4750"
-         style="fill:#ffffff;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none"><path
-           sodipodi:type="arc"
-           style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.46130222;stroke-miterlimit:4;stroke-dasharray:none"
-           id="path4479"
-           sodipodi:cx="102.06332"
-           sodipodi:cy="125.22211"
-           sodipodi:rx="3.25734"
-           sodipodi:ry="3.1216176"
-           d="m 105.32066,125.22211 a 3.25734,3.1216176 0 1 1 -6.514684,0 3.25734,3.1216176 0 1 1 6.514684,0 z"
-           transform="matrix(0.98880313,-0.44393908,0.44393908,0.98880313,-54.312475,46.576269)" /><path
-           transform="matrix(0.98880313,-0.44393908,0.44393908,0.98880313,27.39247,17.938822)"
-           d="m 105.32066,125.22211 a 3.25734,3.1216176 0 1 1 -6.514684,0 3.25734,3.1216176 0 1 1 6.514684,0 z"
-           sodipodi:ry="3.1216176"
-           sodipodi:rx="3.25734"
-           sodipodi:cy="125.22211"
-           sodipodi:cx="102.06332"
-           id="path4481"
-           style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.46130222;stroke-miterlimit:4;stroke-dasharray:none"
-           sodipodi:type="arc" /></g><path
-         style="fill:#4d4d4d;fill-opacity:1;stroke:none"
-         d="m 155.84375,8.53125 c -2.7841,-0.086304 -6.45076,0.5847419 -9.6875,1.6875 l -82.875,28.25 c -2.037566,0.694198 -4.927624,2.827186 -6.46875,5.375 -1.541126,2.547814 -2.092472,5.038809 -0.71875,8.40625 l 34.5,84.53125 c 0.443193,1.08641 1.273856,2.34335 2.5625,3.28125 -0.970342,-0.86582 -1.626075,-1.89589 -2,-2.8125 l -34.5,-84.53125 C 55.28948,49.368352 55.840427,46.91198 57.375,44.375 c 1.530152,-2.529672 4.421979,-4.657063 6.4375,-5.34375 l 82.875,-28.25 c 2.76829,-0.9431583 5.83842,-1.5525003 8.40625,-1.65625 0.85594,-0.034583 1.66293,-0.024361 2.375,0.0625 1.41789,0.1729592 2.35949,0.444633 2.89232,0.8024892 0.1708,0.1147148 0.5204,0.2465578 0.67018,0.3850108 -0.80331,-1.1222334 -1.88419,-1.4842817 -4.0625,-1.75 -0.3584,-0.043718 -0.72727,-0.081421 -1.125,-0.09375 z"
-         id="path5113"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="sccscccccsccssscss" /><path
-         style="fill:#4d4d4d;fill-opacity:1;stroke:none"
-         d="m 158.375,8.84375 c 0.4119,0.085094 0.77418,0.1866234 1.09375,0.3125 -0.3182,-0.1277152 -0.68149,-0.2278629 -1.09375,-0.3125 z m -8.34375,0.3125 c -0.52306,0.1108753 -1.04032,0.2382306 -1.5625,0.375 0.51786,-0.1361952 1.04381,-0.264064 1.5625,-0.375 z m 10.01745,0.6962932 c 0.32528,0.2630278 0.36217,0.4773388 0.5138,0.8349568 l 36.625,86.375 c 0.70023,1.651396 0.93765,2.884086 0.875,3.875 -0.0626,0.99073 -0.43213,1.74619 -0.875,2.53125 -0.43241,0.76651 -1.09694,1.47237 -1.78125,2.03125 -0.68401,0.55863 -1.39617,0.98837 -1.78125,1.125 l -92.5,32.8125 c -3.582155,1.2709 -6.124046,0.97982 -7.9375,0.0625 -0.396515,-0.20058 -0.950398,-0.67555 -1.276291,-1.09315 -0.325894,-0.4176 -0.30025,-0.45646 -0.799278,-1.15258 0.328593,0.8104 0.876055,1.6176 1.489631,2.26917 0.330647,0.25808 0.621581,0.36703 1.023438,0.57031 1.841002,0.93126 4.429643,1.2153 8.03125,-0.0625 l 92.5,-32.8125 c 0.40826,-0.14485 1.1207,-0.56001 1.8125,-1.125 0.6918,-0.56499 1.37094,-1.27978 1.8125,-2.0625 0.44554,-0.78978 0.81102,-1.58146 0.875,-2.59375 0.064,-1.01229 -0.17077,-2.245431 -0.875,-3.90625 l -36.625,-86.375 c -0.20218,-0.476821 -0.20571,-0.799924 -0.43359,-1.121094 -0.008,-0.0048 -0.1992,-0.1554565 -0.207,-0.160156 -0.12453,-0.07439 -0.59028,-0.1518513 -0.73061,-0.2146941 z"
-         id="path5135"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="ccccccccscssccczccsccsscsscccc" /><path
-         style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
-         d="m 78.411182,125.34412 5.640369,-6.62439 -23.160725,-56.389089 -7.679381,1.018426 z"
-         id="path4487"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="ccccc" /><path
-         sodipodi:nodetypes="ccccc"
-         inkscape:connector-curvature="0"
-         id="path4519"
-         d="m 79.019887,125.55253 5.440835,-5.59341 -0.48766,-1.41355 -5.651067,7.26442 z"
-         style="fill:#000000;stroke:none" /><path
-         sodipodi:nodetypes="ccccc"
-         inkscape:connector-curvature="0"
-         id="path4521"
-         d="m 59.978424,61.811457 -7.052525,-0.01903 -0.06697,1.359774 7.75195,-0.769753 z"
-         style="fill:#000000;stroke:none" /></g></g><g
-     inkscape:groupmode="layer"
-     id="layer3"
-     inkscape:label="Text"
-     style="display:inline"
-     sodipodi:insensitive="true"><path
-       d="m 39.99308,164.63193 7.5825,0 0,56.12353 -7.5825,0 0,-26.18603 -29.312963,0 0,26.18603 -7.5820371,0 0,-56.12353 7.5820371,0 0,23.21487 29.312963,0 0,-23.21487"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3449"
-       inkscape:connector-curvature="0" /><path
-       d="m 82.48533,197.07093 c -0.234375,-3.59525 -1.172375,-6.5665 -2.96975,-8.834 -1.72025,-2.26613 -4.53425,-3.35988 -8.442375,-3.35988 -2.03275,0 -3.90825,0.54588 -5.6285,1.64113 -1.79775,1.17237 -3.2045,2.65775 -4.221125,4.61225 -1.016125,1.95412 -1.484875,3.90775 -1.484875,5.9405 l 22.746625,0 z m 6.566375,10.86475 c -0.234375,1.48625 -0.9385,3.28365 -2.110875,5.54976 -1.172375,2.26758 -2.892125,4.14405 -5.158625,5.62794 -1.328625,0.86084 -2.736375,1.56347 -4.299375,2.03222 -1.564,0.54736 -3.8305,0.78271 -6.80025,0.78271 -2.8145,0 -5.394125,-0.54785 -7.660625,-1.56396 -2.267125,-1.01611 -4.22125,-2.42236 -5.78475,-4.29883 -1.641625,-1.87598 -2.813875,-4.06494 -3.595625,-6.48734 -0.859375,-2.42375 -1.251,-5.15863 -1.251,-8.12988 0,-4.30025 0.704125,-8.2075 2.189,-11.64737 1.407125,-3.439 3.595125,-6.17538 6.48775,-8.13038 2.97075,-1.95225 6.6445,-2.96975 10.943875,-2.96975 2.892,0 5.471625,0.54738 7.73875,1.6425 2.1885,1.171 3.985875,2.73488 5.471625,4.76713 1.40675,2.03275 2.501,4.53425 3.28325,7.42625 0.703125,2.89262 1.09425,6.254 1.09425,10.00637 l -29.860375,0 c 0,4.29888 1.016125,7.58155 3.048875,9.92628 1.953625,2.34521 4.92425,3.51757 8.833,3.51757 1.563,0 2.96975,-0.23388 4.29825,-0.78125 1.2515,-0.54736 2.34575,-1.17236 3.28325,-2.03271 0.860375,-0.85986 1.642125,-1.71875 2.189,-2.73584 0.46925,-0.93755 0.703625,-1.79642 0.78175,-2.50142 l 6.878875,0"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3451"
-       inkscape:connector-curvature="0" /><path
-       d="m 94.186955,220.75546 6.878415,0 0,-56.12349 -6.878415,0 0,56.12349 z"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3453"
-       inkscape:connector-curvature="0" /><path
-       d="m 135.60559,197.07093 c -0.23375,-3.59525 -1.17125,-6.5665 -2.97,-8.834 -1.72,-2.26613 -4.53375,-3.35988 -8.44176,-3.35988 -2.03275,0 -3.90875,0.54588 -5.6285,1.64113 -1.79787,1.17237 -3.2045,2.65775 -4.22062,4.61225 -1.01663,1.95412 -1.48538,3.90775 -1.48538,5.9405 l 22.74626,0 z m 6.56625,10.86475 c -0.23375,1.48625 -0.9375,3.28365 -2.11,5.54976 -1.1725,2.26758 -2.8925,4.14405 -5.15875,5.62794 -1.33,0.86084 -2.73625,1.56347 -4.3,2.03222 -1.56375,0.54736 -3.83026,0.78271 -6.80038,0.78271 -2.814,0 -5.39363,-0.54785 -7.66025,-1.56396 -2.2675,-1.01611 -4.22113,-2.42236 -5.78513,-4.29883 -1.64112,-1.87598 -2.8135,-4.06494 -3.59512,-6.48734 -0.85988,-2.42375 -1.2505,-5.15863 -1.2505,-8.12988 0,-4.30025 0.70362,-8.2075 2.18837,-11.64737 1.40675,-3.439 3.59575,-6.17538 6.48838,-8.13038 2.96962,-1.95225 6.644,-2.96975 10.94337,-2.96975 2.89151,0 5.47126,0.54738 7.73876,1.6425 2.18875,1.171 3.98625,2.73488 5.47125,4.76713 1.4075,2.03275 2.50125,4.53425 3.28375,7.42625 0.7025,2.89262 1.09375,6.254 1.09375,10.00637 l -29.86001,0 c 0,4.29888 1.01563,7.58155 3.04838,9.92628 1.954,2.34521 4.92475,3.51757 8.833,3.51757 1.56337,0 2.97013,-0.23388 4.29863,-0.78125 1.25,-0.54736 2.345,-1.17236 3.28375,-2.03271 0.86,-0.85986 1.64125,-1.71875 2.18875,-2.73584 0.46875,-0.93755 0.70375,-1.79642 0.78125,-2.50142 l 6.87875,0"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3455"
-       inkscape:connector-curvature="0" /><path
-       d="m 180.52934,220.75546 -6.88,0 -0.0788,-25.16991 c 0,-3.7525 -0.625,-6.48737 -1.9525,-8.12987 -1.25125,-1.72025 -3.51875,-2.57863 -6.80125,-2.57863 -1.5625,0 -3.205,0.38963 -4.84625,1.25 -1.64125,0.78225 -3.04875,2.1885 -4.22125,4.22113 -1.1725,2.03225 -1.71875,4.76762 -1.71875,8.13 l 0,22.27728 -6.87875,0 0,-40.88091 6.48625,0 0,5.78375 0.1575,0 c 1.1725,-1.79887 2.81375,-3.36137 4.76875,-4.84625 1.95375,-1.40762 4.53375,-2.11125 7.58125,-2.11125 2.4225,0 4.7675,0.39113 6.87875,1.251 2.11,0.78125 3.90875,2.2675 5.39375,4.37738 1.40625,2.11137 2.11125,5.003 2.11125,8.59762 l 0,27.82866"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3457"
-       inkscape:connector-curvature="0" /><path
-       d="m 208.41059,179.16955 c 0,-2.42237 -0.3125,-4.29887 -0.9375,-5.70512 -0.625,-1.48625 -1.955,-2.189 -3.90875,-2.189 -1.955,0 -3.205,0.78125 -3.90875,2.26662 -0.70375,1.48488 -1.01625,3.36138 -1.01625,5.6275 l 0,24.07613 c 0,5.55125 1.6425,8.36476 5.0025,8.36476 1.955,0 3.28375,-0.78125 3.90875,-2.42339 0.5475,-1.56387 0.86,-3.5175 0.86,-5.94137 l 0,-24.07613 z m 13.7575,22.90475 c 0,3.439 -0.31375,6.40875 -0.93875,8.83253 -0.625,2.42236 -1.64125,4.45507 -3.12625,6.17382 -1.4075,1.64259 -3.28375,2.89357 -5.70625,3.75245 -2.345,0.85986 -5.23625,1.33008 -8.755,1.33008 -3.43875,0 -6.33125,-0.47022 -8.755,-1.33008 -2.4225,-0.85888 -4.3775,-2.10986 -5.86125,-3.75245 -1.48625,-1.71875 -2.50125,-3.82861 -3.1275,-6.25146 -0.70375,-2.42476 -1.01625,-5.39501 -1.01625,-8.75489 l 0,-23.84225 c 0,-5.62887 1.6425,-9.92775 4.925,-12.97512 3.20375,-3.04888 7.8175,-4.53375 13.835,-4.53375 6.01875,0 10.63125,1.48487 13.83625,4.53375 3.12625,3.04737 4.69,7.34625 4.69,12.97512 l 0,23.84225"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3459"
-       inkscape:connector-curvature="0" /><path
-       d="m 236.4985,201.1358 0,4.14213 c 0,1.95512 0.39,3.44037 1.25,4.61279 0.7825,1.17236 2.18875,1.71972 4.22125,1.71972 1.485,0 2.57875,-0.54736 3.44,-1.71972 0.78125,-1.17242 1.17125,-2.50142 1.17125,-4.14404 0,-2.10988 -0.54625,-3.67238 -1.72,-4.76713 -1.17125,-1.09375 -3.12625,-2.50137 -5.94,-4.22112 -4.92375,-2.814 -8.4425,-5.39413 -10.39625,-7.66025 -2.6575,-3.12738 -3.9875,-7.03513 -3.9875,-11.726 0,-2.73638 0.3925,-5.15925 1.25125,-7.27 0.78125,-2.11038 1.87625,-3.83013 3.36125,-5.23638 1.485,-1.32912 3.28375,-2.42287 5.39375,-3.12737 2.11125,-0.70275 4.53375,-1.01525 7.27,-1.01525 2.81375,0 5.315,0.46875 7.50375,1.32862 2.1875,0.85988 4.06375,2.11138 5.55,3.7515 1.485,1.64113 2.57875,3.67388 3.2825,6.01863 0.70375,2.34512 1.095,5.00237 1.095,7.89637 l -12.66375,0 c -0.0775,-2.73775 -0.39,-4.77 -0.85875,-6.17625 -0.46875,-1.32912 -1.72,-2.11037 -3.675,-2.26662 -2.89125,0 -4.455,1.32775 -4.7675,3.90925 0,1.79587 0.3125,3.126 1.01625,4.14112 0.70375,1.0175 1.71875,2.03225 3.12625,3.04975 1.25,0.78125 2.8925,1.79738 5.0025,3.04738 2.11125,1.17387 3.67375,2.189 4.7675,2.89262 1.095,0.70413 2.11125,1.48538 3.05,2.34513 1.64,1.5635 2.97,3.44 3.82875,5.629 0.86125,2.1885 1.25125,5.00237 1.25125,8.36325 0,3.67387 -0.7025,6.8789 -2.0325,9.53661 -1.32875,2.57861 -3.36,4.61134 -5.94125,5.94093 -2.65625,1.32763 -5.86125,2.03271 -9.69125,2.03271 -2.97,0 -5.6275,-0.39258 -7.89625,-1.17383 -2.26625,-0.70264 -4.14125,-1.79736 -5.6275,-3.20361 -1.485,-1.40772 -2.57875,-2.9712 -3.28375,-4.76905 -0.7025,-1.79736 -1.09375,-3.67339 -1.09375,-5.62739 l 0,-6.2535 12.7425,0"
-       style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3461"
-       inkscape:connector-curvature="0" /></g></svg>
Index: ntrib/artwork/HelenOS.svg
===================================================================
--- contrib/artwork/HelenOS.svg	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,338 +1,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:xlink="http://www.w3.org/1999/xlink"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   id="svg3437"
-   version="1.1"
-   inkscape:version="0.48.4 r9939"
-   width="259.225"
-   height="231.9"
-   xml:space="preserve"
-   sodipodi:docname="HelenOS.svg"><metadata
-     id="metadata3443"><rdf:RDF><cc:Work
-         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
-     id="defs3441"><linearGradient
-       id="linearGradient7224"
-       inkscape:collect="always"><stop
-         id="stop7226"
-         offset="0"
-         style="stop-color:#f4f7f9;stop-opacity:1" /><stop
-         id="stop7228"
-         offset="1"
-         style="stop-color:#cad0d4;stop-opacity:1" /></linearGradient><linearGradient
-       id="linearGradient7208"><stop
-         style="stop-color:#ebeef1;stop-opacity:1;"
-         offset="0"
-         id="stop7210" /><stop
-         style="stop-color:#cad0d4;stop-opacity:1"
-         offset="1"
-         id="stop7212" /></linearGradient><clipPath
-       clipPathUnits="userSpaceOnUse"
-       id="clipPath3475"><path
-         d="m 816.738,689.309 c -41.34,0 -80.386,25.441 -96.019,66.679 L 477.898,1395.8 c -4.722,12.45 -6.89,25.24 -6.765,37.79 0.418,40.99 25.34,79.39 65.719,94.69 l 635.128,241.02 c 11.89,4.52 24.1,6.66 36.11,6.66 41.36,0 80.39,-25.4 96.01,-66.69 l 242.82,-639.72 c 4.72,-12.46 6.89,-25.27 6.76,-37.84 -0.41,-41.026 -25.35,-79.433 -65.8,-94.73 L 852.75,695.961 c -11.848,-4.512 -24.031,-6.652 -36.012,-6.652"
-         id="path3477" /></clipPath><linearGradient
-       x1="0"
-       y1="0"
-       x2="1"
-       y2="0"
-       gradientUnits="userSpaceOnUse"
-       gradientTransform="matrix(39.659,-85.0491,-85.0491,-39.659,81.4102,165.789)"
-       spreadMethod="pad"
-       id="linearGradient3479"><stop
-         style="stop-opacity:1;stop-color:#ffffff"
-         offset="0"
-         id="stop3481" /><stop
-         style="stop-opacity:1;stop-color:#cac9ca"
-         offset="1"
-         id="stop3483" /></linearGradient><filter
-       id="filter4590"
-       inkscape:label="Inner Shadow"
-       inkscape:menu="Shadows and Glows"
-       inkscape:menu-tooltip="Adds a colorizable drop shadow inside"
-       color-interpolation-filters="sRGB"><feGaussianBlur
-         id="feGaussianBlur4592"
-         stdDeviation="4"
-         result="result8" /><feOffset
-         id="feOffset4594"
-         dx="4"
-         dy="4"
-         result="result11" /><feComposite
-         id="feComposite4596"
-         in2="result11"
-         result="result6"
-         in="SourceGraphic"
-         operator="in" /><feFlood
-         id="feFlood4598"
-         result="result10"
-         in="result6"
-         flood-opacity="1"
-         flood-color="rgb(76,76,76)" /><feBlend
-         id="feBlend4600"
-         in2="result10"
-         mode="normal"
-         in="result6"
-         result="result12" /><feComposite
-         id="feComposite4602"
-         in2="SourceGraphic"
-         result="result2"
-         operator="in" /></filter><filter
-       id="filter4738"
-       style="color-interpolation-filters:sRGB;"
-       inkscape:label="Drop Shadow"><feFlood
-         id="feFlood4740"
-         flood-opacity="0.8909657320872274"
-         flood-color="rgb(0,0,0)"
-         result="flood" /><feComposite
-         id="feComposite4742"
-         in2="SourceGraphic"
-         in="flood"
-         operator="in"
-         result="composite1" /><feGaussianBlur
-         id="feGaussianBlur4744"
-         in="composite"
-         stdDeviation="2.5738461538461532"
-         result="blur" /><feOffset
-         id="feOffset4746"
-         dx="0"
-         dy="2"
-         result="offset" /><feComposite
-         id="feComposite4748"
-         in2="offset"
-         in="SourceGraphic"
-         operator="over"
-         result="composite2" /></filter><filter
-       id="filter4768"
-       inkscape:label="Drop Shadow"
-       inkscape:menu="Shadows and Glows"
-       inkscape:menu-tooltip="Adds a colorizable drop shadow inside"
-       color-interpolation-filters="sRGB"
-       style="color-interpolation-filters:sRGB;"><feGaussianBlur
-         id="feGaussianBlur4770"
-         stdDeviation="1"
-         result="result8" /><feOffset
-         id="feOffset4772"
-         dx="1"
-         dy="1"
-         result="result11" /><feComposite
-         id="feComposite4774"
-         in2="result11"
-         result="result6"
-         in="SourceGraphic"
-         operator="in" /><feFlood
-         id="feFlood4776"
-         result="result10"
-         in="result6"
-         flood-opacity="1"
-         flood-color="rgb(60,62,63)" /><feBlend
-         id="feBlend4778"
-         in2="result10"
-         mode="normal"
-         in="result6"
-         result="result12" /><feComposite
-         id="feComposite4780"
-         in2="SourceGraphic"
-         result="fbSourceGraphic"
-         operator="in" /><feColorMatrix
-         result="fbSourceGraphicAlpha"
-         in="fbSourceGraphic"
-         values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
-         id="feColorMatrix4924" /><feFlood
-         id="feFlood4926"
-         flood-opacity="0.90537634408602152"
-         flood-color="rgb(255,255,255)"
-         result="flood"
-         in="fbSourceGraphic" /><feComposite
-         id="feComposite4928"
-         in2="fbSourceGraphic"
-         in="flood"
-         operator="in"
-         result="composite1" /><feGaussianBlur
-         id="feGaussianBlur4930"
-         in="composite"
-         stdDeviation="0.24978417266187047"
-         result="blur" /><feOffset
-         id="feOffset4932"
-         dx="1"
-         dy="1"
-         result="offset" /><feComposite
-         id="feComposite4934"
-         in2="offset"
-         in="fbSourceGraphic"
-         operator="over"
-         result="composite2" /></filter><linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient7208"
-       id="linearGradient7214"
-       x1="104.32044"
-       y1="18.753582"
-       x2="150.06894"
-       y2="128.61929"
-       gradientUnits="userSpaceOnUse" /><linearGradient
-       inkscape:collect="always"
-       xlink:href="#linearGradient7224"
-       id="linearGradient7222"
-       x1="108.13281"
-       y1="25.685173"
-       x2="146.25656"
-       y2="122.38086"
-       gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1"
-     objecttolerance="10"
-     gridtolerance="10"
-     guidetolerance="10"
-     inkscape:pageopacity="0"
-     inkscape:pageshadow="2"
-     inkscape:window-width="1276"
-     inkscape:window-height="761"
-     id="namedview3439"
-     showgrid="false"
-     inkscape:zoom="2.259464"
-     inkscape:cx="110.05942"
-     inkscape:cy="117.36032"
-     inkscape:window-x="0"
-     inkscape:window-y="18"
-     inkscape:window-maximized="0"
-     inkscape:current-layer="layer3"
-     showguides="true"
-     inkscape:guide-bbox="true" /><g
-     inkscape:groupmode="layer"
-     id="layer2"
-     inkscape:label="Logo"
-     style="display:inline"
-     sodipodi:insensitive="true"><g
-       id="g4604"
-       style="filter:url(#filter4738)"><g
-         id="g7230"><path
-           sodipodi:nodetypes="sssssssss"
-           inkscape:connector-curvature="0"
-           id="path5035"
-           d="M 144.06902,10.045066 61.198812,38.278932 C 53.834625,40.787909 45.731809,50.10879 50.057881,60.713409 L 84.548982,145.2624 c 2.357198,5.77826 9.755299,11.05606 19.840018,7.47815 l 92.48498,-32.81233 c 4.92096,-1.74588 11.69893,-8.51248 7.47816,-18.46647 L 167.72442,15.081378 c -3.72435,-8.7832514 -14.95083,-8.0019572 -23.6554,-5.036312 z"
-           style="fill:#4f5051;fill-opacity:1;stroke:none" /><rect
-           y="48.708691"
-           x="48.849281"
-           height="6.2556591"
-           width="6.8167043"
-           id="rect5037"
-           style="fill:#4f5051;fill-opacity:1;stroke:none" /><rect
-           y="101.55563"
-           x="199.60468"
-           height="5.889843"
-           width="6.0749969"
-           id="rect5039"
-           style="fill:#4f5051;fill-opacity:1;stroke:none" /></g><path
-         sodipodi:nodetypes="sssssssss"
-         inkscape:connector-curvature="0"
-         id="path4485"
-         d="M 144.06902,4.0450664 61.198812,32.278932 C 53.834625,34.787909 45.731809,44.10879 50.057881,54.713409 L 84.548982,139.2624 c 2.357198,5.77826 9.755299,11.05606 19.840018,7.47815 l 92.48498,-32.81233 c 4.92096,-1.74588 11.69893,-8.51248 7.47816,-18.466475 L 167.72442,9.0813775 C 164.00007,0.29812656 152.77359,1.0794208 144.06902,4.0450664 z"
-         style="fill:url(#linearGradient7214);fill-opacity:1;stroke:none" /><path
-         sodipodi:type="inkscape:offset"
-         inkscape:radius="-6.7012396"
-         inkscape:original="M 157.75 2.15625 C 153.38977 1.6243729 148.41478 2.5484272 144.0625 4.03125 L 61.1875 32.28125 C 53.823313 34.790227 45.736428 44.114131 50.0625 54.71875 L 84.5625 139.25 C 86.919698 145.02826 94.290281 150.32791 104.375 146.75 L 196.875 113.9375 C 201.79596 112.19162 208.56452 105.42275 204.34375 95.46875 L 167.71875 9.09375 C 165.85657 4.7021245 162.11023 2.6881271 157.75 2.15625 z "
-         style="fill:url(#linearGradient7222);fill-opacity:1;stroke:none"
-         id="path7206"
-         d="m 156.9375,8.8125 c -2.82602,-0.3447281 -7.03762,0.3083377 -10.71875,1.5625 l -82.875,28.25 c -1.992244,0.678757 -4.857585,2.803885 -6.375,5.3125 -1.517415,2.508615 -2.039469,4.935882 -0.6875,8.25 l 34.5,84.53125 c 1.053105,2.5815 4.193953,6.25539 11.34375,3.71875 l 92.5,-32.8125 c 0.80096,-0.28417 2.6915,-1.58104 3.5625,-3.125 0.871,-1.54396 1.39467,-3.11714 0,-6.40625 l -36.625,-86.375 c -0.8886,-2.0956068 -1.82512,-2.5647104 -4.625,-2.90625 z" /><g
-         style="filter:url(#filter4590)"
-         id="g4542"><path
-           inkscape:connector-curvature="0"
-           id="path4473"
-           d="m 135.03125,34.78125 a 6.750675,6.750675 0 0 0 -6.21875,9.375 l 6.4375,15.9375 -23.78125,9.5625 L 105.03125,53.75 A 6.750675,6.750675 0 0 0 98.75,49.4375 6.750675,6.750675 0 0 0 92.53125,58.8125 L 110,102.03125 a 6.7576093,6.7576093 0 1 0 12.53125,-5.0625 l -6.5625,-16.1875 23.78125,-9.5625 6.53125,16.15625 a 6.7576093,6.7576093 0 1 0 12.53125,-5.0625 l -17.5,-43.21875 a 6.750675,6.750675 0 0 0 -6.28125,-4.3125 z"
-           style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#c3c2c4;fill-opacity:1;stroke:none;stroke-width:13.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" /></g><g
-         id="g4750"
-         style="filter:url(#filter4768)"><path
-           sodipodi:type="arc"
-           style="fill:#c3c2c4;fill-opacity:1;stroke:none"
-           id="path4479"
-           sodipodi:cx="102.06332"
-           sodipodi:cy="125.22211"
-           sodipodi:rx="3.25734"
-           sodipodi:ry="3.1216176"
-           d="m 105.32066,125.22211 a 3.25734,3.1216176 0 1 1 -6.514684,0 3.25734,3.1216176 0 1 1 6.514684,0 z"
-           transform="matrix(0.98880313,-0.44393908,0.44393908,0.98880313,-54.312475,46.576269)" /><path
-           transform="matrix(0.98880313,-0.44393908,0.44393908,0.98880313,27.39247,17.938822)"
-           d="m 105.32066,125.22211 a 3.25734,3.1216176 0 1 1 -6.514684,0 3.25734,3.1216176 0 1 1 6.514684,0 z"
-           sodipodi:ry="3.1216176"
-           sodipodi:rx="3.25734"
-           sodipodi:cy="125.22211"
-           sodipodi:cx="102.06332"
-           id="path4481"
-           style="fill:#c3c2c4;fill-opacity:1;stroke:none"
-           sodipodi:type="arc" /></g><path
-         style="fill:#4d4d4d;fill-opacity:1;stroke:none"
-         d="m 155.84375,8.53125 c -2.7841,-0.086304 -6.45076,0.5847419 -9.6875,1.6875 l -82.875,28.25 c -2.037566,0.694198 -4.927624,2.827186 -6.46875,5.375 -1.541126,2.547814 -2.092472,5.038809 -0.71875,8.40625 l 34.5,84.53125 c 0.443193,1.08641 1.273856,2.34335 2.5625,3.28125 -0.970342,-0.86582 -1.626075,-1.89589 -2,-2.8125 l -34.5,-84.53125 C 55.28948,49.368352 55.840427,46.91198 57.375,44.375 c 1.530152,-2.529672 4.421979,-4.657063 6.4375,-5.34375 l 82.875,-28.25 c 2.76829,-0.9431583 5.83842,-1.5525003 8.40625,-1.65625 0.85594,-0.034583 1.66293,-0.024361 2.375,0.0625 1.41789,0.1729592 2.35949,0.444633 2.89232,0.8024892 0.1708,0.1147148 0.5204,0.2465578 0.67018,0.3850108 -0.80331,-1.1222334 -1.88419,-1.4842817 -4.0625,-1.75 -0.3584,-0.043718 -0.72727,-0.081421 -1.125,-0.09375 z"
-         id="path5113"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="sccscccccsccssscss" /><path
-         style="fill:#4d4d4d;fill-opacity:1;stroke:none"
-         d="m 158.375,8.84375 c 0.4119,0.085094 0.77418,0.1866234 1.09375,0.3125 -0.3182,-0.1277152 -0.68149,-0.2278629 -1.09375,-0.3125 z m -8.34375,0.3125 c -0.52306,0.1108753 -1.04032,0.2382306 -1.5625,0.375 0.51786,-0.1361952 1.04381,-0.264064 1.5625,-0.375 z m 10.01745,0.6962932 c 0.32528,0.2630278 0.36217,0.4773388 0.5138,0.8349568 l 36.625,86.375 c 0.70023,1.651396 0.93765,2.884086 0.875,3.875 -0.0626,0.99073 -0.43213,1.74619 -0.875,2.53125 -0.43241,0.76651 -1.09694,1.47237 -1.78125,2.03125 -0.68401,0.55863 -1.39617,0.98837 -1.78125,1.125 l -92.5,32.8125 c -3.582155,1.2709 -6.124046,0.97982 -7.9375,0.0625 -0.396515,-0.20058 -0.950398,-0.67555 -1.276291,-1.09315 -0.325894,-0.4176 -0.30025,-0.45646 -0.799278,-1.15258 0.328593,0.8104 0.876055,1.6176 1.489631,2.26917 0.330647,0.25808 0.621581,0.36703 1.023438,0.57031 1.841002,0.93126 4.429643,1.2153 8.03125,-0.0625 l 92.5,-32.8125 c 0.40826,-0.14485 1.1207,-0.56001 1.8125,-1.125 0.6918,-0.56499 1.37094,-1.27978 1.8125,-2.0625 0.44554,-0.78978 0.81102,-1.58146 0.875,-2.59375 0.064,-1.01229 -0.17077,-2.245431 -0.875,-3.90625 l -36.625,-86.375 c -0.20218,-0.476821 -0.20571,-0.799924 -0.43359,-1.121094 -0.008,-0.0048 -0.1992,-0.1554565 -0.207,-0.160156 -0.12453,-0.07439 -0.59028,-0.1518513 -0.73061,-0.2146941 z"
-         id="path5135"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="ccccccccscssccczccsccsscsscccc" /><path
-         style="fill:#f9f9f9;fill-opacity:1;stroke:none"
-         d="m 160.66086,9.9356565 c 0.29941,0.4813045 0.18296,0.5641445 0.49539,1.3009705 l 36.625,86.375 c 0.70423,1.660819 0.93898,2.893963 0.875,3.906253 -0.064,1.01229 -0.42946,1.80397 -0.875,2.59375 -0.44156,0.78272 -1.1207,1.49751 -1.8125,2.0625 -0.6918,0.56499 -1.40424,0.98015 -1.8125,1.125 l -92.5,32.8125 c -3.601607,1.2778 -6.214641,1.04049 -8.03125,0.0625 -0.901764,-0.48547 -1.55545,-1.09494 -2.128906,-1.77734 1.601388,2.27579 4.81824,4.36105 10.691406,2.27734 l 92.5,-32.8125 c 0.84547,-0.29996 2.76088,-1.63159 3.65625,-3.21875 0.89537,-1.58716 1.41689,-3.2294 0,-6.562503 L 161.59766,11.638971 c -0.44229,-1.040443 -0.41497,-1.174048 -0.9368,-1.7033145 z"
-         id="path5120"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="csscssccscccsssc" /><path
-         style="fill:#323232;fill-opacity:1;stroke:none"
-         d="m 78.322398,125.81023 5.729153,-7.0905 L 60.890826,62.330641 52.859,63.151994 z"
-         id="path4487"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="ccccc" /><path
-         sodipodi:nodetypes="ccccc"
-         inkscape:connector-curvature="0"
-         id="path4519"
-         d="m 79.019887,125.55253 5.440835,-5.59341 -0.48766,-1.41355 -5.651067,7.26442 z"
-         style="fill:#f9f9f9;stroke:none" /><path
-         style="fill:#f9f9f9;fill-opacity:1;stroke:none"
-         d="m 156.34375,9.09375 c -0.39775,-0.00909 -0.82203,0.013958 -1.25,0.03125 -2.56783,0.1037497 -5.63796,0.7130915 -8.40625,1.65625 l -82.875,28.25 c -2.015521,0.686687 -4.907348,2.814078 -6.4375,5.34375 -1.534573,2.53698 -2.08552,4.993352 -0.71875,8.34375 l 34.5,84.53125 c 0.280444,0.68746 1.163727,1.70758 1.329926,1.86437 0.166199,0.15679 0.344629,0.25227 1.076271,0.55429 -0.464587,-0.22276 -0.384832,-0.17168 -0.636666,-0.39913 -0.251834,-0.22745 -0.493954,-1.1277 -0.769531,-1.73823 L 57.65625,53 c -1.312012,-3.216169 -0.796136,-5.39098 0.6875,-7.84375 1.442449,-2.38468 4.316055,-4.466796 6.15625,-5.09375 l 82.875,-28.25 c 2.71949,-0.926532 5.75094,-1.555279 8.25,-1.65625 0.83773,-0.03385 1.48163,-0.112435 2.15419,-0.09388 1.29552,0.03574 2.14895,0.0066 2.38837,0.249611 0.23943,0.24297 0.49431,0.59618 0.49431,0.59618 0,0 -0.29527,-0.741854 -0.48319,-0.9422587 -0.18792,-0.200405 -0.2281,-0.2086143 -0.54154,-0.3339453 -0.31344,-0.1253311 -0.76625,-0.2734176 -2.16839,-0.444455 -0.35604,-0.04343 -0.72725,-0.08466 -1.125,-0.093752 z m -6.3125,0.0625 c -0.52306,0.1108753 -1.04032,0.2382306 -1.5625,0.375 0.51786,-0.1361952 1.04381,-0.264064 1.5625,-0.375 z"
-         id="path5142"
-         inkscape:connector-curvature="0"
-         sodipodi:nodetypes="ssccscczczccsccsszczzssccc" /><path
-         sodipodi:nodetypes="ccccc"
-         inkscape:connector-curvature="0"
-         id="path4521"
-         d="m 59.978424,61.811457 -7.052525,-0.01903 -0.06697,1.359774 7.75195,-0.769753 z"
-         style="fill:#000000;stroke:none" /></g></g><g
-     inkscape:groupmode="layer"
-     id="layer3"
-     inkscape:label="Text"
-     sodipodi:insensitive="true"
-     style="display:inline"><path
-       d="m 39.99308,164.63193 7.5825,0 0,56.12353 -7.5825,0 0,-26.18603 -29.312963,0 0,26.18603 -7.5820371,0 0,-56.12353 7.5820371,0 0,23.21487 29.312963,0 0,-23.21487"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3449"
-       inkscape:connector-curvature="0" /><path
-       d="m 82.48533,197.07093 c -0.234375,-3.59525 -1.172375,-6.5665 -2.96975,-8.834 -1.72025,-2.26613 -4.53425,-3.35988 -8.442375,-3.35988 -2.03275,0 -3.90825,0.54588 -5.6285,1.64113 -1.79775,1.17237 -3.2045,2.65775 -4.221125,4.61225 -1.016125,1.95412 -1.484875,3.90775 -1.484875,5.9405 l 22.746625,0 z m 6.566375,10.86475 c -0.234375,1.48625 -0.9385,3.28365 -2.110875,5.54976 -1.172375,2.26758 -2.892125,4.14405 -5.158625,5.62794 -1.328625,0.86084 -2.736375,1.56347 -4.299375,2.03222 -1.564,0.54736 -3.8305,0.78271 -6.80025,0.78271 -2.8145,0 -5.394125,-0.54785 -7.660625,-1.56396 -2.267125,-1.01611 -4.22125,-2.42236 -5.78475,-4.29883 -1.641625,-1.87598 -2.813875,-4.06494 -3.595625,-6.48734 -0.859375,-2.42375 -1.251,-5.15863 -1.251,-8.12988 0,-4.30025 0.704125,-8.2075 2.189,-11.64737 1.407125,-3.439 3.595125,-6.17538 6.48775,-8.13038 2.97075,-1.95225 6.6445,-2.96975 10.943875,-2.96975 2.892,0 5.471625,0.54738 7.73875,1.6425 2.1885,1.171 3.985875,2.73488 5.471625,4.76713 1.40675,2.03275 2.501,4.53425 3.28325,7.42625 0.703125,2.89262 1.09425,6.254 1.09425,10.00637 l -29.860375,0 c 0,4.29888 1.016125,7.58155 3.048875,9.92628 1.953625,2.34521 4.92425,3.51757 8.833,3.51757 1.563,0 2.96975,-0.23388 4.29825,-0.78125 1.2515,-0.54736 2.34575,-1.17236 3.28325,-2.03271 0.860375,-0.85986 1.642125,-1.71875 2.189,-2.73584 0.46925,-0.93755 0.703625,-1.79642 0.78175,-2.50142 l 6.878875,0"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3451"
-       inkscape:connector-curvature="0" /><path
-       d="m 94.186955,220.75546 6.878415,0 0,-56.12349 -6.878415,0 0,56.12349 z"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3453"
-       inkscape:connector-curvature="0" /><path
-       d="m 135.60559,197.07093 c -0.23375,-3.59525 -1.17125,-6.5665 -2.97,-8.834 -1.72,-2.26613 -4.53375,-3.35988 -8.44176,-3.35988 -2.03275,0 -3.90875,0.54588 -5.6285,1.64113 -1.79787,1.17237 -3.2045,2.65775 -4.22062,4.61225 -1.01663,1.95412 -1.48538,3.90775 -1.48538,5.9405 l 22.74626,0 z m 6.56625,10.86475 c -0.23375,1.48625 -0.9375,3.28365 -2.11,5.54976 -1.1725,2.26758 -2.8925,4.14405 -5.15875,5.62794 -1.33,0.86084 -2.73625,1.56347 -4.3,2.03222 -1.56375,0.54736 -3.83026,0.78271 -6.80038,0.78271 -2.814,0 -5.39363,-0.54785 -7.66025,-1.56396 -2.2675,-1.01611 -4.22113,-2.42236 -5.78513,-4.29883 -1.64112,-1.87598 -2.8135,-4.06494 -3.59512,-6.48734 -0.85988,-2.42375 -1.2505,-5.15863 -1.2505,-8.12988 0,-4.30025 0.70362,-8.2075 2.18837,-11.64737 1.40675,-3.439 3.59575,-6.17538 6.48838,-8.13038 2.96962,-1.95225 6.644,-2.96975 10.94337,-2.96975 2.89151,0 5.47126,0.54738 7.73876,1.6425 2.18875,1.171 3.98625,2.73488 5.47125,4.76713 1.4075,2.03275 2.50125,4.53425 3.28375,7.42625 0.7025,2.89262 1.09375,6.254 1.09375,10.00637 l -29.86001,0 c 0,4.29888 1.01563,7.58155 3.04838,9.92628 1.954,2.34521 4.92475,3.51757 8.833,3.51757 1.56337,0 2.97013,-0.23388 4.29863,-0.78125 1.25,-0.54736 2.345,-1.17236 3.28375,-2.03271 0.86,-0.85986 1.64125,-1.71875 2.18875,-2.73584 0.46875,-0.93755 0.70375,-1.79642 0.78125,-2.50142 l 6.87875,0"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3455"
-       inkscape:connector-curvature="0" /><path
-       d="m 180.52934,220.75546 -6.88,0 -0.0788,-25.16991 c 0,-3.7525 -0.625,-6.48737 -1.9525,-8.12987 -1.25125,-1.72025 -3.51875,-2.57863 -6.80125,-2.57863 -1.5625,0 -3.205,0.38963 -4.84625,1.25 -1.64125,0.78225 -3.04875,2.1885 -4.22125,4.22113 -1.1725,2.03225 -1.71875,4.76762 -1.71875,8.13 l 0,22.27728 -6.87875,0 0,-40.88091 6.48625,0 0,5.78375 0.1575,0 c 1.1725,-1.79887 2.81375,-3.36137 4.76875,-4.84625 1.95375,-1.40762 4.53375,-2.11125 7.58125,-2.11125 2.4225,0 4.7675,0.39113 6.87875,1.251 2.11,0.78125 3.90875,2.2675 5.39375,4.37738 1.40625,2.11137 2.11125,5.003 2.11125,8.59762 l 0,27.82866"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3457"
-       inkscape:connector-curvature="0" /><path
-       d="m 208.41059,179.16955 c 0,-2.42237 -0.3125,-4.29887 -0.9375,-5.70512 -0.625,-1.48625 -1.955,-2.189 -3.90875,-2.189 -1.955,0 -3.205,0.78125 -3.90875,2.26662 -0.70375,1.48488 -1.01625,3.36138 -1.01625,5.6275 l 0,24.07613 c 0,5.55125 1.6425,8.36476 5.0025,8.36476 1.955,0 3.28375,-0.78125 3.90875,-2.42339 0.5475,-1.56387 0.86,-3.5175 0.86,-5.94137 l 0,-24.07613 z m 13.7575,22.90475 c 0,3.439 -0.31375,6.40875 -0.93875,8.83253 -0.625,2.42236 -1.64125,4.45507 -3.12625,6.17382 -1.4075,1.64259 -3.28375,2.89357 -5.70625,3.75245 -2.345,0.85986 -5.23625,1.33008 -8.755,1.33008 -3.43875,0 -6.33125,-0.47022 -8.755,-1.33008 -2.4225,-0.85888 -4.3775,-2.10986 -5.86125,-3.75245 -1.48625,-1.71875 -2.50125,-3.82861 -3.1275,-6.25146 -0.70375,-2.42476 -1.01625,-5.39501 -1.01625,-8.75489 l 0,-23.84225 c 0,-5.62887 1.6425,-9.92775 4.925,-12.97512 3.20375,-3.04888 7.8175,-4.53375 13.835,-4.53375 6.01875,0 10.63125,1.48487 13.83625,4.53375 3.12625,3.04737 4.69,7.34625 4.69,12.97512 l 0,23.84225"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3459"
-       inkscape:connector-curvature="0" /><path
-       d="m 236.4985,201.1358 0,4.14213 c 0,1.95512 0.39,3.44037 1.25,4.61279 0.7825,1.17236 2.18875,1.71972 4.22125,1.71972 1.485,0 2.57875,-0.54736 3.44,-1.71972 0.78125,-1.17242 1.17125,-2.50142 1.17125,-4.14404 0,-2.10988 -0.54625,-3.67238 -1.72,-4.76713 -1.17125,-1.09375 -3.12625,-2.50137 -5.94,-4.22112 -4.92375,-2.814 -8.4425,-5.39413 -10.39625,-7.66025 -2.6575,-3.12738 -3.9875,-7.03513 -3.9875,-11.726 0,-2.73638 0.3925,-5.15925 1.25125,-7.27 0.78125,-2.11038 1.87625,-3.83013 3.36125,-5.23638 1.485,-1.32912 3.28375,-2.42287 5.39375,-3.12737 2.11125,-0.70275 4.53375,-1.01525 7.27,-1.01525 2.81375,0 5.315,0.46875 7.50375,1.32862 2.1875,0.85988 4.06375,2.11138 5.55,3.7515 1.485,1.64113 2.57875,3.67388 3.2825,6.01863 0.70375,2.34512 1.095,5.00237 1.095,7.89637 l -12.66375,0 c -0.0775,-2.73775 -0.39,-4.77 -0.85875,-6.17625 -0.46875,-1.32912 -1.72,-2.11037 -3.675,-2.26662 -2.89125,0 -4.455,1.32775 -4.7675,3.90925 0,1.79587 0.3125,3.126 1.01625,4.14112 0.70375,1.0175 1.71875,2.03225 3.12625,3.04975 1.25,0.78125 2.8925,1.79738 5.0025,3.04738 2.11125,1.17387 3.67375,2.189 4.7675,2.89262 1.095,0.70413 2.11125,1.48538 3.05,2.34513 1.64,1.5635 2.97,3.44 3.82875,5.629 0.86125,2.1885 1.25125,5.00237 1.25125,8.36325 0,3.67387 -0.7025,6.8789 -2.0325,9.53661 -1.32875,2.57861 -3.36,4.61134 -5.94125,5.94093 -2.65625,1.32763 -5.86125,2.03271 -9.69125,2.03271 -2.97,0 -5.6275,-0.39258 -7.89625,-1.17383 -2.26625,-0.70264 -4.14125,-1.79736 -5.6275,-3.20361 -1.485,-1.40772 -2.57875,-2.9712 -3.28375,-4.76905 -0.7025,-1.79736 -1.09375,-3.67339 -1.09375,-5.62739 l 0,-6.2535 12.7425,0"
-       style="fill:#323232;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
-       id="path3461"
-       inkscape:connector-curvature="0" /></g></svg>
Index: ntrib/highlight/Syntax
===================================================================
--- contrib/highlight/Syntax	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-file ..\*\\.(bp|BP)$ Behavior\sProtocol
-include bp.syntax
-
-file ..\*\\.(adl|ADP)$ Architecture\sDescription\sLanguage
-include adl.syntax
Index: ntrib/highlight/adl.syntax
===================================================================
--- contrib/highlight/adl.syntax	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-# Architecture Description Language syntax highlighting rules
-#  by Martin Decky <martin@decky.cz>
-
-context default
-	keyword whole interface yellow
-	keyword whole frame yellow
-	keyword whole architecture yellow
-
-	keyword whole system yellow
-	keyword whole extends yellow
-	keyword whole version yellow
-
-	keyword whole inst yellow
-	keyword whole bind yellow
-	keyword whole to yellow
-	keyword whole subsume yellow
-	keyword whole delegate yellow
-
-	keyword whole sysarg_t yellow
-	keyword whole string yellow
-	keyword whole stream yellow
-	keyword whole void yellow
-
-	keyword whole in yellow
-	keyword whole in_copy yellow
-	keyword whole out yellow
-	keyword whole out_copy yellow
-
-	keyword whole protocol yellow
-	keyword whole initialization yellow
-	keyword whole finalization yellow
-	keyword whole provides yellow
-	keyword whole requires yellow
-
-	keyword /\* brown
-	keyword \*/ brown
-	keyword // brown
-
-	keyword { brightcyan
-	keyword } brightcyan
-
-	keyword ( brightcyan
-	keyword ) brightcyan
-
-	keyword , brightcyan
-	keyword : brightcyan
-	keyword ; brightmagenta
-
-	keyword [ brightblue black
-	keyword ] brightblue black
-
-context exclusive [ ] brightblue black
-	keyword % brightcyan black
-
-context exclusive /\* \*/ brown
-	spellcheck
-
-context exclusive // \n brown
-	spellcheck
Index: ntrib/highlight/bp.syntax
===================================================================
--- contrib/highlight/bp.syntax	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-# Behavior Protocols syntax highlighting rules
-#  by Martin Decky <martin@decky.cz>
-
-context default
-	keyword whole NULL yellow
-	keyword whole tentative yellow
-	keyword whole alternative yellow
-
-	keyword /\* brown
-	keyword \*/ brown
-	keyword # brown
-
-	keyword ! brightred
-	keyword ? brightgreen
-
-	keyword ( brightcyan
-	keyword ) brightcyan
-
-	keyword { brightcyan
-	keyword } brightcyan
-
-	keyword \+ brightmagenta
-	keyword ; brightmagenta
-	keyword \* brightmagenta
-	keyword | brightmagenta
-
-	keyword \. brightcyan
-
-	keyword [ brightblue black
-	keyword ] brightblue black
-
-context exclusive [ ] brightblue black
-	keyword % brightcyan black
-
-context exclusive /\* \*/ brown
-	spellcheck
-
-context exclusive # \n brown
-	spellcheck
Index: ntrib/qemu/build-from-scratch.sh
===================================================================
--- contrib/qemu/build-from-scratch.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-#!/bin/bash
-
-#
-# Copyright (c) 2014 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-VERSION=9.1.0
-BASENAME=qemu-${VERSION}
-BASENAME_MASTER=qemu-master
-TARBALL=${BASENAME}.tar.bz2
-SOURCEDIR=${BASENAME}
-URL=https://download.qemu.org/${TARBALL}
-REPO=git@github.com:qemu/qemu.git
-
-OPENSPARC_TARBALL="OpenSPARCT1_Arch.1.5.tar.bz2"
-OPENSPARC_URL="http://download.oracle.com/technetwork/systems/opensparc/${OPENSPARC_TARBALL}"
-
-ARCHIVE_PREFIX="./S10image"
-BINARIES="1up-hv.bin 1up-md.bin nvram1 openboot.bin q.bin reset.bin"
-INSTALL_PREFIX="$HOME/.local"
-
-echo "==== Downloading OpenSPARC archive ===="
-
-if [ ! -f ${OPENSPARC_TARBALL} ]
-then
-    wget ${OPENSPARC_URL}
-else
-    echo "===== OpenSPARC archive already exists, skipping. ====="
-fi
-
-echo "==== Extracting OpenSPARC binaries ===="
-(
-    mkdir -p binaries;
-
-    BINLIST=""
-    for b in ${BINARIES};
-    do
-	if [ ! -f binaries/$b ];
-	then
-	    BINLIST+=${ARCHIVE_PREFIX}/$b" "
-	else
-	    echo "===== $b seems to be already extracted, skipping. ====="
-	fi
-    done
-
-    cd binaries
-
-    if [ "${BINLIST}x" != "x" ];
-    then
-	tar --strip-components=2 -xjf ../${OPENSPARC_TARBALL} ${BINLIST}
-    fi
-)
-
-echo "==== Installing OpenSPARC binaries ===="
-
-install -d "$INSTALL_PREFIX/opensparc/image"
-install -m 0444 binaries/* "$INSTALL_PREFIX/opensparc/image"
-
-echo "==== Obtaining QEMU sources ===="
-
-if [ "$1" == "--master" ]; then
-	git clone ${REPO} ${BASENAME_MASTER}
-	cd ${BASENAME_MASTER}
-else
-	if [ ! -f ${TARBALL} ]; then
-		wget ${URL}
-	fi
-
-	if [ ! -f ${TARBALL}.sig ]; then
-		wget ${URL}.sig
-	fi
-
-	gpg --auto-key-retrieve --verify ${TARBALL}.sig ${TARBALL}
-	if [ $? -ne 0 ]; then
-		echo Unable to verify the signature
-		exit
-	fi
-
-	echo "==== Decompressing QEMU sources ===="
-	tar xfj ${TARBALL}
-	cd ${SOURCEDIR}
-fi
-
-echo "==== Configuring QEMU ===="
-
-./configure --target-list=i386-softmmu,x86_64-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,sparc64-softmmu,mips-softmmu,mipsel-softmmu --enable-gtk --enable-vte --enable-kvm --enable-curses --enable-opengl --enable-slirp --enable-pa --audio-drv-list=pa --prefix="$INSTALL_PREFIX" || exit 1
-
-echo "==== Building QEMU ===="
-
-make -j`nproc` || exit 1
-
-echo "==== Installing QEMU ===="
-
-make install
Index: ntrib/tools/font/bdf2c.pl
===================================================================
--- contrib/tools/font/bdf2c.pl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-#!/usr/bin/perl -w
-
-#
-# Copyright (c) 2000 Dmitry Bolkhovityanov
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-use strict;
-
-my $skip;
-
-my $width;
-my $height;
-my $offset_x;
-my $offset_y;
-
-my $gwidth;
-my $gheight;
-my $goffset_x;
-my $goffset_y;
-
-my $index;
-my @glyphs;
-my @chars;
-
-open(BDF, "u_vga16.bdf") or die("Unable to open source font\n");
-
-READHEADER: while (<BDF>) {
-	/^FONTBOUNDINGBOX\s/ and do {
-		($skip, $width, $height, $offset_x, $offset_y) = (split);
-
-		die("Font width is not 8px\n") if ($width != 8);
-		die("Font height is not 16px\n") if ($height != 16);
-	};
-	/^CHARS\s/ && last READHEADER;
-}
-
-READCHARS: while (<BDF>) {
-	/^ENCODING\s+([0-9]+)\s*$/ && do {
-		$index = $1;
-	};
-	/^BBX\s/ && do {
-		($skip, $gwidth, $gheight, $goffset_x, $goffset_y) = (split);
-	};
-	/^BITMAP/ && do {
-		my @glyph = ();
-		my $y;
-
-		# Add empty lines at top
-		my $empties = $height + $offset_y - $goffset_y - $gheight;
-
-		for ($y = 0; $y < $empties; $y++) {
-			$glyph[$y] = 0;
-		}
-
-		# Scan the hex bitmap
-		for ($y = $empties; $y < $empties + $gheight; $y++) {
-			$_ = <BDF>;
-			$glyph[$y] = hex(substr($_, 0, 2)) >> $goffset_x;
-		}
-
-		# Add empty lines at bottom
-		my $fill = $height - $gheight - $empties;
-		for ($y = $empties + $gheight; $y < $empties + $gheight + $fill; $y++) {
-			$glyph[$y] = 0;
-		}
-
-		if ($index != 0) {
-			$glyphs[$index] = (\@glyph);
-			push(@chars, $index);
-		}
-	};
-	/^ENDFONT/ && last READCHARS;
-}
-
-close(BDF);
-
-@chars = sort { $a <=> $b } (@chars);
-
-print "#define FONT_GLYPHS     " . (@chars + 1). "\n";
-print "#define FONT_SCANLINES  " . $height . "\n";
-
-print "\n";
-print "uint16_t fb_font_glyph(const char32_t ch)\n";
-print "{\n";
-print "\tif (ch == 0x0000)\n";
-print "\t\treturn 0;\n\n";
-
-my $pos = 0;
-my $start = -1;
-my $start_pos = 0;
-my $prev = 0;
-for $index (@chars) {
-	if ($prev + 1 < $index) {
-		if ($start != -1) {
-			if ($start == $prev) {
-				printf "\tif (ch == 0x%.4x)\n", $start;
-				print "\t\treturn " . $start_pos . ";\n";
-			} else {
-				printf "\tif ((ch >= 0x%.4x) && (ch <= 0x%.4x))\n", $start, $prev;
-				print "\t\treturn (ch - " . ($start - $start_pos) . ");\n";
-			}
-
-			print "\t\n";
-		}
-
-		$start = $index;
-		$start_pos = $pos;
-	}
-
-	$pos++;
-	$prev = $index;
-}
-
-print "\treturn " . @chars . ";\n";
-print "}\n";
-
-print "\n";
-print "uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {";
-
-for $index (@chars) {
-	print "\n\t{";
-
-	my $y;
-	for ($y = 0; $y < $height; $y++) {
-		print ", " if ($y > 0);
-		printf "0x%.2x", $glyphs[$index]->[$y];
-	}
-
-	print "},";
-}
-
-print "\n\t\n\t/* Special glyph for unknown character */\n\t{";
-my $y;
-for ($y = 0; $y < $height; $y++) {
-	print ", " if ($y > 0);
-	printf "0x%.2x", $glyphs[63]->[$y];
-}
-
-print "}\n};\n";
Index: ntrib/tools/font/u_vga16.bdf
===================================================================
--- contrib/tools/font/u_vga16.bdf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66709 +1,0 @@
-STARTFONT 2.1
-FONT -Bolkhov-VGA-Medium-R-Normal--16-160-75-75-C-80-iso10646-1
-SIZE 16 75 75
-FONTBOUNDINGBOX 8 16 0 -4
-STARTPROPERTIES 24
-FOUNDRY "Bolkhov"
-FAMILY_NAME "VGA"
-WEIGHT_NAME "Medium"
-SLANT "R"
-SETWIDTH_NAME "Normal"
-ADD_STYLE_NAME ""
-PIXEL_SIZE 16
-POINT_SIZE 160
-RESOLUTION_X 75
-RESOLUTION_Y 75
-SPACING "C"
-AVERAGE_WIDTH 80
-CHARSET_REGISTRY "iso10646"
-CHARSET_ENCODING "1"
-CAP_HEIGHT 10
-X_HEIGHT 7
-FONT_ASCENT 12
-FONT_DESCENT 4
-FACE_NAME "VGA Unicode"
-COPYRIGHT "Copyright (c) 2000 Dmitry Bolkhovityanov, bolkhov@inp.nsk.su"
-HOMEPAGE "http://www.inp.nsk.su/~bolkhov/files/fonts/univga/"
-NOTICE "VGA is a trademark of IBM Corporation."
-DEFAULT_CHAR 0
-_XMBDFED_INFO "Edited with xmbdfed 4.4."
-ENDPROPERTIES
-CHARS 2899
-STARTCHAR char0
-ENCODING 0
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DA
-02
-80
-82
-02
-80
-82
-02
-80
-B6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR space
-ENCODING 32
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR exclam
-ENCODING 33
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-3C
-3C
-18
-18
-18
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotedbl
-ENCODING 34
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-66
-66
-66
-24
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR numbersign
-ENCODING 35
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-6C
-6C
-FE
-6C
-6C
-6C
-FE
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dollar
-ENCODING 36
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-7C
-C6
-C2
-C0
-7C
-06
-06
-86
-C6
-7C
-18
-18
-00
-00
-ENDCHAR
-STARTCHAR percent
-ENCODING 37
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C2
-C6
-0C
-18
-30
-60
-C6
-86
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ampersand
-ENCODING 38
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-6C
-38
-76
-DC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotesingle
-ENCODING 39
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-30
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR parenleft
-ENCODING 40
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-30
-30
-30
-30
-30
-30
-18
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR parenright
-ENCODING 41
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-18
-0C
-0C
-0C
-0C
-0C
-0C
-18
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR asterisk
-ENCODING 42
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-3C
-FF
-3C
-66
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR plus
-ENCODING 43
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-18
-7E
-18
-18
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR comma
-ENCODING 44
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-18
-30
-00
-00
-00
-ENDCHAR
-STARTCHAR hyphen
-ENCODING 45
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR period
-ENCODING 46
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR slash
-ENCODING 47
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-02
-06
-0C
-18
-30
-60
-C0
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zero
-ENCODING 48
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-C6
-C6
-D6
-D6
-C6
-C6
-6C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR one
-ENCODING 49
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-38
-78
-18
-18
-18
-18
-18
-18
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR two
-ENCODING 50
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-06
-0C
-18
-30
-60
-C0
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR three
-ENCODING 51
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-06
-06
-3C
-06
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR four
-ENCODING 52
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-1C
-3C
-6C
-CC
-FE
-0C
-0C
-0C
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR five
-ENCODING 53
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C0
-C0
-C0
-FC
-06
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR six
-ENCODING 54
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-60
-C0
-C0
-FC
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR seven
-ENCODING 55
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-06
-06
-0C
-18
-30
-30
-30
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR eight
-ENCODING 56
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-7C
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR nine
-ENCODING 57
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-7E
-06
-06
-06
-0C
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR colon
-ENCODING 58
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR semicolon
-ENCODING 59
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-00
-00
-18
-18
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR less
-ENCODING 60
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-0C
-18
-30
-60
-30
-18
-0C
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR equal
-ENCODING 61
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR greater
-ENCODING 62
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-60
-30
-18
-0C
-06
-0C
-18
-30
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR question
-ENCODING 63
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-0C
-18
-18
-18
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR at
-ENCODING 64
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-C6
-C6
-DE
-DE
-DE
-DC
-C0
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR A
-ENCODING 65
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR B
-ENCODING 66
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR C
-ENCODING 67
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR D
-ENCODING 68
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR E
-ENCODING 69
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR F
-ENCODING 70
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR G
-ENCODING 71
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H
-ENCODING 72
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR I
-ENCODING 73
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR J
-ENCODING 74
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-0C
-0C
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR K
-ENCODING 75
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR L
-ENCODING 76
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR M
-ENCODING 77
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR N
-ENCODING 78
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR O
-ENCODING 79
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR P
-ENCODING 80
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Q
-ENCODING 81
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-D6
-DE
-7C
-0C
-0E
-00
-00
-ENDCHAR
-STARTCHAR R
-ENCODING 82
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR S
-ENCODING 83
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-60
-38
-0C
-06
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR T
-ENCODING 84
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR U
-ENCODING 85
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR V
-ENCODING 86
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-6C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR W
-ENCODING 87
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR X
-ENCODING 88
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-7C
-38
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Y
-ENCODING 89
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Z
-ENCODING 90
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR bracketleft
-ENCODING 91
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-30
-30
-30
-30
-30
-30
-30
-30
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR backslash
-ENCODING 92
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-80
-C0
-E0
-70
-38
-1C
-0E
-06
-02
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR bracketright
-ENCODING 93
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR asciicircum
-ENCODING 94
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-6C
-C6
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR underscore
-ENCODING 95
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-ENDCHAR
-STARTCHAR grave
-ENCODING 96
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR a
-ENCODING 97
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR b
-ENCODING 98
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR c
-ENCODING 99
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR d
-ENCODING 100
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR e
-ENCODING 101
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR f
-ENCODING 102
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-64
-60
-F0
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR g
-ENCODING 103
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR h
-ENCODING 104
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR i
-ENCODING 105
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR j
-ENCODING 106
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-00
-0E
-06
-06
-06
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR k
-ENCODING 107
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR l
-ENCODING 108
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 109
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR n
-ENCODING 110
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR o
-ENCODING 111
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR p
-ENCODING 112
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR q
-ENCODING 113
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-0C
-1E
-00
-ENDCHAR
-STARTCHAR r
-ENCODING 114
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR s
-ENCODING 115
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR t
-ENCODING 116
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR u
-ENCODING 117
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR v
-ENCODING 118
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR w
-ENCODING 119
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR x
-ENCODING 120
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-6C
-38
-38
-38
-6C
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR y
-ENCODING 121
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR z
-ENCODING 122
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR braceleft
-ENCODING 123
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-18
-18
-18
-70
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR bar
-ENCODING 124
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-00
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR braceright
-ENCODING 125
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-18
-18
-18
-0E
-18
-18
-18
-18
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR asciitilde
-ENCODING 126
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR char127
-ENCODING 127
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-38
-6C
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR space
-ENCODING 160
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR exclamdown
-ENCODING 161
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-18
-18
-18
-3C
-3C
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR cent
-ENCODING 162
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-3C
-66
-60
-60
-60
-66
-3C
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR sterling
-ENCODING 163
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-64
-60
-F0
-60
-60
-60
-60
-E6
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR currency
-ENCODING 164
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-66
-3C
-66
-66
-66
-3C
-66
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR yen
-ENCODING 165
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-3C
-18
-7E
-18
-7E
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR brokenbar
-ENCODING 166
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-00
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR section
-ENCODING 167
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-C6
-60
-38
-6C
-C6
-C6
-6C
-38
-0C
-C6
-7C
-00
-00
-00
-ENDCHAR
-STARTCHAR dieresis
-ENCODING 168
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR copyright
-ENCODING 169
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-99
-A5
-A1
-A1
-A5
-99
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ordfeminine
-ENCODING 170
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-3C
-6C
-6C
-3E
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR guillemotleft
-ENCODING 171
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-36
-6C
-D8
-6C
-36
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR logicalnot
-ENCODING 172
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FE
-06
-06
-06
-06
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR hyphen
-ENCODING 173
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-3C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR registered
-ENCODING 174
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-44
-BA
-B2
-AA
-44
-38
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR macron
-ENCODING 175
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR degree
-ENCODING 176
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-6C
-38
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR plusminus
-ENCODING 177
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-7E
-18
-18
-00
-7E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR twosuperior
-ENCODING 178
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D8
-30
-60
-C8
-F8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR threesuperior
-ENCODING 179
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D8
-30
-18
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR acute
-ENCODING 180
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR mu
-ENCODING 181
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-F6
-C0
-C0
-C0
-00
-ENDCHAR
-STARTCHAR paragraph
-ENCODING 182
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7F
-DB
-DB
-DB
-7B
-1B
-1B
-1B
-1B
-1B
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR periodcentered
-ENCODING 183
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR cedilla
-ENCODING 184
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR onesuperior
-ENCODING 185
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-70
-30
-30
-30
-78
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ordmasculine
-ENCODING 186
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-6C
-38
-00
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR guillemotright
-ENCODING 187
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D8
-6C
-36
-6C
-D8
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR onequarter
-ENCODING 188
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-66
-CE
-9E
-3E
-06
-06
-00
-00
-ENDCHAR
-STARTCHAR onehalf
-ENCODING 189
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-DC
-86
-0C
-18
-3E
-00
-00
-ENDCHAR
-STARTCHAR threequarters
-ENCODING 190
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-62
-36
-EC
-18
-30
-66
-CE
-9E
-3E
-06
-06
-00
-00
-ENDCHAR
-STARTCHAR questiondown
-ENCODING 191
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-30
-30
-60
-C0
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Agrave
-ENCODING 192
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Aacute
-ENCODING 193
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Acircumflex
-ENCODING 194
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-6C
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Atilde
-ENCODING 195
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Adieresis
-ENCODING 196
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Aring
-ENCODING 197
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-38
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR AE
-ENCODING 198
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-6C
-CC
-CC
-FE
-CC
-CC
-CC
-CC
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ccedilla
-ENCODING 199
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR Egrave
-ENCODING 200
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-18
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Eacute
-ENCODING 201
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ecircumflex
-ENCODING 202
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Edieresis
-ENCODING 203
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Igrave
-ENCODING 204
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-18
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Iacute
-ENCODING 205
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Icircumflex
-ENCODING 206
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-3C
-42
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Idieresis
-ENCODING 207
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Eth
-ENCODING 208
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-F6
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ntilde
-ENCODING 209
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ograve
-ENCODING 210
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Oacute
-ENCODING 211
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ocircumflex
-ENCODING 212
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Otilde
-ENCODING 213
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Odieresis
-ENCODING 214
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR multiply
-ENCODING 215
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-3C
-18
-3C
-66
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Oslash
-ENCODING 216
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7A
-C4
-CE
-CE
-D6
-D6
-E6
-E6
-46
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ugrave
-ENCODING 217
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Uacute
-ENCODING 218
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ucircumflex
-ENCODING 219
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Udieresis
-ENCODING 220
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Yacute
-ENCODING 221
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Thorn
-ENCODING 222
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-7C
-66
-66
-66
-66
-7C
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR germandbls
-ENCODING 223
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-6C
-66
-66
-66
-66
-EC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR agrave
-ENCODING 224
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR aacute
-ENCODING 225
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-30
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR acircumflex
-ENCODING 226
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR atilde
-ENCODING 227
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR adieresis
-ENCODING 228
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR aring
-ENCODING 229
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ae
-ENCODING 230
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-76
-36
-7E
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ccedilla
-ENCODING 231
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR egrave
-ENCODING 232
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR eacute
-ENCODING 233
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ecircumflex
-ENCODING 234
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR edieresis
-ENCODING 235
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR igrave
-ENCODING 236
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR iacute
-ENCODING 237
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR icircumflex
-ENCODING 238
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR idieresis
-ENCODING 239
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR eth
-ENCODING 240
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-1C
-3C
-06
-7E
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ntilde
-ENCODING 241
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ograve
-ENCODING 242
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR oacute
-ENCODING 243
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ocircumflex
-ENCODING 244
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR otilde
-ENCODING 245
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR odieresis
-ENCODING 246
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR divide
-ENCODING 247
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-7E
-00
-18
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR oslash
-ENCODING 248
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7A
-C4
-CE
-D6
-E6
-46
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ugrave
-ENCODING 249
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uacute
-ENCODING 250
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-30
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ucircumflex
-ENCODING 251
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR udieresis
-ENCODING 252
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR yacute
-ENCODING 253
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR thorn
-ENCODING 254
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-7C
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR ydieresis
-ENCODING 255
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR Amacron
-ENCODING 256
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR amacron
-ENCODING 257
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Abreve
-ENCODING 258
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR abreve
-ENCODING 259
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Aogonek
-ENCODING 260
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-0C
-18
-0E
-00
-ENDCHAR
-STARTCHAR aogonek
-ENCODING 261
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-0C
-18
-0E
-00
-ENDCHAR
-STARTCHAR Cacute
-ENCODING 262
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-3C
-66
-C2
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR cacute
-ENCODING 263
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ccircumflex
-ENCODING 264
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-3C
-66
-C2
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ccircumflex
-ENCODING 265
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Cdotaccent
-ENCODING 266
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-3C
-66
-C2
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR cdotaccent
-ENCODING 267
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ccaron
-ENCODING 268
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-3C
-66
-C2
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ccaron
-ENCODING 269
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Dcaron
-ENCODING 270
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-F8
-6C
-66
-66
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dcaron
-ENCODING 271
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Dcroat
-ENCODING 272
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-F6
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dcroat
-ENCODING 273
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-3E
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Emacron
-ENCODING 274
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR emacron
-ENCODING 275
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ebreve
-ENCODING 276
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ebreve
-ENCODING 277
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Edotaccent
-ENCODING 278
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR edotaccent
-ENCODING 279
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Eogonek
-ENCODING 280
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-18
-30
-1C
-00
-ENDCHAR
-STARTCHAR eogonek
-ENCODING 281
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR Ecaron
-ENCODING 282
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ecaron
-ENCODING 283
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Gcircumflex
-ENCODING 284
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gcircumflex
-ENCODING 285
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR Gbreve
-ENCODING 286
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gbreve
-ENCODING 287
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR Gdotaccent
-ENCODING 288
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gdotaccent
-ENCODING 289
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR Gcommaaccent
-ENCODING 290
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-DE
-C6
-C6
-66
-3A
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR gcommaaccent
-ENCODING 291
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-30
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR Hcircumflex
-ENCODING 292
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR hcircumflex
-ENCODING 293
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-E0
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Hbar
-ENCODING 294
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-FF
-66
-66
-7E
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR hbar
-ENCODING 295
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-F8
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Itilde
-ENCODING 296
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR itilde
-ENCODING 297
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Imacron
-ENCODING 298
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7E
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR imacron
-ENCODING 299
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7E
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ibreve
-ENCODING 300
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-3C
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ibreve
-ENCODING 301
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-3C
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Iogonek
-ENCODING 302
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-18
-30
-1C
-00
-ENDCHAR
-STARTCHAR iogonek
-ENCODING 303
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-18
-30
-1C
-00
-ENDCHAR
-STARTCHAR Idotaccent
-ENCODING 304
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dotlessi
-ENCODING 305
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR IJ
-ENCODING 306
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F7
-63
-63
-63
-63
-63
-63
-7B
-7B
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ij
-ENCODING 307
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-00
-EE
-66
-66
-66
-66
-66
-F6
-06
-66
-3C
-00
-ENDCHAR
-STARTCHAR Jcircumflex
-ENCODING 308
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-1C
-22
-1E
-0C
-0C
-0C
-0C
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR jcircumflex
-ENCODING 309
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-0E
-1B
-00
-0E
-06
-06
-06
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR Kcommaaccent
-ENCODING 310
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR kcommaaccent
-ENCODING 311
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR kgreenlandic
-ENCODING 312
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Lacute
-ENCODING 313
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-30
-00
-F0
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lacute
-ENCODING 314
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-38
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Lcommaaccent
-ENCODING 315
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR lcommaaccent
-ENCODING 316
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR Lcaron
-ENCODING 317
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-F0
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lcaron
-ENCODING 318
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-38
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ldot
-ENCODING 319
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-66
-66
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ldot
-ENCODING 320
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-30
-30
-30
-36
-36
-30
-30
-30
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Lslash
-ENCODING 321
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-78
-E0
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lslash
-ENCODING 322
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-1E
-78
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Nacute
-ENCODING 323
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR nacute
-ENCODING 324
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ncommaaccent
-ENCODING 325
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR ncommaaccent
-ENCODING 326
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR Ncaron
-ENCODING 327
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ncaron
-ENCODING 328
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR napostrophe
-ENCODING 329
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-60
-C0
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Eng
-ENCODING 330
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR eng
-ENCODING 331
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR Omacron
-ENCODING 332
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR omacron
-ENCODING 333
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Obreve
-ENCODING 334
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR obreve
-ENCODING 335
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ohungarumlaut
-ENCODING 336
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-CC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ohungarumlaut
-ENCODING 337
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-CC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR OE
-ENCODING 338
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6E
-D8
-D8
-D8
-DE
-D8
-D8
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR oe
-ENCODING 339
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-D6
-D6
-DE
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Racute
-ENCODING 340
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR racute
-ENCODING 341
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Rcommaaccent
-ENCODING 342
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-66
-E6
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR rcommaaccent
-ENCODING 343
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR Rcaron
-ENCODING 344
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR rcaron
-ENCODING 345
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Sacute
-ENCODING 346
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR sacute
-ENCODING 347
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Scircumflex
-ENCODING 348
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR scircumflex
-ENCODING 349
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Scedilla
-ENCODING 350
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR scedilla
-ENCODING 351
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR Scaron
-ENCODING 352
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR scaron
-ENCODING 353
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Tcommaaccent
-ENCODING 354
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR tcommaaccent
-ENCODING 355
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR Tcaron
-ENCODING 356
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-7E
-7E
-5A
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR tcaron
-ENCODING 357
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-10
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Tbar
-ENCODING 358
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-3C
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR tbar
-ENCODING 359
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-FC
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Utilde
-ENCODING 360
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR utilde
-ENCODING 361
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Umacron
-ENCODING 362
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR umacron
-ENCODING 363
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-78
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ubreve
-ENCODING 364
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ubreve
-ENCODING 365
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-78
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Uring
-ENCODING 366
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-38
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uring
-ENCODING 367
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-38
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Uhungarumlaut
-ENCODING 368
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-CC
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uhungarumlaut
-ENCODING 369
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Uogonek
-ENCODING 370
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uogonek
-ENCODING 371
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR Wcircumflex
-ENCODING 372
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR wcircumflex
-ENCODING 373
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ycircumflex
-ENCODING 374
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ycircumflex
-ENCODING 375
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR Ydieresis
-ENCODING 376
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-66
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Zacute
-ENCODING 377
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-FE
-C6
-8C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zacute
-ENCODING 378
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Zdotaccent
-ENCODING 379
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FE
-C6
-8C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zdotaccent
-ENCODING 380
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Zcaron
-ENCODING 381
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-FE
-C6
-8C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zcaron
-ENCODING 382
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR longs
-ENCODING 383
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-64
-60
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0180
-ENCODING 384
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-F8
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0181
-ENCODING 385
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-B3
-B3
-33
-3E
-33
-33
-33
-33
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0182
-ENCODING 386
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-64
-60
-60
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0183
-ENCODING 387
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-62
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0184
-ENCODING 388
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-E6
-E6
-66
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0185
-ENCODING 389
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-E0
-E0
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0186
-ENCODING 390
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-86
-06
-06
-06
-06
-86
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0187
-ENCODING 391
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-03
-3E
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0188
-ENCODING 392
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-7E
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0189
-ENCODING 393
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-F6
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni018A
-ENCODING 394
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-B6
-B3
-33
-33
-33
-33
-33
-36
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni018B
-ENCODING 395
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-4C
-0C
-0C
-7C
-CC
-CC
-CC
-CC
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni018C
-ENCODING 396
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-4C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni018D
-ENCODING 397
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-7C
-30
-18
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni018E
-ENCODING 398
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-CC
-8C
-2C
-3C
-2C
-0C
-8C
-CC
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni018F
-ENCODING 399
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-06
-06
-06
-FE
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0190
-ENCODING 400
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C2
-C0
-78
-C0
-C0
-C2
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0191
-ENCODING 401
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-60
-60
-60
-60
-60
-C0
-00
-ENDCHAR
-STARTCHAR florin
-ENCODING 402
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-36
-32
-30
-78
-30
-30
-30
-30
-30
-30
-30
-E0
-00
-ENDCHAR
-STARTCHAR uni0193
-ENCODING 403
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-03
-3E
-66
-C2
-C0
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0194
-ENCODING 404
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-6C
-6C
-6C
-38
-38
-10
-38
-6C
-38
-00
-00
-ENDCHAR
-STARTCHAR uni0195
-ENCODING 405
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-F3
-DB
-DB
-DB
-DB
-DB
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0196
-ENCODING 406
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-30
-30
-30
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0197
-ENCODING 407
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0198
-ENCODING 408
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-6D
-6C
-78
-70
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0199
-ENCODING 409
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni019A
-ENCODING 410
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni019B
-ENCODING 411
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C8
-38
-70
-D0
-38
-38
-6C
-64
-C6
-C2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni019C
-ENCODING 412
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-FE
-EC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni019D
-ENCODING 413
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-76
-7E
-7E
-6E
-66
-66
-66
-66
-60
-60
-C0
-00
-ENDCHAR
-STARTCHAR uni019E
-ENCODING 414
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR uni019F
-ENCODING 415
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ohorn
-ENCODING 416
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-03
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ohorn
-ENCODING 417
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01A2
-ENCODING 418
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-73
-DF
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-73
-03
-03
-03
-00
-ENDCHAR
-STARTCHAR uni01A3
-ENCODING 419
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-73
-DF
-DB
-DB
-DB
-DB
-73
-03
-03
-03
-00
-ENDCHAR
-STARTCHAR uni01A4
-ENCODING 420
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-B3
-B3
-33
-3E
-30
-30
-30
-30
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01A5
-ENCODING 421
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-7C
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR uni01A6
-ENCODING 422
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-7C
-66
-66
-7C
-78
-6C
-6C
-E6
-06
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01A7
-ENCODING 423
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-0C
-38
-60
-C0
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01A8
-ENCODING 424
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-0C
-38
-60
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01A9
-ENCODING 425
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-62
-30
-18
-18
-30
-62
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01AA
-ENCODING 426
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-78
-18
-18
-18
-18
-18
-18
-18
-18
-1B
-0E
-00
-ENDCHAR
-STARTCHAR uni01AB
-ENCODING 427
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-0C
-6C
-38
-00
-ENDCHAR
-STARTCHAR uni01AC
-ENCODING 428
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-FE
-9A
-58
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01AD
-ENCODING 429
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-36
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01AE
-ENCODING 430
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-18
-18
-18
-0E
-00
-ENDCHAR
-STARTCHAR Uhorn
-ENCODING 431
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-03
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uhorn
-ENCODING 432
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B1
-ENCODING 433
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-6C
-6C
-6C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B2
-ENCODING 434
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B3
-ENCODING 435
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-63
-B3
-B3
-33
-1E
-0C
-0C
-0C
-0C
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B4
-ENCODING 436
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-0D
-CC
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-18
-F0
-00
-ENDCHAR
-STARTCHAR uni01B5
-ENCODING 437
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-7E
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B6
-ENCODING 438
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-FC
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01B7
-ENCODING 439
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-06
-0C
-18
-30
-7C
-06
-06
-06
-06
-C6
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni01B8
-ENCODING 440
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C0
-60
-30
-18
-7C
-C0
-C0
-C0
-C0
-C6
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni01B9
-ENCODING 441
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-C0
-60
-30
-78
-C0
-C0
-C0
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni01BA
-ENCODING 442
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-06
-0C
-18
-3C
-06
-7C
-C0
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni01BB
-ENCODING 443
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-06
-0C
-7E
-30
-60
-C0
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01BC
-ENCODING 444
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-60
-60
-78
-0C
-06
-06
-06
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01BD
-ENCODING 445
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-60
-78
-0C
-06
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01BE
-ENCODING 446
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-18
-4C
-6C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01BF
-ENCODING 447
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-6C
-78
-70
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR uni01C0
-ENCODING 448
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C1
-ENCODING 449
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C2
-ENCODING 450
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-7E
-18
-7E
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C3
-ENCODING 451
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-3C
-3C
-18
-18
-18
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C4
-ENCODING 452
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1B
-0E
-04
-F7
-D9
-D9
-DA
-DA
-DA
-DC
-DC
-F7
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C5
-ENCODING 453
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F5
-DA
-D8
-DF
-D9
-DA
-DA
-DA
-DC
-F7
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C6
-ENCODING 454
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3D
-1A
-18
-7F
-D9
-DA
-DA
-DA
-DC
-6F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C7
-ENCODING 455
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C7
-C3
-C3
-C3
-C3
-C3
-C3
-C3
-CB
-F6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01C8
-ENCODING 456
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F3
-63
-60
-67
-63
-63
-63
-67
-6F
-FF
-03
-1B
-0E
-00
-ENDCHAR
-STARTCHAR uni01C9
-ENCODING 457
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E3
-63
-60
-67
-63
-63
-63
-63
-63
-F3
-03
-33
-1E
-00
-ENDCHAR
-STARTCHAR uni01CA
-ENCODING 458
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-FB
-FB
-FB
-DB
-DB
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01CB
-ENCODING 459
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-F8
-FF
-FB
-FB
-DB
-DB
-DB
-DB
-03
-33
-1E
-00
-ENDCHAR
-STARTCHAR uni01CC
-ENCODING 460
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-00
-B7
-DB
-DB
-DB
-DB
-DB
-DB
-03
-33
-1E
-00
-ENDCHAR
-STARTCHAR uni01CD
-ENCODING 461
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01CE
-ENCODING 462
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01CF
-ENCODING 463
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D0
-ENCODING 464
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D1
-ENCODING 465
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D2
-ENCODING 466
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D3
-ENCODING 467
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D4
-ENCODING 468
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D5
-ENCODING 469
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D6
-ENCODING 470
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-78
-00
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D7
-ENCODING 471
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-10
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D8
-ENCODING 472
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-30
-00
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01D9
-ENCODING 473
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-28
-10
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DA
-ENCODING 474
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-78
-30
-00
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DB
-ENCODING 475
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-10
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DC
-ENCODING 476
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DD
-ENCODING 477
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-06
-FE
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DE
-ENCODING 478
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-6C
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01DF
-ENCODING 479
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E0
-ENCODING 480
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-30
-30
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E1
-ENCODING 481
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-30
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E2
-ENCODING 482
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-3E
-6C
-CC
-CC
-FE
-CC
-CC
-CC
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E3
-ENCODING 483
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-CC
-76
-36
-7E
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E4
-ENCODING 484
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-DE
-C6
-DF
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E5
-ENCODING 485
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-CC
-CC
-CC
-CC
-7C
-0C
-3E
-CC
-78
-00
-ENDCHAR
-STARTCHAR Gcaron
-ENCODING 486
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gcaron
-ENCODING 487
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni01E8
-ENCODING 488
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-E6
-66
-66
-6C
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01E9
-ENCODING 489
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-E0
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01EA
-ENCODING 490
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni01EB
-ENCODING 491
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni01EC
-ENCODING 492
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni01ED
-ENCODING 493
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni01EE
-ENCODING 494
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-FE
-0C
-18
-30
-7C
-06
-06
-06
-06
-C6
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni01EF
-ENCODING 495
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-FE
-06
-0C
-18
-3C
-06
-06
-06
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni01F0
-ENCODING 496
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1B
-0E
-04
-00
-0E
-06
-06
-06
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR uni01F1
-ENCODING 497
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F7
-D9
-D9
-DA
-DA
-DA
-DA
-DC
-DC
-F7
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F2
-ENCODING 498
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-D8
-D8
-DF
-D9
-DA
-DA
-DA
-DC
-F7
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F3
-ENCODING 499
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-7F
-D9
-DA
-DA
-DA
-DC
-6F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F4
-ENCODING 500
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F5
-ENCODING 501
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-30
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni01F6
-ENCODING 502
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D8
-D8
-D8
-DB
-FB
-DB
-DB
-DB
-DB
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F7
-ENCODING 503
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-66
-6C
-78
-70
-60
-60
-60
-60
-E0
-00
-ENDCHAR
-STARTCHAR uni01F8
-ENCODING 504
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni01F9
-ENCODING 505
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-18
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Aringacute
-ENCODING 506
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-38
-6C
-38
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR aringacute
-ENCODING 507
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-38
-6C
-38
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR AEacute
-ENCODING 508
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-3E
-6C
-CC
-CC
-FE
-CC
-CC
-CC
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR aeacute
-ENCODING 509
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-CC
-76
-36
-7E
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Oslashacute
-ENCODING 510
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7A
-C4
-CE
-CE
-D6
-E6
-E6
-46
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR oslashacute
-ENCODING 511
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7A
-C4
-CE
-D6
-E6
-46
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0200
-ENCODING 512
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0201
-ENCODING 513
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0202
-ENCODING 514
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0203
-ENCODING 515
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0204
-ENCODING 516
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0205
-ENCODING 517
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0206
-ENCODING 518
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0207
-ENCODING 519
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0208
-ENCODING 520
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0209
-ENCODING 521
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020A
-ENCODING 522
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-3C
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020B
-ENCODING 523
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020C
-ENCODING 524
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020D
-ENCODING 525
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020E
-ENCODING 526
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni020F
-ENCODING 527
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0210
-ENCODING 528
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0211
-ENCODING 529
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0212
-ENCODING 530
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0213
-ENCODING 531
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0214
-ENCODING 532
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0215
-ENCODING 533
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0216
-ENCODING 534
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0217
-ENCODING 535
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Scommaaccent
-ENCODING 536
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-60
-38
-0C
-06
-C6
-C6
-7C
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR scommaaccent
-ENCODING 537
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR Tcommaaccent
-ENCODING 538
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR tcommaaccent
-ENCODING 539
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-18
-18
-30
-ENDCHAR
-STARTCHAR uni021C
-ENCODING 540
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-86
-06
-1C
-74
-06
-06
-06
-06
-1C
-F0
-00
-00
-ENDCHAR
-STARTCHAR uni021D
-ENCODING 541
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-0E
-3C
-06
-06
-1C
-F0
-00
-00
-ENDCHAR
-STARTCHAR uni021E
-ENCODING 542
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni021F
-ENCODING 543
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-E0
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0222
-ENCODING 546
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-C6
-C6
-C6
-7C
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0223
-ENCODING 547
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-66
-66
-66
-3C
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0224
-ENCODING 548
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-18
-30
-60
-C0
-C0
-FC
-06
-0C
-00
-00
-ENDCHAR
-STARTCHAR uni0225
-ENCODING 549
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-60
-C0
-FC
-06
-0C
-00
-00
-ENDCHAR
-STARTCHAR uni0226
-ENCODING 550
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0227
-ENCODING 551
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0228
-ENCODING 552
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni0229
-ENCODING 553
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni022A
-ENCODING 554
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni022B
-ENCODING 555
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni022C
-ENCODING 556
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-72
-9C
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni022D
-ENCODING 557
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-76
-DC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni022E
-ENCODING 558
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni022F
-ENCODING 559
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0230
-ENCODING 560
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-00
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0231
-ENCODING 561
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-30
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0232
-ENCODING 562
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-3C
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0233
-ENCODING 563
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni0250
-ENCODING 592
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-7C
-60
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0251
-ENCODING 593
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-74
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0252
-ENCODING 594
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-5C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0253
-ENCODING 595
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0254
-ENCODING 596
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0255
-ENCODING 597
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-DC
-E6
-7C
-80
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0256
-ENCODING 598
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-7C
-0C
-0D
-06
-00
-ENDCHAR
-STARTCHAR uni0257
-ENCODING 599
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-0D
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0258
-ENCODING 600
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0259
-ENCODING 601
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-06
-FE
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025A
-ENCODING 602
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3B
-6C
-8E
-16
-26
-6C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025B
-ENCODING 603
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-78
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025C
-ENCODING 604
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-3C
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025D
-ENCODING 605
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7A
-CD
-0D
-38
-0C
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025E
-ENCODING 606
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-DC
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni025F
-ENCODING 607
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0E
-06
-06
-1F
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR uni0260
-ENCODING 608
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-0D
-7C
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni0261
-ENCODING 609
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni0262
-ENCODING 610
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-CE
-C6
-C6
-7A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0263
-ENCODING 611
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-46
-6C
-2C
-2C
-38
-18
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR uni0264
-ENCODING 612
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C2
-64
-28
-38
-38
-6C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0265
-ENCODING 613
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CE
-CC
-CC
-CC
-CC
-DC
-6C
-0C
-0C
-0E
-00
-ENDCHAR
-STARTCHAR uni0266
-ENCODING 614
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0267
-ENCODING 615
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-6C
-76
-66
-66
-66
-66
-E6
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR uni0268
-ENCODING 616
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-3C
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0269
-ENCODING 617
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni026A
-ENCODING 618
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni026B
-ENCODING 619
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-7B
-DE
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni026C
-ENCODING 620
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-78
-58
-3E
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni026D
-ENCODING 621
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-1B
-0E
-00
-ENDCHAR
-STARTCHAR uni026E
-ENCODING 622
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-7F
-63
-66
-6C
-7E
-63
-F3
-03
-33
-1E
-00
-ENDCHAR
-STARTCHAR uni026F
-ENCODING 623
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-D6
-D6
-D6
-FE
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0270
-ENCODING 624
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-D6
-D6
-D6
-FE
-6E
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR uni0271
-ENCODING 625
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR uni0272
-ENCODING 626
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-60
-60
-C0
-00
-ENDCHAR
-STARTCHAR uni0273
-ENCODING 627
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-06
-06
-03
-00
-ENDCHAR
-STARTCHAR uni0274
-ENCODING 628
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0275
-ENCODING 629
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-FE
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0276
-ENCODING 630
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6E
-D8
-D8
-DE
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0277
-ENCODING 631
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-C6
-D6
-D6
-D6
-D6
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0278
-ENCODING 632
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-7C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR uni0279
-ENCODING 633
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1E
-0C
-0C
-0C
-CC
-DC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni027A
-ENCODING 634
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-0C
-0C
-0C
-CC
-DC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni027B
-ENCODING 635
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1E
-0C
-0C
-0C
-CC
-DC
-6C
-0C
-0D
-06
-00
-ENDCHAR
-STARTCHAR uni027C
-ENCODING 636
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-60
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR uni027D
-ENCODING 637
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-60
-60
-6C
-38
-00
-ENDCHAR
-STARTCHAR uni027E
-ENCODING 638
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni027F
-ENCODING 639
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-CC
-CC
-0C
-0C
-0C
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0280
-ENCODING 640
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FC
-66
-66
-7C
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0281
-ENCODING 641
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-66
-6C
-7C
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0282
-ENCODING 642
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-FC
-C0
-D8
-70
-00
-ENDCHAR
-STARTCHAR uni0283
-ENCODING 643
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-1B
-19
-18
-18
-18
-18
-18
-18
-18
-98
-D8
-70
-00
-ENDCHAR
-STARTCHAR uni0284
-ENCODING 644
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-1B
-19
-18
-18
-18
-18
-18
-18
-3C
-98
-D8
-70
-00
-ENDCHAR
-STARTCHAR uni0285
-ENCODING 645
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-D8
-18
-18
-18
-18
-1B
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0286
-ENCODING 646
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0E
-1B
-18
-18
-18
-18
-18
-18
-7E
-D8
-70
-00
-ENDCHAR
-STARTCHAR uni0287
-ENCODING 647
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-18
-18
-18
-18
-7E
-18
-18
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0288
-ENCODING 648
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-30
-30
-30
-36
-1C
-00
-ENDCHAR
-STARTCHAR uni0289
-ENCODING 649
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-FF
-66
-66
-3B
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028A
-ENCODING 650
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-EE
-6C
-6C
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028B
-ENCODING 651
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028C
-ENCODING 652
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-3C
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028D
-ENCODING 653
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-FE
-D6
-D6
-D6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028E
-ENCODING 654
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-60
-C0
-FC
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni028F
-ENCODING 655
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-3C
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0290
-ENCODING 656
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-06
-06
-03
-00
-ENDCHAR
-STARTCHAR uni0291
-ENCODING 657
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-66
-CB
-FE
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0292
-ENCODING 658
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-06
-0C
-18
-3C
-06
-06
-06
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni0293
-ENCODING 659
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-06
-0C
-18
-3C
-06
-06
-7E
-C7
-7C
-00
-ENDCHAR
-STARTCHAR uni0294
-ENCODING 660
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-06
-1C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0295
-ENCODING 661
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C0
-70
-30
-30
-30
-30
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0296
-ENCODING 662
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-1C
-06
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0297
-ENCODING 663
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C0
-C0
-C0
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni0298
-ENCODING 664
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C3
-C3
-DB
-DB
-C3
-C3
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0299
-ENCODING 665
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FC
-66
-66
-7C
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni029A
-ENCODING 666
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-76
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni029B
-ENCODING 667
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-7E
-C6
-C0
-CE
-C6
-C6
-7A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni029C
-ENCODING 668
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR j
-ENCODING 669
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0C
-00
-1C
-0C
-0C
-0C
-0C
-0C
-0C
-7E
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni029D
-ENCODING 670
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CE
-CC
-6C
-3C
-3C
-6C
-CC
-0C
-0C
-0E
-00
-ENDCHAR
-STARTCHAR uni029E
-ENCODING 671
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F0
-60
-60
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni029F
-ENCODING 672
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-0D
-7C
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-0C
-1E
-00
-ENDCHAR
-STARTCHAR uni02A0
-ENCODING 673
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-06
-1C
-18
-7E
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A1
-ENCODING 674
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C0
-70
-30
-FC
-30
-30
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A2
-ENCODING 675
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-7F
-D9
-DA
-DA
-DA
-DC
-6F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A3
-ENCODING 676
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-7F
-DB
-DB
-DE
-DE
-DB
-6B
-03
-1B
-0E
-00
-ENDCHAR
-STARTCHAR uni02A4
-ENCODING 677
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-7F
-D9
-DA
-DA
-DB
-DD
-6F
-04
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A5
-ENCODING 678
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-60
-60
-F6
-6D
-6C
-66
-63
-6B
-36
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A6
-ENCODING 679
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-26
-6D
-6C
-FC
-6C
-6C
-6C
-6C
-6C
-3C
-0C
-2C
-18
-00
-ENDCHAR
-STARTCHAR uni02A7
-ENCODING 680
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-60
-60
-F6
-6D
-6C
-6C
-6E
-6D
-36
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02A8
-ENCODING 681
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-C0
-FE
-DB
-DB
-DB
-DB
-DB
-DB
-03
-03
-0E
-00
-ENDCHAR
-STARTCHAR uni02A9
-ENCODING 682
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-6D
-6C
-66
-63
-6B
-F6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02AA
-ENCODING 683
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6F
-6B
-63
-66
-6C
-6D
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02AB
-ENCODING 684
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-D6
-7C
-6C
-28
-C6
-D6
-7C
-6C
-28
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02AC
-ENCODING 685
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-C6
-C6
-00
-00
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B0
-ENCODING 688
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-F0
-D8
-D8
-D8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B1
-ENCODING 689
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-C0
-F0
-D8
-D8
-D8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B2
-ENCODING 690
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-00
-38
-18
-18
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B3
-ENCODING 691
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-B0
-D8
-C0
-C0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B4
-ENCODING 692
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-18
-D8
-68
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B5
-ENCODING 693
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-18
-D8
-68
-0C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B6
-ENCODING 694
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-D8
-D8
-F0
-D8
-D8
-F0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B7
-ENCODING 695
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C6
-D6
-7C
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B8
-ENCODING 696
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-D8
-D8
-78
-18
-70
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02B9
-ENCODING 697
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02BA
-ENCODING 698
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-36
-6C
-D8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02BB
-ENCODING 699
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57929
-ENCODING 700
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii64937
-ENCODING 701
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02BE
-ENCODING 702
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-0C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02BF
-ENCODING 703
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-60
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C0
-ENCODING 704
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-18
-30
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C1
-ENCODING 705
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-C0
-60
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C2
-ENCODING 706
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-70
-C0
-70
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C3
-ENCODING 707
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-70
-18
-70
-C0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C4
-ENCODING 708
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-20
-20
-70
-70
-D8
-D8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C5
-ENCODING 709
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-D8
-D8
-70
-70
-20
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR circumflex
-ENCODING 710
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR caron
-ENCODING 711
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02C8
-ENCODING 712
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR macron
-ENCODING 713
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02CA
-ENCODING 714
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02CB
-ENCODING 715
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02CC
-ENCODING 716
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR uni02CD
-ENCODING 717
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni02CE
-ENCODING 718
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-0C
-00
-ENDCHAR
-STARTCHAR uni02CF
-ENCODING 719
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-30
-60
-00
-ENDCHAR
-STARTCHAR breve
-ENCODING 728
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dotaccent
-ENCODING 729
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ring
-ENCODING 730
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-38
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ogonek
-ENCODING 731
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-30
-1C
-00
-ENDCHAR
-STARTCHAR tilde
-ENCODING 732
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR hungarumlaut
-ENCODING 733
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-CC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni02EE
-ENCODING 750
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-6C
-6C
-48
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gravecomb
-ENCODING 768
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR acutecomb
-ENCODING 769
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR tildecomb
-ENCODING 771
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-34
-58
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR hookabovecomb
-ENCODING 777
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-18
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0312
-ENCODING 786
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0313
-ENCODING 787
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0314
-ENCODING 788
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dotbelowcomb
-ENCODING 803
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni0340
-ENCODING 832
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0341
-ENCODING 833
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-06
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0374
-ENCODING 884
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-20
-40
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0375
-ENCODING 885
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-20
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uni037A
-ENCODING 890
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-30
-34
-18
-00
-ENDCHAR
-STARTCHAR uni037E
-ENCODING 894
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-00
-00
-18
-18
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR tonos
-ENCODING 900
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dieresistonos
-ENCODING 901
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Alphatonos
-ENCODING 902
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR anoteleia
-ENCODING 903
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Epsilontonos
-ENCODING 904
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-3E
-32
-30
-34
-3C
-34
-30
-30
-32
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Etatonos
-ENCODING 905
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-33
-33
-33
-33
-3F
-33
-33
-33
-33
-33
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Iotatonos
-ENCODING 906
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Omicrontonos
-ENCODING 908
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-3C
-66
-66
-66
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Upsilontonos
-ENCODING 910
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-66
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Omegatonos
-ENCODING 911
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-3E
-63
-63
-63
-63
-63
-36
-36
-36
-77
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR iotadieresistonos
-ENCODING 912
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-6C
-00
-38
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Alpha
-ENCODING 913
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Beta
-ENCODING 914
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Gamma
-ENCODING 915
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Delta
-ENCODING 916
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Epsilon
-ENCODING 917
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Zeta
-ENCODING 918
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Eta
-ENCODING 919
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Theta
-ENCODING 920
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Iota
-ENCODING 921
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Kappa
-ENCODING 922
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Lambda
-ENCODING 923
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Mu
-ENCODING 924
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Nu
-ENCODING 925
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Xi
-ENCODING 926
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-82
-44
-7C
-44
-00
-82
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Omicron
-ENCODING 927
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Pi
-ENCODING 928
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Rho
-ENCODING 929
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Sigma
-ENCODING 931
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-62
-30
-18
-18
-30
-62
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Tau
-ENCODING 932
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Upsilon
-ENCODING 933
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Phi
-ENCODING 934
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-7C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Chi
-ENCODING 935
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-7C
-38
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Psi
-ENCODING 936
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-92
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Omega
-ENCODING 937
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-6C
-6C
-6C
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Iotadieresis
-ENCODING 938
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Upsilondieresis
-ENCODING 939
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-66
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR alphatonos
-ENCODING 940
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR epsilontonos
-ENCODING 941
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-C0
-78
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR etatonos
-ENCODING 942
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-DC
-66
-66
-66
-66
-66
-66
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR iotatonos
-ENCODING 943
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-38
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR upsilondieresistonos
-ENCODING 944
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-6C
-00
-CC
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR alpha
-ENCODING 945
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR beta
-ENCODING 946
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-6C
-66
-66
-66
-66
-6C
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR gamma
-ENCODING 947
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-46
-6C
-2C
-2C
-38
-18
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR delta
-ENCODING 948
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-30
-18
-7C
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR epsilon
-ENCODING 949
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-78
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zeta
-ENCODING 950
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-46
-7C
-18
-30
-60
-60
-C0
-C0
-C0
-7C
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR eta
-ENCODING 951
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR theta
-ENCODING 952
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-7E
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR iota
-ENCODING 953
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR kappa
-ENCODING 954
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lambda
-ENCODING 955
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-20
-30
-10
-38
-38
-6C
-64
-C6
-C2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR mu
-ENCODING 956
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-F6
-C0
-C0
-C0
-00
-ENDCHAR
-STARTCHAR nu
-ENCODING 957
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-66
-6C
-3C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR xi
-ENCODING 958
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-3C
-30
-60
-3C
-60
-C0
-C0
-C0
-7C
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR omicron
-ENCODING 959
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR pi
-ENCODING 960
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-6C
-6C
-6C
-6C
-6C
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR rho
-ENCODING 961
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-66
-66
-66
-66
-7C
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR sigma1
-ENCODING 962
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-7C
-06
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR sigma
-ENCODING 963
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR tau
-ENCODING 964
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR upsilon
-ENCODING 965
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR phi
-ENCODING 966
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR chi
-ENCODING 967
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-86
-46
-2C
-2C
-18
-30
-68
-68
-C4
-C2
-00
-ENDCHAR
-STARTCHAR psi
-ENCODING 968
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-92
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR omega
-ENCODING 969
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-C6
-D6
-D6
-D6
-D6
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR iotadieresis
-ENCODING 970
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-00
-38
-18
-18
-18
-18
-18
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR upsilondieresis
-ENCODING 971
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-CC
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR omicrontonos
-ENCODING 972
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR upsilontonos
-ENCODING 973
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-CC
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR omegatonos
-ENCODING 974
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-6C
-C6
-D6
-D6
-D6
-D6
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03D0
-ENCODING 976
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-6C
-7C
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR theta1
-ENCODING 977
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-36
-1E
-C6
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Upsilon1
-ENCODING 978
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C2
-65
-24
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03D3
-ENCODING 979
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-C0
-21
-32
-12
-1C
-0C
-0C
-0C
-0C
-0C
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03D4
-ENCODING 980
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C2
-65
-24
-38
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR phi1
-ENCODING 981
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-7C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR omega1
-ENCODING 982
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-6C
-C6
-D6
-D6
-D6
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03D7
-ENCODING 983
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-46
-A6
-2C
-38
-68
-CA
-C4
-0C
-18
-00
-00
-ENDCHAR
-STARTCHAR uni03DA
-ENCODING 986
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-60
-3C
-06
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni03DB
-ENCODING 987
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-C0
-C0
-C0
-C0
-C0
-7C
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR uni03DC
-ENCODING 988
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-78
-68
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03DD
-ENCODING 989
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-32
-30
-30
-3C
-34
-30
-30
-30
-30
-00
-ENDCHAR
-STARTCHAR uni03DE
-ENCODING 990
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-30
-30
-60
-63
-FF
-C6
-06
-0C
-0C
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03DF
-ENCODING 991
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-60
-60
-FE
-FE
-0C
-0C
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03E0
-ENCODING 992
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-AC
-26
-26
-0B
-0B
-1B
-1B
-1B
-1B
-03
-02
-04
-00
-ENDCHAR
-STARTCHAR uni03E1
-ENCODING 993
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C0
-60
-30
-18
-28
-4C
-14
-24
-06
-02
-02
-00
-ENDCHAR
-STARTCHAR uni03E2
-ENCODING 994
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-6D
-03
-3E
-00
-00
-ENDCHAR
-STARTCHAR uni03E3
-ENCODING 995
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DB
-DB
-DB
-DB
-DB
-DB
-6D
-03
-7E
-00
-00
-ENDCHAR
-STARTCHAR uni03E4
-ENCODING 996
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-D6
-C6
-C6
-C6
-7E
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03E5
-ENCODING 997
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-36
-66
-66
-66
-66
-3E
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03E6
-ENCODING 998
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-C0
-FC
-C6
-C6
-C6
-C6
-C6
-06
-76
-9C
-00
-ENDCHAR
-STARTCHAR uni03E7
-ENCODING 999
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-7C
-D6
-66
-06
-06
-66
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03E8
-ENCODING 1000
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-06
-3C
-60
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03E9
-ENCODING 1001
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-26
-1C
-70
-C0
-C2
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03EA
-ENCODING 1002
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-68
-38
-30
-38
-38
-4C
-4C
-86
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03EB
-ENCODING 1003
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-64
-BA
-30
-38
-28
-4C
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03EC
-ENCODING 1004
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-C0
-CC
-D6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03ED
-ENCODING 1005
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-C0
-DC
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03EE
-ENCODING 1006
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-7E
-99
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03EF
-ENCODING 1007
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-1C
-18
-7E
-58
-18
-18
-18
-38
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03F0
-ENCODING 1008
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-46
-A6
-2C
-38
-68
-CA
-C4
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03F1
-ENCODING 1009
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-FC
-C0
-60
-3C
-06
-00
-ENDCHAR
-STARTCHAR uni03F2
-ENCODING 1010
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni03F3
-ENCODING 1011
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-00
-0E
-06
-06
-06
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR uni0400
-ENCODING 1024
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-18
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10023
-ENCODING 1025
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10051
-ENCODING 1026
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-B2
-30
-3E
-33
-33
-33
-33
-33
-33
-03
-06
-00
-00
-ENDCHAR
-STARTCHAR afii10052
-ENCODING 1027
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-FE
-66
-62
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10053
-ENCODING 1028
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-F8
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10054
-ENCODING 1029
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-60
-38
-0C
-06
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10055
-ENCODING 1030
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10056
-ENCODING 1031
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10057
-ENCODING 1032
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-0C
-0C
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10058
-ENCODING 1033
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-D8
-D8
-D8
-DE
-DB
-DB
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10059
-ENCODING 1034
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D8
-D8
-D8
-D8
-FE
-DB
-DB
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10060
-ENCODING 1035
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-B2
-30
-3E
-33
-33
-33
-33
-33
-33
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10061
-ENCODING 1036
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-E6
-66
-66
-6C
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni040D
-ENCODING 1037
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-18
-00
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10062
-ENCODING 1038
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-C6
-C6
-C6
-C6
-7E
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10145
-ENCODING 1039
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-FE
-38
-10
-10
-00
-ENDCHAR
-STARTCHAR afii10017
-ENCODING 1040
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10018
-ENCODING 1041
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10019
-ENCODING 1042
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10020
-ENCODING 1043
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10021
-ENCODING 1044
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-FE
-C6
-82
-00
-00
-ENDCHAR
-STARTCHAR afii10022
-ENCODING 1045
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10024
-ENCODING 1046
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D6
-D6
-D6
-7C
-38
-7C
-D6
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10025
-ENCODING 1047
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-86
-06
-3C
-06
-06
-86
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10026
-ENCODING 1048
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10027
-ENCODING 1049
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-C6
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10028
-ENCODING 1050
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10029
-ENCODING 1051
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-66
-66
-66
-66
-66
-66
-66
-66
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10030
-ENCODING 1052
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10031
-ENCODING 1053
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10032
-ENCODING 1054
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10033
-ENCODING 1055
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10034
-ENCODING 1056
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10035
-ENCODING 1057
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10036
-ENCODING 1058
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10037
-ENCODING 1059
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-7E
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10038
-ENCODING 1060
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-7C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10039
-ENCODING 1061
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-7C
-38
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10040
-ENCODING 1062
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-FE
-06
-02
-00
-00
-ENDCHAR
-STARTCHAR afii10041
-ENCODING 1063
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-7E
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10042
-ENCODING 1064
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10043
-ENCODING 1065
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-D6
-FF
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR afii10044
-ENCODING 1066
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-B0
-B0
-30
-3C
-36
-36
-36
-36
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10045
-ENCODING 1067
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C3
-C3
-C3
-C3
-F3
-DB
-DB
-DB
-DB
-F3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10046
-ENCODING 1068
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10047
-ENCODING 1069
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-86
-06
-3E
-06
-06
-86
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10048
-ENCODING 1070
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-9C
-B6
-B6
-B6
-F6
-B6
-B6
-B6
-B6
-9C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10049
-ENCODING 1071
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-CC
-CC
-CC
-7C
-6C
-6C
-6C
-6C
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10065
-ENCODING 1072
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10066
-ENCODING 1073
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-7C
-C0
-C0
-FC
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10067
-ENCODING 1074
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FC
-66
-66
-7C
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10068
-ENCODING 1075
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-66
-62
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10069
-ENCODING 1076
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-6C
-6C
-6C
-6C
-6C
-FE
-C6
-82
-00
-00
-ENDCHAR
-STARTCHAR afii10070
-ENCODING 1077
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10072
-ENCODING 1078
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D6
-D6
-D6
-7C
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10073
-ENCODING 1079
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-3C
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10074
-ENCODING 1080
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10075
-ENCODING 1081
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10076
-ENCODING 1082
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10077
-ENCODING 1083
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3E
-66
-66
-66
-66
-66
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10078
-ENCODING 1084
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10079
-ENCODING 1085
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10080
-ENCODING 1086
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10081
-ENCODING 1087
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10082
-ENCODING 1088
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR afii10083
-ENCODING 1089
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10084
-ENCODING 1090
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-5A
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10085
-ENCODING 1091
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR afii10086
-ENCODING 1092
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-7C
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR afii10087
-ENCODING 1093
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-6C
-38
-38
-38
-6C
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10088
-ENCODING 1094
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-FE
-06
-02
-00
-00
-ENDCHAR
-STARTCHAR afii10089
-ENCODING 1095
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-7E
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10090
-ENCODING 1096
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-D6
-D6
-D6
-D6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10091
-ENCODING 1097
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-D6
-D6
-D6
-D6
-FF
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR afii10092
-ENCODING 1098
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F8
-B0
-30
-3C
-36
-36
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10093
-ENCODING 1099
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C3
-C3
-C3
-F3
-DB
-DB
-F3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10094
-ENCODING 1100
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F0
-60
-60
-7C
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10095
-ENCODING 1101
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-3E
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10096
-ENCODING 1102
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-9C
-B6
-B6
-F6
-B6
-B6
-9C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10097
-ENCODING 1103
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-CC
-CC
-7C
-6C
-6C
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0450
-ENCODING 1104
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10071
-ENCODING 1105
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10099
-ENCODING 1106
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-F8
-60
-6C
-76
-66
-66
-66
-66
-E6
-06
-06
-1C
-00
-ENDCHAR
-STARTCHAR afii10100
-ENCODING 1107
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-FE
-66
-62
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10101
-ENCODING 1108
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-F8
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10102
-ENCODING 1109
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10103
-ENCODING 1110
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10104
-ENCODING 1111
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10105
-ENCODING 1112
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-00
-0E
-06
-06
-06
-06
-06
-06
-66
-66
-3C
-00
-ENDCHAR
-STARTCHAR afii10106
-ENCODING 1113
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-D8
-D8
-DE
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10107
-ENCODING 1114
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D8
-D8
-D8
-FE
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10108
-ENCODING 1115
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-F8
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10109
-ENCODING 1116
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-E6
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni045D
-ENCODING 1117
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10110
-ENCODING 1118
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR afii10193
-ENCODING 1119
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-FE
-38
-10
-10
-00
-ENDCHAR
-STARTCHAR uni0460
-ENCODING 1120
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-C6
-C6
-D6
-D6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0461
-ENCODING 1121
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10146
-ENCODING 1122
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-FC
-B4
-30
-3C
-36
-36
-36
-36
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10194
-ENCODING 1123
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-30
-FC
-B4
-30
-3C
-36
-36
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0464
-ENCODING 1124
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CE
-DB
-D9
-D8
-FE
-D8
-D8
-D9
-DB
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0465
-ENCODING 1125
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CE
-DB
-D8
-FE
-D8
-DB
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0466
-ENCODING 1126
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-38
-6C
-6C
-6C
-FE
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0467
-ENCODING 1127
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-38
-38
-6C
-7C
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0468
-ENCODING 1128
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-88
-8C
-9C
-96
-F6
-B6
-BF
-AB
-EB
-EB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0469
-ENCODING 1129
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-88
-8C
-9C
-F6
-BE
-AB
-EB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni046A
-ENCODING 1130
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-6C
-6C
-38
-7C
-D6
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni046B
-ENCODING 1131
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-C6
-6C
-7C
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni046C
-ENCODING 1132
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-A3
-B2
-96
-FC
-9C
-BE
-AA
-AB
-EB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni046D
-ENCODING 1133
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-BF
-A3
-96
-FE
-AB
-AB
-EB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni046E
-ENCODING 1134
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-10
-7C
-C6
-06
-06
-7C
-06
-06
-06
-7C
-C0
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni046F
-ENCODING 1135
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-6C
-38
-10
-00
-7C
-86
-06
-7C
-06
-06
-7C
-C0
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni0470
-ENCODING 1136
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-96
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0471
-ENCODING 1137
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-96
-D6
-D6
-D6
-D6
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR afii10147
-ENCODING 1138
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10195
-ENCODING 1139
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-FE
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10148
-ENCODING 1140
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C2
-C6
-C6
-C4
-CC
-6C
-68
-78
-38
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10196
-ENCODING 1141
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C2
-C6
-64
-6C
-38
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0476
-ENCODING 1142
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-66
-00
-C2
-C6
-C4
-C4
-6C
-68
-78
-38
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0477
-ENCODING 1143
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-66
-00
-C2
-C6
-64
-6C
-38
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0478
-ENCODING 1144
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D8
-D8
-DB
-DB
-DB
-DB
-DB
-DB
-6F
-03
-06
-1C
-00
-ENDCHAR
-STARTCHAR uni0479
-ENCODING 1145
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-73
-DB
-DB
-DB
-DB
-DB
-6F
-03
-06
-1C
-00
-ENDCHAR
-STARTCHAR uni047A
-ENCODING 1146
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-7C
-D6
-C6
-C6
-C6
-C6
-C6
-C6
-D6
-7C
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni047B
-ENCODING 1147
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-7C
-D6
-C6
-C6
-C6
-D6
-7C
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni047C
-ENCODING 1148
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-7C
-40
-6C
-C6
-C6
-D6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni047D
-ENCODING 1149
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-7C
-40
-00
-6C
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni047E
-ENCODING 1150
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-54
-00
-6C
-C6
-C6
-D6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni047F
-ENCODING 1151
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-54
-00
-6C
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0480
-ENCODING 1152
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C0
-60
-3C
-0C
-0C
-0C
-00
-ENDCHAR
-STARTCHAR uni0481
-ENCODING 1153
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C0
-78
-18
-18
-00
-00
-ENDCHAR
-STARTCHAR uni0482
-ENCODING 1154
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-3C
-0F
-18
-18
-F0
-3C
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0483
-ENCODING 1155
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-7C
-40
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0484
-ENCODING 1156
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-24
-44
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0485
-ENCODING 1157
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-40
-7C
-40
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0486
-ENCODING 1158
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-7C
-04
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0488
-ENCODING 1160
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-66
-00
-C3
-00
-66
-18
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0489
-ENCODING 1161
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-50
-46
-00
-82
-41
-00
-62
-0A
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni048A
-ENCODING 1162
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-C6
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni048B
-ENCODING 1163
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni048C
-ENCODING 1164
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-F0
-60
-60
-60
-7C
-66
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni048D
-ENCODING 1165
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-60
-F0
-60
-60
-7C
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni048E
-ENCODING 1166
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-6E
-64
-7A
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni048F
-ENCODING 1167
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-6E
-64
-7A
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR afii10050
-ENCODING 1168
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-06
-FE
-60
-60
-60
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10098
-ENCODING 1169
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-02
-06
-FE
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0492
-ENCODING 1170
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-F8
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0493
-ENCODING 1171
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-66
-62
-F8
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0494
-ENCODING 1172
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-60
-7C
-66
-66
-66
-66
-F6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni0495
-ENCODING 1173
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-66
-62
-78
-6C
-66
-F6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni0496
-ENCODING 1174
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D6
-D6
-D6
-7C
-38
-7C
-D6
-D6
-D6
-D7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni0497
-ENCODING 1175
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D6
-D6
-D6
-7C
-D6
-D6
-D7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni0498
-ENCODING 1176
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-86
-06
-3C
-06
-06
-86
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni0499
-ENCODING 1177
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-3C
-06
-C6
-7C
-30
-60
-38
-00
-ENDCHAR
-STARTCHAR uni049A
-ENCODING 1178
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni049B
-ENCODING 1179
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-6C
-78
-78
-6C
-66
-E7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni049C
-ENCODING 1180
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-D6
-D6
-DC
-F8
-DC
-D6
-D6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni049D
-ENCODING 1181
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-DC
-F8
-DC
-D6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni049E
-ENCODING 1182
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-F6
-6C
-78
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni049F
-ENCODING 1183
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-F0
-66
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A0
-ENCODING 1184
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F3
-B3
-B3
-36
-3C
-3C
-36
-33
-33
-73
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A1
-ENCODING 1185
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F3
-B6
-BC
-3C
-36
-33
-73
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A2
-ENCODING 1186
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04A3
-ENCODING 1187
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-FE
-C6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04A4
-ENCODING 1188
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DF
-DB
-D9
-D8
-F8
-D8
-D8
-D8
-D8
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A5
-ENCODING 1189
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DF
-DB
-D9
-F8
-D8
-D8
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A6
-ENCODING 1190
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-D8
-D8
-D8
-DE
-DB
-DB
-DB
-DB
-DB
-03
-0B
-06
-00
-ENDCHAR
-STARTCHAR uni04A7
-ENCODING 1191
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D8
-D8
-D8
-FE
-DB
-DB
-DB
-03
-0B
-06
-00
-ENDCHAR
-STARTCHAR uni04A8
-ENCODING 1192
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C2
-CC
-D6
-D6
-D6
-D6
-D6
-CC
-7A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04A9
-ENCODING 1193
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C2
-CC
-D6
-D6
-CC
-7A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04AA
-ENCODING 1194
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni04AB
-ENCODING 1195
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni04AC
-ENCODING 1196
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-0C
-04
-00
-00
-ENDCHAR
-STARTCHAR uni04AD
-ENCODING 1197
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-5A
-18
-18
-18
-18
-3C
-0C
-04
-00
-00
-ENDCHAR
-STARTCHAR uni04AE
-ENCODING 1198
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04AF
-ENCODING 1199
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-3C
-18
-18
-18
-3C
-00
-ENDCHAR
-STARTCHAR uni04B0
-ENCODING 1200
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-3C
-18
-7E
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04B1
-ENCODING 1201
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-3C
-18
-7E
-18
-3C
-00
-ENDCHAR
-STARTCHAR uni04B2
-ENCODING 1202
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-7C
-38
-38
-7C
-6C
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B3
-ENCODING 1203
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-6C
-38
-38
-38
-6C
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B4
-ENCODING 1204
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F6
-66
-66
-66
-66
-66
-66
-66
-66
-7F
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B5
-ENCODING 1205
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F6
-66
-66
-66
-66
-66
-7F
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B6
-ENCODING 1206
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-7E
-06
-06
-06
-07
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B7
-ENCODING 1207
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-7E
-06
-06
-07
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04B8
-ENCODING 1208
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-D6
-D6
-7E
-16
-16
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04B9
-ENCODING 1209
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-D6
-D6
-7E
-16
-16
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04BA
-ENCODING 1210
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-C0
-FC
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04BB
-ENCODING 1211
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C0
-C0
-C0
-FC
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04BC
-ENCODING 1212
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-33
-B3
-B3
-7F
-30
-30
-30
-33
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04BD
-ENCODING 1213
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-9E
-B3
-7F
-30
-30
-33
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04BE
-ENCODING 1214
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-33
-B3
-B3
-7F
-30
-30
-30
-33
-1E
-0C
-18
-0E
-00
-ENDCHAR
-STARTCHAR uni04BF
-ENCODING 1215
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-9E
-B3
-7F
-30
-30
-33
-1E
-0C
-18
-0E
-00
-ENDCHAR
-STARTCHAR uni04C0
-ENCODING 1216
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04C1
-ENCODING 1217
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-D6
-D6
-D6
-7C
-38
-7C
-D6
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04C2
-ENCODING 1218
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-D6
-D6
-D6
-7C
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04C3
-ENCODING 1219
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni04C4
-ENCODING 1220
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-E6
-6C
-78
-78
-6C
-66
-E6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni04C5
-ENCODING 1221
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-66
-66
-66
-66
-66
-66
-66
-66
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04C6
-ENCODING 1222
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3E
-66
-66
-66
-66
-66
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04C7
-ENCODING 1223
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni04C8
-ENCODING 1224
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-06
-16
-0C
-00
-ENDCHAR
-STARTCHAR uni04C9
-ENCODING 1225
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04CA
-ENCODING 1226
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-FE
-C6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04CB
-ENCODING 1227
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-7E
-06
-06
-06
-0E
-0C
-08
-00
-00
-ENDCHAR
-STARTCHAR uni04CC
-ENCODING 1228
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-7E
-06
-06
-0E
-0C
-08
-00
-00
-ENDCHAR
-STARTCHAR uni04CD
-ENCODING 1229
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04CE
-ENCODING 1230
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C7
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni04D0
-ENCODING 1232
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D1
-ENCODING 1233
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D2
-ENCODING 1234
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D3
-ENCODING 1235
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D4
-ENCODING 1236
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-6C
-CC
-CC
-FE
-CC
-CC
-CC
-CC
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D5
-ENCODING 1237
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-76
-36
-7E
-D8
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D6
-ENCODING 1238
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D7
-ENCODING 1239
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04D8
-ENCODING 1240
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-06
-06
-06
-FE
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii10846
-ENCODING 1241
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-06
-FE
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DA
-ENCODING 1242
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-7C
-C6
-06
-06
-FE
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DB
-ENCODING 1243
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-06
-06
-FE
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DC
-ENCODING 1244
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-D6
-D6
-D6
-7C
-38
-7C
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DD
-ENCODING 1245
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-D6
-D6
-D6
-7C
-D6
-D6
-D6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DE
-ENCODING 1246
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-7C
-C6
-86
-06
-3C
-06
-86
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04DF
-ENCODING 1247
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-06
-3C
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E0
-ENCODING 1248
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-06
-0C
-18
-3C
-06
-06
-86
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E1
-ENCODING 1249
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-06
-0C
-18
-3C
-06
-06
-06
-C6
-7C
-00
-ENDCHAR
-STARTCHAR uni04E2
-ENCODING 1250
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E3
-ENCODING 1251
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E4
-ENCODING 1252
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E5
-ENCODING 1253
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-CE
-DE
-FE
-F6
-E6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E6
-ENCODING 1254
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E7
-ENCODING 1255
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E8
-ENCODING 1256
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04E9
-ENCODING 1257
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-FE
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04EA
-ENCODING 1258
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-7C
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04EB
-ENCODING 1259
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-C6
-FE
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04EC
-ENCODING 1260
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-78
-CC
-86
-06
-3E
-06
-86
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04ED
-ENCODING 1261
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-7C
-C6
-06
-3E
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04EE
-ENCODING 1262
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-C6
-C6
-C6
-C6
-7E
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04EF
-ENCODING 1263
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni04F0
-ENCODING 1264
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-C6
-C6
-7E
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04F1
-ENCODING 1265
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni04F2
-ENCODING 1266
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-66
-CC
-00
-C6
-C6
-C6
-C6
-7E
-06
-06
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04F3
-ENCODING 1267
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-CC
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni04F4
-ENCODING 1268
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-C6
-C6
-7E
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04F5
-ENCODING 1269
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-C6
-C6
-7E
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04F8
-ENCODING 1272
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C3
-C3
-C3
-F3
-DB
-DB
-DB
-DB
-F3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni04F9
-ENCODING 1273
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C3
-C3
-C3
-F3
-DB
-DB
-F3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0500
-ENCODING 1280
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-7C
-CC
-CC
-CC
-CC
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0501
-ENCODING 1281
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0502
-ENCODING 1282
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-7C
-CD
-CD
-CD
-CD
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0503
-ENCODING 1283
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CD
-CD
-CD
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0504
-ENCODING 1284
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-8C
-0C
-38
-0D
-0D
-0D
-0D
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0505
-ENCODING 1285
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-CC
-0C
-39
-0D
-0D
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0506
-ENCODING 1286
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-86
-06
-3C
-06
-06
-06
-06
-07
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni0507
-ENCODING 1287
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-06
-3C
-06
-06
-07
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni0508
-ENCODING 1288
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-6C
-6C
-6C
-6C
-6D
-6D
-6D
-6D
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0509
-ENCODING 1289
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-6C
-6C
-6D
-6D
-6D
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050A
-ENCODING 1290
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-CC
-CC
-CC
-FC
-CD
-CD
-CD
-CD
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050B
-ENCODING 1291
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-FD
-CD
-CD
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050C
-ENCODING 1292
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-CE
-C6
-C6
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050D
-ENCODING 1293
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-CE
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050E
-ENCODING 1294
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-1B
-1B
-1B
-1B
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni050F
-ENCODING 1295
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7E
-5A
-18
-1B
-1B
-1B
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0530
-ENCODING 1328
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-64
-94
-BA
-52
-4C
-30
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0531
-ENCODING 1329
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CF
-7B
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0532
-ENCODING 1330
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-60
-60
-7E
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0533
-ENCODING 1331
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-CC
-CC
-CC
-7F
-0C
-0C
-0C
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0534
-ENCODING 1332
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-CC
-CC
-CC
-CF
-0C
-0C
-0C
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0535
-ENCODING 1333
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-7E
-60
-60
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0536
-ENCODING 1334
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-3E
-06
-0C
-D8
-FE
-C3
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0537
-ENCODING 1335
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-7E
-60
-60
-60
-60
-60
-60
-7C
-06
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0538
-ENCODING 1336
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-66
-60
-60
-60
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0539
-ENCODING 1337
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-CF
-D6
-D6
-D6
-D6
-CC
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053A
-ENCODING 1338
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0C
-0C
-0C
-7F
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053B
-ENCODING 1339
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-7C
-66
-66
-66
-66
-66
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053C
-ENCODING 1340
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-60
-60
-60
-60
-60
-60
-60
-7C
-06
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053D
-ENCODING 1341
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-F6
-D6
-D6
-D6
-D6
-CC
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053E
-ENCODING 1342
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-7F
-24
-66
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni053F
-ENCODING 1343
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-66
-66
-66
-66
-66
-3E
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0540
-ENCODING 1344
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-30
-18
-0C
-18
-30
-60
-F0
-3C
-0E
-04
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0541
-ENCODING 1345
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-06
-06
-06
-6C
-D8
-6E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0542
-ENCODING 1346
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-CC
-CC
-CC
-CC
-0C
-0C
-0C
-0F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0543
-ENCODING 1347
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-30
-60
-F8
-6C
-66
-66
-66
-66
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0544
-ENCODING 1348
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CF
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0545
-ENCODING 1349
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-06
-06
-7C
-06
-06
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0546
-ENCODING 1350
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-60
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0547
-ENCODING 1351
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-06
-3E
-66
-60
-60
-60
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0548
-ENCODING 1352
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0549
-ENCODING 1353
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-06
-06
-06
-6C
-38
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054A
-ENCODING 1354
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-D6
-D6
-D6
-D6
-D6
-16
-16
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054B
-ENCODING 1355
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-76
-1E
-0E
-0C
-D8
-FE
-C3
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054C
-ENCODING 1356
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-CC
-CC
-CC
-CF
-CC
-CC
-CC
-CC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054D
-ENCODING 1357
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054E
-ENCODING 1358
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0C
-CC
-CC
-CC
-CC
-7C
-0C
-0C
-0F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni054F
-ENCODING 1359
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-60
-30
-18
-0C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0550
-ENCODING 1360
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-66
-60
-60
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0551
-ENCODING 1361
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-3C
-66
-06
-06
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0552
-ENCODING 1362
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-7C
-66
-66
-66
-66
-63
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0553
-ENCODING 1363
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-7C
-D6
-D6
-D6
-D6
-D6
-D6
-7C
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0554
-ENCODING 1364
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-7C
-60
-60
-FE
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0555
-ENCODING 1365
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0556
-ENCODING 1366
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D0
-D0
-D0
-7C
-16
-16
-16
-D6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0559
-ENCODING 1369
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055A
-ENCODING 1370
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-18
-18
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055B
-ENCODING 1371
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055C
-ENCODING 1372
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-06
-3C
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055D
-ENCODING 1373
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-18
-0C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055E
-ENCODING 1374
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-36
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni055F
-ENCODING 1375
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-60
-3E
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0561
-ENCODING 1377
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D6
-D6
-D6
-D6
-D6
-D6
-6A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0562
-ENCODING 1378
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-66
-66
-66
-60
-60
-7E
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR uni0563
-ENCODING 1379
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-CC
-CC
-CC
-CC
-CC
-7F
-0C
-0C
-0C
-00
-ENDCHAR
-STARTCHAR uni0564
-ENCODING 1380
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F8
-CC
-CC
-CC
-CC
-CC
-CF
-0C
-0C
-0C
-00
-ENDCHAR
-STARTCHAR uni0565
-ENCODING 1381
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-7E
-60
-60
-66
-66
-66
-66
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0566
-ENCODING 1382
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-0C
-0F
-00
-ENDCHAR
-STARTCHAR uni0567
-ENCODING 1383
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-60
-7C
-60
-60
-60
-60
-60
-78
-0C
-18
-00
-00
-ENDCHAR
-STARTCHAR uni0568
-ENCODING 1384
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-66
-66
-66
-66
-66
-66
-60
-60
-7E
-00
-ENDCHAR
-STARTCHAR uni0569
-ENCODING 1385
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FC
-C6
-C6
-CF
-D6
-D6
-CC
-C0
-C0
-C0
-00
-ENDCHAR
-STARTCHAR uni056A
-ENCODING 1386
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0C
-0C
-7F
-CC
-CC
-CC
-CC
-CC
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni056B
-ENCODING 1387
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-60
-7C
-66
-66
-66
-66
-66
-66
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR uni056C
-ENCODING 1388
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-30
-30
-30
-30
-30
-30
-30
-30
-3E
-00
-ENDCHAR
-STARTCHAR uni056D
-ENCODING 1389
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-F6
-D6
-D6
-D6
-D6
-D6
-CA
-C0
-C0
-C0
-00
-ENDCHAR
-STARTCHAR uni056E
-ENCODING 1390
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-38
-0C
-7F
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni056F
-ENCODING 1391
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-60
-66
-66
-66
-66
-66
-66
-3E
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR uni0570
-ENCODING 1392
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-60
-7C
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0571
-ENCODING 1393
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-1C
-0C
-18
-3C
-64
-66
-62
-63
-3D
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0572
-ENCODING 1394
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F8
-CC
-CC
-CC
-CC
-CC
-CC
-0C
-0C
-0F
-00
-ENDCHAR
-STARTCHAR uni0573
-ENCODING 1395
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-18
-30
-F8
-6C
-66
-66
-66
-66
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0574
-ENCODING 1396
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0F
-0C
-0C
-CC
-CC
-CC
-CC
-CC
-CC
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0575
-ENCODING 1397
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-6C
-38
-00
-ENDCHAR
-STARTCHAR uni0576
-ENCODING 1398
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-66
-66
-66
-66
-66
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0577
-ENCODING 1399
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-66
-66
-06
-0C
-18
-30
-60
-3E
-00
-ENDCHAR
-STARTCHAR uni0578
-ENCODING 1400
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0579
-ENCODING 1401
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-18
-18
-0C
-06
-0C
-18
-30
-60
-3E
-00
-ENDCHAR
-STARTCHAR uni057A
-ENCODING 1402
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-D6
-D6
-D6
-D6
-D6
-D6
-7E
-06
-06
-06
-00
-ENDCHAR
-STARTCHAR uni057B
-ENCODING 1403
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-66
-66
-76
-1C
-18
-30
-60
-3E
-00
-ENDCHAR
-STARTCHAR uni057C
-ENCODING 1404
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-F8
-CC
-CC
-CC
-CC
-CC
-CF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni057D
-ENCODING 1405
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-66
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni057E
-ENCODING 1406
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0C
-0C
-CC
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-0C
-0F
-00
-ENDCHAR
-STARTCHAR uni057F
-ENCODING 1407
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-D6
-D6
-D6
-D6
-D6
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0580
-ENCODING 1408
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-66
-66
-66
-66
-66
-66
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR uni0581
-ENCODING 1409
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3E
-66
-66
-66
-66
-66
-3E
-06
-66
-3C
-00
-ENDCHAR
-STARTCHAR uni0582
-ENCODING 1410
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-30
-30
-30
-30
-30
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0583
-ENCODING 1411
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-DC
-D6
-D6
-D6
-D6
-D6
-76
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR uni0584
-ENCODING 1412
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-66
-66
-66
-66
-7C
-60
-FE
-60
-60
-00
-ENDCHAR
-STARTCHAR uni0585
-ENCODING 1413
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0586
-ENCODING 1414
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-D0
-D0
-7C
-16
-16
-16
-16
-D6
-7C
-10
-10
-10
-00
-ENDCHAR
-STARTCHAR uni0587
-ENCODING 1415
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-C0
-C0
-CC
-CC
-CC
-CC
-77
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0589
-ENCODING 1417
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni058A
-ENCODING 1418
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C0
-C6
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0591
-ENCODING 1425
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-10
-38
-6C
-ENDCHAR
-STARTCHAR uni0592
-ENCODING 1426
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-00
-66
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0593
-ENCODING 1427
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-38
-10
-38
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0594
-ENCODING 1428
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-00
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0595
-ENCODING 1429
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-60
-6C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0596
-ENCODING 1430
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-18
-0C
-00
-ENDCHAR
-STARTCHAR uni0597
-ENCODING 1431
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0598
-ENCODING 1432
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-74
-D6
-5C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0599
-ENCODING 1433
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-60
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni059A
-ENCODING 1434
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-03
-06
-03
-00
-ENDCHAR
-STARTCHAR uni059B
-ENCODING 1435
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-28
-18
-30
-00
-ENDCHAR
-STARTCHAR uni059C
-ENCODING 1436
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni059D
-ENCODING 1437
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-06
-04
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni059E
-ENCODING 1438
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1B
-36
-24
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni059F
-ENCODING 1439
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-44
-AA
-6C
-28
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05A0
-ENCODING 1440
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-0A
-0C
-08
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05A1
-ENCODING 1441
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-40
-50
-E0
-80
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05A3
-ENCODING 1443
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-0C
-3C
-00
-ENDCHAR
-STARTCHAR uni05A4
-ENCODING 1444
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-30
-18
-00
-ENDCHAR
-STARTCHAR uni05A5
-ENCODING 1445
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-30
-60
-00
-ENDCHAR
-STARTCHAR uni05A6
-ENCODING 1446
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-24
-6C
-D8
-00
-ENDCHAR
-STARTCHAR uni05A7
-ENCODING 1447
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-30
-08
-30
-ENDCHAR
-STARTCHAR uni05A8
-ENCODING 1448
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05A9
-ENCODING 1449
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-40
-A0
-60
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05AA
-ENCODING 1450
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-6C
-38
-10
-10
-ENDCHAR
-STARTCHAR uni05AB
-ENCODING 1451
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05AC
-ENCODING 1452
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-3C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05AD
-ENCODING 1453
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-04
-06
-03
-00
-ENDCHAR
-STARTCHAR uni05AE
-ENCODING 1454
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-48
-A8
-90
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05AF
-ENCODING 1455
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-38
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57799
-ENCODING 1456
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-00
-18
-00
-ENDCHAR
-STARTCHAR afii57801
-ENCODING 1457
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-DB
-00
-33
-00
-ENDCHAR
-STARTCHAR afii57800
-ENCODING 1458
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-F6
-00
-06
-00
-ENDCHAR
-STARTCHAR afii57802
-ENCODING 1459
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-F6
-60
-66
-00
-ENDCHAR
-STARTCHAR afii57793
-ENCODING 1460
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57794
-ENCODING 1461
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-66
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57795
-ENCODING 1462
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-66
-00
-18
-00
-ENDCHAR
-STARTCHAR afii57798
-ENCODING 1463
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-7E
-00
-00
-ENDCHAR
-STARTCHAR afii57797
-ENCODING 1464
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-7E
-18
-18
-ENDCHAR
-STARTCHAR afii57806
-ENCODING 1465
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57796
-ENCODING 1467
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-C0
-18
-03
-00
-ENDCHAR
-STARTCHAR afii57807
-ENCODING 1468
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57839
-ENCODING 1469
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-18
-ENDCHAR
-STARTCHAR afii57645
-ENCODING 1470
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7E
-FC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57841
-ENCODING 1471
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57842
-ENCODING 1472
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57804
-ENCODING 1473
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-06
-06
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57803
-ENCODING 1474
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57658
-ENCODING 1475
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05C4
-ENCODING 1476
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57664
-ENCODING 1488
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C6
-C6
-66
-76
-DC
-CC
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57665
-ENCODING 1489
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-F8
-0C
-0C
-0C
-0C
-0C
-0C
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57666
-ENCODING 1490
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-0C
-0C
-0C
-0C
-1C
-36
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57667
-ENCODING 1491
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57668
-ENCODING 1492
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-06
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57669
-ENCODING 1493
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57670
-ENCODING 1494
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-7E
-18
-18
-18
-0C
-0C
-18
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57671
-ENCODING 1495
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-66
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57672
-ENCODING 1496
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-CC
-D6
-D6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57673
-ENCODING 1497
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-18
-18
-18
-30
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57674
-ENCODING 1498
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-06
-0C
-0C
-0C
-0C
-0C
-0C
-0E
-00
-ENDCHAR
-STARTCHAR afii57675
-ENCODING 1499
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-06
-06
-06
-06
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57676
-ENCODING 1500
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-FC
-06
-06
-06
-06
-0C
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57677
-ENCODING 1501
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-66
-C6
-C6
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57678
-ENCODING 1502
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-DC
-76
-66
-C6
-C6
-C6
-C6
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57679
-ENCODING 1503
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-0C
-0C
-18
-18
-18
-18
-18
-18
-18
-1C
-00
-ENDCHAR
-STARTCHAR afii57680
-ENCODING 1504
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-0C
-0C
-0C
-0C
-0C
-0C
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57681
-ENCODING 1505
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-66
-C6
-C6
-C6
-C6
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57682
-ENCODING 1506
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-EE
-66
-66
-66
-66
-66
-2C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57683
-ENCODING 1507
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-F8
-4C
-CC
-CC
-EC
-0C
-0C
-0C
-0C
-0C
-0E
-00
-ENDCHAR
-STARTCHAR afii57684
-ENCODING 1508
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-46
-C6
-C6
-E6
-06
-06
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57685
-ENCODING 1509
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-EE
-66
-66
-6C
-78
-60
-60
-60
-60
-60
-70
-00
-ENDCHAR
-STARTCHAR afii57686
-ENCODING 1510
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-EE
-66
-66
-34
-18
-0C
-06
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57687
-ENCODING 1511
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-66
-64
-6C
-6E
-60
-60
-60
-60
-00
-ENDCHAR
-STARTCHAR afii57688
-ENCODING 1512
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-06
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57689
-ENCODING 1513
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-D6
-D6
-D6
-D6
-D6
-F6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57690
-ENCODING 1514
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-66
-66
-66
-66
-66
-E6
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57716
-ENCODING 1520
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-CC
-66
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57717
-ENCODING 1521
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-CC
-66
-66
-66
-C6
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57718
-ENCODING 1522
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-CC
-66
-66
-66
-CC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05F3
-ENCODING 1523
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni05F4
-ENCODING 1524
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-CC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57388
-ENCODING 1548
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-10
-18
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57403
-ENCODING 1563
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-18
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57407
-ENCODING 1567
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-22
-20
-10
-08
-08
-00
-08
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57409
-ENCODING 1569
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-20
-1E
-20
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57410
-ENCODING 1570
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-3C
-40
-10
-10
-10
-10
-10
-10
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57411
-ENCODING 1571
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-20
-1C
-20
-08
-08
-08
-08
-08
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57412
-ENCODING 1572
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-20
-1C
-20
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57413
-ENCODING 1573
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-08
-08
-08
-08
-00
-18
-20
-1C
-20
-00
-00
-ENDCHAR
-STARTCHAR afii57414
-ENCODING 1574
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-40
-38
-40
-07
-08
-88
-86
-81
-82
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57415
-ENCODING 1575
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-08
-08
-08
-08
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57416
-ENCODING 1576
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57417
-ENCODING 1577
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-28
-00
-00
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57418
-ENCODING 1578
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-14
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57419
-ENCODING 1579
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57420
-ENCODING 1580
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-88
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57421
-ENCODING 1581
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57422
-ENCODING 1582
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-20
-00
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57423
-ENCODING 1583
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57424
-ENCODING 1584
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57425
-ENCODING 1585
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57426
-ENCODING 1586
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57427
-ENCODING 1587
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57428
-ENCODING 1588
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57429
-ENCODING 1589
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57430
-ENCODING 1590
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57431
-ENCODING 1591
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-20
-20
-2C
-32
-A2
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57432
-ENCODING 1592
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-20
-20
-2C
-32
-A2
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57433
-ENCODING 1593
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-80
-8C
-70
-40
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR afii57434
-ENCODING 1594
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-40
-00
-00
-70
-80
-8C
-70
-40
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR afii57440
-ENCODING 1600
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57441
-ENCODING 1601
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57442
-ENCODING 1602
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0A
-00
-06
-09
-09
-47
-81
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57443
-ENCODING 1603
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-19
-21
-19
-21
-01
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57444
-ENCODING 1604
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-02
-02
-02
-02
-02
-42
-82
-82
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57445
-ENCODING 1605
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0C
-12
-12
-3C
-40
-40
-40
-40
-40
-40
-00
-00
-ENDCHAR
-STARTCHAR afii57446
-ENCODING 1606
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57470
-ENCODING 1607
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-40
-30
-4E
-49
-39
-E6
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57448
-ENCODING 1608
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57449
-ENCODING 1609
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57450
-ENCODING 1610
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-24
-00
-ENDCHAR
-STARTCHAR afii57451
-ENCODING 1611
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-0C
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57452
-ENCODING 1612
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-12
-CA
-2C
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57453
-ENCODING 1613
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-30
-0C
-30
-00
-00
-ENDCHAR
-STARTCHAR afii57454
-ENCODING 1614
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57455
-ENCODING 1615
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-14
-0C
-08
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57456
-ENCODING 1616
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-30
-00
-00
-ENDCHAR
-STARTCHAR afii57457
-ENCODING 1617
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0A
-2A
-2C
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57458
-ENCODING 1618
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0653
-ENCODING 1619
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-01
-7E
-80
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0654
-ENCODING 1620
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-10
-0C
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0655
-ENCODING 1621
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-10
-0C
-10
-ENDCHAR
-STARTCHAR afii57392
-ENCODING 1632
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-30
-78
-30
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57393
-ENCODING 1633
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-70
-70
-38
-18
-18
-08
-08
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57394
-ENCODING 1634
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-44
-FC
-F8
-60
-30
-30
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57395
-ENCODING 1635
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-4A
-FE
-F4
-60
-30
-30
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57396
-ENCODING 1636
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-20
-40
-30
-10
-20
-42
-7C
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57397
-ENCODING 1637
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-2C
-44
-42
-82
-82
-FE
-7C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57398
-ENCODING 1638
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-F8
-78
-08
-08
-08
-0C
-0E
-06
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57399
-ENCODING 1639
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-82
-C6
-C6
-6C
-28
-38
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57400
-ENCODING 1640
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-38
-28
-6C
-C6
-C6
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57401
-ENCODING 1641
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-F8
-88
-F8
-78
-08
-0C
-0E
-06
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57381
-ENCODING 1642
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-91
-92
-64
-08
-10
-26
-49
-89
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni066B
-ENCODING 1643
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-30
-30
-60
-60
-00
-00
-ENDCHAR
-STARTCHAR uni066C
-ENCODING 1644
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-18
-10
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii63167
-ENCODING 1645
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-38
-FE
-7C
-38
-6C
-44
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0670
-ENCODING 1648
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-10
-10
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0671
-ENCODING 1649
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-29
-5E
-00
-04
-04
-04
-04
-04
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0672
-ENCODING 1650
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-28
-5E
-00
-04
-04
-04
-04
-04
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0673
-ENCODING 1651
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-04
-04
-04
-04
-04
-00
-06
-28
-5E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0674
-ENCODING 1652
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-07
-08
-07
-08
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0675
-ENCODING 1653
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-04
-03
-14
-10
-10
-10
-10
-10
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0676
-ENCODING 1654
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-04
-03
-04
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0677
-ENCODING 1655
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-23
-54
-33
-24
-40
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0678
-ENCODING 1656
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-04
-03
-04
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57511
-ENCODING 1657
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni067A
-ENCODING 1658
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-08
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni067B
-ENCODING 1659
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uni067C
-ENCODING 1660
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-14
-40
-81
-81
-7E
-08
-14
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni067D
-ENCODING 1661
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-08
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57506
-ENCODING 1662
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-00
-14
-00
-08
-00
-00
-ENDCHAR
-STARTCHAR uni067F
-ENCODING 1663
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-14
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0680
-ENCODING 1664
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-00
-14
-00
-14
-00
-00
-ENDCHAR
-STARTCHAR uni0681
-ENCODING 1665
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-08
-06
-08
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0682
-ENCODING 1666
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-08
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0683
-ENCODING 1667
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-94
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0684
-ENCODING 1668
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-88
-80
-88
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0685
-ENCODING 1669
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57507
-ENCODING 1670
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-94
-80
-88
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0687
-ENCODING 1671
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-94
-80
-94
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57512
-ENCODING 1672
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-38
-28
-70
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0689
-ENCODING 1673
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-08
-14
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068A
-ENCODING 1674
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068B
-ENCODING 1675
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-38
-28
-70
-08
-04
-02
-42
-3C
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068C
-ENCODING 1676
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068D
-ENCODING 1677
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068E
-ENCODING 1678
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni068F
-ENCODING 1679
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-00
-08
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0690
-ENCODING 1680
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-00
-14
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57513
-ENCODING 1681
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0692
-ENCODING 1682
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-08
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0693
-ENCODING 1683
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-02
-04
-1C
-6A
-04
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0694
-ENCODING 1684
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-02
-04
-18
-62
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0695
-ENCODING 1685
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-02
-04
-18
-60
-00
-14
-08
-00
-00
-ENDCHAR
-STARTCHAR uni0696
-ENCODING 1686
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-12
-04
-18
-62
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0697
-ENCODING 1687
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-14
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57508
-ENCODING 1688
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni0699
-ENCODING 1689
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-00
-14
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069A
-ENCODING 1690
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-00
-01
-15
-88
-88
-8A
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069B
-ENCODING 1691
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-01
-15
-88
-88
-90
-65
-00
-02
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069C
-ENCODING 1692
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-00
-0A
-00
-01
-15
-88
-88
-90
-65
-00
-02
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069D
-ENCODING 1693
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-09
-31
-9E
-88
-90
-65
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069E
-ENCODING 1694
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-0A
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni069F
-ENCODING 1695
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-2A
-20
-20
-2C
-32
-A2
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A0
-ENCODING 1696
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-00
-50
-00
-70
-80
-8C
-70
-40
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uni06A1
-ENCODING 1697
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A2
-ENCODING 1698
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-49
-85
-83
-7E
-00
-02
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A3
-ENCODING 1699
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-49
-85
-83
-7E
-00
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57505
-ENCODING 1700
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-0A
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A5
-ENCODING 1701
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-49
-85
-83
-7E
-00
-0A
-00
-04
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A6
-ENCODING 1702
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0A
-00
-0A
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A7
-ENCODING 1703
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-09
-09
-47
-81
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A8
-ENCODING 1704
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-0A
-00
-06
-09
-09
-47
-81
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06A9
-ENCODING 1705
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-01
-02
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06AA
-ENCODING 1706
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-20
-40
-3E
-01
-81
-7E
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06AB
-ENCODING 1707
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-01
-02
-05
-0B
-48
-84
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06AC
-ENCODING 1708
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-19
-21
-19
-21
-01
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06AD
-ENCODING 1709
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-00
-29
-01
-19
-21
-19
-A1
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06AE
-ENCODING 1710
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-19
-21
-19
-21
-01
-81
-7E
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57509
-ENCODING 1711
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B0
-ENCODING 1712
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-05
-0B
-48
-84
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B1
-ENCODING 1713
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-A4
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B2
-ENCODING 1714
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-14
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B3
-ENCODING 1715
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B4
-ENCODING 1716
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-44
-09
-A2
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B5
-ENCODING 1717
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-08
-02
-02
-02
-02
-42
-82
-82
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B6
-ENCODING 1718
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-02
-02
-02
-02
-02
-42
-82
-82
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B7
-ENCODING 1719
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-02
-2A
-02
-02
-02
-42
-82
-82
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06B8
-ENCODING 1720
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-02
-02
-02
-02
-02
-42
-82
-82
-84
-78
-00
-14
-00
-08
-00
-ENDCHAR
-STARTCHAR uni06B9
-ENCODING 1721
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-04
-00
-00
-ENDCHAR
-STARTCHAR afii57514
-ENCODING 1722
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06BB
-ENCODING 1723
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06BC
-ENCODING 1724
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-41
-81
-81
-81
-42
-3C
-08
-14
-08
-00
-00
-ENDCHAR
-STARTCHAR uni06BD
-ENCODING 1725
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06BE
-ENCODING 1726
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-4C
-52
-32
-3C
-40
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06BF
-ENCODING 1727
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-70
-8F
-30
-40
-94
-80
-88
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C0
-ENCODING 1728
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-40
-38
-40
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C1
-ENCODING 1729
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-0C
-13
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C2
-ENCODING 1730
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-40
-38
-40
-00
-0C
-13
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C3
-ENCODING 1731
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-14
-00
-00
-00
-0C
-13
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C4
-ENCODING 1732
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-0E
-12
-2C
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C5
-ENCODING 1733
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-0E
-02
-3C
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C6
-ENCODING 1734
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-08
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C7
-ENCODING 1735
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-18
-10
-20
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C8
-ENCODING 1736
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-08
-08
-08
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06C9
-ENCODING 1737
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-14
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CA
-ENCODING 1738
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-14
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CB
-ENCODING 1739
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CC
-ENCODING 1740
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CD
-ENCODING 1741
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-20
-47
-88
-08
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CE
-ENCODING 1742
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-50
-20
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06CF
-ENCODING 1743
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D0
-ENCODING 1744
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-82
-7C
-00
-08
-00
-08
-ENDCHAR
-STARTCHAR uni06D1
-ENCODING 1745
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-82
-7C
-00
-14
-00
-08
-ENDCHAR
-STARTCHAR afii57519
-ENCODING 1746
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-14
-60
-80
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D3
-ENCODING 1747
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-80
-60
-80
-08
-14
-60
-80
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D4
-ENCODING 1748
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-3C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57534
-ENCODING 1749
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D6
-ENCODING 1750
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-40
-40
-43
-55
-7E
-80
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D7
-ENCODING 1751
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-2A
-20
-26
-2A
-7C
-80
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D8
-ENCODING 1752
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0E
-1C
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06D9
-ENCODING 1753
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-14
-08
-14
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06DA
-ENCODING 1754
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-2C
-10
-28
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06DB
-ENCODING 1755
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06DC
-ENCODING 1756
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-15
-8A
-90
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06DD
-ENCODING 1757
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-5A
-A5
-66
-5B
-81
-81
-81
-81
-81
-81
-5A
-66
-A5
-5A
-00
-ENDCHAR
-STARTCHAR uni06DE
-ENCODING 1758
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-66
-42
-42
-81
-99
-99
-81
-42
-42
-66
-18
-00
-00
-ENDCHAR
-STARTCHAR uni06DF
-ENCODING 1759
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-1C
-08
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E0
-ENCODING 1760
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E1
-ENCODING 1761
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-26
-08
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E2
-ENCODING 1762
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-10
-10
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E3
-ENCODING 1763
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-15
-8A
-90
-60
-ENDCHAR
-STARTCHAR uni06E4
-ENCODING 1764
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-32
-2C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E5
-ENCODING 1765
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-14
-0C
-04
-08
-30
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E6
-ENCODING 1766
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-10
-30
-40
-3E
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E7
-ENCODING 1767
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-30
-40
-3E
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E8
-ENCODING 1768
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06E9
-ENCODING 1769
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-54
-AA
-92
-54
-54
-54
-54
-54
-54
-54
-82
-FE
-00
-00
-ENDCHAR
-STARTCHAR uni06EA
-ENCODING 1770
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-08
-14
-22
-14
-08
-ENDCHAR
-STARTCHAR uni06EB
-ENCODING 1771
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-14
-22
-14
-08
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06EC
-ENCODING 1772
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-3C
-3C
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06ED
-ENCODING 1773
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-0C
-10
-10
-10
-ENDCHAR
-STARTCHAR uni06F0
-ENCODING 1776
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-44
-44
-38
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F1
-ENCODING 1777
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-70
-70
-38
-18
-18
-08
-08
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F2
-ENCODING 1778
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-44
-FC
-F8
-60
-30
-30
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F3
-ENCODING 1779
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-4A
-FE
-F4
-60
-30
-30
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F4
-ENCODING 1780
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-4E
-F0
-FE
-7C
-30
-30
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F5
-ENCODING 1781
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-38
-2C
-44
-42
-82
-92
-FE
-6C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F6
-ENCODING 1782
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-60
-7E
-3C
-30
-60
-40
-80
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F7
-ENCODING 1783
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-82
-C6
-C6
-6C
-28
-38
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F8
-ENCODING 1784
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-10
-38
-28
-6C
-C6
-C6
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06F9
-ENCODING 1785
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-F8
-88
-F8
-78
-08
-0C
-0E
-06
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06FA
-ENCODING 1786
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-01
-15
-88
-88
-88
-72
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06FB
-ENCODING 1787
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-09
-31
-9E
-88
-88
-72
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni06FC
-ENCODING 1788
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-40
-00
-00
-70
-80
-8C
-70
-40
-80
-88
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uni06FD
-ENCODING 1789
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-20
-1E
-20
-00
-14
-14
-14
-14
-00
-00
-ENDCHAR
-STARTCHAR uni06FE
-ENCODING 1790
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0C
-12
-12
-3C
-40
-54
-54
-54
-54
-40
-00
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 4307
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-92
-92
-92
-92
-92
-4C
-30
-4C
-02
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 4311
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-92
-92
-92
-92
-92
-64
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 4314
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-54
-AA
-AA
-AA
-82
-82
-40
-30
-4C
-02
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 4317
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-92
-92
-92
-82
-82
-44
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR m
-ENCODING 4326
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-92
-92
-92
-82
-82
-40
-30
-4C
-02
-00
-ENDCHAR
-STARTCHAR uni1E00
-ENCODING 7680
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-38
-6C
-38
-ENDCHAR
-STARTCHAR uni1E01
-ENCODING 7681
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-38
-6C
-38
-ENDCHAR
-STARTCHAR uni1E02
-ENCODING 7682
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E03
-ENCODING 7683
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-0C
-EC
-60
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E04
-ENCODING 7684
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-66
-FC
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E05
-ENCODING 7685
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E06
-ENCODING 7686
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-66
-66
-66
-66
-FC
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E07
-ENCODING 7687
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-78
-6C
-66
-66
-66
-66
-7C
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E08
-ENCODING 7688
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-3C
-66
-C2
-C0
-C0
-C0
-C2
-66
-3C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni1E09
-ENCODING 7689
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni1E0A
-ENCODING 7690
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-F8
-6C
-66
-66
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E0B
-ENCODING 7691
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-60
-0C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E0C
-ENCODING 7692
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E0D
-ENCODING 7693
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E0E
-ENCODING 7694
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E0F
-ENCODING 7695
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E10
-ENCODING 7696
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-30
-18
-70
-00
-ENDCHAR
-STARTCHAR uni1E11
-ENCODING 7697
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-30
-18
-70
-00
-ENDCHAR
-STARTCHAR uni1E12
-ENCODING 7698
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E13
-ENCODING 7699
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E14
-ENCODING 7700
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-7C
-00
-FE
-62
-68
-78
-68
-62
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E15
-ENCODING 7701
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-7C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E16
-ENCODING 7702
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7C
-00
-FE
-62
-68
-78
-68
-62
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E17
-ENCODING 7703
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E18
-ENCODING 7704
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E19
-ENCODING 7705
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E1A
-ENCODING 7706
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E1B
-ENCODING 7707
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E1C
-ENCODING 7708
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni1E1D
-ENCODING 7709
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-18
-0C
-38
-00
-ENDCHAR
-STARTCHAR uni1E1E
-ENCODING 7710
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FE
-66
-62
-68
-78
-68
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E1F
-ENCODING 7711
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-38
-6C
-64
-F0
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E20
-ENCODING 7712
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-3C
-66
-C2
-C0
-DE
-C6
-C6
-66
-3A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E21
-ENCODING 7713
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-76
-CC
-CC
-CC
-CC
-CC
-7C
-0C
-CC
-78
-00
-ENDCHAR
-STARTCHAR uni1E22
-ENCODING 7714
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E23
-ENCODING 7715
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E24
-ENCODING 7716
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E25
-ENCODING 7717
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E26
-ENCODING 7718
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E27
-ENCODING 7719
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-E0
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E28
-ENCODING 7720
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-60
-30
-E0
-00
-ENDCHAR
-STARTCHAR uni1E29
-ENCODING 7721
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-30
-18
-70
-00
-ENDCHAR
-STARTCHAR uni1E2A
-ENCODING 7722
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-C6
-00
-6C
-38
-00
-ENDCHAR
-STARTCHAR uni1E2B
-ENCODING 7723
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-6C
-38
-00
-ENDCHAR
-STARTCHAR uni1E2C
-ENCODING 7724
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E2D
-ENCODING 7725
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E2E
-ENCODING 7726
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-66
-00
-3C
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E2F
-ENCODING 7727
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-66
-66
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E30
-ENCODING 7728
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-E6
-66
-66
-6C
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E31
-ENCODING 7729
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-0C
-EC
-60
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E32
-ENCODING 7730
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E33
-ENCODING 7731
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E34
-ENCODING 7732
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E35
-ENCODING 7733
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-66
-6C
-78
-78
-6C
-66
-E6
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E36
-ENCODING 7734
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E37
-ENCODING 7735
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E38
-ENCODING 7736
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-F0
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E39
-ENCODING 7737
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-38
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E3A
-ENCODING 7738
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E3B
-ENCODING 7739
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-7E
-00
-00
-ENDCHAR
-STARTCHAR uni1E3C
-ENCODING 7740
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E3D
-ENCODING 7741
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E3E
-ENCODING 7742
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E3F
-ENCODING 7743
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E40
-ENCODING 7744
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E41
-ENCODING 7745
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E42
-ENCODING 7746
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E43
-ENCODING 7747
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E44
-ENCODING 7748
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E45
-ENCODING 7749
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E46
-ENCODING 7750
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E47
-ENCODING 7751
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E48
-ENCODING 7752
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E49
-ENCODING 7753
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E4A
-ENCODING 7754
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-E6
-F6
-FE
-DE
-CE
-C6
-C6
-C6
-C6
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E4B
-ENCODING 7755
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-66
-66
-66
-66
-66
-66
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E4C
-ENCODING 7756
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-72
-9C
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E4D
-ENCODING 7757
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-76
-DC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E4E
-ENCODING 7758
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-00
-72
-9C
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E4F
-ENCODING 7759
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-00
-76
-DC
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E50
-ENCODING 7760
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E51
-ENCODING 7761
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E52
-ENCODING 7762
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E53
-ENCODING 7763
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-7C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E54
-ENCODING 7764
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-FC
-66
-66
-66
-7C
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E55
-ENCODING 7765
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-DC
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR uni1E56
-ENCODING 7766
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FC
-66
-66
-66
-7C
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E57
-ENCODING 7767
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-DC
-66
-66
-66
-66
-66
-7C
-60
-60
-F0
-00
-ENDCHAR
-STARTCHAR uni1E58
-ENCODING 7768
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E59
-ENCODING 7769
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E5A
-ENCODING 7770
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-66
-E6
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E5B
-ENCODING 7771
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E5C
-ENCODING 7772
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-E6
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E5D
-ENCODING 7773
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E5E
-ENCODING 7774
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-6C
-66
-66
-66
-E6
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E5F
-ENCODING 7775
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-66
-60
-60
-60
-F0
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E60
-ENCODING 7776
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E61
-ENCODING 7777
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E62
-ENCODING 7778
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-60
-38
-0C
-06
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E63
-ENCODING 7779
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E64
-ENCODING 7780
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-6C
-18
-00
-7C
-C6
-C6
-70
-1C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E65
-ENCODING 7781
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-60
-0C
-18
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E66
-ENCODING 7782
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-44
-38
-10
-7C
-C6
-C6
-70
-1C
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E67
-ENCODING 7783
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-44
-38
-10
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E68
-ENCODING 7784
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-7C
-C6
-C6
-60
-38
-0C
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E69
-ENCODING 7785
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-7C
-C6
-60
-38
-0C
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E6A
-ENCODING 7786
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E6B
-ENCODING 7787
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-06
-16
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E6C
-ENCODING 7788
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E6D
-ENCODING 7789
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1E6E
-ENCODING 7790
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-00
-7E
-00
-00
-ENDCHAR
-STARTCHAR uni1E6F
-ENCODING 7791
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-7E
-00
-00
-ENDCHAR
-STARTCHAR uni1E70
-ENCODING 7792
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-18
-18
-18
-18
-18
-3C
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E71
-ENCODING 7793
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-30
-30
-FC
-30
-30
-30
-30
-36
-1C
-08
-1C
-36
-00
-ENDCHAR
-STARTCHAR uni1E72
-ENCODING 7794
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-6C
-6C
-00
-ENDCHAR
-STARTCHAR uni1E73
-ENCODING 7795
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-6C
-6C
-00
-ENDCHAR
-STARTCHAR uni1E74
-ENCODING 7796
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E75
-ENCODING 7797
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-76
-DC
-00
-ENDCHAR
-STARTCHAR uni1E76
-ENCODING 7798
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E77
-ENCODING 7799
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-10
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni1E78
-ENCODING 7800
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-72
-9C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E79
-ENCODING 7801
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-76
-DC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E7A
-ENCODING 7802
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-00
-7C
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E7B
-ENCODING 7803
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-CC
-CC
-00
-FC
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E7C
-ENCODING 7804
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-C6
-C6
-C6
-C6
-C6
-C6
-6C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E7D
-ENCODING 7805
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-66
-66
-66
-66
-66
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E7E
-ENCODING 7806
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-6C
-38
-10
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E7F
-ENCODING 7807
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-3C
-18
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR Wgrave
-ENCODING 7808
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-00
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR wgrave
-ENCODING 7809
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Wacute
-ENCODING 7810
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-00
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR wacute
-ENCODING 7811
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-18
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Wdieresis
-ENCODING 7812
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR wdieresis
-ENCODING 7813
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E86
-ENCODING 7814
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E87
-ENCODING 7815
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E88
-ENCODING 7816
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-D6
-D6
-D6
-FE
-EE
-6C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E89
-ENCODING 7817
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E8A
-ENCODING 7818
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-C6
-C6
-6C
-7C
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E8B
-ENCODING 7819
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-C6
-6C
-38
-38
-38
-6C
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E8C
-ENCODING 7820
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-C6
-C6
-6C
-7C
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E8D
-ENCODING 7821
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-C6
-6C
-38
-38
-38
-6C
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E8E
-ENCODING 7822
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E8F
-ENCODING 7823
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni1E90
-ENCODING 7824
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-FE
-C6
-8C
-18
-30
-60
-C2
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E91
-ENCODING 7825
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E92
-ENCODING 7826
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-18
-30
-60
-C2
-C6
-FE
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E93
-ENCODING 7827
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1E94
-ENCODING 7828
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-86
-0C
-18
-30
-60
-C2
-C6
-FE
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E95
-ENCODING 7829
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-CC
-18
-30
-60
-C6
-FE
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E96
-ENCODING 7830
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-60
-60
-6C
-76
-66
-66
-66
-66
-E6
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni1E97
-ENCODING 7831
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-6C
-00
-10
-30
-FC
-30
-30
-30
-30
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E98
-ENCODING 7832
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-38
-00
-C6
-C6
-D6
-D6
-D6
-FE
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E99
-ENCODING 7833
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-6C
-38
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni1E9A
-ENCODING 7834
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-0C
-18
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1E9B
-ENCODING 7835
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-00
-38
-6C
-64
-60
-60
-60
-60
-60
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA0
-ENCODING 7840
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EA1
-ENCODING 7841
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EA2
-ENCODING 7842
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA3
-ENCODING 7843
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-0C
-18
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA4
-ENCODING 7844
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-16
-38
-6C
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA5
-ENCODING 7845
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-16
-38
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA6
-ENCODING 7846
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-68
-1C
-36
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA7
-ENCODING 7847
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-68
-1C
-36
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA8
-ENCODING 7848
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-6C
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EA9
-ENCODING 7849
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EAA
-ENCODING 7850
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-28
-54
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EAB
-ENCODING 7851
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-38
-44
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EAC
-ENCODING 7852
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-6C
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EAD
-ENCODING 7853
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EAE
-ENCODING 7854
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-44
-38
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EAF
-ENCODING 7855
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-18
-44
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB0
-ENCODING 7856
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-44
-38
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB1
-ENCODING 7857
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-30
-44
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB2
-ENCODING 7858
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-08
-54
-38
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB3
-ENCODING 7859
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-08
-54
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB4
-ENCODING 7860
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-72
-9C
-44
-38
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB5
-ENCODING 7861
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-72
-9C
-44
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EB6
-ENCODING 7862
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-6C
-38
-00
-10
-38
-6C
-C6
-C6
-FE
-C6
-C6
-C6
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EB7
-ENCODING 7863
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-38
-00
-78
-0C
-7C
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EB8
-ENCODING 7864
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-66
-62
-68
-78
-68
-60
-62
-66
-FE
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1EB9
-ENCODING 7865
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EBA
-ENCODING 7866
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EBB
-ENCODING 7867
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-0C
-18
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EBC
-ENCODING 7868
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-00
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EBD
-ENCODING 7869
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EBE
-ENCODING 7870
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-23
-76
-88
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EBF
-ENCODING 7871
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-26
-70
-D8
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC0
-ENCODING 7872
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C4
-6E
-11
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC1
-ENCODING 7873
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-64
-0E
-1B
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC2
-ENCODING 7874
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-6C
-00
-FE
-62
-68
-78
-68
-62
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC3
-ENCODING 7875
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC4
-ENCODING 7876
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-38
-44
-FE
-62
-68
-78
-68
-62
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC5
-ENCODING 7877
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-38
-44
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC6
-ENCODING 7878
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-FE
-66
-62
-68
-78
-68
-62
-66
-FE
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1EC7
-ENCODING 7879
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-FE
-C0
-C0
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EC8
-ENCODING 7880
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-3C
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EC9
-ENCODING 7881
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-0C
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ECA
-ENCODING 7882
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1ECB
-ENCODING 7883
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-38
-18
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1ECC
-ENCODING 7884
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1ECD
-ENCODING 7885
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1ECE
-ENCODING 7886
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ECF
-ENCODING 7887
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-0C
-18
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED0
-ENCODING 7888
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-23
-76
-88
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED1
-ENCODING 7889
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-26
-70
-D8
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED2
-ENCODING 7890
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C4
-6E
-11
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED3
-ENCODING 7891
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-64
-0E
-1B
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED4
-ENCODING 7892
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-44
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED5
-ENCODING 7893
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-13
-3A
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED6
-ENCODING 7894
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-28
-44
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED7
-ENCODING 7895
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-76
-DC
-10
-38
-44
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1ED8
-ENCODING 7896
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-38
-44
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1ED9
-ENCODING 7897
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-38
-6C
-00
-7C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EDA
-ENCODING 7898
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-33
-03
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EDB
-ENCODING 7899
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1B
-33
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EDC
-ENCODING 7900
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-33
-03
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EDD
-ENCODING 7901
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-63
-33
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EDE
-ENCODING 7902
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-70
-1B
-33
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EDF
-ENCODING 7903
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-1B
-33
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE0
-ENCODING 7904
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-68
-B3
-03
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE1
-ENCODING 7905
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-68
-B3
-03
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE2
-ENCODING 7906
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-03
-7A
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EE3
-ENCODING 7907
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-06
-78
-CC
-CC
-CC
-CC
-CC
-78
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EE4
-ENCODING 7908
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EE5
-ENCODING 7909
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EE6
-ENCODING 7910
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE7
-ENCODING 7911
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-18
-30
-00
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE8
-ENCODING 7912
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-33
-03
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EE9
-ENCODING 7913
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1B
-33
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EEA
-ENCODING 7914
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-33
-03
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EEB
-ENCODING 7915
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-63
-33
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EEC
-ENCODING 7916
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-70
-1B
-33
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EED
-ENCODING 7917
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-1B
-33
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EEE
-ENCODING 7918
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-68
-B3
-03
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EEF
-ENCODING 7919
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-68
-B3
-03
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EF0
-ENCODING 7920
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-03
-CE
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-CC
-78
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR uni1EF1
-ENCODING 7921
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-06
-CC
-CC
-CC
-CC
-CC
-CC
-76
-00
-30
-30
-00
-ENDCHAR
-STARTCHAR Ygrave
-ENCODING 7922
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-18
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ygrave
-ENCODING 7923
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-30
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni1EF4
-ENCODING 7924
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-18
-18
-00
-ENDCHAR
-STARTCHAR uni1EF5
-ENCODING 7925
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-7E
-0C
-18
-F6
-06
-00
-ENDCHAR
-STARTCHAR uni1EF6
-ENCODING 7926
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-0C
-18
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EF7
-ENCODING 7927
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-0C
-18
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni1EF8
-ENCODING 7928
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-3A
-5C
-00
-66
-66
-66
-3C
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1EF9
-ENCODING 7929
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-76
-DC
-00
-C6
-C6
-C6
-C6
-C6
-C6
-7E
-06
-0C
-F8
-00
-ENDCHAR
-STARTCHAR uni1F00
-ENCODING 7936
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-30
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F01
-ENCODING 7937
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-18
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F02
-ENCODING 7938
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-6C
-C6
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F03
-ENCODING 7939
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-CC
-66
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F04
-ENCODING 7940
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-66
-CC
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F05
-ENCODING 7941
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C6
-6C
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F06
-ENCODING 7942
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-34
-58
-0C
-18
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni1F07
-ENCODING 7943
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-34
-58
-30
-18
-00
-76
-CC
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8192
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-A4
-AA
-EA
-EA
-A6
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8193
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-A4
-EA
-AA
-AA
-A6
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8194
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-8A
-CE
-8E
-EA
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8195
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-8E
-CA
-8A
-EA
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8196
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-CA
-2E
-4A
-2A
-CA
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8197
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-AA
-AE
-EA
-2A
-2A
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8198
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-6A
-8E
-CA
-AA
-4A
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8199
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-38
-20
-30
-20
-20
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8200
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-30
-28
-30
-20
-20
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8201
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-4A
-4E
-4A
-4A
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8202
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-28
-28
-38
-28
-28
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8203
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-2A
-4E
-8E
-EE
-00
-6C
-8A
-4C
-28
-C8
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8204
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-2A
-4E
-8E
-EE
-00
-A2
-A2
-E2
-EA
-A4
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8205
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-EA
-2A
-4E
-8E
-EE
-00
-08
-08
-08
-28
-10
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8206
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-80
-80
-80
-F0
-28
-30
-28
-0A
-0E
-0E
-0A
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 8207
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-00
-C0
-A0
-C0
-A0
-20
-20
-38
-0A
-0E
-0E
-0A
-00
-FE
-00
-ENDCHAR
-STARTCHAR uni2010
-ENCODING 8208
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2011
-ENCODING 8209
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-9C
-D2
-BC
-92
-9C
-00
-3C
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR figuredash
-ENCODING 8210
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR endash
-ENCODING 8211
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR emdash
-ENCODING 8212
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii00208
-ENCODING 8213
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2016
-ENCODING 8214
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR underscoredbl
-ENCODING 8215
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FE
-00
-FE
-00
-ENDCHAR
-STARTCHAR quoteleft
-ENCODING 8216
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-30
-30
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quoteright
-ENCODING 8217
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-18
-18
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotesinglbase
-ENCODING 8218
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-18
-30
-00
-00
-ENDCHAR
-STARTCHAR quotereversed
-ENCODING 8219
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-30
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotedblleft
-ENCODING 8220
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-66
-CC
-CC
-CC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotedblright
-ENCODING 8221
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-66
-66
-66
-CC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR quotedblbase
-ENCODING 8222
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-66
-66
-66
-CC
-00
-00
-ENDCHAR
-STARTCHAR uni201F
-ENCODING 8223
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-CC
-CC
-CC
-66
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dagger
-ENCODING 8224
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-7E
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR daggerdbl
-ENCODING 8225
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-7E
-18
-18
-7E
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR bullet
-ENCODING 8226
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-18
-3C
-3C
-18
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2023
-ENCODING 8227
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-20
-30
-38
-3C
-38
-30
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR onedotenleader
-ENCODING 8228
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR twodotenleader
-ENCODING 8229
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ellipsis
-ENCODING 8230
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2027
-ENCODING 8231
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR perthousand
-ENCODING 8240
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C6
-0C
-18
-30
-60
-C0
-36
-36
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2031
-ENCODING 8241
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C6
-0C
-18
-30
-60
-C0
-6B
-6B
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR minute
-ENCODING 8242
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR second
-ENCODING 8243
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-48
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2034
-ENCODING 8244
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-92
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2035
-ENCODING 8245
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-08
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2036
-ENCODING 8246
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-24
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2037
-ENCODING 8247
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-49
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2038
-ENCODING 8248
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-38
-6C
-C6
-00
-ENDCHAR
-STARTCHAR guilsinglleft
-ENCODING 8249
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0C
-18
-30
-60
-30
-18
-0C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR guilsinglright
-ENCODING 8250
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-60
-30
-18
-0C
-18
-30
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni203B
-ENCODING 8251
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-92
-44
-28
-92
-28
-44
-92
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR exclamdbl
-ENCODING 8252
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-66
-66
-66
-66
-66
-00
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni203D
-ENCODING 8253
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-C3
-DB
-1B
-1E
-1C
-18
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni203E
-ENCODING 8254
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni203F
-ENCODING 8255
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-82
-7C
-00
-00
-ENDCHAR
-STARTCHAR uni2040
-ENCODING 8256
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-7C
-82
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2041
-ENCODING 8257
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-06
-0C
-18
-38
-6C
-00
-ENDCHAR
-STARTCHAR uni2042
-ENCODING 8258
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-28
-00
-00
-44
-EE
-AA
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2043
-ENCODING 8259
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-3C
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR fraction
-ENCODING 8260
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-0C
-0C
-18
-18
-30
-30
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2045
-ENCODING 8261
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-30
-30
-30
-3C
-30
-30
-30
-30
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2046
-ENCODING 8262
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-0C
-0C
-0C
-3C
-0C
-0C
-0C
-0C
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2048
-ENCODING 8264
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7B
-CF
-CF
-1B
-33
-33
-33
-00
-33
-33
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2049
-ENCODING 8265
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DE
-F3
-F3
-C6
-CC
-CC
-CC
-00
-CC
-CC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni204A
-ENCODING 8266
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7E
-7E
-06
-06
-0C
-0C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni204B
-ENCODING 8267
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-DB
-DB
-DB
-DE
-D8
-D8
-D8
-D8
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni204C
-ENCODING 8268
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-3E
-72
-F2
-F2
-F2
-72
-3E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni204D
-ENCODING 8269
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-F8
-9C
-9E
-9E
-9E
-9C
-F8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zerosuperior
-ENCODING 8304
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D8
-D8
-D8
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR foursuperior
-ENCODING 8308
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-18
-38
-78
-D8
-FC
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR fivesuperior
-ENCODING 8309
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-F8
-C0
-F0
-18
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR sixsuperior
-ENCODING 8310
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-78
-C0
-F0
-D8
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR sevensuperior
-ENCODING 8311
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-F8
-D8
-30
-30
-60
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR eightsuperior
-ENCODING 8312
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D8
-70
-D8
-D8
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ninesuperior
-ENCODING 8313
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D8
-D8
-78
-18
-F0
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni207A
-ENCODING 8314
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-30
-FC
-30
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni207B
-ENCODING 8315
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni207C
-ENCODING 8316
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-00
-FC
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR parenleftsuperior
-ENCODING 8317
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-60
-60
-60
-60
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR parenrightsuperior
-ENCODING 8318
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-60
-30
-30
-30
-30
-60
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR nsuperior
-ENCODING 8319
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-B0
-D8
-D8
-D8
-D8
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR zeroinferior
-ENCODING 8320
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-70
-D8
-D8
-D8
-D8
-70
-00
-00
-00
-ENDCHAR
-STARTCHAR oneinferior
-ENCODING 8321
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-30
-70
-30
-30
-30
-78
-00
-00
-00
-ENDCHAR
-STARTCHAR twoinferior
-ENCODING 8322
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-70
-D8
-30
-60
-C8
-F8
-00
-00
-00
-ENDCHAR
-STARTCHAR threeinferior
-ENCODING 8323
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-70
-D8
-30
-18
-D8
-70
-00
-00
-00
-ENDCHAR
-STARTCHAR fourinferior
-ENCODING 8324
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-38
-78
-D8
-FC
-18
-00
-00
-00
-ENDCHAR
-STARTCHAR fiveinferior
-ENCODING 8325
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-F8
-C0
-F0
-18
-D8
-70
-00
-00
-00
-ENDCHAR
-STARTCHAR sixinferior
-ENCODING 8326
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-78
-C0
-F0
-D8
-D8
-70
-00
-00
-00
-ENDCHAR
-STARTCHAR seveninferior
-ENCODING 8327
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-F8
-D8
-30
-30
-60
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR eightinferior
-ENCODING 8328
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-70
-D8
-70
-D8
-D8
-70
-00
-00
-00
-ENDCHAR
-STARTCHAR nineinferior
-ENCODING 8329
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-70
-D8
-D8
-78
-18
-F0
-00
-00
-00
-ENDCHAR
-STARTCHAR uni208A
-ENCODING 8330
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-30
-30
-FC
-30
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni208B
-ENCODING 8331
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FC
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni208C
-ENCODING 8332
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-FC
-00
-FC
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR parenleftinferior
-ENCODING 8333
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-30
-60
-60
-60
-60
-30
-00
-00
-00
-ENDCHAR
-STARTCHAR parenrightinferior
-ENCODING 8334
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-60
-30
-30
-30
-30
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uni208F
-ENCODING 8335
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-B0
-D8
-D8
-D8
-D8
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20A0
-ENCODING 8352
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-C0
-CF
-CC
-CC
-7F
-0C
-0C
-0F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR colonmonetary
-ENCODING 8353
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-04
-7C
-CE
-C8
-C8
-D0
-D0
-D0
-E0
-E6
-7C
-40
-40
-00
-00
-ENDCHAR
-STARTCHAR uni20A2
-ENCODING 8354
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C0
-C0
-D6
-D8
-D8
-D8
-DE
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR franc
-ENCODING 8355
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-C0
-C0
-C0
-F0
-CD
-CE
-CC
-CC
-CC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lira
-ENCODING 8356
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-60
-F8
-60
-F8
-60
-60
-E6
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20A5
-ENCODING 8357
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-02
-EC
-D6
-DE
-D6
-D6
-F6
-D6
-40
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20A6
-ENCODING 8358
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-66
-76
-FF
-76
-6E
-FF
-6E
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR peseta
-ENCODING 8359
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-7C
-62
-66
-6F
-66
-66
-F3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20A8
-ENCODING 8360
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-CC
-CC
-CC
-F8
-E0
-F3
-D6
-DB
-CE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20A9
-ENCODING 8361
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-81
-81
-81
-5A
-FF
-5A
-FF
-24
-24
-24
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii57636
-ENCODING 8362
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-F2
-8A
-AA
-AA
-AA
-AA
-A2
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dong
-ENCODING 8363
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-3E
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-7C
-00
-00
-ENDCHAR
-STARTCHAR Euro
-ENCODING 8364
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-36
-60
-FC
-60
-F8
-60
-60
-36
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20AD
-ENCODING 8365
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-6C
-78
-FE
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20AE
-ENCODING 8366
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-7E
-5A
-18
-1E
-78
-1E
-78
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni20AF
-ENCODING 8367
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-7C
-B6
-36
-33
-33
-33
-63
-66
-F6
-DC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2100
-ENCODING 8448
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D0
-D2
-D6
-7C
-18
-30
-6E
-D8
-98
-18
-0E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2101
-ENCODING 8449
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-D0
-D2
-D6
-7C
-18
-30
-6E
-D8
-8C
-06
-1C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2102
-ENCODING 8450
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-62
-A0
-A0
-A0
-A0
-A0
-A0
-62
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2103
-ENCODING 8451
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-4E
-B9
-58
-18
-18
-18
-18
-18
-19
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2104
-ENCODING 8452
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-7C
-DA
-D8
-D8
-DA
-7C
-19
-3F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii61248
-ENCODING 8453
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-C0
-C2
-C6
-7C
-18
-30
-6E
-DB
-9B
-1B
-0E
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2106
-ENCODING 8454
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-70
-C0
-C2
-C6
-7C
-18
-30
-7B
-DB
-9B
-1B
-0D
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2107
-ENCODING 8455
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C2
-C0
-78
-C0
-C0
-C2
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2108
-ENCODING 8456
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-86
-26
-3E
-26
-06
-86
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2109
-ENCODING 8457
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7F
-B9
-58
-1A
-1E
-1A
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni210A
-ENCODING 8458
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1A
-66
-46
-87
-8C
-8C
-7C
-98
-98
-70
-00
-ENDCHAR
-STARTCHAR uni210B
-ENCODING 8459
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-52
-B5
-15
-16
-2C
-34
-68
-A9
-AA
-4C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni210C
-ENCODING 8460
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-48
-B0
-80
-48
-7C
-66
-26
-26
-A6
-46
-06
-34
-48
-00
-ENDCHAR
-STARTCHAR uni210D
-ENCODING 8461
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E2
-A2
-A2
-A2
-BE
-A2
-A2
-A2
-A2
-E2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni210E
-ENCODING 8462
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-36
-3B
-3B
-33
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni210F
-ENCODING 8463
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-1E
-18
-76
-3B
-3B
-33
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2110
-ENCODING 8464
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-33
-4E
-06
-06
-0C
-0C
-1F
-6C
-88
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Ifraktur
-ENCODING 8465
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-71
-8E
-04
-0C
-06
-03
-63
-C3
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2112
-ENCODING 8466
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-46
-49
-39
-1E
-18
-30
-70
-B1
-BA
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii61289
-ENCODING 8467
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-19
-31
-32
-64
-68
-70
-E1
-66
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2114
-ENCODING 8468
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D8
-FF
-D8
-DE
-DB
-DB
-DB
-DB
-DB
-DE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2115
-ENCODING 8469
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E2
-A2
-B2
-B2
-AA
-AA
-A6
-A6
-A2
-E2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR afii61352
-ENCODING 8470
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-CC
-CF
-ED
-FF
-FC
-DF
-CC
-CC
-CC
-CC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2117
-ENCODING 8471
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-B9
-A5
-A5
-B9
-A1
-A1
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR weierstrass
-ENCODING 8472
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-40
-8E
-93
-A3
-63
-4B
-6A
-A4
-B0
-B0
-60
-00
-ENDCHAR
-STARTCHAR uni2119
-ENCODING 8473
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-A2
-A2
-A2
-A2
-BC
-A0
-A0
-A0
-E0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni211A
-ENCODING 8474
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-A2
-A2
-A2
-A2
-A2
-A2
-AA
-A6
-7E
-01
-00
-00
-00
-ENDCHAR
-STARTCHAR uni211B
-ENCODING 8475
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-4D
-4D
-19
-1E
-1C
-34
-34
-B5
-62
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Rfraktur
-ENCODING 8476
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-58
-A6
-A3
-6C
-B8
-26
-26
-26
-A7
-C2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni211D
-ENCODING 8477
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-A2
-A2
-A2
-A2
-BC
-B0
-A8
-A4
-E2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR prescription
-ENCODING 8478
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FC
-66
-66
-66
-7C
-6C
-6D
-67
-66
-EE
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uni211F
-ENCODING 8479
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-0C
-FC
-C6
-C6
-C6
-FC
-D8
-DC
-DC
-E6
-E6
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2120
-ENCODING 8480
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-71
-DB
-35
-D1
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2121
-ENCODING 8481
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FE
-52
-5A
-52
-5F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR trademark
-ENCODING 8482
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F1
-5B
-55
-51
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2123
-ENCODING 8483
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-18
-CE
-D6
-D6
-D6
-D6
-D6
-E6
-6C
-38
-50
-40
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2124
-ENCODING 8484
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-0A
-14
-14
-28
-28
-50
-50
-A0
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2125
-ENCODING 8485
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-9C
-30
-FE
-0C
-18
-38
-0C
-06
-06
-C6
-C6
-7C
-00
-ENDCHAR
-STARTCHAR Omega
-ENCODING 8486
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-6C
-6C
-6C
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2127
-ENCODING 8487
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-6C
-6C
-6C
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2128
-ENCODING 8488
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-26
-03
-13
-0C
-13
-03
-03
-66
-98
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2129
-ENCODING 8489
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-18
-18
-18
-18
-1C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni212A
-ENCODING 8490
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E6
-66
-66
-6C
-78
-78
-6C
-66
-66
-E6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni212B
-ENCODING 8491
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-6C
-38
-10
-38
-38
-6C
-6C
-C6
-FE
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni212C
-ENCODING 8492
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-2D
-2D
-1A
-1E
-1B
-31
-31
-B2
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni212D
-ENCODING 8493
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-14
-6B
-C8
-CC
-C6
-C6
-CC
-C0
-63
-1C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR estimated
-ENCODING 8494
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-E7
-FF
-E0
-67
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni212F
-ENCODING 8495
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1C
-26
-44
-F8
-C0
-C8
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2130
-ENCODING 8496
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-4C
-52
-3C
-10
-3C
-60
-C0
-C3
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2131
-ENCODING 8497
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-73
-CE
-18
-3A
-5C
-18
-30
-30
-B0
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2132
-ENCODING 8498
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-0C
-0C
-0C
-2C
-3C
-2C
-8C
-CC
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2133
-ENCODING 8499
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-12
-12
-12
-16
-36
-3E
-3A
-5A
-52
-91
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2134
-ENCODING 8500
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1C
-26
-46
-C6
-C4
-C8
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR aleph
-ENCODING 8501
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-42
-C6
-E7
-7A
-38
-5C
-CE
-E7
-63
-E2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2136
-ENCODING 8502
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-FC
-7E
-06
-06
-06
-06
-0C
-7E
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2137
-ENCODING 8503
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-40
-78
-3C
-0C
-0C
-0C
-0C
-1E
-7E
-F2
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2138
-ENCODING 8504
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-FE
-7E
-0C
-0C
-0C
-0C
-0C
-1C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2139
-ENCODING 8505
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-38
-00
-78
-38
-38
-38
-38
-38
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni213A
-ENCODING 8506
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7D
-FF
-83
-86
-82
-FE
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR onethird
-ENCODING 8531
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-DC
-86
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR twothirds
-ENCODING 8532
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-62
-C6
-FC
-18
-30
-60
-DC
-86
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni2155
-ENCODING 8533
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-DE
-98
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni2156
-ENCODING 8534
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-62
-C6
-FC
-18
-30
-60
-DE
-98
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni2157
-ENCODING 8535
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-62
-36
-EC
-18
-30
-60
-DE
-98
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni2158
-ENCODING 8536
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-70
-B2
-F6
-3C
-18
-30
-60
-DE
-98
-1C
-06
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni2159
-ENCODING 8537
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-DC
-B0
-3C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni215A
-ENCODING 8538
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-F0
-C0
-E2
-36
-EC
-18
-30
-60
-DC
-B0
-3C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR oneeighth
-ENCODING 8539
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-DC
-B6
-1C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR threeeighths
-ENCODING 8540
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-62
-36
-EC
-18
-30
-60
-DC
-B6
-1C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR fiveeighths
-ENCODING 8541
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-F0
-80
-E2
-36
-EC
-18
-30
-60
-DC
-B6
-1C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR seveneighths
-ENCODING 8542
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-F0
-30
-62
-66
-6C
-18
-30
-60
-DC
-B6
-1C
-36
-1C
-00
-00
-ENDCHAR
-STARTCHAR uni215F
-ENCODING 8543
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-C2
-C6
-CC
-18
-30
-60
-C0
-80
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2160
-ENCODING 8544
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2161
-ENCODING 8545
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2162
-ENCODING 8546
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2163
-ENCODING 8547
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-CE
-CE
-C4
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2164
-ENCODING 8548
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-6C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2165
-ENCODING 8549
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-73
-73
-23
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2166
-ENCODING 8550
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-95
-95
-95
-95
-95
-95
-95
-65
-65
-65
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2167
-ENCODING 8551
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-B5
-B5
-B5
-B5
-B5
-B5
-55
-55
-55
-55
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2168
-ENCODING 8552
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-DB
-CE
-CE
-CE
-DB
-DB
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2169
-ENCODING 8553
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-7C
-38
-38
-7C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216A
-ENCODING 8554
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-DB
-73
-73
-73
-DB
-DB
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216B
-ENCODING 8555
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-95
-95
-95
-65
-65
-65
-95
-95
-95
-95
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216C
-ENCODING 8556
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-60
-60
-60
-60
-60
-60
-62
-66
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216D
-ENCODING 8557
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-C2
-C0
-C0
-C0
-C0
-C2
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216E
-ENCODING 8558
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-6C
-66
-66
-66
-66
-66
-66
-6C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni216F
-ENCODING 8559
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-EE
-FE
-FE
-D6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2170
-ENCODING 8560
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2171
-ENCODING 8561
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-00
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2172
-ENCODING 8562
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-DB
-DB
-00
-DB
-DB
-DB
-DB
-DB
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2173
-ENCODING 8563
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-00
-DB
-DB
-DB
-DB
-DB
-CE
-C4
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2174
-ENCODING 8564
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-66
-66
-66
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2175
-ENCODING 8565
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-00
-DB
-DB
-DB
-DB
-DB
-73
-23
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2176
-ENCODING 8566
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-05
-05
-00
-95
-95
-95
-95
-95
-65
-65
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2177
-ENCODING 8567
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-15
-15
-00
-B5
-B5
-B5
-B5
-55
-55
-55
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2178
-ENCODING 8568
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-00
-DB
-DB
-CE
-CE
-CE
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2179
-ENCODING 8569
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-6C
-38
-38
-38
-6C
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217A
-ENCODING 8570
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-00
-DB
-DB
-73
-73
-73
-DB
-DB
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217B
-ENCODING 8571
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-05
-05
-00
-95
-95
-65
-65
-95
-95
-95
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217C
-ENCODING 8572
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-18
-18
-18
-18
-18
-18
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217D
-ENCODING 8573
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-7C
-C6
-C0
-C0
-C0
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217E
-ENCODING 8574
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-0C
-0C
-3C
-6C
-CC
-CC
-CC
-CC
-76
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni217F
-ENCODING 8575
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-EC
-FE
-D6
-D6
-D6
-D6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2180
-ENCODING 8576
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-5A
-DB
-DB
-DB
-DB
-DB
-DB
-5A
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2181
-ENCODING 8577
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-CC
-E6
-D6
-D6
-D6
-D6
-E6
-CC
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2182
-ENCODING 8578
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-5A
-99
-BD
-DB
-DB
-BD
-99
-5A
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2183
-ENCODING 8579
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-CC
-86
-06
-06
-06
-06
-86
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowleft
-ENCODING 8592
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-60
-FF
-60
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowup
-ENCODING 8593
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowright
-ENCODING 8594
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-06
-FF
-06
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdown
-ENCODING 8595
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-7E
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowboth
-ENCODING 8596
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-66
-FF
-66
-24
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowupdn
-ENCODING 8597
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-18
-18
-7E
-3C
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2196
-ENCODING 8598
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-F0
-E0
-B0
-18
-0C
-06
-03
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2197
-ENCODING 8599
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-0F
-07
-0D
-18
-30
-60
-C0
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2198
-ENCODING 8600
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C0
-60
-30
-18
-0D
-07
-0F
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2199
-ENCODING 8601
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-06
-0C
-18
-B0
-E0
-F0
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219A
-ENCODING 8602
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-32
-62
-FF
-64
-34
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219B
-ENCODING 8603
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-2C
-26
-FF
-46
-4C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219C
-ENCODING 8604
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-E0
-CE
-BB
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219D
-ENCODING 8605
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-07
-73
-DD
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219E
-ENCODING 8606
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-36
-6C
-FF
-6C
-36
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni219F
-ENCODING 8607
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-3C
-7E
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A0
-ENCODING 8608
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-6C
-36
-FF
-36
-6C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A1
-ENCODING 8609
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-7E
-3C
-18
-7E
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A2
-ENCODING 8610
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-33
-66
-FC
-66
-33
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A3
-ENCODING 8611
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-66
-3F
-66
-CC
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A4
-ENCODING 8612
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-33
-63
-FF
-63
-33
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A5
-ENCODING 8613
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-18
-18
-18
-18
-18
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A6
-ENCODING 8614
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-CC
-C6
-FF
-C6
-CC
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A7
-ENCODING 8615
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-18
-18
-18
-18
-18
-18
-7E
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowupdnbse
-ENCODING 8616
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-18
-18
-7E
-3C
-18
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21A9
-ENCODING 8617
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-33
-63
-FE
-60
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AA
-ENCODING 8618
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-60
-CC
-C6
-7F
-06
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AB
-ENCODING 8619
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-3B
-6B
-FE
-68
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AC
-ENCODING 8620
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-60
-DC
-D6
-7F
-16
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AD
-ENCODING 8621
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-5A
-FF
-66
-24
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AE
-ENCODING 8622
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-2C
-6E
-FF
-76
-34
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21AF
-ENCODING 8623
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-30
-60
-63
-FF
-C6
-16
-1C
-1C
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B0
-ENCODING 8624
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-30
-60
-FE
-66
-36
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B1
-ENCODING 8625
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-0C
-FE
-CC
-D8
-C0
-C0
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B2
-ENCODING 8626
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-06
-06
-06
-36
-66
-FE
-60
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B3
-ENCODING 8627
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C0
-C0
-C0
-D8
-CC
-FE
-0C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B4
-ENCODING 8628
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FC
-0C
-0C
-3F
-1E
-0C
-00
-00
-00
-ENDCHAR
-STARTCHAR carriagereturn
-ENCODING 8629
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-06
-36
-66
-FE
-60
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B6
-ENCODING 8630
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-1E
-33
-33
-33
-30
-FC
-78
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B7
-ENCODING 8631
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-78
-CC
-CC
-CC
-0C
-3F
-1E
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B8
-ENCODING 8632
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-00
-F0
-E0
-B0
-18
-0C
-06
-03
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21B9
-ENCODING 8633
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-98
-B0
-FF
-B0
-98
-19
-0D
-FF
-0D
-19
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BA
-ENCODING 8634
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-1E
-1C
-16
-03
-C3
-C3
-C3
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BB
-ENCODING 8635
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-78
-38
-68
-C0
-C3
-C3
-C3
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BC
-ENCODING 8636
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-60
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BD
-ENCODING 8637
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-60
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BE
-ENCODING 8638
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-1C
-1E
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21BF
-ENCODING 8639
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-38
-78
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C0
-ENCODING 8640
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-06
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C1
-ENCODING 8641
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-06
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C2
-ENCODING 8642
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-1E
-1C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C3
-ENCODING 8643
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-78
-38
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C4
-ENCODING 8644
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-06
-FF
-06
-0C
-30
-60
-FF
-60
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C5
-ENCODING 8645
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-2E
-3F
-24
-24
-24
-24
-FC
-74
-24
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C6
-ENCODING 8646
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-60
-FF
-60
-30
-0C
-06
-FF
-06
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C7
-ENCODING 8647
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-60
-FE
-60
-30
-00
-30
-60
-FE
-60
-30
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C8
-ENCODING 8648
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-7E
-FF
-24
-24
-24
-24
-24
-24
-24
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21C9
-ENCODING 8649
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-0C
-FE
-0C
-18
-00
-18
-0C
-FE
-0C
-18
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CA
-ENCODING 8650
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-24
-24
-24
-24
-24
-24
-FF
-7E
-24
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CB
-ENCODING 8651
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-30
-60
-FF
-00
-FF
-06
-0C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CC
-ENCODING 8652
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0C
-06
-FF
-00
-FF
-60
-30
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CD
-ENCODING 8653
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-22
-7F
-C4
-7F
-24
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CE
-ENCODING 8654
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-2C
-7E
-CB
-7E
-34
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21CF
-ENCODING 8655
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-FE
-23
-FE
-44
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdblleft
-ENCODING 8656
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-20
-7F
-C0
-7F
-20
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdblup
-ENCODING 8657
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-7C
-EE
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdblright
-ENCODING 8658
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-FE
-03
-FE
-04
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdbldown
-ENCODING 8659
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-EE
-7C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR arrowdblboth
-ENCODING 8660
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-7E
-C3
-7E
-24
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21D5
-ENCODING 8661
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-7C
-EE
-6C
-6C
-6C
-6C
-EE
-7C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21D6
-ENCODING 8662
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-F0
-E0
-B0
-D8
-EC
-B6
-1B
-0C
-04
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21D7
-ENCODING 8663
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-0F
-07
-0D
-1B
-37
-6D
-D8
-30
-20
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21D8
-ENCODING 8664
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-20
-30
-D8
-6D
-37
-1B
-0D
-07
-0F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21D9
-ENCODING 8665
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-0C
-1B
-B6
-EC
-D8
-B0
-E0
-F0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DA
-ENCODING 8666
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-3F
-60
-FF
-60
-3F
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DB
-ENCODING 8667
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-FC
-06
-FF
-06
-FC
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DC
-ENCODING 8668
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-6A
-FF
-65
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DD
-ENCODING 8669
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-A6
-FF
-56
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DE
-ENCODING 8670
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-7E
-18
-18
-3C
-18
-3C
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21DF
-ENCODING 8671
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-3C
-18
-3C
-18
-18
-7E
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E0
-ENCODING 8672
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-30
-60
-D5
-60
-30
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E1
-ENCODING 8673
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-66
-18
-00
-18
-00
-18
-00
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E2
-ENCODING 8674
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-06
-AB
-06
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E3
-ENCODING 8675
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-00
-18
-00
-18
-00
-18
-66
-3C
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E4
-ENCODING 8676
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-98
-B0
-FF
-B0
-98
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E5
-ENCODING 8677
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-19
-0D
-FF
-0D
-19
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E6
-ENCODING 8678
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-3F
-41
-81
-41
-3F
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E7
-ENCODING 8679
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-C6
-44
-44
-44
-44
-44
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E8
-ENCODING 8680
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-FC
-82
-81
-82
-FC
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21E9
-ENCODING 8681
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-44
-44
-44
-44
-44
-C6
-44
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21EA
-ENCODING 8682
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-C6
-44
-44
-7C
-00
-7C
-44
-7C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21EB
-ENCODING 8683
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-C6
-44
-44
-44
-C6
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21EC
-ENCODING 8684
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-7C
-C6
-44
-44
-44
-C6
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21ED
-ENCODING 8685
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-54
-D6
-54
-54
-54
-D6
-92
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21EE
-ENCODING 8686
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-28
-54
-EE
-44
-C6
-44
-44
-44
-44
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21EF
-ENCODING 8687
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-28
-54
-EE
-44
-C6
-44
-44
-C6
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21F0
-ENCODING 8688
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-E8
-BC
-82
-81
-82
-BC
-E8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21F1
-ENCODING 8689
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-80
-BC
-B8
-AC
-86
-83
-81
-80
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21F2
-ENCODING 8690
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-01
-81
-C1
-61
-35
-1D
-3D
-01
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni21F3
-ENCODING 8691
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-C6
-44
-44
-44
-C6
-44
-28
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR universal
-ENCODING 8704
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-FE
-C6
-6C
-6C
-38
-38
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2201
-ENCODING 8705
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-60
-60
-60
-60
-60
-66
-3C
-00
-00
-ENDCHAR
-STARTCHAR partialdiff
-ENCODING 8706
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-06
-06
-3E
-66
-C6
-C6
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR existential
-ENCODING 8707
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-06
-06
-06
-7E
-06
-06
-06
-06
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2204
-ENCODING 8708
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-FE
-16
-16
-16
-7E
-16
-26
-26
-26
-FE
-40
-00
-00
-00
-ENDCHAR
-STARTCHAR emptyset
-ENCODING 8709
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-3E
-66
-CF
-DB
-DB
-F3
-66
-7C
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR Delta
-ENCODING 8710
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR gradient
-ENCODING 8711
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-C6
-C6
-6C
-6C
-38
-38
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR element
-ENCODING 8712
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-3E
-60
-C0
-C0
-FE
-C0
-C0
-60
-3E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR notelement
-ENCODING 8713
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-3E
-64
-C8
-C8
-FE
-C8
-D0
-70
-3E
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni220A
-ENCODING 8714
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-3E
-60
-C0
-FE
-C0
-60
-3E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR suchthat
-ENCODING 8715
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-F8
-0C
-06
-06
-FE
-06
-06
-0C
-F8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni220C
-ENCODING 8716
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-F8
-1C
-16
-26
-FE
-26
-26
-4C
-F8
-40
-00
-00
-00
-ENDCHAR
-STARTCHAR uni220D
-ENCODING 8717
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-F8
-0C
-06
-FE
-06
-0C
-F8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni220E
-ENCODING 8718
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-7E
-7E
-7E
-7E
-7E
-7E
-7E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR product
-ENCODING 8719
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-66
-66
-66
-66
-66
-66
-66
-66
-66
-66
-E7
-00
-00
-ENDCHAR
-STARTCHAR uni2210
-ENCODING 8720
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E7
-66
-66
-66
-66
-66
-66
-66
-66
-66
-66
-FF
-00
-00
-ENDCHAR
-STARTCHAR summation
-ENCODING 8721
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-C1
-60
-30
-18
-0C
-0C
-18
-30
-60
-C1
-FF
-00
-00
-ENDCHAR
-STARTCHAR minus
-ENCODING 8722
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2213
-ENCODING 8723
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-7E
-00
-18
-18
-7E
-18
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2214
-ENCODING 8724
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-18
-00
-18
-18
-7E
-18
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR fraction
-ENCODING 8725
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-06
-06
-0C
-0C
-18
-18
-30
-30
-60
-60
-C0
-C0
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2216
-ENCODING 8726
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-C0
-60
-60
-30
-30
-18
-18
-0C
-0C
-06
-06
-00
-00
-00
-ENDCHAR
-STARTCHAR asteriskmath
-ENCODING 8727
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-18
-7E
-18
-24
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2218
-ENCODING 8728
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-24
-24
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR periodcentered
-ENCODING 8729
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-3C
-3C
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR radical
-ENCODING 8730
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-06
-06
-06
-0C
-CC
-6C
-38
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni221B
-ENCODING 8731
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E3
-33
-66
-36
-E6
-0C
-CC
-6C
-38
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni221C
-ENCODING 8732
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-33
-73
-B6
-F6
-36
-0C
-CC
-6C
-38
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR proportional
-ENCODING 8733
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-D8
-D8
-6E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR infinity
-ENCODING 8734
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-DB
-DB
-6E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR orthogonal
-ENCODING 8735
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-C0
-C0
-C0
-C0
-C0
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR angle
-ENCODING 8736
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-02
-06
-0C
-18
-30
-60
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2221
-ENCODING 8737
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-02
-16
-0C
-1C
-34
-62
-FF
-02
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2222
-ENCODING 8738
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-0E
-38
-E8
-38
-0E
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2223
-ENCODING 8739
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2224
-ENCODING 8740
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-1A
-1C
-38
-58
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2225
-ENCODING 8741
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2226
-ENCODING 8742
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6C
-6C
-6C
-6E
-7C
-EC
-6C
-6C
-6C
-6C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR logicaland
-ENCODING 8743
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR logicalor
-ENCODING 8744
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C6
-C6
-6C
-6C
-38
-38
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR intersection
-ENCODING 8745
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-7C
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR union
-ENCODING 8746
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR integral
-ENCODING 8747
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-1A
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-58
-30
-00
-00
-ENDCHAR
-STARTCHAR uni222C
-ENCODING 8748
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-33
-66
-66
-66
-66
-66
-66
-66
-66
-66
-66
-66
-66
-CC
-00
-00
-ENDCHAR
-STARTCHAR uni222D
-ENCODING 8749
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-2A
-54
-54
-54
-54
-54
-54
-54
-54
-54
-54
-54
-54
-A8
-00
-00
-ENDCHAR
-STARTCHAR uni222E
-ENCODING 8750
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-1A
-18
-18
-3C
-5A
-99
-99
-5A
-3C
-18
-18
-58
-30
-00
-00
-ENDCHAR
-STARTCHAR uni222F
-ENCODING 8751
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-33
-66
-66
-66
-7E
-E7
-E7
-E7
-E7
-7E
-66
-66
-66
-CC
-00
-00
-ENDCHAR
-STARTCHAR uni2230
-ENCODING 8752
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-2A
-54
-54
-54
-7C
-D6
-D6
-D6
-D6
-7C
-54
-54
-54
-A8
-00
-00
-ENDCHAR
-STARTCHAR uni2231
-ENCODING 8753
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-34
-30
-30
-38
-35
-33
-37
-30
-30
-30
-30
-B0
-60
-00
-00
-ENDCHAR
-STARTCHAR uni2232
-ENCODING 8754
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-1A
-18
-18
-3C
-5A
-FA
-5A
-5A
-3C
-18
-18
-58
-30
-00
-00
-ENDCHAR
-STARTCHAR uni2233
-ENCODING 8755
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-1A
-18
-18
-3C
-5A
-5F
-5A
-5A
-3C
-18
-18
-58
-30
-00
-00
-ENDCHAR
-STARTCHAR therefore
-ENCODING 8756
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2235
-ENCODING 8757
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2236
-ENCODING 8758
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2237
-ENCODING 8759
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-66
-66
-00
-00
-00
-66
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2238
-ENCODING 8760
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-18
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2239
-ENCODING 8761
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-03
-00
-FC
-00
-03
-03
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni223A
-ENCODING 8762
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-66
-66
-00
-7E
-00
-66
-66
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni223B
-ENCODING 8763
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-18
-00
-76
-DC
-00
-30
-30
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR similar
-ENCODING 8764
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-76
-DC
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni223D
-ENCODING 8765
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-DC
-76
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni223E
-ENCODING 8766
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-72
-DB
-DB
-4E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni223F
-ENCODING 8767
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-D8
-DB
-DB
-1B
-0E
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2240
-ENCODING 8768
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-1C
-30
-30
-30
-18
-0C
-0C
-0C
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2241
-ENCODING 8769
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-10
-76
-DC
-10
-20
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2242
-ENCODING 8770
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FE
-00
-76
-DC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2243
-ENCODING 8771
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-DC
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2244
-ENCODING 8772
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-76
-DC
-10
-FE
-20
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR congruent
-ENCODING 8773
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-76
-DC
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2246
-ENCODING 8774
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-76
-DC
-08
-FE
-10
-FE
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2247
-ENCODING 8775
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-08
-76
-DC
-10
-FE
-20
-FE
-40
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR approxequal
-ENCODING 8776
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-76
-DC
-00
-76
-DC
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2249
-ENCODING 8777
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-76
-DC
-10
-76
-DC
-20
-20
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224A
-ENCODING 8778
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-76
-DC
-00
-76
-DC
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224B
-ENCODING 8779
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-76
-DC
-00
-76
-DC
-00
-76
-DC
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224C
-ENCODING 8780
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-DC
-76
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224D
-ENCODING 8781
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C6
-7C
-00
-7C
-C6
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224E
-ENCODING 8782
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-66
-00
-00
-66
-18
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni224F
-ENCODING 8783
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-66
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2250
-ENCODING 8784
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-7E
-00
-00
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2251
-ENCODING 8785
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-7E
-00
-00
-7E
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2252
-ENCODING 8786
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-60
-00
-7E
-00
-00
-7E
-00
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2253
-ENCODING 8787
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-06
-00
-7E
-00
-00
-7E
-00
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2254
-ENCODING 8788
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C0
-DF
-00
-00
-DF
-C0
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2255
-ENCODING 8789
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-FB
-00
-00
-FB
-03
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2256
-ENCODING 8790
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FE
-28
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2257
-ENCODING 8791
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-10
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2258
-ENCODING 8792
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-44
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2259
-ENCODING 8793
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225A
-ENCODING 8794
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-44
-28
-10
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225B
-ENCODING 8795
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-10
-7C
-28
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225C
-ENCODING 8796
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-10
-28
-44
-7C
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225D
-ENCODING 8797
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-26
-7C
-B4
-6C
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225E
-ENCODING 8798
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-68
-54
-54
-00
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni225F
-ENCODING 8799
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-08
-10
-00
-10
-FE
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR notequal
-ENCODING 8800
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-08
-7E
-08
-10
-7E
-10
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR equivalence
-ENCODING 8801
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-00
-00
-FE
-00
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2262
-ENCODING 8802
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-08
-FE
-08
-10
-FE
-10
-20
-FE
-20
-40
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2263
-ENCODING 8803
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-00
-00
-FE
-00
-00
-FE
-00
-00
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lessequal
-ENCODING 8804
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0E
-38
-E0
-38
-0E
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR greaterequal
-ENCODING 8805
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-E0
-38
-0E
-38
-E0
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2266
-ENCODING 8806
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-0E
-38
-E0
-38
-0E
-00
-FE
-00
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2267
-ENCODING 8807
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-E0
-38
-0E
-38
-E0
-00
-FE
-00
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2268
-ENCODING 8808
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-0E
-38
-E0
-38
-0E
-08
-FE
-10
-FE
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2269
-ENCODING 8809
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-E0
-38
-0E
-38
-E0
-08
-FE
-10
-FE
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226A
-ENCODING 8810
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-1B
-36
-6C
-D8
-6C
-36
-1B
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226B
-ENCODING 8811
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-D8
-6C
-36
-1B
-36
-6C
-D8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226C
-ENCODING 8812
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-66
-18
-3C
-66
-66
-66
-66
-3C
-18
-66
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226D
-ENCODING 8813
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-CE
-7C
-10
-7C
-E6
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226E
-ENCODING 8814
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-04
-0E
-38
-E8
-38
-0E
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni226F
-ENCODING 8815
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-E0
-38
-2E
-38
-E0
-40
-40
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2270
-ENCODING 8816
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-04
-0E
-38
-E8
-38
-0E
-10
-FE
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2271
-ENCODING 8817
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-E0
-38
-2E
-38
-E0
-40
-FE
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2272
-ENCODING 8818
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0E
-38
-E0
-38
-0E
-00
-76
-DC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2273
-ENCODING 8819
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-E0
-38
-0E
-38
-E0
-00
-76
-DC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2274
-ENCODING 8820
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-04
-0E
-38
-E8
-38
-0E
-10
-76
-DC
-20
-20
-00
-00
-ENDCHAR
-STARTCHAR uni2275
-ENCODING 8821
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-E0
-38
-2E
-38
-E0
-40
-76
-DC
-80
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2276
-ENCODING 8822
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-38
-E0
-38
-0E
-E0
-38
-0E
-38
-E0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2277
-ENCODING 8823
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-E0
-38
-0E
-38
-E0
-0E
-38
-E0
-38
-0E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2278
-ENCODING 8824
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-0E
-38
-E8
-38
-1E
-F0
-38
-2E
-38
-E0
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2279
-ENCODING 8825
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-E8
-38
-0E
-38
-F0
-1E
-38
-E0
-38
-2E
-20
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227A
-ENCODING 8826
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-02
-06
-1C
-F0
-1C
-06
-02
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227B
-ENCODING 8827
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-80
-C0
-70
-1E
-70
-C0
-80
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227C
-ENCODING 8828
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-02
-06
-1C
-F0
-1C
-06
-F2
-1C
-06
-02
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227D
-ENCODING 8829
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-C0
-70
-1E
-70
-C0
-9E
-70
-C0
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227E
-ENCODING 8830
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-02
-06
-1C
-F0
-1C
-06
-02
-00
-76
-DC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni227F
-ENCODING 8831
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-C0
-70
-1E
-70
-C0
-80
-00
-76
-DC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2280
-ENCODING 8832
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-06
-0C
-38
-E8
-38
-1C
-16
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2281
-ENCODING 8833
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-D0
-70
-38
-2E
-38
-60
-C0
-40
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR propersubset
-ENCODING 8834
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-7E
-C0
-C0
-C0
-C0
-7E
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR propersuperset
-ENCODING 8835
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FC
-06
-06
-06
-06
-FC
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR notsubset
-ENCODING 8836
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-7E
-C8
-C8
-D0
-D0
-7E
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2285
-ENCODING 8837
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-FC
-16
-16
-26
-26
-FC
-40
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR reflexsubset
-ENCODING 8838
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7E
-C0
-C0
-C0
-C0
-7E
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR reflexsuperset
-ENCODING 8839
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FC
-06
-06
-06
-06
-FC
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2288
-ENCODING 8840
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-7E
-C8
-C8
-D0
-D0
-7E
-20
-FE
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2289
-ENCODING 8841
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-FC
-16
-16
-26
-26
-FC
-40
-FE
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228A
-ENCODING 8842
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7E
-C0
-C0
-C0
-C0
-7E
-08
-FE
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228B
-ENCODING 8843
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FC
-06
-06
-06
-06
-FC
-10
-FE
-20
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228C
-ENCODING 8844
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-92
-A2
-FA
-A2
-92
-44
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228D
-ENCODING 8845
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-82
-92
-BA
-BA
-92
-44
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228E
-ENCODING 8846
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-82
-92
-BA
-92
-82
-44
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni228F
-ENCODING 8847
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-C0
-C0
-C0
-C0
-FE
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2290
-ENCODING 8848
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-06
-06
-06
-06
-FE
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2291
-ENCODING 8849
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-C0
-C0
-C0
-C0
-FE
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2292
-ENCODING 8850
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-06
-06
-06
-06
-FE
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2293
-ENCODING 8851
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2294
-ENCODING 8852
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR circleplus
-ENCODING 8853
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-54
-92
-FE
-92
-54
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2296
-ENCODING 8854
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-82
-FE
-82
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR circlemultiply
-ENCODING 8855
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-AA
-92
-AA
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2298
-ENCODING 8856
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-8A
-92
-A2
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2299
-ENCODING 8857
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-92
-BA
-92
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229A
-ENCODING 8858
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-92
-AA
-92
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229B
-ENCODING 8859
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-54
-D6
-BA
-D6
-54
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229C
-ENCODING 8860
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-BA
-82
-BA
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229D
-ENCODING 8861
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-82
-BA
-82
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229E
-ENCODING 8862
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-92
-92
-FE
-92
-92
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni229F
-ENCODING 8863
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-82
-82
-FE
-82
-82
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A0
-ENCODING 8864
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-C6
-AA
-92
-AA
-C6
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A1
-ENCODING 8865
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-82
-92
-BA
-92
-82
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A2
-ENCODING 8866
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C0
-C0
-C0
-FF
-C0
-C0
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A3
-ENCODING 8867
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-03
-03
-03
-03
-FF
-03
-03
-03
-03
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A4
-ENCODING 8868
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-18
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR perpendicular
-ENCODING 8869
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-18
-18
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A6
-ENCODING 8870
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-60
-60
-60
-60
-7E
-60
-60
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A7
-ENCODING 8871
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-60
-60
-60
-7E
-60
-7E
-60
-60
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A8
-ENCODING 8872
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C0
-C0
-FF
-C0
-FF
-C0
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22A9
-ENCODING 8873
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-D8
-D8
-D8
-D8
-DF
-D8
-D8
-D8
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AA
-ENCODING 8874
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-A8
-A8
-A8
-A8
-AF
-A8
-A8
-A8
-A8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AB
-ENCODING 8875
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-D8
-D8
-D8
-DF
-D8
-DF
-D8
-D8
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AC
-ENCODING 8876
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C2
-C4
-C4
-FF
-C8
-C8
-D0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AD
-ENCODING 8877
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-C4
-C4
-FF
-C8
-FF
-D0
-D0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AE
-ENCODING 8878
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-D8
-D9
-DA
-DA
-DF
-DA
-DA
-DC
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22AF
-ENCODING 8879
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-D8
-D9
-DA
-DF
-DA
-DF
-DA
-DC
-D8
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B0
-ENCODING 8880
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-0C
-06
-1C
-F0
-1C
-06
-0C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B1
-ENCODING 8881
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-60
-C0
-70
-1E
-70
-C0
-60
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B2
-ENCODING 8882
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-06
-1E
-76
-C6
-76
-1E
-06
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B3
-ENCODING 8883
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C0
-F0
-DC
-C6
-DC
-F0
-C0
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B4
-ENCODING 8884
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-1E
-76
-C6
-76
-1E
-06
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B5
-ENCODING 8885
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-F0
-DC
-C6
-DC
-F0
-C0
-00
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B6
-ENCODING 8886
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-42
-BF
-42
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B7
-ENCODING 8887
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-42
-FD
-42
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B8
-ENCODING 8888
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-02
-7D
-02
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22B9
-ENCODING 8889
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-10
-00
-C6
-00
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BA
-ENCODING 8890
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-18
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BB
-ENCODING 8891
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C6
-C6
-6C
-6C
-38
-38
-10
-10
-00
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BC
-ENCODING 8892
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BD
-ENCODING 8893
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-00
-C6
-C6
-6C
-6C
-38
-38
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BE
-ENCODING 8894
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-C0
-C0
-C0
-F0
-C8
-C4
-C4
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22BF
-ENCODING 8895
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-03
-07
-0B
-13
-23
-43
-83
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C0
-ENCODING 8896
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-38
-38
-6C
-6C
-C6
-C6
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C1
-ENCODING 8897
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C6
-C6
-6C
-6C
-38
-38
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C2
-ENCODING 8898
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-6C
-C6
-C6
-C6
-C6
-C6
-C6
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C3
-ENCODING 8899
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C6
-C6
-C6
-C6
-C6
-C6
-6C
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C4
-ENCODING 8900
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-38
-6C
-38
-10
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR dotmath
-ENCODING 8901
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-18
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C6
-ENCODING 8902
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-10
-7C
-38
-28
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C7
-ENCODING 8903
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-92
-44
-28
-92
-28
-44
-92
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C8
-ENCODING 8904
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-C6
-AA
-92
-AA
-C6
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22C9
-ENCODING 8905
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-C4
-A8
-90
-A8
-C4
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CA
-ENCODING 8906
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-82
-46
-2A
-12
-2A
-46
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CB
-ENCODING 8907
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-80
-40
-20
-10
-28
-44
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CC
-ENCODING 8908
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-02
-04
-08
-10
-28
-44
-82
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CD
-ENCODING 8909
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-DC
-76
-00
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CE
-ENCODING 8910
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-10
-38
-38
-6C
-6C
-C6
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22CF
-ENCODING 8911
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C6
-6C
-6C
-38
-38
-10
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D0
-ENCODING 8912
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-3E
-60
-CE
-D8
-D8
-CE
-60
-3E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D1
-ENCODING 8913
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-F8
-0C
-E6
-36
-36
-E6
-0C
-F8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D2
-ENCODING 8914
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-44
-92
-AA
-AA
-AA
-AA
-AA
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D3
-ENCODING 8915
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-AA
-AA
-AA
-AA
-AA
-92
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D4
-ENCODING 8916
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-10
-38
-54
-92
-92
-92
-92
-92
-92
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D5
-ENCODING 8917
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-7E
-18
-18
-7E
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D6
-ENCODING 8918
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-30
-64
-CE
-64
-30
-18
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D7
-ENCODING 8919
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-30
-18
-4C
-E6
-4C
-18
-30
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D8
-ENCODING 8920
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-15
-2A
-54
-A8
-54
-2A
-15
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22D9
-ENCODING 8921
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-A8
-54
-2A
-15
-2A
-54
-A8
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22DA
-ENCODING 8922
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-0E
-38
-E0
-38
-0E
-00
-FE
-00
-E0
-38
-0E
-38
-E0
-00
-00
-ENDCHAR
-STARTCHAR uni22DB
-ENCODING 8923
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-38
-0E
-38
-E0
-00
-FE
-00
-0E
-38
-E0
-38
-0E
-00
-00
-ENDCHAR
-STARTCHAR uni22DC
-ENCODING 8924
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-00
-0E
-38
-E0
-38
-0E
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22DD
-ENCODING 8925
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-00
-E0
-38
-0E
-38
-E0
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22DE
-ENCODING 8926
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-02
-06
-1C
-F2
-06
-1C
-F0
-1C
-06
-02
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22DF
-ENCODING 8927
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-C0
-70
-9E
-C0
-70
-1E
-70
-C0
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E0
-ENCODING 8928
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0A
-0E
-1C
-F0
-1C
-16
-F2
-1C
-26
-22
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E1
-ENCODING 8929
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-88
-C8
-70
-1E
-70
-D0
-9E
-70
-E0
-A0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E2
-ENCODING 8930
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-FE
-C8
-C8
-D0
-D0
-FE
-20
-FE
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E3
-ENCODING 8931
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-FE
-16
-16
-26
-26
-FE
-40
-FE
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E4
-ENCODING 8932
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-C0
-C0
-C0
-C0
-FE
-08
-FE
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E5
-ENCODING 8933
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-06
-06
-06
-06
-FE
-10
-FE
-20
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E6
-ENCODING 8934
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0E
-38
-E0
-38
-0E
-10
-76
-DC
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E7
-ENCODING 8935
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-E0
-38
-0E
-38
-E0
-10
-76
-DC
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E8
-ENCODING 8936
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-02
-06
-1C
-F0
-1C
-06
-02
-10
-76
-DC
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22E9
-ENCODING 8937
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-80
-C0
-70
-1E
-70
-C0
-80
-10
-76
-DC
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22EA
-ENCODING 8938
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-0E
-1E
-76
-D6
-76
-1E
-26
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22EB
-ENCODING 8939
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-C8
-F0
-DC
-D6
-DC
-F0
-E0
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22EC
-ENCODING 8940
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-0E
-1E
-76
-D6
-76
-1E
-26
-20
-FE
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22ED
-ENCODING 8941
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-C8
-F0
-DC
-D6
-DC
-F0
-E0
-20
-FE
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22EE
-ENCODING 8942
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-00
-00
-18
-18
-00
-00
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22EF
-ENCODING 8943
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-DB
-DB
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22F0
-ENCODING 8944
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-03
-03
-00
-00
-18
-18
-00
-00
-C0
-C0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni22F1
-ENCODING 8945
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-00
-00
-18
-18
-00
-00
-03
-03
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR emptyset
-ENCODING 8960
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-3D
-66
-C7
-CB
-D3
-E3
-66
-BC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR house
-ENCODING 8962
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-38
-6C
-C6
-C6
-C6
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2308
-ENCODING 8968
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2309
-ENCODING 8969
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni230A
-ENCODING 8970
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni230B
-ENCODING 8971
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR revlogicalnot
-ENCODING 8976
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FE
-C0
-C0
-C0
-C0
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2318
-ENCODING 8984
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-42
-A5
-7E
-24
-24
-7E
-A5
-42
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR circleplus
-ENCODING 8986
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-38
-54
-8A
-F6
-82
-54
-38
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H
-ENCODING 8987
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-FE
-FE
-44
-44
-28
-10
-28
-44
-44
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR integraltp
-ENCODING 8992
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0E
-1B
-1B
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR integralbt
-ENCODING 8993
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-D8
-D8
-D8
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR angleleft
-ENCODING 9001
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-18
-18
-30
-30
-60
-60
-30
-30
-18
-18
-0C
-0C
-00
-00
-ENDCHAR
-STARTCHAR angleright
-ENCODING 9002
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-60
-30
-30
-18
-18
-0C
-0C
-18
-18
-30
-30
-60
-60
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9115
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-03
-06
-0C
-0C
-18
-18
-18
-30
-30
-30
-30
-30
-30
-30
-30
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9116
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9117
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-30
-30
-30
-30
-30
-18
-18
-18
-0C
-0C
-06
-03
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9118
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-C0
-60
-30
-30
-18
-18
-18
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9119
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9120
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-18
-18
-18
-30
-30
-60
-C0
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9121
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-3F
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9122
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9123
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-30
-3F
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9124
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-FC
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9125
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9126
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-0C
-FC
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9127
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-07
-0C
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9128
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-30
-E0
-30
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9129
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-0C
-07
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9130
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9131
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-E0
-30
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9132
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-0C
-07
-0C
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9133
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-30
-E0
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9134
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9135
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9136
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-07
-0C
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-30
-E0
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9137
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-E0
-30
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-0C
-07
-ENDCHAR
-STARTCHAR summation
-ENCODING 9138
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-C1
-C0
-60
-60
-60
-60
-30
-30
-30
-30
-18
-18
-18
-ENDCHAR
-STARTCHAR summation
-ENCODING 9139
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-30
-30
-30
-30
-60
-60
-60
-60
-C0
-C1
-FF
-00
-00
-ENDCHAR
-STARTCHAR uni2423
-ENCODING 9140
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-C3
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2423
-ENCODING 9141
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-C3
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2423
-ENCODING 9142
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-C3
-FF
-00
-FF
-C3
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9143
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-D8
-D8
-78
-78
-38
-38
-18
-18
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9144
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9145
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-03
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9146
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9147
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9148
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9149
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR carriagereturn
-ENCODING 9166
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-07
-05
-05
-05
-05
-25
-79
-C2
-7C
-20
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2409
-ENCODING 9225
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D8
-D8
-F8
-D8
-D8
-0F
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni240A
-ENCODING 9226
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-C0
-F0
-0F
-0C
-0E
-0C
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni240B
-ENCODING 9227
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D8
-D8
-F8
-70
-20
-0F
-06
-06
-06
-06
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni240C
-ENCODING 9228
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F0
-C0
-E0
-C0
-C0
-0F
-0C
-0E
-0C
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni240D
-ENCODING 9229
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-C0
-C0
-C0
-70
-1E
-1B
-1E
-1B
-1B
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2423
-ENCODING 9251
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2424
-ENCODING 9252
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-98
-D8
-F8
-D8
-D8
-0C
-0C
-0C
-0C
-0F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR question
-ENCODING 9254
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7C
-FE
-C6
-C6
-60
-30
-30
-00
-30
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF100000
-ENCODING 9472
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2501
-ENCODING 9473
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF110000
-ENCODING 9474
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2503
-ENCODING 9475
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2504
-ENCODING 9476
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-6D
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2505
-ENCODING 9477
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-6D
-6D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2506
-ENCODING 9478
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-00
-18
-18
-18
-18
-18
-00
-18
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR uni2507
-ENCODING 9479
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-00
-1C
-1C
-1C
-1C
-1C
-00
-1C
-1C
-1C
-1C
-00
-ENDCHAR
-STARTCHAR uni2508
-ENCODING 9480
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-AA
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2509
-ENCODING 9481
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-AA
-AA
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni250A
-ENCODING 9482
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-00
-18
-18
-18
-00
-18
-18
-18
-00
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR uni250B
-ENCODING 9483
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-00
-1C
-1C
-1C
-00
-1C
-1C
-1C
-00
-1C
-1C
-1C
-00
-ENDCHAR
-STARTCHAR SF010000
-ENCODING 9484
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni250D
-ENCODING 9485
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni250E
-ENCODING 9486
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni250F
-ENCODING 9487
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR SF030000
-ENCODING 9488
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-F8
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2511
-ENCODING 9489
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-F8
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2512
-ENCODING 9490
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2513
-ENCODING 9491
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FC
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR SF020000
-ENCODING 9492
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2515
-ENCODING 9493
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2516
-ENCODING 9494
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2517
-ENCODING 9495
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF040000
-ENCODING 9496
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-F8
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2519
-ENCODING 9497
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-F8
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni251A
-ENCODING 9498
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni251B
-ENCODING 9499
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF080000
-ENCODING 9500
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni251D
-ENCODING 9501
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni251E
-ENCODING 9502
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni251F
-ENCODING 9503
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2520
-ENCODING 9504
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2521
-ENCODING 9505
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2522
-ENCODING 9506
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1F
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2523
-ENCODING 9507
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1F
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR SF090000
-ENCODING 9508
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-F8
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2525
-ENCODING 9509
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-F8
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2526
-ENCODING 9510
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2527
-ENCODING 9511
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2528
-ENCODING 9512
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2529
-ENCODING 9513
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-FC
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni252A
-ENCODING 9514
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FC
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni252B
-ENCODING 9515
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FC
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR SF060000
-ENCODING 9516
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni252D
-ENCODING 9517
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni252E
-ENCODING 9518
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni252F
-ENCODING 9519
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2530
-ENCODING 9520
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2531
-ENCODING 9521
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2532
-ENCODING 9522
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2533
-ENCODING 9523
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR SF070000
-ENCODING 9524
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2535
-ENCODING 9525
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2536
-ENCODING 9526
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2537
-ENCODING 9527
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2538
-ENCODING 9528
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2539
-ENCODING 9529
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni253A
-ENCODING 9530
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni253B
-ENCODING 9531
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF050000
-ENCODING 9532
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni253D
-ENCODING 9533
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni253E
-ENCODING 9534
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni253F
-ENCODING 9535
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-FF
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2540
-ENCODING 9536
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2541
-ENCODING 9537
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2542
-ENCODING 9538
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2543
-ENCODING 9539
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FC
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2544
-ENCODING 9540
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2545
-ENCODING 9541
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2546
-ENCODING 9542
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2547
-ENCODING 9543
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FF
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2548
-ENCODING 9544
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-FF
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni2549
-ENCODING 9545
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FC
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni254A
-ENCODING 9546
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-1F
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni254B
-ENCODING 9547
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-FF
-FF
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni254C
-ENCODING 9548
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-EE
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni254D
-ENCODING 9549
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-EE
-EE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni254E
-ENCODING 9550
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-00
-18
-18
-18
-18
-18
-18
-18
-00
-ENDCHAR
-STARTCHAR uni254F
-ENCODING 9551
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-00
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-00
-ENDCHAR
-STARTCHAR SF430000
-ENCODING 9552
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FF
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF240000
-ENCODING 9553
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF510000
-ENCODING 9554
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-1F
-18
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF520000
-ENCODING 9555
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-3F
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF390000
-ENCODING 9556
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-3F
-30
-37
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF220000
-ENCODING 9557
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-F8
-18
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF210000
-ENCODING 9558
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FE
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF250000
-ENCODING 9559
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FE
-06
-F6
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF500000
-ENCODING 9560
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-1F
-18
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF490000
-ENCODING 9561
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-3F
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF380000
-ENCODING 9562
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-37
-30
-3F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF280000
-ENCODING 9563
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-F8
-18
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF270000
-ENCODING 9564
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-FE
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF260000
-ENCODING 9565
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-F6
-06
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF360000
-ENCODING 9566
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-1F
-18
-1F
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF370000
-ENCODING 9567
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-37
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF420000
-ENCODING 9568
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-37
-30
-37
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF190000
-ENCODING 9569
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-F8
-18
-F8
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF200000
-ENCODING 9570
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-F6
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF230000
-ENCODING 9571
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-F6
-06
-F6
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF470000
-ENCODING 9572
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FF
-00
-FF
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF480000
-ENCODING 9573
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF410000
-ENCODING 9574
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FF
-00
-F7
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF450000
-ENCODING 9575
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-FF
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF460000
-ENCODING 9576
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF400000
-ENCODING 9577
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-F7
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR SF540000
-ENCODING 9578
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-FF
-18
-FF
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR SF530000
-ENCODING 9579
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-36
-FF
-36
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR SF440000
-ENCODING 9580
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-36
-36
-36
-36
-36
-36
-F7
-00
-F7
-36
-36
-36
-36
-36
-36
-36
-ENDCHAR
-STARTCHAR uni256D
-ENCODING 9581
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-03
-0E
-0C
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni256E
-ENCODING 9582
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-C0
-70
-30
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni256F
-ENCODING 9583
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-30
-70
-C0
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2570
-ENCODING 9584
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-0C
-0E
-03
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2571
-ENCODING 9585
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-01
-01
-02
-02
-04
-04
-08
-08
-10
-10
-20
-20
-40
-40
-80
-80
-ENDCHAR
-STARTCHAR uni2572
-ENCODING 9586
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-80
-80
-40
-40
-20
-20
-10
-10
-08
-08
-04
-04
-02
-02
-01
-01
-ENDCHAR
-STARTCHAR uni2573
-ENCODING 9587
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-81
-81
-42
-42
-24
-24
-18
-18
-18
-18
-24
-24
-42
-42
-81
-81
-ENDCHAR
-STARTCHAR uni2574
-ENCODING 9588
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-F8
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2575
-ENCODING 9589
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-18
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2576
-ENCODING 9590
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2577
-ENCODING 9591
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-18
-18
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR uni2578
-ENCODING 9592
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FC
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2579
-ENCODING 9593
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni257A
-ENCODING 9594
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1F
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni257B
-ENCODING 9595
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni257C
-ENCODING 9596
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-1F
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni257D
-ENCODING 9597
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-18
-18
-18
-18
-18
-18
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-ENDCHAR
-STARTCHAR uni257E
-ENCODING 9598
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FF
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni257F
-ENCODING 9599
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-1C
-18
-18
-18
-18
-18
-18
-18
-ENDCHAR
-STARTCHAR upblock
-ENCODING 9600
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2581
-ENCODING 9601
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-ENDCHAR
-STARTCHAR uni2582
-ENCODING 9602
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni2583
-ENCODING 9603
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR dnblock
-ENCODING 9604
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni2585
-ENCODING 9605
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni2586
-ENCODING 9606
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni2587
-ENCODING 9607
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR block
-ENCODING 9608
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni2589
-ENCODING 9609
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-ENDCHAR
-STARTCHAR uni258A
-ENCODING 9610
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-FC
-ENDCHAR
-STARTCHAR uni258B
-ENCODING 9611
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-F8
-ENDCHAR
-STARTCHAR lfblock
-ENCODING 9612
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-F0
-ENDCHAR
-STARTCHAR uni258D
-ENCODING 9613
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-E0
-ENDCHAR
-STARTCHAR uni258E
-ENCODING 9614
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-C0
-ENDCHAR
-STARTCHAR uni258F
-ENCODING 9615
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR rtblock
-ENCODING 9616
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-0F
-ENDCHAR
-STARTCHAR ltshade
-ENCODING 9617
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-11
-44
-11
-44
-11
-44
-11
-44
-11
-44
-11
-44
-11
-44
-11
-44
-ENDCHAR
-STARTCHAR shade
-ENCODING 9618
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-55
-AA
-55
-AA
-55
-AA
-55
-AA
-55
-AA
-55
-AA
-55
-AA
-55
-AA
-ENDCHAR
-STARTCHAR dkshade
-ENCODING 9619
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-DD
-77
-DD
-77
-DD
-77
-DD
-77
-DD
-77
-DD
-77
-DD
-77
-DD
-77
-ENDCHAR
-STARTCHAR uni2594
-ENCODING 9620
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2595
-ENCODING 9621
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-01
-ENDCHAR
-STARTCHAR filledbox
-ENCODING 9632
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H22073
-ENCODING 9633
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-82
-82
-82
-82
-82
-82
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A2
-ENCODING 9634
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-7C
-82
-82
-82
-82
-82
-82
-82
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A3
-ENCODING 9635
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-82
-BA
-BA
-BA
-BA
-BA
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A4
-ENCODING 9636
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-82
-FE
-82
-FE
-82
-FE
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A5
-ENCODING 9637
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-AA
-AA
-AA
-AA
-AA
-AA
-AA
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A6
-ENCODING 9638
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-AA
-FE
-AA
-FE
-AA
-FE
-AA
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A7
-ENCODING 9639
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-8A
-C6
-A2
-92
-8A
-C6
-A2
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A8
-ENCODING 9640
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-A2
-C6
-8A
-92
-A2
-C6
-8A
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25A9
-ENCODING 9641
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-AA
-C6
-AA
-92
-AA
-C6
-AA
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H18543
-ENCODING 9642
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7C
-7C
-7C
-7C
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H18551
-ENCODING 9643
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7C
-44
-44
-44
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR filledrect
-ENCODING 9644
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FE
-FE
-FE
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25AD
-ENCODING 9645
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-FE
-82
-82
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25AE
-ENCODING 9646
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-FE
-00
-00
-ENDCHAR
-STARTCHAR uni25AF
-ENCODING 9647
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-82
-82
-82
-82
-82
-82
-82
-82
-82
-82
-FE
-00
-00
-ENDCHAR
-STARTCHAR uni25B0
-ENCODING 9648
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-7E
-7E
-7E
-FC
-FC
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B1
-ENCODING 9649
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-7E
-42
-42
-84
-84
-FC
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR triagup
-ENCODING 9650
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-38
-38
-7C
-7C
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B3
-ENCODING 9651
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-28
-28
-44
-44
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B4
-ENCODING 9652
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-10
-38
-38
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B5
-ENCODING 9653
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-10
-28
-28
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B6
-ENCODING 9654
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-80
-C0
-E0
-F0
-F8
-FC
-F8
-F0
-E0
-C0
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B7
-ENCODING 9655
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-80
-C0
-A0
-90
-88
-84
-88
-90
-A0
-C0
-80
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B8
-ENCODING 9656
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-40
-70
-78
-70
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25B9
-ENCODING 9657
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-40
-70
-48
-70
-40
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR triagrt
-ENCODING 9658
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-80
-E0
-F8
-FE
-F8
-E0
-80
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25BB
-ENCODING 9659
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-80
-E0
-98
-86
-98
-E0
-80
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR triagdn
-ENCODING 9660
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-7C
-7C
-38
-38
-10
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25BD
-ENCODING 9661
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-82
-44
-44
-28
-28
-10
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25BE
-ENCODING 9662
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-7C
-38
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25BF
-ENCODING 9663
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-7C
-28
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C0
-ENCODING 9664
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-02
-06
-0E
-1E
-3E
-7E
-3E
-1E
-0E
-06
-02
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C1
-ENCODING 9665
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-02
-06
-0A
-12
-22
-42
-22
-12
-0A
-06
-02
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C2
-ENCODING 9666
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-08
-38
-78
-38
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C3
-ENCODING 9667
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-08
-38
-48
-38
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR triaglf
-ENCODING 9668
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-02
-0E
-3E
-FE
-3E
-0E
-02
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C5
-ENCODING 9669
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-02
-0E
-32
-C2
-32
-0E
-02
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C6
-ENCODING 9670
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-38
-7C
-7C
-FE
-FE
-7C
-7C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C7
-ENCODING 9671
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-44
-82
-82
-44
-44
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C8
-ENCODING 9672
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-44
-54
-BA
-BA
-54
-44
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25C9
-ENCODING 9673
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-99
-BD
-BD
-BD
-BD
-99
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR lozenge
-ENCODING 9674
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-28
-28
-44
-82
-82
-44
-28
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR circle
-ENCODING 9675
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-81
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25CC
-ENCODING 9676
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-14
-40
-01
-80
-01
-80
-01
-80
-02
-28
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25CD
-ENCODING 9677
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-A5
-A5
-A5
-A5
-A5
-A5
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25CE
-ENCODING 9678
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-99
-A5
-A5
-A5
-A5
-99
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR H18533
-ENCODING 9679
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-7E
-FF
-FF
-FF
-FF
-FF
-FF
-7E
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D0
-ENCODING 9680
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-72
-F1
-F1
-F1
-F1
-F1
-F1
-72
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D1
-ENCODING 9681
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-4E
-8F
-8F
-8F
-8F
-8F
-8F
-4E
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D2
-ENCODING 9682
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-81
-FF
-FF
-FF
-7E
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D3
-ENCODING 9683
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-7E
-FF
-FF
-FF
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D4
-ENCODING 9684
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-4E
-8F
-8F
-8F
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D5
-ENCODING 9685
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-4E
-8F
-8F
-8F
-FF
-FF
-FF
-7E
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D6
-ENCODING 9686
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-70
-F0
-F0
-F0
-F0
-F0
-F0
-70
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25D7
-ENCODING 9687
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-0E
-0F
-0F
-0F
-0F
-0F
-0F
-0E
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR invbullet
-ENCODING 9688
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-FF
-FF
-FF
-FF
-E7
-C3
-C3
-E7
-FF
-FF
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR invcircle
-ENCODING 9689
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-C3
-BD
-7E
-7E
-7E
-7E
-7E
-7E
-BD
-C3
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni25DA
-ENCODING 9690
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-C3
-BD
-7E
-7E
-7E
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25DB
-ENCODING 9691
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-7E
-7E
-7E
-BD
-C3
-FF
-FF
-FF
-FF
-ENDCHAR
-STARTCHAR uni25DC
-ENCODING 9692
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-40
-80
-80
-80
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25DD
-ENCODING 9693
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0C
-02
-01
-01
-01
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25DE
-ENCODING 9694
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-01
-01
-01
-02
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25DF
-ENCODING 9695
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-80
-80
-80
-40
-30
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E0
-ENCODING 9696
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-81
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E1
-ENCODING 9697
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E2
-ENCODING 9698
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-01
-01
-03
-03
-07
-07
-0F
-0F
-1F
-1F
-3F
-3F
-7F
-7F
-FF
-FF
-ENDCHAR
-STARTCHAR uni25E3
-ENCODING 9699
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-80
-80
-C0
-C0
-E0
-E0
-F0
-F0
-F8
-F8
-FC
-FC
-FE
-FE
-FF
-FF
-ENDCHAR
-STARTCHAR uni25E4
-ENCODING 9700
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-FE
-FE
-FC
-FC
-F8
-F8
-F0
-F0
-E0
-E0
-C0
-C0
-80
-80
-ENDCHAR
-STARTCHAR uni25E5
-ENCODING 9701
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-FF
-FF
-7F
-7F
-3F
-3F
-1F
-1F
-0F
-0F
-07
-07
-03
-03
-01
-01
-ENDCHAR
-STARTCHAR openbullet
-ENCODING 9702
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-3C
-66
-42
-42
-66
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E7
-ENCODING 9703
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-F1
-F1
-F1
-F1
-F1
-F1
-F1
-F1
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E8
-ENCODING 9704
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-8F
-8F
-8F
-8F
-8F
-8F
-8F
-8F
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25E9
-ENCODING 9705
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-FF
-FD
-F9
-F1
-F1
-E1
-C1
-81
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25EA
-ENCODING 9706
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-81
-83
-87
-8F
-8F
-9F
-BF
-FF
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25EB
-ENCODING 9707
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FF
-99
-99
-99
-99
-99
-99
-99
-99
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25EC
-ENCODING 9708
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-28
-28
-44
-44
-92
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25ED
-ENCODING 9709
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-38
-38
-74
-74
-F2
-F2
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25EE
-ENCODING 9710
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-38
-38
-5C
-5C
-9E
-9E
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25EF
-ENCODING 9711
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-81
-81
-81
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F0
-ENCODING 9712
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-92
-92
-92
-F2
-82
-82
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F1
-ENCODING 9713
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-82
-82
-82
-F2
-92
-92
-92
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F2
-ENCODING 9714
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-82
-82
-82
-9E
-92
-92
-92
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F3
-ENCODING 9715
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-FE
-92
-92
-92
-9E
-82
-82
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F4
-ENCODING 9716
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-4A
-89
-89
-89
-F9
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F5
-ENCODING 9717
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-F9
-89
-89
-89
-4A
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F6
-ENCODING 9718
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-81
-9F
-91
-91
-91
-52
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni25F7
-ENCODING 9719
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-52
-91
-91
-91
-9F
-81
-81
-42
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2600
-ENCODING 9728
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-54
-38
-FE
-38
-54
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2602
-ENCODING 9729
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-30
-7C
-FE
-FF
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2601
-ENCODING 9730
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-7C
-FE
-10
-10
-10
-10
-14
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2605
-ENCODING 9733
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-38
-FE
-7C
-38
-6C
-44
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2606
-ENCODING 9734
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-28
-EE
-44
-54
-6C
-44
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2607
-ENCODING 9735
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-18
-30
-60
-C0
-60
-34
-1C
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2608
-ENCODING 9736
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-C6
-CC
-D8
-F0
-D8
-CD
-C7
-CF
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2609
-ENCODING 9737
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-38
-44
-82
-92
-82
-44
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni260A
-ENCODING 9738
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-42
-42
-42
-A5
-A5
-42
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni260B
-ENCODING 9739
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-42
-A5
-A5
-42
-42
-42
-24
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni260C
-ENCODING 9740
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-06
-0C
-78
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni260D
-ENCODING 9741
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-36
-36
-1C
-18
-30
-70
-D8
-D8
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2610
-ENCODING 9744
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-82
-82
-82
-82
-82
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2611
-ENCODING 9745
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-82
-86
-8A
-BA
-92
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2612
-ENCODING 9746
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-FE
-82
-EE
-BA
-BA
-EE
-82
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2613
-ENCODING 9747
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-82
-C6
-6C
-7C
-38
-7C
-6C
-C6
-82
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2620
-ENCODING 9760
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-7C
-82
-AA
-82
-44
-7C
-44
-38
-00
-44
-C6
-38
-C6
-44
-00
-ENDCHAR
-STARTCHAR uni2622
-ENCODING 9762
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-44
-EE
-FE
-92
-BA
-7C
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2626
-ENCODING 9766
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-7E
-18
-18
-FF
-18
-1E
-78
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2628
-ENCODING 9768
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-7E
-18
-18
-FF
-18
-18
-18
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2629
-ENCODING 9769
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-38
-10
-10
-92
-FE
-92
-10
-10
-38
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni262A
-ENCODING 9770
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-72
-E0
-C4
-DF
-CE
-CA
-E0
-72
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni262B
-ENCODING 9771
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-54
-28
-54
-AA
-AA
-AA
-AA
-54
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni262E
-ENCODING 9774
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-5A
-99
-99
-99
-BD
-FF
-DB
-5A
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni262F
-ENCODING 9775
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-42
-81
-85
-B1
-F9
-FF
-DF
-7E
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2630
-ENCODING 9776
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-00
-00
-FE
-FE
-00
-00
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2631
-ENCODING 9777
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-EE
-00
-00
-FE
-FE
-00
-00
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2632
-ENCODING 9778
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-00
-00
-EE
-EE
-00
-00
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2633
-ENCODING 9779
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-EE
-00
-00
-EE
-EE
-00
-00
-FE
-FE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2634
-ENCODING 9780
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-00
-00
-FE
-FE
-00
-00
-EE
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2635
-ENCODING 9781
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-EE
-00
-00
-FE
-FE
-00
-00
-EE
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2636
-ENCODING 9782
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-FE
-FE
-00
-00
-EE
-EE
-00
-00
-EE
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2637
-ENCODING 9783
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-EE
-EE
-00
-00
-EE
-EE
-00
-00
-EE
-EE
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2639
-ENCODING 9785
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-81
-A5
-81
-81
-81
-99
-A5
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR smileface
-ENCODING 9786
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-81
-A5
-81
-81
-A5
-99
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR invsmileface
-ENCODING 9787
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-FF
-DB
-FF
-FF
-DB
-E7
-FF
-FF
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR sun
-ENCODING 9788
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-54
-28
-C6
-28
-54
-10
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni263D
-ENCODING 9789
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-78
-14
-0A
-0A
-0A
-0A
-0A
-0A
-14
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni263E
-ENCODING 9790
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-28
-50
-50
-50
-50
-50
-50
-28
-1E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni263F
-ENCODING 9791
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-66
-66
-3C
-66
-66
-66
-66
-3C
-18
-7E
-18
-18
-00
-00
-00
-ENDCHAR
-STARTCHAR female
-ENCODING 9792
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-3C
-18
-7E
-18
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2641
-ENCODING 9793
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-7E
-18
-3C
-66
-66
-66
-66
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR male
-ENCODING 9794
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-06
-0E
-1A
-78
-CC
-CC
-CC
-CC
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2643
-ENCODING 9795
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-03
-03
-7B
-CF
-CF
-CF
-0F
-1B
-33
-FF
-03
-03
-03
-00
-00
-ENDCHAR
-STARTCHAR uni2644
-ENCODING 9796
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-60
-F0
-60
-6E
-73
-63
-63
-66
-66
-63
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2645
-ENCODING 9797
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-D6
-54
-54
-7C
-54
-54
-D6
-38
-44
-44
-38
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2646
-ENCODING 9798
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-3C
-DB
-DB
-DB
-DB
-7E
-3C
-18
-3C
-18
-18
-00
-00
-ENDCHAR
-STARTCHAR uni2647
-ENCODING 9799
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-F8
-CC
-CC
-CC
-CC
-F8
-C0
-C0
-C0
-C0
-FE
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2648
-ENCODING 9800
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-42
-A5
-A5
-3C
-3C
-18
-18
-18
-18
-18
-18
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2649
-ENCODING 9801
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-C3
-66
-66
-66
-66
-3C
-66
-66
-66
-66
-3C
-00
-00
-ENDCHAR
-STARTCHAR uni264A
-ENCODING 9802
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C3
-7E
-66
-66
-66
-66
-66
-66
-7E
-C3
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni264B
-ENCODING 9803
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7E
-DB
-D8
-70
-00
-00
-0E
-1B
-DB
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni264C
-ENCODING 9804
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1E
-33
-33
-33
-33
-1B
-7B
-DB
-DB
-73
-03
-01
-00
-00
-ENDCHAR
-STARTCHAR uni264D
-ENCODING 9805
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-94
-7C
-55
-57
-55
-55
-55
-55
-55
-55
-06
-0B
-00
-00
-ENDCHAR
-STARTCHAR uni264E
-ENCODING 9806
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-66
-66
-66
-66
-24
-E7
-00
-FF
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni264F
-ENCODING 9807
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-94
-7C
-54
-54
-54
-54
-54
-54
-54
-54
-04
-03
-00
-00
-ENDCHAR
-STARTCHAR uni2650
-ENCODING 9808
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1F
-07
-8F
-DB
-73
-70
-D8
-88
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2651
-ENCODING 9809
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-90
-50
-70
-68
-48
-48
-4E
-49
-09
-0E
-10
-20
-00
-00
-ENDCHAR
-STARTCHAR uni2652
-ENCODING 9810
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-2A
-7E
-AA
-00
-00
-2A
-7E
-AA
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2653
-ENCODING 9811
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C3
-66
-66
-66
-66
-FF
-66
-66
-66
-66
-C3
-00
-00
-00
-ENDCHAR
-STARTCHAR spade
-ENCODING 9824
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-3C
-7E
-FF
-FF
-7E
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2661
-ENCODING 9825
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-6C
-92
-82
-82
-82
-44
-28
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2662
-ENCODING 9826
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-28
-44
-82
-44
-28
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR club
-ENCODING 9827
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-3C
-3C
-E7
-E7
-E7
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2664
-ENCODING 9828
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-24
-42
-81
-81
-66
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR heart
-ENCODING 9829
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-6C
-FE
-FE
-FE
-FE
-7C
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR diamond
-ENCODING 9830
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-38
-7C
-FE
-7C
-38
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2667
-ENCODING 9831
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-18
-24
-3C
-E7
-A5
-E7
-18
-18
-3C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni2669
-ENCODING 9833
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-18
-18
-18
-18
-18
-18
-18
-38
-78
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR musicalnote
-ENCODING 9834
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-30
-3C
-3E
-32
-30
-30
-30
-70
-F0
-E0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR musicalnotedbl
-ENCODING 9835
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-7F
-6F
-63
-63
-63
-63
-E3
-E7
-C7
-06
-00
-00
-00
-ENDCHAR
-STARTCHAR uni266C
-ENCODING 9836
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-7F
-63
-7F
-63
-63
-63
-63
-63
-E7
-E7
-C6
-00
-00
-00
-ENDCHAR
-STARTCHAR uni266D
-ENCODING 9837
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-C0
-C0
-C0
-C0
-CC
-DE
-E6
-C4
-D8
-E0
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uni266E
-ENCODING 9838
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-40
-40
-44
-5C
-74
-44
-44
-5C
-74
-44
-04
-04
-00
-00
-ENDCHAR
-STARTCHAR uni266F
-ENCODING 9839
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-04
-46
-5C
-74
-C4
-46
-5C
-74
-C4
-40
-40
-00
-00
-ENDCHAR
-STARTCHAR ff
-ENCODING 64256
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3B
-66
-66
-66
-FF
-66
-66
-66
-66
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR fi
-ENCODING 64257
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3C
-6E
-66
-60
-FE
-66
-66
-66
-66
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR fl
-ENCODING 64258
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-3E
-6E
-66
-66
-FE
-66
-66
-66
-66
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ffi
-ENCODING 64259
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6E
-DB
-DB
-D8
-FF
-DB
-DB
-DB
-DB
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR ffl
-ENCODING 64260
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-6F
-DB
-DB
-DB
-FF
-DB
-DB
-DB
-DB
-FF
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB05
-ENCODING 64261
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-38
-6C
-6C
-6F
-6C
-6C
-6C
-6C
-6D
-F6
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB50
-ENCODING 64336
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-29
-5E
-00
-04
-04
-04
-04
-04
-04
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB51
-ENCODING 64337
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-29
-5E
-00
-04
-04
-04
-04
-04
-03
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB52
-ENCODING 64338
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB53
-ENCODING 64339
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-80
-81
-7E
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB54
-ENCODING 64340
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB55
-ENCODING 64341
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB56
-ENCODING 64342
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB57
-ENCODING 64343
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-80
-81
-7E
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB58
-ENCODING 64344
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB59
-ENCODING 64345
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5A
-ENCODING 64346
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-14
-00
-14
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5B
-ENCODING 64347
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-80
-81
-7E
-00
-14
-00
-14
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5C
-ENCODING 64348
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-14
-00
-14
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5D
-ENCODING 64349
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-14
-00
-14
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5E
-ENCODING 64350
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-08
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB5F
-ENCODING 64351
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-08
-00
-40
-80
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB60
-ENCODING 64352
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-08
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB61
-ENCODING 64353
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-08
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB62
-ENCODING 64354
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-14
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB63
-ENCODING 64355
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-14
-00
-40
-80
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB64
-ENCODING 64356
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-14
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB65
-ENCODING 64357
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-14
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB66
-ENCODING 64358
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB67
-ENCODING 64359
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-40
-80
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB68
-ENCODING 64360
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB69
-ENCODING 64361
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6A
-ENCODING 64362
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-0A
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6B
-ENCODING 64363
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-00
-0A
-00
-06
-49
-89
-86
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6C
-ENCODING 64364
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-0C
-12
-0A
-06
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6D
-ENCODING 64365
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-0C
-12
-12
-0C
-F3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6E
-ENCODING 64366
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0A
-00
-0A
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB6F
-ENCODING 64367
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0A
-00
-0A
-00
-06
-49
-89
-86
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB70
-ENCODING 64368
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-00
-14
-00
-0C
-12
-0A
-06
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB71
-ENCODING 64369
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-14
-00
-14
-00
-0C
-12
-12
-0C
-F3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB72
-ENCODING 64370
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-88
-80
-88
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB73
-ENCODING 64371
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-88
-80
-88
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFB74
-ENCODING 64372
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-04
-00
-04
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB75
-ENCODING 64373
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB76
-ENCODING 64374
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-94
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB77
-ENCODING 64375
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-80
-94
-80
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFB78
-ENCODING 64376
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-00
-0A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB79
-ENCODING 64377
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB7A
-ENCODING 64378
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-94
-80
-88
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB7B
-ENCODING 64379
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-94
-80
-88
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFB7C
-ENCODING 64380
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-0A
-00
-04
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB7D
-ENCODING 64381
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-14
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB7E
-ENCODING 64382
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-94
-80
-94
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB7F
-ENCODING 64383
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-94
-80
-94
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFB80
-ENCODING 64384
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-0A
-00
-0A
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB81
-ENCODING 64385
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-14
-00
-14
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB82
-ENCODING 64386
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB83
-ENCODING 64387
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-08
-04
-46
-39
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB84
-ENCODING 64388
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-28
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB85
-ENCODING 64389
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-28
-00
-08
-08
-04
-46
-39
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB86
-ENCODING 64390
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-00
-28
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB87
-ENCODING 64391
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-00
-28
-00
-08
-08
-04
-46
-39
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB88
-ENCODING 64392
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-38
-28
-70
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB89
-ENCODING 64393
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-38
-28
-70
-08
-08
-04
-46
-39
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8A
-ENCODING 64394
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-00
-14
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8B
-ENCODING 64395
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-14
-00
-00
-04
-07
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8C
-ENCODING 64396
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8D
-ENCODING 64397
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-00
-00
-04
-07
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8E
-ENCODING 64398
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-01
-02
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB8F
-ENCODING 64399
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-01
-02
-04
-08
-48
-84
-82
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB90
-ENCODING 64400
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-18
-20
-10
-08
-08
-F0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB91
-ENCODING 64401
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-18
-20
-20
-10
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB92
-ENCODING 64402
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB93
-ENCODING 64403
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-48
-84
-82
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB94
-ENCODING 64404
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-46
-18
-20
-10
-08
-08
-F0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB95
-ENCODING 64405
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-46
-18
-20
-20
-10
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB96
-ENCODING 64406
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-10
-00
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB97
-ENCODING 64407
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-09
-12
-04
-08
-48
-84
-82
-7D
-00
-10
-00
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB98
-ENCODING 64408
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-46
-18
-20
-10
-08
-08
-F0
-00
-10
-00
-10
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB99
-ENCODING 64409
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-46
-18
-20
-20
-10
-08
-F7
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9A
-ENCODING 64410
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-A4
-09
-12
-04
-08
-44
-82
-82
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9B
-ENCODING 64411
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-A4
-09
-12
-04
-08
-48
-84
-82
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9C
-ENCODING 64412
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-A2
-0C
-13
-0C
-10
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9D
-ENCODING 64413
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-A2
-0C
-13
-0C
-10
-10
-08
-04
-FB
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9E
-ENCODING 64414
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFB9F
-ENCODING 64415
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-01
-41
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA0
-ENCODING 64416
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA1
-ENCODING 64417
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-00
-00
-01
-41
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA2
-ENCODING 64418
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA3
-ENCODING 64419
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-1C
-14
-38
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA4
-ENCODING 64420
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-38
-40
-38
-40
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA5
-ENCODING 64421
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-70
-80
-70
-80
-10
-68
-88
-74
-03
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA6
-ENCODING 64422
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA7
-ENCODING 64423
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-0C
-13
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA8
-ENCODING 64424
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-10
-F0
-10
-14
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBA9
-ENCODING 64425
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-10
-F7
-08
-08
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAA
-ENCODING 64426
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-4C
-52
-32
-3D
-40
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAB
-ENCODING 64427
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-4C
-52
-32
-3D
-40
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAC
-ENCODING 64428
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-4C
-52
-32
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAD
-ENCODING 64429
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-38
-4C
-52
-32
-FD
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAE
-ENCODING 64430
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-14
-60
-80
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBAF
-ENCODING 64431
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-07
-18
-20
-3F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBB0
-ENCODING 64432
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-70
-80
-70
-80
-08
-14
-60
-80
-FE
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBB1
-ENCODING 64433
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-1C
-20
-1C
-20
-00
-00
-07
-18
-20
-3F
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD3
-ENCODING 64467
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-00
-29
-01
-19
-21
-19
-A1
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD4
-ENCODING 64468
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-00
-2A
-02
-32
-42
-32
-C6
-79
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD5
-ENCODING 64469
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-40
-00
-A3
-0C
-10
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD6
-ENCODING 64470
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-40
-00
-A3
-0C
-10
-10
-08
-04
-FB
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD7
-ENCODING 64471
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-18
-10
-20
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD8
-ENCODING 64472
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-18
-10
-20
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBD9
-ENCODING 64473
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-08
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDA
-ENCODING 64474
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-08
-00
-00
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDB
-ENCODING 64475
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-08
-08
-08
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDC
-ENCODING 64476
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-08
-08
-08
-00
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDD
-ENCODING 64477
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-23
-54
-33
-24
-40
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDE
-ENCODING 64478
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBDF
-ENCODING 64479
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-14
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE0
-ENCODING 64480
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-0E
-02
-3C
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE1
-ENCODING 64481
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-08
-00
-00
-00
-0C
-12
-0F
-02
-3C
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE2
-ENCODING 64482
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-14
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE3
-ENCODING 64483
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-14
-00
-00
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE4
-ENCODING 64484
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-10
-00
-10
-ENDCHAR
-STARTCHAR uniFBE5
-ENCODING 64485
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-07
-88
-87
-81
-7E
-10
-00
-10
-ENDCHAR
-STARTCHAR uniFBE6
-ENCODING 64486
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE7
-ENCODING 64487
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-08
-00
-08
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE8
-ENCODING 64488
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBE9
-ENCODING 64489
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBFC
-ENCODING 64508
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-82
-7C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBFD
-ENCODING 64509
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-07
-88
-87
-81
-7E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBFE
-ENCODING 64510
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFBFF
-ENCODING 64511
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC5B
-ENCODING 64603
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-20
-20
-20
-20
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC5C
-ENCODING 64604
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-10
-10
-10
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC5D
-ENCODING 64605
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-10
-10
-10
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC5E
-ENCODING 64606
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-98
-60
-C2
-12
-92
-9C
-60
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC5F
-ENCODING 64607
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-92
-9C
-60
-0E
-70
-0E
-70
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC60
-ENCODING 64608
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-60
-04
-54
-58
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC61
-ENCODING 64609
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-10
-60
-04
-54
-58
-20
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC62
-ENCODING 64610
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-04
-54
-58
-20
-0C
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC63
-ENCODING 64611
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-10
-04
-54
-58
-20
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFC90
-ENCODING 64656
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-10
-10
-10
-00
-00
-00
-00
-07
-88
-87
-81
-7E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFCF2
-ENCODING 64754
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0E
-F0
-02
-92
-9C
-60
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFCF3
-ENCODING 64755
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-18
-60
-02
-92
-9C
-60
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFCF4
-ENCODING 64756
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-12
-9C
-60
-0E
-70
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFD3C
-ENCODING 64828
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-10
-28
-50
-28
-08
-08
-08
-08
-07
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFD3D
-ENCODING 64829
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-14
-28
-14
-04
-04
-04
-04
-04
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFD3E
-ENCODING 64830
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-08
-10
-54
-38
-54
-10
-08
-04
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFD3F
-ENCODING 64831
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-10
-08
-2A
-1C
-2A
-08
-10
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFDF2
-ENCODING 65010
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-2A
-14
-00
-21
-69
-A9
-69
-16
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE50
-ENCODING 65104
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-08
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE51
-ENCODING 65105
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE52
-ENCODING 65106
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-10
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE54
-ENCODING 65108
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-00
-00
-08
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE55
-ENCODING 65109
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-10
-00
-00
-10
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE56
-ENCODING 65110
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-24
-08
-10
-00
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE57
-ENCODING 65111
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-10
-10
-10
-00
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE58
-ENCODING 65112
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE59
-ENCODING 65113
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-10
-10
-10
-10
-10
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5A
-ENCODING 65114
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-08
-08
-08
-08
-08
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5B
-ENCODING 65115
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-10
-10
-20
-10
-10
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5C
-ENCODING 65116
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-08
-08
-04
-08
-08
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5D
-ENCODING 65117
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-10
-10
-10
-10
-10
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5E
-ENCODING 65118
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-18
-08
-08
-08
-08
-08
-18
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE5F
-ENCODING 65119
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-28
-7C
-28
-7C
-28
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE60
-ENCODING 65120
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-28
-28
-10
-2A
-24
-1A
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE61
-ENCODING 65121
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-10
-10
-7C
-38
-38
-44
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE62
-ENCODING 65122
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-10
-10
-7C
-10
-10
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE63
-ENCODING 65123
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE64
-ENCODING 65124
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-10
-20
-10
-08
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE65
-ENCODING 65125
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-20
-10
-08
-10
-20
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE66
-ENCODING 65126
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-3C
-00
-3C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE68
-ENCODING 65128
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-20
-10
-10
-08
-08
-04
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE69
-ENCODING 65129
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-10
-38
-54
-30
-18
-54
-38
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE6A
-ENCODING 65130
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-24
-08
-08
-10
-10
-24
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE6B
-ENCODING 65131
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-44
-54
-58
-40
-38
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE70
-ENCODING 65136
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-0C
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE71
-ENCODING 65137
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-06
-18
-60
-06
-18
-60
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE72
-ENCODING 65138
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-12
-CA
-2C
-70
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE74
-ENCODING 65140
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-30
-0C
-30
-00
-00
-ENDCHAR
-STARTCHAR uniFE76
-ENCODING 65142
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-30
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE77
-ENCODING 65143
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-06
-18
-60
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE78
-ENCODING 65144
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-08
-14
-0C
-08
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE79
-ENCODING 65145
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-14
-18
-60
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE7A
-ENCODING 65146
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-0C
-30
-00
-00
-ENDCHAR
-STARTCHAR uniFE7B
-ENCODING 65147
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-FF
-00
-00
-06
-18
-60
-00
-00
-ENDCHAR
-STARTCHAR uniFE7C
-ENCODING 65148
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0A
-2A
-2C
-10
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE7D
-ENCODING 65149
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-12
-92
-9C
-60
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE7E
-ENCODING 65150
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-18
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE7F
-ENCODING 65151
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-24
-24
-18
-00
-00
-00
-00
-FF
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE80
-ENCODING 65152
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-20
-1E
-20
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE81
-ENCODING 65153
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-02
-3C
-40
-10
-10
-10
-10
-10
-10
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE82
-ENCODING 65154
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-01
-3E
-40
-08
-08
-08
-08
-08
-07
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE83
-ENCODING 65155
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-18
-20
-1C
-20
-08
-08
-08
-08
-08
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE84
-ENCODING 65156
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-0C
-10
-0E
-10
-04
-04
-04
-04
-03
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE85
-ENCODING 65157
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-20
-1C
-20
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE86
-ENCODING 65158
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-20
-1C
-20
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE87
-ENCODING 65159
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-04
-04
-04
-04
-04
-00
-0C
-10
-0E
-10
-00
-00
-ENDCHAR
-STARTCHAR uniFE88
-ENCODING 65160
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-04
-04
-04
-04
-03
-00
-0C
-10
-0E
-10
-00
-00
-ENDCHAR
-STARTCHAR uniFE89
-ENCODING 65161
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-40
-38
-40
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8A
-ENCODING 65162
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-30
-40
-38
-40
-00
-00
-00
-07
-88
-87
-81
-7E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8B
-ENCODING 65163
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-20
-1C
-20
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8C
-ENCODING 65164
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-1C
-20
-1C
-20
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8D
-ENCODING 65165
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-08
-08
-08
-08
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8E
-ENCODING 65166
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-08
-08
-08
-08
-07
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE8F
-ENCODING 65167
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-81
-81
-7E
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE90
-ENCODING 65168
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-40
-80
-81
-7E
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE91
-ENCODING 65169
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-00
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE92
-ENCODING 65170
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE93
-ENCODING 65171
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-28
-00
-00
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE94
-ENCODING 65172
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-50
-00
-10
-10
-68
-88
-74
-03
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE95
-ENCODING 65173
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-14
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE96
-ENCODING 65174
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-14
-00
-40
-80
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE97
-ENCODING 65175
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-14
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE98
-ENCODING 65176
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-14
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE99
-ENCODING 65177
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-40
-81
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE9A
-ENCODING 65178
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-40
-80
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE9B
-ENCODING 65179
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE9C
-ENCODING 65180
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE9D
-ENCODING 65181
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-88
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFE9E
-ENCODING 65182
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-80
-88
-80
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFE9F
-ENCODING 65183
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-00
-10
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA0
-ENCODING 65184
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-00
-08
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA1
-ENCODING 65185
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA2
-ENCODING 65186
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-41
-80
-80
-80
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFEA3
-ENCODING 65187
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-38
-47
-18
-E0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA4
-ENCODING 65188
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-70
-8F
-32
-C1
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA5
-ENCODING 65189
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-20
-00
-00
-70
-8F
-30
-40
-80
-80
-80
-41
-3E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA6
-ENCODING 65190
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-00
-00
-70
-8F
-32
-41
-80
-80
-80
-40
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFEA7
-ENCODING 65191
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-00
-38
-47
-18
-E0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA8
-ENCODING 65192
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-00
-70
-8F
-32
-C1
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEA9
-ENCODING 65193
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAA
-ENCODING 65194
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-08
-04
-46
-39
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAB
-ENCODING 65195
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-08
-04
-02
-42
-3C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAC
-ENCODING 65196
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-08
-08
-04
-46
-39
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAD
-ENCODING 65197
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAE
-ENCODING 65198
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-04
-07
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEAF
-ENCODING 65199
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-04
-02
-02
-04
-18
-60
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB0
-ENCODING 65200
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-00
-00
-04
-07
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB1
-ENCODING 65201
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB2
-ENCODING 65202
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB3
-ENCODING 65203
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-01
-15
-EA
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB4
-ENCODING 65204
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-2A
-D5
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB5
-ENCODING 65205
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB6
-ENCODING 65206
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-14
-00
-01
-15
-88
-84
-84
-78
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB7
-ENCODING 65207
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-04
-00
-0A
-00
-00
-01
-15
-EA
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB8
-ENCODING 65208
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-14
-00
-00
-00
-2A
-D5
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEB9
-ENCODING 65209
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBA
-ENCODING 65210
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBB
-ENCODING 65211
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-06
-29
-31
-DE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBC
-ENCODING 65212
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-06
-29
-31
-DE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBD
-ENCODING 65213
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBE
-ENCODING 65214
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-04
-00
-06
-09
-31
-9E
-88
-88
-70
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEBF
-ENCODING 65215
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-00
-06
-29
-31
-DE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC0
-ENCODING 65216
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-00
-06
-29
-31
-DE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC1
-ENCODING 65217
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-20
-20
-2C
-32
-A2
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC2
-ENCODING 65218
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-20
-20
-2C
-32
-A2
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC3
-ENCODING 65219
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-20
-20
-2C
-32
-22
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC4
-ENCODING 65220
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-20
-20
-20
-2C
-32
-22
-FD
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC5
-ENCODING 65221
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-20
-20
-2C
-32
-A2
-7C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC6
-ENCODING 65222
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-20
-20
-2C
-32
-A2
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC7
-ENCODING 65223
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-20
-20
-2C
-32
-22
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC8
-ENCODING 65224
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-24
-20
-20
-2C
-32
-22
-FD
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEC9
-ENCODING 65225
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-70
-80
-8C
-70
-40
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFECA
-ENCODING 65226
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-1E
-22
-1C
-22
-41
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFECB
-ENCODING 65227
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0E
-10
-10
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFECC
-ENCODING 65228
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-1E
-22
-1C
-E3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFECD
-ENCODING 65229
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-40
-00
-00
-70
-80
-8C
-70
-40
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFECE
-ENCODING 65230
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-08
-00
-00
-1E
-22
-1C
-22
-41
-80
-80
-80
-41
-3E
-00
-00
-ENDCHAR
-STARTCHAR uniFECF
-ENCODING 65231
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-10
-00
-00
-0E
-10
-10
-FE
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED0
-ENCODING 65232
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-1E
-22
-1C
-E3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED1
-ENCODING 65233
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-49
-85
-83
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED2
-ENCODING 65234
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-04
-00
-06
-49
-89
-86
-7D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED3
-ENCODING 65235
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-0C
-12
-0A
-06
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED4
-ENCODING 65236
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-0C
-12
-12
-0C
-F3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED5
-ENCODING 65237
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0A
-00
-06
-09
-09
-47
-81
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED6
-ENCODING 65238
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-0A
-00
-00
-06
-09
-49
-87
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED7
-ENCODING 65239
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-00
-0C
-12
-0A
-06
-FC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED8
-ENCODING 65240
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-14
-00
-00
-0C
-12
-12
-0C
-F3
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFED9
-ENCODING 65241
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-19
-21
-19
-21
-01
-81
-7E
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEDA
-ENCODING 65242
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-32
-42
-32
-42
-02
-86
-79
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEDB
-ENCODING 65243
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-18
-20
-10
-08
-08
-F0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEDC
-ENCODING 65244
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-06
-18
-20
-20
-10
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEDD
-ENCODING 65245
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-02
-02
-02
-02
-02
-42
-82
-82
-84
-78
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEDE
-ENCODING 65246
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-02
-02
-02
-02
-02
-03
-42
-82
-82
-84
-78
-00
-00
-ENDCHAR
-STARTCHAR uniFEDF
-ENCODING 65247
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-08
-08
-08
-08
-08
-F0
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE0
-ENCODING 65248
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-08
-08
-08
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE1
-ENCODING 65249
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-0C
-12
-12
-3C
-40
-40
-40
-40
-40
-40
-00
-00
-ENDCHAR
-STARTCHAR uniFEE2
-ENCODING 65250
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-3C
-4B
-4A
-44
-40
-40
-40
-00
-00
-ENDCHAR
-STARTCHAR uniFEE3
-ENCODING 65251
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-32
-CC
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE4
-ENCODING 65252
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-32
-CD
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE5
-ENCODING 65253
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-08
-00
-00
-41
-81
-81
-81
-42
-3C
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE6
-ENCODING 65254
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-01
-41
-81
-81
-42
-3C
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE7
-ENCODING 65255
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-00
-08
-04
-04
-F8
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE8
-ENCODING 65256
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-08
-00
-00
-08
-08
-F7
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEE9
-ENCODING 65257
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-18
-24
-22
-22
-1C
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEEA
-ENCODING 65258
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-10
-10
-68
-88
-74
-03
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEEB
-ENCODING 65259
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-40
-30
-4E
-49
-39
-E6
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEEC
-ENCODING 65260
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-08
-14
-24
-28
-F3
-24
-18
-0C
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEED
-ENCODING 65261
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-0C
-12
-0E
-02
-04
-18
-60
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEEE
-ENCODING 65262
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-0C
-12
-0F
-02
-04
-18
-60
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEEF
-ENCODING 65263
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF0
-ENCODING 65264
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-07
-88
-87
-81
-7E
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF1
-ENCODING 65265
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-07
-08
-88
-86
-81
-81
-7E
-00
-00
-24
-00
-ENDCHAR
-STARTCHAR uniFEF2
-ENCODING 65266
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-00
-00
-07
-88
-87
-81
-7E
-00
-24
-00
-ENDCHAR
-STARTCHAR uniFEF3
-ENCODING 65267
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-08
-04
-04
-F8
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF4
-ENCODING 65268
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-00
-00
-00
-00
-08
-08
-F7
-00
-00
-14
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF5
-ENCODING 65269
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-68
-90
-02
-22
-12
-0A
-04
-0C
-12
-3C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF6
-ENCODING 65270
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-68
-90
-02
-32
-12
-0A
-0A
-0E
-3D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF7
-ENCODING 65271
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-60
-80
-72
-A2
-12
-0A
-04
-0C
-12
-3C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF8
-ENCODING 65272
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-30
-40
-3A
-52
-12
-0A
-0A
-0E
-3D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEF9
-ENCODING 65273
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-42
-22
-12
-0A
-04
-0C
-12
-3C
-00
-18
-20
-1C
-20
-00
-ENDCHAR
-STARTCHAR uniFEFA
-ENCODING 65274
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-22
-12
-12
-0A
-0A
-0E
-3D
-00
-00
-18
-20
-1C
-20
-00
-ENDCHAR
-STARTCHAR uniFEFB
-ENCODING 65275
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-42
-22
-12
-0A
-04
-0C
-12
-3C
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEFC
-ENCODING 65276
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-00
-22
-12
-12
-0A
-0A
-0E
-3D
-00
-00
-00
-00
-00
-00
-00
-ENDCHAR
-STARTCHAR uniFEFF
-ENCODING 65279
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-F1
-35
-55
-8A
-E0
-06
-95
-D6
-B5
-97
-00
-EE
-8A
-EE
-28
-E8
-ENDCHAR
-STARTCHAR uniFFFD
-ENCODING 65533
-SWIDTH 480 0
-DWIDTH 8 0
-BBX 8 16 0 -4
-BITMAP
-00
-38
-7C
-7C
-C6
-92
-F2
-E6
-FE
-E6
-7C
-7C
-38
-00
-00
-00
-ENDCHAR
-ENDFONT
Index: ntrib/tools/gen_vga323.c
===================================================================
--- contrib/tools/gen_vga323.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2008 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-
-#define RED(i)    (((i) >> 5) & ((1 << 3) - 1))
-#define GREEN(i)  (((i) >> 3) & ((1 << 2) - 1))
-#define BLUE(i)   ((i) & ((1 << 3) - 1))
-
-int main(int argc, char *argv[])
-{
-	unsigned int i;
-
-	for (i = 0; i < 256; i++)
-		printf("\t.byte 0x%02x, 0x%02x, 0x%02x, 0x00\n", BLUE(i) * 9, GREEN(i) * 21, RED(i) * 9);
-
-	return 0;
-}
Index: ntrib/tools/random_check.sh
===================================================================
--- contrib/tools/random_check.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2014 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-LOOPS=1
-JOBS=1
-MAX_RETRIES=20
-FILENAME_PREFIX=random_run_
-PRUNE_CONFIG_FILE=${FILENAME_PREFIX}prune.config
-
-echo -n "">"$PRUNE_CONFIG_FILE"
-
-while getopts n:j:x:hs option; do
-	case $option in
-	n)
-		LOOPS="$OPTARG"
-		;;
-	j)
-		JOBS="$OPTARG"
-		;;
-	x)
-		echo "$OPTARG" | tr -d ' ' >>"$PRUNE_CONFIG_FILE"
-		;;
-	s)
-		;;
-	*|h)
-		echo "Usage: $0 [options]"
-		echo "where [options] could be:"
-		echo
-		echo "  -n LOOPS"
-		echo "      How many configurations to check."
-		echo "      (Default is one configuration.)"
-		echo "  -j PARALLELISM"
-		echo "      How many parallel jobs to execute by 'make'."
-		echo "      (Default is single job configuration.)"
-		echo "  -s"
-		echo "      Use only supported compilers."
-		echo "      (That is, only GCC cross-compiler and Clang.)"
-		echo "  -x CONFIG_OPTION=value"
-		echo "      Skip the configuration if this option is present."
-		echo "      (Example: CONFIG_BINUTILS=n means that only configurations"
-		echo "      where binutils *are* included would be built.)"
-		echo "  -h"
-		echo "      Print this help and exit."
-		echo
-		if [ "$option" = "h" ]; then
-			exit 0
-		else
-			exit 1
-		fi
-		;;
-	esac
-done
-
-
-COUNTER=0
-FAILED=0
-while [ $COUNTER -lt $LOOPS ]; do
-	COUNTER=$(( $COUNTER + 1 ))
-	echo "Try #$COUNTER ($FAILED failed):" >&2
-
-	(
-		echo "  Cleaning after previous build." >&2
-		make distclean -j$JOBS 2>&1 || exit 1
-
-
-		echo "  Preparing random configuration." >&2
-		# It would be nicer to allow set the constraints directly to
-		# the tools/config.py script but this usually works.
-		# We retry $MAX_RETRIES before aborting this run completely.
-		RETRIES=0
-		while true; do
-			RETRIES=$(( $RETRIES + 1 ))
-			if [ $RETRIES -ge $MAX_RETRIES ]; then
-				echo "  Failed to generate random configuration with given constraints after $RETRIES tries." >&2
-				exit 2
-			fi
-
-			make random-config 2>&1 || exit 1
-
-			tr -d ' ' <Makefile.config >"${FILENAME_PREFIX}config.trimmed"
-
-			THIS_CONFIG_OKAY=true
-			while read pattern; do
-				if grep -q -e "$pattern" "${FILENAME_PREFIX}config.trimmed"; then
-					THIS_CONFIG_OKAY=false
-					break
-				fi
-			done <"$PRUNE_CONFIG_FILE"
-
-			rm -f "${FILENAME_PREFIX}config.trimmed"
-
-			if $THIS_CONFIG_OKAY; then
-				break
-			fi
-		done
-
-
-		# Report basic info about the configuration and build it
-		BASIC_CONFIG=`sed -n \
-			-e 's#PLATFORM = \(.*\)#\1#p' \
-			-e 's#MACHINE = \(.*\)#\1#p' \
-			-e 's#COMPILER = \(.*\)#\1#p' \
-			Makefile.config \
-			| paste '-sd,' | sed 's#,#, #g'`
-		echo -n "  Building ($BASIC_CONFIG)... " >&2
-
-		make -j$JOBS 2>&1
-		if [ $? -eq 0 ]; then
-			echo "okay." >&2
-			exit 0
-		else
-			echo "failed." >&2
-			exit 1
-		fi
-
-	) >random_run_$COUNTER.log
-	RC=$?
-
-	if [ $RC -ne 0 ]; then
-		tail -n 10 random_run_$COUNTER.log | sed 's#.*#    | &#'
-		FAILED=$(( $FAILED + 1 ))
-	fi
-
-	if [ -e Makefile.config ]; then
-		cp Makefile.config "$FILENAME_PREFIX$COUNTER.Makefile.config"
-		cp config.h "$FILENAME_PREFIX$COUNTER.config.h"
-	fi
-done
-
-rm "$PRUNE_CONFIG_FILE"
-
-echo "Out of $LOOPS tries, $FAILED configurations failed to compile." >&2
Index: ntrib/tools/toolchain_check.sh
===================================================================
--- contrib/tools/toolchain_check.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#!/bin/sh
-
-[ -z "$CROSS_HELENOS_PREFIX" ] && CROSS_HELENOS_PREFIX="/usr/local/cross-helenos"
-
-get_define() {
-	echo "$2" | "$1" -E -P -
-}
-
-print_error() {
-	echo "  ERROR:" "$@"
-}
-
-check_define() {
-	def_value=`get_define "$1" "$2"`
-	if [ "$def_value" = "$3" ]; then
-		return 0
-	else
-		print_error "Macro $1 not defined (expected '$3', got '$def_value')."
-		return 1
-	fi
-}
-
-print_version() {
-	if [ -x "$1" ]; then
-		echo " " `$1 --version 2>/dev/null | head -n 1` "@ $1"
-	else
-		print_error "$2";
-		return 1
-	fi
-}
-
-for arch_path in "$CROSS_HELENOS_PREFIX"/*; do
-	arch=`echo "$arch_path" | sed -e 's#/$##' -e 's#.*/\([^/]*\)#\1#'`
-	echo "Checking $arch..."
-
-	gcc_path=`echo "$arch_path"/bin/*-gcc`
-	ld_path=`echo "$arch_path"/bin/*-ld`
-	objcopy_path=`echo "$arch_path"/bin/*-objcopy`
-	gdb_path=`echo "$arch_path"/bin/*-gdb`
-
-	print_version "$ld_path" "Linker not found!" || continue
-
-	print_version "$objcopy_path" "objcopy not found!" || continue
-
-	print_version "$gcc_path" "GCC not found!" || continue
-	check_define "$gcc_path" "__helenos__" 1 || continue
-	check_define "$gcc_path" "helenos_uarch" "$arch" || continue
-
-	print_version "$gdb_path" "GDB not found!" || continue
-done
Index: faults/amd64/Makefile.config
===================================================================
--- defaults/amd64/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-# Platform
-PLATFORM = amd64
-
-# Kernel memory model
-MEMORY_MODEL = kernel
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# PC keyboard support
-CONFIG_PC_KBD = y
-
-# EGA support
-CONFIG_EGA = y
-
-# Framebuffer support
-CONFIG_FB = y
-
-# Default framebuffer mode
-CONFIG_BFB_MODE = 1024x768
-
-# Default framebuffer depth
-CONFIG_BFB_BPP = 16
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# Include userspace unit tests (PCUT)
-CONFIG_PCUT_TESTS = y
-
-# Include development files (headers, libraries)
-CONFIG_DEVEL_FILES = y
-
-# OHCI root hub power switch, ganged is enough
-OHCI_POWER_SWITCH = ganged
-
-# GRUB boot loader architecture
-GRUB_ARCH = pc
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/amd64/output
===================================================================
--- defaults/amd64/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.iso
Index: faults/arm32/Makefile.config
===================================================================
--- defaults/arm32/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-# Platform
-PLATFORM = arm32
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# What is your input device?
-CONFIG_HID_IN = generic
-
-# What is your output device?
-CONFIG_HID_OUT = generic
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/arm32/beagleboardxm/Makefile.config
===================================================================
--- defaults/arm32/beagleboardxm/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# Machine type
-MACHINE = beagleboardxm
-
-# RAM disk format
-RDFMT = ext4fs
-
-#framebuffer
-CONFIG_FB = y
-
-CONFIG_BFB_MODE = 1024x768
-CONFIG_BFB_BPP = 24
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
Index: faults/arm32/beaglebone/Makefile.config
===================================================================
--- defaults/arm32/beaglebone/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-# Machine type
-MACHINE = beaglebone
-
-# RAM disk format
-RDFMT = ext4fs
-
-#framebuffer
-CONFIG_FB = n
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
Index: faults/arm32/gta02/Makefile.config
===================================================================
--- defaults/arm32/gta02/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-# Machine type
-MACHINE = gta02
-
-# RAM disk format
-RDFMT = ext4fs
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
-
-# Don't compress bootimage
-CONFIG_COMPRESSED_INIT = n
Index: faults/arm32/integratorcp/Makefile.config
===================================================================
--- defaults/arm32/integratorcp/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-# Machine type
-MACHINE = integratorcp
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
-
Index: faults/arm32/output
===================================================================
--- defaults/arm32/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.boot
Index: faults/arm32/raspberrypi/Makefile.config
===================================================================
--- defaults/arm32/raspberrypi/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,12 +1,0 @@
-# Machine type
-MACHINE = raspberrypi
-
-# RAM disk format
-RDFMT = fat
-
-#framebuffer
-CONFIG_FB = n
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
-
Index: faults/arm64/Makefile.config
===================================================================
--- defaults/arm64/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-# Platform
-PLATFORM = arm64
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/arm64/hikey960/Makefile.config
===================================================================
--- defaults/arm64/hikey960/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# Machine type
-MACHINE = hikey960
Index: faults/arm64/hikey960/output
===================================================================
--- defaults/arm64/hikey960/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.boot
Index: faults/arm64/virt/Makefile.config
===================================================================
--- defaults/arm64/virt/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# Machine type
-MACHINE = virt
Index: faults/arm64/virt/output
===================================================================
--- defaults/arm64/virt/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.iso
Index: faults/ia32/Makefile.config
===================================================================
--- defaults/ia32/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-# Platform
-PLATFORM = ia32
-
-# CPU type
-PROCESSOR = pentium4
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# ACPI support
-CONFIG_ACPI = y
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# PC keyboard support
-CONFIG_PC_KBD = y
-
-# EGA support
-CONFIG_EGA = y
-
-# Framebuffer support
-CONFIG_FB = y
-
-# Default framebuffer mode
-CONFIG_BFB_MODE = 1024x768
-
-# Default framebuffer depth
-CONFIG_BFB_BPP = 16
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# Include userspace unit tests (PCUT)
-CONFIG_PCUT_TESTS = y
-
-# Include development files (headers, libraries)
-CONFIG_DEVEL_FILES = y
-
-# OHCI root hub power switch, ganged is enough
-OHCI_POWER_SWITCH = ganged
-
-# GRUB boot loader architecture
-GRUB_ARCH = pc
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/ia32/output
===================================================================
--- defaults/ia32/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.iso
Index: faults/ia64/Makefile.config
===================================================================
--- defaults/ia64/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-# Platform
-PLATFORM = ia64
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = y
-
-# Use VHPT
-CONFIG_VHPT = n
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# Optimization level
-OPTIMIZATION = 2
Index: faults/ia64/i460GX/Makefile.config
===================================================================
--- defaults/ia64/i460GX/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-# Machine type
-MACHINE = i460GX
-
Index: faults/ia64/output
===================================================================
--- defaults/ia64/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.boot
Index: faults/ia64/ski/Makefile.config
===================================================================
--- defaults/ia64/ski/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-# Machine type
-MACHINE = ski
-
-# Don't compress bootimage
-CONFIG_COMPRESSED_INIT = n
Index: faults/mips32/Makefile.config
===================================================================
--- defaults/mips32/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-# Platform
-PLATFORM = mips32
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/mips32/malta-be/Makefile.config
===================================================================
--- defaults/mips32/malta-be/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# Machine type
-MACHINE = bmalta
Index: faults/mips32/malta-le/Makefile.config
===================================================================
--- defaults/mips32/malta-le/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# Machine type
-MACHINE = lmalta
Index: faults/mips32/msim/Makefile.config
===================================================================
--- defaults/mips32/msim/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-# Machine type
-MACHINE = msim
Index: faults/mips32/output
===================================================================
--- defaults/mips32/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.boot
Index: faults/ppc32/Makefile.config
===================================================================
--- defaults/ppc32/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-# Platform
-PLATFORM = ppc32
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = n
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# Framebuffer support
-CONFIG_FB = y
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# OHCI root hub power switch, ganged is enough
-OHCI_POWER_SWITCH = ganged
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/ppc32/output
===================================================================
--- defaults/ppc32/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.iso
Index: faults/riscv64/Makefile.config
===================================================================
--- defaults/riscv64/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-# Platform
-PLATFORM = riscv64
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# What is your input device?
-CONFIG_HID_IN = generic
-
-# What is your output device?
-CONFIG_HID_OUT = generic
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/sparc64/Makefile.config
===================================================================
--- defaults/sparc64/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-# Platform
-PLATFORM = sparc64
-
-# Ramdisk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Deadlock detection support for spinlocks
-CONFIG_DEBUG_SPINLOCK = y
-
-# Lazy FPU context switching
-CONFIG_FPU_LAZY = y
-
-# Use TSB
-CONFIG_TSB = y
-
-# Virtually indexed D-cache support
-CONFIG_VIRT_IDX_DCACHE = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Input device class
-CONFIG_HID_IN = generic
-
-# Output device class
-CONFIG_HID_OUT = generic
-
-# Start AP processors by the loader
-CONFIG_AP = y
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/sparc64/niagara/Makefile.config
===================================================================
--- defaults/sparc64/niagara/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,26 +1,0 @@
-# Machine type
-MACHINE = generic
-
-# CPU type
-PROCESSOR = sun4v
-
-# Quad Floats
-QUADFLOAT = hard
-
-# Support for SMP
-CONFIG_SMP = n
-
-# Framebuffer support
-CONFIG_FB = n
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
Index: faults/sparc64/output
===================================================================
--- defaults/sparc64/output	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-image.iso
Index: faults/sparc64/ultra/Makefile.config
===================================================================
--- defaults/sparc64/ultra/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,20 +1,0 @@
-# Machine type
-MACHINE = generic
-
-# CPU type
-PROCESSOR = us
-
-# Quad Floats
-QUADFLOAT = hard
-
-# Dynamic linking support
-CONFIG_RTLD = y
-
-# Build shared libraries
-CONFIG_BUILD_SHARED_LIBS = y
-
-# Link against shared libraries
-CONFIG_USE_SHARED_LIBS = y
-
-# Barebone build with essential binaries only
-CONFIG_BAREBONE = y
Index: faults/special/Makefile.config
===================================================================
--- defaults/special/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-# RAM disk format
-RDFMT = ext4fs
-
-# Compiler
-COMPILER = gcc_cross
-
-# In case compiler is clang, whether or not to use its integrated assembler.
-INTEGRATED_AS = default
-
-# Support for SMP
-CONFIG_SMP = y
-
-# Debug build
-CONFIG_DEBUG = y
-
-# Support for userspace debuggers
-CONFIG_UDEBUG = y
-
-# Kernel console support
-CONFIG_KCONSOLE = y
-
-# Kernel symbol information
-CONFIG_SYMTAB = y
-
-# Detailed kernel logging
-CONFIG_LOG = n
-
-# Kernel function tracing
-CONFIG_TRACE = n
-
-# Compile kernel tests
-CONFIG_TEST = y
-
-# Optimization level
-OPTIMIZATION = 3
Index: faults/special/abs32le/Makefile.config
===================================================================
--- defaults/special/abs32le/Makefile.config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-# Platform
-PLATFORM = abs32le
-
-# Cross-compiler target
-CROSS_TARGET = ia32
Index: doc/TODO
===================================================================
--- doc/TODO	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ doc/TODO	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,22 @@
++ implement true memory management
+  + [ia32] use int 0x15 ax=0xe820 to get memory map and memory size
+  + [mips] use some heuristics to get memory map and memory size
+  + reimplement heap so that it can allocate/deallocate itself frames as necessary
+  + provide native four-level portable page table interface
+    + every architecture uses its native page table format
+    + kernel provides unified four-level page table interface for all architectures
+  + track usage of frames containing middle-level page tables (frame leak)
+
++ get user mode support for all architectures
+
++ when a new thread enters scheduler, at least one CPU in
+  cpu_sleep() should be woken up by an IPI
++ save/restore floating point context on context switch 
+  + [ia32] lazy context switch using TS flag
++ [ia32] review privilege separation
+  + zero IOPL in EFLAGS
+  + before IRET (from SYSCALL), zero NT in EFLAGS
++ [ia32] review the cache controling bits in CR0 register
++ [ia32] zero the alignment exception bit in EFLAGS
++ make emulated architectures also work on real hardware
++ bring in support for other architectures (e.g. PowerPC)
Index: doc/mips
===================================================================
--- doc/mips	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ doc/mips	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,37 @@
+SPARTAN kernel currently supports emulated MIPS R4000 32-bit
+little-endian architecture. In other words, it can only run in MIPS
+R4000 emulator called msim. This emulator is being developed by Viliam
+Holub:
+
+http://nenya.ms.mff.cuni.cz/~holub/msim
+
+Note that msim diverges from real MIPS hardware in some aspects.
+Therefore, some non-trivial changes will be necessary for a real
+hardware port. The simulator is described in this manual:
+
+http://nenya.ms.mff.cuni.cz/~holub/msim/msim.ps
+
+You'll need a msim.conf script like this:
+
+	#
+	# MSIM configuration script
+	#
+
+	add dcpu mips1
+
+	add rwm 	mainmem		0               16M	load "kernel.bin"
+	add rom 	startmem        0x1fc00000	1k      load "load.bin"
+
+	add dprinter    printer         0xA000000
+
+
+
+BOOTSTRAP
+=========
+Because the mips port uses binary executable format and for some other
+architectural reasons, it shares one address for bootstrap entry
+(address where control is passed from loader) and for TLB refill
+exception entry. The former is used only once during system bootstrap.
+From that point further, only TLB refill exception entry uses that
+address. Note that this is the reason why main_bsp() is called from
+tlb_refill() code.
Index: doc/preemption
===================================================================
--- doc/preemption	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ doc/preemption	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,58 @@
+Kernel makes it possible for a thread to be preempted anytime when
+IRQ's are enabled on local CPU. This arrangement triggers a discussion
+about its correctness and efficiency.
+
+The correctness issue relates to the possibility of preempting a
+thread holding a spinlock. It is natural to ask whether such a
+preemption can lead to a deadlock. By proving the following lemma, we
+will show that deadlock is actually not possible.
+
+Lemma:
+  On condition that each spinning lock is always locked on the same
+  CPU priority level (either always with IRQ's disabled or always
+  with IRQ's enabled), otherwise correct code never deadlocks.
+
+Proof:
+  Let all assumptions from the lemma hold.
+  Let us further assume that we have encountered a deadlock.
+  We will analyse all likely ways how that could have happened.
+
+  a)  Deadlock happened between two CPUs. This means that there must
+  have been wrong lock-ordering. Code with lock-ordering problems is
+  considered incorrect and contradicts our assumptions.
+  
+  b)  Deadlock happened between two threads of execution executing on
+  the same CPU. 
+
+  b1) If one thread of execution was servicing an interrupt and the
+  other was executing in thread context, our assumption that each
+  spinning lock is acquired always on the same CPU priority level is
+  violated.
+  
+  b2) The last likely scenario is that the deadlock happened between
+  two threads executing on the same CPU with IRQ's enabled.  Again,
+  this means that we were working with incorrect code because it
+  contained wrong ordering of lock operations.
+  
+  Since there is no possibility left, except for trivial errors, we
+  have shown that the deadlock contradicts with our assumptions and
+  therefore is not possible.
+
+  Q.E.D.
+  
+Notes on the proof:
+  ad a)  Deadlock between two CPUs is independent on the preemption
+         model. If we have this kind of deadlock, we would have had
+	 the same kind of deadlock on an ordinary SMP system with
+	 kernel preemption disabled.
+	 
+	 This preemption model makes UP behave more like SMP because
+	 it introduces some SMP specific specialities.
+
+  ad b2) Notice that the scenario when thread A acquires lock X and
+	 gets preempted in favor of thread B which is trying to
+	 acquire lock X, doesn't deadlock the two threads. Of course,
+	 B won't be allowed to get X until A releases it, but that
+	 will certainly	happen because B too will sooner or later be
+	 preempted. This scenario emphasizes the efficiency issues,
+	 though.
Index: doc/requirements
===================================================================
--- doc/requirements	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ doc/requirements	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+ia32 port
+=========
+
+    HARDWARE REQUIREMENTS
+    o IA-32 processor (Pentium and successors)
+
+    COMPILER REQUIREMENTS
+    o binutils 2.15
+    o gcc 2.95
+    o gcc 3.3.2 - gcc 3.3.5
+
+    SMP COMPATIBILITY
+    o Bochs 2.0.2 - Bochs 2.1
+	o 2x-8x 686 CPU
+    o ASUS P/I-P65UP5 + ASUS C-P55T2D REV. 1.41
+	o 2x 200Mhz Pentium CPU
+    
+    EMULATORS AND VIRTUALIZERS
+    o Bochs 2.0.2 - Bochs 2.1
+    o VMware Workstation 4
+
+
+mips port
+=========
+
+    HARDWARE REQUIREMENTS
+    o no real hardware supported
+    o msim emulated MIPS R4000 CPU (see mips) 
+
+    COMPILER REQUIREMENTS
+    o binutils 2.14 mips cross binutils
+    o gcc 2.8.1 mips cross compiler
+    o gcc 3.2.3 mips cross compiler
+
+    EMULATORS AND VIRTUALIZERS
+    o msim
Index: doc/synchronization
===================================================================
--- doc/synchronization	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ doc/synchronization	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,29 @@
+
+                                 SPINNING LOCKS
+                spinlock_lock, spinlock_trylock, spinlock_unlock
+                                 +------------+
+                                 | spinlock_t |
+                                 +------------+
+
+                                   WAIT QUEUES
+                         waitq_sleep_timeout, waitq_wakeup
+                                   +---------+
+                                   | waitq_t |
+			           +---------+
+				  /           \
+               SEMAPHORES        /             \  CONDITION VARIABLES
+ semaphore_down_timeout, semaphore_up    condvar_wait_timeout, condvar_signal
+            +--------------+   /                 \   +-----------+
+            | semaphore_t  |<-+                   +->| condvar_t |
+            +--------------+                         +-----------+
+                   |                                       ^
+		   |                                       |
+                   |                                +------+
+                   V                               /           
+                MUTEXES                           / READERS/WRITERS LOCKS
+    mutex_lock_timeout, mutex_unlock   rwlock_reader/writer_lock_timeout, rwlock_unlock
+              +---------+                       /        +----------+
+	      | mutex_t |------------------------------->| rwlock_t |
+	      +---------+                     /          +----------+
+	           |                         /
+		   +------------------------+
Index: include/arch.h
===================================================================
--- include/arch.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/arch.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __ARCH_H__
+#define __ARCH_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+#include <cpu.h>
+
+extern cpu_private_page_t *the;
+
+extern void arch_init(void);
+extern void calibrate_delay_loop(void);
+
+extern pri_t cpu_priority_high(void);
+extern pri_t cpu_priority_low(void);
+extern void cpu_priority_restore(pri_t pri);
+extern pri_t cpu_priority_read(void);
+
+#endif
Index: include/config.h
===================================================================
--- include/config.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/config.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+#define CONFIG_MEMORY_SIZE	16*1024*1024
+#define CONFIG_HEAP_SIZE	300*1024
+#define CONFIG_STACK_SIZE	32*1024
+
+struct config {
+	__address base;
+	__u32 memory_size;
+	__u32 kernel_size;
+
+	int cpu_count;
+	volatile int cpu_active;
+};
+
+extern config_t config;
+
+#endif
Index: include/context.h
===================================================================
--- include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/context.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CONTEXT_H__
+#define __CONTEXT_H__
+
+#include <typedefs.h>
+
+extern int context_save(context_t *c);
+extern void context_restore(context_t *c) __attribute__ ((noreturn));
+
+#endif
Index: include/cpu.h
===================================================================
--- include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/cpu.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CPU_H__
+#define __CPU_H__
+
+#include <arch/cpu.h>
+#include <proc/thread.h>
+#include <proc/task.h>
+#include <proc/scheduler.h>
+#include <time/clock.h>
+#include <synch/spinlock.h>
+#include <synch/waitq.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <arch/context.h>
+
+#define CPU_STACK_SIZE	(4096)
+
+struct cpu {
+	spinlock_t lock;
+	context_t saved_context;
+
+	volatile int nrdy;
+	runq_t rq[RQ_COUNT];
+	volatile int needs_relink;
+
+	spinlock_t timeoutlock;
+	link_t timeout_active_head;
+
+	#ifdef __SMP__
+	int kcpulbstarted;
+	waitq_t kcpulb_wq;
+	#endif /* __SMP__ */
+
+	int id;
+
+	__u16 frequency_mhz;
+	__u32 delay_loop_const;
+
+	cpu_arch_t arch;
+	
+	__u8 *stack;
+};
+
+struct cpu_private_page {
+	cpu_t *cpu;
+	thread_t *thread;
+	task_t *task;
+};
+
+extern cpu_t *cpus;
+
+extern void cpu_init(void);
+extern void cpu_arch_init(void);
+extern void cpu_identify(void);
+extern void cpu_print_report(cpu_t *m);
+
+#endif
Index: include/func.h
===================================================================
--- include/func.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/func.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __FUNC_H__
+#define __FUNC_H__
+
+#include <arch/types.h>
+
+extern __u32 haltstate;
+
+extern void halt(void);
+
+extern int strcmp(char *src, char *dst);
+
+extern __address __u32_search(__address src, int cnt, __u32 x);
+
+#endif
Index: include/list.h
===================================================================
--- include/list.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/list.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __LIST_H__
+#define __LIST_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+struct link {
+	link_t *prev;
+	link_t *next;
+};
+
+
+#define link_initialize(link) { \
+	(link)->prev = NULL; \
+	(link)->next = NULL; \
+}
+
+#define list_initialize(head) { \
+	(head)->prev = (head); \
+	(head)->next = (head); \
+}
+
+#define list_prepend(link, head) { \
+	(link)->next = (head)->next; \
+	(link)->prev = (head); \
+	(head)->next->prev = (link); \
+	(head)->next = (link); \
+}
+
+#define list_append(link, head) { \
+	(link)->prev = (head)->prev; \
+	(link)->next = (head); \
+	(head)->prev->next = (link); \
+	(head)->prev = (link); \
+}
+
+#define list_remove(link) { \
+	(link)->next->prev = (link)->prev; \
+	(link)->prev->next = (link)->next; \
+	link_initialize(link); \
+}
+
+#define list_empty(head) (((head)->next == (head))?1:0)
+
+#define list_get_instance(link,type,member) (type *)(((__u8*)(link))-((__u8*)&(((type *)NULL)->member)))
+
+extern int list_member(link_t *link, link_t *head);
+extern void list_concat(link_t *head1, link_t *head2);
+
+#endif
Index: include/main/kinit.h
===================================================================
--- include/main/kinit.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/main/kinit.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __KINIT_H__
+#define __KINIT_H__
+
+extern void kinit(void *arg);
+
+#endif
Index: include/main/uinit.h
===================================================================
--- include/main/uinit.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/main/uinit.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __UINIT_H__
+#define __UINIT_H__
+
+#include <arch/types.h>
+
+extern void utext(void);
+extern __u32 utext_size;  
+
+extern void uinit(void *arg);
+
+#endif
Index: include/memstr.h
===================================================================
--- include/memstr.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/memstr.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MEMSTR_H__
+#define __MEMSTR_H__
+
+#include <arch/types.h>
+
+extern void memcopy(__address src, __address dst, int cnt);
+
+extern void memsetw(__address dst, int cnt, __u16 x);
+extern void memsetb(__address dst, int cnt, __u8 x);
+
+extern int memcmp(__address src, __address dst, int cnt);
+
+#endif
Index: include/mm/frame.h
===================================================================
--- include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/mm/frame.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __FRAME_H__
+#define __FRAME_H__
+
+#include <arch/types.h>
+
+#define FRAME_KA	1	/* skip frames conflicting with user address space */
+#define FRAME_PANIC	2	/* panic on failure */
+
+extern __u32 frames;
+extern __u32 frames_free;
+
+extern __u32 kernel_frames;
+extern __u32 kernel_frames_free;
+
+extern __u8 *frame_bitmap;
+extern __u32 frame_bitmap_octets;
+
+extern __u8 *frame_kernel_bitmap;
+
+extern void frame_init(void);
+
+__address frame_alloc(int flags);
+extern void frame_free(__address addr);
+extern void frame_not_free(__address addr);
+extern void frame_region_not_free(__address start, __address stop);
+
+#endif
Index: include/mm/heap.h
===================================================================
--- include/mm/heap.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/mm/heap.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __HEAP_H__
+#define __HEAP_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+struct chunk {
+	int used;
+	struct chunk *next;
+	struct chunk *prev;
+	__u32 size;
+	__u8 data[0];
+};
+
+extern void heap_init(__address heap, int size);
+
+extern void *malloc(int size);
+extern void free(void *ptr);
+
+#endif
Index: include/mm/page.h
===================================================================
--- include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/mm/page.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PAGE_H__
+#define __PAGE_H__
+
+#include <arch/types.h>
+#include <arch/mm/page.h>
+
+#define PAGE_NOT_CACHEABLE      (0<<0)
+#define PAGE_CACHEABLE          (1<<0)
+
+#define PAGE_PRESENT            (0<<1)
+#define PAGE_NOT_PRESENT        (1<<1)
+
+#define PAGE_USER               (1<<2)
+#define PAGE_KERNEL             (0<<2)
+
+#define PAGE_READ		(1<<3)
+#define PAGE_WRITE		(1<<4)
+#define PAGE_EXEC		(1<<5)
+
+extern void page_init(void);
+extern void map_page_to_frame(__address page, __address frame, int flags, int copy);
+
+#endif
Index: include/mm/tlb.h
===================================================================
--- include/mm/tlb.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/mm/tlb.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TLB_H__
+#define __TLB_H__
+
+extern void tlb_shutdown(void);
+extern void tlb_invalidate(int asid);
+
+#endif
Index: include/mm/vm.h
===================================================================
--- include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/mm/vm.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __VM_H__
+#define __VM_H__
+
+#include <arch/mm/vm.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/spinlock.h>
+#include <list.h>
+
+#define KERNEL_ADDRESS_SPACE_START	KERNEL_ADDRESS_SPACE_START_ARCH
+#define KERNEL_ADDRESS_SPACE_END	KERNEL_ADDRESS_SPACE_END_ARCH
+#define USER_ADDRESS_SPACE_START	USER_ADDRESS_SPACE_START_ARCH
+#define USER_ADDRESS_SPACE_END		USER_ADDRESS_SPACE_END_ARCH
+
+#define IS_KA(addr)	((addr)>=KERNEL_ADDRESS_SPACE_START && (addr)<=KERNEL_ADDRESS_SPACE_END)
+
+#define UTEXT_ADDRESS	UTEXT_ADDRESS_ARCH
+#define USTACK_ADDRESS	USTACK_ADDRESS_ARCH
+#define UDATA_ADDRESS	UDATA_ADDRESS_ARCH
+
+enum vm_type {
+	VMA_TEXT = 1, VMA_DATA, VMA_STACK 
+};
+
+/*
+ * Each vm_area structure describes one continuous area of virtual memory.
+ * In the future, it should not be difficult to support shared areas of vm.
+ */
+struct vm_area {
+	spinlock_t lock;
+	link_t link;
+	vm_type_t type;
+	int size;
+	__address address;
+	__address *mapping;
+};
+
+/*
+ * vm_mapping_t contains the list of vm_areas of userspace accessible
+ * pages for one or more tasks. Ranges of kernel memory pages are not
+ * supposed to figure in the list as they are shared by all tasks and
+ * set up during system initialization.
+ */
+struct vm {
+	spinlock_t lock;
+	link_t vm_area_head;
+};
+
+extern vm_t * vm_create(void);
+extern void vm_destroy(vm_t *m);
+
+extern vm_area_t *vm_area_create(vm_t *m, vm_type_t type, int size, __address addr);
+extern void vm_area_destroy(vm_area_t *a);
+
+extern void vm_area_map(vm_area_t *a);
+extern void vm_area_unmap(vm_area_t *a);
+
+extern void vm_install(vm_t *m);
+extern void vm_uninstall(vm_t *m);
+
+#endif
Index: include/panic.h
===================================================================
--- include/panic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/panic.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PANIC_H__
+#define __PANIC_H__
+
+#define PANIC "KERNEL PANIC: "
+
+extern void panic(char *fmt, ...);
+
+#endif
Index: include/print.h
===================================================================
--- include/print.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/print.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PRINT_H__
+#define __PRINT_H__
+
+#include <arch/types.h>
+
+#define INT8	1
+#define INT16	2
+#define INT32	4
+
+static void print_str(char *str);
+static void print_fixed_hex(__u32 num, int width);
+static  void print_number(__u32 num, int base);
+
+extern void putchar(char c);
+extern void printf(char *fmt, ...);
+
+#endif
Index: include/proc/scheduler.h
===================================================================
--- include/proc/scheduler.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/proc/scheduler.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SCHEDULER_H__
+#define __SCHEDULER_H__
+
+#include <synch/spinlock.h>
+#include <time/clock.h>		/* HZ */
+#include <typedefs.h>
+#include <list.h>
+
+#define RQ_COUNT 		16
+#define NEEDS_RELINK_MAX	(HZ)
+
+struct runq {
+	spinlock_t lock;
+	link_t rq_head;
+	int n;
+};
+
+extern spinlock_t nrdylock;
+extern volatile int nrdy;
+
+static thread_t *find_best_thread(void);
+static void relink_rq(int start);
+static void scheduler_separated_stack(void);
+
+extern void scheduler_init(void);
+
+extern void scheduler(void);
+extern void kcpulb(void *arg);
+
+#endif
Index: include/proc/task.h
===================================================================
--- include/proc/task.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/proc/task.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TASK_H__
+#define __TASK_H__
+
+#include <typedefs.h>
+#include <synch/spinlock.h>
+#include <proc/thread.h>
+#include <mm/vm.h>
+#include <list.h>
+
+struct task {
+	spinlock_t lock;
+	link_t th_head;		/* list of threads contained in this task */
+	link_t tasks_link;	/* link to other tasks within the system */
+	vm_t *vm;
+};
+
+extern spinlock_t tasks_lock;
+extern link_t tasks_head;
+
+extern void task_init(void);
+extern task_t *task_create(vm_t *m);
+
+#endif
Index: include/proc/thread.h
===================================================================
--- include/proc/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/proc/thread.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __THREAD_H__
+#define __THREAD_H__
+
+#include <arch/thread.h>
+#include <proc/task.h>
+#include <synch/spinlock.h>
+#include <arch/context.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <time/timeout.h>
+#include <synch/rwlock.h>
+#include <mm/page.h>
+#include <list.h>
+
+#define THREAD_STACK_SIZE	PAGE_SIZE
+
+#define THREAD_USER_STACK	1
+
+enum state {
+	Invalid,
+	Running,
+	Sleeping,
+	Ready,
+	Entering,
+	Exiting
+};
+
+extern char *thread_states[];
+
+#define X_WIRED		(1<<0)
+#define X_STOLEN	(1<<1)
+
+struct thread {
+	link_t rq_link;				/* run queue link */
+	link_t wq_link;				/* wait queue link */
+	link_t th_link;				/* links to threads within the parent task*/
+	link_t threads_link;
+	
+	/* items below are protected by lock */
+	spinlock_t lock;
+
+	void (* thread_code)(void *);
+	void *thread_arg;
+
+	context_t saved_context;
+	context_t sleep_timeout_context;
+
+	waitq_t *sleep_queue;
+	timeout_t sleep_timeout;
+	volatile int timeout_pending;
+
+	rwlock_type_t rwlock_holder_type;
+	void (* call_me)(void *);
+	void *call_me_with;
+
+	int state;
+	int flags;
+	
+	cpu_t *cpu;
+	task_t *task;
+
+	__u64 ticks;
+
+	__u32 tid;
+	
+	int pri;
+	
+	ARCH_THREAD_DATA;
+
+	__u8 *kstack;
+	__u8 *ustack;
+};
+
+extern spinlock_t threads_lock;
+extern link_t threads_head;
+
+static void cushion(void);
+
+extern void thread_init(void);
+extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags);
+extern void thread_ready(thread_t *t);
+extern void thread_exit(void);
+
+extern void thread_sleep(__u32 sec);
+extern void thread_usleep(__u32 usec);
+
+extern void thread_register_call_me(void (* call_me)(void *), void *call_me_with);
+
+#endif
Index: include/putchar.h
===================================================================
--- include/putchar.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/putchar.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PUTCHAR_H__
+#define __PUTCHAR_H__
+
+extern void putchar(char ch);
+
+#endif
Index: include/synch/condvar.h
===================================================================
--- include/synch/condvar.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/condvar.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CONDVAR_H__
+#define __CONDVAR_H__
+
+#include <arch/types.h>
+#include <synch/waitq.h>
+#include <typedefs.h>
+#include <synch/synch.h>
+
+struct condvar {
+	waitq_t wq;
+};
+
+#define condvar_wait(cv,mtx) \
+	_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+#define condvar_trywait(cv,mtx) \
+	_condvar_wait_timeout((cv),(mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
+#define condvar_wait_timeout(cv,mtx,usec) \
+	_condvar_wait_timeout((cv),(mtx),(usec),SYNCH_NON_BLOCKING)
+
+extern void condvar_initialize(condvar_t *cv);
+extern void condvar_signal(condvar_t *cv);
+extern void condvar_broadcast(condvar_t *cv);
+extern int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait);
+
+#endif
Index: include/synch/mutex.h
===================================================================
--- include/synch/mutex.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/mutex.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MUTEX_H__
+#define __MUTEX_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/semaphore.h>
+#include <synch/synch.h>
+
+struct mutex {
+	semaphore_t sem;
+};
+
+#define mutex_lock(mtx) \
+	_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+#define mutex_trylock(mtx) \
+	_mutex_lock_timeout((mtx),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
+#define mutex_lock_timeout(mtx,usec) \
+	_mutex_lock_timeout((mtx),(usec),SYNCH_NON_BLOCKING)
+	
+extern void mutex_initialize(mutex_t *mtx);
+extern int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock);
+extern void mutex_unlock(mutex_t *mtx);
+
+#endif
Index: include/synch/rwlock.h
===================================================================
--- include/synch/rwlock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/rwlock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __RWLOCK_H__
+#define __RWLOCK_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/mutex.h>
+#include <synch/synch.h>
+
+enum rwlock_type {
+	RWLOCK_NONE,
+	RWLOCK_READER,
+	RWLOCK_WRITER
+};
+
+struct rwlock {
+	spinlock_t lock;
+	mutex_t exclusive;
+	int readers_in;
+};
+
+#define rwlock_write_lock(rwl) \
+	_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+#define rwlock_read_lock(rwl) \
+	_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+#define rwlock_write_trylock(rwl) \
+	_rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
+#define rwlock_read_trylock(rwl) \
+	_rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)
+#define rwlock_write_lock_timeout(rwl,usec) \
+	_rwlock_write_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
+#define rwlock_read_lock_timeout(rwl,usec) \
+	_rwlock_read_lock_timeout((rwl),(usec),SYNCH_NON_BLOCKING)
+
+extern void rwlock_initialize(rwlock_t *rwl);
+extern void rwlock_read_unlock(rwlock_t *rwl);
+extern void rwlock_write_unlock(rwlock_t *rwl);
+extern int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
+extern int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock);
+
+#endif
Index: include/synch/semaphore.h
===================================================================
--- include/synch/semaphore.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/semaphore.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SEMAPHORE_H__
+#define __SEMAPHORE_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/waitq.h>
+#include <synch/synch.h>
+
+struct semaphore
+{
+    waitq_t wq;
+};
+
+#define semaphore_down(s) \
+	_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+#define semaphore_trydown(s) \
+	_semaphore_down_timeout((s),SYNCH_NO_TIMEOUT,SYNCH_NON_BLOCKING)	
+#define semaphore_down_timeout(s,usec) \
+	_semaphore_down_timeout((s),(usec),SYNCH_NON_BLOCKING)
+
+extern void semaphore_initialize(semaphore_t *s, int val);
+extern int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown);
+extern void semaphore_up(semaphore_t *s);
+
+#endif
Index: include/synch/spinlock.h
===================================================================
--- include/synch/spinlock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/spinlock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SPINLOCK_H__
+#define __SPINLOCK_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+
+#ifdef __SMP__
+struct spinlock {
+	int val;
+};
+
+extern void spinlock_initialize(spinlock_t *sl);
+extern void spinlock_lock(spinlock_t *sl);
+extern int spinlock_trylock(spinlock_t *sl);
+extern void spinlock_unlock(spinlock_t *sl);
+
+#else
+
+struct spinlock {
+};
+
+#define spinlock_initialize(x)
+#define spinlock_lock(x)
+#define spinlock_trylock(x) 1
+#define spinlock_unlock(x)
+
+#endif
+
+#endif
Index: include/synch/synch.h
===================================================================
--- include/synch/synch.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/synch.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __SYNCH_H__
+#define __SYNCH_H__
+
+#define SYNCH_NO_TIMEOUT	0
+#define SYNCH_BLOCKING		0
+#define SYNCH_NON_BLOCKING	1
+
+#define ESYNCH_WOULD_BLOCK	1
+#define ESYNCH_TIMEOUT		2
+#define ESYNCH_OK_ATOMIC	4
+#define ESYNCH_OK_BLOCKED	8
+
+#define SYNCH_FAILED(rc)	((rc) & (ESYNCH_WOULD_BLOCK | ESYNCH_TIMEOUT))
+#define SYNCH_OK(rc)		((rc) & (ESYNCH_OK_ATOMIC | ESYNCH_OK_BLOCKED))
+
+#endif
Index: include/synch/waitq.h
===================================================================
--- include/synch/waitq.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/synch/waitq.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __WAITQ_H__
+#define __WAITQ_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/spinlock.h>
+#include <synch/synch.h>
+#include <list.h>
+
+#define WAKEUP_FIRST	0
+#define WAKEUP_ALL	1
+
+struct waitq {
+    spinlock_t lock;
+    int missed_wakeups;
+    link_t head;
+};
+
+#define waitq_sleep(wq) \
+	waitq_sleep_timeout((wq),SYNCH_NO_TIMEOUT,SYNCH_BLOCKING)
+
+extern void waitq_interrupted_sleep(void *data);
+
+extern void waitq_initialize(waitq_t *wq);
+extern int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking);
+extern void waitq_wakeup(waitq_t *wq, int all);
+extern void _waitq_wakeup_unsafe(waitq_t *wq, int all);
+
+#endif
Index: include/test.h
===================================================================
--- include/test.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/test.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TEST_H__
+#define __TEST_H__
+
+extern void test(void);
+
+#endif
Index: include/time/clock.h
===================================================================
--- include/time/clock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/time/clock.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __CLOCK_H__
+#define __CLOCK_H__
+
+#define HZ		100
+
+extern void clock(void);
+
+#endif
Index: include/time/delay.h
===================================================================
--- include/time/delay.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/time/delay.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __DELAY_H__
+#define __DELAY_H__
+
+#include <arch/types.h>
+
+extern void delay(__u32 microseconds);
+
+#endif
Index: include/time/timeout.h
===================================================================
--- include/time/timeout.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/time/timeout.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TIMEOUT_H__
+#define __TIMEOUT_H__
+
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/spinlock.h>
+#include <list.h>
+
+#define us2ticks(us)    ((__u64)(((__u32) (us)/(1000000/HZ))))
+
+typedef void (* timeout_handler)(void *arg);
+
+struct timeout {
+	spinlock_t lock;
+
+	link_t link;
+	
+	__u64 ticks;
+
+	timeout_handler handler;
+	void *arg;
+	
+	cpu_t *cpu;
+};
+
+extern void timeout_init(void);
+extern void timeout_initialize(timeout_t *t);
+extern void timeout_reinitialize(timeout_t *t);
+extern void timeout_register(timeout_t *t, __u64 usec, timeout_handler f, void *arg);
+extern int timeout_unregister(timeout_t *t);
+
+#endif
Index: include/typedefs.h
===================================================================
--- include/typedefs.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/typedefs.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __TYPEDEFS_H__
+#define __TYPEDEFS_H__
+
+typedef struct config config_t;
+typedef struct cpu_private_page cpu_private_page_t;
+typedef struct cpu_info cpu_info_t;
+
+typedef struct cpu cpu_t;
+typedef struct cpu_arch cpu_arch_t;
+typedef struct task task_t;
+typedef struct thread thread_t;
+typedef struct context context_t;
+
+typedef struct timeout timeout_t;
+
+typedef struct runq runq_t;
+
+typedef struct spinlock spinlock_t;
+typedef struct mutex mutex_t;
+typedef struct semaphore semaphore_t;
+typedef struct rwlock rwlock_t;
+typedef enum rwlock_type rwlock_type_t;
+typedef struct condvar condvar_t;
+typedef struct waitq waitq_t;
+
+typedef struct chunk chunk_t;
+
+typedef enum vm_type vm_type_t;
+typedef struct vm_area vm_area_t;
+typedef struct vm vm_t;
+
+typedef struct link link_t;
+
+#endif
Index: include/userspace.h
===================================================================
--- include/userspace.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ include/userspace.h	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __USERSPACE_H__
+#define __USERSPACE_H__
+
+extern void userspace(void) __attribute__ ((noreturn));
+
+#endif
Index: rnel/arch/abs32le/_link.ld.in
===================================================================
--- kernel/arch/abs32le/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-SECTIONS {
-	.text : {
-		kernel_load_address = .;
-		ktext_start = .;
-		*(.text .text.*);
-		ktext_end = .;
-	}
-	.data : {
-		kdata_start = .;
-		*(.data .data.*);                       /* initialized data */
-		*(.bss .bss.*);                        /* uninitialized static variables */
-		*(COMMON);                      /* global variables */
-
-		*(.rodata .rodata.*);
-		*(.eh_frame .eh_frame.*);       /* stack unwinding data */
-		*(.eh_frame_hdr .eh_frame_hdr.*);
-		*(.sdata .sdata.*);
-	}
-	.sbss : {
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-	}
-
-	kdata_end = .;
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note);
-	}
-}
Index: rnel/arch/abs32le/include/arch/arch.h
===================================================================
--- kernel/arch/abs32le/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_ARCH_H_
-#define KERN_abs32le_ARCH_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/asm.h
===================================================================
--- kernel/arch/abs32le/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_ASM_H_
-#define KERN_abs32le_ASM_H_
-
-#include <typedefs.h>
-#include <config.h>
-#include <trace.h>
-
-_NO_TRACE static inline void asm_delay_loop(uint32_t usec)
-{
-}
-
-_NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
-{
-	/*
-	 * On real hardware this should stop processing further
-	 * instructions on the CPU (and possibly putting it into
-	 * low-power mode) without any possibility of exitting
-	 * this function.
-	 */
-
-	while (true)
-		;
-}
-
-_NO_TRACE static inline void cpu_sleep(void)
-{
-	/*
-	 * On real hardware this should put the CPU into low-power
-	 * mode. However, the CPU is free to continue processing
-	 * futher instructions any time. The CPU also wakes up
-	 * upon an interrupt.
-	 */
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-	/*
-	 * Some ISAs have a special instruction for the body of a busy wait loop,
-	 * such as in spinlock and the like. Using it allows the CPU to optimize
-	 * its operation. For an example, see the "pause" instruction on x86.
-	 */
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
-{
-}
-
-/** Word to port
- *
- * Output word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
-{
-}
-
-/** Double word to port
- *
- * Output double word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
-{
-}
-
-/** Byte from port
- *
- * Get byte from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	return 0;
-}
-
-/** Word from port
- *
- * Get word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	return 0;
-}
-
-/** Double word from port
- *
- * Get double word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	return 0;
-}
-
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	/*
-	 * On real hardware this unconditionally enables preemption
-	 * by internal and external interrupts.
-	 *
-	 * The return value stores the previous interrupt level.
-	 */
-
-	return 0;
-}
-
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	/*
-	 * On real hardware this disables preemption by the usual
-	 * set of internal and external interrupts. This does not
-	 * apply to special non-maskable interrupts and sychronous
-	 * CPU exceptions.
-	 *
-	 * The return value stores the previous interrupt level.
-	 */
-
-	return 0;
-}
-
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	/*
-	 * On real hardware this either enables or disables preemption
-	 * according to the interrupt level value from the argument.
-	 */
-}
-
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	/*
-	 * On real hardware the return value stores the current interrupt
-	 * level.
-	 */
-
-	return 0;
-}
-
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	/*
-	 * On real hardware the return value is true iff interrupts are
-	 * disabled.
-	 */
-
-	return false;
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/context.h
===================================================================
--- kernel/arch/abs32le/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_CONTEXT_H_
-#define KERN_abs32le_CONTEXT_H_
-
-#define STACK_ITEM_SIZE  4
-#define SP_DELTA         0
-
-#define context_set(ctx, pc, stack, size) \
-	context_set_generic(ctx, pc, stack, size)
-
-/*
- * On real hardware this stores the registers which
- * need to be preserved across function calls.
- */
-typedef struct {
-	uintptr_t sp;
-	uintptr_t pc;
-} context_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/context_offset.h
===================================================================
--- kernel/arch/abs32le/include/arch/context_offset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_CONTEXT_OFFSET_H_
-#define KERN_abs32le_CONTEXT_OFFSET_H_
-
-#define OFFSET_PC  0x00
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/cpu.h
===================================================================
--- kernel/arch/abs32le/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_CPU_H_
-#define KERN_abs32le_CPU_H_
-
-/*
- * On real hardware this structure stores
- * information specific to the current
- * CPU model.
- */
-typedef struct {
-} cpu_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/cycle.h
===================================================================
--- kernel/arch/abs32le/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_CYCLE_H_
-#define KERN_abs32le_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/faddr.h
===================================================================
--- kernel/arch/abs32le/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_FADDR_H_
-#define KERN_abs32le_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/fpu_context.h
===================================================================
--- kernel/arch/abs32le/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_FPU_CONTEXT_H_
-#define KERN_abs32le_FPU_CONTEXT_H_
-
-/*
- * On real hardware this stores the FPU registers
- * which are part of the CPU context.
- */
-typedef struct {
-} fpu_context_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/interrupt.h
===================================================================
--- kernel/arch/abs32le/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_INTERRUPT_H_
-#define KERN_abs32le_INTERRUPT_H_
-
-#include <arch/istate.h>
-
-#define IVT_ITEMS  0
-#define IVT_FIRST  0
-
-#define VECTOR_TLB_SHOOTDOWN_IPI  0
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/istate.h
===================================================================
--- kernel/arch/abs32le/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_ISTATE_H_
-#define KERN_abs32le_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <typedefs.h>
-#include <verify.h>
-
-#else /* KERNEL */
-
-#include <stdint.h>
-
-#define REQUIRES_EXTENT_MUTABLE(arg)
-#define WRITES(arg)
-
-#endif /* KERNEL */
-
-/*
- * On real hardware this stores the registers which
- * need to be preserved during interupts.
- */
-typedef struct istate {
-	uintptr_t ip;
-	uintptr_t fp;
-	uint32_t stack[];
-} istate_t;
-
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-    REQUIRES_EXTENT_MUTABLE(istate)
-{
-	/*
-	 * On real hardware this checks whether the interrupted
-	 * context originated from user space.
-	 */
-
-	return !(istate->ip & UINT32_C(0x80000000));
-}
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-    WRITES(&istate->ip)
-{
-	/* On real hardware this sets the instruction pointer. */
-
-	istate->ip = retaddr;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-    REQUIRES_EXTENT_MUTABLE(istate)
-{
-	/* On real hardware this returns the instruction pointer. */
-
-	return istate->ip;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-    REQUIRES_EXTENT_MUTABLE(istate)
-{
-	/* On real hardware this returns the frame pointer. */
-
-	return istate->fp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/as.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_AS_H_
-#define KERN_abs32le_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_install_arch(as)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/asid.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-
-#ifndef KERN_abs32le_ASID_H_
-#define KERN_abs32le_ASID_H_
-
-#include <stdint.h>
-
-typedef uint32_t asid_t;
-
-#define ASID_MAX_ARCH  3
-
-#define asid_get()      (ASID_START + 1)
-#define asid_put(asid)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/frame.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_FRAME_H_
-#define KERN_abs32le_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/km.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_KM_H_
-#define KERN_abs32le_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/page.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_PAGE_H_
-#define KERN_abs32le_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <stdbool.h>
-#include <trace.h>
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT32_C(0x80000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x80000000))
-
-/*
- * This is an example of 2-level page tables (PTL1 and PTL2 are left out)
- * on top of the generic 4-level page table interface.
- */
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  1024
-#define PTL1_ENTRIES_ARCH  0
-#define PTL2_ENTRIES_ARCH  0
-#define PTL3_ENTRIES_ARCH  1024
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ffU)
-#define PTL1_INDEX_ARCH(vaddr)  0
-#define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ffU)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	((pte_t *) ((((pte_t *) (ptl0))[(i)].frame_address) << 12))
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	(ptl1)
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	(ptl2)
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	((uintptr_t) ((((pte_t *) (ptl3))[(i)].frame_address) << 12))
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0)
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].frame_address = (a) >> 12)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].frame_address = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	PAGE_PRESENT
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	PAGE_PRESENT
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x)	\
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i)	\
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT_ARCH(ptl2, i)
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last level entries. */
-#define PTE_VALID_ARCH(p) \
-	((p)->soft_valid != 0)
-#define PTE_PRESENT_ARCH(p) \
-	((p)->present != 0)
-#define PTE_GET_FRAME_ARCH(p) \
-	((p)->frame_address << FRAME_WIDTH)
-#define PTE_WRITABLE_ARCH(p) \
-	((p)->writeable != 0)
-#define PTE_EXECUTABLE_ARCH(p)  1
-
-#include <mm/mm.h>
-#include <arch/interrupt.h>
-#include <typedefs.h>
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned int present : 1;
-	unsigned int writeable : 1;
-	unsigned int uaccessible : 1;
-	unsigned int page_write_through : 1;
-	unsigned int page_cache_disable : 1;
-	unsigned int accessed : 1;
-	unsigned int dirty : 1;
-	unsigned int pat : 1;
-	unsigned int global : 1;
-
-	/** Valid content even if the present bit is not set. */
-	unsigned int soft_valid : 1;
-	unsigned int avl : 2;
-	unsigned int frame_address : 20;
-} __attribute__((packed)) pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-    REQUIRES_ARRAY_MUTABLE(pt, PTL0_ENTRIES_ARCH)
-{
-	pte_t *p = &pt[i];
-
-	return (((unsigned int) (!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
-	    ((unsigned int) (!p->present) << PAGE_PRESENT_SHIFT) |
-	    ((unsigned int) p->uaccessible << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) |
-	    ((unsigned int) p->writeable << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) |
-	    ((unsigned int) p->global << PAGE_GLOBAL_SHIFT));
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-    WRITES(ARRAY_RANGE(pt, PTL0_ENTRIES_ARCH))
-    REQUIRES_ARRAY_MUTABLE(pt, PTL0_ENTRIES_ARCH)
-{
-	pte_t *p = &pt[i];
-
-	p->page_cache_disable = !(flags & PAGE_CACHEABLE);
-	p->present = !(flags & PAGE_NOT_PRESENT);
-	p->uaccessible = (flags & PAGE_USER) != 0;
-	p->writeable = (flags & PAGE_WRITE) != 0;
-	p->global = (flags & PAGE_GLOBAL) != 0;
-
-	/*
-	 * Ensure that there is at least one bit set even if the present bit is
-	 * cleared.
-	 */
-	p->soft_valid = true;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-    WRITES(ARRAY_RANGE(pt, PTL0_ENTRIES_ARCH))
-    REQUIRES_ARRAY_MUTABLE(pt, PTL0_ENTRIES_ARCH)
-{
-	pte_t *p = &pt[i];
-
-	p->present = 1;
-}
-
-extern void page_arch_init(void);
-extern void page_fault(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/abs32le/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_TLB_H_
-#define KERN_abs32le_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/proc/task.h
===================================================================
--- kernel/arch/abs32le/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_TASK_H_
-#define KERN_abs32le_TASK_H_
-
-#include <adt/bitmap.h>
-
-/*
- * On real hardware this structure stores task information
- * specific to the architecture.
- */
-typedef struct {
-} task_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/proc/thread.h
===================================================================
--- kernel/arch/abs32le/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_THREAD_H_
-#define KERN_abs32le_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(thr)
-#define thr_destructor_arch(thr)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/stack.h
===================================================================
--- kernel/arch/abs32le/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_STACK_H_
-#define KERN_abs32le_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/include/arch/types.h
===================================================================
--- kernel/arch/abs32le/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_abs32le_TYPES_H_
-#define KERN_abs32le_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/abs32le/meson.build
===================================================================
--- kernel/arch/abs32le/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/debug/stacktrace.c',
-	'src/proc/scheduler.c',
-	'src/proc/task.c',
-	'src/proc/thread.c',
-	'src/abs32le.c',
-	'src/userspace.c',
-	'src/smc.c',
-	'src/cpu/cpu.c',
-	'src/smp/smp.c',
-	'src/smp/ipi.c',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-)
Index: rnel/arch/abs32le/src/abs32le.c
===================================================================
--- kernel/arch/abs32le/src/abs32le.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <typedefs.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-
-#include <halt.h>
-#include <config.h>
-#include <console/console.h>
-#include <errno.h>
-#include <context.h>
-#include <fpu_context.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <syscall/copy.h>
-#include <syscall/syscall.h>
-
-static void abs32le_post_mm_init(void);
-
-arch_ops_t abs32le_ops = {
-	.post_mm_init = abs32le_post_mm_init,
-};
-
-arch_ops_t *arch_ops = &abs32le_ops;
-
-char memcpy_from_uspace_failover_address;
-char memcpy_to_uspace_failover_address;
-
-void abs32le_post_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		/* Initialize IRQ routing */
-		irq_init(0, 0);
-
-		/* Merge all memory zones to 1 big zone */
-		zone_merge_all();
-	}
-}
-
-void calibrate_delay_loop(void)
-{
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void arch_reboot(void)
-{
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-void istate_decode(istate_t *istate)
-{
-	(void) istate;
-}
-
-int context_save_arch(context_t *ctx)
-{
-	return EOK;
-}
-
-void context_restore_arch(context_t *ctx)
-{
-	while (true)
-		;
-}
-
-void fpu_init(void)
-{
-}
-
-void fpu_context_save(fpu_context_t *ctx)
-{
-}
-
-void fpu_context_restore(fpu_context_t *ctx)
-{
-}
-
-uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
-{
-	return 0;
-}
-
-uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
-{
-	return 0;
-}
-
-void early_putuchar(char32_t ch)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/cpu/cpu.c
===================================================================
--- kernel/arch/abs32le/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <stdio.h>
-#include <fpu_context.h>
-
-void fpu_disable(void)
-{
-}
-
-void fpu_enable(void)
-{
-}
-
-void cpu_arch_init(void)
-{
-}
-
-void cpu_identify(void)
-{
-}
-
-void cpu_print_report(cpu_t *cpu)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/debug/stacktrace.c
===================================================================
--- kernel/arch/abs32le/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <syscall/copy.h>
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return true;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return true;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return true;
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return true;
-}
-
-uintptr_t frame_pointer_get(void)
-{
-	return 0;
-}
-
-uintptr_t program_counter_get(void)
-{
-	return 0;
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/mm/as.c
===================================================================
--- kernel/arch/abs32le/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-
-#include <mm/as.h>
-#include <arch/mm/as.h>
-#include <genarch/mm/page_pt.h>
-
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/mm/frame.c
===================================================================
--- kernel/arch/abs32le/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-
-#include <mm/frame.h>
-#include <arch/mm/frame.h>
-#include <mm/as.h>
-#include <config.h>
-#include <panic.h>
-#include <debug.h>
-#include <align.h>
-#include <macros.h>
-#include <stdio.h>
-
-void physmem_print(void)
-{
-}
-
-void frame_low_arch_init(void)
-{
-}
-
-void frame_high_arch_init(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/mm/km.c
===================================================================
--- kernel/arch/abs32le/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <typedefs.h>
-
-void km_identity_arch_init(void)
-{
-}
-
-void km_non_identity_arch_init(void)
-{
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return false;
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/mm/page.c
===================================================================
--- kernel/arch/abs32le/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <align.h>
-#include <config.h>
-#include <halt.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-#include <debug.h>
-#include <stdio.h>
-#include <interrupt.h>
-
-void page_arch_init(void)
-{
-	if (config.cpu_active == 1)
-		page_mapping_operations = &pt_mapping_operations;
-}
-
-void page_fault(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/mm/tlb.c
===================================================================
--- kernel/arch/abs32le/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_mm
- * @{
- */
-
-#include <mm/tlb.h>
-#include <arch/mm/asid.h>
-#include <arch/asm.h>
-#include <typedefs.h>
-
-void tlb_invalidate_all(void)
-{
-}
-
-void tlb_invalidate_asid(asid_t asid __attribute__((unused)))
-{
-	tlb_invalidate_all();
-}
-
-void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt)
-{
-	tlb_invalidate_all();
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/proc/scheduler.c
===================================================================
--- kernel/arch/abs32le/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-
-void before_task_runs_arch(void)
-{
-}
-
-void before_thread_runs_arch(void)
-{
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/proc/task.c
===================================================================
--- kernel/arch/abs32le/src/proc/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/task.h>
-
-void task_create_arch(task_t *t)
-{
-}
-
-void task_destroy_arch(task_t *t)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/proc/thread.c
===================================================================
--- kernel/arch/abs32le/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/thread.h>
-
-errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
-{
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/smc.c
===================================================================
--- kernel/arch/abs32le/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-void smc_coherence(void *a, size_t l)
-{
-	compiler_barrier();
-}
Index: rnel/arch/abs32le/src/smp/ipi.c
===================================================================
--- kernel/arch/abs32le/src/smp/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#ifdef CONFIG_SMP
-
-#include <smp/ipi.h>
-
-void ipi_broadcast_arch(int ipi)
-{
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/abs32le/src/smp/smp.c
===================================================================
--- kernel/arch/abs32le/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-
-void smp_init(void)
-{
-}
-
-void kmp(void *arg)
-{
-}
-
-/** @}
- */
Index: rnel/arch/abs32le/src/userspace.c
===================================================================
--- kernel/arch/abs32le/src/userspace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_abs32le
- * @{
- */
-/** @file
- */
-
-#include <userspace.h>
-#include <stdbool.h>
-#include <arch.h>
-#include <mm/as.h>
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	/*
-	 * On real hardware this switches the CPU to user
-	 * space mode and jumps to kernel_uarg->uspace_entry.
-	 */
-
-	while (true)
-		;
-}
-
-/** @}
- */
Index: rnel/arch/amd64/_link.ld.in
===================================================================
--- kernel/arch/amd64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/** AMD64 linker script
- *
- * umapped section:
- *  kernel text
- *  kernel data
- * mapped section:
- *  kernel text
- *  kernel data
- */
-
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-
-SECTIONS {
-	kernel_load_address = PA2KA(BOOT_OFFSET);
-
-	.unmapped (BOOT_OFFSET + SIZEOF_HEADERS): AT (BOOT_OFFSET + SIZEOF_HEADERS) {
-		unmapped_start = .;
-		KEEP(*(K_TEXT_START));
-		KEEP(*(K_DATA_START));
-		KEEP(*(K_INI_PTLS));
-		unmapped_end = .;
-	}
-
-	.text (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS + SIZEOF(.unmapped)) : AT (BOOT_OFFSET + SIZEOF_HEADERS + SIZEOF(.unmapped)) {
-		ktext_start = .;
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		*(.rodata .rodata.*);  /* read-only global variables */
-		*(.data .data.*);      /* non-zero initialized global variables */
-
-		/*
-		 * When .bss is not physically present in the ELF file (MemSz > FileSz)
-		 * the kernel crashes during early boot. Not sure which part of the
-		 * boot process is to blame, for now just keep .bss packaged with .data
-		 * so that FileSz == MemSz.
-		 */
-
-		 *(.bss .bss.*);        /* uninitialized global variables */
-		*(COMMON);             /* non-`static` global variables without an extern declaration */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-
-#ifdef CONFIG_SMP
-	ap_boot = unmapped_ap_boot - BOOT_OFFSET + AP_BOOT_OFFSET;
-	ap_gdtr = unmapped_ap_gdtr - BOOT_OFFSET + AP_BOOT_OFFSET;
-	protected_ap_gdtr = PA2KA(ap_gdtr);
-#endif /* CONFIG_SMP */
-
-}
Index: rnel/arch/amd64/include/arch/arch.h
===================================================================
--- kernel/arch/amd64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_ARCH_H_
-#define KERN_amd64_ARCH_H_
-
-extern void amd64_pre_main(uint32_t, void *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/asm.h
===================================================================
--- kernel/arch/amd64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,496 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_ASM_H_
-#define KERN_amd64_ASM_H_
-
-#include <config.h>
-#include <typedefs.h>
-#include <arch/cpu.h>
-#include <trace.h>
-
-#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep()
-{
-	/*
-	 * On x86, "sti" enables interrupts after the next instruction.
-	 * Therefore, this sequence is guaranteed to be atomic.
-	 */
-	asm volatile (
-	    "sti\n"
-	    "hlt\n"
-	    "cli\n"
-	);
-}
-
-_NO_TRACE static inline void __attribute__((noreturn)) cpu_halt(void)
-{
-	while (true) {
-		asm volatile (
-		    "hlt\n"
-		);
-	}
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-	asm volatile (
-	    "pause\n"
-	);
-}
-
-/** Byte from port
- *
- * Get byte from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		uint8_t val;
-
-		asm volatile (
-		    "inb %w[port], %b[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint8_t) *port;
-}
-
-/** Word from port
- *
- * Get word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		uint16_t val;
-
-		asm volatile (
-		    "inw %w[port], %w[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint16_t) *port;
-}
-
-/** Double word from port
- *
- * Get double word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		uint32_t val;
-
-		asm volatile (
-		    "inl %w[port], %[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint32_t) *port;
-}
-
-/** Byte to port
- *
- * Output byte to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outb %b[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-/** Word to port
- *
- * Output word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outw %w[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-/** Double word to port
- *
- * Output double word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outl %[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-_NO_TRACE static inline uint64_t read_rflags(void)
-{
-	uint64_t rflags;
-
-	asm volatile (
-	    "pushfq\n"
-	    "popq %[v]\n"
-	    : [v] "=r" (rflags)
-	);
-
-	return rflags;
-}
-
-_NO_TRACE static inline void write_rflags(uint64_t rflags)
-{
-	asm volatile (
-	    "pushq %[v]\n"
-	    "popfq\n"
-	    :: [v] "r" (rflags)
-	);
-}
-
-/** Return interrupt priority level.
- *
- * Return the current interrupt priority level.
- *
- * @return Current interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	return (ipl_t) read_rflags();
-}
-
-/** Enable interrupts.
- *
- * Enable interrupts and return the previous interrupt priority level.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	ipl_t ipl = interrupts_read();
-
-	asm volatile ("sti\n");
-
-	return ipl;
-}
-
-/** Disable interrupts.
- *
- * Disable interrupts and return the previous interrupt priority level.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	ipl_t ipl = interrupts_read();
-
-	asm volatile ("cli\n");
-
-	return ipl;
-}
-
-/** Restore interrupt priority level.
- *
- * Restore the previously save interrupt priority level.
- *
- * @param ipl Saved interrupt priority level.
- *
- */
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	write_rflags((uint64_t) ipl);
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	return ((read_rflags() & RFLAGS_IF) == 0);
-}
-
-/** Write to MSR */
-_NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value)
-{
-	asm volatile (
-	    "wrmsr\n"
-	    :: "c" (msr),
-	      "a" ((uint32_t) (value)),
-	      "d" ((uint32_t) (value >> 32))
-	);
-}
-
-_NO_TRACE static inline sysarg_t read_msr(uint32_t msr)
-{
-	uint32_t ax, dx;
-
-	asm volatile (
-	    "rdmsr\n"
-	    : "=a" (ax), "=d" (dx)
-	    : "c" (msr)
-	);
-
-	return ((uint64_t) dx << 32) | ax;
-}
-
-/** Invalidate TLB Entry.
- *
- * @param addr Address on a page whose TLB entry is to be invalidated.
- *
- */
-_NO_TRACE static inline void invlpg(uintptr_t addr)
-{
-	asm volatile (
-	    "invlpg %[addr]\n"
-	    :: [addr] "m" (*((sysarg_t *) addr))
-	);
-}
-
-/** Load GDTR register from memory.
- *
- * @param gdtr_reg Address of memory from where to load GDTR.
- *
- */
-_NO_TRACE static inline void gdtr_load(ptr_16_64_t *gdtr_reg)
-{
-	asm volatile (
-	    "lgdtq %[gdtr_reg]\n"
-	    :: [gdtr_reg] "m" (*gdtr_reg)
-	);
-}
-
-/** Store GDTR register to memory.
- *
- * @param gdtr_reg Address of memory to where to load GDTR.
- *
- */
-_NO_TRACE static inline void gdtr_store(ptr_16_64_t *gdtr_reg)
-{
-	asm volatile (
-	    "sgdtq %[gdtr_reg]\n"
-	    :: [gdtr_reg] "m" (*gdtr_reg)
-	);
-}
-
-/** Load IDTR register from memory.
- *
- * @param idtr_reg Address of memory from where to load IDTR.
- *
- */
-_NO_TRACE static inline void idtr_load(ptr_16_64_t *idtr_reg)
-{
-	asm volatile (
-	    "lidtq %[idtr_reg]\n"
-	    :: [idtr_reg] "m" (*idtr_reg));
-}
-
-/** Load TR from descriptor table.
- *
- * @param sel Selector specifying descriptor of TSS segment.
- *
- */
-_NO_TRACE static inline void tr_load(uint16_t sel)
-{
-	asm volatile (
-	    "ltr %[sel]"
-	    :: [sel] "r" (sel)
-	);
-}
-
-#define GEN_READ_REG(reg) _NO_TRACE static inline sysarg_t read_ ##reg (void) \
-	{ \
-		sysarg_t res; \
-		asm volatile ( \
-			"movq %%" #reg ", %[res]" \
-			: [res] "=r" (res) \
-		); \
-		return res; \
-	}
-
-#define GEN_WRITE_REG(reg) _NO_TRACE static inline void write_ ##reg (sysarg_t regn) \
-	{ \
-		asm volatile ( \
-			"movq %[regn], %%" #reg \
-			:: [regn] "r" (regn) \
-		); \
-	}
-
-GEN_READ_REG(cr0);
-GEN_WRITE_REG(cr0);
-GEN_READ_REG(cr2);
-GEN_READ_REG(cr3);
-GEN_WRITE_REG(cr3);
-GEN_READ_REG(cr4);
-GEN_WRITE_REG(cr4);
-
-GEN_READ_REG(dr0);
-GEN_READ_REG(dr1);
-GEN_READ_REG(dr2);
-GEN_READ_REG(dr3);
-GEN_READ_REG(dr6);
-GEN_READ_REG(dr7);
-
-GEN_WRITE_REG(dr0);
-GEN_WRITE_REG(dr1);
-GEN_WRITE_REG(dr2);
-GEN_WRITE_REG(dr3);
-GEN_WRITE_REG(dr6);
-GEN_WRITE_REG(dr7);
-
-extern void asm_delay_loop(uint32_t);
-extern void asm_fake_loop(uint32_t);
-
-extern uintptr_t int_0;
-extern uintptr_t int_1;
-extern uintptr_t int_2;
-extern uintptr_t int_3;
-extern uintptr_t int_4;
-extern uintptr_t int_5;
-extern uintptr_t int_6;
-extern uintptr_t int_7;
-extern uintptr_t int_8;
-extern uintptr_t int_9;
-extern uintptr_t int_10;
-extern uintptr_t int_11;
-extern uintptr_t int_12;
-extern uintptr_t int_13;
-extern uintptr_t int_14;
-extern uintptr_t int_15;
-extern uintptr_t int_16;
-extern uintptr_t int_17;
-extern uintptr_t int_18;
-extern uintptr_t int_19;
-extern uintptr_t int_20;
-extern uintptr_t int_21;
-extern uintptr_t int_22;
-extern uintptr_t int_23;
-extern uintptr_t int_24;
-extern uintptr_t int_25;
-extern uintptr_t int_26;
-extern uintptr_t int_27;
-extern uintptr_t int_28;
-extern uintptr_t int_29;
-extern uintptr_t int_30;
-extern uintptr_t int_31;
-extern uintptr_t int_32;
-extern uintptr_t int_33;
-extern uintptr_t int_34;
-extern uintptr_t int_35;
-extern uintptr_t int_36;
-extern uintptr_t int_37;
-extern uintptr_t int_38;
-extern uintptr_t int_39;
-extern uintptr_t int_40;
-extern uintptr_t int_41;
-extern uintptr_t int_42;
-extern uintptr_t int_43;
-extern uintptr_t int_44;
-extern uintptr_t int_45;
-extern uintptr_t int_46;
-extern uintptr_t int_47;
-extern uintptr_t int_48;
-extern uintptr_t int_49;
-extern uintptr_t int_50;
-extern uintptr_t int_51;
-extern uintptr_t int_52;
-extern uintptr_t int_53;
-extern uintptr_t int_54;
-extern uintptr_t int_55;
-extern uintptr_t int_56;
-extern uintptr_t int_57;
-extern uintptr_t int_58;
-extern uintptr_t int_59;
-extern uintptr_t int_60;
-extern uintptr_t int_61;
-extern uintptr_t int_62;
-extern uintptr_t int_63;
-
-extern void enable_l_apic_in_msr(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/bios
===================================================================
--- kernel/arch/amd64/include/arch/bios	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/include/arch/bios
Index: rnel/arch/amd64/include/arch/boot/boot.h
===================================================================
--- kernel/arch/amd64/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_BOOT_H_
-#define KERN_amd64_BOOT_H_
-
-#define BOOT_OFFSET      0x108000
-#define AP_BOOT_OFFSET   0x008000
-#define BOOT_STACK_SIZE  0x000400
-
-#ifndef __ASSEMBLER__
-
-extern uint8_t unmapped_end[];
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/boot/memmap.h
===================================================================
--- kernel/arch/amd64/include/arch/boot/memmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../ia32/include/arch/boot/memmap.h
Index: rnel/arch/amd64/include/arch/boot/memmap_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/boot/memmap_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
-#define KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
-
-#define E820MEMMAP_OFFSET_BASE_ADDRESS  0x00
-#define E820MEMMAP_OFFSET_SIZE          0x08
-#define E820MEMMAP_OFFSET_TYPE          0x10
-#define E820MEMMAP_SIZE                 0x14
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct e820memmap {
-	uint64_t base_address;
-	uint64_t size;
-	uint32_t type;
-} __attribute__((packed)) e820memmap_t;
-
-#endif
-#endif
Index: rnel/arch/amd64/include/arch/context.h
===================================================================
--- kernel/arch/amd64/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_CONTEXT_H_
-#define KERN_amd64_CONTEXT_H_
-
-#include <arch/context_struct.h>
-
-/*
- * According to ABI the stack MUST be aligned on
- * 16-byte boundary. If it is not, the va_arg calling will
- * panic sooner or later
- */
-#define SP_DELTA  16
-
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = (uintptr_t) (_pc); \
-		(c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-		(c)->rbp = 0; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/context_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x08
-#define CONTEXT_OFFSET_RBX  0x10
-#define CONTEXT_OFFSET_RBP  0x18
-#define CONTEXT_OFFSET_R12  0x20
-#define CONTEXT_OFFSET_R13  0x28
-#define CONTEXT_OFFSET_R14  0x30
-#define CONTEXT_OFFSET_R15  0x38
-#define CONTEXT_OFFSET_TP   0x40
-#define CONTEXT_SIZE        0x48
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct context {
-	/*
-	 * We include only registers that must be preserved
-	 * during function call.
-	 */
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t rbx;
-	uint64_t rbp;
-	uint64_t r12;
-	uint64_t r13;
-	uint64_t r14;
-	uint64_t r15;
-	uint64_t tp;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/amd64/include/arch/cpu.h
===================================================================
--- kernel/arch/amd64/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_CPU_H_
-#define KERN_amd64_CPU_H_
-
-#define RFLAGS_CF	(1 << 0)
-#define RFLAGS_PF	(1 << 2)
-#define RFLAGS_AF	(1 << 4)
-#define RFLAGS_ZF	(1 << 6)
-#define RFLAGS_SF	(1 << 7)
-#define RFLAGS_TF	(1 << 8)
-#define RFLAGS_IF	(1 << 9)
-#define RFLAGS_DF	(1 << 10)
-#define RFLAGS_OF	(1 << 11)
-#define RFLAGS_IOPL	(3 << 12)
-#define RFLAGS_NT	(1 << 14)
-#define RFLAGS_RF 	(1 << 16)
-#define RFLAGS_ID	(1 << 21)
-
-#define CR0_PE		(1 << 0)
-#define CR0_MP		(1 << 1)
-#define CR0_EM		(1 << 2)
-#define CR0_TS		(1 << 3)
-#define CR0_AM		(1 << 18)
-#define CR0_PG		(1 << 31)
-
-#define CR4_PAE		(1 << 5)
-#define CR4_OSFXSR	(1 << 9)
-
-/* EFER bits */
-#define AMD_SCE		(1 << 0)
-#define AMD_LME		(1 << 8)
-#define AMD_LMA		(1 << 10)
-#define AMD_NXE		(1 << 11)
-#define AMD_FFXSR	(1 << 14)
-
-#define AMD_APIC_BASE_GE	(1 << 11)
-
-/* MSR registers */
-#define AMD_MSR_APIC_BASE	0x0000001b
-#define AMD_MSR_EFER		0xc0000080
-#define AMD_MSR_STAR		0xc0000081
-#define AMD_MSR_LSTAR		0xc0000082
-#define AMD_MSR_SFMASK		0xc0000084
-#define AMD_MSR_FS		0xc0000100
-#define AMD_MSR_GS		0xc0000101
-#define AMD_MSR_GS_KERNEL	0xc0000102
-
-#ifndef __ASSEMBLER__
-
-#include <arch/pm.h>
-
-typedef struct {
-	int vendor;
-	int family;
-	int model;
-	int stepping;
-	tss_t *tss;
-
-	unsigned int id; /** CPU's local, ie physical, APIC ID. */
-
-	size_t iomapver_copy;  /** Copy of TASK's I/O Permission bitmap generation count. */
-} cpu_arch_t;
-
-struct star_msr {
-};
-
-struct lstar_msr {
-};
-
-void cpu_setup_fpu(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/cpuid.h
===================================================================
--- kernel/arch/amd64/include/arch/cpuid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_CPUID_H_
-#define KERN_amd64_CPUID_H_
-
-#define AMD_CPUID_EXTENDED  0x80000001
-#define AMD_EXT_NOEXECUTE   20
-#define AMD_EXT_LONG_MODE   29
-
-#define INTEL_CPUID_LEVEL     0x00000000
-#define INTEL_CPUID_STANDARD  0x00000001
-#define INTEL_CPUID_EXTENDED  0x80000000
-#define INTEL_SSE2            26
-#define INTEL_FXSAVE          24
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct {
-	uint32_t cpuid_eax;
-	uint32_t cpuid_ebx;
-	uint32_t cpuid_ecx;
-	uint32_t cpuid_edx;
-} __attribute__((packed)) cpu_info_t;
-
-extern int has_cpuid(void);
-
-extern void cpuid(uint32_t cmd, cpu_info_t *info);
-
-#endif /* !def __ASSEMBLER__ */
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/cycle.h
===================================================================
--- kernel/arch/amd64/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_CYCLE_H_
-#define KERN_amd64_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	uint32_t lower;
-	uint32_t upper;
-
-	asm volatile (
-	    "rdtsc\n"
-	    : "=a" (lower),
-	      "=d" (upper)
-	);
-
-	return ((uint64_t) lower) | (((uint64_t) upper) << 32);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/ddi/ddi.h
===================================================================
--- kernel/arch/amd64/include/arch/ddi/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_ddi
- * @{
- */
-
-/**
- * @file
- * @brief amd64 specific DDI declarations and macros.
- */
-
-#ifndef KERN_amd64_DDI_H_
-#define KERN_amd64_DDI_H_
-
-extern void io_perm_bitmap_install(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/drivers
===================================================================
--- kernel/arch/amd64/include/arch/drivers	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/include/arch/drivers
Index: rnel/arch/amd64/include/arch/faddr.h
===================================================================
--- kernel/arch/amd64/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_FADDR_H_
-#define KERN_amd64_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/fpu_context.h
===================================================================
--- kernel/arch/amd64/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/include/arch/fpu_context.h
Index: rnel/arch/amd64/include/arch/interrupt.h
===================================================================
--- kernel/arch/amd64/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_INTERRUPT_H_
-#define KERN_amd64_INTERRUPT_H_
-
-#include <arch/istate.h>
-#include <arch/pm.h>
-#include <stdint.h>
-
-#define IVT_ITEMS  IDT_ITEMS
-#define IVT_FIRST  0
-
-#define EXC_COUNT  32
-#define IRQ_COUNT  16
-
-#define IVT_EXCBASE   0
-#define IVT_IRQBASE   (IVT_EXCBASE + EXC_COUNT)
-#define IVT_FREEBASE  (IVT_IRQBASE + IRQ_COUNT)
-
-#define EXC_DE 0
-#define EXC_NM 7
-#define EXC_SS 12
-#define EXC_GP 13
-#define EXC_PF 14
-
-#define IRQ_CLK       0
-#define IRQ_KBD       1
-#define IRQ_PIC1      2
-/* NS16550 at COM1 */
-#define IRQ_NS16550   4
-#define IRQ_PIC0_SPUR 7
-#define IRQ_MOUSE     12
-#define IRQ_PIC1_SPUR 15
-
-/* This one must have four least significant bits set to ones */
-#define VECTOR_APIC_SPUR  (IVT_ITEMS - 1)
-
-#if (((VECTOR_APIC_SPUR + 1) % 16) || VECTOR_APIC_SPUR >= IVT_ITEMS)
-#error Wrong definition of VECTOR_APIC_SPUR
-#endif
-
-#define VECTOR_DE                 (IVT_EXCBASE + EXC_DE)
-#define VECTOR_NM                 (IVT_EXCBASE + EXC_NM)
-#define VECTOR_SS                 (IVT_EXCBASE + EXC_SS)
-#define VECTOR_GP                 (IVT_EXCBASE + EXC_GP)
-#define VECTOR_PF                 (IVT_EXCBASE + EXC_PF)
-#define VECTOR_CLK                (IVT_IRQBASE + IRQ_CLK)
-#define VECTOR_PIC0_SPUR          (IVT_IRQBASE + IRQ_PIC0_SPUR)
-#define VECTOR_PIC1_SPUR          (IVT_IRQBASE + IRQ_PIC1_SPUR)
-#define VECTOR_SYSCALL            IVT_FREEBASE
-#define VECTOR_TLB_SHOOTDOWN_IPI  (IVT_FREEBASE + 1)
-#define VECTOR_DEBUG_IPI          (IVT_FREEBASE + 2)
-
-extern void interrupt_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/istate.h
===================================================================
--- kernel/arch/amd64/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_ISTATE_H_
-#define KERN_amd64_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-#include <arch/istate_struct.h>
-#else
-#include <libarch/istate_struct.h>
-#endif
-
-#define RPL_USER	3
-
-/** Return true if exception happened while in userspace */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return (istate->cs & RPL_USER) == RPL_USER;
-}
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->rip = retaddr;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->rip;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	return istate->rbp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_RAX         0x00
-#define ISTATE_OFFSET_RBX         0x08
-#define ISTATE_OFFSET_RCX         0x10
-#define ISTATE_OFFSET_RDX         0x18
-#define ISTATE_OFFSET_RSI         0x20
-#define ISTATE_OFFSET_RDI         0x28
-#define ISTATE_OFFSET_RBP         0x30
-#define ISTATE_OFFSET_R8          0x38
-#define ISTATE_OFFSET_R9          0x40
-#define ISTATE_OFFSET_R10         0x48
-#define ISTATE_OFFSET_R11         0x50
-#define ISTATE_OFFSET_R12         0x58
-#define ISTATE_OFFSET_R13         0x60
-#define ISTATE_OFFSET_R14         0x68
-#define ISTATE_OFFSET_R15         0x70
-#define ISTATE_OFFSET_ALIGNMENT   0x78
-#define ISTATE_OFFSET_RBP_FRAME   0x80
-#define ISTATE_OFFSET_RIP_FRAME   0x88
-#define ISTATE_OFFSET_ERROR_WORD  0x90
-#define ISTATE_OFFSET_RIP         0x98
-#define ISTATE_OFFSET_CS          0xa0
-#define ISTATE_OFFSET_RFLAGS      0xa8
-#define ISTATE_OFFSET_RSP         0xb0
-#define ISTATE_OFFSET_SS          0xb8
-#define ISTATE_SIZE               0xc0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct istate {
-	uint64_t rax;
-	uint64_t rbx;
-	uint64_t rcx;
-	uint64_t rdx;
-	uint64_t rsi;
-	uint64_t rdi;
-	uint64_t rbp;
-	uint64_t r8;
-	uint64_t r9;
-	uint64_t r10;
-	uint64_t r11;
-	uint64_t r12;
-	uint64_t r13;
-	uint64_t r14;
-	uint64_t r15;
-	/* align rbp_frame on multiple of 16 */
-	uint64_t alignment;
-	/* imitation of frame pointer linkage */
-	uint64_t rbp_frame;
-	/* imitation of frame address linkage */
-	uint64_t rip_frame;
-	/* real or fake error word */
-	uint64_t error_word;
-	uint64_t rip;
-	uint64_t cs;
-	uint64_t rflags;
-	/* only if istate_t is from uspace */
-	uint64_t rsp;
-	/* only if istate_t is from uspace */
-	uint64_t ss;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/amd64/include/arch/kseg.h
===================================================================
--- kernel/arch/amd64/include/arch/kseg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_KSEG_H_
-#define KERN_amd64_KSEG_H_
-
-extern void kseg_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/kseg_struct.h
===================================================================
--- kernel/arch/amd64/include/arch/kseg_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_KSEG_STRUCT_H_
-#define KERN_ARCH_KSEG_STRUCT_H_
-
-#define KSEG_OFFSET_USTACK_RSP  0x00
-#define KSEG_OFFSET_KSTACK_RSP  0x08
-#define KSEG_OFFSET_FSBASE      0x10
-#define KSEG_SIZE               0x18
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct kseg {
-	uint64_t ustack_rsp;
-	uint64_t kstack_rsp;
-	uint64_t fsbase;
-} kseg_t;
-
-#endif
-#endif
Index: rnel/arch/amd64/include/arch/mm/as.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_AS_H_
-#define KERN_amd64_AS_H_
-
-#define ADDRESS_SPACE_HOLE_START  UINT64_C(0x0000800000000000)
-#define ADDRESS_SPACE_HOLE_END    UINT64_C(0xffff7fffffffffff)
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xffff800000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0x00007fffffffffff)
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-
-#define as_install_arch(as)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/asid.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../ia32/include/arch/mm/asid.h
Index: rnel/arch/amd64/include/arch/mm/frame.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_FRAME_H_
-#define KERN_amd64_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0x1000
-
-#ifndef __ASSEMBLER__
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/km.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_KM_H_
-#define KERN_amd64_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#ifdef MEMORY_MODEL_kernel
-
-#define KM_AMD64_IDENTITY_START      UINT64_C(0xffffffff80000000)
-#define KM_AMD64_IDENTITY_SIZE       UINT64_C(0x0000000080000000)
-
-#define KM_AMD64_NON_IDENTITY_START  UINT64_C(0xffff800000000000)
-#define KM_AMD64_NON_IDENTITY_SIZE   UINT64_C(0x00007fff80000000)
-
-#endif /* MEMORY_MODEL_kernel */
-
-#ifdef MEMORY_MODEL_large
-
-#define KM_AMD64_IDENTITY_START      UINT64_C(0xffff800000000000)
-#define KM_AMD64_IDENTITY_SIZE       UINT64_C(0x0000400000000000)
-
-#define KM_AMD64_NON_IDENTITY_START  UINT64_C(0xffffc00000000000)
-#define KM_AMD64_NON_IDENTITY_SIZE   UINT64_C(0x0000400000000000)
-
-#endif /* MEMORY_MODEL_large */
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/page.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_PAGE_H_
-#define KERN_amd64_PAGE_H_
-
-#include <arch/mm/frame.h>
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#ifdef MEMORY_MODEL_kernel
-
-#ifndef __ASSEMBLER__
-
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffffffff80000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffffffff80000000))
-
-#else /* __ASSEMBLER__ */
-
-#define KA2PA(x)  ((x) - 0xffffffff80000000)
-#define PA2KA(x)  ((x) + 0xffffffff80000000)
-
-#endif /* __ASSEMBLER__ */
-
-#endif /* MEMORY_MODEL_kernel */
-
-#ifdef MEMORY_MODEL_large
-
-#ifndef __ASSEMBLER__
-
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
-
-#else /* __ASSEMBLER__ */
-
-#define KA2PA(x)  ((x) - 0xffff800000000000)
-#define PA2KA(x)  ((x) + 0xffff800000000000)
-
-#endif /* __ASSEMBLER__ */
-
-#endif /* MEMORY_MODEL_large */
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  512
-#define PTL1_ENTRIES_ARCH  512
-#define PTL2_ENTRIES_ARCH  512
-#define PTL3_ENTRIES_ARCH  512
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices into page tables in each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 39) & 0x1ffU)
-#define PTL1_INDEX_ARCH(vaddr)  (((vaddr) >> 30) & 0x1ffU)
-#define PTL2_INDEX_ARCH(vaddr)  (((vaddr) >> 21) & 0x1ffU)
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x1ffU)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	((pte_t *) (((uint64_t) ((pte_t *) (ptl0))[(i)].addr_12_51) << 12))
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	((pte_t *) (((uint64_t) ((pte_t *) (ptl1))[(i)].addr_12_51) << 12))
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	((pte_t *) (((uint64_t) ((pte_t *) (ptl2))[(i)].addr_12_51) << 12))
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	((uintptr_t *) (((uint64_t) ((pte_t *) (ptl3))[(i)].addr_12_51) << 12))
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0) \
-	(write_cr3((uintptr_t) (ptl0)))
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	set_pt_addr((pte_t *) (ptl0), (size_t) (i), a)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) \
-	set_pt_addr((pte_t *) (ptl1), (size_t) (i), a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) \
-	set_pt_addr((pte_t *) (ptl2), (size_t) (i), a)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	set_pt_addr((pte_t *) (ptl3), (size_t) (i), a)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	get_pt_flags((pte_t *) (ptl1), (size_t) (i))
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	get_pt_flags((pte_t *) (ptl2), (size_t) (i))
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x) \
-	set_pt_flags((pte_t *) (ptl1), (size_t) (i), (x))
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x) \
-	set_pt_flags((pte_t *) (ptl2), (size_t) (i), (x))
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i) \
-	set_pt_present((pte_t *) (ptl1), (size_t) (i))
-#define SET_PTL3_PRESENT_ARCH(ptl2, i) \
-	set_pt_present((pte_t *) (ptl2), (size_t) (i))
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last-level PTE entries. */
-#define PTE_VALID_ARCH(p) \
-	((p)->soft_valid != 0)
-#define PTE_PRESENT_ARCH(p) \
-	((p)->present != 0)
-#define PTE_GET_FRAME_ARCH(p) \
-	(((uintptr_t) (p)->addr_12_51) << 12)
-#define PTE_WRITABLE_ARCH(p) \
-	((p)->writeable != 0)
-#define PTE_EXECUTABLE_ARCH(p) \
-	((p)->no_execute == 0)
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-#include <mm/mm.h>
-#include <trace.h>
-#include <typedefs.h>
-
-/* Page fault error codes. */
-
-/** When bit on this position is 0, the page fault was caused by a not-present
- * page.
- */
-#define PFERR_CODE_P  (1 << 0)
-
-/** When bit on this position is 1, the page fault was caused by a write. */
-#define PFERR_CODE_RW  (1 << 1)
-
-/** When bit on this position is 1, the page fault was caused in user mode. */
-#define PFERR_CODE_US  (1 << 2)
-
-/** When bit on this position is 1, a reserved bit was set in page directory. */
-#define PFERR_CODE_RSVD  (1 << 3)
-
-/** When bit on this position os 1, the page fault was caused during instruction
- * fecth.
- */
-#define PFERR_CODE_ID  (1 << 4)
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned int present : 1;
-	unsigned int writeable : 1;
-	unsigned int uaccessible : 1;
-	unsigned int page_write_through : 1;
-	unsigned int page_cache_disable : 1;
-	unsigned int accessed : 1;
-	unsigned int dirty : 1;
-	unsigned int pat : 1;
-	unsigned int global : 1;
-	unsigned int soft_valid : 1;  /**< Valid content even if present bit is cleared. */
-	unsigned int avl : 2;
-	unsigned long addr_12_51 : 40;
-	unsigned int reserved : 11;
-	unsigned int no_execute : 1;
-} __attribute__((packed)) pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
-	    (!p->present) << PAGE_PRESENT_SHIFT |
-	    p->uaccessible << PAGE_USER_SHIFT |
-	    1 << PAGE_READ_SHIFT |
-	    p->writeable << PAGE_WRITE_SHIFT |
-	    (!p->no_execute) << PAGE_EXEC_SHIFT |
-	    p->global << PAGE_GLOBAL_SHIFT |
-	    p->page_write_through << PAGE_WRITE_COMBINE_SHIFT);
-}
-
-_NO_TRACE static inline void set_pt_addr(pte_t *pt, size_t i, uintptr_t a)
-{
-	pte_t *p = &pt[i];
-
-	p->addr_12_51 = (a >> 12) & UINT64_C(0xffffffffff);
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_t *p = &pt[i];
-
-	p->present = !(flags & PAGE_NOT_PRESENT);
-	p->uaccessible = (flags & PAGE_USER) != 0;
-	p->writeable = (flags & PAGE_WRITE) != 0;
-	p->no_execute = (flags & PAGE_EXEC) == 0;
-	p->global = (flags & PAGE_GLOBAL) != 0;
-
-	if (flags & PAGE_WRITE_COMBINE) {
-		/* We have mapped PCD+PWT bits to write-combine mode via PAT MSR. */
-		/* (If PAT is unsupported, it will default to uncached.) */
-		p->page_cache_disable = 1;
-		p->page_write_through = 1;
-	} else {
-		p->page_cache_disable = !(flags & PAGE_CACHEABLE);
-		p->page_write_through = 0;
-	}
-
-	/*
-	 * Ensure that there is at least one bit set even if the present bit is cleared.
-	 */
-	p->soft_valid = 1;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	p->present = 1;
-}
-
-extern void page_arch_init(void);
-extern void page_fault(unsigned int, istate_t *);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/pat.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/pat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2024 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_MM_PAT_H_
-#define KERN_amd64_MM_PAT_H_
-
-#include <arch/asm.h>
-#include <arch/cpuid.h>
-
-#define MSR_IA32_PAT  0x00000277
-
-typedef enum {
-	PAT_TYPE_UNCACHEABLE = 0,
-	PAT_TYPE_WRITE_COMBINING = 1,
-	PAT_TYPE_WRITE_THROUGH = 4,
-	PAT_TYPE_WRITE_PROTECTED = 5,
-	PAT_TYPE_WRITE_BACK = 6,
-	PAT_TYPE_UNCACHED  = 7,
-} pat_type_t;
-
-#ifndef PROCESSOR_i486
-/**
- * Assign caching type for a particular combination of PAT,
- * PCD and PWT bits in PTE.
- */
-static inline void pat_set_mapping(bool pat, bool pcd, bool pwt,
-    pat_type_t type)
-{
-	int index = pat << 2 | pcd << 1 | pwt;
-	int shift = index * 8;
-
-	uint64_t r = read_msr(MSR_IA32_PAT);
-	r &= ~(0xffull << shift);
-	r |= ((uint64_t) type) << shift;
-	write_msr(MSR_IA32_PAT, r);
-}
-#endif
-
-static inline bool pat_supported(void)
-{
-	if (!has_cpuid())
-		return false;
-
-	cpu_info_t info;
-	cpuid(INTEL_CPUID_STANDARD, &info);
-
-	return (info.cpuid_edx & (1 << 16)) != 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/ptl.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/ptl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_PTL_H_
-#define KERN_amd64_PTL_H_
-
-#define PTL_NO_EXEC        (1 << 63)
-#define PTL_ACCESSED       (1 << 5)
-#define PTL_CACHE_DISABLE  (1 << 4)
-#define PTL_CACHE_THROUGH  (1 << 3)
-#define PTL_USER           (1 << 2)
-#define PTL_WRITABLE       (1 << 1)
-#define PTL_PRESENT        1
-#define PTL_2MB_PAGE       (1 << 7)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/amd64/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_TLB_H_
-#define KERN_amd64_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/pm.h
===================================================================
--- kernel/arch/amd64/include/arch/pm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_PM_H_
-#define KERN_amd64_PM_H_
-
-#ifndef __ASSEMBLER__
-#include <typedefs.h>
-#include <arch/context.h>
-#endif
-
-#define IDT_ITEMS  64
-#define GDT_ITEMS  8
-
-#define NULL_DES     0
-/* Warning: Do not reorder the following items, unless you look into syscall.c! */
-#define KTEXT_DES    1
-#define KDATA_DES    2
-#define UDATA_DES    3
-#define UTEXT_DES    4
-#define KTEXT32_DES  5
-/* End of warning */
-#define TSS_DES      6
-
-#ifdef CONFIG_FB
-
-#define VESA_INIT_SEGMENT  0x8000
-#define VESA_INIT_CODE_DES      8
-#define VESA_INIT_DATA_DES      9
-
-#undef GDT_ITEMS
-#define GDT_ITEMS  10
-
-#endif /* CONFIG_FB */
-
-#define GDT_SELECTOR(des)  ((des) << 3)
-
-#define PL_KERNEL  0
-#define PL_USER    3
-
-#define AR_PRESENT    (1 << 7)
-#define AR_DATA       (2 << 3)
-#define AR_CODE       (3 << 3)
-#define AR_WRITABLE   (1 << 1)
-#define AR_READABLE   (1 << 1)
-#define AR_TSS        (0x09U)
-#define AR_INTERRUPT  (0x0eU)
-#define AR_TRAP       (0x0fU)
-
-#define DPL_KERNEL  (PL_KERNEL << 5)
-#define DPL_USER    (PL_USER << 5)
-
-#define TSS_BASIC_SIZE  104
-#define TSS_IOMAP_SIZE  (8 * 1024 + 1)  /* 8K for bitmap + 1 terminating byte for convenience */
-
-#define IO_PORTS  (64 * 1024)
-
-#ifndef __ASSEMBLER__
-
-typedef struct {
-	unsigned limit_0_15 : 16;
-	unsigned base_0_15 : 16;
-	unsigned base_16_23 : 8;
-	unsigned access : 8;
-	unsigned limit_16_19 : 4;
-	unsigned available : 1;
-	unsigned longmode : 1;
-	unsigned special : 1;
-	unsigned granularity : 1;
-	unsigned base_24_31 : 8;
-} __attribute__((packed)) descriptor_t;
-
-typedef struct {
-	unsigned limit_0_15 : 16;
-	unsigned base_0_15 : 16;
-	unsigned base_16_23 : 8;
-	unsigned type : 4;
-	unsigned : 1;
-	unsigned dpl : 2;
-	unsigned present : 1;
-	unsigned limit_16_19 : 4;
-	unsigned available : 1;
-	unsigned : 2;
-	unsigned granularity : 1;
-	unsigned base_24_31 : 8;
-	unsigned base_32_63 : 32;
-	unsigned  : 32;
-} __attribute__((packed)) tss_descriptor_t;
-
-typedef struct {
-	unsigned offset_0_15 : 16;
-	unsigned selector : 16;
-	unsigned ist : 3;
-	unsigned unused : 5;
-	unsigned type : 5;
-	unsigned dpl : 2;
-	unsigned present : 1;
-	unsigned offset_16_31 : 16;
-	unsigned offset_32_63 : 32;
-	unsigned  : 32;
-} __attribute__((packed)) idescriptor_t;
-
-typedef struct {
-	uint16_t limit;
-	uint64_t base;
-} __attribute__((packed)) ptr_16_64_t;
-
-typedef struct {
-	uint16_t limit;
-	uint32_t base;
-} __attribute__((packed)) ptr_16_32_t;
-
-typedef struct {
-	uint32_t reserve1;
-	uint64_t rsp0;
-	uint64_t rsp1;
-	uint64_t rsp2;
-	uint64_t reserve2;
-	uint64_t ist1;
-	uint64_t ist2;
-	uint64_t ist3;
-	uint64_t ist4;
-	uint64_t ist5;
-	uint64_t ist6;
-	uint64_t ist7;
-	uint64_t reserve3;
-	uint16_t reserve4;
-	uint16_t iomap_base;
-	uint8_t iomap[TSS_IOMAP_SIZE];
-} __attribute__((packed)) tss_t;
-
-extern tss_t *tss_p;
-
-extern descriptor_t gdt[];
-extern idescriptor_t idt[];
-
-extern ptr_16_64_t gdtr;
-extern ptr_16_32_t protected_ap_gdtr;
-
-extern void pm_init(void);
-
-extern void gdt_tss_setbase(descriptor_t *d, uintptr_t base);
-extern void gdt_tss_setlimit(descriptor_t *d, uint32_t limit);
-
-extern void idt_init(void);
-extern void idt_setoffset(idescriptor_t *d, uintptr_t offset);
-
-extern void tss_initialize(tss_t *t);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/proc/task.h
===================================================================
--- kernel/arch/amd64/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_TASK_H_
-#define KERN_amd64_TASK_H_
-
-#include <adt/bitmap.h>
-#include <stddef.h>
-
-typedef struct {
-	/** I/O Permission bitmap Generation counter. */
-	size_t iomapver;
-	/** I/O Permission bitmap. */
-	bitmap_t iomap;
-} task_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/proc/thread.h
===================================================================
--- kernel/arch/amd64/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_THREAD_H_
-#define KERN_amd64_THREAD_H_
-
-#include <stdint.h>
-
-typedef struct {
-	uint64_t kstack_rsp;
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/smp
===================================================================
--- kernel/arch/amd64/include/arch/smp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/include/arch/smp
Index: rnel/arch/amd64/include/arch/stack.h
===================================================================
--- kernel/arch/amd64/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_STACK_H_
-#define KERN_amd64_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/syscall.h
===================================================================
--- kernel/arch/amd64/include/arch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_SYSCALL_H_
-#define KERN_amd64_SYSCALL_H_
-
-extern void syscall_setup_cpu(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/types.h
===================================================================
--- kernel/arch/amd64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_TYPES_H_
-#define KERN_amd64_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/include/arch/vreg.h
===================================================================
--- kernel/arch/amd64/include/arch/vreg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_amd64_VREG_H_
-#define KERN_amd64_VREG_H_
-
-#define VREG_TP	0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-extern uint64_t *vreg_ptr;
-
-extern void vreg_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/amd64/meson.build
===================================================================
--- kernel/arch/amd64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/amd64.c',
-	'src/asm.S',
-	'src/bios/bios.c',
-	'src/boot/memmap.c',
-	'src/boot/multiboot2.S',
-	'src/boot/multiboot.S',
-	'src/context.S',
-	'src/cpu/cpu.c',
-	'src/ddi/ddi.c',
-	'src/debug/stacktrace_asm.S',
-	'src/debug/stacktrace.c',
-	'src/delay.S',
-	'src/drivers/i8254.c',
-	'src/fpu_context.c',
-	'src/interrupt.c',
-	'src/kseg.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/km.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/pm.c',
-	'src/proc/scheduler.c',
-	'src/proc/task.c',
-	'src/proc/thread.c',
-	'src/smc.c',
-	'src/syscall.c',
-	'src/userspace.c',
-	'src/vreg.c',
-)
-
-if CONFIG_SMP
-	arch_src += files(
-		'src/smp/apic.c',
-		'src/smp/ap.S',
-		'src/smp/ipi.c',
-		'src/smp/mps.c',
-		'src/smp/smp.c',
-	)
-endif
-
-_check_headers = [
-	'include/arch/boot/memmap_struct.h',
-	'include/arch/context_struct.h',
-	'include/arch/istate_struct.h',
-	'include/arch/kseg_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/amd64/src/amd64.c
===================================================================
--- kernel/arch/amd64/src/amd64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,292 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <stdint.h>
-#include <errno.h>
-#include <memw.h>
-#include <interrupt.h>
-#include <console/console.h>
-#include <syscall/syscall.h>
-#include <sysinfo/sysinfo.h>
-#include <arch/bios/bios.h>
-#include <arch/boot/boot.h>
-#include <arch/drivers/i8254.h>
-#include <arch/syscall.h>
-#include <genarch/acpi/acpi.h>
-#include <genarch/drivers/ega/ega.h>
-#include <genarch/drivers/i8042/i8042.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <genarch/drivers/ns16550/ns16550.h>
-#include <genarch/drivers/legacy/ia32/io.h>
-#include <genarch/fb/bfb.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/srln/srln.h>
-#include <genarch/multiboot/multiboot.h>
-#include <genarch/multiboot/multiboot2.h>
-#include <arch/pm.h>
-#include <arch/vreg.h>
-#include <arch/kseg.h>
-#include <arch/mm/pat.h>
-#include <genarch/pic/pic_ops.h>
-
-#ifdef CONFIG_SMP
-#include <arch/smp/apic.h>
-#endif
-
-static void amd64_pre_mm_init(void);
-static void amd64_post_mm_init(void);
-static void amd64_post_cpu_init(void);
-static void amd64_pre_smp_init(void);
-static void amd64_post_smp_init(void);
-
-arch_ops_t amd64_ops = {
-	.pre_mm_init = amd64_pre_mm_init,
-	.post_mm_init = amd64_post_mm_init,
-	.post_cpu_init = amd64_post_cpu_init,
-	.pre_smp_init = amd64_pre_smp_init,
-	.post_smp_init = amd64_post_smp_init
-};
-
-arch_ops_t *arch_ops = &amd64_ops;
-
-/** Perform amd64-specific initialization before main_bsp() is called.
- *
- * @param signature Multiboot signature.
- * @param info      Multiboot information structure.
- *
- */
-void amd64_pre_main(uint32_t signature, void *info)
-{
-	/* Parse multiboot information obtained from the bootloader. */
-	multiboot_info_parse(signature, (multiboot_info_t *) info);
-	multiboot2_info_parse(signature, (multiboot2_info_t *) info);
-
-#ifdef CONFIG_SMP
-	size_t unmapped_size = (uintptr_t) unmapped_end - BOOT_OFFSET;
-	/* Copy AP bootstrap routines below 1 MB. */
-	memcpy((void *) AP_BOOT_OFFSET, (void *) BOOT_OFFSET, unmapped_size);
-#endif
-}
-
-void amd64_pre_mm_init(void)
-{
-	/* Enable no-execute pages */
-	write_msr(AMD_MSR_EFER, read_msr(AMD_MSR_EFER) | AMD_NXE);
-	/* Enable FPU */
-	cpu_setup_fpu();
-
-	/* Initialize segmentation */
-	pm_init();
-
-	/* Disable I/O on nonprivileged levels, clear the nested-thread flag */
-	write_rflags(read_rflags() & ~(RFLAGS_IOPL | RFLAGS_NT));
-	/* Disable alignment check */
-	write_cr0(read_cr0() & ~CR0_AM);
-
-	/* Use PCD+PWT bit combination in PTE to mean write-combining mode. */
-	if (pat_supported())
-		pat_set_mapping(false, true, true, PAT_TYPE_WRITE_COMBINING);
-
-	if (config.cpu_active == 1) {
-		interrupt_init();
-		bios_init();
-
-		/* PIC */
-		i8259_init((i8259_t *) I8259_PIC0_BASE,
-		    (i8259_t *) I8259_PIC1_BASE, IVT_IRQBASE);
-
-		/* Set PIC operations. */
-		pic_ops = &i8259_pic_ops;
-	}
-}
-
-void amd64_post_mm_init(void)
-{
-	vreg_init();
-	kseg_init();
-
-	if (config.cpu_active == 1) {
-		/* Initialize IRQ routing */
-		irq_init(IRQ_COUNT, IRQ_COUNT);
-
-		/* hard clock */
-		i8254_init();
-
-#if (defined(CONFIG_FB) || defined(CONFIG_EGA))
-		bool bfb = false;
-#endif
-
-#ifdef CONFIG_FB
-		bfb = bfb_init();
-#endif
-
-#ifdef CONFIG_EGA
-		if (!bfb) {
-			outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
-			if (egadev)
-				stdout_wire(egadev);
-		}
-#endif
-
-		/* Merge all memory zones to 1 big zone */
-		zone_merge_all();
-	}
-
-	/* Setup fast SYSCALL/SYSRET */
-	syscall_setup_cpu();
-}
-
-void amd64_post_cpu_init(void)
-{
-#ifdef CONFIG_SMP
-	if (config.cpu_active > 1) {
-		l_apic_init();
-		l_apic_debug();
-	}
-#endif
-}
-
-void amd64_pre_smp_init(void)
-{
-	if (config.cpu_active == 1) {
-#ifdef CONFIG_SMP
-		acpi_init();
-#endif /* CONFIG_SMP */
-	}
-}
-
-void amd64_post_smp_init(void)
-{
-	/* Currently the only supported platform for amd64 is 'pc'. */
-	static const char *platform = "pc";
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-#ifdef CONFIG_PC_KBD
-	/*
-	 * Initialize the i8042 controller. Then initialize the keyboard
-	 * module and connect it to i8042. Enable keyboard interrupts.
-	 */
-	i8042_instance_t *i8042_instance = i8042_init((i8042_t *) I8042_BASE, IRQ_KBD);
-	if (i8042_instance) {
-		kbrd_instance_t *kbrd_instance = kbrd_init();
-		if (kbrd_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-			i8042_wire(i8042_instance, kbrd);
-			pic_ops->enable_irqs(1 << IRQ_KBD);
-			pic_ops->enable_irqs(1 << IRQ_MOUSE);
-		}
-	}
-#endif
-
-#if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT))
-	/*
-	 * Initialize the ns16550 controller.
-	 */
-#ifdef CONFIG_NS16550_OUT
-	outdev_t *ns16550_out;
-	outdev_t **ns16550_out_ptr = &ns16550_out;
-#else
-	outdev_t **ns16550_out_ptr = NULL;
-#endif
-	ns16550_instance_t *ns16550_instance =
-	    ns16550_init(NS16550_BASE, 0, IRQ_NS16550, NULL, NULL,
-	    ns16550_out_ptr);
-	if (ns16550_instance) {
-		ns16550_format_set(ns16550_instance, 38400,
-		    LCR_PARITY_NONE | LCR_STOP_BIT_TWO | LCR_WORD_LEN_8);
-#ifdef CONFIG_NS16550
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			ns16550_wire(ns16550_instance, srln);
-			pic_ops->enable_irqs(1 << IRQ_NS16550);
-		}
-#endif
-#ifdef CONFIG_NS16550_OUT
-		if (ns16550_out) {
-			stdout_wire(ns16550_out);
-		}
-#endif
-	}
-#endif
-
-	sysinfo_set_item_val(pic_ops->get_name(), NULL, true);
-}
-
-void calibrate_delay_loop(void)
-{
-	i8254_calibrate_delay_loop();
-	if (config.cpu_active == 1) {
-		/*
-		 * This has to be done only on UP.
-		 * On SMP, i8254 is not used for time keeping and its interrupt pin remains masked.
-		 */
-		i8254_normal_operation();
-	}
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void arch_reboot(void)
-{
-#ifdef CONFIG_PC_KBD
-	i8042_cpu_reset((i8042_t *) I8042_BASE);
-#endif
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/asm.S
===================================================================
--- kernel/arch/amd64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,550 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/pm.h>
-#include <arch/mm/page.h>
-#include <arch/istate_struct.h>
-#include <arch/kseg_struct.h>
-#include <arch/cpu.h>
-#include <arch/smp/apic.h>
-
-.text
-
-#define MEMCPY_DST   %rdi
-#define MEMCPY_SRC   %rsi
-#define MEMCPY_SIZE  %rdx
-
-/**
- * Copy memory from/to userspace.
- *
- * This is almost conventional memcpy().
- * The difference is that there is a failover part
- * to where control is returned from a page fault if
- * the page fault occurs during copy_from_uspace()
- * or copy_to_uspace().
- *
- * @param MEMCPY_DST  Destination address.
- * @param MEMCPY_SRC  Source address.
- * @param MEMCPY_SIZE Number of bytes to copy.
- *
- * @retrun MEMCPY_DST on success, 0 on failure.
- *
- */
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	movq MEMCPY_DST, %rax
-
-	movq MEMCPY_SIZE, %rcx
-	shrq $3, %rcx           /* size / 8 */
-
-	rep movsq               /* copy as much as possible word by word */
-
-	movq MEMCPY_SIZE, %rcx
-	andq $7, %rcx           /* size % 8 */
-	jz 0f
-
-	rep movsb               /* copy the rest byte by byte */
-
-	0:
-		ret                 /* return MEMCPY_DST, success */
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	xorl %eax, %eax         /* return 0, failure */
-	ret
-
-/** Determine CPUID support
-*
-* @return 0 in EAX if CPUID is not support, 1 if supported.
-*
-*/
-FUNCTION_BEGIN(has_cpuid)
-	/* Load RFLAGS */
-	pushfq
-	popq %rax
-	movq %rax, %rdx
-
-	/* Flip the ID bit */
-	xorl $RFLAGS_ID, %edx
-
-	/* Store RFLAGS */
-	pushq %rdx
-	popfq
-	pushfq
-
-	/* Get the ID bit again */
-	popq %rdx
-	andl $RFLAGS_ID, %eax
-	andl $RFLAGS_ID, %edx
-
-	/* 0 if not supported, 1 if supported */
-	xorl %edx, %eax
-	ret
-FUNCTION_END(has_cpuid)
-
-FUNCTION_BEGIN(cpuid)
-	/* Preserve %rbx across function calls */
-	movq %rbx, %r10
-
-	/* Load the command into %eax */
-	movl %edi, %eax
-
-	cpuid
-	movl %eax, 0(%rsi)
-	movl %ebx, 4(%rsi)
-	movl %ecx, 8(%rsi)
-	movl %edx, 12(%rsi)
-
-	movq %r10, %rbx
-	ret
-FUNCTION_END(cpuid)
-
-/** Enable local APIC
- *
- * Enable local APIC in MSR.
- *
- */
-FUNCTION_BEGIN(enable_l_apic_in_msr)
-	movl $AMD_MSR_APIC_BASE, %ecx
-	rdmsr
-	orl $(L_APIC_BASE | AMD_APIC_BASE_GE), %eax
-	wrmsr
-	ret
-FUNCTION_END(enable_l_apic_in_msr)
-
-/*
- * Size of the istate structure without the hardware-saved part and without the
- * error word.
- */
-#define ISTATE_SOFT_SIZE	ISTATE_SIZE - (6 * 8)
-
-/**
- * Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int
- * has no error word  and 1 means interrupt with error word
- *
- */
-#define ERROR_WORD_INTERRUPT_LIST  0x00027D00
-
-.macro handler i
-SYMBOL(int_\i)
-
-	/*
-	 * Choose between version with error code and version without error
-	 * code.
-	 */
-
-	.iflt \i-32
-		.if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
-			/*
-			 * Version with error word.
-			 */
-			subq $ISTATE_SOFT_SIZE, %rsp
-		.else
-			/*
-			 * Version without error word.
-			 */
-			subq $(ISTATE_SOFT_SIZE + 8), %rsp
-		.endif
-	.else
-		/*
-		 * Version without error word.
-		 */
-		subq $(ISTATE_SOFT_SIZE + 8), %rsp
-	.endif
-
-	/*
-	 * Save the general purpose registers.
-	 */
-	movq %rax, ISTATE_OFFSET_RAX(%rsp)
-	movq %rbx, ISTATE_OFFSET_RBX(%rsp)
-	movq %rcx, ISTATE_OFFSET_RCX(%rsp)
-	movq %rdx, ISTATE_OFFSET_RDX(%rsp)
-	movq %rsi, ISTATE_OFFSET_RSI(%rsp)
-	movq %rdi, ISTATE_OFFSET_RDI(%rsp)
-	movq %rbp, ISTATE_OFFSET_RBP(%rsp)
-	movq %r8, ISTATE_OFFSET_R8(%rsp)
-	movq %r9, ISTATE_OFFSET_R9(%rsp)
-	movq %r10, ISTATE_OFFSET_R10(%rsp)
-	movq %r11, ISTATE_OFFSET_R11(%rsp)
-	movq %r12, ISTATE_OFFSET_R12(%rsp)
-	movq %r13, ISTATE_OFFSET_R13(%rsp)
-	movq %r14, ISTATE_OFFSET_R14(%rsp)
-	movq %r15, ISTATE_OFFSET_R15(%rsp)
-
-	/*
-	 * Is this trap from the kernel?
-	 */
-	cmpq $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%rsp)
-	jz 0f
-
-	/*
-	 * Switch to kernel FS base.
-	 */
-	swapgs
-	movl $AMD_MSR_FS, %ecx
-	movl %gs:KSEG_OFFSET_FSBASE, %eax
-	movl %gs:KSEG_OFFSET_FSBASE+4, %edx
-	wrmsr
-	swapgs
-
-	/*
-	 * Imitate a regular stack frame linkage.
-	 * Stop stack traces here if we came from userspace.
-	 */
-0:	movl $0x0, %edx
-	cmovnzq %rdx, %rbp
-
-	movq %rbp, ISTATE_OFFSET_RBP_FRAME(%rsp)
-	movq ISTATE_OFFSET_RIP(%rsp), %rax
-	movq %rax, ISTATE_OFFSET_RIP_FRAME(%rsp)
-	leaq ISTATE_OFFSET_RBP_FRAME(%rsp), %rbp
-
-	movq $(\i), %rdi   /* pass intnum in the first argument */
-	movq %rsp, %rsi    /* pass istate address in the second argument */
-
-	cld
-
-	/* Call exc_dispatch(i, istate) */
-	call exc_dispatch
-
-	/*
-	 * Restore all scratch registers and the preserved registers we have
-	 * clobbered in this handler (i.e. RBP).
-	 */
-	movq ISTATE_OFFSET_RAX(%rsp), %rax
-	movq ISTATE_OFFSET_RCX(%rsp), %rcx
-	movq ISTATE_OFFSET_RDX(%rsp), %rdx
-	movq ISTATE_OFFSET_RSI(%rsp), %rsi
-	movq ISTATE_OFFSET_RDI(%rsp), %rdi
-	movq ISTATE_OFFSET_RBP(%rsp), %rbp
-	movq ISTATE_OFFSET_R8(%rsp), %r8
-	movq ISTATE_OFFSET_R9(%rsp), %r9
-	movq ISTATE_OFFSET_R10(%rsp), %r10
-	movq ISTATE_OFFSET_R11(%rsp), %r11
-
-	/* $8 = Skip error word */
-	addq $(ISTATE_SOFT_SIZE + 8), %rsp
-	iretq
-.endm
-
-#define LIST_0_63 \
-	0, 1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,\
-	28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,\
-	53,54,55,56,57,58,59,60,61,62,63
-
-SYMBOL(interrupt_handlers)
-.irp cnt, LIST_0_63
-	handler \cnt
-.endr
-
-/** Low-level syscall handler
- *
- * Registers on entry:
- *
- * @param %rcx Userspace return address.
- * @param %r11 Userspace RLFAGS.
- *
- * @param %rax Syscall number.
- * @param %rdi 1st syscall argument.
- * @param %rsi 2nd syscall argument.
- * @param %rdx 3rd syscall argument.
- * @param %r10 4th syscall argument. Used instead of RCX because
- *             the SYSCALL instruction clobbers it.
- * @param %r8  5th syscall argument.
- * @param %r9  6th syscall argument.
- *
- * @return Return value is in %rax.
- *
- */
-SYMBOL(syscall_entry)
-	/* Switch to hidden %gs */
-	swapgs
-
-	movq %rsp, %gs:KSEG_OFFSET_USTACK_RSP  /* save this thread's user RSP */
-	movq %gs:KSEG_OFFSET_KSTACK_RSP, %rsp  /* set this thread's kernel RSP */
-
-	/*
-	 * Note that the space needed for the imitated istate structure has been
-	 * preallocated for us in thread_create_arch() and set in
-	 * before_thread_runs_arch().
-	 */
-
-	/*
-	 * Save the general purpose registers and push the 7th argument (syscall
-	 * number) onto the stack. Note that the istate structure has a layout
-	 * which supports this.
-	 */
-	movq %rax, ISTATE_OFFSET_RAX(%rsp)  /* 7th argument, passed on stack */
-	movq %rbx, ISTATE_OFFSET_RBX(%rsp)  /* observability */
-	movq %rcx, ISTATE_OFFSET_RCX(%rsp)  /* userspace RIP */
-	movq %rdx, ISTATE_OFFSET_RDX(%rsp)  /* 3rd argument, observability */
-	movq %rsi, ISTATE_OFFSET_RSI(%rsp)  /* 2nd argument, observability */
-	movq %rdi, ISTATE_OFFSET_RDI(%rsp)  /* 1st argument, observability */
-	movq %rbp, ISTATE_OFFSET_RBP(%rsp)  /* need to preserve userspace RBP */
-	movq %r8, ISTATE_OFFSET_R8(%rsp)    /* 5th argument, observability */
-	movq %r9, ISTATE_OFFSET_R9(%rsp)    /* 6th argument, observability */
-	movq %r10, ISTATE_OFFSET_R10(%rsp)  /* 4th argument, observability */
-	movq %r11, ISTATE_OFFSET_R11(%rsp)  /* low 32 bits userspace RFLAGS */
-	movq %r12, ISTATE_OFFSET_R12(%rsp)  /* observability */
-	movq %r13, ISTATE_OFFSET_R13(%rsp)  /* observability */
-	movq %r14, ISTATE_OFFSET_R14(%rsp)  /* observability */
-	movq %r15, ISTATE_OFFSET_R15(%rsp)  /* observability */
-
-	/*
-	 * Switch to kernel FS base.
-	 */
-	movl $AMD_MSR_FS, %ecx
-	movl %gs:KSEG_OFFSET_FSBASE, %eax
-	movl %gs:KSEG_OFFSET_FSBASE+4, %edx
-	wrmsr
-	movq ISTATE_OFFSET_RDX(%rsp), %rdx	/* restore 3rd argument */
-
-	/*
-	 * Save the return address and the userspace stack on locations that
-	 * would normally be taken by them.
-	 */
-	movq %gs:KSEG_OFFSET_USTACK_RSP, %rax
-	movq %rax, ISTATE_OFFSET_RSP(%rsp)
-	movq %rcx, ISTATE_OFFSET_RIP(%rsp)
-
-	/*
-	 * Imitate a regular stack frame linkage.
-	 */
-	movq $0, ISTATE_OFFSET_RBP_FRAME(%rsp)
-	movq %rcx, ISTATE_OFFSET_RIP_FRAME(%rsp)
-	leaq ISTATE_OFFSET_RBP_FRAME(%rsp), %rbp
-
-	/* Switch back to normal %gs */
-	swapgs
-	sti
-
-	/* Copy the 4th argument where it is expected  */
-	movq %r10, %rcx
-
-	/*
-	 * Call syscall_handler() with the 7th argument passed on stack.
-	 */
-	call syscall_handler
-
-	/*
-	 * Test if the saved return address is canonical and not-kernel.
-	 * We do this by looking at the 16 most significant bits
-	 * of the saved return address (two bytes at offset 6).
-	 */
-	testw $0xffff, ISTATE_OFFSET_RIP+6(%rsp)
-	jnz bad_rip
-
-	cli
-
-	/*
-	 * Restore registers needed for return via the SYSRET instruction and
-	 * the clobbered preserved registers (i.e. RBP).
-	 */
-	movq ISTATE_OFFSET_RBP(%rsp), %rbp
-	movq ISTATE_OFFSET_RCX(%rsp), %rcx
-	movq ISTATE_OFFSET_R11(%rsp), %r11
-	movq ISTATE_OFFSET_RSP(%rsp), %rsp
-
-	/*
-	 * Clear the rest of the scratch registers to prevent information leak.
-	 * The 32-bit XOR on the low GPRs actually clears the entire 64-bit
-	 * register and the instruction is shorter.
-	 */
-	xorl %edx, %edx
-	xorl %esi, %esi
-	xorl %edi, %edi
-	xorq %r8, %r8
-	xorq %r9, %r9
-	xorq %r10, %r10
-
-	sysretq
-
-bad_rip:
-	movq %rsp, %rdi
-	movabs $bad_rip_msg, %rsi
-	xorb %al, %al
-	callq fault_from_uspace
-	/* not reached */
-
-bad_rip_msg:
-	.asciz "Invalid instruction pointer."
-
-/** Print Unicode character to an early display device.
- *
- * Since the EGA can only display Extended ASCII (usually
- * ISO Latin 1) characters, some of the Unicode characters
- * can be displayed in a wrong way. Only newline and backspace
- * are interpreted, all other characters (even unprintable) are
- * printed verbatim.
- *
- * @param %rdi Unicode character to be printed.
- *
- */
-FUNCTION_BEGIN(early_putuchar)
-
-#if (defined(CONFIG_DEBUG_EARLY_PRINT))
-
-#if (defined(CONFIG_L4RE_UVMM_EARLY_PRINT))
-	xorl %eax, %eax  /* RAX==0: uvmm's print hypercall */
-	mov %rdi, %rcx   /* RCX:    printed character */
-	vmcall
-#endif
-
-#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
-	/* Prologue, save preserved registers */
-	pushq %rbp
-	movq %rsp, %rbp
-	pushq %rbx
-
-	movq %rdi, %rsi
-	movq $(PA2KA(0xb8000)), %rdi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb early_putuchar_cursor_ok
-
-		movw $1998, %ax
-
-	early_putuchar_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %rax
-	addq %rax, %rdi
-
-	movq %rsi, %rax
-
-	cmp $0x0a, %al
-	jne early_putuchar_backspace
-
-		/* Interpret newline */
-
-		movw %bx, %ax  /* %bx -> %dx:%ax */
-		xorw %dx, %dx
-
-		movw $80, %cx
-		idivw %cx, %ax  /* %dx = %bx % 80 */
-
-		/* %bx <- %bx + 80 - (%bx % 80) */
-		addw %cx, %bx
-		subw %dx, %bx
-
-		jmp early_putuchar_skip
-
-	early_putuchar_backspace:
-
-		cmp $0x08, %al
-		jne early_putuchar_print
-
-		/* Interpret backspace */
-
-		cmp $0x0000, %bx
-		je early_putuchar_skip
-
-		dec %bx
-		jmp early_putuchar_skip
-
-	early_putuchar_print:
-
-		/* Print character */
-
-		movb $0x0e, %ah  /* black background, yellow foreground */
-		stosw
-		inc %bx
-
-	early_putuchar_skip:
-
-	/* Sanity check for the cursor on the last line */
-	cmp $2000, %bx
-	jb early_putuchar_no_scroll
-
-		/* Scroll the screen (24 rows) */
-		movq $(PA2KA(0xb80a0)), %rsi
-		movq $(PA2KA(0xb8000)), %rdi
-		movl $480, %ecx
-		rep movsq
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $20, %ecx
-		rep stosq
-
-		/* Go to row 24 */
-		movw $1920, %bx
-
-	early_putuchar_no_scroll:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	/* Epilogue, restore preserved registers */
-	popq %rbx
-	leave
-
-#endif
-
-#endif
-
-	ret
-FUNCTION_END(early_putuchar)
Index: rnel/arch/amd64/src/bios
===================================================================
--- kernel/arch/amd64/src/bios	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../ia32/src/bios
Index: rnel/arch/amd64/src/boot/memmap.c
===================================================================
--- kernel/arch/amd64/src/boot/memmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/boot/memmap.h>
-
-uint8_t e820counter = 0;
-e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
-
-/** @}
- */
Index: rnel/arch/amd64/src/boot/multiboot.S
===================================================================
--- kernel/arch/amd64/src/boot/multiboot.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,721 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-#include <arch/mm/ptl.h>
-#include <arch/pm.h>
-#include <genarch/multiboot/multiboot.h>
-#include <arch/cpuid.h>
-#include <arch/cpu.h>
-
-#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.macro pm_error msg
-	movl \msg, %esi
-	jmp pm_error_halt
-.endm
-
-.macro pm_status msg
-#ifdef CONFIG_EGA
-	pushl %esi
-	movl \msg, %esi
-	call pm_early_puts
-	popl %esi
-#endif
-.endm
-
-.macro pm2_status msg
-#ifndef CONFIG_FB
-	pm_status \msg
-#endif
-.endm
-
-.align 4
-multiboot_header:
-	.long MULTIBOOT_HEADER_MAGIC
-	.long MULTIBOOT_HEADER_FLAGS
-	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)  /* checksum */
-	.long multiboot_header
-	.long unmapped_start
-	.long 0
-	.long 0
-	.long multiboot_image_start
-
-SYMBOL(multiboot_image_start)
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/*
-	 * Initialize Global Descriptor Table and
-	 * Interrupt Descriptor Table registers
-	 */
-	lgdtl bootstrap_gdtr
-	lidtl bootstrap_idtr
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %ds
-	movw %cx, %ss
-
-	/*
-	 * Simics seems to remove hidden part of GS on entering user mode
-	 * when _visible_ part of GS does not point to user-mode segment.
-	 */
-	movw $GDT_SELECTOR(UDATA_DES), %cx
-	movw %cx, %fs
-	movw %cx, %gs
-
-	jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot_meeting_point
-	multiboot_meeting_point:
-
-	/*
-	 * Protected 32-bit. We want to reuse the code-seg descriptor,
-	 * the Default operand size must not be 1 when entering long mode.
-	 */
-
-	/* Save multiboot arguments */
-	movl %eax, multiboot_eax
-	movl %ebx, multiboot_ebx
-
-	pm_status $status_prot
-
-	movl $(INTEL_CPUID_EXTENDED), %eax
-	cpuid
-	cmp $(INTEL_CPUID_EXTENDED), %eax
-	ja extended_cpuid_supported
-
-		pm_error $err_extended_cpuid
-
-	extended_cpuid_supported:
-
-	movl $(AMD_CPUID_EXTENDED), %eax
-	cpuid
-	bt $(AMD_EXT_LONG_MODE), %edx
-	jc long_mode_supported
-
-		pm_error $err_long_mode
-
-	long_mode_supported:
-
-	bt $(AMD_EXT_NOEXECUTE), %edx
-	jc noexecute_supported
-
-		pm_error $err_noexecute
-
-	noexecute_supported:
-
-	movl $(INTEL_CPUID_STANDARD), %eax
-	cpuid
-	bt $(INTEL_FXSAVE), %edx
-	jc fx_supported
-
-		pm_error $err_fx
-
-	fx_supported:
-
-	bt $(INTEL_SSE2), %edx
-	jc sse2_supported
-
-		pm_error $err_sse2
-
-	sse2_supported:
-
-#include "vesa_prot.inc"
-
-	pm2_status $status_prot2
-
-	/*
-	 * Enable 64-bit page translation entries - CR4.PAE = 1.
-	 * Paging is not enabled until after long mode is enabled.
-	 */
-
-	movl %cr4, %eax
-	orl $CR4_PAE, %eax
-	movl %eax, %cr4
-
-	/* Set up paging tables */
-	leal ptl_0, %eax
-	movl %eax, %cr3
-
-	/* Enable long mode */
-	movl $AMD_MSR_EFER, %ecx
-	rdmsr                     /* read EFER */
-	orl $AMD_LME, %eax        /* set LME = 1 */
-	wrmsr
-
-	/* Enable paging to activate long mode (set CR0.PG = 1) */
-	movl %cr0, %eax
-	orl $CR0_PG, %eax
-	movl %eax, %cr0
-
-	/* At this point we are in compatibility mode */
-	jmpl $GDT_SELECTOR(KTEXT_DES), $start64
-
-/** Print string to EGA display (in light red) and halt.
- *
- * Should be executed from 32 bit protected mode with paging
- * turned off. Stack is not required. This routine is used even
- * if CONFIG_EGA is not enabled. Since we are going to halt the
- * CPU anyway, it is always better to at least try to print
- * some hints.
- *
- * @param %esi Pointer to the NULL-terminated string
- *             to be print.
- *
- */
-pm_error_halt:
-	movl $0xb8000, %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb err_cursor_ok
-
-		movw $1998, %ax
-
-	err_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	err_ploop:
-		lodsb
-
-		cmp $0, %al
-		je err_ploop_end
-
-		movb $0x0c, %ah  /* black background, light red foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb err_ploop
-
-		/* Scroll the screen (24 rows) */
-		movl %esi, %edx
-		movl $0xb80a0, %esi
-		movl $0xb8000, %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movl %edx, %esi
-		movl $0xb8f00, %edi
-		movw $1920, %bx
-
-		jmp err_ploop
-	err_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	cli
-	hlt1:
-		hlt
-		jmp hlt1
-
-/** Print string to EGA display (in light green).
- *
- * Should be called from 32 bit protected mode with paging
- * turned off. A stack space of at least 24 bytes is required,
- * but the function does not establish a stack frame.
- *
- * Macros such as pm_status and pm2_status take care that
- * this function is used only when CONFIG_EGA is enabled
- * and CONFIG_FB is disabled.
- *
- * @param %esi Pointer to the NULL-terminated string
- *             to be print.
- *
- */
-pm_early_puts:
-	pushl %eax
-	pushl %ebx
-	pushl %ecx
-	pushl %edx
-	pushl %edi
-
-	movl $0xb8000, %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb pm_puts_cursor_ok
-
-		movw $1998, %ax
-
-	pm_puts_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	pm_puts_ploop:
-		lodsb
-
-		cmp $0, %al
-		je pm_puts_ploop_end
-
-		movb $0x0a, %ah  /* black background, light green foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb pm_puts_ploop
-
-		/* Scroll the screen (24 rows) */
-		movl %esi, %edx
-		movl $0xb80a0, %esi
-		movl $0xb8000, %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movl %edx, %esi
-		movl $0xb8f00, %edi
-		movw $1920, %bx
-
-		jmp pm_puts_ploop
-	pm_puts_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	popl %edi
-	popl %edx
-	popl %ecx
-	popl %ebx
-	popl %eax
-
-	ret
-
-.code64
-
-.macro long_status msg
-	pushq %rdi
-	movq \msg, %rdi
-	call early_puts
-	popq %rdi
-.endm
-
-start64:
-
-	/*
-	 * Long mode.
-	 */
-
-	movq $(PA2KA(START_STACK)), %rsp
-
-	/* Create the first stack frame */
-	pushq $0
-	movq %rsp, %rbp
-
-	long_status $status_long
-
-	/* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
-	movl multiboot_eax, %edi
-	movl multiboot_ebx, %esi
-
-#ifdef MEMORY_MODEL_large
-	movabsq $amd64_pre_main, %rax
-	callq *%rax
-#else
-	callq amd64_pre_main
-#endif
-
-	long_status $status_main
-
-	/* Call main_bsp() */
-#ifdef MEMORY_MODEL_large
-	movabsq $main_bsp, %rax
-	callq *%rax
-#else
-	callq main_bsp
-#endif
-
-	/* Not reached */
-	cli
-	hlt0:
-		hlt
-		jmp hlt0
-
-/** Print string to EGA display.
- *
- * Should be called from long mode (with paging enabled
- * and stack established). This function is ABI compliant
- * (without red-zone).
- *
- * If CONFIG_EGA is undefined or CONFIG_FB is defined
- * then this function does nothing.
- *
- * @param %rdi Pointer to the NULL-terminated string
- *             to be printed.
- *
- */
-early_puts:
-
-#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
-	/* Prologue, save preserved registers */
-	pushq %rbp
-	movq %rsp, %rbp
-	pushq %rbx
-
-	movq %rdi, %rsi
-	movq $(PA2KA(0xb8000)), %rdi  /* base of EGA text mode memory */
-	xorq %rax, %rax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb early_puts_cursor_ok
-
-		movw $1998, %ax
-
-	early_puts_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %rax
-	addq %rax, %rdi
-
-	early_puts_ploop:
-		lodsb
-
-		cmp $0, %al
-		je early_puts_ploop_end
-
-		movb $0x0e, %ah  /* black background, yellow foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb early_puts_ploop
-
-		/* Scroll the screen (24 rows) */
-		movq %rsi, %rdx
-		movq $(PA2KA(0xb80a0)), %rsi
-		movq $(PA2KA(0xb8000)), %rdi
-		movl $480, %ecx
-		rep movsq
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $20, %ecx
-		rep stosq
-
-		/* Go to row 24 */
-		movq %rdx, %rsi
-		movq $(PA2KA(0xb8f00)), %rdi
-		movw $1920, %bx
-
-		jmp early_puts_ploop
-	early_puts_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	/* Epilogue, restore preserved registers */
-	popq %rbx
-	leave
-
-#endif
-
-	ret
-
-#include "vesa_real.inc"
-
-.section K_INI_PTLS, "aw", @progbits
-
-/** Generate initial page table contents.
- *
- * @param cnt Number of entries to generate. Must be multiple of 8.
- * @param g   Number of GB that will be added to the mapping.
- *
- */
-.macro ptl2gen cnt g
-	.if \cnt
-		ptl2gen "\cnt - 8" \g
-		.quad ((\cnt - 8) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 7) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 6) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 5) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 4) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 3) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 2) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-		.quad ((\cnt - 1) * 0x200000) + (\g * 1024 * 1024 * 1024) | (PTL_WRITABLE | PTL_PRESENT | PTL_2MB_PAGE)
-	.endif
-.endm
-
-/* Page table for pages in the 1st gigabyte. */
-.align 4096
-ptl_2_0g:
-	ptl2gen 512 0
-
-/* Page table for pages in the 2nd gigabyte. */
-.align 4096
-ptl_2_1g:
-	ptl2gen 512 1
-
-/* Page table for pages in the 3rd gigabyte. */
-.align 4096
-ptl_2_2g:
-	ptl2gen 512 2
-
-/* Page table for pages in the 4th gigabyte. */
-.align 4096
-ptl_2_3g:
-	ptl2gen 512 3
-
-/* Page table for pages in the 5th gigabyte. */
-.align 4096
-ptl_2_4g:
-	ptl2gen 512 4
-
-/* Page table for pages in the 6th gigabyte. */
-.align 4096
-ptl_2_5g:
-	ptl2gen 512 5
-
-/* Page table for pages in the 7th gigabyte. */
-.align 4096
-ptl_2_6g:
-	ptl2gen 512 6
-
-/* Page table for pages in the 8th gigabyte. */
-.align 4096
-ptl_2_7g:
-	ptl2gen 512 7
-
-#ifdef MEMORY_MODEL_kernel
-.align 4096
-ptl_1:
-	/* Identity mapping for [0; 8G) */
-	.quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
-	.fill 502, 8, 0
-	/* Mapping of [0; 2G) at -2G */
-	.quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
-
-.align 4096
-SYMBOL(ptl_0)
-	.quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
-	.fill 510, 8, 0
-	.quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
-#endif
-
-#ifdef MEMORY_MODEL_large
-.align 4096
-ptl_1:
-	/* Identity mapping for [0; 8G) */
-	.quad ptl_2_0g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_1g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_2g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_3g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_4g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_5g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_6g + (PTL_WRITABLE | PTL_PRESENT)
-	.quad ptl_2_7g + (PTL_WRITABLE | PTL_PRESENT)
-	.fill 504, 8, 0
-
-.align 4096
-SYMBOL(ptl_0)
-	.quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
-	.fill 255, 8, 0
-	.quad ptl_1 + (PTL_WRITABLE | PTL_PRESENT)
-	.fill 255, 8, 0
-#endif
-
-.section K_DATA_START, "aw", @progbits
-
-SYMBOL(bootstrap_idtr)
-	.word 0
-	.long 0
-
-SYMBOL(bootstrap_gdtr)
-	.word GDT_SELECTOR(GDT_ITEMS)
-	.long KA2PA(gdt)
-
-SYMBOL(multiboot_eax)
-	.long 0
-
-SYMBOL(multiboot_ebx)
-	.long 0
-
-err_extended_cpuid:
-	.asciz "Error: Extended CPUID not supported -- CPU is not 64-bit. System halted."
-err_long_mode:
-	.asciz "Error: 64-bit long mode not supported. System halted."
-err_noexecute:
-	.asciz "Error: No-execute pages not supported. System halted."
-err_fx:
-	.asciz "Error: FXSAVE/FXRESTORE instructions not supported. System halted."
-err_sse2:
-	.asciz "Error: SSE2 instructions not supported. System halted."
-
-status_prot:
-	.asciz "[prot] "
-status_vesa_copy:
-	.asciz "[vesa_copy] "
-status_multiboot_cmdline:
-	.asciz "[multiboot_cmdline] "
-status_vesa_real:
-	.asciz "[vesa_real] "
-status_prot2:
-	.asciz "[prot2] "
-status_long:
-	.asciz "[long] "
-status_main:
-	.asciz "[main] "
Index: rnel/arch/amd64/src/boot/multiboot2.S
===================================================================
--- kernel/arch/amd64/src/boot/multiboot2.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,276 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-#include <arch/pm.h>
-#include <arch/cpuid.h>
-#include <arch/cpu.h>
-#include <genarch/multiboot/multiboot2.h>
-
-#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.align 8
-multiboot2_header_start:
-	.long MULTIBOOT2_HEADER_MAGIC
-	.long MULTIBOOT2_HEADER_ARCH_I386
-	.long multiboot2_header_end - multiboot2_header_start
-	.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
-
-	/* Information request tag */
-	.align 8
-	tag_info_req_start:
-		.word MULTIBOOT2_TAG_INFO_REQ
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_info_req_end - tag_info_req_start
-		.long MULTIBOOT2_TAG_CMDLINE
-		.long MULTIBOOT2_TAG_MODULE
-		.long MULTIBOOT2_TAG_MEMMAP
-#ifdef CONFIG_FB
-		.long MULTIBOOT2_TAG_FBINFO
-#endif
-	tag_info_req_end:
-
-	/* Address tag */
-	.align 8
-	tag_address_start:
-		.word MULTIBOOT2_TAG_ADDRESS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_address_end - tag_address_start
-		.long multiboot2_header_start
-		.long unmapped_start
-		.long 0
-		.long 0
-	tag_address_end:
-
-	/* Entry address tag */
-	.align 8
-	tag_entry_address_start:
-		.word MULTIBOOT2_TAG_ENTRY_ADDRESS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_entry_address_end - tag_entry_address_start
-		.long multiboot2_image_start
-	tag_entry_address_end:
-
-	/* Flags tag */
-	.align 8
-	tag_flags_start:
-		.word MULTIBOOT2_TAG_FLAGS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_flags_end - tag_flags_start
-		.long MULTIBOOT2_FLAGS_CONSOLE
-	tag_flags_end:
-
-#ifdef CONFIG_FB
-	/* Framebuffer tag */
-	.align 8
-	tag_framebuffer_start:
-		.word MULTIBOOT2_TAG_FRAMEBUFFER
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_framebuffer_end - tag_framebuffer_start
-		.long CONFIG_BFB_WIDTH
-		.long CONFIG_BFB_HEIGHT
-		.long CONFIG_BFB_BPP
-	tag_framebuffer_end:
-#endif
-
-	/* Module alignment tag */
-	.align 8
-	tag_module_align_start:
-		.word MULTIBOOT2_TAG_MODULE_ALIGN
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_module_align_end - tag_module_align_start
-		.long 0
-	tag_module_align_end:
-
-	/* Tag terminator */
-	.align 8
-	tag_terminator_start:
-		.word MULTIBOOT2_TAG_TERMINATOR
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_terminator_end - tag_terminator_start
-	tag_terminator_end:
-multiboot2_header_end:
-
-SYMBOL(multiboot2_image_start)
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/*
-	 * Initialize Global Descriptor Table and
-	 * Interrupt Descriptor Table registers
-	 */
-	lgdtl bootstrap_gdtr
-	lidtl bootstrap_idtr
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %ds
-	movw %cx, %ss
-
-	/*
-	 * Simics seems to remove hidden part of GS on entering user mode
-	 * when _visible_ part of GS does not point to user-mode segment.
-	 */
-	movw $GDT_SELECTOR(UDATA_DES), %cx
-	movw %cx, %fs
-	movw %cx, %gs
-
-	jmpl $GDT_SELECTOR(KTEXT32_DES), $multiboot2_meeting_point
-	multiboot2_meeting_point:
-
-	/*
-	 * Protected 32-bit. We want to reuse the code-seg descriptor,
-	 * the Default operand size must not be 1 when entering long mode.
-	 */
-
-	/* Save multiboot arguments */
-	movl %eax, multiboot_eax
-	movl %ebx, multiboot_ebx
-
-	movl $(INTEL_CPUID_EXTENDED), %eax
-	cpuid
-	cmp $(INTEL_CPUID_EXTENDED), %eax
-	ja extended_cpuid_supported
-
-		jmp pm_error_halt
-
-	extended_cpuid_supported:
-
-	movl $(AMD_CPUID_EXTENDED), %eax
-	cpuid
-	bt $(AMD_EXT_LONG_MODE), %edx
-	jc long_mode_supported
-
-		jmp pm_error_halt
-
-	long_mode_supported:
-
-	bt $(AMD_EXT_NOEXECUTE), %edx
-	jc noexecute_supported
-
-		jmp pm_error_halt
-
-	noexecute_supported:
-
-	movl $(INTEL_CPUID_STANDARD), %eax
-	cpuid
-	bt $(INTEL_FXSAVE), %edx
-	jc fx_supported
-
-		jmp pm_error_halt
-
-	fx_supported:
-
-	bt $(INTEL_SSE2), %edx
-	jc sse2_supported
-
-		jmp pm_error_halt
-
-	sse2_supported:
-
-	/*
-	 * Enable 64-bit page translation entries - CR4.PAE = 1.
-	 * Paging is not enabled until after long mode is enabled.
-	 */
-
-	movl %cr4, %eax
-	orl $CR4_PAE, %eax
-	movl %eax, %cr4
-
-	/* Set up paging tables */
-	leal ptl_0, %eax
-	movl %eax, %cr3
-
-	/* Enable long mode */
-	movl $AMD_MSR_EFER, %ecx
-	rdmsr                     /* read EFER */
-	orl $AMD_LME, %eax        /* set LME = 1 */
-	wrmsr
-
-	/* Enable paging to activate long mode (set CR0.PG = 1) */
-	movl %cr0, %eax
-	orl $CR0_PG, %eax
-	movl %eax, %cr0
-
-	/* At this point we are in compatibility mode */
-	jmpl $GDT_SELECTOR(KTEXT_DES), $start64
-
-pm_error_halt:
-	cli
-	hlt1:
-		hlt
-		jmp hlt1
-
-.code64
-
-start64:
-
-	/*
-	 * Long mode.
-	 */
-
-	movq $(PA2KA(START_STACK)), %rsp
-
-	/* Create the first stack frame */
-	pushq $0
-	movq %rsp, %rbp
-
-	/* Call amd64_pre_main(multiboot_eax, multiboot_ebx) */
-	movl multiboot_eax, %edi
-	movl multiboot_ebx, %esi
-
-#ifdef MEMORY_MODEL_large
-	movabsq $amd64_pre_main, %rax
-	callq *%rax
-#else
-	callq amd64_pre_main
-#endif
-
-	/* Call main_bsp() */
-#ifdef MEMORY_MODEL_large
-	movabsq $main_bsp, %rax
-	callq *%rax
-#else
-	callq main_bsp
-#endif
-
-	/* Not reached */
-	cli
-	hlt0:
-		hlt
-		jmp hlt0
Index: rnel/arch/amd64/src/boot/vesa_prot.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_prot.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/boot/vesa_prot.inc
Index: rnel/arch/amd64/src/boot/vesa_real.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_real.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/boot/vesa_real.inc
Index: rnel/arch/amd64/src/boot/vesa_ret.inc
===================================================================
--- kernel/arch/amd64/src/boot/vesa_ret.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,24 +1,0 @@
-.code32
-vesa_init_protected:
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %ds
-	movw %cx, %ss
-
-	/*
-	 * Simics seems to remove hidden part of GS on entering user mode
-	 * when _visible_ part of GS does not point to user-mode segment.
-	 */
-
-	movw $GDT_SELECTOR(UDATA_DES), %cx
-	movw %cx, %fs
-	movw %cx, %gs
-
-	jmpl $GDT_SELECTOR(KTEXT32_DES), $vesa_meeting_point
Index: rnel/arch/amd64/src/boot/vga323.pal
===================================================================
--- kernel/arch/amd64/src/boot/vga323.pal	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/boot/vga323.pal
Index: rnel/arch/amd64/src/context.S
===================================================================
--- kernel/arch/amd64/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-#include <arch/vreg.h>
-
-.text
-
-## Save current CPU context
-#
-# Save CPU context to context_t variable
-# pointed by the 1st argument. Returns 1 in EAX.
-#
-FUNCTION_BEGIN(context_save_arch)
-	movq (%rsp), %rdx     # the caller's return %rip
-
-	movq %rdx, CONTEXT_OFFSET_PC(%rdi)
-	movq %rsp, CONTEXT_OFFSET_SP(%rdi)
-
-	movq %rbx, CONTEXT_OFFSET_RBX(%rdi)
-	movq %rbp, CONTEXT_OFFSET_RBP(%rdi)
-	movq %r12, CONTEXT_OFFSET_R12(%rdi)
-	movq %r13, CONTEXT_OFFSET_R13(%rdi)
-	movq %r14, CONTEXT_OFFSET_R14(%rdi)
-	movq %r15, CONTEXT_OFFSET_R15(%rdi)
-
-#ifdef MEMORY_MODEL_large
-	movabsq $vreg_ptr, %rsi
-	movq (%rsi), %rsi
-#else
-	movq vreg_ptr, %rsi
-#endif
-	movq %fs:VREG_TP(%rsi), %rsi
-	movq %rsi, CONTEXT_OFFSET_TP(%rdi)
-
-	xorl %eax, %eax       # context_save returns 1
-	incl %eax
-	ret
-FUNCTION_END(context_save_arch)
-
-
-## Restore current CPU context
-#
-# Restore CPU context from context_t variable
-# pointed by the 1st argument. Returns 0 in EAX.
-#
-FUNCTION_BEGIN(context_restore_arch)
-	movq CONTEXT_OFFSET_R15(%rdi), %r15
-	movq CONTEXT_OFFSET_R14(%rdi), %r14
-	movq CONTEXT_OFFSET_R13(%rdi), %r13
-	movq CONTEXT_OFFSET_R12(%rdi), %r12
-	movq CONTEXT_OFFSET_RBP(%rdi), %rbp
-	movq CONTEXT_OFFSET_RBX(%rdi), %rbx
-
-	movq CONTEXT_OFFSET_SP(%rdi), %rsp
-
-	movq CONTEXT_OFFSET_PC(%rdi), %rdx
-	movq %rdx, (%rsp)
-
-	movq CONTEXT_OFFSET_TP(%rdi), %rcx
-#ifdef MEMORY_MODEL_large
-	movabsq $vreg_ptr, %rsi
-	movq (%rsi), %rsi
-#else
-	movq vreg_ptr, %rsi
-#endif
-	movq %rcx, %fs:VREG_TP(%rsi)
-
-	xorl %eax, %eax       # context_restore returns 0
-	ret
-FUNCTION_END(context_restore_arch)
-
Index: rnel/arch/amd64/src/cpu/cpu.c
===================================================================
--- kernel/arch/amd64/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <cpu.h>
-#include <arch/cpu.h>
-#include <arch/cpuid.h>
-#include <arch/pm.h>
-
-#include <arch.h>
-#include <stdio.h>
-#include <fpu_context.h>
-
-/*
- * Identification of CPUs.
- * Contains only non-MP-Specification specific SMP code.
- */
-#define AMD_CPUID_EBX  UINT32_C(0x68747541)
-#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
-#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
-
-#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
-#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
-#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
-
-enum vendor {
-	VendorUnknown = 0,
-	VendorAMD,
-	VendorIntel
-};
-
-static const char *vendor_str[] = {
-	"Unknown Vendor",
-	"AuthenticAMD",
-	"GenuineIntel"
-};
-
-/** Setup flags on processor so that we can use the FPU
- *
- * cr0.osfxsr = 1 -> we do support fxstor/fxrestor
- * cr0.em = 0 -> we do not emulate coprocessor
- * cr0.mp = 1 -> we do want lazy context switch
- */
-void cpu_setup_fpu(void)
-{
-	write_cr0((read_cr0() & ~CR0_EM) | CR0_MP);
-	write_cr4(read_cr4() | CR4_OSFXSR);
-}
-
-/** Set the TS flag to 1.
- *
- * If a thread accesses coprocessor, exception is run, which
- * does a lazy fpu context switch.
- *
- */
-void fpu_disable(void)
-{
-	write_cr0(read_cr0() | CR0_TS);
-}
-
-void fpu_enable(void)
-{
-	write_cr0(read_cr0() & ~CR0_TS);
-}
-
-void cpu_arch_init(void)
-{
-	CPU->arch.tss = tss_p;
-	CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] -
-	    ((uint8_t *) CPU->arch.tss);
-}
-
-void cpu_identify(void)
-{
-	cpu_info_t info;
-
-	CPU->arch.vendor = VendorUnknown;
-	if (has_cpuid()) {
-		cpuid(INTEL_CPUID_LEVEL, &info);
-
-		/*
-		 * Check for AMD processor.
-		 */
-		if ((info.cpuid_ebx == AMD_CPUID_EBX) &&
-		    (info.cpuid_ecx == AMD_CPUID_ECX) &&
-		    (info.cpuid_edx == AMD_CPUID_EDX)) {
-			CPU->arch.vendor = VendorAMD;
-		}
-
-		/*
-		 * Check for Intel processor.
-		 */
-		if ((info.cpuid_ebx == INTEL_CPUID_EBX) &&
-		    (info.cpuid_ecx == INTEL_CPUID_ECX) &&
-		    (info.cpuid_edx == INTEL_CPUID_EDX)) {
-			CPU->arch.vendor = VendorIntel;
-		}
-
-		cpuid(INTEL_CPUID_STANDARD, &info);
-		CPU->arch.family = (info.cpuid_eax >> 8) & 0xf;
-		CPU->arch.model = (info.cpuid_eax >> 4) & 0xf;
-		CPU->arch.stepping = (info.cpuid_eax >> 0) & 0xf;
-	}
-}
-
-void cpu_print_report(cpu_t *m)
-{
-	printf("cpu%d: (%s family=%d model=%d stepping=%d apicid=%u) %dMHz\n",
-	    m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model,
-	    m->arch.stepping, m->arch.id, m->frequency_mhz);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/ddi/ddi.c
===================================================================
--- kernel/arch/amd64/src/ddi/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_ddi
- * @{
- */
-/** @file
- */
-
-#include <ddi/ddi.h>
-#include <arch/ddi/ddi.h>
-#include <assert.h>
-#include <proc/task.h>
-#include <adt/bitmap.h>
-#include <mm/slab.h>
-#include <arch/pm.h>
-#include <errno.h>
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <align.h>
-#include <stdbool.h>
-
-/** Install I/O Permission bitmap.
- *
- * Current task's I/O permission bitmap, if any, is installed
- * in the current CPU's TSS.
- *
- * Interrupts must be disabled prior this call.
- *
- */
-void io_perm_bitmap_install(void)
-{
-	/* First, copy the I/O Permission Bitmap. */
-	irq_spinlock_lock(&TASK->lock, false);
-
-	size_t ver = TASK->arch.iomapver;
-	size_t elements = TASK->arch.iomap.elements;
-
-	if (elements > 0) {
-		assert(TASK->arch.iomap.bits);
-
-		bitmap_t iomap;
-		bitmap_initialize(&iomap, TSS_IOMAP_SIZE * 8,
-		    CPU->arch.tss->iomap);
-		bitmap_copy(&iomap, &TASK->arch.iomap, elements);
-
-		/*
-		 * Set the trailing bits in the last byte of the map to disable
-		 * I/O access.
-		 */
-		bitmap_set_range(&iomap, elements,
-		    ALIGN_UP(elements, 8) - elements);
-
-		/*
-		 * It is safe to set the trailing eight bits because of the
-		 * extra convenience byte in TSS_IOMAP_SIZE.
-		 */
-		bitmap_set_range(&iomap, ALIGN_UP(elements, 8), 8);
-	}
-
-	irq_spinlock_unlock(&TASK->lock, false);
-
-	/*
-	 * Second, adjust TSS segment limit.
-	 * Take the extra ending byte with all bits set into account.
-	 */
-	ptr_16_64_t cpugdtr;
-	gdtr_store(&cpugdtr);
-
-	descriptor_t *gdt_p = (descriptor_t *) cpugdtr.base;
-	size_t size = bitmap_size(elements);
-	gdt_tss_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE + size);
-	gdtr_load(&cpugdtr);
-
-	/*
-	 * Before we load new TSS limit, the current TSS descriptor
-	 * type must be changed to describe inactive TSS.
-	 */
-	tss_descriptor_t *tss_desc = (tss_descriptor_t *) &gdt_p[TSS_DES];
-	tss_desc->type = AR_TSS;
-	tr_load(GDT_SELECTOR(TSS_DES));
-
-	/*
-	 * Update the generation count so that faults caused by
-	 * early accesses can be serviced.
-	 */
-	CPU->arch.iomapver_copy = ver;
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/amd64/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       1
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint64_t *stack = (void *) ctx->fp;
-	*prev = stack[FRAME_OFFSET_FP_PREV];
-
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint64_t *stack = (void *) ctx->fp;
-	*ra = stack[FRAME_OFFSET_RA];
-
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return !copy_from_uspace(prev,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return !copy_from_uspace(ra,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/amd64/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	movq %rbp, %rax
-	ret
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	movq (%rsp), %rax
-	ret
-FUNCTION_END(program_counter_get)
Index: rnel/arch/amd64/src/delay.S
===================================================================
--- kernel/arch/amd64/src/delay.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Micro second delay loop functions.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(asm_delay_loop)
-	0:
-		dec %rdi
-		jnz 0b
-
-	ret
-FUNCTION_END(asm_delay_loop)
-
-FUNCTION_BEGIN(asm_fake_loop)
-	0:
-		dec %rdi
-		jz 0b
-
-	ret
-FUNCTION_END(asm_fake_loop)
-
Index: rnel/arch/amd64/src/drivers
===================================================================
--- kernel/arch/amd64/src/drivers	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../ia32/src/drivers
Index: rnel/arch/amd64/src/fpu_context.c
===================================================================
--- kernel/arch/amd64/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- *
- */
-
-#include <fpu_context.h>
-
-/** Save FPU (mmx, sse) context using fxsave instruction */
-void fpu_context_save(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "fxsave %[fctx]\n"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-/** Restore FPU (mmx,sse) context using fxrstor instruction */
-void fpu_context_restore(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "fxrstor %[fctx]\n"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-void fpu_init(void)
-{
-	/* TODO: Zero all SSE, MMX etc. registers */
-	/*
-	 * Default value of SCR register is 0x1f80,
-	 * it masks all FPU exceptions
-	 */
-	asm volatile (
-	    "fninit\n"
-	);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/interrupt.c
===================================================================
--- kernel/arch/amd64/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,233 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/interrupt.h>
-#include <assert.h>
-#include <log.h>
-#include <panic.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <genarch/pic/pic_ops.h>
-#include <halt.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <arch.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <synch/spinlock.h>
-#include <arch/ddi/ddi.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <symtab.h>
-#include <stacktrace.h>
-
-/*
- * Interrupt and exception dispatching.
- */
-pic_ops_t *pic_ops = NULL;
-
-void istate_decode(istate_t *istate)
-{
-	log_printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t"
-	    "rfl=%0#18" PRIx64 "\terr=%0#18" PRIx64 "\n",
-	    istate->cs, istate->rip, istate->rflags, istate->error_word);
-
-	if (istate_from_uspace(istate))
-		log_printf("ss =%0#18" PRIx64 "\n", istate->ss);
-
-	log_printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t"
-	    "rcx=%0#18" PRIx64 "\trdx=%0#18" PRIx64 "\n",
-	    istate->rax, istate->rbx, istate->rcx, istate->rdx);
-
-	log_printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t"
-	    "rbp=%0#18" PRIx64 "\trsp=%0#18" PRIx64 "\n",
-	    istate->rsi, istate->rdi, istate->rbp,
-	    istate_from_uspace(istate) ? istate->rsp :
-	    (uintptr_t) &istate->rsp);
-
-	log_printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t"
-	    "r10=%0#18" PRIx64 "\tr11=%0#18" PRIx64 "\n",
-	    istate->r8, istate->r9, istate->r10, istate->r11);
-
-	log_printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t"
-	    "r14=%0#18" PRIx64 "\tr15=%0#18" PRIx64 "\n",
-	    istate->r12, istate->r13, istate->r14, istate->r15);
-}
-
-static void null_interrupt(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n);
-	panic_badtrap(istate, n, "Unserviced interrupt.");
-}
-
-static void de_fault(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Divide error.");
-	panic_badtrap(istate, n, "Divide error.");
-}
-
-/** General Protection Fault.
- *
- */
-static void gp_fault(unsigned int n, istate_t *istate)
-{
-	if (TASK) {
-		irq_spinlock_lock(&TASK->lock, false);
-		size_t ver = TASK->arch.iomapver;
-		irq_spinlock_unlock(&TASK->lock, false);
-
-		if (CPU->arch.iomapver_copy != ver) {
-			/*
-			 * This fault can be caused by an early access
-			 * to I/O port because of an out-dated
-			 * I/O Permission bitmap installed on CPU.
-			 * Install the fresh copy and restart
-			 * the instruction.
-			 */
-			io_perm_bitmap_install();
-			return;
-		}
-		fault_if_from_uspace(istate, "General protection fault.");
-	}
-	panic_badtrap(istate, n, "General protection fault.");
-}
-
-static void ss_fault(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Stack fault.");
-	panic_badtrap(istate, n, "Stack fault.");
-}
-
-static void nm_fault(unsigned int n, istate_t *istate)
-{
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-#else
-	fault_if_from_uspace(istate, "FPU fault.");
-	panic("FPU fault.");
-#endif
-}
-
-#ifdef CONFIG_SMP
-static void tlb_shootdown_ipi(unsigned int n, istate_t *istate)
-{
-	pic_ops->eoi(0);
-	tlb_shootdown_ipi_recv();
-}
-#endif
-
-/** Handler of IRQ exceptions.
- *
- */
-static void irq_interrupt(unsigned int n, istate_t *istate)
-{
-	assert(n >= IVT_IRQBASE);
-
-	unsigned int inum = n - IVT_IRQBASE;
-	bool ack = false;
-	assert(inum < IRQ_COUNT);
-	assert(inum != IRQ_PIC1);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/*
-		 * The IRQ handler was found.
-		 */
-
-		if (irq->preack) {
-			/* Send EOI before processing the interrupt */
-			pic_ops->eoi(inum);
-			ack = true;
-		}
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id,
-		    inum);
-#endif
-	}
-
-	if (!ack)
-		pic_ops->eoi(inum);
-}
-
-static void pic_spurious(unsigned int n, istate_t *istate)
-{
-	unsigned int inum = n - IVT_IRQBASE;
-	if (!pic_ops->is_spurious(inum)) {
-		/* This is actually not a spurious IRQ, so proceed as usual. */
-		irq_interrupt(n, istate);
-		return;
-	}
-	pic_ops->handle_spurious(n);
-#ifdef CONFIG_DEBUG
-	log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id,
-	    inum);
-#endif
-}
-
-void interrupt_init(void)
-{
-	unsigned int i;
-
-	for (i = 0; i < IVT_ITEMS; i++)
-		exc_register(i, "null", false, (iroutine_t) null_interrupt);
-
-	for (i = 0; i < IRQ_COUNT; i++) {
-		if ((i != IRQ_PIC0_SPUR) && (i != IRQ_PIC1_SPUR) &&
-		    (i != IRQ_PIC1))
-			exc_register(IVT_IRQBASE + i, "irq", true,
-			    (iroutine_t) irq_interrupt);
-	}
-
-	exc_register(VECTOR_DE, "de_fault", true, (iroutine_t) de_fault);
-	exc_register(VECTOR_NM, "nm_fault", true, (iroutine_t) nm_fault);
-	exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault);
-	exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault);
-	exc_register(VECTOR_PIC0_SPUR, "pic0_spurious", true,
-	    (iroutine_t) pic_spurious);
-	exc_register(VECTOR_PIC1_SPUR, "pic1_spurious", true,
-	    (iroutine_t) pic_spurious);
-
-#ifdef CONFIG_SMP
-	exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true,
-	    (iroutine_t) tlb_shootdown_ipi);
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/kseg.c
===================================================================
--- kernel/arch/amd64/src/kseg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <arch/kseg.h>
-#include <arch/asm.h>
-#include <panic.h>
-#include <arch/kseg_struct.h>
-#include <stdlib.h>
-
-/**
- * Allocate and initialize a per-CPU structure to be accessible via the
- * GS_KERNEL segment register.
- */
-void kseg_init(void)
-{
-	kseg_t *kseg;
-
-	kseg = (kseg_t *) malloc(sizeof(kseg_t));
-	if (!kseg)
-		panic("Cannot allocate kseg.");
-
-	kseg->ustack_rsp = 0;
-	kseg->kstack_rsp = 0;
-	kseg->fsbase = read_msr(AMD_MSR_FS);
-
-	write_msr(AMD_MSR_GS_KERNEL, (uintptr_t) kseg);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/mm/as.c
===================================================================
--- kernel/arch/amd64/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/mm/as.c
Index: rnel/arch/amd64/src/mm/frame.c
===================================================================
--- kernel/arch/amd64/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/mm/frame.c
Index: rnel/arch/amd64/src/mm/km.c
===================================================================
--- kernel/arch/amd64/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <macros.h>
-#include <stdbool.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_AMD64_IDENTITY_START;
-	config.identity_size = KM_AMD64_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_AMD64_NON_IDENTITY_START,
-	    KM_AMD64_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_AMD64_NON_IDENTITY_START,
-	    KM_AMD64_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/mm/page.c
===================================================================
--- kernel/arch/amd64/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <arch/mm/frame.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/as.h>
-#include <arch/asm.h>
-#include <config.h>
-#include <interrupt.h>
-#include <panic.h>
-#include <align.h>
-#include <macros.h>
-
-void page_arch_init(void)
-{
-	if (config.cpu_active > 1) {
-		write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
-		return;
-	}
-
-	uintptr_t cur;
-	unsigned int identity_flags =
-	    PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_EXEC | PAGE_WRITE | PAGE_READ;
-
-	page_mapping_operations = &pt_mapping_operations;
-
-	page_table_lock(AS_KERNEL, true);
-
-	/*
-	 * PA2KA(identity) mapping for all low-memory frames.
-	 */
-	for (cur = 0; cur < min(config.identity_size, config.physmem_end);
-	    cur += FRAME_SIZE)
-		page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, identity_flags);
-
-	page_table_unlock(AS_KERNEL, true);
-
-	exc_register(VECTOR_PF, "page_fault", true, (iroutine_t) page_fault);
-	write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
-}
-
-void page_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t badvaddr = read_cr2();
-
-	if (istate->error_word & PFERR_CODE_RSVD)
-		panic("Reserved bit set in page table entry.");
-
-	pf_access_t access;
-
-	if (istate->error_word & PFERR_CODE_RW)
-		access = PF_ACCESS_WRITE;
-	else if (istate->error_word & PFERR_CODE_ID)
-		access = PF_ACCESS_EXEC;
-	else
-		access = PF_ACCESS_READ;
-
-	(void) as_page_fault(badvaddr, access, istate);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/mm/tlb.c
===================================================================
--- kernel/arch/amd64/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/mm/tlb.c
Index: rnel/arch/amd64/src/pm.c
===================================================================
--- kernel/arch/amd64/src/pm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,302 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2005-2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/pm.h>
-#include <arch/asm.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <memw.h>
-#include <stdlib.h>
-
-/*
- * There is no segmentation in long mode so we set up flat mode. In this
- * mode, we use, for each privilege level, two segments spanning the
- * whole memory. One is for code and one is for data.
- */
-
-descriptor_t gdt[GDT_ITEMS] = {
-	[NULL_DES] = {
-		0
-	},
-	[KTEXT_DES] = {
-		.limit_0_15 = 0xffffU,
-		.limit_16_19 = 0xfU,
-		.access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
-		.longmode = 1,
-		.granularity = 1
-	},
-	[KDATA_DES] = {
-		.limit_0_15 = 0xffffU,
-		.limit_16_19 = 0xfU,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL,
-		.granularity = 1
-	},
-	[UDATA_DES] = {
-		.limit_0_15 = 0xffffU,
-		.limit_16_19 = 0xfU,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER,
-		.special = 1,
-		.granularity = 1
-	},
-	[UTEXT_DES] = {
-		.limit_0_15 = 0xffffU,
-		.limit_16_19 = 0xfU,
-		.access = AR_PRESENT | AR_CODE | DPL_USER,
-		.longmode = 1,
-		.granularity = 1
-	},
-	[KTEXT32_DES] = {
-		.limit_0_15 = 0xffffU,
-		.limit_16_19 = 0xfU,
-		.access = AR_PRESENT | AR_CODE | DPL_KERNEL | AR_READABLE,
-		.special = 1,
-		.granularity = 1
-	},
-	/*
-	 * TSS descriptor - set up will be completed later,
-	 * on AMD64 it is 64-bit - 2 items in the table
-	 */
-	[TSS_DES] = {
-		0
-	},
-	[TSS_DES + 1] = {
-		0
-	},
-	/* VESA Init descriptor */
-#ifdef CONFIG_FB
-	[VESA_INIT_CODE_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.base_16_23 = VESA_INIT_SEGMENT >> 12,
-		.access = AR_PRESENT | AR_CODE | AR_READABLE | DPL_KERNEL
-	},
-	[VESA_INIT_DATA_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.base_16_23 = VESA_INIT_SEGMENT >> 12,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL
-	}
-#endif
-};
-
-idescriptor_t idt[IDT_ITEMS];
-
-ptr_16_64_t gdtr = {
-	.limit = sizeof(gdt),
-	.base = (uint64_t) gdt
-};
-ptr_16_64_t idtr = {
-	.limit = sizeof(idt),
-	.base = (uint64_t) idt
-};
-
-static tss_t tss;
-tss_t *tss_p = NULL;
-
-void gdt_tss_setbase(descriptor_t *d, uintptr_t base)
-{
-	tss_descriptor_t *td = (tss_descriptor_t *) d;
-
-	td->base_0_15 = base & 0xffffU;
-	td->base_16_23 = ((base) >> 16) & 0xffU;
-	td->base_24_31 = ((base) >> 24) & 0xffU;
-	td->base_32_63 = ((base) >> 32);
-}
-
-void gdt_tss_setlimit(descriptor_t *d, uint32_t limit)
-{
-	tss_descriptor_t *td = (tss_descriptor_t *) d;
-
-	td->limit_0_15 = limit & 0xffffU;
-	td->limit_16_19 = (limit >> 16) & 0x0fU;
-}
-
-void idt_setoffset(idescriptor_t *d, uintptr_t offset)
-{
-	/*
-	 * Offset is a linear address.
-	 */
-	d->offset_0_15 = offset & 0xffffU;
-	d->offset_16_31 = (offset >> 16) & 0xffffU;
-	d->offset_32_63 = offset >> 32;
-}
-
-void tss_initialize(tss_t *t)
-{
-	memsetb(t, sizeof(tss_t), 0);
-}
-
-/*
- * This function takes care of proper setup of IDT and IDTR.
- */
-void idt_init(void)
-{
-	idescriptor_t *d;
-
-	for (unsigned i = 0; i < IDT_ITEMS; i++) {
-		d = &idt[i];
-
-		d->unused = 0;
-		d->selector = GDT_SELECTOR(KTEXT_DES);
-
-		d->present = 1;
-		d->type = AR_INTERRUPT;  /* masking interrupt */
-
-		d->dpl = PL_KERNEL;
-		d->ist = 0;
-	}
-
-	d = &idt[0];
-	idt_setoffset(d++, (uintptr_t) &int_0);
-	idt_setoffset(d++, (uintptr_t) &int_1);
-	idt_setoffset(d++, (uintptr_t) &int_2);
-	idt_setoffset(d++, (uintptr_t) &int_3);
-	idt_setoffset(d++, (uintptr_t) &int_4);
-	idt_setoffset(d++, (uintptr_t) &int_5);
-	idt_setoffset(d++, (uintptr_t) &int_6);
-	idt_setoffset(d++, (uintptr_t) &int_7);
-	idt_setoffset(d++, (uintptr_t) &int_8);
-	idt_setoffset(d++, (uintptr_t) &int_9);
-	idt_setoffset(d++, (uintptr_t) &int_10);
-	idt_setoffset(d++, (uintptr_t) &int_11);
-	idt_setoffset(d++, (uintptr_t) &int_12);
-	idt_setoffset(d++, (uintptr_t) &int_13);
-	idt_setoffset(d++, (uintptr_t) &int_14);
-	idt_setoffset(d++, (uintptr_t) &int_15);
-	idt_setoffset(d++, (uintptr_t) &int_16);
-	idt_setoffset(d++, (uintptr_t) &int_17);
-	idt_setoffset(d++, (uintptr_t) &int_18);
-	idt_setoffset(d++, (uintptr_t) &int_19);
-	idt_setoffset(d++, (uintptr_t) &int_20);
-	idt_setoffset(d++, (uintptr_t) &int_21);
-	idt_setoffset(d++, (uintptr_t) &int_22);
-	idt_setoffset(d++, (uintptr_t) &int_23);
-	idt_setoffset(d++, (uintptr_t) &int_24);
-	idt_setoffset(d++, (uintptr_t) &int_25);
-	idt_setoffset(d++, (uintptr_t) &int_26);
-	idt_setoffset(d++, (uintptr_t) &int_27);
-	idt_setoffset(d++, (uintptr_t) &int_28);
-	idt_setoffset(d++, (uintptr_t) &int_29);
-	idt_setoffset(d++, (uintptr_t) &int_30);
-	idt_setoffset(d++, (uintptr_t) &int_31);
-	idt_setoffset(d++, (uintptr_t) &int_32);
-	idt_setoffset(d++, (uintptr_t) &int_33);
-	idt_setoffset(d++, (uintptr_t) &int_34);
-	idt_setoffset(d++, (uintptr_t) &int_35);
-	idt_setoffset(d++, (uintptr_t) &int_36);
-	idt_setoffset(d++, (uintptr_t) &int_37);
-	idt_setoffset(d++, (uintptr_t) &int_38);
-	idt_setoffset(d++, (uintptr_t) &int_39);
-	idt_setoffset(d++, (uintptr_t) &int_40);
-	idt_setoffset(d++, (uintptr_t) &int_41);
-	idt_setoffset(d++, (uintptr_t) &int_42);
-	idt_setoffset(d++, (uintptr_t) &int_43);
-	idt_setoffset(d++, (uintptr_t) &int_44);
-	idt_setoffset(d++, (uintptr_t) &int_45);
-	idt_setoffset(d++, (uintptr_t) &int_46);
-	idt_setoffset(d++, (uintptr_t) &int_47);
-	idt_setoffset(d++, (uintptr_t) &int_48);
-	idt_setoffset(d++, (uintptr_t) &int_49);
-	idt_setoffset(d++, (uintptr_t) &int_50);
-	idt_setoffset(d++, (uintptr_t) &int_51);
-	idt_setoffset(d++, (uintptr_t) &int_52);
-	idt_setoffset(d++, (uintptr_t) &int_53);
-	idt_setoffset(d++, (uintptr_t) &int_54);
-	idt_setoffset(d++, (uintptr_t) &int_55);
-	idt_setoffset(d++, (uintptr_t) &int_56);
-	idt_setoffset(d++, (uintptr_t) &int_57);
-	idt_setoffset(d++, (uintptr_t) &int_58);
-	idt_setoffset(d++, (uintptr_t) &int_59);
-	idt_setoffset(d++, (uintptr_t) &int_60);
-	idt_setoffset(d++, (uintptr_t) &int_61);
-	idt_setoffset(d++, (uintptr_t) &int_62);
-	idt_setoffset(d++, (uintptr_t) &int_63);
-}
-
-/** Initialize segmentation - code/data/idt tables
- *
- */
-void pm_init(void)
-{
-	descriptor_t *gdt_p = (descriptor_t *) gdtr.base;
-	tss_descriptor_t *tss_desc;
-
-	/*
-	 * Each CPU has its private GDT and TSS.
-	 * All CPUs share one IDT.
-	 */
-
-	if (config.cpu_active == 1) {
-		idt_init();
-		/*
-		 * NOTE: bootstrap CPU has statically allocated TSS, because
-		 * the heap hasn't been initialized so far.
-		 */
-		tss_p = &tss;
-	} else {
-		/*
-		 * We are going to use malloc, which may return
-		 * non boot-mapped pointer, initialize the CR3 register
-		 * ahead of page_init
-		 */
-		write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
-
-		tss_p = (tss_t *) malloc(sizeof(tss_t));
-		if (!tss_p)
-			panic("Cannot allocate TSS.");
-	}
-
-	tss_initialize(tss_p);
-
-	tss_desc = (tss_descriptor_t *) (&gdt_p[TSS_DES]);
-	tss_desc->present = 1;
-	tss_desc->type = AR_TSS;
-	tss_desc->dpl = PL_KERNEL;
-
-	gdt_tss_setbase(&gdt_p[TSS_DES], (uintptr_t) tss_p);
-	gdt_tss_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE - 1);
-
-	gdtr_load(&gdtr);
-	idtr_load(&idtr);
-	/*
-	 * As of this moment, the current CPU has its own GDT pointing
-	 * to its own TSS. We just need to load the TR register.
-	 */
-	tr_load(GDT_SELECTOR(TSS_DES));
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/proc/scheduler.c
===================================================================
--- kernel/arch/amd64/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-#include <cpu.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <arch/asm.h>
-#include <arch/pm.h>
-#include <arch/ddi/ddi.h>
-#include <arch/kseg_struct.h>
-
-/** Perform amd64 specific tasks needed before the new task is run.
- *
- * Interrupts are disabled.
- */
-void before_task_runs_arch(void)
-{
-	io_perm_bitmap_install();
-}
-
-/** Perform amd64 specific tasks needed before the new thread is scheduled. */
-void before_thread_runs_arch(void)
-{
-	CPU->arch.tss->rsp0 = (uintptr_t) &THREAD->kstack[STACK_SIZE];
-
-	kseg_t *kseg = (kseg_t *) read_msr(AMD_MSR_GS_KERNEL);
-	kseg->kstack_rsp = THREAD->arch.kstack_rsp;
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/proc/task.c
===================================================================
--- kernel/arch/amd64/src/proc/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/task.h>
-#include <stddef.h>
-#include <adt/bitmap.h>
-#include <stdlib.h>
-
-/** Perform amd64 specific task initialization.
- *
- * @param task Task to be initialized.
- *
- */
-void task_create_arch(task_t *task)
-{
-	task->arch.iomapver = 0;
-	bitmap_initialize(&task->arch.iomap, 0, NULL);
-}
-
-/** Perform amd64 specific task destruction.
- *
- * @param task Task to be initialized.
- *
- */
-void task_destroy_arch(task_t *task)
-{
-	if (task->arch.iomap.bits != NULL)
-		free(task->arch.iomap.bits);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/proc/thread.c
===================================================================
--- kernel/arch/amd64/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/thread.h>
-#include <arch/interrupt.h>
-#include <arch/kseg_struct.h>
-
-/** Perform amd64 specific thread initialization.
- *
- * @param thread Thread to be initialized.
- *
- */
-errno_t thread_create_arch(thread_t *thread, thread_flags_t flags)
-{
-	/*
-	 * Kernel RSP can be precalculated at thread creation time.
-	 */
-	thread->arch.kstack_rsp =
-	    (uintptr_t) &thread->kstack[PAGE_SIZE - sizeof(istate_t)];
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/smc.c
===================================================================
--- kernel/arch/amd64/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-void smc_coherence(void *a, size_t l)
-{
-	compiler_barrier();
-}
Index: rnel/arch/amd64/src/smp/ap.S
===================================================================
--- kernel/arch/amd64/src/smp/ap.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-#
-# Copyright (c) 2008 Jakub Jermar
-# Copyright (c) 2005-2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Init code for application processors.
-#
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/boot/memmap.h>
-#include <arch/mm/page.h>
-#include <arch/pm.h>
-#include <arch/cpu.h>
-#include <arch/cpuid.h>
-#include <arch/context_struct.h>
-
-.section K_TEXT_START, "ax"
-
-#ifdef CONFIG_SMP
-
-# This piece of code is real-mode and is meant to be alligned at 4K boundary.
-# The requirement for such an alignment comes from MP Specification's STARTUP
-# IPI requirements.
-
-.align 4096
-SYMBOL(unmapped_ap_boot)
-.code16
-	cli
-	xorw %ax, %ax
-	movw %ax, %ds
-
-	lgdtl ap_gdtr       # initialize Global Descriptor Table register
-
-	movl %cr0, %eax
-	orl $CR0_PE, %eax
-	movl %eax, %cr0     # switch to protected mode
-	jmpl $GDT_SELECTOR(KTEXT32_DES), $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
-
-jump_to_kernel:
-.code32
-	movw $GDT_SELECTOR(KDATA_DES), %ax
-	movw %ax, %ds
-	movw %ax, %es
-	movw %ax, %ss
-	movw $GDT_SELECTOR(UDATA_DES), %ax
-	movw %ax, %gs
-
-	# Enable 64-bit page translation entries (CR4.PAE = 1).
-	# Paging is not enabled until after long mode is enabled
-
-	movl %cr4, %eax
-	orl $CR4_PAE, %eax
-	movl %eax, %cr4
-
-	leal ptl_0, %eax
-	movl %eax, %cr3
-
-	# Enable long mode
-	movl $AMD_MSR_EFER, %ecx  # EFER MSR number
-	rdmsr                     # Read EFER
-	orl $AMD_LME, %eax        # Set LME=1
-	wrmsr                     # Write EFER
-
-	# Enable paging to activate long mode (set CR0.PG = 1)
-	movl %cr0, %eax
-	orl $CR0_PG, %eax
-	movl %eax, %cr0
-
-	# At this point we are in compatibility mode
-	jmpl $GDT_SELECTOR(KTEXT_DES), $start64 - BOOT_OFFSET + AP_BOOT_OFFSET
-
-.code64
-start64:
-	movabsq $bootstrap_stack_top, %rsp
-	movq (%rsp), %rsp
-
-	pushq $0
-	pushq $0
-	movq %rsp, %rbp
-
-	movabsq $main_ap, %rax
-	callq *%rax   # never returns
-
-#endif /* CONFIG_SMP */
-
-.section K_DATA_START, "aw", @progbits
-
-#ifdef CONFIG_SMP
-
-SYMBOL(unmapped_ap_gdtr)
-	.word 0
-	.long 0
-
-#endif /* CONFIG_SMP */
Index: rnel/arch/amd64/src/smp/apic.c
===================================================================
--- kernel/arch/amd64/src/smp/apic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/smp/apic.c
Index: rnel/arch/amd64/src/smp/ipi.c
===================================================================
--- kernel/arch/amd64/src/smp/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/smp/ipi.c
Index: rnel/arch/amd64/src/smp/mps.c
===================================================================
--- kernel/arch/amd64/src/smp/mps.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/smp/mps.c
Index: rnel/arch/amd64/src/smp/smp.c
===================================================================
--- kernel/arch/amd64/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/src/smp/smp.c
Index: rnel/arch/amd64/src/syscall.c
===================================================================
--- kernel/arch/amd64/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <syscall/syscall.h>
-#include <arch/syscall.h>
-#include <panic.h>
-#include <arch/cpu.h>
-#include <arch/pm.h>
-#include <arch/asm.h>
-
-extern void syscall_entry(void);
-
-/** Enable & setup support for SYSCALL/SYSRET */
-void syscall_setup_cpu(void)
-{
-	/* Enable SYSCALL/SYSRET */
-	write_msr(AMD_MSR_EFER, read_msr(AMD_MSR_EFER) | AMD_SCE);
-
-	/* Setup syscall entry address */
-
-	/*
-	 * This is _mess_ - the 64-bit CS is argument + 16,
-	 * the SS is argument + 8. The order is:
-	 * +0(KDATA_DES), +8(UDATA_DES), +16(UTEXT_DES)
-	 */
-	write_msr(AMD_MSR_STAR,
-	    ((uint64_t) (GDT_SELECTOR(KDATA_DES) | PL_USER) << 48) |
-	    ((uint64_t) (GDT_SELECTOR(KTEXT_DES) | PL_KERNEL) << 32));
-	write_msr(AMD_MSR_LSTAR, (uint64_t)syscall_entry);
-	/*
-	 * Mask RFLAGS on syscall
-	 * - disable interrupts, until we exchange the stack register
-	 *   (mask the IF bit)
-	 * - clear DF so that the string instructions operate in
-	 *   the right direction
-	 * - clear NT to prevent a #GP should the flag proliferate to an IRET
-	 * - clear TF to prevent an immediate #DB if TF is set
-	 */
-	write_msr(AMD_MSR_SFMASK,
-	    RFLAGS_IF | RFLAGS_DF | RFLAGS_NT | RFLAGS_TF);
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/userspace.c
===================================================================
--- kernel/arch/amd64/src/userspace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <userspace.h>
-#include <arch/cpu.h>
-#include <arch/pm.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <arch.h>
-#include <mm/as.h>
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-/** Enter userspace
- *
- * Change CPU protection level to 3, enter userspace.
- *
- */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	uint64_t rflags = read_rflags();
-
-	rflags &= ~RFLAGS_NT;
-	rflags |= RFLAGS_IF;
-
-	asm volatile (
-	    "pushq %[udata_des]\n"
-	    "pushq %[stack_top]\n"
-	    "pushq %[rflags]\n"
-	    "pushq %[utext_des]\n"
-	    "pushq %[entry]\n"
-
-	    /* %rdi is defined to hold pcb_ptr - set it to 0 */
-	    "xorq %%rdi, %%rdi\n"
-	    "iretq\n"
-	    :: [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
-	      [stack_top] "r" (sp),
-	      [rflags] "r" (rflags),
-	      [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER),
-	      [entry] "r" (pc)
-	);
-
-	unreachable();
-}
-
-/** @}
- */
Index: rnel/arch/amd64/src/vreg.c
===================================================================
--- kernel/arch/amd64/src/vreg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64
- * @{
- */
-/** @file
- */
-
-#include <arch/vreg.h>
-#include <arch/pm.h>
-#include <config.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <panic.h>
-#include <mm/km.h>
-#include <mm/frame.h>
-
-/*
- * During initialization, we need to make sure that context_save() and
- * context_restore() touch some meaningful address when saving/restoring VREGs.
- * When a processor is initialized, we set its FS base to a private page and
- * vreg_ptr to zero.
- */
-static uint64_t vreg_tp_dummy;
-uint64_t *vreg_ptr = &vreg_tp_dummy;
-
-/**
- * Allocate and initialize a per-CPU user page to be accessible via the FS
- * segment register and to hold the virtual registers.
- */
-void vreg_init(void)
-{
-	uintptr_t frame;
-	uint64_t *page;
-
-	frame = frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0);
-	if (!frame)
-		panic("Cannot allocate VREG frame.");
-
-	page = (uint64_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE);
-
-	write_msr(AMD_MSR_FS, (uintptr_t) page);
-
-	vreg_ptr = NULL;
-}
-
-/** @}
- */
Index: rnel/arch/arm32/_link.ld.in
===================================================================
--- kernel/arch/arm32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * ARM linker script
- *
- *  kernel text
- *  kernel data
- *
- */
-
-#ifdef MACHINE_gta02
-#define KERNEL_LOAD_ADDRESS 0xb0a08000
-#elif defined MACHINE_beagleboardxm
-#define KERNEL_LOAD_ADDRESS 0x80a00000
-#elif defined MACHINE_beaglebone
-#define KERNEL_LOAD_ADDRESS 0x80a00000
-#elif defined MACHINE_raspberrypi
-#define KERNEL_LOAD_ADDRESS 0x80a08000
-#else
-#define KERNEL_LOAD_ADDRESS 0x80a00000
-#endif
-
-OUTPUT_ARCH(arm)
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	. = KERNEL_LOAD_ADDRESS;
-	kernel_load_address = .;
-	. = . + SIZEOF_HEADERS;
-
-	.text : {
-		ktext_start = .;
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		*(.data .data.*);                       /* initialized data */
-		*(.bss .bss.*);                        /* uninitialized static variables */
-		*(COMMON);                      /* global variables */
-
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-	  *(.mdebug*);
-	  *(.pdr);
-	  *(.comment);
-	  *(.note);
-	}
-}
Index: rnel/arch/arm32/include/arch/arch.h
===================================================================
--- kernel/arch/arm32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Empty.
- */
-
-#ifndef KERN_arm32_ARCH_H_
-#define KERN_arm32_ARCH_H_
-
-#define TASKMAP_MAX_RECORDS  32
-#define CPUMAP_MAX_RECORDS   32
-
-#define BOOTINFO_TASK_NAME_BUFLEN 32
-
-#include <stddef.h>
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	taskmap_t taskmap;
-} bootinfo_t;
-
-extern void arm32_pre_main(void *entry, bootinfo_t *bootinfo);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/asm.h
===================================================================
--- kernel/arch/arm32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Declarations of functions implemented in assembly.
- */
-
-#ifndef KERN_arm32_ASM_H_
-#define KERN_arm32_ASM_H_
-
-#include <typedefs.h>
-#include <arch/cp15.h>
-#include <arch/stack.h>
-#include <config.h>
-#include <arch/interrupt.h>
-#include <trace.h>
-
-/** CPU specific way to sleep cpu.
- *
- * ARMv7 introduced wait for event and wait for interrupt (wfe/wfi).
- * ARM920T has custom coprocessor action to do the same. See ARM920T Technical
- * Reference Manual ch 4.9 p. 4-23 (103 in the PDF)
- * ARM926EJ-S uses the same coprocessor instruction as ARM920T. See ARM926EJ-S
- * chapter 2.3.8 p.2-22 (52 in the PDF)
- *
- * @note Although CP15WFI (mcr p15, 0, R0, c7, c0, 4) is defined in ARM
- * Architecture reference manual for armv4/5, CP15 implementation is mandatory
- * only for armv6+.
- */
-_NO_TRACE static inline void cpu_sleep(void)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	asm volatile ("wfe");
-#elif defined(PROCESSOR_ARCH_armv6) | defined(PROCESSOR_arm926ej_s) | defined(PROCESSOR_arm920t)
-	WFI_write(0);
-#endif
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this atomically
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	asm volatile ("yield");
-#endif
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	return *port;
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void asm_delay_loop(uint32_t t);
-extern void userspace_asm(uintptr_t ustack, uintptr_t uspace_uarg,
-    uintptr_t entry);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/asm/boot.h
===================================================================
--- kernel/arch/arm32/include/arch/asm/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Initial kernel start.
- */
-
-#ifndef KERN_arm32_ASM_BOOT_H_
-#define KERN_arm32_ASM_BOOT_H_
-
-/** Size of a temporary stack used for initial kernel start. */
-#define TEMP_STACK_SIZE  0x100
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/barrier.h
===================================================================
--- kernel/arch/arm32/include/arch/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Memory barriers.
- */
-
-#ifndef KERN_arm32_BARRIER_H_
-#define KERN_arm32_BARRIER_H_
-
-#include <arch/cache.h>
-#include <arch/cp15.h>
-#include <align.h>
-
-#if defined PROCESSOR_ARCH_armv7_a
-
-/*
- * ARMv7 uses instructions for memory barriers see ARM Architecture reference
- * manual for details:
- * DMB: ch. A8.8.43 page A8-376
- * DSB: ch. A8.8.44 page A8-378
- * See ch. A3.8.3 page A3-148 for details about memory barrier implementation
- * and functionality on armv7 architecture.
- */
-#define dmb()    asm volatile ("dmb" ::: "memory")
-#define dsb()    asm volatile ("dsb" ::: "memory")
-#define isb()    asm volatile ("isb" ::: "memory")
-
-#elif defined PROCESSOR_ARCH_armv6
-
-/*
- * ARMv6 introduced user access of the following commands:
- * - Prefetch flush
- * - Data synchronization barrier
- * - Data memory barrier
- * - Clean and prefetch range operations.
- * ARM Architecture Reference Manual version I ch. B.3.2.1 p. B3-4
- */
-/*
- * ARMv6- use system control coprocessor (CP15) for memory barrier instructions.
- * Although at least mcr p15, 0, r0, c7, c10, 4 is mentioned in earlier archs,
- * CP15 implementation is mandatory only for armv6+.
- */
-#define dmb()    CP15DMB_write(0)
-#define dsb()    CP15DSB_write(0)
-#define isb()    CP15ISB_write(0)
-
-#else
-
-#define dmb()    CP15DSB_write(0)
-#define dsb()    CP15DSB_write(0)
-#define isb()
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/cache.h
===================================================================
--- kernel/arch/arm32/include/arch/cache.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Security Extensions Routines
- */
-
-#ifndef KERN_arm32_CACHE_H_
-#define KERN_arm32_CACHE_H_
-
-#include <typedefs.h>
-
-extern unsigned dcache_levels(void);
-
-extern void dcache_flush(void);
-extern void dcache_flush_invalidate(void);
-extern void cpu_dcache_flush(void);
-extern void cpu_dcache_flush_invalidate(void);
-extern void icache_invalidate(void);
-extern void dcache_invalidate(void);
-extern void dcache_clean_mva_pou(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/context.h
===================================================================
--- kernel/arch/arm32/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Thread context.
- */
-
-#ifndef KERN_arm32_CONTEXT_H_
-#define KERN_arm32_CONTEXT_H_
-
-#include <align.h>
-#include <arch/stack.h>
-#include <arch/context_struct.h>
-#include <arch/regutils.h>
-
-/* Put one item onto the stack to support CURRENT and align it up. */
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = (uintptr_t) (_pc); \
-		(c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-		(c)->fp = 0; \
-		(c)->cpu_mode = SUPERVISOR_MODE; \
-	} while (0)
-
-#ifndef __ASSEMBLER__
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/context_struct.h
===================================================================
--- kernel/arch/arm32/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#include <typedefs.h>
-
-// NOTE: This struct must match assembly code in src/context.S
-
-/*
- * Thread context containing registers that must be preserved across
- * function calls.
- */
-typedef struct context {
-	uint32_t cpu_mode;
-	uintptr_t sp;
-	uintptr_t pc;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	/* r11 */
-	uint32_t fp;
-	ipl_t ipl;
-} context_t;
-
-#endif
Index: rnel/arch/arm32/include/arch/cp15.h
===================================================================
--- kernel/arch/arm32/include/arch/cp15.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,666 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief System Control Coprocessor (CP15)
- */
-
-#ifndef KERN_arm32_CP15_H_
-#define KERN_arm32_CP15_H_
-
-#include <stdint.h>
-
-/** See ARM Architecture reference manual ch. B3.17.1 page B3-1456
- * for the list
- */
-
-#define CONTROL_REG_GEN_READ(name, crn, opc1, crm, opc2) \
-static inline uint32_t name##_read(void) \
-{ \
-	uint32_t val; \
-	asm volatile ( "mrc p15, "#opc1", %0, "#crn", "#crm", "#opc2"\n" : "=r" (val) ); \
-	return val; \
-}
-#define CONTROL_REG_GEN_WRITE(name, crn, opc1, crm, opc2) \
-static inline void name##_write(uint32_t val) \
-{ \
-	asm volatile ( "mcr p15, "#opc1", %0, "#crn", "#crm", "#opc2"\n" :: "r" (val) ); \
-}
-
-/* Identification registers */
-enum {
-	MIDR_IMPLEMENTER_MASK = 0xff,
-	MIDR_IMPLEMENTER_SHIFT = 24,
-	MIDR_VARIANT_MASK = 0xf,
-	MIDR_VARIANT_SHIFT = 20,
-	MIDR_ARCHITECTURE_MASK = 0xf,
-	MIDR_ARCHITECTURE_SHIFT = 16,
-	MIDR_PART_NUMBER_MASK = 0xfff,
-	MIDR_PART_NUMBER_SHIFT = 4,
-	MIDR_REVISION_MASK = 0xf,
-	MIDR_REVISION_SHIFT = 0,
-};
-CONTROL_REG_GEN_READ(MIDR, c0, 0, c0, 0);
-
-enum {
-	CTR_FORMAT_MASK = 0xe0000000,
-	CTR_FORMAT_ARMv7 = 0x80000000,
-	CTR_FORMAT_ARMv6 = 0x00000000,
-	/* ARMv7 format */
-	CTR_CWG_MASK = 0xf,
-	CTR_CWG_SHIFT = 24,
-	CTR_ERG_MASK = 0xf,
-	CTR_ERG_SHIFT = 20,
-	CTR_D_MIN_LINE_MASK = 0xf,
-	CTR_D_MIN_LINE_SHIFT = 16,
-	CTR_I_MIN_LINE_MASK = 0xf,
-	CTR_I_MIN_LINE_SHIFT = 0,
-	CTR_L1I_POLICY_MASK = 0x0000c000,
-	CTR_L1I_POLICY_AIVIVT = 0x00004000,
-	CTR_L1I_POLICY_VIPT = 0x00008000,
-	CTR_L1I_POLICY_PIPT = 0x0000c000,
-	/* ARMv6 format */
-	CTR_CTYPE_MASK = 0x1e000000,
-	CTR_CTYPE_WT = 0x00000000,
-	CTR_CTYPE_WB_NL = 0x04000000,
-	CTR_CTYPE_WB_D = 0x0a000000,
-	CTR_CTYPE_WB_A = 0x0c000000, /**< ARMv5- only */
-	CTR_CTYPE_WB_B = 0x0e000000, /**< ARMv5- only */
-	CTR_CTYPE_WB_C = 0x1c000000,
-	CTR_SEP_FLAG = 1 << 24,
-	CTR_DCACHE_P_FLAG = 1 << 23,
-	CTR_DCACHE_SIZE_MASK = 0xf,
-	CTR_DCACHE_SIZE_SHIFT = 18,
-	CTR_DCACHE_ASSOC_MASK = 0x7,
-	CTR_DCACHE_ASSOC_SHIFT = 15,
-	CTR_DCACHE_M_FLAG = 1 << 14,
-	CTR_DCACHE_LEN_MASK = 0x3,
-	CTR_DCACHE_LEN_SHIFT = 0,
-	CTR_ICACHE_P_FLAG = 1 << 11,
-	CTR_ICACHE_SIZE_MASK = 0xf,
-	CTR_ICACHE_SIZE_SHIFT = 6,
-	CTR_ICACHE_ASSOC_MASK = 0x7,
-	CTR_ICACHE_ASSOC_SHIFT = 3,
-	CTR_ICACHE_M_FLAG = 1 << 2,
-	CTR_ICACHE_LEN_MASK = 0x3,
-	CTR_ICACHE_LEN_SHIFT = 0,
-};
-CONTROL_REG_GEN_READ(CTR, c0, 0, c0, 1);
-
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_READ(TCMR, c0, 0, c0, 2);
-
-enum {
-	TLBTR_SEP_FLAG = 1,
-};
-
-CONTROL_REG_GEN_READ(TLBTR, c0, 0, c0, 3);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_READ(MPIDR, c0, 0, c0, 5);
-CONTROL_REG_GEN_READ(REVIDR, c0, 0, c0, 6);
-#endif
-
-enum {
-	ID_PFR0_THUMBEE_MASK = 0xf << 12,
-	ID_PFR0_THUMBEE = 0x1 << 12,
-	ID_PFR0_JAZELLE_MASK = 0xf << 8,
-	ID_PFR0_JAZELLE = 0x1 << 8,
-	ID_PFR0_JAZELLE_CV_CLEAR = 0x2 << 8,
-	ID_PFR0_THUMB_MASK = 0xf << 4,
-	ID_PFR0_THUMB = 0x1 << 4,
-	ID_PFR0_THUMB2 = 0x3 << 4,
-	ID_PFR0_ARM_MASK = 0xf << 0,
-	ID_PFR0_ARM = 0x1 << 0,
-};
-CONTROL_REG_GEN_READ(ID_PFR0, c0, 0, c1, 0);
-
-enum {
-	ID_PFR1_GEN_TIMER_EXT_MASK = 0xf << 16,
-	ID_PFR1_GEN_TIMER_EXT = 0x1 << 16,
-	ID_PFR1_VIRT_EXT_MASK = 0xf << 12,
-	ID_PFR1_VIRT_EXT = 0x1 << 12,
-	ID_PFR1_M_PROF_MASK = 0xf << 8,
-	ID_PFR1_M_PROF_MODEL = 0x2 << 8,
-	ID_PFR1_SEC_EXT_MASK = 0xf << 4,
-	ID_PFR1_SEC_EXT = 0x1 << 4,
-	ID_PFR1_SEC_EXT_RFR = 0x2 << 4,
-	ID_PFR1_ARMV4_MODEL_MASK = 0xf << 0,
-	ID_PFR1_ARMV4_MODEL = 0x1 << 0,
-};
-CONTROL_REG_GEN_READ(ID_PFR1, c0, 0, c1, 1);
-CONTROL_REG_GEN_READ(ID_DFR0, c0, 0, c1, 2);
-CONTROL_REG_GEN_READ(ID_AFR0, c0, 0, c1, 3);
-CONTROL_REG_GEN_READ(ID_MMFR0, c0, 0, c1, 4);
-CONTROL_REG_GEN_READ(ID_MMFR1, c0, 0, c1, 5);
-CONTROL_REG_GEN_READ(ID_MMFR2, c0, 0, c1, 6);
-CONTROL_REG_GEN_READ(ID_MMFR3, c0, 0, c1, 7);
-
-CONTROL_REG_GEN_READ(ID_ISAR0, c0, 0, c2, 0);
-CONTROL_REG_GEN_READ(ID_ISAR1, c0, 0, c2, 1);
-CONTROL_REG_GEN_READ(ID_ISAR2, c0, 0, c2, 2);
-CONTROL_REG_GEN_READ(ID_ISAR3, c0, 0, c2, 3);
-CONTROL_REG_GEN_READ(ID_ISAR4, c0, 0, c2, 4);
-CONTROL_REG_GEN_READ(ID_ISAR5, c0, 0, c2, 5);
-
-enum {
-	CCSIDR_WT_FLAG = 1 << 31,
-	CCSIDR_WB_FLAG = 1 << 30,
-	CCSIDR_RA_FLAG = 1 << 29,
-	CCSIDR_WA_FLAG = 1 << 28,
-	CCSIDR_NUMSETS_MASK = 0x7fff,
-	CCSIDR_NUMSETS_SHIFT = 13,
-	CCSIDR_ASSOC_MASK = 0x3ff,
-	CCSIDR_ASSOC_SHIFT = 3,
-	CCSIDR_LINESIZE_MASK = 0x7,
-	CCSIDR_LINESIZE_SHIFT = 0,
-};
-
-#define CCSIDR_SETS(val) \
-	(((val >> CCSIDR_NUMSETS_SHIFT) & CCSIDR_NUMSETS_MASK) + 1)
-#define CCSIDR_WAYS(val) \
-	(((val >> CCSIDR_ASSOC_SHIFT) & CCSIDR_ASSOC_MASK) + 1)
-/* The register value is log(linesize_in_words) - 2 */
-#define CCSIDR_LINESIZE_LOG(val) \
-	(((val >> CCSIDR_LINESIZE_SHIFT) & CCSIDR_LINESIZE_MASK) + 2 + 2)
-
-CONTROL_REG_GEN_READ(CCSIDR, c0, 1, c0, 0);
-
-enum {
-	CLIDR_LOUU_MASK = 0x7,
-	CLIDR_LOUU_SHIFT = 27,
-	CLIDR_LOC_MASK = 0x7,
-	CLIDR_LOC_SHIFT = 24,
-	CLIDR_LOUIS_MASK = 0x7,
-	CLIDR_LOUIS_SHIFT = 21,
-	CLIDR_NOCACHE = 0x0,
-	CLIDR_ICACHE_ONLY = 0x1,
-	CLIDR_DCACHE_ONLY = 0x2,
-	CLIDR_SEP_CACHE = 0x3,
-	CLIDR_UNI_CACHE = 0x4,
-	CLIDR_CACHE_MASK = 0x7,
-};
-
-/** levels counted from 0 */
-#define CLIDR_CACHE(level, val)   ((val >> (level * 3)) & CLIDR_CACHE_MASK)
-
-CONTROL_REG_GEN_READ(CLIDR, c0, 1, c0, 1);
-CONTROL_REG_GEN_READ(AIDR, c0, 1, c0, 7); /* Implementation defined or MIDR */
-
-enum {
-	CCSELR_LEVEL_MASK = 0x7,
-	CCSELR_LEVEL_SHIFT = 1,
-	CCSELR_INSTRUCTION_FLAG = 1 << 0,
-};
-CONTROL_REG_GEN_READ(CSSELR, c0, 2, c0, 0);
-CONTROL_REG_GEN_WRITE(CSSELR, c0, 2, c0, 0);
-CONTROL_REG_GEN_READ(VPIDR, c0, 4, c0, 0);
-CONTROL_REG_GEN_WRITE(VPIDR, c0, 4, c0, 0);
-CONTROL_REG_GEN_READ(VMPIDR, c0, 4, c0, 5);
-CONTROL_REG_GEN_WRITE(VMPIDR, c0, 4, c0, 5);
-
-/* System control registers */
-/*
- * Control register bit values see ch. B4.1.130 of ARM Architecture Reference
- * Manual ARMv7-A and ARMv7-R edition, page 1687
- */
-enum {
-	SCTLR_MMU_EN_FLAG            = 1 << 0,
-	SCTLR_ALIGN_CHECK_EN_FLAG    = 1 << 1,  /* Allow alignemnt check */
-	SCTLR_CACHE_EN_FLAG          = 1 << 2,
-	SCTLR_CP15_BARRIER_EN_FLAG   = 1 << 5,
-	SCTLR_B_EN_FLAG              = 1 << 7,  /* ARMv6-, big endian switch */
-	SCTLR_SWAP_EN_FLAG           = 1 << 10,
-	SCTLR_BRANCH_PREDICT_EN_FLAG = 1 << 11,
-	SCTLR_INST_CACHE_EN_FLAG     = 1 << 12,
-	SCTLR_HIGH_VECTORS_EN_FLAG   = 1 << 13,
-	SCTLR_ROUND_ROBIN_EN_FLAG    = 1 << 14,
-	SCTLR_HW_ACCESS_FLAG_EN_FLAG = 1 << 17,
-	SCTLR_WRITE_XN_EN_FLAG       = 1 << 19, /* Only if virt. supported */
-	SCTLR_USPCE_WRITE_XN_EN_FLAG = 1 << 20, /* Only if virt. supported */
-	SCTLR_FAST_IRQ_EN_FLAG       = 1 << 21, /* Disable impl. specific feat */
-	SCTLR_UNALIGNED_EN_FLAG      = 1 << 22, /* Must be 1 on armv7 */
-	SCTLR_EXTENDED_PT_EN_FLAG    = 1 << 23,
-	SCTLR_IRQ_VECTORS_EN_FLAG    = 1 << 24,
-	SCTLR_BIG_ENDIAN_EXC_FLAG    = 1 << 25,
-	SCTLR_NMFI_EN_FLAG           = 1 << 27,
-	SCTLR_TEX_REMAP_EN_FLAG      = 1 << 28,
-	SCTLR_ACCESS_FLAG_EN_FLAG    = 1 << 29,
-	SCTLR_THUMB_EXC_EN_FLAG      = 1 << 30,
-};
-CONTROL_REG_GEN_READ(SCTLR, c1, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(SCTLR, c1, 0, c0, 0);
-CONTROL_REG_GEN_READ(ACTLR, c1, 0, c0, 1);
-CONTROL_REG_GEN_WRITE(ACTLR, c1, 0, c0, 1);
-
-enum {
-	CPACR_ASEDIS_FLAG = 1 << 31,
-	CPACR_D32DIS_FLAG = 1 << 30,
-	CPACR_TRCDIS_FLAG = 1 << 28,
-#define CPACR_CP_MASK(cp) (0x3 << (cp * 2))
-#define CPACR_CP_NO_ACCESS(cp) (0x0 << (cp * 2))
-#define CPACR_CP_PL1_ACCESS(cp) (0x1 << (cp * 2))
-#define CPACR_CP_FULL_ACCESS(cp) (0x3 << (cp * 2))
-};
-CONTROL_REG_GEN_READ(CPACR, c1, 0, c0, 2);
-CONTROL_REG_GEN_WRITE(CPACR, c1, 0, c0, 2);
-
-/* Implemented as part of Security extensions */
-enum {
-	SCR_SIF_FLAG = 1 << 9,
-	SCR_HCE_FLAG = 1 << 8,
-	SCR_SCD_FLAG = 1 << 7,
-	SCR_nET_FLAG = 1 << 6,
-	SCR_AW_FLAG = 1 << 5,
-	SCR_FW_FLAG = 1 << 4,
-	SCR_EA_FLAG = 1 << 3,
-	SCR_FIQ_FLAG = 1 << 2,
-	SCR_IRQ_FLAG = 1 << 1,
-	SCR_NS_FLAG = 1 << 0,
-};
-CONTROL_REG_GEN_READ(SCR, c1, 0, c1, 0);
-CONTROL_REG_GEN_WRITE(SCR, c1, 0, c1, 0);
-CONTROL_REG_GEN_READ(SDER, c1, 0, c1, 1);
-CONTROL_REG_GEN_WRITE(SDER, c1, 0, c1, 1);
-
-enum {
-	NSACR_NSTRCDIS_FLAG = 1 << 20,
-	NSACR_RFR_FLAG = 1 << 19,
-	NSACR_NSASEDIS = 1 << 15,
-	NSACR_NSD32DIS = 1 << 14,
-#define NSACR_CP_FLAG(cp) (1 << cp)
-};
-CONTROL_REG_GEN_READ(NSACR, c1, 0, c1, 2);
-CONTROL_REG_GEN_WRITE(NSACR, c1, 0, c1, 2);
-
-/* Implemented as part of Virtualization extensions */
-CONTROL_REG_GEN_READ(HSCTLR, c1, 4, c0, 0);
-CONTROL_REG_GEN_WRITE(HSCTLR, c1, 4, c0, 0);
-CONTROL_REG_GEN_READ(HACTLR, c1, 4, c0, 1);
-CONTROL_REG_GEN_WRITE(HACTLR, c1, 4, c0, 1);
-
-CONTROL_REG_GEN_READ(HCR, c1, 4, c1, 0);
-CONTROL_REG_GEN_WRITE(HCR, c1, 4, c1, 0);
-CONTROL_REG_GEN_READ(HDCR, c1, 4, c1, 1);
-CONTROL_REG_GEN_WRITE(HDCR, c1, 4, c1, 1);
-CONTROL_REG_GEN_READ(HCPTR, c1, 4, c1, 2);
-CONTROL_REG_GEN_WRITE(HCPTR, c1, 4, c1, 2);
-CONTROL_REG_GEN_READ(HSTR, c1, 4, c1, 3);
-CONTROL_REG_GEN_WRITE(HSTR, c1, 4, c1, 3);
-CONTROL_REG_GEN_READ(HACR, c1, 4, c1, 7);
-CONTROL_REG_GEN_WRITE(HACR, c1, 4, c1, 7);
-
-/* Memory protection and control registers */
-enum {
-	TTBR_ADDR_MASK = 0xffffff80,
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	TTBR_NOS_FLAG = 1 << 5,
-	TTBR_RGN_MASK = 0x3 << 3,
-	TTBR_RGN_NO_CACHE = 0x0 << 3,
-	TTBR_RGN_WBWA_CACHE = 0x1 << 3,
-	TTBR_RGN_WT_CACHE = 0x2 << 3,
-	TTBR_RGN_WB_CACHE = 0x3 << 3,
-	TTBR_S_FLAG = 1 << 1,
-	TTBR_C_FLAG = 1 << 0,
-#endif
-};
-CONTROL_REG_GEN_READ(TTBR0, c2, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(TTBR0, c2, 0, c0, 0);
-
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_READ(TTBR1, c2, 0, c0, 1);
-CONTROL_REG_GEN_WRITE(TTBR1, c2, 0, c0, 1);
-CONTROL_REG_GEN_READ(TTBCR, c2, 0, c0, 2);
-CONTROL_REG_GEN_WRITE(TTBCR, c2, 0, c0, 2);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv7)
-CONTROL_REG_GEN_READ(HTCR, c2, 4, c0, 2);
-CONTROL_REG_GEN_WRITE(HTCR, c2, 4, c0, 2);
-CONTROL_REG_GEN_READ(VTCR, c2, 4, c1, 2);
-CONTROL_REG_GEN_WRITE(VTCR, c2, 4, c1, 2);
-
-/* PAE */
-CONTROL_REG_GEN_READ(TTBR0H, c2, 0, c2, 0);
-CONTROL_REG_GEN_WRITE(TTBR0H, c2, 0, c2, 0);
-CONTROL_REG_GEN_READ(TTBR1H, c2, 0, c2, 1);
-CONTROL_REG_GEN_WRITE(TTBR1H, c2, 0, c2, 1);
-CONTROL_REG_GEN_READ(HTTBRH, c2, 0, c2, 4);
-CONTROL_REG_GEN_WRITE(HTTBRH, c2, 0, c2, 4);
-CONTROL_REG_GEN_READ(VTTBRH, c2, 0, c2, 6);
-CONTROL_REG_GEN_WRITE(VTTBRH, c2, 0, c2, 6);
-#endif
-
-CONTROL_REG_GEN_READ(DACR, c3, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(DACR, c3, 0, c0, 0);
-
-/* Memory system fault registers */
-CONTROL_REG_GEN_READ(DFSR, c5, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(DFSR, c5, 0, c0, 0);
-CONTROL_REG_GEN_READ(IFSR, c5, 0, c0, 1);
-CONTROL_REG_GEN_WRITE(IFSR, c5, 0, c0, 1);
-
-CONTROL_REG_GEN_READ(ADFSR, c5, 0, c1, 0);
-CONTROL_REG_GEN_WRITE(ADFSR, c5, 0, c1, 0);
-CONTROL_REG_GEN_READ(AIFSR, c5, 0, c1, 1);
-CONTROL_REG_GEN_WRITE(AIFSR, c5, 0, c1, 1);
-
-CONTROL_REG_GEN_READ(HADFSR, c5, 4, c1, 0);
-CONTROL_REG_GEN_WRITE(HADFSR, c5, 4, c1, 0);
-CONTROL_REG_GEN_READ(HAIFSR, c5, 4, c1, 1);
-CONTROL_REG_GEN_WRITE(HAIFSR, c5, 4, c1, 1);
-CONTROL_REG_GEN_READ(HSR, c5, 4, c2, 0);
-CONTROL_REG_GEN_WRITE(HSR, c5, 4, c2, 0);
-
-CONTROL_REG_GEN_READ(DFAR, c6, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(DFAR, c6, 0, c0, 0);
-CONTROL_REG_GEN_READ(IFAR, c6, 0, c0, 2);
-CONTROL_REG_GEN_WRITE(IFAR, c6, 0, c0, 2);
-
-CONTROL_REG_GEN_READ(HDFAR, c6, 4, c0, 0);
-CONTROL_REG_GEN_WRITE(HDFAR, c6, 4, c0, 0);
-CONTROL_REG_GEN_READ(HIFAR, c6, 4, c0, 2);
-CONTROL_REG_GEN_WRITE(HIFAR, c6, 4, c0, 2);
-CONTROL_REG_GEN_READ(HPFAR, c6, 4, c0, 4);
-CONTROL_REG_GEN_WRITE(HPFAR, c6, 4, c0, 4);
-
-/*
- * Cache maintenance, address translation and other
- */
-
-#if defined(PROCESSOR_cortex_a8)
-#define CP15_C7_MVA_ALIGN	64
-#elif defined(PROCESSOR_arm1176jzf_s)
-#define CP15_C7_MVA_ALIGN	32
-#elif defined(PROCESSOR_arm926ej_s)
-#define CP15_C7_MVA_ALIGN	32
-#elif defined(PROCESSOR_arm920t)
-#define CP15_C7_MVA_ALIGN	32
-#else
-#error Unknown MVA alignment
-#endif
-
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(CP15ISB, c7, 0, c5, 4);
-CONTROL_REG_GEN_WRITE(BPIALL, c7, 0, c5, 6);
-CONTROL_REG_GEN_WRITE(BPIMVA, c7, 0, c5, 7);
-#endif
-
-#if !defined(PROCESSOR_arm920t)
-CONTROL_REG_GEN_WRITE(DCISW, c7, 0, c6, 2);
-#endif
-
-#if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(DCCSW, c7, 0, c10, 2);
-#endif
-
-CONTROL_REG_GEN_WRITE(CP15DSB, c7, 0, c10, 4);
-
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(CP15DMB, c7, 0, c10, 5);
-#endif
-
-#if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(DCCISW, c7, 0, c14, 2);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(ICIALLLUIS, c7, 0, c1, 0);
-CONTROL_REG_GEN_WRITE(BPIALLIS, c7, 0, c1, 6);
-CONTROL_REG_GEN_READ(PAR, c7, 0, c4, 0); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(PAR, c7, 0, c4, 0); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ICIALLU, c7, 0, c5, 0);
-CONTROL_REG_GEN_WRITE(ICIMVAU, c7, 0, c5, 1);
-CONTROL_REG_GEN_WRITE(DCIMVAC, c7, 0, c6, 1);
-CONTROL_REG_GEN_READ(PARH, c7, 0, c7, 0); /* PAE */
-CONTROL_REG_GEN_WRITE(PARH, c7, 0, c7, 0); /* PAE */
-CONTROL_REG_GEN_WRITE(ATS1CPR, c7, 0, c8, 0); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS1CPW, c7, 0, c8, 1); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS1CUR, c7, 0, c8, 2); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS1CUW, c7, 0, c8, 3); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS12NSOPR, c7, 0, c8, 4); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS12NSOPW, c7, 0, c8, 5); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS12NSOUR, c7, 0, c8, 6); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS12NSOUW, c7, 0, c8, 7); /* Security Extensions */
-CONTROL_REG_GEN_WRITE(ATS1HR, c7, 4, c8, 0); /* Virtualization Extensions */
-CONTROL_REG_GEN_WRITE(ATS1HW, c7, 4, c8, 1); /* Virtualization Extensions */
-CONTROL_REG_GEN_WRITE(DCCMVAC, c7, 0, c10, 1);
-CONTROL_REG_GEN_WRITE(DCCMVAU, c7, 0, c11, 1);
-CONTROL_REG_GEN_WRITE(DCCIMVAC, c7, 0, c14, 1);
-#else
-
-#if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(WFI, c7, 0, c0, 4);
-#endif
-
-CONTROL_REG_GEN_WRITE(ICIALL, c7, 0, c5, 0);
-CONTROL_REG_GEN_WRITE(ICIMVA, c7, 0, c5, 1);
-
-#if !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(ICISW, c7, 0, c5, 2);
-#endif
-
-CONTROL_REG_GEN_WRITE(DCIALL, c7, 0, c6, 0);
-CONTROL_REG_GEN_WRITE(DCIMVA, c7, 0, c6, 1);
-CONTROL_REG_GEN_WRITE(CIALL, c7, 0, c7, 0);
-CONTROL_REG_GEN_WRITE(CIMVA, c7, 0, c7, 1);
-
-#if !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(CISW, c7, 0, c7, 2);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6)
-CONTROL_REG_GEN_WRITE(DCCALL, c7, 0, c10, 0);
-#endif
-
-CONTROL_REG_GEN_WRITE(DCCMVA, c7, 0, c10, 1);
-
-#if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6)
-CONTROL_REG_GEN_WRITE(CCALL, c7, 0, c11, 0);
-#endif
-
-CONTROL_REG_GEN_WRITE(CCMVA, c7, 0, c11, 1);
-
-#if !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(CCSW, c7, 0, c11, 2);
-#endif
-
-#if defined(PROCESSOR_arm920t) || !defined(PROCESSOR_ARCH_armv4)
-CONTROL_REG_GEN_WRITE(PFIMVA, c7, 0, c13, 1);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6)
-CONTROL_REG_GEN_WRITE(DCCIALL, c7, 0, c14, 0);
-#endif
-
-CONTROL_REG_GEN_WRITE(DCCIMVA, c7, 0, c14, 1);
-
-#if defined(PROCESSOR_ARCH_armv4) || defined(PROCESSOR_ARCH_armv6)
-CONTROL_REG_GEN_WRITE(CCIALL, c7, 0, c15, 0);
-#endif
-
-CONTROL_REG_GEN_WRITE(CCIMVA, c7, 0, c15, 1);
-
-#if defined(PROCESSOR_ARCH_armv5) || defined(PROCESSOR_ARCH_armv6)
-CONTROL_REG_GEN_WRITE(CCISW, c7, 0, c15, 2);
-#endif
-
-#endif
-
-/* TLB maintenance */
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(TLBIALLIS, c8, 0, c3, 0); /* Inner shareable */
-CONTROL_REG_GEN_WRITE(TLBIMVAIS, c8, 0, c3, 1); /* Inner shareable */
-CONTROL_REG_GEN_WRITE(TLBIASIDIS, c8, 0, c3, 2); /* Inner shareable */
-CONTROL_REG_GEN_WRITE(TLBIMVAAIS, c8, 0, c3, 3); /* Inner shareable */
-#endif
-
-CONTROL_REG_GEN_WRITE(ITLBIALL, c8, 0, c5, 0);
-CONTROL_REG_GEN_WRITE(ITLBIMVA, c8, 0, c5, 1);
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(ITLBIASID, c8, 0, c5, 2);
-#endif
-
-CONTROL_REG_GEN_WRITE(DTLBIALL, c8, 0, c6, 0);
-CONTROL_REG_GEN_WRITE(DTLBIMVA, c8, 0, c6, 1);
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(DTLBIASID, c8, 0, c6, 2);
-#endif
-
-CONTROL_REG_GEN_WRITE(TLBIALL, c8, 0, c7, 0);
-CONTROL_REG_GEN_WRITE(TLBIMVA, c8, 0, c7, 1);
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(TLBIASID, c8, 0, c7, 2);
-#endif
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(TLBIMVAA, c8, 0, c7, 3);
-#endif
-
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(TLBIALLHIS, c8, 4, c3, 0); /* Inner shareable */
-CONTROL_REG_GEN_WRITE(TLBIMVAHIS, c8, 4, c3, 1); /* Inner shareable */
-CONTROL_REG_GEN_WRITE(TLBIALLNSNHIS, c8, 4, c3, 4); /* Inner shareable */
-#endif
-
-#if defined(PROCESSOR_ARCH_armv7_a)
-CONTROL_REG_GEN_WRITE(TLBIALLH, c8, 4, c7, 0);
-CONTROL_REG_GEN_WRITE(TLBIMVAH, c8, 4, c7, 1);
-CONTROL_REG_GEN_WRITE(TLBIALLNSNHS, c8, 4, c7, 4);
-#endif
-
-/* c9 are performance monitoring resgisters */
-enum {
-	PMCR_IMP_MASK = 0xff,
-	PMCR_IMP_SHIFT = 24,
-	PMCR_IDCODE_MASK = 0xff,
-	PMCR_IDCODE_SHIFT = 16,
-	PMCR_EVENT_NUM_MASK = 0x1f,
-	PMCR_EVENT_NUM_SHIFT = 11,
-	PMCR_DP_FLAG = 1 << 5,
-	PMCR_X_FLAG = 1 << 4,
-	PMCR_D_FLAG = 1 << 3,
-	PMCR_C_FLAG = 1 << 2,
-	PMCR_P_FLAG = 1 << 1,
-	PMCR_E_FLAG = 1 << 0,
-};
-CONTROL_REG_GEN_READ(PMCR, c9, 0, c12, 0);
-CONTROL_REG_GEN_WRITE(PMCR, c9, 0, c12, 0);
-enum {
-	PMCNTENSET_CYCLE_COUNTER_EN_FLAG = 1 << 31,
-#define PMCNTENSET_COUNTER_EN_FLAG(c)   (1 << c)
-};
-CONTROL_REG_GEN_READ(PMCNTENSET, c9, 0, c12, 1);
-CONTROL_REG_GEN_WRITE(PMCNTENSET, c9, 0, c12, 1);
-CONTROL_REG_GEN_READ(PMCCNTR, c9, 0, c13, 0);
-CONTROL_REG_GEN_WRITE(PMCCNTR, c9, 0, c13, 0);
-
-/* c10 has tons of reserved too */
-CONTROL_REG_GEN_READ(PRRR, c10, 0, c2, 0); /* no PAE */
-CONTROL_REG_GEN_WRITE(PRRR, c10, 0, c2, 0); /* no PAE */
-CONTROL_REG_GEN_READ(MAIR0, c10, 0, c2, 0); /* PAE */
-CONTROL_REG_GEN_WRITE(MAIR0, c10, 0, c2, 0); /* PAE */
-CONTROL_REG_GEN_READ(NMRR, c10, 0, c2, 1); /* no PAE */
-CONTROL_REG_GEN_WRITE(NMRR, c10, 0, c2, 1); /* no PAE */
-CONTROL_REG_GEN_READ(MAIR1, c10, 0, c2, 1); /* PAE */
-CONTROL_REG_GEN_WRITE(MAIR1, c10, 0, c2, 1); /* PAE */
-
-CONTROL_REG_GEN_READ(AMAIR0, c10, 0, c3, 0); /* PAE */
-CONTROL_REG_GEN_WRITE(AMAIR0, c10, 0, c3, 0); /* PAE */
-CONTROL_REG_GEN_READ(AMAIR1, c10, 0, c3, 1); /* PAE */
-CONTROL_REG_GEN_WRITE(AMAIR1, c10, 0, c3, 1); /* PAE */
-
-CONTROL_REG_GEN_READ(HMAIR0, c10, 4, c2, 0);
-CONTROL_REG_GEN_WRITE(HMAIR0, c10, 4, c2, 0);
-CONTROL_REG_GEN_READ(HMAIR1, c10, 4, c2, 1);
-CONTROL_REG_GEN_WRITE(HMAIR1, c10, 4, c2, 1);
-
-CONTROL_REG_GEN_READ(HAMAIR0, c10, 4, c3, 0);
-CONTROL_REG_GEN_WRITE(HAMAIR0, c10, 4, c3, 0);
-CONTROL_REG_GEN_READ(HAMAIR1, c10, 4, c3, 1);
-CONTROL_REG_GEN_WRITE(HAMAIR1, c10, 4, c3, 1);
-
-/* c11 is reserved for TCM and DMA */
-
-/* Security extensions */
-CONTROL_REG_GEN_READ(VBAR, c12, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(VBAR, c12, 0, c0, 0);
-CONTROL_REG_GEN_READ(MVBAR, c12, 0, c0, 1);
-CONTROL_REG_GEN_WRITE(MVBAR, c12, 0, c0, 1);
-
-CONTROL_REG_GEN_READ(ISR, c12, 0, c1, 0);
-
-CONTROL_REG_GEN_READ(HVBAR, c12, 4, c0, 0);
-CONTROL_REG_GEN_WRITE(HVBAR, c12, 4, c0, 0);
-
-/* Process context and thread id (FCSE) */
-CONTROL_REG_GEN_READ(FCSEIDR, c13, 0, c0, 0);
-
-CONTROL_REG_GEN_READ(CONTEXTIDR, c13, 0, c0, 1);
-CONTROL_REG_GEN_WRITE(CONTEXTIDR, c13, 0, c0, 1);
-CONTROL_REG_GEN_READ(TPIDRURW, c13, 0, c0, 2);
-CONTROL_REG_GEN_WRITE(TPIDRURW, c13, 0, c0, 2);
-CONTROL_REG_GEN_READ(TPIDRURO, c13, 0, c0, 3);
-CONTROL_REG_GEN_WRITE(TPIDRURO, c13, 0, c0, 3);
-CONTROL_REG_GEN_READ(TPIDRPRW, c13, 0, c0, 4);
-CONTROL_REG_GEN_WRITE(TPIDRPRW, c13, 0, c0, 4);
-
-CONTROL_REG_GEN_READ(HTPIDR, c13, 4, c0, 2);
-CONTROL_REG_GEN_WRITE(HTPIDR, c13, 4, c0, 2);
-
-/* Generic Timer Extensions */
-CONTROL_REG_GEN_READ(CNTFRQ, c14, 0, c0, 0);
-CONTROL_REG_GEN_WRITE(CNTFRQ, c14, 0, c0, 0);
-CONTROL_REG_GEN_READ(CNTKCTL, c14, 0, c1, 0);
-CONTROL_REG_GEN_WRITE(CNTKCTL, c14, 0, c1, 0);
-
-CONTROL_REG_GEN_READ(CNTP_TVAL, c14, 0, c2, 0);
-CONTROL_REG_GEN_WRITE(CNTP_TVAL, c14, 0, c2, 0);
-CONTROL_REG_GEN_READ(CNTP_CTL, c14, 0, c2, 1);
-CONTROL_REG_GEN_WRITE(CNTP_CTL, c14, 0, c2, 1);
-
-CONTROL_REG_GEN_READ(CNTV_TVAL, c14, 0, c3, 0);
-CONTROL_REG_GEN_WRITE(CNTV_TVAL, c14, 0, c3, 0);
-CONTROL_REG_GEN_READ(CNTV_CTL, c14, 0, c3, 1);
-CONTROL_REG_GEN_WRITE(CNTV_CTL, c14, 0, c3, 1);
-
-CONTROL_REG_GEN_READ(CNTHCTL, c14, 4, c1, 0);
-CONTROL_REG_GEN_WRITE(CNTHCTL, c14, 4, c1, 0);
-
-CONTROL_REG_GEN_READ(CNTHP_TVAL, c14, 4, c2, 0);
-CONTROL_REG_GEN_WRITE(CNTHP_TVAL, c14, 4, c2, 0);
-CONTROL_REG_GEN_READ(CNTHP_CTL, c14, 4, c2, 1);
-CONTROL_REG_GEN_WRITE(CNTHP_CTL, c14, 4, c2, 1);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/cpu.h
===================================================================
--- kernel/arch/arm32/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief CPU identification.
- */
-
-#ifndef KERN_arm32_CPU_H_
-#define KERN_arm32_CPU_H_
-
-#include <arch/asm.h>
-#include <stdint.h>
-
-enum {
-	ARM_MAX_CACHE_LEVELS = 7,
-};
-
-/** Struct representing ARM CPU identification. */
-typedef struct {
-	/** Implementor (vendor) number. */
-	uint32_t imp_num;
-
-	/** Variant number. */
-	uint32_t variant_num;
-
-	/** Architecture number. */
-	uint32_t arch_num;
-
-	/** Primary part number. */
-	uint32_t prim_part_num;
-
-	/** Revision number. */
-	uint32_t rev_num;
-
-	struct {
-		unsigned ways;
-		unsigned sets;
-		unsigned line_size;
-		unsigned way_shift;
-		unsigned set_shift;
-	} dcache[ARM_MAX_CACHE_LEVELS];
-	unsigned dcache_levels;
-} cpu_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/cycle.h
===================================================================
--- kernel/arch/arm32/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Count of CPU cycles.
- */
-
-#ifndef KERN_arm32_CYCLE_H_
-#define KERN_arm32_CYCLE_H_
-
-#include <trace.h>
-#include <arch/cp15.h>
-
-/** Return count of CPU cycles.
- *
- * No such instruction on ARM to get count of cycles.
- *
- * @return Count of CPU cycles.
- *
- */
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	if ((ID_PFR1_read() & ID_PFR1_GEN_TIMER_EXT_MASK) ==
-	    ID_PFR1_GEN_TIMER_EXT) {
-		uint32_t low = 0, high = 0;
-		asm volatile (
-		    "MRRC p15, 0, %[low], %[high], c14"
-		    : [low] "=r" (low), [high] "=r" (high)
-		);
-		return ((uint64_t)high << 32) | low;
-	} else {
-		return (uint64_t)PMCCNTR_read() * 64;
-	}
-#endif
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/exception.h
===================================================================
--- kernel/arch/arm32/include/arch/exception.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt, Petr Stepan
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Exception declarations.
- */
-
-#ifndef KERN_arm32_EXCEPTION_H_
-#define KERN_arm32_EXCEPTION_H_
-
-#include <typedefs.h>
-#include <arch/istate.h>
-
-/** If defined, forces using of high exception vectors. */
-#define HIGH_EXCEPTION_VECTORS
-
-#ifdef HIGH_EXCEPTION_VECTORS
-#define EXC_BASE_ADDRESS  0xffff0000
-#else
-#define EXC_BASE_ADDRESS  0x0
-#endif
-
-/* Exception Vectors */
-#define EXC_RESET_VEC           (EXC_BASE_ADDRESS + 0x0)
-#define EXC_UNDEF_INSTR_VEC     (EXC_BASE_ADDRESS + 0x4)
-#define EXC_SWI_VEC             (EXC_BASE_ADDRESS + 0x8)
-#define EXC_PREFETCH_ABORT_VEC  (EXC_BASE_ADDRESS + 0xc)
-#define EXC_DATA_ABORT_VEC      (EXC_BASE_ADDRESS + 0x10)
-#define EXC_IRQ_VEC             (EXC_BASE_ADDRESS + 0x18)
-#define EXC_FIQ_VEC             (EXC_BASE_ADDRESS + 0x1c)
-
-/* Exception numbers */
-#define EXC_RESET           0
-#define EXC_UNDEF_INSTR     1
-#define EXC_SWI             2
-#define EXC_PREFETCH_ABORT  3
-#define EXC_DATA_ABORT      4
-#define EXC_IRQ             5
-#define EXC_FIQ             6
-
-/** Kernel stack pointer.
- *
- * It is set when thread switches to user mode,
- * and then used for exception handling.
- *
- */
-extern uintptr_t supervisor_sp;
-
-/** Temporary exception stack pointer.
- *
- * Temporary stack is used in exceptions handling routines
- * before switching to thread's kernel stack.
- *
- */
-extern uintptr_t exc_stack;
-
-extern void install_exception_handlers(void);
-extern void exception_init(void);
-extern void reset_exception_entry(void);
-extern void irq_exception_entry(void);
-extern void fiq_exception_entry(void);
-extern void undef_instr_exception_entry(void);
-extern void prefetch_abort_exception_entry(void);
-extern void data_abort_exception_entry(void);
-extern void swi_exception_entry(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/faddr.h
===================================================================
--- kernel/arch/arm32/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Function address conversion.
- */
-
-#ifndef KERN_arm32_FADDR_H_
-#define KERN_arm32_FADDR_H_
-
-#include <typedefs.h>
-
-/** Calculate absolute address of function referenced by fptr pointer.
- *
- * @param fptr Function pointer.
- *
- */
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/fpu_context.h
===================================================================
--- kernel/arch/arm32/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief FPU context.
- */
-
-#ifndef KERN_arm32_FPU_CONTEXT_H_
-#define KERN_arm32_FPU_CONTEXT_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/*
- * ARM Architecture reference manual, p B-1529.
- */
-typedef struct {
-	_Alignas(8) uint32_t fpexc;
-	uint32_t fpscr;
-	uint32_t s[64];
-} fpu_context_t;
-
-void fpu_setup(void);
-
-bool handle_if_fpu_exception(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/interrupt.h
===================================================================
--- kernel/arch/arm32/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_interrupt
- * @{
- */
-/** @file
- *  @brief Declarations of interrupt controlling routines.
- */
-
-#ifndef KERN_arm32_INTERRUPT_H_
-#define KERN_arm32_INTERRUPT_H_
-
-#include <stdbool.h>
-#include <arch/exception.h>
-
-/** Initial size of exception dispatch table. */
-#define IVT_ITEMS  6
-
-/** Index of the first item in exception dispatch table. */
-#define IVT_FIRST  0
-
-extern void interrupt_init(void);
-extern ipl_t interrupts_disable(void);
-extern ipl_t interrupts_enable(void);
-extern void interrupts_restore(ipl_t ipl);
-extern ipl_t interrupts_read(void);
-extern bool interrupts_disabled(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/istate.h
===================================================================
--- kernel/arch/arm32/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt, Petr Stepan
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_interrupt
- * @{
- */
-
-#ifndef KERN_arm32_ISTATE_H_
-#define KERN_arm32_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/istate_struct.h>
-#include <arch/regutils.h>
-
-#else /* KERNEL */
-
-#include <libarch/istate_struct.h>
-#include <libarch/regutils.h>
-
-#endif /* KERNEL */
-
-/** Set Program Counter member of given istate structure.
- *
- * @param istate  istate structure
- * @param retaddr new value of istate's PC member
- *
- */
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->pc = retaddr;
-}
-
-/** Return true if exception happened while in userspace. */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return (istate->spsr & STATUS_REG_MODE_MASK) == USER_MODE;
-}
-
-/** Return Program Counter member of given istate structure. */
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->pc;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	return istate->fp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/arm32/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#include <stdint.h>
-
-// NOTE: Must match assembly code in src/exc_handler.S
-
-typedef struct istate {
-	uint32_t dummy;
-	uint32_t spsr;
-	uint32_t sp;
-	uint32_t lr;
-	uint32_t r0;
-	uint32_t r1;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t fp;
-	uint32_t r12;
-	uint32_t pc;
-} istate_t;
-
-#endif
Index: rnel/arch/arm32/include/arch/mach/beagleboardxm/beagleboardxm.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/beagleboardxm/beagleboardxm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_arm32_beagleboardxm beagleboardxm
- *  @brief BeagleBoard-xM platform.
- *  @ingroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief BeagleBoard platform driver.
- */
-
-#ifndef KERN_arm32_beagleboardxm_H_
-#define KERN_arm32_beagleboardxm_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops bbxm_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mach/beaglebone/beaglebone.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/beaglebone/beaglebone.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Matteo Facchinetti
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_arm32_beaglebone beaglebone
- *  @brief BeagleBone platform.
- *  @ingroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief BeagleBone platform driver.
- */
-
-#ifndef KERN_arm32_beaglebone_H_
-#define KERN_arm32_beaglebone_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops bbone_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mach/gta02/gta02.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/gta02/gta02.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_gta02 GTA02
- *  @brief Openmoko GTA02 platform.
- *  @ingroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Openmoko GTA02 platform driver.
- */
-
-#ifndef KERN_arm32_gta02_H_
-#define KERN_arm32_gta02_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops gta02_machine_ops;
-
-/** Size of GTA02 IRQ number range (starting from 0) */
-#define GTA02_IRQ_COUNT 32
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/integratorcp/integratorcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_integratorcp
- *  @brief Integratorcp machine specific parts.
- *  @ingroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Integratorcp peripheries drivers declarations.
- */
-
-#ifndef KERN_arm32_icp_H_
-#define KERN_arm32_icp_H_
-
-#include <arch/machine_func.h>
-
-/** Last interrupt number (beginning from 0) whose status is probed
- * from interrupt controller
- */
-#define ICP_IRQC_MAX_IRQ  8
-#define ICP_KBD_IRQ       3
-#define ICP_TIMER_IRQ     6
-#define ICP_UART0_IRQ     1
-
-/** Timer frequency */
-#define ICP_TIMER_FREQ  10000
-
-#define ICP_UART			0x16000000
-#define ICP_KBD				0x18000000
-#define ICP_KBD_STAT			0x04
-#define ICP_KBD_DATA			0x08
-#define ICP_KBD_INTR_STAT		0x10
-#define ICP_RTC				0x13000000
-#define ICP_RTC1_LOAD_OFFSET		0x100
-#define ICP_RTC1_READ_OFFSET		0x104
-#define ICP_RTC1_CTL_OFFSET		0x108
-#define ICP_RTC1_INTRCLR_OFFSET		0x10C
-#define ICP_RTC1_INTRSTAT_OFFSET	0x114
-#define ICP_RTC1_BGLOAD_OFFSET		0x118
-#define ICP_RTC_CTL_VALUE		0x00E2
-#define ICP_IRQC			0x14000000
-#define ICP_IRQC_MASK_OFFSET		0xC
-#define ICP_IRQC_UNMASK_OFFSET		0x8
-#define ICP_FB				0x00800000
-#define ICP_FB_FRAME			(ICP_FB >> 12)
-#define ICP_FB_NUM_FRAME		512
-#define ICP_VGA				0xC0000000
-#define ICP_CMCR			0x10000000
-#define ICP_SDRAM_MASK			0x1C
-#define ICP_SDRAMCR_OFFSET		0x20
-
-typedef struct {
-	uintptr_t uart;
-	uintptr_t kbd_ctrl;
-	uintptr_t kbd_stat;
-	uintptr_t kbd_data;
-	uintptr_t kbd_intstat;
-	uintptr_t rtc;
-	uintptr_t rtc1_load;
-	uintptr_t rtc1_read;
-	uintptr_t rtc1_ctl;
-	uintptr_t rtc1_intrclr;
-	uintptr_t rtc1_intrstat;
-	uintptr_t rtc1_bgload;
-	uintptr_t irqc;
-	uintptr_t irqc_mask;
-	uintptr_t irqc_unmask;
-	uintptr_t vga;
-	uintptr_t cmcr;
-	uintptr_t sdramcr;
-} icp_hw_map_t;
-
-extern void icp_init(void);
-extern void icp_output_init(void);
-extern void icp_input_init(void);
-extern void icp_timer_irq_start(void);
-extern void icp_cpu_halt(void);
-extern void icp_irq_exception(unsigned int, istate_t *);
-extern void icp_get_memory_extents(uintptr_t *, size_t *);
-extern void icp_frame_init(void);
-extern size_t icp_get_irq_count(void);
-extern const char *icp_get_platform_name(void);
-
-extern struct arm_machine_ops icp_machine_ops;
-
-/** Size of IntegratorCP IRQ number range (starting from 0) */
-#define ICP_IRQ_COUNT 8
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mach/raspberrypi/raspberrypi.h
===================================================================
--- kernel/arch/arm32/include/arch/mach/raspberrypi/raspberrypi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_raspberrypi raspberrypi
- *  @brief Raspberry Pi platform.
- *  @ingroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Raspberry Pi platform driver.
- */
-
-#ifndef KERN_arm32_raspberrypi_H_
-#define KERN_arm32_raspberrypi_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops raspberrypi_machine_ops;
-
-#define BCM2835_UART0_BASE_ADDRESS   0x20201000
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/machine_func.h
===================================================================
--- kernel/arch/arm32/include/arch/machine_func.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Declarations of machine specific functions.
- *
- *  These functions enable to differentiate more kinds of ARM emulators
- *  or CPUs. It's the same concept as "arch" functions on the architecture
- *  level.
- */
-
-#ifndef KERN_arm32_MACHINE_FUNC_H_
-#define KERN_arm32_MACHINE_FUNC_H_
-
-#include <console/console.h>
-#include <typedefs.h>
-#include <arch/exception.h>
-
-struct arm_machine_ops {
-	void (*machine_init)(void);
-	void (*machine_timer_irq_start)(void);
-	void (*machine_cpu_halt)(void);
-	void (*machine_get_memory_extents)(uintptr_t *, size_t *);
-	void (*machine_irq_exception)(unsigned int, istate_t *);
-	void (*machine_frame_init)(void);
-	void (*machine_output_init)(void);
-	void (*machine_input_init)(void);
-	size_t (*machine_get_irq_count)(void);
-	const char *(*machine_get_platform_name)(void);
-};
-
-/** Pointer to arm_machine_ops structure being used. */
-extern struct arm_machine_ops *machine_ops;
-
-/** Initialize machine_ops pointer. */
-extern void machine_ops_init(void);
-
-/** Maps HW devices to the kernel address space using #hw_map. */
-extern void machine_init(void);
-
-/** Starts timer. */
-extern void machine_timer_irq_start(void);
-
-/** Halts CPU. */
-extern void machine_cpu_halt(void);
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address.
- * @param size		Place to store memory size.
- */
-extern void machine_get_memory_extents(uintptr_t *start, size_t *size);
-
-/** Interrupt exception handler.
- *
- * @param exc_no Interrupt exception number.
- * @param istate Saved processor state.
- */
-extern void machine_irq_exception(unsigned int exc_no, istate_t *istate);
-
-/*
- * Machine specific frame initialization
- */
-extern void machine_frame_init(void);
-
-/*
- * configure the serial line output device.
- */
-extern void machine_output_init(void);
-
-/*
- * configure the serial line input device.
- */
-extern void machine_input_init(void);
-
-extern size_t machine_get_irq_count(void);
-
-extern const char *machine_get_platform_name(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/as.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Address space manipulating functions declarations.
- */
-
-#ifndef KERN_arm32_AS_H_
-#define KERN_arm32_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/asid.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief ASIDs related declarations.
- *
- *  ARM CPUs doesn't support ASIDs.
- */
-
-#ifndef KERN_arm32_ASID_H_
-#define KERN_arm32_ASID_H_
-
-#include <stdint.h>
-
-#define ASID_MAX_ARCH		3	/* minimal required number */
-
-typedef uint8_t asid_t;
-
-/*
- * This works due to fact that this file is never included alone but only
- * through "generic/include/mm/asid.h" where ASID_START is defined.
- */
-#define asid_get()		(ASID_START + 1)
-
-#define asid_put(asid)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/frame.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Frame related declarations.
- */
-
-#ifndef KERN_arm32_FRAME_H_
-#define KERN_arm32_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4KB frames */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-#define BOOT_PAGE_TABLE_SIZE     0x4000
-
-#ifdef MACHINE_gta02
-
-#define PHYSMEM_START_ADDR       0x30008000
-#define BOOT_PAGE_TABLE_ADDRESS  0x30010000
-
-#elif defined MACHINE_beagleboardxm
-
-#define PHYSMEM_START_ADDR       0x80000000
-#define BOOT_PAGE_TABLE_ADDRESS  0x80008000
-
-#elif defined MACHINE_beaglebone
-
-#define PHYSMEM_START_ADDR       0x80000000
-#define BOOT_PAGE_TABLE_ADDRESS  0x80008000
-
-#elif defined MACHINE_raspberrypi
-
-#define PHYSMEM_START_ADDR       0x00000000
-#define BOOT_PAGE_TABLE_ADDRESS  0x00010000
-
-#else
-
-#define PHYSMEM_START_ADDR       0x00000000
-#define BOOT_PAGE_TABLE_ADDRESS  0x00008000
-
-#endif
-
-#define BOOT_PAGE_TABLE_START_FRAME     (BOOT_PAGE_TABLE_ADDRESS >> FRAME_WIDTH)
-#define BOOT_PAGE_TABLE_SIZE_IN_FRAMES  (BOOT_PAGE_TABLE_SIZE >> FRAME_WIDTH)
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void boot_page_table_free(void);
-#define physmem_print()
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/km.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_arm32_KM_H_
-#define KERN_arm32_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define KM_ARM32_IDENTITY_START		UINT32_C(0x80000000)
-#define KM_ARM32_IDENTITY_SIZE		UINT32_C(0x40000000)
-
-#define KM_ARM32_NON_IDENTITY_START	UINT32_C(0xc0000000)
-/*
- * The last virtual megabyte contains the high exception vectors (0xFFFF0000).
- * Do not include this range into kernel non-identity.
- */
-#define KM_ARM32_NON_IDENTITY_SIZE	UINT32_C(0x3ff00000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/page.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Paging related declarations.
- */
-
-#ifndef KERN_arm32_PAGE_H_
-#define KERN_arm32_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <mm/mm.h>
-#include <arch/exception.h>
-#include <barrier.h>
-#include <arch/barrier.h>
-#include <arch/cp15.h>
-#include <trace.h>
-
-#define PAGE_WIDTH	FRAME_WIDTH
-#define PAGE_SIZE	FRAME_SIZE
-
-#if (defined MACHINE_beagleboardxm) || (defined MACHINE_beaglebone)
-#ifndef __ASSEMBLER__
-#	define KA2PA(x)	((uintptr_t) (x))
-#	define PA2KA(x)	((uintptr_t) (x))
-#else
-#	define KA2PA(x)	(x)
-#	define PA2KA(x)	(x)
-#endif
-#else
-#ifndef __ASSEMBLER__
-#	define KA2PA(x)	(((uintptr_t) (x)) - 0x80000000)
-#	define PA2KA(x)	(((uintptr_t) (x)) + 0x80000000)
-#else
-#	define KA2PA(x)	((x) - 0x80000000)
-#	define PA2KA(x)	((x) + 0x80000000)
-#endif
-#endif
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH       (1 << 12)       /* 4096 */
-#define PTL1_ENTRIES_ARCH       0
-#define PTL2_ENTRIES_ARCH       0
-/* coarse page tables used (256 * 4 = 1KB per page) */
-#define PTL3_ENTRIES_ARCH       (1 << 8)        /* 256 */
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  4
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices into page tables for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 20) & 0xfff)
-#define PTL1_INDEX_ARCH(vaddr)  0
-#define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x0ff)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-        ((pte_t *) ((((pte_t *)(ptl0))[(i)].l0).coarse_table_addr << 10))
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-        (ptl1)
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-        (ptl2)
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-        ((uintptr_t) ((((pte_t *)(ptl3))[(i)].l1).frame_base_addr << 12))
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0) \
-	set_ptl0_addr((pte_t *) (ptl0))
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	set_ptl1_addr((pte_t*) (ptl0), i, a)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	set_ptl3_addr((pte_t*) (ptl3), i, a)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-        get_pt_level0_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-        PAGE_PRESENT
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-        PAGE_PRESENT
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-        get_pt_level1_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-        set_pt_level0_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_level1_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_level0_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT_ARCH(ptl2, i)
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_level1_present((pte_t *) (ptl3), (size_t) (i))
-
-#define pt_coherence(page) pt_coherence_m(page, 1)
-
-#if defined(PROCESSOR_ARCH_armv6) | defined(PROCESSOR_ARCH_armv7_a)
-#include "page_armv6.h"
-#elif defined(PROCESSOR_ARCH_armv4) | defined(PROCESSOR_ARCH_armv5)
-#include "page_armv4.h"
-#else
-#error "Unsupported architecture"
-#endif
-
-/** Sets the address of level 0 page table.
- *
- * @param pt Pointer to the page table to set.
- *
- * Page tables are always in cacheable memory.
- * Make sure the memory type is correct, and in sync with:
- * init_boot_pt (boot/arch/arm32/src/mm.c)
- * init_ptl0_section (boot/arch/arm32/src/mm.c)
- * set_pt_level1_flags (kernel/arch/arm32/include/arch/mm/page_armv6.h)
- */
-_NO_TRACE static inline void set_ptl0_addr(pte_t *pt)
-{
-	uint32_t val = (uint32_t)pt & TTBR_ADDR_MASK;
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	// FIXME: TTBR_RGN_WBWA_CACHE is unpredictable on ARMv6
-	val |= TTBR_RGN_WBWA_CACHE | TTBR_C_FLAG;
-#endif
-	TTBR0_write(val);
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	BPIALL_write(0);
-#endif
-}
-
-_NO_TRACE static inline void set_ptl1_addr(pte_t *pt, size_t i, uintptr_t address)
-{
-	pt[i].l0.coarse_table_addr = address >> 10;
-	pt_coherence(&pt[i].l0);
-}
-
-_NO_TRACE static inline void set_ptl3_addr(pte_t *pt, size_t i, uintptr_t address)
-{
-	pt[i].l1.frame_base_addr = address >> 12;
-	pt_coherence(&pt[i].l1);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/page_armv4.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/page_armv4.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Paging related declarations.
- */
-
-#ifndef KERN_arm32_PAGE_armv4_H_
-#define KERN_arm32_PAGE_armv4_H_
-
-#include <arch/cache.h>
-
-#ifndef KERN_arm32_PAGE_H_
-#error "Do not include arch specific page.h directly use generic page.h instead"
-#endif
-
-/* Macros for querying the last-level PTE entries. */
-#define PTE_VALID_ARCH(pte) \
-	(((pte_t *) (pte))->l0.should_be_zero != 0 || PTE_PRESENT_ARCH(pte))
-#define PTE_PRESENT_ARCH(pte) \
-	(((pte_t *) (pte))->l0.descriptor_type != 0)
-#define PTE_GET_FRAME_ARCH(pte) \
-	(((uintptr_t) ((pte_t *) (pte))->l1.frame_base_addr) << FRAME_WIDTH)
-#define PTE_WRITABLE_ARCH(pte) \
-	(((pte_t *) (pte))->l1.access_permission_0 == PTE_AP_USER_RW_KERNEL_RW)
-#define PTE_EXECUTABLE_ARCH(pte) \
-	1
-
-#ifndef __ASSEMBLER__
-
-/** Level 0 page table entry. */
-typedef struct {
-	/* 0b01 for coarse tables, see below for details */
-	unsigned descriptor_type : 2;
-	unsigned impl_specific : 3;
-	unsigned domain : 4;
-	unsigned should_be_zero : 1;
-
-	/*
-	 * Pointer to the coarse 2nd level page table (holding entries for small
-	 * (4KB) or large (64KB) pages. ARM also supports fine 2nd level page
-	 * tables that may hold even tiny pages (1KB) but they are bigger (4KB
-	 * per table in comparison with 1KB per the coarse table)
-	 */
-	unsigned coarse_table_addr : 22;
-} ATTRIBUTE_PACKED pte_level0_t;
-
-/** Level 1 page table entry (small (4KB) pages used). */
-typedef struct {
-
-	/* 0b10 for small pages */
-	unsigned descriptor_type : 2;
-	unsigned bufferable : 1;
-	unsigned cacheable : 1;
-
-	/*
-	 * access permissions for each of 4 subparts of a page
-	 * (for each 1KB when small pages used
-	 */
-	unsigned access_permission_0 : 2;
-	unsigned access_permission_1 : 2;
-	unsigned access_permission_2 : 2;
-	unsigned access_permission_3 : 2;
-	unsigned frame_base_addr : 20;
-} ATTRIBUTE_PACKED pte_level1_t;
-
-typedef union {
-	pte_level0_t l0;
-	pte_level1_t l1;
-} pte_t;
-
-/* Level 1 page tables access permissions */
-
-/** User mode: no access, privileged mode: no access. */
-#define PTE_AP_USER_NO_KERNEL_NO	0
-
-/** User mode: no access, privileged mode: read/write. */
-#define PTE_AP_USER_NO_KERNEL_RW	1
-
-/** User mode: read only, privileged mode: read/write. */
-#define PTE_AP_USER_RO_KERNEL_RW	2
-
-/** User mode: read/write, privileged mode: read/write. */
-#define PTE_AP_USER_RW_KERNEL_RW	3
-
-/* pte_level0_t and pte_level1_t descriptor_type flags */
-
-/** pte_level0_t and pte_level1_t "not present" flag (used in descriptor_type). */
-#define PTE_DESCRIPTOR_NOT_PRESENT	0
-
-/** pte_level0_t coarse page table flag (used in descriptor_type). */
-#define PTE_DESCRIPTOR_COARSE_TABLE	1
-
-/** pte_level1_t small page table flag (used in descriptor type). */
-#define PTE_DESCRIPTOR_SMALL_PAGE	2
-
-#define pt_coherence_m(pt, count) \
-do { \
-	for (unsigned i = 0; i < count; ++i) \
-		dcache_clean_mva_pou((uintptr_t)(pt + i)); \
-	read_barrier(); \
-} while (0)
-
-/** Returns level 0 page table entry flags.
- *
- * @param pt Level 0 page table.
- * @param i  Index of the entry to return.
- *
- */
-_NO_TRACE static inline int get_pt_level0_flags(pte_t *pt, size_t i)
-{
-	pte_level0_t *p = &pt[i].l0;
-	int np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
-
-	return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) | (1 << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) | (1 << PAGE_CACHEABLE_SHIFT);
-}
-
-/** Returns level 1 page table entry flags.
- *
- * @param pt Level 1 page table.
- * @param i  Index of the entry to return.
- *
- */
-_NO_TRACE static inline int get_pt_level1_flags(pte_t *pt, size_t i)
-{
-	pte_level1_t *p = &pt[i].l1;
-
-	int dt = p->descriptor_type;
-	int ap = p->access_permission_0;
-
-	return ((dt == PTE_DESCRIPTOR_NOT_PRESENT) << PAGE_PRESENT_SHIFT) |
-	    ((ap == PTE_AP_USER_RO_KERNEL_RW) << PAGE_READ_SHIFT) |
-	    ((ap == PTE_AP_USER_RW_KERNEL_RW) << PAGE_READ_SHIFT) |
-	    ((ap == PTE_AP_USER_RW_KERNEL_RW) << PAGE_WRITE_SHIFT) |
-	    ((ap != PTE_AP_USER_NO_KERNEL_RW) << PAGE_USER_SHIFT) |
-	    ((ap == PTE_AP_USER_NO_KERNEL_RW) << PAGE_READ_SHIFT) |
-	    ((ap == PTE_AP_USER_NO_KERNEL_RW) << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) |
-	    (p->bufferable << PAGE_CACHEABLE);
-}
-
-/** Sets flags of level 0 page table entry.
- *
- * @param pt    level 0 page table
- * @param i     index of the entry to be changed
- * @param flags new flags
- *
- */
-_NO_TRACE static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_level0_t *p = &pt[i].l0;
-
-	if (flags & PAGE_NOT_PRESENT) {
-		p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
-		/*
-		 * Ensures that the entry will be recognized as valid when
-		 * PTE_VALID_ARCH applied.
-		 */
-		p->should_be_zero = 1;
-	} else {
-		p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
-		p->should_be_zero = 0;
-	}
-}
-
-/** Sets flags of level 1 page table entry.
- *
- * We use same access rights for the whole page. When page
- * is not preset we store 1 in acess_rigts_3 so that at least
- * one bit is 1 (to mark correct page entry, see #PAGE_VALID_ARCH).
- *
- * @param pt    Level 1 page table.
- * @param i     Index of the entry to be changed.
- * @param flags New flags.
- *
- */
-_NO_TRACE static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_level1_t *p = &pt[i].l1;
-
-	if (flags & PAGE_NOT_PRESENT)
-		p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
-	else
-		p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
-
-	p->cacheable = p->bufferable = (flags & PAGE_CACHEABLE) != 0;
-
-	/* default access permission */
-	p->access_permission_0 = p->access_permission_1 =
-	    p->access_permission_2 = p->access_permission_3 =
-	    PTE_AP_USER_NO_KERNEL_RW;
-
-	if (flags & PAGE_USER)  {
-		if (flags & PAGE_READ) {
-			p->access_permission_0 = p->access_permission_1 =
-			    p->access_permission_2 = p->access_permission_3 =
-			    PTE_AP_USER_RO_KERNEL_RW;
-		}
-		if (flags & PAGE_WRITE) {
-			p->access_permission_0 = p->access_permission_1 =
-			    p->access_permission_2 = p->access_permission_3 =
-			    PTE_AP_USER_RW_KERNEL_RW;
-		}
-	}
-}
-
-_NO_TRACE static inline void set_pt_level0_present(pte_t *pt, size_t i)
-{
-	pte_level0_t *p = &pt[i].l0;
-
-	p->should_be_zero = 0;
-	write_barrier();
-	p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
-}
-
-_NO_TRACE static inline void set_pt_level1_present(pte_t *pt, size_t i)
-{
-	pte_level1_t *p = &pt[i].l1;
-
-	p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
-}
-
-extern void page_arch_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/page_armv6.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/page_armv6.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,324 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Paging related declarations.
- */
-
-#ifndef KERN_arm32_PAGE_armv7_H_
-#define KERN_arm32_PAGE_armv7_H_
-
-#ifndef KERN_arm32_PAGE_H_
-#error "Do not include arch specific page.h directly use generic page.h instead"
-#endif
-
-/* Macros for querying the last-level PTE entries. */
-#define PTE_VALID_ARCH(pte) \
-	(((pte_t *) (pte))->l0.should_be_zero_0 != 0 || PTE_PRESENT_ARCH(pte))
-#define PTE_PRESENT_ARCH(pte) \
-	(((pte_t *) (pte))->l0.descriptor_type != 0)
-#define PTE_GET_FRAME_ARCH(pte) \
-	(((uintptr_t) ((pte_t *) (pte))->l1.frame_base_addr) << FRAME_WIDTH)
-#define PTE_WRITABLE_ARCH(pte) \
-	(((pte_t *) (pte))->l1.access_permission_1 != PTE_AP1_RO)
-#define PTE_EXECUTABLE_ARCH(pte) \
-	(((pte_t *) (pte))->l1.descriptor_type != PTE_DESCRIPTOR_SMALL_PAGE_NX)
-
-#ifndef __ASSEMBLER__
-
-/** Level 0 page table entry. */
-typedef struct {
-	/* 0b01 for coarse tables, see below for details */
-	unsigned descriptor_type : 2;
-	unsigned pxn : 1;
-	unsigned ns : 1;
-	unsigned should_be_zero_0 : 1;
-	unsigned domain : 4;
-	unsigned should_be_zero_1 : 1;
-
-	/*
-	 * Pointer to the coarse 2nd level page table (holding entries for small
-	 * (4KB) or large (64KB) pages. ARM also supports fine 2nd level page
-	 * tables that may hold even tiny pages (1KB) but they are bigger (4KB
-	 * per table in comparison with 1KB per the coarse table)
-	 */
-	unsigned coarse_table_addr : 22;
-} ATTRIBUTE_PACKED pte_level0_t;
-
-/** Level 1 page table entry (small (4KB) pages used). */
-typedef struct {
-
-	/* 0b10 for small pages, 0b11 for NX small pages */
-	unsigned descriptor_type : 2;
-	unsigned bufferable : 1;
-	unsigned cacheable : 1;
-	unsigned access_permission_0 : 2;
-	unsigned tex : 3;
-	unsigned access_permission_1 : 1;
-	unsigned shareable : 1;
-	unsigned non_global : 1;
-	unsigned frame_base_addr : 20;
-} ATTRIBUTE_PACKED pte_level1_t;
-
-typedef union {
-	pte_level0_t l0;
-	pte_level1_t l1;
-} pte_t;
-
-/* Level 1 page tables access permissions */
-
-/** User mode: no access, privileged mode: no access. */
-#define PTE_AP0_USER_NO_KERNEL_NO   0
-
-/** User mode: no access, privileged mode: read/write. */
-#define PTE_AP0_USER_NO_KERNEL_FULL   1
-
-/** User mode: read only, privileged mode: read/write. */
-#define PTE_AP0_USER_LIMITED_KERNEL_FULL   2
-
-/** User mode: read/write, privileged mode: read/write. */
-#define PTE_AP0_USER_FULL_KERNEL_FULL    3
-
-/** Allow writes */
-#define PTE_AP1_RO   1
-
-/* pte_level0_t and pte_level1_t descriptor_type flags */
-
-/** pte_level0_t and pte_level1_t "not present" flag (used in descriptor_type). */
-#define PTE_DESCRIPTOR_NOT_PRESENT	0
-
-/** pte_level0_t coarse page table flag (used in descriptor_type). */
-#define PTE_DESCRIPTOR_COARSE_TABLE	1
-
-/** pte_level1_t small page table flag (used in descriptor type). */
-#define PTE_DESCRIPTOR_SMALL_PAGE	2
-
-/** pte_level1_t small page table flag with NX (used in descriptor type). */
-#define PTE_DESCRIPTOR_SMALL_PAGE_NX	3
-
-/**
- * For an ARMv7 implementation that does not include the Large Physical Address Extension,
- * and in implementations of architecture versions before ARMv7, if the translation tables
- * are held in Write-Back Cacheable memory, the caches must be cleaned to the point of
- * unification after writing to the translation tables and before the DSB instruction. This
- * ensures that the updated translation table are visible to a hardware translation table walk.
- *
- * Therefore, an example instruction sequence for writing a translation table entry,
- * covering changes to the instruction
- * or data mappings in a uniprocessor system is:
- * STR rx, [Translation table entry]
- * ; write new entry to the translation table
- * Clean cache line [Translation table entry] : This operation is not required with the
- * ; Multiprocessing Extensions.
- * DSB
- * ; ensures visibility of the data cleaned from the D Cache
- * Invalidate TLB entry by MVA (and ASID if non-global) [page address]
- * Invalidate BTC
- * DSB
- * ; ensure completion of the Invalidate TLB operation
- * ISB
- * ; ensure table changes visible to instruction fetch
- *
- * ARM Architecture reference chp. B3.10.1 p. B3-1375
- * @note: see TTRB0/1 for pt memory type
- */
-#define pt_coherence_m(pt, count) \
-do { \
-	for (unsigned i = 0; i < count; ++i) \
-		dcache_clean_mva_pou((uintptr_t)(pt + i)); \
-	read_barrier(); \
-} while (0)
-
-/** Returns level 0 page table entry flags.
- *
- * @param pt Level 0 page table.
- * @param i  Index of the entry to return.
- *
- */
-_NO_TRACE static inline int get_pt_level0_flags(pte_t *pt, size_t i)
-{
-	const pte_level0_t *p = &pt[i].l0;
-	const unsigned np = (p->descriptor_type == PTE_DESCRIPTOR_NOT_PRESENT);
-
-	return (np << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) | (1 << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) | (1 << PAGE_CACHEABLE_SHIFT);
-}
-
-/** Returns level 1 page table entry flags.
- *
- * @param pt Level 1 page table.
- * @param i  Index of the entry to return.
- *
- */
-_NO_TRACE static inline int get_pt_level1_flags(pte_t *pt, size_t i)
-{
-	const pte_level1_t *p = &pt[i].l1;
-
-	const unsigned dt = p->descriptor_type;
-	const unsigned ap0 = p->access_permission_0;
-	const unsigned ap1 = p->access_permission_1;
-
-	return ((dt == PTE_DESCRIPTOR_NOT_PRESENT) << PAGE_PRESENT_SHIFT) |
-	    ((dt != PTE_DESCRIPTOR_SMALL_PAGE_NX) << PAGE_EXEC_SHIFT) |
-	    ((ap0 == PTE_AP0_USER_LIMITED_KERNEL_FULL) << PAGE_READ_SHIFT) |
-	    ((ap0 == PTE_AP0_USER_FULL_KERNEL_FULL) << PAGE_READ_SHIFT) |
-	    ((ap0 == PTE_AP0_USER_NO_KERNEL_FULL) << PAGE_READ_SHIFT) |
-	    ((ap0 != PTE_AP0_USER_NO_KERNEL_FULL) << PAGE_USER_SHIFT) |
-	    (((ap1 != PTE_AP1_RO) && (ap0 == PTE_AP0_USER_FULL_KERNEL_FULL)) << PAGE_WRITE_SHIFT) |
-	    (((ap1 != PTE_AP1_RO) && (ap0 == PTE_AP0_USER_NO_KERNEL_FULL)) << PAGE_WRITE_SHIFT) |
-	    (p->bufferable << PAGE_CACHEABLE);
-}
-
-/** Sets flags of level 0 page table entry.
- *
- * @param pt    level 0 page table
- * @param i     index of the entry to be changed
- * @param flags new flags
- *
- */
-_NO_TRACE static inline void set_pt_level0_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_level0_t *p = &pt[i].l0;
-
-	if (flags & PAGE_NOT_PRESENT) {
-		p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
-		/*
-		 * Ensures that the entry will be recognized as valid when
-		 * PTE_VALID_ARCH applied.
-		 */
-		p->should_be_zero_0 = 1;
-		p->should_be_zero_1 = 1;
-	} else {
-		p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
-		p->should_be_zero_0 = 0;
-		p->should_be_zero_1 = 0;
-		p->domain = 0;
-		p->ns = 0;
-	}
-	pt_coherence(p);
-}
-
-/** Sets flags of level 1 page table entry.
- *
- * We use same access rights for the whole page. When page
- * is not preset we store 1 in acess_rigts_3 so that at least
- * one bit is 1 (to mark correct page entry, see #PAGE_VALID_ARCH).
- *
- * @param pt    Level 1 page table.
- * @param i     Index of the entry to be changed.
- * @param flags New flags.
- *
- */
-_NO_TRACE static inline void set_pt_level1_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_level1_t *p = &pt[i].l1;
-
-	if (flags & PAGE_NOT_PRESENT) {
-		p->descriptor_type = PTE_DESCRIPTOR_NOT_PRESENT;
-	} else {
-		if (flags & PAGE_EXEC)
-			p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
-		else
-			p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE_NX;
-	}
-
-	if (flags & PAGE_CACHEABLE) {
-		/*
-		 * Outer and inner write-back, write-allocate memory,
-		 * see ch. B3.8.2 (p. B3-1358) of ARM Architecture reference
-		 * manual.
-		 *
-		 * Make sure the memory type is correct, and in sync with:
-		 * init_boot_pt (boot/arch/arm32/src/mm.c)
-		 * init_ptl0_section (boot/arch/arm32/src/mm.c)
-		 * set_ptl0_addr (kernel/arch/arm32/include/arch/mm/page.h)
-		 */
-		p->tex = 5;
-		p->cacheable = 0;
-		p->bufferable = 1;
-	} else {
-		/*
-		 * Shareable device memory, see ch. B3.8.2 (p. B3-1358) of
-		 * ARM Architecture reference manual.
-		 */
-		p->tex = 0;
-		p->cacheable = 0;
-		p->bufferable = 1;
-	}
-
-	/*
-	 * Shareable is ignored for devices (non-cacheable),
-	 * turn it off for normal memory.
-	 */
-	p->shareable = 0;
-
-	p->non_global = !(flags & PAGE_GLOBAL);
-
-	/* default access permission: kernel only */
-	p->access_permission_0 = PTE_AP0_USER_NO_KERNEL_FULL;
-
-	if (flags & PAGE_USER) {
-		p->access_permission_0 = PTE_AP0_USER_FULL_KERNEL_FULL;
-		// TODO Fix kernel to use PAGE_WRITE flag properly and
-		// apply this for kernel pages as well.
-		if (!(flags & PAGE_WRITE))
-			p->access_permission_1 = PTE_AP1_RO;
-	}
-	pt_coherence(p);
-}
-
-_NO_TRACE static inline void set_pt_level0_present(pte_t *pt, size_t i)
-{
-	pte_level0_t *p = &pt[i].l0;
-
-	p->should_be_zero_0 = 0;
-	p->should_be_zero_1 = 0;
-	p->descriptor_type = PTE_DESCRIPTOR_COARSE_TABLE;
-	pt_coherence(p);
-}
-
-_NO_TRACE static inline void set_pt_level1_present(pte_t *pt, size_t i)
-{
-	pte_level1_t *p = &pt[i].l1;
-
-	p->descriptor_type = PTE_DESCRIPTOR_SMALL_PAGE;
-	pt_coherence(p);
-}
-
-extern void page_arch_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/page_fault.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/page_fault.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Page fault related declarations.
- */
-
-#ifndef KERN_arm32_PAGE_FAULT_H_
-#define KERN_arm32_PAGE_FAULT_H_
-
-#include <stdint.h>
-
-/** Decribes CP15 "fault status register" (FSR).
- *
- * "VMSAv6 added a fifth fault status bit (bit[10]) to both the IFSR and DFSR.
- * It is IMPLEMENTATION DEFINED how this bit is encoded in earlier versions of
- * the architecture. A write flag (bit[11] of the DFSR) has also been
- * introduced."
- * ARM Architecture Reference Manual version i ch. B4.6 (PDF p. 719)
- *
- * See ARM Architecture Reference Manual ch. B4.9.6 (pdf p.743). for FSR info
- */
-typedef union {
-	struct {
-		unsigned status : 4;
-		unsigned domain : 4;
-		unsigned zero : 1;
-		unsigned lpae : 1; /**< Needs LPAE support implemented */
-		unsigned fs : 1; /**< armv6+ mandated, earlier IPLM. DEFINED */
-		unsigned wr : 1; /**< armv6+ only */
-		unsigned ext : 1; /**< external abort */
-		unsigned cm : 1; /**< Cache maintenance, needs LPAE support */
-		unsigned should_be_zero : 18;
-	} data;
-	struct {
-		unsigned status : 4;
-		unsigned sbz0 : 6;
-		unsigned fs : 1;
-		unsigned should_be_zero : 21;
-	} inst;
-	uint32_t raw;
-} fault_status_t;
-
-/** Simplified description of instruction code.
- *
- * @note Used for recognizing memory access instructions.
- * @see ARM architecture reference (chapter 3.1)
- */
-typedef struct {
-	unsigned dummy1 : 4;
-	unsigned bit4 : 1;
-	unsigned bits567 : 3;
-	unsigned dummy : 12;
-	unsigned access : 1;
-	unsigned opcode : 4;
-	unsigned type : 3;
-	unsigned condition : 4;
-} ATTRIBUTE_PACKED instruction_t;
-
-/** Help union used for casting pc register (uint_32_t) value into
- *  #instruction_t pointer.
- */
-typedef union {
-	instruction_t *instr;
-	uint32_t pc;
-} instruction_union_t;
-
-extern void prefetch_abort(unsigned int, istate_t *);
-extern void data_abort(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/arm32/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief TLB related declarations.
- */
-
-#ifndef KERN_arm32_TLB_H_
-#define KERN_arm32_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/proc/task.h
===================================================================
--- kernel/arch/arm32/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_proc
- * @{
- */
-/** @file
- *  @brief Task related declarations.
- */
-
-#ifndef KERN_arm32_TASK_H_
-#define KERN_arm32_TASK_H_
-
-typedef struct {
-} task_arch_t;
-
-#define task_create_arch(t)
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/proc/thread.h
===================================================================
--- kernel/arch/arm32/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_proc
- * @{
- */
-/** @file
- *  @brief Thread related declarations.
- */
-
-#ifndef KERN_arm32_THREAD_H_
-#define KERN_arm32_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-#define thread_create_arch(t, flags) (EOK)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/ras.h
===================================================================
--- kernel/arch/arm32/include/arch/ras.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Declarations related to Restartable Atomic Sequences.
- */
-
-#ifndef KERN_arm32_RAS_H_
-#define KERN_arm32_RAS_H_
-
-#include <arch/exception.h>
-#include <typedefs.h>
-
-#define RAS_START  0
-#define RAS_END    1
-
-extern uintptr_t *ras_page;
-
-extern void ras_init(void);
-extern void ras_check(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/regutils.h
===================================================================
--- kernel/arch/arm32/include/arch/regutils.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2007 Petr Stepan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/**
- * @file
- * @brief Utilities for convenient manipulation with ARM registers.
- */
-
-#ifndef KERN_arm32_REGUTILS_H_
-#define KERN_arm32_REGUTILS_H_
-
-#define STATUS_REG_IRQ_DISABLED_BIT  (1 << 7)
-#define STATUS_REG_MODE_MASK         0x1f
-
-/* ARM Processor Operation Modes */
-enum {
-	USER_MODE = 0x10,
-	FIQ_MODE = 0x11,
-	IRQ_MODE = 0x12,
-	SUPERVISOR_MODE = 0x13,
-	MONITOR_MODE = 0x16,
-	ABORT_MODE = 0x17,
-	HYPERVISOR_MODE = 0x1a,
-	UNDEFINED_MODE = 0x1b,
-	SYSTEM_MODE = 0x1f,
-	MODE_MASK = 0x1f,
-};
-/* [CS]PRS manipulation macros */
-#define GEN_STATUS_READ(nm, reg) \
-	static inline uint32_t nm## _status_reg_read(void) \
-	{ \
-		uint32_t retval; \
-		\
-		asm volatile ( \
-			"mrs %[retval], " #reg \
-			: [retval] "=r" (retval) \
-		); \
-		\
-		return retval; \
-	}
-
-#define GEN_STATUS_WRITE(nm, reg, fieldname, field) \
-	static inline void nm## _status_reg_ ##fieldname## _write(uint32_t value) \
-	{ \
-		asm volatile ( \
-			"msr " #reg "_" #field ", %[value]" \
-			:: [value] "r" (value) \
-		); \
-	}
-
-/** Return the value of CPSR (Current Program Status Register). */
-GEN_STATUS_READ(current, cpsr);
-
-/** Set control bits of CPSR. */
-GEN_STATUS_WRITE(current, cpsr, control, c);
-
-/** Return the value of SPSR (Saved Program Status Register). */
-GEN_STATUS_READ(saved, spsr);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/security_ext.h
===================================================================
--- kernel/arch/arm32/include/arch/security_ext.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Security Extensions Routines
- */
-
-#ifndef KERN_arm32_SECURITY_EXT_H_
-#define KERN_arm32_SECURITY_EXT_H_
-
-#include <arch/cp15.h>
-#include <arch/regutils.h>
-
-/** Test whether the current cpu supports security extensions.
- * return true if security extensions are supported, false otherwise.
- * @note The Processor Feature Register 1 that provides this information
- * is available only on armv7+. This function returns false on all\
- * older archs.
- */
-static inline bool sec_ext_is_implemented(void)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	const uint32_t idpfr = ID_PFR1_read() & ID_PFR1_SEC_EXT_MASK;
-	return idpfr == ID_PFR1_SEC_EXT || idpfr == ID_PFR1_SEC_EXT_RFR;
-#endif
-	return false;
-}
-
-/** Test whether we are running in monitor mode.
- * return true, if the current mode is Monitor mode, false otherwise.
- * @note this is safe to call even on machines that do not implement monitor
- * mode.
- */
-static inline bool sec_ext_is_monitor_mode(void)
-{
-	return (current_status_reg_read() & MODE_MASK) == MONITOR_MODE;
-}
-
-/** Test whether we are running in a secure state.
- * return true if the current state is secure, false otherwise.
- *
- * @note: This functions will cause undef isntruction trap if we
- * are not running in the secure state.
- *
- * @note: u-boot enables non-secure access to cp 10/11, as well as some other
- * features and switches to non-secure state during boot.
- * Look for 'secureworld_exit' in arch/arm/cpu/armv7/omap3/board.c.
- */
-static inline bool sec_ext_is_secure(void)
-{
-	return sec_ext_is_implemented() &&
-	    (sec_ext_is_monitor_mode() || !(SCR_read() & SCR_NS_FLAG));
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/stack.h
===================================================================
--- kernel/arch/arm32/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Stack constants.
- */
-
-#ifndef KERN_arm32_STACK_H_
-#define KERN_arm32_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#define STACK_ITEM_SIZE		4
-
-/** See <a href="http://www.arm.com/support/faqdev/14269.html">ABI</a> for
- * details
- */
-#define STACK_ALIGNMENT		8
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/include/arch/types.h
===================================================================
--- kernel/arch/arm32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Type definitions.
- */
-
-#ifndef KERN_arm32_TYPES_H_
-#define KERN_arm32_TYPES_H_
-
-#ifndef DOXYGEN
-#define ATTRIBUTE_PACKED __attribute__((packed))
-#else
-#define ATTRIBUTE_PACKED
-#endif
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm32/meson.build
===================================================================
--- kernel/arch/arm32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#
-# Copyright (c) 2007 Jakub Jermar, Michal Kebrt
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/start.S',
-	'src/asm.S',
-	'src/eabi.S',
-	'src/exc_handler.S',
-	'src/arm32.c',
-	'src/machine_func.c',
-	'src/context.S',
-	'src/dummy.S',
-	'src/cpu/cpu.c',
-	'src/interrupt.c',
-	'src/exception.c',
-	'src/userspace.c',
-	'src/smc.c',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/mm/page_fault.c',
-	'src/atomic.c',
-	'src/ras.c',
-)
-
-if CONFIG_FPU
-	arch_src += files('src/fpu_context.c', 'src/fpu.S')
-endif
-
-if MACHINE == 'gta02'
-	arch_src += files('src/mach/gta02/gta02.c')
-
-elif MACHINE == 'integratorcp'
-	arch_src += files('src/mach/integratorcp/integratorcp.c')
-
-elif MACHINE == 'beagleboardxm'
-	arch_src += files('src/mach/beagleboardxm/beagleboardxm.c')
-
-elif MACHINE == 'beaglebone'
-	arch_src += files('src/mach/beaglebone/beaglebone.c')
-
-elif MACHINE == 'raspberrypi'
-	arch_src += files('src/mach/raspberrypi/raspberrypi.c')
-
-endif
Index: rnel/arch/arm32/src/arm32.c
===================================================================
--- kernel/arch/arm32/src/arm32.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief ARM32 architecture specific functions.
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <config.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <console/console.h>
-#include <ddi/irq.h>
-#include <config.h>
-#include <interrupt.h>
-#include <arch/regutils.h>
-#include <arch/machine_func.h>
-#include <userspace.h>
-#include <macros.h>
-#include <str.h>
-#include <arch/ras.h>
-#include <sysinfo/sysinfo.h>
-
-static void arm32_pre_mm_init(void);
-static void arm32_post_mm_init(void);
-static void arm32_post_smp_init(void);
-
-arch_ops_t arm32_ops = {
-	.pre_mm_init = arm32_pre_mm_init,
-	.post_mm_init = arm32_post_mm_init,
-	.post_smp_init = arm32_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &arm32_ops;
-
-/** Performs arm32-specific initialization before main_bsp() is called. */
-void arm32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
-{
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
-
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Initialize machine_ops pointer. */
-	machine_ops_init();
-}
-
-/** Performs arm32 specific initialization before mm is initialized. */
-void arm32_pre_mm_init(void)
-{
-	/* It is not assumed by default */
-	interrupts_disable();
-}
-
-/** Performs arm32 specific initialization afterr mm is initialized. */
-void arm32_post_mm_init(void)
-{
-	machine_init();
-
-	/* Initialize exception dispatch table */
-	exception_init();
-	interrupt_init();
-
-	/* Initialize Restartable Atomic Sequences support. */
-	ras_init();
-
-	machine_output_init();
-}
-
-/** Performs arm32 specific tasks needed after the multiprocessing is
- * initialized.
- *
- * Currently the function is empty because SMP is not supported.
- */
-void arm32_post_smp_init(void)
-{
-	machine_input_init();
-	const char *platform = machine_get_platform_name();
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-}
-
-/** Performs arm32 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Performs arm32 specific tasks needed before the new thread is scheduled.
- *
- * It sets supervisor_sp.
- */
-void before_thread_runs_arch(void)
-{
-	uint8_t *stck;
-
-	stck = &THREAD->kstack[STACK_SIZE];
-	supervisor_sp = (uintptr_t) stck;
-}
-
-/** Performs arm32 specific tasks before a thread stops running.
- *
- * Currently the function is empty.
- */
-void after_thread_ran_arch(void)
-{
-}
-
-/** Halts CPU. */
-void cpu_halt(void)
-{
-	while (true)
-		machine_cpu_halt();
-}
-
-/** Reboot. */
-void arch_reboot(void)
-{
-	/* not implemented */
-	while (true)
-		;
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/asm.S
===================================================================
--- kernel/arch/arm32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	add r3, r1, #3
-	bic r3, r3, #3
-	cmp r1, r3
-	stmdb sp!, {r4, r5, lr}
-	mov r5, r0 /* save dst */
-	beq 4f
-
-	1:
-		cmp r2, #0
-		movne ip, #0
-		beq 3f
-
-	2:
-		ldrb r3, [ip, r1]
-		strb r3, [ip, r0]
-		add ip, ip, #1
-		cmp ip, r2
-		bne 2b
-
-	3:
-		mov r0, r5
-		ldmia sp!, {r4, r5, pc}
-
-	4:
-		add r3, r0, #3
-		bic r3, r3, #3
-		cmp r0, r3
-		bne 1b
-		movs r4, r2, lsr #2
-		moveq lr, r4
-		beq 6f
-		mov lr, #0
-		mov ip, lr
-
-	5:
-		ldr r3, [ip, r1]
-		add lr, lr, #1
-		cmp lr, r4
-		str r3, [ip, r0]
-		add ip, ip, #4
-		bne 5b
-
-	6:
-		ands r4, r2, #3
-		beq 3b
-		mov r3, lr, lsl #2
-		add r0, r3, r0
-		add ip, r3, r1
-		mov r2, #0
-
-	7:
-		ldrb r3, [r2, ip]
-		strb r3, [r2, r0]
-		add r2, r2, #1
-		cmp r2, r4
-		bne 7b
-		b 3b
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	mov r0, #0
-	ldmia sp!, {r4, r5, pc}
-
-FUNCTION_BEGIN(early_putuchar)
-	mov pc, lr
-FUNCTION_END(early_putuchar)
Index: rnel/arch/arm32/src/atomic.c
===================================================================
--- kernel/arch/arm32/src/atomic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Atomic operations emulation.
- */
-
-#include <synch/spinlock.h>
-#include <arch/barrier.h>
-#include <arch/asm.h>
-
-unsigned __atomic_fetch_add_4(volatile void *mem0, unsigned val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	/*
-	 * This implementation is for UP pre-ARMv6 systems where we do not have
-	 * the LDREX and STREX instructions.
-	 */
-	ipl_t ipl = interrupts_disable();
-	unsigned ret = *mem;
-	*mem += val;
-	interrupts_restore(ipl);
-	return ret;
-}
-
-unsigned __atomic_fetch_sub_4(volatile void *mem0, unsigned val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	ipl_t ipl = interrupts_disable();
-	unsigned ret = *mem;
-	*mem -= val;
-	interrupts_restore(ipl);
-	return ret;
-}
-
-IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(cas_lock, "arm-cas-lock");
-
-/** Implements GCC's missing compare-and-swap intrinsic for ARM.
- *
- * Sets \a *ptr to \a new_val if it is equal to \a expected. In any case,
- * returns the previous value of \a *ptr.
- */
-unsigned __sync_val_compare_and_swap_4(volatile void *ptr0, unsigned expected,
-    unsigned new_val)
-{
-	volatile unsigned *ptr = ptr0;
-
-	/*
-	 * Using an interrupt disabling spinlock might still lead to deadlock
-	 * if CAS() is used in an exception handler. Eg. if a CAS() results
-	 * in a page fault exception and the exception handler again tries
-	 * to invoke CAS() (even for a different memory location), the spinlock
-	 * would deadlock.
-	 */
-	irq_spinlock_lock(&cas_lock, true);
-
-	unsigned cur_val = *ptr;
-
-	if (cur_val == expected) {
-		*ptr = new_val;
-	}
-
-	irq_spinlock_unlock(&cas_lock, true);
-
-	return cur_val;
-}
-
-void __sync_synchronize(void)
-{
-	dsb();
-}
-
-/* Naive implementations of the newer intrinsics. */
-
-_Bool __atomic_compare_exchange_4(volatile void *mem, void *expected0,
-    unsigned desired, _Bool weak, int success, int failure)
-{
-	unsigned *expected = expected0;
-
-	(void) weak;
-	(void) success;
-	(void) failure;
-
-	unsigned old = *expected;
-	unsigned new = __sync_val_compare_and_swap_4(mem, old, desired);
-	if (old == new) {
-		return 1;
-	} else {
-		*expected = new;
-		return 0;
-	}
-}
-
-unsigned __atomic_exchange_4(volatile void *mem0, unsigned val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	(void) model;
-
-	irq_spinlock_lock(&cas_lock, true);
-	unsigned old = *mem;
-	*mem = val;
-	irq_spinlock_unlock(&cas_lock, true);
-
-	return old;
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/context.S
===================================================================
--- kernel/arch/arm32/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#
-# Copyright (c) 2007 Petr Stepan
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(context_save_arch)
-	stmfd sp!, {r1}
-	mrs r1, cpsr
-	and r1, r1, #0x1f
-	stmia r0!, {r1}
-	ldmfd sp!, {r1}
-
-	stmia r0!, {sp, lr}
-	stmia r0!, {r4-r11}
-
-	mov r0, #1
-	mov pc, lr
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	ldmia r0!, {r4}
-	mrs r5, cpsr
-	bic r5, r5, #0x1f
-	orr r5, r5, r4
-	msr cpsr_c, r5
-
-	ldmia r0!, {sp, lr}
-	ldmia r0!, {r4-r11}
-
-	mov r0, #0
-	mov pc, lr
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/arm32/src/cpu/cpu.c
===================================================================
--- kernel/arch/arm32/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,378 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief CPU identification.
- */
-
-#include <arch/cache.h>
-#include <arch/cpu.h>
-#include <arch/cp15.h>
-#include <cpu.h>
-#include <arch.h>
-#include <stdio.h>
-
-#ifdef CONFIG_FPU
-#include <arch/fpu_context.h>
-#endif
-
-static inline unsigned log2(unsigned val)
-{
-	unsigned log = 0;
-	--val;
-	while (val) {
-		++log;
-		val >>= 1;
-	}
-	return log;
-}
-
-static unsigned dcache_ways(unsigned level);
-static unsigned dcache_sets(unsigned level);
-static unsigned dcache_linesize_log(unsigned level);
-
-/** Implementers (vendor) names */
-static const char *implementer(unsigned id)
-{
-	switch (id) {
-	case 0x41:
-		return "ARM Limited";
-	case 0x44:
-		return "Digital Equipment Corporation";
-	case 0x4d:
-		return "Motorola, Freescale Semiconductor Inc.";
-	case 0x51:
-		return "Qualcomm Inc.";
-	case 0x56:
-		return "Marvell Semiconductor Inc.";
-	case 0x69:
-		return "Intel Corporation";
-	}
-	return "Unknown implementer";
-}
-
-/** Architecture names */
-static const char *architecture_string(cpu_arch_t *arch)
-{
-	static const char *arch_data[] = {
-		"ARM",       /* 0x0 */
-		"ARMv4",       /* 0x1 */
-		"ARMv4T",      /* 0x2 */
-		"ARMv5",       /* 0x3 */
-		"ARMv5T",      /* 0x4 */
-		"ARMv5TE",     /* 0x5 */
-		"ARMv5TEJ",    /* 0x6 */
-		"ARMv6"        /* 0x7 */
-	};
-	if (arch->arch_num < (sizeof(arch_data) / sizeof(arch_data[0])))
-		return arch_data[arch->arch_num];
-	else
-		return arch_data[0];
-}
-
-/** Retrieves processor identification from CP15 register 0.
- *
- * @param cpu Structure for storing CPU identification.
- * See page B4-1630 of ARM Architecture Reference Manual.
- */
-static void arch_cpu_identify(cpu_arch_t *cpu)
-{
-	const uint32_t ident = MIDR_read();
-
-	cpu->imp_num = (ident >> MIDR_IMPLEMENTER_SHIFT) & MIDR_IMPLEMENTER_MASK;
-	cpu->variant_num = (ident >> MIDR_VARIANT_SHIFT) & MIDR_VARIANT_MASK;
-	cpu->arch_num = (ident >> MIDR_ARCHITECTURE_SHIFT) & MIDR_ARCHITECTURE_MASK;
-	cpu->prim_part_num = (ident >> MIDR_PART_NUMBER_SHIFT) & MIDR_PART_NUMBER_MASK;
-	cpu->rev_num = (ident >> MIDR_REVISION_SHIFT) & MIDR_REVISION_MASK;
-
-	// TODO CPUs with arch_num == 0xf use CPUID scheme for identification
-	cpu->dcache_levels = dcache_levels();
-
-	for (unsigned i = 0; i < cpu->dcache_levels; ++i) {
-		cpu->dcache[i].ways = dcache_ways(i);
-		cpu->dcache[i].sets = dcache_sets(i);
-		cpu->dcache[i].way_shift = 31 - log2(cpu->dcache[i].ways);
-		cpu->dcache[i].set_shift = dcache_linesize_log(i);
-		cpu->dcache[i].line_size = 1 << dcache_linesize_log(i);
-		printf("Found DCache L%u: %u-way, %u sets, %u byte lines "
-		    "(shifts: w%u, s%u)\n", i + 1, cpu->dcache[i].ways,
-		    cpu->dcache[i].sets, cpu->dcache[i].line_size,
-		    cpu->dcache[i].way_shift, cpu->dcache[i].set_shift);
-	}
-}
-
-/** Enables unaligned access and caching for armv6+ */
-void cpu_arch_init(void)
-{
-	uint32_t control_reg = SCTLR_read();
-
-	dcache_invalidate();
-	read_barrier();
-
-	/* Turn off tex remap, RAZ/WI prior to armv7 */
-	control_reg &= ~SCTLR_TEX_REMAP_EN_FLAG;
-	/* Turn off accessed flag, RAZ/WI prior to armv7 */
-	control_reg &= ~(SCTLR_ACCESS_FLAG_EN_FLAG | SCTLR_HW_ACCESS_FLAG_EN_FLAG);
-
-	/* Unaligned access is supported on armv6+ */
-#if defined(PROCESSOR_ARCH_armv7_a) | defined(PROCESSOR_ARCH_armv6)
-	/*
-	 * Enable unaligned access, RAZ/WI prior to armv6
-	 * switchable on armv6, RAO/WI writes on armv7,
-	 * see ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition
-	 * L.3.1 (p. 2456)
-	 */
-	control_reg |= SCTLR_UNALIGNED_EN_FLAG;
-	/*
-	 * Disable alignment checks, this turns unaligned access to undefined,
-	 * unless U bit is set.
-	 */
-	control_reg &= ~SCTLR_ALIGN_CHECK_EN_FLAG;
-	/*
-	 * Enable caching, On arm prior to armv7 there is only one level
-	 * of caches. Data cache is coherent.
-	 * "This means that the behavior of accesses from the same observer to
-	 * different VAs, that are translated to the same PA
-	 * with the same memory attributes, is fully coherent."
-	 *    ARM Architecture Reference Manual ARMv7-A and ARMv7-R Edition
-	 *    B3.11.1 (p. 1383)
-	 * We are safe to turn this on. For arm v6 see ch L.6.2 (p. 2469)
-	 * L2 Cache for armv7 is enabled by default (i.e. controlled by
-	 * this flag).
-	 */
-	control_reg |= SCTLR_CACHE_EN_FLAG;
-	/*
-	 * ICache coherency is elaborated on in barrier.h.
-	 * VIPT and PIPT caches need maintenance only on code modify,
-	 * so it should be safe for general use.
-	 * Enable branch predictors too as they follow the same rules
-	 * as ICache and they can be flushed together
-	 */
-	if ((CTR_read() & CTR_L1I_POLICY_MASK) != CTR_L1I_POLICY_AIVIVT) {
-		control_reg |=
-		    SCTLR_INST_CACHE_EN_FLAG | SCTLR_BRANCH_PREDICT_EN_FLAG;
-	} else {
-		control_reg &=
-		    ~(SCTLR_INST_CACHE_EN_FLAG | SCTLR_BRANCH_PREDICT_EN_FLAG);
-	}
-#endif
-	SCTLR_write(control_reg);
-
-#ifdef CONFIG_FPU
-	fpu_setup();
-#endif
-
-#ifdef PROCESSOR_ARCH_armv7_a
-	if ((ID_PFR1_read() & ID_PFR1_GEN_TIMER_EXT_MASK) !=
-	    ID_PFR1_GEN_TIMER_EXT) {
-		PMCR_write(PMCR_read() | PMCR_E_FLAG | PMCR_D_FLAG);
-		PMCNTENSET_write(PMCNTENSET_CYCLE_COUNTER_EN_FLAG);
-	}
-#endif
-}
-
-/** Retrieves processor identification and stores it to #CPU.arch */
-void cpu_identify(void)
-{
-	arch_cpu_identify(&CPU->arch);
-}
-
-/** Prints CPU identification. */
-void cpu_print_report(cpu_t *m)
-{
-	printf("cpu%d: vendor=%s, architecture=%s, part number=%x, "
-	    "variant=%x, revision=%x\n",
-	    m->id, implementer(m->arch.imp_num),
-	    architecture_string(&m->arch), m->arch.prim_part_num,
-	    m->arch.variant_num, m->arch.rev_num);
-}
-
-/** See chapter B4.1.19 of ARM Architecture Reference Manual */
-static unsigned dcache_linesize_log(unsigned level)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT);
-	const uint32_t ccsidr = CCSIDR_read();
-	return CCSIDR_LINESIZE_LOG(ccsidr);
-#endif
-	return 0;
-
-}
-
-/** See chapter B4.1.19 of ARM Architecture Reference Manual */
-static unsigned dcache_ways(unsigned level)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT);
-	const uint32_t ccsidr = CCSIDR_read();
-	return CCSIDR_WAYS(ccsidr);
-#endif
-	return 0;
-}
-
-/** See chapter B4.1.19 of ARM Architecture Reference Manual */
-static unsigned dcache_sets(unsigned level)
-{
-#ifdef PROCESSOR_ARCH_armv7_a
-	CSSELR_write((level & CCSELR_LEVEL_MASK) << CCSELR_LEVEL_SHIFT);
-	const uint32_t ccsidr = CCSIDR_read();
-	return CCSIDR_SETS(ccsidr);
-#endif
-	return 0;
-}
-
-unsigned dcache_levels(void)
-{
-	unsigned levels = 0;
-#ifdef PROCESSOR_ARCH_armv7_a
-	const uint32_t val = CLIDR_read();
-	for (unsigned i = 0; i < 8; ++i) {
-		const unsigned ctype = CLIDR_CACHE(i, val);
-		switch (ctype) {
-		case CLIDR_DCACHE_ONLY:
-		case CLIDR_SEP_CACHE:
-		case CLIDR_UNI_CACHE:
-			++levels;
-		default:
-			(void)0;
-		}
-	}
-#endif
-	return levels;
-}
-
-static void dcache_clean_manual(unsigned level, bool invalidate,
-    unsigned ways, unsigned sets, unsigned way_shift, unsigned set_shift)
-{
-
-	for (unsigned i = 0; i < ways; ++i) {
-		for (unsigned j = 0; j < sets; ++j) {
-			const uint32_t val =
-			    ((level & 0x7) << 1) |
-			    (j << set_shift) | (i << way_shift);
-			if (invalidate)
-				DCCISW_write(val);
-			else
-				DCCSW_write(val);
-		}
-	}
-}
-
-void dcache_flush(void)
-{
-	/* See ARM Architecture Reference Manual ch. B4.2.1 p. B4-1724 */
-	const unsigned levels = dcache_levels();
-	for (unsigned i = 0; i < levels; ++i) {
-		const unsigned ways = dcache_ways(i);
-		const unsigned sets = dcache_sets(i);
-		const unsigned way_shift = 32 - log2(ways);
-		const unsigned set_shift = dcache_linesize_log(i);
-		dcache_clean_manual(i, false, ways, sets, way_shift, set_shift);
-	}
-}
-
-void dcache_flush_invalidate(void)
-{
-	/* See ARM Architecture Reference Manual ch. B4.2.1 p. B4-1724 */
-	const unsigned levels = dcache_levels();
-	for (unsigned i = 0; i < levels; ++i) {
-		const unsigned ways = dcache_ways(i);
-		const unsigned sets = dcache_sets(i);
-		const unsigned way_shift = 32 - log2(ways);
-		const unsigned set_shift = dcache_linesize_log(i);
-		dcache_clean_manual(i, true, ways, sets, way_shift, set_shift);
-	}
-}
-
-void cpu_dcache_flush(void)
-{
-	for (unsigned i = 0; i < CPU->arch.dcache_levels; ++i)
-		dcache_clean_manual(i, false,
-		    CPU->arch.dcache[i].ways, CPU->arch.dcache[i].sets,
-		    CPU->arch.dcache[i].way_shift, CPU->arch.dcache[i].set_shift);
-}
-
-void cpu_dcache_flush_invalidate(void)
-{
-	const unsigned levels =  dcache_levels();
-	for (unsigned i = 0; i < levels; ++i)
-		dcache_clean_manual(i, true,
-		    CPU->arch.dcache[i].ways, CPU->arch.dcache[i].sets,
-		    CPU->arch.dcache[i].way_shift, CPU->arch.dcache[i].set_shift);
-}
-
-void icache_invalidate(void)
-{
-#if defined(PROCESSOR_ARCH_armv7_a)
-	ICIALLU_write(0);
-#else
-	ICIALL_write(0);
-#endif
-}
-
-#if !defined(PROCESSOR_ARCH_armv7_a)
-static bool cache_is_unified(void)
-{
-	if (MIDR_read() != CTR_read()) {
-		/* We have the CTR register */
-		return (CTR_read() & CTR_SEP_FLAG) != CTR_SEP_FLAG;
-	} else {
-		panic("Unknown cache type");
-	}
-}
-#endif
-
-void dcache_invalidate(void)
-{
-#if defined(PROCESSOR_ARCH_armv7_a)
-	dcache_flush_invalidate();
-#else
-	if (cache_is_unified())
-		CIALL_write(0);
-	else
-		DCIALL_write(0);
-#endif
-}
-
-void dcache_clean_mva_pou(uintptr_t mva)
-{
-#if defined(PROCESSOR_ARCH_armv7_a)
-	DCCMVAU_write(mva);
-#else
-	if (cache_is_unified())
-		CCMVA_write(mva);
-	else
-		DCCMVA_write(mva);
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/arm32/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-#define FRAME_OFFSET_FP_PREV	-3
-#define FRAME_OFFSET_RA		-1
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint32_t *stack = (void *) ctx->fp;
-
-	*prev = stack[FRAME_OFFSET_FP_PREV];
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint32_t *stack = (void *) ctx->fp;
-
-	*ra = stack[FRAME_OFFSET_RA];
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return !copy_from_uspace(prev,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return !copy_from_uspace(ra,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/arm32/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	mov r0, fp
-	mov pc, lr
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	mov r0, lr
-	mov pc, lr
-FUNCTION_END(program_counter_get)
Index: rnel/arch/arm32/src/dummy.S
===================================================================
--- kernel/arch/arm32/src/dummy.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt, Pavel Jancik, Petr Stepan
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(calibrate_delay_loop)
-	mov	pc, lr
-FUNCTION_END(calibrate_delay_loop)
-
-FUNCTION_BEGIN(asm_delay_loop)
-	mov	pc, lr
-FUNCTION_END(asm_delay_loop)
Index: rnel/arch/arm32/src/eabi.S
===================================================================
--- kernel/arch/arm32/src/eabi.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-#
-# Copyright (c) 2012 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(__aeabi_idiv)
-	push {lr}
-	bl __divsi3
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_idiv)
-
-FUNCTION_BEGIN(__aeabi_uidiv)
-	push {lr}
-	bl __udivsi3
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uidiv)
-
-FUNCTION_BEGIN(__aeabi_idivmod)
-	push {lr}
-	sub sp, sp, #12
-	add r2, sp, #4
-	bl __udivmodsi3
-	ldr r1, [sp, #4]
-	add sp, sp, #12
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_idivmod)
-
-FUNCTION_BEGIN(__aeabi_uidivmod)
-	push {lr}
-	sub sp, sp, #12
-	add r2, sp, #4
-	bl __udivmodsi3
-	ldr r1, [sp, #4]
-	add sp, sp, #12
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uidivmod)
-
-FUNCTION_BEGIN(__aeabi_ldivmod)
-	push {lr}
-	sub sp, sp, #24
-	push {sp}
-	bl __divmoddi3
-	add sp, sp, #4
-	pop {r2, r3}
-	add sp, sp, #16
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_ldivmod)
-
-FUNCTION_BEGIN(__aeabi_uldivmod)
-	push {lr}
-	sub sp, sp, #24
-	push {sp}
-	bl __udivmoddi3
-	add sp, sp, #4
-	pop {r2, r3}
-	add sp, sp, #16
-	pop {lr}
-	mov pc, lr
-FUNCTION_END(__aeabi_uldivmod)
Index: rnel/arch/arm32/src/exc_handler.S
===================================================================
--- kernel/arch/arm32/src/exc_handler.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,204 +1,0 @@
-#
-# Copyright (c) 2009 Vineeth Pillai
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-# Switches to kernel stack and saves all registers there.
-#
-#  The stack frame created by the function looks like:
-#
-#              |_________________|
-#              |                 |
-#              |     SPSR        |
-#              |                 |
-#              |_________________|
-#              | Stack Pointer   |
-#              |      of         |
-#              | Previous Mode   |
-#              |_________________|
-#              | Return address  |
-#              |      of         |
-#              | Previous Mode   |
-#              |_________________|
-#              |   R0  - R12     |
-#              |      of         |
-#              | Previous Mode   |
-#              |_________________|
-#              | Return address  |
-#              |     from        |
-#              |Exception Handler|
-#              |_________________|
-#              |                 |
-#
-#
-
-.macro SAVE_REGS_TO_STACK
-	stmfd r13!, {r0-r3}
-	mov r3, sp
-	add sp, sp, #16
-	mrs r1, cpsr
-	bic r1, r1, #0x1f
-	mrs r2, spsr
-	and r0, r2, #0x1f
-	cmp r0, #0x10
-	bne 1f
-
-	# prev mode was usermode
-	mov r0, lr
-
-	# Switch to supervisor mode
-	orr r1, r1, #0x13
-	msr cpsr_c, r1
-
-	# Load sp with [supervisor_sp]
-	ldr r13, =supervisor_sp
-	ldr r13, [r13]
-
-	# Populate the stack frame
-	msr spsr, r2
-	mov lr, r0
-	stmfd r13!, {lr}
-	stmfd r13!, {r4-r12}
-	ldmfd r3!, {r4-r7}
-	stmfd r13!, {r4-r7}
-	mov r4, r13
-	stmfd r4, {r13, lr}^
-	nop			/* Cannot access r13 immediately after stm(2) */
-	sub r13, r13, #8
-	stmfd r13!, {r2}
-
-	# Stop stack traces here
-	mov fp, #0
-
-	b 2f
-
-	# mode was not usermode
-1:
-	# Switch to previous mode which is undoubtedly the supervisor mode
-	orr r1, r1, r0
-	mov r0, lr
-	msr cpsr_c, r1
-
-	# Populate the stack frame
-	mov r1, sp
-	stmfd r13!, {r0}
-	stmfd r13!, {r4-r12}
-
-	# Store r0-r3 in r4-r7 and then push it on to stack
-	ldmfd r3!, {r4-r7}
-	stmfd r13!, {r4-r7}
-
-	# Push return address and stack pointer on to stack
-	stmfd r13!, {lr}
-	stmfd r13!, {r1}
-	mov lr, r0
-	msr spsr, r2
-	stmfd r13!, {r2}
-2:
-	sub sp, sp, #4
-.endm
-
-.macro LOAD_REGS_FROM_STACK
-	add sp, sp, #4
-	ldmfd r13!, {r0}
-	msr spsr, r0
-	and r0, r0, #0x1f
-	cmp r0, #0x10
-	bne 1f
-
-	# return to user mode
-	mov r0, r13
-	ldmfd r0, {r13, lr}^
-	nop			/* Cannot access r13 immediately after ldm(2) */
-	add r13, r13, #8
-	b 2f
-
-	# return to non-user mode
-1:
-	ldmfd r13!, {r1, lr}
-
-2:
-	ldmfd r13!, {r0-r12, pc}^
-.endm
-
-SYMBOL(reset_exception_entry)
-	SAVE_REGS_TO_STACK
-	mov r0, #0
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(irq_exception_entry)
-	sub lr, lr, #4
-	SAVE_REGS_TO_STACK
-	mov r0, #5
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(fiq_exception_entry)
-	sub lr, lr, #4
-	SAVE_REGS_TO_STACK
-	mov r0, #6
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(undef_instr_exception_entry)
-	SAVE_REGS_TO_STACK
-	mov r0, #1
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(prefetch_abort_exception_entry)
-	sub lr, lr, #4
-	SAVE_REGS_TO_STACK
-	mov r0, #3
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(data_abort_exception_entry)
-	sub lr, lr, #8
-	SAVE_REGS_TO_STACK
-	mov r0, #4
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
-SYMBOL(swi_exception_entry)
-	ldr r13, =exc_stack
-	SAVE_REGS_TO_STACK
-	mov r0, #2
-	mov r1, r13
-	bl ras_check
-	LOAD_REGS_FROM_STACK
-
Index: rnel/arch/arm32/src/exception.c
===================================================================
--- kernel/arch/arm32/src/exception.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,227 +1,0 @@
-/*
- * Copyright (c) 2007 Petr Stepan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Exception handlers and exception initialization routines.
- */
-
-#include <arch/exception.h>
-#include <arch/regutils.h>
-#include <arch/machine_func.h>
-#include <interrupt.h>
-#include <arch/mm/page_fault.h>
-#include <arch/cp15.h>
-#include <barrier.h>
-#include <stdio.h>
-#include <syscall/syscall.h>
-#include <stacktrace.h>
-
-/** Offset used in calculation of exception handler's relative address.
- *
- * @see install_handler()
- */
-#define PREFETCH_OFFSET      0x8
-
-/** LDR instruction's code */
-#define LDR_OPCODE           0xe59ff000
-
-/** Number of exception vectors. */
-#define EXC_VECTORS          8
-
-/** Size of memory block occupied by exception vectors. */
-#define EXC_VECTORS_SIZE     (EXC_VECTORS * 4)
-
-/** Updates specified exception vector to jump to given handler.
- *
- *  Addresses of handlers are stored in memory following exception vectors.
- */
-static void install_handler(unsigned handler_addr, unsigned *vector)
-{
-	/*
-	 * Relative address (related to exc. vector) of the word
-	 * where handler's address is stored
-	 */
-	volatile uint32_t handler_address_ptr = EXC_VECTORS_SIZE -
-	    PREFETCH_OFFSET;
-
-	/* Make it LDR instruction and store at exception vector */
-	*vector = handler_address_ptr | LDR_OPCODE;
-	smc_coherence(vector, 4);
-
-	/* Store handler's address */
-	*(vector + EXC_VECTORS) = handler_addr;
-
-}
-
-/** Software Interrupt handler.
- *
- * Dispatches the syscall.
- *
- */
-static void swi_exception(unsigned int exc_no, istate_t *istate)
-{
-	interrupts_enable();
-	istate->r0 = syscall_handler(istate->r0, istate->r1, istate->r2,
-	    istate->r3, istate->r4, istate->r5, istate->r6);
-	interrupts_disable();
-}
-
-/** Fills exception vectors with appropriate exception handlers. */
-void install_exception_handlers(void)
-{
-	install_handler((unsigned) reset_exception_entry,
-	    (unsigned *) EXC_RESET_VEC);
-
-	install_handler((unsigned) undef_instr_exception_entry,
-	    (unsigned *) EXC_UNDEF_INSTR_VEC);
-
-	install_handler((unsigned) swi_exception_entry,
-	    (unsigned *) EXC_SWI_VEC);
-
-	install_handler((unsigned) prefetch_abort_exception_entry,
-	    (unsigned *) EXC_PREFETCH_ABORT_VEC);
-
-	install_handler((unsigned) data_abort_exception_entry,
-	    (unsigned *) EXC_DATA_ABORT_VEC);
-
-	install_handler((unsigned) irq_exception_entry,
-	    (unsigned *) EXC_IRQ_VEC);
-
-	install_handler((unsigned) fiq_exception_entry,
-	    (unsigned *) EXC_FIQ_VEC);
-}
-
-#ifdef HIGH_EXCEPTION_VECTORS
-/** Activates use of high exception vectors addresses.
- *
- * "High vectors were introduced into some implementations of ARMv4 and are
- * required in ARMv6 implementations. High vectors allow the exception vector
- * locations to be moved from their normal address range 0x00000000-0x0000001C
- * at the bottom of the 32-bit address space, to an alternative address range
- * 0xFFFF0000-0xFFFF001C near the top of the address space. These alternative
- * locations are known as the high vectors.
- *
- * Prior to ARMv6, it is IMPLEMENTATION DEFINED whether the high vectors are
- * supported. When they are, a hardware configuration input selects whether
- * the normal vectors or the high vectors are to be used from
- * reset." ARM Architecture Reference Manual A2.6.11 (p. 64 in the PDF).
- *
- * ARM920T (gta02) TRM A2.3.5 (PDF p. 36) and ARM926EJ-S (icp) 2.3.2 (PDF p. 42)
- * say that armv4 an armv5 chips that we support implement this.
- */
-static void high_vectors(void)
-{
-	uint32_t control_reg = SCTLR_read();
-
-	/* switch on the high vectors bit */
-	control_reg |= SCTLR_HIGH_VECTORS_EN_FLAG;
-
-	SCTLR_write(control_reg);
-}
-#endif
-
-/** Interrupt Exception handler.
- *
- * Determines the sources of interrupt and calls their handlers.
- */
-static void irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	machine_irq_exception(exc_no, istate);
-}
-
-/** Undefined instruction exception handler.
- *
- * Calls scheduler_fpu_lazy_request
- */
-static void undef_insn_exception(unsigned int exc_no, istate_t *istate)
-{
-#ifdef CONFIG_FPU
-	if (handle_if_fpu_exception()) {
-		/*
-		 * Retry the failing instruction,
-		 * ARM Architecture Reference Manual says on p.B1-1169
-		 * that offset for undef instruction exception is 4
-		 */
-		istate->pc -= 4;
-		return;
-	}
-#endif
-	fault_if_from_uspace(istate, "Undefined instruction.");
-	panic_badtrap(istate, exc_no, "Undefined instruction.");
-}
-
-/** Initializes exception handling.
- *
- * Installs low-level exception handlers and then registers
- * exceptions and their handlers to kernel exception dispatcher.
- */
-void exception_init(void)
-{
-	// TODO check for availability of high vectors for <= armv5
-#ifdef HIGH_EXCEPTION_VECTORS
-	high_vectors();
-#endif
-	install_exception_handlers();
-
-	exc_register(EXC_UNDEF_INSTR, "undefined instruction", true,
-	    (iroutine_t) undef_insn_exception);
-	exc_register(EXC_IRQ, "interrupt", true,
-	    (iroutine_t) irq_exception);
-	exc_register(EXC_PREFETCH_ABORT, "prefetch abort", true,
-	    (iroutine_t) prefetch_abort);
-	exc_register(EXC_DATA_ABORT, "data abort", true,
-	    (iroutine_t) data_abort);
-	exc_register(EXC_SWI, "software interrupt", true,
-	    (iroutine_t) swi_exception);
-}
-
-/** Prints #istate_t structure content.
- *
- * @param istate Structure to be printed.
- */
-void istate_decode(istate_t *istate)
-{
-	printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
-	    "r2 =%0#10" PRIx32 "\tr3 =%0#10" PRIx32 "\n",
-	    istate->r0, istate->r1, istate->r2, istate->r3);
-	printf("r4 =%0#10" PRIx32 "\tr5 =%0#10" PRIx32 "\t"
-	    "r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\n",
-	    istate->r4, istate->r5, istate->r6, istate->r7);
-	printf("r8 =%0#10" PRIx32 "\tr9 =%0#10" PRIx32 "\t"
-	    "r10=%0#10" PRIx32 "\tfp =%0#10" PRIx32 "\n",
-	    istate->r8, istate->r9, istate->r10, istate->fp);
-	printf("r12=%0#10" PRIx32 "\tsp =%0#10" PRIx32 "\t"
-	    "lr =%0#10" PRIx32 "\tspsr=%0#10" PRIx32 "\n",
-	    istate->r12, istate->sp, istate->lr, istate->spsr);
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/fpu.S
===================================================================
--- kernel/arch/arm32/src/fpu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(fpsid_read)
-	vmrs r0, fpsid
-	mov pc, lr
-FUNCTION_END(fpsid_read)
-
-FUNCTION_BEGIN(mvfr0_read)
-	vmrs r0, mvfr0
-	mov pc, lr
-FUNCTION_END(mvfr0_read)
-
-FUNCTION_BEGIN(fpscr_read)
-	vmrs r0, fpscr
-	mov pc, lr
-FUNCTION_END(fpscr_read)
-
-FUNCTION_BEGIN(fpscr_write)
-	vmsr fpscr, r0
-	mov pc, lr
-FUNCTION_END(fpscr_write)
-
-FUNCTION_BEGIN(fpexc_read)
-	vmrs r0, fpexc
-	mov pc, lr
-FUNCTION_END(fpexc_read)
-
-FUNCTION_BEGIN(fpexc_write)
-	vmsr fpexc, r0
-	mov pc, lr
-FUNCTION_END(fpexc_write)
-
-FUNCTION_BEGIN(fpu_context_save_s32)
-	vmrs r1, fpexc
-	vmrs r2, fpscr
-	stmia r0!, {r1, r2}
-	vstmia r0!, {s0-s31}
-	mov pc, lr
-FUNCTION_END(fpu_context_save_s32)
-
-FUNCTION_BEGIN(fpu_context_restore_s32)
-	ldmia r0!, {r1, r2}
-	vmsr fpexc, r1
-	vmsr fpscr, r2
-	vldmia r0!, {s0-s31}
-	mov pc, lr
-FUNCTION_END(fpu_context_restore_s32)
-
-FUNCTION_BEGIN(fpu_context_save_d16)
-	vmrs r1, fpexc
-	vmrs r2, fpscr
-	stmia r0!, {r1, r2}
-	vstmia r0!, {d0-d15}
-	mov pc, lr
-FUNCTION_END(fpu_context_save_d16)
-
-FUNCTION_BEGIN(fpu_context_restore_d16)
-	ldmia r0!, {r1, r2}
-	vmsr fpexc, r1
-	vmsr fpscr, r2
-	vldmia r0!, {d0-d15}
-	mov pc, lr
-FUNCTION_END(fpu_context_restore_d16)
-
-FUNCTION_BEGIN(fpu_context_save_d32)
-	vmrs r1, fpexc
-	stmia r0!, {r1}
-	vmrs r1, fpscr
-	stmia r0!, {r1}
-	vstmia r0!, {d0-d15}
-	vstmia r0!, {d16-d31}
-	mov pc, lr
-FUNCTION_END(fpu_context_save_d32)
-
-FUNCTION_BEGIN(fpu_context_restore_d32)
-	ldmia r0!, {r1, r2}
-	vmsr fpexc, r1
-	vmsr fpscr, r2
-	vldmia r0!, {d0-d15}
-	vldmia r0!, {d16-d31}
-	mov pc, lr
-FUNCTION_END(fpu_context_restore_d32)
-
Index: rnel/arch/arm32/src/fpu_context.c
===================================================================
--- kernel/arch/arm32/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief arm32 FPU context
- */
-
-#include <fpu_context.h>
-#include <arch.h>
-#include <arch/types.h>
-#include <arch/security_ext.h>
-#include <arch/cp15.h>
-#include <cpu.h>
-
-#define FPSID_IMPLEMENTER(r)   ((r) >> 24)
-#define FPSID_SW_ONLY_FLAG   (1 << 23)
-#define FPSID_SUBACHITECTURE(r)   (((r) >> 16) & 0x7f)
-#define FPSID_PART_NUMBER(r)   (((r) >> 8) & 0xff)
-#define FPSID_VARIANT(r)   (((r) >> 4) 0xf)
-#define FPSID_REVISION(r)   (((r) >> 0) 0xf)
-
-enum {
-	FPU_VFPv1 = 0x00,
-	FPU_VFPv2_COMMONv1 = 0x01,
-	FPU_VFPv3_COMMONv2 = 0x02,
-	FPU_VFPv3_NO_COMMON = 0x3, /* Does not support fpu exc. traps */
-	FPU_VFPv3_COMMONv3 = 0x4,
-};
-
-extern uint32_t fpsid_read(void);
-extern uint32_t mvfr0_read(void);
-
-enum {
-	FPEXC_EX_FLAG = (1 << 31),
-	FPEXC_ENABLED_FLAG = (1 << 30),
-};
-extern uint32_t fpexc_read(void);
-extern void fpexc_write(uint32_t);
-
-/** ARM Architecture Reference Manual ch. B4.1.58, p. B$-1551 */
-enum {
-	FPSCR_N_FLAG = (1 << 31),
-	FPSCR_Z_FLAG = (1 << 30),
-	FPSCR_C_FLAG = (1 << 29),
-	FPSCR_V_FLAG = (1 << 28),
-	FPSCR_QC_FLAG = (1 << 27),
-	FPSCR_AHP_FLAG = (1 << 26),
-	FPSCR_DN_FLAG = (1 << 25),
-	FPSCR_FZ_FLAG = (1 << 24),
-	FPSCR_ROUND_MODE_MASK = (0x3 << 22),
-	FPSCR_ROUND_TO_NEAREST = (0x0 << 22),
-	FPSCR_ROUND_TO_POS_INF = (0x1 << 22),
-	FPSCR_ROUND_TO_NEG_INF = (0x2 << 22),
-	FPSCR_ROUND_TO_ZERO = (0x3 << 22),
-	FPSCR_STRIDE_MASK = (0x3 << 20),
-	FPSCR_STRIDE_SHIFT = 20,
-	FPSCR_LEN_MASK = (0x7 << 16),
-	FPSCR_LEN_SHIFT = 16,
-	FPSCR_DENORMAL_EN_FLAG = (1 << 15),
-	FPSCR_INEXACT_EN_FLAG = (1 << 12),
-	FPSCR_UNDERFLOW_EN_FLAG = (1 << 11),
-	FPSCR_OVERFLOW_EN_FLAG = (1 << 10),
-	FPSCR_ZERO_DIV_EN_FLAG = (1 << 9),
-	FPSCR_INVALID_OP_EN_FLAG = (1 << 8),
-	FPSCR_DENORMAL_FLAG = (1 << 7),
-	FPSCR_INEXACT_FLAG = (1 << 4),
-	FPSCR_UNDERFLOW_FLAG = (1 << 3),
-	FPSCR_OVERLOW_FLAG = (1 << 2),
-	FPSCR_DIV_ZERO_FLAG = (1 << 1),
-	FPSCR_INVALID_OP_FLAG = (1 << 0),
-
-	FPSCR_EN_ALL = FPSCR_DENORMAL_EN_FLAG | FPSCR_INEXACT_EN_FLAG | FPSCR_UNDERFLOW_EN_FLAG | FPSCR_OVERFLOW_EN_FLAG | FPSCR_ZERO_DIV_EN_FLAG | FPSCR_INVALID_OP_EN_FLAG,
-};
-
-extern uint32_t fpscr_read(void);
-extern void fpscr_write(uint32_t);
-
-extern void fpu_context_save_s32(fpu_context_t *);
-extern void fpu_context_restore_s32(fpu_context_t *);
-extern void fpu_context_save_d16(fpu_context_t *);
-extern void fpu_context_restore_d16(fpu_context_t *);
-extern void fpu_context_save_d32(fpu_context_t *);
-extern void fpu_context_restore_d32(fpu_context_t *);
-
-static void (*save_context)(fpu_context_t *ctx);
-static void (*restore_context)(fpu_context_t *ctx);
-
-static int fpu_have_coprocessor_access(void)
-{
-	/*
-	 * The register containing the information (CPACR) is not available
-	 * on armv6-. Rely on user decision to use CONFIG_FPU.
-	 */
-#ifdef PROCESSOR_ARCH_armv7_a
-	const uint32_t cpacr = CPACR_read();
-	/*
-	 * FPU needs access to coprocessor 10 and 11.
-	 * Moreover, they need to have same access enabled
-	 */
-	if (((cpacr & CPACR_CP_MASK(10)) != CPACR_CP_FULL_ACCESS(10)) &&
-	    ((cpacr & CPACR_CP_MASK(11)) != CPACR_CP_FULL_ACCESS(11))) {
-		printf("No access to CP10 and CP11: %" PRIx32 "\n", cpacr);
-		return 0;
-	}
-#endif
-
-	return 1;
-}
-
-/** Enable coprocessor access. Turn both non-secure mode bit and generic access.
- * Cortex A8 Manual says:
- * "You must execute an Instruction Memory Barrier (IMB) sequence immediately
- * after an update of the Coprocessor Access Control Register, see Memory
- * Barriers in the ARM Architecture Reference Manual. You must not attempt to
- * execute any instructions that are affected by the change of access rights
- * between the IMB sequence and the register update."
- * Cortex a8 TRM ch. 3.2.27. c1, Coprocessor Access Control Register
- *
- * @note do we need to call secure monitor here?
- */
-static void fpu_enable_coprocessor_access(void)
-{
-	/*
-	 * The register containing the information (CPACR) is not available
-	 * on armv6-. Rely on user decision to use CONFIG_FPU.
-	 */
-#ifdef PROCESSOR_ARCH_armv7_a
-	/* Allow coprocessor access */
-	uint32_t cpacr = CPACR_read();
-	/*
-	 * FPU needs access to coprocessor 10 and 11.
-	 * Moreover, they need to have same access enabled
-	 */
-	cpacr &= ~(CPACR_CP_MASK(10) | CPACR_CP_MASK(11));
-	cpacr |= (CPACR_CP_FULL_ACCESS(10) | CPACR_CP_FULL_ACCESS(11));
-	CPACR_write(cpacr);
-#endif
-}
-
-void fpu_init(void)
-{
-	/* Check if we have access */
-	if (!fpu_have_coprocessor_access())
-		return;
-
-	/* Clear all fpu flags */
-	fpexc_write(0);
-	fpu_enable();
-	/*
-	 * Mask all exception traps,
-	 * The bits are RAZ/WI on archs that don't support fpu exc traps.
-	 */
-	fpscr_write(fpscr_read() & ~FPSCR_EN_ALL);
-}
-
-void fpu_setup(void)
-{
-	uint32_t mvfr0;
-
-	/* Enable coprocessor access */
-	fpu_enable_coprocessor_access();
-
-	/* Check if we succeeded */
-	if (!fpu_have_coprocessor_access())
-		return;
-
-	const uint32_t fpsid = fpsid_read();
-	if (fpsid & FPSID_SW_ONLY_FLAG) {
-		printf("No FPU avaiable\n");
-		return;
-	}
-	switch (FPSID_SUBACHITECTURE(fpsid)) {
-	case FPU_VFPv1:
-		printf("Detected VFPv1\n");
-		save_context = fpu_context_save_s32;
-		restore_context = fpu_context_restore_s32;
-		break;
-	case FPU_VFPv2_COMMONv1:
-		printf("Detected VFPv2\n");
-		save_context = fpu_context_save_d16;
-		restore_context = fpu_context_restore_d16;
-		break;
-	case FPU_VFPv3_COMMONv2:
-	case FPU_VFPv3_NO_COMMON:
-	case FPU_VFPv3_COMMONv3:
-		mvfr0 = mvfr0_read();
-		/* See page B4-1637 */
-		if ((mvfr0 & 0xf) == 0x1) {
-			printf("Detected VFPv3+ with 16 regs\n");
-			save_context = fpu_context_save_d16;
-			restore_context = fpu_context_restore_d16;
-		} else {
-			printf("Detected VFPv3+ with 32 regs\n");
-			save_context = fpu_context_save_d32;
-			restore_context = fpu_context_restore_d32;
-		}
-		break;
-	}
-}
-
-bool handle_if_fpu_exception(void)
-{
-	/* Check if we have access */
-	if (!fpu_have_coprocessor_access())
-		return false;
-
-	const uint32_t fpexc = fpexc_read();
-	if (fpexc & FPEXC_ENABLED_FLAG) {
-		const uint32_t fpscr = fpscr_read();
-		printf("FPU exception\n"
-		    "\tFPEXC: %" PRIx32 " FPSCR: %" PRIx32 "\n", fpexc, fpscr);
-		return false;
-	}
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-	return true;
-#else
-	return false;
-#endif
-}
-
-void fpu_enable(void)
-{
-	/* Check if we have access */
-	if (!fpu_have_coprocessor_access())
-		return;
-	/* Enable FPU instructions */
-	fpexc_write(fpexc_read() | FPEXC_ENABLED_FLAG);
-}
-
-void fpu_disable(void)
-{
-	/* Check if we have access */
-	if (!fpu_have_coprocessor_access())
-		return;
-	/* Disable FPU instructions */
-	fpexc_write(fpexc_read() & ~FPEXC_ENABLED_FLAG);
-}
-
-void fpu_context_save(fpu_context_t *ctx)
-{
-	/* This is only necessary if we enable fpu exceptions. */
-#if 0
-	const uint32_t fpexc = fpexc_read();
-
-	if (fpexc & FPEXC_EX_FLAG) {
-		printf("EX FPU flag is on, things will fail\n");
-		//TODO implement common subarch context saving
-	}
-#endif
-	if (save_context)
-		save_context(ctx);
-}
-
-void fpu_context_restore(fpu_context_t *ctx)
-{
-	if (restore_context)
-		restore_context(ctx);
-}
Index: rnel/arch/arm32/src/interrupt.c
===================================================================
--- kernel/arch/arm32/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2007 Petr Stepan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Interrupts controlling routines.
- */
-
-#include <arch/asm.h>
-#include <arch/regutils.h>
-#include <arch/machine_func.h>
-#include <ddi/irq.h>
-#include <interrupt.h>
-
-/** Disable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_disable(void)
-{
-	ipl_t ipl = current_status_reg_read();
-
-	current_status_reg_control_write(STATUS_REG_IRQ_DISABLED_BIT | ipl);
-
-	return ipl;
-}
-
-/** Enable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_enable(void)
-{
-	ipl_t ipl = current_status_reg_read();
-
-	current_status_reg_control_write(ipl & ~STATUS_REG_IRQ_DISABLED_BIT);
-
-	return ipl;
-}
-
-/** Restore interrupt priority level.
- *
- * @param ipl Saved interrupt priority level.
- */
-void interrupts_restore(ipl_t ipl)
-{
-	current_status_reg_control_write(
-	    (current_status_reg_read() & ~STATUS_REG_IRQ_DISABLED_BIT) |
-	    (ipl & STATUS_REG_IRQ_DISABLED_BIT));
-}
-
-/** Read interrupt priority level.
- *
- * @return Current interrupt priority level.
- */
-ipl_t interrupts_read(void)
-{
-	return current_status_reg_read();
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-bool interrupts_disabled(void)
-{
-	return current_status_reg_read() & STATUS_REG_IRQ_DISABLED_BIT;
-}
-
-/** Initialize basic tables for exception dispatching
- * and starts the timer.
- */
-void interrupt_init(void)
-{
-	size_t irq_count;
-
-	irq_count = machine_get_irq_count();
-	irq_init(irq_count, irq_count);
-
-	machine_timer_irq_start();
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
===================================================================
--- kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,211 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_arm32_beagleboardxm
- * @{
- */
-/** @file
- *  @brief BeagleBoard-xM platform driver.
- */
-
-#include <arch/exception.h>
-#include <arch/mach/beagleboardxm/beagleboardxm.h>
-#include <assert.h>
-#include <genarch/drivers/amdm37x/uart.h>
-#include <genarch/drivers/amdm37x/irc.h>
-#include <genarch/drivers/amdm37x/gpt.h>
-#include <genarch/fb/fb.h>
-#include <genarch/srln/srln.h>
-#include <interrupt.h>
-#include <mm/km.h>
-#include <ddi/ddi.h>
-#include <stdbool.h>
-
-static void bbxm_init(void);
-static void bbxm_timer_irq_start(void);
-static void bbxm_cpu_halt(void);
-static void bbxm_get_memory_extents(uintptr_t *start, size_t *size);
-static void bbxm_irq_exception(unsigned int exc_no, istate_t *istate);
-static void bbxm_frame_init(void);
-static void bbxm_output_init(void);
-static void bbxm_input_init(void);
-static size_t bbxm_get_irq_count(void);
-static const char *bbxm_get_platform_name(void);
-
-#define BBXM_MEMORY_START	0x80000000	/* physical */
-#define BBXM_MEMORY_SIZE	0x20000000	/* 512 MB */
-
-static struct beagleboard {
-	omap_irc_regs_t *irc_addr;
-	omap_uart_t uart;
-	amdm37x_gpt_t timer;
-} beagleboard;
-
-struct arm_machine_ops bbxm_machine_ops = {
-	.machine_init = bbxm_init,
-	.machine_timer_irq_start = bbxm_timer_irq_start,
-	.machine_cpu_halt = bbxm_cpu_halt,
-	.machine_get_memory_extents = bbxm_get_memory_extents,
-	.machine_irq_exception = bbxm_irq_exception,
-	.machine_frame_init = bbxm_frame_init,
-	.machine_output_init = bbxm_output_init,
-	.machine_input_init = bbxm_input_init,
-	.machine_get_irq_count = bbxm_get_irq_count,
-	.machine_get_platform_name = bbxm_get_platform_name
-};
-
-static irq_ownership_t bb_timer_irq_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void bb_timer_irq_handler(irq_t *irq)
-{
-	amdm37x_gpt_irq_ack(&beagleboard.timer);
-
-	/*
-	 * We are holding a lock which prevents preemption.
-	 * Release the lock, call clock() and reacquire the lock again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-static void bbxm_init(void)
-{
-	/* Initialize interrupt controller */
-	beagleboard.irc_addr =
-	    (void *) km_map(AMDM37x_IRC_BASE_ADDRESS, AMDM37x_IRC_SIZE,
-	    KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-	assert(beagleboard.irc_addr);
-	omap_irc_init(beagleboard.irc_addr);
-
-	/*
-	 * Initialize timer. Use timer1, because it is in WKUP power domain
-	 * (always on) and has special capabilities for precise 1ms ticks
-	 */
-	amdm37x_gpt_timer_ticks_init(&beagleboard.timer,
-	    AMDM37x_GPT1_BASE_ADDRESS, AMDM37x_GPT1_SIZE, HZ);
-}
-
-static void bbxm_timer_irq_start(void)
-{
-	/* Initialize timer IRQ */
-	static irq_t timer_irq;
-	irq_initialize(&timer_irq);
-	timer_irq.inr = AMDM37x_GPT1_IRQ;
-	timer_irq.claim = bb_timer_irq_claim;
-	timer_irq.handler = bb_timer_irq_handler;
-	irq_register(&timer_irq);
-
-	/* Enable timer interrupt */
-	omap_irc_enable(beagleboard.irc_addr, AMDM37x_GPT1_IRQ);
-
-	/* Start timer here */
-	amdm37x_gpt_timer_ticks_start(&beagleboard.timer);
-}
-
-static void bbxm_cpu_halt(void)
-{
-	while (true)
-		;
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address (physical).
- * @param size		Place to store memory size.
- */
-static void bbxm_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	*start = BBXM_MEMORY_START;
-	*size = BBXM_MEMORY_SIZE;
-}
-
-static void bbxm_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	const unsigned inum = omap_irc_inum_get(beagleboard.irc_addr);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		/* Spurious interrupt. */
-		printf("cpu%d: spurious interrupt (inum=%d)\n",
-		    CPU->id, inum);
-	}
-	/** amdm37x manual ch. 12.5.2 (p. 2428) places irc ack at the end
-	 * of ISR. DO this to avoid strange behavior.
-	 */
-	omap_irc_irq_ack(beagleboard.irc_addr);
-}
-
-static void bbxm_frame_init(void)
-{
-}
-
-static void bbxm_output_init(void)
-{
-#ifdef CONFIG_OMAP_UART
-	/* UART3 is wired to external RS232 connector */
-	const bool ok = omap_uart_init(&beagleboard.uart,
-	    AMDM37x_UART3_IRQ, AMDM37x_UART3_BASE_ADDRESS, AMDM37x_UART3_SIZE);
-	if (ok) {
-		stdout_wire(&beagleboard.uart.outdev);
-	}
-#endif
-}
-
-static void bbxm_input_init(void)
-{
-#ifdef CONFIG_OMAP_UART
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance) {
-		indev_t *sink = stdin_wire();
-		indev_t *srln = srln_wire(srln_instance, sink);
-		omap_uart_input_wire(&beagleboard.uart, srln);
-		omap_irc_enable(beagleboard.irc_addr, AMDM37x_UART3_IRQ);
-	}
-#endif
-}
-
-size_t bbxm_get_irq_count(void)
-{
-	return AMDM37x_IRC_IRQ_COUNT;
-}
-
-const char *bbxm_get_platform_name(void)
-{
-	return "beagleboardxm";
-}
-
-/**
- * @}
- */
Index: rnel/arch/arm32/src/mach/beaglebone/beaglebone.c
===================================================================
--- kernel/arch/arm32/src/mach/beaglebone/beaglebone.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-/*
- * Copyright (c) 2012 Matteo Facchinetti
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_arm32_beaglebone
- * @{
- */
-/** @file
- *  @brief BeagleBone platform driver.
- */
-
-#include <arch/exception.h>
-#include <arch/mach/beaglebone/beaglebone.h>
-#include <assert.h>
-#include <genarch/drivers/am335x/irc.h>
-#include <genarch/drivers/am335x/uart.h>
-#include <genarch/drivers/am335x/timer.h>
-#include <genarch/drivers/am335x/cm_per.h>
-#include <genarch/drivers/am335x/cm_dpll.h>
-#include <genarch/drivers/am335x/ctrl_module.h>
-#include <genarch/srln/srln.h>
-#include <interrupt.h>
-#include <ddi/ddi.h>
-#include <mm/km.h>
-#include <stdbool.h>
-
-#define BBONE_MEMORY_START       0x80000000      /* physical */
-#define BBONE_MEMORY_SIZE        0x10000000      /* 256 MB */
-
-static void bbone_init(void);
-static void bbone_timer_irq_start(void);
-static void bbone_cpu_halt(void);
-static void bbone_get_memory_extents(uintptr_t *start, size_t *size);
-static void bbone_irq_exception(unsigned int exc_no, istate_t *istate);
-static void bbone_frame_init(void);
-static void bbone_output_init(void);
-static void bbone_input_init(void);
-static size_t bbone_get_irq_count(void);
-static const char *bbone_get_platform_name(void);
-
-static struct beaglebone {
-	omap_irc_regs_t *irc_addr;
-	am335x_cm_per_regs_t *cm_per_addr;
-	am335x_cm_dpll_regs_t *cm_dpll_addr;
-	am335x_ctrl_module_t  *ctrl_module;
-	am335x_timer_t timer;
-	omap_uart_t uart;
-} bbone;
-
-struct arm_machine_ops bbone_machine_ops = {
-	.machine_init = bbone_init,
-	.machine_timer_irq_start = bbone_timer_irq_start,
-	.machine_cpu_halt = bbone_cpu_halt,
-	.machine_get_memory_extents = bbone_get_memory_extents,
-	.machine_irq_exception = bbone_irq_exception,
-	.machine_frame_init = bbone_frame_init,
-	.machine_output_init = bbone_output_init,
-	.machine_input_init = bbone_input_init,
-	.machine_get_irq_count = bbone_get_irq_count,
-	.machine_get_platform_name = bbone_get_platform_name,
-};
-
-static void bbone_init(void)
-{
-	bbone.irc_addr = (void *) km_map(AM335x_IRC_BASE_ADDRESS,
-	    AM335x_IRC_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-
-	bbone.cm_per_addr = (void *) km_map(AM335x_CM_PER_BASE_ADDRESS,
-	    AM335x_CM_PER_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-
-	bbone.cm_dpll_addr = (void *) km_map(AM335x_CM_DPLL_BASE_ADDRESS,
-	    AM335x_CM_DPLL_SIZE, KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-
-	bbone.ctrl_module = (void *) km_map(AM335x_CTRL_MODULE_BASE_ADDRESS,
-	    AM335x_CTRL_MODULE_SIZE, KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE);
-
-	assert(bbone.irc_addr != NULL);
-	assert(bbone.cm_per_addr != NULL);
-	assert(bbone.cm_dpll_addr != NULL);
-	assert(bbone.ctrl_module != NULL);
-
-	/* Initialize the interrupt controller */
-	omap_irc_init(bbone.irc_addr);
-}
-
-static irq_ownership_t bbone_timer_irq_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void bbone_timer_irq_handler(irq_t *irq)
-{
-	am335x_timer_intr_ack(&bbone.timer);
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-static void bbone_timer_irq_start(void)
-{
-	unsigned sysclk_freq;
-	errno_t rc;
-
-	/* Initialize the IRQ */
-	static irq_t timer_irq;
-	irq_initialize(&timer_irq);
-	timer_irq.inr = AM335x_DMTIMER2_IRQ;
-	timer_irq.claim = bbone_timer_irq_claim;
-	timer_irq.handler = bbone_timer_irq_handler;
-	irq_register(&timer_irq);
-
-	/* Enable the DMTIMER2 clock module */
-	am335x_clock_module_enable(bbone.cm_per_addr, DMTIMER2);
-	/* Select the SYSCLK as the clock source for the dmtimer2 module */
-	am335x_clock_source_select(bbone.cm_dpll_addr, DMTIMER2,
-	    CLK_SRC_M_OSC);
-	/* Initialize the DMTIMER2 */
-	if (am335x_ctrl_module_clock_freq_get(bbone.ctrl_module,
-	    &sysclk_freq) != EOK) {
-		printf("Cannot get the system clock frequency!\n");
-		return;
-	} else
-		printf("system clock running at %u hz\n", sysclk_freq);
-
-	rc = am335x_timer_init(&bbone.timer, DMTIMER2, HZ, sysclk_freq);
-	if (rc != EOK) {
-		printf("Timer initialization failed\n");
-		return;
-	}
-	/* Enable the interrupt */
-	omap_irc_enable(bbone.irc_addr, AM335x_DMTIMER2_IRQ);
-	/* Start the timer */
-	am335x_timer_start(&bbone.timer);
-}
-
-static void bbone_cpu_halt(void)
-{
-	while (true)
-		;
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address (physical).
- * @param size		Place to store memory size.
- */
-static void bbone_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	*start = BBONE_MEMORY_START;
-	*size  = BBONE_MEMORY_SIZE;
-}
-
-static void bbone_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	const unsigned inum = omap_irc_inum_get(bbone.irc_addr);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		printf("Spurious interrupt\n");
-	}
-
-	omap_irc_irq_ack(bbone.irc_addr);
-}
-
-static void bbone_frame_init(void)
-{
-}
-
-static void bbone_output_init(void)
-{
-#ifdef CONFIG_OMAP_UART
-	const bool ok = omap_uart_init(&bbone.uart,
-	    AM335x_UART0_IRQ, AM335x_UART0_BASE_ADDRESS,
-	    AM335x_UART0_SIZE);
-
-	if (ok)
-		stdout_wire(&bbone.uart.outdev);
-#endif
-}
-
-static void bbone_input_init(void)
-{
-#ifdef CONFIG_OMAP_UART
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance) {
-		indev_t *sink = stdin_wire();
-		indev_t *srln = srln_wire(srln_instance, sink);
-		omap_uart_input_wire(&bbone.uart, srln);
-		omap_irc_enable(bbone.irc_addr, AM335x_UART0_IRQ);
-	}
-#endif
-}
-
-size_t bbone_get_irq_count(void)
-{
-	return AM335x_IRC_IRQ_COUNT;
-}
-
-const char *bbone_get_platform_name(void)
-{
-	return "beaglebone";
-}
-
-/**
- * @}
- */
Index: rnel/arch/arm32/src/mach/gta02/gta02.c
===================================================================
--- kernel/arch/arm32/src/mach/gta02/gta02.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,309 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_gta02
- * @{
- */
-/** @file
- *  @brief Openmoko GTA02 (Neo FreeRunner) platform driver.
- */
-
-#include <arch/exception.h>
-#include <arch/mach/gta02/gta02.h>
-#include <arch/mm/page.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <genarch/drivers/s3c24xx/uart.h>
-#include <genarch/drivers/s3c24xx/irqc.h>
-#include <genarch/drivers/s3c24xx/timer.h>
-#include <genarch/srln/srln.h>
-#include <sysinfo/sysinfo.h>
-#include <interrupt.h>
-#include <ddi/ddi.h>
-#include <log.h>
-
-#define GTA02_MEMORY_START	0x30000000	/* physical */
-#define GTA02_MEMORY_SIZE	0x08000000	/* 128 MB */
-#define GTA02_MEMORY_SKIP	0x8000
-
-/** GTA02 serial console UART address (UART S3C24XX CPU UART channel 2). */
-#define GTA02_SCONS_BASE	0x50008000
-
-/** GTA02 framebuffer base address */
-#define GTA02_FB_BASE		0x08800000
-
-/** IRQ number used for clock */
-#define GTA02_TIMER_IRQ		S3C24XX_INT_TIMER0
-
-static void gta02_init(void);
-static void gta02_timer_irq_start(void);
-static void gta02_cpu_halt(void);
-static void gta02_get_memory_extents(uintptr_t *start, size_t *size);
-static void gta02_irq_exception(unsigned int exc_no, istate_t *istate);
-static void gta02_frame_init(void);
-static void gta02_output_init(void);
-static void gta02_input_init(void);
-static size_t gta02_get_irq_count(void);
-static const char *gta02_get_platform_name(void);
-
-static void gta02_timer_irq_init(void);
-static void gta02_timer_start(void);
-static irq_ownership_t gta02_timer_irq_claim(irq_t *irq);
-static void gta02_timer_irq_handler(irq_t *irq);
-
-static outdev_t *gta02_scons_dev;
-static s3c24xx_irqc_t gta02_irqc;
-static s3c24xx_timer_t *gta02_timer;
-
-static irq_t gta02_timer_irq;
-
-struct arm_machine_ops gta02_machine_ops = {
-	gta02_init,
-	gta02_timer_irq_start,
-	gta02_cpu_halt,
-	gta02_get_memory_extents,
-	gta02_irq_exception,
-	gta02_frame_init,
-	gta02_output_init,
-	gta02_input_init,
-	gta02_get_irq_count,
-	gta02_get_platform_name
-};
-
-static void gta02_init(void)
-{
-	s3c24xx_irqc_regs_t *irqc_regs;
-
-	gta02_timer = (void *) km_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE,
-	    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-	irqc_regs = (void *) km_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_NOT_CACHEABLE);
-
-	/* Initialize interrupt controller. */
-	s3c24xx_irqc_init(&gta02_irqc, irqc_regs);
-}
-
-static void gta02_timer_irq_start(void)
-{
-	gta02_timer_irq_init();
-	gta02_timer_start();
-}
-
-static void gta02_cpu_halt(void)
-{
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address (physical).
- * @param size		Place to store memory size.
- */
-static void gta02_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	*start = GTA02_MEMORY_START + GTA02_MEMORY_SKIP;
-	*size  = GTA02_MEMORY_SIZE - GTA02_MEMORY_SKIP;
-}
-
-static void gta02_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	uint32_t inum;
-
-	/* Determine IRQ number. */
-	inum = s3c24xx_irqc_inum_get(&gta02_irqc);
-
-	/* Clear interrupt condition in the interrupt controller. */
-	s3c24xx_irqc_clear(&gta02_irqc, inum);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		/* Spurious interrupt. */
-		log(LF_ARCH, LVL_DEBUG, "cpu%d: spurious interrupt (inum=%d)",
-		    CPU->id, inum);
-	}
-}
-
-static void gta02_frame_init(void)
-{
-}
-
-static void gta02_output_init(void)
-{
-#ifdef CONFIG_FB
-	fb_properties_t prop = {
-		.addr = GTA02_FB_BASE,
-		.offset = 0,
-		.x = 480,
-		.y = 640,
-		.scan = 960,
-		.visual = VISUAL_RGB_5_6_5_LE
-	};
-
-	outdev_t *fb_dev = fb_init(&prop);
-	if (fb_dev)
-		stdout_wire(fb_dev);
-#endif
-
-	/* Initialize serial port of the debugging console. */
-	gta02_scons_dev =
-	    s3c24xx_uart_init(GTA02_SCONS_BASE, S3C24XX_INT_UART2);
-
-	if (gta02_scons_dev) {
-		/* Create output device. */
-		stdout_wire(gta02_scons_dev);
-	}
-
-	/*
-	 * This is the necessary evil until the userspace driver is entirely
-	 * self-sufficient.
-	 */
-	sysinfo_set_item_val("s3c24xx_uart", NULL, true);
-	sysinfo_set_item_val("s3c24xx_uart.inr", NULL, S3C24XX_INT_UART2);
-	sysinfo_set_item_val("s3c24xx_uart.address.physical", NULL,
-	    (uintptr_t) GTA02_SCONS_BASE);
-
-}
-
-static void gta02_input_init(void)
-{
-	s3c24xx_uart_t *scons_inst;
-
-	if (gta02_scons_dev) {
-		/* Create input device. */
-		scons_inst = (void *) gta02_scons_dev->data;
-
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			s3c24xx_uart_input_wire(scons_inst, srln);
-
-			/* Enable interrupts from UART2 */
-			s3c24xx_irqc_src_enable(&gta02_irqc,
-			    S3C24XX_INT_UART2);
-
-			/* Enable interrupts from UART2 RXD */
-			s3c24xx_irqc_subsrc_enable(&gta02_irqc,
-			    S3C24XX_SUBINT_RXD2);
-		}
-	}
-
-	/* Enable interrupts from ADC */
-	s3c24xx_irqc_src_enable(&gta02_irqc, S3C24XX_INT_ADC);
-
-	/* Enable interrupts from ADC sub-sources */
-	s3c24xx_irqc_subsrc_enable(&gta02_irqc, S3C24XX_SUBINT_ADC_S);
-	s3c24xx_irqc_subsrc_enable(&gta02_irqc, S3C24XX_SUBINT_TC);
-}
-
-size_t gta02_get_irq_count(void)
-{
-	return GTA02_IRQ_COUNT;
-}
-
-const char *gta02_get_platform_name(void)
-{
-	return "gta02";
-}
-
-static void gta02_timer_irq_init(void)
-{
-	irq_initialize(&gta02_timer_irq);
-	gta02_timer_irq.inr = GTA02_TIMER_IRQ;
-	gta02_timer_irq.claim = gta02_timer_irq_claim;
-	gta02_timer_irq.handler = gta02_timer_irq_handler;
-
-	irq_register(&gta02_timer_irq);
-}
-
-static irq_ownership_t gta02_timer_irq_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void gta02_timer_irq_handler(irq_t *irq)
-{
-	/*
-	 * We are holding a lock which prevents preemption.
-	 * Release the lock, call clock() and reacquire the lock again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-static void gta02_timer_start(void)
-{
-	s3c24xx_timer_t *timer = gta02_timer;
-
-	/*
-	 * See S3C2442B user manual chapter 10 (PWM Timer) for description
-	 * of timer operation. Starting a timer is described in the
-	 * section 'Timer initialization using manual update bit and
-	 * inverter bit'.
-	 */
-
-	/*
-	 * GTA02 PCLK should be 100 MHz.
-	 * Timer input freq. = PCLK / divider / (1+prescaler)
-	 * 100 MHz / 2 / (1+7) / 62500 ~= 100 Hz
-	 */
-#if HZ != 100
-#warning Other HZ than 100 not suppored.
-#endif
-
-	/* Set prescaler values. No pre-divison, no dead zone. */
-	pio_write_32(&timer->tcfg0, 7); /* prescale 1/8 */
-
-	/* No DMA request, divider value = 2 for all timers. */
-	pio_write_32(&timer->tcfg1, 0);
-
-	/* Stop all timers. */
-	pio_write_32(&timer->tcon, 0);
-
-	/* Start counting from 64k-1. Compare value is irrelevant. */
-	pio_write_32(&timer->timer[0].cntb, 62500);
-	pio_write_32(&timer->timer[0].cmpb, 0);
-
-	/* Enable interrupts from timer0 */
-	s3c24xx_irqc_src_enable(&gta02_irqc, S3C24XX_INT_TIMER0);
-
-	/* Load data from tcntb0/tcmpb0 into tcnt0/tcmp0. */
-	pio_write_32(&timer->tcon, TCON_T0_AUTO_RLD | TCON_T0_MUPDATE);
-
-	/* Start timer 0. Inverter is off. */
-	pio_write_32(&timer->tcon, TCON_T0_AUTO_RLD | TCON_T0_START);
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mach/integratorcp/integratorcp.c
===================================================================
--- kernel/arch/arm32/src/mach/integratorcp/integratorcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,369 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_integratorcp
- * @{
- */
-/** @file
- *  @brief ICP drivers.
- */
-
-#include <interrupt.h>
-#include <ipc/irq.h>
-#include <console/chardev.h>
-#include <genarch/drivers/pl011/pl011.h>
-#include <genarch/drivers/pl050/pl050.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/srln/srln.h>
-#include <console/console.h>
-#include <stdbool.h>
-#include <sysinfo/sysinfo.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/km.h>
-#include <arch/mm/frame.h>
-#include <arch/mach/integratorcp/integratorcp.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <ddi/ddi.h>
-#include <log.h>
-#include <stdlib.h>
-
-#define SDRAM_SIZE \
-	sdram[(*(uint32_t *) (ICP_CMCR + ICP_SDRAMCR_OFFSET) & ICP_SDRAM_MASK) >> 2]
-
-static struct {
-	icp_hw_map_t hw_map;
-	irq_t timer_irq;
-	pl011_uart_t uart;
-} icp;
-
-struct arm_machine_ops icp_machine_ops = {
-	icp_init,
-	icp_timer_irq_start,
-	icp_cpu_halt,
-	icp_get_memory_extents,
-	icp_irq_exception,
-	icp_frame_init,
-	icp_output_init,
-	icp_input_init,
-	icp_get_irq_count,
-	icp_get_platform_name
-};
-
-static bool hw_map_init_called = false;
-uint32_t sdram[8] = {
-	16777216,	/* 16mb */
-	33554432,	/* 32mb */
-	67108864,	/* 64mb */
-	134217728,	/* 128mb */
-	268435456,	/* 256mb */
-	0,		/* Reserved */
-	0,		/* Reserved */
-	0		/* Reserved */
-};
-
-void icp_vga_init(void);
-
-/** Initializes the vga
- *
- */
-void icp_vga_init(void)
-{
-	*(uint32_t *) ((char *)(icp.hw_map.cmcr) + 0x14) = 0xA05F0000;
-	*(uint32_t *) ((char *)(icp.hw_map.cmcr) + 0x1C) = 0x12C11000;
-	*(uint32_t *) icp.hw_map.vga = 0x3F1F3F9C;
-	*(uint32_t *) ((char *)(icp.hw_map.vga) + 0x4) = 0x080B61DF;
-	*(uint32_t *) ((char *)(icp.hw_map.vga) + 0x8) = 0x067F3800;
-	*(uint32_t *) ((char *)(icp.hw_map.vga) + 0x10) = ICP_FB;
-	*(uint32_t *) ((char *)(icp.hw_map.vga) + 0x1C) = 0x182B;
-	*(uint32_t *) ((char *)(icp.hw_map.cmcr) + 0xC) = 0x33805000;
-
-}
-
-/** Returns the mask of active interrupts. */
-static inline uint32_t icp_irqc_get_sources(void)
-{
-	return *((uint32_t *) icp.hw_map.irqc);
-}
-
-/** Masks interrupt.
- *
- * @param irq interrupt number
- */
-static inline void icp_irqc_mask(uint32_t irq)
-{
-	*((uint32_t *) icp.hw_map.irqc_mask) = (1 << irq);
-}
-
-/** Unmasks interrupt.
- *
- * @param irq interrupt number
- */
-static inline void icp_irqc_unmask(uint32_t irq)
-{
-	*((uint32_t *) icp.hw_map.irqc_unmask) |= (1 << irq);
-}
-
-/** Initializes icp.hw_map. */
-void icp_init(void)
-{
-	icp.hw_map.uart = km_map(ICP_UART, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	icp.hw_map.kbd_ctrl = km_map(ICP_KBD, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_NOT_CACHEABLE);
-	icp.hw_map.kbd_stat = icp.hw_map.kbd_ctrl + ICP_KBD_STAT;
-	icp.hw_map.kbd_data = icp.hw_map.kbd_ctrl + ICP_KBD_DATA;
-	icp.hw_map.kbd_intstat = icp.hw_map.kbd_ctrl + ICP_KBD_INTR_STAT;
-	icp.hw_map.rtc = km_map(ICP_RTC, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	icp.hw_map.rtc1_load = icp.hw_map.rtc + ICP_RTC1_LOAD_OFFSET;
-	icp.hw_map.rtc1_read = icp.hw_map.rtc + ICP_RTC1_READ_OFFSET;
-	icp.hw_map.rtc1_ctl = icp.hw_map.rtc + ICP_RTC1_CTL_OFFSET;
-	icp.hw_map.rtc1_intrclr = icp.hw_map.rtc + ICP_RTC1_INTRCLR_OFFSET;
-	icp.hw_map.rtc1_bgload = icp.hw_map.rtc + ICP_RTC1_BGLOAD_OFFSET;
-	icp.hw_map.rtc1_intrstat = icp.hw_map.rtc + ICP_RTC1_INTRSTAT_OFFSET;
-
-	icp.hw_map.irqc = km_map(ICP_IRQC, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	icp.hw_map.irqc_mask = icp.hw_map.irqc + ICP_IRQC_MASK_OFFSET;
-	icp.hw_map.irqc_unmask = icp.hw_map.irqc + ICP_IRQC_UNMASK_OFFSET;
-	icp.hw_map.cmcr = km_map(ICP_CMCR, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	icp.hw_map.sdramcr = icp.hw_map.cmcr + ICP_SDRAMCR_OFFSET;
-	icp.hw_map.vga = km_map(ICP_VGA, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-	hw_map_init_called = true;
-}
-
-/** Starts icp Real Time Clock device, which asserts regular interrupts.
- *
- * @param frequency Interrupts frequency (0 disables RTC).
- */
-static void icp_timer_start(uint32_t frequency)
-{
-	icp_irqc_mask(ICP_TIMER_IRQ);
-	*((uint32_t *) icp.hw_map.rtc1_load) = frequency;
-	*((uint32_t *) icp.hw_map.rtc1_bgload) = frequency;
-	*((uint32_t *) icp.hw_map.rtc1_ctl) = ICP_RTC_CTL_VALUE;
-	icp_irqc_unmask(ICP_TIMER_IRQ);
-}
-
-static irq_ownership_t icp_timer_claim(irq_t *irq)
-{
-	if (icp.hw_map.rtc1_intrstat) {
-		*((uint32_t *) icp.hw_map.rtc1_intrclr) = 1;
-		return IRQ_ACCEPT;
-	} else
-		return IRQ_DECLINE;
-}
-
-/** Timer interrupt handler.
- *
- * @param irq Interrupt information.
- * @param arg Not used.
- */
-static void icp_timer_irq_handler(irq_t *irq)
-{
-	/*
-	 * We are holding a lock which prevents preemption.
-	 * Release the lock, call clock() and reacquire the lock again.
-	 */
-
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-
-}
-
-/** Initializes and registers timer interrupt handler. */
-static void icp_timer_irq_init(void)
-{
-	irq_initialize(&icp.timer_irq);
-	icp.timer_irq.inr = ICP_TIMER_IRQ;
-	icp.timer_irq.claim = icp_timer_claim;
-	icp.timer_irq.handler = icp_timer_irq_handler;
-
-	irq_register(&icp.timer_irq);
-}
-
-/** Starts timer.
- *
- * Initiates regular timer interrupts after initializing
- * corresponding interrupt handler.
- */
-void icp_timer_irq_start(void)
-{
-	icp_timer_irq_init();
-	icp_timer_start(ICP_TIMER_FREQ);
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address.
- * @param size		Place to store memory size.
- */
-void icp_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	*start = 0;
-
-	if (hw_map_init_called) {
-		*size = sdram[(*(uint32_t *) icp.hw_map.sdramcr &
-		    ICP_SDRAM_MASK) >> 2];
-	} else {
-		*size = SDRAM_SIZE;
-	}
-}
-
-/** Stops icp. */
-void icp_cpu_halt(void)
-{
-	while (true)
-		;
-}
-
-/** interrupt exception handler.
- *
- * Determines sources of the interrupt from interrupt controller and
- * calls high-level handlers for them.
- *
- * @param exc_no Interrupt exception number.
- * @param istate Saved processor state.
- */
-void icp_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	uint32_t sources = icp_irqc_get_sources();
-	unsigned int i;
-
-	for (i = 0; i < ICP_IRQC_MAX_IRQ; i++) {
-		if (sources & (1 << i)) {
-			irq_t *irq = irq_dispatch_and_lock(i);
-			if (irq) {
-				/* The IRQ handler was found. */
-				irq->handler(irq);
-				irq_spinlock_unlock(&irq->lock, false);
-			} else {
-				/* Spurious interrupt. */
-				log(LF_ARCH, LVL_DEBUG,
-				    "cpu%d: spurious interrupt (inum=%d)",
-				    CPU->id, i);
-			}
-		}
-	}
-}
-
-/*
- * Integrator specific frame initialization
- */
-void
-icp_frame_init(void)
-{
-	frame_mark_unavailable(ICP_FB_FRAME, ICP_FB_NUM_FRAME);
-	frame_mark_unavailable(0, 256);
-}
-
-void icp_output_init(void)
-{
-#ifdef CONFIG_FB
-	static bool vga_init = false;
-	if (!vga_init) {
-		icp_vga_init();
-		vga_init = true;
-	}
-
-	fb_properties_t prop = {
-		.addr = ICP_FB,
-		.offset = 0,
-		.x = 640,
-		.y = 480,
-		.scan = 2560,
-		.visual = VISUAL_RGB_8_8_8_0,
-	};
-
-	outdev_t *fbdev = fb_init(&prop);
-	if (fbdev)
-		stdout_wire(fbdev);
-#endif
-#ifdef CONFIG_PL011_UART
-	if (pl011_uart_init(&icp.uart, ICP_UART0_IRQ, ICP_UART))
-		stdout_wire(&icp.uart.outdev);
-#endif
-}
-
-void icp_input_init(void)
-{
-
-	pl050_t *pl050 = malloc(sizeof(pl050_t));
-	pl050->status = (ioport8_t *) icp.hw_map.kbd_stat;
-	pl050->data = (ioport8_t *) icp.hw_map.kbd_data;
-	pl050->ctrl = (ioport8_t *) icp.hw_map.kbd_ctrl;
-
-	pl050_instance_t *pl050_instance = pl050_init(pl050, ICP_KBD_IRQ);
-	if (pl050_instance) {
-		kbrd_instance_t *kbrd_instance = kbrd_init();
-		if (kbrd_instance) {
-			icp_irqc_mask(ICP_KBD_IRQ);
-			indev_t *sink = stdin_wire();
-			indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-			pl050_wire(pl050_instance, kbrd);
-			icp_irqc_unmask(ICP_KBD_IRQ);
-		}
-	}
-
-	/*
-	 * This is the necessary evil until the userspace driver is entirely
-	 * self-sufficient.
-	 */
-	sysinfo_set_item_val("kbd", NULL, true);
-	sysinfo_set_item_val("kbd.inr", NULL, ICP_KBD_IRQ);
-	sysinfo_set_item_val("kbd.address.physical", NULL, ICP_KBD);
-
-#ifdef CONFIG_PL011_UART
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance) {
-		indev_t *sink = stdin_wire();
-		indev_t *srln = srln_wire(srln_instance, sink);
-		pl011_uart_input_wire(&icp.uart, srln);
-		icp_irqc_unmask(ICP_UART0_IRQ);
-	}
-#endif
-}
-
-size_t icp_get_irq_count(void)
-{
-	return ICP_IRQ_COUNT;
-}
-
-const char *icp_get_platform_name(void)
-{
-	return "integratorcp";
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mach/raspberrypi/raspberrypi.c
===================================================================
--- kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,221 +1,0 @@
-/*
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_raspberrypi
- * @{
- */
-/** @file
- *  @brief Raspberry PI platform driver.
- */
-
-#include <arch/exception.h>
-#include <arch/mach/raspberrypi/raspberrypi.h>
-#include <assert.h>
-#include <genarch/drivers/pl011/pl011.h>
-#include <genarch/drivers/bcm2835/irc.h>
-#include <genarch/drivers/bcm2835/timer.h>
-#include <genarch/drivers/bcm2835/mbox.h>
-#include <arch/mm/page.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <genarch/srln/srln.h>
-#include <stdbool.h>
-#include <sysinfo/sysinfo.h>
-#include <interrupt.h>
-#include <ddi/ddi.h>
-
-#define RPI_DEFAULT_MEMORY_START	0
-#define RPI_DEFAULT_MEMORY_SIZE		0x08000000
-#define RPI_MEMORY_SKIP			0x8000
-
-static void raspberrypi_init(void);
-static void raspberrypi_timer_irq_start(void);
-static void raspberrypi_cpu_halt(void);
-static void raspberrypi_get_memory_extents(uintptr_t *start, size_t *size);
-static void raspberrypi_irq_exception(unsigned int exc_no, istate_t *istate);
-static void raspberrypi_frame_init(void);
-static void raspberrypi_output_init(void);
-static void raspberrypi_input_init(void);
-static size_t raspberrypi_get_irq_count(void);
-static const char *raspberrypi_get_platform_name(void);
-
-static struct {
-	pl011_uart_t	uart;
-	bcm2835_irc_t	*irc;
-	bcm2835_timer_t	*timer;
-} raspi;
-
-struct arm_machine_ops raspberrypi_machine_ops = {
-	raspberrypi_init,
-	raspberrypi_timer_irq_start,
-	raspberrypi_cpu_halt,
-	raspberrypi_get_memory_extents,
-	raspberrypi_irq_exception,
-	raspberrypi_frame_init,
-	raspberrypi_output_init,
-	raspberrypi_input_init,
-	raspberrypi_get_irq_count,
-	raspberrypi_get_platform_name
-};
-
-static irq_ownership_t raspberrypi_timer_irq_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void raspberrypi_timer_irq_handler(irq_t *irq)
-{
-	bcm2835_timer_irq_ack(raspi.timer);
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-static void raspberrypi_init(void)
-{
-	/* Initialize interrupt controller */
-	raspi.irc = (void *) km_map(BCM2835_IRC_ADDR, sizeof(bcm2835_irc_t),
-	    KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-	assert(raspi.irc);
-	bcm2835_irc_init(raspi.irc);
-
-	/* Initialize system timer */
-	raspi.timer = (void *) km_map(BCM2835_TIMER_ADDR,
-	    sizeof(bcm2835_timer_t), KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-}
-
-static void raspberrypi_timer_irq_start(void)
-{
-	/* Initialize timer IRQ */
-	static irq_t timer_irq;
-	irq_initialize(&timer_irq);
-	timer_irq.inr = BCM2835_TIMER1_IRQ;
-	timer_irq.claim = raspberrypi_timer_irq_claim;
-	timer_irq.handler = raspberrypi_timer_irq_handler;
-	irq_register(&timer_irq);
-
-	bcm2835_irc_enable(raspi.irc, BCM2835_TIMER1_IRQ);
-	bcm2835_timer_start(raspi.timer);
-}
-
-static void raspberrypi_cpu_halt(void)
-{
-	while (true)
-		;
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address (physical).
- * @param size		Place to store memory size.
- */
-static void raspberrypi_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	uint32_t mbase, msize;
-
-	if (bcm2835_prop_get_memory(&mbase, &msize)) {
-		*start = mbase + RPI_MEMORY_SKIP;
-		*size  = msize - RPI_MEMORY_SKIP;
-	} else {
-		/* Stick to safe default values */
-		*start = RPI_DEFAULT_MEMORY_START + RPI_MEMORY_SKIP;
-		*size  = RPI_DEFAULT_MEMORY_SIZE - RPI_MEMORY_SKIP;
-	}
-}
-
-static void raspberrypi_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	const unsigned inum = bcm2835_irc_inum_get(raspi.irc);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		/* Spurious interrupt. */
-		printf("cpu%d: spurious interrupt (inum=%d)\n", CPU->id, inum);
-		bcm2835_irc_disable(raspi.irc, inum);
-	}
-}
-
-static void raspberrypi_frame_init(void)
-{
-}
-
-static void raspberrypi_output_init(void)
-{
-#ifdef CONFIG_FB
-	uint32_t width, height;
-	fb_properties_t prop;
-
-	if (!bcm2835_mbox_get_fb_size(&width, &height)) {
-		printf("mbox: could not get the framebuffer size\n");
-		width = 640;
-		height = 480;
-	}
-	if (bcm2835_fb_init(&prop, width, height)) {
-		outdev_t *fb_dev = fb_init(&prop);
-		if (fb_dev)
-			stdout_wire(fb_dev);
-	}
-#endif
-
-#ifdef CONFIG_PL011_UART
-	if (pl011_uart_init(&raspi.uart, BCM2835_UART_IRQ,
-	    BCM2835_UART0_BASE_ADDRESS))
-		stdout_wire(&raspi.uart.outdev);
-#endif
-}
-
-static void raspberrypi_input_init(void)
-{
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance) {
-		indev_t *sink = stdin_wire();
-		indev_t *srln = srln_wire(srln_instance, sink);
-
-		pl011_uart_input_wire(&raspi.uart, srln);
-		bcm2835_irc_enable(raspi.irc, BCM2835_UART_IRQ);
-	}
-}
-
-size_t raspberrypi_get_irq_count(void)
-{
-	return BCM2835_IRQ_COUNT;
-}
-
-const char *raspberrypi_get_platform_name(void)
-{
-	return "raspberrypi";
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/machine_func.c
===================================================================
--- kernel/arch/arm32/src/machine_func.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Definitions of machine specific functions.
- *
- *  These functions enable to differentiate more kinds of ARM emulators
- *  or CPUs. It's the same concept as "arch" functions on the architecture
- *  level.
- */
-
-#include <arch/machine_func.h>
-#include <arch/mach/gta02/gta02.h>
-#include <arch/mach/integratorcp/integratorcp.h>
-#include <arch/mach/beagleboardxm/beagleboardxm.h>
-#include <arch/mach/beaglebone/beaglebone.h>
-#include <arch/mach/raspberrypi/raspberrypi.h>
-
-/** Pointer to machine_ops structure being used. */
-struct arm_machine_ops *machine_ops;
-
-/** Initialize machine_ops pointer. */
-void machine_ops_init(void)
-{
-#if defined(MACHINE_gta02)
-	machine_ops = &gta02_machine_ops;
-#elif defined(MACHINE_integratorcp)
-	machine_ops = &icp_machine_ops;
-#elif defined(MACHINE_beagleboardxm)
-	machine_ops = &bbxm_machine_ops;
-#elif defined(MACHINE_beaglebone)
-	machine_ops = &bbone_machine_ops;
-#elif defined(MACHINE_raspberrypi)
-	machine_ops = &raspberrypi_machine_ops;
-#else
-#error Machine type not defined.
-#endif
-}
-
-/** Maps HW devices to the kernel address space using #hw_map. */
-void machine_init(void)
-{
-	(machine_ops->machine_init)();
-}
-
-/** Starts timer. */
-void machine_timer_irq_start(void)
-{
-	(machine_ops->machine_timer_irq_start)();
-}
-
-/** Halts CPU. */
-void machine_cpu_halt(void)
-{
-	(machine_ops->machine_cpu_halt)();
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address.
- * @param size		Place to store memory size.
- */
-void machine_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	(machine_ops->machine_get_memory_extents)(start, size);
-}
-
-/** Interrupt exception handler.
- *
- * @param exc_no Interrupt exception number.
- * @param istate Saved processor state.
- */
-void machine_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	(machine_ops->machine_irq_exception)(exc_no, istate);
-}
-
-/*
- * Machine specific frame initialization
- */
-void machine_frame_init(void)
-{
-	(machine_ops->machine_frame_init)();
-}
-
-/*
- * configure the output device.
- */
-void machine_output_init(void)
-{
-	(machine_ops->machine_output_init)();
-}
-
-/*
- * configure the input device.
- */
-void machine_input_init(void)
-{
-	(machine_ops->machine_input_init)();
-}
-
-/** Get IRQ number range used by machine. */
-size_t machine_get_irq_count(void)
-{
-	return (machine_ops->machine_get_irq_count)();
-}
-
-const char *machine_get_platform_name(void)
-{
-	if (machine_ops->machine_get_platform_name)
-		return machine_ops->machine_get_platform_name();
-	return NULL;
-}
-/** @}
- */
Index: rnel/arch/arm32/src/mm/as.c
===================================================================
--- kernel/arch/arm32/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Address space functions.
- */
-
-#include <arch/mm/as.h>
-#include <genarch/mm/as_pt.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/asid_fifo.h>
-#include <mm/as.h>
-#include <mm/tlb.h>
-#include <arch.h>
-
-/** Architecture dependent address space init.
- *
- *  Since ARM supports page tables, #as_pt_operations are used.
- */
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-}
-
-void as_install_arch(as_t *as)
-{
-	tlb_invalidate_all();
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mm/frame.c
===================================================================
--- kernel/arch/arm32/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Frame related functions.
- */
-
-#include <mm/frame.h>
-#include <arch/mm/frame.h>
-#include <arch/machine_func.h>
-#include <config.h>
-#include <align.h>
-#include <macros.h>
-
-static void frame_common_arch_init(bool low)
-{
-	uintptr_t base;
-	size_t size;
-
-	machine_get_memory_extents(&base, &size);
-	base = ALIGN_UP(base, FRAME_SIZE);
-	size = ALIGN_DOWN(size, FRAME_SIZE);
-
-	if (!frame_adjust_zone_bounds(low, &base, &size))
-		return;
-
-	if (low) {
-		zone_create(ADDR2PFN(base), SIZE2FRAMES(size),
-		    BOOT_PAGE_TABLE_START_FRAME +
-		    BOOT_PAGE_TABLE_SIZE_IN_FRAMES,
-		    ZONE_AVAILABLE | ZONE_LOWMEM);
-	} else {
-		pfn_t conf = zone_external_conf_alloc(SIZE2FRAMES(size));
-		if (conf != 0)
-			zone_create(ADDR2PFN(base), SIZE2FRAMES(size), conf,
-			    ZONE_AVAILABLE | ZONE_HIGHMEM);
-	}
-
-}
-
-/** Create low memory zones. */
-void frame_low_arch_init(void)
-{
-	frame_common_arch_init(true);
-
-	/* blacklist boot page table */
-	frame_mark_unavailable(BOOT_PAGE_TABLE_START_FRAME,
-	    BOOT_PAGE_TABLE_SIZE_IN_FRAMES);
-
-	machine_frame_init();
-}
-
-/** Create high memory zones. */
-void frame_high_arch_init(void)
-{
-	frame_common_arch_init(false);
-}
-
-/** Frees the boot page table. */
-void boot_page_table_free(void)
-{
-	frame_free(BOOT_PAGE_TABLE_ADDRESS,
-	    BOOT_PAGE_TABLE_SIZE_IN_FRAMES);
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mm/km.c
===================================================================
--- kernel/arch/arm32/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <stdbool.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_ARM32_IDENTITY_START;
-	config.identity_size = KM_ARM32_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_ARM32_NON_IDENTITY_START,
-	    KM_ARM32_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_ARM32_NON_IDENTITY_START,
-	    KM_ARM32_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mm/page.c
===================================================================
--- kernel/arch/arm32/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Paging related functions.
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/page.h>
-#include <arch/mm/frame.h>
-#include <align.h>
-#include <config.h>
-#include <arch/exception.h>
-#include <typedefs.h>
-#include <interrupt.h>
-#include <macros.h>
-
-/** Initializes page tables.
- *
- * 1:1 virtual-physical mapping is created in kernel address space. Mapping
- * for table with exception vectors is also created.
- */
-void page_arch_init(void)
-{
-	int flags = PAGE_CACHEABLE | PAGE_EXEC;
-	page_mapping_operations = &pt_mapping_operations;
-
-	page_table_lock(AS_KERNEL, true);
-
-	/* Kernel identity mapping */
-	//FIXME: We need to consider the possibility that
-	//identity_base > identity_size and physmem_end.
-	//This might lead to overflow if identity_size is too big.
-	for (uintptr_t cur = PHYSMEM_START_ADDR;
-	    cur < min(KA2PA(config.identity_base) +
-	    config.identity_size, config.physmem_end);
-	    cur += FRAME_SIZE)
-		page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
-
-#ifdef HIGH_EXCEPTION_VECTORS
-	/* Create mapping for exception table at high offset */
-	uintptr_t ev_frame = frame_alloc(1, FRAME_HIGHMEM, 0);
-	page_mapping_insert(AS_KERNEL, EXC_BASE_ADDRESS, ev_frame, flags);
-#else
-#error "Only high exception vector supported now"
-#endif
-
-	page_table_unlock(AS_KERNEL, true);
-
-	as_switch(NULL, AS_KERNEL);
-
-	boot_page_table_free();
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mm/page_fault.c
===================================================================
--- kernel/arch/arm32/src/mm/page_fault.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,260 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik, Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief Page fault related functions.
- */
-#include <panic.h>
-#include <arch/cp15.h>
-#include <arch/exception.h>
-#include <arch/mm/page_fault.h>
-#include <mm/as.h>
-#include <genarch/mm/page_pt.h>
-#include <arch.h>
-#include <interrupt.h>
-
-/**
- * FSR encoding ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition.
- *
- * B3.13.3 page B3-1406 (PDF page 1406)
- */
-typedef enum {
-	DFSR_SOURCE_ALIGN = 0x0001,
-	DFSR_SOURCE_CACHE_MAINTENANCE = 0x0004,
-	DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L1 = 0x000c,
-	DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L2 = 0x000e,
-	DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L1 = 0x040c,
-	DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L2 = 0x040e,
-	DFSR_SOURCE_TRANSLATION_L1 = 0x0005,
-	DFSR_SOURCE_TRANSLATION_L2 = 0x0007,
-	DFSR_SOURCE_ACCESS_FLAG_L1 = 0x0003,  /**< @note: This used to be alignment enc. */
-	DFSR_SOURCE_ACCESS_FLAG_L2 = 0x0006,
-	DFSR_SOURCE_DOMAIN_L1 = 0x0009,
-	DFSR_SOURCE_DOMAIN_L2 = 0x000b,
-	DFSR_SOURCE_PERMISSION_L1 = 0x000d,
-	DFSR_SOURCE_PERMISSION_L2 = 0x000f,
-	DFSR_SOURCE_DEBUG = 0x0002,
-	DFSR_SOURCE_SYNC_EXTERNAL = 0x0008,
-	DFSR_SOURCE_TLB_CONFLICT = 0x0400,
-	DFSR_SOURCE_LOCKDOWN = 0x0404, /**< @note: Implementation defined */
-	DFSR_SOURCE_COPROCESSOR = 0x040a, /**< @note Implementation defined */
-	DFSR_SOURCE_SYNC_PARITY = 0x0409,
-	DFSR_SOURCE_ASYNC_EXTERNAL = 0x0406,
-	DFSR_SOURCE_ASYNC_PARITY = 0x0408,
-	DFSR_SOURCE_MASK = 0x0000040f,
-} dfsr_source_t;
-
-static inline const char *dfsr_source_to_str(dfsr_source_t source)
-{
-	switch (source)	{
-	case DFSR_SOURCE_TRANSLATION_L1:
-		return "Translation fault L1";
-	case DFSR_SOURCE_TRANSLATION_L2:
-		return "Translation fault L2";
-	case DFSR_SOURCE_PERMISSION_L1:
-		return "Permission fault L1";
-	case DFSR_SOURCE_PERMISSION_L2:
-		return "Permission fault L2";
-	case DFSR_SOURCE_ALIGN:
-		return "Alignment fault";
-	case DFSR_SOURCE_CACHE_MAINTENANCE:
-		return "Instruction cache maintenance fault";
-	case DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L1:
-		return "Synchronous external abort on translation table walk level 1";
-	case DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L2:
-		return "Synchronous external abort on translation table walk level 2";
-	case DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L1:
-		return "Synchronous parity error on translation table walk level 1";
-	case DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L2:
-		return "Synchronous parity error on translation table walk level 2";
-	case DFSR_SOURCE_ACCESS_FLAG_L1:
-		return "Access flag fault L1";
-	case DFSR_SOURCE_ACCESS_FLAG_L2:
-		return "Access flag fault L2";
-	case DFSR_SOURCE_DOMAIN_L1:
-		return "Domain fault L1";
-	case DFSR_SOURCE_DOMAIN_L2:
-		return "Domain flault L2";
-	case DFSR_SOURCE_DEBUG:
-		return "Debug event";
-	case DFSR_SOURCE_SYNC_EXTERNAL:
-		return "Synchronous external abort";
-	case DFSR_SOURCE_TLB_CONFLICT:
-		return "TLB conflict abort";
-	case DFSR_SOURCE_LOCKDOWN:
-		return "Lockdown (Implementation defined)";
-	case DFSR_SOURCE_COPROCESSOR:
-		return "Coprocessor abort (Implementation defined)";
-	case DFSR_SOURCE_SYNC_PARITY:
-		return "Synchronous parity error on memory access";
-	case DFSR_SOURCE_ASYNC_EXTERNAL:
-		return "Asynchronous external abort";
-	case DFSR_SOURCE_ASYNC_PARITY:
-		return "Asynchronous parity error on memory access";
-	case DFSR_SOURCE_MASK:
-		break;
-	}
-	return "Unknown data abort";
-}
-
-#if defined(PROCESSOR_ARCH_armv4) | defined(PROCESSOR_ARCH_armv5)
-/** Decides whether read or write into memory is requested.
- *
- * @param instr_addr   Address of instruction which tries to access memory.
- * @param badvaddr     Virtual address the instruction tries to access.
- *
- * @return Type of access into memory, PF_ACCESS_EXEC if no memory access is
- *	   requested.
- */
-static pf_access_t get_memory_access_type(uint32_t instr_addr,
-    uintptr_t badvaddr)
-{
-	instruction_union_t instr_union;
-	instr_union.pc = instr_addr;
-
-	instruction_t instr = *(instr_union.instr);
-
-	/* undefined instructions */
-	if (instr.condition == 0xf) {
-		panic("page_fault - instruction does not access memory "
-		    "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
-		    *(uint32_t *)instr_union.instr, (void *) badvaddr);
-		return PF_ACCESS_EXEC;
-	}
-
-	/*
-	 * See ARM Architecture reference manual ARMv7-A and ARMV7-R edition
-	 * A5.3 (PDF p. 206)
-	 */
-	static const struct {
-		uint32_t mask;
-		uint32_t value;
-		pf_access_t access;
-	} ls_inst[] = {
-		/* Store word/byte */
-		{ 0x0e100000, 0x04000000, PF_ACCESS_WRITE }, /* STR(B) imm */
-		{ 0x0e100010, 0x06000000, PF_ACCESS_WRITE }, /* STR(B) reg */
-		/* Load word/byte */
-		{ 0x0e100000, 0x04100000, PF_ACCESS_READ }, /* LDR(B) imm */
-		{ 0x0e100010, 0x06100000, PF_ACCESS_READ }, /* LDR(B) reg */
-		/* Store half-word/dual  A5.2.8 */
-		{ 0x0e1000b0, 0x000000b0, PF_ACCESS_WRITE }, /* STRH imm reg */
-		/* Load half-word/dual A5.2.8 */
-		{ 0x0e0000f0, 0x000000d0, PF_ACCESS_READ }, /* LDRH imm reg */
-		{ 0x0e1000b0, 0x001000b0, PF_ACCESS_READ }, /* LDRH imm reg */
-		/* Block data transfer, Store */
-		{ 0x0e100000, 0x08000000, PF_ACCESS_WRITE }, /* STM variants */
-		{ 0x0e100000, 0x08100000, PF_ACCESS_READ },  /* LDM variants */
-		/* Swap */
-		{ 0x0fb00000, 0x01000000, PF_ACCESS_WRITE },
-	};
-	const uint32_t inst = *(uint32_t *)instr_addr;
-	for (unsigned i = 0; i < sizeof(ls_inst) / sizeof(ls_inst[0]); ++i) {
-		if ((inst & ls_inst[i].mask) == ls_inst[i].value) {
-			return ls_inst[i].access;
-		}
-	}
-
-	panic("page_fault - instruction doesn't access memory "
-	    "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
-	    inst, (void *) badvaddr);
-}
-#endif
-
-/** Handles "data abort" exception (load or store at invalid address).
- *
- * @param exc_no Exception number.
- * @param istate CPU state when exception occured.
- *
- */
-void data_abort(unsigned int exc_no, istate_t *istate)
-{
-	const uintptr_t badvaddr = DFAR_read();
-	const fault_status_t fsr = { .raw = DFSR_read() };
-	const dfsr_source_t source = fsr.raw & DFSR_SOURCE_MASK;
-
-	switch (source)	{
-	case DFSR_SOURCE_TRANSLATION_L1:
-	case DFSR_SOURCE_TRANSLATION_L2:
-	case DFSR_SOURCE_PERMISSION_L1:
-	case DFSR_SOURCE_PERMISSION_L2:
-		/* Page fault is handled further down */
-		break;
-	case DFSR_SOURCE_ALIGN:
-	case DFSR_SOURCE_CACHE_MAINTENANCE:
-	case DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L1:
-	case DFSR_SOURCE_SYNC_EXTERNAL_TRANSLATION_L2:
-	case DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L1:
-	case DFSR_SOURCE_SYNC_PARITY_TRANSLATION_L2:
-	case DFSR_SOURCE_ACCESS_FLAG_L1:
-	case DFSR_SOURCE_ACCESS_FLAG_L2:
-	case DFSR_SOURCE_DOMAIN_L1:
-	case DFSR_SOURCE_DOMAIN_L2:
-	case DFSR_SOURCE_DEBUG:
-	case DFSR_SOURCE_SYNC_EXTERNAL:
-	case DFSR_SOURCE_TLB_CONFLICT:
-	case DFSR_SOURCE_LOCKDOWN:
-	case DFSR_SOURCE_COPROCESSOR:
-	case DFSR_SOURCE_SYNC_PARITY:
-	case DFSR_SOURCE_ASYNC_EXTERNAL:
-	case DFSR_SOURCE_ASYNC_PARITY:
-	case DFSR_SOURCE_MASK:
-		/* Weird abort stuff */
-		fault_if_from_uspace(istate, "Unhandled abort %s at address: "
-		    "%#x.", dfsr_source_to_str(source), badvaddr);
-		panic("Unhandled abort %s at address: %#x.",
-		    dfsr_source_to_str(source), badvaddr);
-	}
-
-#if defined(PROCESSOR_ARCH_armv6) | defined(PROCESSOR_ARCH_armv7_a)
-	const pf_access_t access =
-	    fsr.data.wr ? PF_ACCESS_WRITE : PF_ACCESS_READ;
-#elif defined(PROCESSOR_ARCH_armv4) | defined(PROCESSOR_ARCH_armv5)
-	const pf_access_t access = get_memory_access_type(istate->pc, badvaddr);
-#else
-#error "Unsupported architecture"
-#endif
-	as_page_fault(badvaddr, access, istate);
-}
-
-/** Handles "prefetch abort" exception (instruction couldn't be executed).
- *
- * @param exc_no Exception number.
- * @param istate CPU state when exception occured.
- *
- */
-void prefetch_abort(unsigned int exc_no, istate_t *istate)
-{
-	as_page_fault(istate->pc, PF_ACCESS_EXEC, istate);
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/mm/tlb.c
===================================================================
--- kernel/arch/arm32/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32_mm
- * @{
- */
-/** @file
- *  @brief TLB related functions.
- */
-
-#include <mm/tlb.h>
-#include <arch/mm/asid.h>
-#include <arch/asm.h>
-#include <arch/cp15.h>
-#include <typedefs.h>
-#include <arch/mm/page.h>
-#include <arch/cache.h>
-#include <arch/barrier.h>
-
-/** Invalidate all entries in TLB.
- *
- * @note See ARM Architecture reference section 3.7.7 for details.
- */
-void tlb_invalidate_all(void)
-{
-	TLBIALL_write(0);
-	/*
-	 * "A TLB maintenance operation is only guaranteed to be complete after
-	 * the execution of a DSB instruction."
-	 * "An ISB instruction, or a return from an exception, causes the
-	 * effect of all completed TLB maintenance operations that appear in
-	 * program order before the ISB or return from exception to be visible
-	 * to all subsequent instructions, including the instruction fetches
-	 * for those instructions."
-	 * ARM Architecture reference Manual ch. B3.10.1 p. B3-1374 B3-1375
-	 */
-	dsb();
-	isb();
-}
-
-/** Invalidate all entries in TLB that belong to specified address space.
- *
- * @param asid Ignored as the ARM architecture doesn't support ASIDs.
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	tlb_invalidate_all();
-	// TODO: why not TLBIASID_write(asid) ?
-}
-
-/** Invalidate single entry in TLB
- *
- * @param page Virtual address of the page
- */
-static inline void invalidate_page(uintptr_t page)
-{
-#if defined(PROCESSOR_ARCH_armv6) || defined(PROCESSOR_ARCH_armv7_a)
-	if (TLBTR_read() & TLBTR_SEP_FLAG) {
-		ITLBIMVA_write(page);
-		DTLBIMVA_write(page);
-	} else {
-		TLBIMVA_write(page);
-	}
-#elif defined(PROCESSOR_arm920t)
-	ITLBIMVA_write(page);
-	DTLBIMVA_write(page);
-#elif defined(PROCESSOR_arm926ej_s)
-	TLBIMVA_write(page);
-#else
-#error Unknown TLB type
-#endif
-
-	/*
-	 * "A TLB maintenance operation is only guaranteed to be complete after
-	 * the execution of a DSB instruction."
-	 * "An ISB instruction, or a return from an exception, causes the
-	 * effect of all completed TLB maintenance operations that appear in
-	 * program order before the ISB or return from exception to be visible
-	 * to all subsequent instructions, including the instruction fetches
-	 * for those instructions."
-	 * ARM Architecture reference Manual ch. B3.10.1 p. B3-1374 B3-1375
-	 */
-	dsb();
-	isb();
-}
-
-/** Invalidate TLB entries for specified page range belonging to specified
- * address space.
- *
- * @param asid Ignored as the ARM architecture doesn't support it.
- * @param page Address of the first page whose entry is to be invalidated.
- * @param cnt Number of entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt)
-{
-	for (unsigned i = 0; i < cnt; i++)
-		invalidate_page(page + i * PAGE_SIZE);
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/ras.c
===================================================================
--- kernel/arch/arm32/src/ras.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Kernel part of Restartable Atomic Sequences support.
- */
-
-#include <arch/ras.h>
-#include <mm/mm.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <mm/tlb.h>
-#include <mm/asid.h>
-#include <interrupt.h>
-#include <arch/exception.h>
-#include <arch.h>
-#include <memw.h>
-#include <typedefs.h>
-
-uintptr_t *ras_page = NULL;
-
-void ras_init(void)
-{
-	uintptr_t frame = frame_alloc(1, FRAME_HIGHMEM, 0);
-
-	ras_page = (uintptr_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE);
-
-	memsetb(ras_page, PAGE_SIZE, 0);
-	ras_page[RAS_START] = 0;
-	ras_page[RAS_END] = 0xffffffff;
-}
-
-void ras_check(unsigned int n, istate_t *istate)
-{
-	bool restart_needed = false;
-	uintptr_t restart_pc = 0;
-
-	if (istate_from_uspace(istate)) {
-		if (ras_page[RAS_START]) {
-			if ((ras_page[RAS_START] < istate->pc) &&
-			    (ras_page[RAS_END] > istate->pc)) {
-				restart_needed = true;
-				restart_pc = ras_page[RAS_START];
-			}
-			ras_page[RAS_START] = 0;
-			ras_page[RAS_END] = 0xffffffff;
-		}
-	}
-
-	exc_dispatch(n, istate);
-	if (restart_needed)
-		istate->pc = restart_pc;
-}
-
-/** @}
- */
Index: rnel/arch/arm32/src/smc.c
===================================================================
--- kernel/arch/arm32/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <align.h>
-#include <arch/cp15.h>
-#include <arch/cache.h>
-#include <arch/barrier.h>
-#include <barrier.h>
-
-/*
- * There are multiple ways ICache can be implemented on ARM machines. Namely
- * PIPT, VIPT, and ASID and VMID tagged VIVT (see ARM Architecture Reference
- * Manual B3.11.2 (p. 1383).  However, CortexA8 Manual states: "For maximum
- * compatibility across processors, ARM recommends that operating systems target
- * the ARMv7 base architecture that uses ASID-tagged VIVT instruction caches,
- * and do not assume the presence of the IVIPT extension. Software that relies
- * on the IVIPT extension might fail in an unpredictable way on an ARMv7
- * implementation that does not include the IVIPT extension." (7.2.6 p. 245).
- * Only PIPT invalidates cache for all VA aliases if one block is invalidated.
- *
- * @note: Supporting ASID and VMID tagged VIVT may need to add ICache
- * maintenance to other places than just smc.
- */
-
-// TODO: Determine CP15_C7_MVA_ALIGN dynamically
-
-void smc_coherence(void *a, size_t l)
-{
-	uintptr_t end = (uintptr_t) a + l;
-	uintptr_t begin = ALIGN_DOWN((uintptr_t) a, CP15_C7_MVA_ALIGN);
-
-	for (uintptr_t addr = begin; addr < end; addr += CP15_C7_MVA_ALIGN) {
-		dcache_clean_mva_pou(addr);
-	}
-
-	/* Wait for completion */
-	dsb();
-
-	icache_invalidate();
-	dsb();
-	/* Wait for Inst refetch */
-	isb();
-}
Index: rnel/arch/arm32/src/start.S
===================================================================
--- kernel/arch/arm32/src/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/boot.h>
-
-.text
-
-SYMBOL(kernel_image_start)
-	# initialize Stack pointer for exception modes
-	mrs r4, cpsr
-	bic r4, r4, #0x1f
-
-	#FIQ Mode
-	orr r3, r4, #0x11
-	msr cpsr_c, r3
-	ldr sp, =exc_stack
-
-	#IRQ Mode
-	orr r3, r4, #0x12
-	msr cpsr_c, r3
-	ldr sp, =exc_stack
-
-	#ABORT Mode
-	orr r3, r4, #0x17
-	msr cpsr_c, r3
-	ldr sp, =exc_stack
-
-	#UNDEFINED Mode
-	orr r3, r4, #0x1b
-	msr cpsr_c, r3
-	ldr sp, =exc_stack
-
-	# switch to supervisor mode
-	orr r3, r4, #0x13
-	msr cpsr_c, r3
-
-	ldr sp, =temp_stack
-
-	bl arm32_pre_main
-
-	#
-	# Create the first stack frame.
-	#
-	mov fp, #0
-	mov ip, sp
-	push {fp, ip, lr, pc}
-	sub fp, ip, #4
-
-	bl main_bsp
-
-	.space TEMP_STACK_SIZE
-temp_stack:
-
-	.space 1024
-SYMBOL(exc_stack)
-
-SYMBOL(supervisor_sp)
-	.space 4
Index: rnel/arch/arm32/src/userspace.c
===================================================================
--- kernel/arch/arm32/src/userspace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2007 Petr Stepan, Pavel Jancik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm32
- * @{
- */
-/** @file
- *  @brief Userspace switch.
- */
-
-#include <stdbool.h>
-#include <userspace.h>
-#include <arch/ras.h>
-
-/** Struct for holding all general purpose registers.
- *
- *  Used to set registers when going to userspace.
- */
-typedef struct {
-	uint32_t r0;
-	uint32_t r1;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t r11;
-	uint32_t r12;
-	uint32_t sp;
-	uint32_t lr;
-	uint32_t pc;
-} ustate_t;
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-/** Change processor mode
- *
- * @param kernel_uarg Userspace settings (entry point, stack, ...).
- *
- */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	volatile ustate_t ustate = { };
-
-	/* pass the RAS page address in %r2 */
-	ustate.r2 = (uintptr_t) ras_page;
-
-	ustate.sp = sp;
-	ustate.pc = pc;
-
-	/* status register in user mode */
-	ipl_t user_mode = current_status_reg_read() &
-	    (~STATUS_REG_MODE_MASK | USER_MODE);
-
-	/* set user mode, set registers, jump */
-	asm volatile (
-	    "mov sp, %[ustate]\n"
-	    "msr spsr_c, %[user_mode]\n"
-	    "ldmfd sp, {r0-r12, sp, lr}^\n"
-	    "nop\n"		/* Cannot access sp immediately after ldm(2) */
-	    "add sp, sp, #(15*4)\n"
-	    "ldmfd sp!, {pc}^\n"
-	    :: [ustate] "r" (&ustate), [user_mode] "r" (user_mode)
-	);
-
-	unreachable();
-}
-
-/** @}
- */
Index: rnel/arch/arm64/_link.ld.in
===================================================================
--- kernel/arch/arm64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * ARM64 linker script
- *
- *  kernel text
- *  kernel data
- *
- */
-
-#include <arch/boot/boot.h>
-#include <arch/mm/km.h>
-
-#define LOAD_ADDRESS_V  (KM_ARM64_IDENTITY_START + BOOT_OFFSET)
-#define LOAD_ADDRESS_P  BOOT_OFFSET
-
-OUTPUT_ARCH(aarch64)
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	kernel_load_address = LOAD_ADDRESS_V;
-
-	.text (LOAD_ADDRESS_V + SIZEOF_HEADERS) : AT (LOAD_ADDRESS_P + SIZEOF_HEADERS) {
-		. = ALIGN(16);
-		ktext_start = .;
-		KEEP(*(K_TEXT_START))
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		KEEP(*(K_DATA_START))
-		*(.rodata .rodata.*);
-		*(.data .data.*);                       /* initialized data */
-		*(.bss .bss.*);                        /* uninitialized static variables */
-		*(COMMON);                      /* global variables */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: rnel/arch/arm64/include/arch/arch.h
===================================================================
--- kernel/arch/arm64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Various ARM64-specific macros.
- */
-
-#ifndef KERN_arm64_ARCH_H_
-#define KERN_arm64_ARCH_H_
-
-#include <arch/boot/boot.h>
-
-extern void arm64_pre_main(void *entry, bootinfo_t *bootinfo);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/asm.h
===================================================================
--- kernel/arch/arm64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Declarations of functions implemented in assembly.
- */
-
-#ifndef KERN_arm64_ASM_H_
-#define KERN_arm64_ASM_H_
-
-#include <config.h>
-#include <trace.h>
-
-extern char exc_vector;
-
-/*
- * Note: Function asm_delay_loop() is defined in arm64.c but declared here
- * because the generic kernel code expects it in arch/asm.h.
- */
-extern void asm_delay_loop(uint32_t usec);
-
-/** CPU specific way to sleep cpu. */
-_NO_TRACE static inline void cpu_sleep(void)
-{
-	asm volatile ("wfe");
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this atomically
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-/** Halts CPU. */
-_NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
-{
-	while (true)
-		;
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-	asm volatile ("yield");
-}
-
-/** Output byte to port.
- *
- * @param port Port to write to.
- * @param val  Value to write.
- */
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
-{
-	*port = val;
-}
-
-/** Output half-word to port.
- *
- * @param port Port to write to.
- * @param val  Value to write.
- */
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
-{
-	*port = val;
-}
-
-/** Output word to port.
- *
- * @param port Port to write to.
- * @param val  Value to write.
- */
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
-{
-	*port = val;
-}
-
-/** Get byte from port.
- *
- * @param port Port to read from.
- * @return Value read.
- */
-_NO_TRACE static inline uint8_t pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-/** Get word from port.
- *
- * @param port Port to read from.
- * @return Value read.
- */
-_NO_TRACE static inline uint16_t pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-/** Get double word from port.
- *
- * @param port Port to read from.
- * @return Value read.
- */
-_NO_TRACE static inline uint32_t pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/barrier.h
===================================================================
--- kernel/arch/arm64/include/arch/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Memory barriers.
- */
-
-#ifndef KERN_arm64_BARRIER_H_
-#define KERN_arm64_BARRIER_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/boot/boot.h
===================================================================
--- kernel/arch/arm64/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Shared interface between the bootcode and the kernel.
- */
-
-#ifndef KERN_arm64_BOOT_H_
-#define KERN_arm64_BOOT_H_
-
-#define BOOT_OFFSET  0x80000
-
-#ifndef __ASSEMBLER__
-#include <stddef.h>
-
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-#define TASKMAP_MAX_RECORDS        32
-#define MEMMAP_MAX_RECORDS        128
-
-/** Task structure. */
-typedef struct {
-	/** Address where the task was placed. */
-	void *addr;
-	/** Size of the task's binary. */
-	size_t size;
-	/** Task name. */
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-/** Task map structure. */
-typedef struct {
-	/** Number of boot tasks. */
-	size_t cnt;
-	/** Boot task data. */
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-/** Memory zone types. */
-typedef enum {
-	/** Unusuable memory. */
-	MEMTYPE_UNUSABLE,
-	/** Usable memory. */
-	MEMTYPE_AVAILABLE,
-	/** Memory that can be used after ACPI is enabled. */
-	MEMTYPE_ACPI_RECLAIM
-} memtype_t;
-
-/** Memory area. */
-typedef struct {
-	/** Type of the memory. */
-	memtype_t type;
-	/** Address of the area. */
-	void *start;
-	/** Size of the area. */
-	size_t size;
-} memzone_t;
-
-/** System memory map. */
-typedef struct {
-	/** Number of memory zones. */
-	size_t cnt;
-	/** Memory zones. */
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-/** Bootinfo structure. */
-typedef struct {
-	/** Task map. */
-	taskmap_t taskmap;
-	/** Memory map. */
-	memmap_t memmap;
-} bootinfo_t;
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/context.h
===================================================================
--- kernel/arch/arm64/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Thread context.
- */
-
-#ifndef KERN_arm64_CONTEXT_H_
-#define KERN_arm64_CONTEXT_H_
-
-#include <align.h>
-#include <arch/context_struct.h>
-#include <arch/stack.h>
-
-/* Put one item onto the stack to support CURRENT and align it up. */
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = (uint64_t) (_pc); \
-		(c)->sp = ((uint64_t) (stack)) + (size) - SP_DELTA; \
-		/* Set frame pointer too. */ \
-		(c)->x29 = 0; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/context_struct.h
===================================================================
--- kernel/arch/arm64/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x08
-#define CONTEXT_OFFSET_X19  0x10
-#define CONTEXT_OFFSET_X20  0x18
-#define CONTEXT_OFFSET_X21  0x20
-#define CONTEXT_OFFSET_X22  0x28
-#define CONTEXT_OFFSET_X23  0x30
-#define CONTEXT_OFFSET_X24  0x38
-#define CONTEXT_OFFSET_X25  0x40
-#define CONTEXT_OFFSET_X26  0x48
-#define CONTEXT_OFFSET_X27  0x50
-#define CONTEXT_OFFSET_X28  0x58
-#define CONTEXT_OFFSET_X29  0x60
-#define CONTEXT_SIZE        0x68
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-/*
- * Thread context containing registers that must be preserved across function
- * calls.
- */
-typedef struct context {
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	uint64_t x29;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/arm64/include/arch/cpu.h
===================================================================
--- kernel/arch/arm64/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief CPU identification.
- */
-
-#ifndef KERN_arm64_CPU_H_
-#define KERN_arm64_CPU_H_
-
-/** Struct representing ARM CPU identification. */
-typedef struct {
-	/** Implementer (vendor) number. */
-	uint32_t implementer;
-
-	/** Variant number. */
-	uint32_t variant;
-
-	/** Primary part number. */
-	uint32_t partnum;
-
-	/** Revision number. */
-	uint32_t revision;
-} cpu_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/cycle.h
===================================================================
--- kernel/arch/arm64/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Information about a current cycle.
- */
-
-#ifndef KERN_arm64_CYCLE_H_
-#define KERN_arm64_CYCLE_H_
-
-#include <arch/asm.h>
-#include <trace.h>
-
-/** Get a current cycle.
- *
- * No instruction exists on ARM64 to get the actual CPU cycle. The function
- * instead returns the value of the virtual counter.
- */
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	return CNTVCT_EL0_read();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/exception.h
===================================================================
--- kernel/arch/arm64/include/arch/exception.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Exception declarations.
- */
-
-#ifndef KERN_arm64_EXCEPTION_H_
-#define KERN_arm64_EXCEPTION_H_
-
-/* Exception numbers. */
-
-/** Current Exception level with SP_EL0, Synchronous. */
-#define EXC_CURRENT_EL_SP_SEL0_SYNCH    0
-/** Current Exception level with SP_EL0, IRQ or vIRQ. */
-#define EXC_CURRENT_EL_SP_SEL0_IRQ      1
-/** Current Exception level with SP_EL0, FIQ or vFIQ. */
-#define EXC_CURRENT_EL_SP_SEL0_FIQ      2
-/** Current Exception level with SP_EL0, SError or vSError. */
-#define EXC_CURRENT_EL_SP_SEL0_SERROR   3
-/** Current Exception level with SP_ELx, x > 0, Synchronous. */
-#define EXC_CURRENT_EL_SP_SELX_SYNCH    4
-/** Current Exception level with SP_ELx, x > 0, IRQ or vIRQ. */
-#define EXC_CURRENT_EL_SP_SELX_IRQ      5
-/** Current Exception level with SP_ELx, x > 0, FIQ or vFIQ. */
-#define EXC_CURRENT_EL_SP_SELX_FIQ      6
-/** Current Exception level with SP_ELx, x > 0, SError or vSError. */
-#define EXC_CURRENT_EL_SP_SELX_SERROR   7
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch64, Synchronous.
- */
-#define EXC_LOWER_EL_AARCH64_SYNCH      8
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch64, IRQ or vIRQ.
- */
-#define EXC_LOWER_EL_AARCH64_IRQ        9
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch64, FIQ or vFIQ.
- */
-#define EXC_LOWER_EL_AARCH64_FIQ       10
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch64, SError or vSError.
- */
-#define EXC_LOWER_EL_AARCH64_SERROR    11
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch32, Synchronous.
- */
-#define EXC_LOWER_EL_AARCH32_SYNCH     12
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch32, IRQ or vIRQ.
- */
-#define EXC_LOWER_EL_AARCH32_IRQ       13
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch32, FIQ or vFIQ.
- */
-#define EXC_LOWER_EL_AARCH32_FIQ       14
-/** Lower Exception level, where the implemented level immediately lower than
- * the target level is using AArch32, SError or vSError.
- */
-#define EXC_LOWER_EL_AARCH32_SERROR    15
-
-#ifndef __ASSEMBLER__
-extern void exception_init(void);
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/faddr.h
===================================================================
--- kernel/arch/arm64/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Function address conversion.
- */
-
-#ifndef KERN_arm64_FADDR_H_
-#define KERN_arm64_FADDR_H_
-
-#include <typedefs.h>
-
-/** Calculate absolute address of function referenced by fptr pointer.
- *
- * @param fptr Function pointer.
- */
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/fpu_context.h
===================================================================
--- kernel/arch/arm64/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief FPU context.
- */
-
-#ifndef KERN_arm64_FPU_CONTEXT_H_
-#define KERN_arm64_FPU_CONTEXT_H_
-
-#include <arch/fpu_context_struct.h>
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/fpu_context_struct.h
===================================================================
--- kernel/arch/arm64/include/arch/fpu_context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-#define KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-
-#define FPU_CONTEXT_OFFSET_VREGS  0x000
-#define FPU_CONTEXT_OFFSET_FPCR   0x200
-#define FPU_CONTEXT_OFFSET_FPSR   0x204
-#define FPU_CONTEXT_SIZE          0x210
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-#include <_bits/int128_t.h>
-
-/** ARM64 FPU context. */
-typedef struct fpu_context {
-	_Alignas(16) uint128_t vregs[32];
-	uint32_t fpcr;
-	uint32_t fpsr;
-} fpu_context_t;
-
-#endif
-#endif
Index: rnel/arch/arm64/include/arch/interrupt.h
===================================================================
--- kernel/arch/arm64/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_interrupt
- * @{
- */
-/** @file
- * @brief Declarations of interrupt controlling routines.
- */
-
-#ifndef KERN_arm64_INTERRUPT_H_
-#define KERN_arm64_INTERRUPT_H_
-
-#include <arch/istate.h>
-#include <stdbool.h>
-#include <typedefs.h>
-
-/** Size of exception table. */
-#define IVT_ITEMS  16
-
-/** Index of the first item in exception table. */
-#define IVT_FIRST  0
-
-/* REVISIT */
-/* This needs to be defined for inter-architecture API portability. */
-#define VECTOR_TLB_SHOOTDOWN_IPI  0
-
-extern ipl_t interrupts_disable(void);
-extern ipl_t interrupts_enable(void);
-extern void interrupts_restore(ipl_t ipl);
-extern ipl_t interrupts_read(void);
-extern bool interrupts_disabled(void);
-extern void interrupt_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/istate.h
===================================================================
--- kernel/arch/arm64/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_interrupt
- * @{
- */
-
-#ifndef KERN_arm64_ISTATE_H_
-#define KERN_arm64_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/istate_struct.h>
-#include <arch/regutils.h>
-
-#else /* KERNEL */
-
-#include <libarch/istate_struct.h>
-#include <libarch/regutils.h>
-
-#endif /* KERNEL */
-
-/** Set Program Counter member of given istate structure.
- *
- * @param istate  istate structure
- * @param retaddr new value of istate's PC member
- */
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->pc = retaddr;
-}
-
-/** Return true if exception happened while in userspace. */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return (istate->spsr & SPSR_MODE_MASK) >> SPSR_MODE_SHIFT ==
-	    SPSR_MODE_ARM64_EL0T;
-}
-
-/** Return Program Counter member of given istate structure. */
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->pc;
-}
-
-/** Return Frame Pointer member of given istate structure. */
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	return istate->x29;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/arm64/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_SPSR   0x00
-#define ISTATE_OFFSET_SP     0x08
-#define ISTATE_OFFSET_PC     0x10
-#define ISTATE_OFFSET_TPIDR  0x18
-#define ISTATE_OFFSET_X0     0x20
-#define ISTATE_OFFSET_X1     0x28
-#define ISTATE_OFFSET_X2     0x30
-#define ISTATE_OFFSET_X3     0x38
-#define ISTATE_OFFSET_X4     0x40
-#define ISTATE_OFFSET_X5     0x48
-#define ISTATE_OFFSET_X6     0x50
-#define ISTATE_OFFSET_X7     0x58
-#define ISTATE_OFFSET_X8     0x60
-#define ISTATE_OFFSET_X9     0x68
-#define ISTATE_OFFSET_X10    0x70
-#define ISTATE_OFFSET_X11    0x78
-#define ISTATE_OFFSET_X12    0x80
-#define ISTATE_OFFSET_X13    0x88
-#define ISTATE_OFFSET_X14    0x90
-#define ISTATE_OFFSET_X15    0x98
-#define ISTATE_OFFSET_X16    0xa0
-#define ISTATE_OFFSET_X17    0xa8
-#define ISTATE_OFFSET_X18    0xb0
-#define ISTATE_OFFSET_X19    0xb8
-#define ISTATE_OFFSET_X20    0xc0
-#define ISTATE_OFFSET_X21    0xc8
-#define ISTATE_OFFSET_X22    0xd0
-#define ISTATE_OFFSET_X23    0xd8
-#define ISTATE_OFFSET_X24    0xe0
-#define ISTATE_OFFSET_X25    0xe8
-#define ISTATE_OFFSET_X26    0xf0
-#define ISTATE_OFFSET_X27    0xf8
-#define ISTATE_OFFSET_X28    0x100
-#define ISTATE_OFFSET_X29    0x108
-#define ISTATE_OFFSET_X30    0x110
-#define ISTATE_OFFSET_PAD0   0x118
-#define ISTATE_SIZE          0x120
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct istate {
-	uint64_t spsr;
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t tpidr;
-	uint64_t x0;
-	uint64_t x1;
-	uint64_t x2;
-	uint64_t x3;
-	uint64_t x4;
-	uint64_t x5;
-	uint64_t x6;
-	uint64_t x7;
-	uint64_t x8;
-	uint64_t x9;
-	uint64_t x10;
-	uint64_t x11;
-	uint64_t x12;
-	uint64_t x13;
-	uint64_t x14;
-	uint64_t x15;
-	uint64_t x16;
-	uint64_t x17;
-	uint64_t x18;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	/* Frame Pointer. */
-	uint64_t x29;
-	/* Link Register. */
-	uint64_t x30;
-
-	/*
-	 * ARM64 mandates that the stack pointer is always aligned to
-	 * a 16-byte boundary. To satisfy this condition, the size of
-	 * this data structure needs to be also a multiple of 16 bytes.
-	 * This is the reason for this padding.
-	 */
-	uint64_t pad0;
-} istate_t;
-
-#endif
-
-#endif
Index: rnel/arch/arm64/include/arch/mach/hikey960/hikey960.h
===================================================================
--- kernel/arch/arm64/include/arch/mach/hikey960/hikey960.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2021 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_hikey960
- * @brief HiKey 960 platform.
- * @ingroup kernel_arm64
- * @{
- */
-/** @file
- * @brief HiKey 960 platform driver.
- */
-
-#ifndef KERN_arm64_mach_hikey960_H_
-#define KERN_arm64_mach_hikey960_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops hikey960_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mach/virt/virt.h
===================================================================
--- kernel/arch/arm64/include/arch/mach/virt/virt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_virt
- * @brief QEMU virt platform.
- * @ingroup kernel_arm64
- * @{
- */
-/** @file
- * @brief QEMU virt platform driver.
- */
-
-#ifndef KERN_arm64_mach_virt_H_
-#define KERN_arm64_mach_virt_H_
-
-#include <arch/machine_func.h>
-
-extern struct arm_machine_ops virt_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/machine_func.h
===================================================================
--- kernel/arch/arm64/include/arch/machine_func.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Declarations of machine specific functions.
- *
- * These functions enable to differentiate more kinds of ARM platforms.
- */
-
-#ifndef KERN_arm64_MACHINE_FUNC_H_
-#define KERN_arm64_MACHINE_FUNC_H_
-
-#include <arch/istate.h>
-#include <typedefs.h>
-
-struct arm_machine_ops {
-	void (*machine_init)(void);
-	void (*machine_irq_exception)(unsigned int, istate_t *);
-	void (*machine_output_init)(void);
-	void (*machine_input_init)(void);
-	inr_t (*machine_enable_vtimer_irq)(void);
-	size_t (*machine_get_irq_count)(void);
-	const char *(*machine_get_platform_name)(void);
-	void (*machine_early_uart_output)(char32_t);
-};
-
-extern void machine_ops_init(void);
-extern void machine_init(void);
-void machine_irq_exception(unsigned int, istate_t *);
-extern void machine_output_init(void);
-extern void machine_input_init(void);
-extern inr_t machine_enable_vtimer_irq(void);
-extern size_t machine_get_irq_count(void);
-extern const char *machine_get_platform_name(void);
-extern void machine_early_uart_output(char32_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/as.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Address space manipulating functions declarations.
- */
-
-#ifndef KERN_arm64_AS_H_
-#define KERN_arm64_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           1
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xffff000000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0x0000ffffffffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/asid.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief ASIDs related declarations.
- */
-
-#ifndef KERN_arm64_ASID_H_
-#define KERN_arm64_ASID_H_
-
-#include <stdint.h>
-
-/*
- * The ASID size is in VMSAv8-64 an implementation defined choice of 8 or 16
- * bits. The actual size can be obtained by reading ID_AA64MMFR0_EL1.ASIDBits
- * but for simplicity, HelenOS currently defaults to 8 bits.
- */
-typedef uint8_t asid_t;
-
-#define ASID_MAX_ARCH  255
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/frame.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Frame related declarations.
- */
-
-#ifndef KERN_arm64_FRAME_H_
-#define KERN_arm64_FRAME_H_
-
-#include <arch/boot/boot.h>
-
-#define FRAME_WIDTH  12  /* 4KB frames */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-extern memmap_t memmap;
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/km.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_arm64_KM_H_
-#define KERN_arm64_KM_H_
-
-#ifndef __ASSEMBLER__
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define KM_ARM64_IDENTITY_START  UINT64_C(0xffffffff00000000)
-#define KM_ARM64_IDENTITY_SIZE   UINT64_C(0x0000000100000000)
-
-#define KM_ARM64_NON_IDENTITY_START  UINT64_C(0xffff000000000000)
-#define KM_ARM64_NON_IDENTITY_SIZE   UINT64_C(0x0000ffff00000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#else /* __ASSEMBLER__ */
-
-#define KM_ARM64_IDENTITY_START  0xffffffff00000000
-#define KM_ARM64_IDENTITY_SIZE   0x0000000100000000
-
-#define KM_ARM64_NON_IDENTITY_START  0xffff000000000000
-#define KM_ARM64_NON_IDENTITY_SIZE   0x0000ffff00000000
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/page.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,422 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Paging related declarations.
- */
-
-#ifndef KERN_arm64_PAGE_H_
-#define KERN_arm64_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <mm/mm.h>
-#include <trace.h>
-
-#ifndef __ASSEMBLER__
-#include <typedefs.h>
-#endif /* __ASSEMBLER__ */
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#ifndef __ASSEMBLER__
-
-extern uintptr_t physmem_base;
-
-#define KA2PA(x) \
-	(((uintptr_t) (x)) - UINT64_C(0xffffffff00000000) + physmem_base)
-#define PA2KA(x) \
-	(((uintptr_t) (x)) + UINT64_C(0xffffffff00000000) - physmem_base)
-
-#endif /* __ASSEMBLER__ */
-
-/** Log2 size of each translation table entry. */
-#define PTL_ENTRY_SIZE_SHIFT  3
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  512
-#define PTL1_ENTRIES_ARCH  512
-#define PTL2_ENTRIES_ARCH  512
-#define PTL3_ENTRIES_ARCH  512
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Starting bit of virtual address portion translated in each level. */
-#define PTL0_VA_SHIFT  39
-#define PTL1_VA_SHIFT  30
-#define PTL2_VA_SHIFT  21
-#define PTL3_VA_SHIFT  12
-
-/* Size mask of virtual address portion translated in each level. */
-#define PTL0_VA_MASK  0x1ff
-#define PTL1_VA_MASK  0x1ff
-#define PTL2_VA_MASK  0x1ff
-#define PTL3_VA_MASK  0x1ff
-
-/* Macros calculating indices into page tables for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> PTL0_VA_SHIFT) & PTL0_VA_MASK)
-#define PTL1_INDEX_ARCH(vaddr)  (((vaddr) >> PTL1_VA_SHIFT) & PTL1_VA_MASK)
-#define PTL2_INDEX_ARCH(vaddr)  (((vaddr) >> PTL2_VA_SHIFT) & PTL2_VA_MASK)
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> PTL3_VA_SHIFT) & PTL3_VA_MASK)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	((pte_t *) (((uintptr_t) ((pte_t *) (ptl0))[(i)].output_address) << 12))
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	((pte_t *) (((uintptr_t) ((pte_t *) (ptl1))[(i)].output_address) << 12))
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	((pte_t *) (((uintptr_t) ((pte_t *) (ptl2))[(i)].output_address) << 12))
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	(((uintptr_t) ((pte_t *) (ptl3))[(i)].output_address) << 12)
-
-/*
- * Set PTE address accessors for each level. Setting of the level 0 table is
- * ignored because it must be done only by calling as_install_arch() which also
- * changes ASID.
- */
-#define SET_PTL0_ADDRESS_ARCH(ptl0)
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].output_address = (a) >> 12)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) \
-	(((pte_t *) (ptl1))[(i)].output_address = (a) >> 12)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) \
-	(((pte_t *) (ptl2))[(i)].output_address = (a) >> 12)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].output_address = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_level012_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	get_pt_level012_flags((pte_t *) (ptl1), (size_t) (i))
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	get_pt_level012_flags((pte_t *) (ptl2), (size_t) (i))
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_level3_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-	set_pt_level012_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x) \
-	set_pt_level012_flags((pte_t *) (ptl1), (size_t) (i), (x))
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x) \
-	set_pt_level012_flags((pte_t *) (ptl2), (size_t) (i), (x))
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_level3_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i) \
-	set_pt_present((pte_t *) (ptl1), (size_t) (i))
-#define SET_PTL3_PRESENT_ARCH(ptl2, i) \
-	set_pt_present((pte_t *) (ptl2), (size_t) (i))
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last-level PTE entries. */
-#define PTE_VALID_ARCH(pte) \
-	(((pte_t *) (pte))->valid != 0)
-#define PTE_PRESENT_ARCH(pte) \
-	(((pte_t *) (pte))->valid != 0)
-#define PTE_GET_FRAME_ARCH(pte) \
-	(((uintptr_t) ((pte_t *) (pte))->output_address) << FRAME_WIDTH)
-#define PTE_WRITABLE_ARCH(pte) \
-	get_pt_writable((pte_t *) (pte))
-#define PTE_EXECUTABLE_ARCH(pte) \
-	get_pt_executable((pte_t *) (pte))
-
-/* Level 3 access permissions. */
-
-/** Data access permission. User mode: no access, privileged mode: read/write.
- */
-#define PTE_AP_USER_NO_KERNEL_FULL  0
-
-/** Data access permission. User mode: read/write, privileged mode: read/write.
- */
-#define PTE_AP_USER_FULL_KERNEL_FULL  1
-
-/** Data access permission. User mode: no access, privileged mode: read only. */
-#define PTE_AP_USER_NO_KERNEL_LIMITED  2
-
-/** Data access permission. User mode: read only, privileged mode: read only. */
-#define PTE_AP_USER_LIMITED_KERNEL_LIMITED  3
-
-/*
- * Memory types. MAIR_EL1 index 0 is unused, which assures that if a page
- * table entry is non-null then it is valid (PTE_VALID_ARCH() returns true).
- */
-
-/** Write-Back Cacheable Normal memory, Inner shareable, Read-write cache
- * allocation. Defined in MAIR_EL1 index 1.
- */
-#define MAIR_EL1_NORMAL_MEMORY_ATTR  0xff
-#define MAIR_EL1_NORMAL_MEMORY_INDEX  1
-
-/** Device-nGnRE memory (Device non-Gathering, non-Reordering, Early Write
- * Acknowledgement). Equivalent to the Device memory type in earlier versions of
- * the architecture. Defined in MAIR_EL1 index 2.
- */
-#define MAIR_EL1_DEVICE_MEMORY_ATTR  0x04
-#define MAIR_EL1_DEVICE_MEMORY_INDEX  2
-
-/** Bit width of one memory attribute field in MAIR_EL1. */
-#define MAIR_EL1_ATTR_SHIFT  8
-
-/* Level 0, 1, 2 descriptor types. */
-
-/** Block descriptor (valid in level 0, 1, 2 page translation tables). */
-#define PTE_L012_TYPE_BLOCK  0
-
-/** Next-table descriptor (valid in level 0, 1, 2 page translation tables). */
-#define PTE_L012_TYPE_TABLE  1
-
-/* Level 3 descriptor types. */
-
-/** Page descriptor (valid in level 3 page translation tables). */
-#define PTE_L3_TYPE_PAGE  1
-
-/** HelenOS descriptor type. Table for level 0, 1, 2 page translation tables,
- * page for level 3 tables. Block descriptors are not used by HelenOS during
- * normal processing.
- */
-#define PTE_L0123_TYPE_HELENOS  1
-
-/* Page table entry access macros. */
-
-/** Shift to access the next-level table address in a page table entry. */
-#define PTE_NEXT_LEVEL_ADDRESS_SHIFT  12
-
-/** Shift to access the resulting address in a page table entry. */
-#define PTE_OUTPUT_ADDRESS_SHIFT  12
-
-/** Shift to access the access bit in a page table entry. */
-#define PTE_ACCESS_SHIFT  10
-
-/** Shift to access the attr_index field in a page table entry. */
-#define PTE_ATTR_INDEX_SHIFT  2
-
-/** Shift to access the type bit in a page table entry. */
-#define PTE_TYPE_SHIFT  1
-
-/** Shift to access the present bit in a page table entry. */
-#define PTE_PRESENT_SHIFT  0
-
-/** The present bit in a page table entry. */
-#define PTE_PRESENT_FLAG  (1 << PTE_PRESENT_SHIFT)
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-
-/** Page Table Entry.
- *
- * HelenOS model:
- * * Level 0, 1, 2 translation tables hold next-level table descriptors. Block
- *   descriptors are not used during normal processing.
- * * Level 3 tables store 4kB page descriptors.
- */
-typedef struct {
-	/* Common bits. */
-	/** Flag indicating entry contains valid data and can be used for page
-	 * translation.
-	 *
-	 * Note: The flag is called `valid' in the official ARM terminology
-	 * but it has the `present' (valid+active) sense in HelenOS.
-	 */
-	unsigned valid : 1;
-	unsigned type : 1;
-
-	/* Lower block and page attributes. */
-	unsigned attr_index : 3;
-	unsigned non_secure : 1;
-	unsigned access_permission : 2;
-	unsigned shareability : 2;
-	unsigned access : 1;
-	unsigned not_global : 1;
-
-	/* Common output address. */
-	uint64_t output_address : 36;
-
-	unsigned : 4;
-
-	/* Upper block and page attributes. */
-	unsigned contiguous : 1;
-	unsigned privileged_execute_never : 1;
-	unsigned unprivileged_execute_never : 1;
-
-	unsigned : 4;
-
-	/* Next-level table attributes. */
-	unsigned privileged_execute_never_table : 1;
-	unsigned unprivileged_execute_never_table : 1;
-	unsigned access_permission_table : 2;
-	unsigned non_secure_table : 1;
-} __attribute__((packed)) pte_t;
-
-/** Returns level 0, 1, 2 page table entry flags.
- *
- * @param pt Level 0, 1, 2 page table.
- * @param i  Index of the entry to return.
- */
-_NO_TRACE static inline unsigned int get_pt_level012_flags(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	return (1 << PAGE_CACHEABLE_SHIFT) |
-	    (!p->valid << PAGE_PRESENT_SHIFT) | (1 << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) | (1 << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT);
-}
-
-/** Returns level 3 page table entry flags.
- *
- * @param pt Level 3 page table.
- * @param i  Index of the entry to return.
- */
-_NO_TRACE static inline unsigned int get_pt_level3_flags(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	int cacheable = (p->attr_index == MAIR_EL1_NORMAL_MEMORY_INDEX);
-	int user = (p->access_permission == PTE_AP_USER_FULL_KERNEL_FULL ||
-	    p->access_permission == PTE_AP_USER_LIMITED_KERNEL_LIMITED);
-	int write = (p->access_permission == PTE_AP_USER_FULL_KERNEL_FULL ||
-	    p->access_permission == PTE_AP_USER_NO_KERNEL_FULL);
-	int exec = ((user && !p->unprivileged_execute_never) ||
-	    (!user && !p->privileged_execute_never));
-
-	return (cacheable << PAGE_CACHEABLE_SHIFT) |
-	    (!p->valid << PAGE_PRESENT_SHIFT) | (user << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) | (write << PAGE_WRITE_SHIFT) |
-	    (exec << PAGE_EXEC_SHIFT) | (!p->not_global << PAGE_GLOBAL_SHIFT);
-}
-
-/** Sets flags of level 0, 1, 2 page table entry.
- *
- * @param pt    Level 0, 1, 2 page table.
- * @param i     Index of the entry to be changed.
- * @param flags New flags.
- */
-_NO_TRACE static inline void set_pt_level012_flags(pte_t *pt, size_t i,
-    int flags)
-{
-	pte_t *p = &pt[i];
-
-	p->valid = (flags & PAGE_PRESENT) != 0;
-	p->type = PTE_L012_TYPE_TABLE;
-}
-
-/** Sets flags of level 3 page table entry.
- *
- * @param pt    Level 3 page table.
- * @param i     Index of the entry to be changed.
- * @param flags New flags.
- */
-_NO_TRACE static inline void set_pt_level3_flags(pte_t *pt, size_t i,
-    int flags)
-{
-	pte_t *p = &pt[i];
-
-	if (flags & PAGE_CACHEABLE)
-		p->attr_index = MAIR_EL1_NORMAL_MEMORY_INDEX;
-	else
-		p->attr_index = MAIR_EL1_DEVICE_MEMORY_INDEX;
-	p->valid = (flags & PAGE_PRESENT) != 0;
-	p->type = PTE_L3_TYPE_PAGE;
-
-	/* Translate page permissions to access permissions. */
-	if (flags & PAGE_USER) {
-		if (flags & PAGE_WRITE)
-			p->access_permission = PTE_AP_USER_FULL_KERNEL_FULL;
-		else
-			p->access_permission =
-			    PTE_AP_USER_LIMITED_KERNEL_LIMITED;
-	} else {
-		if (flags & PAGE_WRITE)
-			p->access_permission = PTE_AP_USER_NO_KERNEL_FULL;
-		else
-			p->access_permission = PTE_AP_USER_NO_KERNEL_LIMITED;
-	}
-	p->access = 1;
-	p->unprivileged_execute_never = p->privileged_execute_never =
-	    (flags & PAGE_EXEC) == 0;
-
-	p->not_global = (flags & PAGE_GLOBAL) == 0;
-}
-
-/** Sets the present flag of page table entry.
- *
- * @param pt Level 0, 1, 2, 3 page table.
- * @param i  Index of the entry to be changed.
- */
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	p->valid = 1;
-}
-
-/** Gets the executable flag of page table entry.
- *
- * @param pte Page table entry.
- */
-_NO_TRACE static inline bool get_pt_executable(pte_t *pte)
-{
-	if (pte->access_permission == PTE_AP_USER_NO_KERNEL_FULL ||
-	    pte->access_permission == PTE_AP_USER_NO_KERNEL_LIMITED)
-		return pte->privileged_execute_never;
-	else
-		return pte->unprivileged_execute_never;
-}
-
-/** Gets the writable flag of page table entry.
- *
- * @param pte Page table entry.
- */
-_NO_TRACE static inline bool get_pt_writable(pte_t *pte)
-{
-	return pte->access_permission == PTE_AP_USER_FULL_KERNEL_FULL ||
-	    pte->access_permission == PTE_AP_USER_NO_KERNEL_FULL;
-}
-
-extern void page_arch_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/arm64/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief TLB related declarations.
- */
-
-#ifndef KERN_arm64_TLB_H_
-#define KERN_arm64_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/proc/task.h
===================================================================
--- kernel/arch/arm64/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_proc
- * @{
- */
-/** @file
- * @brief Task related declarations.
- */
-
-#ifndef KERN_arm64_TASK_H_
-#define KERN_arm64_TASK_H_
-
-typedef struct {
-} task_arch_t;
-
-#define task_create_arch(t)
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/proc/thread.h
===================================================================
--- kernel/arch/arm64/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_proc
- * @{
- */
-/** @file
- * @brief Thread related declarations.
- */
-
-#ifndef KERN_arm64_THREAD_H_
-#define KERN_arm64_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-#define thread_create_arch(t, flags) (EOK)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/regutils.h
===================================================================
--- kernel/arch/arm64/include/arch/regutils.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Utilities for convenient manipulation with ARM registers.
- */
-
-#ifndef KERN_arm64_REGUTILS_H_
-#define KERN_arm64_REGUTILS_H_
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#define SPECIAL_REG_GEN_READ(name) \
-	static inline uint64_t name##_read(void) \
-	{ \
-		uint64_t res; \
-		asm volatile ( \
-		    "mrs %[res], " #name \
-		    : [res] "=r" (res) \
-		); \
-		return res; \
-	}
-
-#define SPECIAL_REG_GEN_WRITE(name) \
-	static inline void name##_write(uint64_t regn) \
-	{ \
-		asm volatile ( \
-		    "msr " #name ", %[regn]\n" \
-		    "isb\n" \
-		    :: [regn] "r" (regn) \
-		); \
-	}
-
-#define UWORD64(c)  UINT64_C(c)
-
-#else /* __ASSEMBLER__ */
-
-#define SPECIAL_REG_GEN_READ(name)
-#define SPECIAL_REG_GEN_WRITE(name)
-#define UWORD64(c)  c
-
-#endif /* __ASSEMBLER__*/
-
-/* CNTFRQ_EL0 */
-SPECIAL_REG_GEN_READ(CNTFRQ_EL0);
-
-/* CNTVCT_EL0 */
-SPECIAL_REG_GEN_READ(CNTVCT_EL0);
-
-/* CNTV_CTL_EL0 */
-SPECIAL_REG_GEN_READ(CNTV_CTL_EL0);
-SPECIAL_REG_GEN_WRITE(CNTV_CTL_EL0);
-#define CNTV_CTL_ENABLE_SHIFT  0
-#define CNTV_CTL_ENABLE_FLAG  (UWORD64(1) << CNTV_CTL_ENABLE_SHIFT)
-#define CNTV_CTL_IMASK_SHIFT  1
-#define CNTV_CTL_IMASK_FLAG  (UWORD64(1) << CNTV_CTL_IMASK_SHIFT)
-
-/* CNTV_CVAL_EL0 */
-SPECIAL_REG_GEN_READ(CNTV_CVAL_EL0);
-SPECIAL_REG_GEN_WRITE(CNTV_CVAL_EL0);
-
-/* CPACR_EL1 */
-SPECIAL_REG_GEN_READ(CPACR_EL1);
-SPECIAL_REG_GEN_WRITE(CPACR_EL1);
-#define CPACR_FPEN_SHIFT  20
-#define CPACR_FPEN_MASK  (UWORD64(0x3) << CPACR_FPEN_SHIFT)
-#define CPACR_FPEN_TRAP_ALL  0x0
-#define CPACR_FPEN_TRAP_NONE  0x3
-
-/* CurrentEL */
-SPECIAL_REG_GEN_READ(CurrentEL);
-#define CURRENT_EL_EL0  0x0
-#define CURRENT_EL_EL1  0x4
-#define CURRENT_EL_EL2  0x8
-#define CURRENT_EL_EL3  0xc
-
-/* DAIF */
-SPECIAL_REG_GEN_READ(DAIF);
-SPECIAL_REG_GEN_WRITE(DAIF);
-#define DAIF_IRQ_SHIFT  7
-#define DAIF_IRQ_FLAG  (UWORD64(1) << DAIF_IRQ_SHIFT)
-
-/* ELR */
-SPECIAL_REG_GEN_WRITE(ELR_EL1);
-
-/* ESR */
-SPECIAL_REG_GEN_READ(ESR_EL1);
-#define ESR_EC_SHIFT  26
-#define ESR_EC_MASK  (UWORD64(0x3f) << ESR_EC_SHIFT)
-
-/** Exception from access to Advanced SIMD or floating-point functionality. */
-#define ESR_EC_FP  0x07
-/** Exception from SVC instruction execution. */
-#define ESR_EC_SVC  0x15
-
-/** Instruction abort from Lower Exception level. */
-#define ESR_EC_IA_LOWER_EL  0x20
-/** Data abort from Lower Exception level. */
-#define ESR_EC_DA_LOWER_EL  0x24
-/** Data abort from Current Exception level. */
-#define ESR_EC_DA_CURRENT_EL  0x25
-
-/** Instruction/data Fault Status Code. */
-#define ESR_IDFSC_SHIFT  0
-#define ESR_IDFSC_MASK  (UWORD64(0x3f) << ESR_IDFSC_SHIFT)
-
-/** Instruction/data abort, translation fault, zeroth level. */
-#define ESR_IDA_IDFSC_TF0  0x4
-/** Instruction/data abort, translation fault, first level. */
-#define ESR_IDA_IDFSC_TF1  0x5
-/** Instruction/data abort, translation fault, second level. */
-#define ESR_IDA_IDFSC_TF2  0x6
-/** Instruction/data abort, translation fault, third level. */
-#define ESR_IDA_IDFSC_TF3  0x7
-
-/** Data abort, Write not Read. */
-#define ESR_DA_WNR_SHIFT  6
-#define ESR_DA_WNR_FLAG  (UWORD64(1) << ESR_DA_WNR_SHIFT)
-
-/* FAR */
-SPECIAL_REG_GEN_READ(FAR_EL1);
-
-/* MIDR_EL1 */
-SPECIAL_REG_GEN_READ(MIDR_EL1);
-#define MIDR_REVISION_SHIFT  0
-#define MIDR_REVISION_MASK  (UWORD64(0xf) << MIDR_REVISION_SHIFT)
-#define MIDR_PARTNUM_SHIFT  4
-#define MIDR_PARTNUM_MASK  (UWORD64(0xfff) << MIDR_PARTNUM_SHIFT)
-#define MIDR_VARIANT_SHIFT  20
-#define MIDR_VARIANT_MASK  (UWORD64(0xf) << MIDR_VARIANT_SHIFT)
-#define MIDR_IMPLEMENTER_SHIFT  24
-#define MIDR_IMPLEMENTER_MASK  (UWORD64(0xff) << MIDR_IMPLEMENTER_SHIFT)
-
-/* SCTLR */
-#define SCTLR_M_SHIFT  0
-#define SCTLR_M_FLAG  (UWORD64(1) << SCTLR_M_SHIFT)
-
-/* SP */
-SPECIAL_REG_GEN_WRITE(SP_EL0);
-
-/* SPSR */
-SPECIAL_REG_GEN_READ(SPSR_EL1);
-SPECIAL_REG_GEN_WRITE(SPSR_EL1);
-#define SPSR_MODE_SHIFT  0
-#define SPSR_MODE_MASK  (UWORD64(0x1f) << SPSR_MODE_SHIFT)
-#define SPSR_MODE_ARM64_EL0T  0x00  /* ARM64, Exception Level 0, SP_EL0 */
-
-/* TPIDR */
-SPECIAL_REG_GEN_WRITE(TPIDR_EL0);
-
-/* TTBR */
-SPECIAL_REG_GEN_WRITE(TTBR0_EL1);
-SPECIAL_REG_GEN_WRITE(TTBR1_EL1);
-#define TTBR0_ASID_SHIFT  48
-
-/* VBAR */
-SPECIAL_REG_GEN_WRITE(VBAR_EL1);
-
-/* TLBI VAE1IS and TLBI ASIDE1IS parameter. */
-#define TLBI_ASID_SHIFT  48
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/stack.h
===================================================================
--- kernel/arch/arm64/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Stack constants.
- */
-
-#ifndef KERN_arm64_STACK_H_
-#define KERN_arm64_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE  STACK_SIZE
-
-/** Size of a stack item. */
-#define STACK_ITEM_SIZE	 8
-
-/** Required stack alignment. */
-#define STACK_ALIGNMENT	 16
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/include/arch/types.h
===================================================================
--- kernel/arch/arm64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_arm64_TYPES_H_
-#define KERN_arm64_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/arm64/meson.build
===================================================================
--- kernel/arch/arm64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/arm64.c',
-	'src/asm.S',
-	'src/context.S',
-	'src/cpu/cpu.c',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/exception.c',
-	'src/fpu.S',
-	'src/fpu_context.c',
-	'src/interrupt.c',
-	'src/machine_func.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/km.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/smp/ipi.c',
-	'src/smp/smp.c',
-	'src/start.S',
-)
-
-if MACHINE == 'virt'
-	arch_src += files('src/mach/virt/virt.c')
-endif
-
-if MACHINE == 'hikey960'
-	arch_src += files('src/mach/hikey960/hikey960.c')
-endif
-
-_check_headers = [
-	'include/arch/context_struct.h',
-	'include/arch/fpu_context_struct.h',
-	'include/arch/istate_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/arm64/src/arm64.c
===================================================================
--- kernel/arch/arm64/src/arm64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief ARM64 architecture specific functions.
- */
-
-#include <abi/errno.h>
-#include <arch.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/exception.h>
-#include <arch/machine_func.h>
-#include <console/console.h>
-#include <interrupt.h>
-#include <proc/scheduler.h>
-#include <syscall/syscall.h>
-#include <sysinfo/sysinfo.h>
-#include <userspace.h>
-
-static void arm64_post_mm_init(void);
-static void arm64_post_smp_init(void);
-
-arch_ops_t arm64_ops = {
-	.post_mm_init = arm64_post_mm_init,
-	.post_smp_init = arm64_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &arm64_ops;
-
-/** Perform ARM64 specific initialization before main_bsp() is called. */
-void arm64_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
-{
-	/* Copy init task info. */
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
-	    CONFIG_INIT_TASKS);
-
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr =
-		    (uintptr_t) bootinfo->taskmap.tasks[i].addr;
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Copy physical memory map. */
-	memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
-	for (i = 0; i < memmap.cnt; i++) {
-		memmap.zones[i].type = bootinfo->memmap.zones[i].type;
-		memmap.zones[i].start = bootinfo->memmap.zones[i].start;
-		memmap.zones[i].size = bootinfo->memmap.zones[i].size;
-	}
-
-	/* Initialize machine_ops pointer. */
-	machine_ops_init();
-}
-
-/** Perform ARM64 specific tasks needed before the memory management is
- * initialized.
- */
-void arm64_post_mm_init(void)
-{
-	if (config.cpu_active != 1)
-		return;
-
-	/* Do machine-specific initialization. */
-	machine_init();
-
-	/* Initialize exception dispatch table. */
-	exception_init();
-	interrupt_init();
-
-	/* Merge all memory zones to 1 big zone. */
-	zone_merge_all();
-
-	/* Initialize output device. */
-	machine_output_init();
-}
-
-/** Perform ARM64 specific tasks needed after the multiprocessing is
- * initialized.
- */
-void arm64_post_smp_init(void)
-{
-	/* Set platform name. */
-	const char *platform = machine_get_platform_name();
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-	/* Initialize input device. */
-	machine_input_init();
-}
-
-/** Calibrate delay loop.
- *
- * On ARM64, we implement delay() by waiting for the CNTVCT_EL0 register to
- * reach a pre-computed value, as opposed to performing some pre-computed amount
- * of instructions of known duration. We set the delay_loop_const to 1 in order
- * to neutralize the multiplication done by delay().
- */
-void calibrate_delay_loop(void)
-{
-	CPU->delay_loop_const = 1;
-}
-
-/** Wait several microseconds.
- *
- * @param t Microseconds to wait.
- */
-void asm_delay_loop(uint32_t usec)
-{
-	uint64_t stop = CNTVCT_EL0_read() + usec * CNTFRQ_EL0_read() / 1000000;
-
-	while (CNTVCT_EL0_read() < stop)
-		;
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-/** Change processor mode.
- *
- * @param kernel_uarg Userspace settings (entry point, stack, ...).
- */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	/* Prepare return to EL0. */
-	SPSR_EL1_write((SPSR_EL1_read() & ~SPSR_MODE_MASK) |
-	    SPSR_MODE_ARM64_EL0T);
-
-	/* Set program entry. */
-	ELR_EL1_write(pc);
-
-	/* Set user stack. */
-	SP_EL0_write(sp);
-
-	/* Clear Thread ID register. */
-	TPIDR_EL0_write(0);
-
-	asm volatile (
-	    /*
-	     * Reset the kernel stack to its base value.
-	     *
-	     * Clear all general-purpose registers.
-	     */
-	    "mov sp, %[kstack]\n"
-	    "mov x0, #0\n"
-	    "mov x1, #0\n"
-	    "mov x2, #0\n"
-	    "mov x3, #0\n"
-	    "mov x4, #0\n"
-	    "mov x5, #0\n"
-	    "mov x6, #0\n"
-	    "mov x7, #0\n"
-	    "mov x8, #0\n"
-	    "mov x9, #0\n"
-	    "mov x10, #0\n"
-	    "mov x11, #0\n"
-	    "mov x12, #0\n"
-	    "mov x13, #0\n"
-	    "mov x14, #0\n"
-	    "mov x15, #0\n"
-	    "mov x16, #0\n"
-	    "mov x17, #0\n"
-	    "mov x18, #0\n"
-	    "mov x19, #0\n"
-	    "mov x20, #0\n"
-	    "mov x21, #0\n"
-	    "mov x22, #0\n"
-	    "mov x23, #0\n"
-	    "mov x24, #0\n"
-	    "mov x25, #0\n"
-	    "mov x26, #0\n"
-	    "mov x27, #0\n"
-	    "mov x28, #0\n"
-	    "mov x29, #0\n"
-	    "mov x30, #0\n"
-	    "eret\n"
-	    :: [kstack] "r" (((uint64_t) (THREAD->kstack)) +
-	      MEM_STACK_SIZE - SP_DELTA)
-	);
-
-	unreachable();
-}
-
-/** Perform ARM64 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Perform ARM64 specific tasks needed before the new thread is scheduled.
- */
-void before_thread_runs_arch(void)
-{
-}
-
-/** Perform ARM64 specific tasks before a thread stops running. */
-void after_thread_ran_arch(void)
-{
-}
-
-/** Reboot the system. */
-void arch_reboot(void)
-{
-	/* Not implemented. */
-	while (true)
-		;
-}
-
-/** Construct function pointer.
- *
- * @param fptr   Function pointer structure.
- * @param addr   Function address.
- * @param caller Calling function address.
- *
- * @return Address of the function pointer.
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-/** Perform ARM64 specific tasks to initialize IRQ processing. */
-void irq_initialize_arch(irq_t *irq __attribute__((unused)))
-{
-}
-
-void early_putuchar(char32_t c)
-{
-#ifdef CONFIG_DEBUG_EARLY_PRINT
-	if (c == '\n')
-		machine_early_uart_output('\r');
-
-	machine_early_uart_output(c);
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/asm.S
===================================================================
--- kernel/arch/arm64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/exception.h>
-#include <arch/istate_struct.h>
-
-.text
-
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	/* Simple (un-optimized) memcpy(). */
-	cbz x2, 2f
-	mov x3, x0
-1:
-	ldrb w4, [x1], #1
-	strb w4, [x3], #1
-	subs x2, x2, #1
-	b.ne 1b
-
-2:
-	ret
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-FUNCTION_BEGIN(memcpy_from_uspace_failover_address)
-FUNCTION_BEGIN(memcpy_to_uspace_failover_address)
-	mov x0, #0
-	ret
-FUNCTION_END(memcpy_from_uspace_failover_address)
-FUNCTION_END(memcpy_to_uspace_failover_address)
-
-/** Flush instruction caches
- *
- * @param x0 Starting address of the flushing.
- * @param x1 Number of bytes to flush.
- *
- */
-FUNCTION_BEGIN(smc_coherence)
-	/* Initialize loop */
-	mov x9, x0
-	mov x10, xzr
-
-	__dc_loop:
-		/* Data or Unified Cache Line Clean */
-		dc cvau, x9
-		add x9, x9, #4
-		add x10, x10, #4
-		cmp x10, x1
-		blo __dc_loop
-
-	dsb ish
-
-	/* Initialize loop */
-	mov x9, x0
-	mov x10, xzr
-
-	__ic_loop:
-		/* Instruction Cache Line Invalidate */
-		ic ivau, x9
-		add x9, x9, #4
-		add x10, x10, #4
-		cmp x10, x1
-		blo __ic_loop
-
-	dsb ish
-	isb
-	ret
-FUNCTION_END(smc_coherence)
-
-/* Static checks for the istate_t save/load. */
-#if ISTATE_OFFSET_X0 + 8 != ISTATE_OFFSET_X1
-#error x0 and x1 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X2 + 8 != ISTATE_OFFSET_X3
-#error x2 and x3 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X4 + 8 != ISTATE_OFFSET_X5
-#error x4 and x5 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X6 + 8 != ISTATE_OFFSET_X7
-#error x6 and x7 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X8 + 8 != ISTATE_OFFSET_X9
-#error x8 and x9 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X10 + 8 != ISTATE_OFFSET_X11
-#error x10 and x11 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X12 + 8 != ISTATE_OFFSET_X13
-#error x12 and x13 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X14 + 8 != ISTATE_OFFSET_X15
-#error x14 and x15 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X16 + 8 != ISTATE_OFFSET_X17
-#error x16 and x17 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X18 + 8 != ISTATE_OFFSET_X19
-#error x18 and x19 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X20 + 8 != ISTATE_OFFSET_X21
-#error x20 and x21 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X22 + 8 != ISTATE_OFFSET_X23
-#error x22 and x23 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X24 + 8 != ISTATE_OFFSET_X25
-#error x24 and x25 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X26 + 8 != ISTATE_OFFSET_X27
-#error x26 and x27 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_X28 + 8 != ISTATE_OFFSET_X29
-#error x28 and x29 are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_SPSR + 8 != ISTATE_OFFSET_SP
-#error spsr and sp are not successive in istate_t
-#endif
-#if ISTATE_OFFSET_PC + 8 != ISTATE_OFFSET_TPIDR
-#error pc and tpidr are not successive in istate_t
-#endif
-
-/* Exception vector. */
-.macro handler i
-handler_\i:
-	/*
-	 * Initial code for each handler, at maximum 128 bytes (32
-	 * instructions).
-	 */
-
-	/* Save current state. */
-	sub sp, sp, #ISTATE_SIZE                /* 0x00 */
-	stp x0, x1, [sp, #ISTATE_OFFSET_X0]     /* 0x04 */
-	stp x2, x3, [sp, #ISTATE_OFFSET_X2]     /* 0x08 */
-	stp x4, x5, [sp, #ISTATE_OFFSET_X4]     /* 0x0c */
-	stp x6, x7, [sp, #ISTATE_OFFSET_X6]     /* 0x10 */
-	stp x8, x9, [sp, #ISTATE_OFFSET_X8]     /* 0x14 */
-	stp x10, x11, [sp, #ISTATE_OFFSET_X10]  /* 0x18 */
-	stp x12, x13, [sp, #ISTATE_OFFSET_X12]  /* 0x1c */
-	stp x14, x15, [sp, #ISTATE_OFFSET_X14]  /* 0x20 */
-	stp x16, x17, [sp, #ISTATE_OFFSET_X16]  /* 0x24 */
-	stp x18, x19, [sp, #ISTATE_OFFSET_X18]  /* 0x28 */
-	stp x20, x21, [sp, #ISTATE_OFFSET_X20]  /* 0x2c */
-	stp x22, x23, [sp, #ISTATE_OFFSET_X22]  /* 0x30 */
-	stp x24, x25, [sp, #ISTATE_OFFSET_X24]  /* 0x34 */
-	stp x26, x27, [sp, #ISTATE_OFFSET_X26]  /* 0x38 */
-	stp x28, x29, [sp, #ISTATE_OFFSET_X28]  /* 0x3c */
-	str x30, [sp, #ISTATE_OFFSET_X30]       /* 0x40 */
-
-	mrs x0, spsr_el1                        /* 0x44 */
-	mrs x1, sp_el0                          /* 0x48 */
-	stp x0, x1, [sp, #ISTATE_OFFSET_SPSR]   /* 0x4c */
-
-	mrs x0, elr_el1                         /* 0x50 */
-	mrs x1, tpidr_el0                       /* 0x54 */
-	stp x0, x1, [sp, #ISTATE_OFFSET_PC]     /* 0x58 */
-
-	mov x0, #\i                             /* 0x5c */
-	mov x1, sp                              /* 0x60 */
-	bl exc_dispatch                         /* 0x64 */
-
-	/* Restore previous state. */
-	ldp x0, x1, [sp, #ISTATE_OFFSET_SPSR]   /* 0x68 */
-	msr spsr_el1, x0                        /* 0x6c */
-	msr sp_el0, x1                          /* 0x70 */
-
-	ldp x0, x1, [sp, #ISTATE_OFFSET_PC]     /* 0x74 */
-	msr elr_el1, x0                         /* 0x78 */
-	b exc_restore_end                       /* 0x7c */
-.endm
-
-exc_restore_end:
-	/* Restore remaining registers and return from the exception handler. */
-	msr tpidr_el0, x1
-	ldp x0, x1, [sp, #ISTATE_OFFSET_X0]
-	ldp x2, x3, [sp, #ISTATE_OFFSET_X2]
-	ldp x4, x5, [sp, #ISTATE_OFFSET_X4]
-	ldp x6, x7, [sp, #ISTATE_OFFSET_X6]
-	ldp x8, x9, [sp, #ISTATE_OFFSET_X8]
-	ldp x10, x11, [sp, #ISTATE_OFFSET_X10]
-	ldp x12, x13, [sp, #ISTATE_OFFSET_X12]
-	ldp x14, x15, [sp, #ISTATE_OFFSET_X14]
-	ldp x16, x17, [sp, #ISTATE_OFFSET_X16]
-	ldp x18, x19, [sp, #ISTATE_OFFSET_X18]
-	ldp x20, x21, [sp, #ISTATE_OFFSET_X20]
-	ldp x22, x23, [sp, #ISTATE_OFFSET_X22]
-	ldp x24, x25, [sp, #ISTATE_OFFSET_X24]
-	ldp x26, x27, [sp, #ISTATE_OFFSET_X26]
-	ldp x28, x29, [sp, #ISTATE_OFFSET_X28]
-	ldr x30, [sp, #ISTATE_OFFSET_X30]
-	add sp, sp, #ISTATE_SIZE
-	eret
-
-.align 11
-SYMBOL(exc_vector)
-.org exc_vector + 0x000
-	handler EXC_CURRENT_EL_SP_SEL0_SYNCH
-.org exc_vector + 0x080
-	handler EXC_CURRENT_EL_SP_SEL0_IRQ
-.org exc_vector + 0x100
-	handler EXC_CURRENT_EL_SP_SEL0_FIQ
-.org exc_vector + 0x180
-	handler EXC_CURRENT_EL_SP_SEL0_SERROR
-.org exc_vector + 0x200
-	handler EXC_CURRENT_EL_SP_SELX_SYNCH
-.org exc_vector + 0x280
-	handler EXC_CURRENT_EL_SP_SELX_IRQ
-.org exc_vector + 0x300
-	handler EXC_CURRENT_EL_SP_SELX_FIQ
-.org exc_vector + 0x380
-	handler EXC_CURRENT_EL_SP_SELX_SERROR
-.org exc_vector + 0x400
-	handler EXC_LOWER_EL_AARCH64_SYNCH
-.org exc_vector + 0x480
-	handler EXC_LOWER_EL_AARCH64_IRQ
-.org exc_vector + 0x500
-	handler EXC_LOWER_EL_AARCH64_FIQ
-.org exc_vector + 0x580
-	handler EXC_LOWER_EL_AARCH64_SERROR
-.org exc_vector + 0x600
-	handler EXC_LOWER_EL_AARCH32_SYNCH
-.org exc_vector + 0x680
-	handler EXC_LOWER_EL_AARCH32_IRQ
-.org exc_vector + 0x700
-	handler EXC_LOWER_EL_AARCH32_FIQ
-.org exc_vector + 0x780
-	handler EXC_LOWER_EL_AARCH32_SERROR
-.org exc_vector + 0x800
Index: rnel/arch/arm64/src/context.S
===================================================================
--- kernel/arch/arm64/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-
-.text
-
-/* Static checks for the context_t save/load. */
-#if CONTEXT_OFFSET_SP + 8 != CONTEXT_OFFSET_PC
-#error sp and pc are not successive in context_t
-#endif
-#if CONTEXT_OFFSET_X19 + 8 != CONTEXT_OFFSET_X20
-#error x19 and x20 are not successive in context_t
-#endif
-#if CONTEXT_OFFSET_X21 + 8 != CONTEXT_OFFSET_X22
-#error x21 and x22 are not successive in context_t
-#endif
-#if CONTEXT_OFFSET_X23 + 8 != CONTEXT_OFFSET_X24
-#error x23 and x24 are not successive in context_t
-#endif
-#if CONTEXT_OFFSET_X25 + 8 != CONTEXT_OFFSET_X26
-#error x25 and x26 are not successive in context_t
-#endif
-#if CONTEXT_OFFSET_X27 + 8 != CONTEXT_OFFSET_X28
-#error x27 and x28 are not successive in context_t
-#endif
-
-FUNCTION_BEGIN(context_save_arch)
-	/* Save callee-saved registers into context_t pointed by x0. */
-	mov x1, sp
-	stp x1, x30, [x0, #CONTEXT_OFFSET_SP]
-	stp x19, x20, [x0, #CONTEXT_OFFSET_X19]
-	stp x21, x22, [x0, #CONTEXT_OFFSET_X21]
-	stp x23, x24, [x0, #CONTEXT_OFFSET_X23]
-	stp x25, x26, [x0, #CONTEXT_OFFSET_X25]
-	stp x27, x28, [x0, #CONTEXT_OFFSET_X27]
-	str x29, [x0, #CONTEXT_OFFSET_X29]
-
-	/* Return 1. */
-	mov x0, #1
-	ret
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	/* Restore callee-saved registers from context_t pointed by x0. */
-	ldp x1, x30, [x0, #CONTEXT_OFFSET_SP]
-	mov sp, x1
-	ldp x19, x20, [x0, #CONTEXT_OFFSET_X19]
-	ldp x21, x22, [x0, #CONTEXT_OFFSET_X21]
-	ldp x23, x24, [x0, #CONTEXT_OFFSET_X23]
-	ldp x25, x26, [x0, #CONTEXT_OFFSET_X25]
-	ldp x27, x28, [x0, #CONTEXT_OFFSET_X27]
-	ldr x29, [x0, #CONTEXT_OFFSET_X29]
-
-	/* Return 0. */
-	mov x0, #0
-	ret
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/arm64/src/cpu/cpu.c
===================================================================
--- kernel/arch/arm64/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief CPU identification.
- */
-
-#include <arch/regutils.h>
-#include <cpu.h>
-#include <typedefs.h>
-
-/** Decode implementer (vendor) name. */
-static const char *implementer(uint32_t id)
-{
-	switch (id) {
-	case 0x41:
-		return "ARM Limited";
-	case 0x42:
-		return "Broadcom Corporation";
-	case 0x43:
-		return "Cavium Inc.";
-	case 0x44:
-		return "Digital Equipment Corporation";
-	case 0x49:
-		return "Infineon Technologies AG";
-	case 0x4d:
-		return "Motorola or Freescale Semiconductor Inc.";
-	case 0x4e:
-		return "NVIDIA Corporation";
-	case 0x50:
-		return "Applied Micro Circuits Corporation";
-	case 0x51:
-		return "Qualcomm Inc.";
-	case 0x56:
-		return "Marvell International Ltd.";
-	case 0x69:
-		return "Intel Corporation";
-	}
-	return "Unknown implementer";
-}
-
-/** Perform ARM64-specific tasks needed for CPU initialization. */
-void cpu_arch_init(void)
-{
-}
-
-/** Retrieve processor identification and stores it to #CPU.arch */
-void cpu_identify(void)
-{
-	uint64_t midr = MIDR_EL1_read();
-
-	CPU->arch.implementer =
-	    (midr & MIDR_IMPLEMENTER_MASK) >> MIDR_IMPLEMENTER_SHIFT;
-	CPU->arch.variant = (midr & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT;
-	CPU->arch.partnum = (midr & MIDR_PARTNUM_MASK) >> MIDR_PARTNUM_SHIFT;
-	CPU->arch.revision = (midr & MIDR_REVISION_MASK) >> MIDR_REVISION_SHIFT;
-}
-
-/** Print CPU identification. */
-void cpu_print_report(cpu_t *m)
-{
-	printf("cpu%d: vendor=%s, variant=%" PRIx32 ", part number=%" PRIx32
-	    ", revision=%" PRIx32 "\n",
-	    m->id, implementer(m->arch.implementer), m->arch.variant,
-	    m->arch.partnum, m->arch.revision);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/arm64/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       1
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint64_t *stack = (void *) ctx->fp;
-
-	*prev = stack[FRAME_OFFSET_FP_PREV];
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint64_t *stack = (void *) ctx->fp;
-
-	*ra = stack[FRAME_OFFSET_RA];
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return !copy_from_uspace(prev,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return !copy_from_uspace(ra,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/arm64/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	mov x0, x29
-	ret
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	mov x0, x30
-	ret
-FUNCTION_END(program_counter_get)
Index: rnel/arch/arm64/src/exception.c
===================================================================
--- kernel/arch/arm64/src/exception.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,324 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Exception handlers and exception initialization routines.
- */
-
-#include <arch/asm.h>
-#include <arch/exception.h>
-#include <arch/machine_func.h>
-#include <arch/regutils.h>
-#include <interrupt.h>
-#include <mm/as.h>
-#include <stdio.h>
-#include <syscall/syscall.h>
-
-static void current_el_sp_sel0_synch_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SEL0, Synch, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_sel0_irq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SEL0, IRQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_sel0_fiq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SEL0, FIQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_sel0_serror_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SEL0, SError, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64
-	    ".", (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_selx_synch_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	uint64_t esr_el1 = ESR_EL1_read();
-	uint64_t far_el1 = FAR_EL1_read();
-	pf_access_t access;
-
-	switch ((esr_el1 & ESR_EC_MASK) >> ESR_EC_SHIFT) {
-	case ESR_EC_DA_CURRENT_EL:
-		/* Data abort. */
-		switch ((esr_el1 & ESR_IDFSC_MASK) >> ESR_IDFSC_SHIFT) {
-		case ESR_IDA_IDFSC_TF0:
-		case ESR_IDA_IDFSC_TF1:
-		case ESR_IDA_IDFSC_TF2:
-		case ESR_IDA_IDFSC_TF3:
-			/* Translation fault. */
-			access = (esr_el1 & ESR_DA_WNR_FLAG) ? PF_ACCESS_WRITE :
-			    PF_ACCESS_READ;
-			as_page_fault(far_el1, access, istate);
-			return;
-		}
-	}
-
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SELx, Synch, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_selx_irq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	machine_irq_exception(exc_no, istate);
-}
-
-static void current_el_sp_selx_fiq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SELx, FIQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void current_el_sp_selx_serror_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	panic_badtrap(istate, exc_no, "Unhandled exception from Current EL, "
-	    "SP_SELx, SError, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64
-	    ".", (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch64_synch_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	uint64_t esr_el1 = ESR_EL1_read();
-	uint64_t far_el1 = FAR_EL1_read();
-	pf_access_t access;
-	bool exec = false;
-
-	switch ((esr_el1 & ESR_EC_MASK) >> ESR_EC_SHIFT) {
-	case ESR_EC_FP:
-		/* Access to Advanced SIMD or floating-point functionality. */
-#ifdef CONFIG_FPU_LAZY
-		scheduler_fpu_lazy_request();
-#else
-		fault_from_uspace(istate, "AdvSIMD/FP fault.");
-#endif
-		return;
-	case ESR_EC_SVC:
-		/* SVC instruction. */
-		interrupts_enable();
-		istate->x0 = syscall_handler(istate->x0, istate->x1, istate->x2,
-		    istate->x3, istate->x4, istate->x5, istate->x6);
-		interrupts_disable();
-		return;
-	case ESR_EC_IA_LOWER_EL:
-		/* Instruction abort. */
-		exec = true;
-		/* Fallthrough */
-	case ESR_EC_DA_LOWER_EL:
-		/* Data abort. */
-		switch ((esr_el1 & ESR_IDFSC_MASK) >> ESR_IDFSC_SHIFT) {
-		case ESR_IDA_IDFSC_TF0:
-		case ESR_IDA_IDFSC_TF1:
-		case ESR_IDA_IDFSC_TF2:
-		case ESR_IDA_IDFSC_TF3:
-			/* Translation fault. */
-			if (exec)
-				access = PF_ACCESS_EXEC;
-			else
-				access = (esr_el1 & ESR_DA_WNR_FLAG) ?
-				    PF_ACCESS_WRITE : PF_ACCESS_READ;
-			as_page_fault(far_el1, access, istate);
-			return;
-		}
-	}
-
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch64, "
-	    "Synch, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) esr_el1, far_el1);
-}
-
-static void lower_el_aarch64_irq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	machine_irq_exception(exc_no, istate);
-}
-
-static void lower_el_aarch64_fiq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch64, "
-	    "FIQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch64_serror_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch64, "
-	    "SError, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch32_synch_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch32, "
-	    "Synch, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch32_irq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch32, "
-	    "IRQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch32_fiq_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch32, "
-	    "FIQ, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-static void lower_el_aarch32_serror_exception(unsigned int exc_no,
-    istate_t *istate)
-{
-	fault_from_uspace(istate, "Unhandled exception from Lower EL, AArch32, "
-	    "SError, ESR_EL1=%0#10" PRIx32 ", FAR_EL1=%0#18" PRIx64 ".",
-	    (uint32_t) ESR_EL1_read(), FAR_EL1_read());
-}
-
-/** Initializes exception handling.
- *
- * Installs low-level exception handlers and then registers exceptions and their
- * handlers to kernel exception dispatcher.
- */
-void exception_init(void)
-{
-	exc_register(EXC_CURRENT_EL_SP_SEL0_SYNCH,
-	    "current EL, SP_SEL0, Synchronous", true,
-	    (iroutine_t) current_el_sp_sel0_synch_exception);
-	exc_register(EXC_CURRENT_EL_SP_SEL0_IRQ,
-	    "current EL, SP_SEL0, IRQ", true,
-	    (iroutine_t) current_el_sp_sel0_irq_exception);
-	exc_register(EXC_CURRENT_EL_SP_SEL0_FIQ,
-	    "current EL, SP_SEL0, FIQ", true,
-	    (iroutine_t) current_el_sp_sel0_fiq_exception);
-	exc_register(EXC_CURRENT_EL_SP_SEL0_SERROR,
-	    "current EL, SP_SEL0, SError", true,
-	    (iroutine_t) current_el_sp_sel0_serror_exception);
-	exc_register(EXC_CURRENT_EL_SP_SELX_SYNCH,
-	    "current EL, SP_SELx, Synchronous", true,
-	    (iroutine_t) current_el_sp_selx_synch_exception);
-	exc_register(EXC_CURRENT_EL_SP_SELX_IRQ,
-	    "current EL, SP_SELx, IRQ", true,
-	    (iroutine_t) current_el_sp_selx_irq_exception);
-	exc_register(EXC_CURRENT_EL_SP_SELX_FIQ,
-	    "current EL, SP_SELx, FIQ", true,
-	    (iroutine_t) current_el_sp_selx_fiq_exception);
-	exc_register(EXC_CURRENT_EL_SP_SELX_SERROR,
-	    "current EL, SP_SELx, SError", true,
-	    (iroutine_t) current_el_sp_selx_serror_exception);
-	exc_register(EXC_LOWER_EL_AARCH64_SYNCH,
-	    "lower EL, AArch64, Synchronous", true,
-	    (iroutine_t) lower_el_aarch64_synch_exception);
-	exc_register(EXC_LOWER_EL_AARCH64_IRQ,
-	    "lower EL, AArch64, IRQ", true,
-	    (iroutine_t) lower_el_aarch64_irq_exception);
-	exc_register(EXC_LOWER_EL_AARCH64_FIQ,
-	    "lower EL, AArch64, FIQ", true,
-	    (iroutine_t) lower_el_aarch64_fiq_exception);
-	exc_register(EXC_LOWER_EL_AARCH64_SERROR,
-	    "lower EL, AArch64, SError", true,
-	    (iroutine_t) lower_el_aarch64_serror_exception);
-	exc_register(EXC_LOWER_EL_AARCH32_SYNCH,
-	    "lower EL, AArch32, Synchronous", true,
-	    (iroutine_t) lower_el_aarch32_synch_exception);
-	exc_register(EXC_LOWER_EL_AARCH32_IRQ,
-	    "lower EL, AArch32, IRQ", true,
-	    (iroutine_t) lower_el_aarch32_irq_exception);
-	exc_register(EXC_LOWER_EL_AARCH32_FIQ,
-	    "lower EL, AArch32, FIQ", true,
-	    (iroutine_t) lower_el_aarch32_fiq_exception);
-	exc_register(EXC_LOWER_EL_AARCH32_SERROR,
-	    "lower EL, AArch32, SError", true,
-	    (iroutine_t) lower_el_aarch32_serror_exception);
-
-	VBAR_EL1_write(((uint64_t) &exc_vector));
-}
-
-/** Print #istate_t structure content.
- *
- * @param istate Structure to be printed.
- */
-void istate_decode(istate_t *istate)
-{
-	printf("x0 =%0#18" PRIx64 "\tx1 =%0#18" PRIx64 "\t"
-	    "x2 =%0#18" PRIx64 "\n", istate->x0, istate->x1, istate->x2);
-	printf("x3 =%0#18" PRIx64 "\tx4 =%0#18" PRIx64 "\t"
-	    "x5 =%0#18" PRIx64 "\n", istate->x3, istate->x4, istate->x5);
-	printf("x6 =%0#18" PRIx64 "\tx7 =%0#18" PRIx64 "\t"
-	    "x8 =%0#18" PRIx64 "\n", istate->x6, istate->x7, istate->x8);
-	printf("x9 =%0#18" PRIx64 "\tx10=%0#18" PRIx64 "\t"
-	    "x11=%0#18" PRIx64 "\n", istate->x9, istate->x10, istate->x11);
-	printf("x12=%0#18" PRIx64 "\tx13=%0#18" PRIx64 "\t"
-	    "x14=%0#18" PRIx64 "\n", istate->x12, istate->x13, istate->x14);
-	printf("x15=%0#18" PRIx64 "\tx16=%0#18" PRIx64 "\t"
-	    "x17=%0#18" PRIx64 "\n", istate->x15, istate->x16, istate->x17);
-	printf("x18=%0#18" PRIx64 "\tx19=%0#18" PRIx64 "\t"
-	    "x20=%0#18" PRIx64 "\n", istate->x18, istate->x19, istate->x20);
-	printf("x21=%0#18" PRIx64 "\tx22=%0#18" PRIx64 "\t"
-	    "x23=%0#18" PRIx64 "\n", istate->x21, istate->x22, istate->x23);
-	printf("x24=%0#18" PRIx64 "\tx25=%0#18" PRIx64 "\t"
-	    "x26=%0#18" PRIx64 "\n", istate->x24, istate->x25, istate->x26);
-	printf("x27=%0#18" PRIx64 "\tx28=%0#18" PRIx64 "\t"
-	    "x29=%0#18" PRIx64 "\n", istate->x27, istate->x28, istate->x29);
-	printf("x30=%0#18" PRIx64 "\tsp =%0#18" PRIx64 "\t"
-	    "pc =%0#18" PRIx64 "\n", istate->x30, istate->sp, istate->pc);
-	printf("spsr=%0#18" PRIx64 "\ttpidr=%0#18" PRIx64 "\n", istate->spsr,
-	    istate->tpidr);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/fpu.S
===================================================================
--- kernel/arch/arm64/src/fpu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/fpu_context_struct.h>
-
-.text
-
-FUNCTION_BEGIN(fpu_context_save)
-	/* Save FPU registers into fpu_context_t pointed by x0. */
-	stp q0, q1, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 0]
-	stp q2, q3, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 2]
-	stp q4, q5, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 4]
-	stp q6, q7, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 6]
-	stp q8, q9, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 8]
-	stp q10, q11, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 10]
-	stp q12, q13, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 12]
-	stp q14, q15, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 14]
-	stp q16, q17, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 16]
-	stp q18, q19, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 18]
-	stp q20, q21, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 20]
-	stp q22, q23, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 22]
-	stp q24, q25, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 24]
-	stp q26, q27, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 26]
-	stp q28, q29, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 28]
-	stp q30, q31, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 30]
-	mrs x1, fpcr
-	str w1, [x0, #FPU_CONTEXT_OFFSET_FPCR]
-	mrs x1, fpsr
-	str w1, [x0, #FPU_CONTEXT_OFFSET_FPSR]
-	ret
-FUNCTION_END(fpu_context_save)
-
-FUNCTION_BEGIN(fpu_context_restore)
-	/* Restore FPU registers from fpu_context_t pointed by x0. */
-	ldp q0, q1, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 0]
-	ldp q2, q3, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 2]
-	ldp q4, q5, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 4]
-	ldp q6, q7, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 6]
-	ldp q8, q9, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 8]
-	ldp q10, q11, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 10]
-	ldp q12, q13, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 12]
-	ldp q14, q15, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 14]
-	ldp q16, q17, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 16]
-	ldp q18, q19, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 18]
-	ldp q20, q21, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 20]
-	ldp q22, q23, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 22]
-	ldp q24, q25, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 24]
-	ldp q26, q27, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 26]
-	ldp q28, q29, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 28]
-	ldp q30, q31, [x0, #FPU_CONTEXT_OFFSET_VREGS + 16 * 30]
-	ldr w1, [x0, #FPU_CONTEXT_OFFSET_FPCR]
-	msr fpcr, x1
-	ldr w1, [x0, #FPU_CONTEXT_OFFSET_FPSR]
-	msr fpsr, x1
-	ret
-FUNCTION_END(fpu_context_restore)
Index: rnel/arch/arm64/src/fpu_context.c
===================================================================
--- kernel/arch/arm64/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief ARM64 FPU context.
- */
-
-#include <arch/regutils.h>
-#include <fpu_context.h>
-
-/** Initialize FPU functionality. */
-void fpu_init(void)
-{
-	/*
-	 * Set initial FPU state:
-	 * o Registers v0-v31 are cleared.
-	 * o FPCR value:
-	 *   [31:27] - Reserved 0.
-	 *   [26]    - AHP=0, IEEE half-precision format selected.
-	 *   [25]    - DN=0, NaN operands propagate through to the output of a
-	 *             floating-point operation.
-	 *   [24]    - FZ=0, flush-to-zero mode disabled.
-	 *   [23:22] - RMode=00, round to nearest mode.
-	 *   [21:20] - Stride=00, this field has no function in AArch64 state.
-	 *   [19]    - FZ16=0, flush-to-zero mode disabled.
-	 *   [18:16] - Len=000, this field has no function in AArch64 state.
-	 *   [15]    - IDE=0, input denormal FP exception is untrapped.
-	 *   [14:13] - Reserved 0.
-	 *   [12]    - IXE=0, inexact FP exception is untrapped.
-	 *   [11]    - UFE=0, underflow FP exception is untrapped.
-	 *   [10]    - OFE=0, overflow FP exception is untrapped.
-	 *   [9]     - DZE=0, divide by zero FP exception is untrapped.
-	 *   [8]     - IOE=0, invalid operation FP exception is untrapped.
-	 *   [7:0]   - Reserved 0.
-	 * o FPSR value:
-	 *   [31]    - N=0, negative condition flag for AArch32.
-	 *   [30]    - Z=0, zero condition flag for AArch32.
-	 *   [29]    - C=0, carry condition flag for AArch32.
-	 *   [28]    - V=0, overflow condition flag for AArch32.
-	 *   [27]    - QC=0, cumulative saturation bit.
-	 *   [26:8]  - Reserved 0.
-	 *   [7]     - IDC=0, input denormal cumulative FP exception bit.
-	 *   [6:5]   - Reserved 0.
-	 *   [4]     - IXC=0, inexact cumulative FP exception bit.
-	 *   [3]     - UFC=0, underflow cumulative FP exception bit.
-	 *   [2]     - OFC=0, overflow cumulative FP exception bit.
-	 *   [1]     - DZC=0, divide by zero cumulative FP exception bit.
-	 *   [0]     - IOC=0, invalid operation cumulative FP exception bit.
-	 */
-	static fpu_context_t init = { .vregs = { 0 }, .fpcr = 0, .fpsr = 0 };
-	fpu_context_restore(&init);
-}
-
-/** Enable FPU instructions. */
-void fpu_enable(void)
-{
-	CPACR_EL1_write((CPACR_EL1_read() & ~CPACR_FPEN_MASK) |
-	    (CPACR_FPEN_TRAP_NONE << CPACR_FPEN_SHIFT));
-}
-
-/** Disable FPU instructions. */
-void fpu_disable(void)
-{
-	CPACR_EL1_write((CPACR_EL1_read() & ~CPACR_FPEN_MASK) |
-	    (CPACR_FPEN_TRAP_ALL << CPACR_FPEN_SHIFT));
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/interrupt.c
===================================================================
--- kernel/arch/arm64/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Interrupts controlling routines.
- */
-
-#include <arch/interrupt.h>
-#include <arch/machine_func.h>
-#include <ddi/irq.h>
-#include <interrupt.h>
-#include <time/clock.h>
-
-static irq_t timer_irq;
-static uint64_t timer_increment;
-
-/** Disable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_disable(void)
-{
-	uint64_t daif = DAIF_read();
-
-	DAIF_write(daif | DAIF_IRQ_FLAG);
-
-	return daif & DAIF_IRQ_FLAG;
-}
-
-/** Enable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_enable(void)
-{
-	uint64_t daif = DAIF_read();
-
-	DAIF_write(daif & ~DAIF_IRQ_FLAG);
-
-	return daif & DAIF_IRQ_FLAG;
-}
-
-/** Restore interrupt priority level.
- *
- * @param ipl Saved interrupt priority level.
- */
-void interrupts_restore(ipl_t ipl)
-{
-	uint64_t daif = DAIF_read();
-
-	DAIF_write((daif & ~DAIF_IRQ_FLAG) | (ipl & DAIF_IRQ_FLAG));
-}
-
-/** Read interrupt priority level.
- *
- * @return Current interrupt priority level.
- */
-ipl_t interrupts_read(void)
-{
-	return DAIF_read() & DAIF_IRQ_FLAG;
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- */
-bool interrupts_disabled(void)
-{
-	return DAIF_read() & DAIF_IRQ_FLAG;
-}
-
-/** Suspend the virtual timer. */
-static void timer_suspend(void)
-{
-	uint64_t cntv_ctl = CNTV_CTL_EL0_read();
-
-	CNTV_CTL_EL0_write(cntv_ctl | CNTV_CTL_IMASK_FLAG);
-}
-
-/** Start the virtual timer. */
-static void timer_start(void)
-{
-	uint64_t cntfrq = CNTFRQ_EL0_read();
-	uint64_t cntvct = CNTVCT_EL0_read();
-	uint64_t cntv_ctl = CNTV_CTL_EL0_read();
-
-	/* Calculate the increment. */
-	timer_increment = cntfrq / HZ;
-
-	/* Program the timer. */
-	CNTV_CVAL_EL0_write(cntvct + timer_increment);
-	CNTV_CTL_EL0_write(
-	    (cntv_ctl & ~CNTV_CTL_IMASK_FLAG) | CNTV_CTL_ENABLE_FLAG);
-}
-
-/** Claim the virtual timer interrupt. */
-static irq_ownership_t timer_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-/** Handle the virtual timer interrupt. */
-static void timer_irq_handler(irq_t *irq)
-{
-	uint64_t cntvct = CNTVCT_EL0_read();
-	uint64_t cntv_cval = CNTV_CVAL_EL0_read();
-
-	uint64_t drift = cntvct - cntv_cval;
-	while (drift > timer_increment) {
-		drift -= timer_increment;
-		CPU_LOCAL->missed_clock_ticks++;
-	}
-	CNTV_CVAL_EL0_write(cntvct + timer_increment - drift);
-
-	/*
-	 * We are holding a lock which prevents preemption.
-	 * Release the lock, call clock() and reacquire the lock again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-/** Initialize basic tables for exception dispatching. */
-void interrupt_init(void)
-{
-	size_t irq_count = machine_get_irq_count();
-	irq_init(irq_count, irq_count);
-
-	/* Initialize virtual timer. */
-	timer_suspend();
-	inr_t timer_inr = machine_enable_vtimer_irq();
-
-	irq_initialize(&timer_irq);
-	timer_irq.inr = timer_inr;
-	timer_irq.claim = timer_claim;
-	timer_irq.handler = timer_irq_handler;
-	irq_register(&timer_irq);
-
-	timer_start();
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mach/hikey960/hikey960.c
===================================================================
--- kernel/arch/arm64/src/mach/hikey960/hikey960.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2021 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_hikey960
- * @{
- */
-/** @file
- * @brief HiKey 960 platform driver.
- */
-
-#include <arch/mach/hikey960/hikey960.h>
-#include <console/console.h>
-#include <genarch/drivers/gicv2/gicv2.h>
-#include <genarch/drivers/pl011/pl011.h>
-#include <genarch/srln/srln.h>
-#include <mm/km.h>
-#include <sysinfo/sysinfo.h>
-
-#define HIKEY960_VTIMER_IRQ         27
-#define HIKEY960_UART_IRQ           111
-#define HIKEY960_GIC_DISTR_ADDRESS  0xE82B1000
-#define HIKEY960_GIC_CPUI_ADDRESS   0xE82B2000
-#define HIKEY960_UART_ADDRESS       0xFFF32000
-
-struct {
-	gicv2_t gicv2;
-	pl011_uart_t uart;
-} hikey960;
-
-static void hikey960_init(void)
-{
-	/* Initialize interrupt controller. */
-	gicv2_distr_regs_t *distr = (void *) km_map(HIKEY960_GIC_DISTR_ADDRESS,
-	    ALIGN_UP(sizeof(*distr), PAGE_SIZE), KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);
-	gicv2_cpui_regs_t *cpui = (void *) km_map(HIKEY960_GIC_CPUI_ADDRESS,
-	    ALIGN_UP(sizeof(*cpui), PAGE_SIZE), KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);
-	gicv2_init(&hikey960.gicv2, distr, cpui);
-}
-
-static void hikey960_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	unsigned int inum, cpuid;
-	gicv2_inum_get(&hikey960.gicv2, &inum, &cpuid);
-
-	/* Dispatch the interrupt. */
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		/* Spurious interrupt. */
-		printf("cpu%d: spurious interrupt (inum=%u)\n", CPU->id, inum);
-	}
-
-	/* Signal end of interrupt to the controller. */
-	gicv2_end(&hikey960.gicv2, inum, cpuid);
-}
-
-static void hikey960_output_init(void)
-{
-	if (!pl011_uart_init(&hikey960.uart, HIKEY960_UART_IRQ,
-	    HIKEY960_UART_ADDRESS))
-		return;
-
-	stdout_wire(&hikey960.uart.outdev);
-}
-
-static void hikey960_input_init(void)
-{
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance == NULL)
-		return;
-
-	indev_t *sink = stdin_wire();
-	indev_t *srln = srln_wire(srln_instance, sink);
-	pl011_uart_input_wire(&hikey960.uart, srln);
-	gicv2_enable(&hikey960.gicv2, HIKEY960_UART_IRQ);
-}
-
-static inr_t hikey960_enable_vtimer_irq(void)
-{
-	gicv2_enable(&hikey960.gicv2, HIKEY960_VTIMER_IRQ);
-	return HIKEY960_VTIMER_IRQ;
-}
-
-static size_t hikey960_get_irq_count(void)
-{
-	return gicv2_inum_get_total(&hikey960.gicv2);
-}
-
-static const char *hikey960_get_platform_name(void)
-{
-	return "hikey960";
-}
-
-static void hikey960_early_uart_output(char32_t c)
-{
-	volatile uint32_t *uartdr = (volatile uint32_t *)
-	    PA2KA(HIKEY960_UART_ADDRESS);
-	volatile uint32_t *uartfr = (volatile uint32_t *)
-	    PA2KA(HIKEY960_UART_ADDRESS + 24);
-
-	while (*uartfr & 0x20U) {
-	}
-
-	*uartdr = c;
-}
-
-struct arm_machine_ops hikey960_machine_ops = {
-	hikey960_init,
-	hikey960_irq_exception,
-	hikey960_output_init,
-	hikey960_input_init,
-	hikey960_enable_vtimer_irq,
-	hikey960_get_irq_count,
-	hikey960_get_platform_name,
-	hikey960_early_uart_output
-};
-
-/** @}
- */
Index: rnel/arch/arm64/src/mach/virt/virt.c
===================================================================
--- kernel/arch/arm64/src/mach/virt/virt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_virt
- * @{
- */
-/** @file
- * @brief QEMU virt platform driver.
- */
-
-#include <arch/mach/virt/virt.h>
-#include <console/console.h>
-#include <genarch/drivers/gicv2/gicv2.h>
-#include <genarch/drivers/pl011/pl011.h>
-#include <genarch/srln/srln.h>
-#include <mm/km.h>
-#include <sysinfo/sysinfo.h>
-
-#define VIRT_VTIMER_IRQ         27
-#define VIRT_UART_IRQ           33
-#define VIRT_GIC_DISTR_ADDRESS  0x08000000
-#define VIRT_GIC_CPUI_ADDRESS   0x08010000
-#define VIRT_UART_ADDRESS       0x09000000
-
-static void virt_init(void);
-static void virt_irq_exception(unsigned int exc_no, istate_t *istate);
-static void virt_output_init(void);
-static void virt_input_init(void);
-inr_t virt_enable_vtimer_irq(void);
-size_t virt_get_irq_count(void);
-static const char *virt_get_platform_name(void);
-
-struct {
-	gicv2_t gicv2;
-	pl011_uart_t uart;
-} virt;
-
-struct arm_machine_ops virt_machine_ops = {
-	virt_init,
-	virt_irq_exception,
-	virt_output_init,
-	virt_input_init,
-	virt_enable_vtimer_irq,
-	virt_get_irq_count,
-	virt_get_platform_name
-};
-
-static void virt_init(void)
-{
-	/* Initialize interrupt controller. */
-	gicv2_distr_regs_t *distr = (void *) km_map(VIRT_GIC_DISTR_ADDRESS,
-	    ALIGN_UP(sizeof(*distr), PAGE_SIZE), KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);
-	gicv2_cpui_regs_t *cpui = (void *) km_map(VIRT_GIC_CPUI_ADDRESS,
-	    ALIGN_UP(sizeof(*cpui), PAGE_SIZE), KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);
-	gicv2_init(&virt.gicv2, distr, cpui);
-}
-
-static void virt_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	unsigned inum, cpuid;
-	gicv2_inum_get(&virt.gicv2, &inum, &cpuid);
-
-	/* Dispatch the interrupt. */
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/* The IRQ handler was found. */
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-		/* Spurious interrupt. */
-		printf("cpu%d: spurious interrupt (inum=%u)\n", CPU->id, inum);
-	}
-
-	/* Signal end of interrupt to the controller. */
-	gicv2_end(&virt.gicv2, inum, cpuid);
-}
-
-static void virt_output_init(void)
-{
-	if (!pl011_uart_init(&virt.uart, VIRT_UART_IRQ, VIRT_UART_ADDRESS))
-		return;
-
-	stdout_wire(&virt.uart.outdev);
-}
-
-static void virt_input_init(void)
-{
-	srln_instance_t *srln_instance = srln_init();
-	if (srln_instance == NULL)
-		return;
-
-	indev_t *sink = stdin_wire();
-	indev_t *srln = srln_wire(srln_instance, sink);
-	pl011_uart_input_wire(&virt.uart, srln);
-	gicv2_enable(&virt.gicv2, VIRT_UART_IRQ);
-}
-
-inr_t virt_enable_vtimer_irq(void)
-{
-	gicv2_enable(&virt.gicv2, VIRT_VTIMER_IRQ);
-	return VIRT_VTIMER_IRQ;
-}
-
-size_t virt_get_irq_count(void)
-{
-	return gicv2_inum_get_total(&virt.gicv2);
-}
-
-const char *virt_get_platform_name(void)
-{
-	return "arm64virt";
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/machine_func.c
===================================================================
--- kernel/arch/arm64/src/machine_func.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- * @brief Definitions of machine specific functions.
- *
- * These functions enable to differentiate more kinds of ARM platforms.
- */
-
-#include <arch/machine_func.h>
-#include <arch/mach/hikey960/hikey960.h>
-#include <arch/mach/virt/virt.h>
-
-/** Pointer to machine_ops structure being used. */
-static struct arm_machine_ops *machine_ops;
-
-/** Initialize machine_ops pointer. */
-void machine_ops_init(void)
-{
-#if defined(MACHINE_virt)
-	machine_ops = &virt_machine_ops;
-#elif defined(MACHINE_hikey960)
-	machine_ops = &hikey960_machine_ops;
-#else
-#error Machine type not defined.
-#endif
-}
-
-/** Perform machine-specific initialization. */
-void machine_init(void)
-{
-	machine_ops->machine_init();
-}
-
-/** Interrupt exception handler.
- *
- * @param exc_no Interrupt exception number.
- * @param istate Saved processor state.
- */
-void machine_irq_exception(unsigned int exc_no, istate_t *istate)
-{
-	machine_ops->machine_irq_exception(exc_no, istate);
-}
-
-/** Configure the output device. */
-void machine_output_init(void)
-{
-	machine_ops->machine_output_init();
-}
-
-/** Configure the input device. */
-void machine_input_init(void)
-{
-	machine_ops->machine_input_init();
-}
-
-/** Get IRQ number range used by machine. */
-size_t machine_get_irq_count(void)
-{
-	return machine_ops->machine_get_irq_count();
-}
-
-/** Enable virtual timer interrupt and return its number. */
-inr_t machine_enable_vtimer_irq(void)
-{
-	return machine_ops->machine_enable_vtimer_irq();
-}
-
-/** Get platform identifier. */
-const char *machine_get_platform_name(void)
-{
-	return machine_ops->machine_get_platform_name();
-}
-
-/** Early debugging output. */
-void machine_early_uart_output(char32_t c)
-{
-	if (machine_ops->machine_early_uart_output != NULL)
-		machine_ops->machine_early_uart_output(c);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mm/as.c
===================================================================
--- kernel/arch/arm64/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Address space functions.
- */
-
-#include <arch/mm/as.h>
-#include <arch/regutils.h>
-#include <genarch/mm/asid_fifo.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/as.h>
-#include <mm/asid.h>
-
-/** Architecture dependent address space init.
- *
- * Since ARM64 supports page tables, #as_pt_operations are used.
- */
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-	asid_fifo_init();
-}
-
-/** Perform ARM64-specific tasks when an address space becomes active on the
- * processor.
- *
- * Change the level 0 page table (this is normally done by
- * SET_PTL0_ADDRESS_ARCH() on other architectures) and install ASID.
- *
- * @param as Address space.
- */
-void as_install_arch(as_t *as)
-{
-	uint64_t val;
-
-	val = (uint64_t) as->genarch.page_table;
-	if (as->asid != ASID_KERNEL) {
-		val |= (uint64_t) as->asid << TTBR0_ASID_SHIFT;
-		TTBR0_EL1_write(val);
-	} else
-		TTBR1_EL1_write(val);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mm/frame.c
===================================================================
--- kernel/arch/arm64/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Frame related functions.
- */
-
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <config.h>
-#include <align.h>
-#include <macros.h>
-
-/** Physical memory map received from the bootcode. */
-memmap_t memmap;
-
-/** Print memory layout. */
-void physmem_print(void)
-{
-	printf("[base            ] [size            ] [type      ]\n");
-
-	size_t i;
-	for (i = 0; i < memmap.cnt; i++) {
-		const char *type;
-		switch (memmap.zones[i].type) {
-		case MEMTYPE_AVAILABLE:
-			type = "available";
-			break;
-		case MEMTYPE_ACPI_RECLAIM:
-			type = "ACPI reclaim";
-			break;
-		default:
-			type = "unusable";
-			break;
-		}
-
-		printf("%p %#018zx %s\n", memmap.zones[i].start,
-		    memmap.zones[i].size, type);
-	}
-}
-
-/** Create memory zones according to information stored in memmap.
- *
- * Walk the memory map and create frame zones according to it.
- */
-static void frame_common_arch_init(bool low)
-{
-	size_t i;
-
-	for (i = 0; i < memmap.cnt; i++) {
-		if (memmap.zones[i].type != MEMTYPE_AVAILABLE)
-			continue;
-
-		/* To be safe, make the available zone possibly smaller. */
-		uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
-		    FRAME_SIZE);
-		size_t size = ALIGN_DOWN(memmap.zones[i].size -
-		    (base - (uintptr_t) memmap.zones[i].start), FRAME_SIZE);
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			continue;
-
-		pfn_t confdata;
-		pfn_t pfn = ADDR2PFN(base);
-		size_t count = SIZE2FRAMES(size);
-
-		if (low) {
-			/* Determine where to place confdata. */
-			if (pfn == 0) {
-				/*
-				 * Avoid placing confdata at the NULL address.
-				 */
-				if (count == 1)
-					continue;
-				confdata = 1;
-			} else
-				confdata = pfn;
-
-			zone_create(pfn, count, confdata,
-			    ZONE_AVAILABLE | ZONE_LOWMEM);
-		} else {
-			confdata = zone_external_conf_alloc(count);
-			if (confdata != 0)
-				zone_create(pfn, count, confdata,
-				    ZONE_AVAILABLE | ZONE_HIGHMEM);
-		}
-	}
-}
-
-/** Create low memory zones. */
-void frame_low_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(true);
-
-	/*
-	 * On ARM64, physical memory can start on a non-zero address. The
-	 * generic frame_init() only marks PFN 0 as not free, so we must mark
-	 * the physically first frame not free explicitly here, no matter what
-	 * is its address.
-	 */
-	frame_mark_unavailable(ADDR2PFN(physmem_base), 1);
-}
-
-/** Create high memory zones. */
-void frame_high_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mm/km.c
===================================================================
--- kernel/arch/arm64/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <config.h>
-#include <macros.h>
-#include <mm/km.h>
-#include <typedefs.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_ARM64_IDENTITY_START;
-	config.identity_size = KM_ARM64_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_ARM64_NON_IDENTITY_START,
-	    KM_ARM64_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_ARM64_NON_IDENTITY_START, KM_ARM64_NON_IDENTITY_SIZE,
-	    addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mm/page.c
===================================================================
--- kernel/arch/arm64/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief Paging related functions.
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/as.h>
-#include <mm/page.h>
-
-/** Initializes page tables. */
-void page_arch_init(void)
-{
-	if (config.cpu_active > 1) {
-		as_switch(NULL, AS_KERNEL);
-		return;
-	}
-
-	page_mapping_operations = &pt_mapping_operations;
-
-	page_table_lock(AS_KERNEL, true);
-
-	/* PA2KA(identity) mapping for all low-memory frames. */
-	for (uintptr_t cur = 0; cur < config.identity_size; cur += FRAME_SIZE) {
-		uintptr_t addr = physmem_base + cur;
-		page_mapping_insert(AS_KERNEL, PA2KA(addr), addr,
-		    PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_EXEC | PAGE_WRITE |
-		    PAGE_READ);
-	}
-
-	page_table_unlock(AS_KERNEL, true);
-
-	as_switch(NULL, AS_KERNEL);
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/mm/tlb.c
===================================================================
--- kernel/arch/arm64/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64_mm
- * @{
- */
-/** @file
- * @brief TLB related functions.
- */
-
-#include <arch/mm/asid.h>
-#include <arch/mm/page.h>
-#include <arch/regutils.h>
-#include <mm/tlb.h>
-#include <typedefs.h>
-
-/** Invalidate all entries in TLB. */
-void tlb_invalidate_all(void)
-{
-	asm volatile (
-	    /* TLB Invalidate All, EL1, Inner Shareable. */
-	    "tlbi alle1is\n"
-	    /* Ensure completion on all PEs. */
-	    "dsb ish\n"
-	    /* Synchronize context on this PE. */
-	    "isb\n"
-	    : : : "memory"
-	);
-}
-
-/** Invalidate all entries in TLB that belong to specified address space.
- *
- * @param asid Address Space ID.
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	uintptr_t val = (uintptr_t)asid << TLBI_ASID_SHIFT;
-
-	asm volatile (
-	    /* TLB Invalidate by ASID, EL1, Inner Shareable. */
-	    "tlbi aside1is, %[val]\n"
-	    /* Ensure completion on all PEs. */
-	    "dsb ish\n"
-	    /* Synchronize context on this PE. */
-	    "isb\n"
-	    : : [val] "r" (val) : "memory"
-	);
-}
-
-/** Invalidate TLB entries for specified page range belonging to specified
- * address space.
- *
- * @param asid Address Space ID.
- * @param page Address of the first page whose entry is to be invalidated.
- * @param cnt  Number of entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	for (size_t i = 0; i < cnt; i++) {
-		uintptr_t val;
-
-		val = (page + i * PAGE_SIZE) >> PAGE_WIDTH;
-		val |= (uintptr_t) asid << TLBI_ASID_SHIFT;
-
-		asm volatile (
-		    /* TLB Invalidate by Virt. Address, EL1, Inner Shareable. */
-		    "tlbi vae1is, %[val]\n"
-		    /* Ensure completion on all PEs. */
-		    "dsb ish\n"
-		    /* Synchronize context on this PE. */
-		    "isb\n"
-		    : : [val] "r" (val) : "memory"
-		);
-	}
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/arm64/src/smp/ipi.c
===================================================================
--- kernel/arch/arm64/src/smp/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- */
-
-#ifdef CONFIG_SMP
-
-#include <smp/ipi.h>
-#include <panic.h>
-
-/** Deliver IPI to all processors except the current one.
- *
- * @param ipi IPI number.
- */
-void ipi_broadcast_arch(int ipi)
-{
-	panic("broadcast IPI not implemented.");
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/arm64/src/smp/smp.c
===================================================================
--- kernel/arch/arm64/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_arm64
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-
-#ifdef CONFIG_SMP
-
-void smp_init(void)
-{
-}
-
-void kmp(void *arg)
-{
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/arm64/src/start.S
===================================================================
--- kernel/arch/arm64/src/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,379 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/mm/km.h>
-#include <arch/mm/page.h>
-#include <arch/regutils.h>
-
-.section K_TEXT_START, "ax"
-
-.macro dcache_flush addr size temp0 temp1
-	mov \temp0, \addr
-	mov \temp1, xzr
-
-	0:
-		/* Data or Unified Cache Line Clean */
-		dc cvau, \temp0
-		add \temp0, \temp0, #4
-		add \temp1, \temp1, #4
-		cmp \temp1, \size
-		blo 0b
-
-	dsb ish
-	isb
-.endm
-
-/** Kernel entry
- *
- * MMU must be disabled at this point.
- *
- * @param x0 Kernel entry point (kernel_image_start).
- * @param x1 Pointer to the bootinfo structure.
- *
- */
-SYMBOL(kernel_image_start)
-	/* Get address of the main memory and remember it. */
-	adrp x20, kernel_image_start - BOOT_OFFSET
-	adrp x2, physmem_base
-	str x20, [x2]
-
-	/* Flush the data cache of physmem_base. */
-	mov x28, #8
-	dcache_flush x2 x28 x29 x30
-
-	/*
-	 * Set up address translation that identity maps the 1 GiB area that
-	 * is holding the current execution page.
-	 */
-
-	/* Prepare the level 0 page table. */
-	adrp x2, lower_page_table_level0
-	lsr x3, x20, #PTL0_VA_SHIFT
-	and x3, x3, #PTL0_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    PTE_L012_TYPE_TABLE << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	adrp x4, lower_page_table_level1
-	lsr x4, x4, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_NEXT_LEVEL_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* Prepare the level 1 page table. */
-	adrp x2, lower_page_table_level1
-	lsr x3, x20, #PTL1_VA_SHIFT
-	and x3, x3, #PTL1_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    MAIR_EL1_NORMAL_MEMORY_INDEX << PTE_ATTR_INDEX_SHIFT | \
-	    PTE_L012_TYPE_BLOCK << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	lsr x4, x20, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_OUTPUT_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/*
-	 * Set up address translation that maps the first 4 GiB of the kernel
-	 * identity virtual address space to the first 4 GiB of the physical
-	 * memory.
-	 */
-
-	mov x21, #KM_ARM64_IDENTITY_START
-	ldr x22, =(1024 * 1024 * 1024)
-
-	/* Prepare the level 0 page table. */
-	adrp x2, upper_page_table_level0
-	lsr x3, x21, #PTL0_VA_SHIFT
-	and x3, x3, #PTL0_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    PTE_L012_TYPE_TABLE << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	adrp x4, upper_page_table_level1
-	lsr x4, x4, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_NEXT_LEVEL_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* Prepare the level 1 page table. */
-	adrp x2, upper_page_table_level1
-	lsr x3, x21, #PTL1_VA_SHIFT
-	and x3, x3, #PTL1_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    MAIR_EL1_NORMAL_MEMORY_INDEX << PTE_ATTR_INDEX_SHIFT | \
-	    PTE_L012_TYPE_BLOCK << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	lsr x4, x20, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_OUTPUT_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* 2nd GiB */
-	add x23, x20, x22
-	add x24, x21, x22
-
-	adrp x2, upper_page_table_level1
-	lsr x3, x24, #PTL1_VA_SHIFT
-	and x3, x3, #PTL1_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    MAIR_EL1_NORMAL_MEMORY_INDEX << PTE_ATTR_INDEX_SHIFT | \
-	    PTE_L012_TYPE_BLOCK << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	lsr x4, x23, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_OUTPUT_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* 3rd GiB */
-	add x23, x23, x22
-	add x24, x24, x22
-
-	adrp x2, upper_page_table_level1
-	lsr x3, x24, #PTL1_VA_SHIFT
-	and x3, x3, #PTL1_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    MAIR_EL1_NORMAL_MEMORY_INDEX << PTE_ATTR_INDEX_SHIFT | \
-	    PTE_L012_TYPE_BLOCK << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	lsr x4, x23, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_OUTPUT_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* 4th GiB */
-	add x23, x23, x22
-	add x24, x24, x22
-
-	adrp x2, upper_page_table_level1
-	lsr x3, x24, #PTL1_VA_SHIFT
-	and x3, x3, #PTL1_VA_MASK
-	add x2, x2, x3, lsl #PTL_ENTRY_SIZE_SHIFT
-	mov x3, #( \
-	    1 << PTE_ACCESS_SHIFT | \
-	    MAIR_EL1_DEVICE_MEMORY_INDEX << PTE_ATTR_INDEX_SHIFT | \
-	    PTE_L012_TYPE_BLOCK << PTE_TYPE_SHIFT | \
-	    1 << PTE_PRESENT_SHIFT)
-	lsr x4, x23, #FRAME_WIDTH
-	orr x3, x3, x4, lsl #PTE_OUTPUT_ADDRESS_SHIFT
-	str x3, [x2]
-
-	/* Flush the data cache of page tables. */
-	adrp x27, lower_page_table_level0
-	mov x28, #4096
-	dcache_flush x27 x28 x29 x30
-
-	adrp x27, lower_page_table_level1
-	mov x28, #4096
-	dcache_flush x27 x28 x29 x30
-
-	adrp x27, upper_page_table_level0
-	mov x28, #4096
-	dcache_flush x27 x28 x29 x30
-
-	adrp x27, upper_page_table_level1
-	mov x28, #4096
-	dcache_flush x27 x28 x29 x30
-
-	/* Make sure there are not any stale TLB entries. */
-	tlbi vmalle1is
-	dsb ish
-
-	/*
-	 * Set TCR_EL1:
-	 * [63:39] - Reserved 0.
-	 * [38]    - TBI1=0, top byte of an address is used in the address
-	 *           calculation for the TTBR1_EL1 region.
-	 * [37]    - TBI0=0, top byte of an address is used in the address
-	 *           calculation for the TTBR0_EL1 region.
-	 * [36]    - AS=1, the upper 16 bits of TTBR0_EL1 and TTBR1_EL1 are used
-	 *           for allocation and matching in the TLB.
-	 * [35]    - Reserved 0.
-	 * [34:32] - IPS=101, intermediate physical address size is 48 bits,
-	 *           256TB.
-	 * [31:30] - TG1=10, TTBR1_EL1 granule size is 4KB.
-	 * [29:28] - SH1=11, memory associated with translation table walks
-	 *           using TTBR1_EL1 is inner shareable.
-	 * [27:26] - ORGN1=01, memory associated with translation table walks
-	 *           using TTBR1_EL1 is normal memory, outer write-through
-	 *           cacheable.
-	 * [25:24] - IRGN1=01, memory associated with translation table walks
-	 *           using TTBR1_EL1 is normal memory, inner write-back
-	 *           write-allocate cacheable.
-	 * [23]    - EPD1=0, perform translation table walks using TTBR1_EL1.
-	 * [22]    - A1=0, TTBR0_EL1.ASID defines the ASID.
-	 * [21:16] - T1SZ=010000, size of the memory region addressed by
-	 *           TTBR1_EL1 is 2^(64 - 16) bytes.
-	 * [15:14] - TG0=00, TTBR0_EL1 granule size is 4KB.
-	 * [13:12] - SH0=11, memory associated with translation table walks
-	 *           using TTBR0_EL1 is inner shareable.
-	 * [11:10] - ORGN0=01, memory associated with translation table walks
-	 *           using TTBR0_EL1 is normal memory, outer write-through
-	 *           cacheable.
-	 * [9:8]   - IRGN0=01, memory associated with translation table walks
-	 *           using TTBR0_EL1 is normal memory, inner write-back
-	 *           write-allocate cacheable.
-	 * [7]     - EPD0=0, perform translation table walks using TTBR0.
-	 * [6]     - Reserved 0.
-	 * [5:0]   - T0SZ=010000, size of the memory region addressed by
-	 *           TTBR0_EL1 is 2^(64 - 16) bytes.
-	 */
-	ldr x2, =0x00000015b5103510
-	msr tcr_el1, x2
-
-	/* Initialize memory attributes. */
-	ldr x2, =(MAIR_EL1_DEVICE_MEMORY_ATTR << \
-	    (MAIR_EL1_DEVICE_MEMORY_INDEX * MAIR_EL1_ATTR_SHIFT) | \
-	    MAIR_EL1_NORMAL_MEMORY_ATTR << \
-	    (MAIR_EL1_NORMAL_MEMORY_INDEX * MAIR_EL1_ATTR_SHIFT))
-	msr mair_el1, x2
-
-	/* Set translation tables. */
-	adrp x2, lower_page_table_level0
-	msr ttbr0_el1, x2
-	adrp x2, upper_page_table_level0
-	msr ttbr1_el1, x2
-	isb
-
-	/*
-	 * Set SCTLR_EL1:
-	 * [31:30] - Reserved 0.
-	 * [29:28] - Reserved 1.
-	 * [27]    - Reserved 0.
-	 * [26]    - UCI=0, any attempt to execute cache maintenance
-	 *           instructions at EL0 is trapped to EL1.
-	 * [25]    - EE=0, explicit data accesses at EL1, and stage 1
-	 *           translation table walks in the EL1&0 translation regime are
-	 *           little-endian.
-	 * [24]    - E0E=0, explicit data accesses at EL1 are little-endian.
-	 * [23:22] - Reserved 1.
-	 * [21]    - Reserved 0.
-	 * [20]    - Reserved 1.
-	 * [19]    - WXN=0, regions with write permission are not forced to
-	 *           Execute Never.
-	 * [18]    - nTWE=0, any attempt to execute WFE at EL0 is trapped to
-	 *           EL1.
-	 * [17]    - Reserved 0.
-	 * [16]    - nTWI=0, any attempt to execute WFI at EL0 is trapped to
-	 *           EL1.
-	 * [15]    - UCT=0, accesses to CTR_EL0 from EL0 are trapped to EL1.
-	 * [14]    - DZE=0, any attempt to execute DC ZVA at EL0 is trapped to
-	 *           EL1.
-	 * [13]    - Reserved 0.
-	 * [12]    - I=1, this control has no effect on the cacheability of
-	 *           instruction access to normal memory.
-	 * [11]    - Reserved 1.
-	 * [10]    - Reserved 0.
-	 * [9]     - UMA=0, any attempt to execute MSR/MRS that accesses DAIF at
-	 *           EL0 is trapped to EL1.
-	 * [8]     - SED=1, SETEND is undefined at EL0 using AArch32.
-	 * [7]     - ITD=1, disables some uses of IT at EL0 using AArch32.
-	 * [6]     - Reserved 0.
-	 * [5]     - CP15BEN=0, CP15DMB/DSB/ISB is undefined at EL0 using
-	 *           AArch32.
-	 * [4]     - SA0=1, use of stack pointer with load/store at EL0 must be
-	 *           aligned to a 16-byte boundary.
-	 * [3]     - SA=1, use of stack pointer with load/store at EL1 must be
-	 *           aligned to a 16-byte boundary.
-	 * [2]     - C=1, this control has no effect on the cacheability of data
-	 *           access to normal memory from EL0 and EL1, and normal memory
-	 *           accesses to the EL1&0 stage 1 translation tables.
-	 * [1]     - A=0, instructions that load/store registers (other than
-	 *           load/store exclusive and load-acquire/store-release) do not
-	 *           check that the address being accessed is aligned to the
-	 *           size of the data element(s) being accessed.
-	 * [0]     - M=1, EL1 and EL0 stage 1 address translation enabled.
-	 */
-	ldr w2, =0x30d0199d
-	msr sctlr_el1, x2
-	isb
-
-	/*
-	 * MMU is enabled at this point (SCTLR_EL1.M=1), switch to the kernel
-	 * mapping.
-	 */
-	ldr x2, =1f
-	br x2
-1:
-
-	/* Disable access to low addresses. */
-	mov x2, #0
-	msr ttbr0_el1, x2
-	isb
-	tlbi vmalle1is
-	dsb ish
-
-	/* Jump on a temporary stack. */
-	ldr x2, =temp_stack
-	mov sp, x2
-
-	/* Create the first stack frame. */
-	mov x29, #0
-	mov x30, #0
-	stp x29, x30, [sp, #-16]!
-	mov x29, sp
-
-	/* PA2KA(bootinfo). */
-	sub x1, x1, x20
-	ldr x2, =KM_ARM64_IDENTITY_START
-	add x1, x1, x2
-
-	bl arm64_pre_main
-	bl main_bsp
-
-.section K_DATA_START, "ax"
-
-	/* Page tables. */
-.align 12
-lower_page_table_level0:
-	.space 4096
-
-lower_page_table_level1:
-	.space 4096
-
-upper_page_table_level0:
-	.space 4096
-
-upper_page_table_level1:
-	.space 4096
-
-	/* Physical memory base address. */
-.align 12
-SYMBOL(physmem_base)
-	.quad 0
-
-	/* Temporary stack. */
-.align 10
-	.space 1024
-temp_stack:
Index: rnel/arch/ia32/_link.ld.in
===================================================================
--- kernel/arch/ia32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/** IA-32 linker script
- *
- * umapped section:
- *  kernel text
- *  kernel data
- * mapped section:
- *  kernel text
- *  kernel data
- */
-
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-
-SECTIONS {
-	kernel_load_address = PA2KA(BOOT_OFFSET);
-
-	.unmapped (BOOT_OFFSET + SIZEOF_HEADERS): AT (BOOT_OFFSET + SIZEOF_HEADERS) {
-		unmapped_start = .;
-		KEEP(*(K_TEXT_START));
-		KEEP(*(K_DATA_START));
-		unmapped_end = .;
-	}
-
-	.text (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS + SIZEOF(.unmapped)): AT (BOOT_OFFSET + SIZEOF_HEADERS + SIZEOF(.unmapped)) {
-		ktext_start = .;
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		*(.rodata .rodata.*);  /* read-only global variables */
-		*(.data .data.*);      /* non-zero initialized global variables */
-
-		/*
-		 * When .bss is not physically present in the ELF file (MemSz > FileSz)
-		 * the kernel crashes during early boot. Not sure which part of the
-		 * boot process is to blame, for now just keep .bss packaged with .data
-		 * so that FileSz == MemSz.
-		 */
-
-		 *(.bss .bss.*);        /* uninitialized global variables */
-		*(COMMON);             /* non-`static` global variables without an extern declaration */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-
-#ifdef CONFIG_SMP
-
-	ap_boot = unmapped_ap_boot - BOOT_OFFSET + AP_BOOT_OFFSET;
-	ap_gdtr = unmapped_ap_gdtr - BOOT_OFFSET + AP_BOOT_OFFSET;
-	protected_ap_gdtr = PA2KA(ap_gdtr);
-
-#endif /* CONFIG_SMP */
-
-}
Index: rnel/arch/ia32/include/arch/arch.h
===================================================================
--- kernel/arch/ia32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_ARCH_H_
-#define KERN_ia32_ARCH_H_
-
-#include <stdint.h>
-
-extern void ia32_pre_main(uint32_t, void *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/asm.h
===================================================================
--- kernel/arch/ia32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,518 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2005 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_ASM_H_
-#define KERN_ia32_ASM_H_
-
-#include <arch/pm.h>
-#include <arch/cpu.h>
-#include <typedefs.h>
-#include <config.h>
-#include <trace.h>
-
-/** Halt CPU
- *
- * Halt the current CPU.
- *
- */
-_NO_TRACE static inline __attribute__((noreturn)) void cpu_halt(void)
-{
-	while (true) {
-		asm volatile (
-		    "hlt\n"
-		);
-	}
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	asm volatile (
-	    "sti\n"
-	    "hlt\n"
-	    "cli\n"
-	);
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-	asm volatile (
-	    "pause\n"
-	);
-}
-
-#define GEN_READ_REG(reg) _NO_TRACE static inline sysarg_t read_ ##reg (void) \
-	{ \
-		sysarg_t res; \
-		asm volatile ( \
-			"movl %%" #reg ", %[res]" \
-			: [res] "=r" (res) \
-		); \
-		return res; \
-	}
-
-#define GEN_WRITE_REG(reg) _NO_TRACE static inline void write_ ##reg (sysarg_t regn) \
-	{ \
-		asm volatile ( \
-			"movl %[regn], %%" #reg \
-			:: [regn] "r" (regn) \
-		); \
-	}
-
-GEN_READ_REG(cr0);
-GEN_READ_REG(cr2);
-GEN_READ_REG(cr3);
-GEN_WRITE_REG(cr3);
-
-GEN_WRITE_REG(cr0);
-
-GEN_READ_REG(dr0);
-GEN_READ_REG(dr1);
-GEN_READ_REG(dr2);
-GEN_READ_REG(dr3);
-GEN_READ_REG(dr6);
-GEN_READ_REG(dr7);
-
-GEN_WRITE_REG(dr0);
-GEN_WRITE_REG(dr1);
-GEN_WRITE_REG(dr2);
-GEN_WRITE_REG(dr3);
-GEN_WRITE_REG(dr6);
-GEN_WRITE_REG(dr7);
-
-#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
-
-/** Byte to port
- *
- * Output byte to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outb %b[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-/** Word to port
- *
- * Output word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outw %w[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-/** Double word to port
- *
- * Output double word to port
- *
- * @param port Port to write to
- * @param val Value to write
- *
- */
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outl %[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-/** Byte from port
- *
- * Get byte from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	if (((void *)port) < IO_SPACE_BOUNDARY) {
-		uint8_t val;
-
-		asm volatile (
-		    "inb %w[port], %b[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint8_t) *port;
-}
-
-/** Word from port
- *
- * Get word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	if (((void *)port) < IO_SPACE_BOUNDARY) {
-		uint16_t val;
-
-		asm volatile (
-		    "inw %w[port], %w[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint16_t) *port;
-}
-
-/** Double word from port
- *
- * Get double word from port
- *
- * @param port Port to read from
- * @return Value read
- *
- */
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	if (((void *)port) < IO_SPACE_BOUNDARY) {
-		uint32_t val;
-
-		asm volatile (
-		    "inl %w[port], %[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint32_t) *port;
-}
-
-_NO_TRACE static inline uint32_t read_eflags(void)
-{
-	uint32_t eflags;
-
-	asm volatile (
-	    "pushf\n"
-	    "popl %[v]\n"
-	    : [v] "=r" (eflags)
-	);
-
-	return eflags;
-}
-
-_NO_TRACE static inline void write_eflags(uint32_t eflags)
-{
-	asm volatile (
-	    "pushl %[v]\n"
-	    "popf\n"
-	    :: [v] "r" (eflags)
-	);
-}
-
-/** Return interrupt priority level.
- *
- * @return Current interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	return (ipl_t) read_eflags();
-}
-
-/** Enable interrupts.
- *
- * Enable interrupts and return the previous interrupt priority level.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	ipl_t ipl = interrupts_read();
-
-	asm volatile ("sti\n");
-
-	return ipl;
-}
-
-/** Disable interrupts.
- *
- * Disable interrupts and return the previous interrupt priority level.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	ipl_t ipl = interrupts_read();
-
-	asm volatile ("cli\n");
-
-	return ipl;
-}
-
-/** Restore interrupt priority level.
- *
- * Restore a saved interrupt priority level.
- *
- * @param ipl Saved interrupt priority level.
- *
- */
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	write_eflags((uint32_t) ipl);
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	return ((read_eflags() & EFLAGS_IF) == 0);
-}
-
-#ifndef PROCESSOR_i486
-
-/** Write to MSR */
-_NO_TRACE static inline void write_msr(uint32_t msr, uint64_t value)
-{
-	asm volatile (
-	    "wrmsr"
-	    :: "c" (msr),
-	      "a" ((uint32_t) (value)),
-	      "d" ((uint32_t) (value >> 32))
-	);
-}
-
-_NO_TRACE static inline uint64_t read_msr(uint32_t msr)
-{
-	uint32_t ax, dx;
-
-	asm volatile (
-	    "rdmsr"
-	    : "=a" (ax),
-	      "=d" (dx)
-	    : "c" (msr)
-	);
-
-	return ((uint64_t) dx << 32) | ax;
-}
-
-#endif /* PROCESSOR_i486 */
-
-/** Invalidate TLB Entry.
- *
- * @param addr Address on a page whose TLB entry is to be invalidated.
- *
- */
-_NO_TRACE static inline void invlpg(uintptr_t addr)
-{
-	asm volatile (
-	    "invlpg %[addr]\n"
-	    :: [addr] "m" (*(sysarg_t *) addr)
-	);
-}
-
-/** Load GDTR register from memory.
- *
- * @param gdtr_reg Address of memory from where to load GDTR.
- *
- */
-_NO_TRACE static inline void gdtr_load(ptr_16_32_t *gdtr_reg)
-{
-	asm volatile (
-	    "lgdtl %[gdtr_reg]\n"
-	    :: [gdtr_reg] "m" (*gdtr_reg)
-	);
-}
-
-/** Store GDTR register to memory.
- *
- * @param gdtr_reg Address of memory to where to load GDTR.
- *
- */
-_NO_TRACE static inline void gdtr_store(ptr_16_32_t *gdtr_reg)
-{
-	asm volatile (
-	    "sgdtl %[gdtr_reg]\n"
-	    : [gdtr_reg] "=m" (*gdtr_reg)
-	);
-}
-
-/** Load IDTR register from memory.
- *
- * @param idtr_reg Address of memory from where to load IDTR.
- *
- */
-_NO_TRACE static inline void idtr_load(ptr_16_32_t *idtr_reg)
-{
-	asm volatile (
-	    "lidtl %[idtr_reg]\n"
-	    :: [idtr_reg] "m" (*idtr_reg)
-	);
-}
-
-/** Load TR from descriptor table.
- *
- * @param sel Selector specifying descriptor of TSS segment.
- *
- */
-_NO_TRACE static inline void tr_load(uint16_t sel)
-{
-	asm volatile (
-	    "ltr %[sel]"
-	    :: [sel] "r" (sel)
-	);
-}
-
-/** Load GS from descriptor table.
- *
- * @param sel Selector specifying descriptor of the GS segment.
- *
- */
-_NO_TRACE static inline void gs_load(uint16_t sel)
-{
-	asm volatile (
-	    "mov %[sel], %%gs"
-	    :: [sel] "r" (sel)
-	);
-}
-
-extern void paging_on(void);
-extern void enable_l_apic_in_msr(void);
-
-extern void asm_delay_loop(uint32_t);
-extern void asm_fake_loop(uint32_t);
-
-extern uintptr_t int_syscall;
-
-extern uintptr_t int_0;
-extern uintptr_t int_1;
-extern uintptr_t int_2;
-extern uintptr_t int_3;
-extern uintptr_t int_4;
-extern uintptr_t int_5;
-extern uintptr_t int_6;
-extern uintptr_t int_7;
-extern uintptr_t int_8;
-extern uintptr_t int_9;
-extern uintptr_t int_10;
-extern uintptr_t int_11;
-extern uintptr_t int_12;
-extern uintptr_t int_13;
-extern uintptr_t int_14;
-extern uintptr_t int_15;
-extern uintptr_t int_16;
-extern uintptr_t int_17;
-extern uintptr_t int_18;
-extern uintptr_t int_19;
-extern uintptr_t int_20;
-extern uintptr_t int_21;
-extern uintptr_t int_22;
-extern uintptr_t int_23;
-extern uintptr_t int_24;
-extern uintptr_t int_25;
-extern uintptr_t int_26;
-extern uintptr_t int_27;
-extern uintptr_t int_28;
-extern uintptr_t int_29;
-extern uintptr_t int_30;
-extern uintptr_t int_31;
-extern uintptr_t int_32;
-extern uintptr_t int_33;
-extern uintptr_t int_34;
-extern uintptr_t int_35;
-extern uintptr_t int_36;
-extern uintptr_t int_37;
-extern uintptr_t int_38;
-extern uintptr_t int_39;
-extern uintptr_t int_40;
-extern uintptr_t int_41;
-extern uintptr_t int_42;
-extern uintptr_t int_43;
-extern uintptr_t int_44;
-extern uintptr_t int_45;
-extern uintptr_t int_46;
-extern uintptr_t int_47;
-extern uintptr_t int_48;
-extern uintptr_t int_49;
-extern uintptr_t int_50;
-extern uintptr_t int_51;
-extern uintptr_t int_52;
-extern uintptr_t int_53;
-extern uintptr_t int_54;
-extern uintptr_t int_55;
-extern uintptr_t int_56;
-extern uintptr_t int_57;
-extern uintptr_t int_58;
-extern uintptr_t int_59;
-extern uintptr_t int_60;
-extern uintptr_t int_61;
-extern uintptr_t int_62;
-extern uintptr_t int_63;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/bios/bios.h
===================================================================
--- kernel/arch/ia32/include/arch/bios/bios.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_BIOS_H_
-#define KERN_ia32_BIOS_H_
-
-#include <typedefs.h>
-
-extern uintptr_t ebda;
-
-extern void bios_init(void);
-
-#endif /* KERN_ia32_BIOS_H_ */
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/boot/boot.h
===================================================================
--- kernel/arch/ia32/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_BOOT_H_
-#define KERN_ia32_BOOT_H_
-
-#define BOOT_OFFSET      0x108000
-#define AP_BOOT_OFFSET   0x8000
-#define BOOT_STACK_SIZE  0x0400
-
-#ifndef __ASSEMBLER__
-
-#ifdef CONFIG_SMP
-
-extern uint8_t unmapped_end[];
-
-#endif /* CONFIG_SMP */
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/boot/memmap.h
===================================================================
--- kernel/arch/ia32/include/arch/boot/memmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_MEMMAP_H_
-#define KERN_ia32_MEMMAP_H_
-
-#include <arch/boot/memmap_struct.h>
-
-/* E820h memory range types */
-
-/* Free memory */
-#define MEMMAP_MEMORY_AVAILABLE  1
-
-/* Not available for OS */
-#define MEMMAP_MEMORY_RESERVED   2
-
-/* OS may use it after reading ACPI table */
-#define MEMMAP_MEMORY_ACPI       3
-
-/* Unusable, required to be saved and restored across an NVS sleep */
-#define MEMMAP_MEMORY_NVS        4
-
-/* Corrupted memory */
-#define MEMMAP_MEMORY_UNUSABLE   5
-
-/* Size of one entry */
-#define MEMMAP_E820_RECORD_SIZE  20
-
-/* Maximum entries */
-#define MEMMAP_E820_MAX_RECORDS  32
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-extern e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
-extern uint8_t e820counter;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/boot/memmap_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/boot/memmap_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
-#define KERN_ARCH_BOOT_MEMMAP_STRUCT_H_
-
-#define E820MEMMAP_OFFSET_BASE_ADDRESS  0x00
-#define E820MEMMAP_OFFSET_SIZE          0x08
-#define E820MEMMAP_OFFSET_TYPE          0x10
-#define E820MEMMAP_SIZE                 0x14
-
-#define E820MEMMAP_SIZE_SIZE            0x08
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct e820memmap {
-	uint64_t base_address;
-	uint64_t size;
-	uint32_t type;
-} __attribute__((packed)) e820memmap_t;
-
-#endif
-#endif
Index: rnel/arch/ia32/include/arch/context.h
===================================================================
--- kernel/arch/ia32/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_CONTEXT_H_
-#define KERN_ia32_CONTEXT_H_
-
-#include <typedefs.h>
-#include <arch/context_struct.h>
-
-#define STACK_ITEM_SIZE  4
-
-/*
- * Both context_save() and context_restore() eat two doublewords from the stack.
- * First for pop of the saved register, second during ret instruction.
- *
- * One item is put onto stack to support CURRENT.
- */
-#define SP_DELTA  (8 + STACK_ITEM_SIZE)
-
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = (uintptr_t) (_pc); \
-		(c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-		(c)->ebp = 0; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/context_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x04
-#define CONTEXT_OFFSET_EBX  0x08
-#define CONTEXT_OFFSET_ESI  0x0c
-#define CONTEXT_OFFSET_EDI  0x10
-#define CONTEXT_OFFSET_EBP  0x14
-#define CONTEXT_OFFSET_TP   0x18
-#define CONTEXT_SIZE        0x1c
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-/* Only save registers that must be preserved across function calls. */
-typedef struct context {
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t ebx;
-	uint32_t esi;
-	uint32_t edi;
-	uint32_t ebp;
-	uint32_t tp;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/ia32/include/arch/cpu.h
===================================================================
--- kernel/arch/ia32/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_CPU_H_
-#define KERN_ia32_CPU_H_
-
-#define EFLAGS_IF	(1 << 9)
-#define EFLAGS_DF	(1 << 10)
-#define EFLAGS_IOPL	(3 << 12)
-#define EFLAGS_NT	(1 << 14)
-#define EFLAGS_RF	(1 << 16)
-#define EFLAGS_ID	(1 << 21)
-
-#define CR0_PE		(1 << 0)
-#define CR0_TS		(1 << 3)
-#define CR0_AM		(1 << 18)
-#define CR0_NW		(1 << 29)
-#define CR0_CD		(1 << 30)
-#define CR0_PG		(1 << 31)
-
-#define CR4_PSE		(1 << 4)
-#define CR4_PAE		(1 << 5)
-#define CR4_OSFXSR	(1 << 9)
-#define CR4_OSXMMEXCPT	(1 << 10)
-
-#define IA32_APIC_BASE_GE	(1 << 11)
-
-#define IA32_MSR_APIC_BASE	0x01b
-
-/* Support for SYSENTER and SYSEXIT */
-#define IA32_MSR_SYSENTER_CS	0x174
-#define IA32_MSR_SYSENTER_ESP	0x175
-#define IA32_MSR_SYSENTER_EIP	0x176
-
-#ifndef __ASSEMBLER__
-
-#include <arch/pm.h>
-#include <arch/asm.h>
-#include <arch/cpuid.h>
-
-typedef struct {
-	unsigned int vendor;
-	unsigned int family;
-	unsigned int model;
-	unsigned int stepping;
-	cpuid_feature_info_t fi;
-
-	unsigned int id; /** CPU's local, ie physical, APIC ID. */
-
-	tss_t *tss;
-
-	size_t iomapver_copy;  /** Copy of TASK's I/O Permission bitmap generation count. */
-} cpu_arch_t;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/cpuid.h
===================================================================
--- kernel/arch/ia32/include/arch/cpuid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_CPUID_H_
-#define KERN_ia32_CPUID_H_
-
-#define INTEL_CPUID_LEVEL     0x00000000
-#define INTEL_CPUID_STANDARD  0x00000001
-#define INTEL_PSE             3
-#define INTEL_SEP             11
-
-#ifndef __ASSEMBLER__
-
-#include <arch/cpu.h>
-#include <stdint.h>
-
-typedef struct {
-	uint32_t cpuid_eax;
-	uint32_t cpuid_ebx;
-	uint32_t cpuid_ecx;
-	uint32_t cpuid_edx;
-} __attribute__((packed)) cpu_info_t;
-
-struct cpuid_extended_feature_info {
-	unsigned int sse3 : 1;
-	unsigned int : 31;
-} __attribute__((packed));
-
-typedef union {
-	struct cpuid_extended_feature_info bits;
-	uint32_t word;
-} cpuid_extended_feature_info_t;
-
-struct cpuid_feature_info {
-	unsigned int : 11;
-	unsigned int sep  : 1;
-	unsigned int : 11;
-	unsigned int mmx  : 1;
-	unsigned int fxsr : 1;
-	unsigned int sse  : 1;
-	unsigned int sse2 : 1;
-	unsigned int : 5;
-} __attribute__((packed));
-
-typedef union {
-	struct cpuid_feature_info bits;
-	uint32_t word;
-} cpuid_feature_info_t;
-
-static inline uint32_t has_cpuid(void)
-{
-	uint32_t val;
-	uint32_t ret;
-
-	asm volatile (
-	    "pushf\n"                      /* read flags */
-	    "popl %[ret]\n"
-	    "movl %[ret], %[val]\n"
-
-	    "xorl %[eflags_id], %[val]\n"  /* swap the ID bit */
-
-	    "pushl %[val]\n"               /* propagate the change into flags */
-	    "popf\n"
-	    "pushf\n"
-	    "popl %[val]\n"
-
-	    "andl %[eflags_id], %[ret]\n"  /* interrested only in ID bit */
-	    "andl %[eflags_id], %[val]\n"
-	    "xorl %[val], %[ret]\n"
-	    : [ret] "=r" (ret), [val] "=r" (val)
-	    : [eflags_id] "i" (EFLAGS_ID)
-	);
-
-	return ret;
-}
-
-static inline void cpuid(uint32_t cmd, cpu_info_t *info)
-{
-	asm volatile (
-	    "cpuid\n"
-	    : "=a" (info->cpuid_eax), "=b" (info->cpuid_ebx),
-	      "=c" (info->cpuid_ecx), "=d" (info->cpuid_edx)
-	    : "a" (cmd)
-	);
-}
-
-#endif /* !def __ASSEMBLER__ */
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/cycle.h
===================================================================
--- kernel/arch/ia32/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_CYCLE_H_
-#define KERN_ia32_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-#ifdef PROCESSOR_i486
-	return 0;
-#else
-	uint64_t v;
-
-	asm volatile (
-	    "rdtsc\n"
-	    : "=A" (v)
-	);
-
-	return v;
-#endif
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/ddi/ddi.h
===================================================================
--- kernel/arch/ia32/include/arch/ddi/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_ddi
- * @{
- */
-/**
- * @file
- * @brief ia32 specific DDI declarations and macros.
- */
-
-#ifndef KERN_ia32_DDI_H_
-#define KERN_ia32_DDI_H_
-
-extern void io_perm_bitmap_install(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/drivers/i8254.h
===================================================================
--- kernel/arch/ia32/include/arch/drivers/i8254.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_I8254_H_
-#define KERN_ia32_I8254_H_
-
-extern void i8254_init(void);
-extern void i8254_calibrate_delay_loop(void);
-extern void i8254_normal_operation(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/faddr.h
===================================================================
--- kernel/arch/ia32/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_FADDR_H_
-#define KERN_ia32_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/fpu_context.h
===================================================================
--- kernel/arch/ia32/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_FPU_CONTEXT_H_
-#define KERN_ia32_FPU_CONTEXT_H_
-
-#include <stdint.h>
-
-typedef struct {
-	_Alignas(16) uint8_t fpu[512];  /* FXSAVE & FXRSTOR storage area */
-} fpu_context_t;
-
-extern void fpu_fxsr(void);
-extern void fpu_fsr(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/interrupt.h
===================================================================
--- kernel/arch/ia32/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_INTERRUPT_H_
-#define KERN_ia32_INTERRUPT_H_
-
-#include <arch/istate.h>
-#include <arch/pm.h>
-#include <stdint.h>
-
-#define IVT_ITEMS  IDT_ITEMS
-#define IVT_FIRST  0
-
-#define EXC_COUNT  32
-#define IRQ_COUNT  16
-
-#define IVT_EXCBASE   0
-#define IVT_IRQBASE   (IVT_EXCBASE + EXC_COUNT)
-#define IVT_FREEBASE  (IVT_IRQBASE + IRQ_COUNT)
-
-#define EXC_DE 0
-#define EXC_DB 1
-#define EXC_NM 7
-#define EXC_SS 12
-#define EXC_GP 13
-#define EXC_PF 14
-#define EXC_XM 19
-
-#define IRQ_CLK       0
-#define IRQ_KBD       1
-#define IRQ_PIC1      2
-/* NS16550 at COM1 */
-#define IRQ_NS16550   4
-#define IRQ_PIC0_SPUR 7
-#define IRQ_MOUSE     12
-#define IRQ_PIC1_SPUR 15
-
-/* This one must have four least significant bits set to ones */
-#define VECTOR_APIC_SPUR  (IVT_ITEMS - 1)
-
-#if (((VECTOR_APIC_SPUR + 1) % 16) || VECTOR_APIC_SPUR >= IVT_ITEMS)
-#error Wrong definition of VECTOR_APIC_SPUR
-#endif
-
-#define VECTOR_DE                 (IVT_EXCBASE + EXC_DE)
-#define VECTOR_DB                 (IVT_EXCBASE + EXC_DB)
-#define VECTOR_NM                 (IVT_EXCBASE + EXC_NM)
-#define VECTOR_SS                 (IVT_EXCBASE + EXC_SS)
-#define VECTOR_GP                 (IVT_EXCBASE + EXC_GP)
-#define VECTOR_PF                 (IVT_EXCBASE + EXC_PF)
-#define VECTOR_XM                 (IVT_EXCBASE + EXC_XM)
-#define VECTOR_CLK                (IVT_IRQBASE + IRQ_CLK)
-#define VECTOR_PIC0_SPUR          (IVT_IRQBASE + IRQ_PIC0_SPUR)
-#define VECTOR_PIC1_SPUR          (IVT_IRQBASE + IRQ_PIC1_SPUR)
-#define VECTOR_SYSCALL            IVT_FREEBASE
-#define VECTOR_TLB_SHOOTDOWN_IPI  (IVT_FREEBASE + 1)
-#define VECTOR_DEBUG_IPI          (IVT_FREEBASE + 2)
-
-extern void interrupt_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/istate.h
===================================================================
--- kernel/arch/ia32/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_ISTATE_H_
-#define KERN_ia32_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-#include <arch/istate_struct.h>
-#else
-#include <libarch/istate_struct.h>
-#endif /* KERNEL */
-
-#define RPL_USER	3
-
-/** Return true if exception happened while in userspace */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return (istate->cs & RPL_USER) == RPL_USER;
-}
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->eip = retaddr;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->eip;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	return istate->ebp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ia32/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_EDX 0
-#define ISTATE_SIZE_EDX 4
-#define ISTATE_OFFSET_ECX 4
-#define ISTATE_SIZE_ECX 4
-#define ISTATE_OFFSET_EBX 8
-#define ISTATE_SIZE_EBX 4
-#define ISTATE_OFFSET_ESI 12
-#define ISTATE_SIZE_ESI 4
-#define ISTATE_OFFSET_EDI 16
-#define ISTATE_SIZE_EDI 4
-#define ISTATE_OFFSET_EBP 20
-#define ISTATE_SIZE_EBP 4
-#define ISTATE_OFFSET_EAX 24
-#define ISTATE_SIZE_EAX 4
-#define ISTATE_OFFSET_EBP_FRAME 28
-#define ISTATE_SIZE_EBP_FRAME 4
-#define ISTATE_OFFSET_EIP_FRAME 32
-#define ISTATE_SIZE_EIP_FRAME 4
-#define ISTATE_OFFSET_GS 36
-#define ISTATE_SIZE_GS 4
-#define ISTATE_OFFSET_FS 40
-#define ISTATE_SIZE_FS 4
-#define ISTATE_OFFSET_ES 44
-#define ISTATE_SIZE_ES 4
-#define ISTATE_OFFSET_DS 48
-#define ISTATE_SIZE_DS 4
-#define ISTATE_OFFSET_ERROR_WORD 52
-#define ISTATE_SIZE_ERROR_WORD 4
-#define ISTATE_OFFSET_EIP 56
-#define ISTATE_SIZE_EIP 4
-#define ISTATE_OFFSET_CS 60
-#define ISTATE_SIZE_CS 4
-#define ISTATE_OFFSET_EFLAGS 64
-#define ISTATE_SIZE_EFLAGS 4
-#define ISTATE_OFFSET_ESP 68
-#define ISTATE_SIZE_ESP 4
-#define ISTATE_OFFSET_SS 72
-#define ISTATE_SIZE_SS 4
-#define ISTATE_SIZE 76
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/*
- * The strange order of the GPRs is given by the requirement to use the
- * istate structure for both regular interrupts and exceptions as well
- * as for syscall handlers which use this order as an optimization.
- */
-typedef struct istate {
-	uint32_t edx;
-	uint32_t ecx;
-	uint32_t ebx;
-	uint32_t esi;
-	uint32_t edi;
-	uint32_t ebp;
-	uint32_t eax;
-	/* imitation of frame pointer linkage */
-	uint32_t ebp_frame;
-	/* imitation of return address linkage */
-	uint32_t eip_frame;
-	uint32_t gs;
-	uint32_t fs;
-	uint32_t es;
-	uint32_t ds;
-	/* real or fake error word */
-	uint32_t error_word;
-	uint32_t eip;
-	uint32_t cs;
-	uint32_t eflags;
-	/* only if istate_t is from uspace */
-	uint32_t esp;
-	/* only if istate_t is from uspace */
-	uint32_t ss;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/ia32/include/arch/mm/as.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_AS_H_
-#define KERN_ia32_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_install_arch(as)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/mm/asid.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- * @ingroup kernel_ia32_mm, kernel_amd64_mm
- */
-
-/*
- * ia32 has no hardware support for address space identifiers.
- * This file is provided to do nop-implementation of mm/asid.h
- * interface.
- */
-
-#ifndef KERN_ia32_ASID_H_
-#define KERN_ia32_ASID_H_
-
-#include <stdint.h>
-
-typedef int32_t asid_t;
-
-#define ASID_MAX_ARCH  3
-
-#define asid_get()  (ASID_START + 1)
-#define asid_put(asid)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/mm/frame.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_FRAME_H_
-#define KERN_ia32_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0x1000
-
-#ifndef __ASSEMBLER__
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/mm/km.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_KM_H_
-#define KERN_ia32_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define KM_IA32_IDENTITY_START		UINT32_C(0x80000000)
-#define KM_IA32_IDENTITY_SIZE		UINT32_C(0x40000000)
-
-#define KM_IA32_NON_IDENTITY_START	UINT32_C(0xc0000000)
-#define KM_IA32_NON_IDENTITY_SIZE	UINT32_C(0x40000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/mm/page.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,237 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_PAGE_H_
-#define KERN_ia32_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <stdbool.h>
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#define PTE_P		(1 << 0)
-#define PTE_RW		(1 << 1)
-
-#define PDE_P		(1 << 0)
-#define PDE_RW		(1 << 1)
-#define PDE_4M		(1 << 7)
-
-#ifndef __ASSEMBLER__
-
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT32_C(0x80000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT32_C(0x80000000))
-
-#else /* __ASSEMBLER__ */
-
-#define KA2PA(x)  ((x) - 0x80000000)
-#define PA2KA(x)  ((x) + 0x80000000)
-
-#endif /* __ASSEMBLER__ */
-
-/*
- * Implementation of generic 4-level page table interface.
- * IA-32 has 2-level page tables, so PTL1 and PTL2 are left out.
- */
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  1024
-#define PTL1_ENTRIES_ARCH  0
-#define PTL2_ENTRIES_ARCH  0
-#define PTL3_ENTRIES_ARCH  1024
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ffU)
-#define PTL1_INDEX_ARCH(vaddr)  0
-#define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ffU)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	((pte_t *) ((((pte_t *) (ptl0))[(i)].frame_address) << 12))
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	(ptl1)
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	(ptl2)
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	((uintptr_t) ((((pte_t *) (ptl3))[(i)].frame_address) << 12))
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0) \
-	(write_cr3((uintptr_t) (ptl0)))
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].frame_address = (a) >> 12)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].frame_address = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	PAGE_PRESENT
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	PAGE_PRESENT
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT_ARCH(ptl2, i)
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last level entries. */
-#define PTE_VALID_ARCH(p) \
-	((p)->soft_valid != 0)
-#define PTE_PRESENT_ARCH(p) \
-	((p)->present != 0)
-#define PTE_GET_FRAME_ARCH(p) \
-	((p)->frame_address << FRAME_WIDTH)
-#define PTE_WRITABLE_ARCH(p) \
-	((p)->writeable != 0)
-#define PTE_EXECUTABLE_ARCH(p)  1
-
-#ifndef __ASSEMBLER__
-
-#include <mm/mm.h>
-#include <arch/interrupt.h>
-#include <stddef.h>
-#include <trace.h>
-
-/* Page fault error codes. */
-
-/** When bit on this position is 0, the page fault was caused by a not-present
- * page.
- */
-#define PFERR_CODE_P		(1 << 0)
-
-/** When bit on this position is 1, the page fault was caused by a write. */
-#define PFERR_CODE_RW		(1 << 1)
-
-/** When bit on this position is 1, the page fault was caused in user mode. */
-#define PFERR_CODE_US		(1 << 2)
-
-/** When bit on this position is 1, a reserved bit was set in page directory. */
-#define PFERR_CODE_RSVD		(1 << 3)
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned present : 1;
-	unsigned writeable : 1;
-	unsigned uaccessible : 1;
-	unsigned page_write_through : 1;
-	unsigned page_cache_disable : 1;
-	unsigned accessed : 1;
-	unsigned dirty : 1;
-	unsigned pat : 1;
-	unsigned global : 1;
-	unsigned soft_valid : 1;	/**< Valid content even if the present bit is not set. */
-	unsigned avl : 2;
-	unsigned frame_address : 20;
-} __attribute__((packed)) pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	return ((!p->page_cache_disable) << PAGE_CACHEABLE_SHIFT |
-	    (!p->present) << PAGE_PRESENT_SHIFT |
-	    p->uaccessible << PAGE_USER_SHIFT |
-	    1 << PAGE_READ_SHIFT |
-	    p->writeable << PAGE_WRITE_SHIFT |
-	    1 << PAGE_EXEC_SHIFT |
-	    p->global << PAGE_GLOBAL_SHIFT |
-	    p->page_write_through << PAGE_WRITE_COMBINE_SHIFT);
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_t *p = &pt[i];
-
-	p->present = !(flags & PAGE_NOT_PRESENT);
-	p->uaccessible = (flags & PAGE_USER) != 0;
-	p->writeable = (flags & PAGE_WRITE) != 0;
-	p->global = (flags & PAGE_GLOBAL) != 0;
-
-	if (flags & PAGE_WRITE_COMBINE) {
-		/* We have mapped PCD+PWT bits to write-combine mode via PAT MSR. */
-		/* (If PAT is unsupported, it will default to uncached.) */
-		p->page_cache_disable = 1;
-		p->page_write_through = 1;
-	} else {
-		p->page_cache_disable = !(flags & PAGE_CACHEABLE);
-		p->page_write_through = 0;
-	}
-
-	/*
-	 * Ensure that there is at least one bit set even if the present bit is
-	 * cleared.
-	 */
-	p->soft_valid = true;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	p->present = 1;
-}
-
-extern void page_arch_init(void);
-extern void page_fault(unsigned int, istate_t *);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/mm/pat.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/pat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../amd64/include/arch/mm/pat.h
Index: rnel/arch/ia32/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/ia32/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_TLB_H_
-#define KERN_ia32_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/pm.h
===================================================================
--- kernel/arch/ia32/include/arch/pm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_PM_H_
-#define KERN_ia32_PM_H_
-
-#define IDT_ITEMS  64
-#define GDT_ITEMS  7
-
-#define NULL_DES   0
-#define KTEXT_DES  1
-#define KDATA_DES  2
-#define UTEXT_DES  3
-#define UDATA_DES  4
-#define TSS_DES    5
-#define VREG_DES   6  /* Virtual registers */
-
-#ifdef CONFIG_FB
-
-#define VESA_INIT_SEGMENT  0x8000
-#define VESA_INIT_CODE_DES      7
-#define VESA_INIT_DATA_DES      8
-#define KTEXT32_DES        KTEXT_DES
-
-#undef GDT_ITEMS
-#define GDT_ITEMS  9
-
-#endif /* CONFIG_FB */
-
-#define GDT_SELECTOR(des)  ((des) << 3)
-
-#define PL_KERNEL  0
-#define PL_USER    3
-
-#define AR_PRESENT    (1 << 7)
-#define AR_DATA       (2 << 3)
-#define AR_CODE       (3 << 3)
-#define AR_WRITABLE   (1 << 1)
-#define AR_READABLE   (1 << 1)
-#define AR_INTERRUPT  (0xe)
-#define AR_TRAP       (0xf)
-#define AR_TSS        (0x9)
-
-#define DPL_KERNEL  (PL_KERNEL << 5)
-#define DPL_USER    (PL_USER << 5)
-
-#define TSS_BASIC_SIZE  104
-#define TSS_IOMAP_SIZE  (8 * 1024 + 1)  /* 8K for bitmap + 1 terminating byte for convenience */
-
-#define IO_PORTS  (64 * 1024)
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-#include <arch/context.h>
-
-typedef struct {
-	uint16_t limit;
-	uint32_t base;
-} __attribute__((packed)) ptr_16_32_t;
-
-typedef struct {
-	unsigned limit_0_15 : 16;
-	unsigned base_0_15 : 16;
-	unsigned base_16_23 : 8;
-	unsigned access : 8;
-	unsigned limit_16_19 : 4;
-	unsigned available : 1;
-	unsigned unused : 1;
-	unsigned special : 1;
-	unsigned granularity : 1;
-	unsigned base_24_31 : 8;
-} __attribute__((packed)) descriptor_t;
-
-typedef struct {
-	unsigned offset_0_15 : 16;
-	unsigned selector : 16;
-	unsigned unused : 8;
-	unsigned access : 8;
-	unsigned offset_16_31 : 16;
-} __attribute__((packed)) idescriptor_t;
-
-typedef struct {
-	uint16_t link;
-	unsigned : 16;
-	uint32_t esp0;
-	uint16_t ss0;
-	unsigned : 16;
-	uint32_t esp1;
-	uint16_t ss1;
-	unsigned : 16;
-	uint32_t esp2;
-	uint16_t ss2;
-	unsigned : 16;
-	uint32_t cr3;
-	uint32_t eip;
-	uint32_t eflags;
-	uint32_t eax;
-	uint32_t ecx;
-	uint32_t edx;
-	uint32_t ebx;
-	uint32_t esp;
-	uint32_t ebp;
-	uint32_t esi;
-	uint32_t edi;
-	uint16_t es;
-	unsigned : 16;
-	uint16_t cs;
-	unsigned : 16;
-	uint16_t ss;
-	unsigned : 16;
-	uint16_t ds;
-	unsigned : 16;
-	uint16_t fs;
-	unsigned : 16;
-	uint16_t gs;
-	unsigned : 16;
-	uint16_t ldtr;
-	unsigned : 16;
-	unsigned : 16;
-	uint16_t iomap_base;
-	uint8_t iomap[TSS_IOMAP_SIZE];
-} __attribute__((packed)) tss_t;
-
-extern ptr_16_32_t gdtr;
-extern ptr_16_32_t protected_ap_gdtr;
-extern tss_t *tss_p;
-
-extern descriptor_t gdt[];
-
-extern void pm_init(void);
-
-extern void gdt_setbase(descriptor_t *d, uintptr_t base);
-extern void gdt_setlimit(descriptor_t *d, uint32_t limit);
-
-extern void idt_init(void);
-extern void idt_setoffset(idescriptor_t *d, uintptr_t offset);
-
-extern void tss_initialize(tss_t *t);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/proc/task.h
===================================================================
--- kernel/arch/ia32/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_TASK_H_
-#define KERN_ia32_TASK_H_
-
-#include <stddef.h>
-#include <adt/bitmap.h>
-
-typedef struct {
-	/** I/O Permission bitmap Generation counter. */
-	size_t iomapver;
-	/** I/O Permission bitmap. */
-	bitmap_t iomap;
-} task_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/proc/thread.h
===================================================================
--- kernel/arch/ia32/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_THREAD_H_
-#define KERN_ia32_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(thr)
-#define thr_destructor_arch(thr)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/smp/ap.h
===================================================================
--- kernel/arch/ia32/include/arch/smp/ap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_AP_H_
-#define KERN_ia32_AP_H_
-
-extern void ap_boot(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/smp/apic.h
===================================================================
--- kernel/arch/ia32/include/arch/smp/apic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,378 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_APIC_H_
-#define KERN_ia32_APIC_H_
-
-#define L_APIC_BASE	0xfee00000
-#define IO_APIC_BASE	0xfec00000
-
-#ifndef __ASSEMBLER__
-
-#include <cpu.h>
-#include <stdint.h>
-#include <genarch/pic/pic_ops.h>
-
-#define FIXED  (0 << 0)
-#define LOPRI  (1 << 0)
-
-#define APIC_ID_COUNT  16
-
-/* local APIC macros */
-#define IPI_INIT     0
-#define IPI_STARTUP  0
-
-/** Delivery modes. */
-#define DELMOD_FIXED    0x0U
-#define DELMOD_LOWPRI   0x1U
-#define DELMOD_SMI      0x2U
-/* 0x3 reserved */
-#define DELMOD_NMI      0x4U
-#define DELMOD_INIT     0x5U
-#define DELMOD_STARTUP  0x6U
-#define DELMOD_EXTINT   0x7U
-
-/** Destination modes. */
-#define DESTMOD_PHYS   0x0U
-#define DESTMOD_LOGIC  0x1U
-
-/** Trigger Modes. */
-#define TRIGMOD_EDGE   0x0U
-#define TRIGMOD_LEVEL  0x1U
-
-/** Levels. */
-#define LEVEL_DEASSERT  0x0U
-#define LEVEL_ASSERT    0x1U
-
-/** Destination Shorthands. */
-#define SHORTHAND_NONE      0x0U
-#define SHORTHAND_SELF      0x1U
-#define SHORTHAND_ALL_INCL  0x2U
-#define SHORTHAND_ALL_EXCL  0x3U
-
-/** Interrupt Input Pin Polarities. */
-#define POLARITY_HIGH  0x0U
-#define POLARITY_LOW   0x1U
-
-/** Divide Values. (Bit 2 is always 0) */
-#define DIVIDE_2    0x0U
-#define DIVIDE_4    0x1U
-#define DIVIDE_8    0x2U
-#define DIVIDE_16   0x3U
-#define DIVIDE_32   0x8U
-#define DIVIDE_64   0x9U
-#define DIVIDE_128  0xaU
-#define DIVIDE_1    0xbU
-
-/** Timer Modes. */
-#define TIMER_ONESHOT   0x0U
-#define TIMER_PERIODIC  0x1U
-
-/** Delivery status. */
-#define DELIVS_IDLE     0x0U
-#define DELIVS_PENDING  0x1U
-
-/** Destination masks. */
-#define DEST_ALL  0xffU
-
-/** Dest format models. */
-#define MODEL_FLAT     0xfU
-#define MODEL_CLUSTER  0x0U
-
-/** Interrupt Command Register. */
-#define ICRlo  (0x300U / sizeof(uint32_t))
-#define ICRhi  (0x310U / sizeof(uint32_t))
-
-typedef struct {
-	union {
-		uint32_t lo;
-		struct {
-			uint8_t vector;                 /**< Interrupt Vector. */
-			unsigned int delmod : 3;        /**< Delivery Mode. */
-			unsigned int destmod : 1;       /**< Destination Mode. */
-			unsigned int delivs : 1;        /**< Delivery status (RO). */
-			unsigned int : 1;               /**< Reserved. */
-			unsigned int level : 1;         /**< Level. */
-			unsigned int trigger_mode : 1;  /**< Trigger Mode. */
-			unsigned int : 2;               /**< Reserved. */
-			unsigned int shorthand : 2;     /**< Destination Shorthand. */
-			unsigned int : 12;              /**< Reserved. */
-		} __attribute__((packed));
-	};
-	union {
-		uint32_t hi;
-		struct {
-			unsigned int : 24;  /**< Reserved. */
-			uint8_t dest;       /**< Destination field. */
-		} __attribute__((packed));
-	};
-} __attribute__((packed)) icr_t;
-
-/* End Of Interrupt. */
-#define EOI  (0x0b0U / sizeof(uint32_t))
-
-/** Error Status Register. */
-#define ESR  (0x280U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	uint8_t err_bitmap;
-	struct {
-		unsigned int send_checksum_error : 1;
-		unsigned int receive_checksum_error : 1;
-		unsigned int send_accept_error : 1;
-		unsigned int receive_accept_error : 1;
-		unsigned int : 1;
-		unsigned int send_illegal_vector : 1;
-		unsigned int received_illegal_vector : 1;
-		unsigned int illegal_register_address : 1;
-		unsigned int : 24;
-	} __attribute__((packed));
-} esr_t;
-
-/* Task Priority Register */
-#define TPR  (0x080U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int pri_sc : 4;  /**< Task Priority Sub-Class. */
-		unsigned int pri : 4;     /**< Task Priority. */
-	} __attribute__((packed));
-} tpr_t;
-
-/** Spurious-Interrupt Vector Register. */
-#define SVR  (0x0f0U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t vector;                   /**< Spurious Vector. */
-		unsigned int lapic_enabled : 1;   /**< APIC Software Enable/Disable. */
-		unsigned int focus_checking : 1;  /**< Focus Processor Checking. */
-		unsigned int : 22;                /**< Reserved. */
-	} __attribute__((packed));
-} svr_t;
-
-/** Time Divide Configuration Register. */
-#define TDCR  (0x3e0U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int div_value : 4;  /**< Divide Value, bit 2 is always 0. */
-		unsigned int : 28;           /**< Reserved. */
-	} __attribute__((packed));
-} tdcr_t;
-
-/* Initial Count Register for Timer */
-#define ICRT  (0x380U / sizeof(uint32_t))
-
-/* Current Count Register for Timer */
-#define CCRT  (0x390U / sizeof(uint32_t))
-
-/** LVT Timer register. */
-#define LVT_Tm  (0x320U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t vector;           /**< Local Timer Interrupt vector. */
-		unsigned int : 4;         /**< Reserved. */
-		unsigned int delivs : 1;  /**< Delivery status (RO). */
-		unsigned int : 3;         /**< Reserved. */
-		unsigned int masked : 1;  /**< Interrupt Mask. */
-		unsigned int mode : 1;    /**< Timer Mode. */
-		unsigned int : 14;        /**< Reserved. */
-	} __attribute__((packed));
-} lvt_tm_t;
-
-/** LVT LINT registers. */
-#define LVT_LINT0  (0x350U / sizeof(uint32_t))
-#define LVT_LINT1  (0x360U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t vector;                 /**< LINT Interrupt vector. */
-		unsigned int delmod : 3;        /**< Delivery Mode. */
-		unsigned int : 1;               /**< Reserved. */
-		unsigned int delivs : 1;        /**< Delivery status (RO). */
-		unsigned int intpol : 1;        /**< Interrupt Input Pin Polarity. */
-		unsigned int irr : 1;           /**< Remote IRR (RO). */
-		unsigned int trigger_mode : 1;  /**< Trigger Mode. */
-		unsigned int masked : 1;        /**< Interrupt Mask. */
-		unsigned int : 15;              /**< Reserved. */
-	} __attribute__((packed));
-} lvt_lint_t;
-
-/** LVT Error register. */
-#define LVT_Err  (0x370U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t vector;           /**< Local Timer Interrupt vector. */
-		unsigned int : 4;         /**< Reserved. */
-		unsigned int delivs : 1;  /**< Delivery status (RO). */
-		unsigned int : 3;         /**< Reserved. */
-		unsigned int masked : 1;  /**< Interrupt Mask. */
-		unsigned int : 15;        /**< Reserved. */
-	} __attribute__((packed));
-} lvt_error_t;
-
-/** Local APIC ID Register. */
-#define L_APIC_ID  (0x020U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int : 24;  /**< Reserved. */
-		uint8_t apic_id;    /**< Local APIC ID. */
-	} __attribute__((packed));
-} l_apic_id_t;
-
-/** Local APIC Version Register */
-#define LAVR       (0x030U / sizeof(uint32_t))
-#define LAVR_Mask  0xffU
-
-#define is_local_apic(x)    (((x) & LAVR_Mask & 0xf0U) == 0x1U)
-#define is_82489DX_apic(x)  ((((x) & LAVR_Mask & 0xf0U) == 0x0U))
-#define is_local_xapic(x)   (((x) & LAVR_Mask) == 0x14U)
-
-/** Logical Destination Register. */
-#define  LDR  (0x0d0U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int : 24;  /**< Reserved. */
-		uint8_t id;         /**< Logical APIC ID. */
-	} __attribute__((packed));
-} ldr_t;
-
-/** Destination Format Register. */
-#define DFR  (0x0e0U / sizeof(uint32_t))
-
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int : 28;       /**< Reserved, all ones. */
-		unsigned int model : 4;  /**< Model. */
-	} __attribute__((packed));
-} dfr_t;
-
-/* IO APIC */
-#define IOREGSEL  (0x00U / sizeof(uint32_t))
-#define IOWIN     (0x10U / sizeof(uint32_t))
-
-#define IOAPICID   0x00U
-#define IOAPICVER  0x01U
-#define IOAPICARB  0x02U
-#define IOREDTBL   0x10U
-
-/** I/O Register Select Register. */
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t reg_addr;   /**< APIC Register Address. */
-		unsigned int : 24;  /**< Reserved. */
-	} __attribute__((packed));
-} io_regsel_t;
-
-/** I/O Redirection Register. */
-typedef struct io_redirection_reg {
-	union {
-		uint32_t lo;
-		struct {
-			uint8_t intvec;                 /**< Interrupt Vector. */
-			unsigned int delmod : 3;        /**< Delivery Mode. */
-			unsigned int destmod : 1;       /**< Destination mode. */
-			unsigned int delivs : 1;        /**< Delivery status (RO). */
-			unsigned int intpol : 1;        /**< Interrupt Input Pin Polarity. */
-			unsigned int irr : 1;           /**< Remote IRR (RO). */
-			unsigned int trigger_mode : 1;  /**< Trigger Mode. */
-			unsigned int masked : 1;        /**< Interrupt Mask. */
-			unsigned int : 15;              /**< Reserved. */
-		} __attribute__((packed));
-	};
-	union {
-		uint32_t hi;
-		struct {
-			unsigned int : 24;  /**< Reserved. */
-			uint8_t dest : 8;   /**< Destination Field. */
-		} __attribute__((packed));
-	};
-
-} __attribute__((packed)) io_redirection_reg_t;
-
-/** IO APIC Identification Register. */
-typedef union {
-	uint32_t value;
-	struct {
-		unsigned int : 24;         /**< Reserved. */
-		unsigned int apic_id : 4;  /**< IO APIC ID. */
-		unsigned int : 4;          /**< Reserved. */
-	} __attribute__((packed));
-} io_apic_id_t;
-
-extern pic_ops_t apic_pic_ops;
-
-extern volatile uint32_t *l_apic;
-extern volatile uint32_t *io_apic;
-
-extern uint32_t apic_id_mask;
-extern uint8_t bsp_l_apic;
-
-extern void apic_init(void);
-
-extern void l_apic_init(void);
-extern void l_apic_eoi(unsigned int);
-extern int l_apic_send_custom_ipi(uint8_t, uint8_t);
-extern int l_apic_broadcast_custom_ipi(uint8_t);
-extern int l_apic_send_init_ipi(uint8_t);
-extern void l_apic_debug(void);
-
-extern uint32_t io_apic_read(uint8_t);
-extern void io_apic_write(uint8_t, uint32_t);
-extern void io_apic_change_ioredtbl(uint8_t pin, uint8_t dest, uint8_t v, unsigned int);
-extern void io_apic_disable_irqs(uint16_t);
-extern void io_apic_enable_irqs(uint16_t);
-
-#endif	/* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/smp/mps.h
===================================================================
--- kernel/arch/ia32/include/arch/smp/mps.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_MPS_H_
-#define KERN_ia32_MPS_H_
-
-#include <stdint.h>
-#include <synch/waitq.h>
-#include <config.h>
-#include <arch/smp/smp.h>
-
-#define CT_EXT_ENTRY_TYPE  0
-#define CT_EXT_ENTRY_LEN   1
-
-struct mps_fs {
-	uint32_t signature;
-	uint32_t configuration_table;
-	uint8_t length;
-	uint8_t revision;
-	uint8_t checksum;
-	uint8_t config_type;
-	uint8_t mpfib2;
-	uint8_t mpfib3;
-	uint8_t mpfib4;
-	uint8_t mpfib5;
-} __attribute__((packed));
-
-struct mps_ct {
-	uint32_t signature;
-	uint16_t base_table_length;
-	uint8_t revision;
-	uint8_t checksum;
-	uint8_t oem_id[8];
-	uint8_t product_id[12];
-	uint32_t oem_table;
-	uint16_t oem_table_size;
-	uint16_t entry_count;
-	uint32_t l_apic;
-	uint16_t ext_table_length;
-	uint8_t ext_table_checksum;
-	uint8_t reserved;
-	uint8_t base_table[0];
-} __attribute__((packed));
-
-struct __processor_entry {
-	uint8_t type;
-	uint8_t l_apic_id;
-	uint8_t l_apic_version;
-	uint8_t cpu_flags;
-	uint8_t cpu_signature[4];
-	uint32_t feature_flags;
-	uint32_t reserved[2];
-} __attribute__((packed));
-
-struct __bus_entry {
-	uint8_t type;
-	uint8_t bus_id;
-	uint8_t bus_type[6];
-} __attribute__((packed));
-
-struct __io_apic_entry {
-	uint8_t type;
-	uint8_t io_apic_id;
-	uint8_t io_apic_version;
-	uint8_t io_apic_flags;
-	uint32_t io_apic;
-} __attribute__((packed));
-
-struct __io_intr_entry {
-	uint8_t type;
-	uint8_t intr_type;
-	uint8_t poel;
-	uint8_t reserved;
-	uint8_t src_bus_id;
-	uint8_t src_bus_irq;
-	uint8_t dst_io_apic_id;
-	uint8_t dst_io_apic_pin;
-} __attribute__((packed));
-
-struct __l_intr_entry {
-	uint8_t type;
-	uint8_t intr_type;
-	uint8_t poel;
-	uint8_t reserved;
-	uint8_t src_bus_id;
-	uint8_t src_bus_irq;
-	uint8_t dst_l_apic_id;
-	uint8_t dst_l_apic_pin;
-} __attribute__((packed));
-
-extern struct smp_config_operations mps_config_operations;
-
-extern void mps_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/smp/smp.h
===================================================================
--- kernel/arch/ia32/include/arch/smp/smp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_SMP_H_
-#define KERN_ia32_SMP_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-
-/** SMP config opertaions interface. */
-struct smp_config_operations {
-	/** Check whether a processor is enabled. */
-	bool (*cpu_enabled)(size_t);
-
-	/** Check whether a processor is BSP. */
-	bool (*cpu_bootstrap)(size_t);
-
-	/** Return APIC ID of a processor. */
-	uint8_t (*cpu_apic_id)(size_t);
-
-	/** Return mapping between IRQ and APIC pin. */
-	int (*irq_to_pin)(unsigned int);
-};
-
-extern int smp_irq_to_pin(unsigned int);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/stack.h
===================================================================
--- kernel/arch/ia32/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_STACK_H_
-#define KERN_ia32_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/syscall.h
===================================================================
--- kernel/arch/ia32/include/arch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../.././../amd64/include/arch/syscall.h
Index: rnel/arch/ia32/include/arch/types.h
===================================================================
--- kernel/arch/ia32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_TYPES_H_
-#define KERN_ia32_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/include/arch/vreg.h
===================================================================
--- kernel/arch/ia32/include/arch/vreg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_VREG_H_
-#define KERN_ia32_VREG_H_
-
-#define VREG_TP	0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-extern uint32_t *vreg_ptr;
-
-extern void vreg_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia32/meson.build
===================================================================
--- kernel/arch/ia32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/context.S',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/delay.S',
-	'src/asm.S',
-	'src/proc/scheduler.c',
-	'src/proc/task.c',
-	'src/proc/thread.c',
-	'src/bios/bios.c',
-	'src/smp/ap.S',
-	'src/smp/apic.c',
-	'src/smp/mps.c',
-	'src/smp/smp.c',
-	'src/atomic.S',
-	'src/smp/ipi.c',
-	'src/ia32.c',
-	'src/vreg.c',
-	'src/interrupt.c',
-	'src/pm.c',
-	'src/userspace.c',
-	'src/smc.c',
-	'src/cpu/cpu.c',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/ddi/ddi.c',
-	'src/drivers/i8254.c',
-	'src/boot/multiboot.S',
-	'src/boot/multiboot2.S',
-	'src/boot/memmap.c',
-	'src/fpu_context.c',
-	'src/syscall.c',
-)
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-	'include/arch/boot/memmap_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/ia32/src/asm.S
===================================================================
--- kernel/arch/ia32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,586 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Very low and hardware-level functions
- *
- */
-
-#include <abi/asmtool.h>
-#include <arch/pm.h>
-#include <arch/cpu.h>
-#include <arch/mm/page.h>
-#include <arch/istate_struct.h>
-#include <arch/smp/apic.h>
-
-.text
-
-#define MEMCPY_DST   4
-#define MEMCPY_SRC   8
-#define MEMCPY_SIZE  12
-
-/** Copy memory to/from userspace.
- *
- * This is almost conventional memcpy().
- * The difference is that there is a failover part
- * to where control is returned from a page fault
- * if the page fault occurs during copy_from_uspace()
- * or copy_to_uspace().
- *
- * @param MEMCPY_DST(%esp)  Destination address.
- * @param MEMCPY_SRC(%esp)  Source address.
- * @param MEMCPY_SIZE(%esp) Size.
- *
- * @return MEMCPY_DST(%esp) on success and 0 on failure.
- *
- */
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	movl %edi, %edx  /* save %edi */
-	movl %esi, %eax  /* save %esi */
-
-	movl MEMCPY_SIZE(%esp), %ecx
-	shrl $2, %ecx  /* size / 4 */
-
-	movl MEMCPY_DST(%esp), %edi
-	movl MEMCPY_SRC(%esp), %esi
-
-	/* Copy whole words */
-	rep movsl
-
-	movl MEMCPY_SIZE(%esp), %ecx
-	andl $3, %ecx  /* size % 4 */
-	jz 0f
-
-	/* Copy the rest byte by byte */
-	rep movsb
-
-	0:
-
-		movl %edx, %edi
-		movl %eax, %esi
-
-		/* MEMCPY_DST(%esp), success */
-		movl MEMCPY_DST(%esp), %eax
-		ret
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-/*
- * We got here from as_page_fault() after the memory operations
- * above had caused a page fault.
- */
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	movl %edx, %edi
-	movl %eax, %esi
-
-	/* Return 0, failure */
-	xorl %eax, %eax
-	ret
-
-/** Turn paging on
- *
- * Enable paging and write-back caching in CR0.
- *
- */
-FUNCTION_BEGIN(paging_on)
-	movl %cr0, %edx
-	orl $CR0_PG, %edx  /* paging on */
-
-	/* Clear Cache Disable and not Write Though */
-	andl $~(CR0_CD | CR0_NW), %edx
-	movl %edx, %cr0
-	jmp 0f
-
-	0:
-		ret
-FUNCTION_END(paging_on)
-
-/** Enable local APIC
- *
- * Enable local APIC in MSR.
- *
- */
-FUNCTION_BEGIN(enable_l_apic_in_msr)
-	movl $IA32_MSR_APIC_BASE, %ecx
-	rdmsr
-	orl $(L_APIC_BASE | IA32_APIC_BASE_GE), %eax
-	wrmsr
-	ret
-FUNCTION_END(enable_l_apic_in_msr)
-
-/*
- * Size of the istate structure without the hardware-saved part
- * and without the error word.
- */
-#define ISTATE_SOFT_SIZE	ISTATE_SIZE - (6 * 4)
-
-/*
- * The SYSENTER syscall mechanism can be used for syscalls with
- * four or fewer arguments. To pass these four arguments, we
- * use four registers: EDX, ECX, EBX, ESI. The syscall number
- * is passed in EAX. We use EDI to remember the return address
- * and EBP to remember the stack. The INT-based syscall mechanism
- * can actually handle six arguments plus the syscall number
- * entirely in registers.
- */
-SYMBOL(sysenter_handler)
-
-	/*
-	 * Note that the space needed for the istate structure has been
-	 * preallocated on the stack by before_thread_runs_arch().
-	 */
-
-	/*
-	 * Save the return address and the userspace stack in the istate
-	 * structure on locations that would normally be taken by them.
-	 */
-	movl %ebp, ISTATE_OFFSET_ESP(%esp)
-	movl %edi, ISTATE_OFFSET_EIP(%esp)
-
-	/*
-	 * Push syscall arguments onto the stack
-	 */
-	movl %eax, ISTATE_OFFSET_EAX(%esp)
-	movl %ebx, ISTATE_OFFSET_EBX(%esp)
-	movl %ecx, ISTATE_OFFSET_ECX(%esp)
-	movl %edx, ISTATE_OFFSET_EDX(%esp)
-	movl %esi, ISTATE_OFFSET_ESI(%esp)
-	movl %edi, ISTATE_OFFSET_EDI(%esp)	/* observability; not needed */
-	movl %ebp, ISTATE_OFFSET_EBP(%esp)	/* observability; not needed */
-
-	/*
-	 * Fake up the stack trace linkage.
-	 */
-	movl %edi, ISTATE_OFFSET_EIP_FRAME(%esp)
-	movl $0, ISTATE_OFFSET_EBP_FRAME(%esp)
-	leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
-
-	/*
-	 * Switch to kernel selectors.
-	 */
-	movl $(GDT_SELECTOR(KDATA_DES)), %eax
-	movl %eax, %ds
-	movl %eax, %es
-	movl $(GDT_SELECTOR(VREG_DES)), %eax
-	movl %eax, %gs
-
-	/*
-	 * Sanitize EFLAGS.
-	 *
-	 * SYSENTER does not clear the NT flag, which could thus proliferate
-	 * from here to the IRET instruction via a context switch and result
-	 * in crash.
-	 *
-	 * SYSENTER does not clear DF, which the ABI assumes to be cleared.
-	 *
-	 * SYSENTER clears IF, which we would like to be set for syscalls.
-	 *
-	 */
-	pushl $(EFLAGS_IF)  /* specify EFLAGS bits that we want to set */
-	popfl	            /* set bits from the mask, clear or ignore others */
-
-	call syscall_handler
-
-	/*
-	 * Prepare return address and userspace stack for SYSEXIT.
-	 */
-	movl ISTATE_OFFSET_EIP(%esp), %edx
-	movl ISTATE_OFFSET_ESP(%esp), %ecx
-
-	sysexit   /* return to userspace */
-
-/*
- * This is the legacy syscall handler using the interrupt mechanism.
- */
-SYMBOL(int_syscall)
-	subl $(ISTATE_SOFT_SIZE + 4), %esp
-
-	/*
-	 * Push syscall arguments onto the stack
-	 *
-	 * NOTE: The idea behind the order of arguments passed
-	 *       in registers is to use all scratch registers
-	 *       first and preserved registers next. An optimized
-	 *       libc syscall wrapper can make use of this setup.
-	 *       The istate structure is arranged in the way to support
-	 *       this idea.
-	 *
-	 */
-	movl %eax, ISTATE_OFFSET_EAX(%esp)
-	movl %ebx, ISTATE_OFFSET_EBX(%esp)
-	movl %ecx, ISTATE_OFFSET_ECX(%esp)
-	movl %edx, ISTATE_OFFSET_EDX(%esp)
-	movl %edi, ISTATE_OFFSET_EDI(%esp)
-	movl %esi, ISTATE_OFFSET_ESI(%esp)
-	movl %ebp, ISTATE_OFFSET_EBP(%esp)
-
-	/*
-	 * Save the segment registers.
-	 */
-	movl %gs, %ecx
-	movl %fs, %edx
-
-	movl %ecx, ISTATE_OFFSET_GS(%esp)
-	movl %edx, ISTATE_OFFSET_FS(%esp)
-
-	movl %es, %ecx
-	movl %ds, %edx
-
-	movl %ecx, ISTATE_OFFSET_ES(%esp)
-	movl %edx, ISTATE_OFFSET_DS(%esp)
-
-	/*
-	 * Switch to kernel selectors.
-	 */
-	movl $(GDT_SELECTOR(KDATA_DES)), %eax
-	movl %eax, %ds
-	movl %eax, %es
-	movl $(GDT_SELECTOR(VREG_DES)), %eax
-	movl %eax, %gs
-
-	movl $0, ISTATE_OFFSET_EBP_FRAME(%esp)
-	movl ISTATE_OFFSET_EIP(%esp), %eax
-	movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
-	leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
-
-	cld
-
-	/* Call syscall_handler(edx, ecx, ebx, esi, edi, ebp, eax) */
-	call syscall_handler
-
-	/*
-	 * Restore the segment registers.
-	 */
-	movl ISTATE_OFFSET_GS(%esp), %ecx
-	movl ISTATE_OFFSET_FS(%esp), %edx
-
-	movl %ecx, %gs
-	movl %edx, %fs
-
-	movl ISTATE_OFFSET_ES(%esp), %ecx
-	movl ISTATE_OFFSET_DS(%esp), %edx
-
-	movl %ecx, %es
-	movl %edx, %ds
-
-	/*
-	 * Restore the preserved registers the handler cloberred itself
-	 * (i.e. EBP).
-	 */
-	movl ISTATE_OFFSET_EBP(%esp), %ebp
-
-	addl $(ISTATE_SOFT_SIZE + 4), %esp
-	iret
-
-/**
- * Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int
- * has no error word  and 1 means interrupt with error word
- *
- */
-#define ERROR_WORD_INTERRUPT_LIST  0x00027d00
-
-.macro handler i
-SYMBOL(int_\i)
-	/*
-	 * This macro distinguishes between two versions of ia32
-	 * exceptions. One version has error word and the other
-	 * does not have it. The latter version fakes the error
-	 * word on the stack so that the handlers and istate_t
-	 * can be the same for both types.
-	 */
-	.iflt \i - 32
-		.if (1 << \i) & ERROR_WORD_INTERRUPT_LIST
-			/*
-			 * Exception with error word.
-			 */
-			subl $ISTATE_SOFT_SIZE, %esp
-		.else
-			/*
-			 * Exception without error word: fake up one
-			 */
-			subl $(ISTATE_SOFT_SIZE + 4), %esp
-		.endif
-	.else
-		/*
-		 * Interrupt: fake up an error word
-		 */
-		subl $(ISTATE_SOFT_SIZE + 4), %esp
-	.endif
-
-	/*
-	 * Save the general purpose registers.
-	 */
-	movl %eax, ISTATE_OFFSET_EAX(%esp)
-	movl %ebx, ISTATE_OFFSET_EBX(%esp)
-	movl %ecx, ISTATE_OFFSET_ECX(%esp)
-	movl %edx, ISTATE_OFFSET_EDX(%esp)
-	movl %edi, ISTATE_OFFSET_EDI(%esp)
-	movl %esi, ISTATE_OFFSET_ESI(%esp)
-	movl %ebp, ISTATE_OFFSET_EBP(%esp)
-
-	/*
-	 * Save the segment registers.
-	 */
-	movl %gs, %ecx
-	movl %fs, %edx
-
-	movl %ecx, ISTATE_OFFSET_GS(%esp)
-	movl %edx, ISTATE_OFFSET_FS(%esp)
-
-	movl %es, %ecx
-	movl %ds, %edx
-
-	movl %ecx, ISTATE_OFFSET_ES(%esp)
-	movl %edx, ISTATE_OFFSET_DS(%esp)
-
-	/*
-	 * Switch to kernel selectors.
-	 */
-	movl $(GDT_SELECTOR(KDATA_DES)), %eax
-	movl %eax, %ds
-	movl %eax, %es
-	movl $(GDT_SELECTOR(VREG_DES)), %eax
-	movl %eax, %gs
-
-	/*
-	 * Imitate a regular stack frame linkage.
-	 * Stop stack traces here if we came from userspace.
-	 */
-	xorl %eax, %eax
-	cmpl $(GDT_SELECTOR(KTEXT_DES)), ISTATE_OFFSET_CS(%esp)
-#ifdef PROCESSOR_i486
-	jz 0f
-		movl %eax, %ebp
-	0:
-#else
-	cmovnzl %eax, %ebp
-#endif
-
-	movl %ebp, ISTATE_OFFSET_EBP_FRAME(%esp)
-	movl ISTATE_OFFSET_EIP(%esp), %eax
-	movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
-	leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
-
-	cld
-
-	pushl %esp   /* pass istate address */
-	pushl $(\i)  /* pass intnum */
-
-	/* Call exc_dispatch(intnum, istate) */
-	call exc_dispatch
-
-	addl $8, %esp  /* clear arguments from the stack */
-
-	/*
-	 * Restore the selector registers.
-	 */
-	movl ISTATE_OFFSET_GS(%esp), %ecx
-	movl ISTATE_OFFSET_FS(%esp), %edx
-
-	movl %ecx, %gs
-	movl %edx, %fs
-
-	movl ISTATE_OFFSET_ES(%esp), %ecx
-	movl ISTATE_OFFSET_DS(%esp), %edx
-
-	movl %ecx, %es
-	movl %edx, %ds
-
-	/*
-	 * Restore the scratch registers and the preserved
-	 * registers the handler cloberred itself
-	 * (i.e. EBP).
-	 */
-	movl ISTATE_OFFSET_EAX(%esp), %eax
-	movl ISTATE_OFFSET_ECX(%esp), %ecx
-	movl ISTATE_OFFSET_EDX(%esp), %edx
-	movl ISTATE_OFFSET_EBP(%esp), %ebp
-
-	addl $(ISTATE_SOFT_SIZE + 4), %esp
-	iret
-.endm
-
-#define LIST_0_63 \
-	0, 1, 2, 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,\
-	28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,\
-	53,54,55,56,57,58,59,60,61,62,63
-
-interrupt_handlers:
-.irp cnt, LIST_0_63
-	handler \cnt
-.endr
-
-/** Print Unicode character to EGA display.
- *
- * If CONFIG_EGA is undefined or CONFIG_FB is defined
- * then this function does nothing.
- *
- * Since the EGA can only display Extended ASCII (usually
- * ISO Latin 1) characters, some of the Unicode characters
- * can be displayed in a wrong way. Only newline and backspace
- * are interpreted, all other characters (even unprintable) are
- * printed verbatim.
- *
- * @param %ebp+0x08 Unicode character to be printed.
- *
- */
-FUNCTION_BEGIN(early_putuchar)
-
-#if ((defined(CONFIG_DEBUG_EARLY_PRINT)) && (defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
-	/* Prologue, save preserved registers */
-	pushl %ebp
-	movl %esp, %ebp
-	pushl %ebx
-	pushl %esi
-	pushl %edi
-
-	movl $(PA2KA(0xb8000)), %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb early_putuchar_cursor_ok
-
-		movw $1998, %ax
-
-	early_putuchar_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	movl 0x08(%ebp), %eax
-
-	cmp $0x0a, %al
-	jne early_putuchar_backspace
-
-		/* Interpret newline */
-
-		movw %bx, %ax  /* %bx -> %dx:%ax */
-		xorw %dx, %dx
-
-		movw $80, %cx
-		idivw %cx, %ax  /* %dx = %bx % 80 */
-
-		/* %bx <- %bx + 80 - (%bx % 80) */
-		addw %cx, %bx
-		subw %dx, %bx
-
-		jmp early_putuchar_skip
-
-	early_putuchar_backspace:
-
-		cmp $0x08, %al
-		jne early_putuchar_print
-
-		/* Interpret backspace */
-
-		cmp $0x0000, %bx
-		je early_putuchar_skip
-
-		dec %bx
-		jmp early_putuchar_skip
-
-	early_putuchar_print:
-
-		/* Print character */
-
-		movb $0x0e, %ah  /* black background, yellow foreground */
-		stosw
-		inc %bx
-
-	early_putuchar_skip:
-
-	/* Sanity check for the cursor on the last line */
-	cmp $2000, %bx
-	jb early_putuchar_no_scroll
-
-		/* Scroll the screen (24 rows) */
-		movl $(PA2KA(0xb80a0)), %esi
-		movl $(PA2KA(0xb8000)), %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movw $1920, %bx
-
-	early_putuchar_no_scroll:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	/* Epilogue, restore preserved registers */
-	popl %edi
-	popl %esi
-	popl %ebx
-	leave
-
-#endif
-
-	ret
-FUNCTION_END(early_putuchar)
-
Index: rnel/arch/ia32/src/atomic.S
===================================================================
--- kernel/arch/ia32/src/atomic.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-#ifdef CONFIG_SMP
-
-#
-# This is a bus-and-hyperthreading-friendly implementation of spinlock
-#
-FUNCTION_BEGIN(spinlock_arch)
-	pushl %eax
-	pushl %ebx
-
-	movl 12(%esp),%ebx
-
-0:
-	pause			# Pentium 4's with HT love this instruction
-	movl (%ebx),%eax
-	testl %eax,%eax
-	jnz 0b			# lightweight looping while it is locked
-	incl %eax
-	xchgl %eax,(%ebx)	# now use the atomic operation
-	testl %eax,%eax
-	jnz 0b
-
-	popl %ebx
-	popl %eax
-	ret
-FUNCTION_END(spinlock_arch)
-
-#endif
Index: rnel/arch/ia32/src/bios/bios.c
===================================================================
--- kernel/arch/ia32/src/bios/bios.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch/bios/bios.h>
-#include <typedefs.h>
-
-#define BIOS_EBDA_PTR  0x40eU
-
-uintptr_t ebda = 0;
-
-void bios_init(void)
-{
-	/* Copy the EBDA address out from BIOS Data Area */
-	ebda = *((uint16_t *) BIOS_EBDA_PTR) * 0x10U;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/boot/memmap.c
===================================================================
--- kernel/arch/ia32/src/boot/memmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/boot/memmap.h>
-
-uint8_t e820counter = 0;
-e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
-
-/** @}
- */
Index: rnel/arch/ia32/src/boot/multiboot.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,733 +1,0 @@
-/*
- * Copyright (c) 2001 Jakub Jermar
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/boot/memmap.h>
-#include <arch/mm/page.h>
-#include <arch/pm.h>
-#include <genarch/multiboot/multiboot.h>
-#include <arch/cpuid.h>
-#include <arch/cpu.h>
-
-#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.macro pm_error msg
-	movl \msg, %esi
-	jmp pm_error_halt
-.endm
-
-.macro pm_status msg
-#ifdef CONFIG_EGA
-	pushl %esi
-	movl \msg, %esi
-	call pm_early_puts
-	popl %esi
-#endif
-.endm
-
-.macro pm2_status msg
-	pushl \msg
-	call early_puts
-.endm
-
-.align 4
-multiboot_header:
-	.long MULTIBOOT_HEADER_MAGIC
-	.long MULTIBOOT_HEADER_FLAGS
-	.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)  /* checksum */
-	.long multiboot_header
-	.long unmapped_start
-	.long 0
-	.long 0
-	.long multiboot_image_start
-
-SYMBOL(multiboot_image_start)
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/*
-	 * Initialize Global Descriptor Table and
-	 * Interrupt Descriptor Table registers
-	 */
-	lgdtl bootstrap_gdtr
-	lidtl bootstrap_idtr
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %fs
-	movw %cx, %gs
-	movw %cx, %ds
-	movw %cx, %ss
-
-	jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot_meeting_point
-	multiboot_meeting_point:
-
-	/* Save multiboot arguments */
-	movl %eax, multiboot_eax
-	movl %ebx, multiboot_ebx
-
-	pm_status $status_prot
-
-#include "vesa_prot.inc"
-
-#ifndef PROCESSOR_i486
-
-	pm_status $status_prot2
-
-	movl $(INTEL_CPUID_LEVEL), %eax
-	cpuid
-	cmp $0x0, %eax  /* any function > 0? */
-	jbe pse_unsupported
-
-	movl $(INTEL_CPUID_STANDARD), %eax
-	cpuid
-	bt $(INTEL_PSE), %edx
-	jnc pse_unsupported
-
-		/* Map kernel and turn paging on */
-		pm_status $status_pse
-		call map_kernel_pse
-		jmp stack_init
-
-#endif /* PROCESSOR_i486 */
-
-	pse_unsupported:
-
-		/* Map kernel and turn paging on */
-		pm_status $status_non_pse
-		call map_kernel_non_pse
-
-	stack_init:
-
-	/* Create the first stack frame */
-	pushl $0
-	movl %esp, %ebp
-
-	pm2_status $status_prot3
-
-	/* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
-	pushl multiboot_ebx
-	pushl multiboot_eax
-	call ia32_pre_main
-
-	pm2_status $status_main
-
-	/* Call main_bsp() */
-	call main_bsp
-
-	/* Not reached */
-	cli
-	hlt0:
-		hlt
-		jmp hlt0
-
-/** Setup mapping for the kernel (PSE variant)
- *
- * Setup mapping for both the unmapped and mapped sections
- * of the kernel. For simplicity, we map the entire 4G space.
- *
- */
-FUNCTION_BEGIN(map_kernel_pse)
-	/* Paging features */
-	movl %cr4, %ecx
-	orl $CR4_PSE, %ecx	/* PSE on */
-	andl $~CR4_PAE, %ecx	/* PAE off */
-	movl %ecx, %cr4
-
-	movl $(page_directory + 0), %esi
-	movl $(page_directory + 2048), %edi
-	xorl %ecx, %ecx
-	xorl %ebx, %ebx
-
-	floop_pse:
-		movl $(PDE_4M | PDE_RW | PDE_P), %eax
-		orl %ebx, %eax
-		/* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
-		movl %eax, (%esi, %ecx, 4)
-		/* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
-		movl %eax, (%edi, %ecx, 4)
-		addl $(4 * 1024 * 1024), %ebx
-
-		incl %ecx
-		cmpl $512, %ecx
-		jl floop_pse
-
-	movl %esi, %cr3
-
-	movl %cr0, %ebx
-	orl $CR0_PG, %ebx	/* paging on */
-	movl %ebx, %cr0
-	ret
-FUNCTION_END(map_kernel_pse)
-
-/** Setup mapping for the kernel (non-PSE variant).
- *
- * Setup mapping for both the unmapped and mapped sections
- * of the kernel. For simplicity, we map the entire 4G space.
- *
- */
-FUNCTION_BEGIN(map_kernel_non_pse)
-	/* Paging features */
-	movl %cr4, %ecx
-	andl $~CR4_PAE, %ecx  /* PAE off */
-	movl %ecx, %cr4
-
-	call calc_kernel_end
-	call find_mem_for_pt
-
-	mov kernel_end, %esi
-	mov free_area, %ecx
-
-	cmpl %esi, %ecx
-	jbe use_kernel_end
-
-		mov %ecx, %esi
-
-		/* Align address down to 4k */
-		andl $(~(PAGE_SIZE - 1)), %esi
-
-	use_kernel_end:
-
-		/* Align address to 4k */
-		addl $(PAGE_SIZE - 1), %esi
-		andl $(~(PAGE_SIZE - 1)), %esi
-
-		/* Allocate space for page tables */
-		movl %esi, pt_loc
-		movl $KA2PA(ballocs), %edi
-
-		movl %esi, (%edi)
-		addl $4, %edi
-		movl $(2 * 1024 * 1024), (%edi)
-
-		/* Fill page tables */
-		xorl %ecx, %ecx
-		xorl %ebx, %ebx
-
-		floop_pt:
-			movl $(PTE_RW | PTE_P), %eax
-			orl %ebx, %eax
-			movl %eax, (%esi, %ecx, 4)
-			addl $PAGE_SIZE, %ebx
-
-			incl %ecx
-			cmpl $(512 * 1024), %ecx
-
-			jl floop_pt
-
-		/* Fill page directory */
-		movl $(page_directory + 0), %esi
-		movl $(page_directory + 2048), %edi
-		xorl %ecx, %ecx
-		movl pt_loc, %ebx
-
-		floop:
-			movl $(PDE_RW | PDE_P), %eax
-			orl %ebx, %eax
-
-			/* Mapping 0x00000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
-			movl %eax, (%esi, %ecx, 4)
-
-			/* Mapping 0x80000000 + %ecx * 4M => 0x00000000 + %ecx * 4M */
-			movl %eax, (%edi, %ecx, 4)
-			addl $PAGE_SIZE, %ebx
-
-			incl %ecx
-			cmpl $512, %ecx
-
-			jl floop
-
-		movl %esi, %cr3
-
-		movl %cr0, %ebx
-		orl $CR0_PG, %ebx  /* paging on */
-		movl %ebx, %cr0
-
-		ret
-FUNCTION_END(map_kernel_non_pse)
-
-/** Calculate unmapped address of the end of the kernel. */
-calc_kernel_end:
-	movl $KA2PA(kdata_end), %edi
-	movl %edi, kernel_end
-	ret
-
-/** Find free 2M (+4k for alignment) region where to store page tables */
-find_mem_for_pt:
-	/* Check if multiboot info is present */
-	cmpl $MULTIBOOT_LOADER_MAGIC, multiboot_eax
-	je check_multiboot_map
-
-		ret
-
-	check_multiboot_map:
-
-		/* Copy address of the multiboot info to ebx */
-		movl multiboot_ebx, %ebx
-
-		/* Check if memory map flag is present */
-		movl (%ebx), %edx
-		andl $MULTIBOOT_INFO_FLAGS_MMAP, %edx
-		jnz use_multiboot_map
-
-			ret
-
-	use_multiboot_map:
-
-		/* Copy address of the memory map to edx */
-		movl MULTIBOOT_INFO_OFFSET_MMAP_ADDR(%ebx), %edx
-		movl %edx, %ecx
-
-		addl MULTIBOOT_INFO_OFFSET_MMAP_LENGTH(%ebx), %ecx
-
-		/* Find a free region at least 2M in size */
-		check_memmap_loop:
-
-			/* Is this a free region? */
-			cmpl $MEMMAP_MEMORY_AVAILABLE, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_TYPE(%edx)
-			jnz next_region
-
-			/* Check size */
-			cmpl $0, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_SIZE + 4(%edx)
-			jnz next_region
-			cmpl $(2 * 1024 * 1024 + PAGE_SIZE), MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_SIZE(%edx)
-			jbe next_region
-
-			cmpl $0, MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_BASE_ADDRESS + 4(%edx)
-			jz found_region
-
-		next_region:
-
-			cmp %ecx, %edx
-			jbe next_region_do
-
-				ret
-
-		next_region_do:
-
-			addl MULTIBOOT_MEMMAP_OFFSET_SIZE(%edx), %edx
-			addl $MULTIBOOT_MEMMAP_SIZE_SIZE, %edx
-			jmp check_memmap_loop
-
-		found_region:
-
-			/* Use end of the found region */
-			mov MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_BASE_ADDRESS(%edx), %ecx
-			add MULTIBOOT_MEMMAP_OFFSET_MM_INFO + E820MEMMAP_OFFSET_SIZE(%edx), %ecx
-			sub $(2 * 1024 * 1024), %ecx
-			mov %ecx, free_area
-
-			ret
-
-/** Print string to EGA display (in light red) and halt.
- *
- * Should be executed from 32 bit protected mode with paging
- * turned off. Stack is not required. This routine is used even
- * if CONFIG_EGA is not enabled. Since we are going to halt the
- * CPU anyway, it is always better to at least try to print
- * some hints.
- *
- * @param %esi NULL-terminated string to print.
- *
- */
-pm_error_halt:
-	movl $0xb8000, %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb err_cursor_ok
-
-		movw $1998, %ax
-
-	err_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	err_ploop:
-		lodsb
-
-		cmp $0, %al
-		je err_ploop_end
-
-		movb $0x0c, %ah  /* black background, light red foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb err_ploop
-
-		/* Scroll the screen (24 rows) */
-		movl %esi, %edx
-		movl $0xb80a0, %esi
-		movl $0xb8000, %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movl %edx, %esi
-		movl $0xb8f00, %edi
-		movw $1920, %bx
-
-		jmp err_ploop
-	err_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	cli
-	hlt1:
-		hlt
-		jmp hlt1
-
-/** Print string to EGA display (in light green).
- *
- * Should be called from 32 bit protected mode with paging
- * turned off. A stack space of at least 24 bytes is required,
- * but the function does not establish a stack frame.
- *
- * Macros such as pm_status take care that this function
- * is used only when CONFIG_EGA is enabled.
- *
- * @param %esi NULL-terminated string to print.
- *
- */
-pm_early_puts:
-	pushl %eax
-	pushl %ebx
-	pushl %ecx
-	pushl %edx
-	pushl %edi
-
-	movl $0xb8000, %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb pm_puts_cursor_ok
-
-		movw $1998, %ax
-
-	pm_puts_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	pm_puts_ploop:
-		lodsb
-
-		cmp $0, %al
-		je pm_puts_ploop_end
-
-		movb $0x0a, %ah  /* black background, light green foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb pm_puts_ploop
-
-		/* Scroll the screen (24 rows) */
-		movl %esi, %edx
-		movl $0xb80a0, %esi
-		movl $0xb8000, %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movl %edx, %esi
-		movl $0xb8f00, %edi
-		movw $1920, %bx
-
-		jmp pm_puts_ploop
-	pm_puts_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	popl %edi
-	popl %edx
-	popl %ecx
-	popl %ebx
-	popl %eax
-
-	ret
-
-/** Print string to EGA display.
- *
- * Should be called from 32 bit protected mode (with paging
- * enabled and stack established). This function is ABI compliant.
- *
- * If CONFIG_EGA is undefined or CONFIG_FB is defined
- * then this function does nothing.
- *
- * @param %ebp+0x08 NULL-terminated string to print.
- *
- */
-early_puts:
-
-#if ((defined(CONFIG_EGA)) && (!defined(CONFIG_FB)))
-
-	/* Prologue, save preserved registers */
-	pushl %ebp
-	movl %esp, %ebp
-	pushl %ebx
-	pushl %esi
-	pushl %edi
-
-	movl 0x08(%ebp), %esi
-	movl $(PA2KA(0xb8000)), %edi  /* base of EGA text mode memory */
-	xorl %eax, %eax
-
-	/* Read bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-	shl $8, %ax
-
-	/* Read bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	inb %dx, %al
-
-	/* Sanity check for the cursor on screen */
-	cmp $2000, %ax
-	jb early_puts_cursor_ok
-
-		movw $1998, %ax
-
-	early_puts_cursor_ok:
-
-	movw %ax, %bx
-	shl $1, %eax
-	addl %eax, %edi
-
-	early_puts_ploop:
-		lodsb
-
-		cmp $0, %al
-		je early_puts_ploop_end
-
-		movb $0x0e, %ah  /* black background, yellow foreground */
-		stosw
-
-		/* Sanity check for the cursor on the last line */
-		inc %bx
-		cmp $2000, %bx
-		jb early_puts_ploop
-
-		/* Scroll the screen (24 rows) */
-		movl %esi, %edx
-		movl $(PA2KA(0xb80a0)), %esi
-		movl $(PA2KA(0xb8000)), %edi
-		movl $960, %ecx
-		rep movsl
-
-		/* Clear the 24th row */
-		xorl %eax, %eax
-		movl $40, %ecx
-		rep stosl
-
-		/* Go to row 24 */
-		movl %edx, %esi
-		movl $(PA2KA(0xb8f00)), %edi
-		movw $1920, %bx
-
-		jmp early_puts_ploop
-	early_puts_ploop_end:
-
-	/* Write bits 8 - 15 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xe, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bh, %al
-	outb %al, %dx
-
-	/* Write bits 0 - 7 of the cursor address */
-	movw $0x3d4, %dx
-	movb $0xf, %al
-	outb %al, %dx
-
-	movw $0x3d5, %dx
-	movb %bl, %al
-	outb %al, %dx
-
-	/* Epilogue, restore preserved registers */
-	popl %edi
-	popl %esi
-	popl %ebx
-	leave
-
-#endif
-
-	ret
-
-#include "vesa_real.inc"
-
-.section K_DATA_START, "aw", @progbits
-
-.align 4096
-page_directory:
-	.space 4096, 0
-
-SYMBOL(bootstrap_idtr)
-	.word 0
-	.long 0
-
-SYMBOL(bootstrap_gdtr)
-	.word GDT_SELECTOR(GDT_ITEMS)
-	.long KA2PA(gdt)
-
-SYMBOL(multiboot_eax)
-	.long 0
-
-SYMBOL(multiboot_ebx)
-	.long 0
-
-pt_loc:
-	.long 0
-kernel_end:
-	.long 0
-free_area:
-	.long 0
-
-status_prot:
-	.asciz "[prot] "
-status_pse:
-	.asciz "[pse] "
-status_non_pse:
-	.asciz "[non_pse] "
-status_vesa_copy:
-	.asciz "[vesa_copy] "
-status_multiboot_cmdline:
-	.asciz "[multiboot_cmdline] "
-status_vesa_real:
-	.asciz "[vesa_real] "
-status_prot2:
-	.asciz "[prot2] "
-status_prot3:
-	.asciz "[prot3] "
-status_main:
-	.asciz "[main] "
Index: rnel/arch/ia32/src/boot/multiboot2.S
===================================================================
--- kernel/arch/ia32/src/boot/multiboot2.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/pm.h>
-#include <arch/cpuid.h>
-#include <genarch/multiboot/multiboot2.h>
-
-#define START_STACK  (BOOT_OFFSET - BOOT_STACK_SIZE)
-
-.section K_TEXT_START, "ax"
-
-.code32
-
-.align 8
-multiboot2_header_start:
-	.long MULTIBOOT2_HEADER_MAGIC
-	.long MULTIBOOT2_HEADER_ARCH_I386
-	.long multiboot2_header_end - multiboot2_header_start
-	.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
-
-	/* Information request tag */
-	.align 8
-	tag_info_req_start:
-		.word MULTIBOOT2_TAG_INFO_REQ
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_info_req_end - tag_info_req_start
-		.long MULTIBOOT2_TAG_CMDLINE
-		.long MULTIBOOT2_TAG_MODULE
-		.long MULTIBOOT2_TAG_MEMMAP
-#ifdef CONFIG_FB
-		.long MULTIBOOT2_TAG_FBINFO
-#endif
-	tag_info_req_end:
-
-	/* Address tag */
-	.align 8
-	tag_address_start:
-		.word MULTIBOOT2_TAG_ADDRESS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_address_end - tag_address_start
-		.long multiboot2_header_start
-		.long unmapped_start
-		.long 0
-		.long 0
-	tag_address_end:
-
-	/* Entry address tag */
-	.align 8
-	tag_entry_address_start:
-		.word MULTIBOOT2_TAG_ENTRY_ADDRESS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_entry_address_end - tag_entry_address_start
-		.long multiboot2_image_start
-	tag_entry_address_end:
-
-	/* Flags tag */
-	.align 8
-	tag_flags_start:
-		.word MULTIBOOT2_TAG_FLAGS
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_flags_end - tag_flags_start
-		.long MULTIBOOT2_FLAGS_CONSOLE
-	tag_flags_end:
-
-#ifdef CONFIG_FB
-	/* Framebuffer tag */
-	.align 8
-	tag_framebuffer_start:
-		.word MULTIBOOT2_TAG_FRAMEBUFFER
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_framebuffer_end - tag_framebuffer_start
-		.long CONFIG_BFB_WIDTH
-		.long CONFIG_BFB_HEIGHT
-		.long CONFIG_BFB_BPP
-	tag_framebuffer_end:
-#endif
-
-	/* Module alignment tag */
-	.align 8
-	tag_module_align_start:
-		.word MULTIBOOT2_TAG_MODULE_ALIGN
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_module_align_end - tag_module_align_start
-		.long 0
-	tag_module_align_end:
-
-	/* Tag terminator */
-	.align 8
-	tag_terminator_start:
-		.word MULTIBOOT2_TAG_TERMINATOR
-		.word MULTIBOOT2_FLAGS_REQUIRED
-		.long tag_terminator_end - tag_terminator_start
-	tag_terminator_end:
-multiboot2_header_end:
-
-SYMBOL(multiboot2_image_start)
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/*
-	 * Initialize Global Descriptor Table and
-	 * Interrupt Descriptor Table registers
-	 */
-	lgdtl bootstrap_gdtr
-	lidtl bootstrap_idtr
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %fs
-	movw %cx, %gs
-	movw %cx, %ds
-	movw %cx, %ss
-
-	jmpl $GDT_SELECTOR(KTEXT_DES), $multiboot2_meeting_point
-	multiboot2_meeting_point:
-
-	/* Save multiboot arguments */
-	movl %eax, multiboot_eax
-	movl %ebx, multiboot_ebx
-
-#ifndef PROCESSOR_i486
-
-	movl $(INTEL_CPUID_LEVEL), %eax
-	cpuid
-	cmp $0x0, %eax  /* any function > 0? */
-	jbe pse_unsupported
-
-	movl $(INTEL_CPUID_STANDARD), %eax
-	cpuid
-	bt $(INTEL_PSE), %edx
-	jnc pse_unsupported
-
-		/* Map kernel and turn paging on */
-		call map_kernel_pse
-		jmp stack_init
-
-#endif /* PROCESSOR_i486 */
-
-	pse_unsupported:
-
-		/* Map kernel and turn paging on */
-		call map_kernel_non_pse
-
-	stack_init:
-
-	/* Create the first stack frame */
-	pushl $0
-	movl %esp, %ebp
-
-	/* Call ia32_pre_main(multiboot_eax, multiboot_ebx) */
-	pushl multiboot_ebx
-	pushl multiboot_eax
-	call ia32_pre_main
-
-	/* Call main_bsp() */
-	call main_bsp
-
-	/* Not reached */
-	cli
-	hlt0:
-		hlt
-		jmp hlt0
Index: rnel/arch/ia32/src/boot/vesa_prot.inc
===================================================================
--- kernel/arch/ia32/src/boot/vesa_prot.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-#ifdef CONFIG_FB
-
-#define MBINFO_BIT_CMDLINE      2
-#define MBINFO_OFFSET_CMDLINE   16
-
-	/* Copy real mode VESA initialization code */
-
-	pm_status $status_vesa_copy
-
-	mov $vesa_init, %esi
-	mov $VESA_INIT_SEGMENT << 4, %edi
-	mov $e_vesa_init - vesa_init, %ecx
-	rep movsb
-
-	/* Check for multiboot command line */
-
-	pm_status $status_multiboot_cmdline
-
-	mov multiboot_eax, %eax
-	cmp $MULTIBOOT_LOADER_MAGIC, %eax
-	jne no_cmdline
-
-	mov multiboot_ebx, %ebx
-	mov (%ebx), %eax
-	bt $MBINFO_BIT_CMDLINE, %eax
-	jnc no_cmdline
-
-	/* Skip the kernel path in command line */
-
-	mov MBINFO_OFFSET_CMDLINE(%ebx), %esi
-
-	skip_loop:
-		lodsb
-
-		cmp $0, %al
-		je no_cmdline
-
-		cmp $' ', %al
-		je skip_loop_done
-
-		jmp skip_loop
-	skip_loop_done:
-
-	space_loop:
-		mov (%esi), %al
-
-		cmp $0, %al
-		je no_cmdline
-
-		cmp $' ', %al
-		jne space_loop_done
-
-		inc %esi
-		jmp space_loop
-	space_loop_done:
-
-	/* Copy at most 23 characters from command line */
-
-	mov $VESA_INIT_SEGMENT << 4, %edi
-	add $default_mode - vesa_init, %edi
-	mov $23, %ecx
-
-	cmd_loop:
-		lodsb
-		stosb
-
-		cmp $0, %al
-		je cmd_loop_done
-
-		loop cmd_loop
-	cmd_loop_done:
-
-	/* Zero termination */
-
-	xor %eax, %eax
-	stosb
-
-	no_cmdline:
-
-	/* Jump to the real mode */
-
-	pm_status $status_vesa_real
-
-	mov $VESA_INIT_SEGMENT << 4, %edi
-	jmpl *%edi
-
-	vesa_meeting_point:
-		/* Returned back to protected mode */
-
-		/*
-		 * Initialize Global Descriptor Table and
-		 * Interrupt Descriptor Table registers
-		 */
-		lgdtl bootstrap_gdtr
-		lidtl bootstrap_idtr
-
-		movzx %ax, %ecx
-		mov %ecx, KA2PA(bfb_scanline)
-
-		shr $16, %eax
-		mov %ax, KA2PA(bfb_bpp)
-
-		movzx %bx, %ecx
-		mov %ecx, KA2PA(bfb_height)
-
-		shr $16, %ebx
-		mov %ebx, KA2PA(bfb_width)
-
-		mov %dl, KA2PA(bfb_green_pos)
-
-		shr $8, %edx
-		mov %dl, KA2PA(bfb_green_size)
-
-		shr $8, %edx
-		mov %dl, KA2PA(bfb_red_pos)
-
-		shr $8, %edx
-		mov %dl, KA2PA(bfb_red_size)
-
-		mov %esi, %edx
-		mov %dl, KA2PA(bfb_blue_pos)
-
-		shr $8, %edx
-		mov %dl, KA2PA(bfb_blue_size)
-
-		mov %edi, KA2PA(bfb_addr)
-#endif
Index: rnel/arch/ia32/src/boot/vesa_real.inc
===================================================================
--- kernel/arch/ia32/src/boot/vesa_real.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,444 +1,0 @@
-#ifdef CONFIG_FB
-
-#include <macros.h>
-
-#define VESA_INFO_SIZE 1024
-
-#define VESA_MODE_ATTRIBUTES_OFFSET  0
-#define VESA_MODE_LIST_PTR_OFFSET    14
-#define VESA_MODE_SCANLINE_OFFSET    16
-#define VESA_MODE_WIDTH_OFFSET       18
-#define VESA_MODE_HEIGHT_OFFSET      20
-#define VESA_MODE_BPP_OFFSET         25
-#define VESA_MODE_RED_MASK_OFFSET    31
-#define VESA_MODE_RED_POS_OFFSET     32
-#define VESA_MODE_GREEN_MASK_OFFSET  33
-#define VESA_MODE_GREEN_POS_OFFSET   34
-#define VESA_MODE_BLUE_MASK_OFFSET   35
-#define VESA_MODE_BLUE_POS_OFFSET    36
-#define VESA_MODE_PHADDR_OFFSET      40
-
-#define VESA_END_OF_MODES  0xffff
-
-#define VESA_OK  0x004f
-
-#define VESA_GET_INFO       0x4f00
-#define VESA_GET_MODE_INFO  0x4f01
-#define VESA_SET_MODE       0x4f02
-#define VESA_SET_PALETTE    0x4f09
-
-.code32
-vesa_init:
-	lidtl vesa_idtr
-
-	mov $GDT_SELECTOR(VESA_INIT_DATA_DES), %bx
-
-	mov %bx, %es
-	mov %bx, %fs
-	mov %bx, %gs
-	mov %bx, %ds
-	mov %bx, %ss
-
-	jmp $GDT_SELECTOR(VESA_INIT_CODE_DES), $vesa_init_real - vesa_init
-
-vesa_idtr:
-	.word 0x3ff
-	.long 0
-
-.code16
-vesa_init_real:
-	mov %cr0, %eax
-	and $~CR0_PE, %eax
-	mov %eax, %cr0
-
-	jmp $VESA_INIT_SEGMENT, $vesa_init_real2 - vesa_init
-
-vesa_init_real2:
-	mov $VESA_INIT_SEGMENT, %bx
-
-	mov %bx, %es
-	mov %bx, %fs
-	mov %bx, %gs
-	mov %bx, %ds
-	mov %bx, %ss
-
-	movl %esp, %eax
-	movl $0x0000fffc, %esp
-	movl $0x0000fffc, %ebp
-	pushl %eax
-
-	/* Parse default mode string */
-
-	mov $default_mode - vesa_init, %di
-	xor %eax, %eax
-	xor %ebx, %ebx
-
-	mov $8, %ecx
-	parse_width:
-		mov (%di), %al
-
-		/* Check for digit */
-
-		cmp $'0', %al
-		jb parse_width_done
-
-		cmp $'9', %al
-		ja parse_width_done
-
-		sub $'0', %al
-
-		/* Multiply default_width by 10 and add digit */
-
-		mov default_width - vesa_init, %bx
-		lea (%ebx, %ebx, 4), %ebx
-		shl $1, %ebx
-		add %ax, %bx
-		mov %bx, default_width - vesa_init
-
-		inc %di
-		loop parse_width
-	parse_width_done:
-
-	mov (%di), %al
-	cmp $0, %al
-	jz parse_done
-	inc %di
-
-	mov $8, %ecx
-	parse_height:
-		mov (%di), %al
-
-		/* Check for digit */
-
-		cmp $'0', %al
-		jb parse_height_done
-
-		cmp $'9', %al
-		ja parse_height_done
-
-		sub $'0', %al
-
-		/* Multiply default_height by 10 and add digit */
-
-		mov default_height - vesa_init, %bx
-		lea (%ebx, %ebx, 4), %ebx
-		shl $1, %ebx
-		add %ax, %bx
-		mov %bx, default_height - vesa_init
-
-		inc %di
-		loop parse_height
-	parse_height_done:
-
-	mov (%di), %al
-	cmp $0, %al
-	jz parse_done
-	inc %di
-
-	mov $4, %ecx
-	parse_bpp:
-		mov (%di), %al
-
-		/* Check for digit */
-
-		cmp $'0', %al
-		jb parse_bpp_done
-
-		cmp $'9', %al
-		ja parse_bpp_done
-
-		sub $'0', %al
-
-		/* Multiply default_bpp by 10 and add digit */
-
-		mov default_bpp - vesa_init, %bx
-		lea (%ebx, %ebx, 4), %ebx
-		shl $1, %ebx
-		add %ax, %bx
-		mov %bx, default_bpp - vesa_init
-
-		inc %di
-		loop parse_bpp
-	parse_bpp_done:
-
-	parse_done:
-
-	mov $VESA_GET_INFO, %ax
-	mov $e_vesa_init - vesa_init, %di
-	push %di
-	/* Write the "VBE2" signature into the info structure in order
-	 * to get proper mode information. The presence of "VBE2"
-	 * indicates two things:
-	 *
-	 *  - VBE controller information structure is expected to be
-	 *    512 bytes long instead of 256 bytes.
-	 *  - The BIOS should report VBE 3.0 information (potentially
-	 *    including non-standard modes in the mode list).
-	 */
-	movl $0x32454256, (%di)
-	int $0x10
-
-	pop %di
-	cmp $VESA_OK, %ax
-	jnz no_mode
-
-	mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si
-	mov %si, %gs
-	mov VESA_MODE_LIST_PTR_OFFSET(%di), %si
-
-	add $VESA_INFO_SIZE, %di
-
-	next_mode:
-		/* Try next mode */
-
-		mov %gs:(%si), %cx
-		cmp $VESA_END_OF_MODES, %cx
-		je no_mode
-
-		inc %si
-		inc %si
-		push %cx
-		push %di
-		push %si
-		mov $VESA_GET_MODE_INFO, %ax
-		int $0x10
-
-		pop %si
-		pop %di
-		pop %cx
-		cmp $VESA_OK, %ax
-		jne no_mode
-
-		/*
-		 * Check for proper attributes (supported,
-		 * color, graphics, linear framebuffer).
-		 */
-
-		mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax
-		and $0x99, %ax
-		cmp $0x99, %ax
-		jne next_mode
-
-		/* Check for proper resolution */
-
-		mov default_width - vesa_init, %ax
-		cmp VESA_MODE_WIDTH_OFFSET(%di), %ax
-		jne next_mode
-
-		mov default_height - vesa_init, %ax
-		cmp VESA_MODE_HEIGHT_OFFSET(%di), %ax
-		jne next_mode
-
-		/* Check for proper bpp */
-
-		mov default_bpp - vesa_init, %al
-		cmp VESA_MODE_BPP_OFFSET(%di), %al
-		je set_mode
-
-		mov $24, %al
-		cmp default_bpp - vesa_init, %al
-		jne next_mode
-
-		/* For 24 bpp modes accept also 32 bit bpp */
-
-		mov $32, %al
-		cmp VESA_MODE_BPP_OFFSET(%di), %al
-		jne next_mode
-
-	set_mode:
-		mov %cx, %bx
-		or $0xc000, %bx
-		push %di
-		mov $VESA_SET_MODE, %ax
-		int $0x10
-
-		pop %di
-		cmp $VESA_OK, %ax
-		jnz no_mode
-
-		/* Set 3:2:3 VGA palette */
-
-		mov VESA_MODE_BPP_OFFSET(%di), %al
-		cmp $8, %al
-		jnz vga_not_set
-
-		mov VESA_MODE_ATTRIBUTES_OFFSET(%di), %ax
-		push %di
-		mov $vga323 - vesa_init, %di
-		mov $0x100, %ecx
-
-		/* Test if VGA compatible registers are present */
-		bt $5, %ax
-		jnc vga_compat
-
-			/* Use VESA routine to set the palette */
-
-			mov $VESA_SET_PALETTE, %ax
-			xor %bl, %bl
-			xor %dx, %dx
-			int $0x10
-
-			cmp $0x00, %ah
-			je vga_not_compat
-
-		vga_compat:
-
-			/* Use VGA registers to set the palette */
-
-			movw $0x3c6, %dx  /* set palette mask */
-			movb $0xff, %al
-			outb %al, %dx
-
-			movw $0x3c8, %dx  /* first index to set */
-			xor %al, %al
-			outb %al, %dx
-
-			movw $0x3c9, %dx  /* data port */
-
-			vga_loop:
-				movb %es:2(%di), %al
-				outb %al, %dx
-
-				movb %es:1(%di), %al
-				outb %al, %dx
-
-				movb %es:(%di), %al
-				outb %al, %dx
-
-				addw $4, %di
-			loop vga_loop
-
-		vga_not_compat:
-
-			pop %di
-
-		vga_not_set:
-
-		/*
-		 * Store mode parameters:
-		 *  eax = bpp[16] scanline[16]
-		 *  ebx = width[16]  height[16]
-		 *  edx = red_mask[8] red_pos[8] green_mask[8] green_pos[8]
-		 *  esi = blue_mask[8] blue_pos[8]
-		 *  edi = linear frame buffer
-		 */
-
-		mov VESA_MODE_BPP_OFFSET(%di), %al
-		xor %ah, %ah
-		shl $16, %eax
-		mov VESA_MODE_SCANLINE_OFFSET(%di), %ax
-
-		mov VESA_MODE_WIDTH_OFFSET(%di), %bx
-		shl $16, %ebx
-		mov VESA_MODE_HEIGHT_OFFSET(%di), %bx
-
-		mov VESA_MODE_BLUE_MASK_OFFSET(%di), %dl
-		shl $8, %edx
-		mov VESA_MODE_BLUE_POS_OFFSET(%di), %dl
-		mov %edx, %esi
-
-		mov VESA_MODE_RED_MASK_OFFSET(%di), %dl
-		shl $8, %edx
-		mov VESA_MODE_RED_POS_OFFSET(%di), %dl
-
-		shl $8, %edx
-		mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl
-		shl $8, %edx
-		mov VESA_MODE_GREEN_POS_OFFSET(%di), %dl
-
-		mov VESA_MODE_PHADDR_OFFSET(%di), %edi
-
-		vesa_leave_real:
-
-			mov %cr0, %ecx
-			or $CR0_PE, %ecx
-			mov %ecx, %cr0
-
-			jmp vesa_leave_real2
-
-		vesa_leave_real2:
-
-			ljmpl $GDT_SELECTOR(KTEXT32_DES), $(vesa_init_protected - vesa_init + VESA_INIT_SEGMENT << 4)
-
-	no_mode:
-
-		/* No prefered mode found */
-		push %di
-		mov $e_vesa_init - vesa_init, %di
-		mov 2 + VESA_MODE_LIST_PTR_OFFSET(%di), %si
-		mov %si, %gs
-		mov VESA_MODE_LIST_PTR_OFFSET(%di), %si
-		pop %di
-
-		/* Check if list of supported modes contains fallback mode */
-	find_fallback_mode:
-
-		mov %gs:(%si), %cx
-
-		cmp $0x111, %cx
-		je fallback_mode_listed
-
-		cmp $VESA_END_OF_MODES, %cx
-		je text_mode
-
-		inc %si
-		inc %si
-		jmp find_fallback_mode /* 16-bit relative jump */
-
-	fallback_mode_listed:
-		/* Make sure fallback mode is really supported */
-		mov $0x111, %cx
-		push %di
-		push %cx
-		mov $VESA_GET_MODE_INFO, %ax
-		int $0x10
-
-		pop %cx
-		pop %di
-		cmp $VESA_OK, %ax
-		jnz text_mode
-
-		/* Verify mode attributes */
-		and $0x99, %ax
-		cmp $0x99, %ax
-		jne text_mode
-
-		jmp set_mode  /* 16-bit relative jump */
-
-	text_mode:
-
-		/* Reset to EGA text mode (because of problems with VESA) */
-
-		mov $0x0003, %ax
-		int $0x10
-
-		xor %eax, %eax
-		xor %ebx, %ebx
-		xor %edx, %edx
-		xor %edi, %edi
-
-		jz vesa_leave_real  /* force relative jump */
-
-vga323:
-#include "vga323.pal"
-
-default_width:
-	.word 0
-
-default_height:
-	.word 0
-
-default_bpp:
-	.byte 0
-
-default_mode:
-	.ascii STRING(CONFIG_BFB_MODE)
-	.ascii "-"
-	.asciz STRING(CONFIG_BFB_BPP)
-	.fill 24
-
-#include "vesa_ret.inc"
-
-.align 4
-e_vesa_init:
-#endif
Index: rnel/arch/ia32/src/boot/vesa_ret.inc
===================================================================
--- kernel/arch/ia32/src/boot/vesa_ret.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,17 +1,0 @@
-.code32
-vesa_init_protected:
-	cli
-	cld
-
-	/* Initialize stack pointer */
-	movl $START_STACK, %esp
-
-	/* Kernel data + stack */
-	movw $GDT_SELECTOR(KDATA_DES), %cx
-	movw %cx, %es
-	movw %cx, %fs
-	movw %cx, %gs
-	movw %cx, %ds
-	movw %cx, %ss
-
-	jmpl $GDT_SELECTOR(KTEXT_DES), $vesa_meeting_point
Index: rnel/arch/ia32/src/boot/vga323.pal
===================================================================
--- kernel/arch/ia32/src/boot/vga323.pal	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-	.byte 0x3f, 0x3f, 0x3f, 0x00
-	.byte 0x36, 0x3f, 0x3f, 0x00
-	.byte 0x2d, 0x3f, 0x3f, 0x00
-	.byte 0x24, 0x3f, 0x3f, 0x00
-	.byte 0x1b, 0x3f, 0x3f, 0x00
-	.byte 0x12, 0x3f, 0x3f, 0x00
-	.byte 0x09, 0x3f, 0x3f, 0x00
-	.byte 0x00, 0x3f, 0x3f, 0x00
-	.byte 0x3f, 0x2a, 0x3f, 0x00
-	.byte 0x36, 0x2a, 0x3f, 0x00
-	.byte 0x2d, 0x2a, 0x3f, 0x00
-	.byte 0x24, 0x2a, 0x3f, 0x00
-	.byte 0x1b, 0x2a, 0x3f, 0x00
-	.byte 0x12, 0x2a, 0x3f, 0x00
-	.byte 0x09, 0x2a, 0x3f, 0x00
-	.byte 0x00, 0x2a, 0x3f, 0x00
-	.byte 0x3f, 0x15, 0x3f, 0x00
-	.byte 0x36, 0x15, 0x3f, 0x00
-	.byte 0x2d, 0x15, 0x3f, 0x00
-	.byte 0x24, 0x15, 0x3f, 0x00
-	.byte 0x1b, 0x15, 0x3f, 0x00
-	.byte 0x12, 0x15, 0x3f, 0x00
-	.byte 0x09, 0x15, 0x3f, 0x00
-	.byte 0x00, 0x15, 0x3f, 0x00
-	.byte 0x3f, 0x00, 0x3f, 0x00
-	.byte 0x36, 0x00, 0x3f, 0x00
-	.byte 0x2d, 0x00, 0x3f, 0x00
-	.byte 0x24, 0x00, 0x3f, 0x00
-	.byte 0x1b, 0x00, 0x3f, 0x00
-	.byte 0x12, 0x00, 0x3f, 0x00
-	.byte 0x09, 0x00, 0x3f, 0x00
-	.byte 0x00, 0x00, 0x3f, 0x00
-	.byte 0x3f, 0x3f, 0x36, 0x00
-	.byte 0x36, 0x3f, 0x36, 0x00
-	.byte 0x2d, 0x3f, 0x36, 0x00
-	.byte 0x24, 0x3f, 0x36, 0x00
-	.byte 0x1b, 0x3f, 0x36, 0x00
-	.byte 0x12, 0x3f, 0x36, 0x00
-	.byte 0x09, 0x3f, 0x36, 0x00
-	.byte 0x00, 0x3f, 0x36, 0x00
-	.byte 0x3f, 0x2a, 0x36, 0x00
-	.byte 0x36, 0x2a, 0x36, 0x00
-	.byte 0x2d, 0x2a, 0x36, 0x00
-	.byte 0x24, 0x2a, 0x36, 0x00
-	.byte 0x1b, 0x2a, 0x36, 0x00
-	.byte 0x12, 0x2a, 0x36, 0x00
-	.byte 0x09, 0x2a, 0x36, 0x00
-	.byte 0x00, 0x2a, 0x36, 0x00
-	.byte 0x3f, 0x15, 0x36, 0x00
-	.byte 0x36, 0x15, 0x36, 0x00
-	.byte 0x2d, 0x15, 0x36, 0x00
-	.byte 0x24, 0x15, 0x36, 0x00
-	.byte 0x1b, 0x15, 0x36, 0x00
-	.byte 0x12, 0x15, 0x36, 0x00
-	.byte 0x09, 0x15, 0x36, 0x00
-	.byte 0x00, 0x15, 0x36, 0x00
-	.byte 0x3f, 0x00, 0x36, 0x00
-	.byte 0x36, 0x00, 0x36, 0x00
-	.byte 0x2d, 0x00, 0x36, 0x00
-	.byte 0x24, 0x00, 0x36, 0x00
-	.byte 0x1b, 0x00, 0x36, 0x00
-	.byte 0x12, 0x00, 0x36, 0x00
-	.byte 0x09, 0x00, 0x36, 0x00
-	.byte 0x00, 0x00, 0x36, 0x00
-	.byte 0x3f, 0x3f, 0x2d, 0x00
-	.byte 0x36, 0x3f, 0x2d, 0x00
-	.byte 0x2d, 0x3f, 0x2d, 0x00
-	.byte 0x24, 0x3f, 0x2d, 0x00
-	.byte 0x1b, 0x3f, 0x2d, 0x00
-	.byte 0x12, 0x3f, 0x2d, 0x00
-	.byte 0x09, 0x3f, 0x2d, 0x00
-	.byte 0x00, 0x3f, 0x2d, 0x00
-	.byte 0x3f, 0x2a, 0x2d, 0x00
-	.byte 0x36, 0x2a, 0x2d, 0x00
-	.byte 0x2d, 0x2a, 0x2d, 0x00
-	.byte 0x24, 0x2a, 0x2d, 0x00
-	.byte 0x1b, 0x2a, 0x2d, 0x00
-	.byte 0x12, 0x2a, 0x2d, 0x00
-	.byte 0x09, 0x2a, 0x2d, 0x00
-	.byte 0x00, 0x2a, 0x2d, 0x00
-	.byte 0x3f, 0x15, 0x2d, 0x00
-	.byte 0x36, 0x15, 0x2d, 0x00
-	.byte 0x2d, 0x15, 0x2d, 0x00
-	.byte 0x24, 0x15, 0x2d, 0x00
-	.byte 0x1b, 0x15, 0x2d, 0x00
-	.byte 0x12, 0x15, 0x2d, 0x00
-	.byte 0x09, 0x15, 0x2d, 0x00
-	.byte 0x00, 0x15, 0x2d, 0x00
-	.byte 0x3f, 0x00, 0x2d, 0x00
-	.byte 0x36, 0x00, 0x2d, 0x00
-	.byte 0x2d, 0x00, 0x2d, 0x00
-	.byte 0x24, 0x00, 0x2d, 0x00
-	.byte 0x1b, 0x00, 0x2d, 0x00
-	.byte 0x12, 0x00, 0x2d, 0x00
-	.byte 0x09, 0x00, 0x2d, 0x00
-	.byte 0x00, 0x00, 0x2d, 0x00
-	.byte 0x3f, 0x3f, 0x24, 0x00
-	.byte 0x36, 0x3f, 0x24, 0x00
-	.byte 0x2d, 0x3f, 0x24, 0x00
-	.byte 0x24, 0x3f, 0x24, 0x00
-	.byte 0x1b, 0x3f, 0x24, 0x00
-	.byte 0x12, 0x3f, 0x24, 0x00
-	.byte 0x09, 0x3f, 0x24, 0x00
-	.byte 0x00, 0x3f, 0x24, 0x00
-	.byte 0x3f, 0x2a, 0x24, 0x00
-	.byte 0x36, 0x2a, 0x24, 0x00
-	.byte 0x2d, 0x2a, 0x24, 0x00
-	.byte 0x24, 0x2a, 0x24, 0x00
-	.byte 0x1b, 0x2a, 0x24, 0x00
-	.byte 0x12, 0x2a, 0x24, 0x00
-	.byte 0x09, 0x2a, 0x24, 0x00
-	.byte 0x00, 0x2a, 0x24, 0x00
-	.byte 0x3f, 0x15, 0x24, 0x00
-	.byte 0x36, 0x15, 0x24, 0x00
-	.byte 0x2d, 0x15, 0x24, 0x00
-	.byte 0x24, 0x15, 0x24, 0x00
-	.byte 0x1b, 0x15, 0x24, 0x00
-	.byte 0x12, 0x15, 0x24, 0x00
-	.byte 0x09, 0x15, 0x24, 0x00
-	.byte 0x00, 0x15, 0x24, 0x00
-	.byte 0x3f, 0x00, 0x24, 0x00
-	.byte 0x36, 0x00, 0x24, 0x00
-	.byte 0x2d, 0x00, 0x24, 0x00
-	.byte 0x24, 0x00, 0x24, 0x00
-	.byte 0x1b, 0x00, 0x24, 0x00
-	.byte 0x12, 0x00, 0x24, 0x00
-	.byte 0x09, 0x00, 0x24, 0x00
-	.byte 0x00, 0x00, 0x24, 0x00
-	.byte 0x3f, 0x3f, 0x1b, 0x00
-	.byte 0x36, 0x3f, 0x1b, 0x00
-	.byte 0x2d, 0x3f, 0x1b, 0x00
-	.byte 0x24, 0x3f, 0x1b, 0x00
-	.byte 0x1b, 0x3f, 0x1b, 0x00
-	.byte 0x12, 0x3f, 0x1b, 0x00
-	.byte 0x09, 0x3f, 0x1b, 0x00
-	.byte 0x00, 0x3f, 0x1b, 0x00
-	.byte 0x3f, 0x2a, 0x1b, 0x00
-	.byte 0x36, 0x2a, 0x1b, 0x00
-	.byte 0x2d, 0x2a, 0x1b, 0x00
-	.byte 0x24, 0x2a, 0x1b, 0x00
-	.byte 0x1b, 0x2a, 0x1b, 0x00
-	.byte 0x12, 0x2a, 0x1b, 0x00
-	.byte 0x09, 0x2a, 0x1b, 0x00
-	.byte 0x00, 0x2a, 0x1b, 0x00
-	.byte 0x3f, 0x15, 0x1b, 0x00
-	.byte 0x36, 0x15, 0x1b, 0x00
-	.byte 0x2d, 0x15, 0x1b, 0x00
-	.byte 0x24, 0x15, 0x1b, 0x00
-	.byte 0x1b, 0x15, 0x1b, 0x00
-	.byte 0x12, 0x15, 0x1b, 0x00
-	.byte 0x09, 0x15, 0x1b, 0x00
-	.byte 0x00, 0x15, 0x1b, 0x00
-	.byte 0x3f, 0x00, 0x1b, 0x00
-	.byte 0x36, 0x00, 0x1b, 0x00
-	.byte 0x2d, 0x00, 0x1b, 0x00
-	.byte 0x24, 0x00, 0x1b, 0x00
-	.byte 0x1b, 0x00, 0x1b, 0x00
-	.byte 0x12, 0x00, 0x1b, 0x00
-	.byte 0x09, 0x00, 0x1b, 0x00
-	.byte 0x00, 0x00, 0x1b, 0x00
-	.byte 0x3f, 0x3f, 0x12, 0x00
-	.byte 0x36, 0x3f, 0x12, 0x00
-	.byte 0x2d, 0x3f, 0x12, 0x00
-	.byte 0x24, 0x3f, 0x12, 0x00
-	.byte 0x1b, 0x3f, 0x12, 0x00
-	.byte 0x12, 0x3f, 0x12, 0x00
-	.byte 0x09, 0x3f, 0x12, 0x00
-	.byte 0x00, 0x3f, 0x12, 0x00
-	.byte 0x3f, 0x2a, 0x12, 0x00
-	.byte 0x36, 0x2a, 0x12, 0x00
-	.byte 0x2d, 0x2a, 0x12, 0x00
-	.byte 0x24, 0x2a, 0x12, 0x00
-	.byte 0x1b, 0x2a, 0x12, 0x00
-	.byte 0x12, 0x2a, 0x12, 0x00
-	.byte 0x09, 0x2a, 0x12, 0x00
-	.byte 0x00, 0x2a, 0x12, 0x00
-	.byte 0x3f, 0x15, 0x12, 0x00
-	.byte 0x36, 0x15, 0x12, 0x00
-	.byte 0x2d, 0x15, 0x12, 0x00
-	.byte 0x24, 0x15, 0x12, 0x00
-	.byte 0x1b, 0x15, 0x12, 0x00
-	.byte 0x12, 0x15, 0x12, 0x00
-	.byte 0x09, 0x15, 0x12, 0x00
-	.byte 0x00, 0x15, 0x12, 0x00
-	.byte 0x3f, 0x00, 0x12, 0x00
-	.byte 0x36, 0x00, 0x12, 0x00
-	.byte 0x2d, 0x00, 0x12, 0x00
-	.byte 0x24, 0x00, 0x12, 0x00
-	.byte 0x1b, 0x00, 0x12, 0x00
-	.byte 0x12, 0x00, 0x12, 0x00
-	.byte 0x09, 0x00, 0x12, 0x00
-	.byte 0x00, 0x00, 0x12, 0x00
-	.byte 0x3f, 0x3f, 0x09, 0x00
-	.byte 0x36, 0x3f, 0x09, 0x00
-	.byte 0x2d, 0x3f, 0x09, 0x00
-	.byte 0x24, 0x3f, 0x09, 0x00
-	.byte 0x1b, 0x3f, 0x09, 0x00
-	.byte 0x12, 0x3f, 0x09, 0x00
-	.byte 0x09, 0x3f, 0x09, 0x00
-	.byte 0x00, 0x3f, 0x09, 0x00
-	.byte 0x3f, 0x2a, 0x09, 0x00
-	.byte 0x36, 0x2a, 0x09, 0x00
-	.byte 0x2d, 0x2a, 0x09, 0x00
-	.byte 0x24, 0x2a, 0x09, 0x00
-	.byte 0x1b, 0x2a, 0x09, 0x00
-	.byte 0x12, 0x2a, 0x09, 0x00
-	.byte 0x09, 0x2a, 0x09, 0x00
-	.byte 0x00, 0x2a, 0x09, 0x00
-	.byte 0x3f, 0x15, 0x09, 0x00
-	.byte 0x36, 0x15, 0x09, 0x00
-	.byte 0x2d, 0x15, 0x09, 0x00
-	.byte 0x24, 0x15, 0x09, 0x00
-	.byte 0x1b, 0x15, 0x09, 0x00
-	.byte 0x12, 0x15, 0x09, 0x00
-	.byte 0x09, 0x15, 0x09, 0x00
-	.byte 0x00, 0x15, 0x09, 0x00
-	.byte 0x3f, 0x00, 0x09, 0x00
-	.byte 0x36, 0x00, 0x09, 0x00
-	.byte 0x2d, 0x00, 0x09, 0x00
-	.byte 0x24, 0x00, 0x09, 0x00
-	.byte 0x1b, 0x00, 0x09, 0x00
-	.byte 0x12, 0x00, 0x09, 0x00
-	.byte 0x09, 0x00, 0x09, 0x00
-	.byte 0x00, 0x00, 0x09, 0x00
-	.byte 0x3f, 0x3f, 0x00, 0x00
-	.byte 0x36, 0x3f, 0x00, 0x00
-	.byte 0x2d, 0x3f, 0x00, 0x00
-	.byte 0x24, 0x3f, 0x00, 0x00
-	.byte 0x1b, 0x3f, 0x00, 0x00
-	.byte 0x12, 0x3f, 0x00, 0x00
-	.byte 0x09, 0x3f, 0x00, 0x00
-	.byte 0x00, 0x3f, 0x00, 0x00
-	.byte 0x3f, 0x2a, 0x00, 0x00
-	.byte 0x36, 0x2a, 0x00, 0x00
-	.byte 0x2d, 0x2a, 0x00, 0x00
-	.byte 0x24, 0x2a, 0x00, 0x00
-	.byte 0x1b, 0x2a, 0x00, 0x00
-	.byte 0x12, 0x2a, 0x00, 0x00
-	.byte 0x09, 0x2a, 0x00, 0x00
-	.byte 0x00, 0x2a, 0x00, 0x00
-	.byte 0x3f, 0x15, 0x00, 0x00
-	.byte 0x36, 0x15, 0x00, 0x00
-	.byte 0x2d, 0x15, 0x00, 0x00
-	.byte 0x24, 0x15, 0x00, 0x00
-	.byte 0x1b, 0x15, 0x00, 0x00
-	.byte 0x12, 0x15, 0x00, 0x00
-	.byte 0x09, 0x15, 0x00, 0x00
-	.byte 0x00, 0x15, 0x00, 0x00
-	.byte 0x3f, 0x00, 0x00, 0x00
-	.byte 0x36, 0x00, 0x00, 0x00
-	.byte 0x2d, 0x00, 0x00, 0x00
-	.byte 0x24, 0x00, 0x00, 0x00
-	.byte 0x1b, 0x00, 0x00, 0x00
-	.byte 0x12, 0x00, 0x00, 0x00
-	.byte 0x09, 0x00, 0x00, 0x00
-	.byte 0x00, 0x00, 0x00, 0x00
Index: rnel/arch/ia32/src/context.S
===================================================================
--- kernel/arch/ia32/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-#include <arch/vreg.h>
-
-.text
-
-## Save current CPU context
-#
-# Save CPU context to the context_t variable
-# pointed by the 1st argument. Returns 1 in EAX.
-#
-FUNCTION_BEGIN(context_save_arch)
-	movl 0(%esp), %eax	# save pc value into eax
-	movl 4(%esp), %edx	# address of the context variable to save context to
-
-	# save registers to given structure
-	movl %esp, CONTEXT_OFFSET_SP(%edx)	# %esp -> ctx->sp
-	movl %eax, CONTEXT_OFFSET_PC(%edx)	# %eip -> ctx->pc
-	movl %ebx, CONTEXT_OFFSET_EBX(%edx)	# %ebx -> ctx->ebx
-	movl %esi, CONTEXT_OFFSET_ESI(%edx)	# %esi -> ctx->esi
-	movl %edi, CONTEXT_OFFSET_EDI(%edx)	# %edi -> ctx->edi
-	movl %ebp, CONTEXT_OFFSET_EBP(%edx)	# %ebp -> ctx->ebp
-
-	mov vreg_ptr, %ecx
-	movl %gs:VREG_TP(%ecx), %ecx
-	movl %ecx, CONTEXT_OFFSET_TP(%edx)
-
-	xorl %eax, %eax		# context_save returns 1
-	incl %eax
-	ret
-FUNCTION_END(context_save_arch)
-
-## Restore saved CPU context
-#
-# Restore CPU context from context_t variable
-# pointed by the 1st argument. Returns 0 in EAX.
-#
-FUNCTION_BEGIN(context_restore_arch)
-	movl 4(%esp), %eax	# address of the context variable to restore context from
-
-	# restore registers from given structure
-	movl CONTEXT_OFFSET_SP(%eax), %esp	# ctx->sp -> %esp
-	movl CONTEXT_OFFSET_PC(%eax), %edx	# ctx->pc -> \pc
-	movl CONTEXT_OFFSET_EBX(%eax), %ebx	# ctx->ebx -> %ebx
-	movl CONTEXT_OFFSET_ESI(%eax), %esi	# ctx->esi -> %esi
-	movl CONTEXT_OFFSET_EDI(%eax), %edi	# ctx->edi -> %edi
-	movl CONTEXT_OFFSET_EBP(%eax), %ebp	# ctx->ebp -> %ebp
-
-	movl %edx, 0(%esp)	# put saved pc on stack
-
-	mov vreg_ptr, %ecx
-	movl CONTEXT_OFFSET_TP(%eax), %edx
-	movl %edx, %gs:VREG_TP(%ecx)
-
-	xorl %eax, %eax		# context_restore returns 0
-	ret
Index: rnel/arch/ia32/src/cpu/cpu.c
===================================================================
--- kernel/arch/ia32/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu.h>
-#include <arch/cpuid.h>
-#include <arch/pm.h>
-
-#include <arch.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <fpu_context.h>
-
-#include <arch/smp/apic.h>
-#include <arch/syscall.h>
-
-/*
- * Identification of CPUs.
- * Contains only non-MP-Specification specific SMP code.
- */
-#define AMD_CPUID_EBX  UINT32_C(0x68747541)
-#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
-#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
-
-#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
-#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
-#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
-
-enum vendor {
-	VendorUnknown = 0,
-	VendorAMD,
-	VendorIntel
-};
-
-static const char *vendor_str[] = {
-	"Unknown Vendor",
-	"AMD",
-	"Intel"
-};
-
-void fpu_disable(void)
-{
-	write_cr0(read_cr0() | CR0_TS);
-}
-
-void fpu_enable(void)
-{
-	write_cr0(read_cr0() & ~CR0_TS);
-}
-
-void cpu_arch_init(void)
-{
-	cpu_info_t info;
-	uint32_t help = 0;
-
-	CPU->arch.tss = tss_p;
-	CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] - ((uint8_t *) CPU->arch.tss);
-
-	cpuid(INTEL_CPUID_STANDARD, &info);
-
-	CPU->arch.fi.word = info.cpuid_edx;
-
-	if (CPU->arch.fi.bits.fxsr)
-		fpu_fxsr();
-	else
-		fpu_fsr();
-
-	if (CPU->arch.fi.bits.sse) {
-		asm volatile (
-		    "mov %%cr4, %[help]\n"
-		    "or %[mask], %[help]\n"
-		    "mov %[help], %%cr4\n"
-		    : [help] "+r" (help)
-		    : [mask] "i" (CR4_OSFXSR | CR4_OSXMMEXCPT)
-		);
-	}
-
-#ifndef PROCESSOR_i486
-	if (CPU->arch.fi.bits.sep) {
-		/* Setup fast SYSENTER/SYSEXIT syscalls */
-		syscall_setup_cpu();
-	}
-#endif
-}
-
-void cpu_identify(void)
-{
-	cpu_info_t info;
-
-	CPU->arch.vendor = VendorUnknown;
-	if (has_cpuid()) {
-		cpuid(INTEL_CPUID_LEVEL, &info);
-
-		/*
-		 * Check for AMD processor.
-		 */
-		if ((info.cpuid_ebx == AMD_CPUID_EBX) &&
-		    (info.cpuid_ecx == AMD_CPUID_ECX) &&
-		    (info.cpuid_edx == AMD_CPUID_EDX))
-			CPU->arch.vendor = VendorAMD;
-
-		/*
-		 * Check for Intel processor.
-		 */
-		if ((info.cpuid_ebx == INTEL_CPUID_EBX) &&
-		    (info.cpuid_ecx == INTEL_CPUID_ECX) &&
-		    (info.cpuid_edx == INTEL_CPUID_EDX))
-			CPU->arch.vendor = VendorIntel;
-
-		cpuid(INTEL_CPUID_STANDARD, &info);
-		CPU->arch.family = (info.cpuid_eax >> 8) & 0x0fU;
-		CPU->arch.model = (info.cpuid_eax >> 4) & 0x0fU;
-		CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0fU;
-	}
-}
-
-void cpu_print_report(cpu_t *cpu)
-{
-	printf("cpu%u: (%s family=%u model=%u stepping=%u apicid=%u) %" PRIu16
-	    " MHz\n", cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family,
-	    cpu->arch.model, cpu->arch.stepping, cpu->arch.id, cpu->frequency_mhz);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/ddi/ddi.c
===================================================================
--- kernel/arch/ia32/src/ddi/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_ddi
- * @{
- */
-/** @file
- */
-
-#include <ddi/ddi.h>
-#include <arch/ddi/ddi.h>
-#include <assert.h>
-#include <proc/task.h>
-#include <stddef.h>
-#include <adt/bitmap.h>
-#include <mm/slab.h>
-#include <arch/pm.h>
-#include <errno.h>
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <align.h>
-
-/** Install I/O Permission bitmap.
- *
- * Current task's I/O permission bitmap, if any, is installed
- * in the current CPU's TSS.
- *
- * Interrupts must be disabled prior this call.
- *
- */
-void io_perm_bitmap_install(void)
-{
-	/* First, copy the I/O Permission Bitmap. */
-	irq_spinlock_lock(&TASK->lock, false);
-
-	size_t ver = TASK->arch.iomapver;
-	size_t elements = TASK->arch.iomap.elements;
-
-	if (elements > 0) {
-		assert(TASK->arch.iomap.bits);
-
-		bitmap_t iomap;
-		bitmap_initialize(&iomap, TSS_IOMAP_SIZE * 8,
-		    CPU->arch.tss->iomap);
-		bitmap_copy(&iomap, &TASK->arch.iomap, elements);
-
-		/*
-		 * Set the trailing bits in the last byte of the map to disable
-		 * I/O access.
-		 */
-		bitmap_set_range(&iomap, elements,
-		    ALIGN_UP(elements, 8) - elements);
-
-		/*
-		 * It is safe to set the trailing eight bits because of the
-		 * extra convenience byte in TSS_IOMAP_SIZE.
-		 */
-		bitmap_set_range(&iomap, ALIGN_UP(elements, 8), 8);
-	}
-
-	irq_spinlock_unlock(&TASK->lock, false);
-
-	/*
-	 * Second, adjust TSS segment limit.
-	 * Take the extra ending byte with all bits set into account.
-	 */
-	ptr_16_32_t cpugdtr;
-	gdtr_store(&cpugdtr);
-
-	descriptor_t *gdt_p = (descriptor_t *) cpugdtr.base;
-	size_t size = bitmap_size(elements);
-	gdt_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE + size);
-	gdtr_load(&cpugdtr);
-
-	/*
-	 * Before we load new TSS limit, the current TSS descriptor
-	 * type must be changed to describe inactive TSS.
-	 */
-	gdt_p[TSS_DES].access = AR_PRESENT | AR_TSS | DPL_KERNEL;
-	tr_load(GDT_SELECTOR(TSS_DES));
-
-	/*
-	 * Update the generation count so that faults caused by
-	 * early accesses can be serviced.
-	 */
-	CPU->arch.iomapver_copy = ver;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/ia32/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <syscall/copy.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       1
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint32_t *stack = (void *) ctx->fp;
-	*prev = stack[FRAME_OFFSET_FP_PREV];
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint32_t *stack = (void *) ctx->fp;
-	*ra = stack[FRAME_OFFSET_RA];
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return !copy_from_uspace(prev,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return !copy_from_uspace(ra,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/ia32/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	movl %ebp, %eax
-	ret
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	movl (%esp), %eax
-	ret
-FUNCTION_END(program_counter_get)
Index: rnel/arch/ia32/src/delay.S
===================================================================
--- kernel/arch/ia32/src/delay.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Micro second delay loop functions.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(asm_delay_loop)
-	movl 4(%esp),%ecx	# move argument to %ecx
-0:	lahf
-	dec %ecx
-	jnz 0b
-	ret
-FUNCTION_END(asm_delay_loop)
-
-FUNCTION_BEGIN(asm_fake_loop)
-	movl 4(%esp),%ecx	# move argument to %ecx
-0:	lahf
-	dec %ecx
-	jz 0b
-	ret
-FUNCTION_END(asm_fake_loop)
-
Index: rnel/arch/ia32/src/drivers/i8254.c
===================================================================
--- kernel/arch/ia32/src/drivers/i8254.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/**
- * @file
- * @brief i8254 chip driver.
- *
- * Low level time functions.
- */
-
-#include <stdint.h>
-#include <time/clock.h>
-#include <time/delay.h>
-#include <arch/cycle.h>
-#include <arch/interrupt.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <arch/drivers/i8254.h>
-#include <cpu.h>
-#include <config.h>
-#include <arch/pm.h>
-#include <arch/asm.h>
-#include <arch/cpuid.h>
-#include <arch.h>
-#include <ddi/irq.h>
-
-#define CLK_PORT1  ((ioport8_t *) 0x40U)
-#define CLK_PORT4  ((ioport8_t *) 0x43U)
-
-#define CLK_CONST     1193180
-#define MAGIC_NUMBER  1194
-
-#define LOOPS  150000
-#define SHIFT  11
-
-static irq_t i8254_irq;
-
-static irq_ownership_t i8254_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void i8254_irq_handler(irq_t *irq)
-{
-	/*
-	 * This IRQ is responsible for kernel preemption.
-	 * Nevertheless, we are now holding a spinlock which prevents
-	 * preemption. For this particular IRQ, we don't need the
-	 * lock. We just release it, call clock() and then reacquire it again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-void i8254_init(void)
-{
-	irq_initialize(&i8254_irq);
-	i8254_irq.preack = true;
-	i8254_irq.inr = IRQ_CLK;
-	i8254_irq.claim = i8254_claim;
-	i8254_irq.handler = i8254_irq_handler;
-	irq_register(&i8254_irq);
-
-	i8254_normal_operation();
-}
-
-void i8254_normal_operation(void)
-{
-	pio_write_8(CLK_PORT4, 0x36);
-	i8259_disable_irqs(1 << IRQ_CLK);
-	pio_write_8(CLK_PORT1, (CLK_CONST / HZ) & 0xf);
-	pio_write_8(CLK_PORT1, (CLK_CONST / HZ) >> 8);
-	i8259_enable_irqs(1 << IRQ_CLK);
-}
-
-void i8254_calibrate_delay_loop(void)
-{
-	/*
-	 * One-shot timer. Count-down from 0xffff at 1193180Hz
-	 * MAGIC_NUMBER is the magic value for 1ms.
-	 */
-	pio_write_8(CLK_PORT4, 0x30);
-	pio_write_8(CLK_PORT1, 0xff);
-	pio_write_8(CLK_PORT1, 0xff);
-
-	uint8_t not_ok;
-	uint32_t t1;
-	uint32_t t2;
-
-	do {
-		/* will read both status and count */
-		pio_write_8(CLK_PORT4, 0xc2);
-		not_ok = (uint8_t) ((pio_read_8(CLK_PORT1) >> 6) & 1);
-		t1 = pio_read_8(CLK_PORT1);
-		t1 |= pio_read_8(CLK_PORT1) << 8;
-	} while (not_ok);
-
-	asm_delay_loop(LOOPS);
-
-	pio_write_8(CLK_PORT4, 0xd2);
-	t2 = pio_read_8(CLK_PORT1);
-	t2 |= pio_read_8(CLK_PORT1) << 8;
-
-	/*
-	 * We want to determine the overhead of the calibrating mechanism.
-	 */
-	pio_write_8(CLK_PORT4, 0xd2);
-	uint32_t o1 = pio_read_8(CLK_PORT1);
-	o1 |= pio_read_8(CLK_PORT1) << 8;
-
-	asm_fake_loop(LOOPS);
-
-	pio_write_8(CLK_PORT4, 0xd2);
-	uint32_t o2 = pio_read_8(CLK_PORT1);
-	o2 |= pio_read_8(CLK_PORT1) << 8;
-
-	uint32_t delta = (t1 - t2) - (o1 - o2);
-	if (!delta)
-		delta = 1;
-
-	CPU->delay_loop_const =
-	    ((MAGIC_NUMBER * LOOPS) / 1000) / delta +
-	    (((MAGIC_NUMBER * LOOPS) / 1000) % delta ? 1 : 0);
-
-	uint64_t clk1 = get_cycle();
-	delay(1 << SHIFT);
-	uint64_t clk2 = get_cycle();
-
-	CPU->frequency_mhz = (clk2 - clk1) >> SHIFT;
-
-	return;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/fpu_context.c
===================================================================
--- kernel/arch/ia32/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- *
- */
-
-#include <fpu_context.h>
-#include <arch.h>
-#include <cpu.h>
-
-/** x87 FPU scr values (P3+ MMX2) */
-enum {
-	X87_FLUSH_ZERO_FLAG = (1 << 15),
-	X87_ROUND_CONTROL_MASK = (0x3 << 13),
-	x87_ROUND_TO_NEAREST_EVEN = (0x0 << 13),
-	X87_ROUND_DOWN_TO_NEG_INF = (0x1 << 13),
-	X87_ROUND_UP_TO_POS_INF = (0x2 << 13),
-	X87_ROUND_TO_ZERO = (0x3 << 13),
-	X87_PRECISION_MASK = (1 << 12),
-	X87_UNDERFLOW_MASK = (1 << 11),
-	X87_OVERFLOW_MASK = (1 << 10),
-	X87_ZERO_DIV_MASK = (1 << 9),
-	X87_DENORMAL_OP_MASK = (1 << 8),
-	X87_INVALID_OP_MASK = (1 << 7),
-	X87_DENOM_ZERO_FLAG = (1 << 6),
-	X87_PRECISION_EXC_FLAG = (1 << 5),
-	X87_UNDERFLOW_EXC_FLAG = (1 << 4),
-	X87_OVERFLOW_EXC_FLAG = (1 << 3),
-	X87_ZERO_DIV_EXC_FLAG = (1 << 2),
-	X87_DENORMAL_EXC_FLAG = (1 << 1),
-	X87_INVALID_OP_EXC_FLAG = (1 << 0),
-
-	X87_ALL_MASK = X87_PRECISION_MASK | X87_UNDERFLOW_MASK | X87_OVERFLOW_MASK | X87_ZERO_DIV_MASK | X87_DENORMAL_OP_MASK | X87_INVALID_OP_MASK,
-};
-
-typedef void (*fpu_context_function)(fpu_context_t *fctx);
-
-static fpu_context_function fpu_save;
-static fpu_context_function fpu_restore;
-
-static void fpu_context_f_save(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "fnsave %[fctx]"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-static void fpu_context_f_restore(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "frstor %[fctx]"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-static void fpu_context_fx_save(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "fxsave %[fctx]"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-static void fpu_context_fx_restore(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "fxrstor %[fctx]"
-	    : [fctx] "=m" (fctx->fpu)
-	);
-}
-
-/* Setup using fxsr instruction */
-void fpu_fxsr(void)
-{
-	fpu_save = fpu_context_fx_save;
-	fpu_restore = fpu_context_fx_restore;
-}
-
-/* Setup using not fxsr instruction */
-void fpu_fsr(void)
-{
-	fpu_save = fpu_context_f_save;
-	fpu_restore = fpu_context_f_restore;
-}
-
-void fpu_context_save(fpu_context_t *fctx)
-{
-	fpu_save(fctx);
-}
-
-void fpu_context_restore(fpu_context_t *fctx)
-{
-	fpu_restore(fctx);
-}
-
-/** Initialize x87 FPU. Mask all exceptions. */
-void fpu_init(void)
-{
-	uint32_t help0 = 0;
-	uint32_t help1 = 0;
-
-	asm volatile (
-	    "fninit\n"
-	    "stmxcsr %[help0]\n"
-	    "mov %[help0], %[help1]\n"
-	    "or %[magic], %[help1]\n"
-	    "mov %[help1], %[help0]\n"
-	    "ldmxcsr %[help0]\n"
-	    : [help0] "+m" (help0), [help1] "+r" (help1)
-	    : [magic] "i" (X87_ALL_MASK)
-	);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/ia32.c
===================================================================
--- kernel/arch/ia32/src/ia32.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,279 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <stdint.h>
-#include <errno.h>
-#include <memw.h>
-#include <interrupt.h>
-#include <console/console.h>
-#include <syscall/syscall.h>
-#include <sysinfo/sysinfo.h>
-#include <arch/bios/bios.h>
-#include <arch/boot/boot.h>
-#include <arch/drivers/i8254.h>
-#include <genarch/acpi/acpi.h>
-#include <genarch/drivers/ega/ega.h>
-#include <genarch/drivers/i8042/i8042.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <genarch/drivers/ns16550/ns16550.h>
-#include <genarch/drivers/legacy/ia32/io.h>
-#include <genarch/fb/bfb.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/srln/srln.h>
-#include <genarch/multiboot/multiboot.h>
-#include <genarch/multiboot/multiboot2.h>
-#include <genarch/pic/pic_ops.h>
-#include <arch/pm.h>
-#include <arch/vreg.h>
-#include <arch/mm/pat.h>
-
-#ifdef CONFIG_SMP
-#include <arch/smp/apic.h>
-#endif
-
-static void ia32_pre_mm_init(void);
-static void ia32_post_mm_init(void);
-static void ia32_post_cpu_init(void);
-static void ia32_pre_smp_init(void);
-static void ia32_post_smp_init(void);
-
-arch_ops_t ia32_ops = {
-	.pre_mm_init = ia32_pre_mm_init,
-	.post_mm_init = ia32_post_mm_init,
-	.post_cpu_init = ia32_post_cpu_init,
-	.pre_smp_init = ia32_pre_smp_init,
-	.post_smp_init = ia32_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &ia32_ops;
-
-/** Perform ia32-specific initialization before main_bsp() is called.
- *
- * @param signature Multiboot signature.
- * @param info      Multiboot information structure.
- *
- */
-void ia32_pre_main(uint32_t signature, void *info)
-{
-	/* Parse multiboot information obtained from the bootloader. */
-	multiboot_info_parse(signature, (multiboot_info_t *) info);
-	multiboot2_info_parse(signature, (multiboot2_info_t *) info);
-
-#ifdef CONFIG_SMP
-	size_t unmapped_size = (uintptr_t) unmapped_end - BOOT_OFFSET;
-	/* Copy AP bootstrap routines below 1 MB. */
-	memcpy((void *) AP_BOOT_OFFSET, (void *) BOOT_OFFSET, unmapped_size);
-#endif
-}
-
-void ia32_pre_mm_init(void)
-{
-	pm_init();
-
-#ifndef PROCESSOR_i486
-	/* Use PCD+PWT bit combination in PTE to mean write-combining mode. */
-	if (pat_supported())
-		pat_set_mapping(false, true, true, PAT_TYPE_WRITE_COMBINING);
-#endif
-
-	if (config.cpu_active == 1) {
-		interrupt_init();
-		bios_init();
-
-		/* PIC */
-		i8259_init((i8259_t *) I8259_PIC0_BASE,
-		    (i8259_t *) I8259_PIC1_BASE, IVT_IRQBASE);
-
-		/* Set PIC operations. */
-		pic_ops = &i8259_pic_ops;
-	}
-}
-
-void ia32_post_mm_init(void)
-{
-	vreg_init();
-
-	if (config.cpu_active == 1) {
-		/* Initialize IRQ routing */
-		irq_init(IRQ_COUNT, IRQ_COUNT);
-
-		/* hard clock */
-		i8254_init();
-
-#if (defined(CONFIG_FB) || defined(CONFIG_EGA))
-		bool bfb = false;
-#endif
-
-#ifdef CONFIG_FB
-		bfb = bfb_init();
-#endif
-
-#ifdef CONFIG_EGA
-		if (!bfb) {
-			outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
-			if (egadev)
-				stdout_wire(egadev);
-		}
-#endif
-
-		/* Merge all memory zones to 1 big zone */
-		zone_merge_all();
-	}
-}
-
-void ia32_post_cpu_init(void)
-{
-#ifdef CONFIG_SMP
-	if (config.cpu_active > 1) {
-		l_apic_init();
-		l_apic_debug();
-	}
-#endif
-}
-
-void ia32_pre_smp_init(void)
-{
-	if (config.cpu_active == 1) {
-#ifdef CONFIG_SMP
-		acpi_init();
-#endif /* CONFIG_SMP */
-	}
-}
-
-void ia32_post_smp_init(void)
-{
-	/* Currently the only supported platform for ia32 is 'pc'. */
-	static const char *platform = "pc";
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-#ifdef CONFIG_PC_KBD
-	/*
-	 * Initialize the i8042 controller. Then initialize the keyboard
-	 * module and connect it to i8042. Enable keyboard interrupts.
-	 */
-	i8042_instance_t *i8042_instance = i8042_init((i8042_t *) I8042_BASE, IRQ_KBD);
-	if (i8042_instance) {
-		kbrd_instance_t *kbrd_instance = kbrd_init();
-		if (kbrd_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-			i8042_wire(i8042_instance, kbrd);
-			pic_ops->enable_irqs(1 << IRQ_KBD);
-			pic_ops->enable_irqs(1 << IRQ_MOUSE);
-		}
-	}
-#endif
-
-#if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT))
-	/*
-	 * Initialize the ns16550 controller.
-	 */
-#ifdef CONFIG_NS16550_OUT
-	outdev_t *ns16550_out;
-	outdev_t **ns16550_out_ptr = &ns16550_out;
-#else
-	outdev_t **ns16550_out_ptr = NULL;
-#endif
-	ns16550_instance_t *ns16550_instance =
-	    ns16550_init(NS16550_BASE, 0, IRQ_NS16550, NULL, NULL,
-	    ns16550_out_ptr);
-	if (ns16550_instance) {
-		ns16550_format_set(ns16550_instance, 38400,
-		    LCR_PARITY_NONE | LCR_STOP_BIT_TWO | LCR_WORD_LEN_8);
-#ifdef CONFIG_NS16550
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			ns16550_wire(ns16550_instance, srln);
-			pic_ops->enable_irqs(1 << IRQ_NS16550);
-		}
-#endif
-#ifdef CONFIG_NS16550_OUT
-		if (ns16550_out) {
-			stdout_wire(ns16550_out);
-		}
-#endif
-	}
-#endif
-
-	sysinfo_set_item_val(pic_ops->get_name(), NULL, true);
-}
-
-void calibrate_delay_loop(void)
-{
-	i8254_calibrate_delay_loop();
-	if (config.cpu_active == 1) {
-		/*
-		 * This has to be done only on UP.
-		 * On SMP, i8254 is not used for time keeping and its interrupt pin remains masked.
-		 */
-		i8254_normal_operation();
-	}
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void arch_reboot(void)
-{
-#ifdef CONFIG_PC_KBD
-	i8042_cpu_reset((i8042_t *) I8042_BASE);
-#endif
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/interrupt.h>
-#include <assert.h>
-#include <syscall/syscall.h>
-#include <stdio.h>
-#include <debug.h>
-#include <panic.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <genarch/pic/pic_ops.h>
-#include <halt.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <arch.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <synch/spinlock.h>
-#include <arch/ddi/ddi.h>
-#include <ipc/sysipc.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <symtab.h>
-#include <stacktrace.h>
-#include <proc/task.h>
-
-/*
- * Interrupt and exception dispatching.
- */
-
-pic_ops_t *pic_ops = NULL;
-
-void istate_decode(istate_t *istate)
-{
-	printf("cs =%0#10" PRIx32 "\teip=%0#10" PRIx32 "\t"
-	    "efl=%0#10" PRIx32 "\terr=%0#10" PRIx32 "\n",
-	    istate->cs, istate->eip, istate->eflags, istate->error_word);
-
-	printf("ds =%0#10" PRIx32 "\tes =%0#10" PRIx32 "\t"
-	    "fs =%0#10" PRIx32 "\tgs =%0#10" PRIx32 "\n",
-	    istate->ds, istate->es, istate->fs, istate->gs);
-
-	if (istate_from_uspace(istate))
-		printf("ss =%0#10" PRIx32 "\n", istate->ss);
-
-	printf("eax=%0#10" PRIx32 "\tebx=%0#10" PRIx32 "\t"
-	    "ecx=%0#10" PRIx32 "\tedx=%0#10" PRIx32 "\n",
-	    istate->eax, istate->ebx, istate->ecx, istate->edx);
-
-	printf("esi=%0#10" PRIx32 "\tedi=%0#10" PRIx32 "\t"
-	    "ebp=%0#10" PRIx32 "\tesp=%0#10" PRIx32 "\n",
-	    istate->esi, istate->edi, istate->ebp,
-	    istate_from_uspace(istate) ? istate->esp :
-	    (uint32_t) &istate->esp);
-}
-
-static void null_interrupt(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Unserviced interrupt: %u.", n);
-	panic_badtrap(istate, n, "Unserviced interrupt: %u.", n);
-}
-
-static void de_fault(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Divide error.");
-	panic_badtrap(istate, n, "Divide error.");
-}
-
-static void db_exception(unsigned int n, istate_t *istate)
-{
-	/*
-	 * We need to provide at least an empty handler that does not panic
-	 * if the exception appears to come from the kernel because the
-	 * userspace can inject a kernel-level #DB after e.g. the SYSENTER
-	 * instruction if the EFLAGS.TF is set.
-	 */
-}
-
-/** General Protection Fault. */
-static void gp_fault(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-	if (TASK) {
-		irq_spinlock_lock(&TASK->lock, false);
-		size_t ver = TASK->arch.iomapver;
-		irq_spinlock_unlock(&TASK->lock, false);
-
-		if (CPU->arch.iomapver_copy != ver) {
-			/*
-			 * This fault can be caused by an early access
-			 * to I/O port because of an out-dated
-			 * I/O Permission bitmap installed on CPU.
-			 * Install the fresh copy and restart
-			 * the instruction.
-			 */
-			io_perm_bitmap_install();
-			return;
-		}
-		fault_if_from_uspace(istate, "General protection fault.");
-	}
-	panic_badtrap(istate, n, "General protection fault.");
-}
-
-static void ss_fault(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Stack fault.");
-	panic_badtrap(istate, n, "Stack fault.");
-}
-
-static void simd_fp_exception(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-	uint32_t mxcsr;
-	asm volatile (
-	    "stmxcsr %[mxcsr]\n"
-	    : [mxcsr] "=m" (mxcsr)
-	);
-
-	fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR=%#0" PRIx32 ".",
-	    mxcsr);
-	panic_badtrap(istate, n, "SIMD FP exception");
-}
-
-static void nm_fault(unsigned int n __attribute__((unused)),
-    istate_t *istate __attribute__((unused)))
-{
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-#else
-	fault_if_from_uspace(istate, "FPU fault.");
-	panic_badtrap(istate, n, "FPU fault.");
-#endif
-}
-
-#ifdef CONFIG_SMP
-static void tlb_shootdown_ipi(unsigned int n __attribute__((unused)),
-    istate_t *istate __attribute__((unused)))
-{
-	pic_ops->eoi(0);
-	tlb_shootdown_ipi_recv();
-}
-#endif
-
-/** Handler of IRQ exceptions */
-static void irq_interrupt(unsigned int n, istate_t *istate __attribute__((unused)))
-{
-	assert(n >= IVT_IRQBASE);
-
-	unsigned int inum = n - IVT_IRQBASE;
-	bool ack = false;
-	assert(inum < IRQ_COUNT);
-	assert(inum != IRQ_PIC1);
-
-	irq_t *irq = irq_dispatch_and_lock(inum);
-	if (irq) {
-		/*
-		 * The IRQ handler was found.
-		 */
-
-		if (irq->preack) {
-			/* Send EOI before processing the interrupt */
-			pic_ops->eoi(inum);
-			ack = true;
-		}
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ %u", CPU->id,
-		    inum);
-#endif
-	}
-
-	if (!ack)
-		pic_ops->eoi(inum);
-}
-
-static void pic_spurious(unsigned int n, istate_t *istate)
-{
-	unsigned int inum = n - IVT_IRQBASE;
-	if (!pic_ops->is_spurious(inum)) {
-		/* This is actually not a spurious IRQ, so proceed as usual. */
-		irq_interrupt(n, istate);
-		return;
-	}
-	pic_ops->handle_spurious(n);
-#ifdef CONFIG_DEBUG
-	log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u", CPU->id,
-	    inum);
-#endif
-}
-
-void interrupt_init(void)
-{
-	unsigned int i;
-
-	for (i = 0; i < IVT_ITEMS; i++)
-		exc_register(i, "null", false, (iroutine_t) null_interrupt);
-
-	for (i = 0; i < IRQ_COUNT; i++) {
-		if ((i != IRQ_PIC0_SPUR) && (i != IRQ_PIC1_SPUR) &&
-		    (i != IRQ_PIC1))
-			exc_register(IVT_IRQBASE + i, "irq", true,
-			    (iroutine_t) irq_interrupt);
-	}
-
-	exc_register(VECTOR_DE, "de_fault", true, (iroutine_t) de_fault);
-	exc_register(VECTOR_DB, "db_exc", true, (iroutine_t) db_exception);
-	exc_register(VECTOR_NM, "nm_fault", true, (iroutine_t) nm_fault);
-	exc_register(VECTOR_SS, "ss_fault", true, (iroutine_t) ss_fault);
-	exc_register(VECTOR_GP, "gp_fault", true, (iroutine_t) gp_fault);
-	exc_register(VECTOR_XM, "simd_fp", true, (iroutine_t) simd_fp_exception);
-	exc_register(VECTOR_PIC0_SPUR, "pic0_spurious", true,
-	    (iroutine_t) pic_spurious);
-	exc_register(VECTOR_PIC1_SPUR, "pic1_spurious", true,
-	    (iroutine_t) pic_spurious);
-
-#ifdef CONFIG_SMP
-	exc_register(VECTOR_TLB_SHOOTDOWN_IPI, "tlb_shootdown", true,
-	    (iroutine_t) tlb_shootdown_ipi);
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/mm/as.c
===================================================================
--- kernel/arch/ia32/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- * @ingroup kernel_ia32_mm, kernel_amd64_mm
- */
-
-#include <arch/mm/as.h>
-#include <genarch/mm/page_pt.h>
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/mm/frame.c
===================================================================
--- kernel/arch/ia32/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- * @ingroup kernel_ia32_mm, kernel_amd64_mm
- */
-
-#include <mm/frame.h>
-#include <arch/mm/frame.h>
-#include <mm/as.h>
-#include <config.h>
-#include <arch/boot/boot.h>
-#include <arch/boot/memmap.h>
-#include <panic.h>
-#include <debug.h>
-#include <align.h>
-#include <macros.h>
-#include <stdio.h>
-
-#define PHYSMEM_LIMIT32  UINT64_C(0x100000000)
-
-static void init_e820_memory(pfn_t minconf, bool low)
-{
-	unsigned int i;
-
-	for (i = 0; i < e820counter; i++) {
-		uint64_t base64 = e820table[i].base_address;
-		uint64_t size64 = e820table[i].size;
-
-#ifdef KARCH_ia32
-		/*
-		 * Restrict the e820 table entries to 32-bits.
-		 */
-		if (base64 >= PHYSMEM_LIMIT32)
-			continue;
-
-		if (base64 + size64 > PHYSMEM_LIMIT32)
-			size64 = PHYSMEM_LIMIT32 - base64;
-#endif
-
-		uintptr_t base = (uintptr_t) base64;
-		size_t size = (size_t) size64;
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			continue;
-
-		if (e820table[i].type == MEMMAP_MEMORY_AVAILABLE) {
-			/* To be safe, make the available zone possibly smaller */
-			uint64_t new_base = ALIGN_UP(base, FRAME_SIZE);
-			uint64_t new_size = ALIGN_DOWN(size - (new_base - base),
-			    FRAME_SIZE);
-
-			size_t count = SIZE2FRAMES(new_size);
-			pfn_t pfn = ADDR2PFN(new_base);
-			pfn_t conf;
-
-			if (low) {
-				if ((minconf < pfn) || (minconf >= pfn + count))
-					conf = pfn;
-				else
-					conf = minconf;
-				zone_create(pfn, count, conf,
-				    ZONE_AVAILABLE | ZONE_LOWMEM);
-			} else {
-				conf = zone_external_conf_alloc(count);
-				if (conf != 0)
-					zone_create(pfn, count, conf,
-					    ZONE_AVAILABLE | ZONE_HIGHMEM);
-			}
-		} else if ((e820table[i].type == MEMMAP_MEMORY_ACPI) ||
-		    (e820table[i].type == MEMMAP_MEMORY_NVS)) {
-			/* To be safe, make the firmware zone possibly larger */
-			uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE);
-			uint64_t new_size = ALIGN_UP(size + (base - new_base),
-			    FRAME_SIZE);
-
-			zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0,
-			    ZONE_FIRMWARE);
-		} else {
-			/* To be safe, make the reserved zone possibly larger */
-			uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE);
-			uint64_t new_size = ALIGN_UP(size + (base - new_base),
-			    FRAME_SIZE);
-
-			zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0,
-			    ZONE_RESERVED);
-		}
-	}
-}
-
-static const char *e820names[] = {
-	"invalid",
-	"available",
-	"reserved",
-	"acpi",
-	"nvs",
-	"unusable"
-};
-
-void physmem_print(void)
-{
-	unsigned int i;
-	printf("[base            ] [size            ] [name   ]\n");
-
-	for (i = 0; i < e820counter; i++) {
-		const char *name;
-
-		if (e820table[i].type <= MEMMAP_MEMORY_UNUSABLE)
-			name = e820names[e820table[i].type];
-		else
-			name = "invalid";
-
-		printf("%#018" PRIx64 " %#018" PRIx64 " %s\n", e820table[i].base_address,
-		    e820table[i].size, name);
-	}
-}
-
-void frame_low_arch_init(void)
-{
-	pfn_t minconf;
-
-	if (config.cpu_active == 1) {
-		minconf = 1;
-
-#ifdef CONFIG_SMP
-		size_t unmapped_size =
-		    (uintptr_t) unmapped_end - BOOT_OFFSET;
-
-		minconf = max(minconf,
-		    ADDR2PFN(AP_BOOT_OFFSET + unmapped_size));
-#endif
-
-		init_e820_memory(minconf, true);
-
-		/* Reserve frame 0 (BIOS data) */
-		frame_mark_unavailable(0, 1);
-
-#ifdef CONFIG_SMP
-		/* Reserve AP real mode bootstrap memory */
-		frame_mark_unavailable(AP_BOOT_OFFSET >> FRAME_WIDTH,
-		    unmapped_size >> FRAME_WIDTH);
-#endif
-	}
-}
-
-void frame_high_arch_init(void)
-{
-	if (config.cpu_active == 1)
-		init_e820_memory(0, false);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/mm/km.c
===================================================================
--- kernel/arch/ia32/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_IA32_IDENTITY_START;
-	config.identity_size = KM_IA32_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_IA32_NON_IDENTITY_START,
-	    KM_IA32_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_IA32_NON_IDENTITY_START, KM_IA32_NON_IDENTITY_SIZE,
-	    addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/mm/page.c
===================================================================
--- kernel/arch/ia32/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <typedefs.h>
-#include <align.h>
-#include <config.h>
-#include <halt.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-#include <debug.h>
-#include <interrupt.h>
-#include <macros.h>
-
-void page_arch_init(void)
-{
-	uintptr_t cur;
-	int flags;
-
-	if (config.cpu_active > 1) {
-		/* Fast path for non-boot CPUs */
-		write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
-		paging_on();
-		return;
-	}
-
-	page_mapping_operations = &pt_mapping_operations;
-
-	/*
-	 * PA2KA(identity) mapping for all low-memory frames.
-	 */
-	page_table_lock(AS_KERNEL, true);
-	for (cur = 0; cur < min(config.identity_size, config.physmem_end);
-	    cur += FRAME_SIZE) {
-		flags = PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_WRITE | PAGE_READ;
-		page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
-	}
-	page_table_unlock(AS_KERNEL, true);
-
-	exc_register(VECTOR_PF, "page_fault", true, (iroutine_t) page_fault);
-	write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
-
-	paging_on();
-}
-
-void page_fault(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-	uintptr_t badvaddr;
-	pf_access_t access;
-
-	badvaddr = read_cr2();
-
-	if (istate->error_word & PFERR_CODE_RSVD)
-		panic("Reserved bit set in page directory.");
-
-	if (istate->error_word & PFERR_CODE_RW)
-		access = PF_ACCESS_WRITE;
-	else
-		access = PF_ACCESS_READ;
-
-	(void) as_page_fault(badvaddr, access, istate);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/mm/tlb.c
===================================================================
--- kernel/arch/ia32/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_mm
- * @{
- */
-/** @file
- * @ingroup kernel_ia32_mm, kernel_amd64_mm
- */
-
-#include <mm/tlb.h>
-#include <arch/mm/asid.h>
-#include <arch/asm.h>
-#include <typedefs.h>
-
-/** Invalidate all entries in TLB. */
-void tlb_invalidate_all(void)
-{
-	write_cr3(read_cr3());
-}
-
-/** Invalidate all entries in TLB that belong to specified address space.
- *
- * @param asid This parameter is ignored as the architecture doesn't support it.
- */
-void tlb_invalidate_asid(asid_t asid __attribute__((unused)))
-{
-	tlb_invalidate_all();
-}
-
-/** Invalidate TLB entries for specified page range belonging to specified address space.
- *
- * @param asid This parameter is ignored as the architecture doesn't support it.
- * @param page Address of the first page whose entry is to be invalidated.
- * @param cnt Number of entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt)
-{
-	unsigned int i;
-
-	for (i = 0; i < cnt; i++)
-		invlpg(page + i * PAGE_SIZE);
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/pm.c
===================================================================
--- kernel/arch/ia32/src/pm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch/pm.h>
-#include <config.h>
-#include <typedefs.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-#include <arch/context.h>
-#include <panic.h>
-#include <arch/mm/page.h>
-#include <mm/km.h>
-#include <mm/frame.h>
-#include <stdlib.h>
-#include <memw.h>
-#include <arch/boot/boot.h>
-#include <interrupt.h>
-#include <arch/cpu.h>
-
-/*
- * Early ia32 configuration functions and data structures.
- */
-
-/*
- * We don't have much use for segmentation so we set up flat mode.
- * In this mode, we use, for each privilege level, two segments spanning the
- * whole memory. One is for code and one is for data.
- *
- * One special segment apart of that is for the GS register which holds
- * a pointer to the VREG page in its base.
- */
-descriptor_t gdt[GDT_ITEMS] = {
-	[NULL_DES] = {
-		0
-	},
-	[KTEXT_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.access = AR_PRESENT | AR_CODE | DPL_KERNEL,
-		.special = 1,
-		.granularity = 1
-	},
-	[KDATA_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL,
-		.special = 1,
-		.granularity = 1
-	},
-	[UTEXT_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.access = AR_PRESENT | AR_CODE | DPL_USER,
-		.special = 1,
-		.granularity = 1
-	},
-	[UDATA_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER,
-		.special = 1,
-		.granularity = 1
-	},
-	[TSS_DES] = {		/* set up will be completed later */
-		0,
-	},
-	[VREG_DES] = {		/* will be reinitialized later */
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER,
-		.special = 1,
-		.granularity = 1
-	},
-	/* VESA Init descriptor */
-#ifdef CONFIG_FB
-	[VESA_INIT_CODE_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.base_16_23 = VESA_INIT_SEGMENT >> 12,
-		.access = AR_PRESENT | AR_CODE | AR_READABLE | DPL_KERNEL
-	},
-	[VESA_INIT_DATA_DES] = {
-		.limit_0_15 = 0xffff,
-		.limit_16_19 = 0xf,
-		.base_16_23 = VESA_INIT_SEGMENT >> 12,
-		.access = AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_KERNEL
-	}
-#endif
-};
-
-static idescriptor_t idt[IDT_ITEMS];
-
-static tss_t tss0;
-
-tss_t *tss_p = NULL;
-
-/* gdtr is changed by kmp before next CPU is initialized */
-ptr_16_32_t gdtr = {
-	.limit = sizeof(gdt),
-	.base = (uintptr_t) gdt
-};
-
-void gdt_setbase(descriptor_t *d, uintptr_t base)
-{
-	d->base_0_15 = base & 0xffff;
-	d->base_16_23 = (base >> 16) & 0xff;
-	d->base_24_31 = (base >> 24) & 0xff;
-}
-
-void gdt_setlimit(descriptor_t *d, uint32_t limit)
-{
-	d->limit_0_15 = limit & 0xffff;
-	d->limit_16_19 = (limit >> 16) & 0xf;
-}
-
-void idt_setoffset(idescriptor_t *d, uintptr_t offset)
-{
-	/*
-	 * Offset is a linear address.
-	 */
-	d->offset_0_15 = offset & 0xffff;
-	d->offset_16_31 = offset >> 16;
-}
-
-void tss_initialize(tss_t *t)
-{
-	memsetb(t, sizeof(tss_t), 0);
-}
-
-/*
- * This function takes care of proper setup of IDT and IDTR.
- */
-void idt_init(void)
-{
-	idescriptor_t *d;
-	unsigned int i;
-
-	for (i = 0; i < IDT_ITEMS; i++) {
-		d = &idt[i];
-
-		d->unused = 0;
-		d->selector = GDT_SELECTOR(KTEXT_DES);
-
-		if (i == VECTOR_SYSCALL) {
-			/*
-			 * The syscall trap gate must be callable from
-			 * userland. Interrupts will remain enabled.
-			 */
-			d->access = AR_PRESENT | AR_TRAP | DPL_USER;
-		} else {
-			/*
-			 * Other interrupts use interrupt gates which
-			 * disable interrupts.
-			 */
-			d->access = AR_PRESENT | AR_INTERRUPT;
-		}
-	}
-
-	d = &idt[0];
-	idt_setoffset(d++, (uintptr_t) &int_0);
-	idt_setoffset(d++, (uintptr_t) &int_1);
-	idt_setoffset(d++, (uintptr_t) &int_2);
-	idt_setoffset(d++, (uintptr_t) &int_3);
-	idt_setoffset(d++, (uintptr_t) &int_4);
-	idt_setoffset(d++, (uintptr_t) &int_5);
-	idt_setoffset(d++, (uintptr_t) &int_6);
-	idt_setoffset(d++, (uintptr_t) &int_7);
-	idt_setoffset(d++, (uintptr_t) &int_8);
-	idt_setoffset(d++, (uintptr_t) &int_9);
-	idt_setoffset(d++, (uintptr_t) &int_10);
-	idt_setoffset(d++, (uintptr_t) &int_11);
-	idt_setoffset(d++, (uintptr_t) &int_12);
-	idt_setoffset(d++, (uintptr_t) &int_13);
-	idt_setoffset(d++, (uintptr_t) &int_14);
-	idt_setoffset(d++, (uintptr_t) &int_15);
-	idt_setoffset(d++, (uintptr_t) &int_16);
-	idt_setoffset(d++, (uintptr_t) &int_17);
-	idt_setoffset(d++, (uintptr_t) &int_18);
-	idt_setoffset(d++, (uintptr_t) &int_19);
-	idt_setoffset(d++, (uintptr_t) &int_20);
-	idt_setoffset(d++, (uintptr_t) &int_21);
-	idt_setoffset(d++, (uintptr_t) &int_22);
-	idt_setoffset(d++, (uintptr_t) &int_23);
-	idt_setoffset(d++, (uintptr_t) &int_24);
-	idt_setoffset(d++, (uintptr_t) &int_25);
-	idt_setoffset(d++, (uintptr_t) &int_26);
-	idt_setoffset(d++, (uintptr_t) &int_27);
-	idt_setoffset(d++, (uintptr_t) &int_28);
-	idt_setoffset(d++, (uintptr_t) &int_29);
-	idt_setoffset(d++, (uintptr_t) &int_30);
-	idt_setoffset(d++, (uintptr_t) &int_31);
-	idt_setoffset(d++, (uintptr_t) &int_32);
-	idt_setoffset(d++, (uintptr_t) &int_33);
-	idt_setoffset(d++, (uintptr_t) &int_34);
-	idt_setoffset(d++, (uintptr_t) &int_35);
-	idt_setoffset(d++, (uintptr_t) &int_36);
-	idt_setoffset(d++, (uintptr_t) &int_37);
-	idt_setoffset(d++, (uintptr_t) &int_38);
-	idt_setoffset(d++, (uintptr_t) &int_39);
-	idt_setoffset(d++, (uintptr_t) &int_40);
-	idt_setoffset(d++, (uintptr_t) &int_41);
-	idt_setoffset(d++, (uintptr_t) &int_42);
-	idt_setoffset(d++, (uintptr_t) &int_43);
-	idt_setoffset(d++, (uintptr_t) &int_44);
-	idt_setoffset(d++, (uintptr_t) &int_45);
-	idt_setoffset(d++, (uintptr_t) &int_46);
-	idt_setoffset(d++, (uintptr_t) &int_47);
-	idt_setoffset(d++, (uintptr_t) &int_48);
-	idt_setoffset(d++, (uintptr_t) &int_49);
-	idt_setoffset(d++, (uintptr_t) &int_50);
-	idt_setoffset(d++, (uintptr_t) &int_51);
-	idt_setoffset(d++, (uintptr_t) &int_52);
-	idt_setoffset(d++, (uintptr_t) &int_53);
-	idt_setoffset(d++, (uintptr_t) &int_54);
-	idt_setoffset(d++, (uintptr_t) &int_55);
-	idt_setoffset(d++, (uintptr_t) &int_56);
-	idt_setoffset(d++, (uintptr_t) &int_57);
-	idt_setoffset(d++, (uintptr_t) &int_58);
-	idt_setoffset(d++, (uintptr_t) &int_59);
-	idt_setoffset(d++, (uintptr_t) &int_60);
-	idt_setoffset(d++, (uintptr_t) &int_61);
-	idt_setoffset(d++, (uintptr_t) &int_62);
-	idt_setoffset(d++, (uintptr_t) &int_63);
-
-	idt_setoffset(&idt[VECTOR_SYSCALL], (uintptr_t) &int_syscall);
-}
-
-void pm_init(void)
-{
-	descriptor_t *gdt_p = (descriptor_t *) gdtr.base;
-	ptr_16_32_t idtr;
-
-	/*
-	 * Update addresses in GDT and IDT to their virtual counterparts.
-	 */
-	idtr.limit = sizeof(idt);
-	idtr.base = (uintptr_t) idt;
-	gdtr_load(&gdtr);
-	idtr_load(&idtr);
-
-	/*
-	 * Each CPU has its private GDT and TSS.
-	 * All CPUs share one IDT.
-	 */
-
-	if (config.cpu_active == 1) {
-		idt_init();
-		/*
-		 * NOTE: bootstrap CPU has statically allocated TSS, because
-		 * the heap hasn't been initialized so far.
-		 */
-		tss_p = &tss0;
-	} else {
-		tss_p = (tss_t *) malloc(sizeof(tss_t));
-		if (!tss_p)
-			panic("Cannot allocate TSS.");
-	}
-
-	tss_initialize(tss_p);
-
-	gdt_p[TSS_DES].access = AR_PRESENT | AR_TSS | DPL_KERNEL;
-	gdt_p[TSS_DES].special = 1;
-	gdt_p[TSS_DES].granularity = 0;
-
-	gdt_setbase(&gdt_p[TSS_DES], (uintptr_t) tss_p);
-	gdt_setlimit(&gdt_p[TSS_DES], TSS_BASIC_SIZE - 1);
-
-	/*
-	 * As of this moment, the current CPU has its own GDT pointing
-	 * to its own TSS. We just need to load the TR register.
-	 */
-	tr_load(GDT_SELECTOR(TSS_DES));
-
-	/* Disable I/O on nonprivileged levels and clear NT flag. */
-	write_eflags(read_eflags() & ~(EFLAGS_IOPL | EFLAGS_NT));
-
-	/* Disable alignment check */
-	write_cr0(read_cr0() & ~CR0_AM);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/proc/scheduler.c
===================================================================
--- kernel/arch/ia32/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-#include <cpu.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <arch/interrupt.h>
-#include <arch/pm.h>
-#include <arch/asm.h>
-#include <arch/ddi/ddi.h>
-
-/** Perform ia32 specific tasks needed before the new task is run.
- *
- * Interrupts are disabled.
- */
-void before_task_runs_arch(void)
-{
-	io_perm_bitmap_install();
-}
-
-/** Perform ia32 specific tasks needed before the new thread is scheduled.
- *
- * THREAD is locked and interrupts are disabled.
- */
-void before_thread_runs_arch(void)
-{
-	uintptr_t kstk = (uintptr_t) &THREAD->kstack[STACK_SIZE];
-
-#ifndef PROCESSOR_i486
-	if (CPU->arch.fi.bits.sep) {
-		/* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */
-		write_msr(IA32_MSR_SYSENTER_ESP, kstk - sizeof(istate_t));
-	}
-#endif
-
-	/* Set kernel stack for CPL3 -> CPL0 switch via interrupt */
-	CPU->arch.tss->esp0 = kstk;
-	CPU->arch.tss->ss0 = GDT_SELECTOR(KDATA_DES);
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/proc/task.c
===================================================================
--- kernel/arch/ia32/src/proc/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/task.h>
-#include <stddef.h>
-#include <adt/bitmap.h>
-#include <stdlib.h>
-
-/** Perform ia32 specific task initialization.
- *
- * @param task Task to be initialized.
- *
- */
-void task_create_arch(task_t *task)
-{
-	task->arch.iomapver = 0;
-	bitmap_initialize(&task->arch.iomap, 0, NULL);
-}
-
-/** Perform ia32 specific task destruction.
- *
- * @param task Task to be initialized.
- *
- */
-void task_destroy_arch(task_t *task)
-{
-	if (task->arch.iomap.bits != NULL)
-		free(task->arch.iomap.bits);
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/proc/thread.c
===================================================================
--- kernel/arch/ia32/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/thread.h>
-
-/** Perform ia32 specific thread initialization.
- *
- * @param t Thread to be initialized.
- */
-errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
-{
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/smc.c
===================================================================
--- kernel/arch/ia32/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-void smc_coherence(void *a, size_t l)
-{
-	compiler_barrier();
-}
Index: rnel/arch/ia32/src/smp/ap.S
===================================================================
--- kernel/arch/ia32/src/smp/ap.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# Copyright (c) 2005-2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-/*
- * Init code for application processors.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/boot/memmap.h>
-#include <arch/mm/page.h>
-#include <arch/pm.h>
-#include <arch/cpu.h>
-#include <arch/context_struct.h>
-
-.section K_TEXT_START, "ax"
-
-#ifdef CONFIG_SMP
-
-KTEXT=8
-KDATA=16
-
-/*
- * This piece of code is real-mode and is meant to be aligned at 4K boundary.
- * The requirement for such an alignment comes from MP Specification's
- * STARTUP IPI requirements.
- */
-
-.align 4096
-SYMBOL(unmapped_ap_boot)
-.code16
-	cli
-	xorw %ax, %ax
-	movw %ax, %ds
-
-	/* initialize Global Descriptor Table register */
-	lgdtl ap_gdtr
-
-	/* switch to protected mode */
-	movl %cr0, %eax
-	orl $CR0_PE, %eax
-	movl %eax, %cr0
-	jmpl $KTEXT, $jump_to_kernel - BOOT_OFFSET + AP_BOOT_OFFSET
-
-jump_to_kernel:
-.code32
-	movw $KDATA, %ax
-	movw %ax, %ds
-	movw %ax, %es
-	movw %ax, %ss
-	movl $KA2PA(bootstrap_stack_top), %eax   /* KA2PA((uintptr_t) &bootstrap_stack_top) */
-	movl (%eax), %esp
-	leal KA2PA(0)(%esp), %esp       /* KA2PA(ctx.sp) */
-
-	/*
-	 * Map kernel and turn paging on.
-	 * We assume that when using SMP, PSE is always available
-	 */
-	call map_kernel_pse
-
-	addl $PA2KA(0), %esp            /* PA2KA(ctx.sp) */
-
-	/* create the first stack frame */
-	pushl $0
-	movl %esp, %ebp
-
-	jmpl $KTEXT, $main_ap
-
-#endif /* CONFIG_SMP */
-
-
-.section K_DATA_START, "aw", @progbits
-
-#ifdef CONFIG_SMP
-
-SYMBOL(unmapped_ap_gdtr)
-	.word 0
-	.long 0
-
-#endif /* CONFIG_SMP */
Index: rnel/arch/ia32/src/smp/apic.c
===================================================================
--- kernel/arch/ia32/src/smp/apic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,695 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <typedefs.h>
-#include <arch/smp/apic.h>
-#include <arch/smp/ap.h>
-#include <arch/smp/mps.h>
-#include <arch/boot/boot.h>
-#include <assert.h>
-#include <mm/page.h>
-#include <time/delay.h>
-#include <interrupt.h>
-#include <arch/interrupt.h>
-#include <log.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <ddi/irq.h>
-#include <genarch/pic/pic_ops.h>
-
-#ifdef CONFIG_SMP
-
-/*
- * Advanced Programmable Interrupt Controller for SMP systems.
- * Tested on:
- *    Bochs 2.0.2 - Bochs 2.2.6 with 2-8 CPUs
- *    Simics 2.0.28 - Simics 2.2.19 2-15 CPUs
- *    VMware Workstation 5.5 with 2 CPUs
- *    QEMU 0.8.0 with 2-15 CPUs
- *    ASUS P/I-P65UP5 + ASUS C-P55T2D REV. 1.41 with 2x 200Mhz Pentium CPUs
- *    ASUS PCH-DL with 2x 3000Mhz Pentium 4 Xeon (HT) CPUs
- *    MSI K7D Master-L with 2x 2100MHz Athlon MP CPUs
- *
- */
-
-static const char *apic_get_name(void);
-static bool l_apic_is_spurious(unsigned int);
-static void l_apic_handle_spurious(unsigned int);
-
-pic_ops_t apic_pic_ops = {
-	.get_name = apic_get_name,
-	.enable_irqs = io_apic_enable_irqs,
-	.disable_irqs = io_apic_disable_irqs,
-	.eoi = l_apic_eoi,
-	.is_spurious = l_apic_is_spurious,
-	.handle_spurious = l_apic_handle_spurious,
-};
-
-/*
- * These variables either stay configured as initilalized, or are changed by
- * the MP configuration code.
- *
- * Pay special attention to the volatile keyword. Without it, gcc -O2 would
- * optimize the code too much and accesses to l_apic and io_apic, that must
- * always be 32-bit, would use byte oriented instructions.
- *
- */
-volatile uint32_t *l_apic = (uint32_t *) L_APIC_BASE;
-volatile uint32_t *io_apic = (uint32_t *) IO_APIC_BASE;
-
-uint32_t apic_id_mask = 0;
-uint8_t bsp_l_apic = 0;
-
-static irq_t l_apic_timer_irq;
-
-static int apic_poll_errors(void);
-
-#ifdef LAPIC_VERBOSE
-static const char *delmod_str[] = {
-	"Fixed",
-	"Lowest Priority",
-	"SMI",
-	"Reserved",
-	"NMI",
-	"INIT",
-	"STARTUP",
-	"ExtInt"
-};
-
-static const char *destmod_str[] = {
-	"Physical",
-	"Logical"
-};
-
-static const char *trigmod_str[] = {
-	"Edge",
-	"Level"
-};
-
-static const char *mask_str[] = {
-	"Unmasked",
-	"Masked"
-};
-
-static const char *delivs_str[] = {
-	"Idle",
-	"Send Pending"
-};
-
-static const char *tm_mode_str[] = {
-	"One-shot",
-	"Periodic"
-};
-
-static const char *intpol_str[] = {
-	"Polarity High",
-	"Polarity Low"
-};
-#endif /* LAPIC_VERBOSE */
-
-const char *apic_get_name(void)
-{
-	return "apic";
-}
-
-bool l_apic_is_spurious(unsigned int n)
-{
-	return n == VECTOR_APIC_SPUR;
-}
-
-void l_apic_handle_spurious(unsigned int n)
-{
-}
-
-/** APIC spurious interrupt handler.
- *
- * @param n      Interrupt vector.
- * @param istate Interrupted state.
- *
- */
-static void apic_spurious(unsigned int n __attribute__((unused)),
-    istate_t *istate __attribute__((unused)))
-{
-}
-
-static irq_ownership_t l_apic_timer_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void l_apic_timer_irq_handler(irq_t *irq)
-{
-	/*
-	 * Holding a spinlock could prevent clock() from preempting
-	 * the current thread. In this case, we don't need to hold the
-	 * irq->lock so we just unlock it and then lock it again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-/** Get Local APIC ID.
- *
- * @return Local APIC ID.
- *
- */
-static uint8_t l_apic_id(void)
-{
-	l_apic_id_t idreg;
-
-	idreg.value = l_apic[L_APIC_ID];
-	return idreg.apic_id;
-}
-
-/** Initialize APIC on BSP. */
-void apic_init(void)
-{
-	exc_register(VECTOR_APIC_SPUR, "apic_spurious", false,
-	    (iroutine_t) apic_spurious);
-
-	pic_ops = &apic_pic_ops;
-
-	/*
-	 * Configure interrupt routing.
-	 * IRQ 0 remains masked as the time signal is generated by l_apic's themselves.
-	 * Other interrupts will be forwarded to the lowest priority CPU.
-	 */
-	io_apic_disable_irqs(0xffffU);
-
-	irq_initialize(&l_apic_timer_irq);
-	l_apic_timer_irq.preack = true;
-	l_apic_timer_irq.inr = IRQ_CLK;
-	l_apic_timer_irq.claim = l_apic_timer_claim;
-	l_apic_timer_irq.handler = l_apic_timer_irq_handler;
-	irq_register(&l_apic_timer_irq);
-
-	uint8_t i;
-	for (i = 0; i < IRQ_COUNT; i++) {
-		int pin;
-
-		if ((pin = smp_irq_to_pin(i)) != -1)
-			io_apic_change_ioredtbl((uint8_t) pin, DEST_ALL, (uint8_t) (IVT_IRQBASE + i), LOPRI);
-	}
-
-	/*
-	 * Ensure that io_apic has unique ID.
-	 */
-	io_apic_id_t idreg;
-
-	idreg.value = io_apic_read(IOAPICID);
-	if ((1 << idreg.apic_id) & apic_id_mask) {  /* See if IO APIC ID is used already */
-		for (i = 0; i < APIC_ID_COUNT; i++) {
-			if (!((1 << i) & apic_id_mask)) {
-				idreg.apic_id = i;
-				io_apic_write(IOAPICID, idreg.value);
-				break;
-			}
-		}
-	}
-
-	/*
-	 * Configure the BSP's lapic.
-	 */
-	l_apic_init();
-	l_apic_debug();
-
-	bsp_l_apic = l_apic_id();
-}
-
-/** Poll for APIC errors.
- *
- * Examine Error Status Register and report all errors found.
- *
- * @return 0 on error, 1 on success.
- *
- */
-int apic_poll_errors(void)
-{
-	esr_t esr;
-
-	esr.value = l_apic[ESR];
-
-	if (esr.err_bitmap) {
-		log_begin(LF_ARCH, LVL_ERROR);
-		log_printf("APIC errors detected:");
-		if (esr.send_checksum_error)
-			log_printf("\nSend Checksum Error");
-		if (esr.receive_checksum_error)
-			log_printf("\nReceive Checksum Error");
-		if (esr.send_accept_error)
-			log_printf("\nSend Accept Error");
-		if (esr.receive_accept_error)
-			log_printf("\nReceive Accept Error");
-		if (esr.send_illegal_vector)
-			log_printf("\nSend Illegal Vector");
-		if (esr.received_illegal_vector)
-			log_printf("\nReceived Illegal Vector");
-		if (esr.illegal_register_address)
-			log_printf("\nIllegal Register Address");
-		log_end();
-	}
-
-	return !esr.err_bitmap;
-}
-
-/* Waits for the destination cpu to accept the previous ipi. */
-static void l_apic_wait_for_delivery(void)
-{
-	icr_t icr;
-
-	do {
-		icr.lo = l_apic[ICRlo];
-	} while (icr.delivs != DELIVS_IDLE);
-}
-
-/** Send one CPU an IPI vector.
- *
- * @param apicid Physical APIC ID of the destination CPU.
- * @param vector Interrupt vector to be sent.
- *
- * @return 0 on failure, 1 on success.
- */
-int l_apic_send_custom_ipi(uint8_t apicid, uint8_t vector)
-{
-	icr_t icr;
-
-	/* Wait for a destination cpu to accept our previous ipi. */
-	l_apic_wait_for_delivery();
-
-	icr.lo = l_apic[ICRlo];
-	icr.hi = l_apic[ICRhi];
-
-	icr.delmod = DELMOD_FIXED;
-	icr.destmod = DESTMOD_PHYS;
-	icr.level = LEVEL_ASSERT;
-	icr.shorthand = SHORTHAND_NONE;
-	icr.trigger_mode = TRIGMOD_LEVEL;
-	icr.vector = vector;
-	icr.dest = apicid;
-
-	/* Send the IPI by writing to l_apic[ICRlo]. */
-	l_apic[ICRhi] = icr.hi;
-	l_apic[ICRlo] = icr.lo;
-
-	return apic_poll_errors();
-}
-
-/** Send all CPUs excluding CPU IPI vector.
- *
- * @param vector Interrupt vector to be sent.
- *
- * @return 0 on failure, 1 on success.
- *
- */
-int l_apic_broadcast_custom_ipi(uint8_t vector)
-{
-	icr_t icr;
-
-	/* Wait for a destination cpu to accept our previous ipi. */
-	l_apic_wait_for_delivery();
-
-	icr.lo = l_apic[ICRlo];
-	icr.delmod = DELMOD_FIXED;
-	icr.destmod = DESTMOD_LOGIC;
-	icr.level = LEVEL_ASSERT;
-	icr.shorthand = SHORTHAND_ALL_EXCL;
-	icr.trigger_mode = TRIGMOD_LEVEL;
-	icr.vector = vector;
-
-	l_apic[ICRlo] = icr.lo;
-
-	return apic_poll_errors();
-}
-
-/** Universal Start-up Algorithm for bringing up the AP processors.
- *
- * @param apicid APIC ID of the processor to be brought up.
- *
- * @return 0 on failure, 1 on success.
- *
- */
-int l_apic_send_init_ipi(uint8_t apicid)
-{
-	/*
-	 * Read the ICR register in and zero all non-reserved fields.
-	 */
-	icr_t icr;
-
-	icr.lo = l_apic[ICRlo];
-	icr.hi = l_apic[ICRhi];
-
-	icr.delmod = DELMOD_INIT;
-	icr.destmod = DESTMOD_PHYS;
-	icr.level = LEVEL_ASSERT;
-	icr.trigger_mode = TRIGMOD_LEVEL;
-	icr.shorthand = SHORTHAND_NONE;
-	icr.vector = 0;
-	icr.dest = apicid;
-
-	l_apic[ICRhi] = icr.hi;
-	l_apic[ICRlo] = icr.lo;
-
-	/*
-	 * According to MP Specification, 20us should be enough to
-	 * deliver the IPI.
-	 */
-	delay(20);
-
-	if (!apic_poll_errors())
-		return 0;
-
-	l_apic_wait_for_delivery();
-
-	icr.lo = l_apic[ICRlo];
-	icr.delmod = DELMOD_INIT;
-	icr.destmod = DESTMOD_PHYS;
-	icr.level = LEVEL_DEASSERT;
-	icr.shorthand = SHORTHAND_NONE;
-	icr.trigger_mode = TRIGMOD_LEVEL;
-	icr.vector = 0;
-	l_apic[ICRlo] = icr.lo;
-
-	/*
-	 * Wait 10ms as MP Specification specifies.
-	 */
-	delay(10000);
-
-	if (!is_82489DX_apic(l_apic[LAVR])) {
-		/*
-		 * If this is not 82489DX-based l_apic we must send two STARTUP IPI's.
-		 */
-		unsigned int i;
-		for (i = 0; i < 2; i++) {
-			icr.lo = l_apic[ICRlo];
-			icr.vector = (uint8_t) (((uintptr_t) ap_boot) >> 12); /* calculate the reset vector */
-			icr.delmod = DELMOD_STARTUP;
-			icr.destmod = DESTMOD_PHYS;
-			icr.level = LEVEL_ASSERT;
-			icr.shorthand = SHORTHAND_NONE;
-			icr.trigger_mode = TRIGMOD_LEVEL;
-			l_apic[ICRlo] = icr.lo;
-			delay(200);
-		}
-	}
-
-	return apic_poll_errors();
-}
-
-/** Initialize Local APIC. */
-void l_apic_init(void)
-{
-	/* Initialize LVT Error register. */
-	lvt_error_t error;
-
-	error.value = l_apic[LVT_Err];
-	error.masked = true;
-	l_apic[LVT_Err] = error.value;
-
-	/* Initialize LVT LINT0 register. */
-	lvt_lint_t lint;
-
-	lint.value = l_apic[LVT_LINT0];
-	lint.masked = true;
-	l_apic[LVT_LINT0] = lint.value;
-
-	/* Initialize LVT LINT1 register. */
-	lint.value = l_apic[LVT_LINT1];
-	lint.masked = true;
-	l_apic[LVT_LINT1] = lint.value;
-
-	/* Task Priority Register initialization. */
-	tpr_t tpr;
-
-	tpr.value = l_apic[TPR];
-	tpr.pri_sc = 0;
-	tpr.pri = 0;
-	l_apic[TPR] = tpr.value;
-
-	/* Spurious-Interrupt Vector Register initialization. */
-	svr_t svr;
-
-	svr.value = l_apic[SVR];
-	svr.vector = VECTOR_APIC_SPUR;
-	svr.lapic_enabled = true;
-	svr.focus_checking = true;
-	l_apic[SVR] = svr.value;
-
-	if (CPU->arch.family >= 6)
-		enable_l_apic_in_msr();
-
-	/* Interrupt Command Register initialization. */
-	icr_t icr;
-
-	icr.lo = l_apic[ICRlo];
-	icr.delmod = DELMOD_INIT;
-	icr.destmod = DESTMOD_PHYS;
-	icr.level = LEVEL_DEASSERT;
-	icr.shorthand = SHORTHAND_ALL_INCL;
-	icr.trigger_mode = TRIGMOD_LEVEL;
-	l_apic[ICRlo] = icr.lo;
-
-	/* Timer Divide Configuration Register initialization. */
-	tdcr_t tdcr;
-
-	tdcr.value = l_apic[TDCR];
-	tdcr.div_value = DIVIDE_1;
-	l_apic[TDCR] = tdcr.value;
-
-	/* Program local timer. */
-	lvt_tm_t tm;
-
-	tm.value = l_apic[LVT_Tm];
-	tm.vector = VECTOR_CLK;
-	tm.mode = TIMER_PERIODIC;
-	tm.masked = false;
-	l_apic[LVT_Tm] = tm.value;
-
-	/*
-	 * Measure and configure the timer to generate timer
-	 * interrupt with period 1s/HZ seconds.
-	 */
-	uint32_t t1 = l_apic[CCRT];
-	l_apic[ICRT] = 0xffffffff;
-
-	while (l_apic[CCRT] == t1)
-		;
-
-	t1 = l_apic[CCRT];
-	delay(1000000 / HZ);
-	uint32_t t2 = l_apic[CCRT];
-
-	l_apic[ICRT] = t1 - t2;
-
-	/* Program Logical Destination Register. */
-	assert(CPU->id < 8);
-	ldr_t ldr;
-
-	ldr.value = l_apic[LDR];
-	ldr.id = (uint8_t) (1 << CPU->id);
-	l_apic[LDR] = ldr.value;
-
-	/* Program Destination Format Register for Flat mode. */
-	dfr_t dfr;
-
-	dfr.value = l_apic[DFR];
-	dfr.model = MODEL_FLAT;
-	l_apic[DFR] = dfr.value;
-}
-
-/** Local APIC End of Interrupt. */
-void l_apic_eoi(unsigned int ignored)
-{
-	l_apic[EOI] = 0;
-}
-
-/** Dump content of Local APIC registers. */
-void l_apic_debug(void)
-{
-#ifdef LAPIC_VERBOSE
-	log_begin(LF_ARCH, LVL_DEBUG);
-	log_printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n",
-	    CPU->id, l_apic_id());
-
-	lvt_tm_t tm;
-	tm.value = l_apic[LVT_Tm];
-	log_printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n",
-	    tm.vector, delivs_str[tm.delivs], mask_str[tm.masked],
-	    tm_mode_str[tm.mode]);
-
-	lvt_lint_t lint;
-	lint.value = l_apic[LVT_LINT0];
-	log_printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
-	    tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs],
-	    intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
-	    mask_str[lint.masked]);
-
-	lint.value = l_apic[LVT_LINT1];
-	log_printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
-	    tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs],
-	    intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
-	    mask_str[lint.masked]);
-
-	lvt_error_t error;
-	error.value = l_apic[LVT_Err];
-	log_printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector,
-	    delivs_str[error.delivs], mask_str[error.masked]);
-	log_end();
-#endif
-}
-
-/** Read from IO APIC register.
- *
- * @param address IO APIC register address.
- *
- * @return Content of the addressed IO APIC register.
- *
- */
-uint32_t io_apic_read(uint8_t address)
-{
-	io_regsel_t regsel;
-
-	regsel.value = io_apic[IOREGSEL];
-	regsel.reg_addr = address;
-	io_apic[IOREGSEL] = regsel.value;
-	return io_apic[IOWIN];
-}
-
-/** Write to IO APIC register.
- *
- * @param address IO APIC register address.
- * @param val     Content to be written to the addressed IO APIC register.
- *
- */
-void io_apic_write(uint8_t address, uint32_t val)
-{
-	io_regsel_t regsel;
-
-	regsel.value = io_apic[IOREGSEL];
-	regsel.reg_addr = address;
-	io_apic[IOREGSEL] = regsel.value;
-	io_apic[IOWIN] = val;
-}
-
-/** Change some attributes of one item in I/O Redirection Table.
- *
- * @param pin   IO APIC pin number.
- * @param dest  Interrupt destination address.
- * @param vec   Interrupt vector to trigger.
- * @param flags Flags.
- *
- */
-void io_apic_change_ioredtbl(uint8_t pin, uint8_t dest, uint8_t vec,
-    unsigned int flags)
-{
-	unsigned int dlvr;
-
-	if (flags & LOPRI)
-		dlvr = DELMOD_LOWPRI;
-	else
-		dlvr = DELMOD_FIXED;
-
-	io_redirection_reg_t reg;
-	reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
-	reg.hi = io_apic_read((uint8_t) (IOREDTBL + pin * 2 + 1));
-
-	reg.dest = dest;
-	reg.destmod = DESTMOD_LOGIC;
-	reg.trigger_mode = TRIGMOD_EDGE;
-	reg.intpol = POLARITY_HIGH;
-	reg.delmod = dlvr;
-	reg.intvec = vec;
-
-	io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
-	io_apic_write((uint8_t) (IOREDTBL + pin * 2 + 1), reg.hi);
-}
-
-/** Mask IRQs in IO APIC.
- *
- * @param irqmask Bitmask of IRQs to be masked (0 = do not mask, 1 = mask).
- *
- */
-void io_apic_disable_irqs(uint16_t irqmask)
-{
-	unsigned int i;
-	for (i = 0; i < 16; i++) {
-		if (irqmask & (1 << i)) {
-			/*
-			 * Mask the signal input in IO APIC if there is a
-			 * mapping for the respective IRQ number.
-			 */
-			int pin = smp_irq_to_pin(i);
-			if (pin != -1) {
-				io_redirection_reg_t reg;
-
-				reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
-				reg.masked = true;
-				io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
-			}
-
-		}
-	}
-}
-
-/** Unmask IRQs in IO APIC.
- *
- * @param irqmask Bitmask of IRQs to be unmasked (0 = do not unmask, 1 = unmask).
- *
- */
-void io_apic_enable_irqs(uint16_t irqmask)
-{
-	unsigned int i;
-	for (i = 0; i < 16; i++) {
-		if (irqmask & (1 << i)) {
-			/*
-			 * Unmask the signal input in IO APIC if there is a
-			 * mapping for the respective IRQ number.
-			 */
-			int pin = smp_irq_to_pin(i);
-			if (pin != -1) {
-				io_redirection_reg_t reg;
-
-				reg.lo = io_apic_read((uint8_t) (IOREDTBL + pin * 2));
-				reg.masked = false;
-				io_apic_write((uint8_t) (IOREDTBL + pin * 2), reg.lo);
-			}
-
-		}
-	}
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/ia32/src/smp/ipi.c
===================================================================
--- kernel/arch/ia32/src/smp/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifdef CONFIG_SMP
-
-#include <smp/ipi.h>
-#include <arch/smp/apic.h>
-
-void ipi_broadcast_arch(int ipi)
-{
-	(void) l_apic_broadcast_custom_ipi((uint8_t) ipi);
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/ia32/src/smp/mps.c
===================================================================
--- kernel/arch/ia32/src/smp/mps.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,476 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifdef CONFIG_SMP
-
-#include <config.h>
-#include <log.h>
-#include <arch/smp/mps.h>
-#include <arch/smp/apic.h>
-#include <arch/smp/smp.h>
-#include <assert.h>
-#include <halt.h>
-#include <typedefs.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <arch/bios/bios.h>
-#include <mm/frame.h>
-
-/*
- * MultiProcessor Specification detection code.
- */
-
-#define FS_SIGNATURE  UINT32_C(0x5f504d5f)
-#define CT_SIGNATURE  UINT32_C(0x504d4350)
-
-static struct mps_fs *fs;
-static struct mps_ct *ct;
-
-static struct __processor_entry *processor_entries = NULL;
-static struct __bus_entry *bus_entries = NULL;
-static struct __io_apic_entry *io_apic_entries = NULL;
-static struct __io_intr_entry *io_intr_entries = NULL;
-static struct __l_intr_entry *l_intr_entries = NULL;
-
-static size_t io_apic_cnt = 0;
-
-static size_t processor_entry_cnt = 0;
-static size_t bus_entry_cnt = 0;
-static size_t io_apic_entry_cnt = 0;
-static size_t io_intr_entry_cnt = 0;
-static size_t l_intr_entry_cnt = 0;
-
-static uint8_t mps_cpu_apic_id(size_t i)
-{
-	assert(i < processor_entry_cnt);
-
-	return processor_entries[i].l_apic_id;
-}
-
-static bool mps_cpu_enabled(size_t i)
-{
-	assert(i < processor_entry_cnt);
-
-	/*
-	 * FIXME: The current local APIC driver limits usable
-	 * CPU IDs to 8.
-	 *
-	 */
-	if (i > 7)
-		return false;
-
-	return ((processor_entries[i].cpu_flags & 0x01) == 0x01);
-}
-
-static bool mps_cpu_bootstrap(size_t i)
-{
-	assert(i < processor_entry_cnt);
-
-	return ((processor_entries[i].cpu_flags & 0x02) == 0x02);
-}
-
-static int mps_irq_to_pin(unsigned int irq)
-{
-	size_t i;
-
-	for (i = 0; i < io_intr_entry_cnt; i++) {
-		if (io_intr_entries[i].src_bus_irq == irq &&
-		    io_intr_entries[i].intr_type == 0)
-			return io_intr_entries[i].dst_io_apic_pin;
-	}
-
-	return -1;
-}
-
-/** Implementation of IA-32 SMP configuration interface.
- *
- */
-struct smp_config_operations mps_config_operations = {
-	.cpu_enabled = mps_cpu_enabled,
-	.cpu_bootstrap = mps_cpu_bootstrap,
-	.cpu_apic_id = mps_cpu_apic_id,
-	.irq_to_pin = mps_irq_to_pin
-};
-
-/** Check the integrity of the MP Floating Structure.
- *
- */
-static bool mps_fs_check(uint8_t *base)
-{
-	unsigned int i;
-	uint8_t sum;
-
-	for (i = 0, sum = 0; i < 16; i++)
-		sum = (uint8_t) (sum + base[i]);
-
-	return (sum == 0);
-}
-
-/** Check the integrity of the MP Configuration Table.
- *
- */
-static bool mps_ct_check(void)
-{
-	uint8_t *base = (uint8_t *) ct;
-	uint8_t *ext = base + ct->base_table_length;
-	uint8_t sum;
-	uint16_t i;
-
-	/* Compute the checksum for the base table */
-	for (i = 0, sum = 0; i < ct->base_table_length; i++)
-		sum = (uint8_t) (sum + base[i]);
-
-	if (sum)
-		return false;
-
-	/* Compute the checksum for the extended table */
-	for (i = 0, sum = 0; i < ct->ext_table_length; i++)
-		sum = (uint8_t) (sum + ext[i]);
-
-	return (sum == ct->ext_table_checksum);
-}
-
-static void ct_processor_entry(struct __processor_entry *pr)
-{
-	/*
-	 * Ignore processors which are not marked enabled.
-	 */
-	if ((pr->cpu_flags & (1 << 0)) == 0)
-		return;
-
-	apic_id_mask |= (1 << pr->l_apic_id);
-}
-
-static void ct_bus_entry(struct __bus_entry *bus __attribute__((unused)))
-{
-#ifdef MPSCT_VERBOSE
-	char buf[7];
-
-	memcpy((void *) buf, (void *) bus->bus_type, 6);
-	buf[6] = 0;
-
-	log(LF_ARCH, LVL_DEBUG, "MPS: bus=%" PRIu8 " (%s)", bus->bus_id, buf);
-#endif
-}
-
-static void ct_io_apic_entry(struct __io_apic_entry *ioa)
-{
-	/* This I/O APIC is marked unusable */
-	if ((ioa->io_apic_flags & 1) == 0)
-		return;
-
-	if (io_apic_cnt++ > 0) {
-		/*
-		 * Multiple I/O APICs are currently not supported.
-		 */
-		return;
-	}
-
-	io_apic = (uint32_t *) (uintptr_t) ioa->io_apic;
-}
-
-static void ct_io_intr_entry(struct __io_intr_entry *iointr
-    __attribute__((unused)))
-{
-#ifdef MPSCT_VERBOSE
-	log_begin(LF_ARCH, LVL_DEBUG);
-	log_printf("MPS: ");
-
-	switch (iointr->intr_type) {
-	case 0:
-		log_printf("INT");
-		break;
-	case 1:
-		log_printf("NMI");
-		break;
-	case 2:
-		log_printf("SMI");
-		break;
-	case 3:
-		log_printf("ExtINT");
-		break;
-	}
-
-	log_printf(", ");
-
-	switch (iointr->poel & 3) {
-	case 0:
-		log_printf("bus-like");
-		break;
-	case 1:
-		log_printf("active high");
-		break;
-	case 2:
-		log_printf("reserved");
-		break;
-	case 3:
-		log_printf("active low");
-		break;
-	}
-
-	log_printf(", ");
-
-	switch ((iointr->poel >> 2) & 3) {
-	case 0:
-		log_printf("bus-like");
-		break;
-	case 1:
-		log_printf("edge-triggered");
-		break;
-	case 2:
-		log_printf("reserved");
-		break;
-	case 3:
-		log_printf("level-triggered");
-		break;
-	}
-
-	log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8 " pin=%"
-	    PRIu8, iointr->src_bus_id, iointr->src_bus_irq,
-	    iointr->dst_io_apic_id, iointr->dst_io_apic_pin);
-	log_end();
-#endif
-}
-
-static void ct_l_intr_entry(struct __l_intr_entry *lintr
-    __attribute__((unused)))
-{
-#ifdef MPSCT_VERBOSE
-	log_begin(LF_ARCH, LVL_DEBUG);
-	log_printf("MPS: ");
-
-	switch (lintr->intr_type) {
-	case 0:
-		log_printf("INT");
-		break;
-	case 1:
-		log_printf("NMI");
-		break;
-	case 2:
-		log_printf("SMI");
-		break;
-	case 3:
-		log_printf("ExtINT");
-		break;
-	}
-
-	log_printf(", ");
-
-	switch (lintr->poel & 3) {
-	case 0:
-		log_printf("bus-like");
-		break;
-	case 1:
-		log_printf("active high");
-		break;
-	case 2:
-		log_printf("reserved");
-		break;
-	case 3:
-		log_printf("active low");
-		break;
-	}
-
-	log_printf(", ");
-
-	switch ((lintr->poel >> 2) & 3) {
-	case 0:
-		log_printf("bus-like");
-		break;
-	case 1:
-		log_printf("edge-triggered");
-		break;
-	case 2:
-		log_printf("reserved");
-		break;
-	case 3:
-		log_printf("level-triggered");
-		break;
-	}
-
-	log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8 " pin=%"
-	    PRIu8, lintr->src_bus_id, lintr->src_bus_irq,
-	    lintr->dst_l_apic_id, lintr->dst_l_apic_pin);
-	log_end();
-#endif
-}
-
-static void ct_extended_entries(void)
-{
-	uint8_t *ext = (uint8_t *) ct + ct->base_table_length;
-	uint8_t *cur;
-
-	for (cur = ext; cur < ext + ct->ext_table_length;
-	    cur += cur[CT_EXT_ENTRY_LEN]) {
-		switch (cur[CT_EXT_ENTRY_TYPE]) {
-		default:
-			log(LF_ARCH, LVL_NOTE, "MPS: Skipping MP Configuration"
-			    " Table extended entry type %" PRIu8,
-			    cur[CT_EXT_ENTRY_TYPE]);
-		}
-	}
-}
-
-static void configure_via_ct(void)
-{
-	if (ct->signature != CT_SIGNATURE) {
-		log(LF_ARCH, LVL_WARN, "MPS: Wrong ct->signature");
-		return;
-	}
-
-	if (!mps_ct_check()) {
-		log(LF_ARCH, LVL_WARN, "MPS: Wrong ct checksum");
-		return;
-	}
-
-	if (ct->oem_table) {
-		log(LF_ARCH, LVL_WARN, "MPS: ct->oem_table not supported");
-		return;
-	}
-
-	l_apic = (uint32_t *) (uintptr_t) ct->l_apic;
-
-	uint8_t *cur = &ct->base_table[0];
-	uint16_t i;
-
-	for (i = 0; i < ct->entry_count; i++) {
-		switch (*cur) {
-		case 0:  /* Processor entry */
-			processor_entries = processor_entries ?
-			    processor_entries :
-			    (struct __processor_entry *) cur;
-			processor_entry_cnt++;
-			ct_processor_entry((struct __processor_entry *) cur);
-			cur += 20;
-			break;
-		case 1:  /* Bus entry */
-			bus_entries = bus_entries ?
-			    bus_entries : (struct __bus_entry *) cur;
-			bus_entry_cnt++;
-			ct_bus_entry((struct __bus_entry *) cur);
-			cur += 8;
-			break;
-		case 2:  /* I/O APIC */
-			io_apic_entries = io_apic_entries ?
-			    io_apic_entries : (struct __io_apic_entry *) cur;
-			io_apic_entry_cnt++;
-			ct_io_apic_entry((struct __io_apic_entry *) cur);
-			cur += 8;
-			break;
-		case 3:  /* I/O Interrupt Assignment */
-			io_intr_entries = io_intr_entries ?
-			    io_intr_entries : (struct __io_intr_entry *) cur;
-			io_intr_entry_cnt++;
-			ct_io_intr_entry((struct __io_intr_entry *) cur);
-			cur += 8;
-			break;
-		case 4:  /* Local Interrupt Assignment */
-			l_intr_entries = l_intr_entries ?
-			    l_intr_entries : (struct __l_intr_entry *) cur;
-			l_intr_entry_cnt++;
-			ct_l_intr_entry((struct __l_intr_entry *) cur);
-			cur += 8;
-			break;
-		default:
-			/*
-			 * Something is wrong. Fallback to UP mode.
-			 */
-			log(LF_ARCH, LVL_WARN, "MPS: ct badness %" PRIu8, *cur);
-			return;
-		}
-	}
-
-	/*
-	 * Process extended entries.
-	 */
-	ct_extended_entries();
-}
-
-static void configure_via_default(uint8_t n __attribute__((unused)))
-{
-	/*
-	 * Not yet implemented.
-	 */
-	log(LF_ARCH, LVL_WARN, "MPS: Default configuration not supported");
-}
-
-void mps_init(void)
-{
-	uint8_t *addr[2] = { NULL, (uint8_t *) PA2KA(0xf0000) };
-	unsigned int i;
-	unsigned int j;
-	unsigned int length[2] = { 1024, 64 * 1024 };
-
-	/*
-	 * Find MP Floating Pointer Structure
-	 *  1a. search first 1K of EBDA
-	 *  1b. if EBDA is undefined, search last 1K of base memory
-	 *  2.  search 64K starting at 0xf0000
-	 */
-
-	addr[0] = (uint8_t *) PA2KA(ebda ? ebda : 639 * 1024);
-	for (i = 0; i < 2; i++) {
-		for (j = 0; j < length[i]; j += 16) {
-			if ((*((uint32_t *) &addr[i][j]) ==
-			    FS_SIGNATURE) && (mps_fs_check(&addr[i][j]))) {
-				fs = (struct mps_fs *) &addr[i][j];
-				goto fs_found;
-			}
-		}
-	}
-
-	return;
-
-fs_found:
-	log(LF_ARCH, LVL_NOTE, "%p: MPS Floating Pointer Structure", fs);
-
-	if ((fs->config_type == 0) && (fs->configuration_table)) {
-		if (fs->mpfib2 >> 7) {
-			log(LF_ARCH, LVL_WARN, "MPS: PIC mode not supported\n");
-			return;
-		}
-
-		ct = (struct mps_ct *) PA2KA((uintptr_t) fs->configuration_table);
-		configure_via_ct();
-	} else
-		configure_via_default(fs->config_type);
-
-	if (processor_entry_cnt > 0)
-		config.cpu_count = processor_entry_cnt;
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/ia32/src/smp/smp.c
===================================================================
--- kernel/arch/ia32/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,200 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-#include <arch/smp/smp.h>
-#include <arch/smp/mps.h>
-#include <arch/smp/ap.h>
-#include <arch/boot/boot.h>
-#include <assert.h>
-#include <errno.h>
-#include <genarch/acpi/acpi.h>
-#include <genarch/acpi/madt.h>
-#include <config.h>
-#include <synch/waitq.h>
-#include <arch/pm.h>
-#include <halt.h>
-#include <panic.h>
-#include <arch/asm.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/km.h>
-#include <stdlib.h>
-#include <mm/as.h>
-#include <log.h>
-#include <memw.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <cpu.h>
-
-#ifdef CONFIG_SMP
-
-static struct smp_config_operations *ops = NULL;
-
-void smp_init(void)
-{
-	if (acpi_madt) {
-		acpi_madt_parse();
-		ops = &madt_config_operations;
-	}
-
-	if (config.cpu_count == 1) {
-		mps_init();
-		ops = &mps_config_operations;
-	}
-
-	if (config.cpu_count > 1) {
-		l_apic = (uint32_t *) km_map((uintptr_t) l_apic, PAGE_SIZE,
-		    PAGE_SIZE, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-		io_apic = (uint32_t *) km_map((uintptr_t) io_apic, PAGE_SIZE,
-		    PAGE_SIZE, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	}
-}
-
-static void cpu_arch_id_init(void)
-{
-	assert(ops != NULL);
-	assert(cpus != NULL);
-
-	for (unsigned int i = 0; i < config.cpu_count; ++i) {
-		cpus[i].arch.id = ops->cpu_apic_id(i);
-	}
-}
-
-/*
- * Kernel thread for bringing up application processors. It becomes clear
- * that we need an arrangement like this (AP's being initialized by a kernel
- * thread), for a thread has its dedicated stack. (The stack used during the
- * BSP initialization (prior the very first call to scheduler()) will be used
- * as an initialization stack for each AP.)
- */
-void kmp(void *arg __attribute__((unused)))
-{
-	unsigned int i;
-
-	assert(ops != NULL);
-
-	/*
-	 * SMP initialized, cpus array allocated. Assign each CPU its
-	 * physical APIC ID.
-	 */
-	cpu_arch_id_init();
-
-	/*
-	 * We need to access data in frame 0.
-	 * We boldly make use of kernel address space mapping.
-	 */
-
-	/*
-	 * Set the warm-reset vector to the real-mode address of 4K-aligned ap_boot()
-	 */
-	*((uint16_t *) (PA2KA(0x467 + 0))) =
-	    (uint16_t) (((uintptr_t) ap_boot) >> 4);  /* segment */
-	*((uint16_t *) (PA2KA(0x467 + 2))) = 0;       /* offset */
-
-	/*
-	 * Save 0xa to address 0xf of the CMOS RAM.
-	 * BIOS will not do the POST after the INIT signal.
-	 */
-	pio_write_8((ioport8_t *) 0x70, 0xf);
-	pio_write_8((ioport8_t *) 0x71, 0xa);
-
-	i8259_disable_irqs(0xffff);
-	apic_init();
-
-	for (i = 0; i < config.cpu_count; i++) {
-		/*
-		 * Skip processors marked unusable.
-		 */
-		if (!ops->cpu_enabled(i))
-			continue;
-
-		/*
-		 * The bootstrap processor is already up.
-		 */
-		if (ops->cpu_bootstrap(i))
-			continue;
-
-		if (ops->cpu_apic_id(i) == bsp_l_apic) {
-			log(LF_ARCH, LVL_ERROR, "kmp: bad processor entry #%u, "
-			    "will not send IPI to myself", i);
-			continue;
-		}
-
-		/*
-		 * Prepare new GDT for CPU in question.
-		 */
-
-		/*
-		 * XXX Flag FRAME_LOW_4_GiB was removed temporarily,
-		 * it needs to be replaced by a generic fuctionality of
-		 * the memory subsystem
-		 */
-		descriptor_t *gdt_new =
-		    (descriptor_t *) malloc(GDT_ITEMS * sizeof(descriptor_t));
-		if (!gdt_new)
-			panic("Cannot allocate memory for GDT.");
-
-		memcpy(gdt_new, gdt, GDT_ITEMS * sizeof(descriptor_t));
-		memsetb(&gdt_new[TSS_DES], sizeof(descriptor_t), 0);
-		protected_ap_gdtr.limit = GDT_ITEMS * sizeof(descriptor_t);
-		protected_ap_gdtr.base = KA2PA((uintptr_t) gdt_new);
-		gdtr.base = (uintptr_t) gdt_new;
-
-		if (l_apic_send_init_ipi(ops->cpu_apic_id(i))) {
-			/*
-			 * There may be just one AP being initialized at
-			 * the time. After it comes completely up, it is
-			 * supposed to wake us up.
-			 */
-			if (semaphore_down_timeout(&ap_completion_semaphore, 1000000) != EOK) {
-				log(LF_ARCH, LVL_NOTE, "%s: waiting for cpu%u "
-				    "(APIC ID = %d) timed out", __FUNCTION__,
-				    i, ops->cpu_apic_id(i));
-			}
-		} else
-			log(LF_ARCH, LVL_ERROR, "INIT IPI for l_apic%d failed",
-			    ops->cpu_apic_id(i));
-	}
-}
-
-int smp_irq_to_pin(unsigned int irq)
-{
-	assert(ops != NULL);
-	return ops->irq_to_pin(irq);
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/ia32/src/syscall.c
===================================================================
--- kernel/arch/ia32/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch/syscall.h>
-#include <arch/cpu.h>
-#include <arch/asm.h>
-#include <arch/pm.h>
-#include <stdint.h>
-
-#ifndef PROCESSOR_i486
-
-/** Enable & setup support for SYSENTER/SYSEXIT */
-void syscall_setup_cpu(void)
-{
-	extern void sysenter_handler(void);
-
-	/* set kernel mode CS selector */
-	write_msr(IA32_MSR_SYSENTER_CS, GDT_SELECTOR(KTEXT_DES));
-	/* set kernel mode entry point */
-	write_msr(IA32_MSR_SYSENTER_EIP, (uint32_t) sysenter_handler);
-}
-
-#endif /* PROCESSOR_i486 */
-
-/** @}
- */
Index: rnel/arch/ia32/src/userspace.c
===================================================================
--- kernel/arch/ia32/src/userspace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <userspace.h>
-#include <arch/pm.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <arch.h>
-#include <mm/as.h>
-#include <arch/cpu.h>
-#include <arch/asm.h>
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-/** Enter userspace
- *
- * Change CPU protection level to 3, enter userspace.
- *
- */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	uint32_t eflags = read_eflags();
-
-	asm volatile (
-	    /* Set up GS register (virtual register segment) */
-	    "movl %[vreg_des], %%gs\n"
-
-	    "pushl %[udata_des]\n"
-	    "pushl %[stack_top]\n"
-	    "pushl %[eflags]\n"
-	    "pushl %[utext_des]\n"
-	    "pushl %[entry]\n"
-
-	    /* %edi is defined to hold pcb_ptr - set it to 0 */
-	    "xorl %%edi, %%edi\n"
-
-	    "iret\n"
-	    :
-	    : [eflags_mask] "i" (~EFLAGS_NT),
-	      [udata_des] "i" (GDT_SELECTOR(UDATA_DES) | PL_USER),
-	      [stack_top] "r" (sp),
-	      [eflags] "r" ((eflags & ~(EFLAGS_NT)) | EFLAGS_IF),
-	      [utext_des] "i" (GDT_SELECTOR(UTEXT_DES) | PL_USER),
-	      [entry] "r" (pc),
-	      [vreg_des] "r" (GDT_SELECTOR(VREG_DES))
-	    : "eax");
-
-	unreachable();
-}
-
-/** @}
- */
Index: rnel/arch/ia32/src/vreg.c
===================================================================
--- kernel/arch/ia32/src/vreg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#include <arch/vreg.h>
-#include <arch/pm.h>
-#include <config.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <panic.h>
-#include <mm/km.h>
-#include <mm/frame.h>
-
-/*
- * During initialization, we need to make sure that context_save() and
- * context_restore() touch some meaningful address when saving/restoring VREGs.
- * When a processor is initialized, we set its GS base to a private page and
- * vreg_ptr to zero.
- */
-static uint32_t vreg_tp_dummy;
-uint32_t *vreg_ptr = &vreg_tp_dummy;
-
-/**
- * Allocate and initialize a per-CPU user page to be accessible via the GS
- * segment register and to hold the virtual registers.
- */
-void vreg_init(void)
-{
-	uintptr_t frame;
-	uint32_t *page;
-	descriptor_t *gdt_p = (descriptor_t *) gdtr.base;
-
-	frame = frame_alloc(1, FRAME_ATOMIC | FRAME_HIGHMEM, 0);
-	if (!frame)
-		panic("Cannot allocate VREG frame.");
-
-	page = (uint32_t *) km_map(frame, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE);
-
-	gdt_setbase(&gdt_p[VREG_DES], (uintptr_t) page);
-	gdt_setlimit(&gdt_p[VREG_DES], sizeof(uint32_t));
-
-	gs_load(GDT_SELECTOR(VREG_DES));
-
-	vreg_ptr = NULL;
-}
-
-/** @}
- */
Index: rnel/arch/ia64/_link.ld.in
===================================================================
--- kernel/arch/ia64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/** IA-64 linker script
- *
- *  It is ELF format, but its only section looks like this:
- *  kernel text
- *  kernel data
- *
- */
-
-#define LOAD_ADDRESS_V	0xe000000004800000
-#define LOAD_ADDRESS_P	0x0000000004800000
-
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	kernel_load_address = LOAD_ADDRESS_V;
-
-	.text (LOAD_ADDRESS_V + SIZEOF_HEADERS): AT (LOAD_ADDRESS_P + SIZEOF_HEADERS) {
-		. = ALIGN(16);
-		ktext_start = .;
-		KEEP(*(K_TEXT_START));
-		*(.text .text.*)
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-	
-	.data : {
-		kdata_start = .;
-		KEEP(*(K_DATA_START));
-		*(.rodata .rodata.*);
-		*(.opd)
-		*(.data .data.*)
-		__gp = .;
-		*(.got .got.*)
-		*(.sdata .sdata.*)
-		*(.sbss .sbss.*)
-		*(.scommon .scommon.*)
-		*(.bss .bss.*)
-		*(COMMON);
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: rnel/arch/ia64/include/arch/arch.h
===================================================================
--- kernel/arch/ia64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_ARCH_H_
-#define KERN_ia64_ARCH_H_
-
-extern void ia64_pre_main(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/asm.h
===================================================================
--- kernel/arch/ia64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,490 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_ASM_H_
-#define KERN_ia64_ASM_H_
-
-#include <config.h>
-#include <typedefs.h>
-#include <arch/register.h>
-#include <arch/legacyio.h>
-#include <trace.h>
-
-#define IO_SPACE_BOUNDARY       ((void *) (64 * 1024))
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-}
-
-/** Map the I/O port address to a legacy I/O address. */
-_NO_TRACE static inline uintptr_t p2a(volatile void *p)
-{
-	uintptr_t prt = (uintptr_t) p;
-
-	return legacyio_virt_base + (((prt >> 2) << 12) | (prt & 0xfff));
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY)
-		*((ioport8_t *) p2a(port)) = v;
-	else
-		*port = v;
-
-	asm volatile (
-	    "mf\n"
-	    "mf.a\n"
-	    ::: "memory"
-	);
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY)
-		*((ioport16_t *) p2a(port)) = v;
-	else
-		*port = v;
-
-	asm volatile (
-	    "mf\n"
-	    "mf.a\n"
-	    ::: "memory"
-	);
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY)
-		*((ioport32_t *) p2a(port)) = v;
-	else
-		*port = v;
-
-	asm volatile (
-	    "mf\n"
-	    "mf.a\n"
-	    ::: "memory"
-	);
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	uint8_t v;
-
-	asm volatile (
-	    "mf\n"
-	    ::: "memory"
-	);
-
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY)
-		v = *((ioport8_t *) p2a(port));
-	else
-		v = *port;
-
-	asm volatile (
-	    "mf.a\n"
-	    ::: "memory"
-	);
-
-	return v;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	uint16_t v;
-
-	asm volatile (
-	    "mf\n"
-	    ::: "memory"
-	);
-
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY)
-		v = *((ioport16_t *) p2a(port));
-	else
-		v = *port;
-
-	asm volatile (
-	    "mf.a\n"
-	    ::: "memory"
-	);
-
-	return v;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	uint32_t v;
-
-	asm volatile (
-	    "mf\n"
-	    ::: "memory"
-	);
-
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY)
-		v = *((ioport32_t *) p2a(port));
-	else
-		v = *port;
-
-	asm volatile (
-	    "mf.a\n"
-	    ::: "memory"
-	);
-
-	return v;
-}
-
-/** Return Processor State Register.
- *
- * @return PSR.
- *
- */
-_NO_TRACE static inline uint64_t psr_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = psr\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Read IVA (Interruption Vector Address).
- *
- * @return Return location of interruption vector table.
- *
- */
-_NO_TRACE static inline uint64_t iva_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr.iva\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write IVA (Interruption Vector Address) register.
- *
- * @param v New location of interruption vector table.
- *
- */
-_NO_TRACE static inline void iva_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.iva = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Read IVR (External Interrupt Vector Register).
- *
- * @return Highest priority, pending, unmasked external
- *         interrupt vector.
- *
- */
-_NO_TRACE static inline uint64_t ivr_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr.ivr\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-_NO_TRACE static inline uint64_t cr64_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr64\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write ITC (Interval Timer Counter) register.
- *
- * @param v New counter value.
- *
- */
-_NO_TRACE static inline void itc_write(uint64_t v)
-{
-	asm volatile (
-	    "mov ar.itc = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Read ITC (Interval Timer Counter) register.
- *
- * @return Current counter value.
- *
- */
-_NO_TRACE static inline uint64_t itc_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = ar.itc\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write ITM (Interval Timer Match) register.
- *
- * @param v New match value.
- *
- */
-_NO_TRACE static inline void itm_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.itm = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Read ITM (Interval Timer Match) register.
- *
- * @return Match value.
- *
- */
-_NO_TRACE static inline uint64_t itm_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr.itm\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Read ITV (Interval Timer Vector) register.
- *
- * @return Current vector and mask bit.
- *
- */
-_NO_TRACE static inline uint64_t itv_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr.itv\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write ITV (Interval Timer Vector) register.
- *
- * @param v New vector and mask bit.
- *
- */
-_NO_TRACE static inline void itv_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.itv = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Write EOI (End Of Interrupt) register.
- *
- * @param v This value is ignored.
- *
- */
-_NO_TRACE static inline void eoi_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.eoi = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Read TPR (Task Priority Register).
- *
- * @return Current value of TPR.
- *
- */
-_NO_TRACE static inline uint64_t tpr_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = cr.tpr\n"
-	    : [value] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write TPR (Task Priority Register).
- *
- * @param v New value of TPR.
- *
- */
-_NO_TRACE static inline void tpr_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.tpr = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-/** Disable interrupts.
- *
- * Disable interrupts and return previous
- * value of PSR.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static ipl_t interrupts_disable(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = psr\n"
-	    "rsm %[mask]\n"
-	    : [value] "=r" (v)
-	    : [mask] "i" (PSR_I_MASK)
-	);
-
-	return (ipl_t) v;
-}
-
-/** Enable interrupts.
- *
- * Enable interrupts and return previous
- * value of PSR.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static ipl_t interrupts_enable(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[value] = psr\n"
-	    "ssm %[mask]\n"
-	    ";;\n"
-	    "srlz.d\n"
-	    : [value] "=r" (v)
-	    : [mask] "i" (PSR_I_MASK)
-	);
-
-	return (ipl_t) v;
-}
-
-/** Restore interrupt priority level.
- *
- * Restore PSR.
- *
- * @param ipl Saved interrupt priority level.
- *
- */
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	if (ipl & PSR_I_MASK)
-		(void) interrupts_enable();
-	else
-		(void) interrupts_disable();
-}
-
-/** Return interrupt priority level.
- *
- * @return PSR.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	return (ipl_t) psr_read();
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	return !(psr_read() & PSR_I_MASK);
-}
-
-/** Disable protection key checking. */
-_NO_TRACE static inline void pk_disable(void)
-{
-	asm volatile (
-	    "rsm %[mask]\n"
-	    ";;\n"
-	    "srlz.d\n"
-	    :: [mask] "i" (PSR_PK_MASK)
-	);
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void cpu_sleep(void);
-extern void asm_delay_loop(uint32_t t);
-
-extern void switch_to_userspace(uintptr_t, uintptr_t, uintptr_t, uintptr_t,
-    uint64_t, uint64_t);
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this properly
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/barrier.h
===================================================================
--- kernel/arch/ia64/include/arch/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_BARRIER_H_
-#define KERN_ia64_BARRIER_H_
-
-#define mf()	asm volatile ("mf\n" ::: "memory")
-
-#define srlz_i()		\
-	asm volatile (";; srlz.i ;;\n" ::: "memory")
-#define srlz_d()		\
-	asm volatile (";; srlz.d\n" ::: "memory")
-
-#define fc_i(a)			\
-	asm volatile ("fc.i %0\n" :: "r" ((a)) : "memory")
-#define sync_i()		\
-	asm volatile (";; sync.i\n" ::: "memory")
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/bootinfo.h
===================================================================
--- kernel/arch/ia64/include/arch/bootinfo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ia64_BOOTINFO_H_
-#define KERN_ia64_BOOTINFO_H_
-
-#define TASKMAP_MAX_RECORDS  32
-
-#define MEMMAP_ITEMS 128
-
-#define MEMMAP_FREE_MEM 0
-
-/** Size of buffer for storing task name in utask_t. */
-#define BOOTINFO_TASK_NAME_BUFLEN 32
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	unsigned int type;
-	unsigned long base;
-	unsigned long size;
-} memmap_item_t;
-
-typedef struct {
-	taskmap_t taskmap;
-
-	memmap_item_t memmap[MEMMAP_ITEMS];
-	unsigned int memmap_items;
-
-	sysarg_t *sapic;
-	unsigned long sys_freq;
-	unsigned long freq_scale;
-	unsigned int wakeup_intno;
-} bootinfo_t;
-
-extern bootinfo_t *bootinfo;
-
-#endif
Index: rnel/arch/ia64/include/arch/context.h
===================================================================
--- kernel/arch/ia64/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_CONTEXT_H_
-#define KERN_ia64_CONTEXT_H_
-
-#include <typedefs.h>
-#include <arch/register.h>
-#include <align.h>
-#include <arch/stack.h>
-#include <arch/context_struct.h>
-
-/*
- * context_save_arch() and context_restore_arch() are both leaf procedures.
- * No need to allocate scratch area.
- *
- * One item is put onto the stack to support CURRENT.
- */
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-extern void *__gp;
-/* RSE stack starts at the bottom of memory stack, hence the division by 2. */
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = (uintptr_t) _pc; \
-		(c)->bsp = ((uintptr_t) stack) + ALIGN_UP((size / 2), REGISTER_STACK_ALIGNMENT); \
-		(c)->ar_pfs &= PFM_MASK; \
-		(c)->ar_fpsr = FPSR_TRAPS_ALL | FPSR_SF1_CTRL; \
-		(c)->sp = ((uintptr_t) stack) + ALIGN_UP((size / 2), STACK_ALIGNMENT) - SP_DELTA; \
-		(c)->r1 = (uintptr_t) &__gp; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/context_struct.h
===================================================================
--- kernel/arch/ia64/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_AR_PFS          0x00
-#define CONTEXT_OFFSET_AR_UNAT_CALLER  0x08
-#define CONTEXT_OFFSET_AR_UNAT_CALLEE  0x10
-#define CONTEXT_OFFSET_AR_RSC          0x18
-#define CONTEXT_OFFSET_BSP             0x20
-#define CONTEXT_OFFSET_AR_RNAT         0x28
-#define CONTEXT_OFFSET_AR_LC           0x30
-#define CONTEXT_OFFSET_AR_FPSR         0x38
-#define CONTEXT_OFFSET_R1              0x40
-#define CONTEXT_OFFSET_R4              0x48
-#define CONTEXT_OFFSET_R5              0x50
-#define CONTEXT_OFFSET_R6              0x58
-#define CONTEXT_OFFSET_R7              0x60
-#define CONTEXT_OFFSET_SP              0x68
-#define CONTEXT_OFFSET_R13             0x70
-#define CONTEXT_OFFSET_PC              0x78
-#define CONTEXT_OFFSET_B1              0x80
-#define CONTEXT_OFFSET_B2              0x88
-#define CONTEXT_OFFSET_B3              0x90
-#define CONTEXT_OFFSET_B4              0x98
-#define CONTEXT_OFFSET_B5              0xa0
-#define CONTEXT_OFFSET_PR              0xa8
-#define CONTEXT_OFFSET_F2              0xb0
-#define CONTEXT_OFFSET_F3              0xc0
-#define CONTEXT_OFFSET_F4              0xd0
-#define CONTEXT_OFFSET_F5              0xe0
-#define CONTEXT_OFFSET_F16             0xf0
-#define CONTEXT_OFFSET_F17             0x100
-#define CONTEXT_OFFSET_F18             0x110
-#define CONTEXT_OFFSET_F19             0x120
-#define CONTEXT_OFFSET_F20             0x130
-#define CONTEXT_OFFSET_F21             0x140
-#define CONTEXT_OFFSET_F22             0x150
-#define CONTEXT_OFFSET_F23             0x160
-#define CONTEXT_OFFSET_F24             0x170
-#define CONTEXT_OFFSET_F25             0x180
-#define CONTEXT_OFFSET_F26             0x190
-#define CONTEXT_OFFSET_F27             0x1a0
-#define CONTEXT_OFFSET_F28             0x1b0
-#define CONTEXT_OFFSET_F29             0x1c0
-#define CONTEXT_OFFSET_F30             0x1d0
-#define CONTEXT_OFFSET_F31             0x1e0
-#define CONTEXT_SIZE                   0x1f0
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-#include <_bits/int128_t.h>
-
-// Only save registers that must be preserved across function calls.
-typedef struct context {
-	// Application registers.
-	uint64_t ar_pfs;
-	uint64_t ar_unat_caller;
-	uint64_t ar_unat_callee;
-	uint64_t ar_rsc;
-	// ar_bsp
-	uint64_t bsp;
-	uint64_t ar_rnat;
-	uint64_t ar_lc;
-	uint64_t ar_fpsr;
-
-	// General registers.
-	uint64_t r1;
-	uint64_t r4;
-	uint64_t r5;
-	uint64_t r6;
-	uint64_t r7;
-	// r12
-	uint64_t sp;
-	uint64_t r13;
-
-	// Branch registers.
-	// b0
-	uint64_t pc;
-	uint64_t b1;
-	uint64_t b2;
-	uint64_t b3;
-	uint64_t b4;
-	uint64_t b5;
-
-	// Predicate registers.
-	uint64_t pr;
-
-	// Floating-point registers.
-	uint128_t f2;
-	uint128_t f3;
-	uint128_t f4;
-	uint128_t f5;
-	uint128_t f16;
-	uint128_t f17;
-	uint128_t f18;
-	uint128_t f19;
-	uint128_t f20;
-	uint128_t f21;
-	uint128_t f22;
-	uint128_t f23;
-	uint128_t f24;
-	uint128_t f25;
-	uint128_t f26;
-	uint128_t f27;
-	uint128_t f28;
-	uint128_t f29;
-	uint128_t f30;
-	uint128_t f31;
-} context_t;
-
-#endif /* __ASSEMBLER__ */
-#endif
Index: rnel/arch/ia64/include/arch/cpu.h
===================================================================
--- kernel/arch/ia64/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_CPU_H_
-#define KERN_ia64_CPU_H_
-
-#include <arch/register.h>
-#include <arch/asm.h>
-#include <arch/barrier.h>
-#include <arch/bootinfo.h>
-#include <stdint.h>
-#include <trace.h>
-
-#define FAMILY_ITANIUM   0x7
-#define FAMILY_ITANIUM2  0x1f
-
-#define CR64_ID_SHIFT   24
-#define CR64_ID_MASK    0xff000000
-#define CR64_EID_SHIFT  16
-#define CR64_EID_MASK   0xff0000
-
-typedef struct {
-	uint64_t cpuid0;
-	uint64_t cpuid1;
-	cpuid3_t cpuid3;
-} cpu_arch_t;
-
-/** Read CPUID register.
- *
- * @param n CPUID register number.
- *
- * @return Value of CPUID[n] register.
- *
- */
-_NO_TRACE static inline uint64_t cpuid_read(int n)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "mov %[v] = cpuid[%[r]]\n"
-	    : [v] "=r" (v)
-	    : [r] "r" (n)
-	);
-
-	return v;
-}
-
-_NO_TRACE static inline int ia64_get_cpu_id(void)
-{
-	uint64_t cr64 = cr64_read();
-	return ((CR64_ID_MASK) &cr64) >> CR64_ID_SHIFT;
-}
-
-_NO_TRACE static inline int ia64_get_cpu_eid(void)
-{
-	uint64_t cr64 = cr64_read();
-	return ((CR64_EID_MASK) &cr64) >> CR64_EID_SHIFT;
-}
-
-_NO_TRACE static inline void ipi_send_ipi(int id, int eid, int intno)
-{
-	(bootinfo->sapic)[2 * (id * 256 + eid)] = intno;
-	srlz_d();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/cycle.h
===================================================================
--- kernel/arch/ia64/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_CYCLE_H_
-#define KERN_ia64_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/drivers/it.h
===================================================================
--- kernel/arch/ia64/include/arch/drivers/it.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_IT_H_
-#define KERN_ia64_IT_H_
-
-/*
- * Unfortunately, Ski does not emulate PAL,
- * so we can't read the real frequency ratios
- * from firmware.
- *
- */
-#define IT_DELTA        it_delta
-
-extern void it_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/drivers/kbd.h
===================================================================
--- kernel/arch/ia64/include/arch/drivers/kbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar, Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_KBD_H_
-#define KERN_ia64_KBD_H_
-
-#define KBD_UNKNOWN  0
-#define KBD_SKI      1
-#define KBD_LEGACY   2
-#define KBD_NS16550  3
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/drivers/ski.h
===================================================================
--- kernel/arch/ia64/include/arch/drivers/ski.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_SKI_H_
-#define KERN_ia64_SKI_H_
-
-#include <console/chardev.h>
-#include <proc/thread.h>
-
-typedef struct {
-	thread_t *thread;
-	indev_t *srlnin;
-} ski_instance_t;
-
-extern outdev_t *skiout_init(void);
-
-extern ski_instance_t *skiin_init(void);
-extern void skiin_wire(ski_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/faddr.h
===================================================================
--- kernel/arch/ia64/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_FADDR_H_
-#define KERN_ia64_FADDR_H_
-
-#include <typedefs.h>
-
-/**
- *
- * Calculate absolute address of function
- * referenced by fptr pointer.
- *
- * @param fptr Function pointer.
- *
- */
-#define FADDR(fptr)  (((fncptr_t *) (fptr))->fnc)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/fpu_context.h
===================================================================
--- kernel/arch/ia64/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_FPU_CONTEXT_H_
-#define KERN_ia64_FPU_CONTEXT_H_
-
-#include <_bits/int128_t.h>
-
-#define FRS 96
-
-typedef struct {
-	_Alignas(16) uint128_t fr[FRS];
-} fpu_context_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/interrupt.h
===================================================================
--- kernel/arch/ia64/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_INTERRUPT_H_
-#define KERN_ia64_INTERRUPT_H_
-
-#ifndef __ASSEMBLER__
-#include <arch/istate.h>
-#include <stdint.h>
-#endif
-
-#define EXC_ALT_ITLB_FAULT	0xc
-#define EXC_ALT_DTLB_FAULT	0x10
-#define EXC_NESTED_TLB_FAULT	0x14
-#define EXC_DATA_D_BIT_FAULT	0x20
-#define EXC_INST_A_BIT_FAULT	0x24
-#define EXC_DATA_A_BIT_FAULT	0x28
-#define EXC_BREAK_INSTRUCTION	0x2c
-#define EXC_EXT_INTERRUPT	0x30
-#define EXC_PAGE_NOT_PRESENT	0x50
-#define EXC_DATA_AR_FAULT	0x53
-#define EXC_GENERAL_EXCEPTION	0x54
-#define EXC_DISABLED_FP_REG	0x55
-#define EXC_SPECULATION		0x57
-
-/** ia64 has 256 INRs. */
-#define INR_COUNT  256
-
-#define IVT_ITEMS  128
-#define IVT_FIRST  0
-
-/** External Interrupt vectors. */
-
-#define VECTOR_TLB_SHOOTDOWN_IPI  0xf0
-
-#define INTERRUPT_SPURIOUS  15
-#define INTERRUPT_TIMER     255
-
-#define LEGACY_INTERRUPT_BASE  0x20
-
-#define IRQ_KBD    (0x01 + LEGACY_INTERRUPT_BASE)
-#define IRQ_MOUSE  (0x0c + LEGACY_INTERRUPT_BASE)
-
-/** General Exception codes. */
-#define GE_ILLEGALOP     0
-#define GE_PRIVOP        1
-#define GE_PRIVREG       2
-#define GE_RESREGFLD     3
-#define GE_DISBLDISTRAN  4
-#define GE_ILLEGALDEP    8
-
-#define EOI  0  /**< The actual value doesn't matter. */
-
-#ifndef __ASSEMBLER__
-extern void *ivt;
-
-extern void general_exception(unsigned int, istate_t *);
-extern sysarg_t break_instruction(unsigned int, istate_t *);
-extern void universal_handler(unsigned int, istate_t *);
-extern void external_interrupt(unsigned int, istate_t *);
-extern void disabled_fp_register(unsigned int, istate_t *);
-
-void exception_init(void);
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/istate.h
===================================================================
--- kernel/arch/ia64/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_ISTATE_H_
-#define KERN_ia64_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/istate_struct.h>
-#include <arch/register.h>
-
-#else /* KERNEL */
-
-#include <libarch/istate_struct.h>
-#include <libarch/register.h>
-
-#endif /* KERNEL */
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->cr_iip = retaddr;
-	istate->cr_ipsr.ri = 0;    /* return to instruction slot #0 */
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->cr_iip;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	/* FIXME */
-
-	return 0;
-}
-
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return istate->cr_ipsr.cpl == PSR_CPL_USER;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ia64/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_F2                0x000
-#define ISTATE_OFFSET_F3                0x010
-#define ISTATE_OFFSET_F4                0x020
-#define ISTATE_OFFSET_F5                0x030
-#define ISTATE_OFFSET_F6                0x040
-#define ISTATE_OFFSET_F7                0x050
-#define ISTATE_OFFSET_F8                0x060
-#define ISTATE_OFFSET_F9                0x070
-#define ISTATE_OFFSET_F10               0x080
-#define ISTATE_OFFSET_F11               0x090
-#define ISTATE_OFFSET_F12               0x0a0
-#define ISTATE_OFFSET_F13               0x0b0
-#define ISTATE_OFFSET_F14               0x0c0
-#define ISTATE_OFFSET_F15               0x0d0
-#define ISTATE_OFFSET_F16               0x0e0
-#define ISTATE_OFFSET_F17               0x0f0
-#define ISTATE_OFFSET_F18               0x100
-#define ISTATE_OFFSET_F19               0x110
-#define ISTATE_OFFSET_F20               0x120
-#define ISTATE_OFFSET_F21               0x130
-#define ISTATE_OFFSET_F22               0x140
-#define ISTATE_OFFSET_F23               0x150
-#define ISTATE_OFFSET_F24               0x160
-#define ISTATE_OFFSET_F25               0x170
-#define ISTATE_OFFSET_F26               0x180
-#define ISTATE_OFFSET_F27               0x190
-#define ISTATE_OFFSET_F28               0x1a0
-#define ISTATE_OFFSET_F29               0x1b0
-#define ISTATE_OFFSET_F30               0x1c0
-#define ISTATE_OFFSET_F31               0x1d0
-#define ISTATE_OFFSET_AR_BSP            0x1e0
-#define ISTATE_OFFSET_AR_BSPSTORE       0x1e8
-#define ISTATE_OFFSET_AR_BSPSTORE_NEW   0x1f0
-#define ISTATE_OFFSET_AR_RNAT           0x1f8
-#define ISTATE_OFFSET_AR_IFS            0x200
-#define ISTATE_OFFSET_AR_PFS            0x208
-#define ISTATE_OFFSET_AR_RSC            0x210
-#define ISTATE_OFFSET_CR_IFA            0x218
-#define ISTATE_OFFSET_CR_ISR            0x220
-#define ISTATE_OFFSET_CR_IIPA           0x228
-#define ISTATE_OFFSET_CR_IPSR           0x230
-#define ISTATE_OFFSET_CR_IIP            0x238
-#define ISTATE_OFFSET_CR_IIM            0x240
-#define ISTATE_OFFSET_PR                0x248
-#define ISTATE_OFFSET_SP                0x250
-#define ISTATE_OFFSET_IN0               0x258
-#define ISTATE_OFFSET_IN1               0x260
-#define ISTATE_OFFSET_IN2               0x268
-#define ISTATE_OFFSET_IN3               0x270
-#define ISTATE_OFFSET_IN4               0x278
-#define ISTATE_OFFSET_IN5               0x280
-#define ISTATE_OFFSET_IN6               0x288
-#define ISTATE_SIZE                     0x290
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-#include <_bits/int128_t.h>
-
-#ifdef KERNEL
-#include <typedefs.h>
-#include <arch/register.h>
-#else
-#include <stddef.h>
-#include <libarch/register.h>
-#endif
-
-typedef struct istate {
-	uint128_t f2;
-	uint128_t f3;
-	uint128_t f4;
-	uint128_t f5;
-	uint128_t f6;
-	uint128_t f7;
-	uint128_t f8;
-	uint128_t f9;
-	uint128_t f10;
-	uint128_t f11;
-	uint128_t f12;
-	uint128_t f13;
-	uint128_t f14;
-	uint128_t f15;
-	uint128_t f16;
-	uint128_t f17;
-	uint128_t f18;
-	uint128_t f19;
-	uint128_t f20;
-	uint128_t f21;
-	uint128_t f22;
-	uint128_t f23;
-	uint128_t f24;
-	uint128_t f25;
-	uint128_t f26;
-	uint128_t f27;
-	uint128_t f28;
-	uint128_t f29;
-	uint128_t f30;
-	uint128_t f31;
-	uintptr_t ar_bsp;
-	uintptr_t ar_bspstore;
-	uintptr_t ar_bspstore_new;
-	uint64_t ar_rnat;
-	uint64_t ar_ifs;
-	uint64_t ar_pfs;
-	uint64_t ar_rsc;
-	uintptr_t cr_ifa;
-	cr_isr_t cr_isr;
-	uintptr_t cr_iipa;
-	psr_t cr_ipsr;
-	uintptr_t cr_iip;
-	uint64_t cr_iim;
-	uint64_t pr;
-	uintptr_t sp;
-
-	// The following variables are defined only for break_instruction
-	// handler.
-	uint64_t in0;
-	uint64_t in1;
-	uint64_t in2;
-	uint64_t in3;
-	uint64_t in4;
-	uint64_t in5;
-	uint64_t in6;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/ia64/include/arch/legacyio.h
===================================================================
--- kernel/arch/ia64/include/arch/legacyio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_LEGACYIO_H_
-#define KERN_ia64_LEGACYIO_H_
-
-#include <typedefs.h>
-
-#define LEGACYIO_PHYS_BASE	0x00000FFFFC000000ULL
-
-/* Legacy I/O space - static uspace address, FIXME */
-#define LEGACYIO_USER_BASE	0x0001000000000000ULL
-
-#define LEGACYIO_PAGE_WIDTH		26	/* 64M */
-#define LEGACYIO_SINGLE_PAGE_WIDTH 	12 	/* 4K */
-
-#define LEGACYIO_SIZE	(1ULL << LEGACYIO_PAGE_WIDTH)
-
-extern uintptr_t legacyio_virt_base;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/as.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_AS_H_
-#define KERN_ia64_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xe000000000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xdfffffffffffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_ht.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/asid.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_ASID_H_
-#define KERN_ia64_ASID_H_
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef uint16_t asid_t;
-typedef uint32_t rid_t;
-
-#endif  /* __ASSEMBLER__ */
-
-/**
- * Number of ia64 RIDs (Region Identifiers) per kernel ASID.
- * Note that some architectures may support more bits,
- * but those extra bits are not used by the kernel.
- */
-#define RIDS_PER_ASID		8
-
-#define RID_MAX			262143		/* 2^18 - 1 */
-#define RID_KERNEL7		7
-
-#define ASID2RID(asid, vrn) \
-	((asid) * RIDS_PER_ASID + (vrn))
-
-#define RID2ASID(rid) \
-	((rid) / RIDS_PER_ASID)
-
-#define ASID_MAX_ARCH		(RID_MAX / RIDS_PER_ASID)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/frame.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_FRAME_H_
-#define KERN_ia64_FRAME_H_
-
-#define FRAME_WIDTH  14  /* 16K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-extern uintptr_t end_of_identity;
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-#define physmem_print()
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/km.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_KM_H_
-#define KERN_ia64_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-/*
- * Be conservative and assume the minimal (3 + 51)-bit virtual address width
- * of the Itanium CPU even if running on CPU with full 64-bit virtual
- * address width, such as Itanium 2.
- */
-
-#define KM_IA64_IDENTITY_START		UINT64_C(0xe000000000000000)
-#define KM_IA64_IDENTITY_SIZE		UINT64_C(0x0004000000000000)
-
-#define KM_IA64_NON_IDENTITY_START	UINT64_C(0xfffc000000000000)
-#define KM_IA64_NON_IDENTITY_SIZE	UINT64_C(0x0004000000000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/page.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- * Copyright (c) 2005 - 2006 Jakub Jermar
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_PAGE_H_
-#define KERN_ia64_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <arch/register.h>
-
-#ifndef __ASSEMBLER__
-#include <assert.h>
-#endif
-
-#define PAGE_SIZE   FRAME_SIZE
-#define PAGE_WIDTH  FRAME_WIDTH
-
-/** Bit width of the TLB-locked portion of kernel address space. */
-#define KERNEL_PAGE_WIDTH 	28	/* 256M */
-
-#define PPN_SHIFT  12
-
-#define VRN_SHIFT   61
-#define VRN_MASK    (7ULL << VRN_SHIFT)
-#define VA2VRN(va)  ((va) >> VRN_SHIFT)
-
-#ifdef __ASSEMBLER__
-#define VRN_KERNEL  7
-#else
-#define VRN_KERNEL  7ULL
-#endif
-
-#define REGION_REGISTERS  8
-
-#define KA2PA(x)  (((uintptr_t) (x)) - (VRN_KERNEL << VRN_SHIFT))
-#define PA2KA(x)  (((uintptr_t) (x)) + (VRN_KERNEL << VRN_SHIFT))
-
-#define VHPT_WIDTH  20  /* 1M */
-#define VHPT_SIZE   (1 << VHPT_WIDTH)
-
-#define PTA_BASE_SHIFT  15
-
-/** Memory Attributes. */
-#define MA_WRITEBACK    0x00
-#define MA_UNCACHEABLE  0x04
-
-/** Privilege Levels. Only the most and the least privileged ones are ever used. */
-#define PL_KERNEL  PSR_CPL_KERNEL
-#define PL_USER    PSR_CPL_USER
-
-/* Access Rigths. Only certain combinations are used by the kernel. */
-#define AR_READ     0x00
-#define AR_EXECUTE  0x01
-#define AR_WRITE    0x02
-
-#ifndef __ASSEMBLER__
-
-#include <arch/mm/as.h>
-#include <arch/mm/frame.h>
-#include <arch/interrupt.h>
-#include <barrier.h>
-#include <arch/mm/asid.h>
-#include <typedefs.h>
-#include <debug.h>
-
-struct vhpt_tag_info {
-	unsigned long long tag : 63;
-	unsigned int ti : 1;
-} __attribute__((packed));
-
-union vhpt_tag {
-	struct vhpt_tag_info tag_info;
-	unsigned tag_word;
-};
-
-struct vhpt_entry_present {
-	/* Word 0 */
-	unsigned int p : 1;
-	unsigned int : 1;
-	unsigned int ma : 3;
-	unsigned int a : 1;
-	unsigned int d : 1;
-	unsigned int pl : 2;
-	unsigned int ar : 3;
-	unsigned long long ppn : 38;
-	unsigned int : 2;
-	unsigned int ed : 1;
-	unsigned int ig1 : 11;
-
-	/* Word 1 */
-	unsigned int : 2;
-	unsigned int ps : 6;
-	unsigned int key : 24;
-	unsigned int : 32;
-
-	/* Word 2 */
-	union vhpt_tag tag;
-
-	/* Word 3 */
-	uint64_t ig3 : 64;
-} __attribute__((packed));
-
-struct vhpt_entry_not_present {
-	/* Word 0 */
-	unsigned int p : 1;
-	unsigned long long ig0 : 52;
-	unsigned int ig1 : 11;
-
-	/* Word 1 */
-	unsigned int : 2;
-	unsigned int ps : 6;
-	unsigned long long ig2 : 56;
-
-	/* Word 2 */
-	union vhpt_tag tag;
-
-	/* Word 3 */
-	uint64_t ig3 : 64;
-} __attribute__((packed));
-
-typedef union {
-	struct vhpt_entry_present present;
-	struct vhpt_entry_not_present not_present;
-	uint64_t word[4];
-} vhpt_entry_t;
-
-struct region_register_map {
-	unsigned int ve : 1;
-	unsigned int : 1;
-	unsigned int ps : 6;
-	unsigned int rid : 24;
-	unsigned int : 32;
-} __attribute__((packed));
-
-typedef union {
-	struct region_register_map map;
-	unsigned long long word;
-} region_register_t;
-
-struct pta_register_map {
-	unsigned int ve : 1;
-	unsigned int : 1;
-	unsigned int size : 6;
-	unsigned int vf : 1;
-	unsigned int : 6;
-	unsigned long long base : 49;
-} __attribute__((packed));
-
-typedef union pta_register {
-	struct pta_register_map map;
-	uint64_t word;
-} pta_register_t;
-
-/** Return Translation Hashed Entry Address.
- *
- * VRN bits are used to read RID (ASID) from one
- * of the eight region registers registers.
- *
- * @param va Virtual address including VRN bits.
- *
- * @return Address of the head of VHPT collision chain.
- */
-_NO_TRACE static inline uint64_t thash(uint64_t va)
-{
-	uint64_t ret;
-
-	asm volatile (
-	    "thash %[ret] = %[va]\n"
-	    : [ret] "=r" (ret)
-	    : [va] "r" (va)
-	);
-
-	return ret;
-}
-
-/** Return Translation Hashed Entry Tag.
- *
- * VRN bits are used to read RID (ASID) from one
- * of the eight region registers.
- *
- * @param va Virtual address including VRN bits.
- *
- * @return The unique tag for VPN and RID in the collision chain returned by thash().
- */
-_NO_TRACE static inline uint64_t ttag(uint64_t va)
-{
-	uint64_t ret;
-
-	asm volatile (
-	    "ttag %[ret] = %[va]\n"
-	    : [ret] "=r" (ret)
-	    : [va] "r" (va)
-	);
-
-	return ret;
-}
-
-/** Read Region Register.
- *
- * @param i Region register index.
- *
- * @return Current contents of rr[i].
- */
-_NO_TRACE static inline uint64_t rr_read(size_t i)
-{
-	uint64_t ret;
-
-	assert(i < REGION_REGISTERS);
-
-	asm volatile (
-	    "mov %[ret] = rr[%[index]]\n"
-	    : [ret] "=r" (ret)
-	    : [index] "r" (i << VRN_SHIFT)
-	);
-
-	return ret;
-}
-
-/** Write Region Register.
- *
- * @param i Region register index.
- * @param v Value to be written to rr[i].
- */
-_NO_TRACE static inline void rr_write(size_t i, uint64_t v)
-{
-	assert(i < REGION_REGISTERS);
-
-	asm volatile (
-	    "mov rr[%[index]] = %[value]\n"
-	    :: [index] "r" (i << VRN_SHIFT),
-	      [value] "r" (v)
-	);
-}
-
-/** Read Page Table Register.
- *
- * @return Current value stored in PTA.
- */
-_NO_TRACE static inline uint64_t pta_read(void)
-{
-	uint64_t ret;
-
-	asm volatile (
-	    "mov %[ret] = cr.pta\n"
-	    : [ret] "=r" (ret)
-	);
-
-	return ret;
-}
-
-/** Write Page Table Register.
- *
- * @param v New value to be stored in PTA.
- */
-_NO_TRACE static inline void pta_write(uint64_t v)
-{
-	asm volatile (
-	    "mov cr.pta = %[value]\n"
-	    :: [value] "r" (v)
-	);
-}
-
-extern void page_arch_init(void);
-
-extern vhpt_entry_t *vhpt_hash(uintptr_t page, asid_t asid);
-extern bool vhpt_compare(uintptr_t page, asid_t asid, vhpt_entry_t *v);
-extern void vhpt_set_record(vhpt_entry_t *v, uintptr_t page, asid_t asid, uintptr_t frame, int flags);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_TLB_H_
-#define KERN_ia64_TLB_H_
-
-#include <arch/mm/page.h>
-#include <arch/mm/asid.h>
-#include <arch/interrupt.h>
-#include <typedefs.h>
-
-/** Data and instruction Translation Register indices. */
-#define DTR_KERNEL   0
-#define ITR_KERNEL   0
-#define DTR_KSTACK1  4
-#define DTR_KSTACK2  5
-
-/** Portion of TLB insertion format data structure. */
-typedef union {
-	uint64_t word[2];
-	struct {
-		/* Word 0 */
-		unsigned int p : 1;           /**< Present. */
-		unsigned int : 1;
-		unsigned int ma : 3;          /**< Memory attribute. */
-		unsigned int a : 1;           /**< Accessed. */
-		unsigned int d : 1;           /**< Dirty. */
-		unsigned int pl : 2;          /**< Privilege level. */
-		unsigned int ar : 3;          /**< Access rights. */
-		unsigned long long ppn : 38;  /**< Physical Page Number, a.k.a. PFN. */
-		unsigned int : 2;
-		unsigned int ed : 1;
-		unsigned int ig1 : 11;
-
-		/* Word 1 */
-		unsigned int : 2;
-		unsigned int ps : 6;    /**< Page size will be 2^ps. */
-		unsigned int key : 24;  /**< Protection key, unused. */
-		unsigned int : 32;
-	} __attribute__((packed));
-} __attribute__((packed)) tlb_entry_t;
-
-extern void tc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, bool dtc);
-extern void dtc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry);
-extern void itc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry);
-
-extern void tr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, bool dtr, size_t tr);
-extern void dtr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, size_t tr);
-extern void itr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, size_t tr);
-
-extern void dtlb_kernel_mapping_insert(uintptr_t page, uintptr_t frame, bool dtr, size_t tr);
-extern void dtr_purge(uintptr_t page, size_t width);
-
-extern void dtc_pte_copy(pte_t *t);
-extern void itc_pte_copy(pte_t *t);
-
-extern void alternate_instruction_tlb_fault(unsigned int, istate_t *);
-extern void alternate_data_tlb_fault(unsigned int, istate_t *);
-extern void data_nested_tlb_fault(unsigned int, istate_t *);
-extern void data_dirty_bit_fault(unsigned int, istate_t *);
-extern void instruction_access_bit_fault(unsigned int, istate_t *);
-extern void data_access_bit_fault(unsigned int, istate_t *);
-extern void data_access_rights_fault(unsigned int, istate_t *);
-extern void page_not_present(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/mm/vhpt.h
===================================================================
--- kernel/arch/ia64/include/arch/mm/vhpt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_VHPT_H_
-#define KERN_ia64_VHPT_H_
-
-#include <arch/mm/tlb.h>
-#include <arch/mm/page.h>
-
-uintptr_t vhpt_set_up(void);
-
-static inline vhpt_entry_t tlb_entry_t2vhpt_entry_t(tlb_entry_t tentry)
-{
-	vhpt_entry_t ventry;
-
-	ventry.word[0] = tentry.word[0];
-	ventry.word[1] = tentry.word[1];
-
-	return ventry;
-}
-
-void vhpt_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry);
-void vhpt_invalidate_all(void);
-void vhpt_invalidate_asid(asid_t asid);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/pal/pal.h
===================================================================
--- kernel/arch/ia64/include/arch/pal/pal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_PAL_H_
-#define KERN_ia64_PAL_H_
-
-#define PAL_OK		 0	/**< Call completed without error. */
-#define PAL_UNIMPL	-1	/**< Unimplemented procedure. */
-#define PAL_INVARG	-2	/**< Invalid argument. */
-#define PAL_ERR		-3	/**< Can not compete call without error. */
-
-/** These are the indices for PAL_PROC. */
-#define PAL_CACHE_FLUSH		1
-#define PAL_CACHE_INFO		2
-#define PAL_CACHE_INIT		3
-#define PAL_CACHE_PROT_INFO	38
-#define PAL_CACHE_SHARED_INFO	43
-#define PAL_CACHE_SUMMARY	4
-
-#define PAL_MEM_ATTRIB		5
-#define PAL_PREFETCH_VISIBILITY	41
-#define PAL_PTCE_INFO		6
-#define PAL_VM_INFO		7
-#define PAL_VM_PAGE_SIZE	34
-#define PAL_VM_SUMMARY		8
-#define PAL_VM_TR_READ		261
-
-#define PAL_BUS_GET_FEATURES	9
-#define PAL_BUS_SET_FEATURES	10
-#define PAL_DEBUG_INFO		11
-#define PAL_FIXED_ADDR		12
-#define PAL_FREQ_BASE		13
-#define PAL_FREQ_RATIOS		14
-#define PAL_LOGICAL_TO_PHYSICAL	42
-#define PAL_PERF_MON_INFO	15
-#define PAL_PLATFORM_ADDR	16
-#define PAL_PROC_GET_FEATURES	17
-#define PAL_PROC_SET_FEATURES	18
-#define PAL_REGISTER_INFO	39
-#define PAL_RSE_INFO		19
-#define PAL_VERSION		20
-
-#define PAL_MC_CLEAR_LOG	21
-#define PAL_MC_DRAIN		22
-#define PAL_MC_DYNAMIC_STATE	24
-#define PAL_MC_ERROR_INFO	25
-#define PAL_MC_EXPECTED		23
-#define PAL_MC_REGISTER_MEM	27
-#define PAL_MC_RESUME		26
-
-#define PAL_HALT		28
-#define PAL_HALT_INFO		257
-#define PAL_HALT_LIGHT		29
-
-#define PAL_CACHE_LINE_INIT	31
-#define PAL_CACHE_READ		259
-#define PAL_CACHE_WRITE		260
-#define PAL_TEST_INFO		37
-#define PAL_TEST_PROC		258
-
-#define PAL_COPY_INFO		30
-#define PAL_COPY_PAL		256
-#define PAL_ENTER_IA_32_ENV	33
-#define PAL_PMI_ENTRYPOINT	32
-
-/*
- *	Ski PTCE data
- */
-#define PAL_PTCE_INFO_BASE() (0x100000000LL)
-#define PAL_PTCE_INFO_COUNT1() (2)
-#define PAL_PTCE_INFO_COUNT2() (3)
-#define PAL_PTCE_INFO_STRIDE1() (0x10000000)
-#define PAL_PTCE_INFO_STRIDE2() (0x2000)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/proc/task.h
===================================================================
--- kernel/arch/ia64/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_proc
- * @{
- */
-/** @file
- */
-#include <proc/task.h>
-
-#ifndef KERN_ia64_TASK_H_
-#define KERN_ia64_TASK_H_
-
-#include <adt/bitmap.h>
-
-typedef struct {
-	bitmap_t *iomap;
-} task_arch_t;
-
-#define task_create_arch(t) { (t)->arch.iomap = NULL; }
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/proc/thread.h
===================================================================
--- kernel/arch/ia64/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_THREAD_H_
-#define KERN_ia64_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-#define thread_create_arch(t, flags) (EOK)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/register.h
===================================================================
--- kernel/arch/ia64/include/arch/register.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_REGISTER_H_
-#define KERN_ia64_REGISTER_H_
-
-#define DCR_PP_MASK  (1 << 0)
-#define DCR_BE_MASK  (1 << 1)
-#define DCR_LC_MASK  (1 << 2)
-#define DCR_DM_MASK  (1 << 8)
-#define DCR_DP_MASK  (1 << 9)
-#define DCR_DK_MASK  (1 << 10)
-#define DCR_DX_MASK  (1 << 11)
-#define DCR_DR_MASK  (1 << 12)
-#define DCR_DA_MASK  (1 << 13)
-#define DCR_DD_MASK  (1 << 14)
-
-#define CR_IVR_MASK  0x0f
-
-#define PSR_IC_MASK   (1 << 13)
-#define PSR_I_MASK    (1 << 14)
-#define PSR_PK_MASK   (1 << 15)
-#define PSR_DT_MASK   (1 << 17)
-#define PSR_DFL_MASK  (1 << 18)
-#define PSR_DFH_MASK  (1 << 19)
-#define PSR_RT_MASK   (1 << 27)
-#define PSR_IT_MASK   (1 << 36)
-
-#define PSR_CPL_USER   3
-#define PSR_CPL_KERNEL 0
-
-#define PSR_CPL_SHIFT         32
-#define PSR_CPL_MASK_SHIFTED  3
-
-#define PSR_RI_SHIFT  41
-#define PSR_RI_LEN    2
-
-#define PFM_MASK  (~0x3fffffffff)
-
-#define RSC_MODE_MASK   3
-#define RSC_PL_MASK     12
-
-#define FPSR_TRAPS_VD  (1 << 0)
-#define FPSR_TRAPS_DD  (1 << 1)
-#define FPSR_TRAPS_ZD  (1 << 2)
-#define FPSR_TRAPS_OD  (1 << 3)
-#define FPSR_TRAPS_UD  (1 << 4)
-#define FPSR_TRAPS_ID  (1 << 5)
-
-#define FPSR_TRAPS_ALL (FPSR_TRAPS_VD | FPSR_TRAPS_DD | FPSR_TRAPS_ZD | \
-    FPSR_TRAPS_OD | FPSR_TRAPS_UD | FPSR_TRAPS_ID)
-
-#define FPSR_SF1_SHIFT 19
-
-#define FPSR_CTRL_WRE           (1 << 1)
-#define FPSR_CTRL_PC_EXTENDED   (3 << 2)
-#define FPSR_CTRL_RC_NEAREST    (0 << 4)
-#define FPSR_CTRL_TD            (1 << 6)
-
-#define FPSR_SF1_CTRL ((FPSR_CTRL_WRE | FPSR_CTRL_PC_EXTENDED | \
-    FPSR_CTRL_RC_NEAREST | FPSR_CTRL_TD) << FPSR_SF1_SHIFT)
-
-/** Application registers. */
-#define AR_KR0       0
-#define AR_KR1       1
-#define AR_KR2       2
-#define AR_KR3       3
-#define AR_KR4       4
-#define AR_KR5       5
-#define AR_KR6       6
-#define AR_KR7       7
-/* ARs 8-15 are reserved */
-#define AR_RSC       16
-#define AR_BSP       17
-#define AR_BSPSTORE  18
-#define AR_RNAT      19
-/* AR 20 is reserved */
-#define AR_FCR       21
-/* ARs 22-23 are reserved */
-#define AR_EFLAG     24
-#define AR_CSD       25
-#define AR_SSD       26
-#define AR_CFLG      27
-#define AR_FSR       28
-#define AR_FIR       29
-#define AR_FDR       30
-/* AR 31 is reserved */
-#define AR_CCV       32
-/* ARs 33-35 are reserved */
-#define AR_UNAT      36
-/* ARs 37-39 are reserved */
-#define AR_FPSR      40
-/* ARs 41-43 are reserved */
-#define AR_ITC       44
-/* ARs 45-47 are reserved */
-/* ARs 48-63 are ignored */
-#define AR_PFS       64
-#define AR_LC        65
-#define AR_EC        66
-/* ARs 67-111 are reserved */
-/* ARs 112-127 are ignored */
-
-/** Control registers. */
-#define CR_DCR   0
-#define CR_ITM   1
-#define CR_IVA   2
-/* CR3-CR7 are reserved */
-#define CR_PTA   8
-/* CR9-CR15 are reserved */
-#define CR_IPSR  16
-#define CR_ISR   17
-/* CR18 is reserved */
-#define CR_IIP   19
-#define CR_IFA   20
-#define CR_ITIR  21
-#define CR_IIPA  22
-#define CR_IFS   23
-#define CR_IIM   24
-#define CR_IHA   25
-/* CR26-CR63 are reserved */
-#define CR_LID   64
-#define CR_IVR   65
-#define CR_TPR   66
-#define CR_EOI   67
-#define CR_IRR0  68
-#define CR_IRR1  69
-#define CR_IRR2  70
-#define CR_IRR3  71
-#define CR_ITV   72
-#define CR_PMV   73
-#define CR_CMCV  74
-/* CR75-CR79 are reserved */
-#define CR_LRR0  80
-#define CR_LRR1  81
-/* CR82-CR127 are reserved */
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/** Processor Status Register. */
-typedef union {
-	uint64_t value;
-	struct {
-		unsigned int : 1;
-		unsigned int be : 1;   /**< Big-Endian data accesses. */
-		unsigned int up : 1;   /**< User Performance monitor enable. */
-		unsigned int ac : 1;   /**< Alignment Check. */
-		unsigned int mfl : 1;  /**< Lower floating-point register written. */
-		unsigned int mfh : 1;  /**< Upper floating-point register written. */
-		unsigned int : 7;
-		unsigned int ic : 1;   /**< Interruption Collection. */
-		unsigned int i : 1;    /**< Interrupt Bit. */
-		unsigned int pk : 1;   /**< Protection Key enable. */
-		unsigned int : 1;
-		unsigned int dt : 1;   /**< Data address Translation. */
-		unsigned int dfl : 1;  /**< Disabled Floating-point Low register set. */
-		unsigned int dfh : 1;  /**< Disabled Floating-point High register set. */
-		unsigned int sp : 1;   /**< Secure Performance monitors. */
-		unsigned int pp : 1;   /**< Privileged Performance monitor enable. */
-		unsigned int di : 1;   /**< Disable Instruction set transition. */
-		unsigned int si : 1;   /**< Secure Interval timer. */
-		unsigned int db : 1;   /**< Debug Breakpoint fault. */
-		unsigned int lp : 1;   /**< Lower Privilege transfer trap. */
-		unsigned int tb : 1;   /**< Taken Branch trap. */
-		unsigned int rt : 1;   /**< Register Stack Translation. */
-		unsigned int : 4;
-		unsigned int cpl : 2;  /**< Current Privilege Level. */
-		unsigned int is : 1;   /**< Instruction Set. */
-		unsigned int mc : 1;   /**< Machine Check abort mask. */
-		unsigned int it : 1;   /**< Instruction address Translation. */
-		unsigned int id : 1;   /**< Instruction Debug fault disable. */
-		unsigned int da : 1;   /**< Disable Data Access and Dirty-bit faults. */
-		unsigned int dd : 1;   /**< Data Debug fault disable. */
-		unsigned int ss : 1;   /**< Single Step enable. */
-		unsigned int ri : 2;   /**< Restart Instruction. */
-		unsigned int ed : 1;   /**< Exception Deferral. */
-		unsigned int bn : 1;   /**< Register Bank. */
-		unsigned int ia : 1;   /**< Disable Instruction Access-bit faults. */
-	} __attribute__((packed));
-} psr_t;
-
-/** Register Stack Configuration Register */
-typedef union {
-	uint64_t value;
-	struct {
-		unsigned int mode : 2;
-		unsigned int pl : 2;    /**< Privilege Level. */
-		unsigned int be : 1;    /**< Big-endian. */
-		unsigned int : 11;
-		unsigned int loadrs : 14;
-	} __attribute__((packed));
-} rsc_t;
-
-/** External Interrupt Vector Register */
-typedef union {
-	uint8_t vector;
-	uint64_t value;
-} cr_ivr_t;
-
-/** Task Priority Register */
-typedef union {
-	uint64_t value;
-	struct {
-		unsigned int : 4;
-		unsigned int mic : 4;  /**< Mask Interrupt Class. */
-		unsigned int : 8;
-		unsigned int mmi : 1;  /**< Mask Maskable Interrupts. */
-	} __attribute__((packed));
-} cr_tpr_t;
-
-/** Interval Timer Vector */
-typedef union {
-	uint64_t value;
-	struct {
-		unsigned int vector : 8;
-		unsigned int : 4;
-		unsigned int : 1;
-		unsigned int : 3;
-		unsigned int m : 1;       /**< Mask. */
-	} __attribute__((packed));
-} cr_itv_t;
-
-/** Interruption Status Register */
-typedef union {
-	uint64_t value;
-	struct {
-		union {
-			/** General Exception code field structuring. */
-			uint16_t code;
-			struct {
-				unsigned int ge_na : 4;
-				unsigned int ge_code : 4;
-			} __attribute__((packed));
-		};
-		uint8_t vector;
-		unsigned int : 8;
-		unsigned int x : 1;   /**< Execute exception. */
-		unsigned int w : 1;   /**< Write exception. */
-		unsigned int r : 1;   /**< Read exception. */
-		unsigned int na : 1;  /**< Non-access exception. */
-		unsigned int sp : 1;  /**< Speculative load exception. */
-		unsigned int rs : 1;  /**< Register stack. */
-		unsigned int ir : 1;  /**< Incomplete Register frame. */
-		unsigned int ni : 1;  /**< Nested Interruption. */
-		unsigned int so : 1;  /**< IA-32 Supervisor Override. */
-		unsigned int ei : 2;  /**< Excepting Instruction. */
-		unsigned int ed : 1;  /**< Exception Deferral. */
-		unsigned int : 20;
-	} __attribute__((packed));
-} cr_isr_t;
-
-/** CPUID Register 3 */
-typedef union {
-	uint64_t value;
-	struct {
-		uint8_t number;
-		uint8_t revision;
-		uint8_t model;
-		uint8_t family;
-		uint8_t archrev;
-	} __attribute__((packed));
-} cpuid3_t;
-
-#endif /* !__ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/stack.h
===================================================================
--- kernel/arch/ia64/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_STACK_H_
-#define KERN_ia64_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	(STACK_SIZE / 2)
-
-#define STACK_ITEM_SIZE			8
-#define STACK_ALIGNMENT			16
-#define STACK_SCRATCH_AREA_SIZE		16
-#define REGISTER_STACK_ALIGNMENT 	8
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/include/arch/types.h
===================================================================
--- kernel/arch/ia64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia64_TYPES_H_
-#define KERN_ia64_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-	sysarg_t fnc;
-	sysarg_t gp;
-} __attribute__((may_alias)) fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/meson.build
===================================================================
--- kernel/arch/ia64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/start.S',
-	'src/asm.S',
-	'src/dummy.S',
-	'src/ia64.c',
-	'src/fpu_context.c',
-	'src/context.S',
-	'src/cpu/cpu.c',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/ivt.S',
-	'src/interrupt.c',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/mm/vhpt.c',
-	'src/proc/scheduler.c',
-	'src/ddi/ddi.c',
-	'src/smc.c',
-	'src/smp/smp.c',
-	'src/drivers/it.c',
-)
-
-if MACHINE == 'ski'
-	arch_src += files('src/drivers/ski.c')
-endif
-
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/ia64/src/asm.S
===================================================================
--- kernel/arch/ia64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/register.h>
-
-.text
-
-/** Copy memory from/to userspace.
- *
- * This memcpy() has been taken from the assembler output of
- * a plain C implementation of memcpy() modified to have the
- * failover part.
- *
- * @param in0 Destination address.
- * @param in1 Source address.
- * @param in2 Number of byte to copy.
- *
- */
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	alloc loc0 = ar.pfs, 3, 1, 0, 0
-
-	adds r14 = 7, in1
-	mov r2 = ar.lc
-	mov r8 = in0 ;;
-	and r14 = -8, r14 ;;
-	cmp.ne p6, p7 = r14, in1
-	(p7) br.cond.dpnt 3f ;;
-
-	0:
-
-		cmp.ne p6, p7 = 0, in2
-		(p7) br.cond.dpnt 2f ;;
-		(p6) adds r14 = -1, in2
-		(p6) mov r16 = r0
-		(p6) mov r17 = r0 ;;
-		(p6) mov ar.lc = r14
-
-	1:
-
-		add r14 = r16, in1
-		add r15 = r16, in0
-		adds r17 = 1, r17 ;;
-		ld1 r14 = [r14]
-		mov r16 = r17 ;;
-		st1 [r15] = r14
-		br.cloop.sptk.few 1b ;;
-
-	2:
-
-		mov ar.lc = r2
-		mov ar.pfs = loc0
-		br.ret.sptk.many rp
-
-	3:
-
-		adds r14 = 7, in0 ;;
-		and r14 = -8, r14 ;;
-		cmp.eq p6, p7 = r14, in0
-		(p7) br.cond.dptk 0b
-		shr.u r18 = in2, 3 ;;
-		cmp.ne p6, p7 = 0, r18
-		(p7) br.cond.dpnt 5f ;;
-		(p6) adds r14 = -1, r18
-		(p6) mov r16 = r0
-		(p6) mov r17 = r0 ;;
-		(p6) mov ar.lc = r14
-
-	4:
-
-		shladd r14 = r16, 3, r0
-		adds r16 = 1, r17 ;;
-		add r15 = in1, r14
-		add r14 = in0, r14
-		mov r17 = r16 ;;
-		ld8 r15 = [r15] ;;
-		st8 [r14] = r15
-		br.cloop.sptk.few 4b
-
-	5:
-
-		and r15 = 7, in2
-		shladd r14 = r18, 3, r0
-		mov r16 = r0
-		mov r18 = r0 ;;
-		cmp.eq p6, p7 = 0, r15
-		add in0 = r14, in0
-		adds r15 = -1, r15
-		add r17 = r14, in1
-		(p6) br.cond.dpnt 2b ;;
-		mov ar.lc = r15
-
-	6:
-
-		add r14 = r16, r17
-		add r15 = r16, in0
-		adds r16 = 1, r18 ;;
-		ld1 r14 = [r14]
-		mov r18 = r16 ;;
-		st1 [r15] = r14
-		br.cloop.sptk.few 6b ;;
-		mov ar.lc = r2
-		mov ar.pfs = loc0
-		br.ret.sptk.many rp
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	/* Return 0 on failure */
-	mov r8 = r0
-	mov ar.pfs = loc0
-	br.ret.sptk.many rp
-
-FUNCTION_BEGIN(cpu_halt)
-	br cpu_halt
-FUNCTION_END(cpu_halt)
-
-/** Switch to userspace - low level code.
- *
- * @param in0 Userspace entry point address.
- * @param in1 Userspace stack pointer address.
- * @param in2 Userspace register stack pointer address.
- * @param in3 Userspace address of thread uspace_arg_t structure.
- * @param in4 Value to be stored in IPSR.
- * @param in5 Value to be stored in RSC.
- *
- */
-FUNCTION_BEGIN(switch_to_userspace)
-	alloc loc0 = ar.pfs, 6, 3, 0, 0
-
-	/* Disable interruption collection and interrupts */
-	rsm (PSR_IC_MASK | PSR_I_MASK)
-	srlz.d ;;
-	srlz.i ;;
-
-	mov cr.ipsr = in4
-	mov cr.iip = in0
-	mov r12 = in1
-
-	xor r1 = r1, r1
-
-	/* r2 is defined to hold pcb_ptr - set it to 0 */
-	xor r2 = r2, r2
-
-	mov loc1 = cr.ifs
-	movl loc2 = PFM_MASK ;;
-	and loc1 = loc2, loc1 ;;
-	mov cr.ifs = loc1 ;;  /* prevent decrementing BSP by rfi */
-
-	invala
-
-	mov loc1 = ar.rsc ;;
-	and loc1 = ~3, loc1 ;;
-	mov ar.rsc = loc1 ;;  /* put RSE into enforced lazy mode */
-
-	flushrs ;;
-
-	mov ar.bspstore = in2 ;;
-	mov ar.rsc = in5 ;;
-
-	mov r8 = in3
-
-	rfi ;;
-FUNCTION_END(switch_to_userspace)
-
-FUNCTION_BEGIN(early_putuchar)
-	br.ret.sptk.many b0
-FUNCTION_END(early_putuchar)
Index: rnel/arch/ia64/src/context.S
===================================================================
--- kernel/arch/ia64/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,346 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-
-.text
-
-FUNCTION_BEGIN(context_save_arch)
-	alloc loc0 = ar.pfs, 1, 50, 0, 0
-	mov loc1 = ar.unat ;;
-	mov loc3 = ar.rsc
-
-	.auto
-
-	/*
-	 * Flush dirty registers to backing store.
-	 * After this ar.bsp and ar.bspstore are equal.
-	 */
-	flushrs
-	mov loc4 = ar.bsp
-
-	/*
-	 * Put RSE to enforced lazy mode.
-	 * So that ar.rnat can be read.
-	 */
-	and loc5 = ~3, loc3
-	mov ar.rsc = loc5
-	mov loc5 = ar.rnat
-
-	.explicit
-
-	mov loc6 = ar.lc
-	mov loc7 = ar.fpsr
-
-	add loc8 = CONTEXT_OFFSET_AR_PFS, in0
-	add loc9 = CONTEXT_OFFSET_AR_UNAT_CALLER, in0
-	add loc10 = CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
-	add loc11 = CONTEXT_OFFSET_AR_RSC, in0
-	add loc12 = CONTEXT_OFFSET_BSP, in0
-	add loc13 = CONTEXT_OFFSET_AR_RNAT, in0
-	add loc14 = CONTEXT_OFFSET_AR_LC, in0
-	add loc15 = CONTEXT_OFFSET_AR_FPSR, in0
-
-	add loc16 = CONTEXT_OFFSET_R1, in0
-	add loc17 = CONTEXT_OFFSET_R4, in0
-	add loc18 = CONTEXT_OFFSET_R5, in0
-	add loc19 = CONTEXT_OFFSET_R6, in0
-	add loc20 = CONTEXT_OFFSET_R7, in0
-	add loc21 = CONTEXT_OFFSET_SP, in0
-	add loc22 = CONTEXT_OFFSET_R13, in0
-
-	add loc23 = CONTEXT_OFFSET_PC, in0
-	add loc24 = CONTEXT_OFFSET_B1, in0
-	add loc25 = CONTEXT_OFFSET_B2, in0
-	add loc26 = CONTEXT_OFFSET_B3, in0
-	add loc27 = CONTEXT_OFFSET_B4, in0
-	add loc28 = CONTEXT_OFFSET_B5, in0
-
-	add loc29 = CONTEXT_OFFSET_PR, in0
-
-	add loc30 = CONTEXT_OFFSET_F2, in0
-	add loc31 = CONTEXT_OFFSET_F3, in0
-	add loc32 = CONTEXT_OFFSET_F4, in0
-	add loc33 = CONTEXT_OFFSET_F5, in0
-
-	add loc34 = CONTEXT_OFFSET_F16, in0
-	add loc35 = CONTEXT_OFFSET_F17, in0
-	add loc36 = CONTEXT_OFFSET_F18, in0
-	add loc37 = CONTEXT_OFFSET_F19, in0
-	add loc38 = CONTEXT_OFFSET_F20, in0
-	add loc39 = CONTEXT_OFFSET_F21, in0
-	add loc40 = CONTEXT_OFFSET_F22, in0
-	add loc41 = CONTEXT_OFFSET_F23, in0
-	add loc42 = CONTEXT_OFFSET_F24, in0
-	add loc43 = CONTEXT_OFFSET_F25, in0
-	add loc44 = CONTEXT_OFFSET_F26, in0
-	add loc45 = CONTEXT_OFFSET_F27, in0
-	add loc46 = CONTEXT_OFFSET_F28, in0
-	add loc47 = CONTEXT_OFFSET_F29, in0
-	add loc48 = CONTEXT_OFFSET_F30, in0
-	add loc49 = CONTEXT_OFFSET_F31, in0 ;;
-
-	/*
-	 * Save general registers including NaT bits
-	 */
-	st8.spill [loc16] = r1 ;;
-	st8.spill [loc17] = r4 ;;
-	st8.spill [loc18] = r5 ;;
-	st8.spill [loc19] = r6 ;;
-	st8.spill [loc20] = r7 ;;
-	st8.spill [loc21] = r12	;;	/* save sp */
-	st8.spill [loc22] = r13 ;;
-
-	mov loc2 = ar.unat
-
-	/*
-	 * Save application registers
-	 */
-	st8 [loc8] = loc0	/* save ar.pfs */
-	st8 [loc9] = loc1 ;;	/* save ar.unat (caller) */
-	st8 [loc10] = loc2	/* save ar.unat (callee) */
-	st8 [loc11] = loc3	/* save ar.rsc */
-	st8 [loc12] = loc4	/* save ar.bsp */
-	st8 [loc13] = loc5	/* save ar.rnat */
-	st8 [loc14] = loc6	/* save ar.lc */
-	st8 [loc15] = loc7 ;;	/* save ar.fpsr */
-
-	/*
-	 * Save branch registers
-	 */
-	mov loc2 = b0
-	mov loc3 = b1
-	mov loc4 = b2
-	mov loc5 = b3
-	mov loc6 = b4
-	mov loc7 = b5 ;;
-	st8 [loc23] = loc2	/* save pc */
-	st8 [loc24] = loc3
-	st8 [loc25] = loc4
-	st8 [loc26] = loc5
-	st8 [loc27] = loc6
-	st8 [loc28] = loc7 ;;
-
-	/*
-	 * Save predicate registers
-	 */
-	mov loc2 = pr ;;
-	st8 [loc29] = loc2
-
-	/*
-	 * Save floating-point registers.
-	 */
-	stf.spill [loc30] = f2
-	stf.spill [loc31] = f3
-	stf.spill [loc32] = f4
-	stf.spill [loc33] = f5
-
-	stf.spill [loc34] = f16
-	stf.spill [loc35] = f17
-	stf.spill [loc36] = f18
-	stf.spill [loc37] = f19
-	stf.spill [loc38] = f20
-	stf.spill [loc39] = f21
-	stf.spill [loc40] = f22
-	stf.spill [loc41] = f23
-	stf.spill [loc42] = f24
-	stf.spill [loc43] = f25
-	stf.spill [loc44] = f26
-	stf.spill [loc45] = f27
-	stf.spill [loc46] = f28
-	stf.spill [loc47] = f29
-	stf.spill [loc48] = f30
-	stf.spill [loc49] = f31
-
-	mov ar.unat = loc1
-
-	add r8 = r0, r0, 1 	/* context_save returns 1 */
-	br.ret.sptk.many b0
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	alloc loc0 = ar.pfs, 1, 51, 0, 0 ;;
-
-	add loc9 = CONTEXT_OFFSET_AR_PFS, in0
-	add loc10 = CONTEXT_OFFSET_AR_UNAT_CALLER, in0
-	add loc11 = CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
-	add loc12 = CONTEXT_OFFSET_AR_RSC, in0
-	add loc13 = CONTEXT_OFFSET_BSP, in0
-	add loc14 = CONTEXT_OFFSET_AR_RNAT, in0
-	add loc15 = CONTEXT_OFFSET_AR_LC, in0
-	add loc16 = CONTEXT_OFFSET_AR_FPSR, in0
-
-	add loc17 = CONTEXT_OFFSET_R1, in0
-	add loc18 = CONTEXT_OFFSET_R4, in0
-	add loc19 = CONTEXT_OFFSET_R5, in0
-	add loc20 = CONTEXT_OFFSET_R6, in0
-	add loc21 = CONTEXT_OFFSET_R7, in0
-	add loc22 = CONTEXT_OFFSET_SP, in0
-	add loc23 = CONTEXT_OFFSET_R13, in0
-
-	add loc24 = CONTEXT_OFFSET_PC, in0
-	add loc25 = CONTEXT_OFFSET_B1, in0
-	add loc26 = CONTEXT_OFFSET_B2, in0
-	add loc27 = CONTEXT_OFFSET_B3, in0
-	add loc28 = CONTEXT_OFFSET_B4, in0
-	add loc29 = CONTEXT_OFFSET_B5, in0
-
-	add loc30 = CONTEXT_OFFSET_PR, in0
-
-	add loc31 = CONTEXT_OFFSET_F2, in0
-	add loc32 = CONTEXT_OFFSET_F3, in0
-	add loc33 = CONTEXT_OFFSET_F4, in0
-	add loc34 = CONTEXT_OFFSET_F5, in0
-
-	add loc35 = CONTEXT_OFFSET_F16, in0
-	add loc36 = CONTEXT_OFFSET_F17, in0
-	add loc37 = CONTEXT_OFFSET_F18, in0
-	add loc38 = CONTEXT_OFFSET_F19, in0
-	add loc39 = CONTEXT_OFFSET_F20, in0
-	add loc40 = CONTEXT_OFFSET_F21, in0
-	add loc41 = CONTEXT_OFFSET_F22, in0
-	add loc42 = CONTEXT_OFFSET_F23, in0
-	add loc43 = CONTEXT_OFFSET_F24, in0
-	add loc44 = CONTEXT_OFFSET_F25, in0
-	add loc45 = CONTEXT_OFFSET_F26, in0
-	add loc46 = CONTEXT_OFFSET_F27, in0
-	add loc47 = CONTEXT_OFFSET_F28, in0
-	add loc48 = CONTEXT_OFFSET_F29, in0
-	add loc49 = CONTEXT_OFFSET_F30, in0
-	add loc50 = CONTEXT_OFFSET_F31, in0 ;;
-
-	ld8 loc0 = [loc9]	/* load ar.pfs */
-	ld8 loc1 = [loc10]	/* load ar.unat (caller) */
-	ld8 loc2 = [loc11]	/* load ar.unat (callee) */
-	ld8 loc3 = [loc12]	/* load ar.rsc */
-	ld8 loc4 = [loc13]	/* load ar.bsp */
-	ld8 loc5 = [loc14]	/* load ar.rnat */
-	ld8 loc6 = [loc15]	/* load ar.lc */
-	ld8 loc7 = [loc16]	/* load ar.fpsr */
-
-	.auto
-
-	/*
-	 * Invalidate the ALAT
-	 */
-	invala
-
-	/*
-	 * Put RSE to enforced lazy mode.
-	 * So that ar.bspstore and ar.rnat can be written.
-	 */
-	movl loc8 = ~3
-	and loc8 = loc3, loc8
-	mov ar.rsc = loc8
-
-	/*
-	 * Flush dirty registers to backing store.
-	 * We do this because we want the following move
-	 * to ar.bspstore to assign the same value to ar.bsp.
-	 */
-	flushrs
-
-	/*
-	 * Restore application registers
-	 */
-	mov ar.bspstore = loc4	/* rse.bspload = ar.bsp = ar.bspstore = loc4 */
-	mov ar.rnat = loc5
-	mov ar.pfs = loc0
-	mov ar.rsc = loc3
-	mov ar.fpsr = loc7
-
-	.explicit
-
-	mov ar.unat = loc2 ;;
-	mov ar.lc = loc6
-
-	/*
-	 * Restore general registers including NaT bits
-	 */
-	ld8.fill r1 = [loc17] ;;
-	ld8.fill r4 = [loc18] ;;
-	ld8.fill r5 = [loc19] ;;
-	ld8.fill r6 = [loc20] ;;
-	ld8.fill r7 = [loc21] ;;
-	ld8.fill r12 = [loc22] ;;	/* restore sp */
-	ld8.fill r13 = [loc23] ;;
-
-	/*
-	 * Restore branch registers
-	 */
-	ld8 loc2 = [loc24]		/* restore pc */
-	ld8 loc3 = [loc25]
-	ld8 loc4 = [loc26]
-	ld8 loc5 = [loc27]
-	ld8 loc6 = [loc28]
-	ld8 loc7 = [loc29] ;;
-	mov b0 = loc2
-	mov b1 = loc3
-	mov b2 = loc4
-	mov b3 = loc5
-	mov b4 = loc6
-	mov b5 = loc7 ;;
-
-	/*
-	 * Restore predicate registers
-	 */
-	ld8 loc2 = [loc30] ;;
-	mov pr = loc2, ~0
-
-	/*
-	 * Restore floating-point registers.
-	 */
-	ldf.fill f2 = [loc31]
-	ldf.fill f3 = [loc32]
-	ldf.fill f4 = [loc33]
-	ldf.fill f5 = [loc34]
-
-	ldf.fill f16 = [loc35]
-	ldf.fill f17 = [loc36]
-	ldf.fill f18 = [loc37]
-	ldf.fill f19 = [loc38]
-	ldf.fill f20 = [loc39]
-	ldf.fill f21 = [loc40]
-	ldf.fill f22 = [loc41]
-	ldf.fill f23 = [loc42]
-	ldf.fill f24 = [loc43]
-	ldf.fill f25 = [loc44]
-	ldf.fill f26 = [loc45]
-	ldf.fill f27 = [loc46]
-	ldf.fill f28 = [loc47]
-	ldf.fill f29 = [loc48]
-	ldf.fill f30 = [loc49]
-	ldf.fill f31 = [loc50]
-
-	mov ar.unat = loc1
-
-	mov r8 = r0			/* context_restore returns 0 */
-	br.ret.sptk.many b0
-FUNCTION_END(context_restore_arch)
-
Index: rnel/arch/ia64/src/cpu/cpu.c
===================================================================
--- kernel/arch/ia64/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#include <cpu.h>
-#include <arch.h>
-#include <arch/register.h>
-#include <stdio.h>
-#include <memw.h>
-
-void cpu_arch_init(void)
-{
-}
-
-void cpu_identify(void)
-{
-	CPU->arch.cpuid0 = cpuid_read(0);
-	CPU->arch.cpuid1 = cpuid_read(1);
-	CPU->arch.cpuid3.value = cpuid_read(3);
-}
-
-void cpu_print_report(cpu_t *m)
-{
-	const char *family_str;
-	char vendor[2 * sizeof(uint64_t) + 1];
-
-	memcpy(vendor, &CPU->arch.cpuid0, 8);
-	memcpy(vendor + 8, &CPU->arch.cpuid1, 8);
-	vendor[sizeof(vendor) - 1] = 0;
-
-	switch (m->arch.cpuid3.family) {
-	case FAMILY_ITANIUM:
-		family_str = "Itanium";
-		break;
-	case FAMILY_ITANIUM2:
-		family_str = "Itanium 2";
-		break;
-	default:
-		family_str = "Unknown";
-		break;
-	}
-
-	printf("cpu%d: %s (%s), archrev=%d, model=%d, revision=%d\n", CPU->id,
-	    family_str, vendor, CPU->arch.cpuid3.archrev,
-	    CPU->arch.cpuid3.model, CPU->arch.cpuid3.revision);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/ddi/ddi.c
===================================================================
--- kernel/arch/ia64/src/ddi/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2008 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_ddi
- * @{
- */
-/** @file
- */
-
-#include <ddi/ddi.h>
-#include <proc/task.h>
-#include <typedefs.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#define IO_MEMMAP_PAGES	16384
-#define PORTS_PER_PAGE	4
-
-/** Enable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task	 Task.
- * @param ioaddr Starting I/O space address.
- * @param size	 Size of the enabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	if (!task->arch.iomap) {
-		task->arch.iomap = malloc(sizeof(bitmap_t));
-		if (task->arch.iomap == NULL)
-			return ENOMEM;
-
-		void *store = malloc(bitmap_size(IO_MEMMAP_PAGES));
-		if (store == NULL)
-			return ENOMEM;
-
-		bitmap_initialize(task->arch.iomap, IO_MEMMAP_PAGES, store);
-		bitmap_clear_range(task->arch.iomap, 0, IO_MEMMAP_PAGES);
-	}
-
-	uintptr_t iopage = ioaddr / PORTS_PER_PAGE;
-	size = ALIGN_UP(size + ioaddr - 4 * iopage, PORTS_PER_PAGE);
-	bitmap_set_range(task->arch.iomap, iopage, size / 4);
-
-	return EOK;
-}
-
-/** Disable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task	 Task.
- * @param ioaddr Starting I/O space address.
- * @param size	 Size of the disabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	if (!task->arch.iomap)
-		return EINVAL;
-
-	uintptr_t iopage = ioaddr / PORTS_PER_PAGE;
-	size = ALIGN_UP(size + ioaddr - 4 * iopage, PORTS_PER_PAGE);
-	bitmap_clear_range(task->arch.iomap, iopage, size / 4);
-
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/ia64/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return false;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return false;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return false;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return false;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return false;
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return false;
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/ia64/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	mov r8 = r0
-	br.ret.sptk.many b0
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	mov r8 = r0
-	br.ret.sptk.many b0
-FUNCTION_END(program_counter_get)
Index: rnel/arch/ia64/src/drivers/it.c
===================================================================
--- kernel/arch/ia64/src/drivers/it.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-/** Interval Timer driver. */
-
-#include <arch/drivers/it.h>
-#include <arch/interrupt.h>
-#include <arch/register.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <time/clock.h>
-#include <ddi/irq.h>
-#include <arch.h>
-
-#define IT_SERVICE_CLOCKS  64
-
-#define FREQ_NUMERATOR_SHIFT  32
-#define FREQ_NUMERATOR_MASK   0xffffffff00000000ULL
-
-#define FREQ_DENOMINATOR_SHIFT  0
-#define FREQ_DENOMINATOR_MASK   0xffffffffULL
-
-uint64_t it_delta;
-
-static irq_t it_irq;
-
-static irq_ownership_t it_claim(irq_t *);
-static void it_interrupt(irq_t *);
-
-/** Initialize Interval Timer. */
-void it_init(void)
-{
-	if (config.cpu_active == 1) {
-		irq_initialize(&it_irq);
-		it_irq.inr = INTERRUPT_TIMER;
-		it_irq.claim = it_claim;
-		it_irq.handler = it_interrupt;
-		irq_register(&it_irq);
-
-		uint64_t base_freq;
-		base_freq  = ((bootinfo->freq_scale) & FREQ_NUMERATOR_MASK) >>
-		    FREQ_NUMERATOR_SHIFT;
-		base_freq *= bootinfo->sys_freq;
-		base_freq /= ((bootinfo->freq_scale) & FREQ_DENOMINATOR_MASK) >>
-		    FREQ_DENOMINATOR_SHIFT;
-
-		it_delta = base_freq / HZ;
-	}
-
-	/* Initialize Interval Timer external interrupt vector */
-	cr_itv_t itv;
-
-	itv.value = itv_read();
-	itv.vector = INTERRUPT_TIMER;
-	itv.m = 0;
-	itv_write(itv.value);
-
-	/* Set Interval Timer Counter to zero */
-	itc_write(0);
-
-	/* Generate first Interval Timer interrupt in IT_DELTA ticks */
-	itm_write(IT_DELTA);
-
-	/* Propagate changes */
-	srlz_d();
-}
-
-/** Always claim ownership for this IRQ.
- *
- * Other devices are responsible to avoid using INR 0.
- *
- * @return Always IRQ_ACCEPT.
- *
- */
-irq_ownership_t it_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-/** Process Interval Timer interrupt. */
-void it_interrupt(irq_t *irq)
-{
-	eoi_write(EOI);
-
-	int64_t itm = itm_read();
-
-	while (true) {
-		int64_t itc = itc_read();
-		itc += IT_SERVICE_CLOCKS;
-
-		itm += IT_DELTA;
-		if (itm - itc < 0)
-			CPU_LOCAL->missed_clock_ticks++;
-		else
-			break;
-	}
-
-	itm_write(itm);
-	srlz_d();  /* Propagate changes */
-
-	/*
-	 * We are holding a lock which prevents preemption.
-	 * Release the lock, call clock() and reacquire the lock again.
-	 */
-	irq_spinlock_unlock(&irq->lock, false);
-	clock();
-	irq_spinlock_lock(&irq->lock, false);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/drivers/ski.c
===================================================================
--- kernel/arch/ia64/src/drivers/ski.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,269 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#include <arch/drivers/ski.h>
-#include <assert.h>
-#include <console/console.h>
-#include <console/chardev.h>
-#include <ddi/ddi.h>
-#include <sysinfo/sysinfo.h>
-#include <stdint.h>
-#include <proc/thread.h>
-#include <synch/spinlock.h>
-#include <arch/asm.h>
-#include <arch/drivers/kbd.h>
-#include <str.h>
-#include <arch.h>
-#include <stdlib.h>
-
-enum {
-	/** Interval between polling in microseconds */
-	POLL_INTERVAL = 10000,  /* 0.01 s */
-
-	/** Max. number of characters to pull out at a time */
-	POLL_LIMIT = 30,
-
-	SKI_INIT_CONSOLE = 20,
-	SKI_GETCHAR      = 21,
-	SKI_PUTCHAR      = 31
-};
-
-static void ski_write(outdev_t *, const char *, size_t);
-
-static outdev_operations_t skidev_ops = {
-	.write = ski_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-static ski_instance_t *instance = NULL;
-static parea_t ski_parea;
-
-/** Ask debug console if a key was pressed.
- *
- * Use SSC (Simulator System Call) to
- * get character from debug console.
- *
- * This call is non-blocking.
- *
- * @return ASCII code of pressed key or 0 if no key pressed.
- *
- */
-static char32_t ski_getchar(void)
-{
-	uint64_t ch;
-
-	asm volatile (
-	    "mov r15 = %1\n"
-	    "break 0x80000;;\n"  /* modifies r8 */
-	    "mov %0 = r8;;\n"
-
-	    : "=r" (ch)
-	    : "i" (SKI_GETCHAR)
-	    : "r15", "r8"
-	);
-
-	return (char32_t) ch;
-}
-
-/** Ask keyboard if a key was pressed.
- *
- * If so, it will repeat and pull up to POLL_LIMIT characters.
- */
-static void poll_keyboard(ski_instance_t *instance)
-{
-	int count = POLL_LIMIT;
-
-	if (ski_parea.mapped && !console_override)
-		return;
-
-	while (count > 0) {
-		char32_t ch = ski_getchar();
-
-		if (ch == '\0')
-			break;
-
-		indev_push_character(instance->srlnin, ch);
-		--count;
-	}
-}
-
-/** Kernel thread for polling keyboard. */
-static void kskipoll(void *arg)
-{
-	ski_instance_t *instance = (ski_instance_t *) arg;
-
-	while (true) {
-		poll_keyboard(instance);
-		thread_usleep(POLL_INTERVAL);
-	}
-}
-
-/** Initialize debug console
- *
- * Issue SSC (Simulator System Call) to
- * to open debug console.
- *
- */
-static void ski_init(void)
-{
-	uintptr_t faddr;
-
-	if (instance)
-		return;
-
-	asm volatile (
-	    "mov r15 = %0\n"
-	    "break 0x80000\n"
-	    :
-	    : "i" (SKI_INIT_CONSOLE)
-	    : "r15", "r8"
-	);
-
-	faddr = frame_alloc(1, FRAME_LOWMEM | FRAME_ATOMIC, 0);
-	if (faddr == 0)
-		panic("Cannot allocate page for ski console.");
-
-	ddi_parea_init(&ski_parea);
-	ski_parea.pbase = faddr;
-	ski_parea.frames = 1;
-	ski_parea.unpriv = false;
-	ski_parea.mapped = false;
-	ddi_parea_register(&ski_parea);
-
-	sysinfo_set_item_val("ski.paddr", NULL, (sysarg_t) faddr);
-
-	instance = malloc(sizeof(ski_instance_t));
-
-	if (instance) {
-		instance->thread = thread_create(kskipoll, instance, TASK,
-		    THREAD_FLAG_UNCOUNTED, "kskipoll");
-
-		if (!instance->thread) {
-			free(instance);
-			instance = NULL;
-			return;
-		}
-
-		instance->srlnin = NULL;
-	}
-}
-
-static void ski_do_putchar(uint8_t ch)
-{
-	asm volatile (
-	    "mov r15 = %[cmd]\n"
-	    "mov r32 = %[ch]\n"   /* r32 is in0 */
-	    "break 0x80000\n"     /* modifies r8 */
-	    :
-	    : [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch)
-	    : "r15", "in0", "r8"
-	);
-}
-
-/** Display character on debug console
- *
- * Use SSC (Simulator System Call) to
- * display character on debug console.
- *
- * @param dev    Character device.
- * @param ch     Character to be printed.
- *
- */
-static void ski_write(outdev_t *dev, const char *s, size_t n)
-{
-	/* If the userspace owns the console, do not output anything. */
-	if (ski_parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			ski_do_putchar('\r');
-
-		ski_do_putchar((uint8_t) *s);
-	}
-}
-
-outdev_t *skiout_init(void)
-{
-	ski_init();
-	if (!instance)
-		return NULL;
-
-	outdev_t *skidev = malloc(sizeof(outdev_t));
-	if (!skidev)
-		return NULL;
-
-	outdev_initialize("skidev", skidev, &skidev_ops);
-	skidev->data = instance;
-
-	if (!fb_exported) {
-		/*
-		 * This is the necessary evil until
-		 * the userspace driver is entirely
-		 * self-sufficient.
-		 */
-		sysinfo_set_item_val("fb", NULL, true);
-		sysinfo_set_item_val("fb.kind", NULL, 6);
-
-		fb_exported = true;
-	}
-
-	return skidev;
-}
-
-ski_instance_t *skiin_init(void)
-{
-	ski_init();
-	return instance;
-}
-
-void skiin_wire(ski_instance_t *instance, indev_t *srlnin)
-{
-	assert(instance);
-	assert(srlnin);
-
-	instance->srlnin = srlnin;
-	thread_start(instance->thread);
-
-	sysinfo_set_item_val("kbd", NULL, true);
-	sysinfo_set_item_val("kbd.type", NULL, KBD_SKI);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/dummy.S
===================================================================
--- kernel/arch/ia64/src/dummy.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(calibrate_delay_loop)
-FUNCTION_BEGIN(asm_delay_loop)
-FUNCTION_BEGIN(cpu_sleep)
-	br.ret.sptk.many b0
-FUNCTION_END(calibrate_delay_loop)
-FUNCTION_END(asm_delay_loop)
-FUNCTION_END(cpu_sleep)
-
Index: rnel/arch/ia64/src/fpu_context.c
===================================================================
--- kernel/arch/ia64/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,639 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- *
- */
-
-#include <fpu_context.h>
-#include <arch/register.h>
-
-void fpu_context_save(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "stf.spill %[f32] = f32\n"
-	    "stf.spill %[f33] = f33\n"
-	    "stf.spill %[f34] = f34\n"
-	    "stf.spill %[f35] = f35\n"
-	    "stf.spill %[f36] = f36\n"
-	    "stf.spill %[f37] = f37\n"
-	    "stf.spill %[f38] = f38\n"
-	    "stf.spill %[f39] = f39\n"
-	    "stf.spill %[f40] = f40\n"
-	    "stf.spill %[f41] = f41\n"
-	    "stf.spill %[f42] = f42\n"
-	    "stf.spill %[f43] = f43\n"
-	    "stf.spill %[f44] = f44\n"
-	    "stf.spill %[f45] = f45\n"
-	    "stf.spill %[f46] = f46\n"
-	    "stf.spill %[f47] = f47\n"
-	    "stf.spill %[f48] = f48\n"
-	    "stf.spill %[f49] = f49\n"
-	    "stf.spill %[f50] = f50\n"
-	    "stf.spill %[f51] = f51\n"
-	    "stf.spill %[f52] = f52\n"
-	    "stf.spill %[f53] = f53\n"
-	    "stf.spill %[f54] = f54\n"
-	    "stf.spill %[f55] = f55\n"
-	    "stf.spill %[f56] = f56\n"
-	    "stf.spill %[f57] = f57\n"
-	    "stf.spill %[f58] = f58\n"
-	    "stf.spill %[f59] = f59\n"
-	    "stf.spill %[f60] = f60\n"
-	    "stf.spill %[f61] = f61\n"
-	    :
-	      [f32] "=m" (fctx->fr[0]),
-	      [f33] "=m" (fctx->fr[1]),
-	      [f34] "=m" (fctx->fr[2]),
-	      [f35] "=m" (fctx->fr[3]),
-	      [f36] "=m" (fctx->fr[4]),
-	      [f37] "=m" (fctx->fr[5]),
-	      [f38] "=m" (fctx->fr[6]),
-	      [f39] "=m" (fctx->fr[7]),
-	      [f40] "=m" (fctx->fr[8]),
-	      [f41] "=m" (fctx->fr[9]),
-	      [f42] "=m" (fctx->fr[10]),
-	      [f43] "=m" (fctx->fr[11]),
-	      [f44] "=m" (fctx->fr[12]),
-	      [f45] "=m" (fctx->fr[13]),
-	      [f46] "=m" (fctx->fr[14]),
-	      [f47] "=m" (fctx->fr[15]),
-	      [f48] "=m" (fctx->fr[16]),
-	      [f49] "=m" (fctx->fr[17]),
-	      [f50] "=m" (fctx->fr[18]),
-	      [f51] "=m" (fctx->fr[19]),
-	      [f52] "=m" (fctx->fr[20]),
-	      [f53] "=m" (fctx->fr[21]),
-	      [f54] "=m" (fctx->fr[22]),
-	      [f55] "=m" (fctx->fr[23]),
-	      [f56] "=m" (fctx->fr[24]),
-	      [f57] "=m" (fctx->fr[25]),
-	      [f58] "=m" (fctx->fr[26]),
-	      [f59] "=m" (fctx->fr[27]),
-	      [f60] "=m" (fctx->fr[28]),
-	      [f61] "=m" (fctx->fr[29])
-	);
-
-	asm volatile (
-	    "stf.spill %[f62] = f62\n"
-	    "stf.spill %[f63] = f63\n"
-	    "stf.spill %[f64] = f64\n"
-	    "stf.spill %[f65] = f65\n"
-	    "stf.spill %[f66] = f66\n"
-	    "stf.spill %[f67] = f67\n"
-	    "stf.spill %[f68] = f68\n"
-	    "stf.spill %[f69] = f69\n"
-	    "stf.spill %[f70] = f70\n"
-	    "stf.spill %[f71] = f71\n"
-	    "stf.spill %[f72] = f72\n"
-	    "stf.spill %[f73] = f73\n"
-	    "stf.spill %[f74] = f74\n"
-	    "stf.spill %[f75] = f75\n"
-	    "stf.spill %[f76] = f76\n"
-	    "stf.spill %[f77] = f77\n"
-	    "stf.spill %[f78] = f78\n"
-	    "stf.spill %[f79] = f79\n"
-	    "stf.spill %[f80] = f80\n"
-	    "stf.spill %[f81] = f81\n"
-	    "stf.spill %[f82] = f82\n"
-	    "stf.spill %[f83] = f83\n"
-	    "stf.spill %[f84] = f84\n"
-	    "stf.spill %[f85] = f85\n"
-	    "stf.spill %[f86] = f86\n"
-	    "stf.spill %[f87] = f87\n"
-	    "stf.spill %[f88] = f88\n"
-	    "stf.spill %[f89] = f89\n"
-	    "stf.spill %[f90] = f90\n"
-	    "stf.spill %[f91] = f91\n"
-	    :
-	      [f62] "=m" (fctx->fr[30]),
-	      [f63] "=m" (fctx->fr[31]),
-	      [f64] "=m" (fctx->fr[32]),
-	      [f65] "=m" (fctx->fr[33]),
-	      [f66] "=m" (fctx->fr[34]),
-	      [f67] "=m" (fctx->fr[35]),
-	      [f68] "=m" (fctx->fr[36]),
-	      [f69] "=m" (fctx->fr[37]),
-	      [f70] "=m" (fctx->fr[38]),
-	      [f71] "=m" (fctx->fr[39]),
-	      [f72] "=m" (fctx->fr[40]),
-	      [f73] "=m" (fctx->fr[41]),
-	      [f74] "=m" (fctx->fr[42]),
-	      [f75] "=m" (fctx->fr[43]),
-	      [f76] "=m" (fctx->fr[44]),
-	      [f77] "=m" (fctx->fr[45]),
-	      [f78] "=m" (fctx->fr[46]),
-	      [f79] "=m" (fctx->fr[47]),
-	      [f80] "=m" (fctx->fr[48]),
-	      [f81] "=m" (fctx->fr[49]),
-	      [f82] "=m" (fctx->fr[50]),
-	      [f83] "=m" (fctx->fr[51]),
-	      [f84] "=m" (fctx->fr[52]),
-	      [f85] "=m" (fctx->fr[53]),
-	      [f86] "=m" (fctx->fr[54]),
-	      [f87] "=m" (fctx->fr[55]),
-	      [f88] "=m" (fctx->fr[56]),
-	      [f89] "=m" (fctx->fr[57]),
-	      [f90] "=m" (fctx->fr[58]),
-	      [f91] "=m" (fctx->fr[59])
-	);
-
-	asm volatile (
-	    "stf.spill %[f92] = f92\n"
-	    "stf.spill %[f93] = f93\n"
-	    "stf.spill %[f94] = f94\n"
-	    "stf.spill %[f95] = f95\n"
-	    "stf.spill %[f96] = f96\n"
-	    "stf.spill %[f97] = f97\n"
-	    "stf.spill %[f98] = f98\n"
-	    "stf.spill %[f99] = f99\n"
-	    "stf.spill %[f100] = f100\n"
-	    "stf.spill %[f101] = f101\n"
-	    "stf.spill %[f102] = f102\n"
-	    "stf.spill %[f103] = f103\n"
-	    "stf.spill %[f104] = f104\n"
-	    "stf.spill %[f105] = f105\n"
-	    "stf.spill %[f106] = f106\n"
-	    "stf.spill %[f107] = f107\n"
-	    "stf.spill %[f108] = f108\n"
-	    "stf.spill %[f109] = f109\n"
-	    "stf.spill %[f110] = f110\n"
-	    "stf.spill %[f111] = f111\n"
-	    "stf.spill %[f112] = f112\n"
-	    "stf.spill %[f113] = f113\n"
-	    "stf.spill %[f114] = f114\n"
-	    "stf.spill %[f115] = f115\n"
-	    "stf.spill %[f116] = f116\n"
-	    "stf.spill %[f117] = f117\n"
-	    "stf.spill %[f118] = f118\n"
-	    "stf.spill %[f119] = f119\n"
-	    "stf.spill %[f120] = f120\n"
-	    "stf.spill %[f121] = f121\n"
-	    :
-	      [f92] "=m" (fctx->fr[60]),
-	      [f93] "=m" (fctx->fr[61]),
-	      [f94] "=m" (fctx->fr[62]),
-	      [f95] "=m" (fctx->fr[63]),
-	      [f96] "=m" (fctx->fr[64]),
-	      [f97] "=m" (fctx->fr[65]),
-	      [f98] "=m" (fctx->fr[66]),
-	      [f99] "=m" (fctx->fr[67]),
-	      [f100] "=m" (fctx->fr[68]),
-	      [f101] "=m" (fctx->fr[69]),
-	      [f102] "=m" (fctx->fr[70]),
-	      [f103] "=m" (fctx->fr[71]),
-	      [f104] "=m" (fctx->fr[72]),
-	      [f105] "=m" (fctx->fr[73]),
-	      [f106] "=m" (fctx->fr[74]),
-	      [f107] "=m" (fctx->fr[75]),
-	      [f108] "=m" (fctx->fr[76]),
-	      [f109] "=m" (fctx->fr[77]),
-	      [f110] "=m" (fctx->fr[78]),
-	      [f111] "=m" (fctx->fr[79]),
-	      [f112] "=m" (fctx->fr[80]),
-	      [f113] "=m" (fctx->fr[81]),
-	      [f114] "=m" (fctx->fr[82]),
-	      [f115] "=m" (fctx->fr[83]),
-	      [f116] "=m" (fctx->fr[84]),
-	      [f117] "=m" (fctx->fr[85]),
-	      [f118] "=m" (fctx->fr[86]),
-	      [f119] "=m" (fctx->fr[87]),
-	      [f120] "=m" (fctx->fr[88]),
-	      [f121] "=m" (fctx->fr[89])
-	);
-
-	asm volatile (
-	    "stf.spill %[f122] = f122\n"
-	    "stf.spill %[f123] = f123\n"
-	    "stf.spill %[f124] = f124\n"
-	    "stf.spill %[f125] = f125\n"
-	    "stf.spill %[f126] = f126\n"
-	    "stf.spill %[f127] = f127\n"
-	    :
-	      [f122] "=m" (fctx->fr[90]),
-	      [f123] "=m" (fctx->fr[91]),
-	      [f124] "=m" (fctx->fr[92]),
-	      [f125] "=m" (fctx->fr[93]),
-	      [f126] "=m" (fctx->fr[94]),
-	      [f127] "=m" (fctx->fr[95])
-	);
-}
-
-void fpu_context_restore(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "ldf.fill f32 = %[f32]\n"
-	    "ldf.fill f33 = %[f33]\n"
-	    "ldf.fill f34 = %[f34]\n"
-	    "ldf.fill f35 = %[f35]\n"
-	    "ldf.fill f36 = %[f36]\n"
-	    "ldf.fill f37 = %[f37]\n"
-	    "ldf.fill f38 = %[f38]\n"
-	    "ldf.fill f39 = %[f39]\n"
-	    "ldf.fill f40 = %[f40]\n"
-	    "ldf.fill f41 = %[f41]\n"
-	    "ldf.fill f42 = %[f42]\n"
-	    "ldf.fill f43 = %[f43]\n"
-	    "ldf.fill f44 = %[f44]\n"
-	    "ldf.fill f45 = %[f45]\n"
-	    "ldf.fill f46 = %[f46]\n"
-	    "ldf.fill f47 = %[f47]\n"
-	    "ldf.fill f48 = %[f48]\n"
-	    "ldf.fill f49 = %[f49]\n"
-	    "ldf.fill f50 = %[f50]\n"
-	    "ldf.fill f51 = %[f51]\n"
-	    "ldf.fill f52 = %[f52]\n"
-	    "ldf.fill f53 = %[f53]\n"
-	    "ldf.fill f54 = %[f54]\n"
-	    "ldf.fill f55 = %[f55]\n"
-	    "ldf.fill f56 = %[f56]\n"
-	    "ldf.fill f57 = %[f57]\n"
-	    "ldf.fill f58 = %[f58]\n"
-	    "ldf.fill f59 = %[f59]\n"
-	    "ldf.fill f60 = %[f60]\n"
-	    "ldf.fill f61 = %[f61]\n"
-	    ::
-	      [f32] "m" (fctx->fr[0]),
-	      [f33] "m" (fctx->fr[1]),
-	      [f34] "m" (fctx->fr[2]),
-	      [f35] "m" (fctx->fr[3]),
-	      [f36] "m" (fctx->fr[4]),
-	      [f37] "m" (fctx->fr[5]),
-	      [f38] "m" (fctx->fr[6]),
-	      [f39] "m" (fctx->fr[7]),
-	      [f40] "m" (fctx->fr[8]),
-	      [f41] "m" (fctx->fr[9]),
-	      [f42] "m" (fctx->fr[10]),
-	      [f43] "m" (fctx->fr[11]),
-	      [f44] "m" (fctx->fr[12]),
-	      [f45] "m" (fctx->fr[13]),
-	      [f46] "m" (fctx->fr[14]),
-	      [f47] "m" (fctx->fr[15]),
-	      [f48] "m" (fctx->fr[16]),
-	      [f49] "m" (fctx->fr[17]),
-	      [f50] "m" (fctx->fr[18]),
-	      [f51] "m" (fctx->fr[19]),
-	      [f52] "m" (fctx->fr[20]),
-	      [f53] "m" (fctx->fr[21]),
-	      [f54] "m" (fctx->fr[22]),
-	      [f55] "m" (fctx->fr[23]),
-	      [f56] "m" (fctx->fr[24]),
-	      [f57] "m" (fctx->fr[25]),
-	      [f58] "m" (fctx->fr[26]),
-	      [f59] "m" (fctx->fr[27]),
-	      [f60] "m" (fctx->fr[28]),
-	      [f61] "m" (fctx->fr[29])
-	);
-
-	asm volatile (
-	    "ldf.fill f62 = %[f62]\n"
-	    "ldf.fill f63 = %[f63]\n"
-	    "ldf.fill f64 = %[f64]\n"
-	    "ldf.fill f65 = %[f65]\n"
-	    "ldf.fill f66 = %[f66]\n"
-	    "ldf.fill f67 = %[f67]\n"
-	    "ldf.fill f68 = %[f68]\n"
-	    "ldf.fill f69 = %[f69]\n"
-	    "ldf.fill f70 = %[f70]\n"
-	    "ldf.fill f71 = %[f71]\n"
-	    "ldf.fill f72 = %[f72]\n"
-	    "ldf.fill f73 = %[f73]\n"
-	    "ldf.fill f74 = %[f74]\n"
-	    "ldf.fill f75 = %[f75]\n"
-	    "ldf.fill f76 = %[f76]\n"
-	    "ldf.fill f77 = %[f77]\n"
-	    "ldf.fill f78 = %[f78]\n"
-	    "ldf.fill f79 = %[f79]\n"
-	    "ldf.fill f80 = %[f80]\n"
-	    "ldf.fill f81 = %[f81]\n"
-	    "ldf.fill f82 = %[f82]\n"
-	    "ldf.fill f83 = %[f83]\n"
-	    "ldf.fill f84 = %[f84]\n"
-	    "ldf.fill f85 = %[f85]\n"
-	    "ldf.fill f86 = %[f86]\n"
-	    "ldf.fill f87 = %[f87]\n"
-	    "ldf.fill f88 = %[f88]\n"
-	    "ldf.fill f89 = %[f89]\n"
-	    "ldf.fill f90 = %[f90]\n"
-	    "ldf.fill f91 = %[f91]\n"
-	    ::
-	      [f62] "m" (fctx->fr[30]),
-	      [f63] "m" (fctx->fr[31]),
-	      [f64] "m" (fctx->fr[32]),
-	      [f65] "m" (fctx->fr[33]),
-	      [f66] "m" (fctx->fr[34]),
-	      [f67] "m" (fctx->fr[35]),
-	      [f68] "m" (fctx->fr[36]),
-	      [f69] "m" (fctx->fr[37]),
-	      [f70] "m" (fctx->fr[38]),
-	      [f71] "m" (fctx->fr[39]),
-	      [f72] "m" (fctx->fr[40]),
-	      [f73] "m" (fctx->fr[41]),
-	      [f74] "m" (fctx->fr[42]),
-	      [f75] "m" (fctx->fr[43]),
-	      [f76] "m" (fctx->fr[44]),
-	      [f77] "m" (fctx->fr[45]),
-	      [f78] "m" (fctx->fr[46]),
-	      [f79] "m" (fctx->fr[47]),
-	      [f80] "m" (fctx->fr[48]),
-	      [f81] "m" (fctx->fr[49]),
-	      [f82] "m" (fctx->fr[50]),
-	      [f83] "m" (fctx->fr[51]),
-	      [f84] "m" (fctx->fr[52]),
-	      [f85] "m" (fctx->fr[53]),
-	      [f86] "m" (fctx->fr[54]),
-	      [f87] "m" (fctx->fr[55]),
-	      [f88] "m" (fctx->fr[56]),
-	      [f89] "m" (fctx->fr[57]),
-	      [f90] "m" (fctx->fr[58]),
-	      [f91] "m" (fctx->fr[59])
-	);
-
-	asm volatile (
-	    "ldf.fill f92 = %[f92]\n"
-	    "ldf.fill f93 = %[f93]\n"
-	    "ldf.fill f94 = %[f94]\n"
-	    "ldf.fill f95 = %[f95]\n"
-	    "ldf.fill f96 = %[f96]\n"
-	    "ldf.fill f97 = %[f97]\n"
-	    "ldf.fill f98 = %[f98]\n"
-	    "ldf.fill f99 = %[f99]\n"
-	    "ldf.fill f100 = %[f100]\n"
-	    "ldf.fill f101 = %[f101]\n"
-	    "ldf.fill f102 = %[f102]\n"
-	    "ldf.fill f103 = %[f103]\n"
-	    "ldf.fill f104 = %[f104]\n"
-	    "ldf.fill f105 = %[f105]\n"
-	    "ldf.fill f106 = %[f106]\n"
-	    "ldf.fill f107 = %[f107]\n"
-	    "ldf.fill f108 = %[f108]\n"
-	    "ldf.fill f109 = %[f109]\n"
-	    "ldf.fill f110 = %[f110]\n"
-	    "ldf.fill f111 = %[f111]\n"
-	    "ldf.fill f112 = %[f112]\n"
-	    "ldf.fill f113 = %[f113]\n"
-	    "ldf.fill f114 = %[f114]\n"
-	    "ldf.fill f115 = %[f115]\n"
-	    "ldf.fill f116 = %[f116]\n"
-	    "ldf.fill f117 = %[f117]\n"
-	    "ldf.fill f118 = %[f118]\n"
-	    "ldf.fill f119 = %[f119]\n"
-	    "ldf.fill f120 = %[f120]\n"
-	    "ldf.fill f121 = %[f121]\n"
-	    ::
-	      [f92] "m" (fctx->fr[60]),
-	      [f93] "m" (fctx->fr[61]),
-	      [f94] "m" (fctx->fr[62]),
-	      [f95] "m" (fctx->fr[63]),
-	      [f96] "m" (fctx->fr[64]),
-	      [f97] "m" (fctx->fr[65]),
-	      [f98] "m" (fctx->fr[66]),
-	      [f99] "m" (fctx->fr[67]),
-	      [f100] "m" (fctx->fr[68]),
-	      [f101] "m" (fctx->fr[69]),
-	      [f102] "m" (fctx->fr[70]),
-	      [f103] "m" (fctx->fr[71]),
-	      [f104] "m" (fctx->fr[72]),
-	      [f105] "m" (fctx->fr[73]),
-	      [f106] "m" (fctx->fr[74]),
-	      [f107] "m" (fctx->fr[75]),
-	      [f108] "m" (fctx->fr[76]),
-	      [f109] "m" (fctx->fr[77]),
-	      [f110] "m" (fctx->fr[78]),
-	      [f111] "m" (fctx->fr[79]),
-	      [f112] "m" (fctx->fr[80]),
-	      [f113] "m" (fctx->fr[81]),
-	      [f114] "m" (fctx->fr[82]),
-	      [f115] "m" (fctx->fr[83]),
-	      [f116] "m" (fctx->fr[84]),
-	      [f117] "m" (fctx->fr[85]),
-	      [f118] "m" (fctx->fr[86]),
-	      [f119] "m" (fctx->fr[87]),
-	      [f120] "m" (fctx->fr[88]),
-	      [f121] "m" (fctx->fr[89])
-	);
-
-	asm volatile (
-	    "ldf.fill f122 = %[f122]\n"
-	    "ldf.fill f123 = %[f123]\n"
-	    "ldf.fill f124 = %[f124]\n"
-	    "ldf.fill f125 = %[f125]\n"
-	    "ldf.fill f126 = %[f126]\n"
-	    "ldf.fill f127 = %[f127]\n"
-	    ::
-	      [f122] "m" (fctx->fr[90]),
-	      [f123] "m" (fctx->fr[91]),
-	      [f124] "m" (fctx->fr[92]),
-	      [f125] "m" (fctx->fr[93]),
-	      [f126] "m" (fctx->fr[94]),
-	      [f127] "m" (fctx->fr[95])
-	);
-}
-
-void fpu_enable(void)
-{
-	asm volatile (
-	    "rsm %0 ;;"
-	    "srlz.i\n"
-	    "srlz.d ;;\n"
-	    :
-	    : "i" (PSR_DFH_MASK)
-	);
-}
-
-void fpu_disable(void)
-{
-	asm volatile (
-	    "ssm %0 ;;\n"
-	    "srlz.i\n"
-	    "srlz.d ;;\n"
-	    :
-	    : "i" (PSR_DFH_MASK)
-	);
-}
-
-void fpu_init(void)
-{
-	uint64_t a = 0;
-
-	asm volatile (
-	    "mov %0 = ar.fpsr ;;\n"
-	    "or %0 = %0,%1 ;;\n"
-	    "mov ar.fpsr = %0 ;;\n"
-	    : "+r" (a)
-	    : "r" (FPSR_TRAPS_ALL | FPSR_SF1_CTRL)
-	);
-
-	asm volatile (
-	    "mov f2 = f0\n"
-	    "mov f3 = f0\n"
-	    "mov f4 = f0\n"
-	    "mov f5 = f0\n"
-	    "mov f6 = f0\n"
-	    "mov f7 = f0\n"
-	    "mov f8 = f0\n"
-	    "mov f9 = f0\n"
-
-	    "mov f10 = f0\n"
-	    "mov f11 = f0\n"
-	    "mov f12 = f0\n"
-	    "mov f13 = f0\n"
-	    "mov f14 = f0\n"
-	    "mov f15 = f0\n"
-	    "mov f16 = f0\n"
-	    "mov f17 = f0\n"
-	    "mov f18 = f0\n"
-	    "mov f19 = f0\n"
-
-	    "mov f20 = f0\n"
-	    "mov f21 = f0\n"
-	    "mov f22 = f0\n"
-	    "mov f23 = f0\n"
-	    "mov f24 = f0\n"
-	    "mov f25 = f0\n"
-	    "mov f26 = f0\n"
-	    "mov f27 = f0\n"
-	    "mov f28 = f0\n"
-	    "mov f29 = f0\n"
-
-	    "mov f30 = f0\n"
-	    "mov f31 = f0\n"
-	    "mov f32 = f0\n"
-	    "mov f33 = f0\n"
-	    "mov f34 = f0\n"
-	    "mov f35 = f0\n"
-	    "mov f36 = f0\n"
-	    "mov f37 = f0\n"
-	    "mov f38 = f0\n"
-	    "mov f39 = f0\n"
-
-	    "mov f40 = f0\n"
-	    "mov f41 = f0\n"
-	    "mov f42 = f0\n"
-	    "mov f43 = f0\n"
-	    "mov f44 = f0\n"
-	    "mov f45 = f0\n"
-	    "mov f46 = f0\n"
-	    "mov f47 = f0\n"
-	    "mov f48 = f0\n"
-	    "mov f49 = f0\n"
-
-	    "mov f50 = f0\n"
-	    "mov f51 = f0\n"
-	    "mov f52 = f0\n"
-	    "mov f53 = f0\n"
-	    "mov f54 = f0\n"
-	    "mov f55 = f0\n"
-	    "mov f56 = f0\n"
-	    "mov f57 = f0\n"
-	    "mov f58 = f0\n"
-	    "mov f59 = f0\n"
-
-	    "mov f60 = f0\n"
-	    "mov f61 = f0\n"
-	    "mov f62 = f0\n"
-	    "mov f63 = f0\n"
-	    "mov f64 = f0\n"
-	    "mov f65 = f0\n"
-	    "mov f66 = f0\n"
-	    "mov f67 = f0\n"
-	    "mov f68 = f0\n"
-	    "mov f69 = f0\n"
-
-	    "mov f70 = f0\n"
-	    "mov f71 = f0\n"
-	    "mov f72 = f0\n"
-	    "mov f73 = f0\n"
-	    "mov f74 = f0\n"
-	    "mov f75 = f0\n"
-	    "mov f76 = f0\n"
-	    "mov f77 = f0\n"
-	    "mov f78 = f0\n"
-	    "mov f79 = f0\n"
-
-	    "mov f80 = f0\n"
-	    "mov f81 = f0\n"
-	    "mov f82 = f0\n"
-	    "mov f83 = f0\n"
-	    "mov f84 = f0\n"
-	    "mov f85 = f0\n"
-	    "mov f86 = f0\n"
-	    "mov f87 = f0\n"
-	    "mov f88 = f0\n"
-	    "mov f89 = f0\n"
-
-	    "mov f90 = f0\n"
-	    "mov f91 = f0\n"
-	    "mov f92 = f0\n"
-	    "mov f93 = f0\n"
-	    "mov f94 = f0\n"
-	    "mov f95 = f0\n"
-	    "mov f96 = f0\n"
-	    "mov f97 = f0\n"
-	    "mov f98 = f0\n"
-	    "mov f99 = f0\n"
-
-	    "mov f100 = f0\n"
-	    "mov f101 = f0\n"
-	    "mov f102 = f0\n"
-	    "mov f103 = f0\n"
-	    "mov f104 = f0\n"
-	    "mov f105 = f0\n"
-	    "mov f106 = f0\n"
-	    "mov f107 = f0\n"
-	    "mov f108 = f0\n"
-	    "mov f109 = f0\n"
-
-	    "mov f110 = f0\n"
-	    "mov f111 = f0\n"
-	    "mov f112 = f0\n"
-	    "mov f113 = f0\n"
-	    "mov f114 = f0\n"
-	    "mov f115 = f0\n"
-	    "mov f116 = f0\n"
-	    "mov f117 = f0\n"
-	    "mov f118 = f0\n"
-	    "mov f119 = f0\n"
-
-	    "mov f120 = f0\n"
-	    "mov f121 = f0\n"
-	    "mov f122 = f0\n"
-	    "mov f123 = f0\n"
-	    "mov f124 = f0\n"
-	    "mov f125 = f0\n"
-	    "mov f126 = f0\n"
-	    "mov f127 = f0\n"
-	);
-
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/ia64.c
===================================================================
--- kernel/arch/ia64/src/ia64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,289 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <typedefs.h>
-#include <errno.h>
-#include <interrupt.h>
-#include <arch/interrupt.h>
-#include <macros.h>
-#include <stdbool.h>
-#include <str.h>
-#include <userspace.h>
-#include <console/console.h>
-#include <syscall/syscall.h>
-#include <sysinfo/sysinfo.h>
-#include <arch/drivers/it.h>
-#include <arch/drivers/kbd.h>
-#include <arch/legacyio.h>
-#include <genarch/drivers/ega/ega.h>
-#include <genarch/drivers/i8042/i8042.h>
-#include <genarch/drivers/ns16550/ns16550.h>
-#include <genarch/drivers/legacy/ia32/io.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/srln/srln.h>
-#include <mm/page.h>
-#include <mm/km.h>
-
-#ifdef MACHINE_ski
-#include <arch/drivers/ski.h>
-#endif
-
-static void ia64_pre_mm_init(void);
-static void ia64_post_mm_init(void);
-static void ia64_post_smp_init(void);
-
-arch_ops_t ia64_ops = {
-	.pre_mm_init = ia64_pre_mm_init,
-	.post_mm_init = ia64_post_mm_init,
-	.post_smp_init = ia64_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &ia64_ops;
-
-/* NS16550 as a COM 1 */
-#define NS16550_IRQ  (4 + LEGACY_INTERRUPT_BASE)
-
-bootinfo_t *bootinfo;
-
-static uint64_t iosapic_base = 0xfec00000;
-uintptr_t legacyio_virt_base = 0;
-
-/** Performs ia64-specific initialization before main_bsp() is called. */
-void ia64_pre_main(void)
-{
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
-	    CONFIG_INIT_TASKS);
-	size_t i;
-
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr =
-		    (uintptr_t) bootinfo->taskmap.tasks[i].addr;
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-}
-
-void ia64_pre_mm_init(void)
-{
-	if (config.cpu_active == 1)
-		exception_init();
-}
-
-static void iosapic_init(void)
-{
-	uintptr_t IOSAPIC = km_map(iosapic_base, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	int i;
-
-	int myid, myeid;
-
-	myid = ia64_get_cpu_id();
-	myeid = ia64_get_cpu_eid();
-
-	for (i = 0; i < 16; i++) {
-		if (i == 2)
-			continue;	 /* Disable Cascade interrupt */
-		((uint32_t *)(IOSAPIC + 0x00))[0] = 0x10 + 2 * i;
-		srlz_d();
-		((uint32_t *)(IOSAPIC + 0x10))[0] = LEGACY_INTERRUPT_BASE + i;
-		srlz_d();
-		((uint32_t *)(IOSAPIC + 0x00))[0] = 0x10 + 2 * i + 1;
-		srlz_d();
-		((uint32_t *)(IOSAPIC + 0x10))[0] = myid << (56 - 32) |
-		    myeid << (48 - 32);
-		srlz_d();
-	}
-
-}
-
-void ia64_post_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		/* Map the page with legacy I/O. */
-		legacyio_virt_base = km_map(LEGACYIO_PHYS_BASE, LEGACYIO_SIZE,
-		    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-		iosapic_init();
-		irq_init(INR_COUNT, INR_COUNT);
-	}
-	it_init();
-}
-
-void ia64_post_smp_init(void)
-{
-	static const char *platform;
-
-	/* Set platform name. */
-#ifdef MACHINE_ski
-	platform = "ski";
-#endif
-#ifdef MACHINE_i460GX
-	platform = "pc";
-#endif
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-#ifdef MACHINE_ski
-	ski_instance_t *ski_instance = skiin_init();
-	if (ski_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			skiin_wire(ski_instance, srln);
-		}
-	}
-
-	outdev_t *skidev = skiout_init();
-	if (skidev)
-		stdout_wire(skidev);
-#endif
-
-#ifdef CONFIG_EGA
-	outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
-	if (egadev)
-		stdout_wire(egadev);
-#endif
-
-#ifdef CONFIG_NS16550
-	ns16550_instance_t *ns16550_instance =
-	    ns16550_init(NS16550_BASE, 0, NS16550_IRQ, NULL, NULL,
-	    NULL);
-	if (ns16550_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			ns16550_wire(ns16550_instance, srln);
-		}
-	}
-
-	sysinfo_set_item_val("kbd", NULL, true);
-	sysinfo_set_item_val("kbd.inr", NULL, NS16550_IRQ);
-	sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550);
-	sysinfo_set_item_val("kbd.address.physical", NULL,
-	    (uintptr_t) NS16550_BASE);
-#endif
-
-#ifdef CONFIG_I8042
-	i8042_instance_t *i8042_instance = i8042_init((i8042_t *) I8042_BASE,
-	    IRQ_KBD);
-	if (i8042_instance) {
-		kbrd_instance_t *kbrd_instance = kbrd_init();
-		if (kbrd_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-			i8042_wire(i8042_instance, kbrd);
-		}
-	}
-#endif
-
-	sysinfo_set_item_val("ia64_iospace", NULL, true);
-	sysinfo_set_item_val("ia64_iospace.address", NULL, true);
-	sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, LEGACYIO_USER_BASE);
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return ALIGN_DOWN(stack_base + stack_size / 2, STACK_ALIGNMENT);
-}
-
-/** Enter userspace and never return. */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	psr_t psr;
-	rsc_t rsc;
-
-	psr.value = psr_read();
-	psr.cpl = PL_USER;
-	psr.i = true;			/* start with interrupts enabled */
-	psr.ic = true;
-	psr.ri = 0;			/* start with instruction #0 */
-	psr.bn = 1;			/* start in bank 0 */
-
-	asm volatile ("mov %0 = ar.rsc\n" : "=r" (rsc.value));
-	rsc.loadrs = 0;
-	rsc.be = false;
-	rsc.pl = PL_USER;
-	rsc.mode = 3;			/* eager mode */
-
-	/*
-	 * Switch to userspace.
-	 *
-	 * When calculating stack addresses, mind the stack split between the
-	 * memory stack and the RSE stack.
-	 * Memory stack occupies area under sp, while RSE stack occupies area above.
-	 */
-	switch_to_userspace(pc,
-	    sp, sp + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT),
-	    0, psr.value, rsc.value);
-
-	while (true)
-		;
-}
-
-void arch_reboot(void)
-{
-	pio_write_8((ioport8_t *)0x64, 0xfe);
-	while (true)
-		;
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	fptr->fnc = (sysarg_t) addr;
-	fptr->gp = ((sysarg_t *) caller)[1];
-
-	return (void *) fptr;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/interrupt.c
===================================================================
--- kernel/arch/ia64/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,347 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/interrupt.h>
-#include <assert.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <panic.h>
-#include <stdio.h>
-#include <console/console.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <arch/register.h>
-#include <arch.h>
-#include <syscall/syscall.h>
-#include <proc/scheduler.h>
-#include <ipc/sysipc.h>
-#include <ipc/irq.h>
-#include <ipc/ipc.h>
-#include <synch/spinlock.h>
-#include <mm/tlb.h>
-#include <arch/mm/tlb.h>
-#include <symtab.h>
-
-#define VECTORS_64_BUNDLE        20
-#define VECTORS_16_BUNDLE        48
-#define VECTORS_16_BUNDLE_START  0x50
-
-#define VECTOR_MAX  0x7f
-
-static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
-	"VHPT Translation vector",
-	"Instruction TLB vector",
-	"Data TLB vector",
-	"Alternate Instruction TLB vector",
-	"Alternate Data TLB vector",
-	"Data Nested TLB vector",
-	"Instruction Key Miss vector",
-	"Data Key Miss vector",
-	"Dirty-Bit vector",
-	"Instruction Access-Bit vector",
-	"Data Access-Bit vector",
-	"Break Instruction vector",
-	"External Interrupt vector",
-	"Virtual External Interrupt vector",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved"
-};
-
-static const char *vector_names_16_bundle[VECTORS_16_BUNDLE] = {
-	"Page Not Present vector",
-	"Key Permission vector",
-	"Instruction Access rights vector",
-	"Data Access Rights vector",
-	"General Exception vector",
-	"Disabled FP-Register vector",
-	"NaT Consumption vector",
-	"Speculation vector",
-	"Reserved",
-	"Debug vector",
-	"Unaligned Reference vector",
-	"Unsupported Data Reference vector",
-	"Floating-point Fault vector",
-	"Floating-point Trap vector",
-	"Lower-Privilege Transfer Trap vector",
-	"Taken Branch Trap vector",
-	"Single Step Trap vector",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"Reserved",
-	"IA-32 Exception vector",
-	"IA-32 Intercept vector",
-	"IA-32 Interrupt vector",
-	"Reserved",
-	"Reserved",
-	"Reserved"
-};
-
-static const char *vector_to_string(unsigned int n)
-{
-	assert(n <= VECTOR_MAX);
-
-	if (n >= VECTORS_16_BUNDLE_START)
-		return vector_names_16_bundle[n - VECTORS_16_BUNDLE_START];
-	else
-		return vector_names_64_bundle[n / 4];
-}
-
-void istate_decode(istate_t *istate)
-{
-	printf("ar.bsp=%p\tar.bspstore=%p\n",
-	    (void *) istate->ar_bsp, (void *) istate->ar_bspstore);
-	printf("ar.rnat=%#0" PRIx64 "\tar.rsc=%#0" PRIx64 "\n",
-	    istate->ar_rnat, istate->ar_rsc);
-	printf("ar.ifs=%#0" PRIx64 "\tar.pfs=%#0" PRIx64 "\n",
-	    istate->ar_ifs, istate->ar_pfs);
-	printf("cr.isr=%#0" PRIx64 "\tcr.ipsr=%#0" PRIx64 "\n",
-	    istate->cr_isr.value, istate->cr_ipsr.value);
-
-	printf("cr.iip=%#0" PRIxPTR ", #%u\t(%s)\n",
-	    istate->cr_iip, istate->cr_isr.ei,
-	    symtab_fmt_name_lookup(istate->cr_iip));
-	printf("cr.iipa=%#0" PRIxPTR "\t(%s)\n", istate->cr_iipa,
-	    symtab_fmt_name_lookup(istate->cr_iipa));
-	printf("cr.ifa=%#0" PRIxPTR "\t(%s)\n", istate->cr_ifa,
-	    symtab_fmt_name_lookup(istate->cr_ifa));
-}
-
-void general_exception(unsigned int n, istate_t *istate)
-{
-	const char *desc;
-
-	switch (istate->cr_isr.ge_code) {
-	case GE_ILLEGALOP:
-		desc = "Illegal Operation fault";
-		break;
-	case GE_PRIVOP:
-		desc = "Privileged Operation fault";
-		break;
-	case GE_PRIVREG:
-		desc = "Privileged Register fault";
-		break;
-	case GE_RESREGFLD:
-		desc = "Reserved Register/Field fault";
-		break;
-	case GE_DISBLDISTRAN:
-		desc = "Disabled Instruction Set Transition fault";
-		break;
-	case GE_ILLEGALDEP:
-		desc = "Illegal Dependency fault";
-		break;
-	default:
-		desc = "unknown";
-		break;
-	}
-
-	fault_if_from_uspace(istate, "General Exception (%s).", desc);
-	panic_badtrap(istate, n, "General Exception (%s).", desc);
-}
-
-void disabled_fp_register(unsigned int n, istate_t *istate)
-{
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-#else
-	fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
-	    (uint16_t) n, vector_to_string(n));
-	panic_badtrap(istate, n, "Interruption: %#hx (%s).",
-	    (uint16_t) n, vector_to_string(n));
-#endif
-}
-
-#define BREAK_IMM_SYSCALL	0x40000U
-
-/** Handle syscall. */
-sysarg_t break_instruction(unsigned int n, istate_t *istate)
-{
-	sysarg_t ret;
-
-	if (istate->cr_iim != BREAK_IMM_SYSCALL) {
-		fault_if_from_uspace(istate, "Unknown software interrupt: %x",
-		    (uint32_t) istate->cr_iim);
-		panic_badtrap(istate, n, "Interruption: %#hx (%s).",
-		    (uint16_t) n, vector_to_string(n));
-	}
-
-	/*
-	 * Move to next instruction after BREAK.
-	 */
-	if (istate->cr_ipsr.ri == 2) {
-		istate->cr_ipsr.ri = 0;
-		istate->cr_iip += 16;
-	} else {
-		istate->cr_ipsr.ri++;
-	}
-
-	interrupts_enable();
-	ret = syscall_handler(istate->in0, istate->in1, istate->in2,
-	    istate->in3, istate->in4, istate->in5, istate->in6);
-	interrupts_disable();
-
-	return ret;
-}
-
-void universal_handler(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
-	    n, vector_to_string(n));
-	panic_badtrap(istate, n, "Interruption: %#hx (%s).",
-	    n, vector_to_string(n));
-}
-
-static void end_of_local_irq(void)
-{
-	asm volatile (
-	    "mov cr.eoi = r0 ;;"
-	);
-}
-
-void external_interrupt(unsigned int n, istate_t *istate)
-{
-	cr_ivr_t ivr;
-
-	ivr.value = ivr_read();
-	srlz_d();
-
-	irq_t *irq;
-
-	switch (ivr.vector) {
-	case INTERRUPT_SPURIOUS:
-#ifdef CONFIG_DEBUG
-		printf("cpu%d: spurious interrupt\n", CPU->id);
-#endif
-		break;
-
-#ifdef CONFIG_SMP
-	case VECTOR_TLB_SHOOTDOWN_IPI:
-		tlb_shootdown_ipi_recv();
-		end_of_local_irq();
-		break;
-#endif
-
-	case INTERRUPT_TIMER:
-		irq = irq_dispatch_and_lock(ivr.vector);
-		if (irq) {
-			irq->handler(irq);
-			irq_spinlock_unlock(&irq->lock, false);
-		} else {
-			panic("Unhandled Internal Timer Interrupt (%d).",
-			    ivr.vector);
-		}
-		break;
-	default:
-		irq = irq_dispatch_and_lock(ivr.vector);
-		if (irq) {
-			/*
-			 * The IRQ handler was found.
-			 */
-			if (irq->preack) {
-				/* Send EOI before processing the interrupt */
-				end_of_local_irq();
-			}
-			irq->handler(irq);
-			if (!irq->preack)
-				end_of_local_irq();
-			irq_spinlock_unlock(&irq->lock, false);
-		} else {
-			/*
-			 * Unhandled interrupt.
-			 */
-			end_of_local_irq();
-#ifdef CONFIG_DEBUG
-			printf("\nUnhandled External Interrupt Vector %d\n",
-			    ivr.vector);
-#endif
-		}
-		break;
-	}
-}
-
-void exception_init(void)
-{
-	unsigned int i;
-
-	for (i = 0; i < IVT_ITEMS; i++)
-		exc_register(i, "universal_handler", false, universal_handler);
-
-	exc_register(EXC_ALT_ITLB_FAULT,
-	    vector_to_string(EXC_ALT_ITLB_FAULT), true,
-	    alternate_instruction_tlb_fault);
-	exc_register(EXC_ALT_DTLB_FAULT,
-	    vector_to_string(EXC_ALT_DTLB_FAULT), true,
-	    alternate_data_tlb_fault);
-	exc_register(EXC_NESTED_TLB_FAULT,
-	    vector_to_string(EXC_NESTED_TLB_FAULT), false,
-	    data_nested_tlb_fault);
-	exc_register(EXC_DATA_D_BIT_FAULT,
-	    vector_to_string(EXC_DATA_D_BIT_FAULT), true,
-	    data_dirty_bit_fault);
-	exc_register(EXC_INST_A_BIT_FAULT,
-	    vector_to_string(EXC_INST_A_BIT_FAULT), true,
-	    instruction_access_bit_fault);
-	exc_register(EXC_DATA_A_BIT_FAULT,
-	    vector_to_string(EXC_DATA_A_BIT_FAULT), true,
-	    data_access_bit_fault);
-	exc_register(EXC_EXT_INTERRUPT,
-	    vector_to_string(EXC_EXT_INTERRUPT), true,
-	    external_interrupt);
-
-	exc_register(EXC_PAGE_NOT_PRESENT,
-	    vector_to_string(EXC_PAGE_NOT_PRESENT), true,
-	    page_not_present);
-	exc_register(EXC_DATA_AR_FAULT,
-	    vector_to_string(EXC_DATA_AR_FAULT), true,
-	    data_access_rights_fault);
-	exc_register(EXC_GENERAL_EXCEPTION,
-	    vector_to_string(EXC_GENERAL_EXCEPTION), false,
-	    general_exception);
-	exc_register(EXC_DISABLED_FP_REG,
-	    vector_to_string(EXC_DISABLED_FP_REG), true,
-	    disabled_fp_register);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/ivt.S
===================================================================
--- kernel/arch/ia64/src/ivt.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,618 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Vana
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/stack.h>
-#include <arch/register.h>
-#include <arch/mm/page.h>
-#include <arch/interrupt.h>
-#include <arch/istate_struct.h>
-#include <align.h>
-
-#define STACK_FRAME_SIZE	ALIGN_UP(ISTATE_SIZE + STACK_SCRATCH_AREA_SIZE, STACK_ALIGNMENT)
-
-#define FLOAT_ITEM_SIZE		(STACK_ITEM_SIZE * 2)
-
-/** Partitioning of bank 0 registers. */
-#define R_VECTOR	r16
-#define R_HANDLER	r17
-#define R_RET		r18
-#define R_KSTACK_BSP	r22	/* keep in sync with before_thread_runs_arch() */
-#define R_KSTACK	r23	/* keep in sync with before_thread_runs_arch() */
-
-/* Speculation vector handler */
-.macro SPECULATION_VECTOR_HANDLER vector
-    .org ivt + \vector * 0x100
-
-    /* 1. Save predicates, IIM, IIP, IPSR and ISR CR's in bank 0 registers. */
-	mov r16 = pr
-	mov r17 = cr.iim
-	mov r18 = cr.iip
-	mov r19 = cr.ipsr
-	mov r20 = cr.isr ;;
-
-    /* 2. Move IIP to IIPA. */
-	mov cr.iipa = r18
-
-    /* 3. Sign extend IIM[20:0], shift left by 4 and add to IIP. */
-	shl r17 = r17, 43 ;;	/* shift bit 20 to bit 63 */
-	shr r17 = r17, 39 ;;	/* signed shift right to bit 24 */
-	add r18 = r18, r17 ;;
-	mov cr.iip = r18
-
-    /* 4. Set IPSR.ri to 0. */
-	dep r19 = 0, r19, PSR_RI_SHIFT, PSR_RI_LEN ;;
-	mov cr.ipsr = r19
-
-    /* 5. Check whether IPSR.tb or IPSR.ss is set. */
-
-	/* TODO:
-	 * Implement this when Taken Branch and Single Step traps can occur.
-	 */
-
-    /* 6. Restore predicates and return from interruption. */
-	mov pr = r16 ;;
-	rfi
-.endm
-
-/** Heavyweight interrupt handler
- *
- * This macro roughly follows steps from 1 to 19 described in
- * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2.
- *
- * HEAVYWEIGHT_HANDLER macro must cram into 16 bundles (48 instructions).
- * This goal is achieved by using procedure calls after RSE becomes operational.
- *
- * Some steps are skipped (enabling and disabling interrupts).
- *
- * @param offs Offset from the beginning of IVT.
- * @param handler Interrupt handler address.
- */
-.macro HEAVYWEIGHT_HANDLER vector, handler=exc_dispatch
-    .org ivt + \vector * 0x100
-	mov R_VECTOR = \vector
-	movl R_HANDLER = \handler ;;
-	br heavyweight_handler
-.endm
-
-SYMBOL(heavyweight_handler)
-    /* 1. copy interrupt registers into bank 0 */
-
-	/*
-	 * Note that r24-r31 from bank 0 can be used only as long as PSR.ic = 0.
-	 */
-
-	/* Set up FPU as in interrupted context. */
-	mov r24 = psr
-	mov r25 = cr.ipsr
-	mov r26 = PSR_DFH_MASK
-	mov r27 = ~PSR_DFH_MASK ;;
-	and r26 = r25, r26
-	and r24 = r24, r27 ;;
-	or r24 = r24, r26 ;;
-	mov psr.l = r24 ;;
-	srlz.i
-	srlz.d ;;
-
-	mov r24 = cr.iip
-	mov r25 = cr.ipsr
-	mov r26 = cr.iipa
-	mov r27 = cr.isr
-	mov r28 = cr.ifa
-
-    /* 2. preserve predicate register into bank 0 */
-	mov r29 = pr ;;
-
-    /* 3. switch to kernel memory stack */
-    	mov r30 = cr.ipsr
-	shr.u r31 = r12, VRN_SHIFT ;;
-
-	shr.u r30 = r30, PSR_CPL_SHIFT ;;
-	and r30 = PSR_CPL_MASK_SHIFTED, r30 ;;
-
-	/*
-	 * Set p3 to true if the interrupted context executed in kernel mode.
-	 * Set p4 to false if the interrupted context didn't execute in kernel mode.
-	 */
-	cmp.eq p3, p4 = r30, r0 ;;
-	cmp.eq p1, p2 = r30, r0 ;;	/* remember IPSR setting in p1 and p2 */
-
-	/*
-	 * Set p3 to true if the stack register references kernel address space.
-	 * Set p4 to false if the stack register doesn't reference kernel address space.
-	 */
-(p3)	cmp.eq p3, p4 = VRN_KERNEL, r31 ;;
-
-	/*
-	 * Now, p4 is true iff the stack needs to be switched to kernel stack.
-	 */
-	mov r30 = r12
-(p4)	mov r12 = R_KSTACK ;;
-
-	add r12 = -STACK_FRAME_SIZE, r12 ;;
-	add r31 = STACK_SCRATCH_AREA_SIZE + ISTATE_OFFSET_IN6, r12
-
-    /* 4. save registers in bank 0 into memory stack */
-
-	/*
-	 * If this is break_instruction handler,
-	 * copy input parameters to stack.
-	 */
-	cmp.eq p6, p5 = EXC_BREAK_INSTRUCTION, R_VECTOR ;;
-
-	/*
-	 * From now on, if this is break_instruction handler, p6 is true and p5
-	 * is false. Otherwise p6 is false and p5 is true.
-	 * Note that p5 is a preserved predicate register and we make use of it.
-	 */
-
-(p6)	st8 [r31] = r38, -STACK_ITEM_SIZE ;;	/* save in6 */
-(p6)	st8 [r31] = r37, -STACK_ITEM_SIZE ;;	/* save in5 */
-(p6)	st8 [r31] = r36, -STACK_ITEM_SIZE ;;	/* save in4 */
-(p6)	st8 [r31] = r35, -STACK_ITEM_SIZE ;;	/* save in3 */
-(p6) 	st8 [r31] = r34, -STACK_ITEM_SIZE ;;	/* save in2 */
-(p6)	st8 [r31] = r33, -STACK_ITEM_SIZE ;;	/* save in1 */
-(p6)	st8 [r31] = r32, -STACK_ITEM_SIZE ;;	/* save in0 */
-(p5)	add r31 = -(7 * STACK_ITEM_SIZE), r31 ;;
-
-	st8 [r31] = r30, -STACK_ITEM_SIZE ;;	/* save old stack pointer */
-
-	st8 [r31] = r29, -STACK_ITEM_SIZE ;;	/* save predicate registers */
-
-	mov r29 = cr.iim ;;
-	st8 [r31] = r29, -STACK_ITEM_SIZE ;;	/* save cr.iim */
-
-	st8 [r31] = r24, -STACK_ITEM_SIZE ;;	/* save cr.iip */
-	st8 [r31] = r25, -STACK_ITEM_SIZE ;;	/* save cr.ipsr */
-	st8 [r31] = r26, -STACK_ITEM_SIZE ;;	/* save cr.iipa */
-	st8 [r31] = r27, -STACK_ITEM_SIZE ;;	/* save cr.isr */
-	st8 [r31] = r28, -STACK_ITEM_SIZE ;;	/* save cr.ifa */
-
-    /* 5. RSE switch from interrupted context */
-	mov r24 = ar.rsc
-	mov r25 = ar.pfs
-	cover
-	mov r26 = cr.ifs
-
-	st8 [r31] = r24, -STACK_ITEM_SIZE ;;	/* save ar.rsc */
-	st8 [r31] = r25, -STACK_ITEM_SIZE ;;	/* save ar.pfs */
-	st8 [r31] = r26, -STACK_ITEM_SIZE	/* save ar.ifs */
-
-	and r24 = ~(RSC_PL_MASK), r24 ;;
-	and r30 = ~(RSC_MODE_MASK), r24 ;;
-	mov ar.rsc = r30 ;;		/* update RSE state */
-
-	mov r27 = ar.rnat
-	mov r28 = ar.bspstore ;;
-
-	/*
-	 * Inspect BSPSTORE to figure out whether it is necessary to switch to
-	 * kernel BSPSTORE.
-	 */
-(p1)	shr.u r30 = r28, VRN_SHIFT ;;
-(p1)	cmp.eq p1, p2 = VRN_KERNEL, r30 ;;
-
-	/*
-	 * If BSPSTORE needs to be switched, p1 is false and p2 is true.
-	 */
-(p1)	mov r30 = r28
-(p2)	mov r30 = R_KSTACK_BSP ;;
-(p2)	mov ar.bspstore = r30 ;;
-
-	mov r29 = ar.bsp
-
-	st8 [r31] = r27, -STACK_ITEM_SIZE ;;	/* save ar.rnat */
-	st8 [r31] = r30, -STACK_ITEM_SIZE ;;	/* save new value written to ar.bspstore */
-	st8 [r31] = r28, -STACK_ITEM_SIZE ;;	/* save ar.bspstore */
-	st8 [r31] = r29, -STACK_ITEM_SIZE 	/* save ar.bsp */
-
-	mov ar.rsc = r24		/* restore RSE's setting + kernel privileges */
-
-    /* steps 6 - 15 are done by heavyweight_handler_inner() */
-	mov R_RET = b0 			/* save b0 belonging to interrupted context */
-	br.call.sptk.many b0 = heavyweight_handler_inner
-0:	mov b0 = R_RET			/* restore b0 belonging to the interrupted context */
-
-    /* 16. RSE switch to interrupted context */
-	cover				/* allocate zero size frame (step 1 (from Intel Docs)) */
-
-	add r31 = STACK_SCRATCH_AREA_SIZE + ISTATE_OFFSET_AR_BSP, r12 ;;
-
-	ld8 r30 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.bsp */
-	ld8 r29 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.bspstore */
-	ld8 r28 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.bspstore_new */
-	sub r27 = r30 , r28 ;;		/* calculate loadrs (step 2) */
-	shl r27 = r27, 16
-
-	mov r24 = ar.rsc ;;
-	and r30 = ~3, r24 ;;
-	or  r24 = r30 , r27 ;;
-	mov ar.rsc = r24 ;;		/* place RSE in enforced lazy mode */
-
-	loadrs 				/* (step 3) */
-
-	ld8 r27 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.rnat */
-	ld8 r26 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.ifs */
-	ld8 r25 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.pfs */
-	ld8 r24 = [r31], +STACK_ITEM_SIZE ;;	/* load ar.rsc */
-
-	mov ar.bspstore = r29 ;;	/* (step 4) */
-	mov ar.rnat = r27		/* (step 5) */
-
-	mov ar.pfs = r25		/* (step 6) */
-	mov cr.ifs = r26
-
-	mov ar.rsc = r24		/* (step 7) */
-
-    /* 17. restore interruption state from memory stack */
-	ld8 r28 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.ifa */
-	ld8 r27 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.isr */
-	ld8 r26 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.iipa */
-	ld8 r25 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.ipsr */
-	ld8 r24 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.iip */
-	ld8 r29 = [r31], +STACK_ITEM_SIZE ;;	/* load cr.iim */
-
-	mov cr.iip = r24;;
-	mov cr.iipa = r26
-	mov cr.isr = r27
-	mov cr.ifa = r28
-	mov cr.iim = r29
-
-	/* Set up FPU as in exception. */
-	mov r24 = psr
-	mov r26 = PSR_DFH_MASK
-	mov r27 = ~PSR_DFH_MASK ;;
-	and r25 = r25, r27
-	and r24 = r24, r26 ;;
-	or r25 = r25, r24 ;;
-	mov cr.ipsr = r25
-
-    /* 18. restore predicate registers from memory stack */
-	ld8 r29 = [r31], +STACK_ITEM_SIZE ;;	/* load predicate registers */
-	mov pr = r29
-
-    /* 19. return from interruption */
-    	ld8 r12 = [r31]				/* load stack pointer */
-	rfi ;;
-
-FUNCTION_BEGIN(heavyweight_handler_inner)
-	/*
-	 * From this point, the rest of the interrupted context
-	 * will be preserved in stacked registers and backing store.
-	 */
-	alloc loc0 = ar.pfs, 0, 48, 2, 0 ;;
-
-	/* bank 0 is going to be shadowed, copy essential data from there */
-	mov loc1 = R_RET	/* b0 belonging to interrupted context */
-	mov loc2 = R_HANDLER
-	mov out0 = R_VECTOR
-
-	add out1 = STACK_SCRATCH_AREA_SIZE, r12
-
-    /* 6. switch to bank 1 and reenable PSR.ic */
-	ssm PSR_IC_MASK
-	bsw.1 ;;
-	srlz.d
-
-    /* 7. preserve branch and application registers */
-    	mov loc3 = ar.unat
-	mov loc4 = ar.lc
-	mov loc5 = ar.ec
-	mov loc6 = ar.ccv
-	mov loc7 = ar.csd
-	mov loc8 = ar.ssd
-
-	mov loc9 = b0
-	mov loc10 = b1
-	mov loc11 = b2
-	mov loc12 = b3
-	mov loc13 = b4
-	mov loc14 = b5
-	mov loc15 = b6
-	mov loc16 = b7
-
-    /* 8. preserve general and floating-point registers */
-	mov loc17 = r1
-	mov loc18 = r2
-	mov loc19 = r3
-	mov loc20 = r4
-	mov loc21 = r5
-	mov loc22 = r6
-	mov loc23 = r7
-(p5)	mov loc24 = r8		/* only if not in break_instruction handler */
-	mov loc25 = r9
-	mov loc26 = r10
-	mov loc27 = r11
-	/* skip r12 (stack pointer) */
-	mov loc28 = r13
-	mov loc29 = r14
-	mov loc30 = r15
-	mov loc31 = r16
-	mov loc32 = r17
-	mov loc33 = r18
-	mov loc34 = r19
-	mov loc35 = r20
-	mov loc36 = r21
-	mov loc37 = r22
-	mov loc38 = r23
-	mov loc39 = r24
-	mov loc40 = r25
-	mov loc41 = r26
-	mov loc42 = r27
-	mov loc43 = r28
-	mov loc44 = r29
-	mov loc45 = r30
-	mov loc46 = r31
-
-	add r24 = ISTATE_OFFSET_F8 + STACK_SCRATCH_AREA_SIZE, r12
-	add r25 = ISTATE_OFFSET_F9 + STACK_SCRATCH_AREA_SIZE, r12
-	add r26 = ISTATE_OFFSET_F2 + STACK_SCRATCH_AREA_SIZE, r12
-	add r27 = ISTATE_OFFSET_F3 + STACK_SCRATCH_AREA_SIZE, r12
-	add r28 = ISTATE_OFFSET_F4 + STACK_SCRATCH_AREA_SIZE, r12
-	add r29 = ISTATE_OFFSET_F5 + STACK_SCRATCH_AREA_SIZE, r12
-	add r30 = ISTATE_OFFSET_F6 + STACK_SCRATCH_AREA_SIZE, r12
-	add r31 = ISTATE_OFFSET_F7 + STACK_SCRATCH_AREA_SIZE, r12 ;;
-
-	stf.spill [r26] = f2, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r27] = f3, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r28] = f4, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r29] = f5, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r30] = f6, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r31] = f7, 8 * FLOAT_ITEM_SIZE ;;
-
-	stf.spill [r24] = f8, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r25] = f9, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r26] = f10, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r27] = f11, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r28] = f12, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r29] = f13, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r30] = f14, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r31] = f15, 8 * FLOAT_ITEM_SIZE ;;
-
-	stf.spill [r24] = f16, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r25] = f17, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r26] = f18, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r27] = f19, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r28] = f20, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r29] = f21, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r30] = f22, 8 * FLOAT_ITEM_SIZE
-	stf.spill [r31] = f23, 8 * FLOAT_ITEM_SIZE ;;
-
-	stf.spill [r24] = f24
-	stf.spill [r25] = f25
-	stf.spill [r26] = f26
-	stf.spill [r27] = f27
-	stf.spill [r28] = f28
-	stf.spill [r29] = f29
-	stf.spill [r30] = f30
-	stf.spill [r31] = f31 ;;
-
-	mov loc47 = ar.fpsr	/* preserve floating point status register */
-
-    /* 9. skipped (will not enable interrupts) */
-	/*
-    	 * ssm PSR_I_MASK
-	 * ;;
-	 * srlz.d
-	 */
-
-    /* 10. call handler */
-    	movl r1 = __gp
-
-    	mov b1 = loc2
-	br.call.sptk.many b0 = b1
-
-    /* 11. return from handler */
-0:
-
-    /* 12. skipped (will not disable interrupts) */
-	/*
-    	 * rsm PSR_I_MASK
-	 * ;;
-	 * srlz.d
-	 */
-
-    /* 13. restore general and floating-point registers */
-	add r24 = ISTATE_OFFSET_F8 + STACK_SCRATCH_AREA_SIZE, r12
-	add r25 = ISTATE_OFFSET_F9 + STACK_SCRATCH_AREA_SIZE, r12
-	add r26 = ISTATE_OFFSET_F2 + STACK_SCRATCH_AREA_SIZE, r12
-	add r27 = ISTATE_OFFSET_F3 + STACK_SCRATCH_AREA_SIZE, r12
-	add r28 = ISTATE_OFFSET_F4 + STACK_SCRATCH_AREA_SIZE, r12
-	add r29 = ISTATE_OFFSET_F5 + STACK_SCRATCH_AREA_SIZE, r12
-	add r30 = ISTATE_OFFSET_F6 + STACK_SCRATCH_AREA_SIZE, r12
-	add r31 = ISTATE_OFFSET_F7 + STACK_SCRATCH_AREA_SIZE, r12 ;;
-
-	ldf.fill f2 = [r26], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f3 = [r27], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f4 = [r28], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f5 = [r29], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f6 = [r30], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f7 = [r31], 8 * FLOAT_ITEM_SIZE ;;
-
-	ldf.fill f8 = [r24], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f9 = [r25], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f10 = [r26],8 * FLOAT_ITEM_SIZE
-	ldf.fill f11 = [r27], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f12 = [r28], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f13 = [r29], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f14 = [r30], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f15 = [r31], 8 * FLOAT_ITEM_SIZE ;;
-
-	ldf.fill f16 = [r24], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f17 = [r25], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f18 = [r26], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f19 = [r27], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f20 = [r28], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f21 = [r29], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f22 = [r30], 8 * FLOAT_ITEM_SIZE
-	ldf.fill f23 = [r31], 8 * FLOAT_ITEM_SIZE ;;
-
-	ldf.fill f24 = [r24]
-	ldf.fill f25 = [r25]
-	ldf.fill f26 = [r26]
-	ldf.fill f27 = [r27]
-	ldf.fill f28 = [r28]
-	ldf.fill f29 = [r29]
-	ldf.fill f30 = [r30]
-	ldf.fill f31 = [r31] ;;
-
-	mov r1 = loc17
-	mov r2 = loc18
-	mov r3 = loc19
-	mov r4 = loc20
-	mov r5 = loc21
-	mov r6 = loc22
-	mov r7 = loc23
-(p5)	mov r8 = loc24		/* only if not in break_instruction handler */
-	mov r9 = loc25
-	mov r10 = loc26
-	mov r11 = loc27
-	/* skip r12 (stack pointer) */
-	mov r13 = loc28
-	mov r14 = loc29
-	mov r15 = loc30
-	mov r16 = loc31
-	mov r17 = loc32
-	mov r18 = loc33
-	mov r19 = loc34
-	mov r20 = loc35
-	mov r21 = loc36
-	mov r22 = loc37
-	mov r23 = loc38
-	mov r24 = loc39
-	mov r25 = loc40
-	mov r26 = loc41
-	mov r27 = loc42
-	mov r28 = loc43
-	mov r29 = loc44
-	mov r30 = loc45
-	mov r31 = loc46
-
-	mov ar.fpsr = loc47	/* restore floating point status register */
-
-    /* 14. restore branch and application registers */
-    	mov ar.unat = loc3
-	mov ar.lc = loc4
-	mov ar.ec = loc5
-	mov ar.ccv = loc6
-	mov ar.csd = loc7
-	mov ar.ssd = loc8
-
-	mov b0 = loc9
-	mov b1 = loc10
-	mov b2 = loc11
-	mov b3 = loc12
-	mov b4 = loc13
-	mov b5 = loc14
-	mov b6 = loc15
-	mov b7 = loc16
-
-    /* 15. disable PSR.ic and switch to bank 0 */
-	rsm PSR_IC_MASK
-	bsw.0 ;;
-	srlz.d
-
-	mov R_RET = loc1
-	mov ar.pfs = loc0
-	br.ret.sptk.many b0
-FUNCTION_END(heavyweight_handler_inner)
-
-.align 32768
-SYMBOL(ivt)
-	HEAVYWEIGHT_HANDLER 0x00
-	HEAVYWEIGHT_HANDLER 0x04
-	HEAVYWEIGHT_HANDLER 0x08
-	HEAVYWEIGHT_HANDLER 0x0c
-	HEAVYWEIGHT_HANDLER 0x10
-	HEAVYWEIGHT_HANDLER 0x14
-	HEAVYWEIGHT_HANDLER 0x18
-	HEAVYWEIGHT_HANDLER 0x1c
-	HEAVYWEIGHT_HANDLER 0x20
-	HEAVYWEIGHT_HANDLER 0x24
-	HEAVYWEIGHT_HANDLER 0x28
-	HEAVYWEIGHT_HANDLER 0x2c break_instruction
-	HEAVYWEIGHT_HANDLER 0x30
-	HEAVYWEIGHT_HANDLER 0x34
-	HEAVYWEIGHT_HANDLER 0x38
-	HEAVYWEIGHT_HANDLER 0x3c
-	HEAVYWEIGHT_HANDLER 0x40
-	HEAVYWEIGHT_HANDLER 0x44
-	HEAVYWEIGHT_HANDLER 0x48
-	HEAVYWEIGHT_HANDLER 0x4c
-
-	HEAVYWEIGHT_HANDLER 0x50
-	HEAVYWEIGHT_HANDLER 0x51
-	HEAVYWEIGHT_HANDLER 0x52
-	HEAVYWEIGHT_HANDLER 0x53
-	HEAVYWEIGHT_HANDLER 0x54
-	HEAVYWEIGHT_HANDLER 0x55
-	HEAVYWEIGHT_HANDLER 0x56
-	SPECULATION_VECTOR_HANDLER 0x57
-	HEAVYWEIGHT_HANDLER 0x58
-	HEAVYWEIGHT_HANDLER 0x59
-	HEAVYWEIGHT_HANDLER 0x5a
-	HEAVYWEIGHT_HANDLER 0x5b
-	HEAVYWEIGHT_HANDLER 0x5c
-	HEAVYWEIGHT_HANDLER 0x5d
-	HEAVYWEIGHT_HANDLER 0x5e
-	HEAVYWEIGHT_HANDLER 0x5f
-
-	HEAVYWEIGHT_HANDLER 0x60
-	HEAVYWEIGHT_HANDLER 0x61
-	HEAVYWEIGHT_HANDLER 0x62
-	HEAVYWEIGHT_HANDLER 0x63
-	HEAVYWEIGHT_HANDLER 0x64
-	HEAVYWEIGHT_HANDLER 0x65
-	HEAVYWEIGHT_HANDLER 0x66
-	HEAVYWEIGHT_HANDLER 0x67
-	HEAVYWEIGHT_HANDLER 0x68
-	HEAVYWEIGHT_HANDLER 0x69
-	HEAVYWEIGHT_HANDLER 0x6a
-	HEAVYWEIGHT_HANDLER 0x6b
-	HEAVYWEIGHT_HANDLER 0x6c
-	HEAVYWEIGHT_HANDLER 0x6d
-	HEAVYWEIGHT_HANDLER 0x6e
-	HEAVYWEIGHT_HANDLER 0x6f
-
-	HEAVYWEIGHT_HANDLER 0x70
-	HEAVYWEIGHT_HANDLER 0x71
-	HEAVYWEIGHT_HANDLER 0x72
-	HEAVYWEIGHT_HANDLER 0x73
-	HEAVYWEIGHT_HANDLER 0x74
-	HEAVYWEIGHT_HANDLER 0x75
-	HEAVYWEIGHT_HANDLER 0x76
-	HEAVYWEIGHT_HANDLER 0x77
-	HEAVYWEIGHT_HANDLER 0x78
-	HEAVYWEIGHT_HANDLER 0x79
-	HEAVYWEIGHT_HANDLER 0x7a
-	HEAVYWEIGHT_HANDLER 0x7b
-	HEAVYWEIGHT_HANDLER 0x7c
-	HEAVYWEIGHT_HANDLER 0x7d
-	HEAVYWEIGHT_HANDLER 0x7e
-	HEAVYWEIGHT_HANDLER 0x7f
Index: rnel/arch/ia64/src/mm/as.c
===================================================================
--- kernel/arch/ia64/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/as.h>
-#include <arch/mm/asid.h>
-#include <arch/mm/page.h>
-#include <assert.h>
-#include <genarch/mm/as_ht.h>
-#include <genarch/mm/page_ht.h>
-#include <genarch/mm/asid_fifo.h>
-#include <mm/asid.h>
-#include <barrier.h>
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	as_operations = &as_ht_operations;
-	asid_fifo_init();
-}
-
-/** Prepare registers for switching to another address space.
- *
- * @param as Address space.
- */
-void as_install_arch(as_t *as)
-{
-	region_register_t rr;
-	int i;
-
-	assert(as->asid != ASID_INVALID);
-
-	/*
-	 * Load respective ASID (7 consecutive RIDs) to
-	 * region registers.
-	 */
-	for (i = 0; i < REGION_REGISTERS; i++) {
-		if (i == VRN_KERNEL)
-			continue;
-
-		rr.word = rr_read(i);
-		rr.map.ve = false;		/* disable VHPT walker */
-		rr.map.rid = ASID2RID(as->asid, i);
-		rr.map.ps = PAGE_WIDTH;
-		rr_write(i, rr.word);
-		srlz_d();
-		srlz_i();
-	}
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/mm/frame.c
===================================================================
--- kernel/arch/ia64/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <config.h>
-#include <panic.h>
-#include <arch/bootinfo.h>
-#include <align.h>
-#include <macros.h>
-
-#define KERNEL_RESERVED_AREA_BASE 	(0x4400000)
-#define KERNEL_RESERVED_AREA_SIZE 	(16 * 1024 * 1024)
-
-#define ROM_BASE	0xa0000               /* for simulators */
-#define ROM_SIZE	(384 * 1024)          /* for simulators */
-
-#define MIN_ZONE_SIZE	(64 * 1024)
-
-#define MINCONF 1
-
-uintptr_t end_of_identity = -1ULL;
-
-static void frame_common_arch_init(bool low)
-{
-	unsigned int i;
-
-	for (i = 0; i < bootinfo->memmap_items; i++) {
-		if (bootinfo->memmap[i].type != MEMMAP_FREE_MEM)
-			continue;
-
-		uintptr_t base = bootinfo->memmap[i].base;
-		size_t size = bootinfo->memmap[i].size;
-		uintptr_t abase = ALIGN_UP(base, FRAME_SIZE);
-
-		if (size > FRAME_SIZE)
-			size -= abase - base;
-
-		if (!frame_adjust_zone_bounds(low, &abase, &size))
-			continue;
-
-		if (size > MIN_ZONE_SIZE) {
-			pfn_t pfn = ADDR2PFN(abase);
-			size_t count = SIZE2FRAMES(size);
-
-			if (low) {
-				zone_create(pfn, count, max(MINCONF, pfn),
-				    ZONE_AVAILABLE | ZONE_LOWMEM);
-			} else {
-				pfn_t conf = zone_external_conf_alloc(count);
-				if (conf != 0)
-					zone_create(pfn, count, conf,
-					    ZONE_AVAILABLE | ZONE_HIGHMEM);
-			}
-		}
-	}
-}
-
-void frame_low_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(true);
-
-	/*
-	 * Blacklist ROM regions.
-	 */
-	frame_mark_unavailable(ADDR2PFN(ROM_BASE),
-	    SIZE2FRAMES(ROM_SIZE));
-
-	frame_mark_unavailable(ADDR2PFN(KERNEL_RESERVED_AREA_BASE),
-	    SIZE2FRAMES(KERNEL_RESERVED_AREA_SIZE));
-
-	/* PA2KA will work only on low-memory. */
-	end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
-}
-
-void frame_high_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/mm/km.c
===================================================================
--- kernel/arch/ia64/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_IA64_IDENTITY_START;
-	config.identity_size = KM_IA64_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_IA64_NON_IDENTITY_START,
-	    KM_IA64_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_IA64_NON_IDENTITY_START, KM_IA64_NON_IDENTITY_SIZE,
-	    addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/mm/page.c
===================================================================
--- kernel/arch/ia64/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <assert.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/asid.h>
-#include <arch/mm/asid.h>
-#include <arch/mm/vhpt.h>
-#include <typedefs.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <config.h>
-#include <panic.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <align.h>
-
-static void set_environment(void);
-
-/** Initialize ia64 virtual address translation subsystem. */
-void page_arch_init(void)
-{
-	page_mapping_operations = &ht_mapping_operations;
-	pk_disable();
-	set_environment();
-}
-
-/** Initialize VHPT and region registers. */
-void set_environment(void)
-{
-	region_register_t rr;
-	pta_register_t pta;
-	int i;
-#ifdef CONFIG_VHPT
-	uintptr_t vhpt_base;
-#endif
-
-	/*
-	 * Set up kernel region registers.
-	 * VRN_KERNEL has already been set in start.S.
-	 * For paranoia reasons, we set it again.
-	 */
-	for (i = 0; i < REGION_REGISTERS; i++) {
-		rr.word = rr_read(i);
-		rr.map.ve = 0;		/* disable VHPT walker */
-		rr.map.rid = ASID2RID(ASID_KERNEL, i);
-		rr.map.ps = PAGE_WIDTH;
-		rr_write(i, rr.word);
-		srlz_i();
-		srlz_d();
-	}
-
-#ifdef CONFIG_VHPT
-	vhpt_base = vhpt_set_up();
-#endif
-	/*
-	 * Set up PTA register.
-	 */
-	pta.word = pta_read();
-#ifndef CONFIG_VHPT
-	pta.map.ve = 0;                   /* disable VHPT walker */
-	pta.map.base = 0 >> PTA_BASE_SHIFT;
-#else
-	pta.map.ve = 1;                   /* enable VHPT walker */
-	pta.map.base = vhpt_base >> PTA_BASE_SHIFT;
-#endif
-	pta.map.vf = 1;                   /* large entry format */
-	pta.map.size = VHPT_WIDTH;
-	pta_write(pta.word);
-	srlz_i();
-	srlz_d();
-}
-
-/** Calculate address of collision chain from VPN and ASID.
- *
- * Interrupts must be disabled.
- *
- * @param page		Address of virtual page including VRN bits.
- * @param asid		Address space identifier.
- *
- * @return		VHPT entry address.
- */
-vhpt_entry_t *vhpt_hash(uintptr_t page, asid_t asid)
-{
-	region_register_t rr_save, rr;
-	size_t vrn;
-	rid_t rid;
-	vhpt_entry_t *v;
-
-	vrn = page >> VRN_SHIFT;
-	rid = ASID2RID(asid, vrn);
-
-	rr_save.word = rr_read(vrn);
-	if (rr_save.map.rid == rid) {
-		/*
-		 * The RID is already in place, compute thash and return.
-		 */
-		v = (vhpt_entry_t *) thash(page);
-		return v;
-	}
-
-	/*
-	 * The RID must be written to some region register.
-	 * To speed things up, register indexed by vrn is used.
-	 */
-	rr.word = rr_save.word;
-	rr.map.rid = rid;
-	rr_write(vrn, rr.word);
-	srlz_i();
-	v = (vhpt_entry_t *) thash(page);
-	rr_write(vrn, rr_save.word);
-	srlz_i();
-	srlz_d();
-
-	return v;
-}
-
-/** Compare ASID and VPN against PTE.
- *
- * Interrupts must be disabled.
- *
- * @param page		Address of virtual page including VRN bits.
- * @param asid		Address space identifier.
- *
- * @return		True if page and asid match the page and asid of t,
- * 			false otherwise.
- */
-bool vhpt_compare(uintptr_t page, asid_t asid, vhpt_entry_t *v)
-{
-	region_register_t rr_save, rr;
-	size_t vrn;
-	rid_t rid;
-	bool match;
-
-	assert(v);
-
-	vrn = page >> VRN_SHIFT;
-	rid = ASID2RID(asid, vrn);
-
-	rr_save.word = rr_read(vrn);
-	if (rr_save.map.rid == rid) {
-		/*
-		 * The RID is already in place, compare ttag with t and return.
-		 */
-		return ttag(page) == v->present.tag.tag_word;
-	}
-
-	/*
-	 * The RID must be written to some region register.
-	 * To speed things up, register indexed by vrn is used.
-	 */
-	rr.word = rr_save.word;
-	rr.map.rid = rid;
-	rr_write(vrn, rr.word);
-	srlz_i();
-	match = (ttag(page) == v->present.tag.tag_word);
-	rr_write(vrn, rr_save.word);
-	srlz_i();
-	srlz_d();
-
-	return match;
-}
-
-/** Set up one VHPT entry.
- *
- * @param v VHPT entry to be set up.
- * @param page		Virtual address of the page mapped by the entry.
- * @param asid		Address space identifier of the address space to which
- * 			page belongs.
- * @param frame		Physical address of the frame to wich page is mapped.
- * @param flags		Different flags for the mapping.
- */
-void
-vhpt_set_record(vhpt_entry_t *v, uintptr_t page, asid_t asid, uintptr_t frame,
-    int flags)
-{
-	region_register_t rr_save, rr;
-	size_t vrn;
-	rid_t rid;
-	uint64_t tag;
-
-	assert(v);
-
-	vrn = page >> VRN_SHIFT;
-	rid = ASID2RID(asid, vrn);
-
-	/*
-	 * Compute ttag.
-	 */
-	rr_save.word = rr_read(vrn);
-	rr.word = rr_save.word;
-	rr.map.rid = rid;
-	rr_write(vrn, rr.word);
-	srlz_i();
-	tag = ttag(page);
-	rr_write(vrn, rr_save.word);
-	srlz_i();
-	srlz_d();
-
-	/*
-	 * Clear the entry.
-	 */
-	v->word[0] = 0;
-	v->word[1] = 0;
-	v->word[2] = 0;
-	v->word[3] = 0;
-
-	v->present.p = true;
-	v->present.ma = (flags & PAGE_CACHEABLE) ?
-	    MA_WRITEBACK : MA_UNCACHEABLE;
-	v->present.a = false;  /* not accessed */
-	v->present.d = false;  /* not dirty */
-	v->present.pl = (flags & PAGE_USER) ? PL_USER : PL_KERNEL;
-	v->present.ar = (flags & PAGE_WRITE) ? AR_WRITE : AR_READ;
-	v->present.ar |= (flags & PAGE_EXEC) ? AR_EXECUTE : 0;
-	v->present.ppn = frame >> PPN_SHIFT;
-	v->present.ed = false;  /* exception not deffered */
-	v->present.ps = PAGE_WIDTH;
-	v->present.key = 0;
-	v->present.tag.tag_word = tag;
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/mm/tlb.c
===================================================================
--- kernel/arch/ia64/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,815 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-/*
- * TLB management.
- */
-
-#include <mm/tlb.h>
-#include <mm/asid.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/page.h>
-#include <arch/mm/vhpt.h>
-#include <barrier.h>
-#include <arch/interrupt.h>
-#include <arch/pal/pal.h>
-#include <arch/asm.h>
-#include <assert.h>
-#include <panic.h>
-#include <arch.h>
-#include <interrupt.h>
-#include <arch/legacyio.h>
-
-/** Invalidate all TLB entries. */
-void tlb_invalidate_all(void)
-{
-	ipl_t ipl;
-	uintptr_t adr;
-	uint32_t count1, count2, stride1, stride2;
-
-	unsigned int i, j;
-
-	adr = PAL_PTCE_INFO_BASE();
-	count1 = PAL_PTCE_INFO_COUNT1();
-	count2 = PAL_PTCE_INFO_COUNT2();
-	stride1 = PAL_PTCE_INFO_STRIDE1();
-	stride2 = PAL_PTCE_INFO_STRIDE2();
-
-	ipl = interrupts_disable();
-
-	for (i = 0; i < count1; i++) {
-		for (j = 0; j < count2; j++) {
-			asm volatile (
-			    "ptc.e %[adr] ;;"
-			    :: [adr] "r" (adr)
-			);
-			adr += stride2;
-		}
-		adr += stride1;
-	}
-
-	interrupts_restore(ipl);
-
-	srlz_d();
-	srlz_i();
-
-#ifdef CONFIG_VHPT
-	vhpt_invalidate_all();
-#endif
-}
-
-/** Invalidate entries belonging to an address space.
- *
- * @param asid Address space identifier.
- *
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	tlb_invalidate_all();
-}
-
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	region_register_t rr;
-	bool restore_rr = false;
-	int b = 0;
-	int c = cnt;
-
-	uintptr_t va;
-	va = page;
-
-	rr.word = rr_read(VA2VRN(page));
-	if ((restore_rr = (rr.map.rid != ASID2RID(asid, VA2VRN(page))))) {
-		/*
-		 * The selected region register does not contain required RID.
-		 * Save the old content of the register and replace the RID.
-		 */
-		region_register_t rr0;
-
-		rr0 = rr;
-		rr0.map.rid = ASID2RID(asid, VA2VRN(page));
-		rr_write(VA2VRN(page), rr0.word);
-		srlz_d();
-		srlz_i();
-	}
-
-	while (c >>= 1)
-		b++;
-	b >>= 1;
-	uint64_t ps;
-
-	switch (b) {
-	case 0: /* cnt 1 - 3 */
-		ps = PAGE_WIDTH;
-		break;
-	case 1: /* cnt 4 - 15 */
-		ps = PAGE_WIDTH + 2;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 2: /* cnt 16 - 63 */
-		ps = PAGE_WIDTH + 4;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 3: /* cnt 64 - 255 */
-		ps = PAGE_WIDTH + 6;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 4: /* cnt 256 - 1023 */
-		ps = PAGE_WIDTH + 8;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 5: /* cnt 1024 - 4095 */
-		ps = PAGE_WIDTH + 10;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 6: /* cnt 4096 - 16383 */
-		ps = PAGE_WIDTH + 12;
-		va &= ~((1UL << ps) - 1);
-		break;
-	case 7: /* cnt 16384 - 65535 */
-	case 8: /* cnt 65536 - (256K - 1) */
-		ps = PAGE_WIDTH + 14;
-		va &= ~((1UL << ps) - 1);
-		break;
-	default:
-		ps = PAGE_WIDTH + 18;
-		va &= ~((1UL << ps) - 1);
-		break;
-	}
-
-	for (; va < (page + cnt * PAGE_SIZE); va += (1UL << ps))
-		asm volatile (
-		    "ptc.l %[va], %[ps] ;;"
-		    :: [va] "r" (va),
-		      [ps] "r" (ps << 2)
-		);
-
-	srlz_d();
-	srlz_i();
-
-	if (restore_rr) {
-		rr_write(VA2VRN(page), rr.word);
-		srlz_d();
-		srlz_i();
-	}
-}
-
-/** Insert data into data translation cache.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- *
- */
-void dtc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry)
-{
-	tc_mapping_insert(va, asid, entry, true);
-}
-
-/** Insert data into instruction translation cache.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- */
-void itc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry)
-{
-	tc_mapping_insert(va, asid, entry, false);
-}
-
-/** Insert data into instruction or data translation cache.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- * @param dtc   If true, insert into data translation cache, use
- *              instruction translation cache otherwise.
- *
- */
-void tc_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, bool dtc)
-{
-	region_register_t rr;
-	bool restore_rr = false;
-
-	rr.word = rr_read(VA2VRN(va));
-	if ((restore_rr = (rr.map.rid != ASID2RID(asid, VA2VRN(va))))) {
-		/*
-		 * The selected region register does not contain required RID.
-		 * Save the old content of the register and replace the RID.
-		 */
-		region_register_t rr0;
-
-		rr0 = rr;
-		rr0.map.rid = ASID2RID(asid, VA2VRN(va));
-		rr_write(VA2VRN(va), rr0.word);
-		srlz_d();
-		srlz_i();
-	}
-
-	asm volatile (
-	    "mov r8 = psr ;;\n"
-	    "rsm %[mask] ;;\n"                 /* PSR_IC_MASK */
-	    "srlz.d ;;\n"
-	    "srlz.i ;;\n"
-	    "mov cr.ifa = %[va]\n"             /* va */
-	    "mov cr.itir = %[word1] ;;\n"      /* entry.word[1] */
-	    "cmp.eq p6, p7 = %[dtc], r0 ;;\n"  /* decide between itc and dtc */
-	    "(p6) itc.i %[word0] ;;\n"
-	    "(p7) itc.d %[word0] ;;\n"
-	    "mov psr.l = r8 ;;\n"
-	    "srlz.d ;;\n"
-	    :: [mask] "i" (PSR_IC_MASK),
-	      [va] "r" (va),
-	      [word0] "r" (entry.word[0]),
-	      [word1] "r" (entry.word[1]),
-	      [dtc] "r" (dtc)
-	    : "p6", "p7", "r8"
-	);
-
-	if (restore_rr) {
-		rr_write(VA2VRN(va), rr.word);
-		srlz_d();
-		srlz_i();
-	}
-}
-
-/** Insert data into instruction translation register.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- * @param tr    Translation register.
- *
- */
-void itr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, size_t tr)
-{
-	tr_mapping_insert(va, asid, entry, false, tr);
-}
-
-/** Insert data into data translation register.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- * @param tr    Translation register.
- *
- */
-void dtr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, size_t tr)
-{
-	tr_mapping_insert(va, asid, entry, true, tr);
-}
-
-/** Insert data into instruction or data translation register.
- *
- * @param va    Virtual page address.
- * @param asid  Address space identifier.
- * @param entry The rest of TLB entry as required by TLB insertion
- *              format.
- * @param dtr   If true, insert into data translation register, use
- *              instruction translation register otherwise.
- * @param tr    Translation register.
- *
- */
-void tr_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry, bool dtr,
-    size_t tr)
-{
-	region_register_t rr;
-	bool restore_rr = false;
-
-	rr.word = rr_read(VA2VRN(va));
-	if ((restore_rr = (rr.map.rid != ASID2RID(asid, VA2VRN(va))))) {
-		/*
-		 * The selected region register does not contain required RID.
-		 * Save the old content of the register and replace the RID.
-		 */
-		region_register_t rr0;
-
-		rr0 = rr;
-		rr0.map.rid = ASID2RID(asid, VA2VRN(va));
-		rr_write(VA2VRN(va), rr0.word);
-		srlz_d();
-		srlz_i();
-	}
-
-	asm volatile (
-	    "mov r8 = psr ;;\n"
-	    "rsm %[mask] ;;\n"                       /* PSR_IC_MASK */
-	    "srlz.d ;;\n"
-	    "srlz.i ;;\n"
-	    "mov cr.ifa = %[va]\n"                   /* va */
-	    "mov cr.itir = %[word1] ;;\n"            /* entry.word[1] */
-	    "cmp.eq p6, p7 = %[dtr], r0 ;;\n"        /* decide between itr and dtr */
-	    "(p6) itr.i itr[%[tr]] = %[word0] ;;\n"
-	    "(p7) itr.d dtr[%[tr]] = %[word0] ;;\n"
-	    "mov psr.l = r8 ;;\n"
-	    "srlz.d ;;\n"
-	    :: [mask] "i" (PSR_IC_MASK),
-	      [va] "r" (va),
-	      [word1] "r" (entry.word[1]),
-	      [word0] "r" (entry.word[0]),
-	      [tr] "r" (tr),
-	      [dtr] "r" (dtr)
-	    : "p6", "p7", "r8"
-	);
-
-	if (restore_rr) {
-		rr_write(VA2VRN(va), rr.word);
-		srlz_d();
-		srlz_i();
-	}
-}
-
-/** Insert data into DTLB.
- *
- * @param page  Virtual page address including VRN bits.
- * @param frame Physical frame address.
- * @param dtr   If true, insert into data translation register, use data
- *              translation cache otherwise.
- * @param tr    Translation register if dtr is true, ignored otherwise.
- *
- */
-void dtlb_kernel_mapping_insert(uintptr_t page, uintptr_t frame, bool dtr,
-    size_t tr)
-{
-	tlb_entry_t entry;
-
-	entry.word[0] = 0;
-	entry.word[1] = 0;
-
-	entry.p = true;           /* present */
-	entry.ma = MA_WRITEBACK;
-	entry.a = true;           /* already accessed */
-	entry.d = true;           /* already dirty */
-	entry.pl = PL_KERNEL;
-	entry.ar = AR_READ | AR_WRITE;
-	entry.ppn = frame >> PPN_SHIFT;
-	entry.ps = PAGE_WIDTH;
-
-	if (dtr)
-		dtr_mapping_insert(page, ASID_KERNEL, entry, tr);
-	else
-		dtc_mapping_insert(page, ASID_KERNEL, entry);
-}
-
-/** Purge kernel entries from DTR.
- *
- * Purge DTR entries used by the kernel.
- *
- * @param page  Virtual page address including VRN bits.
- * @param width Width of the purge in bits.
- *
- */
-void dtr_purge(uintptr_t page, size_t width)
-{
-	asm volatile (
-	    "ptr.d %[page], %[width]\n"
-	    :: [page] "r" (page),
-	      [width] "r" (width << 2)
-	);
-}
-
-/** Copy content of PTE into data translation cache.
- *
- * @param t PTE.
- *
- */
-void dtc_pte_copy(pte_t *t)
-{
-	tlb_entry_t entry;
-
-	entry.word[0] = 0;
-	entry.word[1] = 0;
-
-	entry.p = t->p;
-	entry.ma = t->c ? MA_WRITEBACK : MA_UNCACHEABLE;
-	entry.a = t->a;
-	entry.d = t->d;
-	entry.pl = t->k ? PL_KERNEL : PL_USER;
-	entry.ar = t->w ? AR_WRITE : AR_READ;
-	entry.ppn = t->frame >> PPN_SHIFT;
-	entry.ps = PAGE_WIDTH;
-
-	dtc_mapping_insert(t->page, t->as->asid, entry);
-
-#ifdef CONFIG_VHPT
-	vhpt_mapping_insert(t->page, t->as->asid, entry);
-#endif
-}
-
-/** Copy content of PTE into instruction translation cache.
- *
- * @param t PTE.
- *
- */
-void itc_pte_copy(pte_t *t)
-{
-	tlb_entry_t entry;
-
-	entry.word[0] = 0;
-	entry.word[1] = 0;
-
-	assert(t->x);
-
-	entry.p = t->p;
-	entry.ma = t->c ? MA_WRITEBACK : MA_UNCACHEABLE;
-	entry.a = t->a;
-	entry.pl = t->k ? PL_KERNEL : PL_USER;
-	entry.ar = t->x ? (AR_EXECUTE | AR_READ) : AR_READ;
-	entry.ppn = t->frame >> PPN_SHIFT;
-	entry.ps = PAGE_WIDTH;
-
-	itc_mapping_insert(t->page, t->as->asid, entry);
-
-#ifdef CONFIG_VHPT
-	vhpt_mapping_insert(t->page, t->as->asid, entry);
-#endif
-}
-
-static bool is_kernel_fault(istate_t *istate, uintptr_t va)
-{
-	region_register_t rr;
-
-	if (istate_from_uspace(istate))
-		return false;
-
-	rr.word = rr_read(VA2VRN(va));
-	rid_t rid = rr.map.rid;
-	return (RID2ASID(rid) == ASID_KERNEL) && (VA2VRN(va) == VRN_KERNEL);
-}
-
-/** Instruction TLB fault handler for faults with VHPT turned off.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void alternate_instruction_tlb_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-
-	assert(istate_from_uspace(istate));
-
-	va = istate->cr_ifa; /* faulting address */
-
-	bool found = page_mapping_find(AS, va, true, &t);
-	if (found) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in software page hash table.
-		 * Insert it into data translation cache.
-		 */
-		itc_pte_copy(&t);
-	} else {
-		/*
-		 * Forward the page fault to address space page fault handler.
-		 */
-		as_page_fault(va, PF_ACCESS_EXEC, istate);
-	}
-}
-
-static int is_io_page_accessible(int page)
-{
-	if (TASK->arch.iomap)
-		return bitmap_get(TASK->arch.iomap, page);
-	else
-		return 0;
-}
-
-/**
- * There is special handling of memory mapped legacy io, because of 4KB sized
- * access for userspace.
- *
- * @param va     Virtual address of page fault.
- * @param istate Structure with saved interruption state.
- *
- * @return One on success, zero on failure.
- *
- */
-static int try_memmap_io_insertion(uintptr_t va, istate_t *istate)
-{
-	if ((va >= LEGACYIO_USER_BASE) && (va < LEGACYIO_USER_BASE + (1 << LEGACYIO_PAGE_WIDTH))) {
-		if (TASK) {
-			uint64_t io_page = (va & ((1 << LEGACYIO_PAGE_WIDTH) - 1)) >>
-			    LEGACYIO_SINGLE_PAGE_WIDTH;
-
-			if (is_io_page_accessible(io_page)) {
-				uint64_t page, frame;
-
-				page = LEGACYIO_USER_BASE +
-				    (1 << LEGACYIO_SINGLE_PAGE_WIDTH) * io_page;
-				frame = LEGACYIO_PHYS_BASE +
-				    (1 << LEGACYIO_SINGLE_PAGE_WIDTH) * io_page;
-
-				tlb_entry_t entry;
-
-				entry.word[0] = 0;
-				entry.word[1] = 0;
-
-				entry.p = true;             /* present */
-				entry.ma = MA_UNCACHEABLE;
-				entry.a = true;             /* already accessed */
-				entry.d = true;             /* already dirty */
-				entry.pl = PL_USER;
-				entry.ar = AR_READ | AR_WRITE;
-				entry.ppn = frame >> PPN_SHIFT;
-				entry.ps = LEGACYIO_SINGLE_PAGE_WIDTH;
-
-				dtc_mapping_insert(page, TASK->as->asid, entry);
-				return 1;
-			} else {
-				fault_if_from_uspace(istate,
-				    "IO access fault at %p.", (void *) va);
-			}
-		}
-	}
-
-	return 0;
-}
-
-/** Data TLB fault handler for faults with VHPT turned off.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void alternate_data_tlb_fault(unsigned int n, istate_t *istate)
-{
-	if (istate->cr_isr.sp) {
-		/*
-		 * Speculative load. Deffer the exception until a more clever
-		 * approach can be used. Currently if we try to find the
-		 * mapping for the speculative load while in the kernel, we
-		 * might introduce a livelock because of the possibly invalid
-		 * values of the address.
-		 */
-		istate->cr_ipsr.ed = true;
-		return;
-	}
-
-	uintptr_t va = istate->cr_ifa;  /* faulting address */
-	as_t *as = AS;
-
-	if (is_kernel_fault(istate, va)) {
-		if (va < end_of_identity) {
-			/*
-			 * Create kernel identity mapping for low memory.
-			 */
-			dtlb_kernel_mapping_insert(va, KA2PA(va), false, 0);
-			return;
-		} else {
-			as = AS_KERNEL;
-		}
-	}
-
-	pte_t t;
-	bool found = page_mapping_find(as, va, true, &t);
-	if (found) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table.
-		 * Insert it into data translation cache.
-		 */
-		dtc_pte_copy(&t);
-	} else {
-		if (try_memmap_io_insertion(va, istate))
-			return;
-
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(va, PF_ACCESS_READ, istate);
-	}
-}
-
-/** Data nested TLB fault handler.
- *
- * This fault should not occur.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void data_nested_tlb_fault(unsigned int n, istate_t *istate)
-{
-	assert(false);
-}
-
-/** Data Dirty bit fault handler.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void data_dirty_bit_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-	as_t *as = AS;
-
-	va = istate->cr_ifa;  /* faulting address */
-
-	if (is_kernel_fault(istate, va))
-		as = AS_KERNEL;
-
-	bool found = page_mapping_find(as, va, true, &t);
-
-	assert(found);
-	assert(t.p);
-
-	if (found && t.p && t.w) {
-		/*
-		 * Update the Dirty bit in page tables and reinsert
-		 * the mapping into DTC.
-		 */
-		t.d = true;
-		dtc_pte_copy(&t);
-		page_mapping_update(as, va, true, &t);
-	} else {
-		as_page_fault(va, PF_ACCESS_WRITE, istate);
-	}
-}
-
-/** Instruction access bit fault handler.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void instruction_access_bit_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-
-	assert(istate_from_uspace(istate));
-
-	va = istate->cr_ifa;  /* faulting address */
-
-	bool found = page_mapping_find(AS, va, true, &t);
-
-	assert(found);
-	assert(t.p);
-
-	if (found && t.p && t.x) {
-		/*
-		 * Update the Accessed bit in page tables and reinsert
-		 * the mapping into ITC.
-		 */
-		t.a = true;
-		itc_pte_copy(&t);
-		page_mapping_update(AS, va, true, &t);
-	} else {
-		as_page_fault(va, PF_ACCESS_EXEC, istate);
-	}
-}
-
-/** Data access bit fault handler.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void data_access_bit_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-	as_t *as = AS;
-
-	va = istate->cr_ifa;  /* faulting address */
-
-	if (is_kernel_fault(istate, va))
-		as = AS_KERNEL;
-
-	bool found = page_mapping_find(as, va, true, &t);
-
-	assert(found);
-	assert(t.p);
-
-	if (found && t.p) {
-		/*
-		 * Update the Accessed bit in page tables and reinsert
-		 * the mapping into DTC.
-		 */
-		t.a = true;
-		dtc_pte_copy(&t);
-		page_mapping_update(as, va, true, &t);
-	} else {
-		if (as_page_fault(va, PF_ACCESS_READ, istate) == AS_PF_FAULT) {
-			fault_if_from_uspace(istate, "Page fault at %p.",
-			    (void *) va);
-			panic_memtrap(istate, PF_ACCESS_UNKNOWN, va, NULL);
-		}
-	}
-}
-
-/** Data access rights fault handler.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void data_access_rights_fault(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-
-	assert(istate_from_uspace(istate));
-
-	va = istate->cr_ifa;  /* faulting address */
-
-	/*
-	 * Assume a write to a read-only page.
-	 */
-	bool found = page_mapping_find(AS, va, true, &t);
-
-	assert(found);
-	assert(t.p);
-	assert(!t.w);
-
-	as_page_fault(va, PF_ACCESS_WRITE, istate);
-}
-
-/** Page not present fault handler.
- *
- * @param n Interruption vector.
- * @param istate Structure with saved interruption state.
- *
- */
-void page_not_present(unsigned int n, istate_t *istate)
-{
-	uintptr_t va;
-	pte_t t;
-
-	assert(istate_from_uspace(istate));
-
-	va = istate->cr_ifa;  /* faulting address */
-
-	bool found = page_mapping_find(AS, va, true, &t);
-
-	assert(found);
-
-	if (t.p) {
-		/*
-		 * If the Present bit is set in page hash table, just copy it
-		 * and update ITC/DTC.
-		 */
-		if (t.x)
-			itc_pte_copy(&t);
-		else
-			dtc_pte_copy(&t);
-	} else {
-		as_page_fault(va, PF_ACCESS_READ, istate);
-	}
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/mm/vhpt.c
===================================================================
--- kernel/arch/ia64/src/mm/vhpt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_mm
- * @{
- */
-/** @file
- */
-
-#include <memw.h>
-#include <arch/barrier.h>
-#include <arch/mm/vhpt.h>
-#include <mm/frame.h>
-
-static vhpt_entry_t *vhpt_base;
-
-uintptr_t vhpt_set_up(void)
-{
-	uintptr_t vhpt_frame =
-	    frame_alloc(SIZE2FRAMES(VHPT_SIZE), FRAME_LOWMEM | FRAME_ATOMIC, 0);
-	if (!vhpt_frame)
-		panic("Kernel configured with VHPT but no memory for table.");
-
-	vhpt_base = (vhpt_entry_t *) PA2KA(vhpt_frame);
-	vhpt_invalidate_all();
-	return (uintptr_t) vhpt_base;
-}
-
-void vhpt_mapping_insert(uintptr_t va, asid_t asid, tlb_entry_t entry)
-{
-	region_register_t rr_save, rr;
-	size_t vrn;
-	rid_t rid;
-	uint64_t tag;
-
-	vhpt_entry_t *ventry;
-
-	vrn = va >> VRN_SHIFT;
-	rid = ASID2RID(asid, vrn);
-
-	rr_save.word = rr_read(vrn);
-	rr.word = rr_save.word;
-	rr.map.rid = rid;
-	rr_write(vrn, rr.word);
-	srlz_i();
-
-	ventry = (vhpt_entry_t *) thash(va);
-	tag = ttag(va);
-	rr_write(vrn, rr_save.word);
-	srlz_i();
-	srlz_d();
-
-	ventry->word[0] = entry.word[0];
-	ventry->word[1] = entry.word[1];
-	ventry->present.tag.tag_word = tag;
-}
-
-void vhpt_invalidate_all(void)
-{
-	memsetb(vhpt_base, VHPT_SIZE, 0);
-}
-
-void vhpt_invalidate_asid(asid_t asid)
-{
-	vhpt_invalidate_all();
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/proc/scheduler.c
===================================================================
--- kernel/arch/ia64/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <arch/register.h>
-#include <arch/context.h>
-#include <arch/stack.h>
-#include <arch/mm/tlb.h>
-#include <config.h>
-#include <align.h>
-
-/** Perform ia64 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Prepare kernel stack pointers in bank 0 r22 and r23 and make sure the stack
- * is mapped in DTR.
- */
-void before_thread_runs_arch(void)
-{
-	uintptr_t base;
-
-	base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
-
-	if ((uintptr_t) THREAD->kstack < base ||
-	    (uintptr_t) THREAD->kstack > base + (1 << (KERNEL_PAGE_WIDTH))) {
-		/*
-		 * Kernel stack of this thread is not mapped by DTR[TR_KERNEL].
-		 * Use DTR[TR_KSTACK1] and DTR[TR_KSTACK2] to map it.
-		 */
-
-		/* purge DTR[TR_STACK1] and DTR[TR_STACK2] */
-		dtr_purge((uintptr_t) THREAD->kstack, PAGE_WIDTH + 1);
-
-		/* insert DTR[TR_STACK1] and DTR[TR_STACK2] */
-		dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack,
-		    KA2PA(THREAD->kstack), true, DTR_KSTACK1);
-		dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack +
-		    PAGE_SIZE, KA2PA(THREAD->kstack) + FRAME_SIZE, true,
-		    DTR_KSTACK2);
-	}
-
-	/*
-	 * Record address of kernel backing store to bank 0 r22.
-	 * Record address of kernel stack to bank 0 r23.
-	 * These values will be found there after switch from userspace.
-	 *
-	 * Mind the 1:1 split of the entire STACK_SIZE long region between the
-	 * memory stack and the RSE stack.
-	 */
-	asm volatile (
-	    "bsw.0\n"
-	    "mov r22 = %0\n"
-	    "mov r23 = %1\n"
-	    "bsw.1\n"
-	    :
-	    : "r" (&THREAD->kstack[STACK_SIZE / 2]),
-	      "r" (&THREAD->kstack[STACK_SIZE / 2])
-	);
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/ia64/src/smc.c
===================================================================
--- kernel/arch/ia64/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-#include <arch/barrier.h>
-
-#define FC_INVAL_MIN		32
-
-void smc_coherence(void *a, size_t l)
-{
-	unsigned long i;
-	for (i = 0; i < (l); i += FC_INVAL_MIN)
-		fc_i(a + i);
-	sync_i();
-	srlz_i();
-}
Index: rnel/arch/ia64/src/smp/smp.c
===================================================================
--- kernel/arch/ia64/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia64
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-#include <smp/ipi.h>
-
-#ifdef CONFIG_SMP
-
-void ipi_broadcast_arch(int ipi)
-{
-}
-
-void smp_init(void)
-{
-}
-
-void kmp(void *arg __attribute__((unused)))
-{
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ia64/src/start.S
===================================================================
--- kernel/arch/ia64/src/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/register.h>
-#include <arch/mm/page.h>
-#include <arch/mm/asid.h>
-#include <mm/asid.h>
-
-#define RR_MASK    (0xFFFFFFFF00000002)
-#define RID_SHIFT  8
-#define PS_SHIFT   2
-
-#define KERNEL_TRANSLATION_I    0x0010000000000661
-#define KERNEL_TRANSLATION_D    0x0010000000000661
-
-.section K_TEXT_START, "ax"
-
-stack0:
-
-#
-# Kernel entry point.
-#
-# This is where we are passed control from the boot code.
-# Register contents:
-#
-#	r2	Address of the boot code's bootinfo structure.
-#
-SYMBOL(kernel_image_start)
-	.auto
-
-	mov psr.l = r0
-	srlz.i
-	srlz.d
-
-	# Fill TR.i and TR.d using Region Register #VRN_KERNEL
-
-	movl r8 = (VRN_KERNEL << VRN_SHIFT)
-	mov r9 = rr[r8]
-
-	movl r10 = (RR_MASK)
-	and r9 = r10, r9
-	movl r10 = (((RID_KERNEL7) << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))
-	or r9 = r10, r9
-
-	mov rr[r8] = r9
-
-	movl r8 = (VRN_KERNEL << VRN_SHIFT)
-	mov cr.ifa = r8
-
-	mov r11 = cr.itir
-	movl r10 = (KERNEL_PAGE_WIDTH << PS_SHIFT)
-	or r10 = r10, r11
-	mov cr.itir = r10
-
-	movl r10 = (KERNEL_TRANSLATION_I)
-	itr.i itr[r0] = r10
-	movl r10 = (KERNEL_TRANSLATION_D)
-	itr.d dtr[r0] = r10
-
-	# Initialize DCR
-
-	movl r10 = (DCR_DM_MASK | DCR_DP_MASK | DCR_DK_MASK | DCR_DX_MASK | DCR_DR_MASK | DCR_DA_MASK | DCR_DD_MASK | DCR_LC_MASK)
-	mov r9 = cr.dcr
-	or r10 = r10, r9
-	mov cr.dcr = r10
-
-	# Initialize PSR
-
-	movl r10 = (PSR_DT_MASK | PSR_RT_MASK | PSR_IT_MASK | PSR_IC_MASK)  /* Enable paging */
-	mov r9 = psr
-
-	or r10 = r10, r9
-	mov cr.ipsr = r10
-	mov cr.ifs = r0
-	movl r8 = paging_start
-	mov cr.iip = r8
-	srlz.d
-	srlz.i
-
-	.explicit
-
-	/*
-	 * Return From Interrupt is the only way to
-	 * fill the upper half word of PSR.
-	 */
-	rfi ;;
-
-paging_start:
-
-	/*
-	 * Now we are paging.
-	 */
-
-	#
-	# Set Interruption Vector Address
-	# (i.e. location of interruption vector table)
-	#
-	movl r8 = ivt ;;
-	mov cr.iva = r8
-	srlz.d ;;
-
-
-	# Switch to register bank 1
-	bsw.1
-
-	# Initialize register stack
-	mov ar.rsc = r0
-	movl r8 = (VRN_KERNEL << VRN_SHIFT) ;;
-	mov ar.bspstore = r8
-	loadrs
-
-	#
-	# Initialize memory stack to some sane value and allocate a scratch area
-	# on it.
-	#
-	movl sp = stack0 ;;
-	add sp = -16, sp
-
-	# Initialize gp (Global Pointer) register
-	movl gp = __gp
-
-	#
-	# Initialize bootinfo on BSP.
-	#
-	movl r20 = (VRN_KERNEL << VRN_SHIFT) ;;
-	or r20 = r20, r2 ;;
-	addl r21 = @gprel(bootinfo), gp ;;
-	st8 [r21] = r20
-
-	ssm (1 << 19) ;; /* Disable f32 - f127 */
-	srlz.i
-	srlz.d ;;
-
-	br.call.sptk.many b0 = ia64_pre_main
-0:
-	br.call.sptk.many b0 = main_bsp
-0:
-	br 0b
Index: rnel/arch/mips32/_link.ld.in
===================================================================
--- kernel/arch/mips32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * MIPS32 linker script
- *
- *  kernel text
- *  kernel data
- *
- */
-
-#undef mips
-#define mips mips
-
-#if defined(MACHINE_msim)
-#define KERNEL_LOAD_ADDRESS 0x80100000
-#endif
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-#define KERNEL_LOAD_ADDRESS 0x80200000
-#endif
-
-OUTPUT_ARCH(mips)
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	. = KERNEL_LOAD_ADDRESS;
-	kernel_load_address = .;
-	. = . + SIZEOF_HEADERS;
-
-	.text : {
-		ktext_start = .;
-		/* FIXME: for some reason, mixing .text with .text.* produces a crash on malta-be */
-		*(.text);
-		*(.text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		*(.data .data.*);                       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.reginfo);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);                        /* uninitialized static variables */
-		*(COMMON);                      /* global variables */
-	}
-
-	_gp = . + 0x8000;
-	.lit8 : { *(.lit8) }
-	.lit4 : { *(.lit4) }
-
-	kdata_end = .;
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note);
-	}
-}
Index: rnel/arch/mips32/include/arch/arch.h
===================================================================
--- kernel/arch/mips32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_ARCH_H_
-#define KERN_mips32_ARCH_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#define TASKMAP_MAX_RECORDS        32
-#define CPUMAP_MAX_RECORDS         32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-#define BOOTINFO_BOOTARGS_BUFLEN   256
-
-extern size_t cpu_count;
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-extern size_t sdram_size;
-#endif
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	uint32_t sdram_size;
-#endif
-	uint32_t cpumap;
-	taskmap_t taskmap;
-	char bootargs[BOOTINFO_BOOTARGS_BUFLEN];
-} bootinfo_t;
-
-extern void mips32_pre_main(void *entry, bootinfo_t *bootinfo);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/asm.h
===================================================================
--- kernel/arch/mips32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_ASM_H_
-#define KERN_mips32_ASM_H_
-
-#include <typedefs.h>
-#include <config.h>
-#include <trace.h>
-
-_NO_TRACE static inline void cpu_sleep(void)
-{
-	asm volatile ("wait");
-}
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	return *port;
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void asm_delay_loop(uint32_t);
-extern void userspace_asm(uintptr_t, uintptr_t);
-
-extern ipl_t interrupts_disable(void);
-extern ipl_t interrupts_enable(void);
-extern void interrupts_restore(ipl_t);
-extern ipl_t interrupts_read(void);
-extern bool interrupts_disabled(void);
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this atomically
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/asm/boot.h
===================================================================
--- kernel/arch/mips32/include/arch/asm/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_BOOT_H_
-#define KERN_mips32_BOOT_H_
-
-/* Temporary stack size for boot process */
-#define TEMP_STACK_SIZE  0x100
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/asm/regname.h
===================================================================
--- kernel/arch/mips32/include/arch/asm/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_REGNAME_H_
-#define KERN_mips32_REGNAME_H_
-
-#define zero    0
-#define at      1
-#define v0      2
-#define v1      3
-#define a0      4
-#define a1      5
-#define a2      6
-#define a3      7
-#define t0      8
-#define t1      9
-#define t2      10
-#define t3      11
-#define t4      12
-#define t5      13
-#define t6      14
-#define t7      15
-#define s0      16
-#define s1      17
-#define s2      18
-#define s3      19
-#define s4      20
-#define s5      21
-#define s6      22
-#define s7      23
-#define t8      24
-#define t9      25
-#define k0      26
-#define k1      27
-#define gp      28
-#define sp      29
-#define s8      30
-#define ra      31
-
-#define rindex    0
-#define rrandom   1
-#define entrylo0  2
-#define entrylo1  3
-#define context   4
-#define pagemask  5
-#define wired     6
-#define badvaddr  8
-#define count     9
-#define entryhi   10
-#define compare   11
-#define status    12
-#define cause     13
-#define epc       14
-#define rconfig   16
-#define lladdr    17
-#define watchlo   18
-#define watchhi   19
-#define xcontext  20
-#define rdebug    23
-#define depc      24
-#define eepc      30
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/cache.h
===================================================================
--- kernel/arch/mips32/include/arch/cache.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_CACHE_H_
-#define KERN_mips32_CACHE_H_
-
-#include <arch/exception.h>
-
-extern void cache_error(istate_t *istate);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/context.h
===================================================================
--- kernel/arch/mips32/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_CONTEXT_H_
-#define KERN_mips32_CONTEXT_H_
-
-#include <align.h>
-#include <arch/stack.h>
-#include <arch/context_struct.h>
-
-/*
- * Put one item onto the stack to support CURRENT and align it up.
- */
-#define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-#define context_set(ctx, pc, stack, size) \
-    context_set_generic(ctx, pc, stack, size)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/context_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP  0x00
-#define CONTEXT_OFFSET_PC  0x04
-#define CONTEXT_OFFSET_S0  0x08
-#define CONTEXT_OFFSET_S1  0x0c
-#define CONTEXT_OFFSET_S2  0x10
-#define CONTEXT_OFFSET_S3  0x14
-#define CONTEXT_OFFSET_S4  0x18
-#define CONTEXT_OFFSET_S5  0x1c
-#define CONTEXT_OFFSET_S6  0x20
-#define CONTEXT_OFFSET_S7  0x24
-#define CONTEXT_OFFSET_S8  0x28
-#define CONTEXT_OFFSET_GP  0x2c
-#define CONTEXT_OFFSET_TP  0x30
-#define CONTEXT_SIZE       0x34
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct context {
-	/* Only save registers that must be preserved across function calls. */
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t s0;
-	uint32_t s1;
-	uint32_t s2;
-	uint32_t s3;
-	uint32_t s4;
-	uint32_t s5;
-	uint32_t s6;
-	uint32_t s7;
-	uint32_t s8;
-	uint32_t gp;
-	/* We use the K1 register for userspace thread pointer. */
-	uint32_t tp;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/mips32/include/arch/cp0.h
===================================================================
--- kernel/arch/mips32/include/arch/cp0.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_CP0_H_
-#define KERN_mips32_CP0_H_
-
-#include <stdint.h>
-
-#define cp0_status_ie_enabled_bit     (1 << 0)
-#define cp0_status_exl_exception_bit  (1 << 1)
-#define cp0_status_erl_error_bit      (1 << 2)
-#define cp0_status_um_bit             (1 << 4)
-#define cp0_status_bev_bootstrap_bit  (1 << 22)
-#define cp0_status_fpu_bit            (1 << 29)
-
-#define cp0_status_im_shift  8
-#define cp0_status_im_mask   0xff00
-
-#define cp0_cause_ip_shift  8
-#define cp0_cause_ip_mask   0xff00
-
-#define cp0_cause_excno(cause)   ((cause >> 2) & 0x1f)
-#define cp0_cause_coperr(cause)  ((cause >> 28) & 0x3)
-
-#define fpu_cop_id  1
-
-/*
- * Magic value for use in msim.
- */
-#define cp0_compare_value  100000
-
-#define cp0_mask_all_int() \
-	cp0_status_write(cp0_status_read() & ~(cp0_status_im_mask))
-
-#define cp0_unmask_all_int() \
-	cp0_status_write(cp0_status_read() | cp0_status_im_mask)
-
-#define cp0_mask_int(it) \
-	cp0_status_write(cp0_status_read() & ~(1 << (cp0_status_im_shift + (it))))
-
-#define cp0_unmask_int(it) \
-	cp0_status_write(cp0_status_read() | (1 << (cp0_status_im_shift + (it))))
-
-#define GEN_READ_CP0(nm, reg) \
-	static inline uint32_t cp0_ ##nm##_read(void) \
-	{ \
-		uint32_t retval; \
-		\
-		asm volatile ( \
-			"mfc0 %0, $" #reg \
-			: "=r"(retval) \
-		); \
-		\
-		return retval; \
-	}
-
-#define GEN_WRITE_CP0(nm, reg) \
-	static inline void cp0_ ##nm##_write(uint32_t val) \
-	{ \
-		asm volatile ( \
-			"mtc0 %0, $" #reg \
-			:: "r"(val) \
-		); \
-	}
-
-GEN_READ_CP0(index, 0);
-GEN_WRITE_CP0(index, 0);
-
-GEN_READ_CP0(random, 1);
-
-GEN_READ_CP0(entry_lo0, 2);
-GEN_WRITE_CP0(entry_lo0, 2);
-
-GEN_READ_CP0(entry_lo1, 3);
-GEN_WRITE_CP0(entry_lo1, 3);
-
-GEN_READ_CP0(context, 4);
-GEN_WRITE_CP0(context, 4);
-
-GEN_READ_CP0(pagemask, 5);
-GEN_WRITE_CP0(pagemask, 5);
-
-GEN_READ_CP0(wired, 6);
-GEN_WRITE_CP0(wired, 6);
-
-GEN_READ_CP0(badvaddr, 8);
-
-GEN_READ_CP0(count, 9);
-GEN_WRITE_CP0(count, 9);
-
-GEN_READ_CP0(entry_hi, 10);
-GEN_WRITE_CP0(entry_hi, 10);
-
-GEN_READ_CP0(compare, 11);
-GEN_WRITE_CP0(compare, 11);
-
-GEN_READ_CP0(status, 12);
-GEN_WRITE_CP0(status, 12);
-
-GEN_READ_CP0(cause, 13);
-GEN_WRITE_CP0(cause, 13);
-
-GEN_READ_CP0(epc, 14);
-GEN_WRITE_CP0(epc, 14);
-
-GEN_READ_CP0(prid, 15);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/cpu.h
===================================================================
--- kernel/arch/mips32/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_CPU_H_
-#define KERN_mips32_CPU_H_
-
-#include <arch/asm.h>
-#include <stdint.h>
-
-typedef struct {
-	uint32_t imp_num;
-	uint32_t rev_num;
-} cpu_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/cycle.h
===================================================================
--- kernel/arch/mips32/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_CYCLE_H_
-#define KERN_mips32_CYCLE_H_
-
-#include <arch/cp0.h>
-#include <arch/interrupt.h>
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	return ((uint64_t) count_hi << 32) + ((uint64_t) cp0_count_read());
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/debug.h
===================================================================
--- kernel/arch/mips32/include/arch/debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_DEBUG_H_
-#define KERN_mips32_DEBUG_H_
-
-/** Enter the simulator trace mode */
-#define ___traceon()  asm volatile ( "\t.word\t0x39\n");
-
-/** Leave the simulator trace mode */
-#define ___traceoff()  asm volatile ( "\t.word\t0x3d\n");
-
-/** Ask the simulator to dump registers */
-#define ___regview()  asm volatile ( "\t.word\t0x37\n");
-
-/** Halt the simulator */
-#define ___halt()  asm volatile ( "\t.word\t0x28\n");
-
-/** Enter the simulator interactive mode */
-#define ___intmode()  asm volatile ( "\t.word\t0x29\n");
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/debugger.h
===================================================================
--- kernel/arch/mips32/include/arch/debugger.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_DEBUGGER_H_
-#define KERN_mips32_DEBUGGER_H_
-
-#include <arch/exception.h>
-#include <typedefs.h>
-#include <stdbool.h>
-
-#define BKPOINTS_MAX 10
-
-/** Breakpoint was shot */
-#define BKPOINT_INPROG  (1 << 0)
-
-/** One-time breakpoint, mandatory for j/b instructions */
-#define BKPOINT_ONESHOT  (1 << 1)
-
-/**
- * Breakpoint is set on the next instruction, so that it
- * could be reinstalled on the previous one
- */
-#define BKPOINT_REINST  (1 << 2)
-
-/** Call a predefined function */
-#define BKPOINT_FUNCCALL  (1 << 3)
-
-typedef struct  {
-	uintptr_t address;         /**< Breakpoint address */
-	sysarg_t instruction;      /**< Original instruction */
-	sysarg_t nextinstruction;  /**< Original instruction following break */
-	unsigned int flags;        /**< Flags regarding breakpoint */
-	size_t counter;
-	void (*bkfunc)(void *, istate_t *);
-} bpinfo_t;
-
-extern bpinfo_t breakpoints[BKPOINTS_MAX];
-
-extern bool is_jump(sysarg_t);
-
-extern void debugger_init(void);
-extern void debugger_bpoint(istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/exception.h
===================================================================
--- kernel/arch/mips32/include/arch/exception.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_EXCEPTION_H_
-#define KERN_mips32_EXCEPTION_H_
-
-#include <arch/istate.h>
-
-#define EXC_Int    0
-#define EXC_Mod    1
-#define EXC_TLBL   2
-#define EXC_TLBS   3
-#define EXC_AdEL   4
-#define EXC_AdES   5
-#define EXC_IBE    6
-#define EXC_DBE    7
-#define EXC_Sys    8
-#define EXC_Bp     9
-#define EXC_RI     10
-#define EXC_CpU    11
-#define EXC_Ov     12
-#define EXC_Tr     13
-#define EXC_VCEI   14
-#define EXC_FPE    15
-#define EXC_WATCH  23
-#define EXC_VCED   31
-
-#define INT_SW0    0
-#define INT_SW1    1
-#define INT_HW0    2
-#define INT_HW1    3
-#define INT_HW2    4
-#define INT_HW3    5
-#define INT_HW4    6
-#define INT_TIMER  7
-
-#define MIPS_INTERRUPTS    8
-#define HW_INTERRUPTS      (MIPS_INTERRUPTS - 3)
-
-typedef void (*int_handler_t)(unsigned int);
-extern int_handler_t int_handler[];
-
-extern void exception(istate_t *istate);
-extern void tlb_refill_entry(void);
-extern void exception_entry(void);
-extern void cache_error_entry(void);
-extern void exception_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/faddr.h
===================================================================
--- kernel/arch/mips32/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_FADDR_H_
-#define KERN_mips32_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/fpu_context.h
===================================================================
--- kernel/arch/mips32/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_FPU_CONTEXT_H_
-#define KERN_mips32_FPU_CONTEXT_H_
-
-#include <typedefs.h>
-#include <arch/fpu_context_struct.h>
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/fpu_context_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/fpu_context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-#define KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-
-#define FPU_CONTEXT_OFFSET_DREGS  0
-#define FPU_CONTEXT_OFFSET_CREGS  128
-#define FPU_CONTEXT_SIZE          256
-
-#define FPU_CONTEXT_SIZE_DREGS 128
-#define FPU_CONTEXT_SIZE_CREGS 128
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct fpu_context {
-	_Alignas(sizeof(sysarg_t)) sysarg_t dregs[32];
-	sysarg_t cregs[32];
-} fpu_context_t;
-
-#endif
-#endif
Index: rnel/arch/mips32/include/arch/interrupt.h
===================================================================
--- kernel/arch/mips32/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_INTERRUPT_H_
-#define KERN_mips32_INTERRUPT_H_
-
-#include <arch/exception.h>
-
-#define IVT_ITEMS  32
-#define IVT_FIRST  0
-
-#define VECTOR_TLB_SHOOTDOWN_IPI  EXC_Int
-
-extern function virtual_timer_fnc;
-extern uint32_t count_hi;
-
-extern void interrupt_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/istate.h
===================================================================
--- kernel/arch/mips32/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_ISTATE_H_
-#define KERN_mips32_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/cp0.h>
-#include <arch/istate_struct.h>
-
-#else /* KERNEL */
-
-#include <libarch/cp0.h>
-#include <libarch/istate_struct.h>
-
-#endif /* KERNEL */
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->epc = retaddr;
-}
-
-/** Return true if exception happened while in userspace */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return istate->status & cp0_status_um_bit;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->epc;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	return istate->sp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/mips32/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_A0         0x00
-#define ISTATE_OFFSET_A1         0x04
-#define ISTATE_OFFSET_A2         0x08
-#define ISTATE_OFFSET_A3         0x0c
-#define ISTATE_OFFSET_T0         0x10
-#define ISTATE_OFFSET_T1         0x14
-#define ISTATE_OFFSET_V0         0x18
-#define ISTATE_OFFSET_V1         0x1c
-#define ISTATE_OFFSET_AT         0x20
-#define ISTATE_OFFSET_T2         0x24
-#define ISTATE_OFFSET_T3         0x28
-#define ISTATE_OFFSET_T4         0x2c
-#define ISTATE_OFFSET_T5         0x30
-#define ISTATE_OFFSET_T6         0x34
-#define ISTATE_OFFSET_T7         0x38
-#define ISTATE_OFFSET_S0         0x3c
-#define ISTATE_OFFSET_S1         0x40
-#define ISTATE_OFFSET_S2         0x44
-#define ISTATE_OFFSET_S3         0x48
-#define ISTATE_OFFSET_S4         0x4c
-#define ISTATE_OFFSET_S5         0x50
-#define ISTATE_OFFSET_S6         0x54
-#define ISTATE_OFFSET_S7         0x58
-#define ISTATE_OFFSET_T8         0x5c
-#define ISTATE_OFFSET_T9         0x60
-#define ISTATE_OFFSET_KT0        0x64
-#define ISTATE_OFFSET_KT1        0x68
-#define ISTATE_OFFSET_GP         0x6c
-#define ISTATE_OFFSET_SP         0x70
-#define ISTATE_OFFSET_S8         0x74
-#define ISTATE_OFFSET_RA         0x78
-#define ISTATE_OFFSET_LO         0x7c
-#define ISTATE_OFFSET_HI         0x80
-#define ISTATE_OFFSET_STATUS     0x84
-#define ISTATE_OFFSET_EPC        0x88
-#define ISTATE_OFFSET_ALIGNMENT  0x8c
-#define ISTATE_SIZE              0x90
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#ifdef KERNEL
-#include <typedefs.h>
-#else
-#include <stddef.h>
-#endif
-
-typedef struct istate {
-	/*
-	 * The first seven registers are arranged so that the istate structure
-	 * can be used both for exception handlers and for the syscall handler.
-	 */
-
-	uint32_t a0;  // arg1
-	uint32_t a1;  // arg2
-	uint32_t a2;  // arg3
-	uint32_t a3;  // arg4
-	uint32_t t0;  // arg5
-	uint32_t t1;  // arg6
-	uint32_t v0;  // arg7
-	uint32_t v1;
-	uint32_t at;
-	uint32_t t2;
-	uint32_t t3;
-	uint32_t t4;
-	uint32_t t5;
-	uint32_t t6;
-	uint32_t t7;
-	uint32_t s0;
-	uint32_t s1;
-	uint32_t s2;
-	uint32_t s3;
-	uint32_t s4;
-	uint32_t s5;
-	uint32_t s6;
-	uint32_t s7;
-	uint32_t t8;
-	uint32_t t9;
-	uint32_t kt0;
-	/* We use it as thread-local pointer */
-	uint32_t kt1;
-	uint32_t gp;
-	uint32_t sp;
-	uint32_t s8;
-	uint32_t ra;
-	uint32_t lo;
-	uint32_t hi;
-	/* cp0_status */
-	uint32_t status;
-	/* cp0_epc */
-	uint32_t epc;
-	/* to make sizeof(istate_t) a multiple of 8 */
-	uint32_t alignment;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/mips32/include/arch/mach/malta/malta.h
===================================================================
--- kernel/arch/mips32/include/arch/mach/malta/malta.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief MIPS Malta platform driver.
- */
-
-#ifndef KERN_mips32_malta_H_
-#define KERN_mips32_malta_H_
-
-#include <arch/machine_func.h>
-#include <arch/mm/page.h>
-#include <typedefs.h>
-
-#define MALTA_PCI_PHYSBASE	0x18000000UL
-
-#define MALTA_PCI_BASE		PA2KSEG1(MALTA_PCI_PHYSBASE)
-#define MALTA_GT64120_BASE	PA2KSEG1(0x1be00000UL)
-
-#define PIC0_BASE		(MALTA_PCI_BASE + 0x20)
-#define PIC1_BASE		(MALTA_PCI_BASE + 0xa0)
-
-#define ISA_IRQ_COUNT		16
-
-#define TTY_BASE		(MALTA_PCI_PHYSBASE + 0x3f8)
-#define TTY_ISA_IRQ		4
-
-#define GT64120_PCI0_INTACK	((ioport32_t *) (MALTA_GT64120_BASE + 0xc34))
-
-extern struct mips32_machine_ops malta_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mach/msim/dorder.h
===================================================================
--- kernel/arch/mips32/include/arch/mach/msim/dorder.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_DORDER_H_
-#define KERN_mips32_DORDER_H_
-
-#include <stdint.h>
-
-extern void dorder_init(void);
-extern uint32_t dorder_cpuid(void);
-extern void dorder_ipi_ack(uint32_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mach/msim/msim.h
===================================================================
--- kernel/arch/mips32/include/arch/mach/msim/msim.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief msim platform driver.
- */
-
-#ifndef KERN_mips32_msim_H_
-#define KERN_mips32_msim_H_
-
-#include <arch/machine_func.h>
-#include <arch/mm/page.h>
-
-/** Address of devices. */
-#define MSIM_VIDEORAM        PA2KSEG1(0x10000000)
-#define MSIM_KBD_ADDRESS     PA2KSEG1(0x10000000)
-#define MSIM_DORDER_ADDRESS  PA2KSEG1(0x10000100)
-
-#define MSIM_KBD_IRQ      2
-#define MSIM_DORDER_IRQ   5
-#define MSIM_DDISK_IRQ    6
-
-extern struct mips32_machine_ops msim_machine_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/machine_func.h
===================================================================
--- kernel/arch/mips32/include/arch/machine_func.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2009 Vineeth Pillai
- * Copyrithg (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief Declarations of machine specific functions.
- *
- *  These functions allow us to support various kinds of mips32 machines
- *  in a unified way.
- */
-
-#ifndef KERN_mips32_MACHINE_FUNC_H_
-#define KERN_mips32_MACHINE_FUNC_H_
-
-#include <typedefs.h>
-#include <stdbool.h>
-
-struct mips32_machine_ops {
-	void (*machine_init)(void);
-	void (*machine_cpu_halt)(void);
-	void (*machine_get_memory_extents)(uintptr_t *, size_t *);
-	void (*machine_frame_init)(void);
-	void (*machine_output_init)(void);
-	void (*machine_input_init)(void);
-	const char *(*machine_get_platform_name)(void);
-};
-
-/** Pointer to mips32_machine_ops structure being used. */
-extern struct mips32_machine_ops *machine_ops;
-
-extern void machine_ops_init(void);
-
-extern void machine_init(void);
-extern void machine_cpu_halt(void);
-extern void machine_get_memory_extents(uintptr_t *, size_t *);
-extern void machine_frame_init(void);
-extern void machine_output_init(void);
-extern void machine_input_init(void);
-extern const char *machine_get_platform_name(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/as.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_AS_H_
-#define KERN_mips32_AS_H_
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/asid.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_ASID_H_
-#define KERN_mips32_ASID_H_
-
-#include <stdint.h>
-
-#define ASID_MAX_ARCH  255    /* 2^8 - 1 */
-
-typedef uint8_t asid_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/frame.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_FRAME_H_
-#define KERN_mips32_FRAME_H_
-
-#define FRAME_WIDTH  14  /* 16K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/km.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_KM_H_
-#define KERN_mips32_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define KM_MIPS32_KSEG0_START	UINT32_C(0x80000000)
-#define KM_MIPS32_KSEG0_SIZE	UINT32_C(0x20000000)
-
-#define KM_MIPS32_KSSEG_START	UINT32_C(0xc0000000)
-#define KM_MIPS32_KSSEG_SIZE	UINT32_C(0x20000000)
-
-#define KM_MIPS32_KSEG3_START	UINT32_C(0xe0000000)
-#define KM_MIPS32_KSEG3_SIZE	UINT32_C(0x20000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/page.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,207 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_PAGE_H_
-#define KERN_mips32_PAGE_H_
-
-#include <arch/mm/frame.h>
-#include <trace.h>
-
-#define PAGE_WIDTH	FRAME_WIDTH
-#define PAGE_SIZE	FRAME_SIZE
-
-#ifndef __ASSEMBLER__
-#	define KSEG12PA(x)	(((uintptr_t) (x)) - 0xa0000000)
-#	define PA2KSEG1(x)	(((uintptr_t) (x)) + 0xa0000000)
-#	define KA2PA(x)	(((uintptr_t) (x)) - 0x80000000)
-#	define PA2KA(x)	(((uintptr_t) (x)) + 0x80000000)
-#else
-#	define KA2PA(x)	((x) - 0x80000000)
-#	define PA2KA(x)	((x) + 0x80000000)
-#endif
-
-/*
- * Implementation of generic 4-level page table interface.
- *
- * Page table layout:
- * - 32-bit virtual addresses
- * - Offset is 14 bits => pages are 16K long
- * - PTE's use similar format as CP0 EntryLo[01] registers => PTE is therefore
- *   4 bytes long
- * - PTE's replace EntryLo v (valid) bit with p (present) bit
- * - PTE's use only one bit to distinguish between cacheable and uncacheable
- *   mappings
- * - PTE's define soft_valid field to ensure there is at least one 1 bit even if
- *   the p bit is cleared
- * - PTE's make use of CP0 EntryLo's two-bit reserved field for bit W (writable)
- *   and bit A (accessed)
- * - PTL0 has 64 entries (6 bits)
- * - PTL1 is not used
- * - PTL2 is not used
- * - PTL3 has 4096 entries (12 bits)
- */
-
-/* Macros describing number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  64
-#define PTL1_ENTRIES_ARCH  0
-#define PTL2_ENTRIES_ARCH  0
-#define PTL3_ENTRIES_ARCH  4096
-
-/* Macros describing size of page tables in each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating entry indices for each level. */
-#define PTL0_INDEX_ARCH(vaddr)  ((vaddr) >> 26)
-#define PTL1_INDEX_ARCH(vaddr)  0
-#define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 14) & 0xfff)
-
-/* Set accessor for PTL0 address. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	(((pte_t *) (ptl0))[(i)].pfn << 12)
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	(ptl1)
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	(ptl2)
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	(((pte_t *) (ptl3))[(i)].pfn << 12)
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].pfn = (a) >> 12)
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	PAGE_PRESENT
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	PAGE_PRESENT
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present bit accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-#define SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT_ARCH(ptl2, i)
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Last-level info macros. */
-#define PTE_VALID_ARCH(pte)		((pte)->soft_valid != 0)
-#define PTE_PRESENT_ARCH(pte)		((pte)->p != 0)
-#define PTE_GET_FRAME_ARCH(pte)		((pte)->pfn << 12)
-#define PTE_WRITABLE_ARCH(pte)		((pte)->w != 0)
-#define PTE_EXECUTABLE_ARCH(pte)	1
-
-#ifndef __ASSEMBLER__
-
-#include <mm/mm.h>
-#include <arch/exception.h>
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned g : 1;			/**< Global bit. */
-	unsigned p : 1;			/**< Present bit. */
-	unsigned d : 1;			/**< Dirty bit. */
-	unsigned cacheable : 1;		/**< Cacheable bit. */
-	unsigned : 1;			/**< Unused. */
-	unsigned soft_valid : 1;	/**< Valid content even if not present. */
-	unsigned pfn : 24;		/**< Physical frame number. */
-	unsigned w : 1;			/**< Page writable bit. */
-	unsigned a : 1;			/**< Accessed bit. */
-} pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	return ((p->cacheable << PAGE_CACHEABLE_SHIFT) |
-	    ((!p->p) << PAGE_PRESENT_SHIFT) |
-	    (1 << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) |
-	    ((p->w) << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) |
-	    (p->g << PAGE_GLOBAL_SHIFT));
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_t *p = &pt[i];
-
-	p->cacheable = (flags & PAGE_CACHEABLE) != 0;
-	p->p = !(flags & PAGE_NOT_PRESENT);
-	p->g = (flags & PAGE_GLOBAL) != 0;
-	p->w = (flags & PAGE_WRITE) != 0;
-
-	/*
-	 * Ensure that valid entries have at least one bit set.
-	 */
-	p->soft_valid = 1;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *p = &pt[i];
-
-	p->p = 1;
-}
-
-extern void page_arch_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_TLB_H_
-#define KERN_mips32_TLB_H_
-
-#include <arch/mm/asid.h>
-#include <arch/exception.h>
-#include <stdbool.h>
-#include <trace.h>
-#include <typedefs.h>
-
-#if defined(PROCESSOR_R4000)
-#define TLB_ENTRY_COUNT  48
-#define TLB_INDEX_BITS   6
-#elif defined(PROCESSOR_4Kc)
-#define TLB_ENTRY_COUNT  16
-#define TLB_INDEX_BITS   4
-#else
-#error Please define TLB_ENTRY_COUNT for the target processor.
-#endif
-
-#define TLB_WIRED              	0
-
-#define TLB_PAGE_MASK_4K    (0x000 << 13)
-#define TLB_PAGE_MASK_16K   (0x003 << 13)
-#define TLB_PAGE_MASK_64K   (0x00f << 13)
-#define TLB_PAGE_MASK_256K  (0x03f << 13)
-#define TLB_PAGE_MASK_1M    (0x0ff << 13)
-#define TLB_PAGE_MASK_4M    (0x3ff << 13)
-#define TLB_PAGE_MASK_16M   (0xfff << 13)
-
-#define PAGE_UNCACHED             2
-#define PAGE_CACHEABLE_EXC_WRITE  5
-
-typedef union {
-	struct {
-#ifdef __BE__
-		unsigned : 2;       /* zero */
-		unsigned pfn : 24;  /* frame number */
-		unsigned c : 3;     /* cache coherency attribute */
-		unsigned d : 1;     /* dirty/write-protect bit */
-		unsigned v : 1;     /* valid bit */
-		unsigned g : 1;     /* global bit */
-#else
-		unsigned g : 1;     /* global bit */
-		unsigned v : 1;     /* valid bit */
-		unsigned d : 1;     /* dirty/write-protect bit */
-		unsigned c : 3;     /* cache coherency attribute */
-		unsigned pfn : 24;  /* frame number */
-		unsigned : 2;       /* zero */
-#endif
-	} __attribute__((packed));
-	uint32_t value;
-} entry_lo_t;
-
-typedef union {
-	struct {
-#ifdef __BE__
-		unsigned vpn2 : 19;
-		unsigned : 5;
-		unsigned asid : 8;
-#else
-		unsigned asid : 8;
-		unsigned : 5;
-		unsigned vpn2 : 19;
-#endif
-	} __attribute__((packed));
-	uint32_t value;
-} entry_hi_t;
-
-typedef union {
-	struct {
-#ifdef __BE__
-		unsigned : 7;
-		unsigned mask : 12;
-		unsigned : 13;
-#else
-		unsigned : 13;
-		unsigned mask : 12;
-		unsigned : 7;
-#endif
-	} __attribute__((packed));
-	uint32_t value;
-} page_mask_t;
-
-typedef union {
-	struct {
-#ifdef __BE__
-		unsigned p : 1;
-		unsigned : 32 - TLB_INDEX_BITS - 1;
-		unsigned index : TLB_INDEX_BITS;
-#else
-		unsigned index : TLB_INDEX_BITS;
-		unsigned : 32 - TLB_INDEX_BITS - 1;
-		unsigned p : 1;
-#endif
-	} __attribute__((packed));
-	uint32_t value;
-} tlb_index_t;
-
-/** Probe TLB for Matching Entry
- *
- * Probe TLB for Matching Entry.
- */
-_NO_TRACE static inline void tlbp(void)
-{
-	asm volatile ("tlbp\n\t");
-}
-
-/** Read Indexed TLB Entry
- *
- * Read Indexed TLB Entry.
- */
-_NO_TRACE static inline void tlbr(void)
-{
-	asm volatile ("tlbr\n\t");
-}
-
-/** Write Indexed TLB Entry
- *
- * Write Indexed TLB Entry.
- */
-_NO_TRACE static inline void tlbwi(void)
-{
-	asm volatile ("tlbwi\n\t");
-}
-
-/** Write Random TLB Entry
- *
- * Write Random TLB Entry.
- */
-_NO_TRACE static inline void tlbwr(void)
-{
-	asm volatile ("tlbwr\n\t");
-}
-
-#define tlb_invalidate(asid)  tlb_invalidate_asid(asid)
-
-extern void tlb_invalid(istate_t *istate);
-extern void tlb_refill(istate_t *istate);
-extern void tlb_modified(istate_t *istate);
-extern void tlb_prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, bool cacheable, uintptr_t pfn);
-extern void tlb_prepare_entry_hi(entry_hi_t *hi, asid_t asid, uintptr_t addr);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/proc/task.h
===================================================================
--- kernel/arch/mips32/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_TASK_H_
-#define KERN_mips32_TASK_H_
-
-typedef struct {
-} task_arch_t;
-
-#define task_create_arch(t)
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/proc/thread.h
===================================================================
--- kernel/arch/mips32/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_THREAD_H_
-#define KERN_mips32_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-#define thread_create_arch(t, flags) (EOK)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/stack.h
===================================================================
--- kernel/arch/mips32/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_STACK_H_
-#define KERN_mips32_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#define STACK_ITEM_SIZE  4
-#define STACK_ALIGNMENT  8
-#define ABI_STACK_FRAME  32
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/include/arch/types.h
===================================================================
--- kernel/arch/mips32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_mips32_TYPES_H_
-#define KERN_mips32_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/mips32/meson.build
===================================================================
--- kernel/arch/mips32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/start.S',
-	'src/context.S',
-	'src/mips32.c',
-	'src/asm.S',
-	'src/exception.c',
-	'src/interrupt.c',
-	'src/cache.c',
-	'src/debugger.c',
-	'src/cpu/cpu.c',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/mm/km.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-	'src/mm/as.c',
-	'src/fpu_context.c',
-	'src/smc.c',
-	'src/smp/smp.c',
-	'src/machine_func.c',
-)
-
-if MACHINE == 'lmalta' or MACHINE == 'bmalta'
-	arch_src += files('src/mach/malta/malta.c')
-
-elif MACHINE == 'msim'
-	arch_src += files(
-		'src/mach/msim/msim.c',
-		'src/mach/msim/dorder.c',
-	)
-
-endif
-
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-	'include/arch/fpu_context_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/mips32/src/asm.S
===================================================================
--- kernel/arch/mips32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/*
- * Copyright (c) 2003 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <arch/fpu_context_struct.h>
-
-.text
-
-.macro cp0_read reg
-	mfc0 $2, \reg
-	j $31
-	nop
-.endm
-
-.macro cp0_write reg
-	mtc0 $4, \reg
-	j $31
-	nop
-.endm
-
-.set noat
-.set noreorder
-.set nomacro
-
-FUNCTION_BEGIN(asm_delay_loop)
-	j $31
-	nop
-FUNCTION_END(asm_delay_loop)
-
-FUNCTION_BEGIN(cpu_halt)
-	j cpu_halt
-	nop
-FUNCTION_END(cpu_halt)
-
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	move $t2, $a0  /* save dst */
-
-	addiu $v0, $a1, 3
-	li $v1, -4  /* 0xfffffffffffffffc */
-	and $v0, $v0, $v1
-	beq $a1, $v0, 3f
-	move $t0, $a0
-
-	0:
-		beq $a2, $zero, 2f
-		move $a3, $zero
-
-	1:
-		addu $v0, $a1, $a3
-		lbu $a0, 0($v0)
-		addu $v1, $t0, $a3
-		addiu $a3, $a3, 1
-		bne $a3, $a2, 1b
-		sb $a0, 0($v1)
-
-	2:
-		jr $ra
-		move $v0, $t2
-
-	3:
-		addiu $v0, $a0, 3
-		and $v0, $v0, $v1
-		bne $a0, $v0, 0b
-		srl $t1, $a2, 2
-
-		beq $t1, $zero, 5f
-		move $a3, $zero
-
-		move $a3, $zero
-		move $a0, $zero
-
-	4:
-		addu $v0, $a1, $a0
-		lw $v1, 0($v0)
-		addiu $a3, $a3, 1
-		addu $v0, $t0, $a0
-		sw $v1, 0($v0)
-		bne $a3, $t1, 4b
-		addiu $a0, $a0, 4
-
-	5:
-		andi $a2, $a2, 0x3
-		beq $a2, $zero, 2b
-		nop
-
-		sll $v0, $a3, 2
-		addu $t1, $v0, $t0
-		move $a3, $zero
-		addu $t0, $v0, $a1
-
-	6:
-		addu $v0, $t0, $a3
-		lbu $a0, 0($v0)
-		addu $v1, $t1, $a3
-		addiu $a3, $a3, 1
-		bne $a3, $a2, 6b
-		sb $a0, 0($v1)
-
-		jr $ra
-		move $v0, $t2
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	jr $ra
-	move $v0, $zero
-
-.macro fpu_gp_save reg ctx
-	mfc1 $t0, $\reg
-	sw $t0, FPU_CONTEXT_OFFSET_DREGS + \reg * FPU_CONTEXT_DREGS_ITEM_SIZE(\ctx)
-.endm
-
-.macro fpu_gp_restore reg ctx
-	lw $t0, FPU_CONTEXT_OFFSET_DREGS + \reg * FPU_CONTEXT_DREGS_ITEM_SIZE(\ctx)
-	mtc1 $t0, $\reg
-.endm
-
-.macro fpu_ct_save reg ctx
-	cfc1 $t0, $1
-	sw $t0, FPU_CONTEXT_OFFSET_CREGS + \reg * FPU_CONTEXT_CREGS_ITEM_SIZE(\ctx)
-.endm
-
-.macro fpu_ct_restore reg ctx
-	lw $t0, FPU_CONTEXT_OFFSET_CREGS + \reg * FPU_CONTEZT_CREGS_ITEM_SIZE(\ctx)
-	ctc1 $t0, $\reg
-.endm
-
-FUNCTION_BEGIN(fpu_context_save)
-#ifdef CONFIG_FPU
-	fpu_gp_save 0, $a0
-	fpu_gp_save 1, $a0
-	fpu_gp_save 2, $a0
-	fpu_gp_save 3, $a0
-	fpu_gp_save 4, $a0
-	fpu_gp_save 5, $a0
-	fpu_gp_save 6, $a0
-	fpu_gp_save 7, $a0
-	fpu_gp_save 8, $a0
-	fpu_gp_save 9, $a0
-	fpu_gp_save 10, $a0
-	fpu_gp_save 11, $a0
-	fpu_gp_save 12, $a0
-	fpu_gp_save 13, $a0
-	fpu_gp_save 14, $a0
-	fpu_gp_save 15, $a0
-	fpu_gp_save 16, $a0
-	fpu_gp_save 17, $a0
-	fpu_gp_save 18, $a0
-	fpu_gp_save 19, $a0
-	fpu_gp_save 20, $a0
-	fpu_gp_save 21, $a0
-	fpu_gp_save 22, $a0
-	fpu_gp_save 23, $a0
-	fpu_gp_save 24, $a0
-	fpu_gp_save 25, $a0
-	fpu_gp_save 26, $a0
-	fpu_gp_save 27, $a0
-	fpu_gp_save 28, $a0
-	fpu_gp_save 29, $a0
-	fpu_gp_save 30, $a0
-	fpu_gp_save 31, $a0
-
-	fpu_ct_save 1, $a0
-	fpu_ct_save 2, $a0
-	fpu_ct_save 3, $a0
-	fpu_ct_save 4, $a0
-	fpu_ct_save 5, $a0
-	fpu_ct_save 6, $a0
-	fpu_ct_save 7, $a0
-	fpu_ct_save 8, $a0
-	fpu_ct_save 9, $a0
-	fpu_ct_save 10, $a0
-	fpu_ct_save 11, $a0
-	fpu_ct_save 12, $a0
-	fpu_ct_save 13, $a0
-	fpu_ct_save 14, $a0
-	fpu_ct_save 15, $a0
-	fpu_ct_save 16, $a0
-	fpu_ct_save 17, $a0
-	fpu_ct_save 18, $a0
-	fpu_ct_save 19, $a0
-	fpu_ct_save 20, $a0
-	fpu_ct_save 21, $a0
-	fpu_ct_save 22, $a0
-	fpu_ct_save 23, $a0
-	fpu_ct_save 24, $a0
-	fpu_ct_save 25, $a0
-	fpu_ct_save 26, $a0
-	fpu_ct_save 27, $a0
-	fpu_ct_save 28, $a0
-	fpu_ct_save 29, $a0
-	fpu_ct_save 30, $a0
-	fpu_ct_save 31, $a0
-#endif
-	j $ra
-	nop
-FUNCTION_END(fpu_context_save)
-
-FUNCTION_BEGIN(fpu_context_restore)
-#ifdef CONFIG_FPU
-	fpu_gp_restore 0, $a0
-	fpu_gp_restore 1, $a0
-	fpu_gp_restore 2, $a0
-	fpu_gp_restore 3, $a0
-	fpu_gp_restore 4, $a0
-	fpu_gp_restore 5, $a0
-	fpu_gp_restore 6, $a0
-	fpu_gp_restore 7, $a0
-	fpu_gp_restore 8, $a0
-	fpu_gp_restore 9, $a0
-	fpu_gp_restore 10, $a0
-	fpu_gp_restore 11, $a0
-	fpu_gp_restore 12, $a0
-	fpu_gp_restore 13, $a0
-	fpu_gp_restore 14, $a0
-	fpu_gp_restore 15, $a0
-	fpu_gp_restore 16, $a0
-	fpu_gp_restore 17, $a0
-	fpu_gp_restore 18, $a0
-	fpu_gp_restore 19, $a0
-	fpu_gp_restore 20, $a0
-	fpu_gp_restore 21, $a0
-	fpu_gp_restore 22, $a0
-	fpu_gp_restore 23, $a0
-	fpu_gp_restore 24, $a0
-	fpu_gp_restore 25, $a0
-	fpu_gp_restore 26, $a0
-	fpu_gp_restore 27, $a0
-	fpu_gp_restore 28, $a0
-	fpu_gp_restore 29, $a0
-	fpu_gp_restore 30, $a0
-	fpu_gp_restore 31, $a0
-
-	fpu_ct_restore 1, $a0
-	fpu_ct_restore 2, $a0
-	fpu_ct_restore 3, $a0
-	fpu_ct_restore 4, $a0
-	fpu_ct_restore 5, $a0
-	fpu_ct_restore 6, $a0
-	fpu_ct_restore 7, $a0
-	fpu_ct_restore 8, $a0
-	fpu_ct_restore 9, $a0
-	fpu_ct_restore 10, $a0
-	fpu_ct_restore 11, $a0
-	fpu_ct_restore 12, $a0
-	fpu_ct_restore 13, $a0
-	fpu_ct_restore 14, $a0
-	fpu_ct_restore 15, $a0
-	fpu_ct_restore 16, $a0
-	fpu_ct_restore 17, $a0
-	fpu_ct_restore 18, $a0
-	fpu_ct_restore 19, $a0
-	fpu_ct_restore 20, $a0
-	fpu_ct_restore 21, $a0
-	fpu_ct_restore 22, $a0
-	fpu_ct_restore 23, $a0
-	fpu_ct_restore 24, $a0
-	fpu_ct_restore 25, $a0
-	fpu_ct_restore 26, $a0
-	fpu_ct_restore 27, $a0
-	fpu_ct_restore 28, $a0
-	fpu_ct_restore 29, $a0
-	fpu_ct_restore 30, $a0
-	fpu_ct_restore 31, $a0
-#endif
-	j $ra
-	nop
-FUNCTION_END(fpu_context_restore)
-
-FUNCTION_BEGIN(early_putuchar)
-	j $ra
-	nop
-FUNCTION_END(early_putuchar)
Index: rnel/arch/mips32/src/cache.c
===================================================================
--- kernel/arch/mips32/src/cache.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <arch/cache.h>
-#include <arch/exception.h>
-#include <panic.h>
-
-void cache_error(istate_t *istate)
-{
-	panic("cache_error exception (epc=%p).", (void *) istate->epc);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/context.S
===================================================================
--- kernel/arch/mips32/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-#
-# Copyright (c) 2003-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-
-.text
-
-.set noat
-.set noreorder
-.set nomacro
-
-FUNCTION_BEGIN(context_save_arch)
-	sw $s0, CONTEXT_OFFSET_S0($a0)
-	sw $s1, CONTEXT_OFFSET_S1($a0)
-	sw $s2, CONTEXT_OFFSET_S2($a0)
-	sw $s3, CONTEXT_OFFSET_S3($a0)
-	sw $s4, CONTEXT_OFFSET_S4($a0)
-	sw $s5, CONTEXT_OFFSET_S5($a0)
-	sw $s6, CONTEXT_OFFSET_S6($a0)
-	sw $s7, CONTEXT_OFFSET_S7($a0)
-	sw $s8, CONTEXT_OFFSET_S8($a0)
-	sw $gp, CONTEXT_OFFSET_GP($a0)
-	sw $k1, CONTEXT_OFFSET_TP($a0)
-
-	sw $ra, CONTEXT_OFFSET_PC($a0)
-	sw $sp, CONTEXT_OFFSET_SP($a0)
-
-	# context_save returns 1
-	j $31
-	li $2, 1
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	lw $s0, CONTEXT_OFFSET_S0($a0)
-	lw $s1, CONTEXT_OFFSET_S1($a0)
-	lw $s2, CONTEXT_OFFSET_S2($a0)
-	lw $s3, CONTEXT_OFFSET_S3($a0)
-	lw $s4, CONTEXT_OFFSET_S4($a0)
-	lw $s5, CONTEXT_OFFSET_S5($a0)
-	lw $s6, CONTEXT_OFFSET_S6($a0)
-	lw $s7, CONTEXT_OFFSET_S7($a0)
-	lw $s8, CONTEXT_OFFSET_S8($a0)
-	lw $gp, CONTEXT_OFFSET_GP($a0)
-	lw $k1, CONTEXT_OFFSET_TP($a0)
-
-	lw $ra, CONTEXT_OFFSET_PC($a0)
-	lw $sp, CONTEXT_OFFSET_SP($a0)
-
-	# context_restore returns 0
-	j $31
-	xor $2, $2
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/mips32/src/cpu/cpu.c
===================================================================
--- kernel/arch/mips32/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <arch/cp0.h>
-#include <stdio.h>
-
-struct data_t {
-	const char *vendor;
-	const char *model;
-};
-
-static struct data_t imp_data[] = {
-	{ "Invalid", "Invalid" },	/* 0x00 */
-	{ "MIPS", "R2000" },		/* 0x01 */
-	{ "MIPS", "R3000" },		/* 0x02 */
-	{ "MIPS", "R6000" },		/* 0x03 */
-	{ "MIPS", "R4000/R4400" }, 	/* 0x04 */
-	{ "LSI Logic", "R3000" },	/* 0x05 */
-	{ "MIPS", "R6000A" },		/* 0x06 */
-	{ "IDT", "3051/3052" },		/* 0x07 */
-	{ "Invalid", "Invalid" },	/* 0x08 */
-	{ "MIPS", "R10000/T5" },	/* 0x09 */
-	{ "MIPS", "R4200" },		/* 0x0a */
-	{ "Unknown", "Unknown" },	/* 0x0b */
-	{ "Unknown", "Unknown" },	/* 0x0c */
-	{ "Invalid", "Invalid" },	/* 0x0d */
-	{ "Invalid", "Invalid" },	/* 0x0e */
-	{ "Invalid", "Invalid" },	/* 0x0f */
-	{ "MIPS", "R8000" },		/* 0x10 */
-	{ "Invalid", "Invalid" },	/* 0x11 */
-	{ "Invalid", "Invalid" },	/* 0x12 */
-	{ "Invalid", "Invalid" },	/* 0x13 */
-	{ "Invalid", "Invalid" },	/* 0x14 */
-	{ "Invalid", "Invalid" },	/* 0x15 */
-	{ "Invalid", "Invalid" },	/* 0x16 */
-	{ "Invalid", "Invalid" },	/* 0x17 */
-	{ "Invalid", "Invalid" },	/* 0x18 */
-	{ "Invalid", "Invalid" },	/* 0x19 */
-	{ "Invalid", "Invalid" },  	/* 0x1a */
-	{ "Invalid", "Invalid" },	/* 0x1b */
-	{ "Invalid", "Invalid" },	/* 0x1c */
-	{ "Invalid", "Invalid" },	/* 0x1d */
-	{ "Invalid", "Invalid" },	/* 0x1e */
-	{ "Invalid", "Invalid" },	/* 0x1f */
-	{ "QED", "R4600" },		/* 0x20 */
-	{ "Sony", "R3000" },		/* 0x21 */
-	{ "Toshiba", "R3000" },		/* 0x22 */
-	{ "NKK", "R3000" },		/* 0x23 */
-	{ NULL, NULL }
-};
-
-static struct data_t imp_data80[] = {
-	{ "MIPS", "4Kc" },  /* 0x80 */
-	{ "Invalid", "Invalid" }, /* 0x81 */
-	{ "Invalid", "Invalid" }, /* 0x82 */
-	{ "MIPS", "4Km & 4Kp" }, /* 0x83 */
-	{ NULL, NULL }
-};
-
-void cpu_arch_init(void)
-{
-}
-
-void cpu_identify(void)
-{
-	CPU->arch.rev_num = cp0_prid_read() & 0xff;
-	CPU->arch.imp_num = (cp0_prid_read() >> 8) & 0xff;
-}
-
-void cpu_print_report(cpu_t *m)
-{
-	struct data_t *data;
-	unsigned int i;
-
-	if (m->arch.imp_num & 0x80) {
-		/* Count records */
-		i = 0;
-		while (imp_data80[i].vendor)
-			i++;
-		if ((m->arch.imp_num & 0x7f) >= i) {
-			printf("imp=%d\n", m->arch.imp_num);
-			return;
-		}
-		data = &imp_data80[m->arch.imp_num & 0x7f];
-	} else {
-		i = 0;
-		while (imp_data[i].vendor)
-			i++;
-		if (m->arch.imp_num >= i) {
-			printf("imp=%d\n", m->arch.imp_num);
-			return;
-		}
-		data = &imp_data[m->arch.imp_num];
-	}
-
-	printf("cpu%u: %s %s (rev=%d.%d, imp=%d)\n",
-	    m->id, data->vendor, data->model, m->arch.rev_num >> 4,
-	    m->arch.rev_num & 0x0f, m->arch.imp_num);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/mips32/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,275 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-/*
- * This stack tracing code is based on the suggested algorithm described on page
- * 3-27 and 3-28 of:
- *
- * SYSTEM V
- * APPLICATION BINARY INTERFACE
- *
- * MIPS RISC Processor
- * Supplement
- * 3rd Edition
- *
- * Unfortunately, GCC generates code which is not entirely compliant with this
- * method. For example, it places the "jr ra" instruction quite arbitrarily in
- * the middle of the function which makes the original algorithm unapplicable.
- *
- * We deal with this problem by simply not using those parts of the algorithm
- * that rely on the "jr ra" instruction occurring in the last basic block of a
- * function, which gives us still usable, but less reliable stack tracer. The
- * unreliability stems from the fact that under some circumstances it can become
- * confused and produce incorrect or incomplete stack trace. We apply extra
- * sanity checks so that the algorithm is still safe and should not crash the
- * system.
- *
- * Even though not perfect, our solution is pretty lightweight, especially when
- * compared with a prospective alternative solution based on additional
- * debugging information stored directly in the kernel image.
- */
-
-#include <stacktrace.h>
-#include <stddef.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-#include <arch/debugger.h>
-
-#define R0	0U
-#define SP	29U
-#define RA	31U
-
-#define OP_SHIFT	26
-#define RS_SHIFT	21
-#define RT_SHIFT	16
-#define RD_SHIFT	11
-
-#define HINT_SHIFT	6
-#define BASE_SHIFT	RS_SHIFT
-#define IMM_SHIFT	0
-#define OFFSET_SHIFT	IMM_SHIFT
-
-#define RS_MASK		(0x1f << RS_SHIFT)
-#define RT_MASK		(0x1f << RT_SHIFT)
-#define RD_MASK		(0x1f << RD_SHIFT)
-#define HINT_MASK	(0x1f << HINT_SHIFT)
-#define BASE_MASK	RS_MASK
-#define IMM_MASK	(0xffff << IMM_SHIFT)
-#define OFFSET_MASK	IMM_MASK
-
-#define RS_GET(inst)		(((inst) & RS_MASK) >> RS_SHIFT)
-#define RD_GET(inst)		(((inst) & RD_MASK) >> RD_SHIFT)
-#define IMM_GET(inst)		(int16_t)(((inst) & IMM_MASK) >> IMM_SHIFT)
-#define BASE_GET(inst)		RS_GET(inst)
-#define OFFSET_GET(inst)	IMM_GET(inst)
-
-#define ADDU_R_SP_R0_TEMPL \
-	((0x0 << OP_SHIFT) | (SP << RS_SHIFT) | (R0 << RT_SHIFT) | 0x21)
-#define ADDU_SP_R_R0_TEMPL \
-	((0x0 << OP_SHIFT) | (SP << RD_SHIFT) | (R0 << RT_SHIFT) | 0x21)
-#define ADDI_SP_SP_IMM_TEMPL \
-	((0x8 << OP_SHIFT) | (SP << RS_SHIFT) | (SP << RT_SHIFT))
-#define ADDIU_SP_SP_IMM_TEMPL \
-	((0x9 << OP_SHIFT) | (SP << RS_SHIFT) | (SP << RT_SHIFT))
-#define JR_RA_TEMPL \
-	((0x0 << OP_SHIFT) | (RA << RS_SHIFT) | (0x0 << HINT_SHIFT) | 0x8)
-#define SW_RA_TEMPL \
-	((0x2b << OP_SHIFT) | (RA << RT_SHIFT))
-
-#define IS_ADDU_R_SP_R0(inst) \
-	(((inst) & ~RD_MASK) == ADDU_R_SP_R0_TEMPL)
-#define IS_ADDU_SP_R_R0(inst) \
-	(((inst) & ~RS_MASK) == ADDU_SP_R_R0_TEMPL)
-#define IS_ADDI_SP_SP_IMM(inst) \
-	(((inst) & ~IMM_MASK) == ADDI_SP_SP_IMM_TEMPL)
-#define IS_ADDIU_SP_SP_IMM(inst) \
-	(((inst) & ~IMM_MASK) == ADDIU_SP_SP_IMM_TEMPL)
-#define IS_JR_RA(inst) \
-	(((inst) & ~HINT_MASK) == JR_RA_TEMPL)
-#define IS_SW_RA(inst) \
-	(((inst) & ~(BASE_MASK | OFFSET_MASK)) == SW_RA_TEMPL)
-
-extern char ktext_start;
-extern char ktext_end;
-
-static bool bounds_check(uintptr_t pc)
-{
-	return (pc >= (uintptr_t) &ktext_start) &&
-	    (pc < (uintptr_t) &ktext_end);
-}
-
-static bool
-scan(stack_trace_context_t *ctx, uintptr_t *prev_fp, uintptr_t *prev_ra)
-{
-	uint32_t *inst = (void *) ctx->pc;
-	bool has_fp = false;
-	size_t frame_size;
-	unsigned int fp = SP;
-
-	do {
-		inst--;
-		if (!bounds_check((uintptr_t) inst))
-			return false;
-#if 0
-		/*
-		 * This is one of the situations in which the theory (ABI) does
-		 * not meet the practice (GCC). GCC simply does not place the
-		 * JR $ra instruction as dictated by the ABI, rendering the
-		 * official stack tracing algorithm somewhat unapplicable.
-		 */
-
-		if (IS_ADDU_R_SP_R0(*inst)) {
-			uint32_t *cur;
-			fp = RD_GET(*inst);
-			/*
-			 * We have a candidate for frame pointer.
-			 */
-
-			/* Seek to the end of this function. */
-			cur = inst + 1;
-			while (!IS_JR_RA(*cur))
-				cur++;
-
-			/* Scan the last basic block */
-			for (cur--; !is_jump(*(cur - 1)); cur--) {
-				if (IS_ADDU_SP_R_R0(*cur) &&
-				    (fp == RS_GET(*cur))) {
-					has_fp = true;
-				}
-			}
-			continue;
-		}
-
-		if (IS_JR_RA(*inst)) {
-			if (!ctx->istate)
-				return false;
-			/*
-			 * No stack frame has been allocated yet.
-			 * Use the values stored in istate.
-			 */
-			if (prev_fp)
-				*prev_fp = ctx->istate->sp;
-			if (prev_ra)
-				*prev_ra = ctx->istate->ra - 8;
-			ctx->istate = NULL;
-			return true;
-		}
-#endif
-
-	} while ((!IS_ADDIU_SP_SP_IMM(*inst) && !IS_ADDI_SP_SP_IMM(*inst)) ||
-	    (IMM_GET(*inst) >= 0));
-
-	/*
-	 * We are at the instruction which allocates the space for the current
-	 * stack frame.
-	 */
-	frame_size = -IMM_GET(*inst);
-	if (prev_fp)
-		*prev_fp = ctx->fp + frame_size;
-
-	/*
-	 * Scan the first basic block for the occurrence of
-	 * SW $ra, OFFSET($base).
-	 */
-	for (inst++; !is_jump(*(inst - 1)) && (uintptr_t) inst < ctx->pc;
-	    inst++) {
-		if (IS_SW_RA(*inst)) {
-			unsigned int base = BASE_GET(*inst);
-			int16_t offset = OFFSET_GET(*inst);
-
-			if (base == SP || (has_fp && base == fp)) {
-				uint32_t *addr = (void *) (ctx->fp + offset);
-
-				if (offset % 4 != 0)
-					return false;
-				/* cannot store below current stack pointer */
-				if (offset < 0)
-					return false;
-				/* too big offsets are suspicious */
-				if ((size_t) offset > sizeof(istate_t))
-					return false;
-
-				if (prev_ra)
-					*prev_ra = *addr;
-				return true;
-			}
-		}
-	}
-
-	/*
-	 * The first basic block does not save the return address or saves it
-	 * after ctx->pc, which means that the correct value is in istate.
-	 */
-	if (prev_ra) {
-		if (!ctx->istate)
-			return false;
-		*prev_ra = ctx->istate->ra - 8;
-		ctx->istate = NULL;
-	}
-	return true;
-}
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return !((ctx->fp == 0) || ((ctx->fp % 8) != 0) ||
-	    (ctx->pc % 4 != 0) || !bounds_check(ctx->pc));
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return scan(ctx, prev, NULL);
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return scan(ctx, NULL, ra);
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return false;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return false;
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return false;
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/mips32/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.set noat
-.set noreorder
-
-FUNCTION_BEGIN(frame_pointer_get)
-	j $ra
-	move $v0, $sp
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	j $ra
-	move $v0, $ra
-FUNCTION_END(program_counter_get)
Index: rnel/arch/mips32/src/debugger.c
===================================================================
--- kernel/arch/mips32/src/debugger.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,438 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_debug
- * @{
- */
-/** @file
- */
-
-#include <arch/debugger.h>
-#include <barrier.h>
-#include <console/kconsole.h>
-#include <console/cmd.h>
-#include <stdio.h>
-#include <log.h>
-#include <panic.h>
-#include <arch.h>
-#include <arch/cp0.h>
-#include <halt.h>
-#include <symtab.h>
-
-bpinfo_t breakpoints[BKPOINTS_MAX];
-IRQ_SPINLOCK_STATIC_INITIALIZE(bkpoint_lock);
-
-#ifdef CONFIG_KCONSOLE
-
-static int cmd_print_breakpoints(cmd_arg_t *);
-static int cmd_del_breakpoint(cmd_arg_t *);
-static int cmd_add_breakpoint(cmd_arg_t *);
-
-static cmd_info_t bkpts_info = {
-	.name = "bkpts",
-	.description = "Print breakpoint table.",
-	.func = cmd_print_breakpoints,
-	.argc = 0,
-};
-
-static cmd_arg_t del_argv = {
-	.type = ARG_TYPE_INT
-};
-
-static cmd_info_t delbkpt_info = {
-	.name = "delbkpt",
-	.description = "Delete breakpoint.",
-	.func = cmd_del_breakpoint,
-	.argc = 1,
-	.argv = &del_argv
-};
-
-static cmd_arg_t add_argv = {
-	.type = ARG_TYPE_INT
-};
-
-static cmd_info_t addbkpt_info = {
-	.name = "addbkpt",
-	.description = "Add bkpoint (break on j/branch insts unsupported).",
-	.func = cmd_add_breakpoint,
-	.argc = 1,
-	.argv = &add_argv
-};
-
-static cmd_arg_t adde_argv[] = {
-	{ .type = ARG_TYPE_INT },
-	{ .type = ARG_TYPE_INT }
-};
-static cmd_info_t addbkpte_info = {
-	.name = "addbkpte",
-	.description = "Add bkpoint with a trigger function.",
-	.func = cmd_add_breakpoint,
-	.argc = 2,
-	.argv = adde_argv
-};
-#endif
-
-static struct {
-	uint32_t andmask;
-	uint32_t value;
-} jmpinstr[] = {
-	{ 0xf3ff0000, 0x41000000 },  /* BCzF */
-	{ 0xf3ff0000, 0x41020000 },  /* BCzFL */
-	{ 0xf3ff0000, 0x41010000 },  /* BCzT */
-	{ 0xf3ff0000, 0x41030000 },  /* BCzTL */
-	{ 0xfc000000, 0x10000000 },  /* BEQ */
-	{ 0xfc000000, 0x50000000 },  /* BEQL */
-	{ 0xfc1f0000, 0x04010000 },  /* BEQL */
-	{ 0xfc1f0000, 0x04110000 },  /* BGEZAL */
-	{ 0xfc1f0000, 0x04130000 },  /* BGEZALL */
-	{ 0xfc1f0000, 0x04030000 },  /* BGEZL */
-	{ 0xfc1f0000, 0x1c000000 },  /* BGTZ */
-	{ 0xfc1f0000, 0x5c000000 },  /* BGTZL */
-	{ 0xfc1f0000, 0x18000000 },  /* BLEZ */
-	{ 0xfc1f0000, 0x58000000 },  /* BLEZL */
-	{ 0xfc1f0000, 0x04000000 },  /* BLTZ */
-	{ 0xfc1f0000, 0x04100000 },  /* BLTZAL */
-	{ 0xfc1f0000, 0x04120000 },  /* BLTZALL */
-	{ 0xfc1f0000, 0x04020000 },  /* BLTZL */
-	{ 0xfc000000, 0x14000000 },  /* BNE */
-	{ 0xfc000000, 0x54000000 },  /* BNEL */
-	{ 0xfc000000, 0x08000000 },  /* J */
-	{ 0xfc000000, 0x0c000000 },  /* JAL */
-	{ 0xfc1f07ff, 0x00000009 },  /* JALR */
-	{ 0, 0 }                     /* end of table */
-};
-
-/** Test, if the given instruction is a jump or branch instruction
- *
- * @param instr Instruction code
- *
- * @return true if it is jump instruction, false otherwise
- *
- */
-bool is_jump(sysarg_t instr)
-{
-	unsigned int i;
-
-	for (i = 0; jmpinstr[i].andmask; i++) {
-		if ((instr & jmpinstr[i].andmask) == jmpinstr[i].value)
-			return true;
-	}
-
-	return false;
-}
-
-static inline void write_inst(uintptr_t addr, uint32_t inst)
-{
-	*((uint32_t *) addr) = inst;
-	smc_coherence((uint32_t *) addr, 4);
-}
-
-#ifdef CONFIG_KCONSOLE
-
-/** Add new breakpoint to table
- *
- */
-int cmd_add_breakpoint(cmd_arg_t *argv)
-{
-	if (argv->intval & 0x3) {
-		printf("Not aligned instruction, forgot to use &symbol?\n");
-		return 1;
-	}
-
-	irq_spinlock_lock(&bkpoint_lock, true);
-
-	/* Check, that the breakpoints do not conflict */
-	unsigned int i;
-	for (i = 0; i < BKPOINTS_MAX; i++) {
-		if (breakpoints[i].address == (uintptr_t) argv->intval) {
-			printf("Duplicate breakpoint %d.\n", i);
-			irq_spinlock_unlock(&bkpoint_lock, true);
-			return 0;
-		} else if ((breakpoints[i].address == (uintptr_t) argv->intval +
-		    sizeof(sysarg_t)) || (breakpoints[i].address ==
-		    (uintptr_t) argv->intval - sizeof(sysarg_t))) {
-			printf("Adjacent breakpoints not supported, conflict "
-			    "with %d.\n", i);
-			irq_spinlock_unlock(&bkpoint_lock, true);
-			return 0;
-		}
-
-	}
-
-	bpinfo_t *cur = NULL;
-
-	for (i = 0; i < BKPOINTS_MAX; i++) {
-		if (!breakpoints[i].address) {
-			cur = &breakpoints[i];
-			break;
-		}
-	}
-
-	if (!cur) {
-		printf("Too many breakpoints.\n");
-		irq_spinlock_unlock(&bkpoint_lock, true);
-		return 0;
-	}
-
-	printf("Adding breakpoint on address %p\n", (void *) argv->intval);
-
-	cur->address = (uintptr_t) argv->intval;
-	cur->instruction = ((sysarg_t *) cur->address)[0];
-	cur->nextinstruction = ((sysarg_t *) cur->address)[1];
-	if (argv == &add_argv) {
-		cur->flags = 0;
-	} else {  /* We are add extended */
-		cur->flags = BKPOINT_FUNCCALL;
-		cur->bkfunc = (void (*)(void *, istate_t *)) argv[1].intval;
-	}
-
-	if (is_jump(cur->instruction))
-		cur->flags |= BKPOINT_ONESHOT;
-
-	cur->counter = 0;
-
-	/* Set breakpoint */
-	write_inst(cur->address, 0x0d);
-
-	irq_spinlock_unlock(&bkpoint_lock, true);
-
-	return 1;
-}
-
-/** Remove breakpoint from table
- *
- */
-int cmd_del_breakpoint(cmd_arg_t *argv)
-{
-	if (argv->intval > BKPOINTS_MAX) {
-		printf("Invalid breakpoint number.\n");
-		return 0;
-	}
-
-	irq_spinlock_lock(&bkpoint_lock, true);
-
-	bpinfo_t *cur = &breakpoints[argv->intval];
-	if (!cur->address) {
-		printf("Breakpoint does not exist.\n");
-		irq_spinlock_unlock(&bkpoint_lock, true);
-		return 0;
-	}
-
-	if ((cur->flags & BKPOINT_INPROG) && (cur->flags & BKPOINT_ONESHOT)) {
-		printf("Cannot remove one-shot breakpoint in-progress\n");
-		irq_spinlock_unlock(&bkpoint_lock, true);
-		return 0;
-	}
-
-	write_inst(cur->address, cur->instruction);
-	write_inst(cur->address + 4, cur->nextinstruction);
-
-	cur->address = (uintptr_t) NULL;
-
-	irq_spinlock_unlock(&bkpoint_lock, true);
-	return 1;
-}
-
-/** Print table of active breakpoints
- *
- */
-int cmd_print_breakpoints(cmd_arg_t *argv)
-{
-	unsigned int i;
-
-	printf("[nr] [count] [address ] [inprog] [oneshot] [funccall] [in symbol\n");
-
-	for (i = 0; i < BKPOINTS_MAX; i++) {
-		if (breakpoints[i].address) {
-			const char *symbol = symtab_fmt_name_lookup(
-			    breakpoints[i].address);
-
-			printf("%-4u %7zu %p %-8s %-9s %-10s %s\n", i,
-			    breakpoints[i].counter, (void *) breakpoints[i].address,
-			    ((breakpoints[i].flags & BKPOINT_INPROG) ? "true" :
-			    "false"), ((breakpoints[i].flags & BKPOINT_ONESHOT) ?
-			    "true" : "false"), ((breakpoints[i].flags &
-			    BKPOINT_FUNCCALL) ? "true" : "false"), symbol);
-		}
-	}
-
-	return 1;
-}
-
-#endif /* CONFIG_KCONSOLE */
-
-/** Initialize debugger
- *
- */
-void debugger_init(void)
-{
-	unsigned int i;
-
-	for (i = 0; i < BKPOINTS_MAX; i++)
-		breakpoints[i].address = (uintptr_t) NULL;
-
-#ifdef CONFIG_KCONSOLE
-	cmd_initialize(&bkpts_info);
-	if (!cmd_register(&bkpts_info))
-		log(LF_OTHER, LVL_WARN, "Cannot register command %s",
-		    bkpts_info.name);
-
-	cmd_initialize(&delbkpt_info);
-	if (!cmd_register(&delbkpt_info))
-		log(LF_OTHER, LVL_WARN, "Cannot register command %s",
-		    delbkpt_info.name);
-
-	cmd_initialize(&addbkpt_info);
-	if (!cmd_register(&addbkpt_info))
-		log(LF_OTHER, LVL_WARN, "Cannot register command %s",
-		    addbkpt_info.name);
-
-	cmd_initialize(&addbkpte_info);
-	if (!cmd_register(&addbkpte_info))
-		log(LF_OTHER, LVL_WARN, "Cannot register command %s",
-		    addbkpte_info.name);
-#endif /* CONFIG_KCONSOLE */
-}
-
-/** Handle breakpoint
- *
- * Find breakpoint in breakpoint table.
- * If found, call kconsole, set break on next instruction and reexecute.
- * If we are on "next instruction", set it back on the first and reexecute.
- * If breakpoint not found in breakpoint table, call kconsole and start
- * next instruction.
- *
- */
-void debugger_bpoint(istate_t *istate)
-{
-	/* test branch delay slot */
-	if (cp0_cause_read() & 0x80000000)
-		panic("Breakpoint in branch delay slot not supported.");
-
-	irq_spinlock_lock(&bkpoint_lock, false);
-
-	bpinfo_t *cur = NULL;
-	uintptr_t fireaddr = istate->epc;
-	unsigned int i;
-
-	for (i = 0; i < BKPOINTS_MAX; i++) {
-		/* Normal breakpoint */
-		if ((fireaddr == breakpoints[i].address) &&
-		    (!(breakpoints[i].flags & BKPOINT_REINST))) {
-			cur = &breakpoints[i];
-			break;
-		}
-
-		/* Reinst only breakpoint */
-		if ((breakpoints[i].flags & BKPOINT_REINST) &&
-		    (fireaddr == breakpoints[i].address + sizeof(sysarg_t))) {
-			cur = &breakpoints[i];
-			break;
-		}
-	}
-
-	if (cur) {
-		if (cur->flags & BKPOINT_REINST) {
-			/* Set breakpoint on first instruction */
-			write_inst(cur->address, 0x0d);
-
-			/* Return back the second */
-			write_inst(cur->address + 4, cur->nextinstruction);
-
-			cur->flags &= ~BKPOINT_REINST;
-			irq_spinlock_unlock(&bkpoint_lock, false);
-			return;
-		}
-
-		if (cur->flags & BKPOINT_INPROG)
-			printf("Warning: breakpoint recursion\n");
-
-		if (!(cur->flags & BKPOINT_FUNCCALL)) {
-			printf("***Breakpoint %u: %p in %s.\n", i,
-			    (void *) fireaddr,
-			    symtab_fmt_name_lookup(fireaddr));
-		}
-
-		/* Return first instruction back */
-		write_inst(cur->address, cur->instruction);
-
-		if (!(cur->flags & BKPOINT_ONESHOT)) {
-			/* Set Breakpoint on next instruction */
-			write_inst(cur->address + 4, 0x0d);
-			cur->flags |= BKPOINT_REINST;
-		}
-		cur->flags |= BKPOINT_INPROG;
-	} else {
-		printf("***Breakpoint %d: %p in %s.\n", i,
-		    (void *) fireaddr,
-		    symtab_fmt_name_lookup(fireaddr));
-
-		/* Move on to next instruction */
-		istate->epc += 4;
-	}
-
-	if (cur)
-		cur->counter++;
-
-	if (cur && (cur->flags & BKPOINT_FUNCCALL)) {
-		/* Allow zero bkfunc, just for counting */
-		if (cur->bkfunc)
-			cur->bkfunc(cur, istate);
-	} else {
-#ifdef CONFIG_KCONSOLE
-		/*
-		 * This disables all other processors - we are not SMP,
-		 * actually this gets us to cpu_halt, if scheduler() is run
-		 * - we generally do not want scheduler to be run from debug,
-		 *   so this is a good idea
-		 */
-		atomic_store(&haltstate, 1);
-		irq_spinlock_unlock(&bkpoint_lock, false);
-
-		kconsole("debug", "Debug console ready.\n", false);
-
-		irq_spinlock_lock(&bkpoint_lock, false);
-		atomic_store(&haltstate, 0);
-#endif
-	}
-
-	if ((cur) && (cur->address == fireaddr) &&
-	    ((cur->flags & BKPOINT_INPROG))) {
-		/* Remove one-shot breakpoint */
-		if ((cur->flags & BKPOINT_ONESHOT))
-			cur->address = (uintptr_t) NULL;
-
-		/* Remove in-progress flag */
-		cur->flags &= ~BKPOINT_INPROG;
-	}
-
-	irq_spinlock_unlock(&bkpoint_lock, false);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/exception.c
===================================================================
--- kernel/arch/mips32/src/exception.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <arch/exception.h>
-#include <arch/interrupt.h>
-#include <arch/mm/tlb.h>
-#include <panic.h>
-#include <arch/cp0.h>
-#include <arch.h>
-#include <assert.h>
-#include <proc/thread.h>
-#include <interrupt.h>
-#include <halt.h>
-#include <ddi/irq.h>
-#include <arch/debugger.h>
-#include <symtab.h>
-#include <log.h>
-#include <arch/machine_func.h>
-
-static const char *exctable[] = {
-	"Interrupt",
-	"TLB Modified",
-	"TLB Invalid",
-	"TLB Invalid Store",
-	"Address Error - load/instr. fetch",
-	"Address Error - store",
-	"Bus Error - fetch instruction",
-	"Bus Error - data reference",
-	"Syscall",
-	"BreakPoint",
-	"Reserved Instruction",
-	"Coprocessor Unusable",
-	"Arithmetic Overflow",
-	"Trap",
-	"Virtual Coherency - instruction",
-	"Floating Point",
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	"WatchHi/WatchLo",  /* 23 */
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-	"Virtual Coherency - data",
-};
-
-void istate_decode(istate_t *istate)
-{
-	log_printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t"
-	    "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n",
-	    istate->epc, istate->status, istate->lo, istate->hi);
-
-	log_printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"
-	    "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n",
-	    istate->a0, istate->a1, istate->a2, istate->a3);
-
-	log_printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"
-	    "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n",
-	    istate->t0, istate->t1, istate->t2, istate->t3);
-
-	log_printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"
-	    "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n",
-	    istate->t4, istate->t5, istate->t6, istate->t7);
-
-	log_printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"
-	    "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n",
-	    istate->t8, istate->t9, istate->v0, istate->v1);
-
-	log_printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"
-	    "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n",
-	    istate->s0, istate->s1, istate->s2, istate->s3);
-
-	log_printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"
-	    "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n",
-	    istate->s4, istate->s5, istate->s6, istate->s7);
-
-	log_printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"
-	    "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n",
-	    istate->s8, istate->at, istate->kt0, istate->kt1);
-
-	log_printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"
-	    "gp =%#010" PRIx32 "\n",
-	    istate->sp, istate->ra, istate->gp);
-}
-
-static void unhandled_exception(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Unhandled exception %s.", exctable[n]);
-	panic_badtrap(istate, n, "Unhandled exception %s.", exctable[n]);
-}
-
-static void reserved_instr_exception(unsigned int n, istate_t *istate)
-{
-	if (*((uint32_t *) istate->epc) == 0x7c03e83b) {
-		assert(THREAD);
-		istate->epc += 4;
-		istate->v1 = istate->kt1;
-	} else
-		unhandled_exception(n, istate);
-}
-
-static void breakpoint_exception(unsigned int n, istate_t *istate)
-{
-#ifdef CONFIG_DEBUG
-	debugger_bpoint(istate);
-#else
-	/*
-	 * It is necessary to not re-execute BREAK instruction after
-	 * returning from Exception handler
-	 * (see page 138 in R4000 Manual for more information)
-	 */
-	istate->epc += 4;
-#endif
-}
-
-static void tlbmod_exception(unsigned int n, istate_t *istate)
-{
-	tlb_modified(istate);
-}
-
-static void tlbinv_exception(unsigned int n, istate_t *istate)
-{
-	tlb_invalid(istate);
-}
-
-#ifdef CONFIG_FPU_LAZY
-static void cpuns_exception(unsigned int n, istate_t *istate)
-{
-	if (cp0_cause_coperr(cp0_cause_read()) == fpu_cop_id)
-		scheduler_fpu_lazy_request();
-	else {
-		fault_if_from_uspace(istate,
-		    "Unhandled Coprocessor Unusable Exception.");
-		panic_badtrap(istate, n,
-		    "Unhandled Coprocessor Unusable Exception.");
-	}
-}
-#endif
-
-static void interrupt_exception(unsigned int n, istate_t *istate)
-{
-	uint32_t ip;
-	uint32_t im;
-
-	/* Decode interrupt number and process the interrupt */
-	ip = (cp0_cause_read() & cp0_cause_ip_mask) >> cp0_cause_ip_shift;
-	im = (cp0_status_read() & cp0_status_im_mask) >> cp0_status_im_shift;
-
-	unsigned int i;
-	for (i = 0; i < MIPS_INTERRUPTS; i++) {
-
-		/*
-		 * The interrupt could only occur if it is unmasked in the
-		 * status register. On the other hand, an interrupt can be
-		 * apparently pending even if it is masked, so we need to
-		 * check both the masked and pending interrupts.
-		 */
-		if (im & ip & (1 << i)) {
-			if (int_handler[i])
-				int_handler[i](i);
-			else {
-				/*
-				 * Spurious interrupt.
-				 */
-#ifdef CONFIG_DEBUG
-				log(LF_ARCH, LVL_DEBUG,
-				    "cpu%u: spurious interrupt (inum=%u)",
-				    CPU->id, i);
-#endif
-			}
-		}
-	}
-}
-
-/** Handle syscall userspace call */
-static void syscall_exception(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Syscall is handled through shortcut.");
-}
-
-void exception_init(void)
-{
-	unsigned int i;
-
-	/* Clear exception table */
-	for (i = 0; i < IVT_ITEMS; i++)
-		exc_register(i, "undef", false,
-		    (iroutine_t) unhandled_exception);
-
-	exc_register(EXC_Bp, "bkpoint", true,
-	    (iroutine_t) breakpoint_exception);
-	exc_register(EXC_RI, "resinstr", true,
-	    (iroutine_t) reserved_instr_exception);
-	exc_register(EXC_Mod, "tlb_mod", true,
-	    (iroutine_t) tlbmod_exception);
-	exc_register(EXC_TLBL, "tlbinvl", true,
-	    (iroutine_t) tlbinv_exception);
-	exc_register(EXC_TLBS, "tlbinvl", true,
-	    (iroutine_t) tlbinv_exception);
-	exc_register(EXC_Int, "interrupt", true,
-	    (iroutine_t) interrupt_exception);
-
-#ifdef CONFIG_FPU_LAZY
-	exc_register(EXC_CpU, "cpunus", true,
-	    (iroutine_t) cpuns_exception);
-#endif
-
-	exc_register(EXC_Sys, "syscall", true,
-	    (iroutine_t) syscall_exception);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/fpu_context.c
===================================================================
--- kernel/arch/mips32/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *
- */
-
-#include <fpu_context.h>
-#include <arch.h>
-#include <arch/cp0.h>
-#include <proc/thread.h>
-
-void fpu_disable(void)
-{
-#ifdef CONFIG_FPU
-	cp0_status_write(cp0_status_read() & ~cp0_status_fpu_bit);
-#endif
-}
-
-void fpu_enable(void)
-{
-#ifdef CONFIG_FPU
-	cp0_status_write(cp0_status_read() | cp0_status_fpu_bit);
-#endif
-}
-
-void fpu_init(void)
-{
-	/* TODO: Zero all registers */
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/interrupt.c
===================================================================
--- kernel/arch/mips32/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_interrupt
- * @{
- */
-/** @file
- */
-
-#include <interrupt.h>
-#include <arch/interrupt.h>
-#include <typedefs.h>
-#include <arch.h>
-#include <arch/cp0.h>
-#include <time/clock.h>
-#include <ipc/sysipc.h>
-
-// TODO: This is SMP unsafe!!!
-
-uint32_t count_hi = 0;
-static unsigned long nextcount;
-static unsigned long lastcount;
-
-/** Table of interrupt handlers. */
-int_handler_t int_handler[MIPS_INTERRUPTS] = { };
-
-/** Disable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_disable(void)
-{
-	ipl_t ipl = (ipl_t) cp0_status_read();
-	cp0_status_write(ipl & ~cp0_status_ie_enabled_bit);
-	return ipl;
-}
-
-/** Enable interrupts.
- *
- * @return Old interrupt priority level.
- */
-ipl_t interrupts_enable(void)
-{
-	ipl_t ipl = (ipl_t) cp0_status_read();
-	cp0_status_write(ipl | cp0_status_ie_enabled_bit);
-	return ipl;
-}
-
-/** Restore interrupt priority level.
- *
- * @param ipl Saved interrupt priority level.
- */
-void interrupts_restore(ipl_t ipl)
-{
-	cp0_status_write(cp0_status_read() | (ipl & cp0_status_ie_enabled_bit));
-}
-
-/** Read interrupt priority level.
- *
- * @return Current interrupt priority level.
- */
-ipl_t interrupts_read(void)
-{
-	return cp0_status_read();
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-bool interrupts_disabled(void)
-{
-	return !(cp0_status_read() & cp0_status_ie_enabled_bit);
-}
-
-/** Start hardware clock
- *
- */
-static void timer_start(void)
-{
-	lastcount = cp0_count_read();
-	nextcount = cp0_compare_value + cp0_count_read();
-	cp0_compare_write(nextcount);
-}
-
-static void timer_interrupt_handler(unsigned int intr)
-{
-	if (cp0_count_read() < lastcount)
-		/* Count overflow detected */
-		count_hi++;
-
-	lastcount = cp0_count_read();
-
-	unsigned long drift = cp0_count_read() - nextcount;
-	while (drift > cp0_compare_value) {
-		drift -= cp0_compare_value;
-		CPU_LOCAL->missed_clock_ticks++;
-	}
-
-	nextcount = cp0_count_read() + cp0_compare_value - drift;
-	cp0_compare_write(nextcount);
-
-	clock();
-}
-
-/* Initialize basic tables for exception dispatching */
-void interrupt_init(void)
-{
-	int_handler[INT_TIMER] = timer_interrupt_handler;
-
-	timer_start();
-	cp0_unmask_int(INT_TIMER);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mach/malta/malta.c
===================================================================
--- kernel/arch/mips32/src/mach/malta/malta.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief MIPS Malta platform driver.
- */
-
-#include <arch/mach/malta/malta.h>
-#include <console/console.h>
-#include <console/chardev.h>
-#include <arch/mm/page.h>
-#include <genarch/drivers/i8259/i8259.h>
-#include <genarch/drivers/ns16550/ns16550.h>
-#include <genarch/srln/srln.h>
-#include <arch/interrupt.h>
-#include <stdbool.h>
-#include <byteorder.h>
-#include <sysinfo/sysinfo.h>
-#include <log.h>
-
-static void malta_init(void);
-static void malta_cpu_halt(void);
-static void malta_get_memory_extents(uintptr_t *, size_t *);
-static void malta_frame_init(void);
-static void malta_output_init(void);
-static void malta_input_init(void);
-static const char *malta_get_platform_name(void);
-
-struct mips32_machine_ops malta_machine_ops = {
-	.machine_init = malta_init,
-	.machine_cpu_halt = malta_cpu_halt,
-	.machine_get_memory_extents = malta_get_memory_extents,
-	.machine_frame_init = malta_frame_init,
-	.machine_output_init = malta_output_init,
-	.machine_input_init = malta_input_init,
-	.machine_get_platform_name = malta_get_platform_name
-};
-
-#ifdef CONFIG_NS16550
-static ns16550_instance_t *tty_instance;
-#endif
-#ifdef CONFIG_NS16550_OUT
-static outdev_t *tty_out;
-#endif
-
-static void malta_isa_irq_handler(unsigned int i)
-{
-	uint8_t isa_irq = host2uint32_t_le(pio_read_32(GT64120_PCI0_INTACK));
-	if (i8259_is_spurious(isa_irq)) {
-		i8259_handle_spurious(isa_irq);
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt %u",
-		    CPU->id, isa_irq);
-		return;
-#endif
-	}
-	irq_t *irq = irq_dispatch_and_lock(isa_irq);
-	if (irq) {
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG, "cpu%u: unhandled IRQ (irq=%u)",
-		    CPU->id, isa_irq);
-#endif
-	}
-	i8259_eoi(isa_irq);
-}
-
-void malta_init(void)
-{
-	irq_init(ISA_IRQ_COUNT, ISA_IRQ_COUNT);
-
-	i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 0);
-	sysinfo_set_item_val("i8259", NULL, true);
-
-	int_handler[INT_HW0] = malta_isa_irq_handler;
-	cp0_unmask_int(INT_HW0);
-
-#if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT))
-#ifdef CONFIG_NS16550_OUT
-	outdev_t **tty_out_ptr = &tty_out;
-#else
-	outdev_t **tty_out_ptr = NULL;
-#endif
-	tty_instance = ns16550_init((ioport8_t *) TTY_BASE, 0, TTY_ISA_IRQ,
-	    NULL, NULL, tty_out_ptr);
-#endif
-}
-
-void malta_cpu_halt(void)
-{
-}
-
-void malta_get_memory_extents(uintptr_t *start, size_t *size)
-{
-}
-
-void malta_frame_init(void)
-{
-}
-
-void malta_output_init(void)
-{
-#ifdef CONFIG_NS16550_OUT
-	if (tty_out)
-		stdout_wire(tty_out);
-#endif
-}
-
-void malta_input_init(void)
-{
-#ifdef CONFIG_NS16550
-	if (tty_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			ns16550_wire(tty_instance, srln);
-			i8259_enable_irqs(1 << TTY_ISA_IRQ);
-		}
-	}
-#endif
-}
-
-const char *malta_get_platform_name(void)
-{
-	return "malta";
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mach/msim/dorder.c
===================================================================
--- kernel/arch/mips32/src/mach/msim/dorder.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <arch/mach/msim/dorder.h>
-#include <arch/mach/msim/msim.h>
-#include <stdint.h>
-#include <smp/ipi.h>
-#include <interrupt.h>
-#include <arch/asm.h>
-#include <typedefs.h>
-
-static irq_t dorder_irq;
-
-#ifdef CONFIG_SMP
-
-void ipi_broadcast_arch(int ipi)
-{
-	pio_write_32(((ioport32_t *) MSIM_DORDER_ADDRESS), 0x7fffffff);
-}
-
-#endif
-
-static irq_ownership_t dorder_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void dorder_irq_handler(irq_t *irq)
-{
-	dorder_ipi_ack(1 << dorder_cpuid());
-}
-
-void dorder_init(void)
-{
-	irq_initialize(&dorder_irq);
-	dorder_irq.inr = MSIM_DORDER_IRQ;
-	dorder_irq.claim = dorder_claim;
-	dorder_irq.handler = dorder_irq_handler;
-	irq_register(&dorder_irq);
-
-	cp0_unmask_int(MSIM_DORDER_IRQ);
-}
-
-uint32_t dorder_cpuid(void)
-{
-	return pio_read_32((ioport32_t *) MSIM_DORDER_ADDRESS);
-}
-
-void dorder_ipi_ack(uint32_t mask)
-{
-	pio_write_32((ioport32_t *) (MSIM_DORDER_ADDRESS + 4), mask);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mach/msim/msim.c
===================================================================
--- kernel/arch/mips32/src/mach/msim/msim.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief msim platform driver.
- */
-
-#include <arch/mach/msim/msim.h>
-#include <arch/mach/msim/dorder.h>
-#include <console/console.h>
-#include <sysinfo/sysinfo.h>
-#include <genarch/drivers/dsrln/dsrlnin.h>
-#include <genarch/drivers/dsrln/dsrlnout.h>
-#include <genarch/srln/srln.h>
-#include <stdbool.h>
-
-static void msim_init(void);
-static void msim_cpu_halt(void);
-static void msim_get_memory_extents(uintptr_t *, size_t *);
-static void msim_frame_init(void);
-static void msim_output_init(void);
-static void msim_input_init(void);
-static const char *msim_get_platform_name(void);
-
-struct mips32_machine_ops msim_machine_ops = {
-	.machine_init = msim_init,
-	.machine_cpu_halt = msim_cpu_halt,
-	.machine_get_memory_extents = msim_get_memory_extents,
-	.machine_frame_init = msim_frame_init,
-	.machine_output_init = msim_output_init,
-	.machine_input_init = msim_input_init,
-	.machine_get_platform_name = msim_get_platform_name
-};
-
-static void msim_irq_handler(unsigned int i)
-{
-	irq_t *irq = irq_dispatch_and_lock(i);
-	if (irq) {
-		irq->handler(irq);
-		irq_spinlock_unlock(&irq->lock, false);
-	} else {
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious IRQ (irq=%u)",
-		    CPU->id, i);
-#endif
-	}
-}
-
-void msim_init(void)
-{
-	irq_init(HW_INTERRUPTS, HW_INTERRUPTS);
-
-	int_handler[INT_HW0] = msim_irq_handler;
-	int_handler[INT_HW1] = msim_irq_handler;
-	int_handler[INT_HW2] = msim_irq_handler;
-	int_handler[INT_HW3] = msim_irq_handler;
-	int_handler[INT_HW4] = msim_irq_handler;
-
-	dorder_init();
-	cp0_unmask_int(MSIM_DDISK_IRQ);
-}
-
-void msim_cpu_halt(void)
-{
-}
-
-void msim_get_memory_extents(uintptr_t *start, size_t *size)
-{
-}
-
-void msim_frame_init(void)
-{
-}
-
-void msim_output_init(void)
-{
-#ifdef CONFIG_MSIM_PRN
-	outdev_t *dsrlndev = dsrlnout_init((ioport8_t *) MSIM_KBD_ADDRESS,
-	    KSEG12PA(MSIM_KBD_ADDRESS));
-	if (dsrlndev)
-		stdout_wire(dsrlndev);
-#endif
-}
-
-void msim_input_init(void)
-{
-#ifdef CONFIG_MSIM_KBD
-	/*
-	 * Initialize the msim keyboard port. Then initialize the serial line
-	 * module and connect it to the msim keyboard. Enable keyboard
-	 * interrupts.
-	 */
-	dsrlnin_instance_t *dsrlnin_instance =
-	    dsrlnin_init((dsrlnin_t *) MSIM_KBD_ADDRESS, MSIM_KBD_IRQ);
-	if (dsrlnin_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			dsrlnin_wire(dsrlnin_instance, srln);
-			cp0_unmask_int(MSIM_KBD_IRQ);
-		}
-	}
-#endif
-}
-
-const char *msim_get_platform_name(void)
-{
-	return "msim";
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/machine_func.c
===================================================================
--- kernel/arch/mips32/src/machine_func.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- *  @brief Definitions of machine specific functions.
- *
- *  These functions allow us to support various kinds of mips32 machines
- *  in a unified way.
- */
-
-#include <stddef.h>
-#include <arch/machine_func.h>
-#if defined(MACHINE_msim)
-#include <arch/mach/msim/msim.h>
-#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-#include <arch/mach/malta/malta.h>
-#endif
-
-/** Pointer to machine_ops structure being used. */
-struct mips32_machine_ops *machine_ops;
-
-/** Initialize machine_ops pointer. */
-void machine_ops_init(void)
-{
-#if defined(MACHINE_msim)
-	machine_ops = &msim_machine_ops;
-#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	machine_ops = &malta_machine_ops;
-#else
-#error Machine type not defined.
-#endif
-}
-
-void machine_init(void)
-{
-	(machine_ops->machine_init)();
-}
-
-/** Halts CPU. */
-void machine_cpu_halt(void)
-{
-	(machine_ops->machine_cpu_halt)();
-}
-
-/** Get extents of available memory.
- *
- * @param start		Place to store memory start address.
- * @param size		Place to store memory size.
- */
-void machine_get_memory_extents(uintptr_t *start, size_t *size)
-{
-	(machine_ops->machine_get_memory_extents)(start, size);
-}
-
-/*
- * Machine specific frame initialization
- */
-void machine_frame_init(void)
-{
-	(machine_ops->machine_frame_init)();
-}
-
-/*
- * configure the output device.
- */
-void machine_output_init(void)
-{
-	(machine_ops->machine_output_init)();
-}
-
-/*
- * configure the input device.
- */
-void machine_input_init(void)
-{
-	(machine_ops->machine_input_init)();
-}
-
-const char *machine_get_platform_name(void)
-{
-	if (machine_ops->machine_get_platform_name)
-		return machine_ops->machine_get_platform_name();
-	return NULL;
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mips32.c
===================================================================
--- kernel/arch/mips32/src/mips32.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,225 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <typedefs.h>
-#include <errno.h>
-#include <interrupt.h>
-#include <macros.h>
-#include <str.h>
-#include <memw.h>
-#include <preemption.h>
-#include <userspace.h>
-#include <stdbool.h>
-#include <syscall/syscall.h>
-#include <sysinfo/sysinfo.h>
-#include <arch/debug.h>
-#include <arch/debugger.h>
-#include <arch/machine_func.h>
-
-/*
- * Size of the code jumping to the exception handler code
- * - J+NOP
- */
-#define EXCEPTION_JUMP_SIZE  8
-
-#define TLB_EXC    ((char *) 0x80000000)
-#define NORM_EXC   ((char *) 0x80000180)
-#define CACHE_EXC  ((char *) 0x80000100)
-
-static void mips32_pre_mm_init(void);
-static void mips32_post_mm_init(void);
-static void mips32_post_smp_init(void);
-
-arch_ops_t mips32_ops = {
-	.pre_mm_init = mips32_pre_mm_init,
-	.post_mm_init = mips32_post_mm_init,
-	.post_smp_init = mips32_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &mips32_ops;
-
-/* Stack pointer saved when entering user mode */
-// FIXME: This won't work with SMP unless thread creation is globally serialized.
-uintptr_t supervisor_sp;
-
-size_t cpu_count = 0;
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-size_t sdram_size = 0;
-#endif
-
-/** Performs mips32-specific initialization before main_bsp() is called. */
-void mips32_pre_main(void *entry __attribute__((unused)), bootinfo_t *bootinfo)
-{
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
-
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	for (i = 0; i < CPUMAP_MAX_RECORDS; i++) {
-		if ((bootinfo->cpumap & (1 << i)) != 0)
-			cpu_count++;
-	}
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	sdram_size = bootinfo->sdram_size;
-#endif
-
-	str_cpy(bargs, CONFIG_BOOT_ARGUMENTS_BUFLEN, bootinfo->bootargs);
-
-	/* Initialize machine_ops pointer. */
-	machine_ops_init();
-}
-
-void mips32_pre_mm_init(void)
-{
-	/* It is not assumed by default */
-	interrupts_disable();
-
-	/* Initialize dispatch table */
-	exception_init();
-
-	/* Copy the exception vectors to the right places */
-	memcpy(TLB_EXC, (char *) tlb_refill_entry, EXCEPTION_JUMP_SIZE);
-	smc_coherence(TLB_EXC, EXCEPTION_JUMP_SIZE);
-	memcpy(NORM_EXC, (char *) exception_entry, EXCEPTION_JUMP_SIZE);
-	smc_coherence(NORM_EXC, EXCEPTION_JUMP_SIZE);
-	memcpy(CACHE_EXC, (char *) cache_error_entry, EXCEPTION_JUMP_SIZE);
-	smc_coherence(CACHE_EXC, EXCEPTION_JUMP_SIZE);
-
-	/*
-	 * Switch to BEV normal level so that exception vectors point to the
-	 * kernel. Clear the error level.
-	 */
-	cp0_status_write(cp0_status_read() &
-	    ~(cp0_status_bev_bootstrap_bit | cp0_status_erl_error_bit));
-
-	/*
-	 * Mask all interrupts
-	 */
-	cp0_mask_all_int();
-
-	debugger_init();
-}
-
-void mips32_post_mm_init(void)
-{
-	interrupt_init();
-
-	machine_init();
-	machine_output_init();
-}
-
-void mips32_post_smp_init(void)
-{
-	/* Set platform name. */
-	sysinfo_set_item_data("platform", NULL,
-	    (void *) machine_get_platform_name(),
-	    str_size(machine_get_platform_name()));
-
-	machine_input_init();
-}
-
-void calibrate_delay_loop(void)
-{
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	/* EXL = 1, UM = 1, IE = 1 */
-	cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit |
-	    cp0_status_um_bit | cp0_status_ie_enabled_bit));
-	cp0_epc_write(pc);
-	userspace_asm(sp, pc);
-
-	while (true)
-		;
-}
-
-/** Perform mips32 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Perform mips32 specific tasks needed before the new thread is scheduled. */
-void before_thread_runs_arch(void)
-{
-	supervisor_sp =
-	    (uintptr_t) &THREAD->kstack[STACK_SIZE];
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-void arch_reboot(void)
-{
-	___halt();
-	while (true)
-		;
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mm/as.c
===================================================================
--- kernel/arch/mips32/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/as.h>
-#include <genarch/mm/as_pt.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/asid_fifo.h>
-#include <arch/mm/tlb.h>
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <arch/cp0.h>
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-	asid_fifo_init();
-}
-
-/** Install address space.
- *
- * Install ASID.
- *
- * @param as Address space structure.
- */
-void as_install_arch(as_t *as)
-{
-	entry_hi_t hi;
-
-	/*
-	 * Install ASID.
-	 */
-	hi.value = cp0_entry_hi_read();
-
-	hi.asid = as->asid;
-	cp0_entry_hi_write(hi.value);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mm/frame.c
===================================================================
--- kernel/arch/mips32/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,296 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#include <macros.h>
-#include <arch/mm/frame.h>
-#include <arch/mm/tlb.h>
-#include <interrupt.h>
-#include <mm/frame.h>
-#include <mm/asid.h>
-#include <config.h>
-#ifdef MACHINE_msim
-#include <arch/mach/msim/msim.h>
-#endif
-#include <arch/arch.h>
-#include <stdio.h>
-
-#define ZERO_PAGE_MASK    TLB_PAGE_MASK_256K
-#define ZERO_FRAMES       2048
-#define ZERO_PAGE_WIDTH   18  /* 256K */
-#define ZERO_PAGE_SIZE    (1 << ZERO_PAGE_WIDTH)
-#define ZERO_PAGE_ASID    ASID_INVALID
-#define ZERO_PAGE_TLBI    0
-#define ZERO_PAGE_ADDR    0
-#define ZERO_PAGE_OFFSET  (ZERO_PAGE_SIZE / sizeof(uint32_t) - 1)
-#define ZERO_PAGE_VALUE   (((volatile uint32_t *) ZERO_PAGE_ADDR)[ZERO_PAGE_OFFSET])
-
-#define ZERO_PAGE_VALUE_KSEG1(frame) \
-	(((volatile uint32_t *) PA2KSEG1(frame << ZERO_PAGE_WIDTH))[ZERO_PAGE_OFFSET])
-
-#define MAX_REGIONS  32
-
-typedef struct {
-	pfn_t start;
-	pfn_t count;
-} phys_region_t;
-
-static size_t phys_regions_count = 0;
-static phys_region_t phys_regions[MAX_REGIONS];
-
-/** Check whether frame is available
- *
- * Returns true if given frame is generally available for use.
- * Returns false if given frame is used for physical memory
- * mapped devices and cannot be used.
- *
- */
-static bool frame_available(pfn_t frame)
-{
-#ifdef MACHINE_msim
-	/* MSIM device (dprinter) */
-	if (frame == (KSEG12PA(MSIM_VIDEORAM) >> ZERO_PAGE_WIDTH))
-		return false;
-
-	/* MSIM device (dkeyboard) */
-	if (frame == (KSEG12PA(MSIM_KBD_ADDRESS) >> ZERO_PAGE_WIDTH))
-		return false;
-#endif
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	if (frame >= (sdram_size >> ZERO_PAGE_WIDTH))
-		return false;
-#endif
-
-	return true;
-}
-
-/** Check whether frame is safe to write
- *
- * Returns true if given frame is safe for read/write test.
- * Returns false if given frame should not be touched.
- *
- */
-static bool frame_safe(pfn_t frame)
-{
-	/* Kernel structures */
-	if ((frame << ZERO_PAGE_WIDTH) < KA2PA(config.base))
-		return false;
-
-	/* Kernel */
-	if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
-	    KA2PA(config.base), config.kernel_size))
-		return false;
-
-	/* Boot allocations */
-	if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
-	    KA2PA(ballocs.base), ballocs.size))
-		return false;
-
-	/* Init tasks */
-	bool safe = true;
-	size_t i;
-	for (i = 0; i < init.cnt; i++)
-		if (overlaps(frame << ZERO_PAGE_WIDTH, ZERO_PAGE_SIZE,
-		    init.tasks[i].paddr, init.tasks[i].size)) {
-			safe = false;
-			break;
-		}
-
-	return safe;
-}
-
-static void frame_add_region(pfn_t start_frame, pfn_t end_frame, bool low)
-{
-	if (end_frame <= start_frame)
-		return;
-
-	uintptr_t base = start_frame << ZERO_PAGE_WIDTH;
-	size_t size = (end_frame - start_frame) << ZERO_PAGE_WIDTH;
-
-	if (!frame_adjust_zone_bounds(low, &base, &size))
-		return;
-
-	pfn_t first = ADDR2PFN(base);
-	size_t count = SIZE2FRAMES(size);
-	pfn_t conf_frame;
-
-	if (low) {
-		/* Interrupt vector frame is blacklisted */
-		if (first == 0)
-			conf_frame = 1;
-		else
-			conf_frame = first;
-		zone_create(first, count, conf_frame,
-		    ZONE_AVAILABLE | ZONE_LOWMEM);
-	} else {
-		conf_frame = zone_external_conf_alloc(count);
-		if (conf_frame != 0)
-			zone_create(first, count, conf_frame,
-			    ZONE_AVAILABLE | ZONE_HIGHMEM);
-	}
-
-	if (phys_regions_count < MAX_REGIONS) {
-		phys_regions[phys_regions_count].start = first;
-		phys_regions[phys_regions_count].count = count;
-		phys_regions_count++;
-	}
-}
-
-/** Create memory zones
- *
- * Walk through available 256 KB chunks of physical
- * memory and create zones.
- *
- * Note: It is assumed that the TLB is not yet being
- * used in any way, thus there is no interference.
- *
- */
-void frame_low_arch_init(void)
-{
-	ipl_t ipl = interrupts_disable();
-
-	/* Clear and initialize TLB */
-	cp0_pagemask_write(ZERO_PAGE_MASK);
-	cp0_entry_lo0_write(0);
-	cp0_entry_lo1_write(0);
-	cp0_entry_hi_write(0);
-
-	size_t i;
-	for (i = 0; i < TLB_ENTRY_COUNT; i++) {
-		cp0_index_write(i);
-		tlbwi();
-	}
-
-	pfn_t start_frame = 0;
-	pfn_t frame;
-	bool avail = true;
-
-	/* Walk through all 1 MB frames */
-	for (frame = 0; frame < ZERO_FRAMES; frame++) {
-		if (!frame_available(frame))
-			avail = false;
-		else {
-			if (frame_safe(frame)) {
-				entry_lo_t lo0;
-				entry_lo_t lo1;
-				entry_hi_t hi;
-				tlb_prepare_entry_lo(&lo0, false, true, true, false, frame << (ZERO_PAGE_WIDTH - 12));
-				tlb_prepare_entry_lo(&lo1, false, false, false, false, 0);
-				tlb_prepare_entry_hi(&hi, ZERO_PAGE_ASID, ZERO_PAGE_ADDR);
-
-				cp0_pagemask_write(ZERO_PAGE_MASK);
-				cp0_entry_lo0_write(lo0.value);
-				cp0_entry_lo1_write(lo1.value);
-				cp0_entry_hi_write(hi.value);
-				cp0_index_write(ZERO_PAGE_TLBI);
-				tlbwi();
-
-				ZERO_PAGE_VALUE = 0;
-				if (ZERO_PAGE_VALUE != 0)
-					avail = false;
-				else {
-					ZERO_PAGE_VALUE = 0xdeadbeef;
-					if (ZERO_PAGE_VALUE != 0xdeadbeef)
-						avail = false;
-				}
-			}
-		}
-
-		if (!avail) {
-			frame_add_region(start_frame, frame, true);
-			start_frame = frame + 1;
-			avail = true;
-		}
-	}
-
-	frame_add_region(start_frame, frame, true);
-
-	/* Blacklist interrupt vector frame */
-	frame_mark_unavailable(0, 1);
-
-#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
-	/*
-	 * Blacklist memory regions used by YAMON.
-	 *
-	 * The YAMON User's Manual vaguely says the following physical addresses
-	 * are taken by YAMON:
-	 *
-	 * 0x1000	YAMON functions
-	 * 0x5000	YAMON code
-	 *
-	 * These addresses overlap with the beginning of the SDRAM so we need to
-	 * make sure they cannot be allocated.
-	 *
-	 * The User's Manual unfortunately does not say where does the SDRAM
-	 * portion used by YAMON end.
-	 *
-	 * Looking into the YAMON 02.21 sources, it looks like the first free
-	 * address is computed dynamically and depends on the size of the YAMON
-	 * image. From the YAMON binary, it appears to be 0xc0d50 or roughly
-	 * 772 KiB for that particular version.
-	 *
-	 * Linux is linked to 1MiB which seems to be a safe bet and a reasonable
-	 * upper bound for memory taken by YAMON. We will use it too.
-	 */
-	frame_mark_unavailable(0, 1024 * 1024 / FRAME_SIZE);
-#endif
-
-	/* Cleanup */
-	cp0_pagemask_write(ZERO_PAGE_MASK);
-	cp0_entry_lo0_write(0);
-	cp0_entry_lo1_write(0);
-	cp0_entry_hi_write(0);
-	cp0_index_write(ZERO_PAGE_TLBI);
-	tlbwi();
-
-	interrupts_restore(ipl);
-}
-
-void frame_high_arch_init(void)
-{
-}
-
-void physmem_print(void)
-{
-	printf("[base    ] [size    ]\n");
-
-	size_t i;
-	for (i = 0; i < phys_regions_count; i++) {
-		printf("%#010x %10u\n",
-		    PFN2ADDR(phys_regions[i].start), PFN2ADDR(phys_regions[i].count));
-	}
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mm/km.c
===================================================================
--- kernel/arch/mips32/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_MIPS32_KSEG0_START;
-	config.identity_size = KM_MIPS32_KSEG0_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_MIPS32_KSSEG_START, KM_MIPS32_KSSEG_SIZE);
-	km_non_identity_span_add(KM_MIPS32_KSEG3_START, KM_MIPS32_KSEG3_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_MIPS32_KSSEG_START, KM_MIPS32_KSSEG_SIZE, addr, 1) ||
-	    iswithin(KM_MIPS32_KSEG3_START, KM_MIPS32_KSEG3_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mm/page.c
===================================================================
--- kernel/arch/mips32/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-
-void page_arch_init(void)
-{
-	page_mapping_operations = &pt_mapping_operations;
-	as_switch(NULL, AS_KERNEL);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/mm/tlb.c
===================================================================
--- kernel/arch/mips32/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,438 +1,0 @@
-/*
- * Copyright (c) 2003-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/tlb.h>
-#include <mm/asid.h>
-#include <mm/tlb.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <arch/cp0.h>
-#include <panic.h>
-#include <arch.h>
-#include <synch/mutex.h>
-#include <stdio.h>
-#include <log.h>
-#include <assert.h>
-#include <align.h>
-#include <interrupt.h>
-#include <symtab.h>
-
-#define PFN_SHIFT  12
-#define VPN_SHIFT  12
-
-#define ADDR2HI_VPN(a)   ((a) >> VPN_SHIFT)
-#define ADDR2HI_VPN2(a)  (ADDR2HI_VPN((a)) >> 1)
-
-#define HI_VPN2ADDR(vpn)    ((vpn) << VPN_SHIFT)
-#define HI_VPN22ADDR(vpn2)  (HI_VPN2ADDR(vpn2) << 1)
-
-#define LO_PFN2ADDR(pfn)  ((pfn) << PFN_SHIFT)
-
-#define BANK_SELECT_BIT(a)  (((a) >> PAGE_WIDTH) & 1)
-
-/** Initialize TLB.
- *
- * Invalidate all entries and mark wired entries.
- */
-void tlb_arch_init(void)
-{
-	int i;
-
-	cp0_pagemask_write(TLB_PAGE_MASK_16K);
-	cp0_entry_hi_write(0);
-	cp0_entry_lo0_write(0);
-	cp0_entry_lo1_write(0);
-
-	/* Clear and initialize TLB. */
-
-	for (i = 0; i < TLB_ENTRY_COUNT; i++) {
-		cp0_index_write(i);
-		tlbwi();
-	}
-
-	/*
-	 * The kernel is going to make use of some wired
-	 * entries (e.g. mapping kernel stacks in kseg3).
-	 */
-	cp0_wired_write(TLB_WIRED);
-}
-
-/** Process TLB Refill Exception.
- *
- * @param istate	Interrupted register context.
- */
-void tlb_refill(istate_t *istate)
-{
-	entry_lo_t lo;
-	uintptr_t badvaddr;
-	pte_t pte;
-
-	badvaddr = cp0_badvaddr_read();
-
-	bool found = page_mapping_find(AS, badvaddr, true, &pte);
-	if (found && pte.p) {
-		/*
-		 * Record access to PTE.
-		 */
-		pte.a = 1;
-
-		tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.d,
-		    pte.cacheable, pte.pfn);
-
-		page_mapping_update(AS, badvaddr, true, &pte);
-
-		/*
-		 * New entry is to be inserted into TLB
-		 */
-		if (BANK_SELECT_BIT(badvaddr) == 0) {
-			cp0_entry_lo0_write(lo.value);
-			cp0_entry_lo1_write(0);
-		} else {
-			cp0_entry_lo0_write(0);
-			cp0_entry_lo1_write(lo.value);
-		}
-		cp0_pagemask_write(TLB_PAGE_MASK_16K);
-		tlbwr();
-		return;
-	}
-
-	(void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
-}
-
-/** Process TLB Invalid Exception.
- *
- * @param istate	Interrupted register context.
- */
-void tlb_invalid(istate_t *istate)
-{
-	entry_lo_t lo;
-	tlb_index_t index;
-	uintptr_t badvaddr;
-	pte_t pte;
-
-	/*
-	 * Locate the faulting entry in TLB.
-	 */
-	tlbp();
-	index.value = cp0_index_read();
-
-#if defined(PROCESSOR_4Kc)
-	/*
-	 * This can happen on a 4Kc when Status.EXL is 1 and there is a TLB miss.
-	 * EXL is 1 when interrupts are disabled. The combination of a TLB miss
-	 * and disabled interrupts is possible in copy_to/from_uspace().
-	 */
-	if (index.p) {
-		tlb_refill(istate);
-		return;
-	}
-#endif
-
-	assert(!index.p);
-
-	badvaddr = cp0_badvaddr_read();
-
-	bool found = page_mapping_find(AS, badvaddr, true, &pte);
-	if (found && pte.p) {
-		/*
-		 * Read the faulting TLB entry.
-		 */
-		tlbr();
-
-		/*
-		 * Record access to PTE.
-		 */
-		pte.a = 1;
-
-		tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.d,
-		    pte.cacheable, pte.pfn);
-
-		page_mapping_update(AS, badvaddr, true, &pte);
-
-		/*
-		 * The entry is to be updated in TLB.
-		 */
-		if (BANK_SELECT_BIT(badvaddr) == 0)
-			cp0_entry_lo0_write(lo.value);
-		else
-			cp0_entry_lo1_write(lo.value);
-		tlbwi();
-		return;
-	}
-
-	(void) as_page_fault(badvaddr, PF_ACCESS_READ, istate);
-}
-
-/** Process TLB Modified Exception.
- *
- * @param istate	Interrupted register context.
- */
-void tlb_modified(istate_t *istate)
-{
-	entry_lo_t lo;
-	tlb_index_t index;
-	uintptr_t badvaddr;
-	pte_t pte;
-
-	badvaddr = cp0_badvaddr_read();
-
-	/*
-	 * Locate the faulting entry in TLB.
-	 */
-	tlbp();
-	index.value = cp0_index_read();
-
-	/*
-	 * Emit warning if the entry is not in TLB.
-	 *
-	 * We do not assert on this because this could be a manifestation of
-	 * an emulator bug, such as QEMU Bug #1128935:
-	 * https://bugs.launchpad.net/qemu/+bug/1128935
-	 */
-	if (index.p) {
-		log(LF_ARCH, LVL_WARN, "%s: TLBP failed in exception handler (badvaddr=%#"
-		    PRIxn ", ASID=%d).\n", __func__, badvaddr,
-		    AS ? AS->asid : -1);
-		return;
-	}
-
-	bool found = page_mapping_find(AS, badvaddr, true, &pte);
-	if (found && pte.p && pte.w) {
-		/*
-		 * Read the faulting TLB entry.
-		 */
-		tlbr();
-
-		/*
-		 * Record access and write to PTE.
-		 */
-		pte.a = 1;
-		pte.d = 1;
-
-		tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.w,
-		    pte.cacheable, pte.pfn);
-
-		page_mapping_update(AS, badvaddr, true, &pte);
-
-		/*
-		 * The entry is to be updated in TLB.
-		 */
-		if (BANK_SELECT_BIT(badvaddr) == 0)
-			cp0_entry_lo0_write(lo.value);
-		else
-			cp0_entry_lo1_write(lo.value);
-		tlbwi();
-		return;
-	}
-
-	(void) as_page_fault(badvaddr, PF_ACCESS_WRITE, istate);
-}
-
-void
-tlb_prepare_entry_lo(entry_lo_t *lo, bool g, bool v, bool d, bool cacheable,
-    uintptr_t pfn)
-{
-	lo->value = 0;
-	lo->g = g;
-	lo->v = v;
-	lo->d = d;
-	lo->c = cacheable ? PAGE_CACHEABLE_EXC_WRITE : PAGE_UNCACHED;
-	lo->pfn = pfn;
-}
-
-void tlb_prepare_entry_hi(entry_hi_t *hi, asid_t asid, uintptr_t addr)
-{
-	hi->value = 0;
-	hi->vpn2 = ADDR2HI_VPN2(ALIGN_DOWN(addr, PAGE_SIZE));
-	hi->asid = asid;
-}
-
-/** Print contents of TLB. */
-void tlb_print(void)
-{
-	page_mask_t mask, mask_save;
-	entry_lo_t lo0, lo0_save, lo1, lo1_save;
-	entry_hi_t hi, hi_save;
-	unsigned int i;
-
-	hi_save.value = cp0_entry_hi_read();
-	lo0_save.value = cp0_entry_lo0_read();
-	lo1_save.value = cp0_entry_lo1_read();
-	mask_save.value = cp0_pagemask_read();
-
-	printf("[nr] [asid] [vpn2    ] [mask] [gvdc] [pfn     ]\n");
-
-	for (i = 0; i < TLB_ENTRY_COUNT; i++) {
-		cp0_index_write(i);
-		tlbr();
-
-		mask.value = cp0_pagemask_read();
-		hi.value = cp0_entry_hi_read();
-		lo0.value = cp0_entry_lo0_read();
-		lo1.value = cp0_entry_lo1_read();
-
-		printf("%-4u %-6u %0#10x %-#6x  %1u%1u%1u%1u  %0#10x\n",
-		    i, hi.asid, HI_VPN22ADDR(hi.vpn2), mask.mask,
-		    lo0.g, lo0.v, lo0.d, lo0.c, LO_PFN2ADDR(lo0.pfn));
-		printf("                               %1u%1u%1u%1u  %0#10x\n",
-		    lo1.g, lo1.v, lo1.d, lo1.c, LO_PFN2ADDR(lo1.pfn));
-	}
-
-	cp0_entry_hi_write(hi_save.value);
-	cp0_entry_lo0_write(lo0_save.value);
-	cp0_entry_lo1_write(lo1_save.value);
-	cp0_pagemask_write(mask_save.value);
-}
-
-/** Invalidate all not wired TLB entries. */
-void tlb_invalidate_all(void)
-{
-	entry_lo_t lo0, lo1;
-	entry_hi_t hi_save;
-	int i;
-
-	assert(interrupts_disabled());
-
-	hi_save.value = cp0_entry_hi_read();
-
-	for (i = TLB_WIRED; i < TLB_ENTRY_COUNT; i++) {
-		cp0_index_write(i);
-		tlbr();
-
-		lo0.value = cp0_entry_lo0_read();
-		lo1.value = cp0_entry_lo1_read();
-
-		lo0.v = 0;
-		lo1.v = 0;
-
-		cp0_entry_lo0_write(lo0.value);
-		cp0_entry_lo1_write(lo1.value);
-
-		tlbwi();
-	}
-
-	cp0_entry_hi_write(hi_save.value);
-}
-
-/** Invalidate all TLB entries belonging to specified address space.
- *
- * @param asid Address space identifier.
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	entry_lo_t lo0, lo1;
-	entry_hi_t hi, hi_save;
-	int i;
-
-	assert(interrupts_disabled());
-	assert(asid != ASID_INVALID);
-
-	hi_save.value = cp0_entry_hi_read();
-
-	for (i = 0; i < TLB_ENTRY_COUNT; i++) {
-		cp0_index_write(i);
-		tlbr();
-
-		hi.value = cp0_entry_hi_read();
-
-		if (hi.asid == asid) {
-			lo0.value = cp0_entry_lo0_read();
-			lo1.value = cp0_entry_lo1_read();
-
-			lo0.v = 0;
-			lo1.v = 0;
-
-			cp0_entry_lo0_write(lo0.value);
-			cp0_entry_lo1_write(lo1.value);
-
-			tlbwi();
-		}
-	}
-
-	cp0_entry_hi_write(hi_save.value);
-}
-
-/** Invalidate TLB entries for specified page range belonging to specified
- * address space.
- *
- * @param asid		Address space identifier.
- * @param page		First page whose TLB entry is to be invalidated.
- * @param cnt		Number of entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	unsigned int i;
-	entry_lo_t lo0, lo1;
-	entry_hi_t hi, hi_save;
-	tlb_index_t index;
-
-	assert(interrupts_disabled());
-
-	if (asid == ASID_INVALID)
-		return;
-
-	hi_save.value = cp0_entry_hi_read();
-
-	for (i = 0; i < cnt + 1; i += 2) {
-		tlb_prepare_entry_hi(&hi, asid, page + i * PAGE_SIZE);
-		cp0_entry_hi_write(hi.value);
-
-		tlbp();
-		index.value = cp0_index_read();
-
-		if (!index.p) {
-			/*
-			 * Entry was found, index register contains valid
-			 * index.
-			 */
-			tlbr();
-
-			lo0.value = cp0_entry_lo0_read();
-			lo1.value = cp0_entry_lo1_read();
-
-			lo0.v = 0;
-			lo1.v = 0;
-
-			cp0_entry_lo0_write(lo0.value);
-			cp0_entry_lo1_write(lo1.value);
-
-			tlbwi();
-		}
-	}
-
-	cp0_entry_hi_write(hi_save.value);
-}
-
-/** @}
- */
Index: rnel/arch/mips32/src/smc.c
===================================================================
--- kernel/arch/mips32/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-void smc_coherence(void *a, size_t l)
-{
-	// TODO
-	compiler_barrier();
-}
Index: rnel/arch/mips32/src/smp/smp.c
===================================================================
--- kernel/arch/mips32/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_mips32
- * @{
- */
-/** @file
- */
-
-#include <config.h>
-#include <smp/smp.h>
-#include <arch/arch.h>
-
-#ifdef CONFIG_SMP
-
-void smp_init(void)
-{
-	config.cpu_count = cpu_count;
-}
-
-void kmp(void *arg __attribute__((unused)))
-{
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/arch/mips32/src/start.S
===================================================================
--- kernel/arch/mips32/src/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,345 +1,0 @@
-#
-# Copyright (c) 2003-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <arch/mm/page.h>
-#include <arch/asm/boot.h>
-#include <arch/stack.h>
-#include <arch/istate_struct.h>
-
-.text
-
-.set noat
-.set noreorder
-
-/*
- * Which status bits are thread-local:
- * KSU(UM), EXL, ERL, IE
- */
-#define REG_SAVE_MASK 0x1f
-
-/*
- * The fake ABI prologue is never executed and may not be part of the
- * procedure's body. Instead, it should be immediately preceding the procedure's
- * body. Its only purpose is to trick the stack trace walker into thinking that
- * the exception is more or less just a normal function call.
- */
-.macro FAKE_ABI_PROLOGUE
-	sub $sp, ISTATE_SIZE
-	sw $ra, ISTATE_OFFSET_EPC($sp)
-.endm
-
-/*
- * Save registers to space defined by \r
- * We will change status: Disable ERL, EXL, UM, IE
- * These changes will be automatically reversed in REGISTER_LOAD
- * %sp is NOT saved as part of these registers
- */
-.macro REGISTERS_STORE_AND_EXC_RESET r
-	sw $at, ISTATE_OFFSET_AT(\r)
-	sw $v0, ISTATE_OFFSET_V0(\r)
-	sw $v1, ISTATE_OFFSET_V1(\r)
-	sw $a0, ISTATE_OFFSET_A0(\r)
-	sw $a1, ISTATE_OFFSET_A1(\r)
-	sw $a2, ISTATE_OFFSET_A2(\r)
-	sw $a3, ISTATE_OFFSET_A3(\r)
-	sw $t0, ISTATE_OFFSET_T0(\r)
-	sw $t1, ISTATE_OFFSET_T1(\r)
-	sw $t2, ISTATE_OFFSET_T2(\r)
-	sw $t3, ISTATE_OFFSET_T3(\r)
-	sw $t4, ISTATE_OFFSET_T4(\r)
-	sw $t5, ISTATE_OFFSET_T5(\r)
-	sw $t6, ISTATE_OFFSET_T6(\r)
-	sw $t7, ISTATE_OFFSET_T7(\r)
-	sw $t8, ISTATE_OFFSET_T8(\r)
-	sw $t9, ISTATE_OFFSET_T9(\r)
-	sw $s0, ISTATE_OFFSET_S0(\r)
-	sw $s1, ISTATE_OFFSET_S1(\r)
-	sw $s2, ISTATE_OFFSET_S2(\r)
-	sw $s3, ISTATE_OFFSET_S3(\r)
-	sw $s4, ISTATE_OFFSET_S4(\r)
-	sw $s5, ISTATE_OFFSET_S5(\r)
-	sw $s6, ISTATE_OFFSET_S6(\r)
-	sw $s7, ISTATE_OFFSET_S7(\r)
-	sw $s8, ISTATE_OFFSET_S8(\r)
-
-	mflo $at
-	sw $at, ISTATE_OFFSET_LO(\r)
-	mfhi $at
-	sw $at, ISTATE_OFFSET_HI(\r)
-
-	sw $gp, ISTATE_OFFSET_GP(\r)
-	sw $ra, ISTATE_OFFSET_RA(\r)
-	sw $k0, ISTATE_OFFSET_KT0(\r)
-	sw $k1, ISTATE_OFFSET_KT1(\r)
-
-	mfc0 $t0, $status
-	mfc0 $t1, $epc
-
-	/* save only KSU, EXL, ERL, IE */
-	and $t2, $t0, REG_SAVE_MASK
-
-	/* clear KSU, EXL, ERL, IE */
-	li $t3, ~(REG_SAVE_MASK)
-	and $t0, $t0, $t3
-
-	sw $t2, ISTATE_OFFSET_STATUS(\r)
-	sw $t1, ISTATE_OFFSET_EPC(\r)
-	mtc0 $t0, $status
-.endm
-
-.macro REGISTERS_LOAD r
-	/*
-	 * Update only UM, EXR, IE from status, the rest
-	 * is controlled by OS and not bound to task.
-	 */
-	mfc0 $t0, $status
-	lw $t1, ISTATE_OFFSET_STATUS(\r)
-
-	/* mask UM, EXL, ERL, IE */
-	li $t2, ~REG_SAVE_MASK
-	and $t0, $t0, $t2
-
-	/* copy UM, EXL, ERL, IE from saved status */
-	or $t0, $t0, $t1
-	mtc0 $t0, $status
-
-	lw $v0, ISTATE_OFFSET_V0(\r)
-	lw $v1, ISTATE_OFFSET_V1(\r)
-	lw $a0, ISTATE_OFFSET_A0(\r)
-	lw $a1, ISTATE_OFFSET_A1(\r)
-	lw $a2, ISTATE_OFFSET_A2(\r)
-	lw $a3, ISTATE_OFFSET_A3(\r)
-	lw $t0, ISTATE_OFFSET_T0(\r)
-	lw $t1, ISTATE_OFFSET_T1(\r)
-	lw $t2, ISTATE_OFFSET_T2(\r)
-	lw $t3, ISTATE_OFFSET_T3(\r)
-	lw $t4, ISTATE_OFFSET_T4(\r)
-	lw $t5, ISTATE_OFFSET_T5(\r)
-	lw $t6, ISTATE_OFFSET_T6(\r)
-	lw $t7, ISTATE_OFFSET_T7(\r)
-	lw $t8, ISTATE_OFFSET_T8(\r)
-	lw $t9, ISTATE_OFFSET_T9(\r)
-
-	lw $gp, ISTATE_OFFSET_GP(\r)
-	lw $ra, ISTATE_OFFSET_RA(\r)
-	lw $k1, ISTATE_OFFSET_KT1(\r)
-
-	lw $at, ISTATE_OFFSET_LO(\r)
-	mtlo $at
-	lw $at, ISTATE_OFFSET_HI(\r)
-	mthi $at
-
-	lw $at, ISTATE_OFFSET_EPC(\r)
-	mtc0 $at, $epc
-
-	lw $at, ISTATE_OFFSET_AT(\r)
-	lw $sp, ISTATE_OFFSET_SP(\r)
-.endm
-
-/*
- * Move kernel stack pointer address to register $k0.
- * If we are in user mode, load the appropriate stack address.
- */
-.macro KERNEL_STACK_TO_K0
-	/* if we are in user mode */
-	mfc0 $k0, $status
-	andi $k0, 0x10
-
-	beq $k0, $0, 1f
-	move $k0, $sp
-
-	/* move $k0 pointer to kernel stack */
-	la $k0, supervisor_sp
-
-	/* move $k0 (supervisor_sp) */
-	lw $k0, ($k0)
-
-	1:
-.endm
-
-.org 0x0
-SYMBOL(kernel_image_start)
-	/* load temporary stack */
-	lui $sp, %hi(end_stack)
-	ori $sp, $sp, %lo(end_stack)
-
-	/* not sure about this, but might be needed for PIC code */
-	lui $gp, 0x8000
-
-	/* $a1 contains physical address of bootinfo_t */
-	jal mips32_pre_main
-	addiu $sp, -ABI_STACK_FRAME
-
-	j main_bsp
-	nop
-
-.space TEMP_STACK_SIZE
-end_stack:
-
-SYMBOL(tlb_refill_entry)
-	j tlb_refill_handler
-	nop
-
-SYMBOL(cache_error_entry)
-	j cache_error_handler
-	nop
-
-SYMBOL(exception_entry)
-	j exception_handler
-	nop
-
-	FAKE_ABI_PROLOGUE
-exception_handler:
-	KERNEL_STACK_TO_K0
-
-	sub $k0, ISTATE_SIZE
-	sw $sp, ISTATE_OFFSET_SP($k0)
-	move $sp, $k0
-
-	mfc0 $k0, $cause
-
-	sra $k0, $k0, 0x2    /* cp0_exc_cause() part 1 */
-	andi $k0, $k0, 0x1f  /* cp0_exc_cause() part 2 */
-	sub $k0, 8           /* 8 = SYSCALL */
-
-	beqz $k0, syscall_shortcut
-	add $k0, 8           /* revert $k0 back to correct exc number */
-
-	REGISTERS_STORE_AND_EXC_RESET $sp
-
-	move $a1, $sp
-	move $a0, $k0
-	jal exc_dispatch     /* exc_dispatch(excno, register_space) */
-	addiu $sp, -ABI_STACK_FRAME
-	addiu $sp, ABI_STACK_FRAME
-
-	REGISTERS_LOAD $sp
-	/* the $sp is automatically restored to former value */
-	eret
-
-/** Syscall entry
- *
- * Registers:
- *
- * @param $v0 Syscall number.
- * @param $a0 1st argument.
- * @param $a1 2nd argument.
- * @param $a2 3rd argument.
- * @param $a3 4th argument.
- * @param $t0 5th argument.
- * @param $t1 6th argument.
- *
- * @return The return value will be stored in $v0.
- *
- */
-syscall_shortcut:
-	mfc0 $t3, $epc
-	mfc0 $t2, $status
-	sw $t3, ISTATE_OFFSET_EPC($sp)  /* save EPC */
-
-	and $t4, $t2, REG_SAVE_MASK  /* save only KSU, EXL, ERL, IE */
-	li $t5, ~(0x1f)
-	and $t2, $t2, $t5  /* clear KSU, EXL, ERL */
-	ori $t2, $t2, 0x1  /* set IE */
-
-	sw $t4, ISTATE_OFFSET_STATUS($sp)
-	mtc0 $t2, $status
-
-	/*
-	 * Call the higher level system call handler.
-	 *
-	 */
-	sw $t0, ISTATE_OFFSET_T0($sp)  /* save the 5th argument on the stack */
-	sw $t1, ISTATE_OFFSET_T1($sp)  /* save the 6th argument on the stack */
-
-	jal syscall_handler
-	sw $v0, ISTATE_OFFSET_V0($sp)  /* save the syscall number on the stack */
-
-	/* restore status */
-	mfc0 $t2, $status
-	lw $t3, ISTATE_OFFSET_STATUS($sp)
-
-	/*
-	 * Change back to EXL = 1 (from last exception), otherwise
-	 * an interrupt could rewrite the CP0 - EPC.
-	 *
-	 */
-	li $t4, ~REG_SAVE_MASK  /* mask UM, EXL, ERL, IE */
-	and $t2, $t2, $t4
-	or $t2, $t2, $t3  /* copy saved UM, EXL, ERL, IE */
-	mtc0 $t2, $status
-
-	/* restore epc + 4 */
-	lw $t2, ISTATE_OFFSET_EPC($sp)
-	addi $t2, $t2, 4
-	mtc0 $t2, $epc
-
-	lw $sp, ISTATE_OFFSET_SP($sp)  /* restore $sp */
-	eret
-
-	FAKE_ABI_PROLOGUE
-tlb_refill_handler:
-	KERNEL_STACK_TO_K0
-	sub $k0, ISTATE_SIZE
-	REGISTERS_STORE_AND_EXC_RESET $k0
-	sw $sp, ISTATE_OFFSET_SP($k0)
-	move $sp, $k0
-
-	move $a0, $sp
-	jal tlb_refill
-	addiu $sp, -ABI_STACK_FRAME
-	addiu $sp, ABI_STACK_FRAME
-
-	REGISTERS_LOAD $sp
-	eret
-
-	FAKE_ABI_PROLOGUE
-cache_error_handler:
-	KERNEL_STACK_TO_K0
-	sub $k0, ISTATE_SIZE
-	REGISTERS_STORE_AND_EXC_RESET $k0
-	sw $sp, ISTATE_OFFSET_SP($k0)
-	move $sp, $k0
-
-	move $a0, $sp
-	jal cache_error
-	addiu $sp, -ABI_STACK_FRAME
-	addiu $sp, ABI_STACK_FRAME
-
-	REGISTERS_LOAD $sp
-	eret
-
-FUNCTION_BEGIN(userspace_asm)
-	move $sp, $a0
-	xor $a0, $a0, $a0  /* $a0 is defined to hold pcb_ptr, set it to 0 */
-	xor $fp, $fp, $fp  // FIXME: wipe all userspace-accessible registers
-	xor $ra, $ra, $ra
-	eret
-FUNCTION_END(userspace_asm)
Index: rnel/arch/ppc32/_link.ld.in
===================================================================
--- kernel/arch/ppc32/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/** PPC32 linker script
- *
- * umapped section:
- *  kernel text
- *  kernel data
- * mapped section:
- *  kernel text
- *  kernel data
- *
- */
-
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-
-ENTRY(kernel_image_start)
-OUTPUT_FORMAT("elf32-powerpc")
-OUTPUT_ARCH("powerpc:common")
-
-SECTIONS {
-	kernel_load_address = PA2KA(0);
-
-	.unmapped (SIZEOF_HEADERS): AT (SIZEOF_HEADERS) {
-		. = ALIGN(0x100);
-		KEEP(*(K_UNMAPPED_TEXT_START));
-	}
-
-	.text PA2KA(BOOT_OFFSET): AT (BOOT_OFFSET) {
-		ktext_start = .;
-		KEEP(*(K_TEXT_START));
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		KEEP(*(K_DATA_START));
-		*(.rodata .rodata.*);
-		*(.data .data.*);       /* initialized data */
-		*(.sdata .sdata.*);
-		*(.sdata2 .sdata2.*);
-		*(.sbss .sbss.*);
-		*(.bss .bss.*);        /* uninitialized static variables */
-		*(COMMON);      /* global variables */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-}
Index: rnel/arch/ppc32/include/arch/arch.h
===================================================================
--- kernel/arch/ppc32/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_ARCH_H_
-#define KERN_ppc32_ARCH_H_
-
-#include <arch/boot/boot.h>
-
-extern void ppc32_pre_main(bootinfo_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/asm.h
===================================================================
--- kernel/arch/ppc32/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_ASM_H_
-#define KERN_ppc32_ASM_H_
-
-#include <typedefs.h>
-#include <config.h>
-#include <arch/msr.h>
-#include <arch/mm/asid.h>
-#include <trace.h>
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-}
-
-_NO_TRACE static inline uint32_t msr_read(void)
-{
-	uint32_t msr;
-
-	asm volatile (
-	    "mfmsr %[msr]\n"
-	    : [msr] "=r" (msr)
-	);
-
-	return msr;
-}
-
-_NO_TRACE static inline void msr_write(uint32_t msr)
-{
-	asm volatile (
-	    "mtmsr %[msr]\n"
-	    "isync\n"
-	    :: [msr] "r" (msr)
-	);
-}
-
-_NO_TRACE static inline void sr_set(uint32_t flags, asid_t asid, uint32_t sr)
-{
-	asm volatile (
-	    "mtsrin %[value], %[sr]\n"
-	    "sync\n"
-	    "isync\n"
-	    :: [value] "r" ((flags << 16) + (asid << 4) + sr),
-	      [sr] "r" (sr << 28)
-	);
-}
-
-_NO_TRACE static inline uint32_t sr_get(uint32_t vaddr)
-{
-	uint32_t vsid;
-
-	asm volatile (
-	    "mfsrin %[vsid], %[vaddr]\n"
-	    : [vsid] "=r" (vsid)
-	    : [vaddr] "r" (vaddr)
-	);
-
-	return vsid;
-}
-
-_NO_TRACE static inline uint32_t sdr1_get(void)
-{
-	uint32_t sdr1;
-
-	asm volatile (
-	    "mfsdr1 %[sdr1]\n"
-	    : [sdr1] "=r" (sdr1)
-	);
-
-	return sdr1;
-}
-
-/** Enable interrupts.
- *
- * Enable interrupts and return previous
- * value of EE.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	ipl_t ipl = msr_read();
-	msr_write(ipl | MSR_EE);
-	return ipl;
-}
-
-/** Disable interrupts.
- *
- * Disable interrupts and return previous
- * value of EE.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	ipl_t ipl = msr_read();
-	msr_write(ipl & (~MSR_EE));
-	return ipl;
-}
-
-/** Restore interrupt priority level.
- *
- * Restore EE.
- *
- * @param ipl Saved interrupt priority level.
- *
- */
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	msr_write((msr_read() & (~MSR_EE)) | (ipl & MSR_EE));
-}
-
-/** Return interrupt priority level.
- *
- * Return EE.
- *
- * @return Current interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	return msr_read();
-}
-
-/** Check whether interrupts are disabled.
- *
- * @return True if interrupts are disabled.
- *
- */
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	return ((msr_read() & MSR_EE) == 0);
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this properly
-	interrupts_enable();
-	interrupts_disable();
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	return *port;
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void asm_delay_loop(uint32_t t);
-extern void userspace_asm(uintptr_t uspace_uarg, uintptr_t stack, uintptr_t entry);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/asm/regname.h
===================================================================
--- kernel/arch/ppc32/include/arch/asm/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,222 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_REGNAME_H_
-#define KERN_ppc32_REGNAME_H_
-
-/* Condition Register Bit Fields */
-#define cr0  0
-#define cr1  1
-#define cr2  2
-#define cr3  3
-#define cr4  4
-#define cr5  5
-#define cr6  6
-#define cr7  7
-
-/* General Purpose Registers (GPRs) */
-#define r0   0
-#define r1   1
-#define r2   2
-#define r3   3
-#define r4   4
-#define r5   5
-#define r6   6
-#define r7   7
-#define r8   8
-#define r9   9
-#define r10  10
-#define r11  11
-#define r12  12
-#define r13  13
-#define r14  14
-#define r15  15
-#define r16  16
-#define r17  17
-#define r18  18
-#define r19  19
-#define r20  20
-#define r21  21
-#define r22  22
-#define r23  23
-#define r24  24
-#define r25  25
-#define r26  26
-#define r27  27
-#define r28  28
-#define r29  29
-#define r30  30
-#define r31  31
-
-/* GPR Aliases */
-#define sp  1
-
-/* Floating Point Registers (FPRs) */
-#define fr0   0
-#define fr1   1
-#define fr2   2
-#define fr3   3
-#define fr4   4
-#define fr5   5
-#define fr6   6
-#define fr7   7
-#define fr8   8
-#define fr9   9
-#define fr10  10
-#define fr11  11
-#define fr12  12
-#define fr13  13
-#define fr14  14
-#define fr15  15
-#define fr16  16
-#define fr17  17
-#define fr18  18
-#define fr19  19
-#define fr20  20
-#define fr21  21
-#define fr22  22
-#define fr23  23
-#define fr24  24
-#define fr25  25
-#define fr26  26
-#define fr27  27
-#define fr28  28
-#define fr29  29
-#define fr30  30
-#define fr31  31
-
-#define vr0   0
-#define vr1   1
-#define vr2   2
-#define vr3   3
-#define vr4   4
-#define vr5   5
-#define vr6   6
-#define vr7   7
-#define vr8   8
-#define vr9   9
-#define vr10  10
-#define vr11  11
-#define vr12  12
-#define vr13  13
-#define vr14  14
-#define vr15  15
-#define vr16  16
-#define vr17  17
-#define vr18  18
-#define vr19  19
-#define vr20  20
-#define vr21  21
-#define vr22  22
-#define vr23  23
-#define vr24  24
-#define vr25  25
-#define vr26  26
-#define vr27  27
-#define vr28  28
-#define vr29  29
-#define vr30  30
-#define vr31  31
-
-#define evr0   0
-#define evr1   1
-#define evr2   2
-#define evr3   3
-#define evr4   4
-#define evr5   5
-#define evr6   6
-#define evr7   7
-#define evr8   8
-#define evr9   9
-#define evr10  10
-#define evr11  11
-#define evr12  12
-#define evr13  13
-#define evr14  14
-#define evr15  15
-#define evr16  16
-#define evr17  17
-#define evr18  18
-#define evr19  19
-#define evr20  20
-#define evr21  21
-#define evr22  22
-#define evr23  23
-#define evr24  24
-#define evr25  25
-#define evr26  26
-#define evr27  27
-#define evr28  28
-#define evr29  29
-#define evr30  30
-#define evr31  31
-
-/* Special Purpose Registers (SPRs) */
-#define xer      1
-#define lr       8
-#define ctr      9
-#define dec      22
-#define sdr1     25
-#define srr0     26
-#define srr1     27
-#define sprg0    272
-#define sprg1    273
-#define sprg2    274
-#define sprg3    275
-#define prv      287
-#define ibat0u   528
-#define ibat0l   529
-#define ibat1u   530
-#define ibat1l   531
-#define ibat2u   532
-#define ibat2l   533
-#define ibat3u   534
-#define ibat3l   535
-#define dbat0u   536
-#define dbat0l   537
-#define dbat1u   538
-#define dbat1l   539
-#define dbat2u   540
-#define dbat2l   541
-#define dbat3u   542
-#define dbat3l   543
-#define tlbmiss  980
-#define ptehi    981
-#define ptelo    982
-#define hid0     1008
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/boot/boot.h
===================================================================
--- kernel/arch/ppc32/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_BOOT_H_
-#define KERN_ppc32_BOOT_H_
-
-#define BOOT_OFFSET  0x8000
-
-#define TASKMAP_MAX_RECORDS        32
-#define MEMMAP_MAX_RECORDS         32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-#ifndef __ASSEMBLER__
-
-#include <config.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <stddef.h>
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	memmap_t memmap;
-	taskmap_t taskmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern memmap_t memmap;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/context.h
===================================================================
--- kernel/arch/ppc32/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_CONTEXT_H_
-#define KERN_ppc32_CONTEXT_H_
-
-#include <arch/context_struct.h>
-
-#define SP_DELTA  16
-
-#define context_set(ctx, pc, stack, size) \
-    context_set_generic(ctx, pc, stack, size)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/context_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x04
-#define CONTEXT_OFFSET_R2   0x08
-#define CONTEXT_OFFSET_R13  0x0c
-#define CONTEXT_OFFSET_R14  0x10
-#define CONTEXT_OFFSET_R15  0x14
-#define CONTEXT_OFFSET_R16  0x18
-#define CONTEXT_OFFSET_R17  0x1c
-#define CONTEXT_OFFSET_R18  0x20
-#define CONTEXT_OFFSET_R19  0x24
-#define CONTEXT_OFFSET_R20  0x28
-#define CONTEXT_OFFSET_R21  0x2c
-#define CONTEXT_OFFSET_R22  0x30
-#define CONTEXT_OFFSET_R23  0x34
-#define CONTEXT_OFFSET_R24  0x38
-#define CONTEXT_OFFSET_R25  0x3c
-#define CONTEXT_OFFSET_R26  0x40
-#define CONTEXT_OFFSET_R27  0x44
-#define CONTEXT_OFFSET_R28  0x48
-#define CONTEXT_OFFSET_R29  0x4c
-#define CONTEXT_OFFSET_R30  0x50
-#define CONTEXT_OFFSET_R31  0x54
-#define CONTEXT_OFFSET_CR   0x58
-#define CONTEXT_SIZE        0x5c
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct context {
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t r2;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-	uint32_t cr;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/ppc32/include/arch/cpu.h
===================================================================
--- kernel/arch/ppc32/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_CPU_H_
-#define KERN_ppc32_CPU_H_
-
-#include <stdint.h>
-#include <trace.h>
-
-typedef struct {
-	uint16_t version;
-	uint16_t revision;
-} __attribute__((packed)) cpu_arch_t;
-
-_NO_TRACE static inline void cpu_version(cpu_arch_t *info)
-{
-	asm volatile (
-	    "mfpvr %[cpu_info]\n"
-	    : [cpu_info] "=r" (*info)
-	);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/cycle.h
===================================================================
--- kernel/arch/ppc32/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_CYCLE_H_
-#define KERN_ppc32_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	uint32_t lower;
-	uint32_t upper;
-	uint32_t tmp;
-
-	do {
-		asm volatile (
-		    "mftbu %[upper]\n"
-		    "mftb %[lower]\n"
-		    "mftbu %[tmp]\n"
-		    : [upper] "=r" (upper),
-		      [lower] "=r" (lower),
-		      [tmp] "=r" (tmp)
-		);
-	} while (upper != tmp);
-
-	return ((uint64_t) upper << 32) + (uint64_t) lower;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/drivers/pic.h
===================================================================
--- kernel/arch/ppc32/include/arch/drivers/pic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_PIC_H_
-#define KERN_ppc32_PIC_H_
-
-#include <typedefs.h>
-#include <ddi/irq.h>
-
-#define PIC_PENDING_LOW   8
-#define PIC_PENDING_HIGH  4
-#define PIC_MASK_LOW      9
-#define PIC_MASK_HIGH     5
-#define PIC_ACK_LOW       10
-#define PIC_ACK_HIGH      6
-
-extern void pic_init(uintptr_t, size_t, cir_t *, void **);
-extern void pic_enable_interrupt(inr_t);
-extern void pic_disable_interrupt(inr_t);
-extern void pic_ack_interrupt(void *, inr_t);
-extern uint8_t pic_get_pending(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/faddr.h
===================================================================
--- kernel/arch/ppc32/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_FADDR_H_
-#define KERN_ppc32_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/fpu_context.h
===================================================================
--- kernel/arch/ppc32/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_FPU_CONTEXT_H_
-#define KERN_ppc32_FPU_CONTEXT_H_
-
-#include <arch/fpu_context_struct.h>
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/fpu_context_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/fpu_context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-#define KERN_ARCH_FPU_CONTEXT_STRUCT_H_
-
-#define FPU_CONTEXT_OFFSET_FR0    0x00
-#define FPU_CONTEXT_OFFSET_FR1    0x08
-#define FPU_CONTEXT_OFFSET_FR2    0x10
-#define FPU_CONTEXT_OFFSET_FR3    0x18
-#define FPU_CONTEXT_OFFSET_FR4    0x20
-#define FPU_CONTEXT_OFFSET_FR5    0x28
-#define FPU_CONTEXT_OFFSET_FR6    0x30
-#define FPU_CONTEXT_OFFSET_FR7    0x38
-#define FPU_CONTEXT_OFFSET_FR8    0x40
-#define FPU_CONTEXT_OFFSET_FR9    0x48
-#define FPU_CONTEXT_OFFSET_FR10   0x50
-#define FPU_CONTEXT_OFFSET_FR11   0x58
-#define FPU_CONTEXT_OFFSET_FR12   0x60
-#define FPU_CONTEXT_OFFSET_FR13   0x68
-#define FPU_CONTEXT_OFFSET_FR14   0x70
-#define FPU_CONTEXT_OFFSET_FR15   0x78
-#define FPU_CONTEXT_OFFSET_FR16   0x80
-#define FPU_CONTEXT_OFFSET_FR17   0x88
-#define FPU_CONTEXT_OFFSET_FR18   0x90
-#define FPU_CONTEXT_OFFSET_FR19   0x98
-#define FPU_CONTEXT_OFFSET_FR20   0xa0
-#define FPU_CONTEXT_OFFSET_FR21   0xa8
-#define FPU_CONTEXT_OFFSET_FR22   0xb0
-#define FPU_CONTEXT_OFFSET_FR23   0xb8
-#define FPU_CONTEXT_OFFSET_FR24   0xc0
-#define FPU_CONTEXT_OFFSET_FR25   0xc8
-#define FPU_CONTEXT_OFFSET_FR26   0xd0
-#define FPU_CONTEXT_OFFSET_FR27   0xd8
-#define FPU_CONTEXT_OFFSET_FR28   0xe0
-#define FPU_CONTEXT_OFFSET_FR29   0xe8
-#define FPU_CONTEXT_OFFSET_FR30   0xf0
-#define FPU_CONTEXT_OFFSET_FR31   0xf8
-#define FPU_CONTEXT_OFFSET_FPSCR  0x100
-#define FPU_CONTEXT_SIZE          0x108
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct fpu_context {
-	_Alignas(8) uint64_t fr0;
-	uint64_t fr1;
-	uint64_t fr2;
-	uint64_t fr3;
-	uint64_t fr4;
-	uint64_t fr5;
-	uint64_t fr6;
-	uint64_t fr7;
-	uint64_t fr8;
-	uint64_t fr9;
-	uint64_t fr10;
-	uint64_t fr11;
-	uint64_t fr12;
-	uint64_t fr13;
-	uint64_t fr14;
-	uint64_t fr15;
-	uint64_t fr16;
-	uint64_t fr17;
-	uint64_t fr18;
-	uint64_t fr19;
-	uint64_t fr20;
-	uint64_t fr21;
-	uint64_t fr22;
-	uint64_t fr23;
-	uint64_t fr24;
-	uint64_t fr25;
-	uint64_t fr26;
-	uint64_t fr27;
-	uint64_t fr28;
-	uint64_t fr29;
-	uint64_t fr30;
-	uint64_t fr31;
-	uint64_t fpscr;
-} fpu_context_t;
-
-#endif
-#endif
Index: rnel/arch/ppc32/include/arch/interrupt.h
===================================================================
--- kernel/arch/ppc32/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_INTERRUPT_H_
-#define KERN_ppc32_INTERRUPT_H_
-
-#include <arch/istate.h>
-
-#define IVT_ITEMS  16
-#define IVT_FIRST  0
-
-#define VECTOR_DATA_STORAGE         2
-#define VECTOR_INSTRUCTION_STORAGE  3
-#define VECTOR_EXTERNAL             4
-#define VECTOR_FP_UNAVAILABLE       7
-#define VECTOR_DECREMENTER          8
-#define VECTOR_ITLB_MISS            13
-#define VECTOR_DTLB_MISS_LOAD       14
-#define VECTOR_DTLB_MISS_STORE      15
-
-extern void decrementer_start(uint32_t);
-extern void decrementer_restart(void);
-extern void interrupt_init(void);
-extern void extint_handler(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/istate.h
===================================================================
--- kernel/arch/ppc32/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_EXCEPTION_H_
-#define KERN_ppc32_EXCEPTION_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/istate_struct.h>
-#include <arch/msr.h>
-
-#else /* KERNEL */
-
-#include <libarch/istate_struct.h>
-#include <libarch/msr.h>
-
-#endif /* KERNEL */
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->pc = retaddr;
-}
-
-/** Return true if exception happened while in userspace
- *
- * The contexts of MSR register was stored in SRR1.
- *
- */
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return (istate->srr1 & MSR_PR) != 0;
-}
-
-_NO_TRACE static inline sysarg_t istate_get_pc(istate_t *istate)
-{
-	return istate->pc;
-}
-
-_NO_TRACE static inline sysarg_t istate_get_fp(istate_t *istate)
-{
-	return istate->sp;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/istate_struct.h
===================================================================
--- kernel/arch/ppc32/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_SP_FRAME  0x00
-#define ISTATE_OFFSET_LR_FRAME  0x04
-#define ISTATE_OFFSET_R0        0x08
-#define ISTATE_OFFSET_R2        0x0c
-#define ISTATE_OFFSET_R3        0x10
-#define ISTATE_OFFSET_R4        0x14
-#define ISTATE_OFFSET_R5        0x18
-#define ISTATE_OFFSET_R6        0x1c
-#define ISTATE_OFFSET_R7        0x20
-#define ISTATE_OFFSET_R8        0x24
-#define ISTATE_OFFSET_R9        0x28
-#define ISTATE_OFFSET_R10       0x2c
-#define ISTATE_OFFSET_R11       0x30
-#define ISTATE_OFFSET_R13       0x34
-#define ISTATE_OFFSET_R14       0x38
-#define ISTATE_OFFSET_R15       0x3c
-#define ISTATE_OFFSET_R16       0x40
-#define ISTATE_OFFSET_R17       0x44
-#define ISTATE_OFFSET_R18       0x48
-#define ISTATE_OFFSET_R19       0x4c
-#define ISTATE_OFFSET_R20       0x50
-#define ISTATE_OFFSET_R21       0x54
-#define ISTATE_OFFSET_R22       0x58
-#define ISTATE_OFFSET_R23       0x5c
-#define ISTATE_OFFSET_R24       0x60
-#define ISTATE_OFFSET_R25       0x64
-#define ISTATE_OFFSET_R26       0x68
-#define ISTATE_OFFSET_R27       0x6c
-#define ISTATE_OFFSET_R28       0x70
-#define ISTATE_OFFSET_R29       0x74
-#define ISTATE_OFFSET_R30       0x78
-#define ISTATE_OFFSET_R31       0x7c
-#define ISTATE_OFFSET_CR        0x80
-#define ISTATE_OFFSET_PC        0x84
-#define ISTATE_OFFSET_SRR1      0x88
-#define ISTATE_OFFSET_LR        0x8c
-#define ISTATE_OFFSET_CTR       0x90
-#define ISTATE_OFFSET_XER       0x94
-#define ISTATE_OFFSET_DAR       0x98
-#define ISTATE_OFFSET_R12       0x9c
-#define ISTATE_OFFSET_SP        0xa0
-#define ISTATE_SIZE             0xa4
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#ifdef KERNEL
-#include <typedefs.h>
-#else
-#include <stddef.h>
-#endif
-
-typedef struct istate {
-	/* imitation of frame pointer linkage */
-	uint32_t sp_frame;
-	/* imitation of return address linkage */
-	uint32_t lr_frame;
-	uint32_t r0;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t r11;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-	uint32_t cr;
-	uint32_t pc;
-	uint32_t srr1;
-	uint32_t lr;
-	uint32_t ctr;
-	uint32_t xer;
-	uint32_t dar;
-	uint32_t r12;
-	uint32_t sp;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/ppc32/include/arch/mm/as.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_AS_H_
-#define KERN_ppc32_AS_H_
-
-#include <arch/mm/pht.h>
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT32_C(0x80000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT32_C(0xffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT32_C(0x7fffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-
-#define as_invalidate_translation_cache(as, page, cnt) \
-	pht_invalidate((as), (page), (cnt))
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/asid.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_ASID_H_
-#define KERN_ppc32_ASID_H_
-
-#include <stdint.h>
-
-#define ASID_MAX_ARCH  4096
-
-typedef uint32_t asid_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/frame.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_FRAME_H_
-#define KERN_ppc32_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-#include <trace.h>
-
-_NO_TRACE static inline uint32_t physmem_top(void)
-{
-	uint32_t physmem;
-
-	asm volatile (
-	    "mfsprg3 %[physmem]\n"
-	    : [physmem] "=r" (physmem)
-	);
-
-	return physmem;
-}
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/km.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_KM_H_
-#define KERN_ppc32_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define KM_PPC32_IDENTITY_START		UINT32_C(0x80000000)
-#define KM_PPC32_IDENTITY_SIZE		UINT32_C(0x40000000)
-
-#define KM_PPC32_NON_IDENTITY_START	UINT32_C(0xc0000000)
-#define KM_PPC32_NON_IDENTITY_SIZE	UINT32_C(0x40000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/page.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_PAGE_H_
-#define KERN_ppc32_PAGE_H_
-
-#include <arch/mm/frame.h>
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#ifndef __ASSEMBLER__
-#define KA2PA(x)  (((uintptr_t) (x)) - 0x80000000)
-#define PA2KA(x)  (((uintptr_t) (x)) + 0x80000000)
-#else
-#define KA2PA(x)  ((x) - 0x80000000)
-#define PA2KA(x)  ((x) + 0x80000000)
-#endif
-
-/*
- * Implementation of generic 4-level page table interface,
- * the hardware Page Hash Table is used as cache.
- *
- * Page table layout:
- * - 32-bit virtual addressess
- * - Offset is 12 bits => pages are 4K long
- * - PTL0 has 1024 entries (10 bits)
- * - PTL1 is not used
- * - PTL2 is not used
- * - PLT3 has 1024 entries (10 bits)
- */
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  1024
-#define PTL1_ENTRIES_ARCH  0
-#define PTL2_ENTRIES_ARCH  0
-#define PTL3_ENTRIES_ARCH  1024
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices into page tables on each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 22) & 0x3ff)
-#define PTL1_INDEX_ARCH(vaddr)  0
-#define PTL2_INDEX_ARCH(vaddr)  0
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x3ff)
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	(((pte_t *) (ptl0))[(i)].pfn << 12)
-
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	(ptl1)
-
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	(ptl2)
-
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	(((pte_t *) (ptl3))[(i)].pfn << 12)
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0)
-
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].pfn = (a) >> 12)
-
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	PAGE_PRESENT
-
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	PAGE_PRESENT
-
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, x) \
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), (x))
-
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, x) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (x))
-
-/* Set PTE present accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-
-#define SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT_ARCH(ptl2, i)
-
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last-level PTEs. */
-#define PTE_VALID_ARCH(pte)       ((pte)->valid != 0)
-#define PTE_PRESENT_ARCH(pte)     ((pte)->present != 0)
-#define PTE_GET_FRAME_ARCH(pte)   ((pte)->pfn << 12)
-#define PTE_WRITABLE_ARCH(pte)    1
-#define PTE_EXECUTABLE_ARCH(pte)  1
-
-#ifndef __ASSEMBLER__
-
-#include <mm/mm.h>
-#include <arch/interrupt.h>
-#include <trace.h>
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned int present : 1;             /**< Present bit. */
-	unsigned int page_write_through : 1;  /**< Write thought caching. */
-	unsigned int page_cache_disable : 1;  /**< No caching. */
-	unsigned int accessed : 1;            /**< Accessed bit. */
-	unsigned int global : 1;              /**< Global bit. */
-	unsigned int valid : 1;               /**< Valid content even if not present. */
-	unsigned int pfn : 20;                /**< Physical frame number. */
-} pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-{
-	pte_t *entry = &pt[i];
-
-	return (((!entry->page_cache_disable) << PAGE_CACHEABLE_SHIFT) |
-	    ((!entry->present) << PAGE_PRESENT_SHIFT) |
-	    (1 << PAGE_USER_SHIFT) |
-	    (1 << PAGE_READ_SHIFT) |
-	    (1 << PAGE_WRITE_SHIFT) |
-	    (1 << PAGE_EXEC_SHIFT) |
-	    (entry->global << PAGE_GLOBAL_SHIFT));
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_t *entry = &pt[i];
-
-	entry->page_cache_disable = !(flags & PAGE_CACHEABLE);
-	entry->present = !(flags & PAGE_NOT_PRESENT);
-	entry->global = (flags & PAGE_GLOBAL) != 0;
-	entry->valid = 1;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *entry = &pt[i];
-
-	entry->present = 1;
-}
-
-extern void page_arch_init(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/pht.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/pht.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_PHT_H_
-#define KERN_ppc32_PHT_H_
-
-#include <arch/interrupt.h>
-#include <typedefs.h>
-
-/* Forward declaration. */
-struct as;
-
-extern void pht_init(void);
-extern void pht_refill(unsigned int, istate_t *);
-extern void pht_invalidate(struct as *, uintptr_t, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/ppc32/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_TLB_H_
-#define KERN_ppc32_TLB_H_
-
-#include <arch/interrupt.h>
-
-#define WIMG_GUARDED    0x01
-#define WIMG_COHERENT   0x02
-#define WIMG_NO_CACHE   0x04
-#define WIMG_WRITETHRU  0x08
-
-typedef struct {
-	unsigned int v : 1;          /**< Valid */
-	unsigned int vsid : 24;      /**< Virtual Segment ID */
-	unsigned int h : 1;          /**< Primary/secondary hash */
-	unsigned int api : 6;        /**< Abbreviated Page Index */
-	unsigned int rpn : 20;       /**< Real Page Number */
-	unsigned int reserved0 : 3;
-	unsigned int r : 1;          /**< Reference */
-	unsigned int c : 1;          /**< Change */
-	unsigned int wimg : 4;       /**< Access control */
-	unsigned int reserved1 : 1;
-	unsigned int pp : 2;         /**< Page protection */
-} phte_t;
-
-typedef struct {
-	unsigned int v : 1;
-	unsigned int vsid : 24;
-	unsigned int reserved0 : 1;
-	unsigned int api : 6;
-} ptehi_t;
-
-typedef struct {
-	unsigned int rpn : 20;
-	unsigned int xpn : 3;
-	unsigned int reserved0 : 1;
-	unsigned int c : 1;
-	unsigned int wimg : 4;
-	unsigned int x : 1;
-	unsigned int pp : 2;
-} ptelo_t;
-
-extern void tlb_refill(unsigned int, istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/msr.h
===================================================================
--- kernel/arch/ppc32/include/arch/msr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_MSR_H_
-#define KERN_ppc32_MSR_H_
-
-/* MSR bits */
-#define MSR_DR  (1 << 4)
-#define MSR_IR  (1 << 5)
-#define MSR_FE1 (1 << 8)
-#define MSR_FE0 (1 << 11)
-#define MSR_FP  (1 << 13)
-#define MSR_PR  (1 << 14)
-#define MSR_EE  (1 << 15)
-
-/* HID0 bits */
-#define HID0_STEN  (1 << 24)
-#define HID0_ICE   (1 << 15)
-#define HID0_DCE   (1 << 14)
-#define HID0_ICFI  (1 << 11)
-#define HID0_DCI   (1 << 10)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/proc/task.h
===================================================================
--- kernel/arch/ppc32/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_TASK_H_
-#define KERN_ppc32_TASK_H_
-
-typedef struct {
-} task_arch_t;
-
-#define task_create_arch(t)
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/proc/thread.h
===================================================================
--- kernel/arch/ppc32/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_THREAD_H_
-#define KERN_ppc32_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(t)
-#define thr_destructor_arch(t)
-#define thread_create_arch(t, flags) (EOK)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/stack.h
===================================================================
--- kernel/arch/ppc32/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_STACK_H_
-#define KERN_ppc32_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#define STACK_ALIGNMENT	16
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/include/arch/types.h
===================================================================
--- kernel/arch/ppc32/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ppc32_TYPES_H_
-#define KERN_ppc32_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/ppc32/meson.build
===================================================================
--- kernel/arch/ppc32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/context.S',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/fpu_context.S',
-	'src/boot/boot.S',
-	'src/ppc32.c',
-	'src/dummy.S',
-	'src/exception.S',
-	'src/interrupt.c',
-	'src/asm.S',
-	'src/cpu/cpu.c',
-	'src/proc/scheduler.c',
-	'src/smc.c',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/pht.c',
-	'src/mm/tlb.c',
-	'src/drivers/pic.c',
-)
-
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-	'include/arch/fpu_context_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/ppc32/src/asm.S
===================================================================
--- kernel/arch/ppc32/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,269 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <arch/msr.h>
-#include <arch/istate_struct.h>
-
-.text
-
-FUNCTION_BEGIN(userspace_asm)
-	/*
-	 * r3 = uspace_uarg
-	 * r4 = stack
-	 * r5 = entry
-	 */
-
-	/* Disable interrupts */
-
-	mfmsr r31
-	rlwinm r31, r31, 0, 17, 15
-	mtmsr r31
-	isync
-
-	/* Set entry point */
-
-	mtsrr0 r5
-
-	/* Set privileged state, enable interrupts */
-
-	ori r31, r31, MSR_PR
-	ori r31, r31, MSR_EE
-	mtsrr1 r31
-
-	/* Set stack */
-
-	mr sp, r4
-
-	/* %r6 is defined to hold pcb_ptr - set it to 0 */
-
-	xor r6, r6, r6
-
-	/* Jump to userspace */
-
-	rfi
-FUNCTION_END(userspace_asm)
-
-SYMBOL(iret)
-	/* Disable interrupts */
-
-	mfmsr r31
-	rlwinm r31, r31, 0, 17, 15
-	mtmsr r31
-	isync
-
-	lwz r0, ISTATE_OFFSET_R0(sp)
-	lwz r2, ISTATE_OFFSET_R2(sp)
-	lwz r3, ISTATE_OFFSET_R3(sp)
-	lwz r4, ISTATE_OFFSET_R4(sp)
-	lwz r5, ISTATE_OFFSET_R5(sp)
-	lwz r6, ISTATE_OFFSET_R6(sp)
-	lwz r7, ISTATE_OFFSET_R7(sp)
-	lwz r8, ISTATE_OFFSET_R8(sp)
-	lwz r9, ISTATE_OFFSET_R9(sp)
-	lwz r10, ISTATE_OFFSET_R10(sp)
-	lwz r11, ISTATE_OFFSET_R11(sp)
-	lwz r13, ISTATE_OFFSET_R13(sp)
-	lwz r14, ISTATE_OFFSET_R14(sp)
-	lwz r15, ISTATE_OFFSET_R15(sp)
-	lwz r16, ISTATE_OFFSET_R16(sp)
-	lwz r17, ISTATE_OFFSET_R17(sp)
-	lwz r18, ISTATE_OFFSET_R18(sp)
-	lwz r19, ISTATE_OFFSET_R19(sp)
-	lwz r20, ISTATE_OFFSET_R20(sp)
-	lwz r21, ISTATE_OFFSET_R21(sp)
-	lwz r22, ISTATE_OFFSET_R22(sp)
-	lwz r23, ISTATE_OFFSET_R23(sp)
-	lwz r24, ISTATE_OFFSET_R24(sp)
-	lwz r25, ISTATE_OFFSET_R25(sp)
-	lwz r26, ISTATE_OFFSET_R26(sp)
-	lwz r27, ISTATE_OFFSET_R27(sp)
-	lwz r28, ISTATE_OFFSET_R28(sp)
-	lwz r29, ISTATE_OFFSET_R29(sp)
-	lwz r30, ISTATE_OFFSET_R30(sp)
-	lwz r31, ISTATE_OFFSET_R31(sp)
-
-	lwz r12, ISTATE_OFFSET_CR(sp)
-	mtcr r12
-
-	lwz r12, ISTATE_OFFSET_PC(sp)
-	mtsrr0 r12
-
-	lwz r12, ISTATE_OFFSET_SRR1(sp)
-	mtsrr1 r12
-
-	lwz r12, ISTATE_OFFSET_LR(sp)
-	mtlr r12
-
-	lwz r12, ISTATE_OFFSET_CTR(sp)
-	mtctr r12
-
-	lwz r12, ISTATE_OFFSET_XER(sp)
-	mtxer r12
-
-	lwz r12, ISTATE_OFFSET_R12(sp)
-	lwz sp, ISTATE_OFFSET_SP(sp)
-
-	rfi
-
-SYMBOL(iret_syscall)
-	/* Disable interrupts */
-
-	mfmsr r31
-	rlwinm r31, r31, 0, 17, 15
-	mtmsr r31
-	isync
-
-	lwz r0, ISTATE_OFFSET_R0(sp)
-	lwz r2, ISTATE_OFFSET_R2(sp)
-	lwz r4, ISTATE_OFFSET_R4(sp)
-	lwz r5, ISTATE_OFFSET_R5(sp)
-	lwz r6, ISTATE_OFFSET_R6(sp)
-	lwz r7, ISTATE_OFFSET_R7(sp)
-	lwz r8, ISTATE_OFFSET_R8(sp)
-	lwz r9, ISTATE_OFFSET_R9(sp)
-	lwz r10, ISTATE_OFFSET_R10(sp)
-	lwz r11, ISTATE_OFFSET_R11(sp)
-	lwz r13, ISTATE_OFFSET_R13(sp)
-	lwz r14, ISTATE_OFFSET_R14(sp)
-	lwz r15, ISTATE_OFFSET_R15(sp)
-	lwz r16, ISTATE_OFFSET_R16(sp)
-	lwz r17, ISTATE_OFFSET_R17(sp)
-	lwz r18, ISTATE_OFFSET_R18(sp)
-	lwz r19, ISTATE_OFFSET_R19(sp)
-	lwz r20, ISTATE_OFFSET_R20(sp)
-	lwz r21, ISTATE_OFFSET_R21(sp)
-	lwz r22, ISTATE_OFFSET_R22(sp)
-	lwz r23, ISTATE_OFFSET_R23(sp)
-	lwz r24, ISTATE_OFFSET_R24(sp)
-	lwz r25, ISTATE_OFFSET_R25(sp)
-	lwz r26, ISTATE_OFFSET_R26(sp)
-	lwz r27, ISTATE_OFFSET_R27(sp)
-	lwz r28, ISTATE_OFFSET_R28(sp)
-	lwz r29, ISTATE_OFFSET_R29(sp)
-	lwz r30, ISTATE_OFFSET_R30(sp)
-	lwz r31, ISTATE_OFFSET_R31(sp)
-
-	lwz r12, ISTATE_OFFSET_CR(sp)
-	mtcr r12
-
-	lwz r12, ISTATE_OFFSET_PC(sp)
-	mtsrr0 r12
-
-	lwz r12, ISTATE_OFFSET_SRR1(sp)
-	mtsrr1 r12
-
-	lwz r12, ISTATE_OFFSET_LR(sp)
-	mtlr r12
-
-	lwz r12, ISTATE_OFFSET_CTR(sp)
-	mtctr r12
-
-	lwz r12, ISTATE_OFFSET_XER(sp)
-	mtxer r12
-
-	lwz r12, ISTATE_OFFSET_R12(sp)
-	lwz sp, ISTATE_OFFSET_SP(sp)
-
-	rfi
-
-FUNCTION_BEGIN(memcpy_from_uspace)
-FUNCTION_BEGIN(memcpy_to_uspace)
-	srwi. r7, r5, 3
-	addi r6, r3, -4
-	addi r4, r4, -4
-	beq 2f
-
-	andi. r0, r6, 3
-	mtctr r7
-	bne 5f
-
-	1:
-
-		lwz r7, 4(r4)
-		lwzu r8, 8(r4)
-		stw r7, 4(r6)
-		stwu r8, 8(r6)
-		bdnz 1b
-
-		andi. r5, r5, 7
-
-	2:
-
-		cmplwi 0, r5, 4
-		blt 3f
-
-		lwzu r0, 4(r4)
-		addi r5, r5, -4
-		stwu r0, 4(r6)
-
-	3:
-
-		cmpwi 0, r5, 0
-		beqlr
-		mtctr r5
-		addi r4, r4, 3
-		addi r6, r6, 3
-
-	4:
-
-		lbzu r0, 1(r4)
-		stbu r0, 1(r6)
-		bdnz 4b
-		blr
-
-	5:
-
-		subfic r0, r0, 4
-		mtctr r0
-
-	6:
-
-		lbz r7, 4(r4)
-		addi r4, r4, 1
-		stb r7, 4(r6)
-		addi r6, r6, 1
-		bdnz 6b
-		subf r5, r0, r5
-		rlwinm. r7, r5, 32-3, 3, 31
-		beq 2b
-		mtctr r7
-		b 1b
-FUNCTION_END(memcpy_from_uspace)
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	/* Return zero, failure */
-	xor r3, r3, r3
-	blr
-
-FUNCTION_BEGIN(early_putuchar)
-	blr
-FUNCTION_END(early_putuchar)
Index: rnel/arch/ppc32/src/boot/boot.S
===================================================================
--- kernel/arch/ppc32/src/boot/boot.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <config.h>
-
-.section K_TEXT_START, "ax"
-
-SYMBOL(kernel_image_start)
-	# load temporary kernel stack
-
-	lis sp, kernel_stack@ha
-	addi sp, sp, kernel_stack@l
-
-	# set kernel stack for interrupt handling
-
-	mr r31, sp
-	subis r31, r31, 0x8000
-	mtsprg0 r31
-
-	# r3 contains physical address of bootinfo_t
-
-	addis r3, r3, 0x8000
-	bl ppc32_pre_main
-	b main_bsp
-
-.section K_DATA_START, "aw", @progbits
-
-.align 12
-kernel_stack_bottom:
-	.space STACK_SIZE
-kernel_stack:
Index: rnel/arch/ppc32/src/context.S
===================================================================
--- kernel/arch/ppc32/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-#include <arch/asm/regname.h>
-
-.text
-
-FUNCTION_BEGIN(context_save_arch)
-	stw sp, CONTEXT_OFFSET_SP(r3)
-	stw r2, CONTEXT_OFFSET_R2(r3)
-	stw r13, CONTEXT_OFFSET_R13(r3)
-	stw r14, CONTEXT_OFFSET_R14(r3)
-	stw r15, CONTEXT_OFFSET_R15(r3)
-	stw r16, CONTEXT_OFFSET_R16(r3)
-	stw r17, CONTEXT_OFFSET_R17(r3)
-	stw r18, CONTEXT_OFFSET_R18(r3)
-	stw r19, CONTEXT_OFFSET_R19(r3)
-	stw r20, CONTEXT_OFFSET_R20(r3)
-	stw r21, CONTEXT_OFFSET_R21(r3)
-	stw r22, CONTEXT_OFFSET_R22(r3)
-	stw r23, CONTEXT_OFFSET_R23(r3)
-	stw r24, CONTEXT_OFFSET_R24(r3)
-	stw r25, CONTEXT_OFFSET_R25(r3)
-	stw r26, CONTEXT_OFFSET_R26(r3)
-	stw r27, CONTEXT_OFFSET_R27(r3)
-	stw r28, CONTEXT_OFFSET_R28(r3)
-	stw r29, CONTEXT_OFFSET_R29(r3)
-	stw r30, CONTEXT_OFFSET_R30(r3)
-	stw r31, CONTEXT_OFFSET_R31(r3)
-
-	mflr r4
-	stw r4, CONTEXT_OFFSET_PC(r3)
-
-	mfcr r4
-	stw r4, CONTEXT_OFFSET_CR(r3)
-
-	# context_save returns 1
-	li r3, 1
-	blr
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	lwz sp, CONTEXT_OFFSET_SP(r3)
-	lwz r2, CONTEXT_OFFSET_R2(r3)
-	lwz r13, CONTEXT_OFFSET_R13(r3)
-	lwz r14, CONTEXT_OFFSET_R14(r3)
-	lwz r15, CONTEXT_OFFSET_R15(r3)
-	lwz r16, CONTEXT_OFFSET_R16(r3)
-	lwz r17, CONTEXT_OFFSET_R17(r3)
-	lwz r18, CONTEXT_OFFSET_R18(r3)
-	lwz r19, CONTEXT_OFFSET_R19(r3)
-	lwz r20, CONTEXT_OFFSET_R20(r3)
-	lwz r21, CONTEXT_OFFSET_R21(r3)
-	lwz r22, CONTEXT_OFFSET_R22(r3)
-	lwz r23, CONTEXT_OFFSET_R23(r3)
-	lwz r24, CONTEXT_OFFSET_R24(r3)
-	lwz r25, CONTEXT_OFFSET_R25(r3)
-	lwz r26, CONTEXT_OFFSET_R26(r3)
-	lwz r27, CONTEXT_OFFSET_R27(r3)
-	lwz r28, CONTEXT_OFFSET_R28(r3)
-	lwz r29, CONTEXT_OFFSET_R29(r3)
-	lwz r30, CONTEXT_OFFSET_R30(r3)
-	lwz r31, CONTEXT_OFFSET_R31(r3)
-
-	lwz r4, CONTEXT_OFFSET_CR(r3)
-	mtcr r4
-
-	lwz r4, CONTEXT_OFFSET_PC(r3)
-	mtlr r4
-
-	# context_restore returns 0
-	li r3, 0
-	blr
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/ppc32/src/cpu/cpu.c
===================================================================
--- kernel/arch/ppc32/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <stdio.h>
-#include <fpu_context.h>
-
-void cpu_arch_init(void)
-{
-#ifdef CONFIG_FPU
-	fpu_enable();
-#endif
-}
-
-void cpu_identify(void)
-{
-	cpu_version(&CPU->arch);
-}
-
-void cpu_print_report(cpu_t *cpu)
-{
-	const char *name;
-
-	switch (cpu->arch.version) {
-	case 8:
-		name = "PowerPC 750";
-		break;
-	case 9:
-		name = "PowerPC 604e";
-		break;
-	case 0x81:
-		name = "PowerPC 8260";
-		break;
-	case 0x8081:
-		name = "PowerPC 826xA";
-		break;
-	default:
-		name = "unknown";
-	}
-
-	printf("cpu%u: version=%" PRIu16 " (%s), revision=%" PRIu16 "\n", cpu->id,
-	    cpu->arch.version, name, cpu->arch.revision);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/debug/stacktrace.c
===================================================================
--- kernel/arch/ppc32/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       1
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint32_t *stack = (void *) ctx->fp;
-	*prev = stack[FRAME_OFFSET_FP_PREV];
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint32_t *stack = (void *) ctx->fp;
-	*ra = stack[FRAME_OFFSET_RA];
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return ctx->fp != 0;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return !copy_from_uspace(prev,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_FP_PREV, sizeof(*prev));
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return !copy_from_uspace(ra,
-	    ctx->fp + sizeof(uintptr_t) * FRAME_OFFSET_RA, sizeof(*ra));
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/ppc32/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	mr r3, sp
-	blr
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	mflr r3
-	blr
-FUNCTION_END(program_counter_get)
Index: rnel/arch/ppc32/src/drivers/pic.c
===================================================================
--- kernel/arch/ppc32/src/drivers/pic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#include <arch/drivers/pic.h>
-#include <mm/km.h>
-#include <byteorder.h>
-#include <bitops.h>
-#include <typedefs.h>
-
-static ioport32_t *pic = NULL;
-
-void pic_init(uintptr_t base, size_t size, cir_t *cir, void **cir_arg)
-{
-	pic = (uint32_t *) km_map(base, size, KM_NATURAL_ALIGNMENT,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	*cir = pic_ack_interrupt;
-	*cir_arg = NULL;
-}
-
-void pic_enable_interrupt(inr_t intnum)
-{
-	if (!pic)
-		return;
-
-	if (intnum < 32) {
-		pio_write_32(&pic[PIC_MASK_LOW],
-		    pio_read_32(&pic[PIC_MASK_LOW]) | (1 << intnum));
-	} else {
-		pio_write_32(&pic[PIC_MASK_HIGH],
-		    pio_read_32(&pic[PIC_MASK_HIGH]) | (1 << (intnum - 32)));
-	}
-}
-
-void pic_disable_interrupt(inr_t intnum)
-{
-	if (!pic)
-		return;
-
-	if (intnum < 32) {
-		pio_write_32(&pic[PIC_MASK_LOW],
-		    pio_read_32(&pic[PIC_MASK_LOW]) & (~(1 << intnum)));
-	} else {
-		pio_write_32(&pic[PIC_MASK_HIGH],
-		    pio_read_32(&pic[PIC_MASK_HIGH]) & (~(1 << (intnum - 32))));
-	}
-}
-
-void pic_ack_interrupt(void *arg, inr_t intnum)
-{
-	if (!pic)
-		return;
-
-	if (intnum < 32) {
-		pio_write_32(&pic[PIC_ACK_LOW], 1 << intnum);
-	} else {
-		pio_write_32(&pic[PIC_ACK_HIGH], 1 << (intnum - 32));
-	}
-}
-
-/** Return number of pending interrupts
- *
- */
-uint8_t pic_get_pending(void)
-{
-	if (pic) {
-		uint32_t pending;
-
-		pending = pio_read_32(&pic[PIC_PENDING_LOW]);
-		if (pending != 0)
-			return fnzb32(pending);
-
-		pending = pio_read_32(&pic[PIC_PENDING_HIGH]);
-		if (pending != 0)
-			return fnzb32(pending) + 32;
-	}
-
-	return 255;
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/dummy.S
===================================================================
--- kernel/arch/ppc32/src/dummy.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(asm_delay_loop)
-	blr
-FUNCTION_END(asm_delay_loop)
-
-FUNCTION_BEGIN(cpu_halt)
-	b cpu_halt
-FUNCTION_END(cpu_halt)
Index: rnel/arch/ppc32/src/exception.S
===================================================================
--- kernel/arch/ppc32/src/exception.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,298 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <arch/msr.h>
-#include <arch/mm/page.h>
-#include <arch/istate_struct.h>
-#include <arch/stack.h>
-#include <align.h>
-
-.section K_UNMAPPED_TEXT_START, "ax"
-
-.macro CONTEXT_STORE
-
-	# save r12 in SPRG1, backup CR in r12
-	# save SP in SPRG2
-
-	mtsprg1 r12
-	mfcr r12
-	mtsprg2 sp
-
-	# check whether the previous mode was user or kernel
-
-	mfsrr1 sp # use sp as a temporary register to hold SRR1
-	andi. sp, sp, MSR_PR
-	bne 1f
-		# previous mode was kernel
-
-		mfsprg2 sp
-		subis sp, sp, 0x8000
-	b 2f
-
-	1:
-		# previous mode was user
-
-		mfsprg0 sp
-	2:
-
-	subi sp, sp, ALIGN_UP(ISTATE_SIZE, STACK_ALIGNMENT)
-	stw r0, ISTATE_OFFSET_R0(sp)
-	stw r2, ISTATE_OFFSET_R2(sp)
-	stw r3, ISTATE_OFFSET_R3(sp)
-	stw r4, ISTATE_OFFSET_R4(sp)
-	stw r5, ISTATE_OFFSET_R5(sp)
-	stw r6, ISTATE_OFFSET_R6(sp)
-	stw r7, ISTATE_OFFSET_R7(sp)
-	stw r8, ISTATE_OFFSET_R8(sp)
-	stw r9, ISTATE_OFFSET_R9(sp)
-	stw r10, ISTATE_OFFSET_R10(sp)
-	stw r11, ISTATE_OFFSET_R11(sp)
-	stw r13, ISTATE_OFFSET_R13(sp)
-	stw r14, ISTATE_OFFSET_R14(sp)
-	stw r15, ISTATE_OFFSET_R15(sp)
-	stw r16, ISTATE_OFFSET_R16(sp)
-	stw r17, ISTATE_OFFSET_R17(sp)
-	stw r18, ISTATE_OFFSET_R18(sp)
-	stw r19, ISTATE_OFFSET_R19(sp)
-	stw r20, ISTATE_OFFSET_R20(sp)
-	stw r21, ISTATE_OFFSET_R21(sp)
-	stw r22, ISTATE_OFFSET_R22(sp)
-	stw r23, ISTATE_OFFSET_R23(sp)
-	stw r24, ISTATE_OFFSET_R24(sp)
-	stw r25, ISTATE_OFFSET_R25(sp)
-	stw r26, ISTATE_OFFSET_R26(sp)
-	stw r27, ISTATE_OFFSET_R27(sp)
-	stw r28, ISTATE_OFFSET_R28(sp)
-	stw r29, ISTATE_OFFSET_R29(sp)
-	stw r30, ISTATE_OFFSET_R30(sp)
-	stw r31, ISTATE_OFFSET_R31(sp)
-
-	stw r12, ISTATE_OFFSET_CR(sp)
-
-	mfsrr0 r12
-	stw r12, ISTATE_OFFSET_PC(sp)
-
-	mfsrr1 r12
-	stw r12, ISTATE_OFFSET_SRR1(sp)
-
-	mflr r12
-	stw r12, ISTATE_OFFSET_LR(sp)
-
-	mfctr r12
-	stw r12, ISTATE_OFFSET_CTR(sp)
-
-	mfxer r12
-	stw r12, ISTATE_OFFSET_XER(sp)
-
-	mfdar r12
-	stw r12, ISTATE_OFFSET_DAR(sp)
-
-	mfsprg1 r12
-	stw r12, ISTATE_OFFSET_R12(sp)
-
-	mfsprg2 r12
-	stw r12, ISTATE_OFFSET_SP(sp)
-
-	li r12, 0
-	stw r12, ISTATE_OFFSET_LR_FRAME(sp)
-	stw r12, ISTATE_OFFSET_SP_FRAME(sp)
-.endm
-
-// NOTE: K_UNMAPPED_TEXT_START section starts at 0x100,
-// so all the following .org directives are relative to that.
-#define ABSOLUTE(x) ((x) - 0x100)
-
-.org ABSOLUTE(0x100)
-SYMBOL(exc_system_reset)
-	CONTEXT_STORE
-
-	li r3, 0
-	b jump_to_kernel
-
-.org ABSOLUTE(0x200)
-SYMBOL(exc_machine_check)
-	CONTEXT_STORE
-
-	li r3, 1
-	b jump_to_kernel
-
-.org ABSOLUTE(0x300)
-SYMBOL(exc_data_storage)
-	CONTEXT_STORE
-
-	li r3, 2
-	b jump_to_kernel
-
-.org ABSOLUTE(0x400)
-SYMBOL(exc_instruction_storage)
-	CONTEXT_STORE
-
-	li r3, 3
-	b jump_to_kernel
-
-.org ABSOLUTE(0x500)
-SYMBOL(exc_external)
-	CONTEXT_STORE
-
-	li r3, 4
-	b jump_to_kernel
-
-.org ABSOLUTE(0x600)
-SYMBOL(exc_alignment)
-	CONTEXT_STORE
-
-	li r3, 5
-	b jump_to_kernel
-
-.org ABSOLUTE(0x700)
-SYMBOL(exc_program)
-	CONTEXT_STORE
-
-	li r3, 6
-	b jump_to_kernel
-
-.org ABSOLUTE(0x800)
-SYMBOL(exc_fp_unavailable)
-	CONTEXT_STORE
-
-	li r3, 7
-	b jump_to_kernel
-
-.org ABSOLUTE(0x900)
-SYMBOL(exc_decrementer)
-	CONTEXT_STORE
-
-	li r3, 8
-	b jump_to_kernel
-
-.org ABSOLUTE(0xa00)
-SYMBOL(exc_reserved0)
-	CONTEXT_STORE
-
-	li r3, 9
-	b jump_to_kernel
-
-.org ABSOLUTE(0xb00)
-SYMBOL(exc_reserved1)
-	CONTEXT_STORE
-
-	li r3, 10
-	b jump_to_kernel
-
-.org ABSOLUTE(0xc00)
-SYMBOL(exc_syscall)
-	CONTEXT_STORE
-
-	b jump_to_kernel_syscall
-
-.org ABSOLUTE(0xd00)
-SYMBOL(exc_trace)
-	CONTEXT_STORE
-
-	li r3, 12
-	b jump_to_kernel
-
-.org ABSOLUTE(0x1000)
-SYMBOL(exc_itlb_miss)
-	CONTEXT_STORE
-
-	li r3, 13
-	b jump_to_kernel
-
-.org ABSOLUTE(0x1100)
-SYMBOL(exc_dtlb_miss_load)
-	CONTEXT_STORE
-
-	li r3, 14
-	b jump_to_kernel
-
-.org ABSOLUTE(0x1200)
-SYMBOL(exc_dtlb_miss_store)
-	CONTEXT_STORE
-
-	li r3, 15
-	b jump_to_kernel
-
-.org ABSOLUTE(0x4000)
-jump_to_kernel:
-	mfsrr1 r5
-	andi. r5, r5, MSR_PR
-	bne 1f
-		# Previous mode was kernel.
-		# We can construct a proper frame linkage.
-
-		mfsrr0 r12
-		stw r12, ISTATE_OFFSET_LR_FRAME(sp)
-		mfsprg2 r12
-		stw r12, ISTATE_OFFSET_SP_FRAME(sp)
-	1:
-
-	lis r12, iret@ha
-	addi r12, r12, iret@l
-	mtlr r12
-
-	lis r12, exc_dispatch@ha
-	addi r12, r12, exc_dispatch@l
-	mtsrr0 r12
-
-	mfmsr r12
-	mfsrr1 r5
-	andi. r5, r5, MSR_FP
-	or r12, r12, r5		# Propagate MSR_FP from SRR1 to MSR
-	ori r12, r12, (MSR_IR | MSR_DR)
-	mtsrr1 r12
-
-	addis sp, sp, 0x8000
-	mr r4, sp
-
-	rfi
-
-jump_to_kernel_syscall:
-	lis r12, syscall_handler@ha
-	addi r12, r12, syscall_handler@l
-	mtsrr0 r12
-
-	lis r12, iret_syscall@ha
-	addi r12, r12, iret_syscall@l
-	mtlr r12
-
-	mfsrr1 r0
-	andi. r0, r0, MSR_FP
-	mfmsr r12
-	or r12, r12, r0		# Propagate MSR_FP from SRR1 to MSR
-	ori r12, r12, (MSR_IR | MSR_DR | MSR_EE)
-	mtsrr1 r12
-
-	addis sp, sp, 0x8000
-	rfi
-
-/* Rest is for stack. */
-
-.org ABSOLUTE(0x8000)
Index: rnel/arch/ppc32/src/fpu_context.S
===================================================================
--- kernel/arch/ppc32/src/fpu_context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/asm/regname.h>
-#include <arch/fpu_context_struct.h>
-#include <arch/msr.h>
-
-.text
-
-.macro FPU_CONTEXT_STORE r
-	stfd fr0, FPU_CONTEXT_OFFSET_FR0(\r)
-	stfd fr1, FPU_CONTEXT_OFFSET_FR1(\r)
-	stfd fr2, FPU_CONTEXT_OFFSET_FR2(\r)
-	stfd fr3, FPU_CONTEXT_OFFSET_FR3(\r)
-	stfd fr4, FPU_CONTEXT_OFFSET_FR4(\r)
-	stfd fr5, FPU_CONTEXT_OFFSET_FR5(\r)
-	stfd fr6, FPU_CONTEXT_OFFSET_FR6(\r)
-	stfd fr7, FPU_CONTEXT_OFFSET_FR7(\r)
-	stfd fr8, FPU_CONTEXT_OFFSET_FR8(\r)
-	stfd fr9, FPU_CONTEXT_OFFSET_FR9(\r)
-	stfd fr10, FPU_CONTEXT_OFFSET_FR10(\r)
-	stfd fr11, FPU_CONTEXT_OFFSET_FR11(\r)
-	stfd fr12, FPU_CONTEXT_OFFSET_FR12(\r)
-	stfd fr13, FPU_CONTEXT_OFFSET_FR13(\r)
-	stfd fr14, FPU_CONTEXT_OFFSET_FR14(\r)
-	stfd fr15, FPU_CONTEXT_OFFSET_FR15(\r)
-	stfd fr16, FPU_CONTEXT_OFFSET_FR16(\r)
-	stfd fr17, FPU_CONTEXT_OFFSET_FR17(\r)
-	stfd fr18, FPU_CONTEXT_OFFSET_FR18(\r)
-	stfd fr19, FPU_CONTEXT_OFFSET_FR19(\r)
-	stfd fr20, FPU_CONTEXT_OFFSET_FR20(\r)
-	stfd fr21, FPU_CONTEXT_OFFSET_FR21(\r)
-	stfd fr22, FPU_CONTEXT_OFFSET_FR22(\r)
-	stfd fr23, FPU_CONTEXT_OFFSET_FR23(\r)
-	stfd fr24, FPU_CONTEXT_OFFSET_FR24(\r)
-	stfd fr25, FPU_CONTEXT_OFFSET_FR25(\r)
-	stfd fr26, FPU_CONTEXT_OFFSET_FR26(\r)
-	stfd fr27, FPU_CONTEXT_OFFSET_FR27(\r)
-	stfd fr28, FPU_CONTEXT_OFFSET_FR28(\r)
-	stfd fr29, FPU_CONTEXT_OFFSET_FR29(\r)
-	stfd fr30, FPU_CONTEXT_OFFSET_FR30(\r)
-	stfd fr31, FPU_CONTEXT_OFFSET_FR31(\r)
-.endm
-
-.macro FPU_CONTEXT_LOAD r
-	lfd fr0, FPU_CONTEXT_OFFSET_FR0(\r)
-	lfd fr1, FPU_CONTEXT_OFFSET_FR1(\r)
-	lfd fr2, FPU_CONTEXT_OFFSET_FR2(\r)
-	lfd fr3, FPU_CONTEXT_OFFSET_FR3(\r)
-	lfd fr4, FPU_CONTEXT_OFFSET_FR4(\r)
-	lfd fr5, FPU_CONTEXT_OFFSET_FR5(\r)
-	lfd fr6, FPU_CONTEXT_OFFSET_FR6(\r)
-	lfd fr7, FPU_CONTEXT_OFFSET_FR7(\r)
-	lfd fr8, FPU_CONTEXT_OFFSET_FR8(\r)
-	lfd fr9, FPU_CONTEXT_OFFSET_FR9(\r)
-	lfd fr10, FPU_CONTEXT_OFFSET_FR10(\r)
-	lfd fr11, FPU_CONTEXT_OFFSET_FR11(\r)
-	lfd fr12, FPU_CONTEXT_OFFSET_FR12(\r)
-	lfd fr13, FPU_CONTEXT_OFFSET_FR13(\r)
-	lfd fr14, FPU_CONTEXT_OFFSET_FR14(\r)
-	lfd fr15, FPU_CONTEXT_OFFSET_FR15(\r)
-	lfd fr16, FPU_CONTEXT_OFFSET_FR16(\r)
-	lfd fr17, FPU_CONTEXT_OFFSET_FR17(\r)
-	lfd fr18, FPU_CONTEXT_OFFSET_FR18(\r)
-	lfd fr19, FPU_CONTEXT_OFFSET_FR19(\r)
-	lfd fr20, FPU_CONTEXT_OFFSET_FR20(\r)
-	lfd fr21, FPU_CONTEXT_OFFSET_FR21(\r)
-	lfd fr22, FPU_CONTEXT_OFFSET_FR22(\r)
-	lfd fr23, FPU_CONTEXT_OFFSET_FR23(\r)
-	lfd fr24, FPU_CONTEXT_OFFSET_FR24(\r)
-	lfd fr25, FPU_CONTEXT_OFFSET_FR25(\r)
-	lfd fr26, FPU_CONTEXT_OFFSET_FR26(\r)
-	lfd fr27, FPU_CONTEXT_OFFSET_FR27(\r)
-	lfd fr28, FPU_CONTEXT_OFFSET_FR28(\r)
-	lfd fr29, FPU_CONTEXT_OFFSET_FR29(\r)
-	lfd fr30, FPU_CONTEXT_OFFSET_FR30(\r)
-	lfd fr31, FPU_CONTEXT_OFFSET_FR31(\r)
-.endm
-
-FUNCTION_BEGIN(fpu_context_save)
-	FPU_CONTEXT_STORE r3
-
-	mffs fr0
-	stfd fr0, FPU_CONTEXT_OFFSET_FPSCR(r3)
-
-	blr
-FUNCTION_END(fpu_context_save)
-
-FUNCTION_BEGIN(fpu_context_restore)
-	lfd fr0, FPU_CONTEXT_OFFSET_FPSCR(r3)
-	mtfsf 0xff, fr0
-
-	FPU_CONTEXT_LOAD r3
-
-	blr
-FUNCTION_END(fpu_context_restore)
-
-FUNCTION_BEGIN(fpu_init)
-	mfmsr r0
-	ori r0, r0, MSR_FP
-
-	# Disable FPU exceptions
-	li r3, MSR_FE0 | MSR_FE1
-	andc r0, r0, r3
-
-	mtmsr r0
-	isync
-
-	blr
-FUNCTION_END(fpu_init)
-
-FUNCTION_BEGIN(fpu_enable)
-	mfmsr r0
-	ori r0, r0, MSR_FP
-	mtmsr r0
-	isync
-	blr
-FUNCTION_END(fpu_enable)
-
-FUNCTION_BEGIN(fpu_disable)
-	mfmsr r0
-	li r3, MSR_FP
-	andc r0, r0, r3
-	mtmsr r0
-	isync
-	blr
-FUNCTION_END(fpu_disable)
Index: rnel/arch/ppc32/src/interrupt.c
===================================================================
--- kernel/arch/ppc32/src/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_interrupt
- * @{
- */
-/** @file
- */
-
-#include <ddi/irq.h>
-#include <interrupt.h>
-#include <arch/interrupt.h>
-#include <arch/istate.h>
-#include <stdint.h>
-#include <arch.h>
-#include <ipc/sysipc.h>
-#include <arch/drivers/pic.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/pht.h>
-#include <log.h>
-
-static uint32_t decrementer_value;
-
-void decrementer_start(uint32_t val)
-{
-	decrementer_value = val;
-	decrementer_restart();
-}
-
-void decrementer_restart(void)
-{
-	asm volatile (
-	    "mtdec %[dec]\n"
-	    :: [dec] "r" (decrementer_value)
-	);
-}
-
-void istate_decode(istate_t *istate)
-{
-	log_printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
-	    "r2 =%0#10" PRIx32 "\n", istate->r0, istate->sp, istate->r2);
-
-	log_printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"
-	    "r5 =%0#10" PRIx32 "\n", istate->r3, istate->r4, istate->r5);
-
-	log_printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"
-	    "r8 =%0#10" PRIx32 "\n", istate->r6, istate->r7, istate->r8);
-
-	log_printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"
-	    "r11=%0#10" PRIx32 "\n", istate->r9, istate->r10, istate->r11);
-
-	log_printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"
-	    "r14=%0#10" PRIx32 "\n", istate->r12, istate->r13, istate->r14);
-
-	log_printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"
-	    "r17=%0#10" PRIx32 "\n", istate->r15, istate->r16, istate->r17);
-
-	log_printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"
-	    "r20=%0#10" PRIx32 "\n", istate->r18, istate->r19, istate->r20);
-
-	log_printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"
-	    "r23=%0#10" PRIx32 "\n", istate->r21, istate->r22, istate->r23);
-
-	log_printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"
-	    "r26=%0#10" PRIx32 "\n", istate->r24, istate->r25, istate->r26);
-
-	log_printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"
-	    "r29=%0#10" PRIx32 "\n", istate->r27, istate->r28, istate->r29);
-
-	log_printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",
-	    istate->r30, istate->r31);
-
-	log_printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"
-	    "lr =%0#10" PRIx32 "\n", istate->cr, istate->pc, istate->lr);
-
-	log_printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"
-	    "dar=%0#10" PRIx32 "\n", istate->ctr, istate->xer, istate->dar);
-
-	log_printf("srr1=%0#10" PRIx32 "\n", istate->srr1);
-}
-
-/** External interrupts handler
- *
- */
-static void exception_external(unsigned int n, istate_t *istate)
-{
-	uint8_t inum;
-
-	while ((inum = pic_get_pending()) != 255) {
-		irq_t *irq = irq_dispatch_and_lock(inum);
-		if (irq) {
-			/*
-			 * The IRQ handler was found.
-			 */
-
-			if (irq->preack) {
-				/* Acknowledge the interrupt before processing */
-				if (irq->cir)
-					irq->cir(irq->cir_arg, irq->inr);
-			}
-
-			irq->handler(irq);
-
-			if (!irq->preack) {
-				if (irq->cir)
-					irq->cir(irq->cir_arg, irq->inr);
-			}
-
-			irq_spinlock_unlock(&irq->lock, false);
-		} else {
-			/*
-			 * Spurious interrupt.
-			 */
-#ifdef CONFIG_DEBUG
-			log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt"
-			    " (inum=%" PRIu8 ")", CPU->id, inum);
-#endif
-			pic_ack_interrupt(NULL, inum);
-			break;
-		}
-	}
-}
-
-static void exception_fp_unavailable(unsigned int n, istate_t *istate)
-{
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-	/*
-	 * Propagate MSR_FP from MSR back to istate's SRR1, which will become
-	 * the next MSR.
-	 */
-	istate->srr1 |= msr_read() & MSR_FP;
-#else
-	fault_if_from_uspace(istate, "FPU fault.");
-	panic_badtrap(istate, n, "FPU fault.");
-#endif
-}
-
-static void exception_decrementer(unsigned int n, istate_t *istate)
-{
-	decrementer_restart();
-	clock();
-}
-
-/* Initialize basic tables for exception dispatching */
-void interrupt_init(void)
-{
-	exc_register(VECTOR_DATA_STORAGE, "data_storage", true,
-	    pht_refill);
-	exc_register(VECTOR_INSTRUCTION_STORAGE, "instruction_storage", true,
-	    pht_refill);
-	exc_register(VECTOR_EXTERNAL, "external", true,
-	    exception_external);
-	exc_register(VECTOR_FP_UNAVAILABLE, "fp_unavailable", true,
-	    exception_fp_unavailable);
-	exc_register(VECTOR_DECREMENTER, "timer", true,
-	    exception_decrementer);
-	exc_register(VECTOR_ITLB_MISS, "itlb_miss", true,
-	    tlb_refill);
-	exc_register(VECTOR_DTLB_MISS_LOAD, "dtlb_miss_load", true,
-	    tlb_refill);
-	exc_register(VECTOR_DTLB_MISS_STORE, "dtlb_miss_store", true,
-	    tlb_refill);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/as.c
===================================================================
--- kernel/arch/ppc32/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/as.h>
-#include <genarch/mm/as_pt.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/asid_fifo.h>
-#include <arch.h>
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-	asid_fifo_init();
-}
-
-/** Install address space.
- *
- * Install ASID.
- *
- * @param as Address space structure.
- *
- */
-void as_install_arch(as_t *as)
-{
-	uint32_t sr;
-
-	/* Lower 2 GB, user and supervisor access */
-	for (sr = 0; sr < 8; sr++)
-		sr_set(0x6000, as->asid, sr);
-
-	/* Upper 2 GB, only supervisor access */
-	for (sr = 8; sr < 16; sr++)
-		sr_set(0x4000, as->asid, sr);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/frame.c
===================================================================
--- kernel/arch/ppc32/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/asm.h>
-#include <arch/boot/boot.h>
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <align.h>
-#include <macros.h>
-#include <stdio.h>
-
-memmap_t memmap;
-
-void physmem_print(void)
-{
-	printf("[base    ] [size    ]\n");
-
-	size_t i;
-	for (i = 0; i < memmap.cnt; i++) {
-		printf("%p %#0zx\n", memmap.zones[i].start,
-		    memmap.zones[i].size);
-	}
-}
-
-static void frame_common_arch_init(bool low)
-{
-	pfn_t minconf = 2;
-	size_t i;
-
-	for (i = 0; i < memmap.cnt; i++) {
-		/* To be safe, make the available zone possibly smaller */
-		uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
-		    FRAME_SIZE);
-		size_t size = ALIGN_DOWN(memmap.zones[i].size -
-		    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			return;
-
-		pfn_t pfn = ADDR2PFN(base);
-		size_t count = SIZE2FRAMES(size);
-		pfn_t conf;
-
-		if (low) {
-			if ((minconf < pfn) || (minconf >= pfn + count))
-				conf = pfn;
-			else
-				conf = minconf;
-			zone_create(pfn, count, conf,
-			    ZONE_AVAILABLE | ZONE_LOWMEM);
-		} else {
-			conf = zone_external_conf_alloc(count);
-			if (conf != 0)
-				zone_create(pfn, count, conf,
-				    ZONE_AVAILABLE | ZONE_HIGHMEM);
-		}
-	}
-
-}
-
-void frame_low_arch_init(void)
-{
-	frame_common_arch_init(true);
-
-	/*
-	 * First is exception vector, second is 'implementation specific',
-	 * third and fourth is reserved, other contain real mode code
-	 */
-	frame_mark_unavailable(0, 8);
-
-	/* Mark the Page Hash Table frames as unavailable */
-	uint32_t sdr1 = sdr1_get();
-
-	// FIXME: compute size of PHT exactly
-	frame_mark_unavailable(ADDR2PFN(sdr1 & 0xffff000), 16);
-}
-
-void frame_high_arch_init(void)
-{
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/km.c
===================================================================
--- kernel/arch/ppc32/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_PPC32_IDENTITY_START;
-	config.identity_size = KM_PPC32_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_PPC32_NON_IDENTITY_START,
-	    KM_PPC32_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_PPC32_NON_IDENTITY_START,
-	    KM_PPC32_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/page.c
===================================================================
--- kernel/arch/ppc32/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#include <genarch/mm/page_pt.h>
-#include <mm/frame.h>
-#include <mm/as.h>
-#include <align.h>
-#include <config.h>
-
-void page_arch_init(void)
-{
-	if (config.cpu_active == 1)
-		page_mapping_operations = &pt_mapping_operations;
-	as_switch(NULL, AS_KERNEL);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/pht.c
===================================================================
--- kernel/arch/ppc32/src/mm/pht.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/pht.h>
-#include <arch/mm/tlb.h>
-#include <assert.h>
-#include <interrupt.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <macros.h>
-#include <typedefs.h>
-
-static unsigned int seed = 42;
-
-/** Try to find PTE for faulting address
- *
- * @param as       Address space.
- * @param badvaddr Faulting virtual address.
- * @param access   Access mode that caused the fault.
- * @param istate   Pointer to interrupted state.
- * @param[out] pte Structure that will receive a copy of the found PTE.
- *
- * @return True if the mapping was found, false otherwise.
- *
- */
-static bool find_mapping_and_check(as_t *as, uintptr_t badvaddr, int access,
-    istate_t *istate, pte_t *pte)
-{
-	/*
-	 * Check if the mapping exists in page tables.
-	 */
-	bool found = page_mapping_find(as, badvaddr, true, pte);
-	if (found && pte->present) {
-		/*
-		 * Mapping found in page tables.
-		 * Immediately succeed.
-		 */
-		return true;
-	}
-	/*
-	 * Mapping not found in page tables.
-	 * Resort to higher-level page fault handler.
-	 */
-	if (as_page_fault(badvaddr, access, istate) == AS_PF_OK) {
-		/*
-		 * The higher-level page fault handler succeeded,
-		 * The mapping ought to be in place.
-		 */
-		found = page_mapping_find(as, badvaddr, true, pte);
-
-		assert(found);
-		assert(pte->present);
-
-		return found;
-	}
-
-	return false;
-}
-
-static void pht_insert(const uintptr_t vaddr, const pte_t *pte)
-{
-	uint32_t page = (vaddr >> 12) & 0xffff;
-	uint32_t api = (vaddr >> 22) & 0x3f;
-
-	uint32_t vsid = sr_get(vaddr);
-	uint32_t sdr1 = sdr1_get();
-
-	// FIXME: compute size of PHT exactly
-	phte_t *phte = (phte_t *) PA2KA(sdr1 & 0xffff0000);
-
-	/* Primary hash (xor) */
-	uint32_t h = 0;
-	uint32_t hash = vsid ^ page;
-	uint32_t base = (hash & 0x3ff) << 3;
-	uint32_t i;
-	bool found = false;
-
-	/* Find colliding PTE in PTEG */
-	for (i = 0; i < 8; i++) {
-		if ((phte[base + i].v) &&
-		    (phte[base + i].vsid == vsid) &&
-		    (phte[base + i].api == api) &&
-		    (phte[base + i].h == 0)) {
-			found = true;
-			break;
-		}
-	}
-
-	if (!found) {
-		/* Find unused PTE in PTEG */
-		for (i = 0; i < 8; i++) {
-			if (!phte[base + i].v) {
-				found = true;
-				break;
-			}
-		}
-	}
-
-	if (!found) {
-		/* Secondary hash (not) */
-		uint32_t base2 = (~hash & 0x3ff) << 3;
-
-		/* Find colliding PTE in PTEG */
-		for (i = 0; i < 8; i++) {
-			if ((phte[base2 + i].v) &&
-			    (phte[base2 + i].vsid == vsid) &&
-			    (phte[base2 + i].api == api) &&
-			    (phte[base2 + i].h == 1)) {
-				found = true;
-				base = base2;
-				h = 1;
-				break;
-			}
-		}
-
-		if (!found) {
-			/* Find unused PTE in PTEG */
-			for (i = 0; i < 8; i++) {
-				if (!phte[base2 + i].v) {
-					found = true;
-					base = base2;
-					h = 1;
-					break;
-				}
-			}
-		}
-
-		if (!found)
-			i = RANDI(seed) % 8;
-	}
-
-	phte[base + i].v = 1;
-	phte[base + i].vsid = vsid;
-	phte[base + i].h = h;
-	phte[base + i].api = api;
-	phte[base + i].rpn = pte->pfn;
-	phte[base + i].r = 0;
-	phte[base + i].c = 0;
-	phte[base + i].wimg = (pte->page_cache_disable ? WIMG_NO_CACHE : 0);
-	phte[base + i].pp = 2; // FIXME
-}
-
-/** Process Instruction/Data Storage Exception
- *
- * @param n      Exception vector number.
- * @param istate Interrupted register context.
- *
- */
-void pht_refill(unsigned int n, istate_t *istate)
-{
-	uintptr_t badvaddr;
-
-	if (n == VECTOR_DATA_STORAGE)
-		badvaddr = istate->dar;
-	else
-		badvaddr = istate->pc;
-
-	pte_t pte;
-	bool found = find_mapping_and_check(AS, badvaddr,
-	    PF_ACCESS_READ /* FIXME */, istate, &pte);
-
-	if (found) {
-		/* Record access to PTE */
-		pte.accessed = 1;
-		pht_insert(badvaddr, &pte);
-	}
-}
-
-void pht_invalidate(as_t *as, uintptr_t page, size_t pages)
-{
-	uint32_t sdr1 = sdr1_get();
-
-	// FIXME: compute size of PHT exactly
-	phte_t *phte = (phte_t *) PA2KA(sdr1 & 0xffff0000);
-
-	// FIXME: this invalidates all PHT entries,
-	// which is an overkill, invalidate only
-	// selectively
-	for (size_t i = 0; i < 8192; i++) {
-		phte[i].v = 0;
-	}
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/mm/tlb.c
===================================================================
--- kernel/arch/ppc32/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/tlb.h>
-#include <interrupt.h>
-#include <typedefs.h>
-
-void tlb_refill(unsigned int n, istate_t *istate)
-{
-	uint32_t tlbmiss;
-	ptehi_t ptehi;
-	ptelo_t ptelo;
-
-	asm volatile (
-	    "mfspr %[tlbmiss], 980\n"
-	    "mfspr %[ptehi], 981\n"
-	    "mfspr %[ptelo], 982\n"
-	    : [tlbmiss] "=r" (tlbmiss),
-	      [ptehi] "=r" (ptehi),
-	      [ptelo] "=r" (ptelo)
-	);
-
-	uint32_t badvaddr = tlbmiss & 0xfffffffc;
-	uint32_t physmem = physmem_top();
-
-	if ((badvaddr < PA2KA(0)) || (badvaddr >= PA2KA(physmem)))
-		return; // FIXME
-
-	ptelo.rpn = KA2PA(badvaddr) >> 12;
-	ptelo.wimg = 0;
-	ptelo.pp = 2; // FIXME
-
-	uint32_t index = 0;
-	asm volatile (
-	    "mtspr 981, %[ptehi]\n"
-	    "mtspr 982, %[ptelo]\n"
-	    "tlbld %[index]\n"
-	    "tlbli %[index]\n"
-	    : [index] "=r" (index)
-	    : [ptehi] "r" (ptehi),
-	      [ptelo] "r" (ptelo)
-	);
-}
-
-void tlb_arch_init(void)
-{
-	tlb_invalidate_all();
-}
-
-void tlb_invalidate_all(void)
-{
-	asm volatile (
-	    "sync\n"
-	);
-
-	for (unsigned int i = 0; i < 0x00040000; i += 0x00001000) {
-		asm volatile (
-		    "tlbie %[i]\n"
-		    :: [i] "r" (i)
-		);
-	}
-
-	asm volatile (
-	    "eieio\n"
-	    "tlbsync\n"
-	    "sync\n"
-	);
-}
-
-void tlb_invalidate_asid(asid_t asid)
-{
-	tlb_invalidate_all();
-}
-
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	tlb_invalidate_all();
-}
-
-#define PRINT_BAT(name, ureg, lreg) \
-	asm volatile ( \
-		"mfspr %[upper], " #ureg "\n" \
-		"mfspr %[lower], " #lreg "\n" \
-		: [upper] "=r" (upper), \
-		  [lower] "=r" (lower) \
-	); \
-	\
-	mask = (upper & 0x1ffc) >> 2; \
-	if (upper & 3) { \
-		uint32_t tmp = mask; \
-		length = 128; \
-		\
-		while (tmp) { \
-			if ((tmp & 1) == 0) { \
-				printf("ibat[0]: error in mask\n"); \
-				break; \
-			} \
-			length <<= 1; \
-			tmp >>= 1; \
-		} \
-	} else \
-		length = 0; \
-	\
-	printf(name ": page=%#0" PRIx32 " frame=%#0" PRIx32 \
-	    " length=%#0" PRIx32 " KB (mask=%#0" PRIx32 ")%s%s\n", \
-	    upper & UINT32_C(0xffff0000), lower & UINT32_C(0xffff0000), \
-	    length, mask, \
-	    ((upper >> 1) & 1) ? " supervisor" : "", \
-	    (upper & 1) ? " user" : "");
-
-void tlb_print(void)
-{
-	uint32_t sr;
-
-	for (sr = 0; sr < 16; sr++) {
-		uint32_t vsid = sr_get(sr << 28);
-
-		printf("sr[%02" PRIu32 "]: vsid=%#0" PRIx32 " (asid=%" PRIu32 ")"
-		    "%s%s\n", sr, vsid & UINT32_C(0x00ffffff),
-		    (vsid & UINT32_C(0x00ffffff)) >> 4,
-		    ((vsid >> 30) & 1) ? " supervisor" : "",
-		    ((vsid >> 29) & 1) ? " user" : "");
-	}
-
-	uint32_t upper;
-	uint32_t lower;
-	uint32_t mask;
-	uint32_t length;
-
-	PRINT_BAT("ibat[0]", 528, 529);
-	PRINT_BAT("ibat[1]", 530, 531);
-	PRINT_BAT("ibat[2]", 532, 533);
-	PRINT_BAT("ibat[3]", 534, 535);
-
-	PRINT_BAT("dbat[0]", 536, 537);
-	PRINT_BAT("dbat[1]", 538, 539);
-	PRINT_BAT("dbat[2]", 540, 541);
-	PRINT_BAT("dbat[3]", 542, 543);
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/ppc32.c
===================================================================
--- kernel/arch/ppc32/src/ppc32.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,324 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <config.h>
-#include <arch/boot/boot.h>
-#include <genarch/drivers/via-cuda/cuda.h>
-#include <genarch/kbrd/kbrd.h>
-#include <arch/interrupt.h>
-#include <interrupt.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/pci.h>
-#include <userspace.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <time/clock.h>
-#include <console/console.h>
-#include <sysinfo/sysinfo.h>
-#include <ddi/irq.h>
-#include <arch/drivers/pic.h>
-#include <align.h>
-#include <macros.h>
-#include <str.h>
-
-#define IRQ_COUNT  64
-#define IRQ_CUDA   10
-
-static void ppc32_pre_mm_init(void);
-static void ppc32_post_mm_init(void);
-static void ppc32_post_smp_init(void);
-
-arch_ops_t ppc32_ops = {
-	.pre_mm_init = ppc32_pre_mm_init,
-	.post_mm_init = ppc32_post_mm_init,
-	.post_smp_init = ppc32_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &ppc32_ops;
-
-bootinfo_t bootinfo;
-
-static cir_t pic_cir;
-static void *pic_cir_arg;
-
-/** Performs ppc32-specific initialization before main_bsp() is called. */
-void ppc32_pre_main(bootinfo_t *bootinfo)
-{
-	/* Copy tasks map. */
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Copy physical memory map. */
-	memmap.total = bootinfo->memmap.total;
-	memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
-	for (i = 0; i < memmap.cnt; i++) {
-		memmap.zones[i].start = bootinfo->memmap.zones[i].start;
-		memmap.zones[i].size = bootinfo->memmap.zones[i].size;
-	}
-
-	/* Copy boot allocations info. */
-	ballocs.base = bootinfo->ballocs.base;
-	ballocs.size = bootinfo->ballocs.size;
-
-	/* Copy OFW tree. */
-	ofw_tree_init(bootinfo->ofw_root);
-}
-
-void ppc32_pre_mm_init(void)
-{
-	/* Initialize dispatch table */
-	interrupt_init();
-
-	ofw_tree_node_t *cpus_node;
-	ofw_tree_node_t *cpu_node;
-	ofw_tree_property_t *freq_prop;
-
-	cpus_node = ofw_tree_lookup("/cpus");
-	if (!cpus_node)
-		panic("Could not find cpus node.");
-
-	cpu_node = cpus_node->child;
-	if (!cpu_node)
-		panic("Could not find first cpu.");
-
-	freq_prop = ofw_tree_getprop(cpu_node, "timebase-frequency");
-	if (!freq_prop)
-		panic("Could not get frequency property.");
-
-	uint32_t freq;
-	freq = *((uint32_t *) freq_prop->value);
-
-	/* Start decrementer */
-	decrementer_start(freq / HZ);
-}
-
-#ifdef CONFIG_FB
-static bool display_register(ofw_tree_node_t *node, void *arg)
-{
-	uintptr_t fb_addr = 0;
-	uint32_t fb_width = 0;
-	uint32_t fb_height = 0;
-	uint32_t fb_scanline = 0;
-	unsigned int visual = VISUAL_UNKNOWN;
-
-	ofw_tree_property_t *prop = ofw_tree_getprop(node, "address");
-	if ((prop) && (prop->value))
-		fb_addr = *((uintptr_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "width");
-	if ((prop) && (prop->value))
-		fb_width = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "height");
-	if ((prop) && (prop->value))
-		fb_height = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "depth");
-	if ((prop) && (prop->value)) {
-		uint32_t fb_bpp = *((uint32_t *) prop->value);
-		switch (fb_bpp) {
-		case 8:
-			visual = VISUAL_INDIRECT_8;
-			break;
-		case 15:
-			visual = VISUAL_RGB_5_5_5_BE;
-			break;
-		case 16:
-			visual = VISUAL_RGB_5_6_5_BE;
-			break;
-		case 24:
-			visual = VISUAL_BGR_8_8_8;
-			break;
-		case 32:
-			visual = VISUAL_RGB_0_8_8_8;
-			break;
-		default:
-			visual = VISUAL_UNKNOWN;
-		}
-	}
-
-	prop = ofw_tree_getprop(node, "linebytes");
-	if ((prop) && (prop->value))
-		fb_scanline = *((uint32_t *) prop->value);
-
-	if ((fb_addr) && (fb_width > 0) && (fb_height > 0) &&
-	    (fb_scanline > 0) && (visual != VISUAL_UNKNOWN)) {
-		fb_properties_t fb_prop = {
-			.addr = fb_addr,
-			.offset = 0,
-			.x = fb_width,
-			.y = fb_height,
-			.scan = fb_scanline,
-			.visual = visual,
-		};
-
-		outdev_t *fbdev = fb_init(&fb_prop);
-		if (fbdev)
-			stdout_wire(fbdev);
-	}
-
-	return true;
-}
-#endif
-
-void ppc32_post_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-#ifdef CONFIG_FB
-		ofw_tree_walk_by_device_type("display", display_register, NULL);
-#endif
-		/* Map OFW information into sysinfo */
-		ofw_sysinfo_map();
-
-		/* Initialize IRQ routing */
-		irq_init(IRQ_COUNT, IRQ_COUNT);
-
-		/* Merge all zones to 1 big zone */
-		zone_merge_all();
-	}
-}
-
-static bool macio_register(ofw_tree_node_t *node, void *arg)
-{
-	ofw_pci_reg_t *assigned_address = NULL;
-
-	ofw_tree_property_t *prop = ofw_tree_getprop(node, "assigned-addresses");
-	if ((prop) && (prop->value))
-		assigned_address = ((ofw_pci_reg_t *) prop->value);
-
-	if (assigned_address) {
-		/* Initialize PIC */
-		pic_init(assigned_address[0].addr, PAGE_SIZE, &pic_cir,
-		    &pic_cir_arg);
-
-#ifdef CONFIG_MAC_KBD
-		uintptr_t pa = assigned_address[0].addr + 0x16000;
-		size_t size = 2 * PAGE_SIZE;
-
-		cuda_t *cuda = (cuda_t *) km_map(pa, size, KM_NATURAL_ALIGNMENT,
-		    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-		/* Initialize I/O controller */
-		cuda_instance_t *cuda_instance =
-		    cuda_init(cuda, IRQ_CUDA, pic_cir, pic_cir_arg);
-		if (cuda_instance) {
-			kbrd_instance_t *kbrd_instance = kbrd_init();
-			if (kbrd_instance) {
-				indev_t *sink = stdin_wire();
-				indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-				cuda_wire(cuda_instance, kbrd);
-				pic_enable_interrupt(IRQ_CUDA);
-			}
-		}
-
-		/*
-		 * This is the necessary evil until the userspace driver is entirely
-		 * self-sufficient.
-		 */
-		sysinfo_set_item_val("cuda", NULL, true);
-		sysinfo_set_item_val("cuda.inr", NULL, IRQ_CUDA);
-		sysinfo_set_item_val("cuda.address.physical", NULL, pa);
-#endif
-	}
-
-	/* Consider only a single device for now */
-	return false;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	irq->cir = pic_cir;
-	irq->cir_arg = pic_cir_arg;
-	irq->preack = true;
-}
-
-void ppc32_post_smp_init(void)
-{
-	/* Currently the only supported platform for ppc32 is 'mac'. */
-	static const char *platform = "mac";
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-	ofw_tree_walk_by_device_type("mac-io", macio_register, NULL);
-}
-
-void calibrate_delay_loop(void)
-{
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size - SP_DELTA;
-}
-
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	userspace_asm(0, sp, pc);
-	unreachable();
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void arch_reboot(void)
-{
-	// TODO
-	while (true)
-		;
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/proc/scheduler.c
===================================================================
--- kernel/arch/ppc32/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ppc32_proc
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <arch/boot/boot.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <arch.h>
-
-/** Perform ppc32 specific tasks needed before the new task is run.
- *
- */
-void before_task_runs_arch(void)
-{
-}
-
-/** Perform ppc32 specific tasks needed before the new thread is scheduled.
- *
- */
-void before_thread_runs_arch(void)
-{
-	tlb_invalidate_all();
-
-	asm volatile (
-	    "mtsprg0 %[ksp]\n"
-	    :: [ksp] "r" (KA2PA(&THREAD->kstack[STACK_SIZE]))
-	);
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/ppc32/src/smc.c
===================================================================
--- kernel/arch/ppc32/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-#define COHERENCE_INVAL_MIN  4
-
-/*
- * The IMB sequence used here is valid for all possible cache models
- * on uniprocessor. SMP might require a different sequence.
- * See PowerPC Programming Environment for 32-Bit Microprocessors,
- * chapter 5.1.5.2
- */
-
-void smc_coherence(void *addr, size_t len)
-{
-	unsigned int i;
-
-	for (i = 0; i < len; i += COHERENCE_INVAL_MIN)
-		asm volatile (
-		    "dcbst 0, %[addr]\n"
-		    :: [addr] "r" (addr + i)
-		);
-
-	asm volatile ("sync" ::: "memory");
-
-	for (i = 0; i < len; i += COHERENCE_INVAL_MIN)
-		asm volatile (
-		    "icbi 0, %[addr]\n"
-		    :: [addr] "r" (addr + i)
-		);
-
-	asm volatile ("sync" ::: "memory");
-	asm volatile ("isync" ::: "memory");
-}
Index: rnel/arch/riscv64/_link.ld.in
===================================================================
--- kernel/arch/riscv64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * RISC-V 64 linker script
- *
- *  kernel text
- *  kernel data
- *
- */
-
-OUTPUT_ARCH(riscv)
-ENTRY(kernel_image_start)
-
-#include <arch/boot/boot.h>
-#include <arch/mm/page.h>
-
-SECTIONS {
-	kernel_load_address = PA2KA(BOOT_OFFSET);
-
-	.text (PA2KA(BOOT_OFFSET) + SIZEOF_HEADERS) : AT (BOOT_OFFSET + SIZEOF_HEADERS) {
-		ktext_start = .;
-		KEEP(*(K_TEXT_START));
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		*(.data .data.*);                       /* initialized data */
-		*(.rodata .rodata.*);
-		*(.sdata .sdata.*);
-		*(.sbss .sbss.*);
-		*(.scommon .scommon.*);
-		*(.bss .bss.*);                        /* uninitialized static variables */
-		*(COMMON);                      /* global variables */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(.mdebug*);
-		*(.pdr);
-		*(.comment);
-		*(.note);
-	}
-}
Index: rnel/arch/riscv64/include/arch/arch.h
===================================================================
--- kernel/arch/riscv64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_ARCH_H_
-#define KERN_riscv64_ARCH_H_
-
-#include <arch/boot/boot.h>
-
-extern void riscv64_pre_main(bootinfo_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/asm.h
===================================================================
--- kernel/arch/riscv64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_ASM_H_
-#define KERN_riscv64_ASM_H_
-
-#include <arch/cpu.h>
-#include <typedefs.h>
-#include <config.h>
-#include <arch/mm/asid.h>
-#include <trace.h>
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-}
-
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	ipl_t ipl;
-
-	asm volatile (
-	    "csrrsi %[ipl], sstatus, " STRING(SSTATUS_SIE_MASK) "\n"
-	    : [ipl] "=r" (ipl)
-	);
-
-	return ipl;
-}
-
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	ipl_t ipl;
-
-	asm volatile (
-	    "csrrci %[ipl], sstatus, " STRING(SSTATUS_SIE_MASK) "\n"
-	    : [ipl] "=r" (ipl)
-	);
-
-	return ipl;
-}
-
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	if ((ipl & SSTATUS_SIE_MASK) == SSTATUS_SIE_MASK)
-		interrupts_enable();
-	else
-		interrupts_disable();
-}
-
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	ipl_t ipl;
-
-	asm volatile (
-	    "csrr %[ipl], sstatus\n"
-	    : [ipl] "=r" (ipl)
-	);
-
-	return ipl;
-}
-
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	return ((interrupts_read() & SSTATUS_SIE_MASK) == 0);
-}
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this properly
-	interrupts_enable();
-	interrupts_disable();
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	return *port;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	return *port;
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void asm_delay_loop(uint32_t t);
-extern void userspace_asm(uintptr_t uspace_uarg, uintptr_t stack,
-    uintptr_t entry);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/boot/boot.h
===================================================================
--- kernel/arch/riscv64/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_BOOT_H_
-#define KERN_riscv64_BOOT_H_
-
-#define BOOT_OFFSET  0x48000000
-
-#define TASKMAP_MAX_RECORDS        32
-#define MEMMAP_MAX_RECORDS         32
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-/* Temporary stack size for boot process */
-#define TEMP_STACK_SIZE  0x1000
-
-#ifndef __ASSEMBLER__
-
-#include <stddef.h>
-#include <stdint.h>
-#include <config.h>
-
-typedef struct {
-	volatile uint64_t *tohost;
-	volatile uint64_t *fromhost;
-} ucbinfo_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	ucbinfo_t ucbinfo;
-	uintptr_t physmem_start;
-	uintptr_t htif_frame;
-	uintptr_t pt_frame;
-	memmap_t memmap;
-	taskmap_t taskmap;
-} bootinfo_t;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/context.h
===================================================================
--- kernel/arch/riscv64/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_CONTEXT_H_
-#define KERN_riscv64_CONTEXT_H_
-
-#include <arch/context_struct.h>
-
-#define SP_DELTA  16
-
-#define context_set(context, pc, stack, size) \
-	context_set_generic(context, pc, stack, size)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/context_struct.h
===================================================================
--- kernel/arch/riscv64/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x08
-#define CONTEXT_OFFSET_GP   0x10
-#define CONTEXT_OFFSET_TP   0x18
-#define CONTEXT_OFFSET_S0   0x20
-#define CONTEXT_OFFSET_S1   0x28
-#define CONTEXT_OFFSET_S2   0x30
-#define CONTEXT_OFFSET_S3   0x38
-#define CONTEXT_OFFSET_S4   0x40
-#define CONTEXT_OFFSET_S5   0x48
-#define CONTEXT_OFFSET_S6   0x50
-#define CONTEXT_OFFSET_S7   0x58
-#define CONTEXT_OFFSET_S8   0x60
-#define CONTEXT_OFFSET_S9   0x68
-#define CONTEXT_OFFSET_S10  0x70
-#define CONTEXT_OFFSET_S11  0x78
-#define CONTEXT_SIZE        0x80
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct context {
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t gp;
-	uint64_t tp;
-	uint64_t s0;
-	uint64_t s1;
-	uint64_t s2;
-	uint64_t s3;
-	uint64_t s4;
-	uint64_t s5;
-	uint64_t s6;
-	uint64_t s7;
-	uint64_t s8;
-	uint64_t s9;
-	uint64_t s10;
-	uint64_t s11;
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/riscv64/include/arch/cpu.h
===================================================================
--- kernel/arch/riscv64/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_CPU_H_
-#define KERN_riscv64_CPU_H_
-
-#define SSTATUS_SIE_MASK  0x00000002
-
-#define SATP_PFN_MASK  UINT64_C(0x00000fffffffffff)
-
-#define SATP_MODE_MASK  UINT64_C(0xf000000000000000)
-#define SATP_MODE_BARE  UINT64_C(0x0000000000000000)
-#define SATP_MODE_SV39  UINT64_C(0x8000000000000000)
-#define SATP_MODE_SV48  UINT64_C(0x9000000000000000)
-
-#ifndef __ASSEMBLER__
-
-typedef struct {
-} cpu_arch_t;
-
-extern void cpu_setup_fpu(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/cycle.h
===================================================================
--- kernel/arch/riscv64/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_CYCLE_H_
-#define KERN_riscv64_CYCLE_H_
-
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	uint64_t cycle;
-
-	asm volatile (
-	    "rdcycle %[cycle]\n"
-	    : [cycle] "=r" (cycle)
-	);
-
-	return cycle;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/drivers/ucb.h
===================================================================
--- kernel/arch/riscv64/include/arch/drivers/ucb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_DRIVERS_UCB_H_
-#define KERN_riscv64_DRIVERS_UCB_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <console/chardev.h>
-
-extern void htif_init(volatile uint64_t *, volatile uint64_t *);
-extern outdev_t *htifout_init(void);
-extern void htif_putuchar(outdev_t *, const char32_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/faddr.h
===================================================================
--- kernel/arch/riscv64/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_FADDR_H_
-#define KERN_riscv64_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/fpu_context.h
===================================================================
--- kernel/arch/riscv64/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_FPU_CONTEXT_H_
-#define KERN_riscv64_FPU_CONTEXT_H_
-
-#include <stdint.h>
-
-typedef struct {
-} fpu_context_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/interrupt.h
===================================================================
--- kernel/arch/riscv64/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_INTERRUPT_H_
-#define KERN_riscv64_INTERRUPT_H_
-
-#include <typedefs.h>
-#include <arch/istate.h>
-
-#define IVT_ITEMS  0
-#define IVT_FIRST  0
-
-#define VECTOR_TLB_SHOOTDOWN_IPI  0
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/istate.h
===================================================================
--- kernel/arch/riscv64/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_ISTATE_H_
-#define KERN_riscv64_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-#include <arch/istate_struct.h>
-#else
-#include <libarch/istate_struct.h>
-#endif
-
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	// FIXME
-	return 0;
-}
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	// FIXME
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	// FIXME
-	return 0;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	// FIXME
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/riscv64/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_ZERO  0x00
-#define ISTATE_OFFSET_RA    0x08
-#define ISTATE_OFFSET_SP    0x10
-#define ISTATE_OFFSET_X3    0x18
-#define ISTATE_OFFSET_X4    0x20
-#define ISTATE_OFFSET_X5    0x28
-#define ISTATE_OFFSET_X6    0x30
-#define ISTATE_OFFSET_X7    0x38
-#define ISTATE_OFFSET_X8    0x40
-#define ISTATE_OFFSET_X9    0x48
-#define ISTATE_OFFSET_X10   0x50
-#define ISTATE_OFFSET_X11   0x58
-#define ISTATE_OFFSET_X12   0x60
-#define ISTATE_OFFSET_X13   0x68
-#define ISTATE_OFFSET_X14   0x70
-#define ISTATE_OFFSET_X15   0x78
-#define ISTATE_OFFSET_X16   0x80
-#define ISTATE_OFFSET_X17   0x88
-#define ISTATE_OFFSET_X18   0x90
-#define ISTATE_OFFSET_X19   0x98
-#define ISTATE_OFFSET_X20   0xa0
-#define ISTATE_OFFSET_X21   0xa8
-#define ISTATE_OFFSET_X22   0xb0
-#define ISTATE_OFFSET_X23   0xb8
-#define ISTATE_OFFSET_X24   0xc0
-#define ISTATE_OFFSET_X25   0xc8
-#define ISTATE_OFFSET_X26   0xd0
-#define ISTATE_OFFSET_X27   0xd8
-#define ISTATE_OFFSET_X28   0xe0
-#define ISTATE_OFFSET_X29   0xe8
-#define ISTATE_OFFSET_X30   0xf0
-#define ISTATE_OFFSET_X31   0xf8
-#define ISTATE_OFFSET_PC    0x100
-#define ISTATE_SIZE         0x108
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#ifdef KERNEL
-#include <typedefs.h>
-#else
-#include <stddef.h>
-#endif
-
-typedef struct istate {
-	uint64_t zero;
-	uint64_t ra;
-	uint64_t sp;
-	uint64_t x3;
-	uint64_t x4;
-	uint64_t x5;
-	uint64_t x6;
-	uint64_t x7;
-	uint64_t x8;
-	uint64_t x9;
-	uint64_t x10;
-	uint64_t x11;
-	uint64_t x12;
-	uint64_t x13;
-	uint64_t x14;
-	uint64_t x15;
-	uint64_t x16;
-	uint64_t x17;
-	uint64_t x18;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	uint64_t x29;
-	uint64_t x30;
-	uint64_t x31;
-	uint64_t pc;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/riscv64/include/arch/mm/as.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_AS_H_
-#define KERN_riscv64_AS_H_
-
-#define ADDRESS_SPACE_HOLE_START  UINT64_C(0x0000800000000000)
-#define ADDRESS_SPACE_HOLE_END    UINT64_C(0xffff7fffffffffff)
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  0
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0xffff800000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0x00007fffffffffff)
-
-typedef struct {
-} as_arch_t;
-
-#include <genarch/mm/as_pt.h>
-
-#define as_constructor_arch(as, flags)  ((void)as, (void)flags, EOK)
-#define as_destructor_arch(as)          ((void)as, 0)
-#define as_create_arch(as, flags)       ((void)as, (void)flags, EOK)
-#define as_deinstall_arch(as)
-#define as_invalidate_translation_cache(as, page, cnt)
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/mm/asid.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_ASID_H_
-#define KERN_riscv64_ASID_H_
-
-#include <stdint.h>
-
-#define ASID_MAX_ARCH  4096
-
-typedef uint32_t asid_t;
-
-#define asid_get()  (ASID_START + 1)
-#define asid_put(asid)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/mm/frame.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_FRAME_H_
-#define KERN_riscv64_FRAME_H_
-
-#define FRAME_WIDTH  12  /* 4 KiB */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-#include <arch/boot/boot.h>
-
-extern uintptr_t physmem_start;
-extern uintptr_t htif_frame;
-extern uintptr_t pt_frame;
-extern memmap_t memmap;
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-extern void physmem_print(void);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/mm/km.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_KM_H_
-#define KERN_riscv64_KM_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define KM_RISCV64_IDENTITY_START      UINT64_C(0xffff800000000000)
-#define KM_RISCV64_IDENTITY_SIZE       UINT64_C(0x0000400000000000)
-
-#define KM_RISCV64_NON_IDENTITY_START  UINT64_C(0xffffc00000000000)
-#define KM_RISCV64_NON_IDENTITY_SIZE   UINT64_C(0x0000400000000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/mm/page.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_PAGE_H_
-#define KERN_riscv64_PAGE_H_
-
-#include <arch/mm/frame.h>
-
-#define PAGE_WIDTH  FRAME_WIDTH
-#define PAGE_SIZE   FRAME_SIZE
-
-#ifndef __ASSEMBLER__
-#define KA2PA(x)  (((uintptr_t) (x)) - UINT64_C(0xffff800000000000))
-#define PA2KA(x)  (((uintptr_t) (x)) + UINT64_C(0xffff800000000000))
-#else
-#define KA2PA(x)  ((x) - 0xffff800000000000)
-#define PA2KA(x)  ((x) + 0xffff800000000000)
-#endif
-
-/*
- * Implementation of 4-level page table interface.
- *
- * Page table layout:
- * - 64-bit virtual addressess
- *   (the virtual address space is 2^48 bytes in size
- *   with a hole in the middle)
- * - Offset is 12 bits => pages are 4 KiB long
- * - PTL0 has 512 entries (9 bits)
- * - PTL1 has 512 entries (9 bits)
- * - PTL2 has 512 entries (9 bits)
- * - PLT3 has 512 entries (9 bits)
- */
-
-/* Number of entries in each level. */
-#define PTL0_ENTRIES_ARCH  512
-#define PTL1_ENTRIES_ARCH  512
-#define PTL2_ENTRIES_ARCH  512
-#define PTL3_ENTRIES_ARCH  512
-
-/* Page table sizes for each level. */
-#define PTL0_FRAMES_ARCH  1
-#define PTL1_FRAMES_ARCH  1
-#define PTL2_FRAMES_ARCH  1
-#define PTL3_FRAMES_ARCH  1
-
-/* Macros calculating indices into page tables on each level. */
-#define PTL0_INDEX_ARCH(vaddr)  (((vaddr) >> 39) & 0x1ff)
-#define PTL1_INDEX_ARCH(vaddr)  (((vaddr) >> 30) & 0x1ff)
-#define PTL2_INDEX_ARCH(vaddr)  (((vaddr) >> 21) & 0x1ff)
-#define PTL3_INDEX_ARCH(vaddr)  (((vaddr) >> 12) & 0x1ff)
-
-/* Flags mask for non-leaf page table entries */
-#define NON_LEAF_MASK  (~(PAGE_READ | PAGE_WRITE | PAGE_EXEC))
-
-/* Get PTE address accessors for each level. */
-#define GET_PTL1_ADDRESS_ARCH(ptl0, i) \
-	(((pte_t *) (ptl0))[(i)].pfn << 12)
-
-#define GET_PTL2_ADDRESS_ARCH(ptl1, i) \
-	(((pte_t *) (ptl1))[(i)].pfn << 12)
-
-#define GET_PTL3_ADDRESS_ARCH(ptl2, i) \
-	(((pte_t *) (ptl2))[(i)].pfn << 12)
-
-#define GET_FRAME_ADDRESS_ARCH(ptl3, i) \
-	(((pte_t *) (ptl3))[(i)].pfn << 12)
-
-/* Set PTE address accessors for each level. */
-#define SET_PTL0_ADDRESS_ARCH(ptl0) \
-	(write_satp((uintptr_t) (ptl0)))
-
-#define SET_PTL1_ADDRESS_ARCH(ptl0, i, a) \
-	(((pte_t *) (ptl0))[(i)].pfn = (a) >> 12)
-
-#define SET_PTL2_ADDRESS_ARCH(ptl1, i, a) \
-	(((pte_t *) (ptl1))[(i)].pfn = (a) >> 12)
-
-#define SET_PTL3_ADDRESS_ARCH(ptl2, i, a) \
-	(((pte_t *) (ptl2))[(i)].pfn = (a) >> 12)
-
-#define SET_FRAME_ADDRESS_ARCH(ptl3, i, a) \
-	(((pte_t *) (ptl3))[(i)].pfn = (a) >> 12)
-
-/* Get PTE flags accessors for each level. */
-#define GET_PTL1_FLAGS_ARCH(ptl0, i) \
-	get_pt_flags((pte_t *) (ptl0), (size_t) (i))
-
-#define GET_PTL2_FLAGS_ARCH(ptl1, i) \
-	get_pt_flags((pte_t *) (ptl1), (size_t) (i))
-
-#define GET_PTL3_FLAGS_ARCH(ptl2, i) \
-	get_pt_flags((pte_t *) (ptl2), (size_t) (i))
-
-#define GET_FRAME_FLAGS_ARCH(ptl3, i) \
-	get_pt_flags((pte_t *) (ptl3), (size_t) (i))
-
-/* Set PTE flags accessors for each level. */
-#define SET_PTL1_FLAGS_ARCH(ptl0, i, flags) \
-	set_pt_flags((pte_t *) (ptl0), (size_t) (i), ((flags) & NON_LEAF_MASK))
-
-#define SET_PTL2_FLAGS_ARCH(ptl1, i, flags) \
-	set_pt_flags((pte_t *) (ptl1), (size_t) (i), ((flags) & NON_LEAF_MASK))
-
-#define SET_PTL3_FLAGS_ARCH(ptl2, i, flags) \
-	set_pt_flags((pte_t *) (ptl2), (size_t) (i), ((flags) & NON_LEAF_MASK))
-
-#define SET_FRAME_FLAGS_ARCH(ptl3, i, flags) \
-	set_pt_flags((pte_t *) (ptl3), (size_t) (i), (flags))
-
-/* Set PTE present accessors for each level. */
-#define SET_PTL1_PRESENT_ARCH(ptl0, i) \
-	set_pt_present((pte_t *) (ptl0), (size_t) (i))
-
-#define SET_PTL2_PRESENT_ARCH(ptl1, i) \
-	set_pt_present((pte_t *) (ptl1), (size_t) (i))
-
-#define SET_PTL3_PRESENT_ARCH(ptl2, i) \
-	set_pt_present((pte_t *) (ptl2), (size_t) (i))
-
-#define SET_FRAME_PRESENT_ARCH(ptl3, i) \
-	set_pt_present((pte_t *) (ptl3), (size_t) (i))
-
-/* Macros for querying the last-level PTEs. */
-#define PTE_VALID_ARCH(pte)       ((pte)->valid != 0)
-#define PTE_PRESENT_ARCH(pte)     ((pte)->valid != 0)
-#define PTE_GET_FRAME_ARCH(pte)   ((uintptr_t) (pte)->pfn << 12)
-#define PTE_WRITABLE_ARCH(pte)    ((pte)->writable != 0)
-#define PTE_EXECUTABLE_ARCH(pte)  ((pte)->executable != 0)
-
-#ifndef __ASSEMBLER__
-
-#include <mm/mm.h>
-#include <arch/interrupt.h>
-#include <stdint.h>
-
-/** Page Table Entry. */
-typedef struct {
-	unsigned long valid : 1;       /**< Valid bit. */
-	unsigned long readable : 1;    /**< Readable bit. */
-	unsigned long writable : 1;    /**< Writable bit. */
-	unsigned long executable : 1;  /**< Executable bit. */
-	unsigned long user : 1;        /**< User mode accessible bit. */
-	unsigned long global : 1;      /**< Global mapping bit. */
-	unsigned long accessed : 1;    /**< Accessed bit. */
-	unsigned long dirty : 1;       /**< Dirty bit. */
-	unsigned long reserved : 2;    /**< Reserved bits. */
-	unsigned long pfn : 54;        /**< Physical frame number. */
-} pte_t;
-
-_NO_TRACE static inline unsigned int get_pt_flags(pte_t *pt, size_t i)
-{
-	pte_t *entry = &pt[i];
-
-	return (((!entry->valid) << PAGE_PRESENT_SHIFT) |
-	    (entry->user << PAGE_USER_SHIFT) |
-	    (entry->readable << PAGE_READ_SHIFT) |
-	    (entry->writable << PAGE_WRITE_SHIFT) |
-	    (entry->executable << PAGE_EXEC_SHIFT) |
-	    (entry->global << PAGE_GLOBAL_SHIFT));
-}
-
-_NO_TRACE static inline void set_pt_flags(pte_t *pt, size_t i, int flags)
-{
-	pte_t *entry = &pt[i];
-
-	entry->valid = !(flags & PAGE_NOT_PRESENT);
-	entry->readable = (flags & PAGE_READ) != 0;
-	entry->writable = (flags & PAGE_WRITE) != 0;
-	entry->executable = (flags & PAGE_EXEC) != 0;
-	entry->user = (flags & PAGE_USER) != 0;
-	entry->global = (flags & PAGE_GLOBAL) != 0;
-	entry->accessed = 1;
-	entry->dirty = 1;
-}
-
-_NO_TRACE static inline void set_pt_present(pte_t *pt, size_t i)
-{
-	pte_t *entry = &pt[i];
-
-	entry->valid = 1;
-}
-
-extern void page_arch_init(void);
-extern void page_fault(unsigned int, istate_t *);
-extern void write_satp(uintptr_t);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/riscv64/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_TLB_H_
-#define KERN_riscv64_TLB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/proc/task.h
===================================================================
--- kernel/arch/riscv64/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_TASK_H_
-#define KERN_riscv64_TASK_H_
-
-#include <stddef.h>
-
-typedef struct {
-} task_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/proc/thread.h
===================================================================
--- kernel/arch/riscv64/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_THREAD_H_
-#define KERN_riscv64_THREAD_H_
-
-typedef struct {
-} thread_arch_t;
-
-#define thr_constructor_arch(thread)
-#define thr_destructor_arch(thread)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/stack.h
===================================================================
--- kernel/arch/riscv64/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_STACK_H_
-#define KERN_riscv64_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE  STACK_SIZE
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/include/arch/types.h
===================================================================
--- kernel/arch/riscv64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_riscv64_TYPES_H_
-#define KERN_riscv64_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/riscv64/meson.build
===================================================================
--- kernel/arch/riscv64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/boot/boot.S',
-	'src/asm.S',
-	'src/context.S',
-	'src/debug/stacktrace.c',
-	'src/drivers/ucb.c',
-	'src/proc/scheduler.c',
-	'src/proc/task.c',
-	'src/proc/thread.c',
-	'src/riscv64.c',
-	'src/userspace.c',
-	'src/smc.c',
-	'src/cpu/cpu.c',
-	'src/mm/km.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/tlb.c',
-)
-
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/riscv64/src/asm.S
===================================================================
--- kernel/arch/riscv64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(asm_delay_loop)
-	ret
-FUNCTION_END(asm_delay_loop)
-
-FUNCTION_BEGIN(early_putuchar)
-	ret
-FUNCTION_END(early_putuchar)
-
-FUNCTION_BEGIN(cpu_halt)
-	j cpu_halt
-FUNCTION_END(cpu_halt)
Index: rnel/arch/riscv64/src/boot/boot.S
===================================================================
--- kernel/arch/riscv64/src/boot/boot.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2017 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/boot/boot.h>
-#include <arch/cpu.h>
-
-.section K_TEXT_START, "ax"
-
-SYMBOL(kernel_image_start)
-	/* Setup temporary stack */
-	la sp, temp_stack
-
-	/* Create the first stack frame */
-	addi sp, sp, -16
-
-	/* Call riscv64_pre_main() */
-	jal riscv64_pre_main
-
-	/* Call main_bsp() */
-	jal main_bsp
-
-	/* Not reached */
-	csrci sstatus, SSTATUS_SIE_MASK
-	hlt0:
-		wfi
-		j hlt0
-
-.data
-
-.align 16
-.space TEMP_STACK_SIZE
-temp_stack:
Index: rnel/arch/riscv64/src/context.S
===================================================================
--- kernel/arch/riscv64/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-#
-# Copyright (c) 2003-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-
-.text
-
-FUNCTION_BEGIN(context_save_arch)
-	sd gp, CONTEXT_OFFSET_GP(a0)
-	sd tp, CONTEXT_OFFSET_TP(a0)
-	sd s0, CONTEXT_OFFSET_S0(a0)
-	sd s1, CONTEXT_OFFSET_S1(a0)
-	sd s2, CONTEXT_OFFSET_S2(a0)
-	sd s3, CONTEXT_OFFSET_S3(a0)
-	sd s4, CONTEXT_OFFSET_S4(a0)
-	sd s5, CONTEXT_OFFSET_S5(a0)
-	sd s6, CONTEXT_OFFSET_S6(a0)
-	sd s7, CONTEXT_OFFSET_S7(a0)
-	sd s8, CONTEXT_OFFSET_S8(a0)
-	sd s9, CONTEXT_OFFSET_S9(a0)
-	sd s10, CONTEXT_OFFSET_S10(a0)
-	sd s11, CONTEXT_OFFSET_S11(a0)
-
-	sd ra, CONTEXT_OFFSET_PC(a0)
-	sd sp, CONTEXT_OFFSET_SP(a0)
-
-	# context_save returns 1
-	li a0, 1
-	ret
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	ld gp, CONTEXT_OFFSET_GP(a0)
-	ld tp, CONTEXT_OFFSET_TP(a0)
-	ld s0, CONTEXT_OFFSET_S0(a0)
-	ld s1, CONTEXT_OFFSET_S1(a0)
-	ld s2, CONTEXT_OFFSET_S2(a0)
-	ld s3, CONTEXT_OFFSET_S3(a0)
-	ld s4, CONTEXT_OFFSET_S4(a0)
-	ld s5, CONTEXT_OFFSET_S5(a0)
-	ld s6, CONTEXT_OFFSET_S6(a0)
-	ld s7, CONTEXT_OFFSET_S7(a0)
-	ld s8, CONTEXT_OFFSET_S8(a0)
-	ld s9, CONTEXT_OFFSET_S9(a0)
-	ld s10, CONTEXT_OFFSET_S10(a0)
-	ld s11, CONTEXT_OFFSET_S11(a0)
-
-	ld ra, CONTEXT_OFFSET_PC(a0)
-	ld sp, CONTEXT_OFFSET_SP(a0)
-
-	# context_restore returns 0
-	li a0, 0
-	ret
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/riscv64/src/cpu/cpu.c
===================================================================
--- kernel/arch/riscv64/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <fpu_context.h>
-
-void fpu_disable(void)
-{
-}
-
-void fpu_enable(void)
-{
-}
-
-void cpu_arch_init(void)
-{
-}
-
-void cpu_identify(void)
-{
-}
-
-void cpu_print_report(cpu_t *cpu)
-{
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/riscv64/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <syscall/copy.h>
-#include <typedefs.h>
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return true;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return true;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return true;
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return true;
-}
-
-uintptr_t frame_pointer_get(void)
-{
-	return 0;
-}
-
-uintptr_t program_counter_get(void)
-{
-	return 0;
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/drivers/ucb.c
===================================================================
--- kernel/arch/riscv64/src/drivers/ucb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2017 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <arch/drivers/ucb.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <console/chardev.h>
-#include <str.h>
-#include <stdlib.h>
-
-#define HTIF_DEVICE_CONSOLE  1
-
-#define HTIF_CONSOLE_PUTC  1
-
-static volatile uint64_t *tohost;
-static volatile uint64_t *fromhost;
-
-static void poll_fromhost()
-{
-	uint64_t val = *fromhost;
-	if (!val)
-		return;
-
-	*fromhost = 0;
-}
-
-static void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload)
-{
-	uint64_t val = (((uint64_t) device) << 56) |
-	    (((uint64_t) cmd) << 48) |
-	    (payload & UINT64_C(0xffffffffffff));
-
-	while (*tohost)
-		poll_fromhost();
-
-	*tohost = val;
-}
-
-static void htif_write(outdev_t *dev, const char *s, size_t n)
-{
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, '\r');
-
-		htif_cmd(HTIF_DEVICE_CONSOLE, HTIF_CONSOLE_PUTC, (uint8_t) *s);
-	}
-}
-
-static outdev_operations_t htifdev_ops = {
-	.write = htif_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-void htif_init(volatile uint64_t *tohost_addr, volatile uint64_t *fromhost_addr)
-{
-	tohost = tohost_addr;
-	fromhost = fromhost_addr;
-}
-
-outdev_t *htifout_init(void)
-{
-	outdev_t *htifdev = malloc(sizeof(outdev_t));
-	if (!htifdev)
-		return NULL;
-
-	outdev_initialize("htifdev", htifdev, &htifdev_ops);
-	return htifdev;
-}
Index: rnel/arch/riscv64/src/mm/as.c
===================================================================
--- kernel/arch/riscv64/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-
-#include <mm/as.h>
-#include <arch/mm/as.h>
-#include <genarch/mm/page_pt.h>
-
-void as_arch_init(void)
-{
-	as_operations = &as_pt_operations;
-}
-
-/** Install address space.
- *
- * Install ASID.
- *
- * @param as Address space structure.
- */
-void as_install_arch(as_t *as)
-{
-	// FIXME
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/mm/frame.c
===================================================================
--- kernel/arch/riscv64/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-
-#include <mm/frame.h>
-#include <arch/boot/boot.h>
-#include <arch/mm/frame.h>
-#include <arch/drivers/ucb.h>
-#include <mm/as.h>
-#include <config.h>
-#include <panic.h>
-#include <debug.h>
-#include <align.h>
-#include <macros.h>
-
-uintptr_t physmem_start;
-uintptr_t htif_frame;
-uintptr_t pt_frame;
-memmap_t memmap;
-
-void physmem_print(void)
-{
-}
-
-static void frame_common_arch_init(bool low)
-{
-	pfn_t minconf =
-	    max3(ADDR2PFN(physmem_start), htif_frame + 1, pt_frame + 1);
-
-	for (size_t i = 0; i < memmap.cnt; i++) {
-		/* To be safe, make the available zone possibly smaller */
-		uintptr_t base = ALIGN_UP((uintptr_t) memmap.zones[i].start,
-		    FRAME_SIZE);
-		size_t size = ALIGN_DOWN(memmap.zones[i].size -
-		    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			return;
-
-		pfn_t pfn = ADDR2PFN(base);
-		size_t count = SIZE2FRAMES(size);
-		pfn_t conf;
-
-		if (low) {
-			if ((minconf < pfn) || (minconf >= pfn + count))
-				conf = pfn;
-			else
-				conf = minconf;
-
-			zone_create(pfn, count, conf,
-			    ZONE_AVAILABLE | ZONE_LOWMEM);
-		} else {
-			conf = zone_external_conf_alloc(count);
-			if (conf != 0)
-				zone_create(pfn, count, conf,
-				    ZONE_AVAILABLE | ZONE_HIGHMEM);
-		}
-	}
-}
-
-void frame_low_arch_init(void)
-{
-	frame_common_arch_init(true);
-
-	frame_mark_unavailable(htif_frame, 1);
-	frame_mark_unavailable(pt_frame, 1);
-}
-
-void frame_high_arch_init(void)
-{
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/mm/km.c
===================================================================
--- kernel/arch/riscv64/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <stdbool.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_RISCV64_IDENTITY_START;
-	config.identity_size = KM_RISCV64_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_RISCV64_NON_IDENTITY_START,
-	    KM_RISCV64_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_RISCV64_NON_IDENTITY_START,
-	    KM_RISCV64_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/mm/page.c
===================================================================
--- kernel/arch/riscv64/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <arch/mm/frame.h>
-#include <arch/cpu.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <align.h>
-#include <config.h>
-#include <halt.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-#include <debug.h>
-#include <interrupt.h>
-
-void page_arch_init(void)
-{
-	if (config.cpu_active == 1) {
-		page_mapping_operations = &pt_mapping_operations;
-
-		page_table_lock(AS_KERNEL, true);
-
-		/*
-		 * PA2KA(identity) mapping for all low-memory frames.
-		 */
-		for (uintptr_t cur = 0;
-		    cur < min(config.identity_size, config.physmem_end);
-		    cur += FRAME_SIZE)
-			page_mapping_insert(AS_KERNEL, PA2KA(cur), cur,
-			    PAGE_GLOBAL | PAGE_CACHEABLE | PAGE_EXEC | PAGE_WRITE | PAGE_READ);
-
-		page_table_unlock(AS_KERNEL, true);
-
-		// FIXME: register page fault extension handler
-
-		write_satp((uintptr_t) AS_KERNEL->genarch.page_table);
-
-		/* The boot page table is no longer needed. */
-		// FIXME: frame_mark_available(pt_frame, 1);
-	}
-}
-
-void page_fault(unsigned int n __attribute__((unused)), istate_t *istate)
-{
-}
-
-void write_satp(uintptr_t ptl0)
-{
-	uint64_t satp = ((ptl0 >> FRAME_WIDTH) & SATP_PFN_MASK) |
-	    SATP_MODE_SV48;
-
-	asm volatile (
-	    "csrw satp, %[satpv]\n"
-	    :: [satpv] "r" (satp)
-	);
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/mm/tlb.c
===================================================================
--- kernel/arch/riscv64/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_mm
- * @{
- */
-
-#include <mm/tlb.h>
-#include <arch/mm/asid.h>
-#include <arch/asm.h>
-#include <typedefs.h>
-
-void tlb_invalidate_all(void)
-{
-}
-
-void tlb_invalidate_asid(asid_t asid __attribute__((unused)))
-{
-	tlb_invalidate_all();
-}
-
-void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt)
-{
-	tlb_invalidate_all();
-}
-
-void tlb_arch_init(void)
-{
-}
-
-void tlb_print(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/proc/scheduler.c
===================================================================
--- kernel/arch/riscv64/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-
-void before_task_runs_arch(void)
-{
-}
-
-void before_thread_runs_arch(void)
-{
-}
-
-void after_thread_ran_arch(void)
-{
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/proc/task.c
===================================================================
--- kernel/arch/riscv64/src/proc/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/task.h>
-
-void task_create_arch(task_t *t)
-{
-}
-
-void task_destroy_arch(task_t *t)
-{
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/proc/thread.c
===================================================================
--- kernel/arch/riscv64/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/thread.h>
-
-errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
-{
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/riscv64.c
===================================================================
--- kernel/arch/riscv64/src/riscv64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <stddef.h>
-#include <arch/arch.h>
-#include <arch/interrupt.h>
-#include <arch/asm.h>
-#include <arch/drivers/ucb.h>
-
-#include <halt.h>
-#include <config.h>
-#include <errno.h>
-#include <context.h>
-#include <fpu_context.h>
-#include <interrupt.h>
-#include <syscall/copy.h>
-#include <ddi/irq.h>
-#include <proc/thread.h>
-#include <console/console.h>
-#include <memw.h>
-#include <str.h>
-
-char memcpy_from_uspace_failover_address;
-char memcpy_to_uspace_failover_address;
-
-static void riscv64_post_mm_init(void);
-
-arch_ops_t riscv64_ops = {
-	.post_mm_init = riscv64_post_mm_init
-};
-
-arch_ops_t *arch_ops = &riscv64_ops;
-
-void riscv64_pre_main(bootinfo_t *bootinfo)
-{
-	physmem_start = bootinfo->physmem_start;
-	htif_frame = bootinfo->htif_frame;
-	pt_frame = bootinfo->pt_frame;
-
-	htif_init(bootinfo->ucbinfo.tohost, bootinfo->ucbinfo.fromhost);
-
-	/* Copy tasks map. */
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS,
-	    CONFIG_INIT_TASKS);
-
-	for (size_t i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Copy physical memory map. */
-	memmap.total = bootinfo->memmap.total;
-	memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
-	for (size_t i = 0; i < memmap.cnt; i++) {
-		memmap.zones[i].start = bootinfo->memmap.zones[i].start;
-		memmap.zones[i].size = bootinfo->memmap.zones[i].size;
-	}
-}
-
-void riscv64_post_mm_init(void)
-{
-	outdev_t *htifout = htifout_init();
-	if (htifout)
-		stdout_wire(htifout);
-}
-
-void calibrate_delay_loop(void)
-{
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void arch_reboot(void)
-{
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-void istate_decode(istate_t *istate)
-{
-	(void) istate;
-}
-
-void fpu_init(void)
-{
-}
-
-void fpu_context_save(fpu_context_t *ctx)
-{
-}
-
-void fpu_context_restore(fpu_context_t *ctx)
-{
-}
-
-uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
-{
-	return 0;
-}
-
-uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
-{
-	return 0;
-}
-
-/** @}
- */
Index: rnel/arch/riscv64/src/smc.c
===================================================================
--- kernel/arch/riscv64/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-
-void smc_coherence(void *a, size_t l)
-{
-	// TODO
-	compiler_barrier();
-}
Index: rnel/arch/riscv64/src/userspace.c
===================================================================
--- kernel/arch/riscv64/src/userspace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_riscv64
- * @{
- */
-/** @file
- */
-
-#include <userspace.h>
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return stack_base + stack_size;
-}
-
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	// FIXME
-	while (true)
-		;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/_link.ld.in
===================================================================
--- kernel/arch/sparc64/_link.ld.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/** SPARC64 linker script
- *
- *  It is ELF format, but its only section looks like this:
- *   kernel text
- *   kernel data
- *
- */
-
-#include <arch/boot/boot.h>
-
-ENTRY(kernel_image_start)
-
-SECTIONS {
-	kernel_load_address = VMA;
-
-	.text (VMA + SIZEOF_HEADERS): AT (LMA + SIZEOF_HEADERS) {
-		ktext_start = .;
-		KEEP(*(K_TEXT_START));
-		*(.text .text.*);
-		ktext_end = .;
-	}
-
-	/* stack unwinding data */
-	.eh_frame_hdr : {
-		eh_frame_hdr_start = .;
-		*(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*);
-		eh_frame_hdr_end = .;
-	}
-
-	.eh_frame : {
-		eh_frame_start = .;
-		KEEP(*(.eh_frame .eh_frame.*));
-		eh_frame_end = .;
-	}
-
-	.data : {
-		kdata_start = .;
-		KEEP(*(K_DATA_START));
-		*(.rodata .rodata.*);
-		*(.data .data.*);                   /* initialized data */
-		*(.sdata .sdata.*);
-		*(.sdata2 .sdata2.*);
-		*(.sbss .sbss.*);
-		. = ALIGN(8);
-		*(.bss .bss.*);                    /* uninitialized static variables */
-		*(COMMON);                  /* global variables */
-		kdata_end = .;
-	}
-
-	.comment 0 : { *(.comment); }
-	.debug_abbrev 0 : { *(.debug_abbrev); }
-	.debug_abbrev.dwo 0 : { *(	.debug_abbrev.dwo); }
-	.debug_addr 0 : { *(.debug_addr); }
-	.debug_aranges 0 : { *(.debug_aranges); }
-	.debug_cu_index 0 : { *(.debug_cu_index); }
-	.debug_frame 0 : { *(.debug_frame); }
-	.debug_frame_hdr 0 : { *(.debug_frame_hdr); }
-	.debug_info 0 : { *(.debug_info); }
-	.debug_info.dwo 0 : { *(.debug_info.dwo); }
-	.debug_line 0 : { *(.debug_line); }
-	.debug_line.dwo 0 : { *(.debug_line.dwo); }
-	.debug_line_str 0 : { *(.debug_line_str); }
-	.debug_loc 0 : { *(.debug_loc); }
-	.debug_loclists 0 : { *(.debug_loclists); }
-	.debug_loclists.dwo 0 : { *(.debug_loclists.dwo); }
-	.debug_macinfo 0 : { *(.debug_macinfo); }
-	.debug_macro 0 : { *(.debug_macro); }
-	.debug_macro.dwo 0 : { *(.debug_macro.dwo); }
-	.debug_names 0 : { *(.debug_names); }
-	.debug_pubnames 0 : { *(.debug_pubnames); }
-	.debug_pubtypes 0 : { *(.debug_pubtypes); }
-	.debug_ranges 0 : { *(.debug_ranges); }
-	.debug_rnglists 0 : { *(.debug_rnglists); }
-	.debug_str 0 : { *(.debug_str); }
-	.debug_str.dwo 0 : { *(.debug_str.dwo); }
-	.debug_str_offsets 0 : { *(.debug_str_offsets); }
-	.debug_str_offsets.dwo 0 : { *(.debug_str_offsets.dwo); }
-	.debug_tu_index 0 : { *(.debug_tu_index); }
-	.debug_types 0 : { *(.debug_types); }
-
-	/DISCARD/ : {
-		*(*);
-	}
-
-}
Index: rnel/arch/sparc64/include/arch/arch.h
===================================================================
--- kernel/arch/sparc64/include/arch/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief Various sparc64-specific macros.
- */
-
-#ifndef KERN_sparc64_ARCH_H_
-#define KERN_sparc64_ARCH_H_
-
-#ifndef __ASSEMBLER__
-#include <arch.h>
-#endif
-
-#include <arch/boot/boot.h>
-
-#if defined (SUN4U)
-#include <arch/sun4u/arch.h>
-#elif defined (SUN4V)
-#include <arch/sun4v/arch.h>
-#endif
-
-#define ASI_AIUP  0x10  /** Access to primary context with user privileges. */
-#define ASI_AIUS  0x11  /** Access to secondary context with user privileges. */
-
-#define NWINDOWS  8  /** Number of register window sets. */
-
-#ifndef __ASSEMBLER__
-
-extern arch_ops_t *sparc64_ops;
-
-extern void sparc64_pre_main(bootinfo_t *);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/asm.h
===================================================================
--- kernel/arch/sparc64/include/arch/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_ASM_H_
-#define KERN_sparc64_ASM_H_
-
-#include <typedefs.h>
-#include <align.h>
-#include <arch/register.h>
-#include <config.h>
-#include <arch/stack.h>
-#include <barrier.h>
-#include <trace.h>
-
-_NO_TRACE static inline void cpu_spin_hint(void)
-{
-}
-
-_NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-_NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-_NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-_NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
-{
-	uint8_t rv = *port;
-	memory_barrier();
-	return rv;
-}
-
-_NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
-{
-	uint16_t rv = *port;
-	memory_barrier();
-	return rv;
-}
-
-_NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
-{
-	uint32_t rv = *port;
-	memory_barrier();
-	return rv;
-}
-
-/** Read Processor State register.
- *
- * @return Value of PSTATE register.
- *
- */
-_NO_TRACE static inline uint64_t pstate_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%pstate, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write Processor State register.
- *
- * @param v New value of PSTATE register.
- *
- */
-_NO_TRACE static inline void pstate_write(uint64_t v)
-{
-	asm volatile (
-	    "wrpr %[v], %[zero], %%pstate\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Read TICK_compare Register.
- *
- * @return Value of TICK_comapre register.
- *
- */
-_NO_TRACE static inline uint64_t tick_compare_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rd %%tick_cmpr, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write TICK_compare Register.
- *
- * @param v New value of TICK_comapre register.
- *
- */
-_NO_TRACE static inline void tick_compare_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%tick_cmpr\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Read STICK_compare Register.
- *
- * @return Value of STICK_compare register.
- *
- */
-_NO_TRACE static inline uint64_t stick_compare_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rd %%asr25, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write STICK_compare Register.
- *
- * @param v New value of STICK_comapre register.
- *
- */
-_NO_TRACE static inline void stick_compare_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%asr25\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Read TICK Register.
- *
- * @return Value of TICK register.
- *
- */
-_NO_TRACE static inline uint64_t tick_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%tick, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write TICK Register.
- *
- * @param v New value of TICK register.
- *
- */
-_NO_TRACE static inline void tick_write(uint64_t v)
-{
-	asm volatile (
-	    "wrpr %[v], %[zero], %%tick\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Read FPRS Register.
- *
- * @return Value of FPRS register.
- *
- */
-_NO_TRACE static inline uint64_t fprs_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rd %%fprs, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write FPRS Register.
- *
- * @param v New value of FPRS register.
- *
- */
-_NO_TRACE static inline void fprs_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%fprs\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Read SOFTINT Register.
- *
- * @return Value of SOFTINT register.
- *
- */
-_NO_TRACE static inline uint64_t softint_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rd %%softint, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write SOFTINT Register.
- *
- * @param v New value of SOFTINT register.
- *
- */
-_NO_TRACE static inline void softint_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%softint\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Write CLEAR_SOFTINT Register.
- *
- * Bits set in CLEAR_SOFTINT register will be cleared in SOFTINT register.
- *
- * @param v New value of CLEAR_SOFTINT register.
- *
- */
-_NO_TRACE static inline void clear_softint_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%clear_softint\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Write SET_SOFTINT Register.
- *
- * Bits set in SET_SOFTINT register will be set in SOFTINT register.
- *
- * @param v New value of SET_SOFTINT register.
- *
- */
-_NO_TRACE static inline void set_softint_write(uint64_t v)
-{
-	asm volatile (
-	    "wr %[v], %[zero], %%set_softint\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Enable interrupts.
- *
- * Enable interrupts and return previous
- * value of IPL.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_enable(void)
-{
-	pstate_reg_t pstate;
-	uint64_t value = pstate_read();
-
-	pstate.value = value;
-	pstate.ie = true;
-	pstate_write(pstate.value);
-
-	return (ipl_t) value;
-}
-
-/** Disable interrupts.
- *
- * Disable interrupts and return previous
- * value of IPL.
- *
- * @return Old interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_disable(void)
-{
-	pstate_reg_t pstate;
-	uint64_t value = pstate_read();
-
-	pstate.value = value;
-	pstate.ie = false;
-	pstate_write(pstate.value);
-
-	return (ipl_t) value;
-}
-
-/** Restore interrupt priority level.
- *
- * Restore IPL.
- *
- * @param ipl Saved interrupt priority level.
- *
- */
-_NO_TRACE static inline void interrupts_restore(ipl_t ipl)
-{
-	pstate_reg_t pstate;
-
-	pstate.value = pstate_read();
-	pstate.ie = ((pstate_reg_t)(uint64_t) ipl).ie;
-	pstate_write(pstate.value);
-}
-
-/** Return interrupt priority level.
- *
- * Return IPL.
- *
- * @return Current interrupt priority level.
- *
- */
-_NO_TRACE static inline ipl_t interrupts_read(void)
-{
-	return (ipl_t) pstate_read();
-}
-
-/** Check interrupts state.
- *
- * @return True if interrupts are disabled.
- *
- */
-_NO_TRACE static inline bool interrupts_disabled(void)
-{
-	pstate_reg_t pstate;
-
-	pstate.value = pstate_read();
-	return !pstate.ie;
-}
-
-/** Read Version Register.
- *
- * @return Value of VER register.
- *
- */
-_NO_TRACE static inline uint64_t ver_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%ver, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Read Trap Program Counter register.
- *
- * @return Current value in TPC.
- *
- */
-_NO_TRACE static inline uint64_t tpc_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%tpc, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Read Trap Level register.
- *
- * @return Current value in TL.
- *
- */
-_NO_TRACE static inline uint64_t tl_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%tl, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Read Trap Base Address register.
- *
- * @return Current value in TBA.
- *
- */
-_NO_TRACE static inline uint64_t tba_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%tba, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-/** Write Trap Base Address register.
- *
- * @param v New value of TBA.
- *
- */
-_NO_TRACE static inline void tba_write(uint64_t v)
-{
-	asm volatile (
-	    "wrpr %[v], %[zero], %%tba\n"
-	    :: [v] "r" (v),
-	      [zero] "i" (0)
-	);
-}
-
-/** Load uint64_t from alternate space.
- *
- * @param asi ASI determining the alternate space.
- * @param va  Virtual address within the ASI.
- *
- * @return Value read from the virtual address in
- *         the specified address space.
- *
- */
-_NO_TRACE static inline uint64_t asi_u64_read(asi_t asi, uintptr_t va)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "ldxa [%[va]] %[asi], %[v]\n"
-	    : [v] "=r" (v)
-	    : [va] "r" (va),
-	      [asi] "i" ((unsigned int) asi)
-	);
-
-	return v;
-}
-
-/** Store uint64_t to alternate space.
- *
- * @param asi ASI determining the alternate space.
- * @param va  Virtual address within the ASI.
- * @param v   Value to be written.
- *
- */
-_NO_TRACE static inline void asi_u64_write(asi_t asi, uintptr_t va, uint64_t v)
-{
-	asm volatile (
-	    "stxa %[v], [%[va]] %[asi]\n"
-	    :: [v] "r" (v),
-	      [va] "r" (va),
-	      [asi] "i" ((unsigned int) asi)
-	    : "memory"
-	);
-}
-
-/** Flush all valid register windows to memory. */
-_NO_TRACE static inline void flushw(void)
-{
-	asm volatile ("flushw\n");
-}
-
-/** Switch to nucleus by setting TL to 1. */
-_NO_TRACE static inline void nucleus_enter(void)
-{
-	asm volatile ("wrpr %g0, 1, %tl\n");
-}
-
-/** Switch from nucleus by setting TL to 0. */
-_NO_TRACE static inline void nucleus_leave(void)
-{
-	asm volatile ("wrpr %g0, %g0, %tl\n");
-}
-
-extern void cpu_halt(void) __attribute__((noreturn));
-extern void cpu_sleep(void);
-extern void asm_delay_loop(const uint32_t usec);
-
-extern uint64_t read_from_ag_g6(void);
-extern uint64_t read_from_ag_g7(void);
-extern void write_to_ag_g6(uint64_t val);
-extern void write_to_ag_g7(uint64_t val);
-extern void write_to_ig_g6(uint64_t val);
-
-extern void switch_to_userspace(uint64_t pc, uint64_t sp, uint64_t uarg);
-
-/** Enables interrupts and blocks until an interrupt arrives,
- * atomically if possible on target architecture.
- * Disables interrupts again before returning to caller.
- */
-_NO_TRACE static inline void cpu_interruptible_sleep(void)
-{
-	// FIXME: do this atomically
-	interrupts_enable();
-	cpu_sleep();
-	interrupts_disable();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/barrier.h
===================================================================
--- kernel/arch/sparc64/include/arch/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_BARRIER_H_
-#define KERN_sparc64_BARRIER_H_
-
-#include <trace.h>
-
-/** Flush Instruction pipeline. */
-_NO_TRACE static inline void flush_pipeline(void)
-{
-	unsigned long pc;
-
-	/*
-	 * The FLUSH instruction takes address parameter.
-	 * As such, it may trap if the address is not found in DTLB.
-	 *
-	 * The entire kernel text is mapped by a locked ITLB and
-	 * DTLB entries. Therefore, when this function is called,
-	 * the %pc register will always be in the range mapped by
-	 * DTLB.
-	 *
-	 */
-
-	asm volatile (
-	    "rd %%pc, %[pc]\n"
-	    "flush %[pc]\n"
-	    : [pc] "=&r" (pc)
-	);
-}
-
-/** Memory Barrier instruction. */
-_NO_TRACE static inline void membar(void)
-{
-	asm volatile (
-	    "membar #Sync\n"
-	);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/boot/boot.h
===================================================================
--- kernel/arch/sparc64/include/arch/boot/boot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_BOOT_H_
-#define KERN_sparc64_BOOT_H_
-
-#define VMA  0x400000
-#define LMA  VMA
-
-#ifndef __ASSEMBLER__
-#ifndef __LINKER__
-
-#include <config.h>
-#include <typedefs.h>
-#include <genarch/ofw/ofw_tree.h>
-
-#define TASKMAP_MAX_RECORDS  32
-#define MEMMAP_MAX_RECORDS   32
-
-#define BOOTINFO_TASK_NAME_BUFLEN  32
-
-typedef struct {
-	void *addr;
-	size_t size;
-	char name[BOOTINFO_TASK_NAME_BUFLEN];
-} utask_t;
-
-typedef struct {
-	size_t cnt;
-	utask_t tasks[TASKMAP_MAX_RECORDS];
-} taskmap_t;
-
-typedef struct {
-	void *start;
-	size_t size;
-} memzone_t;
-
-typedef struct {
-	uint64_t total;
-	size_t cnt;
-	memzone_t zones[MEMMAP_MAX_RECORDS];
-} memmap_t;
-
-/** Bootinfo structure.
- *
- * Must be in sync with bootinfo structure used by the boot loader.
- *
- */
-typedef struct {
-	uintptr_t physmem_start;
-	taskmap_t taskmap;
-	memmap_t memmap;
-	ballocs_t ballocs;
-	ofw_tree_node_t *ofw_root;
-} bootinfo_t;
-
-extern memmap_t memmap;
-
-#endif
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/console.h
===================================================================
--- kernel/arch/sparc64/include/arch/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CONSOLE_H_
-#define KERN_sparc64_CONSOLE_H_
-
-extern void kkbdpoll(void *arg);
-extern void standalone_sparc64_console_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/context.h
===================================================================
--- kernel/arch/sparc64/include/arch/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CONTEXT_H_
-#define KERN_sparc64_CONTEXT_H_
-
-#include <arch/stack.h>
-#include <arch/context_struct.h>
-#include <typedefs.h>
-#include <align.h>
-
-#define SP_DELTA  (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
-
-#define context_set(c, _pc, stack, size) \
-	do { \
-		(c)->pc = ((uintptr_t) _pc) - 8; \
-		(c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \
-		    STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \
-		(c)->fp = -STACK_BIAS; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/context_struct.h
===================================================================
--- kernel/arch/sparc64/include/arch/context_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_CONTEXT_STRUCT_H_
-#define KERN_ARCH_CONTEXT_STRUCT_H_
-
-#define CONTEXT_OFFSET_SP   0x00
-#define CONTEXT_OFFSET_PC   0x08
-#define CONTEXT_OFFSET_I0   0x10
-#define CONTEXT_OFFSET_I1   0x18
-#define CONTEXT_OFFSET_I2   0x20
-#define CONTEXT_OFFSET_I3   0x28
-#define CONTEXT_OFFSET_I4   0x30
-#define CONTEXT_OFFSET_I5   0x38
-#define CONTEXT_OFFSET_FP   0x40
-#define CONTEXT_OFFSET_I7   0x48
-#define CONTEXT_OFFSET_L0   0x50
-#define CONTEXT_OFFSET_L1   0x58
-#define CONTEXT_OFFSET_L2   0x60
-#define CONTEXT_OFFSET_L3   0x68
-#define CONTEXT_OFFSET_L4   0x70
-#define CONTEXT_OFFSET_L5   0x78
-#define CONTEXT_OFFSET_L6   0x80
-#define CONTEXT_OFFSET_L7   0x88
-#define CONTEXT_OFFSET_TP   0x90
-#define CONTEXT_SIZE        0x98
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-typedef struct context {
-	uintptr_t sp;  // %o6
-	uintptr_t pc;  // %o7
-	uint64_t i0;
-	uint64_t i1;
-	uint64_t i2;
-	uint64_t i3;
-	uint64_t i4;
-	uint64_t i5;
-	uintptr_t fp;  // %i6
-	uintptr_t i7;
-	uint64_t l0;
-	uint64_t l1;
-	uint64_t l2;
-	uint64_t l3;
-	uint64_t l4;
-	uint64_t l5;
-	uint64_t l6;
-	uint64_t l7;
-	uint64_t tp;  // %g7
-} context_t;
-
-#endif
-#endif
Index: rnel/arch/sparc64/include/arch/cpu.h
===================================================================
--- kernel/arch/sparc64/include/arch/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CPU_H_
-#define KERN_sparc64_CPU_H_
-
-#define MANUF_FUJITSU		0x04
-#define MANUF_ULTRASPARC	0x17	/**< UltraSPARC I, UltraSPARC II */
-#define MANUF_SUN		0x3e
-
-#define IMPL_ULTRASPARCI	0x10
-#define IMPL_ULTRASPARCII	0x11
-#define IMPL_ULTRASPARCII_I	0x12
-#define IMPL_ULTRASPARCII_E	0x13
-#define IMPL_ULTRASPARCIII	0x14
-#define IMPL_ULTRASPARCIII_PLUS	0x15
-#define IMPL_ULTRASPARCIII_I	0x16
-#define IMPL_ULTRASPARCIV	0x18
-#define IMPL_ULTRASPARCIV_PLUS	0x19
-
-#define IMPL_SPARC64V		0x5
-
-#ifndef __ASSEMBLER__
-
-#include <arch/register.h>
-#include <arch/regdef.h>
-#include <arch/asm.h>
-
-#if defined (SUN4U)
-#include <arch/sun4u/cpu.h>
-#elif defined (SUN4V)
-#include <arch/sun4v/cpu.h>
-#endif
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/cpu_family.h
===================================================================
--- kernel/arch/sparc64/include/arch/cpu_family.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CPU_FAMILY_H_
-#define KERN_sparc64_CPU_FAMILY_H_
-
-#include <arch.h>
-#include <cpu.h>
-#include <arch/register.h>
-#include <arch/asm.h>
-
-/**
- * Find the processor (sub)family.
- *
- * @return 	true iff the CPU belongs to the US family
- */
-static inline bool is_us(void)
-{
-	int impl = ((ver_reg_t) ver_read()).impl;
-	return (impl == IMPL_ULTRASPARCI) || (impl == IMPL_ULTRASPARCII) ||
-	    (impl == IMPL_ULTRASPARCII_I) ||  (impl == IMPL_ULTRASPARCII_E);
-}
-
-/**
- * Find the processor (sub)family.
- *
- * @return 	true iff the CPU belongs to the US-III subfamily
- */
-static inline bool is_us_iii(void)
-{
-	int impl = ((ver_reg_t) ver_read()).impl;
-	return (impl == IMPL_ULTRASPARCIII) ||
-	    (impl == IMPL_ULTRASPARCIII_PLUS) ||
-	    (impl == IMPL_ULTRASPARCIII_I);
-}
-
-/**
- * Find the processor (sub)family.
- *
- * @return 	true iff the CPU belongs to the US-IV subfamily
- */
-static inline bool is_us_iv(void)
-{
-	int impl = ((ver_reg_t) ver_read()).impl;
-	return (impl == IMPL_ULTRASPARCIV) || (impl == IMPL_ULTRASPARCIV_PLUS);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/cpu_node.h
===================================================================
--- kernel/arch/sparc64/include/arch/cpu_node.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CPU_NODE_H_
-#define KERN_sparc64_CPU_NODE_H_
-
-#include <genarch/ofw/ofw_tree.h>
-
-/** Finds the parent node of all the CPU nodes (nodes named "cpu" or "cmp").
- *
- *  Depending on the machine type (and possibly the OFW version), CPUs can be
- *  at "/" or at "/ssm@0,0".
- */
-static inline ofw_tree_node_t *cpus_parent(void)
-{
-	ofw_tree_node_t *parent;
-	parent = ofw_tree_find_child(ofw_tree_lookup("/"), "ssm@0,0");
-	if (parent == NULL)
-		parent = ofw_tree_lookup("/");
-	return parent;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/cycle.h
===================================================================
--- kernel/arch/sparc64/include/arch/cycle.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CYCLE_H_
-#define KERN_sparc64_CYCLE_H_
-
-#include <arch/asm.h>
-#include <trace.h>
-
-_NO_TRACE static inline uint64_t get_cycle(void)
-{
-	return tick_read();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/fb.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/fb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_FB_H_
-#define KERN_sparc64_FB_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/kbd.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/kbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_KBD_H_
-#define KERN_sparc64_KBD_H_
-
-#include <genarch/ofw/ofw_tree.h>
-
-extern void kbd_init(ofw_tree_node_t *node);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/niagara.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/niagara.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_NIAGARA_H
-#define KERN_sparc64_NIAGARA_H
-
-#include <proc/thread.h>
-#include <console/chardev.h>
-
-typedef struct {
-	thread_t *thread;
-	indev_t *srlnin;
-} niagara_instance_t;
-
-char niagara_getc(void);
-void niagara_grab(void);
-void niagara_release(void);
-niagara_instance_t *niagarain_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/niagara_buf.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/niagara_buf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief Niagara input/output buffer shared between kernel and user space
- */
-
-#ifdef KERNEL
-#include <mm/as.h>
-#else
-#include <as.h>
-#endif
-
-#include <stdint.h>
-
-#define OUTPUT_BUFFER_SIZE  ((PAGE_SIZE) - 2 * 8)
-
-typedef struct {
-	uint64_t read_ptr;
-	uint64_t write_ptr;
-	char data[OUTPUT_BUFFER_SIZE];
-} __attribute__((packed)) niagara_output_buffer_t;
-
-#define INPUT_BUFFER_SIZE  ((PAGE_SIZE) - 2 * 8)
-
-typedef struct {
-	uint64_t write_ptr;
-	uint64_t read_ptr;
-	char data[INPUT_BUFFER_SIZE];
-} __attribute__((packed)) niagara_input_buffer_t;
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/pci.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_PCI_H_
-#define KERN_sparc64_PCI_H_
-
-#include <stdint.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-
-typedef enum pci_model pci_model_t;
-typedef struct pci pci_t;
-typedef struct pci_operations pci_operations_t;
-
-enum pci_model {
-	PCI_UNKNOWN,
-	PCI_SABRE,
-	PCI_PSYCHO
-};
-
-struct pci_operations {
-	void (*enable_interrupt)(pci_t *, int);
-	void (*clear_interrupt)(pci_t *, int);
-};
-
-struct pci {
-	pci_model_t model;
-	pci_operations_t *op;
-	volatile uint64_t *reg;		/**< Registers including interrupt registers. */
-};
-
-extern pci_t *pci_init(ofw_tree_node_t *);
-extern void pci_enable_interrupt(pci_t *, int);
-extern void pci_clear_interrupt(void *, int);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/scr.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/scr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_SCR_H_
-#define KERN_sparc64_SCR_H_
-
-#include <genarch/ofw/ofw_tree.h>
-
-typedef enum {
-	SCR_UNKNOWN,
-	SCR_ATYFB,
-	SCR_FFB,
-	SCR_CGSIX,
-	SCR_XVR,
-	SCR_QEMU_VGA
-} scr_type_t;
-
-extern scr_type_t scr_type;
-
-extern void scr_init(ofw_tree_node_t *node);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/tick.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/tick.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TICK_H_
-#define KERN_sparc64_TICK_H_
-
-#include <arch/asm.h>
-#include <arch/interrupt.h>
-
-/* mask of the "counter" field of the Tick register */
-#define TICK_COUNTER_MASK  (~(1l << 63))
-
-extern void tick_init(void);
-extern void tick_interrupt(unsigned int, istate_t *);
-
-/**
- * Reads the Tick register counter.
- */
-static inline uint64_t tick_counter_read(void)
-{
-	return TICK_COUNTER_MASK & tick_read();
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/drivers/tty.h
===================================================================
--- kernel/arch/sparc64/include/arch/drivers/tty.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TTY_H_
-#define KERN_sparc64_TTY_H_
-
-#include <genarch/ofw/ofw_tree.h>
-
-extern void tty_init(ofw_tree_node_t *node);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/faddr.h
===================================================================
--- kernel/arch/sparc64/include/arch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_FADDR_H_
-#define KERN_sparc64_FADDR_H_
-
-#include <typedefs.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/fpu_context.h
===================================================================
--- kernel/arch/sparc64/include/arch/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_FPU_CONTEXT_H_
-#define KERN_sparc64_FPU_CONTEXT_H_
-
-#include <stdint.h>
-
-typedef struct {
-	_Alignas(8) uint64_t d[32];
-	uint64_t fsr;
-} fpu_context_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/arch/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt sparc64
- * @ingroup interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_INTERRUPT_H_
-#define KERN_sparc64_INTERRUPT_H_
-
-#include <arch/istate.h>
-
-#define IVT_ITEMS  512
-#define IVT_FIRST  0
-
-/* This needs to be defined for inter-architecture API portability. */
-#define VECTOR_TLB_SHOOTDOWN_IPI  0
-
-enum {
-	IPI_TLB_SHOOTDOWN = VECTOR_TLB_SHOOTDOWN_IPI,
-};
-
-extern void exc_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/istate.h
===================================================================
--- kernel/arch/sparc64/include/arch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt sparc64
- * @ingroup interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_ISTATE_H_
-#define KERN_sparc64_ISTATE_H_
-
-#include <trace.h>
-
-#ifdef KERNEL
-
-#include <arch/istate_struct.h>
-#include <arch/regdef.h>
-
-#else /* KERNEL */
-
-#include <libarch/istate_struct.h>
-#include <libarch/regdef.h>
-
-#endif /* KERNEL */
-
-_NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
-    uintptr_t retaddr)
-{
-	istate->tpc = retaddr;
-}
-
-_NO_TRACE static inline int istate_from_uspace(istate_t *istate)
-{
-	return !(istate->tstate & TSTATE_PRIV_BIT);
-}
-
-_NO_TRACE static inline uintptr_t istate_get_pc(istate_t *istate)
-{
-	return istate->tpc;
-}
-
-_NO_TRACE static inline uintptr_t istate_get_fp(istate_t *istate)
-{
-	/* TODO */
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/istate_struct.h
===================================================================
--- kernel/arch/sparc64/include/arch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_ARCH_ISTATE_STRUCT_H_
-#define KERN_ARCH_ISTATE_STRUCT_H_
-
-#define ISTATE_OFFSET_L0              0x00
-#define ISTATE_OFFSET_L1              0x08
-#define ISTATE_OFFSET_L2              0x10
-#define ISTATE_OFFSET_L3              0x18
-#define ISTATE_OFFSET_L4              0x20
-#define ISTATE_OFFSET_L5              0x28
-#define ISTATE_OFFSET_L6              0x30
-#define ISTATE_OFFSET_L7              0x38
-#define ISTATE_OFFSET_I0              0x40
-#define ISTATE_OFFSET_I1              0x48
-#define ISTATE_OFFSET_I2              0x50
-#define ISTATE_OFFSET_I3              0x58
-#define ISTATE_OFFSET_I4              0x60
-#define ISTATE_OFFSET_I5              0x68
-#define ISTATE_OFFSET_I6              0x70
-#define ISTATE_OFFSET_I7              0x78
-#define ISTATE_OFFSET_UNDEF_ARG       0x80
-#define ISTATE_OFFSET_ARG6            0xb0
-#define ISTATE_OFFSET_TNPC            0xb8
-#define ISTATE_OFFSET_TPC             0xc0
-#define ISTATE_OFFSET_TSTATE          0xc8
-#define ISTATE_OFFSET_Y               0xd0
-#define ISTATE_OFFSET_O0              0xd8
-#define ISTATE_OFFSET_O1              0xe0
-#define ISTATE_OFFSET_O2              0xe8
-#define ISTATE_OFFSET_O3              0xf0
-#define ISTATE_OFFSET_O4              0xf8
-#define ISTATE_OFFSET_O5              0x100
-#define ISTATE_OFFSET_O6              0x108
-#define ISTATE_OFFSET_O7              0x110
-#define ISTATE_OFFSET_TLB_TAG_ACCESS  0x118
-#define ISTATE_SIZE                   0x120
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-#ifdef KERNEL
-#include <typedefs.h>
-#else
-#include <stddef.h>
-#endif
-
-typedef struct istate {
-	/*
-	 * Window save area for locals and inputs. Required by ABI.
-	 * Before using these, make sure that the corresponding register
-	 * window has been spilled into memory, otherwise l0-l7 and
-	 * i0-i7 will have undefined values.
-	 */
-	uint64_t l0;
-	uint64_t l1;
-	uint64_t l2;
-	uint64_t l3;
-	uint64_t l4;
-	uint64_t l5;
-	uint64_t l6;
-	uint64_t l7;
-	uint64_t i0;
-	uint64_t i1;
-	uint64_t i2;
-	uint64_t i3;
-	uint64_t i4;
-	uint64_t i5;
-	uint64_t i6;
-	uint64_t i7;
-
-	/*
-	 * Six mandatory argument slots, required by the ABI, plus an
-	 * optional argument slot for the 7th argument used by our
-	 * syscalls. Since the preemptible handler is always passing
-	 * integral arguments, undef_arg[0] - undef_arg[5] are always
-	 * undefined.
-	 */
-	uint64_t undef_arg[6];
-	uint64_t arg6;
-
-	/*
-	 * From this point onwards, the istate layout is not dicated by
-	 * the ABI. The only requirement is the stack alignment.
-	 */
-	uint64_t tnpc;
-	uint64_t tpc;
-	uint64_t tstate;
-	uint64_t y;
-
-	/*
-	 * At the moment, these are defined only when needed by the
-	 * preemptible handler, so consider them undefined for now.
-	 */
-	uint64_t o0;
-	uint64_t o1;
-	uint64_t o2;
-	uint64_t o3;
-	uint64_t o4;
-	uint64_t o5;
-	uint64_t o6;
-	uint64_t o7;
-
-	/*
-	 * I/DTLB Tag Access register or zero for non-MMU traps.
-	 */
-	uint64_t tlb_tag_access;
-} istate_t;
-
-#endif
-#endif
Index: rnel/arch/sparc64/include/arch/mm/as.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_AS_H_
-#define KERN_sparc64_AS_H_
-
-#if defined (SUN4U)
-
-#include <arch/mm/sun4u/as.h>
-
-#elif defined (SUN4V)
-
-#include <arch/mm/sun4v/as.h>
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/asid.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_ASID_H_
-#define KERN_sparc64_ASID_H_
-
-#include <stdint.h>
-
-/*
- * On SPARC, Context means the same thing as ASID trough out the kernel.
- */
-typedef uint16_t asid_t;
-
-#define ASID_MAX_ARCH		8191	/* 2^13 - 1 */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/cache_spec.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/cache_spec.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_CACHE_SPEC_H_
-#define KERN_sparc64_CACHE_SPEC_H_
-
-/*
- * The following macros are valid for the following processors:
- *
- *  UltraSPARC, UltraSPARC II, UltraSPARC IIi, UltraSPARC III,
- *  UltraSPARC III+, UltraSPARC IV, UltraSPARC IV+
- *
- * Should we support other UltraSPARC processors, we need to make sure that
- * the macros are defined correctly for them.
- */
-
-#if defined (US)
-#define DCACHE_SIZE  (16 * 1024)
-#elif defined (US3)
-#define DCACHE_SIZE  (64 * 1024)
-#endif
-
-#define DCACHE_LINE_SIZE  32
-#define DCACHE_TAG_SHIFT  2
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/frame.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_FRAME_H_
-#define KERN_sparc64_FRAME_H_
-
-#if defined (SUN4U)
-
-#include <arch/mm/sun4u/frame.h>
-
-#elif defined (SUN4V)
-
-#include <arch/mm/sun4v/frame.h>
-
-#endif
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-extern uintptr_t end_of_identity;
-
-extern void frame_low_arch_init(void);
-extern void frame_high_arch_init(void);
-#define physmem_print()
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/km.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_KM_H_
-#define KERN_sparc64_KM_H_
-
-#if defined (SUN4U)
-#include <arch/mm/sun4u/km.h>
-#elif defined (SUN4V)
-#include <arch/mm/sun4v/km.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_MMU_H_
-#define KERN_sparc64_MMU_H_
-
-#if defined (SUN4U)
-#include <arch/mm/sun4u/mmu.h>
-#elif defined (SUN4V)
-#include <arch/mm/sun4v/mmu.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/page.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_PAGE_H_
-#define KERN_sparc64_PAGE_H_
-
-#include <arch/mm/frame.h>
-
-/*
- * On the TLB and TSB level, we still use 8K pages, which are supported by the
- * MMU.
- */
-#define MMU_PAGE_WIDTH	MMU_FRAME_WIDTH
-#define MMU_PAGE_SIZE	MMU_FRAME_SIZE
-
-/*
- * On the page table level, we use 16K pages. 16K pages are not supported by
- * the MMU but we emulate them with pairs of 8K pages.
- */
-#define PAGE_WIDTH	FRAME_WIDTH
-#define PAGE_SIZE	FRAME_SIZE
-
-#define MMU_PAGES_PER_PAGE	(1 << (PAGE_WIDTH - MMU_PAGE_WIDTH))
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-
-extern uintptr_t physmem_base;
-
-#define KA2PA(x)	(((uintptr_t) (x)) + physmem_base)
-#define PA2KA(x)	(((uintptr_t) (x)) - physmem_base)
-
-typedef union {
-	uintptr_t address;
-	struct {
-		uint64_t vpn : 51;		/**< Virtual Page Number. */
-		unsigned offset : 13;		/**< Offset. */
-	} __attribute__((packed));
-} page_address_t;
-
-extern void page_arch_init(void);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/pagesize.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/pagesize.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_PAGESIZE_H
-#define KERN_sparc64_PAGESIZE_H
-
-/** Page sizes. */
-#define PAGESIZE_8K	0
-#define PAGESIZE_64K	1
-#define PAGESIZE_512K	2
-#define PAGESIZE_4M	3
-
-#endif
Index: rnel/arch/sparc64/include/arch/mm/sun4u/as.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_AS_H_
-#define KERN_sparc64_sun4u_AS_H_
-
-#include <arch/mm/tte.h>
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  1
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xffffffffffffffff)
-
-#ifdef CONFIG_TSB
-
-/** TSB Tag Target register. */
-typedef union tsb_tag_target {
-	uint64_t value;
-	struct {
-		unsigned invalid : 1;	/**< Invalidated by software. */
-		unsigned : 2;
-		unsigned context : 13;	/**< Software ASID. */
-		unsigned : 6;
-		uint64_t va_tag : 42;	/**< Virtual address bits <63:22>. */
-	} __attribute__((packed));
-} tsb_tag_target_t;
-
-/** TSB entry. */
-typedef struct tsb_entry {
-	tsb_tag_target_t tag;
-	tte_data_t data;
-} __attribute__((packed)) tsb_entry_t;
-
-typedef struct {
-	tsb_entry_t *itsb;
-	tsb_entry_t *dtsb;
-} as_arch_t;
-
-#else
-
-typedef struct {
-} as_arch_t;
-
-#endif /* CONFIG_TSB */
-
-#include <genarch/mm/as_ht.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#define as_invalidate_translation_cache(as, page, cnt) \
-	tsb_invalidate((as), (page), (cnt))
-#else
-#define as_invalidate_translation_cache(as, page, cnt)
-#endif
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/frame.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_SUN4U_FRAME_H_
-#define KERN_sparc64_SUN4U_FRAME_H_
-
-/*
- * Page size supported by the MMU.
- * For 8K there is the nasty illegal virtual aliasing problem.
- * Therefore, the kernel uses 8K only internally on the TLB and TSB levels.
- */
-#define MMU_FRAME_WIDTH  13  /* 8K */
-#define MMU_FRAME_SIZE   (1 << MMU_FRAME_WIDTH)
-
-/*
- * Page size exported to the generic memory management subsystems.
- * This page size is not directly supported by the MMU, but we can emulate
- * each 16K page with a pair of adjacent 8K pages.
- */
-#define FRAME_WIDTH  14  /* 16K */
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-
-union frame_address {
-	uintptr_t address;
-	struct {
-#if defined (US)
-		unsigned : 23;
-		uint64_t pfn : 28;		/**< Physical Frame Number. */
-#elif defined (US3)
-		unsigned : 21;
-		uint64_t pfn : 30;		/**< Physical Frame Number. */
-#endif
-		unsigned offset : 13;		/**< Offset. */
-	} __attribute__((packed));
-};
-
-typedef union frame_address frame_address_t;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/km.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_KM_H_
-#define KERN_sparc64_sun4u_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-/*
- * Be conservative and assume the 44-bit virtual address width as found
- * on the UltraSPARC CPU, even when running on a newer CPU, such as
- * UltraSPARC III, which has the full 64-bit virtual address width.
- *
- * Do not use the 4 GiB area on either side of the VA hole to meet the
- * limitations of the UltraSPARC CPU.
- */
-
-#define KM_SPARC64_US_IDENTITY_START		UINT64_C(0x0000000000000000)
-#define KM_SPARC64_US_IDENTITY_SIZE		UINT64_C(0x000007ff00000000)
-
-#define KM_SPARC64_US_NON_IDENTITY_START	UINT64_C(0xfffff80100000000)
-#define KM_SPARC64_US_NON_IDENTITY_SIZE		UINT64_C(0x000007ff00000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_MMU_H_
-#define KERN_sparc64_sun4u_MMU_H_
-
-#if defined(US)
-/* LSU Control Register ASI. */
-#define ASI_LSU_CONTROL_REG		0x45	/**< Load/Store Unit Control Register. */
-#endif
-
-/* I-MMU ASIs. */
-#define ASI_IMMU			0x50
-#define ASI_IMMU_TSB_8KB_PTR_REG	0x51
-#define ASI_IMMU_TSB_64KB_PTR_REG	0x52
-#define ASI_ITLB_DATA_IN_REG		0x54
-#define ASI_ITLB_DATA_ACCESS_REG	0x55
-#define ASI_ITLB_TAG_READ_REG		0x56
-#define ASI_IMMU_DEMAP			0x57
-
-/* Virtual Addresses within ASI_IMMU. */
-#define VA_IMMU_TSB_TAG_TARGET		0x0	/**< IMMU TSB tag target register. */
-#define VA_IMMU_SFSR			0x18	/**< IMMU sync fault status register. */
-#define VA_IMMU_TSB_BASE		0x28	/**< IMMU TSB base register. */
-#define VA_IMMU_TAG_ACCESS		0x30	/**< IMMU TLB tag access register. */
-#if defined (US3)
-#define VA_IMMU_PRIMARY_EXTENSION	0x48	/**< IMMU TSB primary extension register */
-#define VA_IMMU_NUCLEUS_EXTENSION	0x58	/**< IMMU TSB nucleus extension register */
-#endif
-
-/* D-MMU ASIs. */
-#define ASI_DMMU			0x58
-#define ASI_DMMU_TSB_8KB_PTR_REG	0x59
-#define ASI_DMMU_TSB_64KB_PTR_REG	0x5a
-#define ASI_DMMU_TSB_DIRECT_PTR_REG	0x5b
-#define ASI_DTLB_DATA_IN_REG		0x5c
-#define ASI_DTLB_DATA_ACCESS_REG	0x5d
-#define ASI_DTLB_TAG_READ_REG		0x5e
-#define ASI_DMMU_DEMAP			0x5f
-
-/* Virtual Addresses within ASI_DMMU. */
-#define VA_DMMU_TSB_TAG_TARGET		0x0	/**< DMMU TSB tag target register. */
-#define VA_PRIMARY_CONTEXT_REG		0x8	/**< DMMU primary context register. */
-#define VA_SECONDARY_CONTEXT_REG	0x10	/**< DMMU secondary context register. */
-#define VA_DMMU_SFSR			0x18	/**< DMMU sync fault status register. */
-#define VA_DMMU_SFAR			0x20	/**< DMMU sync fault address register. */
-#define VA_DMMU_TSB_BASE		0x28	/**< DMMU TSB base register. */
-#define VA_DMMU_TAG_ACCESS		0x30	/**< DMMU TLB tag access register. */
-#define VA_DMMU_VA_WATCHPOINT_REG	0x38	/**< DMMU VA data watchpoint register. */
-#define VA_DMMU_PA_WATCHPOINT_REG	0x40	/**< DMMU PA data watchpoint register. */
-#if defined (US3)
-#define VA_DMMU_PRIMARY_EXTENSION	0x48	/**< DMMU TSB primary extension register */
-#define VA_DMMU_SECONDARY_EXTENSION	0x50	/**< DMMU TSB secondary extension register */
-#define VA_DMMU_NUCLEUS_EXTENSION	0x58	/**< DMMU TSB nucleus extension register */
-#endif
-
-#ifndef __ASSEMBLER__
-
-#include <arch/asm.h>
-#include <barrier.h>
-#include <stdint.h>
-
-#if defined(US)
-/** LSU Control Register. */
-typedef union {
-	uint64_t value;
-	struct {
-		unsigned : 23;
-		unsigned pm : 8;
-		unsigned vm : 8;
-		unsigned pr : 1;
-		unsigned pw : 1;
-		unsigned vr : 1;
-		unsigned vw : 1;
-		unsigned : 1;
-		unsigned fm : 16;
-		unsigned dm : 1;	/**< D-MMU enable. */
-		unsigned im : 1;	/**< I-MMU enable. */
-		unsigned dc : 1;	/**< D-Cache enable. */
-		unsigned ic : 1;	/**< I-Cache enable. */
-
-	} __attribute__((packed));
-} lsu_cr_reg_t;
-#endif /* US */
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/tlb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,691 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TLB_sun4u_H_
-#define KERN_sparc64_TLB_sun4u_H_
-
-#if defined (US)
-#define ITLB_ENTRY_COUNT		64
-#define DTLB_ENTRY_COUNT		64
-#define DTLB_MAX_LOCKED_ENTRIES		DTLB_ENTRY_COUNT
-#endif
-
-/** TLB_DSMALL is the only of the three DMMUs that can hold locked entries. */
-#if defined (US3)
-#define DTLB_MAX_LOCKED_ENTRIES		16
-#endif
-
-#define MEM_CONTEXT_KERNEL		0
-#define MEM_CONTEXT_TEMP		1
-
-/** Page sizes. */
-#define PAGESIZE_8K	0
-#define PAGESIZE_64K	1
-#define PAGESIZE_512K	2
-#define PAGESIZE_4M	3
-
-/** Bit width of the TLB-locked portion of kernel address space. */
-#define KERNEL_PAGE_WIDTH       22	/* 4M */
-
-/* TLB Demap Operation types. */
-#define TLB_DEMAP_PAGE		0
-#define TLB_DEMAP_CONTEXT	1
-#if defined (US3)
-#define TLB_DEMAP_ALL		2
-#endif
-
-#define TLB_DEMAP_TYPE_SHIFT	6
-
-/* TLB Demap Operation Context register encodings. */
-#define TLB_DEMAP_PRIMARY	0
-#define TLB_DEMAP_SECONDARY	1
-#define TLB_DEMAP_NUCLEUS	2
-
-/* There are more TLBs in one MMU in US3, their codes are defined here. */
-#if defined (US3)
-/* D-MMU: one small (16-entry) TLB and two big (512-entry) TLBs */
-#define TLB_DSMALL	0
-#define TLB_DBIG_0	2
-#define TLB_DBIG_1	3
-
-/* I-MMU: one small (16-entry) TLB and one big TLB */
-#define TLB_ISMALL	0
-#define TLB_IBIG	2
-#endif
-
-#define TLB_DEMAP_CONTEXT_SHIFT	4
-
-/* TLB Tag Access shifts */
-#define TLB_TAG_ACCESS_CONTEXT_SHIFT	0
-#define TLB_TAG_ACCESS_CONTEXT_MASK	((1 << 13) - 1)
-#define TLB_TAG_ACCESS_VPN_SHIFT	13
-
-#ifndef __ASSEMBLER__
-
-#include <arch/mm/tte.h>
-#include <arch/mm/mmu.h>
-#include <arch/mm/page.h>
-#include <arch/asm.h>
-#include <arch/barrier.h>
-#include <barrier.h>
-#include <typedefs.h>
-#include <trace.h>
-#include <arch/register.h>
-#include <arch/cpu.h>
-
-union tlb_context_reg {
-	uint64_t v;
-	struct {
-		unsigned long : 51;
-		unsigned context : 13;		/**< Context/ASID. */
-	} __attribute__((packed));
-};
-typedef union tlb_context_reg tlb_context_reg_t;
-
-/** I-/D-TLB Data In/Access Register type. */
-typedef tte_data_t tlb_data_t;
-
-/** I-/D-TLB Data Access Address in Alternate Space. */
-
-#if defined (US)
-
-union tlb_data_access_addr {
-	uint64_t value;
-	struct {
-		uint64_t : 55;
-		unsigned tlb_entry : 6;
-		unsigned : 3;
-	} __attribute__((packed));
-};
-typedef union tlb_data_access_addr dtlb_data_access_addr_t;
-typedef union tlb_data_access_addr dtlb_tag_read_addr_t;
-typedef union tlb_data_access_addr itlb_data_access_addr_t;
-typedef union tlb_data_access_addr itlb_tag_read_addr_t;
-
-#elif defined (US3)
-
-/*
- * In US3, I-MMU and D-MMU have different formats of the data
- * access register virtual address. In the corresponding
- * structures the member variable for the entry number is
- * called "local_tlb_entry" - it contrasts with the "tlb_entry"
- * for the US data access register VA structure. The rationale
- * behind this is to prevent careless mistakes in the code
- * caused by setting only the entry number and not the TLB
- * number in the US3 code (when taking the code from US).
- */
-
-union dtlb_data_access_addr {
-	uint64_t value;
-	struct {
-		uint64_t : 45;
-		unsigned : 1;
-		unsigned tlb_number : 2;
-		unsigned : 4;
-		unsigned local_tlb_entry : 9;
-		unsigned : 3;
-	} __attribute__((packed));
-};
-typedef union dtlb_data_access_addr dtlb_data_access_addr_t;
-typedef union dtlb_data_access_addr dtlb_tag_read_addr_t;
-
-union itlb_data_access_addr {
-	uint64_t value;
-	struct {
-		uint64_t : 45;
-		unsigned : 1;
-		unsigned tlb_number : 2;
-		unsigned : 6;
-		unsigned local_tlb_entry : 7;
-		unsigned : 3;
-	} __attribute__((packed));
-};
-typedef union itlb_data_access_addr itlb_data_access_addr_t;
-typedef union itlb_data_access_addr itlb_tag_read_addr_t;
-
-#endif
-
-/** I-/D-TLB Tag Read Register. */
-union tlb_tag_read_reg {
-	uint64_t value;
-	struct {
-		uint64_t vpn : 51;	/**< Virtual Address bits 63:13. */
-		unsigned context : 13;	/**< Context identifier. */
-	} __attribute__((packed));
-};
-typedef union tlb_tag_read_reg tlb_tag_read_reg_t;
-typedef union tlb_tag_read_reg tlb_tag_access_reg_t;
-
-/** TLB Demap Operation Address. */
-union tlb_demap_addr {
-	uint64_t value;
-	struct {
-		uint64_t vpn : 51;	/**< Virtual Address bits 63:13. */
-#if defined (US)
-		unsigned : 6;		/**< Ignored. */
-		unsigned type : 1;	/**< The type of demap operation. */
-#elif defined (US3)
-		unsigned : 5;		/**< Ignored. */
-		unsigned type : 2;	/**< The type of demap operation. */
-#endif
-		unsigned context : 2;	/**< Context register selection. */
-		unsigned : 4;		/**< Zero. */
-	} __attribute__((packed));
-};
-typedef union tlb_demap_addr tlb_demap_addr_t;
-
-/** TLB Synchronous Fault Status Register. */
-union tlb_sfsr_reg {
-	uint64_t value;
-	struct {
-#if defined (US)
-		unsigned long : 40;	/**< Implementation dependent. */
-		unsigned asi : 8;	/**< ASI. */
-		unsigned : 2;
-		unsigned ft : 7;	/**< Fault type. */
-#elif defined (US3)
-		unsigned long : 39;	/**< Implementation dependent. */
-		unsigned nf : 1;	/**< Non-faulting load. */
-		unsigned asi : 8;	/**< ASI. */
-		unsigned tm : 1;	/**< I-TLB miss. */
-		unsigned : 3;		/**< Reserved. */
-		unsigned ft : 5;	/**< Fault type. */
-#endif
-		unsigned e : 1;		/**< Side-effect bit. */
-		unsigned ct : 2;	/**< Context Register selection. */
-		unsigned pr : 1;	/**< Privilege bit. */
-		unsigned w : 1;		/**< Write bit. */
-		unsigned ow : 1;	/**< Overwrite bit. */
-		unsigned fv : 1;	/**< Fault Valid bit. */
-	} __attribute__((packed));
-};
-typedef union tlb_sfsr_reg tlb_sfsr_reg_t;
-
-#if defined (US3)
-
-/*
- * Functions for determining the number of entries in TLBs. They either return
- * a constant value or a value based on the CPU autodetection.
- */
-
-/**
- * Determine the number of entries in the DMMU's small TLB.
- */
-_NO_TRACE static inline uint16_t tlb_dsmall_size(void)
-{
-	return 16;
-}
-
-/**
- * Determine the number of entries in each DMMU's big TLB.
- */
-_NO_TRACE static inline uint16_t tlb_dbig_size(void)
-{
-	return 512;
-}
-
-/**
- * Determine the number of entries in the IMMU's small TLB.
- */
-_NO_TRACE static inline uint16_t tlb_ismall_size(void)
-{
-	return 16;
-}
-
-/**
- * Determine the number of entries in the IMMU's big TLB.
- */
-_NO_TRACE static inline uint16_t tlb_ibig_size(void)
-{
-	if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS)
-		return 512;
-	else
-		return 128;
-}
-
-#endif
-
-/** Read MMU Primary Context Register.
- *
- * @return		Current value of Primary Context Register.
- */
-_NO_TRACE static inline uint64_t mmu_primary_context_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG);
-}
-
-/** Write MMU Primary Context Register.
- *
- * @param v		New value of Primary Context Register.
- */
-_NO_TRACE static inline void mmu_primary_context_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v);
-	flush_pipeline();
-}
-
-/** Read MMU Secondary Context Register.
- *
- * @return		Current value of Secondary Context Register.
- */
-_NO_TRACE static inline uint64_t mmu_secondary_context_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG);
-}
-
-/** Write MMU Primary Context Register.
- *
- * @param v		New value of Primary Context Register.
- */
-_NO_TRACE static inline void mmu_secondary_context_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_SECONDARY_CONTEXT_REG, v);
-	flush_pipeline();
-}
-
-#if defined (US)
-
-/** Read IMMU TLB Data Access Register.
- *
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified IMMU TLB Data Access
- * 			Register.
- */
-_NO_TRACE static inline uint64_t itlb_data_access_read(size_t entry)
-{
-	itlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_entry = entry;
-	return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
-}
-
-/** Write IMMU TLB Data Access Register.
- *
- * @param entry		TLB Entry index.
- * @param value		Value to be written.
- */
-_NO_TRACE static inline void itlb_data_access_write(size_t entry, uint64_t value)
-{
-	itlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_entry = entry;
-	asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
-	flush_pipeline();
-}
-
-/** Read DMMU TLB Data Access Register.
- *
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified DMMU TLB Data Access
- * 			Register.
- */
-_NO_TRACE static inline uint64_t dtlb_data_access_read(size_t entry)
-{
-	dtlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_entry = entry;
-	return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
-}
-
-/** Write DMMU TLB Data Access Register.
- *
- * @param entry		TLB Entry index.
- * @param value		Value to be written.
- */
-_NO_TRACE static inline void dtlb_data_access_write(size_t entry, uint64_t value)
-{
-	dtlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_entry = entry;
-	asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
-	membar();
-}
-
-/** Read IMMU TLB Tag Read Register.
- *
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified IMMU TLB Tag Read Register.
- */
-_NO_TRACE static inline uint64_t itlb_tag_read_read(size_t entry)
-{
-	itlb_tag_read_addr_t tag;
-
-	tag.value = 0;
-	tag.tlb_entry =	entry;
-	return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
-}
-
-/** Read DMMU TLB Tag Read Register.
- *
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified DMMU TLB Tag Read Register.
- */
-_NO_TRACE static inline uint64_t dtlb_tag_read_read(size_t entry)
-{
-	dtlb_tag_read_addr_t tag;
-
-	tag.value = 0;
-	tag.tlb_entry =	entry;
-	return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
-}
-
-#elif defined (US3)
-
-/** Read IMMU TLB Data Access Register.
- *
- * @param tlb		TLB number (one of TLB_ISMALL or TLB_IBIG)
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified IMMU TLB Data Access
- * 			Register.
- */
-_NO_TRACE static inline uint64_t itlb_data_access_read(int tlb, size_t entry)
-{
-	itlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_number = tlb;
-	reg.local_tlb_entry = entry;
-	return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
-}
-
-/** Write IMMU TLB Data Access Register.
- * @param tlb		TLB number (one of TLB_ISMALL or TLB_IBIG)
- * @param entry		TLB Entry index.
- * @param value		Value to be written.
- */
-_NO_TRACE static inline void itlb_data_access_write(int tlb, size_t entry,
-    uint64_t value)
-{
-	itlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_number = tlb;
-	reg.local_tlb_entry = entry;
-	asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
-	flush_pipeline();
-}
-
-/** Read DMMU TLB Data Access Register.
- *
- * @param tlb		TLB number (one of TLB_DSMALL, TLB_DBIG, TLB_DBIG)
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified DMMU TLB Data Access
- * 			Register.
- */
-_NO_TRACE static inline uint64_t dtlb_data_access_read(int tlb, size_t entry)
-{
-	dtlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_number = tlb;
-	reg.local_tlb_entry = entry;
-	return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
-}
-
-/** Write DMMU TLB Data Access Register.
- *
- * @param tlb		TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1)
- * @param entry		TLB Entry index.
- * @param value		Value to be written.
- */
-_NO_TRACE static inline void dtlb_data_access_write(int tlb, size_t entry,
-    uint64_t value)
-{
-	dtlb_data_access_addr_t reg;
-
-	reg.value = 0;
-	reg.tlb_number = tlb;
-	reg.local_tlb_entry = entry;
-	asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
-	membar();
-}
-
-/** Read IMMU TLB Tag Read Register.
- *
- * @param tlb		TLB number (one of TLB_ISMALL or TLB_IBIG)
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified IMMU TLB Tag Read Register.
- */
-_NO_TRACE static inline uint64_t itlb_tag_read_read(int tlb, size_t entry)
-{
-	itlb_tag_read_addr_t tag;
-
-	tag.value = 0;
-	tag.tlb_number = tlb;
-	tag.local_tlb_entry = entry;
-	return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
-}
-
-/** Read DMMU TLB Tag Read Register.
- *
- * @param tlb		TLB number (one of TLB_DSMALL, TLB_DBIG_0, TLB_DBIG_1)
- * @param entry		TLB Entry index.
- *
- * @return		Current value of specified DMMU TLB Tag Read Register.
- */
-_NO_TRACE static inline uint64_t dtlb_tag_read_read(int tlb, size_t entry)
-{
-	dtlb_tag_read_addr_t tag;
-
-	tag.value = 0;
-	tag.tlb_number = tlb;
-	tag.local_tlb_entry = entry;
-	return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
-}
-
-#endif
-
-/** Write IMMU TLB Tag Access Register.
- *
- * @param v		Value to be written.
- */
-_NO_TRACE static inline void itlb_tag_access_write(uint64_t v)
-{
-	asi_u64_write(ASI_IMMU, VA_IMMU_TAG_ACCESS, v);
-	flush_pipeline();
-}
-
-/** Read IMMU TLB Tag Access Register.
- *
- * @return		Current value of IMMU TLB Tag Access Register.
- */
-_NO_TRACE static inline uint64_t itlb_tag_access_read(void)
-{
-	return asi_u64_read(ASI_IMMU, VA_IMMU_TAG_ACCESS);
-}
-
-/** Write DMMU TLB Tag Access Register.
- *
- * @param v		Value to be written.
- */
-_NO_TRACE static inline void dtlb_tag_access_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_TAG_ACCESS, v);
-	membar();
-}
-
-/** Read DMMU TLB Tag Access Register.
- *
- * @return 		Current value of DMMU TLB Tag Access Register.
- */
-_NO_TRACE static inline uint64_t dtlb_tag_access_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_DMMU_TAG_ACCESS);
-}
-
-/** Write IMMU TLB Data in Register.
- *
- * @param v		Value to be written.
- */
-_NO_TRACE static inline void itlb_data_in_write(uint64_t v)
-{
-	asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v);
-	flush_pipeline();
-}
-
-/** Write DMMU TLB Data in Register.
- *
- * @param v		Value to be written.
- */
-_NO_TRACE static inline void dtlb_data_in_write(uint64_t v)
-{
-	asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v);
-	membar();
-}
-
-/** Read ITLB Synchronous Fault Status Register.
- *
- * @return		Current content of I-SFSR register.
- */
-_NO_TRACE static inline uint64_t itlb_sfsr_read(void)
-{
-	return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR);
-}
-
-/** Write ITLB Synchronous Fault Status Register.
- *
- * @param v		New value of I-SFSR register.
- */
-_NO_TRACE static inline void itlb_sfsr_write(uint64_t v)
-{
-	asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v);
-	flush_pipeline();
-}
-
-/** Read DTLB Synchronous Fault Status Register.
- *
- * @return		Current content of D-SFSR register.
- */
-_NO_TRACE static inline uint64_t dtlb_sfsr_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR);
-}
-
-/** Write DTLB Synchronous Fault Status Register.
- *
- * @param v		New value of D-SFSR register.
- */
-_NO_TRACE static inline void dtlb_sfsr_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v);
-	membar();
-}
-
-/** Read DTLB Synchronous Fault Address Register.
- *
- * @return		Current content of D-SFAR register.
- */
-_NO_TRACE static inline uint64_t dtlb_sfar_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR);
-}
-
-/** Perform IMMU TLB Demap Operation.
- *
- * @param type		Selects between context and page demap (and entire MMU
- * 			demap on US3).
- * @param context_encoding Specifies which Context register has Context ID for
- * 			demap.
- * @param page		Address which is on the page to be demapped.
- */
-_NO_TRACE static inline void itlb_demap(int type, int context_encoding, uintptr_t page)
-{
-	tlb_demap_addr_t da;
-	page_address_t pg;
-
-	da.value = 0;
-	pg.address = page;
-
-	da.type = type;
-	da.context = context_encoding;
-	da.vpn = pg.vpn;
-
-	/* da.value is the address within the ASI */
-	asi_u64_write(ASI_IMMU_DEMAP, da.value, 0);
-
-	flush_pipeline();
-}
-
-/** Perform DMMU TLB Demap Operation.
- *
- * @param type		Selects between context and page demap (and entire MMU
- * 			demap on US3).
- * @param context_encoding Specifies which Context register has Context ID for
- * 			demap.
- * @param page		Address which is on the page to be demapped.
- */
-_NO_TRACE static inline void dtlb_demap(int type, int context_encoding, uintptr_t page)
-{
-	tlb_demap_addr_t da;
-	page_address_t pg;
-
-	da.value = 0;
-	pg.address = page;
-
-	da.type = type;
-	da.context = context_encoding;
-	da.vpn = pg.vpn;
-
-	/* da.value is the address within the ASI */
-	asi_u64_write(ASI_DMMU_DEMAP, da.value, 0);
-
-	membar();
-}
-
-extern void fast_instruction_access_mmu_miss(unsigned int, istate_t *);
-extern void fast_data_access_mmu_miss(unsigned int, istate_t *);
-extern void fast_data_access_protection(unsigned int, istate_t *);
-
-extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool);
-
-extern void dump_sfsr_and_sfar(void);
-extern void describe_dmmu_fault(void);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/tsb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/tsb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_TSB_H_
-#define KERN_sparc64_sun4u_TSB_H_
-
-/*
- * ITSB abd DTSB will claim 64K of memory, which
- * is a nice number considered that it is one of
- * the page sizes supported by hardware, which,
- * again, is nice because TSBs need to be locked
- * in TLBs - only one TLB entry will do.
- */
-#define TSB_BASE_REG_SIZE	2	/* keep in sync with as.c */
-#define ITSB_ENTRY_COUNT	(512 * (1 << TSB_BASE_REG_SIZE))
-#define DTSB_ENTRY_COUNT	(512 * (1 << TSB_BASE_REG_SIZE))
-
-#define ITSB_ENTRY_MASK		(ITSB_ENTRY_COUNT - 1)
-#define DTSB_ENTRY_MASK		(DTSB_ENTRY_COUNT - 1)
-
-#define TSB_ENTRY_COUNT		(ITSB_ENTRY_COUNT + DTSB_ENTRY_COUNT)
-#define TSB_SIZE		(TSB_ENTRY_COUNT * sizeof(tsb_entry_t))
-#define TSB_FRAMES		SIZE2FRAMES(TSB_SIZE)
-
-#define TSB_TAG_TARGET_CONTEXT_SHIFT	48
-
-#ifndef __ASSEMBLER__
-
-#include <arch/mm/tte.h>
-#include <arch/mm/mmu.h>
-#include <typedefs.h>
-
-/** TSB Base register. */
-typedef union tsb_base_reg {
-	uint64_t value;
-	struct {
-		/** TSB base address, bits 63:13. */
-		uint64_t base : 51;
-		/** Split vs. common TSB for 8K and 64K pages. HelenOS uses
-		 * only 8K pages for user mappings, so we always set this to 0.
-		 */
-		unsigned split : 1;
-		unsigned : 9;
-		/** TSB size. Number of entries is 512 * 2^size. */
-		unsigned size : 3;
-	} __attribute__((packed));
-} tsb_base_reg_t;
-
-/** Read ITSB Base register.
- *
- * @return Content of the ITSB Base register.
- */
-static inline uint64_t itsb_base_read(void)
-{
-	return asi_u64_read(ASI_IMMU, VA_IMMU_TSB_BASE);
-}
-
-/** Read DTSB Base register.
- *
- * @return Content of the DTSB Base register.
- */
-static inline uint64_t dtsb_base_read(void)
-{
-	return asi_u64_read(ASI_DMMU, VA_DMMU_TSB_BASE);
-}
-
-/** Write ITSB Base register.
- *
- * @param v New content of the ITSB Base register.
- */
-static inline void itsb_base_write(uint64_t v)
-{
-	asi_u64_write(ASI_IMMU, VA_IMMU_TSB_BASE, v);
-}
-
-/** Write DTSB Base register.
- *
- * @param v New content of the DTSB Base register.
- */
-static inline void dtsb_base_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_TSB_BASE, v);
-}
-
-#if defined (US3)
-
-/** Write DTSB Primary Extension register.
- *
- * @param v New content of the DTSB Primary Extension register.
- */
-static inline void dtsb_primary_extension_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_PRIMARY_EXTENSION, v);
-}
-
-/** Write DTSB Secondary Extension register.
- *
- * @param v New content of the DTSB Secondary Extension register.
- */
-static inline void dtsb_secondary_extension_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_SECONDARY_EXTENSION, v);
-}
-
-/** Write DTSB Nucleus Extension register.
- *
- * @param v New content of the DTSB Nucleus Extension register.
- */
-static inline void dtsb_nucleus_extension_write(uint64_t v)
-{
-	asi_u64_write(ASI_DMMU, VA_DMMU_NUCLEUS_EXTENSION, v);
-}
-
-/** Write ITSB Primary Extension register.
- *
- * @param v New content of the ITSB Primary Extension register.
- */
-static inline void itsb_primary_extension_write(uint64_t v)
-{
-	asi_u64_write(ASI_IMMU, VA_IMMU_PRIMARY_EXTENSION, v);
-}
-
-/** Write ITSB Nucleus Extension register.
- *
- * @param v New content of the ITSB Nucleus Extension register.
- */
-static inline void itsb_nucleus_extension_write(uint64_t v)
-{
-	asi_u64_write(ASI_IMMU, VA_IMMU_NUCLEUS_EXTENSION, v);
-}
-
-#endif
-
-/* Forward declarations. */
-struct as;
-struct pte;
-
-extern void tsb_invalidate(struct as *as, uintptr_t page, size_t pages);
-extern void itsb_pte_copy(struct pte *t, size_t index);
-extern void dtsb_pte_copy(struct pte *t, size_t index, bool ro);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4u/tte.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4u/tte.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_TTE_H_
-#define KERN_sparc64_sun4u_TTE_H_
-
-#define TTE_G		(1 << 0)
-#define TTE_W		(1 << 1)
-#define TTE_P		(1 << 2)
-#define TTE_E		(1 << 3)
-#define TTE_CV		(1 << 4)
-#define TTE_CP		(1 << 5)
-#define TTE_L		(1 << 6)
-
-#define TTE_V_SHIFT	63
-#define TTE_SIZE_SHIFT	61
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/* TTE tag's VA_tag field contains bits <63:VA_TAG_PAGE_SHIFT> of the VA */
-#define VA_TAG_PAGE_SHIFT	22
-
-/** Translation Table Entry - Tag. */
-union tte_tag {
-	uint64_t value;
-	struct {
-		unsigned g : 1;		/**< Global. */
-		unsigned : 2;		/**< Reserved. */
-		unsigned context : 13;	/**< Context identifier. */
-		unsigned : 6;		/**< Reserved. */
-		uint64_t va_tag : 42;	/**< Virtual Address Tag, bits 63:22. */
-	} __attribute__((packed));
-};
-
-typedef union tte_tag tte_tag_t;
-
-/** Translation Table Entry - Data. */
-union tte_data {
-	uint64_t value;
-	struct {
-		unsigned v : 1;		/**< Valid. */
-		unsigned size : 2;	/**< Page size of this entry. */
-		unsigned nfo : 1;	/**< No-Fault-Only. */
-		unsigned ie : 1;	/**< Invert Endianness. */
-		unsigned soft2 : 9;	/**< Software defined field. */
-#if defined (US)
-		unsigned diag : 9;	/**< Diagnostic data. */
-		unsigned pfn : 28;	/**< Physical Address bits, bits 40:13. */
-#elif defined (US3)
-		unsigned : 7;		/**< Reserved. */
-		unsigned pfn : 30;	/**< Physical Address bits, bits 42:13 */
-#endif
-		unsigned soft : 6;	/**< Software defined field. */
-		unsigned l : 1;		/**< Lock. */
-		unsigned cp : 1;	/**< Cacheable in physically indexed cache. */
-		unsigned cv : 1;	/**< Cacheable in virtually indexed cache. */
-		unsigned e : 1;		/**< Side-effect. */
-		unsigned p : 1;		/**< Privileged. */
-		unsigned w : 1;		/**< Writable. */
-		unsigned g : 1;		/**< Global. */
-	} __attribute__((packed));
-};
-
-typedef union tte_data tte_data_t;
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/as.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_AS_H_
-#define KERN_sparc64_sun4v_AS_H_
-
-#include <arch/mm/tte.h>
-#include <arch/mm/tsb.h>
-
-#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH  1
-#define KERNEL_SEPARATE_PTL0_ARCH           0
-
-#define KERNEL_ADDRESS_SPACE_START_ARCH  UINT64_C(0x0000000000000000)
-#define KERNEL_ADDRESS_SPACE_END_ARCH    UINT64_C(0xffffffffffffffff)
-#define USER_ADDRESS_SPACE_START_ARCH    UINT64_C(0x0000000000000000)
-#define USER_ADDRESS_SPACE_END_ARCH      UINT64_C(0xffffffffffffffff)
-
-#ifdef CONFIG_TSB
-
-/**
- * TTE Tag.
- *
- * Even though for sun4v the format of the TSB Tag states that the context
- * field has 16 bits, the T1 CPU still only supports 13-bit contexts and the
- * three most significant bits are always zero.
- */
-typedef union tte_tag {
-	uint64_t value;
-	struct {
-		unsigned : 3;
-		unsigned context : 13;	/**< Software ASID. */
-		unsigned : 6;
-		uint64_t va_tag : 42;	/**< Virtual address bits <63:22>. */
-	} __attribute__((packed));
-} tte_tag_t;
-
-/** TSB entry. */
-typedef struct tsb_entry {
-	tte_tag_t tag;
-	tte_data_t data;
-} __attribute__((packed)) tsb_entry_t;
-
-typedef struct {
-	tsb_descr_t tsb_description;
-} as_arch_t;
-
-#else
-
-typedef struct {
-} as_arch_t;
-
-#endif /* CONFIG_TSB */
-
-#include <genarch/mm/as_ht.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#define as_invalidate_translation_cache(as, page, cnt) \
-	tsb_invalidate((as), (page), (cnt))
-#else
-#define as_invalidate_translation_cache(as, page, cnt)
-#endif
-
-extern void as_arch_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/frame.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_FRAME_H_
-#define KERN_sparc64_sun4v_FRAME_H_
-
-#define MMU_FRAME_WIDTH  13  /* 8K */
-#define MMU_FRAME_SIZE   (1 << MMU_FRAME_WIDTH)
-
-#define FRAME_WIDTH  13
-#define FRAME_SIZE   (1 << FRAME_WIDTH)
-
-#define FRAME_LOWPRIO  0
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/km.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_KM_H_
-#define KERN_sparc64_sun4v_KM_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-/*
- * Do not use the 4 GiB area on either side of the VA hole to meet the
- * limitations of the UltraSPARC T1 CPU.
- */
-
-#define KM_SPARC64_T1_IDENTITY_START		UINT64_C(0x0000000000000000)
-#define KM_SPARC64_T1_IDENTITY_SIZE		UINT64_C(0x00007fff00000000)
-
-#define KM_SPARC64_T1_NON_IDENTITY_START	UINT64_C(0xffff800100000000)
-#define KM_SPARC64_T1_NON_IDENTITY_SIZE		UINT64_C(0x00007fff00000000)
-
-extern void km_identity_arch_init(void);
-extern void km_non_identity_arch_init(void);
-extern bool km_is_non_identity_arch(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_MMU_H_
-#define KERN_sparc64_sun4v_MMU_H_
-
-#define ASI_REAL			0x14	/**< MMU bypass ASI */
-
-#define VA_PRIMARY_CONTEXT_REG		0x8	/**< primary context register VA. */
-#define ASI_PRIMARY_CONTEXT_REG		0x21	/**< primary context register ASI. */
-
-#define VA_SECONDARY_CONTEXT_REG	0x10	/**< secondary context register VA. */
-#define ASI_SECONDARY_CONTEXT_REG	0x21	/**< secondary context register ASI. */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/page.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_PAGE_H_
-#define KERN_sparc64_sun4v_PAGE_H_
-
-#include <arch/mm/frame.h>
-
-#define MMU_PAGE_WIDTH	MMU_FRAME_WIDTH
-#define MMU_PAGE_SIZE	MMU_FRAME_SIZE
-
-#define PAGE_WIDTH	FRAME_WIDTH
-#define PAGE_SIZE	FRAME_SIZE
-
-#define MMU_PAGES_PER_PAGE	(1 << (PAGE_WIDTH - MMU_PAGE_WIDTH))
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-
-extern uintptr_t physmem_base;
-
-#define KA2PA(x)	(((uintptr_t) (x)) + physmem_base)
-#define PA2KA(x)	(((uintptr_t) (x)) - physmem_base)
-
-typedef union {
-	uintptr_t address;
-	struct {
-		uint64_t vpn : 51;		/**< Virtual Page Number. */
-		unsigned offset : 13;		/**< Offset. */
-	} __attribute__((packed));
-} page_address_t;
-
-extern void page_arch_init(void);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/tlb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_TLB_H_
-#define KERN_sparc64_sun4v_TLB_H_
-
-#define MMU_FSA_ALIGNMENT	64
-#define MMU_FSA_SIZE		128
-
-#ifndef __ASSEMBLER__
-
-#include <arch/mm/tte.h>
-#include <trace.h>
-#include <arch/mm/mmu.h>
-#include <arch/mm/page.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <typedefs.h>
-#include <arch/register.h>
-#include <arch/cpu.h>
-#include <arch/sun4v/hypercall.h>
-
-/**
- * Structure filled by hypervisor (or directly CPU, if implemented so) when
- * a MMU fault occurs. The structure describes the exact condition which
- * has caused the fault.
- */
-typedef struct mmu_fault_status_area {
-	uint64_t ift;		/**< Instruction fault type (IFT) */
-	uint64_t ifa;		/**< Instruction fault address (IFA) */
-	uint64_t ifc;		/**< Instruction fault context (IFC) */
-	uint8_t reserved1[0x28];
-
-	uint64_t dft;		/**< Data fault type (DFT) */
-	uint64_t dfa;		/**< Data fault address (DFA) */
-	uint64_t dfc;		/**< Data fault context (DFC) */
-	uint8_t reserved2[0x28];
-} __attribute__((packed)) mmu_fault_status_area_t;
-
-#define DTLB_MAX_LOCKED_ENTRIES		8
-
-/** Bit width of the TLB-locked portion of kernel address space. */
-#define KERNEL_PAGE_WIDTH       22	/* 4M */
-
-/*
- * Reading and writing context registers.
- *
- * Note that UltraSPARC Architecture-compatible processors do not require
- * a MEMBAR #Sync, FLUSH, DONE, or RETRY instruction after a store to an
- * MMU register for proper operation.
- *
- */
-
-/** Read MMU Primary Context Register.
- *
- * @return	Current value of Primary Context Register.
- */
-_NO_TRACE static inline uint64_t mmu_primary_context_read(void)
-{
-	return asi_u64_read(ASI_PRIMARY_CONTEXT_REG, VA_PRIMARY_CONTEXT_REG);
-}
-
-/** Write MMU Primary Context Register.
- *
- * @param v	New value of Primary Context Register.
- */
-_NO_TRACE static inline void mmu_primary_context_write(uint64_t v)
-{
-	asi_u64_write(ASI_PRIMARY_CONTEXT_REG, VA_PRIMARY_CONTEXT_REG, v);
-}
-
-/** Read MMU Secondary Context Register.
- *
- * @return	Current value of Secondary Context Register.
- */
-_NO_TRACE static inline uint64_t mmu_secondary_context_read(void)
-{
-	return asi_u64_read(ASI_SECONDARY_CONTEXT_REG, VA_SECONDARY_CONTEXT_REG);
-}
-
-/** Write MMU Secondary Context Register.
- *
- * @param v	New value of Secondary Context Register.
- */
-_NO_TRACE static inline void mmu_secondary_context_write(uint64_t v)
-{
-	asi_u64_write(ASI_SECONDARY_CONTEXT_REG, VA_SECONDARY_CONTEXT_REG, v);
-}
-
-/**
- * Demaps all mappings in a context.
- *
- * @param context	number of the context
- * @param mmu_flag	MMU_FLAG_DTLB, MMU_FLAG_ITLB or a combination of both
- */
-_NO_TRACE static inline void mmu_demap_ctx(int context, int mmu_flag)
-{
-	__hypercall_fast4(MMU_DEMAP_CTX, 0, 0, context, mmu_flag);
-}
-
-/**
- * Demaps given page.
- *
- * @param vaddr		VA of the page to be demapped
- * @param context	number of the context
- * @param mmu_flag	MMU_FLAG_DTLB, MMU_FLAG_ITLB or a combination of both
- */
-_NO_TRACE static inline void mmu_demap_page(uintptr_t vaddr, int context, int mmu_flag)
-{
-	__hypercall_fast5(MMU_DEMAP_PAGE, 0, 0, vaddr, context, mmu_flag);
-}
-
-extern void fast_instruction_access_mmu_miss(unsigned int, istate_t *);
-extern void fast_data_access_mmu_miss(unsigned int, istate_t *);
-extern void fast_data_access_protection(unsigned int, istate_t *);
-
-extern void dtlb_insert_mapping(uintptr_t, uintptr_t, int, bool, bool);
-
-extern void describe_dmmu_fault(void);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/tsb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/tsb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_TSB_H_
-#define KERN_sparc64_sun4v_TSB_H_
-
-/*
- * TSB will claim 64K of memory, which
- * is a nice number considered that it is one of
- * the page sizes supported by hardware, which,
- * again, is nice because TSBs need to be locked
- * in TLBs - only one TLB entry will do.
- */
-#define TSB_ENTRY_COUNT			4096
-#define TSB_ENTRY_MASK			(TSB_ENTRY_COUNT - 1)
-#define TSB_SIZE			(TSB_ENTRY_COUNT * sizeof(tsb_entry_t))
-#define TSB_FRAMES			SIZE2FRAMES(TSB_SIZE)
-
-#ifndef __ASSEMBLER__
-
-#include <stdbool.h>
-#include <typedefs.h>
-#include <arch/mm/tte.h>
-#include <arch/mm/mmu.h>
-
-/** TSB description, used in hypercalls */
-typedef struct tsb_descr {
-	uint16_t page_size;	/**< Page size (0 = 8K, 1 = 64K,...). */
-	uint16_t associativity;	/**< TSB associativity (will be 1). */
-	uint32_t num_ttes;	/**< Number of TTEs. */
-	uint32_t context;	/**< Context number. */
-	uint32_t pgsize_mask;	/**< Equals "1 << page_size". */
-	uint64_t tsb_base;	/**< Real address of TSB base. */
-	uint64_t reserved;
-} __attribute__((packed)) tsb_descr_t;
-
-/* Forward declarations. */
-struct as;
-struct pte;
-
-extern void tsb_invalidate(struct as *as, uintptr_t page, size_t pages);
-extern void itsb_pte_copy(struct pte *t);
-extern void dtsb_pte_copy(struct pte *t, bool ro);
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/sun4v/tte.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/sun4v/tte.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_TTE_H_
-#define KERN_sparc64_sun4v_TTE_H_
-
-#define TTE_V_SHIFT	63	/**< valid */
-#define TTE_TADDR_SHIFT	13	/**< target address */
-#define TTE_CP_SHIFT	10	/**< cacheable physically */
-#define TTE_CV_SHIFT	9	/**< caheable virtually */
-#define TTE_P_SHIFT	8	/**< privileged */
-#define TTE_EP_SHIFT	7	/**< execute permission */
-#define TTE_W_SHIFT	6	/**< writable */
-#define TTE_SZ_SHIFT	0	/**< size */
-
-#define MMU_FLAG_ITLB	2	/**< operation applies to ITLB */
-#define MMU_FLAG_DTLB	1	/**< operation applies to DTLB */
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/** Translation Table Entry - Data. */
-union tte_data {
-	uint64_t value;
-	struct {
-		unsigned v : 1;		/**< Valid. */
-		unsigned nfo : 1;	/**< No-Fault-Only. */
-		unsigned soft : 6;	/**< Software defined field. */
-		unsigned long ra : 43;	/**< Real address. */
-		unsigned ie : 1;	/**< Invert endianess. */
-		unsigned e : 1;		/**< Side-effect. */
-		unsigned cp : 1;	/**< Cacheable in physically indexed cache. */
-		unsigned cv : 1;	/**< Cacheable in virtually indexed cache. */
-		unsigned p : 1;		/**< Privileged. */
-		unsigned x : 1;		/**< Executable. */
-		unsigned w : 1;		/**< Writable. */
-		unsigned soft2 : 2;	/**< Software defined field. */
-		unsigned size : 4;	/**< Page size. */
-	} __attribute__((packed));
-};
-
-typedef union tte_data tte_data_t;
-
-#define VA_TAG_PAGE_SHIFT	22
-
-#endif /* !def __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/tlb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TLB_H_
-#define KERN_sparc64_TLB_H_
-
-#if defined (SUN4U)
-
-#include <arch/mm/sun4u/tlb.h>
-
-#elif defined (SUN4V)
-
-#include <arch/mm/sun4v/tlb.h>
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/tsb.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/tsb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TSB_H_
-#define KERN_sparc64_TSB_H_
-
-#if defined (SUN4U)
-#include <arch/mm/sun4u/tsb.h>
-#elif defined (SUN4V)
-#include <arch/mm/sun4v/tsb.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/mm/tte.h
===================================================================
--- kernel/arch/sparc64/include/arch/mm/tte.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TTE_H_
-#define KERN_sparc64_TTE_H_
-
-#if defined (SUN4U)
-#include <arch/mm/sun4u/tte.h>
-#elif defined (SUN4V)
-#include <arch/mm/sun4v/tte.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/proc/task.h
===================================================================
--- kernel/arch/sparc64/include/arch/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TASK_H_
-#define KERN_sparc64_TASK_H_
-
-typedef struct {
-} task_arch_t;
-
-#define task_create_arch(t)
-#define task_destroy_arch(t)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/proc/thread.h
===================================================================
--- kernel/arch/sparc64/include/arch/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_THREAD_H_
-#define KERN_sparc64_THREAD_H_
-
-#include <arch/arch.h>
-#include <mm/slab.h>
-#include <stdint.h>
-
-extern slab_cache_t *uwb_cache;
-
-typedef struct {
-	/** Buffer for register windows with userspace content. */
-	uint8_t *uspace_window_buffer;
-} thread_arch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/regdef.h
===================================================================
--- kernel/arch/sparc64/include/arch/regdef.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_REGDEF_H_
-#define KERN_sparc64_REGDEF_H_
-
-#define PSTATE_IE_BIT	(1 << 1)
-#define PSTATE_AM_BIT	(1 << 3)
-
-#define PSTATE_AG_BIT	(1 << 0)
-#define PSTATE_IG_BIT	(1 << 11)
-#define PSTATE_MG_BIT	(1 << 10)
-
-#define PSTATE_PRIV_BIT	(1 << 2)
-#define PSTATE_PEF_BIT	(1 << 4)
-
-#define TSTATE_PSTATE_SHIFT	8
-#define TSTATE_PRIV_BIT		(PSTATE_PRIV_BIT << TSTATE_PSTATE_SHIFT)
-#define TSTATE_IE_BIT		(PSTATE_IE_BIT << TSTATE_PSTATE_SHIFT)
-#define TSTATE_PEF_BIT		(PSTATE_PEF_BIT << TSTATE_PSTATE_SHIFT)
-
-#define TSTATE_CWP_MASK		0x1f
-
-#define WSTATE_NORMAL(n)	(n)
-#define WSTATE_OTHER(n)		((n) << 3)
-
-/*
- * The following definitions concern the UPA_CONFIG register on US and the
- * FIREPLANE_CONFIG register on US3.
- */
-#define ICBUS_CONFIG_MID_SHIFT    17
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/register.h
===================================================================
--- kernel/arch/sparc64/include/arch/register.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_REGISTER_H_
-#define KERN_sparc64_REGISTER_H_
-
-#include <arch/regdef.h>
-#include <stdint.h>
-
-/** Version Register. */
-union ver_reg {
-	uint64_t value;
-	struct {
-		uint16_t manuf;	/**< Manufacturer code. */
-		uint16_t impl;	/**< Implementation code. */
-		uint8_t mask;	/**< Mask set revision. */
-		unsigned : 8;
-		uint8_t maxtl;
-		unsigned : 3;
-		unsigned maxwin : 5;
-	} __attribute__((packed));
-};
-typedef union ver_reg ver_reg_t;
-
-/** Processor State Register. */
-union pstate_reg {
-	uint64_t value;
-	struct {
-		uint64_t : 52;
-		unsigned ig : 1;	/**< Interrupt Globals. */
-		unsigned mg : 1;	/**< MMU Globals. */
-		unsigned cle : 1;	/**< Current Little Endian. */
-		unsigned tle : 1;	/**< Trap Little Endian. */
-		unsigned mm : 2;	/**< Memory Model. */
-		unsigned red : 1;	/**< RED state. */
-		unsigned pef : 1;	/**< Enable floating-point. */
-		unsigned am : 1;	/**< 32-bit Address Mask. */
-		unsigned priv : 1;	/**< Privileged Mode. */
-		unsigned ie : 1;	/**< Interrupt Enable. */
-		unsigned ag : 1;	/**< Alternate Globals */
-	} __attribute__((packed));
-};
-typedef union pstate_reg pstate_reg_t;
-
-/** TICK Register. */
-union tick_reg {
-	uint64_t value;
-	struct {
-		unsigned npt : 1;	/**< Non-privileged Trap enable. */
-		uint64_t counter : 63;	/**< Elapsed CPU clck cycle counter. */
-	} __attribute__((packed));
-};
-typedef union tick_reg tick_reg_t;
-
-/** TICK_compare Register. */
-union tick_compare_reg {
-	uint64_t value;
-	struct {
-		unsigned int_dis : 1;		/**< TICK_INT interrupt disabled flag. */
-		uint64_t tick_cmpr : 63;	/**< Compare value for TICK interrupts. */
-	} __attribute__((packed));
-};
-typedef union tick_compare_reg tick_compare_reg_t;
-
-/** SOFTINT Register. */
-union softint_reg {
-	uint64_t value;
-	struct {
-		uint64_t : 47;
-		unsigned stick_int : 1;
-		unsigned int_level : 15;
-		unsigned tick_int : 1;
-	} __attribute__((packed));
-};
-typedef union softint_reg softint_reg_t;
-
-/** Floating-point Registers State Register. */
-union fprs_reg {
-	uint64_t value;
-	struct {
-		uint64_t : 61;
-		unsigned fef : 1;
-		unsigned du : 1;
-		unsigned dl : 1;
-	} __attribute__((packed));
-};
-typedef union fprs_reg fprs_reg_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/smp/sun4v/smp.h
===================================================================
--- kernel/arch/sparc64/include/arch/smp/sun4v/smp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	sun4v smp functions
- */
-
-#ifndef KERN_sparc64_sun4v_SMP_H_
-#define KERN_sparc64_sun4v_SMP_H_
-
-#include <arch/sun4v/cpu.h>
-#include <stdint.h>
-
-extern bool calculate_optimal_nrdy(exec_unit_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sparc64.h
===================================================================
--- kernel/arch/sparc64/include/arch/sparc64.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_SPARC64_H_
-#define KERN_sparc64_SPARC64_H_
-
-#include <interrupt.h>
-
-extern void interrupt_register(unsigned int, const char *, iroutine_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/stack.h
===================================================================
--- kernel/arch/sparc64/include/arch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_STACK_H_
-#define KERN_sparc64_STACK_H_
-
-#include <config.h>
-
-#define MEM_STACK_SIZE	STACK_SIZE
-
-#define STACK_ITEM_SIZE			8
-
-/** According to SPARC Compliance Definition, every stack frame is 16-byte aligned. */
-#define STACK_ALIGNMENT			16
-
-/**
- * 16-extended-word save area for %i[0-7] and %l[0-7] registers.
- */
-#define STACK_WINDOW_SAVE_AREA_SIZE	(16 * STACK_ITEM_SIZE)
-
-/**
- * Six extended words for first six arguments.
- */
-#define STACK_ARG_SAVE_AREA_SIZE	(6 * STACK_ITEM_SIZE)
-
-/**
- * By convention, the actual top of the stack is %sp + STACK_BIAS.
- */
-#define STACK_BIAS            2047
-
-/*
- * Offsets of arguments on stack.
- */
-#define STACK_ARG0			0
-#define STACK_ARG1			8
-#define STACK_ARG2			16
-#define STACK_ARG3			24
-#define STACK_ARG4			32
-#define STACK_ARG5			40
-#define STACK_ARG6			48
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4u/arch.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4u/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	Various sun4u-specific macros.
- */
-
-#ifndef KERN_sparc64_sun4u_ARCH_H_
-#define KERN_sparc64_sun4u_ARCH_H_
-
-#define ASI_NUCLEUS_QUAD_LDD	0x24	/** ASI for 16-byte atomic loads. */
-#define ASI_DCACHE_TAG		0x47	/** ASI D-Cache Tag. */
-#define ASI_ICBUS_CONFIG	0x4a	/** ASI of the UPA_CONFIG/FIREPLANE_CONFIG register. */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4u/asm.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4u/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_ASM_H_
-#define KERN_sparc64_sun4u_ASM_H_
-
-#include <trace.h>
-
-/** Read Version Register.
- *
- * @return Value of VER register.
- *
- */
-_NO_TRACE static inline uint64_t ver_read(void)
-{
-	uint64_t v;
-
-	asm volatile (
-	    "rdpr %%ver, %[v]\n"
-	    : [v] "=r" (v)
-	);
-
-	return v;
-}
-
-extern uint64_t read_from_ag_g7(void);
-extern void write_to_ag_g6(uint64_t);
-extern void write_to_ag_g7(uint64_t);
-extern void write_to_ig_g6(uint64_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4u/cpu.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4u/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4u_CPU_H_
-#define KERN_sparc64_sun4u_CPU_H_
-
-#define MANUF_FUJITSU     0x04
-#define MANUF_ULTRASPARC  0x17  /**< UltraSPARC I, UltraSPARC II */
-#define MANUF_SUN         0x3e
-
-#define IMPL_ULTRASPARCI         0x10
-#define IMPL_ULTRASPARCII        0x11
-#define IMPL_ULTRASPARCII_I      0x12
-#define IMPL_ULTRASPARCII_E      0x13
-#define IMPL_ULTRASPARCIII       0x14
-#define IMPL_ULTRASPARCIII_PLUS  0x15
-#define IMPL_ULTRASPARCIII_I     0x16
-#define IMPL_ULTRASPARCIV        0x18
-#define IMPL_ULTRASPARCIV_PLUS   0x19
-
-#define IMPL_SPARC64V  0x5
-
-#ifndef __ASSEMBLER__
-
-#include <arch/register.h>
-#include <arch/regdef.h>
-#include <arch/asm.h>
-#include <arch/arch.h>
-#include <stdint.h>
-#include <trace.h>
-
-typedef struct {
-	/** Processor ID as read from UPA_CONFIG/FIREPLANE_CONFIG. */
-	uint32_t mid;
-	ver_reg_t ver;
-	/** Processor frequency in Hz. */
-	uint32_t clock_frequency;
-	/** Next clock interrupt should be generated when the TICK register
-	 * matches this value.
-	 */
-	uint64_t next_tick_cmpr;
-} cpu_arch_t;
-
-/** Read the module ID (agent ID/CPUID) of the current CPU.
- *
- */
-_NO_TRACE static inline uint32_t read_mid(void)
-{
-	uint64_t icbus_config = asi_u64_read(ASI_ICBUS_CONFIG, 0);
-	icbus_config = icbus_config >> ICBUS_CONFIG_MID_SHIFT;
-
-#if defined (US)
-	return icbus_config & 0x1f;
-#elif defined (US3)
-	if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIII_I)
-		return icbus_config & 0x1f;
-	else
-		return icbus_config & 0x3ff;
-#endif
-}
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/arch.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	Various sun4v-specific macros.
- */
-
-#ifndef KERN_sparc64_sun4v_ARCH_H_
-#define KERN_sparc64_sun4v_ARCH_H_
-
-/* scratch pad registers ASI */
-#define	ASI_SCRATCHPAD		0x20
-
-/*
- * Assignment of scratchpad register virtual addresses. The same convention is
- * used by both Linux and Solaris.
- */
-
-/* register where the address of the MMU fault status area will be stored */
-#define SCRATCHPAD_MMU_FSA	0x00
-
-/* register where the CPUID will be stored */
-#define SCRATCHPAD_CPUID	0x08
-
-/* register where the kernel stack address will be stored */
-#define SCRATCHPAD_KSTACK	0x10
-
-/* register where the userspace window buffer address will be stored */
-#define SCRATCHPAD_WBUF		0x18
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/asm.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/asm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_ASM_H_
-#define KERN_sparc64_sun4v_ASM_H_
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/cpu.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_CPU_H_
-#define KERN_sparc64_sun4v_CPU_H_
-
-/** Maximum number of virtual processors. */
-#define MAX_NUM_STRANDS  64
-
-/** Maximum number of logical processors in a processor core */
-#define MAX_CORE_STRANDS  8
-
-#ifndef __ASSEMBLER__
-
-#include <atomic.h>
-#include <synch/spinlock.h>
-
-struct cpu;
-
-typedef struct {
-	uint64_t exec_unit_id;
-	uint8_t strand_count;
-	uint64_t cpuids[MAX_CORE_STRANDS];
-	struct cpu *cpus[MAX_CORE_STRANDS];
-	atomic_size_t nrdy;
-	SPINLOCK_DECLARE(proposed_nrdy_lock);
-} exec_unit_t;
-
-typedef struct cpu_arch {
-	/** Virtual processor ID */
-	uint64_t id;
-	/** Processor frequency in Hz */
-	uint32_t clock_frequency;
-	/** Next clock interrupt should be generated when the TICK register
-	 * matches this value.
-	 */
-	uint64_t next_tick_cmpr;
-	/** Physical core. */
-	exec_unit_t *exec_unit;
-	/** Proposed No. of ready threads so that cores are equally balanced. */
-	unsigned long proposed_nrdy;
-} cpu_arch_t;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/hypercall.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/hypercall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	Macros, constants and functions needed to perform a call to the
- * 		hypervisor API. For details and terminology see this document:
- *		UltraSPARC Virtual Machine Specification (The Hypervisor API
- *		specification for Logical Domains).
- *
- */
-
-#ifndef KERN_sparc64_sun4v_HYPERCALL_H_
-#define KERN_sparc64_sun4v_HYPERCALL_H_
-
-/* SW trap numbers for hyperfast traps */
-#define FAST_TRAP		0x80
-#define MMU_MAP_ADDR		0x83
-#define MMU_UNMAP_ADDR		0x84
-
-/* function codes for fast traps */
-#define MACH_DESC		0x01
-#define CPU_START		0x10
-#define CPU_STOP		0x11
-#define CPU_YIELD		0x12
-#define CPU_QCONF		0x14
-#define CPU_MYID		0x16
-#define CPU_STATE		0x17
-#define CPU_SET_RTBA		0x18
-#define CPU_GET_RTBA		0x19
-#define MMU_TSB_CTX0		0x20
-#define MMU_TSB_CTXNON0		0x21
-#define MMU_DEMAP_PAGE		0x22
-#define MMU_DEMAP_CTX		0x23
-#define MMU_DEMAP_ALL		0x24
-#define MMU_MAP_PERM_ADDR	0x25
-#define MMU_FAULT_AREA_CONF	0x26
-#define MMU_ENABLE		0x27
-#define MMU_UNMAP_PERM_ADDR	0x28
-#define MMU_TSB_CTX0_INFO	0x29
-#define MMU_TSB_CTXNON0_INFO	0x2a
-#define MMU_FAULT_AREA_INFO	0x2b
-#define CPU_MONDO_SEND		0x42
-#define CONS_GETCHAR		0x60
-#define CONS_PUTCHAR		0x61
-
-/* return codes */
-#define HV_EOK			0	/**< Successful return */
-#define HV_ENOCPU		1	/**< Invalid CPU id */
-#define HV_ENORADDR		2	/**< Invalid real address */
-#define HV_ENOINTR		3	/**< Invalid interrupt id */
-#define HV_EBADPGSZ		4	/**< Invalid pagesize encoding */
-#define HV_EBADTSB		5	/**< Invalid TSB description */
-#define	HV_EINVAL		6	/**< Invalid argument */
-#define HV_EBADTRAP		7	/**< Invalid function number */
-#define HV_EBADALIGN		8	/**< Invalid address alignment */
-#define HV_EWOULDBLOCK		9	/**< Cannot complete operation without blocking */
-#define HV_ENOACCESS		10	/**< No access to specified resource */
-#define HV_EIO			11	/**< I/O Error */
-#define HV_ECPUERROR		12	/**< CPU is in error state */
-#define HV_ENOTSUPPORTED	13	/**< Function not supported */
-#define HV_ENOMAP		14	/**< No mapping found */
-#define HV_ETOOMANY		15	/**< Too many items specified / limit reached */
-#define HV_ECHANNEL		16	/**< Invalid LDC channel */
-#define HV_EBUSY		17	/**< Operation failed as resource is otherwise busy */
-
-/**
- * Performs a hyperfast hypervisor API call from the assembly language code.
- * Expects the registers %o1-%o4 are properly filled with the arguments of the
- * call.
- *
- * @param function_number	hyperfast call function number
- */
-#define __HYPERCALL_FAST(function_number) \
-	set function_number, %o5; \
-	ta FAST_TRAP;
-
-/**
- * Performs a fast hypervisor API call from the assembly language code.
- * Expects the registers %o1-%o4 are properly filled with the arguments of the
- * call.
- *
- * @param sw_trap_number	software trap number
- */
-#define __HYPERCALL_HYPERFAST(sw_trap_number) \
-	ta (sw_trap_number);
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/*
- * Macros to be used from the C-language code; __hypercall_fastN performs
- * a fast hypervisor API call taking exactly N arguments.
- */
-
-#define __hypercall_fast0(function_number) \
-	__hypercall_fast(0, 0, 0, 0, 0, function_number)
-#define __hypercall_fast1(function_number, p1) \
-	__hypercall_fast(p1, 0, 0, 0, 0, function_number)
-#define __hypercall_fast2(function_number, p1, p2) \
-	__hypercall_fast(p1, p2, 0, 0, 0, function_number)
-#define __hypercall_fast3(function_number, p1, p2, p3) \
-	__hypercall_fast(p1, p2, p3, 0, 0, function_number)
-#define __hypercall_fast4(function_number, p1, p2, p3, p4) \
-	__hypercall_fast(p1, p2, p3, p4, 0, function_number)
-#define __hypercall_fast5(function_number, p1, p2, p3, p4, p5) \
-	__hypercall_fast(p1, p2, p3, p4, p5, function_number)
-
-/**
- * Performs a fast hypervisor API call which returns no value except for the
- * error status.
- *
- * @param p1			the 1st argument of the hypervisor API call
- * @param p2			the 2nd argument of the hypervisor API call
- * @param p3			the 3rd argument of the hypervisor API call
- * @param p4			the 4th argument of the hypervisor API call
- * @param p5			the 5th argument of the hypervisor API call
- * @param function_number	function number of the call
- * @return			error status
- */
-static inline uint64_t
-__hypercall_fast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
-    const uint64_t p4, const uint64_t p5, const uint64_t function_number)
-{
-	register uint64_t a6 asm("o5") = function_number;
-	register uint64_t a1 asm("o0") = p1;
-	register uint64_t a2 asm("o1") = p2;
-	register uint64_t a3 asm("o2") = p3;
-	register uint64_t a4 asm("o3") = p4;
-	register uint64_t a5 asm("o4") = p5;
-
-	asm volatile (
-	    "ta %7\n"
-	    : "=r" (a1)
-	    : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
-	      "i" (FAST_TRAP)
-	    : "memory"
-	);
-
-	return a1;
-}
-
-/**
- * Performs a fast hypervisor API call which can return a value.
- *
- * @param p1			the 1st argument of the hypervisor API call
- * @param p2			the 2nd argument of the hypervisor API call
- * @param p3			the 3rd argument of the hypervisor API call
- * @param p4			the 4th argument of the hypervisor API call
- * @param p5			the 5th argument of the hypervisor API call
- * @param function_number	function number of the call
- * @param ret1			pointer to an address where the return value
- * 				of the hypercall should be saved, or NULL
- * @return			error status
- */
-static inline uint64_t
-__hypercall_fast_ret1(const uint64_t p1, const uint64_t p2, const uint64_t p3,
-    const uint64_t p4, const uint64_t p5, const uint64_t function_number,
-    uint64_t *ret1)
-{
-	register uint64_t a6 asm("o5") = function_number;
-	register uint64_t a1 asm("o0") = p1;
-	register uint64_t a2 asm("o1") = p2;
-	register uint64_t a3 asm("o2") = p3;
-	register uint64_t a4 asm("o3") = p4;
-	register uint64_t a5 asm("o4") = p5;
-
-	asm volatile (
-	    "ta %8\n"
-	    : "=r" (a1), "=r" (a2)
-	    : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
-	      "i" (FAST_TRAP)
-	    : "memory"
-	);
-
-	if (ret1)
-		*ret1 = a2;
-
-	return a1;
-}
-
-/**
- * Performs a hyperfast hypervisor API call.
- *
- * @param p1			the 1st argument of the hypervisor API call
- * @param p2			the 2nd argument of the hypervisor API call
- * @param p3			the 3rd argument of the hypervisor API call
- * @param p4			the 4th argument of the hypervisor API call
- * @param p5			the 5th argument of the hypervisor API call
- * @param sw_trap_number	software trap number
- */
-static inline uint64_t
-__hypercall_hyperfast(const uint64_t p1, const uint64_t p2, const uint64_t p3,
-    const uint64_t p4, const uint64_t p5, const uint64_t sw_trap_number)
-{
-	register uint64_t a1 asm("o0") = p1;
-	register uint64_t a2 asm("o1") = p2;
-	register uint64_t a3 asm("o2") = p3;
-	register uint64_t a4 asm("o3") = p4;
-	register uint64_t a5 asm("o4") = p5;
-
-	asm volatile (
-	    "ta %6\n"
-	    : "=r" (a1)
-	    : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5),
-	      "i" (sw_trap_number)
-	    : "memory"
-	);
-
-	return a1;
-}
-
-#endif /* ASM */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/ipi.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/ipi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	sun4v-specific IPI functions
- */
-
-#ifndef KERN_sparc64_sun4v_IPI_H_
-#define KERN_sparc64_sun4v_IPI_H_
-
-#include <stdint.h>
-
-extern uint64_t ipi_brodcast_to(void (*)(void), uint16_t cpu_list[], uint64_t);
-extern uint64_t ipi_unicast_to(void (*)(void), uint16_t);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/md.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/md.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_MD_H_
-#define KERN_sparc64_sun4v_MD_H_
-
-#include <stdbool.h>
-
-/**
- * Data type used to iterate through MD nodes. Internally represented as
- * an index to the first element of the node.
- */
-typedef unsigned int md_node_t;
-
-/** used to iterate over children of a given node */
-typedef unsigned int md_child_iter_t;
-
-md_node_t md_get_root(void);
-md_node_t md_get_child(md_node_t node, char *name);
-md_child_iter_t md_get_child_iterator(md_node_t node);
-bool md_next_child(md_child_iter_t *it);
-md_node_t md_get_child_node(md_child_iter_t it);
-const char *md_get_node_name(md_node_t node);
-bool md_get_integer_property(md_node_t node, const char *key,
-    uint64_t *result);
-bool md_get_string_property(md_node_t node, const char *key,
-    const char **result);
-bool md_next_node(md_node_t *node, const char *name);
-void md_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/regdef.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/regdef.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_REGDEF_H_
-#define KERN_sparc64_sun4v_REGDEF_H_
-
-#define TSTATE_CWP_MASK  0x1f
-
-#define WSTATE_NORMAL(n)  (n)
-#define WSTATE_OTHER(n)   ((n) << 3)
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/sun4v/register.h
===================================================================
--- kernel/arch/sparc64/include/arch/sun4v/register.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_sun4v_REGISTER_H_
-#define KERN_sparc64_sun4v_REGISTER_H_
-
-#include <arch/regdef.h>
-#include <stdint.h>
-
-/** Processor State Register. */
-union pstate_reg {
-	uint64_t value;
-	struct {
-		uint64_t : 54;
-		unsigned cle : 1;	/**< Current Little Endian. */
-		unsigned tle : 1;	/**< Trap Little Endian. */
-		unsigned mm : 2;	/**< Memory Model. */
-		unsigned : 1;		/**< RED state. */
-		unsigned pef : 1;	/**< Enable floating-point. */
-		unsigned am : 1;	/**< 32-bit Address Mask. */
-		unsigned priv : 1;	/**< Privileged Mode. */
-		unsigned ie : 1;	/**< Interrupt Enable. */
-		unsigned : 1;
-	} __attribute__((packed));
-};
-typedef union pstate_reg pstate_reg_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/exception.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/exception.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KERN_sparc64_EXCEPTION_H_
-#define KERN_sparc64_EXCEPTION_H_
-
-#define TT_INSTRUCTION_ACCESS_EXCEPTION		0x08
-#define TT_INSTRUCTION_ACCESS_MMU_MISS		0x09
-#define TT_INSTRUCTION_ACCESS_ERROR		0x0a
-#define	TT_IAE_UNAUTH_ACCESS			0x0b
-#define	TT_IAE_NFO_PAGE				0x0c
-#define TT_ILLEGAL_INSTRUCTION			0x10
-#define TT_PRIVILEGED_OPCODE			0x11
-#define TT_UNIMPLEMENTED_LDD			0x12
-#define TT_UNIMPLEMENTED_STD			0x13
-#define TT_DAE_INVALID_ASI			0x14
-#define TT_DAE_PRIVILEGE_VIOLATION		0x15
-#define TT_DAE_NC_PAGE				0x16
-#define TT_DAE_NFO_PAGE				0x17
-#define TT_FP_DISABLED				0x20
-#define TT_FP_EXCEPTION_IEEE_754		0x21
-#define TT_FP_EXCEPTION_OTHER			0x22
-#define TT_TAG_OVERFLOW				0x23
-#define TT_DIVISION_BY_ZERO			0x28
-#define TT_DATA_ACCESS_EXCEPTION		0x30
-#define TT_DATA_ACCESS_MMU_MISS			0x31
-#define TT_DATA_ACCESS_ERROR			0x32
-#define TT_MEM_ADDRESS_NOT_ALIGNED		0x34
-#define TT_LDDF_MEM_ADDRESS_NOT_ALIGNED		0x35
-#define TT_STDF_MEM_ADDRESS_NOT_ALIGNED		0x36
-#define TT_PRIVILEGED_ACTION			0x37
-#define TT_LDQF_MEM_ADDRESS_NOT_ALIGNED		0x38
-#define TT_STQF_MEM_ADDRESS_NOT_ALIGNED		0x39
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-
-extern void dump_istate(istate_t *istate);
-
-extern void instruction_access_exception(unsigned int, istate_t *);
-extern void instruction_access_error(unsigned int, istate_t *);
-extern void illegal_instruction(unsigned int, istate_t *);
-extern void privileged_opcode(unsigned int, istate_t *);
-extern void unimplemented_LDD(unsigned int, istate_t *);
-extern void unimplemented_STD(unsigned int, istate_t *);
-extern void fp_disabled(unsigned int, istate_t *);
-extern void fp_exception_ieee_754(unsigned int, istate_t *);
-extern void fp_exception_other(unsigned int, istate_t *);
-extern void tag_overflow(unsigned int, istate_t *);
-extern void division_by_zero(unsigned int, istate_t *);
-extern void data_access_exception(unsigned int, istate_t *);
-extern void data_access_error(unsigned int, istate_t *);
-extern void mem_address_not_aligned(unsigned int, istate_t *);
-extern void LDDF_mem_address_not_aligned(unsigned int, istate_t *);
-extern void STDF_mem_address_not_aligned(unsigned int, istate_t *);
-extern void privileged_action(unsigned int, istate_t *);
-extern void LDQF_mem_address_not_aligned(unsigned int, istate_t *);
-extern void STQF_mem_address_not_aligned(unsigned int, istate_t *);
-
-#endif /* !__ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains level N interrupt and inter-processor interrupt
- * trap handler.
- */
-#ifndef KERN_sparc64_INTERRUPT_TRAP_H_
-#define KERN_sparc64_INTERRUPT_TRAP_H_
-
-#define TT_INTERRUPT_LEVEL_1			0x41
-#define TT_INTERRUPT_LEVEL_2			0x42
-#define TT_INTERRUPT_LEVEL_3			0x43
-#define TT_INTERRUPT_LEVEL_4			0x44
-#define TT_INTERRUPT_LEVEL_5			0x45
-#define TT_INTERRUPT_LEVEL_6			0x46
-#define TT_INTERRUPT_LEVEL_7			0x47
-#define TT_INTERRUPT_LEVEL_8			0x48
-#define TT_INTERRUPT_LEVEL_9			0x49
-#define TT_INTERRUPT_LEVEL_10			0x4a
-#define TT_INTERRUPT_LEVEL_11			0x4b
-#define TT_INTERRUPT_LEVEL_12			0x4c
-#define TT_INTERRUPT_LEVEL_13			0x4d
-#define TT_INTERRUPT_LEVEL_14			0x4e
-#define TT_INTERRUPT_LEVEL_15			0x4f
-
-#define INTERRUPT_LEVEL_N_HANDLER_SIZE		TRAP_TABLE_ENTRY_SIZE
-
-/* IMAP register bits */
-#define IGN_MASK	0x7c0
-#define INO_MASK	0x1f
-#define IMAP_V_MASK	(1ULL << 31)
-
-#define IGN_SHIFT	6
-
-#ifndef __ASSEMBLER__
-
-#include <arch/interrupt.h>
-
-extern void interrupt(unsigned int n, istate_t *istate);
-
-#endif /* !def __ASSEMBLER__ */
-
-#if defined (SUN4U)
-#include <arch/trap/sun4u/interrupt.h>
-#elif defined (SUN4V)
-#include <arch/trap/sun4v/interrupt.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains fast MMU trap handlers.
- */
-
-#ifndef KERN_sparc64_MMU_TRAP_H_
-#define KERN_sparc64_MMU_TRAP_H_
-
-#if defined (SUN4U)
-#include <arch/trap/sun4u/mmu.h>
-#elif defined (SUN4V)
-#include <arch/trap/sun4v/mmu.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/regwin.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/regwin.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains register window trap handlers.
- */
-
-/*
- * Macro used by the nucleus and the primary context 0 during normal and other spills.
- */
-.macro SPILL_NORMAL_HANDLER_KERNEL
-	stx %l0, [%sp + STACK_BIAS + L0_OFFSET]
-	stx %l1, [%sp + STACK_BIAS + L1_OFFSET]
-	stx %l2, [%sp + STACK_BIAS + L2_OFFSET]
-	stx %l3, [%sp + STACK_BIAS + L3_OFFSET]
-	stx %l4, [%sp + STACK_BIAS + L4_OFFSET]
-	stx %l5, [%sp + STACK_BIAS + L5_OFFSET]
-	stx %l6, [%sp + STACK_BIAS + L6_OFFSET]
-	stx %l7, [%sp + STACK_BIAS + L7_OFFSET]
-	stx %i0, [%sp + STACK_BIAS + I0_OFFSET]
-	stx %i1, [%sp + STACK_BIAS + I1_OFFSET]
-	stx %i2, [%sp + STACK_BIAS + I2_OFFSET]
-	stx %i3, [%sp + STACK_BIAS + I3_OFFSET]
-	stx %i4, [%sp + STACK_BIAS + I4_OFFSET]
-	stx %i5, [%sp + STACK_BIAS + I5_OFFSET]
-	stx %i6, [%sp + STACK_BIAS + I6_OFFSET]
-	stx %i7, [%sp + STACK_BIAS + I7_OFFSET]
-	saved
-	retry
-.endm
-
-/*
- * Macro used by the userspace during normal spills.
- */
-.macro SPILL_NORMAL_HANDLER_USERSPACE
-	wr %g0, ASI_AIUP, %asi
-	stxa %l0, [%sp + STACK_BIAS + L0_OFFSET] %asi
-	stxa %l1, [%sp + STACK_BIAS + L1_OFFSET] %asi
-	stxa %l2, [%sp + STACK_BIAS + L2_OFFSET] %asi
-	stxa %l3, [%sp + STACK_BIAS + L3_OFFSET] %asi
-	stxa %l4, [%sp + STACK_BIAS + L4_OFFSET] %asi
-	stxa %l5, [%sp + STACK_BIAS + L5_OFFSET] %asi
-	stxa %l6, [%sp + STACK_BIAS + L6_OFFSET] %asi
-	stxa %l7, [%sp + STACK_BIAS + L7_OFFSET] %asi
-	stxa %i0, [%sp + STACK_BIAS + I0_OFFSET] %asi
-	stxa %i1, [%sp + STACK_BIAS + I1_OFFSET] %asi
-	stxa %i2, [%sp + STACK_BIAS + I2_OFFSET] %asi
-	stxa %i3, [%sp + STACK_BIAS + I3_OFFSET] %asi
-	stxa %i4, [%sp + STACK_BIAS + I4_OFFSET] %asi
-	stxa %i5, [%sp + STACK_BIAS + I5_OFFSET] %asi
-	stxa %i6, [%sp + STACK_BIAS + I6_OFFSET] %asi
-	stxa %i7, [%sp + STACK_BIAS + I7_OFFSET] %asi
-	saved
-	retry
-.endm
-
-/*
- * Macro used by the nucleus and the primary context 0 during normal fills.
- */
-.macro FILL_NORMAL_HANDLER_KERNEL
-	ldx [%sp + STACK_BIAS + L0_OFFSET], %l0
-	ldx [%sp + STACK_BIAS + L1_OFFSET], %l1
-	ldx [%sp + STACK_BIAS + L2_OFFSET], %l2
-	ldx [%sp + STACK_BIAS + L3_OFFSET], %l3
-	ldx [%sp + STACK_BIAS + L4_OFFSET], %l4
-	ldx [%sp + STACK_BIAS + L5_OFFSET], %l5
-	ldx [%sp + STACK_BIAS + L6_OFFSET], %l6
-	ldx [%sp + STACK_BIAS + L7_OFFSET], %l7
-	ldx [%sp + STACK_BIAS + I0_OFFSET], %i0
-	ldx [%sp + STACK_BIAS + I1_OFFSET], %i1
-	ldx [%sp + STACK_BIAS + I2_OFFSET], %i2
-	ldx [%sp + STACK_BIAS + I3_OFFSET], %i3
-	ldx [%sp + STACK_BIAS + I4_OFFSET], %i4
-	ldx [%sp + STACK_BIAS + I5_OFFSET], %i5
-	ldx [%sp + STACK_BIAS + I6_OFFSET], %i6
-	ldx [%sp + STACK_BIAS + I7_OFFSET], %i7
-	restored
-	retry
-.endm
-
-/*
- * Macro used by the userspace during normal fills.
- */
-.macro FILL_NORMAL_HANDLER_USERSPACE
-	wr %g0, ASI_AIUP, %asi
-	ldxa [%sp + STACK_BIAS + L0_OFFSET] %asi, %l0
-	ldxa [%sp + STACK_BIAS + L1_OFFSET] %asi, %l1
-	ldxa [%sp + STACK_BIAS + L2_OFFSET] %asi, %l2
-	ldxa [%sp + STACK_BIAS + L3_OFFSET] %asi, %l3
-	ldxa [%sp + STACK_BIAS + L4_OFFSET] %asi, %l4
-	ldxa [%sp + STACK_BIAS + L5_OFFSET] %asi, %l5
-	ldxa [%sp + STACK_BIAS + L6_OFFSET] %asi, %l6
-	ldxa [%sp + STACK_BIAS + L7_OFFSET] %asi, %l7
-	ldxa [%sp + STACK_BIAS + I0_OFFSET] %asi, %i0
-	ldxa [%sp + STACK_BIAS + I1_OFFSET] %asi, %i1
-	ldxa [%sp + STACK_BIAS + I2_OFFSET] %asi, %i2
-	ldxa [%sp + STACK_BIAS + I3_OFFSET] %asi, %i3
-	ldxa [%sp + STACK_BIAS + I4_OFFSET] %asi, %i4
-	ldxa [%sp + STACK_BIAS + I5_OFFSET] %asi, %i5
-	ldxa [%sp + STACK_BIAS + I6_OFFSET] %asi, %i6
-	ldxa [%sp + STACK_BIAS + I7_OFFSET] %asi, %i7
-	restored
-	retry
-.endm
-
-.macro CLEAN_WINDOW_HANDLER
-	rdpr %cleanwin, %l0
-	add %l0, 1, %l0
-	wrpr %l0, 0, %cleanwin
-#if defined(SUN4U)
-	mov %r0, %l0
-	mov %r0, %l1
-	mov %r0, %l2
-	mov %r0, %l3
-	mov %r0, %l4
-	mov %r0, %l5
-	mov %r0, %l6
-	mov %r0, %l7
-	mov %r0, %o0
-	mov %r0, %o1
-	mov %r0, %o2
-	mov %r0, %o3
-	mov %r0, %o4
-	mov %r0, %o5
-	mov %r0, %o6
-	mov %r0, %o7
-#endif
-	retry
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/regwin.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/regwin.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains register window trap handlers.
- */
-
-#ifndef KERN_sparc64_REGWIN_H_
-#define KERN_sparc64_REGWIN_H_
-
-#include <arch/stack.h>
-#include <arch/arch.h>
-#include <align.h>
-
-#define TT_CLEAN_WINDOW			0x24
-#define TT_SPILL_0_NORMAL		0x80	/* kernel spills */
-#define TT_SPILL_1_NORMAL		0x84	/* userspace spills */
-#define TT_SPILL_2_NORMAL		0x88	/* spills to userspace window buffer */
-#define TT_SPILL_0_OTHER		0xa0	/* spills to userspace window buffer */
-#define TT_FILL_0_NORMAL		0xc0	/* kernel fills */
-#define TT_FILL_1_NORMAL		0xc4	/* userspace fills */
-
-#define REGWIN_HANDLER_SIZE		128
-
-#define CLEAN_WINDOW_HANDLER_SIZE	REGWIN_HANDLER_SIZE
-#define SPILL_HANDLER_SIZE		REGWIN_HANDLER_SIZE
-#define FILL_HANDLER_SIZE		REGWIN_HANDLER_SIZE
-
-/* Window Save Area offsets. */
-#define L0_OFFSET	0
-#define L1_OFFSET	8
-#define L2_OFFSET	16
-#define L3_OFFSET	24
-#define L4_OFFSET	32
-#define L5_OFFSET	40
-#define L6_OFFSET	48
-#define L7_OFFSET	56
-#define I0_OFFSET	64
-#define I1_OFFSET	72
-#define I2_OFFSET	80
-#define I3_OFFSET	88
-#define I4_OFFSET	96
-#define I5_OFFSET	104
-#define I6_OFFSET	112
-#define I7_OFFSET	120
-
-/* Uspace Window Buffer constants. */
-#define UWB_SIZE	((NWINDOWS - 1) * STACK_WINDOW_SAVE_AREA_SIZE)
-#define UWB_ALIGNMENT	1024
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/regwin.S>
-#endif /* __ASSEMBLER__ */
-
-#if defined(SUN4U)
-#include <arch/trap/sun4u/regwin.h>
-#elif defined(SUN4V)
-#include <arch/trap/sun4v/regwin.h>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4u/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4u/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains interrupt vector trap handler.
- */
-
-#ifndef KERN_sparc64_TRAP_SUN4U_INTERRUPT_H_
-#define KERN_sparc64_TRAP_SUN4U_INTERRUPT_H_
-
-#include <arch/trap/trap_table.h>
-#include <arch/stack.h>
-
-/* Interrupt ASI registers. */
-#define ASI_INTR_W			0x77
-#define ASI_INTR_DISPATCH_STATUS	0x48
-#define ASI_INTR_R			0x7f
-#define ASI_INTR_RECEIVE		0x49
-
-/* VA's used with ASI_INTR_W register. */
-#if defined (US)
-#define ASI_UDB_INTR_W_DATA_0	0x40
-#define ASI_UDB_INTR_W_DATA_1	0x50
-#define ASI_UDB_INTR_W_DATA_2	0x60
-#elif defined (US3)
-#define VA_INTR_W_DATA_0	0x40
-#define VA_INTR_W_DATA_1	0x48
-#define VA_INTR_W_DATA_2	0x50
-#define VA_INTR_W_DATA_3	0x58
-#define VA_INTR_W_DATA_4	0x60
-#define VA_INTR_W_DATA_5	0x68
-#define VA_INTR_W_DATA_6	0x80
-#define VA_INTR_W_DATA_7	0x88
-#endif
-#define VA_INTR_W_DISPATCH	0x70
-
-/* VA's used with ASI_INTR_R register. */
-#if defined(US)
-#define ASI_UDB_INTR_R_DATA_0	0x40
-#define ASI_UDB_INTR_R_DATA_1	0x50
-#define ASI_UDB_INTR_R_DATA_2	0x60
-#elif defined (US3)
-#define VA_INTR_R_DATA_0	0x40
-#define VA_INTR_R_DATA_1	0x48
-#define VA_INTR_R_DATA_2	0x50
-#define VA_INTR_R_DATA_3	0x58
-#define VA_INTR_R_DATA_4	0x60
-#define VA_INTR_R_DATA_5	0x68
-#define VA_INTR_R_DATA_6	0x80
-#define VA_INTR_R_DATA_7	0x88
-#endif
-
-/* Shifts in the Interrupt Vector Dispatch virtual address. */
-#define INTR_VEC_DISPATCH_MID_SHIFT	14
-
-/* Bits in the Interrupt Dispatch Status register. */
-#define INTR_DISPATCH_STATUS_NACK	0x2
-#define INTR_DISPATCH_STATUS_BUSY	0x1
-
-#define TT_INTERRUPT_VECTOR_TRAP		0x60
-
-#define INTERRUPT_VECTOR_TRAP_HANDLER_SIZE	TRAP_TABLE_ENTRY_SIZE
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4u/mmu.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4u/mmu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains fast MMU trap handlers.
- */
-
-.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
-	/*
-	 * First, try to refill TLB from TSB.
-	 */
-#ifdef CONFIG_TSB
-	ldxa [%g0] ASI_IMMU, %g1			! read TSB Tag Target Register
-	ldxa [%g0] ASI_IMMU_TSB_8KB_PTR_REG, %g2	! read TSB 8K Pointer
-	ldda [%g2] ASI_NUCLEUS_QUAD_LDD, %g4		! 16-byte atomic load into %g4 and %g5
-	cmp %g1, %g4					! is this the entry we are looking for?
-	bne,pn %xcc, 0f
-	nop
-	stxa %g5, [%g0] ASI_ITLB_DATA_IN_REG		! copy mapping from ITSB to ITLB
-	retry
-#endif
-
-0:
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
-	mov TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, %g2
-	mov VA_IMMU_TAG_ACCESS, %g5
-	ldxa [%g5] ASI_IMMU, %g5			! read the faulting Context and VPN
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-.macro FAST_DATA_ACCESS_MMU_MISS_HANDLER tl
-	/*
-	 * First, try to refill TLB from TSB.
-	 */
-
-#ifdef CONFIG_TSB
-	ldxa [%g0] ASI_DMMU, %g1			! read TSB Tag Target Register
-	srlx %g1, TSB_TAG_TARGET_CONTEXT_SHIFT, %g2	! is this a kernel miss?
-	brz,pn %g2, 0f
-	ldxa [%g0] ASI_DMMU_TSB_8KB_PTR_REG, %g3	! read TSB 8K Pointer
-	ldda [%g3] ASI_NUCLEUS_QUAD_LDD, %g4		! 16-byte atomic load into %g4 and %g5
-	cmp %g1, %g4					! is this the entry we are looking for?
-	bne,pn %xcc, 0f
-	nop
-	stxa %g5, [%g0] ASI_DTLB_DATA_IN_REG		! copy mapping from DTSB to DTLB
-	retry
-#endif
-
-	/*
-	 * Second, test if it is the portion of the kernel address space
-	 * which is faulting. If that is the case, immediately create
-	 * identity mapping for that page in DTLB. VPN 0 is excluded from
-	 * this treatment.
-	 *
-	 * Note that branch-delay slots are used in order to save space.
-	 */
-0:
-	sethi %hi(fast_data_access_mmu_miss_data_hi), %g7
-	wr %g0, ASI_DMMU, %asi
-	ldxa [VA_DMMU_TAG_ACCESS] %asi, %g1		! read the faulting Context and VPN
-	ldx [%g7 + %lo(tlb_tag_access_context_mask)], %g2
-	andcc %g1, %g2, %g3				! get Context
-	bnz %xcc, 0f					! Context is non-zero
-	andncc %g1, %g2, %g3				! get page address into %g3
-	bz  %xcc, 0f					! page address is zero
-	ldx [%g7 + %lo(end_of_identity)], %g4
-	cmp %g3, %g4
-	bgeu %xcc, 0f
-
-	ldx [%g7 + %lo(kernel_8k_tlb_data_template)], %g2
-	add %g3, %g2, %g2
-	stxa %g2, [%g0] ASI_DTLB_DATA_IN_REG		! identity map the kernel page
-	retry
-
-	/*
-	 * Third, catch and handle special cases when the trap is caused by
-	 * the userspace register window spill or fill handler. In case
-	 * one of these two traps caused this trap, we just lower the trap
-	 * level and service the DTLB miss. In the end, we restart
-	 * the offending SAVE or RESTORE.
-	 */
-0:
-.if (\tl > 0)
-	wrpr %g0, 1, %tl
-.endif
-
-	/*
-	 * Switch from the MM globals.
-	 */
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
-
-	mov TT_FAST_DATA_ACCESS_MMU_MISS, %g2
-	ldxa [VA_DMMU_TAG_ACCESS] %asi, %g5		! read the faulting Context and VPN
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-.macro FAST_DATA_ACCESS_PROTECTION_HANDLER tl
-	/*
-	 * The same special case as in FAST_DATA_ACCESS_MMU_MISS_HANDLER.
-	 */
-
-.if (\tl > 0)
-	wrpr %g0, 1, %tl
-.endif
-
-	/*
-	 * Switch from the MM globals.
-	 */
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_AG_BIT, %pstate
-
-	mov TT_FAST_DATA_ACCESS_PROTECTION, %g2
-	mov VA_DMMU_TAG_ACCESS, %g5
-	ldxa [%g5] ASI_DMMU, %g5			! read the faulting Context and VPN
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4u/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4u/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains fast MMU trap handlers.
- */
-
-#ifndef KERN_sparc64_SUN4U_MMU_TRAP_H_
-#define KERN_sparc64_SUN4U_MMU_TRAP_H_
-
-#include <arch/stack.h>
-#include <arch/regdef.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/mmu.h>
-#include <arch/mm/tte.h>
-#include <arch/trap/regwin.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#endif
-
-#define TT_FAST_INSTRUCTION_ACCESS_MMU_MISS	0x64
-#define TT_FAST_DATA_ACCESS_MMU_MISS		0x68
-#define TT_FAST_DATA_ACCESS_PROTECTION		0x6c
-
-#define FAST_MMU_HANDLER_SIZE			128
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/sun4u/mmu.S>
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4u/regwin.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4u/regwin.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-
-/*
- * Macro used to spill userspace window to userspace window buffer.
- * It can be either triggered from preemptible_handler doing SAVE
- * at (TL=1) or from normal kernel code doing SAVE when OTHERWIN>0
- * at (TL=0).
- */
-.macro SPILL_TO_USPACE_WINDOW_BUFFER
-	stx %l0, [%g7 + L0_OFFSET]
-	stx %l1, [%g7 + L1_OFFSET]
-	stx %l2, [%g7 + L2_OFFSET]
-	stx %l3, [%g7 + L3_OFFSET]
-	stx %l4, [%g7 + L4_OFFSET]
-	stx %l5, [%g7 + L5_OFFSET]
-	stx %l6, [%g7 + L6_OFFSET]
-	stx %l7, [%g7 + L7_OFFSET]
-	stx %i0, [%g7 + I0_OFFSET]
-	stx %i1, [%g7 + I1_OFFSET]
-	stx %i2, [%g7 + I2_OFFSET]
-	stx %i3, [%g7 + I3_OFFSET]
-	stx %i4, [%g7 + I4_OFFSET]
-	stx %i5, [%g7 + I5_OFFSET]
-	stx %i6, [%g7 + I6_OFFSET]
-	stx %i7, [%g7 + I7_OFFSET]
-	add %g7, STACK_WINDOW_SAVE_AREA_SIZE, %g7
-	saved
-	retry
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4u/regwin.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4u/regwin.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-#ifndef KERN_sparc64_sun4u_REGWIN_H_
-#define KERN_sparc64_sun4u_REGWIN_H_
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/sun4u/regwin.S>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4v/interrupt.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4v/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains interrupt vector trap handler.
- */
-
-#ifndef KERN_sparc64_TRAP_SUN4V_INTERRUPT_H_
-#define KERN_sparc64_TRAP_SUN4V_INTERRUPT_H_
-
-#ifndef __ASSEMBLER__
-
-#include <arch/istate_struct.h>
-
-extern void sun4v_ipi_init(void);
-extern void cpu_mondo(unsigned int, istate_t *);
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4v/mmu.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4v/mmu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains fast MMU trap handlers.
- */
-
-/* MMU fault status area data fault offset */
-#define FSA_DFA_OFFSET				0x48
-
-/* MMU fault status area data context */
-#define FSA_DFC_OFFSET				0x50
-
-/* offset of the target address within the TTE Data entry */
-#define TTE_DATA_TADDR_OFFSET			13
-
-.macro FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
-	mov TT_FAST_INSTRUCTION_ACCESS_MMU_MISS, %g2
-	clr %g5		! XXX
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-/*
- * Handler of the Fast Data Access MMU Miss trap. If the trap occurred in the kernel
- * (context 0), an identity mapping (with displacement) is installed. Otherwise
- * a higher level service routine is called.
- */
-.macro FAST_DATA_ACCESS_MMU_MISS_HANDLER tl
-	mov SCRATCHPAD_MMU_FSA, %g1
-	ldxa [%g1] ASI_SCRATCHPAD, %g1			! g1 <= RA of MMU fault status area
-
-	/* read faulting context */
-	add %g1, FSA_DFC_OFFSET, %g2			! g2 <= RA of data fault context
-	ldxa [%g2] ASI_REAL, %g3			! read the fault context
-
-	/* read the faulting address */
-	add %g1, FSA_DFA_OFFSET, %g2			! g2 <= RA of data fault address
-	ldxa [%g2] ASI_REAL, %g1			! read the fault address
-	srlx %g1, TTE_DATA_TADDR_OFFSET, %g1		! truncate it to page boundary
-	sllx %g1, TTE_DATA_TADDR_OFFSET, %g1
-
-	/* service by higher-level routine when context != 0 */
-	brnz %g3, 0f
-	nop
-	/* exclude page number 0 from installing the identity mapping */
-	brz %g1, 0f
-	nop
-
-	/* exclude pages beyond the end of memory from the identity mapping */
-	sethi %hi(end_of_identity), %g4
-	ldx [%g4 + %lo(end_of_identity)], %g4
-	cmp %g1, %g4
-	bgeu %xcc, 0f
-	nop
-
-	/*
-	 * Installing the identity does not fit into 32 instructions, call
-	 * a separate routine. The routine performs RETRY, hence the call never
-	 * returns.
-	 */
-	ba,a %xcc, install_identity_mapping
-
-0:
-
-	/*
-	 * One of the scenarios in which this trap can occur is when the
-	 * register window spill/fill handler accesses a memory which is not
-	 * mapped. In such a case, this handler will be called from TL = 1.
-	 * We handle the situation by pretending that the MMU miss occurred
-	 * on TL = 0. Once the MMU miss trap is serviced, the instruction which
-	 * caused the spill/fill trap is restarted, the spill/fill trap occurs,
-	 * but this time its handler accesses memory which is mapped.
-	 */
-	.if (\tl > 0)
-		wrpr %g0, 1, %tl
-	.endif
-
-	mov TT_FAST_DATA_ACCESS_MMU_MISS, %g2
-
-	/*
-	 * Save the faulting virtual page and faulting context to the %g5
-	 * register. The most significant 51 bits of the %g5 register will
-	 * contain the virtual address which caused the fault truncated to the
-	 * page boundary. The least significant 13 bits of the %g5 register
-	 * will contain the number of the context in which the fault occurred.
-	 * The value of the %g5 register will be stored in the istate structure
-	 * for inspeciton by the higher level service routine.
-	 */
-	or %g1, %g3, %g5
-
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-/*
- * Handler of the Fast Data MMU Protection trap. Finds the trapping address
- * and context and calls higher level service routine.
- */
-.macro FAST_DATA_ACCESS_PROTECTION_HANDLER tl
-	/*
-	 * The same special case as in FAST_DATA_ACCESS_MMU_MISS_HANDLER.
-	 */
-	.if (\tl > 0)
-		wrpr %g0, 1, %tl
-	.endif
-
-	mov SCRATCHPAD_MMU_FSA, %g1
-	ldxa [%g1] ASI_SCRATCHPAD, %g1			! g1 <= RA of MMU fault status area
-
-	/* read faulting context */
-	add %g1, FSA_DFC_OFFSET, %g2			! g2 <= RA of data fault context
-	ldxa [%g2] ASI_REAL, %g3			! read the fault context
-
-	/* read the faulting address */
-	add %g1, FSA_DFA_OFFSET, %g2			! g2 <= RA of data fault address
-	ldxa [%g2] ASI_REAL, %g1			! read the fault address
-	srlx %g1, TTE_DATA_TADDR_OFFSET, %g1		! truncate it to page boundary
-	sllx %g1, TTE_DATA_TADDR_OFFSET, %g1
-
-	mov TT_FAST_DATA_ACCESS_PROTECTION, %g2
-
-	/* the same as for FAST_DATA_ACCESS_MMU_MISS_HANDLER */
-	or %g1, %g3, %g5
-
-	PREEMPTIBLE_HANDLER exc_dispatch
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4v/mmu.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4v/mmu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief This file contains fast MMU trap handlers.
- */
-
-#ifndef KERN_sparc64_sun4v_MMU_TRAP_H_
-#define KERN_sparc64_sun4v_MMU_TRAP_H_
-
-#include <arch/stack.h>
-#include <arch/regdef.h>
-#include <arch/arch.h>
-#include <arch/sun4v/arch.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/mm/sun4v/mmu.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/mmu.h>
-#include <arch/mm/tte.h>
-#include <arch/trap/regwin.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#endif
-
-#define TT_FAST_INSTRUCTION_ACCESS_MMU_MISS	0x64
-#define TT_FAST_DATA_ACCESS_MMU_MISS		0x68
-#define TT_FAST_DATA_ACCESS_PROTECTION		0x6c
-#define TT_CPU_MONDO				0x7c
-
-#define FAST_MMU_HANDLER_SIZE			128
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/sun4v/mmu.S>
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4v/regwin.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4v/regwin.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-
-/*
- * Saves the contents of the current window to the userspace window buffer.
- * Does not modify any register window registers, but updates pointer to the
- * top of the userspace window buffer.
- *
- * Parameters:
- * 	\tmpreg1	global register to be used for scratching purposes
- * 	\tmpreg2	global register to be used for scratching purposes
- */
-.macro SAVE_TO_USPACE_WBUF tmpreg1, tmpreg2
-	set SCRATCHPAD_WBUF, \tmpreg2
-	ldxa [\tmpreg2] ASI_SCRATCHPAD, \tmpreg1
-	stx %l0, [\tmpreg1 + L0_OFFSET]
-	stx %l1, [\tmpreg1 + L1_OFFSET]
-	stx %l2, [\tmpreg1 + L2_OFFSET]
-	stx %l3, [\tmpreg1 + L3_OFFSET]
-	stx %l4, [\tmpreg1 + L4_OFFSET]
-	stx %l5, [\tmpreg1 + L5_OFFSET]
-	stx %l6, [\tmpreg1 + L6_OFFSET]
-	stx %l7, [\tmpreg1 + L7_OFFSET]
-	stx %i0, [\tmpreg1 + I0_OFFSET]
-	stx %i1, [\tmpreg1 + I1_OFFSET]
-	stx %i2, [\tmpreg1 + I2_OFFSET]
-	stx %i3, [\tmpreg1 + I3_OFFSET]
-	stx %i4, [\tmpreg1 + I4_OFFSET]
-	stx %i5, [\tmpreg1 + I5_OFFSET]
-	stx %i6, [\tmpreg1 + I6_OFFSET]
-	stx %i7, [\tmpreg1 + I7_OFFSET]
-	add \tmpreg1, STACK_WINDOW_SAVE_AREA_SIZE, \tmpreg1
-	stxa \tmpreg1, [\tmpreg2] ASI_SCRATCHPAD
-.endm
-
-/*
- * Macro used to spill userspace window to userspace window buffer.
- * It is triggered from normal kernel code doing SAVE when
- * OTHERWIN>0 at (TL=0).
- */
-.macro SPILL_TO_USPACE_WINDOW_BUFFER
-	SAVE_TO_USPACE_WBUF %g7, %g4
-	saved
-	retry
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/sun4v/regwin.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/sun4v/regwin.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-#ifndef KERN_sparc64_sun4v_REGWIN_H_
-#define KERN_sparc64_sun4v_REGWIN_H_
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/sun4v/regwin.S>
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/syscall.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef KERN_sparc64_SYSCALL_TRAP_H_
-#define KERN_sparc64_SYSCALL_TRAP_H_
-
-#define TT_TRAP_INSTRUCTION_0		0x100
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/trap.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/trap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TRAP_H_
-#define KERN_sparc64_TRAP_H_
-
-extern void trap_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/trap_table.S
===================================================================
--- kernel/arch/sparc64/include/arch/trap/trap_table.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-.macro SAVE_GLOBALS
-	mov %g1, %l1
-	mov %g2, %l2
-	mov %g3, %l3
-	mov %g4, %l4
-	mov %g5, %l5
-	mov %g6, %l6
-	mov %g7, %l7
-.endm
-
-.macro RESTORE_GLOBALS
-	mov %l1, %g1
-	mov %l2, %g2
-	mov %l3, %g3
-	mov %l4, %g4
-	mov %l5, %g5
-	mov %l6, %g6
-	mov %l7, %g7
-.endm
-
-.macro PREEMPTIBLE_HANDLER f
-	sethi %hi(\f), %g1
-	ba %xcc, preemptible_handler
-	or %g1, %lo(\f), %g1
-.endm
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/trap/trap_table.h
===================================================================
--- kernel/arch/sparc64/include/arch/trap/trap_table.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TRAP_TABLE_H_
-#define KERN_sparc64_TRAP_TABLE_H_
-
-#include <arch/stack.h>
-#include <arch/istate_struct.h>
-
-#define TRAP_TABLE_ENTRY_COUNT	1024
-#define TRAP_TABLE_ENTRY_SIZE	32
-#define TRAP_TABLE_SIZE		(TRAP_TABLE_ENTRY_COUNT * TRAP_TABLE_ENTRY_SIZE)
-
-#ifdef __ASSEMBLER__
-#include <arch/trap/trap_table.S>
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/include/arch/types.h
===================================================================
--- kernel/arch/sparc64/include/arch/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_sparc64_TYPES_H_
-#define KERN_sparc64_TYPES_H_
-
-#include <_bits/all.h>
-
-typedef struct {
-} fncptr_t;
-
-typedef uint8_t asi_t;
-
-#endif
-
-/** @}
- */
Index: rnel/arch/sparc64/meson.build
===================================================================
--- kernel/arch/sparc64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-if PROCESSOR == 'us' or PROCESSOR == 'us3'
-	USARCH = 'sun4u'
-elif PROCESSOR == 'sun4v'
-	USARCH = 'sun4v'
-else
-	error('Unknown PROCESSOR: ' + PROCESSOR)
-endif
-
-arch_src += files(
-	'src/sparc64.c',
-	'src/cpu' / USARCH / 'cpu.c',
-	'src/debug/stacktrace.c',
-	'src/debug/stacktrace_asm.S',
-	'src/asm.S',
-	'src' / USARCH / 'asm.S',
-	'src/console.c',
-	'src/context.S',
-	'src/fpu_context.c',
-	'src/dummy.S',
-	'src/mm' / USARCH / 'km.c',
-	'src/mm' / USARCH / 'as.c',
-	'src/mm' / USARCH / 'frame.c',
-	'src/mm/page.c',
-	'src/mm' / USARCH / 'tlb.c',
-	'src' / USARCH / 'sparc64.c',
-	'src' / USARCH / 'start.S',
-	'src/proc' / USARCH / 'scheduler.c',
-	'src/proc/thread.c',
-	'src/smc.c',
-	'src/trap' / USARCH / 'mmu.S',
-	'src/trap' / USARCH / 'trap_table.S',
-	'src/trap/trap.c',
-	'src/trap/exception.c',
-	'src/trap/interrupt.c',
-	'src/drivers/tick.c',
-	'src/drivers/kbd.c',
-	'src/drivers/tty.c',
-	'src/drivers/pci.c',
-	'src/trap' / USARCH / 'interrupt.c',
-)
-
-if USARCH == 'sun4v'
-	arch_src += files(
-		'src/drivers/niagara.c',
-		'src/sun4v/md.c',
-	)
-endif
-
-if CONFIG_FB
-	arch_src += files(
-		'src/drivers/scr.c',
-	)
-endif
-
-if CONFIG_SMP
-	arch_src += files(
-		'src/smp' / USARCH / 'smp.c',
-		'src/smp' / USARCH / 'ipi.c',
-	)
-endif
-
-if CONFIG_TSB
-	arch_src += files(
-		'src/mm' / USARCH / 'tsb.c',
-	)
-endif
-
-
-_check_headers = [
-	'include/arch/istate_struct.h',
-	'include/arch/context_struct.h',
-]
-
-foreach h : _check_headers
-	arch_src += [ autocheck.process(h) ]
-endforeach
Index: rnel/arch/sparc64/src/asm.S
===================================================================
--- kernel/arch/sparc64/src/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/stack.h>
-
-.text
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-/*
- * Almost the same as memcpy() except the loads are from userspace.
- */
-FUNCTION_BEGIN(memcpy_from_uspace)
-	mov %o0, %o3  /* save dst */
-	add %o1, 7, %g1
-	and %g1, -8, %g1
-	cmp %o1, %g1
-	be,pn %xcc, 3f
-	add %o0, 7, %g1
-	mov 0, %g3
-
-	0:
-
-		brz,pn %o2, 2f
-		mov 0, %g2
-
-	1:
-
-		lduba [%g3 + %o1] ASI_AIUS, %g1
-		add %g2, 1, %g2
-		cmp %o2, %g2
-		stb %g1, [%g3 + %o0]
-		bne,pt %xcc, 1b
-		mov %g2, %g3
-
-	2:
-
-		jmp %o7 + 8  /* exit point */
-		mov %o3, %o0
-
-	3:
-
-		and %g1, -8, %g1
-		cmp %o0, %g1
-		bne,pt %xcc, 0b
-		mov 0, %g3
-		srlx %o2, 3, %g4
-		brz,pn %g4, 5f
-		mov 0, %g5
-
-	4:
-
-		sllx %g3, 3, %g2
-		add %g5, 1, %g3
-		ldxa [%o1 + %g2] ASI_AIUS, %g1
-		mov %g3, %g5
-		cmp %g4, %g3
-		bne,pt %xcc, 4b
-		stx %g1, [%o0 + %g2]
-
-	5:
-
-		and %o2, 7, %o2
-		brz,pn %o2, 2b
-		sllx %g4, 3, %g1
-		mov 0, %g2
-		add %g1, %o0, %o0
-		add %g1, %o1, %g4
-		mov 0, %g3
-
-	6:
-
-		lduba [%g2 + %g4] ASI_AIUS, %g1
-		stb %g1, [%g2 + %o0]
-		add %g3, 1, %g2
-		cmp %o2, %g2
-		bne,pt %xcc, 6b
-		mov %g2, %g3
-
-		jmp %o7 + 8  /* exit point */
-		mov %o3, %o0
-FUNCTION_END(memcpy_from_uspace)
-
-/*
- * Almost the same as memcpy() except the stores are to userspace.
- */
-FUNCTION_BEGIN(memcpy_to_uspace)
-	mov %o0, %o3  /* save dst */
-	add %o1, 7, %g1
-	and %g1, -8, %g1
-	cmp %o1, %g1
-	be,pn %xcc, 3f
-	add %o0, 7, %g1
-	mov 0, %g3
-
-	0:
-
-		brz,pn %o2, 2f
-		mov 0, %g2
-
-	1:
-
-		ldub [%g3 + %o1], %g1
-		add %g2, 1, %g2
-		cmp %o2, %g2
-		stba %g1, [%g3 + %o0] ASI_AIUS
-		bne,pt %xcc, 1b
-		mov %g2, %g3
-
-	2:
-
-		jmp %o7 + 8  /* exit point */
-		mov %o3, %o0
-
-	3:
-
-		and %g1, -8, %g1
-		cmp %o0, %g1
-		bne,pt %xcc, 0b
-		mov 0, %g3
-		srlx %o2, 3, %g4
-		brz,pn %g4, 5f
-		mov 0, %g5
-
-	4:
-
-		sllx %g3, 3, %g2
-		add %g5, 1, %g3
-		ldx [%o1 + %g2], %g1
-		mov %g3, %g5
-		cmp %g4, %g3
-		bne,pt %xcc, 4b
-		stxa %g1, [%o0 + %g2] ASI_AIUS
-
-	5:
-
-		and %o2, 7, %o2
-		brz,pn %o2, 2b
-		sllx %g4, 3, %g1
-		mov 0, %g2
-		add %g1, %o0, %o0
-		add %g1, %o1, %g4
-		mov 0, %g3
-
-	6:
-
-		ldub [%g2 + %g4], %g1
-		stba %g1, [%g2 + %o0] ASI_AIUS
-		add %g3, 1, %g2
-		cmp %o2, %g2
-		bne,pt %xcc, 6b
-		mov %g2, %g3
-
-		jmp	%o7 + 8  /* exit point */
-		mov	%o3, %o0
-FUNCTION_END(memcpy_to_uspace)
-
-SYMBOL(memcpy_from_uspace_failover_address)
-SYMBOL(memcpy_to_uspace_failover_address)
-	jmp %o7 + 8   /* exit point */
-	mov %g0, %o0  /* return 0 on failure */
-
-FUNCTION_BEGIN(early_putuchar)
-	retl
-	nop
-FUNCTION_END(early_putuchar)
Index: rnel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch/console.h>
-
-#include <arch/drivers/scr.h>
-#include <arch/drivers/kbd.h>
-#include <arch/drivers/tty.h>
-#include <genarch/srln/srln.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <arch/asm.h>
-#include <arch/register.h>
-#include <proc/thread.h>
-#include <arch/mm/tlb.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <arch.h>
-#include <panic.h>
-#include <str.h>
-
-#define KEYBOARD_POLL_PAUSE	50000	/* 50ms */
-
-/**
- * Initialize kernel console to use framebuffer and keyboard directly.
- * Called on UltraSPARC machines with standard keyboard and framebuffer.
- *
- * @param aliases	the "/aliases" OBP node
- */
-static void standard_console_init(ofw_tree_node_t *aliases)
-{
-#ifdef CONFIG_FB
-	ofw_tree_property_t *prop_scr = ofw_tree_getprop(aliases, "screen");
-	if (!prop_scr)
-		panic("Cannot find property 'screen'.");
-	if (!prop_scr->value)
-		panic("Cannot find screen alias.");
-	ofw_tree_node_t *screen = ofw_tree_lookup(prop_scr->value);
-	if (!screen)
-		panic("Cannot find %s.", (char *) prop_scr->value);
-
-	scr_init(screen);
-#endif
-
-#ifdef CONFIG_SUN_KBD
-	ofw_tree_property_t *prop_kbd = ofw_tree_getprop(aliases, "keyboard");
-	if (!prop_kbd)
-		panic("Cannot find property 'keyboard'.");
-	if (!prop_kbd->value)
-		panic("Cannot find keyboard alias.");
-	ofw_tree_node_t *keyboard = ofw_tree_lookup(prop_kbd->value);
-	if (!keyboard)
-		panic("Cannot find %s.", (char *) prop_kbd->value);
-
-	kbd_init(keyboard);
-#endif
-
-#ifdef CONFIG_SUN_TTY
-	ofw_tree_property_t *prop_tty = ofw_tree_getprop(aliases, "ttya");
-	if (prop_tty && prop_tty->value) {
-		ofw_tree_node_t *tty = ofw_tree_lookup(prop_tty->value);
-		if (tty)
-			tty_init(tty);
-	}
-#endif
-}
-
-/**
- * Initialize input/output. Auto-detects the type of machine
- * and calls the appropriate I/O init routine.
- */
-void standalone_sparc64_console_init(void)
-{
-	ofw_tree_node_t *aliases;
-	ofw_tree_property_t *prop;
-
-	aliases = ofw_tree_lookup("/aliases");
-	if (!aliases)
-		panic("Cannot find '/aliases'.");
-
-	/* "def-cn" = "default console" */
-	prop = ofw_tree_getprop(aliases, "def-cn");
-
-	if ((!prop) || (!prop->value))
-		standard_console_init(aliases);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/context.S
===================================================================
--- kernel/arch/sparc64/src/context.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/context_struct.h>
-#include <arch/arch.h>
-#include <arch/regdef.h>
-
-.text
-
-/*
- * context_save_arch() is required not to create its own stack frame. See the
- * generic context.h for explanation.
- */
-FUNCTION_BEGIN(context_save_arch)
-	#
-	# Force all our active register windows to memory so that we can find
-	# them there even if e.g. the thread is migrated to another processor.
-	#
-	flushw
-
-	stx %sp, [%o0 + CONTEXT_OFFSET_SP]
-	stx %o7, [%o0 + CONTEXT_OFFSET_PC]
-	stx %i0, [%o0 + CONTEXT_OFFSET_I0]
-	stx %i1, [%o0 + CONTEXT_OFFSET_I1]
-	stx %i2, [%o0 + CONTEXT_OFFSET_I2]
-	stx %i3, [%o0 + CONTEXT_OFFSET_I3]
-	stx %i4, [%o0 + CONTEXT_OFFSET_I4]
-	stx %i5, [%o0 + CONTEXT_OFFSET_I5]
-	stx %fp, [%o0 + CONTEXT_OFFSET_FP]
-	stx %i7, [%o0 + CONTEXT_OFFSET_I7]
-	stx %l0, [%o0 + CONTEXT_OFFSET_L0]
-	stx %l1, [%o0 + CONTEXT_OFFSET_L1]
-	stx %l2, [%o0 + CONTEXT_OFFSET_L2]
-	stx %l3, [%o0 + CONTEXT_OFFSET_L3]
-	stx %l4, [%o0 + CONTEXT_OFFSET_L4]
-	stx %l5, [%o0 + CONTEXT_OFFSET_L5]
-	stx %l6, [%o0 + CONTEXT_OFFSET_L6]
-	stx %l7, [%o0 + CONTEXT_OFFSET_L7]
-	stx %g7, [%o0 + CONTEXT_OFFSET_TP]
-	retl
-	mov 1, %o0		! context_save_arch returns 1
-FUNCTION_END(context_save_arch)
-
-FUNCTION_BEGIN(context_restore_arch)
-	#
-	# Forget all previous windows, they are not going to be needed again.
-	# Enforce a window fill on the next RESTORE instruction by setting
-	# CANRESTORE to zero and other window configuration registers
-	# accordingly. Note that the same can be achieved by executing the
-	# FLUSHW instruction, but since we don't need to remember the previous
-	# windows, we do the former and save thus some unnecessary window
-	# spills.
-	#
-	rdpr %pstate, %l0
-	andn %l0, PSTATE_IE_BIT, %l1
-	wrpr %l1, %pstate
-	wrpr %g0, 0, %canrestore
-	wrpr %g0, 0, %otherwin
-	wrpr %g0, NWINDOWS - 2, %cansave
-	wrpr %l0, %pstate
-
-	ldx [%o0 + CONTEXT_OFFSET_SP], %sp
-	ldx [%o0 + CONTEXT_OFFSET_PC], %o7
-	ldx [%o0 + CONTEXT_OFFSET_I0], %i0
-	ldx [%o0 + CONTEXT_OFFSET_I1], %i1
-	ldx [%o0 + CONTEXT_OFFSET_I2], %i2
-	ldx [%o0 + CONTEXT_OFFSET_I3], %i3
-	ldx [%o0 + CONTEXT_OFFSET_I4], %i4
-	ldx [%o0 + CONTEXT_OFFSET_I5], %i5
-	ldx [%o0 + CONTEXT_OFFSET_FP], %fp
-	ldx [%o0 + CONTEXT_OFFSET_I7], %i7
-	ldx [%o0 + CONTEXT_OFFSET_L0], %l0
-	ldx [%o0 + CONTEXT_OFFSET_L1], %l1
-	ldx [%o0 + CONTEXT_OFFSET_L2], %l2
-	ldx [%o0 + CONTEXT_OFFSET_L3], %l3
-	ldx [%o0 + CONTEXT_OFFSET_L4], %l4
-	ldx [%o0 + CONTEXT_OFFSET_L5], %l5
-	ldx [%o0 + CONTEXT_OFFSET_L6], %l6
-	ldx [%o0 + CONTEXT_OFFSET_L7], %l7
-	ldx [%o0 + CONTEXT_OFFSET_TP], %g7
-	retl
-	xor %o0, %o0, %o0	! context_restore_arch returns 0
-FUNCTION_END(context_restore_arch)
Index: rnel/arch/sparc64/src/cpu/sun4u/cpu.c
===================================================================
--- kernel/arch/sparc64/src/cpu/sun4u/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch/cpu_family.h>
-#include <cpu.h>
-#include <arch.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <arch/drivers/tick.h>
-#include <stdio.h>
-#include <arch/cpu_node.h>
-
-/**
- * Finds out the clock frequency of the current CPU.
- *
- * @param node	node representing the current CPU in the OFW tree
- * @return 	clock frequency if "node" is the current CPU and no error
- *		occurs,	-1 if "node" is not the current CPU or on error
- */
-static int find_cpu_frequency(ofw_tree_node_t *node)
-{
-	ofw_tree_property_t *prop;
-	uint32_t mid;
-
-	/* 'upa-portid' for US, 'portid' for US-III, 'cpuid' for US-IV */
-	prop = ofw_tree_getprop(node, "upa-portid");
-	if ((!prop) || (!prop->value))
-		prop = ofw_tree_getprop(node, "portid");
-	if ((!prop) || (!prop->value))
-		prop = ofw_tree_getprop(node, "cpuid");
-
-	if (prop && prop->value) {
-		mid = *((uint32_t *) prop->value);
-		if (mid == CPU->arch.mid) {
-			prop = ofw_tree_getprop(node, "clock-frequency");
-			if (prop && prop->value) {
-				return *((uint32_t *) prop->value);
-			}
-		}
-	}
-
-	return -1;
-}
-
-/** Perform sparc64 specific initialization of the processor structure for the
- * current processor.
- */
-void cpu_arch_init(void)
-{
-	ofw_tree_node_t *node;
-	uint32_t clock_frequency = 0;
-
-	CPU->arch.mid = read_mid();
-
-	/*
-	 * Detect processor frequency.
-	 */
-	if (is_us() || is_us_iii()) {
-		node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu");
-		while (node) {
-			int f = find_cpu_frequency(node);
-			if (f != -1)
-				clock_frequency = (uint32_t) f;
-			node = ofw_tree_find_peer_by_device_type(node, "cpu");
-		}
-	} else if (is_us_iv()) {
-		node = ofw_tree_find_child(cpus_parent(), "cmp");
-		while (node) {
-			int f;
-			f = find_cpu_frequency(
-			    ofw_tree_find_child(node, "cpu@0"));
-			if (f != -1)
-				clock_frequency = (uint32_t) f;
-			f = find_cpu_frequency(
-			    ofw_tree_find_child(node, "cpu@1"));
-			if (f != -1)
-				clock_frequency = (uint32_t) f;
-			node = ofw_tree_find_peer_by_name(node, "cmp");
-		}
-	}
-
-	CPU->arch.clock_frequency = clock_frequency;
-	tick_init();
-}
-
-/** Read version information from the current processor. */
-void cpu_identify(void)
-{
-	CPU->arch.ver.value = ver_read();
-}
-
-/** Print version information for a processor.
- *
- * This function is called by the bootstrap processor.
- *
- * @param m Processor structure of the CPU for which version information is to
- * 	be printed.
- */
-void cpu_print_report(cpu_t *m)
-{
-	const char *manuf;
-	const char *impl;
-
-	switch (m->arch.ver.manuf) {
-	case MANUF_FUJITSU:
-		manuf = "Fujitsu";
-		break;
-	case MANUF_ULTRASPARC:
-		manuf = "UltraSPARC";
-		break;
-	case MANUF_SUN:
-		manuf = "Sun";
-		break;
-	default:
-		manuf = "Unknown";
-		break;
-	}
-
-	switch (CPU->arch.ver.impl) {
-	case IMPL_ULTRASPARCI:
-		impl = "UltraSPARC I";
-		break;
-	case IMPL_ULTRASPARCII:
-		impl = "UltraSPARC II";
-		break;
-	case IMPL_ULTRASPARCII_I:
-		impl = "UltraSPARC IIi";
-		break;
-	case IMPL_ULTRASPARCII_E:
-		impl = "UltraSPARC IIe";
-		break;
-	case IMPL_ULTRASPARCIII:
-		impl = "UltraSPARC III";
-		break;
-	case IMPL_ULTRASPARCIII_PLUS:
-		impl = "UltraSPARC III+";
-		break;
-	case IMPL_ULTRASPARCIII_I:
-		impl = "UltraSPARC IIIi";
-		break;
-	case IMPL_ULTRASPARCIV:
-		impl = "UltraSPARC IV";
-		break;
-	case IMPL_ULTRASPARCIV_PLUS:
-		impl = "UltraSPARC IV+";
-		break;
-	case IMPL_SPARC64V:
-		impl = "SPARC 64V";
-		break;
-	default:
-		impl = "Unknown";
-		break;
-	}
-
-	printf("cpu%d: manuf=%s, impl=%s, mask=%d (%d MHz)\n", m->id, manuf,
-	    impl, m->arch.ver.mask, m->arch.clock_frequency / 1000000);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/cpu/sun4v/cpu.c
===================================================================
--- kernel/arch/sparc64/src/cpu/sun4v/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <cpu.h>
-#include <arch.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <arch/drivers/tick.h>
-#include <stdio.h>
-#include <arch/sun4v/md.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/trap/sun4v/interrupt.h>
-
-/** Perform sparc64 specific initialization of the processor structure for the
- * current processor.
- */
-void cpu_arch_init(void)
-{
-	uint64_t myid;
-	__hypercall_fast_ret1(0, 0, 0, 0, 0, CPU_MYID, &myid);
-
-	CPU->arch.id = myid;
-
-	md_node_t node = md_get_root();
-
-	/* walk through MD, find the current CPU node & its clock-frequency */
-	while (true) {
-		if (!md_next_node(&node, "cpu")) {
-			panic("Could not determine CPU frequency.");
-		}
-		uint64_t id = 0;
-		md_get_integer_property(node, "id", &id);
-
-		if (id == myid) {
-			uint64_t clock_frequency = 0;
-			md_get_integer_property(node, "clock-frequency",
-			    &clock_frequency);
-			CPU->arch.clock_frequency = clock_frequency;
-			break;
-		}
-	}
-
-	tick_init();
-
-	sun4v_ipi_init();
-}
-
-/**
- * Implemented as an empty function as accessing the VER register is
- * a hyperprivileged operation on sun4v.
- */
-void cpu_identify(void)
-{
-}
-
-/** Print version information for a processor.
- *
- * This function is called by the bootstrap processor.
- *
- * @param m Processor structure of the CPU for which version information is to
- * 	be printed.
- */
-void cpu_print_report(cpu_t *m)
-{
-	printf("cpu%d: Niagara (%d MHz)\n", m->id,
-	    m->arch.clock_frequency / 1000000);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/debug/stacktrace.c
===================================================================
--- kernel/arch/sparc64/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <syscall/copy.h>
-#include <proc/thread.h>
-
-#include <arch.h>
-#include <arch/stack.h>
-#include <arch/trap/trap_table.h>
-
-#include <arch/istate_struct.h>
-
-#if defined(SUN4V)
-#include <arch/sun4v/arch.h>
-#endif
-
-#define FRAME_OFFSET_FP_PREV	14
-#define FRAME_OFFSET_RA		15
-
-extern void alloc_window_and_flush(void);
-
-bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	uintptr_t kstack;
-
-#if defined(SUN4U)
-	kstack = read_from_ag_g6();
-#elif defined(SUN4V)
-	kstack = asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK);
-#endif
-
-	kstack += STACK_BIAS;
-	kstack -= ISTATE_SIZE;
-
-	if (THREAD && (ctx->fp == kstack))
-		return false;
-	return ctx->fp != 0;
-}
-
-bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	uint64_t *stack = (void *) ctx->fp;
-	alloc_window_and_flush();
-	*prev = stack[FRAME_OFFSET_FP_PREV] + STACK_BIAS;
-	return true;
-}
-
-bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	uint64_t *stack = (void *) ctx->fp;
-	alloc_window_and_flush();
-	*ra = stack[FRAME_OFFSET_RA];
-	return true;
-}
-
-bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx)
-{
-	return false;
-}
-
-bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)
-{
-	return false;
-}
-
-bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra)
-{
-	return false;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/debug/stacktrace_asm.S
===================================================================
--- kernel/arch/sparc64/src/debug/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#
-# Copyright (c) 2010 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/stack.h>
-
-.text
-
-FUNCTION_BEGIN(frame_pointer_get)
-	# Add the stack bias to %sp to get the actual address.
-	retl
-	add %sp, STACK_BIAS, %o0
-FUNCTION_END(frame_pointer_get)
-
-FUNCTION_BEGIN(program_counter_get)
-	retl
-	mov %o7, %o0
-FUNCTION_END(program_counter_get)
-
-FUNCTION_BEGIN(alloc_window_and_flush)
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp
-	# Flush all other windows to memory so that we can read their contents.
-	flushw
-	ret
-	restore
-FUNCTION_END(alloc_window_and_flush)
-
Index: rnel/arch/sparc64/src/drivers/kbd.c
===================================================================
--- kernel/arch/sparc64/src/drivers/kbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch/drivers/kbd.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/ebus.h>
-#include <console/console.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-#include <align.h>
-#include <str.h>
-#include <log.h>
-#include <sysinfo/sysinfo.h>
-
-#ifdef CONFIG_SUN_KBD
-#include <genarch/kbrd/kbrd.h>
-#endif
-
-#ifdef CONFIG_NS16550
-#include <genarch/drivers/ns16550/ns16550.h>
-#endif
-
-#ifdef CONFIG_SUN_KBD
-
-#ifdef CONFIG_NS16550
-
-static bool kbd_ns16550_init(ofw_tree_node_t *node)
-{
-	const char *name = ofw_tree_node_name(node);
-
-	if (str_cmp(name, "su") != 0)
-		return false;
-
-	/*
-	 * Read 'interrupts' property.
-	 */
-	ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");
-	if ((!prop) || (!prop->value)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Unable to find interrupts property");
-		return false;
-	}
-
-	uint32_t interrupts = *((uint32_t *) prop->value);
-
-	/*
-	 * Read 'reg' property.
-	 */
-	prop = ofw_tree_getprop(node, "reg");
-	if ((!prop) || (!prop->value)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Unable to find reg property");
-		return false;
-	}
-
-	uintptr_t pa = 0; // Prevent -Werror=maybe-uninitialized
-	if (!ofw_ebus_apply_ranges(node->parent,
-	    ((ofw_ebus_reg_t *) prop->value), &pa)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Failed to determine address");
-		return false;
-	}
-
-	inr_t inr;
-	cir_t cir;
-	void *cir_arg;
-	if (!ofw_ebus_map_interrupt(node->parent,
-	    ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir,
-	    &cir_arg)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Failed to determine interrupt");
-		return false;
-	}
-
-	ns16550_instance_t *ns16550_instance = ns16550_init((ioport8_t *) pa, 0,
-	    inr, cir, cir_arg, NULL);
-	if (ns16550_instance) {
-		kbrd_instance_t *kbrd_instance = kbrd_init();
-		if (kbrd_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *kbrd = kbrd_wire(kbrd_instance, sink);
-			ns16550_wire(ns16550_instance, kbrd);
-		}
-	}
-
-	/*
-	 * This is the necessary evil until the userspace drivers are
-	 * entirely self-sufficient.
-	 */
-	sysinfo_set_item_val("kbd", NULL, true);
-	sysinfo_set_item_val("kbd.inr", NULL, inr);
-	sysinfo_set_item_val("kbd.address.physical", NULL, pa);
-	sysinfo_set_item_val("kbd.type.ns16550", NULL, true);
-
-	return true;
-}
-
-#endif /* CONFIG_NS16550 */
-
-/** Initialize keyboard.
- *
- * Traverse OpenFirmware device tree in order to find necessary
- * info about the keyboard device.
- *
- * @param node Keyboard device node.
- *
- */
-void kbd_init(ofw_tree_node_t *node)
-{
-#ifdef CONFIG_NS16550
-	kbd_ns16550_init(node);
-#endif
-}
-
-#endif /* CONFIG_SUN_KBD */
-
-/** @}
- */
Index: rnel/arch/sparc64/src/drivers/niagara.c
===================================================================
--- kernel/arch/sparc64/src/drivers/niagara.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief Niagara input/output driver based on hypervisor calls.
- */
-
-#include <arch/drivers/niagara.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <ddi/ddi.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <stdlib.h>
-#include <arch/drivers/niagara_buf.h>
-#include <arch/drivers/kbd.h>
-#include <arch/sun4v/hypercall.h>
-#include <sysinfo/sysinfo.h>
-#include <ipc/irq.h>
-#include <proc/thread.h>
-#include <console/console.h>
-#include <genarch/srln/srln.h>
-
-/* Polling interval in miliseconds */
-#define POLL_INTERVAL  10000
-
-/* Device instance */
-static niagara_instance_t *instance = NULL;
-
-static void niagara_write(outdev_t *, const char *, size_t);
-
-/** Character device operations */
-static outdev_operations_t niagara_ops = {
-	.write = niagara_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-/**
- * The driver uses hypercalls to print characters to the console. Since the
- * hypercall cannot be performed from the userspace, we do this:
- *
- * The kernel "little brother" driver (which will be present no matter what
- * the DDI architecture is -- as we need the kernel part for the kconsole)
- * defines a shared buffer. Kernel walks through the buffer (in the same thread
- * which is used for polling the keyboard) and prints any pending characters
- * to the console (using hypercalls).
- *
- * The userspace fb server maps this shared buffer to its address space and
- * output operation it does is performed using the mapped buffer. The shared
- * buffer definition follows.
- */
-static volatile niagara_output_buffer_t __attribute__((aligned(PAGE_SIZE)))
-    output_buffer;
-
-static parea_t outbuf_parea;
-
-/**
- * Analogous to the output_buffer, see the previous definition.
- */
-static volatile niagara_input_buffer_t __attribute__((aligned(PAGE_SIZE)))
-    input_buffer;
-
-static parea_t inbuf_parea;
-
-/** Write a single character to the standard output. */
-static inline void do_putchar(uint8_t c)
-{
-	/* Repeat until the buffer is non-full */
-	while (__hypercall_fast1(CONS_PUTCHAR, c) == HV_EWOULDBLOCK)
-		;
-}
-
-static void niagara_write(outdev_t *dev, const char *s, size_t n)
-{
-	/* If the userspace owns the console, do not output anything. */
-	if (outbuf_parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			do_putchar('\r');
-
-		do_putchar((uint8_t) *s);
-	}
-}
-
-/** Poll keyboard and print pending characters.
- *
- * Ask the hypervisor whether there is any unread character. If so,
- * pick it up and send it to the indev layer.
- *
- * Check whether the userspace output driver has pushed any
- * characters to the output buffer and eventually print them.
- *
- */
-static void niagara_poll(void)
-{
-	/*
-	 * Print any pending characters from the
-	 * shared buffer to the console.
-	 */
-
-	while (output_buffer.read_ptr != output_buffer.write_ptr) {
-		do_putchar(output_buffer.data[output_buffer.read_ptr]);
-		output_buffer.read_ptr =
-		    ((output_buffer.read_ptr) + 1) % OUTPUT_BUFFER_SIZE;
-	}
-
-	/*
-	 * Read character from keyboard.
-	 */
-
-	uint64_t c;
-	if (__hypercall_fast_ret1(0, 0, 0, 0, 0, CONS_GETCHAR, &c) == HV_EOK) {
-		if ((!inbuf_parea.mapped) || (console_override)) {
-			/*
-			 * Kernel console is active, send
-			 * the character to kernel.
-			 */
-			indev_push_character(instance->srlnin, c);
-		} else {
-			/*
-			 * Kernel console is inactive, send
-			 * the character to uspace driver.
-			 */
-			input_buffer.data[input_buffer.write_ptr] = (char) c;
-			input_buffer.write_ptr =
-			    ((input_buffer.write_ptr) + 1) % INPUT_BUFFER_SIZE;
-		}
-	}
-}
-
-/** Polling thread function.
- *
- */
-static void kniagarapoll(void *arg)
-{
-	while (true) {
-		niagara_poll();
-		thread_usleep(POLL_INTERVAL);
-	}
-}
-
-/** Initialize the input/output subsystem
- *
- */
-static void niagara_init(void)
-{
-	if (instance)
-		return;
-
-	instance = malloc(sizeof(niagara_instance_t));
-	instance->thread = thread_create(kniagarapoll, NULL, TASK,
-	    THREAD_FLAG_UNCOUNTED, "kniagarapoll");
-
-	if (!instance->thread) {
-		free(instance);
-		instance = NULL;
-		return;
-	}
-
-	instance->srlnin = NULL;
-
-	output_buffer.read_ptr = 0;
-	output_buffer.write_ptr = 0;
-	input_buffer.write_ptr = 0;
-	input_buffer.read_ptr = 0;
-
-	/*
-	 * Set sysinfos and pareas so that the userspace counterpart of the
-	 * niagara fb and kbd driver can communicate with kernel using shared
-	 * buffers.
-	 */
-
-	sysinfo_set_item_val("fb", NULL, true);
-	sysinfo_set_item_val("fb.kind", NULL, 5);
-
-	sysinfo_set_item_val("niagara.outbuf.address", NULL,
-	    KA2PA(&output_buffer));
-	sysinfo_set_item_val("niagara.outbuf.size", NULL,
-	    PAGE_SIZE);
-	sysinfo_set_item_val("niagara.outbuf.datasize", NULL,
-	    OUTPUT_BUFFER_SIZE);
-
-	sysinfo_set_item_val("niagara.inbuf.address", NULL,
-	    KA2PA(&input_buffer));
-	sysinfo_set_item_val("niagara.inbuf.size", NULL,
-	    PAGE_SIZE);
-	sysinfo_set_item_val("niagara.inbuf.datasize", NULL,
-	    INPUT_BUFFER_SIZE);
-
-	ddi_parea_init(&outbuf_parea);
-	outbuf_parea.pbase = (uintptr_t) (KA2PA(&output_buffer));
-	outbuf_parea.frames = 1;
-	outbuf_parea.unpriv = false;
-	outbuf_parea.mapped = false;
-	ddi_parea_register(&outbuf_parea);
-
-	inbuf_parea.pbase = (uintptr_t) (KA2PA(&input_buffer));
-	inbuf_parea.frames = 1;
-	inbuf_parea.unpriv = false;
-	inbuf_parea.mapped = false;
-	ddi_parea_register(&inbuf_parea);
-
-	outdev_t *niagara_dev = malloc(sizeof(outdev_t));
-	outdev_initialize("niagara_dev", niagara_dev, &niagara_ops);
-	stdout_wire(niagara_dev);
-}
-
-/** Initialize input from the Niagara console.
- *
- */
-niagara_instance_t *niagarain_init(void)
-{
-	niagara_init();
-
-	if (instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-
-			instance->srlnin = srln;
-			thread_start(instance->thread);
-		}
-	}
-
-	return instance;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/drivers/pci.c
===================================================================
--- kernel/arch/sparc64/src/drivers/pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/**
- * @file
- * @brief	PCI driver.
- */
-
-#include <arch/drivers/pci.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/upa.h>
-#include <arch/trap/interrupt.h>
-#include <mm/km.h>
-#include <stdlib.h>
-#include <typedefs.h>
-#include <assert.h>
-#include <log.h>
-#include <str.h>
-#include <arch/asm.h>
-#include <sysinfo/sysinfo.h>
-
-#define SABRE_INTERNAL_REG	0
-#define PSYCHO_INTERNAL_REG	2
-
-#define OBIO_IMR_BASE	0x200
-#define OBIO_IMR(ino)	(OBIO_IMR_BASE + ((ino) & INO_MASK))
-
-#define OBIO_CIR_BASE	0x300
-#define OBIO_CIR(ino)	(OBIO_CIR_BASE + ((ino) & INO_MASK))
-
-static void obio_enable_interrupt(pci_t *, int);
-static void obio_clear_interrupt(pci_t *, int);
-
-static pci_t *pci_sabre_init(ofw_tree_node_t *);
-static pci_t *pci_psycho_init(ofw_tree_node_t *);
-
-/** PCI operations for Sabre model. */
-static pci_operations_t pci_sabre_ops = {
-	.enable_interrupt = obio_enable_interrupt,
-	.clear_interrupt = obio_clear_interrupt
-};
-/** PCI operations for Psycho model. */
-static pci_operations_t pci_psycho_ops = {
-	.enable_interrupt = obio_enable_interrupt,
-	.clear_interrupt = obio_clear_interrupt
-};
-
-/** Initialize PCI controller (model Sabre).
- *
- * @param node		OpenFirmware device tree node of the Sabre.
- *
- * @return		Address of the initialized PCI structure.
- */
-pci_t *pci_sabre_init(ofw_tree_node_t *node)
-{
-	pci_t *pci;
-	ofw_tree_property_t *prop;
-
-	/*
-	 * Get registers.
-	 */
-	prop = ofw_tree_getprop(node, "reg");
-	if (!prop || !prop->value)
-		return NULL;
-
-	ofw_upa_reg_t *reg = prop->value;
-	size_t regs = prop->size / sizeof(ofw_upa_reg_t);
-
-	if (regs < SABRE_INTERNAL_REG + 1)
-		return NULL;
-
-	uintptr_t paddr;
-	if (!ofw_upa_apply_ranges(node->parent, &reg[SABRE_INTERNAL_REG],
-	    &paddr))
-		return NULL;
-
-	pci = (pci_t *) malloc(sizeof(pci_t));
-	if (!pci)
-		return NULL;
-
-	pci->model = PCI_SABRE;
-	pci->op = &pci_sabre_ops;
-	pci->reg = (uint64_t *) km_map(paddr, reg[SABRE_INTERNAL_REG].size,
-	    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-	return pci;
-}
-
-/** Initialize the Psycho PCI controller.
- *
- * @param node		OpenFirmware device tree node of the Psycho.
- *
- * @return		Address of the initialized PCI structure.
- */
-pci_t *pci_psycho_init(ofw_tree_node_t *node)
-{
-	pci_t *pci;
-	ofw_tree_property_t *prop;
-
-	/*
-	 * Get registers.
-	 */
-	prop = ofw_tree_getprop(node, "reg");
-	if (!prop || !prop->value)
-		return NULL;
-
-	ofw_upa_reg_t *reg = prop->value;
-	size_t regs = prop->size / sizeof(ofw_upa_reg_t);
-
-	if (regs < PSYCHO_INTERNAL_REG + 1)
-		return NULL;
-
-	uintptr_t paddr;
-	if (!ofw_upa_apply_ranges(node->parent, &reg[PSYCHO_INTERNAL_REG],
-	    &paddr))
-		return NULL;
-
-	pci = (pci_t *) malloc(sizeof(pci_t));
-	if (!pci)
-		return NULL;
-
-	pci->model = PCI_PSYCHO;
-	pci->op = &pci_psycho_ops;
-	pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size,
-	    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-	return pci;
-}
-
-void obio_enable_interrupt(pci_t *pci, int inr)
-{
-	pci->reg[OBIO_IMR(inr & INO_MASK)] |= IMAP_V_MASK;
-}
-
-void obio_clear_interrupt(pci_t *pci, int inr)
-{
-	pci->reg[OBIO_CIR(inr & INO_MASK)] = 0;	/* set IDLE */
-}
-
-/** Initialize PCI controller. */
-pci_t *pci_init(ofw_tree_node_t *node)
-{
-	ofw_tree_property_t *prop;
-
-	/*
-	 * First, verify this is a PCI node.
-	 */
-	assert(str_cmp(ofw_tree_node_name(node), "pci") == 0);
-
-	/*
-	 * Determine PCI controller model.
-	 */
-	prop = ofw_tree_getprop(node, "model");
-	if (!prop || !prop->value)
-		return NULL;
-
-	if (str_cmp(prop->value, "SUNW,sabre") == 0) {
-		/*
-		 * PCI controller Sabre.
-		 * This model is found on UltraSPARC IIi based machines.
-		 */
-		return pci_sabre_init(node);
-	} else if (str_cmp(prop->value, "SUNW,psycho") == 0) {
-		/*
-		 * PCI controller Psycho.
-		 * Used on UltraSPARC II based processors, for instance,
-		 * on Ultra 60.
-		 */
-		return pci_psycho_init(node);
-	} else {
-		/*
-		 * Unsupported model.
-		 */
-		log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).",
-		    (char *) prop->value);
-	}
-
-	return NULL;
-}
-
-void pci_enable_interrupt(pci_t *pci, int inr)
-{
-	assert(pci->op && pci->op->enable_interrupt);
-	pci->op->enable_interrupt(pci, inr);
-}
-
-void pci_clear_interrupt(void *pcip, int inr)
-{
-	pci_t *pci = (pci_t *)pcip;
-
-	assert(pci->op && pci->op->clear_interrupt);
-	pci->op->clear_interrupt(pci, inr);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/drivers/scr.c
===================================================================
--- kernel/arch/sparc64/src/drivers/scr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch/drivers/scr.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/pci.h>
-#include <genarch/ofw/sbus.h>
-#include <genarch/ofw/upa.h>
-#include <genarch/fb/fb.h>
-#include <abi/fb/visuals.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <stdint.h>
-#include <str.h>
-#include <align.h>
-#include <log.h>
-
-#define FFB_REG_24BPP	7
-
-scr_type_t scr_type = SCR_UNKNOWN;
-
-/** Initialize screen.
- *
- * Traverse OpenFirmware device tree in order to find necessary
- * info about the screen device.
- *
- * @param node Screen device node.
- */
-void scr_init(ofw_tree_node_t *node)
-{
-	ofw_tree_property_t *prop;
-	ofw_pci_reg_t *pci_reg;
-	ofw_pci_reg_t pci_abs_reg;
-	ofw_upa_reg_t *upa_reg;
-	ofw_sbus_reg_t *sbus_reg;
-	const char *name;
-
-	name = ofw_tree_node_name(node);
-
-	if (str_cmp(name, "SUNW,m64B") == 0)
-		scr_type = SCR_ATYFB;
-	else if (str_cmp(name, "SUNW,XVR-100") == 0)
-		scr_type = SCR_XVR;
-	else if (str_cmp(name, "SUNW,ffb") == 0)
-		scr_type = SCR_FFB;
-	else if (str_cmp(name, "cgsix") == 0)
-		scr_type = SCR_CGSIX;
-	else if (str_cmp(name, "QEMU,VGA") == 0)
-		scr_type = SCR_QEMU_VGA;
-
-	if (scr_type == SCR_UNKNOWN) {
-		log(LF_ARCH, LVL_ERROR, "Unknown screen device.");
-		return;
-	}
-
-	uintptr_t fb_addr;
-	unsigned int fb_offset = 0;
-	uint32_t fb_width = 0;
-	uint32_t fb_height = 0;
-	uint32_t fb_depth = 0;
-	uint32_t fb_linebytes = 0;
-	uint32_t fb_scanline = 0;
-	unsigned int visual;
-
-	prop = ofw_tree_getprop(node, "width");
-	if (prop && prop->value)
-		fb_width = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "height");
-	if (prop && prop->value)
-		fb_height = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "depth");
-	if (prop && prop->value)
-		fb_depth = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "linebytes");
-	if (prop && prop->value)
-		fb_linebytes = *((uint32_t *) prop->value);
-
-	prop = ofw_tree_getprop(node, "reg");
-	if (!prop)
-		panic("Cannot find 'reg' property.");
-
-	switch (scr_type) {
-	case SCR_ATYFB:
-		if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
-			log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
-			return;
-		}
-
-		pci_reg = &((ofw_pci_reg_t *) prop->value)[1];
-
-		if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to absolutize fb register.");
-			return;
-		}
-
-		if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
-		    &fb_addr)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to determine screen address.");
-			return;
-		}
-
-		switch (fb_depth) {
-		case 8:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_INDIRECT_8;
-			break;
-		case 16:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_5_6_5_BE;
-			break;
-		case 24:
-			fb_scanline = fb_linebytes * 4;
-			visual = VISUAL_BGR_8_8_8_0;
-			break;
-		case 32:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_0_8_8_8;
-			break;
-		default:
-			log(LF_ARCH, LVL_ERROR,
-			    "Unsupported bits per pixel.");
-			return;
-		}
-
-		break;
-	case SCR_XVR:
-		if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Too few screen registers.");
-			return;
-		}
-
-		pci_reg = &((ofw_pci_reg_t *) prop->value)[1];
-
-		if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to absolutize fb register.");
-			return;
-		}
-
-		if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
-		    &fb_addr)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to determine screen address.");
-			return;
-		}
-
-		fb_offset = 4 * 0x2000;
-
-		switch (fb_depth) {
-		case 8:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_INDIRECT_8;
-			break;
-		case 16:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_5_6_5_BE;
-			break;
-		case 24:
-			fb_scanline = fb_linebytes * 4;
-			visual = VISUAL_BGR_8_8_8_0;
-			break;
-		case 32:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_0_8_8_8;
-			break;
-		default:
-			log(LF_ARCH, LVL_ERROR,
-			    "Unsupported bits per pixel.");
-			return;
-		}
-
-		break;
-	case SCR_FFB:
-		fb_scanline = 8192;
-		visual = VISUAL_BGR_0_8_8_8;
-
-		upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP];
-		if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to determine screen address.");
-			return;
-		}
-
-		break;
-	case SCR_CGSIX:
-		switch (fb_depth) {
-		case 8:
-			fb_scanline = fb_linebytes;
-			visual = VISUAL_INDIRECT_8;
-			break;
-		default:
-			log(LF_ARCH, LVL_WARN, "Not implemented.");
-			return;
-		}
-
-		sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0];
-		if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to determine screen address.");
-			return;
-		}
-
-		break;
-
-	case SCR_QEMU_VGA:
-		if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
-			log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
-			return;
-		}
-
-		pci_reg = &((ofw_pci_reg_t *) prop->value)[1];
-
-		if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to absolutize fb register.");
-			return;
-		}
-
-		if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
-		    &fb_addr)) {
-			log(LF_ARCH, LVL_ERROR,
-			    "Failed to determine screen address.");
-			return;
-		}
-
-		switch (fb_depth) {
-		case 8:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_INDIRECT_8;
-			break;
-		case 16:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_5_6_5_BE;
-			break;
-		case 24:
-			fb_scanline = fb_linebytes * 4;
-			visual = VISUAL_BGR_8_8_8_0;
-			break;
-		case 32:
-			fb_scanline = fb_linebytes * (fb_depth >> 3);
-			visual = VISUAL_RGB_0_8_8_8;
-			break;
-		default:
-			log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel.");
-			return;
-		}
-		break;
-
-	default:
-		panic("Unexpected type.");
-	}
-
-	fb_properties_t props = {
-		.addr = fb_addr,
-		.offset = fb_offset,
-		.x = fb_width,
-		.y = fb_height,
-		.scan = fb_scanline,
-		.visual = visual,
-	};
-
-	outdev_t *fbdev = fb_init(&props);
-	if (fbdev)
-		stdout_wire(fbdev);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/drivers/tick.c
===================================================================
--- kernel/arch/sparc64/src/drivers/tick.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch/drivers/tick.h>
-#include <arch/interrupt.h>
-#include <arch/trap/interrupt.h>
-#include <arch/sparc64.h>
-#include <arch/asm.h>
-#include <arch/register.h>
-#include <arch/cpu.h>
-#include <arch/boot/boot.h>
-#include <time/clock.h>
-#include <arch.h>
-#include <assert.h>
-
-/** Initialize tick and stick interrupt. */
-void tick_init(void)
-{
-	/* initialize TICK interrupt */
-	tick_compare_reg_t compare;
-	softint_reg_t clear;
-
-	compare.int_dis = false;
-	compare.tick_cmpr = tick_counter_read() +
-	    CPU->arch.clock_frequency / HZ;
-	CPU->arch.next_tick_cmpr = compare.tick_cmpr;
-	tick_compare_write(compare.value);
-
-	clear.value = 0;
-	clear.tick_int = 1;
-	clear_softint_write(clear.value);
-
-#if defined (US3) || defined (SUN4V)
-	/* disable STICK interrupts and clear any pending ones */
-	tick_compare_reg_t stick_compare;
-
-	stick_compare.value = stick_compare_read();
-	stick_compare.int_dis = true;
-	stick_compare.tick_cmpr = 0;
-	stick_compare_write(stick_compare.value);
-
-	clear.value = 0;
-	clear.stick_int = 1;
-	clear_softint_write(clear.value);
-#endif
-}
-
-/** Process tick interrupt.
- *
- * @param n      Trap type (0x4e, can be ignored)
- * @param istate Interrupted state.
- *
- */
-void tick_interrupt(unsigned int n, istate_t *istate)
-{
-	softint_reg_t softint, clear;
-	uint64_t drift;
-
-	softint.value = softint_read();
-
-	/*
-	 * Make sure we are servicing interrupt_level_14
-	 */
-	assert(n == TT_INTERRUPT_LEVEL_14);
-
-	/*
-	 * Make sure we are servicing TICK_INT.
-	 */
-	assert(softint.tick_int);
-
-	/*
-	 * Clear tick interrupt.
-	 */
-	clear.value = 0;
-	clear.tick_int = 1;
-	clear_softint_write(clear.value);
-
-	/*
-	 * Reprogram the compare register.
-	 * For now, we can ignore the potential of the registers to overflow.
-	 * On a 360MHz Ultra 60, the 63-bit compare counter will overflow in
-	 * about 812 years. If there was a 2GHz UltraSPARC computer, it would
-	 * overflow only in 146 years.
-	 */
-	drift = tick_counter_read() - CPU->arch.next_tick_cmpr;
-	while (drift > CPU->arch.clock_frequency / HZ) {
-		drift -= CPU->arch.clock_frequency / HZ;
-		CPU_LOCAL->missed_clock_ticks++;
-	}
-	CPU->arch.next_tick_cmpr = tick_counter_read() +
-	    (CPU->arch.clock_frequency / HZ) - drift;
-	tick_compare_write(CPU->arch.next_tick_cmpr);
-	clock();
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/drivers/tty.c
===================================================================
--- kernel/arch/sparc64/src/drivers/tty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2019 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/ebus.h>
-#include <console/console.h>
-#include <genarch/srln/srln.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-#include <align.h>
-#include <str.h>
-#include <log.h>
-
-#ifdef CONFIG_SUN_TTY
-#include <arch/drivers/tty.h>
-#endif
-
-#ifdef CONFIG_NS16550
-#include <genarch/drivers/ns16550/ns16550.h>
-#endif
-
-#ifdef CONFIG_SUN_TTY
-
-#ifdef CONFIG_NS16550
-
-static bool tty_ns16550_init(ofw_tree_node_t *node)
-{
-	const char *name = ofw_tree_node_name(node);
-
-	if (str_cmp(name, "su") != 0)
-		return false;
-
-	/*
-	 * Read 'interrupts' property.
-	 */
-	ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");
-	if ((!prop) || (!prop->value)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Unable to find interrupts property");
-		return false;
-	}
-
-	uint32_t interrupts = *((uint32_t *) prop->value);
-
-	/*
-	 * Read 'reg' property.
-	 */
-	prop = ofw_tree_getprop(node, "reg");
-	if ((!prop) || (!prop->value)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Unable to find reg property");
-		return false;
-	}
-
-	uintptr_t pa = 0; // Prevent -Werror=maybe-uninitialized
-	if (!ofw_ebus_apply_ranges(node->parent,
-	    ((ofw_ebus_reg_t *) prop->value), &pa)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Failed to determine address");
-		return false;
-	}
-
-	inr_t inr;
-	cir_t cir;
-	void *cir_arg;
-	if (!ofw_ebus_map_interrupt(node->parent,
-	    ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir,
-	    &cir_arg)) {
-		log(LF_ARCH, LVL_ERROR,
-		    "ns16550: Failed to determine interrupt");
-		return false;
-	}
-
-	outdev_t *ns16550_out;
-	ns16550_instance_t *ns16550_instance = ns16550_init((ioport8_t *) pa, 0,
-	    inr, cir, cir_arg, &ns16550_out);
-	if (ns16550_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			ns16550_wire(ns16550_instance, srln);
-		}
-		stdout_wire(ns16550_out);
-	}
-
-	return true;
-}
-
-#endif /* CONFIG_NS16550 */
-
-/** Initialize tty.
- *
- * Traverse OpenFirmware device tree in order to find necessary
- * info about the keyboard device.
- *
- * @param node Keyboard device node.
- *
- */
-void tty_init(ofw_tree_node_t *node)
-{
-#ifdef CONFIG_NS16550
-	tty_ns16550_init(node);
-#endif
-}
-
-#endif /* CONFIG_SUN_TTY */
-
-/** @}
- */
Index: rnel/arch/sparc64/src/dummy.S
===================================================================
--- kernel/arch/sparc64/src/dummy.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(cpu_sleep)
-	retl
-	nop
-FUNCTION_END(cpu_sleep)
-
-FUNCTION_BEGIN(cpu_halt)
-	ba %xcc, cpu_halt
-	nop
-FUNCTION_END(cpu_halt)
-
Index: rnel/arch/sparc64/src/fpu_context.c
===================================================================
--- kernel/arch/sparc64/src/fpu_context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- *
- */
-
-#include <fpu_context.h>
-#include <arch/register.h>
-#include <arch/asm.h>
-
-void fpu_context_save(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "std %%f0, %0\n"
-	    "std %%f2, %1\n"
-	    "std %%f4, %2\n"
-	    "std %%f6, %3\n"
-	    "std %%f8, %4\n"
-	    "std %%f10, %5\n"
-	    "std %%f12, %6\n"
-	    "std %%f14, %7\n"
-	    "std %%f16, %8\n"
-	    "std %%f18, %9\n"
-	    "std %%f20, %10\n"
-	    "std %%f22, %11\n"
-	    "std %%f24, %12\n"
-	    "std %%f26, %13\n"
-	    "std %%f28, %14\n"
-	    "std %%f30, %15\n"
-	    : "=m" (fctx->d[0]), "=m" (fctx->d[1]), "=m" (fctx->d[2]), "=m" (fctx->d[3]),
-	      "=m" (fctx->d[4]), "=m" (fctx->d[5]), "=m" (fctx->d[6]), "=m" (fctx->d[7]),
-	      "=m" (fctx->d[8]), "=m" (fctx->d[9]), "=m" (fctx->d[10]), "=m" (fctx->d[11]),
-	      "=m" (fctx->d[12]), "=m" (fctx->d[13]), "=m" (fctx->d[14]), "=m" (fctx->d[15])
-	);
-
-	/*
-	 * We need to split loading of the floating-point registers because
-	 * GCC (4.1.1) can't handle more than 30 operands in one asm statement.
-	 */
-
-	asm volatile (
-	    "std %%f32, %0\n"
-	    "std %%f34, %1\n"
-	    "std %%f36, %2\n"
-	    "std %%f38, %3\n"
-	    "std %%f40, %4\n"
-	    "std %%f42, %5\n"
-	    "std %%f44, %6\n"
-	    "std %%f46, %7\n"
-	    "std %%f48, %8\n"
-	    "std %%f50, %9\n"
-	    "std %%f52, %10\n"
-	    "std %%f54, %11\n"
-	    "std %%f56, %12\n"
-	    "std %%f58, %13\n"
-	    "std %%f60, %14\n"
-	    "std %%f62, %15\n"
-	    : "=m" (fctx->d[16]), "=m" (fctx->d[17]), "=m" (fctx->d[18]), "=m" (fctx->d[19]),
-	      "=m" (fctx->d[20]), "=m" (fctx->d[21]), "=m" (fctx->d[22]), "=m" (fctx->d[23]),
-	      "=m" (fctx->d[24]), "=m" (fctx->d[25]), "=m" (fctx->d[26]), "=m" (fctx->d[27]),
-	      "=m" (fctx->d[28]), "=m" (fctx->d[29]), "=m" (fctx->d[30]), "=m" (fctx->d[31])
-	);
-
-	asm volatile ("stx %%fsr, %0\n" : "=m" (fctx->fsr));
-}
-
-void fpu_context_restore(fpu_context_t *fctx)
-{
-	asm volatile (
-	    "ldd %0, %%f0\n"
-	    "ldd %1, %%f2\n"
-	    "ldd %2, %%f4\n"
-	    "ldd %3, %%f6\n"
-	    "ldd %4, %%f8\n"
-	    "ldd %5, %%f10\n"
-	    "ldd %6, %%f12\n"
-	    "ldd %7, %%f14\n"
-	    "ldd %8, %%f16\n"
-	    "ldd %9, %%f18\n"
-	    "ldd %10, %%f20\n"
-	    "ldd %11, %%f22\n"
-	    "ldd %12, %%f24\n"
-	    "ldd %13, %%f26\n"
-	    "ldd %14, %%f28\n"
-	    "ldd %15, %%f30\n"
-	    :
-	    : "m" (fctx->d[0]), "m" (fctx->d[1]), "m" (fctx->d[2]), "m" (fctx->d[3]),
-	      "m" (fctx->d[4]), "m" (fctx->d[5]), "m" (fctx->d[6]), "m" (fctx->d[7]),
-	      "m" (fctx->d[8]), "m" (fctx->d[9]), "m" (fctx->d[10]), "m" (fctx->d[11]),
-	      "m" (fctx->d[12]), "m" (fctx->d[13]), "m" (fctx->d[14]), "m" (fctx->d[15])
-	);
-
-	/*
-	 * We need to split loading of the floating-point registers because
-	 * GCC (4.1.1) can't handle more than 30 operands in one asm statement.
-	 */
-
-	asm volatile (
-	    "ldd %0, %%f32\n"
-	    "ldd %1, %%f34\n"
-	    "ldd %2, %%f36\n"
-	    "ldd %3, %%f38\n"
-	    "ldd %4, %%f40\n"
-	    "ldd %5, %%f42\n"
-	    "ldd %6, %%f44\n"
-	    "ldd %7, %%f46\n"
-	    "ldd %8, %%f48\n"
-	    "ldd %9, %%f50\n"
-	    "ldd %10, %%f52\n"
-	    "ldd %11, %%f54\n"
-	    "ldd %12, %%f56\n"
-	    "ldd %13, %%f58\n"
-	    "ldd %14, %%f60\n"
-	    "ldd %15, %%f62\n"
-	    :
-	    : "m" (fctx->d[16]), "m" (fctx->d[17]), "m" (fctx->d[18]), "m" (fctx->d[19]),
-	      "m" (fctx->d[20]), "m" (fctx->d[21]), "m" (fctx->d[22]), "m" (fctx->d[23]),
-	      "m" (fctx->d[24]), "m" (fctx->d[25]), "m" (fctx->d[26]), "m" (fctx->d[27]),
-	      "m" (fctx->d[28]), "m" (fctx->d[29]), "m" (fctx->d[30]), "m" (fctx->d[31])
-	);
-
-	asm volatile ("ldx %0, %%fsr\n" : : "m" (fctx->fsr));
-}
-
-void fpu_enable(void)
-{
-	pstate_reg_t pstate;
-
-	pstate.value = pstate_read();
-	pstate.pef = true;
-	pstate_write(pstate.value);
-}
-
-void fpu_disable(void)
-{
-	pstate_reg_t pstate;
-
-	pstate.value = pstate_read();
-	pstate.pef = false;
-	pstate_write(pstate.value);
-}
-
-void fpu_init(void)
-{
-	fpu_enable();
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/page.c
===================================================================
--- kernel/arch/sparc64/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <mm/page.h>
-#include <arch/mm/page.h>
-#include <arch/mm/tlb.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/frame.h>
-#include <arch/mm/frame.h>
-#include <bitops.h>
-#include <debug.h>
-#include <align.h>
-#include <config.h>
-
-/** Perform sparc64 specific initialization of paging. */
-void page_arch_init(void)
-{
-	if (config.cpu_active == 1)
-		page_mapping_operations = &ht_mapping_operations;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4u/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,222 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/as.h>
-#include <arch/mm/tlb.h>
-#include <assert.h>
-#include <config.h>
-#include <genarch/mm/page_ht.h>
-#include <genarch/mm/asid_fifo.h>
-
-#ifdef CONFIG_TSB
-
-#include <arch/mm/tsb.h>
-#include <arch/asm.h>
-#include <mm/frame.h>
-#include <bitops.h>
-#include <macros.h>
-#include <memw.h>
-
-#endif /* CONFIG_TSB */
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	if (config.cpu_active == 1) {
-		as_operations = &as_ht_operations;
-		asid_fifo_init();
-	}
-}
-
-errno_t as_constructor_arch(as_t *as, unsigned int flags)
-{
-#ifdef CONFIG_TSB
-	uintptr_t tsb_base = frame_alloc(TSB_FRAMES, FRAME_LOWMEM | flags,
-	    TSB_SIZE - 1);
-	if (!tsb_base)
-		return ENOMEM;
-
-	tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_base);
-	memsetb(tsb, TSB_SIZE, 0);
-
-	as->arch.itsb = tsb;
-	as->arch.dtsb = tsb + ITSB_ENTRY_COUNT;
-#endif
-
-	return EOK;
-}
-
-int as_destructor_arch(as_t *as)
-{
-#ifdef CONFIG_TSB
-	frame_free(KA2PA((uintptr_t) as->arch.itsb), TSB_FRAMES);
-
-	return TSB_FRAMES;
-#else
-	return 0;
-#endif
-}
-
-errno_t as_create_arch(as_t *as, unsigned int flags)
-{
-#ifdef CONFIG_TSB
-	tsb_invalidate(as, 0, (size_t) -1);
-#endif
-
-	return 0;
-}
-
-/** Perform sparc64-specific tasks when an address space becomes active on the
- * processor.
- *
- * Install ASID and map TSBs.
- *
- * @param as Address space.
- */
-void as_install_arch(as_t *as)
-{
-	tlb_context_reg_t ctx;
-
-	/*
-	 * Note that we don't and may not lock the address space. That's ok
-	 * since we only read members that are currently read-only.
-	 *
-	 * Moreover, the as->asid is protected by asidlock, which is being held.
-	 *
-	 */
-
-	/*
-	 * Write ASID to secondary context register. The primary context
-	 * register has to be set from TL>0 so it will be filled from the
-	 * secondary context register from the TL=1 code just before switch to
-	 * userspace.
-	 *
-	 */
-	ctx.v = 0;
-	ctx.context = as->asid;
-	mmu_secondary_context_write(ctx.v);
-
-#ifdef CONFIG_TSB
-	uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
-
-	assert(as->arch.itsb);
-	assert(as->arch.dtsb);
-
-	uintptr_t tsb = (uintptr_t) as->arch.itsb;
-
-	if (!overlaps(tsb, TSB_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
-		/*
-		 * TSBs were allocated from memory not covered
-		 * by the locked 4M kernel DTLB entry. We need
-		 * to map both TSBs explicitly.
-		 *
-		 */
-		dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, tsb);
-		dtlb_insert_mapping(tsb, KA2PA(tsb), PAGESIZE_64K, true, true);
-	}
-
-	/*
-	 * Setup TSB Base registers.
-	 *
-	 */
-	tsb_base_reg_t tsb_base_reg;
-
-	tsb_base_reg.value = 0;
-	tsb_base_reg.size = TSB_BASE_REG_SIZE;
-	tsb_base_reg.split = 0;
-
-	tsb_base_reg.base = ((uintptr_t) as->arch.itsb) >> MMU_PAGE_WIDTH;
-	itsb_base_write(tsb_base_reg.value);
-	tsb_base_reg.base = ((uintptr_t) as->arch.dtsb) >> MMU_PAGE_WIDTH;
-	dtsb_base_write(tsb_base_reg.value);
-
-#if defined (US3)
-	/*
-	 * Clear the extension registers.
-	 * In HelenOS, primary and secondary context registers contain
-	 * equal values and kernel misses (context 0, ie. the nucleus context)
-	 * are excluded from the TSB miss handler, so it makes no sense
-	 * to have separate TSBs for primary, secondary and nucleus contexts.
-	 * Clearing the extension registers will ensure that the value of the
-	 * TSB Base register will be used as an address of TSB, making the code
-	 * compatible with the US port.
-	 *
-	 */
-	itsb_primary_extension_write(0);
-	itsb_nucleus_extension_write(0);
-	dtsb_primary_extension_write(0);
-	dtsb_secondary_extension_write(0);
-	dtsb_nucleus_extension_write(0);
-#endif
-#endif
-}
-
-/** Perform sparc64-specific tasks when an address space is removed from the
- * processor.
- *
- * Demap TSBs.
- *
- * @param as Address space.
- */
-void as_deinstall_arch(as_t *as)
-{
-	/*
-	 * Note that we don't and may not lock the address space. That's ok
-	 * since we only read members that are currently read-only.
-	 *
-	 * Moreover, the as->asid is protected by asidlock, which is being held.
-	 *
-	 */
-
-#ifdef CONFIG_TSB
-	uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
-
-	assert(as->arch.itsb);
-	assert(as->arch.dtsb);
-
-	uintptr_t tsb = (uintptr_t) as->arch.itsb;
-
-	if (!overlaps(tsb, TSB_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
-		/*
-		 * TSBs were allocated from memory not covered
-		 * by the locked 4M kernel DTLB entry. We need
-		 * to demap the entry installed by as_install_arch().
-		 */
-		dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_NUCLEUS, tsb);
-	}
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4u/frame.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <arch/boot/boot.h>
-#include <typedefs.h>
-#include <config.h>
-#include <align.h>
-#include <macros.h>
-
-/** Create memory zones according to information stored in memmap.
- *
- * Walk the memory map and create frame zones according to it.
- */
-static void frame_common_arch_init(bool low)
-{
-	unsigned int i;
-
-	for (i = 0; i < memmap.cnt; i++) {
-		uintptr_t base;
-		size_t size;
-
-		/*
-		 * The memmap is created by HelenOS boot loader.
-		 * It already contains no holes.
-		 */
-
-		/* To be safe, make the available zone possibly smaller */
-		base = ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE);
-		size = ALIGN_DOWN(memmap.zones[i].size -
-		    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			continue;
-
-		pfn_t confdata;
-		pfn_t pfn = ADDR2PFN(base);
-		size_t count = SIZE2FRAMES(size);
-
-		if (low) {
-			confdata = pfn;
-			if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0))))
-				confdata = ADDR2PFN(KA2PA(PFN2ADDR(2)));
-
-			zone_create(pfn, count, confdata,
-			    ZONE_AVAILABLE | ZONE_LOWMEM);
-		} else {
-			confdata = zone_external_conf_alloc(count);
-			if (confdata != 0)
-				zone_create(pfn, count, confdata,
-				    ZONE_AVAILABLE | ZONE_HIGHMEM);
-		}
-	}
-}
-
-void frame_low_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(true);
-
-	/*
-	 * On sparc64, physical memory can start on a non-zero address.
-	 * The generic frame_init() only marks PFN 0 as not free, so we
-	 * must mark the physically first frame not free explicitly
-	 * here, no matter what is its address.
-	 */
-	frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
-
-	/* PA2KA will work only on low-memory. */
-	end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
-}
-
-void frame_high_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4u/km.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_SPARC64_US_IDENTITY_START;
-	config.identity_size = KM_SPARC64_US_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_SPARC64_US_NON_IDENTITY_START,
-	    KM_SPARC64_US_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_SPARC64_US_NON_IDENTITY_START,
-	    KM_SPARC64_US_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4u/tlb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,572 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/tlb.h>
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <mm/asid.h>
-#include <arch/mm/frame.h>
-#include <arch/mm/page.h>
-#include <arch/mm/mmu.h>
-#include <arch/interrupt.h>
-#include <assert.h>
-#include <interrupt.h>
-#include <arch.h>
-#include <stdio.h>
-#include <typedefs.h>
-#include <config.h>
-#include <arch/trap/trap.h>
-#include <arch/trap/exception.h>
-#include <panic.h>
-#include <arch/asm.h>
-#include <genarch/mm/page_ht.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#endif
-
-static void dtlb_pte_copy(pte_t *, size_t, bool);
-static void itlb_pte_copy(pte_t *, size_t);
-
-const char *context_encoding[] = {
-	"Primary",
-	"Secondary",
-	"Nucleus",
-	"Reserved"
-};
-
-void tlb_arch_init(void)
-{
-	/*
-	 * Invalidate all non-locked DTLB and ITLB entries.
-	 */
-	tlb_invalidate_all();
-
-	/*
-	 * Clear both SFSRs.
-	 */
-	dtlb_sfsr_write(0);
-	itlb_sfsr_write(0);
-}
-
-/** Insert privileged mapping into DMMU TLB.
- *
- * @param page		Virtual page address.
- * @param frame		Physical frame address.
- * @param pagesize	Page size.
- * @param locked	True for permanent mappings, false otherwise.
- * @param cacheable	True if the mapping is cacheable, false otherwise.
- */
-void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize,
-    bool locked, bool cacheable)
-{
-	tlb_tag_access_reg_t tag;
-	tlb_data_t data;
-	page_address_t pg;
-	frame_address_t fr;
-
-	pg.address = page;
-	fr.address = frame;
-
-	tag.context = ASID_KERNEL;
-	tag.vpn = pg.vpn;
-
-	dtlb_tag_access_write(tag.value);
-
-	data.value = 0;
-	data.v = true;
-	data.size = pagesize;
-	data.pfn = fr.pfn;
-	data.l = locked;
-	data.cp = cacheable;
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	data.cv = cacheable;
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-	data.p = true;
-	data.w = true;
-	data.g = false;
-
-	dtlb_data_in_write(data.value);
-}
-
-/** Copy PTE to TLB.
- *
- * @param t 		Page Table Entry to be copied.
- * @param index		Zero if lower 8K-subpage, one if higher 8K-subpage.
- * @param ro		If true, the entry will be created read-only, regardless
- * 			of its w field.
- */
-void dtlb_pte_copy(pte_t *t, size_t index, bool ro)
-{
-	tlb_tag_access_reg_t tag;
-	tlb_data_t data;
-	page_address_t pg;
-	frame_address_t fr;
-
-	pg.address = t->page + (index << MMU_PAGE_WIDTH);
-	fr.address = t->frame + (index << MMU_PAGE_WIDTH);
-
-	tag.value = 0;
-	tag.context = t->as->asid;
-	tag.vpn = pg.vpn;
-
-	dtlb_tag_access_write(tag.value);
-
-	data.value = 0;
-	data.v = true;
-	data.size = PAGESIZE_8K;
-	data.pfn = fr.pfn;
-	data.l = false;
-	data.cp = t->c;
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	data.cv = t->c;
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-	data.p = t->k;		/* p like privileged */
-	data.w = ro ? false : t->w;
-	data.g = t->g;
-
-	dtlb_data_in_write(data.value);
-}
-
-/** Copy PTE to ITLB.
- *
- * @param t		Page Table Entry to be copied.
- * @param index		Zero if lower 8K-subpage, one if higher 8K-subpage.
- */
-void itlb_pte_copy(pte_t *t, size_t index)
-{
-	tlb_tag_access_reg_t tag;
-	tlb_data_t data;
-	page_address_t pg;
-	frame_address_t fr;
-
-	pg.address = t->page + (index << MMU_PAGE_WIDTH);
-	fr.address = t->frame + (index << MMU_PAGE_WIDTH);
-
-	tag.value = 0;
-	tag.context = t->as->asid;
-	tag.vpn = pg.vpn;
-
-	itlb_tag_access_write(tag.value);
-
-	data.value = 0;
-	data.v = true;
-	data.size = PAGESIZE_8K;
-	data.pfn = fr.pfn;
-	data.l = false;
-	data.cp = t->c;
-	data.p = t->k;		/* p like privileged */
-	data.w = false;
-	data.g = t->g;
-
-	itlb_data_in_write(data.value);
-}
-
-/** ITLB miss handler. */
-void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate)
-{
-	size_t index = (istate->tpc >> MMU_PAGE_WIDTH) % MMU_PAGES_PER_PAGE;
-	pte_t t;
-
-	bool found = page_mapping_find(AS, istate->tpc, true, &t);
-	if (found && PTE_EXECUTABLE(&t)) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table.
-		 * Insert it into ITLB.
-		 */
-		t.a = true;
-		itlb_pte_copy(&t, index);
-#ifdef CONFIG_TSB
-		itsb_pte_copy(&t, index);
-#endif
-		page_mapping_update(AS, istate->tpc, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(istate->tpc, PF_ACCESS_EXEC, istate);
-	}
-}
-
-/** DTLB miss handler.
- *
- * Note that some faults (e.g. kernel faults) were already resolved by the
- * low-level, assembly language part of the fast_data_access_mmu_miss handler.
- *
- * @param tt		Trap type.
- * @param istate	Interrupted state saved on the stack.
- */
-void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate)
-{
-	tlb_tag_access_reg_t tag;
-	uintptr_t page_8k;
-	uintptr_t page_16k;
-	size_t index;
-	pte_t t;
-	as_t *as = AS;
-
-	tag.value = istate->tlb_tag_access;
-	page_8k = (uint64_t) tag.vpn << MMU_PAGE_WIDTH;
-	page_16k = ALIGN_DOWN(page_8k, PAGE_SIZE);
-	index = tag.vpn % MMU_PAGES_PER_PAGE;
-
-	if (tag.context == ASID_KERNEL) {
-		if (!tag.vpn) {
-			/* NULL access in kernel */
-			panic("NULL pointer dereference.");
-		} else if (page_8k >= end_of_identity) {
-			/* Kernel non-identity. */
-			as = AS_KERNEL;
-		} else {
-			panic("Unexpected kernel page fault.");
-		}
-	}
-
-	bool found = page_mapping_find(as, page_16k, true, &t);
-	if (found) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table.
-		 * Insert it into DTLB.
-		 */
-		t.a = true;
-		dtlb_pte_copy(&t, index, true);
-#ifdef CONFIG_TSB
-		dtsb_pte_copy(&t, index, true);
-#endif
-		page_mapping_update(as, page_16k, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(page_16k, PF_ACCESS_READ, istate);
-	}
-}
-
-/** DTLB protection fault handler.
- *
- * @param tt		Trap type.
- * @param istate	Interrupted state saved on the stack.
- */
-void fast_data_access_protection(unsigned int tt, istate_t *istate)
-{
-	tlb_tag_access_reg_t tag;
-	uintptr_t page_16k;
-	size_t index;
-	pte_t t;
-	as_t *as = AS;
-
-	tag.value = istate->tlb_tag_access;
-	page_16k = ALIGN_DOWN((uint64_t) tag.vpn << MMU_PAGE_WIDTH, PAGE_SIZE);
-	index = tag.vpn % MMU_PAGES_PER_PAGE;	/* 16K-page emulation */
-
-	if (tag.context == ASID_KERNEL)
-		as = AS_KERNEL;
-
-	bool found = page_mapping_find(as, page_16k, true, &t);
-	if (found && PTE_WRITABLE(&t)) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table and is
-		 * writable. Demap the old mapping and insert an updated mapping
-		 * into DTLB.
-		 */
-		t.a = true;
-		t.d = true;
-		dtlb_demap(TLB_DEMAP_PAGE,
-		    (as == AS_KERNEL) ? TLB_DEMAP_PRIMARY : TLB_DEMAP_SECONDARY,
-		    page_16k + index * MMU_PAGE_SIZE);
-		dtlb_pte_copy(&t, index, false);
-#ifdef CONFIG_TSB
-		dtsb_pte_copy(&t, index, false);
-#endif
-		page_mapping_update(as, page_16k, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(page_16k, PF_ACCESS_WRITE, istate);
-	}
-}
-
-/** Print TLB entry (for debugging purposes).
- *
- * The diag field has been left out in order to make this function more generic
- * (there is no diag field in US3 architeture).
- *
- * @param i		TLB entry number
- * @param t		TLB entry tag
- * @param d		TLB entry data
- */
-static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d)
-{
-	printf("%u: vpn=%#" PRIx64 ", context=%u, v=%u, size=%u, nfo=%u, "
-	    "ie=%u, soft2=%#x, pfn=%#x, soft=%#x, l=%u, "
-	    "cp=%u, cv=%u, e=%u, p=%u, w=%u, g=%u\n", i, (uint64_t) t.vpn,
-	    t.context, d.v, d.size, d.nfo, d.ie, d.soft2,
-	    d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g);
-}
-
-#if defined (US)
-
-/** Print contents of both TLBs. */
-void tlb_print(void)
-{
-	int i;
-	tlb_data_t d;
-	tlb_tag_read_reg_t t;
-
-	printf("I-TLB contents:\n");
-	for (i = 0; i < ITLB_ENTRY_COUNT; i++) {
-		d.value = itlb_data_access_read(i);
-		t.value = itlb_tag_read_read(i);
-		print_tlb_entry(i, t, d);
-	}
-
-	printf("D-TLB contents:\n");
-	for (i = 0; i < DTLB_ENTRY_COUNT; i++) {
-		d.value = dtlb_data_access_read(i);
-		t.value = dtlb_tag_read_read(i);
-		print_tlb_entry(i, t, d);
-	}
-}
-
-#elif defined (US3)
-
-/** Print contents of all TLBs. */
-void tlb_print(void)
-{
-	int i;
-	tlb_data_t d;
-	tlb_tag_read_reg_t t;
-
-	printf("TLB_ISMALL contents:\n");
-	for (i = 0; i < tlb_ismall_size(); i++) {
-		d.value = dtlb_data_access_read(TLB_ISMALL, i);
-		t.value = dtlb_tag_read_read(TLB_ISMALL, i);
-		print_tlb_entry(i, t, d);
-	}
-
-	printf("TLB_IBIG contents:\n");
-	for (i = 0; i < tlb_ibig_size(); i++) {
-		d.value = dtlb_data_access_read(TLB_IBIG, i);
-		t.value = dtlb_tag_read_read(TLB_IBIG, i);
-		print_tlb_entry(i, t, d);
-	}
-
-	printf("TLB_DSMALL contents:\n");
-	for (i = 0; i < tlb_dsmall_size(); i++) {
-		d.value = dtlb_data_access_read(TLB_DSMALL, i);
-		t.value = dtlb_tag_read_read(TLB_DSMALL, i);
-		print_tlb_entry(i, t, d);
-	}
-
-	printf("TLB_DBIG_1 contents:\n");
-	for (i = 0; i < tlb_dbig_size(); i++) {
-		d.value = dtlb_data_access_read(TLB_DBIG_0, i);
-		t.value = dtlb_tag_read_read(TLB_DBIG_0, i);
-		print_tlb_entry(i, t, d);
-	}
-
-	printf("TLB_DBIG_2 contents:\n");
-	for (i = 0; i < tlb_dbig_size(); i++) {
-		d.value = dtlb_data_access_read(TLB_DBIG_1, i);
-		t.value = dtlb_tag_read_read(TLB_DBIG_1, i);
-		print_tlb_entry(i, t, d);
-	}
-}
-
-#endif
-
-void describe_dmmu_fault(void)
-{
-	tlb_sfsr_reg_t sfsr;
-	uintptr_t sfar;
-
-	sfsr.value = dtlb_sfsr_read();
-	sfar = dtlb_sfar_read();
-
-#if defined (US)
-	printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, "
-	    "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
-	    sfsr.ow, sfsr.fv);
-#elif defined (US3)
-	printf("DTLB SFSR: nf=%d, asi=%#x, tm=%d, ft=%#x, e=%d, ct=%d, pr=%d, "
-	    "w=%d, ow=%d, fv=%d\n", sfsr.nf, sfsr.asi, sfsr.tm, sfsr.ft,
-	    sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
-#endif
-
-	printf("DTLB SFAR: address=%p\n", (void *) sfar);
-
-	dtlb_sfsr_write(0);
-}
-
-void dump_sfsr_and_sfar(void)
-{
-	tlb_sfsr_reg_t sfsr;
-	uintptr_t sfar;
-
-	sfsr.value = dtlb_sfsr_read();
-	sfar = dtlb_sfar_read();
-
-#if defined (US)
-	printf("DTLB SFSR: asi=%#x, ft=%#x, e=%d, ct=%d, pr=%d, w=%d, ow=%d, "
-	    "fv=%d\n", sfsr.asi, sfsr.ft, sfsr.e, sfsr.ct, sfsr.pr, sfsr.w,
-	    sfsr.ow, sfsr.fv);
-#elif defined (US3)
-	printf("DTLB SFSR: nf=%d, asi=%#x, tm=%d, ft=%#x, e=%d, ct=%d, pr=%d, "
-	    "w=%d, ow=%d, fv=%d\n", sfsr.nf, sfsr.asi, sfsr.tm, sfsr.ft,
-	    sfsr.e, sfsr.ct, sfsr.pr, sfsr.w, sfsr.ow, sfsr.fv);
-#endif
-
-	printf("DTLB SFAR: address=%p\n", (void *) sfar);
-
-	dtlb_sfsr_write(0);
-}
-
-#if defined (US)
-/** Invalidate all unlocked ITLB and DTLB entries. */
-void tlb_invalidate_all(void)
-{
-	int i;
-
-	/*
-	 * Walk all ITLB and DTLB entries and remove all unlocked mappings.
-	 *
-	 * The kernel doesn't use global mappings so any locked global mappings
-	 * found must have been created by someone else. Their only purpose now
-	 * is to collide with proper mappings. Invalidate immediately. It should
-	 * be safe to invalidate them as late as now.
-	 */
-
-	tlb_data_t d;
-	tlb_tag_read_reg_t t;
-
-	for (i = 0; i < ITLB_ENTRY_COUNT; i++) {
-		d.value = itlb_data_access_read(i);
-		if (!d.l || d.g) {
-			t.value = itlb_tag_read_read(i);
-			d.v = false;
-			itlb_tag_access_write(t.value);
-			itlb_data_access_write(i, d.value);
-		}
-	}
-
-	for (i = 0; i < DTLB_ENTRY_COUNT; i++) {
-		d.value = dtlb_data_access_read(i);
-		if (!d.l || d.g) {
-			t.value = dtlb_tag_read_read(i);
-			d.v = false;
-			dtlb_tag_access_write(t.value);
-			dtlb_data_access_write(i, d.value);
-		}
-	}
-
-}
-
-#elif defined (US3)
-
-/** Invalidate all unlocked ITLB and DTLB entries. */
-void tlb_invalidate_all(void)
-{
-	itlb_demap(TLB_DEMAP_ALL, 0, 0);
-	dtlb_demap(TLB_DEMAP_ALL, 0, 0);
-}
-
-#endif
-
-/** Invalidate all ITLB and DTLB entries that belong to specified ASID
- * (Context).
- *
- * @param asid Address Space ID.
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	tlb_context_reg_t pc_save, ctx;
-
-	/* switch to nucleus because we are mapped by the primary context */
-	nucleus_enter();
-
-	ctx.v = pc_save.v = mmu_primary_context_read();
-	ctx.context = asid;
-	mmu_primary_context_write(ctx.v);
-
-	itlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0);
-	dtlb_demap(TLB_DEMAP_CONTEXT, TLB_DEMAP_PRIMARY, 0);
-
-	mmu_primary_context_write(pc_save.v);
-
-	nucleus_leave();
-}
-
-/** Invalidate all ITLB and DTLB entries for specified page range in specified
- * address space.
- *
- * @param asid		Address Space ID.
- * @param page		First page which to sweep out from ITLB and DTLB.
- * @param cnt		Number of ITLB and DTLB entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	unsigned int i;
-	tlb_context_reg_t pc_save, ctx;
-
-	/* switch to nucleus because we are mapped by the primary context */
-	nucleus_enter();
-
-	ctx.v = pc_save.v = mmu_primary_context_read();
-	ctx.context = asid;
-	mmu_primary_context_write(ctx.v);
-
-	for (i = 0; i < cnt * MMU_PAGES_PER_PAGE; i++) {
-		itlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY,
-		    page + i * MMU_PAGE_SIZE);
-		dtlb_demap(TLB_DEMAP_PAGE, TLB_DEMAP_PRIMARY,
-		    page + i * MMU_PAGE_SIZE);
-	}
-
-	mmu_primary_context_write(pc_save.v);
-
-	nucleus_leave();
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4u/tsb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4u/tsb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/tsb.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/page.h>
-#include <barrier.h>
-#include <assert.h>
-#include <mm/as.h>
-#include <typedefs.h>
-#include <macros.h>
-
-/** Invalidate portion of TSB.
- *
- * We assume that the address space is already locked. Note that respective
- * portions of both TSBs are invalidated at a time.
- *
- * @param as Address space.
- * @param page First page to invalidate in TSB.
- * @param pages Number of pages to invalidate. Value of (size_t) -1 means the
- * 	whole TSB.
- */
-void tsb_invalidate(as_t *as, uintptr_t page, size_t pages)
-{
-	size_t i0;
-	size_t i;
-	size_t cnt;
-
-	assert(as->arch.itsb);
-	assert(as->arch.dtsb);
-
-	i0 = (page >> MMU_PAGE_WIDTH) & ITSB_ENTRY_MASK;
-
-	if (pages == (size_t) -1 || (pages * 2) > ITSB_ENTRY_COUNT)
-		cnt = ITSB_ENTRY_COUNT;
-	else
-		cnt = pages * 2;
-
-	for (i = 0; i < cnt; i++) {
-		as->arch.itsb[(i0 + i) & ITSB_ENTRY_MASK].tag.invalid = true;
-		as->arch.dtsb[(i0 + i) & DTSB_ENTRY_MASK].tag.invalid = true;
-	}
-}
-
-/** Copy software PTE to ITSB.
- *
- * @param t 	Software PTE.
- * @param index	Zero if lower 8K-subpage, one if higher 8K subpage.
- */
-void itsb_pte_copy(pte_t *t, size_t index)
-{
-	as_t *as;
-	tsb_entry_t *tte;
-	size_t entry;
-
-	assert(index <= 1);
-
-	as = t->as;
-	entry = ((t->page >> MMU_PAGE_WIDTH) + index) & ITSB_ENTRY_MASK;
-	tte = &as->arch.itsb[entry];
-
-	/*
-	 * We use write barriers to make sure that the TSB load
-	 * won't use inconsistent data or that the fault will
-	 * be repeated.
-	 */
-
-	/* Invalidate the entry (tag target has this set to 0) */
-	tte->tag.invalid = true;
-
-	write_barrier();
-
-	tte->tag.context = as->asid;
-	/* the shift is bigger than PAGE_WIDTH, do not bother with index  */
-	tte->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
-	tte->data.value = 0;
-	tte->data.size = PAGESIZE_8K;
-	tte->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index;
-	tte->data.cp = t->c;	/* cp as cache in phys.-idxed, c as cacheable */
-	tte->data.p = t->k;	/* p as privileged, k as kernel */
-	tte->data.v = t->p;	/* v as valid, p as present */
-
-	write_barrier();
-
-	tte->tag.invalid = false;	/* mark the entry as valid */
-}
-
-/** Copy software PTE to DTSB.
- *
- * @param t	Software PTE.
- * @param index	Zero if lower 8K-subpage, one if higher 8K-subpage.
- * @param ro	If true, the mapping is copied read-only.
- */
-void dtsb_pte_copy(pte_t *t, size_t index, bool ro)
-{
-	as_t *as;
-	tsb_entry_t *tte;
-	size_t entry;
-
-	assert(index <= 1);
-
-	as = t->as;
-	entry = ((t->page >> MMU_PAGE_WIDTH) + index) & DTSB_ENTRY_MASK;
-	tte = &as->arch.dtsb[entry];
-
-	/*
-	 * We use write barriers to make sure that the TSB load
-	 * won't use inconsistent data or that the fault will
-	 * be repeated.
-	 */
-
-	/* Invalidate the entry (tag target has this set to 0) */
-	tte->tag.invalid = true;
-
-	write_barrier();
-
-	tte->tag.context = as->asid;
-	/* the shift is bigger than PAGE_WIDTH, do not bother with index */
-	tte->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
-	tte->data.value = 0;
-	tte->data.size = PAGESIZE_8K;
-	tte->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index;
-	tte->data.cp = t->c;
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	tte->data.cv = t->c;
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-	tte->data.p = t->k;		/* p as privileged */
-	tte->data.w = ro ? false : t->w;
-	tte->data.v = t->p;
-
-	write_barrier();
-
-	tte->tag.invalid = false;	/* mark the entry as valid */
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4v/as.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/as.h>
-#include <arch/mm/pagesize.h>
-#include <arch/mm/tlb.h>
-#include <assert.h>
-#include <genarch/mm/page_ht.h>
-#include <genarch/mm/asid_fifo.h>
-#include <config.h>
-#include <arch/sun4v/hypercall.h>
-
-#ifdef CONFIG_TSB
-
-#include <arch/mm/tsb.h>
-#include <arch/asm.h>
-#include <mm/frame.h>
-#include <bitops.h>
-#include <macros.h>
-#include <memw.h>
-
-#endif /* CONFIG_TSB */
-
-/** Architecture dependent address space init. */
-void as_arch_init(void)
-{
-	if (config.cpu_active == 1) {
-		as_operations = &as_ht_operations;
-		asid_fifo_init();
-	}
-}
-
-errno_t as_constructor_arch(as_t *as, unsigned int flags)
-{
-#ifdef CONFIG_TSB
-	uintptr_t tsb_base = frame_alloc(TSB_FRAMES, FRAME_LOWMEM | flags,
-	    TSB_SIZE - 1);
-	if (!tsb_base)
-		return ENOMEM;
-
-	tsb_entry_t *tsb = (tsb_entry_t *) PA2KA(tsb_base);
-
-	as->arch.tsb_description.page_size = PAGESIZE_8K;
-	as->arch.tsb_description.associativity = 1;
-	as->arch.tsb_description.num_ttes = TSB_ENTRY_COUNT;
-	as->arch.tsb_description.pgsize_mask = 1 << PAGESIZE_8K;
-	as->arch.tsb_description.tsb_base = tsb_base;
-	as->arch.tsb_description.reserved = 0;
-	as->arch.tsb_description.context = 0;
-
-	memsetb(tsb, TSB_SIZE, 0);
-#endif
-
-	return EOK;
-}
-
-int as_destructor_arch(as_t *as)
-{
-#ifdef CONFIG_TSB
-	frame_free(as->arch.tsb_description.tsb_base, TSB_FRAMES);
-
-	return TSB_FRAMES;
-#else
-	return 0;
-#endif
-}
-
-errno_t as_create_arch(as_t *as, unsigned int flags)
-{
-#ifdef CONFIG_TSB
-	tsb_invalidate(as, 0, (size_t) -1);
-#endif
-
-	return EOK;
-}
-
-/** Perform sparc64-specific tasks when an address space becomes active on the
- * processor.
- *
- * Install ASID and map TSBs.
- *
- * @param as Address space.
- *
- */
-void as_install_arch(as_t *as)
-{
-	mmu_secondary_context_write(as->asid);
-
-#ifdef CONFIG_TSB
-	uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
-
-	assert(as->arch.tsb_description.tsb_base);
-	uintptr_t tsb = PA2KA(as->arch.tsb_description.tsb_base);
-
-	if (!overlaps(tsb, TSB_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
-		/*
-		 * TSBs were allocated from memory not covered
-		 * by the locked 4M kernel DTLB entry. We need
-		 * to map both TSBs explicitly.
-		 *
-		 */
-		mmu_demap_page(tsb, 0, MMU_FLAG_DTLB);
-		dtlb_insert_mapping(tsb, KA2PA(tsb), PAGESIZE_64K, true, true);
-	}
-
-	__hypercall_fast2(MMU_TSB_CTXNON0, 1, KA2PA(&as->arch.tsb_description));
-#endif
-}
-
-/** Perform sparc64-specific tasks when an address space is removed from the
- * processor.
- *
- * Demap TSBs.
- *
- * @param as Address space.
- *
- */
-void as_deinstall_arch(as_t *as)
-{
-	/*
-	 * Note that we don't and may not lock the address space. That's ok
-	 * since we only read members that are currently read-only.
-	 *
-	 * Moreover, the as->asid is protected by asidlock, which is being held.
-	 *
-	 */
-
-#ifdef CONFIG_TSB
-	uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
-
-	assert(as->arch.tsb_description.tsb_base);
-
-	uintptr_t tsb = PA2KA(as->arch.tsb_description.tsb_base);
-
-	if (!overlaps(tsb, TSB_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) {
-		/*
-		 * TSBs were allocated from memory not covered
-		 * by the locked 4M kernel DTLB entry. We need
-		 * to demap the entry installed by as_install_arch().
-		 *
-		 */
-		__hypercall_fast3(MMU_UNMAP_PERM_ADDR, tsb, 0, MMU_FLAG_DTLB);
-	}
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4v/frame.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/frame.h>
-#include <mm/frame.h>
-#include <arch/boot/boot.h>
-#include <typedefs.h>
-#include <config.h>
-#include <align.h>
-#include <macros.h>
-
-/** Create memory zones according to information stored in memmap.
- *
- * Walk the memory map and create frame zones according to it.
- */
-static void frame_common_arch_init(bool low)
-{
-	unsigned int i;
-
-	for (i = 0; i < memmap.cnt; i++) {
-		uintptr_t base;
-		size_t size;
-
-		/*
-		 * The memmap is created by HelenOS boot loader.
-		 * It already contains no holes.
-		 */
-
-		/* To be safe, make the available zone possibly smaller */
-		base = ALIGN_UP((uintptr_t) memmap.zones[i].start, FRAME_SIZE);
-		size = ALIGN_DOWN(memmap.zones[i].size -
-		    (base - ((uintptr_t) memmap.zones[i].start)), FRAME_SIZE);
-
-		if (!frame_adjust_zone_bounds(low, &base, &size))
-			continue;
-
-		pfn_t confdata;
-		pfn_t pfn = ADDR2PFN(base);
-		size_t count = SIZE2FRAMES(size);
-
-		if (low) {
-			confdata = pfn;
-			if (confdata == ADDR2PFN(KA2PA(PFN2ADDR(0))))
-				confdata = ADDR2PFN(KA2PA(PFN2ADDR(2)));
-
-			zone_create(pfn, count, confdata,
-			    ZONE_AVAILABLE | ZONE_LOWMEM);
-		} else {
-			confdata = zone_external_conf_alloc(count);
-			if (confdata != 0)
-				zone_create(pfn, count, confdata,
-				    ZONE_AVAILABLE | ZONE_HIGHMEM);
-		}
-	}
-}
-
-void frame_low_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(true);
-
-	/*
-	 * On sparc64, physical memory can start on a non-zero address.
-	 * The generic frame_init() only marks PFN 0 as not free, so we
-	 * must mark the physically first frame not free explicitly
-	 * here, no matter what is its address.
-	 */
-	frame_mark_unavailable(ADDR2PFN(KA2PA(PFN2ADDR(0))), 1);
-
-	/* PA2KA will work only on low-memory. */
-	end_of_identity = PA2KA(config.physmem_end - FRAME_SIZE) + PAGE_SIZE;
-}
-
-void frame_high_arch_init(void)
-{
-	if (config.cpu_active > 1)
-		return;
-
-	frame_common_arch_init(false);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4v/km.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-
-#include <arch/mm/km.h>
-#include <mm/km.h>
-#include <config.h>
-#include <typedefs.h>
-#include <macros.h>
-
-void km_identity_arch_init(void)
-{
-	config.identity_base = KM_SPARC64_T1_IDENTITY_START;
-	config.identity_size = KM_SPARC64_T1_IDENTITY_SIZE;
-}
-
-void km_non_identity_arch_init(void)
-{
-	km_non_identity_span_add(KM_SPARC64_T1_NON_IDENTITY_START,
-	    KM_SPARC64_T1_NON_IDENTITY_SIZE);
-}
-
-bool km_is_non_identity_arch(uintptr_t addr)
-{
-	return iswithin(KM_SPARC64_T1_NON_IDENTITY_START,
-	    KM_SPARC64_T1_NON_IDENTITY_SIZE, addr, 1);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4v/tlb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,402 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2008 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <mm/asid.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/mm/frame.h>
-#include <arch/mm/page.h>
-#include <arch/mm/tte.h>
-#include <arch/mm/tlb.h>
-#include <arch/interrupt.h>
-#include <assert.h>
-#include <interrupt.h>
-#include <arch.h>
-#include <stdio.h>
-#include <log.h>
-#include <typedefs.h>
-#include <config.h>
-#include <arch/trap/trap.h>
-#include <arch/trap/exception.h>
-#include <panic.h>
-#include <arch/asm.h>
-#include <arch/cpu.h>
-#include <arch/mm/pagesize.h>
-#include <genarch/mm/page_ht.h>
-
-#ifdef CONFIG_TSB
-#include <arch/mm/tsb.h>
-#endif
-
-static void itlb_pte_copy(pte_t *);
-static void dtlb_pte_copy(pte_t *, bool);
-
-/*
- * The assembly language routine passes a 64-bit parameter to the Data Access
- * MMU Miss and Data Access protection handlers, the parameter encapsulates
- * a virtual address of the faulting page and the faulting context. The most
- * significant 51 bits represent the VA of the faulting page and the least
- * significant 13 vits represent the faulting context. The following macros
- * extract the page and context out of the 64-bit parameter:
- */
-
-/* extracts the VA of the faulting page */
-#define DMISS_ADDRESS(page_and_ctx)	(((page_and_ctx) >> 13) << 13)
-
-/* extracts the faulting context */
-#define DMISS_CONTEXT(page_and_ctx)	((page_and_ctx) & 0x1fff)
-
-/**
- * Descriptions of fault types from the MMU Fault status area.
- *
- * fault_type[i] contains description of error for which the IFT or DFT
- * field of the MMU fault status area is i.
- */
-static const char *fault_types[] = {
-	"unknown",
-	"fast miss",
-	"fast protection",
-	"MMU miss",
-	"invalid RA",
-	"privileged violation",
-	"protection violation",
-	"NFO access",
-	"so page/NFO side effect",
-	"invalid VA",
-	"invalid ASI",
-	"nc atomic",
-	"privileged action",
-	"unknown",
-	"unaligned access",
-	"invalid page size"
-};
-
-/** Array of MMU fault status areas. */
-extern mmu_fault_status_area_t mmu_fsas[MAX_NUM_STRANDS];
-
-/*
- * Invalidate all non-locked DTLB and ITLB entries.
- */
-void tlb_arch_init(void)
-{
-	tlb_invalidate_all();
-}
-
-/** Insert privileged mapping into DMMU TLB.
- *
- * @param page		Virtual page address.
- * @param frame		Physical frame address.
- * @param pagesize	Page size.
- * @param locked	True for permanent mappings, false otherwise.
- * @param cacheable	True if the mapping is cacheable, false otherwise.
- */
-void dtlb_insert_mapping(uintptr_t page, uintptr_t frame, int pagesize,
-    bool locked, bool cacheable)
-{
-	tte_data_t data;
-
-	data.value = 0;
-	data.v = true;
-	data.nfo = false;
-	data.ra = frame >> FRAME_WIDTH;
-	data.ie = false;
-	data.e = false;
-	data.cp = cacheable;
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	data.cv = cacheable;
-#endif
-	data.p = true;
-	data.x = false;
-	data.w = true;
-	data.size = pagesize;
-
-	if (locked) {
-		__hypercall_fast4(
-		    MMU_MAP_PERM_ADDR, page, 0, data.value, MMU_FLAG_DTLB);
-	} else {
-		__hypercall_hyperfast(
-		    page, ASID_KERNEL, data.value, MMU_FLAG_DTLB, 0,
-		    MMU_MAP_ADDR);
-	}
-}
-
-/** Copy PTE to TLB.
- *
- * @param t 		Page Table Entry to be copied.
- * @param ro		If true, the entry will be created read-only, regardless
- * 			of its w field.
- */
-void dtlb_pte_copy(pte_t *t, bool ro)
-{
-	tte_data_t data;
-
-	data.value = 0;
-	data.v = true;
-	data.nfo = false;
-	data.ra = (t->frame) >> FRAME_WIDTH;
-	data.ie = false;
-	data.e = false;
-	data.cp = t->c;
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	data.cv = t->c;
-#endif
-	data.p = t->k;
-	data.x = false;
-	data.w = ro ? false : t->w;
-	data.size = PAGESIZE_8K;
-
-	__hypercall_hyperfast(
-	    t->page, t->as->asid, data.value, MMU_FLAG_DTLB, 0, MMU_MAP_ADDR);
-}
-
-/** Copy PTE to ITLB.
- *
- * @param t		Page Table Entry to be copied.
- */
-void itlb_pte_copy(pte_t *t)
-{
-	tte_data_t data;
-
-	data.value = 0;
-	data.v = true;
-	data.nfo = false;
-	data.ra = (t->frame) >> FRAME_WIDTH;
-	data.ie = false;
-	data.e = false;
-	data.cp = t->c;
-	data.cv = false;
-	data.p = t->k;
-	data.x = true;
-	data.w = false;
-	data.size = PAGESIZE_8K;
-
-	__hypercall_hyperfast(
-	    t->page, t->as->asid, data.value, MMU_FLAG_ITLB, 0, MMU_MAP_ADDR);
-}
-
-/** ITLB miss handler. */
-void fast_instruction_access_mmu_miss(unsigned int tt, istate_t *istate)
-{
-	uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
-	pte_t t;
-
-	bool found = page_mapping_find(AS, va, true, &t);
-	if (found && PTE_EXECUTABLE(&t)) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table.
-		 * Insert it into ITLB.
-		 */
-		t.a = true;
-		itlb_pte_copy(&t);
-#ifdef CONFIG_TSB
-		itsb_pte_copy(&t);
-#endif
-		page_mapping_update(AS, va, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(va, PF_ACCESS_EXEC, istate);
-	}
-}
-
-/** DTLB miss handler.
- *
- * Note that some faults (e.g. kernel faults) were already resolved by the
- * low-level, assembly language part of the fast_data_access_mmu_miss handler.
- *
- * @param tt		Trap type.
- * @param istate	Interrupted state saved on the stack.
- */
-void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate)
-{
-	pte_t t;
-	uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
-	uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
-	as_t *as = AS;
-
-	if (ctx == ASID_KERNEL) {
-		if (va == 0) {
-			/* NULL access in kernel */
-			panic("NULL pointer dereference.");
-		} else if (va >= end_of_identity) {
-			/* Kernel non-identity */
-			as = AS_KERNEL;
-		} else {
-			panic("Unexpected kernel page fault.");
-		}
-	}
-
-	bool found = page_mapping_find(as, va, true, &t);
-	if (found) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table.
-		 * Insert it into DTLB.
-		 */
-		t.a = true;
-		dtlb_pte_copy(&t, true);
-#ifdef CONFIG_TSB
-		dtsb_pte_copy(&t, true);
-#endif
-		page_mapping_update(as, va, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(va, PF_ACCESS_READ, istate);
-	}
-}
-
-/** DTLB protection fault handler.
- *
- * @param tt		Trap type.
- * @param istate	Interrupted state saved on the stack.
- */
-void fast_data_access_protection(unsigned int tt, istate_t *istate)
-{
-	pte_t t;
-	uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
-	uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
-	as_t *as = AS;
-
-	if (ctx == ASID_KERNEL)
-		as = AS_KERNEL;
-
-	bool found = page_mapping_find(as, va, true, &t);
-	if (found && PTE_WRITABLE(&t)) {
-		assert(t.p);
-
-		/*
-		 * The mapping was found in the software page hash table and is
-		 * writable. Demap the old mapping and insert an updated mapping
-		 * into DTLB.
-		 */
-		t.a = true;
-		t.d = true;
-		mmu_demap_page(va, ctx, MMU_FLAG_DTLB);
-		dtlb_pte_copy(&t, false);
-#ifdef CONFIG_TSB
-		dtsb_pte_copy(&t, false);
-#endif
-		page_mapping_update(as, va, true, &t);
-	} else {
-		/*
-		 * Forward the page fault to the address space page fault
-		 * handler.
-		 */
-		as_page_fault(va, PF_ACCESS_WRITE, istate);
-	}
-}
-
-/*
- * On Niagara this function does not work, as supervisor software is isolated
- * from the TLB by the hypervisor and has no chance to investigate the TLB
- * entries.
- */
-void tlb_print(void)
-{
-	log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara.");
-}
-
-/**
- * Describes the exact condition which caused the last DMMU fault.
- */
-void describe_dmmu_fault(void)
-{
-	uint64_t myid;
-	__hypercall_fast_ret1(0, 0, 0, 0, 0, CPU_MYID, &myid);
-
-	assert(mmu_fsas[myid].dft < 16);
-
-	printf("condition which caused the fault: %s\n",
-	    fault_types[mmu_fsas[myid].dft]);
-}
-
-/** Invalidate all unlocked ITLB and DTLB entries. */
-void tlb_invalidate_all(void)
-{
-	uint64_t errno =  __hypercall_fast3(MMU_DEMAP_ALL, 0, 0,
-	    MMU_FLAG_DTLB | MMU_FLAG_ITLB);
-	if (errno != HV_EOK)
-		panic("Error code = %" PRIu64 ".\n", errno);
-}
-
-/** Invalidate all ITLB and DTLB entries that belong to specified ASID
- * (Context).
- *
- * @param asid Address Space ID.
- */
-void tlb_invalidate_asid(asid_t asid)
-{
-	/* switch to nucleus because we are mapped by the primary context */
-	nucleus_enter();
-
-	__hypercall_fast4(MMU_DEMAP_CTX, 0, 0, asid,
-	    MMU_FLAG_ITLB | MMU_FLAG_DTLB);
-
-	nucleus_leave();
-}
-
-/** Invalidate all ITLB and DTLB entries for specified page range in specified
- * address space.
- *
- * @param asid		Address Space ID.
- * @param page		First page which to sweep out from ITLB and DTLB.
- * @param cnt		Number of ITLB and DTLB entries to invalidate.
- */
-void tlb_invalidate_pages(asid_t asid, uintptr_t page, size_t cnt)
-{
-	unsigned int i;
-
-	/* switch to nucleus because we are mapped by the primary context */
-	nucleus_enter();
-
-	for (i = 0; i < cnt; i++) {
-		__hypercall_fast5(MMU_DEMAP_PAGE, 0, 0, page + i * PAGE_SIZE,
-		    asid, MMU_FLAG_DTLB | MMU_FLAG_ITLB);
-	}
-
-	nucleus_leave();
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/mm/sun4v/tsb.c
===================================================================
--- kernel/arch/sparc64/src/mm/sun4v/tsb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_mm
- * @{
- */
-/** @file
- */
-
-#include <arch/mm/tsb.h>
-#include <arch/mm/pagesize.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/page.h>
-#include <barrier.h>
-#include <assert.h>
-#include <mm/as.h>
-#include <typedefs.h>
-#include <macros.h>
-
-/** Invalidate portion of TSB.
- *
- * We assume that the address space is already locked. Note that respective
- * portions of both TSBs are invalidated at a time.
- *
- * @param as	Address space.
- * @param page 	First page to invalidate in TSB.
- * @param pages Number of pages to invalidate. Value of (count_t) -1 means the
- * 		whole TSB.
- */
-void tsb_invalidate(as_t *as, uintptr_t page, size_t pages)
-{
-	tsb_entry_t *tsb;
-	size_t i0, i;
-	size_t cnt;
-
-	assert(as->arch.tsb_description.tsb_base);
-
-	i0 = (page >> MMU_PAGE_WIDTH) & TSB_ENTRY_MASK;
-
-	if (pages == (size_t) -1 || pages > TSB_ENTRY_COUNT)
-		cnt = TSB_ENTRY_COUNT;
-	else
-		cnt = pages;
-
-	tsb = (tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base);
-	for (i = 0; i < cnt; i++)
-		tsb[(i0 + i) & TSB_ENTRY_MASK].data.v = false;
-}
-
-/** Copy software PTE to ITSB.
- *
- * @param t 	Software PTE.
- */
-void itsb_pte_copy(pte_t *t)
-{
-	as_t *as;
-	tsb_entry_t *tsb;
-	tsb_entry_t *tte;
-	size_t index;
-
-	as = t->as;
-	index = (t->page >> MMU_PAGE_WIDTH) & TSB_ENTRY_MASK;
-
-	tsb = (tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base);
-	tte = &tsb[index];
-
-	/*
-	 * We use write barriers to make sure that the TSB load
-	 * won't use inconsistent data or that the fault will
-	 * be repeated.
-	 */
-
-	tte->data.v = false;
-
-	write_barrier();
-
-	tte->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
-
-	tte->data.value = 0;
-	tte->data.nfo = false;
-	tte->data.ra = t->frame >> MMU_FRAME_WIDTH;
-	tte->data.ie = false;
-	tte->data.e = false;
-	tte->data.cp = t->c;	/* cp as cache in phys.-idxed, c as cacheable */
-	tte->data.cv = false;
-	tte->data.p = t->k;	/* p as privileged, k as kernel */
-	tte->data.x = true;
-	tte->data.w = false;
-	tte->data.size = PAGESIZE_8K;
-
-	write_barrier();
-
-	tte->data.v = t->p;	/* v as valid, p as present */
-}
-
-/** Copy software PTE to DTSB.
- *
- * @param t	Software PTE.
- * @param ro	If true, the mapping is copied read-only.
- */
-void dtsb_pte_copy(pte_t *t, bool ro)
-{
-	as_t *as;
-	tsb_entry_t *tsb;
-	tsb_entry_t *tte;
-	size_t index;
-
-	as = t->as;
-	index = (t->page >> MMU_PAGE_WIDTH) & TSB_ENTRY_MASK;
-	tsb = (tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base);
-	tte = &tsb[index];
-
-	/*
-	 * We use write barriers to make sure that the TSB load
-	 * won't use inconsistent data or that the fault will
-	 * be repeated.
-	 */
-
-	tte->data.v = false;
-
-	write_barrier();
-
-	tte->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT;
-
-	tte->data.value = 0;
-	tte->data.nfo = false;
-	tte->data.ra = t->frame >> MMU_FRAME_WIDTH;
-	tte->data.ie = false;
-	tte->data.e = false;
-	tte->data.cp = t->c;	/* cp as cache in phys.-idxed, c as cacheable */
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	tte->data.cv = t->c;
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-	tte->data.p = t->k;	/* p as privileged, k as kernel */
-	tte->data.x = true;
-	tte->data.w = ro ? false : t->w;
-	tte->data.size = PAGESIZE_8K;
-
-	write_barrier();
-
-	tte->data.v = t->p;	/* v as valid, p as present */
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/proc/sun4u/scheduler.c
===================================================================
--- kernel/arch/sparc64/src/proc/sun4u/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <arch/asm.h>
-#include <arch/stack.h>
-
-/** Perform sparc64 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Perform sparc64 specific steps before scheduling a thread.
- *
- * For userspace threads, initialize reserved global registers in the alternate
- * and interrupt sets.
- */
-void before_thread_runs_arch(void)
-{
-	if (THREAD->uspace) {
-		uint64_t sp;
-
-		/*
-		 * Write kernel stack address to %g6 of the alternate and
-		 * interrupt global sets.
-		 *
-		 * Write pointer to the last item in the userspace window buffer
-		 * to %g7 in the alternate set. Write to the interrupt %g7 is
-		 * not necessary because:
-		 * - spill traps operate only in the alternate global set,
-		 * - preemptible trap handler switches to alternate globals
-		 *   before it explicitly uses %g7.
-		 */
-		sp = (uintptr_t) THREAD->kstack + STACK_SIZE - STACK_BIAS;
-		write_to_ig_g6(sp);
-		write_to_ag_g6(sp);
-		write_to_ag_g7((uintptr_t) THREAD->arch.uspace_window_buffer);
-	}
-}
-
-/** Perform sparc64 specific steps before a thread stops running. */
-void after_thread_ran_arch(void)
-{
-	if (THREAD->uspace) {
-		asm volatile ("flushw");
-
-		/* sample the state of the userspace window buffer */
-		THREAD->arch.uspace_window_buffer =
-		    (uint8_t *) read_from_ag_g7();
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/proc/sun4v/scheduler.c
===================================================================
--- kernel/arch/sparc64/src/proc/sun4v/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <arch/asm.h>
-#include <arch/arch.h>
-#include <arch/stack.h>
-#include <arch/sun4v/cpu.h>
-#include <arch/sun4v/hypercall.h>
-
-/** Perform sparc64 specific tasks needed before the new task is run. */
-void before_task_runs_arch(void)
-{
-}
-
-/** Perform sparc64 specific steps before scheduling a thread.
- *
- * For userspace threads, initialize pointer to the kernel stack and for the
- * userspace window buffer.
- */
-void before_thread_runs_arch(void)
-{
-	if (THREAD->uspace) {
-		uint64_t sp;
-
-		sp = (uintptr_t) THREAD->kstack + STACK_SIZE - STACK_BIAS;
-		asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_KSTACK, sp);
-		asi_u64_write(ASI_SCRATCHPAD, SCRATCHPAD_WBUF,
-		    (uintptr_t) THREAD->arch.uspace_window_buffer);
-	}
-}
-
-/** Perform sparc64 specific steps before a thread stops running. */
-void after_thread_ran_arch(void)
-{
-	if (THREAD->uspace) {
-		asm volatile ("flushw");
-
-		/* sample the state of the userspace window buffer */
-		THREAD->arch.uspace_window_buffer =
-		    (uint8_t *) asi_u64_read(ASI_SCRATCHPAD, SCRATCHPAD_WBUF);
-
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/proc/thread.c
===================================================================
--- kernel/arch/sparc64/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_proc
- * @{
- */
-/** @file
- */
-
-#include <proc/thread.h>
-#include <arch/proc/thread.h>
-#include <mm/slab.h>
-#include <arch/trap/regwin.h>
-#include <align.h>
-
-slab_cache_t *uwb_cache = NULL;
-
-void thr_constructor_arch(thread_t *t)
-{
-	/*
-	 * Allocate memory for uspace_window_buffer.
-	 */
-	t->arch.uspace_window_buffer = NULL;
-}
-
-void thr_destructor_arch(thread_t *t)
-{
-	if (t->arch.uspace_window_buffer) {
-		uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
-		/*
-		 * Mind the possible alignment of the userspace window buffer
-		 * belonging to a killed thread.
-		 */
-		slab_free(uwb_cache, (uint8_t *) ALIGN_DOWN(uw_buf,
-		    UWB_ALIGNMENT));
-	}
-}
-
-errno_t thread_create_arch(thread_t *t, thread_flags_t flags)
-{
-	if ((flags & THREAD_FLAG_USPACE) && (!t->arch.uspace_window_buffer)) {
-		/*
-		 * The thread needs userspace window buffer and the object
-		 * returned from the slab allocator doesn't have any.
-		 */
-		t->arch.uspace_window_buffer = slab_alloc(uwb_cache, FRAME_ATOMIC);
-		if (!t->arch.uspace_window_buffer)
-			return ENOMEM;
-	} else {
-		uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
-
-		/*
-		 * Mind the possible alignment of the userspace window buffer
-		 * belonging to a killed thread.
-		 */
-		t->arch.uspace_window_buffer = (uint8_t *) ALIGN_DOWN(uw_buf,
-		    UWB_ALIGNMENT);
-	}
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/smc.c
===================================================================
--- kernel/arch/sparc64/src/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <barrier.h>
-#include <arch/barrier.h>
-
-#if defined(US)
-
-#define FLUSH_INVAL_MIN  4
-
-void smc_coherence(void *a, size_t l)
-{
-	asm volatile ("membar #StoreStore\n" ::: "memory");
-
-	for (size_t i = 0; i < l; i += FLUSH_INVAL_MIN) {
-		asm volatile (
-		    "flush %[reg]\n"
-		    :: [reg] "r" (a + i)
-		    : "memory"
-		);
-	}
-}
-
-#elif defined (US3)
-
-void smc_coherence(void *a, size_t l)
-{
-	asm volatile ("membar #StoreStore\n" ::: "memory");
-
-	flush_pipeline();
-}
-
-#endif  /* defined(US3) */
Index: rnel/arch/sparc64/src/smp/sun4u/ipi.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4u/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <smp/ipi.h>
-#include <arch/barrier.h>
-#include <assert.h>
-#include <cpu.h>
-#include <arch.h>
-#include <arch/cpu.h>
-#include <arch/asm.h>
-#include <config.h>
-#include <mm/tlb.h>
-#include <arch/interrupt.h>
-#include <arch/trap/interrupt.h>
-#include <barrier.h>
-#include <preemption.h>
-#include <time/delay.h>
-#include <panic.h>
-
-/** Set the contents of the outgoing interrupt vector data.
- *
- * The first data item (data 0) will be set to the value of func, the
- * rest of the vector will contain zeros.
- *
- * This is a helper function used from within the cross_call function.
- *
- * @param func value the first data item of the vector will be set to
- */
-static inline void set_intr_w_data(void (*func)(void))
-{
-#if defined (US)
-	asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t) func);
-	asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_1, 0);
-	asi_u64_write(ASI_INTR_W, ASI_UDB_INTR_W_DATA_2, 0);
-#elif defined (US3)
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_0, (uintptr_t)	func);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_1, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_2, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_3, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_4, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_5, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_6, 0);
-	asi_u64_write(ASI_INTR_W, VA_INTR_W_DATA_7, 0);
-#endif
-}
-
-/** Invoke function on another processor.
- *
- * Currently, only functions without arguments are supported.
- * Supporting more arguments in the future should be no big deal.
- *
- * Interrupts must be disabled prior to this call.
- *
- * @param mid MID of the target processor.
- * @param func Function to be invoked.
- */
-static void cross_call(int mid, void (*func)(void))
-{
-	uint64_t status;
-	bool done;
-
-	/*
-	 * This function might enable interrupts for a while.
-	 * In order to prevent migration to another processor,
-	 * we explicitly disable preemption.
-	 */
-
-	preemption_disable();
-
-	status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0);
-	if (status & INTR_DISPATCH_STATUS_BUSY)
-		panic("Interrupt Dispatch Status busy bit set\n");
-
-	assert(!(pstate_read() & PSTATE_IE_BIT));
-
-	do {
-		set_intr_w_data(func);
-		asi_u64_write(ASI_INTR_W,
-		    (mid << INTR_VEC_DISPATCH_MID_SHIFT) |
-		    VA_INTR_W_DISPATCH, 0);
-
-		membar();
-
-		do {
-			status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0);
-		} while (status & INTR_DISPATCH_STATUS_BUSY);
-
-		done = !(status & INTR_DISPATCH_STATUS_NACK);
-		if (!done) {
-			/*
-			 * Prevent deadlock.
-			 */
-			(void) interrupts_enable();
-			delay(20 + (tick_read() & 0xff));
-			(void) interrupts_disable();
-		}
-	} while (!done);
-
-	preemption_enable();
-}
-
-/*
- * Deliver IPI to all processors except the current one.
- *
- * The sparc64 architecture does not support any group addressing
- * which is found, for instance, on ia32 and amd64. Therefore we
- * need to simulate the broadcast by sending the message to
- * all target processors step by step.
- *
- * We assume that interrupts are disabled.
- *
- * @param ipi IPI number.
- */
-void ipi_broadcast_arch(int ipi)
-{
-	unsigned int i;
-
-	void (*func)(void);
-
-	switch (ipi) {
-	case IPI_TLB_SHOOTDOWN:
-		func = tlb_shootdown_ipi_recv;
-		break;
-	default:
-		panic("Unknown IPI (%d).\n", ipi);
-		break;
-	}
-
-	/*
-	 * As long as we don't support hot-plugging
-	 * or hot-unplugging of CPUs, we can walk
-	 * the cpus array and read processor's MID
-	 * without locking.
-	 */
-
-	for (i = 0; i < config.cpu_active; i++) {
-		if (&cpus[i] == CPU)
-			continue;		/* skip the current CPU */
-
-		cross_call(cpus[i].arch.mid, func);
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/smp/sun4u/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4u/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <cpu.h>
-#include <arch/cpu_family.h>
-#include <arch/cpu.h>
-#include <arch.h>
-#include <config.h>
-#include <macros.h>
-#include <stdint.h>
-#include <synch/waitq.h>
-#include <log.h>
-#include <arch/cpu_node.h>
-
-/**
- * This global variable is used to pick-up application processors
- * from their active loop in start.S. When a processor looping in
- * start.S sees that this variable contains its MID, it can
- * proceed with its initialization.
- *
- * This variable is modified only by the bootstrap processor.
- * Other processors access it read-only.
- */
-volatile uint64_t waking_up_mid = (uint64_t) -1;
-
-/** Determine number of processors. */
-void smp_init(void)
-{
-	ofw_tree_node_t *node;
-	unsigned int cnt = 0;
-
-	if (is_us() || is_us_iii()) {
-		node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu");
-		while (node) {
-			cnt++;
-			node = ofw_tree_find_peer_by_device_type(node, "cpu");
-		}
-	} else if (is_us_iv()) {
-		node = ofw_tree_find_child(cpus_parent(), "cmp");
-		while (node) {
-			cnt += 2;
-			node = ofw_tree_find_peer_by_name(node, "cmp");
-		}
-	}
-
-	config.cpu_count = max(1, cnt);
-}
-
-/**
- * Wakes up the CPU which is represented by the "node" OFW tree node.
- * If "node" represents the current CPU, calling the function has
- * no effect.
- */
-static void wakeup_cpu(ofw_tree_node_t *node)
-{
-	uint32_t mid;
-	ofw_tree_property_t *prop;
-
-	/* 'upa-portid' for US, 'portid' for US-III, 'cpuid' for US-IV */
-	prop = ofw_tree_getprop(node, "upa-portid");
-	if ((!prop) || (!prop->value))
-		prop = ofw_tree_getprop(node, "portid");
-	if ((!prop) || (!prop->value))
-		prop = ofw_tree_getprop(node, "cpuid");
-
-	if (!prop || prop->value == NULL)
-		return;
-
-	mid = *((uint32_t *) prop->value);
-	if (CPU->arch.mid == mid)
-		return;
-
-	waking_up_mid = mid;
-
-	if (semaphore_down_timeout(&ap_completion_semaphore, 1000000) != EOK)
-		log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32
-		    ") timed out", __func__, mid);
-}
-
-/** Wake application processors up. */
-void kmp(void *arg)
-{
-	ofw_tree_node_t *node;
-	int i;
-
-	if (is_us() || is_us_iii()) {
-		node = ofw_tree_find_child_by_device_type(cpus_parent(), "cpu");
-		for (i = 0; node;
-		    node = ofw_tree_find_peer_by_device_type(node, "cpu"), i++)
-			wakeup_cpu(node);
-	} else if (is_us_iv()) {
-		node = ofw_tree_find_child(cpus_parent(), "cmp");
-		while (node) {
-			wakeup_cpu(ofw_tree_find_child(node, "cpu@0"));
-			wakeup_cpu(ofw_tree_find_child(node, "cpu@1"));
-			node = ofw_tree_find_peer_by_name(node, "cmp");
-		}
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/smp/sun4v/ipi.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <smp/ipi.h>
-#include <cpu.h>
-#include <config.h>
-#include <interrupt.h>
-#include <arch/asm.h>
-#include <arch/cpu.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/sun4v/ipi.h>
-
-#define IPI_MESSAGE_SIZE	8
-
-static uint64_t data[MAX_NUM_STRANDS][IPI_MESSAGE_SIZE]
-    __attribute__((aligned(64)));
-
-static uint16_t ipi_cpu_list[MAX_NUM_STRANDS][MAX_NUM_STRANDS];
-
-/**
- * Sends an inter-processor interrupt to all virtual processors whose IDs are
- * listed in the list.
- *
- * @param func		address of the function to be invoked on the recipient
- * @param cpu_list	list of CPU IDs (16-bit identifiers) of the recipients
- * @param list_size	number of recipients (number of valid cpu_list entries)
- *
- * @return		error code returned by the CPU_MONDO_SEND hypercall
- */
-uint64_t ipi_brodcast_to(void (*func)(void), uint16_t cpu_list[MAX_NUM_STRANDS],
-    uint64_t list_size)
-{
-
-	data[CPU->arch.id][0] = (uint64_t) func;
-
-	unsigned int i;
-	for (i = 0; i < list_size; i++) {
-		ipi_cpu_list[CPU->arch.id][i] = cpu_list[i];
-	}
-
-	return __hypercall_fast3(CPU_MONDO_SEND, list_size,
-	    KA2PA(ipi_cpu_list[CPU->arch.id]), KA2PA(data[CPU->arch.id]));
-}
-
-/**
- * Send an inter-processor interrupt to a particular CPU.
- *
- * @param func		address of the function to be invoked on the recipient
- * @param cpu_is	CPU ID (16-bit identifier) of the recipient
- *
- * @return		error code returned by the CPU_MONDO_SEND hypercall
- */
-uint64_t ipi_unicast_to(void (*func)(void), uint16_t cpu_id)
-{
-	ipi_cpu_list[CPU->arch.id][0] = cpu_id;
-	return ipi_brodcast_to(func, ipi_cpu_list[CPU->arch.id], 1);
-}
-
-/*
- * Deliver IPI to all processors except the current one.
- *
- * We assume that interrupts are disabled.
- *
- * @param ipi IPI number.
- */
-void ipi_broadcast_arch(int ipi)
-{
-	void (*func)(void);
-
-	switch (ipi) {
-	case IPI_TLB_SHOOTDOWN:
-		func = tlb_shootdown_ipi_recv;
-		break;
-	default:
-		panic("Unknown IPI (%d).\n", ipi);
-		break;
-	}
-
-	unsigned int i;
-	unsigned idx = 0;
-	for (i = 0; i < config.cpu_active; i++) {
-		if (&cpus[i] == CPU) {
-			continue;
-		}
-
-		ipi_cpu_list[CPU->id][idx] = (uint16_t) cpus[i].id;
-		idx++;
-	}
-
-	ipi_brodcast_to(func, ipi_cpu_list[CPU->arch.id], idx);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/smp/sun4v/smp.c
===================================================================
--- kernel/arch/sparc64/src/smp/sun4v/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,395 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <smp/smp.h>
-#include <smp/ipi.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <cpu.h>
-#include <arch/cpu.h>
-#include <arch/boot/boot.h>
-#include <arch.h>
-#include <config.h>
-#include <macros.h>
-#include <halt.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <synch/waitq.h>
-#include <stdio.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/sun4v/md.h>
-#include <arch/sun4v/ipi.h>
-#include <time/delay.h>
-#include <arch/smp/sun4v/smp.h>
-#include <str.h>
-#include <errno.h>
-
-/** hypervisor code of the "running" state of the CPU */
-#define CPU_STATE_RUNNING	2
-
-/** maximum possible number of processor cores */
-#define MAX_NUM_CORES		8
-
-/** needed in the CPU_START hypercall */
-extern void kernel_image_start(void);
-
-/** needed in the CPU_START hypercall */
-extern void *trap_table;
-
-/** number of execution units detected */
-uint8_t exec_unit_count = 0;
-
-/** execution units (processor cores) */
-exec_unit_t exec_units[MAX_NUM_CORES];
-
-/** CPU structures */
-extern cpu_t *cpus;
-
-/** maximum number of strands per a physical core detected */
-unsigned int max_core_strands = 0;
-
-#if 0
-/**
- * Proposes the optimal number of ready threads for each virtual processor
- * in the given processor core so that the processor core is as busy as the
- * average processor core. The proposed number of ready threads will be
- * stored to the proposed_nrdy variable of the cpu_arch_t struture.
- */
-bool calculate_optimal_nrdy(exec_unit_t *exec_unit)
-{
-
-	/* calculate the number of threads the core will steal */
-	int avg = atomic_load(&nrdy) / exec_unit_count;
-	int to_steal = avg - atomic_load(&(exec_units->nrdy));
-	if (to_steal < 0) {
-		return true;
-	} else if (to_steal == 0) {
-		return false;
-	}
-
-	/* initialize the proposals with the real numbers of ready threads */
-	unsigned int k;
-	for (k = 0; k < exec_unit->strand_count; k++) {
-		exec_units->cpus[k]->arch.proposed_nrdy =
-		    atomic_load(&(exec_unit->cpus[k]->nrdy));
-	}
-
-	/* distribute the threads to be stolen to the core's CPUs */
-	int j;
-	for (j = to_steal; j > 0; j--) {
-		unsigned int k;
-		unsigned int least_busy = 0;
-		unsigned int least_busy_nrdy =
-		    exec_unit->cpus[0]->arch.proposed_nrdy;
-
-		/* for each stolen thread, give it to the least busy CPU */
-		for (k = 0; k < exec_unit->strand_count; k++) {
-			if (exec_unit->cpus[k]->arch.proposed_nrdy < least_busy_nrdy) {
-				least_busy = k;
-				least_busy_nrdy =
-				    exec_unit->cpus[k]->arch.proposed_nrdy;
-			}
-		}
-		exec_unit->cpus[least_busy]->arch.proposed_nrdy++;
-	}
-
-	return false;
-}
-#endif
-
-/**
- * Finds out which execution units belong to particular CPUs. By execution unit
- * we mean the physical core the logical processor is backed by. Since each
- * Niagara physical core has just one integer execution unit and we will
- * ignore other execution units than the integer ones, we will use the terms
- * "integer execution unit", "execution unit" and "physical core"
- * interchangeably.
- *
- * The physical cores are detected by browsing the children of the CPU node
- * in the machine description and looking for a node representing an integer
- * execution unit. Once the integer execution unit of a particular CPU is
- * known, the ID of the CPU is added to the list of cpuids of the corresponding
- * execution unit structure (exec_unit_t). If an execution unit is encountered
- * for the first time, a new execution unit structure (exec_unit_t) must be
- * created first and added to the execution units array (exec_units).
- *
- * If the function fails to find an execution unit for a CPU (this may happen
- * on machines with older firmware or on Simics), it performs a fallback code
- * which pretends there exists just one execution unit and all CPUs belong to
- * it.
- *
- * Finally, the array of all execution units is reordered such that its element
- * which represents the physical core of the the bootstrap CPU is at index 0.
- * Moreover, the array of CPU IDs within the BSP's physical core structure is
- * reordered such that the element which represents the ID of the BSP is at
- * index 0. This is done because we would like the CPUs to be woken up
- * such that the 0-index CPU of the 0-index execution unit is
- * woken up first. And since the BSP is already woken up, we would like it to be
- * at 0-th position of the 0-th execution unit structure.
- *
- * Apart from that, the code also counts the total number of CPUs and stores
- * it to the global config.cpu_count variable.
- */
-static void detect_execution_units(void)
-{
-	/* ID of the bootstrap processor */
-	uint64_t myid;
-
-	/* total number of CPUs detected */
-	size_t cpu_count = 0;
-
-	/* will be set to 1 if detecting the physical cores fails */
-	bool exec_unit_assign_error = 0;
-
-	/* index of the bootstrap physical core in the array of cores */
-	unsigned int bsp_exec_unit_index = 0;
-
-	/* index of the BSP ID inside the array of bootstrap core's cpuids */
-	unsigned int bsp_core_strand_index = 0;
-
-	__hypercall_fast_ret1(0, 0, 0, 0, 0, CPU_MYID, &myid);
-	md_node_t node = md_get_root();
-
-	/* walk through all the CPU nodes in the MD */
-	while (md_next_node(&node, "cpu")) {
-
-		uint64_t cpuid;
-		md_get_integer_property(node, "id", &cpuid);
-		cpu_count++;
-
-		/*
-		 * if failed in previous CPUs, don't try
-		 * to detect physical cores any more
-		 */
-		if (exec_unit_assign_error)
-			continue;
-
-		/* detect exec. unit for the CPU represented by current node */
-		uint64_t exec_unit_id = 0;
-		md_child_iter_t it = md_get_child_iterator(node);
-
-		while (md_next_child(&it)) {
-			md_node_t child = md_get_child_node(it);
-			const char *exec_unit_type = "";
-			md_get_string_property(child, "type", &exec_unit_type);
-
-			/* each physical core has just 1 integer exec. unit */
-			if (str_cmp(exec_unit_type, "integer") == 0) {
-				exec_unit_id = child;
-				break;
-			}
-		}
-
-		/* execution unit detected successfully */
-		if (exec_unit_id != 0) {
-
-			/* find the exec. unit in array of existing units */
-			unsigned int i = 0;
-			for (i = 0; i < exec_unit_count; i++) {
-				if (exec_units[i].exec_unit_id == exec_unit_id)
-					break;
-			}
-
-			/*
-			 * execution unit just met has not been met before, so
-			 * create a new entry in array of all execution units
-			 */
-			if (i == exec_unit_count) {
-				exec_units[i].exec_unit_id = exec_unit_id;
-				exec_units[i].strand_count = 0;
-				atomic_store(&(exec_units[i].nrdy), 0);
-				spinlock_initialize(&(exec_units[i].proposed_nrdy_lock), "exec_units[].proposed_nrdy_lock");
-				exec_unit_count++;
-			}
-
-			/*
-			 * remember the exec. unit and strand of the BSP
-			 */
-			if (cpuid == myid) {
-				bsp_exec_unit_index = i;
-				bsp_core_strand_index = exec_units[i].strand_count;
-			}
-
-			/* add the CPU just met to the exec. unit's list */
-			exec_units[i].cpuids[exec_units[i].strand_count] = cpuid;
-			exec_units[i].strand_count++;
-			max_core_strands =
-			    exec_units[i].strand_count > max_core_strands ?
-			    exec_units[i].strand_count : max_core_strands;
-
-			/* detecting execution unit failed */
-		} else {
-			exec_unit_assign_error = 1;
-		}
-	}
-
-	/* save the number of CPUs to a globally accessible variable */
-	config.cpu_count = cpu_count;
-
-	/*
-	 * A fallback code which will be executed if finding out which
-	 * execution units belong to particular CPUs fails. Pretend there
-	 * exists just one execution unit and all CPUs belong to it.
-	 */
-	if (exec_unit_assign_error) {
-		bsp_exec_unit_index = 0;
-		exec_unit_count = 1;
-		exec_units[0].strand_count = cpu_count;
-		exec_units[0].exec_unit_id = 1;
-		spinlock_initialize(&(exec_units[0].proposed_nrdy_lock), "exec_units[0].proposed_nrdy_lock");
-		atomic_store(&(exec_units[0].nrdy), 0);
-		max_core_strands = cpu_count;
-
-		/* browse CPUs again, assign them the fictional exec. unit */
-		node = md_get_root();
-		unsigned int i = 0;
-
-		while (md_next_node(&node, "cpu")) {
-			uint64_t cpuid;
-			md_get_integer_property(node, "id", &cpuid);
-			if (cpuid == myid) {
-				bsp_core_strand_index = i;
-			}
-			exec_units[0].cpuids[i++] = cpuid;
-		}
-	}
-
-	/*
-	 * Reorder the execution units array elements and the cpuid array
-	 * elements so that the BSP will always be the very first CPU of
-	 * the very first execution unit.
-	 */
-	exec_unit_t temp_exec_unit = exec_units[0];
-	exec_units[0] = exec_units[bsp_exec_unit_index];
-	exec_units[bsp_exec_unit_index] = temp_exec_unit;
-
-	uint64_t temp_cpuid = exec_units[0].cpuids[0];
-	exec_units[0].cpuids[0] = exec_units[0].cpuids[bsp_exec_unit_index];
-	exec_units[0].cpuids[bsp_core_strand_index] = temp_cpuid;
-
-}
-
-/**
- * Determine number of processors and detect physical cores. On Simics
- * copy the code which will be executed by the AP when the BSP sends an
- * IPI to it in order to make it execute HelenOS code.
- */
-void smp_init(void)
-{
-	detect_execution_units();
-}
-
-/**
- * For each CPU sets the value of cpus[i].arch.id, where i is the
- * index of the CPU in the cpus variable, to the cpuid of the i-th processor
- * to be run. The CPUs are run such that the CPU represented by cpus[0]
- * is run first, cpus[1] is run after it, and cpus[cpu_count - 1] is run as the
- * last one.
- *
- * The CPU IDs are set such that during waking the CPUs up the
- * processor cores will be alternated, i.e. first one CPU from the first core
- * will be run, after that one CPU from the second CPU core will be run,...
- * then one CPU from the last core will be run, after that another CPU
- * from the first core will be run, then another CPU from the second core
- * will be run,... then another CPU from the last core will be run, and so on.
- */
-static void init_cpuids(void)
-{
-	unsigned int cur_core_strand;
-	unsigned int cur_core;
-	unsigned int cur_cpu = 0;
-
-	for (cur_core_strand = 0; cur_core_strand < max_core_strands; cur_core_strand++) {
-		for (cur_core = 0; cur_core < exec_unit_count; cur_core++) {
-			if (cur_core_strand > exec_units[cur_core].strand_count)
-				continue;
-
-			cpus[cur_cpu].arch.exec_unit = &(exec_units[cur_core]);
-			atomic_add(&(exec_units[cur_core].nrdy), atomic_load(&(cpus[cur_cpu].nrdy)));
-			cpus[cur_cpu].arch.id = exec_units[cur_core].cpuids[cur_core_strand];
-			exec_units[cur_core].cpus[cur_core_strand] = &(cpus[cur_cpu]);
-			cur_cpu++;
-		}
-	}
-}
-
-/**
- * Wakes up a single CPU.
- *
- * @param cpuid	ID of the CPU to be woken up
- */
-static bool wake_cpu(uint64_t cpuid)
-{
-#ifdef CONFIG_SIMICS_SMP_HACK
-	ipi_unicast_to((void (*)(void)) 1234, cpuid);
-#else
-	/* stop the CPU before making it execute our code */
-	if (__hypercall_fast1(CPU_STOP, cpuid) != EOK)
-		return false;
-
-	/* wait for the CPU to stop */
-	uint64_t state;
-	__hypercall_fast_ret1(cpuid, 0, 0, 0, 0, CPU_STATE, &state);
-	while (state == CPU_STATE_RUNNING)
-		__hypercall_fast_ret1(cpuid, 0, 0, 0, 0, CPU_STATE, &state);
-
-	/* make the CPU run again and execute HelenOS code */
-	if (__hypercall_fast4(CPU_START, cpuid,
-	    (uint64_t) KA2PA(kernel_image_start), KA2PA(trap_table),
-	    physmem_base) != EOK)
-		return false;
-#endif
-
-	if (semaphore_down_timeout(&ap_completion_semaphore, 10000000) != EOK)
-		printf("%s: waiting for processor (cpuid = %" PRIu64 ") timed out\n",
-		    __func__, cpuid);
-
-	return true;
-}
-
-/** Wake application processors up. */
-void kmp(void *arg)
-{
-	init_cpuids();
-
-	unsigned int i;
-
-	for (i = 1; i < config.cpu_count; i++) {
-		wake_cpu(cpus[i].arch.id);
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sparc64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <mm/slab.h>
-#include <sysinfo/sysinfo.h>
-#include <config.h>
-#include <arch/proc/thread.h>
-#include <arch/trap/regwin.h>
-#include <debug.h>
-
-#define SPARC64_ARCH_OP(op)	ARCH_STRUCT_OP(sparc64_ops, op)
-
-static void sparc64_pre_mm_init(void);
-static void sparc64_post_mm_init(void);
-static void sparc64_post_cpu_init(void);
-static void sparc64_pre_smp_init(void);
-static void sparc64_post_smp_init(void);
-
-arch_ops_t sparc64_arch_ops = {
-	.pre_mm_init = sparc64_pre_mm_init,
-	.post_mm_init = sparc64_post_mm_init,
-	.post_cpu_init = sparc64_post_cpu_init,
-	.pre_smp_init = sparc64_pre_smp_init,
-	.post_smp_init = sparc64_post_smp_init,
-};
-
-arch_ops_t *arch_ops = &sparc64_arch_ops;
-
-void sparc64_pre_mm_init(void)
-{
-	SPARC64_ARCH_OP(pre_mm_init);
-}
-
-void sparc64_post_mm_init(void)
-{
-	SPARC64_ARCH_OP(post_mm_init);
-
-	if (config.cpu_active == 1) {
-		static_assert(UWB_SIZE <= UWB_ALIGNMENT, "");
-		/* Create slab cache for the userspace window buffers */
-		uwb_cache = slab_cache_create("uwb_cache", UWB_SIZE,
-		    UWB_ALIGNMENT, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-
-		/* Copy boot arguments */
-		ofw_tree_node_t *options = ofw_tree_lookup("/options");
-		if (options) {
-			ofw_tree_property_t *prop;
-
-			prop = ofw_tree_getprop(options, "boot-args");
-			if (prop && prop->value) {
-				str_ncpy(bargs, CONFIG_BOOT_ARGUMENTS_BUFLEN,
-				    prop->value, prop->size);
-			}
-		}
-	}
-}
-
-void sparc64_post_cpu_init(void)
-{
-	SPARC64_ARCH_OP(post_cpu_init);
-}
-
-void sparc64_pre_smp_init(void)
-{
-	SPARC64_ARCH_OP(pre_smp_init);
-}
-
-void sparc64_post_smp_init(void)
-{
-	SPARC64_ARCH_OP(post_smp_init);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/sun4u/asm.S
===================================================================
--- kernel/arch/sparc64/src/sun4u/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/stack.h>
-#include <arch/regdef.h>
-#include <arch/mm/mmu.h>
-
-.text
-
-.register       %g2, #scratch
-.register       %g3, #scratch
-
-.macro WRITE_ALTERNATE_REGISTER reg, bit
-	rdpr %pstate, %g1				! save PSTATE.PEF
-	wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate
-	mov %o0, \reg
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate
-	retl
-	wrpr %g1, 0, %pstate				! restore PSTATE.PEF
-.endm
-
-.macro READ_ALTERNATE_REGISTER reg, bit
-	rdpr %pstate, %g1				! save PSTATE.PEF
-	wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate
-	mov \reg, %o0
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate
-	retl
-	wrpr %g1, 0, %pstate				! restore PSTATE.PEF
-.endm
-
-FUNCTION_BEGIN(write_to_ag_g6)
-	WRITE_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT
-FUNCTION_END(write_to_ag_g6)
-
-FUNCTION_BEGIN(write_to_ag_g7)
-	WRITE_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT
-FUNCTION_END(write_to_ag_g7)
-
-FUNCTION_BEGIN(write_to_ig_g6)
-	WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT
-FUNCTION_END(write_to_ig_g6)
-
-FUNCTION_BEGIN(read_from_ag_g6)
-	READ_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT
-FUNCTION_END(read_from_ag_g6)
-
-FUNCTION_BEGIN(read_from_ag_g7)
-	READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT
-FUNCTION_END(read_from_ag_g7)
-
-/** Switch to userspace.
- *
- * %o0	Userspace entry address.
- * %o1	Userspace stack pointer address.
- * %o2  Userspace address of uarg structure.
- */
-FUNCTION_BEGIN(switch_to_userspace)
-	save %o1, 0, %sp
-	flushw
-	wrpr %g0, 0, %cleanwin		! avoid information leak
-
-	mov %i2, %o0			! uarg
-	xor %o1, %o1, %o1		! %o1 is defined to hold pcb_ptr
-					! set it to 0
-
-	clr %i2
-	clr %i3
-	clr %i4
-	clr %i5
-	clr %i6
-
-	wrpr %g0, 1, %tl		! enforce mapping via nucleus
-
-	rdpr %cwp, %g1
-	wrpr %g1, TSTATE_IE_BIT, %tstate
-	wrpr %i0, 0, %tnpc
-
-	/*
-	 * Set primary context according to secondary context.
-	 * Secondary context has been already installed by
-	 * higher-level functions.
-	 */
-	wr %g0, ASI_DMMU, %asi
-	ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
-	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
-	flush %i7
-
-	/*
-	 * Spills and fills will be handled by the userspace handlers.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
-
-	done				! jump to userspace
-FUNCTION_END(switch_to_userspace)
-
Index: rnel/arch/sparc64/src/sun4u/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sun4u/sparc64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,204 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <debug.h>
-#include <config.h>
-#include <macros.h>
-#include <arch/trap/trap.h>
-#include <arch/console.h>
-#include <console/console.h>
-#include <arch/boot/boot.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/mm/page.h>
-#include <arch/stack.h>
-#include <interrupt.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <userspace.h>
-#include <ddi/irq.h>
-#include <stdbool.h>
-#include <str.h>
-#include <sysinfo/sysinfo.h>
-
-static void sun4u_pre_mm_init(void);
-static void sun4u_post_mm_init(void);
-static void sun4u_post_smp_init(void);
-
-arch_ops_t sun4u_ops = {
-	.pre_mm_init = sun4u_pre_mm_init,
-	.post_mm_init = sun4u_post_mm_init,
-	.post_smp_init = sun4u_post_smp_init,
-};
-
-arch_ops_t *sparc64_ops = &sun4u_ops;
-
-memmap_t memmap;
-
-/** Perform sparc64-specific initialization before main_bsp() is called. */
-void sparc64_pre_main(bootinfo_t *bootinfo)
-{
-	/* Copy init task info. */
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
-
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Copy physical memory map. */
-	memmap.total = bootinfo->memmap.total;
-	memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
-	for (i = 0; i < memmap.cnt; i++) {
-		memmap.zones[i].start = bootinfo->memmap.zones[i].start;
-		memmap.zones[i].size = bootinfo->memmap.zones[i].size;
-	}
-
-	/* Copy boot allocations info. */
-	ballocs.base = bootinfo->ballocs.base;
-	ballocs.size = bootinfo->ballocs.size;
-
-	ofw_tree_init(bootinfo->ofw_root);
-}
-
-/** Perform sparc64 specific initialization before mm is initialized. */
-void sun4u_pre_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		trap_init();
-		exc_arch_init();
-	}
-}
-
-/** Perform sparc64 specific initialization afterr mm is initialized. */
-void sun4u_post_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		/* Map OFW information into sysinfo */
-		ofw_sysinfo_map();
-
-		/*
-		 * We have 2^11 different interrupt vectors.
-		 * But we only create 128 buckets.
-		 */
-		irq_init(1 << 11, 128);
-	}
-}
-
-void sun4u_post_smp_init(void)
-{
-	/* Currently the only supported platform for sparc64/sun4u is 'sun4u'. */
-	static const char *platform = "sun4u";
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-	standalone_sparc64_console_init();
-}
-
-/** Calibrate delay loop.
- *
- * On sparc64, we implement delay() by waiting for the TICK register to
- * reach a pre-computed value, as opposed to performing some pre-computed
- * amount of instructions of known duration. We set the delay_loop_const
- * to 1 in order to neutralize the multiplication done by delay().
- */
-void calibrate_delay_loop(void)
-{
-	CPU->delay_loop_const = 1;
-}
-
-/** Wait several microseconds.
- *
- * We assume that interrupts are already disabled.
- *
- * @param t Microseconds to wait.
- */
-void asm_delay_loop(const uint32_t usec)
-{
-	uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
-	    CPU->arch.clock_frequency / 1000000;
-
-	while (tick_read() < stop)
-		;
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return ALIGN_DOWN(stack_base + stack_size - STACK_WINDOW_SAVE_AREA_SIZE - STACK_ARG_SAVE_AREA_SIZE, 16) - STACK_BIAS;
-}
-
-/** Switch to userspace. */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	(void) interrupts_disable();
-	switch_to_userspace(pc, sp, 0);
-
-	/* Not reached */
-	while (true)
-		;
-}
-
-void arch_reboot(void)
-{
-	// TODO
-	while (true)
-		;
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/sun4u/start.S
===================================================================
--- kernel/arch/sparc64/src/sun4u/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,439 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-#include <arch/arch.h>
-#include <arch/cpu.h>
-#include <arch/regdef.h>
-#include <arch/boot/boot.h>
-#include <arch/stack.h>
-
-#include <arch/mm/mmu.h>
-#include <arch/mm/tlb.h>
-#include <arch/mm/tte.h>
-#include <arch/mm/cache_spec.h>
-
-#ifdef CONFIG_SMP
-#include <arch/context_struct.h>
-#endif
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.section K_TEXT_START, "ax"
-
-#define BSP_FLAG	1
-
-/*
- * 2^PHYSMEM_ADDR_SIZE is the size of the physical address space on
- * a given processor.
- */
-#if defined (US)
-    #define PHYSMEM_ADDR_SIZE	41
-#elif defined (US3)
-    #define PHYSMEM_ADDR_SIZE	43
-#endif
-
-/*
- * Here is where the kernel is passed control from the boot loader.
- *
- * The registers are expected to be in this state:
- *  - %o0 starting address of physical memory
- *        + bootstrap processor flag
- *          bits 63...1: physical memory starting address / 2
- *          bit 0:       non-zero on BSP processor, zero on AP processors
- *  - %o1 bootinfo structure address (BSP only)
- *
- *
- * Moreover, we depend on boot having established the following environment:
- *  - TLBs are on
- *  - identity mapping for the kernel image
- *
- */
-
-SYMBOL(kernel_image_start)
-	mov BSP_FLAG, %l0
-	and %o0, %l0, %l7			! l7 <= bootstrap processor?
-	andn %o0, %l0, %l6			! l6 <= start of physical memory
-
-	! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
-	srlx %l6, 13, %l5
-
-	! l5 <= physmem_base[(PHYSMEM_ADDR_SIZE - 1):13]
-	sllx %l5, 13 + (63 - (PHYSMEM_ADDR_SIZE - 1)), %l5
-	srlx %l5, 63 - (PHYSMEM_ADDR_SIZE - 1), %l5
-
-	/*
-	 * Setup basic runtime environment.
-	 */
-
-	wrpr %g0, NWINDOWS - 2, %cansave	! set maximum saveable windows
-	wrpr %g0, 0, %canrestore		! get rid of windows we will
-						! never need again
-	wrpr %g0, 0, %otherwin			! make sure the window state is
-						! consistent
-	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent needless clean_window
-						! traps for kernel
-
-	wrpr %g0, 0, %wstate			! use default spill/fill trap
-
-	wrpr %g0, 0, %tl			! TL = 0, primary context
-						! register is used
-
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! disable interrupts and disable
-						! 32-bit address masking
-
-	wrpr %g0, 0, %pil			! intialize %pil
-
-	/*
-	 * Switch to kernel trap table.
-	 */
-	sethi %hi(trap_table), %g1
-	wrpr %g1, %lo(trap_table), %tba
-
-	/*
-	 * Take over the DMMU by installing locked TTE entry identically
-	 * mapping the first 4M of memory.
-	 *
-	 * In case of DMMU, no FLUSH instructions need to be issued. Because of
-	 * that, the old DTLB contents can be demapped pretty straightforwardly
-	 * and without causing any traps.
-	 */
-
-	wr %g0, ASI_DMMU, %asi
-
-#define SET_TLB_DEMAP_CMD(r1, context_id) \
-	set (TLB_DEMAP_CONTEXT << TLB_DEMAP_TYPE_SHIFT) | (context_id << \
-		TLB_DEMAP_CONTEXT_SHIFT), %r1
-
-	! demap context 0
-	SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_NUCLEUS)
-	stxa %g0, [%g1] ASI_DMMU_DEMAP
-	membar #Sync
-
-#define SET_TLB_TAG(r1, context) \
-	set VMA | (context << TLB_TAG_ACCESS_CONTEXT_SHIFT), %r1
-
-	! write DTLB tag
-	SET_TLB_TAG(g1, MEM_CONTEXT_KERNEL)
-	stxa %g1, [VA_DMMU_TAG_ACCESS] %asi
-	membar #Sync
-
-#ifdef CONFIG_VIRT_IDX_DCACHE
-#define TTE_LOW_DATA(imm) 	(TTE_CP | TTE_CV | TTE_P | LMA | (imm))
-#else /* CONFIG_VIRT_IDX_DCACHE */
-#define TTE_LOW_DATA(imm) 	(TTE_CP | TTE_P | LMA | (imm))
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-
-#define SET_TLB_DATA(r1, r2, imm) \
-	set TTE_LOW_DATA(imm), %r1; \
-	or %r1, %l5, %r1; \
-	mov PAGESIZE_4M, %r2; \
-	sllx %r2, TTE_SIZE_SHIFT, %r2; \
-	or %r1, %r2, %r1; \
-	mov 1, %r2; \
-	sllx %r2, TTE_V_SHIFT, %r2; \
-	or %r1, %r2, %r1;
-
-	! write DTLB data and install the kernel mapping
-	SET_TLB_DATA(g1, g2, TTE_L | TTE_W)	! use non-global mapping
-	stxa %g1, [%g0] ASI_DTLB_DATA_IN_REG
-	membar #Sync
-
-	/*
-	 * Because we cannot use global mappings (because we want to have
-	 * separate 64-bit address spaces for both the kernel and the
-	 * userspace), we prepare the identity mapping also in context 1. This
-	 * step is required by the code installing the ITLB mapping.
-	 */
-	! write DTLB tag of context 1 (i.e. MEM_CONTEXT_TEMP)
-	SET_TLB_TAG(g1, MEM_CONTEXT_TEMP)
-	stxa %g1, [VA_DMMU_TAG_ACCESS] %asi
-	membar #Sync
-
-	! write DTLB data and install the kernel mapping in context 1
-	SET_TLB_DATA(g1, g2, TTE_W)			! use non-global mapping
-	stxa %g1, [%g0] ASI_DTLB_DATA_IN_REG
-	membar #Sync
-
-	/*
-	 * Now is time to take over the IMMU. Unfortunatelly, it cannot be done
-	 * as easily as the DMMU, because the IMMU is mapping the code it
-	 * executes.
-	 *
-	 * [ Note that brave experiments with disabling the IMMU and using the
-	 * DMMU approach failed after a dozen of desparate days with only little
-	 * success. ]
-	 *
-	 * The approach used here is inspired from OpenBSD. First, the kernel
-	 * creates IMMU mapping for itself in context 1 (MEM_CONTEXT_TEMP) and
-	 * switches to it. Context 0 (MEM_CONTEXT_KERNEL) can be demapped
-	 * afterwards and replaced with the kernel permanent mapping. Finally,
-	 * the kernel switches back to context 0 and demaps context 1.
-	 *
-	 * Moreover, the IMMU requires use of the FLUSH instructions. But that
-	 * is OK because we always use operands with addresses already mapped by
-	 * the taken over DTLB.
-	 */
-
-	set kernel_image_start, %g5
-
-	! write ITLB tag of context 1
-	SET_TLB_TAG(g1, MEM_CONTEXT_TEMP)
-	mov VA_DMMU_TAG_ACCESS, %g2
-	stxa %g1, [%g2] ASI_IMMU
-	flush %g5
-
-	! write ITLB data and install the temporary mapping in context 1
-	SET_TLB_DATA(g1, g2, 0)			! use non-global mapping
-	stxa %g1, [%g0] ASI_ITLB_DATA_IN_REG
-	flush %g5
-
-	! switch to context 1
-	mov MEM_CONTEXT_TEMP, %g1
-	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi	! ASI_DMMU is correct here !!!
-	flush %g5
-
-	! demap context 0
-	SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_NUCLEUS)
-	stxa %g0, [%g1] ASI_IMMU_DEMAP
-	flush %g5
-
-	! write ITLB tag of context 0
-	SET_TLB_TAG(g1, MEM_CONTEXT_KERNEL)
-	mov VA_DMMU_TAG_ACCESS, %g2
-	stxa %g1, [%g2] ASI_IMMU
-	flush %g5
-
-	! write ITLB data and install the permanent kernel mapping in context 0
-	SET_TLB_DATA(g1, g2, TTE_L)		! use non-global mapping
-	stxa %g1, [%g0] ASI_ITLB_DATA_IN_REG
-	flush %g5
-
-	! enter nucleus - using context 0
-	wrpr %g0, 1, %tl
-
-	! demap context 1
-	SET_TLB_DEMAP_CMD(g1, TLB_DEMAP_PRIMARY)
-	stxa %g0, [%g1] ASI_IMMU_DEMAP
-	flush %g5
-
-	! set context 0 in the primary context register
-	stxa %g0, [VA_PRIMARY_CONTEXT_REG] %asi	! ASI_DMMU is correct here !!!
-	flush %g5
-
-	! leave nucleus - using primary context, i.e. context 0
-	wrpr %g0, 0, %tl
-
-	brz %l7, 1f				! skip if you are not the bootstrap CPU
-	nop
-
-	/*
-	 * Save physmem_base for use by the mm subsystem.
-	 * %l6 contains starting physical address
-	 */
-	sethi %hi(physmem_base), %l4
-	stx %l6, [%l4 + %lo(physmem_base)]
-
-	/*
-	 * Precompute kernel 8K TLB data template.
-	 * %l5 contains starting physical address
-	 * bits [(PHYSMEM_ADDR_SIZE - 1):13]
-	 */
-	sethi %hi(kernel_8k_tlb_data_template), %l4
-	ldx [%l4 + %lo(kernel_8k_tlb_data_template)], %l3
-	or %l3, %l5, %l3
-	stx %l3, [%l4 + %lo(kernel_8k_tlb_data_template)]
-
-	! flush the whole D-cache
-	set (DCACHE_SIZE - DCACHE_LINE_SIZE), %g1
-	stxa %g0, [%g1] ASI_DCACHE_TAG
-
-0:
-	membar #Sync
-	subcc %g1, DCACHE_LINE_SIZE, %g1
-	bnz,pt %xcc, 0b
-	stxa %g0, [%g1] ASI_DCACHE_TAG
-	membar #Sync
-
-	/*
-	 * So far, we have not touched the stack.
-	 * It is a good idea to set the kernel stack to a known state now.
-	 */
-	sethi %hi(temporary_boot_stack), %sp
-	or %sp, %lo(temporary_boot_stack), %sp
-	sub %sp, STACK_BIAS, %sp
-
-	/*
-	 * Call sparc64_pre_main(bootinfo)
-	 */
-	call sparc64_pre_main
-	mov %o1, %o0
-
-	/*
-	 * Create the first stack frame.
-	 */
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
-	flushw
-	add %g0, -STACK_BIAS, %fp
-
-	call main_bsp
-	nop
-
-	/* Not reached. */
-
-0:
-	ba,a %xcc, 0b
-
-
-1:
-#ifdef CONFIG_SMP
-	/*
-	 * Determine the width of the MID and save its mask to %g3. The width
-	 * is
-	 * 	* 5 for US and US-IIIi,
-	 * 	* 10 for US3 except US-IIIi.
-	 */
-#if defined(US)
-	mov 0x1f, %g3
-#elif defined(US3)
-	mov 0x3ff, %g3
-	rdpr %ver, %g2
-	sllx %g2, 16, %g2
-	srlx %g2, 48, %g2
-	cmp %g2, IMPL_ULTRASPARCIII_I
-	move %xcc, 0x1f, %g3
-#endif
-
-	/*
-	 * Read MID from the processor.
-	 */
-	ldxa [%g0] ASI_ICBUS_CONFIG, %g1
-	srlx %g1, ICBUS_CONFIG_MID_SHIFT, %g1
-	and %g1, %g3, %g1
-
-	/*
-	 * Active loop for APs until the BSP picks them up. A processor cannot
-	 * leave the loop until the global variable 'waking_up_mid' equals its
-	 * MID.
-	 */
-	set waking_up_mid, %g2
-2:
-	ldx [%g2], %g3
-	cmp %g3, %g1
-	bne %xcc, 2b
-	nop
-
-	/*
-	 * Configure stack for the AP.
-	 * The AP is expected to use the stack saved
-	 * in the ctx global variable.
-	 */
-	set bootstrap_stack_top, %g1
-	ldx [%g1], %o6
-
-	/*
-	 * Create the first stack frame.
-	 */
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
-	flushw
-	add %g0, -STACK_BIAS, %fp
-
-	call main_ap
-	nop
-
-	/* Not reached. */
-#endif
-
-0:
-	ba,a %xcc, 0b
-
-
-.section K_DATA_START, "aw", @progbits
-
-/*
- * Create small stack to be used by the bootstrap processor. It is going to be
- * used only for a very limited period of time, but we switch to it anyway,
- * just to be sure we are properly initialized.
- */
-
-#define INITIAL_STACK_SIZE	1024
-
-.align STACK_ALIGNMENT
-	.space INITIAL_STACK_SIZE
-.align STACK_ALIGNMENT
-temporary_boot_stack:
-	.space STACK_WINDOW_SAVE_AREA_SIZE
-
-
-.data
-
-.align 8
-SYMBOL(physmem_base)	! copy of the physical memory base address
-	.quad 0
-
-/*
- * The fast_data_access_mmu_miss_data_hi label, the end_of_identity,
- * kernel_8k_tlb_data_template and tlb_tag_access_context_mask variables
- * are meant to stay together, aligned on a 32B boundary.
- */
-
-.align 32
-/*
- * This label is used by the fast_data_access_MMU_miss trap handler.
- */
-SYMBOL(fast_data_access_mmu_miss_data_hi)
-/*
- * This variable is used by the fast_data_access_MMU_miss trap handler.
- * In runtime, it is modified to contain the address of the end of physical
- * memory.
- */
-SYMBOL(end_of_identity)
-	.quad -1
-/*
- * This variable is used by the fast_data_access_MMU_miss trap handler.
- * In runtime, it is further modified to reflect the starting address of
- * physical memory.
- */
-SYMBOL(kernel_8k_tlb_data_template)
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	.quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \
-		 TTE_CV | TTE_P | TTE_W)
-#else /* CONFIG_VIRT_IDX_DCACHE */
-	.quad ((1 << TTE_V_SHIFT) | (PAGESIZE_8K << TTE_SIZE_SHIFT) | TTE_CP | \
-		TTE_P | TTE_W)
-#endif /* CONFIG_VIRT_IDX_DCACHE */
-
-/*
- * This variable is used by the fast_data_access_MMU_miss trap handler.
- * It allows us to save one precious instruction slot of this handler.
- */
-SYMBOL(tlb_tag_access_context_mask)
-	.quad TLB_TAG_ACCESS_CONTEXT_MASK
-
Index: rnel/arch/sparc64/src/sun4v/asm.S
===================================================================
--- kernel/arch/sparc64/src/sun4v/asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-#
-# Copyright (c) 2008 Pavel Rimsky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/mm/mmu.h>
-#include <arch/regdef.h>
-#include <arch/stack.h>
-
-.text
-
-/** Switch to userspace.
- *
- * %o0	Userspace entry address.
- * %o1	Userspace stack pointer address.
- * %o2  Userspace address of uarg structure.
- */
-FUNCTION_BEGIN(switch_to_userspace)
-	save %o1, 0, %sp
-	flushw
-	wrpr %g0, 0, %cleanwin		! avoid information leak
-
-	mov %i2, %o0			! uarg
-	xor %o1, %o1, %o1		! %o1 is defined to hold pcb_ptr
-					! set it to 0
-	clr %i2
-	clr %i3
-	clr %i4
-	clr %i5
-	clr %i6
-	wrpr %g0, 1, %tl		! enforce mapping via nucleus
-
-	rdpr %cwp, %g1
-	wrpr %g1, TSTATE_IE_BIT, %tstate
-	wrpr %i0, 0, %tnpc
-
-	/*
-	 * Set primary context according to secondary context.
-	 * Secondary context has been already installed by
-	 * higher-level functions.
-	 */
-	wr %g0, ASI_SECONDARY_CONTEXT_REG, %asi
-	ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
-	wr %g0, ASI_PRIMARY_CONTEXT_REG, %asi
-	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
-	flush %i7
-
-	/*
-	 * Spills and fills will be handled by the userspace handlers.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
-	done				! jump to userspace
-FUNCTION_END(switch_to_userspace)
Index: rnel/arch/sparc64/src/sun4v/md.c
===================================================================
--- kernel/arch/sparc64/src/sun4v/md.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,321 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <debug.h>
-#include <panic.h>
-#include <halt.h>
-#include <log.h>
-#include <str.h>
-#include <arch/sun4v/md.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/mm/page.h>
-
-/* maximum MD size estimate (in bytes) */
-#define MD_MAX_SIZE	(64 * 1024)
-
-/** element types (element tag values) */
-#define LIST_END	0x0	/**< End of element list */
-#define NODE		0x4e	/**< Start of node definition */
-#define NODE_END	0x45	/**< End of node definition */
-#define NOOP		0x20	/**< NOOP list element - to be ignored */
-#define PROP_ARC	0x61	/**< Node property arc'ing to another node */
-#define PROP_VAL	0x76	/**< Node property with an integer value */
-#define PROP_STR	0x73	/**< Node property with a string value */
-#define PROP_DATA	0x64	/**< Node property with a block of data */
-
-/** machine description header */
-typedef struct {
-	uint32_t transport_version;	/**< Transport version number */
-	uint32_t node_blk_sz;		/**< Size in bytes of node block */
-	uint32_t name_blk_sz;		/**< Size in bytes of name block */
-	uint32_t data_blk_sz;		/**< Size in bytes of data block */
-} __attribute__((packed)) md_header_t;
-
-/** machine description element (in the node block) */
-typedef struct {
-	/** Type of element */
-	uint8_t tag;
-	/** Length in bytes of element name */
-	uint8_t name_len;
-	/** Reserved field (zeros) */
-	uint16_t _reserved_field;
-	/** Location offset of name associated with this element relative to
-	 * start of name block
-	 */
-	uint32_t name_offset;
-
-	union {
-		/** for elements of type “PROP_STR” and of type “PROP_DATA” */
-		struct {
-			/** Length in bytes of data in data block */
-			uint32_t data_len;
-
-			/**
-			 * Location offset of data associated with this
-			 * element relative to start of data block
-			 */
-			uint32_t data_offset;
-		} y;
-
-		/**
-		 *  64 bit value for elements of tag type “NODE”, “PROP_VAL”
-		 *  or “PROP_ARC”
-		 */
-		uint64_t val;
-	} d;
-} __attribute__((packed)) md_element_t;
-
-/** index of the element within the node block */
-typedef unsigned int element_idx_t;
-
-/** buffer to which the machine description will be saved */
-static uint8_t mach_desc[MD_MAX_SIZE]
-    __attribute__((aligned(16)));
-
-/** returns pointer to the element at the given index */
-static md_element_t *get_element(element_idx_t idx)
-{
-	return (md_element_t *) (mach_desc +
-	    sizeof(md_header_t) + idx * sizeof(md_element_t));
-}
-
-/** returns the name of the element represented by the index */
-static const char *get_element_name(element_idx_t idx)
-{
-	md_header_t *md_header = (md_header_t *) mach_desc;
-	uintptr_t name_offset = get_element(idx)->name_offset;
-	return (char *) mach_desc + sizeof(md_header_t) +
-	    md_header->node_blk_sz + name_offset;
-}
-
-/** finds the name of the node represented by "node" */
-const char *md_get_node_name(md_node_t node)
-{
-	return get_element_name(node);
-}
-
-/**
- * Returns the value of the integer property of the given node.
- *
- * @param
- */
-bool md_get_integer_property(md_node_t node, const char *key,
-    uint64_t *result)
-{
-	element_idx_t idx = node;
-
-	while (get_element(idx)->tag != NODE_END) {
-		idx++;
-		md_element_t *element = get_element(idx);
-		if (element->tag == PROP_VAL &&
-		    str_cmp(key, get_element_name(idx)) == 0) {
-			*result = element->d.val;
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/**
- * Returns the value of the string property of the given node.
- *
- * @param
- */
-bool md_get_string_property(md_node_t node, const char *key,
-    const char **result)
-{
-	md_header_t *md_header = (md_header_t *) mach_desc;
-	element_idx_t idx = node;
-
-	while (get_element(idx)->tag != NODE_END) {
-		idx++;
-		md_element_t *element = get_element(idx);
-		if (element->tag == PROP_DATA &&
-		    str_cmp(key, get_element_name(idx)) == 0) {
-			*result = (char *) mach_desc + sizeof(md_header_t) +
-			    md_header->node_blk_sz + md_header->name_blk_sz +
-			    element->d.y.data_offset;
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/**
- * Moves the child oterator to the next child (following sibling of the node
- * the oterator currently points to).
- *
- * @param it	pointer to the iterator to be moved
- */
-bool md_next_child(md_child_iter_t *it)
-{
-	element_idx_t backup = *it;
-
-	while (get_element(*it)->tag != NODE_END) {
-		(*it)++;
-		md_element_t *element = get_element(*it);
-		if (element->tag == PROP_ARC &&
-		    str_cmp("fwd", get_element_name(*it)) == 0) {
-			return true;
-		}
-	}
-
-	*it = backup;
-	return false;
-}
-
-/**
- * Returns the node the iterator point to.
- */
-md_node_t md_get_child_node(md_child_iter_t it)
-{
-	return get_element(it)->d.val;
-}
-
-/**
- * Helper function used to split a string to a part before the first
- * slash sign and a part after the slash sign.
- *
- * @param str	pointer to the string to be split; when the function finishes,
- * 		it will	contain only the part following the first slash sign of
- * 		the original string
- * @param head	pointer to the string which will be set to the part before the
- * 		first slash sign
- */
-static bool str_parse_head(char **str, char **head)
-{
-	*head = *str;
-
-	char *cur = *str;
-	while (*cur != '\0') {
-		if (*cur == '/') {
-			*cur = '\0';
-			*str = cur + 1;
-			return true;
-		}
-		cur++;
-	}
-
-	return false;
-}
-
-/**
- * Returns the descendant of the given node. The descendant is identified
- * by a path where the node names are separated by a slash.
- *
- * Ex.: Let there be a node N with path "a/b/c/x/y/z" and let P represent the
- * node with path "a/b/c". Then md_get_child(P, "x/y/z") will return N.
- */
-md_node_t md_get_child(md_node_t node, char *name)
-{
-	bool more;
-
-	do {
-		char *head;
-		more = str_parse_head(&name, &head);
-
-		while (md_next_child(&node)) {
-			element_idx_t child = md_get_child_node(node);
-			if (str_cmp(head, get_element_name(child)) == 0) {
-				node = child;
-				break;
-			}
-		}
-
-	} while (more);
-
-	return node;
-}
-
-/** returns the root node of MD */
-md_node_t md_get_root(void)
-{
-	return 0;
-}
-
-/**
- * Returns the child iterator - a token to be passed to functions iterating
- * through all the children of a node.
- *
- * @param node	a node whose children the iterator will be used
- * 		to iterate through
- */
-md_child_iter_t md_get_child_iterator(md_node_t node)
-{
-	return node;
-}
-
-/**
- * Moves "node" to the node following "node" in the list of all the existing
- * nodes of the MD whose name is "name".
- */
-bool md_next_node(md_node_t *node, const char *name)
-{
-	md_element_t *element;
-	(*node)++;
-
-	do {
-		element = get_element(*node);
-
-		if (element->tag == NODE &&
-		    str_cmp(name, get_element_name(*node)) == 0) {
-			return true;
-		}
-
-		(*node)++;
-	} while (element->tag != LIST_END);
-
-	return false;
-}
-
-/**
- * Retrieves the machine description from the hypervisor and saves it to
- * a kernel buffer.
- */
-void md_init(void)
-{
-	uint64_t retval = __hypercall_fast2(MACH_DESC, KA2PA(mach_desc),
-	    MD_MAX_SIZE);
-
-	retval = retval;
-	if (retval != HV_EOK) {
-		log(LF_ARCH, LVL_ERROR, "Could not retrieve machine "
-		    "description, error=%" PRIu64 ".", retval);
-	}
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/sun4v/sparc64.c
===================================================================
--- kernel/arch/sparc64/src/sun4v/sparc64.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <arch/arch.h>
-#include <debug.h>
-#include <config.h>
-#include <macros.h>
-#include <arch/trap/trap.h>
-#include <arch/console.h>
-#include <arch/sun4v/md.h>
-#include <console/console.h>
-#include <arch/boot/boot.h>
-#include <arch/arch.h>
-#include <arch/asm.h>
-#include <arch/mm/page.h>
-#include <arch/stack.h>
-#include <interrupt.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <userspace.h>
-#include <ddi/irq.h>
-#include <stdbool.h>
-#include <str.h>
-#include <arch/drivers/niagara.h>
-#include <sysinfo/sysinfo.h>
-
-static void sun4v_pre_mm_init(void);
-static void sun4v_post_mm_init(void);
-static void sun4v_post_smp_init(void);
-
-arch_ops_t sun4v_ops = {
-	.pre_mm_init = sun4v_pre_mm_init,
-	.post_mm_init = sun4v_post_mm_init,
-	.post_smp_init = sun4v_post_smp_init,
-};
-
-arch_ops_t *sparc64_ops = &sun4v_ops;
-
-memmap_t memmap;
-
-/** Perform sparc64-specific initialization before main_bsp() is called. */
-void sparc64_pre_main(bootinfo_t *bootinfo)
-{
-	/* Copy init task info. */
-	init.cnt = min3(bootinfo->taskmap.cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS);
-
-	size_t i;
-	for (i = 0; i < init.cnt; i++) {
-		init.tasks[i].paddr = KA2PA(bootinfo->taskmap.tasks[i].addr);
-		init.tasks[i].size = bootinfo->taskmap.tasks[i].size;
-		str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN,
-		    bootinfo->taskmap.tasks[i].name);
-	}
-
-	/* Copy physical memory map. */
-	memmap.total = bootinfo->memmap.total;
-	memmap.cnt = min(bootinfo->memmap.cnt, MEMMAP_MAX_RECORDS);
-	for (i = 0; i < memmap.cnt; i++) {
-		memmap.zones[i].start = bootinfo->memmap.zones[i].start;
-		memmap.zones[i].size = bootinfo->memmap.zones[i].size;
-	}
-
-	md_init();
-}
-
-/** Perform sparc64 specific initialization before mm is initialized. */
-void sun4v_pre_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		trap_init();
-		exc_arch_init();
-	}
-}
-
-/** Perform sparc64 specific initialization afterr mm is initialized. */
-void sun4v_post_mm_init(void)
-{
-	if (config.cpu_active == 1) {
-		/* Map OFW information into sysinfo */
-		ofw_sysinfo_map();
-
-		/*
-		 * We have 2^11 different interrupt vectors.
-		 * But we only create 128 buckets.
-		 */
-		irq_init(1 << 11, 128);
-	}
-}
-
-void sun4v_post_smp_init(void)
-{
-	/* Currently the only supported platform for sparc64/sun4v is 'sun4v'. */
-	static const char *platform = "sun4v";
-
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-	niagarain_init();
-}
-
-/** Calibrate delay loop.
- *
- * On sparc64, we implement delay() by waiting for the TICK register to
- * reach a pre-computed value, as opposed to performing some pre-computed
- * amount of instructions of known duration. We set the delay_loop_const
- * to 1 in order to neutralize the multiplication done by delay().
- */
-void calibrate_delay_loop(void)
-{
-	CPU->delay_loop_const = 1;
-}
-
-/** Wait several microseconds.
- *
- * We assume that interrupts are already disabled.
- *
- * @param t Microseconds to wait.
- */
-void asm_delay_loop(const uint32_t usec)
-{
-	uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
-	    CPU->arch.clock_frequency / 1000000;
-
-	while (tick_read() < stop)
-		;
-}
-
-uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size)
-{
-	return ALIGN_DOWN(stack_base + stack_size - STACK_WINDOW_SAVE_AREA_SIZE - STACK_ARG_SAVE_AREA_SIZE, 16) - STACK_BIAS;
-}
-
-/** Switch to userspace. */
-void userspace(uintptr_t pc, uintptr_t sp)
-{
-	(void) interrupts_disable();
-	switch_to_userspace(pc, sp, 0);
-
-	/* Not reached */
-	while (true)
-		;
-}
-
-void arch_reboot(void)
-{
-	// TODO
-	while (true)
-		;
-}
-
-/** Construct function pointer
- *
- * @param fptr   function pointer structure
- * @param addr   function address
- * @param caller calling function address
- *
- * @return address of the function pointer
- *
- */
-void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller)
-{
-	return addr;
-}
-
-void irq_initialize_arch(irq_t *irq)
-{
-	(void) irq;
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/sun4v/start.S
===================================================================
--- kernel/arch/sparc64/src/sun4v/start.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,342 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# Copyright (c) 2008 Pavel Rimsky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <arch/arch.h>
-#include <arch/stack.h>
-#include <arch/regdef.h>
-#include <arch/context_struct.h>
-#include <arch/sun4v/regdef.h>
-#include <arch/sun4v/hypercall.h>
-#include <arch/sun4v/arch.h>
-#include <arch/sun4v/cpu.h>
-#include <arch/mm/pagesize.h>
-#include <arch/mm/sun4v/tte.h>
-#include <arch/mm/sun4v/mmu.h>
-#include <arch/mm/sun4v/tlb.h>
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.section K_TEXT_START, "ax"
-
-#define BSP_FLAG		1
-#define PHYSMEM_ADDR_SIZE	56
-
-/*
- * Flags set in the TTE data entry mapping the kernel.
- */
-#ifdef CONFIG_VIRT_IDX_DCACHE
-	#define TTE_FLAGS \
-		(1 << TTE_V_SHIFT) \
-		| (1 << TTE_EP_SHIFT) \
-		| (1 << TTE_CP_SHIFT) \
-		| (1 << TTE_CV_SHIFT) \
-		| (1 << TTE_P_SHIFT) \
-		| (1 << TTE_W_SHIFT)
-#else
-	#define TTE_FLAGS \
-		(1 << TTE_V_SHIFT) \
-		| (1 << TTE_EP_SHIFT) \
-		| (1 << TTE_CP_SHIFT) \
-		| (1 << TTE_P_SHIFT) \
-		| (1 << TTE_W_SHIFT)
-#endif
-
-
-/*
- * Fills a register with a TTE Data item. The item will map the given virtual
- * address to a real address which will be computed by adding the starting
- * address of the physical memory to the virtual address.
- *
- * parameters:
- *  addr:           virtual address to be mapped
- *  rphysmem_start: register containing the starting address
- *                  of the physical memory
- *  rtmp1:          a register to be used as temporary
- *  rtmp2:          a register to be used as temporary
- *  rd:             register where the result will be saved
- *
- */
-#define TTE_DATA(addr, rphysmem_start, rtmp1, rtmp2, rd) \
-	setx TTE_FLAGS | PAGESIZE_4M, rtmp1, rd; \
-	add rd, rphysmem_start, rd; \
-	setx (addr), rtmp1, rtmp2; \
-	add rd, rtmp2, rd;
-
-/*
- * Here is where the kernel is passed control from the boot loader.
- *
- * The registers are expected to be in this state:
- *  - %o0 starting address of physical memory
- *        + bootstrap processor flag
- *          bits 63...1: physical memory starting address / 2
- *          bit 0:       non-zero on BSP processor, zero on AP processors
- *  - %o1 bootinfo structure address (BSP only)
- *
- *
- * Moreover, we depend on boot having established the following environment:
- *  - TLBs are on
- *  - identity mapping for the kernel image
- *
- */
-SYMBOL(kernel_image_start)
-	mov BSP_FLAG, %l0
-	and %o0, %l0, %l7			! l7 <= bootstrap processor?
-	andn %o0, %l0, %l6			! l6 <= start of physical memory
-	or %o1, %g0, %l1
-
-	! Get bits (PHYSMEM_ADDR_SIZE - 1):13 of physmem_base.
-	srlx %l6, 13, %l5
-
-	! l5 <= physmem_base[(PHYSMEM_ADDR_SIZE - 1):13]
-	sllx %l5, 13 + (63 - (PHYSMEM_ADDR_SIZE - 1)), %l5
-	srlx %l5, 63 - (PHYSMEM_ADDR_SIZE - 1), %l5
-
-	/*
-	 * Setup basic runtime environment.
-	 */
-	wrpr %g0, NWINDOWS - 2, %cansave	! set maximum saveable windows
-	wrpr %g0, 0, %canrestore		! get rid of windows we will
-						! never need again
-	wrpr %g0, 0, %otherwin			! make sure the window state is
-						! consistent
-	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent needless clean_window
-						! traps for kernel
-
-	wrpr %g0, 0, %wstate			! use default spill/fill trap
-
-	wrpr %g0, 0, %tl			! TL = 0, primary context
-						! register is used
-	wrpr %g0, 0, %gl
-
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate	! disable interrupts and disable
-						! 32-bit address masking
-
-	wrpr %g0, 0, %pil			! intialize %pil
-
-	/*
-	 * Switch to kernel trap table.
-	 */
-	sethi %hi(trap_table), %g1
-	wrpr %g1, %lo(trap_table), %tba
-
-	/* Explicitly switch to hypervisor API 1.1. */
-	mov 1, %o0
-   	mov 1, %o1
-   	mov 1, %o2
-   	mov 0, %o3
-   	mov 0, %o4
-   	mov 0, %o5
-   	ta 0xff
-
-	/*
-	 * Take over the MMU.
-	 */
-
-	! map kernel in context 1
-	set kernel_load_address, %o0				! virt. address
-	set 1, %o1						! context
-	TTE_DATA(kernel_load_address, %l5, %g2, %g3, %o2)	! TTE data
-	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
-	__HYPERCALL_HYPERFAST(MMU_MAP_ADDR)
-
-	! switch to context 1
-	set 1, %o0
-	set VA_PRIMARY_CONTEXT_REG, %o1
-	stxa %o0, [%o1] ASI_PRIMARY_CONTEXT_REG
-
-	! demap all in context 0
-	set 0, %o0						! reserved
-	set 0, %o1						! reserved
-	set 0, %o2						! context
-	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
-	__HYPERCALL_FAST(MMU_DEMAP_CTX)
-
-	! install permanent mapping for kernel in context 0
-	set kernel_load_address, %o0				! virtual address
-	set 0, %o1						! context
-	TTE_DATA(kernel_load_address, %l5, %g2, %g3, %o2)	! TTE data
-	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
-	__HYPERCALL_FAST(MMU_MAP_PERM_ADDR)
-
-	! switch to context 0
-	mov 0, %o0
-	set VA_PRIMARY_CONTEXT_REG, %o1
-	stxa %o0, [%o1] ASI_PRIMARY_CONTEXT_REG
-
-	! demap all in context 1 (cleanup)
-	set 0, %o0						! reserved
-	set 0, %o1						! reserved
-	set 1, %o2						! context
-	set MMU_FLAG_DTLB | MMU_FLAG_ITLB, %o3			! MMU flags
-	__HYPERCALL_FAST(MMU_DEMAP_CTX)
-
-	/*
-	 * Set CPUID.
-	 */
-	__HYPERCALL_FAST(CPU_MYID)
-	mov SCRATCHPAD_CPUID, %g1
-	stxa %o1, [%g1] ASI_SCRATCHPAD
-
-	/*
-	 * Set MMU fault status area for the current CPU.
-	 */
-	set mmu_fsas, %o0			! o0 <= addr. of fault status areas array
-	add %o0, %l6, %o0			! kernel address to real address
-	mulx %o1, MMU_FSA_SIZE, %g1		! g1 <= offset of current CPU's fault status area
-	add %g1, %o0, %o0			! o0 <= FSA of the current CPU
-	mov SCRATCHPAD_MMU_FSA, %g1
-	stxa %o0, [%g1] ASI_SCRATCHPAD		! remember MMU fault status area to speed up miss handler
-	__HYPERCALL_FAST(MMU_FAULT_AREA_CONF)
-
-	! on APs skip executing the following code
-	cmp %l7, 0
-	be %xcc, 1f
-	nop
-
-	/*
-	 * Save physmem_base for use by the mm subsystem.
-	 * %l6 contains starting physical address
-	 */
-	sethi %hi(physmem_base), %l4
-	stx %l6, [%l4 + %lo(physmem_base)]
-
-	/*
-	 * Store a template of a TTE Data entry for kernel mappings.
-	 * This template will be used from the kernel MMU miss handler.
-	 */
-	!TTE_DATA(0, %l5, %g2, %g3, %g1)
-	setx TTE_FLAGS | PAGESIZE_8K, %g2, %g1; \
-	add %g1, %l5, %g1; \
-	set kernel_8k_tlb_data_template, %g4
-	stx %g1, [%g4]
-
-	/*
-	 * So far, we have not touched the stack.
-	 * It is a good idea to set the kernel stack to a known state now.
-	 */
-	sethi %hi(temporary_boot_stack), %sp
-	or %sp, %lo(temporary_boot_stack), %sp
-	sub %sp, STACK_BIAS, %sp
-
-	/*
-	 * Call sparc64_pre_main(bootinfo)
-	 */
-	call sparc64_pre_main
-	or %l1, %g0, %o0
-
-	/*
-	 * Create the first stack frame.
-	 */
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
-	flushw
-	add %g0, -STACK_BIAS, %fp
-
-	call main_bsp
-	nop
-
-	/* Not reached. */
-
-0:
-	ba,a %xcc, 0b
-
-1:
-
-#ifdef CONFIG_SMP
-
-	/*
-	 * Configure stack for the AP.
-	 * The AP is expected to use the stack saved
-	 * in the ctx global variable.
-	 */
-
-	mov 1, %o0		! MMU enable flag
-	set mmu_enabled, %o1
-	mov MMU_ENABLE, %o5	! MMU enable HV call
-	ta 0x80			! call HV
-
-	mmu_enabled:
-
-	/*
-	 * Configure stack for the AP.
-	 * The AP is expected to use the stack saved
-	 * in the ctx global variable.
-	 */
-	set ctx, %g1
-	add %g1, CONTEXT_OFFSET_SP, %g1
-	ldx [%g1], %o6
-
-	/*
-	 * Create the first stack frame.
-	 */
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp
-	flushw
-	add %g0, -STACK_BIAS, %fp
-
-	call main_ap
-	nop
-#endif
-
-	/* Not reached. */
-0:
-	ba,a %xcc, 0b
-
-.section K_DATA_START, "aw", @progbits
-
-#define INITIAL_STACK_SIZE		1024
-
-.align STACK_ALIGNMENT
-	.space INITIAL_STACK_SIZE
-.align STACK_ALIGNMENT
-temporary_boot_stack:
-	.space STACK_WINDOW_SAVE_AREA_SIZE
-
-
-.data
-
-.align 8
-SYMBOL(physmem_base)	! copy of the physical memory base address
-	.quad 0
-
-/*
- * This variable is used by the fast_data_access_MMU_miss trap handler.
- * In runtime, it is modified to contain the address of the end of physical
- * memory.
- */
-SYMBOL(end_of_identity)
-	.quad -1
-
-SYMBOL(kernel_8k_tlb_data_template)
-	.quad 0
-
-/* MMU fault status areas for all CPUs */
-.align MMU_FSA_ALIGNMENT
-SYMBOL(mmu_fsas)
-	.space (MMU_FSA_SIZE * MAX_NUM_STRANDS)
Index: rnel/arch/sparc64/src/trap/exception.c
===================================================================
--- kernel/arch/sparc64/src/trap/exception.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- *
- */
-
-#include <arch/trap/exception.h>
-#include <arch/mm/tlb.h>
-#include <arch/interrupt.h>
-#include <interrupt.h>
-#include <arch/asm.h>
-#include <arch/register.h>
-#include <debug.h>
-#include <stdio.h>
-#include <symtab.h>
-
-void istate_decode(istate_t *istate)
-{
-	const char *tpcs = symtab_fmt_name_lookup(istate->tpc);
-	const char *tnpcs = symtab_fmt_name_lookup(istate->tnpc);
-
-	printf("TSTATE=%#" PRIx64 "\n", istate->tstate);
-	printf("TPC=%#" PRIx64 " (%s)\n", istate->tpc, tpcs);
-	printf("TNPC=%#" PRIx64 " (%s)\n", istate->tnpc, tnpcs);
-}
-
-/** Handle instruction_access_exception. (0x8) */
-void instruction_access_exception(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle instruction_access_error. (0xa) */
-void instruction_access_error(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle illegal_instruction. (0x10) */
-void illegal_instruction(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle privileged_opcode. (0x11) */
-void privileged_opcode(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle unimplemented_LDD. (0x12) */
-void unimplemented_LDD(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle unimplemented_STD. (0x13) */
-void unimplemented_STD(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle fp_disabled. (0x20) */
-void fp_disabled(unsigned int n, istate_t *istate)
-{
-	fprs_reg_t fprs;
-
-	fprs.value = fprs_read();
-	if (!fprs.fef) {
-		fprs.fef = true;
-		fprs_write(fprs.value);
-		return;
-	}
-
-#ifdef CONFIG_FPU_LAZY
-	scheduler_fpu_lazy_request();
-#else
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-#endif
-}
-
-/** Handle fp_exception_ieee_754. (0x21) */
-void fp_exception_ieee_754(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle fp_exception_other. (0x22) */
-void fp_exception_other(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle tag_overflow. (0x23) */
-void tag_overflow(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle division_by_zero. (0x28) */
-void division_by_zero(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle data_access_exception. (0x30) */
-void data_access_exception(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle data_access_error. (0x32) */
-void data_access_error(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle mem_address_not_aligned. (0x34) */
-void mem_address_not_aligned(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle LDDF_mem_address_not_aligned. (0x35) */
-void LDDF_mem_address_not_aligned(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle STDF_mem_address_not_aligned. (0x36) */
-void STDF_mem_address_not_aligned(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle privileged_action. (0x37) */
-void privileged_action(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle LDQF_mem_address_not_aligned. (0x38) */
-void LDQF_mem_address_not_aligned(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** Handle STQF_mem_address_not_aligned. (0x39) */
-void STQF_mem_address_not_aligned(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "%s.", __func__);
-	panic_badtrap(istate, n, "%s.", __func__);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/trap/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/interrupt.h>
-#include <arch/trap/interrupt.h>
-#include <arch/trap/exception.h>
-#include <arch/trap/mmu.h>
-#include <arch/sparc64.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <stdbool.h>
-#include <debug.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <arch/drivers/tick.h>
-#include <arch.h>
-#include <mm/tlb.h>
-#include <config.h>
-#include <synch/spinlock.h>
-
-void exc_arch_init(void)
-{
-	exc_register(TT_INSTRUCTION_ACCESS_EXCEPTION,
-	    "instruction_access_exception", false,
-	    instruction_access_exception);
-	exc_register(TT_INSTRUCTION_ACCESS_ERROR,
-	    "instruction_access_error", false,
-	    instruction_access_error);
-
-#ifdef SUN4V
-	exc_register(TT_IAE_UNAUTH_ACCESS,
-	    "iae_unauth_access", false,
-	    instruction_access_exception);
-	exc_register(TT_IAE_NFO_PAGE,
-	    "iae_nfo_page", false,
-	    instruction_access_exception);
-#endif
-
-	exc_register(TT_ILLEGAL_INSTRUCTION,
-	    "illegal_instruction", false,
-	    illegal_instruction);
-	exc_register(TT_PRIVILEGED_OPCODE,
-	    "privileged_opcode", false,
-	    privileged_opcode);
-	exc_register(TT_UNIMPLEMENTED_LDD,
-	    "unimplemented_LDD", false,
-	    unimplemented_LDD);
-	exc_register(TT_UNIMPLEMENTED_STD,
-	    "unimplemented_STD", false,
-	    unimplemented_STD);
-
-#ifdef SUN4V
-	exc_register(TT_DAE_INVALID_ASI,
-	    "dae_invalid_asi", false,
-	    data_access_exception);
-	exc_register(TT_DAE_PRIVILEGE_VIOLATION,
-	    "dae_privilege_violation", false,
-	    data_access_exception);
-	exc_register(TT_DAE_NC_PAGE,
-	    "dae_nc_page", false,
-	    data_access_exception);
-	exc_register(TT_DAE_NC_PAGE,
-	    "dae_nc_page", false,
-	    data_access_exception);
-	exc_register(TT_DAE_NFO_PAGE,
-	    "dae_nfo_page", false,
-	    data_access_exception);
-#endif
-
-	exc_register(TT_FP_DISABLED,
-	    "fp_disabled", true,
-	    fp_disabled);
-	exc_register(TT_FP_EXCEPTION_IEEE_754,
-	    "fp_exception_ieee_754", false,
-	    fp_exception_ieee_754);
-	exc_register(TT_FP_EXCEPTION_OTHER,
-	    "fp_exception_other", false,
-	    fp_exception_other);
-	exc_register(TT_TAG_OVERFLOW,
-	    "tag_overflow", false,
-	    tag_overflow);
-	exc_register(TT_DIVISION_BY_ZERO,
-	    "division_by_zero", false,
-	    division_by_zero);
-	exc_register(TT_DATA_ACCESS_EXCEPTION,
-	    "data_access_exception", false,
-	    data_access_exception);
-	exc_register(TT_DATA_ACCESS_ERROR,
-	    "data_access_error", false,
-	    data_access_error);
-	exc_register(TT_MEM_ADDRESS_NOT_ALIGNED,
-	    "mem_address_not_aligned", false,
-	    mem_address_not_aligned);
-	exc_register(TT_LDDF_MEM_ADDRESS_NOT_ALIGNED,
-	    "LDDF_mem_address_not_aligned", false,
-	    LDDF_mem_address_not_aligned);
-	exc_register(TT_STDF_MEM_ADDRESS_NOT_ALIGNED,
-	    "STDF_mem_address_not_aligned", false,
-	    STDF_mem_address_not_aligned);
-	exc_register(TT_PRIVILEGED_ACTION,
-	    "privileged_action", false,
-	    privileged_action);
-	exc_register(TT_LDQF_MEM_ADDRESS_NOT_ALIGNED,
-	    "LDQF_mem_address_not_aligned", false,
-	    LDQF_mem_address_not_aligned);
-	exc_register(TT_STQF_MEM_ADDRESS_NOT_ALIGNED,
-	    "STQF_mem_address_not_aligned", false,
-	    STQF_mem_address_not_aligned);
-
-	exc_register(TT_INTERRUPT_LEVEL_14,
-	    "interrupt_level_14", true,
-	    tick_interrupt);
-
-#ifdef SUN4U
-	exc_register(TT_INTERRUPT_VECTOR_TRAP,
-	    "interrupt_vector_trap", true,
-	    interrupt);
-#endif
-
-	exc_register(TT_FAST_INSTRUCTION_ACCESS_MMU_MISS,
-	    "fast_instruction_access_mmu_miss", true,
-	    fast_instruction_access_mmu_miss);
-	exc_register(TT_FAST_DATA_ACCESS_MMU_MISS,
-	    "fast_data_access_mmu_miss", true,
-	    fast_data_access_mmu_miss);
-	exc_register(TT_FAST_DATA_ACCESS_PROTECTION,
-	    "fast_data_access_protection", true,
-	    fast_data_access_protection);
-
-#ifdef SUN4V
-	exc_register(TT_CPU_MONDO,
-	    "cpu_mondo", true,
-	    cpu_mondo);
-#endif
-
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/trap/sun4u/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/sun4u/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/barrier.h>
-#include <arch/interrupt.h>
-#include <arch/sparc64.h>
-#include <arch/trap/interrupt.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <stdint.h>
-#include <debug.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <log.h>
-#include <arch.h>
-#include <mm/tlb.h>
-#include <config.h>
-#include <synch/spinlock.h>
-
-/** Process hardware interrupt.
- *
- * @param n Ignored.
- * @param istate Ignored.
- */
-void interrupt(unsigned int n, istate_t *istate)
-{
-	uint64_t status = asi_u64_read(ASI_INTR_DISPATCH_STATUS, 0);
-	if (status & (!INTR_DISPATCH_STATUS_BUSY))
-		panic("Interrupt Dispatch Status busy bit not set\n");
-
-	uint64_t intrcv = asi_u64_read(ASI_INTR_RECEIVE, 0);
-#if defined (US)
-	uint64_t data0 = asi_u64_read(ASI_INTR_R, ASI_UDB_INTR_R_DATA_0);
-#elif defined (US3)
-	uint64_t data0 = asi_u64_read(ASI_INTR_R, VA_INTR_R_DATA_0);
-#endif
-
-	irq_t *irq = irq_dispatch_and_lock(data0);
-	if (irq) {
-		/*
-		 * The IRQ handler was found.
-		 */
-		irq->handler(irq);
-
-		/*
-		 * See if there is a clear-interrupt-routine and call it.
-		 */
-		if (irq->cir)
-			irq->cir(irq->cir_arg, irq->inr);
-
-		irq_spinlock_unlock(&irq->lock, false);
-	} else if (data0 > config.base) {
-		/*
-		 * This is a cross-call.
-		 * data0 contains address of the kernel function.
-		 * We call the function only after we verify
-		 * it is one of the supported ones.
-		 */
-#ifdef CONFIG_SMP
-		if (data0 == (uintptr_t) tlb_shootdown_ipi_recv)
-			tlb_shootdown_ipi_recv();
-#endif
-	} else {
-		/*
-		 * Spurious interrupt.
-		 */
-#ifdef CONFIG_DEBUG
-		log(LF_ARCH, LVL_DEBUG,
-		    "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#"
-		    PRIx64 ")", CPU->id, intrcv, data0);
-#else
-		(void) intrcv;
-#endif
-	}
-
-	membar();
-	asi_u64_write(ASI_INTR_RECEIVE, 0, 0);
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/trap/sun4u/mmu.S
===================================================================
--- kernel/arch/sparc64/src/trap/sun4u/mmu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-/**
- * @file
- * @brief	MMU trap handlers that do not fit into the trap table.
- */
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.text
-
-#include <arch/trap/mmu.h>
-#include <arch/trap/trap_table.h>
-#include <arch/regdef.h>
-
Index: rnel/arch/sparc64/src/trap/sun4u/trap_table.S
===================================================================
--- kernel/arch/sparc64/src/trap/sun4u/trap_table.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,860 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-/**
- * @file
- * @brief This file contains kernel trap table.
- */
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.text
-
-#include <abi/asmtool.h>
-#include <arch/trap/trap_table.h>
-#include <arch/trap/regwin.h>
-#include <arch/trap/interrupt.h>
-#include <arch/trap/exception.h>
-#include <arch/trap/syscall.h>
-#include <arch/trap/mmu.h>
-#include <arch/mm/mmu.h>
-#include <arch/mm/page.h>
-#include <arch/stack.h>
-#include <arch/regdef.h>
-
-#define TABLE_SIZE	TRAP_TABLE_SIZE
-#define ENTRY_SIZE	TRAP_TABLE_ENTRY_SIZE
-
-/*
- * Kernel trap table.
- */
-.align TABLE_SIZE
-SYMBOL(trap_table)
-
-/* TT = 0x08, TL = 0, instruction_access_exception */
-.org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE
-SYMBOL(instruction_access_exception_tl0)
-	wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate
-	mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0a, TL = 0, instruction_access_error */
-.org trap_table + TT_INSTRUCTION_ACCESS_ERROR*ENTRY_SIZE
-SYMBOL(instruction_access_error_tl0)
-	mov TT_INSTRUCTION_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x10, TL = 0, illegal_instruction */
-.org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE
-SYMBOL(illegal_instruction_tl0)
-	mov TT_ILLEGAL_INSTRUCTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x11, TL = 0, privileged_opcode */
-.org trap_table + TT_PRIVILEGED_OPCODE*ENTRY_SIZE
-SYMBOL(privileged_opcode_tl0)
-	mov TT_PRIVILEGED_OPCODE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x12, TL = 0, unimplemented_LDD */
-.org trap_table + TT_UNIMPLEMENTED_LDD*ENTRY_SIZE
-SYMBOL(unimplemented_LDD_tl0)
-	mov TT_UNIMPLEMENTED_LDD, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x13, TL = 0, unimplemented_STD */
-.org trap_table + TT_UNIMPLEMENTED_STD*ENTRY_SIZE
-SYMBOL(unimplemented_STD_tl0)
-	mov TT_UNIMPLEMENTED_STD, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x20, TL = 0, fb_disabled handler */
-.org trap_table + TT_FP_DISABLED*ENTRY_SIZE
-SYMBOL(fp_disabled_tl0)
-	mov TT_FP_DISABLED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x21, TL = 0, fb_exception_ieee_754 handler */
-.org trap_table + TT_FP_EXCEPTION_IEEE_754*ENTRY_SIZE
-SYMBOL(fp_exception_ieee_754_tl0)
-	mov TT_FP_EXCEPTION_IEEE_754, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x22, TL = 0, fb_exception_other handler */
-.org trap_table + TT_FP_EXCEPTION_OTHER*ENTRY_SIZE
-SYMBOL(fp_exception_other_tl0)
-	mov TT_FP_EXCEPTION_OTHER, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x23, TL = 0, tag_overflow */
-.org trap_table + TT_TAG_OVERFLOW*ENTRY_SIZE
-SYMBOL(tag_overflow_tl0)
-	mov TT_TAG_OVERFLOW, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x24, TL = 0, clean_window handler */
-.org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE
-SYMBOL(clean_window_tl0)
-	CLEAN_WINDOW_HANDLER
-
-/* TT = 0x28, TL = 0, division_by_zero */
-.org trap_table + TT_DIVISION_BY_ZERO*ENTRY_SIZE
-SYMBOL(division_by_zero_tl0)
-	mov TT_DIVISION_BY_ZERO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x30, TL = 0, data_access_exception */
-.org trap_table + TT_DATA_ACCESS_EXCEPTION*ENTRY_SIZE
-SYMBOL(data_access_exception_tl0)
-	wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate
-	mov TT_DATA_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x32, TL = 0, data_access_error */
-.org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE
-SYMBOL(data_access_error_tl0)
-	mov TT_DATA_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x34, TL = 0, mem_address_not_aligned */
-.org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(mem_address_not_aligned_tl0)
-	mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x35, TL = 0, LDDF_mem_address_not_aligned */
-.org trap_table + TT_LDDF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(LDDF_mem_address_not_aligned_tl0)
-	mov TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x36, TL = 0, STDF_mem_address_not_aligned */
-.org trap_table + TT_STDF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(STDF_mem_address_not_aligned_tl0)
-	mov TT_STDF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x37, TL = 0, privileged_action */
-.org trap_table + TT_PRIVILEGED_ACTION*ENTRY_SIZE
-SYMBOL(privileged_action_tl0)
-	mov TT_PRIVILEGED_ACTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x38, TL = 0, LDQF_mem_address_not_aligned */
-.org trap_table + TT_LDQF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(LDQF_mem_address_not_aligned_tl0)
-	mov TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x39, TL = 0, STQF_mem_address_not_aligned */
-.org trap_table + TT_STQF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(STQF_mem_address_not_aligned_tl0)
-	mov TT_STQF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x41, TL = 0, interrupt_level_1 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE
-SYMBOL(interrupt_level_1_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_1, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x42, TL = 0, interrupt_level_2 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE
-SYMBOL(interrupt_level_2_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_2, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x43, TL = 0, interrupt_level_3 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE
-SYMBOL(interrupt_level_3_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_3, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x44, TL = 0, interrupt_level_4 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE
-SYMBOL(interrupt_level_4_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_4, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x45, TL = 0, interrupt_level_5 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE
-SYMBOL(interrupt_level_5_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_5, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x46, TL = 0, interrupt_level_6 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE
-SYMBOL(interrupt_level_6_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_6, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x47, TL = 0, interrupt_level_7 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE
-SYMBOL(interrupt_level_7_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_7, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x48, TL = 0, interrupt_level_8 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE
-SYMBOL(interrupt_level_8_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_8, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x49, TL = 0, interrupt_level_9 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE
-SYMBOL(interrupt_level_9_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_9, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4a, TL = 0, interrupt_level_10 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE
-SYMBOL(interrupt_level_10_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_10, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4b, TL = 0, interrupt_level_11 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE
-SYMBOL(interrupt_level_11_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_11, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4c, TL = 0, interrupt_level_12 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE
-SYMBOL(interrupt_level_12_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_12, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4d, TL = 0, interrupt_level_13 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE
-SYMBOL(interrupt_level_13_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_13, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4e, TL = 0, interrupt_level_14 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE
-SYMBOL(interrupt_level_14_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_14, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4f, TL = 0, interrupt_level_15 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE
-SYMBOL(interrupt_level_15_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_15, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x60, TL = 0, interrupt_vector_trap handler */
-.org trap_table + TT_INTERRUPT_VECTOR_TRAP*ENTRY_SIZE
-SYMBOL(interrupt_vector_trap_handler_tl0)
-	mov TT_INTERRUPT_VECTOR_TRAP, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */
-.org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(fast_instruction_access_mmu_miss_handler_tl0)
-	FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
-
-/* TT = 0x68, TL = 0, fast_data_access_MMU_miss */
-.org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(fast_data_access_mmu_miss_handler_tl0)
-	FAST_DATA_ACCESS_MMU_MISS_HANDLER 0
-
-/* TT = 0x6c, TL = 0, fast_data_access_protection */
-.org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE
-SYMBOL(fast_data_access_protection_handler_tl0)
-	FAST_DATA_ACCESS_PROTECTION_HANDLER 0
-
-/* TT = 0x80, TL = 0, spill_0_normal handler */
-.org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE
-SYMBOL(spill_0_normal_tl0)
-	SPILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0x84, TL = 0, spill_1_normal handler */
-.org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE
-SYMBOL(spill_1_normal_tl0)
-	SPILL_NORMAL_HANDLER_USERSPACE
-
-/* TT = 0x88, TL = 0, spill_2_normal handler */
-.org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE
-SYMBOL(spill_2_normal_tl0)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xa0, TL = 0, spill_0_other handler */
-.org trap_table + TT_SPILL_0_OTHER*ENTRY_SIZE
-SYMBOL(spill_0_other_tl0)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xc0, TL = 0, fill_0_normal handler */
-.org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE
-SYMBOL(fill_0_normal_tl0)
-	FILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0xc4, TL = 0, fill_1_normal handler */
-.org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE
-SYMBOL(fill_1_normal_tl0)
-	FILL_NORMAL_HANDLER_USERSPACE
-
-/* TT = 0x100 - 0x17f, TL = 0, trap_instruction_0 - trap_instruction_7f */
-.irp cur, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\
-    20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\
-    39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\
-    58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\
-    77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,\
-    96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\
-    112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,\
-    127
-.org trap_table + (TT_TRAP_INSTRUCTION_0+\cur)*ENTRY_SIZE
-SYMBOL(trap_instruction_\cur\()_tl0)
-	mov \cur, %g2
-	ba %xcc, trap_instruction_handler
-	clr %g5
-.endr
-
-/*
- * Handlers for TL>0.
- */
-
-/* TT = 0x08, TL > 0, instruction_access_exception */
-.org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE
-SYMBOL(instruction_access_exception_tl1)
-	wrpr %g0, 1, %tl
-	wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate
-	mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0a, TL > 0, instruction_access_error */
-.org trap_table + (TT_INSTRUCTION_ACCESS_ERROR+512)*ENTRY_SIZE
-SYMBOL(instruction_access_error_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_INSTRUCTION_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x10, TL > 0, illegal_instruction */
-.org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE
-SYMBOL(illegal_instruction_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_ILLEGAL_INSTRUCTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x24, TL > 0, clean_window handler */
-.org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE
-SYMBOL(clean_window_tl1)
-	CLEAN_WINDOW_HANDLER
-
-/* TT = 0x28, TL > 0, division_by_zero */
-.org trap_table + (TT_DIVISION_BY_ZERO+512)*ENTRY_SIZE
-SYMBOL(division_by_zero_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DIVISION_BY_ZERO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x30, TL > 0, data_access_exception */
-.org trap_table + (TT_DATA_ACCESS_EXCEPTION+512)*ENTRY_SIZE
-SYMBOL(data_access_exception_tl1)
-	wrpr %g0, 1, %tl
-	wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate
-	mov TT_DATA_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x32, TL > 0, data_access_error */
-.org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE
-SYMBOL(data_access_error_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DATA_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x34, TL > 0, mem_address_not_aligned */
-.org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE
-SYMBOL(mem_address_not_aligned_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x68, TL > 0, fast_data_access_MMU_miss */
-.org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE
-SYMBOL(fast_data_access_mmu_miss_handler_tl1)
-	FAST_DATA_ACCESS_MMU_MISS_HANDLER 1
-
-/* TT = 0x6c, TL > 0, fast_data_access_protection */
-.org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE
-SYMBOL(fast_data_access_protection_handler_tl1)
-	FAST_DATA_ACCESS_PROTECTION_HANDLER 1
-
-/* TT = 0x80, TL > 0, spill_0_normal handler */
-.org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE
-SYMBOL(spill_0_normal_tl1)
-	SPILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0x88, TL > 0, spill_2_normal handler */
-.org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE
-SYMBOL(spill_2_normal_tl1)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xa0, TL > 0, spill_0_other handler */
-.org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE
-SYMBOL(spill_0_other_tl1)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xc0, TL > 0, fill_0_normal handler */
-.org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE
-SYMBOL(fill_0_normal_tl1)
-	FILL_NORMAL_HANDLER_KERNEL
-
-.align TABLE_SIZE
-
-
-#define NOT(x)	((x) == 0)
-
-/* Preemptible trap handler for TL=1.
- *
- * This trap handler makes arrangements to make calling of scheduler() from
- * within a trap context possible. It is called from several other trap
- * handlers.
- *
- * This function can be entered either with interrupt globals or alternate
- * globals. Memory management trap handlers are obliged to switch to one of
- * those global sets prior to calling this function. Register window management
- * functions are not allowed to modify the alternate global registers.
- *
- * The kernel is designed to work on trap levels 0 - 4. For instance, the
- * following can happen:
- * TL0: kernel thread runs (CANSAVE=0, kernel stack not in DTLB)
- * TL1: preemptible trap handler started after a tick interrupt
- * TL2: preemptible trap handler did SAVE
- * TL3: spill handler touched the kernel stack
- * TL4: hardware or software failure
- *
- * Input registers:
- *	%g1		Address of function to call if this is not a syscall.
- * 	%g2	 	First argument for the function.
- *	%g5		I/DTLB_TAG_ACCESS register if applicable.
- *	%g6		Pre-set as kernel stack base if trap from userspace.
- *	%g7		Pre-set as address of the userspace window buffer.
- */
-.macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall
-.if NOT(\is_syscall)
-	rdpr %tstate, %g3
-
-	/*
-	 * One of the ways this handler can be invoked is after a nested MMU trap from
-	 * either spill_1_normal or fill_1_normal traps. Both of these traps manipulate
-	 * the CWP register. We deal with the situation by simulating the MMU trap
-	 * on TL=1 and restart the respective SAVE or RESTORE instruction once the MMU
-	 * trap is resolved. However, because we are in the wrong window from the
-	 * perspective of the MMU trap, we need to synchronize CWP with CWP from TL=0.
-	 */
-	and %g3, TSTATE_CWP_MASK, %g4
-	wrpr %g4, 0, %cwp			! resynchronize CWP
-
-	andcc %g3, TSTATE_PRIV_BIT, %g0		! if this trap came from the privileged mode...
-	bnz %xcc, 0f				! ...skip setting of kernel stack and primary context
-	nop
-.endif
-
-	/*
-	 * Normal window spills will go to the userspace window buffer.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(2), %wstate
-
-	wrpr %g0, NWINDOWS - 1, %cleanwin	! prevent unnecessary clean_window exceptions
-
-	/*
-	 * Switch to kernel stack. The old stack is
-	 * automatically saved in the old window's %sp
-	 * and the new window's %fp.
-	 */
-	save %g6, -ISTATE_SIZE, %sp
-
-.if \is_syscall
-	/*
-	 * Copy arguments for the syscall to the new window.
-	 */
-	mov %i0, %o0
-	mov %i1, %o1
-	mov %i2, %o2
-	mov %i3, %o3
-	mov %i4, %o4
-	mov %i5, %o5
-.endif
-
-	/*
-	 * Mark the CANRESTORE windows as OTHER windows.
-	 */
-	rdpr %canrestore, %l0
-	wrpr %l0, %otherwin
-	wrpr %g0, %canrestore
-
-	/*
-	 * Switch to primary context 0.
-	 */
-	mov VA_PRIMARY_CONTEXT_REG, %l0
-	stxa %g0, [%l0] ASI_DMMU
-	rd %pc, %l0
-	flush %l0
-
-.if NOT(\is_syscall)
-	ba,a %xcc, 1f
-0:
-	save %sp, -ISTATE_SIZE, %sp
-
-	/*
-	 * At this moment, we are using the kernel stack
-	 * and have successfully allocated a register window.
-	 */
-1:
-.endif
-	/*
-	 * Other window spills will go to the userspace window buffer
-	 * and normal spills will go to the kernel stack.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate
-
-	/*
-	 * Copy arguments.
-	 */
-	mov %g1, %l0
-.if NOT(\is_syscall)
-	mov %g2, %o0
-.else
-	! store the syscall number on the stack as 7th argument
-	stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_ARG6]
-.endif
-
-	/*
-	 * Save TSTATE, TPC, TNPC and I/DTLB_TAG_ACCESS aside.
-	 */
-	rdpr %tstate, %g1
-	rdpr %tpc, %g2
-	rdpr %tnpc, %g3
-	rd %y, %g4
-
-	stx %g1, [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE]
-	stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_TPC]
-	stx %g3, [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC]
-	stx %g5, [%sp + STACK_BIAS + ISTATE_OFFSET_TLB_TAG_ACCESS]
-
-	/*
-	 * Save the Y register.
-	 */
-	stx %g4, [%sp + STACK_BIAS + ISTATE_OFFSET_Y]
-
-	wrpr %g0, 0, %tl
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate
-	SAVE_GLOBALS
-
-.if NOT(\is_syscall)
-	/*
-	 * Call the higher-level handler and pass istate as second parameter.
-	 */
-	call %l0
-	add %sp, STACK_BIAS, %o1
-.else
-	/*
-	 * Call the higher-level syscall handler and enable interrupts.
-	 */
-	call syscall_handler
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT | PSTATE_IE_BIT, %pstate
-	mov %o0, %i0				! copy the value returned by the syscall
-.endif
-
-	RESTORE_GLOBALS
-	rdpr %pstate, %l1			! we must preserve the PEF bit
-	wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate
-	wrpr %g0, 1, %tl
-
-	/*
-	 * Read TSTATE, TPC and TNPC from saved copy.
-	 */
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE], %g1
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TPC], %g2
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC], %g3
-
-	/*
-	 * Copy PSTATE.PEF to the in-register copy of TSTATE.
-	 */
-	and %l1, PSTATE_PEF_BIT, %l1
-	sllx %l1, TSTATE_PSTATE_SHIFT, %l1
-	sethi %hi(TSTATE_PEF_BIT), %g4
-	andn %g1, %g4, %g1
-	or %g1, %l1, %g1
-
-	/*
-	 * Restore TSTATE, TPC and TNPC from saved copies.
-	 */
-	wrpr %g1, 0, %tstate
-	wrpr %g2, 0, %tpc
-	wrpr %g3, 0, %tnpc
-
-	/*
-	 * Restore Y.
-	 */
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_Y], %g4
-	wr %g4, %y
-
-	/*
-	 * If OTHERWIN is zero, then all the userspace windows have been
-	 * spilled to kernel memory (i.e. register window buffer). Moreover,
-	 * if the scheduler was called in the meantime, all valid windows
-	 * belonging to other threads were spilled by context_save().
-	 * If OTHERWIN is non-zero, then some userspace windows are still
-	 * valid. Others might have been spilled. However, the CWP pointer
-	 * needs no fixing because the scheduler had not been called.
-	 */
-	rdpr %otherwin, %l0
-	brnz %l0, 0f
-	nop
-
-	/*
-	 * OTHERWIN == 0
-	 */
-
-	/*
-	 * If TSTATE.CWP + 1 == CWP, then we still do not have to fix CWP.
-	 */
-	and %g1, TSTATE_CWP_MASK, %l0
-	inc %l0
-	and %l0, NWINDOWS - 1, %l0	! %l0 mod NWINDOWS
-	rdpr %cwp, %l1
-	cmp %l0, %l1
-	bz %xcc, 0f			! CWP is ok
-	nop
-
-	/*
-	 * Fix CWP.
-	 * In order to recapitulate, the input registers in the current
-	 * window are the output registers of the window to which we want
-	 * to restore. Because the fill trap fills only input and local
-	 * registers of a window, we need to preserve those output
-	 * registers manually.
-	 */
-	mov %sp, %g2
-	stx %i0, [%sp + STACK_BIAS + ISTATE_OFFSET_O0]
-	stx %i1, [%sp + STACK_BIAS + ISTATE_OFFSET_O1]
-	stx %i2, [%sp + STACK_BIAS + ISTATE_OFFSET_O2]
-	stx %i3, [%sp + STACK_BIAS + ISTATE_OFFSET_O3]
-	stx %i4, [%sp + STACK_BIAS + ISTATE_OFFSET_O4]
-	stx %i5, [%sp + STACK_BIAS + ISTATE_OFFSET_O5]
-	stx %i6, [%sp + STACK_BIAS + ISTATE_OFFSET_O6]
-	stx %i7, [%sp + STACK_BIAS + ISTATE_OFFSET_O7]
-	wrpr %l0, 0, %cwp
-	mov %g2, %sp
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O0], %i0
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O1], %i1
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O2], %i2
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O3], %i3
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O4], %i4
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O5], %i5
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O6], %i6
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O7], %i7
-
-	/*
-	 * OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case.
-	 * The CWP has already been restored to the value it had after the SAVE
-	 * at the beginning of this function.
-	 */
-0:
-.if NOT(\is_syscall)
-	rdpr %tstate, %g1
-	andcc %g1, TSTATE_PRIV_BIT, %g0		! if we are not returning to userspace...,
-	bnz %xcc, 1f				! ...skip restoring userspace windows
-	nop
-.endif
-
-	/*
-	 * Spills and fills will be processed by the {spill,fill}_1_normal
-	 * handlers.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
-
-	/*
-	 * Set primary context according to secondary context.
-	 */
-	wr %g0, ASI_DMMU, %asi
-	ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
-	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
-	rd %pc, %g1
-	flush %g1
-
-	rdpr %cwp, %g1
-	rdpr %otherwin, %g2
-
-	/*
-	 * Skip all OTHERWIN windows and descend to the first window
-	 * in the userspace window buffer.
-	 */
-	sub %g1, %g2, %g3
-	dec %g3
-	and %g3, NWINDOWS - 1, %g3
-	wrpr %g3, 0, %cwp
-
-	/*
-	 * CWP is now in the window last saved in the userspace window buffer.
-	 * Fill all windows stored in the buffer.
-	 */
-	clr %g4
-0:	andcc %g7, UWB_ALIGNMENT - 1, %g0	! alignment check
-	bz %xcc, 0f				! %g7 is UWB_ALIGNMENT-aligned, no more windows to refill
-	nop
-
-	add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7
-	ldx [%g7 + L0_OFFSET], %l0
-	ldx [%g7 + L1_OFFSET], %l1
-	ldx [%g7 + L2_OFFSET], %l2
-	ldx [%g7 + L3_OFFSET], %l3
-	ldx [%g7 + L4_OFFSET], %l4
-	ldx [%g7 + L5_OFFSET], %l5
-	ldx [%g7 + L6_OFFSET], %l6
-	ldx [%g7 + L7_OFFSET], %l7
-	ldx [%g7 + I0_OFFSET], %i0
-	ldx [%g7 + I1_OFFSET], %i1
-	ldx [%g7 + I2_OFFSET], %i2
-	ldx [%g7 + I3_OFFSET], %i3
-	ldx [%g7 + I4_OFFSET], %i4
-	ldx [%g7 + I5_OFFSET], %i5
-	ldx [%g7 + I6_OFFSET], %i6
-	ldx [%g7 + I7_OFFSET], %i7
-
-	dec %g3
-	and %g3, NWINDOWS - 1, %g3
-	wrpr %g3, 0, %cwp			! switch to the preceeding window
-
-	ba %xcc, 0b
-	inc %g4
-
-0:
-	/*
-	 * Switch back to the proper current window and adjust
-	 * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN.
-	 */
-	wrpr %g1, 0, %cwp
-	add %g4, %g2, %g2
-	cmp %g2, NWINDOWS - 2
-	bg %xcc, 2f				! fix the CANRESTORE=NWINDOWS-1 anomaly
-	mov NWINDOWS - 2, %g1			! use dealy slot for both cases
-	sub %g1, %g2, %g1
-
-	wrpr %g0, 0, %otherwin
-	wrpr %g1, 0, %cansave			! NWINDOWS - 2 - CANRESTORE
-	wrpr %g2, 0, %canrestore		! OTHERWIN + windows in the buffer
-	wrpr %g2, 0, %cleanwin			! avoid information leak
-
-1:
-	restore
-
-.if \is_syscall
-	done
-.else
-	retry
-.endif
-
-	/*
-	 * We got here in order to avoid inconsistency of the window state registers.
-	 * If the:
-	 *
-	 * 	save %g6, -ISTATE_SIZE, %sp
-	 *
-	 * instruction trapped and spilled a register window into the userspace
-	 * window buffer, we have just restored NWINDOWS - 1 register windows.
-	 * However, CANRESTORE can be only NWINDOW - 2 at most.
-	 *
-	 * The solution is to manually switch to (CWP - 1) mod NWINDOWS
-	 * and set the window state registers so that:
-	 *
-	 * 	CANRESTORE 	= NWINDOWS - 2
-	 *	CLEANWIN	= NWINDOWS - 2
-	 *	CANSAVE 	= 0
-	 *	OTHERWIN	= 0
-	 *
-	 * The RESTORE instruction is therfore to be skipped.
-	 */
-2:
-	wrpr %g0, 0, %otherwin
-	wrpr %g0, 0, %cansave
-	wrpr %g1, 0, %canrestore
-	wrpr %g1, 0, %cleanwin
-
-	rdpr %cwp, %g1
-	dec %g1
-	and %g1, NWINDOWS - 1, %g1
-	wrpr %g1, 0, %cwp			! CWP--
-
-.if \is_syscall
-	done
-.else
-	retry
-.endif
-
-.endm
-
-SYMBOL(preemptible_handler)
-	PREEMPTIBLE_HANDLER_TEMPLATE 0
-
-SYMBOL(trap_instruction_handler)
-	PREEMPTIBLE_HANDLER_TEMPLATE 1
Index: rnel/arch/sparc64/src/trap/sun4v/interrupt.c
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2009 Pavel Rimsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- */
-
-#include <arch/interrupt.h>
-#include <arch/trap/interrupt.h>
-#include <arch/sparc64.h>
-#include <interrupt.h>
-#include <ddi/irq.h>
-#include <stdint.h>
-#include <debug.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <log.h>
-#include <arch.h>
-#include <mm/tlb.h>
-#include <config.h>
-#include <synch/spinlock.h>
-#include <arch/sun4v/hypercall.h>
-
-/** number of uint64_t-s in one CPU mondo message */
-#define CPU_MONDO_ENTRY_SIZE	8
-
-/** number of entries (messages) in the CPU mondo queue */
-#define CPU_MONDO_NENTRIES	8
-
-/** number of uint64_t-s in the CPU mondo queue */
-#define CPU_MONDO_QUEUE_SIZE	((CPU_MONDO_NENTRIES) * (CPU_MONDO_ENTRY_SIZE))
-
-/** used to identify CPU mondo queue in the hypercall */
-#define CPU_MONDO_QUEUE_ID	0x3c
-
-/** ASI for reading/writing CPU mondo head/tail registers */
-#define ASI_QUEUE		0x25
-
-/** VA for reading the CPU mondo tail */
-#define VA_CPU_MONDO_QUEUE_TAIL	0x3c8
-
-/** VA for reading/writing the CPU mondo head */
-#define VA_CPU_MONDO_QUEUE_HEAD	0x3c0
-
-/**
- * array which contains CPU mondo queue for every CPU
- */
-uint64_t cpu_mondo_queues[MAX_NUM_STRANDS][CPU_MONDO_QUEUE_SIZE]
-    __attribute__((aligned(CPU_MONDO_QUEUE_SIZE * sizeof(uint64_t))));
-
-/**
- * Initializes CPU mondo queue for the current CPU.
- */
-void sun4v_ipi_init(void)
-{
-	if (__hypercall_fast3(
-	    CPU_QCONF,
-	    CPU_MONDO_QUEUE_ID,
-	    KA2PA(cpu_mondo_queues[CPU->id]),
-	    CPU_MONDO_NENTRIES) != HV_EOK)
-		panic("Initializing mondo queue failed on CPU %" PRIu64 ".\n",
-		    CPU->arch.id);
-}
-
-/**
- * Handler of the CPU Mondo trap. Reads the message queue, updates the head
- * register and processes the message (invokes a function call).
- */
-void cpu_mondo(unsigned int tt, istate_t *istate)
-{
-#ifdef CONFIG_SMP
-	unsigned int tail = asi_u64_read(ASI_QUEUE, VA_CPU_MONDO_QUEUE_TAIL);
-	unsigned int head = asi_u64_read(ASI_QUEUE, VA_CPU_MONDO_QUEUE_HEAD);
-
-	while (head != tail) {
-		uint64_t data1 = cpu_mondo_queues[CPU->id][0];
-
-		head = (head + CPU_MONDO_ENTRY_SIZE * sizeof(uint64_t)) %
-		    (CPU_MONDO_QUEUE_SIZE * sizeof(uint64_t));
-		asi_u64_write(ASI_QUEUE, VA_CPU_MONDO_QUEUE_HEAD, head);
-
-		if (data1 == (uintptr_t) tlb_shootdown_ipi_recv) {
-			((void (*)(void)) data1)();
-		} else {
-			log(LF_ARCH, LVL_DEBUG, "Spurious interrupt on %" PRIu64
-			    ", data = %" PRIx64 ".", CPU->arch.id, data1);
-		}
-	}
-#endif
-}
-
-/** @}
- */
Index: rnel/arch/sparc64/src/trap/sun4v/mmu.S
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/mmu.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-/**
- * @file
- * @brief	MMU trap handlers that do not fit into the trap table.
- */
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.text
-
-#include <abi/asmtool.h>
-#include <arch/trap/sun4v/mmu.h>
-#include <arch/trap/trap_table.h>
-#include <arch/sun4v/regdef.h>
-
-/*
- * Install mapping for the kernel. The mapping obeys this formula:
- * 	virtual address = real address + start of physical memory
- *
- * The routine expects the following values of registers:
- *	 %g1	virtual address that has caused the miss
- */
-SYMBOL(install_identity_mapping)
-	/* output registers mustn't be clobbered during the hypercall, SAVE is too risky */
-	mov %o0, %g3
-	mov %o1, %g4
-	mov %o2, %g5
-	mov %o3, %g6
-
-	/* install mapping for kernel */
-	mov %g1, %o0
-	set 0, %o1					! set context
-	setx kernel_8k_tlb_data_template, %g1, %g2	! g2 <= template of TTE Data
-	ldx [%g2], %g2					! read the TTE Data template
-	add %g2, %o0, %o2				! template + VA = TTE Data entry
-	set MMU_FLAG_DTLB, %o3				! map in DTLB only
-	ta MMU_MAP_ADDR
-
-	/* restore output registers */
-	mov %g6, %o3
-	mov %g5, %o2
-	mov %g4, %o1
-	mov %g3, %o0
-
-	retry
Index: rnel/arch/sparc64/src/trap/sun4v/trap_table.S
===================================================================
--- kernel/arch/sparc64/src/trap/sun4v/trap_table.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1109 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# Copyright (c) 2008 Pavel Rimsky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-/**
- * @file
- * @brief This file contains kernel trap table.
- */
-
-.register %g2, #scratch
-.register %g3, #scratch
-
-.text
-
-#include <abi/asmtool.h>
-#include <arch/trap/trap_table.h>
-#include <arch/trap/regwin.h>
-#include <arch/trap/interrupt.h>
-#include <arch/trap/exception.h>
-#include <arch/trap/syscall.h>
-#include <arch/trap/sun4v/mmu.h>
-#include <arch/mm/sun4v/mmu.h>
-#include <arch/mm/page.h>
-#include <arch/stack.h>
-#include <arch/sun4v/regdef.h>
-#include <arch/sun4v/arch.h>
-#include <arch/sun4v/cpu.h>
-
-#define TABLE_SIZE	TRAP_TABLE_SIZE
-#define ENTRY_SIZE	TRAP_TABLE_ENTRY_SIZE
-
-/*
- * Kernel trap table.
- */
-.align TABLE_SIZE
-SYMBOL(trap_table)
-
-/* TT = 0x08, TL = 0, instruction_access_exception */
-/* TT = 0x08, TL = 0, IAE_privilege_violation on UltraSPARC T2 */
-.org trap_table + TT_INSTRUCTION_ACCESS_EXCEPTION*ENTRY_SIZE
-SYMBOL(instruction_access_exception_tl0)
-	mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x09, TL = 0, instruction_access_mmu_miss */
-.org trap_table + TT_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(instruction_access_mmu_miss_handler_tl0)
-	ba,a %xcc, fast_instruction_access_mmu_miss_handler_tl0
-
-/* TT = 0x0a, TL = 0, instruction_access_error */
-.org trap_table + TT_INSTRUCTION_ACCESS_ERROR*ENTRY_SIZE
-SYMBOL(instruction_access_error_tl0)
-	mov TT_INSTRUCTION_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0b, TL = 0, IAE_unauth_access */
-.org trap_table + TT_IAE_UNAUTH_ACCESS*ENTRY_SIZE
-SYMBOL(iae_unauth_access_tl0)
-	mov TT_IAE_UNAUTH_ACCESS, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0c, TL = 0, IAE_nfo_page */
-.org trap_table + TT_IAE_NFO_PAGE*ENTRY_SIZE
-SYMBOL(iae_nfo_page_tl0)
-	mov TT_IAE_NFO_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x10, TL = 0, illegal_instruction */
-.org trap_table + TT_ILLEGAL_INSTRUCTION*ENTRY_SIZE
-SYMBOL(illegal_instruction_tl0)
-	mov TT_ILLEGAL_INSTRUCTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x11, TL = 0, privileged_opcode */
-.org trap_table + TT_PRIVILEGED_OPCODE*ENTRY_SIZE
-SYMBOL(privileged_opcode_tl0)
-	mov TT_PRIVILEGED_OPCODE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x12, TL = 0, unimplemented_LDD */
-.org trap_table + TT_UNIMPLEMENTED_LDD*ENTRY_SIZE
-SYMBOL(unimplemented_LDD_tl0)
-	mov TT_UNIMPLEMENTED_LDD, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x13, TL = 0, unimplemented_STD */
-.org trap_table + TT_UNIMPLEMENTED_STD*ENTRY_SIZE
-SYMBOL(unimplemented_STD_tl0)
-	mov TT_UNIMPLEMENTED_STD, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x14, TL = 0, DAE_invalid_asi */
-.org trap_table + TT_DAE_INVALID_ASI*ENTRY_SIZE
-SYMBOL(dae_invalid_asi_tl0)
-	mov TT_DAE_INVALID_ASI, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x15, TL = 0, DAE_privilege_violation */
-.org trap_table + TT_DAE_PRIVILEGE_VIOLATION*ENTRY_SIZE
-SYMBOL(dae_privilege_violation_tl0)
-	mov TT_DAE_PRIVILEGE_VIOLATION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x16, TL = 0, DAE_nc_page */
-.org trap_table + TT_DAE_NC_PAGE*ENTRY_SIZE
-SYMBOL(dae_nc_page_tl0)
-	mov TT_DAE_NC_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x17, TL = 0, DAE_nfo_page */
-.org trap_table + TT_DAE_NFO_PAGE*ENTRY_SIZE
-SYMBOL(dae_nfo_page_tl0)
-	mov TT_DAE_NFO_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x20, TL = 0, fb_disabled handler */
-.org trap_table + TT_FP_DISABLED*ENTRY_SIZE
-SYMBOL(fp_disabled_tl0)
-	mov TT_FP_DISABLED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x21, TL = 0, fb_exception_ieee_754 handler */
-.org trap_table + TT_FP_EXCEPTION_IEEE_754*ENTRY_SIZE
-SYMBOL(fp_exception_ieee_754_tl0)
-	mov TT_FP_EXCEPTION_IEEE_754, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x22, TL = 0, fb_exception_other handler */
-.org trap_table + TT_FP_EXCEPTION_OTHER*ENTRY_SIZE
-SYMBOL(fp_exception_other_tl)
-	mov TT_FP_EXCEPTION_OTHER, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x23, TL = 0, tag_overflow */
-.org trap_table + TT_TAG_OVERFLOW*ENTRY_SIZE
-SYMBOL(tag_overflow_tl0)
-	mov TT_TAG_OVERFLOW, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x24, TL = 0, clean_window handler */
-.org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE
-SYMBOL(clean_window_tl0)
-	CLEAN_WINDOW_HANDLER
-
-/* TT = 0x28, TL = 0, division_by_zero */
-.org trap_table + TT_DIVISION_BY_ZERO*ENTRY_SIZE
-SYMBOL(division_by_zero_tl0)
-	mov TT_DIVISION_BY_ZERO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x30, TL = 0, data_access_exception */
-/* TT = 0x30, TL = 0, DAE_side_effect_page for UltraPSARC T2 */
-.org trap_table + TT_DATA_ACCESS_EXCEPTION*ENTRY_SIZE
-SYMBOL(data_access_exception_tl0)
-	mov TT_DATA_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x31, TL = 0, data_access_mmu_miss */
-.org trap_table + TT_DATA_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(data_access_mmu_miss_tl0)
-	ba,a %xcc, fast_data_access_mmu_miss_handler_tl0
-
-/* TT = 0x32, TL = 0, data_access_error */
-.org trap_table + TT_DATA_ACCESS_ERROR*ENTRY_SIZE
-SYMBOL(data_access_error_tl0)
-	mov TT_DATA_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x34, TL = 0, mem_address_not_aligned */
-.org trap_table + TT_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(mem_address_not_aligned_tl0)
-	mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x35, TL = 0, LDDF_mem_address_not_aligned */
-.org trap_table + TT_LDDF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(LDDF_mem_address_not_aligned_tl0)
-	mov TT_LDDF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x36, TL = 0, STDF_mem_address_not_aligned */
-.org trap_table + TT_STDF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(STDF_mem_address_not_aligned_tl0)
-	mov TT_STDF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x37, TL = 0, privileged_action */
-.org trap_table + TT_PRIVILEGED_ACTION*ENTRY_SIZE
-SYMBOL(privileged_action_tl0)
-	mov TT_PRIVILEGED_ACTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x38, TL = 0, LDQF_mem_address_not_aligned */
-.org trap_table + TT_LDQF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(LDQF_mem_address_not_aligned_tl0)
-	mov TT_LDQF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x39, TL = 0, STQF_mem_address_not_aligned */
-.org trap_table + TT_STQF_MEM_ADDRESS_NOT_ALIGNED*ENTRY_SIZE
-SYMBOL(STQF_mem_address_not_aligned_tl0)
-	mov TT_STQF_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x41, TL = 0, interrupt_level_1 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_1*ENTRY_SIZE
-SYMBOL(interrupt_level_1_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_1, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x42, TL = 0, interrupt_level_2 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_2*ENTRY_SIZE
-SYMBOL(interrupt_level_2_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_2, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x43, TL = 0, interrupt_level_3 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_3*ENTRY_SIZE
-SYMBOL(interrupt_level_3_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_3, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x44, TL = 0, interrupt_level_4 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_4*ENTRY_SIZE
-SYMBOL(interrupt_level_4_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_4, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x45, TL = 0, interrupt_level_5 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_5*ENTRY_SIZE
-SYMBOL(interrupt_level_5_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_5, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x46, TL = 0, interrupt_level_6 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_6*ENTRY_SIZE
-SYMBOL(interrupt_level_6_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_6, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x47, TL = 0, interrupt_level_7 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_7*ENTRY_SIZE
-SYMBOL(interrupt_level_7_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_7, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x48, TL = 0, interrupt_level_8 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_8*ENTRY_SIZE
-SYMBOL(interrupt_level_8_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_8, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x49, TL = 0, interrupt_level_9 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_9*ENTRY_SIZE
-SYMBOL(interrupt_level_9_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_9, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4a, TL = 0, interrupt_level_10 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_10*ENTRY_SIZE
-SYMBOL(interrupt_level_10_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_10, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4b, TL = 0, interrupt_level_11 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_11*ENTRY_SIZE
-SYMBOL(interrupt_level_11_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_11, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4c, TL = 0, interrupt_level_12 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_12*ENTRY_SIZE
-SYMBOL(interrupt_level_12_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_12, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4d, TL = 0, interrupt_level_13 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_13*ENTRY_SIZE
-SYMBOL(interrupt_level_13_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_13, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4e, TL = 0, interrupt_level_14 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_14*ENTRY_SIZE
-SYMBOL(interrupt_level_14_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_14, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x4f, TL = 0, interrupt_level_15 handler */
-.org trap_table + TT_INTERRUPT_LEVEL_15*ENTRY_SIZE
-SYMBOL(interrupt_level_15_handler_tl0)
-	mov TT_INTERRUPT_LEVEL_15, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x64, TL = 0, fast_instruction_access_MMU_miss */
-.org trap_table + TT_FAST_INSTRUCTION_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(fast_instruction_access_mmu_miss_handler_tl0)
-	FAST_INSTRUCTION_ACCESS_MMU_MISS_HANDLER
-
-/* TT = 0x68, TL = 0, fast_data_access_MMU_miss */
-.org trap_table + TT_FAST_DATA_ACCESS_MMU_MISS*ENTRY_SIZE
-SYMBOL(fast_data_access_mmu_miss_handler_tl0)
-	FAST_DATA_ACCESS_MMU_MISS_HANDLER 0
-
-/* TT = 0x6c, TL = 0, fast_data_access_protection */
-.org trap_table + TT_FAST_DATA_ACCESS_PROTECTION*ENTRY_SIZE
-SYMBOL(fast_data_access_protection_handler_tl0)
-	FAST_DATA_ACCESS_PROTECTION_HANDLER 0
-
-/* TT = 0x7c, TL = 0, cpu_mondo */
-.org trap_table + TT_CPU_MONDO*ENTRY_SIZE
-SYMBOL(cpu_mondo_handler_tl0)
-	mov TT_CPU_MONDO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x80, TL = 0, spill_0_normal handler */
-.org trap_table + TT_SPILL_0_NORMAL*ENTRY_SIZE
-SYMBOL(spill_0_normal_tl0)
-	SPILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0x84, TL = 0, spill_1_normal handler */
-.org trap_table + TT_SPILL_1_NORMAL*ENTRY_SIZE
-SYMBOL(spill_1_normal_tl0)
-	SPILL_NORMAL_HANDLER_USERSPACE
-
-/* TT = 0x88, TL = 0, spill_2_normal handler */
-.org trap_table + TT_SPILL_2_NORMAL*ENTRY_SIZE
-SYMBOL(spill_2_normal_tl0)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xa0, TL = 0, spill_0_other handler */
-.org trap_table + TT_SPILL_0_OTHER*ENTRY_SIZE
-SYMBOL(spill_0_other_tl0)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xc0, TL = 0, fill_0_normal handler */
-.org trap_table + TT_FILL_0_NORMAL*ENTRY_SIZE
-SYMBOL(fill_0_normal_tl0)
-	FILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0xc4, TL = 0, fill_1_normal handler */
-.org trap_table + TT_FILL_1_NORMAL*ENTRY_SIZE
-SYMBOL(fill_1_normal_tl0)
-	FILL_NORMAL_HANDLER_USERSPACE
-
-/* TT = 0x100 - 0x17f, TL = 0, trap_instruction_0 - trap_instruction_7f */
-.irp cur, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,\
-    20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,\
-    39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,\
-    58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,\
-    77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,\
-    96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,\
-    112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,\
-    127
-.org trap_table + (TT_TRAP_INSTRUCTION_0+\cur)*ENTRY_SIZE
-SYMBOL(trap_instruction_\cur\()_tl0)
-	mov \cur, %g2
-	ba %xcc, trap_instruction_handler
-	clr %g5
-.endr
-
-/*
- * Handlers for TL>0.
- */
-
-/* TT = 0x08, TL > 0, instruction_access_exception */
-/* TT = 0x08, TL > 0, IAE_privilege_violation on UltraSPARC T2 */
-.org trap_table + (TT_INSTRUCTION_ACCESS_EXCEPTION+512)*ENTRY_SIZE
-SYMBOL(instruction_access_exception_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_INSTRUCTION_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x09, TL > 0, instruction_access_mmu_miss */
-.org trap_table + (TT_INSTRUCTION_ACCESS_MMU_MISS+512)*ENTRY_SIZE
-SYMBOL(instruction_access_mmu_miss_handler_tl1)
-	wrpr %g0, 1, %tl
-	ba,a %xcc, fast_instruction_access_mmu_miss_handler_tl0
-
-/* TT = 0x0a, TL > 0, instruction_access_error */
-.org trap_table + (TT_INSTRUCTION_ACCESS_ERROR+512)*ENTRY_SIZE
-SYMBOL(instruction_access_error_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_INSTRUCTION_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0b, TL > 0, IAE_unauth_access */
-.org trap_table + (TT_IAE_UNAUTH_ACCESS+512)*ENTRY_SIZE
-SYMBOL(iae_unauth_access_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_IAE_UNAUTH_ACCESS, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x0c, TL > 0, IAE_nfo_page */
-.org trap_table + (TT_IAE_NFO_PAGE+512)*ENTRY_SIZE
-SYMBOL(iae_nfo_page_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_IAE_NFO_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x10, TL > 0, illegal_instruction */
-.org trap_table + (TT_ILLEGAL_INSTRUCTION+512)*ENTRY_SIZE
-SYMBOL(illegal_instruction_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_ILLEGAL_INSTRUCTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x14, TL > 0, DAE_invalid_asi */
-.org trap_table + (TT_DAE_INVALID_ASI+512)*ENTRY_SIZE
-SYMBOL(dae_invalid_asi_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DAE_INVALID_ASI, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x15, TL > 0, DAE_privilege_violation */
-.org trap_table + (TT_DAE_PRIVILEGE_VIOLATION+512)*ENTRY_SIZE
-SYMBOL(dae_privilege_violation_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DAE_PRIVILEGE_VIOLATION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x16, TL > 0, DAE_nc_page */
-.org trap_table + (TT_DAE_NC_PAGE+512)*ENTRY_SIZE
-SYMBOL(dae_nc_page_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DAE_NC_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x17, TL > 0, DAE_nfo_page */
-.org trap_table + (TT_DAE_NFO_PAGE+512)*ENTRY_SIZE
-SYMBOL(dae_nfo_page_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DAE_NFO_PAGE, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x24, TL > 0, clean_window handler */
-.org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE
-SYMBOL(clean_window_tl1)
-	CLEAN_WINDOW_HANDLER
-
-/* TT = 0x28, TL > 0, division_by_zero */
-.org trap_table + (TT_DIVISION_BY_ZERO+512)*ENTRY_SIZE
-SYMBOL(division_by_zero_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DIVISION_BY_ZERO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x30, TL > 0, data_access_exception */
-.org trap_table + (TT_DATA_ACCESS_EXCEPTION+512)*ENTRY_SIZE
-SYMBOL(data_access_exception_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DATA_ACCESS_EXCEPTION, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x31, TL > 0, data_access_mmu_miss */
-.org trap_table + (TT_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE
-SYMBOL(data_access_mmu_miss_tl1)
-	ba,a %xcc, fast_data_access_mmu_miss_handler_tl1
-
-/* TT = 0x32, TL > 0, data_access_error */
-.org trap_table + (TT_DATA_ACCESS_ERROR+512)*ENTRY_SIZE
-SYMBOL(data_access_error_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_DATA_ACCESS_ERROR, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x34, TL > 0, mem_address_not_aligned */
-.org trap_table + (TT_MEM_ADDRESS_NOT_ALIGNED+512)*ENTRY_SIZE
-SYMBOL(mem_address_not_aligned_tl1)
-	wrpr %g0, 1, %tl
-	mov TT_MEM_ADDRESS_NOT_ALIGNED, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x68, TL > 0, fast_data_access_MMU_miss */
-.org trap_table + (TT_FAST_DATA_ACCESS_MMU_MISS+512)*ENTRY_SIZE
-SYMBOL(fast_data_access_mmu_miss_handler_tl1)
-	FAST_DATA_ACCESS_MMU_MISS_HANDLER 1
-
-/* TT = 0x6c, TL > 0, fast_data_access_protection */
-.org trap_table + (TT_FAST_DATA_ACCESS_PROTECTION+512)*ENTRY_SIZE
-SYMBOL(fast_data_access_protection_handler_tl1)
-	FAST_DATA_ACCESS_PROTECTION_HANDLER 1
-
-/* TT = 0x7c, TL > 0, cpu_mondo */
-.org trap_table + (TT_CPU_MONDO+512)*ENTRY_SIZE
-SYMBOL(cpu_mondo_handler_tl1)
-	wrpr %g0, %tl
-	mov TT_CPU_MONDO, %g2
-	clr %g5
-	PREEMPTIBLE_HANDLER exc_dispatch
-
-/* TT = 0x80, TL > 0, spill_0_normal handler */
-.org trap_table + (TT_SPILL_0_NORMAL+512)*ENTRY_SIZE
-SYMBOL(spill_0_normal_tl1)
-	SPILL_NORMAL_HANDLER_KERNEL
-
-/* TT = 0x88, TL > 0, spill_2_normal handler */
-.org trap_table + (TT_SPILL_2_NORMAL+512)*ENTRY_SIZE
-SYMBOL(spill_2_normal_tl1)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xa0, TL > 0, spill_0_other handler */
-.org trap_table + (TT_SPILL_0_OTHER+512)*ENTRY_SIZE
-SYMBOL(spill_0_other_tl1)
-	SPILL_TO_USPACE_WINDOW_BUFFER
-
-/* TT = 0xc0, TL > 0, fill_0_normal handler */
-.org trap_table + (TT_FILL_0_NORMAL+512)*ENTRY_SIZE
-SYMBOL(fill_0_normal_tl1)
-	FILL_NORMAL_HANDLER_KERNEL
-
-.align TABLE_SIZE
-
-
-/*
- * Spills the window at CWP + 2 to the kernel stack. This macro is to be
- * used before doing SAVE when the spill trap is undesirable.
- *
- * Parameters:
- * 	tmpreg1		global register to be used for scratching purposes
- * 	tmpreg2		global register to be used for scratching purposes
- */
-.macro INLINE_SPILL tmpreg1, tmpreg2
-	! CWP := CWP + 2
-	rdpr %cwp, \tmpreg2
-	add \tmpreg2, 2, \tmpreg1
-	and \tmpreg1, NWINDOWS - 1, \tmpreg1		! modulo NWINDOWS
-	wrpr \tmpreg1, %cwp
-
-	! spill to kernel stack
-	stx %l0, [%sp + STACK_BIAS + L0_OFFSET]
-	stx %l1, [%sp + STACK_BIAS + L1_OFFSET]
-	stx %l2, [%sp + STACK_BIAS + L2_OFFSET]
-	stx %l3, [%sp + STACK_BIAS + L3_OFFSET]
-	stx %l4, [%sp + STACK_BIAS + L4_OFFSET]
-	stx %l5, [%sp + STACK_BIAS + L5_OFFSET]
-	stx %l6, [%sp + STACK_BIAS + L6_OFFSET]
-	stx %l7, [%sp + STACK_BIAS + L7_OFFSET]
-	stx %i0, [%sp + STACK_BIAS + I0_OFFSET]
-	stx %i1, [%sp + STACK_BIAS + I1_OFFSET]
-	stx %i2, [%sp + STACK_BIAS + I2_OFFSET]
-	stx %i3, [%sp + STACK_BIAS + I3_OFFSET]
-	stx %i4, [%sp + STACK_BIAS + I4_OFFSET]
-	stx %i5, [%sp + STACK_BIAS + I5_OFFSET]
-	stx %i6, [%sp + STACK_BIAS + I6_OFFSET]
-	stx %i7, [%sp + STACK_BIAS + I7_OFFSET]
-
-	! CWP := CWP - 2
-	wrpr \tmpreg2, %cwp
-
-	saved
-.endm
-
-/*
- * Fill the window at CWP - 1 from the kernel stack. This macro is to be
- * used before doing RESTORE when the fill trap is undesirable.
- *
- * Parameters:
- * 	tmpreg1		global register to be used for scratching purposes
- * 	tmpreg2		global register to be used for scratching purposes
- */
-.macro INLINE_FILL tmpreg1, tmpreg2
-	! CWP := CWP - 1
-	rdpr %cwp, \tmpreg2
-	add \tmpreg2, NWINDOWS - 1, \tmpreg1
-	and \tmpreg1, NWINDOWS - 1, \tmpreg1
-	wrpr \tmpreg1, %cwp
-
-	! fill from kernel stack
-	ldx [%sp + STACK_BIAS + L0_OFFSET], %l0
-	ldx [%sp + STACK_BIAS + L1_OFFSET], %l1
-	ldx [%sp + STACK_BIAS + L2_OFFSET], %l2
-	ldx [%sp + STACK_BIAS + L3_OFFSET], %l3
-	ldx [%sp + STACK_BIAS + L4_OFFSET], %l4
-	ldx [%sp + STACK_BIAS + L5_OFFSET], %l5
-	ldx [%sp + STACK_BIAS + L6_OFFSET], %l6
-	ldx [%sp + STACK_BIAS + L7_OFFSET], %l7
-	ldx [%sp + STACK_BIAS + I0_OFFSET], %i0
-	ldx [%sp + STACK_BIAS + I1_OFFSET], %i1
-	ldx [%sp + STACK_BIAS + I2_OFFSET], %i2
-	ldx [%sp + STACK_BIAS + I3_OFFSET], %i3
-	ldx [%sp + STACK_BIAS + I4_OFFSET], %i4
-	ldx [%sp + STACK_BIAS + I5_OFFSET], %i5
-	ldx [%sp + STACK_BIAS + I6_OFFSET], %i6
-	ldx [%sp + STACK_BIAS + I7_OFFSET], %i7
-
-	! CWP := CWP + 1
-	wrpr \tmpreg2, %cwp
-
-	restored
-.endm
-
-#define NOT(x)	((x) == 0)
-
-/*
- * Perform all the actions of the preemptible trap handler which are common
- * for trapping from kernel and trapping from userspace, including call of the
- * higher level service routine.
- *
- * Important note:
- * 	This macro must be inserted between the "2:" and "4:" labels. The
- *	inserting code must be aware of the usage of all the registers
- *	contained in this macro.
- */
-.macro MIDDLE_PART is_syscall
-	/* copy higher level routine's address and its argument */
-	mov %g1, %l0
-.if NOT(\is_syscall)
-	mov %g2, %o0
-.else
-	! store the syscall number on the stack as 7th argument
-	stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_ARG6]
-.endif
-
-	/*
-	 * Save TSTATE, TPC and TNPC aside.
-	 */
-	rdpr %tstate, %g1
-	rdpr %tpc, %g2
-	rdpr %tnpc, %g3
-
-	stx %g1, [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE]
-	stx %g2, [%sp + STACK_BIAS + ISTATE_OFFSET_TPC]
-	stx %g3, [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC]
-
-	/*
-	 * Save the Y register.
-	 */
-	rd %y, %g4
-	stx %g4, [%sp + STACK_BIAS + ISTATE_OFFSET_Y]
-
-	/*
-	 * Save the faulting page and context.
-	 */
-	stx %g5, [%sp + STACK_BIAS + ISTATE_OFFSET_TLB_TAG_ACCESS]
-
-	/* switch to TL = 0, explicitly enable FPU */
-	wrpr %g0, 0, %tl
-	wrpr %g0, 0, %gl
-	wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate
-
-	/* g1 -> l1, ..., g7 -> l7 */
-	SAVE_GLOBALS
-
-.if NOT(\is_syscall)
-	/* call higher-level service routine, pass istate as its 2nd parameter */
-	call %l0
-	add %sp, STACK_BIAS, %o1
-.else
-	/* Call the higher-level syscall handler. */
-	!wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT | PSTATE_IE_BIT, %pstate
-	call syscall_handler
-	nop
-	/* copy the value returned by the syscall */
-	mov %o0, %i0
-.endif
-
-	/* l1 -> g1, ..., l7 -> g7 */
-	RESTORE_GLOBALS
-
-	/* we must prserve the PEF bit */
-	rdpr %pstate, %l1
-
-	/* TL := 1, GL := 1 */
-	wrpr %g0, PSTATE_PRIV_BIT, %pstate
-	wrpr %g0, 1, %tl
-	wrpr %g0, 1, %gl
-
-	/* Read TSTATE, TPC and TNPC from saved copy. */
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TSTATE], %g1
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TPC], %g2
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_TNPC], %g3
-
-	/* Copy PSTATE.PEF to the in-register copy of TSTATE. */
-	and %l1, PSTATE_PEF_BIT, %l1
-	sllx %l1, TSTATE_PSTATE_SHIFT, %l1
-	sethi %hi(TSTATE_PEF_BIT), %g4		! reset the PEF bit to 0 ...
-	andn %g1, %g4, %g1
-	or %g1, %l1, %g1			! ... "or" it with saved PEF
-
-	/* Restore TSTATE, TPC and TNPC from saved copies. */
-	wrpr %g1, 0, %tstate
-	wrpr %g2, 0, %tpc
-	wrpr %g3, 0, %tnpc
-
-	/* Restore Y. */
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_Y], %g4
-	wr %g4, %y
-
-	/* If TSTATE.CWP + 1 == CWP, then we do not have to fix CWP. */
-	and %g1, TSTATE_CWP_MASK, %l0
-	inc %l0
-	and %l0, NWINDOWS - 1, %l0	! %l0 mod NWINDOWS
-	rdpr %cwp, %l1
-	cmp %l0, %l1
-	bz %xcc, 4f			! CWP is ok
-	nop
-
-3:
-	/*
-	 * Fix CWP.
-	 * In order to recapitulate, the input registers in the current
-	 * window are the output registers of the window to which we want
-	 * to restore. Because the fill trap fills only input and local
-	 * registers of a window, we need to preserve those output
-	 * registers manually.
-	 */
-	mov %sp, %g2
-	stx %i0, [%sp + STACK_BIAS + ISTATE_OFFSET_O0]
-	stx %i1, [%sp + STACK_BIAS + ISTATE_OFFSET_O1]
-	stx %i2, [%sp + STACK_BIAS + ISTATE_OFFSET_O2]
-	stx %i3, [%sp + STACK_BIAS + ISTATE_OFFSET_O3]
-	stx %i4, [%sp + STACK_BIAS + ISTATE_OFFSET_O4]
-	stx %i5, [%sp + STACK_BIAS + ISTATE_OFFSET_O5]
-	stx %i6, [%sp + STACK_BIAS + ISTATE_OFFSET_O6]
-	stx %i7, [%sp + STACK_BIAS + ISTATE_OFFSET_O7]
-	wrpr %l0, 0, %cwp
-	mov %g2, %sp
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O0], %i0
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O1], %i1
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O2], %i2
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O3], %i3
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O4], %i4
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O5], %i5
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O6], %i6
-	ldx [%sp + STACK_BIAS + ISTATE_OFFSET_O7], %i7
-.endm
-
-/*
- * Preemptible trap handler for handling traps from kernel.
- */
-.macro PREEMPTIBLE_HANDLER_KERNEL
-	/* prevent unnecessary CLEANWIN exceptions */
-	wrpr %g0, NWINDOWS - 1, %cleanwin
-
-	/*
-	 * Prevent SAVE instruction from causing a spill exception. If the
-	 * CANSAVE register is zero, explicitly spill register window
-	 * at CWP + 2.
-	 */
-
-	rdpr %cansave, %g3
-	brnz %g3, 2f
-	nop
-	rdpr %otherwin, %g4
-	brnz %g4, 1f
-	nop
-
-	/* OTHERWIN is zero, we are spilling a kernel window. */
-	INLINE_SPILL %g3, %g4
-	ba,a %xcc, 2f
-
-1:
-	/* OTHERWIN is non-zero, we are spilling a uspace window. */
-	INLINE_SPILL_TO_WBUF %g3, %g4, %g7
-
-2:
-	/* ask for new register window */
-	save %sp, -ISTATE_SIZE, %sp
-
-	MIDDLE_PART 0
-
-4:
-	/*
-	 * Prevent RESTORE instruction from causing a fill exception. If the
-	 * CANRESTORE register is zero, explicitly fill register window
-	 * at CWP - 1.
-	 */
-	rdpr %canrestore, %g1
-	brnz %g1, 5f
-	nop
-	INLINE_FILL %g3, %g4
-
-5:
-	restore
-	retry
-.endm
-
-/*
- * Spills the window at CWP + 2 to the userspace window buffer. This macro
- * is to be used before doing SAVE when the spill trap is undesirable.
- *
- * Parameters:
- * 	tmpreg1		global register to be used for scratching purposes
- * 	tmpreg2		global register to be used for scratching purposes
- * 	tmpreg3		global register to be used for scratching purposes
- */
-.macro INLINE_SPILL_TO_WBUF tmpreg1, tmpreg2, tmpreg3
-	! CWP := CWP + 2
-	rdpr %cwp, \tmpreg2
-	add \tmpreg2, 2, \tmpreg1
-	and \tmpreg1, NWINDOWS - 1, \tmpreg1		! modulo NWINDOWS
-	wrpr \tmpreg1, %cwp
-
-	! spill to userspace window buffer
-	SAVE_TO_USPACE_WBUF \tmpreg3, \tmpreg1
-
-	! CWP := CWP - 2
-	wrpr \tmpreg2, %cwp
-
-	saved
-.endm
-
-/*
- * Preemptible handler for handling traps from userspace.
- */
-.macro PREEMPTIBLE_HANDLER_USPACE is_syscall
-	/*
-	 * One of the ways this handler can be invoked is after a nested MMU trap from
-	 * either spill_1_normal or fill_1_normal traps. Both of these traps manipulate
-	 * the CWP register. We deal with the situation by simulating the MMU trap
-	 * on TL=1 and restart the respective SAVE or RESTORE instruction once the MMU
-	 * trap is resolved. However, because we are in the wrong window from the
-	 * perspective of the MMU trap, we need to synchronize CWP with CWP from TL=0.
-	 */
-.if NOT(\is_syscall)
-	rdpr %tstate, %g3
-	and %g3, TSTATE_CWP_MASK, %g4
-	wrpr %g4, 0, %cwp			! resynchronize CWP
-.endif
-
-	/* prevent unnecessary CLEANWIN exceptions */
-	wrpr %g0, NWINDOWS - 1, %cleanwin
-
-	/*
-	 * Prevent SAVE instruction from causing a spill exception. If the
-	 * CANSAVE register is zero, explicitly spill register window
-	 * at CWP + 2.
-	 */
-	rdpr %cansave, %g3
-	brnz %g3, 2f
-	nop
-	INLINE_SPILL_TO_WBUF %g3, %g4, %g7
-
-2:
-	set SCRATCHPAD_KSTACK, %g4
-	ldxa [%g4] ASI_SCRATCHPAD, %g6
-	save %g6, -ISTATE_SIZE, %sp
-
-.if \is_syscall
-	/* Copy arguments for the syscall to the new window. */
-	mov %i0, %o0
-	mov %i1, %o1
-	mov %i2, %o2
-	mov %i3, %o3
-	mov %i4, %o4
-	mov %i5, %o5
-.endif
-
-	mov VA_PRIMARY_CONTEXT_REG, %l0
-	stxa %g0, [%l0] ASI_PRIMARY_CONTEXT_REG
-	rd %pc, %l0
-	flush %l0
-
-	/* Mark the CANRESTORE windows as OTHER windows. */
-	rdpr %canrestore, %l0
-	wrpr %l0, %otherwin
-	wrpr %g0, %canrestore
-
-	/*
-	 * Other window spills will go to the userspace window buffer
-	 * and normal spills will go to the kernel stack.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(0), %wstate
-
-	MIDDLE_PART \is_syscall
-
-4:
-	/*
-	 * Spills and fills will be processed by the {spill,fill}_1_normal
-	 * handlers.
-	 */
-	wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate
-
-	/*
-	 * Set primary context according to secondary context.
-	 */
-	wr %g0, ASI_SECONDARY_CONTEXT_REG, %asi
-	ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1
-	wr %g0, ASI_PRIMARY_CONTEXT_REG, %asi
-	stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi
-	rd %pc, %g1
-	flush %g1
-
-	/* Restoring userspace windows: */
-
-	/* Save address of the userspace window buffer to the %g7 register. */
-	set SCRATCHPAD_WBUF, %g5
-	ldxa [%g5] ASI_SCRATCHPAD, %g7
-
-	rdpr %cwp, %g1
-	rdpr %otherwin, %g2
-
-	/*
-	 * Skip all OTHERWIN windows and descend to the first window
-	 * in the userspace window buffer.
-	 */
-	sub %g1, %g2, %g3
-	dec %g3
-	and %g3, NWINDOWS - 1, %g3
-	wrpr %g3, 0, %cwp
-
-	/*
-	 * CWP is now in the window last saved in the userspace window buffer.
-	 * Fill all windows stored in the buffer.
-	 */
-	clr %g4
-5:	andcc %g7, UWB_ALIGNMENT - 1, %g0	! alignment check
-	bz %xcc, 6f				! %g7 is UWB_ALIGNMENT-aligned, no more windows to refill
-	nop
-
-	add %g7, -STACK_WINDOW_SAVE_AREA_SIZE, %g7
-	ldx [%g7 + L0_OFFSET], %l0
-	ldx [%g7 + L1_OFFSET], %l1
-	ldx [%g7 + L2_OFFSET], %l2
-	ldx [%g7 + L3_OFFSET], %l3
-	ldx [%g7 + L4_OFFSET], %l4
-	ldx [%g7 + L5_OFFSET], %l5
-	ldx [%g7 + L6_OFFSET], %l6
-	ldx [%g7 + L7_OFFSET], %l7
-	ldx [%g7 + I0_OFFSET], %i0
-	ldx [%g7 + I1_OFFSET], %i1
-	ldx [%g7 + I2_OFFSET], %i2
-	ldx [%g7 + I3_OFFSET], %i3
-	ldx [%g7 + I4_OFFSET], %i4
-	ldx [%g7 + I5_OFFSET], %i5
-	ldx [%g7 + I6_OFFSET], %i6
-	ldx [%g7 + I7_OFFSET], %i7
-
-	dec %g3
-	and %g3, NWINDOWS - 1, %g3
-	wrpr %g3, 0, %cwp			! switch to the preceeding window
-
-	ba %xcc, 5b
-	inc %g4
-
-6:
-	/* Save changes of the address of the userspace window buffer. */
-	stxa %g7, [%g5] ASI_SCRATCHPAD
-
-	/*
-	 * Switch back to the proper current window and adjust
-	 * OTHERWIN, CANRESTORE, CANSAVE and CLEANWIN.
-	 */
-	wrpr %g1, 0, %cwp
-	add %g4, %g2, %g2
-	cmp %g2, NWINDOWS - 2
-	bg %xcc, 8f				! fix the CANRESTORE=NWINDOWS-1 anomaly
-	mov NWINDOWS - 2, %g1			! use dealy slot for both cases
-	sub %g1, %g2, %g1
-
-	wrpr %g0, 0, %otherwin
-	wrpr %g1, 0, %cansave			! NWINDOWS - 2 - CANRESTORE
-	wrpr %g2, 0, %canrestore		! OTHERWIN + windows in the buffer
-	wrpr %g2, 0, %cleanwin			! avoid information leak
-
-7:
-	restore
-
-.if \is_syscall
-	done
-.else
-	retry
-.endif
-
-8:
-	/*
-	 * We got here in order to avoid inconsistency of the window state registers.
-	 * If the:
-	 *
-	 * 	save %g6, -ISTATE_SIZE, %sp
-	 *
-	 * instruction trapped and spilled a register window into the userspace
-	 * window buffer, we have just restored NWINDOWS - 1 register windows.
-	 * However, CANRESTORE can be only NWINDOW - 2 at most.
-	 *
-	 * The solution is to manually switch to (CWP - 1) mod NWINDOWS
-	 * and set the window state registers so that:
-	 *
-	 * 	CANRESTORE 	= NWINDOWS - 2
-	 *	CLEANWIN	= NWINDOWS - 2
-	 *	CANSAVE 	= 0
-	 *	OTHERWIN	= 0
-	 *
-	 * The RESTORE instruction is therfore to be skipped.
-	 */
-	wrpr %g0, 0, %otherwin
-	wrpr %g0, 0, %cansave
-	wrpr %g1, 0, %canrestore
-	wrpr %g1, 0, %cleanwin
-
-	rdpr %cwp, %g1
-	dec %g1
-	and %g1, NWINDOWS - 1, %g1
-	wrpr %g1, 0, %cwp			! CWP--
-
-.if \is_syscall
-	done
-.else
-	retry
-.endif
-
-.endm
-
-/* Preemptible trap handler for TL=1.
- *
- * This trap handler makes arrangements to make calling of scheduler() from
- * within a trap context possible. It is called from several other trap
- * handlers.
- */
-.macro PREEMPTIBLE_HANDLER_TEMPLATE is_syscall
-	rdpr %tstate, %g3
-	and %g3, TSTATE_PRIV_BIT, %g3
-	brz %g3, 100f			! trapping from userspace
-	nop
-
-	PREEMPTIBLE_HANDLER_KERNEL
-	ba,a %xcc, 101f
-
-	100:
-	PREEMPTIBLE_HANDLER_USPACE \is_syscall
-
-	101:
-.endm
-
-SYMBOL(preemptible_handler)
-	PREEMPTIBLE_HANDLER_TEMPLATE 0
-
-SYMBOL(trap_instruction_handler)
-	PREEMPTIBLE_HANDLER_TEMPLATE 1
Index: rnel/arch/sparc64/src/trap/trap.c
===================================================================
--- kernel/arch/sparc64/src/trap/trap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sparc64_interrupt
- * @{
- */
-/** @file
- *
- */
-
-#include <arch/trap/trap.h>
-
-/** Initialize trap table. */
-void trap_init(void)
-{
-}
-
-/** @}
- */
Index: rnel/doc/doxygroups.h
===================================================================
--- kernel/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,512 +1,0 @@
-/* Definitions of modules and its relations for generating Doxygen documentation */
-
-/** @defgroup kernel kernel
- * @brief HelenOS kernel
- */
-
-/** @defgroup kernel_generic_adt Data types
- * @ingroup kernel
- */
-
-/** @defgroup kernel_generic_console Kernel console
- * @ingroup others
- */
-
-/** @defgroup kernel_time Time management
- * @ingroup kernel
- */
-
-/** @defgroup proc Scheduling
- * @ingroup kernel
- */
-
-/**    @defgroup kernel_generic_proc generic
- *     @ingroup proc
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le_proc abs32le
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64_proc amd64
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32_proc arm32
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64_proc arm64
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_ia32_proc ia32
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64_proc ia64
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32_proc mips32
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32_proc ppc32
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64_proc riscv64
- *     @ingroup proc
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64_proc sparc64
- *     @ingroup proc
- *     @endcond
- */
-
-/** @defgroup kernel_sync Synchronization
- * @ingroup kernel
- */
-
-/** @defgroup mm Memory management
- * @ingroup kernel
- */
-
-/**
- *     @defgroup kernel_generic_mm generic
- *     @ingroup mm
- */
-
-/**
- *     @defgroup kernel_genarch_mm genarch
- *     @ingroup mm
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le_mm abs32le
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64_mm amd64
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32_mm arm32
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64_mm arm64
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_ia32_mm ia32
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64_mm ia64
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32_mm mips32
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32_mm ppc32
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64_mm riscv64
- *     @ingroup mm
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64_mm sparc64
- *     @ingroup mm
- *     @endcond
- */
-
-/** @defgroup kernel_generic_ipc IPC
- * @ingroup kernel
- */
-
-/** @defgroup kernel_generic_kio KIO
- * @brief Kernel character input/output facility
- * @ingroup kernel_generic_console
- */
-
-/** @defgroup ddi Device Driver Interface
- * @ingroup kernel
- */
-
-/**
- *     @defgroup kernel_generic_ddi generic
- *     @ingroup ddi
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le_ddi abs32le
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64_ddi amd64
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32_ddi arm32
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64_ddi arm64
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_ia32_ddi ia32
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64_ddi ia64
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32_ddi mips32
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32_ddi ppc32
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64_ddi riscv64
- *     @ingroup ddi
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64_ddi sparc64
- *     @ingroup ddi
- *     @endcond
- */
-
-/** @defgroup debug Debugging
- * @ingroup others
- */
-
-/**
- *     @defgroup kernel_generic_debug generic
- *     @ingroup debug
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le_debug abs32le
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64_debug ia32/amd64
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32_debug arm32
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64_debug arm64
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_amd64_debug ia32/amd64
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64_debug ia64
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32_debug mips32
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32_debug ppc32
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64_debug riscv64
- *     @ingroup debug
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64_debug sparc64
- *     @ingroup debug
- *     @endcond
- */
-
-/** @defgroup interrupt Interrupt handling and dispatching
- * @ingroup kernel
- */
-/**
- *     @defgroup kernel_generic_interrupt generic
- *     @ingroup interrupt
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le_interrupt abs32le
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64_interrupt amd64
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32_interrupt arm32
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64_interrupt arm64
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_ia32_interrupt ia32
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64_interrupt ia64
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32_interrupt mips32
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32_interrupt ppc32
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64_interrupt riscv64
- *     @ingroup interrupt
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64_interrupt sparc64
- *     @ingroup interrupt
- *     @endcond
- */
-
-/** @defgroup others Miscellanea
- * @ingroup kernel
- */
-
-/**
- *     @defgroup kernel_generic generic
- *     @ingroup others
- */
-
-/**
- *     @defgroup kernel_genarch genarch
- *     @ingroup others
- */
-
-/**
- *     @cond abs32le
- *     @defgroup kernel_abs32le abs32le
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond amd64
- *     @defgroup kernel_amd64 amd64
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond arm32
- *     @defgroup kernel_arm32 arm32
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond arm64
- *     @defgroup kernel_arm64 arm64
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond ia32
- *     @defgroup kernel_ia32 ia32
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond ia64
- *     @defgroup kernel_ia64 ia64
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond mips32
- *     @defgroup kernel_mips32 mips32
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond ppc32
- *     @defgroup kernel_ppc32 ppc32
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond riscv64
- *     @defgroup kernel_riscv64 riscv64
- *     @ingroup others
- *     @endcond
- */
-
-/**
- *     @cond sparc64
- *     @defgroup kernel_sparc64 sparc64
- *     @ingroup others
- *     @endcond
- */
Index: rnel/doc/mm
===================================================================
--- kernel/doc/mm	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-Memory management
-=================
-
-1. Virtual Address Translation
-
-1.1 Hierarchical 4-level per address space page tables
-
-SPARTAN kernel deploys generic interface for 4-level page tables for these
-architectures: amd64, arm32, ia32, mips32 and ppc32. In this setting, page
-tables are hierarchical and are not shared by address spaces (i.e. one set of
-page tables per address space).
-
-
- VADDR
- +-----------------------------------------------------------------------------+
- |   PTL0_INDEX  |   PTL1_INDEX   |   PTL2_INDEX   |   PTL3_INDEX   |   OFFSET |
- +-----------------------------------------------------------------------------+
-
-
- PTL0                   PTL1                   PTL2                   PTL3
- +--------+             +--------+             +--------+             +--------+
- |        |             |        |             |  PTL3  | -----\      |        |
- |        |             |        |             +--------+      |      |        |
- |        |             +--------+             |        |      |      |        |
- |        |             |  PTL2  | -----\      |        |      |      |        |
- |        |             +--------+      |      |        |      |      |        |
- |        |             |        |      |      |        |      |      +--------+
- +--------+             |        |      |      |        |      |      | FRAME  |
- |  PTL1  | -----\      |        |      |      |        |      |      +--------+
- +--------+      |      |        |      |      |        |      |      |        |
- |        |      |      |        |      |      |        |      |      |        |
- |        |      |      |        |      |      |        |      |      |        |
- +--------+      \----> +--------+      \----> +--------+      \----> +--------+
-     ^
-     |
-     |
- +--------+
- |  PTL0  |
- +--------+
-
-
-PTL0		Page Table Level 0 (Page Directory)
-PTL1		Page Table Level 1
-PTL2		Page Table Level 2
-PTL3		Page Table Level 3
-
-PTL0_INDEX	Index into PTL0
-PTL1_INDEX	Index into PTL1
-PTL2_INDEX	Index into PTL2
-PTL3_INDEX	Index into PTL3
-
-VADDR		Virtual address for which mapping is looked up
-FRAME		Physical address of memory frame to which VADDR is mapped
-
-
-On architectures whose hardware has fewer levels, PTL2 and, if need be, PTL1 are
-left out. TLB-only architectures are to define custom format for software page
-tables.
-
-1.2 Single global page hash table
-
-Generic page hash table interface is deployed on 64-bit architectures without
-implied hardware support for hierarchical page tables, i.e. ia64 and sparc64.
-There is only one global page hash table in the system shared by all address
-spaces.
-
-
-2. Memory allocators
-
-2.1 General allocator
-
-'malloc' function accepts flags as a second argument. The flags are directly
-passed to the underlying frame_alloc function.
-
-1) If the flags parameter contains FRAME_ATOMIC, the allocator will not sleep.
-   The allocator CAN return NULL, when memory is not directly available.
-   The caller MUST check if NULL was not returned
-
-2) If the flags parameter does not contain FRAME_ATOMIC, the allocator
-   will never return NULL, but it CAN sleep indefinitely. The caller
-   does not have to check the return value.
-
-3) The maximum size that can be allocated using malloc is 256K
-
-Rules 1) and 2) apply to slab_alloc as well. Using SLAB allocator
-to allocate too large values is not recommended.
-
Index: rnel/doc/synchronization
===================================================================
--- kernel/doc/synchronization	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-
-                                 SPINNING LOCKS
-                spinlock_lock, spinlock_trylock, spinlock_unlock
-                                 +------------+
-                                 | spinlock_t |
-                                 +------------+
-                                       |
-                                       +------------------------------+
-                                                                      |
-                      INTERRUPTS-DISABLED SPINNING LOCKS              |
-       irq_spinlock_lock, irq_spinlock_trylock, irq_spinlock_unlock   |
-                               +----------------+                     |
-                               | irq_spinlock_t |<--------------------+
-                               +----------------+
-
-
-
-                                   WAIT QUEUES
-                         waitq_sleep_timeout, waitq_wakeup
-                                   +---------+
-                                   | waitq_t |
-                                   +---------+
-                                  /           \
-               SEMAPHORES        /             \  CONDITION VARIABLES
- semaphore_down_timeout, semaphore_up    condvar_wait_timeout, condvar_signal
-            +--------------+   /                 \   +-----------+
-            | semaphore_t  |<-+                   +->| condvar_t |
-            +--------------+                         +-----------+
-                   |                                       ^
-                   |                                       |
-                   |                                +------+
-                   V                               /
-                MUTEXES                           / READERS/WRITERS LOCKS
-    mutex_lock_timeout, mutex_unlock   rwlock_reader/writer_lock_timeout, rwlock_unlock
-              +---------+                       /        +----------+
-              | mutex_t |------------------------------->| rwlock_t |
-              +---------+                     /          +----------+
-                   |                         /
-                   +------------------------+
Index: rnel/genarch/include/genarch/acpi/acpi.h
===================================================================
--- kernel/genarch/include/genarch/acpi/acpi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ACPI_H_
-#define KERN_ACPI_H_
-
-#include <typedefs.h>
-
-/* Root System Description Pointer */
-struct acpi_rsdp {
-	uint8_t signature[8];
-	uint8_t checksum;
-	uint8_t oemid[6];
-	uint8_t revision;
-	uint32_t rsdt_address;
-	uint32_t length;
-	uint64_t xsdt_address;
-	uint32_t ext_checksum;
-	uint8_t reserved[3];
-} __attribute__((packed));
-
-/* System Description Table Header */
-struct acpi_sdt_header {
-	uint8_t signature[4];
-	uint32_t length;
-	uint8_t revision;
-	uint8_t checksum;
-	uint8_t oemid[6];
-	uint8_t oem_table_id[8];
-	uint32_t oem_revision;
-	uint32_t creator_id;
-	uint32_t creator_revision;
-} __attribute__((packed));
-
-struct acpi_signature_map {
-	uint8_t *signature;
-	struct acpi_sdt_header **sdt_ptr;
-	const char *description;
-};
-
-/* Root System Description Table */
-struct acpi_rsdt {
-	struct acpi_sdt_header header;
-	uint32_t entry[];
-} __attribute__((packed));
-
-/* Extended System Description Table */
-struct acpi_xsdt {
-	struct acpi_sdt_header header;
-	uint64_t entry[];
-} __attribute__((packed));
-
-extern struct acpi_rsdp *acpi_rsdp;
-extern struct acpi_rsdt *acpi_rsdt;
-extern struct acpi_xsdt *acpi_xsdt;
-
-extern void acpi_init(void);
-extern int acpi_sdt_check(uint8_t *sdt);
-
-#endif /* KERN_ACPI_H_ */
-
-/** @}
- */
Index: rnel/genarch/include/genarch/acpi/madt.h
===================================================================
--- kernel/genarch/include/genarch/acpi/madt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MADT_H_
-#define KERN_MADT_H_
-
-#include <genarch/acpi/acpi.h>
-#include <arch/smp/apic.h>
-#include <arch/smp/smp.h>
-
-#define MADT_L_APIC               0
-#define MADT_IO_APIC              1
-#define MADT_INTR_SRC_OVRD        2
-#define MADT_NMI_SRC              3
-#define MADT_L_APIC_NMI           4
-#define MADT_L_APIC_ADDR_OVRD     5
-#define MADT_IO_SAPIC             6
-#define MADT_L_SAPIC              7
-#define MADT_PLATFORM_INTR_SRC    8
-#define MADT_RESERVED_SKIP_BEGIN  9
-#define MADT_RESERVED_SKIP_END    127
-#define MADT_RESERVED_OEM_BEGIN   128
-
-struct madt_apic_header {
-	uint8_t type;
-	uint8_t length;
-} __attribute__((packed));
-
-/* Multiple APIC Description Table */
-struct acpi_madt {
-	struct acpi_sdt_header header;
-	uint32_t l_apic_address;
-	uint32_t flags;
-	struct madt_apic_header apic_header[];
-} __attribute__((packed));
-
-struct madt_l_apic {
-	struct madt_apic_header header;
-	uint8_t acpi_id;
-	uint8_t apic_id;
-	uint32_t flags;
-} __attribute__((packed));
-
-struct madt_io_apic {
-	struct madt_apic_header header;
-	uint8_t io_apic_id;
-	uint8_t reserved;
-	uint32_t io_apic_address;
-	uint32_t global_intr_base;
-} __attribute__((packed));
-
-struct madt_intr_src_ovrd {
-	struct madt_apic_header header;
-	uint8_t bus;
-	uint8_t source;
-	uint32_t global_int;
-	uint16_t flags;
-} __attribute__((packed));
-
-struct madt_nmi_src {
-	struct madt_apic_header header;
-	uint16_t flags;
-	uint32_t global_intr;
-} __attribute__((packed));
-
-struct madt_l_apic_nmi {
-	struct madt_apic_header header;
-	uint8_t acpi_id;
-	uint16_t flags;
-	uint8_t l_apic_lint;
-} __attribute__((packed));
-
-struct madt_l_apic_addr_ovrd {
-	struct madt_apic_header header;
-	uint16_t reserved;
-	uint64_t l_apic_address;
-} __attribute__((packed));
-
-struct madt_io_sapic {
-	struct madt_apic_header header;
-	uint8_t io_apic_id;
-	uint8_t reserved;
-	uint32_t global_intr_base;
-	uint64_t io_apic_address;
-} __attribute__((packed));
-
-struct madt_l_sapic {
-	struct madt_apic_header header;
-	uint8_t acpi_id;
-	uint8_t sapic_id;
-	uint8_t sapic_eid;
-	uint8_t reserved[3];
-	uint32_t flags;
-	uint32_t acpi_processor_uid_value;
-	uint8_t acpi_processor_uid_str[1];
-} __attribute__((packed));
-
-struct madt_platform_intr_src {
-	struct madt_apic_header header;
-	uint16_t flags;
-	uint8_t intr_type;
-	uint8_t processor_id;
-	uint8_t processor_eid;
-	uint8_t io_sapic_vector;
-	uint32_t global_intr;
-	uint32_t platform_intr_src_flags;
-} __attribute__((packed));
-
-extern struct acpi_madt *acpi_madt;
-extern struct smp_config_operations madt_config_operations;
-
-extern void acpi_madt_parse(void);
-
-#endif /* KERN_MADT_H_ */
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/cm_dpll.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/cm_dpll.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x DPLL.
- */
-
-#ifndef _KERN_AM335X_CM_DPLL_H_
-#define _KERN_AM335X_CM_DPLL_H_
-
-#include "cm_dpll_regs.h"
-#include "timer.h"
-
-#define AM335x_CM_DPLL_BASE_ADDRESS   0x44E00500
-#define AM335x_CM_DPLL_SIZE           256
-
-static ioport32_t *am335x_cm_dpll_timer_reg_get(am335x_cm_dpll_regs_t *cm,
-    am335x_timer_id_t id)
-{
-	switch (id) {
-	default:
-		return NULL;
-	case DMTIMER2:
-		return &cm->clksel_timer2;
-	case DMTIMER3:
-		return &cm->clksel_timer3;
-	case DMTIMER4:
-		return &cm->clksel_timer4;
-	case DMTIMER5:
-		return &cm->clksel_timer5;
-	case DMTIMER6:
-		return &cm->clksel_timer6;
-	case DMTIMER7:
-		return &cm->clksel_timer7;
-	}
-}
-
-static void am335x_clock_source_select(am335x_cm_dpll_regs_t *cm,
-    am335x_timer_id_t id, am335x_clk_src_t src)
-{
-	ioport32_t *reg = am335x_cm_dpll_timer_reg_get(cm, id);
-	if (!reg)
-		return;
-
-	*reg = (*reg & ~0x03) | src;
-}
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/cm_dpll_regs.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/cm_dpll_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x DPLL registers.
- */
-
-#ifndef _KERN_AM335X_CM_DPLL_REGS_H_
-#define _KERN_AM335X_CM_DPLL_REGS_H_
-
-typedef enum {
-	CLK_SRC_TCLKIN = 0x00,
-	CLK_SRC_M_OSC,
-	CLK_SRC_32_KHZ
-} am335x_clk_src_t;
-
-typedef struct am335x_cm_dpll_regs {
-
-	ioport32_t const pad0;
-
-	ioport32_t clksel_timer7;
-	ioport32_t clksel_timer2;
-	ioport32_t clksel_timer3;
-	ioport32_t clksel_timer4;
-
-	ioport32_t clksel_mac;
-#define AM335x_CM_CLKSEL_MII_FLAG (1 << 2)
-
-	ioport32_t clksel_timer5;
-	ioport32_t clksel_timer6;
-
-	ioport32_t clksel_cpts_rft;
-
-	ioport32_t const pad1;
-
-	ioport32_t clksel_timer1ms;
-#define AM335x_CM_CLKSEL_TIMER1MS_CLKMOSC      0x00
-#define AM335x_CM_CLKSEL_TIMER1MS_CLK32KHZ     0x01
-#define AM335x_CM_CLKSEL_TIMER1MS_TCLKIN       0x02
-#define AM335x_CM_CLKSEL_TIMER1MS_CLKRC32KHZ   0x03
-#define AM335x_CM_CLKSEL_TIMER1MS_32KHZCRYSTAL 0x04
-
-	ioport32_t clksel_gfx_fclk;
-#define AM335x_CM_CLKSEL_GFX_FCLK_CLKDIV_FLAG  (1 << 0)
-#define AM335x_CM_CLKSEL_GFX_FCLK_CLKSEL_FLAG  (1 << 1)
-
-	ioport32_t clksel_pru_icss_ocp;
-	ioport32_t clksel_lcdc_pixel;
-	ioport32_t clksel_wdt1;
-	ioport32_t clksel_gpio0_db;
-
-} am335x_cm_dpll_regs_t;
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/cm_per.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/cm_per.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x clock module.
- */
-
-#ifndef _KERN_AM335X_CM_PER_H_
-#define _KERN_AM335X_CM_PER_H_
-
-#include <typedefs.h>
-#include "cm_per_regs.h"
-#include "timer.h"
-
-#define AM335x_CM_PER_BASE_ADDRESS   0x44E00000
-#define AM335x_CM_PER_SIZE           1024
-
-static ioport32_t *am335x_clock_clkctrl_reg_get(am335x_cm_per_regs_t *cm,
-    am335x_timer_id_t id)
-{
-	switch (id) {
-	default:
-		return NULL;
-	case DMTIMER2:
-		return &cm->timer2_clkctrl;
-	case DMTIMER3:
-		return &cm->timer3_clkctrl;
-	case DMTIMER4:
-		return &cm->timer4_clkctrl;
-	case DMTIMER5:
-		return &cm->timer5_clkctrl;
-	case DMTIMER6:
-		return &cm->timer6_clkctrl;
-	case DMTIMER7:
-		return &cm->timer7_clkctrl;
-	}
-
-}
-
-static void am335x_clock_module_enable(am335x_cm_per_regs_t *cm,
-    am335x_timer_id_t timer_id)
-{
-	ioport32_t *tmr_reg = am335x_clock_clkctrl_reg_get(cm, timer_id);
-	if (tmr_reg == NULL)
-		return;
-
-	/* Enable the clock module */
-	*tmr_reg = (*tmr_reg & ~0x03) | 0x02;
-
-	/* Wait for completion */
-	while ((*tmr_reg & 0x03) != 0x02)
-		;
-}
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/cm_per_regs.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/cm_per_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x clock module registers.
- */
-
-#ifndef _KERN_AM335X_CM_PER_REGS_H_
-#define _KERN_AM335X_CM_PER_REGS_H_
-
-#include <typedefs.h>
-
-typedef struct am335x_cm_per_regs {
-
-	ioport32_t l4ls_clkstctrl;
-	ioport32_t l3ls_clkstctrl;
-	ioport32_t l4fw_clkstctrl;
-	ioport32_t l3_clkstctrl;
-
-	ioport32_t const pad0;
-
-	ioport32_t cpgmac0_clkctrl;
-	ioport32_t lcdc_clkctrl;
-	ioport32_t usb0_clkctrl;
-
-	ioport32_t const pad1;
-
-	ioport32_t tptc0_clkctrl;
-	ioport32_t emif_clkctrl;
-	ioport32_t ocmcram_clkctrl;
-	ioport32_t gpmc_clkctrl;
-	ioport32_t mcasp0_clkctrl;
-	ioport32_t uart5_clkctrl;
-	ioport32_t mmc0_clkctrl;
-	ioport32_t elm_clkctrl;
-	ioport32_t i2c2_clkctrl;
-	ioport32_t i2c1_clkctrl;
-	ioport32_t spi0_clkctrl;
-	ioport32_t spi1_clkctrl;
-
-	ioport32_t const pad2[3];
-
-	ioport32_t l4ls_clkctrl;
-	ioport32_t l4fw_clkctrl;
-	ioport32_t mcasp1_clkctrl;
-	ioport32_t uart1_clkctrl;
-	ioport32_t uart2_clkctrl;
-	ioport32_t uart3_clkctrl;
-	ioport32_t uart4_clkctrl;
-	ioport32_t timer7_clkctrl;
-	ioport32_t timer2_clkctrl;
-	ioport32_t timer3_clkctrl;
-	ioport32_t timer4_clkctrl;
-
-	ioport32_t const pad3[8];
-
-	ioport32_t gpio1_clkctrl;
-	ioport32_t gpio2_clkctrl;
-	ioport32_t gpio3_clkctrl;
-
-	ioport32_t const pad4;
-
-	ioport32_t tpcc_clkctrl;
-	ioport32_t dcan0_clkctrl;
-	ioport32_t dcan1_clkctrl;
-	ioport32_t epwmss1_clkctrl;
-	ioport32_t emiffw_clkctrl;
-	ioport32_t epwmss0_clkctrl;
-	ioport32_t epwmss2_clkctrl;
-	ioport32_t l3instr_clkctrl;
-	ioport32_t l3_clkctrl;
-	ioport32_t ieee5000_clkctrl;
-	ioport32_t pruicss_clkctrl;
-	ioport32_t timer5_clkctrl;
-	ioport32_t timer6_clkctrl;
-	ioport32_t mmc1_clkctrl;
-	ioport32_t mmc2_clkctrl;
-	ioport32_t tptc1_clkctrl;
-	ioport32_t tptc2_clkctrl;
-
-	ioport32_t const pad5[2];
-
-	ioport32_t spinlock_clkctrl;
-	ioport32_t mailbox0_clkctrl;
-
-	ioport32_t const pad6[2];
-
-	ioport32_t l4hs_clkstctrl;
-	ioport32_t l4hs_clkctrl;
-
-	ioport32_t const pad7[2];
-
-	ioport32_t ocpwp_l3_clkstctrl;
-	ioport32_t ocpwp_clkctrl;
-
-	ioport32_t const pad8[3];
-
-	ioport32_t pruicss_clkstctrl;
-	ioport32_t cpsw_clkstctrl;
-	ioport32_t lcdc_clkstctrl;
-	ioport32_t clkdiv32_clkctrl;
-	ioport32_t clk24mhz_clkstctrl;
-} am335x_cm_per_regs_t;
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/ctrl_module.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/ctrl_module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x control module.
- */
-
-#ifndef _KERN_AM335X_CTRL_MODULE_H_
-#define _KERN_AM335X_CTRL_MODULE_H_
-
-#include <errno.h>
-#include <typedefs.h>
-#include "ctrl_module_regs.h"
-
-#define AM335x_CTRL_MODULE_BASE_ADDRESS  0x44E10000
-#define AM335x_CTRL_MODULE_SIZE          131072 /* 128 Kb */
-
-typedef ioport32_t am335x_ctrl_module_t;
-
-static errno_t
-am335x_ctrl_module_clock_freq_get(am335x_ctrl_module_t *base, unsigned *freq)
-{
-	unsigned const control_status = AM335x_CTRL_MODULE_REG_VALUE(base,
-	    CONTROL_STATUS);
-
-	/* Get the sysboot1 field at control_status[22,23] */
-	unsigned const sysboot1 = (control_status >> 22) & 0x03;
-
-	switch (sysboot1) {
-	default:
-		return EINVAL;
-	case 0:
-		*freq = 19200000; /* 19.2 Mhz */
-		break;
-	case 1:
-		*freq = 24000000; /* 24 Mhz */
-		break;
-	case 2:
-		*freq = 25000000; /* 25 Mhz */
-		break;
-	case 3:
-		*freq = 26000000; /* 26 Mhz */
-		break;
-	}
-
-	return EOK;
-}
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/ctrl_module_regs.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/ctrl_module_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,280 +1,0 @@
-/*
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x control module registers.
- */
-
-#ifndef _KERN_AM335X_CTRL_MODULE_REGS_H_
-#define _KERN_AM335X_CTRL_MODULE_REGS_H_
-
-#include <typedefs.h>
-
-#define AM335x_CTRL_MODULE_REG_VALUE(base, name) \
-	    (*((ioport32_t *)(AM335x_CTRL_MODULE_##name##_OFFSET + \
-	    ((ioport8_t *) base))))
-
-#define AM335x_CTRL_MODULE_CONTROL_REVISION_OFFSET          0x00
-#define AM335x_CTRL_MODULE_CONTROL_HWINFO_OFFSET            0x04
-#define AM335x_CTRL_MODULE_CONTROL_SYSCONFIG_OFFSET         0x10
-#define AM335x_CTRL_MODULE_CONTROL_STATUS_OFFSET            0x40
-#define AM335x_CTRL_MODULE_CONTROL_EMIF_SDRAM_CONFIG_OFFSET 0x110
-#define AM335x_CTRL_MODULE_CORTEX_VBBLDO_CTRL_OFFSET        0x41C
-#define AM335x_CTRL_MODULE_CORE_SLDO_CTRL_OFFSET            0x428
-#define AM335x_CTRL_MODULE_MPU_SLDO_CTRL_OFFSET             0x42C
-#define AM335x_CTRL_MODULE_CLK32KDIVRATIO_CTRL_OFFSET       0x444
-#define AM335x_CTRL_MODULE_BANDGAP_CTRL_OFFSET              0x448
-#define AM335x_CTRL_MODULE_BANDGAP_TRIM_OFFSET              0x44C
-#define AM335x_CTRL_MODULE_PLL_CLKINPULOW_CTRL_OFFSET       0x458
-#define AM335x_CTRL_MODULE_MOSC_CTRL_OFFSET                 0x468
-#define AM335x_CTRL_MODULE_ROSC_CTRL_OFFSET                 0x46C
-#define AM335x_CTRL_MODULE_DEEPSLEEP_CTRL_OFFSET            0x470
-#define AM335x_CTRL_MODULE_DEVICE_ID_OFFSET                 0x600
-#define AM335x_CTRL_MODULE_DEV_FEATURE_OFFSET               0x604
-#define AM335x_CTRL_MODULE_INIT_PRIORITY_0_OFFSET           0x608
-#define AM335x_CTRL_MODULE_INIT_PRIORITY_1_OFFSET           0x60C
-#define AM335x_CTRL_MODULE_MMU_CFG_OFFSET                   0x610
-#define AM335x_CTRL_MODULE_TPTC_CFG_OFFSET                  0x614
-#define AM335x_CTRL_MODULE_USB_CTRL0_OFFSET                 0x620
-#define AM335x_CTRL_MODULE_USB_STS0_OFFSET                  0x624
-#define AM335x_CTRL_MODULE_USB_CTRL1_OFFSET                 0x628
-#define AM335x_CTRL_MODULE_USB_STS1_OFFSET                  0x62C
-#define AM335x_CTRL_MODULE_MAC_ID0_LO_OFFSET                0x630
-#define AM335x_CTRL_MODULE_MAC_ID0_HI_OFFSET                0x634
-#define AM335x_CTRL_MODULE_MAC_ID1_LO_OFFSET                0x638
-#define AM335x_CTRL_MODULE_MAC_ID1_HI_OFFSET                0x63C
-#define AM335x_CTRL_MODULE_DCAN_RAMINIT_OFFSET              0x644
-#define AM335x_CTRL_MODULE_USB_WKUP_CTRL_OFFSET             0x648
-#define AM335x_CTRL_MODULE_GMII_SEL_OFFSET                  0x650
-#define AM335x_CTRL_MODULE_PWMSS_CTRL_OFFSET                0x664
-#define AM335x_CTRL_MODULE_MREQPRIO_0_OFFSET                0x670
-#define AM335x_CTRL_MODULE_MREQPRIO_1_OFFSET                0x674
-#define AM335x_CTRL_MODULE_HW_EVENT_SEL_GRP1_OFFSET         0x690
-#define AM335x_CTRL_MODULE_HW_EVENT_SEL_GRP2_OFFSET         0x694
-#define AM335x_CTRL_MODULE_HW_EVENT_SEL_GRP3_OFFSET         0x698
-#define AM335x_CTRL_MODULE_HW_EVENT_SEL_GRP4_OFFSET         0x69C
-#define AM335x_CTRL_MODULE_SMRT_CTRL_OFFSET                 0x6A0
-#define AM335x_CTRL_MODULE_MPUSS_HW_DEBUG_SEL_OFFSET        0x6A4
-#define AM335x_CTRL_MODULE_MPUSS_HW_DBG_INFO_OFFSET         0x6A8
-#define AM335x_CTRL_MODULE_VDD_MPU_OPP_050_OFFSET           0x770
-#define AM335x_CTRL_MODULE_VDD_MPU_OPP_100_OFFSET           0x774
-#define AM335x_CTRL_MODULE_VDD_MPU_OPP_120_OFFSET           0x778
-#define AM335x_CTRL_MODULE_VDD_MPU_OPP_TURBO_OFFSET         0x77C
-#define AM335x_CTRL_MODULE_VDD_CORE_OPP_050_OFFSET          0x7B8
-#define AM335x_CTRL_MODULE_VDD_CORE_OPP_100_OFFSET          0x7BC
-#define AM335x_CTRL_MODULE_BB_SCALE_OFFSET                  0x7D0
-#define AM335x_CTRL_MODULE_USB_VID_PID_OFFSET               0x7F4
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD0_OFFSET             0x800
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD1_OFFSET             0x804
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD2_OFFSET             0x808
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD3_OFFSET             0x80C
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD4_OFFSET             0x810
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD5_OFFSET             0x814
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD6_OFFSET             0x818
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD7_OFFSET             0x81C
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD8_OFFSET             0x820
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD9_OFFSET             0x824
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD10_OFFSET            0x828
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD11_OFFSET            0x82C
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD12_OFFSET            0x830
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD13_OFFSET            0x834
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD14_OFFSET            0x838
-#define AM335x_CTRL_MODULE_CONF_GPMC_AD15_OFFSET            0x83C
-#define AM335x_CTRL_MODULE_CONF_GPMC_A0_OFFSET              0x840
-#define AM335x_CTRL_MODULE_CONF_GPMC_A1_OFFSET              0x844
-#define AM335x_CTRL_MODULE_CONF_GPMC_A2_OFFSET              0x848
-#define AM335x_CTRL_MODULE_CONF_GPMC_A3_OFFSET              0x84C
-#define AM335x_CTRL_MODULE_CONF_GPMC_A4_OFFSET              0x850
-#define AM335x_CTRL_MODULE_CONF_GPMC_A5_OFFSET              0x854
-#define AM335x_CTRL_MODULE_CONF_GPMC_A6_OFFSET              0x858
-#define AM335x_CTRL_MODULE_CONF_GPMC_A7_OFFSET              0x85C
-#define AM335x_CTRL_MODULE_CONF_GPMC_A8_OFFSET              0x860
-#define AM335x_CTRL_MODULE_CONF_GPMC_A9_OFFSET              0x864
-#define AM335x_CTRL_MODULE_CONF_GPMC_A10_OFFSET             0x868
-#define AM335x_CTRL_MODULE_CONF_GPMC_A11_OFFSET             0x86C
-#define AM335x_CTRL_MODULE_CONF_GPMC_WAIT0_OFFSET           0x870
-#define AM335x_CTRL_MODULE_CONF_GPMC_WPN_OFFSET             0x874
-#define AM335x_CTRL_MODULE_CONF_GPMC_BEN1_OFFSET            0x878
-#define AM335x_CTRL_MODULE_CONF_GPMC_CSN0_OFFSET            0x87C
-#define AM335x_CTRL_MODULE_CONF_GPMC_CSN1_OFFSET            0x880
-#define AM335x_CTRL_MODULE_CONF_GPMC_CSN2_OFFSET            0x884
-#define AM335x_CTRL_MODULE_CONF_GPMC_CSN3_OFFSET            0x888
-#define AM335x_CTRL_MODULE_CONF_GPMC_CLK_OFFSET             0x88C
-#define AM335x_CTRL_MODULE_CONF_GPMC_ADVN_ALE_OFFSET        0x890
-#define AM335x_CTRL_MODULE_CONF_GPMC_OEN_REN_OFFSET         0x894
-#define AM335x_CTRL_MODULE_CONF_GPMC_WEN_OFFSET             0x898
-#define AM335x_CTRL_MODULE_CONF_GPMC_BEN0_CLE_OFFSET        0x89C
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA0_OFFSET            0x8A0
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA1_OFFSET            0x8A4
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA2_OFFSET            0x8A8
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA3_OFFSET            0x8AC
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA4_OFFSET            0x8B0
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA5_OFFSET            0x8B4
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA6_OFFSET            0x8B8
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA7_OFFSET            0x8BC
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA8_OFFSET            0x8C0
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA9_OFFSET            0x8C4
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA10_OFFSET           0x8C8
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA11_OFFSET           0x8CC
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA12_OFFSET           0x8D0
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA13_OFFSET           0x8D4
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA14_OFFSET           0x8D8
-#define AM335x_CTRL_MODULE_CONF_LCD_DATA15_OFFSET           0x8DC
-#define AM335x_CTRL_MODULE_CONF_LCD_VSYNC_OFFSET            0x8E0
-#define AM335x_CTRL_MODULE_CONF_LCD_HSYNC_OFFSET            0x8E4
-#define AM335x_CTRL_MODULE_CONF_LCD_PCLK_OFFSET             0x8E8
-#define AM335x_CTRL_MODULE_CONF_LCD_AC_BIAS_EN_OFFSET       0x8EC
-#define AM335x_CTRL_MODULE_CONF_MMC0_DAT3_OFFSET            0x8F0
-#define AM335x_CTRL_MODULE_CONF_MMC0_DAT2_OFFSET            0x8F4
-#define AM335x_CTRL_MODULE_CONF_MMC0_DAT1_OFFSET            0x8F8
-#define AM335x_CTRL_MODULE_CONF_MMC0_DAT0_OFFSET            0x8FC
-#define AM335x_CTRL_MODULE_CONF_MMC0_CLK_OFFSET             0x900
-#define AM335x_CTRL_MODULE_CONF_MMC0_CMD_OFFSET             0x904
-#define AM335x_CTRL_MODULE_CONF_MII1_COL_OFFSET             0x908
-#define AM335x_CTRL_MODULE_CONF_MII1_CRS_OFFSET             0x90C
-#define AM335x_CTRL_MODULE_CONF_MII1_RX_ER_OFFSET           0x910
-#define AM335x_CTRL_MODULE_CONF_MII1_TX_EN_OFFSET           0x914
-#define AM335x_CTRL_MODULE_CONF_MII1_RX_DV_OFFSET           0x918
-#define AM335x_CTRL_MODULE_CONF_MII1_TXD3_OFFSET            0x91C
-#define AM335x_CTRL_MODULE_CONF_MII1_TXD2_OFFSET            0x920
-#define AM335x_CTRL_MODULE_CONF_MII1_TXD1_OFFSET            0x924
-#define AM335x_CTRL_MODULE_CONF_MII1_TXD0_OFFSET            0x928
-#define AM335x_CTRL_MODULE_CONF_MII1_TX_CLK_OFFSET          0x92C
-#define AM335x_CTRL_MODULE_CONF_MII1_RX_CLK_OFFSET          0x930
-#define AM335x_CTRL_MODULE_CONF_MII1_RXD3_OFFSET            0x934
-#define AM335x_CTRL_MODULE_CONF_MII1_RXD2_OFFSET            0x938
-#define AM335x_CTRL_MODULE_CONF_MII1_RXD1_OFFSET            0x93C
-#define AM335x_CTRL_MODULE_CONF_MII1_RXD0_OFFSET            0x940
-#define AM335x_CTRL_MODULE_CONF_RMII1_REF_CLK_OFFSET        0x944
-#define AM335x_CTRL_MODULE_CONF_MDIO_OFFSET                 0x948
-#define AM335x_CTRL_MODULE_CONF_MDC_OFFSET                  0x94C
-#define AM335x_CTRL_MODULE_CONF_SPI0_SCLK_OFFSET            0x950
-#define AM335x_CTRL_MODULE_CONF_SPI0_D0_OFFSET              0x954
-#define AM335x_CTRL_MODULE_CONF_SPI0_D1_OFFSET              0x958
-#define AM335x_CTRL_MODULE_CONF_SPI0_CS0_OFFSET             0x95C
-#define AM335x_CTRL_MODULE_CONF_SPI0_CS1_OFFSET             0x960
-#define AM335x_CTRL_MODULE_CONF_ECAP0_IN_PWM0_OUT_OFFSET    0x964
-#define AM335x_CTRL_MODULE_CONF_UART0_CTSN_OFFSET           0x968
-#define AM335x_CTRL_MODULE_CONF_UART0_RTSN_OFFSET           0x96C
-#define AM335x_CTRL_MODULE_CONF_UART0_RXD_OFFSET            0x970
-#define AM335x_CTRL_MODULE_CONF_UART0_TXD_OFFSET            0x974
-#define AM335x_CTRL_MODULE_CONF_UART1_CTSN_OFFSET           0x978
-#define AM335x_CTRL_MODULE_CONF_UART1_RTSN_OFFSET           0x97C
-#define AM335x_CTRL_MODULE_CONF_UART1_RXD_OFFSET            0x980
-#define AM335x_CTRL_MODULE_CONF_UART1_TXD_OFFSET            0x984
-#define AM335x_CTRL_MODULE_CONF_I2C0_SDA_OFFSET             0x988
-#define AM335x_CTRL_MODULE_CONF_I2C0_SCL_OFFSET             0x98C
-#define AM335x_CTRL_MODULE_CONF_MCASP0_ACLKX_OFFSET         0x990
-#define AM335x_CTRL_MODULE_CONF_MCASP0_FSX_OFFSET           0x994
-#define AM335x_CTRL_MODULE_CONF_MCASP0_AXR0_OFFSET          0x998
-#define AM335x_CTRL_MODULE_CONF_MCASP0_AHCLKR_OFFSET        0x99C
-#define AM335x_CTRL_MODULE_CONF_MCASP0_ACLKR_OFFSET         0x9A0
-#define AM335x_CTRL_MODULE_CONF_MCASP0_FSR_OFFSET           0x9A4
-#define AM335x_CTRL_MODULE_CONF_MCASP0_AXR1_OFFSET          0x9A8
-#define AM335x_CTRL_MODULE_CONF_MCASP0_AHCLKX_OFFSET        0x9AC
-#define AM335x_CTRL_MODULE_CONF_XDMA_EVENT_INTR0_OFFSET     0x9B0
-#define AM335x_CTRL_MODULE_CONF_XDMA_EVENT_INTR1_OFFSET     0x9B4
-#define AM335x_CTRL_MODULE_CONF_WARMRSTN_OFFSET             0x9B8
-#define AM335x_CTRL_MODULE_CONF_PWRONRSTN_OFFSET            0x9BC
-#define AM335x_CTRL_MODULE_CONF_NNMI_OFFSET                 0x9C0
-#define AM335x_CTRL_MODULE_CONF_XTALIN_OFFSET               0x9C4
-#define AM335x_CTRL_MODULE_CONF_XTALOUT_OFFSET              0x9C8
-#define AM335x_CTRL_MODULE_CONF_TMS_OFFSET                  0x9D0
-#define AM335x_CTRL_MODULE_CONF_TDI_OFFSET                  0x9D4
-#define AM335x_CTRL_MODULE_CONF_TDO_OFFSET                  0x9D8
-#define AM335x_CTRL_MODULE_CONF_TCK_OFFSET                  0x9DC
-#define AM335x_CTRL_MODULE_CONF_TRSTN_OFFSET                0x9E0
-#define AM335x_CTRL_MODULE_CONF_EMU0_OFFSET                 0x9E4
-#define AM335x_CTRL_MODULE_CONF_EMU1_OFFSET                 0x9E8
-#define AM335x_CTRL_MODULE_CONF_RTC_XTALIN_OFFSET           0x9EC
-#define AM335x_CTRL_MODULE_CONF_RTC_XTALOUT_OFFSET          0x9F0
-#define AM335x_CTRL_MODULE_CONF_RTC_PWRONRSTN_OFFSET        0x9F8
-#define AM335x_CTRL_MODULE_CONF_PMIC_POWER_EN_OFFSET        0x9FC
-#define AM335x_CTRL_MODULE_CONF_EXT_WAKEUP_OFFSET           0xA00
-#define AM335x_CTRL_MODULE_CONF_RTC_KALDO_ENN_OFFSET        0xA04
-#define AM335x_CTRL_MODULE_CONF_USB0_DM_OFFSET              0xA08
-#define AM335x_CTRL_MODULE_CONF_USB0_DP_OFFSET              0xA0C
-#define AM335x_CTRL_MODULE_CONF_USB0_CE_OFFSET              0xA10
-#define AM335x_CTRL_MODULE_CONF_USB0_ID_OFFSET              0xA14
-#define AM335x_CTRL_MODULE_CONF_USB0_VBUS_OFFSET            0xA18
-#define AM335x_CTRL_MODULE_CONF_USB0_DRVVBUS_OFFSET         0xA1C
-#define AM335x_CTRL_MODULE_CONF_USB1_DM_OFFSET              0xA20
-#define AM335x_CTRL_MODULE_CONF_USB1_DP_OFFSET              0xA24
-#define AM335x_CTRL_MODULE_CONF_USB1_CE_OFFSET              0xA28
-#define AM335x_CTRL_MODULE_CONF_USB1_ID_OFFSET              0xA2C
-#define AM335x_CTRL_MODULE_CONF_USB1_VBUS_OFFSET            0xA30
-#define AM335x_CTRL_MODULE_CONF_USB1_DRVVBUS_OFFSET         0xA34
-#define AM335x_CTRL_MODULE_CQDETECT_STATUS_OFFSET           0xE00
-#define AM335x_CTRL_MODULE_DDR_IO_CTRL_OFFSET               0xE04
-#define AM335x_CTRL_MODULE_VTP_CTRL_OFFSET                  0xE0C
-#define AM335x_CTRL_MODULE_VREF_CTRL_OFFSET                 0xE14
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_0_3_OFFSET          0xF90
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_4_7_OFFSET          0xF94
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_8_11_OFFSET         0xF98
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_12_15_OFFSET        0xF9C
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_16_19_OFFSET        0xFA0
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_20_23_OFFSET        0xFA4
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_24_27_OFFSET        0xFA8
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_28_31_OFFSET        0xFAC
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_32_35_OFFSET        0xFB0
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_36_39_OFFSET        0xFB4
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_40_43_OFFSET        0xFB8
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_44_47_OFFSET        0xFBC
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_48_51_OFFSET        0xFC0
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_52_55_OFFSET        0xFC4
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_56_59_OFFSET        0xFC8
-#define AM335x_CTRL_MODULE_TPCC_EVT_MUX_60_63_OFFSET        0xFCC
-#define AM335x_CTRL_MODULE_TIMER_EVT_CAPT_OFFSET            0xFD0
-#define AM335x_CTRL_MODULE_ECAP_EVT_CAPT_OFFSET             0xFD4
-#define AM335x_CTRL_MODULE_ADC_EVT_CAPT_OFFSET              0xFD8
-#define AM335x_CTRL_MODULE_RESET_ISO_OFFSET                 0x1000
-#define AM335x_CTRL_MODULE_DDR_CKE_CTRL_OFFSET              0x131C
-#define AM335x_CTRL_MODULE_SMA2_OFFSET                      0x1320
-#define AM335x_CTRL_MODULE_M3_TXEV_EOI_OFFSET               0x1324
-#define AM335x_CTRL_MODULE_IPC_MSG_REG0_OFFSET              0x1328
-#define AM335x_CTRL_MODULE_IPC_MSG_REG1_OFFSET              0x132C
-#define AM335x_CTRL_MODULE_IPC_MSG_REG2_OFFSET              0x1330
-#define AM335x_CTRL_MODULE_IPC_MSG_REG3_OFFSET              0x1334
-#define AM335x_CTRL_MODULE_IPC_MSG_REG4_OFFSET              0x1338
-#define AM335x_CTRL_MODULE_IPC_MSG_REG5_OFFSET              0x133C
-#define AM335x_CTRL_MODULE_IPC_MSG_REG6_OFFSET              0x1340
-#define AM335x_CTRL_MODULE_IPC_MSG_REG7_OFFSET              0x1344
-#define AM335x_CTRL_MODULE_DDR_CMD0_IOCTRL_OFFSET           0x1404
-#define AM335x_CTRL_MODULE_DDR_CMD1_IOCTRL_OFFSET           0x1408
-#define AM335x_CTRL_MODULE_DDR_CMD2_IOCTRL_OFFSET           0x140C
-#define AM335x_CTRL_MODULE_DDR_DATA0_IOCTRL_OFFSET          0x1440
-#define AM335x_CTRL_MODULE_DDR_DATA1_IOCTRL_OFFSET          0x1444
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/iomux.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/iomux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2012 Matteo Facchinetti
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x CONTROL_MODULE: I/O multiplexing.
- */
-
-#ifndef KERN_AM335X_IOMUX_H_
-#define KERN_AM335X_IOMUX_H_
-
-#include <typedefs.h>
-
-/* Pad Control Register for each configurable pin p. 876 */
-#define AM335X_IOMUX_SLEWRATE_SLOW_FLAG  (1 << 6)
-#define AM335X_IOMUX_RX_ENABLE_FLAG  (1 << 5)
-#define AM335X_IOMUX_PULLUP_FLAG  (1 << 4)
-#define AM335X_IOMUX_PULLUPDOWN_ENABLE_FLAG  (1 << 3)
-#define AM335X_IOMUX_MODE0  0
-#define AM335X_IOMUX_MODE1  1
-#define AM335X_IOMUX_MODE2  2
-#define AM335X_IOMUX_MODE3  3
-#define AM335X_IOMUX_MODE4  4
-#define AM335X_IOMUX_MODE5  5
-#define AM335X_IOMUX_MODE6  6
-#define AM335X_IOMUX_MODE7  7
-
-/* AM335X CONTROL_MODULE configurable I/O pin. Table 9-10 at p. 886 */
-#define AM335X_IOMUX_CONF_BASE_ADDRESS 0x44E10800
-
-typedef struct {
-	ioport32_t gpmc_ad1;
-	ioport32_t gpmc_ad2;
-	ioport32_t gpmc_ad3;
-	ioport32_t gpmc_ad4;
-	ioport32_t gpmc_ad5;
-	ioport32_t gpmc_ad6;
-	ioport32_t gpmc_ad7;
-	ioport32_t gpmc_ad8;
-	ioport32_t gpmc_ad9;
-	ioport32_t gpmc_ad10;
-	ioport32_t gpmc_ad11;
-	ioport32_t gpmc_ad12;
-	ioport32_t gpmc_ad13;
-	ioport32_t gpmc_ad14;
-	ioport32_t gpmc_ad15;
-	ioport32_t gpmc_a0;
-	ioport32_t gpmc_a1;
-	ioport32_t gpmc_a2;
-	ioport32_t gpmc_a3;
-	ioport32_t gpmc_a4;
-	ioport32_t gpmc_a5;
-	ioport32_t gpmc_a6;
-	ioport32_t gpmc_a7;
-	ioport32_t gpmc_a8;
-	ioport32_t gpmc_a9;
-	ioport32_t gpmc_a10;
-	ioport32_t gpmc_a11;
-	ioport32_t gpmc_wait0;
-	ioport32_t gpmc_wpn;
-	ioport32_t gpmc_be1n;
-	ioport32_t gpmc_csn0;
-	ioport32_t gpmc_csn1;
-	ioport32_t gpmc_csn2;
-	ioport32_t gpmc_csn3;
-	ioport32_t gpmc_clk;
-	ioport32_t gpmc_advn_ale;
-	ioport32_t gpmc_oen_ren;
-	ioport32_t gpmc_wen;
-	ioport32_t gpmc_be0n_cle;
-	ioport32_t lcd_data0;
-	ioport32_t lcd_data1;
-	ioport32_t lcd_data2;
-	ioport32_t lcd_data3;
-	ioport32_t lcd_data4;
-	ioport32_t lcd_data5;
-	ioport32_t lcd_data6;
-	ioport32_t lcd_data7;
-	ioport32_t lcd_data8;
-	ioport32_t lcd_data9;
-	ioport32_t lcd_data10;
-	ioport32_t lcd_data11;
-	ioport32_t lcd_data12;
-	ioport32_t lcd_data13;
-	ioport32_t lcd_data14;
-	ioport32_t lcd_data15;
-	ioport32_t lcd_vsync;
-	ioport32_t lcd_hsync;
-	ioport32_t lcd_pclk;
-	ioport32_t lcd_ac_bias_en;
-	ioport32_t mmc0_dat3;
-	ioport32_t mmc0_dat2;
-	ioport32_t mmc0_dat1;
-	ioport32_t mmc0_dat0;
-	ioport32_t mmc0_clk;
-	ioport32_t mmc0_cmd;
-	ioport32_t mii1_col;
-	ioport32_t mii1_crs;
-	ioport32_t mii1_rxerr;
-	ioport32_t mii1_txen;
-	ioport32_t mii1_rxdv;
-	ioport32_t mii1_txd3;
-	ioport32_t mii1_txd2;
-	ioport32_t mii1_txd1;
-	ioport32_t mii1_txd0;
-	ioport32_t mii1_txclk;
-	ioport32_t mii1_rxclk;
-	ioport32_t mii1_rxd3;
-	ioport32_t mii1_rxd2;
-	ioport32_t mii1_rxd1;
-	ioport32_t mii1_rxd0;
-	ioport32_t rmii1_refclk;
-	ioport32_t mdio_data;
-	ioport32_t mdio_clk;
-	ioport32_t spi0_sclk;
-	ioport32_t spi0_d0;
-	ioport32_t spi0_d1;
-	ioport32_t spi0_cs0;
-	ioport32_t spi0_cs1;
-	ioport32_t ecap0_in_pwm0_out;
-	ioport32_t uart0_ctsn;
-	ioport32_t uart0_rtsn;
-	ioport32_t uart0_rxd;
-	ioport32_t uart0_txd;
-	ioport32_t uart1_ctsn;
-	ioport32_t uart1_rtsn;
-	ioport32_t uart1_rxd;
-	ioport32_t uart1_txd;
-	ioport32_t i2c0_sda;
-	ioport32_t i2c0_scl;
-	ioport32_t mcasp0_aclkx;
-	ioport32_t mcasp0_fsx;
-	ioport32_t mcasp0_axr0;
-	ioport32_t mcasp0_ahclkr;
-	ioport32_t mcasp0_aclkr;
-	ioport32_t mcasp0_fsr;
-	ioport32_t mcasp0_axr1;
-	ioport32_t mcasp0_ahclkx;
-	ioport32_t xdma_event_intr0;
-	ioport32_t xdma_event_intr1;
-	ioport32_t nresetin_out;
-	ioport32_t porz;
-	ioport32_t nnmi;
-	ioport32_t osc0_in;
-	ioport32_t osc0_out;
-	ioport32_t osc0_vss;
-	ioport32_t tms;
-	ioport32_t tdi;
-	ioport32_t tdo;
-	ioport32_t tck;
-	ioport32_t ntrst;
-	ioport32_t emu0;
-	ioport32_t emu1;
-	ioport32_t osc1_in;
-	ioport32_t osc1_out;
-	ioport32_t osc1_vss;
-	ioport32_t rtc_porz;
-	ioport32_t pmic_power_en;
-	ioport32_t ext_wakeup;
-	ioport32_t enz_kaldo_1p8v;
-	ioport32_t usb0_dm;
-	ioport32_t usb0_dp;
-	ioport32_t usb0_ce;
-	ioport32_t usb0_id;
-	ioport32_t usb0_vbus;
-	ioport32_t usb0_drvvbus;
-	ioport32_t usb1_dm;
-	ioport32_t usb1_dp;
-	ioport32_t usb1_ce;
-	ioport32_t usb1_id;
-	ioport32_t usb1_vbus;
-	ioport32_t usb1_drvvbus;
-	ioport32_t ddr_resetn;
-	ioport32_t ddr_csn0;
-	ioport32_t ddr_cke;
-	ioport32_t ddr_ck;
-	ioport32_t ddr_nck;
-	ioport32_t ddr_casn;
-	ioport32_t ddr_rasn;
-	ioport32_t ddr_wen;
-	ioport32_t ddr_ba0;
-	ioport32_t ddr_ba1;
-	ioport32_t ddr_ba2;
-	ioport32_t ddr_a0;
-	ioport32_t ddr_a1;
-	ioport32_t ddr_a2;
-	ioport32_t ddr_a3;
-	ioport32_t ddr_a4;
-	ioport32_t ddr_a5;
-	ioport32_t ddr_a6;
-	ioport32_t ddr_a7;
-	ioport32_t ddr_a8;
-	ioport32_t ddr_a9;
-	ioport32_t ddr_a10;
-	ioport32_t ddr_a11;
-	ioport32_t ddr_a12;
-	ioport32_t ddr_a13;
-	ioport32_t ddr_a14;
-	ioport32_t ddr_a15;
-	ioport32_t ddr_odt;
-	ioport32_t ddr_d0;
-	ioport32_t ddr_d1;
-	ioport32_t ddr_d2;
-	ioport32_t ddr_d3;
-	ioport32_t ddr_d4;
-	ioport32_t ddr_d5;
-	ioport32_t ddr_d6;
-	ioport32_t ddr_d7;
-	ioport32_t ddr_d8;
-	ioport32_t ddr_d9;
-	ioport32_t ddr_d10;
-	ioport32_t ddr_d11;
-	ioport32_t ddr_d12;
-	ioport32_t ddr_d13;
-	ioport32_t ddr_d14;
-	ioport32_t ddr_d15;
-	ioport32_t ddr_dqm0;
-	ioport32_t ddr_dqm1;
-	ioport32_t ddr_dqs0;
-	ioport32_t ddr_dqsn0;
-	ioport32_t ddr_dqs1;
-	ioport32_t ddr_dqsn1;
-	ioport32_t ddr_vref;
-	ioport32_t ddr_vtp;
-	ioport32_t ain7;
-	ioport32_t ain6;
-	ioport32_t ain5;
-	ioport32_t ain4;
-	ioport32_t ain3;
-	ioport32_t ain2;
-	ioport32_t ain1;
-	ioport32_t ain0;
-	ioport32_t vrefp;
-	ioport32_t vrefn;
-	ioport32_t avdd;
-	ioport32_t avss;
-	ioport32_t iforce;
-	ioport32_t vsense;
-	ioport32_t testout;
-} am335x_iomux_conf_regs_t;
-#endif /* KERN_AM335X_IOMUX_H_ */
Index: rnel/genarch/include/genarch/drivers/am335x/irc.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-
-/**
- * @file
- * @brief Texas Instruments AM335x MPU on-chip interrupt controller driver.
- */
-
-#ifndef KERN_AM335x_IRQC_H_
-#define KERN_AM335x_IRQC_H_
-
-#define AM335x_IRC_BASE_ADDRESS     0x48200000
-#define AM335x_IRC_SIZE             4096
-
-#define AM335x_IRC_IRQ_COUNT        128
-#define AM335x_IRC_IRQ_GROUPS_COUNT 4
-
-#define OMAP_IRC_IRQ_COUNT        AM335x_IRC_IRQ_COUNT
-#define OMAP_IRC_IRQ_GROUPS_COUNT AM335x_IRC_IRQ_GROUPS_COUNT
-
-#include <genarch/drivers/omap/irc.h>
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/timer.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/timer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x timer driver.
- */
-
-#ifndef _KERN_AM335X_TIMER_H_
-#define _KERN_AM335X_TIMER_H_
-
-#include <genarch/drivers/am335x/timer_regs.h>
-
-#define AM335x_DMTIMER0_BASE_ADDRESS    0x44E05000
-#define AM335x_DMTIMER0_SIZE            4096
-#define AM335x_DMTIMER0_IRQ             66
-
-#define AM335x_DMTIMER2_BASE_ADDRESS    0x48040000
-#define AM335x_DMTIMER2_SIZE            4096
-#define AM335x_DMTIMER2_IRQ             68
-
-#define AM335x_DMTIMER3_BASE_ADDRESS    0x48042000
-#define AM335x_DMTIMER3_SIZE            4096
-#define AM335x_DMTIMER3_IRQ             69
-
-#define AM335x_DMTIMER4_BASE_ADDRESS    0x48044000
-#define AM335x_DMTIMER4_SIZE            4096
-#define AM335x_DMTIMER4_IRQ             92
-
-#define AM335x_DMTIMER5_BASE_ADDRESS    0x48046000
-#define AM335x_DMTIMER5_SIZE            4096
-#define AM335x_DMTIMER5_IRQ             93
-
-#define AM335x_DMTIMER6_BASE_ADDRESS    0x48048000
-#define AM335x_DMTIMER6_SIZE            4096
-#define AM335x_DMTIMER6_IRQ             94
-
-#define AM335x_DMTIMER7_BASE_ADDRESS    0x4804A000
-#define AM335x_DMTIMER7_SIZE            4096
-#define AM335x_DMTIMER7_IRQ             95
-
-typedef enum {
-	DMTIMER0 = 0,
-	DMTIMER1_1MS,
-	DMTIMER2,
-	DMTIMER3,
-	DMTIMER4,
-	DMTIMER5,
-	DMTIMER6,
-	DMTIMER7,
-
-	TIMERS_MAX
-} am335x_timer_id_t;
-
-typedef struct am335x_timer {
-	am335x_timer_regs_t *regs;
-	am335x_timer_id_t id;
-} am335x_timer_t;
-
-extern errno_t am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id,
-    unsigned hz, unsigned srcclk_hz);
-extern void am335x_timer_intr_ack(am335x_timer_t *timer);
-extern void am335x_timer_reset(am335x_timer_t *timer);
-extern void am335x_timer_start(am335x_timer_t *timer);
-extern void am335x_timer_stop(am335x_timer_t *timer);
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/timer_regs.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/timer_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x DMTIMER memory mapped registers.
- */
-
-#ifndef _KERN_AM335X_TIMER_REGS_H_
-#define _KERN_AM335X_TIMER_REGS_H_
-
-#include <typedefs.h>
-
-typedef struct am335x_timer_regs {
-
-	/*
-	 * This read only register contains the
-	 * revision number of the module
-	 */
-	ioport32_t const tidr;
-#define AM335x_TIMER_TIDR_MINOR_MASK     0x3F
-#define AM335x_TIMER_TIDR_MINOR_SHIFT    0
-#define AM335x_TIMER_TIDR_CUSTOM_MASK    0x03
-#define AM335x_TIMER_TIDR_CUSTOM_SHIFT   6
-#define AM335x_TIMER_TIDR_MAJOR_MASK     0x07
-#define AM335x_TIMER_TIDR_MAJOR_SHIFT    8
-#define AM335x_TIMER_TIDR_RTL_MASK       0x1F
-#define AM335x_TIMER_TIDR_RTL_SHIFT      11
-#define AM335x_TIMER_TIDR_FUNC_MASK      0xFFF
-#define AM335x_TIMER_TIDR_FUNC_SHIFT     16
-#define AM335x_TIMER_TIDR_SCHEME_MASK    0x03
-#define AM335x_TIMER_TIDR_SCHEME_SHIFT   30
-
-	ioport32_t const pad1[3];
-
-	/*
-	 * This register allows controlling various
-	 * parameters of the OCP interface.
-	 */
-	ioport32_t tiocp_cfg;
-#define AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG    (1 << 0)
-#define AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG      (1 << 1)
-
-#define AM335x_TIMER_TIOCPCFG_IDLEMODE_MASK            0x02
-#define AM335x_TIMER_TIOCPCFG_IDLEMODE_SHIFT           2
-#  define AM335x_TIMER_TIOCCPCFG_IDLEMODE_FORCE        0x00
-#  define AM335x_TIMER_TIOCCPCFG_IDLEMODE_DISABLED     0x01
-#  define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART        0x02
-#  define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART_WAKEUP 0x03
-
-	ioport32_t const pad2[4];
-
-	ioport32_t irqstatus_raw;
-#define AM335x_TIMER_IRQSTATUS_RAW_MAT_FLAG     (1 << 0)
-#define AM335x_TIMER_IRQSTATUS_RAW_OVF_FLAG     (1 << 1)
-#define AM335x_TIMER_IRQSTATUS_RAW_TCAR_FLAG    (1 << 2)
-
-	ioport32_t irqstatus;
-#define AM335x_TIMER_IRQSTATUS_MAT_FLAG     (1 << 0)
-#define AM335x_TIMER_IRQSTATUS_OVF_FLAG     (1 << 1)
-#define AM335x_TIMER_IRQSTATUS_TCAR_FLAG    (1 << 2)
-
-	ioport32_t irqenable_set;
-#define AM335x_TIMER_IRQENABLE_SET_MAT_FLAG (1 << 0)
-#define AM335x_TIMER_IRQENABLE_SET_OVF_FLAG (1 << 1)
-#define AM335x_TIMER_IRQENABLE_SET_TCAR_FLAG (1 << 2)
-
-	ioport32_t irqenable_clr;
-#define AM335x_TIMER_IRQENABLE_CLR_MAT_FLAG (1 << 0)
-#define AM335x_TIMER_IRQENABLE_CLR_OVF_FLAG (1 << 1)
-#define AM335x_TIMER_IRQENABLE_CLR_TCAR_FLAG (1 << 2)
-
-	/* Timer IRQ wakeup enable register */
-	ioport32_t irqwakeen;
-#define AM335x_TIMER_IRQWAKEEN_MAT_FLAG     (1 << 0)
-#define AM335x_TIMER_IRQWAKEEN_OVF_FLAG     (1 << 1)
-#define AM335x_TIMER_IRQWAKEEN_TCAR_FLAG    (1 << 2)
-
-	/* Timer control register */
-	ioport32_t tclr;
-#define AM335x_TIMER_TCLR_ST_FLAG           (1 << 0)
-#define AM335x_TIMER_TCLR_AR_FLAG           (1 << 1)
-#define AM335x_TIMER_TCLR_PTV_MASK          0x07
-#define AM335x_TIMER_TCLR_PTV_SHIFT         2
-#define AM335x_TIMER_TCLR_PRE_FLAG          (1 << 5)
-#define AM335x_TIMER_TCLR_CE_FLAG           (1 << 6)
-#define AM335x_TIMER_TCLR_SCPWM_FLAG        (1 << 7)
-#define AM335x_TIMER_TCLR_TCM_MASK          0x03
-#define AM335x_TIMER_TCLR_TCM_SHIFT         8
-#define AM335x_TIMER_TCLR_TGR_MASK          0x03
-#define AM335x_TIMER_TCLR_TGR_SHIFT         10
-#define AM335x_TIMER_TCLR_PT_FLAG           (1 << 12)
-#define AM335x_TIMER_TCLR_CAPT_MODE_FLAG    (1 << 13)
-#define AM335x_TIMER_TCLR_GPO_CFG_FLAG      (1 << 14)
-
-	/* Timer counter register */
-	ioport32_t tcrr;
-
-	/* Timer load register */
-	ioport32_t tldr;
-
-	/* Timer trigger register */
-	ioport32_t const ttgr;
-
-	/* Timer write posted status register */
-	ioport32_t twps;
-#define AM335x_TIMER_TWPS_PEND_TCLR         (1 << 0)
-#define AM335x_TIMER_TWPS_PEND_TCRR         (1 << 1)
-#define AM335x_TIMER_TWPS_PEND_TLDR         (1 << 2)
-#define AM335x_TIMER_TWPS_PEND_TTGR         (1 << 3)
-#define AM335x_TIMER_TWPS_PEND_TMAR         (1 << 4)
-
-	/* Timer match register */
-	ioport32_t tmar;
-
-	/* Timer capture register */
-	ioport32_t tcar1;
-
-	/* Timer synchronous interface control register */
-	ioport32_t tsicr;
-#define AM335x_TIMER_TSICR_SFT_FLAG         (1 << 1)
-#define AM335x_TIMER_TSICR_POSTED_FLAG      (1 << 2)
-
-	/* Timer capture register */
-	ioport32_t tcar2;
-
-} am335x_timer_regs_t;
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/am335x/uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/am335x/uart.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x UART driver.
- */
-
-#ifndef _KERN_AM335X_UART_H_
-#define _KERN_AM335X_UART_H_
-
-#include <genarch/drivers/omap/uart.h>
-
-#define AM335x_UART0_BASE_ADDRESS    0x44E09000
-#define AM335x_UART0_SIZE            4096
-#define AM335x_UART0_IRQ             72
-
-#define AM335x_UART1_BASE_ADDRESS    0x48022000
-#define AM335x_UART1_SIZE            4096
-#define AM335x_UART1_IRQ             73
-
-#define AM335x_UART2_BASE_ADDRESS    0x48024000
-#define AM335x_UART2_SIZE            4096
-#define AM335x_UART2_IRQ             74
-
-#define AM335x_UART3_BASE_ADDRESS    0x481A6000
-#define AM335x_UART3_SIZE            4096
-#define AM335x_UART3_IRQ             44
-
-#define AM335x_UART4_BASE_ADDRESS    0x481A8000
-#define AM335x_UART4_SIZE            4096
-#define AM335x_UART4_IRQ             45
-
-#define AM335x_UART5_BASE_ADDRESS    0x481AA000
-#define AM335x_UART5_SIZE            4096
-#define AM335x_UART5_IRQ             46
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/amdm37x/gpt.h
===================================================================
--- kernel/genarch/include/genarch/drivers/amdm37x/gpt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,273 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM/DM37x MPU general purpose timer driver.
- */
-
-#ifndef KERN_AMDM37x_GPT_H_
-#define KERN_AMDM37x_GPT_H_
-
-#include <assert.h>
-#include <typedefs.h>
-#include <mm/km.h>
-#include <time/clock.h>
-
-/* AMDM37x TRM p. 2740 */
-#define AMDM37x_GPT1_BASE_ADDRESS  0x48318000
-#define AMDM37x_GPT1_SIZE  4096
-#define AMDM37x_GPT1_IRQ  37
-#define AMDM37x_GPT2_BASE_ADDRESS  0x49032000
-#define AMDM37x_GPT2_SIZE  4096
-#define AMDM37x_GPT2_IRQ  38
-#define AMDM37x_GPT3_BASE_ADDRESS  0x49034000
-#define AMDM37x_GPT3_SIZE  4096
-#define AMDM37x_GPT3_IRQ  39
-#define AMDM37x_GPT4_BASE_ADDRESS  0x49036000
-#define AMDM37x_GPT4_SIZE  4096
-#define AMDM37x_GPT4_IRQ  40
-#define AMDM37x_GPT5_BASE_ADDRESS  0x49038000
-#define AMDM37x_GPT5_SIZE  4096
-#define AMDM37x_GPT5_IRQ  41
-#define AMDM37x_GPT6_BASE_ADDRESS  0x4903a000
-#define AMDM37x_GPT6_SIZE  4096
-#define AMDM37x_GPT6_IRQ  42
-#define AMDM37x_GPT7_BASE_ADDRESS  0x4903c000
-#define AMDM37x_GPT7_SIZE  4096
-#define AMDM37x_GPT7_IRQ  43
-#define AMDM37x_GPT8_BASE_ADDRESS  0x4903e000
-#define AMDM37x_GPT8_SIZE  4096
-#define AMDM37x_GPT8_IRQ  44
-#define AMDM37x_GPT9_BASE_ADDRESS  0x49040000
-#define AMDM37x_GPT9_SIZE  4096
-#define AMDM37x_GPT9_IRQ  45
-#define AMDM37x_GPT10_BASE_ADDRESS  0x48086000
-#define AMDM37x_GPT10_SIZE  4096
-#define AMDM37x_GPT10_IRQ  46
-#define AMDM37x_GPT11_BASE_ADDRESS  0x48088000
-#define AMDM37x_GPT11_SIZE  4096
-#define AMDM37x_GPT11_IRQ  47
-
-/** GPT register map AMDM37x TRM p. 2740 */
-typedef struct {
-	/** IP revision */
-	const ioport32_t tidr;
-#define AMDM37x_GPT_TIDR_MINOR_MASK  (0xf)
-#define AMDM37x_GPT_TIDR_MINOR_SHIFT  (0)
-#define AMDM37x_GPT_TIDR_MAJOR_MASK  (0xf)
-#define AMDM37x_GPT_TIDR_MAJOR_SHIFT  (4)
-	uint32_t padd0_[3];
-
-	/** L4 Interface parameters */
-	ioport32_t tiocp_cfg;
-#define AMDM37x_GPT_TIOCP_CFG_AUTOIDLE_FLAG  (1 << 0)
-#define AMDM37x_GPT_TIOCP_CFG_SOFTRESET_FLAG  (1 << 1)
-#define AMDM37x_GPT_TIOCP_CFG_ENWAKEUP_FLAG  (1 << 2)
-#define AMDM37x_GPT_TIOCP_CFG_IDLEMODE_MASK  (0x3)
-#define AMDM37x_GPT_TIOCP_CFG_IDLEMODE_SHIFT  (3)
-#define AMDM37x_GPT_TIOCP_CFG_EMUFREE_FlAG  (1 << 5)
-#define AMDM37x_GPT_TIOCP_CFG_CLOCKACTIVITY_MASK  (0x3)
-#define AMDM37x_GPT_TIOCP_CFG_CLOCKACTIVITY_SHIFT (8)
-
-	/** Module status information, excluding irq */
-	const ioport32_t tistat;
-#define AMDM37x_GPT_TISTAT_RESET_DONE_FLAG  (1 << 0)
-
-	/** Interrupt status register */
-	ioport32_t tisr;
-#define AMDM37x_GPT_TISR_MAT_IRQ_FLAG  (1 << 0)
-#define AMDM37x_GPT_TISR_OVF_IRQ_FLAG  (1 << 1)
-#define AMDM37x_GPT_TISR_TCAR_IRQ_FLAG  (1 << 2)
-
-	/* Interrupt enable register */
-	ioport32_t tier;
-#define AMDM37x_GPT_TIER_MAT_IRQ_FLAG  (1 << 0)
-#define AMDM37x_GPT_TIER_OVF_IRQ_FLAG  (1 << 1)
-#define AMDM37x_GPT_TIER_TCAR_IRQ_FLAG  (1 << 2)
-
-	/** Wakeup enable register */
-	ioport32_t twer;
-#define AMDM37x_GPT_TWER_MAT_IRQ_FLAG  (1 << 0)
-#define AMDM37x_GPT_TWER_OVF_IRQ_FLAG  (1 << 1)
-#define AMDM37x_GPT_TWER_TCAR_IRQ_FLAG  (1 << 2)
-
-	/** Optional features control register */
-	ioport32_t tclr;
-#define AMDM37x_GPT_TCLR_ST_FLAG  (1 << 0)
-#define AMDM37x_GPT_TCLR_AR_FLAG  (1 << 1)
-#define AMDM37x_GPT_TCLR_PTV_MASK  (0x7)
-#define AMDM37x_GPT_TCLR_PTV_SHIFT  (2)
-#define AMDM37x_GPT_TCLR_PRE_FLAG  (1 << 5)
-#define AMDM37x_GPT_TCLR_CE_FLAG  (1 << 6)
-#define AMDM37x_GPT_TCLR_SCPWM  (1 << 7)
-#define AMDM37x_GPT_TCLR_TCM_MASK  (0x3 << 8)
-#define AMDM37x_GPT_TCLR_TCM_NO_CAPTURE   (0x0 << 8)
-#define AMDM37x_GPT_TCLR_TCM_RAISE_CAPTURE   (0x1 << 8)
-#define AMDM37x_GPT_TCLR_TCM_FALL_CAPTURE   (0x2 << 8)
-#define AMDM37x_GPT_TCLR_TCM_BOTH_CAPTURE   (0x3 << 8)
-#define AMDM37x_GPT_TCLR_TRG_MASK  (0x3 << 10)
-#define AMDM37x_GPT_TCLR_TRG_NO  (0x0 << 10)
-#define AMDM37x_GPT_TCLR_TRG_OVERFLOW  (0x1 << 10)
-#define AMDM37x_GPT_TCLR_TRG_OVERMATCH  (0x2 << 10)
-#define AMDM37x_GPT_TCLR_PT_FLAG  (1 << 12)
-#define AMDM37x_GPT_TCLR_CAPT_MODE_FLAG  (1 << 13)
-#define AMDM37x_GPT_TCLR_GPO_CFG_FLAG  (1 << 14)
-
-	/** Value of timer counter */
-	ioport32_t tccr;
-
-	/** Timer load register */
-	ioport32_t tldr;
-
-	/** Timer trigger register */
-	ioport32_t ttgr;
-
-	/** Write-posted pending register */
-	const ioport32_t twps;
-#define AMDM37x_GPT_TWPS_TCLR_FLAG  (1 << 0)
-#define AMDM37x_GPT_TWPS_TCRR_FLAG  (1 << 1)
-#define AMDM37x_GPT_TWPS_TLDR_FLAG  (1 << 2)
-#define AMDM37x_GPT_TWPS_TTGR_FLAG  (1 << 3)
-#define AMDM37x_GPT_TWPS_TMAR_FLAG  (1 << 4)
-#define AMDM37x_GPT_TWPS_TPIR_FLAG  (1 << 5)
-#define AMDM37x_GPT_TWPS_TNIR_FLAG  (1 << 6)
-#define AMDM37x_GPT_TWPS_TCVR_FLAG  (1 << 7)
-#define AMDM37x_GPT_TWPS_TOCR_FLAG  (1 << 8)
-#define AMDM37x_GPT_TWPS_TOWR_FLAG  (1 << 9)
-
-	/** Timer match register */
-	ioport32_t tmar;
-
-	/** Capture value 1 register */
-	const ioport32_t tcar1;
-
-	/** Software interface control register */
-	ioport32_t tsicr;
-#define AMDM37x_GPT_TSICR_SFT_FLAG  (1 << 1)
-#define AMDM37x_GPT_TSICR_POSTED_FLAG  (1 << 2)
-
-	/** Capture value 2 register */
-	const ioport32_t tcar2;
-
-	/* GPT1,2,10 only (used for 1ms time period generation) */
-
-	/** Positive increment register */
-	ioport32_t tpir;
-
-	/** Negative increment register */
-	ioport32_t tnir;
-
-	/** Counter value register */
-	ioport32_t tcvr;
-
-	/** Mask the tick interrupt for selected number of ticks */
-	ioport32_t tocr;
-
-	/** Number of masked overflow interrupts */
-	ioport32_t towr;
-} amdm37x_gpt_regs_t;
-
-typedef struct {
-	amdm37x_gpt_regs_t *regs;
-	bool special_available;
-} amdm37x_gpt_t;
-
-static inline void amdm37x_gpt_timer_ticks_init(
-    amdm37x_gpt_t *timer, uintptr_t ioregs, size_t iosize, unsigned hz)
-{
-	/* Set 32768 Hz clock as source */
-	// TODO find a nicer way to setup 32kHz clock source for timer1
-	// reg 0x48004C40 is CM_CLKSEL_WKUP see page 485 of the manual
-	ioport32_t *clksel = (void *) km_map(0x48004C40, 4, PAGE_SIZE,
-	    PAGE_NOT_CACHEABLE);
-	*clksel &= ~1;
-	km_unmap((uintptr_t)clksel, 4);
-
-	assert(timer);
-	/* Map control register */
-	timer->regs = (void *) km_map(ioregs, iosize, KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE);
-
-	/* Reset the timer */
-	timer->regs->tiocp_cfg |= AMDM37x_GPT_TIOCP_CFG_SOFTRESET_FLAG;
-
-	while (!(timer->regs->tistat & AMDM37x_GPT_TISTAT_RESET_DONE_FLAG))
-		;
-
-	/* Set autoreload */
-	timer->regs->tclr |= AMDM37x_GPT_TCLR_AR_FLAG;
-
-	timer->special_available = ((ioregs == AMDM37x_GPT1_BASE_ADDRESS) ||
-	    (ioregs == AMDM37x_GPT2_BASE_ADDRESS) ||
-	    (ioregs == AMDM37x_GPT10_BASE_ADDRESS));
-	/* Select reload value */
-	timer->regs->tldr = 0xffffffff - (32768 / hz) + 1;
-	/* Set current counter value */
-	timer->regs->tccr = 0xffffffff - (32768 / hz) + 1;
-
-	if (timer->special_available) {
-		/* Set values according to formula (manual p. 2733) */
-		/* Use temporary variables for easier debugging */
-		const uint32_t tpir =
-		    ((32768 / hz + 1) * 1000000) - (32768000L * (1000 / hz));
-		const uint32_t tnir =
-		    ((32768 / hz) * 1000000) - (32768000L * (1000 / hz));
-		timer->regs->tpir = tpir;
-		timer->regs->tnir = tnir;
-	}
-
-}
-
-static inline void amdm37x_gpt_timer_ticks_start(amdm37x_gpt_t *timer)
-{
-	assert(timer);
-	assert(timer->regs);
-	/* Enable overflow interrupt */
-	timer->regs->tier |= AMDM37x_GPT_TIER_OVF_IRQ_FLAG;
-	/* Start timer */
-	timer->regs->tclr |= AMDM37x_GPT_TCLR_ST_FLAG;
-}
-
-static inline bool amdm37x_gpt_irq_ack(amdm37x_gpt_t *timer)
-{
-	assert(timer);
-	assert(timer->regs);
-	/* Clear all pending interrupts */
-	const uint32_t tisr = timer->regs->tisr;
-	timer->regs->tisr = tisr;
-	return tisr != 0;
-}
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/amdm37x/irc.h
===================================================================
--- kernel/genarch/include/genarch/drivers/amdm37x/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM/DM37x MPU on-chip interrupt controller driver.
- */
-
-#ifndef KERN_AMDM37x_IRQC_H_
-#define KERN_AMDM37x_IRQC_H_
-
-/* AMDM37x TRM p. 1079 */
-#define AMDM37x_IRC_BASE_ADDRESS     0x48200000
-#define AMDM37x_IRC_SIZE             4096
-
-#define AMDM37x_IRC_IRQ_COUNT        96
-#define AMDM37x_IRC_IRQ_GROUPS_COUNT 3
-
-#define OMAP_IRC_IRQ_COUNT        AMDM37x_IRC_IRQ_COUNT
-#define OMAP_IRC_IRQ_GROUPS_COUNT AMDM37x_IRC_IRQ_GROUPS_COUNT
-
-#include <genarch/drivers/omap/irc.h>
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/amdm37x/uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/amdm37x/uart.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AMDM37x UART driver
- */
-
-#ifndef _AMDM37x_UART_H_
-#define _AMDM37x_UART_H_
-
-#include <genarch/drivers/omap/uart.h>
-
-/* AMDM37x TRM p. 2950 */
-#define AMDM37x_UART1_BASE_ADDRESS   0x4806a000
-#define AMDM37x_UART1_SIZE   1024
-#define AMDM37x_UART1_IRQ   72 /* AMDM37x TRM p. 2418 */
-
-#define AMDM37x_UART2_BASE_ADDRESS   0x4806b000
-#define AMDM37x_UART2_SIZE   1024
-#define AMDM37x_UART2_IRQ   73 /* AMDM37x TRM p. 2418 */
-
-#define AMDM37x_UART3_BASE_ADDRESS   0x49020000
-#define AMDM37x_UART3_SIZE   1024
-#define AMDM37x_UART3_IRQ   74 /* AMDM37x TRM p. 2418 */
-
-#define AMDM37x_UART4_BASE_ADDRESS   0x49042000
-#define AMDM37x_UART4_SIZE   1024
-#define AMDM37x_UART4_IRQ   80 /* AMDM37x TRM p. 2418 */
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/bcm2835/irc.h
===================================================================
--- kernel/genarch/include/genarch/drivers/bcm2835/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Broadcom BCM2835 on-chip interrupt controller driver.
- */
-
-#ifndef KERN_BCM2835_IRQC_H_
-#define KERN_BCM2835_IRQC_H_
-
-#include <assert.h>
-#include <typedefs.h>
-
-#define BANK_GPU0	0
-#define BANK_GPU1	1
-#define BANK_ARM	2
-
-#define IRQ_TO_BANK(x)	((x) >> 5)
-#define IRQ_TO_NUM(x)	((x) & 0x1f)
-
-#define MAKE_IRQ(b,n)	(((b) << 5) | ((n) & 0x1f))
-
-#define BCM2835_UART_IRQ	MAKE_IRQ(BANK_GPU1, 25)
-#define BCM2835_TIMER1_IRQ	MAKE_IRQ(BANK_GPU0,  1)
-
-#define IRQ_PEND_ARM_M		0xFF
-#define IRQ_PEND_GPU0_M		(1 << 8)
-#define IRQ_PEND_GPU1_M		(1 << 9)
-#define IRQ_PEND_SHORT_M	0x1FFC00
-#define IRQ_PEND_SHORT_S	10
-
-typedef struct {
-	ioport32_t	irq_basic_pending;
-	ioport32_t	irq_pending1;
-	ioport32_t	irq_pending2;
-
-	ioport32_t	fiq_control;
-
-	ioport32_t	irq_enable[3];
-	ioport32_t	irq_disable[3];
-} bcm2835_irc_t;
-
-#define BCM2835_IRC_ADDR 0x2000b200
-#define BCM2835_IRQ_COUNT 96
-
-extern void bcm2835_irc_init(bcm2835_irc_t *);
-extern unsigned bcm2835_irc_inum_get(bcm2835_irc_t *);
-extern void bcm2835_irc_enable(bcm2835_irc_t *, unsigned);
-extern void bcm2835_irc_disable(bcm2835_irc_t *, unsigned);
-
-#endif /* KERN_BCM2835_IRQC_H_ */
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/bcm2835/mbox.h
===================================================================
--- kernel/genarch/include/genarch/drivers/bcm2835/mbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief BCM2835 mailbox communication routines
- */
-
-#ifndef _BCM2835_MBOX_H_
-#define _BCM2835_MBOX_H_
-
-#include <genarch/fb/fb.h>
-#include <arch/mm/page.h>
-#include <align.h>
-
-#define BCM2835_MBOX0_ADDR	0x2000B880
-
-enum {
-	MBOX_CHAN_PM		= 0,
-	MBOX_CHAN_FB		= 1,
-	MBOX_CHAN_UART		= 2,
-	MBOX_CHAN_VCHIQ		= 3,
-	MBOX_CHAN_LED		= 4,
-	MBOX_CHAN_BTN		= 5,
-	MBOX_CHAN_TS		= 6,
-	MBOX_CHAN_PROP_A2V	= 8,
-	MBOX_CHAN_PROP_V2A	= 9
-};
-
-enum {
-	TAG_GET_FW_REV		= 0x00000001,
-	TAG_GET_BOARD_MODEL	= 0x00010001,
-	TAG_GET_BOARD_REV	= 0x00010002,
-	TAG_GET_BOARD_MAC	= 0x00010003,
-	TAG_GET_BOARD_SERIAL	= 0x00010004,
-	TAG_GET_ARM_MEMORY	= 0x00010005,
-	TAG_GET_VC_MEMORY	= 0x00010006,
-	TAG_GET_CLOCKS		= 0x00010007,
-	TAG_GET_CMD_LINE	= 0x00050001,
-};
-
-enum {
-	MBOX_TAG_GET_PHYS_W_H	= 0x00040003,
-	MBOX_TAG_SET_PHYS_W_H	= 0x00048003,
-	MBOX_TAG_GET_VIRT_W_H	= 0x00040004,
-	MBOX_TAG_SET_VIRT_W_G	= 0x00048004
-};
-
-enum {
-	MBOX_PROP_CODE_REQ	= 0x00000000,
-	MBOX_PROP_CODE_RESP_OK	= 0x80000000,
-	MBOX_PROP_CODE_RESP_ERR	= 0x80000001
-};
-
-#define MBOX_STATUS_FULL	(1 << 31)
-#define MBOX_STATUS_EMPTY	(1 << 30)
-
-#define MBOX_COMPOSE(chan, value) (((chan) & 0xf) | ((value) & ~0xf))
-#define MBOX_MSG_CHAN(msg)	((msg) & 0xf)
-#define MBOX_MSG_VALUE(msg)	((msg) & ~0xf)
-
-#define KA2VCA(addr)		(KA2PA(addr) + 0x40000000)
-
-#define MBOX_ADDR_ALIGN		16
-
-#define MBOX_BUFF_ALLOC(name, type)					\
-	char tmp_ ## name[sizeof(type) + MBOX_ADDR_ALIGN] = { 0 };      \
-	type *name = (type *)ALIGN_UP((uintptr_t)tmp_ ## name, MBOX_ADDR_ALIGN);
-
-typedef struct {
-	ioport32_t read;
-	ioport32_t unused[3];
-	ioport32_t peek;
-	ioport32_t sender;
-	ioport32_t status;
-	ioport32_t config;
-	ioport32_t write;
-} bcm2835_mbox_t;
-
-typedef struct {
-	ioport32_t size;
-	ioport32_t code;
-} mbox_prop_buf_hdr_t;
-
-typedef struct {
-	ioport32_t tag_id;
-	ioport32_t buf_size;
-	ioport32_t val_len;
-} mbox_tag_hdr_t;
-
-typedef struct {
-	ioport32_t base;
-	ioport32_t size;
-} mbox_tag_getmem_resp_t;
-
-typedef struct {
-	mbox_prop_buf_hdr_t	buf_hdr;
-	mbox_tag_hdr_t		tag_hdr;
-	mbox_tag_getmem_resp_t	data;
-	uint32_t		zero;
-} mbox_getmem_buf_t;
-
-typedef struct {
-	mbox_prop_buf_hdr_t	buf_hdr;
-	mbox_tag_hdr_t		tag_hdr;
-	struct {
-		uint32_t	width;
-		uint32_t	height;
-	} body;
-	uint32_t zero;
-} mbox_getfbsize_buf_t;
-
-typedef struct {
-	ioport32_t width;
-	ioport32_t height;
-	ioport32_t virt_width;
-	ioport32_t virt_height;
-	ioport32_t pitch;
-	ioport32_t bpp;
-	ioport32_t x_offset;
-	ioport32_t y_offset;
-	ioport32_t addr;
-	ioport32_t size;
-} bcm2835_fb_desc_t;
-
-extern bool bcm2835_prop_get_memory(uint32_t *base, uint32_t *size);
-extern bool bcm2835_fb_init(fb_properties_t *prop, uint32_t width, uint32_t heigth);
-extern bool bcm2835_mbox_get_fb_size(uint32_t *h, uint32_t *w);
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/bcm2835/timer.h
===================================================================
--- kernel/genarch/include/genarch/drivers/bcm2835/timer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Broadcom BCM2835 system timer driver.
- */
-
-#ifndef KERN_BCM2835_TIMER_H_
-
-#include <assert.h>
-#include <typedefs.h>
-#include <mm/km.h>
-
-#define BCM2835_TIMER_ADDR 0x20003000
-#define BCM2835_CLOCK_FREQ 1000000
-
-typedef struct {
-	/** System Timer Control/Status */
-	ioport32_t cs;
-#define BCM2835_TIMER_CS_M0 (1 << 0)
-#define BCM2835_TIMER_CS_M1 (1 << 1)
-#define BCM2835_TIMER_CS_M2 (1 << 2)
-#define BCM2835_TIMER_CS_M3 (1 << 3)
-	/** System Timer Counter Lower 32 bits */
-	ioport32_t clo;
-	/** System Timer Counter Higher 32 bits */
-	ioport32_t chi;
-	/** System Timer Compare 0 */
-	ioport32_t c0;
-	/** System Timer Compare 1 */
-	ioport32_t c1;
-	/** System Timer Compare 2 */
-	ioport32_t c2;
-	/** System Timer Compare 3 */
-	ioport32_t c3;
-} bcm2835_timer_t;
-
-extern void bcm2835_timer_start(bcm2835_timer_t *);
-extern void bcm2835_timer_irq_ack(bcm2835_timer_t *);
-
-#endif /* KERN_BCM2835_TIMER_H_ */
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/dsrln/dsrlnin.h
===================================================================
--- kernel/genarch/include/genarch/drivers/dsrln/dsrlnin.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Dummy serial line input.
- */
-
-#ifndef KERN_DSRLNIN_H_
-#define KERN_DSRLNIN_H_
-
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-typedef struct {
-	ioport8_t data;
-} __attribute__((packed)) dsrlnin_t;
-
-typedef struct {
-	irq_t irq;
-	dsrlnin_t *dsrlnin;
-	indev_t *srlnin;
-} dsrlnin_instance_t;
-
-extern dsrlnin_instance_t *dsrlnin_init(dsrlnin_t *, inr_t);
-extern void dsrlnin_wire(dsrlnin_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/dsrln/dsrlnout.h
===================================================================
--- kernel/genarch/include/genarch/drivers/dsrln/dsrlnout.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Dummy serial line output.
- */
-
-#ifndef KERN_DSRLNOUT_H_
-#define KERN_DSRLNOUT_H_
-
-#include <typedefs.h>
-#include <stdint.h>
-#include <console/chardev.h>
-
-extern outdev_t *dsrlnout_init(ioport8_t *, uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/ega/ega.h
===================================================================
--- kernel/genarch/include/genarch/drivers/ega/ega.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_EGA_H_
-#define KERN_EGA_H_
-
-#include <typedefs.h>
-#include <console/chardev.h>
-
-#define EGA_COLS       80
-#define EGA_ROWS       25
-#define EGA_SCREEN     (EGA_COLS * EGA_ROWS)
-#define EGA_VRAM_SIZE  (2 * EGA_SCREEN)
-
-/* EGA device registers. */
-#define EGA_INDEX_REG  0
-#define EGA_DATA_REG   1
-
-extern outdev_t *ega_init(ioport8_t *, uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/gicv2/gicv2.h
===================================================================
--- kernel/genarch/include/genarch/drivers/gicv2/gicv2.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup genarch
- * @{
- */
-/** @file
- * @brief ARM Generic Interrupt Controller, Architecture version 2.0.
- */
-
-#ifndef KERN_GICV2_H_
-#define KERN_GICV2_H_
-
-#include <typedefs.h>
-
-/** GICv2 distributor register map. */
-typedef struct {
-	/** Distributor control register. */
-	ioport32_t ctlr;
-#define GICV2D_CTLR_ENABLE_FLAG  0x1
-
-	/** Interrupt controller type register. */
-	const ioport32_t typer;
-#define GICV2D_TYPER_IT_LINES_NUMBER_SHIFT  0
-#define GICV2D_TYPER_IT_LINES_NUMBER_MASK \
-	(0x1f << GICV2D_TYPER_IT_LINES_NUMBER_SHIFT)
-
-	/** Distributor implementer identification register. */
-	const ioport32_t iidr;
-	/** Reserved. */
-	ioport32_t res_[5];
-	/** Implementation defined registers. */
-	ioport32_t impl[8];
-	/** Reserved. */
-	ioport32_t res2_[16];
-	/** Interrupt group registers. */
-	ioport32_t igroupr[32];
-	/** Interrupt set-enable registers. */
-	ioport32_t isenabler[32];
-	/** Interrupt clear-enable registers. */
-	ioport32_t icenabler[32];
-	/** Interrupt set-pending registers. */
-	ioport32_t ispendr[32];
-	/** Interrupt clear-pending registers. */
-	ioport32_t icpendr[32];
-	/** GICv2 interrupt set-active registers. */
-	ioport32_t isactiver[32];
-	/** Interrupt clear-active registers. */
-	ioport32_t icactiver[32];
-	/** Interrupt priority registers. */
-	ioport32_t ipriorityr[255];
-	/** Reserved. */
-	ioport32_t res3_;
-	/** Interrupt processor target registers. First 8 words are read-only.
-	 */
-	ioport32_t itargetsr[255];
-	/** Reserved. */
-	ioport32_t res4_;
-	/** Interrupt configuration registers. */
-	ioport32_t icfgr[64];
-	/** Implementation defined registers. */
-	ioport32_t impl2[64];
-	/** Non-secure access control registers. */
-	ioport32_t nsacr[64];
-	/** Software generated interrupt register. */
-	ioport32_t sgir;
-	/** Reserved. */
-	ioport32_t res5_[3];
-	/** SGI clear-pending registers. */
-	ioport32_t cpendsgir[4];
-	/** SGI set-pending registers. */
-	ioport32_t spendsgir[4];
-	/** Reserved. */
-	ioport32_t res6_[40];
-	/** Implementation defined identification registers. */
-	const ioport32_t impl3[12];
-} gicv2_distr_regs_t;
-
-/* GICv2 CPU interface register map. */
-typedef struct {
-	/** CPU interface control register. */
-	ioport32_t ctlr;
-#define GICV2C_CTLR_ENABLE_FLAG  0x1
-
-	/** Interrupt priority mask register. */
-	ioport32_t pmr;
-	/** Binary point register. */
-	ioport32_t bpr;
-	/** Interrupt acknowledge register. */
-	const ioport32_t iar;
-#define GICV2C_IAR_INTERRUPT_ID_SHIFT  0
-#define GICV2C_IAR_INTERRUPT_ID_MASK \
-	(0x3ff << GICV2C_IAR_INTERRUPT_ID_SHIFT)
-#define GICV2C_IAR_CPUID_SHIFT  10
-#define GICV2C_IAR_CPUID_MASK \
-	(0x7 << GICV2C_IAR_CPUID_SHIFT)
-
-	/** End of interrupt register. */
-	ioport32_t eoir;
-	/** Running priority register. */
-	const ioport32_t rpr;
-	/** Highest priority pending interrupt register. */
-	const ioport32_t hppir;
-	/** Aliased binary point register. */
-	ioport32_t abpr;
-	/** Aliased interrupt acknowledge register. */
-	const ioport32_t aiar;
-	/** Aliased end of interrupt register. */
-	ioport32_t aeoir;
-	/** Aliased highest priority pending interrupt register. */
-	const ioport32_t ahppir;
-	/** Reserved. */
-	ioport32_t res_[5];
-	/** Implementation defined registers. */
-	ioport32_t impl[36];
-	/** Active priorities registers. */
-	ioport32_t apr[4];
-	/** Non-secure active priorities registers. */
-	ioport32_t nsapr[4];
-	/** Reserved. */
-	ioport32_t res2_[3];
-	/** CPU interface identification register. */
-	const ioport32_t iidr;
-	/** Unallocated. */
-	ioport32_t unalloc_[960];
-	/** Deactivate interrupt register. */
-	ioport32_t dir;
-} gicv2_cpui_regs_t;
-
-/** GICv2 driver-specific device data. */
-typedef struct {
-	gicv2_distr_regs_t *distr;
-	gicv2_cpui_regs_t *cpui;
-	unsigned inum_total;
-} gicv2_t;
-
-extern void gicv2_init(gicv2_t *, gicv2_distr_regs_t *, gicv2_cpui_regs_t *);
-extern unsigned gicv2_inum_get_total(gicv2_t *);
-extern void gicv2_inum_get(gicv2_t *, unsigned *, unsigned *);
-extern void gicv2_end(gicv2_t *, unsigned, unsigned);
-extern void gicv2_enable(gicv2_t *, unsigned);
-extern void gicv2_disable(gicv2_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/i8042/i8042.h
===================================================================
--- kernel/genarch/include/genarch/drivers/i8042/i8042.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_I8042_H_
-#define KERN_I8042_H_
-
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-typedef struct {
-	ioport8_t data;
-	uint8_t pad[3];
-	ioport8_t status;
-} __attribute__((packed)) i8042_t;
-
-typedef struct {
-	irq_t irq;
-	i8042_t *i8042;
-	indev_t *kbrdin;
-} i8042_instance_t;
-
-extern i8042_instance_t *i8042_init(i8042_t *, inr_t);
-extern void i8042_wire(i8042_instance_t *, indev_t *);
-extern void i8042_cpu_reset(i8042_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/i8259/i8259.h
===================================================================
--- kernel/genarch/include/genarch/drivers/i8259/i8259.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_I8259_H_
-#define KERN_I8259_H_
-
-#include <typedefs.h>
-#include <arch/interrupt.h>
-#include <genarch/pic/pic_ops.h>
-#include <stdbool.h>
-
-typedef struct {
-	ioport8_t port1;
-	ioport8_t port2;
-} __attribute__((packed)) i8259_t;
-
-extern pic_ops_t i8259_pic_ops;
-
-extern void i8259_init(i8259_t *, i8259_t *, unsigned int);
-extern void i8259_enable_irqs(uint16_t);
-extern void i8259_disable_irqs(uint16_t);
-extern void i8259_eoi(unsigned int);
-extern bool i8259_is_spurious(unsigned int);
-extern void i8259_handle_spurious(unsigned int);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/legacy/ia32/io.h
===================================================================
--- kernel/genarch/include/genarch/drivers/legacy/ia32/io.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- * @brief This file contains definitions used by architectures with the
- *        ia32 legacy I/O space (i.e. ia32, amd64 and ia64).
- */
-
-#ifndef KERN_LEGACY_IA32_IO_H
-#define KERN_LEGACY_IA32_IO_H
-
-#include <typedefs.h>
-
-#define I8042_BASE    ((ioport8_t *) 0x60)
-#define EGA_BASE      ((ioport8_t *) 0x3d4)
-#define NS16550_BASE  ((ioport8_t *) 0x3f8)
-
-#define I8259_PIC0_BASE ((ioport8_t *) 0x20U)
-#define I8259_PIC1_BASE ((ioport8_t *) 0xA0U)
-
-#define EGA_VIDEORAM  0xb8000
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/ns16550/ns16550.h
===================================================================
--- kernel/genarch/include/genarch/drivers/ns16550/ns16550.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Headers for NS 16550 serial controller.
- */
-
-#ifndef KERN_NS16550_H_
-#define KERN_NS16550_H_
-
-#include <ddi/ddi.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-#include <console/chardev.h>
-
-#define NS156440_CLOCK    115200 /** Internal clock speed, max. baud rate. */
-
-#define IER_ERBFI         0x01   /** Enable Receive Buffer Full Interrupt. */
-#define MCR_OUT2          0x08   /** OUT2. */
-
-#define LCR_DLAB          0x80   /** Divisor Latch Access bit. */
-#define LCR_SBE           0x40   /** RS-232 Break Signal bit. */
-
-#define LCR_PARITY_NONE   0x00   /** No parity bit. */
-#define LCR_PARITY_ODD    0x08   /** Odd parity. */
-#define LCR_PARITY_EVEN   0x18   /** Even parity. */
-#define LCR_PARITY_MARK   0x28   /** Parity bit always one. */
-#define LCR_PARITY_SPACE  0x38   /** Parity bit always zero. */
-
-#define LCR_STOP_BIT_ONE  0x00   /** One stop bit. */
-#define LCR_STOP_BIT_TWO  0x04   /** Two stop bits. */
-
-#define LCR_WORD_LEN_5    0x00   /** 5-bit word length. */
-#define LCR_WORD_LEN_6    0x01   /** 6-bit word length. */
-#define LCR_WORD_LEN_7    0x02   /** 7-bit word length. */
-#define LCR_WORD_LEN_8    0x03   /** 8-bit word length. */
-
-/** NS16550 registers. */
-typedef enum {
-	NS16550_REG_RBR = 0,  /**< Receiver Buffer Register (read). */
-	NS16550_REG_THR = 0,  /**< Transmitter Holder Register (write). */
-	NS16550_REG_DLL = 0,  /**< Baud rate divisor latch low byte (write). */
-	NS16550_REG_IER = 1,  /**< Interrupt Enable Register. */
-	NS16550_REG_DLH = 1,  /**< Baud rate divisor latch high byte (write). */
-	NS16550_REG_IIR = 2,  /**< Interrupt Ident Register (read). */
-	NS16550_REG_FCR = 2,  /**< FIFO control register (write). */
-	NS16550_REG_LCR = 3,  /**< Line Control register. */
-	NS16550_REG_MCR = 4,  /**< Modem Control Register. */
-	NS16550_REG_LSR = 5,  /**< Line Status Register. */
-} ns16550_reg_t;
-
-/** Structure representing the ns16550 device. */
-typedef struct {
-	irq_t irq;
-	volatile ioport8_t *ns16550;
-	indev_t *input;
-	outdev_t *output;
-	parea_t parea;
-	int reg_shift;
-} ns16550_instance_t;
-
-extern ns16550_instance_t *ns16550_init(ioport8_t *, unsigned, inr_t, cir_t,
-    void *, outdev_t **);
-extern void ns16550_format_set(ns16550_instance_t *, unsigned, uint8_t);
-extern void ns16550_wire(ns16550_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/omap/irc.h
===================================================================
--- kernel/genarch/include/genarch/drivers/omap/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,300 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-
-/**
- * @file
- * @brief Texas Instruments OMAP on-chip interrupt controller driver.
- */
-
-#ifndef KERN_OMAP_IRQC_H_
-#define KERN_OMAP_IRQC_H_
-
-#include <assert.h>
-#include <typedefs.h>
-
-#define OMAP_IRC_IRQ_GROUPS_PAD (4 - OMAP_IRC_IRQ_GROUPS_COUNT)
-
-typedef struct {
-	const ioport32_t revision;
-#define OMAP_IRC_REV_MASK 0xFF
-
-	const uint8_t padd0[12];
-
-	/*
-	 * This register controls the various parameters
-	 * of the OCP interface.
-	 */
-	ioport32_t sysconfig;
-#define OMAP_IRC_SYSCONFIG_AUTOIDLE_FLAG   (1 << 0)
-#define OMAP_IRC_SYSCONFIG_SOFTRESET_FLAG  (1 << 1)
-
-	/* This register provides status information about the module */
-	const ioport32_t sysstatus;
-#define OMAP_IRC_SYSSTATUS_RESET_DONE_FLAG (1 << 0)
-
-	const uint8_t padd1[40];
-
-	/* This register supplies the currently active IRQ interrupt number */
-	ioport32_t sir_irq;
-#define OMAP_IRC_SIR_IRQ_ACTIVEIRQ_MASK       0x7F
-#define OMAP_IRC_SIR_IRQ_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
-
-	/* This register supplies the currently active FIQ interrupt number */
-	const ioport32_t sir_fiq;
-#define OMAP_IRC_FIQ_IRQ_ACTIVEFIQ_MASK       0x7F
-#define OMAP_IRC_FIQ_IRQ_SPURIOUSFIQFLAG_MASK 0xFFFFFFF8
-
-	/* This register contains the new interrupt agreement bits */
-	ioport32_t control;
-#define OMAP_IRC_CONTROL_NEWIRQAGR_FLAG       (1 << 0)
-#define OMAP_IRC_CONTROL_NEWFIQAGR_FLAG       (1 << 1)
-
-	/*
-	 * This register controls protection of the other registers.
-	 * This register can only be accessed in priviledged mode, regardless
-	 * of the current value of the protection bit.
-	 */
-	ioport32_t protection;
-#define OMAP_IRC_PROTECTION_FLAG              (1 << 0)
-
-	/*
-	 * This register controls the clock auto-idle for the functional
-	 * clock and the input synchronizers.
-	 */
-	ioport32_t idle;
-#define OMAP_IRC_IDLE_FUNCIDLE_FLAG           (1 << 0)
-#define OMAP_IRC_IDLE_TURBO_FLAG              (1 << 1)
-
-	const uint8_t padd2[12];
-
-	/* This register supplies the currently active IRQ priority level */
-	const ioport32_t irq_priority;
-#define OMAP_IRC_IRQ_PRIORITY_IRQPRIORITY_MASK     0x7F
-#define OMAP_IRC_IRQ_PRIORITY_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
-
-	/* This register supplies the currently active FIQ priority level */
-	const ioport32_t fiq_priority;
-#define OMAP_IRC_FIQ_PRIORITY_FIQPRIORITY_MASK     0x7F
-#define OMAP_IRC_FIQ_PRIORITY_SPURIOUSIRQFLAG_MASK 0xFFFFFFF8
-
-	/* This register sets the priority threshold */
-	ioport32_t threshold;
-#define OMAP_IRC_THRESHOLD_PRIORITYTHRESHOLD_MASK     0xFF
-#define OMAP_IRC_THRESHOLD_PRIORITYTHRESHOLD_ENABLED  0x00
-#define OMAP_IRC_THRESHOLD_PRIORITYTHRESHOLD_DISABLED 0xFF
-
-	const uint8_t padd3[20];
-
-	struct {
-		/* Raw interrupt input status before masking */
-		const ioport32_t itr;
-
-		/* Interrupt mask */
-		ioport32_t mir;
-
-		/*
-		 * This register is used to clear the interrupt mask bits,
-		 * Write 1 clears the mask bit to 0.
-		 */
-		ioport32_t mir_clear;
-
-		/*
-		 * This register is used to set the interrupt mask bits,
-		 * Write 1 sets the mask bit to 1.
-		 */
-		ioport32_t mir_set;
-
-		/*
-		 * This register is used to set the software interrupt bits,
-		 * it is also used to read the current active software
-		 * interrupts.
-		 * Write 1 sets the software interrups bits to 1.
-		 */
-		ioport32_t isr_set;
-
-		/*
-		 * This register is used to clear the software interrups bits.
-		 * Write 1 clears the software interrupt bits to 0.
-		 */
-		ioport32_t isr_clear;
-
-		/* This register contains the IRQ status after masking. */
-		const ioport32_t pending_irq;
-
-		/* This register contains the FIQ status after masking. */
-		const ioport32_t pending_fiq;
-	} interrupts[OMAP_IRC_IRQ_GROUPS_COUNT];
-
-	const uint32_t padd4[8 * OMAP_IRC_IRQ_GROUPS_PAD];
-
-	/*
-	 * These registers contain the priority for the interrups and
-	 * the FIQ/IRQ steering.
-	 */
-	ioport32_t ilr[OMAP_IRC_IRQ_COUNT];
-
-} omap_irc_regs_t;
-
-/* 0 = Interrupt routed to IRQ, 1 = interrupt routed to FIQ */
-#define OMAP_IRC_ILR_FIQNIRQ_FLAG    (1 << 0)
-#define OMAP_IRC_ILR_PRIORITY_MASK   0x3F
-#define OMAP_IRC_ILR_PRIORITY_SHIFT  2
-
-static inline void omap_irc_init(omap_irc_regs_t *regs)
-{
-	int i;
-
-	/* Initialization sequence */
-
-	/*
-	 * 1 - Program the SYSCONFIG register: if necessary, enable the
-	 *     autogating by setting the AUTOIDLE bit.
-	 */
-	regs->sysconfig &= ~OMAP_IRC_SYSCONFIG_AUTOIDLE_FLAG;
-
-	/*
-	 * 2 - Program the IDLE register: if necessary, disable functional
-	 *     clock autogating or enable synchronizer autogating by setting
-	 *     the FUNCIDLE bit or the TURBO bit accordingly.
-	 */
-	regs->idle &= ~OMAP_IRC_IDLE_FUNCIDLE_FLAG;
-	regs->idle &= ~OMAP_IRC_IDLE_TURBO_FLAG;
-
-	/*
-	 * 3 - Program ILRm register for each interrupt line: Assign a
-	 *     priority level and set the FIQNIRQ bit for an FIQ interrupt
-	 *     (by default, interrupts are mapped to IRQ and
-	 *     priority is 0 (highest).
-	 */
-
-	for (i = 0; i < OMAP_IRC_IRQ_COUNT; ++i)
-		regs->ilr[i] = 0;
-
-	/*
-	 * 4 - Program the MIRn register: Enable interrupts (by default,
-	 *     all interrupt lines are masked).
-	 */
-	for (i = 0; i < OMAP_IRC_IRQ_GROUPS_COUNT; ++i)
-		regs->interrupts[i].mir_set = 0xFFFFFFFF;
-}
-
-/** Get the currently active IRQ interrupt number
- *
- * @param regs     Pointer to the irc memory mapped registers
- *
- * @return         The active IRQ interrupt number
- */
-static inline unsigned omap_irc_inum_get(omap_irc_regs_t *regs)
-{
-	return regs->sir_irq & OMAP_IRC_SIR_IRQ_ACTIVEIRQ_MASK;
-}
-
-/** Reset IRQ output and enable new IRQ generation
- *
- * @param regs    Pointer to the irc memory mapped registers
- */
-static inline void omap_irc_irq_ack(omap_irc_regs_t *regs)
-{
-	regs->control = OMAP_IRC_CONTROL_NEWIRQAGR_FLAG;
-}
-
-/** Reset FIQ output and enable new FIQ generation
- *
- * @param regs    Pointer to the irc memory mapped registers
- */
-static inline void omap_irc_fiq_ack(omap_irc_regs_t *regs)
-{
-	regs->control = OMAP_IRC_CONTROL_NEWFIQAGR_FLAG;
-}
-
-/** Clear an interrupt mask bit
- *
- * @param regs    Pointer to the irc memory mapped registers
- * @param inum    The interrupt to be enabled
- */
-static inline void omap_irc_enable(omap_irc_regs_t *regs, unsigned inum)
-{
-	assert(inum < OMAP_IRC_IRQ_COUNT);
-	const unsigned set = inum / 32;
-	const unsigned pos = inum % 32;
-	regs->interrupts[set].mir_clear = (1 << pos);
-}
-
-/** Set an interrupt mask bit
- *
- * @param regs    Pointer to the irc memory mapped registers
- * @param inum    The interrupt to be disabled
- */
-static inline void omap_irc_disable(omap_irc_regs_t *regs, unsigned inum)
-{
-	assert(inum < OMAP_IRC_IRQ_COUNT);
-	const unsigned set = inum / 32;
-	const unsigned pos = inum % 32;
-	regs->interrupts[set].mir_set = (1 << pos);
-}
-
-static inline void omap_irc_dump(omap_irc_regs_t *regs)
-{
-#define DUMP_REG(name) \
-	printf("%s %p(%x).\n", #name, &regs->name, regs->name);
-
-	DUMP_REG(revision);
-	DUMP_REG(sysconfig);
-	DUMP_REG(sysstatus);
-	DUMP_REG(sir_irq);
-	DUMP_REG(sir_fiq);
-	DUMP_REG(control);
-	DUMP_REG(protection);
-	DUMP_REG(idle);
-	DUMP_REG(irq_priority);
-	DUMP_REG(fiq_priority);
-	DUMP_REG(threshold);
-
-	for (int i = 0; i < OMAP_IRC_IRQ_GROUPS_COUNT; ++i) {
-		DUMP_REG(interrupts[i].itr);
-		DUMP_REG(interrupts[i].mir);
-		DUMP_REG(interrupts[i].isr_set);
-		DUMP_REG(interrupts[i].pending_irq);
-		DUMP_REG(interrupts[i].pending_fiq);
-	}
-	for (int i = 0; i < OMAP_IRC_IRQ_COUNT; ++i) {
-		DUMP_REG(ilr[i]);
-	}
-
-#undef DUMP_REG
-}
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/omap/uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/omap/uart.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments OMAP UART driver.
- */
-
-#ifndef _KERN_OMAP_UART_H_
-#define _KERN_OMAP_UART_H_
-
-#include "uart_regs.h"
-
-typedef struct {
-	omap_uart_regs_t *regs;
-	indev_t *indev;
-	outdev_t outdev;
-	irq_t irq;
-} omap_uart_t;
-
-extern bool omap_uart_init(omap_uart_t *uart, inr_t interrupt,
-    uintptr_t addr, size_t size);
-
-extern void omap_uart_input_wire(omap_uart_t *uart, indev_t *indev);
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/omap/uart_regs.h
===================================================================
--- kernel/genarch/include/genarch/drivers/omap/uart_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,430 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments OMAP UART memory mapped registers.
- */
-
-#ifndef _KERN_OMAP_UART_REGS_H_
-#define _KERN_OMAP_UART_REGS_H_
-
-#include <typedefs.h>
-#include <console/chardev.h>
-#include <ddi/irq.h>
-
-typedef struct {
-	union {
-		/** Stores lower part of the 14-bit baud divisor */
-		ioport32_t dll;
-#define OMAP_UART_DLL_MASK   (0xff)
-
-		/** Receive holding register */
-		const ioport32_t rhr;
-#define OMAP_UART_RHR_MASK   (0xff)
-
-		/** Transmit holding register */
-		ioport32_t thr;
-#define OMAP_UART_THR_MASK   (0xff)
-	};
-
-	union {
-		/** Stores higher part of the 14-bit baud divisor */
-		ioport32_t dlh;
-#define OMAP_UART_DLH_MASK   (0x1f)
-
-		/** Interrupt enable registers */
-		ioport32_t ier;
-#define OMAP_UART_IER_RHR_IRQ_FLAG   (1 << 0)
-#define OMAP_UART_IER_THR_IRQ_FLAG   (1 << 1)
-#define OMAP_UART_IER_LINE_STS_IRQ_FLAG   (1 << 2)
-#define OMAP_UART_IER_MODEM_STS_IRQ_FLAG   (1 << 3)
-#define OMAP_UART_IER_SLEEP_MODE_FLAG   (1 << 4)
-#define OMAP_UART_IER_XOFF_IRQ_FLAG   (1 << 5)
-#define OMAP_UART_IER_RTS_IRQ_FLAG   (1 << 6)
-#define OMAP_UART_IER_CTS_IRQ_FLAG   (1 << 7)
-
-#define OMAP_CIR_IER_RHR_IRQ_FLAG   (1 << 0)
-#define OMAP_CIR_IER_THR_IRQ_FLAG   (1 << 1)
-#define OMAP_CIR_IER_RX_STOP_IRQ_FLAG   (1 << 2)
-#define OMAP_CIR_IER_RX_OVERRUN_IRQ_FLAG   (1 << 3)
-#define OMAP_CIR_IER_TX_STS_IRQ_FLAG   (1 << 5)
-
-#define OMAP_IRDA_IER_RHR_IRQ_FLAG   (1 << 0)
-#define OMAP_IRDA_IER_THR_IRQ_FLAG   (1 << 1)
-#define OMAP_IRDA_IER_LAST_RX_BYTE_IRQ_FLAG   (1 << 2)
-#define OMAP_IRDA_IER_RX_OVERRUN_IRQ_FLAG   (1 << 3)
-#define OMAP_IRDA_IER_STS_FIFO_TRIG_IRQ_FLAG   (1 << 4)
-#define OMAP_IRDA_IER_TX_STS_IRQ_FLAG   (1 << 5)
-#define OMAP_IRDA_IER_LINE_STS_IRQ_FLAG   (1 << 6)
-#define OMAP_IRDA_IER_EOF_IRQ_FLAG   (1 << 7)
-	};
-
-	union {
-		/** Interrupt identification register */
-		const ioport32_t iir;
-#define OMAP_UART_IIR_IRQ_PENDING_FLAG   (1 << 0)
-#define OMAP_UART_IIR_TYPE_MASK   (0x1f)
-#define OMAP_UART_IIR_TYPE_SHIFT   (1)
-#define OMAP_UART_IIR_FCR_MASK   (0x3)
-#define OMAP_UART_IIR_FCR_SHIFT   (6)
-
-#define OMAP_CIR_IIR_RHR_IRQ_FLAG   (1 << 0)
-#define OMAP_CIR_IIR_THR_IRQ_FLAG   (1 << 1)
-#define OMAP_CIR_IIR_RX_STOP_IRQ_FLAG   (1 << 2)
-#define OMAP_CIR_IIR_RX_OE_IRQ_FLAG   (1 << 3)
-#define OMAP_CIR_IIR_TX_STS_IRQ_FLAG   (1 << 5)
-
-#define OMAP_IRDA_IIR_RHR_IRQ_FLAG   (1 << 0)
-#define OMAP_IRDA_IIR_THR_IRQ_FLAG   (1 << 1)
-#define OMAP_IRDA_IIR_RX_FIFO_LB_IRQ_FLAG   (1 << 2)
-#define OMAP_IRDA_IIR_RX_OE_IRQ_FLAG   (1 << 3)
-#define OMAP_IRDA_IIR_STS_FIFO_IRQ_FLAG   (1 << 4)
-#define OMAP_IRDA_IIR_TX_STS_IRQ_FLAG   (1 << 5)
-#define OMAP_IRDA_IIR_LINE_STS_IRQ_FLAG   (1 << 6)
-#define OMAP_IRDA_IIR_EOF_IRQ_FLAG   (1 << 7)
-
-		/** FIFO control register */
-		ioport32_t fcr;
-#define OMAP_UART_FCR_FIFO_EN_FLAG   (1 << 0)
-#define OMAP_UART_FCR_RX_FIFO_CLR_FLAG   (1 << 1)
-#define OMAP_UART_FCR_TX_FIFO_CLR_FLAG   (1 << 3)
-#define OMAP_UART_FCR_DMA_MODE_FLAG   (1 << 4)
-
-#define OMAP_UART_FCR_TX_FIFO_TRIG_MASK   (0x3)
-#define OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT   (4)
-
-#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK   (0x3)
-#define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT   (6)
-
-		/** Enhanced feature register */
-		ioport32_t efr;
-#define OMAP_UART_EFR_SW_FLOW_CTRL_RX_MASK   (0x3)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_RX_SHIFT   (0)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_TX_MASK   (0x3)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_TX_SHIFT   (2)
-
-#define OMAP_UART_EFR_SW_FLOW_CTRL_NONE   (0x0)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_X2   (0x1)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_X1   (0x2)
-#define OMAP_UART_EFR_SW_FLOW_CTRL_XBOTH   (0x3)
-
-#define OMAP_UART_EFR_ENH_FLAG   (1 << 4)
-#define OMAP_UART_EFR_SPEC_CHAR_FLAG   (1 << 5)
-#define OMAP_UART_EFR_AUTO_RTS_EN_FLAG   (1 << 6)
-#define OMAP_UART_EFR_AUTO_CTS_EN_FLAG   (1 << 7)
-	};
-
-	/** Line control register */
-	ioport32_t lcr;
-#define OMAP_UART_LCR_CHAR_LENGTH_MASK   (0x3)
-#define OMAP_UART_LCR_CHAR_LENGTH_SHIFT   (0)
-#define OMAP_UART_LCR_CHAR_LENGTH_5BITS   (0x0)
-#define OMAP_UART_LCR_CHAR_LENGTH_6BITS   (0x1)
-#define OMAP_UART_LCR_CHAR_LENGTH_7BITS   (0x2)
-#define OMAP_UART_LCR_CHAR_LENGTH_8BITS   (0x3)
-#define OMAP_UART_LCR_NB_STOP_FLAG   (1 << 2)
-#define OMAP_UART_LCR_PARITY_EN_FLAG   (1 << 3)
-#define OMAP_UART_LCR_PARITY_TYPE1_FLAG   (1 << 4)
-#define OMAP_UART_LCR_PARITY_TYPE2_FLAG   (1 << 5)
-#define OMAP_UART_LCR_BREAK_EN_FLAG   (1 << 6)
-#define OMAP_UART_LCR_DIV_EN_FLAG   (1 << 7)
-
-	union {
-		/** Modem control register */
-		ioport32_t mcr;
-#define OMAP_UART_MCR_DTR_FLAG   (1 << 0)
-#define OMAP_UART_MCR_RTS_FLAG   (1 << 1)
-#define OMAP_UART_MCR_RI_STS_CH_FLAG   (1 << 2)
-#define OMAP_UART_MCR_CD_STS_CH_FLAG   (1 << 3)
-#define OMAP_UART_MCR_LOOPBACK_EN_FLAG   (1 << 4)
-#define OMAP_UART_MCR_XON_EN_FLAG   (1 << 5)
-#define OMAP_UART_MCR_TCR_TLR_FLAG   (1 << 6)
-
-		/** UART: XON1 char, IRDA: ADDR1 address */
-		ioport32_t xon1_addr1;
-#define OMAP_UART_XON1_ADDR1_MASK   (0xff)
-	};
-
-	union {
-		/** Line status register */
-		const ioport32_t lsr;
-#define OMAP_UART_LSR_RX_FIFO_E_FLAG   (1 << 0)
-#define OMAP_UART_LSR_RX_OE_FLAG   (1 << 1)
-#define OMAP_UART_LSR_RX_PE_FLAG   (1 << 2)
-#define OMAP_UART_LSR_RX_FE_FLAG   (1 << 3)
-#define OMAP_UART_LSR_RX_BI_FLAG   (1 << 4)
-#define OMAP_UART_LSR_TX_FIFO_E_FLAG   (1 << 5)
-#define OMAP_UART_LSR_TX_SR_E_FLAG   (1 << 6)
-#define OMAP_UART_LSR_RX_FIFO_STS_FLAG   (1 << 7)
-
-#define OMAP_CIR_LSR_RX_FIFO_E_FLAG   (1 << 0)
-#define OMAP_CIR_LSR_RX_STOP_FLAG   (1 << 5)
-#define OMAP_CIR_LSR_THR_EMPTY_FLAG   (1 << 7)
-
-#define OMAP_IRDA_LSR_RX_FIFO_E_FLAG   (1 << 0)
-#define OMAP_IRDA_LSR_STS_FIFO_E_FLAG   (1 << 1)
-#define OMAP_IRDA_LSR_CRC_FLAG   (1 << 2)
-#define OMAP_IRDA_LSR_ABORT_FLAG   (1 << 3)
-#define OMAP_IRDA_LSR_FTL_FLAG   (1 << 4)
-#define OMAP_IRDA_LSR_RX_LAST_FLAG   (1 << 5)
-#define OMAP_IRDA_LSR_STS_FIFO_FULL_FLAG   (1 << 6)
-#define OMAP_IRDA_LSR_THR_EMPTY_FLAG   (1 << 7)
-
-		/** UART: XON2 char, IRDA: ADDR2 address */
-		ioport32_t xon2_addr2;
-	};
-
-	union {
-		/** Modem status register */
-		const ioport32_t msr;
-#define OMAP_UART_MSR_CTS_STS_FLAG   (1 << 0)
-#define OMAP_UART_MSR_DSR_STS_FLAG   (1 << 1)
-#define OMAP_UART_MSR_RI_STS_FLAG   (1 << 2)
-#define OMAP_UART_MSR_DCD_STS_FLAG   (1 << 3)
-#define OMAP_UART_MSR_NCTS_STS_FLAG   (1 << 4)
-#define OMAP_UART_MSR_NDSR_STS_FLAG   (1 << 5)
-#define OMAP_UART_MSR_NRI_STS_FLAG   (1 << 6)
-#define OMAP_UART_MSR_NCD_STS_FLAG   (1 << 7)
-
-		/** Transmission control register */
-		ioport32_t tcr;
-#define OMAP_UART_TCR_FIFO_TRIG_MASK   (0xf)
-#define OMAP_UART_TCR_FIFO_TRIG_HALT_SHIFT   (0)
-#define OMAP_UART_TCR_FIFO_TRIG_START_SHIFT   (4)
-
-		/** UART: XOFF1 char */
-		ioport32_t xoff1;
-#define OMAP_UART_XOFF1_MASK   (0xff)
-	};
-
-	union {
-		/* Scratchpad register, does nothing */
-		ioport32_t spr;
-#define OMAP_UART_SPR_MASK   (0xff)
-
-		/* Trigger level register */
-		ioport32_t tlr;
-#define OMAP_UART_TLR_LEVEL_MASK   (0xf)
-#define OMAP_UART_TLR_TX_FIFO_TRIG_SHIFT   (0)
-#define OMAP_UART_TLR_RX_FIFO_TRIG_SHIFT   (4)
-
-		/** UART: XOFF2 char */
-		ioport32_t xoff2;
-#define OMAP_UART_XOFF2_MASK   (0xff)
-	};
-
-	/** Mode definition register. */
-	ioport32_t mdr1;
-#define OMAP_UART_MDR_MS_MASK   (0x7)
-#define OMAP_UART_MDR_MS_SHIFT   (0)
-#define OMAP_UART_MDR_MS_UART16   (0x0)
-#define OMAP_UART_MDR_MS_SIR   (0x1)
-#define OMAP_UART_MDR_MS_UART16_AUTO   (0x2)
-#define OMAP_UART_MDR_MS_UART13   (0x3)
-#define OMAP_UART_MDR_MS_MIR   (0x4)
-#define OMAP_UART_MDR_MS_FIR   (0x5)
-#define OMAP_UART_MDR_MS_CIR   (0x6)
-#define OMAP_UART_MDR_MS_DISABLE   (0x7)
-
-#define OMAP_UART_MDR_IR_SLEEP_FLAG   (1 << 3)
-#define OMAP_UART_MDR_SET_TXIR_FLAG   (1 << 4)
-#define OMAP_UART_MDR_SCT_FLAG   (1 << 5)
-#define OMAP_UART_MDR_SIP_FLAG   (1 << 6)
-#define OMAP_UART_MDR_FRAME_END_MODE_FLAG   (1 << 7)
-
-	/** Mode definition register */
-	ioport32_t mdr2;
-#define OMAP_UART_MDR_IRTX_UNDERRUN_FLAG   (1 << 0)
-#define OMAP_UART_MDR_STS_FIFO_TRIG_MASK   (0x3)
-#define OMAP_UART_MDR_STS_FIFO_TRIG_SHIFT   (1)
-#define OMAP_UART_MDR_PULSE_SHAPING_FLAG   (1 << 3)
-#define OMAP_UART_MDR_CIR_PULSE_MODE_MASK   (0x3)
-#define OMAP_UART_MDR_CIR_PULSE_MODE_SHIFT   (4)
-#define OMAP_UART_MDR_IRRXINVERT_FLAG   (1 << 6)
-
-	union {
-		/** Status FIFO line status register (IrDA only) */
-		const ioport32_t sflsr;
-#define OMAP_IRDA_SFLSR_CRC_ERROR_FLAG   (1 << 1)
-#define OMAP_IRDA_SFLSR_ABORT_FLAG   (1 << 2)
-#define OMAP_IRDA_SFLSR_FTL_FLAG   (1 << 3)
-#define OMAP_IRDA_SFLSR_OE_FLAG   (1 << 4)
-
-		/** Transmit frame length low (IrDA only) */
-		ioport32_t txfll;
-#define OMAP_UART_TXFLL_MASK   (0xff)
-	};
-
-	union {
-		/** Dummy register to restart TX or RX (IrDA only) */
-		const ioport32_t resume;
-		/** Transmit frame length high (IrDA only) */
-		ioport32_t txflh;
-#define OMAP_UART_TXFLH_MASK   (0xff)
-	};
-
-	union {
-		/** Status FIFO register low (IrDA only) */
-		const ioport32_t sfregl;
-#define OMAP_UART_SFREGL_MASK   (0xff)
-		/** Received frame length low (IrDA only) */
-		ioport32_t rxfll;
-#define OMAP_UART_RXFLL_MASK   (0xff)
-	};
-
-	union {
-		/** Status FIFO register high (IrDA only) */
-		const ioport32_t sfregh;
-#define OMAP_UART_SFREGH_MASK   (0xf)
-		/** Received frame length high (IrDA only) */
-		ioport32_t rxflh;
-#define OMAP_UART_RXFLH_MASK   (0xf)
-	};
-
-	union {
-		/** UART autobauding status register */
-		const ioport32_t uasr;
-#define OMAP_UART_UASR_SPEED_MASK   (0x1f)
-#define OMAP_UART_UASR_SPEED_SHIFT   (0)
-#define OMAP_UART_UASR_8BIT_CHAR_FLAG   (1 << 5)
-#define OMAP_UART_UASR_PARITY_MASK   (0x3)
-#define OMAP_UART_UASR_PARITY_SHIFT   (6)
-
-		/** BOF control register (IrDA only) */
-		ioport32_t blr;
-#define OMAP_IRDA_BLR_XBOF_TYPE_FLAG   (1 << 6)
-#define OMAP_IRDA_BLR_STS_FIFO_RESET   (1 << 7)
-	};
-
-	/** Auxiliary control register (IrDA only) */
-	ioport32_t acreg;
-#define OMAP_IRDA_ACREG_EOT_EN_FLAG   (1 << 0)
-#define OMAP_IRDA_ACREG_ABORT_EN_FLAG   (1 << 1)
-#define OMAP_IRDA_ACREG_SCTX_EN_FLAG   (1 << 2)
-#define OMAP_IRDA_ACREG_SEND_SIP_FLAG   (1 << 3)
-#define OMAP_IRDA_ACREG_DIS_TX_UNDERRUN_FLAG   (1 << 4)
-#define OMAP_IRDA_ACREG_DIS_IR_RX_FLAG   (1 << 5)
-#define OMAP_IRDA_ACREG_SD_MOD_FLAG   (1 << 6)
-#define OMAP_IRDA_ACREG_PULSE_TYPE_FLAG   (1 << 7)
-
-	/** Supplementary control register */
-	ioport32_t scr;
-#define OMAP_UART_SCR_DMA_MODE_CTL_FLAG   (1 << 0)
-#define OMAP_UART_SCR_DMA_MODE_MASK   (0x3)
-#define OMAP_UART_SCR_DMA_MODE_SHIFT   (1)
-#define OMAP_UART_SCR_TX_EMPTY_CTL_IRQ_FLAG   (1 << 3)
-#define OMAP_UART_SCR_RX_CTS_WU_EN_FLAG   (1 << 4)
-#define OMAP_UART_SCR_TX_TRIG_GRANU1_FLAG   (1 << 6)
-#define OMAP_UART_SCR_RX_TRIG_GRANU1_FLAG   (1 << 7)
-
-	/** Supplementary status register */
-	const ioport32_t ssr;
-#define OMAP_UART_SSR_TX_FIFO_FULL_FLAG   (1 << 0)
-#define OMAP_UART_SSR_RX_CTS_WU_STS_FLAG   (1 << 1)
-#define OMAP_UART_SSR_DMA_COUNTER_RESET_FLAG   (1 << 2)
-
-	/** BOF Length register (IrDA only) */
-	ioport32_t eblr;
-#define OMAP_IRDA_EBLR_DISABLED   (0x00)
-#define OMAP_IRDA_EBLR_RX_STOP_BITS(bits)   (bits & 0xff)
-
-	uint32_t padd0_;
-
-	/** Module version register */
-	const ioport32_t mvr;
-#define OMAP_UART_MVR_MINOR_MASK   (0xf)
-#define OMAP_UART_MVR_MINOR_SHIFT   (0)
-#define OMAP_UART_MVR_MAJOR_MASK   (0xf)
-#define OMAP_UART_MVR_MAJOR_SHIFT   (4)
-
-	/** System configuration register */
-	ioport32_t sysc;
-#define OMAP_UART_SYSC_AUTOIDLE_FLAG   (1 << 0)
-#define OMAP_UART_SYSC_SOFTRESET_FLAG   (1 << 1)
-#define OMAP_UART_SYSC_ENWAKEUP_FLAG   (1 << 2)
-#define OMAP_UART_SYSC_IDLE_MODE_MASK   (0x3)
-#define OMAP_UART_SYSC_IDLE_MODE_SHIFT   (3)
-#define OMAP_UART_SYSC_IDLE_MODE_FORCE   (0x0)
-#define OMAP_UART_SYSC_IDLE_MODE_NO   (0x1)
-#define OMAP_UART_SYSC_IDLE_MODE_SMART   (0x2)
-
-	/** System status register */
-	const ioport32_t syss;
-#define OMAP_UART_SYSS_RESETDONE_FLAG   (1 << 0)
-
-	/** Wake-up enable register */
-	ioport32_t wer;
-#define OMAP_UART_WER_CTS_ACTIVITY_FLAG  (1 << 0)
-#define OMAP_UART_WER_RI_ACTIVITY_FLAG  (1 << 2)
-#define OMAP_UART_WER_RX_ACTIVITY_FLAG  (1 << 4)
-#define OMAP_UART_WER_RHR_IRQ_FLAG  (1 << 5)
-#define OMAP_UART_WER_RLS_IRQ_FLAG  (1 << 6)
-#define OMAP_UART_WER_TX_WAKEUP_EN_FLAG  (1 << 7)
-
-	/** Carrier frequency prescaler */
-	ioport32_t cfps;
-#define OMAP_UART_CFPS_MASK   (0xff)
-
-	/** Number of bytes in RX fifo */
-	const ioport32_t rx_fifo_lvl;
-#define OMAP_UART_RX_FIFO_LVL_MASK   (0xff)
-
-	/** Number of bytes in TX fifo */
-	const ioport32_t tx_fifo_lvl;
-#define OMAP_UART_TX_FIFO_LVL_MASK   (0xff)
-
-	/** RX/TX empty interrupts */
-	ioport32_t ier2;
-#define OMAP_UART_IER2_RX_FIFO_EMPTY_IRQ_EN_FLAG  (1 << 0)
-#define OMAP_UART_IER2_TX_FIFO_EMPTY_IRQ_EN_FLAG  (1 << 1)
-
-	/** RX/TX empty status */
-	ioport32_t isr2;
-#define OMAP_UART_ISR2_RX_FIFO_EMPTY_FLAG  (1 << 0)
-#define OMAP_UART_ISR2_TX_FIFO_EMPTY_FLAG  (1 << 1)
-
-	/** Set the sample per bit if non default frequency is used */
-	ioport32_t freq_sel;
-#define OMAP_UART_FREQ_SEL_MASK  (0x000000FF)
-
-	uint32_t padd2_[2];
-
-	/** Mode definition register 3 */
-	ioport32_t mdr3;
-#define OMAP_UART_MDR3_DIS_CIR_RX_DEMOD_FLAG   (1 << 0)
-} omap_uart_regs_t;
-
-#endif
-
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/pl011/pl011.h
===================================================================
--- kernel/genarch/include/genarch/drivers/pl011/pl011.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief ARM PrimeCell PL011 UART driver.
- */
-
-#ifndef KERN_PL011_H_
-#define KERN_PL011_H_
-
-#include <ddi/ddi.h>
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-/** PrimeCell UART TRM ch. 3.3 (p. 49 in the pdf) */
-typedef struct {
-	/** UART data register */
-	ioport32_t data;
-#define PL011_UART_DATA_DATA_MASK   0xff
-#define PL011_UART_DATA_FE_FLAG   (1 <<  7)
-#define PL011_UART_DATA_PE_FLAG   (1 <<  9)
-#define PL011_UART_DATA_BE_FLAG   (1 << 10)
-#define PL011_UART_DATA_OE_FLAG   (1 << 11)
-
-	union {
-		/* Same values that are in upper bits of data register */
-		const ioport32_t status;
-#define PL011_UART_STATUS_FE_FLAG   (1 << 0)
-#define PL011_UART_STATUS_PE_FLAG   (1 << 1)
-#define PL011_UART_STATUS_BE_FLAG   (1 << 2)
-#define PL011_UART_STATUS_OE_FLAG   (1 << 3)
-		/* Writing anything clears all errors */
-		ioport32_t error_clear;
-	};
-	uint32_t padd0_[4];
-
-	const ioport32_t flag;
-#define PL011_UART_FLAG_CTS_FLAG    (1 << 0)
-#define PL011_UART_FLAG_DSR_FLAG    (1 << 1)
-#define PL011_UART_FLAG_DCD_FLAG    (1 << 2)
-#define PL011_UART_FLAG_BUSY_FLAG   (1 << 3)
-#define PL011_UART_FLAG_RXFE_FLAG   (1 << 4)
-#define PL011_UART_FLAG_TXFF_FLAG   (1 << 5)
-#define PL011_UART_FLAG_RXFF_FLAG   (1 << 6)
-#define PL011_UART_FLAG_TXFE_FLAG   (1 << 7)
-#define PL011_UART_FLAG_RI_FLAG     (1 << 8)
-	uint32_t padd1_;
-
-	ioport32_t irda_low_power;
-#define PL011_UART_IRDA_LOW_POWER_MASK   0xff
-
-	ioport32_t int_baud_divisor;
-#define PL011_UART_INT_BAUD_DIVISOR_MASK   0xffff
-
-	ioport32_t fract_baud_divisor;
-#define PL011_UART_FRACT_BAUD_DIVISOR_MASK   0x1f
-
-	ioport32_t line_control_high;
-#define PL011_UART_CONTROLHI_BRK_FLAG    (1 << 0)
-#define PL011_UART_CONTROLHI_PEN_FLAG    (1 << 1)
-#define PL011_UART_CONTROLHI_EPS_FLAG    (1 << 2)
-#define PL011_UART_CONTROLHI_STP2_FLAG   (1 << 3)
-#define PL011_UART_CONTROLHI_FEN_FLAG    (1 << 4)
-#define PL011_UART_CONTROLHI_WLEN_MASK   0x3
-#define PL011_UART_CONTROLHI_WLEN_SHIFT    5
-#define PL011_UART_CONTROLHI_SPS_FLAG    (1 << 5)
-
-	ioport32_t control;
-#define PL011_UART_CONTROL_UARTEN_FLAG   (1 << 0)
-#define PL011_UART_CONTROL_SIREN_FLAG    (1 << 1)
-#define PL011_UART_CONTROL_SIRLP_FLAG    (1 << 2)
-#define PL011_UART_CONTROL_LBE_FLAG      (1 << 7)
-#define PL011_UART_CONTROL_TXE_FLAG      (1 << 8)
-#define PL011_UART_CONTROL_RXE_FLAG      (1 << 9)
-#define PL011_UART_CONTROL_DTR_FLAG     (1 << 10)
-#define PL011_UART_CONTROL_RTS_FLAG     (1 << 11)
-#define PL011_UART_CONTROL_OUT1_FLAG    (1 << 12)
-#define PL011_UART_CONTROL_OUT2_FLAG    (1 << 13)
-#define PL011_UART_CONTROL_RTSE_FLAG    (1 << 14)
-#define PL011_UART_CONTROL_CTSE_FLAG    (1 << 15)
-
-	ioport32_t interrupt_fifo;
-#define PL011_UART_INTERRUPTFIFO_TX_MASK   0x7
-#define PL011_UART_INTERRUPTFIFO_TX_SHIFT    0
-#define PL011_UART_INTERRUPTFIFO_RX_MASK   0x7
-#define PL011_UART_INTERRUPTFIFO_RX_SHIFT    3
-
-	/** Interrupt mask register */
-	ioport32_t interrupt_mask;
-	/** Pending interrupts before applying the mask */
-	const ioport32_t raw_interrupt_status;
-	/** Pending interrupts after applying the mask */
-	const ioport32_t masked_interrupt_status;
-	/** Write 1s to clear pending interrupts */
-	ioport32_t interrupt_clear;
-#define PL011_UART_INTERRUPT_RIM_FLAG    (1 << 0)
-#define PL011_UART_INTERRUPT_CTSM_FLAG   (1 << 1)
-#define PL011_UART_INTERRUPT_DCDM_FLAG   (1 << 2)
-#define PL011_UART_INTERRUPT_DSRM_FLAG   (1 << 3)
-#define PL011_UART_INTERRUPT_RX_FLAG     (1 << 4)
-#define PL011_UART_INTERRUPT_TX_FLAG     (1 << 5)
-#define PL011_UART_INTERRUPT_RT_FLAG     (1 << 6)
-#define PL011_UART_INTERRUPT_FE_FLAG     (1 << 7)
-#define PL011_UART_INTERRUPT_PE_FLAG     (1 << 8)
-#define PL011_UART_INTERRUPT_BE_FLAG     (1 << 9)
-#define PL011_UART_INTERRUPT_OE_FLAG    (1 << 10)
-#define PL011_UART_INTERRUPT_ALL           0x3ff
-
-	ioport32_t dma_control;
-#define PL011_UART_DMACONTROL_RXDMAEN_FLAG    (1 << 0)
-#define PL011_UART_DMACONTROL_TXDMAEN_FLAG    (1 << 1)
-#define PL011_UART_DMACONTROL_DMAONERR_FLAG   (1 << 2)
-
-	// TODO There is some reserved space here followed by
-	// peripheral identification registers.
-} pl011_uart_regs_t;
-
-typedef struct {
-	pl011_uart_regs_t *regs;
-	indev_t *indev;
-	outdev_t outdev;
-	irq_t irq;
-	parea_t parea;
-} pl011_uart_t;
-
-bool pl011_uart_init(pl011_uart_t *, inr_t, uintptr_t);
-void pl011_uart_input_wire(pl011_uart_t *, indev_t *);
-
-#endif
-/**
- * @}
- */
Index: rnel/genarch/include/genarch/drivers/pl050/pl050.h
===================================================================
--- kernel/genarch/include/genarch/drivers/pl050/pl050.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- * @brief	Describes the pl050 keyboard/mouse controller
- */
-
-/**
- * This file implements pl050 specific functions for keyboard and mouse
- */
-
-#ifndef KERN_genarch_PL050_H
-#define KERN_genarch_PL050_H
-
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-/*
- * pl050 register offsets from the base address
- */
-#define PL050_CR	0x00
-#define PL050_STAT	0x04
-#define PL050_DATA	0x08
-#define PL050_CLOCKDIV	0x0C
-#define PL050_INTRSTAT	0x10
-
-/*
- * Control Register Bits
- */
-#define PL050_CR_TYPE	(1 << 5)	/* Type 0: PS2/AT mode, 1: No Line control bit mode */
-#define PL050_CR_RXINTR	(1 << 4)	/* Recieve Interrupt Enable */
-#define PL050_CR_TXINTR	(1 << 3)	/* Transmit Interrupt Enable */
-#define PL050_CR_INTR	(1 << 2)	/* Interrupt Enable */
-#define PL050_CR_FKMID	(1 << 1)	/* Force KMI Data Low */
-#define PL050_CR_FKMIC	1		/* Force KMI Clock Low */
-
-/*
- * Status register bits
- */
-#define PL050_STAT_TXEMPTY	(1 << 6)	/* 1: Transmit register empty */
-#define PL050_STAT_TXBUSY	(1 << 5)	/* 1: Busy, sending data */
-#define PL050_STAT_RXFULL	(1 << 4)	/* 1: register Full */
-#define PL050_STAT_RXBUSY	(1 << 3)	/* 1: Busy, recieving Data */
-#define PL050_STAT_RXPARITY	(1 << 2)	/* odd parity of the last bit received */
-#define PL050_STAT_KMIC		(1 << 1)	/* status of KMICLKIN */
-#define PL050_STAT_KMID		1		/* status of KMIDATAIN */
-
-/*
- * Interrupt status register bits.
- */
-#define PL050_TX_INTRSTAT	(1 << 1)	/* Transmit intr asserted */
-#define PL050_RX_INTRSTAT	1		/* Recieve intr asserted */
-
-typedef struct {
-	ioport8_t *base;
-	ioport8_t *data;
-	ioport8_t *status;
-	ioport8_t *ctrl;
-} pl050_t;
-
-typedef struct {
-	irq_t	irq;
-	pl050_t *pl050;
-	indev_t *kbrdin;
-} pl050_instance_t;
-
-extern pl050_instance_t *pl050_init(pl050_t *, inr_t);
-extern void pl050_wire(pl050_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/s3c24xx/irqc.h
===================================================================
--- kernel/genarch/include/genarch/drivers/s3c24xx/irqc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip interrupt controller driver.
- */
-
-#ifndef KERN_S3C24XX_IRQC_H_
-#define KERN_S3C24XX_IRQC_H_
-
-#include <typedefs.h>
-
-/** Physical address where S3C24XX Interrupt controller is mapped */
-#define S3C24XX_IRQC_ADDRESS	0x4a000000
-
-/** S3C24xx on-chip interrupt controller registers */
-typedef struct {
-	ioport32_t srcpnd;	/**< Source pending */
-	ioport32_t intmod;	/**< Interrupt mode */
-	ioport32_t intmsk;	/**< Interrupt mask */
-	ioport32_t priority;	/**< Priority */
-	ioport32_t intpnd;	/**< Interrupt pending */
-	ioport32_t intoffset;	/**< Interrupt offset */
-	ioport32_t subsrcpnd;	/**< Sub source pending */
-	ioport32_t intsubmsk;	/** Interrupt sub mask */
-} s3c24xx_irqc_regs_t;
-
-/** S3C24xx Interrupt source numbers.
- *
- * These correspond to bit numbers in srcpnd, intmod, intmsk and intpnd
- * registers as well as to the values read from the intoffset register.
- */
-enum s3c24xx_int_source {
-	S3C24XX_INT_ADC		= 31,
-	S3C24XX_INT_RTC		= 30,
-	S3C24XX_INT_SPI1	= 29,
-	S3C24XX_INT_UART0	= 28,
-	S3C24XX_INT_IIC		= 27,
-	S3C24XX_INT_USBH	= 26,
-	S3C24XX_INT_USBD	= 25,
-	S3C24XX_INT_NFCON	= 24,
-	S3C24XX_INT_UART1	= 23,
-	S3C24XX_INT_SPI0	= 22,
-	S3C24XX_INT_SDI		= 21,
-	S3C24XX_INT_DMA3	= 20,
-	S3C24XX_INT_DMA2	= 19,
-	S3C24XX_INT_DMA1	= 18,
-	S3C24XX_INT_DMA0	= 17,
-	S3C24XX_INT_LCD		= 16,
-	S3C24XX_INT_UART2	= 15,
-	S3C24XX_INT_TIMER4	= 14,
-	S3C24XX_INT_TIMER3	= 13,
-	S3C24XX_INT_TIMER2	= 12,
-	S3C24XX_INT_TIMER1	= 11,
-	S3C24XX_INT_TIMER0	= 10,
-	S3C24XX_INT_WDT_AC97	= 9,
-	S3C24XX_INT_TICK	= 8,
-	S3C24XX_nBATT_FLT	= 7,
-	S3C24XX_INT_CAM		= 6,
-	S3C24XX_EINT8_23	= 5,
-	S3C24XX_EINT4_7		= 4,
-	S3C24XX_EINT3		= 3,
-	S3C24XX_EINT2		= 2,
-	S3C24XX_EINT1		= 1,
-	S3C24XX_EINT0		= 0
-};
-
-/** S3C24xx Interrupt sub-source numbers.
- *
- * These correspond to bit numbers in the intsubmsk register.
- */
-enum s3c24xx_int_subsource {
-	S3C24XX_SUBINT_AC97	= 14,
-	S3C24XX_SUBINT_WDT	= 13,
-	S3C24XX_SUBINT_CAM_P	= 12,
-	S3C24XX_SUBINT_CAM_C	= 11,
-	S3C24XX_SUBINT_ADC_S	= 10,
-	S3C24XX_SUBINT_TC	= 9,
-	S3C24XX_SUBINT_ERR2	= 8,
-	S3C24XX_SUBINT_TXD2	= 7,
-	S3C24XX_SUBINT_RXD2	= 6,
-	S3C24XX_SUBINT_ERR1	= 5,
-	S3C24XX_SUBINT_TXD1	= 4,
-	S3C24XX_SUBINT_RXD1	= 3,
-	S3C24XX_SUBINT_ERR0	= 2,
-	S3C24XX_SUBINT_TXD0	= 1,
-	S3C24XX_SUBINT_RXD0	= 0
-};
-
-#define S3C24XX_INT_BIT(source) (1 << (source))
-#define S3C24XX_SUBINT_BIT(subsource) (1 << (subsource))
-
-typedef struct {
-	s3c24xx_irqc_regs_t *regs;
-} s3c24xx_irqc_t;
-
-extern void s3c24xx_irqc_init(s3c24xx_irqc_t *, s3c24xx_irqc_regs_t *);
-extern unsigned s3c24xx_irqc_inum_get(s3c24xx_irqc_t *);
-extern void s3c24xx_irqc_clear(s3c24xx_irqc_t *, unsigned);
-extern void s3c24xx_irqc_src_enable(s3c24xx_irqc_t *, unsigned);
-extern void s3c24xx_irqc_src_disable(s3c24xx_irqc_t *, unsigned);
-extern void s3c24xx_irqc_subsrc_enable(s3c24xx_irqc_t *, unsigned);
-extern void s3c24xx_irqc_subsrc_disable(s3c24xx_irqc_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/s3c24xx/timer.h
===================================================================
--- kernel/genarch/include/genarch/drivers/s3c24xx/timer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip PWM timer driver.
- */
-
-#ifndef KERN_S3C24XX_TIMER_H_
-#define KERN_S3C24XX_TIMER_H_
-
-#include <typedefs.h>
-
-/** Physical address where S3C24XX on-chip PWM timer is mapped */
-#define S3C24XX_TIMER_ADDRESS	0x51000000
-
-/** S3C24xx on-chip PWM timer registers */
-typedef struct {
-	ioport32_t tcfg0;	/**< Timer configuration register 0 */
-	ioport32_t tcfg1;	/**< Timer configuration register 1 */
-	ioport32_t tcon;	/**< Timer control register */
-
-	struct {
-		ioport32_t cntb;	/**< Count buffer register */
-		ioport32_t cmpb;	/**< Compare buffer register */
-		ioport32_t cnto;	/**< Count observation register */
-	} timer[5];
-} s3c24xx_timer_t;
-
-/** Bits in the S3C24xx PWM timer TCON register. */
-enum s3c24xx_tcon_bits {
-	TCON_T0_START		= (1 << 0),	/**< Timer 0 start */
-	TCON_T0_MUPDATE		= (1 << 1),	/**< Timer 0 manual update */
-	TCON_T0_INVERT		= (1 << 2),	/**< Timer 0 inverter on */
-	TCON_T0_AUTO_RLD	= (1 << 3),	/**< Timer 0 auto reload */
-
-	TCON_DEAD_ZONE		= (1 << 4),	/**< Dead zone enable */
-
-	TCON_T1_START		= (1 << 8),	/**< Timer 1 start */
-	TCON_T1_MUPDATE		= (1 << 9),	/**< Timer 1 manual update */
-	TCON_T1_INVERT		= (1 << 10),	/**< Timer 1 inverter on */
-	TCON_T1_AUTO_RLD	= (1 << 11),	/**< Timer 1 auto reload */
-
-	TCON_T2_START		= (1 << 12),	/**< Timer 2 start */
-	TCON_T2_MUPDATE		= (1 << 13),	/**< Timer 2 manual update */
-	TCON_T2_INVERT		= (1 << 14),	/**< Timer 2 inverter on */
-	TCON_T2_AUTO_RLD	= (1 << 15),	/**< Timer 2 auto reload */
-
-	TCON_T3_START		= (1 << 16),	/**< Timer 3 start */
-	TCON_T3_MUPDATE		= (1 << 17),	/**< Timer 3 manual update */
-	TCON_T3_INVERT		= (1 << 18),	/**< Timer 3 inverter on */
-	TCON_T3_AUTO_RLD	= (1 << 19),	/**< Timer 3 auto reload */
-
-	TCON_T4_START		= (1 << 20),	/**< Timer 4 start */
-	TCON_T4_MUPDATE		= (1 << 21),	/**< Timer 4 manual update */
-	TCON_T4_AUTO_RLD	= (1 << 22)	/**< Timer 4 auto reload */
-};
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/s3c24xx/uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/s3c24xx/uart.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip UART driver.
- */
-
-#ifndef KERN_S3C24XX_UART_H_
-#define KERN_S3C24XX_UART_H_
-
-#include <ddi/ddi.h>
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-/** S3C24xx UART I/O */
-typedef struct {
-	uint32_t ulcon;
-	uint32_t ucon;
-	uint32_t ufcon;
-	uint32_t umcon;
-
-	uint32_t utrstat;
-	uint32_t uerstat;
-	uint32_t ufstat;
-	uint32_t umstat;
-
-	uint32_t utxh;
-	uint32_t urxh;
-
-	uint32_t ubrdiv;
-} s3c24xx_uart_io_t;
-
-/* Bits in UTRSTAT register */
-#define S3C24XX_UTRSTAT_TX_EMPTY	0x4
-#define S3C24XX_UTRSTAT_RDATA		0x1
-
-/* Bits in UFSTAT register */
-#define S3C24XX_UFSTAT_TX_FULL		0x4000
-#define S3C24XX_UFSTAT_RX_FULL		0x0040
-#define S3C24XX_UFSTAT_RX_COUNT		0x002f
-
-/* Bits in UCON register */
-#define UCON_RX_INT_LEVEL		0x100
-
-/* Bits in UFCON register */
-#define UFCON_TX_FIFO_TLEVEL_EMPTY	0x00
-#define UFCON_RX_FIFO_TLEVEL_1B		0x00
-#define UFCON_FIFO_ENABLE		0x01
-
-/** S3C24xx UART instance */
-typedef struct {
-	s3c24xx_uart_io_t *io;
-	indev_t *indev;
-	irq_t irq;
-	parea_t parea;
-} s3c24xx_uart_t;
-
-extern outdev_t *s3c24xx_uart_init(uintptr_t, inr_t inr);
-extern void s3c24xx_uart_input_wire(s3c24xx_uart_t *,
-    indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/via-cuda/cuda.h
===================================================================
--- kernel/genarch/include/genarch/drivers/via-cuda/cuda.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CUDA_H_
-#define KERN_CUDA_H_
-
-#include <ddi/irq.h>
-#include <typedefs.h>
-#include <console/chardev.h>
-#include <synch/spinlock.h>
-
-typedef struct {
-	ioport8_t b;
-	uint8_t pad0[0x1ff];
-
-	ioport8_t a;
-	uint8_t pad1[0x1ff];
-
-	ioport8_t dirb;
-	uint8_t pad2[0x1ff];
-
-	ioport8_t dira;
-	uint8_t pad3[0x1ff];
-
-	ioport8_t t1cl;
-	uint8_t pad4[0x1ff];
-
-	ioport8_t t1ch;
-	uint8_t pad5[0x1ff];
-
-	ioport8_t t1ll;
-	uint8_t pad6[0x1ff];
-
-	ioport8_t t1lh;
-	uint8_t pad7[0x1ff];
-
-	ioport8_t t2cl;
-	uint8_t pad8[0x1ff];
-
-	ioport8_t t2ch;
-	uint8_t pad9[0x1ff];
-
-	ioport8_t sr;
-	uint8_t pad10[0x1ff];
-
-	ioport8_t acr;
-	uint8_t pad11[0x1ff];
-
-	ioport8_t pcr;
-	uint8_t pad12[0x1ff];
-
-	ioport8_t ifr;
-	uint8_t pad13[0x1ff];
-
-	ioport8_t ier;
-	uint8_t pad14[0x1ff];
-
-	ioport8_t anh;
-	uint8_t pad15[0x1ff];
-} cuda_t;
-
-enum {
-	CUDA_RCV_BUF_SIZE = 5
-};
-
-enum cuda_xfer_state {
-	cx_listen,
-	cx_receive,
-	cx_rcv_end,
-	cx_send_start,
-	cx_send
-};
-
-typedef struct {
-	irq_t irq;
-	cuda_t *cuda;
-	indev_t *kbrdin;
-	uint8_t rcv_buf[CUDA_RCV_BUF_SIZE];
-	uint8_t snd_buf[CUDA_RCV_BUF_SIZE];
-	size_t bidx;
-	size_t snd_bytes;
-	enum cuda_xfer_state xstate;
-	SPINLOCK_DECLARE(dev_lock);
-} cuda_instance_t;
-
-extern cuda_instance_t *cuda_init(cuda_t *, inr_t, cir_t, void *);
-extern void cuda_wire(cuda_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/fb/bfb.h
===================================================================
--- kernel/genarch/include/genarch/fb/bfb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_BFB_H_
-#define KERN_BFB_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-extern uintptr_t bfb_addr;
-extern uint32_t bfb_width;
-extern uint32_t bfb_height;
-extern uint16_t bfb_bpp;
-extern uint32_t bfb_scanline;
-
-extern uint8_t bfb_red_pos;
-extern uint8_t bfb_red_size;
-
-extern uint8_t bfb_green_pos;
-extern uint8_t bfb_green_size;
-
-extern uint8_t bfb_blue_pos;
-extern uint8_t bfb_blue_size;
-
-extern bool bfb_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/fb/fb.h
===================================================================
--- kernel/genarch/include/genarch/fb/fb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_FB_H_
-#define KERN_FB_H_
-
-#include <typedefs.h>
-#include <abi/fb/visuals.h>
-#include <console/chardev.h>
-
-/**
- * Properties of the framebuffer device.
- */
-typedef struct fb_properties {
-	/** Physical address of the framebuffer device. */
-	uintptr_t addr;
-
-	/**
-	 * Address where the first (top left) pixel is mapped,
-	 * relative to "addr".
-	 */
-	unsigned int offset;
-
-	/** Screen width in pixels. */
-	unsigned int x;
-
-	/** Screen height in pixels. */
-	unsigned int y;
-
-	/** Bytes per one scanline. */
-	unsigned int scan;
-
-	/** Color model. */
-	visual_t visual;
-} fb_properties_t;
-
-extern outdev_t *fb_init(fb_properties_t *props);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/fb/font-8x16.h
===================================================================
--- kernel/genarch/include/genarch/fb/font-8x16.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_FONT_8X16_H_
-#define KERN_FONT_8X16_H_
-
-#define FONT_GLYPHS     2899
-#define FONT_WIDTH      8
-#define FONT_SCANLINES  16
-
-#include <typedefs.h>
-
-extern uint16_t fb_font_glyph(const char32_t ch);
-extern uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES];
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/kbrd.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/kbrd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KERN_KBD_H_
-#define KERN_KBD_H_
-
-#include <console/chardev.h>
-#include <proc/thread.h>
-#include <synch/spinlock.h>
-
-typedef struct {
-	thread_t *thread;
-
-	indev_t *sink;
-	indev_t raw;
-
-	SPINLOCK_DECLARE(keylock);        /**< keylock protects keyflags and lockflags. */
-	volatile unsigned int keyflags;   /**< Tracking of multiple keypresses. */
-	volatile unsigned int lockflags;  /**< Tracking of multiple keys lockings. */
-} kbrd_instance_t;
-
-extern kbrd_instance_t *kbrd_init(void);
-extern indev_t *kbrd_wire(kbrd_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/scanc.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/scanc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KERN_SCANC_H_
-#define KERN_SCANC_H_
-
-#include <typedefs.h>
-
-#define SCANCODES  128
-
-extern char32_t sc_primary_map[SCANCODES];
-extern char32_t sc_secondary_map[SCANCODES];
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/scanc_at.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/scanc_at.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	Scan codes for PC/AT keyboards.
- */
-
-#ifndef KERN_SCANC_AT_H_
-#define KERN_SCANC_AT_H_
-
-#define SC_SCAN_ESCAPE	0xE0
-#define SC_ESC		0x76
-#define SC_BACKSPACE	0x66
-#define SC_LSHIFT       0x12
-#define SC_RSHIFT       0x59
-#define SC_CAPSLOCK     0x58
-#define SC_SPEC_ESCAPE  0xe0
-#define SC_LEFTARR      0x6b
-#define SC_RIGHTARR     0x74
-#define SC_UPARR        0x75
-#define SC_DOWNARR      0x72
-#define SC_DELETE       0x70
-#define SC_HOME         0x6C
-#define SC_END          0x69
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/scanc_mac.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/scanc_mac.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for Macintosh ADB keyboards.
- */
-
-#ifndef KERN_SCANC_MAC_H_
-#define KERN_SCANC_MAC_H_
-
-#define SC_LSHIFT       0x38
-#define SC_RSHIFT       0xfd	/* Not used */
-#define SC_CAPSLOCK     0xfe	/* Not used */
-#define SC_SCAN_ESCAPE  0xff	/* Not used */
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/scanc_pc.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/scanc_pc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for PC keyboards.
- */
-
-#ifndef KERN_SCANC_PC_H_
-#define KERN_SCANC_PC_H_
-
-#define SC_LSHIFT       0x2a
-#define SC_RSHIFT       0x36
-#define SC_CAPSLOCK     0x3a
-#define SC_SCAN_ESCAPE  0xe0
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/kbrd/scanc_sun.h
===================================================================
--- kernel/genarch/include/genarch/kbrd/scanc_sun.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for Sun keyboards.
- */
-
-#ifndef KERN_SCANC_SUN_H_
-#define KERN_SCANC_SUN_H_
-
-#define SC_LSHIFT       0x63
-#define SC_RSHIFT       0x6e
-#define SC_CAPSLOCK     0x77
-#define SC_SCAN_ESCAPE  0xe0
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/mm/as_ht.h
===================================================================
--- kernel/genarch/include/genarch/mm/as_ht.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_AS_HT_H_
-#define KERN_AS_HT_H_
-
-#include <mm/mm.h>
-#include <adt/hash_table.h>
-#include <typedefs.h>
-
-typedef struct {
-} as_genarch_t;
-
-struct as;
-
-typedef struct pte {
-	ht_link_t link;		/**< Page hash table link. */
-	struct as *as;		/**< Address space. */
-	uintptr_t page;		/**< Virtual memory page. */
-	uintptr_t frame;	/**< Physical memory frame. */
-	unsigned g : 1;		/**< Global page. */
-	unsigned x : 1;		/**< Execute. */
-	unsigned w : 1;		/**< Writable. */
-	unsigned k : 1;		/**< Kernel privileges required. */
-	unsigned c : 1;		/**< Cacheable. */
-	unsigned a : 1;		/**< Accessed. */
-	unsigned d : 1;		/**< Dirty. */
-	unsigned p : 1;		/**< Present. */
-} pte_t;
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/mm/as_pt.h
===================================================================
--- kernel/genarch/include/genarch/mm/as_pt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_AS_PT_H_
-#define KERN_AS_PT_H_
-
-#include <arch/mm/page.h>
-
-#define AS_PAGE_TABLE
-
-typedef struct {
-	/** Page table pointer. */
-	pte_t *page_table;
-} as_genarch_t;
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/mm/asid_fifo.h
===================================================================
--- kernel/genarch/include/genarch/mm/asid_fifo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ASID_FIFO_H_
-#define KERN_ASID_FIFO_H_
-
-extern void asid_fifo_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/mm/page_ht.h
===================================================================
--- kernel/genarch/include/genarch/mm/page_ht.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-/**
- * @file
- * @brief This is the generic page hash table interface.
- */
-
-#ifdef CONFIG_PAGE_HT
-
-#ifndef KERN_PAGE_HT_H_
-#define KERN_PAGE_HT_H_
-
-#include <typedefs.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <mm/slab.h>
-#include <adt/hash_table.h>
-
-#define KEY_AS        0
-#define KEY_PAGE      1
-
-/* Macros for querying page hash table PTEs. */
-#define PTE_VALID(pte)       ((void *) (pte) != NULL)
-#define PTE_PRESENT(pte)     ((pte)->p != 0)
-#define PTE_GET_FRAME(pte)   ((pte)->frame)
-#define PTE_READABLE(pte)    1
-#define PTE_WRITABLE(pte)    ((pte)->w != 0)
-#define PTE_EXECUTABLE(pte)  ((pte)->x != 0)
-
-extern const as_operations_t as_ht_operations;
-extern const page_mapping_operations_t ht_mapping_operations;
-
-extern slab_cache_t *pte_cache;
-extern hash_table_t page_ht;
-extern const hash_table_ops_t ht_ops;
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/mm/page_pt.h
===================================================================
--- kernel/genarch/include/genarch/mm/page_pt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-/** @file
- */
-
-/*
- * This is the generic 4-level page table interface.
- * Architectures that use hierarchical page tables
- * are supposed to implement *_ARCH macros.
- *
- */
-
-#ifdef CONFIG_PAGE_PT
-
-#ifndef KERN_PAGE_PT_H_
-#define KERN_PAGE_PT_H_
-
-#include <mm/as.h>
-#include <mm/page.h>
-#include <arch/mm/page.h>
-#include <typedefs.h>
-
-/*
- * Number of entries in each level.
- */
-#define PTL0_ENTRIES  PTL0_ENTRIES_ARCH
-#define PTL1_ENTRIES  PTL1_ENTRIES_ARCH
-#define PTL2_ENTRIES  PTL2_ENTRIES_ARCH
-#define PTL3_ENTRIES  PTL3_ENTRIES_ARCH
-
-/* Table sizes in each level (in frames) */
-#define PTL0_FRAMES  PTL0_FRAMES_ARCH
-#define PTL1_FRAMES  PTL1_FRAMES_ARCH
-#define PTL2_FRAMES  PTL2_FRAMES_ARCH
-#define PTL3_FRAMES  PTL3_FRAMES_ARCH
-
-/* Table sizes in each level (in bytes) */
-#define PTL0_SIZE  FRAMES2SIZE(PTL0_FRAMES)
-#define PTL1_SIZE  FRAMES2SIZE(PTL1_FRAMES)
-#define PTL2_SIZE  FRAMES2SIZE(PTL2_FRAMES)
-#define PTL3_SIZE  FRAMES2SIZE(PTL3_FRAMES)
-
-/*
- * These macros process vaddr and extract those portions
- * of it that function as indices to respective page tables.
- *
- */
-#define PTL0_INDEX(vaddr)  PTL0_INDEX_ARCH(vaddr)
-#define PTL1_INDEX(vaddr)  PTL1_INDEX_ARCH(vaddr)
-#define PTL2_INDEX(vaddr)  PTL2_INDEX_ARCH(vaddr)
-#define PTL3_INDEX(vaddr)  PTL3_INDEX_ARCH(vaddr)
-
-#define SET_PTL0_ADDRESS(ptl0)  SET_PTL0_ADDRESS_ARCH(ptl0)
-
-/*
- * These macros traverse the 4-level tree of page tables,
- * each descending by one level.
- *
- */
-#define GET_PTL1_ADDRESS(ptl0, i)   GET_PTL1_ADDRESS_ARCH(ptl0, i)
-#define GET_PTL2_ADDRESS(ptl1, i)   GET_PTL2_ADDRESS_ARCH(ptl1, i)
-#define GET_PTL3_ADDRESS(ptl2, i)   GET_PTL3_ADDRESS_ARCH(ptl2, i)
-#define GET_FRAME_ADDRESS(ptl3, i)  GET_FRAME_ADDRESS_ARCH(ptl3, i)
-
-/*
- * These macros are provided to change the shape of the 4-level tree of page
- * tables on respective level.
- *
- */
-#define SET_PTL1_ADDRESS(ptl0, i, a)   SET_PTL1_ADDRESS_ARCH(ptl0, i, a)
-#define SET_PTL2_ADDRESS(ptl1, i, a)   SET_PTL2_ADDRESS_ARCH(ptl1, i, a)
-#define SET_PTL3_ADDRESS(ptl2, i, a)   SET_PTL3_ADDRESS_ARCH(ptl2, i, a)
-#define SET_FRAME_ADDRESS(ptl3, i, a)  SET_FRAME_ADDRESS_ARCH(ptl3, i, a)
-
-/*
- * These macros are provided to query various flags within the page tables.
- *
- */
-#define GET_PTL1_FLAGS(ptl0, i)   GET_PTL1_FLAGS_ARCH(ptl0, i)
-#define GET_PTL2_FLAGS(ptl1, i)   GET_PTL2_FLAGS_ARCH(ptl1, i)
-#define GET_PTL3_FLAGS(ptl2, i)   GET_PTL3_FLAGS_ARCH(ptl2, i)
-#define GET_FRAME_FLAGS(ptl3, i)  GET_FRAME_FLAGS_ARCH(ptl3, i)
-
-/*
- * These macros are provided to set/clear various flags within the page tables.
- *
- */
-#define SET_PTL1_FLAGS(ptl0, i, x)   SET_PTL1_FLAGS_ARCH(ptl0, i, x)
-#define SET_PTL2_FLAGS(ptl1, i, x)   SET_PTL2_FLAGS_ARCH(ptl1, i, x)
-#define SET_PTL3_FLAGS(ptl2, i, x)   SET_PTL3_FLAGS_ARCH(ptl2, i, x)
-#define SET_FRAME_FLAGS(ptl3, i, x)  SET_FRAME_FLAGS_ARCH(ptl3, i, x)
-
-/*
- * These macros are provided to set the present bit within the page tables.
- *
- */
-#define SET_PTL1_PRESENT(ptl0, i)   SET_PTL1_PRESENT_ARCH(ptl0, i)
-#define SET_PTL2_PRESENT(ptl1, i)   SET_PTL2_PRESENT_ARCH(ptl1, i)
-#define SET_PTL3_PRESENT(ptl2, i)   SET_PTL3_PRESENT_ARCH(ptl2, i)
-#define SET_FRAME_PRESENT(ptl3, i)  SET_FRAME_PRESENT_ARCH(ptl3, i)
-
-/*
- * Macros for querying the last-level PTEs.
- *
- */
-#define PTE_VALID(p)       PTE_VALID_ARCH((p))
-#define PTE_PRESENT(p)     PTE_PRESENT_ARCH((p))
-#define PTE_GET_FRAME(p)   PTE_GET_FRAME_ARCH((p))
-#define PTE_READABLE(p)    1
-#define PTE_WRITABLE(p)    PTE_WRITABLE_ARCH((p))
-#define PTE_EXECUTABLE(p)  PTE_EXECUTABLE_ARCH((p))
-
-extern const as_operations_t as_pt_operations;
-extern const page_mapping_operations_t pt_mapping_operations;
-
-extern void page_mapping_insert_pt(as_t *, uintptr_t, uintptr_t, unsigned int);
-extern pte_t *page_mapping_find_pt(as_t *, uintptr_t, bool);
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/multiboot/multiboot.h
===================================================================
--- kernel/genarch/include/genarch/multiboot/multiboot.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MULTIBOOT_H_
-#define KERN_MULTIBOOT_H_
-
-#include <genarch/multiboot/multiboot_memmap_struct.h>
-#include <genarch/multiboot/multiboot_info_struct.h>
-
-#define MULTIBOOT_HEADER_MAGIC  0x1badb002
-#define MULTIBOOT_HEADER_FLAGS  0x00010003
-
-#define MULTIBOOT_LOADER_MAGIC  0x2badb002
-
-#define MULTIBOOT_INFO_FLAGS_MEM	0x01
-#define MULTIBOOT_INFO_FLAGS_BOOT	0x02
-#define MULTIBOOT_INFO_FLAGS_CMDLINE	0x04
-#define MULTIBOOT_INFO_FLAGS_MODS	0x08
-#define MULTIBOOT_INFO_FLAGS_SYMS1	0x10
-#define MULTIBOOT_INFO_FLAGS_SYMS2	0x20
-#define MULTIBOOT_INFO_FLAGS_MMAP	0x40
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-#include <arch/boot/memmap.h>
-
-/** Convert 32-bit multiboot address to a pointer. */
-#define MULTIBOOT_PTR(mba)  ((void *) (uintptr_t) (mba))
-
-/** Multiboot 32-bit address. */
-typedef uint32_t mbaddr_t;
-
-/** Multiboot module structure */
-typedef struct {
-	mbaddr_t start;
-	mbaddr_t end;
-	mbaddr_t string;
-	uint32_t reserved;
-} __attribute__((packed)) multiboot_module_t;
-
-extern void multiboot_cmdline(const char *);
-
-extern void multiboot_extract_command(char *, size_t, const char *);
-extern void multiboot_extract_argument(char *, size_t, const char *);
-extern void multiboot_info_parse(uint32_t, const multiboot_info_t *);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/multiboot/multiboot2.h
===================================================================
--- kernel/genarch/include/genarch/multiboot/multiboot2.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MULTIBOOT2_H_
-#define KERN_MULTIBOOT2_H_
-
-#define MULTIBOOT2_HEADER_MAGIC      0xe85250d6
-#define MULTIBOOT2_HEADER_ARCH_I386  0
-
-#define MULTIBOOT2_LOADER_MAGIC  0x36d76289
-
-#define MULTIBOOT2_FLAGS_REQUIRED  0
-#define MULTIBOOT2_FLAGS_CONSOLE   0x03
-
-#define MULTIBOOT2_TAG_TERMINATOR     0
-#define MULTIBOOT2_TAG_INFO_REQ       1
-#define MULTIBOOT2_TAG_ADDRESS        2
-#define MULTIBOOT2_TAG_ENTRY_ADDRESS  3
-#define MULTIBOOT2_TAG_FLAGS          4
-#define MULTIBOOT2_TAG_FRAMEBUFFER    5
-#define MULTIBOOT2_TAG_MODULE_ALIGN   6
-
-#define MULTIBOOT2_TAG_CMDLINE 1
-#define MULTIBOOT2_TAG_MODULE  3
-#define MULTIBOOT2_TAG_MEMMAP  6
-#define MULTIBOOT2_TAG_FBINFO  8
-
-#define MULTIBOOT2_VISUAL_INDEXED  0
-#define MULTIBOOT2_VISUAL_RGB      1
-#define MULTIBOOT2_VISUAL_EGA      2
-
-#ifndef __ASSEMBLER__
-
-#include <typedefs.h>
-#include <arch/boot/memmap.h>
-
-/** Multiboot2 32-bit address. */
-typedef uint32_t mb2addr_t;
-
-/** Multiboot2 information structure */
-typedef struct {
-	uint32_t size;
-	uint32_t reserved;
-} __attribute__((packed)) multiboot2_info_t;
-
-/** Multiboot2 cmdline structure */
-typedef struct {
-	char string[0];
-} __attribute__((packed)) multiboot2_cmdline_t;
-
-/** Multiboot2 modules structure */
-typedef struct {
-	mb2addr_t start;
-	mb2addr_t end;
-	char string[];
-} __attribute__((packed)) multiboot2_module_t;
-
-/** Multiboot2 memmap structure */
-typedef struct {
-	uint32_t entry_size;
-	uint32_t entry_version;
-} __attribute__((packed)) multiboot2_memmap_t;
-
-/** Multiboot2 memmap entry structure */
-typedef struct {
-	uint64_t base_address;
-	uint64_t size;
-	uint32_t type;
-	uint32_t reserved;
-} __attribute__((packed)) multiboot2_memmap_entry_t;
-
-/** Multiboot2 palette structure */
-typedef struct {
-	uint8_t red;
-	uint8_t green;
-	uint8_t blue;
-} __attribute__((packed)) multiboot2_colorinfo_palette_t;
-
-/** Multiboot2 indexed color information structure */
-typedef struct {
-	uint32_t colors;
-	multiboot2_colorinfo_palette_t palette[];
-} __attribute__((packed)) multiboot2_colorinfo_indexed_t;
-
-/** Multiboot2 RGB color information structure */
-typedef struct {
-	uint8_t red_pos;
-	uint8_t red_size;
-	uint8_t green_pos;
-	uint8_t green_size;
-	uint8_t blue_pos;
-	uint8_t blue_size;
-} __attribute__((packed)) multiboot2_colorinfo_rgb_t;
-
-/** Multiboot2 framebuffer information structure */
-typedef struct {
-	uint64_t addr;
-	uint32_t scanline;
-	uint32_t width;
-	uint32_t height;
-	uint8_t bpp;
-	uint8_t visual;
-	uint8_t reserved;
-	union {
-		multiboot2_colorinfo_indexed_t indexed;
-		multiboot2_colorinfo_rgb_t rgb;
-	};
-} __attribute__((packed)) multiboot2_fbinfo_t;
-
-/** Generic multiboot2 tag */
-typedef struct {
-	uint32_t type;
-	uint32_t size;
-	union {
-		multiboot2_cmdline_t cmdline;
-		multiboot2_module_t module;
-		multiboot2_memmap_t memmap;
-		multiboot2_fbinfo_t fbinfo;
-	};
-} __attribute__((packed)) multiboot2_tag_t;
-
-extern void multiboot2_info_parse(uint32_t, const multiboot2_info_t *);
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/multiboot/multiboot_info_struct.h
===================================================================
--- kernel/genarch/include/genarch/multiboot/multiboot_info_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_MULTIBOOT_INFO_STRUCT_H_
-#define KERN_MULTIBOOT_INFO_STRUCT_H_
-
-#define MULTIBOOT_INFO_OFFSET_FLAGS        0x00
-#define MULTIBOOT_INFO_OFFSET_MEM_LOWER    0x04
-#define MULTIBOOT_INFO_OFFSET_MEM_UPPER    0x08
-#define MULTIBOOT_INFO_OFFSET_BOOT_DEVICE  0x0c
-#define MULTIBOOT_INFO_OFFSET_CMD_LINE     0x10
-#define MULTIBOOT_INFO_OFFSET_MODS_COUNT   0x14
-#define MULTIBOOT_INFO_OFFSET_MODS_ADDR    0x18
-#define MULTIBOOT_INFO_OFFSET_SYMS         0x1c
-#define MULTIBOOT_INFO_OFFSET_MMAP_LENGTH  0x2c
-#define MULTIBOOT_INFO_OFFSET_MMAP_ADDR    0x30
-#define MULTIBOOT_INFO_SIZE                0x34
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct multiboot_info {
-	uint32_t flags;
-	uint32_t mem_lower;
-	uint32_t mem_upper;
-	uint32_t boot_device;
-	uint32_t cmd_line;
-	uint32_t mods_count;
-	uint32_t mods_addr;
-	uint32_t syms[4];
-	uint32_t mmap_length;
-	uint32_t mmap_addr;
-} __attribute__((packed)) multiboot_info_t;
-
-#endif
-#endif
Index: rnel/genarch/include/genarch/multiboot/multiboot_memmap_struct.h
===================================================================
--- kernel/genarch/include/genarch/multiboot/multiboot_memmap_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_MULTIBOOT_MEMMAP_STRUCT_H_
-#define KERN_MULTIBOOT_MEMMAP_STRUCT_H_
-
-#include <arch/boot/memmap_struct.h>
-
-#define MULTIBOOT_MEMMAP_OFFSET_SIZE     0x00
-#define MULTIBOOT_MEMMAP_OFFSET_MM_INFO  0x04
-#define MULTIBOOT_MEMMAP_SIZE            0x18
-
-#define MULTIBOOT_MEMMAP_SIZE_SIZE       0x04
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct multiboot_memmap {
-	uint32_t size;
-	e820memmap_t mm_info;
-} __attribute__((packed)) multiboot_memmap_t;
-
-#endif
-#endif
Index: rnel/genarch/include/genarch/ofw/ebus.h
===================================================================
--- kernel/genarch/include/genarch/ofw/ebus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_EBUS_H_
-#define KERN_EBUS_H_
-
-#include <genarch/ofw/ofw_tree.h>
-#include <typedefs.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-
-typedef struct {
-	uint32_t space;
-	uint32_t addr;
-	uint32_t size;
-} __attribute__((packed)) ofw_ebus_reg_t;
-
-typedef struct {
-	uint32_t child_space;
-	uint32_t child_base;
-	uint32_t parent_space;
-
-	/* Group phys.mid and phys.lo together */
-	uint64_t parent_base;
-	uint32_t size;
-} __attribute__((packed)) ofw_ebus_range_t;
-
-typedef struct {
-	uint32_t space;
-	uint32_t addr;
-	uint32_t intr;
-	uint32_t controller_handle;
-	uint32_t controller_ino;
-} __attribute__((packed)) ofw_ebus_intr_map_t;
-
-typedef struct {
-	uint32_t space_mask;
-	uint32_t addr_mask;
-	uint32_t intr_mask;
-} __attribute__((packed)) ofw_ebus_intr_mask_t;
-
-extern bool ofw_ebus_apply_ranges(ofw_tree_node_t *, ofw_ebus_reg_t *,
-    uintptr_t *);
-extern bool ofw_ebus_map_interrupt(ofw_tree_node_t *, ofw_ebus_reg_t *,
-    uint32_t, int *, cir_t *, void **);
-
-#endif
Index: rnel/genarch/include/genarch/ofw/ofw_tree.h
===================================================================
--- kernel/genarch/include/genarch/ofw/ofw_tree.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_OFW_TREE_H_
-#define KERN_OFW_TREE_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-#define OFW_TREE_PROPERTY_MAX_NAMELEN  32
-
-typedef uint32_t phandle;
-
-/** Memory representation of OpenFirmware device tree node property. */
-typedef struct {
-	char name[OFW_TREE_PROPERTY_MAX_NAMELEN];
-	size_t size;
-	void *value;
-} ofw_tree_property_t;
-
-/** Memory representation of OpenFirmware device tree node. */
-typedef struct ofw_tree_node {
-	struct ofw_tree_node *parent;
-	struct ofw_tree_node *peer;
-	struct ofw_tree_node *child;
-
-	phandle node_handle;            /**< Old OpenFirmware node handle. */
-
-	char *da_name;                  /**< Disambigued name. */
-
-	size_t properties;              /**< Number of properties. */
-	ofw_tree_property_t *property;
-
-	/**
-	 * Pointer to a structure representing respective device.
-	 * Its semantics is device dependent.
-	 */
-	void *device;
-} ofw_tree_node_t;
-
-/* Walker for visiting OpenFirmware device tree nodes. */
-typedef bool (*ofw_tree_walker_t)(ofw_tree_node_t *, void *);
-
-extern void ofw_tree_init(ofw_tree_node_t *);
-extern void ofw_sysinfo_map(void);
-
-extern const char *ofw_tree_node_name(const ofw_tree_node_t *);
-extern ofw_tree_node_t *ofw_tree_lookup(const char *);
-extern ofw_tree_property_t *ofw_tree_getprop(const ofw_tree_node_t *,
-    const char *);
-extern void ofw_tree_walk_by_device_type(const char *, ofw_tree_walker_t,
-    void *);
-
-extern ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *, const char *);
-extern ofw_tree_node_t *ofw_tree_find_child_by_device_type(ofw_tree_node_t *,
-    const char *);
-
-extern ofw_tree_node_t *ofw_tree_find_peer_by_device_type(ofw_tree_node_t *,
-    const char *);
-extern ofw_tree_node_t *ofw_tree_find_peer_by_name(ofw_tree_node_t *,
-    const char *);
-extern ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *,
-    phandle);
-
-#endif
Index: rnel/genarch/include/genarch/ofw/pci.h
===================================================================
--- kernel/genarch/include/genarch/ofw/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_PCI_H_
-#define KERN_PCI_H_
-
-#include <genarch/ofw/ofw_tree.h>
-#include <typedefs.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-
-typedef struct {
-	/* Needs to be masked to obtain pure space id */
-	uint32_t space;
-
-	/* Group phys.mid and phys.lo together */
-	uint64_t addr;
-	uint64_t size;
-} __attribute__((packed)) ofw_pci_reg_t;
-
-typedef struct {
-	uint32_t space;
-
-	/* Group phys.mid and phys.lo together */
-	uint64_t child_base;
-	uint64_t parent_base;
-	uint64_t size;
-} __attribute__((packed)) ofw_pci_range_t;
-
-extern bool ofw_pci_apply_ranges(ofw_tree_node_t *, ofw_pci_reg_t *,
-    uintptr_t *);
-
-extern bool ofw_pci_reg_absolutize(ofw_tree_node_t *, ofw_pci_reg_t *,
-    ofw_pci_reg_t *);
-
-extern bool ofw_pci_map_interrupt(ofw_tree_node_t *, ofw_pci_reg_t *,
-    int, int *, cir_t *, void **);
-
-#endif
Index: rnel/genarch/include/genarch/ofw/sbus.h
===================================================================
--- kernel/genarch/include/genarch/ofw/sbus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_SBUS_H_
-#define KERN_SBUS_H_
-
-#include <genarch/ofw/ofw_tree.h>
-#include <typedefs.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-
-typedef struct {
-	uint64_t addr;
-	uint32_t size;
-} __attribute__((packed)) ofw_sbus_reg_t;
-
-typedef struct {
-	uint64_t child_base;
-	uint64_t parent_base;
-	uint32_t size;
-} __attribute__((packed)) ofw_sbus_range_t;
-
-extern bool ofw_sbus_apply_ranges(ofw_tree_node_t *, ofw_sbus_reg_t *,
-    uintptr_t *);
-
-#endif
Index: rnel/genarch/include/genarch/ofw/upa.h
===================================================================
--- kernel/genarch/include/genarch/ofw/upa.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_UPA_H_
-#define KERN_UPA_H_
-
-#include <genarch/ofw/ofw_tree.h>
-#include <typedefs.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-
-typedef struct {
-	uint64_t addr;
-	uint64_t size;
-} __attribute__((packed)) ofw_upa_reg_t;
-
-extern bool ofw_upa_apply_ranges(ofw_tree_node_t *, ofw_upa_reg_t *,
-    uintptr_t *);
-
-#endif
Index: rnel/genarch/include/genarch/pic/pic_ops.h
===================================================================
--- kernel/genarch/include/genarch/pic/pic_ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2019 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PIC_OPS_H_
-#define KERN_PIC_OPS_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-typedef struct {
-	const char *(*get_name)(void);
-	void (*disable_irqs)(uint16_t);
-	void (*enable_irqs)(uint16_t);
-	void (*eoi)(unsigned int);
-	bool (*is_spurious)(unsigned int);
-	void (*handle_spurious)(unsigned int);
-} pic_ops_t;
-
-extern pic_ops_t *pic_ops;
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/softint/division.h
===================================================================
--- kernel/genarch/include/genarch/softint/division.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_DIVISION_H_
-#define KERN_DIVISION_H_
-
-#include <cc.h>
-
-#ifdef CONFIG_LTO
-#define DO_NOT_DISCARD ATTRIBUTE_USED
-#else
-#define DO_NOT_DISCARD
-#endif
-
-extern int __divsi3(int, int);
-extern long long __divdi3(long long, long long);
-
-extern unsigned int __udivsi3(unsigned int, unsigned int);
-extern unsigned long long __udivdi3(unsigned long long, unsigned long long) DO_NOT_DISCARD;
-
-extern int __modsi3(int, int);
-extern long long __moddi3(long long, long long);
-
-extern unsigned int __umodsi3(unsigned int, unsigned int);
-extern unsigned long long __umoddi3(unsigned long long, unsigned long long) DO_NOT_DISCARD;
-
-extern int __divmodsi3(int, int, int *);
-extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *);
-
-extern long long __divmoddi3(long long, long long, long long *);
-extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long,
-    unsigned long long *);
-extern unsigned long long __udivmoddi4(unsigned long long, unsigned long long,
-    unsigned long long *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/softint/multiplication.h
===================================================================
--- kernel/genarch/include/genarch/softint/multiplication.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2009 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KERN_MULTIPLICATION_H_
-#define KERN_MULTIPLICATION_H_
-
-/* 64 bit multiplication */
-extern long long __muldi3(long long, long long);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/srln/srln.h
===================================================================
--- kernel/genarch/include/genarch/srln/srln.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KERN_SRLN_H_
-#define KERN_SRLN_H_
-
-#include <console/chardev.h>
-#include <proc/thread.h>
-
-typedef struct {
-	thread_t *thread;
-
-	indev_t *sink;
-	indev_t raw;
-} srln_instance_t;
-
-extern srln_instance_t *srln_init(void);
-extern indev_t *srln_wire(srln_instance_t *, indev_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/meson.build
===================================================================
--- kernel/genarch/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-## Accepted configuration directives
-#
-
-_src = []
-_check = []
-
-if CONFIG_ACPI
-	_src += [ 'acpi/acpi.c', 'acpi/madt.c' ]
-endif
-
-if CONFIG_PAGE_PT
-	_src += [ 'mm/page_pt.c', 'mm/as_pt.c' ]
-endif
-
-if CONFIG_PAGE_HT
-	_src += [ 'mm/page_ht.c', 'mm/as_ht.c' ]
-endif
-
-if CONFIG_ASID
-	_src += [ 'mm/asid.c' ]
-endif
-
-if CONFIG_ASID_FIFO
-	_src += [ 'mm/asid_fifo.c' ]
-endif
-
-if CONFIG_SOFTINT
-	_src += [ 'softint/division.c', 'softint/multiplication.c' ]
-endif
-
-if CONFIG_FB
-	_src += [ 'fb/font-8x16.c', 'fb/fb.c', 'fb/bfb.c' ]
-endif
-
-if CONFIG_DSRLNIN
-	_src += [ 'drivers/dsrln/dsrlnin.c' ]
-endif
-
-if CONFIG_DSRLNOUT
-	_src += [ 'drivers/dsrln/dsrlnout.c' ]
-endif
-
-if CONFIG_I8042
-	_src += [ 'drivers/i8042/i8042.c' ]
-endif
-
-if CONFIG_I8259
-	_src += [ 'drivers/i8259/i8259.c' ]
-endif
-
-if CONFIG_NS16550
-	_src += [ 'drivers/ns16550/ns16550.c' ]
-endif
-
-if CONFIG_PL011_UART
-	_src += [ 'drivers/pl011/pl011.c' ]
-endif
-
-if CONFIG_PL050
-	_src += [ 'drivers/pl050/pl050.c' ]
-endif
-
-if CONFIG_S3C24XX_IRQC
-	_src += [ 'drivers/s3c24xx/irqc.c' ]
-endif
-
-if CONFIG_S3C24XX_UART
-	_src += [ 'drivers/s3c24xx/uart.c' ]
-endif
-
-if CONFIG_OMAP_UART
-	_src += [ 'drivers/omap/uart.c' ]
-endif
-
-if CONFIG_AM335X_TIMERS
-	_src += [ 'drivers/am335x/timer.c' ]
-endif
-
-if CONFIG_BCM2835_MAILBOX
-	_src += [ 'drivers/bcm2835/irc.c', 'drivers/bcm2835/mbox.c', 'drivers/bcm2835/timer.c' ]
-endif
-
-if CONFIG_GICV2
-	_src += [ 'drivers/gicv2/gicv2.c' ]
-endif
-
-if CONFIG_VIA_CUDA
-	_src += [ 'drivers/via-cuda/cuda.c' ]
-endif
-
-if CONFIG_PC_KBD
-	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_pc.c' ]
-endif
-
-if CONFIG_AT_KBD
-	_src += [ 'kbrd/kbrd_at.c', 'kbrd/scanc_at.c' ]
-endif
-
-if CONFIG_SUN_KBD
-	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_sun.c' ]
-endif
-
-if CONFIG_MAC_KBD
-	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_mac.c' ]
-endif
-
-if CONFIG_SRLN
-	_src += [ 'srln/srln.c' ]
-endif
-
-if CONFIG_OFW_TREE
-	_src += [ 'ofw/ofw_tree.c' ]
-endif
-
-if CONFIG_OFW_PCI
-	_src += [ 'ofw/ebus.c', 'ofw/pci.c', 'ofw/sbus.c', 'ofw/upa.c' ]
-endif
-
-if CONFIG_MULTIBOOT
-	_src += [ 'multiboot/common.c', 'multiboot/multiboot.c', 'multiboot/multiboot2.c' ]
-	_check += [ 'multiboot/multiboot_memmap_struct.h', 'multiboot/multiboot_info_struct.h' ]
-endif
-
-if CONFIG_EGA
-	_src += [ 'drivers/ega/ega.c' ]
-endif
-
-if CONFIG_IOMAP_BITMAP
-	_src += [ 'ddi/ddi-bitmap.c' ]
-endif
-
-if CONFIG_IOMAP_DUMMY
-	_src += [ 'ddi/ddi-dummy.c' ]
-endif
-
-
-genarch_src = []
-
-foreach f : _src
-	genarch_src += files('src' / f)
-endforeach
-
-foreach f : _check
-	genarch_src += [ autocheck.process('include' / 'genarch' / f) ]
-endforeach
Index: rnel/genarch/src/acpi/acpi.c
===================================================================
--- kernel/genarch/src/acpi/acpi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-
-/**
- * @file
- * @brief Advanced Configuration and Power Interface (ACPI) initialization.
- */
-
-#include <genarch/acpi/acpi.h>
-#include <genarch/acpi/madt.h>
-#include <arch/bios/bios.h>
-#include <debug.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <log.h>
-#include <memw.h>
-
-#define RSDP_SIGNATURE      "RSD PTR "
-#define RSDP_REVISION_OFFS  15
-
-#define CMP_SIGNATURE(left, right) \
-	(((left)[0] == (right)[0]) && \
-	((left)[1] == (right)[1]) && \
-	((left)[2] == (right)[2]) && \
-	((left)[3] == (right)[3]))
-
-struct acpi_rsdp *acpi_rsdp = NULL;
-struct acpi_rsdt *acpi_rsdt = NULL;
-struct acpi_xsdt *acpi_xsdt = NULL;
-
-struct acpi_signature_map signature_map[] = {
-	{
-		(uint8_t *) "APIC",
-		(void *) &acpi_madt,
-		"Multiple APIC Description Table"
-	}
-};
-
-static int rsdp_check(uint8_t *_rsdp)
-{
-	struct acpi_rsdp *rsdp = (struct acpi_rsdp *) _rsdp;
-	uint8_t sum = 0;
-	uint32_t i;
-
-	for (i = 0; i < 20; i++)
-		sum = (uint8_t) (sum + _rsdp[i]);
-
-	if (sum)
-		return 0; /* bad checksum */
-
-	if (rsdp->revision == 0)
-		return 1; /* ACPI 1.0 */
-
-	for (; i < rsdp->length; i++)
-		sum = (uint8_t) (sum + _rsdp[i]);
-
-	return !sum;
-}
-
-int acpi_sdt_check(uint8_t *sdt)
-{
-	struct acpi_sdt_header *hdr = (struct acpi_sdt_header *) sdt;
-	uint8_t sum = 0;
-	unsigned int i;
-
-	for (i = 0; i < hdr->length; i++)
-		sum = (uint8_t) (sum + sdt[i]);
-
-	return !sum;
-}
-
-static struct acpi_sdt_header *map_sdt(struct acpi_sdt_header *psdt)
-{
-	struct acpi_sdt_header *vhdr;
-	struct acpi_sdt_header *vsdt;
-
-	/* Start with mapping the header only. */
-	vhdr = (struct acpi_sdt_header *) km_map((uintptr_t) psdt,
-	    sizeof(struct acpi_sdt_header), KM_NATURAL_ALIGNMENT,
-	    PAGE_READ | PAGE_NOT_CACHEABLE);
-
-	/* Now we can map the entire structure. */
-	vsdt = (struct acpi_sdt_header *) km_map((uintptr_t) psdt,
-	    vhdr->length, KM_NATURAL_ALIGNMENT,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-
-	// TODO: do not leak vtmp
-
-	return vsdt;
-}
-
-static void configure_via_rsdt(void)
-{
-	size_t i;
-	size_t j;
-	size_t cnt = (acpi_rsdt->header.length - sizeof(struct acpi_sdt_header)) /
-	    sizeof(uint32_t);
-
-	for (i = 0; i < cnt; i++) {
-		for (j = 0; j < sizeof(signature_map) /
-		    sizeof(struct acpi_signature_map); j++) {
-			struct acpi_sdt_header *hdr =
-			    (struct acpi_sdt_header *) (sysarg_t) acpi_rsdt->entry[i];
-
-			struct acpi_sdt_header *vhdr = map_sdt(hdr);
-			if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
-				if (!acpi_sdt_check((uint8_t *) vhdr))
-					break;
-
-				*signature_map[j].sdt_ptr = vhdr;
-				LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
-				    signature_map[j].description);
-			}
-		}
-	}
-}
-
-static void configure_via_xsdt(void)
-{
-	size_t i;
-	size_t j;
-	size_t cnt = (acpi_xsdt->header.length - sizeof(struct acpi_sdt_header)) /
-	    sizeof(uint64_t);
-
-	for (i = 0; i < cnt; i++) {
-		for (j = 0; j < sizeof(signature_map) /
-		    sizeof(struct acpi_signature_map); j++) {
-			struct acpi_sdt_header *hdr =
-			    (struct acpi_sdt_header *) ((uintptr_t) acpi_xsdt->entry[i]);
-
-			struct acpi_sdt_header *vhdr = map_sdt(hdr);
-			if (CMP_SIGNATURE(vhdr->signature, signature_map[j].signature)) {
-				if (!acpi_sdt_check((uint8_t *) vhdr))
-					break;
-
-				*signature_map[j].sdt_ptr = vhdr;
-				LOG("%p: ACPI %s", *signature_map[j].sdt_ptr,
-				    signature_map[j].description);
-			}
-		}
-	}
-}
-
-static uint8_t *search_rsdp(uint8_t *base, size_t len)
-{
-	for (size_t i = 0; i < len; i += 16) {
-		if (!__builtin_memcmp(&base[i], RSDP_SIGNATURE, 8) &&
-		    rsdp_check(&base[i]))
-			return &base[i];
-	}
-
-	return NULL;
-}
-
-void acpi_init(void)
-{
-	/*
-	 * Find Root System Description Pointer
-	 * 1. search first 1K of EBDA
-	 * 2. search 128K starting at 0xe0000
-	 */
-
-	uint8_t *rsdp = NULL;
-
-	if (ebda)
-		rsdp = search_rsdp((uint8_t *) PA2KA(ebda), 1024);
-
-	if (!rsdp)
-		rsdp = search_rsdp((uint8_t *) PA2KA(0xe0000), 128 * 1024);
-
-	if (!rsdp)
-		return;
-
-	acpi_rsdp = (struct acpi_rsdp *) rsdp;
-
-	LOG("%p: ACPI Root System Description Pointer", acpi_rsdp);
-
-	uintptr_t acpi_rsdt_p = (uintptr_t) acpi_rsdp->rsdt_address;
-	uintptr_t acpi_xsdt_p = 0;
-
-	if (acpi_rsdp->revision)
-		acpi_xsdt_p = (uintptr_t) acpi_rsdp->xsdt_address;
-
-	if (acpi_rsdt_p)
-		acpi_rsdt = (struct acpi_rsdt *) map_sdt(
-		    (struct acpi_sdt_header *) acpi_rsdt_p);
-
-	if (acpi_xsdt_p)
-		acpi_xsdt = (struct acpi_xsdt *) map_sdt(
-		    (struct acpi_sdt_header *) acpi_xsdt_p);
-
-	if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
-		log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum");
-		return;
-	}
-
-	if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) {
-		log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum");
-		return;
-	}
-
-	if (acpi_xsdt)
-		configure_via_xsdt();
-	else if (acpi_rsdt)
-		configure_via_rsdt();
-}
-
-/** @}
- */
Index: rnel/genarch/src/acpi/madt.c
===================================================================
--- kernel/genarch/src/acpi/madt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,263 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Multiple APIC Description Table (MADT) parsing.
- */
-
-#include <assert.h>
-#include <typedefs.h>
-#include <genarch/acpi/acpi.h>
-#include <genarch/acpi/madt.h>
-#include <arch/smp/apic.h>
-#include <arch/smp/smp.h>
-#include <panic.h>
-#include <config.h>
-#include <log.h>
-#include <stdlib.h>
-#include <gsort.h>
-
-struct acpi_madt *acpi_madt = NULL;
-
-#ifdef CONFIG_SMP
-
-/**
- * Standard ISA IRQ map; can be overriden by
- * Interrupt Source Override entries of MADT.
- */
-static int isa_irq_map[] =
-    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-
-struct madt_l_apic *madt_l_apic_entries = NULL;
-struct madt_io_apic *madt_io_apic_entries = NULL;
-
-static size_t madt_l_apic_entry_index = 0;
-static size_t madt_io_apic_entry_index = 0;
-static size_t madt_l_apic_entry_cnt = 0;
-static size_t madt_io_apic_entry_cnt = 0;
-
-static struct madt_apic_header **madt_entries_index = NULL;
-
-const char *entry[] = {
-	"L_APIC",
-	"IO_APIC",
-	"INTR_SRC_OVRD",
-	"NMI_SRC",
-	"L_APIC_NMI",
-	"L_APIC_ADDR_OVRD",
-	"IO_SAPIC",
-	"L_SAPIC",
-	"PLATFORM_INTR_SRC"
-};
-
-static uint8_t madt_cpu_apic_id(size_t i)
-{
-	assert(i < madt_l_apic_entry_cnt);
-
-	return ((struct madt_l_apic *)
-	    madt_entries_index[madt_l_apic_entry_index + i])->apic_id;
-}
-
-static bool madt_cpu_enabled(size_t i)
-{
-	assert(i < madt_l_apic_entry_cnt);
-
-	/*
-	 * FIXME: The current local APIC driver limits usable
-	 * CPU IDs to 8.
-	 *
-	 */
-	if (i > 7)
-		return false;
-
-	return ((struct madt_l_apic *)
-	    madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1;
-}
-
-static bool madt_cpu_bootstrap(size_t i)
-{
-	assert(i < madt_l_apic_entry_cnt);
-
-	return ((struct madt_l_apic *)
-	    madt_entries_index[madt_l_apic_entry_index + i])->apic_id ==
-	    bsp_l_apic;
-}
-
-static int madt_irq_to_pin(unsigned int irq)
-{
-	if (irq >= sizeof(isa_irq_map) / sizeof(int))
-		return (int) irq;
-
-	return isa_irq_map[irq];
-}
-
-/** ACPI MADT Implementation of SMP configuration interface.
- *
- */
-struct smp_config_operations madt_config_operations = {
-	.cpu_enabled = madt_cpu_enabled,
-	.cpu_bootstrap = madt_cpu_bootstrap,
-	.cpu_apic_id = madt_cpu_apic_id,
-	.irq_to_pin = madt_irq_to_pin
-};
-
-static int madt_cmp(void *a, void *b, void *arg)
-{
-	uint8_t typea = (*((struct madt_apic_header **) a))->type;
-	uint8_t typeb = (*((struct madt_apic_header **) b))->type;
-
-	if (typea > typeb)
-		return 1;
-
-	if (typea < typeb)
-		return -1;
-
-	return 0;
-}
-
-static void madt_l_apic_entry(struct madt_l_apic *la, size_t i)
-{
-	if (madt_l_apic_entry_cnt == 0)
-		madt_l_apic_entry_index = i;
-
-	madt_l_apic_entry_cnt++;
-
-	if (!(la->flags & 0x1)) {
-		/* Processor is unusable, skip it. */
-		return;
-	}
-
-	apic_id_mask |= 1 << la->apic_id;
-}
-
-static void madt_io_apic_entry(struct madt_io_apic *ioa, size_t i)
-{
-	if (madt_io_apic_entry_cnt == 0) {
-		/* Remember index of the first io apic entry */
-		madt_io_apic_entry_index = i;
-		io_apic = (uint32_t *) (sysarg_t) ioa->io_apic_address;
-	} else {
-		/* Currently not supported */
-	}
-
-	madt_io_apic_entry_cnt++;
-}
-
-static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override,
-    size_t i)
-{
-	assert(override->source < sizeof(isa_irq_map) / sizeof(int));
-
-	isa_irq_map[override->source] = override->global_int;
-}
-
-void acpi_madt_parse(void)
-{
-	struct madt_apic_header *end = (struct madt_apic_header *)
-	    (((uint8_t *) acpi_madt) + acpi_madt->header.length);
-	struct madt_apic_header *hdr;
-
-	l_apic = (uint32_t *) (sysarg_t) acpi_madt->l_apic_address;
-
-	/* Count MADT entries */
-	unsigned int madt_entries_index_cnt = 0;
-	for (hdr = acpi_madt->apic_header; hdr < end;
-	    hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length))
-		madt_entries_index_cnt++;
-
-	/* Create MADT APIC entries index array */
-	madt_entries_index = (struct madt_apic_header **)
-	    malloc(madt_entries_index_cnt * sizeof(struct madt_apic_header *));
-	if (!madt_entries_index)
-		panic("Memory allocation error.");
-
-	size_t i = 0;
-
-	for (hdr = acpi_madt->apic_header; hdr < end;
-	    hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) {
-		madt_entries_index[i] = hdr;
-		i++;
-	}
-
-	/* Sort MADT index structure */
-	if (!gsort(madt_entries_index, madt_entries_index_cnt,
-	    sizeof(struct madt_apic_header *), madt_cmp, NULL))
-		panic("Sorting error.");
-
-	/* Parse MADT entries */
-	for (i = 0; i < madt_entries_index_cnt; i++) {
-		hdr = madt_entries_index[i];
-
-		switch (hdr->type) {
-		case MADT_L_APIC:
-			madt_l_apic_entry((struct madt_l_apic *) hdr, i);
-			break;
-		case MADT_IO_APIC:
-			madt_io_apic_entry((struct madt_io_apic *) hdr, i);
-			break;
-		case MADT_INTR_SRC_OVRD:
-			madt_intr_src_ovrd_entry((struct madt_intr_src_ovrd *) hdr, i);
-			break;
-		case MADT_NMI_SRC:
-		case MADT_L_APIC_NMI:
-		case MADT_L_APIC_ADDR_OVRD:
-		case MADT_IO_SAPIC:
-		case MADT_L_SAPIC:
-		case MADT_PLATFORM_INTR_SRC:
-			log(LF_ARCH, LVL_WARN,
-			    "MADT: Skipping %s entry (type=%" PRIu8 ")",
-			    entry[hdr->type], hdr->type);
-			break;
-		default:
-			if ((hdr->type >= MADT_RESERVED_SKIP_BEGIN) &&
-			    (hdr->type <= MADT_RESERVED_SKIP_END))
-				log(LF_ARCH, LVL_NOTE,
-				    "MADT: Skipping reserved entry (type=%" PRIu8 ")",
-				    hdr->type);
-
-			if (hdr->type >= MADT_RESERVED_OEM_BEGIN)
-				log(LF_ARCH, LVL_NOTE,
-				    "MADT: Skipping OEM entry (type=%" PRIu8 ")",
-				    hdr->type);
-
-			break;
-		}
-	}
-
-	if (madt_l_apic_entry_cnt > 0)
-		config.cpu_count = madt_l_apic_entry_cnt;
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/genarch/src/ddi/ddi-bitmap.c
===================================================================
--- kernel/genarch/src/ddi/ddi-bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_amd64_ddi
- * @{
- */
-/** @file
- */
-
-#include <ddi/ddi.h>
-#include <arch/ddi/ddi.h>
-#include <proc/task.h>
-#include <typedefs.h>
-#include <adt/bitmap.h>
-#include <stdlib.h>
-#include <arch/pm.h>
-#include <errno.h>
-#include <arch/cpu.h>
-#include <cpu.h>
-#include <arch.h>
-#include <align.h>
-
-/** Enable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task   Task.
- * @param ioaddr Starting I/O space address.
- * @param size   Size of the enabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- *
- */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	size_t elements = ioaddr + size;
-	if (elements > IO_PORTS)
-		return ENOENT;
-
-	if (task->arch.iomap.elements < elements) {
-		/*
-		 * The I/O permission bitmap is too small and needs to be grown.
-		 */
-
-		void *store = malloc(bitmap_size(elements));
-		if (!store)
-			return ENOMEM;
-
-		bitmap_t oldiomap;
-		bitmap_initialize(&oldiomap, task->arch.iomap.elements,
-		    task->arch.iomap.bits);
-
-		bitmap_initialize(&task->arch.iomap, elements, store);
-
-		/*
-		 * Mark the new range inaccessible.
-		 */
-		bitmap_set_range(&task->arch.iomap, oldiomap.elements,
-		    elements - oldiomap.elements);
-
-		/*
-		 * In case there really existed smaller iomap,
-		 * copy its contents and deallocate it.
-		 */
-		if (oldiomap.bits) {
-			bitmap_copy(&task->arch.iomap, &oldiomap,
-			    oldiomap.elements);
-
-			free(oldiomap.bits);
-		}
-	}
-
-	/*
-	 * Enable the range and we are done.
-	 */
-	bitmap_clear_range(&task->arch.iomap, (size_t) ioaddr, size);
-
-	/*
-	 * Increment I/O Permission bitmap generation counter.
-	 */
-	task->arch.iomapver++;
-
-	return EOK;
-}
-
-/** Disable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task   Task.
- * @param ioaddr Starting I/O space address.
- * @param size   Size of the enabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- *
- */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	size_t elements = ioaddr + size;
-	if (elements > IO_PORTS)
-		return ENOENT;
-
-	if (ioaddr >= task->arch.iomap.elements)
-		return EINVAL;
-
-	if (task->arch.iomap.elements < elements)
-		size -= elements - task->arch.iomap.elements;
-
-	/*
-	 * Disable the range.
-	 */
-	bitmap_set_range(&task->arch.iomap, (size_t) ioaddr, size);
-
-	/*
-	 * Increment I/O Permission bitmap generation counter.
-	 */
-	task->arch.iomapver++;
-
-	return 0;
-}
-
-/** @}
- */
Index: rnel/genarch/src/ddi/ddi-dummy.c
===================================================================
--- kernel/genarch/src/ddi/ddi-dummy.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- *  @brief DDI.
- */
-
-#include <ddi/ddi.h>
-#include <proc/task.h>
-#include <typedefs.h>
-
-/** Enable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task   Task.
- * @param ioaddr Starting I/O space address.
- * @param size   Size of the enabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- */
-errno_t ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	return 0;
-}
-
-/** Disable I/O space range for task.
- *
- * Interrupts are disabled and task is locked.
- *
- * @param task   Task.
- * @param ioaddr Starting I/O space address.
- * @param size   Size of the disabled I/O range.
- *
- * @return EOK on success or an error code from errno.h.
- */
-errno_t ddi_iospace_disable_arch(task_t *task, uintptr_t ioaddr, size_t size)
-{
-	return 0;
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/am335x/timer.c
===================================================================
--- kernel/genarch/src/drivers/am335x/timer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM335x timer driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/am335x/timer.h>
-#include <mm/km.h>
-#include <errno.h>
-
-typedef enum {
-	REG_TCLR = 0x00,
-	REG_TCRR = 0x01,
-	REG_TLDR = 0x02,
-	REG_TTGR = 0x04
-} timer_reg_t;
-
-typedef struct timer_regs_mmap {
-	uintptr_t base;
-	size_t size;
-} timer_regs_mmap_t;
-
-static const timer_regs_mmap_t regs_map[TIMERS_MAX] = {
-	{ .base = AM335x_DMTIMER0_BASE_ADDRESS, .size = AM335x_DMTIMER0_SIZE },
-	{ 0, 0 }, /* DMTIMER1 is not supported by this driver */
-	{ .base = AM335x_DMTIMER2_BASE_ADDRESS, .size = AM335x_DMTIMER2_SIZE },
-	{ .base = AM335x_DMTIMER3_BASE_ADDRESS, .size = AM335x_DMTIMER3_SIZE },
-	{ .base = AM335x_DMTIMER4_BASE_ADDRESS, .size = AM335x_DMTIMER4_SIZE },
-	{ .base = AM335x_DMTIMER5_BASE_ADDRESS, .size = AM335x_DMTIMER5_SIZE },
-	{ .base = AM335x_DMTIMER6_BASE_ADDRESS, .size = AM335x_DMTIMER6_SIZE },
-	{ .base = AM335x_DMTIMER7_BASE_ADDRESS, .size = AM335x_DMTIMER7_SIZE },
-};
-
-static void
-write_register_posted(am335x_timer_t *timer, timer_reg_t reg, uint32_t value)
-{
-	am335x_timer_regs_t *regs = timer->regs;
-
-	while (regs->twps & reg)
-		;
-
-	switch (reg) {
-	default:
-		return;
-	case REG_TCLR:
-		regs->tclr = value;
-		break;
-	case REG_TCRR:
-		regs->tcrr = value;
-		break;
-	case REG_TLDR:
-		regs->tldr = value;
-		break;
-	}
-}
-
-errno_t
-am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz,
-    unsigned srcclk_hz)
-{
-	uintptr_t base_addr;
-	size_t size;
-
-	assert(id < TIMERS_MAX);
-	assert(timer != NULL);
-
-	if (id == DMTIMER1_1MS)
-		return ENOTSUP; /* Not supported yet */
-
-	base_addr = regs_map[id].base;
-	size = regs_map[id].size;
-
-	timer->regs = (void *) km_map(base_addr, size, KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE);
-	assert(timer->regs != NULL);
-
-	timer->id = id;
-
-	am335x_timer_regs_t *regs = timer->regs;
-
-	/* Enable the posted mode of operation */
-	regs->tsicr |= AM335x_TIMER_TSICR_POSTED_FLAG;
-
-	/* Stop the timer */
-	am335x_timer_stop(timer);
-
-	/* Perform a soft reset */
-	am335x_timer_reset(timer);
-
-	unsigned tclr = regs->tclr;
-
-	/* Disable compare mode */
-	tclr &= ~AM335x_TIMER_TCLR_CE_FLAG;
-
-	/* Enable auto-reload mode */
-	tclr |= AM335x_TIMER_TCLR_AR_FLAG;
-
-	write_register_posted(timer, REG_TCLR, tclr);
-
-	/* Disable the emulation mode */
-	regs->tiocp_cfg |= AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG;
-
-	unsigned const count = 0xFFFFFFFF - (srcclk_hz / hz + 1);
-	write_register_posted(timer, REG_TCRR, count);
-	write_register_posted(timer, REG_TLDR, count);
-
-	return EOK;
-}
-
-void
-am335x_timer_intr_ack(am335x_timer_t *timer)
-{
-	/* Clear pending OVF event */
-	timer->regs->irqstatus |= AM335x_TIMER_IRQSTATUS_OVF_FLAG;
-}
-
-void
-am335x_timer_reset(am335x_timer_t *timer)
-{
-	/* Initiate soft reset */
-	timer->regs->tiocp_cfg |= AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG;
-	/* Wait until the reset is done */
-	while (timer->regs->tiocp_cfg & AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG)
-		;
-}
-
-void
-am335x_timer_stop(am335x_timer_t *timer)
-{
-	/* Disable the interrupt */
-	timer->regs->irqenable_clr |= AM335x_TIMER_IRQENABLE_CLR_OVF_FLAG;
-	timer->regs->irqwakeen &= ~AM335x_TIMER_IRQWAKEEN_OVF_FLAG;
-	/* Stop the timer */
-	write_register_posted(timer, REG_TCLR,
-	    timer->regs->tclr & ~AM335x_TIMER_TCLR_ST_FLAG);
-}
-
-void
-am335x_timer_start(am335x_timer_t *timer)
-{
-	/* Enable the interrupt */
-	timer->regs->irqenable_set |= AM335x_TIMER_IRQENABLE_SET_OVF_FLAG;
-	timer->regs->irqwakeen |= AM335x_TIMER_IRQWAKEEN_OVF_FLAG;
-	/* Start the clock */
-	write_register_posted(timer, REG_TCLR,
-	    timer->regs->tclr | AM335x_TIMER_TCLR_ST_FLAG);
-}
-
-/**
- * @}
- */
Index: rnel/genarch/src/drivers/bcm2835/irc.c
===================================================================
--- kernel/genarch/src/drivers/bcm2835/irc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Broadcom BCM2835 on-chip interrupt controller driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/bcm2835/irc.h>
-#include <stdio.h>
-
-unsigned shortcut_inums[] = { 7, 9, 10, 18, 19, 53, 54, 55, 56, 57, 62 };
-
-static void bcm2835_irc_dump(bcm2835_irc_t *regs)
-{
-#define DUMP_REG(name) \
-	printf("%s : %08x\n", #name, regs->name);
-
-	DUMP_REG(irq_basic_pending);
-	DUMP_REG(irq_pending1);
-	DUMP_REG(irq_pending2);
-	DUMP_REG(fiq_control);
-
-	for (int i = 0; i < 3; ++i) {
-		DUMP_REG(irq_enable[i]);
-		DUMP_REG(irq_disable[i]);
-	}
-#undef DUMP_REG
-}
-
-void bcm2835_irc_init(bcm2835_irc_t *regs)
-{
-	/* Disable all interrupts */
-	regs->irq_disable[BANK_GPU0] = 0xffffffff;
-	regs->irq_disable[BANK_GPU1] = 0xffffffff;
-	regs->irq_disable[BANK_ARM]  = 0xffffffff;
-
-	/* Disable FIQ generation */
-	regs->fiq_control = 0;
-}
-
-static int ffs(unsigned int x)
-{
-	int ret;
-
-	asm volatile (
-	    "clz r0, %[x]\n"
-	    "rsb %[ret], r0, #32\n"
-	    : [ret] "=r" (ret)
-	    : [x] "r" (x)
-	    : "r0"
-	);
-
-	return ret;
-}
-
-unsigned bcm2835_irc_inum_get(bcm2835_irc_t *regs)
-{
-	uint32_t pending;
-	int inum = -1;
-
-	pending = regs->irq_basic_pending;
-
-	/*
-	 * The basic pending register shows interrupts pending from ARM
-	 * peripherals and it also contains, in order to speed up processing,
-	 * additional information about pending GPU interrupts:
-	 *
-	 *  - bits 0-7 are associated to ARM peripherals
-	 *  - bit 8 is 1 when at least one bit is set in pending register 1
-	 *  - bit 9 is 1 when at least one bit is set in pending register 2
-	 *  - bits 10-20 indicate pending status of selected GPU peripherals
-	 *
-	 *  Reference: BCM2835 ARM Peripherals, p.113
-	 */
-
-	if (pending & IRQ_PEND_ARM_M) {
-		inum = MAKE_IRQ(BANK_ARM, ffs(pending & IRQ_PEND_ARM_M) - 1);
-	} else if (pending & IRQ_PEND_SHORT_M) {
-		int pos = (pending & IRQ_PEND_SHORT_M) >> IRQ_PEND_SHORT_S;
-		inum = shortcut_inums[ffs(pos) - 1];
-	} else if (pending & IRQ_PEND_GPU0_M) {
-		inum = MAKE_IRQ(BANK_GPU0, ffs(regs->irq_pending1) - 1);
-	} else if (pending & IRQ_PEND_GPU1_M) {
-		inum = MAKE_IRQ(BANK_GPU1, ffs(regs->irq_pending2) - 1);
-	}
-
-	if (inum < 0) {
-		printf("Spurious interrupt!\n");
-		bcm2835_irc_dump(regs);
-		inum = 0;
-	}
-
-	return inum;
-}
-
-void bcm2835_irc_enable(bcm2835_irc_t *regs, unsigned inum)
-{
-	assert(inum < BCM2835_IRQ_COUNT);
-	regs->irq_enable[IRQ_TO_BANK(inum)] |= (1 << IRQ_TO_NUM(inum));
-}
-
-void bcm2835_irc_disable(bcm2835_irc_t *regs, unsigned inum)
-{
-	assert(inum < BCM2835_IRQ_COUNT);
-	regs->irq_disable[IRQ_TO_BANK(inum)] |= (1 << IRQ_TO_NUM(inum));
-}
-
-/**
- * @}
- */
Index: rnel/genarch/src/drivers/bcm2835/mbox.c
===================================================================
--- kernel/genarch/src/drivers/bcm2835/mbox.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief BCM2835 mailbox communication routines
- */
-
-#include <mm/km.h>
-#include <typedefs.h>
-#include <genarch/drivers/bcm2835/mbox.h>
-
-static void mbox_write(bcm2835_mbox_t *mbox, uint8_t chan, uint32_t value)
-{
-	while (mbox->status & MBOX_STATUS_FULL)
-		;
-	mbox->write = MBOX_COMPOSE(chan, value);
-}
-
-static uint32_t mbox_read(bcm2835_mbox_t *mbox, uint8_t chan)
-{
-	uint32_t msg;
-
-	do {
-		while (mbox->status & MBOX_STATUS_EMPTY)
-			;
-		msg = mbox->read;
-	} while (MBOX_MSG_CHAN(msg) != chan);
-
-	return MBOX_MSG_VALUE(msg);
-}
-
-bool bcm2835_prop_get_memory(uint32_t *base, uint32_t *size)
-{
-	bool ret;
-	MBOX_BUFF_ALLOC(req, mbox_getmem_buf_t);
-
-	req->buf_hdr.size = sizeof(mbox_getmem_buf_t);
-	req->buf_hdr.code = MBOX_PROP_CODE_REQ;
-	req->tag_hdr.tag_id = TAG_GET_ARM_MEMORY;
-	req->tag_hdr.buf_size = sizeof(mbox_tag_getmem_resp_t);
-	req->tag_hdr.val_len = 0;
-	req->zero = 0;
-
-	mbox_write((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
-	    MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)req));
-	mbox_read((bcm2835_mbox_t *)BCM2835_MBOX0_ADDR,
-	    MBOX_CHAN_PROP_A2V);
-
-	if (req->buf_hdr.code == MBOX_PROP_CODE_RESP_OK) {
-		*base = req->data.base;
-		*size = req->data.size;
-		ret = true;
-	} else {
-		ret = false;
-	}
-
-	return ret;
-}
-
-bool bcm2835_fb_init(fb_properties_t *prop, uint32_t width, uint32_t height)
-{
-	bcm2835_mbox_t *fb_mbox;
-	bool ret = false;
-	MBOX_BUFF_ALLOC(fb_desc, bcm2835_fb_desc_t);
-
-	fb_mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t),
-	    KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-
-	fb_desc->width = width;
-	fb_desc->height = height;
-	fb_desc->virt_width = fb_desc->width;
-	fb_desc->virt_height = fb_desc->height;
-	fb_desc->pitch = 0;			/* Set by VC */
-	fb_desc->bpp = 16;
-	fb_desc->x_offset = 0;
-	fb_desc->y_offset = 0;
-	fb_desc->addr = 0;			/* Set by VC */
-	fb_desc->size = 0;			/* Set by VC */
-
-	mbox_write(fb_mbox, MBOX_CHAN_FB, KA2VCA(fb_desc));
-
-	if (mbox_read(fb_mbox, MBOX_CHAN_FB)) {
-		printf("BCM2835 framebuffer initialization failed\n");
-		goto out;
-	}
-
-	prop->addr = fb_desc->addr;
-	prop->offset = 0;
-	prop->x = fb_desc->width;
-	prop->y = fb_desc->height;
-	prop->scan = fb_desc->pitch;
-	prop->visual = VISUAL_RGB_5_6_5_LE;
-
-	printf("BCM2835 framebuffer at 0x%08x (%dx%d)\n", prop->addr,
-	    prop->x, prop->y);
-	ret = true;
-out:
-	km_unmap((uintptr_t)fb_mbox, sizeof(bcm2835_mbox_t));
-	return ret;
-}
-
-bool bcm2835_mbox_get_fb_size(uint32_t *w, uint32_t *h)
-{
-	bool r;
-	MBOX_BUFF_ALLOC(msg, mbox_getfbsize_buf_t);
-	bcm2835_mbox_t *mbox;
-
-	mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t),
-	    KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
-	assert(mbox);
-
-	msg->buf_hdr.size = sizeof(mbox_getfbsize_buf_t);
-	msg->buf_hdr.code = MBOX_PROP_CODE_REQ;
-	msg->tag_hdr.tag_id = MBOX_TAG_GET_PHYS_W_H;
-	msg->tag_hdr.buf_size = sizeof(msg->body);
-	msg->tag_hdr.val_len  = 0;
-	msg->zero = 0;
-
-	mbox_write(mbox,
-	    MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)msg));
-	mbox_read(mbox, MBOX_CHAN_PROP_A2V);
-
-	r = msg->buf_hdr.code == MBOX_PROP_CODE_RESP_OK;
-	if (r) {
-		*h = msg->body.height;
-		*w = msg->body.width;
-	}
-
-	km_unmap((uintptr_t) mbox, sizeof(bcm2835_mbox_t));
-	return r;
-}
-
-/**
- * @}
- */
Index: rnel/genarch/src/drivers/bcm2835/timer.c
===================================================================
--- kernel/genarch/src/drivers/bcm2835/timer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2013 Beniamino Galvani
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Broadcom BCM2835 system timer driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/bcm2835/timer.h>
-#include <time/clock.h>
-
-void bcm2835_timer_start(bcm2835_timer_t *timer)
-{
-	assert(timer);
-	/* Clear pending interrupt on channel 1 */
-	timer->cs |= BCM2835_TIMER_CS_M1;
-	/* Initialize compare value for match channel 1 */
-	timer->c1 = timer->clo + (BCM2835_CLOCK_FREQ / HZ);
-}
-
-void bcm2835_timer_irq_ack(bcm2835_timer_t *timer)
-{
-	assert(timer);
-	/* Clear pending interrupt on channel 1 */
-	timer->cs |= BCM2835_TIMER_CS_M1;
-	/* Reprogram compare value for match channel 1 */
-	timer->c1 = timer->clo + (BCM2835_CLOCK_FREQ / HZ);
-}
-
-/**
- * @}
- */
Index: rnel/genarch/src/drivers/dsrln/dsrlnin.c
===================================================================
--- kernel/genarch/src/drivers/dsrln/dsrlnin.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Dummy serial line input.
- */
-
-#include <assert.h>
-#include <genarch/drivers/dsrln/dsrlnin.h>
-#include <console/chardev.h>
-#include <stdlib.h>
-#include <arch/asm.h>
-
-static irq_ownership_t dsrlnin_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void dsrlnin_irq_handler(irq_t *irq)
-{
-	dsrlnin_instance_t *instance = irq->instance;
-	dsrlnin_t *dev = instance->dsrlnin;
-
-	indev_push_character(instance->srlnin, pio_read_8(&dev->data));
-}
-
-dsrlnin_instance_t *dsrlnin_init(dsrlnin_t *dev, inr_t inr)
-{
-	dsrlnin_instance_t *instance =
-	    malloc(sizeof(dsrlnin_instance_t));
-	if (instance) {
-		instance->dsrlnin = dev;
-		instance->srlnin = NULL;
-
-		irq_initialize(&instance->irq);
-		instance->irq.inr = inr;
-		instance->irq.claim = dsrlnin_claim;
-		instance->irq.handler = dsrlnin_irq_handler;
-		instance->irq.instance = instance;
-	}
-
-	return instance;
-}
-
-void dsrlnin_wire(dsrlnin_instance_t *instance, indev_t *srlnin)
-{
-	assert(instance);
-	assert(srlnin);
-
-	instance->srlnin = srlnin;
-	irq_register(&instance->irq);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/dsrln/dsrlnout.c
===================================================================
--- kernel/genarch/src/drivers/dsrln/dsrlnout.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Dummy serial line output.
- */
-
-#include <genarch/drivers/dsrln/dsrlnout.h>
-#include <console/chardev.h>
-#include <arch/asm.h>
-#include <stdlib.h>
-#include <console/console.h>
-#include <sysinfo/sysinfo.h>
-#include <str.h>
-#include <ddi/ddi.h>
-
-typedef struct {
-	parea_t parea;
-	ioport8_t *base;
-} dsrlnout_instance_t;
-
-static void dsrlnout_write(outdev_t *dev, const char *s, size_t n)
-{
-	dsrlnout_instance_t *instance = (dsrlnout_instance_t *) dev->data;
-
-	if (instance->parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			pio_write_8(instance->base, '\r');
-
-		pio_write_8(instance->base, (uint8_t) *s);
-	}
-}
-
-static outdev_operations_t dsrlndev_ops = {
-	.write = dsrlnout_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-outdev_t *dsrlnout_init(ioport8_t *base, uintptr_t base_phys)
-{
-	outdev_t *dsrlndev = malloc(sizeof(outdev_t));
-	if (!dsrlndev)
-		return NULL;
-
-	dsrlnout_instance_t *instance = malloc(sizeof(dsrlnout_instance_t));
-	if (!instance) {
-		free(dsrlndev);
-		return NULL;
-	}
-
-	outdev_initialize("dsrlndev", dsrlndev, &dsrlndev_ops);
-	dsrlndev->data = instance;
-
-	instance->base = base;
-	ddi_parea_init(&instance->parea);
-	instance->parea.pbase = base_phys;
-	instance->parea.frames = 1;
-	instance->parea.unpriv = false;
-	instance->parea.mapped = false;
-	ddi_parea_register(&instance->parea);
-
-	if (!fb_exported) {
-		/*
-		 * This is the necessary evil until
-		 * the userspace driver is entirely
-		 * self-sufficient.
-		 */
-		sysinfo_set_item_val("fb", NULL, true);
-		sysinfo_set_item_val("fb.kind", NULL, 3);
-		sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(base));
-
-		fb_exported = true;
-	}
-
-	return dsrlndev;
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/ega/ega.c
===================================================================
--- kernel/genarch/src/drivers/ega/ega.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,679 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief EGA driver.
- */
-
-#include <debug.h>
-#include <genarch/drivers/ega/ega.h>
-#include <mm/km.h>
-#include <mm/as.h>
-#include <stdlib.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <memw.h>
-#include <str.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <sysinfo/sysinfo.h>
-#include <ddi/ddi.h>
-
-/*
- * The EGA driver.
- * Simple and short. Function for displaying characters and "scrolling".
- */
-
-#define SPACE  0x20
-#define STYLE  0x1e
-#define INVAL  0x17
-
-#define EMPTY_CHAR  ((STYLE << 8) | SPACE)
-
-typedef struct {
-	IRQ_SPINLOCK_DECLARE(lock);
-
-	parea_t parea;
-
-	uint32_t cursor;
-	uint8_t *addr;
-	uint8_t *backbuf;
-	ioport8_t *base;
-	mbstate_t mbstate;
-} ega_instance_t;
-
-static void ega_write(outdev_t *, const char *, size_t);
-static void ega_redraw(outdev_t *);
-
-static outdev_operations_t egadev_ops = {
-	.write = ega_write,
-	.redraw = ega_redraw,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-static uint16_t ega_oem_glyph(const char32_t ch)
-{
-	if (ch <= 0x007f)
-		return ch;
-
-	if (ch == 0x00a0)
-		return 255;
-
-	if (ch == 0x00a1)
-		return 173;
-
-	if ((ch >= 0x00a2) && (ch <= 0x00a3))
-		return (ch - 7);
-
-	if (ch == 0x00a5)
-		return 157;
-
-	if (ch == 0x00aa)
-		return 166;
-
-	if (ch == 0x00ab)
-		return 174;
-
-	if (ch == 0x00ac)
-		return 170;
-
-	if (ch == 0x00b0)
-		return 248;
-
-	if (ch == 0x00b1)
-		return 241;
-
-	if (ch == 0x00b2)
-		return 253;
-
-	if (ch == 0x00b5)
-		return 230;
-
-	if (ch == 0x00b7)
-		return 250;
-
-	if (ch == 0x00ba)
-		return 167;
-
-	if (ch == 0x00bb)
-		return 175;
-
-	if (ch == 0x00bc)
-		return 172;
-
-	if (ch == 0x00bd)
-		return 171;
-
-	if (ch == 0x00bf)
-		return 168;
-
-	if ((ch >= 0x00c4) && (ch <= 0x00c5))
-		return (ch - 54);
-
-	if (ch == 0x00c6)
-		return 146;
-
-	if (ch == 0x00c7)
-		return 128;
-
-	if (ch == 0x00c9)
-		return 144;
-
-	if (ch == 0x00d1)
-		return 165;
-
-	if (ch == 0x00d6)
-		return 153;
-
-	if (ch == 0x00dc)
-		return 154;
-
-	if (ch == 0x00df)
-		return 225;
-
-	if (ch == 0x00e0)
-		return 133;
-
-	if (ch == 0x00e1)
-		return 160;
-
-	if (ch == 0x00e2)
-		return 131;
-
-	if (ch == 0x00e4)
-		return 132;
-
-	if (ch == 0x00e5)
-		return 134;
-
-	if (ch == 0x00e6)
-		return 145;
-
-	if (ch == 0x00e7)
-		return 135;
-
-	if (ch == 0x00e8)
-		return 138;
-
-	if (ch == 0x00e9)
-		return 130;
-
-	if ((ch >= 0x00ea) && (ch <= 0x00eb))
-		return (ch - 98);
-
-	if (ch == 0x00ec)
-		return 141;
-
-	if (ch == 0x00ed)
-		return 161;
-
-	if (ch == 0x00ee)
-		return 140;
-
-	if (ch == 0x00ef)
-		return 139;
-
-	if (ch == 0x00f1)
-		return 164;
-
-	if (ch == 0x00f2)
-		return 149;
-
-	if (ch == 0x00f3)
-		return 162;
-
-	if (ch == 0x00f4)
-		return 147;
-
-	if (ch == 0x00f6)
-		return 148;
-
-	if (ch == 0x00f7)
-		return 246;
-
-	if (ch == 0x00f9)
-		return 151;
-
-	if (ch == 0x00fa)
-		return 163;
-
-	if (ch == 0x00fb)
-		return 150;
-
-	if (ch == 0x00fc)
-		return 129;
-
-	if (ch == 0x00ff)
-		return 152;
-
-	if (ch == 0x0192)
-		return 159;
-
-	if (ch == 0x0393)
-		return 226;
-
-	if (ch == 0x0398)
-		return 233;
-
-	if (ch == 0x03a3)
-		return 228;
-
-	if (ch == 0x03a6)
-		return 232;
-
-	if (ch == 0x03a9)
-		return 234;
-
-	if (ch == 0x03b1)
-		return 224;
-
-	if (ch == 0x03b4)
-		return 235;
-
-	if (ch == 0x03b5)
-		return 238;
-
-	if (ch == 0x03c0)
-		return 227;
-
-	if (ch == 0x03c3)
-		return 229;
-
-	if (ch == 0x03c4)
-		return 231;
-
-	if (ch == 0x03c6)
-		return 237;
-
-	if (ch == 0x207f)
-		return 252;
-
-	if (ch == 0x20a7)
-		return 158;
-
-	if (ch == 0x2219)
-		return 249;
-
-	if (ch == 0x221a)
-		return 251;
-
-	if (ch == 0x221e)
-		return 236;
-
-	if (ch == 0x2229)
-		return 239;
-
-	if (ch == 0x2248)
-		return 247;
-
-	if (ch == 0x2261)
-		return 240;
-
-	if (ch == 0x2264)
-		return 243;
-
-	if (ch == 0x2265)
-		return 242;
-
-	if (ch == 0x2310)
-		return 169;
-
-	if ((ch >= 0x2320) && (ch <= 0x2321))
-		return (ch - 8748);
-
-	if (ch == 0x2500)
-		return 196;
-
-	if (ch == 0x2502)
-		return 179;
-
-	if (ch == 0x250c)
-		return 218;
-
-	if (ch == 0x2510)
-		return 191;
-
-	if (ch == 0x2514)
-		return 192;
-
-	if (ch == 0x2518)
-		return 217;
-
-	if (ch == 0x251c)
-		return 195;
-
-	if (ch == 0x2524)
-		return 180;
-
-	if (ch == 0x252c)
-		return 194;
-
-	if (ch == 0x2534)
-		return 193;
-
-	if (ch == 0x253c)
-		return 197;
-
-	if (ch == 0x2550)
-		return 205;
-
-	if (ch == 0x2551)
-		return 186;
-
-	if ((ch >= 0x2552) && (ch <= 0x2553))
-		return (ch - 9341);
-
-	if (ch == 0x2554)
-		return 201;
-
-	if (ch == 0x2555)
-		return 184;
-
-	if (ch == 0x2556)
-		return 183;
-
-	if (ch == 0x2557)
-		return 187;
-
-	if (ch == 0x2558)
-		return 212;
-
-	if (ch == 0x2559)
-		return 211;
-
-	if (ch == 0x255a)
-		return 200;
-
-	if (ch == 0x255b)
-		return 190;
-
-	if (ch == 0x255c)
-		return 189;
-
-	if (ch == 0x255d)
-		return 188;
-
-	if ((ch >= 0x255e) && (ch <= 0x255f))
-		return (ch - 9368);
-
-	if (ch == 0x2560)
-		return 204;
-
-	if ((ch >= 0x2561) && (ch <= 0x2562))
-		return (ch - 9388);
-
-	if (ch == 0x2563)
-		return 185;
-
-	if ((ch >= 0x2564) && (ch <= 0x2565))
-		return (ch - 9363);
-
-	if (ch == 0x2566)
-		return 203;
-
-	if ((ch >= 0x2567) && (ch <= 0x2568))
-		return (ch - 9368);
-
-	if (ch == 0x2569)
-		return 202;
-
-	if (ch == 0x256a)
-		return 216;
-
-	if (ch == 0x256b)
-		return 215;
-
-	if (ch == 0x256c)
-		return 206;
-
-	if (ch == 0x2580)
-		return 223;
-
-	if (ch == 0x2584)
-		return 220;
-
-	if (ch == 0x2588)
-		return 219;
-
-	if (ch == 0x258c)
-		return 221;
-
-	if (ch == 0x2590)
-		return 222;
-
-	if ((ch >= 0x2591) && (ch <= 0x2593))
-		return (ch - 9441);
-
-	return 256;
-}
-
-/*
- * This function takes care of scrolling.
- */
-static void ega_check_cursor(ega_instance_t *instance)
-{
-	if (instance->cursor < EGA_SCREEN)
-		return;
-
-	memmove((void *) instance->backbuf,
-	    (void *) (instance->backbuf + EGA_COLS * 2),
-	    (EGA_SCREEN - EGA_COLS) * 2);
-	memsetw(instance->backbuf + (EGA_SCREEN - EGA_COLS) * 2,
-	    EGA_COLS, EMPTY_CHAR);
-
-	if ((!instance->parea.mapped) || (console_override)) {
-		memmove((void *) instance->addr,
-		    (void *) (instance->addr + EGA_COLS * 2),
-		    (EGA_SCREEN - EGA_COLS) * 2);
-		memsetw(instance->addr + (EGA_SCREEN - EGA_COLS) * 2,
-		    EGA_COLS, EMPTY_CHAR);
-	}
-
-	instance->cursor = instance->cursor - EGA_COLS;
-}
-
-static void ega_show_cursor(ega_instance_t *instance)
-{
-	if ((!instance->parea.mapped) || (console_override)) {
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0a);
-		uint8_t stat = pio_read_8(instance->base + EGA_DATA_REG);
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0a);
-		pio_write_8(instance->base + EGA_DATA_REG, stat & (~(1 << 5)));
-	}
-}
-
-static void ega_move_cursor(ega_instance_t *instance)
-{
-	if ((!instance->parea.mapped) || (console_override)) {
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0e);
-		pio_write_8(instance->base + EGA_DATA_REG,
-		    (uint8_t) ((instance->cursor >> 8) & 0xff));
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0f);
-		pio_write_8(instance->base + EGA_DATA_REG,
-		    (uint8_t) (instance->cursor & 0xff));
-	}
-}
-
-static void ega_sync_cursor(ega_instance_t *instance)
-{
-	if ((!instance->parea.mapped) || (console_override)) {
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0e);
-		uint8_t hi = pio_read_8(instance->base + EGA_DATA_REG);
-		pio_write_8(instance->base + EGA_INDEX_REG, 0x0f);
-		uint8_t lo = pio_read_8(instance->base + EGA_DATA_REG);
-
-		instance->cursor = (hi << 8) | lo;
-	} else
-		instance->cursor = 0;
-
-	if (instance->cursor >= EGA_SCREEN)
-		instance->cursor = 0;
-
-	if ((instance->cursor % EGA_COLS) != 0)
-		instance->cursor =
-		    (instance->cursor + EGA_COLS) - instance->cursor % EGA_COLS;
-
-	memsetw(instance->backbuf + instance->cursor * 2,
-	    EGA_SCREEN - instance->cursor, EMPTY_CHAR);
-
-	if ((!instance->parea.mapped) || (console_override))
-		memsetw(instance->addr + instance->cursor * 2,
-		    EGA_SCREEN - instance->cursor, EMPTY_CHAR);
-
-	ega_check_cursor(instance);
-	ega_move_cursor(instance);
-	ega_show_cursor(instance);
-}
-
-static void ega_display_wchar(ega_instance_t *instance, char32_t ch)
-{
-	uint16_t index = ega_oem_glyph(ch);
-	uint8_t glyph;
-	uint8_t style;
-
-	if ((index >> 8)) {
-		glyph = U_SPECIAL;
-		style = INVAL;
-	} else {
-		glyph = index & 0xff;
-		style = STYLE;
-	}
-
-	instance->backbuf[instance->cursor * 2] = glyph;
-	instance->backbuf[instance->cursor * 2 + 1] = style;
-
-	if ((!instance->parea.mapped) || (console_override)) {
-		instance->addr[instance->cursor * 2] = glyph;
-		instance->addr[instance->cursor * 2 + 1] = style;
-	}
-}
-
-static void _putuchar(ega_instance_t *instance, char32_t ch)
-{
-	switch (ch) {
-	case '\n':
-		instance->cursor = (instance->cursor + EGA_COLS) -
-		    instance->cursor % EGA_COLS;
-		break;
-	case '\t':
-		instance->cursor = (instance->cursor + 8) -
-		    instance->cursor % 8;
-		break;
-	case '\b':
-		if (instance->cursor % EGA_COLS)
-			instance->cursor--;
-		break;
-	default:
-		ega_display_wchar(instance, ch);
-		instance->cursor++;
-		break;
-	}
-	ega_check_cursor(instance);
-	ega_move_cursor(instance);
-}
-
-static void ega_write(outdev_t *dev, const char *s, size_t n)
-{
-	ega_instance_t *instance = (ega_instance_t *) dev->data;
-
-	irq_spinlock_lock(&instance->lock, true);
-
-	size_t offset = 0;
-	char32_t ch;
-
-	while ((ch = str_decode_r(s, &offset, n, U_SPECIAL, &instance->mbstate)))
-		_putuchar(instance, ch);
-
-	irq_spinlock_unlock(&instance->lock, true);
-}
-
-static void ega_redraw_internal(ega_instance_t *instance)
-{
-	memcpy(instance->addr, instance->backbuf, EGA_VRAM_SIZE);
-	ega_move_cursor(instance);
-	ega_show_cursor(instance);
-}
-
-static void ega_redraw(outdev_t *dev)
-{
-	ega_instance_t *instance = (ega_instance_t *) dev->data;
-
-	irq_spinlock_lock(&instance->lock, true);
-	ega_redraw_internal(instance);
-	irq_spinlock_unlock(&instance->lock, true);
-}
-
-/** EGA was mapped or unmapped.
- *
- * @param arg EGA instance
- */
-static void ega_mapped_changed(void *arg)
-{
-	ega_instance_t *instance = (ega_instance_t *) arg;
-
-	if (!instance->parea.mapped) {
-		irq_spinlock_lock(&instance->lock, true);
-		ega_redraw_internal(instance);
-		irq_spinlock_unlock(&instance->lock, true);
-	}
-}
-
-outdev_t *ega_init(ioport8_t *base, uintptr_t addr)
-{
-	outdev_t *egadev = malloc(sizeof(outdev_t));
-	if (!egadev)
-		return NULL;
-
-	ega_instance_t *instance = malloc(sizeof(ega_instance_t));
-	if (!instance) {
-		free(egadev);
-		return NULL;
-	}
-
-	outdev_initialize("egadev", egadev, &egadev_ops);
-	egadev->data = instance;
-
-	irq_spinlock_initialize(&instance->lock, "*ega.instance.lock");
-
-	instance->base = base;
-	instance->addr = (uint8_t *) km_map(addr, EGA_VRAM_SIZE,
-	    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	if (!instance->addr) {
-		LOG("Unable to EGA video memory.");
-		free(instance);
-		free(egadev);
-		return NULL;
-	}
-
-	instance->backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE);
-	if (!instance->backbuf) {
-		LOG("Unable to allocate backbuffer.");
-		free(instance);
-		free(egadev);
-		return NULL;
-	}
-
-	ddi_parea_init(&instance->parea);
-	instance->parea.pbase = addr;
-	instance->parea.frames = SIZE2FRAMES(EGA_VRAM_SIZE);
-	instance->parea.unpriv = false;
-	instance->parea.mapped = false;
-	instance->parea.mapped_changed = ega_mapped_changed;
-	instance->parea.arg = (void *) instance;
-	ddi_parea_register(&instance->parea);
-
-	/* Synchronize the back buffer and cursor position. */
-	memcpy(instance->backbuf, instance->addr, EGA_VRAM_SIZE);
-	ega_sync_cursor(instance);
-
-	if (!fb_exported) {
-		/*
-		 * We export the kernel framebuffer for uspace usage.
-		 * This is used in the case the uspace framebuffer
-		 * driver is not self-sufficient.
-		 */
-		sysinfo_set_item_val("fb", NULL, true);
-		sysinfo_set_item_val("fb.kind", NULL, 2);
-		sysinfo_set_item_val("fb.width", NULL, EGA_COLS);
-		sysinfo_set_item_val("fb.height", NULL, EGA_ROWS);
-		sysinfo_set_item_val("fb.blinking", NULL, true);
-		sysinfo_set_item_val("fb.address.physical", NULL, addr);
-
-		fb_exported = true;
-	}
-
-	return egadev;
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/gicv2/gicv2.c
===================================================================
--- kernel/genarch/src/drivers/gicv2/gicv2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup genarch
- * @{
- */
-/** @file
- * @brief ARM Generic Interrupt Controller, Architecture version 2.0.
- *
- * This IRQ controller is present on the QEMU virt platform for ARM.
- */
-
-#include <arch/asm.h>
-#include <genarch/drivers/gicv2/gicv2.h>
-#include <assert.h>
-
-/** Initialize GICv2 interrupt controller.
- *
- * @param irqc Instance structure.
- * @param distr Distributor registers.
- * @param cpui CPU interface registers.
- */
-void gicv2_init(gicv2_t *irqc, gicv2_distr_regs_t *distr,
-    gicv2_cpui_regs_t *cpui)
-{
-	irqc->distr = distr;
-	irqc->cpui = cpui;
-
-	/* Get maximum number of interrupts. */
-	uint32_t typer = pio_read_32(&distr->typer);
-	irqc->inum_total = (((typer & GICV2D_TYPER_IT_LINES_NUMBER_MASK) >>
-	    GICV2D_TYPER_IT_LINES_NUMBER_SHIFT) + 1) * 32;
-
-	/* Disable all interrupts. */
-	for (unsigned i = 0; i < irqc->inum_total / 32; i++)
-		pio_write_32(&distr->icenabler[i], 0xffffffff);
-
-	/* Enable interrupts for all priority levels. */
-	pio_write_32(&cpui->pmr, 0xff);
-
-	/* Enable signaling of interrupts. */
-	pio_write_32(&cpui->ctlr, GICV2C_CTLR_ENABLE_FLAG);
-	pio_write_32(&distr->ctlr, GICV2D_CTLR_ENABLE_FLAG);
-}
-
-/** Obtain total number of interrupts that the controller supports. */
-unsigned gicv2_inum_get_total(gicv2_t *irqc)
-{
-	return irqc->inum_total;
-}
-
-/** Obtain number of pending interrupt. */
-void gicv2_inum_get(gicv2_t *irqc, unsigned *inum, unsigned *cpuid)
-{
-	uint32_t iar = pio_read_32(&irqc->cpui->iar);
-
-	*inum = (iar & GICV2C_IAR_INTERRUPT_ID_MASK) >>
-	    GICV2C_IAR_INTERRUPT_ID_SHIFT;
-	*cpuid = (iar & GICV2C_IAR_CPUID_MASK) >> GICV2C_IAR_CPUID_SHIFT;
-}
-
-/** Signal end of interrupt to the controller. */
-void gicv2_end(gicv2_t *irqc, unsigned inum, unsigned cpuid)
-{
-	assert((inum & ~((unsigned) GICV2C_IAR_INTERRUPT_ID_MASK >>
-	    GICV2C_IAR_INTERRUPT_ID_SHIFT)) == 0);
-	assert((cpuid & ~((unsigned) GICV2C_IAR_CPUID_MASK >>
-	    GICV2C_IAR_CPUID_SHIFT)) == 0);
-
-	uint32_t eoir = (inum << GICV2C_IAR_INTERRUPT_ID_SHIFT) |
-	    (cpuid << GICV2C_IAR_CPUID_SHIFT);
-	pio_write_32(&irqc->cpui->eoir, eoir);
-}
-
-/** Enable specific interrupt. */
-void gicv2_enable(gicv2_t *irqc, unsigned inum)
-{
-	assert(inum < irqc->inum_total);
-
-	pio_write_32(&irqc->distr->isenabler[inum / 32], 1 << (inum % 32));
-}
-
-/** Disable specific interrupt. */
-void gicv2_disable(gicv2_t *irqc, unsigned inum)
-{
-	assert(inum < irqc->inum_total);
-
-	pio_write_32(&irqc->distr->icenabler[inum / 32], 1 << (inum % 32));
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/i8042/i8042.c
===================================================================
--- kernel/genarch/src/drivers/i8042/i8042.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief i8042 processor driver
- *
- * It takes care of the i8042 serial communication.
- *
- */
-
-#include <assert.h>
-#include <genarch/drivers/i8042/i8042.h>
-#include <genarch/drivers/legacy/ia32/io.h>
-#include <arch/asm.h>
-#include <console/chardev.h>
-#include <stdlib.h>
-#include <time/delay.h>
-
-#define i8042_SET_COMMAND  0x60
-#define i8042_COMMAND      0x69
-#define i8042_CPU_RESET    0xfe
-
-#define i8042_BUFFER_FULL_MASK  0x01
-#define i8042_WAIT_MASK         0x02
-
-#define i8042_TIMEOUT  65536
-
-static irq_ownership_t i8042_claim(irq_t *irq)
-{
-	i8042_instance_t *i8042_instance = irq->instance;
-	i8042_t *dev = i8042_instance->i8042;
-
-	if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK)
-		return IRQ_ACCEPT;
-	else
-		return IRQ_DECLINE;
-}
-
-static void i8042_irq_handler(irq_t *irq)
-{
-	i8042_instance_t *instance = irq->instance;
-	i8042_t *dev = instance->i8042;
-
-	if (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) {
-		uint8_t data = pio_read_8(&dev->data);
-		indev_push_character(instance->kbrdin, data);
-	}
-}
-
-/** Clear input buffer. */
-static void i8042_clear_buffer(i8042_t *dev)
-{
-	for (uint32_t i = 0; i < i8042_TIMEOUT; i++) {
-		if ((pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK) == 0)
-			break;
-
-		(void) pio_read_8(&dev->data);
-		delay(50);  /* 50 us think time */
-	}
-}
-
-static void i8042_send_command(i8042_t *dev, uint8_t cmd)
-{
-	for (uint32_t i = 0; i < i8042_TIMEOUT; i++) {
-		if ((pio_read_8(&dev->status) & i8042_WAIT_MASK) == 0)
-			break;
-
-		delay(50);  /* 50 us think time */
-	}
-
-	pio_write_8(&dev->status, cmd);
-	delay(10000);  /* 10 ms think time */
-}
-
-/** Initialize i8042. */
-i8042_instance_t *i8042_init(i8042_t *dev, inr_t inr)
-{
-	i8042_instance_t *instance =
-	    malloc(sizeof(i8042_instance_t));
-	if (instance) {
-		instance->i8042 = dev;
-		instance->kbrdin = NULL;
-
-		irq_initialize(&instance->irq);
-		instance->irq.inr = inr;
-		instance->irq.claim = i8042_claim;
-		instance->irq.handler = i8042_irq_handler;
-		instance->irq.instance = instance;
-	}
-
-	return instance;
-}
-
-void i8042_wire(i8042_instance_t *instance, indev_t *kbrdin)
-{
-	assert(instance);
-	assert(kbrdin);
-
-	i8042_clear_buffer(instance->i8042);
-
-	instance->kbrdin = kbrdin;
-	irq_register(&instance->irq);
-}
-
-/* Reset CPU by pulsing pin 0 */
-void i8042_cpu_reset(i8042_t *dev)
-{
-	interrupts_disable();
-	i8042_clear_buffer(dev);
-	i8042_send_command(dev, i8042_CPU_RESET);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/i8259/i8259.c
===================================================================
--- kernel/genarch/src/drivers/i8259/i8259.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief i8259 driver.
- *
- * Programmable Interrupt Controller for UP systems based on i8259 chip.
- */
-
-#include <genarch/drivers/i8259/i8259.h>
-#include <typedefs.h>
-#include <stdint.h>
-#include <log.h>
-#include <interrupt.h>
-
-/* ICW1 bits */
-#define I8259_ICW1           (1 << 4)
-#define I8259_ICW1_NEEDICW4  (1 << 0)
-
-/* OCW3 bits */
-#define I8259_OCW3           (1 << 3)
-#define I8259_OCW3_READ_ISR  (3 << 0)
-
-/* OCW4 bits */
-#define I8259_OCW4           (0 << 3)
-#define I8259_OCW4_NSEOI     (1 << 5)
-
-#define I8259_IRQ_COUNT 8
-
-#define I8259_IRQ_SLAVE 2
-
-static const char *i8259_get_name(void);
-
-pic_ops_t i8259_pic_ops = {
-	.get_name = i8259_get_name,
-	.enable_irqs = i8259_enable_irqs,
-	.disable_irqs = i8259_disable_irqs,
-	.eoi = i8259_eoi,
-	.is_spurious = i8259_is_spurious,
-	.handle_spurious = i8259_handle_spurious
-};
-
-// XXX: need to change pic_* API to get rid of these
-static i8259_t *saved_pic0;
-static i8259_t *saved_pic1;
-
-void i8259_init(i8259_t *pic0, i8259_t *pic1, unsigned int irq0_vec)
-{
-	saved_pic0 = pic0;
-	saved_pic1 = pic1;
-
-	/* ICW1: this is ICW1, ICW4 to follow */
-	pio_write_8(&pic0->port1, I8259_ICW1 | I8259_ICW1_NEEDICW4);
-
-	/* ICW2: IRQ 0 maps to interrupt vector address irq0_vec */
-	pio_write_8(&pic0->port2, irq0_vec);
-
-	/* ICW3: pic1 using IRQ I8259_IRQ_SLAVE */
-	pio_write_8(&pic0->port2, 1 << I8259_IRQ_SLAVE);
-
-	/* ICW4: i8086 mode */
-	pio_write_8(&pic0->port2, 1);
-
-	/* ICW1: ICW1, ICW4 to follow */
-	pio_write_8(&pic1->port1, I8259_ICW1 | I8259_ICW1_NEEDICW4);
-
-	/* ICW2: IRQ 8 maps to interrupt vector address irq0_vec + 8 */
-	pio_write_8(&pic1->port2, irq0_vec + I8259_IRQ_COUNT);
-
-	/* ICW3: pic1 is known as I8259_IRQ_SLAVE */
-	pio_write_8(&pic1->port2, I8259_IRQ_SLAVE);
-
-	/* ICW4: i8086 mode */
-	pio_write_8(&pic1->port2, 1);
-
-	/* disable all irq's */
-	i8259_disable_irqs(0xffff);
-	/* but enable I8259_IRQ_SLAVE */
-	i8259_enable_irqs(1 << I8259_IRQ_SLAVE);
-}
-
-const char *i8259_get_name(void)
-{
-	return "i8259";
-}
-
-void i8259_enable_irqs(uint16_t irqmask)
-{
-	uint8_t x;
-
-	if (irqmask & 0xff) {
-		x = pio_read_8(&saved_pic0->port2);
-		pio_write_8(&saved_pic0->port2,
-		    (uint8_t) (x & (~(irqmask & 0xff))));
-	}
-	if (irqmask >> I8259_IRQ_COUNT) {
-		x = pio_read_8(&saved_pic1->port2);
-		pio_write_8(&saved_pic1->port2,
-		    (uint8_t) (x & (~(irqmask >> I8259_IRQ_COUNT))));
-	}
-}
-
-void i8259_disable_irqs(uint16_t irqmask)
-{
-	uint8_t x;
-
-	if (irqmask & 0xff) {
-		x = pio_read_8(&saved_pic0->port2);
-		pio_write_8(&saved_pic0->port2,
-		    (uint8_t) (x | (irqmask & 0xff)));
-	}
-	if (irqmask >> I8259_IRQ_COUNT) {
-		x = pio_read_8(&saved_pic1->port2);
-		pio_write_8(&saved_pic1->port2,
-		    (uint8_t) (x | (irqmask >> I8259_IRQ_COUNT)));
-	}
-}
-
-void i8259_eoi(unsigned int irq)
-{
-	if (irq >= I8259_IRQ_COUNT)
-		pio_write_8(&saved_pic1->port1, I8259_OCW4 | I8259_OCW4_NSEOI);
-	pio_write_8(&saved_pic0->port1, I8259_OCW4 | I8259_OCW4_NSEOI);
-}
-
-bool i8259_is_spurious(unsigned int irq)
-{
-	pio_write_8(&saved_pic0->port1, I8259_OCW3 | I8259_OCW3_READ_ISR);
-	pio_write_8(&saved_pic1->port1, I8259_OCW3 | I8259_OCW3_READ_ISR);
-	uint8_t isr_lo = pio_read_8(&saved_pic0->port1);
-	uint8_t isr_hi = pio_read_8(&saved_pic1->port1);
-	return !(((isr_hi << I8259_IRQ_COUNT) | isr_lo) & (1 << irq));
-}
-
-void i8259_handle_spurious(unsigned int irq)
-{
-	/* For spurious IRQs from pic1, we need to isssue an EOI to pic0 */
-	if (irq >= I8259_IRQ_COUNT)
-		pio_write_8(&saved_pic0->port1, I8259_OCW4 | I8259_OCW4_NSEOI);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/ns16550/ns16550.c
===================================================================
--- kernel/genarch/src/drivers/ns16550/ns16550.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,241 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief NS 16550 serial controller driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/ns16550/ns16550.h>
-#include <ddi/irq.h>
-#include <ddi/ddi.h>
-#include <arch/asm.h>
-#include <console/chardev.h>
-#include <stdlib.h>
-#include <align.h>
-#include <str.h>
-
-#define LSR_DATA_READY  0x01
-#define LSR_TH_READY    0x20
-
-#define RETRY_CNT	100000
-
-#define NOTHING \
-	do { \
-	} while(0)
-
-#define WHILE_CNT_AND_COND_DO(cnt, expr, statement) \
-	do { \
-		for (volatile unsigned i = 0; i < (cnt); i++) \
-			if ((expr)) \
-				statement; \
-			else \
-				break; \
-	} while (0)
-
-static uint8_t ns16550_reg_read(ns16550_instance_t *inst, ns16550_reg_t reg)
-{
-	return pio_read_8(&inst->ns16550[reg << inst->reg_shift]);
-}
-
-static void ns16550_reg_write(ns16550_instance_t *inst, ns16550_reg_t reg,
-    uint8_t val)
-{
-	pio_write_8(&inst->ns16550[reg << inst->reg_shift], val);
-}
-
-static irq_ownership_t ns16550_claim(irq_t *irq)
-{
-	ns16550_instance_t *instance = irq->instance;
-
-	if (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY)
-		return IRQ_ACCEPT;
-	else
-		return IRQ_DECLINE;
-}
-
-static void ns16550_irq_handler(irq_t *irq)
-{
-	ns16550_instance_t *instance = irq->instance;
-
-	while (ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY) {
-		uint8_t data = ns16550_reg_read(instance, NS16550_REG_RBR);
-		indev_push_character(instance->input, data);
-	}
-}
-
-/** Clear input buffer. */
-static void ns16550_clear_buffer(ns16550_instance_t *instance)
-{
-	WHILE_CNT_AND_COND_DO(RETRY_CNT,
-	    ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_DATA_READY,
-	    (void) ns16550_reg_read(instance, NS16550_REG_RBR));
-}
-
-static void ns16550_sendb(ns16550_instance_t *instance, uint8_t byte)
-{
-	WHILE_CNT_AND_COND_DO(RETRY_CNT,
-	    !(ns16550_reg_read(instance, NS16550_REG_LSR) & LSR_TH_READY),
-	    NOTHING);
-
-	ns16550_reg_write(instance, NS16550_REG_THR, byte);
-}
-
-static void ns16550_write(outdev_t *dev, const char *s, size_t n)
-{
-	ns16550_instance_t *instance = (ns16550_instance_t *) dev->data;
-
-	if (instance->parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			ns16550_sendb(instance, '\r');
-
-		ns16550_sendb(instance, (uint8_t) *s);
-	}
-}
-
-static outdev_operations_t ns16550_ops = {
-	.write = ns16550_write,
-	.redraw = NULL
-};
-
-/** Configure ns16550 transmission format.
- *
- * @param instance   NS 16550 driver instance.
- * @param baud_rate  Transmission speed in bits per second, also known as baud,
- *                   maximum value is 115200.
- * @param lcr_format Line Control Register configuration bits, as defined by
- *                   the @c LCR_ macros.  These configure the word width,
- *                   parity type, and stop bit count.
- */
-void ns16550_format_set(ns16550_instance_t *instance,
-    unsigned baud_rate, uint8_t lcr_format)
-{
-	uint16_t divisor;
-
-	divisor = (uint16_t)(NS156440_CLOCK / baud_rate);
-	if (divisor == 0)
-		divisor = 1;  /* Avoid division by zero. */
-
-	ns16550_reg_write(instance, NS16550_REG_LCR, LCR_DLAB);
-	ns16550_reg_write(instance, NS16550_REG_DLL, divisor & 0xFF);
-	ns16550_reg_write(instance, NS16550_REG_DLH, (divisor >> 8) & 0xFF);
-	ns16550_reg_write(instance, NS16550_REG_LCR, lcr_format & ~LCR_DLAB);
-}
-
-/** Initialize ns16550.
- *
- * @param dev        Address of the beginning of the device in I/O space.
- * @param reg_shift  Spacing between individual register addresses, in log2.
- *                   The individual register location is calculated as
- *                   `base + (register offset << reg_shift)`.
- * @param inr        Interrupt number.
- * @param cir        Clear interrupt function.
- * @param cir_arg    First argument to cir.
- * @param output     Where to store pointer to the output device
- *                   or NULL if the caller is not interested in
- *                   writing to the serial port.
- *
- * @return Keyboard instance or NULL on failure.
- *
- */
-ns16550_instance_t *ns16550_init(ioport8_t *dev_phys, unsigned reg_shift,
-    inr_t inr, cir_t cir, void *cir_arg, outdev_t **output)
-{
-	size_t size = 6 * (1U << reg_shift);
-	ioport8_t *dev = pio_map((void *) dev_phys, size);
-
-	ns16550_instance_t *instance = malloc(sizeof(ns16550_instance_t));
-	if (instance) {
-		instance->ns16550 = dev;
-		instance->reg_shift = reg_shift;
-		instance->input = NULL;
-		instance->output = NULL;
-
-		if (output) {
-			instance->output = malloc(sizeof(outdev_t));
-			if (!instance->output) {
-				free(instance);
-				pio_unmap((void *) dev_phys, (void *) dev,
-				    size);
-				return NULL;
-			}
-
-			outdev_initialize("ns16550", instance->output,
-			    &ns16550_ops);
-			instance->output->data = instance;
-			*output = instance->output;
-		}
-
-		irq_initialize(&instance->irq);
-		instance->irq.inr = inr;
-		instance->irq.claim = ns16550_claim;
-		instance->irq.handler = ns16550_irq_handler;
-		instance->irq.instance = instance;
-		instance->irq.cir = cir;
-		instance->irq.cir_arg = cir_arg;
-
-		ddi_parea_init(&instance->parea);
-		instance->parea.pbase = ALIGN_DOWN((uintptr_t) dev_phys,
-		    PAGE_SIZE);
-		instance->parea.frames = ALIGN_UP(size, PAGE_SIZE);
-		instance->parea.unpriv = false;
-		instance->parea.mapped = false;
-		ddi_parea_register(&instance->parea);
-	}
-
-	return instance;
-}
-
-void ns16550_wire(ns16550_instance_t *instance, indev_t *input)
-{
-	assert(instance);
-	assert(input);
-
-	instance->input = input;
-	irq_register(&instance->irq);
-
-	ns16550_clear_buffer(instance);
-
-	/* Enable interrupts */
-	ns16550_reg_write(instance, NS16550_REG_IER, IER_ERBFI);
-	ns16550_reg_write(instance, NS16550_REG_MCR, MCR_OUT2);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/omap/uart.c
===================================================================
--- kernel/genarch/src/drivers/omap/uart.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2013 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments OMAP on-chip uart serial line driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/omap/uart.h>
-#include <str.h>
-#include <mm/km.h>
-
-static void omap_uart_txb(omap_uart_t *uart, uint8_t b)
-{
-	/* Wait for buffer */
-	while (uart->regs->ssr & OMAP_UART_SSR_TX_FIFO_FULL_FLAG)
-		;
-	/* Write to the outgoing fifo */
-	uart->regs->thr = b;
-}
-
-static void omap_uart_write(outdev_t *dev, const char *s, size_t n)
-{
-	omap_uart_t *uart = dev->data;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			omap_uart_txb(uart, '\r');
-
-		omap_uart_txb(uart, (uint8_t) *s);
-	}
-}
-
-static outdev_operations_t omap_uart_ops = {
-	.write = omap_uart_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-static irq_ownership_t omap_uart_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void omap_uart_handler(irq_t *irq)
-{
-	omap_uart_t *uart = irq->instance;
-	while ((uart->regs->rx_fifo_lvl)) {
-		const uint8_t val = uart->regs->rhr;
-		if (uart->indev && val) {
-			indev_push_character(uart->indev, val);
-		}
-	}
-}
-
-bool omap_uart_init(
-    omap_uart_t *uart, inr_t interrupt, uintptr_t addr, size_t size)
-{
-	assert(uart);
-	uart->regs = (void *)km_map(addr, size, KM_NATURAL_ALIGNMENT,
-	    PAGE_NOT_CACHEABLE);
-
-	assert(uart->regs);
-
-	/* Soft reset the port */
-	uart->regs->sysc = OMAP_UART_SYSC_SOFTRESET_FLAG;
-	while (!(uart->regs->syss & OMAP_UART_SYSS_RESETDONE_FLAG))
-		;
-
-	/* Disable the UART module */
-	uart->regs->mdr1 |= OMAP_UART_MDR_MS_DISABLE;
-
-	/* Enable access to EFR register */
-	uart->regs->lcr = 0xbf;              /* Sets config mode B */
-
-	/* Enable access to TCL_TLR register */
-	const bool enhanced = uart->regs->efr & OMAP_UART_EFR_ENH_FLAG;
-	uart->regs->efr |= OMAP_UART_EFR_ENH_FLAG; /* Turn on enh. */
-	uart->regs->lcr = 0x80;              /* Config mode A */
-
-	/* Set default (val 0) triggers, disable DMA enable FIFOs */
-	const bool tcl_tlr = uart->regs->mcr & OMAP_UART_MCR_TCR_TLR_FLAG;
-	/* Enable access to tcr and tlr registers */
-	uart->regs->mcr |= OMAP_UART_MCR_TCR_TLR_FLAG;
-
-	/* Enable FIFOs */
-	uart->regs->fcr = OMAP_UART_FCR_FIFO_EN_FLAG;
-
-	/*
-	 * Enable fine granularity for RX FIFO and set trigger level to 1,
-	 * TX FIFO, trigger level is irrelevant
-	 */
-	uart->regs->lcr = 0xBF;              /* Sets config mode B */
-	uart->regs->scr = OMAP_UART_SCR_RX_TRIG_GRANU1_FLAG;
-	uart->regs->tlr = 1 << OMAP_UART_TLR_RX_FIFO_TRIG_SHIFT;
-
-	/* Sets config mode A */
-	uart->regs->lcr = 0x80;
-	/* Restore tcl_tlr access flag */
-	if (!tcl_tlr)
-		uart->regs->mcr &= ~OMAP_UART_MCR_TCR_TLR_FLAG;
-	/* Sets config mode B */
-	uart->regs->lcr = 0xBF;
-
-	/* Set the divisor value to get a baud rate of 115200 bps */
-	uart->regs->dll = 0x1A;
-	uart->regs->dlh = 0x00;
-
-	/* Restore enhanced */
-	if (!enhanced)
-		uart->regs->efr &= ~OMAP_UART_EFR_ENH_FLAG;
-
-	/* Set the DIV_EN bit to 0 */
-	uart->regs->lcr &= ~OMAP_UART_LCR_DIV_EN_FLAG;
-	/* Set the BREAK_EN bit to 0 */
-	uart->regs->lcr &= ~OMAP_UART_LCR_BREAK_EN_FLAG;
-	/* No parity */
-	uart->regs->lcr &= ~OMAP_UART_LCR_PARITY_EN_FLAG;
-	/* Stop = 1 bit */
-	uart->regs->lcr &= ~OMAP_UART_LCR_NB_STOP_FLAG;
-	/* Char length = 8 bits */
-	uart->regs->lcr |= OMAP_UART_LCR_CHAR_LENGTH_8BITS;
-
-	/* Enable the UART module */
-	uart->regs->mdr1 &= (OMAP_UART_MDR_MS_UART16 &
-	    ~OMAP_UART_MDR_MS_MASK);
-
-	/* Disable interrupts */
-	uart->regs->ier = 0;
-
-	/* Setup outdev */
-	outdev_initialize("omap_uart_dev", &uart->outdev, &omap_uart_ops);
-	uart->outdev.data = uart;
-
-	/* Initialize IRQ */
-	irq_initialize(&uart->irq);
-	uart->irq.inr = interrupt;
-	uart->irq.claim = omap_uart_claim;
-	uart->irq.handler = omap_uart_handler;
-	uart->irq.instance = uart;
-
-	return true;
-}
-
-void omap_uart_input_wire(omap_uart_t *uart, indev_t *indev)
-{
-	assert(uart);
-	/* Set indev */
-	uart->indev = indev;
-	/* Register interrupt. */
-	irq_register(&uart->irq);
-	/* Enable interrupt on receive */
-	uart->regs->ier |= OMAP_UART_IER_RHR_IRQ_FLAG;
-}
-
-/**
- * @}
- */
Index: rnel/genarch/src/drivers/pl011/pl011.c
===================================================================
--- kernel/genarch/src/drivers/pl011/pl011.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief ARM PrimeCell PL011 UART driver.
- */
-
-#include <assert.h>
-#include <genarch/drivers/pl011/pl011.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <arch/asm.h>
-#include <mm/slab.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <sysinfo/sysinfo.h>
-#include <str.h>
-
-static void pl011_uart_sendb(pl011_uart_t *uart, uint8_t byte)
-{
-	/* Wait for space becoming available in Tx FIFO. */
-	// TODO make pio_read accept consts pointers and remove the cast
-	while ((pio_read_32((ioport32_t *)&uart->regs->flag) & PL011_UART_FLAG_TXFF_FLAG) != 0)
-		;
-
-	pio_write_32(&uart->regs->data, byte);
-}
-
-static void pl011_uart_write(outdev_t *dev, const char *s, size_t n)
-{
-	pl011_uart_t *uart = dev->data;
-
-	/* If the userspace owns the console, do not output anything. */
-	if (uart->parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			pl011_uart_sendb(uart, '\r');
-
-		pl011_uart_sendb(uart, (uint8_t) *s);
-	}
-}
-
-static outdev_operations_t pl011_uart_ops = {
-	.write = pl011_uart_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-static irq_ownership_t pl011_uart_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void pl011_uart_irq_handler(irq_t *irq)
-{
-	pl011_uart_t *uart = irq->instance;
-
-	// TODO make pio_read accept const pointers and remove the cast
-	while ((pio_read_32((ioport32_t *)&uart->regs->flag) & PL011_UART_FLAG_RXFE_FLAG) == 0) {
-		/* We ignore all error flags here */
-		const uint8_t data = pio_read_32(&uart->regs->data);
-		if (uart->indev)
-			indev_push_character(uart->indev, data);
-	}
-	/* Ack interrupts */
-	pio_write_32(&uart->regs->interrupt_clear, PL011_UART_INTERRUPT_ALL);
-}
-
-bool pl011_uart_init(pl011_uart_t *uart, inr_t interrupt, uintptr_t addr)
-{
-	assert(uart);
-	uart->regs = (void *)km_map(addr, sizeof(pl011_uart_regs_t),
-	    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	assert(uart->regs);
-
-	/* Disable UART */
-	uart->regs->control &= ~PL011_UART_CONTROL_UARTEN_FLAG;
-
-	/* Enable hw flow control */
-	uart->regs->control |=
-	    PL011_UART_CONTROL_RTSE_FLAG |
-	    PL011_UART_CONTROL_CTSE_FLAG;
-
-	/* Mask all interrupts */
-	uart->regs->interrupt_mask = 0;
-	/* Clear interrupts */
-	uart->regs->interrupt_clear = PL011_UART_INTERRUPT_ALL;
-	/* Enable UART, TX and RX */
-	uart->regs->control |=
-	    PL011_UART_CONTROL_UARTEN_FLAG |
-	    PL011_UART_CONTROL_TXE_FLAG |
-	    PL011_UART_CONTROL_RXE_FLAG;
-
-	outdev_initialize("pl011_uart_dev", &uart->outdev, &pl011_uart_ops);
-	uart->outdev.data = uart;
-
-	/* Initialize IRQ */
-	irq_initialize(&uart->irq);
-	uart->irq.inr = interrupt;
-	uart->irq.claim = pl011_uart_claim;
-	uart->irq.handler = pl011_uart_irq_handler;
-	uart->irq.instance = uart;
-
-	ddi_parea_init(&uart->parea);
-	uart->parea.pbase = addr;
-	uart->parea.frames = 1;
-	uart->parea.unpriv = false;
-	uart->parea.mapped = false;
-	ddi_parea_register(&uart->parea);
-
-	return true;
-}
-
-void pl011_uart_input_wire(pl011_uart_t *uart, indev_t *indev)
-{
-	assert(uart);
-	assert(indev);
-
-	uart->indev = indev;
-	irq_register(&uart->irq);
-	/* Enable receive interrupts */
-	uart->regs->interrupt_mask |=
-	    PL011_UART_INTERRUPT_RX_FLAG |
-	    PL011_UART_INTERRUPT_RT_FLAG;
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/pl050/pl050.c
===================================================================
--- kernel/genarch/src/drivers/pl050/pl050.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	pl050 keyboard/mouse driver.
- *
- * It takes care of low-level keyboard functions.
- */
-
-#include <genarch/drivers/pl050/pl050.h>
-#include <arch/asm.h>
-#include <console/chardev.h>
-#include <stdlib.h>
-
-#define PL050_KEY_RELEASE 0xF0
-#define PL050_ESC_KEY	0xE0
-#define PL050_CAPS_SCAN_CODE   0x58
-
-/** Structure for pl050's IRQ. */
-static pl050_t *pl050;
-
-static irq_ownership_t pl050_claim(irq_t *irq)
-{
-	uint8_t status;
-	if ((status = pio_read_8(pl050->status)) & PL050_STAT_RXFULL)
-		return IRQ_ACCEPT;
-	else {
-		return IRQ_DECLINE;
-	}
-}
-
-static void pl050_irq_handler(irq_t *irq)
-{
-	uint8_t data;
-	uint8_t status;
-	pl050_instance_t *instance = irq->instance;
-
-	while ((status = pio_read_8(pl050->status)) & PL050_STAT_RXFULL) {
-		data = pio_read_8(pl050->data);
-		indev_push_character(instance->kbrdin, data);
-
-	}
-}
-
-/** Initialize pl050. */
-pl050_instance_t *pl050_init(pl050_t *dev, inr_t inr)
-{
-
-	pl050_instance_t *instance =
-	    malloc(sizeof(pl050_instance_t));
-
-	pl050 = dev;
-
-	if (instance) {
-		instance->pl050 = dev;
-		instance->kbrdin = NULL;
-
-		irq_initialize(&instance->irq);
-		instance->irq.inr = inr;
-		instance->irq.claim = pl050_claim;
-		instance->irq.handler = pl050_irq_handler;
-		instance->irq.instance = instance;
-	}
-
-	return instance;
-}
-
-void pl050_wire(pl050_instance_t *instance, indev_t *kbrdin)
-{
-	uint8_t val;
-
-	instance->kbrdin = kbrdin;
-	irq_register(&instance->irq);
-
-	val = PL050_CR_RXINTR | PL050_CR_INTR;
-
-	pio_write_8(pl050->ctrl, val);
-
-	/* reset the data buffer */
-	pio_read_8(pl050->data);
-
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/s3c24xx/irqc.c
===================================================================
--- kernel/genarch/src/drivers/s3c24xx/irqc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip interrupt controller.
- *
- * This IRQC is present on the Samsung S3C24xx CPU (on the gta02 platform).
- */
-
-#include <genarch/drivers/s3c24xx/irqc.h>
-#include <arch/asm.h>
-
-/** Correspondence between interrupt sources and sub-sources. */
-static unsigned s3c24xx_subsrc_src[][2] = {
-	{ S3C24XX_SUBINT_CAM_P, S3C24XX_INT_CAM },
-	{ S3C24XX_SUBINT_CAM_C, S3C24XX_INT_CAM },
-	{ S3C24XX_SUBINT_ADC_S, S3C24XX_INT_ADC },
-	{ S3C24XX_SUBINT_TC, S3C24XX_INT_ADC },
-	{ S3C24XX_SUBINT_ERR2, S3C24XX_INT_UART2 },
-	{ S3C24XX_SUBINT_TXD2, S3C24XX_INT_UART2 },
-	{ S3C24XX_SUBINT_RXD2, S3C24XX_INT_UART2 },
-	{ S3C24XX_SUBINT_ERR1, S3C24XX_INT_UART1 },
-	{ S3C24XX_SUBINT_TXD1, S3C24XX_INT_UART1 },
-	{ S3C24XX_SUBINT_RXD1, S3C24XX_INT_UART1 },
-	{ S3C24XX_SUBINT_ERR0, S3C24XX_INT_UART0 },
-	{ S3C24XX_SUBINT_TXD0, S3C24XX_INT_UART0 },
-	{ S3C24XX_SUBINT_RXD0, S3C24XX_INT_UART0 }
-};
-
-/** Initialize S3C24xx interrupt controller.
- *
- * @param irqc	Instance structure
- * @param regs	Register I/O structure
- */
-void s3c24xx_irqc_init(s3c24xx_irqc_t *irqc, s3c24xx_irqc_regs_t *regs)
-{
-	irqc->regs = regs;
-
-	/* Make all interrupt sources use IRQ mode (not FIQ). */
-	pio_write_32(&regs->intmod, 0x00000000);
-
-	/* Disable all interrupt sources. */
-	pio_write_32(&regs->intmsk, 0xffffffff);
-
-	/* Disable interrupts from all sub-sources. */
-	pio_write_32(&regs->intsubmsk, 0xffffffff);
-}
-
-/** Obtain number of pending interrupt. */
-unsigned s3c24xx_irqc_inum_get(s3c24xx_irqc_t *irqc)
-{
-	return pio_read_32(&irqc->regs->intoffset);
-}
-
-/** Clear pending interrupt condition including sub-sources.
- *
- * Clear source and interrupt pending condition and also automatically clear
- * any sub-source pending condition pertaining to the source.
- */
-void s3c24xx_irqc_clear(s3c24xx_irqc_t *irqc, unsigned inum)
-{
-	unsigned src, subsrc;
-	unsigned entries, i;
-
-	entries = sizeof(s3c24xx_subsrc_src) / sizeof(s3c24xx_subsrc_src[0]);
-
-	for (i = 0; i < entries; i++) {
-		subsrc = s3c24xx_subsrc_src[i][0];
-		src = s3c24xx_subsrc_src[i][1];
-
-		if (src == inum) {
-			pio_write_32(&irqc->regs->subsrcpnd,
-			    S3C24XX_SUBINT_BIT(subsrc));
-		}
-	}
-
-	pio_write_32(&irqc->regs->srcpnd, S3C24XX_INT_BIT(inum));
-	pio_write_32(&irqc->regs->intpnd, S3C24XX_INT_BIT(inum));
-}
-
-/** Enable interrupts from the specified source. */
-void s3c24xx_irqc_src_enable(s3c24xx_irqc_t *irqc, unsigned src)
-{
-	pio_write_32(&irqc->regs->intmsk, pio_read_32(&irqc->regs->intmsk) &
-	    ~S3C24XX_INT_BIT(src));
-}
-
-/** Disable interrupts from the specified source. */
-void s3c24xx_irqc_src_disable(s3c24xx_irqc_t *irqc, unsigned src)
-{
-	pio_write_32(&irqc->regs->intmsk, pio_read_32(&irqc->regs->intmsk) |
-	    S3C24XX_INT_BIT(src));
-}
-
-/** Enable interrupts from the specified sub-source. */
-void s3c24xx_irqc_subsrc_enable(s3c24xx_irqc_t *irqc, unsigned subsrc)
-{
-	pio_write_32(&irqc->regs->intsubmsk,
-	    pio_read_32(&irqc->regs->intsubmsk) &
-	    ~S3C24XX_SUBINT_BIT(subsrc));
-}
-
-/** Disable interrupts from the specified sub-source. */
-void s3c24xx_irqc_subsrc_disable(s3c24xx_irqc_t *irqc, unsigned subsrc)
-{
-	pio_write_32(&irqc->regs->intsubmsk,
-	    pio_read_32(&irqc->regs->intsubmsk) |
-	    S3C24XX_SUBINT_BIT(subsrc));
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/s3c24xx/uart.c
===================================================================
--- kernel/genarch/src/drivers/s3c24xx/uart.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip UART driver.
- *
- * This UART is present on the Samsung S3C24xx CPU (on the gta02 platform).
- */
-
-#include <assert.h>
-#include <genarch/drivers/s3c24xx/uart.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <arch/asm.h>
-#include <stdlib.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <sysinfo/sysinfo.h>
-#include <str.h>
-
-static void s3c24xx_uart_sendb(s3c24xx_uart_t *uart, uint8_t byte)
-{
-	/* Wait for space becoming available in Tx FIFO. */
-	while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_TX_FULL) != 0)
-		;
-
-	pio_write_32(&uart->io->utxh, byte);
-}
-
-static void s3c24xx_uart_write(outdev_t *dev, const char *s, size_t n)
-{
-	s3c24xx_uart_t *uart = dev->data;
-
-	/* If the userspace owns the console, do not output anything. */
-	if (uart->parea.mapped && !console_override)
-		return;
-
-	const char *top = s + n;
-	assert(top >= s);
-
-	for (; s < top; s++) {
-		if (*s == '\n')
-			s3c24xx_uart_sendb(uart, '\r');
-
-		s3c24xx_uart_sendb(uart, (uint8_t) *s);
-	}
-}
-
-static irq_ownership_t s3c24xx_uart_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void s3c24xx_uart_irq_handler(irq_t *irq)
-{
-	s3c24xx_uart_t *uart = irq->instance;
-
-	while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_RX_COUNT) != 0) {
-		uint32_t data = pio_read_32(&uart->io->urxh);
-		pio_read_32(&uart->io->uerstat);
-		indev_push_character(uart->indev, data & 0xff);
-	}
-}
-
-static outdev_operations_t s3c24xx_uart_ops = {
-	.write = s3c24xx_uart_write,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
-outdev_t *s3c24xx_uart_init(uintptr_t paddr, inr_t inr)
-{
-	outdev_t *uart_dev = malloc(sizeof(outdev_t));
-	if (!uart_dev)
-		return NULL;
-
-	s3c24xx_uart_t *uart =
-	    malloc(sizeof(s3c24xx_uart_t));
-	if (!uart) {
-		free(uart_dev);
-		return NULL;
-	}
-
-	outdev_initialize("s3c24xx_uart_dev", uart_dev, &s3c24xx_uart_ops);
-	uart_dev->data = uart;
-
-	uart->io = (s3c24xx_uart_io_t *) km_map(paddr, PAGE_SIZE, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	uart->indev = NULL;
-
-	/* Initialize IRQ structure. */
-	irq_initialize(&uart->irq);
-	uart->irq.inr = inr;
-	uart->irq.claim = s3c24xx_uart_claim;
-	uart->irq.handler = s3c24xx_uart_irq_handler;
-	uart->irq.instance = uart;
-
-	/* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
-	pio_write_32(&uart->io->ufcon, UFCON_FIFO_ENABLE |
-	    UFCON_TX_FIFO_TLEVEL_EMPTY | UFCON_RX_FIFO_TLEVEL_1B);
-
-	/* Set RX interrupt to pulse mode */
-	pio_write_32(&uart->io->ucon,
-	    pio_read_32(&uart->io->ucon) & ~UCON_RX_INT_LEVEL);
-
-	ddi_parea_init(&uart->parea);
-	uart->parea.pbase = paddr;
-	uart->parea.frames = 1;
-	uart->parea.unpriv = false;
-	uart->parea.mapped = false;
-	ddi_parea_register(&uart->parea);
-
-	if (!fb_exported) {
-		/*
-		 * This is the necessary evil until
-		 * the userspace driver is entirely
-		 * self-sufficient.
-		 */
-		sysinfo_set_item_val("fb", NULL, true);
-		sysinfo_set_item_val("fb.kind", NULL, 3);
-		sysinfo_set_item_val("fb.address.physical", NULL, paddr);
-
-		fb_exported = true;
-	}
-
-	return uart_dev;
-}
-
-void s3c24xx_uart_input_wire(s3c24xx_uart_t *uart, indev_t *indev)
-{
-	assert(uart);
-	assert(indev);
-
-	uart->indev = indev;
-	irq_register(&uart->irq);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/via-cuda/cuda.c
===================================================================
--- kernel/genarch/src/drivers/via-cuda/cuda.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,369 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <genarch/drivers/via-cuda/cuda.h>
-#include <console/chardev.h>
-#include <ddi/irq.h>
-#include <arch/asm.h>
-#include <stdlib.h>
-#include <synch/spinlock.h>
-#include <memw.h>
-
-static irq_ownership_t cuda_claim(irq_t *irq);
-static void cuda_irq_handler(irq_t *irq);
-
-static void cuda_irq_listen(irq_t *irq);
-static void cuda_irq_receive(irq_t *irq);
-static void cuda_irq_rcv_end(irq_t *irq, void *buf, size_t *len);
-static void cuda_irq_send_start(irq_t *irq);
-static void cuda_irq_send(irq_t *irq);
-
-static void cuda_packet_handle(cuda_instance_t *instance, uint8_t *buf, size_t len);
-static void cuda_send_start(cuda_instance_t *instance);
-static void cuda_autopoll_set(cuda_instance_t *instance, bool enable);
-
-/** B register fields */
-enum {
-	TREQ	= 0x08,
-	TACK	= 0x10,
-	TIP	= 0x20
-};
-
-/** IER register fields */
-enum {
-	IER_CLR	= 0x00,
-	IER_SET	= 0x80,
-
-	SR_INT	= 0x04,
-	ALL_INT	= 0x7f
-};
-
-/** ACR register fields */
-enum {
-	SR_OUT	= 0x10
-};
-
-/** Packet types */
-enum {
-	PT_ADB	= 0x00,
-	PT_CUDA	= 0x01
-};
-
-/** CUDA packet types */
-enum {
-	CPT_AUTOPOLL	= 0x01
-};
-
-cuda_instance_t *cuda_init(cuda_t *dev, inr_t inr, cir_t cir, void *cir_arg)
-{
-	cuda_instance_t *instance =
-	    malloc(sizeof(cuda_instance_t));
-	if (instance) {
-		instance->cuda = dev;
-		instance->kbrdin = NULL;
-		instance->xstate = cx_listen;
-		instance->bidx = 0;
-		instance->snd_bytes = 0;
-
-		spinlock_initialize(&instance->dev_lock, "cuda.instance.dev_lock");
-
-		/* Disable all interrupts from CUDA. */
-		pio_write_8(&dev->ier, IER_CLR | ALL_INT);
-
-		irq_initialize(&instance->irq);
-		instance->irq.inr = inr;
-		instance->irq.claim = cuda_claim;
-		instance->irq.handler = cuda_irq_handler;
-		instance->irq.instance = instance;
-		instance->irq.cir = cir;
-		instance->irq.cir_arg = cir_arg;
-		instance->irq.preack = true;
-	}
-
-	return instance;
-}
-
-#include <log.h>
-void cuda_wire(cuda_instance_t *instance, indev_t *kbrdin)
-{
-	cuda_t *dev = instance->cuda;
-
-	assert(instance);
-	assert(kbrdin);
-
-	instance->kbrdin = kbrdin;
-	irq_register(&instance->irq);
-
-	/* Enable SR interrupt. */
-	pio_write_8(&dev->ier, TIP | TREQ);
-	pio_write_8(&dev->ier, IER_SET | SR_INT);
-
-	/* Enable ADB autopolling. */
-	cuda_autopoll_set(instance, true);
-}
-
-static irq_ownership_t cuda_claim(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-	uint8_t ifr;
-
-	spinlock_lock(&instance->dev_lock);
-	ifr = pio_read_8(&dev->ifr);
-	spinlock_unlock(&instance->dev_lock);
-
-	if ((ifr & SR_INT) == 0)
-		return IRQ_DECLINE;
-
-	return IRQ_ACCEPT;
-}
-
-static void cuda_irq_handler(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	uint8_t rbuf[CUDA_RCV_BUF_SIZE];
-	size_t len;
-	bool handle;
-
-	handle = false;
-	len = 0;
-
-	spinlock_lock(&instance->dev_lock);
-
-	/* Lower IFR.SR_INT so that CUDA can generate next int by raising it. */
-	pio_write_8(&instance->cuda->ifr, SR_INT);
-
-	switch (instance->xstate) {
-	case cx_listen:
-		cuda_irq_listen(irq);
-		break;
-	case cx_receive:
-		cuda_irq_receive(irq);
-		break;
-	case cx_rcv_end:
-		cuda_irq_rcv_end(irq, rbuf, &len);
-		handle = true;
-		break;
-	case cx_send_start:
-		cuda_irq_send_start(irq);
-		break;
-	case cx_send:
-		cuda_irq_send(irq);
-		break;
-	}
-
-	spinlock_unlock(&instance->dev_lock);
-
-	/* Handle an incoming packet. */
-	if (handle)
-		cuda_packet_handle(instance, rbuf, len);
-}
-
-/** Interrupt in listen state.
- *
- * Start packet reception.
- */
-static void cuda_irq_listen(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-	uint8_t b;
-
-	b = pio_read_8(&dev->b);
-
-	if ((b & TREQ) != 0) {
-		log(LF_OTHER, LVL_ERROR, "cuda_irq_listen: no TREQ?!");
-		return;
-	}
-
-	pio_read_8(&dev->sr);
-	pio_write_8(&dev->b, pio_read_8(&dev->b) & ~TIP);
-	instance->xstate = cx_receive;
-}
-
-/** Interrupt in receive state.
- *
- * Receive next byte of packet.
- */
-static void cuda_irq_receive(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-	uint8_t b, data;
-
-	data = pio_read_8(&dev->sr);
-	if (instance->bidx < CUDA_RCV_BUF_SIZE)
-		instance->rcv_buf[instance->bidx++] = data;
-
-	b = pio_read_8(&dev->b);
-
-	if ((b & TREQ) == 0) {
-		pio_write_8(&dev->b, b ^ TACK);
-	} else {
-		pio_write_8(&dev->b, b | TACK | TIP);
-		instance->xstate = cx_rcv_end;
-	}
-}
-
-/** Interrupt in rcv_end state.
- *
- * Terminate packet reception. Either go back to listen state or start
- * receiving another packet if CUDA has one for us.
- */
-static void cuda_irq_rcv_end(irq_t *irq, void *buf, size_t *len)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-	uint8_t b;
-
-	b = pio_read_8(&dev->b);
-	pio_read_8(&dev->sr);
-
-	if ((b & TREQ) == 0) {
-		instance->xstate = cx_receive;
-		pio_write_8(&dev->b, b & ~TIP);
-	} else {
-		instance->xstate = cx_listen;
-		cuda_send_start(instance);
-	}
-
-	memcpy(buf, instance->rcv_buf, instance->bidx);
-	*len = instance->bidx;
-	instance->bidx = 0;
-}
-
-/** Interrupt in send_start state.
- *
- * Process result of sending first byte (and send second on success).
- */
-static void cuda_irq_send_start(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-	uint8_t b;
-
-	b = pio_read_8(&dev->b);
-
-	if ((b & TREQ) == 0) {
-		/* Collision */
-		pio_write_8(&dev->acr, pio_read_8(&dev->acr) & ~SR_OUT);
-		pio_read_8(&dev->sr);
-		pio_write_8(&dev->b, pio_read_8(&dev->b) | TIP | TACK);
-		instance->xstate = cx_listen;
-		return;
-	}
-
-	pio_write_8(&dev->sr, instance->snd_buf[1]);
-	pio_write_8(&dev->b, pio_read_8(&dev->b) ^ TACK);
-	instance->bidx = 2;
-
-	instance->xstate = cx_send;
-}
-
-/** Interrupt in send state.
- *
- * Send next byte or terminate transmission.
- */
-static void cuda_irq_send(irq_t *irq)
-{
-	cuda_instance_t *instance = irq->instance;
-	cuda_t *dev = instance->cuda;
-
-	if (instance->bidx < instance->snd_bytes) {
-		/* Send next byte. */
-		pio_write_8(&dev->sr, instance->snd_buf[instance->bidx++]);
-		pio_write_8(&dev->b, pio_read_8(&dev->b) ^ TACK);
-		return;
-	}
-
-	/* End transfer. */
-	instance->snd_bytes = 0;
-	instance->bidx = 0;
-
-	pio_write_8(&dev->acr, pio_read_8(&dev->acr) & ~SR_OUT);
-	pio_read_8(&dev->sr);
-	pio_write_8(&dev->b, pio_read_8(&dev->b) | TACK | TIP);
-
-	instance->xstate = cx_listen;
-	/* TODO: Match reply with request. */
-}
-
-static void cuda_packet_handle(cuda_instance_t *instance, uint8_t *data, size_t len)
-{
-	if (data[0] != 0x00 || data[1] != 0x40 || (data[2] != 0x2c &&
-	    data[2] != 0x8c))
-		return;
-
-	/* The packet contains one or two scancodes. */
-	if (data[3] != 0xff)
-		indev_push_character(instance->kbrdin, data[3]);
-	if (data[4] != 0xff)
-		indev_push_character(instance->kbrdin, data[4]);
-}
-
-static void cuda_autopoll_set(cuda_instance_t *instance, bool enable)
-{
-	instance->snd_buf[0] = PT_CUDA;
-	instance->snd_buf[1] = CPT_AUTOPOLL;
-	instance->snd_buf[2] = enable ? 0x01 : 0x00;
-	instance->snd_bytes = 3;
-	instance->bidx = 0;
-
-	cuda_send_start(instance);
-}
-
-static void cuda_send_start(cuda_instance_t *instance)
-{
-	cuda_t *dev = instance->cuda;
-
-	assert(instance->xstate == cx_listen);
-
-	if (instance->snd_bytes == 0)
-		return;
-
-	/* Check for incoming data. */
-	if ((pio_read_8(&dev->b) & TREQ) == 0)
-		return;
-
-	pio_write_8(&dev->acr, pio_read_8(&dev->acr) | SR_OUT);
-	pio_write_8(&dev->sr, instance->snd_buf[0]);
-	pio_write_8(&dev->b, pio_read_8(&dev->b) & ~TIP);
-
-	instance->xstate = cx_send_start;
-}
-
-/** @}
- */
Index: rnel/genarch/src/fb/bfb.c
===================================================================
--- kernel/genarch/src/fb/bfb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Boot framebuffer driver.
- */
-
-#include <debug.h>
-#include <typedefs.h>
-#include <genarch/fb/fb.h>
-#include <genarch/fb/bfb.h>
-#include <console/console.h>
-
-uintptr_t bfb_addr = 0;
-uint32_t bfb_width = 0;
-uint32_t bfb_height = 0;
-uint16_t bfb_bpp = 0;
-uint32_t bfb_scanline = 0;
-
-uint8_t bfb_red_pos = 0;
-uint8_t bfb_red_size = 0;
-
-uint8_t bfb_green_pos = 0;
-uint8_t bfb_green_size = 0;
-
-uint8_t bfb_blue_pos = 0;
-uint8_t bfb_blue_size = 0;
-
-bool bfb_init(void)
-{
-	if ((bfb_addr == 0) || (bfb_width == 0) || (bfb_height == 0) ||
-	    (bfb_bpp == 0) || (bfb_scanline == 0))
-		return false;
-
-	fb_properties_t bfb_props = {
-		.addr = bfb_addr,
-		.offset = 0,
-		.x = bfb_width,
-		.y = bfb_height,
-		.scan = bfb_scanline
-	};
-
-	switch (bfb_bpp) {
-	case 8:
-		bfb_props.visual = VISUAL_INDIRECT_8;
-		break;
-	case 16:
-		if ((bfb_red_pos == 10) && (bfb_red_size == 5) &&
-		    (bfb_green_pos == 5) && (bfb_green_size == 5) &&
-		    (bfb_blue_pos == 0) && (bfb_blue_size == 5))
-			bfb_props.visual = VISUAL_RGB_5_5_5_LE;
-		else
-			bfb_props.visual = VISUAL_RGB_5_6_5_LE;
-		break;
-	case 24:
-		bfb_props.visual = VISUAL_BGR_8_8_8;
-		break;
-	case 32:
-		bfb_props.visual = VISUAL_BGR_8_8_8_0;
-		break;
-	default:
-		LOG("Unsupported bits per pixel.");
-		return false;
-	}
-
-	outdev_t *fbdev = fb_init(&bfb_props);
-	if (!fbdev)
-		return false;
-
-	stdout_wire(fbdev);
-	return true;
-}
-
-/** @}
- */
Index: rnel/genarch/src/fb/fb.c
===================================================================
--- kernel/genarch/src/fb/fb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,730 +1,0 @@
-/*
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <debug.h>
-#include <genarch/fb/font-8x16.h>
-#include <genarch/fb/fb.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <sysinfo/sysinfo.h>
-#include <mm/km.h>
-#include <stdlib.h>
-#include <align.h>
-#include <panic.h>
-#include <memw.h>
-#include <config.h>
-#include <bitops.h>
-#include <str.h>
-#include <ddi/ddi.h>
-#include <typedefs.h>
-#include <byteorder.h>
-
-#define BG_COLOR     0x001620
-#define FG_COLOR     0xf3cf65
-#define INV_COLOR    0xaaaaaa
-
-#define FB_PAGES  8
-
-#define RED(x, bits)    (((x) >> (8 + 8 + 8 - (bits))) & ((1 << (bits)) - 1))
-#define GREEN(x, bits)  (((x) >> (8 + 8 - (bits))) & ((1 << (bits)) - 1))
-#define BLUE(x, bits)   (((x) >> (8 - (bits))) & ((1 << (bits)) - 1))
-
-#define COL2X(col)  ((col) * FONT_WIDTH)
-#define ROW2Y(row)  ((row) * FONT_SCANLINES)
-
-#define X2COL(x)  ((x) / FONT_WIDTH)
-#define Y2ROW(y)  ((y) / FONT_SCANLINES)
-
-#define FB_POS(instance, x, y) \
-	((y) * (instance)->scanline + (x) * (instance)->pixelbytes)
-
-#define BB_POS(instance, col, row) \
-	((((instance)->start_row + (row)) % (instance)->rows) * \
-	    (instance)->cols + (col))
-
-#define BB_NEXT_COL(pos) (++(pos))
-
-#define GLYPH_POS(instance, glyph, y) \
-	((glyph) * (instance)->glyphbytes + (y) * (instance)->glyphscanline)
-
-#define TAB_WIDTH 8
-
-typedef void (*rgb_conv_t)(void *, uint32_t);
-
-typedef struct {
-	SPINLOCK_DECLARE(lock);
-
-	parea_t parea;
-
-	uint8_t *addr;
-	uint16_t *backbuf;
-	uint8_t *glyphs;
-	uint8_t *bgscan;
-
-	rgb_conv_t rgb_conv;
-
-	unsigned int xres;
-	unsigned int yres;
-
-	/** Number of rows that fit on framebuffer */
-	unsigned int screen_rows;
-
-	unsigned int scanline;
-	unsigned int glyphscanline;
-
-	unsigned int pixelbytes;
-	unsigned int glyphbytes;
-	unsigned int bgscanbytes;
-
-	/** Number of columns in the backbuffer */
-	unsigned int cols;
-	/** Number of rows in the backbuffer */
-	unsigned int rows;
-
-	/** Starting row in the cyclic backbuffer */
-	unsigned int start_row;
-
-	/** Top-most visible row (relative to start_row) */
-	unsigned int offset_row;
-
-	/** Current backbuffer position */
-	unsigned int position;
-
-	/** Partial character between writes */
-	mbstate_t mbstate;
-
-	unsigned int row;
-	unsigned int column;
-} fb_instance_t;
-
-static void fb_write(outdev_t *, const char *, size_t);
-static void fb_redraw(outdev_t *);
-static void fb_scroll_up(outdev_t *);
-static void fb_scroll_down(outdev_t *);
-
-static outdev_operations_t fbdev_ops = {
-	.write = fb_write,
-	.redraw = fb_redraw,
-	.scroll_up = fb_scroll_up,
-	.scroll_down = fb_scroll_down
-};
-
-/*
- * RGB conversion functions.
- *
- * These functions write an RGB value to some memory in some predefined format.
- * The naming convention corresponds to the format created by these functions.
- * The functions use the so called network order (i.e. big endian) with respect
- * to their names.
- */
-
-static void rgb_0888(void *dst, uint32_t rgb)
-{
-	*((uint32_t *) dst) = host2uint32_t_be((0 << 24) |
-	    (RED(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (BLUE(rgb, 8)));
-}
-
-static void bgr_0888(void *dst, uint32_t rgb)
-{
-	*((uint32_t *) dst) = host2uint32_t_be((0 << 24) |
-	    (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (RED(rgb, 8)));
-}
-
-static void rgb_8880(void *dst, uint32_t rgb)
-{
-	*((uint32_t *) dst) = host2uint32_t_be((RED(rgb, 8) << 24) |
-	    (GREEN(rgb,	8) << 16) | (BLUE(rgb, 8) << 8) | 0);
-}
-
-static void bgr_8880(void *dst, uint32_t rgb)
-{
-	*((uint32_t *) dst) = host2uint32_t_be((BLUE(rgb, 8) << 24) |
-	    (GREEN(rgb,	8) << 16) | (RED(rgb, 8) << 8) | 0);
-}
-
-static void rgb_888(void *dst, uint32_t rgb)
-{
-	((uint8_t *) dst)[0] = RED(rgb, 8);
-	((uint8_t *) dst)[1] = GREEN(rgb, 8);
-	((uint8_t *) dst)[2] = BLUE(rgb, 8);
-}
-
-static void bgr_888(void *dst, uint32_t rgb)
-{
-	((uint8_t *) dst)[0] = BLUE(rgb, 8);
-	((uint8_t *) dst)[1] = GREEN(rgb, 8);
-	((uint8_t *) dst)[2] = RED(rgb, 8);
-}
-
-static void rgb_555_be(void *dst, uint32_t rgb)
-{
-	*((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 10 |
-	    GREEN(rgb, 5) << 5 | BLUE(rgb, 5));
-}
-
-static void rgb_555_le(void *dst, uint32_t rgb)
-{
-	*((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 10 |
-	    GREEN(rgb, 5) << 5 | BLUE(rgb, 5));
-}
-
-static void rgb_565_be(void *dst, uint32_t rgb)
-{
-	*((uint16_t *) dst) = host2uint16_t_be(RED(rgb, 5) << 11 |
-	    GREEN(rgb, 6) << 5 | BLUE(rgb, 5));
-}
-
-static void rgb_565_le(void *dst, uint32_t rgb)
-{
-	*((uint16_t *) dst) = host2uint16_t_le(RED(rgb, 5) << 11 |
-	    GREEN(rgb, 6) << 5 | BLUE(rgb, 5));
-}
-
-/** BGR 3:2:3
- *
- * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
- * will most likely use a color palette. The color appearance
- * will be pretty random and depend on the default installed
- * palette. This could be fixed by supporting custom palette
- * and setting it to simulate the 8-bit truecolor.
- *
- * Currently we set the palette on the ia32, amd64, ppc32 and sparc64 port.
- *
- * Note that the byte is being inverted by this function. The reason is
- * that we would like to use a color palette where the white color code
- * is 0 and the black color code is 255, as some machines (Sun Blade 1500)
- * use these codes for black and white and prevent to set codes
- * 0 and 255 to other colors.
- *
- */
-static void bgr_323(void *dst, uint32_t rgb)
-{
-	*((uint8_t *) dst) =
-	    ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3));
-}
-
-/** Draw character at given position
- *
- */
-static void glyph_draw(fb_instance_t *instance, uint16_t glyph,
-    unsigned int col, unsigned int row, bool overlay)
-{
-	if (!overlay)
-		instance->backbuf[BB_POS(instance, col, row)] = glyph;
-
-	/* Do not output if the framebuffer is used by user space */
-	if ((instance->parea.mapped) && (!console_override))
-		return;
-
-	/* Check whether the glyph should be visible */
-	if (row < instance->offset_row)
-		return;
-
-	unsigned int rel_row = row - instance->offset_row;
-	if (rel_row >= instance->screen_rows)
-		return;
-
-	unsigned int x = COL2X(col);
-	unsigned int y = ROW2Y(rel_row);
-
-	for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++)
-		memcpy(&instance->addr[FB_POS(instance, x, y + yd)],
-		    &instance->glyphs[GLYPH_POS(instance, glyph, yd)],
-		    instance->glyphscanline);
-}
-
-/** Scroll screen down by one row
- *
- */
-static void screen_scroll(fb_instance_t *instance)
-{
-	if ((!instance->parea.mapped) || (console_override)) {
-		for (unsigned int rel_row = 0; rel_row < instance->screen_rows; rel_row++) {
-			unsigned int y = ROW2Y(rel_row);
-			unsigned int row = rel_row + instance->offset_row;
-
-			for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++) {
-				unsigned int x;
-				unsigned int col;
-				size_t bb_pos = BB_POS(instance, 0, row);
-				size_t bb_pos1 = BB_POS(instance, 0, row + 1);
-
-				for (col = 0, x = 0; col < instance->cols;
-				    col++, x += FONT_WIDTH) {
-					uint16_t glyph;
-
-					if (row < instance->rows - 1) {
-						if (instance->backbuf[bb_pos] ==
-						    instance->backbuf[bb_pos1])
-							goto skip;
-
-						glyph = instance->backbuf[bb_pos1];
-					} else
-						glyph = 0;
-
-					memcpy(&instance->addr[FB_POS(instance, x, y + yd)],
-					    &instance->glyphs[GLYPH_POS(instance, glyph, yd)],
-					    instance->glyphscanline);
-				skip:
-					BB_NEXT_COL(bb_pos);
-					BB_NEXT_COL(bb_pos1);
-				}
-			}
-		}
-	}
-
-	/*
-	 * Implement backbuffer scrolling by wrapping around
-	 * the cyclic buffer.
-	 */
-
-	instance->start_row++;
-	if (instance->start_row == instance->rows)
-		instance->start_row = 0;
-
-	memsetw(&instance->backbuf[BB_POS(instance, 0, instance->rows - 1)],
-	    instance->cols, 0);
-}
-
-static void cursor_put(fb_instance_t *instance)
-{
-	unsigned int col = instance->column;
-	unsigned int row = instance->row;
-
-	glyph_draw(instance, fb_font_glyph(U_CURSOR), col, row, true);
-}
-
-static void cursor_remove(fb_instance_t *instance)
-{
-	unsigned int col = instance->column;
-	unsigned int row = instance->row;
-
-	glyph_draw(instance, instance->backbuf[BB_POS(instance, col, row)],
-	    col, row, true);
-}
-
-/** Render glyphs
- *
- * Convert glyphs from device independent font
- * description to current visual representation.
- *
- */
-static void glyphs_render(fb_instance_t *instance)
-{
-	/* Prerender glyphs */
-	uint16_t glyph;
-
-	for (glyph = 0; glyph < FONT_GLYPHS; glyph++) {
-		uint32_t fg_color;
-
-		if (glyph == FONT_GLYPHS - 1)
-			fg_color = INV_COLOR;
-		else
-			fg_color = FG_COLOR;
-
-		unsigned int y;
-
-		for (y = 0; y < FONT_SCANLINES; y++) {
-			unsigned int x;
-
-			for (x = 0; x < FONT_WIDTH; x++) {
-				void *dst =
-				    &instance->glyphs[GLYPH_POS(instance, glyph, y) +
-				    x * instance->pixelbytes];
-				uint32_t rgb = (fb_font[glyph][y] &
-				    (1 << (7 - x))) ? fg_color : BG_COLOR;
-				instance->rgb_conv(dst, rgb);
-			}
-		}
-	}
-
-	/* Prerender background scanline */
-	unsigned int x;
-
-	for (x = 0; x < instance->xres; x++)
-		instance->rgb_conv(&instance->bgscan[x * instance->pixelbytes], BG_COLOR);
-}
-
-static void fb_redraw_internal(fb_instance_t *instance)
-{
-	for (unsigned int rel_row = 0; rel_row < instance->screen_rows; rel_row++) {
-		unsigned int y = ROW2Y(rel_row);
-		unsigned int row = rel_row + instance->offset_row;
-
-		for (unsigned int yd = 0; yd < FONT_SCANLINES; yd++) {
-			unsigned int x;
-			unsigned int col;
-			size_t bb_pos = BB_POS(instance, 0, row);
-
-			for (col = 0, x = 0; col < instance->cols;
-			    col++, x += FONT_WIDTH) {
-				uint16_t glyph =
-				    instance->backbuf[bb_pos];
-				void *dst = &instance->addr[FB_POS(instance, x, y + yd)];
-				void *src = &instance->glyphs[GLYPH_POS(instance, glyph, yd)];
-				memcpy(dst, src, instance->glyphscanline);
-				BB_NEXT_COL(bb_pos);
-			}
-		}
-	}
-
-	if (COL2X(instance->cols) < instance->xres) {
-		unsigned int y;
-		unsigned int size =
-		    (instance->xres - COL2X(instance->cols)) * instance->pixelbytes;
-
-		for (y = 0; y < instance->yres; y++)
-			memcpy(&instance->addr[FB_POS(instance, COL2X(instance->cols), y)],
-			    instance->bgscan, size);
-	}
-
-	if (ROW2Y(instance->screen_rows) < instance->yres) {
-		unsigned int y;
-
-		for (y = ROW2Y(instance->screen_rows); y < instance->yres; y++)
-			memcpy(&instance->addr[FB_POS(instance, 0, y)],
-			    instance->bgscan, instance->bgscanbytes);
-	}
-}
-
-static void _advance_row(fb_instance_t *instance)
-{
-	instance->column = 0;
-	instance->row++;
-}
-
-static void _advance_column(fb_instance_t *instance)
-{
-	instance->column++;
-	if (instance->column == instance->cols)
-		_advance_row(instance);
-}
-
-/** Print character to screen
- *
- * Emulate basic terminal commands.
- *
- */
-static void _putuchar(fb_instance_t *instance, char32_t ch)
-{
-	switch (ch) {
-	case '\n':
-		_advance_row(instance);
-		break;
-	case '\r':
-		instance->column = 0;
-		break;
-	case '\b':
-		if (instance->column > 0)
-			instance->column--;
-		break;
-	case '\t':
-		do {
-			glyph_draw(instance, fb_font_glyph(' '),
-			    instance->column,
-			    instance->row, false);
-			_advance_column(instance);
-		} while (instance->column % TAB_WIDTH != 0);
-		break;
-	default:
-		glyph_draw(instance, fb_font_glyph(ch),
-		    instance->column,
-		    instance->row, false);
-		_advance_column(instance);
-	}
-
-	while (instance->row >= instance->rows) {
-		instance->row--;
-		screen_scroll(instance);
-	}
-}
-
-static void fb_write(outdev_t *dev, const char *s, size_t n)
-{
-	fb_instance_t *instance = (fb_instance_t *) dev->data;
-
-	spinlock_lock(&instance->lock);
-	cursor_remove(instance);
-
-	size_t offset = 0;
-	char32_t ch;
-
-	while ((ch = str_decode_r(s, &offset, n, U_SPECIAL, &instance->mbstate)))
-		_putuchar(instance, ch);
-
-	cursor_put(instance);
-	spinlock_unlock(&instance->lock);
-}
-
-/** Scroll the framebuffer up
- *
- */
-static void fb_scroll_up(outdev_t *dev)
-{
-	fb_instance_t *instance = (fb_instance_t *) dev->data;
-	spinlock_lock(&instance->lock);
-
-	if (instance->offset_row >= instance->screen_rows / 2)
-		instance->offset_row -= instance->screen_rows / 2;
-	else
-		instance->offset_row = 0;
-
-	fb_redraw_internal(instance);
-	cursor_put(instance);
-
-	spinlock_unlock(&instance->lock);
-}
-
-/** Scroll the framebuffer down
- *
- */
-static void fb_scroll_down(outdev_t *dev)
-{
-	fb_instance_t *instance = (fb_instance_t *) dev->data;
-	spinlock_lock(&instance->lock);
-
-	if (instance->offset_row + instance->screen_rows / 2 <=
-	    instance->rows - instance->screen_rows)
-		instance->offset_row += instance->screen_rows / 2;
-	else
-		instance->offset_row = instance->rows - instance->screen_rows;
-
-	fb_redraw_internal(instance);
-	cursor_put(instance);
-
-	spinlock_unlock(&instance->lock);
-}
-
-/** Refresh the screen
- *
- */
-static void fb_redraw(outdev_t *dev)
-{
-	fb_instance_t *instance = (fb_instance_t *) dev->data;
-
-	spinlock_lock(&instance->lock);
-	fb_redraw_internal(instance);
-	spinlock_unlock(&instance->lock);
-}
-
-/** Framebuffer was mapped or unmapped.
- *
- * @param arg Framebuffer instance
- */
-static void fb_mapped_changed(void *arg)
-{
-	fb_instance_t *instance = (fb_instance_t *) arg;
-
-	if (!instance->parea.mapped) {
-		spinlock_lock(&instance->lock);
-		fb_redraw_internal(instance);
-		spinlock_unlock(&instance->lock);
-	}
-}
-
-/** Initialize framebuffer as a output character device
- *
- */
-outdev_t *fb_init(fb_properties_t *props)
-{
-	assert(props);
-	assert(props->x > 0);
-	assert(props->y > 0);
-	assert(props->scan > 0);
-
-	rgb_conv_t rgb_conv;
-	unsigned int pixelbytes;
-
-	switch (props->visual) {
-	case VISUAL_INDIRECT_8:
-		rgb_conv = bgr_323;
-		pixelbytes = 1;
-		break;
-	case VISUAL_RGB_5_5_5_LE:
-		rgb_conv = rgb_555_le;
-		pixelbytes = 2;
-		break;
-	case VISUAL_RGB_5_5_5_BE:
-		rgb_conv = rgb_555_be;
-		pixelbytes = 2;
-		break;
-	case VISUAL_RGB_5_6_5_LE:
-		rgb_conv = rgb_565_le;
-		pixelbytes = 2;
-		break;
-	case VISUAL_RGB_5_6_5_BE:
-		rgb_conv = rgb_565_be;
-		pixelbytes = 2;
-		break;
-	case VISUAL_RGB_8_8_8:
-		rgb_conv = rgb_888;
-		pixelbytes = 3;
-		break;
-	case VISUAL_BGR_8_8_8:
-		rgb_conv = bgr_888;
-		pixelbytes = 3;
-		break;
-	case VISUAL_RGB_8_8_8_0:
-		rgb_conv = rgb_8880;
-		pixelbytes = 4;
-		break;
-	case VISUAL_RGB_0_8_8_8:
-		rgb_conv = rgb_0888;
-		pixelbytes = 4;
-		break;
-	case VISUAL_BGR_0_8_8_8:
-		rgb_conv = bgr_0888;
-		pixelbytes = 4;
-		break;
-	case VISUAL_BGR_8_8_8_0:
-		rgb_conv = bgr_8880;
-		pixelbytes = 4;
-		break;
-	default:
-		LOG("Unsupported visual.");
-		return NULL;
-	}
-
-	outdev_t *fbdev = malloc(sizeof(outdev_t));
-	if (!fbdev)
-		return NULL;
-
-	fb_instance_t *instance = malloc(sizeof(fb_instance_t));
-	if (!instance) {
-		free(fbdev);
-		return NULL;
-	}
-
-	outdev_initialize("fbdev", fbdev, &fbdev_ops);
-	fbdev->data = instance;
-
-	spinlock_initialize(&instance->lock, "*fb.instance.lock");
-
-	instance->rgb_conv = rgb_conv;
-	instance->pixelbytes = pixelbytes;
-	instance->xres = props->x;
-	instance->yres = props->y;
-	instance->scanline = props->scan;
-
-	instance->screen_rows = Y2ROW(instance->yres);
-
-	instance->cols = X2COL(instance->xres);
-	instance->rows = FB_PAGES * instance->screen_rows;
-
-	instance->start_row = instance->rows - instance->screen_rows;
-	instance->offset_row = instance->start_row;
-	instance->row = instance->start_row;
-	instance->column = 0;
-
-	instance->glyphscanline = FONT_WIDTH * instance->pixelbytes;
-	instance->glyphbytes = ROW2Y(instance->glyphscanline);
-	instance->bgscanbytes = instance->xres * instance->pixelbytes;
-
-	size_t fbsize = instance->scanline * instance->yres;
-	size_t bbsize = instance->cols * instance->rows * sizeof(uint16_t);
-	size_t glyphsize = FONT_GLYPHS * instance->glyphbytes;
-
-	instance->addr = (uint8_t *) km_map((uintptr_t) props->addr, fbsize,
-	    KM_NATURAL_ALIGNMENT, PAGE_WRITE | PAGE_WRITE_COMBINE);
-	if (!instance->addr) {
-		LOG("Unable to map framebuffer.");
-		free(instance);
-		free(fbdev);
-		return NULL;
-	}
-
-	instance->backbuf = (uint16_t *) malloc(bbsize);
-	if (!instance->backbuf) {
-		LOG("Unable to allocate backbuffer.");
-		free(instance);
-		free(fbdev);
-		return NULL;
-	}
-
-	instance->glyphs = (uint8_t *) malloc(glyphsize);
-	if (!instance->glyphs) {
-		LOG("Unable to allocate glyphs.");
-		free(instance->backbuf);
-		free(instance);
-		free(fbdev);
-		return NULL;
-	}
-
-	instance->bgscan = malloc(instance->bgscanbytes);
-	if (!instance->bgscan) {
-		LOG("Unable to allocate background pixel.");
-		free(instance->glyphs);
-		free(instance->backbuf);
-		free(instance);
-		free(fbdev);
-		return NULL;
-	}
-
-	memsetw(instance->backbuf, instance->cols * instance->rows, 0);
-	glyphs_render(instance);
-
-	ddi_parea_init(&instance->parea);
-	instance->parea.pbase = props->addr;
-	instance->parea.frames = SIZE2FRAMES(fbsize);
-	instance->parea.unpriv = false;
-	instance->parea.mapped = false;
-	instance->parea.mapped_changed = fb_mapped_changed;
-	instance->parea.arg = (void *) instance;
-	ddi_parea_register(&instance->parea);
-
-	if (!fb_exported) {
-		/*
-		 * We export the kernel framebuffer for uspace usage.
-		 * This is used in the case the uspace framebuffer
-		 * driver is not self-sufficient.
-		 */
-		sysinfo_set_item_val("fb", NULL, true);
-		sysinfo_set_item_val("fb.kind", NULL, 1);
-		sysinfo_set_item_val("fb.width", NULL, instance->xres);
-		sysinfo_set_item_val("fb.height", NULL, instance->yres);
-		sysinfo_set_item_val("fb.scanline", NULL, instance->scanline);
-		sysinfo_set_item_val("fb.visual", NULL, props->visual);
-		sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
-
-		fb_exported = true;
-	}
-
-	fb_redraw(fbdev);
-	return fbdev;
-}
-
-/** @}
- */
Index: rnel/genarch/src/fb/font-8x16.c
===================================================================
--- kernel/genarch/src/fb/font-8x16.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3270 +1,0 @@
-/*
- * Copyright (c) 2000 Dmitry Bolkhovityanov
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <genarch/fb/font-8x16.h>
-
-/** Convert character to font glyph index
- *
- * The font does not cover all Unicode characters.
- * This function converts the character to an appropriate
- * glyph in the font or returns an index to the question
- * mark glyph if no specific glyph exists.
- */
-uint16_t fb_font_glyph(const char32_t ch)
-{
-	if (ch == 0x0000)
-		return 0;
-
-	if ((ch >= 0x0020) && (ch <= 0x007f))
-		return (ch - 32);
-
-	if ((ch >= 0x00a0) && (ch <= 0x021f))
-		return (ch - 64);
-
-	if ((ch >= 0x0222) && (ch <= 0x0233))
-		return (ch - 66);
-
-	if ((ch >= 0x0250) && (ch <= 0x02ad))
-		return (ch - 94);
-
-	if ((ch >= 0x02b0) && (ch <= 0x02cf))
-		return (ch - 96);
-
-	if ((ch >= 0x02d8) && (ch <= 0x02dd))
-		return (ch - 104);
-
-	if (ch == 0x02ee)
-		return 630;
-
-	if ((ch >= 0x0300) && (ch <= 0x0301))
-		return (ch - 137);
-
-	if (ch == 0x0303)
-		return 633;
-
-	if (ch == 0x0309)
-		return 634;
-
-	if ((ch >= 0x0312) && (ch <= 0x0314))
-		return (ch - 151);
-
-	if (ch == 0x0323)
-		return 638;
-
-	if ((ch >= 0x0340) && (ch <= 0x0341))
-		return (ch - 193);
-
-	if ((ch >= 0x0374) && (ch <= 0x0375))
-		return (ch - 243);
-
-	if (ch == 0x037a)
-		return 643;
-
-	if (ch == 0x037e)
-		return 644;
-
-	if ((ch >= 0x0384) && (ch <= 0x038a))
-		return (ch - 255);
-
-	if (ch == 0x038c)
-		return 652;
-
-	if ((ch >= 0x038e) && (ch <= 0x03a1))
-		return (ch - 257);
-
-	if ((ch >= 0x03a3) && (ch <= 0x03ce))
-		return (ch - 258);
-
-	if ((ch >= 0x03d0) && (ch <= 0x03d7))
-		return (ch - 259);
-
-	if ((ch >= 0x03da) && (ch <= 0x03f3))
-		return (ch - 261);
-
-	if ((ch >= 0x0400) && (ch <= 0x0486))
-		return (ch - 273);
-
-	if ((ch >= 0x0488) && (ch <= 0x04ce))
-		return (ch - 274);
-
-	if ((ch >= 0x04d0) && (ch <= 0x04f5))
-		return (ch - 275);
-
-	if ((ch >= 0x04f8) && (ch <= 0x04f9))
-		return (ch - 277);
-
-	if ((ch >= 0x0500) && (ch <= 0x050f))
-		return (ch - 283);
-
-	if ((ch >= 0x0530) && (ch <= 0x0556))
-		return (ch - 315);
-
-	if ((ch >= 0x0559) && (ch <= 0x055f))
-		return (ch - 317);
-
-	if ((ch >= 0x0561) && (ch <= 0x0587))
-		return (ch - 318);
-
-	if ((ch >= 0x0589) && (ch <= 0x058a))
-		return (ch - 319);
-
-	if ((ch >= 0x0591) && (ch <= 0x05a1))
-		return (ch - 325);
-
-	if ((ch >= 0x05a3) && (ch <= 0x05b9))
-		return (ch - 326);
-
-	if ((ch >= 0x05bb) && (ch <= 0x05c4))
-		return (ch - 327);
-
-	if ((ch >= 0x05d0) && (ch <= 0x05ea))
-		return (ch - 338);
-
-	if ((ch >= 0x05f0) && (ch <= 0x05f4))
-		return (ch - 343);
-
-	if (ch == 0x060c)
-		return 1182;
-
-	if (ch == 0x061b)
-		return 1183;
-
-	if (ch == 0x061f)
-		return 1184;
-
-	if ((ch >= 0x0621) && (ch <= 0x063a))
-		return (ch - 384);
-
-	if ((ch >= 0x0640) && (ch <= 0x0655))
-		return (ch - 389);
-
-	if ((ch >= 0x0660) && (ch <= 0x066d))
-		return (ch - 399);
-
-	if ((ch >= 0x0670) && (ch <= 0x06ed))
-		return (ch - 401);
-
-	if ((ch >= 0x06f0) && (ch <= 0x06fe))
-		return (ch - 403);
-
-	if (ch == 0x10d3)
-		return 1388;
-
-	if (ch == 0x10d7)
-		return 1389;
-
-	if (ch == 0x10da)
-		return 1390;
-
-	if (ch == 0x10dd)
-		return 1391;
-
-	if (ch == 0x10e6)
-		return 1392;
-
-	if ((ch >= 0x1e00) && (ch <= 0x1e9b))
-		return (ch - 6287);
-
-	if ((ch >= 0x1ea0) && (ch <= 0x1ef9))
-		return (ch - 6291);
-
-	if ((ch >= 0x1f00) && (ch <= 0x1f07))
-		return (ch - 6297);
-
-	if ((ch >= 0x2000) && (ch <= 0x2027))
-		return (ch - 6545);
-
-	if ((ch >= 0x2030) && (ch <= 0x2046))
-		return (ch - 6553);
-
-	if ((ch >= 0x2048) && (ch <= 0x204d))
-		return (ch - 6554);
-
-	if (ch == 0x2070)
-		return 1716;
-
-	if ((ch >= 0x2074) && (ch <= 0x208f))
-		return (ch - 6591);
-
-	if ((ch >= 0x20a0) && (ch <= 0x20af))
-		return (ch - 6607);
-
-	if ((ch >= 0x2100) && (ch <= 0x213a))
-		return (ch - 6687);
-
-	if ((ch >= 0x2153) && (ch <= 0x2183))
-		return (ch - 6711);
-
-	if ((ch >= 0x2190) && (ch <= 0x21f3))
-		return (ch - 6723);
-
-	if ((ch >= 0x2200) && (ch <= 0x22f1))
-		return (ch - 6735);
-
-	if (ch == 0x2300)
-		return 2211;
-
-	if (ch == 0x2302)
-		return 2212;
-
-	if ((ch >= 0x2308) && (ch <= 0x230b))
-		return (ch - 6755);
-
-	if (ch == 0x2310)
-		return 2217;
-
-	if (ch == 0x2318)
-		return 2218;
-
-	if ((ch >= 0x231a) && (ch <= 0x231b))
-		return (ch - 6767);
-
-	if ((ch >= 0x2320) && (ch <= 0x2321))
-		return (ch - 6771);
-
-	if ((ch >= 0x2329) && (ch <= 0x232a))
-		return (ch - 6778);
-
-	if ((ch >= 0x239b) && (ch <= 0x23bd))
-		return (ch - 6890);
-
-	if (ch == 0x23ce)
-		return 2260;
-
-	if ((ch >= 0x2409) && (ch <= 0x240d))
-		return (ch - 6964);
-
-	if ((ch >= 0x2423) && (ch <= 0x2424))
-		return (ch - 6985);
-
-	if (ch == 0x2426)
-		return 2268;
-
-	if ((ch >= 0x2500) && (ch <= 0x2595))
-		return (ch - 7203);
-
-	if ((ch >= 0x25a0) && (ch <= 0x25f7))
-		return (ch - 7213);
-
-	if ((ch >= 0x2600) && (ch <= 0x2602))
-		return (ch - 7221);
-
-	if ((ch >= 0x2605) && (ch <= 0x260d))
-		return (ch - 7223);
-
-	if ((ch >= 0x2610) && (ch <= 0x2613))
-		return (ch - 7225);
-
-	if (ch == 0x2620)
-		return 2523;
-
-	if (ch == 0x2622)
-		return 2524;
-
-	if (ch == 0x2626)
-		return 2525;
-
-	if ((ch >= 0x2628) && (ch <= 0x262b))
-		return (ch - 7242);
-
-	if ((ch >= 0x262e) && (ch <= 0x2637))
-		return (ch - 7244);
-
-	if ((ch >= 0x2639) && (ch <= 0x2653))
-		return (ch - 7245);
-
-	if ((ch >= 0x2660) && (ch <= 0x2667))
-		return (ch - 7257);
-
-	if ((ch >= 0x2669) && (ch <= 0x266f))
-		return (ch - 7258);
-
-	if ((ch >= 0xfb00) && (ch <= 0xfb05))
-		return (ch - 61674);
-
-	if ((ch >= 0xfb50) && (ch <= 0xfbb1))
-		return (ch - 61748);
-
-	if ((ch >= 0xfbd3) && (ch <= 0xfbe9))
-		return (ch - 61781);
-
-	if ((ch >= 0xfbfc) && (ch <= 0xfbff))
-		return (ch - 61799);
-
-	if ((ch >= 0xfc5b) && (ch <= 0xfc63))
-		return (ch - 61890);
-
-	if (ch == 0xfc90)
-		return 2722;
-
-	if ((ch >= 0xfcf2) && (ch <= 0xfcf4))
-		return (ch - 62031);
-
-	if ((ch >= 0xfd3c) && (ch <= 0xfd3f))
-		return (ch - 62102);
-
-	if (ch == 0xfdf2)
-		return 2730;
-
-	if ((ch >= 0xfe50) && (ch <= 0xfe52))
-		return (ch - 62373);
-
-	if ((ch >= 0xfe54) && (ch <= 0xfe66))
-		return (ch - 62374);
-
-	if ((ch >= 0xfe68) && (ch <= 0xfe6b))
-		return (ch - 62375);
-
-	if ((ch >= 0xfe70) && (ch <= 0xfe72))
-		return (ch - 62379);
-
-	if (ch == 0xfe74)
-		return 2760;
-
-	if ((ch >= 0xfe76) && (ch <= 0xfefc))
-		return (ch - 62381);
-
-	if (ch == 0xfeff)
-		return 2896;
-
-	return 2898;
-}
-
-uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0xa1, 0xa1, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x44, 0xba, 0xb2, 0xaa, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x30, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf6, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x3c, 0x42, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7a, 0xc4, 0xce, 0xce, 0xd6, 0xd6, 0xe6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x66, 0x66, 0x66, 0x66, 0xec, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0x1c, 0x3c, 0x06, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xc4, 0xce, 0xd6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x3e, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x10, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xff, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7e, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x3c, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x3c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf7, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7b, 0x7b, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0xee, 0x66, 0x66, 0x66, 0x66, 0x66, 0xf6, 0x06, 0x66, 0x3c, 0x00 },
-	{ 0x08, 0x1c, 0x22, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x0e, 0x1b, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x30, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x66, 0x66, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x36, 0x36, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x78, 0xe0, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x1e, 0x78, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x60, 0xc0, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6e, 0xd8, 0xd8, 0xd8, 0xde, 0xd8, 0xd8, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd6, 0xd6, 0xde, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x10, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0xfc, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x78, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x78, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xb3, 0xb3, 0x33, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x64, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xe6, 0xe6, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xe0, 0xe0, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x06, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x3e, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x7e, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xb6, 0xb3, 0x33, 0x33, 0x33, 0x33, 0x33, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x4c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x4c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x18, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xcc, 0x8c, 0x2c, 0x3c, 0x2c, 0x0c, 0x8c, 0xcc, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc2, 0xc0, 0x78, 0xc0, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x32, 0x30, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, 0x00 },
-	{ 0x00, 0x03, 0x3e, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x38, 0x6c, 0x38, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x6d, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc8, 0x38, 0x70, 0xd0, 0x38, 0x38, 0x6c, 0x64, 0xc6, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0xec, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x73, 0xdf, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x03, 0x03, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xdf, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x03, 0x03, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xb3, 0xb3, 0x33, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x78, 0x6c, 0x6c, 0xe6, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x38, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x0c, 0x38, 0x60, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x62, 0x30, 0x18, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x0c, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xfe, 0x9a, 0x58, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00 },
-	{ 0x03, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0xb3, 0xb3, 0x33, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x7e, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0xfc, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x7c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc0, 0x60, 0x30, 0x18, 0x7c, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0x60, 0x30, 0x78, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x7c, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x7e, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x60, 0x60, 0x78, 0x0c, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x60, 0x78, 0x0c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x18, 0x4c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x70, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1b, 0x0e, 0x04, 0xf7, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf5, 0xda, 0xd8, 0xdf, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3d, 0x1a, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xcb, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf3, 0x63, 0x60, 0x67, 0x63, 0x63, 0x63, 0x67, 0x6f, 0xff, 0x03, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe3, 0x63, 0x60, 0x67, 0x63, 0x63, 0x63, 0x63, 0x63, 0xf3, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xfb, 0xfb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xf8, 0xff, 0xfb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xb7, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x78, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x28, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x78, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x30, 0x30, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xdf, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x3e, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0x0c, 0x18, 0x30, 0x7c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x1b, 0x0e, 0x04, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xf7, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xda, 0xdc, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0xd8, 0xd8, 0xdf, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xdb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x70, 0x60, 0x60, 0x60, 0x60, 0xe0, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x38, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x38, 0x6c, 0x38, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7a, 0xc4, 0xce, 0xce, 0xd6, 0xe6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7a, 0xc4, 0xce, 0xd6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x3c, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x1c, 0x74, 0x06, 0x06, 0x06, 0x06, 0x1c, 0xf0, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0e, 0x3c, 0x06, 0x06, 0x1c, 0xf0, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc0, 0xfc, 0x06, 0x0c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc0, 0xfc, 0x06, 0x0c, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x3c, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x5c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xdc, 0xe6, 0x7c, 0x80, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0d, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x0d, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x6c, 0x8e, 0x16, 0x26, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xcd, 0x0d, 0x38, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xdc, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x06, 0x06, 0x1f, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x46, 0x6c, 0x2c, 0x2c, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x64, 0x28, 0x38, 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x6c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x7b, 0xde, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x78, 0x58, 0x3e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x7f, 0x63, 0x66, 0x6c, 0x7e, 0x63, 0xf3, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xd8, 0xd8, 0xde, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x6c, 0x0c, 0x0d, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xfc, 0xc0, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x19, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x98, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x19, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x98, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xd6, 0xd6, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x06, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x66, 0xcb, 0xfe, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x7e, 0xc7, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0x70, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc3, 0xc3, 0xdb, 0xdb, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x76, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x7e, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7e, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xcc, 0x6c, 0x3c, 0x3c, 0x6c, 0xcc, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x1c, 0x18, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0x70, 0x30, 0xfc, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xdb, 0xdb, 0xde, 0xde, 0xdb, 0x6b, 0x03, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xdb, 0xdd, 0x6f, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x60, 0x60, 0xf6, 0x6d, 0x6c, 0x66, 0x63, 0x6b, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x26, 0x6d, 0x6c, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x3c, 0x0c, 0x2c, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x60, 0x60, 0xf6, 0x6d, 0x6c, 0x6c, 0x6e, 0x6d, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xc0, 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x03, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6d, 0x6c, 0x66, 0x63, 0x6b, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6f, 0x6b, 0x63, 0x66, 0x6c, 0x6d, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0x7c, 0x6c, 0x28, 0xc6, 0xd6, 0x7c, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xf0, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xf0, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xb0, 0xd8, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0xd8, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0xd8, 0x68, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xd8, 0xd8, 0xf0, 0xd8, 0xd8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xd6, 0x7c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0x78, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xc0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x70, 0xc0, 0x70, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x70, 0x18, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x20, 0x70, 0x70, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xd8, 0xd8, 0x70, 0x70, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x6c, 0x6c, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 },
-	{ 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x34, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3e, 0x32, 0x30, 0x34, 0x3c, 0x34, 0x30, 0x30, 0x32, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x33, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x36, 0x36, 0x77, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x82, 0x44, 0x7c, 0x44, 0x00, 0x82, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x62, 0x30, 0x18, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x92, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x46, 0x6c, 0x2c, 0x2c, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x30, 0x18, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x46, 0x7c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x20, 0x30, 0x10, 0x38, 0x38, 0x6c, 0x64, 0xc6, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf6, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x66, 0x6c, 0x3c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x3c, 0x30, 0x60, 0x3c, 0x60, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x46, 0x2c, 0x2c, 0x18, 0x30, 0x68, 0x68, 0xc4, 0xc2, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x6c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x36, 0x1e, 0xc6, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc2, 0x65, 0x24, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x21, 0x32, 0x12, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc2, 0x65, 0x24, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xa6, 0x2c, 0x38, 0x68, 0xca, 0xc4, 0x0c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x3c, 0x06, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x32, 0x30, 0x30, 0x3c, 0x34, 0x30, 0x30, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x60, 0x30, 0x30, 0x60, 0x63, 0xff, 0xc6, 0x06, 0x0c, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x60, 0x60, 0xfe, 0xfe, 0x0c, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xac, 0x26, 0x26, 0x0b, 0x0b, 0x1b, 0x1b, 0x1b, 0x1b, 0x03, 0x02, 0x04, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x30, 0x18, 0x28, 0x4c, 0x14, 0x24, 0x06, 0x02, 0x02, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6d, 0x03, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6d, 0x03, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xd6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x36, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x76, 0x9c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x7c, 0xd6, 0x66, 0x06, 0x06, 0x66, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x3c, 0x60, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x26, 0x1c, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0x68, 0x38, 0x30, 0x38, 0x38, 0x4c, 0x4c, 0x86, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0xba, 0x30, 0x38, 0x28, 0x4c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xc0, 0xcc, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xdc, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x7e, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x1c, 0x18, 0x7e, 0x58, 0x18, 0x18, 0x18, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xa6, 0x2c, 0x38, 0x68, 0xca, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc0, 0x60, 0x3c, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xb2, 0x30, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x03, 0x06, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xf8, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xd8, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xb2, 0x30, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x38, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0xc6, 0x82, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfe, 0x06, 0x02, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xff, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xb0, 0xb0, 0x30, 0x3c, 0x36, 0x36, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x3e, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x9c, 0xb6, 0xb6, 0xb6, 0xf6, 0xb6, 0xb6, 0xb6, 0xb6, 0x9c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0xcc, 0x7c, 0x6c, 0x6c, 0x6c, 0x6c, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x7c, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0xc6, 0x82, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfe, 0x06, 0x02, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xff, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xb0, 0x30, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xb6, 0xb6, 0xf6, 0xb6, 0xb6, 0x9c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0x7c, 0x6c, 0x6c, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xf8, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x38, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0xfc, 0xb4, 0x30, 0x3c, 0x36, 0x36, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x30, 0xfc, 0xb4, 0x30, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xce, 0xdb, 0xd9, 0xd8, 0xfe, 0xd8, 0xd8, 0xd9, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xdb, 0xd8, 0xfe, 0xd8, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0x6c, 0xfe, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x6c, 0x7c, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x88, 0x8c, 0x9c, 0x96, 0xf6, 0xb6, 0xbf, 0xab, 0xeb, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x8c, 0x9c, 0xf6, 0xbe, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x6c, 0x6c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x6c, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xa3, 0xb2, 0x96, 0xfc, 0x9c, 0xbe, 0xaa, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xa3, 0x96, 0xfe, 0xab, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0x06, 0x06, 0x7c, 0x06, 0x06, 0x06, 0x7c, 0xc0, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0x86, 0x06, 0x7c, 0x06, 0x06, 0x7c, 0xc0, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x96, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x96, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc2, 0xc6, 0xc6, 0xc4, 0xcc, 0x6c, 0x68, 0x78, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x64, 0x6c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xc2, 0xc6, 0xc4, 0xc4, 0x6c, 0x68, 0x78, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xc2, 0xc6, 0x64, 0x6c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xd8, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6f, 0x03, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6f, 0x03, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x10, 0x7c, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x7c, 0x40, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x40, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x54, 0x00, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x54, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x3c, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0x78, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x3c, 0x0f, 0x18, 0x18, 0xf0, 0x3c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x24, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x7c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0xc3, 0x00, 0x66, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x50, 0x46, 0x00, 0x82, 0x41, 0x00, 0x62, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xf0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x6e, 0x64, 0x7a, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x6e, 0x64, 0x7a, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x02, 0x06, 0xfe, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x06, 0xfe, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0xf8, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0xf8, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xf6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x78, 0x6c, 0x66, 0xf6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xdc, 0xf8, 0xdc, 0xd6, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xdc, 0xf8, 0xdc, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0xf6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0xf0, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf3, 0xb3, 0xb3, 0x36, 0x3c, 0x3c, 0x36, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0xb6, 0xbc, 0x3c, 0x36, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdf, 0xdb, 0xd9, 0xd8, 0xf8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, 0xdb, 0xd9, 0xf8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xd8, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x0b, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xdb, 0x03, 0x0b, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc2, 0xcc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc2, 0xcc, 0xd6, 0xd6, 0xcc, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0c, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0c, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0x7e, 0x16, 0x16, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0x7e, 0x16, 0x16, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0xb3, 0xb3, 0x7f, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0xb3, 0x7f, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0xb3, 0xb3, 0x7f, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0xb3, 0x7f, 0x30, 0x30, 0x33, 0x1e, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0e, 0x0c, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x0e, 0x0c, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x3e, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x7c, 0xcd, 0xcd, 0xcd, 0xcd, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcd, 0xcd, 0xcd, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x8c, 0x0c, 0x38, 0x0d, 0x0d, 0x0d, 0x0d, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0x0c, 0x39, 0x0d, 0x0d, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0x6d, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xcd, 0xcd, 0xcd, 0xcd, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xfd, 0xcd, 0xcd, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xce, 0xc6, 0xc6, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x1b, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x64, 0x94, 0xba, 0x52, 0x4c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x7b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x7e, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0xd8, 0xfe, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xcf, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xf6, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x7f, 0x24, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xf0, 0x3c, 0x0e, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x6c, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x30, 0x60, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcf, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x7c, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x60, 0x60, 0x60, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x6c, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x16, 0x16, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x76, 0x1e, 0x0e, 0x0c, 0xd8, 0xfe, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x30, 0x18, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x63, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xfe, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd0, 0xd0, 0xd0, 0x7c, 0x16, 0x16, 0x16, 0xd6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x3c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x0c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xcf, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xca, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x38, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x1c, 0x0c, 0x18, 0x3c, 0x64, 0x66, 0x62, 0x63, 0x3d, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x18, 0x30, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0f, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x76, 0x1c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0xdc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x76, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xfe, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd0, 0xd0, 0x7c, 0x16, 0x16, 0x16, 0x16, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0x77, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x6c },
-	{ 0x18, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x38, 0x10, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x60, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0c, 0x00 },
-	{ 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x74, 0xd6, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x18, 0x30, 0x00 },
-	{ 0x0c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1b, 0x36, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x44, 0xaa, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x0a, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x50, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x6c, 0xd8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x08, 0x30 },
-	{ 0x60, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0xa0, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0x10, 0x10 },
-	{ 0x18, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x03, 0x00 },
-	{ 0x48, 0xa8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x33, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x60, 0x66, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18 },
-	{ 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x18, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x66, 0x76, 0xdc, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x36, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0xd6, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x66, 0x66, 0x66, 0x2c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x4c, 0xcc, 0xcc, 0xec, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x46, 0xc6, 0xc6, 0xe6, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x6c, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x34, 0x18, 0x0c, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x66, 0x64, 0x6c, 0x6e, 0x60, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xf6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0xc6, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x22, 0x20, 0x10, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x3c, 0x40, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x20, 0x1c, 0x20, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x28, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x40, 0x30, 0x4e, 0x49, 0x39, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x24, 0x00 },
-	{ 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x12, 0xca, 0x2c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0a, 0x2a, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x7e, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x10, 0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x0c, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x70, 0x70, 0x38, 0x18, 0x18, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0xfc, 0xf8, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4a, 0xfe, 0xf4, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x20, 0x40, 0x30, 0x10, 0x20, 0x42, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x2c, 0x44, 0x42, 0x82, 0x82, 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xf8, 0x78, 0x08, 0x08, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x82, 0xc6, 0xc6, 0x6c, 0x28, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x28, 0x6c, 0xc6, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xf8, 0x88, 0xf8, 0x78, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x91, 0x92, 0x64, 0x08, 0x10, 0x26, 0x49, 0x89, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x18, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0xfe, 0x7c, 0x38, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x28, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x06, 0x28, 0x5e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x07, 0x08, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x04, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x54, 0x33, 0x24, 0x40, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x04, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00 },
-	{ 0x06, 0x08, 0x06, 0x08, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x08, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x94, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x88, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x94, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x08, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x1c, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x14, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x12, 0x04, 0x18, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x15, 0x88, 0x88, 0x8a, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x88, 0x90, 0x65, 0x00, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x00, 0x0a, 0x00, 0x01, 0x15, 0x88, 0x88, 0x90, 0x65, 0x00, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x90, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x2a, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x00, 0x50, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x20, 0x40, 0x3e, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x05, 0x0b, 0x48, 0x84, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x29, 0x01, 0x19, 0x21, 0x19, 0xa1, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x05, 0x0b, 0x48, 0x84, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x44, 0x09, 0xa2, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x08, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x02, 0x2a, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x14, 0x00, 0x08, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x08, 0x14, 0x08, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x40, 0x38, 0x40, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x40, 0x38, 0x40, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x12, 0x2c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x20, 0x47, 0x88, 0x08, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x50, 0x20, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x08, 0x00, 0x08 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x14, 0x00, 0x08 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x80, 0x60, 0x80, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x40, 0x43, 0x55, 0x7e, 0x80, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x2a, 0x20, 0x26, 0x2a, 0x7c, 0x80, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0e, 0x1c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x14, 0x08, 0x14, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x2c, 0x10, 0x28, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x15, 0x8a, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x5a, 0xa5, 0x66, 0x5b, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x5a, 0x66, 0xa5, 0x5a, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x66, 0x42, 0x42, 0x81, 0x99, 0x99, 0x81, 0x42, 0x42, 0x66, 0x18, 0x00, 0x00 },
-	{ 0x08, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x26, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x8a, 0x90, 0x60 },
-	{ 0x32, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x0c, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x40, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x30, 0x40, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x54, 0xaa, 0x92, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x82, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x14, 0x08 },
-	{ 0x08, 0x14, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x10, 0x10, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x70, 0x70, 0x38, 0x18, 0x18, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0xfc, 0xf8, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4a, 0xfe, 0xf4, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4e, 0xf0, 0xfe, 0x7c, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x38, 0x2c, 0x44, 0x42, 0x82, 0x92, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x60, 0x7e, 0x3c, 0x30, 0x60, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x82, 0xc6, 0xc6, 0x6c, 0x28, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x28, 0x6c, 0xc6, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xf8, 0x88, 0xf8, 0x78, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x88, 0x88, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x54, 0x54, 0x54, 0x54, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x4c, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0xaa, 0xaa, 0xaa, 0x82, 0x82, 0x40, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x82, 0x82, 0x44, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x82, 0x82, 0x40, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0x38 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x38, 0x6c, 0x38 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0c, 0xec, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x0c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x38, 0x6c, 0x64, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x30, 0xe0, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x0c, 0x18, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0c, 0xec, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x60, 0x6c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0x70, 0x1c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x44, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0x70, 0x1c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x44, 0x38, 0x10, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x16, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x08, 0x1c, 0x36, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x6c, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x6c, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x72, 0x9c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x76, 0xdc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0xcc, 0x00, 0xfc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x18, 0x0c, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x38, 0x6c, 0x64, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x16, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x16, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x68, 0x1c, 0x36, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x68, 0x1c, 0x36, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x28, 0x54, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x0c, 0x18, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x08, 0x54, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x08, 0x54, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x72, 0x9c, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x72, 0x9c, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x76, 0x88, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x26, 0x70, 0xd8, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc4, 0x6e, 0x11, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x64, 0x0e, 0x1b, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x76, 0x88, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x26, 0x70, 0xd8, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc4, 0x6e, 0x11, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x64, 0x0e, 0x1b, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x28, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x18, 0x33, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1b, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x33, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x1b, 0x33, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x1b, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0xb3, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x68, 0xb3, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x18, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x33, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1b, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x33, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x1b, 0x33, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x1b, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0xb3, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x68, 0xb3, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x0c, 0x18, 0xf6, 0x06, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x3a, 0x5c, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x6c, 0xc6, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xcc, 0x66, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x66, 0xcc, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc6, 0x6c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x34, 0x58, 0x0c, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x34, 0x58, 0x30, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xfe, 0x00, 0xa4, 0xaa, 0xea, 0xea, 0xa6, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xa4, 0xea, 0xaa, 0xaa, 0xa6, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x8a, 0xce, 0x8e, 0xea, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x8e, 0xca, 0x8a, 0xea, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xca, 0x2e, 0x4a, 0x2a, 0xca, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xaa, 0xae, 0xea, 0x2a, 0x2a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x6a, 0x8e, 0xca, 0xaa, 0x4a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x38, 0x20, 0x30, 0x20, 0x20, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x30, 0x28, 0x30, 0x20, 0x20, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x4a, 0x4e, 0x4a, 0x4a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0xa2, 0xa2, 0xe2, 0xea, 0xa4, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x80, 0x80, 0x80, 0xf0, 0x28, 0x30, 0x28, 0x0a, 0x0e, 0x0e, 0x0a, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xc0, 0xa0, 0xc0, 0xa0, 0x20, 0x20, 0x38, 0x0a, 0x0e, 0x0e, 0x0a, 0x00, 0xfe, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x9c, 0xd2, 0xbc, 0x92, 0x9c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xfe, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x00, 0xcc, 0xcc, 0xcc, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38, 0x3c, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x92, 0x44, 0x28, 0x92, 0x28, 0x44, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xc3, 0xdb, 0x1b, 0x1e, 0x1c, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x7c, 0x00, 0x00 },
-	{ 0x7c, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00, 0x44, 0xee, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7b, 0xcf, 0xcf, 0x1b, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xde, 0xf3, 0xf3, 0xc6, 0xcc, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x06, 0x06, 0x0c, 0x0c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xdb, 0xdb, 0xdb, 0xde, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3e, 0x72, 0xf2, 0xf2, 0xf2, 0x72, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x9c, 0x9e, 0x9e, 0x9e, 0x9c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x38, 0x78, 0xd8, 0xfc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xf8, 0xc0, 0xf0, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x78, 0xc0, 0xf0, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xf8, 0xd8, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0xd8, 0x78, 0x18, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x60, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xb0, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0xd8, 0xfc, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xf0, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xc0, 0xf0, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xd8, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xd8, 0x78, 0x18, 0xf0, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcf, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x04, 0x7c, 0xce, 0xc8, 0xc8, 0xd0, 0xd0, 0xd0, 0xe0, 0xe6, 0x7c, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xd6, 0xd8, 0xd8, 0xd8, 0xde, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xc0, 0xc0, 0xc0, 0xf0, 0xcd, 0xce, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0xf8, 0x60, 0xf8, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0xec, 0xd6, 0xde, 0xd6, 0xd6, 0xf6, 0xd6, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x76, 0xff, 0x76, 0x6e, 0xff, 0x6e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xe0, 0xf3, 0xd6, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x81, 0x81, 0x81, 0x5a, 0xff, 0x5a, 0xff, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf2, 0x8a, 0xaa, 0xaa, 0xaa, 0xaa, 0xa2, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x3e, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x60, 0xfc, 0x60, 0xf8, 0x60, 0x60, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x78, 0xfe, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x1e, 0x78, 0x1e, 0x78, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x7c, 0xb6, 0x36, 0x33, 0x33, 0x33, 0x63, 0x66, 0xf6, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd0, 0xd2, 0xd6, 0x7c, 0x18, 0x30, 0x6e, 0xd8, 0x98, 0x18, 0x0e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd0, 0xd2, 0xd6, 0x7c, 0x18, 0x30, 0x6e, 0xd8, 0x8c, 0x06, 0x1c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x62, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4e, 0xb9, 0x58, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x7c, 0xda, 0xd8, 0xd8, 0xda, 0x7c, 0x19, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x18, 0x30, 0x6e, 0xdb, 0x9b, 0x1b, 0x0e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x18, 0x30, 0x7b, 0xdb, 0x9b, 0x1b, 0x0d, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc2, 0xc0, 0x78, 0xc0, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x26, 0x3e, 0x26, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0xb9, 0x58, 0x1a, 0x1e, 0x1a, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x66, 0x46, 0x87, 0x8c, 0x8c, 0x7c, 0x98, 0x98, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x52, 0xb5, 0x15, 0x16, 0x2c, 0x34, 0x68, 0xa9, 0xaa, 0x4c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x48, 0xb0, 0x80, 0x48, 0x7c, 0x66, 0x26, 0x26, 0xa6, 0x46, 0x06, 0x34, 0x48, 0x00 },
-	{ 0x00, 0x00, 0xe2, 0xa2, 0xa2, 0xa2, 0xbe, 0xa2, 0xa2, 0xa2, 0xa2, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x36, 0x3b, 0x3b, 0x33, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x1e, 0x18, 0x76, 0x3b, 0x3b, 0x33, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x33, 0x4e, 0x06, 0x06, 0x0c, 0x0c, 0x1f, 0x6c, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x71, 0x8e, 0x04, 0x0c, 0x06, 0x03, 0x63, 0xc3, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x46, 0x49, 0x39, 0x1e, 0x18, 0x30, 0x70, 0xb1, 0xba, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x19, 0x31, 0x32, 0x64, 0x68, 0x70, 0xe1, 0x66, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xff, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe2, 0xa2, 0xb2, 0xb2, 0xaa, 0xaa, 0xa6, 0xa6, 0xa2, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcf, 0xed, 0xff, 0xfc, 0xdf, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0xb9, 0xa5, 0xa5, 0xb9, 0xa1, 0xa1, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x40, 0x8e, 0x93, 0xa3, 0x63, 0x4b, 0x6a, 0xa4, 0xb0, 0xb0, 0x60, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0xa2, 0xa2, 0xa2, 0xa2, 0xbc, 0xa0, 0xa0, 0xa0, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xaa, 0xa6, 0x7e, 0x01, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x4d, 0x4d, 0x19, 0x1e, 0x1c, 0x34, 0x34, 0xb5, 0x62, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x58, 0xa6, 0xa3, 0x6c, 0xb8, 0x26, 0x26, 0x26, 0xa7, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0xa2, 0xa2, 0xa2, 0xa2, 0xbc, 0xb0, 0xa8, 0xa4, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x6d, 0x67, 0x66, 0xee, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x0c, 0xfc, 0xc6, 0xc6, 0xc6, 0xfc, 0xd8, 0xdc, 0xdc, 0xe6, 0xe6, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x71, 0xdb, 0x35, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x52, 0x5a, 0x52, 0x5f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf1, 0x5b, 0x55, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x18, 0xce, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xe6, 0x6c, 0x38, 0x50, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x0a, 0x14, 0x14, 0x28, 0x28, 0x50, 0x50, 0xa0, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x9c, 0x30, 0xfe, 0x0c, 0x18, 0x38, 0x0c, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x26, 0x03, 0x13, 0x0c, 0x13, 0x03, 0x03, 0x66, 0x98, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x2d, 0x2d, 0x1a, 0x1e, 0x1b, 0x31, 0x31, 0xb2, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x6b, 0xc8, 0xcc, 0xc6, 0xc6, 0xcc, 0xc0, 0x63, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xe7, 0xff, 0xe0, 0x67, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x26, 0x44, 0xf8, 0xc0, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4c, 0x52, 0x3c, 0x10, 0x3c, 0x60, 0xc0, 0xc3, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x73, 0xce, 0x18, 0x3a, 0x5c, 0x18, 0x30, 0x30, 0xb0, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x2c, 0x3c, 0x2c, 0x8c, 0xcc, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x12, 0x12, 0x12, 0x16, 0x36, 0x3e, 0x3a, 0x5a, 0x52, 0x91, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x26, 0x46, 0xc6, 0xc4, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0xc6, 0xe7, 0x7a, 0x38, 0x5c, 0xce, 0xe7, 0x63, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xfc, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x7e, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x40, 0x78, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x7e, 0xf2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xfe, 0x7e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x38, 0x00, 0x78, 0x38, 0x38, 0x38, 0x38, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xff, 0x83, 0x86, 0x82, 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0xc6, 0xfc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0xc6, 0xfc, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x70, 0xb2, 0xf6, 0x3c, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0xb0, 0x3c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0xc0, 0xe2, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb0, 0x3c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0x80, 0xe2, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0x30, 0x62, 0x66, 0x6c, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0xce, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x73, 0x23, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x65, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xce, 0xce, 0xce, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0x73, 0x73, 0x73, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x95, 0x95, 0x95, 0x65, 0x65, 0x65, 0x95, 0x95, 0x95, 0x95, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x23, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x05, 0x05, 0x00, 0x95, 0x95, 0x95, 0x95, 0x95, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x15, 0x15, 0x00, 0xb5, 0xb5, 0xb5, 0xb5, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0xdb, 0xdb, 0xce, 0xce, 0xce, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xdb, 0xdb, 0x73, 0x73, 0x73, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x05, 0x05, 0x00, 0x95, 0x95, 0x65, 0x65, 0x95, 0x95, 0x95, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xe6, 0xd6, 0xd6, 0xd6, 0xd6, 0xe6, 0xcc, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0x99, 0xbd, 0xdb, 0xdb, 0xbd, 0x99, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x06, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xb0, 0x18, 0x0c, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0f, 0x07, 0x0d, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x30, 0x18, 0x0d, 0x07, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x0c, 0x18, 0xb0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x62, 0xff, 0x64, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x26, 0xff, 0x46, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x73, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xff, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x36, 0xff, 0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xfc, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x3f, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x63, 0xff, 0x63, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xff, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x33, 0x63, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xcc, 0xc6, 0x7f, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x3b, 0x6b, 0xfe, 0x68, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xdc, 0xd6, 0x7f, 0x16, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x5a, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x6e, 0xff, 0x76, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x60, 0x63, 0xff, 0xc6, 0x16, 0x1c, 0x1c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x66, 0x36, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0xcc, 0xd8, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x36, 0x66, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xd8, 0xcc, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x36, 0x66, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x30, 0xfc, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x0c, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x00, 0xf0, 0xe0, 0xb0, 0x18, 0x0c, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x98, 0xb0, 0xff, 0xb0, 0x98, 0x19, 0x0d, 0xff, 0x0d, 0x19, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x1e, 0x1c, 0x16, 0x03, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x78, 0x38, 0x68, 0xc0, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x1c, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x30, 0x60, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x2e, 0x3f, 0x24, 0x24, 0x24, 0x24, 0xfc, 0x74, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x60, 0xff, 0x60, 0x30, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x7e, 0xff, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0xff, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x00, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x00, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x7f, 0xc4, 0x7f, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x7e, 0xcb, 0x7e, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xfe, 0x23, 0xfe, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7f, 0xc0, 0x7f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x7c, 0xee, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfe, 0x03, 0xfe, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x7e, 0xc3, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x7c, 0xee, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xb0, 0xd8, 0xec, 0xb6, 0x1b, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0f, 0x07, 0x0d, 0x1b, 0x37, 0x6d, 0xd8, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x20, 0x30, 0xd8, 0x6d, 0x37, 0x1b, 0x0d, 0x07, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x0c, 0x1b, 0xb6, 0xec, 0xd8, 0xb0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x60, 0xff, 0x60, 0x3f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xfc, 0x06, 0xff, 0x06, 0xfc, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x6a, 0xff, 0x65, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa6, 0xff, 0x56, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xd5, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x66, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xab, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xb0, 0xff, 0xb0, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x0d, 0xff, 0x0d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x41, 0x81, 0x41, 0x3f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xfc, 0x82, 0x81, 0x82, 0xfc, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x44, 0xc6, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x7c, 0x00, 0x7c, 0x44, 0x7c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x7c, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x54, 0xd6, 0x54, 0x54, 0x54, 0xd6, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x54, 0xee, 0x44, 0xc6, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x54, 0xee, 0x44, 0xc6, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe8, 0xbc, 0x82, 0x81, 0x82, 0xbc, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x80, 0xbc, 0xb8, 0xac, 0x86, 0x83, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x01, 0x81, 0xc1, 0x61, 0x35, 0x1d, 0x3d, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xfe, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x06, 0x06, 0x3e, 0x66, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x7e, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xfe, 0x16, 0x16, 0x16, 0x7e, 0x16, 0x26, 0x26, 0x26, 0xfe, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x3e, 0x66, 0xcf, 0xdb, 0xdb, 0xf3, 0x66, 0x7c, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xc0, 0xfe, 0xc0, 0xc0, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x3e, 0x64, 0xc8, 0xc8, 0xfe, 0xc8, 0xd0, 0x70, 0x3e, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xfe, 0xc0, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x06, 0x06, 0xfe, 0x06, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xf8, 0x1c, 0x16, 0x26, 0xfe, 0x26, 0x26, 0x4c, 0xf8, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x06, 0xfe, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe7, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe7, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x7e, 0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x06, 0x06, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe3, 0x33, 0x66, 0x36, 0xe6, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x33, 0x73, 0xb6, 0xf6, 0x36, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdb, 0xdb, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x0c, 0x1c, 0x34, 0x62, 0xff, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x1a, 0x1c, 0x38, 0x58, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6e, 0x7c, 0xec, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x33, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x2a, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0xa8, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0x99, 0x99, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x33, 0x66, 0x66, 0x66, 0x7e, 0xe7, 0xe7, 0xe7, 0xe7, 0x7e, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x2a, 0x54, 0x54, 0x54, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x54, 0x54, 0x54, 0xa8, 0x00, 0x00 },
-	{ 0x18, 0x34, 0x30, 0x30, 0x38, 0x35, 0x33, 0x37, 0x30, 0x30, 0x30, 0x30, 0xb0, 0x60, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0xfa, 0x5a, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0x5f, 0x5a, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0xfc, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x7e, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x76, 0xdc, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0xdb, 0xdb, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xdb, 0xdb, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x1c, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x76, 0xdc, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0xfe, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0xfe, 0x20, 0xfe, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0x76, 0xdc, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x7c, 0x00, 0x7c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0x00, 0x66, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x00, 0x00, 0xdf, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x00, 0x00, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x28, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x10, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0x28, 0x10, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x10, 0x7c, 0x28, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x44, 0x7c, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x26, 0x7c, 0xb4, 0x6c, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x68, 0x54, 0x54, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x08, 0x10, 0x00, 0x10, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x08, 0x7e, 0x08, 0x10, 0x7e, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x08, 0xfe, 0x08, 0x10, 0xfe, 0x10, 0x20, 0xfe, 0x20, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1b, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x1b, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xce, 0x7c, 0x10, 0x7c, 0xe6, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x76, 0xdc, 0x20, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0x76, 0xdc, 0x80, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x0e, 0x38, 0xe8, 0x38, 0x1e, 0xf0, 0x38, 0x2e, 0x38, 0xe0, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xe8, 0x38, 0x0e, 0x38, 0xf0, 0x1e, 0x38, 0xe0, 0x38, 0x2e, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0xf2, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x9e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x06, 0x0c, 0x38, 0xe8, 0x38, 0x1c, 0x16, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0xd0, 0x70, 0x38, 0x2e, 0x38, 0x60, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x7e, 0xc8, 0xc8, 0xd0, 0xd0, 0x7e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0xfc, 0x16, 0x16, 0x26, 0x26, 0xfc, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x7e, 0xc8, 0xc8, 0xd0, 0xd0, 0x7e, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xfc, 0x16, 0x16, 0x26, 0x26, 0xfc, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x08, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x92, 0xa2, 0xfa, 0xa2, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0xba, 0xba, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0xba, 0x92, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x54, 0x92, 0xfe, 0x92, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0xfe, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0xaa, 0x92, 0xaa, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x8a, 0x92, 0xa2, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xba, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xaa, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x54, 0xd6, 0xba, 0xd6, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0xba, 0x82, 0xba, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0xba, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0xfe, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0xfe, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x92, 0xba, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0xff, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7e, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xdf, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xa8, 0xa8, 0xa8, 0xa8, 0xaf, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xdf, 0xd8, 0xdf, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc2, 0xc4, 0xc4, 0xff, 0xc8, 0xc8, 0xd0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc4, 0xc4, 0xff, 0xc8, 0xff, 0xd0, 0xd0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd9, 0xda, 0xda, 0xdf, 0xda, 0xda, 0xdc, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd9, 0xda, 0xdf, 0xda, 0xdf, 0xda, 0xdc, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0c, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x1e, 0x76, 0xc6, 0x76, 0x1e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xf0, 0xdc, 0xc6, 0xdc, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x1e, 0x76, 0xc6, 0x76, 0x1e, 0x06, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xf0, 0xdc, 0xc6, 0xdc, 0xf0, 0xc0, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xbf, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xfd, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7d, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0xc6, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf0, 0xc8, 0xc4, 0xc4, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0b, 0x13, 0x23, 0x43, 0x83, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x38, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x92, 0x44, 0x28, 0x92, 0x28, 0x44, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0xc4, 0xa8, 0x90, 0xa8, 0xc4, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x46, 0x2a, 0x12, 0x2a, 0x46, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3e, 0x60, 0xce, 0xd8, 0xd8, 0xce, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf8, 0x0c, 0xe6, 0x36, 0x36, 0xe6, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x54, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x64, 0xce, 0x64, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x4c, 0xe6, 0x4c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x15, 0x2a, 0x54, 0xa8, 0x54, 0x2a, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xa8, 0x54, 0x2a, 0x15, 0x2a, 0x54, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf2, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x9e, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x0e, 0x1c, 0xf0, 0x1c, 0x16, 0xf2, 0x1c, 0x26, 0x22, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x88, 0xc8, 0x70, 0x1e, 0x70, 0xd0, 0x9e, 0x70, 0xe0, 0xa0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0xfe, 0xc8, 0xc8, 0xd0, 0xd0, 0xfe, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xfe, 0x16, 0x16, 0x26, 0x26, 0xfe, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x08, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x0e, 0x1e, 0x76, 0xd6, 0x76, 0x1e, 0x26, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xc8, 0xf0, 0xdc, 0xd6, 0xdc, 0xf0, 0xe0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x0e, 0x1e, 0x76, 0xd6, 0x76, 0x1e, 0x26, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xc8, 0xf0, 0xdc, 0xd6, 0xdc, 0xf0, 0xe0, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3d, 0x66, 0xc7, 0xcb, 0xd3, 0xe3, 0x66, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x42, 0xa5, 0x7e, 0x24, 0x24, 0x7e, 0xa5, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x38, 0x54, 0x8a, 0xf6, 0x82, 0x54, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xfe, 0xfe, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x03, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00, 0x00 },
-	{ 0x00, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3f, 0x00, 0x00 },
-	{ 0x00, 0xfc, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xfc, 0x00, 0x00 },
-	{ 0x00, 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0 },
-	{ 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07 },
-	{ 0x00, 0x00, 0xff, 0xc1, 0xc0, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0xc0, 0xc1, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xff, 0x00, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x78, 0x78, 0x38, 0x38, 0x18, 0x18, 0x00, 0x00 },
-	{ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0 },
-	{ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
-	{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x07, 0x05, 0x05, 0x05, 0x05, 0x25, 0x79, 0xc2, 0x7c, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xf8, 0xd8, 0xd8, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x0f, 0x0c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xf8, 0x70, 0x20, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0xc0, 0xe0, 0xc0, 0xc0, 0x0f, 0x0c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xc0, 0xc0, 0xc0, 0x70, 0x1e, 0x1b, 0x1e, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x98, 0xd8, 0xf8, 0xd8, 0xd8, 0x0c, 0x0c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xfe, 0xc6, 0xc6, 0x60, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0e, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80 },
-	{ 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01 },
-	{ 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
-	{ 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc },
-	{ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8 },
-	{ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 },
-	{ 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0 },
-	{ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0 },
-	{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
-	{ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f },
-	{ 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44 },
-	{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa },
-	{ 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77 },
-	{ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0xba, 0xba, 0xba, 0xba, 0xba, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x8a, 0xc6, 0xa2, 0x92, 0x8a, 0xc6, 0xa2, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xa2, 0xc6, 0x8a, 0x92, 0xa2, 0xc6, 0x8a, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x84, 0x84, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x80, 0xc0, 0xa0, 0x90, 0x88, 0x84, 0x88, 0x90, 0xa0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70, 0x78, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70, 0x48, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x98, 0x86, 0x98, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x06, 0x0a, 0x12, 0x22, 0x42, 0x22, 0x12, 0x0a, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x78, 0x38, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x48, 0x38, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x32, 0xc2, 0x32, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x54, 0xba, 0xba, 0x54, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0xbd, 0xbd, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x28, 0x44, 0x82, 0x82, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x40, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0xa5, 0xa5, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x72, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0x72, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x4e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x70, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x70, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xc3, 0xbd, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0xbd, 0xc3, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xc3, 0xbd, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0xbd, 0xc3, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x30, 0x40, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x40, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f, 0xff, 0xff },
-	{ 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff },
-	{ 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80 },
-	{ 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xff, 0xfd, 0xf9, 0xf1, 0xf1, 0xe1, 0xc1, 0x81, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x81, 0x83, 0x87, 0x8f, 0x8f, 0x9f, 0xbf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x74, 0x74, 0xf2, 0xf2, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x5c, 0x5c, 0x9e, 0x9e, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0x92, 0xf2, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0xf2, 0x92, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x9e, 0x92, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0x92, 0x9e, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4a, 0x89, 0x89, 0x89, 0xf9, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0xf9, 0x89, 0x89, 0x89, 0x4a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x9f, 0x91, 0x91, 0x91, 0x52, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x52, 0x91, 0x91, 0x91, 0x9f, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x7c, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x7c, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0xfe, 0x7c, 0x38, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0xee, 0x44, 0x54, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x34, 0x1c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcd, 0xc7, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x92, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0xa5, 0xa5, 0x42, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x42, 0xa5, 0xa5, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x18, 0x30, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x86, 0x8a, 0xba, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0xee, 0xba, 0xba, 0xee, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x82, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x82, 0xaa, 0x82, 0x44, 0x7c, 0x44, 0x38, 0x00, 0x44, 0xc6, 0x38, 0xc6, 0x44, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0xee, 0xfe, 0x92, 0xba, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0xff, 0x18, 0x1e, 0x78, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x10, 0x10, 0x92, 0xfe, 0x92, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x72, 0xe0, 0xc4, 0xdf, 0xce, 0xca, 0xe0, 0x72, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x54, 0x28, 0x54, 0xaa, 0xaa, 0xaa, 0xaa, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0x99, 0x99, 0x99, 0xbd, 0xff, 0xdb, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x85, 0xb1, 0xf9, 0xff, 0xdf, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0x81, 0x99, 0xa5, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xa5, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xdb, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x54, 0x28, 0xc6, 0x28, 0x54, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0x14, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x14, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x28, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x28, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x06, 0x0e, 0x1a, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x03, 0x7b, 0xcf, 0xcf, 0xcf, 0x0f, 0x1b, 0x33, 0xff, 0x03, 0x03, 0x03, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf0, 0x60, 0x6e, 0x73, 0x63, 0x63, 0x66, 0x66, 0x63, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0x54, 0x54, 0x7c, 0x54, 0x54, 0xd6, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0xdb, 0xdb, 0xdb, 0xdb, 0x7e, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0xa5, 0xa5, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc3, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7e, 0xc3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xdb, 0xd8, 0x70, 0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x33, 0x1b, 0x7b, 0xdb, 0xdb, 0x73, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x94, 0x7c, 0x55, 0x57, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x06, 0x0b, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x24, 0xe7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x94, 0x7c, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x04, 0x03, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1f, 0x07, 0x8f, 0xdb, 0x73, 0x70, 0xd8, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x90, 0x50, 0x70, 0x68, 0x48, 0x48, 0x4e, 0x49, 0x09, 0x0e, 0x10, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x2a, 0x7e, 0xaa, 0x00, 0x00, 0x2a, 0x7e, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0x66, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x81, 0x81, 0x66, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x24, 0x3c, 0xe7, 0xa5, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x38, 0x78, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x3c, 0x3e, 0x32, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x7f, 0x6f, 0x63, 0x63, 0x63, 0x63, 0xe3, 0xe7, 0xc7, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0xe7, 0xe7, 0xc6, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xde, 0xe6, 0xc4, 0xd8, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x40, 0x40, 0x44, 0x5c, 0x74, 0x44, 0x44, 0x5c, 0x74, 0x44, 0x04, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x46, 0x5c, 0x74, 0xc4, 0x46, 0x5c, 0x74, 0xc4, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3b, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6e, 0x66, 0x60, 0xfe, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6e, 0x66, 0x66, 0xfe, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6e, 0xdb, 0xdb, 0xd8, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6f, 0xdb, 0xdb, 0xdb, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x6f, 0x6c, 0x6c, 0x6c, 0x6c, 0x6d, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x88, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x88, 0x80, 0x88, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x94, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x94, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x94, 0x80, 0x88, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x94, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x94, 0x80, 0x94, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x28, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x28, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x28, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x28, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa2, 0x0c, 0x13, 0x0c, 0x10, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa2, 0x0c, 0x13, 0x0c, 0x10, 0x10, 0x08, 0x04, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x00, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x40, 0x38, 0x40, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x80, 0x70, 0x80, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0x10, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf7, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3d, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3d, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x80, 0x70, 0x80, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x00, 0x07, 0x18, 0x20, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x29, 0x01, 0x19, 0x21, 0x19, 0xa1, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x2a, 0x02, 0x32, 0x42, 0x32, 0xc6, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x00, 0xa3, 0x0c, 0x10, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x00, 0xa3, 0x0c, 0x10, 0x10, 0x08, 0x04, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x54, 0x33, 0x24, 0x40, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x10, 0x00, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x10, 0x00, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x20, 0x20, 0x20, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x98, 0x60, 0xc2, 0x12, 0x92, 0x9c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x92, 0x9c, 0x60, 0x0e, 0x70, 0x0e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x60, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x10, 0x60, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x54, 0x58, 0x20, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0xf0, 0x02, 0x92, 0x9c, 0x60, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x60, 0x02, 0x92, 0x9c, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x12, 0x9c, 0x60, 0x0e, 0x70, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x50, 0x28, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x28, 0x14, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x08, 0x10, 0x54, 0x38, 0x54, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x10, 0x08, 0x2a, 0x1c, 0x2a, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x2a, 0x14, 0x00, 0x21, 0x69, 0xa9, 0x69, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x20, 0x10, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x04, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2a, 0x24, 0x1a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x38, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x30, 0x18, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x08, 0x08, 0x10, 0x10, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x54, 0x58, 0x40, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x18, 0x60, 0x06, 0x18, 0x60, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x12, 0xca, 0x2c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x14, 0x18, 0x60, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x06, 0x18, 0x60, 0x00, 0x00 },
-	{ 0x0a, 0x2a, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x12, 0x92, 0x9c, 0x60, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x3c, 0x40, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x3e, 0x40, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x20, 0x1c, 0x20, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x10, 0x0e, 0x10, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x0c, 0x10, 0x0e, 0x10, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x0c, 0x10, 0x0e, 0x10, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x28, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x50, 0x00, 0x10, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x88, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x01, 0x15, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2a, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0x22, 0x41, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x10, 0x10, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0x22, 0x41, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x0e, 0x10, 0x10, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x00, 0x06, 0x09, 0x49, 0x87, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x32, 0x42, 0x32, 0x42, 0x02, 0x86, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3c, 0x4b, 0x4a, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x32, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x32, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x40, 0x30, 0x4e, 0x49, 0x39, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x24, 0x28, 0xf3, 0x24, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x24, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x24, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0x90, 0x02, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0x90, 0x02, 0x32, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x80, 0x72, 0xa2, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x40, 0x3a, 0x52, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00 },
-	{ 0x00, 0x00, 0x22, 0x12, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00 },
-	{ 0x00, 0x00, 0x42, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x22, 0x12, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xf1, 0x35, 0x55, 0x8a, 0xe0, 0x06, 0x95, 0xd6, 0xb5, 0x97, 0x00, 0xee, 0x8a, 0xee, 0x28, 0xe8 },
-	{ 0x00, 0x38, 0x7c, 0x7c, 0xc6, 0x92, 0xf2, 0xe6, 0xfe, 0xe6, 0x7c, 0x7c, 0x38, 0x00, 0x00, 0x00 },
-
-	/* Special glyph for unknown character */
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
-};
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/kbrd.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,208 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Keyboard processing.
- */
-
-#include <assert.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/kbrd/scanc.h>
-
-#ifdef CONFIG_PC_KBD
-#include <genarch/kbrd/scanc_pc.h>
-#endif
-
-#ifdef CONFIG_SUN_KBD
-#include <genarch/kbrd/scanc_sun.h>
-#endif
-
-#ifdef CONFIG_MAC_KBD
-#include <genarch/kbrd/scanc_mac.h>
-#endif
-
-#include <synch/spinlock.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <macros.h>
-#include <str.h>
-#include <stdlib.h>
-
-#define IGNORE_CODE  0x7f
-#define KEY_RELEASE  0x80
-
-#define PRESSED_SHIFT     (1 << 0)
-#define PRESSED_CAPSLOCK  (1 << 1)
-#define LOCKED_CAPSLOCK   (1 << 0)
-
-static indev_operations_t kbrd_raw_ops = {
-	.poll = NULL,
-	.signal = NULL
-};
-
-/** Process release of key.
- *
- * @param sc Scancode of the key being released.
- */
-static void key_released(kbrd_instance_t *instance, char32_t sc)
-{
-	spinlock_lock(&instance->keylock);
-
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags &= ~PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags &= ~PRESSED_CAPSLOCK;
-		if (instance->lockflags & LOCKED_CAPSLOCK)
-			instance->lockflags &= ~LOCKED_CAPSLOCK;
-		else
-			instance->lockflags |= LOCKED_CAPSLOCK;
-		break;
-	default:
-		break;
-	}
-
-	spinlock_unlock(&instance->keylock);
-}
-
-/** Process keypress.
- *
- * @param sc Scancode of the key being pressed.
- */
-static void key_pressed(kbrd_instance_t *instance, char32_t sc)
-{
-	bool letter;
-	bool shift;
-	bool capslock;
-	char32_t ch;
-
-	spinlock_lock(&instance->keylock);
-
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags |= PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags |= PRESSED_CAPSLOCK;
-		break;
-	case SC_SCAN_ESCAPE:
-		break;
-	default:
-		letter = islower(sc_primary_map[sc]);
-		shift = instance->keyflags & PRESSED_SHIFT;
-		capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
-		    (instance->lockflags & LOCKED_CAPSLOCK);
-
-		if ((letter) && (capslock))
-			shift = !shift;
-
-		if (shift)
-			ch = sc_secondary_map[sc];
-		else
-			ch = sc_primary_map[sc];
-
-		switch (ch) {
-		case U_PAGE_UP:
-			indev_signal(instance->sink, INDEV_SIGNAL_SCROLL_UP);
-			break;
-		case U_PAGE_DOWN:
-			indev_signal(instance->sink, INDEV_SIGNAL_SCROLL_DOWN);
-			break;
-		default:
-			indev_push_character(instance->sink, ch);
-		}
-
-		break;
-	}
-
-	spinlock_unlock(&instance->keylock);
-}
-
-static void kkbrd(void *arg)
-{
-	kbrd_instance_t *instance = (kbrd_instance_t *) arg;
-
-	while (true) {
-		char32_t sc = indev_pop_character(&instance->raw);
-
-		if (sc == IGNORE_CODE)
-			continue;
-
-		if (sc & KEY_RELEASE)
-			key_released(instance, (sc ^ KEY_RELEASE) & 0x7f);
-		else
-			key_pressed(instance, sc & 0x7f);
-	}
-}
-
-kbrd_instance_t *kbrd_init(void)
-{
-	kbrd_instance_t *instance =
-	    malloc(sizeof(kbrd_instance_t));
-	if (instance) {
-		instance->thread = thread_create(kkbrd, (void *) instance,
-		    TASK, THREAD_FLAG_NONE, "kkbrd");
-
-		if (!instance->thread) {
-			free(instance);
-			return NULL;
-		}
-
-		instance->sink = NULL;
-		indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
-
-		spinlock_initialize(&instance->keylock, "kbrd.instance.keylock");
-		instance->keyflags = 0;
-		instance->lockflags = 0;
-	}
-
-	return instance;
-}
-
-indev_t *kbrd_wire(kbrd_instance_t *instance, indev_t *sink)
-{
-	assert(instance);
-	assert(sink);
-
-	instance->sink = sink;
-	thread_start(instance->thread);
-
-	return &instance->raw;
-}
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/kbrd_at.c
===================================================================
--- kernel/genarch/src/kbrd/kbrd_at.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief PC/AT Keyboard processing.
- */
-
-#include <assert.h>
-#include <genarch/kbrd/kbrd.h>
-#include <genarch/kbrd/scanc.h>
-
-#include <genarch/kbrd/scanc_at.h>
-
-#include <synch/spinlock.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <macros.h>
-#include <stdlib.h>
-
-#define PRESSED_SHIFT     (1 << 0)
-#define PRESSED_CAPSLOCK  (1 << 1)
-#define LOCKED_CAPSLOCK   (1 << 0)
-
-#define AT_KEY_RELEASE		0xF0
-#define AT_ESC_KEY		0xE0
-#define AT_CAPS_SCAN_CODE	0x58
-#define AT_NUM_SCAN_CODE	0x77
-#define AT_SCROLL_SCAN_CODE	0x7E
-
-static bool is_lock_key(char32_t);
-
-static indev_operations_t kbrd_raw_ops = {
-	.poll = NULL
-};
-
-/** Process release of key.
- *
- * @param sc Scancode of the key being released.
- */
-static void key_released(kbrd_instance_t *instance, char32_t sc)
-{
-	spinlock_lock(&instance->keylock);
-
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags &= ~PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags &= ~PRESSED_CAPSLOCK;
-		if (instance->lockflags & LOCKED_CAPSLOCK)
-			instance->lockflags &= ~LOCKED_CAPSLOCK;
-		else
-			instance->lockflags |= LOCKED_CAPSLOCK;
-		break;
-	default:
-		break;
-	}
-
-	spinlock_unlock(&instance->keylock);
-}
-
-/** Process keypress.
- *
- * @param sc Scancode of the key being pressed.
- */
-static void key_pressed(kbrd_instance_t *instance, char32_t sc)
-{
-	bool letter;
-	bool shift;
-	bool capslock;
-
-	spinlock_lock(&instance->keylock);
-
-	switch (sc) {
-	case SC_LSHIFT:
-	case SC_RSHIFT:
-		instance->keyflags |= PRESSED_SHIFT;
-		break;
-	case SC_CAPSLOCK:
-		instance->keyflags |= PRESSED_CAPSLOCK;
-		break;
-	case SC_SCAN_ESCAPE:
-		break;
-	default:
-		letter = islower(sc_primary_map[sc]);
-		shift = instance->keyflags & PRESSED_SHIFT;
-		capslock = (instance->keyflags & PRESSED_CAPSLOCK) ||
-		    (instance->lockflags & LOCKED_CAPSLOCK);
-
-		if ((letter) && (capslock))
-			shift = !shift;
-
-		if (shift)
-			indev_push_character(instance->sink, sc_secondary_map[sc]);
-		else
-			indev_push_character(instance->sink, sc_primary_map[sc]);
-		break;
-	}
-
-	spinlock_unlock(&instance->keylock);
-}
-
-static void kkbrd(void *arg)
-{
-	static int key_released_flag = 0;
-	static int is_locked = 0;
-	kbrd_instance_t *instance = (kbrd_instance_t *) arg;
-
-	while (true) {
-		char32_t sc = indev_pop_character(&instance->raw);
-
-		if (sc == AT_KEY_RELEASE) {
-			key_released_flag = 1;
-		} else {
-			if (key_released_flag) {
-				key_released_flag = 0;
-				if (is_lock_key(sc)) {
-					if (!is_locked) {
-						is_locked = 1;
-					} else {
-						is_locked = 0;
-						continue;
-					}
-				}
-				key_released(instance, sc);
-
-			} else {
-				if (is_lock_key(sc) && is_locked)
-					continue;
-				key_pressed(instance, sc);
-			}
-		}
-
-	}
-}
-
-kbrd_instance_t *kbrd_init(void)
-{
-	kbrd_instance_t *instance;
-
-	instance = malloc(sizeof(kbrd_instance_t));
-	if (instance) {
-		instance->thread = thread_create(kkbrd, (void *) instance, TASK, 0,
-		    "kkbrd");
-
-		if (!instance->thread) {
-			free(instance);
-			return NULL;
-		}
-
-		instance->sink = NULL;
-		indev_initialize("kbrd", &instance->raw, &kbrd_raw_ops);
-
-		spinlock_initialize(&instance->keylock, "kbrd_at.instance.keylock");
-		instance->keyflags = 0;
-		instance->lockflags = 0;
-	}
-
-	return instance;
-}
-
-indev_t *kbrd_wire(kbrd_instance_t *instance, indev_t *sink)
-{
-	assert(instance);
-	assert(sink);
-
-	instance->sink = sink;
-	thread_start(instance->thread);
-
-	return &instance->raw;
-}
-
-static bool is_lock_key(char32_t sc)
-{
-	return ((sc == AT_CAPS_SCAN_CODE) || (sc == AT_NUM_SCAN_CODE) ||
-	    (sc == AT_SCROLL_SCAN_CODE));
-}
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_at.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_at.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,233 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, U_SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	Scan codes for PC/AT keyboards (set 2).
- */
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-/** Primary meaning of scancodes. */
-char32_t sc_primary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'`',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'q', '1',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'z', 's', 'a', 'w', '2',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'c', 'x', 'd', 'e', '4', '3',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'v', 'f', 't', 'r', '5',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'n', 'b', 'h', 'g', 'y', '6',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'm', 'j', 'u', '7', '8',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	',', 'k', 'i', 'o', '0', '9',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'.', '/', 'l', ';', 'p', '-',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'\'',
-	U_SPECIAL, /* 0x53 */
-	'[', '=',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', ']',
-	U_SPECIAL, /* 0x5C */
-	'\\',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace */
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del */
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock */
-	U_SPECIAL, /* 0x78  F11 */
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** Secondary meaning of scancodes. */
-char32_t sc_secondary_map[] = {
-	U_NULL, /* 0x00 */
-	U_SPECIAL, /* 0x01 - F9 */
-	U_SPECIAL, /* 0x02 - F7 */
-	U_SPECIAL, /* 0x03 - F5 */
-	U_SPECIAL, /* 0x04 - F3 */
-	U_SPECIAL, /* 0x05 - F1 */
-	U_SPECIAL, /* 0x06 - F2 */
-	U_SPECIAL, /* 0x07 - F12 */
-	U_SPECIAL, /* 0x08 -  */
-	U_SPECIAL, /* 0x09 - F10 */
-	U_SPECIAL, /* 0x0A - F8 */
-	U_SPECIAL, /* 0x0B - F10 */
-	U_SPECIAL, /* 0x0C - F4 */
-	'\t', /* 0x0D - Tab */
-	'~',
-	U_SPECIAL, /* 0x0F */
-	U_SPECIAL, /* 0x10 */
-	U_SPECIAL, /* 0x11 - LAlt */
-	U_SPECIAL, /* 0x12 - LShift */
-	U_SPECIAL, /* ox13 */
-	U_SPECIAL, /* 0x14 Ctrl */
-	'Q', '!',
-	U_SPECIAL, /* 0x17 */
-	U_SPECIAL, /* 0x18 */
-	U_SPECIAL, /* 0x19 */
-	'Z', 'S', 'A', 'W', '@',
-	U_SPECIAL, /* 0x1F */
-	U_SPECIAL, /* 0x20 */
-	'C', 'X', 'D', 'E', '$', '#',
-	U_SPECIAL, /* 0x27 */
-	U_SPECIAL, /* 0x28 */
-	' ', 'V', 'F', 'T', 'R', '%',
-	U_SPECIAL, /* 0x2F */
-	U_SPECIAL, /* 0x30 */
-	'N', 'B', 'H', 'G', 'Y', '^',
-	U_SPECIAL, /* 0x37 */
-	U_SPECIAL, /* 0x38 */
-	U_SPECIAL, /* 0x39 */
-	'M', 'J', 'U', '&', '*',
-	U_SPECIAL, /* 0x3F */
-	U_SPECIAL, /* 0x40 */
-	'<', 'K', 'I', 'O', ')', '(',
-	U_SPECIAL, /* 0x47 */
-	U_SPECIAL, /* 0x48 */
-	'>', '?', 'L', ':', 'P', '_',
-	U_SPECIAL, /* 0x4F */
-	U_SPECIAL, /* 0x50 */
-	U_SPECIAL, /* 0x51 */
-	'"',
-	U_SPECIAL, /* 0x53 */
-	'{', '+',
-	U_SPECIAL, /* 0x56 */
-	U_SPECIAL, /* 0x57 */
-	U_SPECIAL, /* 0x58 - Caps Lock */
-	U_SPECIAL, /* 0x59 - RShift */
-	'\n', '}',
-	U_SPECIAL, /* 0x5C */
-	'|',
-	U_SPECIAL, /* 0x5E */
-	U_SPECIAL, /* 0x5F */
-	U_SPECIAL, /* 0x60 */
-	U_SPECIAL, /* 0x61 */
-	U_SPECIAL, /* 0x62 */
-	U_SPECIAL, /* 0x63 */
-	U_SPECIAL, /* 0x64 */
-	U_SPECIAL, /* 0x65 */
-	'\b', /* 0x66  - backspace */
-	U_SPECIAL, /* 0x67 */
-	U_SPECIAL, /* 0x68 */
-	U_END_ARROW, /* 0x69 */
-	U_SPECIAL, /* 0x6a */
-	U_LEFT_ARROW, /* 0x6b - Left Arrow */
-	U_SPECIAL, /* 0x6c */
-	U_SPECIAL, /* 0x6d */
-	U_SPECIAL, /* 0x6e */
-	U_SPECIAL, /* 0x6f */
-	U_SPECIAL, /* 0x70 */
-	U_DELETE, /* 0x71 - Del */
-	U_DOWN_ARROW, /* 0x72 Down Arrow */
-	U_SPECIAL, /* 0x73 */
-	U_RIGHT_ARROW, /* 0x74  - Right Arrow */
-	U_UP_ARROW, /* 0x75  Up Arrow */
-	U_ESCAPE, /* 0x76 Esc */
-	U_SPECIAL, /* 0x77 - NumLock */
-	U_SPECIAL, /* 0x78  F11 */
-	U_SPECIAL, /* 0x79 */
-	U_PAGE_DOWN, /* 0x7a */
-	U_SPECIAL, /* 0x7b */
-	U_SPECIAL, /* 0x7c */
-	U_PAGE_UP, /* 0x7d */
-	U_SPECIAL, /* 0x7e */
-	U_SPECIAL /* 0x7f */
-};
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_mac.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_mac.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,306 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for Macintosh ADB keyboards.
- */
-
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-/** Primary meaning of scancodes. */
-char32_t sc_primary_map[SCANCODES] = {
-	[0x00] = 'a',
-	[0x01] = 's',
-	[0x02] = 'd',
-	[0x03] = 'f',
-	[0x04] = 'h',
-	[0x05] = 'g',
-	[0x06] = 'z',
-	[0x07] = 'x',
-	[0x08] = 'c',
-	[0x09] = 'v',
-	[0x0a] = U_SPECIAL,
-	[0x0b] = 'b',
-	[0x0c] = 'q',
-	[0x0d] = 'w',
-	[0x0e] = 'e',
-	[0x0f] = 'r',
-	[0x10] = 'y',
-	[0x11] = 't',
-	[0x12] = '1',
-	[0x13] = '2',
-	[0x14] = '3',
-	[0x15] = '4',
-	[0x16] = '6',
-	[0x17] = '5',
-	[0x18] = '=',
-	[0x19] = '9',
-	[0x1a] = '7',
-	[0x1b] = '-',
-	[0x1c] = '8',
-	[0x1d] = '0',
-	[0x1e] = ']',
-	[0x1f] = 'o',
-	[0x20] = 'u',
-	[0x21] = '[',
-	[0x22] = 'i',
-	[0x23] = 'p',
-	[0x24] = '\n',		/* Enter */
-	[0x25] = 'l',
-	[0x26] = 'j',
-	[0x27] = '\'',
-	[0x28] = 'k',
-	[0x29] = ';',
-	[0x2a] = '\\',
-	[0x2b] = ',',
-	[0x2c] = '/',
-	[0x2d] = 'n',
-	[0x2e] = 'm',
-	[0x2f] = '.',
-	[0x30] = '\t',		/* Tab */
-	[0x31] = ' ',		/* Space */
-	[0x32] = '`',
-	[0x33] = '\b',		/* Backspace */
-	[0x34] = U_SPECIAL,
-	[0x35] = U_ESCAPE,
-	[0x36] = U_SPECIAL,
-	[0x37] = U_SPECIAL,
-	[0x38] = U_SPECIAL,
-	[0x39] = U_SPECIAL,
-	[0x3a] = U_SPECIAL,
-	[0x3b] = U_LEFT_ARROW,
-	[0x3c] = U_RIGHT_ARROW,
-	[0x3d] = U_DOWN_ARROW,
-	[0x3e] = U_UP_ARROW,
-	[0x3f] = U_SPECIAL,
-	[0x40] = U_SPECIAL,
-	[0x41] = '.',		/* Num Separator */
-	[0x42] = U_SPECIAL,
-	[0x43] = '*',		/* Num Times */
-	[0x44] = U_SPECIAL,
-	[0x45] = '+',		/* Num Plus */
-	[0x46] = U_SPECIAL,
-	[0x47] = U_SPECIAL,
-	[0x48] = U_SPECIAL,
-	[0x49] = U_SPECIAL,
-	[0x4a] = U_SPECIAL,
-	[0x4b] = '/',		/* Num Divide */
-	[0x4c] = U_SPECIAL,
-	[0x4d] = U_SPECIAL,
-	[0x4e] = '-',		/* Num Minus */
-	[0x4f] = U_SPECIAL,
-	[0x50] = U_SPECIAL,
-	[0x51] = U_SPECIAL,
-	[0x52] = '0',		/* Num Zero */
-	[0x53] = '1',		/* Num One */
-	[0x54] = '2',		/* Num Two */
-	[0x55] = '3',		/* Num Three */
-	[0x56] = '4',		/* Num Four */
-	[0x57] = '5',		/* Num Five */
-	[0x58] = '6',		/* Num Six */
-	[0x59] = '7',		/* Num Seven */
-	[0x5a] = U_SPECIAL,
-	[0x5b] = '8',		/* Num Eight */
-	[0x5c] = '9',		/* Num Nine */
-	[0x5d] = U_SPECIAL,
-	[0x5e] = U_SPECIAL,
-	[0x5f] = U_SPECIAL,
-	[0x60] = U_SPECIAL,
-	[0x61] = U_SPECIAL,
-	[0x62] = U_SPECIAL,
-	[0x63] = U_SPECIAL,
-	[0x64] = U_SPECIAL,
-	[0x65] = U_SPECIAL,
-	[0x66] = U_SPECIAL,
-	[0x67] = U_SPECIAL,
-	[0x68] = U_SPECIAL,
-	[0x69] = U_SPECIAL,
-	[0x6a] = U_SPECIAL,
-	[0x6b] = U_SPECIAL,
-	[0x6c] = U_SPECIAL,
-	[0x6d] = U_SPECIAL,
-	[0x6e] = U_SPECIAL,
-	[0x6f] = U_SPECIAL,
-	[0x70] = U_SPECIAL,
-	[0x71] = U_SPECIAL,
-	[0x72] = U_SPECIAL,
-	[0x73] = U_HOME_ARROW,
-	[0x74] = U_PAGE_UP,
-	[0x75] = U_DELETE,
-	[0x76] = U_SPECIAL,
-	[0x77] = U_SPECIAL,
-	[0x78] = U_SPECIAL,
-	[0x79] = U_PAGE_DOWN,
-	[0x7a] = U_SPECIAL,
-	[0x7b] = U_SPECIAL,
-	[0x7c] = U_SPECIAL,
-	[0x7d] = U_SPECIAL,
-	[0x7e] = U_SPECIAL,
-	[0x7f] = U_SPECIAL
-};
-
-/** Secondary meaning of scancodes. */
-char32_t sc_secondary_map[SCANCODES] = {
-	[0x00] = 'A',
-	[0x01] = 'S',
-	[0x02] = 'D',
-	[0x03] = 'F',
-	[0x04] = 'H',
-	[0x05] = 'G',
-	[0x06] = 'Z',
-	[0x07] = 'X',
-	[0x08] = 'C',
-	[0x09] = 'V',
-	[0x0a] = U_SPECIAL,
-	[0x0b] = 'B',
-	[0x0c] = 'Q',
-	[0x0d] = 'W',
-	[0x0e] = 'E',
-	[0x0f] = 'R',
-	[0x10] = 'Y',
-	[0x11] = 'T',
-	[0x12] = '!',
-	[0x13] = '@',
-	[0x14] = '#',
-	[0x15] = '$',
-	[0x16] = '^',
-	[0x17] = '%',
-	[0x18] = '+',
-	[0x19] = '(',
-	[0x1a] = '&',
-	[0x1b] = '_',
-	[0x1c] = '*',
-	[0x1d] = ')',
-	[0x1e] = '}',
-	[0x1f] = 'O',
-	[0x20] = 'U',
-	[0x21] = '{',
-	[0x22] = 'I',
-	[0x23] = 'P',
-	[0x24] = '\n',		/* Enter */
-	[0x25] = 'L',
-	[0x26] = 'J',
-	[0x27] = '"',
-	[0x28] = 'K',
-	[0x29] = ':',
-	[0x2a] = '|',
-	[0x2b] = '<',
-	[0x2c] = '?',
-	[0x2d] = 'N',
-	[0x2e] = 'M',
-	[0x2f] = '>',
-	[0x30] = '\t',		/* Tab */
-	[0x31] = ' ',		/* Space */
-	[0x32] = '~',
-	[0x33] = '\b',		/* Backspace */
-	[0x34] = U_SPECIAL,
-	[0x35] = U_SPECIAL,
-	[0x36] = U_SPECIAL,
-	[0x37] = U_SPECIAL,
-	[0x38] = U_SPECIAL,
-	[0x39] = U_SPECIAL,
-	[0x3a] = U_SPECIAL,
-	[0x3b] = U_SPECIAL,
-	[0x3c] = U_SPECIAL,
-	[0x3d] = U_SPECIAL,
-	[0x3e] = U_SPECIAL,
-	[0x3f] = U_SPECIAL,
-	[0x40] = U_SPECIAL,
-	[0x41] = '.',		/* Num Separator */
-	[0x42] = U_SPECIAL,
-	[0x43] = '*',		/* Num Times */
-	[0x44] = U_SPECIAL,
-	[0x45] = '+',		/* Num Plus */
-	[0x46] = U_SPECIAL,
-	[0x47] = U_SPECIAL,
-	[0x48] = U_SPECIAL,
-	[0x49] = U_SPECIAL,
-	[0x4a] = U_SPECIAL,
-	[0x4b] = '/',		/* Num Divide */
-	[0x4c] = U_SPECIAL,
-	[0x4d] = U_SPECIAL,
-	[0x4e] = '-',		/* Num Minus */
-	[0x4f] = U_SPECIAL,
-	[0x50] = U_SPECIAL,
-	[0x51] = U_SPECIAL,
-	[0x52] = '0',		/* Num Zero */
-	[0x53] = '1',		/* Num One */
-	[0x54] = '2',		/* Num Two */
-	[0x55] = '3',		/* Num Three */
-	[0x56] = '4',		/* Num Four */
-	[0x57] = '5',		/* Num Five */
-	[0x58] = '6',		/* Num Six */
-	[0x59] = '7',		/* Num Seven */
-	[0x5a] = U_SPECIAL,
-	[0x5b] = '8',		/* Num Eight */
-	[0x5c] = '9',		/* Num Nine */
-	[0x5d] = U_SPECIAL,
-	[0x5e] = U_SPECIAL,
-	[0x5f] = U_SPECIAL,
-	[0x60] = U_SPECIAL,
-	[0x61] = U_SPECIAL,
-	[0x62] = U_SPECIAL,
-	[0x63] = U_SPECIAL,
-	[0x64] = U_SPECIAL,
-	[0x65] = U_SPECIAL,
-	[0x66] = U_SPECIAL,
-	[0x67] = U_SPECIAL,
-	[0x68] = U_SPECIAL,
-	[0x69] = U_SPECIAL,
-	[0x6a] = U_SPECIAL,
-	[0x6b] = U_SPECIAL,
-	[0x6c] = U_SPECIAL,
-	[0x6d] = U_SPECIAL,
-	[0x6e] = U_SPECIAL,
-	[0x6f] = U_SPECIAL,
-	[0x70] = U_SPECIAL,
-	[0x71] = U_SPECIAL,
-	[0x72] = U_SPECIAL,
-	[0x73] = U_SPECIAL,
-	[0x74] = U_SPECIAL,
-	[0x75] = U_SPECIAL,
-	[0x76] = U_SPECIAL,
-	[0x77] = U_SPECIAL,
-	[0x78] = U_SPECIAL,
-	[0x79] = U_SPECIAL,
-	[0x7a] = U_SPECIAL,
-	[0x7b] = U_SPECIAL,
-	[0x7c] = U_SPECIAL,
-	[0x7d] = U_SPECIAL,
-	[0x7e] = U_SPECIAL,
-	[0x7f] = U_SPECIAL
-};
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_pc.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_pc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,221 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for PC keyboards.
- */
-
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-/** Primary meaning of scancodes. */
-char32_t sc_primary_map[SCANCODES] = {
-	U_NULL,         /* 0x00 - undefined */
-	U_ESCAPE,       /* 0x01 - Esc */
-	'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
-	'\b',           /* 0x0e - Backspace */
-	'\t',           /* 0x0f - Tab */
-	'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
-	'\n',           /* 0x1e - Enter */
-	U_SPECIAL,      /* 0x1d - Left Ctrl */
-	'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
-	U_SPECIAL,      /* 0x2a - Left Shift */
-	'\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
-	U_SPECIAL,      /* 0x36 - Right Shift */
-	U_SPECIAL,      /* 0x37 - Print Screen */
-	U_SPECIAL,      /* 0x38 - Left Alt */
-	' ',
-	U_SPECIAL,      /* 0x3a - CapsLock */
-	U_SPECIAL,      /* 0x3b - F1 */
-	U_SPECIAL,      /* 0x3c - F2 */
-	U_SPECIAL,      /* 0x3d - F3 */
-	U_SPECIAL,      /* 0x3e - F4 */
-	U_SPECIAL,      /* 0x3f - F5 */
-	U_SPECIAL,      /* 0x40 - F6 */
-	U_SPECIAL,      /* 0x41 - F7 */
-	U_SPECIAL,      /* 0x42 - F8 */
-	U_SPECIAL,      /* 0x43 - F9 */
-	U_SPECIAL,      /* 0x44 - F10 */
-	U_SPECIAL,      /* 0x45 - NumLock */
-	U_SPECIAL,      /* 0x46 - ScrollLock */
-	U_HOME_ARROW,   /* 0x47 - Home */
-	U_UP_ARROW,     /* 0x48 - Up Arrow */
-	U_PAGE_UP,      /* 0x49 - Page Up */
-	'-',
-	U_LEFT_ARROW,   /* 0x4b - Left Arrow */
-	'5',            /* 0x4c - Numpad Center */
-	U_RIGHT_ARROW,  /* 0x4d - Right Arrow */
-	'+',
-	U_END_ARROW,    /* 0x4f - End */
-	U_DOWN_ARROW,   /* 0x50 - Down Arrow */
-	U_PAGE_DOWN,    /* 0x51 - Page Down */
-	'0',            /* 0x52 - Numpad Insert */
-	U_DELETE,       /* 0x53 - Delete */
-	U_SPECIAL,      /* 0x54 - Alt-SysRq */
-	U_SPECIAL,      /* 0x55 - F11/F12/PF1/FN */
-	U_SPECIAL,      /* 0x56 - unlabelled key next to LAlt */
-	U_SPECIAL,      /* 0x57 - F11 */
-	U_SPECIAL,      /* 0x58 - F12 */
-	U_SPECIAL,      /* 0x59 */
-	U_SPECIAL,      /* 0x5a */
-	U_SPECIAL,      /* 0x5b */
-	U_SPECIAL,      /* 0x5c */
-	U_SPECIAL,      /* 0x5d */
-	U_SPECIAL,      /* 0x5e */
-	U_SPECIAL,      /* 0x5f */
-	U_SPECIAL,      /* 0x60 */
-	U_SPECIAL,      /* 0x61 */
-	U_SPECIAL,      /* 0x62 */
-	U_SPECIAL,      /* 0x63 */
-	U_SPECIAL,      /* 0x64 */
-	U_SPECIAL,      /* 0x65 */
-	U_SPECIAL,      /* 0x66 */
-	U_SPECIAL,      /* 0x67 */
-	U_SPECIAL,      /* 0x68 */
-	U_SPECIAL,      /* 0x69 */
-	U_SPECIAL,      /* 0x6a */
-	U_SPECIAL,      /* 0x6b */
-	U_SPECIAL,      /* 0x6c */
-	U_SPECIAL,      /* 0x6d */
-	U_SPECIAL,      /* 0x6e */
-	U_SPECIAL,      /* 0x6f */
-	U_SPECIAL,      /* 0x70 */
-	U_SPECIAL,      /* 0x71 */
-	U_SPECIAL,      /* 0x72 */
-	U_SPECIAL,      /* 0x73 */
-	U_SPECIAL,      /* 0x74 */
-	U_SPECIAL,      /* 0x75 */
-	U_SPECIAL,      /* 0x76 */
-	U_SPECIAL,      /* 0x77 */
-	U_SPECIAL,      /* 0x78 */
-	U_SPECIAL,      /* 0x79 */
-	U_SPECIAL,      /* 0x7a */
-	U_SPECIAL,      /* 0x7b */
-	U_SPECIAL,      /* 0x7c */
-	U_SPECIAL,      /* 0x7d */
-	U_SPECIAL,      /* 0x7e */
-	U_SPECIAL       /* 0x7f */
-};
-
-/** Secondary meaning of scancodes. */
-char32_t sc_secondary_map[SCANCODES] = {
-	U_NULL,         /* 0x00 - undefined */
-	U_ESCAPE,       /* 0x01 - Esc */
-	'!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
-	'\b',           /* 0x0e - Backspace */
-	'\t',           /* 0x0f - Tab */
-	'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
-	'\n',           /* 0x1e - Enter */
-	U_SPECIAL,      /* 0x1d - Left Ctrl */
-	'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~',
-	U_SPECIAL,      /* 0x2a - Left Shift */
-	'|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
-	U_SPECIAL,      /* 0x36 - Right Shift */
-	U_SPECIAL,      /* 0x37 - Print Screen */
-	U_SPECIAL,      /* 0x38 - Left Alt */
-	' ',
-	U_SPECIAL,      /* 0x3a - CapsLock */
-	U_SPECIAL,      /* 0x3b - F1 */
-	U_SPECIAL,      /* 0x3c - F2 */
-	U_SPECIAL,      /* 0x3d - F3 */
-	U_SPECIAL,      /* 0x3e - F4 */
-	U_SPECIAL,      /* 0x3f - F5 */
-	U_SPECIAL,      /* 0x40 - F6 */
-	U_SPECIAL,      /* 0x41 - F7 */
-	U_SPECIAL,      /* 0x42 - F8 */
-	U_SPECIAL,      /* 0x43 - F9 */
-	U_SPECIAL,      /* 0x44 - F10 */
-	U_SPECIAL,      /* 0x45 - NumLock */
-	U_SPECIAL,      /* 0x46 - ScrollLock */
-
-	U_HOME_ARROW,   /* 0x47 - Home */
-	U_UP_ARROW,     /* 0x48 - Up Arrow */
-	U_PAGE_UP,      /* 0x49 - Page Up */
-	'-',
-	U_LEFT_ARROW,   /* 0x4b - Left Arrow */
-	'5',            /* 0x4c - Numpad Center */
-	U_RIGHT_ARROW,  /* 0x4d - Right Arrow */
-	'+',
-	U_END_ARROW,    /* 0x4f - End */
-	U_DOWN_ARROW,   /* 0x50 - Down Arrow */
-	U_PAGE_DOWN,    /* 0x51 - Page Down */
-	'0',            /* 0x52 - Numpad Insert */
-	U_DELETE,       /* 0x53 - Delete */
-	U_SPECIAL,      /* 0x54 - Alt-SysRq */
-	U_SPECIAL,      /* 0x55 - F11/F12/PF1/FN */
-	U_SPECIAL,      /* 0x56 - unlabelled key next to LAlt */
-	U_SPECIAL,      /* 0x57 - F11 */
-	U_SPECIAL,      /* 0x58 - F12 */
-	U_SPECIAL,      /* 0x59 */
-	U_SPECIAL,      /* 0x5a */
-	U_SPECIAL,      /* 0x5b */
-	U_SPECIAL,      /* 0x5c */
-	U_SPECIAL,      /* 0x5d */
-	U_SPECIAL,      /* 0x5e */
-	U_SPECIAL,      /* 0x5f */
-	U_SPECIAL,      /* 0x60 */
-	U_SPECIAL,      /* 0x61 */
-	U_SPECIAL,      /* 0x62 */
-	U_SPECIAL,      /* 0x63 */
-	U_SPECIAL,      /* 0x64 */
-	U_SPECIAL,      /* 0x65 */
-	U_SPECIAL,      /* 0x66 */
-	U_SPECIAL,      /* 0x67 */
-	U_SPECIAL,      /* 0x68 */
-	U_SPECIAL,      /* 0x69 */
-	U_SPECIAL,      /* 0x6a */
-	U_SPECIAL,      /* 0x6b */
-	U_SPECIAL,      /* 0x6c */
-	U_SPECIAL,      /* 0x6d */
-	U_SPECIAL,      /* 0x6e */
-	U_SPECIAL,      /* 0x6f */
-	U_SPECIAL,      /* 0x70 */
-	U_SPECIAL,      /* 0x71 */
-	U_SPECIAL,      /* 0x72 */
-	U_SPECIAL,      /* 0x73 */
-	U_SPECIAL,      /* 0x74 */
-	U_SPECIAL,      /* 0x75 */
-	U_SPECIAL,      /* 0x76 */
-	U_SPECIAL,      /* 0x77 */
-	U_SPECIAL,      /* 0x78 */
-	U_SPECIAL,      /* 0x79 */
-	U_SPECIAL,      /* 0x7a */
-	U_SPECIAL,      /* 0x7b */
-	U_SPECIAL,      /* 0x7c */
-	U_SPECIAL,      /* 0x7d */
-	U_SPECIAL,      /* 0x7e */
-	U_SPECIAL       /* 0x7f */
-};
-
-/** @}
- */
Index: rnel/genarch/src/kbrd/scanc_sun.c
===================================================================
--- kernel/genarch/src/kbrd/scanc_sun.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,306 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Scan codes for Sun keyboards.
- */
-
-#include <genarch/kbrd/scanc.h>
-#include <typedefs.h>
-#include <str.h>
-
-/** Primary meaning of scancodes. */
-char32_t sc_primary_map[SCANCODES] = {
-	[0x00] = U_SPECIAL,
-	[0x01] = U_SPECIAL,
-	[0x02] = U_SPECIAL,
-	[0x03] = U_SPECIAL,
-	[0x04] = U_SPECIAL,
-	[0x05] = U_SPECIAL,      /* F1 */
-	[0x06] = U_SPECIAL,      /* F2 */
-	[0x07] = U_SPECIAL,      /* F10 */
-	[0x08] = U_SPECIAL,      /* F3 */
-	[0x09] = U_SPECIAL,      /* F11 */
-	[0x0a] = U_SPECIAL,      /* F4 */
-	[0x0b] = U_SPECIAL,      /* F12 */
-	[0x0c] = U_SPECIAL,      /* F5 */
-	[0x0d] = U_SPECIAL,      /* Right Alt */
-	[0x0e] = U_SPECIAL,      /* F6 */
-	[0x0f] = U_SPECIAL,
-	[0x10] = U_SPECIAL,      /* F7 */
-	[0x11] = U_SPECIAL,      /* F8 */
-	[0x12] = U_SPECIAL,      /* F9 */
-	[0x13] = U_SPECIAL,      /* Left Alt */
-	[0x14] = U_UP_ARROW,     /* Up Arrow */
-	[0x15] = U_SPECIAL,      /* Pause */
-	[0x16] = U_SPECIAL,
-	[0x17] = U_SPECIAL,      /* Scroll Lock */
-	[0x18] = U_LEFT_ARROW,   /* Left Arrow */
-	[0x19] = U_SPECIAL,
-	[0x1a] = U_SPECIAL,
-	[0x1b] = U_DOWN_ARROW,   /* Down Arrow */
-	[0x1c] = U_RIGHT_ARROW,  /* Right Arrow */
-	[0x1d] = U_ESCAPE,       /* Esc */
-	[0x1e] = '1',
-	[0x1f] = '2',
-	[0x20] = '3',
-	[0x21] = '4',
-	[0x22] = '5',
-	[0x23] = '6',
-	[0x24] = '7',
-	[0x25] = '8',
-	[0x26] = '9',
-	[0x27] = '0',
-	[0x28] = '-',
-	[0x29] = '=',
-	[0x2a] = '`',
-	[0x2b] = '\b',           /* Backspace */
-	[0x2c] = U_SPECIAL,      /* Insert */
-	[0x2d] = U_SPECIAL,
-	[0x2e] = '/',            /* Numpad / */
-	[0x2f] = '*',            /* Numpad * */
-	[0x30] = U_SPECIAL,
-	[0x31] = U_SPECIAL,
-	[0x32] = '.',            /* Numpad . */
-	[0x33] = U_SPECIAL,
-	[0x34] = U_HOME_ARROW,   /* Home */
-	[0x35] = '\t',           /* Tab */
-	[0x36] = 'q',
-	[0x37] = 'w',
-	[0x38] = 'e',
-	[0x39] = 'r',
-	[0x3a] = 't',
-	[0x3b] = 'y',
-	[0x3c] = 'u',
-	[0x3d] = 'i',
-	[0x3e] = 'o',
-	[0x3f] = 'p',
-	[0x40] = '[',
-	[0x41] = ']',
-	[0x42] = U_DELETE,       /* Delete */
-	[0x43] = U_SPECIAL,
-	[0x44] = '7',            /* Numpad 7 */
-	[0x45] = '8',            /* Numpad 8 */
-	[0x46] = '9',            /* Numpad 9 */
-	[0x47] = '-',            /* Numpad - */
-	[0x48] = U_SPECIAL,
-	[0x49] = U_SPECIAL,
-	[0x4a] = U_END_ARROW,    /* End */
-	[0x4b] = U_SPECIAL,
-	[0x4c] = U_SPECIAL,      /* Control */
-	[0x4d] = 'a',
-	[0x4e] = 's',
-	[0x4f] = 'd',
-	[0x50] = 'f',
-	[0x51] = 'g',
-	[0x52] = 'h',
-	[0x53] = 'j',
-	[0x54] = 'k',
-	[0x55] = 'l',
-	[0x56] = ';',
-	[0x57] = '\'',
-	[0x58] = '\\',
-	[0x59] = '\n',           /* Enter */
-	[0x5a] = '\n',           /* Numpad Enter */
-	[0x5b] = '4',            /* Numpad 4 */
-	[0x5c] = '5',            /* Numpad 5 */
-	[0x5d] = '6',            /* Numpad 6 */
-	[0x5e] = '0',            /* Numpad 0 */
-	[0x5f] = U_SPECIAL,
-	[0x60] = U_PAGE_UP,      /* Page Up */
-	[0x61] = U_SPECIAL,
-	[0x62] = U_SPECIAL,      /* NumLock */
-	[0x63] = U_SPECIAL,      /* Left Shift */
-	[0x64] = 'z',
-	[0x65] = 'x',
-	[0x66] = 'c',
-	[0x67] = 'v',
-	[0x68] = 'b',
-	[0x69] = 'n',
-	[0x6a] = 'm',
-	[0x6b] = ',',
-	[0x6c] = '.',
-	[0x6d] = '/',
-	[0x6e] = U_SPECIAL,      /* Right Shift */
-	[0x6f] = U_SPECIAL,
-	[0x70] = '1',            /* Numpad 1 */
-	[0x71] = '2',            /* Numpad 2 */
-	[0x72] = '3',            /* Numpad 3 */
-	[0x73] = U_SPECIAL,
-	[0x74] = U_SPECIAL,
-	[0x75] = U_SPECIAL,
-	[0x76] = U_SPECIAL,
-	[0x77] = U_SPECIAL,      /* CapsLock */
-	[0x78] = U_SPECIAL,
-	[0x79] = ' ',
-	[0x7a] = U_SPECIAL,
-	[0x7b] = U_PAGE_DOWN,    /* Page Down */
-	[0x7c] = U_SPECIAL,
-	[0x7d] = '+',            /* Numpad + */
-	[0x7e] = U_SPECIAL,
-	[0x7f] = U_SPECIAL
-};
-
-/** Secondary meaning of scancodes. */
-char32_t sc_secondary_map[SCANCODES] = {
-	[0x00] = U_SPECIAL,
-	[0x01] = U_SPECIAL,
-	[0x02] = U_SPECIAL,
-	[0x03] = U_SPECIAL,
-	[0x04] = U_SPECIAL,
-	[0x05] = U_SPECIAL,      /* F1 */
-	[0x06] = U_SPECIAL,      /* F2 */
-	[0x07] = U_SPECIAL,      /* F10 */
-	[0x08] = U_SPECIAL,      /* F3 */
-	[0x09] = U_SPECIAL,      /* F11 */
-	[0x0a] = U_SPECIAL,      /* F4 */
-	[0x0b] = U_SPECIAL,      /* F12 */
-	[0x0c] = U_SPECIAL,      /* F5 */
-	[0x0d] = U_SPECIAL,      /* Right Alt */
-	[0x0e] = U_SPECIAL,      /* F6 */
-	[0x0f] = U_SPECIAL,
-	[0x10] = U_SPECIAL,      /* F7 */
-	[0x11] = U_SPECIAL,      /* F8 */
-	[0x12] = U_SPECIAL,      /* F9 */
-	[0x13] = U_SPECIAL,      /* Left Alt */
-	[0x14] = U_UP_ARROW,     /* Up Arrow */
-	[0x15] = U_SPECIAL,      /* Pause */
-	[0x16] = U_SPECIAL,
-	[0x17] = U_SPECIAL,      /* Scroll Lock */
-	[0x18] = U_LEFT_ARROW,   /* Left Arrow */
-	[0x19] = U_SPECIAL,
-	[0x1a] = U_SPECIAL,
-	[0x1b] = U_DOWN_ARROW,   /* Down Arrow */
-	[0x1c] = U_RIGHT_ARROW,  /* Right Arrow */
-	[0x1d] = U_ESCAPE,       /* Esc */
-	[0x1e] = '!',
-	[0x1f] = '@',
-	[0x20] = '#',
-	[0x21] = '$',
-	[0x22] = '%',
-	[0x23] = '^',
-	[0x24] = '&',
-	[0x25] = '*',
-	[0x26] = '(',
-	[0x27] = ')',
-	[0x28] = '_',
-	[0x29] = '+',
-	[0x2a] = '~',
-	[0x2b] = '\b',           /* Backspace */
-	[0x2c] = U_SPECIAL,      /* Insert */
-	[0x2d] = U_SPECIAL,
-	[0x2e] = '/',            /* Numpad / */
-	[0x2f] = '*',            /* Numpad * */
-	[0x30] = U_SPECIAL,
-	[0x31] = U_SPECIAL,
-	[0x32] = '.',            /* Numpad . */
-	[0x33] = U_SPECIAL,
-	[0x34] = U_HOME_ARROW,   /* Home */
-	[0x35] = '\t',           /* Tab */
-	[0x36] = 'Q',
-	[0x37] = 'W',
-	[0x38] = 'E',
-	[0x39] = 'R',
-	[0x3a] = 'T',
-	[0x3b] = 'Y',
-	[0x3c] = 'U',
-	[0x3d] = 'I',
-	[0x3e] = 'O',
-	[0x3f] = 'P',
-	[0x40] = '{',
-	[0x41] = '}',
-	[0x42] = U_DELETE,       /* Delete */
-	[0x43] = U_SPECIAL,
-	[0x44] = '7',            /* Numpad 7 */
-	[0x45] = '8',            /* Numpad 8 */
-	[0x46] = '9',            /* Numpad 9 */
-	[0x47] = '-',            /* Numpad - */
-	[0x48] = U_SPECIAL,
-	[0x49] = U_SPECIAL,
-	[0x4a] = U_END_ARROW,    /* End */
-	[0x4b] = U_SPECIAL,
-	[0x4c] = U_SPECIAL,      /* Control */
-	[0x4d] = 'A',
-	[0x4e] = 'S',
-	[0x4f] = 'D',
-	[0x50] = 'F',
-	[0x51] = 'G',
-	[0x52] = 'H',
-	[0x53] = 'J',
-	[0x54] = 'K',
-	[0x55] = 'L',
-	[0x56] = ':',
-	[0x57] = '"',
-	[0x58] = '|',
-	[0x59] = '\n',           /* Enter */
-	[0x5a] = '\n',           /* Numpad Enter */
-	[0x5b] = '4',            /* Numpad 4 */
-	[0x5c] = '5',            /* Numpad 5 */
-	[0x5d] = '6',            /* Numpad 6 */
-	[0x5e] = '0',            /* Numpad 0 */
-	[0x5f] = U_SPECIAL,
-	[0x60] = U_PAGE_UP,      /* Page Up */
-	[0x61] = U_SPECIAL,
-	[0x62] = U_SPECIAL,      /* NumLock */
-	[0x63] = U_SPECIAL,      /* Left Shift */
-	[0x64] = 'Z',
-	[0x65] = 'X',
-	[0x66] = 'C',
-	[0x67] = 'V',
-	[0x68] = 'B',
-	[0x69] = 'N',
-	[0x6a] = 'M',
-	[0x6b] = '<',
-	[0x6c] = '>',
-	[0x6d] = '?',
-	[0x6e] = U_SPECIAL,      /* Right Shift */
-	[0x6f] = U_SPECIAL,
-	[0x70] = '1',            /* Numpad 1 */
-	[0x71] = '2',            /* Numpad 2 */
-	[0x72] = '3',            /* Numpad 3 */
-	[0x73] = U_SPECIAL,
-	[0x74] = U_SPECIAL,
-	[0x75] = U_SPECIAL,
-	[0x76] = U_SPECIAL,
-	[0x77] = U_SPECIAL,      /* CapsLock */
-	[0x78] = U_SPECIAL,
-	[0x79] = ' ',
-	[0x7a] = U_SPECIAL,
-	[0x7b] = U_PAGE_DOWN,    /* Page Down */
-	[0x7c] = U_SPECIAL,
-	[0x7d] = '+',            /* Numpad + */
-	[0x7e] = U_SPECIAL,
-	[0x7f] = U_SPECIAL
-};
-
-/** @}
- */
Index: rnel/genarch/src/mm/as_ht.c
===================================================================
--- kernel/genarch/src/mm/as_ht.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief Address space functions for global page hash table.
- */
-
-#include <arch/mm/as.h>
-#include <genarch/mm/as_ht.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <typedefs.h>
-#include <adt/hash_table.h>
-#include <synch/mutex.h>
-
-static pte_t *ht_create(unsigned int);
-static void ht_destroy(pte_t *);
-
-static void ht_lock(as_t *, bool);
-static void ht_unlock(as_t *, bool);
-static bool ht_locked(as_t *);
-
-const as_operations_t as_ht_operations = {
-	.page_table_create = ht_create,
-	.page_table_destroy = ht_destroy,
-	.page_table_lock = ht_lock,
-	.page_table_unlock = ht_unlock,
-	.page_table_locked = ht_locked,
-};
-
-/** Page hash table create.
- *
- * The page hash table will be created only once
- * and will be shared by all address spaces.
- *
- * @param flags Ignored.
- *
- * @return Returns NULL.
- *
- */
-pte_t *ht_create(unsigned int flags)
-{
-	if (flags & FLAG_AS_KERNEL) {
-		hash_table_create(&page_ht, 0, 0, &ht_ops);
-		pte_cache = slab_cache_create("pte_t", sizeof(pte_t), 0,
-		    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-	}
-
-	return NULL;
-}
-
-/** Destroy page table.
- *
- * Actually do nothing as the global page hash table is used.
- *
- * @param page_table This parameter is ignored.
- *
- */
-void ht_destroy(pte_t *page_table)
-{
-	/* No-op. */
-}
-
-/** Lock page table.
- *
- * Lock address space.
- * Interrupts must be disabled.
- *
- * @param as   Address space.
- * @param lock If false, do not attempt to lock the address space.
- *
- */
-void ht_lock(as_t *as, bool lock)
-{
-	if (lock)
-		mutex_lock(&as->lock);
-}
-
-/** Unlock page table.
- *
- * Unlock address space.
- * Interrupts must be disabled.
- *
- * @param as     Address space.
- * @param unlock If false, do not attempt to lock the address space.
- *
- */
-void ht_unlock(as_t *as, bool unlock)
-{
-	if (unlock)
-		mutex_unlock(&as->lock);
-}
-
-/** Test whether page tables are locked.
- *
- * @param as		Address space where the page tables belong.
- *
- * @return		True if the page tables belonging to the address soace
- *			are locked, otherwise false.
- */
-bool ht_locked(as_t *as)
-{
-	return mutex_locked(&as->lock);
-}
-
-/** @}
- */
Index: rnel/genarch/src/mm/as_pt.c
===================================================================
--- kernel/genarch/src/mm/as_pt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief Address space functions for 4-level hierarchical pagetables.
- */
-
-#include <genarch/mm/page_pt.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/as.h>
-#include <synch/mutex.h>
-#include <arch/mm/page.h>
-#include <arch/mm/as.h>
-#include <typedefs.h>
-#include <memw.h>
-#include <arch.h>
-
-static pte_t *ptl0_create(unsigned int);
-static void ptl0_destroy(pte_t *);
-
-static void pt_lock(as_t *, bool);
-static void pt_unlock(as_t *, bool);
-static bool pt_locked(as_t *);
-
-const as_operations_t as_pt_operations = {
-	.page_table_create = ptl0_create,
-	.page_table_destroy = ptl0_destroy,
-	.page_table_lock = pt_lock,
-	.page_table_unlock = pt_unlock,
-	.page_table_locked = pt_locked,
-};
-
-/** Create PTL0.
- *
- * PTL0 of 4-level page table will be created for each address space.
- *
- * @param flags Flags can specify whether ptl0 is for the kernel address space.
- *
- * @return New PTL0.
- *
- */
-pte_t *ptl0_create(unsigned int flags)
-{
-	pte_t *dst_ptl0 = (pte_t *)
-	    PA2KA(frame_alloc(PTL0_FRAMES, FRAME_LOWMEM, PTL0_SIZE - 1));
-
-	memsetb(dst_ptl0, PTL0_SIZE, 0);
-
-	if (!KERNEL_SEPARATE_PTL0 && !(flags & FLAG_AS_KERNEL)) {
-		/*
-		 * Copy the kernel address space portion to new PTL0.
-		 */
-
-		mutex_lock(&AS_KERNEL->lock);
-
-		pte_t *src_ptl0 =
-		    (pte_t *) PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
-
-		uintptr_t src = (uintptr_t)
-		    &src_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
-		uintptr_t dst = (uintptr_t)
-		    &dst_ptl0[PTL0_INDEX(KERNEL_ADDRESS_SPACE_START)];
-
-		memcpy((void *) dst, (void *) src,
-		    PTL0_SIZE - (src - (uintptr_t) src_ptl0));
-
-		mutex_unlock(&AS_KERNEL->lock);
-	}
-
-	return (pte_t *) KA2PA((uintptr_t) dst_ptl0);
-}
-
-/** Destroy page table.
- *
- * Destroy PTL0, other levels are expected to be already deallocated.
- *
- * @param page_table Physical address of PTL0.
- *
- */
-void ptl0_destroy(pte_t *page_table)
-{
-	frame_free((uintptr_t) page_table, PTL0_FRAMES);
-}
-
-/** Lock page tables.
- *
- * Lock only the address space.
- * Interrupts must be disabled.
- *
- * @param as   Address space.
- * @param lock If false, do not attempt to lock the address space.
- *
- */
-void pt_lock(as_t *as, bool lock)
-{
-	if (lock)
-		mutex_lock(&as->lock);
-}
-
-/** Unlock page tables.
- *
- * Unlock the address space.
- * Interrupts must be disabled.
- *
- * @param as     Address space.
- * @param unlock If false, do not attempt to unlock the address space.
- *
- */
-void pt_unlock(as_t *as, bool unlock)
-{
-	if (unlock)
-		mutex_unlock(&as->lock);
-}
-
-/** Test whether page tables are locked.
- *
- * @param as		Address space where the page tables belong.
- *
- * @return		True if the page tables belonging to the address soace
- *			are locked, otherwise false.
- */
-bool pt_locked(as_t *as)
-{
-	return mutex_locked(&as->lock);
-}
-
-/** @}
- */
Index: rnel/genarch/src/mm/asid.c
===================================================================
--- kernel/genarch/src/mm/asid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,166 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief ASID management.
- *
- * Modern processor architectures optimize TLB utilization
- * by using ASIDs (a.k.a. memory contexts on sparc64 and
- * region identifiers on ia64). These ASIDs help to associate
- * each TLB item with an address space, thus making
- * finer-grained TLB invalidation possible.
- *
- * Unfortunatelly, there are usually less ASIDs available than
- * there can be unique as_t structures (i.e. address spaces
- * recognized by the kernel).
- *
- * When system runs short of ASIDs, it will attempt to steal
- * ASID from an address space that has not been active for
- * a while.
- *
- * This code depends on the fact that ASIDS_ALLOCABLE
- * is greater than number of supported CPUs (i.e. the
- * amount of concurently active address spaces).
- *
- * Architectures that don't have hardware support for address
- * spaces do not compile with this file.
- */
-
-#include <assert.h>
-#include <mm/asid.h>
-#include <mm/as.h>
-#include <mm/tlb.h>
-#include <arch/mm/asid.h>
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <adt/list.h>
-
-static size_t asids_allocated = 0;
-
-/** Allocate free address space identifier.
- *
- * @return New ASID.
- */
-asid_t asid_get(void)
-{
-	asid_t asid;
-	link_t *tmp;
-	as_t *as;
-
-	assert(interrupts_disabled());
-	assert(spinlock_locked(&asidlock));
-
-	/*
-	 * Check if there is an unallocated ASID.
-	 */
-
-	if (asids_allocated == ASIDS_ALLOCABLE) {
-
-		/*
-		 * All ASIDs are already allocated.
-		 * Resort to stealing.
-		 */
-
-		/*
-		 * Remove the first item on the list.
-		 * It is guaranteed to belong to an
-		 * inactive address space.
-		 */
-		tmp = list_first(&inactive_as_with_asid_list);
-		assert(tmp != NULL);
-		list_remove(tmp);
-
-		as = list_get_instance(tmp, as_t, inactive_as_with_asid_link);
-
-		/*
-		 * Steal the ASID.
-		 * Note that the stolen ASID is not active.
-		 */
-		asid = as->asid;
-		assert(asid != ASID_INVALID);
-
-		/*
-		 * Notify the address space from wich the ASID
-		 * was stolen by invalidating its asid member.
-		 */
-		as->asid = ASID_INVALID;
-
-		/*
-		 * If the architecture uses some software cache
-		 * of TLB entries (e.g. TSB on sparc64), the
-		 * cache must be invalidated as well.
-		 */
-		as_invalidate_translation_cache(as, 0, (size_t) -1);
-
-		/*
-		 * Get the system rid of the stolen ASID.
-		 */
-		ipl_t ipl = tlb_shootdown_start(TLB_INVL_ASID, asid, 0, 0);
-		tlb_invalidate_asid(asid);
-		tlb_shootdown_finalize(ipl);
-	} else {
-
-		/*
-		 * There is at least one unallocated ASID.
-		 * Find it and assign it.
-		 */
-
-		asid = asid_find_free();
-		asids_allocated++;
-
-		/*
-		 * Purge the allocated ASID from TLBs.
-		 */
-		ipl_t ipl = tlb_shootdown_start(TLB_INVL_ASID, asid, 0, 0);
-		tlb_invalidate_asid(asid);
-		tlb_shootdown_finalize(ipl);
-	}
-
-	return asid;
-}
-
-/** Release address space identifier.
- *
- * This code relies on architecture
- * dependent functionality.
- *
- * @param asid ASID to be released.
- */
-void asid_put(asid_t asid)
-{
-	asids_allocated--;
-	asid_put_arch(asid);
-}
-
-/** @}
- */
Index: rnel/genarch/src/mm/asid_fifo.c
===================================================================
--- kernel/genarch/src/mm/asid_fifo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief	FIFO queue ASID management.
- *
- * Architectures that link with this file keep the unallocated ASIDs
- * in FIFO queue. The queue can be statically (e.g. mips32) or
- * dynamically allocated (e.g ia64 and sparc64).
- */
-
-#include <genarch/mm/asid_fifo.h>
-#include <arch/mm/asid.h>
-#include <mm/asid.h>
-#include <adt/fifo.h>
-
-#define FIFO_STATIC_LIMIT	1024
-#define FIFO_STATIC		(ASIDS_ALLOCABLE<FIFO_STATIC_LIMIT)
-
-/**
- * FIFO queue containing unassigned ASIDs.
- * Can be only accessed when asidlock is held.
- */
-#if FIFO_STATIC
-FIFO_INITIALIZE_STATIC(free_asids, asid_t, ASIDS_ALLOCABLE);
-#else
-FIFO_INITIALIZE_DYNAMIC(free_asids, asid_t, ASIDS_ALLOCABLE);
-#endif
-
-/** Initialize data structures for O(1) ASID allocation and deallocation. */
-void asid_fifo_init(void)
-{
-	int i;
-
-#if (!FIFO_STATIC)
-	fifo_create(free_asids);
-	if (!free_asids.fifo)
-		panic("Not enough memory to allocate ASID FIFO");
-	// TODO: There really is no reason not to statically allocate it
-	//       except to keep binary size low. Once kernel is a regular ELF
-	//       binary supporting .bss section (wip as of the late 2018),
-	//       the dynamic option should be removed.
-#endif
-
-	for (i = 0; i < ASIDS_ALLOCABLE; i++) {
-		fifo_push(free_asids, ASID_START + i);
-	}
-}
-
-/** Allocate free ASID.
- *
- * Allocation runs in O(1).
- *
- * @return Free ASID.
- */
-asid_t asid_find_free(void)
-{
-	return fifo_pop(free_asids);
-}
-
-/** Return ASID among free ASIDs.
- *
- * This operation runs in O(1).
- *
- * @param asid ASID being freed.
- */
-void asid_put_arch(asid_t asid)
-{
-	fifo_push(free_asids, asid);
-}
-
-/** @}
- */
Index: rnel/genarch/src/mm/page_ht.c
===================================================================
--- kernel/genarch/src/mm/page_ht.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief Virtual Address Translation (VAT) for global page hash table.
- */
-
-#include <genarch/mm/page_ht.h>
-#include <mm/page.h>
-#include <arch/mm/page.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <mm/as.h>
-#include <arch/mm/asid.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <barrier.h>
-#include <synch/spinlock.h>
-#include <arch.h>
-#include <assert.h>
-#include <adt/hash.h>
-#include <adt/hash_table.h>
-#include <align.h>
-
-static size_t ht_hash(const ht_link_t *);
-static size_t ht_key_hash(const void *);
-static bool ht_key_equal(const void *, size_t, const ht_link_t *);
-static void ht_remove_callback(ht_link_t *);
-
-static void ht_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int);
-static void ht_mapping_remove(as_t *, uintptr_t);
-static bool ht_mapping_find(as_t *, uintptr_t, bool, pte_t *);
-static void ht_mapping_update(as_t *, uintptr_t, bool, pte_t *);
-static void ht_mapping_make_global(uintptr_t, size_t);
-
-slab_cache_t *pte_cache = NULL;
-
-/**
- * This lock protects the page hash table. It must be acquired
- * after address space lock and after any address space area
- * locks.
- *
- */
-IRQ_SPINLOCK_STATIC_INITIALIZE(page_ht_lock);
-
-/** Page hash table.
- *
- * The page hash table may be accessed only when page_ht_lock is held.
- *
- */
-hash_table_t page_ht;
-
-/** Hash table operations for page hash table. */
-const hash_table_ops_t ht_ops = {
-	.hash = ht_hash,
-	.key_hash = ht_key_hash,
-	.key_equal = ht_key_equal,
-	.remove_callback = ht_remove_callback
-};
-
-/** Page mapping operations for page hash table architectures. */
-const page_mapping_operations_t ht_mapping_operations = {
-	.mapping_insert = ht_mapping_insert,
-	.mapping_remove = ht_mapping_remove,
-	.mapping_find = ht_mapping_find,
-	.mapping_update = ht_mapping_update,
-	.mapping_make_global = ht_mapping_make_global
-};
-
-/** Return the hash of the key stored in the item */
-size_t ht_hash(const ht_link_t *item)
-{
-	pte_t *pte = hash_table_get_inst(item, pte_t, link);
-	size_t hash = 0;
-	hash = hash_combine(hash, (uintptr_t) pte->as);
-	hash = hash_combine(hash, pte->page >> PAGE_WIDTH);
-	return hash;
-}
-
-/** Return the hash of the key. */
-size_t ht_key_hash(const void *arg)
-{
-	const uintptr_t *key = arg;
-	size_t hash = 0;
-	hash = hash_combine(hash, key[KEY_AS]);
-	hash = hash_combine(hash, key[KEY_PAGE] >> PAGE_WIDTH);
-	return hash;
-}
-
-/** Return true if the key is equal to the item's lookup key. */
-bool ht_key_equal(const void *arg, size_t hash, const ht_link_t *item)
-{
-	const uintptr_t *key = arg;
-	pte_t *pte = hash_table_get_inst(item, pte_t, link);
-	return (key[KEY_AS] == (uintptr_t) pte->as) &&
-	    (key[KEY_PAGE] == pte->page);
-}
-
-/** Callback on page hash table item removal.
- *
- * @param item Page hash table item being removed.
- *
- */
-void ht_remove_callback(ht_link_t *item)
-{
-	assert(item);
-
-	pte_t *pte = hash_table_get_inst(item, pte_t, link);
-	slab_free(pte_cache, pte);
-}
-
-/** Map page to frame using page hash table.
- *
- * Map virtual address page to physical address frame
- * using flags.
- *
- * @param as    Address space to which page belongs.
- * @param page  Virtual address of the page to be mapped.
- * @param frame Physical address of memory frame to which the mapping is done.
- * @param flags Flags to be used for mapping.
- *
- */
-void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame,
-    unsigned int flags)
-{
-	uintptr_t key[2] = {
-		[KEY_AS] = (uintptr_t) as,
-		[KEY_PAGE] = ALIGN_DOWN(page, PAGE_SIZE)
-	};
-
-	assert(page_table_locked(as));
-
-	irq_spinlock_lock(&page_ht_lock, true);
-
-	if (!hash_table_find(&page_ht, key)) {
-		pte_t *pte = slab_alloc(pte_cache, FRAME_LOWMEM | FRAME_ATOMIC);
-		assert(pte != NULL);
-
-		pte->g = (flags & PAGE_GLOBAL) != 0;
-		pte->x = (flags & PAGE_EXEC) != 0;
-		pte->w = (flags & PAGE_WRITE) != 0;
-		pte->k = !(flags & PAGE_USER);
-		pte->c = (flags & PAGE_CACHEABLE) != 0;
-		pte->p = !(flags & PAGE_NOT_PRESENT);
-		pte->a = false;
-		pte->d = false;
-
-		pte->as = as;
-		pte->page = ALIGN_DOWN(page, PAGE_SIZE);
-		pte->frame = ALIGN_DOWN(frame, FRAME_SIZE);
-
-		/*
-		 * Make sure that a concurrent ht_mapping_find() will see the
-		 * new entry only after it is fully initialized.
-		 */
-		write_barrier();
-
-		hash_table_insert(&page_ht, &pte->link);
-	}
-
-	irq_spinlock_unlock(&page_ht_lock, true);
-}
-
-/** Remove mapping of page from page hash table.
- *
- * Remove any mapping of page within address space as.
- * TLB shootdown should follow in order to make effects of
- * this call visible.
- *
- * @param as   Address space to which page belongs.
- * @param page Virtual address of the page to be demapped.
- *
- */
-void ht_mapping_remove(as_t *as, uintptr_t page)
-{
-	uintptr_t key[2] = {
-		[KEY_AS] = (uintptr_t) as,
-		[KEY_PAGE] = ALIGN_DOWN(page, PAGE_SIZE)
-	};
-
-	assert(page_table_locked(as));
-
-	irq_spinlock_lock(&page_ht_lock, true);
-
-	/*
-	 * Note that removed PTE's will be freed
-	 * by remove_callback().
-	 */
-	hash_table_remove(&page_ht, key);
-
-	irq_spinlock_unlock(&page_ht_lock, true);
-}
-
-static pte_t *ht_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
-{
-	uintptr_t key[2] = {
-		[KEY_AS] = (uintptr_t) as,
-		[KEY_PAGE] = ALIGN_DOWN(page, PAGE_SIZE)
-	};
-
-	assert(nolock || page_table_locked(as));
-
-	ht_link_t *cur = hash_table_find(&page_ht, key);
-	if (cur)
-		return hash_table_get_inst(cur, pte_t, link);
-
-	return NULL;
-}
-
-/** Find mapping for virtual page in page hash table.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param[out] pte Structure that will receive a copy of the found PTE.
- *
- * @return True if the mapping was found, false otherwise.
- */
-bool ht_mapping_find(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
-{
-	irq_spinlock_lock(&page_ht_lock, true);
-
-	pte_t *t = ht_mapping_find_internal(as, page, nolock);
-	if (t)
-		*pte = *t;
-
-	irq_spinlock_unlock(&page_ht_lock, true);
-
-	return t != NULL;
-}
-
-/** Update mapping for virtual page in page hash table.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param pte      New PTE.
- */
-void ht_mapping_update(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
-{
-	irq_spinlock_lock(&page_ht_lock, true);
-
-	pte_t *t = ht_mapping_find_internal(as, page, nolock);
-	if (!t)
-		panic("Updating non-existent PTE");
-
-	assert(pte->as == t->as);
-	assert(pte->page == t->page);
-	assert(pte->frame == t->frame);
-	assert(pte->g == t->g);
-	assert(pte->x == t->x);
-	assert(pte->w == t->w);
-	assert(pte->k == t->k);
-	assert(pte->c == t->c);
-	assert(pte->p == t->p);
-
-	t->a = pte->a;
-	t->d = pte->d;
-
-	irq_spinlock_unlock(&page_ht_lock, true);
-}
-
-void ht_mapping_make_global(uintptr_t base, size_t size)
-{
-	/* nothing to do */
-}
-
-/** @}
- */
Index: rnel/genarch/src/mm/page_pt.c
===================================================================
--- kernel/genarch/src/mm/page_pt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,439 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch_mm
- * @{
- */
-
-/**
- * @file
- * @brief Virtual Address Translation for hierarchical 4-level page tables.
- */
-
-#include <assert.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/km.h>
-#include <mm/as.h>
-#include <arch/mm/page.h>
-#include <arch/mm/as.h>
-#include <barrier.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <memw.h>
-#include <align.h>
-#include <macros.h>
-#include <bitops.h>
-
-static void pt_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int);
-static void pt_mapping_remove(as_t *, uintptr_t);
-static bool pt_mapping_find(as_t *, uintptr_t, bool, pte_t *pte);
-static void pt_mapping_update(as_t *, uintptr_t, bool, pte_t *pte);
-static void pt_mapping_make_global(uintptr_t, size_t);
-
-const page_mapping_operations_t pt_mapping_operations = {
-	.mapping_insert = pt_mapping_insert,
-	.mapping_remove = pt_mapping_remove,
-	.mapping_find = pt_mapping_find,
-	.mapping_update = pt_mapping_update,
-	.mapping_make_global = pt_mapping_make_global
-};
-
-/** Map page to frame using hierarchical page tables.
- *
- * Map virtual address page to physical address frame
- * using flags.
- *
- * @param as    Address space to wich page belongs.
- * @param page  Virtual address of the page to be mapped.
- * @param frame Physical address of memory frame to which the mapping is done.
- * @param flags Flags to be used for mapping.
- *
- */
-void pt_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame,
-    unsigned int flags)
-{
-	pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
-
-	assert(page_table_locked(as));
-
-	if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT) {
-		pte_t *newpt = (pte_t *)
-		    PA2KA(frame_alloc(PTL1_FRAMES, FRAME_LOWMEM, PTL1_SIZE - 1));
-		memsetb(newpt, PTL1_SIZE, 0);
-		SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page), KA2PA(newpt));
-		SET_PTL1_FLAGS(ptl0, PTL0_INDEX(page),
-		    PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
-		    PAGE_WRITE);
-		/*
-		 * Make sure that a concurrent hardware page table walk or
-		 * pt_mapping_find() will see the new PTL1 only after it is
-		 * fully initialized.
-		 */
-		write_barrier();
-		SET_PTL1_PRESENT(ptl0, PTL0_INDEX(page));
-	}
-
-	pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
-
-	if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT) {
-		pte_t *newpt = (pte_t *)
-		    PA2KA(frame_alloc(PTL2_FRAMES, FRAME_LOWMEM, PTL2_SIZE - 1));
-		memsetb(newpt, PTL2_SIZE, 0);
-		SET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page), KA2PA(newpt));
-		SET_PTL2_FLAGS(ptl1, PTL1_INDEX(page),
-		    PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
-		    PAGE_WRITE);
-		/*
-		 * Make the new PTL2 visible only after it is fully initialized.
-		 */
-		write_barrier();
-		SET_PTL2_PRESENT(ptl1, PTL1_INDEX(page));
-	}
-
-	pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
-
-	if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT) {
-		pte_t *newpt = (pte_t *)
-		    PA2KA(frame_alloc(PTL3_FRAMES, FRAME_LOWMEM, PTL2_SIZE - 1));
-		memsetb(newpt, PTL2_SIZE, 0);
-		SET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page), KA2PA(newpt));
-		SET_PTL3_FLAGS(ptl2, PTL2_INDEX(page),
-		    PAGE_NOT_PRESENT | PAGE_USER | PAGE_EXEC | PAGE_CACHEABLE |
-		    PAGE_WRITE);
-		/*
-		 * Make the new PTL3 visible only after it is fully initialized.
-		 */
-		write_barrier();
-		SET_PTL3_PRESENT(ptl2, PTL2_INDEX(page));
-	}
-
-	pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
-
-	SET_FRAME_ADDRESS(ptl3, PTL3_INDEX(page), frame);
-	SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), flags | PAGE_NOT_PRESENT);
-	/*
-	 * Make the new mapping visible only after it is fully initialized.
-	 */
-	write_barrier();
-	SET_FRAME_PRESENT(ptl3, PTL3_INDEX(page));
-}
-
-/** Remove mapping of page from hierarchical page tables.
- *
- * Remove any mapping of page within address space as.
- * TLB shootdown should follow in order to make effects of
- * this call visible.
- *
- * Empty page tables except PTL0 are freed.
- *
- * @param as   Address space to wich page belongs.
- * @param page Virtual address of the page to be demapped.
- *
- */
-void pt_mapping_remove(as_t *as, uintptr_t page)
-{
-	assert(page_table_locked(as));
-
-	/*
-	 * First, remove the mapping, if it exists.
-	 */
-
-	pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
-	if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
-		return;
-
-	pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
-	if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
-		return;
-
-	pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
-	if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
-		return;
-
-	pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
-
-	/*
-	 * Destroy the mapping.
-	 * Setting to PAGE_NOT_PRESENT is not sufficient.
-	 * But we need SET_FRAME for possible PT coherence maintenance.
-	 * At least on ARM.
-	 */
-	//TODO: Fix this inconsistency
-	SET_FRAME_FLAGS(ptl3, PTL3_INDEX(page), PAGE_NOT_PRESENT);
-	memsetb(&ptl3[PTL3_INDEX(page)], sizeof(pte_t), 0);
-
-	/*
-	 * Second, free all empty tables along the way from PTL3 down to PTL0
-	 * except those needed for sharing the kernel non-identity mappings.
-	 */
-
-	/* Check PTL3 */
-	bool empty = true;
-
-	unsigned int i;
-	for (i = 0; i < PTL3_ENTRIES; i++) {
-		if (PTE_VALID(&ptl3[i])) {
-			empty = false;
-			break;
-		}
-	}
-
-	if (empty) {
-		/*
-		 * PTL3 is empty.
-		 * Release the frame and remove PTL3 pointer from the parent
-		 * table.
-		 */
-#if (PTL2_ENTRIES != 0)
-		memsetb(&ptl2[PTL2_INDEX(page)], sizeof(pte_t), 0);
-#elif (PTL1_ENTRIES != 0)
-		memsetb(&ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0);
-#else
-		if (km_is_non_identity(page))
-			return;
-
-		memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
-#endif
-		frame_free(KA2PA((uintptr_t) ptl3), PTL3_FRAMES);
-	} else {
-		/*
-		 * PTL3 is not empty.
-		 * Therefore, there must be a path from PTL0 to PTL3 and
-		 * thus nothing to free in higher levels.
-		 *
-		 */
-		return;
-	}
-
-	/* Check PTL2, empty is still true */
-#if (PTL2_ENTRIES != 0)
-	for (i = 0; i < PTL2_ENTRIES; i++) {
-		if (PTE_VALID(&ptl2[i])) {
-			empty = false;
-			break;
-		}
-	}
-
-	if (empty) {
-		/*
-		 * PTL2 is empty.
-		 * Release the frame and remove PTL2 pointer from the parent
-		 * table.
-		 */
-#if (PTL1_ENTRIES != 0)
-		memsetb(&ptl1[PTL1_INDEX(page)], sizeof(pte_t), 0);
-#else
-		if (km_is_non_identity(page))
-			return;
-
-		memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
-#endif
-		frame_free(KA2PA((uintptr_t) ptl2), PTL2_FRAMES);
-	} else {
-		/*
-		 * PTL2 is not empty.
-		 * Therefore, there must be a path from PTL0 to PTL2 and
-		 * thus nothing to free in higher levels.
-		 *
-		 */
-		return;
-	}
-#endif /* PTL2_ENTRIES != 0 */
-
-	/* check PTL1, empty is still true */
-#if (PTL1_ENTRIES != 0)
-	for (i = 0; i < PTL1_ENTRIES; i++) {
-		if (PTE_VALID(&ptl1[i])) {
-			empty = false;
-			break;
-		}
-	}
-
-	if (empty) {
-		/*
-		 * PTL1 is empty.
-		 * Release the frame and remove PTL1 pointer from the parent
-		 * table.
-		 */
-		if (km_is_non_identity(page))
-			return;
-
-		memsetb(&ptl0[PTL0_INDEX(page)], sizeof(pte_t), 0);
-		frame_free(KA2PA((uintptr_t) ptl1), PTL1_FRAMES);
-	}
-#endif /* PTL1_ENTRIES != 0 */
-}
-
-static pte_t *pt_mapping_find_internal(as_t *as, uintptr_t page, bool nolock)
-{
-	assert(nolock || page_table_locked(as));
-
-	pte_t *ptl0 = (pte_t *) PA2KA((uintptr_t) as->genarch.page_table);
-	if (GET_PTL1_FLAGS(ptl0, PTL0_INDEX(page)) & PAGE_NOT_PRESENT)
-		return NULL;
-
-	read_barrier();
-
-	pte_t *ptl1 = (pte_t *) PA2KA(GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(page)));
-	if (GET_PTL2_FLAGS(ptl1, PTL1_INDEX(page)) & PAGE_NOT_PRESENT)
-		return NULL;
-
-#if (PTL1_ENTRIES != 0)
-	/*
-	 * Always read ptl2 only after we are sure it is present.
-	 */
-	read_barrier();
-#endif
-
-	pte_t *ptl2 = (pte_t *) PA2KA(GET_PTL2_ADDRESS(ptl1, PTL1_INDEX(page)));
-	if (GET_PTL3_FLAGS(ptl2, PTL2_INDEX(page)) & PAGE_NOT_PRESENT)
-		return NULL;
-
-#if (PTL2_ENTRIES != 0)
-	/*
-	 * Always read ptl3 only after we are sure it is present.
-	 */
-	read_barrier();
-#endif
-
-	pte_t *ptl3 = (pte_t *) PA2KA(GET_PTL3_ADDRESS(ptl2, PTL2_INDEX(page)));
-
-	return &ptl3[PTL3_INDEX(page)];
-}
-
-/** Find mapping for virtual page in hierarchical page tables.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param[out] pte Structure that will receive a copy of the found PTE.
- *
- * @return True if the mapping was found, false otherwise.
- */
-bool pt_mapping_find(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
-{
-	pte_t *t = pt_mapping_find_internal(as, page, nolock);
-	if (t)
-		*pte = *t;
-	return t != NULL;
-}
-
-/** Update mapping for virtual page in hierarchical page tables.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param[in] pte  New PTE.
- */
-void pt_mapping_update(as_t *as, uintptr_t page, bool nolock, pte_t *pte)
-{
-	pte_t *t = pt_mapping_find_internal(as, page, nolock);
-	if (!t)
-		panic("Updating non-existent PTE");
-
-	assert(PTE_VALID(t) == PTE_VALID(pte));
-	assert(PTE_PRESENT(t) == PTE_PRESENT(pte));
-	assert(PTE_GET_FRAME(t) == PTE_GET_FRAME(pte));
-	assert(PTE_WRITABLE(t) == PTE_WRITABLE(pte));
-	assert(PTE_EXECUTABLE(t) == PTE_EXECUTABLE(pte));
-
-	*t = *pte;
-}
-
-/** Return the size of the region mapped by a single PTL0 entry.
- *
- * @return Size of the region mapped by a single PTL0 entry.
- */
-static uintptr_t ptl0_step_get(void)
-{
-	size_t va_bits;
-
-	va_bits = fnzb(PTL0_ENTRIES) + fnzb(PTL1_ENTRIES) + fnzb(PTL2_ENTRIES) +
-	    fnzb(PTL3_ENTRIES) + PAGE_WIDTH;
-
-	return 1UL << (va_bits - fnzb(PTL0_ENTRIES));
-}
-
-/** Make the mappings in the given range global accross all address spaces.
- *
- * All PTL0 entries in the given range will be mapped to a next level page
- * table. The next level page table will be allocated and cleared.
- *
- * pt_mapping_remove() will never deallocate these page tables even when there
- * are no PTEs in them.
- *
- * @param as   Address space.
- * @param base Base address corresponding to the first PTL0 entry that will be
- *             altered by this function.
- * @param size Size in bytes defining the range of PTL0 entries that will be
- *             altered by this function.
- *
- */
-void pt_mapping_make_global(uintptr_t base, size_t size)
-{
-	assert(size > 0);
-
-	uintptr_t ptl0 = PA2KA((uintptr_t) AS_KERNEL->genarch.page_table);
-	uintptr_t ptl0_step = ptl0_step_get();
-	size_t frames;
-
-#if (PTL1_ENTRIES != 0)
-	frames = PTL1_FRAMES;
-#elif (PTL2_ENTRIES != 0)
-	frames = PTL2_FRAMES;
-#else
-	frames = PTL3_FRAMES;
-#endif
-
-	for (uintptr_t addr = ALIGN_DOWN(base, ptl0_step);
-	    addr - 1 < base + size - 1;
-	    addr += ptl0_step) {
-		if (GET_PTL1_ADDRESS(ptl0, PTL0_INDEX(addr)) != 0) {
-			assert(overlaps(addr, ptl0_step,
-			    config.identity_base, config.identity_size));
-
-			/*
-			 * This PTL0 entry also maps the kernel identity region,
-			 * so it is already global and initialized.
-			 */
-			continue;
-		}
-
-		uintptr_t l1 = PA2KA(frame_alloc(frames, FRAME_LOWMEM, 0));
-		memsetb((void *) l1, FRAMES2SIZE(frames), 0);
-		SET_PTL1_ADDRESS(ptl0, PTL0_INDEX(addr), KA2PA(l1));
-		SET_PTL1_FLAGS(ptl0, PTL0_INDEX(addr),
-		    PAGE_PRESENT | PAGE_USER | PAGE_CACHEABLE |
-		    PAGE_EXEC | PAGE_WRITE | PAGE_READ);
-	}
-}
-
-/** @}
- */
Index: rnel/genarch/src/multiboot/common.c
===================================================================
--- kernel/genarch/src/multiboot/common.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <genarch/multiboot/multiboot.h>
-#include <config.h>
-#include <stddef.h>
-
-void multiboot_cmdline(const char *cmdline)
-{
-	/*
-	 * GRUB passes the command line in an escaped form.
-	 */
-	for (size_t i = 0, j = 0;
-	    cmdline[i] && j < CONFIG_BOOT_ARGUMENTS_BUFLEN;
-	    i++, j++) {
-		if (cmdline[i] == '\\') {
-			switch (cmdline[i + 1]) {
-			case '\\':
-			case '\'':
-			case '\"':
-				i++;
-				break;
-			}
-		}
-		bargs[j] = cmdline[i];
-	}
-}
-
-/** @}
- */
Index: rnel/genarch/src/multiboot/multiboot.c
===================================================================
--- kernel/genarch/src/multiboot/multiboot.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <typedefs.h>
-#include <genarch/multiboot/multiboot.h>
-#include <config.h>
-#include <stddef.h>
-#include <str.h>
-
-/** Extract command name from the multiboot module command line.
- *
- * @param buf      Destination buffer (will be always NULL-terminated).
- * @param size     Size of destination buffer (in bytes).
- * @param cmd_line Input string (the command line).
- *
- */
-void multiboot_extract_command(char *buf, size_t size, const char *cmd_line)
-{
-	/* Find the first space. */
-	const char *end = str_chr(cmd_line, ' ');
-	if (end == NULL)
-		end = cmd_line + str_size(cmd_line);
-
-	/*
-	 * Find last occurence of '/' before 'end'. If found, place start at
-	 * next character. Otherwise, place start at beginning of command line.
-	 */
-	const char *cp = end;
-	const char *start = cmd_line;
-
-	while (cp != start) {
-		if (*cp == '/') {
-			start = cp + 1;
-			break;
-		}
-		cp--;
-	}
-
-	/* Copy the command. */
-	str_ncpy(buf, size, start, (size_t) (end - start));
-}
-
-/** Extract arguments from the multiboot module command line.
- *
- * @param buf      Destination buffer (will be always NULL-terminated).
- * @param size     Size of destination buffer (in bytes).
- * @param cmd_line Input string (the command line).
- *
- */
-void multiboot_extract_argument(char *buf, size_t size, const char *cmd_line)
-{
-	/* Start after first space. */
-	const char *start = str_chr(cmd_line, ' ');
-	if (start == NULL) {
-		str_cpy(buf, size, "");
-		return;
-	}
-
-	const char *end = cmd_line + str_size(cmd_line);
-
-	/* Skip the space(s). */
-	while (start != end) {
-		if (start[0] == ' ')
-			start++;
-		else
-			break;
-	}
-
-	str_ncpy(buf, size, start, (size_t) (end - start));
-}
-
-static void multiboot_modules(uint32_t count, multiboot_module_t *mods)
-{
-	for (uint32_t i = 0; i < count; i++) {
-		if (init.cnt >= CONFIG_INIT_TASKS)
-			break;
-
-		init.tasks[init.cnt].paddr = mods[i].start;
-		init.tasks[init.cnt].size = mods[i].end - mods[i].start;
-
-		/* Copy command line, if available. */
-		if (mods[i].string) {
-			multiboot_extract_command(init.tasks[init.cnt].name,
-			    CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string));
-			multiboot_extract_argument(init.tasks[init.cnt].arguments,
-			    CONFIG_TASK_ARGUMENTS_BUFLEN, MULTIBOOT_PTR(mods[i].string));
-		} else {
-			init.tasks[init.cnt].name[0] = 0;
-			init.tasks[init.cnt].arguments[0] = 0;
-		}
-
-		init.cnt++;
-	}
-}
-
-static void multiboot_memmap(uint32_t length, multiboot_memmap_t *memmap)
-{
-	uint32_t pos = 0;
-
-	while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
-		e820table[e820counter] = memmap->mm_info;
-
-		/* Compute address of next structure. */
-		uint32_t size = sizeof(memmap->size) + memmap->size;
-		memmap = (multiboot_memmap_t *) ((uintptr_t) memmap + size);
-		pos += size;
-
-		e820counter++;
-	}
-}
-
-/** Parse multiboot information structure.
- *
- * If @a signature does not contain a valid multiboot signature,
- * assumes no multiboot information is available.
- *
- * @param signature Should contain the multiboot signature.
- * @param info      Multiboot information structure.
- *
- */
-void multiboot_info_parse(uint32_t signature, const multiboot_info_t *info)
-{
-	if (signature != MULTIBOOT_LOADER_MAGIC)
-		return;
-
-	/* Copy command line. */
-	if ((info->flags & MULTIBOOT_INFO_FLAGS_CMDLINE) != 0)
-		multiboot_cmdline((char *) MULTIBOOT_PTR(info->cmd_line));
-
-	/* Copy modules information. */
-	if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0)
-		multiboot_modules(info->mods_count,
-		    (multiboot_module_t *) MULTIBOOT_PTR(info->mods_addr));
-
-	/* Copy memory map. */
-	if ((info->flags & MULTIBOOT_INFO_FLAGS_MMAP) != 0)
-		multiboot_memmap(info->mmap_length,
-		    (multiboot_memmap_t *) MULTIBOOT_PTR(info->mmap_addr));
-}
-
-/** @}
- */
Index: rnel/genarch/src/multiboot/multiboot2.c
===================================================================
--- kernel/genarch/src/multiboot/multiboot2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <typedefs.h>
-#include <genarch/multiboot/multiboot.h>
-#include <genarch/multiboot/multiboot2.h>
-#include <genarch/fb/bfb.h>
-#include <config.h>
-#include <align.h>
-
-#define MULTIBOOT2_TAG_ALIGN  8
-
-static void multiboot2_cmdline(const multiboot2_cmdline_t *module)
-{
-	multiboot_cmdline(module->string);
-}
-
-static void multiboot2_module(const multiboot2_module_t *module)
-{
-	if (init.cnt < CONFIG_INIT_TASKS) {
-		init.tasks[init.cnt].paddr = module->start;
-		init.tasks[init.cnt].size = module->end - module->start;
-		multiboot_extract_command(init.tasks[init.cnt].name,
-		    CONFIG_TASK_NAME_BUFLEN, module->string);
-		multiboot_extract_argument(init.tasks[init.cnt].arguments,
-		    CONFIG_TASK_ARGUMENTS_BUFLEN, module->string);
-
-		init.cnt++;
-	}
-}
-
-static void multiboot2_memmap(uint32_t length, const multiboot2_memmap_t *memmap)
-{
-	multiboot2_memmap_entry_t *entry = (multiboot2_memmap_entry_t *)
-	    ((uintptr_t) memmap + sizeof(*memmap));
-	uint32_t pos = offsetof(multiboot2_tag_t, memmap) + sizeof(*memmap);
-
-	while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) {
-		e820table[e820counter].base_address = entry->base_address;
-		e820table[e820counter].size = entry->size;
-		e820table[e820counter].type = entry->type;
-
-		/* Compute address of next entry. */
-		entry = (multiboot2_memmap_entry_t *)
-		    ((uintptr_t) entry + memmap->entry_size);
-		pos += memmap->entry_size;
-
-		e820counter++;
-	}
-}
-
-static void multiboot2_fbinfo(const multiboot2_fbinfo_t *fbinfo)
-{
-#ifdef CONFIG_FB
-	if (fbinfo->visual == MULTIBOOT2_VISUAL_RGB) {
-		bfb_addr = fbinfo->addr;
-		bfb_width = fbinfo->width;
-		bfb_height = fbinfo->height;
-		bfb_bpp = fbinfo->bpp;
-		bfb_scanline = fbinfo->scanline;
-
-		bfb_red_pos = fbinfo->rgb.red_pos;
-		bfb_red_size = fbinfo->rgb.red_size;
-
-		bfb_green_pos = fbinfo->rgb.green_pos;
-		bfb_green_size = fbinfo->rgb.green_size;
-
-		bfb_blue_pos = fbinfo->rgb.blue_pos;
-		bfb_blue_size = fbinfo->rgb.blue_size;
-	}
-#endif
-}
-
-/** Parse multiboot2 information structure.
- *
- * If @a signature does not contain a valid multiboot2 signature,
- * assumes no multiboot2 information is available.
- *
- * @param signature Should contain the multiboot2 signature.
- * @param info      Multiboot2 information structure.
- *
- */
-void multiboot2_info_parse(uint32_t signature, const multiboot2_info_t *info)
-{
-	if (signature != MULTIBOOT2_LOADER_MAGIC)
-		return;
-
-	const multiboot2_tag_t *tag = (const multiboot2_tag_t *)
-	    ALIGN_UP((uintptr_t) info + sizeof(*info), MULTIBOOT2_TAG_ALIGN);
-
-	while (tag->type != MULTIBOOT2_TAG_TERMINATOR) {
-		switch (tag->type) {
-		case MULTIBOOT2_TAG_CMDLINE:
-			multiboot2_cmdline(&tag->cmdline);
-			break;
-		case MULTIBOOT2_TAG_MODULE:
-			multiboot2_module(&tag->module);
-			break;
-		case MULTIBOOT2_TAG_MEMMAP:
-			multiboot2_memmap(tag->size, &tag->memmap);
-			break;
-		case MULTIBOOT2_TAG_FBINFO:
-			multiboot2_fbinfo(&tag->fbinfo);
-			break;
-		}
-
-		tag = (const multiboot2_tag_t *)
-		    ALIGN_UP((uintptr_t) tag + tag->size, MULTIBOOT2_TAG_ALIGN);
-	}
-}
-
-/** @}
- */
Index: rnel/genarch/src/ofw/ebus.c
===================================================================
--- kernel/genarch/src/ofw/ebus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	EBUS 'reg' and 'ranges' properties handling.
- *
- */
-
-#include <assert.h>
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/ebus.h>
-#include <genarch/ofw/pci.h>
-#include <str.h>
-#include <panic.h>
-#include <macros.h>
-
-/** Apply EBUS ranges to EBUS register. */
-bool
-ofw_ebus_apply_ranges(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uintptr_t *pa)
-{
-	ofw_tree_property_t *prop;
-	ofw_ebus_range_t *range;
-	size_t ranges;
-
-	prop = ofw_tree_getprop(node, "ranges");
-	if (!prop)
-		return false;
-
-	ranges = prop->size / sizeof(ofw_ebus_range_t);
-	range = prop->value;
-
-	unsigned int i;
-
-	for (i = 0; i < ranges; i++) {
-		if (reg->space != range[i].child_space)
-			continue;
-		if (overlaps(reg->addr, reg->size, range[i].child_base,
-		    range[i].size)) {
-			ofw_pci_reg_t pci_reg;
-
-			pci_reg.space = range[i].parent_space;
-			pci_reg.addr = range[i].parent_base +
-			    (reg->addr - range[i].child_base);
-			pci_reg.size = reg->size;
-
-			return ofw_pci_apply_ranges(node->parent, &pci_reg, pa);
-		}
-	}
-
-	return false;
-}
-
-bool
-ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg,
-    uint32_t interrupt, int *inr, cir_t *cir, void **cir_arg)
-{
-	ofw_tree_property_t *prop;
-	ofw_tree_node_t *controller;
-
-	prop = ofw_tree_getprop(node, "interrupt-map");
-	if (!prop || !prop->value)
-		return false;
-
-	ofw_ebus_intr_map_t *intr_map = prop->value;
-	size_t count = prop->size / sizeof(ofw_ebus_intr_map_t);
-
-	assert(count);
-
-	prop = ofw_tree_getprop(node, "interrupt-map-mask");
-	if (!prop || !prop->value)
-		return false;
-
-	ofw_ebus_intr_mask_t *intr_mask = prop->value;
-
-	assert(prop->size == sizeof(ofw_ebus_intr_mask_t));
-
-	uint32_t space = reg->space & intr_mask->space_mask;
-	uint32_t addr = reg->addr & intr_mask->addr_mask;
-	uint32_t intr = interrupt & intr_mask->intr_mask;
-
-	unsigned int i;
-	for (i = 0; i < count; i++) {
-		if ((intr_map[i].space == space) &&
-		    (intr_map[i].addr == addr) && (intr_map[i].intr == intr))
-			goto found;
-	}
-	return false;
-
-found:
-	/*
-	 * We found the device that functions as an interrupt controller
-	 * for the interrupt. We also found partial mapping from interrupt to
-	 * INO.
-	 */
-
-	controller = ofw_tree_find_node_by_handle(ofw_tree_lookup("/"),
-	    intr_map[i].controller_handle);
-	if (!controller)
-		return false;
-
-	if (str_cmp(ofw_tree_node_name(controller), "pci") != 0) {
-		/*
-		 * This is not a PCI node.
-		 */
-		return false;
-	}
-
-	/*
-	 * Let the PCI do the next step in mapping the interrupt.
-	 */
-	if (!ofw_pci_map_interrupt(controller, NULL, intr_map[i].controller_ino,
-	    inr, cir, cir_arg))
-		return false;
-
-	return true;
-}
-
-/** @}
- */
Index: rnel/genarch/src/ofw/ofw_tree.c
===================================================================
--- kernel/genarch/src/ofw/ofw_tree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,417 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief OpenFirmware device tree navigation.
- *
- */
-
-#include <genarch/ofw/ofw_tree.h>
-#include <stdlib.h>
-#include <sysinfo/sysinfo.h>
-#include <memw.h>
-#include <str.h>
-#include <panic.h>
-#include <stdio.h>
-
-#define PATH_MAX_LEN  256
-#define NAME_BUF_LEN  50
-
-static ofw_tree_node_t *ofw_root;
-
-void ofw_tree_init(ofw_tree_node_t *root)
-{
-	ofw_root = root;
-}
-
-/** Get OpenFirmware node property.
- *
- * @param node Node in which to lookup the property.
- * @param name Name of the property.
- *
- * @return Pointer to the property structure or NULL if no such
- *         property.
- *
- */
-ofw_tree_property_t *ofw_tree_getprop(const ofw_tree_node_t *node,
-    const char *name)
-{
-	for (size_t i = 0; i < node->properties; i++) {
-		if (str_cmp(node->property[i].name, name) == 0)
-			return &node->property[i];
-	}
-
-	return NULL;
-}
-
-/** Return value of the 'name' property.
- *
- * @param node Node of interest.
- *
- * @return Value of the 'name' property belonging to the node
- *         or NULL if the property is invalid.
- *
- */
-const char *ofw_tree_node_name(const ofw_tree_node_t *node)
-{
-	ofw_tree_property_t *prop = ofw_tree_getprop(node, "name");
-	if ((!prop) || (prop->size < 2))
-		return NULL;
-
-	return prop->value;
-}
-
-/** Lookup child of given name.
- *
- * @param node Node whose child is being looked up.
- * @param name Name of the child being looked up.
- *
- * @return NULL if there is no such child or pointer to the
- *         matching child node.
- *
- */
-ofw_tree_node_t *ofw_tree_find_child(ofw_tree_node_t *node,
-    const char *name)
-{
-	/*
-	 * Try to find the disambigued name.
-	 */
-	for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
-		if (str_cmp(cur->da_name, name) == 0)
-			return cur;
-	}
-
-	/*
-	 * Disambigued name not found.
-	 * Lets try our luck with possibly ambiguous "name" property.
-	 *
-	 * We need to do this because paths stored in "/aliases"
-	 * are not always fully-qualified.
-	 */
-	for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
-		if (str_cmp(ofw_tree_node_name(cur), name) == 0)
-			return cur;
-	}
-
-	return NULL;
-}
-
-/** Lookup first child of given device type.
- *
- * @param node  Node whose child is being looked up.
- * @param dtype Device type of the child being looked up.
- *
- * @return NULL if there is no such child or pointer to the
- *         matching child node.
- *
- */
-ofw_tree_node_t *ofw_tree_find_child_by_device_type(ofw_tree_node_t *node,
-    const char *dtype)
-{
-	for (ofw_tree_node_t *cur = node->child; cur; cur = cur->peer) {
-		ofw_tree_property_t *prop =
-		    ofw_tree_getprop(cur, "device_type");
-
-		if ((!prop) || (!prop->value))
-			continue;
-
-		if (str_cmp(prop->value, dtype) == 0)
-			return cur;
-	}
-
-	return NULL;
-}
-
-/** Lookup node with matching node_handle.
- *
- * Child nodes are looked up recursively contrary to peer nodes that
- * are looked up iteratively to avoid stack overflow.
- *
- * @param root   Root of the searched subtree.
- * @param handle OpenFirmware handle.
- *
- * @return NULL if there is no such node or pointer to the matching
- *         node.
- *
- */
-ofw_tree_node_t *ofw_tree_find_node_by_handle(ofw_tree_node_t *root,
-    phandle handle)
-{
-	for (ofw_tree_node_t *cur = root; cur; cur = cur->peer) {
-		if (cur->node_handle == handle)
-			return cur;
-
-		if (cur->child) {
-			ofw_tree_node_t *node =
-			    ofw_tree_find_node_by_handle(cur->child, handle);
-			if (node)
-				return node;
-		}
-	}
-
-	return NULL;
-}
-
-/** Lookup first peer of given device type.
- *
- * @param node  Node whose peer is being looked up.
- * @param dtype Device type of the child being looked up.
- *
- * @return NULL if there is no such child or pointer to the
- *         matching child node.
- *
- */
-ofw_tree_node_t *ofw_tree_find_peer_by_device_type(ofw_tree_node_t *node,
-    const char *dtype)
-{
-	for (ofw_tree_node_t *cur = node->peer; cur; cur = cur->peer) {
-		ofw_tree_property_t *prop =
-		    ofw_tree_getprop(cur, "device_type");
-
-		if ((!prop) || (!prop->value))
-			continue;
-
-		if (str_cmp(prop->value, dtype) == 0)
-			return cur;
-	}
-
-	return NULL;
-}
-
-/** Lookup first peer of given name.
- *
- * @param node Node whose peer is being looked up.
- * @param name Name of the child being looked up.
- *
- * @return NULL if there is no such peer or pointer to the matching
- *         peer node.
- *
- */
-ofw_tree_node_t *ofw_tree_find_peer_by_name(ofw_tree_node_t *node,
-    const char *name)
-{
-	for (ofw_tree_node_t *cur = node->peer; cur; cur = cur->peer) {
-		ofw_tree_property_t *prop =
-		    ofw_tree_getprop(cur, "name");
-
-		if ((!prop) || (!prop->value))
-			continue;
-
-		if (str_cmp(prop->value, name) == 0)
-			return cur;
-	}
-
-	return NULL;
-}
-
-/** Lookup OpenFirmware node by its path.
- *
- * @param path Path to the node.
- *
- * @return NULL if there is no such node or pointer to the leaf
- *         node.
- *
- */
-ofw_tree_node_t *ofw_tree_lookup(const char *path)
-{
-	if (path[0] != '/')
-		return NULL;
-
-	ofw_tree_node_t *node = ofw_root;
-	size_t j;
-
-	for (size_t i = 1; (i < str_size(path)) && (node); i = j + 1) {
-		j = i;
-		while (j < str_size(path) && path[j] != '/')
-			j++;
-
-		/* Skip extra slashes */
-		if (i == j)
-			continue;
-
-		char buf[NAME_BUF_LEN + 1];
-		memcpy(buf, &path[i], j - i);
-		buf[j - i] = 0;
-		node = ofw_tree_find_child(node, buf);
-	}
-
-	return node;
-}
-
-/** Walk the OpenFirmware device subtree rooted in a node.
- *
- * Child nodes are processed recursively and peer nodes are processed
- * iteratively in order to avoid stack overflow.
- *
- * @param node   Root of the subtree.
- * @param dtype  Device type to look for.
- * @param walker Routine to be invoked on found device.
- * @param arg    User argument to the walker.
- *
- * @return True if the walk should continue.
- *
- */
-static bool ofw_tree_walk_by_device_type_internal(ofw_tree_node_t *node,
-    const char *dtype, ofw_tree_walker_t walker, void *arg)
-{
-	for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
-		ofw_tree_property_t *prop =
-		    ofw_tree_getprop(cur, "device_type");
-
-		if ((prop) && (prop->value) && (str_cmp(prop->value, dtype) == 0)) {
-			bool ret = walker(cur, arg);
-			if (!ret)
-				return false;
-		}
-
-		if (cur->child) {
-			bool ret =
-			    ofw_tree_walk_by_device_type_internal(cur->child, dtype, walker, arg);
-			if (!ret)
-				return false;
-		}
-	}
-
-	return true;
-}
-
-/** Walk the OpenFirmware device tree and find devices by type.
- *
- * Walk the whole OpenFirmware device tree and if any node has
- * the property "device_type" equal to dtype, run a walker on it.
- * If the walker returns false, the walk does not continue.
- *
- * @param dtype  Device type to look for.
- * @param walker Routine to be invoked on found device.
- * @param arg    User argument to the walker.
- *
- */
-void ofw_tree_walk_by_device_type(const char *dtype, ofw_tree_walker_t walker,
-    void *arg)
-{
-	(void) ofw_tree_walk_by_device_type_internal(ofw_root, dtype, walker, arg);
-}
-
-/** Get OpenFirmware node properties.
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    OpenFirmware node.
- *
- * @return Data containing a serialized dump of all node
- *         properties. If the return value is not NULL, it
- *         should be freed in the context of the sysinfo request.
- *
- */
-static void *ofw_sysinfo_properties(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	ofw_tree_node_t *node = (ofw_tree_node_t *) data;
-
-	/* Compute serialized data size */
-	*size = 0;
-	for (size_t i = 0; i < node->properties; i++)
-		*size += str_size(node->property[i].name) + 1 +
-		    sizeof(node->property[i].size) + node->property[i].size;
-
-	if (dry_run)
-		return NULL;
-
-	void *dump = malloc(*size);
-	if (dump == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	/* Serialize the data */
-	size_t pos = 0;
-	for (size_t i = 0; i < node->properties; i++) {
-		/* Property name */
-		str_cpy(dump + pos, *size - pos, node->property[i].name);
-		pos += str_size(node->property[i].name) + 1;
-
-		/* Value size */
-		memcpy(dump + pos, &node->property[i].size,
-		    sizeof(node->property[i].size));
-		pos += sizeof(node->property[i].size);
-
-		/* Value */
-		memcpy(dump + pos, node->property[i].value,
-		    node->property[i].size);
-		pos += node->property[i].size;
-	}
-
-	return ((void *) dump);
-}
-
-/** Map OpenFirmware device subtree rooted in a node into sysinfo.
- *
- * Child nodes are processed recursively and peer nodes are processed
- * iteratively in order to avoid stack overflow.
- *
- * @param node Root of the subtree.
- * @param path Current path, NULL for the very root of the entire tree.
- *
- */
-static void ofw_tree_node_sysinfo(ofw_tree_node_t *node, const char *path)
-{
-	char *cur_path = malloc(PATH_MAX_LEN);
-	if (!cur_path)
-		panic("Not enough memory to process OFW tree.");
-
-	for (ofw_tree_node_t *cur = node; cur; cur = cur->peer) {
-		if ((cur->parent) && (path))
-			snprintf(cur_path, PATH_MAX_LEN, "%s.%s", path, cur->da_name);
-		else if (!str_size(cur->da_name))
-			snprintf(cur_path, PATH_MAX_LEN, "firmware.ofw");
-		else
-			snprintf(cur_path, PATH_MAX_LEN, "firmware.%s", cur->da_name);
-
-		sysinfo_set_item_gen_data(cur_path, NULL, ofw_sysinfo_properties,
-		    (void *) cur);
-
-		if (cur->child)
-			ofw_tree_node_sysinfo(cur->child, cur_path);
-	}
-
-	free(cur_path);
-}
-
-/** Map the OpenFirmware device tree into sysinfo. */
-void ofw_sysinfo_map(void)
-{
-	ofw_tree_node_sysinfo(ofw_root, NULL);
-}
-
-/** @}
- */
Index: rnel/genarch/src/ofw/pci.c
===================================================================
--- kernel/genarch/src/ofw/pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	PCI 'reg' and 'ranges' properties handling.
- *
- */
-
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/pci.h>
-#include <arch/drivers/pci.h>
-#include <arch/trap/interrupt.h>
-#include <str.h>
-#include <panic.h>
-#include <macros.h>
-
-#define PCI_SPACE_MASK		0x03000000
-#define PCI_ABS_MASK		0x80000000
-#define PCI_REG_MASK		0x000000ff
-
-#define PCI_IGN			0x1f
-
-bool
-ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa)
-{
-	ofw_tree_property_t *prop;
-	ofw_pci_range_t *range;
-	size_t ranges;
-
-	prop = ofw_tree_getprop(node, "ranges");
-	if (!prop) {
-		if (str_cmp(ofw_tree_node_name(node->parent), "pci") == 0)
-			return ofw_pci_apply_ranges(node->parent, reg, pa);
-		return false;
-	}
-
-	ranges = prop->size / sizeof(ofw_pci_range_t);
-	range = prop->value;
-
-	unsigned int i;
-
-	for (i = 0; i < ranges; i++) {
-		if ((reg->space & PCI_SPACE_MASK) !=
-		    (range[i].space & PCI_SPACE_MASK))
-			continue;
-		if (overlaps(reg->addr, reg->size, range[i].child_base,
-		    range[i].size)) {
-			*pa = range[i].parent_base +
-			    (reg->addr - range[i].child_base);
-			return true;
-		}
-	}
-
-	return false;
-}
-
-bool
-ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg,
-    ofw_pci_reg_t *out)
-{
-	if (reg->space & PCI_ABS_MASK) {
-		/* already absolute */
-		out->space = reg->space;
-		out->addr = reg->addr;
-		out->size = reg->size;
-		return true;
-	}
-
-	ofw_tree_property_t *prop;
-	ofw_pci_reg_t *assigned_address;
-	size_t assigned_addresses;
-
-	prop = ofw_tree_getprop(node, "assigned-addresses");
-	if (!prop)
-		panic("Cannot find 'assigned-addresses' property.");
-
-	assigned_addresses = prop->size / sizeof(ofw_pci_reg_t);
-	assigned_address = prop->value;
-
-	unsigned int i;
-
-	for (i = 0; i < assigned_addresses; i++) {
-		if ((assigned_address[i].space & PCI_REG_MASK) ==
-		    (reg->space & PCI_REG_MASK)) {
-			out->space = assigned_address[i].space;
-			out->addr = reg->addr + assigned_address[i].addr;
-			out->size = reg->size;
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** Map PCI interrupt.
- *
- * So far, we only know how to map interrupts of non-PCI devices connected
- * to a PCI bridge.
- */
-bool
-ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino,
-    int *inr, cir_t *cir, void **cir_arg)
-{
-	pci_t *pci = node->device;
-	if (!pci) {
-		pci = pci_init(node);
-		if (!pci)
-			return false;
-		node->device = pci;
-	}
-
-	pci_enable_interrupt(pci, ino);
-
-	*inr = (PCI_IGN << IGN_SHIFT) | ino;
-	*cir = pci_clear_interrupt;
-	*cir_arg = pci;
-
-	return true;
-}
-
-/** @}
- */
Index: rnel/genarch/src/ofw/sbus.c
===================================================================
--- kernel/genarch/src/ofw/sbus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	SBUS 'reg' and 'ranges' properties handling.
- *
- */
-
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/sbus.h>
-#include <macros.h>
-
-bool ofw_sbus_apply_ranges(ofw_tree_node_t *node, ofw_sbus_reg_t *reg,
-    uintptr_t *pa)
-{
-	ofw_tree_property_t *prop;
-	ofw_sbus_range_t *range;
-	size_t ranges;
-
-	/*
-	 * The SBUS support is very rudimentary in that we simply assume
-	 * that the SBUS bus in question is connected directly to the UPA bus.
-	 * Should we come across configurations that need more robust support,
-	 * the driver will have to be extended to handle different topologies.
-	 */
-	if (!node->parent || node->parent->parent)
-		return false;
-
-	prop = ofw_tree_getprop(node, "ranges");
-	if (!prop)
-		return false;
-
-	ranges = prop->size / sizeof(ofw_sbus_range_t);
-	range = prop->value;
-
-	unsigned int i;
-
-	for (i = 0; i < ranges; i++) {
-		if (overlaps(reg->addr, reg->size, range[i].child_base,
-		    range[i].size)) {
-			*pa = range[i].parent_base +
-			    (reg->addr - range[i].child_base);
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** @}
- */
Index: rnel/genarch/src/ofw/upa.c
===================================================================
--- kernel/genarch/src/ofw/upa.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief	UPA 'reg' and 'ranges' properties handling.
- *
- */
-
-#include <genarch/ofw/ofw_tree.h>
-#include <genarch/ofw/upa.h>
-#include <halt.h>
-#include <panic.h>
-#include <macros.h>
-#include <debug.h>
-
-bool ofw_upa_apply_ranges(ofw_tree_node_t *node, ofw_upa_reg_t *reg, uintptr_t *pa)
-{
-	*pa = reg->addr;
-	return true;
-}
-
-/** @}
- */
Index: rnel/genarch/src/softint/division.c
===================================================================
--- kernel/genarch/src/softint/division.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/** @file
- */
-
-#include <genarch/softint/division.h>
-
-#define ABSVAL(x)  ((x) > 0 ? (x) : -(x))
-#define SGN(x)     ((x) >= 0 ? 1 : 0)
-
-static unsigned int divandmod32(unsigned int a, unsigned int b,
-    unsigned int *remainder)
-{
-	unsigned int result;
-	int steps = sizeof(unsigned int) * 8;
-
-	*remainder = 0;
-	result = 0;
-
-	if (b == 0) {
-		/* FIXME: division by zero */
-		return 0;
-	}
-
-	if (a < b) {
-		*remainder = a;
-		return 0;
-	}
-
-	for (; steps > 0; steps--) {
-		/* shift one bit to remainder */
-		*remainder = ((*remainder) << 1) | ((a >> 31) & 0x1);
-		result <<= 1;
-
-		if (*remainder >= b) {
-			*remainder -= b;
-			result |= 0x1;
-		}
-		a <<= 1;
-	}
-
-	return result;
-}
-
-static unsigned long long divandmod64(unsigned long long a,
-    unsigned long long b, unsigned long long *remainder)
-{
-	unsigned long long result;
-	int steps = sizeof(unsigned long long) * 8;
-
-	*remainder = 0;
-	result = 0;
-
-	if (b == 0) {
-		/* FIXME: division by zero */
-		return 0;
-	}
-
-	if (a < b) {
-		*remainder = a;
-		return 0;
-	}
-
-	for (; steps > 0; steps--) {
-		/* shift one bit to remainder */
-		*remainder = ((*remainder) << 1) | ((a >> 63) & 0x1);
-		result <<= 1;
-
-		if (*remainder >= b) {
-			*remainder -= b;
-			result |= 0x1;
-		}
-		a <<= 1;
-	}
-
-	return result;
-}
-
-/* 32bit integer division */
-int __divsi3(int a, int b)
-{
-	unsigned int rem;
-	int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b))
-		return result;
-
-	return -result;
-}
-
-/* 64bit integer division */
-long long __divdi3(long long a, long long b)
-{
-	unsigned long long rem;
-	long long result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b))
-		return result;
-
-	return -result;
-}
-
-/* 32bit unsigned integer division */
-unsigned int __udivsi3(unsigned int a, unsigned int b)
-{
-	unsigned int rem;
-	return divandmod32(a, b, &rem);
-}
-
-/* 64bit unsigned integer division */
-unsigned long long __udivdi3(unsigned long long a, unsigned long long b)
-{
-	unsigned long long rem;
-	return divandmod64(a, b, &rem);
-}
-
-/* 32bit remainder of the signed division */
-int __modsi3(int a, int b)
-{
-	unsigned int rem;
-	divandmod32(a, b, &rem);
-
-	/* if divident is negative, remainder must be too */
-	if (!(SGN(a)))
-		return -((int) rem);
-
-	return (int) rem;
-}
-
-/* 64bit remainder of the signed division */
-long long __moddi3(long long a, long long b)
-{
-	unsigned long long rem;
-	divandmod64(a, b, &rem);
-
-	/* if divident is negative, remainder must be too */
-	if (!(SGN(a)))
-		return -((long long) rem);
-
-	return (long long) rem;
-}
-
-/* 32bit remainder of the unsigned division */
-unsigned int __umodsi3(unsigned int a, unsigned int b)
-{
-	unsigned int rem;
-	divandmod32(a, b, &rem);
-	return rem;
-}
-
-/* 64bit remainder of the unsigned division */
-unsigned long long __umoddi3(unsigned long long a, unsigned long long b)
-{
-	unsigned long long rem;
-	divandmod64(a, b, &rem);
-	return rem;
-}
-
-int __divmodsi3(int a, int b, int *c)
-{
-	unsigned int rem;
-	int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b)) {
-		*c = rem;
-		return result;
-	}
-
-	*c = -rem;
-	return -result;
-}
-
-unsigned int __udivmodsi3(unsigned int a, unsigned int b,
-    unsigned int *c)
-{
-	return divandmod32(a, b, c);
-}
-
-long long __divmoddi3(long long a, long long b, long long *c)
-{
-	unsigned long long rem;
-	long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
-
-	if (SGN(a) == SGN(b)) {
-		*c = rem;
-		return result;
-	}
-
-	*c = -rem;
-	return -result;
-}
-
-unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b,
-    unsigned long long *c)
-{
-	return divandmod64(a, b, c);
-}
-
-unsigned long long __udivmoddi4(unsigned long long a, unsigned long long b,
-    unsigned long long *c)
-{
-	return divandmod64(a, b, c);
-}
-
-/** @}
- */
Index: rnel/genarch/src/softint/multiplication.c
===================================================================
--- kernel/genarch/src/softint/multiplication.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2009 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * SW implementation of 32 and 64 bit multiplication.
- */
-
-#include <genarch/softint/multiplication.h>
-
-/** Set 1 to return MAX_INT64 or MIN_INT64 on overflow */
-#ifndef SOFTINT_CHECK_OF
-# define SOFTINT_CHECK_OF 0
-#endif
-
-#define MAX_UINT16 (0xFFFFu)
-#define MAX_UINT32 (0xFFFFFFFFu)
-#define MAX_INT64 (0x7FFFFFFFFFFFFFFFll)
-#define MIN_INT64 (0x8000000000000000ll)
-
-/**
- * Multiply two integers and return long long as result.
- * This function is overflow safe.
- * @param a
- * @param b
- * @result
- */
-static unsigned long long mul(unsigned int a, unsigned int b)
-{
-	unsigned int a1, a2, b1, b2;
-	unsigned long long t1, t2, t3;
-
-	a1 = a >> 16;
-	a2 = a & MAX_UINT16;
-	b1 = b >> 16;
-	b2 = b & MAX_UINT16;
-
-	t1 = a1 * b1;
-	t2 = a1 * b2;
-	t2 += a2 * b1;
-	t3 = a2 * b2;
-
-	t3 = (((t1 << 16) + t2) << 16) + t3;
-
-	return t3;
-}
-
-/** Emulate multiplication of two 64-bit long long integers.
- *
- */
-long long __muldi3 (long long a, long long b)
-{
-	long long result;
-	unsigned long long t1, t2;
-	unsigned long long a1, a2, b1, b2;
-	char neg = 0;
-
-	if (a < 0) {
-		neg = !neg;
-		a = -a;
-	}
-
-	if (b < 0) {
-		neg = !neg;
-		b = -b;
-	}
-
-	a1 = a >> 32;
-	b1 = b >> 32;
-
-	a2 = a & (MAX_UINT32);
-	b2 = b & (MAX_UINT32);
-
-	if (SOFTINT_CHECK_OF && (a1 != 0) && (b1 != 0)) {
-		// error, overflow
-		return (neg ? MIN_INT64 : MAX_INT64);
-	}
-
-	// (if OF checked) a1 or b1 is zero => result fits in 64 bits, no need to another overflow check
-	t1 = mul(a1, b2) + mul(b1, a2);
-
-	if (SOFTINT_CHECK_OF && t1 > MAX_UINT32) {
-		// error, overflow
-		return (neg ? MIN_INT64 : MAX_INT64);
-	}
-
-	t1 = t1 << 32;
-	t2 = mul(a2, b2);
-	t2 += t1;
-
-	/*
-	 * t2 & (1ull << 63) - if this bit is set in unsigned long long,
-	 * result does not fit in signed one
-	 */
-	if (SOFTINT_CHECK_OF && ((t2 < t1) || (t2 & (1ull << 63)))) {
-		// error, overflow
-		return (neg ? MIN_INT64 : MAX_INT64);
-	}
-
-	result = t2;
-
-	if (neg) {
-		result = -result;
-	}
-
-	return result;
-}
-
-/** @}
- */
Index: rnel/genarch/src/srln/srln.c
===================================================================
--- kernel/genarch/src/srln/srln.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_genarch
- * @{
- */
-/**
- * @file
- * @brief Serial line processing.
- */
-
-#include <assert.h>
-#include <genarch/srln/srln.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <str.h>
-#include <stdlib.h>
-
-static indev_operations_t srln_raw_ops = {
-	.poll = NULL,
-	.signal = NULL
-};
-
-static void ksrln(void *arg)
-{
-	srln_instance_t *instance = (srln_instance_t *) arg;
-	bool cr = false;
-	uint32_t escape = 0;
-
-	while (true) {
-		char32_t ch = indev_pop_character(&instance->raw);
-
-		/* ANSI escape sequence processing */
-		if (escape != 0) {
-			escape <<= 8;
-			escape |= ch & 0xff;
-
-			if ((escape == 0x1b4f) || (escape == 0x1b5b) || (escape == 0x1b5b33))
-				continue;
-
-			switch (escape) {
-			case 0x1b4f46:
-			case 0x1b5b46:
-				ch = U_END_ARROW;
-				escape = 0;
-				break;
-			case 0x1b4f48:
-			case 0x1b5b48:
-				ch = U_HOME_ARROW;
-				escape = 0;
-				break;
-			case 0x1b5b41:
-				ch = U_UP_ARROW;
-				escape = 0;
-				break;
-			case 0x1b5b42:
-				ch = U_DOWN_ARROW;
-				escape = 0;
-				break;
-			case 0x1b5b43:
-				ch = U_RIGHT_ARROW;
-				escape = 0;
-				break;
-			case 0x1b5b44:
-				ch = U_LEFT_ARROW;
-				escape = 0;
-				break;
-			case 0x1b5b337e:
-				ch = U_DELETE;
-				escape = 0;
-				break;
-			default:
-				escape = 0;
-			}
-		}
-
-		if (ch == 0x1b) {
-			escape = ch & 0xff;
-			continue;
-		}
-
-		/*
-		 * Replace carriage return with line feed
-		 * and suppress any following line feed
-		 */
-		if ((ch == '\n') && (cr)) {
-			cr = false;
-			continue;
-		}
-
-		if (ch == '\r') {
-			ch = '\n';
-			cr = true;
-		} else
-			cr = false;
-
-		/* Backspace */
-		if (ch == 0x7f)
-			ch = '\b';
-
-		indev_push_character(instance->sink, ch);
-	}
-}
-
-srln_instance_t *srln_init(void)
-{
-	srln_instance_t *instance =
-	    malloc(sizeof(srln_instance_t));
-	if (instance) {
-		instance->thread = thread_create(ksrln, (void *) instance,
-		    TASK, THREAD_FLAG_NONE, "ksrln");
-
-		if (!instance->thread) {
-			free(instance);
-			return NULL;
-		}
-
-		instance->sink = NULL;
-		indev_initialize("srln", &instance->raw, &srln_raw_ops);
-	}
-
-	return instance;
-}
-
-indev_t *srln_wire(srln_instance_t *instance, indev_t *sink)
-{
-	assert(instance);
-	assert(sink);
-
-	instance->sink = sink;
-	thread_start(instance->thread);
-
-	return &instance->raw;
-}
-
-/** @}
- */
Index: rnel/generic/common
===================================================================
--- kernel/generic/common	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../common
Index: rnel/generic/include/align.h
===================================================================
--- kernel/generic/include/align.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @ingroup others
- * @{
- */
-/**
- * @file
- * @brief Macros for making values and addresses aligned.
- */
-
-#ifndef KERN_ALIGN_H_
-#define KERN_ALIGN_H_
-
-#ifdef __ASSEMBLER__
-#define ALIGN_DOWN(s, a)  ((s) & ~((a) - 1))
-#define ALIGN_UP(s, a)    (((s) + ((a) - 1)) & ~((a) - 1))
-#else
-
-/** Align to the nearest lower address.
- *
- * @param s Address or size to be aligned.
- * @param a Size of alignment, must be a power of 2.
- */
-#define ALIGN_DOWN(s, a)  ((s) & ~((typeof(s))(a) - 1))
-
-/** Align to the nearest higher address.
- *
- * @param s Address or size to be aligned.
- * @param a Size of alignment, must be a power of 2.
- */
-#define ALIGN_UP(s, a)  (((s) + ((a) - 1)) & ~((typeof(s))(a) - 1))
-
-#endif
-
-/** Check alignment.
- *
- * @param s Address or size to be checked for alignment.
- * @param a Size of alignment, must be a power of 2.
- */
-#define IS_ALIGNED(s, a)	(ALIGN_UP((s), (a)) == (s))
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/arch.h
===================================================================
--- kernel/generic/include/arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ARCH_H_
-#define KERN_ARCH_H_
-
-#include <config.h>
-
-/** Return the current_t structure
- *
- * The current_t structure holds pointers to various parts of the current
- * execution state, like running task, thread, address space, etc.
- *
- * The current_t structure is located at the base address of the current
- * stack. The stack is assumed to be STACK_SIZE bytes long. The stack base
- * address must be aligned to STACK_SIZE.
- *
- */
-#define CURRENT \
-	((current_t *) (((uintptr_t) __builtin_frame_address(0)) & \
-	    (~((uintptr_t) STACK_SIZE - 1))))
-
-#define MAGIC  UINT32_C(0xfacefeed)
-
-#define container_check(ctn1, ctn2)  ((ctn1) == (ctn2))
-
-#define DEFAULT_CONTAINER  0
-#define CONTAINER \
-	((CURRENT->task) ? (CURRENT->task->container) : (DEFAULT_CONTAINER))
-
-/* Fwd decl. to avoid include hell. */
-struct thread;
-struct task;
-struct cpu;
-struct as;
-
-/** Current structure
- *
- * For each possible kernel stack, structure
- * of the following type will be placed at
- * the base address of the stack.
- *
- */
-typedef struct {
-	size_t preemption;      /**< Preemption disabled counter and flag. */
-	size_t mutex_locks;
-	struct thread *thread;  /**< Current thread. */
-	struct task *task;      /**< Current task. */
-	struct cpu *cpu;        /**< Executing CPU. */
-	struct as *as;          /**< Current address space. */
-	uint32_t magic;         /**< Magic value. */
-} current_t;
-
-typedef struct {
-	void (*pre_mm_init)(void);
-	void (*post_mm_init)(void);
-	void (*post_cpu_init)(void);
-	void (*pre_smp_init)(void);
-	void (*post_smp_init)(void);
-} arch_ops_t;
-
-extern arch_ops_t *arch_ops;
-
-#define ARCH_STRUCT_OP(s, op) \
-	do { \
-		if ((s)->op) \
-			(s)->op(); \
-	} while (0)
-
-#define ARCH_OP(op)  ARCH_STRUCT_OP(arch_ops, op)
-
-extern void current_initialize(current_t *);
-extern void current_copy(current_t *, current_t *);
-
-extern void calibrate_delay_loop(void);
-
-extern void arch_reboot(void);
-extern void *arch_construct_function(fncptr_t *, void *, void *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/assert.h
===================================================================
--- kernel/generic/include/assert.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ASSERT_H_
-#define KERN_ASSERT_H_
-
-#include <panic.h>
-
-#ifdef CONFIG_DEBUG
-
-/** Debugging assert macro
- *
- * If CONFIG_DEBUG is set, the assert() macro
- * evaluates expr and if it is false raises
- * kernel panic.
- *
- * @param expr Expression which is expected to be true.
- *
- */
-#define assert(expr) \
-	do { \
-		if (!(expr)) \
-			panic_assert("%s() at %s:%u:\n%s", \
-			    __func__, __FILE__, __LINE__, #expr); \
-	} while (0)
-
-/** Debugging verbose assert macro
- *
- * If CONFIG_DEBUG is set, the assert_verbose() macro
- * evaluates expr and if it is false raises
- * kernel panic. The panic message contains also
- * the supplied message.
- *
- * @param expr Expression which is expected to be true.
- * @param msg  Additional message to show (string).
- *
- */
-#define assert_verbose(expr, msg) \
-	do { \
-		if (!(expr)) \
-			panic_assert("%s() at %s:%u:\n%s, %s", \
-			    __func__, __FILE__, __LINE__, #expr, msg); \
-	} while (0)
-
-/** Static assert macro
- *
- */
-#define static_assert \
-	_Static_assert
-
-#else /* CONFIG_DEBUG */
-
-#define assert(expr) ((void) 0)
-#define assert_verbose(expr, msg) ((void) 0)
-#define static_assert(expr, msg) ((void) 0)
-
-#endif /* CONFIG_DEBUG */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/atomic.h
===================================================================
--- kernel/generic/include/atomic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,169 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ATOMIC_H_
-#define KERN_ATOMIC_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-#include <stdatomic.h>
-
-/*
- * Shorthand for relaxed atomic read/write, something that's needed to formally
- * avoid undefined behavior in cases where we need to read a variable in
- * different threads and we don't particularly care about ordering
- * (e.g. statistic printouts). This is most likely translated into the same
- * assembly instructions as regular read/writes.
- */
-#define atomic_set_unordered(var, val) atomic_store_explicit((var), (val), memory_order_relaxed)
-#define atomic_get_unordered(var) atomic_load_explicit((var), memory_order_relaxed)
-
-#define atomic_predec(val) \
-	(atomic_fetch_sub((val), 1) - 1)
-
-#define atomic_preinc(val) \
-	(atomic_fetch_add((val), 1) + 1)
-
-#define atomic_postdec(val) \
-	atomic_fetch_sub((val), 1)
-
-#define atomic_postinc(val) \
-	atomic_fetch_add((val), 1)
-
-#define atomic_dec(val) \
-	((void) atomic_fetch_sub(val, 1))
-
-#define atomic_inc(val) \
-	((void) atomic_fetch_add(val, 1))
-
-#define local_atomic_exchange(var_addr, new_val) \
-	atomic_exchange_explicit( \
-	    (_Atomic typeof(*(var_addr)) *) (var_addr), \
-	    (new_val), memory_order_relaxed)
-
-#if __64_BITS__
-
-typedef struct {
-	atomic_uint_fast64_t value;
-} atomic_time_stat_t;
-
-#define ATOMIC_TIME_INITIALIZER() (atomic_time_stat_t) {}
-
-static inline void atomic_time_increment(atomic_time_stat_t *time, int a)
-{
-	/*
-	 * We require increments to be synchronized with each other, so we
-	 * can use ordinary reads and writes instead of a more expensive atomic
-	 * read-modify-write operations.
-	 */
-	uint64_t v = atomic_load_explicit(&time->value, memory_order_relaxed);
-	atomic_store_explicit(&time->value, v + a, memory_order_relaxed);
-}
-
-static inline uint64_t atomic_time_read(atomic_time_stat_t *time)
-{
-	return atomic_load_explicit(&time->value, memory_order_relaxed);
-}
-
-#else
-
-/**
- * A monotonically increasing 64b time statistic.
- * Increments must be synchronized with each other (or limited to a single
- * thread/CPU), but reads can be performed from any thread.
- *
- */
-typedef struct {
-	uint64_t true_value;
-	atomic_uint_fast32_t high1;
-	atomic_uint_fast32_t high2;
-	atomic_uint_fast32_t low;
-} atomic_time_stat_t;
-
-#define ATOMIC_TIME_INITIALIZER() (atomic_time_stat_t) {}
-
-static inline void atomic_time_increment(atomic_time_stat_t *time, int a)
-{
-	/*
-	 * On 32b architectures, we can't rely on 64b memory reads/writes being
-	 * architecturally atomic, but we also don't want to pay the cost of
-	 * emulating atomic reads/writes, so instead we split value in half
-	 * and perform some ordering magic to make sure readers always get
-	 * consistent value.
-	 */
-
-	/* true_value is only used by the writer, so this need not be atomic. */
-	uint64_t val = time->true_value;
-	uint32_t old_high = val >> 32;
-	val += a;
-	uint32_t new_high = val >> 32;
-	time->true_value = val;
-
-	/* Tell GCC that the first branch is far more likely than the second. */
-	if (__builtin_expect(old_high == new_high, 1)) {
-		/* If the high half didn't change, we need not bother with barriers. */
-		atomic_store_explicit(&time->low, (uint32_t) val, memory_order_relaxed);
-	} else {
-		/*
-		 * If both halves changed, extra ordering is necessary.
-		 * The idea is that if reader reads high1 and high2 with the same value,
-		 * it is guaranteed that they read the correct low half for that value.
-		 *
-		 * This is the same sequence that is used by userspace to read clock.
-		 */
-		atomic_store_explicit(&time->high1, new_high, memory_order_relaxed);
-		atomic_store_explicit(&time->low, (uint32_t) val, memory_order_release);
-		atomic_store_explicit(&time->high2, new_high, memory_order_release);
-	}
-}
-
-static inline uint64_t atomic_time_read(atomic_time_stat_t *time)
-{
-	uint32_t high2 = atomic_load_explicit(&time->high2, memory_order_acquire);
-	uint32_t low = atomic_load_explicit(&time->low, memory_order_acquire);
-	uint32_t high1 = atomic_load_explicit(&time->high1, memory_order_relaxed);
-
-	if (high1 != high2)
-		low = 0;
-
-	/* If the values differ, high1 is always the newer value. */
-	return (uint64_t) high1 << 32 | (uint64_t) low;
-}
-
-#endif /* __64_BITS__ */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/barrier.h
===================================================================
--- kernel/generic/include/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef KERN_COMPILER_BARRIER_H_
-#define KERN_COMPILER_BARRIER_H_
-
-#include <stdatomic.h>
-#include <stddef.h>
-
-static inline void compiler_barrier(void)
-{
-	atomic_signal_fence(memory_order_seq_cst);
-}
-
-static inline void memory_barrier(void)
-{
-	atomic_thread_fence(memory_order_seq_cst);
-}
-
-static inline void read_barrier(void)
-{
-	atomic_thread_fence(memory_order_acquire);
-}
-
-static inline void write_barrier(void)
-{
-	atomic_thread_fence(memory_order_release);
-}
-
-#define CS_ENTER_BARRIER() atomic_thread_fence(memory_order_acquire)
-#define CS_LEAVE_BARRIER() atomic_thread_fence(memory_order_release)
-
-/** Forces the compiler to access (ie load/store) the variable only once. */
-#define ACCESS_ONCE(var) (*((volatile typeof(var)*)&(var)))
-
-extern void smc_coherence(void *, size_t);
-
-#endif /* KERN_COMPILER_BARRIER_H_ */
Index: rnel/generic/include/bitops.h
===================================================================
--- kernel/generic/include/bitops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_BITOPS_H_
-#define KERN_BITOPS_H_
-
-#include <stdint.h>
-#include <trace.h>
-
-#ifdef __32_BITS__
-#define fnzb(arg)  fnzb32(arg)
-#endif
-
-#ifdef __64_BITS__
-#define fnzb(arg)  fnzb64(arg)
-#endif
-
-/** Return position of first non-zero bit from left (32b variant).
- *
- * @return 0 (if the number is zero) or [log_2(arg)].
- *
- */
-_NO_TRACE static inline uint8_t fnzb32(uint32_t arg)
-{
-	uint8_t n = 0;
-
-	if (arg >> 16) {
-		arg >>= 16;
-		n += 16;
-	}
-
-	if (arg >> 8) {
-		arg >>= 8;
-		n += 8;
-	}
-
-	if (arg >> 4) {
-		arg >>= 4;
-		n += 4;
-	}
-
-	if (arg >> 2) {
-		arg >>= 2;
-		n += 2;
-	}
-
-	if (arg >> 1)
-		n += 1;
-
-	return n;
-}
-
-/** Return position of first non-zero bit from left (64b variant).
- *
- * @return 0 (if the number is zero) or [log_2(arg)].
- *
- */
-_NO_TRACE static inline uint8_t fnzb64(uint64_t arg)
-{
-	uint8_t n = 0;
-
-	if (arg >> 32) {
-		arg >>= 32;
-		n += 32;
-	}
-
-	return n + fnzb32((uint32_t) arg);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/byteorder.h
===================================================================
--- kernel/generic/include/byteorder.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_BYTEORDER_H_
-#define KERN_BYTEORDER_H_
-
-#include <stdint.h>
-
-#if !(defined(__BE__) ^ defined(__LE__))
-#error The architecture must be either big-endian or little-endian.
-#endif
-
-#ifdef __BE__
-
-#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
-
-#define uint16_t_be2host(n)  (n)
-#define uint32_t_be2host(n)  (n)
-#define uint64_t_be2host(n)  (n)
-
-#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_be(n)  (n)
-#define host2uint32_t_be(n)  (n)
-#define host2uint64_t_be(n)  (n)
-
-#else
-
-#define uint16_t_le2host(n)  (n)
-#define uint32_t_le2host(n)  (n)
-#define uint64_t_le2host(n)  (n)
-
-#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_le(n)  (n)
-#define host2uint32_t_le(n)  (n)
-#define host2uint64_t_le(n)  (n)
-
-#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
-
-#endif
-
-static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
-{
-	return ((n & 0xff) << 56) |
-	    ((n & 0xff00) << 40) |
-	    ((n & 0xff0000) << 24) |
-	    ((n & 0xff000000LL) << 8) |
-	    ((n & 0xff00000000LL) >> 8) |
-	    ((n & 0xff0000000000LL) >> 24) |
-	    ((n & 0xff000000000000LL) >> 40) |
-	    ((n & 0xff00000000000000LL) >> 56);
-}
-
-static inline uint32_t uint32_t_byteorder_swap(uint32_t n)
-{
-	return ((n & 0xff) << 24) |
-	    ((n & 0xff00) << 8) |
-	    ((n & 0xff0000) >> 8) |
-	    ((n & 0xff000000) >> 24);
-}
-
-static inline uint16_t uint16_t_byteorder_swap(uint16_t n)
-{
-	return ((n & 0xff) << 8) |
-	    ((n & 0xff00) >> 8);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/cap/cap.h
===================================================================
--- kernel/generic/include/cap/cap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CAP_H_
-#define KERN_CAP_H_
-
-#include <abi/cap.h>
-#include <typedefs.h>
-#include <adt/list.h>
-#include <adt/hash.h>
-#include <adt/hash_table.h>
-#include <lib/ra.h>
-#include <synch/mutex.h>
-#include <atomic.h>
-
-typedef enum {
-	CAP_STATE_FREE,
-	CAP_STATE_ALLOCATED,
-	CAP_STATE_PUBLISHED
-} cap_state_t;
-
-typedef enum {
-	KOBJECT_TYPE_CALL,
-	KOBJECT_TYPE_IRQ,
-	KOBJECT_TYPE_PHONE,
-	KOBJECT_TYPE_WAITQ,
-	KOBJECT_TYPE_MAX
-} kobject_type_t;
-
-struct task;
-
-struct call;
-struct irq;
-struct phone;
-struct waitq;
-
-typedef struct kobject_ops {
-	void (*destroy)(void *);
-} kobject_ops_t;
-
-extern kobject_ops_t *kobject_ops[];
-
-#define KOBJECT_OP(k)	kobject_ops[(k)->type]
-
-/*
- * Everything in kobject_t except for the atomic reference count, the capability
- * list and its lock is imutable.
- */
-typedef struct kobject {
-	kobject_type_t type;
-	atomic_size_t refcnt;
-
-	/** Mutex protecting caps_list */
-	mutex_t caps_list_lock;
-	/** List of published capabilities associated with the kobject */
-	list_t caps_list;
-
-	union {
-		void *raw;
-		struct call *call;
-		struct irq *irq;
-		struct phone *phone;
-		struct waitq *waitq;
-	};
-} kobject_t;
-
-/*
- * A cap_t may only be accessed under the protection of the cap_info_t lock.
- */
-typedef struct cap {
-	cap_state_t state;
-
-	struct task *task;
-	cap_handle_t handle;
-
-	/** Link to the kobject's list of capabilities. */
-	link_t kobj_link;
-
-	/* Link to the task's capabilities of the same kobject type. */
-	link_t type_link;
-
-	ht_link_t caps_link;
-
-	/* The underlying kernel object. */
-	kobject_t *kobject;
-} cap_t;
-
-typedef struct cap_info {
-	mutex_t lock;
-
-	list_t type_list[KOBJECT_TYPE_MAX];
-
-	hash_table_t caps;
-	ra_arena_t *handles;
-} cap_info_t;
-
-extern void caps_init(void);
-extern errno_t caps_task_alloc(struct task *);
-extern void caps_task_free(struct task *);
-extern void caps_task_init(struct task *);
-extern bool caps_apply_to_kobject_type(struct task *, kobject_type_t,
-    bool (*)(cap_t *, void *), void *);
-
-extern errno_t cap_alloc(struct task *, cap_handle_t *);
-extern void cap_publish(struct task *, cap_handle_t, kobject_t *);
-extern kobject_t *cap_unpublish(struct task *, cap_handle_t, kobject_type_t);
-extern void cap_revoke(kobject_t *);
-extern void cap_free(struct task *, cap_handle_t);
-
-extern kobject_t *kobject_alloc(unsigned int);
-extern void kobject_free(kobject_t *);
-extern void kobject_initialize(kobject_t *, kobject_type_t, void *);
-extern kobject_t *kobject_get(struct task *, cap_handle_t, kobject_type_t);
-extern void kobject_add_ref(kobject_t *);
-extern void kobject_put(kobject_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/cc.h
===================================================================
--- kernel/generic/include/cc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- * Macros related to used compiler (such as GCC-specific attributes).
- */
-
-#ifndef KERN_CC_H_
-#define KERN_CC_H_
-
-#ifndef __clang__
-#define ATTRIBUTE_USED \
-	__attribute__ ((used))
-#else
-#define ATTRIBUTE_USED
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/config.h
===================================================================
--- kernel/generic/include/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CONFIG_H_
-#define KERN_CONFIG_H_
-
-#include <arch/mm/page.h>
-#include <macros.h>
-
-#define STACK_FRAMES  2
-#define STACK_SIZE    FRAMES2SIZE(STACK_FRAMES)
-
-#define STACK_SIZE_USER  (1 * 1024 * 1024)
-
-#define CONFIG_BOOT_ARGUMENTS_BUFLEN 256
-
-#define CONFIG_INIT_TASKS        32
-#define CONFIG_TASK_NAME_BUFLEN  32
-#define CONFIG_TASK_ARGUMENTS_BUFLEN 64
-
-#ifndef __ASSEMBLER__
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-typedef struct {
-	uintptr_t paddr;
-	size_t size;
-	char name[CONFIG_TASK_NAME_BUFLEN];
-	char arguments[CONFIG_TASK_ARGUMENTS_BUFLEN];
-} init_task_t;
-
-typedef struct {
-	size_t cnt;
-	init_task_t tasks[CONFIG_INIT_TASKS];
-} init_t;
-
-/** Boot allocations.
- *
- * Allocatations made by the boot that are meant to be used by the kernel
- * are all recorded in the ballocs_t type.
- */
-typedef struct {
-	uintptr_t base;
-	size_t size;
-} ballocs_t;
-
-typedef struct {
-	/** Number of processors detected. */
-	unsigned int cpu_count;
-	/** Number of processors that are up and running. */
-	volatile size_t cpu_active;
-
-	uintptr_t base;
-	/** Size of memory in bytes taken by kernel and stack. */
-	size_t kernel_size;
-
-	bool identity_configured;
-	/** Base address of the kernel identity mapped memory. */
-	uintptr_t identity_base;
-	/** Size of the kernel identity mapped memory. */
-	size_t identity_size;
-
-	bool non_identity_configured;
-
-	/** End of physical memory. */
-	uint64_t physmem_end;
-} config_t;
-
-extern config_t config;
-extern char bargs[];
-extern init_t init;
-extern ballocs_t ballocs;
-
-#endif /* __ASSEMBLER__ */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/console/chardev.h
===================================================================
--- kernel/generic/include/console/chardev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CHARDEV_H_
-#define KERN_CHARDEV_H_
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <synch/semaphore.h>
-#include <synch/spinlock.h>
-
-#define INDEV_BUFLEN  512
-
-/** Input character device out-of-band signal type. */
-typedef enum {
-	INDEV_SIGNAL_SCROLL_UP = 0,
-	INDEV_SIGNAL_SCROLL_DOWN
-} indev_signal_t;
-
-struct indev;
-
-/** Input character device operations interface. */
-typedef struct {
-	/** Read character directly from device, assume interrupts disabled. */
-	char32_t (*poll)(struct indev *);
-
-	/** Signal out-of-band condition. */
-	void (*signal)(struct indev *, indev_signal_t);
-} indev_operations_t;
-
-/** Character input device. */
-typedef struct indev {
-	const char *name;
-	semaphore_t wq;
-
-	/** Protects everything below. */
-	IRQ_SPINLOCK_DECLARE(lock);
-	char32_t buffer[INDEV_BUFLEN];
-	size_t counter;
-
-	/** Implementation of indev operations. */
-	indev_operations_t *op;
-	size_t index;
-	void *data;
-} indev_t;
-
-struct outdev;
-
-/** Output character device operations interface. */
-typedef struct {
-	/** Write string to output. */
-	void (*write)(struct outdev *, const char *, size_t);
-
-	/** Redraw any previously cached characters. */
-	void (*redraw)(struct outdev *);
-
-	/** Scroll up in the device cache. */
-	void (*scroll_up)(struct outdev *);
-
-	/** Scroll down in the device cache. */
-	void (*scroll_down)(struct outdev *);
-} outdev_operations_t;
-
-/** Character output device. */
-typedef struct outdev {
-	const char *name;
-
-	/** Protects everything below. */
-	SPINLOCK_DECLARE(lock);
-
-	/** Fields suitable for multiplexing. */
-	link_t link;
-	list_t list;
-
-	/** Implementation of outdev operations. */
-	outdev_operations_t *op;
-	void *data;
-} outdev_t;
-
-extern void indev_initialize(const char *, indev_t *,
-    indev_operations_t *);
-extern void indev_push_character(indev_t *, char32_t);
-extern char32_t indev_pop_character(indev_t *);
-extern void indev_signal(indev_t *, indev_signal_t);
-
-extern void outdev_initialize(const char *, outdev_t *,
-    outdev_operations_t *);
-
-extern bool check_poll(indev_t *);
-
-#endif /* KERN_CHARDEV_H_ */
-
-/** @}
- */
Index: rnel/generic/include/console/cmd.h
===================================================================
--- kernel/generic/include/console/cmd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CMD_H_
-#define KERN_CMD_H_
-
-#include <console/kconsole.h>
-
-extern void cmd_initialize(cmd_info_t *cmd);
-extern void cmd_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/console/console.h
===================================================================
--- kernel/generic/include/console/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CONSOLE_H_
-#define KERN_CONSOLE_H_
-
-#include <console/chardev.h>
-#include <synch/spinlock.h>
-
-#define PAGING(counter, increment, before, after) \
-	do { \
-		(counter) += (increment); \
-		if ((counter) > 23) { \
-			before; \
-			printf(" -- Press any key to continue -- "); \
-			indev_pop_character(stdin); \
-			after; \
-			printf("\n"); \
-			(counter) = 0; \
-		} \
-	} while (0)
-
-extern indev_t *stdin;
-extern outdev_t *stdout;
-
-extern void early_putuchar(char32_t);
-
-extern indev_t *stdin_wire(void);
-extern void stdout_wire(outdev_t *outdev);
-extern void console_init(void);
-
-extern void kio_init(void);
-extern void kio_update(void *);
-extern void kio_flush(void);
-extern void kio_push_bytes(const char *, size_t);
-extern irq_spinlock_t kio_lock;
-
-extern sysarg_t sys_kio_read(uspace_addr_t buf, size_t size, size_t at);
-extern sys_errno_t sys_kio(int cmd, uspace_addr_t buf, size_t size);
-
-extern void grab_console(void);
-extern void release_console(void);
-
-extern sysarg_t sys_debug_console(void);
-
-extern void console_lock(void);
-extern void console_unlock(void);
-
-extern void putstr(const char *s, size_t n);
-
-#endif /* KERN_CONSOLE_H_ */
-
-/** @}
- */
Index: rnel/generic/include/console/kconsole.h
===================================================================
--- kernel/generic/include/console/kconsole.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_KCONSOLE_H_
-#define KERN_KCONSOLE_H_
-
-#include <adt/list.h>
-#include <synch/spinlock.h>
-#include <ipc/irq.h>
-
-#define MAX_CMDLINE       256
-#define KCONSOLE_HISTORY  10
-
-/** Callback to be used to enum hints for cmd tab completion. */
-typedef const char *(*hints_enum_func_t)(const char *, const char **, void **);
-
-typedef enum {
-	ARG_TYPE_INVALID = 0,
-	ARG_TYPE_INT,
-	ARG_TYPE_STRING,
-	/** Optional string */
-	ARG_TYPE_STRING_OPTIONAL,
-	/** Variable type - either symbol or string. */
-	ARG_TYPE_VAR
-} cmd_arg_type_t;
-
-/** Structure representing one argument of kconsole command line. */
-typedef struct {
-	/** Type descriptor. */
-	cmd_arg_type_t type;
-	/** Buffer where to store data. */
-	void *buffer;
-	/** Size of the buffer. */
-	size_t len;
-	/** Integer value. */
-	sysarg_t intval;
-	/** Resulting type of variable arg */
-	cmd_arg_type_t vartype;
-} cmd_arg_t;
-
-/** Structure representing one kconsole command. */
-typedef struct {
-	/** Command list link. */
-	link_t link;
-	/** This lock protects everything below. */
-	SPINLOCK_DECLARE(lock);
-	/** Command name. */
-	const char *name;
-	/** Textual description. */
-	const char *description;
-	/** Function implementing the command. */
-	int (*func)(cmd_arg_t *);
-	/** Number of arguments. */
-	size_t argc;
-	/** Argument vector. */
-	cmd_arg_t *argv;
-	/** Function for printing detailed help. */
-	void (*help)(void);
-	/** Function for enumerating hints for arguments. */
-	hints_enum_func_t hints_enum;
-} cmd_info_t;
-
-extern bool kconsole_notify;
-extern irq_t kconsole_irq;
-
-SPINLOCK_EXTERN(cmd_lock);
-extern list_t cmd_list;
-
-extern void kconsole_init(void);
-extern void kconsole_notify_init(void);
-extern bool kconsole_check_poll(void);
-extern void kconsole(const char *prompt, const char *msg, bool kcon);
-extern void kconsole_thread(void *data);
-
-extern bool cmd_register(cmd_info_t *cmd);
-extern const char *cmdtab_enum(const char *name, const char **h, void **ctx);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/console/prompt.h
===================================================================
--- kernel/generic/include/console/prompt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CONSOLE_PROMPT_H_
-#define KERN_CONSOLE_PROMPT_H_
-
-#include <console/chardev.h>
-
-#define MAX_TAB_HINTS 37
-
-extern bool console_prompt_display_all_hints(indev_t *, size_t);
-extern bool console_prompt_more_hints(indev_t *, size_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/context.h
===================================================================
--- kernel/generic/include/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CONTEXT_H_
-#define KERN_CONTEXT_H_
-
-#include <panic.h>
-#include <trace.h>
-#include <arch/context.h>
-#include <arch/faddr.h>
-
-#define context_set_generic(ctx, _pc, stack, size) \
-	do { \
-		(ctx)->pc = (uintptr_t) (_pc); \
-		(ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-	} while (0)
-
-extern int context_save_arch(context_t *ctx) __attribute__((returns_twice));
-extern void context_restore_arch(context_t *ctx) __attribute__((noreturn));
-
-/** Restore register context.
- *
- * Restore a previously saved register context (including stack pointer) from
- * a context structure.
- *
- * Note that this function does not normally return.  Instead, it returns to the
- * same address as the corresponding call to context_save(), the only difference
- * being return value.
- *
- * @param ctx Context structure.
- *
- */
-_NO_TRACE __attribute__((noreturn))
-    static inline void context_restore(context_t *ctx)
-{
-	context_restore_arch(ctx);
-}
-
-/**
- * Saves current context to the variable pointed to by `self`,
- * and restores the context denoted by `other`.
- *
- * When the `self` context is later restored by another call to
- * `context_swap()`, the control flow behaves as if the earlier call to
- * `context_swap()` just returned.
- */
-_NO_TRACE static inline void context_swap(context_t *self, context_t *other)
-{
-	if (context_save_arch(self))
-		context_restore_arch(other);
-}
-
-_NO_TRACE static inline void context_create(context_t *context,
-    void (*fn)(void), void *stack_base, size_t stack_size)
-{
-	*context = (context_t) { 0 };
-	context_set(context, FADDR(fn), stack_base, stack_size);
-}
-
-__attribute__((noreturn)) static inline void context_replace(void (*fn)(void),
-    void *stack_base, size_t stack_size)
-{
-	context_t ctx;
-	context_create(&ctx, fn, stack_base, stack_size);
-	context_restore(&ctx);
-}
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/cpu.h
===================================================================
--- kernel/generic/include/cpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CPU_H_
-#define KERN_CPU_H_
-
-#include <mm/tlb.h>
-#include <synch/spinlock.h>
-#include <proc/scheduler.h>
-#include <arch/cpu.h>
-#include <arch/context.h>
-#include <adt/list.h>
-#include <arch.h>
-
-#define CPU                  (CURRENT->cpu)
-#define CPU_LOCAL            (&CPU->local)
-
-/**
- * Contents of CPU_LOCAL. These are variables that are only ever accessed by
- * the CPU they belong to, so they don't need any synchronization,
- * just locally disabled interrupts.
- */
-typedef struct cpu_local {
-	/**
-	 * When system clock loses a tick, it is
-	 * recorded here so that clock() can react.
-	 */
-	size_t missed_clock_ticks;
-
-	uint64_t current_clock_tick;
-	uint64_t preempt_deadline;  /* < when should the currently running thread be preempted */
-	uint64_t relink_deadline;
-
-	/**
-	 * Stack used by scheduler when there is no running thread.
-	 * This field is unchanged after initialization.
-	 */
-	uint8_t *stack;
-
-	/**
-	 * Processor cycle accounting.
-	 */
-	bool idle;
-	uint64_t last_cycle;
-
-	context_t scheduler_context;
-
-	struct thread *prev_thread;
-} cpu_local_t;
-
-/** CPU structure.
- *
- * There is one structure like this for every processor.
- */
-typedef struct cpu {
-	IRQ_SPINLOCK_DECLARE(tlb_lock);
-
-	tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];
-	size_t tlb_messages_count;
-
-	atomic_size_t nrdy;
-	runq_t rq[RQ_COUNT];
-
-	IRQ_SPINLOCK_DECLARE(timeoutlock);
-	list_t timeout_active_list;
-
-	/**
-	 * Processor cycle accounting.
-	 */
-	atomic_time_stat_t idle_cycles;
-	atomic_time_stat_t busy_cycles;
-
-	/**
-	 * Processor ID assigned by kernel.
-	 */
-	unsigned int id;
-
-	bool active;
-	volatile bool tlb_active;
-
-	uint16_t frequency_mhz;
-	uint32_t delay_loop_const;
-
-	cpu_arch_t arch;
-
-#ifdef CONFIG_FPU_LAZY
-	/* For synchronization between FPU trap and thread destructor. */
-	IRQ_SPINLOCK_DECLARE(fpu_lock);
-#endif
-	_Atomic(struct thread *) fpu_owner;
-
-	cpu_local_t local;
-} cpu_t;
-
-extern cpu_t *cpus;
-
-extern void cpu_init(void);
-extern void cpu_list(void);
-
-extern void cpu_arch_init(void);
-extern void cpu_identify(void);
-extern void cpu_print_report(cpu_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/cpu/cpu_mask.h
===================================================================
--- kernel/generic/include/cpu/cpu_mask.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-#ifndef KERN_CPU_CPU_MASK_H_
-#define KERN_CPU_CPU_MASK_H_
-
-#include <cpu.h>
-#include <config.h>
-#include <memw.h>
-
-/** Iterates over all cpu id's whose bit is included in the cpu mask.
- *
- * Example usage:
- * @code
- * DEFINE_CPU_MASK(cpu_mask);
- * cpu_mask_active(&cpu_mask);
- *
- * cpu_mask_for_each(cpu_mask, cpu_id) {
- *     printf("Cpu with logical id %u is active.\n", cpu_id);
- * }
- * @endcode
- */
-#define cpu_mask_for_each(mask, cpu_id) \
-	for (unsigned int (cpu_id) = 0; (cpu_id) < config.cpu_count; ++(cpu_id)) \
-		if (cpu_mask_is_set(&(mask), (cpu_id)))
-
-/** Allocates a cpu_mask_t on stack. */
-#define DEFINE_CPU_MASK(cpu_mask) \
-	cpu_mask_t *(cpu_mask) = (cpu_mask_t*) alloca(cpu_mask_size())
-
-/** If used with DEFINE_CPU_MASK, the mask is large enough for all detected cpus. */
-typedef struct cpu_mask {
-	unsigned int mask[1];
-} cpu_mask_t;
-
-extern size_t cpu_mask_size(void);
-extern void cpu_mask_active(cpu_mask_t *);
-extern void cpu_mask_all(cpu_mask_t *);
-extern void cpu_mask_none(cpu_mask_t *);
-extern void cpu_mask_set(cpu_mask_t *, unsigned int);
-extern void cpu_mask_reset(cpu_mask_t *, unsigned int);
-extern bool cpu_mask_is_set(cpu_mask_t *, unsigned int);
-extern bool cpu_mask_is_none(cpu_mask_t *);
-
-#endif /* KERN_CPU_CPU_MASK_H_ */
-
-/** @}
- */
Index: rnel/generic/include/ddi/ddi.h
===================================================================
--- kernel/generic/include/ddi/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ddi
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_DDI_H_
-#define KERN_DDI_H_
-
-#include <typedefs.h>
-#include <abi/ddi/arg.h>
-#include <proc/task.h>
-#include <adt/odict.h>
-
-/** Structure representing contiguous physical memory area. */
-typedef struct parea {
-	/** Link to @c pareas ordered dictionary */
-	odlink_t lpareas;
-
-	/** Physical base of the area. */
-	uintptr_t pbase;
-	/** Number of frames in the area. */
-	pfn_t frames;
-	/** Allow mapping by unprivileged tasks. */
-	bool unpriv;
-	/** Indicate whether the area is actually mapped. */
-	bool mapped;
-	/** Called when @c mapped field has changed */
-	void (*mapped_changed)(void *);
-	/** Callback argument */
-	void *arg;
-} parea_t;
-
-extern void ddi_init(void);
-extern void ddi_parea_init(parea_t *);
-extern void ddi_parea_register(parea_t *);
-extern void ddi_parea_unmap_notify(parea_t *);
-
-extern void *pio_map(void *, size_t);
-extern void pio_unmap(void *, void *, size_t);
-
-extern sys_errno_t sys_physmem_map(uintptr_t, size_t, unsigned int, uspace_ptr_uintptr_t,
-    uintptr_t);
-extern sys_errno_t sys_physmem_unmap(uintptr_t);
-
-extern sys_errno_t sys_dmamem_map(size_t, unsigned int, unsigned int, uspace_ptr_uintptr_t,
-    uspace_ptr_uintptr_t, uintptr_t);
-extern sys_errno_t sys_dmamem_unmap(uintptr_t, size_t, unsigned int);
-
-extern sys_errno_t sys_iospace_enable(uspace_ptr_ddi_ioarg_t);
-extern sys_errno_t sys_iospace_disable(uspace_ptr_ddi_ioarg_t);
-
-/*
- * Interface to be implemented by all architectures.
- */
-extern errno_t ddi_iospace_enable_arch(task_t *, uintptr_t, size_t);
-extern errno_t ddi_iospace_disable_arch(task_t *, uintptr_t, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ddi/irq.h
===================================================================
--- kernel/generic/include/ddi/irq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ddi
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_DDI_IRQ_H_
-#define KERN_DDI_IRQ_H_
-
-#include <typedefs.h>
-#include <abi/ddi/irq.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <synch/spinlock.h>
-#include <proc/task.h>
-#include <ipc/ipc.h>
-#include <mm/slab.h>
-
-typedef enum {
-	IRQ_DECLINE,  /**< Decline to service. */
-	IRQ_ACCEPT    /**< Accept to service. */
-} irq_ownership_t;
-
-typedef enum {
-	IRQ_TRIGGER_LEVEL = 1,
-	IRQ_TRIGGER_EDGE
-} irq_trigger_t;
-
-struct irq;
-
-typedef void (*irq_handler_t)(struct irq *);
-
-/** Type for function used to clear the interrupt. */
-typedef void (*cir_t)(void *, inr_t);
-
-/** IPC notification config structure.
- *
- * Primarily, this structure is encapsulated in the irq_t structure.
- * It is protected by irq_t::lock.
- *
- */
-typedef struct {
-	/** When false, notifications are not sent. */
-	bool notify;
-	/** True if the structure is in irq_uspace_hash_table_table */
-	bool hashed_in;
-	/** Answerbox for notifications. */
-	answerbox_t *answerbox;
-	/** Interface and method to be used for the notification. */
-	sysarg_t imethod;
-	/** Arguments that will be sent if the IRQ is claimed. */
-	uint32_t scratch[IPC_CALL_LEN];
-	/** Top-half IRQ code. */
-	irq_code_t *code;
-	/** Counter. */
-	size_t counter;
-} ipc_notif_cfg_t;
-
-/** Structure representing one device IRQ.
- *
- * If one device has multiple interrupts, there will be multiple irq_t
- * instantions.
- */
-typedef struct irq {
-	/** Hash table link. */
-	ht_link_t link;
-
-	/** Lock protecting everything in this structure
-	 *  except the link member. When both the IRQ
-	 *  hash table lock and this lock are to be acquired,
-	 *  this lock must not be taken first.
-	 */
-	IRQ_SPINLOCK_DECLARE(lock);
-
-	/** Send EOI before processing the interrupt.
-	 *  This is essential for timer interrupt which
-	 *  has to be acknowledged before doing preemption
-	 *  to make sure another timer interrupt will
-	 *  be eventually generated.
-	 */
-	bool preack;
-
-	/** Actual IRQ number. -1 if not yet assigned. */
-	inr_t inr;
-	/** Trigger level of the IRQ. */
-	irq_trigger_t trigger;
-	/** Claim ownership of the IRQ. */
-	irq_ownership_t (*claim)(struct irq *);
-	/** Handler for this IRQ and device. */
-	irq_handler_t handler;
-	/** Instance argument for the handler and the claim function. */
-	void *instance;
-
-	/** Clear interrupt routine. */
-	cir_t cir;
-	/** First argument to the clear interrupt routine. */
-	void *cir_arg;
-
-	/** Notification configuration structure. */
-	ipc_notif_cfg_t notif_cfg;
-} irq_t;
-
-IRQ_SPINLOCK_EXTERN(irq_uspace_hash_table_lock);
-extern hash_table_t irq_uspace_hash_table;
-
-extern slab_cache_t *irq_cache;
-
-extern inr_t last_inr;
-
-extern void irq_init(size_t, size_t);
-extern void irq_initialize(irq_t *);
-extern void irq_register(irq_t *);
-extern irq_t *irq_dispatch_and_lock(inr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/debug.h
===================================================================
--- kernel/generic/include/debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_DEBUG_H_
-#define KERN_DEBUG_H_
-
-#include <log.h>
-#include <printf/verify.h>
-#include <symtab.h>
-
-#define CALLER  ((uintptr_t) __builtin_return_address(0))
-
-/* An empty printf function to ensure syntactic correctness of disabled debug prints. */
-static inline void dummy_printf(const char *fmt, ...) _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-static inline void dummy_printf(const char *fmt, ...)
-{
-}
-
-#ifdef CONFIG_LOG
-
-/** Extensive logging output macro
- *
- * If CONFIG_LOG is set, the LOG() macro
- * will print whatever message is indicated plus
- * an information about the location.
- *
- */
-#define LOG(format, ...) \
-	do { \
-		log(LF_OTHER, LVL_DEBUG, \
-		    "%s() from %s at %s:%u: " format, __func__, \
-		    symtab_fmt_name_lookup(CALLER), __FILE__, __LINE__, \
-		    ##__VA_ARGS__); \
-	} while (0)
-
-#else /* CONFIG_LOG */
-
-#define LOG(format, ...) dummy_printf(format, ##__VA_ARGS__)
-
-#endif /* CONFIG_LOG */
-
-#ifdef CONFIG_TRACE
-
-extern void __cyg_profile_func_enter(void *, void *);
-extern void __cyg_profile_func_exit(void *, void *);
-
-#endif /* CONFIG_TRACE */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/debug/constants.h
===================================================================
--- kernel/generic/include/debug/constants.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,826 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DWARFS_CONSTANTS_H_
-#define DWARFS_CONSTANTS_H_
-
-enum {
-	DW_SECT_INFO = 1,        // .debug_info.dwo
-	DW_SECT_ABBREV = 3,      // .debug_abbrev.dwo
-	DW_SECT_LINE = 4,        // .debug_line.dwo
-	DW_SECT_LOCLISTS = 5,    // .debug_loclists.dwo
-	DW_SECT_STR_OFFSETS = 6, // .debug_str_offsets.dwo
-	DW_SECT_MACRO = 7,       // .debug_macro.dwo
-	DW_SECT_RNGLISTS = 8,    // .debug_rnglists.dwo
-
-	DW_SECT_MAX,
-};
-
-enum {
-	DW_ACCESS_public = 0x01,
-	DW_ACCESS_protected = 0x02,
-	DW_ACCESS_private = 0x03,
-
-	DW_ACCESS_MAX,
-};
-
-enum {
-	DW_AT_sibling = 0x01,
-	DW_AT_location = 0x02,
-	DW_AT_name = 0x03,
-	DW_AT_reserved_0x04 = 0x04,
-	DW_AT_fund_type = 0x05,
-	DW_AT_mod_fund_type = 0x06,
-	DW_AT_user_def_type = 0x07,
-	DW_AT_mod_u_d_type = 0x08,
-	DW_AT_ordering = 0x09,
-	DW_AT_subscr_data = 0x0a,
-	DW_AT_byte_size = 0x0b,
-	DW_AT_bit_offset = 0x0c,
-	DW_AT_bit_size = 0x0d,
-	DW_AT_reserved_0x0e = 0x0e,
-	DW_AT_unused8 = 0x0f,
-	DW_AT_stmt_list = 0x10,
-	DW_AT_low_pc = 0x11,
-	DW_AT_high_pc = 0x12,
-	DW_AT_language = 0x13,
-	DW_AT_member = 0x14,
-	DW_AT_discr = 0x15,
-	DW_AT_discr_value = 0x16,
-	DW_AT_visibility = 0x17,
-	DW_AT_import = 0x18,
-	DW_AT_string_length = 0x19,
-	DW_AT_common_reference = 0x1a,
-	DW_AT_comp_dir = 0x1b,
-	DW_AT_const_value = 0x1c,
-	DW_AT_containing_type = 0x1d,
-	DW_AT_default_value = 0x1e,
-	DW_AT_reserved_0x1f = 0x1f,
-	DW_AT_inline = 0x20,
-	DW_AT_is_optional = 0x21,
-	DW_AT_lower_bound = 0x22,
-	DW_AT_reserved_0x23 = 0x23,
-	DW_AT_reserved_0x24 = 0x24,
-	DW_AT_producer = 0x25,
-	DW_AT_reserved_0x26 = 0x26,
-	DW_AT_prototyped = 0x27,
-	DW_AT_reserved_0x28 = 0x28,
-	DW_AT_reserved_0x29 = 0x29,
-	DW_AT_return_addr = 0x2a,
-	DW_AT_reserved_0x2b = 0x2b,
-	DW_AT_start_scope = 0x2c,
-	DW_AT_reserved_0x2d = 0x2d,
-	DW_AT_bit_stride = 0x2e,
-	DW_AT_upper_bound = 0x2f,
-	DW_AT_virtual = 0x30,
-	DW_AT_abstract_origin = 0x31,
-	DW_AT_accessibility = 0x32,
-	DW_AT_address_class = 0x33,
-	DW_AT_artificial = 0x34,
-	DW_AT_base_types = 0x35,
-	DW_AT_calling_convention = 0x36,
-	DW_AT_count = 0x37,
-	DW_AT_data_member_location = 0x38,
-	DW_AT_decl_column = 0x39,
-	DW_AT_decl_file = 0x3a,
-	DW_AT_decl_line = 0x3b,
-	DW_AT_declaration = 0x3c,
-	DW_AT_discr_list = 0x3d,
-	DW_AT_encoding = 0x3e,
-	DW_AT_external = 0x3f,
-	DW_AT_frame_base = 0x40,
-	DW_AT_friend = 0x41,
-	DW_AT_identifier_case = 0x42,
-	DW_AT_macro_info = 0x43,
-	DW_AT_namelist_item = 0x44,
-	DW_AT_priority = 0x45,
-	DW_AT_segment = 0x46,
-	DW_AT_specification = 0x47,
-	DW_AT_static_link = 0x48,
-	DW_AT_type = 0x49,
-	DW_AT_use_location = 0x4a,
-	DW_AT_variable_parameter = 0x4b,
-	DW_AT_virtuality = 0x4c,
-	DW_AT_vtable_elem_location = 0x4d,
-	DW_AT_allocated = 0x4e,
-	DW_AT_associated = 0x4f,
-	DW_AT_data_location = 0x50,
-	DW_AT_byte_stride = 0x51,
-	DW_AT_entry_pc = 0x52,
-	DW_AT_use_UTF8 = 0x53,
-	DW_AT_extension = 0x54,
-	DW_AT_ranges = 0x55,
-	DW_AT_trampoline = 0x56,
-	DW_AT_call_column = 0x57,
-	DW_AT_call_file = 0x58,
-	DW_AT_call_line = 0x59,
-	DW_AT_description = 0x5a,
-	DW_AT_binary_scale = 0x5b,
-	DW_AT_decimal_scale = 0x5c,
-	DW_AT_small = 0x5d,
-	DW_AT_decimal_sign = 0x5e,
-	DW_AT_digit_count = 0x5f,
-	DW_AT_picture_string = 0x60,
-	DW_AT_mutable = 0x61,
-	DW_AT_threads_scaled = 0x62,
-	DW_AT_explicit = 0x63,
-	DW_AT_object_pointer = 0x64,
-	DW_AT_endianity = 0x65,
-	DW_AT_elemental = 0x66,
-	DW_AT_pure = 0x67,
-	DW_AT_recursive = 0x68,
-	DW_AT_signature = 0x69,
-	DW_AT_main_subprogram = 0x6a,
-	DW_AT_data_bit_offset = 0x6b,
-	DW_AT_const_expr = 0x6c,
-	DW_AT_enum_class = 0x6d,
-	DW_AT_linkage_name = 0x6e,
-	DW_AT_string_length_bit_size = 0x6f,
-	DW_AT_string_length_byte_size = 0x70,
-	DW_AT_rank = 0x71,
-	DW_AT_str_offsets_base = 0x72,
-	DW_AT_addr_base = 0x73,
-	DW_AT_rnglists_base = 0x74,
-	DW_AT_dwo_id = 0x75,
-	DW_AT_dwo_name = 0x76,
-	DW_AT_reference = 0x77,
-	DW_AT_rvalue_reference = 0x78,
-	DW_AT_macros = 0x79,
-	DW_AT_call_all_calls = 0x7a,
-	DW_AT_call_all_source_calls = 0x7b,
-	DW_AT_call_all_tail_calls = 0x7c,
-	DW_AT_call_return_pc = 0x7d,
-	DW_AT_call_value = 0x7e,
-	DW_AT_call_origin = 0x7f,
-	DW_AT_call_parameter = 0x80,
-	DW_AT_call_pc = 0x81,
-	DW_AT_call_tail_call = 0x82,
-	DW_AT_call_target = 0x83,
-	DW_AT_call_target_clobbered = 0x84,
-	DW_AT_call_data_location = 0x85,
-	DW_AT_call_data_value = 0x86,
-	DW_AT_noreturn = 0x87,
-	DW_AT_alignment = 0x88,
-	DW_AT_export_symbols = 0x89,
-	DW_AT_deleted = 0x8a,
-	DW_AT_defaulted = 0x8b,
-	DW_AT_loclists_base = 0x8c,
-
-	DW_AT_MAX,
-
-	DW_AT_lo_user = 0x2000,
-	DW_AT_hi_user = 0x3fff,
-};
-
-enum {
-	DW_ATE_address = 0x01,
-	DW_ATE_boolean = 0x02,
-	DW_ATE_complex_float = 0x03,
-	DW_ATE_float = 0x04,
-	DW_ATE_signed = 0x05,
-	DW_ATE_signed_char = 0x06,
-	DW_ATE_unsigned = 0x07,
-	DW_ATE_unsigned_char = 0x08,
-	DW_ATE_imaginary_float = 0x09,
-	DW_ATE_packed_decimal = 0x0a,
-	DW_ATE_numeric_string = 0x0b,
-	DW_ATE_edited = 0x0c,
-	DW_ATE_signed_fixed = 0x0d,
-	DW_ATE_unsigned_fixed = 0x0e,
-	DW_ATE_decimal_float = 0x0f,
-	DW_ATE_UTF = 0x10,
-	DW_ATE_UCS = 0x11,
-	DW_ATE_ASCII = 0x12,
-
-	DW_ATE_MAX,
-
-	DW_ATE_lo_user = 0x80,
-	DW_ATE_hi_user = 0xff,
-};
-
-enum {
-	DW_CC_normal = 0x01,
-	DW_CC_program = 0x02,
-	DW_CC_nocall = 0x03,
-	DW_CC_pass_by_reference = 0x04,
-	DW_CC_pass_by_value = 0x05,
-
-	DW_CC_MAX,
-
-	DW_CC_lo_user = 0x40,
-	DW_CC_hi_user = 0xff,
-};
-
-enum {
-	DW_UT_compile = 1,
-	DW_UT_type = 2,
-	DW_UT_partial = 3,
-	DW_UT_skeleton = 4,
-	DW_UT_split_compile = 5,
-	DW_UT_split_type = 6,
-
-	DW_UT_MAX,
-
-	DW_UT_lo_user = 0x80,
-	DW_UT_hi_user = 0xff,
-};
-
-enum {
-	DW_TAG_array_type = 0x01,
-	DW_TAG_class_type = 0x02,
-	DW_TAG_entry_point = 0x03,
-	DW_TAG_enumeration_type = 0x04,
-	DW_TAG_formal_parameter = 0x05,
-	DW_TAG_global_subroutine = 0x06,
-	DW_TAG_global_variable = 0x07,
-	DW_TAG_imported_declaration = 0x08,
-	DW_TAG_reserved_0x09 = 0x09,
-	DW_TAG_label = 0x0a,
-	DW_TAG_lexical_block = 0x0b,
-	DW_TAG_local_variable = 0x0c,
-	DW_TAG_member = 0x0d,
-	DW_TAG_reserved_0x0e = 0x0e,
-	DW_TAG_pointer_type = 0x0f,
-	DW_TAG_reference_type = 0x10,
-	DW_TAG_compile_unit = 0x11,
-	DW_TAG_string_type = 0x12,
-	DW_TAG_structure_type = 0x13,
-	DW_TAG_subroutine = 0x14,
-	DW_TAG_subroutine_type = 0x15,
-	DW_TAG_typedef = 0x16,
-	DW_TAG_union_type = 0x17,
-	DW_TAG_unspecified_parameters = 0x18,
-	DW_TAG_variant = 0x19,
-	DW_TAG_common_block = 0x1a,
-	DW_TAG_common_inclusion = 0x1b,
-	DW_TAG_inheritance = 0x1c,
-	DW_TAG_inlined_subroutine = 0x1d,
-	DW_TAG_module = 0x1e,
-	DW_TAG_ptr_to_member_type = 0x1f,
-	DW_TAG_set_type = 0x20,
-	DW_TAG_subrange_type = 0x21,
-	DW_TAG_with_stmt = 0x22,
-	DW_TAG_access_declaration = 0x23,
-	DW_TAG_base_type = 0x24,
-	DW_TAG_catch_block = 0x25,
-	DW_TAG_const_type = 0x26,
-	DW_TAG_constant = 0x27,
-	DW_TAG_enumerator = 0x28,
-	DW_TAG_file_type = 0x29,
-	DW_TAG_friend = 0x2a,
-	DW_TAG_namelist = 0x2b,
-	DW_TAG_namelist_item = 0x2c,
-	DW_TAG_packed_type = 0x2d,
-	DW_TAG_subprogram = 0x2e,
-	DW_TAG_template_type_parameter = 0x2f,
-	DW_TAG_template_value_parameter = 0x30,
-	DW_TAG_thrown_type = 0x31,
-	DW_TAG_try_block = 0x32,
-	DW_TAG_variant_part = 0x33,
-	DW_TAG_variable = 0x34,
-	DW_TAG_volatile_type = 0x35,
-	DW_TAG_dwarf_procedure = 0x36,
-	DW_TAG_restrict_type = 0x37,
-	DW_TAG_interface_type = 0x38,
-	DW_TAG_namespace = 0x39,
-	DW_TAG_imported_module = 0x3a,
-	DW_TAG_unspecified_type = 0x3b,
-	DW_TAG_partial_unit = 0x3c,
-	DW_TAG_imported_unit = 0x3d,
-	DW_TAG_mutable_type = 0x3e,
-	DW_TAG_condition = 0x3f,
-	DW_TAG_shared_type = 0x40,
-	DW_TAG_type_unit = 0x41,
-	DW_TAG_rvalue_reference_type = 0x42,
-	DW_TAG_template_alias = 0x43,
-	DW_TAG_coarray_type = 0x44,
-	DW_TAG_generic_subrange = 0x45,
-	DW_TAG_dynamic_type = 0x46,
-	DW_TAG_atomic_type = 0x47,
-	DW_TAG_call_site = 0x48,
-	DW_TAG_call_site_parameter = 0x49,
-	DW_TAG_skeleton_unit = 0x4a,
-	DW_TAG_immutable_type = 0x4b,
-
-	DW_TAG_MAX,
-
-	DW_TAG_lo_user = 0x4080,
-	DW_TAG_hi_user = 0xffff,
-};
-
-enum {
-	DW_FORM_addr = 0x01,
-	DW_FORM_reserved_0x02 = 0x02,
-	DW_FORM_block2 = 0x03,
-	DW_FORM_block4 = 0x04,
-	DW_FORM_data2 = 0x05,
-	DW_FORM_data4 = 0x06,
-	DW_FORM_data8 = 0x07,
-	DW_FORM_string = 0x08,
-	DW_FORM_block = 0x09,
-	DW_FORM_block1 = 0x0a,
-	DW_FORM_data1 = 0x0b,
-	DW_FORM_flag = 0x0c,
-	DW_FORM_sdata = 0x0d,
-	DW_FORM_strp = 0x0e,
-	DW_FORM_udata = 0x0f,
-	DW_FORM_ref_addr = 0x10,
-	DW_FORM_ref1 = 0x11,
-	DW_FORM_ref2 = 0x12,
-	DW_FORM_ref4 = 0x13,
-	DW_FORM_ref8 = 0x14,
-	DW_FORM_ref_udata = 0x15,
-	DW_FORM_indirect = 0x16,
-	DW_FORM_sec_offset = 0x17,
-	DW_FORM_exprloc = 0x18,
-	DW_FORM_flag_present = 0x19,
-	DW_FORM_strx = 0x1a,
-	DW_FORM_addrx = 0x1b,
-	DW_FORM_ref_sup4 = 0x1c,
-	DW_FORM_strp_sup = 0x1d,
-	DW_FORM_data16 = 0x1e,
-	DW_FORM_line_strp = 0x1f,
-	DW_FORM_ref_sig8 = 0x20,
-	DW_FORM_implicit_const = 0x21,
-	DW_FORM_loclistx = 0x22,
-	DW_FORM_rnglistx = 0x23,
-	DW_FORM_ref_sup8 = 0x24,
-	DW_FORM_strx1 = 0x25,
-	DW_FORM_strx2 = 0x26,
-	DW_FORM_strx3 = 0x27,
-	DW_FORM_strx4 = 0x28,
-	DW_FORM_addrx1 = 0x29,
-	DW_FORM_addrx2 = 0x2a,
-	DW_FORM_addrx3 = 0x2b,
-	DW_FORM_addrx4 = 0x2c,
-
-	DW_FORM_MAX,
-};
-
-enum {
-	DW_OP_reg = 0x01,
-	DW_OP_basereg = 0x02,
-	DW_OP_addr = 0x03,
-	DW_OP_const = 0x04,
-	DW_OP_deref2 = 0x05,
-	DW_OP_deref = 0x06,
-	DW_OP_add = 0x07,
-	DW_OP_const1u = 0x08,
-	DW_OP_const1s = 0x09,
-	DW_OP_const2u = 0x0a,
-	DW_OP_const2s = 0x0b,
-	DW_OP_const4u = 0x0c,
-	DW_OP_const4s = 0x0d,
-	DW_OP_const8u = 0x0e,
-	DW_OP_const8s = 0x0f,
-	DW_OP_constu = 0x10,
-	DW_OP_consts = 0x11,
-	DW_OP_dup = 0x12,
-	DW_OP_drop = 0x13,
-	DW_OP_over = 0x14,
-	DW_OP_pick = 0x15,
-	DW_OP_swap = 0x16,
-	DW_OP_rot = 0x17,
-	DW_OP_xderef = 0x18,
-	DW_OP_abs = 0x19,
-	DW_OP_and = 0x1a,
-	DW_OP_div = 0x1b,
-	DW_OP_minus = 0x1c,
-	DW_OP_mod = 0x1d,
-	DW_OP_mul = 0x1e,
-	DW_OP_neg = 0x1f,
-	DW_OP_not = 0x20,
-	DW_OP_or = 0x21,
-	DW_OP_plus = 0x22,
-	DW_OP_plus_uconst = 0x23,
-	DW_OP_shl = 0x24,
-	DW_OP_shr = 0x25,
-	DW_OP_shra = 0x26,
-	DW_OP_xor = 0x27,
-	DW_OP_bra = 0x28,
-	DW_OP_eq = 0x29,
-	DW_OP_ge = 0x2a,
-	DW_OP_gt = 0x2b,
-	DW_OP_le = 0x2c,
-	DW_OP_lt = 0x2d,
-	DW_OP_ne = 0x2e,
-	DW_OP_skip = 0x2f,
-	DW_OP_lit0 = 0x30,
-	DW_OP_lit1 = 0x31,
-	DW_OP_lit2 = 0x32,
-	DW_OP_lit3 = 0x33,
-	DW_OP_lit4 = 0x34,
-	DW_OP_lit5 = 0x35,
-	DW_OP_lit6 = 0x36,
-	DW_OP_lit7 = 0x37,
-	DW_OP_lit8 = 0x38,
-	DW_OP_lit9 = 0x39,
-	DW_OP_lit10 = 0x3a,
-	DW_OP_lit11 = 0x3b,
-	DW_OP_lit12 = 0x3c,
-	DW_OP_lit13 = 0x3d,
-	DW_OP_lit14 = 0x3e,
-	DW_OP_lit15 = 0x3f,
-	DW_OP_lit16 = 0x40,
-	DW_OP_lit17 = 0x41,
-	DW_OP_lit18 = 0x42,
-	DW_OP_lit19 = 0x43,
-	DW_OP_lit20 = 0x44,
-	DW_OP_lit21 = 0x45,
-	DW_OP_lit22 = 0x46,
-	DW_OP_lit23 = 0x47,
-	DW_OP_lit24 = 0x48,
-	DW_OP_lit25 = 0x49,
-	DW_OP_lit26 = 0x4a,
-	DW_OP_lit27 = 0x4b,
-	DW_OP_lit28 = 0x4c,
-	DW_OP_lit29 = 0x4d,
-	DW_OP_lit30 = 0x4e,
-	DW_OP_lit31 = 0x4f,
-	DW_OP_reg0 = 0x50,
-	DW_OP_reg1 = 0x51,
-	DW_OP_reg2 = 0x52,
-	DW_OP_reg3 = 0x53,
-	DW_OP_reg4 = 0x54,
-	DW_OP_reg5 = 0x55,
-	DW_OP_reg6 = 0x56,
-	DW_OP_reg7 = 0x57,
-	DW_OP_reg8 = 0x58,
-	DW_OP_reg9 = 0x59,
-	DW_OP_reg10 = 0x5a,
-	DW_OP_reg11 = 0x5b,
-	DW_OP_reg12 = 0x5c,
-	DW_OP_reg13 = 0x5d,
-	DW_OP_reg14 = 0x5e,
-	DW_OP_reg15 = 0x5f,
-	DW_OP_reg16 = 0x60,
-	DW_OP_reg17 = 0x61,
-	DW_OP_reg18 = 0x62,
-	DW_OP_reg19 = 0x63,
-	DW_OP_reg20 = 0x64,
-	DW_OP_reg21 = 0x65,
-	DW_OP_reg22 = 0x66,
-	DW_OP_reg23 = 0x67,
-	DW_OP_reg24 = 0x68,
-	DW_OP_reg25 = 0x69,
-	DW_OP_reg26 = 0x6a,
-	DW_OP_reg27 = 0x6b,
-	DW_OP_reg28 = 0x6c,
-	DW_OP_reg29 = 0x6d,
-	DW_OP_reg30 = 0x6e,
-	DW_OP_reg31 = 0x6f,
-	DW_OP_breg0 = 0x70,
-	DW_OP_breg1 = 0x71,
-	DW_OP_breg2 = 0x72,
-	DW_OP_breg3 = 0x73,
-	DW_OP_breg4 = 0x74,
-	DW_OP_breg5 = 0x75,
-	DW_OP_breg6 = 0x76,
-	DW_OP_breg7 = 0x77,
-	DW_OP_breg8 = 0x78,
-	DW_OP_breg9 = 0x79,
-	DW_OP_breg10 = 0x7a,
-	DW_OP_breg11 = 0x7b,
-	DW_OP_breg12 = 0x7c,
-	DW_OP_breg13 = 0x7d,
-	DW_OP_breg14 = 0x7e,
-	DW_OP_breg15 = 0x7f,
-	DW_OP_breg16 = 0x80,
-	DW_OP_breg17 = 0x81,
-	DW_OP_breg18 = 0x82,
-	DW_OP_breg19 = 0x83,
-	DW_OP_breg20 = 0x84,
-	DW_OP_breg21 = 0x85,
-	DW_OP_breg22 = 0x86,
-	DW_OP_breg23 = 0x87,
-	DW_OP_breg24 = 0x88,
-	DW_OP_breg25 = 0x89,
-	DW_OP_breg26 = 0x8a,
-	DW_OP_breg27 = 0x8b,
-	DW_OP_breg28 = 0x8c,
-	DW_OP_breg29 = 0x8d,
-	DW_OP_breg30 = 0x8e,
-	DW_OP_breg31 = 0x8f,
-	DW_OP_regx = 0x90,
-	DW_OP_fbreg = 0x91,
-	DW_OP_bregx = 0x92,
-	DW_OP_piece = 0x93,
-	DW_OP_deref_size = 0x94,
-	DW_OP_xderef_size = 0x95,
-	DW_OP_nop = 0x96,
-	DW_OP_push_object_address = 0x97,
-	DW_OP_call2 = 0x98,
-	DW_OP_call4 = 0x99,
-	DW_OP_call_ref = 0x9a,
-	DW_OP_form_tls_address = 0x9b,
-	DW_OP_call_frame_cfa = 0x9c,
-	DW_OP_bit_piece = 0x9d,
-	DW_OP_implicit_value = 0x9e,
-	DW_OP_stack_value = 0x9f,
-	DW_OP_implicit_pointer = 0xa0,
-	DW_OP_addrx = 0xa1,
-	DW_OP_constx = 0xa2,
-	DW_OP_entry_value = 0xa3,
-	DW_OP_const_type = 0xa4,
-	DW_OP_regval_type = 0xa5,
-	DW_OP_deref_type = 0xa6,
-	DW_OP_xderef_type = 0xa7,
-	DW_OP_convert = 0xa8,
-	DW_OP_reinterpret = 0xa9,
-
-	DW_OP_MAX,
-
-	DW_OP_lo_user = 0xe0,
-	DW_OP_hi_user = 0xff,
-};
-
-enum {
-	DW_LLE_end_of_list = 0x00,
-	DW_LLE_base_addressx = 0x01,
-	DW_LLE_startx_endx = 0x02,
-	DW_LLE_startx_length = 0x03,
-	DW_LLE_offset_pair = 0x04,
-	DW_LLE_default_location = 0x05,
-	DW_LLE_base_address = 0x06,
-	DW_LLE_start_end = 0x07,
-	DW_LLE_start_length = 0x08,
-
-	DW_LLE_MAX,
-};
-
-enum {
-	DW_DS_unsigned = 0x01,
-	DW_DS_leading_overpunch = 0x02,
-	DW_DS_trailing_overpunch = 0x03,
-	DW_DS_leading_separate = 0x04,
-	DW_DS_trailing_separate = 0x05,
-
-	DW_DS_MAX,
-};
-
-enum {
-	DW_END_default = 0x00,
-	DW_END_big = 0x01,
-	DW_END_little = 0x02,
-
-	DW_END_MAX,
-
-	DW_END_lo_user = 0x40,
-	DW_END_hi_user = 0xff,
-};
-
-enum {
-	DW_VIS_local = 0x01,
-	DW_VIS_exported = 0x02,
-	DW_VIS_qualified = 0x03,
-
-	DW_VIS_MAX,
-};
-
-enum {
-	DW_VIRTUALITY_none = 0x00,
-	DW_VIRTUALITY_virtual = 0x01,
-	DW_VIRTUALITY_pure_virtual = 0x02,
-
-	DW_VIRTUALITY_MAX,
-};
-
-enum {
-	DW_LANG_C89 = 0x01,
-	DW_LANG_C = 0x02,
-	DW_LANG_Ada83 = 0x03,
-	DW_LANG_C_plus_plus = 0x04,
-	DW_LANG_Cobol74 = 0x05,
-	DW_LANG_Cobol85 = 0x06,
-	DW_LANG_Fortran77 = 0x07,
-	DW_LANG_Fortran90 = 0x08,
-	DW_LANG_Pascal83 = 0x09,
-	DW_LANG_Modula2 = 0x0a,
-	DW_LANG_Java = 0x0b,
-	DW_LANG_C99 = 0x0c,
-	DW_LANG_Ada95 = 0x0d,
-	DW_LANG_Fortran95 = 0x0e,
-	DW_LANG_PLI = 0x0f,
-	DW_LANG_ObjC = 0x10,
-	DW_LANG_ObjC_plus_plus = 0x11,
-	DW_LANG_UPC = 0x12,
-	DW_LANG_D = 0x13,
-	DW_LANG_Python = 0x14,
-	DW_LANG_OpenCL = 0x15,
-	DW_LANG_Go = 0x16,
-	DW_LANG_Modula3 = 0x17,
-	DW_LANG_Haskell = 0x18,
-	DW_LANG_C_plus_plus_03 = 0x19,
-	DW_LANG_C_plus_plus_11 = 0x1a,
-	DW_LANG_OCaml = 0x1b,
-	DW_LANG_Rust = 0x1c,
-	DW_LANG_C11 = 0x1d,
-	DW_LANG_Swift = 0x1e,
-	DW_LANG_Julia = 0x1f,
-	DW_LANG_Dylan = 0x20,
-	DW_LANG_C_plus_plus_14 = 0x21,
-	DW_LANG_Fortran03 = 0x22,
-	DW_LANG_Fortran08 = 0x23,
-	DW_LANG_RenderScript = 0x24,
-	DW_LANG_BLISS = 0x25,
-
-	DW_LANG_MAX,
-
-	DW_LANG_lo_user = 0x8000,
-	DW_LANG_hi_user = 0xffff,
-};
-
-enum {
-	DW_ADDR_none = 0,
-};
-
-enum {
-	DW_ID_case_sensitive = 0x00,
-	DW_ID_up_case = 0x01,
-	DW_ID_down_case = 0x02,
-	DW_ID_case_insensitive = 0x03,
-
-	DW_ID_MAX,
-};
-
-enum {
-	DW_LNS_copy = 0x01,
-	DW_LNS_advance_pc = 0x02,
-	DW_LNS_advance_line = 0x03,
-	DW_LNS_set_file = 0x04,
-	DW_LNS_set_column = 0x05,
-	DW_LNS_negate_stmt = 0x06,
-	DW_LNS_set_basic_block = 0x07,
-	DW_LNS_const_add_pc = 0x08,
-	DW_LNS_fixed_advance_pc = 0x09,
-	DW_LNS_set_prologue_end = 0x0a,
-	DW_LNS_set_epilogue_begin = 0x0b,
-	DW_LNS_set_isa = 0x0c,
-
-	DW_LNS_MAX,
-};
-
-enum {
-	DW_LNE_end_sequence = 0x01,
-	DW_LNE_set_address = 0x02,
-	DW_LNE_define_file = 0x03,
-	DW_LNE_set_discriminator = 0x04,
-
-	DW_LNE_MAX,
-
-	DW_LNE_lo_user = 0x80,
-	DW_LNE_hi_user = 0xff,
-};
-
-enum {
-	DW_LNCT_path = 0x1,
-	DW_LNCT_directory_index = 0x2,
-	DW_LNCT_timestamp = 0x3,
-	DW_LNCT_size = 0x4,
-	DW_LNCT_MD5 = 0x5,
-
-	DW_LNCT_MAX,
-
-	DW_LNCT_lo_user = 0x2000,
-	DW_LNCT_hi_user = 0x3fff,
-};
-
-enum {
-	DW_INL_not_inlined = 0x00,
-	DW_INL_inlined = 0x01,
-	DW_INL_declared_not_inlined = 0x02,
-	DW_INL_declared_inlined = 0x03,
-
-	DW_INL_MAX,
-};
-
-enum {
-	DW_ORD_row_major = 0x00,
-	DW_ORD_col_major = 0x01,
-
-	DW_ORD_MAX,
-};
-
-enum {
-	DW_DSC_label = 0x00,
-	DW_DSC_range = 0x01,
-
-	DW_DSC_MAX,
-};
-
-enum {
-	DW_IDX_compile_unit = 1,
-	DW_IDX_type_unit = 2,
-	DW_IDX_die_offset = 3,
-	DW_IDX_parent = 4,
-	DW_IDX_type_hash = 5,
-
-	DW_IDX_MAX,
-
-	DW_IDX_lo_user = 0x2000,
-	DW_IDX_hi_user = 0x3fff,
-};
-
-enum {
-	DW_DEFAULTED_no = 0x00,
-	DW_DEFAULTED_in_class = 0x01,
-	DW_DEFAULTED_out_of_class = 0x02,
-
-	DW_DEFAULTED_MAX,
-};
-
-enum {
-	DW_MACRO_define = 0x01,
-	DW_MACRO_undef = 0x02,
-	DW_MACRO_start_file = 0x03,
-	DW_MACRO_end_file = 0x04,
-	DW_MACRO_define_strp = 0x05,
-	DW_MACRO_undef_strp = 0x06,
-	DW_MACRO_import = 0x07,
-	DW_MACRO_define_sup = 0x08,
-	DW_MACRO_undef_sup = 0x09,
-	DW_MACRO_import_sup = 0x0a,
-	DW_MACRO_define_strx = 0x0b,
-	DW_MACRO_undef_strx = 0x0c,
-
-	DW_MACRO_MAX,
-
-	DW_MACRO_lo_user = 0xe0,
-	DW_MACRO_hi_user = 0xff,
-};
-
-enum {
-	DW_CFA_nop = 0,
-	DW_CFA_set_loc = 0x01,
-	DW_CFA_advance_loc1 = 0x02,
-	DW_CFA_advance_loc2 = 0x03,
-	DW_CFA_advance_loc4 = 0x04,
-	DW_CFA_offset_extended = 0x05,
-	DW_CFA_restore_extended = 0x06,
-	DW_CFA_undefined = 0x07,
-	DW_CFA_same_value = 0x08,
-	DW_CFA_register = 0x09,
-	DW_CFA_remember_state = 0x0a,
-	DW_CFA_restore_state = 0x0b,
-	DW_CFA_def_cfa = 0x0c,
-	DW_CFA_def_cfa_register = 0x0d,
-	DW_CFA_def_cfa_offset = 0x0e,
-	DW_CFA_def_cfa_expression = 0x0f,
-	DW_CFA_expression = 0x10,
-	DW_CFA_offset_extended_sf = 0x11,
-	DW_CFA_def_cfa_sf = 0x12,
-	DW_CFA_def_cfa_offset_sf = 0x13,
-	DW_CFA_val_offset = 0x14,
-	DW_CFA_val_offset_sf = 0x15,
-	DW_CFA_val_expression = 0x16,
-
-	DW_CFA_MAX,
-
-	DW_CFA_lo_user = 0x1c,
-	DW_CFA_hi_user = 0x3f,
-
-	/* These hold extra data in the 6 low-order bits. */
-	DW_CFA_advance_loc = 0x40,
-	DW_CFA_offset = 0x80,
-	DW_CFA_restore = 0xc0,
-};
-
-enum {
-	DW_RLE_end_of_list = 0x00,
-	DW_RLE_base_addressx = 0x01,
-	DW_RLE_startx_endx = 0x02,
-	DW_RLE_startx_length = 0x03,
-	DW_RLE_offset_pair = 0x04,
-	DW_RLE_base_address = 0x05,
-	DW_RLE_start_end = 0x06,
-	DW_RLE_start_length = 0x07,
-
-	DW_RLE_MAX,
-};
-
-#endif /* DWARFS_CONSTANTS_H_ */
Index: rnel/generic/include/debug/line.h
===================================================================
--- kernel/generic/include/debug/line.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DWARFS_LINE_H_
-#define DWARFS_LINE_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <debug/sections.h>
-
-struct debug_line_program_header {
-	uint64_t unit_length;
-	uint64_t header_length;
-	const uint8_t *unit_end;
-	const uint8_t *header_end;
-	const uint8_t *standard_opcode_lengths;
-	size_t standard_opcode_lengths_size;
-	unsigned width;
-	uint16_t version;
-	uint8_t minimum_instruction_length;
-	bool default_is_stmt;
-	int8_t line_base;
-	uint8_t line_range;
-	uint8_t opcode_base;
-
-	union {
-		struct {
-			const uint8_t *include_directories;
-			const uint8_t *include_directories_end;
-			const uint8_t *file_names;
-		} v3;
-		struct {
-			uint64_t directories_count;
-			uint64_t file_names_count;
-			const uint8_t *directory_entry_format;
-			const uint8_t *directory_entry_format_end;
-			const uint8_t *directories;
-			const uint8_t *directories_end;
-			const uint8_t *file_name_entry_format;
-			const uint8_t *file_name_entry_format_end;
-			const uint8_t *file_names;
-			const uint8_t *file_names_end;
-			uint8_t address_size;
-			uint8_t segment_selector_size;
-			uint8_t directory_entry_format_count;
-			uint8_t file_name_entry_format_count;
-			uint8_t maximum_operations_per_instruction;
-		} v5;
-	};
-};
-
-struct debug_line_program {
-	const struct debug_line_program_header *hdr;
-	const uint8_t *program;
-	const uint8_t *program_end;
-
-	uintptr_t address;
-	int op_advance;
-	int file;
-	int line;
-	int column;
-
-	bool end_sequence;
-	bool truncated;
-};
-
-static inline struct debug_line_program debug_line_program_create(const uint8_t *program,
-    const uint8_t *const program_end,
-    const struct debug_line_program_header *hdr)
-{
-	return (struct debug_line_program) {
-		.hdr = hdr,
-		.program = program,
-		.program_end = program_end,
-		.end_sequence = true,
-		.truncated = false,
-	};
-}
-
-extern bool debug_line_get_address_info(debug_sections_t *scs, uintptr_t addr, int op_index, const char **file, const char **dir, int *line, int *col);
-
-#endif /* DWARFS_LINE_H_ */
Index: rnel/generic/include/debug/names.h
===================================================================
--- kernel/generic/include/debug/names.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_DWARF_NAMES_H_
-#define DEBUG_DWARF_NAMES_H_
-
-#include <debug/types.h>
-
-extern const char *dw_access_name(dw_access_t);
-extern const char *dw_at_name(dw_at_t);
-extern const char *dw_ate_name(dw_ate_t);
-extern const char *dw_cc_name(dw_cc_t);
-extern const char *dw_cfa_name(dw_cfa_t);
-extern const char *dw_defaulted_name(dw_defaulted_t);
-extern const char *dw_ds_name(dw_ds_t);
-extern const char *dw_dsc_name(dw_dsc_t);
-extern const char *dw_end_name(dw_end_t);
-extern const char *dw_form_name(dw_form_t);
-extern const char *dw_id_name(dw_id_t);
-extern const char *dw_idx_name(dw_idx_t);
-extern const char *dw_inl_name(dw_inl_t);
-extern const char *dw_lang_name(dw_lang_t);
-extern const char *dw_lle_name(dw_lle_t);
-extern const char *dw_lnct_name(dw_lnct_t);
-extern const char *dw_lne_name(dw_lne_t);
-extern const char *dw_lns_name(dw_lns_t);
-extern const char *dw_macro_name(dw_macro_t);
-extern const char *dw_op_name(dw_op_t);
-extern const char *dw_ord_name(dw_ord_t);
-extern const char *dw_rle_name(dw_rle_t);
-extern const char *dw_tag_name(dw_tag_t);
-extern const char *dw_ut_name(dw_ut_t);
-extern const char *dw_virtuality_name(dw_virtuality_t);
-extern const char *dw_vis_name(dw_vis_t);
-
-#endif /* DEBUG_DWARF_NAMES_H_ */
Index: rnel/generic/include/debug/register.h
===================================================================
--- kernel/generic/include/debug/register.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_REGISTER_H_
-#define DEBUG_REGISTER_H_
-
-/** Accepts data of an ELF file containing debug sections. */
-void register_debug_data(const void *data, size_t data_size);
-
-#endif /* DEBUG_REGISTER_H_ */
Index: rnel/generic/include/debug/sections.h
===================================================================
--- kernel/generic/include/debug/sections.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_SECTIONS_H_
-#define DEBUG_SECTIONS_H_
-
-#include <abi/elf.h>
-#include <stddef.h>
-
-typedef struct {
-	const void *debug_aranges;
-	size_t debug_aranges_size;
-
-	const void *debug_info;
-	size_t debug_info_size;
-
-	const void *debug_abbrev;
-	size_t debug_abbrev_size;
-
-	const void *debug_line;
-	size_t debug_line_size;
-
-	const char *debug_str;
-	size_t debug_str_size;
-
-	const char *debug_line_str;
-	size_t debug_line_str_size;
-
-	const void *debug_rnglists;
-	size_t debug_rnglists_size;
-
-	const void *eh_frame_hdr;
-	size_t eh_frame_hdr_size;
-
-	const void *eh_frame;
-	size_t eh_frame_size;
-
-	const elf_symbol_t *symtab;
-	size_t symtab_size;
-
-	const char *strtab;
-	size_t strtab_size;
-} debug_sections_t;
-
-extern debug_sections_t kernel_sections;
-
-debug_sections_t get_debug_sections(const void *elf, size_t elf_size);
-
-#endif /* DEBUG_SECTIONS_H_ */
Index: rnel/generic/include/debug/types.h
===================================================================
--- kernel/generic/include/debug/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_DWARF_TYPES_H_
-#define DEBUG_DWARF_TYPES_H_
-
-typedef unsigned dw_access_t;
-typedef unsigned dw_at_t;
-typedef unsigned dw_ate_t;
-typedef unsigned dw_cc_t;
-typedef unsigned dw_cfa_t;
-typedef unsigned dw_defaulted_t;
-typedef unsigned dw_ds_t;
-typedef unsigned dw_dsc_t;
-typedef unsigned dw_end_t;
-typedef unsigned dw_form_t;
-typedef unsigned dw_id_t;
-typedef unsigned dw_idx_t;
-typedef unsigned dw_idx_t;
-typedef unsigned dw_inl_t;
-typedef unsigned dw_lang_t;
-typedef unsigned dw_lle_t;
-typedef unsigned dw_lnct_t;
-typedef unsigned dw_lne_t;
-typedef unsigned dw_lns_t;
-typedef unsigned dw_macro_t;
-typedef unsigned dw_op_t;
-typedef unsigned dw_ord_t;
-typedef unsigned dw_rle_t;
-typedef unsigned dw_sect_t;
-typedef unsigned dw_tag_t;
-typedef unsigned dw_ut_t;
-typedef unsigned dw_virtuality_t;
-typedef unsigned dw_vis_t;
-
-#endif /* DEBUG_DWARF_TYPES_H_ */
Index: rnel/generic/include/errno.h
===================================================================
--- kernel/generic/include/errno.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ERRNO_H_
-#define KERN_ERRNO_H_
-
-#include <_bits/errno.h>
-#include <abi/errno.h>
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/fpu_context.h
===================================================================
--- kernel/generic/include/fpu_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_FPU_CONTEXT_H_
-#define KERN_FPU_CONTEXT_H_
-
-#include <arch/fpu_context.h>
-
-extern void fpu_context_save(fpu_context_t *);
-extern void fpu_context_restore(fpu_context_t *);
-extern void fpu_init(void);
-extern void fpu_enable(void);
-extern void fpu_disable(void);
-
-#endif /* KERN_FPU_CONTEXT_H_ */
-
-/** @}
- */
Index: rnel/generic/include/halt.h
===================================================================
--- kernel/generic/include/halt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_HALT_H_
-#define KERN_HALT_H_
-
-#include <atomic.h>
-
-extern atomic_bool haltstate;
-
-extern void halt(void) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/interrupt.h
===================================================================
--- kernel/generic/include/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_interrupt
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_INTERRUPT_H_
-#define KERN_INTERRUPT_H_
-
-#include <arch/interrupt.h>
-#include <print.h>
-#include <stdarg.h>
-#include <typedefs.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <ddi/irq.h>
-#include <stacktrace.h>
-#include <arch/istate.h>
-
-typedef void (*iroutine_t)(unsigned int, istate_t *);
-
-typedef struct {
-	const char *name;
-	bool hot;
-	iroutine_t handler;
-	uint64_t cycles;
-	uint64_t count;
-} exc_table_t;
-
-IRQ_SPINLOCK_EXTERN(exctbl_lock);
-extern exc_table_t exc_table[];
-
-extern void fault_from_uspace(istate_t *, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern void fault_if_from_uspace(istate_t *, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern istate_t *istate_get(thread_t *);
-extern iroutine_t exc_register(unsigned int, const char *, bool, iroutine_t);
-extern void exc_dispatch(unsigned int, istate_t *);
-extern void exc_init(void);
-
-extern void irq_initialize_arch(irq_t *);
-
-extern void istate_decode(istate_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/event.h
===================================================================
--- kernel/generic/include/ipc/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_EVENT_H_
-#define KERN_EVENT_H_
-
-#include <abi/ipc/event.h>
-#include <typedefs.h>
-#include <synch/spinlock.h>
-#include <ipc/ipc.h>
-
-struct task;
-
-typedef void (*event_callback_t)(void *);
-
-/** Event notification structure. */
-typedef struct {
-	SPINLOCK_DECLARE(lock);
-
-	/** Answerbox for notifications. */
-	answerbox_t *answerbox;
-	/** Interface and method to be used for the notification. */
-	sysarg_t imethod;
-	/** Counter. */
-	size_t counter;
-
-	/** Masked flag. */
-	bool masked;
-	/** Unmask callback. */
-	event_callback_t unmask_callback;
-} event_t;
-
-extern void event_init(void);
-extern void event_task_init(struct task *);
-extern void event_cleanup_answerbox(answerbox_t *);
-extern void event_set_unmask_callback(event_type_t, event_callback_t);
-extern void event_task_set_unmask_callback(struct task *, event_task_type_t,
-    event_callback_t);
-
-#define event_notify_0(e, m) \
-	event_notify((e), (m), 0, 0, 0, 0, 0)
-#define event_notify_1(e, m, a1) \
-	event_notify((e), (m), (a1), 0, 0, 0, 0)
-#define event_notify_2(e, m, a1, a2) \
-	event_notify((e), (m), (a1), (a2), 0, 0, 0)
-#define event_notify_3(e, m, a1, a2, a3) \
-	event_notify((e), (m), (a1), (a2), (a3), 0, 0)
-#define event_notify_4(e, m, a1, a2, a3, a4) \
-	event_notify((e), (m), (a1), (a2), (a3), (a4), 0)
-#define event_notify_5(e, m, a1, a2, a3, a4, a5) \
-	event_notify((e), (m), (a1), (a2), (a3), (a4), (a5))
-
-#define event_task_notify_0(t, e, m) \
-	event_task_notify((t), (e), (m), 0, 0, 0, 0, 0)
-#define event_task_notify_1(t, e, m, a1) \
-	event_task_notify((t), (e), (m), (a1), 0, 0, 0, 0)
-#define event_task_notify_2(t, e, m, a1, a2) \
-	event_task_notify((t), (e), (m), (a1), (a2), 0, 0, 0)
-#define event_task_notify_3(t, e, m, a1, a2, a3) \
-	event_task_notify((t), (e), (m), (a1), (a2), (a3), 0, 0)
-#define event_task_notify_4(t, e, m, a1, a2, a3, a4) \
-	event_task_notify((t), (e), (m), (a1), (a2), (a3), (a4), 0)
-#define event_task_notify_5(t, e, m, a1, a2, a3, a4, a5) \
-	event_task_notify((t), (e), (m), (a1), (a2), (a3), (a4), (a5))
-
-extern errno_t event_notify(event_type_t, bool, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t event_task_notify(struct task *, event_task_type_t, bool, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-extern sys_errno_t sys_ipc_event_subscribe(sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_event_unsubscribe(sysarg_t);
-extern sys_errno_t sys_ipc_event_unmask(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_IPC_H_
-#define KERN_IPC_H_
-
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <synch/waitq.h>
-#include <abi/ipc/ipc.h>
-#include <abi/proc/task.h>
-#include <typedefs.h>
-#include <mm/slab.h>
-#include <cap/cap.h>
-
-struct answerbox;
-struct task;
-struct call;
-
-typedef enum {
-	/** Phone is free and can be allocated */
-	IPC_PHONE_FREE = 0,
-	/** Phone is connecting somewhere */
-	IPC_PHONE_CONNECTING,
-	/** Phone is connected */
-	IPC_PHONE_CONNECTED,
-	/** Phone is hung up, waiting for answers to come */
-	IPC_PHONE_HUNGUP,
-	/** Phone was hungup from server */
-	IPC_PHONE_SLAMMED
-} ipc_phone_state_t;
-
-/** Structure identifying phone (in TASK structure) */
-typedef struct phone {
-	mutex_t lock;
-	link_t link;
-	struct task *caller;
-	struct answerbox *callee;
-	/* A call prepared for hangup ahead of time, so that it cannot fail. */
-	struct call *hangup_call;
-	ipc_phone_state_t state;
-	atomic_size_t active_calls;
-	/** User-defined label */
-	sysarg_t label;
-	kobject_t *kobject;
-} phone_t;
-
-typedef struct answerbox {
-	IRQ_SPINLOCK_DECLARE(lock);
-
-	/** Answerbox is active until it enters cleanup. */
-	bool active;
-
-	struct task *task;
-
-	waitq_t wq;
-
-	/**
-	 * Number of answers the answerbox is expecting to eventually arrive.
-	 */
-	atomic_size_t active_calls;
-
-	/** Phones connected to this answerbox. */
-	list_t connected_phones;
-	/** Received calls. */
-	list_t calls;
-	list_t dispatched_calls;  /* Should be hash table in the future */
-
-	/** Answered calls. */
-	list_t answers;
-
-	IRQ_SPINLOCK_DECLARE(irq_lock);
-
-	/** Notifications from IRQ handlers. */
-	list_t irq_notifs;
-} answerbox_t;
-
-typedef struct call {
-	kobject_t *kobject;
-
-	/**
-	 * Task link.
-	 * Valid only when the call is not forgotten.
-	 * Protected by the task's active_calls_lock.
-	 */
-	link_t ta_link;
-
-	/** Answerbox link. */
-	link_t ab_link;
-
-	unsigned int flags;
-
-	/** Protects the forget member. */
-	SPINLOCK_DECLARE(forget_lock);
-
-	/**
-	 * True if the caller 'forgot' this call and donated it to the callee.
-	 * Forgotten calls are discarded upon answering (the answer is not
-	 * delivered) and answered calls cannot be forgotten. Forgotten calls
-	 * also do not figure on the task's active call list.
-	 *
-	 * We keep this separate from the flags so that it is not necessary
-	 * to take a lock when accessing them.
-	 */
-	bool forget;
-
-	/** True if the call is in the active list. */
-	bool active;
-
-	/**
-	 * Identification of the caller.
-	 * Valid only when the call is not forgotten.
-	 */
-	struct task *sender;
-
-	/*
-	 * Answerbox that will receive the answer.
-	 * This will most of the times be the sender's answerbox,
-	 * but we allow for useful exceptions.
-	 */
-	answerbox_t *callerbox;
-
-	/** Phone which was used to send the call. */
-	phone_t *caller_phone;
-
-	/** Private data to internal IPC. */
-	sysarg_t priv;
-
-	/** Data passed from/to userspace. */
-	ipc_data_t data;
-
-	/** Method as it was sent in the request. */
-	sysarg_t request_method;
-
-	/** Buffer for IPC_M_DATA_WRITE and IPC_M_DATA_READ. */
-	uint8_t *buffer;
-} call_t;
-
-extern slab_cache_t *phone_cache;
-
-extern answerbox_t *ipc_box_0;
-
-extern kobject_ops_t call_kobject_ops;
-
-extern void ipc_init(void);
-
-extern call_t *ipc_call_alloc(void);
-
-extern errno_t ipc_call_sync(phone_t *, call_t *);
-extern errno_t ipc_call(phone_t *, call_t *);
-extern errno_t ipc_wait_for_call(answerbox_t *, uint32_t, unsigned int, call_t **);
-extern errno_t ipc_forward(call_t *, phone_t *, answerbox_t *, unsigned int);
-extern void ipc_answer(answerbox_t *, call_t *);
-extern void _ipc_answer_free_call(call_t *, bool);
-
-extern void ipc_phone_init(phone_t *, struct task *);
-extern bool ipc_phone_connect(phone_t *, answerbox_t *);
-extern errno_t ipc_phone_hangup(phone_t *);
-
-extern void ipc_answerbox_init(answerbox_t *, struct task *);
-
-extern void ipc_cleanup(void);
-extern void ipc_backsend_err(phone_t *, call_t *, errno_t);
-extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
-extern void ipc_cleanup_call_list(answerbox_t *, list_t *);
-
-extern void ipc_print_task(task_id_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/ipcrsc.h
===================================================================
--- kernel/generic/include/ipc/ipcrsc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_IPCRSC_H_
-#define KERN_IPCRSC_H_
-
-#include <proc/task.h>
-#include <ipc/ipc.h>
-#include <cap/cap.h>
-
-extern kobject_ops_t phone_kobject_ops;
-
-extern errno_t phone_alloc(task_t *, bool, cap_phone_handle_t *, kobject_t **);
-extern void phone_dealloc(cap_phone_handle_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_IPC_IRQ_H_
-#define KERN_IPC_IRQ_H_
-
-/** Maximum number of IPC IRQ programmed I/O ranges. */
-#define IRQ_MAX_RANGE_COUNT  8
-
-/** Maximum length of IPC IRQ program. */
-#define IRQ_MAX_PROG_SIZE  256
-
-#include <ipc/ipc.h>
-#include <ddi/irq.h>
-#include <typedefs.h>
-#include <adt/list.h>
-#include <cap/cap.h>
-
-extern kobject_ops_t irq_kobject_ops;
-
-extern irq_ownership_t ipc_irq_top_half_claim(irq_t *);
-extern void ipc_irq_top_half_handler(irq_t *);
-
-extern errno_t ipc_irq_subscribe(answerbox_t *, inr_t, sysarg_t, uspace_ptr_irq_code_t,
-    uspace_ptr_cap_irq_handle_t);
-extern errno_t ipc_irq_unsubscribe(answerbox_t *, cap_irq_handle_t);
-
-/*
- * User friendly wrappers for ipc_irq_send_msg(). They are in the form
- * ipc_irq_send_msg_m(), where m is the number of payload arguments.
- */
-#define ipc_irq_send_msg_0(irq) \
-	ipc_irq_send_msg((irq), 0, 0, 0, 0, 0)
-
-#define ipc_irq_send_msg_1(irq, a1) \
-	ipc_irq_send_msg((irq), (a1), 0, 0, 0, 0)
-
-#define ipc_irq_send_msg_2(irq, a1, a2) \
-	ipc_irq_send_msg((irq), (a1), (a2), 0, 0, 0)
-
-#define ipc_irq_send_msg_3(irq, a1, a2, a3) \
-	ipc_irq_send_msg((irq), (a1), (a2), (a3), 0, 0)
-
-#define ipc_irq_send_msg_4(irq, a1, a2, a3, a4) \
-	ipc_irq_send_msg((irq), (a1), (a2), (a3), (a4), 0)
-
-#define ipc_irq_send_msg_5(irq, a1, a2, a3, a4, a5) \
-	ipc_irq_send_msg((irq), (a1), (a2), (a3), (a4), (a5))
-
-extern void ipc_irq_send_msg(irq_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/kbox.h
===================================================================
--- kernel/generic/include/ipc/kbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_IPC_KBOX_H_
-#define KERN_IPC_KBOX_H_
-
-#include <typedefs.h>
-
-/** Kernel answerbox structure. */
-typedef struct kbox {
-	/** The answerbox itself. */
-	answerbox_t box;
-	/** Thread used to service the answerbox. */
-	struct thread *thread;
-	/** Kbox thread creation vs. begin of cleanup mutual exclusion. */
-	mutex_t cleanup_lock;
-	/** True if cleanup of kbox has already started. */
-	bool finished;
-} kbox_t;
-
-extern errno_t ipc_connect_kbox(task_id_t, cap_phone_handle_t *);
-extern void ipc_kbox_cleanup(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/sysipc.h
===================================================================
--- kernel/generic/include/ipc/sysipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYSIPC_H_
-#define KERN_SYSIPC_H_
-
-#include <ipc/ipc.h>
-#include <ipc/irq.h>
-#include <typedefs.h>
-
-extern errno_t ipc_req_internal(cap_phone_handle_t, ipc_data_t *, sysarg_t);
-
-extern sys_errno_t sys_ipc_call_async_fast(cap_phone_handle_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t, uspace_ptr_ipc_data_t,
-    sysarg_t);
-extern sys_errno_t sys_ipc_answer_fast(cap_call_handle_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-extern sys_errno_t sys_ipc_answer_slow(cap_call_handle_t, uspace_ptr_ipc_data_t);
-extern sys_errno_t sys_ipc_wait_for_call(uspace_ptr_ipc_data_t, uint32_t, unsigned int);
-extern sys_errno_t sys_ipc_poke(void);
-extern sys_errno_t sys_ipc_forward_fast(cap_call_handle_t, cap_phone_handle_t,
-    sysarg_t, sysarg_t, sysarg_t, unsigned int);
-extern sys_errno_t sys_ipc_forward_slow(cap_call_handle_t, cap_phone_handle_t,
-    uspace_ptr_ipc_data_t, unsigned int);
-extern sys_errno_t sys_ipc_hangup(cap_phone_handle_t);
-
-extern sys_errno_t sys_ipc_irq_subscribe(inr_t, sysarg_t, uspace_ptr_irq_code_t,
-    uspace_ptr_cap_irq_handle_t);
-extern sys_errno_t sys_ipc_irq_unsubscribe(cap_irq_handle_t);
-
-extern sys_errno_t sys_ipc_connect_kbox(uspace_ptr_task_id_t, uspace_ptr_cap_phone_handle_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/sysipc_ops.h
===================================================================
--- kernel/generic/include/ipc/sysipc_ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYSIPC_OPS_H_
-#define KERN_SYSIPC_OPS_H_
-
-#include <ipc/ipc.h>
-
-#define SYSIPC_OP(op, call, ...) \
-	({ \
-		sysipc_ops_t *ops = sysipc_ops_get((call)->request_method); \
-		assert(ops->op); \
-		ops->op((call), ##__VA_ARGS__); \
-	})
-
-/**
- * This header declares the per-method IPC callbacks. Using these callbacks,
- * each IPC method (but system methods in particular), can define actions that
- * will be called at specific moments in the call life-cycle.
- *
- * Normally, the kernel will attempt to invoke the following callbacks in the
- * following order on each call:
- *
- * request_preprocess()
- * request_process()
- * answer_preprocess()
- * answer_process()
- *
- * This callback invocation sequence is a natural order of processing. Note,
- * however, that due to various special circumstances, callbacks may be called
- * also in a different than natural order of processing. This means that some
- * callbacks may be skipped and some others may be called instead.
- *
- * The additional callbacks that may be called are as follows:
- *
- * request_forget()
- * answer_cleanup()
- *
- * There are several notable scenarios in which some callbacks of the natural
- * order of processing will be skipped.
- *
- * The request_process(), answer_preprocess() and answer_process() callbacks
- * will be skipped if the call cannot be delivered to the callee. This may
- * happen when e.g. the request_preprocess() callback fails or the connection
- * to the callee is not functional. The next callback that will be invoked on
- * the call is request_forget().
- *
- * The comments for each callback type describe the specifics of each callback
- * such as the context in which it is invoked and various constraints.
- */
-
-typedef struct {
-	/**
-	 * This callback is called from request_preprocess().
-	 *
-	 * Context:		caller
-	 * Caller alive:	guaranteed
-	 * Races with:		N/A
-	 * Invoked on:		all calls
-	 */
-	errno_t (*request_preprocess)(call_t *, phone_t *);
-
-	/**
-	 * This callback is called when the IPC cleanup code wins the race to
-	 * forget the call.
-	 *
-	 * Context:		caller
-	 * Caller alive:	guaranteed
-	 * Races with:		request_process(), answer_cleanup(),
-	 *			_ipc_answer_free_call()
-	 * Invoked on:		all forgotten calls
-	 */
-	errno_t (*request_forget)(call_t *);
-
-	/**
-	 * This callback is called from process_request().
-	 *
-	 * Context:		callee
-	 * Caller alive:	no guarantee
-	 * Races with:		request_forget()
-	 * Invoked on:		all calls delivered to the callee
-	 */
-	int (*request_process)(call_t *, answerbox_t *);
-
-	/**
-	 * This callback is called when answer_preprocess() loses the race to
-	 * answer the call.
-	 *
-	 * Context:		callee
-	 * Caller alive:	no guarantee
-	 * Races with:		request_forget()
-	 * Invoked on:		all forgotten calls
-	 */
-	errno_t (*answer_cleanup)(call_t *, ipc_data_t *);
-
-	/**
-	 * This callback is called when answer_preprocess() wins the race to
-	 * answer the call.
-	 *
-	 * Context:		callee
-	 * Caller alive:	guaranteed
-	 * Races with:		N/A
-	 * Invoked on:		all answered calls
-	 */
-	errno_t (*answer_preprocess)(call_t *, ipc_data_t *);
-
-	/**
-	 * This callback is called from process_answer().
-	 *
-	 * Context:		caller
-	 * Caller alive:	guaranteed
-	 * Races with:		N/A
-	 * Invoked on:		all answered calls
-	 */
-	errno_t (*answer_process)(call_t *);
-} sysipc_ops_t;
-
-extern sysipc_ops_t *sysipc_ops_get(sysarg_t);
-
-extern errno_t null_request_preprocess(call_t *, phone_t *);
-extern errno_t null_request_forget(call_t *);
-extern int null_request_process(call_t *, answerbox_t *);
-extern errno_t null_answer_cleanup(call_t *, ipc_data_t *);
-extern errno_t null_answer_preprocess(call_t *, ipc_data_t *);
-extern errno_t null_answer_process(call_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/ipc/sysipc_priv.h
===================================================================
--- kernel/generic/include/ipc/sysipc_priv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYSIPC_PRIV_H_
-#define KERN_SYSIPC_PRIV_H_
-
-#include <ipc/ipc.h>
-
-extern errno_t answer_preprocess(call_t *, ipc_data_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/lib/elf.h
===================================================================
--- kernel/generic/include/lib/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ELF_H_
-#define KERN_ELF_H_
-
-#include <abi/elf.h>
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/lib/elf_load.h
===================================================================
--- kernel/generic/include/lib/elf_load.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ELF_LOAD_H_
-#define KERN_ELF_LOAD_H_
-
-#include <abi/elf.h>
-
-extern errno_t elf_load(elf_header_t *, as_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/lib/ra.h
===================================================================
--- kernel/generic/include/lib/ra.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_RA_H_
-#define KERN_RA_H_
-
-#include <typedefs.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <synch/spinlock.h>
-
-typedef struct {
-	IRQ_SPINLOCK_DECLARE(lock);
-	list_t spans;		/**< List of arena's spans. */
-} ra_arena_t;
-
-typedef struct {
-	link_t span_link;	/**< Arena's list of spans link. */
-
-	list_t segments;	/**< List of span's segments. */
-
-	size_t max_order;	/**< Base 2 logarithm of span's size. */
-	list_t *free;		/**< max_order segment free lists. */
-
-	hash_table_t used;
-
-	uintptr_t base;		/**< Span base. */
-	size_t size;		/**< Span size. */
-} ra_span_t;
-
-#define RA_SEGMENT_FREE		1
-
-/*
- * We would like to achieve a good ratio of the size of one unit of the
- * represented resource (e.g. a page) and sizeof(ra_segment_t).  We therefore
- * attempt to have as few redundant information in the segment as possible. For
- * example, the size of the segment needs to be calculated from the segment
- * base and the base of the following segment.
- */
-typedef struct {
-	link_t segment_link;	/**< Span's segment list link. */
-
-	/*
-	 * A segment cannot be both on the free list and in the used hash.
-	 * Their respective links can therefore occupy the same space.
-	 */
-	union {
-		link_t fl_link;		/**< Span's free list link. */
-		ht_link_t uh_link;	/**< Span's used hash link. */
-	};
-
-	uintptr_t base;		/**< Segment base. */
-	uint8_t flags;		/**< Segment flags. */
-} ra_segment_t;
-
-extern void ra_init(void);
-extern ra_arena_t *ra_arena_create(void);
-extern void ra_arena_destroy(ra_arena_t *);
-extern bool ra_span_add(ra_arena_t *, uintptr_t, size_t);
-extern bool ra_alloc(ra_arena_t *, size_t, size_t, uintptr_t *);
-extern void ra_free(ra_arena_t *, uintptr_t, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/lib/rd.h
===================================================================
--- kernel/generic/include/lib/rd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_RD_H_
-#define KERN_RD_H_
-
-#include <stddef.h>
-
-extern void init_rd(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/lib/refcount.h
===================================================================
--- kernel/generic/include/lib/refcount.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/*
- * Using atomics for reference counting efficiently is a little tricky,
- * so we define a unified API for this.
- */
-
-#ifndef _LIBC_REFCOUNT_H_
-#define _LIBC_REFCOUNT_H_
-
-#include <assert.h>
-#include <stdatomic.h>
-#include <stdbool.h>
-
-/* Wrapped in a structure to prevent direct manipulation. */
-typedef struct atomic_refcount {
-	volatile atomic_int __cnt;
-} atomic_refcount_t;
-
-#define REFCOUNT_INITIALIZER() { \
-	.__cnt = ATOMIC_VAR_INIT(0), \
-}
-
-static inline void refcount_init(atomic_refcount_t *rc)
-{
-	atomic_init(&rc->__cnt, 0);
-}
-
-/**
- * Increment a reference count.
- *
- * Calling this without already owning a reference is undefined behavior.
- * E.g. acquiring a reference through a shared mutable pointer requires that
- * the caller first locks the pointer itself (thereby acquiring the reference
- * inherent to the shared variable), and only then may call refcount_up().
- */
-static inline void refcount_up(atomic_refcount_t *rc)
-{
-	// NOTE: We can use relaxed operation because acquiring a reference
-	//       implies no ordering relationships. A reference-counted object
-	//       still needs to be synchronized independently of the refcount.
-
-	int old = atomic_fetch_add_explicit(&rc->__cnt, 1,
-	    memory_order_relaxed);
-
-	/* old < 0 indicates that the function is used incorrectly. */
-	assert(old >= 0);
-	(void) old;
-}
-
-/**
- * Try to upgrade a weak reference.
- * Naturally, this is contingent on another form of synchronization being used
- * to ensure that the object continues to exist while the weak reference is in
- * use.
- */
-static inline bool refcount_try_up(atomic_refcount_t *rc)
-{
-	int cnt = atomic_load_explicit(&rc->__cnt, memory_order_relaxed);
-
-	while (cnt >= 0) {
-		if (atomic_compare_exchange_weak_explicit(&rc->__cnt, &cnt, cnt + 1,
-		    memory_order_relaxed, memory_order_relaxed)) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-static inline bool refcount_unique(atomic_refcount_t *rc)
-{
-	int val = atomic_load_explicit(&rc->__cnt, memory_order_acquire);
-	if (val < 0) {
-		assert(val == -1);
-	}
-
-	return val <= 0;
-}
-
-/**
- * Decrement a reference count. Caller must own the reference.
- *
- * If the function returns `false`, the caller no longer owns the reference and
- * must not access the reference counted object.
- *
- * If the function returns `true`, the caller is now the sole owner of the
- * reference counted object, and must deallocate it.
- */
-static inline bool refcount_down(atomic_refcount_t *rc)
-{
-	// NOTE: The decrementers don't need to synchronize with each other,
-	//       but they do need to synchronize with the one doing deallocation.
-	int old = atomic_fetch_sub_explicit(&rc->__cnt, 1,
-	    memory_order_release);
-
-	assert(old >= 0);
-
-	if (old == 0) {
-		// NOTE: We are holding the last reference, so we must now
-		//       synchronize with all the other decrementers.
-
-		int val = atomic_load_explicit(&rc->__cnt,
-		    memory_order_acquire);
-		assert(val == -1);
-
-		/*
-		 * The compiler probably wouldn't optimize the memory barrier
-		 * away, but better safe than sorry.
-		 */
-		return val < 0;
-	}
-
-	return false;
-}
-
-#endif
Index: rnel/generic/include/log.h
===================================================================
--- kernel/generic/include/log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_LOG_H_
-#define KERN_LOG_H_
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <printf/verify.h>
-#include <abi/log.h>
-#include <abi/klog.h>
-
-extern void log_init(void);
-extern void log_begin(log_facility_t, log_level_t);
-extern void log_end(void);
-extern int log_vprintf(const char *, va_list);
-extern int log_printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int log(log_facility_t, log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
-
-extern sys_errno_t sys_klog(sysarg_t, uspace_addr_t buf, size_t size,
-    sysarg_t level, uspace_ptr_size_t uspace_nread);
-
-#endif /* KERN_LOG_H_ */
-
-/** @}
- */
Index: rnel/generic/include/macros.h
===================================================================
--- kernel/generic/include/macros.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MACROS_H_
-#define KERN_MACROS_H_
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-#include <trace.h>
-
-/** Return true if the intervals overlap.
- *
- * @param s1  Start address of the first interval.
- * @param sz1 Size of the first interval.
- * @param s2  Start address of the second interval.
- * @param sz2 Size of the second interval.
- *
- */
-_NO_TRACE static inline int overlaps(uint64_t s1, uint64_t sz1, uint64_t s2,
-    uint64_t sz2)
-{
-	uint64_t e1 = s1 + sz1 - 1;
-	uint64_t e2 = s2 + sz2 - 1;
-
-	/* both sizes are non-zero */
-	if (sz1 && sz2)
-		return ((s1 <= e2) && (s2 <= e1));
-
-	/* one size is non-zero */
-	if (sz2)
-		return ((s1 >= s2) && (s1 <= e2));
-
-	if (sz1)
-		return ((s2 >= s1) && (s2 <= e1));
-
-	/* both are zero */
-	return (s1 == s2);
-}
-
-/** Return true if the second interval is within the first interval.
- *
- * @param s1  Start address of the first interval.
- * @param sz1 Size of the first interval.
- * @param s2  Start address of the second interval.
- * @param sz2 Size of the second interval.
- *
- */
-_NO_TRACE static inline int iswithin(uint64_t s1, uint64_t sz1, uint64_t s2,
-    uint64_t sz2)
-{
-	uint64_t e1;
-	uint64_t e2;
-
-	/* Handle the two corner cases when either sz1 or sz2 are zero. */
-	if (sz1 == 0)
-		return (s1 == s2) && (sz2 == 0);
-
-	e1 = s1 + sz1 - 1;
-	if (sz2 == 0)
-		return (s1 <= s2) && (s2 <= e1);
-
-	e2 = s2 + sz2 - 1;
-
-	/* e1 and e2 are end addresses, the sum is imune to overflow */
-	return ((s1 <= s2) && (e1 >= e2));
-}
-
-#endif /* __ASSEMBLER__ */
-
-#define ispwr2(x)  (((x) & ((x) - 1)) == 0)
-
-#define isdigit(d)     (((d) >= '0') && ((d) <= '9'))
-#define islower(c)     (((c) >= 'a') && ((c) <= 'z'))
-#define isupper(c)     (((c) >= 'A') && ((c) <= 'Z'))
-#define isalpha(c)     (is_lower((c)) || is_upper((c)))
-#define isalphanum(c)  (is_alpha((c)) || is_digit((c)))
-#define isspace(c) \
-	(((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r'))
-
-#define min(a, b)  ((a) < (b) ? (a) : (b))
-#define max(a, b)  ((a) > (b) ? (a) : (b))
-
-#define min3(a, b, c)  ((a) < (b) ? (min(a, c)) : (min(b, c)))
-#define max3(a, b, c)  ((a) > (b) ? (max(a, c)) : (max(b, c)))
-
-/* Compute overlapping of physical addresses */
-#define PA_OVERLAPS(x, szx, y, szy) \
-	overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy))
-
-#define PFN2ADDR(frame)  ((frame) << FRAME_WIDTH)
-#define ADDR2PFN(addr)   ((addr) >> FRAME_WIDTH)
-
-#define FRAMES2SIZE(frames)  ((frames) << FRAME_WIDTH)
-#define SIZE2FRAMES(size) \
-	(((size) == 0) ? 0 : ((((size) - 1) >> FRAME_WIDTH) + 1))
-
-#define KiB2SIZE(kb)  ((kb) << 10)
-#define MiB2SIZE(mb)  ((mb) << 20)
-
-#define STRING(arg)      STRING_ARG(arg)
-#define STRING_ARG(arg)  #arg
-
-#define LOWER32(arg)  (((uint64_t) (arg)) & UINT32_C(0xffffffff))
-#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & UINT32_C(0xffffffff))
-
-#define MERGE_LOUP32(lo, up) \
-	((((uint64_t) (lo)) & UINT32_C(0xffffffff)) \
-	    | ((((uint64_t) (up)) & UINT32_C(0xffffffff)) << 32))
-
-/* Test for sum overflow. */
-#define overflows(a, b) \
-	((a) + (b) < (a))
-
-/* Test for sum overflow into positive numbers. */
-#define overflows_into_positive(a, b) \
-	(overflows((a), (b)) && ((a) + (b) > 0))
-
-/** Pseudorandom generator
- *
- * A pretty standard linear congruential pseudorandom
- * number generator (m = 2^32 or 2^64 depending on architecture).
- *
- */
-#define RANDI(seed) \
-	({ \
-		(seed) = 1103515245 * (seed) + 12345; \
-		(seed); \
-	})
-
-/** Get the size of an array in array elements
- *
- * @param array Array to determine the size of
- *
- * @return Size of array in array elements
- *
- */
-#define sizeof_array(array) \
-	(sizeof(array) / sizeof((array)[0]))
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/main/kinit.h
===================================================================
--- kernel/generic/include/main/kinit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_KINIT_H_
-#define KERN_KINIT_H_
-
-extern void kinit(void *arg);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/main/main.h
===================================================================
--- kernel/generic/include/main/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MAIN_H_
-#define KERN_MAIN_H_
-
-#include <proc/task.h>
-#include <typedefs.h>
-
-/* Address of the start of the kernel image. */
-extern uint8_t kernel_load_address[];
-/* Address of the end of kernel. */
-extern uint8_t kdata_end[];
-extern task_t *kernel_task;
-
-extern void main_bsp(void);
-extern void main_ap(void);
-
-extern void malloc_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/main/shutdown.h
===================================================================
--- kernel/generic/include/main/shutdown.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SHUTDOWN_H_
-#define KERN_SHUTDOWN_H_
-
-#include <errno.h>
-
-extern void reboot(void);
-extern sys_errno_t sys_reboot(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/main/uinit.h
===================================================================
--- kernel/generic/include/main/uinit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_UINIT_H_
-#define KERN_UINIT_H_
-
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t pc;
-	uintptr_t sp;
-} uinit_arg_t;
-
-extern void uinit(void *arg);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/main/version.h
===================================================================
--- kernel/generic/include/main/version.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_VERSION_H_
-#define KERN_VERSION_H_
-
-extern void version_print(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/member.h
===================================================================
--- kernel/generic/include/member.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2021 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MEMBER_H_
-#define KERN_MEMBER_H_
-
-#include <stdint.h>
-
-#define member_to_inst(ptr_member, type, member_identif) \
-	((type *) (((uintptr_t) (ptr_member)) - \
-	    offsetof(type, member_identif)))
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/memw.h
===================================================================
--- kernel/generic/include/memw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MEM_H_
-#define KERN_MEM_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <mem.h>
-
-extern void memsetb(void *, size_t, uint8_t)
-    __attribute__((nonnull(1)));
-extern void memsetw(void *, size_t, uint16_t)
-    __attribute__((nonnull(1)));
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/as.h
===================================================================
--- kernel/generic/include/mm/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,389 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_AS_H_
-#define KERN_AS_H_
-
-#include <typedefs.h>
-#include <abi/mm/as.h>
-#include <arch/mm/page.h>
-#include <arch/mm/as.h>
-#include <arch/mm/asid.h>
-#include <arch/istate.h>
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <lib/elf.h>
-#include <arch.h>
-#include <lib/refcount.h>
-
-#define AS                   CURRENT->as
-
-/**
- * Defined to be true if user address space and kernel address space shadow each
- * other.
- *
- */
-#define KERNEL_ADDRESS_SPACE_SHADOWED  KERNEL_ADDRESS_SPACE_SHADOWED_ARCH
-
-/**
- * Defined to be true if user address space and kernel address space do not
- * share the same page table.
- */
-#define KERNEL_SEPARATE_PTL0 KERNEL_SEPARATE_PTL0_ARCH
-
-#define KERNEL_ADDRESS_SPACE_START  KERNEL_ADDRESS_SPACE_START_ARCH
-#define KERNEL_ADDRESS_SPACE_END    KERNEL_ADDRESS_SPACE_END_ARCH
-#define USER_ADDRESS_SPACE_START    USER_ADDRESS_SPACE_START_ARCH
-#define USER_ADDRESS_SPACE_END      USER_ADDRESS_SPACE_END_ARCH
-
-/** Kernel address space. */
-#define FLAG_AS_KERNEL  (1 << 0)
-
-/* Address space area attributes. */
-#define AS_AREA_ATTR_NONE     0
-#define AS_AREA_ATTR_PARTIAL  1  /**< Not fully initialized area. */
-
-/** The page fault was resolved by as_page_fault(). */
-#define AS_PF_OK     0
-
-/** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */
-#define AS_PF_DEFER  1
-
-/** The page fault was not resolved by as_page_fault(). */
-#define AS_PF_FAULT  2
-
-/** The page fault was not resolved by as_page_fault(). Non-verbose version. */
-#define AS_PF_SILENT 3
-
-/** Address space structure.
- *
- * as_t contains the list of as_areas of userspace accessible
- * pages for one or more tasks. Ranges of kernel memory pages are not
- * supposed to figure in the list as they are shared by all tasks and
- * set up during system initialization.
- *
- */
-typedef struct as {
-	/** Protected by asidlock. */
-	link_t inactive_as_with_asid_link;
-
-	/**
-	 * Number of processors on which this
-	 * address space is active. Protected by
-	 * asidlock.
-	 */
-	size_t cpu_refcount;
-
-	/** Address space identifier.
-	 *
-	 * Constant on architectures that do not
-	 * support ASIDs. Protected by asidlock.
-	 *
-	 */
-	asid_t asid;
-
-	/** Number of references (i.e. tasks that reference this as). */
-	atomic_refcount_t refcount;
-
-	mutex_t lock;
-
-	/** Address space areas in this address space by base address.
-	 *
-	 * Members are of type as_area_t.
-	 */
-	odict_t as_areas;
-
-	/** Non-generic content. */
-	as_genarch_t genarch;
-
-	/** Architecture specific content. */
-	as_arch_t arch;
-} as_t;
-
-typedef struct {
-	pte_t *(*page_table_create)(unsigned int);
-	void (*page_table_destroy)(pte_t *);
-	void (*page_table_lock)(as_t *, bool);
-	void (*page_table_unlock)(as_t *, bool);
-	bool (*page_table_locked)(as_t *);
-} as_operations_t;
-
-/** Single anonymous page mapping. */
-typedef struct {
-	/** Containing pagemap structure */
-	struct as_pagemap *pagemap;
-	/** Link to @c shinfo->pagemap ordered dictionary */
-	odlink_t lpagemap;
-	/** Virtual address */
-	uintptr_t vaddr;
-	/** Physical frame address */
-	uintptr_t frame;
-} as_page_mapping_t;
-
-/** Map of anonymous pages in a shared area. */
-typedef struct as_pagemap {
-	/**
-	 * Dictionary ordered by virtual address. Members are of type
-	 * as_page_mapping_t
-	 */
-	odict_t map;
-} as_pagemap_t;
-
-/** Used space interval */
-typedef struct {
-	/** Containing used_space structure */
-	struct used_space *used_space;
-	/** Link to @c used_space->ivals */
-	odlink_t lused_space;
-	/** First page address */
-	uintptr_t page;
-	/** Count of pages */
-	size_t count;
-} used_space_ival_t;
-
-/** Map of used space in an address space area */
-typedef struct used_space {
-	/**
-	 * Dictionary of intervals by start address.
-	 * Members are of type @c used_space_ival_t.
-	 */
-	odict_t ivals;
-	/** Total number of used pages. */
-	size_t pages;
-} used_space_t;
-
-/**
- * This structure contains information associated with the shared address space
- * area.
- *
- */
-typedef struct {
-	/** This lock must be acquired only when the as_area lock is held. */
-	mutex_t lock;
-	/** This structure can be deallocated if refcount drops to 0. */
-	size_t refcount;
-	/** True if the area has been ever shared. */
-	bool shared;
-
-	/** Complete map of anonymous pages of the shared area. */
-	as_pagemap_t pagemap;
-
-	/** Address space area backend. */
-	struct mem_backend *backend;
-	/** Address space area shared data. */
-	void *backend_shared_data;
-} share_info_t;
-
-/** Page fault access type. */
-typedef enum {
-	PF_ACCESS_READ,
-	PF_ACCESS_WRITE,
-	PF_ACCESS_EXEC,
-	PF_ACCESS_UNKNOWN
-} pf_access_t;
-
-struct mem_backend;
-
-/** Backend data stored in address space area. */
-typedef union mem_backend_data {
-	/* anon_backend members */
-	struct {
-	};
-
-	/** elf_backend members */
-	struct {
-		uintptr_t elf_base;
-		elf_header_t *elf;
-		elf_segment_header_t *segment;
-	};
-
-	/** phys_backend members */
-	struct {
-		uintptr_t base;
-		size_t frames;
-		bool anonymous;
-		struct parea *parea;
-	};
-
-	/** user_backend members */
-	struct {
-		as_area_pager_info_t pager_info;
-	};
-
-} mem_backend_data_t;
-
-/** Address space area structure.
- *
- * Each as_area_t structure describes one contiguous area of virtual memory.
- *
- */
-typedef struct {
-	mutex_t lock;
-
-	/** Containing address space. */
-	as_t *as;
-
-	/** Link to @c as->as_areas */
-	odlink_t las_areas;
-
-	/** Memory flags. */
-	unsigned int flags;
-
-	/** Address space area attributes. */
-	unsigned int attributes;
-
-	/** Number of pages in the area. */
-	size_t pages;
-
-	/** Base address of this area. */
-	uintptr_t base;
-
-	/** Map of used space. */
-	used_space_t used_space;
-
-	/**
-	 * If the address space area is shared. this is
-	 * a reference to the share info structure.
-	 */
-	share_info_t *sh_info;
-
-	/** Memory backend backing this address space area. */
-	struct mem_backend *backend;
-
-	/** Data to be used by the backend. */
-	mem_backend_data_t backend_data;
-} as_area_t;
-
-/** Address space area backend structure. */
-typedef struct mem_backend {
-	bool (*create)(as_area_t *);
-	bool (*resize)(as_area_t *, size_t);
-	void (*share)(as_area_t *);
-	void (*destroy)(as_area_t *);
-
-	bool (*is_resizable)(as_area_t *);
-	bool (*is_shareable)(as_area_t *);
-
-	int (*page_fault)(as_area_t *, uintptr_t, pf_access_t);
-	void (*frame_free)(as_area_t *, uintptr_t, uintptr_t);
-
-	bool (*create_shared_data)(as_area_t *);
-	void (*destroy_shared_data)(void *);
-} mem_backend_t;
-
-extern as_t *AS_KERNEL;
-
-extern const as_operations_t *as_operations;
-extern list_t inactive_as_with_asid_list;
-
-extern void as_init(void);
-
-extern as_t *as_create(unsigned int);
-extern void as_hold(as_t *);
-extern void as_release(as_t *);
-extern void as_switch(as_t *, as_t *);
-extern int as_page_fault(uintptr_t, pf_access_t, istate_t *);
-
-extern as_area_t *as_area_create(as_t *, unsigned int, size_t, unsigned int,
-    mem_backend_t *, mem_backend_data_t *, uintptr_t *, uintptr_t);
-extern errno_t as_area_destroy(as_t *, uintptr_t);
-extern errno_t as_area_resize(as_t *, uintptr_t, size_t, unsigned int);
-extern errno_t as_area_share(as_t *, uintptr_t, size_t, as_t *, unsigned int,
-    uintptr_t *, uintptr_t);
-extern errno_t as_area_change_flags(as_t *, unsigned int, uintptr_t);
-extern as_area_t *as_area_first(as_t *);
-extern as_area_t *as_area_next(as_area_t *);
-
-extern void as_pagemap_initialize(as_pagemap_t *);
-extern void as_pagemap_finalize(as_pagemap_t *);
-extern as_page_mapping_t *as_pagemap_first(as_pagemap_t *);
-extern as_page_mapping_t *as_pagemap_next(as_page_mapping_t *);
-extern errno_t as_pagemap_find(as_pagemap_t *, uintptr_t, uintptr_t *);
-extern void as_pagemap_insert(as_pagemap_t *, uintptr_t, uintptr_t);
-extern void as_pagemap_remove(as_page_mapping_t *);
-
-extern unsigned int as_area_get_flags(as_area_t *);
-extern bool as_area_check_access(as_area_t *, pf_access_t);
-extern size_t as_area_get_size(uintptr_t);
-extern used_space_ival_t *used_space_first(used_space_t *);
-extern used_space_ival_t *used_space_next(used_space_ival_t *);
-extern used_space_ival_t *used_space_find_gteq(used_space_t *, uintptr_t);
-extern bool used_space_insert(used_space_t *, uintptr_t, size_t);
-
-/* Interface to be implemented by architectures. */
-
-#ifndef as_constructor_arch
-extern errno_t as_constructor_arch(as_t *, unsigned int);
-#endif /* !def as_constructor_arch */
-
-#ifndef as_destructor_arch
-extern int as_destructor_arch(as_t *);
-#endif /* !def as_destructor_arch */
-
-#ifndef as_create_arch
-extern errno_t as_create_arch(as_t *, unsigned int);
-#endif /* !def as_create_arch */
-
-#ifndef as_install_arch
-extern void as_install_arch(as_t *);
-#endif /* !def as_install_arch */
-
-#ifndef as_deinstall_arch
-extern void as_deinstall_arch(as_t *);
-#endif /* !def as_deinstall_arch */
-
-/* Backend declarations and functions. */
-extern mem_backend_t anon_backend;
-extern mem_backend_t elf_backend;
-extern mem_backend_t phys_backend;
-extern mem_backend_t user_backend;
-
-/* Address space area related syscalls. */
-extern sysarg_t sys_as_area_create(uintptr_t, size_t, unsigned int, uintptr_t,
-    uspace_ptr_as_area_pager_info_t);
-extern sys_errno_t sys_as_area_resize(uintptr_t, size_t, unsigned int);
-extern sys_errno_t sys_as_area_change_flags(uintptr_t, unsigned int);
-extern sys_errno_t sys_as_area_get_info(uintptr_t, uspace_ptr_as_area_info_t);
-extern sys_errno_t sys_as_area_destroy(uintptr_t);
-
-/* Introspection functions. */
-extern as_area_info_t *as_get_area_info(as_t *, size_t *);
-extern void as_print(as_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/asid.h
===================================================================
--- kernel/generic/include/mm/asid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-/*
- * This is generic interface for managing
- * Address Space IDentifiers (ASIDs).
- */
-
-#ifndef KERN_ASID_H_
-#define KERN_ASID_H_
-
-#ifndef __ASSEMBLER__
-
-#include <arch/mm/asid.h>
-#include <synch/spinlock.h>
-#include <adt/list.h>
-#include <mm/as.h>
-
-#endif
-
-#define ASID_KERNEL	0
-#define ASID_INVALID	1
-#define ASID_START	2
-#define ASID_MAX	ASID_MAX_ARCH
-
-#ifndef __ASSEMBLER__
-
-#define ASIDS_ALLOCABLE	((ASID_MAX + 1) - ASID_START)
-
-SPINLOCK_EXTERN(asidlock);
-extern link_t as_with_asid_head;
-
-#ifndef asid_get
-extern asid_t asid_get(void);
-#endif /* !def asid_get */
-
-#ifndef asid_put
-extern void asid_put(asid_t asid);
-#endif /* !def asid_put */
-
-#ifndef asid_install
-extern void asid_install(as_t *as);
-#endif /* !def asid_install */
-
-#ifndef asid_find_free
-extern asid_t asid_find_free(void);
-#endif /* !def asid_find_free */
-
-#ifndef asid_put_arch
-extern void asid_put_arch(asid_t asid);
-#endif /* !def asid_put_arch */
-
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/frame.h
===================================================================
--- kernel/generic/include/mm/frame.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2005 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_FRAME_H_
-#define KERN_FRAME_H_
-
-#include <typedefs.h>
-#include <trace.h>
-#include <adt/bitmap.h>
-#include <adt/list.h>
-#include <synch/spinlock.h>
-#include <arch/mm/page.h>
-#include <arch/mm/frame.h>
-
-/** Maximum number of zones in the system. */
-#define ZONES_MAX  32
-
-typedef uint8_t frame_flags_t;
-
-#define FRAME_NONE        0x00
-/** Do not panic and do not sleep on failure. */
-#define FRAME_ATOMIC      0x01
-/** Do not start reclaiming when no free memory. */
-#define FRAME_NO_RECLAIM  0x02
-/** Do not reserve / unreserve memory. */
-#define FRAME_NO_RESERVE  0x04
-/** Allocate a frame which can be identity-mapped. */
-#define FRAME_LOWMEM      0x08
-/**
- * Allocate a frame outside the identity-mapped region if possible.
- * Fall back to low memory if that fails.
- */
-#define FRAME_HIGHMEM     0x10
-
-// NOTE: If neither FRAME_LOWMEM nor FRAME_HIGHMEM is set, FRAME_LOWMEM is
-//       assumed as a safe default, and a runtime warning may be issued.
-//       If both are set, FRAME_LOWMEM takes priority.
-
-typedef uint8_t zone_flags_t;
-
-#define ZONE_NONE       0x00
-/** Available zone (free for allocation) */
-#define ZONE_AVAILABLE  0x01
-/** Zone is reserved (not available for allocation) */
-#define ZONE_RESERVED   0x02
-/** Zone is used by firmware (not available for allocation) */
-#define ZONE_FIRMWARE   0x04
-/** Zone contains memory that can be identity-mapped */
-#define ZONE_LOWMEM     0x08
-/** Zone contains memory that cannot be identity-mapped */
-#define ZONE_HIGHMEM    0x10
-
-/** Mask of zone bits that must be matched exactly. */
-#define ZONE_EF_MASK  0x07
-
-#define ZONE_FLAGS_MATCH(zf, f) \
-	(((((zf) & ZONE_EF_MASK)) == ((f) & ZONE_EF_MASK)) && \
-	    (((zf) & ~ZONE_EF_MASK) & (f)))
-
-typedef struct {
-	size_t refcount;  /**< Tracking of shared frames */
-	void *parent;     /**< If allocated by slab, this points there */
-} frame_t;
-
-typedef struct {
-	/** Frame_no of the first frame in the frames array */
-	pfn_t base;
-
-	/** Size of zone */
-	size_t count;
-
-	/** Number of free frame_t structures */
-	size_t free_count;
-
-	/** Number of busy frame_t structures */
-	size_t busy_count;
-
-	/** Type of the zone */
-	zone_flags_t flags;
-
-	/** Frame bitmap */
-	bitmap_t bitmap;
-
-	/** Array of frame_t structures in this zone */
-	frame_t *frames;
-} zone_t;
-
-/*
- * The zoneinfo.lock must be locked when accessing zoneinfo structure.
- * Some of the attributes in zone_t structures are 'read-only'
- */
-typedef struct {
-	IRQ_SPINLOCK_DECLARE(lock);
-	size_t count;
-	zone_t info[ZONES_MAX];
-} zones_t;
-
-extern zones_t zones;
-
-extern void frame_init(void);
-extern bool frame_adjust_zone_bounds(bool, uintptr_t *, size_t *);
-extern uintptr_t frame_alloc_generic(size_t, frame_flags_t, uintptr_t,
-    size_t *);
-extern uintptr_t frame_alloc(size_t, frame_flags_t, uintptr_t);
-extern void frame_free_generic(uintptr_t, size_t, frame_flags_t);
-extern void frame_free(uintptr_t, size_t);
-extern void frame_free_noreserve(uintptr_t, size_t);
-extern void frame_reference_add(pfn_t);
-extern size_t frame_total_free_get(void);
-
-extern size_t find_zone(pfn_t, size_t, size_t);
-extern size_t zone_create(pfn_t, size_t, pfn_t, zone_flags_t);
-extern void *frame_get_parent(pfn_t, size_t);
-extern void frame_set_parent(pfn_t, void *, size_t);
-extern void frame_mark_unavailable(pfn_t, size_t);
-extern size_t zone_conf_size(size_t);
-extern pfn_t zone_external_conf_alloc(size_t);
-extern bool zone_merge(size_t, size_t);
-extern void zone_merge_all(void);
-extern uint64_t zones_total_size(void);
-extern void zones_stats(uint64_t *, uint64_t *, uint64_t *, uint64_t *);
-
-/*
- * Console functions
- */
-extern void zones_print_list(void);
-extern void zone_print_one(size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/km.h
===================================================================
--- kernel/generic/include/mm/km.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_KM_H_
-#define KERN_KM_H_
-
-#include <typedefs.h>
-#include <mm/frame.h>
-
-#define KM_NATURAL_ALIGNMENT	-1U
-
-extern void km_identity_init(void);
-extern void km_non_identity_init(void);
-
-extern void km_non_identity_span_add(uintptr_t, size_t);
-
-extern uintptr_t km_page_alloc(size_t, size_t);
-extern void km_page_free(uintptr_t, size_t);
-
-extern bool km_is_non_identity(uintptr_t);
-
-extern uintptr_t km_map(uintptr_t, size_t, size_t, unsigned int);
-extern void km_unmap(uintptr_t, size_t);
-
-extern uintptr_t km_temporary_page_get(uintptr_t *, frame_flags_t);
-extern void km_temporary_page_put(uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/mm.h
===================================================================
--- kernel/generic/include/mm/mm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MM_H_
-#define KERN_MM_H_
-
-#define PAGE_CACHEABLE_SHIFT		0
-#define PAGE_NOT_CACHEABLE_SHIFT	PAGE_CACHEABLE_SHIFT
-#define PAGE_PRESENT_SHIFT		1
-#define PAGE_NOT_PRESENT_SHIFT		PAGE_PRESENT_SHIFT
-#define PAGE_USER_SHIFT			2
-#define PAGE_KERNEL_SHIFT		PAGE_USER_SHIFT
-#define PAGE_READ_SHIFT			3
-#define PAGE_WRITE_SHIFT		4
-#define PAGE_EXEC_SHIFT			5
-#define PAGE_GLOBAL_SHIFT		6
-#define PAGE_WRITE_COMBINE_SHIFT  7
-
-#define PAGE_NOT_CACHEABLE		(0 << PAGE_CACHEABLE_SHIFT)
-#define PAGE_CACHEABLE			(1 << PAGE_CACHEABLE_SHIFT)
-
-#define PAGE_PRESENT			(0 << PAGE_PRESENT_SHIFT)
-#define PAGE_NOT_PRESENT		(1 << PAGE_PRESENT_SHIFT)
-
-#define PAGE_USER			(1 << PAGE_USER_SHIFT)
-#define PAGE_KERNEL			(0 << PAGE_USER_SHIFT)
-
-#define PAGE_READ			(1 << PAGE_READ_SHIFT)
-#define PAGE_WRITE			(1 << PAGE_WRITE_SHIFT)
-#define PAGE_EXEC			(1 << PAGE_EXEC_SHIFT)
-
-#define PAGE_GLOBAL			(1 << PAGE_GLOBAL_SHIFT)
-
-#define PAGE_WRITE_COMBINE  (1 << PAGE_WRITE_COMBINE_SHIFT)
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/page.h
===================================================================
--- kernel/generic/include/mm/page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PAGE_H_
-#define KERN_PAGE_H_
-
-#include <typedefs.h>
-#include <proc/task.h>
-#include <mm/as.h>
-#include <arch/mm/page.h>
-
-#define P2SZ(pages) \
-	((pages) << PAGE_WIDTH)
-
-/** Operations to manipulate page mappings. */
-typedef struct {
-	void (*mapping_insert)(as_t *, uintptr_t, uintptr_t, unsigned int);
-	void (*mapping_remove)(as_t *, uintptr_t);
-	bool (*mapping_find)(as_t *, uintptr_t, bool, pte_t *);
-	void (*mapping_update)(as_t *, uintptr_t, bool, pte_t *);
-	void (*mapping_make_global)(uintptr_t, size_t);
-} page_mapping_operations_t;
-
-extern const page_mapping_operations_t *page_mapping_operations;
-
-extern void page_init(void);
-extern void page_table_lock(as_t *, bool);
-extern void page_table_unlock(as_t *, bool);
-extern bool page_table_locked(as_t *);
-extern void page_mapping_insert(as_t *, uintptr_t, uintptr_t, unsigned int);
-extern void page_mapping_remove(as_t *, uintptr_t);
-extern bool page_mapping_find(as_t *, uintptr_t, bool, pte_t *);
-extern void page_mapping_update(as_t *, uintptr_t, bool, pte_t *);
-extern void page_mapping_make_global(uintptr_t, size_t);
-extern pte_t *page_table_create(unsigned int);
-extern void page_table_destroy(pte_t *);
-
-extern errno_t page_find_mapping(uintptr_t, uintptr_t *);
-extern sys_errno_t sys_page_find_mapping(uintptr_t, uspace_ptr_uintptr_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/reserve.h
===================================================================
--- kernel/generic/include/mm/reserve.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_RESERVE_H_
-#define KERN_RESERVE_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-
-extern void reserve_init(void);
-extern bool reserve_try_alloc(size_t);
-extern void reserve_force_alloc(size_t);
-extern void reserve_free(size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/slab.h
===================================================================
--- kernel/generic/include/mm/slab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SLAB_H_
-#define KERN_SLAB_H_
-
-#include <adt/list.h>
-#include <synch/spinlock.h>
-#include <atomic.h>
-#include <mm/frame.h>
-
-/** Initial Magazine size (TODO: dynamically growing magazines) */
-#define SLAB_MAG_SIZE  4
-
-/** If object size is less, store control structure inside SLAB */
-#define SLAB_INSIDE_SIZE  (PAGE_SIZE >> 3)
-
-/** Maximum wasted space we allow for cache */
-#define SLAB_MAX_BADNESS(cache) \
-	(FRAMES2SIZE((cache)->frames) >> 2)
-
-/* slab_reclaim constants */
-
-/** Reclaim all possible memory, because we are in memory stress */
-#define SLAB_RECLAIM_ALL  0x01
-
-/* cache_create flags */
-
-/** Do not use per-cpu cache */
-#define SLAB_CACHE_NOMAGAZINE   0x01
-/** Have control structure inside SLAB */
-#define SLAB_CACHE_SLINSIDE     0x02
-/** We add magazine cache later, if we have this flag */
-#define SLAB_CACHE_MAGDEFERRED  (0x04 | SLAB_CACHE_NOMAGAZINE)
-
-typedef struct {
-	link_t link;
-	size_t busy;  /**< Count of full slots in magazine */
-	size_t size;  /**< Number of slots in magazine */
-	void *objs[];  /**< Slots in magazine */
-} slab_magazine_t;
-
-typedef struct {
-	slab_magazine_t *current;
-	slab_magazine_t *last;
-	IRQ_SPINLOCK_DECLARE(lock);
-} slab_mag_cache_t;
-
-typedef struct {
-	const char *name;
-
-	link_t link;
-
-	/* Configuration */
-
-	/** Size of slab position - align_up(sizeof(obj)) */
-	size_t size;
-
-	errno_t (*constructor)(void *obj, unsigned int kmflag);
-	size_t (*destructor)(void *obj);
-
-	/** Flags changing behaviour of cache */
-	unsigned int flags;
-
-	/* Computed values */
-	size_t frames;   /**< Number of frames to be allocated */
-	size_t objects;  /**< Number of objects that fit in */
-
-	/* Statistics */
-	atomic_size_t allocated_slabs;
-	atomic_size_t allocated_objs;
-	atomic_size_t cached_objs;
-	/** How many magazines in magazines list */
-	atomic_size_t magazine_counter;
-
-	/* Slabs */
-	list_t full_slabs;     /**< List of full slabs */
-	list_t partial_slabs;  /**< List of partial slabs */
-	IRQ_SPINLOCK_DECLARE(slablock);
-	/* Magazines */
-	list_t magazines;  /**< List o full magazines */
-	IRQ_SPINLOCK_DECLARE(maglock);
-
-	/** CPU cache */
-	slab_mag_cache_t *mag_cache;
-} slab_cache_t;
-
-extern slab_cache_t *slab_cache_create(const char *, size_t, size_t,
-    errno_t (*)(void *, unsigned int), size_t (*)(void *), unsigned int);
-extern void slab_cache_destroy(slab_cache_t *);
-
-extern void *slab_alloc(slab_cache_t *, unsigned int)
-    __attribute__((malloc));
-extern void slab_free(slab_cache_t *, void *);
-extern size_t slab_reclaim(unsigned int);
-
-/* slab subsytem initialization */
-extern void slab_cache_init(void);
-extern void slab_enable_cpucache(void);
-
-/* kconsole debug */
-extern void slab_print_list(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/mm/tlb.h
===================================================================
--- kernel/generic/include/mm/tlb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TLB_H_
-#define KERN_TLB_H_
-
-#include <arch/asm.h>
-#include <arch/mm/asid.h>
-#include <typedefs.h>
-
-/**
- * Number of TLB shootdown messages that can be queued in processor tlb_messages
- * queue.
- */
-#define TLB_MESSAGE_QUEUE_LEN	10
-
-/** Type of TLB shootdown message. */
-typedef enum {
-	/** Invalid type. */
-	TLB_INVL_INVALID = 0,
-	/** Invalidate all entries in TLB. */
-	TLB_INVL_ALL,
-	/** Invalidate all entries belonging to one address space. */
-	TLB_INVL_ASID,
-	/** Invalidate specified page range belonging to one address space. */
-	TLB_INVL_PAGES
-} tlb_invalidate_type_t;
-
-/** TLB shootdown message. */
-typedef struct {
-	tlb_invalidate_type_t type;	/**< Message type. */
-	asid_t asid;			/**< Address space identifier. */
-	uintptr_t page;			/**< Page address. */
-	size_t count;			/**< Number of pages to invalidate. */
-} tlb_shootdown_msg_t;
-
-extern void tlb_init(void);
-
-#ifdef CONFIG_SMP
-extern ipl_t tlb_shootdown_start(tlb_invalidate_type_t, asid_t, uintptr_t,
-    size_t);
-extern void tlb_shootdown_finalize(ipl_t);
-extern void tlb_shootdown_ipi_recv(void);
-#else
-#define tlb_shootdown_start(w, x, y, z)	interrupts_disable()
-#define tlb_shootdown_finalize(i)	(interrupts_restore(i));
-#define tlb_shootdown_ipi_recv()
-#endif /* CONFIG_SMP */
-
-/* Export TLB interface that each architecture must implement. */
-extern void tlb_arch_init(void);
-extern void tlb_print(void);
-extern void tlb_shootdown_ipi_send(void);
-
-extern void tlb_invalidate_all(void);
-extern void tlb_invalidate_asid(asid_t);
-extern void tlb_invalidate_pages(asid_t, uintptr_t, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/panic.h
===================================================================
--- kernel/generic/include/panic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PANIC_H_
-#define KERN_PANIC_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <typedefs.h>
-#include <print.h>
-
-#define panic(fmt, ...) \
-	panic_common(PANIC_OTHER, NULL, 0, 0, fmt, ##__VA_ARGS__)
-
-#define panic_assert(fmt, ...) \
-	panic_common(PANIC_ASSERT, NULL, 0, 0, fmt, ##__VA_ARGS__)
-
-#define panic_badtrap(istate, n, fmt, ...) \
-	panic_common(PANIC_BADTRAP, istate, 0, n, fmt, ##__VA_ARGS__)
-
-#define panic_memtrap(istate, access, addr, fmt, ...) \
-	panic_common(PANIC_MEMTRAP, istate, access, addr, fmt, ##__VA_ARGS__)
-
-#define unreachable() \
-	panic_assert("%s() at %s:%u:\nUnreachable line reached.", \
-	    __func__, __FILE__, __LINE__);
-
-typedef enum {
-	PANIC_OTHER,
-	PANIC_ASSERT,
-	PANIC_BADTRAP,
-	PANIC_MEMTRAP
-} panic_category_t;
-
-struct istate;
-
-extern bool console_override;
-
-extern void panic_common(panic_category_t, struct istate *, int,
-    uintptr_t, const char *, ...) __attribute__((noreturn))
-    _HELENOS_PRINTF_ATTRIBUTE(5, 6);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/preemption.h
===================================================================
--- kernel/generic/include/preemption.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PREEMPTION_H_
-#define KERN_PREEMPTION_H_
-
-#include <arch.h>
-#include <assert.h>
-#include <barrier.h>
-
-#define PREEMPTION_INC         (1 << 0)
-#define PREEMPTION_DISABLED    (PREEMPTION_INC <= CURRENT->preemption)
-#define PREEMPTION_ENABLED     (!PREEMPTION_DISABLED)
-
-/** Increment preemption disabled counter. */
-#define preemption_disable() \
-	do { \
-		CURRENT->preemption += PREEMPTION_INC; \
-		compiler_barrier(); \
-	} while (0)
-
-/** Restores preemption but never reschedules. */
-#define preemption_enable() \
-	do { \
-		assert(PREEMPTION_DISABLED); \
-		compiler_barrier(); \
-		CURRENT->preemption -= PREEMPTION_INC; \
-	} while (0)
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/print.h
===================================================================
--- kernel/generic/include/print.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PRINT_H_
-#define KERN_PRINT_H_
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <printf/verify.h>
-
-#define EOF  (-1)
-
-extern int puts(const char *s);
-extern int printf(const char *fmt, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int snprintf(char *str, size_t size, const char *fmt, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
-
-extern int vprintf(const char *fmt, va_list ap);
-extern int vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/printf/verify.h
===================================================================
--- kernel/generic/include/printf/verify.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PRINTF_VERIFY_H_
-#define KERN_PRINTF_VERIFY_H_
-
-#ifdef __clang__
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(__printf__, start, end)))
-#else
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(gnu_printf, start, end)))
-#endif
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/proc/program.h
===================================================================
--- kernel/generic/include/proc/program.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_PROGRAM_H_
-#define KERN_PROGRAM_H_
-
-#include <typedefs.h>
-
-struct task;
-struct thread;
-
-/** Program info structure.
- *
- * A program is an abstraction of a freshly created (not yet running)
- * userspace task containing a main thread along with its userspace stack.
- *
- */
-typedef struct program {
-	struct task *task;           /**< Program task */
-	struct thread *main_thread;  /**< Program main thread */
-	errno_t loader_status;  /**< Binary loader error status */
-} program_t;
-
-extern void *program_loader;
-
-extern errno_t program_create(as_t *, uspace_addr_t, char *, program_t *);
-extern errno_t program_create_from_image(void *, size_t, char *, program_t *);
-extern errno_t program_create_loader(program_t *, char *);
-extern void program_ready(program_t *);
-
-extern sys_errno_t sys_program_spawn_loader(uspace_ptr_char, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/proc/scheduler.h
===================================================================
--- kernel/generic/include/proc/scheduler.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SCHEDULER_H_
-#define KERN_SCHEDULER_H_
-
-#include <stddef.h>
-#include <synch/spinlock.h>
-#include <time/clock.h>
-#include <atomic.h>
-#include <adt/list.h>
-#include <abi/proc/thread.h>
-
-#define RQ_COUNT          16
-#define NEEDS_RELINK_MAX  (HZ)
-
-/** Scheduler run queue structure. */
-typedef struct {
-	IRQ_SPINLOCK_DECLARE(lock);
-	list_t rq;			/**< List of ready threads. */
-	size_t n;			/**< Number of threads in rq_ready. */
-} runq_t;
-
-extern atomic_size_t nrdy;
-extern void scheduler_init(void);
-
-extern void scheduler_fpu_lazy_request(void);
-extern void kcpulb(void *arg);
-
-extern void sched_print_list(void);
-
-extern void scheduler_run(void) __attribute__((noreturn));
-extern void scheduler_enter(state_t);
-
-extern void thread_main_func(void);
-
-/*
- * To be defined by architectures.
- */
-extern void before_task_runs_arch(void);
-extern void before_thread_runs_arch(void);
-extern void after_thread_ran_arch(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/proc/task.h
===================================================================
--- kernel/generic/include/proc/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TASK_H_
-#define KERN_TASK_H_
-
-#include <abi/proc/task.h>
-#include <abi/sysinfo.h>
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <arch/context.h>
-#include <arch/cpu.h>
-#include <arch/fpu_context.h>
-#include <arch/proc/task.h>
-#include <arch/proc/thread.h>
-#include <arch.h>
-#include <cap/cap.h>
-#include <cpu.h>
-#include <debug/sections.h>
-#include <ipc/event.h>
-#include <ipc/ipc.h>
-#include <ipc/kbox.h>
-#include <mm/as.h>
-#include <mm/tlb.h>
-#include <proc/scheduler.h>
-#include <security/perm.h>
-#include <synch/mutex.h>
-#include <synch/spinlock.h>
-#include <udebug/udebug.h>
-
-#define TASK                 CURRENT->task
-
-struct thread;
-struct cap;
-
-/** Task structure. */
-typedef struct task {
-	/** Link to @c tasks ordered dictionary */
-	odlink_t ltasks;
-
-	/** Task lock.
-	 *
-	 * Must be acquired before threads_lock and thread lock of any of its
-	 * threads.
-	 */
-	IRQ_SPINLOCK_DECLARE(lock);
-
-	char name[TASK_NAME_BUFLEN];
-	/** List of threads contained in this task. */
-	list_t threads;
-	/** Address space. */
-	as_t *as;
-	/** Unique identity of task. */
-	task_id_t taskid;
-	/** Task security container. */
-	container_id_t container;
-
-	/** Number of references (i.e. threads). */
-	atomic_refcount_t refcount;
-	/** Number of threads that haven't exited yet. */
-	// TODO: remove
-	atomic_size_t lifecount;
-
-	/** Task permissions. */
-	perm_t perms;
-
-	/** Capabilities */
-	cap_info_t *cap_info;
-
-	/* IPC stuff */
-
-	/** Receiving communication endpoint */
-	answerbox_t answerbox;
-
-	/** Spinlock protecting the active_calls list. */
-	SPINLOCK_DECLARE(active_calls_lock);
-
-	/**
-	 * List of all calls sent by this task that have not yet been
-	 * answered.
-	 */
-	list_t active_calls;
-
-	event_t events[EVENT_TASK_END - EVENT_END];
-
-	/** IPC statistics */
-	stats_ipc_t ipc_info;
-
-#ifdef CONFIG_UDEBUG
-	/** Debugging stuff. */
-	udebug_task_t udebug;
-
-	/** Kernel answerbox. */
-	kbox_t kb;
-#endif /* CONFIG_UDEBUG */
-
-	/** Architecture specific task data. */
-	task_arch_t arch;
-
-	/** Accumulated accounting. */
-	uint64_t ucycles;
-	uint64_t kcycles;
-
-	debug_sections_t *debug_sections;
-} task_t;
-
-/** Synchronize access to @c tasks */
-IRQ_SPINLOCK_EXTERN(tasks_lock);
-/** Ordered dictionary of all tasks by ID (of task_t structures) */
-extern odict_t tasks;
-
-extern void task_init(void);
-extern void task_done(task_t *);
-extern task_t *task_create(as_t *, const char *);
-extern void task_hold(task_t *);
-extern void task_release(task_t *);
-extern task_t *task_find_by_id(task_id_t);
-extern size_t task_count(void);
-extern task_t *task_first(void);
-extern task_t *task_next(task_t *);
-extern errno_t task_kill(task_id_t);
-extern void task_kill_self(bool) __attribute__((noreturn));
-extern void task_get_accounting(task_t *, uint64_t *, uint64_t *);
-extern void task_print_list(bool);
-
-extern void perm_set(task_t *, perm_t);
-extern perm_t perm_get(task_t *);
-
-#ifndef task_create_arch
-extern void task_create_arch(task_t *);
-#endif
-
-#ifndef task_destroy_arch
-extern void task_destroy_arch(task_t *);
-#endif
-
-#ifdef __32_BITS__
-extern sys_errno_t sys_task_get_id(uspace_ptr_sysarg64_t);
-#endif
-
-#ifdef __64_BITS__
-extern sysarg_t sys_task_get_id(void);
-#endif
-
-extern sys_errno_t sys_task_set_name(uspace_ptr_const_char, size_t);
-extern sys_errno_t sys_task_kill(uspace_ptr_task_id_t);
-extern sys_errno_t sys_task_exit(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/proc/thread.h
===================================================================
--- kernel/generic/include/proc/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,310 +1,0 @@
-/*
- * Copyright (c) 2001-2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_THREAD_H_
-#define KERN_THREAD_H_
-
-#include <synch/waitq.h>
-#include <proc/task.h>
-#include <time/timeout.h>
-#include <cpu.h>
-#include <synch/spinlock.h>
-#include <adt/odict.h>
-#include <mm/slab.h>
-#include <arch/cpu.h>
-#include <mm/tlb.h>
-#include <udebug/udebug.h>
-#include <abi/proc/thread.h>
-#include <abi/sysinfo.h>
-#include <arch.h>
-
-#define THREAD              CURRENT->thread
-
-#define THREAD_NAME_BUFLEN  20
-
-extern const char *thread_states[];
-
-/* Thread flags */
-typedef enum {
-	THREAD_FLAG_NONE = 0,
-	/** Thread executes in user space. */
-	THREAD_FLAG_USPACE = (1 << 0),
-	/** Thread will be attached by the caller. */
-	THREAD_FLAG_NOATTACH = (1 << 1),
-	/** Thread accounting doesn't affect accumulated task accounting. */
-	THREAD_FLAG_UNCOUNTED = (1 << 2)
-} thread_flags_t;
-
-/** Thread structure. There is one per thread. */
-typedef struct thread {
-	atomic_refcount_t refcount;
-
-	link_t rq_link;  /**< Run queue link. */
-	link_t wq_link;  /**< Wait queue link. */
-	link_t th_link;  /**< Links to threads within containing task. */
-
-	/** Link to @c threads ordered dictionary. */
-	odlink_t lthreads;
-
-	/** Tracking variable for thread_wait/thread_wakeup */
-	atomic_int sleep_state;
-
-	/**
-	 * If true, the thread is terminating.
-	 * It will not go to sleep in interruptible synchronization functions
-	 * and will call thread_exit() before returning to userspace.
-	 */
-	volatile bool interrupted;
-
-	/** Wait queue in which this thread sleeps. Used for debug printouts. */
-	_Atomic(waitq_t *) sleep_queue;
-
-	/** Waitq for thread_join_timeout(). */
-	waitq_t join_wq;
-
-	/** Thread accounting. */
-	atomic_time_stat_t ucycles;
-	atomic_time_stat_t kcycles;
-
-	/** Architecture-specific data. */
-	thread_arch_t arch;
-
-#ifdef CONFIG_UDEBUG
-	/**
-	 * If true, the scheduler will print a stack trace
-	 * to the kernel console upon scheduling this thread.
-	 */
-	atomic_int_fast8_t btrace;
-
-	/** Debugging stuff */
-	udebug_thread_t udebug;
-#endif /* CONFIG_UDEBUG */
-
-	/*
-	 * Immutable fields.
-	 *
-	 * These fields are only modified during initialization, and are not
-	 * changed at any time between initialization and destruction.
-	 * Can be accessed without synchronization in most places.
-	 */
-
-	/** Thread ID. */
-	thread_id_t tid;
-
-	/** Function implementing the thread. */
-	void (*thread_code)(void *);
-	/** Argument passed to thread_code() function. */
-	void *thread_arg;
-
-	char name[THREAD_NAME_BUFLEN];
-
-	/** Thread is executed in user space. */
-	bool uspace;
-
-	/** Thread doesn't affect accumulated accounting. */
-	bool uncounted;
-
-	/** Containing task. */
-	task_t *task;
-
-	/** Thread's kernel stack. */
-	uint8_t *kstack;
-
-	/*
-	 * Local fields.
-	 *
-	 * These fields can be safely accessed from code that _controls execution_
-	 * of this thread. Code controls execution of a thread if either:
-	 *  - it runs in the context of said thread AND interrupts are disabled
-	 *    (interrupts can and will access these fields)
-	 *  - the thread is not running, and the code accessing it can legally
-	 *    add/remove the thread to/from a runqueue, i.e., either:
-	 *    - it is allowed to enqueue thread in a new runqueue
-	 *    - it holds the lock to the runqueue containing the thread
-	 *
-	 */
-
-	/**
-	 * From here, the stored context is restored
-	 * when the thread is scheduled.
-	 */
-	context_t saved_context;
-
-	// TODO: we only need one of the two bools below
-
-	/**
-	 * True if this thread is executing copy_from_uspace().
-	 * False otherwise.
-	 */
-	bool in_copy_from_uspace;
-
-	/**
-	 * True if this thread is executing copy_to_uspace().
-	 * False otherwise.
-	 */
-	bool in_copy_to_uspace;
-
-	/*
-	 * FPU context is a special case. If lazy FPU switching is disabled,
-	 * it acts as a regular local field. However, if lazy switching is enabled,
-	 * the context is synchronized via CPU->fpu_lock
-	 */
-#ifdef CONFIG_FPU
-	fpu_context_t fpu_context;
-#endif
-	bool fpu_context_exists;
-
-	/* The thread will not be migrated if nomigrate is non-zero. */
-	unsigned int nomigrate;
-
-	/** Thread was migrated to another CPU and has not run yet. */
-	bool stolen;
-
-	/**
-	 * Thread state (state_t).
-	 * This is atomic because we read it via some commands for debug output,
-	 * otherwise it could just be a regular local.
-	 */
-	atomic_int_fast32_t state;
-
-	/** Thread CPU. */
-	_Atomic(cpu_t *) cpu;
-
-	/** Thread's priority. Implemented as index to CPU->rq */
-	atomic_int_fast32_t priority;
-
-	/** Last sampled cycle. */
-	uint64_t last_cycle;
-} thread_t;
-
-IRQ_SPINLOCK_EXTERN(threads_lock);
-extern odict_t threads;
-
-extern void thread_init(void);
-extern thread_t *thread_create(void (*)(void *), void *, task_t *,
-    thread_flags_t, const char *);
-extern void thread_wire(thread_t *, cpu_t *);
-extern void thread_attach(thread_t *, task_t *);
-extern void thread_start(thread_t *);
-extern void thread_requeue_sleeping(thread_t *);
-extern void thread_exit(void) __attribute__((noreturn));
-extern void thread_interrupt(thread_t *);
-
-enum sleep_state {
-	SLEEP_INITIAL,
-	SLEEP_ASLEEP,
-	SLEEP_WOKE,
-};
-
-typedef enum {
-	THREAD_OK,
-	THREAD_TERMINATING,
-} thread_termination_state_t;
-
-typedef enum {
-	THREAD_WAIT_SUCCESS,
-	THREAD_WAIT_TIMEOUT,
-} thread_wait_result_t;
-
-extern thread_termination_state_t thread_wait_start(void);
-extern thread_wait_result_t thread_wait_finish(deadline_t);
-extern void thread_wakeup(thread_t *);
-
-static inline thread_t *thread_ref(thread_t *thread)
-{
-	refcount_up(&thread->refcount);
-	return thread;
-}
-
-static inline thread_t *thread_try_ref(thread_t *thread)
-{
-	if (refcount_try_up(&thread->refcount))
-		return thread;
-	else
-		return NULL;
-}
-
-extern void thread_put(thread_t *);
-
-#ifndef thread_create_arch
-extern errno_t thread_create_arch(thread_t *, thread_flags_t);
-#endif
-
-#ifndef thr_constructor_arch
-extern void thr_constructor_arch(thread_t *);
-#endif
-
-#ifndef thr_destructor_arch
-extern void thr_destructor_arch(thread_t *);
-#endif
-
-extern void thread_sleep(uint32_t);
-extern void thread_usleep(uint32_t);
-
-extern errno_t thread_join(thread_t *);
-extern errno_t thread_join_timeout(thread_t *, uint32_t, unsigned int);
-extern void thread_detach(thread_t *);
-
-extern void thread_yield(void);
-
-extern void thread_print_list(bool);
-extern thread_t *thread_find_by_id(thread_id_t);
-extern size_t thread_count(void);
-extern thread_t *thread_first(void);
-extern thread_t *thread_next(thread_t *);
-extern void thread_update_accounting(bool);
-extern thread_t *thread_try_get(thread_t *);
-
-extern void thread_migration_disable(void);
-extern void thread_migration_enable(void);
-
-#ifdef CONFIG_UDEBUG
-extern void thread_stack_trace(thread_id_t);
-#endif
-
-/** Fpu context slab cache. */
-extern slab_cache_t *fpu_context_cache;
-
-/* Thread syscall prototypes. */
-extern sys_errno_t sys_thread_create(uspace_ptr_uspace_arg_t, uspace_ptr_char, size_t,
-    uspace_ptr_thread_id_t);
-extern sys_errno_t sys_thread_exit(int);
-extern sys_errno_t sys_thread_get_id(uspace_ptr_thread_id_t);
-extern sys_errno_t sys_thread_usleep(uint32_t);
-extern sys_errno_t sys_thread_udelay(uint32_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/security/perm.h
===================================================================
--- kernel/generic/include/security/perm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-/**
- * @file
- * @brief Task permissions definitions.
- *
- * Permissions represent virtual rights that entitle their
- * holder to perform certain security sensitive tasks.
- *
- * Each task can have arbitrary combination of the permissions
- * defined in this file. Therefore, they are required to be powers
- * of two.
- */
-
-#ifndef __PERM_H__
-#define __PERM_H__
-
-#include <typedefs.h>
-
-/**
- * PERM_PERM allows its holder to grant/revoke arbitrary permission to/from
- * other tasks.
- */
-#define PERM_PERM        (1 << 0)
-
-/**
- * PERM_MEM_MANAGER allows its holder to map physical memory to other tasks.
- */
-#define PERM_MEM_MANAGER (1 << 1)
-
-/**
- * PERM_IO_MANAGER allows its holder to access I/O space to other tasks.
- */
-#define PERM_IO_MANAGER  (1 << 2)
-
-/**
- * PERM_IRQ_REG entitles its holder to register IRQ handlers.
- */
-#define PERM_IRQ_REG     (1 << 3)
-
-typedef uint32_t perm_t;
-
-#ifdef __32_BITS__
-
-extern sys_errno_t sys_perm_grant(uspace_ptr_sysarg64_t, perm_t);
-extern sys_errno_t sys_perm_revoke(uspace_ptr_sysarg64_t, perm_t);
-
-#endif  /* __32_BITS__ */
-
-#ifdef __64_BITS__
-
-extern sys_errno_t sys_perm_grant(sysarg_t, perm_t);
-extern sys_errno_t sys_perm_revoke(sysarg_t, perm_t);
-
-#endif  /* __64_BITS__ */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/smp/ipi.h
===================================================================
--- kernel/generic/include/smp/ipi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_IPI_H_
-#define KERN_IPI_H_
-
-#ifdef CONFIG_SMP
-
-extern void ipi_broadcast(int);
-extern void ipi_broadcast_arch(int);
-
-#else
-
-#define ipi_broadcast(ipi)
-
-#endif /* CONFIG_SMP */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/smp/smp.h
===================================================================
--- kernel/generic/include/smp/smp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SMP_H_
-#define KERN_SMP_H_
-
-#include <synch/semaphore.h>
-
-extern semaphore_t ap_completion_semaphore;
-
-#ifdef CONFIG_SMP
-
-extern void smp_init(void);
-extern void kmp(void *arg);
-
-#else /* CONFIG_SMP */
-
-#define smp_init()
-
-#endif /* CONFIG_SMP */
-
-#endif /* __SMP_H__ */
-
-/** @}
- */
Index: rnel/generic/include/stacktrace.h
===================================================================
--- kernel/generic/include/stacktrace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_STACKTRACE_H_
-#define KERN_STACKTRACE_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-
-/* Forward declaration. */
-struct istate;
-
-typedef struct {
-	uintptr_t fp;
-	uintptr_t pc;
-	struct istate *istate;
-} stack_trace_context_t;
-
-typedef struct {
-	bool (*stack_trace_context_validate)(stack_trace_context_t *);
-	bool (*frame_pointer_prev)(stack_trace_context_t *, uintptr_t *);
-	bool (*return_address_get)(stack_trace_context_t *, uintptr_t *);
-	bool (*symbol_resolve)(uintptr_t, int, const char **, uintptr_t *, const char **, const char **, int *, int *);
-} stack_trace_ops_t;
-
-extern stack_trace_ops_t kst_ops;
-extern stack_trace_ops_t ust_ops;
-
-extern void stack_trace(void);
-extern void stack_trace_istate(struct istate *);
-extern void stack_trace_ctx(stack_trace_ops_t *, stack_trace_context_t *);
-
-/*
- * The following interface is to be implemented by each architecture.
- */
-extern uintptr_t frame_pointer_get(void);
-extern uintptr_t program_counter_get(void);
-
-extern bool kernel_stack_trace_context_validate(stack_trace_context_t *);
-extern bool kernel_frame_pointer_prev(stack_trace_context_t *, uintptr_t *);
-extern bool kernel_return_address_get(stack_trace_context_t *, uintptr_t *);
-
-extern bool uspace_stack_trace_context_validate(stack_trace_context_t *);
-extern bool uspace_frame_pointer_prev(stack_trace_context_t *, uintptr_t *);
-extern bool uspace_return_address_get(stack_trace_context_t *, uintptr_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/stdio.h
===================================================================
--- kernel/generic/include/stdio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_STDIO_H_
-#define KERN_STDIO_H_
-
-#include <print.h>
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/symtab.h
===================================================================
--- kernel/generic/include/symtab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYMTAB_H_
-#define KERN_SYMTAB_H_
-
-#include <stdbool.h>
-#include <typedefs.h>
-#include <debug/sections.h>
-
-extern void symtab_print_search(const char *);
-extern const char *symtab_hints_enum(const char *, const char **, void **);
-extern const char *symtab_fmt_name_lookup(uintptr_t);
-extern errno_t symtab_addr_lookup(const char *, uintptr_t *);
-extern const char *symtab_name_lookup(uintptr_t, uintptr_t *, debug_sections_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/condvar.h
===================================================================
--- kernel/generic/include/synch/condvar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CONDVAR_H_
-#define KERN_CONDVAR_H_
-
-#include <stdint.h>
-#include <synch/waitq.h>
-#include <synch/mutex.h>
-#include <synch/spinlock.h>
-#include <abi/synch.h>
-
-typedef struct {
-	waitq_t wq;
-} condvar_t;
-
-#define CONDVAR_INITIALIZER(name) (condvar_t) { \
-	.wq = WAITQ_INITIALIZER((name).wq), \
-}
-
-#define CONDVAR_INITIALIZE(name) \
-	condvar_t name = CONDVAR_INITIALIZER(name)
-
-extern void condvar_initialize(condvar_t *cv);
-extern void condvar_signal(condvar_t *cv);
-extern void condvar_broadcast(condvar_t *cv);
-
-extern errno_t __condvar_wait_mutex(condvar_t *cv, mutex_t *mtx);
-extern errno_t __condvar_wait_spinlock(condvar_t *cv, spinlock_t *mtx);
-extern errno_t __condvar_wait_irq_spinlock(condvar_t *cv, irq_spinlock_t *mtx);
-extern errno_t __condvar_wait_timeout_mutex(condvar_t *cv, mutex_t *mtx, uint32_t usec);
-extern errno_t __condvar_wait_timeout_spinlock(condvar_t *cv, spinlock_t *mtx, uint32_t usec);
-extern errno_t __condvar_wait_timeout_irq_spinlock(condvar_t *cv, irq_spinlock_t *mtx, uint32_t usec);
-
-#define condvar_wait(cv, mtx) (_Generic((mtx), \
-	mutex_t *: __condvar_wait_mutex, \
-	spinlock_t *: __condvar_wait_spinlock, \
-	irq_spinlock_t *: __condvar_wait_irq_spinlock \
-)(cv, mtx))
-
-#define condvar_wait_timeout(cv, mtx, usec) (_Generic((mtx), \
-	mutex_t *: __condvar_wait_timeout_mutex, \
-	spinlock_t *: __condvar_wait_timeout_spinlock, \
-	irq_spinlock_t *: __condvar_wait_timeout_irq_spinlock \
-)(cv, mtx))
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/mutex.h
===================================================================
--- kernel/generic/include/synch/mutex.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_MUTEX_H_
-#define KERN_MUTEX_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <synch/semaphore.h>
-#include <abi/synch.h>
-
-typedef enum {
-	MUTEX_PASSIVE,
-	MUTEX_RECURSIVE,
-} mutex_type_t;
-
-struct thread;
-
-typedef struct {
-	mutex_type_t type;
-	int nesting;
-	semaphore_t sem;
-	_Atomic(struct thread *) owner;
-} mutex_t;
-
-#define MUTEX_INITIALIZER(name, mtype) (mutex_t) { \
-	.type = (mtype), \
-	.nesting = 0, \
-	.sem = SEMAPHORE_INITIALIZER((name).sem, 1), \
-	.owner = NULL, \
-}
-
-#define MUTEX_INITIALIZE(name, mtype) \
-	mutex_t name = MUTEX_INITIALIZER(name, mtype)
-
-extern void mutex_initialize(mutex_t *, mutex_type_t);
-extern bool mutex_locked(mutex_t *);
-extern errno_t mutex_trylock(mutex_t *);
-extern void mutex_lock(mutex_t *);
-extern errno_t mutex_lock_timeout(mutex_t *, uint32_t);
-extern void mutex_unlock(mutex_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/semaphore.h
===================================================================
--- kernel/generic/include/synch/semaphore.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SEMAPHORE_H_
-#define KERN_SEMAPHORE_H_
-
-#include <errno.h>
-#include <stdint.h>
-#include <synch/waitq.h>
-#include <abi/synch.h>
-
-typedef struct {
-	waitq_t wq;
-} semaphore_t;
-
-#define SEMAPHORE_INITIALIZER(name, count) (semaphore_t) { \
-	.wq = WAITQ_INITIALIZER_WITH_COUNT((name).wq, count), \
-}
-
-#define SEMAPHORE_INITIALIZE(name, count) \
-	semaphore_t name = SEMAPHORE_INITIALIZER(name, count)
-
-extern void semaphore_initialize(semaphore_t *, int);
-extern errno_t semaphore_down_timeout(semaphore_t *, uint32_t);
-extern errno_t semaphore_trydown(semaphore_t *);
-extern void semaphore_down(semaphore_t *);
-extern void semaphore_up(semaphore_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/smc.h
===================================================================
--- kernel/generic/include/synch/smc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SMC_H_
-#define KERN_SMC_H_
-
-extern sys_errno_t sys_smc_coherence(uintptr_t, size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/spinlock.h
===================================================================
--- kernel/generic/include/synch/spinlock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,208 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SPINLOCK_H_
-#define KERN_SPINLOCK_H_
-
-#include <stdatomic.h>
-#include <stdbool.h>
-
-#include <arch/types.h>
-#include <assert.h>
-
-#define DEADLOCK_THRESHOLD  100000000
-
-#if defined(CONFIG_SMP) && defined(CONFIG_DEBUG_SPINLOCK)
-
-#include <log.h>
-
-#define DEADLOCK_PROBE_INIT(pname)  size_t pname = 0
-
-#define DEADLOCK_PROBE(pname, value) \
-	if ((pname)++ > (value)) { \
-		(pname) = 0; \
-		log(LF_OTHER, LVL_WARN, \
-		    "Deadlock probe %s: exceeded threshold %u\n" \
-		    "cpu%u: function=%s, line=%u\n", \
-		    #pname, (value), CPU->id, __func__, __LINE__); \
-	}
-
-#else /* CONFIG_DEBUG_SPINLOCK */
-
-#define DEADLOCK_PROBE_INIT(pname)
-#define DEADLOCK_PROBE(pname, value)
-
-#endif /* CONFIG_DEBUG_SPINLOCK */
-
-typedef struct spinlock {
-#ifdef CONFIG_SMP
-	atomic_flag flag;
-
-#ifdef CONFIG_DEBUG_SPINLOCK
-	const char *name;
-#endif /* CONFIG_DEBUG_SPINLOCK */
-#endif
-} spinlock_t;
-
-/*
- * SPINLOCK_DECLARE is to be used for dynamically allocated spinlocks,
- * where the lock gets initialized in run time.
- */
-#define SPINLOCK_DECLARE(lock_name)  spinlock_t lock_name
-#define SPINLOCK_EXTERN(lock_name)   extern spinlock_t lock_name
-
-#ifdef CONFIG_SMP
-#ifdef CONFIG_DEBUG_SPINLOCK
-#define SPINLOCK_INITIALIZER(desc_name) { .name = (desc_name), .flag = ATOMIC_FLAG_INIT }
-#else
-#define SPINLOCK_INITIALIZER(desc_name) { .flag = ATOMIC_FLAG_INIT }
-#endif
-#else
-#define SPINLOCK_INITIALIZER(desc_name) {}
-#endif
-
-/*
- * SPINLOCK_INITIALIZE and SPINLOCK_STATIC_INITIALIZE are to be used
- * for statically allocated spinlocks. They declare (either as global
- * or static) symbol and initialize the lock.
- */
-#define SPINLOCK_INITIALIZE_NAME(lock_name, desc_name) \
-	spinlock_t lock_name = SPINLOCK_INITIALIZER(desc_name)
-
-#define SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, desc_name) \
-	static spinlock_t lock_name = SPINLOCK_INITIALIZER(desc_name)
-
-#if defined(CONFIG_SMP) && defined(CONFIG_DEBUG_SPINLOCK)
-#define ASSERT_SPINLOCK(expr, lock) assert_verbose(expr, (lock)->name)
-#else /* CONFIG_DEBUG_SPINLOCK */
-#define ASSERT_SPINLOCK(expr, lock) assert(expr)
-#endif /* CONFIG_DEBUG_SPINLOCK */
-
-#define SPINLOCK_INITIALIZE(lock_name) \
-	SPINLOCK_INITIALIZE_NAME(lock_name, #lock_name)
-
-#define SPINLOCK_STATIC_INITIALIZE(lock_name) \
-	SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, #lock_name)
-
-#ifdef CONFIG_SMP
-
-extern void spinlock_initialize(spinlock_t *, const char *);
-extern bool spinlock_trylock(spinlock_t *);
-extern void spinlock_lock(spinlock_t *);
-extern void spinlock_unlock(spinlock_t *);
-extern bool spinlock_locked(spinlock_t *);
-
-#else
-
-#include <preemption.h>
-
-static inline void spinlock_initialize(spinlock_t *l, const char *name)
-{
-}
-
-static inline bool spinlock_trylock(spinlock_t *l)
-{
-	preemption_disable();
-	return true;
-}
-
-static inline void spinlock_lock(spinlock_t *l)
-{
-	preemption_disable();
-}
-
-static inline void spinlock_unlock(spinlock_t *l)
-{
-	preemption_enable();
-}
-
-static inline bool spinlock_locked(spinlock_t *l)
-{
-	return true;
-}
-
-#endif
-
-typedef struct {
-	spinlock_t lock;              /**< Spinlock */
-	bool guard;                   /**< Flag whether ipl is valid */
-	ipl_t ipl;                    /**< Original interrupt level */
-#ifdef CONFIG_DEBUG_SPINLOCK
-	_Atomic(struct cpu *) owner;  /**< Which cpu currently owns this lock */
-#endif
-} irq_spinlock_t;
-
-#define IRQ_SPINLOCK_DECLARE(lock_name)  irq_spinlock_t lock_name
-#define IRQ_SPINLOCK_EXTERN(lock_name)   extern irq_spinlock_t lock_name
-
-#define ASSERT_IRQ_SPINLOCK(expr, irq_lock) \
-	ASSERT_SPINLOCK(expr, &((irq_lock)->lock))
-
-#define IRQ_SPINLOCK_INITIALIZER(desc_name) \
-	{ \
-		.lock = SPINLOCK_INITIALIZER(desc_name), \
-		.guard = false, \
-		.ipl = 0, \
-	}
-
-/*
- * IRQ_SPINLOCK_INITIALIZE and IRQ_SPINLOCK_STATIC_INITIALIZE are to be used
- * for statically allocated interrupts-disabled spinlocks. They declare (either
- * as global or static symbol) and initialize the lock.
- */
-#define IRQ_SPINLOCK_INITIALIZE_NAME(lock_name, desc_name) \
-	irq_spinlock_t lock_name = IRQ_SPINLOCK_INITIALIZER(desc_name)
-
-#define IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, desc_name) \
-	static irq_spinlock_t lock_name = IRQ_SPINLOCK_INITIALIZER(desc_name)
-
-#define IRQ_SPINLOCK_INITIALIZE(lock_name) \
-	IRQ_SPINLOCK_INITIALIZE_NAME(lock_name, #lock_name)
-
-#define IRQ_SPINLOCK_STATIC_INITIALIZE(lock_name) \
-	IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(lock_name, #lock_name)
-
-extern void irq_spinlock_initialize(irq_spinlock_t *, const char *);
-extern void irq_spinlock_lock(irq_spinlock_t *, bool);
-extern void irq_spinlock_unlock(irq_spinlock_t *, bool);
-extern bool irq_spinlock_trylock(irq_spinlock_t *);
-extern void irq_spinlock_pass(irq_spinlock_t *, irq_spinlock_t *);
-extern void irq_spinlock_exchange(irq_spinlock_t *, irq_spinlock_t *);
-extern bool irq_spinlock_locked(irq_spinlock_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/syswaitq.h
===================================================================
--- kernel/generic/include/synch/syswaitq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYS_WAITQ_H_
-#define KERN_SYS_WAITQ_H_
-
-#include <typedefs.h>
-#include <abi/cap.h>
-#include <cap/cap.h>
-
-extern kobject_ops_t waitq_kobject_ops;
-
-extern void sys_waitq_init(void);
-
-extern void sys_waitq_task_cleanup(void);
-
-extern sys_errno_t sys_waitq_create(uspace_ptr_cap_waitq_handle_t);
-extern sys_errno_t sys_waitq_sleep(cap_waitq_handle_t, uint32_t, unsigned int);
-extern sys_errno_t sys_waitq_wakeup(cap_waitq_handle_t);
-extern sys_errno_t sys_waitq_destroy(cap_waitq_handle_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/synch/waitq.h
===================================================================
--- kernel/generic/include/synch/waitq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_WAITQ_H_
-#define KERN_WAITQ_H_
-
-#include <typedefs.h>
-#include <synch/spinlock.h>
-#include <abi/synch.h>
-#include <adt/list.h>
-
-#define WAITQ_INITIALIZER_WITH_COUNT(name, count) (waitq_t) { \
-	.lock = IRQ_SPINLOCK_INITIALIZER(#name ".lock"), \
-	.sleepers = LIST_INITIALIZER((name).sleepers), \
-	.wakeup_balance = (count), \
-}
-
-#define WAITQ_INITIALIZER(name) WAITQ_INITIALIZER_WITH_COUNT(name, 0)
-
-#define WAITQ_INITIALIZE_WITH_COUNT(name, count) \
-	waitq_t name = WAITQ_INITIALIZER_WITH_COUNT(name, count)
-
-#define WAITQ_INITIALIZE(name) \
-	waitq_t name = WAITQ_INITIALIZER(name)
-
-/** Wait queue structure.
- *
- */
-typedef struct waitq {
-	/** Lock protecting wait queue structure.
-	 *
-	 * Must be acquired before T.lock for each T of type thread_t.
-	 */
-	IRQ_SPINLOCK_DECLARE(lock);
-
-	/**
-	 * If negative, number of wakeups that are to be ignored (necessary for futex operation).
-	 * If positive, number of wakeups that weren't able to wake a thread.
-	 */
-	int wakeup_balance;
-
-	/** List of sleeping threads for which there was no missed_wakeup. */
-	list_t sleepers;
-
-	bool closed;
-} waitq_t;
-
-typedef struct wait_guard {
-	ipl_t ipl;
-} wait_guard_t;
-
-struct thread;
-
-extern void waitq_initialize(waitq_t *);
-extern void waitq_initialize_with_count(waitq_t *, int);
-extern errno_t waitq_sleep(waitq_t *);
-extern errno_t _waitq_sleep_timeout(waitq_t *, uint32_t, unsigned int);
-extern errno_t waitq_sleep_timeout(waitq_t *, uint32_t);
-extern wait_guard_t waitq_sleep_prepare(waitq_t *);
-extern errno_t waitq_sleep_unsafe(waitq_t *, wait_guard_t);
-extern errno_t waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, unsigned int, wait_guard_t);
-
-extern void waitq_wake_one(waitq_t *);
-extern void waitq_wake_all(waitq_t *);
-extern void waitq_signal(waitq_t *);
-extern void waitq_close(waitq_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/syscall/copy.h
===================================================================
--- kernel/generic/include/syscall/copy.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_COPY_H_
-#define KERN_COPY_H_
-
-#include <stddef.h>
-
-/** Label within memcpy_from_uspace() that contains return -1. */
-extern char memcpy_from_uspace_failover_address;
-
-/** Label within memcpy_to_uspace() that contains return -1. */
-extern char memcpy_to_uspace_failover_address;
-
-extern errno_t copy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size);
-extern errno_t copy_to_uspace(uspace_addr_t dst_uspace, const void *src, size_t size);
-
-/*
- * This interface must be implemented by each architecture.
- * The functions return zero on failure and nonzero on success.
- */
-extern uintptr_t memcpy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size);
-extern uintptr_t memcpy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/syscall/syscall.h
===================================================================
--- kernel/generic/include/syscall/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYSCALL_H_
-#define KERN_SYSCALL_H_
-
-#include <typedefs.h>
-#include <abi/syscall.h>
-
-typedef sysarg_t (*syshandler_t)(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-
-extern sysarg_t syscall_handler(sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/sysinfo/stats.h
===================================================================
--- kernel/generic/include/sysinfo/stats.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_STATS_H_
-#define KERN_STATS_H_
-
-extern void kload(void *arg);
-extern void stats_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/sysinfo/sysinfo.h
===================================================================
--- kernel/generic/include/sysinfo/sysinfo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_SYSINFO_H_
-#define KERN_SYSINFO_H_
-
-#include <typedefs.h>
-#include <stdbool.h>
-#include <str.h>
-#include <abi/sysinfo.h>
-
-/** Framebuffer info exported flags */
-extern bool fb_exported;
-
-/** Subtree type
- *
- */
-typedef enum {
-	SYSINFO_SUBTREE_NONE = 0,     /**< No subtree (leaf item) */
-	SYSINFO_SUBTREE_TABLE = 1,    /**< Fixed subtree */
-	SYSINFO_SUBTREE_FUNCTION = 2  /**< Generated subtree */
-} sysinfo_subtree_type_t;
-
-struct sysinfo_item;
-
-/** Generated numeric value function */
-typedef sysarg_t (*sysinfo_fn_val_t)(struct sysinfo_item *, void *);
-
-/** Sysinfo generated numberic value data
- *
- */
-typedef struct {
-	sysinfo_fn_val_t fn;  /**< Generated value function */
-	void *data;           /**< Private data */
-} sysinfo_gen_val_data_t;
-
-/** Generated binary data function */
-typedef void *(*sysinfo_fn_data_t)(struct sysinfo_item *, size_t *, bool,
-    void *);
-
-/** Sysinfo generated binary data data
- *
- */
-typedef struct {
-	sysinfo_fn_data_t fn;  /**< Generated binary data function */
-	void *data;            /**< Private data */
-} sysinfo_gen_data_data_t;
-
-/** Sysinfo item binary data
- *
- */
-typedef struct {
-	void *data;   /**< Data */
-	size_t size;  /**< Size (bytes) */
-} sysinfo_data_t;
-
-/** Sysinfo item value (union)
- *
- */
-typedef union {
-	sysarg_t val;                      /**< Constant numberic value */
-	sysinfo_data_t data;               /**< Constant binary data */
-	sysinfo_gen_val_data_t gen_val;    /**< Generated numeric value function */
-	sysinfo_gen_data_data_t gen_data;  /**< Generated binary data function */
-} sysinfo_item_val_t;
-
-/** Sysinfo return holder
- *
- * This structure is generated from the constant
- * items or by the generating functions. Note that
- * the validity of the data is limited by the scope
- * of single sysinfo invocation guarded by sysinfo_lock.
- *
- */
-typedef struct {
-	sysinfo_item_val_type_t tag;  /**< Return value type */
-	union {
-		sysarg_t val;             /**< Numberic value */
-		sysinfo_data_t data;      /**< Binary data */
-	};
-} sysinfo_return_t;
-
-/** Generated subtree function */
-typedef sysinfo_return_t (*sysinfo_fn_subtree_t)(const char *, bool, void *);
-
-/** Sysinfo generated subtree data
- *
- */
-typedef struct {
-	sysinfo_fn_subtree_t fn;  /**< Generated subtree function */
-	void *data;               /**< Private data */
-} sysinfo_gen_subtree_data_t;
-
-/** Sysinfo subtree (union)
- *
- */
-typedef union {
-	struct sysinfo_item *table;            /**< Fixed subtree (list of subitems) */
-	sysinfo_gen_subtree_data_t generator;  /**< Generated subtree */
-} sysinfo_subtree_t;
-
-/** Sysinfo item
- *
- */
-typedef struct sysinfo_item {
-	char *name;                           /**< Item name */
-
-	sysinfo_item_val_type_t val_type;     /**< Item value type */
-	sysinfo_item_val_t val;               /**< Item value */
-
-	sysinfo_subtree_type_t subtree_type;  /**< Subtree type */
-	sysinfo_subtree_t subtree;            /**< Subtree */
-
-	struct sysinfo_item *next;            /**< Sibling item */
-} sysinfo_item_t;
-
-extern void sysinfo_set_item_val(const char *, sysinfo_item_t **, sysarg_t);
-extern void sysinfo_set_item_data(const char *, sysinfo_item_t **, void *,
-    size_t);
-extern void sysinfo_set_item_gen_val(const char *, sysinfo_item_t **,
-    sysinfo_fn_val_t, void *);
-extern void sysinfo_set_item_gen_data(const char *, sysinfo_item_t **,
-    sysinfo_fn_data_t, void *);
-extern void sysinfo_set_item_undefined(const char *, sysinfo_item_t **);
-
-extern void sysinfo_set_subtree_fn(const char *, sysinfo_item_t **,
-    sysinfo_fn_subtree_t, void *);
-
-extern void sysinfo_init(void);
-extern void sysinfo_dump(sysinfo_item_t *);
-
-extern sys_errno_t sys_sysinfo_get_keys_size(uspace_addr_t, size_t, uspace_addr_t);
-extern sys_errno_t sys_sysinfo_get_keys(uspace_addr_t, size_t, uspace_addr_t, size_t, uspace_ptr_size_t);
-extern sysarg_t sys_sysinfo_get_val_type(uspace_addr_t, size_t);
-extern sys_errno_t sys_sysinfo_get_value(uspace_addr_t, size_t, uspace_addr_t);
-extern sys_errno_t sys_sysinfo_get_data_size(uspace_addr_t, size_t, uspace_addr_t);
-extern sys_errno_t sys_sysinfo_get_data(uspace_addr_t, size_t, uspace_addr_t, size_t, uspace_ptr_size_t);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/time/clock.h
===================================================================
--- kernel/generic/include/time/clock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_CLOCK_H_
-#define KERN_CLOCK_H_
-
-#include <typedefs.h>
-
-#define HZ  100
-
-/** Uptime structure */
-typedef struct {
-	sysarg_t seconds1;
-	sysarg_t useconds;
-	sysarg_t seconds2;
-} uptime_t;
-
-extern uptime_t *uptime;
-
-extern void clock(void);
-extern void clock_counter_init(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/time/delay.h
===================================================================
--- kernel/generic/include/time/delay.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_DELAY_H_
-#define KERN_DELAY_H_
-
-#include <stdint.h>
-
-extern void delay(uint32_t microseconds);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/time/timeout.h
===================================================================
--- kernel/generic/include/time/timeout.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TIMEOUT_H_
-#define KERN_TIMEOUT_H_
-
-#include <adt/list.h>
-#include <cpu.h>
-#include <stdint.h>
-
-typedef void (*timeout_handler_t)(void *arg);
-
-typedef uint64_t deadline_t;
-#define DEADLINE_NEVER ((deadline_t) UINT64_MAX)
-
-typedef struct {
-	/** Link to the list of active timeouts on timeout->cpu */
-	link_t link;
-	/** Timeout will be activated when current clock tick reaches this value. */
-	deadline_t deadline;
-	/** Function that will be called on timeout activation. */
-	timeout_handler_t handler;
-	/** Argument to be passed to handler() function. */
-	void *arg;
-	/** On which processor is this timeout registered. */
-	cpu_t *cpu;
-	/** Used to synchronize with the handler callback. */
-	atomic_bool finished;
-} timeout_t;
-
-#define us2ticks(us)  ((uint64_t) (((uint32_t) (us) / (1000000 / HZ))))
-
-extern deadline_t timeout_deadline_in_usec(uint32_t us);
-
-extern void timeout_init(void);
-extern void timeout_initialize(timeout_t *);
-extern void timeout_register(timeout_t *, uint64_t, timeout_handler_t, void *);
-extern void timeout_register_deadline(timeout_t *, deadline_t, timeout_handler_t, void *);
-extern bool timeout_unregister(timeout_t *);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/trace.h
===================================================================
--- kernel/generic/include/trace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TRACE_H_
-#define KERN_TRACE_H_
-
-#define _NO_TRACE  __attribute__((no_instrument_function))
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/typedefs.h
===================================================================
--- kernel/generic/include/typedefs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TYPEDEFS_H_
-#define KERN_TYPEDEFS_H_
-
-#include <arch/types.h>
-#include <_bits/errno.h>
-
-typedef void (*function)(void);
-
-typedef uint32_t container_id_t;
-
-typedef int32_t inr_t;
-
-typedef volatile uint8_t ioport8_t;
-typedef volatile uint16_t ioport16_t;
-typedef volatile uint32_t ioport32_t;
-
-#ifdef __32_BITS__
-
-/** Explicit 64-bit arguments passed to syscalls. */
-typedef uint64_t sysarg64_t;
-
-#endif /* __32_BITS__ */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/udebug/udebug.h
===================================================================
--- kernel/generic/include/udebug/udebug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_UDEBUG_H_
-#define KERN_UDEBUG_H_
-
-#include <abi/udebug.h>
-#include <ipc/ipc.h>
-#include <synch/mutex.h>
-#include <synch/condvar.h>
-#include <arch/interrupt.h>
-#include <atomic.h>
-
-typedef enum {
-	/** Task is not being debugged */
-	UDEBUG_TS_INACTIVE,
-	/** BEGIN operation in progress (waiting for threads to stop) */
-	UDEBUG_TS_BEGINNING,
-	/** Debugger fully connected */
-	UDEBUG_TS_ACTIVE
-} udebug_task_state_t;
-
-/** Debugging part of task_t structure.
- */
-typedef struct {
-	/** Synchronize debug ops on this task / access to this structure */
-	mutex_t lock;
-	char *lock_owner;
-
-	udebug_task_state_t dt_state;
-	call_t *begin_call;
-	int not_stoppable_count;
-	struct task *debugger;
-	udebug_evmask_t evmask;
-} udebug_task_t;
-
-/** Debugging part of thread_t structure.
- */
-typedef struct {
-	/** Synchronize debug ops on this thread / access to this structure. */
-	mutex_t lock;
-
-	waitq_t go_wq;
-	call_t *go_call;
-	sysarg_t syscall_args[6];
-	istate_t *uspace_state;
-
-	/** What type of event are we stopped in or 0 if none. */
-	udebug_event_t cur_event;
-	bool go;         /**< Thread is GO */
-	bool stoppable;  /**< Thread is stoppable */
-	bool active;     /**< Thread is in a debugging session */
-	condvar_t active_cv;
-} udebug_thread_t;
-
-struct task;
-struct thread;
-
-void udebug_task_init(udebug_task_t *);
-void udebug_thread_initialize(udebug_thread_t *);
-
-void udebug_syscall_event(sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, bool);
-
-void udebug_thread_b_event_attach(struct thread *, struct task *);
-void udebug_thread_e_event(void);
-
-void udebug_stoppable_begin(void);
-void udebug_stoppable_end(void);
-
-void udebug_before_thread_runs(void);
-
-errno_t udebug_task_cleanup(struct task *);
-void udebug_thread_fault(void);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/udebug/udebug_ipc.h
===================================================================
--- kernel/generic/include/udebug/udebug_ipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_UDEBUG_IPC_H_
-#define KERN_UDEBUG_IPC_H_
-
-#include <ipc/ipc.h>
-
-errno_t udebug_request_preprocess(call_t *call, phone_t *phone);
-void udebug_call_receive(call_t *call);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/udebug/udebug_ops.h
===================================================================
--- kernel/generic/include/udebug/udebug_ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_UDEBUG_OPS_H_
-#define KERN_UDEBUG_OPS_H_
-
-#include <ipc/ipc.h>
-#include <proc/thread.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-errno_t udebug_begin(call_t *call, bool *active);
-errno_t udebug_end(void);
-errno_t udebug_set_evmask(udebug_evmask_t mask);
-
-errno_t udebug_go(thread_t *t, call_t *call);
-errno_t udebug_stop(thread_t *t, call_t *call);
-
-errno_t udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
-    size_t *needed);
-errno_t udebug_name_read(char **data, size_t *data_size);
-errno_t udebug_args_read(thread_t *t, void **buffer);
-
-errno_t udebug_regs_read(thread_t *t, void **buffer);
-
-errno_t udebug_mem_read(uspace_addr_t uspace_addr, size_t n, void **buffer);
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/userspace.h
===================================================================
--- kernel/generic/include/userspace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_USERSPACE_H_
-#define KERN_USERSPACE_H_
-
-#include <proc/thread.h>
-#include <typedefs.h>
-
-extern uintptr_t arch_get_initial_sp(uintptr_t stack_base, uintptr_t stack_size);
-
-/** Switch to user-space (CPU user priviledge level) */
-extern void userspace(sysarg_t pc, sysarg_t sp) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: rnel/generic/include/verify.h
===================================================================
--- kernel/generic/include/verify.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_VERIFY_H_
-#define KERN_VERIFY_H_
-
-#ifdef CONFIG_VERIFY_VCC
-
-#define READS(ptr)     __specification(reads(ptr))
-#define WRITES(ptr)    __specification(writes(ptr))
-#define REQUIRES(...)  __specification(requires __VA_ARGS__)
-
-#define EXTENT(ptr)              \extent(ptr)
-#define ARRAY_RANGE(ptr, nmemb)  \array_range(ptr, nmemb)
-
-#define REQUIRES_EXTENT_MUTABLE(ptr) \
-	REQUIRES(\extent_mutable(ptr))
-
-#define REQUIRES_ARRAY_MUTABLE(ptr, nmemb) \
-	REQUIRES(\mutable_array(ptr, nmemb))
-
-#else /* CONFIG_VERIFY_VCC */
-
-#define READS(ptr)
-#define WRITES(ptr)
-#define REQUIRES(...)
-
-#define EXTENT(ptr)
-#define ARRAY_RANGE(ptr, nmemb)
-
-#define REQUIRES_EXTENT_MUTABLE(ptr)
-#define REQUIRES_ARRAY_MUTABLE(ptr, nmemb)
-
-#endif /* CONFIG_VERIFY_VCC */
-
-#endif
-
-/** @}
- */
Index: rnel/generic/meson.build
===================================================================
--- kernel/generic/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Generic kernel sources
-generic_src = []
-
-# Generic kernel sources that are instrumented when CONFIG_TRACE is enabled.
-# Must be disjoint with generic_src.
-instrumentable_src = []
-
-
-generic_src += files(
-	'common/adt/bitmap.c',
-	'common/adt/hash_table.c',
-	'common/adt/list.c',
-	'common/adt/odict.c',
-	'common/gsort.c',
-	'common/printf/printf_core.c',
-	'common/stdc/calloc.c',
-	'common/stdc/ctype.c',
-	'common/stdc/mem.c',
-	'common/stdc/snprintf.c',
-	'common/stdc/vsnprintf.c',
-	'common/str.c',
-	'common/str_error.c',
-	'common/strtol.c',
-
-	'src/cap/cap.c',
-	'src/console/chardev.c',
-	'src/console/console.c',
-	'src/console/prompt.c',
-	'src/cpu/cpu_mask.c',
-	'src/ddi/irq.c',
-	'src/debug/line.c',
-	'src/debug/names.c',
-	'src/debug/panic.c',
-	'src/debug/profile.c',
-	'src/debug/sections.c',
-	'src/debug/stacktrace.c',
-	'src/debug/symtab.c',
-	'src/debug/util.c',
-	'src/ipc/event.c',
-	'src/ipc/ipc.c',
-	'src/ipc/ipcrsc.c',
-	'src/ipc/irq.c',
-	'src/ipc/ops/conctmeto.c',
-	'src/ipc/ops/concttome.c',
-	'src/ipc/ops/dataread.c',
-	'src/ipc/ops/datawrite.c',
-	'src/ipc/ops/debug.c',
-	'src/ipc/ops/pagein.c',
-	'src/ipc/ops/sharein.c',
-	'src/ipc/ops/shareout.c',
-	'src/ipc/ops/stchngath.c',
-	'src/ipc/sysipc.c',
-	'src/ipc/sysipc_ops.c',
-	'src/lib/elf.c',
-	'src/lib/halt.c',
-	'src/lib/mem.c',
-	'src/lib/ra.c',
-	'src/lib/rd.c',
-	'src/lib/ubsan.c',
-	'src/log/log.c',
-	'src/main/shutdown.c',
-	'src/main/uinit.c',
-	'src/main/version.c',
-	'src/mm/backend_anon.c',
-	'src/mm/backend_elf.c',
-	'src/mm/backend_phys.c',
-	'src/mm/backend_user.c',
-	'src/mm/km.c',
-	'src/mm/malloc.c',
-	'src/mm/reserve.c',
-	'src/printf/printf.c',
-	'src/printf/vprintf.c',
-	'src/proc/program.c',
-	'src/proc/scheduler.c',
-	'src/proc/task.c',
-	'src/proc/thread.c',
-	'src/security/perm.c',
-	'src/smp/ipi.c',
-	'src/smp/smp.c',
-	'src/synch/condvar.c',
-	'src/synch/irq_spinlock.c',
-	'src/synch/mutex.c',
-	'src/synch/semaphore.c',
-	'src/synch/smc.c',
-	'src/synch/spinlock.c',
-	'src/synch/syswaitq.c',
-	'src/synch/waitq.c',
-	'src/syscall/copy.c',
-	'src/syscall/syscall.c',
-	'src/sysinfo/stats.c',
-	'src/time/clock.c',
-	'src/time/delay.c',
-	'src/time/timeout.c',
-)
-
-instrumentable_src += files(
-	'src/cpu/cpu.c',
-	'src/ddi/ddi.c',
-	'src/interrupt/interrupt.c',
-	'src/main/kinit.c',
-	'src/main/main.c',
-	'src/mm/as.c',
-	'src/mm/frame.c',
-	'src/mm/page.c',
-	'src/mm/slab.c',
-	'src/mm/tlb.c',
-	'src/proc/current.c',
-	'src/sysinfo/sysinfo.c',
-)
-
-## Kernel console support
-#
-
-if CONFIG_KCONSOLE
-	generic_src += files('src/console/cmd.c')
-	instrumentable_src += files('src/console/kconsole.c')
-endif
-
-## Udebug interface sources
-#
-
-if CONFIG_UDEBUG
-	generic_src += files(
-		'src/ipc/kbox.c',
-		'src/udebug/udebug.c',
-		'src/udebug/udebug_ops.c',
-		'src/udebug/udebug_ipc.c',
-	)
-endif
Index: rnel/generic/src/cap/cap.c
===================================================================
--- kernel/generic/src/cap/cap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,490 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-/*
- * HelenOS capabilities are task-local names for references to kernel objects.
- * Kernel objects are reference-counted wrappers for a select group of objects
- * allocated in and by the kernel that can be made accessible to userspace in a
- * controlled way via integer handles.
- *
- * A kernel object (kobject_t) encapsulates one of the following raw objects:
- *
- * - IPC call
- * - IPC phone
- * - IRQ object
- *
- * A capability (cap_t) is either free, allocated or published. Free
- * capabilities can be allocated, which reserves the capability handle in the
- * task-local capability space. Allocated capabilities can be published, which
- * associates them with an existing kernel object. Userspace can only access
- * published capabilities.
- *
- * A published capability may get unpublished, which disassociates it from the
- * underlying kernel object and puts it back into the allocated state. An
- * allocated capability can be freed to become available for future use.
- *
- * There is a 1:1 correspondence between a kernel object (kobject_t) and the
- * actual raw object it encapsulates. A kernel object (kobject_t) may have
- * multiple references, either implicit from one or more capabilities (cap_t),
- * even from capabilities in different tasks, or explicit as a result of
- * creating a new reference from a capability handle using kobject_get(), or
- * creating a new reference from an already existing reference by
- * kobject_add_ref() or as a result of unpublishing a capability and
- * disassociating it from its kobject_t using cap_unpublish().
- *
- * A holder of an explicit reference to a kernel object may revoke access to it
- * from all capabilities that point to it by calling cap_revoke().
- *
- * As kernel objects are reference-counted, they get automatically destroyed
- * when their last reference is dropped in kobject_put(). The idea is that
- * whenever a kernel object is inserted into some sort of a container (e.g. a
- * list or hash table), its reference count should be incremented via
- * kobject_get() or kobject_add_ref(). When the kernel object is removed from
- * the container, the reference count should go down via a call to
- * kobject_put().
- */
-
-#include <cap/cap.h>
-#include <abi/cap.h>
-#include <proc/task.h>
-#include <synch/mutex.h>
-#include <abi/errno.h>
-#include <mm/slab.h>
-#include <adt/list.h>
-#include <synch/syswaitq.h>
-#include <ipc/ipcrsc.h>
-#include <ipc/ipc.h>
-#include <ipc/irq.h>
-
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define CAPS_START	((intptr_t) CAP_NIL + 1)
-#define CAPS_SIZE	(INT_MAX - (int) CAPS_START)
-#define CAPS_LAST	(CAPS_SIZE - 1)
-
-static slab_cache_t *cap_cache;
-static slab_cache_t *kobject_cache;
-
-kobject_ops_t *kobject_ops[KOBJECT_TYPE_MAX] = {
-	[KOBJECT_TYPE_CALL] = &call_kobject_ops,
-	[KOBJECT_TYPE_IRQ] = &irq_kobject_ops,
-	[KOBJECT_TYPE_PHONE] = &phone_kobject_ops,
-	[KOBJECT_TYPE_WAITQ] = &waitq_kobject_ops
-};
-
-static size_t caps_hash(const ht_link_t *item)
-{
-	cap_t *cap = hash_table_get_inst(item, cap_t, caps_link);
-	return hash_mix(cap_handle_raw(cap->handle));
-}
-
-static size_t caps_key_hash(const void *key)
-{
-	const cap_handle_t *handle = key;
-	return hash_mix(cap_handle_raw(*handle));
-}
-
-static bool caps_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const cap_handle_t *handle = key;
-	cap_t *cap = hash_table_get_inst(item, cap_t, caps_link);
-	return *handle == cap->handle;
-}
-
-static const hash_table_ops_t caps_ops = {
-	.hash = caps_hash,
-	.key_hash = caps_key_hash,
-	.key_equal = caps_key_equal
-};
-
-void caps_init(void)
-{
-	cap_cache = slab_cache_create("cap_t", sizeof(cap_t), 0, NULL,
-	    NULL, 0);
-	kobject_cache = slab_cache_create("kobject_t", sizeof(kobject_t), 0,
-	    NULL, NULL, 0);
-}
-
-/** Allocate the capability info structure
- *
- * @param task  Task for which to allocate the info structure.
- */
-errno_t caps_task_alloc(task_t *task)
-{
-	task->cap_info = (cap_info_t *) malloc(sizeof(cap_info_t));
-	if (!task->cap_info)
-		return ENOMEM;
-	task->cap_info->handles = ra_arena_create();
-	if (!task->cap_info->handles)
-		goto error_handles;
-	if (!ra_span_add(task->cap_info->handles, CAPS_START, CAPS_SIZE))
-		goto error_span;
-	if (!hash_table_create(&task->cap_info->caps, 0, 0, &caps_ops))
-		goto error_span;
-	return EOK;
-
-error_span:
-	ra_arena_destroy(task->cap_info->handles);
-error_handles:
-	free(task->cap_info);
-	return ENOMEM;
-}
-
-/** Initialize the capability info structure
- *
- * @param task  Task for which to initialize the info structure.
- */
-void caps_task_init(task_t *task)
-{
-	mutex_initialize(&task->cap_info->lock, MUTEX_RECURSIVE);
-
-	for (kobject_type_t t = 0; t < KOBJECT_TYPE_MAX; t++)
-		list_initialize(&task->cap_info->type_list[t]);
-}
-
-/** Deallocate the capability info structure
- *
- * @param task  Task from which to deallocate the info structure.
- */
-void caps_task_free(task_t *task)
-{
-	hash_table_destroy(&task->cap_info->caps);
-	ra_arena_destroy(task->cap_info->handles);
-	free(task->cap_info);
-}
-
-/** Invoke callback function on task's capabilites of given type
- *
- * @param task  Task where the invocation should take place.
- * @param type  Kernel object type of the task's capabilities that will be
- *              subject to the callback invocation.
- * @param cb    Callback function.
- * @param arg   Argument for the callback function.
- *
- * @return True if the callback was called on all matching capabilities.
- * @return False if the callback was applied only partially.
- */
-bool caps_apply_to_kobject_type(task_t *task, kobject_type_t type,
-    bool (*cb)(cap_t *, void *), void *arg)
-{
-	bool done = true;
-
-	mutex_lock(&task->cap_info->lock);
-	list_foreach_safe(task->cap_info->type_list[type], cur, next) {
-		cap_t *cap = list_get_instance(cur, cap_t, type_link);
-		done = cb(cap, arg);
-		if (!done)
-			break;
-	}
-	mutex_unlock(&task->cap_info->lock);
-
-	return done;
-}
-
-/** Initialize capability and associate it with its handle
- *
- * @param cap     Address of the capability.
- * @param task    Backling to the owning task.
- * @param handle  Capability handle.
- */
-static void cap_initialize(cap_t *cap, task_t *task, cap_handle_t handle)
-{
-	cap->state = CAP_STATE_FREE;
-	cap->task = task;
-	cap->handle = handle;
-	link_initialize(&cap->kobj_link);
-	link_initialize(&cap->type_link);
-}
-
-/** Get capability using capability handle
- *
- * @param task    Task whose capability to get.
- * @param handle  Capability handle of the desired capability.
- * @param state   State in which the capability must be.
- *
- * @return Address of the desired capability if it exists and its state matches.
- * @return NULL if no such capability exists or it's in a different state.
- */
-static cap_t *cap_get(task_t *task, cap_handle_t handle, cap_state_t state)
-{
-	assert(mutex_locked(&task->cap_info->lock));
-
-	if ((cap_handle_raw(handle) < CAPS_START) ||
-	    (cap_handle_raw(handle) > CAPS_LAST))
-		return NULL;
-	ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle);
-	if (!link)
-		return NULL;
-	cap_t *cap = hash_table_get_inst(link, cap_t, caps_link);
-	if (cap->state != state)
-		return NULL;
-	return cap;
-}
-
-/** Allocate new capability
- *
- * @param task  Task for which to allocate the new capability.
- *
- * @param[out] handle  New capability handle on success.
- *
- * @return An error code in case of error.
- */
-errno_t cap_alloc(task_t *task, cap_handle_t *handle)
-{
-	mutex_lock(&task->cap_info->lock);
-	cap_t *cap = slab_alloc(cap_cache, FRAME_ATOMIC);
-	if (!cap) {
-		mutex_unlock(&task->cap_info->lock);
-		return ENOMEM;
-	}
-	uintptr_t hbase;
-	if (!ra_alloc(task->cap_info->handles, 1, 1, &hbase)) {
-		slab_free(cap_cache, cap);
-		mutex_unlock(&task->cap_info->lock);
-		return ENOMEM;
-	}
-	cap_initialize(cap, task, (cap_handle_t) hbase);
-	hash_table_insert(&task->cap_info->caps, &cap->caps_link);
-
-	cap->state = CAP_STATE_ALLOCATED;
-	*handle = cap->handle;
-	mutex_unlock(&task->cap_info->lock);
-
-	return EOK;
-}
-
-/** Publish allocated capability
- *
- * The kernel object is moved into the capability. In other words, its reference
- * is handed over to the capability. Once published, userspace can access and
- * manipulate the capability.
- *
- * @param task    Task in which to publish the capability.
- * @param handle  Capability handle.
- * @param kobj    Kernel object.
- */
-void
-cap_publish(task_t *task, cap_handle_t handle, kobject_t *kobj)
-{
-	mutex_lock(&kobj->caps_list_lock);
-	mutex_lock(&task->cap_info->lock);
-	cap_t *cap = cap_get(task, handle, CAP_STATE_ALLOCATED);
-	assert(cap);
-	cap->state = CAP_STATE_PUBLISHED;
-	/* Hand over kobj's reference to cap */
-	cap->kobject = kobj;
-	list_append(&cap->kobj_link, &kobj->caps_list);
-	list_append(&cap->type_link, &task->cap_info->type_list[kobj->type]);
-	mutex_unlock(&task->cap_info->lock);
-	mutex_unlock(&kobj->caps_list_lock);
-}
-
-static void cap_unpublish_unsafe(cap_t *cap)
-{
-	cap->kobject = NULL;
-	list_remove(&cap->kobj_link);
-	list_remove(&cap->type_link);
-	cap->state = CAP_STATE_ALLOCATED;
-}
-
-/** Unpublish published capability
- *
- * The kernel object is moved out of the capability. In other words, the
- * capability's reference to the objects is handed over to the kernel object
- * pointer returned by this function. Once unpublished, the capability does not
- * refer to any kernel object anymore.
- *
- * @param task    Task in which to unpublish the capability.
- * @param handle  Capability handle.
- * @param type    Kernel object type of the object associated with the
- *                capability.
- *
- * @return Pointer and explicit reference to the kobject that was associated
- *         with the capability.
- */
-kobject_t *cap_unpublish(task_t *task, cap_handle_t handle, kobject_type_t type)
-{
-	kobject_t *kobj = NULL;
-
-restart:
-	mutex_lock(&task->cap_info->lock);
-	cap_t *cap = cap_get(task, handle, CAP_STATE_PUBLISHED);
-	if (cap) {
-		if (cap->kobject->type == type) {
-			/* Hand over cap's reference to kobj */
-			kobj = cap->kobject;
-			if (mutex_trylock(&kobj->caps_list_lock) != EOK) {
-				mutex_unlock(&task->cap_info->lock);
-				kobj = NULL;
-				goto restart;
-			}
-			cap_unpublish_unsafe(cap);
-			mutex_unlock(&kobj->caps_list_lock);
-		}
-	}
-	mutex_unlock(&task->cap_info->lock);
-
-	return kobj;
-}
-
-/** Revoke access to kobject from all existing capabilities
- *
- * All published capabilities associated with the kobject are unpublished (i.e.
- * their new state is set to CAP_STATE_ALLOCATED) and no longer point to the
- * kobject. Kobject's reference count is decreased accordingly.
- *
- * Note that the caller is supposed to hold an explicit reference to the kobject
- * so that the kobject is guaranteed to exist when this function returns.
- *
- * @param kobj  Pointer and explicit reference to the kobject capabilities of
- *              which are about to be unpublished.
- */
-void cap_revoke(kobject_t *kobj)
-{
-	mutex_lock(&kobj->caps_list_lock);
-	list_foreach_safe(kobj->caps_list, cur, hlp) {
-		cap_t *cap = list_get_instance(cur, cap_t, kobj_link);
-		mutex_lock(&cap->task->cap_info->lock);
-		cap_unpublish_unsafe(cap);
-		/* Drop the reference for the unpublished capability */
-		kobject_put(kobj);
-		mutex_unlock(&cap->task->cap_info->lock);
-	}
-	mutex_unlock(&kobj->caps_list_lock);
-}
-
-/** Free allocated capability
- *
- * @param task    Task in which to free the capability.
- * @param handle  Capability handle.
- */
-void cap_free(task_t *task, cap_handle_t handle)
-{
-	assert(cap_handle_raw(handle) >= CAPS_START);
-	assert(cap_handle_raw(handle) <= CAPS_LAST);
-
-	mutex_lock(&task->cap_info->lock);
-	cap_t *cap = cap_get(task, handle, CAP_STATE_ALLOCATED);
-
-	assert(cap);
-
-	hash_table_remove_item(&task->cap_info->caps, &cap->caps_link);
-	ra_free(task->cap_info->handles, cap_handle_raw(handle), 1);
-	slab_free(cap_cache, cap);
-	mutex_unlock(&task->cap_info->lock);
-}
-
-kobject_t *kobject_alloc(unsigned int flags)
-{
-	return slab_alloc(kobject_cache, flags);
-}
-
-void kobject_free(kobject_t *kobj)
-{
-	slab_free(kobject_cache, kobj);
-}
-
-/** Initialize kernel object
- *
- * @param kobj  Kernel object to initialize.
- * @param type  Type of the kernel object.
- * @param raw   Raw pointer to the encapsulated object.
- */
-void kobject_initialize(kobject_t *kobj, kobject_type_t type, void *raw)
-{
-	atomic_store(&kobj->refcnt, 1);
-
-	mutex_initialize(&kobj->caps_list_lock, MUTEX_PASSIVE);
-	list_initialize(&kobj->caps_list);
-
-	kobj->type = type;
-	kobj->raw = raw;
-}
-
-/** Get new reference to kernel object from capability
- *
- * @param task    Task from which to get the reference.
- * @param handle  Capability handle.
- * @param type    Kernel object type of the object associated with the
- *                capability referenced by handle.
- *
- * @return Kernel object with incremented reference count on success.
- * @return NULL if there is no matching capability or kernel object.
- */
-kobject_t *
-kobject_get(struct task *task, cap_handle_t handle, kobject_type_t type)
-{
-	kobject_t *kobj = NULL;
-
-	mutex_lock(&task->cap_info->lock);
-	cap_t *cap = cap_get(task, handle, CAP_STATE_PUBLISHED);
-	if (cap) {
-		if (cap->kobject->type == type) {
-			kobj = cap->kobject;
-			atomic_inc(&kobj->refcnt);
-		}
-	}
-	mutex_unlock(&task->cap_info->lock);
-
-	return kobj;
-}
-
-/** Record new reference
- *
- * @param kobj  Kernel object from which the new reference is created.
- */
-void kobject_add_ref(kobject_t *kobj)
-{
-	atomic_inc(&kobj->refcnt);
-}
-
-/** Drop reference to kernel object
- *
- * The encapsulated object and the kobject_t wrapper are both destroyed when the
- * last reference is dropped.
- *
- * @param kobj  Kernel object whose reference to drop.
- */
-void kobject_put(kobject_t *kobj)
-{
-	if (atomic_postdec(&kobj->refcnt) == 1) {
-		KOBJECT_OP(kobj)->destroy(kobj->raw);
-		kobject_free(kobj);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/console/chardev.c
===================================================================
--- kernel/generic/src/console/chardev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <adt/list.h>
-#include <console/chardev.h>
-#include <synch/waitq.h>
-#include <synch/spinlock.h>
-#include <stdio.h>
-#include <halt.h>
-#include <cpu.h>
-
-/** Initialize input character device.
- *
- * @param indev Input character device.
- * @param op    Implementation of input character device operations.
- *
- */
-void indev_initialize(const char *name, indev_t *indev,
-    indev_operations_t *op)
-{
-	indev->name = name;
-	semaphore_initialize(&indev->wq, 0);
-	irq_spinlock_initialize(&indev->lock, "chardev.indev.lock");
-	indev->counter = 0;
-	indev->index = 0;
-	indev->op = op;
-}
-
-/** Push character read from input character device.
- *
- * @param indev Input character device.
- * @param ch    Character being pushed.
- *
- */
-void indev_push_character(indev_t *indev, char32_t ch)
-{
-	assert(indev);
-
-	irq_spinlock_lock(&indev->lock, true);
-	if (indev->counter == INDEV_BUFLEN - 1) {
-		/* Buffer full */
-		irq_spinlock_unlock(&indev->lock, true);
-		return;
-	}
-
-	indev->counter++;
-	indev->buffer[indev->index++] = ch;
-
-	/* Index modulo size of buffer */
-	indev->index = indev->index % INDEV_BUFLEN;
-	semaphore_up(&indev->wq);
-	irq_spinlock_unlock(&indev->lock, true);
-}
-
-/** Pop character from input character device.
- *
- * @param indev Input character device.
- *
- * @return Character read.
- *
- */
-char32_t indev_pop_character(indev_t *indev)
-{
-	if (atomic_load(&haltstate)) {
-		/*
-		 * If we are here, we are hopefully on the processor that
-		 * issued the 'halt' command, so proceed to read the character
-		 * directly from input
-		 */
-		if (check_poll(indev))
-			return indev->op->poll(indev);
-
-		/* No other way of interacting with user */
-		interrupts_disable();
-
-		if (CPU)
-			printf("cpu%u: ", CPU->id);
-		else
-			printf("cpu: ");
-
-		printf("halted (no polling input)\n");
-		cpu_halt();
-	}
-
-	semaphore_down(&indev->wq);
-	irq_spinlock_lock(&indev->lock, true);
-	char32_t ch = indev->buffer[(indev->index - indev->counter) %
-	    INDEV_BUFLEN];
-	indev->counter--;
-	irq_spinlock_unlock(&indev->lock, true);
-
-	return ch;
-}
-
-/** Signal out-of-band condition
- *
- * @param indev  Input character device.
- * @param signal Out-of-band condition to signal.
- *
- */
-void indev_signal(indev_t *indev, indev_signal_t signal)
-{
-	if ((indev != NULL) && (indev->op != NULL) &&
-	    (indev->op->signal != NULL))
-		indev->op->signal(indev, signal);
-}
-
-/** Initialize output character device.
- *
- * @param outdev Output character device.
- * @param op     Implementation of output character device operations.
- *
- */
-void outdev_initialize(const char *name, outdev_t *outdev,
-    outdev_operations_t *op)
-{
-	outdev->name = name;
-	spinlock_initialize(&outdev->lock, "chardev.outdev.lock");
-	link_initialize(&outdev->link);
-	list_initialize(&outdev->list);
-	outdev->op = op;
-}
-
-bool check_poll(indev_t *indev)
-{
-	if (indev == NULL)
-		return false;
-
-	if (indev->op == NULL)
-		return false;
-
-	return (indev->op->poll != NULL);
-}
-
-/** @}
- */
Index: rnel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1653 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-
-/**
- * @file  cmd.c
- * @brief Kernel console command wrappers.
- *
- * This file is meant to contain all wrapper functions for
- * all kconsole commands. The point is in separating
- * kconsole specific wrappers from kconsole-unaware functions
- * from other subsystems.
- */
-
-#include <assert.h>
-#include <console/cmd.h>
-#include <console/console.h>
-#include <console/kconsole.h>
-#include <stdio.h>
-#include <log.h>
-#include <panic.h>
-#include <typedefs.h>
-#include <adt/list.h>
-#include <arch.h>
-#include <config.h>
-#include <halt.h>
-#include <str.h>
-#include <macros.h>
-#include <cpu.h>
-#include <mm/tlb.h>
-#include <mm/km.h>
-#include <arch/mm/tlb.h>
-#include <mm/frame.h>
-#include <main/shutdown.h>
-#include <main/version.h>
-#include <mm/slab.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <ipc/ipc.h>
-#include <ipc/irq.h>
-#include <ipc/event.h>
-#include <sysinfo/sysinfo.h>
-#include <symtab.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#ifdef CONFIG_TEST
-#include <test.h>
-#endif
-
-/* Data and methods for 'help' command. */
-static int cmd_help(cmd_arg_t *argv);
-static cmd_info_t help_info = {
-	.name = "help",
-	.description = "List supported commands.",
-	.func = cmd_help,
-	.argc = 0
-};
-
-/* Data and methods for pio_read_8 command */
-static int cmd_pio_read_8(cmd_arg_t *argv);
-static cmd_arg_t pio_read_8_argv[] = { { .type = ARG_TYPE_INT } };
-static cmd_info_t pio_read_8_info = {
-	.name = "pio_read_8",
-	.description = "pio_read_8 <address> Read 1 byte from memory (or port).",
-	.func = cmd_pio_read_8,
-	.argc = 1,
-	.argv = pio_read_8_argv
-};
-
-/* Data and methods for pio_read_16 command */
-static int cmd_pio_read_16(cmd_arg_t *argv);
-static cmd_arg_t pio_read_16_argv[] = { { .type = ARG_TYPE_INT } };
-static cmd_info_t pio_read_16_info = {
-	.name = "pio_read_16",
-	.description = "pio_read_16 <address> Read 2 bytes from memory (or port).",
-	.func = cmd_pio_read_16,
-	.argc = 1,
-	.argv = pio_read_16_argv
-};
-
-/* Data and methods for pio_read_32 command */
-static int cmd_pio_read_32(cmd_arg_t *argv);
-static cmd_arg_t pio_read_32_argv[] = { { .type = ARG_TYPE_INT } };
-static cmd_info_t pio_read_32_info = {
-	.name = "pio_read_32",
-	.description = "pio_read_32 <address> Read 4 bytes from memory (or port).",
-	.func = cmd_pio_read_32,
-	.argc = 1,
-	.argv = pio_read_32_argv
-};
-
-/* Data and methods for pio_write_8 command */
-static int cmd_pio_write_8(cmd_arg_t *argv);
-static cmd_arg_t pio_write_8_argv[] = {
-	{ .type = ARG_TYPE_INT },
-	{ .type = ARG_TYPE_INT }
-};
-static cmd_info_t pio_write_8_info = {
-	.name = "pio_write_8",
-	.description = "pio_write_8 <address> <value> Write 1 byte to memory (or port).",
-	.func = cmd_pio_write_8,
-	.argc = 2,
-	.argv = pio_write_8_argv
-};
-
-/* Data and methods for pio_write_16 command */
-static int cmd_pio_write_16(cmd_arg_t *argv);
-static cmd_arg_t pio_write_16_argv[] = {
-	{ .type = ARG_TYPE_INT },
-	{ .type = ARG_TYPE_INT }
-};
-static cmd_info_t pio_write_16_info = {
-	.name = "pio_write_16",
-	.description = "pio_write_16 <address> <value> Write 2 bytes to memory (or port).",
-	.func = cmd_pio_write_16,
-	.argc = 2,
-	.argv = pio_write_16_argv
-};
-
-/* Data and methods for pio_write_32 command */
-static int cmd_pio_write_32(cmd_arg_t *argv);
-static cmd_arg_t pio_write_32_argv[] = {
-	{ .type = ARG_TYPE_INT },
-	{ .type = ARG_TYPE_INT }
-};
-static cmd_info_t pio_write_32_info = {
-	.name = "pio_write_32",
-	.description = "pio_write_32 <address> <value> Write 4 bytes to memory (or port).",
-	.func = cmd_pio_write_32,
-	.argc = 2,
-	.argv = pio_write_32_argv
-};
-
-/* Data and methods for 'reboot' command. */
-static int cmd_reboot(cmd_arg_t *argv);
-static cmd_info_t reboot_info = {
-	.name = "reboot",
-	.description = "Reboot system.",
-	.func = cmd_reboot,
-	.argc = 0
-};
-
-/* Data and methods for 'uptime' command. */
-static int cmd_uptime(cmd_arg_t *argv);
-static cmd_info_t uptime_info = {
-	.name = "uptime",
-	.description = "Show system uptime.",
-	.func = cmd_uptime,
-	.argc = 0
-};
-
-/* Data and methods for 'continue' command. */
-static int cmd_continue(cmd_arg_t *argv);
-static cmd_info_t continue_info = {
-	.name = "continue",
-	.description = "Return console back to userspace.",
-	.func = cmd_continue,
-	.argc = 0
-};
-
-#ifdef CONFIG_TEST
-
-/* Data and methods for 'test' command. */
-static char test_buf[MAX_CMDLINE + 1];
-static int cmd_test(cmd_arg_t *argv);
-static cmd_arg_t test_argv[] = {
-	{
-		.type = ARG_TYPE_STRING_OPTIONAL,
-		.buffer = test_buf,
-		.len = sizeof(test_buf)
-	}
-};
-static cmd_info_t test_info = {
-	.name = "test",
-	.description = "<test> List kernel tests or run a test.",
-	.func = cmd_test,
-	.argc = 1,
-	.argv = test_argv,
-	.hints_enum = tests_hints_enum
-};
-
-/* Data and methods for 'bench' command. */
-static int cmd_bench(cmd_arg_t *argv);
-static cmd_arg_t bench_argv[] = {
-	{
-		.type = ARG_TYPE_STRING,
-		.buffer = test_buf,
-		.len = sizeof(test_buf)
-	},
-	{
-		.type = ARG_TYPE_INT,
-	}
-};
-static cmd_info_t bench_info = {
-	.name = "bench",
-	.description = "<test> <count> Run kernel test as benchmark.",
-	.func = cmd_bench,
-	.argc = 2,
-	.argv = bench_argv
-};
-
-/* Data and methods for 'printbench' command. */
-static int cmd_printbench(cmd_arg_t *argv);
-
-static cmd_info_t printbench_info = {
-	.name = "printbench",
-	.description = "Run a printing benchmark.",
-	.func = cmd_printbench,
-	.argc = 0,
-};
-
-#endif /* CONFIG_TEST */
-
-/* Data and methods for 'description' command. */
-static int cmd_desc(cmd_arg_t *argv);
-static void desc_help(void);
-static char desc_buf[MAX_CMDLINE + 1];
-static cmd_arg_t desc_argv = {
-	.type = ARG_TYPE_STRING,
-	.buffer = desc_buf,
-	.len = sizeof(desc_buf)
-};
-static cmd_info_t desc_info = {
-	.name = "describe",
-	.description = "<command> Describe specified command.",
-	.help = desc_help,
-	.func = cmd_desc,
-	.argc = 1,
-	.argv = &desc_argv,
-	.hints_enum = cmdtab_enum
-};
-
-/* Data and methods for 'symaddr' command. */
-static int cmd_symaddr(cmd_arg_t *argv);
-static char symaddr_buf[MAX_CMDLINE + 1];
-static cmd_arg_t symaddr_argv = {
-	.type = ARG_TYPE_STRING,
-	.buffer = symaddr_buf,
-	.len = sizeof(symaddr_buf)
-};
-static cmd_info_t symaddr_info = {
-	.name = "symaddr",
-	.description = "<symbol> Return symbol address.",
-	.func = cmd_symaddr,
-	.argc = 1,
-	.argv = &symaddr_argv,
-	.hints_enum = symtab_hints_enum,
-};
-
-/* Data and methods for 'set4' command. */
-static char set_buf[MAX_CMDLINE + 1];
-static int cmd_set4(cmd_arg_t *argv);
-static cmd_arg_t set4_argv[] = {
-	{
-		.type = ARG_TYPE_STRING,
-		.buffer = set_buf,
-		.len = sizeof(set_buf)
-	},
-	{
-		.type = ARG_TYPE_INT
-	}
-};
-static cmd_info_t set4_info = {
-	.name = "set4",
-	.description = "<addr> <value> Set 4B memory location to a value.",
-	.func = cmd_set4,
-	.argc = 2,
-	.argv = set4_argv
-};
-
-/* Data and methods for 'call0' and 'mcall0' command. */
-static char call0_buf[MAX_CMDLINE + 1];
-static char carg1_buf[MAX_CMDLINE + 1];
-static char carg2_buf[MAX_CMDLINE + 1];
-static char carg3_buf[MAX_CMDLINE + 1];
-
-static int cmd_call0(cmd_arg_t *argv);
-static cmd_arg_t call0_argv = {
-	.type = ARG_TYPE_STRING,
-	.buffer = call0_buf,
-	.len = sizeof(call0_buf)
-};
-static cmd_info_t call0_info = {
-	.name = "call0",
-	.description = "<function> Call function().",
-	.func = cmd_call0,
-	.argc = 1,
-	.argv = &call0_argv,
-	.hints_enum = symtab_hints_enum
-};
-
-/* Data and methods for 'mcall0' command. */
-static int cmd_mcall0(cmd_arg_t *argv);
-static cmd_arg_t mcall0_argv = {
-	.type = ARG_TYPE_STRING,
-	.buffer = call0_buf,
-	.len = sizeof(call0_buf)
-};
-static cmd_info_t mcall0_info = {
-	.name = "mcall0",
-	.description = "<function> Call function() on each CPU.",
-	.func = cmd_mcall0,
-	.argc = 1,
-	.argv = &mcall0_argv,
-	.hints_enum = symtab_hints_enum
-};
-
-/* Data and methods for 'call1' command. */
-static int cmd_call1(cmd_arg_t *argv);
-static cmd_arg_t call1_argv[] = {
-	{
-		.type = ARG_TYPE_STRING,
-		.buffer = call0_buf,
-		.len = sizeof(call0_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg1_buf,
-		.len = sizeof(carg1_buf)
-	}
-};
-static cmd_info_t call1_info = {
-	.name = "call1",
-	.description = "<function> <arg1> Call function(arg1).",
-	.func = cmd_call1,
-	.argc = 2,
-	.argv = call1_argv,
-	.hints_enum = symtab_hints_enum
-};
-
-/* Data and methods for 'call2' command. */
-static int cmd_call2(cmd_arg_t *argv);
-static cmd_arg_t call2_argv[] = {
-	{
-		.type = ARG_TYPE_STRING,
-		.buffer = call0_buf,
-		.len = sizeof(call0_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg1_buf,
-		.len = sizeof(carg1_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg2_buf,
-		.len = sizeof(carg2_buf)
-	}
-};
-static cmd_info_t call2_info = {
-	.name = "call2",
-	.description = "<function> <arg1> <arg2> Call function(arg1, arg2).",
-	.func = cmd_call2,
-	.argc = 3,
-	.argv = call2_argv,
-	.hints_enum = symtab_hints_enum
-};
-
-/* Data and methods for 'call3' command. */
-static int cmd_call3(cmd_arg_t *argv);
-static cmd_arg_t call3_argv[] = {
-	{
-		.type = ARG_TYPE_STRING,
-		.buffer = call0_buf,
-		.len = sizeof(call0_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg1_buf,
-		.len = sizeof(carg1_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg2_buf,
-		.len = sizeof(carg2_buf)
-	},
-	{
-		.type = ARG_TYPE_VAR,
-		.buffer = carg3_buf,
-		.len = sizeof(carg3_buf)
-	}
-
-};
-static cmd_info_t call3_info = {
-	.name = "call3",
-	.description = "<function> <arg1> <arg2> <arg3> Call function(arg1, arg2, arg3).",
-	.func = cmd_call3,
-	.argc = 4,
-	.argv = call3_argv,
-	.hints_enum = symtab_hints_enum
-};
-
-/* Data and methods for 'halt' command. */
-static int cmd_halt(cmd_arg_t *argv);
-static cmd_info_t halt_info = {
-	.name = "halt",
-	.description = "Halt the kernel.",
-	.func = cmd_halt,
-	.argc = 0
-};
-
-/* Data and methods for 'physmem' command. */
-static int cmd_physmem(cmd_arg_t *argv);
-cmd_info_t physmem_info = {
-	.name = "physmem",
-	.description = "Print physical memory configuration.",
-	.help = NULL,
-	.func = cmd_physmem,
-	.argc = 0,
-	.argv = NULL
-};
-
-/* Data and methods for 'tlb' command. */
-static int cmd_tlb(cmd_arg_t *argv);
-cmd_info_t tlb_info = {
-	.name = "tlb",
-	.description = "Print TLB of the current CPU.",
-	.help = NULL,
-	.func = cmd_tlb,
-	.argc = 0,
-	.argv = NULL
-};
-
-static char flag_buf[MAX_CMDLINE + 1];
-
-static int cmd_threads(cmd_arg_t *argv);
-static cmd_arg_t threads_argv = {
-	.type = ARG_TYPE_STRING_OPTIONAL,
-	.buffer = flag_buf,
-	.len = sizeof(flag_buf)
-};
-static cmd_info_t threads_info = {
-	.name = "threads",
-	.description = "List all threads (use -a for additional information).",
-	.func = cmd_threads,
-	.argc = 1,
-	.argv = &threads_argv
-};
-
-static int cmd_tasks(cmd_arg_t *argv);
-static cmd_arg_t tasks_argv = {
-	.type = ARG_TYPE_STRING_OPTIONAL,
-	.buffer = flag_buf,
-	.len = sizeof(flag_buf)
-};
-static cmd_info_t tasks_info = {
-	.name = "tasks",
-	.description = "List all tasks (use -a for additional information).",
-	.func = cmd_tasks,
-	.argc = 1,
-	.argv = &tasks_argv
-};
-
-#ifdef CONFIG_UDEBUG
-
-/* Data and methods for 'btrace' command */
-static int cmd_btrace(cmd_arg_t *argv);
-static cmd_arg_t btrace_argv = {
-	.type = ARG_TYPE_INT,
-};
-static cmd_info_t btrace_info = {
-	.name = "btrace",
-	.description = "<threadid> Show thread stack trace.",
-	.func = cmd_btrace,
-	.argc = 1,
-	.argv = &btrace_argv
-};
-
-#endif /* CONFIG_UDEBUG */
-
-static int cmd_sched(cmd_arg_t *argv);
-static cmd_info_t sched_info = {
-	.name = "scheduler",
-	.description = "Show scheduler information.",
-	.func = cmd_sched,
-	.argc = 0
-};
-
-static int cmd_caches(cmd_arg_t *argv);
-static cmd_info_t caches_info = {
-	.name = "caches",
-	.description = "List slab caches.",
-	.func = cmd_caches,
-	.argc = 0
-};
-
-static int cmd_sysinfo(cmd_arg_t *argv);
-static cmd_info_t sysinfo_info = {
-	.name = "sysinfo",
-	.description = "Dump sysinfo.",
-	.func = cmd_sysinfo,
-	.argc = 0
-};
-
-/* Data and methods for 'zones' command */
-static int cmd_zones(cmd_arg_t *argv);
-static cmd_info_t zones_info = {
-	.name = "zones",
-	.description = "List memory zones.",
-	.func = cmd_zones,
-	.argc = 0
-};
-
-/* Data and methods for 'zone' command */
-static int cmd_zone(cmd_arg_t *argv);
-static cmd_arg_t zone_argv = {
-	.type = ARG_TYPE_INT,
-};
-
-static cmd_info_t zone_info = {
-	.name = "zone",
-	.description = "<zone> Show memory zone structure.",
-	.func = cmd_zone,
-	.argc = 1,
-	.argv = &zone_argv
-};
-
-/* Data and methods for 'ipc' command */
-static int cmd_ipc(cmd_arg_t *argv);
-static cmd_arg_t ipc_argv = {
-	.type = ARG_TYPE_INT,
-};
-static cmd_info_t ipc_info = {
-	.name = "ipc",
-	.description = "<taskid> Show IPC information of a task.",
-	.func = cmd_ipc,
-	.argc = 1,
-	.argv = &ipc_argv
-};
-
-/* Data and methods for 'kill' command */
-static int cmd_kill(cmd_arg_t *argv);
-static cmd_arg_t kill_argv = {
-	.type = ARG_TYPE_INT,
-};
-static cmd_info_t kill_info = {
-	.name = "kill",
-	.description = "<taskid> Kill a task.",
-	.func = cmd_kill,
-	.argc = 1,
-	.argv = &kill_argv
-};
-
-/* Data and methods for 'cpus' command. */
-static int cmd_cpus(cmd_arg_t *argv);
-cmd_info_t cpus_info = {
-	.name = "cpus",
-	.description = "List all processors.",
-	.help = NULL,
-	.func = cmd_cpus,
-	.argc = 0,
-	.argv = NULL
-};
-
-/* Data and methods for 'version' command. */
-static int cmd_version(cmd_arg_t *argv);
-cmd_info_t version_info = {
-	.name = "version",
-	.description = "Print version information.",
-	.help = NULL,
-	.func = cmd_version,
-	.argc = 0,
-	.argv = NULL
-};
-
-static cmd_info_t *basic_commands[] = {
-	&call0_info,
-	&mcall0_info,
-	&caches_info,
-	&call1_info,
-	&call2_info,
-	&call3_info,
-	&continue_info,
-	&cpus_info,
-	&desc_info,
-	&halt_info,
-	&help_info,
-	&ipc_info,
-	&kill_info,
-	&physmem_info,
-	&reboot_info,
-	&sched_info,
-	&set4_info,
-	&symaddr_info,
-	&sysinfo_info,
-	&tasks_info,
-	&threads_info,
-	&tlb_info,
-	&uptime_info,
-	&version_info,
-	&zones_info,
-	&zone_info,
-#ifdef CONFIG_TEST
-	&test_info,
-	&bench_info,
-	&printbench_info,
-#endif
-#ifdef CONFIG_UDEBUG
-	&btrace_info,
-#endif
-	&pio_read_8_info,
-	&pio_read_16_info,
-	&pio_read_32_info,
-	&pio_write_8_info,
-	&pio_write_16_info,
-	&pio_write_32_info,
-	NULL
-};
-
-/** Initialize command info structure.
- *
- * @param cmd Command info structure.
- *
- */
-void cmd_initialize(cmd_info_t *cmd)
-{
-	spinlock_initialize(&cmd->lock, "cmd.lock");
-	link_initialize(&cmd->link);
-}
-
-/** Initialize and register commands. */
-void cmd_init(void)
-{
-	unsigned int i;
-
-	for (i = 0; basic_commands[i]; i++) {
-		cmd_initialize(basic_commands[i]);
-	}
-
-	for (i = 0; basic_commands[i]; i++) {
-		if (!cmd_register(basic_commands[i])) {
-			log(LF_OTHER, LVL_ERROR,
-			    "Cannot register command %s",
-			    basic_commands[i]->name);
-		}
-	}
-}
-
-/** List supported commands.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-int cmd_help(cmd_arg_t *argv)
-{
-	spinlock_lock(&cmd_lock);
-
-	size_t len = 0;
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		spinlock_lock(&hlp->lock);
-		if (str_length(hlp->name) > len)
-			len = str_length(hlp->name);
-		spinlock_unlock(&hlp->lock);
-	}
-
-	unsigned int _len = (unsigned int) len;
-	if ((_len != len) || (((int) _len) < 0)) {
-		log(LF_OTHER, LVL_ERROR, "Command length overflow");
-		return 1;
-	}
-
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		spinlock_lock(&hlp->lock);
-		printf("%-*s %s\n", _len, hlp->name, hlp->description);
-		spinlock_unlock(&hlp->lock);
-	}
-
-	spinlock_unlock(&cmd_lock);
-
-	return 1;
-}
-
-/** Read 1 byte from phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_read_8(cmd_arg_t *argv)
-{
-	uint8_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint8_t *) km_map(argv[0].intval, sizeof(uint8_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	const uint8_t val = pio_read_8(ptr);
-	printf("read %" PRIxn ": %" PRIx8 "\n", argv[0].intval, val);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint8_t));
-	return 1;
-}
-
-/** Read 2 bytes from phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_read_16(cmd_arg_t *argv)
-{
-	uint16_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint16_t *) km_map(argv[0].intval, sizeof(uint16_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	const uint16_t val = pio_read_16(ptr);
-	printf("read %" PRIxn ": %" PRIx16 "\n", argv[0].intval, val);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint16_t));
-	return 1;
-}
-
-/** Read 4 bytes from phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_read_32(cmd_arg_t *argv)
-{
-	uint32_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint32_t *) km_map(argv[0].intval, sizeof(uint32_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	const uint32_t val = pio_read_32(ptr);
-	printf("read %" PRIxn ": %" PRIx32 "\n", argv[0].intval, val);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint32_t));
-	return 1;
-}
-
-/** Write 1 byte to phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_write_8(cmd_arg_t *argv)
-{
-	uint8_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint8_t *) km_map(argv[0].intval, sizeof(uint8_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	printf("write %" PRIxn ": %" PRIx8 "\n", argv[0].intval,
-	    (uint8_t) argv[1].intval);
-	pio_write_8(ptr, (uint8_t) argv[1].intval);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint8_t));
-	return 1;
-}
-
-/** Write 2 bytes to phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_write_16(cmd_arg_t *argv)
-{
-	uint16_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint16_t *) km_map(argv[0].intval, sizeof(uint16_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	printf("write %" PRIxn ": %" PRIx16 "\n", argv[0].intval,
-	    (uint16_t) argv[1].intval);
-	pio_write_16(ptr, (uint16_t) argv[1].intval);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint16_t));
-	return 1;
-}
-
-/** Write 4 bytes to phys memory or io port.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-static int cmd_pio_write_32(cmd_arg_t *argv)
-{
-	uint32_t *ptr = NULL;
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		ptr = (void *) argv[0].intval;
-	else
-#endif
-		ptr = (uint32_t *) km_map(argv[0].intval, sizeof(uint32_t),
-		    PAGE_SIZE, PAGE_NOT_CACHEABLE);
-
-	printf("write %" PRIxn ": %" PRIx32 "\n", argv[0].intval,
-	    (uint32_t) argv[1].intval);
-	pio_write_32(ptr, (uint32_t) argv[1].intval);
-
-#ifdef IO_SPACE_BOUNDARY
-	if ((void *) argv->intval < IO_SPACE_BOUNDARY)
-		return 1;
-#endif
-
-	km_unmap((uintptr_t) ptr, sizeof(uint32_t));
-	return 1;
-}
-
-/** Reboot the system.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-int cmd_reboot(cmd_arg_t *argv)
-{
-	reboot();
-
-	/* Not reached */
-	return 1;
-}
-
-/** Print system uptime information.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-int cmd_uptime(cmd_arg_t *argv)
-{
-	assert(uptime);
-
-	/* This doesn't have to be very accurate */
-	sysarg_t sec = uptime->seconds1;
-
-	printf("Up %" PRIun " days, %" PRIun " hours, %" PRIun " minutes, %" PRIun " seconds\n",
-	    sec / 86400, (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60);
-
-	return 1;
-}
-
-/** Describe specified command.
- *
- * @param argv Argument vector.
- *
- * @return 0 on failure, 1 on success.
- */
-int cmd_desc(cmd_arg_t *argv)
-{
-	spinlock_lock(&cmd_lock);
-
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		spinlock_lock(&hlp->lock);
-
-		if (str_lcmp(hlp->name, (const char *) argv->buffer, str_length(hlp->name)) == 0) {
-			printf("%s - %s\n", hlp->name, hlp->description);
-			if (hlp->help)
-				hlp->help();
-			spinlock_unlock(&hlp->lock);
-			break;
-		}
-
-		spinlock_unlock(&hlp->lock);
-	}
-
-	spinlock_unlock(&cmd_lock);
-
-	return 1;
-}
-
-/** Search symbol table */
-int cmd_symaddr(cmd_arg_t *argv)
-{
-	symtab_print_search((char *) argv->buffer);
-
-	return 1;
-}
-
-/** Call function with zero parameters */
-int cmd_call0(cmd_arg_t *argv)
-{
-	uintptr_t symaddr;
-	char *symbol;
-	sysarg_t (*fnc)(void);
-	fncptr_t fptr;
-	errno_t rc;
-
-	symbol = (char *) argv->buffer;
-	rc = symtab_addr_lookup(symbol, &symaddr);
-
-	if (rc == ENOENT)
-		printf("Symbol %s not found.\n", symbol);
-	else if (rc == EOVERFLOW) {
-		symtab_print_search(symbol);
-		printf("Duplicate symbol, be more specific.\n");
-	} else if (rc == EOK) {
-		ipl_t ipl;
-
-		ipl = interrupts_disable();
-		fnc = (sysarg_t (*)(void)) arch_construct_function(&fptr,
-		    (void *) symaddr, (void *) cmd_call0);
-		printf("Calling %s() (%p)\n", symbol, (void *) symaddr);
-		printf("Result: %#" PRIxn "\n", fnc());
-		interrupts_restore(ipl);
-	} else {
-		printf("No symbol information available.\n");
-	}
-	return 1;
-}
-
-/** Call function with zero parameters on each CPU */
-int cmd_mcall0(cmd_arg_t *argv)
-{
-	/*
-	 * For each CPU, create a thread which will
-	 * call the function.
-	 */
-
-	unsigned int i;
-	for (i = 0; i < config.cpu_count; i++) {
-		if (!cpus[i].active)
-			continue;
-
-		thread_t *thread;
-		if ((thread = thread_create((void (*)(void *)) cmd_call0,
-		    (void *) argv, TASK, THREAD_FLAG_NONE, "call0"))) {
-			printf("cpu%u: ", i);
-			thread_wire(thread, &cpus[i]);
-			thread_start(thread);
-			thread_join(thread);
-		} else
-			printf("Unable to create thread for cpu%u\n", i);
-	}
-
-	return 1;
-}
-
-/** Call function with one parameter */
-int cmd_call1(cmd_arg_t *argv)
-{
-	uintptr_t symaddr;
-	char *symbol;
-	sysarg_t (*fnc)(sysarg_t, ...);
-	sysarg_t arg1 = argv[1].intval;
-	fncptr_t fptr;
-	errno_t rc;
-
-	symbol = (char *) argv->buffer;
-	rc = symtab_addr_lookup(symbol, &symaddr);
-
-	if (rc == ENOENT) {
-		printf("Symbol %s not found.\n", symbol);
-	} else if (rc == EOVERFLOW) {
-		symtab_print_search(symbol);
-		printf("Duplicate symbol, be more specific.\n");
-	} else if (rc == EOK) {
-		ipl_t ipl;
-
-		ipl = interrupts_disable();
-		fnc = (sysarg_t (*)(sysarg_t, ...))
-		    arch_construct_function(&fptr, (void *) symaddr,
-		    (void *) cmd_call1);
-		printf("Calling f(%#" PRIxn "): %p: %s\n", arg1,
-		    (void *) symaddr, symbol);
-		printf("Result: %#" PRIxn "\n", fnc(arg1));
-		interrupts_restore(ipl);
-	} else {
-		printf("No symbol information available.\n");
-	}
-
-	return 1;
-}
-
-/** Call function with two parameters */
-int cmd_call2(cmd_arg_t *argv)
-{
-	uintptr_t symaddr;
-	char *symbol;
-	sysarg_t (*fnc)(sysarg_t, sysarg_t, ...);
-	sysarg_t arg1 = argv[1].intval;
-	sysarg_t arg2 = argv[2].intval;
-	fncptr_t fptr;
-	errno_t rc;
-
-	symbol = (char *) argv->buffer;
-	rc = symtab_addr_lookup(symbol, &symaddr);
-
-	if (rc == ENOENT) {
-		printf("Symbol %s not found.\n", symbol);
-	} else if (rc == EOVERFLOW) {
-		symtab_print_search(symbol);
-		printf("Duplicate symbol, be more specific.\n");
-	} else if (rc == EOK) {
-		ipl_t ipl;
-
-		ipl = interrupts_disable();
-		fnc = (sysarg_t (*)(sysarg_t, sysarg_t, ...))
-		    arch_construct_function(&fptr, (void *) symaddr,
-		    (void *) cmd_call2);
-		printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
-		    arg1, arg2, (void *) symaddr, symbol);
-		printf("Result: %#" PRIxn "\n", fnc(arg1, arg2));
-		interrupts_restore(ipl);
-	} else {
-		printf("No symbol information available.\n");
-	}
-	return 1;
-}
-
-/** Call function with three parameters */
-int cmd_call3(cmd_arg_t *argv)
-{
-	uintptr_t symaddr;
-	char *symbol;
-	sysarg_t (*fnc)(sysarg_t, sysarg_t, sysarg_t, ...);
-	sysarg_t arg1 = argv[1].intval;
-	sysarg_t arg2 = argv[2].intval;
-	sysarg_t arg3 = argv[3].intval;
-	fncptr_t fptr;
-	errno_t rc;
-
-	symbol = (char *) argv->buffer;
-	rc = symtab_addr_lookup(symbol, &symaddr);
-
-	if (rc == ENOENT) {
-		printf("Symbol %s not found.\n", symbol);
-	} else if (rc == EOVERFLOW) {
-		symtab_print_search(symbol);
-		printf("Duplicate symbol, be more specific.\n");
-	} else if (rc == EOK) {
-		ipl_t ipl;
-
-		ipl = interrupts_disable();
-		fnc = (sysarg_t (*)(sysarg_t, sysarg_t, sysarg_t, ...))
-		    arch_construct_function(&fptr, (void *) symaddr,
-		    (void *) cmd_call3);
-		printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
-		    arg1, arg2, arg3, (void *) symaddr, symbol);
-		printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3));
-		interrupts_restore(ipl);
-	} else {
-		printf("No symbol information available.\n");
-	}
-	return 1;
-}
-
-/** Print detailed description of 'describe' command. */
-void desc_help(void)
-{
-	printf("Syntax: describe command_name\n");
-}
-
-/** Halt the kernel.
- *
- * @param argv Argument vector (ignored).
- *
- * @return 0 on failure, 1 on success (never returns).
- */
-int cmd_halt(cmd_arg_t *argv)
-{
-	halt();
-	return 1;
-}
-
-/** Command for printing TLB contents.
- *
- * @param argv Not used.
- *
- * @return Always returns 1.
- */
-int cmd_tlb(cmd_arg_t *argv)
-{
-	tlb_print();
-	return 1;
-}
-
-/** Command for printing physical memory configuration.
- *
- * @param argv Not used.
- *
- * @return Always returns 1.
- */
-int cmd_physmem(cmd_arg_t *argv)
-{
-	physmem_print();
-	return 1;
-}
-
-/** Write 4 byte value to address */
-int cmd_set4(cmd_arg_t *argv)
-{
-	uintptr_t addr = 0; // Prevent -Werror=maybe-uninitialized
-	uint32_t arg1 = argv[1].intval;
-	bool pointer = false;
-	errno_t rc;
-
-	if (((char *) argv->buffer)[0] == '*') {
-		rc = symtab_addr_lookup((char *) argv->buffer + 1, &addr);
-		pointer = true;
-	} else if (((char *) argv->buffer)[0] >= '0' &&
-	    ((char *) argv->buffer)[0] <= '9') {
-		uint64_t value;
-		rc = str_uint64_t((char *) argv->buffer, NULL, 0, true, &value);
-		if (rc == EOK)
-			addr = (uintptr_t) value;
-	} else
-		rc = symtab_addr_lookup((char *) argv->buffer, &addr);
-
-	if (rc == ENOENT)
-		printf("Symbol %s not found.\n", (char *) argv->buffer);
-	else if (rc == EINVAL)
-		printf("Invalid address.\n");
-	else if (rc == EOVERFLOW) {
-		symtab_print_search((char *) argv->buffer);
-		printf("Duplicate symbol (be more specific) or address overflow.\n");
-	} else if (rc == EOK) {
-		if (pointer)
-			addr = *(uintptr_t *) addr;
-		printf("Writing %#" PRIx32 " -> %p\n", arg1, (void *) addr);
-		*(uint32_t *) addr = arg1;
-	} else
-		printf("No symbol information available.\n");
-
-	return 1;
-}
-
-/** Command for listing slab allocator caches
- *
- * @param argv Ignored
- *
- * @return Always 1
- */
-int cmd_caches(cmd_arg_t *argv)
-{
-	slab_print_list();
-	return 1;
-}
-
-/** Command for dumping sysinfo
- *
- * @param argv Ignores
- *
- * @return Always 1
- */
-int cmd_sysinfo(cmd_arg_t *argv)
-{
-	sysinfo_dump(NULL);
-	return 1;
-}
-
-/** Command for listing thread information
- *
- * @param argv Ignored
- *
- * @return Always 1
- */
-int cmd_threads(cmd_arg_t *argv)
-{
-	if (str_cmp(flag_buf, "-a") == 0)
-		thread_print_list(true);
-	else if (str_cmp(flag_buf, "") == 0)
-		thread_print_list(false);
-	else
-		printf("Unknown argument \"%s\".\n", flag_buf);
-
-	return 1;
-}
-
-/** Command for listing task information
- *
- * @param argv Ignored
- *
- * @return Always 1
- */
-int cmd_tasks(cmd_arg_t *argv)
-{
-	if (str_cmp(flag_buf, "-a") == 0)
-		task_print_list(true);
-	else if (str_cmp(flag_buf, "") == 0)
-		task_print_list(false);
-	else
-		printf("Unknown argument \"%s\".\n", flag_buf);
-
-	return 1;
-}
-
-#ifdef CONFIG_UDEBUG
-
-/** Command for printing thread stack trace
- *
- * @param argv Integer argument from cmdline expected
- *
- * return Always 1
- *
- */
-int cmd_btrace(cmd_arg_t *argv)
-{
-	thread_stack_trace(argv[0].intval);
-	return 1;
-}
-
-#endif /* CONFIG_UDEBUG */
-
-/** Command for printing scheduler information
- *
- * @param argv Ignores
- *
- * @return Always 1
- */
-int cmd_sched(cmd_arg_t *argv)
-{
-	sched_print_list();
-	return 1;
-}
-
-/** Command for listing memory zones
- *
- * @param argv Ignored
- *
- * return Always 1
- */
-int cmd_zones(cmd_arg_t *argv)
-{
-	zones_print_list();
-	return 1;
-}
-
-/** Command for memory zone details
- *
- * @param argv Integer argument from cmdline expected
- *
- * return Always 1
- */
-int cmd_zone(cmd_arg_t *argv)
-{
-	zone_print_one(argv[0].intval);
-	return 1;
-}
-
-/** Command for printing task IPC details
- *
- * @param argv Integer argument from cmdline expected
- *
- * return Always 1
- */
-int cmd_ipc(cmd_arg_t *argv)
-{
-	ipc_print_task(argv[0].intval);
-	return 1;
-}
-
-/** Command for killing a task
- *
- * @param argv Integer argument from cmdline expected
- *
- * return 0 on failure, 1 on success.
- */
-int cmd_kill(cmd_arg_t *argv)
-{
-	if (task_kill(argv[0].intval) != EOK)
-		return 0;
-
-	return 1;
-}
-
-/** Command for listing processors.
- *
- * @param argv Ignored.
- *
- * return Always 1.
- */
-int cmd_cpus(cmd_arg_t *argv)
-{
-	cpu_list();
-	return 1;
-}
-
-/** Command for printing kernel version.
- *
- * @param argv Ignored.
- *
- * return Always 1.
- */
-int cmd_version(cmd_arg_t *argv)
-{
-	version_print();
-	return 1;
-}
-
-/** Command for returning console back to userspace.
- *
- * @param argv Ignored.
- *
- * return Always 1.
- */
-int cmd_continue(cmd_arg_t *argv)
-{
-	printf("The kernel will now relinquish the console.\n");
-	release_console();
-	indev_pop_character(stdin);
-
-	return 1;
-}
-
-#ifdef CONFIG_TEST
-static bool run_test(const test_t *test)
-{
-	printf("%s (%s)\n", test->name, test->desc);
-
-	/*
-	 * Update and read thread accounting
-	 * for benchmarking
-	 */
-	irq_spinlock_lock(&TASK->lock, true);
-	uint64_t ucycles0, kcycles0;
-	task_get_accounting(TASK, &ucycles0, &kcycles0);
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	/* Execute the test */
-	test_quiet = false;
-	const char *ret = test->entry();
-
-	/* Update and read thread accounting */
-	uint64_t ucycles1, kcycles1;
-	irq_spinlock_lock(&TASK->lock, true);
-	task_get_accounting(TASK, &ucycles1, &kcycles1);
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	uint64_t ucycles, kcycles;
-	char usuffix, ksuffix;
-	order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix);
-	order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
-
-	printf("Time: %" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles\n",
-	    ucycles, usuffix, kcycles, ksuffix);
-
-	if (ret == NULL) {
-		printf("Test passed\n");
-		return true;
-	}
-
-	printf("%s\n", ret);
-	return false;
-}
-
-static bool run_bench(const test_t *test, const uint32_t cnt)
-{
-	uint32_t i;
-	bool ret = true;
-	uint64_t ucycles, kcycles;
-	char usuffix, ksuffix;
-
-	if (cnt < 1)
-		return true;
-
-	uint64_t *data = (uint64_t *) malloc(sizeof(uint64_t) * cnt);
-	if (data == NULL) {
-		printf("Error allocating memory for statistics\n");
-		return false;
-	}
-
-	for (i = 0; i < cnt; i++) {
-		printf("%s (%u/%u) ... ", test->name, i + 1, cnt);
-
-		/*
-		 * Update and read thread accounting
-		 * for benchmarking
-		 */
-		irq_spinlock_lock(&TASK->lock, true);
-		uint64_t ucycles0, kcycles0;
-		task_get_accounting(TASK, &ucycles0, &kcycles0);
-		irq_spinlock_unlock(&TASK->lock, true);
-
-		/* Execute the test */
-		test_quiet = true;
-		const char *test_ret = test->entry();
-
-		/* Update and read thread accounting */
-		irq_spinlock_lock(&TASK->lock, true);
-		uint64_t ucycles1, kcycles1;
-		task_get_accounting(TASK, &ucycles1, &kcycles1);
-		irq_spinlock_unlock(&TASK->lock, true);
-
-		if (test_ret != NULL) {
-			printf("%s\n", test_ret);
-			ret = false;
-			break;
-		}
-
-		data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0;
-		order_suffix(ucycles1 - ucycles0, &ucycles, &usuffix);
-		order_suffix(kcycles1 - kcycles0, &kcycles, &ksuffix);
-		printf("OK (%" PRIu64 "%c user cycles, %" PRIu64 "%c kernel cycles)\n",
-		    ucycles, usuffix, kcycles, ksuffix);
-	}
-
-	if (ret) {
-		printf("\n");
-
-		uint64_t sum = 0;
-
-		for (i = 0; i < cnt; i++) {
-			sum += data[i];
-		}
-
-		order_suffix(sum / (uint64_t) cnt, &ucycles, &usuffix);
-		printf("Average\t\t%" PRIu64 "%c\n", ucycles, usuffix);
-	}
-
-	free(data);
-
-	return ret;
-}
-
-static void list_tests(void)
-{
-	size_t len = 0;
-	test_t *test;
-
-	for (test = tests; test->name != NULL; test++) {
-		if (str_length(test->name) > len)
-			len = str_length(test->name);
-	}
-
-	unsigned int _len = (unsigned int) len;
-	if ((_len != len) || (((int) _len) < 0)) {
-		printf("Command length overflow\n");
-		return;
-	}
-
-	for (test = tests; test->name != NULL; test++)
-		printf("%-*s %s%s\n", _len, test->name, test->desc,
-		    (test->safe ? "" : " (unsafe)"));
-
-	printf("%-*s Run all safe tests\n", _len, "*");
-}
-
-/** Command for listing and running kernel tests
- *
- * @param argv Argument vector.
- *
- * return Always 1.
- *
- */
-int cmd_test(cmd_arg_t *argv)
-{
-	test_t *test;
-
-	if (str_cmp((char *) argv->buffer, "*") == 0) {
-		for (test = tests; test->name != NULL; test++) {
-			if (test->safe) {
-				printf("\n");
-				if (!run_test(test))
-					break;
-			}
-		}
-	} else if (str_cmp((char *) argv->buffer, "") != 0) {
-		bool fnd = false;
-
-		for (test = tests; test->name != NULL; test++) {
-			if (str_cmp(test->name, (char *) argv->buffer) == 0) {
-				fnd = true;
-				run_test(test);
-				break;
-			}
-		}
-
-		if (!fnd)
-			printf("Unknown test\n");
-	} else
-		list_tests();
-
-	return 1;
-}
-
-/** Command for returning kernel tests as benchmarks
- *
- * @param argv Argument vector.
- *
- * return Always 1.
- */
-int cmd_bench(cmd_arg_t *argv)
-{
-	test_t *test;
-	uint32_t cnt = argv[1].intval;
-
-	if (str_cmp((char *) argv->buffer, "*") == 0) {
-		for (test = tests; test->name != NULL; test++) {
-			if (test->safe) {
-				if (!run_bench(test, cnt))
-					break;
-			}
-		}
-	} else {
-		bool fnd = false;
-
-		for (test = tests; test->name != NULL; test++) {
-			if (str_cmp(test->name, (char *) argv->buffer) == 0) {
-				fnd = true;
-
-				if (test->safe)
-					run_bench(test, cnt);
-				else
-					printf("Unsafe test\n");
-
-				break;
-			}
-		}
-
-		if (!fnd)
-			printf("Unknown test\n");
-	}
-
-	return 1;
-}
-
-int cmd_printbench(cmd_arg_t *argv)
-{
-	int cnt = 20;
-
-	uint64_t *data = malloc(sizeof(uint64_t) * cnt);
-	if (data == NULL) {
-		printf("Error allocating memory for statistics\n");
-		return false;
-	}
-
-	for (int i = 0; i < cnt; i++) {
-		/*
-		 * Update and read thread accounting
-		 * for benchmarking
-		 */
-		irq_spinlock_lock(&TASK->lock, true);
-		uint64_t ucycles0, kcycles0;
-		task_get_accounting(TASK, &ucycles0, &kcycles0);
-		irq_spinlock_unlock(&TASK->lock, true);
-
-		/* Execute the test */
-		for (int j = 0; j < 20; j++) {
-			printf("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ěščřžýáíéú!@#$%%^&*(){}+\n");
-			printf("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ěščřžýáíéú!@#$%%^&*(){}+abcdefghijklmnopqrstuvwxyz\n");
-			printf("0123456789ěščřžýáíéú!@#$%%^&*(){}+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
-		}
-
-		/* Update and read thread accounting */
-		irq_spinlock_lock(&TASK->lock, true);
-		uint64_t ucycles1, kcycles1;
-		task_get_accounting(TASK, &ucycles1, &kcycles1);
-		irq_spinlock_unlock(&TASK->lock, true);
-
-		data[i] = ucycles1 - ucycles0 + kcycles1 - kcycles0;
-	}
-
-	printf("\n");
-
-	uint64_t cycles;
-	char suffix;
-	uint64_t sum = 0;
-
-	for (int i = 0; i < cnt; i++) {
-		sum += data[i];
-	}
-
-	order_suffix(sum / (uint64_t) cnt, &cycles, &suffix);
-	printf("Average\t\t%" PRIu64 "%c\n", cycles, suffix);
-
-	free(data);
-
-	return true;
-}
-
-#endif
-
-/** @}
- */
Index: rnel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,482 +1,0 @@
-/*
- * Copyright (c) 2003 Josef Cejka
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-/** @file
- */
-
-#include <abi/kio.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <errno.h>
-#include <ipc/event.h>
-#include <log.h>
-#include <panic.h>
-#include <preemption.h>
-#include <proc/task.h>
-#include <stdatomic.h>
-#include <stdio.h>
-#include <stdlib.h>  /* malloc */
-#include <str.h>
-#include <synch/mutex.h>
-#include <synch/spinlock.h>
-#include <syscall/copy.h>
-#include <sysinfo/sysinfo.h>
-
-#define KIO_PAGES    8
-#define KIO_LENGTH   (KIO_PAGES * PAGE_SIZE)
-
-/** Kernel log cyclic buffer */
-static char kio[KIO_LENGTH];
-
-/** Kernel log initialized */
-static atomic_bool kio_inited = ATOMIC_VAR_INIT(false);
-
-/** A mutex for preventing interleaving of output lines from different threads.
- * May not be held in some circumstances, so locking of any internal shared
- * structures is still necessary.
- */
-static MUTEX_INITIALIZE(console_mutex, MUTEX_RECURSIVE);
-
-/** Number of characters written to buffer. Periodically overflows. */
-static size_t kio_written = 0;
-
-/** Number of characters written to output devices. Periodically overflows. */
-static size_t kio_processed = 0;
-
-/** Last notification sent to uspace. */
-static size_t kio_notified = 0;
-
-/** Kernel log spinlock */
-IRQ_SPINLOCK_INITIALIZE(kio_lock);
-
-static IRQ_SPINLOCK_INITIALIZE(flush_lock);
-
-static IRQ_SPINLOCK_INITIALIZE(early_mbstate_lock);
-static mbstate_t early_mbstate;
-
-static indev_t stdin_sink;
-static outdev_t stdout_source;
-
-static void stdin_signal(indev_t *, indev_signal_t);
-
-static indev_operations_t stdin_ops = {
-	.poll = NULL,
-	.signal = stdin_signal
-};
-
-static void stdout_write(outdev_t *, const char *, size_t);
-static void stdout_redraw(outdev_t *);
-static void stdout_scroll_up(outdev_t *);
-static void stdout_scroll_down(outdev_t *);
-
-static outdev_operations_t stdout_ops = {
-	.write = stdout_write,
-	.redraw = stdout_redraw,
-	.scroll_up = stdout_scroll_up,
-	.scroll_down = stdout_scroll_down
-};
-
-/** Override kernel console lockout */
-bool console_override = false;
-
-/** Standard input and output character devices */
-indev_t *stdin = NULL;
-outdev_t *stdout = NULL;
-
-indev_t *stdin_wire(void)
-{
-	if (stdin == NULL) {
-		indev_initialize("stdin", &stdin_sink, &stdin_ops);
-		stdin = &stdin_sink;
-	}
-
-	return stdin;
-}
-
-static void stdin_signal(indev_t *indev, indev_signal_t signal)
-{
-	switch (signal) {
-	case INDEV_SIGNAL_SCROLL_UP:
-		if (stdout != NULL)
-			stdout_scroll_up(stdout);
-		break;
-	case INDEV_SIGNAL_SCROLL_DOWN:
-		if (stdout != NULL)
-			stdout_scroll_down(stdout);
-		break;
-	}
-}
-
-void stdout_wire(outdev_t *outdev)
-{
-	if (stdout == NULL) {
-		outdev_initialize("stdout", &stdout_source, &stdout_ops);
-		stdout = &stdout_source;
-	}
-
-	list_append(&outdev->link, &stdout->list);
-}
-
-static void stdout_write(outdev_t *dev, const char *s, size_t n)
-{
-	list_foreach(dev->list, link, outdev_t, sink) {
-		if ((sink) && (sink->op->write))
-			sink->op->write(sink, s, n);
-	}
-}
-
-static void stdout_redraw(outdev_t *dev)
-{
-	list_foreach(dev->list, link, outdev_t, sink) {
-		if ((sink) && (sink->op->redraw))
-			sink->op->redraw(sink);
-	}
-}
-
-static void stdout_scroll_up(outdev_t *dev)
-{
-	list_foreach(dev->list, link, outdev_t, sink) {
-		if ((sink) && (sink->op->scroll_up))
-			sink->op->scroll_up(sink);
-	}
-}
-
-static void stdout_scroll_down(outdev_t *dev)
-{
-	list_foreach(dev->list, link, outdev_t, sink) {
-		if ((sink) && (sink->op->scroll_down))
-			sink->op->scroll_down(sink);
-	}
-}
-
-/** Initialize kernel logging facility
- */
-void kio_init(void)
-{
-	event_set_unmask_callback(EVENT_KIO, kio_update);
-	atomic_store(&kio_inited, true);
-}
-
-void grab_console(void)
-{
-	sysinfo_set_item_val("kconsole", NULL, true);
-	event_notify_1(EVENT_KCONSOLE, false, true);
-	bool prev = console_override;
-
-	console_override = true;
-	if ((stdout) && (stdout->op->redraw))
-		stdout->op->redraw(stdout);
-
-	if ((stdin) && (!prev)) {
-		/*
-		 * Force the console to print the prompt.
-		 */
-		indev_push_character(stdin, '\n');
-	}
-}
-
-void release_console(void)
-{
-	sysinfo_set_item_val("kconsole", NULL, false);
-	console_override = false;
-	event_notify_1(EVENT_KCONSOLE, false, false);
-}
-
-/** Activate kernel console override */
-sysarg_t sys_debug_console(void)
-{
-#ifdef CONFIG_KCONSOLE
-	grab_console();
-	return true;
-#else
-	return false;
-#endif
-}
-
-void kio_update(void *event)
-{
-	if (!atomic_load(&kio_inited))
-		return;
-
-	irq_spinlock_lock(&kio_lock, true);
-
-	if (kio_notified != kio_written) {
-		if (event_notify_1(EVENT_KIO, true, kio_written) == EOK)
-			kio_notified = kio_written;
-	}
-
-	irq_spinlock_unlock(&kio_lock, true);
-}
-
-/** Flush characters that are stored in the output buffer
- *
- */
-void kio_flush(void)
-{
-	bool ordy = ((stdout) && (stdout->op->write));
-
-	if (!ordy)
-		return;
-
-	irq_spinlock_lock(&kio_lock, true);
-
-	if (!irq_spinlock_trylock(&flush_lock)) {
-		/* Someone is currently flushing. */
-		irq_spinlock_unlock(&kio_lock, true);
-		return;
-	}
-
-	/* A small-ish local buffer so that we can write to output in chunks. */
-	char buffer[256];
-
-	/* Print characters that weren't printed earlier */
-	while (kio_written != kio_processed) {
-		size_t offset = kio_processed % KIO_LENGTH;
-		size_t len = min(kio_written - kio_processed, KIO_LENGTH - offset);
-		len = min(len, sizeof(buffer));
-
-		/* Take out a chunk of the big buffer. */
-		memcpy(buffer, &kio[offset], len);
-		kio_processed += len;
-
-		/*
-		 * We need to give up the spinlock for the physical operation of writing
-		 * out the buffer.
-		 */
-		irq_spinlock_unlock(&kio_lock, true);
-		stdout->op->write(stdout, buffer, len);
-		irq_spinlock_lock(&kio_lock, true);
-	}
-
-	irq_spinlock_unlock(&flush_lock, false);
-	irq_spinlock_unlock(&kio_lock, true);
-}
-
-void kio_push_bytes(const char *s, size_t n)
-{
-	/* Skip the section we know we can't keep. */
-	if (n > KIO_LENGTH) {
-		size_t lost = n - KIO_LENGTH;
-		kio_written += lost;
-		s += lost;
-		n -= lost;
-	}
-
-	size_t offset = kio_written % KIO_LENGTH;
-	if (offset + n > KIO_LENGTH) {
-		size_t first = KIO_LENGTH - offset;
-		size_t last = n - first;
-		memcpy(kio + offset, s, first);
-		memcpy(kio, s + first, last);
-	} else {
-		memcpy(kio + offset, s, n);
-	}
-
-	kio_written += n;
-}
-
-static void early_putstr(const char *s, size_t n)
-{
-	irq_spinlock_lock(&early_mbstate_lock, true);
-
-	size_t offset = 0;
-	char32_t c;
-
-	while ((c = str_decode_r(s, &offset, n, U_SPECIAL, &early_mbstate)))
-		early_putuchar(c);
-
-	irq_spinlock_unlock(&early_mbstate_lock, true);
-}
-
-void putstr(const char *s, size_t n)
-{
-	bool ordy = ((stdout) && (stdout->op->write));
-
-	irq_spinlock_lock(&kio_lock, true);
-	kio_push_bytes(s, n);
-	irq_spinlock_unlock(&kio_lock, true);
-
-	/* Output stored characters */
-	kio_flush();
-
-	if (!ordy) {
-		/*
-		 * No standard output routine defined yet.
-		 * The character is still stored in the kernel log
-		 * for possible future output.
-		 *
-		 * The early_putuchar() function is used to output
-		 * the character for low-level debugging purposes.
-		 * Note that the early_putuchar() function might be
-		 * a no-op on certain hardware configurations.
-		 */
-		early_putstr(s, n);
-	}
-
-	/* Force notification when containing a newline */
-	if (memchr(s, '\n', n) != NULL)
-		kio_update(NULL);
-}
-
-/** Reads up to `size` characters from kio buffer starting at character `at`.
- *
- * @param size  Maximum number of characters that can be stored in buffer.
- *              Values greater than KIO_LENGTH are silently treated as KIO_LENGTH
- *              for the purposes of calculating the return value.
- * @return Number of characters read. Can be more than `size`.
- *         In that case, `size` characters are written to user buffer
- *         and the extra amount is the number of characters missed.
- */
-sysarg_t sys_kio_read(uspace_addr_t buf, size_t size, size_t at)
-{
-	errno_t rc;
-	size_t missed = 0;
-
-	irq_spinlock_lock(&kio_lock, true);
-
-	if (at == kio_written) {
-		irq_spinlock_unlock(&kio_lock, true);
-		return 0;
-	}
-
-	size_t readable_chars = kio_written - at;
-	if (readable_chars > KIO_LENGTH) {
-		missed = readable_chars - KIO_LENGTH;
-		readable_chars = KIO_LENGTH;
-	}
-
-	size_t actual_read = min(readable_chars, size);
-	size_t offset = (kio_written - readable_chars) % KIO_LENGTH;
-
-	if (offset + actual_read > KIO_LENGTH) {
-		size_t first = KIO_LENGTH - offset;
-		size_t last = actual_read - first;
-
-		rc = copy_to_uspace(buf, &kio[offset], first);
-		if (rc == EOK)
-			rc = copy_to_uspace(buf + first, &kio[0], last);
-	} else {
-		rc = copy_to_uspace(buf, &kio[offset], actual_read);
-	}
-
-	irq_spinlock_unlock(&kio_lock, true);
-
-	if (rc != EOK) {
-		log(LF_OTHER, LVL_WARN,
-		    "[%s(%" PRIu64 ")] Terminating due to invalid memory buffer"
-		    " in SYS_KIO_READ.\n", TASK->name, TASK->taskid);
-		task_kill_self(true);
-	}
-
-	return actual_read + missed;
-}
-
-/** Print using kernel facility
- *
- * Print to kernel log.
- *
- */
-sys_errno_t sys_kio(int cmd, uspace_addr_t buf, size_t size)
-{
-	char *data;
-	errno_t rc;
-
-	switch (cmd) {
-	case KIO_UPDATE:
-		kio_update(NULL);
-		return EOK;
-	case KIO_WRITE:
-	case KIO_COMMAND:
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	if (size > PAGE_SIZE)
-		return (sys_errno_t) ELIMIT;
-
-	if (size > 0) {
-		data = (char *) malloc(size + 1);
-		if (!data)
-			return (sys_errno_t) ENOMEM;
-
-		rc = copy_from_uspace(data, buf, size);
-		if (rc) {
-			free(data);
-			return (sys_errno_t) rc;
-		}
-		data[size] = 0;
-
-		uint8_t substitute = '\x1a';
-		str_sanitize(data, size, substitute);
-
-		switch (cmd) {
-		case KIO_WRITE:
-			printf("[%s(%lu)] %s\n", TASK->name,
-			    (unsigned long) TASK->taskid, data);
-			break;
-		case KIO_COMMAND:
-			if (!stdin)
-				break;
-			for (unsigned int i = 0; i < size; i++)
-				indev_push_character(stdin, data[i]);
-			indev_push_character(stdin, '\n');
-			break;
-		}
-
-		free(data);
-	}
-
-	return EOK;
-}
-
-/** Lock console output, ensuring that lines from different threads don't
- * interleave. Does nothing when preemption is disabled, so that debugging
- * and error printouts in sensitive areas still work.
- */
-void console_lock(void)
-{
-	if (!PREEMPTION_DISABLED)
-		mutex_lock(&console_mutex);
-}
-
-/** Unlocks console output. See console_lock()
- */
-void console_unlock(void)
-{
-	if (!PREEMPTION_DISABLED)
-		mutex_unlock(&console_mutex);
-}
-
-/** @}
- */
Index: rnel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,859 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-
-/**
- * @file  kconsole.c
- * @brief Kernel console.
- *
- * This file contains kernel thread managing the kernel console.
- *
- */
-
-#include <adt/list.h>
-#include <arch.h>
-#include <assert.h>
-#include <console/chardev.h>
-#include <console/cmd.h>
-#include <console/console.h>
-#include <console/kconsole.h>
-#include <console/prompt.h>
-#include <debug.h>
-#include <errno.h>
-#include <halt.h>
-#include <macros.h>
-#include <panic.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <symtab.h>
-#include <sysinfo/sysinfo.h>
-#include <typedefs.h>
-
-/** Simple kernel console.
- *
- * The console is realized by kernel thread kconsole.
- * It doesn't understand any useful command on its own,
- * but makes it possible for other kernel subsystems to
- * register their own commands.
- */
-
-/** Locking.
- *
- * There is a list of cmd_info_t structures. This list
- * is protected by cmd_lock spinlock. Note that specially
- * the link elements of cmd_info_t are protected by
- * this lock.
- *
- * Each cmd_info_t also has its own lock, which protects
- * all elements thereof except the link element.
- *
- * cmd_lock must be acquired before any cmd_info lock.
- * When locking two cmd info structures, structure with
- * lower address must be locked first.
- */
-
-SPINLOCK_INITIALIZE(cmd_lock);  /**< Lock protecting command list. */
-LIST_INITIALIZE(cmd_list);      /**< Command list. */
-
-#define MAX_SYMBOL_NAME 64
-
-static char32_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = { };
-static size_t history_pos = 0;
-
-/** Initialize kconsole data structures
- *
- * This is the most basic initialization, almost no
- * other kernel subsystem is ready yet.
- *
- */
-void kconsole_init(void)
-{
-	unsigned int i;
-
-	cmd_init();
-	for (i = 0; i < KCONSOLE_HISTORY; i++)
-		history[i][0] = 0;
-}
-
-/** Register kconsole command.
- *
- * @param cmd Structure describing the command.
- *
- * @return False on failure, true on success.
- *
- */
-bool cmd_register(cmd_info_t *cmd)
-{
-	spinlock_lock(&cmd_lock);
-
-	/*
-	 * Make sure the command is not already listed.
-	 */
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		if (hlp == cmd) {
-			/* The command is already there. */
-			spinlock_unlock(&cmd_lock);
-			return false;
-		}
-
-		/* Avoid deadlock. */
-		if (hlp < cmd) {
-			spinlock_lock(&hlp->lock);
-			spinlock_lock(&cmd->lock);
-		} else {
-			spinlock_lock(&cmd->lock);
-			spinlock_lock(&hlp->lock);
-		}
-
-		if (str_cmp(hlp->name, cmd->name) == 0) {
-			/* The command is already there. */
-			spinlock_unlock(&hlp->lock);
-			spinlock_unlock(&cmd->lock);
-			spinlock_unlock(&cmd_lock);
-			return false;
-		}
-
-		spinlock_unlock(&hlp->lock);
-		spinlock_unlock(&cmd->lock);
-	}
-
-	/*
-	 * Now the command can be added.
-	 */
-	list_append(&cmd->link, &cmd_list);
-
-	spinlock_unlock(&cmd_lock);
-	return true;
-}
-
-/** Print count times a character */
-_NO_TRACE static void print_cc(char ch, size_t count)
-{
-	// FIXME: only lock once
-
-	for (size_t i = 0; i < count; i++)
-		putstr(&ch, 1);
-}
-
-/** Try to find a command beginning with prefix */
-const char *cmdtab_enum(const char *name, const char **h, void **ctx)
-{
-	link_t **startpos = (link_t **) ctx;
-	size_t namelen = str_length(name);
-
-	spinlock_lock(&cmd_lock);
-
-	if (*startpos == NULL)
-		*startpos = list_first(&cmd_list);
-
-	for (; *startpos != NULL; *startpos = list_next(*startpos, &cmd_list)) {
-		cmd_info_t *hlp = list_get_instance(*startpos, cmd_info_t, link);
-
-		const char *curname = hlp->name;
-		if (str_length(curname) < namelen)
-			continue;
-
-		if (str_lcmp(curname, name, namelen) == 0) {
-			*startpos = list_next(*startpos, &cmd_list);
-			if (h)
-				*h = hlp->description;
-
-			spinlock_unlock(&cmd_lock);
-			return (curname + str_lsize(curname, namelen));
-		}
-	}
-
-	spinlock_unlock(&cmd_lock);
-	return NULL;
-}
-
-/** Command completion of the commands
- *
- * @param name String to match, changed to hint on exit
- * @param size Input buffer size
- *
- * @return Number of found matches
- *
- */
-_NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev,
-    hints_enum_func_t hints_enum)
-{
-	const char *name = input;
-
-	size_t found = 0;
-
-	/*
-	 * Maximum Match Length: Length of longest matching common
-	 * substring in case more than one match is found.
-	 */
-	size_t max_match_len = size;
-	size_t max_match_len_tmp = size;
-	void *pos = NULL;
-	const char *hint;
-	const char *help;
-	size_t hints_to_show = MAX_TAB_HINTS - 1;
-	size_t total_hints_shown = 0;
-	bool continue_showing_hints = true;
-
-	char *output = malloc(MAX_CMDLINE);
-	if (!output) {
-		// TODO: fix the function so that it does not need allocation
-		printf("Can't complete command, out of memory.\n");
-		return 0;
-	}
-
-	output[0] = 0;
-
-	while ((hint = hints_enum(name, NULL, &pos))) {
-		if ((found == 0) || (str_length(hint) > str_length(output)))
-			str_cpy(output, MAX_CMDLINE, hint);
-
-		found++;
-	}
-
-	/*
-	 * If the number of possible completions is more than MAX_TAB_HINTS,
-	 * ask the user whether to display them or not.
-	 */
-	if (found > MAX_TAB_HINTS) {
-		printf("\n");
-		continue_showing_hints =
-		    console_prompt_display_all_hints(indev, found);
-	}
-
-	if ((found > 1) && (str_length(output) != 0)) {
-		printf("\n");
-		pos = NULL;
-		while ((hint = hints_enum(name, &help, &pos))) {
-
-			if (continue_showing_hints) {
-				if (help)
-					printf("%s%s (%s)\n", name, hint, help);
-				else
-					printf("%s%s\n", name, hint);
-
-				--hints_to_show;
-				++total_hints_shown;
-
-				if ((hints_to_show == 0) && (total_hints_shown != found)) {
-					/* Ask user to continue */
-					continue_showing_hints =
-					    console_prompt_more_hints(indev, &hints_to_show);
-				}
-			}
-
-			max_match_len_tmp = 0;
-			while ((output[max_match_len_tmp] ==
-			    hint[max_match_len_tmp]) &&
-			    (max_match_len_tmp < max_match_len))
-				++max_match_len_tmp;
-
-			max_match_len = max_match_len_tmp;
-		}
-
-		/* Keep only the characters common in all completions */
-		output[max_match_len] = 0;
-	}
-
-	if (found > 0)
-		str_cpy(input, size, output);
-
-	free(output);
-	return found;
-}
-
-_NO_TRACE static cmd_info_t *parse_cmd(const char32_t *cmdline)
-{
-	size_t start = 0;
-	size_t end;
-	char *tmp;
-
-	while (isspace(cmdline[start]))
-		start++;
-
-	end = start + 1;
-
-	while (!isspace(cmdline[end]))
-		end++;
-
-	tmp = malloc(STR_BOUNDS(end - start + 1));
-	if (!tmp)
-		return NULL;
-
-	wstr_to_str(tmp, end - start + 1, &cmdline[start]);
-
-	spinlock_lock(&cmd_lock);
-
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		spinlock_lock(&hlp->lock);
-
-		if (str_cmp(hlp->name, tmp) == 0) {
-			spinlock_unlock(&hlp->lock);
-			spinlock_unlock(&cmd_lock);
-			free(tmp);
-			return hlp;
-		}
-
-		spinlock_unlock(&hlp->lock);
-	}
-
-	free(tmp);
-	spinlock_unlock(&cmd_lock);
-
-	return NULL;
-}
-
-_NO_TRACE static char32_t *clever_readline(const char *prompt, indev_t *indev,
-    char *tmp)
-{
-	printf("%s> ", prompt);
-
-	size_t position = 0;
-	char32_t *current = history[history_pos];
-	current[0] = 0;
-
-	while (true) {
-		char32_t ch = indev_pop_character(indev);
-
-		if (ch == '\n') {
-			/* Enter */
-			putstr("\n", 1);
-			break;
-		}
-
-		if (ch == '\b') {
-			/* Backspace */
-			if (position == 0)
-				continue;
-
-			if (wstr_remove(current, position - 1)) {
-				position--;
-				putstr("\b", 1);
-				printf("%ls ", current + position);
-				print_cc('\b', wstr_length(current) - position + 1);
-				continue;
-			}
-		}
-
-		if (ch == '\t') {
-			/* Tab completion */
-
-			size_t i = position;
-			while (current[i] && !isspace(current[i]))
-				i++;
-
-			char32_t stash = current[i];
-			current[i] = 0;
-			printf("%ls", &current[position]);
-			current[i] = stash;
-			position = i;
-
-			/*
-			 * Find the beginning of the word
-			 * and copy it to tmp
-			 */
-			size_t beg;
-			unsigned narg = 0;
-			if (position == 0) {
-				tmp[0] = '\0';
-				beg = 0;
-			} else {
-				beg = position - 1;
-				while ((beg > 0) && (!isspace(current[beg])))
-					beg--;
-
-				if (isspace(current[beg]))
-					beg++;
-
-				wstr_to_str(tmp, position - beg + 1, current + beg);
-			}
-
-			/* Count which argument number are we tabbing (narg=0 is cmd) */
-			bool sp = false;
-			for (; beg > 0; beg--) {
-				if (isspace(current[beg])) {
-					if (!sp) {
-						narg++;
-						sp = true;
-					}
-				} else
-					sp = false;
-			}
-
-			if (narg && isspace(current[0]))
-				narg--;
-
-			int found;
-			if (narg == 0) {
-				/* Command completion */
-				found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
-				    cmdtab_enum);
-			} else {
-				/* Arguments completion */
-				cmd_info_t *cmd = parse_cmd(current);
-				if (!cmd || !cmd->hints_enum || cmd->argc < narg)
-					continue;
-				found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev,
-				    cmd->hints_enum);
-			}
-
-			if (found == 0)
-				continue;
-
-			/*
-			 * We have hints, possibly many. In case of more than one hint,
-			 * tmp will contain the common prefix.
-			 */
-			size_t off = 0;
-			for (size_t i = 0; (ch = str_decode(tmp, &off, STR_NO_LIMIT)); i++)
-				if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
-					break;
-
-			if (found > 1) {
-				/* No unique hint, list was printed */
-				printf("%s> ", prompt);
-				printf("%ls", current);
-				position += str_length(tmp);
-				print_cc('\b', wstr_length(current) - position);
-				continue;
-			}
-
-			/* We have a hint */
-
-			printf("%ls", current + position);
-			position += str_length(tmp);
-			print_cc('\b', wstr_length(current) - position);
-
-			if (position == wstr_length(current)) {
-				/* Insert a space after the last completed argument */
-				if (wstr_linsert(current, ' ', position, MAX_CMDLINE)) {
-					printf("%ls", current + position);
-					position++;
-				}
-			}
-			continue;
-		}
-
-		if (ch == U_LEFT_ARROW) {
-			/* Left */
-			if (position > 0) {
-				putstr("\b", 1);
-				position--;
-			}
-			continue;
-		}
-
-		if (ch == U_RIGHT_ARROW) {
-			/* Right */
-			if (position < wstr_length(current)) {
-				printf("%lc", current[position]);
-				position++;
-			}
-			continue;
-		}
-
-		if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) {
-			/* Up, down */
-			print_cc('\b', position);
-			print_cc(' ', wstr_length(current));
-			print_cc('\b', wstr_length(current));
-
-			if (ch == U_UP_ARROW) {
-				/* Up */
-				if (history_pos == 0)
-					history_pos = KCONSOLE_HISTORY - 1;
-				else
-					history_pos--;
-			} else {
-				/* Down */
-				history_pos++;
-				history_pos = history_pos % KCONSOLE_HISTORY;
-			}
-			current = history[history_pos];
-			printf("%ls", current);
-			position = wstr_length(current);
-			continue;
-		}
-
-		if (ch == U_HOME_ARROW) {
-			/* Home */
-			print_cc('\b', position);
-			position = 0;
-			continue;
-		}
-
-		if (ch == U_END_ARROW) {
-			/* End */
-			printf("%ls", current + position);
-			position = wstr_length(current);
-			continue;
-		}
-
-		if (ch == U_DELETE) {
-			/* Delete */
-			if (position == wstr_length(current))
-				continue;
-
-			if (wstr_remove(current, position)) {
-				printf("%ls ", current + position);
-				print_cc('\b', wstr_length(current) - position + 1);
-			}
-			continue;
-		}
-
-		if (wstr_linsert(current, ch, position, MAX_CMDLINE)) {
-			printf("%ls", current + position);
-			position++;
-			print_cc('\b', wstr_length(current) - position);
-		}
-	}
-
-	if (wstr_length(current) > 0) {
-		history_pos++;
-		history_pos = history_pos % KCONSOLE_HISTORY;
-	}
-
-	return current;
-}
-
-bool kconsole_check_poll(void)
-{
-	return check_poll(stdin);
-}
-
-_NO_TRACE static bool parse_int_arg(const char *text, size_t len,
-    sysarg_t *result)
-{
-	bool isaddr = false;
-	bool isptr = false;
-
-	/* If we get a name, try to find it in symbol table */
-	if (text[0] == '&') {
-		isaddr = true;
-		text++;
-		len--;
-	} else if (text[0] == '*') {
-		isptr = true;
-		text++;
-		len--;
-	}
-
-	if ((text[0] < '0') || (text[0] > '9')) {
-		char symname[MAX_SYMBOL_NAME];
-		str_ncpy(symname, MAX_SYMBOL_NAME, text, len + 1);
-
-		uintptr_t symaddr;
-		errno_t rc = symtab_addr_lookup(symname, &symaddr);
-		switch (rc) {
-		case ENOENT:
-			printf("Symbol %s not found.\n", symname);
-			return false;
-		case EOVERFLOW:
-			printf("Duplicate symbol %s.\n", symname);
-			symtab_print_search(symname);
-			return false;
-		case ENOTSUP:
-			printf("No symbol information available.\n");
-			return false;
-		case EOK:
-			if (isaddr)
-				*result = (sysarg_t) symaddr;
-			else if (isptr)
-				*result = **((sysarg_t **) symaddr);
-			else
-				*result = *((sysarg_t *) symaddr);
-			break;
-		default:
-			printf("Unknown error.\n");
-			return false;
-		}
-	} else {
-		/* It's a number - convert it */
-		uint64_t value;
-		const char *end;
-		errno_t rc = str_uint64_t(text, &end, 0, false, &value);
-		if (end != text + len)
-			rc = EINVAL;
-		switch (rc) {
-		case EINVAL:
-			printf("Invalid number '%s'.\n", text);
-			return false;
-		case EOVERFLOW:
-			printf("Integer overflow in '%s'.\n", text);
-			return false;
-		case EOK:
-			*result = (sysarg_t) value;
-			if (isptr)
-				*result = *((sysarg_t *) *result);
-			break;
-		default:
-			printf("Unknown error parsing '%s'.\n", text);
-			return false;
-		}
-	}
-
-	return true;
-}
-
-/** Parse argument.
- *
- * Find start and end positions of command line argument.
- *
- * @param cmdline Command line as read from the input device.
- * @param size    Size (in bytes) of the string.
- * @param start   On entry, 'start' contains pointer to the offset
- *                of the first unprocessed character of cmdline.
- *                On successful exit, it marks beginning of the next argument.
- * @param end     Undefined on entry. On exit, 'end' is the offset of the first
- *                character behind the next argument.
- *
- * @return False on failure, true on success.
- *
- */
-_NO_TRACE static bool parse_argument(const char *cmdline, size_t size,
-    size_t *start, size_t *end)
-{
-	assert(start != NULL);
-	assert(end != NULL);
-
-	bool found_start = false;
-	size_t offset = *start;
-	size_t prev = *start;
-	char32_t ch;
-
-	while ((ch = str_decode(cmdline, &offset, size)) != 0) {
-		if (!found_start) {
-			if (!isspace(ch)) {
-				*start = prev;
-				found_start = true;
-			}
-		} else {
-			if (isspace(ch))
-				break;
-		}
-
-		prev = offset;
-	}
-	*end = prev;
-
-	return found_start;
-}
-
-/** Parse command line.
- *
- * @param cmdline Command line as read from input device.
- * @param size    Size (in bytes) of the string.
- *
- * @return Structure describing the command.
- *
- */
-_NO_TRACE static cmd_info_t *parse_cmdline(const char *cmdline, size_t size)
-{
-	size_t start = 0;
-	size_t end = 0;
-	if (!parse_argument(cmdline, size, &start, &end)) {
-		/* Command line did not contain alphanumeric word. */
-		return NULL;
-	}
-	spinlock_lock(&cmd_lock);
-
-	cmd_info_t *cmd = NULL;
-
-	list_foreach(cmd_list, link, cmd_info_t, hlp) {
-		spinlock_lock(&hlp->lock);
-
-		if (str_lcmp(hlp->name, cmdline + start,
-		    max(str_length(hlp->name),
-		    str_nlength(cmdline + start, (size_t) (end - start)))) == 0) {
-			cmd = hlp;
-			break;
-		}
-
-		spinlock_unlock(&hlp->lock);
-	}
-
-	spinlock_unlock(&cmd_lock);
-
-	if (!cmd) {
-		/* Unknown command. */
-		printf("Unknown command.\n");
-		return NULL;
-	}
-
-	/* cmd == hlp is locked */
-
-	/*
-	 * The command line must be further analyzed and
-	 * the parameters therefrom must be matched and
-	 * converted to those specified in the cmd info
-	 * structure.
-	 */
-
-	bool error = false;
-	size_t i;
-	for (i = 0; i < cmd->argc; i++) {
-		char *buf;
-
-		start = end;
-		if (!parse_argument(cmdline, size, &start, &end)) {
-			if (cmd->argv[i].type == ARG_TYPE_STRING_OPTIONAL) {
-				buf = (char *) cmd->argv[i].buffer;
-				str_cpy(buf, cmd->argv[i].len, "");
-				continue;
-			}
-
-			printf("Too few arguments.\n");
-			spinlock_unlock(&cmd->lock);
-			return NULL;
-		}
-
-		switch (cmd->argv[i].type) {
-		case ARG_TYPE_STRING:
-		case ARG_TYPE_STRING_OPTIONAL:
-			buf = (char *) cmd->argv[i].buffer;
-			str_ncpy(buf, cmd->argv[i].len, cmdline + start,
-			    end - start);
-			break;
-		case ARG_TYPE_INT:
-			if (!parse_int_arg(cmdline + start, end - start,
-			    &cmd->argv[i].intval))
-				error = true;
-			break;
-		case ARG_TYPE_VAR:
-			if ((start < end - 1) && (cmdline[start] == '"')) {
-				if (cmdline[end - 1] == '"') {
-					buf = (char *) cmd->argv[i].buffer;
-					str_ncpy(buf, cmd->argv[i].len,
-					    cmdline + start + 1,
-					    (end - start) - 1);
-					cmd->argv[i].intval = (sysarg_t) buf;
-					cmd->argv[i].vartype = ARG_TYPE_STRING;
-				} else {
-					printf("Wrong syntax.\n");
-					error = true;
-				}
-			} else if (parse_int_arg(cmdline + start,
-			    end - start, &cmd->argv[i].intval)) {
-				cmd->argv[i].vartype = ARG_TYPE_INT;
-			} else {
-				printf("Unrecognized variable argument.\n");
-				error = true;
-			}
-			break;
-		case ARG_TYPE_INVALID:
-		default:
-			printf("Invalid argument type\n");
-			error = true;
-			break;
-		}
-	}
-
-	if (error) {
-		spinlock_unlock(&cmd->lock);
-		return NULL;
-	}
-
-	start = end;
-	if (parse_argument(cmdline, size, &start, &end)) {
-		printf("Too many arguments.\n");
-		spinlock_unlock(&cmd->lock);
-		return NULL;
-	}
-
-	spinlock_unlock(&cmd->lock);
-	return cmd;
-}
-
-/** Kernel console prompt.
- *
- * @param prompt Kernel console prompt (e.g kconsole/panic).
- * @param msg    Message to display in the beginning.
- * @param kcon   Wait for keypress to show the prompt
- *               and never exit.
- *
- */
-void kconsole(const char *prompt, const char *msg, bool kcon)
-{
-	if (!stdin) {
-		LOG("No stdin for kernel console");
-		return;
-	}
-
-	if (msg)
-		printf("%s", msg);
-
-	if (kcon)
-		indev_pop_character(stdin);
-	else
-		printf("Type \"exit\" to leave the console.\n");
-
-	char *buffer = malloc(STR_BOUNDS(MAX_CMDLINE));
-	char *cmdline = malloc(STR_BOUNDS(MAX_CMDLINE));
-	if (!buffer || !cmdline) {
-		// TODO: fix the function so that it does not need allocations
-		printf("Can't start console, out of memory.\n");
-		free(buffer);
-		free(cmdline);
-		return;
-	}
-
-	while (true) {
-		char32_t *tmp = clever_readline((char *) prompt, stdin, buffer);
-		size_t len = wstr_length(tmp);
-		if (!len)
-			continue;
-
-		wstr_to_str(cmdline, STR_BOUNDS(MAX_CMDLINE), tmp);
-
-		if ((!kcon) && (len == 4) && (str_lcmp(cmdline, "exit", 4) == 0))
-			break;
-
-		cmd_info_t *cmd_info = parse_cmdline(cmdline, STR_BOUNDS(MAX_CMDLINE));
-		if (!cmd_info)
-			continue;
-
-		(void) cmd_info->func(cmd_info->argv);
-	}
-	free(buffer);
-	free(cmdline);
-}
-
-/** Kernel console managing thread.
- *
- */
-void kconsole_thread(void *data)
-{
-	kconsole("kconsole", "Kernel console ready (press any key to activate)\n", true);
-}
-
-/** @}
- */
Index: rnel/generic/src/console/prompt.c
===================================================================
--- kernel/generic/src/console/prompt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2012 Sandeep Kumar
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_console
- * @{
- */
-
-/**
- * @file
- * @brief Kernel console special prompts.
- */
-
-#include <assert.h>
-#include <console/prompt.h>
-
-/** Display the <i>display all possibilities</i> prompt and wait for answer.
- *
- * @param indev Where to read characters from.
- * @param hints Number of hints that would be displayed.
- *
- * @return Whether to print all hints.
- *
- */
-bool console_prompt_display_all_hints(indev_t *indev, size_t hints)
-{
-	assert(indev);
-	assert(hints > 0);
-
-	printf("Display all %zu possibilities? (y or n) ", hints);
-
-	while (true) {
-		char32_t answer = indev_pop_character(indev);
-
-		if ((answer == 'y') || (answer == 'Y')) {
-			printf("y");
-			return true;
-		}
-
-		if ((answer == 'n') || (answer == 'N')) {
-			printf("n");
-			return false;
-		}
-	}
-}
-
-/** Display the <i>--more--</i> prompt and wait for answer.
- *
- * When the function returns false, @p display_hints is set to zero.
- *
- * @param[in]  indev         Where to read characters from.
- * @param[out] display_hints How many hints to display.
- *
- * @return Whether to display more hints.
- *
- */
-bool console_prompt_more_hints(indev_t *indev, size_t *display_hints)
-{
-	assert(indev);
-	assert(display_hints != NULL);
-
-	printf("--More--");
-	while (true) {
-		char32_t continue_showing_hints = indev_pop_character(indev);
-		/* Display a full page again? */
-		if ((continue_showing_hints == 'y') ||
-		    (continue_showing_hints == 'Y') ||
-		    (continue_showing_hints == ' ')) {
-			*display_hints = MAX_TAB_HINTS - 1;
-			break;
-		}
-
-		/* Stop displaying hints? */
-		if ((continue_showing_hints == 'n') ||
-		    (continue_showing_hints == 'N') ||
-		    (continue_showing_hints == 'q') ||
-		    (continue_showing_hints == 'Q')) {
-			*display_hints = 0;
-			break;
-		}
-
-		/* Show one more hint? */
-		if (continue_showing_hints == '\n') {
-			*display_hints = 1;
-			break;
-		}
-	}
-
-	/* Delete the --More-- option */
-	printf("\r         \r");
-
-	return *display_hints > 0;
-}
-
-/** @}
- */
Index: rnel/generic/src/cpu/cpu.c
===================================================================
--- kernel/generic/src/cpu/cpu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief CPU subsystem initialization and listing.
- */
-
-#include <cpu.h>
-#include <arch.h>
-#include <arch/cpu.h>
-#include <stdlib.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <typedefs.h>
-#include <config.h>
-#include <panic.h>
-#include <memw.h>
-#include <adt/list.h>
-#include <stdio.h>
-#include <sysinfo/sysinfo.h>
-#include <arch/cycle.h>
-
-cpu_t *cpus;
-
-/** Initialize CPUs
- *
- * Initialize kernel CPUs support.
- *
- */
-void cpu_init(void)
-{
-#ifdef CONFIG_SMP
-	if (config.cpu_active == 1) {
-#endif /* CONFIG_SMP */
-
-		cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count);
-		if (!cpus)
-			panic("Cannot allocate CPU structures.");
-
-		/* Initialize everything */
-		memsetb(cpus, sizeof(cpu_t) * config.cpu_count, 0);
-
-		/*
-		 * NOTE: All kernel stacks must be aligned to STACK_SIZE,
-		 *       see CURRENT.
-		 */
-		for (size_t i = 0; i < config.cpu_count; i++) {
-			uintptr_t stack_phys = frame_alloc(STACK_FRAMES,
-			    FRAME_LOWMEM | FRAME_ATOMIC, STACK_SIZE - 1);
-			if (!stack_phys)
-				panic("Cannot allocate CPU stack.");
-
-			cpus[i].local.stack = (uint8_t *) PA2KA(stack_phys);
-			cpus[i].id = i;
-
-#ifdef CONFIG_FPU_LAZY
-			irq_spinlock_initialize(&cpus[i].fpu_lock, "cpus[].fpu_lock");
-#endif
-			irq_spinlock_initialize(&cpus[i].tlb_lock, "cpus[].tlb_lock");
-
-			for (unsigned int j = 0; j < RQ_COUNT; j++) {
-				irq_spinlock_initialize(&cpus[i].rq[j].lock, "cpus[].rq[].lock");
-				list_initialize(&cpus[i].rq[j].rq);
-			}
-		}
-
-#ifdef CONFIG_SMP
-	}
-#endif /* CONFIG_SMP */
-
-	CPU = &cpus[config.cpu_active - 1];
-
-	CPU->active = true;
-	CPU->tlb_active = true;
-
-	CPU_LOCAL->idle = false;
-	CPU_LOCAL->last_cycle = get_cycle();
-	CPU->idle_cycles = ATOMIC_TIME_INITIALIZER();
-	CPU->busy_cycles = ATOMIC_TIME_INITIALIZER();
-
-	cpu_identify();
-	cpu_arch_init();
-}
-
-/** List all processors. */
-void cpu_list(void)
-{
-	unsigned int i;
-
-	for (i = 0; i < config.cpu_count; i++) {
-		if (cpus[i].active)
-			cpu_print_report(&cpus[i]);
-		else
-			printf("cpu%u: not active\n", i);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/cpu/cpu_mask.c
===================================================================
--- kernel/generic/src/cpu/cpu_mask.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief CPU mask manipulation functions.
- */
-#include <assert.h>
-#include <cpu/cpu_mask.h>
-#include <cpu.h>
-#include <config.h>
-
-static const size_t word_size = sizeof(unsigned int);
-static const size_t word_bit_cnt = 8 * sizeof(unsigned int);
-
-/** Returns the size of cpu_mask_t for the detected number of cpus in bytes. */
-size_t cpu_mask_size(void)
-{
-	size_t word_cnt = (config.cpu_count + word_bit_cnt - 1) / word_bit_cnt;
-	return word_cnt * word_size;
-}
-
-/** Add first cpu_cnt cpus to the mask, ie sets the first cpu_cnt bits. */
-static void cpu_mask_count(cpu_mask_t *cpus, size_t cpu_cnt)
-{
-	assert(NULL != cpus);
-	assert(cpu_cnt <= config.cpu_count);
-
-	for (size_t active_word = 0;
-	    (active_word + 1) * word_bit_cnt <= cpu_cnt;
-	    ++active_word) {
-		/* Set all bits in the cell/word. */
-		cpus->mask[active_word] = -1;
-	}
-
-	size_t remaining_bits = (cpu_cnt % word_bit_cnt);
-	if (0 < remaining_bits) {
-		/* Set lower remaining_bits of the last word. */
-		cpus->mask[cpu_cnt / word_bit_cnt] = (1 << remaining_bits) - 1;
-	}
-}
-
-/** Sets bits corresponding to the active cpus, ie the first
- * config.cpu_active cpus.
- */
-void cpu_mask_active(cpu_mask_t *cpus)
-{
-	cpu_mask_none(cpus);
-	cpu_mask_count(cpus, config.cpu_active);
-}
-
-/** Sets bits for all cpus of the mask. */
-void cpu_mask_all(cpu_mask_t *cpus)
-{
-	cpu_mask_count(cpus, config.cpu_count);
-}
-
-/** Resets/removes all bits. */
-void cpu_mask_none(cpu_mask_t *cpus)
-{
-	assert(cpus);
-
-	size_t word_cnt = cpu_mask_size() / word_size;
-
-	for (size_t word = 0; word < word_cnt; ++word) {
-		cpus->mask[word] = 0;
-	}
-}
-
-/** Sets the bit corresponding to cpu_id to true. */
-void cpu_mask_set(cpu_mask_t *cpus, unsigned int cpu_id)
-{
-	size_t word = cpu_id / word_bit_cnt;
-	size_t word_pos = cpu_id % word_bit_cnt;
-
-	cpus->mask[word] |= (1U << word_pos);
-}
-
-/** Resets the bit corresponding to cpu_id to false. */
-void cpu_mask_reset(cpu_mask_t *cpus, unsigned int cpu_id)
-{
-	size_t word = cpu_id / word_bit_cnt;
-	size_t word_pos = cpu_id % word_bit_cnt;
-
-	cpus->mask[word] &= ~(1U << word_pos);
-}
-
-/** Returns true if the bit corresponding to cpu_id is set. */
-bool cpu_mask_is_set(cpu_mask_t *cpus, unsigned int cpu_id)
-{
-	size_t word = cpu_id / word_bit_cnt;
-	size_t word_pos = cpu_id % word_bit_cnt;
-
-	return 0 != (cpus->mask[word] & (1U << word_pos));
-}
-
-/** Returns true if no bits are set. */
-bool cpu_mask_is_none(cpu_mask_t *cpus)
-{
-	size_t word_cnt = cpu_mask_size() / word_size;
-
-	for (size_t word = 0; word < word_cnt; ++word) {
-		if (cpus->mask[word])
-			return false;
-	}
-
-	return true;
-}
-
-/** @}
- */
Index: rnel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ddi
- * @{
- */
-
-/**
- * @file
- * @brief Device Driver Interface functions.
- *
- * This file contains functions that comprise the Device Driver Interface.
- * These are the functions for mapping physical memory and enabling I/O
- * space to tasks.
- */
-
-#include <assert.h>
-#include <ddi/ddi.h>
-#include <proc/task.h>
-#include <security/perm.h>
-#include <mm/frame.h>
-#include <mm/as.h>
-#include <mm/km.h>
-#include <mm/page.h>
-#include <synch/mutex.h>
-#include <syscall/copy.h>
-#include <adt/odict.h>
-#include <arch.h>
-#include <align.h>
-#include <errno.h>
-#include <memw.h>
-#include <trace.h>
-#include <bitops.h>
-#include <arch/asm.h>
-
-/** This lock protects the @c pareas ordered dictionary. */
-static MUTEX_INITIALIZE(pareas_lock, MUTEX_PASSIVE);
-
-/** Ordered dictionary of enabled physical memory areas by base address. */
-static odict_t pareas;
-
-static void *pareas_getkey(odlink_t *);
-static int pareas_cmp(void *, void *);
-
-/** Initialize DDI.
- *
- */
-void ddi_init(void)
-{
-	odict_initialize(&pareas, pareas_getkey, pareas_cmp);
-}
-
-/** Initialize physical area structure.
- *
- * This should always be called first on the parea structure before
- * filling in fields and calling ddi_parea_register.
- *
- * @param parea Pointer to physical area structure.
- *
- */
-void ddi_parea_init(parea_t *parea)
-{
-	memset(parea, 0, sizeof(parea_t));
-}
-
-/** Enable piece of physical memory for mapping by physmem_map().
- *
- * @param parea Pointer to physical area structure.
- *
- */
-void ddi_parea_register(parea_t *parea)
-{
-	mutex_lock(&pareas_lock);
-
-	/*
-	 * We don't check for overlaps here as the kernel is pretty sane.
-	 */
-	odict_insert(&parea->lpareas, &pareas, NULL);
-
-	mutex_unlock(&pareas_lock);
-}
-
-/** Norify physical area has been unmapped.
- *
- * @param parea Physical area
- */
-void ddi_parea_unmap_notify(parea_t *parea)
-{
-	parea->mapped = false;
-	if (parea->mapped_changed != NULL)
-		parea->mapped_changed(parea->arg);
-}
-
-/** Map piece of physical memory into virtual address space of current task.
- *
- * @param phys  Physical address of the starting frame.
- * @param pages Number of pages to map.
- * @param flags Address space area flags for the mapping.
- * @param virt  Virtual address of the starting page.
- * @param bound Lowest virtual address bound.
- *
- * @return EOK on success.
- * @return EPERM if the caller lacks permissions to use this syscall.
- * @return EBADMEM if phys is not page aligned.
- * @return ENOENT if there is no task matching the specified ID or
- *         the physical address space is not enabled for mapping.
- * @return ENOMEM if there was a problem in creating address space area.
- *
- */
-_NO_TRACE static errno_t physmem_map(uintptr_t phys, size_t pages,
-    unsigned int flags, uintptr_t *virt, uintptr_t bound)
-{
-	assert(TASK);
-
-	if ((phys % FRAME_SIZE) != 0)
-		return EBADMEM;
-
-	/*
-	 * Unprivileged tasks are only allowed to map pareas
-	 * which are explicitly marked as such.
-	 */
-	bool priv =
-	    ((perm_get(TASK) & PERM_MEM_MANAGER) == PERM_MEM_MANAGER);
-
-	mem_backend_data_t backend_data;
-	backend_data.base = phys;
-	backend_data.frames = pages;
-	backend_data.anonymous = false;
-
-	/*
-	 * Check if the memory region is explicitly enabled
-	 * for mapping by any parea structure.
-	 */
-
-	mutex_lock(&pareas_lock);
-	odlink_t *odlink = odict_find_eq(&pareas, &phys, NULL);
-	parea_t *parea = odlink != NULL ?
-	    odict_get_instance(odlink, parea_t, lpareas) : NULL;
-
-	if ((parea != NULL) && (parea->frames >= pages)) {
-		if ((!priv) && (!parea->unpriv)) {
-			mutex_unlock(&pareas_lock);
-			return EPERM;
-		}
-
-		goto map;
-	}
-
-	parea = NULL;
-	mutex_unlock(&pareas_lock);
-
-	/*
-	 * Check if the memory region is part of physical
-	 * memory generally enabled for mapping.
-	 */
-
-	irq_spinlock_lock(&zones.lock, true);
-	size_t znum = find_zone(ADDR2PFN(phys), pages, 0);
-
-	if (znum == (size_t) -1) {
-		/*
-		 * Frames not found in any zone
-		 * -> assume it is a hardware device and allow mapping
-		 *    for privileged tasks.
-		 */
-		irq_spinlock_unlock(&zones.lock, true);
-
-		if (!priv)
-			return EPERM;
-
-		goto map;
-	}
-
-	if (zones.info[znum].flags & (ZONE_FIRMWARE | ZONE_RESERVED)) {
-		/*
-		 * Frames are part of firmware or reserved zone
-		 * -> allow mapping for privileged tasks.
-		 */
-		irq_spinlock_unlock(&zones.lock, true);
-
-		if (!priv)
-			return EPERM;
-
-		goto map;
-	}
-
-	irq_spinlock_unlock(&zones.lock, true);
-	return ENOENT;
-
-map:
-	backend_data.parea = parea;
-
-	if (!as_area_create(TASK->as, flags, FRAMES2SIZE(pages),
-	    AS_AREA_ATTR_NONE, &phys_backend, &backend_data, virt, bound)) {
-		/*
-		 * The address space area was not created.
-		 * We report it using ENOMEM.
-		 */
-
-		if (parea != NULL)
-			mutex_unlock(&pareas_lock);
-
-		return ENOMEM;
-	}
-
-	/*
-	 * Mapping is created on-demand during page fault.
-	 */
-
-	if (parea != NULL) {
-		parea->mapped = true;
-		mutex_unlock(&pareas_lock);
-	}
-
-	return EOK;
-}
-
-_NO_TRACE static errno_t physmem_unmap(uintptr_t virt)
-{
-	assert(TASK);
-
-	return as_area_destroy(TASK->as, virt);
-}
-
-/** Wrapper for SYS_PHYSMEM_MAP syscall.
- *
- * @param phys     Physical base address to map
- * @param pages    Number of pages
- * @param flags    Flags of newly mapped pages
- * @param virt_ptr Destination virtual address
- * @param bound    Lowest virtual address bound.
- *
- * @return 0 on success, otherwise it returns error code found in errno.h
- *
- */
-sys_errno_t sys_physmem_map(uintptr_t phys, size_t pages, unsigned int flags,
-    uspace_ptr_uintptr_t virt_ptr, uintptr_t bound)
-{
-	uintptr_t virt;
-	errno_t rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt));
-	if (rc != EOK)
-		return rc;
-
-	rc = physmem_map(ALIGN_DOWN(phys, FRAME_SIZE), pages, flags, &virt,
-	    bound);
-	if (rc != EOK)
-		return rc;
-
-	rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt));
-	if (rc != EOK) {
-		physmem_unmap(virt);
-		return rc;
-	}
-
-	return EOK;
-}
-
-sys_errno_t sys_physmem_unmap(uintptr_t virt)
-{
-	return physmem_unmap(virt);
-}
-
-/** Get key function for the @c pareas ordered dictionary.
- *
- * @param odlink Link
- * @return Pointer to base address cast as 'void *'
- */
-static void *pareas_getkey(odlink_t *odlink)
-{
-	parea_t *parea = odict_get_instance(odlink, parea_t, lpareas);
-	return (void *) &parea->pbase;
-}
-
-/** Key comparison function for the @c pareas ordered dictionary.
- *
- * @param a Pointer to parea A base
- * @param b Pointer to parea B base
- * @return -1, 0, 1 iff base of A is less than, equal to, greater than B
- */
-static int pareas_cmp(void *a, void *b)
-{
-	uintptr_t pa = *(uintptr_t *)a;
-	uintptr_t pb = *(uintptr_t *)b;
-
-	if (pa < pb)
-		return -1;
-	else if (pa == pb)
-		return 0;
-	else
-		return +1;
-}
-
-/** Enable range of I/O space for task.
- *
- * @param id     Task ID of the destination task.
- * @param ioaddr Starting I/O address.
- * @param size   Size of the enabled I/O space.
- *
- * @return 0 on success, EPERM if the caller lacks permissions to use this
- *           syscall, ENOENT if there is no task matching the specified ID.
- *
- */
-_NO_TRACE static errno_t iospace_enable(task_id_t id, uintptr_t ioaddr, size_t size)
-{
-	/*
-	 * Make sure the caller is authorised to make this syscall.
-	 */
-	perm_t perms = perm_get(TASK);
-	if (!(perms & PERM_IO_MANAGER))
-		return EPERM;
-
-	task_t *task = task_find_by_id(id);
-
-	if (!task)
-		return ENOENT;
-
-	errno_t rc = ENOENT;
-
-	irq_spinlock_lock(&task->lock, true);
-
-	/* Check that the task belongs to the correct security context. */
-	if (container_check(CONTAINER, task->container))
-		rc = ddi_iospace_enable_arch(task, ioaddr, size);
-
-	irq_spinlock_unlock(&task->lock, true);
-	task_release(task);
-	return rc;
-}
-
-/** Disable range of I/O space for task.
- *
- * @param id     Task ID of the destination task.
- * @param ioaddr Starting I/O address.
- * @param size   Size of the enabled I/O space.
- *
- * @return 0 on success, EPERM if the caller lacks permissions to use this
- *           syscall, ENOENT if there is no task matching the specified ID.
- *
- */
-_NO_TRACE static errno_t iospace_disable(task_id_t id, uintptr_t ioaddr, size_t size)
-{
-	/*
-	 * Make sure the caller is authorised to make this syscall.
-	 */
-	perm_t perms = perm_get(TASK);
-	if (!(perms & PERM_IO_MANAGER))
-		return EPERM;
-
-	task_t *task = task_find_by_id(id);
-
-	if (!task)
-		return ENOENT;
-
-	errno_t rc = ENOENT;
-
-	irq_spinlock_lock(&task->lock, true);
-
-	/* Check that the task belongs to the correct security context. */
-	if (container_check(CONTAINER, task->container))
-		rc = ddi_iospace_disable_arch(task, ioaddr, size);
-
-	irq_spinlock_unlock(&task->lock, true);
-	task_release(task);
-	return rc;
-}
-
-/** Wrapper for SYS_ENABLE_IOSPACE syscall.
- *
- * @param uspace_io_arg User space address of DDI argument structure.
- *
- * @return 0 on success, otherwise it returns error code found in errno.h
- *
- */
-sys_errno_t sys_iospace_enable(uspace_ptr_ddi_ioarg_t uspace_io_arg)
-{
-	ddi_ioarg_t arg;
-	errno_t rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return (sys_errno_t) iospace_enable((task_id_t) arg.task_id,
-	    (uintptr_t) arg.ioaddr, (size_t) arg.size);
-}
-
-sys_errno_t sys_iospace_disable(uspace_ptr_ddi_ioarg_t uspace_io_arg)
-{
-	ddi_ioarg_t arg;
-	errno_t rc = copy_from_uspace(&arg, uspace_io_arg, sizeof(ddi_ioarg_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return (sys_errno_t) iospace_disable((task_id_t) arg.task_id,
-	    (uintptr_t) arg.ioaddr, (size_t) arg.size);
-}
-
-_NO_TRACE static errno_t dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags,
-    unsigned int flags, uintptr_t *phys)
-{
-	assert(TASK);
-
-	// TODO: implement locking of non-anonymous mapping
-	return page_find_mapping(virt, phys);
-}
-
-_NO_TRACE static errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
-    unsigned int map_flags, unsigned int flags, uintptr_t *phys,
-    uintptr_t *virt, uintptr_t bound)
-{
-	assert(TASK);
-
-	size_t frames = SIZE2FRAMES(size);
-	if (frames == 0)
-		return EINVAL;
-
-	// FIXME: probably need to ensure that the memory is suitable for DMA
-	*phys = frame_alloc(frames, FRAME_ATOMIC, constraint);
-	if (*phys == 0)
-		return ENOMEM;
-
-	mem_backend_data_t backend_data;
-	backend_data.base = *phys;
-	backend_data.frames = frames;
-	backend_data.anonymous = true;
-	backend_data.parea = NULL;
-
-	if (!as_area_create(TASK->as, map_flags, size,
-	    AS_AREA_ATTR_NONE, &phys_backend, &backend_data, virt, bound)) {
-		frame_free(*phys, frames);
-		return ENOMEM;
-	}
-
-	return EOK;
-}
-
-_NO_TRACE static errno_t dmamem_unmap(uintptr_t virt, size_t size)
-{
-	// TODO: implement unlocking & unmap
-	return EOK;
-}
-
-_NO_TRACE static errno_t dmamem_unmap_anonymous(uintptr_t virt)
-{
-	return as_area_destroy(TASK->as, virt);
-}
-
-sys_errno_t sys_dmamem_map(size_t size, unsigned int map_flags, unsigned int flags,
-    uspace_ptr_uintptr_t phys_ptr, uspace_ptr_uintptr_t virt_ptr, uintptr_t bound)
-{
-	if ((flags & DMAMEM_FLAGS_ANONYMOUS) == 0) {
-		/*
-		 * Non-anonymous DMA mapping
-		 */
-
-		uintptr_t phys;
-		errno_t rc = dmamem_map(virt_ptr, size, map_flags,
-		    flags, &phys);
-
-		if (rc != EOK)
-			return rc;
-
-		rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
-		if (rc != EOK) {
-			dmamem_unmap(virt_ptr, size);
-			return rc;
-		}
-	} else {
-		/*
-		 * Anonymous DMA mapping
-		 */
-
-		uintptr_t constraint;
-		errno_t rc = copy_from_uspace(&constraint, phys_ptr,
-		    sizeof(constraint));
-		if (rc != EOK)
-			return rc;
-
-		uintptr_t virt;
-		rc = copy_from_uspace(&virt, virt_ptr, sizeof(virt));
-		if (rc != EOK)
-			return rc;
-
-		uintptr_t phys;
-		rc = dmamem_map_anonymous(size, constraint, map_flags, flags,
-		    &phys, &virt, bound);
-		if (rc != EOK)
-			return rc;
-
-		rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
-		if (rc != EOK) {
-			dmamem_unmap_anonymous(virt);
-			return rc;
-		}
-
-		rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt));
-		if (rc != EOK) {
-			dmamem_unmap_anonymous(virt);
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-sys_errno_t sys_dmamem_unmap(uintptr_t virt, size_t size, unsigned int flags)
-{
-	if ((flags & DMAMEM_FLAGS_ANONYMOUS) == 0)
-		return dmamem_unmap(virt, size);
-	else
-		return dmamem_unmap_anonymous(virt);
-}
-void *pio_map(void *phys, size_t size)
-{
-#ifdef IO_SPACE_BOUNDARY
-	if (phys < IO_SPACE_BOUNDARY)
-		return phys;
-#endif
-	return (void *) km_map((uintptr_t) phys, size, KM_NATURAL_ALIGNMENT,
-	    PAGE_READ | PAGE_WRITE | PAGE_NOT_CACHEABLE);
-}
-
-void pio_unmap(void *phys, void *virt, size_t size)
-{
-#ifdef IO_SPACE_BOUNDARY
-	if (phys < IO_SPACE_BOUNDARY)
-		return;
-#endif
-	km_unmap((uintptr_t) virt, size);
-}
-
-/** @}
- */
Index: rnel/generic/src/ddi/irq.c
===================================================================
--- kernel/generic/src/ddi/irq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ddi
- * @{
- */
-/**
- * @file
- * @brief IRQ dispatcher
- *
- * This file provides means of connecting IRQs with respective device drivers
- * and logic for dispatching interrupts to IRQ handlers defined by those
- * drivers.
- */
-
-#include <ddi/irq.h>
-#include <adt/hash.h>
-#include <adt/hash_table.h>
-#include <mm/slab.h>
-#include <typedefs.h>
-#include <synch/spinlock.h>
-#include <console/console.h>
-#include <interrupt.h>
-#include <memw.h>
-#include <arch.h>
-
-slab_cache_t *irq_cache = NULL;
-
-/** Spinlock protecting the kernel IRQ hash table
- *
- * This lock must be taken only when interrupts are disabled.
- *
- */
-IRQ_SPINLOCK_STATIC_INITIALIZE(irq_kernel_hash_table_lock);
-
-/** The kernel IRQ hash table. */
-static hash_table_t irq_kernel_hash_table;
-
-/** Spinlock protecting the uspace IRQ hash table
- *
- * This lock must be taken only when interrupts are disabled.
- *
- */
-IRQ_SPINLOCK_INITIALIZE(irq_uspace_hash_table_lock);
-
-/** The uspace IRQ hash table */
-hash_table_t irq_uspace_hash_table;
-
-static size_t irq_ht_hash(const ht_link_t *);
-static size_t irq_ht_key_hash(const void *);
-static bool irq_ht_equal(const ht_link_t *, const ht_link_t *);
-static bool irq_ht_key_equal(const void *, size_t, const ht_link_t *);
-
-static const hash_table_ops_t irq_ht_ops = {
-	.hash = irq_ht_hash,
-	.key_hash = irq_ht_key_hash,
-	.equal = irq_ht_equal,
-	.key_equal = irq_ht_key_equal
-};
-
-/** Last valid INR */
-inr_t last_inr = 0;
-
-/** Initialize IRQ subsystem
- *
- * @param inrs    Numbers of unique IRQ numbers or INRs.
- * @param chains  Number of buckets in the hash table.
- *
- */
-void irq_init(size_t inrs, size_t chains)
-{
-	last_inr = inrs - 1;
-
-	irq_cache = slab_cache_create("irq_t", sizeof(irq_t), 0, NULL, NULL,
-	    FRAME_ATOMIC);
-	assert(irq_cache);
-
-	hash_table_create(&irq_uspace_hash_table, chains, 0, &irq_ht_ops);
-	hash_table_create(&irq_kernel_hash_table, chains, 0, &irq_ht_ops);
-}
-
-/** Initialize one IRQ structure
- *
- * @param irq  Pointer to the IRQ structure to be initialized.
- *
- */
-void irq_initialize(irq_t *irq)
-{
-	memsetb(irq, sizeof(irq_t), 0);
-	irq_spinlock_initialize(&irq->lock, "irq.lock");
-	irq->inr = -1;
-
-	irq_initialize_arch(irq);
-}
-
-/** Register IRQ for device
- *
- * The irq structure must be filled with information about the interrupt source
- * and with the claim() function pointer and handler() function pointer.
- *
- * @param irq  IRQ structure belonging to a device.
- *
- */
-void irq_register(irq_t *irq)
-{
-	irq_spinlock_lock(&irq_kernel_hash_table_lock, true);
-	irq_spinlock_lock(&irq->lock, false);
-	hash_table_insert(&irq_kernel_hash_table, &irq->link);
-	irq_spinlock_unlock(&irq->lock, false);
-	irq_spinlock_unlock(&irq_kernel_hash_table_lock, true);
-}
-
-/** Search and lock an IRQ hash table */
-static irq_t *
-irq_dispatch_and_lock_table(hash_table_t *h, irq_spinlock_t *l, inr_t inr)
-{
-	irq_spinlock_lock(l, false);
-
-	hash_table_foreach(h, &inr, link, irq_t, irq) {
-		irq_spinlock_lock(&irq->lock, false);
-		if (irq->claim(irq) == IRQ_ACCEPT) {
-			/* leave irq locked */
-			irq_spinlock_unlock(l, false);
-			return irq;
-		}
-		irq_spinlock_unlock(&irq->lock, false);
-	}
-
-	irq_spinlock_unlock(l, false);
-
-	return NULL;
-}
-
-/** Dispatch the IRQ
- *
- * We assume this function is only called from interrupt context (i.e. that
- * interrupts are disabled prior to this call).
- *
- * This function attempts to lookup a fitting IRQ structure. In case of success,
- * return with interrupts disabled and holding the respective structure.
- *
- * @param inr  Interrupt number (aka inr or irq).
- *
- * @return IRQ structure of the respective device
- * @return NULL if no IRQ structure found
- *
- */
-irq_t *irq_dispatch_and_lock(inr_t inr)
-{
-	/*
-	 * If the kernel console override is on, then try first the kernel
-	 * handlers and eventually fall back to uspace handlers.
-	 *
-	 * In the usual case the uspace handlers have precedence.
-	 */
-
-	if (console_override) {
-		irq_t *irq = irq_dispatch_and_lock_table(&irq_kernel_hash_table,
-		    &irq_kernel_hash_table_lock, inr);
-		if (irq)
-			return irq;
-
-		return irq_dispatch_and_lock_table(&irq_uspace_hash_table,
-		    &irq_uspace_hash_table_lock, inr);
-	}
-
-	irq_t *irq = irq_dispatch_and_lock_table(&irq_uspace_hash_table,
-	    &irq_uspace_hash_table_lock, inr);
-	if (irq)
-		return irq;
-
-	return irq_dispatch_and_lock_table(&irq_kernel_hash_table,
-	    &irq_kernel_hash_table_lock, inr);
-}
-
-/** Return the hash of the key stored in the item. */
-size_t irq_ht_hash(const ht_link_t *item)
-{
-	irq_t *irq = hash_table_get_inst(item, irq_t, link);
-	return hash_mix(irq->inr);
-}
-
-/** Return the hash of the key. */
-size_t irq_ht_key_hash(const void *key)
-{
-	const inr_t *inr = key;
-	return hash_mix(*inr);
-}
-
-/** Return true if the items have the same lookup key. */
-bool irq_ht_equal(const ht_link_t *item1, const ht_link_t *item2)
-{
-	irq_t *irq1 = hash_table_get_inst(item1, irq_t, link);
-	irq_t *irq2 = hash_table_get_inst(item2, irq_t, link);
-	return irq1->inr == irq2->inr;
-}
-
-/** Return true if the key is equal to the item's lookup key. */
-bool irq_ht_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const inr_t *inr = key;
-	irq_t *irq = hash_table_get_inst(item, irq_t, link);
-	return irq->inr == *inr;
-}
-
-/** @}
- */
Index: rnel/generic/src/debug/line.c
===================================================================
--- kernel/generic/src/debug/line.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,739 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdatomic.h>
-
-#include <stdlib.h>
-
-#include <debug/constants.h>
-#include <debug/line.h>
-#include <debug/names.h>
-#include <debug/sections.h>
-
-#include "util.h"
-
-static inline void line_program_reset(struct debug_line_program *lp)
-{
-	lp->address = 0;
-	lp->op_advance = 0;
-	lp->file = 1;
-	lp->line = 1;
-	lp->column = 0;
-	lp->end_sequence = false;
-}
-
-/**
- * Quickly advance program just past the next sequence end, without processing
- * anything on the way. This is useful for when we just want to get start
- * addresses of every range to build a table.
- *
- * @param lp
- */
-static void debug_line_program_skip_to_sequence_end(struct debug_line_program *lp)
-{
-	const uint8_t opcode_base = lp->hdr->opcode_base;
-
-	const uint8_t *program = lp->program;
-	const uint8_t *const program_end = lp->program_end;
-
-	if (lp->end_sequence)
-		line_program_reset(lp);
-
-	while (program < program_end) {
-		uint8_t opcode = read_byte(&program, program_end);
-
-		if (opcode >= opcode_base) {
-			// Special opcode.
-			continue;
-		}
-
-		switch (opcode) {
-		case DW_LNS_fixed_advance_pc:
-			safe_increment(&program, program_end, 2);
-			break;
-
-		case DW_LNS_copy:
-		case DW_LNS_negate_stmt:
-		case DW_LNS_set_basic_block:
-		case DW_LNS_set_prologue_end:
-		case DW_LNS_set_epilogue_begin:
-		case DW_LNS_const_add_pc:
-			break;
-
-		case DW_LNS_advance_pc:
-		case DW_LNS_advance_line:
-		case DW_LNS_set_file:
-		case DW_LNS_set_column:
-		case DW_LNS_set_isa:
-			skip_leb128(&program, program_end);
-			break;
-
-		case 0:
-			// Extended opcodes.
-			size_t length = read_uleb128(&program, program_end);
-
-			if (read_byte(&program, program_end) == DW_LNE_end_sequence) {
-				lp->program = program;
-				lp->end_sequence = true;
-				return;
-			}
-
-			safe_increment(&program, program_end, length - 1);
-			break;
-
-		default:
-			// Unknown standard opcode.
-
-			// If the opcode length array is truncated, there is already
-			// something wrong with the parse, so we don't care if we misparse
-			// the remainder.
-			if (opcode < lp->hdr->standard_opcode_lengths_size) {
-				int len = lp->hdr->standard_opcode_lengths[opcode];
-				for (int i = 0; i < len; i++) {
-					// Drop arguments.
-					skip_leb128(&program, program_end);
-				}
-			}
-		}
-	}
-
-	lp->program = program;
-	lp->truncated = true;
-}
-
-static void transfer_op_advance(struct debug_line_program *lp)
-{
-	if (lp->hdr->version < 5) {
-		lp->address += lp->op_advance * lp->hdr->minimum_instruction_length;
-		lp->op_advance = 0;
-	} else {
-		int maxops = lp->hdr->v5.maximum_operations_per_instruction;
-
-		// For branch prediction, tell GCC maxops is likely to be 1, because
-		// I don't want to punish sensible architectures for VLIW madness.
-		if (__builtin_expect(maxops == 1, 1)) {
-			lp->address += lp->op_advance * lp->hdr->minimum_instruction_length;
-			lp->op_advance = 0;
-		} else {
-			int adv = lp->op_advance;
-			int d = adv / maxops;
-			int r = adv % maxops;
-
-			lp->address += d * lp->hdr->minimum_instruction_length;
-			lp->op_advance = r;
-		}
-	}
-}
-
-static void debug_line_program_advance(struct debug_line_program *lp)
-{
-	const uint8_t opcode_base = lp->hdr->opcode_base;
-	const int8_t line_base = lp->hdr->line_base;
-	const uint8_t line_range = lp->hdr->line_range;
-	const int const_advance = (255 - opcode_base) / lp->hdr->line_range;
-
-	const uint8_t *program = lp->program;
-	const uint8_t *const program_end = lp->program_end;
-
-	if (lp->end_sequence)
-		line_program_reset(lp);
-
-	while (program < program_end) {
-		uint8_t opcode = read_byte(&program, program_end);
-
-		if (opcode >= opcode_base) {
-			// Special opcode.
-			int adjusted = opcode - opcode_base;
-			DEBUGF("DW_LNS_special(%d)\n", adjusted);
-
-			lp->op_advance += adjusted / line_range;
-			lp->line += line_base + (adjusted % line_range);
-
-			transfer_op_advance(lp);
-			lp->program = program;
-			return;
-		}
-
-		const char *opname = dw_lns_name(opcode);
-
-		uint64_t arg;
-		uint16_t arg16;
-
-		switch (opcode) {
-		case DW_LNS_copy:
-			DEBUGF("%s()\n", opname);
-
-			transfer_op_advance(lp);
-			lp->program = program;
-			return;
-
-		case DW_LNS_advance_pc:
-			arg = read_uleb128(&program, program_end);
-			DEBUGF("%s(%" PRIu64 ")\n", opname, arg);
-			lp->op_advance += arg;
-			break;
-
-		case DW_LNS_advance_line:
-			lp->line += read_sleb128(&program, program_end);
-			DEBUGF("%s(line = %d)\n", opname, lp->line);
-			break;
-
-		case DW_LNS_set_file:
-			lp->file = read_uleb128(&program, program_end);
-			DEBUGF("%s(%d)\n", opname, lp->file);
-			break;
-
-		case DW_LNS_set_column:
-			lp->column = read_uleb128(&program, program_end);
-			DEBUGF("%s(%d)\n", opname, lp->column);
-			break;
-
-		case DW_LNS_negate_stmt:
-		case DW_LNS_set_basic_block:
-		case DW_LNS_set_prologue_end:
-		case DW_LNS_set_epilogue_begin:
-			DEBUGF("%s()\n", opname);
-			// ignore
-			break;
-
-		case DW_LNS_set_isa:
-			// discard argument and ignore
-			arg = read_uleb128(&program, program_end);
-			DEBUGF("%s(%" PRIu64 ")\n", opname, arg);
-			break;
-
-		case DW_LNS_const_add_pc:
-			DEBUGF("%s(%d)\n", opname, const_advance);
-			lp->op_advance += const_advance;
-			break;
-
-		case DW_LNS_fixed_advance_pc:
-			arg16 = read_uint16(&program, program_end);
-			DEBUGF("%s(%u)\n", opname, arg16);
-
-			transfer_op_advance(lp);
-			lp->address += arg16;
-			lp->op_advance = 0;
-			break;
-
-		case 0:
-			/* Extended opcodes. */
-			size_t length = read_uleb128(&program, program_end);
-
-			opcode = read_byte(&program, program_end);
-			const char *opname = dw_lne_name(opcode);
-
-			switch (opcode) {
-			case DW_LNE_end_sequence:
-				DEBUGF("%s:%zu()\n", opname, length);
-
-				transfer_op_advance(lp);
-				lp->program = program;
-				lp->end_sequence = true;
-				return;
-
-			case DW_LNE_set_address:
-				lp->address = read_uint(&program, program_end, sizeof(uintptr_t));
-				lp->op_advance = 0;
-
-				DEBUGF("%s:%zu(0x%zx)\n", opname, length, lp->address);
-				break;
-
-			case DW_LNE_set_discriminator:
-				uint64_t arg = read_uleb128(&program, program_end);
-				DEBUGF("%s:%zu(%" PRIu64 ")\n", opname, length, arg);
-				break;
-
-			default:
-				DEBUGF("unknown extended opcode %d:%zu\n", opcode, length);
-				safe_increment(&program, program_end, length - 1);
-			}
-			break;
-
-		default:
-			DEBUGF("unknown standard opcode %d\n", opcode);
-
-			// If the opcode length array is truncated, there is already
-			// something wrong with the parse, so we don't care if we misparse
-			// the remainder.
-			if (opcode < lp->hdr->standard_opcode_lengths_size) {
-				int len = lp->hdr->standard_opcode_lengths[opcode];
-				for (int i = 0; i < len; i++) {
-					// Drop arguments.
-					skip_leb128(&program, program_end);
-				}
-			}
-		}
-	}
-
-	transfer_op_advance(lp);
-	lp->program = program;
-	lp->truncated = true;
-}
-
-static void debug_line_program_header_parse(debug_sections_t *scs, const uint8_t *data, const uint8_t *data_end, struct debug_line_program_header *hdr)
-{
-	const uint8_t *unit_start = data;
-
-#define FIELD(name, spec, expr) (hdr->name = expr, DEBUGF(#name ": %" spec "\n", hdr->name))
-
-	unsigned width;
-
-	FIELD(unit_length, PRId64, read_initial_length(&data, data_end, &width));
-	FIELD(width, "d", width);
-
-	hdr->unit_end = data;
-	safe_increment(&hdr->unit_end, data_end, hdr->unit_length);
-	DEBUGF("unit size: %zu\n", hdr->unit_end - unit_start);
-
-	data_end = hdr->unit_end;
-
-	FIELD(version, "u", read_uint16(&data, data_end));
-
-	if (hdr->version < 3 || hdr->version > 5) {
-		// Not supported.
-		hdr->header_end = hdr->unit_end;
-		return;
-	}
-
-	if (hdr->version >= 5) {
-		FIELD(v5.address_size, "u", read_byte(&data, data_end));
-		FIELD(v5.segment_selector_size, "u", read_byte(&data, data_end));
-	}
-
-	FIELD(header_length, PRIu64, read_uint(&data, data_end, width));
-
-	hdr->header_end = data;
-	safe_increment(&hdr->header_end, data_end, hdr->header_length);
-
-	data_end = hdr->header_end;
-
-	FIELD(minimum_instruction_length, "u", read_byte(&data, data_end));
-	if (hdr->version >= 5)
-		FIELD(v5.maximum_operations_per_instruction, "u", read_byte(&data, data_end));
-	FIELD(default_is_stmt, "u", read_byte(&data, data_end));
-	FIELD(line_base, "d", (int8_t) read_byte(&data, data_end));
-	FIELD(line_range, "u", read_byte(&data, data_end));
-	FIELD(opcode_base, "u", read_byte(&data, data_end));
-
-	hdr->standard_opcode_lengths = data;
-	safe_increment(&data, data_end, hdr->opcode_base - 1);
-	hdr->standard_opcode_lengths_size = data - hdr->standard_opcode_lengths;
-
-	if (hdr->version < 5) {
-		hdr->v3.include_directories = data;
-		while (data < data_end && *data != 0)
-			skip_string(&data, data_end);
-		hdr->v3.include_directories_end = data;
-
-		// Sanitize the list a little.
-		while (hdr->v3.include_directories < hdr->v3.include_directories_end && hdr->v3.include_directories_end[-1] != 0)
-			hdr->v3.include_directories_end--;
-
-		safe_increment(&data, data_end, 1);
-
-		hdr->v3.file_names = data;
-	}
-
-	if (hdr->version >= 5) {
-		FIELD(v5.directory_entry_format_count, "u", read_byte(&data, data_end));
-
-		hdr->v5.directory_entry_format = data;
-		skip_format(&data, data_end, hdr->v5.directory_entry_format_count);
-		hdr->v5.directory_entry_format_end = data;
-
-		print_format("directory_entry_format",
-		    hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end);
-
-		FIELD(v5.directories_count, PRIu64, read_uleb128(&data, data_end));
-
-		hdr->v5.directories = data;
-		skip_formatted_list(&data, data_end, hdr->v5.directories_count,
-		    hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end, width);
-		hdr->v5.directories_end = data;
-
-		print_formatted_list(scs, "directories", hdr->v5.directories, hdr->v5.directories_end,
-		    hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end, width);
-
-		FIELD(v5.file_name_entry_format_count, "u", read_byte(&data, data_end));
-
-		hdr->v5.file_name_entry_format = data;
-		skip_format(&data, data_end, hdr->v5.file_name_entry_format_count);
-		hdr->v5.file_name_entry_format_end = data;
-
-		print_format("file_name_entry_format",
-		    hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end);
-
-		FIELD(v5.file_names_count, PRIu64, read_uleb128(&data, data_end));
-
-		hdr->v5.file_names = data;
-		skip_formatted_list(&data, data_end, hdr->v5.file_names_count,
-		    hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end, width);
-		hdr->v5.file_names_end = data;
-
-		print_formatted_list(scs, "file_names", hdr->v5.file_names, hdr->v5.file_names_end,
-		    hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end, width);
-	}
-}
-
-static bool has_usable_name(const uint8_t *format, const uint8_t *format_end, unsigned width)
-{
-	// Check if there is an appropriate entry we can use.
-	bool has_usable_name = false;
-	const uint8_t *dummy = NULL;
-
-	while (format < format_end) {
-		uint64_t type = read_uleb128(&format, format_end);
-		uint64_t form = read_uleb128(&format, format_end);
-
-		if (type == DW_LNCT_path) {
-			if (form == DW_FORM_string || form == DW_FORM_line_strp) {
-				has_usable_name = true;
-			}
-		}
-
-		if (!skip_data(form, &dummy, NULL, width)) {
-			// Encountered DW_FORM that we don't understand,
-			// which means we can't skip it.
-			return false;
-		}
-	}
-
-	return has_usable_name;
-}
-
-static const char *get_file_name_v3(struct debug_line_program_header *hdr, int file, int *dir)
-{
-	if (file == 0) {
-		// We'd have to find and read the compilation unit header for this one,
-		// and we don't wanna.
-		return NULL;
-	}
-
-	file--;
-
-	const uint8_t *files = hdr->v3.file_names;
-	const uint8_t *files_end = hdr->header_end;
-
-	for (int i = 0; i < file; i++) {
-		if (files >= files_end || *files == 0) {
-			// End of list.
-			return NULL;
-		}
-
-		// Skip an entry.
-		skip_string(&files, files_end);
-		skip_leb128(&files, files_end);
-		skip_leb128(&files, files_end);
-		skip_leb128(&files, files_end);
-	}
-
-	if (files >= files_end || *files == 0)
-		return NULL;
-
-	const char *fn = (const char *) files;
-	skip_string(&files, files_end);
-	*dir = read_uleb128(&files, files_end);
-	return fn;
-}
-
-static const char *get_file_name_v5(debug_sections_t *scs, struct debug_line_program_header *hdr, int file, int *dir)
-{
-	// DWARF5 has dynamic layout for file information, which is why
-	// this is so horrible to decode. Enjoy.
-
-	if (!has_usable_name(hdr->v5.file_name_entry_format, hdr->v5.file_name_entry_format_end, hdr->width))
-		return NULL;
-
-	const uint8_t *fns = hdr->v5.file_names;
-	const uint8_t *fns_end = hdr->v5.file_names_end;
-
-	const char *filename = NULL;
-
-	for (uint8_t i = 0; i < hdr->v5.file_names_count; i++) {
-
-		const uint8_t *fnef = hdr->v5.file_name_entry_format;
-		const uint8_t *fnef_end = hdr->v5.file_name_entry_format_end;
-
-		for (uint8_t j = 0; j < hdr->v5.file_name_entry_format_count; j++) {
-			uint64_t type = read_uleb128(&fnef, fnef_end);
-			uint64_t form = read_uleb128(&fnef, fnef_end);
-
-			if (i == file && type == DW_LNCT_path) {
-				if (form == DW_FORM_string) {
-					filename = read_string(&fns, fns_end);
-					continue;
-				}
-
-				if (form == DW_FORM_line_strp) {
-					uint64_t offset = read_uint(&fns, fns_end, hdr->width);
-					if (offset < scs->debug_line_str_size) {
-						filename = scs->debug_line_str + offset;
-					}
-					continue;
-				}
-			}
-
-			if (i == file && type == DW_LNCT_directory_index) {
-				if (form == DW_FORM_data1) {
-					*dir = read_byte(&fns, fns_end);
-					continue;
-				}
-
-				if (form == DW_FORM_data2) {
-					*dir = read_uint16(&fns, fns_end);
-					continue;
-				}
-
-				if (form == DW_FORM_udata) {
-					*dir = read_uleb128(&fns, fns_end);
-					continue;
-				}
-			}
-
-			skip_data(form, &fns, fns_end, hdr->width);
-		}
-
-		if (i == file)
-			break;
-	}
-
-	return filename;
-}
-
-static const char *get_file_name(debug_sections_t *scs, struct debug_line_program_header *hdr, int file, int *dir)
-{
-	switch (hdr->version) {
-	case 3:
-	case 4:
-		return get_file_name_v3(hdr, file, dir);
-	case 5:
-		return get_file_name_v5(scs, hdr, file, dir);
-	default:
-		return NULL;
-	}
-}
-
-static const char *get_dir_name_v3(struct debug_line_program_header *hdr, int dir)
-{
-	if (dir == 0)
-		return ".";
-
-	const uint8_t *dirs = hdr->v3.include_directories;
-	const uint8_t *dirs_end = hdr->v3.include_directories_end;
-
-	for (int i = 1; i < dir; i++) {
-		skip_string(&dirs, dirs_end);
-	}
-
-	if (dirs < dirs_end)
-		return (const char *) dirs;
-	else
-		return NULL;
-}
-
-static const char *get_dir_name_v5(debug_sections_t *scs, struct debug_line_program_header *hdr, int dir)
-{
-	// TODO: basically a copypaste of get_file_name(). Try to deduplicate it.
-
-	if (!has_usable_name(hdr->v5.directory_entry_format, hdr->v5.directory_entry_format_end, hdr->width))
-		return NULL;
-
-	const uint8_t *fns = hdr->v5.directories;
-	const uint8_t *fns_end = hdr->v5.directories_end;
-
-	const char *filename = NULL;
-
-	for (uint8_t i = 0; i < hdr->v5.directories_count; i++) {
-
-		const uint8_t *fnef = hdr->v5.directory_entry_format;
-		const uint8_t *fnef_end = hdr->v5.directory_entry_format_end;
-
-		for (uint8_t j = 0; j < hdr->v5.directory_entry_format_count; j++) {
-			uint64_t type = read_uleb128(&fnef, fnef_end);
-			uint64_t form = read_uleb128(&fnef, fnef_end);
-
-			if (i == dir && type == DW_LNCT_path) {
-				if (form == DW_FORM_string) {
-					filename = read_string(&fns, fns_end);
-					continue;
-				}
-
-				if (form == DW_FORM_line_strp) {
-					uint64_t offset = read_uint(&fns, fns_end, hdr->width);
-					if (offset < scs->debug_line_str_size) {
-						filename = scs->debug_line_str + offset;
-					}
-					continue;
-				}
-			}
-
-			skip_data(form, &fns, fns_end, hdr->width);
-		}
-
-		if (i == dir)
-			break;
-	}
-
-	return filename;
-}
-
-static const char *get_dir_name(debug_sections_t *scs, struct debug_line_program_header *hdr, int dir)
-{
-	switch (hdr->version) {
-	case 3:
-	case 4:
-		return get_dir_name_v3(hdr, dir);
-	case 5:
-		return get_dir_name_v5(scs, hdr, dir);
-	default:
-		return NULL;
-	}
-}
-
-static const uint8_t *find_line_program(debug_sections_t *scs, uintptr_t addr)
-{
-	// TODO: use .debug_aranges to find the data quickly
-	// This implementation just iterates through the entire .debug_line
-
-	uintptr_t closest_addr = 0;
-	const uint8_t *closest_prog = NULL;
-
-	const uint8_t *debug_line_ptr = scs->debug_line;
-	const uint8_t *const debug_line_end = scs->debug_line + scs->debug_line_size;
-
-	while (debug_line_ptr < debug_line_end) {
-		const uint8_t *prog = debug_line_ptr;
-
-		// Parse header
-		struct debug_line_program_header hdr = { };
-		debug_line_program_header_parse(scs, prog, debug_line_end, &hdr);
-		assert(hdr.unit_end > debug_line_ptr);
-		assert(hdr.unit_end <= debug_line_end);
-		debug_line_ptr = hdr.unit_end;
-
-		struct debug_line_program lp = debug_line_program_create(
-		    hdr.header_end, hdr.unit_end, &hdr);
-
-		while (lp.program < lp.program_end) {
-			// Find the start address of every sequence
-
-			debug_line_program_advance(&lp);
-			DEBUGF("<< address: %zx, line: %d, column: %d >>\n", lp.address, lp.line, lp.column);
-
-			if (!lp.truncated) {
-				if (lp.address <= addr && lp.address > closest_addr) {
-					closest_addr = lp.address;
-					closest_prog = prog;
-				}
-			}
-
-			if (!lp.end_sequence) {
-				debug_line_program_skip_to_sequence_end(&lp);
-				assert(lp.truncated || lp.end_sequence);
-			}
-		}
-	}
-
-	return closest_prog;
-}
-
-static bool get_info(const struct debug_line_program_header *hdr, uintptr_t addr, int op_index, int *file, int *line, int *column)
-{
-	struct debug_line_program lp = debug_line_program_create(
-	    hdr->header_end, hdr->unit_end, hdr);
-
-	int last_file = 0;
-	int last_line = 0;
-	int last_column = 0;
-
-	while (lp.program < lp.program_end) {
-		bool first = lp.end_sequence;
-
-		debug_line_program_advance(&lp);
-
-		if (lp.truncated)
-			continue;
-
-		/*
-		 * Return previous entry when we pass the target address, because
-		 * the address may not be aligned perfectly on instruction boundary.
-		 */
-		if (lp.address > addr || (lp.address == addr && lp.op_advance > op_index)) {
-			if (first) {
-				// First address is already too large, skip to the next sequence.
-				debug_line_program_skip_to_sequence_end(&lp);
-				continue;
-			}
-
-			*file = last_file;
-			*line = last_line;
-			*column = last_column;
-			return true;
-		}
-
-		last_file = lp.file;
-		last_line = lp.line;
-		last_column = lp.column;
-	}
-
-	return false;
-}
-
-bool debug_line_get_address_info(debug_sections_t *scs, uintptr_t addr, int op_index, const char **file_name, const char **dir_name, int *line, int *column)
-{
-	const uint8_t *data = find_line_program(scs, addr);
-	if (data == NULL) {
-		return false;
-	}
-
-	const uint8_t *const debug_line_end = scs->debug_line + scs->debug_line_size;
-
-	struct debug_line_program_header hdr = { };
-	debug_line_program_header_parse(scs, data, debug_line_end, &hdr);
-	assert(hdr.unit_end > data);
-	assert(hdr.unit_end <= debug_line_end);
-
-	int dir = -1;
-	int file = -1;
-
-	if (!get_info(&hdr, addr, op_index, &file, line, column)) {
-		// printf("no info for 0x%zx: prog offset 0x%zx\n", addr, (void *) data - debug_line);
-		return false;
-	}
-
-	// printf("got info for 0x%zx: file %d, line %d, column %d\n", addr, file, *line, *column);
-
-	if (file >= 0)
-		*file_name = get_file_name(scs, &hdr, file, &dir);
-
-	if (dir >= 0)
-		*dir_name = get_dir_name(scs, &hdr, dir);
-
-	return true;
-}
Index: rnel/generic/src/debug/names.c
===================================================================
--- kernel/generic/src/debug/names.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,801 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <debug/names.h>
-#include <debug/constants.h>
-#include <stddef.h>
-
-#define ENTRY(name) [name] = #name
-
-static const char *const dw_access_names[] = {
-	ENTRY(DW_ACCESS_public),
-	ENTRY(DW_ACCESS_protected),
-	ENTRY(DW_ACCESS_private),
-};
-
-_Static_assert(DW_ACCESS_MAX == DW_ACCESS_private + 1);
-
-static const char *const dw_at_names[] = {
-	ENTRY(DW_AT_sibling),
-	ENTRY(DW_AT_location),
-	ENTRY(DW_AT_name),
-	ENTRY(DW_AT_reserved_0x04),
-	ENTRY(DW_AT_fund_type),
-	ENTRY(DW_AT_mod_fund_type),
-	ENTRY(DW_AT_user_def_type),
-	ENTRY(DW_AT_mod_u_d_type),
-	ENTRY(DW_AT_ordering),
-	ENTRY(DW_AT_subscr_data),
-	ENTRY(DW_AT_byte_size),
-	ENTRY(DW_AT_bit_offset),
-	ENTRY(DW_AT_bit_size),
-	ENTRY(DW_AT_reserved_0x0e),
-	ENTRY(DW_AT_unused8),
-	ENTRY(DW_AT_stmt_list),
-	ENTRY(DW_AT_low_pc),
-	ENTRY(DW_AT_high_pc),
-	ENTRY(DW_AT_language),
-	ENTRY(DW_AT_member),
-	ENTRY(DW_AT_discr),
-	ENTRY(DW_AT_discr_value),
-	ENTRY(DW_AT_visibility),
-	ENTRY(DW_AT_import),
-	ENTRY(DW_AT_string_length),
-	ENTRY(DW_AT_common_reference),
-	ENTRY(DW_AT_comp_dir),
-	ENTRY(DW_AT_const_value),
-	ENTRY(DW_AT_containing_type),
-	ENTRY(DW_AT_default_value),
-	ENTRY(DW_AT_reserved_0x1f),
-	ENTRY(DW_AT_inline),
-	ENTRY(DW_AT_is_optional),
-	ENTRY(DW_AT_lower_bound),
-	ENTRY(DW_AT_reserved_0x23),
-	ENTRY(DW_AT_reserved_0x24),
-	ENTRY(DW_AT_producer),
-	ENTRY(DW_AT_reserved_0x26),
-	ENTRY(DW_AT_prototyped),
-	ENTRY(DW_AT_reserved_0x28),
-	ENTRY(DW_AT_reserved_0x29),
-	ENTRY(DW_AT_return_addr),
-	ENTRY(DW_AT_reserved_0x2b),
-	ENTRY(DW_AT_start_scope),
-	ENTRY(DW_AT_reserved_0x2d),
-	ENTRY(DW_AT_bit_stride),
-	ENTRY(DW_AT_upper_bound),
-	ENTRY(DW_AT_virtual),
-	ENTRY(DW_AT_abstract_origin),
-	ENTRY(DW_AT_accessibility),
-	ENTRY(DW_AT_address_class),
-	ENTRY(DW_AT_artificial),
-	ENTRY(DW_AT_base_types),
-	ENTRY(DW_AT_calling_convention),
-	ENTRY(DW_AT_count),
-	ENTRY(DW_AT_data_member_location),
-	ENTRY(DW_AT_decl_column),
-	ENTRY(DW_AT_decl_file),
-	ENTRY(DW_AT_decl_line),
-	ENTRY(DW_AT_declaration),
-	ENTRY(DW_AT_discr_list),
-	ENTRY(DW_AT_encoding),
-	ENTRY(DW_AT_external),
-	ENTRY(DW_AT_frame_base),
-	ENTRY(DW_AT_friend),
-	ENTRY(DW_AT_identifier_case),
-	ENTRY(DW_AT_macro_info),
-	ENTRY(DW_AT_namelist_item),
-	ENTRY(DW_AT_priority),
-	ENTRY(DW_AT_segment),
-	ENTRY(DW_AT_specification),
-	ENTRY(DW_AT_static_link),
-	ENTRY(DW_AT_type),
-	ENTRY(DW_AT_use_location),
-	ENTRY(DW_AT_variable_parameter),
-	ENTRY(DW_AT_virtuality),
-	ENTRY(DW_AT_vtable_elem_location),
-	ENTRY(DW_AT_allocated),
-	ENTRY(DW_AT_associated),
-	ENTRY(DW_AT_data_location),
-	ENTRY(DW_AT_byte_stride),
-	ENTRY(DW_AT_entry_pc),
-	ENTRY(DW_AT_use_UTF8),
-	ENTRY(DW_AT_extension),
-	ENTRY(DW_AT_ranges),
-	ENTRY(DW_AT_trampoline),
-	ENTRY(DW_AT_call_column),
-	ENTRY(DW_AT_call_file),
-	ENTRY(DW_AT_call_line),
-	ENTRY(DW_AT_description),
-	ENTRY(DW_AT_binary_scale),
-	ENTRY(DW_AT_decimal_scale),
-	ENTRY(DW_AT_small),
-	ENTRY(DW_AT_decimal_sign),
-	ENTRY(DW_AT_digit_count),
-	ENTRY(DW_AT_picture_string),
-	ENTRY(DW_AT_mutable),
-	ENTRY(DW_AT_threads_scaled),
-	ENTRY(DW_AT_explicit),
-	ENTRY(DW_AT_object_pointer),
-	ENTRY(DW_AT_endianity),
-	ENTRY(DW_AT_elemental),
-	ENTRY(DW_AT_pure),
-	ENTRY(DW_AT_recursive),
-	ENTRY(DW_AT_signature),
-	ENTRY(DW_AT_main_subprogram),
-	ENTRY(DW_AT_data_bit_offset),
-	ENTRY(DW_AT_const_expr),
-	ENTRY(DW_AT_enum_class),
-	ENTRY(DW_AT_linkage_name),
-	ENTRY(DW_AT_string_length_bit_size),
-	ENTRY(DW_AT_string_length_byte_size),
-	ENTRY(DW_AT_rank),
-	ENTRY(DW_AT_str_offsets_base),
-	ENTRY(DW_AT_addr_base),
-	ENTRY(DW_AT_rnglists_base),
-	ENTRY(DW_AT_dwo_id),
-	ENTRY(DW_AT_dwo_name),
-	ENTRY(DW_AT_reference),
-	ENTRY(DW_AT_rvalue_reference),
-	ENTRY(DW_AT_macros),
-	ENTRY(DW_AT_call_all_calls),
-	ENTRY(DW_AT_call_all_source_calls),
-	ENTRY(DW_AT_call_all_tail_calls),
-	ENTRY(DW_AT_call_return_pc),
-	ENTRY(DW_AT_call_value),
-	ENTRY(DW_AT_call_origin),
-	ENTRY(DW_AT_call_parameter),
-	ENTRY(DW_AT_call_pc),
-	ENTRY(DW_AT_call_tail_call),
-	ENTRY(DW_AT_call_target),
-	ENTRY(DW_AT_call_target_clobbered),
-	ENTRY(DW_AT_call_data_location),
-	ENTRY(DW_AT_call_data_value),
-	ENTRY(DW_AT_noreturn),
-	ENTRY(DW_AT_alignment),
-	ENTRY(DW_AT_export_symbols),
-	ENTRY(DW_AT_deleted),
-	ENTRY(DW_AT_defaulted),
-	ENTRY(DW_AT_loclists_base),
-};
-
-_Static_assert(DW_AT_MAX == DW_AT_loclists_base + 1);
-
-static const char *const dw_ate_names[] = {
-	ENTRY(DW_ATE_address),
-	ENTRY(DW_ATE_boolean),
-	ENTRY(DW_ATE_complex_float),
-	ENTRY(DW_ATE_float),
-	ENTRY(DW_ATE_signed),
-	ENTRY(DW_ATE_signed_char),
-	ENTRY(DW_ATE_unsigned),
-	ENTRY(DW_ATE_unsigned_char),
-	ENTRY(DW_ATE_imaginary_float),
-	ENTRY(DW_ATE_packed_decimal),
-	ENTRY(DW_ATE_numeric_string),
-	ENTRY(DW_ATE_edited),
-	ENTRY(DW_ATE_signed_fixed),
-	ENTRY(DW_ATE_unsigned_fixed),
-	ENTRY(DW_ATE_decimal_float),
-	ENTRY(DW_ATE_UTF),
-	ENTRY(DW_ATE_UCS),
-	ENTRY(DW_ATE_ASCII),
-};
-
-_Static_assert(DW_ATE_MAX == DW_ATE_ASCII + 1);
-
-static const char *const dw_cc_names[] = {
-	ENTRY(DW_CC_normal),
-	ENTRY(DW_CC_program),
-	ENTRY(DW_CC_nocall),
-	ENTRY(DW_CC_pass_by_reference),
-	ENTRY(DW_CC_pass_by_value),
-};
-
-_Static_assert(DW_CC_MAX == DW_CC_pass_by_value + 1);
-
-static const char *const dw_ut_names[] = {
-	ENTRY(DW_UT_compile),
-	ENTRY(DW_UT_type),
-	ENTRY(DW_UT_partial),
-	ENTRY(DW_UT_skeleton),
-	ENTRY(DW_UT_split_compile),
-	ENTRY(DW_UT_split_type),
-};
-
-_Static_assert(DW_UT_MAX == DW_UT_split_type + 1);
-
-static const char *const dw_tag_names[] = {
-	ENTRY(DW_TAG_array_type),
-	ENTRY(DW_TAG_class_type),
-	ENTRY(DW_TAG_entry_point),
-	ENTRY(DW_TAG_enumeration_type),
-	ENTRY(DW_TAG_formal_parameter),
-	ENTRY(DW_TAG_global_subroutine),
-	ENTRY(DW_TAG_global_variable),
-	ENTRY(DW_TAG_imported_declaration),
-	ENTRY(DW_TAG_reserved_0x09),
-	ENTRY(DW_TAG_label),
-	ENTRY(DW_TAG_lexical_block),
-	ENTRY(DW_TAG_local_variable),
-	ENTRY(DW_TAG_member),
-	ENTRY(DW_TAG_reserved_0x0e),
-	ENTRY(DW_TAG_pointer_type),
-	ENTRY(DW_TAG_reference_type),
-	ENTRY(DW_TAG_compile_unit),
-	ENTRY(DW_TAG_string_type),
-	ENTRY(DW_TAG_structure_type),
-	ENTRY(DW_TAG_subroutine),
-	ENTRY(DW_TAG_subroutine_type),
-	ENTRY(DW_TAG_typedef),
-	ENTRY(DW_TAG_union_type),
-	ENTRY(DW_TAG_unspecified_parameters),
-	ENTRY(DW_TAG_variant),
-	ENTRY(DW_TAG_common_block),
-	ENTRY(DW_TAG_common_inclusion),
-	ENTRY(DW_TAG_inheritance),
-	ENTRY(DW_TAG_inlined_subroutine),
-	ENTRY(DW_TAG_module),
-	ENTRY(DW_TAG_ptr_to_member_type),
-	ENTRY(DW_TAG_set_type),
-	ENTRY(DW_TAG_subrange_type),
-	ENTRY(DW_TAG_with_stmt),
-	ENTRY(DW_TAG_access_declaration),
-	ENTRY(DW_TAG_base_type),
-	ENTRY(DW_TAG_catch_block),
-	ENTRY(DW_TAG_const_type),
-	ENTRY(DW_TAG_constant),
-	ENTRY(DW_TAG_enumerator),
-	ENTRY(DW_TAG_file_type),
-	ENTRY(DW_TAG_friend),
-	ENTRY(DW_TAG_namelist),
-	ENTRY(DW_TAG_namelist_item),
-	ENTRY(DW_TAG_packed_type),
-	ENTRY(DW_TAG_subprogram),
-	ENTRY(DW_TAG_template_type_parameter),
-	ENTRY(DW_TAG_template_value_parameter),
-	ENTRY(DW_TAG_thrown_type),
-	ENTRY(DW_TAG_try_block),
-	ENTRY(DW_TAG_variant_part),
-	ENTRY(DW_TAG_variable),
-	ENTRY(DW_TAG_volatile_type),
-	ENTRY(DW_TAG_dwarf_procedure),
-	ENTRY(DW_TAG_restrict_type),
-	ENTRY(DW_TAG_interface_type),
-	ENTRY(DW_TAG_namespace),
-	ENTRY(DW_TAG_imported_module),
-	ENTRY(DW_TAG_unspecified_type),
-	ENTRY(DW_TAG_partial_unit),
-	ENTRY(DW_TAG_imported_unit),
-	ENTRY(DW_TAG_mutable_type),
-	ENTRY(DW_TAG_condition),
-	ENTRY(DW_TAG_shared_type),
-	ENTRY(DW_TAG_type_unit),
-	ENTRY(DW_TAG_rvalue_reference_type),
-	ENTRY(DW_TAG_template_alias),
-	ENTRY(DW_TAG_coarray_type),
-	ENTRY(DW_TAG_generic_subrange),
-	ENTRY(DW_TAG_dynamic_type),
-	ENTRY(DW_TAG_atomic_type),
-	ENTRY(DW_TAG_call_site),
-	ENTRY(DW_TAG_call_site_parameter),
-	ENTRY(DW_TAG_skeleton_unit),
-	ENTRY(DW_TAG_immutable_type),
-};
-
-_Static_assert(DW_TAG_MAX == DW_TAG_immutable_type + 1);
-
-static const char *const dw_form_names[] = {
-	ENTRY(DW_FORM_addr),
-	ENTRY(DW_FORM_reserved_0x02),
-	ENTRY(DW_FORM_block2),
-	ENTRY(DW_FORM_block4),
-	ENTRY(DW_FORM_data2),
-	ENTRY(DW_FORM_data4),
-	ENTRY(DW_FORM_data8),
-	ENTRY(DW_FORM_string),
-	ENTRY(DW_FORM_block),
-	ENTRY(DW_FORM_block1),
-	ENTRY(DW_FORM_data1),
-	ENTRY(DW_FORM_flag),
-	ENTRY(DW_FORM_sdata),
-	ENTRY(DW_FORM_strp),
-	ENTRY(DW_FORM_udata),
-	ENTRY(DW_FORM_ref_addr),
-	ENTRY(DW_FORM_ref1),
-	ENTRY(DW_FORM_ref2),
-	ENTRY(DW_FORM_ref4),
-	ENTRY(DW_FORM_ref8),
-	ENTRY(DW_FORM_ref_udata),
-	ENTRY(DW_FORM_indirect),
-	ENTRY(DW_FORM_sec_offset),
-	ENTRY(DW_FORM_exprloc),
-	ENTRY(DW_FORM_flag_present),
-	ENTRY(DW_FORM_strx),
-	ENTRY(DW_FORM_addrx),
-	ENTRY(DW_FORM_ref_sup4),
-	ENTRY(DW_FORM_strp_sup),
-	ENTRY(DW_FORM_data16),
-	ENTRY(DW_FORM_line_strp),
-	ENTRY(DW_FORM_ref_sig8),
-	ENTRY(DW_FORM_implicit_const),
-	ENTRY(DW_FORM_loclistx),
-	ENTRY(DW_FORM_rnglistx),
-	ENTRY(DW_FORM_ref_sup8),
-	ENTRY(DW_FORM_strx1),
-	ENTRY(DW_FORM_strx2),
-	ENTRY(DW_FORM_strx3),
-	ENTRY(DW_FORM_strx4),
-	ENTRY(DW_FORM_addrx1),
-	ENTRY(DW_FORM_addrx2),
-	ENTRY(DW_FORM_addrx3),
-	ENTRY(DW_FORM_addrx4),
-};
-
-_Static_assert(DW_FORM_MAX == DW_FORM_addrx4 + 1);
-
-static const char *const dw_op_names[] = {
-	ENTRY(DW_OP_reg),
-	ENTRY(DW_OP_basereg),
-	ENTRY(DW_OP_addr),
-	ENTRY(DW_OP_const),
-	ENTRY(DW_OP_deref2),
-	ENTRY(DW_OP_deref),
-	ENTRY(DW_OP_add),
-	ENTRY(DW_OP_const1u),
-	ENTRY(DW_OP_const1s),
-	ENTRY(DW_OP_const2u),
-	ENTRY(DW_OP_const2s),
-	ENTRY(DW_OP_const4u),
-	ENTRY(DW_OP_const4s),
-	ENTRY(DW_OP_const8u),
-	ENTRY(DW_OP_const8s),
-	ENTRY(DW_OP_constu),
-	ENTRY(DW_OP_consts),
-	ENTRY(DW_OP_dup),
-	ENTRY(DW_OP_drop),
-	ENTRY(DW_OP_over),
-	ENTRY(DW_OP_pick),
-	ENTRY(DW_OP_swap),
-	ENTRY(DW_OP_rot),
-	ENTRY(DW_OP_xderef),
-	ENTRY(DW_OP_abs),
-	ENTRY(DW_OP_and),
-	ENTRY(DW_OP_div),
-	ENTRY(DW_OP_minus),
-	ENTRY(DW_OP_mod),
-	ENTRY(DW_OP_mul),
-	ENTRY(DW_OP_neg),
-	ENTRY(DW_OP_not),
-	ENTRY(DW_OP_or),
-	ENTRY(DW_OP_plus),
-	ENTRY(DW_OP_plus_uconst),
-	ENTRY(DW_OP_shl),
-	ENTRY(DW_OP_shr),
-	ENTRY(DW_OP_shra),
-	ENTRY(DW_OP_xor),
-	ENTRY(DW_OP_bra),
-	ENTRY(DW_OP_eq),
-	ENTRY(DW_OP_ge),
-	ENTRY(DW_OP_gt),
-	ENTRY(DW_OP_le),
-	ENTRY(DW_OP_lt),
-	ENTRY(DW_OP_ne),
-	ENTRY(DW_OP_skip),
-	ENTRY(DW_OP_lit0),
-	ENTRY(DW_OP_lit1),
-	ENTRY(DW_OP_lit2),
-	ENTRY(DW_OP_lit3),
-	ENTRY(DW_OP_lit4),
-	ENTRY(DW_OP_lit5),
-	ENTRY(DW_OP_lit6),
-	ENTRY(DW_OP_lit7),
-	ENTRY(DW_OP_lit8),
-	ENTRY(DW_OP_lit9),
-	ENTRY(DW_OP_lit10),
-	ENTRY(DW_OP_lit11),
-	ENTRY(DW_OP_lit12),
-	ENTRY(DW_OP_lit13),
-	ENTRY(DW_OP_lit14),
-	ENTRY(DW_OP_lit15),
-	ENTRY(DW_OP_lit16),
-	ENTRY(DW_OP_lit17),
-	ENTRY(DW_OP_lit18),
-	ENTRY(DW_OP_lit19),
-	ENTRY(DW_OP_lit20),
-	ENTRY(DW_OP_lit21),
-	ENTRY(DW_OP_lit22),
-	ENTRY(DW_OP_lit23),
-	ENTRY(DW_OP_lit24),
-	ENTRY(DW_OP_lit25),
-	ENTRY(DW_OP_lit26),
-	ENTRY(DW_OP_lit27),
-	ENTRY(DW_OP_lit28),
-	ENTRY(DW_OP_lit29),
-	ENTRY(DW_OP_lit30),
-	ENTRY(DW_OP_lit31),
-	ENTRY(DW_OP_reg0),
-	ENTRY(DW_OP_reg1),
-	ENTRY(DW_OP_reg2),
-	ENTRY(DW_OP_reg3),
-	ENTRY(DW_OP_reg4),
-	ENTRY(DW_OP_reg5),
-	ENTRY(DW_OP_reg6),
-	ENTRY(DW_OP_reg7),
-	ENTRY(DW_OP_reg8),
-	ENTRY(DW_OP_reg9),
-	ENTRY(DW_OP_reg10),
-	ENTRY(DW_OP_reg11),
-	ENTRY(DW_OP_reg12),
-	ENTRY(DW_OP_reg13),
-	ENTRY(DW_OP_reg14),
-	ENTRY(DW_OP_reg15),
-	ENTRY(DW_OP_reg16),
-	ENTRY(DW_OP_reg17),
-	ENTRY(DW_OP_reg18),
-	ENTRY(DW_OP_reg19),
-	ENTRY(DW_OP_reg20),
-	ENTRY(DW_OP_reg21),
-	ENTRY(DW_OP_reg22),
-	ENTRY(DW_OP_reg23),
-	ENTRY(DW_OP_reg24),
-	ENTRY(DW_OP_reg25),
-	ENTRY(DW_OP_reg26),
-	ENTRY(DW_OP_reg27),
-	ENTRY(DW_OP_reg28),
-	ENTRY(DW_OP_reg29),
-	ENTRY(DW_OP_reg30),
-	ENTRY(DW_OP_reg31),
-	ENTRY(DW_OP_breg0),
-	ENTRY(DW_OP_breg1),
-	ENTRY(DW_OP_breg2),
-	ENTRY(DW_OP_breg3),
-	ENTRY(DW_OP_breg4),
-	ENTRY(DW_OP_breg5),
-	ENTRY(DW_OP_breg6),
-	ENTRY(DW_OP_breg7),
-	ENTRY(DW_OP_breg8),
-	ENTRY(DW_OP_breg9),
-	ENTRY(DW_OP_breg10),
-	ENTRY(DW_OP_breg11),
-	ENTRY(DW_OP_breg12),
-	ENTRY(DW_OP_breg13),
-	ENTRY(DW_OP_breg14),
-	ENTRY(DW_OP_breg15),
-	ENTRY(DW_OP_breg16),
-	ENTRY(DW_OP_breg17),
-	ENTRY(DW_OP_breg18),
-	ENTRY(DW_OP_breg19),
-	ENTRY(DW_OP_breg20),
-	ENTRY(DW_OP_breg21),
-	ENTRY(DW_OP_breg22),
-	ENTRY(DW_OP_breg23),
-	ENTRY(DW_OP_breg24),
-	ENTRY(DW_OP_breg25),
-	ENTRY(DW_OP_breg26),
-	ENTRY(DW_OP_breg27),
-	ENTRY(DW_OP_breg28),
-	ENTRY(DW_OP_breg29),
-	ENTRY(DW_OP_breg30),
-	ENTRY(DW_OP_breg31),
-	ENTRY(DW_OP_regx),
-	ENTRY(DW_OP_fbreg),
-	ENTRY(DW_OP_bregx),
-	ENTRY(DW_OP_piece),
-	ENTRY(DW_OP_deref_size),
-	ENTRY(DW_OP_xderef_size),
-	ENTRY(DW_OP_nop),
-	ENTRY(DW_OP_push_object_address),
-	ENTRY(DW_OP_call2),
-	ENTRY(DW_OP_call4),
-	ENTRY(DW_OP_call_ref),
-	ENTRY(DW_OP_form_tls_address),
-	ENTRY(DW_OP_call_frame_cfa),
-	ENTRY(DW_OP_bit_piece),
-	ENTRY(DW_OP_implicit_value),
-	ENTRY(DW_OP_stack_value),
-	ENTRY(DW_OP_implicit_pointer),
-	ENTRY(DW_OP_addrx),
-	ENTRY(DW_OP_constx),
-	ENTRY(DW_OP_entry_value),
-	ENTRY(DW_OP_const_type),
-	ENTRY(DW_OP_regval_type),
-	ENTRY(DW_OP_deref_type),
-	ENTRY(DW_OP_xderef_type),
-	ENTRY(DW_OP_convert),
-	ENTRY(DW_OP_reinterpret),
-};
-
-_Static_assert(DW_OP_MAX == DW_OP_reinterpret + 1);
-
-static const char *const dw_lle_names[] = {
-	ENTRY(DW_LLE_end_of_list),
-	ENTRY(DW_LLE_base_addressx),
-	ENTRY(DW_LLE_startx_endx),
-	ENTRY(DW_LLE_startx_length),
-	ENTRY(DW_LLE_offset_pair),
-	ENTRY(DW_LLE_default_location),
-	ENTRY(DW_LLE_base_address),
-	ENTRY(DW_LLE_start_end),
-	ENTRY(DW_LLE_start_length),
-};
-
-_Static_assert(DW_LLE_MAX == DW_LLE_start_length + 1);
-
-static const char *const dw_ds_names[] = {
-	ENTRY(DW_DS_unsigned),
-	ENTRY(DW_DS_leading_overpunch),
-	ENTRY(DW_DS_trailing_overpunch),
-	ENTRY(DW_DS_leading_separate),
-	ENTRY(DW_DS_trailing_separate),
-};
-
-_Static_assert(DW_DS_MAX == DW_DS_trailing_separate + 1);
-
-static const char *const dw_end_names[] = {
-	ENTRY(DW_END_default),
-	ENTRY(DW_END_big),
-	ENTRY(DW_END_little),
-};
-
-_Static_assert(DW_END_MAX == DW_END_little + 1);
-
-static const char *const dw_vis_names[] = {
-	ENTRY(DW_VIS_local),
-	ENTRY(DW_VIS_exported),
-	ENTRY(DW_VIS_qualified),
-};
-
-_Static_assert(DW_VIS_MAX == DW_VIS_qualified + 1);
-
-static const char *const dw_virtuality_names[] = {
-	ENTRY(DW_VIRTUALITY_none),
-	ENTRY(DW_VIRTUALITY_virtual),
-	ENTRY(DW_VIRTUALITY_pure_virtual),
-};
-
-_Static_assert(DW_VIRTUALITY_MAX == DW_VIRTUALITY_pure_virtual + 1);
-
-static const char *const dw_lang_names[] = {
-	ENTRY(DW_LANG_C89),
-	ENTRY(DW_LANG_C),
-	ENTRY(DW_LANG_Ada83),
-	ENTRY(DW_LANG_C_plus_plus),
-	ENTRY(DW_LANG_Cobol74),
-	ENTRY(DW_LANG_Cobol85),
-	ENTRY(DW_LANG_Fortran77),
-	ENTRY(DW_LANG_Fortran90),
-	ENTRY(DW_LANG_Pascal83),
-	ENTRY(DW_LANG_Modula2),
-	ENTRY(DW_LANG_Java),
-	ENTRY(DW_LANG_C99),
-	ENTRY(DW_LANG_Ada95),
-	ENTRY(DW_LANG_Fortran95),
-	ENTRY(DW_LANG_PLI),
-	ENTRY(DW_LANG_ObjC),
-	ENTRY(DW_LANG_ObjC_plus_plus),
-	ENTRY(DW_LANG_UPC),
-	ENTRY(DW_LANG_D),
-	ENTRY(DW_LANG_Python),
-	ENTRY(DW_LANG_OpenCL),
-	ENTRY(DW_LANG_Go),
-	ENTRY(DW_LANG_Modula3),
-	ENTRY(DW_LANG_Haskell),
-	ENTRY(DW_LANG_C_plus_plus_03),
-	ENTRY(DW_LANG_C_plus_plus_11),
-	ENTRY(DW_LANG_OCaml),
-	ENTRY(DW_LANG_Rust),
-	ENTRY(DW_LANG_C11),
-	ENTRY(DW_LANG_Swift),
-	ENTRY(DW_LANG_Julia),
-	ENTRY(DW_LANG_Dylan),
-	ENTRY(DW_LANG_C_plus_plus_14),
-	ENTRY(DW_LANG_Fortran03),
-	ENTRY(DW_LANG_Fortran08),
-	ENTRY(DW_LANG_RenderScript),
-	ENTRY(DW_LANG_BLISS),
-};
-
-_Static_assert(DW_LANG_MAX == DW_LANG_BLISS + 1);
-
-static const char *const dw_id_names[] = {
-	ENTRY(DW_ID_case_sensitive),
-	ENTRY(DW_ID_up_case),
-	ENTRY(DW_ID_down_case),
-	ENTRY(DW_ID_case_insensitive),
-};
-
-_Static_assert(DW_ID_MAX == DW_ID_case_insensitive + 1);
-
-static const char *const dw_lns_names[] = {
-	ENTRY(DW_LNS_copy),
-	ENTRY(DW_LNS_advance_pc),
-	ENTRY(DW_LNS_advance_line),
-	ENTRY(DW_LNS_set_file),
-	ENTRY(DW_LNS_set_column),
-	ENTRY(DW_LNS_negate_stmt),
-	ENTRY(DW_LNS_set_basic_block),
-	ENTRY(DW_LNS_const_add_pc),
-	ENTRY(DW_LNS_fixed_advance_pc),
-	ENTRY(DW_LNS_set_prologue_end),
-	ENTRY(DW_LNS_set_epilogue_begin),
-	ENTRY(DW_LNS_set_isa),
-};
-
-_Static_assert(DW_LNS_MAX == DW_LNS_set_isa + 1);
-
-static const char *const dw_lne_names[] = {
-	ENTRY(DW_LNE_end_sequence),
-	ENTRY(DW_LNE_set_address),
-	ENTRY(DW_LNE_define_file),
-	ENTRY(DW_LNE_set_discriminator),
-};
-
-_Static_assert(DW_LNE_MAX == DW_LNE_set_discriminator + 1);
-
-static const char *const dw_lnct_names[] = {
-	ENTRY(DW_LNCT_path),
-	ENTRY(DW_LNCT_directory_index),
-	ENTRY(DW_LNCT_timestamp),
-	ENTRY(DW_LNCT_size),
-	ENTRY(DW_LNCT_MD5),
-};
-
-_Static_assert(DW_LNCT_MAX == DW_LNCT_MD5 + 1);
-
-static const char *const dw_inl_names[] = {
-	ENTRY(DW_INL_not_inlined),
-	ENTRY(DW_INL_inlined),
-	ENTRY(DW_INL_declared_not_inlined),
-	ENTRY(DW_INL_declared_inlined),
-};
-
-_Static_assert(DW_INL_MAX == DW_INL_declared_inlined + 1);
-
-static const char *const dw_ord_names[] = {
-	ENTRY(DW_ORD_row_major),
-	ENTRY(DW_ORD_col_major),
-};
-
-_Static_assert(DW_ORD_MAX == DW_ORD_col_major + 1);
-
-static const char *const dw_dsc_names[] = {
-	ENTRY(DW_DSC_label),
-	ENTRY(DW_DSC_range),
-};
-
-_Static_assert(DW_DSC_MAX == DW_DSC_range + 1);
-
-static const char *const dw_idx_names[] = {
-	ENTRY(DW_IDX_compile_unit),
-	ENTRY(DW_IDX_type_unit),
-	ENTRY(DW_IDX_die_offset),
-	ENTRY(DW_IDX_parent),
-	ENTRY(DW_IDX_type_hash),
-};
-
-_Static_assert(DW_IDX_MAX == DW_IDX_type_hash + 1);
-
-static const char *const dw_defaulted_names[] = {
-	ENTRY(DW_DEFAULTED_no),
-	ENTRY(DW_DEFAULTED_in_class),
-	ENTRY(DW_DEFAULTED_out_of_class),
-};
-
-_Static_assert(DW_DEFAULTED_MAX == DW_DEFAULTED_out_of_class + 1);
-
-static const char *const dw_macro_names[] = {
-	ENTRY(DW_MACRO_define),
-	ENTRY(DW_MACRO_undef),
-	ENTRY(DW_MACRO_start_file),
-	ENTRY(DW_MACRO_end_file),
-	ENTRY(DW_MACRO_define_strp),
-	ENTRY(DW_MACRO_undef_strp),
-	ENTRY(DW_MACRO_import),
-	ENTRY(DW_MACRO_define_sup),
-	ENTRY(DW_MACRO_undef_sup),
-	ENTRY(DW_MACRO_import_sup),
-	ENTRY(DW_MACRO_define_strx),
-	ENTRY(DW_MACRO_undef_strx),
-};
-
-_Static_assert(DW_MACRO_MAX == DW_MACRO_undef_strx + 1);
-
-static const char *const dw_cfa_names[] = {
-	ENTRY(DW_CFA_nop),
-	ENTRY(DW_CFA_set_loc),
-	ENTRY(DW_CFA_advance_loc1),
-	ENTRY(DW_CFA_advance_loc2),
-	ENTRY(DW_CFA_advance_loc4),
-	ENTRY(DW_CFA_offset_extended),
-	ENTRY(DW_CFA_restore_extended),
-	ENTRY(DW_CFA_undefined),
-	ENTRY(DW_CFA_same_value),
-	ENTRY(DW_CFA_register),
-	ENTRY(DW_CFA_remember_state),
-	ENTRY(DW_CFA_restore_state),
-	ENTRY(DW_CFA_def_cfa),
-	ENTRY(DW_CFA_def_cfa_register),
-	ENTRY(DW_CFA_def_cfa_offset),
-	ENTRY(DW_CFA_def_cfa_expression),
-	ENTRY(DW_CFA_expression),
-	ENTRY(DW_CFA_offset_extended_sf),
-	ENTRY(DW_CFA_def_cfa_sf),
-	ENTRY(DW_CFA_def_cfa_offset_sf),
-	ENTRY(DW_CFA_val_offset),
-	ENTRY(DW_CFA_val_offset_sf),
-	ENTRY(DW_CFA_val_expression),
-};
-
-_Static_assert(DW_CFA_MAX == DW_CFA_val_expression + 1);
-
-static const char *const dw_rle_names[] = {
-	ENTRY(DW_RLE_end_of_list),
-	ENTRY(DW_RLE_base_addressx),
-	ENTRY(DW_RLE_startx_endx),
-	ENTRY(DW_RLE_startx_length),
-	ENTRY(DW_RLE_offset_pair),
-	ENTRY(DW_RLE_base_address),
-	ENTRY(DW_RLE_start_end),
-	ENTRY(DW_RLE_start_length),
-};
-
-_Static_assert(DW_RLE_MAX == DW_RLE_start_length + 1);
-
-#define NAME_FUNC(prefix) \
-	const char *prefix##_name(prefix##_t val) \
-	{ \
-		if (val >= sizeof(prefix##_names) / sizeof(const char *)) return NULL; \
-		return prefix##_names[val]; \
-	}
-
-NAME_FUNC(dw_access);
-NAME_FUNC(dw_at);
-NAME_FUNC(dw_ate);
-NAME_FUNC(dw_cc);
-NAME_FUNC(dw_cfa);
-NAME_FUNC(dw_defaulted);
-NAME_FUNC(dw_ds);
-NAME_FUNC(dw_dsc);
-NAME_FUNC(dw_end);
-NAME_FUNC(dw_form);
-NAME_FUNC(dw_id);
-NAME_FUNC(dw_idx);
-NAME_FUNC(dw_inl);
-NAME_FUNC(dw_lang);
-NAME_FUNC(dw_lle);
-NAME_FUNC(dw_lnct);
-NAME_FUNC(dw_lne);
-NAME_FUNC(dw_lns);
-NAME_FUNC(dw_macro);
-NAME_FUNC(dw_op);
-NAME_FUNC(dw_ord);
-NAME_FUNC(dw_rle);
-NAME_FUNC(dw_tag);
-NAME_FUNC(dw_ut);
-NAME_FUNC(dw_virtuality);
-NAME_FUNC(dw_vis);
Index: rnel/generic/src/debug/panic.c
===================================================================
--- kernel/generic/src/debug/panic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#include <panic.h>
-#include <stdio.h>
-#include <stacktrace.h>
-#include <halt.h>
-#include <typedefs.h>
-#include <mm/as.h>
-#include <stdarg.h>
-#include <interrupt.h>
-
-#define BANNER_LEFT   "######>"
-#define BANNER_RIGHT  "<######"
-
-void panic_common(panic_category_t cat, istate_t *istate, int access,
-    uintptr_t address, const char *fmt, ...)
-{
-	console_override = true;
-
-	printf("\n%s Kernel panic ", BANNER_LEFT);
-	if (CPU)
-		printf("on cpu%u ", CPU->id);
-	printf("due to ");
-
-	va_list args;
-	va_start(args, fmt);
-	if (cat == PANIC_ASSERT) {
-		printf("a failed assertion: %s\n", BANNER_RIGHT);
-		vprintf(fmt, args);
-		printf("\n");
-	} else if (cat == PANIC_BADTRAP) {
-		printf("bad trap %" PRIuPTR ". %s\n", address,
-		    BANNER_RIGHT);
-		if (fmt) {
-			vprintf(fmt, args);
-			printf("\n");
-		}
-	} else if (cat == PANIC_MEMTRAP) {
-		printf("a bad memory access while ");
-		if (access == PF_ACCESS_READ)
-			printf("loading from");
-		else if (access == PF_ACCESS_WRITE)
-			printf("storing to");
-		else if (access == PF_ACCESS_EXEC)
-			printf("branching to");
-		else
-			printf("referencing");
-		printf(" address %p. %s\n", (void *) address,
-		    BANNER_RIGHT);
-		if (fmt) {
-			vprintf(fmt, args);
-			printf("\n");
-		}
-	} else {
-		printf("the following reason: %s\n",
-		    BANNER_RIGHT);
-		vprintf(fmt, args);
-		printf("\n");
-	}
-	va_end(args);
-
-	printf("\n");
-
-	printf("CURRENT=%p: ", CURRENT);
-	if (CURRENT != NULL) {
-		printf("pe=%" PRIuPTR " thread=%p task=%p cpu=%p as=%p"
-		    " magic=%#" PRIx32 "\n", CURRENT->preemption,
-		    CURRENT->thread, CURRENT->task, CURRENT->cpu, CURRENT->as, CURRENT->magic);
-
-		if (CURRENT->thread != NULL)
-			printf("thread=\"%s\"\n", CURRENT->thread->name);
-
-		if (CURRENT->task != NULL)
-			printf("task=\"%s\"\n", CURRENT->task->name);
-	} else
-		printf("invalid\n");
-
-	if (istate) {
-		istate_decode(istate);
-		printf("\n");
-	}
-
-	stack_trace();
-	halt();
-}
-
-/** @}
- */
Index: rnel/generic/src/debug/profile.c
===================================================================
--- kernel/generic/src/debug/profile.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-
-/**
- * @file
- * @brief Kernel instrumentation functions.
- */
-
-#ifdef CONFIG_TRACE
-
-#include <debug.h>
-#include <symtab.h>
-#include <errno.h>
-#include <stdio.h>
-
-void __cyg_profile_func_enter(void *fn, void *call_site)
-{
-	const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn);
-
-	const char *call_site_sym;
-	uintptr_t call_site_off;
-
-	if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
-	    &call_site_off) == EOK)
-		printf("%s()+%p->%s()\n", call_site_sym,
-		    (void *) call_site_off, fn_sym);
-	else
-		printf("->%s()\n", fn_sym);
-}
-
-void __cyg_profile_func_exit(void *fn, void *call_site)
-{
-	const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn);
-
-	const char *call_site_sym;
-	uintptr_t call_site_off;
-
-	if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
-	    &call_site_off) == EOK)
-		printf("%s()+%p<-%s()\n", call_site_sym,
-		    (void *) call_site_off, fn_sym);
-	else
-		printf("<-%s()\n", fn_sym);
-}
-
-#endif /* CONFIG_TRACE */
-
-/** @}
- */
Index: rnel/generic/src/debug/sections.c
===================================================================
--- kernel/generic/src/debug/sections.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <debug/sections.h>
-#include <debug/register.h>
-#include <debug.h>
-
-#include <stdio.h>
-#include <str.h>
-
-#define DEBUGF dummy_printf
-
-debug_sections_t kernel_sections;
-
-struct section_manifest {
-	const char *name;
-	const void **address_field;
-	size_t *size_field;
-};
-
-static void _check_string_section(const char *section, size_t *section_size)
-{
-	while (*section_size > 0 && section[*section_size - 1] != 0) {
-		(*section_size)--;
-	}
-}
-
-debug_sections_t get_debug_sections(const void *elf, size_t elf_size)
-{
-	debug_sections_t out = { };
-
-#define section(name) { "." #name, (const void **)&out.name, &out.name##_size }
-
-	const struct section_manifest manifest[] = {
-		section(debug_aranges),
-		section(debug_info),
-		section(debug_abbrev),
-		section(debug_line),
-		section(debug_str),
-		section(debug_line_str),
-		section(debug_rnglists),
-		section(eh_frame_hdr),
-		section(eh_frame),
-		section(symtab),
-		section(strtab),
-	};
-
-	const size_t manifest_len = sizeof(manifest) / sizeof(struct section_manifest);
-
-	const void *data_end = elf + elf_size;
-
-	/*
-	 * While this data is technically "trusted", insofar as it is provided
-	 * by the bootloader, it's not critical, so we try to make sure malformed or
-	 * misconfigured debug data doesn't crash the kernel.
-	 */
-
-	if (elf_size < sizeof(elf_header_t)) {
-		printf("bad debug data: too short\n");
-		return out;
-	}
-
-	if (((uintptr_t) elf) % 8 != 0) {
-		printf("bad debug data: unaligned input\n");
-		return out;
-	}
-
-	const elf_header_t *hdr = elf;
-
-	if (hdr->e_ident[0] != ELFMAG0 || hdr->e_ident[1] != ELFMAG1 ||
-	    hdr->e_ident[2] != ELFMAG2 || hdr->e_ident[3] != ELFMAG3) {
-		printf("bad debug data: wrong ELF magic bytes\n");
-		return out;
-	}
-
-	if (hdr->e_shentsize != sizeof(elf_section_header_t)) {
-		printf("bad debug data: wrong e_shentsize\n");
-		return out;
-	}
-
-	/* Get section header table. */
-	const elf_section_header_t *shdr = elf + hdr->e_shoff;
-	size_t shdr_len = hdr->e_shnum;
-
-	if ((void *) &shdr[shdr_len] > data_end) {
-		printf("bad debug data: truncated section header table\n");
-		return out;
-	}
-
-	if (hdr->e_shstrndx >= shdr_len) {
-		printf("bad debug data: string table index out of range\n");
-		return out;
-	}
-
-	/* Get data on section name string table. */
-	const elf_section_header_t *shstr = &shdr[hdr->e_shstrndx];
-	const char *shstrtab = elf + shstr->sh_offset;
-	size_t shstrtab_size = shstr->sh_size;
-
-	if ((void *) shstrtab + shstrtab_size > data_end) {
-		printf("bad debug data: truncated string table\n");
-		return out;
-	}
-
-	/* Check NUL-terminator. */
-	_check_string_section(shstrtab, &shstrtab_size);
-
-	if (shstrtab_size == 0) {
-		printf("bad debug data: empty or non-null-terminated string table\n");
-		return out;
-	}
-
-	/* List all present sections. */
-	for (size_t i = 0; i < shdr_len; i++) {
-		if (shdr[i].sh_type == SHT_NULL || shdr[i].sh_type == SHT_NOBITS)
-			continue;
-
-		if (shdr[i].sh_name >= shstrtab_size) {
-			printf("bad debug data: string table index out of range\n");
-			continue;
-		}
-
-		const char *name = shstrtab + shdr[i].sh_name;
-		size_t offset = shdr[i].sh_offset;
-		size_t size = shdr[i].sh_size;
-
-		DEBUGF("section '%s': offset %zd (%zd bytes)\n", name, offset, size);
-
-		if (elf + offset + size > data_end) {
-			printf("bad debug data: truncated section %s\n", name);
-			continue;
-		}
-
-		for (size_t i = 0; i < manifest_len; i++) {
-			if (str_cmp(manifest[i].name, name) == 0) {
-				*manifest[i].address_field = elf + offset;
-				*manifest[i].size_field = size;
-				break;
-			}
-		}
-	}
-
-	/* Check NUL-terminator in .strtab, .debug_str and .debug_line_str */
-	_check_string_section(out.strtab, &out.strtab_size);
-	_check_string_section(out.debug_str, &out.debug_str_size);
-	_check_string_section(out.debug_line_str, &out.debug_line_str_size);
-
-	return out;
-}
-
-void register_debug_data(const void *elf, size_t elf_size)
-{
-	kernel_sections = get_debug_sections(elf, elf_size);
-}
Index: rnel/generic/src/debug/stacktrace.c
===================================================================
--- kernel/generic/src/debug/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdbool.h>
-#include <interrupt.h>
-#include <symtab.h>
-#include <stdio.h>
-
-#include <debug/line.h>
-
-#define STACK_FRAMES_MAX  20
-
-void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
-{
-	int cnt = 0;
-
-	uintptr_t fp;
-	uintptr_t pc;
-
-	while ((cnt++ < STACK_FRAMES_MAX) &&
-	    (ops->stack_trace_context_validate(ctx))) {
-
-		const char *symbol = NULL;
-		uintptr_t symbol_addr = 0;
-		const char *file_name = NULL;
-		const char *dir_name = NULL;
-		int line = 0;
-		int column = 0;
-
-		/*
-		 * If this isn't the first frame, move pc back by one byte to read the
-		 * position of the call instruction, not the return address.
-		 */
-		pc = cnt == 1 ? ctx->pc : ctx->pc - 1;
-
-		if (ops->symbol_resolve &&
-		    ops->symbol_resolve(pc, 0, &symbol, &symbol_addr, &file_name, &dir_name, &line, &column)) {
-
-			if (symbol == NULL)
-				symbol = "<unknown>";
-
-			if (file_name == NULL && line == 0) {
-				printf("%p: %24s()+%zu\n", (void *) ctx->fp, symbol, ctx->pc - symbol_addr);
-			} else {
-				if (file_name == NULL)
-					file_name = "<unknown>";
-				if (dir_name == NULL)
-					dir_name = "<unknown>";
-
-				printf("%p: %20s()+%zu\t %s/%s:%d:%d\n",
-				    (void *) ctx->fp, symbol, ctx->pc - symbol_addr,
-				    dir_name, file_name, line, column);
-			}
-		} else
-			printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc);
-
-		if (!ops->return_address_get(ctx, &pc))
-			break;
-
-		if (!ops->frame_pointer_prev(ctx, &fp))
-			break;
-
-		ctx->fp = fp;
-		ctx->pc = pc;
-	}
-}
-
-void stack_trace(void)
-{
-	stack_trace_context_t ctx = {
-		.fp = frame_pointer_get(),
-		.pc = program_counter_get(),
-		.istate = NULL
-	};
-
-	stack_trace_ctx(&kst_ops, &ctx);
-
-	/*
-	 * Prevent the tail call optimization of the previous call by
-	 * making it a non-tail call.
-	 */
-	(void) frame_pointer_get();
-}
-
-void stack_trace_istate(istate_t *istate)
-{
-	stack_trace_context_t ctx = {
-		.fp = istate_get_fp(istate),
-		.pc = istate_get_pc(istate),
-		.istate = istate
-	};
-
-	if (istate_from_uspace(istate))
-		stack_trace_ctx(&ust_ops, &ctx);
-	else
-		stack_trace_ctx(&kst_ops, &ctx);
-}
-
-static bool
-resolve_kernel_address(uintptr_t addr, int op_index,
-    const char **symbol, uintptr_t *symbol_addr,
-    const char **filename, const char **dirname,
-    int *line, int *column)
-{
-	*symbol_addr = 0;
-	*symbol = symtab_name_lookup(addr, symbol_addr, &kernel_sections);
-
-	return debug_line_get_address_info(&kernel_sections, addr, op_index, filename, dirname, line, column) || *symbol_addr != 0;
-}
-
-static bool
-resolve_uspace_address(uintptr_t addr, int op_index,
-    const char **symbol, uintptr_t *symbol_addr,
-    const char **filename, const char **dirname,
-    int *line, int *column)
-{
-	if (TASK->debug_sections == NULL)
-		return false;
-
-	debug_sections_t *scs = TASK->debug_sections;
-
-	*symbol_addr = 0;
-	*symbol = symtab_name_lookup(addr, symbol_addr, scs);
-
-	return debug_line_get_address_info(scs, addr, op_index, filename, dirname, line, column) || *symbol_addr != 0;
-}
-
-stack_trace_ops_t kst_ops = {
-	.stack_trace_context_validate = kernel_stack_trace_context_validate,
-	.frame_pointer_prev = kernel_frame_pointer_prev,
-	.return_address_get = kernel_return_address_get,
-	.symbol_resolve = resolve_kernel_address,
-};
-
-stack_trace_ops_t ust_ops = {
-	.stack_trace_context_validate = uspace_stack_trace_context_validate,
-	.frame_pointer_prev = uspace_frame_pointer_prev,
-	.return_address_get = uspace_return_address_get,
-	.symbol_resolve = resolve_uspace_address,
-};
-
-/** @}
- */
Index: rnel/generic/src/debug/symtab.c
===================================================================
--- kernel/generic/src/debug/symtab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,215 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_debug
- * @{
- */
-
-/**
- * @file
- * @brief Kernel symbol resolver.
- */
-
-#include <abi/elf.h>
-#include <byteorder.h>
-#include <console/prompt.h>
-#include <debug/sections.h>
-#include <errno.h>
-#include <proc/task.h>
-#include <stdio.h>
-#include <str.h>
-#include <symtab.h>
-#include <typedefs.h>
-
-static inline const char *symtab_entry_name(debug_sections_t *scs, int entry)
-{
-	size_t index = scs->symtab[entry].st_name;
-
-	if (index >= scs->strtab_size)
-		return NULL;
-
-	return scs->strtab + index;
-}
-
-static inline size_t symtab_next(debug_sections_t *scs, size_t i)
-{
-	size_t symtab_len = scs->symtab_size / sizeof(elf_symbol_t);
-
-	for (; i < symtab_len; i++) {
-		const char *name = symtab_entry_name(scs, i);
-		int st_bind = elf_st_bind(scs->symtab[i].st_info);
-		int st_type = elf_st_type(scs->symtab[i].st_info);
-
-		if (st_bind == STB_LOCAL)
-			continue;
-
-		if (name == NULL || *name == '\0')
-			continue;
-
-		if (st_type == STT_FUNC || st_type == STT_OBJECT)
-			break;
-	}
-
-	return i;
-}
-
-const char *symtab_name_lookup(uintptr_t addr, uintptr_t *symbol_addr, debug_sections_t *scs)
-{
-	const elf_symbol_t *symtab = scs->symtab;
-	size_t symtab_len = scs->symtab_size / sizeof(elf_symbol_t);
-	const char *strtab = scs->strtab;
-	size_t strtab_size = scs->strtab_size;
-
-	if (symtab == NULL || strtab == NULL)
-		return NULL;
-
-	uintptr_t closest_symbol_addr = 0;
-	uintptr_t closest_symbol_name = 0;
-
-	for (size_t i = symtab_next(scs, 0); i < symtab_len; i = symtab_next(scs, i + 1)) {
-		if (symtab[i].st_value > addr)
-			continue;
-
-		if (symtab[i].st_value + symtab[i].st_size > addr) {
-			closest_symbol_addr = symtab[i].st_value;
-			closest_symbol_name = symtab[i].st_name;
-			break;
-		}
-
-		if (symtab[i].st_value > closest_symbol_addr) {
-			closest_symbol_addr = symtab[i].st_value;
-			closest_symbol_name = symtab[i].st_name;
-		}
-	}
-
-	if (closest_symbol_addr == 0)
-		return NULL;
-
-	if (symbol_addr)
-		*symbol_addr = closest_symbol_addr;
-
-	if (closest_symbol_name >= strtab_size)
-		return NULL;
-
-	return strtab + closest_symbol_name;
-}
-
-/** Lookup symbol by address and format for display.
- *
- * Returns name of closest corresponding symbol,
- * "unknown" if none exists and "N/A" if no symbol
- * information is available.
- *
- * @param addr Address.
- * @param name Place to store pointer to the symbol name.
- *
- * @return Pointer to a human-readable string.
- *
- */
-const char *symtab_fmt_name_lookup(uintptr_t addr)
-{
-	const char *name = symtab_name_lookup(addr, NULL, &kernel_sections);
-	if (name == NULL)
-		name = "<unknown>";
-	return name;
-}
-
-/** Return address that corresponds to the entry.
- *
- * Search symbol table, and if there is one match, return it
- *
- * @param name Name of the symbol
- * @param addr Place to store symbol address
- *
- * @return Zero on success, ENOENT - not found
- *
- */
-errno_t symtab_addr_lookup(const char *name, uintptr_t *addr)
-{
-	debug_sections_t *scs = &kernel_sections;
-	size_t symtab_len = scs->symtab_size / sizeof(elf_symbol_t);
-
-	for (size_t i = symtab_next(scs, 0); i < symtab_len; i = symtab_next(scs, i + 1)) {
-		if (str_cmp(name, symtab_entry_name(scs, i)) == 0) {
-			*addr = scs->symtab[i].st_value;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Find symbols that match parameter and print them */
-void symtab_print_search(const char *name)
-{
-	debug_sections_t *scs = &kernel_sections;
-	size_t symtab_len = scs->symtab_size / sizeof(elf_symbol_t);
-
-	if (scs->symtab == NULL || scs->strtab == NULL) {
-		printf("No symbol information available.\n");
-		return;
-	}
-
-	size_t namelen = str_length(name);
-
-	for (size_t i = symtab_next(scs, 0); i < symtab_len; i = symtab_next(scs, i + 1)) {
-		const char *n = symtab_entry_name(scs, i);
-
-		if (str_lcmp(name, n, namelen) == 0) {
-			printf("%p: %s\n", (void *) scs->symtab[i].st_value, n);
-		}
-	}
-}
-
-/** Symtab completion enum, see kernel/generic/include/kconsole.h */
-const char *symtab_hints_enum(const char *input, const char **help, void **ctx)
-{
-	debug_sections_t *scs = &kernel_sections;
-	size_t symtab_len = scs->symtab_size / sizeof(elf_symbol_t);
-
-	if (scs->symtab == NULL || scs->strtab == NULL)
-		return NULL;
-
-	if (help)
-		*help = NULL;
-
-	size_t len = str_length(input);
-	for (size_t i = symtab_next(scs, (size_t) *ctx); i < symtab_len; i = symtab_next(scs, i + 1)) {
-		const char *curname = symtab_entry_name(scs, i);
-
-		if (str_lcmp(input, curname, len) == 0) {
-			*ctx = (void *) (i + 1);
-			return (curname + str_lsize(curname, len));
-		}
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: rnel/generic/src/debug/util.c
===================================================================
--- kernel/generic/src/debug/util.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "util.h"
-
-#include <stdio.h>
-#include <debug/sections.h>
-#include <debug/names.h>
-
-bool skip_data(unsigned form, const uint8_t **const data,
-    const uint8_t *data_end, unsigned width)
-{
-	// Skip data we don't care about reading.
-
-	size_t len;
-
-	switch (form) {
-	case DW_FORM_string:
-		skip_string(data, data_end);
-		break;
-
-	case DW_FORM_strp:
-	case DW_FORM_line_strp:
-	case DW_FORM_strp_sup:
-	case DW_FORM_sec_offset:
-		safe_increment(data, data_end, width);
-		break;
-
-	case DW_FORM_strx:
-	case DW_FORM_sdata:
-	case DW_FORM_udata:
-		skip_leb128(data, data_end);
-		break;
-
-	case DW_FORM_strx1:
-	case DW_FORM_data1:
-	case DW_FORM_flag:
-		safe_increment(data, data_end, 1);
-		break;
-
-	case DW_FORM_strx2:
-	case DW_FORM_data2:
-		safe_increment(data, data_end, 2);
-		break;
-
-	case DW_FORM_strx3:
-		safe_increment(data, data_end, 3);
-		break;
-
-	case DW_FORM_strx4:
-	case DW_FORM_data4:
-		safe_increment(data, data_end, 4);
-		break;
-
-	case DW_FORM_data8:
-		safe_increment(data, data_end, 8);
-		break;
-
-	case DW_FORM_data16:
-		safe_increment(data, data_end, 16);
-		break;
-
-	case DW_FORM_block:
-		len = read_uleb128(data, data_end);
-		safe_increment(data, data_end, len);
-		break;
-
-	case DW_FORM_block1:
-		len = read_byte(data, data_end);
-		safe_increment(data, data_end, len);
-		break;
-
-	case DW_FORM_block2:
-		len = read_uint16(data, data_end);
-		safe_increment(data, data_end, len);
-		break;
-
-	case DW_FORM_block4:
-		len = read_uint32(data, data_end);
-		safe_increment(data, data_end, len);
-		break;
-
-	default:
-		// Unknown FORM.
-		*data = data_end;
-		return false;
-	}
-
-	return true;
-}
-
-void print_format(const char *name, const uint8_t *format, const uint8_t *format_end)
-{
-	DEBUGF("%s: ", name);
-
-	while (format < format_end) {
-		uint64_t lnct = read_uleb128(&format, format_end);
-		uint64_t form = read_uleb128(&format, format_end);
-
-		const char *fname = dw_form_name(form);
-
-		if (fname)
-			DEBUGF("%s:%s, ", dw_lnct_name(lnct), fname);
-		else
-			DEBUGF("%s:unknown DW_FORM_(%" PRIu64 "), ", dw_lnct_name(lnct), form);
-	}
-
-	DEBUGF("\n");
-}
-
-void print_formatted_list(debug_sections_t *scs, const char *name,
-    const uint8_t *data, const uint8_t *const data_end,
-    const uint8_t *format, const uint8_t *format_end,
-    unsigned width)
-{
-	DEBUGF("%s: ", name);
-
-	while (data < data_end) {
-		const uint8_t *old_data = data;
-		const uint8_t *format_ptr = format;
-
-		while (format_ptr < format_end) {
-			uint64_t lnct = read_uleb128(&format_ptr, format_end);
-			uint64_t form = read_uleb128(&format_ptr, format_end);
-
-			DEBUGF("%s:%s:", dw_lnct_name(lnct), dw_form_name(form));
-			print_formed_data(scs, form, &data, data_end, width);
-			DEBUGF("\n");
-		}
-
-		if (data <= old_data)
-			break;
-	}
-
-	DEBUGF("\n");
-}
-
-void print_block(const uint8_t **const data,
-    const uint8_t *data_end, unsigned bytes)
-{
-	while (bytes > 0 && *data < data_end) {
-		DEBUGF("%02x ", **data);
-		(*data)++;
-		bytes--;
-	}
-}
-
-void print_formed_data(debug_sections_t *scs, unsigned form, const uint8_t **const data,
-    const uint8_t *data_end, unsigned width)
-{
-	size_t len;
-	uint64_t offset;
-
-	switch (form) {
-	case DW_FORM_string:
-		DEBUGF("\"%s\"", read_string(data, data_end));
-		break;
-
-	case DW_FORM_strp:
-	case DW_FORM_strp_sup:
-		offset = read_uint(data, data_end, width);
-		if (offset >= scs->debug_str_size)
-			DEBUGF("<out of range>");
-		else
-			DEBUGF("\"%s\"", scs->debug_str + offset);
-		break;
-
-	case DW_FORM_line_strp:
-		offset = read_uint(data, data_end, width);
-		if (offset >= scs->debug_line_str_size)
-			DEBUGF("<out of range>");
-		else
-			DEBUGF("\"%s\"", scs->debug_line_str + offset);
-		break;
-
-	case DW_FORM_sec_offset:
-		if (width == 4)
-			DEBUGF("0x%08" PRIx64, read_uint(data, data_end, width));
-		else
-			DEBUGF("0x%016" PRIx64, read_uint(data, data_end, width));
-		break;
-
-	case DW_FORM_strx:
-	case DW_FORM_udata:
-		DEBUGF("%" PRIu64, read_uleb128(data, data_end));
-		break;
-
-	case DW_FORM_sdata:
-		DEBUGF("%" PRId64, read_sleb128(data, data_end));
-		break;
-
-	case DW_FORM_strx1:
-	case DW_FORM_data1:
-	case DW_FORM_flag:
-		DEBUGF("%u", read_byte(data, data_end));
-		break;
-
-	case DW_FORM_strx2:
-	case DW_FORM_data2:
-		DEBUGF("%u", read_uint16(data, data_end));
-		break;
-
-	case DW_FORM_strx3:
-		DEBUGF("%u", read_uint24(data, data_end));
-		break;
-
-	case DW_FORM_strx4:
-	case DW_FORM_data4:
-		DEBUGF("%u", read_uint32(data, data_end));
-		break;
-
-	case DW_FORM_data8:
-		DEBUGF("%" PRIu64, read_uint64(data, data_end));
-		break;
-
-	case DW_FORM_data16:
-		uint64_t data1 = read_uint64(data, data_end);
-		uint64_t data2 = read_uint64(data, data_end);
-		DEBUGF("0x%016" PRIx64 "%016" PRIx64, data2, data1);
-		break;
-
-	case DW_FORM_block:
-		len = read_uleb128(data, data_end);
-		print_block(data, data_end, len);
-		break;
-
-	case DW_FORM_block1:
-		len = read_byte(data, data_end);
-		print_block(data, data_end, len);
-		break;
-
-	case DW_FORM_block2:
-		len = read_uint16(data, data_end);
-		print_block(data, data_end, len);
-		break;
-
-	case DW_FORM_block4:
-		len = read_uint32(data, data_end);
-		print_block(data, data_end, len);
-		break;
-
-	default:
-		DEBUGF("unexpected form");
-		*data = data_end;
-	}
-}
Index: rnel/generic/src/debug/util.h
===================================================================
--- kernel/generic/src/debug/util.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_UTIL_H_
-#define DEBUG_UTIL_H_
-
-#include <assert.h>
-#include <stdint.h>
-#include <debug/constants.h>
-#include <debug/sections.h>
-#include <debug.h>
-
-#define DEBUGF dummy_printf
-
-extern bool skip_data(unsigned, const uint8_t **const, const uint8_t *, unsigned);
-extern void print_format(const char *, const uint8_t *, const uint8_t *);
-extern void print_formatted_list(debug_sections_t *, const char *,
-    const uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *, unsigned);
-
-extern void print_block(const uint8_t **, const uint8_t *, unsigned);
-extern void print_formed_data(debug_sections_t *scs, unsigned, const uint8_t **const, const uint8_t *, unsigned);
-
-static inline uint8_t read_byte(const uint8_t **data, const uint8_t *data_end)
-{
-	if (*data >= data_end) {
-		return 0;
-	} else {
-		return *((*data)++);
-	}
-}
-
-/* Casting to these structures allows us to read unaligned integers safely. */
-struct u16 {
-	uint16_t val;
-} __attribute__((packed));
-
-struct u32 {
-	uint32_t val;
-} __attribute__((packed));
-
-struct u64 {
-	uint64_t val;
-} __attribute__((packed));
-
-static inline uint16_t read_uint16(const uint8_t **data, const uint8_t *data_end)
-{
-	if (*data + 2 > data_end) {
-		/* Safe exit path for malformed input. */
-		*data = data_end;
-		return 0;
-	}
-
-	uint16_t v = ((struct u16 *) *data)->val;
-	*data += 2;
-	return v;
-}
-
-static inline uint32_t read_uint24(const uint8_t **data, const uint8_t *data_end)
-{
-	if (*data + 3 > data_end) {
-		/* Safe exit path for malformed input. */
-		*data = data_end;
-		return 0;
-	}
-
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-	uint32_t v = (*data)[0] | (*data)[1] << 8 | (*data)[2] << 16;
-#else
-	uint32_t v = (*data)[2] | (*data)[1] << 8 | (*data)[0] << 16;
-#endif
-
-	*data += 3;
-	return v;
-}
-
-static inline uint32_t read_uint32(const uint8_t **data, const uint8_t *data_end)
-{
-	if (*data + 4 > data_end) {
-		/* Safe exit path for malformed input. */
-		*data = data_end;
-		return 0;
-	}
-
-	uint32_t v = ((struct u32 *) *data)->val;
-	*data += 4;
-	return v;
-}
-
-static inline uint64_t read_uint64(const uint8_t **data, const uint8_t *data_end)
-{
-	if (*data + 8 > data_end) {
-		/* Safe exit path for malformed input. */
-		*data = data_end;
-		return 0;
-	}
-
-	uint64_t v = ((struct u64 *) *data)->val;
-	*data += 8;
-	return v;
-}
-
-static inline uint64_t read_uint(const uint8_t **data, const uint8_t *data_end, unsigned bytes)
-{
-	switch (bytes) {
-	case 1:
-		return read_byte(data, data_end);
-	case 2:
-		return read_uint16(data, data_end);
-	case 4:
-		return read_uint32(data, data_end);
-	case 8:
-		return read_uint64(data, data_end);
-	default:
-		panic("unimplemented");
-	}
-}
-
-static inline uint64_t read_uleb128(const uint8_t **data, const uint8_t *data_end)
-{
-	uint64_t result = 0;
-	unsigned shift = 0;
-
-	while (*data < data_end) {
-		uint8_t byte = *((*data)++);
-		result |= (byte & 0x7f) << shift;
-		shift += 7;
-
-		if ((byte & 0x80) == 0)
-			break;
-	}
-
-	return result;
-}
-
-static inline int64_t read_sleb128(const uint8_t **data, const uint8_t *data_end)
-{
-	uint64_t result = 0;
-	unsigned shift = 0;
-
-	while (*data < data_end) {
-		uint8_t byte = *((*data)++);
-		result |= (byte & 0x7f) << shift;
-		shift += 7;
-
-		if ((byte & 0x80) == 0) {
-			if (shift < 64 && (byte & 0x40) != 0) {
-				/* sign extend */
-				result |= -(1 << shift);
-			}
-			break;
-		}
-	}
-
-	return (int64_t) result;
-}
-
-static inline void skip_leb128(const uint8_t **data, const uint8_t *data_end)
-{
-	while (*data < data_end) {
-		uint8_t byte = *((*data)++);
-		if ((byte & 0x80) == 0)
-			break;
-	}
-}
-
-static inline uint64_t read_initial_length(const uint8_t **data, const uint8_t *data_end, unsigned *width)
-{
-	uint32_t initial = read_uint32(data, data_end);
-	if (initial == 0xffffffffu) {
-		*width = 8;
-		return read_uint64(data, data_end);
-	} else {
-		*width = 4;
-		return initial;
-	}
-}
-
-static inline const char *read_string(const uint8_t **data, const uint8_t *data_end)
-{
-	const char *start = (const char *) *data;
-
-	// NUL-terminated string.
-	while (*data < data_end && **data != 0)
-		(*data)++;
-
-	if (*data < data_end) {
-		// Skip the terminating zero.
-		(*data)++;
-		return start;
-	} else {
-		// No terminating zero, we can't use this.
-		return NULL;
-	}
-}
-
-static inline void skip_string(const uint8_t **data, const uint8_t *data_end)
-{
-	(void) read_string(data, data_end);
-}
-
-static inline void safe_increment(const uint8_t **data,
-    const uint8_t *data_end, ptrdiff_t increment)
-{
-	assert(data_end >= *data);
-
-	if (increment >= data_end - *data) {
-		*data = data_end;
-	} else {
-		(*data) += increment;
-	}
-}
-
-static inline void skip_format(const uint8_t **data, const uint8_t *const data_end,
-    unsigned count)
-{
-	for (unsigned i = 0; i < count; i++) {
-		(void) read_uleb128(data, data_end);
-		(void) read_uleb128(data, data_end);
-	}
-}
-
-static inline void skip_formatted_entry(const uint8_t **data, const uint8_t *const data_end,
-    const uint8_t *format, const uint8_t *format_end, unsigned width)
-{
-	while (format < format_end) {
-		/* Ignore content type code */
-		(void) read_uleb128(&format, format_end);
-
-		uint64_t form = read_uleb128(&format, format_end);
-		skip_data(form, data, data_end, width);
-	}
-}
-
-static inline void skip_formatted_list(const uint8_t **data, const uint8_t *const data_end,
-    unsigned count,	const uint8_t *format, const uint8_t *format_end,
-    unsigned width)
-{
-	for (unsigned i = 0; i < count; i++) {
-		skip_formatted_entry(data, data_end, format, format_end, width);
-	}
-}
-
-#endif /* DEBUG_UTIL_H_ */
Index: rnel/generic/src/interrupt/interrupt.c
===================================================================
--- kernel/generic/src/interrupt/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,356 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_interrupt
- * @{
- */
-/**
- * @file
- * @brief Interrupt redirector.
- *
- * This file provides means of registering interrupt handlers
- * by kernel functions and calling the handlers when interrupts
- * occur.
- *
- */
-
-#include <assert.h>
-#include <interrupt.h>
-#include <console/kconsole.h>
-#include <console/console.h>
-#include <console/cmd.h>
-#include <synch/mutex.h>
-#include <time/delay.h>
-#include <macros.h>
-#include <panic.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <symtab.h>
-#include <proc/thread.h>
-#include <arch/cycle.h>
-#include <arch/stack.h>
-#include <str.h>
-#include <trace.h>
-
-/*
- * If IVT_ITEMS is zero (e.g. for special/abs32le) we hide completely any
- * access to the exception table array and panic if the function is called
- * at all. It also silences (correct) compiler warnings about possible
- * out-of-bound array access.
- */
-
-exc_table_t exc_table[IVT_ITEMS];
-IRQ_SPINLOCK_INITIALIZE(exctbl_lock);
-
-/** Register exception handler
- *
- * @param n       Exception number.
- * @param name    Description.
- * @param hot     Whether the exception is actually handled
- *                in any meaningful way.
- * @param handler New exception handler.
- *
- * @return Previously registered exception handler.
- *
- */
-iroutine_t exc_register(unsigned int n, const char *name, bool hot,
-    iroutine_t handler)
-{
-#if (IVT_ITEMS > 0)
-	assert(n < IVT_ITEMS);
-
-	irq_spinlock_lock(&exctbl_lock, true);
-
-	iroutine_t old = exc_table[n].handler;
-	exc_table[n].handler = handler;
-	exc_table[n].name = name;
-	exc_table[n].hot = hot;
-	exc_table[n].cycles = 0;
-	exc_table[n].count = 0;
-
-	irq_spinlock_unlock(&exctbl_lock, true);
-
-	return old;
-#else
-	panic("No space for any exception handler, cannot register.");
-#endif
-}
-
-/** Dispatch exception according to exception table
- *
- * Called directly from the assembler code.
- * CPU is interrupts_disable()'d.
- *
- */
-_NO_TRACE void exc_dispatch(unsigned int n, istate_t *istate)
-{
-#if (IVT_ITEMS > 0)
-	assert(n < IVT_ITEMS);
-
-	/* Account user cycles */
-	if (THREAD)
-		thread_update_accounting(true);
-
-	/* Account CPU usage if it woke up from sleep */
-	if (CPU && CPU_LOCAL->idle) {
-		uint64_t now = get_cycle();
-		atomic_time_increment(&CPU->idle_cycles, now - CPU_LOCAL->last_cycle);
-		CPU_LOCAL->last_cycle = now;
-		CPU_LOCAL->idle = false;
-	}
-
-	uint64_t begin_cycle = get_cycle();
-
-#ifdef CONFIG_UDEBUG
-	if (THREAD)
-		THREAD->udebug.uspace_state = istate;
-#endif
-
-	exc_table[n].handler(n + IVT_FIRST, istate);
-
-#ifdef CONFIG_UDEBUG
-	if (THREAD)
-		THREAD->udebug.uspace_state = NULL;
-#endif
-
-	/* This is a safe place to exit exiting thread */
-	if ((THREAD) && (THREAD->interrupted) && (istate_from_uspace(istate)))
-		thread_exit();
-
-	/* Account exception handling */
-	uint64_t end_cycle = get_cycle();
-
-	irq_spinlock_lock(&exctbl_lock, false);
-	exc_table[n].cycles += end_cycle - begin_cycle;
-	exc_table[n].count++;
-	irq_spinlock_unlock(&exctbl_lock, false);
-
-	/* Do not charge THREAD for exception cycles */
-	if (THREAD)
-		THREAD->last_cycle = end_cycle;
-#else
-	panic("No space for any exception handler, yet we want to handle some exception.");
-#endif
-}
-
-/** Default 'null' exception handler
- *
- */
-_NO_TRACE static void exc_undef(unsigned int n, istate_t *istate)
-{
-	fault_if_from_uspace(istate, "Unhandled exception %u.", n);
-	panic_badtrap(istate, n, "Unhandled exception %u.", n);
-}
-
-static _NO_TRACE void
-fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
-{
-	printf("Task %s (%" PRIu64 ") killed due to an exception at "
-	    "program counter %p.\n", TASK->name, TASK->taskid,
-	    (void *) istate_get_pc(istate));
-
-	istate_decode(istate);
-	stack_trace_istate(istate);
-
-	printf("Kill message: ");
-	vprintf(fmt, args);
-	printf("\n");
-
-	task_kill_self(true);
-}
-
-/** Terminate thread and task after the exception came from userspace.
- *
- */
-_NO_TRACE void fault_from_uspace(istate_t *istate, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	fault_from_uspace_core(istate, fmt, args);
-	va_end(args);
-}
-
-/** Terminate thread and task if exception came from userspace.
- *
- */
-_NO_TRACE void fault_if_from_uspace(istate_t *istate, const char *fmt, ...)
-{
-	if (!istate_from_uspace(istate))
-		return;
-
-	va_list args;
-	va_start(args, fmt);
-	fault_from_uspace_core(istate, fmt, args);
-	va_end(args);
-}
-
-/** Get istate structure of a thread.
- *
- * Get pointer to the istate structure at the bottom of the kernel stack.
- *
- * This function can be called in interrupt or user context. In interrupt
- * context the istate structure is created by the low-level exception
- * handler. In user context the istate structure is created by the
- * low-level syscall handler.
- */
-istate_t *istate_get(thread_t *thread)
-{
-	/*
-	 * The istate structure should be right at the bottom of the kernel
-	 * memory stack.
-	 */
-	return (istate_t *) &thread->kstack[MEM_STACK_SIZE - sizeof(istate_t)];
-}
-
-#ifdef CONFIG_KCONSOLE
-
-static char flag_buf[MAX_CMDLINE + 1];
-
-/** Print all exceptions
- *
- */
-_NO_TRACE static int cmd_exc_print(cmd_arg_t *argv)
-{
-	bool excs_all;
-
-	if (str_cmp(flag_buf, "-a") == 0)
-		excs_all = true;
-	else if (str_cmp(flag_buf, "") == 0)
-		excs_all = false;
-	else {
-		printf("Unknown argument \"%s\".\n", flag_buf);
-		return 1;
-	}
-
-#if (IVT_ITEMS > 0)
-	unsigned int i;
-	unsigned int rows;
-
-	irq_spinlock_lock(&exctbl_lock, true);
-
-#ifdef __32_BITS__
-	printf("[exc   ] [description       ] [count   ] [cycles  ]"
-	    " [handler ] [symbol\n");
-	rows = 1;
-#endif
-
-#ifdef __64_BITS__
-	printf("[exc   ] [description       ] [count   ] [cycles  ]"
-	    " [handler         ]\n");
-	printf("         [symbol\n");
-	rows = 2;
-#endif
-
-	for (i = 0; i < IVT_ITEMS; i++) {
-		if ((!excs_all) && (!exc_table[i].hot))
-			continue;
-
-		uint64_t count;
-		char count_suffix;
-
-		order_suffix(exc_table[i].count, &count, &count_suffix);
-
-		uint64_t cycles;
-		char cycles_suffix;
-
-		order_suffix(exc_table[i].cycles, &cycles, &cycles_suffix);
-
-		const char *symbol =
-		    symtab_fmt_name_lookup((sysarg_t) exc_table[i].handler);
-
-#ifdef __32_BITS__
-		printf("%-8u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %10p %s\n",
-		    i + IVT_FIRST, exc_table[i].name, count, count_suffix,
-		    cycles, cycles_suffix, exc_table[i].handler, symbol);
-
-		PAGING(rows, 1, irq_spinlock_unlock(&exctbl_lock, true),
-		    irq_spinlock_lock(&exctbl_lock, true));
-#endif
-
-#ifdef __64_BITS__
-		printf("%-8u %-20s %9" PRIu64 "%c %9" PRIu64 "%c %18p\n",
-		    i + IVT_FIRST, exc_table[i].name, count, count_suffix,
-		    cycles, cycles_suffix, exc_table[i].handler);
-		printf("         %s\n", symbol);
-
-		PAGING(rows, 2, irq_spinlock_unlock(&exctbl_lock, true),
-		    irq_spinlock_lock(&exctbl_lock, true));
-#endif
-	}
-
-	irq_spinlock_unlock(&exctbl_lock, true);
-#else /* (IVT_ITEMS > 0) */
-
-	printf("No exception table%s.\n", excs_all ? " (showing all exceptions)" : "");
-
-#endif /* (IVT_ITEMS > 0) */
-
-	return 1;
-}
-
-static cmd_arg_t exc_argv = {
-	.type = ARG_TYPE_STRING_OPTIONAL,
-	.buffer = flag_buf,
-	.len = sizeof(flag_buf)
-};
-
-static cmd_info_t exc_info = {
-	.name = "exc",
-	.description = "Print exception table (use -a for all exceptions).",
-	.func = cmd_exc_print,
-	.help = NULL,
-	.argc = 1,
-	.argv = &exc_argv
-};
-
-#endif /* CONFIG_KCONSOLE */
-
-/** Initialize generic exception handling support
- *
- */
-void exc_init(void)
-{
-	(void) exc_undef;
-
-#if (IVT_ITEMS > 0)
-	unsigned int i;
-
-	for (i = 0; i < IVT_ITEMS; i++)
-		exc_register(i, "undef", false, (iroutine_t) exc_undef);
-#endif
-
-#ifdef CONFIG_KCONSOLE
-	cmd_initialize(&exc_info);
-	if (!cmd_register(&exc_info))
-		printf("Cannot register command %s\n", exc_info.name);
-#endif
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,390 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/**
- * @file
- * @brief Kernel event notifications.
- */
-
-#include <assert.h>
-#include <ipc/event.h>
-#include <mm/slab.h>
-#include <typedefs.h>
-#include <synch/spinlock.h>
-#include <console/console.h>
-#include <proc/task.h>
-#include <errno.h>
-#include <arch.h>
-
-/** The events array. */
-static event_t events[EVENT_END];
-
-static void event_initialize(event_t *event)
-{
-	spinlock_initialize(&event->lock, "event.lock");
-	event->answerbox = NULL;
-	event->counter = 0;
-	event->imethod = 0;
-	event->masked = false;
-	event->unmask_callback = NULL;
-}
-
-static event_t *evno2event(int evno, task_t *task)
-{
-	assert(evno < EVENT_TASK_END);
-
-	event_t *event;
-
-	if (evno < EVENT_END)
-		event = &events[(event_type_t) evno];
-	else
-		event = &task->events[(event_task_type_t) evno - EVENT_END];
-
-	return event;
-}
-
-/** Initialize kernel events.
- *
- */
-void event_init(void)
-{
-	for (unsigned int i = 0; i < EVENT_END; i++)
-		event_initialize(evno2event(i, NULL));
-}
-
-void event_task_init(task_t *task)
-{
-	for (unsigned int i = EVENT_END; i < EVENT_TASK_END; i++)
-		event_initialize(evno2event(i, task));
-}
-
-/** Unsubscribe kernel events associated with an answerbox
- *
- * @param answerbox Answerbox to be unsubscribed.
- *
- */
-void event_cleanup_answerbox(answerbox_t *answerbox)
-{
-	for (unsigned int i = 0; i < EVENT_END; i++) {
-		spinlock_lock(&events[i].lock);
-
-		if (events[i].answerbox == answerbox) {
-			events[i].answerbox = NULL;
-			events[i].counter = 0;
-			events[i].imethod = 0;
-			events[i].masked = false;
-		}
-
-		spinlock_unlock(&events[i].lock);
-	}
-}
-
-static void _event_set_unmask_callback(event_t *event, event_callback_t callback)
-{
-	spinlock_lock(&event->lock);
-	event->unmask_callback = callback;
-	spinlock_unlock(&event->lock);
-}
-
-/** Define a callback function for the event unmask event.
- *
- * @param evno     Event type.
- * @param callback Callback function to be called when
- *                 the event is unmasked.
- *
- */
-void event_set_unmask_callback(event_type_t evno, event_callback_t callback)
-{
-	assert(evno < EVENT_END);
-
-	_event_set_unmask_callback(evno2event(evno, NULL), callback);
-}
-
-void event_task_set_unmask_callback(task_t *task, event_task_type_t evno,
-    event_callback_t callback)
-{
-	assert(evno >= (int) EVENT_END);
-	assert(evno < EVENT_TASK_END);
-
-	_event_set_unmask_callback(evno2event(evno, task), callback);
-}
-
-static errno_t event_enqueue(event_t *event, bool mask, sysarg_t a1, sysarg_t a2,
-    sysarg_t a3, sysarg_t a4, sysarg_t a5)
-{
-	errno_t res;
-
-	spinlock_lock(&event->lock);
-
-	if (event->answerbox != NULL) {
-		if (!event->masked) {
-			call_t *call = ipc_call_alloc();
-
-			if (call) {
-				call->flags |= IPC_CALL_NOTIF;
-				call->priv = ++event->counter;
-
-				ipc_set_imethod(&call->data, event->imethod);
-				ipc_set_arg1(&call->data, a1);
-				ipc_set_arg2(&call->data, a2);
-				ipc_set_arg3(&call->data, a3);
-				ipc_set_arg4(&call->data, a4);
-				ipc_set_arg5(&call->data, a5);
-
-				call->data.task_id = TASK ? TASK->taskid : 0;
-
-				irq_spinlock_lock(&event->answerbox->irq_lock,
-				    true);
-				list_append(&call->ab_link,
-				    &event->answerbox->irq_notifs);
-				irq_spinlock_unlock(&event->answerbox->irq_lock,
-				    true);
-
-				waitq_wake_one(&event->answerbox->wq);
-
-				if (mask)
-					event->masked = true;
-
-				res = EOK;
-			} else
-				res = ENOMEM;
-		} else
-			res = EBUSY;
-	} else
-		res = ENOENT;
-
-	spinlock_unlock(&event->lock);
-	return res;
-}
-
-/** Send kernel notification event
- *
- * @param evno Event type.
- * @param mask Mask further notifications after a successful
- *             sending.
- * @param a1   First argument.
- * @param a2   Second argument.
- * @param a3   Third argument.
- * @param a4   Fourth argument.
- * @param a5   Fifth argument.
- *
- * @return EOK if notification was successfully sent.
- * @return ENOMEM if the notification IPC message failed to allocate.
- * @return EBUSY if the notifications of the given type are
- *         currently masked.
- * @return ENOENT if the notifications of the given type are
- *         currently not subscribed.
- *
- */
-errno_t event_notify(event_type_t evno, bool mask, sysarg_t a1, sysarg_t a2,
-    sysarg_t a3, sysarg_t a4, sysarg_t a5)
-{
-	assert(evno < EVENT_END);
-
-	return event_enqueue(evno2event(evno, NULL), mask, a1, a2, a3, a4, a5);
-}
-
-/** Send per-task kernel notification event
- *
- * @param task Destination task.
- * @param evno Event type.
- * @param mask Mask further notifications after a successful
- *             sending.
- * @param a1   First argument.
- * @param a2   Second argument.
- * @param a3   Third argument.
- * @param a4   Fourth argument.
- * @param a5   Fifth argument.
- *
- * @return EOK if notification was successfully sent.
- * @return ENOMEM if the notification IPC message failed to allocate.
- * @return EBUSY if the notifications of the given type are
- *         currently masked.
- * @return ENOENT if the notifications of the given type are
- *         currently not subscribed.
- *
- */
-errno_t event_task_notify(task_t *task, event_task_type_t evno, bool mask,
-    sysarg_t a1, sysarg_t a2, sysarg_t a3, sysarg_t a4, sysarg_t a5)
-{
-	assert(evno >= (int) EVENT_END);
-	assert(evno < EVENT_TASK_END);
-
-	return event_enqueue(evno2event(evno, task), mask, a1, a2, a3, a4, a5);
-}
-
-/** Subscribe event notifications
- *
- * @param evno      Event type.
- * @param imethod   IPC interface and method to be used for
- *                  the notifications.
- * @param answerbox Answerbox to send the notifications to.
- *
- * @return EOK if the subscription was successful.
- * @return EEXIST if the notifications of the given type are
- *         already subscribed.
- *
- */
-static errno_t event_subscribe(event_t *event, sysarg_t imethod,
-    answerbox_t *answerbox)
-{
-	errno_t res;
-
-	spinlock_lock(&event->lock);
-
-	if (event->answerbox == NULL) {
-		event->answerbox = answerbox;
-		event->imethod = imethod;
-		event->counter = 0;
-		event->masked = false;
-		res = EOK;
-	} else
-		res = EEXIST;
-
-	spinlock_unlock(&event->lock);
-
-	return res;
-}
-
-/** Unsubscribe event notifications
- *
- * @param evno      Event type.
- * @param answerbox Answerbox used to send the notifications to.
- *
- * @return EOK if the subscription was successful.
- * @return EEXIST if the notifications of the given type are
- *         already subscribed.
- *
- */
-static errno_t event_unsubscribe(event_t *event, answerbox_t *answerbox)
-{
-	errno_t res;
-
-	spinlock_lock(&event->lock);
-
-	if (event->answerbox == answerbox) {
-		event->answerbox = NULL;
-		event->counter = 0;
-		event->imethod = 0;
-		event->masked = false;
-		res = EOK;
-	} else
-		res = ENOENT;
-
-	spinlock_unlock(&event->lock);
-
-	return res;
-}
-
-/** Unmask event notifications
- *
- * @param evno Event type to unmask.
- *
- */
-static void event_unmask(event_t *event)
-{
-	spinlock_lock(&event->lock);
-	event->masked = false;
-	event_callback_t callback = event->unmask_callback;
-	spinlock_unlock(&event->lock);
-
-	/*
-	 * Check if there is an unmask callback
-	 * function defined for this event.
-	 */
-	if (callback != NULL)
-		callback(event);
-}
-
-/** Event notification subscription syscall wrapper
- *
- * @param evno    Event type to subscribe.
- * @param imethod IPC interface and method to be used for
- *                the notifications.
- *
- * @return EOK on success.
- * @return ELIMIT on unknown event type.
- * @return EEXIST if the notifications of the given type are
- *         already subscribed.
- *
- */
-sys_errno_t sys_ipc_event_subscribe(sysarg_t evno, sysarg_t imethod)
-{
-	if (evno >= EVENT_TASK_END)
-		return ELIMIT;
-
-	return (sys_errno_t) event_subscribe(evno2event(evno, TASK),
-	    (sysarg_t) imethod, &TASK->answerbox);
-}
-
-/** Event notification unsubscription syscall wrapper
- *
- * @param evno    Event type to unsubscribe.
- *
- * @return EOK on success.
- * @return ELIMIT on unknown event type.
- * @return ENOENT if the notification of the given type is not
- *         subscribed.
- */
-sys_errno_t sys_ipc_event_unsubscribe(sysarg_t evno)
-{
-	if (evno >= EVENT_TASK_END)
-		return ELIMIT;
-
-	return (sys_errno_t) event_unsubscribe(evno2event(evno, TASK),
-	    &TASK->answerbox);
-}
-
-/** Event notification unmask syscall wrapper
- *
- * Note that currently no tests are performed whether the calling
- * task is entitled to unmask the notifications. However, thanks
- * to the fact that notification masking is only a performance
- * optimization, this has probably no security implications.
- *
- * @param evno Event type to unmask.
- *
- * @return EOK on success.
- * @return ELIMIT on unknown event type.
- *
- */
-sys_errno_t sys_ipc_event_unmask(sysarg_t evno)
-{
-	if (evno >= EVENT_TASK_END)
-		return ELIMIT;
-
-	event_unmask(evno2event(evno, TASK));
-
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1008 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-/*
- * Lock ordering
- *
- * First the answerbox, then the phone.
- */
-
-#include <assert.h>
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <synch/waitq.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <abi/ipc/methods.h>
-#include <ipc/kbox.h>
-#include <ipc/event.h>
-#include <ipc/sysipc_ops.h>
-#include <ipc/sysipc_priv.h>
-#include <errno.h>
-#include <mm/slab.h>
-#include <arch.h>
-#include <proc/task.h>
-#include <memw.h>
-#include <stdio.h>
-#include <console/console.h>
-#include <proc/thread.h>
-#include <arch/interrupt.h>
-#include <ipc/irq.h>
-#include <cap/cap.h>
-#include <stdlib.h>
-
-static void ipc_forget_call(call_t *);
-
-/** Answerbox that new tasks are automatically connected to */
-answerbox_t *ipc_box_0 = NULL;
-
-static slab_cache_t *call_cache;
-static slab_cache_t *answerbox_cache;
-
-slab_cache_t *phone_cache = NULL;
-
-/** Initialize a call structure.
- *
- * @param call Call structure to be initialized.
- *
- */
-static void _ipc_call_init(call_t *call)
-{
-	memsetb(call, sizeof(*call), 0);
-	spinlock_initialize(&call->forget_lock, "forget_lock");
-	call->active = false;
-	call->forget = false;
-	call->sender = NULL;
-	call->callerbox = NULL;
-	call->buffer = NULL;
-}
-
-static void call_destroy(void *arg)
-{
-	call_t *call = (call_t *) arg;
-
-	if (call->buffer)
-		free(call->buffer);
-	if (call->caller_phone)
-		kobject_put(call->caller_phone->kobject);
-	slab_free(call_cache, call);
-}
-
-kobject_ops_t call_kobject_ops = {
-	.destroy = call_destroy
-};
-
-/** Allocate and initialize a call structure.
- *
- * The call is initialized, so that the reply will be directed to
- * TASK->answerbox.
- *
- * @return Initialized kernel call structure with one reference, or NULL.
- *
- */
-call_t *ipc_call_alloc(void)
-{
-	// TODO: Allocate call and kobject in single allocation
-
-	call_t *call = slab_alloc(call_cache, FRAME_ATOMIC);
-	if (!call)
-		return NULL;
-
-	kobject_t *kobj = kobject_alloc(0);
-	if (!kobj) {
-		slab_free(call_cache, call);
-		return NULL;
-	}
-
-	_ipc_call_init(call);
-	kobject_initialize(kobj, KOBJECT_TYPE_CALL, call);
-	call->kobject = kobj;
-
-	return call;
-}
-
-/** Initialize an answerbox structure.
- *
- * @param box  Answerbox structure to be initialized.
- * @param task Task to which the answerbox belongs.
- *
- */
-void ipc_answerbox_init(answerbox_t *box, task_t *task)
-{
-	irq_spinlock_initialize(&box->lock, "ipc.box.lock");
-	irq_spinlock_initialize(&box->irq_lock, "ipc.box.irqlock");
-	waitq_initialize(&box->wq);
-	list_initialize(&box->connected_phones);
-	list_initialize(&box->calls);
-	list_initialize(&box->dispatched_calls);
-	list_initialize(&box->answers);
-	list_initialize(&box->irq_notifs);
-	atomic_store(&box->active_calls, 0);
-	box->task = task;
-}
-
-/** Connect a phone to an answerbox.
- *
- * This function must be passed a reference to phone->kobject.
- *
- * @param phone  Initialized phone structure.
- * @param box    Initialized answerbox structure.
- * @return       True if the phone was connected, false otherwise.
- */
-bool ipc_phone_connect(phone_t *phone, answerbox_t *box)
-{
-	bool connected;
-
-	mutex_lock(&phone->lock);
-	irq_spinlock_lock(&box->lock, true);
-
-	connected = box->active && (phone->state == IPC_PHONE_CONNECTING);
-	if (connected) {
-		phone->state = IPC_PHONE_CONNECTED;
-		phone->callee = box;
-		/* Pass phone->kobject reference to box->connected_phones */
-		list_append(&phone->link, &box->connected_phones);
-	}
-
-	irq_spinlock_unlock(&box->lock, true);
-	mutex_unlock(&phone->lock);
-
-	if (!connected) {
-		/* We still have phone->kobject's reference; drop it */
-		kobject_put(phone->kobject);
-	}
-
-	return connected;
-}
-
-/** Initialize a phone structure.
- *
- * @param phone Phone structure to be initialized.
- * @param caller Owning task.
- *
- */
-void ipc_phone_init(phone_t *phone, task_t *caller)
-{
-	mutex_initialize(&phone->lock, MUTEX_PASSIVE);
-	phone->caller = caller;
-	phone->callee = NULL;
-	phone->state = IPC_PHONE_FREE;
-	atomic_store(&phone->active_calls, 0);
-	phone->label = 0;
-	phone->kobject = NULL;
-}
-
-/** Helper function to facilitate synchronous calls.
- *
- * @param phone   Destination kernel phone structure.
- * @param request Call structure with request.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t ipc_call_sync(phone_t *phone, call_t *request)
-{
-	answerbox_t *mybox = slab_alloc(answerbox_cache, FRAME_ATOMIC);
-	if (!mybox)
-		return ENOMEM;
-
-	ipc_answerbox_init(mybox, TASK);
-
-	/* We will receive data in a special box. */
-	request->callerbox = mybox;
-
-	errno_t rc = ipc_call(phone, request);
-	if (rc != EOK) {
-		slab_free(answerbox_cache, mybox);
-		return rc;
-	}
-
-	call_t *answer = NULL;
-	(void) ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
-	    SYNCH_FLAGS_INTERRUPTIBLE, &answer);
-	if (!answer) {
-
-		/*
-		 * The sleep was interrupted.
-		 *
-		 * There are two possibilities now:
-		 * 1) the call gets answered before we manage to forget it
-		 * 2) we manage to forget the call before it gets answered
-		 */
-
-		spinlock_lock(&request->forget_lock);
-		spinlock_lock(&TASK->active_calls_lock);
-
-		assert(!request->forget);
-
-		bool answered = !request->active;
-		if (!answered) {
-			/*
-			 * The call is not yet answered and we won the race to
-			 * forget it.
-			 */
-			ipc_forget_call(request);	/* releases locks */
-			rc = EINTR;
-
-		} else {
-			spinlock_unlock(&TASK->active_calls_lock);
-			spinlock_unlock(&request->forget_lock);
-		}
-
-		if (answered) {
-			/*
-			 * The other side won the race to answer the call.
-			 * It is safe to wait for the answer uninterruptibly
-			 * now.
-			 */
-			(void) ipc_wait_for_call(mybox, SYNCH_NO_TIMEOUT,
-			    SYNCH_FLAGS_NONE, &answer);
-		}
-	}
-	assert(!answer || request == answer);
-
-	slab_free(answerbox_cache, mybox);
-	return rc;
-}
-
-/** Answer a message which was not dispatched and is not listed in any queue.
- *
- * @param call       Call structure to be answered.
- * @param selflocked If true, then TASK->answebox is locked.
- *
- */
-void _ipc_answer_free_call(call_t *call, bool selflocked)
-{
-	/* Count sent answer */
-	irq_spinlock_lock(&TASK->lock, true);
-	TASK->ipc_info.answer_sent++;
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	spinlock_lock(&call->forget_lock);
-	if (call->forget) {
-		/* This is a forgotten call and call->sender is not valid. */
-		spinlock_unlock(&call->forget_lock);
-		kobject_put(call->kobject);
-		return;
-	} else {
-		/*
-		 * If the call is still active, i.e. it was answered
-		 * in a non-standard way, remove the call from the
-		 * sender's active call list.
-		 */
-		if (call->active) {
-			spinlock_lock(&call->sender->active_calls_lock);
-			list_remove(&call->ta_link);
-			spinlock_unlock(&call->sender->active_calls_lock);
-		}
-	}
-	spinlock_unlock(&call->forget_lock);
-
-	answerbox_t *callerbox = call->callerbox ? call->callerbox :
-	    &call->sender->answerbox;
-	bool do_lock = ((!selflocked) || (callerbox != &TASK->answerbox));
-
-	call->flags |= IPC_CALL_ANSWERED;
-
-	call->data.task_id = TASK->taskid;
-
-	if (do_lock)
-		irq_spinlock_lock(&callerbox->lock, true);
-
-	list_append(&call->ab_link, &callerbox->answers);
-
-	if (do_lock)
-		irq_spinlock_unlock(&callerbox->lock, true);
-
-	waitq_wake_one(&callerbox->wq);
-}
-
-/** Answer a message which is in a callee queue.
- *
- * @param box  Answerbox that is answering the message.
- * @param call Modified request that is being sent back.
- *
- */
-void ipc_answer(answerbox_t *box, call_t *call)
-{
-	/* Remove from active box */
-	irq_spinlock_lock(&box->lock, true);
-	list_remove(&call->ab_link);
-	irq_spinlock_unlock(&box->lock, true);
-
-	/* Send back answer */
-	_ipc_answer_free_call(call, false);
-}
-
-static void _ipc_call_actions_internal(phone_t *phone, call_t *call,
-    bool preforget)
-{
-	task_t *caller = phone->caller;
-
-	call->caller_phone = phone;
-	kobject_add_ref(phone->kobject);
-
-	if (preforget) {
-		call->forget = true;
-	} else {
-		atomic_inc(&phone->active_calls);
-		if (call->callerbox)
-			atomic_inc(&call->callerbox->active_calls);
-		else
-			atomic_inc(&caller->answerbox.active_calls);
-		kobject_add_ref(phone->kobject);
-		call->sender = caller;
-		call->active = true;
-		spinlock_lock(&caller->active_calls_lock);
-		list_append(&call->ta_link, &caller->active_calls);
-		spinlock_unlock(&caller->active_calls_lock);
-	}
-
-	call->data.request_label = phone->label;
-	call->data.task_id = caller->taskid;
-}
-
-/** Simulate sending back a message.
- *
- * Most errors are better handled by forming a normal backward
- * message and sending it as a normal answer.
- *
- * @param phone Phone structure the call should appear to come from.
- * @param call  Call structure to be answered.
- * @param err   Return value to be used for the answer.
- *
- */
-void ipc_backsend_err(phone_t *phone, call_t *call, errno_t err)
-{
-	_ipc_call_actions_internal(phone, call, false);
-	ipc_set_retval(&call->data, err);
-	_ipc_answer_free_call(call, false);
-}
-
-/** Unsafe unchecking version of ipc_call.
- *
- * @param phone     Phone structure the call comes from.
- * @param box       Destination answerbox structure.
- * @param call      Call structure with request.
- * @param preforget If true, the call will be delivered already forgotten.
- *
- */
-static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call,
-    bool preforget)
-{
-	task_t *caller = phone->caller;
-
-	/* Count sent ipc call */
-	irq_spinlock_lock(&caller->lock, true);
-	caller->ipc_info.call_sent++;
-	irq_spinlock_unlock(&caller->lock, true);
-
-	if (!(call->flags & IPC_CALL_FORWARDED))
-		_ipc_call_actions_internal(phone, call, preforget);
-
-	irq_spinlock_lock(&box->lock, true);
-	list_append(&call->ab_link, &box->calls);
-	irq_spinlock_unlock(&box->lock, true);
-
-	waitq_wake_one(&box->wq);
-}
-
-/** Send an asynchronous request using a phone to an answerbox.
- *
- * @param phone Phone structure the call comes from and which is
- *              connected to the destination answerbox.
- * @param call  Call structure with request.
- *
- * @return Return 0 on success, ENOENT on error.
- *
- */
-errno_t ipc_call(phone_t *phone, call_t *call)
-{
-	mutex_lock(&phone->lock);
-	if (phone->state != IPC_PHONE_CONNECTED) {
-		mutex_unlock(&phone->lock);
-		if (!(call->flags & IPC_CALL_FORWARDED)) {
-			if (phone->state == IPC_PHONE_HUNGUP)
-				ipc_backsend_err(phone, call, EHANGUP);
-			else
-				ipc_backsend_err(phone, call, ENOENT);
-		}
-
-		return ENOENT;
-	}
-
-	answerbox_t *box = phone->callee;
-	_ipc_call(phone, box, call, false);
-
-	mutex_unlock(&phone->lock);
-	return 0;
-}
-
-/** Disconnect phone from answerbox.
- *
- * This call leaves the phone in the hung-up state. The phone is destroyed when
- * its last active call is answered and there are no references to it.
- *
- * @param phone Phone structure to be hung up.
- *
- * @return EOK if the phone is disconnected.
- * @return EINVAL if the phone was already disconnected.
- *
- */
-errno_t ipc_phone_hangup(phone_t *phone)
-{
-	mutex_lock(&phone->lock);
-	if (phone->state == IPC_PHONE_FREE ||
-	    phone->state == IPC_PHONE_HUNGUP ||
-	    phone->state == IPC_PHONE_CONNECTING) {
-		mutex_unlock(&phone->lock);
-		return EINVAL;
-	}
-
-	answerbox_t *box = phone->callee;
-	if (phone->state != IPC_PHONE_SLAMMED) {
-		/* Remove myself from answerbox */
-		irq_spinlock_lock(&box->lock, true);
-		list_remove(&phone->link);
-		irq_spinlock_unlock(&box->lock, true);
-
-		/* Drop the answerbox reference */
-		kobject_put(phone->kobject);
-
-		call_t *call = phone->hangup_call;
-		phone->hangup_call = NULL;
-		assert(call);
-
-		ipc_set_imethod(&call->data, IPC_M_PHONE_HUNGUP);
-		call->request_method = IPC_M_PHONE_HUNGUP;
-		call->flags |= IPC_CALL_DISCARD_ANSWER;
-		_ipc_call(phone, box, call, false);
-	}
-
-	phone->state = IPC_PHONE_HUNGUP;
-	mutex_unlock(&phone->lock);
-
-	return EOK;
-}
-
-/** Forwards call from one answerbox to another one.
- *
- * @param call     Call structure to be redirected.
- * @param newphone Phone structure to target answerbox.
- * @param oldbox   Old answerbox structure.
- * @param mode     Flags that specify mode of the forward operation.
- *
- * @return 0 if forwarding succeeded or an error code if
- *         there was an error.
- *
- * The return value serves only as an information for the forwarder,
- * the original caller is notified automatically with EFORWARD.
- *
- */
-errno_t ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox,
-    unsigned int mode)
-{
-	/* Count forwarded calls */
-	irq_spinlock_lock(&TASK->lock, true);
-	TASK->ipc_info.forwarded++;
-	irq_spinlock_pass(&TASK->lock, &oldbox->lock);
-	list_remove(&call->ab_link);
-	irq_spinlock_unlock(&oldbox->lock, true);
-
-	if (mode & IPC_FF_ROUTE_FROM_ME) {
-		call->data.request_label = newphone->label;
-		call->data.task_id = TASK->taskid;
-	}
-
-	return ipc_call(newphone, call);
-}
-
-/** Wait for a phone call.
- *
- * @param box   Answerbox expecting the call.
- * @param usec  Timeout in microseconds. See documentation for
- *              waitq_sleep_timeout() for decription of its special
- *              meaning.
- * @param flags Select mode of sleep operation. See documentation for
- *              waitq_sleep_timeout() for description of its special
- *              meaning.
- * @param call  Received call structure or NULL.
- *
- * @return Error code from waitq_sleep_timeout.
- *         ENOENT if sleep returns successfully, but there is no call.
- *
- * To distinguish between a call and an answer, have a look at call->flags.
- *
- */
-errno_t ipc_wait_for_call(answerbox_t *box, uint32_t usec, unsigned int flags,
-    call_t **call)
-{
-	call_t *request;
-	uint64_t irq_cnt = 0;
-	uint64_t answer_cnt = 0;
-	uint64_t call_cnt = 0;
-	errno_t rc;
-
-	rc = _waitq_sleep_timeout(&box->wq, usec, flags);
-	if (rc != EOK)
-		return rc;
-
-	irq_spinlock_lock(&box->lock, true);
-	if (!list_empty(&box->irq_notifs)) {
-		/* Count received IRQ notification */
-		irq_cnt++;
-
-		irq_spinlock_lock(&box->irq_lock, false);
-
-		request = list_get_instance(list_first(&box->irq_notifs),
-		    call_t, ab_link);
-		list_remove(&request->ab_link);
-
-		irq_spinlock_unlock(&box->irq_lock, false);
-	} else if (!list_empty(&box->answers)) {
-		/* Count received answer */
-		answer_cnt++;
-
-		/* Handle asynchronous answers */
-		request = list_get_instance(list_first(&box->answers),
-		    call_t, ab_link);
-		list_remove(&request->ab_link);
-		atomic_dec(&request->caller_phone->active_calls);
-		atomic_dec(&box->active_calls);
-		kobject_put(request->caller_phone->kobject);
-	} else if (!list_empty(&box->calls)) {
-		/* Count received call */
-		call_cnt++;
-
-		/* Handle requests */
-		request = list_get_instance(list_first(&box->calls),
-		    call_t, ab_link);
-		list_remove(&request->ab_link);
-
-		/* Append request to dispatch queue */
-		list_append(&request->ab_link, &box->dispatched_calls);
-	} else {
-		/*
-		 * This can happen regularly after ipc_cleanup, or in
-		 * response to ipc_poke(). Let the caller sort out the wakeup.
-		 */
-		irq_spinlock_unlock(&box->lock, true);
-		return ENOENT;
-	}
-
-	irq_spinlock_pass(&box->lock, &TASK->lock);
-
-	TASK->ipc_info.irq_notif_received += irq_cnt;
-	TASK->ipc_info.answer_received += answer_cnt;
-	TASK->ipc_info.call_received += call_cnt;
-
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	*call = request;
-	return EOK;
-}
-
-/** Answer all calls from list with EHANGUP answer.
- *
- * @param box Answerbox with the list.
- * @param lst Head of the list to be cleaned up.
- */
-void ipc_cleanup_call_list(answerbox_t *box, list_t *lst)
-{
-	irq_spinlock_lock(&box->lock, true);
-	while (!list_empty(lst)) {
-		call_t *call = list_get_instance(list_first(lst), call_t,
-		    ab_link);
-
-		list_remove(&call->ab_link);
-
-		irq_spinlock_unlock(&box->lock, true);
-
-		if (lst == &box->calls)
-			SYSIPC_OP(request_process, call, box);
-
-		ipc_data_t old = call->data;
-		ipc_set_retval(&call->data, EHANGUP);
-		answer_preprocess(call, &old);
-		_ipc_answer_free_call(call, true);
-
-		irq_spinlock_lock(&box->lock, true);
-	}
-	irq_spinlock_unlock(&box->lock, true);
-}
-
-/** Disconnects all phones connected to an answerbox.
- *
- * @param box        Answerbox to disconnect phones from.
- * @param notify_box If true, the answerbox will get a hangup message for
- *                   each disconnected phone.
- *
- */
-void ipc_answerbox_slam_phones(answerbox_t *box, bool notify_box)
-{
-	phone_t *phone;
-	DEADLOCK_PROBE_INIT(p_phonelck);
-
-	/* Disconnect all phones connected to our answerbox */
-restart_phones:
-	irq_spinlock_lock(&box->lock, true);
-	while (!list_empty(&box->connected_phones)) {
-		phone = list_get_instance(list_first(&box->connected_phones),
-		    phone_t, link);
-		if (mutex_trylock(&phone->lock) != EOK) {
-			irq_spinlock_unlock(&box->lock, true);
-			DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
-			goto restart_phones;
-		}
-
-		/* Disconnect phone */
-		assert(phone->state == IPC_PHONE_CONNECTED);
-
-		list_remove(&phone->link);
-		phone->state = IPC_PHONE_SLAMMED;
-		phone->label = 0;
-
-		if (notify_box) {
-			task_hold(phone->caller);
-			mutex_unlock(&phone->lock);
-			irq_spinlock_unlock(&box->lock, true);
-
-			/*
-			 * Send one call to the answerbox for each phone.
-			 * Used to make sure the kbox thread wakes up after
-			 * the last phone has been disconnected. The call is
-			 * forgotten upon sending, so the "caller" may cease
-			 * to exist as soon as we release it.
-			 */
-			call_t *call = phone->hangup_call;
-			phone->hangup_call = NULL;
-			assert(call);
-
-			ipc_set_imethod(&call->data, IPC_M_PHONE_HUNGUP);
-			call->request_method = IPC_M_PHONE_HUNGUP;
-			call->flags |= IPC_CALL_DISCARD_ANSWER;
-			_ipc_call(phone, box, call, true);
-
-			task_release(phone->caller);
-
-			kobject_put(phone->kobject);
-
-			/* Must start again */
-			goto restart_phones;
-		}
-
-		mutex_unlock(&phone->lock);
-		kobject_put(phone->kobject);
-	}
-
-	irq_spinlock_unlock(&box->lock, true);
-}
-
-static void ipc_forget_call(call_t *call)
-{
-	assert(spinlock_locked(&TASK->active_calls_lock));
-	assert(spinlock_locked(&call->forget_lock));
-
-	/*
-	 * Forget the call and donate it to the task which holds up the answer.
-	 */
-
-	call->forget = true;
-	call->sender = NULL;
-	list_remove(&call->ta_link);
-
-	/*
-	 * The call may be freed by _ipc_answer_free_call() before we are done
-	 * with it; to avoid working with a destroyed call_t structure, we
-	 * must hold a reference to it.
-	 */
-	kobject_add_ref(call->kobject);
-
-	spinlock_unlock(&call->forget_lock);
-	spinlock_unlock(&TASK->active_calls_lock);
-
-	atomic_dec(&call->caller_phone->active_calls);
-	atomic_dec(&TASK->answerbox.active_calls);
-	kobject_put(call->caller_phone->kobject);
-
-	SYSIPC_OP(request_forget, call);
-
-	kobject_put(call->kobject);
-}
-
-static void ipc_forget_all_active_calls(void)
-{
-	call_t *call;
-
-restart:
-	spinlock_lock(&TASK->active_calls_lock);
-	if (list_empty(&TASK->active_calls)) {
-		/*
-		 * We are done, there are no more active calls.
-		 * Nota bene: there may still be answers waiting for pick up.
-		 */
-		spinlock_unlock(&TASK->active_calls_lock);
-		return;
-	}
-
-	call = list_get_instance(list_first(&TASK->active_calls), call_t,
-	    ta_link);
-
-	if (!spinlock_trylock(&call->forget_lock)) {
-		/*
-		 * Avoid deadlock and let async_answer() or
-		 *  _ipc_answer_free_call() win the race to dequeue the first
-		 * call on the list.
-		 */
-		spinlock_unlock(&TASK->active_calls_lock);
-		goto restart;
-	}
-
-	ipc_forget_call(call);
-
-	goto restart;
-}
-
-static bool phone_cap_cleanup_cb(cap_t *cap, void *arg)
-{
-	ipc_phone_hangup(cap->kobject->phone);
-	kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
-	    KOBJECT_TYPE_PHONE);
-	kobject_put(kobj);
-	cap_free(cap->task, cap->handle);
-	return true;
-}
-
-/** Wait for all answers to asynchronous calls to arrive. */
-static void ipc_wait_for_all_answered_calls(void)
-{
-	while (atomic_load(&TASK->answerbox.active_calls) != 0) {
-		call_t *call = NULL;
-		if (ipc_wait_for_call(&TASK->answerbox,
-		    SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE, &call) == ENOENT)
-			continue;
-		assert(call);
-		assert(call->flags & (IPC_CALL_ANSWERED | IPC_CALL_NOTIF));
-
-		SYSIPC_OP(answer_process, call);
-
-		kobject_put(call->kobject);
-
-		/*
-		 * Now there may be some new phones and new hangup calls to
-		 * immediately forget.
-		 */
-		caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_PHONE,
-		    phone_cap_cleanup_cb, NULL);
-		ipc_forget_all_active_calls();
-	}
-}
-
-static bool irq_cap_cleanup_cb(cap_t *cap, void *arg)
-{
-	ipc_irq_unsubscribe(&TASK->answerbox, cap->handle);
-	return true;
-}
-
-static bool call_cap_cleanup_cb(cap_t *cap, void *arg)
-{
-	/*
-	 * Here we just free the capability and release the kobject.
-	 * The kernel answers the remaining calls elsewhere in ipc_cleanup().
-	 */
-	kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
-	    KOBJECT_TYPE_CALL);
-	kobject_put(kobj);
-	cap_free(cap->task, cap->handle);
-	return true;
-}
-
-/** Clean up all IPC communication of the current task.
- *
- * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
- * have to change it as well if you want to cleanup other tasks than TASK.
- *
- */
-void ipc_cleanup(void)
-{
-	/*
-	 * Mark the answerbox as inactive.
-	 *
-	 * The main purpose for doing this is to prevent any pending callback
-	 * connections from getting established beyond this point.
-	 */
-	irq_spinlock_lock(&TASK->answerbox.lock, true);
-	TASK->answerbox.active = false;
-	irq_spinlock_unlock(&TASK->answerbox.lock, true);
-
-	/* Hangup all phones and destroy all phone capabilities */
-	caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_PHONE,
-	    phone_cap_cleanup_cb, NULL);
-
-	/* Unsubscribe from any event notifications */
-	event_cleanup_answerbox(&TASK->answerbox);
-
-	/* Disconnect all connected IRQs */
-	caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_IRQ, irq_cap_cleanup_cb,
-	    NULL);
-
-	/* Disconnect all phones connected to our regular answerbox */
-	ipc_answerbox_slam_phones(&TASK->answerbox, false);
-
-#ifdef CONFIG_UDEBUG
-	/* Clean up kbox thread and communications */
-	ipc_kbox_cleanup();
-#endif
-
-	/* Destroy all call capabilities */
-	caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_CALL, call_cap_cleanup_cb,
-	    NULL);
-
-	/* Answer all messages in 'calls' and 'dispatched_calls' queues */
-	ipc_cleanup_call_list(&TASK->answerbox, &TASK->answerbox.calls);
-	ipc_cleanup_call_list(&TASK->answerbox,
-	    &TASK->answerbox.dispatched_calls);
-
-	ipc_forget_all_active_calls();
-	ipc_wait_for_all_answered_calls();
-
-	assert(atomic_load(&TASK->answerbox.active_calls) == 0);
-}
-
-/** Initilize IPC subsystem
- *
- */
-void ipc_init(void)
-{
-	call_cache = slab_cache_create("call_t", sizeof(call_t), 0, NULL,
-	    NULL, 0);
-	phone_cache = slab_cache_create("phone_t", sizeof(phone_t), 0, NULL,
-	    NULL, 0);
-	answerbox_cache = slab_cache_create("answerbox_t", sizeof(answerbox_t),
-	    0, NULL, NULL, 0);
-}
-
-static void ipc_print_call_list(list_t *list)
-{
-	list_foreach(*list, ab_link, call_t, call) {
-#ifdef __32_BITS__
-		printf("%10p ", call);
-#endif
-
-#ifdef __64_BITS__
-		printf("%18p ", call);
-#endif
-
-		spinlock_lock(&call->forget_lock);
-
-		printf("%-8" PRIun " %-6" PRIun " %-6" PRIun " %-6" PRIun
-		    " %-6" PRIun " %-6" PRIun " %-7x",
-		    ipc_get_imethod(&call->data), ipc_get_arg1(&call->data),
-		    ipc_get_arg2(&call->data), ipc_get_arg3(&call->data),
-		    ipc_get_arg4(&call->data), ipc_get_arg5(&call->data),
-		    call->flags);
-
-		if (call->forget) {
-			printf(" ? (call forgotten)\n");
-		} else {
-			printf(" %" PRIu64 " (%s)\n",
-			    call->sender->taskid, call->sender->name);
-		}
-
-		spinlock_unlock(&call->forget_lock);
-	}
-}
-
-static bool print_task_phone_cb(cap_t *cap, void *arg)
-{
-	phone_t *phone = cap->kobject->phone;
-
-	mutex_lock(&phone->lock);
-	if (phone->state != IPC_PHONE_FREE) {
-		printf("%-11d %7" PRIun " ", (int) cap_handle_raw(cap->handle),
-		    atomic_load(&phone->active_calls));
-
-		switch (phone->state) {
-		case IPC_PHONE_CONNECTING:
-			printf("connecting");
-			break;
-		case IPC_PHONE_CONNECTED:
-			printf("connected to %" PRIu64 " (%s)",
-			    phone->callee->task->taskid,
-			    phone->callee->task->name);
-			break;
-		case IPC_PHONE_SLAMMED:
-			printf("slammed by %p", phone->callee);
-			break;
-		case IPC_PHONE_HUNGUP:
-			printf("hung up to %p", phone->callee);
-			break;
-		default:
-			break;
-		}
-
-		printf("\n");
-	}
-	mutex_unlock(&phone->lock);
-
-	return true;
-}
-
-/** List answerbox contents.
- *
- * @param taskid Task ID.
- *
- */
-void ipc_print_task(task_id_t taskid)
-{
-	task_t *task = task_find_by_id(taskid);
-	if (!task)
-		return;
-
-	printf("[phone cap] [calls] [state\n");
-
-	caps_apply_to_kobject_type(task, KOBJECT_TYPE_PHONE,
-	    print_task_phone_cb, NULL);
-
-	irq_spinlock_lock(&task->lock, true);
-	irq_spinlock_lock(&task->answerbox.lock, false);
-
-	printf("Active calls: %" PRIun "\n",
-	    atomic_load(&task->answerbox.active_calls));
-
-#ifdef __32_BITS__
-	printf("[call adr] [method] [arg1] [arg2] [arg3] [arg4] [arg5]"
-	    " [flags] [sender\n");
-#endif
-
-#ifdef __64_BITS__
-	printf("[call address    ] [method] [arg1] [arg2] [arg3] [arg4]"
-	    " [arg5] [flags] [sender\n");
-#endif
-
-	printf(" --- incomming calls ---\n");
-	ipc_print_call_list(&task->answerbox.calls);
-	printf(" --- dispatched calls ---\n");
-	ipc_print_call_list(&task->answerbox.dispatched_calls);
-	printf(" --- incoming answers ---\n");
-	ipc_print_call_list(&task->answerbox.answers);
-
-	irq_spinlock_unlock(&task->answerbox.lock, false);
-	irq_spinlock_unlock(&task->lock, true);
-
-	task_release(task);
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/ipcrsc.c
===================================================================
--- kernel/generic/src/ipc/ipcrsc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <synch/spinlock.h>
-#include <ipc/ipc.h>
-#include <arch.h>
-#include <proc/task.h>
-#include <ipc/ipcrsc.h>
-#include <assert.h>
-#include <abi/errno.h>
-#include <cap/cap.h>
-#include <mm/slab.h>
-#include <stdlib.h>
-
-static void phone_destroy(void *arg)
-{
-	phone_t *phone = (phone_t *) arg;
-	if (phone->hangup_call)
-		kobject_put(phone->hangup_call->kobject);
-	slab_free(phone_cache, phone);
-}
-
-kobject_ops_t phone_kobject_ops = {
-	.destroy = phone_destroy
-};
-
-/** Allocate new phone in the specified task.
- *
- * @param[in]  task     Task for which to allocate a new phone.
- * @param[in]  publish  If true, the new capability will be published.
- * @param[out] phandle  New phone capability handle.
- * @param[out] kobject  New phone kobject.
- *
- * @return  An error code if a new capability cannot be allocated.
- */
-errno_t phone_alloc(task_t *task, bool publish, cap_phone_handle_t *phandle,
-    kobject_t **kobject)
-{
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(task, &handle);
-	if (rc == EOK) {
-		phone_t *phone = slab_alloc(phone_cache, FRAME_ATOMIC);
-		if (!phone) {
-			cap_free(TASK, handle);
-			return ENOMEM;
-		}
-		kobject_t *kobj = kobject_alloc(FRAME_ATOMIC);
-		if (!kobj) {
-			cap_free(TASK, handle);
-			slab_free(phone_cache, phone);
-			return ENOMEM;
-		}
-		call_t *hcall = ipc_call_alloc();
-		if (!hcall) {
-			cap_free(TASK, handle);
-			slab_free(phone_cache, phone);
-			free(kobj);
-			return ENOMEM;
-		}
-
-		ipc_phone_init(phone, task);
-		phone->state = IPC_PHONE_CONNECTING;
-		phone->hangup_call = hcall;
-
-		kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone);
-		phone->kobject = kobj;
-
-		if (publish)
-			cap_publish(task, handle, kobj);
-
-		*phandle = handle;
-		if (kobject)
-			*kobject = kobj;
-	}
-	return rc;
-}
-
-/** Free slot from a disconnected phone.
- *
- * All already sent messages will be correctly processed.
- *
- * @param handle Phone capability handle of the phone to be freed.
- *
- */
-void phone_dealloc(cap_phone_handle_t handle)
-{
-	kobject_t *kobj = cap_unpublish(TASK, handle, KOBJECT_TYPE_PHONE);
-	if (!kobj)
-		return;
-
-	kobject_put(kobj);
-	cap_free(TASK, handle);
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,592 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-
-/**
- * @file
- * @brief IRQ notification framework.
- *
- * This framework allows applications to subscribe to receive a notification
- * when an interrupt is detected. The application may provide a simple
- * 'top-half' handler as part of its registration, which can perform simple
- * operations (read/write port/memory, add information to notification IPC
- * message).
- *
- * The structure of a notification message is as follows:
- * - IMETHOD: interface and method as set by the SYS_IPC_IRQ_SUBSCRIBE syscall
- * - ARG1: payload modified by a 'top-half' handler (scratch[1])
- * - ARG2: payload modified by a 'top-half' handler (scratch[2])
- * - ARG3: payload modified by a 'top-half' handler (scratch[3])
- * - ARG4: payload modified by a 'top-half' handler (scratch[4])
- * - ARG5: payload modified by a 'top-half' handler (scratch[5])
- * - request_label: interrupt counter (may be needed to assure correct order
- *                  in multithreaded drivers)
- */
-
-#include <arch.h>
-#include <assert.h>
-#include <mm/slab.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <errno.h>
-#include <ddi/irq.h>
-#include <ipc/ipc.h>
-#include <ipc/irq.h>
-#include <syscall/copy.h>
-#include <console/console.h>
-#include <macros.h>
-#include <cap/cap.h>
-#include <stdlib.h>
-
-static void ranges_unmap(irq_pio_range_t *ranges, size_t rangecount)
-{
-	for (size_t i = 0; i < rangecount; i++) {
-#ifdef IO_SPACE_BOUNDARY
-		if ((void *) ranges[i].base >= IO_SPACE_BOUNDARY)
-#endif
-			km_unmap(ranges[i].base, ranges[i].size);
-	}
-}
-
-static errno_t ranges_map_and_apply(irq_pio_range_t *ranges, size_t rangecount,
-    irq_cmd_t *cmds, size_t cmdcount)
-{
-	/* Copy the physical base addresses aside. */
-	uintptr_t *pbase = malloc(rangecount * sizeof(uintptr_t));
-	if (!pbase)
-		return ENOMEM;
-	for (size_t i = 0; i < rangecount; i++)
-		pbase[i] = ranges[i].base;
-
-	/* Map the PIO ranges into the kernel virtual address space. */
-	for (size_t i = 0; i < rangecount; i++) {
-#ifdef IO_SPACE_BOUNDARY
-		if ((void *) ranges[i].base < IO_SPACE_BOUNDARY)
-			continue;
-#endif
-		ranges[i].base = km_map(pbase[i], ranges[i].size,
-		    KM_NATURAL_ALIGNMENT,
-		    PAGE_READ | PAGE_WRITE | PAGE_KERNEL | PAGE_NOT_CACHEABLE);
-		if (!ranges[i].base) {
-			ranges_unmap(ranges, i);
-			free(pbase);
-			return ENOMEM;
-		}
-	}
-
-	/* Rewrite the IRQ code addresses from physical to kernel virtual. */
-	for (size_t i = 0; i < cmdcount; i++) {
-		uintptr_t addr;
-		size_t size;
-
-		/* Process only commands that use an address. */
-		switch (cmds[i].cmd) {
-		case CMD_PIO_READ_8:
-		case CMD_PIO_WRITE_8:
-		case CMD_PIO_WRITE_A_8:
-			size = 1;
-			break;
-		case CMD_PIO_READ_16:
-		case CMD_PIO_WRITE_16:
-		case CMD_PIO_WRITE_A_16:
-			size = 2;
-			break;
-		case CMD_PIO_READ_32:
-		case CMD_PIO_WRITE_32:
-		case CMD_PIO_WRITE_A_32:
-			size = 4;
-			break;
-		default:
-			/* Move onto the next command. */
-			continue;
-		}
-
-		addr = (uintptr_t) cmds[i].addr;
-
-		size_t j;
-		for (j = 0; j < rangecount; j++) {
-			/* Find the matching range. */
-			if (!iswithin(pbase[j], ranges[j].size, addr, size))
-				continue;
-
-			/* Switch the command to a kernel virtual address. */
-			addr -= pbase[j];
-			addr += ranges[j].base;
-
-			cmds[i].addr = (void *) addr;
-			break;
-		}
-
-		if (j == rangecount) {
-			/*
-			 * The address used in this command is outside of all
-			 * defined ranges.
-			 */
-			ranges_unmap(ranges, rangecount);
-			free(pbase);
-			return EINVAL;
-		}
-	}
-
-	free(pbase);
-	return EOK;
-}
-
-/** Statically check the top-half IRQ code
- *
- * Check the top-half IRQ code for invalid or unsafe constructs.
- *
- */
-static errno_t code_check(irq_cmd_t *cmds, size_t cmdcount)
-{
-	for (size_t i = 0; i < cmdcount; i++) {
-		/*
-		 * Check for accepted ranges.
-		 */
-		if (cmds[i].cmd >= CMD_LAST)
-			return EINVAL;
-
-		if (cmds[i].srcarg >= IPC_CALL_LEN)
-			return EINVAL;
-
-		if (cmds[i].dstarg >= IPC_CALL_LEN)
-			return EINVAL;
-
-		switch (cmds[i].cmd) {
-		case CMD_PREDICATE:
-			/*
-			 * Check for control flow overflow.
-			 * Note that jumping just beyond the last
-			 * command is a correct behaviour.
-			 */
-			if (i + cmds[i].value > cmdcount)
-				return EINVAL;
-
-			break;
-		default:
-			break;
-		}
-	}
-
-	return EOK;
-}
-
-/** Free the top-half IRQ code.
- *
- * @param code Pointer to the top-half IRQ code.
- *
- */
-static void code_free(irq_code_t *code)
-{
-	if (code) {
-		ranges_unmap(code->ranges, code->rangecount);
-		free(code->ranges);
-		free(code->cmds);
-		free(code);
-	}
-}
-
-/** Copy the top-half IRQ code from userspace into the kernel.
- *
- * @param ucode Userspace address of the top-half IRQ code.
- *
- * @return Kernel address of the copied IRQ code.
- *
- */
-static irq_code_t *code_from_uspace(uspace_ptr_irq_code_t ucode)
-{
-	irq_pio_range_t *ranges = NULL;
-	irq_cmd_t *cmds = NULL;
-
-	irq_code_t *code = malloc(sizeof(*code));
-	if (!code)
-		return NULL;
-	errno_t rc = copy_from_uspace(code, ucode, sizeof(*code));
-	if (rc != EOK)
-		goto error;
-
-	if ((code->rangecount > IRQ_MAX_RANGE_COUNT) ||
-	    (code->cmdcount > IRQ_MAX_PROG_SIZE))
-		goto error;
-
-	ranges = malloc(sizeof(code->ranges[0]) * code->rangecount);
-	if (!ranges)
-		goto error;
-	rc = copy_from_uspace(ranges, (uintptr_t) code->ranges,
-	    sizeof(code->ranges[0]) * code->rangecount);
-	if (rc != EOK)
-		goto error;
-
-	cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount);
-	if (!cmds)
-		goto error;
-	rc = copy_from_uspace(cmds, (uintptr_t) code->cmds,
-	    sizeof(code->cmds[0]) * code->cmdcount);
-	if (rc != EOK)
-		goto error;
-
-	rc = code_check(cmds, code->cmdcount);
-	if (rc != EOK)
-		goto error;
-
-	rc = ranges_map_and_apply(ranges, code->rangecount, cmds,
-	    code->cmdcount);
-	if (rc != EOK)
-		goto error;
-
-	code->ranges = ranges;
-	code->cmds = cmds;
-
-	return code;
-
-error:
-	if (cmds)
-		free(cmds);
-
-	if (ranges)
-		free(ranges);
-
-	free(code);
-	return NULL;
-}
-
-static void irq_hash_out(irq_t *irq)
-{
-	irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
-	irq_spinlock_lock(&irq->lock, false);
-
-	if (irq->notif_cfg.hashed_in) {
-		/* Remove the IRQ from the uspace IRQ hash table. */
-		hash_table_remove_item(&irq_uspace_hash_table, &irq->link);
-		irq->notif_cfg.hashed_in = false;
-	}
-
-	irq_spinlock_unlock(&irq->lock, false);
-	irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
-}
-
-static void irq_destroy(void *arg)
-{
-	irq_t *irq = (irq_t *) arg;
-
-	irq_hash_out(irq);
-
-	/* Free up the IRQ code and associated structures. */
-	code_free(irq->notif_cfg.code);
-	slab_free(irq_cache, irq);
-}
-
-kobject_ops_t irq_kobject_ops = {
-	.destroy = irq_destroy
-};
-
-/** Subscribe an answerbox as a receiving end for IRQ notifications.
- *
- * @param box     Receiving answerbox.
- * @param inr     IRQ number.
- * @param imethod Interface and method to be associated with the notification.
- * @param ucode   Uspace pointer to top-half IRQ code.
- *
- * @param[out] uspace_handle  Uspace pointer to IRQ capability handle
- *
- * @return  Error code.
- *
- */
-errno_t ipc_irq_subscribe(answerbox_t *box, inr_t inr, sysarg_t imethod,
-    uspace_ptr_irq_code_t ucode, uspace_ptr_cap_irq_handle_t uspace_handle)
-{
-	if ((inr < 0) || (inr > last_inr))
-		return ELIMIT;
-
-	irq_code_t *code;
-	if (ucode) {
-		code = code_from_uspace(ucode);
-		if (!code)
-			return EBADMEM;
-	} else
-		code = NULL;
-
-	/*
-	 * Allocate and populate the IRQ kernel object.
-	 */
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(TASK, &handle);
-	if (rc != EOK)
-		return rc;
-
-	rc = copy_to_uspace(uspace_handle, &handle, sizeof(cap_handle_t));
-	if (rc != EOK) {
-		cap_free(TASK, handle);
-		return rc;
-	}
-
-	irq_t *irq = (irq_t *) slab_alloc(irq_cache, FRAME_ATOMIC);
-	if (!irq) {
-		cap_free(TASK, handle);
-		return ENOMEM;
-	}
-
-	kobject_t *kobject = kobject_alloc(FRAME_ATOMIC);
-	if (!kobject) {
-		cap_free(TASK, handle);
-		slab_free(irq_cache, irq);
-		return ENOMEM;
-	}
-
-	irq_initialize(irq);
-	irq->inr = inr;
-	irq->claim = ipc_irq_top_half_claim;
-	irq->handler = ipc_irq_top_half_handler;
-	irq->notif_cfg.notify = true;
-	irq->notif_cfg.answerbox = box;
-	irq->notif_cfg.imethod = imethod;
-	irq->notif_cfg.code = code;
-	irq->notif_cfg.counter = 0;
-
-	/*
-	 * Insert the IRQ structure into the uspace IRQ hash table.
-	 */
-	irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
-	irq_spinlock_lock(&irq->lock, false);
-
-	irq->notif_cfg.hashed_in = true;
-	hash_table_insert(&irq_uspace_hash_table, &irq->link);
-
-	irq_spinlock_unlock(&irq->lock, false);
-	irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
-
-	kobject_initialize(kobject, KOBJECT_TYPE_IRQ, irq);
-	cap_publish(TASK, handle, kobject);
-
-	return EOK;
-}
-
-/** Unsubscribe task from IRQ notification.
- *
- * @param box     Answerbox associated with the notification.
- * @param handle  IRQ capability handle.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t ipc_irq_unsubscribe(answerbox_t *box, cap_irq_handle_t handle)
-{
-	kobject_t *kobj = cap_unpublish(TASK, handle, KOBJECT_TYPE_IRQ);
-	if (!kobj)
-		return ENOENT;
-
-	assert(kobj->irq->notif_cfg.answerbox == box);
-
-	irq_hash_out(kobj->irq);
-
-	kobject_put(kobj);
-	cap_free(TASK, handle);
-
-	return EOK;
-}
-
-/** Add a call to the proper answerbox queue.
- *
- * Assume irq->lock is locked and interrupts disabled.
- *
- * @param irq  IRQ structure referencing the target answerbox.
- * @param call IRQ notification call.
- *
- */
-static void send_call(irq_t *irq, call_t *call)
-{
-	irq_spinlock_lock(&irq->notif_cfg.answerbox->irq_lock, false);
-	list_append(&call->ab_link, &irq->notif_cfg.answerbox->irq_notifs);
-	irq_spinlock_unlock(&irq->notif_cfg.answerbox->irq_lock, false);
-
-	waitq_wake_one(&irq->notif_cfg.answerbox->wq);
-}
-
-/** Apply the top-half IRQ code to find out whether to accept the IRQ or not.
- *
- * @param irq IRQ structure.
- *
- * @return IRQ_ACCEPT if the interrupt is accepted by the IRQ code.
- * @return IRQ_DECLINE if the interrupt is not accepted byt the IRQ code.
- *
- */
-irq_ownership_t ipc_irq_top_half_claim(irq_t *irq)
-{
-	irq_code_t *code = irq->notif_cfg.code;
-	uint32_t *scratch = irq->notif_cfg.scratch;
-
-	if (!irq->notif_cfg.notify)
-		return IRQ_DECLINE;
-
-	if (!code)
-		return IRQ_DECLINE;
-
-	for (size_t i = 0; i < code->cmdcount; i++) {
-		uintptr_t srcarg = code->cmds[i].srcarg;
-		uintptr_t dstarg = code->cmds[i].dstarg;
-
-		switch (code->cmds[i].cmd) {
-		case CMD_PIO_READ_8:
-			scratch[dstarg] =
-			    pio_read_8((ioport8_t *) code->cmds[i].addr);
-			break;
-		case CMD_PIO_READ_16:
-			scratch[dstarg] =
-			    pio_read_16((ioport16_t *) code->cmds[i].addr);
-			break;
-		case CMD_PIO_READ_32:
-			scratch[dstarg] =
-			    pio_read_32((ioport32_t *) code->cmds[i].addr);
-			break;
-		case CMD_PIO_WRITE_8:
-			pio_write_8((ioport8_t *) code->cmds[i].addr,
-			    (uint8_t) code->cmds[i].value);
-			break;
-		case CMD_PIO_WRITE_16:
-			pio_write_16((ioport16_t *) code->cmds[i].addr,
-			    (uint16_t) code->cmds[i].value);
-			break;
-		case CMD_PIO_WRITE_32:
-			pio_write_32((ioport32_t *) code->cmds[i].addr,
-			    (uint32_t) code->cmds[i].value);
-			break;
-		case CMD_PIO_WRITE_A_8:
-			pio_write_8((ioport8_t *) code->cmds[i].addr,
-			    (uint8_t) scratch[srcarg]);
-			break;
-		case CMD_PIO_WRITE_A_16:
-			pio_write_16((ioport16_t *) code->cmds[i].addr,
-			    (uint16_t) scratch[srcarg]);
-			break;
-		case CMD_PIO_WRITE_A_32:
-			pio_write_32((ioport32_t *) code->cmds[i].addr,
-			    (uint32_t) scratch[srcarg]);
-			break;
-		case CMD_LOAD:
-			scratch[dstarg] = code->cmds[i].value;
-			break;
-		case CMD_AND:
-			scratch[dstarg] = scratch[srcarg] &
-			    code->cmds[i].value;
-			break;
-		case CMD_PREDICATE:
-			if (scratch[srcarg] == 0)
-				i += code->cmds[i].value;
-
-			break;
-		case CMD_ACCEPT:
-			return IRQ_ACCEPT;
-		case CMD_DECLINE:
-		default:
-			return IRQ_DECLINE;
-		}
-	}
-
-	return IRQ_DECLINE;
-}
-
-/** IRQ top-half handler.
- *
- * We expect interrupts to be disabled and the irq->lock already held.
- *
- * @param irq IRQ structure.
- *
- */
-void ipc_irq_top_half_handler(irq_t *irq)
-{
-	assert(irq);
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&irq->lock));
-
-	if (irq->notif_cfg.answerbox) {
-		call_t *call = ipc_call_alloc();
-		if (!call)
-			return;
-
-		call->flags |= IPC_CALL_NOTIF;
-		/* Put a counter to the message */
-		call->priv = ++irq->notif_cfg.counter;
-
-		/* Set up args */
-		ipc_set_imethod(&call->data, irq->notif_cfg.imethod);
-		ipc_set_arg1(&call->data, irq->notif_cfg.scratch[1]);
-		ipc_set_arg2(&call->data, irq->notif_cfg.scratch[2]);
-		ipc_set_arg3(&call->data, irq->notif_cfg.scratch[3]);
-		ipc_set_arg4(&call->data, irq->notif_cfg.scratch[4]);
-		ipc_set_arg5(&call->data, irq->notif_cfg.scratch[5]);
-
-		send_call(irq, call);
-	}
-}
-
-/** Send notification message.
- *
- * @param irq IRQ structure.
- * @param a1  Driver-specific payload argument.
- * @param a2  Driver-specific payload argument.
- * @param a3  Driver-specific payload argument.
- * @param a4  Driver-specific payload argument.
- * @param a5  Driver-specific payload argument.
- *
- */
-void ipc_irq_send_msg(irq_t *irq, sysarg_t a1, sysarg_t a2, sysarg_t a3,
-    sysarg_t a4, sysarg_t a5)
-{
-	irq_spinlock_lock(&irq->lock, true);
-
-	if (irq->notif_cfg.answerbox) {
-		call_t *call = ipc_call_alloc();
-		if (!call) {
-			irq_spinlock_unlock(&irq->lock, true);
-			return;
-		}
-
-		call->flags |= IPC_CALL_NOTIF;
-		/* Put a counter to the message */
-		call->priv = ++irq->notif_cfg.counter;
-
-		ipc_set_imethod(&call->data, irq->notif_cfg.imethod);
-		ipc_set_arg1(&call->data, a1);
-		ipc_set_arg2(&call->data, a2);
-		ipc_set_arg3(&call->data, a3);
-		ipc_set_arg4(&call->data, a4);
-		ipc_set_arg5(&call->data, a5);
-
-		send_call(irq, call);
-	}
-
-	irq_spinlock_unlock(&irq->lock, true);
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/kbox.c
===================================================================
--- kernel/generic/src/ipc/kbox.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <ipc/ipc.h>
-#include <abi/ipc/methods.h>
-#include <ipc/ipcrsc.h>
-#include <arch.h>
-#include <errno.h>
-#include <debug.h>
-#include <udebug/udebug_ipc.h>
-#include <ipc/kbox.h>
-#include <proc/thread.h>
-
-void ipc_kbox_cleanup(void)
-{
-	/*
-	 * Not really needed, just to be consistent with the meaning of
-	 * answerbox_t.active.
-	 */
-	irq_spinlock_lock(&TASK->kb.box.lock, true);
-	TASK->kb.box.active = false;
-	irq_spinlock_unlock(&TASK->kb.box.lock, true);
-
-	/*
-	 * Only hold kb.cleanup_lock while setting kb.finished -
-	 * this is enough.
-	 */
-	mutex_lock(&TASK->kb.cleanup_lock);
-	TASK->kb.finished = true;
-	mutex_unlock(&TASK->kb.cleanup_lock);
-
-	bool have_kb_thread = (TASK->kb.thread != NULL);
-
-	/*
-	 * From now on nobody will try to connect phones or attach
-	 * kbox threads
-	 */
-
-	/*
-	 * Disconnect all phones connected to our kbox. Passing true for
-	 * notify_box causes a HANGUP message to be inserted for each
-	 * disconnected phone. This ensures the kbox thread is going to
-	 * wake up and terminate.
-	 */
-	ipc_answerbox_slam_phones(&TASK->kb.box, have_kb_thread);
-
-	/*
-	 * If the task was being debugged, clean up debugging session.
-	 * This is necessarry as slamming the phones won't force
-	 * kbox thread to clean it up since sender != debugger.
-	 */
-	mutex_lock(&TASK->udebug.lock);
-	udebug_task_cleanup(TASK);
-	mutex_unlock(&TASK->udebug.lock);
-
-	if (have_kb_thread) {
-		LOG("Join kb.thread.");
-		thread_join(TASK->kb.thread);
-		LOG("...join done.");
-		TASK->kb.thread = NULL;
-	}
-
-	/* Answer all messages in 'calls' and 'dispatched_calls' queues. */
-	ipc_cleanup_call_list(&TASK->kb.box, &TASK->kb.box.calls);
-	ipc_cleanup_call_list(&TASK->kb.box, &TASK->kb.box.dispatched_calls);
-}
-
-/** Handle hangup message in kbox.
- *
- * @param call The IPC_M_PHONE_HUNGUP call structure.
- * @param last Output, the function stores @c true here if
- *             this was the last phone, @c false otherwise.
- *
- */
-static void kbox_proc_phone_hungup(call_t *call, bool *last)
-{
-	/* Was it our debugger, who hung up? */
-	if (call->sender == TASK->udebug.debugger) {
-		/* Terminate debugging session (if any). */
-		LOG("Terminate debugging session.");
-		mutex_lock(&TASK->udebug.lock);
-		udebug_task_cleanup(TASK);
-		mutex_unlock(&TASK->udebug.lock);
-	} else {
-		LOG("Was not debugger.");
-	}
-
-	LOG("Continue with hangup message.");
-	ipc_set_retval(&call->data, 0);
-	ipc_answer(&TASK->kb.box, call);
-
-	mutex_lock(&TASK->kb.cleanup_lock);
-
-	irq_spinlock_lock(&TASK->lock, true);
-	irq_spinlock_lock(&TASK->kb.box.lock, false);
-	if (list_empty(&TASK->kb.box.connected_phones)) {
-		/*
-		 * Last phone has been disconnected. Detach this thread so it
-		 * gets freed and signal to the caller.
-		 */
-
-		/* Only detach kbox thread unless already terminating. */
-		if (TASK->kb.finished == false) {
-			/* Release kbox thread so it gets freed from memory. */
-			thread_put(TASK->kb.thread);
-			TASK->kb.thread = NULL;
-		}
-
-		LOG("Phone list is empty.");
-		*last = true;
-	} else
-		*last = false;
-
-	irq_spinlock_unlock(&TASK->kb.box.lock, false);
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	mutex_unlock(&TASK->kb.cleanup_lock);
-}
-
-/** Implementing function for the kbox thread.
- *
- * This function listens for debug requests. It terminates
- * when all phones are disconnected from the kbox.
- *
- * @param arg Ignored.
- *
- */
-static void kbox_thread_proc(void *arg)
-{
-	(void) arg;
-	LOG("Starting.");
-	bool done = false;
-
-	while (!done) {
-		call_t *call = NULL;
-		(void) ipc_wait_for_call(&TASK->kb.box, SYNCH_NO_TIMEOUT,
-		    SYNCH_FLAGS_NONE, &call);
-
-		if (call == NULL)
-			continue;  /* Try again. */
-
-		switch (ipc_get_imethod(&call->data)) {
-
-		case IPC_M_DEBUG:
-			/* Handle debug call. */
-			udebug_call_receive(call);
-			break;
-
-		case IPC_M_PHONE_HUNGUP:
-			/*
-			 * Process the hangup call. If this was the last
-			 * phone, done will be set to true and the
-			 * while loop will terminate.
-			 */
-			kbox_proc_phone_hungup(call, &done);
-			break;
-
-		default:
-			/* Ignore */
-			break;
-		}
-	}
-
-	LOG("Exiting.");
-}
-
-/** Connect phone to a task kernel-box specified by id.
- *
- * @param[out] out_phone  Phone capability handle on success.
- * @return Error code.
- *
- */
-errno_t ipc_connect_kbox(task_id_t taskid, cap_phone_handle_t *out_phone)
-{
-	task_t *task = task_find_by_id(taskid);
-	if (!task)
-		return ENOENT;
-
-	mutex_lock(&task->kb.cleanup_lock);
-
-	if (task->kb.finished) {
-		mutex_unlock(&task->kb.cleanup_lock);
-		task_release(task);
-		return EINVAL;
-	}
-
-	/* Create a kbox thread if necessary. */
-	if (task->kb.thread == NULL) {
-		thread_t *kb_thread = thread_create(kbox_thread_proc, NULL, task,
-		    THREAD_FLAG_NONE, "kbox");
-
-		if (!kb_thread) {
-			mutex_unlock(&task->kb.cleanup_lock);
-			task_release(task);
-			return ENOMEM;
-		}
-
-		task->kb.thread = kb_thread;
-		thread_start(kb_thread);
-	}
-
-	/* Allocate a new phone. */
-	cap_phone_handle_t phone_handle;
-	errno_t rc = phone_alloc(TASK, true, &phone_handle, NULL);
-	if (rc != EOK) {
-		mutex_unlock(&task->kb.cleanup_lock);
-		task_release(task);
-		return rc;
-	}
-
-	kobject_t *phone_obj = kobject_get(TASK, phone_handle,
-	    KOBJECT_TYPE_PHONE);
-	/* Connect the newly allocated phone to the kbox */
-	/* Hand over phone_obj's reference to ipc_phone_connect() */
-	(void) ipc_phone_connect(phone_obj->phone, &task->kb.box);
-
-	mutex_unlock(&task->kb.cleanup_lock);
-	task_release(task);
-	*out_phone = phone_handle;
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/conctmeto.c
===================================================================
--- kernel/generic/src/ipc/ops/conctmeto.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <abi/errno.h>
-#include <arch.h>
-
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	/*
-	 * Create the new phone and capability, but don't publish them yet.
-	 * That will be done once the phone is connected.
-	 */
-	cap_phone_handle_t phandle;
-	kobject_t *pobj;
-	errno_t rc = phone_alloc(TASK, false, &phandle, &pobj);
-	if (rc != EOK) {
-		call->priv = 0;
-		return rc;
-	}
-
-	/* Move pobj's reference to call->priv */
-	call->priv = (sysarg_t) pobj;
-	pobj = NULL;
-
-	/* Remember the handle */
-	ipc_set_arg5(&call->data, (sysarg_t) phandle);
-
-	return EOK;
-}
-
-static errno_t request_forget(call_t *call)
-{
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(&call->data);
-
-	if (cap_handle_raw(phandle) < 0)
-		return EOK;
-
-	/* Move reference from call->priv to pobj */
-	kobject_t *pobj = (kobject_t *) call->priv;
-	call->priv = 0;
-	/* Drop pobj's reference */
-	kobject_put(pobj);
-	cap_free(TASK, phandle);
-
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	/* Get an extra reference for phone */
-	kobject_t *pobj = (kobject_t *) answer->priv;
-	kobject_add_ref(pobj);
-
-	/* Set the recipient-assigned label */
-	pobj->phone->label = ipc_get_arg5(&answer->data);
-
-	/* Restore phone handle in answer's ARG5 */
-	ipc_set_arg5(&answer->data, ipc_get_arg5(olddata));
-
-	/* If the user accepted the call, connect */
-	if (ipc_get_retval(&answer->data) == EOK) {
-		/* Hand over reference from pobj to the answerbox */
-		(void) ipc_phone_connect(pobj->phone, &TASK->answerbox);
-	} else {
-		/* Drop the extra reference */
-		kobject_put(pobj);
-	}
-
-	return EOK;
-}
-
-static errno_t answer_process(call_t *answer)
-{
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(&answer->data);
-	/* Move the reference from answer->priv to pobj */
-	kobject_t *pobj = (kobject_t *) answer->priv;
-	answer->priv = 0;
-
-	if (ipc_get_retval(&answer->data)) {
-		if (cap_handle_raw(phandle) >= 0) {
-			/*
-			 * Cleanup the unpublished capability and drop
-			 * phone->kobject's reference.
-			 */
-			kobject_put(pobj);
-			cap_free(TASK, phandle);
-		}
-	} else {
-		/*
-		 * Publish the capability. Publishing the capability this late
-		 * is important for ipc_cleanup() where we want to have a
-		 * capability for each phone that wasn't hung up by the user.
-		 */
-		cap_publish(TASK, phandle, pobj);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_connect_me_to_ops = {
-	.request_preprocess = request_preprocess,
-	.request_forget = request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/concttome.c
===================================================================
--- kernel/generic/src/ipc/ops/concttome.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <abi/errno.h>
-#include <arch.h>
-
-static int request_process(call_t *call, answerbox_t *box)
-{
-	cap_phone_handle_t phandle = CAP_NIL;
-	kobject_t *pobj = NULL;
-	errno_t rc = phone_alloc(TASK, false, &phandle, &pobj);
-	if (rc == EOK) {
-		/*
-		 * Set the sender-assigned label to the new phone.
-		 */
-		pobj->phone->label = ipc_get_arg5(&call->data);
-	}
-	call->priv = (sysarg_t) pobj;
-	ipc_set_arg5(&call->data, cap_handle_raw(phandle));
-	return 0;
-}
-
-static errno_t answer_cleanup(call_t *answer, ipc_data_t *olddata)
-{
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(olddata);
-	kobject_t *pobj = (kobject_t *) answer->priv;
-
-	if (cap_handle_valid(phandle)) {
-		kobject_put(pobj);
-		cap_free(TASK, phandle);
-	}
-
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(olddata);
-	kobject_t *pobj = (kobject_t *) answer->priv;
-
-	if (ipc_get_retval(&answer->data) != EOK) {
-		/* The connection was not accepted */
-		answer_cleanup(answer, olddata);
-	} else if (cap_handle_valid(phandle)) {
-		/*
-		 * The connection was accepted
-		 */
-
-		/*
-		 * We need to create another reference as the one we have now
-		 * will be consumed by ipc_phone_connect().
-		 */
-		kobject_add_ref(pobj);
-
-		if (ipc_phone_connect(pobj->phone,
-		    &answer->sender->answerbox)) {
-			/* Pass the reference to the capability */
-			cap_publish(TASK, phandle, pobj);
-		} else {
-			/* The answerbox is shutting down. */
-			ipc_set_retval(&answer->data, ENOENT);
-			answer_cleanup(answer, olddata);
-		}
-	} else {
-		ipc_set_retval(&answer->data, ELIMIT);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_connect_to_me_ops = {
-	.request_preprocess = null_request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = request_process,
-	.answer_cleanup = answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/dataread.c
===================================================================
--- kernel/generic/src/ipc/ops/dataread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <stdlib.h>
-#include <abi/errno.h>
-#include <syscall/copy.h>
-#include <config.h>
-
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	size_t size = ipc_get_arg2(&call->data);
-
-	if (size > DATA_XFER_LIMIT) {
-		int flags = ipc_get_arg3(&call->data);
-
-		if (flags & IPC_XF_RESTRICT)
-			ipc_set_arg2(&call->data, DATA_XFER_LIMIT);
-		else
-			return ELIMIT;
-	}
-
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	assert(!answer->buffer);
-
-	if (!ipc_get_retval(&answer->data)) {
-		/* The recipient agreed to send data. */
-		uspace_addr_t src = ipc_get_arg1(&answer->data);
-		uspace_addr_t dst = ipc_get_arg1(olddata);
-		size_t max_size = ipc_get_arg2(olddata);
-		size_t size = ipc_get_arg2(&answer->data);
-
-		if (size && size <= max_size) {
-			/*
-			 * Copy the destination VA so that this piece of
-			 * information is not lost.
-			 */
-			ipc_set_arg1(&answer->data, dst);
-
-			answer->buffer = malloc(size);
-			if (!answer->buffer) {
-				ipc_set_retval(&answer->data, ENOMEM);
-				return EOK;
-			}
-			errno_t rc = copy_from_uspace(answer->buffer,
-			    src, size);
-			if (rc) {
-				ipc_set_retval(&answer->data, rc);
-				/*
-				 * answer->buffer will be cleaned up in
-				 * ipc_call_free().
-				 */
-				return EOK;
-			}
-		} else if (!size) {
-			ipc_set_retval(&answer->data, EOK);
-		} else {
-			ipc_set_retval(&answer->data, ELIMIT);
-		}
-	}
-
-	return EOK;
-}
-
-static errno_t answer_process(call_t *answer)
-{
-	if (answer->buffer) {
-		uspace_addr_t dst = ipc_get_arg1(&answer->data);
-		size_t size = ipc_get_arg2(&answer->data);
-		errno_t rc;
-
-		rc = copy_to_uspace(dst, answer->buffer, size);
-		if (rc)
-			ipc_set_retval(&answer->data, rc);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_data_read_ops = {
-	.request_preprocess = request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/datawrite.c
===================================================================
--- kernel/generic/src/ipc/ops/datawrite.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <stdlib.h>
-#include <abi/errno.h>
-#include <syscall/copy.h>
-#include <config.h>
-
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	uspace_addr_t src = ipc_get_arg1(&call->data);
-	size_t size = ipc_get_arg2(&call->data);
-
-	if (size > DATA_XFER_LIMIT) {
-		int flags = ipc_get_arg3(&call->data);
-
-		if (flags & IPC_XF_RESTRICT) {
-			size = DATA_XFER_LIMIT;
-			ipc_set_arg2(&call->data, size);
-		} else
-			return ELIMIT;
-	}
-
-	call->buffer = (uint8_t *) malloc(size);
-	if (!call->buffer)
-		return ENOMEM;
-	errno_t rc = copy_from_uspace(call->buffer, src, size);
-	if (rc != EOK) {
-		/*
-		 * call->buffer will be cleaned up in ipc_call_free() at the
-		 * latest.
-		 */
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	assert(answer->buffer);
-
-	if (!ipc_get_retval(&answer->data)) {
-		/* The recipient agreed to receive data. */
-		uspace_addr_t dst = ipc_get_arg1(&answer->data);
-		size_t size = ipc_get_arg2(&answer->data);
-		size_t max_size = ipc_get_arg2(olddata);
-
-		if (size <= max_size) {
-			errno_t rc = copy_to_uspace(dst,
-			    answer->buffer, size);
-			if (rc)
-				ipc_set_retval(&answer->data, rc);
-		} else {
-			ipc_set_retval(&answer->data, ELIMIT);
-		}
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_data_write_ops = {
-	.request_preprocess = request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/debug.c
===================================================================
--- kernel/generic/src/ipc/ops/debug.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <udebug/udebug_ipc.h>
-#include <syscall/copy.h>
-#include <abi/errno.h>
-
-static int request_process(call_t *call, answerbox_t *box)
-{
-	return -1;
-}
-
-static errno_t answer_process(call_t *answer)
-{
-	if (answer->buffer) {
-		uspace_addr_t dst = ipc_get_arg1(&answer->data);
-		size_t size = ipc_get_arg2(&answer->data);
-		errno_t rc;
-
-		rc = copy_to_uspace(dst, answer->buffer, size);
-		if (rc)
-			ipc_set_retval(&answer->data, rc);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_debug_ops = {
-#ifdef CONFIG_UDEBUG
-	.request_preprocess = udebug_request_preprocess,
-#else
-	.request_preprocess = null_request_preprocess,
-#endif
-	.request_forget = null_request_forget,
-	.request_process = request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = null_answer_preprocess,
-	.answer_process = answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/pagein.c
===================================================================
--- kernel/generic/src/ipc/ops/pagein.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/frame.h>
-#include <proc/task.h>
-#include <abi/errno.h>
-#include <arch.h>
-
-static errno_t pagein_request_preprocess(call_t *call, phone_t *phone)
-{
-	/*
-	 * Allow only requests from numerically higher task IDs to
-	 * numerically lower task IDs to prevent deadlock in
-	 * pagein_answer_preprocess() that could happen if two tasks
-	 * wanted to be each other's pager.
-	 */
-	if (TASK->taskid <= phone->callee->task->taskid)
-		return ENOTSUP;
-	else
-		return EOK;
-}
-
-static errno_t pagein_answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	/*
-	 * We only do the special handling below if the call was initiated by
-	 * the kernel. Otherwise a malicious task could use this mechanism to
-	 * hold memory frames forever.
-	 */
-	if (!answer->priv)
-		return EOK;
-
-	if (!ipc_get_retval(&answer->data)) {
-
-		pte_t pte;
-		uintptr_t frame;
-
-		page_table_lock(AS, true);
-		bool found = page_mapping_find(AS, ipc_get_arg1(&answer->data),
-		    false, &pte);
-		if (found & PTE_PRESENT(&pte)) {
-			frame = PTE_GET_FRAME(&pte);
-			pfn_t pfn = ADDR2PFN(frame);
-			if (find_zone(pfn, 1, 0) != (size_t) -1) {
-				/*
-				 * The frame is in physical memory managed by
-				 * the frame allocator.
-				 */
-				frame_reference_add(ADDR2PFN(frame));
-			}
-			ipc_set_arg1(&answer->data, frame);
-		} else {
-			ipc_set_retval(&answer->data, ENOENT);
-		}
-		page_table_unlock(AS, true);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_page_in_ops = {
-	.request_preprocess = pagein_request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = pagein_answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/sharein.c
===================================================================
--- kernel/generic/src/ipc/ops/sharein.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <mm/as.h>
-#include <synch/spinlock.h>
-#include <proc/task.h>
-#include <abi/errno.h>
-#include <arch.h>
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	if (!ipc_get_retval(&answer->data)) {
-		irq_spinlock_lock(&answer->sender->lock, true);
-		as_t *as = answer->sender->as;
-		irq_spinlock_unlock(&answer->sender->lock, true);
-
-		uintptr_t dst_base = (uintptr_t) -1;
-		errno_t rc = as_area_share(AS, ipc_get_arg1(&answer->data),
-		    ipc_get_arg1(olddata), as, ipc_get_arg2(&answer->data),
-		    &dst_base, ipc_get_arg2(olddata));
-		ipc_set_arg5(&answer->data, dst_base);
-		ipc_set_retval(&answer->data, rc);
-	}
-
-	return EOK;
-}
-
-sysipc_ops_t ipc_m_share_in_ops = {
-	.request_preprocess = null_request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/shareout.c
===================================================================
--- kernel/generic/src/ipc/ops/shareout.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <mm/as.h>
-#include <synch/spinlock.h>
-#include <proc/task.h>
-#include <syscall/copy.h>
-#include <abi/errno.h>
-#include <arch.h>
-
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	size_t size = as_area_get_size(ipc_get_arg1(&call->data));
-
-	if (!size)
-		return EPERM;
-	ipc_set_arg2(&call->data, size);
-
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	errno_t rc = EOK;
-
-	if (!ipc_get_retval(&answer->data)) {
-		/* Accepted, handle as_area receipt */
-
-		irq_spinlock_lock(&answer->sender->lock, true);
-		as_t *as = answer->sender->as;
-		irq_spinlock_unlock(&answer->sender->lock, true);
-
-		uintptr_t dst_base = (uintptr_t) -1;
-		rc = as_area_share(as, ipc_get_arg1(olddata),
-		    ipc_get_arg2(olddata), AS, ipc_get_arg3(olddata),
-		    &dst_base, ipc_get_arg1(&answer->data));
-
-		if (rc == EOK) {
-			rc = copy_to_uspace(ipc_get_arg2(&answer->data),
-			    &dst_base, sizeof(dst_base));
-		}
-
-		ipc_set_retval(&answer->data, rc);
-	}
-
-	return rc;
-}
-
-sysipc_ops_t ipc_m_share_out_ops = {
-	.request_preprocess = request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/ops/stchngath.c
===================================================================
--- kernel/generic/src/ipc/ops/stchngath.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <synch/mutex.h>
-#include <proc/task.h>
-#include <abi/errno.h>
-#include <macros.h>
-
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	task_t *other_task_s;
-
-	kobject_t *sender_obj = kobject_get(TASK,
-	    (cap_handle_t) ipc_get_arg5(&call->data), KOBJECT_TYPE_PHONE);
-	if (!sender_obj)
-		return ENOENT;
-
-	mutex_lock(&sender_obj->phone->lock);
-	if (sender_obj->phone->state != IPC_PHONE_CONNECTED) {
-		mutex_unlock(&sender_obj->phone->lock);
-		kobject_put(sender_obj);
-		return EINVAL;
-	}
-
-	other_task_s = sender_obj->phone->callee->task;
-
-	mutex_unlock(&sender_obj->phone->lock);
-
-	/* Remember the third party task hash. */
-	ipc_set_arg5(&call->data, (sysarg_t) other_task_s);
-
-	kobject_put(sender_obj);
-	return EOK;
-}
-
-static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	errno_t rc = EOK;
-
-	if (!ipc_get_retval(&answer->data)) {
-		/* The recipient authorized the change of state. */
-		task_t *other_task_s;
-		task_t *other_task_r;
-
-		kobject_t *recipient_obj = kobject_get(TASK,
-		    (cap_handle_t) ipc_get_arg1(&answer->data),
-		    KOBJECT_TYPE_PHONE);
-		if (!recipient_obj) {
-			ipc_set_retval(&answer->data, ENOENT);
-			return ENOENT;
-		}
-
-		mutex_lock(&recipient_obj->phone->lock);
-		if (recipient_obj->phone->state != IPC_PHONE_CONNECTED) {
-			mutex_unlock(&recipient_obj->phone->lock);
-			ipc_set_retval(&answer->data, EINVAL);
-			kobject_put(recipient_obj);
-			return EINVAL;
-		}
-
-		other_task_r = recipient_obj->phone->callee->task;
-		other_task_s = (task_t *) ipc_get_arg5(olddata);
-
-		/*
-		 * See if both the sender and the recipient meant the
-		 * same third party task.
-		 */
-		if (other_task_r != other_task_s) {
-			ipc_set_retval(&answer->data, EINVAL);
-			rc = EINVAL;
-		} else {
-			rc = event_task_notify_5(other_task_r,
-			    EVENT_TASK_STATE_CHANGE, false,
-			    ipc_get_arg1(olddata),
-			    ipc_get_arg2(olddata),
-			    ipc_get_arg3(olddata),
-			    LOWER32(olddata->task_id),
-			    UPPER32(olddata->task_id));
-			ipc_set_retval(&answer->data, rc);
-		}
-
-		mutex_unlock(&recipient_obj->phone->lock);
-		kobject_put(recipient_obj);
-	}
-
-	return rc;
-}
-
-sysipc_ops_t ipc_m_state_change_authorize_ops = {
-	.request_preprocess = request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-/** @}
- */
Index: rnel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,947 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <arch.h>
-#include <assert.h>
-#include <errno.h>
-#include <memw.h>
-#include <ipc/ipc.h>
-#include <abi/ipc/methods.h>
-#include <ipc/sysipc.h>
-#include <ipc/sysipc_ops.h>
-#include <ipc/sysipc_priv.h>
-#include <ipc/irq.h>
-#include <ipc/ipcrsc.h>
-#include <ipc/event.h>
-#include <ipc/kbox.h>
-#include <synch/waitq.h>
-#include <arch/interrupt.h>
-#include <syscall/copy.h>
-#include <security/perm.h>
-#include <console/console.h>
-#include <macros.h>
-#include <cap/cap.h>
-
-#define STRUCT_TO_USPACE(dst, src)  copy_to_uspace((dst), (src), sizeof(*(src)))
-
-/** Decide if the interface and method is a system method.
- *
- * @param imethod Interface and method to be decided.
- *
- * @return True if the interface and method is a system
- *         interface and method.
- *
- */
-static inline bool method_is_system(sysarg_t imethod)
-{
-	if (imethod <= IPC_M_LAST_SYSTEM)
-		return true;
-
-	return false;
-}
-
-/** Decide if the message with this interface and method is forwardable.
- *
- * Some system messages may be forwarded, for some of them
- * it is useless.
- *
- * @param imethod Interface and method to be decided.
- *
- * @return True if the interface and method is forwardable.
- *
- */
-static inline bool method_is_forwardable(sysarg_t imethod)
-{
-	switch (imethod) {
-	case IPC_M_PHONE_HUNGUP:
-		/* This message is meant only for the original recipient. */
-		return false;
-	default:
-		return true;
-	}
-}
-
-/** Decide if the message with this interface and method is immutable on forward.
- *
- * Some system messages may be forwarded but their content cannot be altered.
- *
- * @param imethod Interface and method to be decided.
- *
- * @return True if the interface and method is immutable on forward.
- *
- */
-static inline bool method_is_immutable(sysarg_t imethod)
-{
-	switch (imethod) {
-	case IPC_M_PAGE_IN:
-	case IPC_M_SHARE_OUT:
-	case IPC_M_SHARE_IN:
-	case IPC_M_DATA_WRITE:
-	case IPC_M_DATA_READ:
-	case IPC_M_STATE_CHANGE_AUTHORIZE:
-		return true;
-	default:
-		return false;
-	}
-}
-
-/*
- * Functions that preprocess answer before sending it to the recepient.
- */
-
-/** Decide if the caller (e.g. ipc_answer()) should save the old call contents
- * for answer_preprocess().
- *
- * @param call Call structure to be decided.
- *
- * @return true if the old call contents should be saved.
- *
- */
-static inline bool answer_need_old(call_t *call)
-{
-	switch (ipc_get_imethod(&call->data)) {
-	case IPC_M_CONNECT_TO_ME:
-	case IPC_M_CONNECT_ME_TO:
-	case IPC_M_PAGE_IN:
-	case IPC_M_SHARE_OUT:
-	case IPC_M_SHARE_IN:
-	case IPC_M_DATA_WRITE:
-	case IPC_M_DATA_READ:
-	case IPC_M_STATE_CHANGE_AUTHORIZE:
-		return true;
-	default:
-		return false;
-	}
-}
-
-/** Interpret process answer as control information.
- *
- * This function is called directly after sys_ipc_answer().
- *
- * @param answer  Call structure with the answer.
- * @param olddata Saved data of the request.
- *
- * @return Return EOK on success or an error code.
- *
- */
-errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
-{
-	errno_t rc = EOK;
-
-	spinlock_lock(&answer->forget_lock);
-	if (answer->forget) {
-		/*
-		 * This is a forgotten call and answer->sender is not valid.
-		 */
-		spinlock_unlock(&answer->forget_lock);
-
-		SYSIPC_OP(answer_cleanup, answer, olddata);
-		return rc;
-	} else {
-		assert(answer->active);
-
-		/*
-		 * Mark the call as inactive to prevent _ipc_answer_free_call()
-		 * from attempting to remove the call from the active list
-		 * itself.
-		 */
-		answer->active = false;
-
-		/*
-		 * Remove the call from the sender's active call list.
-		 * We enforce this locking order so that any potential
-		 * concurrently executing forget operation is forced to
-		 * release its active_calls_lock and lose the race to
-		 * forget this soon to be answered call.
-		 */
-		spinlock_lock(&answer->sender->active_calls_lock);
-		list_remove(&answer->ta_link);
-		spinlock_unlock(&answer->sender->active_calls_lock);
-	}
-	spinlock_unlock(&answer->forget_lock);
-
-	if ((errno_t) ipc_get_retval(&answer->data) == EHANGUP) {
-		phone_t *phone = answer->caller_phone;
-		mutex_lock(&phone->lock);
-		if (phone->state == IPC_PHONE_CONNECTED) {
-			irq_spinlock_lock(&phone->callee->lock, true);
-			list_remove(&phone->link);
-			/* Drop callee->connected_phones reference */
-			kobject_put(phone->kobject);
-			phone->state = IPC_PHONE_SLAMMED;
-			phone->label = 0;
-			irq_spinlock_unlock(&phone->callee->lock, true);
-		}
-		mutex_unlock(&phone->lock);
-	}
-
-	if (!olddata)
-		return rc;
-
-	return SYSIPC_OP(answer_preprocess, answer, olddata);
-}
-
-/** Called before the request is sent.
- *
- * @param call  Call structure with the request.
- * @param phone Phone that the call will be sent through.
- *
- * @return Return 0 on success, ELIMIT or EPERM on error.
- *
- */
-static errno_t request_preprocess(call_t *call, phone_t *phone)
-{
-	call->request_method = ipc_get_imethod(&call->data);
-	return SYSIPC_OP(request_preprocess, call, phone);
-}
-
-/*
- * Functions called to process received call/answer before passing it to uspace.
- */
-
-/** Do basic kernel processing of received call answer.
- *
- * @param call Call structure with the answer.
- *
- */
-static void process_answer(call_t *call)
-{
-	if (((errno_t) ipc_get_retval(&call->data) == EHANGUP) &&
-	    (call->flags & IPC_CALL_FORWARDED))
-		ipc_set_retval(&call->data, EFORWARD);
-
-	SYSIPC_OP(answer_process, call);
-}
-
-/** Do basic kernel processing of received call request.
- *
- * @param box  Destination answerbox structure.
- * @param call Call structure with the request.
- *
- * @return 0 if the call should be passed to userspace.
- * @return -1 if the call should be ignored.
- *
- */
-static int process_request(answerbox_t *box, call_t *call)
-{
-	return SYSIPC_OP(request_process, call, box);
-}
-
-/** Make a call over IPC and wait for reply.
- *
- * @param handle       Phone capability handle for the call.
- * @param data[inout]  Structure with request/reply data.
- * @param priv         Value to be stored in call->priv.
- *
- * @return EOK on success.
- * @return ENOENT if there is no such phone handle.
- * @return ENOMEM if not enough memory to make the call
- *
- */
-errno_t
-ipc_req_internal(cap_phone_handle_t handle, ipc_data_t *data, sysarg_t priv)
-{
-	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
-	if (!kobj->phone)
-		return ENOENT;
-
-	call_t *call = ipc_call_alloc();
-	if (!call) {
-		kobject_put(kobj);
-		return ENOMEM;
-	}
-
-	call->priv = priv;
-	memcpy(call->data.args, data->args, sizeof(data->args));
-
-	errno_t rc = request_preprocess(call, kobj->phone);
-	if (!rc) {
-#ifdef CONFIG_UDEBUG
-		udebug_stoppable_begin();
-#endif
-
-		kobject_add_ref(call->kobject);
-		rc = ipc_call_sync(kobj->phone, call);
-		spinlock_lock(&call->forget_lock);
-		bool forgotten = call->forget;
-		spinlock_unlock(&call->forget_lock);
-		kobject_put(call->kobject);
-
-#ifdef CONFIG_UDEBUG
-		udebug_stoppable_end();
-#endif
-
-		if (rc != EOK) {
-			if (!forgotten) {
-				/*
-				 * There was an error, but it did not result
-				 * in the call being forgotten. In fact, the
-				 * call was not even sent. We are still
-				 * its owners and are responsible for its
-				 * deallocation.
-				 */
-				kobject_put(call->kobject);
-			} else {
-				/*
-				 * The call was forgotten and it changed hands.
-				 * We are no longer expected to free it.
-				 */
-				assert(rc == EINTR);
-			}
-			kobject_put(kobj);
-			return rc;
-		}
-
-		process_answer(call);
-	} else
-		ipc_set_retval(&call->data, rc);
-
-	memcpy(data->args, call->data.args, sizeof(data->args));
-	kobject_put(call->kobject);
-	kobject_put(kobj);
-
-	return EOK;
-}
-
-/** Check that the task did not exceed the allowed limit of asynchronous calls
- * made over a phone.
- *
- * @param phone Phone to check the limit against.
- *
- * @return 0 if limit not reached or -1 if limit exceeded.
- *
- */
-static int check_call_limit(phone_t *phone)
-{
-	if (atomic_load(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
-		return -1;
-
-	return 0;
-}
-
-/** Make a fast asynchronous call over IPC.
- *
- * This function can only handle three arguments of payload, but is faster than
- * the generic function sys_ipc_call_async_slow().
- *
- * @param handle   Phone capability handle for the call.
- * @param imethod  Interface and method of the call.
- * @param arg1     Service-defined payload argument.
- * @param arg2     Service-defined payload argument.
- * @param arg3     Service-defined payload argument.
- * @param label    User-defined label.
- *
- * @return EOK on success.
- * @return An error code on error.
- *
- */
-sys_errno_t sys_ipc_call_async_fast(cap_phone_handle_t handle, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t label)
-{
-	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
-	if (!kobj)
-		return ENOENT;
-
-	if (check_call_limit(kobj->phone)) {
-		kobject_put(kobj);
-		return ELIMIT;
-	}
-
-	call_t *call = ipc_call_alloc();
-	if (!call) {
-		kobject_put(kobj);
-		return ENOMEM;
-	}
-
-	ipc_set_imethod(&call->data, imethod);
-	ipc_set_arg1(&call->data, arg1);
-	ipc_set_arg2(&call->data, arg2);
-	ipc_set_arg3(&call->data, arg3);
-
-	/*
-	 * To achieve deterministic behavior, zero out arguments that are beyond
-	 * the limits of the fast version.
-	 */
-	ipc_set_arg5(&call->data, 0);
-
-	/* Set the user-defined label */
-	call->data.answer_label = label;
-
-	errno_t res = request_preprocess(call, kobj->phone);
-
-	if (!res)
-		ipc_call(kobj->phone, call);
-	else
-		ipc_backsend_err(kobj->phone, call, res);
-
-	kobject_put(kobj);
-	return EOK;
-}
-
-/** Make an asynchronous IPC call allowing to transmit the entire payload.
- *
- * @param handle  Phone capability for the call.
- * @param data    Userspace address of call data with the request.
- * @param label   User-defined label.
- *
- * @return See sys_ipc_call_async_fast().
- *
- */
-sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t handle, uspace_ptr_ipc_data_t data,
-    sysarg_t label)
-{
-	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
-	if (!kobj)
-		return ENOENT;
-
-	if (check_call_limit(kobj->phone)) {
-		kobject_put(kobj);
-		return ELIMIT;
-	}
-
-	call_t *call = ipc_call_alloc();
-	if (!call) {
-		kobject_put(kobj);
-		return ENOMEM;
-	}
-
-	errno_t rc = copy_from_uspace(&call->data.args, data + offsetof(ipc_data_t, args),
-	    sizeof(call->data.args));
-	if (rc != EOK) {
-		kobject_put(call->kobject);
-		kobject_put(kobj);
-		return (sys_errno_t) rc;
-	}
-
-	/* Set the user-defined label */
-	call->data.answer_label = label;
-
-	errno_t res = request_preprocess(call, kobj->phone);
-
-	if (!res)
-		ipc_call(kobj->phone, call);
-	else
-		ipc_backsend_err(kobj->phone, call, res);
-
-	kobject_put(kobj);
-	return EOK;
-}
-
-/** Forward a received call to another destination
- *
- * Common code for both the fast and the slow version.
- *
- * @param chandle  Call handle of the forwarded call.
- * @param phandle  Phone handle to use for forwarding.
- * @param imethod  New interface and method to use for the forwarded call.
- * @param arg1     New value of the first argument for the forwarded call.
- * @param arg2     New value of the second argument for the forwarded call.
- * @param arg3     New value of the third argument for the forwarded call.
- * @param arg4     New value of the fourth argument for the forwarded call.
- * @param arg5     New value of the fifth argument for the forwarded call.
- * @param mode     Flags that specify mode of the forward operation.
- * @param slow     If true, arg3, arg4 and arg5 are considered. Otherwise
- *                 the function considers only the fast version arguments:
- *                 i.e. arg1 and arg2.
- *
- * @return 0 on succes, otherwise an error code.
- *
- * Warning: Make sure that ARG5 is not rewritten for certain system IPC
- *
- */
-static sys_errno_t sys_ipc_forward_common(cap_call_handle_t chandle,
-    cap_phone_handle_t phandle, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
-{
-	kobject_t *ckobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
-	if (!ckobj)
-		return ENOENT;
-
-	call_t *call = ckobj->call;
-
-	ipc_data_t old;
-	bool need_old = answer_need_old(call);
-	if (need_old)
-		old = call->data;
-
-	bool after_forward = false;
-	errno_t rc;
-
-	kobject_t *pkobj = kobject_get(TASK, phandle, KOBJECT_TYPE_PHONE);
-	if (!pkobj) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	if (!method_is_forwardable(ipc_get_imethod(&call->data))) {
-		rc = EPERM;
-		goto error;
-	}
-
-	call->flags |= IPC_CALL_FORWARDED;
-
-	/*
-	 * User space is not allowed to change interface and method of system
-	 * methods on forward, allow changing ARG1, ARG2, ARG3 and ARG4 by
-	 * means of imethod, arg1, arg2 and arg3.
-	 * If the interface and method is immutable, don't change anything.
-	 */
-	if (!method_is_immutable(ipc_get_imethod(&call->data))) {
-		if (method_is_system(ipc_get_imethod(&call->data))) {
-			if (ipc_get_imethod(&call->data) ==
-			    IPC_M_CONNECT_TO_ME) {
-				kobject_put((kobject_t *) call->priv);
-				call->priv = 0;
-				cap_free(TASK,
-				    (cap_handle_t) ipc_get_arg5(&call->data));
-			}
-
-			ipc_set_arg1(&call->data, imethod);
-			ipc_set_arg2(&call->data, arg1);
-			ipc_set_arg3(&call->data, arg2);
-
-			if (slow)
-				ipc_set_arg4(&call->data, arg3);
-
-			/*
-			 * For system methods we deliberately don't
-			 * overwrite ARG5.
-			 */
-		} else {
-			ipc_set_imethod(&call->data, imethod);
-			ipc_set_arg1(&call->data, arg1);
-			ipc_set_arg2(&call->data, arg2);
-			if (slow) {
-				ipc_set_arg3(&call->data, arg3);
-				ipc_set_arg4(&call->data, arg4);
-				ipc_set_arg5(&call->data, arg5);
-			}
-		}
-	}
-
-	rc = ipc_forward(call, pkobj->phone, &TASK->answerbox, mode);
-	if (rc != EOK) {
-		after_forward = true;
-		goto error;
-	}
-
-	cap_free(TASK, chandle);
-	kobject_put(ckobj);
-	kobject_put(pkobj);
-	return EOK;
-
-error:
-	ipc_set_retval(&call->data, EFORWARD);
-	(void) answer_preprocess(call, need_old ? &old : NULL);
-	if (after_forward)
-		_ipc_answer_free_call(call, false);
-	else
-		ipc_answer(&TASK->answerbox, call);
-
-	cap_free(TASK, chandle);
-	kobject_put(ckobj);
-
-	if (pkobj)
-		kobject_put(pkobj);
-	return rc;
-}
-
-/** Forward a received call to another destination - fast version.
- *
- * In case the original interface and method is a system method, ARG1, ARG2
- * and ARG3 are overwritten in the forwarded message with the new method and
- * the new arg1 and arg2, respectively. Otherwise the IMETHOD, ARG1 and ARG2
- * are rewritten with the new interface and method, arg1 and arg2, respectively.
- * Also note there is a set of immutable methods, for which the new method and
- * arguments are not set and these values are ignored.
- *
- * @param chandle  Call handle of the call to forward.
- * @param phandle  Phone handle to use for forwarding.
- * @param imethod  New interface and method to use for the forwarded call.
- * @param arg1     New value of the first argument for the forwarded call.
- * @param arg2     New value of the second argument for the forwarded call.
- * @param mode     Flags that specify mode of the forward operation.
- *
- * @return 0 on succes, otherwise an error code.
- *
- */
-sys_errno_t sys_ipc_forward_fast(cap_call_handle_t chandle,
-    cap_phone_handle_t phandle, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
-    unsigned int mode)
-{
-	return sys_ipc_forward_common(chandle, phandle, imethod, arg1, arg2, 0,
-	    0, 0, mode, false);
-}
-
-/** Forward a received call to another destination - slow version.
- *
- * This function is the slow verision of the sys_ipc_forward_fast interface.
- * It can copy all five new arguments and the new interface and method from
- * the userspace. It naturally extends the functionality of the fast version.
- * For system methods, it additionally stores the new value of arg3 to ARG4.
- * For non-system methods, it additionally stores the new value of arg3, arg4
- * and arg5, respectively, to ARG3, ARG4 and ARG5, respectively.
- *
- * @param chandle  Call handle of the call to forward.
- * @param phandle  Phone handle to use for forwarding.
- * @param data     Userspace address of the new IPC data.
- * @param mode     Flags that specify mode of the forward operation.
- *
- * @return 0 on succes, otherwise an error code.
- *
- */
-sys_errno_t sys_ipc_forward_slow(cap_call_handle_t chandle,
-    cap_phone_handle_t phandle, uspace_ptr_ipc_data_t data, unsigned int mode)
-{
-	ipc_data_t newdata;
-	errno_t rc = copy_from_uspace(&newdata.args, data + offsetof(ipc_data_t, args),
-	    sizeof(newdata.args));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return sys_ipc_forward_common(chandle, phandle,
-	    ipc_get_imethod(&newdata), ipc_get_arg1(&newdata),
-	    ipc_get_arg2(&newdata), ipc_get_arg3(&newdata),
-	    ipc_get_arg4(&newdata), ipc_get_arg5(&newdata), mode, true);
-}
-
-/** Answer an IPC call - fast version.
- *
- * This function can handle only two return arguments of payload, but is faster
- * than the generic sys_ipc_answer().
- *
- * @param chandle  Call handle to be answered.
- * @param retval   Return value of the answer.
- * @param arg1     Service-defined return value.
- * @param arg2     Service-defined return value.
- * @param arg3     Service-defined return value.
- * @param arg4     Service-defined return value.
- *
- * @return 0 on success, otherwise an error code.
- *
- */
-sys_errno_t sys_ipc_answer_fast(cap_call_handle_t chandle, sysarg_t retval,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
-	if (!kobj)
-		return ENOENT;
-
-	call_t *call = kobj->call;
-	assert(!(call->flags & IPC_CALL_ANSWERED));
-
-	ipc_data_t saved_data;
-	bool saved;
-
-	if (answer_need_old(call)) {
-		memcpy(&saved_data, &call->data, sizeof(call->data));
-		saved = true;
-	} else
-		saved = false;
-
-	ipc_set_retval(&call->data, retval);
-	ipc_set_arg1(&call->data, arg1);
-	ipc_set_arg2(&call->data, arg2);
-	ipc_set_arg3(&call->data, arg3);
-	ipc_set_arg4(&call->data, arg4);
-
-	/*
-	 * To achieve deterministic behavior, zero out arguments that are beyond
-	 * the limits of the fast version.
-	 */
-	ipc_set_arg5(&call->data, 0);
-	errno_t rc = answer_preprocess(call, saved ? &saved_data : NULL);
-
-	ipc_answer(&TASK->answerbox, call);
-
-	kobject_put(kobj);
-	cap_free(TASK, chandle);
-
-	return rc;
-}
-
-/** Answer an IPC call.
- *
- * @param chandle Call handle to be answered.
- * @param data    Userspace address of call data with the answer.
- *
- * @return 0 on success, otherwise an error code.
- *
- */
-sys_errno_t sys_ipc_answer_slow(cap_call_handle_t chandle, uspace_ptr_ipc_data_t data)
-{
-	kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
-	if (!kobj)
-		return ENOENT;
-
-	call_t *call = kobj->call;
-	assert(!(call->flags & IPC_CALL_ANSWERED));
-
-	ipc_data_t saved_data;
-	bool saved;
-
-	if (answer_need_old(call)) {
-		memcpy(&saved_data, &call->data, sizeof(call->data));
-		saved = true;
-	} else
-		saved = false;
-
-	errno_t rc = copy_from_uspace(&call->data.args, data + offsetof(ipc_data_t, args),
-	    sizeof(call->data.args));
-	if (rc != EOK) {
-		/*
-		 * Republish the capability so that the call does not get lost.
-		 */
-		cap_publish(TASK, chandle, kobj);
-		return rc;
-	}
-
-	rc = answer_preprocess(call, saved ? &saved_data : NULL);
-
-	ipc_answer(&TASK->answerbox, call);
-
-	kobject_put(kobj);
-	cap_free(TASK, chandle);
-
-	return rc;
-}
-
-/** Hang up a phone.
- *
- * @param handle  Phone capability handle of the phone to be hung up.
- *
- * @return 0 on success or an error code.
- *
- */
-sys_errno_t sys_ipc_hangup(cap_phone_handle_t handle)
-{
-	kobject_t *kobj = cap_unpublish(TASK, handle, KOBJECT_TYPE_PHONE);
-	if (!kobj)
-		return ENOENT;
-
-	errno_t rc = ipc_phone_hangup(kobj->phone);
-	kobject_put(kobj);
-	cap_free(TASK, handle);
-	return rc;
-}
-
-/** Wait for an incoming IPC call or an answer.
- *
- * @param calldata Pointer to buffer where the call/answer data is stored.
- * @param usec     Timeout. See waitq_sleep_timeout() for explanation.
- * @param flags    Select mode of sleep operation. See waitq_sleep_timeout()
- *                 for explanation.
- *
- * @return An error code on error.
- */
-sys_errno_t sys_ipc_wait_for_call(uspace_ptr_ipc_data_t calldata, uint32_t usec,
-    unsigned int flags)
-{
-	call_t *call = NULL;
-	errno_t rc;
-restart:
-
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_begin();
-#endif
-
-	rc = ipc_wait_for_call(&TASK->answerbox, usec,
-	    flags | SYNCH_FLAGS_INTERRUPTIBLE, &call);
-
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_end();
-#endif
-
-	if (rc != EOK)
-		return rc;
-
-	assert(call);
-
-	call->data.flags = call->flags;
-	if (call->flags & IPC_CALL_NOTIF) {
-		/* Set the request_label to the interrupt counter */
-		call->data.request_label = (sysarg_t) call->priv;
-
-		call->data.cap_handle = CAP_NIL;
-
-		STRUCT_TO_USPACE(calldata, &call->data);
-		kobject_put(call->kobject);
-
-		return EOK;
-	}
-
-	if (call->flags & IPC_CALL_ANSWERED) {
-		process_answer(call);
-
-		if (call->flags & IPC_CALL_DISCARD_ANSWER) {
-			kobject_put(call->kobject);
-			goto restart;
-		}
-
-		call->data.cap_handle = CAP_NIL;
-
-		STRUCT_TO_USPACE(calldata, &call->data);
-		kobject_put(call->kobject);
-
-		return EOK;
-	}
-
-	if (process_request(&TASK->answerbox, call))
-		goto restart;
-
-	cap_handle_t handle = CAP_NIL;
-	rc = cap_alloc(TASK, &handle);
-	if (rc != EOK) {
-		goto error;
-	}
-
-	call->data.cap_handle = handle;
-
-	/*
-	 * Copy the whole call->data to include the request label.
-	 */
-	rc = STRUCT_TO_USPACE(calldata, &call->data);
-	if (rc != EOK)
-		goto error;
-
-	kobject_add_ref(call->kobject);
-	cap_publish(TASK, handle, call->kobject);
-	return EOK;
-
-error:
-	if (cap_handle_valid(handle))
-		cap_free(TASK, handle);
-
-	/*
-	 * The callee will not receive this call and no one else has a chance to
-	 * answer it. Set the IPC_CALL_AUTO_REPLY flag and return the EPARTY
-	 * error code.
-	 */
-	ipc_data_t saved_data;
-	bool saved;
-
-	if (answer_need_old(call)) {
-		memcpy(&saved_data, &call->data, sizeof(call->data));
-		saved = true;
-	} else
-		saved = false;
-
-	ipc_set_retval(&call->data, EPARTY);
-	(void) answer_preprocess(call, saved ? &saved_data : NULL);
-	call->flags |= IPC_CALL_AUTO_REPLY;
-	ipc_answer(&TASK->answerbox, call);
-
-	return rc;
-}
-
-/** Interrupt one thread from sys_ipc_wait_for_call().
- *
- */
-sys_errno_t sys_ipc_poke(void)
-{
-	waitq_wake_one(&TASK->answerbox.wq);
-	return EOK;
-}
-
-/** Connect an IRQ handler to a task.
- *
- * @param inr     IRQ number.
- * @param imethod Interface and method to be associated with the notification.
- * @param ucode   Uspace pointer to the top-half pseudocode.
- *
- * @param[out] uspace_handle  Uspace pointer to IRQ capability handle
- *
- * @return EPERM
- * @return Error code returned by ipc_irq_subscribe().
- *
- */
-sys_errno_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod,
-    uspace_ptr_irq_code_t ucode, uspace_ptr_cap_irq_handle_t uspace_handle)
-{
-	if (!(perm_get(TASK) & PERM_IRQ_REG))
-		return EPERM;
-
-	return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode, uspace_handle);
-}
-
-/** Disconnect an IRQ handler from a task.
- *
- * @param handle  IRQ capability handle.
- *
- * @return Zero on success or EPERM on error.
- *
- */
-sys_errno_t sys_ipc_irq_unsubscribe(cap_irq_handle_t handle)
-{
-	if (!(perm_get(TASK) & PERM_IRQ_REG))
-		return EPERM;
-
-	ipc_irq_unsubscribe(&TASK->answerbox, handle);
-
-	return 0;
-}
-
-/** Syscall connect to a task by ID
- *
- * @return Error code.
- *
- */
-sys_errno_t sys_ipc_connect_kbox(uspace_ptr_task_id_t uspace_taskid,
-    uspace_ptr_cap_phone_handle_t uspace_phone)
-{
-#ifdef CONFIG_UDEBUG
-	task_id_t taskid;
-	cap_phone_handle_t phone;
-
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(task_id_t));
-	if (rc == EOK) {
-		rc = ipc_connect_kbox((task_id_t) taskid, &phone);
-	}
-
-	if (rc == EOK) {
-		rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t));
-		if (rc != EOK) {
-			// Clean up the phone on failure.
-			sys_ipc_hangup(phone);
-		}
-	}
-
-	return (sys_errno_t) rc;
-#else
-	return (sys_errno_t) ENOTSUP;
-#endif
-}
-
-/** @}
- */
Index: rnel/generic/src/ipc/sysipc_ops.c
===================================================================
--- kernel/generic/src/ipc/sysipc_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_ipc
- * @{
- */
-/** @file
- */
-
-#include <ipc/sysipc_ops.h>
-#include <abi/ipc/methods.h>
-#include <abi/errno.h>
-
-/* Forward declarations. */
-extern sysipc_ops_t ipc_m_connect_to_me_ops;
-extern sysipc_ops_t ipc_m_connect_me_to_ops;
-extern sysipc_ops_t ipc_m_page_in_ops;
-extern sysipc_ops_t ipc_m_share_out_ops;
-extern sysipc_ops_t ipc_m_share_in_ops;
-extern sysipc_ops_t ipc_m_data_write_ops;
-extern sysipc_ops_t ipc_m_data_read_ops;
-extern sysipc_ops_t ipc_m_state_change_authorize_ops;
-extern sysipc_ops_t ipc_m_debug_ops;
-
-static sysipc_ops_t *sysipc_ops[] = {
-	[IPC_M_CONNECT_TO_ME] = &ipc_m_connect_to_me_ops,
-	[IPC_M_CONNECT_ME_TO] = &ipc_m_connect_me_to_ops,
-	[IPC_M_PAGE_IN] = &ipc_m_page_in_ops,
-	[IPC_M_SHARE_OUT] = &ipc_m_share_out_ops,
-	[IPC_M_SHARE_IN] = &ipc_m_share_in_ops,
-	[IPC_M_DATA_WRITE] = &ipc_m_data_write_ops,
-	[IPC_M_DATA_READ] = &ipc_m_data_read_ops,
-	[IPC_M_STATE_CHANGE_AUTHORIZE] = &ipc_m_state_change_authorize_ops,
-	[IPC_M_DEBUG] = &ipc_m_debug_ops
-};
-
-static sysipc_ops_t null_ops = {
-	.request_preprocess = null_request_preprocess,
-	.request_forget = null_request_forget,
-	.request_process = null_request_process,
-	.answer_cleanup = null_answer_cleanup,
-	.answer_preprocess = null_answer_preprocess,
-	.answer_process = null_answer_process,
-};
-
-errno_t null_request_preprocess(call_t *call, phone_t *phone)
-{
-	return EOK;
-}
-
-errno_t null_request_forget(call_t *call)
-{
-	return EOK;
-}
-
-int null_request_process(call_t *call, answerbox_t *box)
-{
-	return 0;
-}
-
-errno_t null_answer_cleanup(call_t *call, ipc_data_t *data)
-{
-	return EOK;
-}
-
-errno_t null_answer_preprocess(call_t *call, ipc_data_t *data)
-{
-	return EOK;
-}
-
-errno_t null_answer_process(call_t *call)
-{
-	return EOK;
-}
-
-sysipc_ops_t *sysipc_ops_get(sysarg_t imethod)
-{
-	if (imethod < sizeof(sysipc_ops) / (sizeof(sysipc_ops_t *)))
-		return sysipc_ops[imethod] ? sysipc_ops[imethod] : &null_ops;
-
-	return &null_ops;
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/elf.c
===================================================================
--- kernel/generic/src/lib/elf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Kernel ELF loader.
- */
-
-#include <assert.h>
-#include <lib/elf.h>
-#include <typedefs.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <align.h>
-#include <macros.h>
-#include <arch.h>
-#include <str.h>
-
-#include <lib/elf_load.h>
-
-static errno_t load_segment(elf_segment_header_t *, elf_header_t *, as_t *);
-
-/** ELF loader
- *
- * @param header Pointer to ELF header in memory
- * @param as     Created and properly mapped address space
- * @param flags  A combination of ELD_F_*
- *
- * @return EOK on success
- *
- */
-errno_t elf_load(elf_header_t *header, as_t *as)
-{
-	/* Identify ELF */
-	if ((header->e_ident[EI_MAG0] != ELFMAG0) ||
-	    (header->e_ident[EI_MAG1] != ELFMAG1) ||
-	    (header->e_ident[EI_MAG2] != ELFMAG2) ||
-	    (header->e_ident[EI_MAG3] != ELFMAG3))
-		return EINVAL;
-
-	/* Identify ELF compatibility */
-	if ((header->e_ident[EI_DATA] != ELF_DATA_ENCODING) ||
-	    (header->e_machine != ELF_MACHINE) ||
-	    (header->e_ident[EI_VERSION] != EV_CURRENT) ||
-	    (header->e_version != EV_CURRENT) ||
-	    (header->e_ident[EI_CLASS] != ELF_CLASS))
-		return EINVAL;
-
-	if (header->e_phentsize != sizeof(elf_segment_header_t))
-		return EINVAL;
-
-	/* Check if the object type is supported. */
-	if (header->e_type != ET_EXEC)
-		return ENOTSUP;
-
-	/* Check if the ELF image starts on a page boundary */
-	if (ALIGN_UP((uintptr_t) header, PAGE_SIZE) != (uintptr_t) header)
-		return ENOTSUP;
-
-	/* Walk through all segment headers and process them. */
-	elf_half i;
-	for (i = 0; i < header->e_phnum; i++) {
-		elf_segment_header_t *seghdr =
-		    &((elf_segment_header_t *)(((uint8_t *) header) +
-		    header->e_phoff))[i];
-
-		if (seghdr->p_type != PT_LOAD)
-			continue;
-
-		errno_t rc = load_segment(seghdr, header, as);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Load segment described by program header entry.
- *
- * @param entry Program header entry describing segment to be loaded.
- * @param elf   ELF header.
- * @param as    Address space into wich the ELF is being loaded.
- *
- * @return EOK on success, error code otherwise.
- *
- */
-errno_t load_segment(elf_segment_header_t *entry, elf_header_t *elf, as_t *as)
-{
-	mem_backend_data_t backend_data;
-
-	if (entry->p_align > 1) {
-		if ((entry->p_offset % entry->p_align) !=
-		    (entry->p_vaddr % entry->p_align))
-			return EINVAL;
-	}
-
-	unsigned int flags = 0;
-
-	if (entry->p_flags & PF_X)
-		flags |= AS_AREA_EXEC;
-
-	if (entry->p_flags & PF_W)
-		flags |= AS_AREA_WRITE;
-
-	if (entry->p_flags & PF_R)
-		flags |= AS_AREA_READ;
-
-	flags |= AS_AREA_CACHEABLE;
-
-	/*
-	 * Align vaddr down, inserting a little "gap" at the beginning.
-	 * Adjust area size, so that its end remains in place.
-	 *
-	 */
-	uintptr_t base = ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE);
-	size_t mem_sz = entry->p_memsz + (entry->p_vaddr - base);
-
-	backend_data.elf_base = base;
-	backend_data.elf = elf;
-	backend_data.segment = entry;
-
-	as_area_t *area = as_area_create(as, flags, mem_sz,
-	    AS_AREA_ATTR_NONE, &elf_backend, &backend_data, &base, 0);
-	if (!area)
-		return ENOMEM;
-
-	/*
-	 * The segment will be mapped on demand by elf_page_fault().
-	 *
-	 */
-
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/halt.c
===================================================================
--- kernel/generic/src/lib/halt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Halt function.
- */
-
-#include <stdbool.h>
-#include <halt.h>
-#include <log.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <console/kconsole.h>
-
-/** Halt flag */
-atomic_bool haltstate = false;
-
-/** Halt wrapper
- *
- * Set halt flag and halt the CPU.
- *
- */
-void halt(void)
-{
-#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
-	bool rundebugger = false;
-
-	if (!atomic_load(&haltstate)) {
-		atomic_store(&haltstate, true);
-		rundebugger = true;
-	}
-#else
-	atomic_store(&haltstate, true);
-#endif
-
-	interrupts_disable();
-
-#if (defined(CONFIG_DEBUG)) && (defined(CONFIG_KCONSOLE))
-	if ((rundebugger) && (kconsole_check_poll()))
-		kconsole("panic", "\nLast resort kernel console ready.\n", false);
-#endif
-
-	if (CPU)
-		log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);
-	else
-		log(LF_OTHER, LVL_NOTE, "cpu: halted");
-
-	cpu_halt();
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/mem.c
===================================================================
--- kernel/generic/src/lib/mem.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Memory string operations.
- *
- * This file provides architecture independent functions to manipulate blocks
- * of memory. These functions are optimized as much as generic functions of
- * this type can be.
- */
-
-#include <memw.h>
-#include <typedefs.h>
-
-/** Fill block of memory.
- *
- * Fill cnt bytes at dst address with the value val.
- *
- * @param dst Destination address to fill.
- * @param cnt Number of bytes to fill.
- * @param val Value to fill.
- *
- */
-void memsetb(void *dst, size_t cnt, uint8_t val)
-{
-	memset(dst, val, cnt);
-}
-
-/** Fill block of memory.
- *
- * Fill cnt words at dst address with the value val. The filling
- * is done word-by-word.
- *
- * @param dst Destination address to fill.
- * @param cnt Number of words to fill.
- * @param val Value to fill.
- *
- */
-void memsetw(void *dst, size_t cnt, uint16_t val)
-{
-	size_t i;
-	uint16_t *ptr = (uint16_t *) dst;
-
-	for (i = 0; i < cnt; i++)
-		ptr[i] = val;
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/ra.c
===================================================================
--- kernel/generic/src/lib/ra.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,459 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Resource allocator.
- *
- * This is a generic resource allocator, loosely based on the ideas presented
- * in chapter 4 of the following paper and further simplified:
- *
- *   Bonwick J., Adams J.: Magazines and Vmem: Extending the Slab Allocator to
- *   Many CPUs and Arbitrary Resources, USENIX 2001
- *
- */
-
-#include <assert.h>
-#include <lib/ra.h>
-#include <typedefs.h>
-#include <mm/slab.h>
-#include <bitops.h>
-#include <panic.h>
-#include <adt/list.h>
-#include <adt/hash.h>
-#include <adt/hash_table.h>
-#include <align.h>
-#include <macros.h>
-#include <synch/spinlock.h>
-#include <stdlib.h>
-
-static slab_cache_t *ra_segment_cache;
-
-/** Return the hash of the key stored in the item */
-static size_t used_hash(const ht_link_t *item)
-{
-	ra_segment_t *seg = hash_table_get_inst(item, ra_segment_t, uh_link);
-	return hash_mix(seg->base);
-}
-
-/** Return the hash of the key */
-static size_t used_key_hash(const void *key)
-{
-	const uintptr_t *base = key;
-	return hash_mix(*base);
-}
-
-/** Return true if the key is equal to the item's lookup key */
-static bool used_key_equal(const void *key, size_t, const ht_link_t *item)
-{
-	const uintptr_t *base = key;
-	ra_segment_t *seg = hash_table_get_inst(item, ra_segment_t, uh_link);
-	return seg->base == *base;
-}
-
-static const hash_table_ops_t used_ops = {
-	.hash = used_hash,
-	.key_hash = used_key_hash,
-	.key_equal = used_key_equal
-};
-
-/** Calculate the segment size. */
-static size_t ra_segment_size_get(ra_segment_t *seg)
-{
-	ra_segment_t *nextseg;
-
-	nextseg = list_get_instance(seg->segment_link.next, ra_segment_t,
-	    segment_link);
-	return nextseg->base - seg->base;
-}
-
-static ra_segment_t *ra_segment_create(uintptr_t base)
-{
-	ra_segment_t *seg;
-
-	seg = slab_alloc(ra_segment_cache, FRAME_ATOMIC);
-	if (!seg)
-		return NULL;
-
-	link_initialize(&seg->segment_link);
-	link_initialize(&seg->fl_link);
-
-	seg->base = base;
-	seg->flags = 0;
-
-	return seg;
-}
-
-static void ra_segment_destroy(ra_segment_t *seg)
-{
-	slab_free(ra_segment_cache, seg);
-}
-
-static ra_span_t *ra_span_create(uintptr_t base, size_t size)
-{
-	ra_span_t *span;
-	ra_segment_t *seg, *lastseg;
-	unsigned int i;
-
-	span = (ra_span_t *) malloc(sizeof(ra_span_t));
-	if (!span)
-		return NULL;
-
-	span->max_order = fnzb(size);
-	span->base = base;
-	span->size = size;
-
-	span->free = (list_t *) malloc((span->max_order + 1) * sizeof(list_t));
-	if (!span->free) {
-		free(span);
-		return NULL;
-	}
-
-	/*
-	 * Create a segment to represent the entire size of the span.
-	 */
-	seg = ra_segment_create(base);
-	if (!seg) {
-		free(span->free);
-		free(span);
-		return NULL;
-	}
-	seg->flags = RA_SEGMENT_FREE;
-
-	/*
-	 * The last segment will be used as a sentinel at the end of the
-	 * segment list so that it is possible to calculate the size for
-	 * all other segments. It will not be placed in any free list or
-	 * in the used segment hash and adjacent segments will not be
-	 * coalesced with it.
-	 */
-	lastseg = ra_segment_create(base + size);
-	if (!lastseg) {
-		ra_segment_destroy(seg);
-		free(span->free);
-		free(span);
-		return NULL;
-	}
-
-	link_initialize(&span->span_link);
-	list_initialize(&span->segments);
-
-	hash_table_create(&span->used, 0, 0, &used_ops);
-
-	for (i = 0; i <= span->max_order; i++)
-		list_initialize(&span->free[i]);
-
-	/* Insert the first segment into the list of segments. */
-	list_append(&seg->segment_link, &span->segments);
-	/* Insert the last segment into the list of segments. */
-	list_append(&lastseg->segment_link, &span->segments);
-
-	/* Insert the first segment into the respective free list. */
-	list_append(&seg->fl_link, &span->free[span->max_order]);
-
-	return span;
-}
-
-static void ra_span_destroy(ra_span_t *span)
-{
-	hash_table_destroy(&span->used);
-
-	list_foreach_safe(span->segments, cur, next) {
-		ra_segment_t *seg = list_get_instance(cur, ra_segment_t,
-		    segment_link);
-		list_remove(&seg->segment_link);
-		if (seg->flags & RA_SEGMENT_FREE)
-			list_remove(&seg->fl_link);
-		ra_segment_destroy(seg);
-	}
-
-	free(span);
-}
-
-/** Create an empty arena. */
-ra_arena_t *ra_arena_create(void)
-{
-	ra_arena_t *arena;
-
-	arena = (ra_arena_t *) malloc(sizeof(ra_arena_t));
-	if (!arena)
-		return NULL;
-
-	irq_spinlock_initialize(&arena->lock, "arena_lock");
-	list_initialize(&arena->spans);
-
-	return arena;
-}
-
-void ra_arena_destroy(ra_arena_t *arena)
-{
-	/*
-	 * No locking necessary as this is the cleanup and all users should have
-	 * stopped using the arena already.
-	 */
-	list_foreach_safe(arena->spans, cur, next) {
-		ra_span_t *span = list_get_instance(cur, ra_span_t, span_link);
-		list_remove(&span->span_link);
-		ra_span_destroy(span);
-	}
-
-	free(arena);
-}
-
-/** Add a span to arena. */
-bool ra_span_add(ra_arena_t *arena, uintptr_t base, size_t size)
-{
-	ra_span_t *span;
-
-	span = ra_span_create(base, size);
-	if (!span)
-		return false;
-
-	/* TODO: check for overlaps */
-	irq_spinlock_lock(&arena->lock, true);
-	list_append(&span->span_link, &arena->spans);
-	irq_spinlock_unlock(&arena->lock, true);
-	return true;
-}
-
-static bool
-ra_span_alloc(ra_span_t *span, size_t size, size_t align, uintptr_t *base)
-{
-	/*
-	 * We need to add the maximum of align - 1 to be able to compensate for
-	 * the worst case unaligned segment.
-	 */
-	size_t needed = size + align - 1;
-	size_t order = ispwr2(needed) ? fnzb(needed) : fnzb(needed) + 1;
-	ra_segment_t *pred = NULL;
-	ra_segment_t *succ = NULL;
-
-	/*
-	 * Find the free list of the smallest order which can satisfy this
-	 * request.
-	 */
-	for (; order <= span->max_order; order++) {
-		ra_segment_t *seg;
-		uintptr_t newbase;
-
-		if (list_empty(&span->free[order]))
-			continue;
-
-		/* Take the first segment from the free list. */
-		seg = list_get_instance(list_first(&span->free[order]),
-		    ra_segment_t, fl_link);
-
-		assert(seg->flags & RA_SEGMENT_FREE);
-
-		/*
-		 * See if we need to allocate new segments for the chopped-off
-		 * parts of this segment.
-		 */
-		if (!IS_ALIGNED(seg->base, align)) {
-			pred = ra_segment_create(seg->base);
-			if (!pred) {
-				/*
-				 * Fail as we are unable to split the segment.
-				 */
-				break;
-			}
-			pred->flags |= RA_SEGMENT_FREE;
-		}
-		newbase = ALIGN_UP(seg->base, align);
-		if (newbase + size != seg->base + ra_segment_size_get(seg)) {
-			assert(newbase + (size - 1) < seg->base +
-			    (ra_segment_size_get(seg) - 1));
-			succ = ra_segment_create(newbase + size);
-			if (!succ) {
-				if (pred)
-					ra_segment_destroy(pred);
-				/*
-				 * Fail as we are unable to split the segment.
-				 */
-				break;
-			}
-			succ->flags |= RA_SEGMENT_FREE;
-		}
-
-		/* Put unneeded parts back. */
-		if (pred) {
-			size_t pred_order;
-
-			list_insert_before(&pred->segment_link,
-			    &seg->segment_link);
-			pred_order = fnzb(ra_segment_size_get(pred));
-			list_append(&pred->fl_link, &span->free[pred_order]);
-		}
-		if (succ) {
-			size_t succ_order;
-
-			list_insert_after(&succ->segment_link,
-			    &seg->segment_link);
-			succ_order = fnzb(ra_segment_size_get(succ));
-			list_append(&succ->fl_link, &span->free[succ_order]);
-		}
-
-		/* Now remove the found segment from the free list. */
-		list_remove(&seg->fl_link);
-		seg->base = newbase;
-		seg->flags &= ~RA_SEGMENT_FREE;
-
-		/* Hash-in the segment into the used hash. */
-		hash_table_insert(&span->used, &seg->uh_link);
-
-		*base = newbase;
-		return true;
-	}
-
-	return false;
-}
-
-static void ra_span_free(ra_span_t *span, size_t base, size_t size)
-{
-	sysarg_t key = base;
-	ht_link_t *link;
-	ra_segment_t *seg;
-	ra_segment_t *pred;
-	ra_segment_t *succ;
-	size_t order;
-
-	/*
-	 * Locate the segment in the used hash table.
-	 */
-	link = hash_table_find(&span->used, &key);
-	if (!link) {
-		panic("Freeing segment which is not known to be used (base=%zx"
-		    ", size=%zd).", base, size);
-	}
-	seg = hash_table_get_inst(link, ra_segment_t, uh_link);
-
-	/*
-	 * Hash out the segment.
-	 */
-	hash_table_remove_item(&span->used, link);
-
-	assert(!(seg->flags & RA_SEGMENT_FREE));
-	assert(seg->base == base);
-	assert(ra_segment_size_get(seg) == size);
-
-	/*
-	 * Check whether the segment can be coalesced with its left neighbor.
-	 */
-	if (list_first(&span->segments) != &seg->segment_link) {
-		pred = hash_table_get_inst(seg->segment_link.prev,
-		    ra_segment_t, segment_link);
-
-		assert(pred->base < seg->base);
-
-		if (pred->flags & RA_SEGMENT_FREE) {
-			/*
-			 * The segment can be coalesced with its predecessor.
-			 * Remove the predecessor from the free and segment
-			 * lists, rebase the segment and throw the predecessor
-			 * away.
-			 */
-			list_remove(&pred->fl_link);
-			list_remove(&pred->segment_link);
-			seg->base = pred->base;
-			ra_segment_destroy(pred);
-		}
-	}
-
-	/*
-	 * Check whether the segment can be coalesced with its right neighbor.
-	 */
-	succ = hash_table_get_inst(seg->segment_link.next, ra_segment_t,
-	    segment_link);
-	assert(succ->base > seg->base);
-	if (succ->flags & RA_SEGMENT_FREE) {
-		/*
-		 * The segment can be coalesced with its successor.
-		 * Remove the successor from the free and segment lists
-		 * and throw it away.
-		 */
-		list_remove(&succ->fl_link);
-		list_remove(&succ->segment_link);
-		ra_segment_destroy(succ);
-	}
-
-	/* Put the segment on the appropriate free list. */
-	seg->flags |= RA_SEGMENT_FREE;
-	order = fnzb(ra_segment_size_get(seg));
-	list_append(&seg->fl_link, &span->free[order]);
-}
-
-/** Allocate resources from arena. */
-bool
-ra_alloc(ra_arena_t *arena, size_t size, size_t alignment, uintptr_t *base)
-{
-	bool success = false;
-
-	assert(size >= 1);
-	assert(alignment >= 1);
-	assert(ispwr2(alignment));
-
-	irq_spinlock_lock(&arena->lock, true);
-	list_foreach(arena->spans, span_link, ra_span_t, span) {
-		success = ra_span_alloc(span, size, alignment, base);
-		if (success)
-			break;
-	}
-	irq_spinlock_unlock(&arena->lock, true);
-
-	return success;
-}
-
-/* Return resources to arena. */
-void ra_free(ra_arena_t *arena, uintptr_t base, size_t size)
-{
-	irq_spinlock_lock(&arena->lock, true);
-	list_foreach(arena->spans, span_link, ra_span_t, span) {
-		if (iswithin(span->base, span->size, base, size)) {
-			ra_span_free(span, base, size);
-			irq_spinlock_unlock(&arena->lock, true);
-			return;
-		}
-	}
-	irq_spinlock_unlock(&arena->lock, true);
-
-	panic("Freeing to wrong arena (base=%" PRIxPTR ", size=%zd).",
-	    base, size);
-}
-
-void ra_init(void)
-{
-	ra_segment_cache = slab_cache_create("ra_segment_t",
-	    sizeof(ra_segment_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/rd.c
===================================================================
--- kernel/generic/src/lib/rd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief RAM disk support.
- *
- * Support for RAM disk images.
- */
-
-#include <assert.h>
-#include <log.h>
-#include <lib/rd.h>
-#include <mm/frame.h>
-#include <sysinfo/sysinfo.h>
-#include <ddi/ddi.h>
-
-/** Physical memory area for RAM disk. */
-static parea_t rd_parea;
-
-/** RAM disk initialization routine
- *
- * The information about the RAM disk is provided as sysinfo
- * values to the uspace tasks.
- *
- */
-void init_rd(void *data, size_t size)
-{
-	uintptr_t base = (uintptr_t) data;
-	assert((base % FRAME_SIZE) == 0);
-
-	ddi_parea_init(&rd_parea);
-	rd_parea.pbase = base;
-	rd_parea.frames = SIZE2FRAMES(size);
-	rd_parea.unpriv = false;
-	rd_parea.mapped = false;
-	ddi_parea_register(&rd_parea);
-
-	sysinfo_set_item_val("rd", NULL, true);
-	sysinfo_set_item_val("rd.size", NULL, size);
-	sysinfo_set_item_val("rd.address.physical", NULL, (sysarg_t) base);
-
-	log(LF_OTHER, LVL_NOTE, "RAM disk at %p (size %zu bytes)", (void *) base,
-	    size);
-}
-
-/** @}
- */
Index: rnel/generic/src/lib/ubsan.c
===================================================================
--- kernel/generic/src/lib/ubsan.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,269 +1,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-/*
- * Copyright (c) 2016, Linaro Limited
- */
-
-/* Modified for HelenOS use by Jiří Zárevúcky. */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <panic.h>
-#include <memw.h>
-
-#define PRINTF(...) printf(__VA_ARGS__)
-
-struct source_location {
-	const char *file_name;
-	uint32_t line;
-	uint32_t column;
-};
-
-struct type_descriptor {
-	uint16_t type_kind;
-	uint16_t type_info;
-	char type_name[];
-};
-
-struct type_mismatch_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-	unsigned long alignment;
-	unsigned char type_check_kind;
-};
-
-struct type_mismatch_data_v1 {
-	struct source_location loc;
-	struct type_descriptor *type;
-	unsigned char log_alignment;
-	unsigned char type_check_kind;
-};
-
-struct overflow_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct shift_out_of_bounds_data {
-	struct source_location loc;
-	struct type_descriptor *lhs_type;
-	struct type_descriptor *rhs_type;
-};
-
-struct out_of_bounds_data {
-	struct source_location loc;
-	struct type_descriptor *array_type;
-	struct type_descriptor *index_type;
-};
-
-struct unreachable_data {
-	struct source_location loc;
-};
-
-struct vla_bound_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct invalid_value_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct nonnull_arg_data {
-	struct source_location loc;
-};
-
-struct nonnull_return_data {
-	struct source_location loc;
-	struct source_location attr_loc;
-};
-
-struct pointer_overflow_data {
-	struct source_location loc;
-};
-
-/*
- * When compiling with -fsanitize=undefined the compiler expects functions
- * with the following signatures. The functions are never called directly,
- * only when undefined behavior is detected in instrumented code.
- */
-void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, unsigned long ptr);
-void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, unsigned long ptr);
-void __ubsan_handle_add_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_sub_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_mul_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_negate_overflow(struct overflow_data *data, unsigned long old_val);
-void __ubsan_handle_divrem_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, unsigned long idx);
-void __ubsan_handle_unreachable(struct unreachable_data *data);
-void __ubsan_handle_missing_return(struct unreachable_data *data);
-void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, unsigned long bound);
-void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, unsigned long val);
-#if __GCC_VERSION < 60000
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data, size_t arg_no);
-#else
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data);
-#endif
-void __ubsan_handle_nonnull_return(struct nonnull_return_data *data);
-void __ubsan_handle_nonnull_return_v1(struct nonnull_return_data *data,
-    struct source_location *loc);
-void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
-    unsigned long base, unsigned long result);
-void __ubsan_handle_builtin_unreachable(struct unreachable_data *data);
-
-/* A real function for potential breakpoint location. */
-__attribute__((noinline))
-    static void ubsan_panic(void)
-{
-	panic("... aborting ...");
-}
-
-static void print_loc(const char *func, struct source_location *loc)
-{
-	const char *f = func;
-	const char func_prefix[] = "__ubsan_handle";
-
-	if (!memcmp(f, func_prefix, sizeof(func_prefix) - 1))
-		f += sizeof(func_prefix);
-
-	PRINTF("Undefined behavior %s at %s:%" PRIu32 " col %" PRIu32 "\n",
-	    f, loc->file_name, loc->line, loc->column);
-}
-
-void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
-    unsigned long ptr)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_add_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_sub_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_mul_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_negate_overflow(struct overflow_data *data,
-    unsigned long old_val)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_divrem_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	PRINTF("LHS type: %s, value: %lu, RHS type: %s, value: %lu\n",
-	    data->lhs_type->type_name, lhs, data->rhs_type->type_name, rhs);
-	ubsan_panic();
-}
-
-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data,
-    unsigned long idx)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_unreachable(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_missing_return(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data,
-    unsigned long bound)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_load_invalid_value(struct invalid_value_data *data,
-    unsigned long val)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-#if __GCC_VERSION < 60000
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data, size_t arg_no)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-#else
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-#endif
-
-void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_nonnull_return_v1(struct nonnull_return_data *data,
-    struct source_location *loc)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
-    unsigned long base, unsigned long result)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data,
-    unsigned long ptr)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
Index: rnel/generic/src/log/log.c
===================================================================
--- kernel/generic/src/log/log.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,355 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <abi/log.h>
-#include <arch.h>
-#include <atomic.h>
-#include <console/console.h>
-#include <ddi/ddi.h>
-#include <ddi/irq.h>
-#include <errno.h>
-#include <ipc/event.h>
-#include <ipc/irq.h>
-#include <log.h>
-#include <panic.h>
-#include <print.h>
-#include <printf_core.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <str.h>
-#include <synch/spinlock.h>
-#include <syscall/copy.h>
-#include <sysinfo/sysinfo.h>
-#include <typedefs.h>
-
-#define LOG_PAGES    8
-#define LOG_LENGTH   (LOG_PAGES * PAGE_SIZE)
-#define LOG_ENTRY_HEADER_LENGTH (sizeof(size_t) + sizeof(uint32_t))
-
-/** Cyclic buffer holding the data for kernel log */
-static uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));
-
-/** Kernel log initialized */
-static atomic_bool log_inited = false;
-
-/** Position in the cyclic buffer where the first log entry starts */
-static size_t log_start = 0;
-
-/** Sum of length of all log entries currently stored in the cyclic buffer */
-static size_t log_used = 0;
-
-/** Log spinlock */
-static IRQ_SPINLOCK_INITIALIZE(log_lock);
-
-/** Overall count of logged messages, which may overflow as needed */
-static uint32_t log_counter = 0;
-
-/** Starting position of the entry currently being written to the log */
-static size_t log_current_start = 0;
-
-/** Length (including header) of the entry currently being written to the log */
-static size_t log_current_len = 0;
-
-/** Start of the next entry to be handed to uspace starting from log_start */
-static size_t next_for_uspace = 0;
-
-static void log_update(void *);
-
-/** Initialize kernel logging facility
- *
- */
-void log_init(void)
-{
-	event_set_unmask_callback(EVENT_KLOG, log_update);
-	atomic_store(&log_inited, true);
-}
-
-static size_t log_copy_from(uint8_t *data, size_t pos, size_t len)
-{
-	for (size_t i = 0; i < len; i++, pos = (pos + 1) % LOG_LENGTH) {
-		data[i] = log_buffer[pos];
-	}
-	return pos;
-}
-
-static size_t log_copy_to(const uint8_t *data, size_t pos, size_t len)
-{
-	for (size_t i = 0; i < len; i++, pos = (pos + 1) % LOG_LENGTH) {
-		log_buffer[pos] = data[i];
-	}
-	return pos;
-}
-
-/** Append data to the currently open log entry.
- *
- * This function requires that the log_lock is acquired by the caller.
- */
-static void log_append(const uint8_t *data, size_t len)
-{
-	/* Cap the length so that the entry entirely fits into the buffer */
-	if (len > LOG_LENGTH - log_current_len) {
-		len = LOG_LENGTH - log_current_len;
-	}
-
-	if (len == 0)
-		return;
-
-	size_t log_free = LOG_LENGTH - log_used - log_current_len;
-
-	/* Discard older entries to make space, if necessary */
-	while (len > log_free) {
-		size_t entry_len;
-		log_copy_from((uint8_t *) &entry_len, log_start, sizeof(size_t));
-		log_start = (log_start + entry_len) % LOG_LENGTH;
-		log_used -= entry_len;
-		log_free += entry_len;
-		next_for_uspace -= entry_len;
-	}
-
-	size_t pos = (log_current_start + log_current_len) % LOG_LENGTH;
-	log_copy_to(data, pos, len);
-	log_current_len += len;
-}
-
-/** Begin writing an entry to the log.
- *
- * This acquires the log and output buffer locks, so only calls to log_* functions should
- * be used until calling log_end.
- */
-void log_begin(log_facility_t fac, log_level_t level)
-{
-	console_lock();
-	irq_spinlock_lock(&log_lock, true);
-	irq_spinlock_lock(&kio_lock, true);
-
-	log_current_start = (log_start + log_used) % LOG_LENGTH;
-	log_current_len = 0;
-
-	/* Write header of the log entry, the length will be written in log_end() */
-	log_append((uint8_t *) &log_current_len, sizeof(size_t));
-	log_append((uint8_t *) &log_counter, sizeof(uint32_t));
-	uint32_t fac32 = fac;
-	uint32_t lvl32 = level;
-	log_append((uint8_t *) &fac32, sizeof(uint32_t));
-	log_append((uint8_t *) &lvl32, sizeof(uint32_t));
-
-	log_counter++;
-}
-
-/** Finish writing an entry to the log.
- *
- * This releases the log and output buffer locks.
- */
-void log_end(void)
-{
-	/* Set the length in the header to correct value */
-	log_copy_to((uint8_t *) &log_current_len, log_current_start, sizeof(size_t));
-	log_used += log_current_len;
-
-	kio_push_bytes("\n", 1);
-	irq_spinlock_unlock(&kio_lock, true);
-	irq_spinlock_unlock(&log_lock, true);
-
-	/* This has to be called after we released the locks above */
-	kio_flush();
-	kio_update(NULL);
-	log_update(NULL);
-	console_unlock();
-}
-
-static void log_update(void *event)
-{
-	if (!atomic_load(&log_inited))
-		return;
-
-	irq_spinlock_lock(&log_lock, true);
-	if (next_for_uspace < log_used)
-		event_notify_0(EVENT_KLOG, true);
-	irq_spinlock_unlock(&log_lock, true);
-}
-
-static int log_printf_str_write(const char *str, size_t size, void *data)
-{
-	kio_push_bytes(str, size);
-	log_append((const uint8_t *)str, size);
-	return EOK;
-}
-
-/** Append a message to the currently being written entry.
- *
- * Requires that an entry has been started using log_begin()
- */
-int log_vprintf(const char *fmt, va_list args)
-{
-	printf_spec_t ps = {
-		log_printf_str_write,
-		NULL
-	};
-
-	return printf_core(fmt, &ps, args);
-}
-
-/** Append a message to the currently being written entry.
- *
- * Requires that an entry has been started using log_begin()
- */
-int log_printf(const char *fmt, ...)
-{
-	int ret;
-	va_list args;
-
-	va_start(args, fmt);
-	ret = log_vprintf(fmt, args);
-	va_end(args);
-
-	return ret;
-}
-
-/** Log a message to the kernel log.
- *
- * This atomically appends a log entry.
- * The resulting message should not contain a trailing newline, as the log
- * entries are explicitly delimited when stored in the log.
- */
-int log(log_facility_t fac, log_level_t level, const char *fmt, ...)
-{
-	int ret;
-	va_list args;
-
-	log_begin(fac, level);
-
-	va_start(args, fmt);
-	ret = log_vprintf(fmt, args);
-	va_end(args);
-
-	log_end();
-
-	return ret;
-}
-
-/** Control of the log from uspace
- *
- */
-sys_errno_t sys_klog(sysarg_t operation, uspace_addr_t buf, size_t size,
-    sysarg_t level, uspace_ptr_size_t uspace_nread)
-{
-	char *data;
-	errno_t rc;
-
-	if (size > PAGE_SIZE)
-		return (sys_errno_t) ELIMIT;
-
-	switch (operation) {
-	case KLOG_WRITE:
-		data = (char *) malloc(size + 1);
-		if (!data)
-			return (sys_errno_t) ENOMEM;
-
-		rc = copy_from_uspace(data, buf, size);
-		if (rc) {
-			free(data);
-			return (sys_errno_t) rc;
-		}
-		data[size] = 0;
-
-		if (level >= LVL_LIMIT)
-			level = LVL_NOTE;
-
-		log(LF_USPACE, level, "%s", data);
-
-		free(data);
-		return EOK;
-	case KLOG_READ:
-		data = (char *) malloc(size);
-		if (!data)
-			return (sys_errno_t) ENOMEM;
-
-		size_t entry_len = 0;
-		size_t copied = 0;
-
-		rc = EOK;
-
-		irq_spinlock_lock(&log_lock, true);
-
-		while (next_for_uspace < log_used) {
-			size_t pos = (log_start + next_for_uspace) % LOG_LENGTH;
-			log_copy_from((uint8_t *) &entry_len, pos, sizeof(size_t));
-
-			if (entry_len > PAGE_SIZE) {
-				/*
-				 * Since we limit data transfer
-				 * to uspace to a maximum of PAGE_SIZE
-				 * bytes, skip any entries larger
-				 * than this limit to prevent
-				 * userspace being stuck trying to
-				 * read them.
-				 */
-				next_for_uspace += entry_len;
-				continue;
-			}
-
-			if (size < copied + entry_len) {
-				if (copied == 0)
-					rc = EOVERFLOW;
-				break;
-			}
-
-			log_copy_from((uint8_t *) (data + copied), pos, entry_len);
-			copied += entry_len;
-			next_for_uspace += entry_len;
-		}
-
-		irq_spinlock_unlock(&log_lock, true);
-
-		if (rc != EOK) {
-			free(data);
-			return (sys_errno_t) rc;
-		}
-
-		rc = copy_to_uspace(buf, data, size);
-
-		free(data);
-
-		if (rc != EOK)
-			return (sys_errno_t) rc;
-
-		return copy_to_uspace(uspace_nread, &copied, sizeof(copied));
-		return EOK;
-	default:
-		return (sys_errno_t) ENOTSUP;
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,332 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Kernel initialization thread.
- *
- * This file contains kinit kernel thread which carries out
- * high level system initialization.
- *
- * This file is responsible for finishing SMP configuration
- * and creation of userspace init tasks.
- */
-
-#include <assert.h>
-#include <main/kinit.h>
-#include <config.h>
-#include <arch.h>
-#include <proc/scheduler.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <proc/program.h>
-#include <panic.h>
-#include <halt.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <mm/page.h>
-#include <arch/mm/page.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <mm/km.h>
-#include <stdio.h>
-#include <log.h>
-#include <memw.h>
-#include <console/console.h>
-#include <interrupt.h>
-#include <console/kconsole.h>
-#include <security/perm.h>
-#include <lib/rd.h>
-#include <ipc/ipc.h>
-#include <str.h>
-#include <str_error.h>
-#include <sysinfo/stats.h>
-#include <sysinfo/sysinfo.h>
-#include <align.h>
-#include <stdlib.h>
-#include <debug/register.h>
-
-#ifdef CONFIG_SMP
-#include <smp/smp.h>
-#endif /* CONFIG_SMP */
-
-#include <synch/waitq.h>
-#include <synch/spinlock.h>
-
-#define ALIVE_CHARS  4
-
-#ifdef CONFIG_KCONSOLE
-static char alive[ALIVE_CHARS] = "-\\|/";
-#endif
-
-#define INIT_PREFIX      "init:"
-#define INIT_PREFIX_LEN  5
-
-/** Kernel initialization thread.
- *
- * kinit takes care of higher level kernel
- * initialization (i.e. thread creation,
- * userspace initialization etc.).
- *
- * @param arg Not used.
- */
-void kinit(void *arg)
-{
-	thread_t *thread;
-
-	interrupts_disable();
-
-#ifdef CONFIG_SMP
-	if (config.cpu_count > 1) {
-		/*
-		 * Create the kmp thread and wait for its completion.
-		 * cpu1 through cpuN-1 will come up consecutively and
-		 * not mess together with kcpulb threads.
-		 * Just a beautification.
-		 */
-		thread = thread_create(kmp, NULL, TASK,
-		    THREAD_FLAG_UNCOUNTED, "kmp");
-		if (!thread)
-			panic("Unable to create kmp thread.");
-
-		thread_wire(thread, &cpus[0]);
-		thread_start(thread);
-		thread_join(thread);
-
-		/*
-		 * For each CPU, create its load balancing thread.
-		 */
-		unsigned int i;
-
-		for (i = 0; i < config.cpu_count; i++) {
-			thread = thread_create(kcpulb, NULL, TASK,
-			    THREAD_FLAG_UNCOUNTED, "kcpulb");
-			if (thread != NULL) {
-				thread_wire(thread, &cpus[i]);
-				thread_start(thread);
-				thread_detach(thread);
-			} else
-				log(LF_OTHER, LVL_ERROR,
-				    "Unable to create kcpulb thread for cpu%u", i);
-		}
-	}
-#endif /* CONFIG_SMP */
-
-	/*
-	 * At this point SMP, if present, is configured.
-	 */
-	ARCH_OP(post_smp_init);
-
-	/* Start thread computing system load */
-	thread = thread_create(kload, NULL, TASK, THREAD_FLAG_NONE,
-	    "kload");
-	if (thread != NULL) {
-		thread_start(thread);
-		thread_detach(thread);
-	} else {
-		log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
-	}
-
-#ifdef CONFIG_KCONSOLE
-	if (stdin) {
-		/*
-		 * Create kernel console.
-		 */
-		thread = thread_create(kconsole_thread, NULL, TASK,
-		    THREAD_FLAG_NONE, "kconsole");
-		if (thread != NULL) {
-			thread_start(thread);
-			thread_detach(thread);
-		} else {
-			log(LF_OTHER, LVL_ERROR,
-			    "Unable to create kconsole thread");
-		}
-	}
-#endif /* CONFIG_KCONSOLE */
-
-	/*
-	 * Store the default stack size in sysinfo so that uspace can create
-	 * stack with this default size.
-	 */
-	sysinfo_set_item_val("default.stack_size", NULL, STACK_SIZE_USER);
-
-	interrupts_enable();
-
-	/*
-	 * Create user tasks, load RAM disk images.
-	 */
-	size_t i;
-	program_t programs[CONFIG_INIT_TASKS] = { };
-
-	// FIXME: do not propagate arguments through sysinfo
-	// but pass them directly to the tasks
-	for (i = 0; i < init.cnt; i++) {
-		const char *arguments = init.tasks[i].arguments;
-		if (str_length(arguments) == 0)
-			continue;
-		if (str_length(init.tasks[i].name) == 0)
-			continue;
-		size_t arguments_size = str_size(arguments);
-
-		void *arguments_copy = malloc(arguments_size);
-		if (arguments_copy == NULL)
-			continue;
-		memcpy(arguments_copy, arguments, arguments_size);
-
-		char item_name[CONFIG_TASK_NAME_BUFLEN + 15];
-		snprintf(item_name, CONFIG_TASK_NAME_BUFLEN + 15,
-		    "init_args.%s", init.tasks[i].name);
-
-		sysinfo_set_item_data(item_name, NULL, arguments_copy, arguments_size);
-	}
-
-	for (i = 0; i < init.cnt; i++) {
-		if (init.tasks[i].paddr % FRAME_SIZE) {
-			log(LF_OTHER, LVL_ERROR,
-			    "init[%zu]: Address is not frame aligned", i);
-			programs[i].task = NULL;
-			continue;
-		}
-
-		/*
-		 * Construct task name from the 'init:' prefix and the
-		 * name stored in the init structure (if any).
-		 */
-
-		char namebuf[TASK_NAME_BUFLEN];
-
-		const char *name = init.tasks[i].name;
-		if (name[0] == 0)
-			name = "<unknown>";
-
-		static_assert(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN, "");
-		str_cpy(namebuf, TASK_NAME_BUFLEN, INIT_PREFIX);
-		str_cpy(namebuf + INIT_PREFIX_LEN,
-		    TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name);
-
-		/*
-		 * Create virtual memory mappings for init task images.
-		 */
-		uintptr_t page = km_map(init.tasks[i].paddr,
-		    init.tasks[i].size, PAGE_SIZE,
-		    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
-		assert(page);
-
-		if (str_cmp(name, "kernel.dbg") == 0) {
-			/*
-			 * Not an actual init task, but rather debug sections extracted
-			 * from the kernel ELF file and handed to us here so we can use
-			 * it for debugging.
-			 */
-
-			register_debug_data((void *) page, init.tasks[i].size);
-			programs[i].task = NULL;
-			continue;
-		}
-
-		if (str_cmp(name, "loader") == 0) {
-			/* Register image as the program loader */
-			if (program_loader == NULL) {
-				program_loader = (void *) page;
-				log(LF_OTHER, LVL_NOTE, "Program loader at %p",
-				    program_loader);
-			} else {
-				log(LF_OTHER, LVL_ERROR,
-				    "init[%zu]: Second binary named \"loader\""
-				    " present.", i);
-			}
-
-			programs[i].task = NULL;
-			continue;
-		}
-
-		errno_t rc = program_create_from_image((void *) page, init.tasks[i].size, namebuf,
-		    &programs[i]);
-
-		if (rc == 0) {
-			assert(programs[i].task != NULL);
-
-			/*
-			 * Set permissions to init userspace tasks.
-			 */
-			perm_set(programs[i].task,
-			    PERM_PERM | PERM_MEM_MANAGER |
-			    PERM_IO_MANAGER | PERM_IRQ_REG);
-
-			if (!ipc_box_0) {
-				ipc_box_0 = &programs[i].task->answerbox;
-				/*
-				 * Hold the first task so that
-				 * ipc_box_0 remains a valid pointer
-				 * even if the first task exits for
-				 * whatever reason.
-				 */
-				task_hold(programs[i].task);
-			}
-
-		} else if (str_cmp(name, "initrd.img") == 0) {
-			init_rd((void *) init.tasks[i].paddr, init.tasks[i].size);
-		} else {
-			log(LF_OTHER, LVL_ERROR,
-			    "init[%zu]: Init binary load failed "
-			    "(error %s, loader status %s)", i,
-			    str_error_name(rc), str_error_name(programs[i].loader_status));
-		}
-	}
-
-	/*
-	 * Run user tasks.
-	 */
-	for (i = 0; i < init.cnt; i++) {
-		if (programs[i].task != NULL) {
-			program_ready(&programs[i]);
-			task_release(programs[i].task);
-		}
-	}
-
-#ifdef CONFIG_KCONSOLE
-	if (!stdin) {
-		thread_sleep(10);
-		printf("kinit: No stdin\nKernel alive: .");
-
-		unsigned int i = 0;
-		while (true) {
-			printf("\b%c", alive[i % ALIVE_CHARS]);
-			thread_sleep(1);
-			i++;
-		}
-	}
-#endif /* CONFIG_KCONSOLE */
-}
-
-/** @}
- */
Index: rnel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,364 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Main initialization kernel function for all processors.
- *
- * During kernel boot, all processors, after architecture dependent
- * initialization, start executing code found in this file. After
- * bringing up all subsystems, control is passed to scheduler().
- *
- * The bootstrap processor starts executing main_bsp() while
- * the application processors start executing main_ap().
- *
- * @see scheduler()
- * @see main_bsp()
- * @see main_ap()
- */
-
-#include <arch/asm.h>
-#include <debug.h>
-#include <context.h>
-#include <stdio.h>
-#include <panic.h>
-#include <config.h>
-#include <time/clock.h>
-#include <time/timeout.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <main/kinit.h>
-#include <main/version.h>
-#include <console/kconsole.h>
-#include <console/console.h>
-#include <log.h>
-#include <cpu.h>
-#include <align.h>
-#include <interrupt.h>
-#include <str.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <mm/km.h>
-#include <mm/tlb.h>
-#include <mm/as.h>
-#include <mm/slab.h>
-#include <mm/reserve.h>
-#include <synch/waitq.h>
-#include <synch/syswaitq.h>
-#include <arch/arch.h>
-#include <arch.h>
-#include <ipc/ipc.h>
-#include <macros.h>
-#include <smp/smp.h>
-#include <ddi/ddi.h>
-#include <main/main.h>
-#include <ipc/event.h>
-#include <sysinfo/sysinfo.h>
-#include <sysinfo/stats.h>
-#include <lib/ra.h>
-#include <cap/cap.h>
-
-/*
- * Ensure [u]int*_t types are of correct size.
- *
- * Probably, this is not the best place for such tests
- * but this file is compiled on all architectures.
- */
-#define CHECK_INT_TYPE_(signness, size) \
-	static_assert(sizeof(signness##size##_t) * 8 == size, \
-	    #signness #size "_t does not have " #size " bits");
-
-#define CHECK_INT_TYPE(size) \
-	CHECK_INT_TYPE_(int, size); \
-	CHECK_INT_TYPE_(uint, size)
-
-CHECK_INT_TYPE(8);
-CHECK_INT_TYPE(16);
-CHECK_INT_TYPE(32);
-CHECK_INT_TYPE(64);
-
-task_t *kernel_task;
-
-/** Global configuration structure. */
-config_t config = {
-	.identity_configured = false,
-	.non_identity_configured = false,
-	.physmem_end = 0
-};
-
-/** Boot arguments. */
-char bargs[CONFIG_BOOT_ARGUMENTS_BUFLEN] = { };
-
-/** Initial user-space tasks */
-init_t init = {
-	.cnt = 0
-};
-
-/** Boot allocations. */
-ballocs_t ballocs = {
-	.base = (uintptr_t) NULL,
-	.size = 0
-};
-
-static context_t ctx;
-
-// NOTE: All kernel stacks must be aligned to STACK_SIZE, see CURRENT.
-static const size_t bootstrap_stack_size = STACK_SIZE;
-static _Alignas(STACK_SIZE) uint8_t bootstrap_stack[STACK_SIZE];
-
-/* Just a convenient value for some assembly code. */
-uint8_t *const bootstrap_stack_top = bootstrap_stack + STACK_SIZE;
-
-/*
- * These two functions prevent stack from underflowing during the
- * kernel boot phase when SP is set to the very top of the reserved
- * space. The stack could get corrupted by a fooled compiler-generated
- * pop sequence otherwise.
- */
-static void main_bsp_separated_stack(void);
-
-#ifdef CONFIG_SMP
-static void main_ap_separated_stack(void);
-#endif
-
-/** Main kernel routine for bootstrap CPU.
- *
- * The code here still runs on the boot stack, which knows nothing about
- * preemption counts.  Because of that, this function cannot directly call
- * functions that disable or enable preemption (e.g. spinlock_lock()). The
- * primary task of this function is to calculate address of a new stack and
- * switch to it.
- *
- * Assuming interrupts_disable().
- *
- */
-_NO_TRACE void main_bsp(void)
-{
-	config.cpu_count = 1;
-	config.cpu_active = 1;
-
-	config.base = (uintptr_t) kernel_load_address;
-
-	config.kernel_size =
-	    ALIGN_UP((uintptr_t) kdata_end - config.base, PAGE_SIZE);
-
-	context_create(&ctx, main_bsp_separated_stack,
-	    bootstrap_stack, bootstrap_stack_size);
-	context_restore(&ctx);
-	/* not reached */
-}
-
-/** Main kernel routine for bootstrap CPU using new stack.
- *
- * Second part of main_bsp().
- *
- */
-void main_bsp_separated_stack(void)
-{
-	/* Keep this the first thing. */
-	current_initialize(CURRENT);
-
-	version_print();
-
-	LOG("\nconfig.base=%p config.kernel_size=%zu",
-	    (void *) config.base, config.kernel_size);
-
-#ifdef CONFIG_KCONSOLE
-	/*
-	 * kconsole data structures must be initialized very early
-	 * because other subsystems will register their respective
-	 * commands.
-	 */
-	kconsole_init();
-#endif
-
-	/*
-	 * Exception handler initialization, before architecture
-	 * starts adding its own handlers
-	 */
-	exc_init();
-
-	/*
-	 * Memory management subsystems initialization.
-	 */
-	ARCH_OP(pre_mm_init);
-	km_identity_init();
-	frame_init();
-	slab_cache_init();
-	malloc_init();
-	ra_init();
-	sysinfo_init();
-	as_init();
-	page_init();
-	tlb_init();
-	km_non_identity_init();
-	ddi_init();
-	ARCH_OP(post_mm_init);
-	reserve_init();
-	ARCH_OP(pre_smp_init);
-	smp_init();
-
-	/* Slab must be initialized after we know the number of processors. */
-	slab_enable_cpucache();
-
-	uint64_t size;
-	const char *size_suffix;
-	bin_order_suffix(zones_total_size(), &size, &size_suffix, false);
-	printf("Detected %u CPU(s), %" PRIu64 " %s free memory\n",
-	    config.cpu_count, size, size_suffix);
-
-	cpu_init();
-	calibrate_delay_loop();
-	ARCH_OP(post_cpu_init);
-
-	clock_counter_init();
-	timeout_init();
-	scheduler_init();
-	caps_init();
-	task_init();
-	thread_init();
-	sys_waitq_init();
-
-	sysinfo_set_item_data("boot_args", NULL, bargs, str_size(bargs) + 1);
-
-	if (init.cnt > 0) {
-		size_t i;
-		for (i = 0; i < init.cnt; i++)
-			LOG("init[%zu].addr=%p, init[%zu].size=%zu",
-			    i, (void *) init.tasks[i].paddr, i, init.tasks[i].size);
-	} else
-		printf("No init binaries found.\n");
-
-	ipc_init();
-	event_init();
-	kio_init();
-	log_init();
-	stats_init();
-
-	/*
-	 * Create kernel task.
-	 */
-	task_t *kernel = task_create(AS_KERNEL, "kernel");
-	if (!kernel)
-		panic("Cannot create kernel task.");
-
-	kernel_task = kernel;
-
-	/*
-	 * Create the first thread.
-	 */
-	thread_t *kinit_thread = thread_create(kinit, NULL, kernel,
-	    THREAD_FLAG_UNCOUNTED, "kinit");
-	if (!kinit_thread)
-		panic("Cannot create kinit thread.");
-	thread_start(kinit_thread);
-	thread_detach(kinit_thread);
-
-	/*
-	 * This call to scheduler_run() will return to kinit,
-	 * starting the thread of kernel threads.
-	 */
-	current_copy(CURRENT, (current_t *) CPU_LOCAL->stack);
-	context_replace(scheduler_run, CPU_LOCAL->stack, STACK_SIZE);
-	/* not reached */
-}
-
-#ifdef CONFIG_SMP
-
-/** Main kernel routine for application CPUs.
- *
- * Executed by application processors, temporary stack
- * is at ctx.sp which was set during BSP boot.
- * This function passes control directly to
- * main_ap_separated_stack().
- *
- * Assuming interrupts_disable()'d.
- *
- */
-void main_ap(void)
-{
-	/*
-	 * Incrementing the active CPU counter will guarantee that the
-	 * *_init() functions can find out that they need to
-	 * do initialization for AP only.
-	 */
-	config.cpu_active++;
-
-	/*
-	 * The CURRENT structure is well defined because ctx.sp is used as stack.
-	 */
-	current_initialize(CURRENT);
-
-	ARCH_OP(pre_mm_init);
-	frame_init();
-	page_init();
-	tlb_init();
-	ARCH_OP(post_mm_init);
-
-	cpu_init();
-	calibrate_delay_loop();
-	ARCH_OP(post_cpu_init);
-
-	/*
-	 * If we woke kmp up before we left the kernel stack, we could
-	 * collide with another CPU coming up. To prevent this, we
-	 * switch to this cpu's private stack prior to waking kmp up.
-	 */
-	current_copy(CURRENT, (current_t *) CPU_LOCAL->stack);
-	context_replace(main_ap_separated_stack, CPU_LOCAL->stack, STACK_SIZE);
-	/* not reached */
-}
-
-/** Main kernel routine for application CPUs using new stack.
- *
- * Second part of main_ap().
- *
- */
-void main_ap_separated_stack(void)
-{
-	/*
-	 * Configure timeouts for this cpu.
-	 */
-	timeout_init();
-
-	semaphore_up(&ap_completion_semaphore);
-	scheduler_run();
-	/* not reached */
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/generic/src/main/shutdown.c
===================================================================
--- kernel/generic/src/main/shutdown.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Shutdown procedures.
- */
-
-#include <arch.h>
-#include <errno.h>
-#include <halt.h>
-#include <log.h>
-#include <main/main.h>
-#include <main/shutdown.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-
-static thread_t *reboot_thrd = NULL;
-SPINLOCK_INITIALIZE(reboot_lock);
-
-void reboot(void)
-{
-	task_done(kernel_task);
-
-#ifdef CONFIG_DEBUG
-	log(LF_OTHER, LVL_DEBUG, "Rebooting the system");
-#endif
-
-	arch_reboot();
-	halt();
-}
-
-/** Thread procedure for rebooting the system.
- *
- * @param arg Argument (unused)
- */
-static void reboot_thrd_proc(void *arg)
-{
-	(void)arg;
-
-	reboot();
-}
-
-/** Reboot the system.
- *
- * @return EOK if reboot started successfully. EBUSY if reboot already
- *         started, ENOMEM if out of memory.
- */
-sys_errno_t sys_reboot(void)
-{
-	thread_t *thread;
-
-	thread = thread_create(reboot_thrd_proc, NULL, kernel_task,
-	    THREAD_FLAG_NONE, "reboot");
-	if (thread == NULL)
-		return ENOMEM;
-
-	spinlock_lock(&reboot_lock);
-
-	if (reboot_thrd != NULL) {
-		spinlock_unlock(&reboot_lock);
-		thread_put(thread);
-		return EBUSY;
-	}
-
-	reboot_thrd = thread;
-
-	spinlock_unlock(&reboot_lock);
-
-	thread_start(thread);
-	thread_detach(thread);
-
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/main/uinit.c
===================================================================
--- kernel/generic/src/main/uinit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Userspace bootstrap thread.
- *
- * This file contains uinit kernel thread wich is used to start every
- * userspace thread including threads created by SYS_THREAD_CREATE syscall.
- *
- * @see SYS_THREAD_CREATE
- */
-
-#include <main/uinit.h>
-#include <typedefs.h>
-#include <proc/thread.h>
-#include <userspace.h>
-#include <stdlib.h>
-#include <arch.h>
-#include <udebug/udebug.h>
-
-/** Thread used to bring up userspace thread.
- *
- * @param arg Pointer to structure containing userspace entry and stack
- *     addresses.
- */
-void uinit(void *arg)
-{
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_end();
-#endif
-
-	uinit_arg_t *uarg = arg;
-	sysarg_t pc = uarg->pc;
-	sysarg_t sp = uarg->sp;
-	free(uarg);
-
-	userspace(pc, sp);
-}
-
-/** @}
- */
Index: rnel/generic/src/main/version.c
===================================================================
--- kernel/generic/src/main/version.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <main/version.h>
-#include <stdio.h>
-#include <macros.h>
-
-static const char *project = "SPARTAN kernel";
-static const char *copyright = STRING(HELENOS_COPYRIGHT);
-static const char *release = STRING(HELENOS_RELEASE);
-static const char *name = STRING(HELENOS_CODENAME);
-static const char *arch = STRING(KARCH);
-
-#ifdef REVISION
-static const char *revision = ", revision " STRING(REVISION);
-#else
-static const char *revision = "";
-#endif
-
-#ifdef TIMESTAMP
-static const char *timestamp = " on " STRING(TIMESTAMP);
-#else
-static const char *timestamp = "";
-#endif
-
-/** Print version information. */
-void version_print(void)
-{
-	printf("%s, release %s (%s)%s\nBuilt%s for %s\n%s\n",
-	    project, release, name, revision, timestamp, arch, copyright);
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2234 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Address space related functions.
- *
- * This file contains address space manipulation functions.
- * Roughly speaking, this is a higher-level client of
- * Virtual Address Translation (VAT) subsystem.
- *
- * Functionality provided by this file allows one to
- * create address spaces and create, resize and share
- * address space areas.
- *
- * @see page.c
- *
- */
-
-#include <mm/as.h>
-#include <arch/mm/as.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <mm/tlb.h>
-#include <arch/mm/page.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/asid.h>
-#include <arch/mm/asid.h>
-#include <preemption.h>
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <adt/list.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch/asm.h>
-#include <panic.h>
-#include <assert.h>
-#include <stdio.h>
-#include <memw.h>
-#include <macros.h>
-#include <bitops.h>
-#include <arch.h>
-#include <errno.h>
-#include <config.h>
-#include <align.h>
-#include <typedefs.h>
-#include <syscall/copy.h>
-#include <arch/interrupt.h>
-#include <interrupt.h>
-#include <stdlib.h>
-
-/**
- * Each architecture decides what functions will be used to carry out
- * address space operations such as creating or locking page tables.
- */
-const as_operations_t *as_operations = NULL;
-
-/** Cache for as_t objects */
-static slab_cache_t *as_cache;
-
-/** Cache for as_page_mapping_t objects */
-static slab_cache_t *as_page_mapping_cache;
-
-/** Cache for used_space_ival_t objects */
-static slab_cache_t *used_space_ival_cache;
-
-/** ASID subsystem lock.
- *
- * This lock protects:
- * - inactive_as_with_asid_list
- * - as->asid for each as of the as_t type
- * - asids_allocated counter
- *
- */
-SPINLOCK_INITIALIZE(asidlock);
-
-/**
- * Inactive address spaces (on all processors)
- * that have valid ASID.
- */
-LIST_INITIALIZE(inactive_as_with_asid_list);
-
-/** Kernel address space. */
-as_t *AS_KERNEL = NULL;
-
-static void *as_areas_getkey(odlink_t *);
-static int as_areas_cmp(void *, void *);
-
-static void used_space_initialize(used_space_t *);
-static void used_space_finalize(used_space_t *);
-static void *used_space_getkey(odlink_t *);
-static int used_space_cmp(void *, void *);
-static used_space_ival_t *used_space_last(used_space_t *);
-static void used_space_remove_ival(used_space_ival_t *);
-static void used_space_shorten_ival(used_space_ival_t *, size_t);
-
-_NO_TRACE static errno_t as_constructor(void *obj, unsigned int flags)
-{
-	as_t *as = (as_t *) obj;
-
-	link_initialize(&as->inactive_as_with_asid_link);
-	mutex_initialize(&as->lock, MUTEX_PASSIVE);
-
-	return as_constructor_arch(as, flags);
-}
-
-_NO_TRACE static size_t as_destructor(void *obj)
-{
-	return as_destructor_arch((as_t *) obj);
-}
-
-/** Initialize address space subsystem. */
-void as_init(void)
-{
-	as_arch_init();
-
-	as_cache = slab_cache_create("as_t", sizeof(as_t), 0,
-	    as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED);
-
-	as_page_mapping_cache = slab_cache_create("as_page_mapping_t",
-	    sizeof(as_page_mapping_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-
-	used_space_ival_cache = slab_cache_create("used_space_ival_t",
-	    sizeof(used_space_ival_t), 0, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-
-	AS_KERNEL = as_create(FLAG_AS_KERNEL);
-	if (!AS_KERNEL)
-		panic("Cannot create kernel address space.");
-}
-
-/** Create address space.
- *
- * @param flags Flags that influence the way in wich the address
- *              space is created.
- *
- */
-as_t *as_create(unsigned int flags)
-{
-	as_t *as = (as_t *) slab_alloc(as_cache, FRAME_ATOMIC);
-	if (!as)
-		return NULL;
-
-	(void) as_create_arch(as, 0);
-
-	odict_initialize(&as->as_areas, as_areas_getkey, as_areas_cmp);
-
-	if (flags & FLAG_AS_KERNEL)
-		as->asid = ASID_KERNEL;
-	else
-		as->asid = ASID_INVALID;
-
-	refcount_init(&as->refcount);
-	as->cpu_refcount = 0;
-
-#ifdef AS_PAGE_TABLE
-	as->genarch.page_table = page_table_create(flags);
-#else
-	page_table_create(flags);
-#endif
-
-	return as;
-}
-
-/** Destroy address space.
- *
- * When there are no tasks referencing this address space (i.e. its refcount is
- * zero), the address space can be destroyed.
- *
- * We know that we don't hold any spinlock.
- *
- * @param as Address space to be destroyed.
- *
- */
-static void as_destroy(as_t *as)
-{
-	DEADLOCK_PROBE_INIT(p_asidlock);
-
-	assert(as != AS);
-	assert(refcount_unique(&as->refcount));
-
-	/*
-	 * Since there is no reference to this address space, it is safe not to
-	 * lock its mutex.
-	 */
-
-	/*
-	 * We need to avoid deadlock between TLB shootdown and asidlock.
-	 * We therefore try to take asid conditionally and if we don't succeed,
-	 * we enable interrupts and try again. This is done while preemption is
-	 * disabled to prevent nested context switches. We also depend on the
-	 * fact that so far no spinlocks are held.
-	 */
-	preemption_disable();
-	ipl_t ipl = interrupts_read();
-
-retry:
-	interrupts_disable();
-	if (!spinlock_trylock(&asidlock)) {
-		interrupts_enable();
-		DEADLOCK_PROBE(p_asidlock, DEADLOCK_THRESHOLD);
-		goto retry;
-	}
-
-	/* Interrupts disabled, enable preemption */
-	preemption_enable();
-
-	if ((as->asid != ASID_INVALID) && (as != AS_KERNEL)) {
-		if (as->cpu_refcount == 0)
-			list_remove(&as->inactive_as_with_asid_link);
-
-		asid_put(as->asid);
-	}
-
-	spinlock_unlock(&asidlock);
-	interrupts_restore(ipl);
-
-	/*
-	 * Destroy address space areas of the address space.
-	 * Need to start from the beginning each time since we are destroying
-	 * the areas.
-	 */
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		/*
-		 * XXX We already have as_area_t, but as_area_destroy will
-		 * have to search for it. This could be made faster.
-		 */
-		as_area_destroy(as, area->base);
-		area = as_area_first(as);
-	}
-
-	odict_finalize(&as->as_areas);
-
-#ifdef AS_PAGE_TABLE
-	page_table_destroy(as->genarch.page_table);
-#else
-	page_table_destroy(NULL);
-#endif
-
-	slab_free(as_cache, as);
-}
-
-/** Hold a reference to an address space.
- *
- * Holding a reference to an address space prevents destruction
- * of that address space.
- *
- * @param as Address space to be held.
- *
- */
-_NO_TRACE void as_hold(as_t *as)
-{
-	refcount_up(&as->refcount);
-}
-
-/** Release a reference to an address space.
- *
- * The last one to release a reference to an address space
- * destroys the address space.
- *
- * @param as Address space to be released.
- *
- */
-_NO_TRACE void as_release(as_t *as)
-{
-	if (refcount_down(&as->refcount))
-		as_destroy(as);
-}
-
-/** Return first address space area.
- *
- * @param as Address space
- * @return First area in @a as (i.e. area with the lowest base address)
- *         or @c NULL if there is none
- */
-as_area_t *as_area_first(as_t *as)
-{
-	odlink_t *odlink = odict_first(&as->as_areas);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, as_area_t, las_areas);
-}
-
-/** Return next address space area.
- *
- * @param cur Current area
- * @return Next area in the same address space or @c NULL if @a cur is the
- *         last area.
- */
-as_area_t *as_area_next(as_area_t *cur)
-{
-	odlink_t *odlink = odict_next(&cur->las_areas, &cur->as->as_areas);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, as_area_t, las_areas);
-}
-
-/** Determine if area with specified parameters would conflict with
- * a specific existing address space area.
- *
- * @param addr    Starting virtual address of the area being tested.
- * @param count   Number of pages in the area being tested.
- * @param guarded True if the area being tested is protected by guard pages.
- * @param area    Area against which we are testing.
- *
- * @return True if the two areas conflict, false otherwise.
- */
-_NO_TRACE static bool area_is_conflicting(uintptr_t addr,
-    size_t count, bool guarded, as_area_t *area)
-{
-	assert((addr % PAGE_SIZE) == 0);
-
-	size_t gsize = P2SZ(count);
-	size_t agsize = P2SZ(area->pages);
-
-	/*
-	 * A guarded area has one guard page before, one page after.
-	 * What we do here is: if either area is guarded, we add
-	 * PAGE_SIZE to the size of both areas. That guarantees
-	 * they will be spaced at least one page apart.
-	 */
-	if (guarded || (area->flags & AS_AREA_GUARD) != 0) {
-		/* Add guard page size unless area is at the end of VA domain */
-		if (!overflows(addr, P2SZ(count)))
-			gsize += PAGE_SIZE;
-
-		/* Add guard page size unless area is at the end of VA domain */
-		if (!overflows(area->base, P2SZ(area->pages)))
-			agsize += PAGE_SIZE;
-	}
-
-	return overlaps(addr, gsize, area->base, agsize);
-
-}
-
-/** Check area conflicts with other areas.
- *
- * @param as      Address space.
- * @param addr    Starting virtual address of the area being tested.
- * @param count   Number of pages in the area being tested.
- * @param guarded True if the area being tested is protected by guard pages.
- * @param avoid   Do not touch this area. I.e. this area is not considered
- *                as presenting a conflict.
- *
- * @return True if there is no conflict, false otherwise.
- *
- */
-_NO_TRACE static bool check_area_conflicts(as_t *as, uintptr_t addr,
-    size_t count, bool guarded, as_area_t *avoid)
-{
-	assert((addr % PAGE_SIZE) == 0);
-	assert(mutex_locked(&as->lock));
-
-	/*
-	 * If the addition of the supposed area address and size overflows,
-	 * report conflict.
-	 */
-	if (overflows_into_positive(addr, P2SZ(count)))
-		return false;
-
-	/*
-	 * We don't want any area to have conflicts with NULL page.
-	 */
-	if (overlaps(addr, P2SZ(count), (uintptr_t) NULL, PAGE_SIZE))
-		return false;
-
-	/*
-	 * To determine if we overlap with another area, we just need
-	 * to look at overlap with the last area with base address <=
-	 * to ours and on the first area with base address > than ours.
-	 *
-	 * First find last area with <= base address.
-	 */
-	odlink_t *odlink = odict_find_leq(&as->as_areas, &addr, NULL);
-	if (odlink != NULL) {
-		as_area_t *area = odict_get_instance(odlink, as_area_t,
-		    las_areas);
-
-		if (area != avoid) {
-			mutex_lock(&area->lock);
-			if (area_is_conflicting(addr, count, guarded, area)) {
-				mutex_unlock(&area->lock);
-				return false;
-			}
-
-			mutex_unlock(&area->lock);
-		}
-
-		/* Next area */
-		odlink = odict_next(odlink, &as->as_areas);
-	}
-
-	/*
-	 * Next area, if any, is the first with base > than our base address.
-	 * If there was no area with <= base, we need to look at the first area.
-	 */
-	if (odlink == NULL)
-		odlink = odict_first(&as->as_areas);
-
-	if (odlink != NULL) {
-		as_area_t *area = odict_get_instance(odlink, as_area_t,
-		    las_areas);
-
-		if (area != avoid) {
-			mutex_lock(&area->lock);
-			if (area_is_conflicting(addr, count, guarded, area)) {
-				mutex_unlock(&area->lock);
-				return false;
-			}
-
-			mutex_unlock(&area->lock);
-		}
-	}
-
-	/*
-	 * So far, the area does not conflict with other areas.
-	 * Check if it is contained in the user address space.
-	 */
-	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
-		return iswithin(USER_ADDRESS_SPACE_START,
-		    (USER_ADDRESS_SPACE_END - USER_ADDRESS_SPACE_START) + 1,
-		    addr, P2SZ(count));
-	}
-
-	return true;
-}
-
-/** Return pointer to unmapped address space area
- *
- * The address space must be already locked when calling
- * this function.
- *
- * @param as      Address space.
- * @param bound   Lowest address bound.
- * @param size    Requested size of the allocation.
- * @param guarded True if the allocation must be protected by guard pages.
- *
- * @return Address of the beginning of unmapped address space area.
- * @return -1 if no suitable address space area was found.
- *
- */
-_NO_TRACE static uintptr_t as_get_unmapped_area(as_t *as, uintptr_t bound,
-    size_t size, bool guarded)
-{
-	assert(mutex_locked(&as->lock));
-
-	if (size == 0)
-		return (uintptr_t) -1;
-
-	/*
-	 * Make sure we allocate from page-aligned
-	 * address. Check for possible overflow in
-	 * each step.
-	 */
-
-	size_t pages = SIZE2FRAMES(size);
-
-	/*
-	 * Find the lowest unmapped address aligned on the size
-	 * boundary, not smaller than bound and of the required size.
-	 */
-
-	/* First check the bound address itself */
-	uintptr_t addr = ALIGN_UP(bound, PAGE_SIZE);
-	if (addr >= bound) {
-		if (guarded) {
-			/*
-			 * Leave an unmapped page between the lower
-			 * bound and the area's start address.
-			 */
-			addr += P2SZ(1);
-		}
-
-		if (check_area_conflicts(as, addr, pages, guarded, NULL))
-			return addr;
-	}
-
-	/* Eventually check the addresses behind each area */
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		mutex_lock(&area->lock);
-
-		addr = area->base + P2SZ(area->pages);
-
-		if (guarded || area->flags & AS_AREA_GUARD) {
-			/*
-			 * We must leave an unmapped page
-			 * between the two areas.
-			 */
-			addr += P2SZ(1);
-		}
-
-		bool avail =
-		    ((addr >= bound) && (addr >= area->base) &&
-		    (check_area_conflicts(as, addr, pages, guarded, area)));
-
-		mutex_unlock(&area->lock);
-
-		if (avail)
-			return addr;
-
-		area = as_area_next(area);
-	}
-
-	/* No suitable address space area found */
-	return (uintptr_t) -1;
-}
-
-/** Get key function for pagemap ordered dictionary.
- *
- * The key is the virtual address of the page (as_page_mapping_t.vaddr)
- *
- * @param odlink Link to as_pagemap_t.map ordered dictionary
- * @return Pointer to virtual address cast as @c void *
- */
-static void *as_pagemap_getkey(odlink_t *odlink)
-{
-	as_page_mapping_t *mapping;
-
-	mapping = odict_get_instance(odlink, as_page_mapping_t, lpagemap);
-	return (void *) &mapping->vaddr;
-}
-
-/** Comparison function for pagemap ordered dictionary.
- *
- * @param a Pointer to virtual address cast as @c void *
- * @param b Pointer to virtual address cast as @c void *
- * @return <0, =0, >0 if virtual address a is less than, equal to, or
- *         greater than b, respectively.
- */
-static int as_pagemap_cmp(void *a, void *b)
-{
-	uintptr_t va = *(uintptr_t *)a;
-	uintptr_t vb = *(uintptr_t *)b;
-
-	if (va < vb)
-		return -1;
-	else if (va == vb)
-		return 0;
-	else
-		return +1;
-}
-
-/** Initialize pagemap.
- *
- * @param pagemap Pagemap
- */
-_NO_TRACE void as_pagemap_initialize(as_pagemap_t *pagemap)
-{
-	odict_initialize(&pagemap->map, as_pagemap_getkey, as_pagemap_cmp);
-}
-
-/** Finalize pagemap.
- *
- * Destroy any entries in the pagemap.
- *
- * @param pagemap Pagemap
- */
-_NO_TRACE void as_pagemap_finalize(as_pagemap_t *pagemap)
-{
-	as_page_mapping_t *mapping = as_pagemap_first(pagemap);
-	while (mapping != NULL) {
-		as_pagemap_remove(mapping);
-		mapping = as_pagemap_first(pagemap);
-	}
-	odict_finalize(&pagemap->map);
-}
-
-/** Get first page mapping.
- *
- * @param pagemap Pagemap
- * @return First mapping or @c NULL if there is none
- */
-_NO_TRACE as_page_mapping_t *as_pagemap_first(as_pagemap_t *pagemap)
-{
-	odlink_t *odlink;
-
-	odlink = odict_first(&pagemap->map);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, as_page_mapping_t, lpagemap);
-}
-
-/** Get next page mapping.
- *
- * @param cur Current mapping
- * @return Next mapping or @c NULL if @a cur is the last one
- */
-_NO_TRACE as_page_mapping_t *as_pagemap_next(as_page_mapping_t *cur)
-{
-	odlink_t *odlink;
-
-	odlink = odict_next(&cur->lpagemap, &cur->pagemap->map);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, as_page_mapping_t, lpagemap);
-}
-
-/** Find frame by virtual address.
- *
- * @param pagemap Pagemap
- * @param vaddr Virtual address of page
- * @param rframe Place to store physical frame address
- * @return EOK on succcess or ENOENT if no mapping found
- */
-_NO_TRACE errno_t as_pagemap_find(as_pagemap_t *pagemap, uintptr_t vaddr,
-    uintptr_t *rframe)
-{
-	odlink_t *odlink;
-	as_page_mapping_t *mapping;
-
-	odlink = odict_find_eq(&pagemap->map, &vaddr, NULL);
-	if (odlink == NULL)
-		return ENOENT;
-
-	mapping = odict_get_instance(odlink, as_page_mapping_t, lpagemap);
-	*rframe = mapping->frame;
-	return EOK;
-}
-
-/** Insert new page mapping.
- *
- * This function can block to allocate kernel memory.
- *
- * @param pagemap Pagemap
- * @param vaddr Virtual page address
- * @param frame Physical frame address
- */
-_NO_TRACE void as_pagemap_insert(as_pagemap_t *pagemap, uintptr_t vaddr,
-    uintptr_t frame)
-{
-	as_page_mapping_t *mapping;
-
-	mapping = slab_alloc(as_page_mapping_cache, 0);
-	mapping->pagemap = pagemap;
-	odlink_initialize(&mapping->lpagemap);
-	mapping->vaddr = vaddr;
-	mapping->frame = frame;
-	odict_insert(&mapping->lpagemap, &pagemap->map, NULL);
-}
-
-/** Remove page mapping.
- *
- * @param mapping Mapping
- */
-_NO_TRACE void as_pagemap_remove(as_page_mapping_t *mapping)
-{
-	odict_remove(&mapping->lpagemap);
-	slab_free(as_page_mapping_cache, mapping);
-}
-
-/** Remove reference to address space area share info.
- *
- * If the reference count drops to 0, the sh_info is deallocated.
- *
- * @param sh_info Pointer to address space area share info.
- *
- */
-_NO_TRACE static void sh_info_remove_reference(share_info_t *sh_info)
-{
-	bool dealloc = false;
-
-	mutex_lock(&sh_info->lock);
-	assert(sh_info->refcount);
-
-	if (--sh_info->refcount == 0) {
-		dealloc = true;
-
-		as_page_mapping_t *mapping = as_pagemap_first(&sh_info->pagemap);
-		while (mapping != NULL) {
-			frame_free(mapping->frame, 1);
-			mapping = as_pagemap_next(mapping);
-		}
-
-	}
-	mutex_unlock(&sh_info->lock);
-
-	if (dealloc) {
-		if (sh_info->backend && sh_info->backend->destroy_shared_data) {
-			sh_info->backend->destroy_shared_data(
-			    sh_info->backend_shared_data);
-		}
-		as_pagemap_finalize(&sh_info->pagemap);
-		free(sh_info);
-	}
-}
-
-/** Create address space area of common attributes.
- *
- * The created address space area is added to the target address space.
- *
- * @param as           Target address space.
- * @param flags        Flags of the area memory.
- * @param size         Size of area.
- * @param attrs        Attributes of the area.
- * @param backend      Address space area backend. NULL if no backend is used.
- * @param backend_data NULL or a pointer to custom backend data.
- * @param base         Starting virtual address of the area.
- *                     If set to AS_AREA_ANY, a suitable mappable area is
- *                     found.
- * @param bound        Lowest address bound if base is set to AS_AREA_ANY.
- *                     Otherwise ignored.
- *
- * @return Address space area on success or NULL on failure.
- *
- */
-as_area_t *as_area_create(as_t *as, unsigned int flags, size_t size,
-    unsigned int attrs, mem_backend_t *backend,
-    mem_backend_data_t *backend_data, uintptr_t *base, uintptr_t bound)
-{
-	if ((*base != (uintptr_t) AS_AREA_ANY) && !IS_ALIGNED(*base, PAGE_SIZE))
-		return NULL;
-
-	if (size == 0)
-		return NULL;
-
-	size_t pages = SIZE2FRAMES(size);
-
-	/* Writeable executable areas are not supported. */
-	if ((flags & AS_AREA_EXEC) && (flags & AS_AREA_WRITE))
-		return NULL;
-
-	bool const guarded = flags & AS_AREA_GUARD;
-
-	mutex_lock(&as->lock);
-
-	if (*base == (uintptr_t) AS_AREA_ANY) {
-		*base = as_get_unmapped_area(as, bound, size, guarded);
-		if (*base == (uintptr_t) -1) {
-			mutex_unlock(&as->lock);
-			return NULL;
-		}
-	}
-
-	if (overflows_into_positive(*base, size)) {
-		mutex_unlock(&as->lock);
-		return NULL;
-	}
-
-	if (!check_area_conflicts(as, *base, pages, guarded, NULL)) {
-		mutex_unlock(&as->lock);
-		return NULL;
-	}
-
-	as_area_t *area = (as_area_t *) malloc(sizeof(as_area_t));
-	if (!area) {
-		mutex_unlock(&as->lock);
-		return NULL;
-	}
-
-	mutex_initialize(&area->lock, MUTEX_PASSIVE);
-
-	area->as = as;
-	odlink_initialize(&area->las_areas);
-	area->flags = flags;
-	area->attributes = attrs;
-	area->pages = pages;
-	area->base = *base;
-	area->backend = backend;
-	area->sh_info = NULL;
-
-	if (backend_data)
-		area->backend_data = *backend_data;
-	else
-		memsetb(&area->backend_data, sizeof(area->backend_data), 0);
-
-	share_info_t *si = NULL;
-
-	/*
-	 * Create the sharing info structure.
-	 * We do this in advance for every new area, even if it is not going
-	 * to be shared.
-	 */
-	if (!(attrs & AS_AREA_ATTR_PARTIAL)) {
-		si = (share_info_t *) malloc(sizeof(share_info_t));
-		if (!si) {
-			free(area);
-			mutex_unlock(&as->lock);
-			return NULL;
-		}
-		mutex_initialize(&si->lock, MUTEX_PASSIVE);
-		si->refcount = 1;
-		si->shared = false;
-		si->backend_shared_data = NULL;
-		si->backend = backend;
-		as_pagemap_initialize(&si->pagemap);
-
-		area->sh_info = si;
-
-		if (area->backend && area->backend->create_shared_data) {
-			if (!area->backend->create_shared_data(area)) {
-				free(area);
-				mutex_unlock(&as->lock);
-				sh_info_remove_reference(si);
-				return NULL;
-			}
-		}
-	}
-
-	if (area->backend && area->backend->create) {
-		if (!area->backend->create(area)) {
-			free(area);
-			mutex_unlock(&as->lock);
-			if (!(attrs & AS_AREA_ATTR_PARTIAL))
-				sh_info_remove_reference(si);
-			return NULL;
-		}
-	}
-
-	used_space_initialize(&area->used_space);
-	odict_insert(&area->las_areas, &as->as_areas, NULL);
-
-	mutex_unlock(&as->lock);
-
-	return area;
-}
-
-/** Find address space area and lock it.
- *
- * @param as Address space.
- * @param va Virtual address.
- *
- * @return Locked address space area containing va on success or
- *         NULL on failure.
- *
- */
-_NO_TRACE static as_area_t *find_area_and_lock(as_t *as, uintptr_t va)
-{
-	assert(mutex_locked(&as->lock));
-
-	odlink_t *odlink = odict_find_leq(&as->as_areas, &va, NULL);
-	if (odlink == NULL)
-		return NULL;
-
-	as_area_t *area = odict_get_instance(odlink, as_area_t, las_areas);
-	mutex_lock(&area->lock);
-
-	assert(area->base <= va);
-
-	if (va <= area->base + (P2SZ(area->pages) - 1))
-		return area;
-
-	mutex_unlock(&area->lock);
-	return NULL;
-}
-
-/** Find address space area and change it.
- *
- * @param as      Address space.
- * @param address Virtual address belonging to the area to be changed.
- *                Must be page-aligned.
- * @param size    New size of the virtual memory block starting at
- *                address.
- * @param flags   Flags influencing the remap operation. Currently unused.
- *
- * @return Zero on success or a value from @ref errno.h otherwise.
- *
- */
-errno_t as_area_resize(as_t *as, uintptr_t address, size_t size, unsigned int flags)
-{
-	if (!IS_ALIGNED(address, PAGE_SIZE))
-		return EINVAL;
-
-	mutex_lock(&as->lock);
-
-	/*
-	 * Locate the area.
-	 */
-	as_area_t *area = find_area_and_lock(as, address);
-	if (!area) {
-		mutex_unlock(&as->lock);
-		return ENOENT;
-	}
-
-	if (!area->backend->is_resizable(area)) {
-		/*
-		 * The backend does not support resizing for this area.
-		 */
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return ENOTSUP;
-	}
-
-	mutex_lock(&area->sh_info->lock);
-	if (area->sh_info->shared) {
-		/*
-		 * Remapping of shared address space areas
-		 * is not supported.
-		 */
-		mutex_unlock(&area->sh_info->lock);
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return ENOTSUP;
-	}
-	mutex_unlock(&area->sh_info->lock);
-
-	size_t pages = SIZE2FRAMES((address - area->base) + size);
-	if (!pages) {
-		/*
-		 * Zero size address space areas are not allowed.
-		 */
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return EPERM;
-	}
-
-	if (pages < area->pages) {
-		uintptr_t start_free = area->base + P2SZ(pages);
-
-		/*
-		 * Shrinking the area.
-		 * No need to check for overlaps.
-		 */
-
-		page_table_lock(as, false);
-
-		/*
-		 * Start TLB shootdown sequence.
-		 */
-
-		ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES,
-		    as->asid, area->base + P2SZ(pages),
-		    area->pages - pages);
-
-		/*
-		 * Remove frames belonging to used space starting from
-		 * the highest addresses downwards until an overlap with
-		 * the resized address space area is found.
-		 */
-		bool cond = true;
-		while (cond) {
-			used_space_ival_t *ival =
-			    used_space_last(&area->used_space);
-			assert(ival != NULL);
-
-			uintptr_t ptr = ival->page;
-			size_t pcount = ival->count;
-			size_t i = 0;
-
-			if (overlaps(ptr, P2SZ(pcount), area->base,
-			    P2SZ(pages))) {
-
-				if (ptr + P2SZ(pcount) <= start_free) {
-					/*
-					 * The whole interval fits completely
-					 * in the resized address space area.
-					 */
-					break;
-				}
-
-				/*
-				 * Part of the interval corresponding to b and
-				 * c overlaps with the resized address space
-				 * area.
-				 */
-
-				/* We are almost done */
-				cond = false;
-				i = (start_free - ptr) >> PAGE_WIDTH;
-
-				/* Shorten the interval to @c i pages */
-				used_space_shorten_ival(ival, i);
-			} else {
-				/*
-				 * The interval of used space can be completely
-				 * removed.
-				 */
-				used_space_remove_ival(ival);
-			}
-
-			for (; i < pcount; i++) {
-				pte_t pte;
-				bool found = page_mapping_find(as,
-				    ptr + P2SZ(i), false, &pte);
-
-				(void) found;
-				assert(found);
-				assert(PTE_VALID(&pte));
-				assert(PTE_PRESENT(&pte));
-
-				if ((area->backend) &&
-				    (area->backend->frame_free)) {
-					area->backend->frame_free(area,
-					    ptr + P2SZ(i),
-					    PTE_GET_FRAME(&pte));
-				}
-
-				page_mapping_remove(as, ptr + P2SZ(i));
-			}
-
-		}
-
-		/*
-		 * Finish TLB shootdown sequence.
-		 */
-
-		tlb_invalidate_pages(as->asid,
-		    area->base + P2SZ(pages),
-		    area->pages - pages);
-
-		/*
-		 * Invalidate software translation caches
-		 * (e.g. TSB on sparc64, PHT on ppc32).
-		 */
-		as_invalidate_translation_cache(as,
-		    area->base + P2SZ(pages),
-		    area->pages - pages);
-		tlb_shootdown_finalize(ipl);
-
-		page_table_unlock(as, false);
-	} else {
-		/*
-		 * Growing the area.
-		 */
-
-		if (overflows_into_positive(address, P2SZ(pages)))
-			return EINVAL;
-
-		/*
-		 * Check for overlaps with other address space areas.
-		 */
-		bool const guarded = area->flags & AS_AREA_GUARD;
-		if (!check_area_conflicts(as, address, pages, guarded, area)) {
-			mutex_unlock(&area->lock);
-			mutex_unlock(&as->lock);
-			return EADDRNOTAVAIL;
-		}
-	}
-
-	if (area->backend && area->backend->resize) {
-		if (!area->backend->resize(area, pages)) {
-			mutex_unlock(&area->lock);
-			mutex_unlock(&as->lock);
-			return ENOMEM;
-		}
-	}
-
-	area->pages = pages;
-
-	mutex_unlock(&area->lock);
-	mutex_unlock(&as->lock);
-
-	return 0;
-}
-
-/** Destroy address space area.
- *
- * @param as      Address space.
- * @param address Address within the area to be deleted.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t as_area_destroy(as_t *as, uintptr_t address)
-{
-	mutex_lock(&as->lock);
-
-	as_area_t *area = find_area_and_lock(as, address);
-	if (!area) {
-		mutex_unlock(&as->lock);
-		return ENOENT;
-	}
-
-	if (area->backend && area->backend->destroy)
-		area->backend->destroy(area);
-
-	page_table_lock(as, false);
-	/*
-	 * Start TLB shootdown sequence.
-	 */
-	ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES, as->asid, area->base,
-	    area->pages);
-
-	/*
-	 * Visit only the pages mapped by used_space.
-	 */
-	used_space_ival_t *ival = used_space_first(&area->used_space);
-	while (ival != NULL) {
-		uintptr_t ptr = ival->page;
-
-		for (size_t size = 0; size < ival->count; size++) {
-			pte_t pte;
-			bool found = page_mapping_find(as,
-			    ptr + P2SZ(size), false, &pte);
-
-			(void) found;
-			assert(found);
-			assert(PTE_VALID(&pte));
-			assert(PTE_PRESENT(&pte));
-
-			if ((area->backend) &&
-			    (area->backend->frame_free)) {
-				area->backend->frame_free(area,
-				    ptr + P2SZ(size),
-				    PTE_GET_FRAME(&pte));
-			}
-
-			page_mapping_remove(as, ptr + P2SZ(size));
-		}
-
-		used_space_remove_ival(ival);
-		ival = used_space_first(&area->used_space);
-	}
-
-	/*
-	 * Finish TLB shootdown sequence.
-	 */
-
-	tlb_invalidate_pages(as->asid, area->base, area->pages);
-
-	/*
-	 * Invalidate potential software translation caches
-	 * (e.g. TSB on sparc64, PHT on ppc32).
-	 */
-	as_invalidate_translation_cache(as, area->base, area->pages);
-	tlb_shootdown_finalize(ipl);
-
-	page_table_unlock(as, false);
-
-	used_space_finalize(&area->used_space);
-	area->attributes |= AS_AREA_ATTR_PARTIAL;
-	sh_info_remove_reference(area->sh_info);
-
-	mutex_unlock(&area->lock);
-
-	/*
-	 * Remove the empty area from address space.
-	 */
-	odict_remove(&area->las_areas);
-
-	free(area);
-
-	mutex_unlock(&as->lock);
-	return 0;
-}
-
-/** Share address space area with another or the same address space.
- *
- * Address space area mapping is shared with a new address space area.
- * If the source address space area has not been shared so far,
- * a new sh_info is created. The new address space area simply gets the
- * sh_info of the source area. The process of duplicating the
- * mapping is done through the backend share function.
- *
- * @param src_as         Pointer to source address space.
- * @param src_base       Base address of the source address space area.
- * @param acc_size       Expected size of the source area.
- * @param dst_as         Pointer to destination address space.
- * @param dst_flags_mask Destination address space area flags mask.
- * @param dst_base       Target base address. If set to -1,
- *                       a suitable mappable area is found.
- * @param bound          Lowest address bound if dst_base is set to -1.
- *                       Otherwise ignored.
- *
- * @return Zero on success.
- * @return ENOENT if there is no such task or such address space.
- * @return EPERM if there was a problem in accepting the area.
- * @return ENOMEM if there was a problem in allocating destination
- *         address space area.
- * @return ENOTSUP if the address space area backend does not support
- *         sharing.
- *
- */
-errno_t as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
-    as_t *dst_as, unsigned int dst_flags_mask, uintptr_t *dst_base,
-    uintptr_t bound)
-{
-	mutex_lock(&src_as->lock);
-	as_area_t *src_area = find_area_and_lock(src_as, src_base);
-	if (!src_area) {
-		/*
-		 * Could not find the source address space area.
-		 */
-		mutex_unlock(&src_as->lock);
-		return ENOENT;
-	}
-
-	if (!src_area->backend->is_shareable(src_area)) {
-		/*
-		 * The backend does not permit sharing of this area.
-		 */
-		mutex_unlock(&src_area->lock);
-		mutex_unlock(&src_as->lock);
-		return ENOTSUP;
-	}
-
-	size_t src_size = P2SZ(src_area->pages);
-	unsigned int src_flags = src_area->flags;
-	mem_backend_t *src_backend = src_area->backend;
-	mem_backend_data_t src_backend_data = src_area->backend_data;
-
-	/* Share the cacheable flag from the original mapping */
-	if (src_flags & AS_AREA_CACHEABLE)
-		dst_flags_mask |= AS_AREA_CACHEABLE;
-
-	if ((src_size != acc_size) ||
-	    ((src_flags & dst_flags_mask) != dst_flags_mask)) {
-		mutex_unlock(&src_area->lock);
-		mutex_unlock(&src_as->lock);
-		return EPERM;
-	}
-
-	/*
-	 * Now we are committed to sharing the area.
-	 * First, prepare the area for sharing.
-	 * Then it will be safe to unlock it.
-	 */
-	share_info_t *sh_info = src_area->sh_info;
-
-	mutex_lock(&sh_info->lock);
-	sh_info->refcount++;
-	bool shared = sh_info->shared;
-	sh_info->shared = true;
-	mutex_unlock(&sh_info->lock);
-
-	if (!shared) {
-		/*
-		 * Call the backend to setup sharing.
-		 * This only happens once for each sh_info.
-		 */
-		src_area->backend->share(src_area);
-	}
-
-	mutex_unlock(&src_area->lock);
-	mutex_unlock(&src_as->lock);
-
-	/*
-	 * Create copy of the source address space area.
-	 * The destination area is created with AS_AREA_ATTR_PARTIAL
-	 * attribute set which prevents race condition with
-	 * preliminary as_page_fault() calls.
-	 * The flags of the source area are masked against dst_flags_mask
-	 * to support sharing in less privileged mode.
-	 */
-	as_area_t *dst_area = as_area_create(dst_as, dst_flags_mask,
-	    src_size, AS_AREA_ATTR_PARTIAL, src_backend,
-	    &src_backend_data, dst_base, bound);
-	if (!dst_area) {
-		/*
-		 * Destination address space area could not be created.
-		 */
-		sh_info_remove_reference(sh_info);
-
-		return ENOMEM;
-	}
-
-	/*
-	 * Now the destination address space area has been
-	 * fully initialized. Clear the AS_AREA_ATTR_PARTIAL
-	 * attribute and set the sh_info.
-	 */
-	mutex_lock(&dst_as->lock);
-	mutex_lock(&dst_area->lock);
-	dst_area->attributes &= ~AS_AREA_ATTR_PARTIAL;
-	dst_area->sh_info = sh_info;
-	mutex_unlock(&dst_area->lock);
-	mutex_unlock(&dst_as->lock);
-
-	return 0;
-}
-
-/** Check access mode for address space area.
- *
- * @param area   Address space area.
- * @param access Access mode.
- *
- * @return False if access violates area's permissions, true
- *         otherwise.
- *
- */
-_NO_TRACE bool as_area_check_access(as_area_t *area, pf_access_t access)
-{
-	assert(mutex_locked(&area->lock));
-
-	int flagmap[] = {
-		[PF_ACCESS_READ] = AS_AREA_READ,
-		[PF_ACCESS_WRITE] = AS_AREA_WRITE,
-		[PF_ACCESS_EXEC] = AS_AREA_EXEC
-	};
-
-	if (!(area->flags & flagmap[access]))
-		return false;
-
-	return true;
-}
-
-/** Convert address space area flags to page flags.
- *
- * @param aflags Flags of some address space area.
- *
- * @return Flags to be passed to page_mapping_insert().
- *
- */
-_NO_TRACE static unsigned int area_flags_to_page_flags(unsigned int aflags)
-{
-	unsigned int flags = PAGE_USER | PAGE_PRESENT;
-
-	if (aflags & AS_AREA_READ)
-		flags |= PAGE_READ;
-
-	if (aflags & AS_AREA_WRITE)
-		flags |= PAGE_WRITE;
-
-	if (aflags & AS_AREA_EXEC)
-		flags |= PAGE_EXEC;
-
-	if (aflags & AS_AREA_CACHEABLE)
-		flags |= PAGE_CACHEABLE;
-
-	return flags;
-}
-
-/** Change address space area flags.
- *
- * The idea is to have the same data, but with a different access mode.
- * This is needed e.g. for writing code into memory and then executing it.
- * In order for this to work properly, this may copy the data
- * into private anonymous memory (unless it's already there).
- *
- * @param as      Address space.
- * @param flags   Flags of the area memory.
- * @param address Address within the area to be changed.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t as_area_change_flags(as_t *as, unsigned int flags, uintptr_t address)
-{
-	/* Flags for the new memory mapping */
-	unsigned int page_flags = area_flags_to_page_flags(flags);
-
-	mutex_lock(&as->lock);
-
-	as_area_t *area = find_area_and_lock(as, address);
-	if (!area) {
-		mutex_unlock(&as->lock);
-		return ENOENT;
-	}
-
-	if (area->backend != &anon_backend) {
-		/* Copying non-anonymous memory not supported yet */
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return ENOTSUP;
-	}
-
-	mutex_lock(&area->sh_info->lock);
-	if (area->sh_info->shared) {
-		/* Copying shared areas not supported yet */
-		mutex_unlock(&area->sh_info->lock);
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return ENOTSUP;
-	}
-	mutex_unlock(&area->sh_info->lock);
-
-	/* An array for storing frame numbers */
-	uintptr_t *old_frame = malloc(area->used_space.pages *
-	    sizeof(uintptr_t));
-	if (!old_frame) {
-		mutex_unlock(&area->lock);
-		mutex_unlock(&as->lock);
-		return ENOMEM;
-	}
-
-	page_table_lock(as, false);
-
-	/*
-	 * Start TLB shootdown sequence.
-	 */
-	ipl_t ipl = tlb_shootdown_start(TLB_INVL_PAGES, as->asid, area->base,
-	    area->pages);
-
-	/*
-	 * Remove used pages from page tables and remember their frame
-	 * numbers.
-	 */
-	size_t frame_idx = 0;
-
-	used_space_ival_t *ival = used_space_first(&area->used_space);
-	while (ival != NULL) {
-		uintptr_t ptr = ival->page;
-		size_t size;
-
-		for (size = 0; size < ival->count; size++) {
-			pte_t pte;
-			bool found = page_mapping_find(as, ptr + P2SZ(size),
-			    false, &pte);
-
-			(void) found;
-			assert(found);
-			assert(PTE_VALID(&pte));
-			assert(PTE_PRESENT(&pte));
-
-			old_frame[frame_idx++] = PTE_GET_FRAME(&pte);
-
-			/* Remove old mapping */
-			page_mapping_remove(as, ptr + P2SZ(size));
-		}
-
-		ival = used_space_next(ival);
-	}
-
-	/*
-	 * Finish TLB shootdown sequence.
-	 */
-
-	tlb_invalidate_pages(as->asid, area->base, area->pages);
-
-	/*
-	 * Invalidate potential software translation caches
-	 * (e.g. TSB on sparc64, PHT on ppc32).
-	 */
-	as_invalidate_translation_cache(as, area->base, area->pages);
-	tlb_shootdown_finalize(ipl);
-
-	page_table_unlock(as, false);
-
-	/*
-	 * Set the new flags.
-	 */
-	area->flags = flags;
-
-	/*
-	 * Map pages back in with new flags. This step is kept separate
-	 * so that the memory area could not be accesed with both the old and
-	 * the new flags at once.
-	 */
-	frame_idx = 0;
-
-	ival = used_space_first(&area->used_space);
-	while (ival != NULL) {
-		uintptr_t ptr = ival->page;
-		size_t size;
-
-		for (size = 0; size < ival->count; size++) {
-			page_table_lock(as, false);
-
-			/* Insert the new mapping */
-			page_mapping_insert(as, ptr + P2SZ(size),
-			    old_frame[frame_idx++], page_flags);
-
-			page_table_unlock(as, false);
-		}
-
-		ival = used_space_next(ival);
-	}
-
-	free(old_frame);
-
-	mutex_unlock(&area->lock);
-	mutex_unlock(&as->lock);
-
-	return 0;
-}
-
-/** Handle page fault within the current address space.
- *
- * This is the high-level page fault handler. It decides whether the page fault
- * can be resolved by any backend and if so, it invokes the backend to resolve
- * the page fault.
- *
- * Interrupts are assumed disabled.
- *
- * @param address Faulting address.
- * @param access  Access mode that caused the page fault (i.e.
- *                read/write/exec).
- * @param istate  Pointer to the interrupted state.
- *
- * @return AS_PF_FAULT on page fault.
- * @return AS_PF_OK on success.
- * @return AS_PF_DEFER if the fault was caused by copy_to_uspace()
- *         or copy_from_uspace().
- *
- */
-int as_page_fault(uintptr_t address, pf_access_t access, istate_t *istate)
-{
-	uintptr_t page = ALIGN_DOWN(address, PAGE_SIZE);
-	int rc = AS_PF_FAULT;
-
-	if (!THREAD)
-		goto page_fault;
-
-	if (!AS)
-		goto page_fault;
-
-	mutex_lock(&AS->lock);
-	as_area_t *area = find_area_and_lock(AS, page);
-	if (!area) {
-		/*
-		 * No area contained mapping for 'page'.
-		 * Signal page fault to low-level handler.
-		 */
-		mutex_unlock(&AS->lock);
-		goto page_fault;
-	}
-
-	if (area->attributes & AS_AREA_ATTR_PARTIAL) {
-		/*
-		 * The address space area is not fully initialized.
-		 * Avoid possible race by returning error.
-		 */
-		mutex_unlock(&area->lock);
-		mutex_unlock(&AS->lock);
-		goto page_fault;
-	}
-
-	if ((!area->backend) || (!area->backend->page_fault)) {
-		/*
-		 * The address space area is not backed by any backend
-		 * or the backend cannot handle page faults.
-		 */
-		mutex_unlock(&area->lock);
-		mutex_unlock(&AS->lock);
-		goto page_fault;
-	}
-
-	page_table_lock(AS, false);
-
-	/*
-	 * To avoid race condition between two page faults on the same address,
-	 * we need to make sure the mapping has not been already inserted.
-	 */
-	pte_t pte;
-	bool found = page_mapping_find(AS, page, false, &pte);
-	if (found && PTE_PRESENT(&pte)) {
-		if (((access == PF_ACCESS_READ) && PTE_READABLE(&pte)) ||
-		    (access == PF_ACCESS_WRITE && PTE_WRITABLE(&pte)) ||
-		    (access == PF_ACCESS_EXEC && PTE_EXECUTABLE(&pte))) {
-			page_table_unlock(AS, false);
-			mutex_unlock(&area->lock);
-			mutex_unlock(&AS->lock);
-			return AS_PF_OK;
-		}
-	}
-
-	/*
-	 * Resort to the backend page fault handler.
-	 */
-	rc = area->backend->page_fault(area, page, access);
-	if (rc != AS_PF_OK) {
-		page_table_unlock(AS, false);
-		mutex_unlock(&area->lock);
-		mutex_unlock(&AS->lock);
-		goto page_fault;
-	}
-
-	page_table_unlock(AS, false);
-	mutex_unlock(&area->lock);
-	mutex_unlock(&AS->lock);
-	return AS_PF_OK;
-
-page_fault:
-	if (THREAD && THREAD->in_copy_from_uspace) {
-		THREAD->in_copy_from_uspace = false;
-		istate_set_retaddr(istate,
-		    (uintptr_t) &memcpy_from_uspace_failover_address);
-	} else if (THREAD && THREAD->in_copy_to_uspace) {
-		THREAD->in_copy_to_uspace = false;
-		istate_set_retaddr(istate,
-		    (uintptr_t) &memcpy_to_uspace_failover_address);
-	} else if (rc == AS_PF_SILENT) {
-		printf("Killing task %" PRIu64 " due to a "
-		    "failed late reservation request.\n", TASK->taskid);
-		task_kill_self(true);
-	} else {
-		fault_if_from_uspace(istate, "Page fault: %p.", (void *) address);
-		panic_memtrap(istate, access, address, NULL);
-	}
-
-	return AS_PF_DEFER;
-}
-
-/** Switch address spaces.
- *
- * Note that this function cannot sleep as it is essentially a part of
- * scheduling. Sleeping here would lead to deadlock on wakeup. Another
- * thing which is forbidden in this context is locking the address space.
- *
- * When this function is entered, no spinlocks may be held.
- *
- * @param old Old address space or NULL.
- * @param new New address space.
- *
- */
-void as_switch(as_t *old_as, as_t *new_as)
-{
-	DEADLOCK_PROBE_INIT(p_asidlock);
-	preemption_disable();
-
-retry:
-	(void) interrupts_disable();
-	if (!spinlock_trylock(&asidlock)) {
-		/*
-		 * Avoid deadlock with TLB shootdown.
-		 * We can enable interrupts here because
-		 * preemption is disabled. We should not be
-		 * holding any other lock.
-		 */
-		(void) interrupts_enable();
-		DEADLOCK_PROBE(p_asidlock, DEADLOCK_THRESHOLD);
-		goto retry;
-	}
-	preemption_enable();
-
-	/*
-	 * First, take care of the old address space.
-	 */
-	if (old_as) {
-		assert(old_as->cpu_refcount);
-
-		if ((--old_as->cpu_refcount == 0) && (old_as != AS_KERNEL)) {
-			/*
-			 * The old address space is no longer active on
-			 * any processor. It can be appended to the
-			 * list of inactive address spaces with assigned
-			 * ASID.
-			 */
-			assert(old_as->asid != ASID_INVALID);
-
-			list_append(&old_as->inactive_as_with_asid_link,
-			    &inactive_as_with_asid_list);
-		}
-
-		/*
-		 * Perform architecture-specific tasks when the address space
-		 * is being removed from the CPU.
-		 */
-		as_deinstall_arch(old_as);
-	}
-
-	/*
-	 * Second, prepare the new address space.
-	 */
-	if ((new_as->cpu_refcount++ == 0) && (new_as != AS_KERNEL)) {
-		if (new_as->asid != ASID_INVALID)
-			list_remove(&new_as->inactive_as_with_asid_link);
-		else
-			new_as->asid = asid_get();
-	}
-
-#ifdef AS_PAGE_TABLE
-	SET_PTL0_ADDRESS(new_as->genarch.page_table);
-#endif
-
-	/*
-	 * Perform architecture-specific steps.
-	 * (e.g. write ASID to hardware register etc.)
-	 */
-	as_install_arch(new_as);
-
-	spinlock_unlock(&asidlock);
-
-	if (AS)
-		as_release(AS);
-
-	AS = new_as;
-
-	as_hold(AS);
-}
-
-/** Compute flags for virtual address translation subsytem.
- *
- * @param area Address space area.
- *
- * @return Flags to be used in page_mapping_insert().
- *
- */
-_NO_TRACE unsigned int as_area_get_flags(as_area_t *area)
-{
-	assert(mutex_locked(&area->lock));
-
-	return area_flags_to_page_flags(area->flags);
-}
-
-/** Get key function for the @c as_t.as_areas ordered dictionary.
- *
- * @param odlink Link
- * @return Pointer to task ID cast as 'void *'
- */
-static void *as_areas_getkey(odlink_t *odlink)
-{
-	as_area_t *area = odict_get_instance(odlink, as_area_t, las_areas);
-	return (void *) &area->base;
-}
-
-/** Key comparison function for the @c as_t.as_areas ordered dictionary.
- *
- * @param a Pointer to area A base
- * @param b Pointer to area B base
- * @return -1, 0, 1 iff base of A is lower than, equal to, higher than B
- */
-static int as_areas_cmp(void *a, void *b)
-{
-	uintptr_t base_a = *(uintptr_t *)a;
-	uintptr_t base_b = *(uintptr_t *)b;
-
-	if (base_a < base_b)
-		return -1;
-	else if (base_a == base_b)
-		return 0;
-	else
-		return +1;
-}
-
-/** Create page table.
- *
- * Depending on architecture, create either address space private or global page
- * table.
- *
- * @param flags Flags saying whether the page table is for the kernel
- *              address space.
- *
- * @return First entry of the page table.
- *
- */
-_NO_TRACE pte_t *page_table_create(unsigned int flags)
-{
-	assert(as_operations);
-	assert(as_operations->page_table_create);
-
-	return as_operations->page_table_create(flags);
-}
-
-/** Destroy page table.
- *
- * Destroy page table in architecture specific way.
- *
- * @param page_table Physical address of PTL0.
- *
- */
-_NO_TRACE void page_table_destroy(pte_t *page_table)
-{
-	assert(as_operations);
-	assert(as_operations->page_table_destroy);
-
-	as_operations->page_table_destroy(page_table);
-}
-
-/** Lock page table.
- *
- * This function should be called before any page_mapping_insert(),
- * page_mapping_remove() and page_mapping_find().
- *
- * Locking order is such that address space areas must be locked
- * prior to this call. Address space can be locked prior to this
- * call in which case the lock argument is false.
- *
- * @param as   Address space.
- * @param lock If false, do not attempt to lock as->lock.
- *
- */
-_NO_TRACE void page_table_lock(as_t *as, bool lock)
-{
-	assert(as_operations);
-	assert(as_operations->page_table_lock);
-
-	as_operations->page_table_lock(as, lock);
-}
-
-/** Unlock page table.
- *
- * @param as     Address space.
- * @param unlock If false, do not attempt to unlock as->lock.
- *
- */
-_NO_TRACE void page_table_unlock(as_t *as, bool unlock)
-{
-	assert(as_operations);
-	assert(as_operations->page_table_unlock);
-
-	as_operations->page_table_unlock(as, unlock);
-}
-
-/** Test whether page tables are locked.
- *
- * @param as Address space where the page tables belong.
- *
- * @return True if the page tables belonging to the address soace
- *         are locked, otherwise false.
- */
-_NO_TRACE bool page_table_locked(as_t *as)
-{
-	assert(as_operations);
-	assert(as_operations->page_table_locked);
-
-	return as_operations->page_table_locked(as);
-}
-
-/** Return size of the address space area with given base.
- *
- * @param base Arbitrary address inside the address space area.
- *
- * @return Size of the address space area in bytes or zero if it
- *         does not exist.
- *
- */
-size_t as_area_get_size(uintptr_t base)
-{
-	size_t size;
-
-	page_table_lock(AS, true);
-	as_area_t *src_area = find_area_and_lock(AS, base);
-
-	if (src_area) {
-		size = P2SZ(src_area->pages);
-		mutex_unlock(&src_area->lock);
-	} else
-		size = 0;
-
-	page_table_unlock(AS, true);
-	return size;
-}
-
-/** Initialize used space map.
- *
- * @param used_space Used space map
- */
-static void used_space_initialize(used_space_t *used_space)
-{
-	odict_initialize(&used_space->ivals, used_space_getkey, used_space_cmp);
-	used_space->pages = 0;
-}
-
-/** Finalize used space map.
- *
- * @param used_space Used space map
- */
-static void used_space_finalize(used_space_t *used_space)
-{
-	assert(odict_empty(&used_space->ivals));
-	odict_finalize(&used_space->ivals);
-}
-
-/** Get first interval of used space.
- *
- * @param used_space Used space map
- * @return First interval or @c NULL if there are none
- */
-used_space_ival_t *used_space_first(used_space_t *used_space)
-{
-	odlink_t *odlink = odict_first(&used_space->ivals);
-
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, used_space_ival_t, lused_space);
-}
-
-/** Get next interval of used space.
- *
- * @param cur Current interval
- * @return Next interval or @c NULL if there are none
- */
-used_space_ival_t *used_space_next(used_space_ival_t *cur)
-{
-	odlink_t *odlink = odict_next(&cur->lused_space,
-	    &cur->used_space->ivals);
-
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, used_space_ival_t, lused_space);
-}
-
-/** Get last interval of used space.
- *
- * @param used_space Used space map
- * @return First interval or @c NULL if there are none
- */
-static used_space_ival_t *used_space_last(used_space_t *used_space)
-{
-	odlink_t *odlink = odict_last(&used_space->ivals);
-
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, used_space_ival_t, lused_space);
-}
-
-/** Find the first interval that contains addresses greater than or equal to
- * @a ptr.
- *
- * @param used_space Used space map
- * @param ptr Virtual address
- *
- * @return Used space interval or @c NULL if none matches
- */
-used_space_ival_t *used_space_find_gteq(used_space_t *used_space, uintptr_t ptr)
-{
-	odlink_t *odlink;
-	used_space_ival_t *ival;
-
-	/* Find last interval to start at address less than @a ptr */
-	odlink = odict_find_lt(&used_space->ivals, &ptr, NULL);
-	if (odlink != NULL) {
-		ival = odict_get_instance(odlink, used_space_ival_t,
-		    lused_space);
-
-		/* If the interval extends above @a ptr, return it */
-		if (ival->page + P2SZ(ival->count) > ptr)
-			return ival;
-
-		/*
-		 * Otherwise, if a next interval exists, it must match
-		 * the criteria.
-		 */
-		odlink = odict_next(&ival->lused_space, &used_space->ivals);
-	} else {
-		/*
-		 * No interval with lower base address, so if there is any
-		 * interval at all, it must match the criteria
-		 */
-		odlink = odict_first(&used_space->ivals);
-	}
-
-	if (odlink != NULL) {
-		ival = odict_get_instance(odlink, used_space_ival_t,
-		    lused_space);
-		return ival;
-	}
-
-	return NULL;
-}
-
-/** Get key function for used space ordered dictionary.
- *
- * The key is the virtual address of the first page
- *
- * @param odlink Ordered dictionary link (used_space_ival_t.lused_space)
- * @return Pointer to virtual address of first page cast as @c void *.
- */
-static void *used_space_getkey(odlink_t *odlink)
-{
-	used_space_ival_t *ival = odict_get_instance(odlink, used_space_ival_t,
-	    lused_space);
-	return (void *) &ival->page;
-}
-
-/** Compare function for used space ordered dictionary.
- *
- * @param a Pointer to virtual address of first page cast as @c void *
- * @param b Pointer to virtual address of first page cast as @c void *
- * @return Less than zero, zero, greater than zero if virtual address @a a
- *         is less than, equal to, greater than virtual address b, respectively.
- */
-static int used_space_cmp(void *a, void *b)
-{
-	uintptr_t va = *(uintptr_t *) a;
-	uintptr_t vb = *(uintptr_t *) b;
-
-	if (va < vb)
-		return -1;
-	else if (va == vb)
-		return 0;
-	else
-		return +1;
-}
-
-/** Remove used space interval.
- *
- * @param ival Used space interval
- */
-static void used_space_remove_ival(used_space_ival_t *ival)
-{
-	ival->used_space->pages -= ival->count;
-	odict_remove(&ival->lused_space);
-	slab_free(used_space_ival_cache, ival);
-}
-
-/** Shorten used space interval.
- *
- * @param ival Used space interval
- * @param count New number of pages in the interval
- */
-static void used_space_shorten_ival(used_space_ival_t *ival, size_t count)
-{
-	assert(count > 0);
-	assert(count < ival->count);
-
-	ival->used_space->pages -= ival->count - count;
-	ival->count = count;
-}
-
-/** Mark portion of address space area as used.
- *
- * The address space area must be already locked.
- *
- * @param used_space Used space map
- * @param page First page to be marked.
- * @param count Number of page to be marked.
- *
- * @return False on failure or true on success.
- *
- */
-bool used_space_insert(used_space_t *used_space, uintptr_t page, size_t count)
-{
-	used_space_ival_t *a;
-	used_space_ival_t *b;
-	bool adj_a;
-	bool adj_b;
-	odlink_t *odlink;
-	used_space_ival_t *ival;
-
-	assert(IS_ALIGNED(page, PAGE_SIZE));
-	assert(count);
-
-	/* Interval to the left */
-	odlink = odict_find_lt(&used_space->ivals, &page, NULL);
-	a = (odlink != NULL) ?
-	    odict_get_instance(odlink, used_space_ival_t, lused_space) :
-	    NULL;
-
-	/* Interval to the right */
-	b = (a != NULL) ? used_space_next(a) :
-	    used_space_first(used_space);
-
-	/* Check for conflict with left interval */
-	if (a != NULL && overlaps(a->page, P2SZ(a->count), page, P2SZ(count)))
-		return false;
-
-	/* Check for conflict with right interval */
-	if (b != NULL && overlaps(page, P2SZ(count), b->page, P2SZ(b->count)))
-		return false;
-
-	/* Check if A is adjacent to the new interval */
-	adj_a = (a != NULL) && (a->page + P2SZ(a->count) == page);
-	/* Check if the new interval is adjacent to B */
-	adj_b = (b != NULL) && page + P2SZ(count) == b->page;
-
-	if (adj_a && adj_b) {
-		/* Fuse into a single interval */
-		a->count += count + b->count;
-		used_space_remove_ival(b);
-	} else if (adj_a) {
-		/* Append to A */
-		a->count += count;
-	} else if (adj_b) {
-		/* Prepend to B */
-		b->page = page;
-		b->count += count;
-	} else {
-		/* Create new interval */
-		ival = slab_alloc(used_space_ival_cache, 0);
-		ival->used_space = used_space;
-		odlink_initialize(&ival->lused_space);
-		ival->page = page;
-		ival->count = count;
-
-		odict_insert(&ival->lused_space, &used_space->ivals,
-		    NULL);
-	}
-
-	used_space->pages += count;
-	return true;
-}
-
-/*
- * Address space related syscalls.
- */
-
-sysarg_t sys_as_area_create(uintptr_t base, size_t size, unsigned int flags,
-    uintptr_t bound, uspace_ptr_as_area_pager_info_t pager_info)
-{
-	uintptr_t virt = base;
-	mem_backend_t *backend;
-	mem_backend_data_t backend_data;
-
-	if (!pager_info)
-		backend = &anon_backend;
-	else {
-		backend = &user_backend;
-		if (copy_from_uspace(&backend_data.pager_info, pager_info,
-		    sizeof(as_area_pager_info_t)) != EOK) {
-			return (sysarg_t) AS_MAP_FAILED;
-		}
-	}
-	as_area_t *area = as_area_create(AS, flags, size,
-	    AS_AREA_ATTR_NONE, backend, &backend_data, &virt, bound);
-	if (area == NULL)
-		return (sysarg_t) AS_MAP_FAILED;
-
-	return (sysarg_t) virt;
-}
-
-sys_errno_t sys_as_area_resize(uintptr_t address, size_t size, unsigned int flags)
-{
-	return (sys_errno_t) as_area_resize(AS, address, size, 0);
-}
-
-sys_errno_t sys_as_area_change_flags(uintptr_t address, unsigned int flags)
-{
-	return (sys_errno_t) as_area_change_flags(AS, flags, address);
-}
-
-sys_errno_t sys_as_area_get_info(uintptr_t address, uspace_ptr_as_area_info_t dest)
-{
-	as_area_t *area;
-	as_area_info_t info;
-
-	/* Prevent leaking stack bytes via structure padding. */
-	memset(&info, 0, sizeof(info));
-
-	mutex_lock(&AS->lock);
-	area = find_area_and_lock(AS, address);
-	if (area == NULL) {
-		mutex_unlock(&AS->lock);
-		return ENOENT;
-	}
-
-	info.start_addr = area->base;
-	info.size = P2SZ(area->pages);
-	info.flags = area->flags;
-
-	mutex_unlock(&area->lock);
-	mutex_unlock(&AS->lock);
-
-	copy_to_uspace(dest, &info, sizeof(info));
-	return EOK;
-}
-
-sys_errno_t sys_as_area_destroy(uintptr_t address)
-{
-	return (sys_errno_t) as_area_destroy(AS, address);
-}
-
-/** Get list of address space areas.
- *
- * @param as    Address space.
- * @param obuf  Place to save pointer to returned buffer.
- * @param osize Place to save size of returned buffer.
- *
- */
-as_area_info_t *as_get_area_info(as_t *as, size_t *osize)
-{
-	mutex_lock(&as->lock);
-
-	/* Count number of areas. */
-	size_t area_cnt = odict_count(&as->as_areas);
-
-	size_t isize = area_cnt * sizeof(as_area_info_t);
-	as_area_info_t *info = malloc(isize);
-	if (!info) {
-		mutex_unlock(&as->lock);
-		return NULL;
-	}
-
-	/* Record area data. */
-
-	size_t area_idx = 0;
-
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		assert(area_idx < area_cnt);
-		mutex_lock(&area->lock);
-
-		info[area_idx].start_addr = area->base;
-		info[area_idx].size = P2SZ(area->pages);
-		info[area_idx].flags = area->flags;
-		++area_idx;
-
-		mutex_unlock(&area->lock);
-		area = as_area_next(area);
-	}
-
-	mutex_unlock(&as->lock);
-
-	*osize = isize;
-	return info;
-}
-
-/** Print out information about address space.
- *
- * @param as Address space.
- *
- */
-void as_print(as_t *as)
-{
-	mutex_lock(&as->lock);
-
-	/* Print out info about address space areas */
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		mutex_lock(&area->lock);
-		printf("as_area: %p, base=%p, pages=%zu"
-		    " (%p - %p)\n", area, (void *) area->base,
-		    area->pages, (void *) area->base,
-		    (void *) (area->base + P2SZ(area->pages)));
-		mutex_unlock(&area->lock);
-
-		area = as_area_next(area);
-	}
-
-	mutex_unlock(&as->lock);
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,298 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief	Backend for anonymous memory address space areas.
- *
- */
-
-#include <assert.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <mm/reserve.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/page_ht.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <mm/km.h>
-#include <synch/mutex.h>
-#include <adt/list.h>
-#include <errno.h>
-#include <typedefs.h>
-#include <align.h>
-#include <memw.h>
-#include <arch.h>
-
-static bool anon_create(as_area_t *);
-static bool anon_resize(as_area_t *, size_t);
-static void anon_share(as_area_t *);
-static void anon_destroy(as_area_t *);
-
-static bool anon_is_resizable(as_area_t *);
-static bool anon_is_shareable(as_area_t *);
-
-static int anon_page_fault(as_area_t *, uintptr_t, pf_access_t);
-static void anon_frame_free(as_area_t *, uintptr_t, uintptr_t);
-
-mem_backend_t anon_backend = {
-	.create = anon_create,
-	.resize = anon_resize,
-	.share = anon_share,
-	.destroy = anon_destroy,
-
-	.is_resizable = anon_is_resizable,
-	.is_shareable = anon_is_shareable,
-
-	.page_fault = anon_page_fault,
-	.frame_free = anon_frame_free,
-
-	.create_shared_data = NULL,
-	.destroy_shared_data = NULL
-};
-
-bool anon_create(as_area_t *area)
-{
-	if (area->flags & AS_AREA_LATE_RESERVE)
-		return true;
-
-	return reserve_try_alloc(area->pages);
-}
-
-bool anon_resize(as_area_t *area, size_t new_pages)
-{
-	if (area->flags & AS_AREA_LATE_RESERVE)
-		return true;
-
-	if (new_pages > area->pages)
-		return reserve_try_alloc(new_pages - area->pages);
-	else if (new_pages < area->pages)
-		reserve_free(area->pages - new_pages);
-
-	return true;
-}
-
-/** Share the anonymous address space area.
- *
- * Sharing of anonymous area is done by duplicating its entire mapping
- * to the pagemap. Page faults will primarily search for frames there.
- *
- * The address space and address space area must be already locked.
- *
- * @param area Address space area to be shared.
- */
-void anon_share(as_area_t *area)
-{
-	assert(mutex_locked(&area->as->lock));
-	assert(mutex_locked(&area->lock));
-	assert(!(area->flags & AS_AREA_LATE_RESERVE));
-
-	/*
-	 * Copy used portions of the area to sh_info's page map.
-	 */
-	mutex_lock(&area->sh_info->lock);
-	used_space_ival_t *ival = used_space_first(&area->used_space);
-	while (ival != NULL) {
-		uintptr_t base = ival->page;
-		size_t count = ival->count;
-		unsigned int j;
-
-		for (j = 0; j < count; j++) {
-			pte_t pte;
-			bool found;
-
-			page_table_lock(area->as, false);
-			found = page_mapping_find(area->as, base + P2SZ(j),
-			    false, &pte);
-
-			(void)found;
-			assert(found);
-			assert(PTE_VALID(&pte));
-			assert(PTE_PRESENT(&pte));
-
-			as_pagemap_insert(&area->sh_info->pagemap,
-			    (base + P2SZ(j)) - area->base, PTE_GET_FRAME(&pte));
-			page_table_unlock(area->as, false);
-
-			pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(&pte));
-			frame_reference_add(pfn);
-		}
-
-		ival = used_space_next(ival);
-	}
-	mutex_unlock(&area->sh_info->lock);
-}
-
-void anon_destroy(as_area_t *area)
-{
-	if (area->flags & AS_AREA_LATE_RESERVE)
-		return;
-
-	reserve_free(area->pages);
-}
-
-bool anon_is_resizable(as_area_t *area)
-{
-	return true;
-}
-
-bool anon_is_shareable(as_area_t *area)
-{
-	return !(area->flags & AS_AREA_LATE_RESERVE);
-}
-
-/** Service a page fault in the anonymous memory address space area.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area Pointer to the address space area.
- * @param upage Faulting virtual page.
- * @param access Access mode that caused the fault (i.e. read/write/exec).
- *
- * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e.
- *     serviced).
- */
-int anon_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
-{
-	uintptr_t kpage;
-	uintptr_t frame;
-
-	assert(page_table_locked(AS));
-	assert(mutex_locked(&area->lock));
-	assert(IS_ALIGNED(upage, PAGE_SIZE));
-
-	if (!as_area_check_access(area, access))
-		return AS_PF_FAULT;
-
-	mutex_lock(&area->sh_info->lock);
-	if (area->sh_info->shared) {
-		/*
-		 * The area is shared, chances are that the mapping can be found
-		 * in the pagemap of the address space area share info
-		 * structure.
-		 * In the case that the pagemap does not contain the respective
-		 * mapping, a new frame is allocated and the mapping is created.
-		 */
-		errno_t rc = as_pagemap_find(&area->sh_info->pagemap,
-		    upage - area->base, &frame);
-		if (rc != EOK) {
-			/* Need to allocate the frame */
-			kpage = km_temporary_page_get(&frame,
-			    FRAME_NO_RESERVE);
-			memsetb((void *) kpage, PAGE_SIZE, 0);
-			km_temporary_page_put(kpage);
-
-			/*
-			 * Insert the address of the newly allocated
-			 * frame to the pagemap.
-			 */
-			as_pagemap_insert(&area->sh_info->pagemap,
-			    upage - area->base, frame);
-		}
-		frame_reference_add(ADDR2PFN(frame));
-	} else {
-
-		/*
-		 * In general, there can be several reasons that
-		 * can have caused this fault.
-		 *
-		 * - non-existent mapping: the area is an anonymous
-		 *   area (e.g. heap or stack) and so far has not been
-		 *   allocated a frame for the faulting page
-		 *
-		 * - non-present mapping: another possibility,
-		 *   currently not implemented, would be frame
-		 *   reuse; when this becomes a possibility,
-		 *   do not forget to distinguish between
-		 *   the different causes
-		 */
-
-		if (area->flags & AS_AREA_LATE_RESERVE) {
-			/*
-			 * Reserve the memory for this page now.
-			 */
-			if (!reserve_try_alloc(1)) {
-				mutex_unlock(&area->sh_info->lock);
-				return AS_PF_SILENT;
-			}
-		}
-
-		kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE);
-		memsetb((void *) kpage, PAGE_SIZE, 0);
-		km_temporary_page_put(kpage);
-	}
-	mutex_unlock(&area->sh_info->lock);
-
-	/*
-	 * Map 'upage' to 'frame'.
-	 * Note that TLB shootdown is not attempted as only new information is
-	 * being inserted into page tables.
-	 */
-	page_mapping_insert(AS, upage, frame, as_area_get_flags(area));
-	if (!used_space_insert(&area->used_space, upage, 1))
-		panic("Cannot insert used space.");
-
-	return AS_PF_OK;
-}
-
-/** Free a frame that is backed by the anonymous memory backend.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area Ignored.
- * @param page Virtual address of the page corresponding to the frame.
- * @param frame Frame to be released.
- */
-void anon_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
-{
-	assert(page_table_locked(area->as));
-	assert(mutex_locked(&area->lock));
-
-	if (area->flags & AS_AREA_LATE_RESERVE) {
-		/*
-		 * In case of the late reserve areas, physical memory will not
-		 * be unreserved when the area is destroyed so we need to use
-		 * the normal unreserving frame_free().
-		 */
-		frame_free(frame, 1);
-	} else {
-		/*
-		 * The reserve will be given back when the area is destroyed or
-		 * resized, so use the frame_free_noreserve() which does not
-		 * manipulate the reserve or it would be given back twice.
-		 */
-		frame_free_noreserve(frame, 1);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,451 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief	Backend for address space areas backed by an ELF image.
- */
-
-#include <lib/elf.h>
-#include <assert.h>
-#include <typedefs.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <mm/page.h>
-#include <mm/reserve.h>
-#include <mm/km.h>
-#include <genarch/mm/page_pt.h>
-#include <genarch/mm/page_ht.h>
-#include <align.h>
-#include <memw.h>
-#include <macros.h>
-#include <arch.h>
-#include <barrier.h>
-
-static bool elf_create(as_area_t *);
-static bool elf_resize(as_area_t *, size_t);
-static void elf_share(as_area_t *);
-static void elf_destroy(as_area_t *);
-
-static bool elf_is_resizable(as_area_t *);
-static bool elf_is_shareable(as_area_t *);
-
-static int elf_page_fault(as_area_t *, uintptr_t, pf_access_t);
-static void elf_frame_free(as_area_t *, uintptr_t, uintptr_t);
-
-mem_backend_t elf_backend = {
-	.create = elf_create,
-	.resize = elf_resize,
-	.share = elf_share,
-	.destroy = elf_destroy,
-
-	.is_resizable = elf_is_resizable,
-	.is_shareable = elf_is_shareable,
-
-	.page_fault = elf_page_fault,
-	.frame_free = elf_frame_free,
-
-	.create_shared_data = NULL,
-	.destroy_shared_data = NULL
-};
-
-static size_t elf_nonanon_pages_get(as_area_t *area)
-{
-	elf_segment_header_t *entry = area->backend_data.segment;
-	uintptr_t first = ALIGN_UP(entry->p_vaddr, PAGE_SIZE);
-	uintptr_t last = ALIGN_DOWN(entry->p_vaddr + entry->p_filesz,
-	    PAGE_SIZE);
-
-	if (entry->p_flags & PF_W)
-		return 0;
-
-	if (last < first)
-		return 0;
-
-	return last - first;
-}
-
-/** Get page number in the task where the ELF page originates from.
- *
- * The ELF page can be shared to a different address than it originated from,
- * but we need the originating address since that corresponds to the ELF's
- * virtual addesses.
- *
- * @param area Area in which the page resides
- * @param page Virtual address of the page in @a area
- * @return Virtual address of the page in the origin address space
- */
-static uintptr_t elf_orig_page(as_area_t *area, uintptr_t page)
-{
-	return page - area->base + area->backend_data.elf_base;
-}
-
-bool elf_create(as_area_t *area)
-{
-	size_t nonanon_pages = elf_nonanon_pages_get(area);
-
-	if (area->pages <= nonanon_pages)
-		return true;
-
-	return reserve_try_alloc(area->pages - nonanon_pages);
-}
-
-bool elf_resize(as_area_t *area, size_t new_pages)
-{
-	size_t nonanon_pages = elf_nonanon_pages_get(area);
-
-	if (new_pages > area->pages) {
-		/* The area is growing. */
-		if (area->pages >= nonanon_pages)
-			return reserve_try_alloc(new_pages - area->pages);
-		else if (new_pages > nonanon_pages)
-			return reserve_try_alloc(new_pages - nonanon_pages);
-	} else if (new_pages < area->pages) {
-		/* The area is shrinking. */
-		if (new_pages >= nonanon_pages)
-			reserve_free(area->pages - new_pages);
-		else if (area->pages > nonanon_pages)
-			reserve_free(nonanon_pages - new_pages);
-	}
-
-	return true;
-}
-
-/** Share ELF image backed address space area.
- *
- * If the area is writable, then all mapped pages are duplicated in the pagemap.
- * Otherwise only portions of the area that are not backed by the ELF image
- * are put into the pagemap.
- *
- * @param area		Address space area.
- */
-void elf_share(as_area_t *area)
-{
-	elf_segment_header_t *entry = area->backend_data.segment;
-	used_space_ival_t *start;
-	used_space_ival_t *cur;
-	uintptr_t start_anon = entry->p_vaddr + entry->p_filesz;
-
-	assert(mutex_locked(&area->as->lock));
-	assert(mutex_locked(&area->lock));
-
-	/*
-	 * Find the node in which to start linear search.
-	 */
-	if (area->flags & AS_AREA_WRITE) {
-		start = used_space_first(&area->used_space);
-	} else {
-		/* Find first interval containing addresses >= start_anon */
-		start = used_space_find_gteq(&area->used_space, start_anon);
-	}
-
-	/*
-	 * Copy used anonymous portions of the area to sh_info's page map.
-	 */
-	mutex_lock(&area->sh_info->lock);
-	cur = start;
-	while (cur != NULL) {
-		uintptr_t base = cur->page;
-		size_t count = cur->count;
-		unsigned int i;
-
-		/*
-		 * Skip read-only areas of used space that are backed
-		 * by the ELF image.
-		 */
-		if (!(area->flags & AS_AREA_WRITE))
-			if (base >= entry->p_vaddr &&
-			    base + P2SZ(count) <= start_anon)
-				continue;
-
-		for (i = 0; i < count; i++) {
-			pte_t pte;
-			bool found;
-
-			/*
-			 * Skip read-only pages that are backed by the
-			 * ELF image.
-			 */
-			if (!(area->flags & AS_AREA_WRITE))
-				if (base >= entry->p_vaddr &&
-				    base + P2SZ(i + 1) <= start_anon)
-					continue;
-
-			page_table_lock(area->as, false);
-			found = page_mapping_find(area->as,
-			    base + P2SZ(i), false, &pte);
-
-			(void) found;
-			assert(found);
-			assert(PTE_VALID(&pte));
-			assert(PTE_PRESENT(&pte));
-
-			as_pagemap_insert(&area->sh_info->pagemap,
-			    (base + P2SZ(i)) - area->base,
-			    PTE_GET_FRAME(&pte));
-			page_table_unlock(area->as, false);
-
-			pfn_t pfn = ADDR2PFN(PTE_GET_FRAME(&pte));
-			frame_reference_add(pfn);
-		}
-
-		cur = used_space_next(cur);
-	}
-
-	mutex_unlock(&area->sh_info->lock);
-}
-
-void elf_destroy(as_area_t *area)
-{
-	size_t nonanon_pages = elf_nonanon_pages_get(area);
-
-	if (area->pages > nonanon_pages)
-		reserve_free(area->pages - nonanon_pages);
-}
-
-bool elf_is_resizable(as_area_t *area)
-{
-	return true;
-}
-
-bool elf_is_shareable(as_area_t *area)
-{
-	return true;
-}
-
-/** Service a page fault in the ELF backend address space area.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area		Pointer to the address space area.
- * @param upage		Faulting virtual page.
- * @param access	Access mode that caused the fault (i.e.
- * 			read/write/exec).
- *
- * @return		AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK
- * 			on success (i.e. serviced).
- */
-int elf_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
-{
-	elf_header_t *elf = area->backend_data.elf;
-	elf_segment_header_t *entry = area->backend_data.segment;
-	uintptr_t base;
-	uintptr_t frame;
-	uintptr_t kpage;
-	uintptr_t start_anon;
-	uintptr_t elfpage;
-	size_t i;
-	bool dirty = false;
-
-	assert(page_table_locked(AS));
-	assert(mutex_locked(&area->lock));
-	assert(IS_ALIGNED(upage, PAGE_SIZE));
-
-	elfpage = elf_orig_page(area, upage);
-
-	if (!as_area_check_access(area, access))
-		return AS_PF_FAULT;
-
-	if (elfpage < ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE))
-		return AS_PF_FAULT;
-
-	if (elfpage >= entry->p_vaddr + entry->p_memsz)
-		return AS_PF_FAULT;
-
-	i = (elfpage - ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) >>
-	    PAGE_WIDTH;
-	base = (uintptr_t)
-	    (((void *) elf) + ALIGN_DOWN(entry->p_offset, PAGE_SIZE));
-
-	/* Virtual address of the end of initialized part of segment */
-	start_anon = entry->p_vaddr + entry->p_filesz;
-
-	mutex_lock(&area->sh_info->lock);
-	if (area->sh_info->shared) {
-		/*
-		 * The address space area is shared.
-		 */
-
-		errno_t rc = as_pagemap_find(&area->sh_info->pagemap,
-		    upage - area->base, &frame);
-		if (rc == EOK) {
-			frame_reference_add(ADDR2PFN(frame));
-			page_mapping_insert(AS, upage, frame,
-			    as_area_get_flags(area));
-			if (!used_space_insert(&area->used_space, upage, 1))
-				panic("Cannot insert used space.");
-			mutex_unlock(&area->sh_info->lock);
-			return AS_PF_OK;
-		}
-	}
-
-	/*
-	 * The area is either not shared or the pagemap does not contain the
-	 * mapping.
-	 */
-	if (elfpage >= entry->p_vaddr && elfpage + PAGE_SIZE <= start_anon) {
-		/*
-		 * Initialized portion of the segment. The memory is backed
-		 * directly by the content of the ELF image. Pages are
-		 * only copied if the segment is writable so that there
-		 * can be more instances of the same memory ELF image
-		 * used at a time. Note that this could be later done
-		 * as COW.
-		 */
-		if (entry->p_flags & PF_W) {
-			kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE);
-			memcpy((void *) kpage, (void *) (base + i * PAGE_SIZE),
-			    PAGE_SIZE);
-			if (entry->p_flags & PF_X) {
-				smc_coherence((void *) kpage, PAGE_SIZE);
-			}
-			km_temporary_page_put(kpage);
-			dirty = true;
-		} else {
-			pte_t pte;
-			bool found;
-
-			found = page_mapping_find(AS_KERNEL,
-			    base + i * FRAME_SIZE, true, &pte);
-
-			(void) found;
-			assert(found);
-			assert(PTE_PRESENT(&pte));
-
-			frame = PTE_GET_FRAME(&pte);
-		}
-	} else if (elfpage >= start_anon) {
-		/*
-		 * This is the uninitialized portion of the segment.
-		 * It is not physically present in the ELF image.
-		 * To resolve the situation, a frame must be allocated
-		 * and cleared.
-		 */
-		kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE);
-		memsetb((void *) kpage, PAGE_SIZE, 0);
-		km_temporary_page_put(kpage);
-		dirty = true;
-	} else {
-		size_t pad_lo, pad_hi;
-		/*
-		 * The mixed case.
-		 *
-		 * The middle part is backed by the ELF image and
-		 * the lower and upper parts are anonymous memory.
-		 * (The segment can be and often is shorter than 1 page).
-		 */
-		if (upage < entry->p_vaddr)
-			pad_lo = entry->p_vaddr - upage;
-		else
-			pad_lo = 0;
-
-		if (start_anon < upage + PAGE_SIZE)
-			pad_hi = upage + PAGE_SIZE - start_anon;
-		else
-			pad_hi = 0;
-
-		kpage = km_temporary_page_get(&frame, FRAME_NO_RESERVE);
-		memcpy((void *) (kpage + pad_lo),
-		    (void *) (base + i * PAGE_SIZE + pad_lo),
-		    PAGE_SIZE - pad_lo - pad_hi);
-		if (entry->p_flags & PF_X) {
-			smc_coherence((void *) (kpage + pad_lo),
-			    PAGE_SIZE - pad_lo - pad_hi);
-		}
-		memsetb((void *) kpage, pad_lo, 0);
-		memsetb((void *) (kpage + PAGE_SIZE - pad_hi), pad_hi, 0);
-		km_temporary_page_put(kpage);
-		dirty = true;
-	}
-
-	if (dirty && area->sh_info->shared) {
-		frame_reference_add(ADDR2PFN(frame));
-		as_pagemap_insert(&area->sh_info->pagemap, upage - area->base,
-		    frame);
-	}
-
-	mutex_unlock(&area->sh_info->lock);
-
-	page_mapping_insert(AS, upage, frame, as_area_get_flags(area));
-	if (!used_space_insert(&area->used_space, upage, 1))
-		panic("Cannot insert used space.");
-
-	return AS_PF_OK;
-}
-
-/** Free a frame that is backed by the ELF backend.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area		Pointer to the address space area.
- * @param page		Page that is mapped to frame. Must be aligned to
- * 			PAGE_SIZE.
- * @param frame		Frame to be released.
- *
- */
-void elf_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
-{
-	elf_segment_header_t *entry = area->backend_data.segment;
-	uintptr_t start_anon;
-	uintptr_t elfpage;
-
-	assert(page_table_locked(area->as));
-	assert(mutex_locked(&area->lock));
-
-	elfpage = elf_orig_page(area, page);
-
-	assert(elfpage >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE));
-	assert(elfpage < entry->p_vaddr + entry->p_memsz);
-
-	start_anon = entry->p_vaddr + entry->p_filesz;
-
-	if (elfpage >= entry->p_vaddr && elfpage + PAGE_SIZE <= start_anon) {
-		if (entry->p_flags & PF_W) {
-			/*
-			 * Free the frame with the copy of writable segment
-			 * data.
-			 */
-			frame_free_noreserve(frame, 1);
-		}
-	} else {
-		/*
-		 * The frame is either anonymous memory or the mixed case (i.e.
-		 * lower part is backed by the ELF image and the upper is
-		 * anonymous). In any case, a frame needs to be freed.
-		 */
-		frame_free_noreserve(frame, 1);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/backend_phys.c
===================================================================
--- kernel/generic/src/mm/backend_phys.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief	Backend for address space areas backed by continuous physical
- * 		memory.
- */
-
-#include <assert.h>
-#include <ddi/ddi.h>
-#include <typedefs.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <arch.h>
-#include <align.h>
-
-static bool phys_create(as_area_t *);
-static void phys_share(as_area_t *);
-static void phys_destroy(as_area_t *);
-
-static bool phys_is_resizable(as_area_t *);
-static bool phys_is_shareable(as_area_t *);
-
-static int phys_page_fault(as_area_t *, uintptr_t, pf_access_t);
-
-static bool phys_create_shared_data(as_area_t *);
-static void phys_destroy_shared_data(void *);
-
-typedef struct {
-	uintptr_t base;
-	size_t frames;
-} phys_shared_data_t;
-
-mem_backend_t phys_backend = {
-	.create = phys_create,
-	.resize = NULL,
-	.share = phys_share,
-	.destroy = phys_destroy,
-
-	.is_resizable = phys_is_resizable,
-	.is_shareable = phys_is_shareable,
-
-	.page_fault = phys_page_fault,
-	.frame_free = NULL,
-
-	.create_shared_data = phys_create_shared_data,
-	.destroy_shared_data = phys_destroy_shared_data
-};
-
-bool phys_create(as_area_t *area)
-{
-	return true;
-}
-
-/** Share address space area backed by physical memory.
- *
- * Do actually nothing as sharing of address space areas
- * that are backed up by physical memory is very easy.
- * Note that the function must be defined so that
- * as_area_share() will succeed.
- */
-void phys_share(as_area_t *area)
-{
-	assert(mutex_locked(&area->as->lock));
-	assert(mutex_locked(&area->lock));
-}
-
-void phys_destroy(as_area_t *area)
-{
-	/*
-	 * The anonymous frames, if any, are released in
-	 * phys_destroy_shared_data().
-	 */
-
-	/* Notify parea has been unmapped */
-	if (area->backend_data.parea != NULL)
-		ddi_parea_unmap_notify(area->backend_data.parea);
-}
-
-bool phys_is_resizable(as_area_t *area)
-{
-	return false;
-}
-
-bool phys_is_shareable(as_area_t *area)
-{
-	return true;
-}
-
-/** Service a page fault in the address space area backed by physical memory.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area Pointer to the address space area.
- * @param upage Faulting virtual page.
- * @param access Access mode that caused the fault (i.e. read/write/exec).
- *
- * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e.
- * serviced).
- */
-int phys_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
-{
-	uintptr_t base = area->backend_data.base;
-
-	assert(page_table_locked(AS));
-	assert(mutex_locked(&area->lock));
-	assert(IS_ALIGNED(upage, PAGE_SIZE));
-
-	if (!as_area_check_access(area, access))
-		return AS_PF_FAULT;
-
-	assert(upage - area->base < area->backend_data.frames * FRAME_SIZE);
-	page_mapping_insert(AS, upage, base + (upage - area->base),
-	    as_area_get_flags(area));
-
-	if (!used_space_insert(&area->used_space, upage, 1))
-		panic("Cannot insert used space.");
-
-	return AS_PF_OK;
-}
-
-bool phys_create_shared_data(as_area_t *area)
-{
-	/*
-	 * For anonymous phys areas, create the shared data.
-	 */
-	if (area->backend_data.anonymous) {
-		phys_shared_data_t *data;
-
-		data = (phys_shared_data_t *) malloc(sizeof(*data));
-		if (!data)
-			return false;
-
-		data->base = area->backend_data.base;
-		data->frames = area->backend_data.frames;
-		area->sh_info->backend_shared_data = data;
-	}
-
-	return true;
-}
-
-void phys_destroy_shared_data(void *opaque_data)
-{
-	phys_shared_data_t *data = (phys_shared_data_t *) opaque_data;
-
-	if (data) {
-		frame_free(data->base, data->frames);
-		free(data);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/backend_user.c
===================================================================
--- kernel/generic/src/mm/backend_user.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief	Backend for address space areas backed by the user pager.
- *
- */
-
-#include <mm/as.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <abi/mm/as.h>
-#include <abi/ipc/methods.h>
-#include <ipc/sysipc.h>
-#include <synch/mutex.h>
-#include <typedefs.h>
-#include <align.h>
-#include <assert.h>
-#include <errno.h>
-#include <log.h>
-#include <str.h>
-#include <str_error.h>
-
-static bool user_create(as_area_t *);
-static void user_destroy(as_area_t *);
-
-static bool user_is_resizable(as_area_t *);
-static bool user_is_shareable(as_area_t *);
-
-static int user_page_fault(as_area_t *, uintptr_t, pf_access_t);
-static void user_frame_free(as_area_t *, uintptr_t, uintptr_t);
-
-mem_backend_t user_backend = {
-	.create = user_create,
-	.resize = NULL,
-	.share = NULL,
-	.destroy = user_destroy,
-
-	.is_resizable = user_is_resizable,
-	.is_shareable = user_is_shareable,
-
-	.page_fault = user_page_fault,
-	.frame_free = user_frame_free,
-
-	.create_shared_data = NULL,
-	.destroy_shared_data = NULL
-};
-
-bool user_create(as_area_t *area)
-{
-	return true;
-}
-
-void user_destroy(as_area_t *area)
-{
-	return;
-}
-
-bool user_is_resizable(as_area_t *area)
-{
-	return false;
-}
-
-bool user_is_shareable(as_area_t *area)
-{
-	return false;
-}
-
-/** Service a page fault in the user-paged address space area.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area Pointer to the address space area.
- * @param upage Faulting virtual page.
- * @param access Access mode that caused the fault (i.e. read/write/exec).
- *
- * @return AS_PF_FAULT on failure (i.e. page fault) or AS_PF_OK on success (i.e.
- *     serviced).
- */
-int user_page_fault(as_area_t *area, uintptr_t upage, pf_access_t access)
-{
-	assert(page_table_locked(AS));
-	assert(mutex_locked(&area->lock));
-	assert(IS_ALIGNED(upage, PAGE_SIZE));
-
-	if (!as_area_check_access(area, access))
-		return AS_PF_FAULT;
-
-	as_area_pager_info_t *pager_info = &area->backend_data.pager_info;
-
-	ipc_data_t data = { };
-	ipc_set_imethod(&data, IPC_M_PAGE_IN);
-	ipc_set_arg1(&data, upage - area->base);
-	ipc_set_arg2(&data, PAGE_SIZE);
-	ipc_set_arg3(&data, pager_info->id1);
-	ipc_set_arg4(&data, pager_info->id2);
-	ipc_set_arg5(&data, pager_info->id3);
-
-	errno_t rc = ipc_req_internal(pager_info->pager, &data, (sysarg_t) true);
-
-	if (rc != EOK) {
-		log(LF_USPACE, LVL_FATAL,
-		    "Page-in request for page %#" PRIxPTR
-		    " at pager %p failed with error %s.",
-		    upage, pager_info->pager, str_error_name(rc));
-		return AS_PF_FAULT;
-	}
-
-	if (ipc_get_retval(&data) != EOK)
-		return AS_PF_FAULT;
-
-	/*
-	 * A successful reply will contain the physical frame in ARG1.
-	 * The physical frame will have the reference count already
-	 * incremented (if applicable).
-	 */
-
-	uintptr_t frame = ipc_get_arg1(&data);
-	page_mapping_insert(AS, upage, frame, as_area_get_flags(area));
-	if (!used_space_insert(&area->used_space, upage, 1))
-		panic("Cannot insert used space.");
-
-	return AS_PF_OK;
-}
-
-/** Free a frame that is backed by the user memory backend.
- *
- * The address space area and page tables must be already locked.
- *
- * @param area Ignored.
- * @param page Virtual address of the page corresponding to the frame.
- * @param frame Frame to be released.
- */
-void user_frame_free(as_area_t *area, uintptr_t page, uintptr_t frame)
-{
-	assert(page_table_locked(area->as));
-	assert(mutex_locked(&area->lock));
-
-	pfn_t pfn = ADDR2PFN(frame);
-	if (find_zone(pfn, 1, 0) != (size_t) -1) {
-		frame_free(frame, 1);
-	} else {
-		/* Nothing to do */
-	}
-
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1442 +1,0 @@
-/*
- * Copyright (c) 2001-2005 Jakub Jermar
- * Copyright (c) 2005 Sergey Bondari
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Physical frame allocator.
- *
- * This file contains the physical frame allocator and memory zone management.
- * The frame allocator is built on top of the two-level bitmap structure.
- *
- */
-
-#include <typedefs.h>
-#include <mm/frame.h>
-#include <mm/reserve.h>
-#include <mm/as.h>
-#include <panic.h>
-#include <assert.h>
-#include <adt/list.h>
-#include <synch/mutex.h>
-#include <synch/condvar.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <stdio.h>
-#include <log.h>
-#include <align.h>
-#include <mm/slab.h>
-#include <bitops.h>
-#include <macros.h>
-#include <config.h>
-#include <str.h>
-#include <proc/thread.h> /* THREAD */
-
-zones_t zones = {
-	.count = 0,
-	.lock = IRQ_SPINLOCK_INITIALIZER("frame.zones.lock"),
-};
-
-/*
- * Synchronization primitives used to sleep when there is no memory
- * available.
- */
-static IRQ_SPINLOCK_INITIALIZE(mem_avail_lock);
-static CONDVAR_INITIALIZE(mem_avail_cv);
-static size_t mem_avail_req = 0;  /**< Number of frames requested. */
-static size_t mem_avail_gen = 0;  /**< Generation counter. */
-
-/** Initialize frame structure.
- *
- * @param frame Frame structure to be initialized.
- *
- */
-_NO_TRACE static void frame_initialize(frame_t *frame)
-{
-	frame->refcount = 0;
-	frame->parent = NULL;
-}
-
-/*
- * Zones functions
- */
-
-/** Insert-sort zone into zones list.
- *
- * Assume interrupts are disabled and zones lock is
- * locked.
- *
- * @param base  Base frame of the newly inserted zone.
- * @param count Number of frames of the newly inserted zone.
- *
- * @return Zone number on success, -1 on error.
- *
- */
-_NO_TRACE static size_t zones_insert_zone(pfn_t base, size_t count,
-    zone_flags_t flags)
-{
-	if (zones.count + 1 == ZONES_MAX) {
-		log(LF_OTHER, LVL_ERROR, "Maximum zone count %u exceeded!",
-		    ZONES_MAX);
-		return (size_t) -1;
-	}
-
-	size_t i;
-	for (i = 0; i < zones.count; i++) {
-		/* Check for overlap */
-		if (overlaps(zones.info[i].base, zones.info[i].count,
-		    base, count)) {
-
-			/*
-			 * If the overlaping zones are of the same type
-			 * and the new zone is completely within the previous
-			 * one, then quietly ignore the new zone.
-			 *
-			 */
-
-			if ((zones.info[i].flags != flags) ||
-			    (!iswithin(zones.info[i].base, zones.info[i].count,
-			    base, count))) {
-				log(LF_OTHER, LVL_WARN,
-				    "Zone (%p, %p) overlaps "
-				    "with previous zone (%p %p)!",
-				    (void *) PFN2ADDR(base), (void *) PFN2ADDR(count),
-				    (void *) PFN2ADDR(zones.info[i].base),
-				    (void *) PFN2ADDR(zones.info[i].count));
-			}
-
-			return (size_t) -1;
-		}
-		if (base < zones.info[i].base)
-			break;
-	}
-
-	/* Move other zones up */
-	for (size_t j = zones.count; j > i; j--)
-		zones.info[j] = zones.info[j - 1];
-
-	zones.count++;
-
-	return i;
-}
-
-/** Get total available frames.
- *
- * Assume interrupts are disabled and zones lock is
- * locked.
- *
- * @return Total number of available frames.
- *
- */
-_NO_TRACE static size_t frame_total_free_get_internal(void)
-{
-	size_t total = 0;
-	size_t i;
-
-	for (i = 0; i < zones.count; i++)
-		total += zones.info[i].free_count;
-
-	return total;
-}
-
-_NO_TRACE size_t frame_total_free_get(void)
-{
-	size_t total;
-
-	irq_spinlock_lock(&zones.lock, true);
-	total = frame_total_free_get_internal();
-	irq_spinlock_unlock(&zones.lock, true);
-
-	return total;
-}
-
-/** Find a zone with a given frames.
- *
- * Assume interrupts are disabled and zones lock is
- * locked.
- *
- * @param frame Frame number contained in zone.
- * @param count Number of frames to look for.
- * @param hint  Used as zone hint.
- *
- * @return Zone index or -1 if not found.
- *
- */
-_NO_TRACE size_t find_zone(pfn_t frame, size_t count, size_t hint)
-{
-	if (hint >= zones.count)
-		hint = 0;
-
-	size_t i = hint;
-	do {
-		if ((zones.info[i].base <= frame) &&
-		    (zones.info[i].base + zones.info[i].count >= frame + count))
-			return i;
-
-		i++;
-		if (i >= zones.count)
-			i = 0;
-
-	} while (i != hint);
-
-	return (size_t) -1;
-}
-
-/** @return True if zone can allocate specified number of frames */
-_NO_TRACE static bool zone_can_alloc(zone_t *zone, size_t count,
-    pfn_t constraint)
-{
-	/*
-	 * The function bitmap_allocate_range() does not modify
-	 * the bitmap if the last argument is NULL.
-	 */
-
-	return ((zone->flags & ZONE_AVAILABLE) &&
-	    bitmap_allocate_range(&zone->bitmap, count, zone->base,
-	    FRAME_LOWPRIO, constraint, NULL));
-}
-
-/** Find a zone that can allocate specified number of frames
- *
- * This function searches among all zones. Assume interrupts are
- * disabled and zones lock is locked.
- *
- * @param count      Number of free frames we are trying to find.
- * @param flags      Required flags of the zone.
- * @param constraint Indication of bits that cannot be set in the
- *                   physical frame number of the first allocated frame.
- * @param hint       Preferred zone.
- *
- * @return Zone that can allocate specified number of frames.
- * @return -1 if no zone can satisfy the request.
- *
- */
-_NO_TRACE static size_t find_free_zone_all(size_t count, zone_flags_t flags,
-    pfn_t constraint, size_t hint)
-{
-	for (size_t pos = 0; pos < zones.count; pos++) {
-		size_t i = (pos + hint) % zones.count;
-
-		/* Check whether the zone meets the search criteria. */
-		if (!ZONE_FLAGS_MATCH(zones.info[i].flags, flags))
-			continue;
-
-		/* Check if the zone can satisfy the allocation request. */
-		if (zone_can_alloc(&zones.info[i], count, constraint))
-			return i;
-	}
-
-	return (size_t) -1;
-}
-
-/** Check if frame range  priority memory
- *
- * @param pfn   Starting frame.
- * @param count Number of frames.
- *
- * @return True if the range contains only priority memory.
- *
- */
-_NO_TRACE static bool is_high_priority(pfn_t base, size_t count)
-{
-	return (base + count <= FRAME_LOWPRIO);
-}
-
-/** Find a zone that can allocate specified number of frames
- *
- * This function ignores zones that contain only high-priority
- * memory. Assume interrupts are disabled and zones lock is locked.
- *
- * @param count      Number of free frames we are trying to find.
- * @param flags      Required flags of the zone.
- * @param constraint Indication of bits that cannot be set in the
- *                   physical frame number of the first allocated frame.
- * @param hint       Preferred zone.
- *
- * @return Zone that can allocate specified number of frames.
- * @return -1 if no low-priority zone can satisfy the request.
- *
- */
-_NO_TRACE static size_t find_free_zone_lowprio(size_t count, zone_flags_t flags,
-    pfn_t constraint, size_t hint)
-{
-	for (size_t pos = 0; pos < zones.count; pos++) {
-		size_t i = (pos + hint) % zones.count;
-
-		/* Skip zones containing only high-priority memory. */
-		if (is_high_priority(zones.info[i].base, zones.info[i].count))
-			continue;
-
-		/* Check whether the zone meets the search criteria. */
-		if (!ZONE_FLAGS_MATCH(zones.info[i].flags, flags))
-			continue;
-
-		/* Check if the zone can satisfy the allocation request. */
-		if (zone_can_alloc(&zones.info[i], count, constraint))
-			return i;
-	}
-
-	return (size_t) -1;
-}
-
-/** Find a zone that can allocate specified number of frames
- *
- * Assume interrupts are disabled and zones lock is
- * locked.
- *
- * @param count      Number of free frames we are trying to find.
- * @param flags      Required flags of the target zone.
- * @param constraint Indication of bits that cannot be set in the
- *                   physical frame number of the first allocated frame.
- * @param hint       Preferred zone.
- *
- * @return Zone that can allocate specified number of frames.
- * @return -1 if no zone can satisfy the request.
- *
- */
-_NO_TRACE static size_t find_free_zone(size_t count, zone_flags_t flags,
-    pfn_t constraint, size_t hint)
-{
-	if (hint >= zones.count)
-		hint = 0;
-
-	/*
-	 * Prefer zones with low-priority memory over
-	 * zones with high-priority memory.
-	 */
-
-	size_t znum = find_free_zone_lowprio(count, flags, constraint, hint);
-	if (znum != (size_t) -1)
-		return znum;
-
-	/* Take all zones into account */
-	return find_free_zone_all(count, flags, constraint, hint);
-}
-
-/*
- * Zone functions
- */
-
-/** Return frame from zone. */
-_NO_TRACE static frame_t *zone_get_frame(zone_t *zone, size_t index)
-{
-	assert(index < zone->count);
-
-	return &zone->frames[index];
-}
-
-/** Allocate frame in particular zone.
- *
- * Assume zone is locked and is available for allocation.
- * Panics if allocation is impossible.
- *
- * @param zone       Zone to allocate from.
- * @param count      Number of frames to allocate
- * @param constraint Indication of bits that cannot be set in the
- *                   physical frame number of the first allocated frame.
- *
- * @return Frame index in zone.
- *
- */
-_NO_TRACE static size_t zone_frame_alloc(zone_t *zone, size_t count,
-    pfn_t constraint)
-{
-	assert(zone->flags & ZONE_AVAILABLE);
-	assert(zone->free_count >= count);
-
-	/* Allocate frames from zone */
-	size_t index = (size_t) -1;
-	int avail = bitmap_allocate_range(&zone->bitmap, count, zone->base,
-	    FRAME_LOWPRIO, constraint, &index);
-
-	(void) avail;
-	assert(avail);
-	assert(index != (size_t) -1);
-
-	/* Update frame reference count */
-	for (size_t i = 0; i < count; i++) {
-		frame_t *frame = zone_get_frame(zone, index + i);
-
-		assert(frame->refcount == 0);
-		frame->refcount = 1;
-	}
-
-	/* Update zone information. */
-	zone->free_count -= count;
-	zone->busy_count += count;
-
-	return index;
-}
-
-/** Free frame from zone.
- *
- * Assume zone is locked and is available for deallocation.
- *
- * @param zone  Pointer to zone from which the frame is to be freed.
- * @param index Frame index relative to zone.
- *
- * @return Number of freed frames.
- *
- */
-_NO_TRACE static size_t zone_frame_free(zone_t *zone, size_t index)
-{
-	assert(zone->flags & ZONE_AVAILABLE);
-
-	frame_t *frame = zone_get_frame(zone, index);
-	assert(frame->refcount > 0);
-
-	if (!--frame->refcount) {
-		assert(zone->busy_count > 0);
-
-		bitmap_set(&zone->bitmap, index, 0);
-
-		/* Update zone information. */
-		zone->free_count++;
-		zone->busy_count--;
-
-		return 1;
-	}
-
-	return 0;
-}
-
-/** Mark frame in zone unavailable to allocation. */
-_NO_TRACE static void zone_mark_unavailable(zone_t *zone, size_t index)
-{
-	assert(zone->flags & ZONE_AVAILABLE);
-
-	frame_t *frame = zone_get_frame(zone, index);
-	assert(frame->refcount <= 1);
-
-	if (frame->refcount > 0)
-		return;
-
-	assert(zone->free_count > 0);
-
-	frame->refcount = 1;
-	bitmap_set_range(&zone->bitmap, index, 1);
-
-	zone->free_count--;
-	reserve_force_alloc(1);
-}
-
-/** Mark frame in zone available to allocation. */
-_NO_TRACE static void zone_mark_available(zone_t *zone, size_t index)
-{
-	assert(zone->flags & ZONE_AVAILABLE);
-
-	frame_t *frame = zone_get_frame(zone, index);
-	assert(frame->refcount == 1);
-
-	frame->refcount = 0;
-	bitmap_set_range(&zone->bitmap, index, 0);
-
-	zone->free_count++;
-}
-
-/** Merge two zones.
- *
- * Assume z1 & z2 are locked and compatible and zones lock is
- * locked.
- *
- * @param z1       First zone to merge.
- * @param z2       Second zone to merge.
- * @param old_z1   Original data of the first zone.
- * @param confdata Merged zone configuration data.
- *
- */
-_NO_TRACE static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1,
-    void *confdata)
-{
-	assert(zones.info[z1].flags & ZONE_AVAILABLE);
-	assert(zones.info[z2].flags & ZONE_AVAILABLE);
-	assert(zones.info[z1].flags == zones.info[z2].flags);
-	assert(zones.info[z1].base < zones.info[z2].base);
-	assert(!overlaps(zones.info[z1].base, zones.info[z1].count,
-	    zones.info[z2].base, zones.info[z2].count));
-
-	/* Difference between zone bases */
-	pfn_t base_diff = zones.info[z2].base - zones.info[z1].base;
-	pfn_t gap = base_diff - zones.info[z1].count;
-
-	zones.info[z1].count = base_diff + zones.info[z2].count;
-	zones.info[z1].free_count += zones.info[z2].free_count;
-	zones.info[z1].busy_count += zones.info[z2].busy_count;
-
-	bitmap_initialize(&zones.info[z1].bitmap, zones.info[z1].count,
-	    confdata + (sizeof(frame_t) * zones.info[z1].count));
-	bitmap_clear_range(&zones.info[z1].bitmap, 0, zones.info[z1].count);
-
-	zones.info[z1].frames = (frame_t *) confdata;
-
-	/*
-	 * Copy frames and bits from both zones to preserve parents, etc.
-	 */
-
-	for (size_t i = 0; i < old_z1->count; i++) {
-		bitmap_set(&zones.info[z1].bitmap, i,
-		    bitmap_get(&old_z1->bitmap, i));
-		zones.info[z1].frames[i] = old_z1->frames[i];
-	}
-
-	for (size_t i = 0; i < zones.info[z2].count; i++) {
-		bitmap_set(&zones.info[z1].bitmap, base_diff + i,
-		    bitmap_get(&zones.info[z2].bitmap, i));
-		zones.info[z1].frames[base_diff + i] =
-		    zones.info[z2].frames[i];
-	}
-
-	/*
-	 * Mark the gap between the original zones as unavailable.
-	 */
-
-	for (size_t i = 0; i < gap; i++) {
-		frame_initialize(&zones.info[z1].frames[old_z1->count + i]);
-		zone_mark_unavailable(&zones.info[z1], old_z1->count + i);
-	}
-}
-
-/** Return old configuration frames into the zone.
- *
- * We have two cases:
- * - The configuration data is outside the zone
- *   -> do nothing (perhaps call frame_free?)
- * - The configuration data was created by zone_create
- *   or updated by reduce_region -> free every frame
- *
- * @param znum  The actual zone where freeing should occur.
- * @param pfn   Old zone configuration frame.
- * @param count Old zone frame count.
- *
- */
-_NO_TRACE static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
-{
-	assert(zones.info[znum].flags & ZONE_AVAILABLE);
-
-	size_t cframes = SIZE2FRAMES(zone_conf_size(count));
-
-	if ((pfn < zones.info[znum].base) ||
-	    (pfn >= zones.info[znum].base + zones.info[znum].count))
-		return;
-
-	for (size_t i = 0; i < cframes; i++)
-		zone_mark_available(&zones.info[znum],
-		    pfn - zones.info[znum].base + i);
-}
-
-/** Merge zones z1 and z2.
- *
- * The merged zones must be 2 zones with no zone existing in between
- * (which means that z2 = z1 + 1). Both zones must be available zones
- * with the same flags.
- *
- * When you create a new zone, the frame allocator configuration does
- * not to be 2^order size. Once the allocator is running it is no longer
- * possible, merged configuration data occupies more space :-/
- *
- */
-bool zone_merge(size_t z1, size_t z2)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	bool ret = true;
-
-	/*
-	 * We can join only 2 zones with none existing inbetween,
-	 * the zones have to be available and with the same
-	 * set of flags
-	 */
-	if ((z1 >= zones.count) || (z2 >= zones.count) || (z2 - z1 != 1) ||
-	    (zones.info[z1].flags != zones.info[z2].flags)) {
-		ret = false;
-		goto errout;
-	}
-
-	pfn_t cframes = SIZE2FRAMES(zone_conf_size(
-	    zones.info[z2].base - zones.info[z1].base +
-	    zones.info[z2].count));
-
-	/* Allocate merged zone data inside one of the zones */
-	pfn_t pfn;
-	if (zone_can_alloc(&zones.info[z1], cframes, 0)) {
-		pfn = zones.info[z1].base +
-		    zone_frame_alloc(&zones.info[z1], cframes, 0);
-	} else if (zone_can_alloc(&zones.info[z2], cframes, 0)) {
-		pfn = zones.info[z2].base +
-		    zone_frame_alloc(&zones.info[z2], cframes, 0);
-	} else {
-		ret = false;
-		goto errout;
-	}
-
-	/* Preserve original data from z1 */
-	zone_t old_z1 = zones.info[z1];
-
-	/* Do zone merging */
-	zone_merge_internal(z1, z2, &old_z1, (void *) PA2KA(PFN2ADDR(pfn)));
-
-	/* Subtract zone information from busy frames */
-	zones.info[z1].busy_count -= cframes;
-
-	/* Free old zone information */
-	return_config_frames(z1,
-	    ADDR2PFN(KA2PA((uintptr_t) old_z1.frames)), old_z1.count);
-	return_config_frames(z1,
-	    ADDR2PFN(KA2PA((uintptr_t) zones.info[z2].frames)),
-	    zones.info[z2].count);
-
-	/* Move zones down */
-	for (size_t i = z2 + 1; i < zones.count; i++)
-		zones.info[i - 1] = zones.info[i];
-
-	zones.count--;
-
-errout:
-	irq_spinlock_unlock(&zones.lock, true);
-
-	return ret;
-}
-
-/** Merge all mergeable zones into one big zone.
- *
- * It is reasonable to do this on systems where
- * BIOS reports parts in chunks, so that we could
- * have 1 zone (it's faster).
- *
- */
-void zone_merge_all(void)
-{
-	size_t i = 1;
-
-	while (i < zones.count) {
-		if (!zone_merge(i - 1, i))
-			i++;
-	}
-}
-
-/** Create new frame zone.
- *
- * @param zone     Zone to construct.
- * @param start    Physical address of the first frame within the zone.
- * @param count    Count of frames in zone.
- * @param flags    Zone flags.
- * @param confdata Configuration data of the zone.
- *
- * @return Initialized zone.
- *
- */
-_NO_TRACE static void zone_construct(zone_t *zone, pfn_t start, size_t count,
-    zone_flags_t flags, void *confdata)
-{
-	zone->base = start;
-	zone->count = count;
-	zone->flags = flags;
-	zone->free_count = count;
-	zone->busy_count = 0;
-
-	if (flags & ZONE_AVAILABLE) {
-		/*
-		 * Initialize frame bitmap (located after the array of
-		 * frame_t structures in the configuration space).
-		 */
-
-		bitmap_initialize(&zone->bitmap, count, confdata +
-		    (sizeof(frame_t) * count));
-		bitmap_clear_range(&zone->bitmap, 0, count);
-
-		/*
-		 * Initialize the array of frame_t structures.
-		 */
-
-		zone->frames = (frame_t *) confdata;
-
-		for (size_t i = 0; i < count; i++)
-			frame_initialize(&zone->frames[i]);
-	} else {
-		bitmap_initialize(&zone->bitmap, 0, NULL);
-		zone->frames = NULL;
-	}
-}
-
-/** Compute configuration data size for zone.
- *
- * @param count Size of zone in frames.
- *
- * @return Size of zone configuration info (in bytes).
- *
- */
-size_t zone_conf_size(size_t count)
-{
-	return (count * sizeof(frame_t) + bitmap_size(count));
-}
-
-/** Allocate external configuration frames from low memory. */
-pfn_t zone_external_conf_alloc(size_t count)
-{
-	size_t frames = SIZE2FRAMES(zone_conf_size(count));
-
-	return ADDR2PFN((uintptr_t)
-	    frame_alloc(frames, FRAME_LOWMEM | FRAME_ATOMIC, 0));
-}
-
-/** Create and add zone to system.
- *
- * @param start     First frame number (absolute).
- * @param count     Size of zone in frames.
- * @param confframe Where configuration frames are supposed to be.
- *                  Automatically checks that we will not disturb the
- *                  kernel and possibly init. If confframe is given
- *                  _outside_ this zone, it is expected, that the area is
- *                  already marked BUSY and big enough to contain
- *                  zone_conf_size() amount of data. If the confframe is
- *                  inside the area, the zone free frame information is
- *                  modified not to include it.
- *
- * @return Zone number or -1 on error.
- *
- */
-size_t zone_create(pfn_t start, size_t count, pfn_t confframe,
-    zone_flags_t flags)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	if (flags & ZONE_AVAILABLE) {  /* Create available zone */
-		/*
-		 * Theoretically we could have NULL here, practically make sure
-		 * nobody tries to do that. If some platform requires, remove
-		 * the assert
-		 */
-		assert(confframe != ADDR2PFN((uintptr_t) NULL));
-
-		/* Update the known end of physical memory. */
-		config.physmem_end = max(config.physmem_end, PFN2ADDR(start + count));
-
-		/*
-		 * If confframe is supposed to be inside our zone, then make sure
-		 * it does not span kernel & init
-		 */
-		size_t confcount = SIZE2FRAMES(zone_conf_size(count));
-
-		if ((confframe >= start) && (confframe < start + count)) {
-			for (; confframe < start + count; confframe++) {
-				uintptr_t addr = PFN2ADDR(confframe);
-				if (overlaps(addr, PFN2ADDR(confcount),
-				    KA2PA(config.base), config.kernel_size))
-					continue;
-
-				if (overlaps(addr, PFN2ADDR(confcount),
-				    KA2PA(ballocs.base), ballocs.size))
-					continue;
-
-				bool overlap = false;
-				for (size_t i = 0; i < init.cnt; i++) {
-					if (overlaps(addr, PFN2ADDR(confcount),
-					    init.tasks[i].paddr,
-					    init.tasks[i].size)) {
-						overlap = true;
-						break;
-					}
-				}
-
-				if (overlap)
-					continue;
-
-				break;
-			}
-
-			if (confframe >= start + count)
-				panic("Cannot find configuration data for zone.");
-		}
-
-		size_t znum = zones_insert_zone(start, count, flags);
-		if (znum == (size_t) -1) {
-			irq_spinlock_unlock(&zones.lock, true);
-			return (size_t) -1;
-		}
-
-		void *confdata = (void *) PA2KA(PFN2ADDR(confframe));
-		zone_construct(&zones.info[znum], start, count, flags, confdata);
-
-		/* If confdata in zone, mark as unavailable */
-		if ((confframe >= start) && (confframe < start + count)) {
-			for (size_t i = confframe; i < confframe + confcount; i++)
-				zone_mark_unavailable(&zones.info[znum],
-				    i - zones.info[znum].base);
-		}
-
-		irq_spinlock_unlock(&zones.lock, true);
-
-		return znum;
-	}
-
-	/* Non-available zone */
-	size_t znum = zones_insert_zone(start, count, flags);
-	if (znum == (size_t) -1) {
-		irq_spinlock_unlock(&zones.lock, true);
-		return (size_t) -1;
-	}
-
-	zone_construct(&zones.info[znum], start, count, flags, NULL);
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	return znum;
-}
-
-/*
- * Frame functions
- */
-
-/** Set parent of frame. */
-void frame_set_parent(pfn_t pfn, void *data, size_t hint)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	size_t znum = find_zone(pfn, 1, hint);
-
-	assert(znum != (size_t) -1);
-
-	zone_get_frame(&zones.info[znum],
-	    pfn - zones.info[znum].base)->parent = data;
-
-	irq_spinlock_unlock(&zones.lock, true);
-}
-
-void *frame_get_parent(pfn_t pfn, size_t hint)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	size_t znum = find_zone(pfn, 1, hint);
-
-	assert(znum != (size_t) -1);
-
-	void *res = zone_get_frame(&zones.info[znum],
-	    pfn - zones.info[znum].base)->parent;
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	return res;
-}
-
-static size_t try_find_zone(size_t count, bool lowmem,
-    pfn_t frame_constraint, size_t hint)
-{
-	if (!lowmem) {
-		size_t znum = find_free_zone(count,
-		    ZONE_HIGHMEM | ZONE_AVAILABLE, frame_constraint, hint);
-		if (znum != (size_t) -1)
-			return znum;
-	}
-
-	return find_free_zone(count, ZONE_LOWMEM | ZONE_AVAILABLE,
-	    frame_constraint, hint);
-}
-
-/** Allocate frames of physical memory.
- *
- * @param count      Number of continuous frames to allocate.
- * @param flags      Flags for host zone selection and address processing.
- * @param constraint Indication of physical address bits that cannot be
- *                   set in the address of the first allocated frame.
- * @param pzone      Preferred zone.
- *
- * @return Physical address of the allocated frame.
- *
- */
-uintptr_t frame_alloc_generic(size_t count, frame_flags_t flags,
-    uintptr_t constraint, size_t *pzone)
-{
-	assert(count > 0);
-
-	size_t hint = pzone ? (*pzone) : 0;
-	pfn_t frame_constraint = ADDR2PFN(constraint);
-
-	/*
-	 * If not told otherwise, we must first reserve the memory.
-	 */
-	if (!(flags & FRAME_NO_RESERVE))
-		reserve_force_alloc(count);
-
-loop:
-	irq_spinlock_lock(&zones.lock, true);
-
-	// TODO: Print diagnostic if neither is explicitly specified.
-	bool lowmem = (flags & FRAME_LOWMEM) || !(flags & FRAME_HIGHMEM);
-
-	/*
-	 * First, find suitable frame zone.
-	 */
-	size_t znum = try_find_zone(count, lowmem, frame_constraint, hint);
-
-	/*
-	 * If no memory, reclaim some slab memory,
-	 * if it does not help, reclaim all.
-	 */
-	if ((znum == (size_t) -1) && (!(flags & FRAME_NO_RECLAIM))) {
-		irq_spinlock_unlock(&zones.lock, true);
-		size_t freed = slab_reclaim(0);
-		irq_spinlock_lock(&zones.lock, true);
-
-		if (freed > 0)
-			znum = try_find_zone(count, lowmem,
-			    frame_constraint, hint);
-
-		if (znum == (size_t) -1) {
-			irq_spinlock_unlock(&zones.lock, true);
-			freed = slab_reclaim(SLAB_RECLAIM_ALL);
-			irq_spinlock_lock(&zones.lock, true);
-
-			if (freed > 0)
-				znum = try_find_zone(count, lowmem,
-				    frame_constraint, hint);
-		}
-	}
-
-	if (znum == (size_t) -1) {
-		if (flags & FRAME_ATOMIC) {
-			irq_spinlock_unlock(&zones.lock, true);
-
-			if (!(flags & FRAME_NO_RESERVE))
-				reserve_free(count);
-
-			return 0;
-		}
-
-		size_t avail = frame_total_free_get_internal();
-
-		irq_spinlock_unlock(&zones.lock, true);
-
-		if (!THREAD)
-			panic("Cannot wait for %zu frames to become available "
-			    "(%zu available).", count, avail);
-
-		/*
-		 * Sleep until some frames are available again.
-		 */
-
-#ifdef CONFIG_DEBUG
-		log(LF_OTHER, LVL_DEBUG,
-		    "Thread %" PRIu64 " waiting for %zu frames "
-		    "%zu available.", THREAD->tid, count, avail);
-#endif
-
-		/* Disabled interrupts needed to prevent deadlock with TLB shootdown. */
-		irq_spinlock_lock(&mem_avail_lock, true);
-
-		if (mem_avail_req > 0)
-			mem_avail_req = min(mem_avail_req, count);
-		else
-			mem_avail_req = count;
-
-		size_t gen = mem_avail_gen;
-
-		while (gen == mem_avail_gen)
-			condvar_wait(&mem_avail_cv, &mem_avail_lock);
-
-		irq_spinlock_unlock(&mem_avail_lock, true);
-
-#ifdef CONFIG_DEBUG
-		log(LF_OTHER, LVL_DEBUG, "Thread %" PRIu64 " woken up.",
-		    THREAD->tid);
-#endif
-
-		goto loop;
-	}
-
-	pfn_t pfn = zone_frame_alloc(&zones.info[znum], count,
-	    frame_constraint) + zones.info[znum].base;
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	if (pzone)
-		*pzone = znum;
-
-	return PFN2ADDR(pfn);
-}
-
-uintptr_t frame_alloc(size_t count, frame_flags_t flags, uintptr_t constraint)
-{
-	return frame_alloc_generic(count, flags, constraint, NULL);
-}
-
-/** Free frames of physical memory.
- *
- * Find respective frame structures for supplied physical frames.
- * Decrement each frame reference count. If it drops to zero, mark
- * the frames as available.
- *
- * @param start Physical Address of the first frame to be freed.
- * @param count Number of frames to free.
- * @param flags Flags to control memory reservation.
- *
- */
-void frame_free_generic(uintptr_t start, size_t count, frame_flags_t flags)
-{
-	size_t freed = 0;
-
-	irq_spinlock_lock(&zones.lock, true);
-
-	for (size_t i = 0; i < count; i++) {
-		/*
-		 * First, find host frame zone for addr.
-		 */
-		pfn_t pfn = ADDR2PFN(start) + i;
-		size_t znum = find_zone(pfn, 1, 0);
-
-		assert(znum != (size_t) -1);
-
-		freed += zone_frame_free(&zones.info[znum],
-		    pfn - zones.info[znum].base);
-	}
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	/* Signal that some memory has been freed. */
-
-	/* Disabled interrupts needed to prevent deadlock with TLB shootdown. */
-	irq_spinlock_lock(&mem_avail_lock, true);
-
-	if (mem_avail_req > 0)
-		mem_avail_req -= min(mem_avail_req, freed);
-
-	if (mem_avail_req == 0) {
-		mem_avail_gen++;
-		condvar_broadcast(&mem_avail_cv);
-	}
-
-	irq_spinlock_unlock(&mem_avail_lock, true);
-
-	if (!(flags & FRAME_NO_RESERVE))
-		reserve_free(freed);
-}
-
-void frame_free(uintptr_t frame, size_t count)
-{
-	frame_free_generic(frame, count, 0);
-}
-
-void frame_free_noreserve(uintptr_t frame, size_t count)
-{
-	frame_free_generic(frame, count, FRAME_NO_RESERVE);
-}
-
-/** Add reference to frame.
- *
- * Find respective frame structure for supplied PFN and
- * increment frame reference count.
- *
- * @param pfn Frame number of the frame to be freed.
- *
- */
-_NO_TRACE void frame_reference_add(pfn_t pfn)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	/*
-	 * First, find host frame zone for addr.
-	 */
-	size_t znum = find_zone(pfn, 1, 0);
-
-	assert(znum != (size_t) -1);
-
-	zones.info[znum].frames[pfn - zones.info[znum].base].refcount++;
-
-	irq_spinlock_unlock(&zones.lock, true);
-}
-
-/** Mark given range unavailable in frame zones.
- *
- */
-_NO_TRACE void frame_mark_unavailable(pfn_t start, size_t count)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	for (size_t i = 0; i < count; i++) {
-		size_t znum = find_zone(start + i, 1, 0);
-
-		if (znum == (size_t) -1)  /* PFN not found */
-			continue;
-
-		zone_mark_unavailable(&zones.info[znum],
-		    start + i - zones.info[znum].base);
-	}
-
-	irq_spinlock_unlock(&zones.lock, true);
-}
-
-/** Initialize physical memory management.
- *
- */
-void frame_init(void)
-{
-	/* Tell the architecture to create some memory */
-	frame_low_arch_init();
-
-	if (config.cpu_active == 1) {
-		frame_mark_unavailable(ADDR2PFN(KA2PA(config.base)),
-		    SIZE2FRAMES(config.kernel_size));
-
-		for (size_t i = 0; i < init.cnt; i++)
-			frame_mark_unavailable(ADDR2PFN(init.tasks[i].paddr),
-			    SIZE2FRAMES(init.tasks[i].size));
-
-		if (ballocs.size)
-			frame_mark_unavailable(ADDR2PFN(KA2PA(ballocs.base)),
-			    SIZE2FRAMES(ballocs.size));
-
-		/*
-		 * Blacklist first frame, as allocating NULL would
-		 * fail in some places
-		 */
-		frame_mark_unavailable(0, 1);
-	}
-
-	frame_high_arch_init();
-}
-
-/** Adjust bounds of physical memory region according to low/high memory split.
- *
- * @param low[in]      If true, the adjustment is performed to make the region
- *                     fit in the low memory. Otherwise the adjustment is
- *                     performed to make the region fit in the high memory.
- * @param basep[inout] Pointer to a variable which contains the region's base
- *                     address and which may receive the adjusted base address.
- * @param sizep[inout] Pointer to a variable which contains the region's size
- *                     and which may receive the adjusted size.
- *
- * @return True if the region still exists even after the adjustment.
- * @return False otherwise.
- *
- */
-bool frame_adjust_zone_bounds(bool low, uintptr_t *basep, size_t *sizep)
-{
-	uintptr_t limit = KA2PA(config.identity_base) + config.identity_size;
-
-	if (low) {
-		if (*basep > limit)
-			return false;
-
-		if (*basep + *sizep > limit)
-			*sizep = limit - *basep;
-	} else {
-		if (*basep + *sizep <= limit)
-			return false;
-
-		if (*basep <= limit) {
-			*sizep -= limit - *basep;
-			*basep = limit;
-		}
-	}
-
-	return true;
-}
-
-/** Return total size of all zones.
- *
- */
-uint64_t zones_total_size(void)
-{
-	irq_spinlock_lock(&zones.lock, true);
-
-	uint64_t total = 0;
-
-	for (size_t i = 0; i < zones.count; i++)
-		total += (uint64_t) FRAMES2SIZE(zones.info[i].count);
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	return total;
-}
-
-void zones_stats(uint64_t *total, uint64_t *unavail, uint64_t *busy,
-    uint64_t *free)
-{
-	assert(total != NULL);
-	assert(unavail != NULL);
-	assert(busy != NULL);
-	assert(free != NULL);
-
-	irq_spinlock_lock(&zones.lock, true);
-
-	*total = 0;
-	*unavail = 0;
-	*busy = 0;
-	*free = 0;
-
-	for (size_t i = 0; i < zones.count; i++) {
-		*total += (uint64_t) FRAMES2SIZE(zones.info[i].count);
-
-		if (zones.info[i].flags & ZONE_AVAILABLE) {
-			*busy += (uint64_t) FRAMES2SIZE(zones.info[i].busy_count);
-			*free += (uint64_t) FRAMES2SIZE(zones.info[i].free_count);
-		} else
-			*unavail += (uint64_t) FRAMES2SIZE(zones.info[i].count);
-	}
-
-	irq_spinlock_unlock(&zones.lock, true);
-}
-
-/** Prints list of zones.
- *
- */
-void zones_print_list(void)
-{
-#ifdef __32_BITS__
-	printf("[nr] [base addr] [frames    ] [flags ] [free frames ] [busy frames ]\n");
-#endif
-
-#ifdef __64_BITS__
-	printf("[nr] [base address    ] [frames    ] [flags ] [free frames ] [busy frames ]\n");
-#endif
-
-	/*
-	 * Because printing may require allocation of memory, we may not hold
-	 * the frame allocator locks when printing zone statistics. Therefore,
-	 * we simply gather the statistics under the protection of the locks and
-	 * print the statistics when the locks have been released.
-	 *
-	 * When someone adds/removes zones while we are printing the statistics,
-	 * we may end up with inaccurate output (e.g. a zone being skipped from
-	 * the listing).
-	 */
-
-	size_t free_lowmem = 0;
-	size_t free_highmem = 0;
-	size_t free_highprio = 0;
-
-	for (size_t i = 0; ; i++) {
-		irq_spinlock_lock(&zones.lock, true);
-
-		if (i >= zones.count) {
-			irq_spinlock_unlock(&zones.lock, true);
-			break;
-		}
-
-		pfn_t fbase = zones.info[i].base;
-		uintptr_t base = PFN2ADDR(fbase);
-		size_t count = zones.info[i].count;
-		zone_flags_t flags = zones.info[i].flags;
-		size_t free_count = zones.info[i].free_count;
-		size_t busy_count = zones.info[i].busy_count;
-
-		bool available = ((flags & ZONE_AVAILABLE) != 0);
-		bool lowmem = ((flags & ZONE_LOWMEM) != 0);
-		bool highmem = ((flags & ZONE_HIGHMEM) != 0);
-		bool highprio = is_high_priority(fbase, count);
-
-		if (available) {
-			if (lowmem)
-				free_lowmem += free_count;
-
-			if (highmem)
-				free_highmem += free_count;
-
-			if (highprio) {
-				free_highprio += free_count;
-			} else {
-				/*
-				 * Walk all frames of the zone and examine
-				 * all high priority memory to get accurate
-				 * statistics.
-				 */
-
-				for (size_t index = 0; index < count; index++) {
-					if (is_high_priority(fbase + index, 0)) {
-						if (!bitmap_get(&zones.info[i].bitmap, index))
-							free_highprio++;
-					} else
-						break;
-				}
-			}
-		}
-
-		irq_spinlock_unlock(&zones.lock, true);
-
-		printf("%-4zu", i);
-
-#ifdef __32_BITS__
-		printf("  %p", (void *) base);
-#endif
-
-#ifdef __64_BITS__
-		printf(" %p", (void *) base);
-#endif
-
-		printf(" %12zu %c%c%c%c%c    ", count,
-		    available ? 'A' : '-',
-		    (flags & ZONE_RESERVED) ? 'R' : '-',
-		    (flags & ZONE_FIRMWARE) ? 'F' : '-',
-		    (flags & ZONE_LOWMEM) ? 'L' : '-',
-		    (flags & ZONE_HIGHMEM) ? 'H' : '-');
-
-		if (available)
-			printf("%14zu %14zu",
-			    free_count, busy_count);
-
-		printf("\n");
-	}
-
-	printf("\n");
-
-	uint64_t size;
-	const char *size_suffix;
-
-	bin_order_suffix(FRAMES2SIZE(free_lowmem), &size, &size_suffix,
-	    false);
-	printf("Available low memory:    %zu frames (%" PRIu64 " %s)\n",
-	    free_lowmem, size, size_suffix);
-
-	bin_order_suffix(FRAMES2SIZE(free_highmem), &size, &size_suffix,
-	    false);
-	printf("Available high memory:   %zu frames (%" PRIu64 " %s)\n",
-	    free_highmem, size, size_suffix);
-
-	bin_order_suffix(FRAMES2SIZE(free_highprio), &size, &size_suffix,
-	    false);
-	printf("Available high priority: %zu frames (%" PRIu64 " %s)\n",
-	    free_highprio, size, size_suffix);
-}
-
-/** Prints zone details.
- *
- * @param num Zone base address or zone number.
- *
- */
-void zone_print_one(size_t num)
-{
-	irq_spinlock_lock(&zones.lock, true);
-	size_t znum = (size_t) -1;
-
-	for (size_t i = 0; i < zones.count; i++) {
-		if ((i == num) || (PFN2ADDR(zones.info[i].base) == num)) {
-			znum = i;
-			break;
-		}
-	}
-
-	if (znum == (size_t) -1) {
-		irq_spinlock_unlock(&zones.lock, true);
-		printf("Zone not found.\n");
-		return;
-	}
-
-	size_t free_lowmem = 0;
-	size_t free_highmem = 0;
-	size_t free_highprio = 0;
-
-	pfn_t fbase = zones.info[znum].base;
-	uintptr_t base = PFN2ADDR(fbase);
-	zone_flags_t flags = zones.info[znum].flags;
-	size_t count = zones.info[znum].count;
-	size_t free_count = zones.info[znum].free_count;
-	size_t busy_count = zones.info[znum].busy_count;
-
-	bool available = ((flags & ZONE_AVAILABLE) != 0);
-	bool lowmem = ((flags & ZONE_LOWMEM) != 0);
-	bool highmem = ((flags & ZONE_HIGHMEM) != 0);
-	bool highprio = is_high_priority(fbase, count);
-
-	if (available) {
-		if (lowmem)
-			free_lowmem = free_count;
-
-		if (highmem)
-			free_highmem = free_count;
-
-		if (highprio) {
-			free_highprio = free_count;
-		} else {
-			/*
-			 * Walk all frames of the zone and examine
-			 * all high priority memory to get accurate
-			 * statistics.
-			 */
-
-			for (size_t index = 0; index < count; index++) {
-				if (is_high_priority(fbase + index, 0)) {
-					if (!bitmap_get(&zones.info[znum].bitmap, index))
-						free_highprio++;
-				} else
-					break;
-			}
-		}
-	}
-
-	irq_spinlock_unlock(&zones.lock, true);
-
-	uint64_t size;
-	const char *size_suffix;
-
-	bin_order_suffix(FRAMES2SIZE(count), &size, &size_suffix, false);
-
-	printf("Zone number:             %zu\n", znum);
-	printf("Zone base address:       %p\n", (void *) base);
-	printf("Zone size:               %zu frames (%" PRIu64 " %s)\n", count,
-	    size, size_suffix);
-	printf("Zone flags:              %c%c%c%c%c\n",
-	    available ? 'A' : '-',
-	    (flags & ZONE_RESERVED) ? 'R' : '-',
-	    (flags & ZONE_FIRMWARE) ? 'F' : '-',
-	    (flags & ZONE_LOWMEM) ? 'L' : '-',
-	    (flags & ZONE_HIGHMEM) ? 'H' : '-');
-
-	if (available) {
-		bin_order_suffix(FRAMES2SIZE(busy_count), &size, &size_suffix,
-		    false);
-		printf("Allocated space:         %zu frames (%" PRIu64 " %s)\n",
-		    busy_count, size, size_suffix);
-
-		bin_order_suffix(FRAMES2SIZE(free_count), &size, &size_suffix,
-		    false);
-		printf("Available space:         %zu frames (%" PRIu64 " %s)\n",
-		    free_count, size, size_suffix);
-
-		bin_order_suffix(FRAMES2SIZE(free_lowmem), &size, &size_suffix,
-		    false);
-		printf("Available low memory:    %zu frames (%" PRIu64 " %s)\n",
-		    free_lowmem, size, size_suffix);
-
-		bin_order_suffix(FRAMES2SIZE(free_highmem), &size, &size_suffix,
-		    false);
-		printf("Available high memory:   %zu frames (%" PRIu64 " %s)\n",
-		    free_highmem, size, size_suffix);
-
-		bin_order_suffix(FRAMES2SIZE(free_highprio), &size, &size_suffix,
-		    false);
-		printf("Available high priority: %zu frames (%" PRIu64 " %s)\n",
-		    free_highprio, size, size_suffix);
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/km.c
===================================================================
--- kernel/generic/src/mm/km.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,289 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Kernel virtual memory setup.
- */
-
-#include <mm/km.h>
-#include <arch/mm/km.h>
-#include <assert.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/asid.h>
-#include <config.h>
-#include <typedefs.h>
-#include <lib/ra.h>
-#include <arch.h>
-#include <align.h>
-#include <macros.h>
-#include <bitops.h>
-#include <proc/thread.h>
-
-static ra_arena_t *km_ni_arena;
-
-#define DEFERRED_PAGES_MAX	(PAGE_SIZE / sizeof(uintptr_t))
-
-/** Number of freed pages in the deferred buffer. */
-static volatile unsigned deferred_pages;
-/** Buffer of deferred freed pages. */
-static uintptr_t deferred_page[DEFERRED_PAGES_MAX];
-
-/** Flush the buffer of deferred freed pages.
- *
- * @return		Number of freed pages.
- */
-static unsigned km_flush_deferred(void)
-{
-	unsigned i = 0;
-	ipl_t ipl;
-
-	ipl = tlb_shootdown_start(TLB_INVL_ASID, ASID_KERNEL, 0, 0);
-
-	for (i = 0; i < deferred_pages; i++) {
-		page_mapping_remove(AS_KERNEL, deferred_page[i]);
-		km_page_free(deferred_page[i], PAGE_SIZE);
-	}
-
-	tlb_invalidate_asid(ASID_KERNEL);
-
-	as_invalidate_translation_cache(AS_KERNEL, 0, -1);
-	tlb_shootdown_finalize(ipl);
-
-	return i;
-}
-
-/** Architecture dependent setup of identity-mapped kernel memory. */
-void km_identity_init(void)
-{
-	km_identity_arch_init();
-	config.identity_configured = true;
-}
-
-/** Architecture dependent setup of non-identity-mapped kernel memory. */
-void km_non_identity_init(void)
-{
-	km_ni_arena = ra_arena_create();
-	assert(km_ni_arena != NULL);
-	km_non_identity_arch_init();
-	config.non_identity_configured = true;
-}
-
-bool km_is_non_identity(uintptr_t addr)
-{
-	return km_is_non_identity_arch(addr);
-}
-
-void km_non_identity_span_add(uintptr_t base, size_t size)
-{
-	bool span_added;
-
-	page_mapping_make_global(base, size);
-
-	span_added = ra_span_add(km_ni_arena, base, size);
-	assert(span_added);
-	(void) span_added;
-}
-
-uintptr_t km_page_alloc(size_t size, size_t align)
-{
-	uintptr_t base;
-	if (ra_alloc(km_ni_arena, size, align, &base))
-		return base;
-	else
-		panic("Kernel ran out of virtual address space.");
-}
-
-void km_page_free(uintptr_t page, size_t size)
-{
-	ra_free(km_ni_arena, page, size);
-}
-
-static uintptr_t
-km_map_aligned(uintptr_t paddr, size_t size, size_t align, unsigned int flags)
-{
-	uintptr_t vaddr;
-	uintptr_t offs;
-
-	if (align == KM_NATURAL_ALIGNMENT)
-		align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
-
-	assert(ALIGN_DOWN(paddr, FRAME_SIZE) == paddr);
-	assert(ALIGN_UP(size, FRAME_SIZE) == size);
-	assert(ispwr2(align));
-
-	/* Enforce at least PAGE_SIZE alignment. */
-	vaddr = km_page_alloc(size, max(PAGE_SIZE, align));
-
-	page_table_lock(AS_KERNEL, true);
-	for (offs = 0; offs < size; offs += PAGE_SIZE) {
-		page_mapping_insert(AS_KERNEL, vaddr + offs, paddr + offs,
-		    flags);
-	}
-	page_table_unlock(AS_KERNEL, true);
-
-	return vaddr;
-}
-
-static void km_unmap_aligned(uintptr_t vaddr, size_t size)
-{
-	uintptr_t offs;
-	ipl_t ipl;
-
-	assert(ALIGN_DOWN(vaddr, PAGE_SIZE) == vaddr);
-	assert(ALIGN_UP(size, PAGE_SIZE) == size);
-
-	page_table_lock(AS_KERNEL, true);
-
-	size_t pages = size >> PAGE_WIDTH;
-	ipl = tlb_shootdown_start(TLB_INVL_PAGES, ASID_KERNEL, vaddr, pages);
-
-	for (offs = 0; offs < size; offs += PAGE_SIZE)
-		page_mapping_remove(AS_KERNEL, vaddr + offs);
-
-	tlb_invalidate_pages(ASID_KERNEL, vaddr, pages);
-
-	as_invalidate_translation_cache(AS_KERNEL, 0, -1);
-	tlb_shootdown_finalize(ipl);
-	page_table_unlock(AS_KERNEL, true);
-
-	km_page_free(vaddr, size);
-}
-
-/** Map a piece of physical address space into the virtual address space.
- *
- * @param paddr		Physical address to be mapped. May be unaligned.
- * @param size		Size of area starting at paddr to be mapped.
- * @param flags		Protection flags to be used for the mapping.
- *
- * @return New virtual address mapped to paddr.
- */
-uintptr_t km_map(uintptr_t paddr, size_t size, size_t align, unsigned int flags)
-{
-	uintptr_t page;
-	size_t offs;
-
-	offs = paddr - ALIGN_DOWN(paddr, FRAME_SIZE);
-	page = km_map_aligned(ALIGN_DOWN(paddr, FRAME_SIZE),
-	    ALIGN_UP(size + offs, FRAME_SIZE), align, flags);
-
-	return page + offs;
-}
-
-/** Unmap a piece of virtual address space.
- *
- * @param vaddr		Virtual address to be unmapped. May be unaligned, but
- *			it must be a value previously returned by km_map().
- * @param size		Size of area starting at vaddr to be unmapped.
- */
-void km_unmap(uintptr_t vaddr, size_t size)
-{
-	size_t offs;
-
-	offs = vaddr - ALIGN_DOWN(vaddr, PAGE_SIZE);
-	km_unmap_aligned(ALIGN_DOWN(vaddr, PAGE_SIZE),
-	    ALIGN_UP(size + offs, PAGE_SIZE));
-}
-
-/** Unmap kernel non-identity page.
- *
- * @param[in] page	Non-identity page to be unmapped.
- */
-static void km_unmap_deferred(uintptr_t page)
-{
-	page_table_lock(AS_KERNEL, true);
-
-	if (deferred_pages == DEFERRED_PAGES_MAX) {
-		(void) km_flush_deferred();
-		deferred_pages = 0;
-	}
-
-	deferred_page[deferred_pages++] = page;
-
-	page_table_unlock(AS_KERNEL, true);
-}
-
-/** Create a temporary page.
- *
- * The page is mapped read/write to a newly allocated frame of physical memory.
- * The page must be returned back to the system by a call to
- * km_temporary_page_put().
- *
- * @param[inout] framep	Pointer to a variable which will receive the physical
- *			address of the allocated frame.
- * @param[in] flags	Frame allocation flags. FRAME_NONE, FRAME_NO_RESERVE
- *			and FRAME_ATOMIC bits are allowed.
- * @return		Virtual address of the allocated frame.
- */
-uintptr_t km_temporary_page_get(uintptr_t *framep, frame_flags_t flags)
-{
-	assert(THREAD);
-	assert(framep);
-	assert(!(flags & ~(FRAME_NO_RESERVE | FRAME_ATOMIC)));
-
-	/*
-	 * Allocate a frame, preferably from high memory.
-	 */
-	uintptr_t page;
-	uintptr_t frame;
-
-	frame = frame_alloc(1, FRAME_HIGHMEM | flags, 0);
-	if (frame >= config.identity_size) {
-		page = km_map(frame, PAGE_SIZE, PAGE_SIZE,
-		    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
-	} else {
-		page = PA2KA(frame);
-	}
-
-	*framep = frame;
-	return page;
-}
-
-/** Destroy a temporary page.
- *
- * This function destroys a temporary page previously created by
- * km_temporary_page_get(). The page destruction may be immediate or deferred.
- * The frame mapped by the destroyed page is not freed.
- *
- * @param[in] page	Temporary page to be destroyed.
- */
-void km_temporary_page_put(uintptr_t page)
-{
-	assert(THREAD);
-
-	if (km_is_non_identity(page))
-		km_unmap_deferred(page);
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/malloc.c
===================================================================
--- kernel/generic/src/mm/malloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdalign.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <align.h>
-#include <bitops.h>
-#include <mm/slab.h>
-#include <memw.h>
-#include <main/main.h> // malloc_init()
-#include <macros.h>
-
-/** Minimum size to be allocated by malloc */
-#define SLAB_MIN_MALLOC_W  4
-
-/** Maximum size to be allocated by malloc */
-#define SLAB_MAX_MALLOC_W  22
-
-/** Caches for malloc */
-static slab_cache_t *malloc_caches[SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1];
-
-static const char *malloc_names[] =  {
-	"malloc-16",
-	"malloc-32",
-	"malloc-64",
-	"malloc-128",
-	"malloc-256",
-	"malloc-512",
-	"malloc-1K",
-	"malloc-2K",
-	"malloc-4K",
-	"malloc-8K",
-	"malloc-16K",
-	"malloc-32K",
-	"malloc-64K",
-	"malloc-128K",
-	"malloc-256K",
-	"malloc-512K",
-	"malloc-1M",
-	"malloc-2M",
-	"malloc-4M"
-};
-
-void malloc_init(void)
-{
-	/* Initialize structures for malloc */
-	size_t i;
-	size_t size;
-
-	for (i = 0, size = (1 << SLAB_MIN_MALLOC_W);
-	    i < (SLAB_MAX_MALLOC_W - SLAB_MIN_MALLOC_W + 1);
-	    i++, size <<= 1) {
-		malloc_caches[i] = slab_cache_create(malloc_names[i], size, 0,
-		    NULL, NULL, SLAB_CACHE_MAGDEFERRED);
-	}
-}
-
-static void _check_sizes(size_t *alignment, size_t *size)
-{
-	assert(size);
-	assert(alignment);
-
-	/* Force size to be nonzero. */
-	if (*size == 0)
-		*size = 1;
-
-	/* Alignment must be a power of 2. */
-	assert(ispwr2(*alignment));
-	assert(*alignment <= PAGE_SIZE);
-
-	if (*alignment < alignof(max_align_t))
-		*alignment = alignof(max_align_t);
-
-	*size = ALIGN_UP(*size, *alignment);
-
-	if (*size < (1 << SLAB_MIN_MALLOC_W))
-		*size = (1 << SLAB_MIN_MALLOC_W);
-}
-
-static slab_cache_t *cache_for_size(size_t size)
-{
-	assert(size > 0);
-	assert(size <= (1 << SLAB_MAX_MALLOC_W));
-
-	size_t idx = fnzb(size - 1) - SLAB_MIN_MALLOC_W + 1;
-
-	assert(idx < sizeof(malloc_caches) / sizeof(malloc_caches[0]));
-
-	slab_cache_t *cache = malloc_caches[idx];
-
-	assert(cache != NULL);
-	return cache;
-}
-
-// TODO: Expose publicly and use mem_alloc() and mem_free() instead of malloc()
-
-static void *mem_alloc(size_t, size_t) __attribute__((malloc));
-
-static void *mem_alloc(size_t alignment, size_t size)
-{
-	_check_sizes(&alignment, &size);
-
-	if (size > (1 << SLAB_MAX_MALLOC_W)) {
-		// TODO: Allocate big objects directly from coarse allocator.
-		assert(size <= (1 << SLAB_MAX_MALLOC_W));
-	}
-
-	/* We assume that slab objects are aligned naturally */
-	return slab_alloc(cache_for_size(size), FRAME_ATOMIC);
-}
-
-static void *mem_realloc(void *old_ptr, size_t alignment, size_t old_size,
-    size_t new_size)
-{
-	assert(old_ptr);
-	_check_sizes(&alignment, &old_size);
-	_check_sizes(&alignment, &new_size);
-
-	// TODO: handle big objects
-	assert(new_size <= (1 << SLAB_MAX_MALLOC_W));
-
-	slab_cache_t *old_cache = cache_for_size(old_size);
-	slab_cache_t *new_cache = cache_for_size(new_size);
-	if (old_cache == new_cache)
-		return old_ptr;
-
-	void *new_ptr = slab_alloc(new_cache, FRAME_ATOMIC);
-	if (!new_ptr)
-		return NULL;
-
-	memcpy(new_ptr, old_ptr, min(old_size, new_size));
-	slab_free(old_cache, old_ptr);
-	return new_ptr;
-}
-
-/**
- * Free memory allocated using mem_alloc().
- *
- * @param ptr        Pointer returned by mem_alloc().
- * @param size       Size used to call mem_alloc().
- * @param alignment  Alignment used to call mem_alloc().
- */
-static void mem_free(void *ptr, size_t alignment, size_t size)
-{
-	if (!ptr)
-		return;
-
-	_check_sizes(&alignment, &size);
-
-	if (size > (1 << SLAB_MAX_MALLOC_W)) {
-		// TODO: Allocate big objects directly from coarse allocator.
-		assert(size <= (1 << SLAB_MAX_MALLOC_W));
-	}
-
-	return slab_free(cache_for_size(size), ptr);
-}
-
-static const size_t _offset = ALIGN_UP(sizeof(size_t), alignof(max_align_t));
-
-void *malloc(size_t size)
-{
-	if (size + _offset < size)
-		return NULL;
-
-	void *obj = mem_alloc(alignof(max_align_t), size + _offset) + _offset;
-
-	/* Remember the allocation size just before the object. */
-	((size_t *) obj)[-1] = size;
-	return obj;
-}
-
-void free(void *obj)
-{
-	/*
-	 * We don't check integrity of size, so buffer over/underruns can
-	 * corrupt it. That's ok, it ultimately only serves as a hint to
-	 * select the correct slab cache. If the selected cache is not correct,
-	 * slab_free() will detect it and panic.
-	 */
-	size_t size = ((size_t *) obj)[-1];
-	mem_free(obj - _offset, alignof(max_align_t), size + _offset);
-}
-
-void *realloc(void *old_obj, size_t new_size)
-{
-	if (new_size == 0)
-		new_size = 1;
-
-	if (!old_obj)
-		return malloc(new_size);
-
-	size_t old_size = ((size_t *) old_obj)[-1];
-
-	void *new_obj = mem_realloc(old_obj - _offset, alignof(max_align_t),
-	    old_size + _offset, new_size + _offset) + _offset;
-	if (!new_obj)
-		return NULL;
-
-	((size_t *) new_obj)[-1] = new_size;
-	return new_obj;
-}
Index: rnel/generic/src/mm/page.c
===================================================================
--- kernel/generic/src/mm/page.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2001-2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Virtual Address Translation subsystem.
- *
- * This file contains code for creating, destroying and searching
- * mappings between virtual addresses and physical addresses.
- * Functions here are mere wrappers that call the real implementation.
- * They however, define the single interface.
- *
- */
-
-/*
- * Note on memory prefetching and updating memory mappings, also described in:
- * AMD x86-64 Architecture Programmer's Manual, Volume 2, System Programming,
- * 7.2.1 Special Coherency Considerations.
- *
- * The processor which modifies a page table mapping can access prefetched data
- * from the old mapping.  In order to prevent this, we place a memory barrier
- * after a mapping is updated.
- *
- * We assume that the other processors are either not using the mapping yet
- * (i.e. during the bootstrap) or are executing the TLB shootdown code.  While
- * we don't care much about the former case, the processors in the latter case
- * will do an implicit serialization by virtue of running the TLB shootdown
- * interrupt handler.
- *
- */
-
-#include <mm/page.h>
-#include <genarch/mm/page_ht.h>
-#include <genarch/mm/page_pt.h>
-#include <arch/mm/page.h>
-#include <arch/mm/asid.h>
-#include <mm/as.h>
-#include <mm/frame.h>
-#include <barrier.h>
-#include <typedefs.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <assert.h>
-#include <syscall/copy.h>
-#include <errno.h>
-#include <align.h>
-
-/** Virtual operations for page subsystem. */
-const page_mapping_operations_t *page_mapping_operations = NULL;
-
-void page_init(void)
-{
-	page_arch_init();
-}
-
-/** Insert mapping of page to frame.
- *
- * Map virtual address page to physical address frame
- * using flags. Allocate and setup any missing page tables.
- *
- * @param as    Address space to which page belongs.
- * @param page  Virtual address of the page to be mapped.
- * @param frame Physical address of memory frame to which the mapping is
- *              done.
- * @param flags Flags to be used for mapping.
- *
- */
-_NO_TRACE void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame,
-    unsigned int flags)
-{
-	assert(page_table_locked(as));
-
-	assert(page_mapping_operations);
-	assert(page_mapping_operations->mapping_insert);
-
-	page_mapping_operations->mapping_insert(as, ALIGN_DOWN(page, PAGE_SIZE),
-	    ALIGN_DOWN(frame, FRAME_SIZE), flags);
-
-	/* Repel prefetched accesses to the old mapping. */
-	memory_barrier();
-}
-
-/** Remove mapping of page.
- *
- * Remove any mapping of page within address space as.
- * TLB shootdown should follow in order to make effects of
- * this call visible.
- *
- * @param as   Address space to which page belongs.
- * @param page Virtual address of the page to be demapped.
- *
- */
-_NO_TRACE void page_mapping_remove(as_t *as, uintptr_t page)
-{
-	assert(page_table_locked(as));
-
-	assert(page_mapping_operations);
-	assert(page_mapping_operations->mapping_remove);
-
-	page_mapping_operations->mapping_remove(as,
-	    ALIGN_DOWN(page, PAGE_SIZE));
-
-	/* Repel prefetched accesses to the old mapping. */
-	memory_barrier();
-}
-
-/** Find mapping for virtual page.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param[out] pte Structure that will receive a copy of the found PTE.
- *
- * @return True if a valid PTE is returned, false otherwise. Note that
- *         the PTE is not guaranteed to be present.
- */
-_NO_TRACE bool page_mapping_find(as_t *as, uintptr_t page, bool nolock,
-    pte_t *pte)
-{
-	assert(nolock || page_table_locked(as));
-
-	assert(page_mapping_operations);
-	assert(page_mapping_operations->mapping_find);
-
-	return page_mapping_operations->mapping_find(as,
-	    ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
-}
-
-/** Update mapping for virtual page.
- *
- * Use only to update accessed and modified/dirty bits.
- *
- * @param as       Address space to which page belongs.
- * @param page     Virtual page.
- * @param nolock   True if the page tables need not be locked.
- * @param pte      New PTE.
- */
-_NO_TRACE void page_mapping_update(as_t *as, uintptr_t page, bool nolock,
-    pte_t *pte)
-{
-	assert(nolock || page_table_locked(as));
-
-	assert(page_mapping_operations);
-	assert(page_mapping_operations->mapping_find);
-
-	page_mapping_operations->mapping_update(as,
-	    ALIGN_DOWN(page, PAGE_SIZE), nolock, pte);
-}
-
-/** Make the mapping shared by all page tables (not address spaces).
- *
- * @param base Starting virtual address of the range that is made global.
- * @param size Size of the address range that is made global.
- */
-void page_mapping_make_global(uintptr_t base, size_t size)
-{
-	assert(page_mapping_operations);
-	assert(page_mapping_operations->mapping_make_global);
-
-	return page_mapping_operations->mapping_make_global(base, size);
-}
-
-errno_t page_find_mapping(uintptr_t virt, uintptr_t *phys)
-{
-	page_table_lock(AS, true);
-
-	pte_t pte;
-	bool found = page_mapping_find(AS, virt, false, &pte);
-	if (!found || !PTE_VALID(&pte) || !PTE_PRESENT(&pte)) {
-		page_table_unlock(AS, true);
-		return ENOENT;
-	}
-
-	*phys = PTE_GET_FRAME(&pte) +
-	    (virt - ALIGN_DOWN(virt, PAGE_SIZE));
-
-	page_table_unlock(AS, true);
-
-	return EOK;
-}
-
-/** Syscall wrapper for getting mapping of a virtual page.
- *
- * @return EOK on success.
- * @return ENOENT if no virtual address mapping found.
- *
- */
-sys_errno_t sys_page_find_mapping(uintptr_t virt, uspace_ptr_uintptr_t phys_ptr)
-{
-	uintptr_t phys;
-	errno_t rc = page_find_mapping(virt, &phys);
-	if (rc != EOK)
-		return rc;
-
-	rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys));
-	return (sys_errno_t) rc;
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/reserve.c
===================================================================
--- kernel/generic/src/mm/reserve.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Memory reservations.
- */
-
-#include <assert.h>
-#include <mm/reserve.h>
-#include <mm/frame.h>
-#include <mm/slab.h>
-#include <synch/spinlock.h>
-#include <typedefs.h>
-#include <arch/types.h>
-
-static bool reserve_initialized = false;
-
-IRQ_SPINLOCK_STATIC_INITIALIZE_NAME(reserve_lock, "reserve_lock");
-static ssize_t reserve = 0;
-
-/** Initialize memory reservations tracking.
- *
- * This function must be called after frame zones are created and merged
- * and before any address space area is created.
- */
-void reserve_init(void)
-{
-	reserve = frame_total_free_get();
-	reserve_initialized = true;
-}
-
-/** Try to reserve memory.
- *
- * This function may not be called from contexts that do not allow memory
- * reclaiming, such as some invocations of frame_alloc_generic().
- *
- * @param size		Number of frames to reserve.
- * @return		True on success or false otherwise.
- */
-bool reserve_try_alloc(size_t size)
-{
-	bool reserved = false;
-
-	assert(reserve_initialized);
-
-	irq_spinlock_lock(&reserve_lock, true);
-	if (reserve >= 0 && (size_t) reserve >= size) {
-		reserve -= size;
-		reserved = true;
-	} else {
-		/*
-		 * Some reservable frames may be cached by the slab allocator.
-		 * Try to reclaim some reservable memory. Try to be gentle for
-		 * the first time. If it does not help, try to reclaim
-		 * everything.
-		 */
-		irq_spinlock_unlock(&reserve_lock, true);
-		slab_reclaim(0);
-		irq_spinlock_lock(&reserve_lock, true);
-		if (reserve >= 0 && (size_t) reserve >= size) {
-			reserve -= size;
-			reserved = true;
-		} else {
-			irq_spinlock_unlock(&reserve_lock, true);
-			slab_reclaim(SLAB_RECLAIM_ALL);
-			irq_spinlock_lock(&reserve_lock, true);
-			if (reserve >= 0 && (size_t) reserve >= size) {
-				reserve -= size;
-				reserved = true;
-			}
-		}
-	}
-	irq_spinlock_unlock(&reserve_lock, true);
-
-	return reserved;
-}
-
-/** Reserve memory.
- *
- * This function simply marks the respective amount of memory frames reserved.
- * It does not implement any sort of blocking for the case there is not enough
- * reservable memory. It will simply take the reserve into negative numbers and
- * leave the blocking up to the allocation phase.
- *
- * @param size		Number of frames to reserve.
- */
-void reserve_force_alloc(size_t size)
-{
-	if (!reserve_initialized)
-		return;
-
-	irq_spinlock_lock(&reserve_lock, true);
-	reserve -= size;
-	irq_spinlock_unlock(&reserve_lock, true);
-}
-
-/** Unreserve memory.
- *
- * @param size		Number of frames to unreserve.
- */
-void reserve_free(size_t size)
-{
-	if (!reserve_initialized)
-		return;
-
-	irq_spinlock_lock(&reserve_lock, true);
-	reserve += size;
-	irq_spinlock_unlock(&reserve_lock, true);
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,927 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Slab allocator.
- *
- * The slab allocator is closely modelled after OpenSolaris slab allocator.
- * @see http://www.usenix.org/events/usenix01/full_papers/bonwick/bonwick_html/
- *
- * with the following exceptions:
- * @li empty slabs are deallocated immediately
- *     (in Linux they are kept in linked list, in Solaris ???)
- * @li empty magazines are deallocated when not needed
- *     (in Solaris they are held in linked list in slab cache)
- *
- * Following features are not currently supported but would be easy to do:
- * @li cache coloring
- * @li dynamic magazine growing (different magazine sizes are already
- *     supported, but we would need to adjust allocation strategy)
- *
- * The slab allocator supports per-CPU caches ('magazines') to facilitate
- * good SMP scaling.
- *
- * When a new object is being allocated, it is first checked, if it is
- * available in a CPU-bound magazine. If it is not found there, it is
- * allocated from a CPU-shared slab - if a partially full one is found,
- * it is used, otherwise a new one is allocated.
- *
- * When an object is being deallocated, it is put to a CPU-bound magazine.
- * If there is no such magazine, a new one is allocated (if this fails,
- * the object is deallocated into slab). If the magazine is full, it is
- * put into cpu-shared list of magazines and a new one is allocated.
- *
- * The CPU-bound magazine is actually a pair of magazines in order to avoid
- * thrashing when somebody is allocating/deallocating 1 item at the magazine
- * size boundary. LIFO order is enforced, which should avoid fragmentation
- * as much as possible.
- *
- * Every cache contains list of full slabs and list of partially full slabs.
- * Empty slabs are immediately freed (thrashing will be avoided because
- * of magazines).
- *
- * The slab information structure is kept inside the data area, if possible.
- * The cache can be marked that it should not use magazines. This is used
- * only for slab related caches to avoid deadlocks and infinite recursion
- * (the slab allocator uses itself for allocating all it's control structures).
- *
- * The slab allocator allocates a lot of space and does not free it. When
- * the frame allocator fails to allocate a frame, it calls slab_reclaim().
- * It tries 'light reclaim' first, then brutal reclaim. The light reclaim
- * releases slabs from cpu-shared magazine-list, until at least 1 slab
- * is deallocated in each cache (this algorithm should probably change).
- * The brutal reclaim removes all cached objects, even from CPU-bound
- * magazines.
- *
- * @todo
- * For better CPU-scaling the magazine allocation strategy should
- * be extended. Currently, if the cache does not have magazine, it asks
- * for non-cpu cached magazine cache to provide one. It might be feasible
- * to add cpu-cached magazine cache (which would allocate it's magazines
- * from non-cpu-cached mag. cache). This would provide a nice per-cpu
- * buffer. The other possibility is to use the per-cache
- * 'empty-magazine-list', which decreases competing for 1 per-system
- * magazine cache.
- *
- * @todo
- * It might be good to add granularity of locks even to slab level,
- * we could then try_spinlock over all partial slabs and thus improve
- * scalability even on slab level.
- *
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <synch/spinlock.h>
-#include <mm/slab.h>
-#include <adt/list.h>
-#include <memw.h>
-#include <align.h>
-#include <mm/frame.h>
-#include <config.h>
-#include <stdio.h>
-#include <arch.h>
-#include <panic.h>
-#include <bitops.h>
-#include <macros.h>
-#include <cpu.h>
-#include <stdlib.h>
-
-IRQ_SPINLOCK_STATIC_INITIALIZE(slab_cache_lock);
-static LIST_INITIALIZE(slab_cache_list);
-
-/** Magazine cache */
-static slab_cache_t mag_cache;
-
-/** Cache for cache descriptors */
-static slab_cache_t slab_cache_cache;
-
-/** Cache for per-CPU magazines of caches */
-static slab_cache_t slab_mag_cache;
-
-/** Cache for external slab descriptors
- * This time we want per-cpu cache, so do not make it static
- * - using slab for internal slab structures will not deadlock,
- *   as all slab structures are 'small' - control structures of
- *   their caches do not require further allocation
- */
-static slab_cache_t *slab_extern_cache;
-
-/** Slab descriptor */
-typedef struct {
-	slab_cache_t *cache;  /**< Pointer to parent cache. */
-	link_t link;          /**< List of full/partial slabs. */
-	void *start;          /**< Start address of first available item. */
-	size_t available;     /**< Count of available items in this slab. */
-	size_t nextavail;     /**< The index of next available item. */
-} slab_t;
-
-#ifdef CONFIG_DEBUG
-static unsigned int _slab_initialized = 0;
-#endif
-
-/*
- * Slab allocation functions
- */
-
-/** Allocate frames for slab space and initialize
- *
- */
-_NO_TRACE static slab_t *slab_space_alloc(slab_cache_t *cache,
-    unsigned int flags)
-{
-	size_t zone = 0;
-
-	uintptr_t data_phys =
-	    frame_alloc_generic(cache->frames, FRAME_LOWMEM | flags, 0, &zone);
-	if (!data_phys)
-		return NULL;
-
-	void *data = (void *) PA2KA(data_phys);
-
-	slab_t *slab;
-	size_t fsize;
-
-	if (!(cache->flags & SLAB_CACHE_SLINSIDE)) {
-		slab = slab_alloc(slab_extern_cache, flags);
-		if (!slab) {
-			frame_free(KA2PA(data), cache->frames);
-			return NULL;
-		}
-	} else {
-		fsize = FRAMES2SIZE(cache->frames);
-		slab = data + fsize - sizeof(*slab);
-	}
-
-	/* Fill in slab structures */
-	size_t i;
-	for (i = 0; i < cache->frames; i++)
-		frame_set_parent(ADDR2PFN(KA2PA(data)) + i, slab, zone);
-
-	slab->start = data;
-	slab->available = cache->objects;
-	slab->nextavail = 0;
-	slab->cache = cache;
-
-	for (i = 0; i < cache->objects; i++)
-		*((size_t *) (slab->start + i * cache->size)) = i + 1;
-
-	atomic_inc(&cache->allocated_slabs);
-	return slab;
-}
-
-/** Deallocate space associated with slab
- *
- * @return number of freed frames
- *
- */
-_NO_TRACE static size_t slab_space_free(slab_cache_t *cache, slab_t *slab)
-{
-	frame_free(KA2PA(slab->start), slab->cache->frames);
-	if (!(cache->flags & SLAB_CACHE_SLINSIDE))
-		slab_free(slab_extern_cache, slab);
-
-	atomic_dec(&cache->allocated_slabs);
-
-	return cache->frames;
-}
-
-/** Map object to slab structure */
-_NO_TRACE static slab_t *obj2slab(void *obj)
-{
-	return (slab_t *) frame_get_parent(ADDR2PFN(KA2PA(obj)), 0);
-}
-
-/*
- * Slab functions
- */
-
-/** Return object to slab and call a destructor
- *
- * @param slab If the caller knows directly slab of the object, otherwise NULL
- *
- * @return Number of freed pages
- *
- */
-_NO_TRACE static size_t slab_obj_destroy(slab_cache_t *cache, void *obj,
-    slab_t *slab)
-{
-	if (!slab)
-		slab = obj2slab(obj);
-
-	assert(slab->cache == cache);
-
-	size_t freed = 0;
-
-	if (cache->destructor)
-		freed = cache->destructor(obj);
-
-	irq_spinlock_lock(&cache->slablock, true);
-	assert(slab->available < cache->objects);
-
-	*((size_t *) obj) = slab->nextavail;
-	slab->nextavail = (obj - slab->start) / cache->size;
-	slab->available++;
-
-	/* Move it to correct list */
-	if (slab->available == cache->objects) {
-		/* Free associated memory */
-		list_remove(&slab->link);
-		irq_spinlock_unlock(&cache->slablock, true);
-
-		return freed + slab_space_free(cache, slab);
-	} else if (slab->available == 1) {
-		/* It was in full, move to partial */
-		list_remove(&slab->link);
-		list_prepend(&slab->link, &cache->partial_slabs);
-	}
-
-	irq_spinlock_unlock(&cache->slablock, true);
-	return freed;
-}
-
-/** Take new object from slab or create new if needed
- *
- * @return Object address or null
- *
- */
-_NO_TRACE static void *slab_obj_create(slab_cache_t *cache, unsigned int flags)
-{
-	irq_spinlock_lock(&cache->slablock, true);
-
-	slab_t *slab;
-
-	if (list_empty(&cache->partial_slabs)) {
-		/*
-		 * Allow recursion and reclaiming
-		 * - this should work, as the slab control structures
-		 *   are small and do not need to allocate with anything
-		 *   other than frame_alloc when they are allocating,
-		 *   that's why we should get recursion at most 1-level deep
-		 *
-		 */
-		irq_spinlock_unlock(&cache->slablock, true);
-		slab = slab_space_alloc(cache, flags);
-		if (!slab)
-			return NULL;
-
-		irq_spinlock_lock(&cache->slablock, true);
-	} else {
-		slab = list_get_instance(list_first(&cache->partial_slabs),
-		    slab_t, link);
-		list_remove(&slab->link);
-	}
-
-	void *obj = slab->start + slab->nextavail * cache->size;
-	slab->nextavail = *((size_t *) obj);
-	slab->available--;
-
-	if (!slab->available)
-		list_prepend(&slab->link, &cache->full_slabs);
-	else
-		list_prepend(&slab->link, &cache->partial_slabs);
-
-	irq_spinlock_unlock(&cache->slablock, true);
-
-	if ((cache->constructor) && (cache->constructor(obj, flags) != EOK)) {
-		/* Bad, bad, construction failed */
-		slab_obj_destroy(cache, obj, slab);
-		return NULL;
-	}
-
-	return obj;
-}
-
-/*
- * CPU-Cache slab functions
- */
-
-/** Find a full magazine in cache, take it from list and return it
- *
- * @param first If true, return first, else last mag.
- *
- */
-_NO_TRACE static slab_magazine_t *get_mag_from_cache(slab_cache_t *cache,
-    bool first)
-{
-	slab_magazine_t *mag = NULL;
-	link_t *cur;
-
-	irq_spinlock_lock(&cache->maglock, true);
-	if (!list_empty(&cache->magazines)) {
-		if (first)
-			cur = list_first(&cache->magazines);
-		else
-			cur = list_last(&cache->magazines);
-
-		mag = list_get_instance(cur, slab_magazine_t, link);
-		list_remove(&mag->link);
-		atomic_dec(&cache->magazine_counter);
-	}
-	irq_spinlock_unlock(&cache->maglock, true);
-
-	return mag;
-}
-
-/** Prepend magazine to magazine list in cache
- *
- */
-_NO_TRACE static void put_mag_to_cache(slab_cache_t *cache,
-    slab_magazine_t *mag)
-{
-	irq_spinlock_lock(&cache->maglock, true);
-
-	list_prepend(&mag->link, &cache->magazines);
-	atomic_inc(&cache->magazine_counter);
-
-	irq_spinlock_unlock(&cache->maglock, true);
-}
-
-/** Free all objects in magazine and free memory associated with magazine
- *
- * @return Number of freed pages
- *
- */
-_NO_TRACE static size_t magazine_destroy(slab_cache_t *cache,
-    slab_magazine_t *mag)
-{
-	size_t i;
-	size_t frames = 0;
-
-	for (i = 0; i < mag->busy; i++) {
-		frames += slab_obj_destroy(cache, mag->objs[i], NULL);
-		atomic_dec(&cache->cached_objs);
-	}
-
-	slab_free(&mag_cache, mag);
-
-	return frames;
-}
-
-/** Find full magazine, set it as current and return it
- *
- */
-_NO_TRACE static slab_magazine_t *get_full_current_mag(slab_cache_t *cache)
-{
-	slab_magazine_t *cmag = cache->mag_cache[CPU->id].current;
-	slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
-
-	assert(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
-
-	if (cmag) { /* First try local CPU magazines */
-		if (cmag->busy)
-			return cmag;
-
-		if ((lastmag) && (lastmag->busy)) {
-			cache->mag_cache[CPU->id].current = lastmag;
-			cache->mag_cache[CPU->id].last = cmag;
-			return lastmag;
-		}
-	}
-
-	/* Local magazines are empty, import one from magazine list */
-	slab_magazine_t *newmag = get_mag_from_cache(cache, 1);
-	if (!newmag)
-		return NULL;
-
-	if (lastmag)
-		magazine_destroy(cache, lastmag);
-
-	cache->mag_cache[CPU->id].last = cmag;
-	cache->mag_cache[CPU->id].current = newmag;
-
-	return newmag;
-}
-
-/** Try to find object in CPU-cache magazines
- *
- * @return Pointer to object or NULL if not available
- *
- */
-_NO_TRACE static void *magazine_obj_get(slab_cache_t *cache)
-{
-	if (!CPU)
-		return NULL;
-
-	irq_spinlock_lock(&cache->mag_cache[CPU->id].lock, true);
-
-	slab_magazine_t *mag = get_full_current_mag(cache);
-	if (!mag) {
-		irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
-		return NULL;
-	}
-
-	void *obj = mag->objs[--mag->busy];
-	irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
-
-	atomic_dec(&cache->cached_objs);
-
-	return obj;
-}
-
-/** Assure that the current magazine is empty, return pointer to it,
- * or NULL if no empty magazine is available and cannot be allocated
- *
- * We have 2 magazines bound to processor.
- * First try the current.
- * If full, try the last.
- * If full, put to magazines list.
- *
- */
-_NO_TRACE static slab_magazine_t *make_empty_current_mag(slab_cache_t *cache)
-{
-	slab_magazine_t *cmag = cache->mag_cache[CPU->id].current;
-	slab_magazine_t *lastmag = cache->mag_cache[CPU->id].last;
-
-	assert(irq_spinlock_locked(&cache->mag_cache[CPU->id].lock));
-
-	if (cmag) {
-		if (cmag->busy < cmag->size)
-			return cmag;
-
-		if ((lastmag) && (lastmag->busy < lastmag->size)) {
-			cache->mag_cache[CPU->id].last = cmag;
-			cache->mag_cache[CPU->id].current = lastmag;
-			return lastmag;
-		}
-	}
-
-	/* current | last are full | nonexistent, allocate new */
-
-	/*
-	 * We do not want to sleep just because of caching,
-	 * especially we do not want reclaiming to start, as
-	 * this would deadlock.
-	 *
-	 */
-	slab_magazine_t *newmag = slab_alloc(&mag_cache,
-	    FRAME_ATOMIC | FRAME_NO_RECLAIM);
-	if (!newmag)
-		return NULL;
-
-	newmag->size = SLAB_MAG_SIZE;
-	newmag->busy = 0;
-
-	/* Flush last to magazine list */
-	if (lastmag)
-		put_mag_to_cache(cache, lastmag);
-
-	/* Move current as last, save new as current */
-	cache->mag_cache[CPU->id].last = cmag;
-	cache->mag_cache[CPU->id].current = newmag;
-
-	return newmag;
-}
-
-/** Put object into CPU-cache magazine
- *
- * @return 0 on success, -1 on no memory
- *
- */
-_NO_TRACE static int magazine_obj_put(slab_cache_t *cache, void *obj)
-{
-	if (!CPU)
-		return -1;
-
-	irq_spinlock_lock(&cache->mag_cache[CPU->id].lock, true);
-
-	slab_magazine_t *mag = make_empty_current_mag(cache);
-	if (!mag) {
-		irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
-		return -1;
-	}
-
-	mag->objs[mag->busy++] = obj;
-
-	irq_spinlock_unlock(&cache->mag_cache[CPU->id].lock, true);
-
-	atomic_inc(&cache->cached_objs);
-
-	return 0;
-}
-
-/*
- * Slab cache functions
- */
-
-/** Return number of objects that fit in certain cache size
- *
- */
-_NO_TRACE static size_t comp_objects(slab_cache_t *cache)
-{
-	if (cache->flags & SLAB_CACHE_SLINSIDE)
-		return (FRAMES2SIZE(cache->frames) - sizeof(slab_t)) /
-		    cache->size;
-	else
-		return FRAMES2SIZE(cache->frames) / cache->size;
-}
-
-/** Return wasted space in slab
- *
- */
-_NO_TRACE static size_t badness(slab_cache_t *cache)
-{
-	size_t objects = comp_objects(cache);
-	size_t ssize = FRAMES2SIZE(cache->frames);
-
-	if (cache->flags & SLAB_CACHE_SLINSIDE)
-		ssize -= sizeof(slab_t);
-
-	return ssize - objects * cache->size;
-}
-
-/** Initialize mag_cache structure in slab cache
- *
- */
-_NO_TRACE static bool make_magcache(slab_cache_t *cache)
-{
-	assert(_slab_initialized >= 2);
-
-	cache->mag_cache = slab_alloc(&slab_mag_cache, FRAME_ATOMIC);
-	if (!cache->mag_cache)
-		return false;
-
-	size_t i;
-	for (i = 0; i < config.cpu_count; i++) {
-		memsetb(&cache->mag_cache[i], sizeof(cache->mag_cache[i]), 0);
-		irq_spinlock_initialize(&cache->mag_cache[i].lock,
-		    "slab.cache.mag_cache[].lock");
-	}
-
-	return true;
-}
-
-/** Initialize allocated memory as a slab cache
- *
- */
-_NO_TRACE static void _slab_cache_create(slab_cache_t *cache, const char *name,
-    size_t size, size_t align, errno_t (*constructor)(void *obj,
-    unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
-{
-	assert(size > 0);
-
-	memsetb(cache, sizeof(*cache), 0);
-	cache->name = name;
-
-	if (align < sizeof(sysarg_t))
-		align = sizeof(sysarg_t);
-
-	size = ALIGN_UP(size, align);
-
-	cache->size = size;
-	cache->constructor = constructor;
-	cache->destructor = destructor;
-	cache->flags = flags;
-
-	list_initialize(&cache->full_slabs);
-	list_initialize(&cache->partial_slabs);
-	list_initialize(&cache->magazines);
-
-	irq_spinlock_initialize(&cache->slablock, "slab.cache.slablock");
-	irq_spinlock_initialize(&cache->maglock, "slab.cache.maglock");
-
-	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
-		(void) make_magcache(cache);
-
-	/* Compute slab sizes, object counts in slabs etc. */
-	if (cache->size < SLAB_INSIDE_SIZE)
-		cache->flags |= SLAB_CACHE_SLINSIDE;
-
-	/* Minimum slab frames */
-	cache->frames = SIZE2FRAMES(cache->size);
-
-	while (badness(cache) > SLAB_MAX_BADNESS(cache))
-		cache->frames <<= 1;
-
-	cache->objects = comp_objects(cache);
-
-	/* If info fits in, put it inside */
-	if (badness(cache) > sizeof(slab_t))
-		cache->flags |= SLAB_CACHE_SLINSIDE;
-
-	/* Add cache to cache list */
-	irq_spinlock_lock(&slab_cache_lock, true);
-	list_append(&cache->link, &slab_cache_list);
-	irq_spinlock_unlock(&slab_cache_lock, true);
-}
-
-/** Create slab cache
- *
- */
-slab_cache_t *slab_cache_create(const char *name, size_t size, size_t align,
-    errno_t (*constructor)(void *obj, unsigned int kmflag),
-    size_t (*destructor)(void *obj), unsigned int flags)
-{
-	slab_cache_t *cache = slab_alloc(&slab_cache_cache, FRAME_ATOMIC);
-	if (!cache)
-		panic("Not enough memory to allocate slab cache %s.", name);
-
-	_slab_cache_create(cache, name, size, align, constructor, destructor,
-	    flags);
-
-	return cache;
-}
-
-/** Reclaim space occupied by objects that are already free
- *
- * @param flags If contains SLAB_RECLAIM_ALL, do aggressive freeing
- *
- * @return Number of freed pages
- *
- */
-_NO_TRACE static size_t _slab_reclaim(slab_cache_t *cache, unsigned int flags)
-{
-	if (cache->flags & SLAB_CACHE_NOMAGAZINE)
-		return 0; /* Nothing to do */
-
-	/*
-	 * We count up to original magazine count to avoid
-	 * endless loop
-	 */
-	size_t magcount = atomic_load(&cache->magazine_counter);
-
-	slab_magazine_t *mag;
-	size_t frames = 0;
-
-	while ((magcount--) && (mag = get_mag_from_cache(cache, 0))) {
-		frames += magazine_destroy(cache, mag);
-		if ((!(flags & SLAB_RECLAIM_ALL)) && (frames))
-			break;
-	}
-
-	if (flags & SLAB_RECLAIM_ALL) {
-		/* Free cpu-bound magazines */
-		/* Destroy CPU magazines */
-		size_t i;
-		for (i = 0; i < config.cpu_count; i++) {
-			irq_spinlock_lock(&cache->mag_cache[i].lock, true);
-
-			mag = cache->mag_cache[i].current;
-			if (mag)
-				frames += magazine_destroy(cache, mag);
-			cache->mag_cache[i].current = NULL;
-
-			mag = cache->mag_cache[i].last;
-			if (mag)
-				frames += magazine_destroy(cache, mag);
-			cache->mag_cache[i].last = NULL;
-
-			irq_spinlock_unlock(&cache->mag_cache[i].lock, true);
-		}
-	}
-
-	return frames;
-}
-
-/** Return object to cache, use slab if known
- *
- */
-_NO_TRACE static void _slab_free(slab_cache_t *cache, void *obj, slab_t *slab)
-{
-	if (!obj)
-		return;
-
-	ipl_t ipl = interrupts_disable();
-
-	if ((cache->flags & SLAB_CACHE_NOMAGAZINE) ||
-	    (magazine_obj_put(cache, obj)))
-		slab_obj_destroy(cache, obj, slab);
-
-	interrupts_restore(ipl);
-	atomic_dec(&cache->allocated_objs);
-}
-
-/** Check that there are no slabs and remove cache from system
- *
- */
-void slab_cache_destroy(slab_cache_t *cache)
-{
-	/*
-	 * First remove cache from link, so that we don't need
-	 * to disable interrupts later
-	 *
-	 */
-	irq_spinlock_lock(&slab_cache_lock, true);
-	list_remove(&cache->link);
-	irq_spinlock_unlock(&slab_cache_lock, true);
-
-	/*
-	 * Do not lock anything, we assume the software is correct and
-	 * does not touch the cache when it decides to destroy it
-	 *
-	 */
-
-	/* Destroy all magazines */
-	_slab_reclaim(cache, SLAB_RECLAIM_ALL);
-
-	/* All slabs must be empty */
-	if ((!list_empty(&cache->full_slabs)) ||
-	    (!list_empty(&cache->partial_slabs)))
-		panic("Destroying cache that is not empty.");
-
-	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE) && cache->mag_cache) {
-		slab_free(&slab_mag_cache, cache->mag_cache);
-	}
-
-	slab_free(&slab_cache_cache, cache);
-}
-
-/** Allocate new object from cache - if no flags given, always returns memory
- *
- */
-void *slab_alloc(slab_cache_t *cache, unsigned int flags)
-{
-	/* Disable interrupts to avoid deadlocks with interrupt handlers */
-	ipl_t ipl = interrupts_disable();
-
-	void *result = NULL;
-
-	if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
-		result = magazine_obj_get(cache);
-
-	if (!result)
-		result = slab_obj_create(cache, flags);
-
-	interrupts_restore(ipl);
-
-	if (result)
-		atomic_inc(&cache->allocated_objs);
-
-	return result;
-}
-
-/** Return slab object to cache
- *
- */
-void slab_free(slab_cache_t *cache, void *obj)
-{
-	_slab_free(cache, obj, NULL);
-}
-
-/** Go through all caches and reclaim what is possible */
-size_t slab_reclaim(unsigned int flags)
-{
-	irq_spinlock_lock(&slab_cache_lock, true);
-
-	size_t frames = 0;
-	list_foreach(slab_cache_list, link, slab_cache_t, cache) {
-		frames += _slab_reclaim(cache, flags);
-	}
-
-	irq_spinlock_unlock(&slab_cache_lock, true);
-
-	return frames;
-}
-
-/* Print list of caches */
-void slab_print_list(void)
-{
-	printf("[cache name      ] [size  ] [pages ] [obj/pg] [slabs ]"
-	    " [cached] [alloc ] [ctl]\n");
-
-	size_t skip = 0;
-	while (true) {
-		/*
-		 * We must not hold the slab_cache_lock spinlock when printing
-		 * the statistics. Otherwise we can easily deadlock if the print
-		 * needs to allocate memory.
-		 *
-		 * Therefore, we walk through the slab cache list, skipping some
-		 * amount of already processed caches during each iteration and
-		 * gathering statistics about the first unprocessed cache. For
-		 * the sake of printing the statistics, we realese the
-		 * slab_cache_lock and reacquire it afterwards. Then the walk
-		 * starts again.
-		 *
-		 * This limits both the efficiency and also accuracy of the
-		 * obtained statistics. The efficiency is decreased because the
-		 * time complexity of the algorithm is quadratic instead of
-		 * linear. The accuracy is impacted because we drop the lock
-		 * after processing one cache. If there is someone else
-		 * manipulating the cache list, we might omit an arbitrary
-		 * number of caches or process one cache multiple times.
-		 * However, we don't bleed for this algorithm for it is only
-		 * statistics.
-		 */
-
-		irq_spinlock_lock(&slab_cache_lock, true);
-
-		link_t *cur = list_first(&slab_cache_list);
-		size_t i = 0;
-		while (i < skip && cur != NULL) {
-			i++;
-			cur = list_next(cur, &slab_cache_list);
-		}
-
-		if (cur == NULL) {
-			irq_spinlock_unlock(&slab_cache_lock, true);
-			break;
-		}
-
-		skip++;
-
-		slab_cache_t *cache = list_get_instance(cur, slab_cache_t, link);
-
-		const char *name = cache->name;
-		size_t frames = cache->frames;
-		size_t size = cache->size;
-		size_t objects = cache->objects;
-		long allocated_slabs = atomic_load(&cache->allocated_slabs);
-		long cached_objs = atomic_load(&cache->cached_objs);
-		long allocated_objs = atomic_load(&cache->allocated_objs);
-		unsigned int flags = cache->flags;
-
-		irq_spinlock_unlock(&slab_cache_lock, true);
-
-		printf("%-18s %8zu %8zu %8zu %8ld %8ld %8ld %-5s\n",
-		    name, size, frames, objects, allocated_slabs,
-		    cached_objs, allocated_objs,
-		    flags & SLAB_CACHE_SLINSIDE ? "in" : "out");
-	}
-}
-
-void slab_cache_init(void)
-{
-	/* Initialize magazine cache */
-	_slab_cache_create(&mag_cache, "slab_magazine_t",
-	    sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void *),
-	    sizeof(uintptr_t), NULL, NULL, SLAB_CACHE_NOMAGAZINE |
-	    SLAB_CACHE_SLINSIDE);
-
-	/* Initialize slab_cache cache */
-	_slab_cache_create(&slab_cache_cache, "slab_cache_cache",
-	    sizeof(slab_cache_cache), sizeof(uintptr_t), NULL, NULL,
-	    SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
-
-	/* Initialize external slab cache */
-	slab_extern_cache = slab_cache_create("slab_t", sizeof(slab_t), 0,
-	    NULL, NULL, SLAB_CACHE_SLINSIDE | SLAB_CACHE_MAGDEFERRED);
-
-#ifdef CONFIG_DEBUG
-	_slab_initialized = 1;
-#endif
-}
-
-/** Enable cpu_cache
- *
- * Kernel calls this function, when it knows the real number of
- * processors. Allocate slab for cpucache and enable it on all
- * existing slabs that are SLAB_CACHE_MAGDEFERRED
- *
- */
-void slab_enable_cpucache(void)
-{
-#ifdef CONFIG_DEBUG
-	_slab_initialized = 2;
-#endif
-
-	_slab_cache_create(&slab_mag_cache, "slab_mag_cache",
-	    sizeof(slab_mag_cache_t) * config.cpu_count, sizeof(uintptr_t),
-	    NULL, NULL, SLAB_CACHE_NOMAGAZINE | SLAB_CACHE_SLINSIDE);
-
-	irq_spinlock_lock(&slab_cache_lock, false);
-
-	list_foreach(slab_cache_list, link, slab_cache_t, slab) {
-		if ((slab->flags & SLAB_CACHE_MAGDEFERRED) !=
-		    SLAB_CACHE_MAGDEFERRED)
-			continue;
-
-		(void) make_magcache(slab);
-		slab->flags &= ~SLAB_CACHE_MAGDEFERRED;
-	}
-
-	irq_spinlock_unlock(&slab_cache_lock, false);
-}
-
-/** @}
- */
Index: rnel/generic/src/mm/tlb.c
===================================================================
--- kernel/generic/src/mm/tlb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,198 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_mm
- * @{
- */
-
-/**
- * @file
- * @brief Generic TLB shootdown algorithm.
- *
- * The algorithm implemented here is based on the CMU TLB shootdown
- * algorithm and is further simplified (e.g. all CPUs receive all TLB
- * shootdown messages).
- */
-
-#include <mm/tlb.h>
-#include <mm/asid.h>
-#include <arch/mm/tlb.h>
-#include <assert.h>
-#include <smp/ipi.h>
-#include <synch/spinlock.h>
-#include <atomic.h>
-#include <arch/interrupt.h>
-#include <config.h>
-#include <arch.h>
-#include <panic.h>
-#include <cpu.h>
-
-void tlb_init(void)
-{
-	tlb_arch_init();
-}
-
-#ifdef CONFIG_SMP
-
-/**
- * This lock is used for synchronisation between sender and
- * recipients of TLB shootdown message. It must be acquired
- * before CPU structure lock.
- *
- */
-IRQ_SPINLOCK_STATIC_INITIALIZE(tlblock);
-
-/** Send TLB shootdown message.
- *
- * This function attempts to deliver TLB shootdown message
- * to all other processors.
- *
- * @param type  Type describing scope of shootdown.
- * @param asid  Address space, if required by type.
- * @param page  Virtual page address, if required by type.
- * @param count Number of pages, if required by type.
- *
- * @return The interrupt priority level as it existed prior to this call.
- *
- */
-ipl_t tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid,
-    uintptr_t page, size_t count)
-{
-	ipl_t ipl = interrupts_disable();
-	CPU->tlb_active = false;
-	irq_spinlock_lock(&tlblock, false);
-
-	size_t i;
-	for (i = 0; i < config.cpu_count; i++) {
-		if (i == CPU->id)
-			continue;
-
-		cpu_t *cpu = &cpus[i];
-
-		irq_spinlock_lock(&cpu->tlb_lock, false);
-		if (cpu->tlb_messages_count == TLB_MESSAGE_QUEUE_LEN) {
-			/*
-			 * The message queue is full.
-			 * Erase the queue and store one TLB_INVL_ALL message.
-			 */
-			cpu->tlb_messages_count = 1;
-			cpu->tlb_messages[0].type = TLB_INVL_ALL;
-			cpu->tlb_messages[0].asid = ASID_INVALID;
-			cpu->tlb_messages[0].page = 0;
-			cpu->tlb_messages[0].count = 0;
-		} else {
-			/*
-			 * Enqueue the message.
-			 */
-			size_t idx = cpu->tlb_messages_count++;
-			cpu->tlb_messages[idx].type = type;
-			cpu->tlb_messages[idx].asid = asid;
-			cpu->tlb_messages[idx].page = page;
-			cpu->tlb_messages[idx].count = count;
-		}
-		irq_spinlock_unlock(&cpu->tlb_lock, false);
-	}
-
-	tlb_shootdown_ipi_send();
-
-busy_wait:
-	for (i = 0; i < config.cpu_count; i++) {
-		if (cpus[i].tlb_active)
-			goto busy_wait;
-	}
-
-	return ipl;
-}
-
-/** Finish TLB shootdown sequence.
- *
- * @param ipl Previous interrupt priority level.
- *
- */
-void tlb_shootdown_finalize(ipl_t ipl)
-{
-	irq_spinlock_unlock(&tlblock, false);
-	CPU->tlb_active = true;
-	interrupts_restore(ipl);
-}
-
-void tlb_shootdown_ipi_send(void)
-{
-	ipi_broadcast(VECTOR_TLB_SHOOTDOWN_IPI);
-}
-
-/** Receive TLB shootdown message.
- *
- */
-void tlb_shootdown_ipi_recv(void)
-{
-	assert(CPU);
-
-	CPU->tlb_active = false;
-	irq_spinlock_lock(&tlblock, false);
-	irq_spinlock_unlock(&tlblock, false);
-
-	irq_spinlock_lock(&CPU->tlb_lock, false);
-	assert(CPU->tlb_messages_count <= TLB_MESSAGE_QUEUE_LEN);
-
-	size_t i;
-	for (i = 0; i < CPU->tlb_messages_count; i++) {
-		tlb_invalidate_type_t type = CPU->tlb_messages[i].type;
-		asid_t asid = CPU->tlb_messages[i].asid;
-		uintptr_t page = CPU->tlb_messages[i].page;
-		size_t count = CPU->tlb_messages[i].count;
-
-		switch (type) {
-		case TLB_INVL_ALL:
-			tlb_invalidate_all();
-			break;
-		case TLB_INVL_ASID:
-			tlb_invalidate_asid(asid);
-			break;
-		case TLB_INVL_PAGES:
-			assert(count);
-			tlb_invalidate_pages(asid, page, count);
-			break;
-		default:
-			panic("Unknown type (%d).", type);
-			break;
-		}
-
-		if (type == TLB_INVL_ALL)
-			break;
-	}
-
-	CPU->tlb_messages_count = 0;
-	irq_spinlock_unlock(&CPU->tlb_lock, false);
-	CPU->tlb_active = true;
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/generic/src/printf/printf.c
===================================================================
--- kernel/generic/src/printf/printf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <print.h>
-#include <stdarg.h>
-
-int printf(const char *fmt, ...)
-{
-	int ret;
-	va_list args;
-
-	va_start(args, fmt);
-
-	ret = vprintf(fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-/** @}
- */
Index: rnel/generic/src/printf/vprintf.c
===================================================================
--- kernel/generic/src/printf/vprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <arch/asm.h>
-#include <console/console.h>
-#include <print.h>
-#include <printf_core.h>
-#include <str.h>
-#include <synch/spinlock.h>
-#include <typedefs.h>
-
-static errno_t vprintf_str_write(const char *str, size_t size, void *data)
-{
-	putstr(str, size);
-	return EOK;
-}
-
-int puts(const char *str)
-{
-	size_t n = str_size(str);
-	putstr(str, n);
-	return n;
-}
-
-int vprintf(const char *fmt, va_list ap)
-{
-	printf_spec_t ps = {
-		vprintf_str_write,
-		NULL
-	};
-
-	console_lock();
-	int ret = printf_core(fmt, &ps, ap);
-	console_unlock();
-	return ret;
-}
-
-/** @}
- */
Index: rnel/generic/src/proc/current.c
===================================================================
--- kernel/generic/src/proc/current.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-
-/**
- * @file
- * @brief CURRENT structure functions.
- *
- * This file contains functions to manage the CURRENT structure.
- * The CURRENT structure exists at the base address of every kernel
- * stack and carries information about current settings
- * (e.g. current CPU, current thread, task and address space
- * and current preemption counter).
- */
-
-#include <arch.h>
-#include <assert.h>
-
-/** Initialize CURRENT structure
- *
- * Initialize CURRENT structure passed as argument.
- *
- * @param the CURRENT structure to be initialized.
- *
- */
-void current_initialize(current_t *the)
-{
-	the->preemption = 0;
-	the->mutex_locks = 0;
-	the->cpu = NULL;
-	the->thread = NULL;
-	the->task = NULL;
-	the->as = NULL;
-	the->magic = MAGIC;
-}
-
-/** Copy CURRENT structure
- *
- * Copy the source CURRENT structure to the destination CURRENT structure.
- *
- * @param src The source CURRENT structure.
- * @param dst The destination CURRENT structure.
- *
- */
-_NO_TRACE void current_copy(current_t *src, current_t *dst)
-{
-	assert(src->magic == MAGIC);
-	*dst = *src;
-}
-
-/** @}
- */
Index: rnel/generic/src/proc/program.c
===================================================================
--- kernel/generic/src/proc/program.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-
-/**
- * @file
- * @brief Running userspace programs.
- */
-
-#include <main/uinit.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <mm/as.h>
-#include <stdlib.h>
-#include <arch.h>
-#include <adt/list.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <security/perm.h>
-#include <lib/elf_load.h>
-#include <str.h>
-#include <str_error.h>
-#include <log.h>
-#include <syscall/copy.h>
-#include <proc/program.h>
-#include <userspace.h>
-
-/**
- * Points to the binary image used as the program loader. All non-initial
- * tasks are created from this executable image.
- */
-void *program_loader = NULL;
-
-/** Create a program using an existing address space.
- *
- * @param as         Address space containing a binary program image.
- * @param entry_addr Program entry-point address in program address space.
- * @param name       Name to set for the program's task.
- * @param prg        Buffer for storing program information.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create(as_t *as, uspace_addr_t entry_addr, char *name, program_t *prg)
-{
-	uinit_arg_t *kernel_uarg = malloc(sizeof(uinit_arg_t));
-	if (!kernel_uarg)
-		return ENOMEM;
-
-	prg->loader_status = EOK;
-	prg->task = task_create(as, name);
-	if (!prg->task) {
-		free(kernel_uarg);
-		return ELIMIT;
-	}
-
-	/*
-	 * Create the stack address space area.
-	 */
-	uintptr_t virt = (uintptr_t) AS_AREA_ANY;
-	uintptr_t bound = USER_ADDRESS_SPACE_END - (STACK_SIZE_USER - 1);
-
-	/* Adjust bound to create space for the desired guard page. */
-	bound -= PAGE_SIZE;
-
-	as_area_t *area = as_area_create(as,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
-	    AS_AREA_LATE_RESERVE, STACK_SIZE_USER, AS_AREA_ATTR_NONE,
-	    &anon_backend, NULL, &virt, bound);
-	if (!area) {
-		free(kernel_uarg);
-		task_release(prg->task);
-		prg->task = NULL;
-		return ENOMEM;
-	}
-
-	kernel_uarg->pc = entry_addr;
-	kernel_uarg->sp = arch_get_initial_sp(virt, STACK_SIZE_USER);
-
-	/*
-	 * Create the main thread.
-	 */
-	prg->main_thread = thread_create(uinit, kernel_uarg, prg->task,
-	    THREAD_FLAG_USPACE, "uinit");
-	if (!prg->main_thread) {
-		free(kernel_uarg);
-		as_area_destroy(as, virt);
-		task_release(prg->task);
-		prg->task = NULL;
-		return ELIMIT;
-	}
-
-	return EOK;
-}
-
-/** Parse an executable image in the kernel memory.
- *
- * If the image belongs to a program loader, it is registered as such,
- * (and *task is set to NULL). Otherwise a task is created from the
- * executable image. The task is returned in *task.
- *
- * @param[in]  image_addr Address of an executable program image.
- * @param[in]  name       Name to set for the program's task.
- * @param[out] prg        Buffer for storing program info.
- *                        If image_addr points to a loader image,
- *                        prg->task will be set to NULL and EOK
- *                        will be returned.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create_from_image(void *image_addr, size_t image_size, char *name, program_t *prg)
-{
-	as_t *as = as_create(0);
-	if (!as)
-		return ENOMEM;
-
-	prg->loader_status = elf_load((elf_header_t *) image_addr, as);
-	if (prg->loader_status != EOK) {
-		as_release(as);
-		prg->task = NULL;
-		prg->main_thread = NULL;
-		return ENOTSUP;
-	}
-
-	errno_t rc = program_create(as, ((elf_header_t *) image_addr)->e_entry,
-	    name, prg);
-
-	if (rc == EOK) {
-		prg->task->debug_sections = calloc(1, sizeof(debug_sections_t));
-		if (prg->task->debug_sections != NULL)
-			*prg->task->debug_sections = get_debug_sections(image_addr, image_size);
-	}
-
-	return rc;
-}
-
-/** Create a task from the program loader image.
- *
- * @param prg  Buffer for storing program info.
- * @param name Name to set for the program's task.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t program_create_loader(program_t *prg, char *name)
-{
-	as_t *as = as_create(0);
-	if (!as)
-		return ENOMEM;
-
-	void *loader = program_loader;
-	if (!loader) {
-		as_release(as);
-		log(LF_OTHER, LVL_ERROR,
-		    "Cannot spawn loader as none was registered");
-		return ENOENT;
-	}
-
-	prg->loader_status = elf_load((elf_header_t *) program_loader, as);
-	if (prg->loader_status != EOK) {
-		as_release(as);
-		log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)",
-		    str_error(prg->loader_status));
-		return prg->loader_status;
-	}
-
-	return program_create(as, ((elf_header_t *) program_loader)->e_entry,
-	    name, prg);
-}
-
-/** Make program ready.
- *
- * Switch program's main thread to the ready state.
- *
- * @param prg Program to make ready.
- *
- */
-void program_ready(program_t *prg)
-{
-	thread_start(prg->main_thread);
-	thread_detach(prg->main_thread);
-	prg->main_thread = NULL;
-}
-
-/** Syscall for creating a new loader instance from userspace.
- *
- * Creates a new task from the program loader image and sets
- * the task name.
- *
- * @param uspace_name Name to set on the new task (typically the same
- *                    as the command used to execute it).
- * @param name_len    Length of the name.
- *
- * @return EOK on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_program_spawn_loader(uspace_ptr_char uspace_name, size_t name_len)
-{
-	/* Cap length of name and copy it from userspace. */
-	if (name_len > TASK_NAME_BUFLEN - 1)
-		name_len = TASK_NAME_BUFLEN - 1;
-
-	char namebuf[TASK_NAME_BUFLEN];
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	namebuf[name_len] = 0;
-
-	/* Spawn the new task. */
-	program_t prg;
-	rc = program_create_loader(&prg, namebuf);
-	if (rc != EOK)
-		return rc;
-
-	// FIXME: control the permissions
-	perm_set(prg.task, perm_get(TASK));
-	program_ready(&prg);
-
-	task_release(prg.task);
-
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,802 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-
-/**
- * @file
- * @brief Scheduler and load balancing.
- *
- * This file contains the scheduler and kcpulb kernel thread which
- * performs load-balancing of per-CPU run queues.
- */
-
-#include <assert.h>
-#include <atomic.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <mm/as.h>
-#include <time/timeout.h>
-#include <time/delay.h>
-#include <arch/asm.h>
-#include <arch/cycle.h>
-#include <atomic.h>
-#include <synch/spinlock.h>
-#include <config.h>
-#include <context.h>
-#include <fpu_context.h>
-#include <halt.h>
-#include <arch.h>
-#include <adt/list.h>
-#include <panic.h>
-#include <cpu.h>
-#include <stdio.h>
-#include <log.h>
-#include <stacktrace.h>
-
-atomic_size_t nrdy;  /**< Number of ready threads in the system. */
-
-#ifdef CONFIG_FPU_LAZY
-void scheduler_fpu_lazy_request(void)
-{
-	fpu_enable();
-
-	/* We need this lock to ensure synchronization with thread destructor. */
-	irq_spinlock_lock(&CPU->fpu_lock, false);
-
-	/* Save old context */
-	thread_t *owner = atomic_load_explicit(&CPU->fpu_owner, memory_order_relaxed);
-	if (owner != NULL) {
-		fpu_context_save(&owner->fpu_context);
-		atomic_store_explicit(&CPU->fpu_owner, NULL, memory_order_relaxed);
-	}
-
-	irq_spinlock_unlock(&CPU->fpu_lock, false);
-
-	if (THREAD->fpu_context_exists) {
-		fpu_context_restore(&THREAD->fpu_context);
-	} else {
-		fpu_init();
-		THREAD->fpu_context_exists = true;
-	}
-
-	atomic_store_explicit(&CPU->fpu_owner, THREAD, memory_order_relaxed);
-}
-#endif /* CONFIG_FPU_LAZY */
-
-/** Initialize scheduler
- *
- * Initialize kernel scheduler.
- *
- */
-void scheduler_init(void)
-{
-}
-
-/** Get thread to be scheduled
- *
- * Get the optimal thread to be scheduled
- * according to thread accounting and scheduler
- * policy.
- *
- * @return Thread to be scheduled.
- *
- */
-static thread_t *try_find_thread(int *rq_index)
-{
-	assert(interrupts_disabled());
-	assert(CPU != NULL);
-
-	if (atomic_load(&CPU->nrdy) == 0)
-		return NULL;
-
-	for (int i = 0; i < RQ_COUNT; i++) {
-		irq_spinlock_lock(&(CPU->rq[i].lock), false);
-		if (CPU->rq[i].n == 0) {
-			/*
-			 * If this queue is empty, try a lower-priority queue.
-			 */
-			irq_spinlock_unlock(&(CPU->rq[i].lock), false);
-			continue;
-		}
-
-		atomic_dec(&CPU->nrdy);
-		atomic_dec(&nrdy);
-		CPU->rq[i].n--;
-
-		/*
-		 * Take the first thread from the queue.
-		 */
-		thread_t *thread = list_get_instance(
-		    list_first(&CPU->rq[i].rq), thread_t, rq_link);
-		list_remove(&thread->rq_link);
-
-		irq_spinlock_unlock(&(CPU->rq[i].lock), false);
-
-		*rq_index = i;
-		return thread;
-	}
-
-	return NULL;
-}
-
-/** Get thread to be scheduled
- *
- * Get the optimal thread to be scheduled
- * according to thread accounting and scheduler
- * policy.
- *
- * @return Thread to be scheduled.
- *
- */
-static thread_t *find_best_thread(int *rq_index)
-{
-	assert(interrupts_disabled());
-	assert(CPU != NULL);
-
-	while (true) {
-		thread_t *thread = try_find_thread(rq_index);
-
-		if (thread != NULL)
-			return thread;
-
-		/*
-		 * For there was nothing to run, the CPU goes to sleep
-		 * until a hardware interrupt or an IPI comes.
-		 * This improves energy saving and hyperthreading.
-		 */
-		CPU_LOCAL->idle = true;
-
-		/*
-		 * Go to sleep with interrupts enabled.
-		 * Ideally, this should be atomic, but this is not guaranteed on
-		 * all platforms yet, so it is possible we will go sleep when
-		 * a thread has just become available.
-		 */
-		cpu_interruptible_sleep();
-	}
-}
-
-static void switch_task(task_t *task)
-{
-	/* If the task stays the same, a lot of work is avoided. */
-	if (TASK == task)
-		return;
-
-	as_t *old_as = AS;
-	as_t *new_as = task->as;
-
-	/* It is possible for two tasks to share one address space. */
-	if (old_as != new_as)
-		as_switch(old_as, new_as);
-
-	if (TASK)
-		task_release(TASK);
-
-	TASK = task;
-
-	task_hold(TASK);
-
-	before_task_runs_arch();
-}
-
-/** Prevent rq starvation
- *
- * Prevent low priority threads from starving in rq's.
- *
- * When the function decides to relink rq's, it reconnects
- * respective pointers so that in result threads with 'pri'
- * greater or equal start are moved to a higher-priority queue.
- *
- * @param start Threshold priority.
- *
- */
-static void relink_rq(int start)
-{
-	assert(interrupts_disabled());
-
-	if (CPU_LOCAL->current_clock_tick < CPU_LOCAL->relink_deadline)
-		return;
-
-	CPU_LOCAL->relink_deadline = CPU_LOCAL->current_clock_tick + NEEDS_RELINK_MAX;
-
-	/* Temporary cache for lists we are moving. */
-	list_t list;
-	list_initialize(&list);
-
-	size_t n = 0;
-
-	/* Move every list (except the one with highest priority) one level up. */
-	for (int i = RQ_COUNT - 1; i > start; i--) {
-		irq_spinlock_lock(&CPU->rq[i].lock, false);
-
-		/* Swap lists. */
-		list_swap(&CPU->rq[i].rq, &list);
-
-		/* Swap number of items. */
-		size_t tmpn = CPU->rq[i].n;
-		CPU->rq[i].n = n;
-		n = tmpn;
-
-		irq_spinlock_unlock(&CPU->rq[i].lock, false);
-	}
-
-	/* Append the contents of rq[start + 1]  to rq[start]. */
-	if (n != 0) {
-		irq_spinlock_lock(&CPU->rq[start].lock, false);
-		list_concat(&CPU->rq[start].rq, &list);
-		CPU->rq[start].n += n;
-		irq_spinlock_unlock(&CPU->rq[start].lock, false);
-	}
-}
-
-/**
- * Do whatever needs to be done with current FPU state before we switch to
- * another thread.
- */
-static void fpu_cleanup(void)
-{
-#if (defined CONFIG_FPU) && (!defined CONFIG_FPU_LAZY)
-	fpu_context_save(&THREAD->fpu_context);
-#endif
-}
-
-/**
- * Set correct FPU state for this thread after switch from another thread.
- */
-static void fpu_restore(void)
-{
-#ifdef CONFIG_FPU_LAZY
-	/*
-	 * The only concurrent modification possible for fpu_owner here is
-	 * another thread changing it from itself to NULL in its destructor.
-	 */
-	thread_t *owner = atomic_load_explicit(&CPU->fpu_owner,
-	    memory_order_relaxed);
-
-	if (THREAD == owner)
-		fpu_enable();
-	else
-		fpu_disable();
-
-#elif defined CONFIG_FPU
-	fpu_enable();
-	if (THREAD->fpu_context_exists)
-		fpu_context_restore(&THREAD->fpu_context);
-	else {
-		fpu_init();
-		THREAD->fpu_context_exists = true;
-	}
-#endif
-}
-
-/** Things to do before we switch to THREAD context.
- */
-static void prepare_to_run_thread(int rq_index)
-{
-	relink_rq(rq_index);
-
-	switch_task(THREAD->task);
-
-	assert(atomic_get_unordered(&THREAD->cpu) == CPU);
-
-	atomic_set_unordered(&THREAD->state, Running);
-	atomic_set_unordered(&THREAD->priority, rq_index);  /* Correct rq index */
-
-	/*
-	 * Clear the stolen flag so that it can be migrated
-	 * when load balancing needs emerge.
-	 */
-	THREAD->stolen = false;
-
-#ifdef SCHEDULER_VERBOSE
-	log(LF_OTHER, LVL_DEBUG,
-	    "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64
-	    ", nrdy=%zu)", CPU->id, THREAD->tid, rq_index,
-	    THREAD->ticks, atomic_load(&CPU->nrdy));
-#endif
-
-	/*
-	 * Some architectures provide late kernel PA2KA(identity)
-	 * mapping in a page fault handler. However, the page fault
-	 * handler uses the kernel stack of the running thread and
-	 * therefore cannot be used to map it. The kernel stack, if
-	 * necessary, is to be mapped in before_thread_runs(). This
-	 * function must be executed before the switch to the new stack.
-	 */
-	before_thread_runs_arch();
-
-#ifdef CONFIG_UDEBUG
-	if (atomic_get_unordered(&THREAD->btrace)) {
-		istate_t *istate = THREAD->udebug.uspace_state;
-		if (istate != NULL) {
-			printf("Thread %" PRIu64 " stack trace:\n", THREAD->tid);
-			stack_trace_istate(istate);
-		} else {
-			printf("Thread %" PRIu64 " interrupt state not available\n", THREAD->tid);
-		}
-
-		atomic_set_unordered(&THREAD->btrace, false);
-	}
-#endif
-
-	fpu_restore();
-
-	/* Time allocation in microseconds. */
-	uint64_t time_to_run = (rq_index + 1) * 10000;
-
-	/* Set the time of next preemption. */
-	CPU_LOCAL->preempt_deadline =
-	    CPU_LOCAL->current_clock_tick + us2ticks(time_to_run);
-
-	/* Save current CPU cycle */
-	THREAD->last_cycle = get_cycle();
-}
-
-static void add_to_rq(thread_t *thread, cpu_t *cpu, int i)
-{
-	/* Add to the appropriate runqueue. */
-	runq_t *rq = &cpu->rq[i];
-
-	irq_spinlock_lock(&rq->lock, false);
-	list_append(&thread->rq_link, &rq->rq);
-	rq->n++;
-	irq_spinlock_unlock(&rq->lock, false);
-
-	atomic_inc(&nrdy);
-	atomic_inc(&cpu->nrdy);
-}
-
-/** Requeue a thread that was just preempted on this CPU.
- */
-static void thread_requeue_preempted(thread_t *thread)
-{
-	assert(interrupts_disabled());
-	assert(atomic_get_unordered(&thread->state) == Running);
-	assert(atomic_get_unordered(&thread->cpu) == CPU);
-
-	int prio = atomic_get_unordered(&thread->priority);
-
-	if (prio < RQ_COUNT - 1) {
-		prio++;
-		atomic_set_unordered(&thread->priority, prio);
-	}
-
-	atomic_set_unordered(&thread->state, Ready);
-
-	add_to_rq(thread, CPU, prio);
-}
-
-void thread_requeue_sleeping(thread_t *thread)
-{
-	ipl_t ipl = interrupts_disable();
-
-	assert(atomic_get_unordered(&thread->state) == Sleeping || atomic_get_unordered(&thread->state) == Entering);
-
-	atomic_set_unordered(&thread->priority, 0);
-	atomic_set_unordered(&thread->state, Ready);
-
-	/* Prefer the CPU on which the thread ran last */
-	cpu_t *cpu = atomic_get_unordered(&thread->cpu);
-
-	if (!cpu) {
-		cpu = CPU;
-		atomic_set_unordered(&thread->cpu, CPU);
-	}
-
-	add_to_rq(thread, cpu, 0);
-
-	interrupts_restore(ipl);
-}
-
-static void cleanup_after_thread(thread_t *thread)
-{
-	assert(CURRENT->mutex_locks == 0);
-	assert(interrupts_disabled());
-
-	int expected;
-
-	switch (atomic_get_unordered(&thread->state)) {
-	case Running:
-		thread_requeue_preempted(thread);
-		break;
-
-	case Exiting:
-		waitq_close(&thread->join_wq);
-
-		/*
-		 * Release the reference CPU has for the thread.
-		 * If there are no other references (e.g. threads calling join),
-		 * the thread structure is deallocated.
-		 */
-		thread_put(thread);
-		break;
-
-	case Sleeping:
-		expected = SLEEP_INITIAL;
-
-		/* Only set SLEEP_ASLEEP in sleep pad if it's still in initial state */
-		if (!atomic_compare_exchange_strong_explicit(&thread->sleep_state,
-		    &expected, SLEEP_ASLEEP,
-		    memory_order_acq_rel, memory_order_acquire)) {
-
-			assert(expected == SLEEP_WOKE);
-			/* The thread has already been woken up, requeue immediately. */
-			thread_requeue_sleeping(thread);
-		}
-		break;
-
-	default:
-		/*
-		 * Entering state is unexpected.
-		 */
-		panic("tid%" PRIu64 ": unexpected state %s.",
-		    thread->tid, thread_states[atomic_get_unordered(&thread->state)]);
-		break;
-	}
-}
-
-/** Switch to scheduler context to let other threads run. */
-void scheduler_enter(state_t new_state)
-{
-	ipl_t ipl = interrupts_disable();
-
-	assert(CPU != NULL);
-	assert(THREAD != NULL);
-
-	if (atomic_load(&haltstate))
-		halt();
-
-	/* Check if we have a thread to switch to. */
-
-	int rq_index;
-	thread_t *new_thread = try_find_thread(&rq_index);
-
-	if (new_thread == NULL && new_state == Running) {
-		/* No other thread to run, but we still have work to do here. */
-		interrupts_restore(ipl);
-		return;
-	}
-
-	atomic_set_unordered(&THREAD->state, new_state);
-
-	/* Update thread kernel accounting */
-	atomic_time_increment(&THREAD->kcycles, get_cycle() - THREAD->last_cycle);
-
-	fpu_cleanup();
-
-	/*
-	 * On Sparc, this saves some extra userspace state that's not
-	 * covered by context_save()/context_restore().
-	 */
-	after_thread_ran_arch();
-
-	if (new_thread) {
-		thread_t *old_thread = THREAD;
-		CPU_LOCAL->prev_thread = old_thread;
-		THREAD = new_thread;
-		/* No waiting necessary, we can switch to the new thread directly. */
-		prepare_to_run_thread(rq_index);
-
-		current_copy(CURRENT, (current_t *) new_thread->kstack);
-		context_swap(&old_thread->saved_context, &new_thread->saved_context);
-	} else {
-		/*
-		 * A new thread isn't immediately available, switch to a separate
-		 * stack to sleep or do other idle stuff.
-		 */
-		current_copy(CURRENT, (current_t *) CPU_LOCAL->stack);
-		context_swap(&THREAD->saved_context, &CPU_LOCAL->scheduler_context);
-	}
-
-	assert(CURRENT->mutex_locks == 0);
-	assert(interrupts_disabled());
-
-	/* Check if we need to clean up after another thread. */
-	if (CPU_LOCAL->prev_thread) {
-		cleanup_after_thread(CPU_LOCAL->prev_thread);
-		CPU_LOCAL->prev_thread = NULL;
-	}
-
-	interrupts_restore(ipl);
-}
-
-/** Enter main scheduler loop. Never returns.
- *
- * This function switches to a runnable thread as soon as one is available,
- * after which it is only switched back to if a thread is stopping and there is
- * no other thread to run in its place. We need a separate context for that
- * because we're going to block the CPU, which means we need another context
- * to clean up after the previous thread.
- */
-void scheduler_run(void)
-{
-	assert(interrupts_disabled());
-
-	assert(CPU != NULL);
-	assert(TASK == NULL);
-	assert(THREAD == NULL);
-	assert(interrupts_disabled());
-
-	while (!atomic_load(&haltstate)) {
-		assert(CURRENT->mutex_locks == 0);
-
-		int rq_index;
-		THREAD = find_best_thread(&rq_index);
-		prepare_to_run_thread(rq_index);
-
-		/*
-		 * Copy the knowledge of CPU, TASK, THREAD and preemption counter to
-		 * thread's stack.
-		 */
-		current_copy(CURRENT, (current_t *) THREAD->kstack);
-
-		/* Switch to thread context. */
-		context_swap(&CPU_LOCAL->scheduler_context, &THREAD->saved_context);
-
-		/* Back from another thread. */
-		assert(CPU != NULL);
-		assert(THREAD != NULL);
-		assert(CURRENT->mutex_locks == 0);
-		assert(interrupts_disabled());
-
-		cleanup_after_thread(THREAD);
-
-		/*
-		 * Necessary because we're allowing interrupts in find_best_thread(),
-		 * so we need to avoid other code referencing the thread we left.
-		 */
-		THREAD = NULL;
-	}
-
-	halt();
-}
-
-/** Thread wrapper.
- *
- * This wrapper is provided to ensure that a starting thread properly handles
- * everything it needs to do when first scheduled, and when it exits.
- */
-void thread_main_func(void)
-{
-	assert(interrupts_disabled());
-
-	void (*f)(void *) = THREAD->thread_code;
-	void *arg = THREAD->thread_arg;
-
-	/* This is where each thread wakes up after its creation */
-
-	/* Check if we need to clean up after another thread. */
-	if (CPU_LOCAL->prev_thread) {
-		cleanup_after_thread(CPU_LOCAL->prev_thread);
-		CPU_LOCAL->prev_thread = NULL;
-	}
-
-	interrupts_enable();
-
-	f(arg);
-
-	thread_exit();
-
-	/* Not reached */
-}
-
-#ifdef CONFIG_SMP
-
-static thread_t *steal_thread_from(cpu_t *old_cpu, int i)
-{
-	runq_t *old_rq = &old_cpu->rq[i];
-	runq_t *new_rq = &CPU->rq[i];
-
-	ipl_t ipl = interrupts_disable();
-
-	irq_spinlock_lock(&old_rq->lock, false);
-
-	/*
-	 * If fpu_owner is any thread in the list, its store is seen here thanks to
-	 * the runqueue lock.
-	 */
-	thread_t *fpu_owner = atomic_load_explicit(&old_cpu->fpu_owner,
-	    memory_order_relaxed);
-
-	/* Search rq from the back */
-	list_foreach_rev(old_rq->rq, rq_link, thread_t, thread) {
-
-		/*
-		 * Do not steal CPU-wired threads, threads
-		 * already stolen, threads for which migration
-		 * was temporarily disabled or threads whose
-		 * FPU context is still in the CPU.
-		 */
-		if (thread->stolen || thread->nomigrate || thread == fpu_owner) {
-			continue;
-		}
-
-		thread->stolen = true;
-		atomic_set_unordered(&thread->cpu, CPU);
-
-		/*
-		 * Ready thread on local CPU
-		 */
-
-#ifdef KCPULB_VERBOSE
-		log(LF_OTHER, LVL_DEBUG,
-		    "kcpulb%u: TID %" PRIu64 " -> cpu%u, "
-		    "nrdy=%ld, avg=%ld", CPU->id, thread->tid,
-		    CPU->id, atomic_load(&CPU->nrdy),
-		    atomic_load(&nrdy) / config.cpu_active);
-#endif
-
-		/* Remove thread from ready queue. */
-		old_rq->n--;
-		list_remove(&thread->rq_link);
-		irq_spinlock_unlock(&old_rq->lock, false);
-
-		/* Append thread to local queue. */
-		irq_spinlock_lock(&new_rq->lock, false);
-		list_append(&thread->rq_link, &new_rq->rq);
-		new_rq->n++;
-		irq_spinlock_unlock(&new_rq->lock, false);
-
-		atomic_dec(&old_cpu->nrdy);
-		atomic_inc(&CPU->nrdy);
-		interrupts_restore(ipl);
-		return thread;
-	}
-
-	irq_spinlock_unlock(&old_rq->lock, false);
-	interrupts_restore(ipl);
-	return NULL;
-}
-
-/** Load balancing thread
- *
- * SMP load balancing thread, supervising thread supplies
- * for the CPU it's wired to.
- *
- * @param arg Generic thread argument (unused).
- *
- */
-void kcpulb(void *arg)
-{
-	size_t average;
-	size_t rdy;
-
-loop:
-	/*
-	 * Work in 1s intervals.
-	 */
-	thread_sleep(1);
-
-not_satisfied:
-	/*
-	 * Calculate the number of threads that will be migrated/stolen from
-	 * other CPU's. Note that situation can have changed between two
-	 * passes. Each time get the most up to date counts.
-	 *
-	 */
-	average = atomic_load(&nrdy) / config.cpu_active + 1;
-	rdy = atomic_load(&CPU->nrdy);
-
-	if (average <= rdy)
-		goto satisfied;
-
-	size_t count = average - rdy;
-
-	/*
-	 * Searching least priority queues on all CPU's first and most priority
-	 * queues on all CPU's last.
-	 */
-	size_t acpu;
-	int rq;
-
-	for (rq = RQ_COUNT - 1; rq >= 0; rq--) {
-		for (acpu = 0; acpu < config.cpu_active; acpu++) {
-			cpu_t *cpu = &cpus[acpu];
-
-			/*
-			 * Not interested in ourselves.
-			 * Doesn't require interrupt disabling for kcpulb has
-			 * THREAD_FLAG_WIRED.
-			 *
-			 */
-			if (CPU == cpu)
-				continue;
-
-			if (atomic_load(&cpu->nrdy) <= average)
-				continue;
-
-			if (steal_thread_from(cpu, rq) && --count == 0)
-				goto satisfied;
-		}
-	}
-
-	if (atomic_load(&CPU->nrdy)) {
-		/*
-		 * Be a little bit light-weight and let migrated threads run.
-		 *
-		 */
-		thread_yield();
-	} else {
-		/*
-		 * We failed to migrate a single thread.
-		 * Give up this turn.
-		 *
-		 */
-		goto loop;
-	}
-
-	goto not_satisfied;
-
-satisfied:
-	goto loop;
-}
-#endif /* CONFIG_SMP */
-
-/** Print information about threads & scheduler queues
- *
- */
-void sched_print_list(void)
-{
-	size_t cpu;
-	for (cpu = 0; cpu < config.cpu_count; cpu++) {
-		if (!cpus[cpu].active)
-			continue;
-
-		printf("cpu%u: address=%p, nrdy=%zu\n",
-		    cpus[cpu].id, &cpus[cpu], atomic_load(&cpus[cpu].nrdy));
-
-		unsigned int i;
-		for (i = 0; i < RQ_COUNT; i++) {
-			irq_spinlock_lock(&(cpus[cpu].rq[i].lock), false);
-			if (cpus[cpu].rq[i].n == 0) {
-				irq_spinlock_unlock(&(cpus[cpu].rq[i].lock), false);
-				continue;
-			}
-
-			printf("\trq[%u]: ", i);
-			list_foreach(cpus[cpu].rq[i].rq, rq_link, thread_t,
-			    thread) {
-				printf("%" PRIu64 "(%s) ", thread->tid,
-				    thread_states[atomic_get_unordered(&thread->state)]);
-			}
-			printf("\n");
-
-			irq_spinlock_unlock(&(cpus[cpu].rq[i].lock), false);
-		}
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/proc/task.c
===================================================================
--- kernel/generic/src/proc/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,720 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-
-/**
- * @file
- * @brief Task management.
- */
-
-#include <assert.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <mm/as.h>
-#include <mm/slab.h>
-#include <atomic.h>
-#include <synch/spinlock.h>
-#include <synch/waitq.h>
-#include <arch.h>
-#include <barrier.h>
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <cap/cap.h>
-#include <ipc/ipc.h>
-#include <ipc/ipcrsc.h>
-#include <ipc/event.h>
-#include <stdio.h>
-#include <errno.h>
-#include <halt.h>
-#include <str.h>
-#include <syscall/copy.h>
-#include <macros.h>
-
-/** Spinlock protecting the @c tasks ordered dictionary. */
-IRQ_SPINLOCK_INITIALIZE(tasks_lock);
-
-/** Ordered dictionary of active tasks by task ID.
- *
- * Members are task_t structures.
- *
- * The task is guaranteed to exist after it was found in the @c tasks
- * dictionary as long as:
- *
- * @li the tasks_lock is held,
- * @li the task's lock is held when task's lock is acquired before releasing
- *     tasks_lock or
- * @li the task's refcount is greater than 0
- *
- */
-odict_t tasks;
-
-static task_id_t task_counter = 0;
-
-static slab_cache_t *task_cache;
-
-/* Forward declarations. */
-static void task_kill_internal(task_t *);
-static errno_t tsk_constructor(void *, unsigned int);
-static size_t tsk_destructor(void *);
-
-static void *tasks_getkey(odlink_t *);
-static int tasks_cmp(void *, void *);
-
-/** Initialize kernel tasks support.
- *
- */
-void task_init(void)
-{
-	TASK = NULL;
-	odict_initialize(&tasks, tasks_getkey, tasks_cmp);
-	task_cache = slab_cache_create("task_t", sizeof(task_t), 0,
-	    tsk_constructor, tsk_destructor, 0);
-}
-
-/** Kill all tasks except the current task.
- *
- */
-void task_done(task_t *cur_task)
-{
-	size_t tasks_left;
-	task_t *task;
-
-	if (ipc_box_0) {
-		task_t *task_0 = ipc_box_0->task;
-		ipc_box_0 = NULL;
-
-		/*
-		 * The first task is held by kinit(), we need to release it or
-		 * it will never finish cleanup.
-		 */
-		task_release(task_0);
-	}
-
-	/* Repeat until there are any tasks except TASK */
-	do {
-#ifdef CONFIG_DEBUG
-		printf("Killing tasks... ");
-#endif
-		irq_spinlock_lock(&tasks_lock, true);
-		tasks_left = 0;
-
-		task = task_first();
-		while (task != NULL) {
-			if (task != cur_task) {
-				tasks_left++;
-#ifdef CONFIG_DEBUG
-				printf("[%" PRIu64 "] ", task->taskid);
-#endif
-				task_kill_internal(task);
-			}
-
-			task = task_next(task);
-		}
-
-		irq_spinlock_unlock(&tasks_lock, true);
-
-		thread_sleep(1);
-
-#ifdef CONFIG_DEBUG
-		printf("\n");
-#endif
-	} while (tasks_left > 0);
-}
-
-errno_t tsk_constructor(void *obj, unsigned int kmflags)
-{
-	task_t *task = (task_t *) obj;
-
-	errno_t rc = caps_task_alloc(task);
-	if (rc != EOK)
-		return rc;
-
-	atomic_store(&task->lifecount, 0);
-
-	irq_spinlock_initialize(&task->lock, "task_t_lock");
-
-	list_initialize(&task->threads);
-
-	ipc_answerbox_init(&task->answerbox, task);
-
-	spinlock_initialize(&task->active_calls_lock, "active_calls_lock");
-	list_initialize(&task->active_calls);
-
-#ifdef CONFIG_UDEBUG
-	/* Init kbox stuff */
-	task->kb.thread = NULL;
-	ipc_answerbox_init(&task->kb.box, task);
-	mutex_initialize(&task->kb.cleanup_lock, MUTEX_PASSIVE);
-#endif
-
-	return EOK;
-}
-
-size_t tsk_destructor(void *obj)
-{
-	task_t *task = (task_t *) obj;
-
-	caps_task_free(task);
-	return 0;
-}
-
-/** Create new task with no threads.
- *
- * @param as   Task's address space.
- * @param name Symbolic name (a copy is made).
- *
- * @return New task's structure.
- *
- */
-task_t *task_create(as_t *as, const char *name)
-{
-	task_t *task = (task_t *) slab_alloc(task_cache, FRAME_ATOMIC);
-	if (!task)
-		return NULL;
-
-	refcount_init(&task->refcount);
-
-	task_create_arch(task);
-
-	task->as = as;
-	str_cpy(task->name, TASK_NAME_BUFLEN, name);
-
-	task->container = CONTAINER;
-	task->perms = 0;
-	task->ucycles = 0;
-	task->kcycles = 0;
-
-	caps_task_init(task);
-
-	task->ipc_info.call_sent = 0;
-	task->ipc_info.call_received = 0;
-	task->ipc_info.answer_sent = 0;
-	task->ipc_info.answer_received = 0;
-	task->ipc_info.irq_notif_received = 0;
-	task->ipc_info.forwarded = 0;
-
-	event_task_init(task);
-
-	task->answerbox.active = true;
-
-	task->debug_sections = NULL;
-
-#ifdef CONFIG_UDEBUG
-	/* Init debugging stuff */
-	udebug_task_init(&task->udebug);
-
-	/* Init kbox stuff */
-	task->kb.box.active = true;
-	task->kb.finished = false;
-#endif
-
-	if ((ipc_box_0) &&
-	    (container_check(ipc_box_0->task->container, task->container))) {
-		cap_phone_handle_t phone_handle;
-		errno_t rc = phone_alloc(task, true, &phone_handle, NULL);
-		if (rc != EOK) {
-			task->as = NULL;
-			task_destroy_arch(task);
-			slab_free(task_cache, task);
-			return NULL;
-		}
-
-		kobject_t *phone_obj = kobject_get(task, phone_handle,
-		    KOBJECT_TYPE_PHONE);
-		(void) ipc_phone_connect(phone_obj->phone, ipc_box_0);
-	}
-
-	irq_spinlock_lock(&tasks_lock, true);
-
-	task->taskid = ++task_counter;
-	odlink_initialize(&task->ltasks);
-	odict_insert(&task->ltasks, &tasks, NULL);
-
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	return task;
-}
-
-/** Destroy task.
- *
- * @param task Task to be destroyed.
- *
- */
-static void task_destroy(task_t *task)
-{
-	/*
-	 * Remove the task from the task odict.
-	 */
-	irq_spinlock_lock(&tasks_lock, true);
-	odict_remove(&task->ltasks);
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	/*
-	 * Perform architecture specific task destruction.
-	 */
-	task_destroy_arch(task);
-
-	/*
-	 * Drop our reference to the address space.
-	 */
-	as_release(task->as);
-
-	slab_free(task_cache, task);
-}
-
-/** Hold a reference to a task.
- *
- * Holding a reference to a task prevents destruction of that task.
- *
- * @param task Task to be held.
- *
- */
-void task_hold(task_t *task)
-{
-	refcount_up(&task->refcount);
-}
-
-/** Release a reference to a task.
- *
- * The last one to release a reference to a task destroys the task.
- *
- * @param task Task to be released.
- *
- */
-void task_release(task_t *task)
-{
-	if (refcount_down(&task->refcount))
-		task_destroy(task);
-}
-
-#ifdef __32_BITS__
-
-/** Syscall for reading task ID from userspace (32 bits)
- *
- * @param uspace_taskid Pointer to user-space buffer
- *                      where to store current task ID.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_task_get_id(uspace_ptr_sysarg64_t uspace_taskid)
-{
-	/*
-	 * No need to acquire lock on TASK because taskid remains constant for
-	 * the lifespan of the task.
-	 */
-	return (sys_errno_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
-	    sizeof(TASK->taskid));
-}
-
-#endif  /* __32_BITS__ */
-
-#ifdef __64_BITS__
-
-/** Syscall for reading task ID from userspace (64 bits)
- *
- * @return Current task ID.
- *
- */
-sysarg_t sys_task_get_id(void)
-{
-	/*
-	 * No need to acquire lock on TASK because taskid remains constant for
-	 * the lifespan of the task.
-	 */
-	return TASK->taskid;
-}
-
-#endif  /* __64_BITS__ */
-
-/** Syscall for setting the task name.
- *
- * The name simplifies identifying the task in the task list.
- *
- * @param name The new name for the task. (typically the same
- *             as the command used to execute it).
- *
- * @return 0 on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_task_set_name(const uspace_ptr_char uspace_name, size_t name_len)
-{
-	char namebuf[TASK_NAME_BUFLEN];
-
-	/* Cap length of name and copy it from userspace. */
-	if (name_len > TASK_NAME_BUFLEN - 1)
-		name_len = TASK_NAME_BUFLEN - 1;
-
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	namebuf[name_len] = '\0';
-
-	/*
-	 * As the task name is referenced also from the
-	 * threads, lock the threads' lock for the course
-	 * of the update.
-	 */
-
-	irq_spinlock_lock(&tasks_lock, true);
-	irq_spinlock_lock(&TASK->lock, false);
-
-	/* Set task name */
-	str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf);
-
-	irq_spinlock_unlock(&TASK->lock, false);
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	return EOK;
-}
-
-/** Syscall to forcefully terminate a task
- *
- * @param uspace_taskid Pointer to task ID in user space.
- *
- * @return 0 on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_task_kill(uspace_ptr_task_id_t uspace_taskid)
-{
-	task_id_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return (sys_errno_t) task_kill(taskid);
-}
-
-/** Find task structure corresponding to task ID.
- *
- * @param id Task ID.
- *
- * @return Task reference or NULL if there is no such task ID.
- *
- */
-task_t *task_find_by_id(task_id_t id)
-{
-	task_t *task = NULL;
-
-	irq_spinlock_lock(&tasks_lock, true);
-
-	odlink_t *odlink = odict_find_eq(&tasks, &id, NULL);
-	if (odlink != NULL) {
-		task = odict_get_instance(odlink, task_t, ltasks);
-
-		/*
-		 * The directory of tasks can't hold a reference, since that would
-		 * prevent task from ever being destroyed. That means we have to
-		 * check for the case where the task is already being destroyed, but
-		 * not yet removed from the directory.
-		 */
-		if (!refcount_try_up(&task->refcount))
-			task = NULL;
-	}
-
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	return task;
-}
-
-/** Get count of tasks.
- *
- * @return Number of tasks in the system
- */
-size_t task_count(void)
-{
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&tasks_lock));
-
-	return odict_count(&tasks);
-}
-
-/** Get first task (task with lowest ID).
- *
- * @return Pointer to first task or @c NULL if there are none.
- */
-task_t *task_first(void)
-{
-	odlink_t *odlink;
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&tasks_lock));
-
-	odlink = odict_first(&tasks);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, task_t, ltasks);
-}
-
-/** Get next task (with higher task ID).
- *
- * @param cur Current task
- * @return Pointer to next task or @c NULL if there are no more tasks.
- */
-task_t *task_next(task_t *cur)
-{
-	odlink_t *odlink;
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&tasks_lock));
-
-	odlink = odict_next(&cur->ltasks, &tasks);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, task_t, ltasks);
-}
-
-/** Get accounting data of given task.
- *
- * Note that task lock of 'task' must be already held and interrupts must be
- * already disabled.
- *
- * @param task    Pointer to the task.
- * @param ucycles Out pointer to sum of all user cycles.
- * @param kcycles Out pointer to sum of all kernel cycles.
- *
- */
-void task_get_accounting(task_t *task, uint64_t *ucycles, uint64_t *kcycles)
-{
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&task->lock));
-
-	/* Accumulated values of task */
-	uint64_t uret = task->ucycles;
-	uint64_t kret = task->kcycles;
-
-	/* Current values of threads */
-	list_foreach(task->threads, th_link, thread_t, thread) {
-		/* Process only counted threads */
-		if (!thread->uncounted) {
-			if (thread == THREAD) {
-				/* Update accounting of current thread */
-				thread_update_accounting(false);
-			}
-
-			uret += atomic_time_read(&thread->ucycles);
-			kret += atomic_time_read(&thread->kcycles);
-		}
-	}
-
-	*ucycles = uret;
-	*kcycles = kret;
-}
-
-static void task_kill_internal(task_t *task)
-{
-	irq_spinlock_lock(&task->lock, true);
-
-	/*
-	 * Interrupt all threads.
-	 */
-
-	list_foreach(task->threads, th_link, thread_t, thread) {
-		thread_interrupt(thread);
-	}
-
-	irq_spinlock_unlock(&task->lock, true);
-}
-
-/** Kill task.
- *
- * This function is idempotent.
- * It signals all the task's threads to bail it out.
- *
- * @param id ID of the task to be killed.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t task_kill(task_id_t id)
-{
-	if (id == 1)
-		return EPERM;
-
-	task_t *task = task_find_by_id(id);
-	if (!task)
-		return ENOENT;
-
-	task_kill_internal(task);
-	task_release(task);
-	return EOK;
-}
-
-/** Kill the currently running task.
- *
- * @param notify Send out fault notifications.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-void task_kill_self(bool notify)
-{
-	/*
-	 * User space can subscribe for FAULT events to take action
-	 * whenever a task faults (to take a dump, run a debugger, etc.).
-	 * The notification is always available, but unless udebug is enabled,
-	 * that's all you get.
-	 */
-	if (notify) {
-		/* Notify the subscriber that a fault occurred. */
-		if (event_notify_3(EVENT_FAULT, false, LOWER32(TASK->taskid),
-		    UPPER32(TASK->taskid), (sysarg_t) THREAD) == EOK) {
-#ifdef CONFIG_UDEBUG
-			/* Wait for a debugging session. */
-			udebug_thread_fault();
-#endif
-		}
-	}
-
-	task_kill_internal(TASK);
-	thread_exit();
-}
-
-/** Process syscall to terminate the current task.
- *
- * @param notify Send out fault notifications.
- *
- */
-sys_errno_t sys_task_exit(sysarg_t notify)
-{
-	task_kill_self(notify);
-	unreachable();
-}
-
-static void task_print(task_t *task, bool additional)
-{
-	irq_spinlock_lock(&task->lock, false);
-
-	uint64_t ucycles;
-	uint64_t kcycles;
-	char usuffix, ksuffix;
-	task_get_accounting(task, &ucycles, &kcycles);
-	order_suffix(ucycles, &ucycles, &usuffix);
-	order_suffix(kcycles, &kcycles, &ksuffix);
-
-#ifdef __32_BITS__
-	if (additional)
-		printf("%-8" PRIu64 " %9zu", task->taskid,
-		    atomic_load(&task->lifecount));
-	else
-		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
-		    " %9" PRIu64 "%c %9" PRIu64 "%c\n", task->taskid,
-		    task->name, task->container, task, task->as,
-		    ucycles, usuffix, kcycles, ksuffix);
-#endif
-
-#ifdef __64_BITS__
-	if (additional)
-		printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
-		    "%9zu\n", task->taskid, ucycles, usuffix, kcycles,
-		    ksuffix, atomic_load(&task->lifecount));
-	else
-		printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
-		    task->taskid, task->name, task->container, task, task->as);
-#endif
-
-	irq_spinlock_unlock(&task->lock, false);
-}
-
-/** Print task list
- *
- * @param additional Print additional information.
- *
- */
-void task_print_list(bool additional)
-{
-	/* Messing with task structures, avoid deadlock */
-	irq_spinlock_lock(&tasks_lock, true);
-
-#ifdef __32_BITS__
-	if (additional)
-		printf("[id    ] [threads] [calls] [callee\n");
-	else
-		printf("[id    ] [name        ] [ctn] [address ] [as      ]"
-		    " [ucycles ] [kcycles ]\n");
-#endif
-
-#ifdef __64_BITS__
-	if (additional)
-		printf("[id    ] [ucycles ] [kcycles ] [threads] [calls]"
-		    " [callee\n");
-	else
-		printf("[id    ] [name        ] [ctn] [address         ]"
-		    " [as              ]\n");
-#endif
-
-	task_t *task;
-
-	task = task_first();
-	while (task != NULL) {
-		task_print(task, additional);
-		task = task_next(task);
-	}
-
-	irq_spinlock_unlock(&tasks_lock, true);
-}
-
-/** Get key function for the @c tasks ordered dictionary.
- *
- * @param odlink Link
- * @return Pointer to task ID cast as 'void *'
- */
-static void *tasks_getkey(odlink_t *odlink)
-{
-	task_t *task = odict_get_instance(odlink, task_t, ltasks);
-	return (void *) &task->taskid;
-}
-
-/** Key comparison function for the @c tasks ordered dictionary.
- *
- * @param a Pointer to thread A ID
- * @param b Pointer to thread B ID
- * @return -1, 0, 1 iff ID A is less than, equal to, greater than B
- */
-static int tasks_cmp(void *a, void *b)
-{
-	task_id_t ida = *(task_id_t *)a;
-	task_id_t idb = *(task_id_t *)b;
-
-	if (ida < idb)
-		return -1;
-	else if (ida == idb)
-		return 0;
-	else
-		return +1;
-}
-
-/** @}
- */
Index: rnel/generic/src/proc/thread.c
===================================================================
--- kernel/generic/src/proc/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1043 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic_proc
- * @{
- */
-
-/**
- * @file
- * @brief Thread management functions.
- */
-
-#include <assert.h>
-#include <proc/scheduler.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <mm/frame.h>
-#include <mm/page.h>
-#include <arch/asm.h>
-#include <arch/cycle.h>
-#include <arch.h>
-#include <synch/spinlock.h>
-#include <synch/waitq.h>
-#include <synch/syswaitq.h>
-#include <cpu.h>
-#include <str.h>
-#include <context.h>
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <time/clock.h>
-#include <time/timeout.h>
-#include <time/delay.h>
-#include <config.h>
-#include <arch/interrupt.h>
-#include <smp/ipi.h>
-#include <atomic.h>
-#include <memw.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <main/uinit.h>
-#include <syscall/copy.h>
-#include <errno.h>
-#include <debug.h>
-#include <halt.h>
-
-/** Thread states */
-const char *thread_states[] = {
-	"Invalid",
-	"Running",
-	"Sleeping",
-	"Ready",
-	"Entering",
-	"Exiting",
-	"Lingering"
-};
-
-/** Lock protecting the @c threads ordered dictionary .
- *
- * For locking rules, see declaration thereof.
- */
-IRQ_SPINLOCK_INITIALIZE(threads_lock);
-
-/** Ordered dictionary of all threads by their address (i.e. pointer to
- * the thread_t structure).
- *
- * When a thread is found in the @c threads ordered dictionary, it is
- * guaranteed to exist as long as the @c threads_lock is held.
- *
- * Members are of type thread_t.
- *
- * This structure contains weak references. Any reference from it must not leave
- * threads_lock critical section unless strengthened via thread_try_ref().
- */
-odict_t threads;
-
-IRQ_SPINLOCK_STATIC_INITIALIZE(tidlock);
-static thread_id_t last_tid = 0;
-
-static slab_cache_t *thread_cache;
-
-static void *threads_getkey(odlink_t *);
-static int threads_cmp(void *, void *);
-
-/** Initialization and allocation for thread_t structure
- *
- */
-static errno_t thr_constructor(void *obj, unsigned int kmflags)
-{
-	thread_t *thread = (thread_t *) obj;
-
-	link_initialize(&thread->rq_link);
-	link_initialize(&thread->wq_link);
-	link_initialize(&thread->th_link);
-
-	/* call the architecture-specific part of the constructor */
-	thr_constructor_arch(thread);
-
-	/*
-	 * Allocate the kernel stack from the low-memory to prevent an infinite
-	 * nesting of TLB-misses when accessing the stack from the part of the
-	 * TLB-miss handler written in C.
-	 *
-	 * Note that low-memory is safe to be used for the stack as it will be
-	 * covered by the kernel identity mapping, which guarantees not to
-	 * nest TLB-misses infinitely (either via some hardware mechanism or
-	 * by the construction of the assembly-language part of the TLB-miss
-	 * handler).
-	 *
-	 * This restriction can be lifted once each architecture provides
-	 * a similar guarantee, for example, by locking the kernel stack
-	 * in the TLB whenever it is allocated from the high-memory and the
-	 * thread is being scheduled to run.
-	 */
-	kmflags |= FRAME_LOWMEM;
-	kmflags &= ~FRAME_HIGHMEM;
-
-	/*
-	 * NOTE: All kernel stacks must be aligned to STACK_SIZE,
-	 *       see CURRENT.
-	 */
-
-	uintptr_t stack_phys =
-	    frame_alloc(STACK_FRAMES, kmflags, STACK_SIZE - 1);
-	if (!stack_phys)
-		return ENOMEM;
-
-	thread->kstack = (uint8_t *) PA2KA(stack_phys);
-
-#ifdef CONFIG_UDEBUG
-	mutex_initialize(&thread->udebug.lock, MUTEX_PASSIVE);
-#endif
-
-	return EOK;
-}
-
-/** Destruction of thread_t object */
-static size_t thr_destructor(void *obj)
-{
-	thread_t *thread = (thread_t *) obj;
-
-	/* call the architecture-specific part of the destructor */
-	thr_destructor_arch(thread);
-
-	frame_free(KA2PA(thread->kstack), STACK_FRAMES);
-
-	return STACK_FRAMES;  /* number of frames freed */
-}
-
-/** Initialize threads
- *
- * Initialize kernel threads support.
- *
- */
-void thread_init(void)
-{
-	THREAD = NULL;
-
-	atomic_store(&nrdy, 0);
-	thread_cache = slab_cache_create("thread_t", sizeof(thread_t), _Alignof(thread_t),
-	    thr_constructor, thr_destructor, 0);
-
-	odict_initialize(&threads, threads_getkey, threads_cmp);
-}
-
-/** Wire thread to the given CPU
- *
- * @param cpu CPU to wire the thread to.
- *
- */
-void thread_wire(thread_t *thread, cpu_t *cpu)
-{
-	ipl_t ipl = interrupts_disable();
-	atomic_set_unordered(&thread->cpu, cpu);
-	thread->nomigrate++;
-	interrupts_restore(ipl);
-}
-
-/** Start a thread that wasn't started yet since it was created.
- *
- * @param thread A reference to the newly created thread.
- */
-void thread_start(thread_t *thread)
-{
-	assert(atomic_get_unordered(&thread->state) == Entering);
-	thread_requeue_sleeping(thread_ref(thread));
-}
-
-/** Create new thread
- *
- * Create a new thread.
- *
- * @param func      Thread's implementing function.
- * @param arg       Thread's implementing function argument.
- * @param task      Task to which the thread belongs. The caller must
- *                  guarantee that the task won't cease to exist during the
- *                  call. The task's lock may not be held.
- * @param flags     Thread flags.
- * @param name      Symbolic name (a copy is made).
- *
- * @return New thread's structure on success, NULL on failure.
- *
- */
-thread_t *thread_create(void (*func)(void *), void *arg, task_t *task,
-    thread_flags_t flags, const char *name)
-{
-	thread_t *thread = (thread_t *) slab_alloc(thread_cache, FRAME_ATOMIC);
-	if (!thread)
-		return NULL;
-
-	refcount_init(&thread->refcount);
-
-	if (thread_create_arch(thread, flags) != EOK) {
-		slab_free(thread_cache, thread);
-		return NULL;
-	}
-
-	/* Not needed, but good for debugging */
-	memsetb(thread->kstack, STACK_SIZE, 0);
-
-	irq_spinlock_lock(&tidlock, true);
-	thread->tid = ++last_tid;
-	irq_spinlock_unlock(&tidlock, true);
-
-	context_create(&thread->saved_context, thread_main_func,
-	    thread->kstack, STACK_SIZE);
-
-	current_initialize((current_t *) thread->kstack);
-
-	str_cpy(thread->name, THREAD_NAME_BUFLEN, name);
-
-	thread->thread_code = func;
-	thread->thread_arg = arg;
-	thread->ucycles = ATOMIC_TIME_INITIALIZER();
-	thread->kcycles = ATOMIC_TIME_INITIALIZER();
-	thread->uncounted =
-	    ((flags & THREAD_FLAG_UNCOUNTED) == THREAD_FLAG_UNCOUNTED);
-	atomic_init(&thread->priority, 0);
-	atomic_init(&thread->cpu, NULL);
-	thread->stolen = false;
-	thread->uspace =
-	    ((flags & THREAD_FLAG_USPACE) == THREAD_FLAG_USPACE);
-
-	thread->nomigrate = 0;
-	atomic_init(&thread->state, Entering);
-
-	atomic_init(&thread->sleep_queue, NULL);
-
-	thread->in_copy_from_uspace = false;
-	thread->in_copy_to_uspace = false;
-
-	thread->interrupted = false;
-	atomic_init(&thread->sleep_state, SLEEP_INITIAL);
-
-	waitq_initialize(&thread->join_wq);
-
-	thread->task = task;
-
-	thread->fpu_context_exists = false;
-
-	odlink_initialize(&thread->lthreads);
-
-#ifdef CONFIG_UDEBUG
-	/* Initialize debugging stuff */
-	atomic_init(&thread->btrace, false);
-	udebug_thread_initialize(&thread->udebug);
-#endif
-
-	if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH)
-		thread_attach(thread, task);
-
-	return thread;
-}
-
-/** Destroy thread memory structure
- *
- * Detach thread from all queues, cpus etc. and destroy it.
- *
- * @param obj  Thread to be destroyed.
- *
- */
-static void thread_destroy(void *obj)
-{
-	thread_t *thread = (thread_t *) obj;
-
-	assert_link_not_used(&thread->rq_link);
-	assert_link_not_used(&thread->wq_link);
-
-	assert(thread->task);
-
-	ipl_t ipl = interrupts_disable();
-
-	/* Remove thread from global list. */
-	irq_spinlock_lock(&threads_lock, false);
-	odict_remove(&thread->lthreads);
-	irq_spinlock_unlock(&threads_lock, false);
-
-	/* Remove thread from task's list and accumulate accounting. */
-	irq_spinlock_lock(&thread->task->lock, false);
-
-	list_remove(&thread->th_link);
-
-	/*
-	 * No other CPU has access to this thread anymore, so we don't need
-	 * thread->lock for accessing thread's fields after this point.
-	 */
-
-	if (!thread->uncounted) {
-		thread->task->ucycles += atomic_time_read(&thread->ucycles);
-		thread->task->kcycles += atomic_time_read(&thread->kcycles);
-	}
-
-	irq_spinlock_unlock(&thread->task->lock, false);
-
-	assert((atomic_get_unordered(&thread->state) == Entering) ||
-	    (atomic_get_unordered(&thread->state) == Exiting) ||
-	    (atomic_get_unordered(&thread->state) == Lingering));
-
-	/* Clear cpu->fpu_owner if set to this thread. */
-#ifdef CONFIG_FPU_LAZY
-	cpu_t *cpu = atomic_get_unordered(&thread->cpu);
-	if (cpu) {
-		/*
-		 * We need to lock for this because the old CPU can concurrently try
-		 * to dump this thread's FPU state, in which case we need to wait for
-		 * it to finish. An atomic compare-and-swap wouldn't be enough.
-		 */
-		irq_spinlock_lock(&cpu->fpu_lock, false);
-
-		if (atomic_get_unordered(&cpu->fpu_owner) == thread)
-			atomic_set_unordered(&cpu->fpu_owner, NULL);
-
-		irq_spinlock_unlock(&cpu->fpu_lock, false);
-	}
-#endif
-
-	interrupts_restore(ipl);
-
-	/*
-	 * Drop the reference to the containing task.
-	 */
-	task_release(thread->task);
-	thread->task = NULL;
-
-	slab_free(thread_cache, thread);
-}
-
-void thread_put(thread_t *thread)
-{
-	if (refcount_down(&thread->refcount)) {
-		thread_destroy(thread);
-	}
-}
-
-/** Make the thread visible to the system.
- *
- * Attach the thread structure to the current task and make it visible in the
- * threads_tree.
- *
- * @param t    Thread to be attached to the task.
- * @param task Task to which the thread is to be attached.
- *
- */
-void thread_attach(thread_t *thread, task_t *task)
-{
-	ipl_t ipl = interrupts_disable();
-
-	/*
-	 * Attach to the specified task.
-	 */
-	irq_spinlock_lock(&task->lock, false);
-
-	/* Hold a reference to the task. */
-	task_hold(task);
-
-	/* Must not count kbox thread into lifecount */
-	if (thread->uspace)
-		atomic_inc(&task->lifecount);
-
-	list_append(&thread->th_link, &task->threads);
-
-	irq_spinlock_unlock(&task->lock, false);
-
-	/*
-	 * Register this thread in the system-wide dictionary.
-	 */
-	irq_spinlock_lock(&threads_lock, false);
-	odict_insert(&thread->lthreads, &threads, NULL);
-	irq_spinlock_unlock(&threads_lock, false);
-
-	interrupts_restore(ipl);
-}
-
-/** Terminate thread.
- *
- * End current thread execution and switch it to the exiting state.
- * All pending timeouts are executed.
- *
- */
-void thread_exit(void)
-{
-	if (THREAD->uspace) {
-#ifdef CONFIG_UDEBUG
-		/* Generate udebug THREAD_E event */
-		udebug_thread_e_event();
-
-		/*
-		 * This thread will not execute any code or system calls from
-		 * now on.
-		 */
-		udebug_stoppable_begin();
-#endif
-		if (atomic_predec(&TASK->lifecount) == 0) {
-			/*
-			 * We are the last userspace thread in the task that
-			 * still has not exited. With the exception of the
-			 * moment the task was created, new userspace threads
-			 * can only be created by threads of the same task.
-			 * We are safe to perform cleanup.
-			 *
-			 */
-			ipc_cleanup();
-			sys_waitq_task_cleanup();
-			LOG("Cleanup of task %" PRIu64 " completed.", TASK->taskid);
-		}
-	}
-
-	scheduler_enter(Exiting);
-	unreachable();
-}
-
-/** Interrupts an existing thread so that it may exit as soon as possible.
- *
- * Threads that are blocked waiting for a synchronization primitive
- * are woken up with a return code of EINTR if the
- * blocking call was interruptable. See waitq_sleep_timeout().
- *
- * Interrupted threads automatically exit when returning back to user space.
- *
- * @param thread A valid thread object.
- */
-void thread_interrupt(thread_t *thread)
-{
-	assert(thread != NULL);
-	thread->interrupted = true;
-	thread_wakeup(thread);
-}
-
-/** Prepare for putting the thread to sleep.
- *
- * @returns whether the thread is currently terminating. If THREAD_OK
- * is returned, the thread is guaranteed to be woken up instantly if the thread
- * is terminated at any time between this function's return and
- * thread_wait_finish(). If THREAD_TERMINATING is returned, the thread can still
- * go to sleep, but doing so will delay termination.
- */
-thread_termination_state_t thread_wait_start(void)
-{
-	assert(THREAD != NULL);
-
-	/*
-	 * This is an exchange rather than a store so that we can use the acquire
-	 * semantics, which is needed to ensure that code after this operation sees
-	 * memory ops made before thread_wakeup() in other thread, if that wakeup
-	 * was reset by this operation.
-	 *
-	 * In particular, we need this to ensure we can't miss the thread being
-	 * terminated concurrently with a synchronization primitive preparing to
-	 * sleep.
-	 */
-	(void) atomic_exchange_explicit(&THREAD->sleep_state, SLEEP_INITIAL,
-	    memory_order_acquire);
-
-	return THREAD->interrupted ? THREAD_TERMINATING : THREAD_OK;
-}
-
-static void thread_wait_timeout_callback(void *arg)
-{
-	thread_wakeup(arg);
-}
-
-/**
- * Suspends this thread's execution until thread_wakeup() is called on it,
- * or deadline is reached.
- *
- * The way this would normally be used is that the current thread call
- * thread_wait_start(), and if interruption has not been signaled, stores
- * a reference to itself in a synchronized structure (such as waitq).
- * After that, it releases any spinlocks it might hold and calls this function.
- *
- * The thread doing the wakeup will acquire the thread's reference from said
- * synchronized structure and calls thread_wakeup() on it.
- *
- * Notably, there can be more than one thread performing wakeup.
- * The number of performed calls to thread_wakeup(), or their relative
- * ordering with thread_wait_finish(), does not matter. However, calls to
- * thread_wakeup() are expected to be synchronized with thread_wait_start()
- * with which they are associated, otherwise wakeups may be missed.
- * However, the operation of thread_wakeup() is defined at any time,
- * synchronization notwithstanding (in the sense of C un/defined behavior),
- * and is in fact used to interrupt waiting threads by external events.
- * The waiting thread must operate correctly in face of spurious wakeups,
- * and clean up its reference in the synchronization structure if necessary.
- *
- * Returns THREAD_WAIT_TIMEOUT if timeout fired, which is a necessary condition
- * for it to have been waken up by the timeout, but the caller must assume
- * that proper wakeups, timeouts and interrupts may occur concurrently, so
- * the fact timeout has been registered does not necessarily mean the thread
- * has not been woken up or interrupted.
- */
-thread_wait_result_t thread_wait_finish(deadline_t deadline)
-{
-	assert(THREAD != NULL);
-
-	timeout_t timeout;
-
-	/* Extra check to avoid going to scheduler if we don't need to. */
-	if (atomic_load_explicit(&THREAD->sleep_state, memory_order_acquire) !=
-	    SLEEP_INITIAL)
-		return THREAD_WAIT_SUCCESS;
-
-	if (deadline != DEADLINE_NEVER) {
-		timeout_initialize(&timeout);
-		timeout_register_deadline(&timeout, deadline,
-		    thread_wait_timeout_callback, THREAD);
-	}
-
-	scheduler_enter(Sleeping);
-
-	if (deadline != DEADLINE_NEVER && !timeout_unregister(&timeout)) {
-		return THREAD_WAIT_TIMEOUT;
-	} else {
-		return THREAD_WAIT_SUCCESS;
-	}
-}
-
-void thread_wakeup(thread_t *thread)
-{
-	assert(thread != NULL);
-
-	int state = atomic_exchange_explicit(&thread->sleep_state, SLEEP_WOKE,
-	    memory_order_acq_rel);
-
-	if (state == SLEEP_ASLEEP) {
-		/*
-		 * Only one thread gets to do this.
-		 * The reference consumed here is the reference implicitly passed to
-		 * the waking thread by the sleeper in thread_wait_finish().
-		 */
-		thread_requeue_sleeping(thread);
-	}
-}
-
-/** Prevent the current thread from being migrated to another processor. */
-void thread_migration_disable(void)
-{
-	ipl_t ipl = interrupts_disable();
-
-	assert(THREAD);
-	THREAD->nomigrate++;
-
-	interrupts_restore(ipl);
-}
-
-/** Allow the current thread to be migrated to another processor. */
-void thread_migration_enable(void)
-{
-	ipl_t ipl = interrupts_disable();
-
-	assert(THREAD);
-	assert(THREAD->nomigrate > 0);
-
-	if (THREAD->nomigrate > 0)
-		THREAD->nomigrate--;
-
-	interrupts_restore(ipl);
-}
-
-/** Thread sleep
- *
- * Suspend execution of the current thread.
- *
- * @param sec Number of seconds to sleep.
- *
- */
-void thread_sleep(uint32_t sec)
-{
-	/*
-	 * Sleep in 1000 second steps to support
-	 * full argument range
-	 */
-	while (sec > 0) {
-		uint32_t period = (sec > 1000) ? 1000 : sec;
-
-		thread_usleep(period * 1000000);
-		sec -= period;
-	}
-}
-
-errno_t thread_join(thread_t *thread)
-{
-	return thread_join_timeout(thread, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
-}
-
-/** Wait for another thread to exit.
- * After successful wait, the thread reference is destroyed.
- *
- * @param thread Thread to join on exit.
- * @param usec   Timeout in microseconds.
- * @param flags  Mode of operation.
- *
- * @return An error code from errno.h or an error code from synch.h.
- *
- */
-errno_t thread_join_timeout(thread_t *thread, uint32_t usec, unsigned int flags)
-{
-	assert(thread != NULL);
-
-	if (thread == THREAD)
-		return EINVAL;
-
-	errno_t rc = _waitq_sleep_timeout(&thread->join_wq, usec, flags);
-
-	if (rc == EOK)
-		thread_put(thread);
-
-	return rc;
-}
-
-void thread_detach(thread_t *thread)
-{
-	thread_put(thread);
-}
-
-/** Thread usleep
- *
- * Suspend execution of the current thread.
- *
- * @param usec Number of microseconds to sleep.
- *
- */
-void thread_usleep(uint32_t usec)
-{
-	WAITQ_INITIALIZE(wq);
-	(void) waitq_sleep_timeout(&wq, usec);
-}
-
-/** Allow other threads to run. */
-void thread_yield(void)
-{
-	assert(THREAD != NULL);
-	scheduler_enter(Running);
-}
-
-static void thread_print(thread_t *thread, bool additional)
-{
-	uint64_t ucycles, kcycles;
-	char usuffix, ksuffix;
-	order_suffix(atomic_time_read(&thread->ucycles), &ucycles, &usuffix);
-	order_suffix(atomic_time_read(&thread->kcycles), &kcycles, &ksuffix);
-
-	state_t state = atomic_get_unordered(&thread->state);
-
-	char *name;
-	if (str_cmp(thread->name, "uinit") == 0)
-		name = thread->task->name;
-	else
-		name = thread->name;
-
-	if (additional)
-		printf("%-8" PRIu64 " %p %p %9" PRIu64 "%c %9" PRIu64 "%c ",
-		    thread->tid, thread->thread_code, thread->kstack,
-		    ucycles, usuffix, kcycles, ksuffix);
-	else
-		printf("%-8" PRIu64 " %-14s %p %-8s %p %-5" PRIu32 "\n",
-		    thread->tid, name, thread, thread_states[state],
-		    thread->task, thread->task->container);
-
-	if (additional) {
-		cpu_t *cpu = atomic_get_unordered(&thread->cpu);
-		if (cpu)
-			printf("%-5u", cpu->id);
-		else
-			printf("none ");
-
-		if (state == Sleeping) {
-			printf(" %p", thread->sleep_queue);
-		}
-
-		printf("\n");
-	}
-}
-
-/** Print list of threads debug info
- *
- * @param additional Print additional information.
- *
- */
-void thread_print_list(bool additional)
-{
-	thread_t *thread;
-
-	/* Accessing system-wide threads list through thread_first()/thread_next(). */
-	irq_spinlock_lock(&threads_lock, true);
-
-	if (sizeof(void *) <= 4) {
-		if (additional)
-			printf("[id    ] [code    ] [stack   ] [ucycles ] [kcycles ]"
-			    " [cpu] [waitqueue]\n");
-		else
-			printf("[id    ] [name        ] [address ] [state ] [task    ]"
-			    " [ctn]\n");
-	} else {
-		if (additional) {
-			printf("[id    ] [code            ] [stack           ] [ucycles ] [kcycles ]"
-			    " [cpu] [waitqueue       ]\n");
-		} else
-			printf("[id    ] [name        ] [address         ] [state ]"
-			    " [task            ] [ctn]\n");
-	}
-
-	thread = thread_first();
-	while (thread != NULL) {
-		thread_print(thread, additional);
-		thread = thread_next(thread);
-	}
-
-	irq_spinlock_unlock(&threads_lock, true);
-}
-
-static bool thread_exists(thread_t *thread)
-{
-	odlink_t *odlink = odict_find_eq(&threads, thread, NULL);
-	return odlink != NULL;
-}
-
-/** Check whether the thread exists, and if so, return a reference to it.
- */
-thread_t *thread_try_get(thread_t *thread)
-{
-	irq_spinlock_lock(&threads_lock, true);
-
-	if (thread_exists(thread)) {
-		/* Try to strengthen the reference. */
-		thread = thread_try_ref(thread);
-	} else {
-		thread = NULL;
-	}
-
-	irq_spinlock_unlock(&threads_lock, true);
-
-	return thread;
-}
-
-/** Update accounting of current thread.
- *
- * Note that thread_lock on THREAD must be already held and
- * interrupts must be already disabled.
- *
- * @param user True to update user accounting, false for kernel.
- *
- */
-void thread_update_accounting(bool user)
-{
-	assert(interrupts_disabled());
-
-	uint64_t time = get_cycle();
-
-	if (user)
-		atomic_time_increment(&THREAD->ucycles, time - THREAD->last_cycle);
-	else
-		atomic_time_increment(&THREAD->kcycles, time - THREAD->last_cycle);
-
-	THREAD->last_cycle = time;
-}
-
-/** Find thread structure corresponding to thread ID.
- *
- * The threads_lock must be already held by the caller of this function and
- * interrupts must be disabled.
- *
- * The returned reference is weak.
- * If the caller needs to keep it, thread_try_ref() must be used to upgrade
- * to a strong reference _before_ threads_lock is released.
- *
- * @param id Thread ID.
- *
- * @return Thread structure address or NULL if there is no such thread ID.
- *
- */
-thread_t *thread_find_by_id(thread_id_t thread_id)
-{
-	thread_t *thread;
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&threads_lock));
-
-	thread = thread_first();
-	while (thread != NULL) {
-		if (thread->tid == thread_id)
-			return thread;
-
-		thread = thread_next(thread);
-	}
-
-	return NULL;
-}
-
-/** Get count of threads.
- *
- * @return Number of threads in the system
- */
-size_t thread_count(void)
-{
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&threads_lock));
-
-	return odict_count(&threads);
-}
-
-/** Get first thread.
- *
- * @return Pointer to first thread or @c NULL if there are none.
- */
-thread_t *thread_first(void)
-{
-	odlink_t *odlink;
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&threads_lock));
-
-	odlink = odict_first(&threads);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, thread_t, lthreads);
-}
-
-/** Get next thread.
- *
- * @param cur Current thread
- * @return Pointer to next thread or @c NULL if there are no more threads.
- */
-thread_t *thread_next(thread_t *cur)
-{
-	odlink_t *odlink;
-
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&threads_lock));
-
-	odlink = odict_next(&cur->lthreads, &threads);
-	if (odlink == NULL)
-		return NULL;
-
-	return odict_get_instance(odlink, thread_t, lthreads);
-}
-
-#ifdef CONFIG_UDEBUG
-
-void thread_stack_trace(thread_id_t thread_id)
-{
-	irq_spinlock_lock(&threads_lock, true);
-	thread_t *thread = thread_try_ref(thread_find_by_id(thread_id));
-	irq_spinlock_unlock(&threads_lock, true);
-
-	if (thread == NULL) {
-		printf("No such thread.\n");
-		return;
-	}
-
-	/*
-	 * Schedule a stack trace to be printed
-	 * just before the thread is scheduled next.
-	 *
-	 * If the thread is sleeping then try to interrupt
-	 * the sleep. Any request for printing an uspace stack
-	 * trace from within the kernel should be always
-	 * considered a last resort debugging means, therefore
-	 * forcing the thread's sleep to be interrupted
-	 * is probably justifiable.
-	 */
-
-	printf("Scheduling thread stack trace.\n");
-	atomic_set_unordered(&thread->btrace, true);
-
-	thread_wakeup(thread);
-	thread_put(thread);
-}
-
-#endif /* CONFIG_UDEBUG */
-
-/** Get key function for the @c threads ordered dictionary.
- *
- * @param odlink Link
- * @return Pointer to thread structure cast as 'void *'
- */
-static void *threads_getkey(odlink_t *odlink)
-{
-	thread_t *thread = odict_get_instance(odlink, thread_t, lthreads);
-	return (void *) thread;
-}
-
-/** Key comparison function for the @c threads ordered dictionary.
- *
- * @param a Pointer to thread A
- * @param b Pointer to thread B
- * @return -1, 0, 1 iff pointer to A is less than, equal to, greater than B
- */
-static int threads_cmp(void *a, void *b)
-{
-	if (a > b)
-		return -1;
-	else if (a == b)
-		return 0;
-	else
-		return +1;
-}
-
-/** Process syscall to create new thread.
- * The started thread will have initial pc and sp set to the exact values passed
- * to the syscall. The kernel will not touch any stack data below the stack
- * pointer, but some architectures may require some space to be available
- * for use above it. See userspace() in kernel, and <libarch/thread.h> in libc.
- *
- */
-sys_errno_t sys_thread_create(sysarg_t pc, sysarg_t sp,
-    uspace_ptr_char uspace_name, size_t name_len)
-{
-	if (name_len > THREAD_NAME_BUFLEN - 1)
-		name_len = THREAD_NAME_BUFLEN - 1;
-
-	char namebuf[THREAD_NAME_BUFLEN];
-	errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len);
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	namebuf[name_len] = 0;
-
-	/*
-	 * In case of failure, kernel_uarg will be deallocated in this function.
-	 * In case of success, kernel_uarg will be freed in uinit().
-	 */
-	uinit_arg_t *kernel_uarg = malloc(sizeof(uinit_arg_t));
-	if (!kernel_uarg)
-		return (sys_errno_t) ENOMEM;
-
-	kernel_uarg->pc = pc;
-	kernel_uarg->sp = sp;
-
-	// TODO: fix some unnecessary inconsistencies between architectures
-
-	thread_t *thread = thread_create(uinit, kernel_uarg, TASK,
-	    THREAD_FLAG_USPACE | THREAD_FLAG_NOATTACH, namebuf);
-	if (!thread) {
-		free(kernel_uarg);
-		return (sys_errno_t) ENOMEM;
-	}
-
-#ifdef CONFIG_UDEBUG
-	/*
-	 * Generate udebug THREAD_B event and attach the thread.
-	 * This must be done atomically (with the debug locks held),
-	 * otherwise we would either miss some thread or receive
-	 * THREAD_B events for threads that already existed
-	 * and could be detected with THREAD_READ before.
-	 */
-	udebug_thread_b_event_attach(thread, TASK);
-#else
-	thread_attach(thread, TASK);
-#endif
-	thread_start(thread);
-	thread_put(thread);
-
-	return (sys_errno_t) EOK;
-}
-
-/** Process syscall to terminate thread.
- *
- */
-sys_errno_t sys_thread_exit(int uspace_status)
-{
-	thread_exit();
-}
-
-/** Syscall for getting TID.
- *
- * @param uspace_thread_id Userspace address of 8-byte buffer where to store
- * current thread ID.
- *
- * @return 0 on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_thread_get_id(uspace_ptr_thread_id_t uspace_thread_id)
-{
-	/*
-	 * No need to acquire lock on THREAD because tid
-	 * remains constant for the lifespan of the thread.
-	 *
-	 */
-	return (sys_errno_t) copy_to_uspace(uspace_thread_id, &THREAD->tid,
-	    sizeof(THREAD->tid));
-}
-
-/** Syscall wrapper for sleeping. */
-sys_errno_t sys_thread_usleep(uint32_t usec)
-{
-	thread_usleep(usec);
-	return 0;
-}
-
-sys_errno_t sys_thread_udelay(uint32_t usec)
-{
-	delay(usec);
-	return 0;
-}
-
-/** @}
- */
Index: rnel/generic/src/security/perm.c
===================================================================
--- kernel/generic/src/security/perm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file perm.c
- * @brief Task permissions control.
- *
- * @see perm.h
- */
-
-#include <security/perm.h>
-#include <proc/task.h>
-#include <synch/spinlock.h>
-#include <syscall/copy.h>
-#include <arch.h>
-#include <errno.h>
-
-/** Set permissions.
- *
- * @param task  Task whose permissions are to be changed.
- * @param perms New set of permissions.
- *
- */
-void perm_set(task_t *task, perm_t perms)
-{
-	irq_spinlock_lock(&task->lock, true);
-	task->perms = perms;
-	irq_spinlock_unlock(&task->lock, true);
-}
-
-/** Get permissions.
- *
- * @param task Task whose permissions are to be returned.
- *
- * @return Task's permissions.
- *
- */
-perm_t perm_get(task_t *task)
-{
-	irq_spinlock_lock(&task->lock, true);
-	perm_t perms = task->perms;
-	irq_spinlock_unlock(&task->lock, true);
-
-	return perms;
-}
-
-/** Grant permissions to a task.
- *
- * The calling task must have the PERM_PERM permission.
- *
- * @param taskid Destination task ID.
- * @param perms   Permissions to grant.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-static errno_t perm_grant(task_id_t taskid, perm_t perms)
-{
-	if (!(perm_get(TASK) & PERM_PERM))
-		return EPERM;
-
-	task_t *task = task_find_by_id(taskid);
-	if (!task)
-		return ENOENT;
-
-	errno_t rc = ENOENT;
-
-	irq_spinlock_lock(&task->lock, true);
-	if (container_check(CONTAINER, task->container)) {
-		task->perms |= perms;
-		rc = EOK;
-	}
-	irq_spinlock_unlock(&task->lock, true);
-
-	task_release(task);
-	return rc;
-}
-
-/** Revoke permissions from a task.
- *
- * The calling task must have the PERM_PERM permission or the caller must
- * attempt to revoke permissions from itself.
- *
- * @param taskid Destination task ID.
- * @param perms   Permissions to revoke.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-static errno_t perm_revoke(task_id_t taskid, perm_t perms)
-{
-	task_t *task = task_find_by_id(taskid);
-	if (!task)
-		return ENOENT;
-
-	/*
-	 * Revoking permissions is different from granting them in that
-	 * a task can revoke permissions from itself even if it
-	 * doesn't have PERM_PERM.
-	 */
-	if (task != TASK && !(perm_get(TASK) & PERM_PERM)) {
-		task_release(task);
-		return EPERM;
-	}
-
-	errno_t rc = ENOENT;
-
-	irq_spinlock_lock(&task->lock, true);
-	if (container_check(CONTAINER, task->container)) {
-		task->perms &= ~perms;
-		rc = EOK;
-	}
-	irq_spinlock_unlock(&task->lock, true);
-
-	task_release(task);
-	return rc;
-}
-
-#ifdef __32_BITS__
-
-/** Grant permissions to a task (32 bits)
- *
- * The calling task must have the PERM_PERM permission.
- *
- * @param uspace_taskid User-space pointer to destination task ID.
- * @param perms         Permissions to grant.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_perm_grant(uspace_ptr_sysarg64_t uspace_taskid, perm_t perms)
-{
-	sysarg64_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return perm_grant((task_id_t) taskid, perms);
-}
-
-/** Revoke permissions from a task (32 bits)
- *
- * The calling task must have the PERM_PERM permission or the caller must
- * attempt to revoke permissions from itself.
- *
- * @param uspace_taskid User-space pointer to destination task ID.
- * @param perms         Perms to revoke.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_perm_revoke(uspace_ptr_sysarg64_t uspace_taskid, perm_t perms)
-{
-	sysarg64_t taskid;
-	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(sysarg64_t));
-	if (rc != EOK)
-		return (sys_errno_t) rc;
-
-	return perm_revoke((task_id_t) taskid, perms);
-}
-
-#endif  /* __32_BITS__ */
-
-#ifdef __64_BITS__
-
-/** Grant permissions to a task (64 bits)
- *
- * The calling task must have the PERM_PERM permission.
- *
- * @param taskid Destination task ID.
- * @param perms  Permissions to grant.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_perm_grant(sysarg_t taskid, perm_t perms)
-{
-	return perm_grant((task_id_t) taskid, perms);
-}
-
-/** Revoke permissions from a task (64 bits)
- *
- * The calling task must have the PERM_PERM permission or the caller must
- * attempt to revoke permissions from itself.
- *
- * @param taskid Destination task ID.
- * @param perms  Permissions to revoke.
- *
- * @return Zero on success or an error code from @ref errno.h.
- *
- */
-sys_errno_t sys_perm_revoke(sysarg_t taskid, perm_t perms)
-{
-	return perm_revoke((task_id_t) taskid, perms);
-}
-
-#endif  /* __64_BITS__ */
-
-/** @}
- */
Index: rnel/generic/src/smp/ipi.c
===================================================================
--- kernel/generic/src/smp/ipi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Generic IPI interface.
- */
-
-#ifdef CONFIG_SMP
-
-#include <smp/ipi.h>
-#include <config.h>
-
-/** Broadcast IPI message
- *
- * Broadcast IPI message to all CPUs.
- *
- * @param ipi Message to broadcast.
- *
- */
-void ipi_broadcast(int ipi)
-{
-	/*
-	 * Provisions must be made to avoid sending IPI:
-	 * - before all CPU's were configured to accept the IPI
-	 * - if there is only one CPU but the kernel was compiled with CONFIG_SMP
-	 */
-
-	if (config.cpu_count > 1)
-		ipi_broadcast_arch(ipi);
-}
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/generic/src/smp/smp.c
===================================================================
--- kernel/generic/src/smp/smp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- */
-
-#include <smp/smp.h>
-
-#ifdef CONFIG_SMP
-
-SEMAPHORE_INITIALIZE(ap_completion_semaphore, 0);
-
-#endif /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/generic/src/synch/condvar.c
===================================================================
--- kernel/generic/src/synch/condvar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief	Condition variables.
- */
-
-#include <synch/condvar.h>
-#include <synch/mutex.h>
-#include <synch/spinlock.h>
-#include <synch/waitq.h>
-#include <arch.h>
-
-/** Initialize condition variable.
- *
- * @param cv		Condition variable.
- */
-void condvar_initialize(condvar_t *cv)
-{
-	*cv = CONDVAR_INITIALIZER(*cv);
-}
-
-/** Signal the condition has become true to the first waiting thread by waking
- * it up.
- *
- * @param cv		Condition variable.
- */
-void condvar_signal(condvar_t *cv)
-{
-	waitq_signal(&cv->wq);
-}
-
-/** Signal the condition has become true to all waiting threads by waking
- * them up.
- *
- * @param cv		Condition variable.
- */
-void condvar_broadcast(condvar_t *cv)
-{
-	waitq_wake_all(&cv->wq);
-}
-
-/** Wait for the condition becoming true.
- *
- * @param cv		Condition variable.
- * @param mtx		Mutex.
- * @param usec		Timeout value in microseconds.
- *
- * @return		See comment for waitq_sleep_timeout().
- */
-errno_t __condvar_wait_timeout_mutex(condvar_t *cv, mutex_t *mtx, uint32_t usec)
-{
-	wait_guard_t guard = waitq_sleep_prepare(&cv->wq);
-
-	/* Unlock only after the waitq is locked so we don't miss a wakeup. */
-	mutex_unlock(mtx);
-
-	errno_t rc = waitq_sleep_timeout_unsafe(&cv->wq, usec, SYNCH_FLAGS_NON_BLOCKING, guard);
-
-	mutex_lock(mtx);
-	return rc;
-}
-
-errno_t __condvar_wait_mutex(condvar_t *cv, mutex_t *mtx)
-{
-	wait_guard_t guard = waitq_sleep_prepare(&cv->wq);
-
-	/* Unlock only after the waitq is locked so we don't miss a wakeup. */
-	mutex_unlock(mtx);
-
-	errno_t rc = waitq_sleep_unsafe(&cv->wq, guard);
-
-	mutex_lock(mtx);
-	return rc;
-}
-
-/** Same as __condvar_wait_timeout_mutex(), except for spinlock_t. */
-errno_t __condvar_wait_timeout_spinlock(condvar_t *cv, spinlock_t *lock,
-    uint32_t usec)
-{
-	wait_guard_t guard = waitq_sleep_prepare(&cv->wq);
-
-	/* Unlock only after the waitq is locked so we don't miss a wakeup. */
-	spinlock_unlock(lock);
-
-	errno_t rc = waitq_sleep_timeout_unsafe(&cv->wq, usec,
-	    SYNCH_FLAGS_NON_BLOCKING, guard);
-
-	spinlock_lock(lock);
-	return rc;
-}
-
-errno_t __condvar_wait_spinlock(condvar_t *cv, spinlock_t *mtx)
-{
-	wait_guard_t guard = waitq_sleep_prepare(&cv->wq);
-
-	/* Unlock only after the waitq is locked so we don't miss a wakeup. */
-	spinlock_unlock(mtx);
-
-	errno_t rc = waitq_sleep_unsafe(&cv->wq, guard);
-
-	spinlock_lock(mtx);
-	return rc;
-}
-
-/** Same as __condvar_wait_timeout_mutex(), except for irq_spinlock_t. */
-errno_t __condvar_wait_timeout_irq_spinlock(condvar_t *cv,
-    irq_spinlock_t *irq_lock, uint32_t usec)
-{
-	errno_t rc;
-	/* Save spinlock's state so we can restore it correctly later on. */
-	ipl_t ipl = irq_lock->ipl;
-	bool guard = irq_lock->guard;
-
-	irq_lock->guard = false;
-
-	/*
-	 * waitq_prepare() restores interrupts to the current state,
-	 * ie disabled. Therefore, interrupts will remain disabled while
-	 * it spins waiting for a pending timeout handler to complete.
-	 * Although it spins with interrupts disabled there can only
-	 * be a pending timeout if we failed to cancel an imminent
-	 * timeout (on another cpu) during a wakeup. As a result the
-	 * timeout handler is guaranteed to run (it is most likely already
-	 * running) and there is no danger of a deadlock.
-	 */
-	rc = __condvar_wait_timeout_spinlock(cv, &irq_lock->lock, usec);
-
-	irq_lock->guard = guard;
-	irq_lock->ipl = ipl;
-
-	return rc;
-}
-
-/** Same as __condvar_wait_mutex(), except for irq_spinlock_t. */
-errno_t __condvar_wait_irq_spinlock(condvar_t *cv, irq_spinlock_t *irq_lock)
-{
-	errno_t rc;
-	/* Save spinlock's state so we can restore it correctly later on. */
-	ipl_t ipl = irq_lock->ipl;
-	bool guard = irq_lock->guard;
-
-	irq_lock->guard = false;
-
-	rc = __condvar_wait_spinlock(cv, &irq_lock->lock);
-
-	irq_lock->guard = guard;
-	irq_lock->ipl = ipl;
-
-	return rc;
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/irq_spinlock.c
===================================================================
--- kernel/generic/src/synch/irq_spinlock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief IRQ Spinlocks.
- */
-
-#include <arch/asm.h>
-#include <synch/spinlock.h>
-
-#include <cpu.h>
-
-#ifdef CONFIG_DEBUG_SPINLOCK
-
-#define CPU_OWNER ((CPU == NULL) ? (cpu_t *) UINTPTR_MAX : CPU)
-
-static inline bool owned_by_me(irq_spinlock_t *lock)
-{
-	return atomic_load_explicit(&lock->owner, memory_order_relaxed) == CPU_OWNER;
-}
-
-static inline bool not_owned_by_me(irq_spinlock_t *lock)
-{
-	return !owned_by_me(lock);
-}
-
-static inline void claim(irq_spinlock_t *lock)
-{
-	cpu_t *cpu = CPU_OWNER;
-	atomic_store_explicit(&lock->owner, cpu, memory_order_relaxed);
-	CURRENT->mutex_locks++;
-}
-
-static inline void unclaim(irq_spinlock_t *lock)
-{
-	CURRENT->mutex_locks--;
-	atomic_store_explicit(&lock->owner, NULL, memory_order_relaxed);
-}
-
-#else
-
-static inline bool owned_by_me(irq_spinlock_t *lock)
-{
-	return true;
-}
-
-static inline bool not_owned_by_me(irq_spinlock_t *lock)
-{
-	return true;
-}
-
-static inline void claim(irq_spinlock_t *lock)
-{
-}
-
-static inline void unclaim(irq_spinlock_t *lock)
-{
-}
-
-#endif
-
-/** Initialize interrupts-disabled spinlock
- *
- * @param lock IRQ spinlock to be initialized.
- * @param name IRQ spinlock name.
- *
- */
-void irq_spinlock_initialize(irq_spinlock_t *lock, const char *name)
-{
-	*lock = (irq_spinlock_t) IRQ_SPINLOCK_INITIALIZER(name);
-}
-
-/** Lock interrupts-disabled spinlock
- *
- * Lock a spinlock which requires disabled interrupts.
- *
- * @param lock    IRQ spinlock to be locked.
- * @param irq_dis If true, disables interrupts before locking the spinlock.
- *                If false, interrupts are expected to be already disabled.
- *
- */
-void irq_spinlock_lock(irq_spinlock_t *lock, bool irq_dis)
-{
-	ASSERT_IRQ_SPINLOCK(not_owned_by_me(lock), lock);
-
-	if (irq_dis) {
-		ipl_t ipl = interrupts_disable();
-		spinlock_lock(&(lock->lock));
-
-		lock->guard = true;
-		lock->ipl = ipl;
-	} else {
-		ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
-
-		spinlock_lock(&(lock->lock));
-		ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
-	}
-
-	claim(lock);
-}
-
-/** Unlock interrupts-disabled spinlock
- *
- * Unlock a spinlock which requires disabled interrupts.
- *
- * @param lock    IRQ spinlock to be unlocked.
- * @param irq_res If true, interrupts are restored to previously
- *                saved interrupt level.
- *
- */
-void irq_spinlock_unlock(irq_spinlock_t *lock, bool irq_res)
-{
-	ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
-	ASSERT_IRQ_SPINLOCK(owned_by_me(lock), lock);
-
-	unclaim(lock);
-
-	if (irq_res) {
-		ASSERT_IRQ_SPINLOCK(lock->guard, lock);
-
-		lock->guard = false;
-		ipl_t ipl = lock->ipl;
-
-		spinlock_unlock(&(lock->lock));
-		interrupts_restore(ipl);
-	} else {
-		ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
-		spinlock_unlock(&(lock->lock));
-	}
-}
-
-/** Lock interrupts-disabled spinlock
- *
- * Lock an interrupts-disabled spinlock conditionally. If the
- * spinlock is not available at the moment, signal failure.
- * Interrupts are expected to be already disabled.
- *
- * @param lock IRQ spinlock to be locked conditionally.
- *
- * @return Zero on failure, non-zero otherwise.
- *
- */
-bool irq_spinlock_trylock(irq_spinlock_t *lock)
-{
-	ASSERT_IRQ_SPINLOCK(interrupts_disabled(), lock);
-	bool ret = spinlock_trylock(&(lock->lock));
-	if (ret)
-		claim(lock);
-
-	ASSERT_IRQ_SPINLOCK((!ret) || (!lock->guard), lock);
-	return ret;
-}
-
-/** Pass lock from one interrupts-disabled spinlock to another
- *
- * Pass lock from one IRQ spinlock to another IRQ spinlock
- * without enabling interrupts during the process.
- *
- * The first IRQ spinlock is supposed to be locked.
- *
- * @param unlock IRQ spinlock to be unlocked.
- * @param lock   IRQ spinlock to be locked.
- *
- */
-void irq_spinlock_pass(irq_spinlock_t *unlock, irq_spinlock_t *lock)
-{
-	ASSERT_IRQ_SPINLOCK(interrupts_disabled(), unlock);
-	ASSERT_IRQ_SPINLOCK(owned_by_me(unlock), unlock);
-	ASSERT_IRQ_SPINLOCK(not_owned_by_me(lock), lock);
-
-	/* Pass guard from unlock to lock */
-	bool guard = unlock->guard;
-	ipl_t ipl = unlock->ipl;
-	unlock->guard = false;
-
-	unclaim(unlock);
-
-	spinlock_unlock(&(unlock->lock));
-	spinlock_lock(&(lock->lock));
-
-	claim(lock);
-
-	ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
-
-	if (guard) {
-		lock->guard = true;
-		lock->ipl = ipl;
-	}
-}
-
-/** Hand-over-hand locking of interrupts-disabled spinlocks
- *
- * Implement hand-over-hand locking between two interrupts-disabled
- * spinlocks without enabling interrupts during the process.
- *
- * The first IRQ spinlock is supposed to be locked.
- *
- * @param unlock IRQ spinlock to be unlocked.
- * @param lock   IRQ spinlock to be locked.
- *
- */
-void irq_spinlock_exchange(irq_spinlock_t *unlock, irq_spinlock_t *lock)
-{
-	ASSERT_IRQ_SPINLOCK(interrupts_disabled(), unlock);
-	ASSERT_IRQ_SPINLOCK(owned_by_me(unlock), unlock);
-	ASSERT_IRQ_SPINLOCK(not_owned_by_me(lock), lock);
-
-	spinlock_lock(&(lock->lock));
-	ASSERT_IRQ_SPINLOCK(!lock->guard, lock);
-
-	/* Pass guard from unlock to lock */
-	if (unlock->guard) {
-		lock->guard = true;
-		lock->ipl = unlock->ipl;
-		unlock->guard = false;
-	}
-
-	claim(lock);
-	unclaim(unlock);
-
-	spinlock_unlock(&(unlock->lock));
-}
-
-/** Find out whether the IRQ spinlock is currently locked.
- *
- * @param lock		IRQ spinlock.
- * @return		True if the IRQ spinlock is locked, false otherwise.
- */
-bool irq_spinlock_locked(irq_spinlock_t *lock)
-{
-	return owned_by_me(lock) && spinlock_locked(&lock->lock);
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/mutex.c
===================================================================
--- kernel/generic/src/synch/mutex.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief Mutexes.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <proc/thread.h>
-#include <stdatomic.h>
-#include <synch/mutex.h>
-#include <synch/semaphore.h>
-
-/** Initialize mutex.
- *
- * @param mtx   Mutex.
- * @param type  Type of the mutex.
- */
-void mutex_initialize(mutex_t *mtx, mutex_type_t type)
-{
-	*mtx = MUTEX_INITIALIZER(*mtx, type);
-}
-
-/** A race in mtx->owner access is unavoidable, so we have to make
- * access to it formally atomic. These are convenience functions to
- * read/write the variable without memory barriers, since we don't need
- * them and C11 atomics default to the strongest possible memory ordering
- * by default, which is utterly ridiculous.
- */
-static inline thread_t *_get_owner(mutex_t *mtx)
-{
-	return atomic_load_explicit(&mtx->owner, memory_order_relaxed);
-}
-
-/** Counterpart to _get_owner(). */
-static inline void _set_owner(mutex_t *mtx, thread_t *owner)
-{
-	atomic_store_explicit(&mtx->owner, owner, memory_order_relaxed);
-}
-
-/** Find out whether the mutex is currently locked.
- *
- * @param mtx  Mutex.
- *
- * @return  True if the mutex is locked, false otherwise.
- */
-bool mutex_locked(mutex_t *mtx)
-{
-	if (!THREAD)
-		return mtx->nesting > 0;
-
-	return _get_owner(mtx) == THREAD;
-}
-
-/** Acquire mutex.
- *
- * This operation is uninterruptible and cannot fail.
- */
-void mutex_lock(mutex_t *mtx)
-{
-	if (!THREAD) {
-		assert(mtx->type == MUTEX_RECURSIVE || mtx->nesting == 0);
-		mtx->nesting++;
-		return;
-	}
-
-	if (_get_owner(mtx) == THREAD) {
-		/* This will also detect nested locks on a non-recursive mutex. */
-		assert(mtx->type == MUTEX_RECURSIVE);
-		assert(mtx->nesting > 0);
-		mtx->nesting++;
-		return;
-	}
-
-	semaphore_down(&mtx->sem);
-
-	_set_owner(mtx, THREAD);
-	assert(mtx->nesting == 0);
-	mtx->nesting = 1;
-}
-
-/** Acquire mutex with timeout.
- *
- * @param mtx    Mutex.
- * @param usec   Timeout in microseconds.
- *
- * @return EOK if lock was successfully acquired, something else otherwise.
- */
-errno_t mutex_lock_timeout(mutex_t *mtx, uint32_t usec)
-{
-	if (!THREAD) {
-		assert(mtx->type == MUTEX_RECURSIVE || mtx->nesting == 0);
-		mtx->nesting++;
-		return EOK;
-	}
-
-	if (_get_owner(mtx) == THREAD) {
-		assert(mtx->type == MUTEX_RECURSIVE);
-		assert(mtx->nesting > 0);
-		mtx->nesting++;
-		return EOK;
-	}
-
-	errno_t rc = semaphore_down_timeout(&mtx->sem, usec);
-	if (rc != EOK)
-		return rc;
-
-	_set_owner(mtx, THREAD);
-	assert(mtx->nesting == 0);
-	mtx->nesting = 1;
-	return EOK;
-}
-
-/** Attempt to acquire mutex without blocking.
- *
- * @return EOK if lock was successfully acquired, something else otherwise.
- */
-errno_t mutex_trylock(mutex_t *mtx)
-{
-	return mutex_lock_timeout(mtx, 0);
-}
-
-/** Release mutex.
- *
- * @param mtx  Mutex.
- */
-void mutex_unlock(mutex_t *mtx)
-{
-	if (--mtx->nesting > 0) {
-		assert(mtx->type == MUTEX_RECURSIVE);
-		return;
-	}
-
-	assert(mtx->nesting == 0);
-
-	if (!THREAD)
-		return;
-
-	assert(_get_owner(mtx) == THREAD);
-	_set_owner(mtx, NULL);
-
-	semaphore_up(&mtx->sem);
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/semaphore.c
===================================================================
--- kernel/generic/src/synch/semaphore.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief Semaphores.
- */
-
-#include <synch/semaphore.h>
-#include <synch/waitq.h>
-#include <synch/spinlock.h>
-#include <arch/asm.h>
-#include <arch.h>
-
-/** Initialize semaphore
- *
- * Initialize semaphore.
- *
- * @param sem Semaphore.
- * @param val Maximal number of threads allowed to enter critical section.
- *
- */
-void semaphore_initialize(semaphore_t *sem, int val)
-{
-	*sem = SEMAPHORE_INITIALIZER(*sem, val);
-}
-
-errno_t semaphore_trydown(semaphore_t *sem)
-{
-	return semaphore_down_timeout(sem, 0);
-}
-
-/** Semaphore down with timeout
- *
- * @param sem   Semaphore.
- * @param usec  Timeout in microseconds.
- *
- * @return See comment for waitq_sleep_timeout().
- *
- */
-errno_t semaphore_down_timeout(semaphore_t *sem, uint32_t usec)
-{
-	errno_t rc = waitq_sleep_timeout(&sem->wq, usec);
-	assert(rc == EOK || rc == ETIMEOUT || rc == EAGAIN);
-	return rc;
-}
-
-void semaphore_down(semaphore_t *sem)
-{
-	errno_t rc = waitq_sleep(&sem->wq);
-	assert(rc == EOK);
-}
-
-/** Semaphore up
- *
- * Semaphore up.
- *
- * @param s Semaphore.
- *
- */
-void semaphore_up(semaphore_t *sem)
-{
-	waitq_wake_one(&sem->wq);
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/smc.c
===================================================================
--- kernel/generic/src/synch/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief	Self-modifying code barriers.
- */
-
-#include <arch.h>
-#include <macros.h>
-#include <errno.h>
-#include <barrier.h>
-#include <synch/smc.h>
-#include <mm/as.h>
-
-sys_errno_t sys_smc_coherence(uintptr_t va, size_t size)
-{
-	if (overlaps(va, size, (uintptr_t) NULL, PAGE_SIZE))
-		return EINVAL;
-
-	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
-		if (overlaps(va, size, KERNEL_ADDRESS_SPACE_START,
-		    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START))
-			return EINVAL;
-	}
-
-	smc_coherence((void *) va, size);
-	return 0;
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2023 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief Spinlocks.
- */
-
-#ifdef CONFIG_SMP
-
-#include <arch/asm.h>
-#include <synch/spinlock.h>
-#include <atomic.h>
-#include <barrier.h>
-#include <arch.h>
-#include <preemption.h>
-#include <stdio.h>
-#include <debug.h>
-#include <symtab.h>
-#include <stacktrace.h>
-#include <cpu.h>
-
-/** Initialize spinlock
- *
- * @param sl Pointer to spinlock_t structure.
- *
- */
-void spinlock_initialize(spinlock_t *lock, const char *name)
-{
-	atomic_flag_clear_explicit(&lock->flag, memory_order_relaxed);
-#ifdef CONFIG_DEBUG_SPINLOCK
-	lock->name = name;
-#endif
-}
-
-/** Lock spinlock
- *
- * @param lock Pointer to spinlock_t structure.
- *
- */
-void spinlock_lock(spinlock_t *lock)
-{
-	preemption_disable();
-
-	bool deadlock_reported = false;
-	size_t i = 0;
-
-	while (atomic_flag_test_and_set_explicit(&lock->flag, memory_order_acquire)) {
-		cpu_spin_hint();
-
-#ifdef CONFIG_DEBUG_SPINLOCK
-		/*
-		 * We need to be careful about particular locks
-		 * which are directly used to report deadlocks
-		 * via printf() (and recursively other functions).
-		 * This concerns especially printf_lock and the
-		 * framebuffer lock.
-		 *
-		 * Any lock whose name is prefixed by "*" will be
-		 * ignored by this deadlock detection routine
-		 * as this might cause an infinite recursion.
-		 * We trust our code that there is no possible deadlock
-		 * caused by these locks (except when an exception
-		 * is triggered for instance by printf()).
-		 *
-		 * We encountered false positives caused by very
-		 * slow framebuffer interaction (especially when
-		 * run in a simulator) that caused problems with both
-		 * printf_lock and the framebuffer lock.
-		 */
-		if (lock->name[0] == '*')
-			continue;
-
-		if (i++ > DEADLOCK_THRESHOLD) {
-			printf("cpu%u: looping on spinlock %p:%s, "
-			    "caller=%p (%s)\n", CPU->id, lock, lock->name,
-			    (void *) CALLER, symtab_fmt_name_lookup(CALLER));
-			stack_trace();
-
-			i = 0;
-			deadlock_reported = true;
-		}
-#endif
-	}
-
-	/* Avoid compiler warning with debug disabled. */
-	(void) i;
-
-	if (deadlock_reported)
-		printf("cpu%u: not deadlocked\n", CPU->id);
-}
-
-/** Unlock spinlock
- *
- * @param sl Pointer to spinlock_t structure.
- */
-void spinlock_unlock(spinlock_t *lock)
-{
-#ifdef CONFIG_DEBUG_SPINLOCK
-	ASSERT_SPINLOCK(spinlock_locked(lock), lock);
-#endif
-
-	atomic_flag_clear_explicit(&lock->flag, memory_order_release);
-	preemption_enable();
-}
-
-/**
- * Lock spinlock conditionally. If the spinlock is not available
- * at the moment, signal failure.
- *
- * @param lock Pointer to spinlock_t structure.
- *
- * @return true on success.
- *
- */
-bool spinlock_trylock(spinlock_t *lock)
-{
-	preemption_disable();
-
-	bool ret = !atomic_flag_test_and_set_explicit(&lock->flag, memory_order_acquire);
-
-	if (!ret)
-		preemption_enable();
-
-	return ret;
-}
-
-/** Find out whether the spinlock is currently locked.
- *
- * @param lock		Spinlock.
- * @return		True if the spinlock is locked, false otherwise.
- */
-bool spinlock_locked(spinlock_t *lock)
-{
-	// NOTE: Atomic flag doesn't support simple atomic read (by design),
-	//       so instead we test_and_set and then clear if necessary.
-	//       This function is only used inside assert, so we don't need
-	//       any preemption_disable/enable here.
-
-	bool ret = atomic_flag_test_and_set_explicit(&lock->flag, memory_order_relaxed);
-	if (!ret)
-		atomic_flag_clear_explicit(&lock->flag, memory_order_relaxed);
-	return ret;
-}
-
-#endif  /* CONFIG_SMP */
-
-/** @}
- */
Index: rnel/generic/src/synch/syswaitq.c
===================================================================
--- kernel/generic/src/synch/syswaitq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief Wrapper for using wait queue as a kobject.
- */
-
-#include <synch/syswaitq.h>
-#include <synch/waitq.h>
-#include <abi/cap.h>
-#include <cap/cap.h>
-#include <mm/slab.h>
-#include <proc/task.h>
-#include <syscall/copy.h>
-
-#include <stdint.h>
-
-static slab_cache_t *waitq_cache;
-
-static void waitq_destroy(void *arg)
-{
-	waitq_t *wq = (waitq_t *) arg;
-	slab_free(waitq_cache, wq);
-}
-
-kobject_ops_t waitq_kobject_ops = {
-	.destroy = waitq_destroy
-};
-
-static bool waitq_cap_cleanup_cb(cap_t *cap, void *arg)
-{
-	kobject_t *kobj = cap_unpublish(cap->task, cap->handle,
-	    KOBJECT_TYPE_WAITQ);
-	kobject_put(kobj);
-	cap_free(cap->task, cap->handle);
-	return true;
-}
-
-/** Initialize the user waitq subsystem */
-void sys_waitq_init(void)
-{
-	waitq_cache = slab_cache_create("waitq_t", sizeof(waitq_t), 0, NULL,
-	    NULL, 0);
-}
-
-/** Clean-up all waitq capabilities held by the exiting task */
-void sys_waitq_task_cleanup(void)
-{
-	caps_apply_to_kobject_type(TASK, KOBJECT_TYPE_WAITQ,
-	    waitq_cap_cleanup_cb, NULL);
-}
-
-/** Create a waitq for the current task
- *
- * @param[out] whandle  Userspace address of the destination buffer that will
- *                      receive the allocated waitq capability.
- *
- * @return              Error code.
- */
-sys_errno_t sys_waitq_create(uspace_ptr_cap_waitq_handle_t whandle)
-{
-	waitq_t *wq = slab_alloc(waitq_cache, FRAME_ATOMIC);
-	if (!wq)
-		return (sys_errno_t) ENOMEM;
-	waitq_initialize(wq);
-
-	kobject_t *kobj = kobject_alloc(0);
-	if (!kobj) {
-		slab_free(waitq_cache, wq);
-		return (sys_errno_t) ENOMEM;
-	}
-	kobject_initialize(kobj, KOBJECT_TYPE_WAITQ, wq);
-
-	cap_handle_t handle;
-	errno_t rc = cap_alloc(TASK, &handle);
-	if (rc != EOK) {
-		slab_free(waitq_cache, wq);
-		kobject_free(kobj);
-		return (sys_errno_t) rc;
-	}
-
-	rc = copy_to_uspace(whandle, &handle, sizeof(handle));
-	if (rc != EOK) {
-		cap_free(TASK, handle);
-		kobject_free(kobj);
-		slab_free(waitq_cache, wq);
-		return (sys_errno_t) rc;
-	}
-
-	cap_publish(TASK, handle, kobj);
-
-	return (sys_errno_t) EOK;
-}
-
-/** Destroy a waitq
- *
- * @param whandle  Waitq capability handle of the waitq to be destroyed.
- *
- * @return         Error code.
- */
-sys_errno_t sys_waitq_destroy(cap_waitq_handle_t whandle)
-{
-	kobject_t *kobj = cap_unpublish(TASK, whandle, KOBJECT_TYPE_WAITQ);
-	if (!kobj)
-		return (sys_errno_t) ENOENT;
-	kobject_put(kobj);
-	cap_free(TASK, whandle);
-	return EOK;
-}
-
-/** Sleep in the waitq
- *
- * @param whandle  Waitq capability handle of the waitq in which to sleep.
- * @param timeout  Timeout in microseconds.
- * @param flags    Flags from SYNCH_FLAGS_* family. SYNCH_FLAGS_INTERRUPTIBLE is
- *                 always implied.
- *
- * @return         Error code.
- */
-sys_errno_t sys_waitq_sleep(cap_waitq_handle_t whandle, uint32_t timeout,
-    unsigned int flags)
-{
-	kobject_t *kobj = kobject_get(TASK, whandle, KOBJECT_TYPE_WAITQ);
-	if (!kobj)
-		return (sys_errno_t) ENOENT;
-
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_begin();
-#endif
-
-	errno_t rc = _waitq_sleep_timeout(kobj->waitq, timeout,
-	    SYNCH_FLAGS_INTERRUPTIBLE | flags);
-
-#ifdef CONFIG_UDEBUG
-	udebug_stoppable_end();
-#endif
-
-	kobject_put(kobj);
-
-	return (sys_errno_t) rc;
-}
-
-/** Wakeup a thread sleeping in the waitq
- *
- * @param whandle  Waitq capability handle of the waitq to invoke wakeup on.
- *
- * @return         Error code.
- */
-sys_errno_t sys_waitq_wakeup(cap_waitq_handle_t whandle)
-{
-	kobject_t *kobj = kobject_get(TASK, whandle, KOBJECT_TYPE_WAITQ);
-	if (!kobj)
-		return (sys_errno_t) ENOENT;
-
-	waitq_wake_one(kobj->waitq);
-
-	kobject_put(kobj);
-	return (sys_errno_t) EOK;
-}
-
-/** @}
- */
Index: rnel/generic/src/synch/waitq.c
===================================================================
--- kernel/generic/src/synch/waitq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,346 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2022 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_sync
- * @{
- */
-
-/**
- * @file
- * @brief Wait queue.
- *
- * Wait queue is the basic synchronization primitive upon which all
- * other synchronization primitives build.
- *
- * It allows threads to wait for an event in first-come, first-served
- * fashion. Conditional operation as well as timeouts and interruptions
- * are supported.
- *
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <synch/waitq.h>
-#include <synch/spinlock.h>
-#include <preemption.h>
-#include <proc/thread.h>
-#include <proc/scheduler.h>
-#include <arch/asm.h>
-#include <typedefs.h>
-#include <time/timeout.h>
-#include <arch.h>
-#include <context.h>
-#include <adt/list.h>
-#include <arch/cycle.h>
-#include <memw.h>
-
-/** Initialize wait queue
- *
- * Initialize wait queue.
- *
- * @param wq Pointer to wait queue to be initialized.
- *
- */
-void waitq_initialize(waitq_t *wq)
-{
-	*wq = WAITQ_INITIALIZER(*wq);
-}
-
-/**
- * Initialize wait queue with an initial number of queued wakeups
- * (or a wakeup debt if negative).
- */
-void waitq_initialize_with_count(waitq_t *wq, int count)
-{
-	*wq = WAITQ_INITIALIZER_WITH_COUNT(*wq, count);
-}
-
-#define PARAM_NON_BLOCKING(flags, usec) \
-	(((flags) & SYNCH_FLAGS_NON_BLOCKING) && ((usec) == 0))
-
-errno_t waitq_sleep(waitq_t *wq)
-{
-	return _waitq_sleep_timeout(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
-}
-
-errno_t waitq_sleep_timeout(waitq_t *wq, uint32_t usec)
-{
-	return _waitq_sleep_timeout(wq, usec, SYNCH_FLAGS_NON_BLOCKING);
-}
-
-/** Sleep until either wakeup, timeout or interruption occurs
- *
- * Sleepers are organised in a FIFO fashion in a structure called wait queue.
- *
- * Other functions as waitq_sleep() and all the *_timeout() functions are
- * implemented using this function.
- *
- * @param wq    Pointer to wait queue.
- * @param usec  Timeout in microseconds.
- * @param flags Specify mode of the sleep.
- *
- * The sleep can be interrupted only if the
- * SYNCH_FLAGS_INTERRUPTIBLE bit is specified in flags.
- *
- * If usec is greater than zero, regardless of the value of the
- * SYNCH_FLAGS_NON_BLOCKING bit in flags, the call will not return until either
- * timeout, interruption or wakeup comes.
- *
- * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is not set in flags,
- * the call will not return until wakeup or interruption comes.
- *
- * If usec is zero and the SYNCH_FLAGS_NON_BLOCKING bit is set in flags, the
- * call will immediately return, reporting either success or failure.
- *
- * @return ETIMEOUT, meaning that the sleep timed out, or a nonblocking call
- *                   returned unsuccessfully.
- * @return EINTR, meaning that somebody interrupted the sleeping thread.
- * @return EOK, meaning that none of the above conditions occured, and the
- *              thread was woken up successfuly by `waitq_wake_*()`.
- *
- */
-errno_t _waitq_sleep_timeout(waitq_t *wq, uint32_t usec, unsigned int flags)
-{
-	assert((!PREEMPTION_DISABLED) || (PARAM_NON_BLOCKING(flags, usec)));
-	return waitq_sleep_timeout_unsafe(wq, usec, flags, waitq_sleep_prepare(wq));
-}
-
-/** Prepare to sleep in a waitq.
- *
- * This function will return holding the lock of the wait queue
- * and interrupts disabled.
- *
- * @param wq Wait queue.
- *
- * @return Interrupt level as it existed on entry to this function.
- *
- */
-wait_guard_t waitq_sleep_prepare(waitq_t *wq)
-{
-	ipl_t ipl = interrupts_disable();
-	irq_spinlock_lock(&wq->lock, false);
-	return (wait_guard_t) {
-		.ipl = ipl,
-	};
-}
-
-errno_t waitq_sleep_unsafe(waitq_t *wq, wait_guard_t guard)
-{
-	return waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE, guard);
-}
-
-/** Internal implementation of waitq_sleep_timeout().
- *
- * This function implements logic of sleeping in a wait queue.
- * This call must be preceded by a call to waitq_sleep_prepare().
- *
- * @param wq    See waitq_sleep_timeout().
- * @param usec  See waitq_sleep_timeout().
- * @param flags See waitq_sleep_timeout().
- *
- * @param[out] blocked  See waitq_sleep_timeout().
- *
- * @return See waitq_sleep_timeout().
- *
- */
-errno_t waitq_sleep_timeout_unsafe(waitq_t *wq, uint32_t usec, unsigned int flags, wait_guard_t guard)
-{
-	errno_t rc;
-
-	/*
-	 * If true, and this thread's sleep returns without a wakeup
-	 * (timed out or interrupted), waitq ignores the next wakeup.
-	 * This is necessary for futex to be able to handle those conditions.
-	 */
-	bool sleep_composable = (flags & SYNCH_FLAGS_FUTEX);
-	bool interruptible = (flags & SYNCH_FLAGS_INTERRUPTIBLE);
-
-	if (wq->closed) {
-		rc = EOK;
-		goto exit;
-	}
-
-	/* Checks whether to go to sleep at all */
-	if (wq->wakeup_balance > 0) {
-		wq->wakeup_balance--;
-
-		rc = EOK;
-		goto exit;
-	}
-
-	if (PARAM_NON_BLOCKING(flags, usec)) {
-		/* Return immediately instead of going to sleep */
-		rc = ETIMEOUT;
-		goto exit;
-	}
-
-	/* Just for debugging output. */
-	atomic_store_explicit(&THREAD->sleep_queue, wq, memory_order_relaxed);
-
-	/*
-	 * This thread_t field is synchronized exclusively via
-	 * waitq lock of the waitq currently listing it.
-	 */
-	list_append(&THREAD->wq_link, &wq->sleepers);
-
-	/* Needs to be run when interrupts are still disabled. */
-	deadline_t deadline = usec > 0 ?
-	    timeout_deadline_in_usec(usec) : DEADLINE_NEVER;
-
-	while (true) {
-		bool terminating = (thread_wait_start() == THREAD_TERMINATING);
-		if (terminating && interruptible) {
-			rc = EINTR;
-			goto exit;
-		}
-
-		irq_spinlock_unlock(&wq->lock, false);
-
-		bool timed_out = (thread_wait_finish(deadline) == THREAD_WAIT_TIMEOUT);
-
-		/*
-		 * We always need to re-lock the WQ, since concurrently running
-		 * waitq_wakeup() may still not have exitted.
-		 * If we didn't always do this, we'd risk waitq_wakeup() that woke us
-		 * up still running on another CPU even after this function returns,
-		 * and that would be an issue if the waitq is allocated locally to
-		 * wait for a one-off asynchronous event. We'd need more external
-		 * synchronization in that case, and that would be a pain.
-		 *
-		 * On the plus side, always regaining a lock simplifies cleanup.
-		 */
-		irq_spinlock_lock(&wq->lock, false);
-
-		if (!link_in_use(&THREAD->wq_link)) {
-			/*
-			 * We were woken up by the desired event. Return success,
-			 * regardless of any concurrent timeout or interruption.
-			 */
-			rc = EOK;
-			goto exit;
-		}
-
-		if (timed_out) {
-			rc = ETIMEOUT;
-			goto exit;
-		}
-
-		/* Interrupted for some other reason. */
-	}
-
-exit:
-	if (THREAD)
-		list_remove(&THREAD->wq_link);
-
-	if (rc != EOK && sleep_composable)
-		wq->wakeup_balance--;
-
-	if (THREAD)
-		atomic_store_explicit(&THREAD->sleep_queue, NULL, memory_order_relaxed);
-
-	irq_spinlock_unlock(&wq->lock, false);
-	interrupts_restore(guard.ipl);
-	return rc;
-}
-
-static void _wake_one(waitq_t *wq)
-{
-	/* Pop one thread from the queue and wake it up. */
-	thread_t *thread = list_get_instance(list_first(&wq->sleepers), thread_t, wq_link);
-	list_remove(&thread->wq_link);
-	thread_wakeup(thread);
-}
-
-/**
- * Meant for implementing condvar signal.
- * Always wakes one thread if there are any sleeping,
- * has no effect if no threads are waiting for wakeup.
- */
-void waitq_signal(waitq_t *wq)
-{
-	irq_spinlock_lock(&wq->lock, true);
-
-	if (!list_empty(&wq->sleepers))
-		_wake_one(wq);
-
-	irq_spinlock_unlock(&wq->lock, true);
-}
-
-/**
- * Wakes up one thread sleeping on this waitq.
- * If there are no threads waiting, saves the wakeup so that the next sleep
- * returns immediately. If a previous failure in sleep created a wakeup debt
- * (see SYNCH_FLAGS_FUTEX) this debt is annulled and no thread is woken up.
- */
-void waitq_wake_one(waitq_t *wq)
-{
-	irq_spinlock_lock(&wq->lock, true);
-
-	if (!wq->closed) {
-		if (wq->wakeup_balance < 0 || list_empty(&wq->sleepers))
-			wq->wakeup_balance++;
-		else
-			_wake_one(wq);
-	}
-
-	irq_spinlock_unlock(&wq->lock, true);
-}
-
-static void _wake_all(waitq_t *wq)
-{
-	while (!list_empty(&wq->sleepers))
-		_wake_one(wq);
-}
-
-/**
- * Wakes up all threads currently waiting on this waitq
- * and makes all future sleeps return instantly.
- */
-void waitq_close(waitq_t *wq)
-{
-	irq_spinlock_lock(&wq->lock, true);
-	wq->wakeup_balance = 0;
-	wq->closed = true;
-	_wake_all(wq);
-	irq_spinlock_unlock(&wq->lock, true);
-}
-
-/**
- * Wakes up all threads currently waiting on this waitq
- */
-void waitq_wake_all(waitq_t *wq)
-{
-	irq_spinlock_lock(&wq->lock, true);
-	wq->wakeup_balance = 0;
-	_wake_all(wq);
-	irq_spinlock_unlock(&wq->lock, true);
-}
-
-/** @}
- */
Index: rnel/generic/src/syscall/copy.c
===================================================================
--- kernel/generic/src/syscall/copy.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief	Copying between kernel and userspace.
- *
- * This file contains sanitized functions for copying data
- * between kernel and userspace.
- */
-
-#include <assert.h>
-#include <syscall/copy.h>
-#include <proc/thread.h>
-#include <mm/as.h>
-#include <macros.h>
-#include <arch.h>
-#include <errno.h>
-
-/** Copy data from userspace to kernel.
- *
- * Provisions are made to return value even after page fault.
- *
- * This function can be called only from syscall.
- *
- * @param dst Destination kernel address.
- * @param uspace_src Source userspace address.
- * @param size Size of the data to be copied.
- *
- * @return EOK on success or an error code from @ref errno.h.
- */
-errno_t copy_from_uspace(void *dst, uspace_addr_t uspace_src, size_t size)
-{
-	ipl_t ipl;
-	errno_t rc;
-
-	assert(THREAD);
-	assert(!THREAD->in_copy_from_uspace);
-
-	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
-		if (overlaps(uspace_src, size,
-		    KERNEL_ADDRESS_SPACE_START,
-		    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START)) {
-			/*
-			 * The userspace source block conflicts with kernel address space.
-			 */
-			return EPERM;
-		}
-	}
-
-#ifdef ADDRESS_SPACE_HOLE_START
-	/*
-	 * Check whether the address is outside the address space hole.
-	 */
-	if (overlaps(uspace_src, size, ADDRESS_SPACE_HOLE_START,
-	    ADDRESS_SPACE_HOLE_END - ADDRESS_SPACE_HOLE_START))
-		return EPERM;
-#endif
-
-	ipl = interrupts_disable();
-	THREAD->in_copy_from_uspace = true;
-
-	rc = !memcpy_from_uspace(dst, uspace_src, size) ? EPERM : EOK;
-
-	THREAD->in_copy_from_uspace = false;
-
-	interrupts_restore(ipl);
-	return rc;
-}
-
-/** Copy data from kernel to userspace.
- *
- * Provisions are made to return value even after page fault.
- *
- * This function can be called only from syscall.
- *
- * @param uspace_dst Destination userspace address.
- * @param src Source kernel address.
- * @param size Size of the data to be copied.
- *
- * @return 0 on success or an error code from @ref errno.h.
- */
-errno_t copy_to_uspace(uspace_addr_t uspace_dst, const void *src, size_t size)
-{
-	ipl_t ipl;
-	errno_t rc;
-
-	assert(THREAD);
-	assert(!THREAD->in_copy_to_uspace);
-
-	if (!KERNEL_ADDRESS_SPACE_SHADOWED) {
-		if (overlaps(uspace_dst, size,
-		    KERNEL_ADDRESS_SPACE_START,
-		    KERNEL_ADDRESS_SPACE_END - KERNEL_ADDRESS_SPACE_START)) {
-			/*
-			 * The userspace destination block conflicts with kernel address space.
-			 */
-			return EPERM;
-		}
-	}
-
-#ifdef ADDRESS_SPACE_HOLE_START
-	/*
-	 * Check whether the address is outside the address space hole.
-	 */
-	if (overlaps(uspace_dst, size, ADDRESS_SPACE_HOLE_START,
-	    ADDRESS_SPACE_HOLE_END - ADDRESS_SPACE_HOLE_START))
-		return EPERM;
-#endif
-
-	ipl = interrupts_disable();
-	THREAD->in_copy_to_uspace = true;
-
-	rc = !memcpy_to_uspace(uspace_dst, src, size) ? EPERM : EOK;
-
-	THREAD->in_copy_to_uspace = false;
-
-	interrupts_restore(ipl);
-	return rc;
-}
-
-/** @}
- */
Index: rnel/generic/src/syscall/syscall.c
===================================================================
--- kernel/generic/src/syscall/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Syscall table and syscall wrappers.
- */
-
-#include <syscall/syscall.h>
-#include <proc/thread.h>
-#include <proc/task.h>
-#include <proc/program.h>
-#include <main/shutdown.h>
-#include <mm/as.h>
-#include <mm/page.h>
-#include <arch.h>
-#include <debug.h>
-#include <interrupt.h>
-#include <ipc/sysipc.h>
-#include <synch/smc.h>
-#include <synch/syswaitq.h>
-#include <ddi/ddi.h>
-#include <ipc/event.h>
-#include <security/perm.h>
-#include <sysinfo/sysinfo.h>
-#include <console/console.h>
-#include <udebug/udebug.h>
-#include <log.h>
-
-static syshandler_t syscall_table[] = {
-	/* System management syscalls. */
-	[SYS_KIO] = (syshandler_t) sys_kio,
-	[SYS_REBOOT] = (syshandler_t) sys_reboot,
-
-	/* Thread and task related syscalls. */
-	[SYS_THREAD_CREATE] = (syshandler_t) sys_thread_create,
-	[SYS_THREAD_EXIT] = (syshandler_t) sys_thread_exit,
-	[SYS_THREAD_GET_ID] = (syshandler_t) sys_thread_get_id,
-	[SYS_THREAD_USLEEP] = (syshandler_t) sys_thread_usleep,
-	[SYS_THREAD_UDELAY] = (syshandler_t) sys_thread_udelay,
-
-	[SYS_TASK_GET_ID] = (syshandler_t) sys_task_get_id,
-	[SYS_TASK_SET_NAME] = (syshandler_t) sys_task_set_name,
-	[SYS_TASK_KILL] = (syshandler_t) sys_task_kill,
-	[SYS_TASK_EXIT] = (syshandler_t) sys_task_exit,
-	[SYS_PROGRAM_SPAWN_LOADER] = (syshandler_t) sys_program_spawn_loader,
-
-	/* Synchronization related syscalls. */
-	[SYS_WAITQ_CREATE] = (syshandler_t) sys_waitq_create,
-	[SYS_WAITQ_SLEEP] = (syshandler_t) sys_waitq_sleep,
-	[SYS_WAITQ_WAKEUP] = (syshandler_t) sys_waitq_wakeup,
-	[SYS_WAITQ_DESTROY] = (syshandler_t) sys_waitq_destroy,
-	[SYS_SMC_COHERENCE] = (syshandler_t) sys_smc_coherence,
-
-	/* Address space related syscalls. */
-	[SYS_AS_AREA_CREATE] = (syshandler_t) sys_as_area_create,
-	[SYS_AS_AREA_RESIZE] = (syshandler_t) sys_as_area_resize,
-	[SYS_AS_AREA_CHANGE_FLAGS] = (syshandler_t) sys_as_area_change_flags,
-	[SYS_AS_AREA_GET_INFO] = (syshandler_t) sys_as_area_get_info,
-	[SYS_AS_AREA_DESTROY] = (syshandler_t) sys_as_area_destroy,
-
-	/* Page mapping related syscalls. */
-	[SYS_PAGE_FIND_MAPPING] = (syshandler_t) sys_page_find_mapping,
-
-	/* IPC related syscalls. */
-	[SYS_IPC_CALL_ASYNC_FAST] = (syshandler_t) sys_ipc_call_async_fast,
-	[SYS_IPC_CALL_ASYNC_SLOW] = (syshandler_t) sys_ipc_call_async_slow,
-	[SYS_IPC_ANSWER_FAST] = (syshandler_t) sys_ipc_answer_fast,
-	[SYS_IPC_ANSWER_SLOW] = (syshandler_t) sys_ipc_answer_slow,
-	[SYS_IPC_FORWARD_FAST] = (syshandler_t) sys_ipc_forward_fast,
-	[SYS_IPC_FORWARD_SLOW] = (syshandler_t) sys_ipc_forward_slow,
-	[SYS_IPC_WAIT] = (syshandler_t) sys_ipc_wait_for_call,
-	[SYS_IPC_POKE] = (syshandler_t) sys_ipc_poke,
-	[SYS_IPC_HANGUP] = (syshandler_t) sys_ipc_hangup,
-	[SYS_IPC_CONNECT_KBOX] = (syshandler_t) sys_ipc_connect_kbox,
-
-	/* Event notification syscalls. */
-	[SYS_IPC_EVENT_SUBSCRIBE] = (syshandler_t) sys_ipc_event_subscribe,
-	[SYS_IPC_EVENT_UNSUBSCRIBE] = (syshandler_t) sys_ipc_event_unsubscribe,
-	[SYS_IPC_EVENT_UNMASK] = (syshandler_t) sys_ipc_event_unmask,
-
-	/* Permission related syscalls. */
-	[SYS_PERM_GRANT] = (syshandler_t) sys_perm_grant,
-	[SYS_PERM_REVOKE] = (syshandler_t) sys_perm_revoke,
-
-	/* DDI related syscalls. */
-	[SYS_PHYSMEM_MAP] = (syshandler_t) sys_physmem_map,
-	[SYS_PHYSMEM_UNMAP] = (syshandler_t) sys_physmem_unmap,
-	[SYS_DMAMEM_MAP] = (syshandler_t) sys_dmamem_map,
-	[SYS_DMAMEM_UNMAP] = (syshandler_t) sys_dmamem_unmap,
-	[SYS_IOSPACE_ENABLE] = (syshandler_t) sys_iospace_enable,
-	[SYS_IOSPACE_DISABLE] = (syshandler_t) sys_iospace_disable,
-
-	[SYS_IPC_IRQ_SUBSCRIBE] = (syshandler_t) sys_ipc_irq_subscribe,
-	[SYS_IPC_IRQ_UNSUBSCRIBE] = (syshandler_t) sys_ipc_irq_unsubscribe,
-
-	/* Sysinfo syscalls. */
-	[SYS_SYSINFO_GET_KEYS_SIZE] = (syshandler_t) sys_sysinfo_get_keys_size,
-	[SYS_SYSINFO_GET_KEYS] = (syshandler_t) sys_sysinfo_get_keys,
-	[SYS_SYSINFO_GET_VAL_TYPE] = (syshandler_t) sys_sysinfo_get_val_type,
-	[SYS_SYSINFO_GET_VALUE] = (syshandler_t) sys_sysinfo_get_value,
-	[SYS_SYSINFO_GET_DATA_SIZE] = (syshandler_t) sys_sysinfo_get_data_size,
-	[SYS_SYSINFO_GET_DATA] = (syshandler_t) sys_sysinfo_get_data,
-
-	/* Kernel console syscalls. */
-	[SYS_DEBUG_CONSOLE] = (syshandler_t) sys_debug_console,
-
-	[SYS_KLOG] = (syshandler_t) sys_klog,
-	[SYS_KIO_READ] = (syshandler_t) sys_kio_read,
-};
-
-/** Dispatch system call */
-sysarg_t syscall_handler(sysarg_t a1, sysarg_t a2, sysarg_t a3,
-    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id)
-{
-	/* Do userpace accounting */
-	ipl_t ipl = interrupts_disable();
-	thread_update_accounting(true);
-	interrupts_restore(ipl);
-
-#ifdef CONFIG_UDEBUG
-	/*
-	 * An istate_t-compatible record was created on the stack by the
-	 * low-level syscall handler. This is the userspace space state
-	 * structure.
-	 */
-	THREAD->udebug.uspace_state = istate_get(THREAD);
-
-	/*
-	 * Early check for undebugged tasks. We do not lock anything as this
-	 * test need not be precise in either direction.
-	 */
-	if (THREAD->udebug.active)
-		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
-#endif
-
-	sysarg_t rc;
-	if (id < sizeof_array(syscall_table)) {
-		rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
-	} else {
-		log(LF_OTHER, LVL_ERROR,
-		    "Task %" PRIu64 ": Unknown syscall %#" PRIxn, TASK->taskid, id);
-		task_kill_self(true);
-	}
-
-	if (THREAD->interrupted)
-		thread_exit();
-
-#ifdef CONFIG_UDEBUG
-	if (THREAD->udebug.active) {
-		udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
-
-		/*
-		 * Stopping point needed for tasks that only invoke
-		 * non-blocking system calls. Not needed if the task
-		 * is not being debugged (it cannot block here).
-		 */
-		udebug_stoppable_begin();
-		udebug_stoppable_end();
-	}
-
-	/* Clear userspace state pointer */
-	THREAD->udebug.uspace_state = NULL;
-#endif
-
-	/* Do kernel accounting */
-	ipl = interrupts_disable();
-	thread_update_accounting(false);
-	interrupts_restore(ipl);
-
-	return rc;
-}
-
-/** @}
- */
Index: rnel/generic/src/sysinfo/stats.c
===================================================================
--- kernel/generic/src/sysinfo/stats.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,861 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <typedefs.h>
-#include <abi/sysinfo.h>
-#include <sysinfo/stats.h>
-#include <sysinfo/sysinfo.h>
-#include <synch/spinlock.h>
-#include <synch/mutex.h>
-#include <time/clock.h>
-#include <mm/frame.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <interrupt.h>
-#include <stdbool.h>
-#include <str.h>
-#include <errno.h>
-#include <cpu.h>
-#include <arch.h>
-#include <stdlib.h>
-
-/** Bits of fixed-point precision for load */
-#define LOAD_FIXED_SHIFT  11
-
-/** Uspace load fixed-point precision */
-#define LOAD_USPACE_SHIFT  6
-
-/** Kernel load shift */
-#define LOAD_KERNEL_SHIFT  (LOAD_FIXED_SHIFT - LOAD_USPACE_SHIFT)
-
-/** 1.0 as fixed-point for load */
-#define LOAD_FIXED_1  (1 << LOAD_FIXED_SHIFT)
-
-/** Compute load in 5 second intervals */
-#define LOAD_INTERVAL  5
-
-/** IPC connections statistics state */
-typedef struct {
-	bool counting;
-	size_t count;
-	size_t i;
-	stats_ipcc_t *data;
-} ipccs_state_t;
-
-/** Fixed-point representation of
- *
- * 1 / exp(5 sec / 1 min)
- * 1 / exp(5 sec / 5 min)
- * 1 / exp(5 sec / 15 min)
- *
- */
-static load_t load_exp[LOAD_STEPS] = { 1884, 2014, 2037 };
-
-/** Running average of the number of ready threads */
-static load_t avenrdy[LOAD_STEPS] = { 0, 0, 0 };
-
-/** Load calculation lock */
-static MUTEX_INITIALIZE(load_lock, MUTEX_PASSIVE);
-
-/** Get statistics of all CPUs
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing several stats_cpu_t structures.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	*size = sizeof(stats_cpu_t) * config.cpu_count;
-	if (dry_run)
-		return NULL;
-
-	/* Assumption: config.cpu_count is constant */
-	stats_cpu_t *stats_cpus = (stats_cpu_t *) malloc(*size);
-	if (stats_cpus == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	size_t i;
-	for (i = 0; i < config.cpu_count; i++) {
-		stats_cpus[i].id = cpus[i].id;
-		stats_cpus[i].active = cpus[i].active;
-		stats_cpus[i].frequency_mhz = cpus[i].frequency_mhz;
-
-		stats_cpus[i].busy_cycles = atomic_time_read(&cpus[i].busy_cycles);
-		stats_cpus[i].idle_cycles = atomic_time_read(&cpus[i].idle_cycles);
-	}
-
-	return ((void *) stats_cpus);
-}
-
-/** Get the size of a virtual address space
- *
- * @param as Address space.
- *
- * @return Size of the mapped virtual address space (bytes).
- *
- */
-static size_t get_task_virtmem(as_t *as)
-{
-	/*
-	 * We are holding spinlocks here and therefore are not allowed to
-	 * block. Only attempt to lock the address space and address space
-	 * area mutexes conditionally. If it is not possible to lock either
-	 * object, return inexact statistics by skipping the respective object.
-	 */
-
-	if (mutex_trylock(&as->lock) != EOK)
-		return 0;
-
-	size_t pages = 0;
-
-	/* Walk areas in the address space and count pages */
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		if (mutex_trylock(&area->lock) != EOK)
-			continue;
-
-		pages += area->pages;
-		mutex_unlock(&area->lock);
-		area = as_area_next(area);
-	}
-
-	mutex_unlock(&as->lock);
-
-	return (pages << PAGE_WIDTH);
-}
-
-/** Get the resident (used) size of a virtual address space
- *
- * @param as Address space.
- *
- * @return Size of the resident (used) virtual address space (bytes).
- *
- */
-static size_t get_task_resmem(as_t *as)
-{
-	/*
-	 * We are holding spinlocks here and therefore are not allowed to
-	 * block. Only attempt to lock the address space and address space
-	 * area mutexes conditionally. If it is not possible to lock either
-	 * object, return inexact statistics by skipping the respective object.
-	 */
-
-	if (mutex_trylock(&as->lock) != EOK)
-		return 0;
-
-	size_t pages = 0;
-
-	/* Walk areas in the address space and count pages */
-	as_area_t *area = as_area_first(as);
-	while (area != NULL) {
-		if (mutex_trylock(&area->lock) != EOK)
-			continue;
-
-		pages += area->used_space.pages;
-		mutex_unlock(&area->lock);
-		area = as_area_next(area);
-	}
-
-	mutex_unlock(&as->lock);
-
-	return (pages << PAGE_WIDTH);
-}
-
-/** Produce task statistics
- *
- * Summarize task information into task statistics.
- *
- * @param task       Task.
- * @param stats_task Task statistics.
- *
- */
-static void produce_stats_task(task_t *task, stats_task_t *stats_task)
-{
-	assert(interrupts_disabled());
-	assert(irq_spinlock_locked(&task->lock));
-
-	stats_task->task_id = task->taskid;
-	str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name);
-	stats_task->virtmem = get_task_virtmem(task->as);
-	stats_task->resmem = get_task_resmem(task->as);
-	stats_task->threads = atomic_load(&task->lifecount);
-	task_get_accounting(task, &(stats_task->ucycles),
-	    &(stats_task->kcycles));
-	stats_task->ipc_info = task->ipc_info;
-}
-
-/** Get task statistics
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing several stats_task_t structures.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	/* Messing with task structures, avoid deadlock */
-	irq_spinlock_lock(&tasks_lock, true);
-
-	/* Count the tasks */
-	size_t count = task_count();
-
-	if (count == 0) {
-		/* No tasks found (strange) */
-		irq_spinlock_unlock(&tasks_lock, true);
-		*size = 0;
-		return NULL;
-	}
-
-	*size = sizeof(stats_task_t) * count;
-	if (dry_run) {
-		irq_spinlock_unlock(&tasks_lock, true);
-		return NULL;
-	}
-
-	stats_task_t *stats_tasks = (stats_task_t *) malloc(*size);
-	if (stats_tasks == NULL) {
-		/* No free space for allocation */
-		irq_spinlock_unlock(&tasks_lock, true);
-		*size = 0;
-		return NULL;
-	}
-
-	/* Gather the statistics for each task */
-	size_t i = 0;
-	task_t *task = task_first();
-	while (task != NULL) {
-		/* Interrupts are already disabled */
-		irq_spinlock_lock(&(task->lock), false);
-
-		/* Record the statistics and increment the index */
-		produce_stats_task(task, &stats_tasks[i]);
-		i++;
-
-		irq_spinlock_unlock(&(task->lock), false);
-		task = task_next(task);
-	}
-
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	return ((void *) stats_tasks);
-}
-
-/** Produce thread statistics
- *
- * Summarize thread information into thread statistics.
- *
- * @param thread       Thread.
- * @param stats_thread Thread statistics.
- *
- */
-static void produce_stats_thread(thread_t *thread, stats_thread_t *stats_thread)
-{
-	assert(interrupts_disabled());
-
-	stats_thread->thread_id = thread->tid;
-	stats_thread->task_id = thread->task->taskid;
-	stats_thread->state = atomic_get_unordered(&thread->state);
-	stats_thread->priority = atomic_get_unordered(&thread->priority);
-	stats_thread->ucycles = atomic_time_read(&thread->ucycles);
-	stats_thread->kcycles = atomic_time_read(&thread->kcycles);
-
-	cpu_t *cpu = atomic_get_unordered(&thread->cpu);
-
-	if (cpu != NULL) {
-		stats_thread->on_cpu = true;
-		stats_thread->cpu = cpu->id;
-	} else
-		stats_thread->on_cpu = false;
-}
-
-/** Get thread statistics
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing several stats_task_t structures.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	/* Messing with threads structures */
-	irq_spinlock_lock(&threads_lock, true);
-
-	/* Count the threads */
-	size_t count = thread_count();
-
-	if (count == 0) {
-		/* No threads found (strange) */
-		irq_spinlock_unlock(&threads_lock, true);
-		*size = 0;
-		return NULL;
-	}
-
-	*size = sizeof(stats_thread_t) * count;
-	if (dry_run) {
-		irq_spinlock_unlock(&threads_lock, true);
-		return NULL;
-	}
-
-	stats_thread_t *stats_threads = (stats_thread_t *) malloc(*size);
-	if (stats_threads == NULL) {
-		/* No free space for allocation */
-		irq_spinlock_unlock(&threads_lock, true);
-		*size = 0;
-		return NULL;
-	}
-
-	/* Walk tha thread tree again to gather the statistics */
-	size_t i = 0;
-
-	thread_t *thread = thread_first();
-	while (thread != NULL) {
-		/* Record the statistics and increment the index */
-		produce_stats_thread(thread, &stats_threads[i]);
-		i++;
-
-		thread = thread_next(thread);
-	}
-
-	irq_spinlock_unlock(&threads_lock, true);
-
-	return ((void *) stats_threads);
-}
-
-/** Produce IPC connection statistics
- *
- * Summarize IPC connection information into IPC connection statistics.
- *
- * @param cap Phone capability.
- * @param arg State variable.
- *
- */
-static bool produce_stats_ipcc_cb(cap_t *cap, void *arg)
-{
-	phone_t *phone = cap->kobject->phone;
-	ipccs_state_t *state = (ipccs_state_t *) arg;
-
-	if (state->counting) {
-		/*
-		 * Simply update the number of entries
-		 * in case we are in the counting mode.
-		 */
-
-		state->count++;
-		return true;
-	}
-
-	/* We are in the gathering mode */
-
-	if ((state->data == NULL) || (state->i >= state->count)) {
-		/*
-		 * Do nothing if we have no buffer
-		 * to store the data to (meaning we are
-		 * in a dry run) or the buffer is already
-		 * full.
-		 */
-
-		return true;
-	}
-
-	mutex_lock(&phone->lock);
-
-	if (phone->state == IPC_PHONE_CONNECTED) {
-		state->data[state->i].caller = phone->caller->taskid;
-		state->data[state->i].callee = phone->callee->task->taskid;
-		state->i++;
-	}
-
-	mutex_unlock(&phone->lock);
-
-	return true;
-}
-
-/** Get IPC connections statistics
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing several stats_ipccs_t structures.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- *
- */
-static void *get_stats_ipccs(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	/* Messing with tasks structures, avoid deadlock */
-	irq_spinlock_lock(&tasks_lock, true);
-
-	ipccs_state_t state = {
-		.counting = true,
-		.count = 0,
-		.i = 0,
-		.data = NULL
-	};
-
-	/* Compute the number of IPC connections */
-	task_t *task = task_first();
-	while (task != NULL) {
-		task_hold(task);
-		irq_spinlock_unlock(&tasks_lock, true);
-
-		caps_apply_to_kobject_type(task, KOBJECT_TYPE_PHONE,
-		    produce_stats_ipcc_cb, &state);
-
-		irq_spinlock_lock(&tasks_lock, true);
-
-		task = task_next(task);
-	}
-
-	state.counting = false;
-	*size = sizeof(stats_ipcc_t) * state.count;
-
-	if (!dry_run)
-		state.data = (stats_ipcc_t *) malloc(*size);
-
-	/* Gather the statistics for each task */
-	task = task_first();
-	while (task != NULL) {
-		/* We already hold a reference to the task */
-		irq_spinlock_unlock(&tasks_lock, true);
-
-		caps_apply_to_kobject_type(task, KOBJECT_TYPE_PHONE,
-		    produce_stats_ipcc_cb, &state);
-
-		irq_spinlock_lock(&tasks_lock, true);
-
-		task_t *prev_task = task;
-		task = task_next(prev_task);
-		task_release(prev_task);
-	}
-
-	irq_spinlock_unlock(&tasks_lock, true);
-
-	return ((void *) state.data);
-}
-
-/** Get a single task statistics
- *
- * Get statistics of a given task. The task ID is passed
- * as a string (current limitation of the sysinfo interface,
- * but it is still reasonable for the given purpose).
- *
- * @param name    Task ID (string-encoded number).
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Sysinfo return holder. The type of the returned
- *         data is either SYSINFO_VAL_UNDEFINED (unknown
- *         task ID or memory allocation error) or
- *         SYSINFO_VAL_FUNCTION_DATA (in that case the
- *         generated data should be freed within the
- *         sysinfo request context).
- *
- */
-static sysinfo_return_t get_stats_task(const char *name, bool dry_run,
-    void *data)
-{
-	/* Initially no return value */
-	sysinfo_return_t ret = {
-		.tag = SYSINFO_VAL_UNDEFINED,
-	};
-
-	/* Parse the task ID */
-	task_id_t task_id;
-	if (str_uint64_t(name, NULL, 0, true, &task_id) != EOK)
-		return ret;
-
-	task_t *task = task_find_by_id(task_id);
-	if (!task)
-		return ret;
-
-	if (dry_run) {
-		ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-		ret.data.data = NULL;
-		ret.data.size = sizeof(stats_task_t);
-	} else {
-		/* Allocate stats_task_t structure */
-		stats_task_t *stats_task = malloc(sizeof(stats_task_t));
-
-		if (stats_task != NULL) {
-			/* Correct return value */
-			ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-			ret.data.data = stats_task;
-			ret.data.size = sizeof(stats_task_t);
-
-			irq_spinlock_lock(&task->lock, true);
-			produce_stats_task(task, stats_task);
-			irq_spinlock_unlock(&task->lock, true);
-		}
-	}
-
-	task_release(task);
-	return ret;
-}
-
-/** Get thread statistics
- *
- * Get statistics of a given thread. The thread ID is passed
- * as a string (current limitation of the sysinfo interface,
- * but it is still reasonable for the given purpose).
- *
- * @param name    Thread ID (string-encoded number).
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Sysinfo return holder. The type of the returned
- *         data is either SYSINFO_VAL_UNDEFINED (unknown
- *         thread ID or memory allocation error) or
- *         SYSINFO_VAL_FUNCTION_DATA (in that case the
- *         generated data should be freed within the
- *         sysinfo request context).
- *
- */
-static sysinfo_return_t get_stats_thread(const char *name, bool dry_run,
-    void *data)
-{
-	/* Initially no return value */
-	sysinfo_return_t ret;
-	ret.tag = SYSINFO_VAL_UNDEFINED;
-
-	/* Parse the thread ID */
-	thread_id_t thread_id;
-	if (str_uint64_t(name, NULL, 0, true, &thread_id) != EOK)
-		return ret;
-
-	/* Messing with threads structures */
-	irq_spinlock_lock(&threads_lock, true);
-
-	thread_t *thread = thread_find_by_id(thread_id);
-	if (thread == NULL) {
-		/* No thread with this ID */
-		irq_spinlock_unlock(&threads_lock, true);
-		return ret;
-	}
-
-	if (dry_run) {
-		ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-		ret.data.data = NULL;
-		ret.data.size = sizeof(stats_thread_t);
-
-		irq_spinlock_unlock(&threads_lock, true);
-	} else {
-		/* Allocate stats_thread_t structure */
-		stats_thread_t *stats_thread =
-		    (stats_thread_t *) malloc(sizeof(stats_thread_t));
-		if (stats_thread == NULL) {
-			irq_spinlock_unlock(&threads_lock, true);
-			return ret;
-		}
-
-		/* Correct return value */
-		ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-		ret.data.data = (void *) stats_thread;
-		ret.data.size = sizeof(stats_thread_t);
-
-		produce_stats_thread(thread, stats_thread);
-
-		irq_spinlock_unlock(&threads_lock, true);
-	}
-
-	return ret;
-}
-
-/** Get exceptions statistics
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing several stats_exc_t structures.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	*size = sizeof(stats_exc_t) * IVT_ITEMS;
-
-	if ((dry_run) || (IVT_ITEMS == 0))
-		return NULL;
-
-	stats_exc_t *stats_exceptions =
-	    (stats_exc_t *) malloc(*size);
-	if (stats_exceptions == NULL) {
-		/* No free space for allocation */
-		*size = 0;
-		return NULL;
-	}
-
-#if (IVT_ITEMS > 0)
-	/* Messing with exception table, avoid deadlock */
-	irq_spinlock_lock(&exctbl_lock, true);
-
-	unsigned int i;
-	for (i = 0; i < IVT_ITEMS; i++) {
-		stats_exceptions[i].id = i + IVT_FIRST;
-		str_cpy(stats_exceptions[i].desc, EXC_NAME_BUFLEN, exc_table[i].name);
-		stats_exceptions[i].hot = exc_table[i].hot;
-		stats_exceptions[i].cycles = exc_table[i].cycles;
-		stats_exceptions[i].count = exc_table[i].count;
-	}
-
-	irq_spinlock_unlock(&exctbl_lock, true);
-#endif
-
-	return ((void *) stats_exceptions);
-}
-
-/** Get exception statistics
- *
- * Get statistics of a given exception. The exception number
- * is passed as a string (current limitation of the sysinfo
- * interface, but it is still reasonable for the given purpose).
- *
- * @param name    Exception number (string-encoded number).
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Sysinfo return holder. The type of the returned
- *         data is either SYSINFO_VAL_UNDEFINED (unknown
- *         exception number or memory allocation error) or
- *         SYSINFO_VAL_FUNCTION_DATA (in that case the
- *         generated data should be freed within the
- *         sysinfo request context).
- *
- */
-static sysinfo_return_t get_stats_exception(const char *name, bool dry_run,
-    void *data)
-{
-	/* Initially no return value */
-	sysinfo_return_t ret;
-	ret.tag = SYSINFO_VAL_UNDEFINED;
-
-	/* Parse the exception number */
-	uint64_t excn;
-	if (str_uint64_t(name, NULL, 0, true, &excn) != EOK)
-		return ret;
-
-#if (IVT_FIRST > 0)
-	if (excn < IVT_FIRST)
-		return ret;
-#endif
-
-#if (IVT_ITEMS + IVT_FIRST == 0)
-	return ret;
-#else
-	if (excn >= IVT_ITEMS + IVT_FIRST)
-		return ret;
-#endif
-
-	if (dry_run) {
-		ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-		ret.data.data = NULL;
-		ret.data.size = sizeof(stats_thread_t);
-	} else {
-		/* Update excn index for accessing exc_table */
-		excn -= IVT_FIRST;
-
-		/* Allocate stats_exc_t structure */
-		stats_exc_t *stats_exception =
-		    (stats_exc_t *) malloc(sizeof(stats_exc_t));
-		if (stats_exception == NULL)
-			return ret;
-
-		/* Messing with exception table, avoid deadlock */
-		irq_spinlock_lock(&exctbl_lock, true);
-
-		/* Correct return value */
-		ret.tag = SYSINFO_VAL_FUNCTION_DATA;
-		ret.data.data = (void *) stats_exception;
-		ret.data.size = sizeof(stats_exc_t);
-
-		stats_exception->id = excn;
-		str_cpy(stats_exception->desc, EXC_NAME_BUFLEN, exc_table[excn].name);
-		stats_exception->hot = exc_table[excn].hot;
-		stats_exception->cycles = exc_table[excn].cycles;
-		stats_exception->count = exc_table[excn].count;
-
-		irq_spinlock_unlock(&exctbl_lock, true);
-	}
-
-	return ret;
-}
-
-/** Get physical memory statistics
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data containing stats_physmem_t.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	*size = sizeof(stats_physmem_t);
-	if (dry_run)
-		return NULL;
-
-	stats_physmem_t *stats_physmem =
-	    (stats_physmem_t *) malloc(*size);
-	if (stats_physmem == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	zones_stats(&(stats_physmem->total), &(stats_physmem->unavail),
-	    &(stats_physmem->used), &(stats_physmem->free));
-
-	return ((void *) stats_physmem);
-}
-
-/** Get system load
- *
- * @param item    Sysinfo item (unused).
- * @param size    Size of the returned data.
- * @param dry_run Do not get the data, just calculate the size.
- * @param data    Unused.
- *
- * @return Data several load_t values.
- *         If the return value is not NULL, it should be freed
- *         in the context of the sysinfo request.
- */
-static void *get_stats_load(struct sysinfo_item *item, size_t *size,
-    bool dry_run, void *data)
-{
-	*size = sizeof(load_t) * LOAD_STEPS;
-	if (dry_run)
-		return NULL;
-
-	load_t *stats_load = (load_t *) malloc(*size);
-	if (stats_load == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	/* To always get consistent values acquire the mutex */
-	mutex_lock(&load_lock);
-
-	unsigned int i;
-	for (i = 0; i < LOAD_STEPS; i++)
-		stats_load[i] = avenrdy[i] << LOAD_KERNEL_SHIFT;
-
-	mutex_unlock(&load_lock);
-
-	return ((void *) stats_load);
-}
-
-/** Calculate load
- *
- */
-static inline load_t load_calc(load_t load, load_t exp, size_t ready)
-{
-	load *= exp;
-	load += (ready << LOAD_FIXED_SHIFT) * (LOAD_FIXED_1 - exp);
-
-	return (load >> LOAD_FIXED_SHIFT);
-}
-
-/** Load computation thread.
- *
- * Compute system load every few seconds.
- *
- * @param arg Unused.
- *
- */
-void kload(void *arg)
-{
-	while (true) {
-		size_t ready = atomic_load(&nrdy);
-
-		/* Mutually exclude with get_stats_load() */
-		mutex_lock(&load_lock);
-
-		unsigned int i;
-		for (i = 0; i < LOAD_STEPS; i++)
-			avenrdy[i] = load_calc(avenrdy[i], load_exp[i], ready);
-
-		mutex_unlock(&load_lock);
-
-		thread_sleep(LOAD_INTERVAL);
-	}
-}
-
-/** Register sysinfo statistical items
- *
- */
-void stats_init(void)
-{
-	sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL);
-	sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL);
-	sysinfo_set_item_gen_data("system.load", NULL, get_stats_load, NULL);
-	sysinfo_set_item_gen_data("system.tasks", NULL, get_stats_tasks, NULL);
-	sysinfo_set_item_gen_data("system.threads", NULL, get_stats_threads, NULL);
-	sysinfo_set_item_gen_data("system.ipccs", NULL, get_stats_ipccs, NULL);
-	sysinfo_set_item_gen_data("system.exceptions", NULL, get_stats_exceptions, NULL);
-	sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL);
-	sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL);
-	sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL);
-}
-
-/** @}
- */
Index: rnel/generic/src/sysinfo/sysinfo.c
===================================================================
--- kernel/generic/src/sysinfo/sysinfo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1063 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <arch/asm.h>
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <mm/slab.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <synch/mutex.h>
-#include <syscall/copy.h>
-#include <sysinfo/sysinfo.h>
-
-/** Maximal sysinfo path length */
-#define SYSINFO_MAX_PATH  2048
-
-bool fb_exported = false;
-
-/** Global sysinfo tree root item */
-static sysinfo_item_t *global_root = NULL;
-
-/** Sysinfo SLAB cache */
-static slab_cache_t *sysinfo_item_cache;
-
-/** Sysinfo lock */
-static MUTEX_INITIALIZE(sysinfo_lock, MUTEX_PASSIVE);
-
-/** Sysinfo item constructor
- *
- */
-_NO_TRACE static errno_t sysinfo_item_constructor(void *obj, unsigned int kmflag)
-{
-	sysinfo_item_t *item = (sysinfo_item_t *) obj;
-
-	item->name = NULL;
-	item->val_type = SYSINFO_VAL_UNDEFINED;
-	item->subtree_type = SYSINFO_SUBTREE_NONE;
-	item->subtree.table = NULL;
-	item->next = NULL;
-
-	return EOK;
-}
-
-/** Sysinfo item destructor
- *
- * Note that the return value is not perfectly correct
- * since more space might get actually freed thanks
- * to the disposal of item->name
- *
- */
-_NO_TRACE static size_t sysinfo_item_destructor(void *obj)
-{
-	sysinfo_item_t *item = (sysinfo_item_t *) obj;
-
-	if (item->name != NULL)
-		free(item->name);
-
-	return 0;
-}
-
-/** Initialize sysinfo subsystem
- *
- * Create SLAB cache for sysinfo items.
- *
- */
-void sysinfo_init(void)
-{
-	sysinfo_item_cache = slab_cache_create("sysinfo_item_t",
-	    sizeof(sysinfo_item_t), 0, sysinfo_item_constructor,
-	    sysinfo_item_destructor, SLAB_CACHE_MAGDEFERRED);
-}
-
-/** Recursively find an item in sysinfo tree
- *
- * Should be called with sysinfo_lock held.
- *
- * @param name    Current sysinfo path suffix.
- * @param subtree Current sysinfo (sub)tree root item.
- * @param ret     If the return value is NULL, this argument
- *                can be set either to NULL (i.e. no item was
- *                found and no data was generated) or the
- *                original pointer is used to store the value
- *                generated by a generated subtree function.
- * @param dry_run Do not actually get any generated
- *                binary data, just calculate the size.
- *
- * @return Found item or NULL if no item in the fixed tree
- *         was found (N.B. ret).
- *
- */
-_NO_TRACE static sysinfo_item_t *sysinfo_find_item(const char *name,
-    sysinfo_item_t *subtree, sysinfo_return_t **ret, bool dry_run)
-{
-	assert(subtree != NULL);
-
-	sysinfo_item_t *cur = subtree;
-
-	/* Walk all siblings */
-	while (cur != NULL) {
-		size_t i = 0;
-
-		/* Compare name with path */
-		while ((cur->name[i] != 0) && (name[i] == cur->name[i]))
-			i++;
-
-		/* Check for perfect name and path match */
-		if ((name[i] == 0) && (cur->name[i] == 0))
-			return cur;
-
-		/* Partial match up to the delimiter */
-		if ((name[i] == '.') && (cur->name[i] == 0)) {
-			/* Look into the subtree */
-			switch (cur->subtree_type) {
-			case SYSINFO_SUBTREE_TABLE:
-				/* Recursively find in subtree */
-				return sysinfo_find_item(name + i + 1,
-				    cur->subtree.table, ret, dry_run);
-			case SYSINFO_SUBTREE_FUNCTION:
-				/* Get generated data */
-				if (ret != NULL)
-					**ret = cur->subtree.generator.fn(name + i + 1,
-					    dry_run, cur->subtree.generator.data);
-
-				return NULL;
-			default:
-				/* Not found, no data generated */
-				if (ret != NULL)
-					*ret = NULL;
-
-				return NULL;
-			}
-		}
-
-		cur = cur->next;
-	}
-
-	/* Not found, no data generated */
-	if (ret != NULL)
-		*ret = NULL;
-
-	return NULL;
-}
-
-/** Recursively create items in sysinfo tree
- *
- * Should be called with sysinfo_lock held.
- *
- * @param name     Current sysinfo path suffix.
- * @param psubtree Pointer to an already existing (sub)tree root
- *                 item or where to store a new tree root item.
- *
- * @return Existing or newly allocated sysinfo item or NULL
- *         if the current tree configuration does not allow to
- *         create a new item.
- *
- */
-_NO_TRACE static sysinfo_item_t *sysinfo_create_path(const char *name,
-    sysinfo_item_t **psubtree)
-{
-	assert(psubtree != NULL);
-
-	if (*psubtree == NULL) {
-		/* No parent */
-
-		size_t i = 0;
-
-		/* Find the first delimiter in name */
-		while ((name[i] != 0) && (name[i] != '.'))
-			i++;
-
-		*psubtree =
-		    (sysinfo_item_t *) slab_alloc(sysinfo_item_cache, FRAME_ATOMIC);
-		if (!*psubtree)
-			return NULL;
-
-		/* Fill in item name up to the delimiter */
-		(*psubtree)->name = str_ndup(name, i);
-		if (!(*psubtree)->name) {
-			slab_free(sysinfo_item_cache, *psubtree);
-			return NULL;
-		}
-
-		/* Create subtree items */
-		if (name[i] == '.') {
-			(*psubtree)->subtree_type = SYSINFO_SUBTREE_TABLE;
-			sysinfo_item_t *item = sysinfo_create_path(name + i + 1,
-			    &((*psubtree)->subtree.table));
-			if (!item) {
-				free((*psubtree)->name);
-				slab_free(sysinfo_item_cache, *psubtree);
-			}
-			return item;
-		}
-
-		/* No subtree needs to be created */
-		return *psubtree;
-	}
-
-	sysinfo_item_t *cur = *psubtree;
-
-	/* Walk all siblings */
-	while (cur != NULL) {
-		size_t i = 0;
-
-		/* Compare name with path */
-		while ((cur->name[i] != 0) && (name[i] == cur->name[i]))
-			i++;
-
-		/*
-		 * Check for perfect name and path match
-		 * -> item is already present.
-		 */
-		if ((name[i] == 0) && (cur->name[i] == 0))
-			return cur;
-
-		/* Partial match up to the delimiter */
-		if ((name[i] == '.') && (cur->name[i] == 0)) {
-			switch (cur->subtree_type) {
-			case SYSINFO_SUBTREE_NONE:
-				/* No subtree yet, create one */
-				cur->subtree_type = SYSINFO_SUBTREE_TABLE;
-				return sysinfo_create_path(name + i + 1,
-				    &(cur->subtree.table));
-			case SYSINFO_SUBTREE_TABLE:
-				/* Subtree already created, add new sibling */
-				return sysinfo_create_path(name + i + 1,
-				    &(cur->subtree.table));
-			default:
-				/*
-				 * Subtree items handled by a function, this
-				 * cannot be overriden by a constant item.
-				 */
-				return NULL;
-			}
-		}
-
-		/*
-		 * No match and no more siblings to check
-		 * -> create a new sibling item.
-		 */
-		if (cur->next == NULL) {
-			/* Find the first delimiter in name */
-			i = 0;
-			while ((name[i] != 0) && (name[i] != '.'))
-				i++;
-
-			sysinfo_item_t *item =
-			    (sysinfo_item_t *) slab_alloc(sysinfo_item_cache, FRAME_ATOMIC);
-			if (!item)
-				return NULL;
-
-			cur->next = item;
-
-			/* Fill in item name up to the delimiter */
-			item->name = str_ndup(name, i);
-			if (!item->name) {
-				slab_free(sysinfo_item_cache, item);
-				return NULL;
-			}
-
-			/* Create subtree items */
-			if (name[i] == '.') {
-				item->subtree_type = SYSINFO_SUBTREE_TABLE;
-				sysinfo_item_t *sub = sysinfo_create_path(
-				    name + i + 1, &(item->subtree.table));
-				if (!sub) {
-					free(item->name);
-					slab_free(sysinfo_item_cache, item);
-					return NULL;
-				}
-				return sub;
-			}
-
-			/* No subtree needs to be created */
-			return item;
-		}
-
-		cur = cur->next;
-	}
-
-	unreachable();
-}
-
-/** Set sysinfo item with a constant numeric value
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- * @param val  Value to store in the item.
- *
- */
-void sysinfo_set_item_val(const char *name, sysinfo_item_t **root,
-    sysarg_t val)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-	if (item != NULL) {
-		item->val_type = SYSINFO_VAL_VAL;
-		item->val.val = val;
-	} else {
-		printf("Could not set sysinfo item %s.\n", name);
-	}
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Set sysinfo item with a constant binary data
- *
- * Note that sysinfo only stores the pointer to the
- * binary data and does not touch it in any way. The
- * data should be static and immortal.
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- * @param data Binary data.
- * @param size Size of the binary data.
- *
- */
-void sysinfo_set_item_data(const char *name, sysinfo_item_t **root,
-    void *data, size_t size)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-	if (item != NULL) {
-		item->val_type = SYSINFO_VAL_DATA;
-		item->val.data.data = data;
-		item->val.data.size = size;
-	} else {
-		printf("Could not set sysinfo item %s.\n", name);
-	}
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Set sysinfo item with a generated numeric value
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- * @param fn   Numeric value generator function.
- * @param data Private data.
- *
- */
-void sysinfo_set_item_gen_val(const char *name, sysinfo_item_t **root,
-    sysinfo_fn_val_t fn, void *data)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-	if (item != NULL) {
-		item->val_type = SYSINFO_VAL_FUNCTION_VAL;
-		item->val.gen_val.fn = fn;
-		item->val.gen_val.data = data;
-	} else {
-		printf("Could not set sysinfo item %s.\n", name);
-	}
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Set sysinfo item with a generated binary data
- *
- * Note that each time the generator function is called
- * it is supposed to return a new dynamically allocated
- * data. This data is then freed by sysinfo in the context
- * of the current sysinfo request.
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- * @param fn   Binary data generator function.
- * @param data Private data.
- *
- */
-void sysinfo_set_item_gen_data(const char *name, sysinfo_item_t **root,
-    sysinfo_fn_data_t fn, void *data)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-	if (item != NULL) {
-		item->val_type = SYSINFO_VAL_FUNCTION_DATA;
-		item->val.gen_data.fn = fn;
-		item->val.gen_data.data = data;
-	} else {
-		printf("Could not set sysinfo item %s.\n", name);
-	}
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Set sysinfo item with an undefined value
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- *
- */
-void sysinfo_set_item_undefined(const char *name, sysinfo_item_t **root)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-	if (item != NULL)
-		item->val_type = SYSINFO_VAL_UNDEFINED;
-	else
-		printf("Could not set sysinfo item %s.\n", name);
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Set sysinfo item with a generated subtree
- *
- * @param name Sysinfo path.
- * @param root Pointer to the root item or where to store
- *             a new root item (NULL for global sysinfo root).
- * @param fn   Subtree generator function.
- * @param data Private data to be passed to the generator.
- *
- */
-void sysinfo_set_subtree_fn(const char *name, sysinfo_item_t **root,
-    sysinfo_fn_subtree_t fn, void *data)
-{
-	/* Protect sysinfo tree consistency */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *item = sysinfo_create_path(name, root);
-
-	/*
-	 * Change the type of the subtree only if it is not already
-	 * a fixed subtree
-	 */
-	if ((item != NULL) && (item->subtree_type != SYSINFO_SUBTREE_TABLE)) {
-		item->subtree_type = SYSINFO_SUBTREE_FUNCTION;
-		item->subtree.generator.fn = fn;
-		item->subtree.generator.data = data;
-	} else {
-		printf("Could not set sysinfo item %s.\n", name);
-	}
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Sysinfo dump indentation helper routine
- *
- * @param depth Number of spaces to print.
- *
- */
-_NO_TRACE static void sysinfo_indent(size_t spaces)
-{
-	for (size_t i = 0; i < spaces; i++)
-		printf(" ");
-}
-
-/** Dump the structure of sysinfo tree
- *
- * Should be called with sysinfo_lock held.
- *
- * @param root   Root item of the current (sub)tree.
- * @param spaces Current indentation level.
- *
- */
-_NO_TRACE static void sysinfo_dump_internal(sysinfo_item_t *root, size_t spaces)
-{
-	/* Walk all siblings */
-	for (sysinfo_item_t *cur = root; cur; cur = cur->next) {
-		size_t length;
-
-		if (spaces == 0) {
-			printf("%s", cur->name);
-			length = str_length(cur->name);
-		} else {
-			sysinfo_indent(spaces);
-			printf(".%s", cur->name);
-			length = str_length(cur->name) + 1;
-		}
-
-		sysarg_t val;
-		size_t size;
-
-		/* Display node value and type */
-		switch (cur->val_type) {
-		case SYSINFO_VAL_UNDEFINED:
-			printf(" [undefined]\n");
-			break;
-		case SYSINFO_VAL_VAL:
-			printf(" -> %" PRIun " (%#" PRIxn ")\n", cur->val.val,
-			    cur->val.val);
-			break;
-		case SYSINFO_VAL_DATA:
-			printf(" (%zu bytes)\n", cur->val.data.size);
-			break;
-		case SYSINFO_VAL_FUNCTION_VAL:
-			val = cur->val.gen_val.fn(cur, cur->val.gen_val.data);
-			printf(" -> %" PRIun " (%#" PRIxn ") [generated]\n", val,
-			    val);
-			break;
-		case SYSINFO_VAL_FUNCTION_DATA:
-			/* N.B.: No data was actually returned (only a dry run) */
-			(void) cur->val.gen_data.fn(cur, &size, true,
-			    cur->val.gen_data.data);
-			printf(" (%zu bytes) [generated]\n", size);
-			break;
-		default:
-			printf("+ %s [unknown]\n", cur->name);
-		}
-
-		/* Recursivelly nest into the subtree */
-		switch (cur->subtree_type) {
-		case SYSINFO_SUBTREE_NONE:
-			break;
-		case SYSINFO_SUBTREE_TABLE:
-			sysinfo_dump_internal(cur->subtree.table, spaces + length);
-			break;
-		case SYSINFO_SUBTREE_FUNCTION:
-			sysinfo_indent(spaces + length);
-			printf("<generated subtree>\n");
-			break;
-		default:
-			sysinfo_indent(spaces + length);
-			printf("<unknown subtree>\n");
-		}
-	}
-}
-
-/** Dump the structure of sysinfo tree
- *
- * @param root  Root item of the sysinfo (sub)tree.
- *              If it is NULL then consider the global
- *              sysinfo tree.
- *
- */
-void sysinfo_dump(sysinfo_item_t *root)
-{
-	/*
-	 * Avoid other functions to mess with sysinfo
-	 * while we are dumping it
-	 */
-	mutex_lock(&sysinfo_lock);
-
-	if (root == NULL)
-		sysinfo_dump_internal(global_root, 0);
-	else
-		sysinfo_dump_internal(root, 0);
-
-	mutex_unlock(&sysinfo_lock);
-}
-
-/** Return sysinfo item value determined by name
- *
- * Should be called with sysinfo_lock held.
- *
- * @param name    Sysinfo path.
- * @param root    Root item of the sysinfo (sub)tree.
- *                If it is NULL then consider the global
- *                sysinfo tree.
- * @param dry_run Do not actually get any generated
- *                binary data, just calculate the size.
- *
- * @return Item value (constant or generated).
- *
- */
-_NO_TRACE static sysinfo_return_t sysinfo_get_item(const char *name,
-    sysinfo_item_t **root, bool dry_run)
-{
-	if (root == NULL)
-		root = &global_root;
-
-	/* Try to find the item or generate data */
-	sysinfo_return_t ret;
-	sysinfo_return_t *ret_ptr = &ret;
-	sysinfo_item_t *item = sysinfo_find_item(name, *root, &ret_ptr,
-	    dry_run);
-
-	if (item != NULL) {
-		/* Item found in the fixed sysinfo tree */
-
-		ret.tag = item->val_type;
-		switch (item->val_type) {
-		case SYSINFO_VAL_UNDEFINED:
-			break;
-		case SYSINFO_VAL_VAL:
-			ret.val = item->val.val;
-			break;
-		case SYSINFO_VAL_DATA:
-			ret.data = item->val.data;
-			break;
-		case SYSINFO_VAL_FUNCTION_VAL:
-			ret.val = item->val.gen_val.fn(item, item->val.gen_val.data);
-			break;
-		case SYSINFO_VAL_FUNCTION_DATA:
-			ret.data.data = item->val.gen_data.fn(item, &ret.data.size,
-			    dry_run, item->val.gen_data.data);
-			break;
-		}
-	} else {
-		/* No item in the fixed sysinfo tree */
-		if (ret_ptr == NULL) {
-			/* Even no data was generated */
-			ret.tag = SYSINFO_VAL_UNDEFINED;
-		}
-	}
-
-	return ret;
-}
-
-/** Return sysinfo item determined by name from user space
- *
- * The path string passed from the user space has to be properly null-terminated
- * (the last passed character must be null).
- *
- * @param ptr     Sysinfo path in the user address space.
- * @param size    Size of the path string.
- * @param dry_run Do not actually get any generated
- *                binary data, just calculate the size.
- *
- */
-_NO_TRACE static sysinfo_return_t sysinfo_get_item_uspace(uspace_addr_t ptr, size_t size,
-    bool dry_run)
-{
-	sysinfo_return_t ret;
-	ret.tag = SYSINFO_VAL_UNDEFINED;
-
-	if (size > SYSINFO_MAX_PATH)
-		return ret;
-
-	// TODO: Change this so that allocation is not needed.
-	char *path = malloc(size + 1);
-	if (!path)
-		return ret;
-
-	if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
-	    (path[size] == 0)) {
-		/*
-		 * Prevent other functions from messing with sysinfo while we
-		 * are reading it.
-		 */
-		mutex_lock(&sysinfo_lock);
-		ret = sysinfo_get_item(path, NULL, dry_run);
-		mutex_unlock(&sysinfo_lock);
-	}
-
-	free(path);
-	return ret;
-}
-
-/** Return sysinfo keys determined by name
- *
- * Should be called with sysinfo_lock held.
- *
- * @param name    Sysinfo path.
- * @param root    Root item of the sysinfo (sub)tree.
- *                If it is NULL then consider the global
- *                sysinfo tree.
- * @param dry_run Do not actually get any generated
- *                binary data, just calculate the size.
- *
- * @return Item value (constant or generated).
- *
- */
-_NO_TRACE static sysinfo_return_t sysinfo_get_keys(const char *name,
-    sysinfo_item_t **root, bool dry_run)
-{
-	if (root == NULL)
-		root = &global_root;
-
-	sysinfo_item_t *subtree = NULL;
-
-	if (name[0] != 0) {
-		/* Try to find the item */
-		sysinfo_item_t *item =
-		    sysinfo_find_item(name, *root, NULL, dry_run);
-		if ((item != NULL) &&
-		    (item->subtree_type == SYSINFO_SUBTREE_TABLE))
-			subtree = item->subtree.table;
-	} else
-		subtree = *root;
-
-	sysinfo_return_t ret;
-	ret.tag = SYSINFO_VAL_UNDEFINED;
-
-	if (subtree != NULL) {
-		/*
-		 * Calculate the size of subkeys.
-		 */
-		size_t size = 0;
-		for (sysinfo_item_t *cur = subtree; cur; cur = cur->next)
-			size += str_size(cur->name) + 1;
-
-		if (dry_run) {
-			ret.tag = SYSINFO_VAL_DATA;
-			ret.data.data = NULL;
-			ret.data.size = size;
-		} else {
-			/* Allocate buffer for subkeys */
-			char *names = (char *) malloc(size);
-			if (names == NULL)
-				return ret;
-
-			size_t pos = 0;
-			for (sysinfo_item_t *cur = subtree; cur; cur = cur->next) {
-				str_cpy(names + pos, size - pos, cur->name);
-				pos += str_size(cur->name) + 1;
-			}
-
-			/* Correct return value */
-			ret.tag = SYSINFO_VAL_DATA;
-			ret.data.data = (void *) names;
-			ret.data.size = size;
-		}
-	}
-
-	return ret;
-}
-
-/** Return sysinfo keys determined by name from user space
- *
- * The path string passed from the user space has to be properly
- * null-terminated (the last passed character must be null).
- *
- * @param ptr     Sysinfo path in the user address space.
- * @param size    Size of the path string.
- * @param dry_run Do not actually get any generated
- *                binary data, just calculate the size.
- *
- */
-_NO_TRACE static sysinfo_return_t sysinfo_get_keys_uspace(uspace_addr_t ptr, size_t size,
-    bool dry_run)
-{
-	sysinfo_return_t ret;
-	ret.tag = SYSINFO_VAL_UNDEFINED;
-	ret.data.data = NULL;
-	ret.data.size = 0;
-
-	if (size > SYSINFO_MAX_PATH)
-		return ret;
-
-	// TODO: Change this so that allocation is not needed.
-	char *path = malloc(size + 1);
-	if (!path)
-		return ret;
-
-	if ((copy_from_uspace(path, ptr, size + 1) == 0) &&
-	    (path[size] == 0)) {
-		/*
-		 * Prevent other functions from messing with sysinfo while we
-		 * are reading it.
-		 */
-		mutex_lock(&sysinfo_lock);
-		ret = sysinfo_get_keys(path, NULL, dry_run);
-		mutex_unlock(&sysinfo_lock);
-	}
-
-	free(path);
-	return ret;
-}
-
-/** Get the sysinfo keys size (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * @param path_ptr  Sysinfo path in the user address space.
- * @param path_size Size of the path string.
- * @param size_ptr  User space pointer where to store the
- *                  keys size.
- *
- * @return Error code (EOK in case of no error).
- *
- */
-sys_errno_t sys_sysinfo_get_keys_size(uspace_addr_t path_ptr, size_t path_size,
-    uspace_addr_t size_ptr)
-{
-	errno_t rc;
-
-	/*
-	 * Get the keys.
-	 *
-	 * N.B.: There is no need to free any potential keys
-	 * since we request a dry run.
-	 */
-	sysinfo_return_t ret =
-	    sysinfo_get_keys_uspace(path_ptr, path_size, true);
-
-	/* Check return data tag */
-	if (ret.tag == SYSINFO_VAL_DATA)
-		rc = copy_to_uspace(size_ptr, &ret.data.size,
-		    sizeof(ret.data.size));
-	else
-		rc = EINVAL;
-
-	return (sys_errno_t) rc;
-}
-
-/** Get the sysinfo keys (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * If the user space buffer size does not equal
- * the actual size of the returned data, the data
- * is truncated.
- *
- * The actual size of data returned is stored to
- * size_ptr.
- *
- * @param path_ptr    Sysinfo path in the user address space.
- * @param path_size   Size of the path string.
- * @param buffer_ptr  User space pointer to the buffer where
- *                    to store the binary data.
- * @param buffer_size User space buffer size.
- * @param size_ptr    User space pointer where to store the
- *                    binary data size.
- *
- * @return Error code (EOK in case of no error).
- *
- */
-sys_errno_t sys_sysinfo_get_keys(uspace_addr_t path_ptr, size_t path_size,
-    uspace_addr_t buffer_ptr, size_t buffer_size, uspace_ptr_size_t size_ptr)
-{
-	errno_t rc;
-
-	/* Get the keys */
-	sysinfo_return_t ret = sysinfo_get_keys_uspace(path_ptr, path_size,
-	    false);
-
-	/* Check return data tag */
-	if (ret.tag == SYSINFO_VAL_DATA) {
-		size_t size = min(ret.data.size, buffer_size);
-		rc = copy_to_uspace(buffer_ptr, ret.data.data, size);
-		if (rc == EOK)
-			rc = copy_to_uspace(size_ptr, &size, sizeof(size));
-
-		free(ret.data.data);
-	} else
-		rc = EINVAL;
-
-	return (sys_errno_t) rc;
-}
-
-/** Get the sysinfo value type (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * @param path_ptr  Sysinfo path in the user address space.
- * @param path_size Size of the path string.
- *
- * @return Item value type.
- *
- */
-sysarg_t sys_sysinfo_get_val_type(uspace_addr_t path_ptr, size_t path_size)
-{
-	/*
-	 * Get the item.
-	 *
-	 * N.B.: There is no need to free any potential generated
-	 * binary data since we request a dry run.
-	 */
-	sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true);
-
-	/*
-	 * Map generated value types to constant types (user space does
-	 * not care whether the value is constant or generated).
-	 */
-	if (ret.tag == SYSINFO_VAL_FUNCTION_VAL)
-		ret.tag = SYSINFO_VAL_VAL;
-	else if (ret.tag == SYSINFO_VAL_FUNCTION_DATA)
-		ret.tag = SYSINFO_VAL_DATA;
-
-	return (sysarg_t) ret.tag;
-}
-
-/** Get the sysinfo numerical value (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * @param path_ptr  Sysinfo path in the user address space.
- * @param path_size Size of the path string.
- * @param value_ptr User space pointer where to store the
- *                  numberical value.
- *
- * @return Error code (EOK in case of no error).
- *
- */
-sys_errno_t sys_sysinfo_get_value(uspace_addr_t path_ptr, size_t path_size,
-    uspace_addr_t value_ptr)
-{
-	errno_t rc;
-
-	/*
-	 * Get the item.
-	 *
-	 * N.B.: There is no need to free any potential generated binary
-	 * data since we request a dry run.
-	 */
-	sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true);
-
-	/* Only constant or generated numerical value is returned */
-	if ((ret.tag == SYSINFO_VAL_VAL) || (ret.tag == SYSINFO_VAL_FUNCTION_VAL))
-		rc = copy_to_uspace(value_ptr, &ret.val, sizeof(ret.val));
-	else
-		rc = EINVAL;
-
-	return (sys_errno_t) rc;
-}
-
-/** Get the sysinfo binary data size (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * @param path_ptr  Sysinfo path in the user address space.
- * @param path_size Size of the path string.
- * @param size_ptr  User space pointer where to store the
- *                  binary data size.
- *
- * @return Error code (EOK in case of no error).
- *
- */
-sys_errno_t sys_sysinfo_get_data_size(uspace_addr_t path_ptr, size_t path_size,
-    uspace_addr_t size_ptr)
-{
-	errno_t rc;
-
-	/*
-	 * Get the item.
-	 *
-	 * N.B.: There is no need to free any potential generated binary
-	 * data since we request a dry run.
-	 */
-	sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size, true);
-
-	/* Only the size of constant or generated binary data is considered */
-	if ((ret.tag == SYSINFO_VAL_DATA) || (ret.tag == SYSINFO_VAL_FUNCTION_DATA))
-		rc = copy_to_uspace(size_ptr, &ret.data.size,
-		    sizeof(ret.data.size));
-	else
-		rc = EINVAL;
-
-	return (sys_errno_t) rc;
-}
-
-/** Get the sysinfo binary data (syscall)
- *
- * The path string passed from the user space has
- * to be properly null-terminated (the last passed
- * character must be null).
- *
- * If the user space buffer size does not equal
- * the actual size of the returned data, the data
- * is truncated. Whether this is actually a fatal
- * error or the data can be still interpreted as valid
- * depends on the nature of the data and has to be
- * decided by the user space.
- *
- * The actual size of data returned is stored to
- * size_ptr.
- *
- * @param path_ptr    Sysinfo path in the user address space.
- * @param path_size   Size of the path string.
- * @param buffer_ptr  User space pointer to the buffer where
- *                    to store the binary data.
- * @param buffer_size User space buffer size.
- * @param size_ptr    User space pointer where to store the
- *                    binary data size.
- *
- * @return Error code (EOK in case of no error).
- *
- */
-sys_errno_t sys_sysinfo_get_data(uspace_addr_t path_ptr, size_t path_size,
-    uspace_addr_t buffer_ptr, size_t buffer_size, uspace_ptr_size_t size_ptr)
-{
-	errno_t rc;
-
-	/* Get the item */
-	sysinfo_return_t ret = sysinfo_get_item_uspace(path_ptr, path_size,
-	    false);
-
-	/* Only constant or generated binary data is considered */
-	if ((ret.tag == SYSINFO_VAL_DATA) ||
-	    (ret.tag == SYSINFO_VAL_FUNCTION_DATA)) {
-		size_t size = min(ret.data.size, buffer_size);
-		rc = copy_to_uspace(buffer_ptr, ret.data.data, size);
-		if (rc == EOK)
-			rc = copy_to_uspace(size_ptr, &size, sizeof(size));
-	} else
-		rc = EINVAL;
-
-	/* N.B.: The generated binary data should be freed */
-	if ((ret.tag == SYSINFO_VAL_FUNCTION_DATA) && (ret.data.data != NULL))
-		free(ret.data.data);
-
-	return (sys_errno_t) rc;
-}
-
-/** @}
- */
Index: rnel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2022 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-
-/**
- * @file
- * @brief High-level clock interrupt handler.
- *
- * This file contains the clock() function which is the source
- * of preemption. It is also responsible for executing expired
- * timeouts.
- *
- */
-
-#include <time/clock.h>
-#include <time/timeout.h>
-#include <config.h>
-#include <synch/spinlock.h>
-#include <synch/waitq.h>
-#include <halt.h>
-#include <proc/scheduler.h>
-#include <cpu.h>
-#include <arch.h>
-#include <adt/list.h>
-#include <atomic.h>
-#include <proc/thread.h>
-#include <sysinfo/sysinfo.h>
-#include <barrier.h>
-#include <mm/frame.h>
-#include <ddi/ddi.h>
-#include <arch/cycle.h>
-#include <preemption.h>
-
-/* Pointer to variable with uptime */
-uptime_t *uptime;
-
-/** Physical memory area of the real time clock */
-static parea_t clock_parea;
-
-/** Initialize realtime clock counter
- *
- * The applications (and sometimes kernel) need to access accurate
- * information about realtime data. We allocate 1 page with these
- * data and update it periodically.
- *
- */
-void clock_counter_init(void)
-{
-	uintptr_t faddr = frame_alloc(1, FRAME_LOWMEM | FRAME_ATOMIC, 0);
-	if (faddr == 0)
-		panic("Cannot allocate page for clock.");
-
-	uptime = (uptime_t *) PA2KA(faddr);
-
-	uptime->seconds1 = 0;
-	uptime->seconds2 = 0;
-	uptime->useconds = 0;
-
-	ddi_parea_init(&clock_parea);
-	clock_parea.pbase = faddr;
-	clock_parea.frames = 1;
-	clock_parea.unpriv = true;
-	clock_parea.mapped = false;
-	ddi_parea_register(&clock_parea);
-
-	/*
-	 * Prepare information for the userspace so that it can successfully
-	 * physmem_map() the clock_parea.
-	 *
-	 */
-	sysinfo_set_item_val("clock.faddr", NULL, (sysarg_t) faddr);
-}
-
-/** Update public counters
- *
- * Update it only on first processor
- */
-static void clock_update_counters(uint64_t current_tick)
-{
-	if (CPU->id == 0) {
-		uint64_t usec = (1000000 / HZ) * current_tick;
-
-		sysarg_t secs = usec / 1000000;
-		sysarg_t usecs = usec % 1000000;
-
-		uptime->seconds1 = secs;
-		write_barrier();
-		uptime->useconds = usecs;
-		write_barrier();
-		uptime->seconds2 = secs;
-	}
-}
-
-static void cpu_update_accounting(void)
-{
-	// FIXME: get_cycle() is unimplemented on several platforms
-	uint64_t now = get_cycle();
-	atomic_time_increment(&CPU->busy_cycles, now - CPU_LOCAL->last_cycle);
-	CPU_LOCAL->last_cycle = now;
-}
-
-/** Clock routine
- *
- * Clock routine executed from clock interrupt handler
- * (assuming interrupts_disable()'d). Runs expired timeouts
- * and preemptive scheduling.
- *
- */
-void clock(void)
-{
-	size_t missed_clock_ticks = CPU_LOCAL->missed_clock_ticks;
-	CPU_LOCAL->missed_clock_ticks = 0;
-
-	CPU_LOCAL->current_clock_tick += missed_clock_ticks + 1;
-	uint64_t current_clock_tick = CPU_LOCAL->current_clock_tick;
-	clock_update_counters(current_clock_tick);
-
-	/* Account CPU usage */
-	cpu_update_accounting();
-
-	/*
-	 * To avoid lock ordering problems,
-	 * run all expired timeouts as you visit them.
-	 *
-	 */
-
-	irq_spinlock_lock(&CPU->timeoutlock, false);
-
-	link_t *cur;
-	while ((cur = list_first(&CPU->timeout_active_list)) != NULL) {
-		timeout_t *timeout = list_get_instance(cur, timeout_t, link);
-
-		if (current_clock_tick <= timeout->deadline) {
-			break;
-		}
-
-		list_remove(cur);
-		timeout_handler_t handler = timeout->handler;
-		void *arg = timeout->arg;
-		atomic_bool *finished = &timeout->finished;
-
-		irq_spinlock_unlock(&CPU->timeoutlock, false);
-
-		handler(arg);
-
-		/* Signal that the handler is finished. */
-		atomic_store_explicit(finished, true, memory_order_release);
-
-		irq_spinlock_lock(&CPU->timeoutlock, false);
-	}
-
-	irq_spinlock_unlock(&CPU->timeoutlock, false);
-
-	/*
-	 * Do CPU usage accounting and find out whether to preempt THREAD.
-	 *
-	 */
-
-	if (THREAD) {
-		if (current_clock_tick >= CPU_LOCAL->preempt_deadline && PREEMPTION_ENABLED) {
-			thread_yield();
-#ifdef CONFIG_UDEBUG
-			/*
-			 * Give udebug chance to stop the thread
-			 * before it begins executing userspace code.
-			 */
-			istate_t *istate = THREAD->udebug.uspace_state;
-			if ((istate) && (istate_from_uspace(istate)))
-				udebug_before_thread_runs();
-#endif
-		}
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/time/delay.c
===================================================================
--- kernel/generic/src/time/delay.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-
-/**
- * @file
- * @brief	Active delay function.
- */
-
-#include <time/delay.h>
-#include <proc/thread.h>
-#include <typedefs.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <arch.h>
-
-/** Delay the execution for the given number of microseconds (or slightly more).
- *
- * The delay is implemented as active delay loop.
- *
- * @param usec Number of microseconds to sleep.
- */
-void delay(uint32_t usec)
-{
-	/*
-	 * The delay loop is calibrated for each and every CPU in the system.
-	 * If running in a thread context, it is therefore necessary to disable
-	 * thread migration. We want to do this in a lightweight manner.
-	 */
-	if (THREAD)
-		thread_migration_disable();
-	asm_delay_loop(usec * CPU->delay_loop_const);
-	if (THREAD)
-		thread_migration_enable();
-}
-
-/** @}
- */
Index: rnel/generic/src/time/timeout.c
===================================================================
--- kernel/generic/src/time/timeout.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2022 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_time
- * @{
- */
-
-/**
- * @file
- * @brief Timeout management functions.
- */
-
-#include <time/timeout.h>
-#include <typedefs.h>
-#include <config.h>
-#include <panic.h>
-#include <synch/spinlock.h>
-#include <halt.h>
-#include <cpu.h>
-#include <arch/asm.h>
-#include <arch.h>
-
-/** Initialize timeouts
- *
- * Initialize kernel timeouts.
- *
- */
-void timeout_init(void)
-{
-	irq_spinlock_initialize(&CPU->timeoutlock, "cpu.timeoutlock");
-	list_initialize(&CPU->timeout_active_list);
-}
-
-/** Initialize timeout
- *
- * Initialize all members including the lock.
- *
- * @param timeout Timeout to be initialized.
- *
- */
-void timeout_initialize(timeout_t *timeout)
-{
-	link_initialize(&timeout->link);
-	timeout->cpu = NULL;
-}
-
-/* Only call when interrupts are disabled. */
-deadline_t timeout_deadline_in_usec(uint32_t usec)
-{
-	if (usec == 0)
-		return 0;
-
-	return CPU_LOCAL->current_clock_tick + us2ticks(usec);
-}
-
-static void timeout_register_deadline_locked(timeout_t *timeout, deadline_t deadline,
-    timeout_handler_t handler, void *arg)
-{
-	assert(!link_in_use(&timeout->link));
-
-	*timeout = (timeout_t) {
-		.cpu = CPU,
-		.deadline = deadline,
-		.handler = handler,
-		.arg = arg,
-		.finished = ATOMIC_VAR_INIT(false),
-	};
-
-	/* Insert timeout into the active timeouts list according to timeout->deadline. */
-
-	link_t *last = list_last(&CPU->timeout_active_list);
-	if (last == NULL || timeout->deadline >= list_get_instance(last, timeout_t, link)->deadline) {
-		list_append(&timeout->link, &CPU->timeout_active_list);
-	} else {
-		for (link_t *cur = list_first(&CPU->timeout_active_list); cur != NULL;
-		    cur = list_next(cur, &CPU->timeout_active_list)) {
-
-			if (timeout->deadline < list_get_instance(cur, timeout_t, link)->deadline) {
-				list_insert_before(&timeout->link, cur);
-				break;
-			}
-		}
-	}
-}
-
-/** Register timeout
- *
- * Insert timeout handler f (with argument arg)
- * to timeout list and make it execute in
- * time microseconds (or slightly more).
- *
- * @param timeout Timeout structure.
- * @param time    Number of usec in the future to execute the handler.
- * @param handler Timeout handler function.
- * @param arg     Timeout handler argument.
- *
- */
-void timeout_register(timeout_t *timeout, uint64_t time,
-    timeout_handler_t handler, void *arg)
-{
-	irq_spinlock_lock(&CPU->timeoutlock, true);
-	timeout_register_deadline_locked(timeout, timeout_deadline_in_usec(time), handler, arg);
-	irq_spinlock_unlock(&CPU->timeoutlock, true);
-}
-
-void timeout_register_deadline(timeout_t *timeout, deadline_t deadline,
-    timeout_handler_t handler, void *arg)
-{
-	irq_spinlock_lock(&CPU->timeoutlock, true);
-	timeout_register_deadline_locked(timeout, deadline, handler, arg);
-	irq_spinlock_unlock(&CPU->timeoutlock, true);
-}
-
-/** Unregister timeout
- *
- * Remove timeout from timeout list.
- *
- * @param timeout Timeout to unregister.
- *
- * @return True on success, false on failure.
- *
- */
-bool timeout_unregister(timeout_t *timeout)
-{
-	if (atomic_load_explicit(&timeout->finished, memory_order_acquire))
-		/* The timeout fired and finished already, no need to check the list. */
-		return false;
-
-	assert(timeout->cpu);
-
-	irq_spinlock_lock(&timeout->cpu->timeoutlock, true);
-
-	bool success = link_in_use(&timeout->link);
-	if (success) {
-		list_remove(&timeout->link);
-	}
-
-	irq_spinlock_unlock(&timeout->cpu->timeoutlock, true);
-
-	if (!success) {
-		/* Timeout was fired, we need to wait for the callback to finish. */
-		while (!atomic_load_explicit(&timeout->finished, memory_order_acquire))
-			cpu_spin_hint();
-	}
-
-	return success;
-}
-
-/** @}
- */
Index: rnel/generic/src/udebug/udebug.c
===================================================================
--- kernel/generic/src/udebug/udebug.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,484 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Udebug hooks and data structure management.
- *
- * Udebug is an interface that makes userspace debuggers possible.
- */
-
-#include <assert.h>
-#include <debug.h>
-#include <synch/waitq.h>
-#include <udebug/udebug.h>
-#include <errno.h>
-#include <arch.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-
-/** Initialize udebug part of task structure.
- *
- * Called as part of task structure initialization.
- * @param ut Pointer to the structure to initialize.
- *
- */
-void udebug_task_init(udebug_task_t *ut)
-{
-	mutex_initialize(&ut->lock, MUTEX_PASSIVE);
-	ut->dt_state = UDEBUG_TS_INACTIVE;
-	ut->begin_call = NULL;
-	ut->not_stoppable_count = 0;
-	ut->evmask = 0;
-}
-
-/** Initialize udebug part of thread structure.
- *
- * Called as part of thread structure initialization.
- *
- * @param ut Pointer to the structure to initialize.
- *
- */
-void udebug_thread_initialize(udebug_thread_t *ut)
-{
-	mutex_initialize(&ut->lock, MUTEX_PASSIVE);
-	waitq_initialize(&ut->go_wq);
-	condvar_initialize(&ut->active_cv);
-
-	ut->go_call = NULL;
-	ut->uspace_state = NULL;
-	ut->go = false;
-	ut->stoppable = true;
-	ut->active = false;
-	ut->cur_event = 0;  /* None */
-}
-
-/** Wait for a GO message.
- *
- * When a debugging event occurs in a thread or the thread is stopped,
- * this function is called to block the thread until a GO message
- * is received.
- *
- * @param wq The wait queue used by the thread to wait for GO messages.
- *
- */
-static void udebug_wait_for_go(waitq_t *wq)
-{
-	waitq_sleep(wq);
-}
-
-/** Start of stoppable section.
- *
- * A stoppable section is a section of code where if the thread can
- * be stoped. In other words, if a STOP operation is issued, the thread
- * is guaranteed not to execute any userspace instructions until the
- * thread is resumed.
- *
- * Having stoppable sections is better than having stopping points, since
- * a thread can be stopped even when it is blocked indefinitely in a system
- * call (whereas it would not reach any stopping point).
- *
- */
-void udebug_stoppable_begin(void)
-{
-	assert(THREAD);
-	assert(TASK);
-
-	mutex_lock(&TASK->udebug.lock);
-
-	int nsc = --TASK->udebug.not_stoppable_count;
-
-	/* Lock order OK, THREAD->udebug.lock is after TASK->udebug.lock */
-	mutex_lock(&THREAD->udebug.lock);
-	assert(THREAD->udebug.stoppable == false);
-	THREAD->udebug.stoppable = true;
-
-	if ((TASK->udebug.dt_state == UDEBUG_TS_BEGINNING) && (nsc == 0)) {
-		/*
-		 * This was the last non-stoppable thread. Reply to
-		 * DEBUG_BEGIN call.
-		 *
-		 */
-
-		call_t *db_call = TASK->udebug.begin_call;
-		assert(db_call);
-
-		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
-		TASK->udebug.begin_call = NULL;
-
-		ipc_set_retval(&db_call->data, 0);
-		ipc_answer(&TASK->answerbox, db_call);
-	} else if (TASK->udebug.dt_state == UDEBUG_TS_ACTIVE) {
-		/*
-		 * Active debugging session
-		 */
-
-		if (THREAD->udebug.active == true &&
-		    THREAD->udebug.go == false) {
-			/*
-			 * Thread was requested to stop - answer go call
-			 *
-			 */
-
-			/* Make sure nobody takes this call away from us */
-			call_t *go_call = THREAD->udebug.go_call;
-			THREAD->udebug.go_call = NULL;
-			assert(go_call);
-
-			ipc_set_retval(&go_call->data, 0);
-			ipc_set_arg1(&go_call->data, UDEBUG_EVENT_STOP);
-
-			THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
-			ipc_answer(&TASK->answerbox, go_call);
-		}
-	}
-
-	mutex_unlock(&THREAD->udebug.lock);
-	mutex_unlock(&TASK->udebug.lock);
-}
-
-/** End of a stoppable section.
- *
- * This is the point where the thread will block if it is stopped.
- * (As, by definition, a stopped thread must not leave its stoppable
- * section).
- *
- */
-void udebug_stoppable_end(void)
-{
-restart:
-	mutex_lock(&TASK->udebug.lock);
-	mutex_lock(&THREAD->udebug.lock);
-
-	if ((THREAD->udebug.active) && (THREAD->udebug.go == false)) {
-		mutex_unlock(&THREAD->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-
-		udebug_wait_for_go(&THREAD->udebug.go_wq);
-
-		goto restart;
-		/* Must try again - have to lose stoppability atomically. */
-	} else {
-		++TASK->udebug.not_stoppable_count;
-		assert(THREAD->udebug.stoppable == true);
-		THREAD->udebug.stoppable = false;
-
-		mutex_unlock(&THREAD->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-	}
-}
-
-/** Upon being scheduled to run, check if the current thread should stop.
- *
- * This function is called from clock().
- *
- */
-void udebug_before_thread_runs(void)
-{
-	/* Check if we're supposed to stop */
-	udebug_stoppable_begin();
-	udebug_stoppable_end();
-}
-
-/** Syscall event hook.
- *
- * Must be called before and after servicing a system call. This generates
- * a SYSCALL_B or SYSCALL_E event, depending on the value of @a end_variant.
- *
- */
-void udebug_syscall_event(sysarg_t a1, sysarg_t a2, sysarg_t a3,
-    sysarg_t a4, sysarg_t a5, sysarg_t a6, sysarg_t id, sysarg_t rc,
-    bool end_variant)
-{
-	udebug_event_t etype =
-	    end_variant ? UDEBUG_EVENT_SYSCALL_E : UDEBUG_EVENT_SYSCALL_B;
-
-	mutex_lock(&TASK->udebug.lock);
-	mutex_lock(&THREAD->udebug.lock);
-
-	/* Must only generate events when in debugging session and is go. */
-	if (THREAD->udebug.active != true || THREAD->udebug.go == false ||
-	    (TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
-		mutex_unlock(&THREAD->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-		return;
-	}
-
-	/* Fill in the GO response. */
-	call_t *call = THREAD->udebug.go_call;
-	THREAD->udebug.go_call = NULL;
-
-	ipc_set_retval(&call->data, 0);
-	ipc_set_arg1(&call->data, etype);
-	ipc_set_arg2(&call->data, id);
-	ipc_set_arg3(&call->data, rc);
-
-	THREAD->udebug.syscall_args[0] = a1;
-	THREAD->udebug.syscall_args[1] = a2;
-	THREAD->udebug.syscall_args[2] = a3;
-	THREAD->udebug.syscall_args[3] = a4;
-	THREAD->udebug.syscall_args[4] = a5;
-	THREAD->udebug.syscall_args[5] = a6;
-
-	/*
-	 * Make sure udebug.go is false when going to sleep
-	 * in case we get woken up by DEBUG_END. (At which
-	 * point it must be back to the initial true value).
-	 *
-	 */
-	THREAD->udebug.go = false;
-	THREAD->udebug.cur_event = etype;
-
-	ipc_answer(&TASK->answerbox, call);
-
-	mutex_unlock(&THREAD->udebug.lock);
-	mutex_unlock(&TASK->udebug.lock);
-
-	udebug_wait_for_go(&THREAD->udebug.go_wq);
-}
-
-/** Thread-creation event hook combined with attaching the thread.
- *
- * Must be called when a new userspace thread is created in the debugged
- * task. Generates a THREAD_B event. Also attaches the thread @a t
- * to the task @a ta.
- *
- * This is necessary to avoid a race condition where the BEGIN and THREAD_READ
- * requests would be handled inbetween attaching the thread and checking it
- * for being in a debugging session to send the THREAD_B event. We could then
- * either miss threads or get some threads both in the thread list
- * and get a THREAD_B event for them.
- *
- * @param thread Structure of the thread being created. Not locked, as the
- *               thread is not executing yet.
- * @param task   Task to which the thread should be attached.
- *
- */
-void udebug_thread_b_event_attach(struct thread *thread, struct task *task)
-{
-	mutex_lock(&TASK->udebug.lock);
-	mutex_lock(&THREAD->udebug.lock);
-
-	thread_attach(thread, task);
-
-	LOG("Check state");
-
-	/* Must only generate events when in debugging session */
-	if (THREAD->udebug.active != true) {
-		LOG("udebug.active: %s, udebug.go: %s",
-		    THREAD->udebug.active ? "Yes(+)" : "No",
-		    THREAD->udebug.go ? "Yes(-)" : "No");
-
-		mutex_unlock(&THREAD->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-		return;
-	}
-
-	LOG("Trigger event");
-
-	call_t *call = THREAD->udebug.go_call;
-
-	THREAD->udebug.go_call = NULL;
-	ipc_set_retval(&call->data, 0);
-	ipc_set_arg1(&call->data, UDEBUG_EVENT_THREAD_B);
-	ipc_set_arg2(&call->data, (sysarg_t) thread);
-
-	/*
-	 * Make sure udebug.go is false when going to sleep
-	 * in case we get woken up by DEBUG_END. (At which
-	 * point it must be back to the initial true value).
-	 *
-	 */
-	THREAD->udebug.go = false;
-	THREAD->udebug.cur_event = UDEBUG_EVENT_THREAD_B;
-
-	ipc_answer(&TASK->answerbox, call);
-
-	mutex_unlock(&THREAD->udebug.lock);
-	mutex_unlock(&TASK->udebug.lock);
-
-	LOG("Wait for Go");
-	udebug_wait_for_go(&THREAD->udebug.go_wq);
-}
-
-/** Thread-termination event hook.
- *
- * Must be called when the current thread is terminating.
- * Generates a THREAD_E event.
- *
- */
-void udebug_thread_e_event(void)
-{
-	mutex_lock(&TASK->udebug.lock);
-	mutex_lock(&THREAD->udebug.lock);
-
-	LOG("Check state");
-
-	/* Must only generate events when in debugging session. */
-	if (THREAD->udebug.active != true) {
-		LOG("udebug.active: %s, udebug.go: %s",
-		    THREAD->udebug.active ? "Yes" : "No",
-		    THREAD->udebug.go ? "Yes" : "No");
-
-		mutex_unlock(&THREAD->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-		return;
-	}
-
-	LOG("Trigger event");
-
-	call_t *call = THREAD->udebug.go_call;
-
-	THREAD->udebug.go_call = NULL;
-	ipc_set_retval(&call->data, 0);
-	ipc_set_arg1(&call->data, UDEBUG_EVENT_THREAD_E);
-
-	/* Prevent any further debug activity in thread. */
-	THREAD->udebug.active = false;
-	THREAD->udebug.cur_event = 0;   /* None */
-	THREAD->udebug.go = false;      /* Set to initial value */
-
-	ipc_answer(&TASK->answerbox, call);
-
-	mutex_unlock(&THREAD->udebug.lock);
-	mutex_unlock(&TASK->udebug.lock);
-
-	/*
-	 * This event does not sleep - debugging has finished
-	 * in this thread.
-	 *
-	 */
-}
-
-/** Terminate task debugging session.
- *
- * Gracefully terminate the debugging session for a task. If the debugger
- * is still waiting for events on some threads, it will receive a
- * FINISHED event for each of them.
- *
- * @param task Task structure. task->udebug.lock must be already locked.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_task_cleanup(struct task *task)
-{
-	assert(mutex_locked(&task->udebug.lock));
-
-	if ((task->udebug.dt_state != UDEBUG_TS_BEGINNING) &&
-	    (task->udebug.dt_state != UDEBUG_TS_ACTIVE)) {
-		return EINVAL;
-	}
-
-	LOG("Task %" PRIu64, task->taskid);
-
-	/* Finish debugging of all userspace threads */
-	list_foreach(task->threads, th_link, thread_t, thread) {
-		mutex_lock(&thread->udebug.lock);
-
-		/* Only process userspace threads. */
-		if (thread->uspace) {
-			/* Prevent any further debug activity in thread. */
-			thread->udebug.active = false;
-			thread->udebug.cur_event = 0;   /* None */
-
-			/* Is the thread still go? */
-			if (thread->udebug.go == true) {
-				/*
-				 * Yes, so clear go. As active == false,
-				 * this doesn't affect anything.
-				 */
-				thread->udebug.go = false;
-
-				/* Answer GO call */
-				LOG("Answer GO call with EVENT_FINISHED.");
-
-				ipc_set_retval(&thread->udebug.go_call->data, 0);
-				ipc_set_arg1(&thread->udebug.go_call->data,
-				    UDEBUG_EVENT_FINISHED);
-
-				ipc_answer(&task->answerbox, thread->udebug.go_call);
-				thread->udebug.go_call = NULL;
-			} else {
-				/*
-				 * Debug_stop is already at initial value.
-				 * Yet this means the thread needs waking up.
-				 *
-				 */
-
-				/*
-				 * thread's lock must not be held when calling
-				 * waitq_close.
-				 *
-				 */
-				waitq_close(&thread->udebug.go_wq);
-			}
-
-			mutex_unlock(&thread->udebug.lock);
-			condvar_broadcast(&thread->udebug.active_cv);
-		} else
-			mutex_unlock(&thread->udebug.lock);
-	}
-
-	task->udebug.dt_state = UDEBUG_TS_INACTIVE;
-	task->udebug.debugger = NULL;
-
-	return 0;
-}
-
-/** Wait for debugger to handle a fault in this thread.
- *
- * When a thread faults and someone is subscribed to the FAULT kernel event,
- * this function is called to wait for a debugging session to give userspace
- * a chance to examine the faulting thead/task. When the debugging session
- * is over, this function returns (so that thread/task cleanup can continue).
- *
- */
-void udebug_thread_fault(void)
-{
-	udebug_stoppable_begin();
-
-	/* Wait until a debugger attends to us. */
-	mutex_lock(&THREAD->udebug.lock);
-	while (!THREAD->udebug.active)
-		condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);
-	mutex_unlock(&THREAD->udebug.lock);
-
-	/*
-	 * This is where we will typically block until a post-mortem debugger
-	 * terminates the debugging session.
-	 */
-	udebug_stoppable_end();
-}
-
-/** @}
- */
Index: rnel/generic/src/udebug/udebug_ipc.c
===================================================================
--- kernel/generic/src/udebug/udebug_ipc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,502 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief	Udebug IPC message handling.
- *
- * This module handles udebug IPC messages and calls the appropriate
- * functions from the udebug_ops module which implement them.
- */
-
-#include <assert.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <mm/as.h>
-#include <arch.h>
-#include <errno.h>
-#include <ipc/ipc.h>
-#include <syscall/copy.h>
-#include <udebug/udebug.h>
-#include <udebug/udebug_ops.h>
-#include <udebug/udebug_ipc.h>
-
-errno_t udebug_request_preprocess(call_t *call, phone_t *phone)
-{
-	switch (ipc_get_arg1(&call->data)) {
-		/* future UDEBUG_M_REGS_WRITE, UDEBUG_M_MEM_WRITE: */
-	default:
-		break;
-	}
-
-	return EOK;
-}
-
-/** Process a BEGIN call.
- *
- * Initiates a debugging session for the current task. The reply
- * to this call may or may not be sent before this function returns.
- *
- * @param call	The call structure.
- */
-static void udebug_receive_begin(call_t *call)
-{
-	errno_t rc;
-	bool active;
-
-	rc = udebug_begin(call, &active);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	/*
-	 * If the initialization of the debugging session has finished,
-	 * send a reply.
-	 */
-	if (active) {
-		ipc_set_retval(&call->data, EOK);
-		ipc_answer(&TASK->kb.box, call);
-	}
-}
-
-/** Process an END call.
- *
- * Terminates the debugging session for the current task.
- * @param call	The call structure.
- */
-static void udebug_receive_end(call_t *call)
-{
-	errno_t rc;
-
-	rc = udebug_end();
-
-	ipc_set_retval(&call->data, rc);
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process a SET_EVMASK call.
- *
- * Sets an event mask for the current debugging session.
- * @param call	The call structure.
- */
-static void udebug_receive_set_evmask(call_t *call)
-{
-	errno_t rc;
-	udebug_evmask_t mask;
-
-	mask = ipc_get_arg2(&call->data);
-	rc = udebug_set_evmask(mask);
-
-	ipc_set_retval(&call->data, rc);
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process a GO call.
- *
- * Resumes execution of the specified thread.
- * @param call	The call structure.
- */
-static void udebug_receive_go(call_t *call)
-{
-	thread_t *t;
-	errno_t rc;
-
-	t = (thread_t *)ipc_get_arg2(&call->data);
-
-	rc = udebug_go(t, call);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-}
-
-/** Process a STOP call.
- *
- * Suspends execution of the specified thread.
- * @param call	The call structure.
- */
-static void udebug_receive_stop(call_t *call)
-{
-	thread_t *t;
-	errno_t rc;
-
-	t = (thread_t *)ipc_get_arg2(&call->data);
-
-	rc = udebug_stop(t, call);
-	ipc_set_retval(&call->data, rc);
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process a THREAD_READ call.
- *
- * Reads the list of hashes of the (userspace) threads in the current task.
- * @param call	The call structure.
- */
-static void udebug_receive_thread_read(call_t *call)
-{
-	uintptr_t uspace_addr;
-	size_t buf_size;
-	void *buffer;
-	size_t copied, needed;
-	errno_t rc;
-
-	uspace_addr = ipc_get_arg2(&call->data);	/* Destination address */
-	buf_size = ipc_get_arg3(&call->data);	/* Dest. buffer size */
-
-	/*
-	 * Read thread list. Variable n will be filled with actual number
-	 * of threads times thread-id size.
-	 */
-	rc = udebug_thread_read(&buffer, buf_size, &copied, &needed);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	/*
-	 * Make use of call->buffer to transfer data to caller's userspace
-	 */
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_addr);
-	ipc_set_arg2(&call->data, copied);
-	ipc_set_arg3(&call->data, needed);
-	call->buffer = buffer;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process a NAME_READ call.
- *
- * Returns a string containing the name of the task.
- *
- * @param call	The call structure.
- */
-static void udebug_receive_name_read(call_t *call)
-{
-	sysarg_t uspace_addr;
-	sysarg_t to_copy;
-	size_t data_size;
-	size_t buf_size;
-	void *data;
-	errno_t rc;
-
-	uspace_addr = ipc_get_arg2(&call->data);	/* Destination address */
-	buf_size = ipc_get_arg3(&call->data);	/* Dest. buffer size */
-
-	/*
-	 * Read task name.
-	 */
-	rc = udebug_name_read((char **) &data, &data_size);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	/* Copy MAX(buf_size, data_size) bytes */
-
-	if (buf_size > data_size)
-		to_copy = data_size;
-	else
-		to_copy = buf_size;
-
-	/*
-	 * Make use of call->buffer to transfer data to caller's userspace
-	 */
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_addr);
-	ipc_set_arg2(&call->data, to_copy);
-
-	ipc_set_arg3(&call->data, data_size);
-	call->buffer = data;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process an AREAS_READ call.
- *
- * Returns a list of address space areas in the current task, as an array
- * of as_area_info_t structures.
- *
- * @param call	The call structure.
- */
-static void udebug_receive_areas_read(call_t *call)
-{
-	sysarg_t uspace_addr;
-	sysarg_t to_copy;
-	size_t data_size;
-	size_t buf_size;
-	as_area_info_t *data;
-
-	uspace_addr = ipc_get_arg2(&call->data);	/* Destination address */
-	buf_size = ipc_get_arg3(&call->data);	/* Dest. buffer size */
-
-	/*
-	 * Read area list.
-	 */
-	data = as_get_area_info(AS, &data_size);
-	if (!data) {
-		ipc_set_retval(&call->data, ENOMEM);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	/* Copy MAX(buf_size, data_size) bytes */
-
-	if (buf_size > data_size)
-		to_copy = data_size;
-	else
-		to_copy = buf_size;
-
-	/*
-	 * Make use of call->buffer to transfer data to caller's userspace
-	 */
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_addr);
-	ipc_set_arg2(&call->data, to_copy);
-
-	ipc_set_arg3(&call->data, data_size);
-	call->buffer = (uint8_t *) data;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process an ARGS_READ call.
- *
- * Reads the argument of a current syscall event (SYSCALL_B or SYSCALL_E).
- * @param call	The call structure.
- */
-static void udebug_receive_args_read(call_t *call)
-{
-	thread_t *t;
-	sysarg_t uspace_addr;
-	errno_t rc;
-	void *buffer;
-
-	t = (thread_t *)ipc_get_arg2(&call->data);
-
-	rc = udebug_args_read(t, &buffer);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	/*
-	 * Make use of call->buffer to transfer data to caller's userspace
-	 */
-
-	uspace_addr = ipc_get_arg3(&call->data);
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_addr);
-	ipc_set_arg2(&call->data, 6 * sizeof(sysarg_t));
-	call->buffer = buffer;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Receive a REGS_READ call.
- *
- * Reads the thread's register state (istate structure).
- */
-static void udebug_receive_regs_read(call_t *call)
-{
-	thread_t *t;
-	sysarg_t uspace_addr;
-	sysarg_t to_copy;
-	void *buffer = NULL;
-	errno_t rc;
-
-	t = (thread_t *) ipc_get_arg2(&call->data);
-
-	rc = udebug_regs_read(t, &buffer);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	assert(buffer != NULL);
-
-	/*
-	 * Make use of call->buffer to transfer data to caller's userspace
-	 */
-
-	uspace_addr = ipc_get_arg3(&call->data);
-	to_copy = sizeof(istate_t);
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_addr);
-	ipc_set_arg2(&call->data, to_copy);
-
-	call->buffer = buffer;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Process an MEM_READ call.
- *
- * Reads memory of the current (debugged) task.
- * @param call	The call structure.
- */
-static void udebug_receive_mem_read(call_t *call)
-{
-	uspace_addr_t uspace_dst;
-	uspace_addr_t uspace_src;
-	unsigned size;
-	void *buffer = NULL;
-	errno_t rc;
-
-	uspace_dst = ipc_get_arg2(&call->data);
-	uspace_src = ipc_get_arg3(&call->data);
-	size = ipc_get_arg4(&call->data);
-
-	rc = udebug_mem_read(uspace_src, size, &buffer);
-	if (rc != EOK) {
-		ipc_set_retval(&call->data, rc);
-		ipc_answer(&TASK->kb.box, call);
-		return;
-	}
-
-	assert(buffer != NULL);
-
-	ipc_set_retval(&call->data, EOK);
-	/*
-	 * ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
-	 * same code in process_answer() can be used
-	 * (no way to distinguish method in answer)
-	 */
-	ipc_set_arg1(&call->data, uspace_dst);
-	ipc_set_arg2(&call->data, size);
-	call->buffer = buffer;
-
-	ipc_answer(&TASK->kb.box, call);
-}
-
-/** Handle a debug call received on the kernel answerbox.
- *
- * This is called by the kbox servicing thread. Verifies that the sender
- * is indeed the debugger and calls the appropriate processing function.
- */
-void udebug_call_receive(call_t *call)
-{
-	int debug_method;
-
-	debug_method = ipc_get_arg1(&call->data);
-
-	if (debug_method != UDEBUG_M_BEGIN) {
-		/*
-		 * Verify that the sender is this task's debugger.
-		 * Note that this is the only thread that could change
-		 * TASK->debugger. Therefore no locking is necessary
-		 * and the sender can be safely considered valid until
-		 * control exits this function.
-		 */
-		if (TASK->udebug.debugger != call->sender) {
-			ipc_set_retval(&call->data, EINVAL);
-			ipc_answer(&TASK->kb.box, call);
-			return;
-		}
-	}
-
-	switch (debug_method) {
-	case UDEBUG_M_BEGIN:
-		udebug_receive_begin(call);
-		break;
-	case UDEBUG_M_END:
-		udebug_receive_end(call);
-		break;
-	case UDEBUG_M_SET_EVMASK:
-		udebug_receive_set_evmask(call);
-		break;
-	case UDEBUG_M_GO:
-		udebug_receive_go(call);
-		break;
-	case UDEBUG_M_STOP:
-		udebug_receive_stop(call);
-		break;
-	case UDEBUG_M_THREAD_READ:
-		udebug_receive_thread_read(call);
-		break;
-	case UDEBUG_M_NAME_READ:
-		udebug_receive_name_read(call);
-		break;
-	case UDEBUG_M_AREAS_READ:
-		udebug_receive_areas_read(call);
-		break;
-	case UDEBUG_M_ARGS_READ:
-		udebug_receive_args_read(call);
-		break;
-	case UDEBUG_M_REGS_READ:
-		udebug_receive_regs_read(call);
-		break;
-	case UDEBUG_M_MEM_READ:
-		udebug_receive_mem_read(call);
-		break;
-	}
-}
-
-/** @}
- */
Index: rnel/generic/src/udebug/udebug_ops.c
===================================================================
--- kernel/generic/src/udebug/udebug_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,567 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-
-/**
- * @file
- * @brief Udebug operations.
- *
- * Udebug operations on tasks and threads are implemented here. The
- * functions defined here are called from the udebug_ipc module
- * when servicing udebug IPC messages.
- */
-
-#include <debug.h>
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <str.h>
-#include <syscall/copy.h>
-#include <ipc/ipc.h>
-#include <udebug/udebug.h>
-#include <udebug/udebug_ops.h>
-#include <memw.h>
-#include <stdlib.h>
-
-/** Prepare a thread for a debugging operation.
- *
- * Simply put, return thread t with t->udebug.lock held,
- * but only if it verifies all conditions.
- *
- * Specifically, verifies that thread t exists, is a userspace thread,
- * and belongs to the current task (TASK). Verifies, that the thread
- * is (or is not) go according to being_go (typically false).
- * It also locks t->udebug.lock, making sure that t->udebug.active
- * is true - that the thread is in a valid debugging session.
- *
- * With this verified and the t->udebug.lock mutex held, it is ensured
- * that the thread cannot leave the debugging session, let alone cease
- * to exist.
- *
- * In this function, holding the TASK->udebug.lock mutex prevents the
- * thread from leaving the debugging session, while relaxing from
- * the t->lock spinlock to the t->udebug.lock mutex.
- *
- * @param thread   Pointer, need not at all be valid.
- * @param being_go Required thread state.
- *
- * Returns EOK if all went well, or an error code otherwise.
- *
- */
-static errno_t _thread_op_begin(thread_t *thread, bool being_go)
-{
-	mutex_lock(&TASK->udebug.lock);
-
-	thread = thread_try_get(thread);
-
-	if (!thread) {
-		mutex_unlock(&TASK->udebug.lock);
-		return ENOENT;
-	}
-
-	/* Verify that 'thread' is a userspace thread. */
-	if (!thread->uspace) {
-		mutex_unlock(&TASK->udebug.lock);
-		return ENOENT;
-	}
-
-	/*
-	 * Now we need to grab the thread's debug lock for synchronization
-	 * of the threads stoppability/stop state.
-	 *
-	 */
-	mutex_lock(&thread->udebug.lock);
-
-	/* Verify debugging state. */
-	if (thread->udebug.active != true) {
-		/* Not in debugging session or undesired GO state */
-		mutex_unlock(&thread->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-		return ENOENT;
-	}
-
-	/* Now verify that the thread belongs to the current task. */
-	if (thread->task != TASK) {
-		/* No such thread belonging this task */
-		mutex_unlock(&thread->udebug.lock);
-		mutex_unlock(&TASK->udebug.lock);
-		return ENOENT;
-	}
-
-	/* The big task mutex is no longer needed. */
-	mutex_unlock(&TASK->udebug.lock);
-
-	if (thread->udebug.go != being_go) {
-		/* Not in debugging session or undesired GO state. */
-		mutex_unlock(&thread->udebug.lock);
-		return EINVAL;
-	}
-
-	/* Only thread->udebug.lock left. */
-
-	return EOK;  /* All went well. */
-}
-
-/** End debugging operation on a thread. */
-static void _thread_op_end(thread_t *thread)
-{
-	mutex_unlock(&thread->udebug.lock);
-
-	/* Drop reference from _thread_op_begin() */
-	thread_put(thread);
-}
-
-/** Begin debugging the current task.
- *
- * Initiates a debugging session for the current task (and its threads).
- * When the debugging session has started a reply should be sent to the
- * UDEBUG_BEGIN call. This may happen immediately in this function if
- * all the threads in this task are stoppable at the moment and in this
- * case the function sets @a *active to @c true.
- *
- * Otherwise the function sets @a *active to false and the resonse should
- * be sent as soon as all the threads become stoppable (i.e. they can be
- * considered stopped).
- *
- * @param call The BEGIN call we are servicing.
- * @param active Place to store @c true iff we went directly to active state,
- *               @c false if we only went to beginning state
- *
- * @return EOK on success, EBUSY if the task is already has an active
- *         debugging session.
- */
-errno_t udebug_begin(call_t *call, bool *active)
-{
-	LOG("Debugging task %" PRIu64, TASK->taskid);
-
-	mutex_lock(&TASK->udebug.lock);
-
-	if (TASK->udebug.dt_state != UDEBUG_TS_INACTIVE) {
-		mutex_unlock(&TASK->udebug.lock);
-		return EBUSY;
-	}
-
-	TASK->udebug.dt_state = UDEBUG_TS_BEGINNING;
-	TASK->udebug.begin_call = call;
-	TASK->udebug.debugger = call->sender;
-
-	if (TASK->udebug.not_stoppable_count == 0) {
-		TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
-		TASK->udebug.begin_call = NULL;
-		*active = true;  /* directly to active state */
-	} else
-		*active = false;  /* only in beginning state */
-
-	/* Set udebug.active on all of the task's userspace threads. */
-
-	list_foreach(TASK->threads, th_link, thread_t, thread) {
-		mutex_lock(&thread->udebug.lock);
-		if (thread->uspace) {
-			thread->udebug.active = true;
-			mutex_unlock(&thread->udebug.lock);
-			condvar_broadcast(&thread->udebug.active_cv);
-		} else
-			mutex_unlock(&thread->udebug.lock);
-	}
-
-	mutex_unlock(&TASK->udebug.lock);
-	return EOK;
-}
-
-/** Finish debugging the current task.
- *
- * Closes the debugging session for the current task.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_end(void)
-{
-	LOG("Task %" PRIu64, TASK->taskid);
-
-	mutex_lock(&TASK->udebug.lock);
-	errno_t rc = udebug_task_cleanup(TASK);
-	mutex_unlock(&TASK->udebug.lock);
-
-	return rc;
-}
-
-/** Set the event mask.
- *
- * Sets the event mask that determines which events are enabled.
- *
- * @param mask Or combination of events that should be enabled.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t udebug_set_evmask(udebug_evmask_t mask)
-{
-	LOG("mask = 0x%x", mask);
-
-	mutex_lock(&TASK->udebug.lock);
-
-	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
-		mutex_unlock(&TASK->udebug.lock);
-		return EINVAL;
-	}
-
-	TASK->udebug.evmask = mask;
-	mutex_unlock(&TASK->udebug.lock);
-
-	return EOK;
-}
-
-/** Give thread GO.
- *
- * Upon recieving a go message, the thread is given GO. Being GO
- * means the thread is allowed to execute userspace code (until
- * a debugging event or STOP occurs, at which point the thread loses GO.
- *
- * @param thread The thread to operate on (unlocked and need not be valid).
- * @param call   The GO call that we are servicing.
- *
- */
-errno_t udebug_go(thread_t *thread, call_t *call)
-{
-	/* On success, this will lock thread->udebug.lock. */
-	errno_t rc = _thread_op_begin(thread, false);
-	if (rc != EOK)
-		return rc;
-
-	thread->udebug.go_call = call;
-	thread->udebug.go = true;
-	thread->udebug.cur_event = 0;  /* none */
-
-	/*
-	 * Neither thread's lock nor threads_lock may be held during wakeup.
-	 *
-	 */
-	waitq_wake_all(&thread->udebug.go_wq);
-
-	_thread_op_end(thread);
-
-	return EOK;
-}
-
-/** Stop a thread (i.e. take its GO away)
- *
- * Generates a STOP event as soon as the thread becomes stoppable (i.e.
- * can be considered stopped).
- *
- * @param thread The thread to operate on (unlocked and need not be valid).
- * @param call   The GO call that we are servicing.
- *
- */
-errno_t udebug_stop(thread_t *thread, call_t *call)
-{
-	LOG("udebug_stop()");
-
-	/*
-	 * On success, this will lock thread->udebug.lock. Note that this
-	 * makes sure the thread is not stopped.
-	 *
-	 */
-	errno_t rc = _thread_op_begin(thread, true);
-	if (rc != EOK)
-		return rc;
-
-	/* Take GO away from the thread. */
-	thread->udebug.go = false;
-
-	if (thread->udebug.stoppable != true) {
-		/* Answer will be sent when the thread becomes stoppable. */
-		_thread_op_end(thread);
-		return EOK;
-	}
-
-	/*
-	 * Answer GO call.
-	 *
-	 */
-
-	/* Make sure nobody takes this call away from us. */
-	call = thread->udebug.go_call;
-	thread->udebug.go_call = NULL;
-
-	ipc_set_retval(&call->data, 0);
-	ipc_set_arg1(&call->data, UDEBUG_EVENT_STOP);
-
-	THREAD->udebug.cur_event = UDEBUG_EVENT_STOP;
-
-	_thread_op_end(thread);
-
-	mutex_lock(&TASK->udebug.lock);
-	ipc_answer(&TASK->answerbox, call);
-	mutex_unlock(&TASK->udebug.lock);
-
-	return EOK;
-}
-
-/** Read the list of userspace threads in the current task.
- *
- * The list takes the form of a sequence of thread hashes (i.e. the pointers
- * to thread structures). A buffer of size @a buf_size is allocated and
- * a pointer to it written to @a buffer. The sequence of hashes is written
- * into this buffer.
- *
- * If the sequence is longer than @a buf_size bytes, only as much hashes
- * as can fit are copied. The number of bytes copied is stored in @a stored.
- * The total number of thread bytes that could have been saved had there been
- * enough space is stored in @a needed.
- *
- * The rationale for having @a buf_size is that this function is only
- * used for servicing the THREAD_READ message, which always specifies
- * a maximum size for the userspace buffer.
- *
- * @param buffer   The buffer for storing thread hashes.
- * @param buf_size Buffer size in bytes.
- * @param stored   The actual number of bytes copied will be stored here.
- * @param needed   Total number of hashes that could have been saved.
- *
- */
-errno_t udebug_thread_read(void **buffer, size_t buf_size, size_t *stored,
-    size_t *needed)
-{
-	LOG("udebug_thread_read()");
-
-	/* Allocate a buffer to hold thread IDs */
-	sysarg_t *id_buffer = malloc(buf_size + 1);
-	if (!id_buffer)
-		return ENOMEM;
-
-	mutex_lock(&TASK->udebug.lock);
-
-	/* Verify task state */
-	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
-		mutex_unlock(&TASK->udebug.lock);
-		free(id_buffer);
-		return EINVAL;
-	}
-
-	irq_spinlock_lock(&TASK->lock, true);
-
-	/* Copy down the thread IDs */
-
-	size_t max_ids = buf_size / sizeof(sysarg_t);
-	size_t copied_ids = 0;
-	size_t extra_ids = 0;
-
-	/* FIXME: make sure the thread isn't past debug shutdown... */
-	list_foreach(TASK->threads, th_link, thread_t, thread) {
-		bool uspace = thread->uspace;
-
-		/* Not interested in kernel threads. */
-		if (!uspace)
-			continue;
-
-		if (copied_ids < max_ids) {
-			/* Using thread struct pointer as identification hash */
-			id_buffer[copied_ids++] = (sysarg_t) thread;
-		} else
-			extra_ids++;
-	}
-
-	irq_spinlock_unlock(&TASK->lock, true);
-
-	mutex_unlock(&TASK->udebug.lock);
-
-	*buffer = id_buffer;
-	*stored = copied_ids * sizeof(sysarg_t);
-	*needed = (copied_ids + extra_ids) * sizeof(sysarg_t);
-
-	return EOK;
-}
-
-/** Read task name.
- *
- * Returns task name as non-terminated string in a newly allocated buffer.
- * Also returns the size of the data.
- *
- * @param data      Place to store pointer to newly allocated block.
- * @param data_size Place to store size of the data.
- *
- * @return EOK on success, ENOMEM if memory allocation failed.
- *
- */
-errno_t udebug_name_read(char **data, size_t *data_size)
-{
-	size_t name_size = str_size(TASK->name) + 1;
-
-	*data = malloc(name_size);
-	if (!*data)
-		return ENOMEM;
-	*data_size = name_size;
-
-	memcpy(*data, TASK->name, name_size);
-
-	return EOK;
-}
-
-/** Read the arguments of a system call.
- *
- * The arguments of the system call being being executed are copied
- * to an allocated buffer and a pointer to it is written to @a buffer.
- * The size of the buffer is exactly such that it can hold the maximum number
- * of system-call arguments.
- *
- * Unless the thread is currently blocked in a SYSCALL_B or SYSCALL_E event,
- * this function will fail with an EINVAL error code.
- *
- * @param thread Thread where call arguments are to be read.
- * @param buffer Place to store pointer to new buffer.
- *
- * @return EOK on success, ENOENT if @a t is invalid, EINVAL
- *         if thread state is not valid for this operation.
- *
- */
-errno_t udebug_args_read(thread_t *thread, void **buffer)
-{
-	/* On success, this will lock t->udebug.lock. */
-	errno_t rc = _thread_op_begin(thread, false);
-	if (rc != EOK)
-		return rc;
-
-	/* Additionally we need to verify that we are inside a syscall. */
-	if ((thread->udebug.cur_event != UDEBUG_EVENT_SYSCALL_B) &&
-	    (thread->udebug.cur_event != UDEBUG_EVENT_SYSCALL_E)) {
-		_thread_op_end(thread);
-		return EINVAL;
-	}
-
-	/* Prepare a buffer to hold the arguments. */
-	sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t));
-	if (!arg_buffer) {
-		_thread_op_end(thread);
-		return ENOMEM;
-	}
-
-	/* Copy to a local buffer before releasing the lock. */
-	memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(sysarg_t));
-
-	_thread_op_end(thread);
-
-	*buffer = arg_buffer;
-	return EOK;
-}
-
-/** Read the register state of the thread.
- *
- * The contents of the thread's istate structure are copied to a newly
- * allocated buffer and a pointer to it is written to @a buffer. The size of
- * the buffer will be sizeof(istate_t).
- *
- * Currently register state cannot be read if the thread is inside a system
- * call (as opposed to an exception). This is an implementation limit.
- *
- * @param thread Thread whose state is to be read.
- * @param buffer Place to store pointer to new buffer.
- *
- * @return EOK on success, ENOENT if @a t is invalid, EINVAL
- *         if thread is not in valid state, EBUSY if istate
- *         is not available.
- *
- */
-errno_t udebug_regs_read(thread_t *thread, void **buffer)
-{
-	/* On success, this will lock t->udebug.lock */
-	errno_t rc = _thread_op_begin(thread, false);
-	if (rc != EOK)
-		return rc;
-
-	istate_t *state = thread->udebug.uspace_state;
-	if (state == NULL) {
-		_thread_op_end(thread);
-		return EBUSY;
-	}
-
-	/* Prepare a buffer to hold the data. */
-	istate_t *state_buf = malloc(sizeof(istate_t));
-	if (!state_buf) {
-		_thread_op_end(thread);
-		return ENOMEM;
-	}
-
-	/* Copy to the allocated buffer */
-	memcpy(state_buf, state, sizeof(istate_t));
-
-	_thread_op_end(thread);
-
-	*buffer = (void *) state_buf;
-	return EOK;
-}
-
-/** Read the memory of the debugged task.
- *
- * Reads @a n bytes from the address space of the debugged task, starting
- * from @a uspace_addr. The bytes are copied into an allocated buffer
- * and a pointer to it is written into @a buffer.
- *
- * @param uspace_addr Address from where to start reading.
- * @param n           Number of bytes to read.
- * @param buffer      For storing a pointer to the allocated buffer.
- *
- */
-errno_t udebug_mem_read(uspace_addr_t uspace_addr, size_t n, void **buffer)
-{
-	/* Verify task state */
-	mutex_lock(&TASK->udebug.lock);
-
-	if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
-		mutex_unlock(&TASK->udebug.lock);
-		return EBUSY;
-	}
-
-	void *data_buffer = malloc(n);
-	if (!data_buffer) {
-		mutex_unlock(&TASK->udebug.lock);
-		return ENOMEM;
-	}
-
-	/*
-	 * NOTE: this is not strictly from a syscall... but that shouldn't
-	 * be a problem
-	 *
-	 */
-	errno_t rc = copy_from_uspace(data_buffer, uspace_addr, n);
-	mutex_unlock(&TASK->udebug.lock);
-
-	if (rc != EOK)
-		return rc;
-
-	*buffer = data_buffer;
-	return EOK;
-}
-
-/** @}
- */
Index: rnel/meson.build
===================================================================
--- kernel/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,210 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-arch_src = []
-
-# Fills arch_src.
-subdir('arch' / KARCH)
-
-# Defines genarch_src.
-subdir('genarch')
-
-# Defines generic_src, instrumentable_src.
-subdir('generic')
-
-# Defines test_src
-subdir('test')
-
-kernel_include_dirs = include_directories(
-	'generic/include',
-	'genarch/include',
-	'arch' / KARCH / 'include',
-	'..' / 'abi' / 'arch' / KARCH / 'include',
-	'..' / 'abi' / 'include',
-	'..' / 'common' / 'include',
-	'test',
-)
-
-kernel_defs = [
-	'-imacros', meson.build_root() / 'config.h',
-	'-D_HELENOS_SOURCE',
-	'-DKERNEL',
-	'-DHELENOS_RELEASE=' + HELENOS_RELEASE,
-	'-DHELENOS_COPYRIGHT=' + HELENOS_COPYRIGHT,
-	'-DHELENOS_CODENAME=' + HELENOS_CODENAME,
-	'-D__@0@_BITS__'.format(meson.get_cross_property('bits')),
-]
-
-# Preprocess linker script using C preprocessor.
-kernel_ldscript = custom_target('_link.ld',
-	input: 'arch' / KARCH / '_link.ld.in',
-	output: '_link.ld',
-	command: [
-		cc.cmd_array(),
-		arch_kernel_c_args,
-		kernel_defs,
-		'-I' + meson.current_source_dir() / 'arch' / KARCH / 'include',
-		'-D__ASSEMBLER__',
-		'-D__LINKER__',
-		'-E',
-		'-P',
-		'-x', 'c',
-		'@INPUT@',
-	],
-	capture: true,
-	build_by_default: true,
-)
-
-kernel_link_args = arch_kernel_link_args + [
-	'-Wl,--nmagic',
-	'-T', meson.current_build_dir() / '_link.ld',
-]
-# The kernel is built as ELF but then copied as a blob of bytes and
-# the permissions are not relevant anyway (needed for binutils 2.39+).
-kernel_link_args += ldflags_ignore_rwx_segments
-
-if CONFIG_LTO
-	kernel_link_args += [ '-flto' ]
-endif
-
-kernel_c_args = arch_kernel_c_args + kernel_defs + [
-	'-ffreestanding',
-	'-fdebug-prefix-map=../../kernel/=',
-	'-fdebug-prefix-map=../../../kernel/=',
-
-	cc.get_supported_arguments([
-		# TODO: remove this flag
-		'-Wno-cast-function-type',
-
-		# When accessing specific memory addresses that are below
-		# normal page size, the compiler may assume that we actually
-		# dereferenced NULL pointer and warns us about that.
-		# But in kernel we often need to access these addresses
-		# directly hence we need to ignore these warnings.
-		#
-		# TODO: might make more sense to disable this selectively
-		# in specific files (or better yet, for specific lines).
-		'--param=min-pagesize=0',
-	]),
-]
-
-if not CONFIG_LINE_DEBUG
-	# Keep the debug info needed to get file names for kernel stack traces.
-	kernel_c_args += cc.get_supported_arguments([ '-gdwarf-5', '-g1', '-gno-statement-frontiers' ])
-endif
-
-if CONFIG_LTO
-	kernel_c_args += [ '-flto' ]
-endif
-
-if cc.get_id() == 'clang'
-	kernel_c_args += [
-		'-fno-stack-protector',
-		'-fno-PIC',
-		'-mllvm', '-asm-macro-max-nesting-depth=1000',
-	]
-endif
-
-instrumentables = static_library('instrumentables', instrumentable_src,
-	include_directories: kernel_include_dirs,
-	implicit_include_directories: false,
-	c_args: kernel_c_args + (CONFIG_TRACE ? [ '-finstrument-functions' ] : []),
-	pic: false,
-)
-
-noninstrumentables = static_library('noninstrumentables', arch_src, genarch_src, generic_src, test_src,
-	include_directories: kernel_include_dirs,
-	implicit_include_directories: false,
-	c_args: kernel_c_args,
-	pic: false,
-)
-
-all_kernel_objects = [ instrumentables, noninstrumentables ]
-
-kernel_name = 'kernel.elf'
-kernel_map_name = kernel_name + '.map'
-kernel_map_path = meson.current_build_dir() / kernel_map_name
-
-kernel_elf = executable(kernel_name,
-	include_directories: kernel_include_dirs,
-	implicit_include_directories: false,
-	c_args: kernel_c_args,
-	link_args: kernel_c_args + kernel_link_args + [
-		'-Wl,-Map,' + kernel_map_path,
-	],
-	link_depends: kernel_ldscript,
-	link_whole: all_kernel_objects,
-	pie: false,
-)
-
-kernel_dbg = custom_target('kernel.dbg',
-	output: 'kernel.dbg',
-	input: kernel_elf,
-	command: [
-		objcopy,
-		'--only-keep-debug',
-		'@INPUT@',
-		'@OUTPUT@',
-	],
-)
-
-kernel_elf_stripped = custom_target(kernel_name + '.stripped',
-	output: kernel_name + '.stripped',
-	input: kernel_elf,
-	command: [
-		objcopy,
-		'--strip-unneeded',
-		'@INPUT@',
-		'@OUTPUT@',
-	],
-)
-
-rd_init_binaries += [[ kernel_elf_stripped, 'boot/kernel.elf' ]]
-install_files += [[ 'boot', kernel_elf_stripped.full_path(), 'kernel.elf' ]]
-install_deps += [ kernel_elf_stripped ]
-
-if CONFIG_SYMTAB
-	rd_init_binaries += [[ kernel_dbg, 'kernel.dbg' ]]
-	install_files += [[ 'boot', kernel_dbg.full_path(), 'kernel.dbg' ]]
-	install_deps += [ kernel_dbg ]
-endif
-
-kernel_disasm = custom_target('kernel.elf.disasm',
-	command: [ objdump, '-S', '@INPUT@' ],
-	input: kernel_elf,
-	output: 'kernel.elf.disasm',
-	capture: true,
-	build_by_default: true,
-)
-
-# TODO: Add configuration option for installing debug files
-if false
-	install_files += [[ 'boot', kernel_disasm.full_path(), 'kernel.elf.disasm' ]]
-	install_deps += [ kernel_disasm ]
-endif
Index: rnel/test/atomic/atomic1.c
===================================================================
--- kernel/test/atomic/atomic1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <atomic.h>
-
-const char *test_atomic1(void)
-{
-	atomic_int a;
-
-	atomic_store(&a, 10);
-	if (atomic_load(&a) != 10)
-		return "Failed atomic_store()/atomic_load()";
-
-	if (atomic_postinc(&a) != 10)
-		return "Failed atomic_postinc()";
-	if (atomic_load(&a) != 11)
-		return "Failed atomic_load() after atomic_postinc()";
-
-	if (atomic_postdec(&a) != 11)
-		return "Failed atomic_postdec()";
-	if (atomic_load(&a) != 10)
-		return "Failed atomic_load() after atomic_postdec()";
-
-	if (atomic_preinc(&a) != 11)
-		return "Failed atomic_preinc()";
-	if (atomic_load(&a) != 11)
-		return "Failed atomic_load() after atomic_preinc()";
-
-	if (atomic_predec(&a) != 10)
-		return "Failed atomic_predec()";
-	if (atomic_load(&a) != 10)
-		return "Failed atomic_load() after atomic_predec()";
-
-	return NULL;
-}
Index: rnel/test/atomic/atomic1.def
===================================================================
--- kernel/test/atomic/atomic1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"atomic1",
-	"Test atomic operations",
-	&test_atomic1,
-	true
-},
Index: rnel/test/debug/mips1.c
===================================================================
--- kernel/test/debug/mips1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-
-const char *test_mips1(void)
-{
-	TPRINTF("If kconsole is compiled in, you should enter debug mode now.\n");
-
-	asm volatile (
-	    "break\n"
-	);
-
-	return "Back from debug mode";
-}
Index: rnel/test/debug/mips1.def
===================================================================
--- kernel/test/debug/mips1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"mips1",
-	"MIPS debug test",
-	&test_mips1,
-	false
-},
Index: rnel/test/debug/mips1_skip.c
===================================================================
--- kernel/test/debug/mips1_skip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <stddef.h>
-
-const char *test_mips1(void)
-{
-	return NULL;
-}
Index: rnel/test/fault/fault1.c
===================================================================
--- kernel/test/fault/fault1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-
-#pragma GCC diagnostic ignored "-Warray-bounds"
-
-const char *test_fault1(void)
-{
-	((int *)(0))[1] = 0;
-
-	return "Written to NULL";
-}
Index: rnel/test/fault/fault1.def
===================================================================
--- kernel/test/fault/fault1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"fault1",
-	"Write to NULL (maybe page fault)",
-	&test_fault1,
-	false
-},
Index: rnel/test/meson.build
===================================================================
--- kernel/test/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-## Test sources
-#
-
-test_src = []
-
-if CONFIG_TEST
-	test_src += files(
-		'test.c',
-		'atomic/atomic1.c',
-		'fault/fault1.c',
-		'mm/falloc1.c',
-		'mm/falloc2.c',
-		'mm/mapping1.c',
-		'mm/slab1.c',
-		'mm/slab2.c',
-		'synch/semaphore1.c',
-		'synch/semaphore2.c',
-		'print/print1.c',
-		'print/print2.c',
-		'print/print3.c',
-		'print/print4.c',
-		'print/print5.c',
-		'thread/thread1.c',
-	)
-
-	if KARCH == 'mips32'
-		test_src += files('debug/mips1.c')
-	else
-		test_src += files('debug/mips1_skip.c')
-	endif
-
-	if KARCH == 'ia64'
-		test_src += files('mm/purge1.c')
-	else
-		test_src += files('mm/purge1_skip.c')
-	endif
-endif
Index: rnel/test/mm/falloc1.c
===================================================================
--- kernel/test/mm/falloc1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <arch/mm/page.h>
-#include <typedefs.h>
-#include <align.h>
-#include <stdlib.h>
-
-#define MAX_FRAMES  1024
-#define MAX_ORDER   8
-#define TEST_RUNS   2
-
-const char *test_falloc1(void)
-{
-	if (TEST_RUNS < 2)
-		return "Test is compiled with TEST_RUNS < 2";
-
-	uintptr_t *frames = (uintptr_t *)
-	    malloc(MAX_FRAMES * sizeof(uintptr_t));
-	if (frames == NULL)
-		return "Unable to allocate frames";
-
-	unsigned int results[MAX_FRAMES + 1];
-
-	for (unsigned int run = 0; run < TEST_RUNS; run++) {
-		for (size_t count = 1; count <= MAX_FRAMES; count++) {
-			size_t bytes = FRAMES2SIZE(count);
-
-			TPRINTF("Allocating %zu frames blocks (%zu bytes) ... ",
-			    count, bytes);
-
-			unsigned int allocated = 0;
-			for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) {
-				frames[allocated] = frame_alloc(count, FRAME_ATOMIC, 0);
-				if (frames[allocated]) {
-					allocated++;
-				} else {
-					TPRINTF("done. ");
-					break;
-				}
-			}
-
-			TPRINTF("%d blocks allocated.\n", allocated);
-
-			if (run > 0) {
-				if (results[count] != allocated)
-					return "Possible frame leak";
-			} else
-				results[count] = allocated;
-
-			TPRINTF("Deallocating ... ");
-
-			for (unsigned int i = 0; i < allocated; i++)
-				frame_free(frames[i], count);
-
-			TPRINTF("done.\n");
-		}
-	}
-
-	free(frames);
-
-	return NULL;
-}
Index: rnel/test/mm/falloc1.def
===================================================================
--- kernel/test/mm/falloc1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"falloc1",
-	"Frame allocator test 1",
-	&test_falloc1,
-	true
-},
Index: rnel/test/mm/falloc2.c
===================================================================
--- kernel/test/mm/falloc2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <stdlib.h>
-#include <arch/mm/page.h>
-#include <typedefs.h>
-#include <atomic.h>
-#include <proc/thread.h>
-#include <memw.h>
-#include <arch.h>
-
-#define MAX_FRAMES  256
-
-#define THREAD_RUNS  1
-#define THREADS      8
-
-static atomic_size_t thread_fail;
-
-static void falloc(void *arg)
-{
-	uint8_t val = THREAD->tid % THREADS;
-
-	uintptr_t *frames = (uintptr_t *)
-	    malloc(MAX_FRAMES * sizeof(uintptr_t));
-	if (frames == NULL) {
-		TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-		    "Unable to allocate frames\n", THREAD->tid, CPU->id);
-		atomic_inc(&thread_fail);
-		return;
-	}
-
-	for (unsigned int run = 0; run < THREAD_RUNS; run++) {
-		for (size_t count = 1; count <= MAX_FRAMES; count++) {
-			size_t bytes = FRAMES2SIZE(count);
-
-			TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-			    "Allocating %zu frames blocks (%zu bytes) ... \n", THREAD->tid,
-			    CPU->id, count, bytes);
-
-			unsigned int allocated = 0;
-			for (unsigned int i = 0; i < (MAX_FRAMES / count); i++) {
-				frames[allocated] = frame_alloc(count, FRAME_ATOMIC, 0);
-				if (frames[allocated]) {
-					memsetb((void *) PA2KA(frames[allocated]), bytes, val);
-					allocated++;
-				} else
-					break;
-			}
-
-			TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-			    "%u blocks allocated.\n", THREAD->tid, CPU->id,
-			    allocated);
-			TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-			    "Deallocating ... \n", THREAD->tid, CPU->id);
-
-			for (unsigned int i = 0; i < allocated; i++) {
-				for (size_t k = 0; k < bytes; k++) {
-					if (((uint8_t *) PA2KA(frames[i]))[k] != val) {
-						TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-						    "Unexpected data (%c) in block %zu offset %zu\n",
-						    THREAD->tid, CPU->id, ((char *) PA2KA(frames[i]))[k],
-						    frames[i], k);
-						atomic_inc(&thread_fail);
-						goto cleanup;
-					}
-				}
-				frame_free(frames[i], count);
-			}
-
-			TPRINTF("Thread #%" PRIu64 " (cpu%u): "
-			    "Finished run.\n", THREAD->tid, CPU->id);
-		}
-	}
-
-cleanup:
-	free(frames);
-
-	TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n",
-	    THREAD->tid, CPU->id);
-}
-
-const char *test_falloc2(void)
-{
-	atomic_store(&thread_fail, 0);
-
-	thread_t *threads[THREADS] = { };
-
-	for (unsigned int i = 0; i < THREADS; i++) {
-		thread_t *thrd = thread_create(falloc, NULL, TASK,
-		    THREAD_FLAG_NONE, "falloc2");
-		if (!thrd) {
-			TPRINTF("Could not create thread %u\n", i);
-			break;
-		}
-		thread_start(thrd);
-		threads[i] = thrd;
-	}
-
-	for (unsigned int i = 0; i < THREADS; i++) {
-		if (threads[i] != NULL)
-			thread_join(threads[i]);
-
-		TPRINTF("Threads left: %u\n", THREADS - i - 1);
-	}
-
-	if (atomic_load(&thread_fail) == 0)
-		return NULL;
-
-	return "Test failed";
-}
Index: rnel/test/mm/falloc2.def
===================================================================
--- kernel/test/mm/falloc2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"falloc2",
-	"Frame allocator test 2",
-	&test_falloc2,
-	true
-},
Index: rnel/test/mm/mapping1.c
===================================================================
--- kernel/test/mm/mapping1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <arch/mm/page.h>
-#include <mm/km.h>
-#include <typedefs.h>
-#include <arch.h>
-
-#define TEST_MAGIC  UINT32_C(0x01234567)
-
-const char *test_mapping1(void)
-{
-	uintptr_t frame = frame_alloc(1, FRAME_HIGHMEM, 0);
-
-	uintptr_t page0 = km_map(frame, FRAME_SIZE, FRAME_SIZE,
-	    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
-	TPRINTF("Virtual address %p mapped to physical address %p.\n",
-	    (void *) page0, (void *) frame);
-
-	uintptr_t page1 = km_map(frame, FRAME_SIZE, FRAME_SIZE,
-	    PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE);
-	TPRINTF("Virtual address %p mapped to physical address %p.\n",
-	    (void *) page1, (void *) frame);
-
-	for (unsigned int i = 0; i < 2; i++) {
-		TPRINTF("Writing magic using the first virtual address.\n");
-
-		*((uint32_t *) page0) = TEST_MAGIC;
-
-		TPRINTF("Reading magic using the second virtual address.\n");
-
-		uint32_t v = *((uint32_t *) page1);
-
-		if (v != TEST_MAGIC) {
-			km_unmap(page0, PAGE_SIZE);
-			km_unmap(page1, PAGE_SIZE);
-			frame_free(frame, 1);
-			return "Criss-cross read does not match the value written.";
-		}
-
-		TPRINTF("Writing zero using the second virtual address.\n");
-
-		*((uint32_t *) page1) = 0;
-
-		TPRINTF("Reading zero using the first virtual address.\n");
-
-		v = *((uint32_t *) page0);
-
-		if (v != 0) {
-			km_unmap(page0, PAGE_SIZE);
-			km_unmap(page1, PAGE_SIZE);
-			frame_free(frame, 1);
-			return "Criss-cross read does not match the value written.";
-		}
-	}
-
-	km_unmap(page0, PAGE_SIZE);
-	km_unmap(page1, PAGE_SIZE);
-	frame_free(frame, 1);
-
-	return NULL;
-}
Index: rnel/test/mm/mapping1.def
===================================================================
--- kernel/test/mm/mapping1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"mapping1",
-	"Mapping test",
-	&test_mapping1,
-	true
-},
Index: rnel/test/mm/purge1.c
===================================================================
--- kernel/test/mm/purge1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/page.h>
-#include <mm/frame.h>
-#include <mm/as.h>
-#include <arch/mm/page.h>
-#include <arch/mm/tlb.h>
-#include <typedefs.h>
-
-extern void tlb_invalidate_all(void);
-extern void tlb_invalidate_pages(asid_t asid, uintptr_t va, size_t cnt);
-
-const char *test_purge1(void)
-{
-	tlb_entry_t entryi;
-	tlb_entry_t entryd;
-
-	int i;
-
-	entryd.word[0] = 0;
-	entryd.word[1] = 0;
-
-	entryd.p = true;                 /* present */
-	entryd.ma = MA_WRITEBACK;
-	entryd.a = true;                 /* already accessed */
-	entryd.d = true;                 /* already dirty */
-	entryd.pl = PL_KERNEL;
-	entryd.ar = AR_READ | AR_WRITE;
-	entryd.ppn = 0;
-	entryd.ps = PAGE_WIDTH;
-
-	entryi.word[0] = 0;
-	entryi.word[1] = 0;
-
-	entryi.p = true;                 /* present */
-	entryi.ma = MA_WRITEBACK;
-	entryi.a = true;                 /* already accessed */
-	entryi.d = true;                 /* already dirty */
-	entryi.pl = PL_KERNEL;
-	entryi.ar = AR_READ | AR_EXECUTE;
-	entryi.ppn = 0;
-	entryi.ps = PAGE_WIDTH;
-
-	for (i = 0; i < 100; i++) {
-		itc_mapping_insert(0 + i * (1 << PAGE_WIDTH), 8, entryi);
-		dtc_mapping_insert(0 + i * (1 << PAGE_WIDTH), 9, entryd);
-	}
-
-	tlb_invalidate_pages(8, 0x0c000, 14);
-
-	/* tlb_invalidate_all(); */
-
-	return NULL;
-}
Index: rnel/test/mm/purge1.def
===================================================================
--- kernel/test/mm/purge1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"purge1",
-	"Itanium TLB purge test",
-	&test_purge1,
-	true
-},
Index: rnel/test/mm/purge1_skip.c
===================================================================
--- kernel/test/mm/purge1_skip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <test.h>
-
-const char *test_purge1(void)
-{
-	return NULL;
-}
Index: rnel/test/mm/slab1.c
===================================================================
--- kernel/test/mm/slab1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/slab.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <memw.h>
-
-#define VAL_COUNT  1024
-
-static void *data[VAL_COUNT];
-
-static void testit(int size, int count)
-{
-	slab_cache_t *cache;
-	int i;
-
-	TPRINTF("Creating cache, object size: %d.\n", size);
-
-	cache = slab_cache_create("test_cache", size, 0, NULL, NULL,
-	    SLAB_CACHE_NOMAGAZINE);
-
-	TPRINTF("Allocating %d items...", count);
-
-	for (i = 0; i < count; i++) {
-		data[i] = slab_alloc(cache, FRAME_ATOMIC);
-		if (data[i])
-			memsetb(data[i], size, 0);
-	}
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Freeing %d items...", count);
-
-	for (i = 0; i < count; i++)
-		slab_free(cache, data[i]);
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Allocating %d items...", count);
-
-	for (i = 0; i < count; i++) {
-		data[i] = slab_alloc(cache, FRAME_ATOMIC);
-		if (data[i])
-			memsetb(data[i], size, 0);
-	}
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Freeing %d items...", count / 2);
-
-	for (i = count - 1; i >= count / 2; i--)
-		slab_free(cache, data[i]);
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Allocating %d items...", count / 2);
-
-	for (i = count / 2; i < count; i++) {
-		data[i] = slab_alloc(cache, FRAME_ATOMIC);
-		if (data[i])
-			memsetb(data[i], size, 0);
-	}
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Freeing %d items...", count);
-
-	for (i = 0; i < count; i++)
-		slab_free(cache, data[i]);
-
-	TPRINTF("done.\n");
-
-	slab_cache_destroy(cache);
-
-	TPRINTF("Test complete.\n");
-}
-
-static void testsimple(void)
-{
-	testit(100, VAL_COUNT);
-	testit(200, VAL_COUNT);
-	testit(1024, VAL_COUNT);
-	testit(2048, 512);
-	testit(4000, 128);
-	testit(8192, 128);
-	testit(16384, 128);
-	testit(16385, 128);
-}
-
-#define THREADS        6
-#define THR_MEM_COUNT  1024
-#define THR_MEM_SIZE   128
-
-static void *thr_data[THREADS][THR_MEM_COUNT];
-static slab_cache_t *thr_cache;
-
-static void slabtest(void *data)
-{
-	int offs = (int) (sysarg_t) data;
-	int i, j;
-
-	TPRINTF("Starting thread #%" PRIu64 "...\n", THREAD->tid);
-
-	for (j = 0; j < 10; j++) {
-		for (i = 0; i < THR_MEM_COUNT; i++)
-			thr_data[offs][i] = slab_alloc(thr_cache, FRAME_ATOMIC);
-		for (i = 0; i < THR_MEM_COUNT / 2; i++)
-			slab_free(thr_cache, thr_data[offs][i]);
-		for (i = 0; i < THR_MEM_COUNT / 2; i++)
-			thr_data[offs][i] = slab_alloc(thr_cache, FRAME_ATOMIC);
-		for (i = 0; i < THR_MEM_COUNT; i++)
-			slab_free(thr_cache, thr_data[offs][i]);
-	}
-
-	TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
-}
-
-static void testthreads(void)
-{
-	thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL,
-	    SLAB_CACHE_NOMAGAZINE);
-
-	thread_t *threads[THREADS] = { };
-
-	for (int i = 0; i < THREADS; i++) {
-		threads[i] = thread_create(slabtest, (void *) (sysarg_t) i,
-		    TASK, THREAD_FLAG_NONE, "slabtest");
-		if (threads[i]) {
-			thread_start(threads[i]);
-		} else {
-			TPRINTF("Could not create thread %d\n", i);
-		}
-	}
-
-	for (int i = 0; i < THREADS; i++) {
-		if (threads[i] != NULL)
-			thread_join(threads[i]);
-	}
-
-	slab_cache_destroy(thr_cache);
-
-	TPRINTF("Test complete.\n");
-}
-
-const char *test_slab1(void)
-{
-	testsimple();
-	testthreads();
-
-	return NULL;
-}
Index: rnel/test/mm/slab1.def
===================================================================
--- kernel/test/mm/slab1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"slab1",
-	"SLAB test 1",
-	&test_slab1,
-	true
-},
Index: rnel/test/mm/slab2.c
===================================================================
--- kernel/test/mm/slab2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,241 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <mm/slab.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <mm/frame.h>
-#include <memw.h>
-#include <synch/condvar.h>
-#include <synch/mutex.h>
-
-#define ITEM_SIZE  256
-
-/** Fill memory with 2 caches, when allocation fails,
- *  free one of the caches. We should have everything in magazines,
- *  now allocation should clean magazines and allow for full allocation.
- */
-static void totalmemtest(void)
-{
-	slab_cache_t *cache1;
-	slab_cache_t *cache2;
-	int i;
-
-	void *data1, *data2;
-	void *olddata1 = NULL, *olddata2 = NULL;
-
-	cache1 = slab_cache_create("test_cache1", ITEM_SIZE, 0, NULL, NULL, 0);
-	cache2 = slab_cache_create("test_cache2", ITEM_SIZE, 0, NULL, NULL, 0);
-
-	TPRINTF("Allocating...");
-
-	/* Use atomic alloc, so that we find end of memory */
-	do {
-		data1 = slab_alloc(cache1, FRAME_ATOMIC);
-		data2 = slab_alloc(cache2, FRAME_ATOMIC);
-		if ((!data1) || (!data2)) {
-			if (data1)
-				slab_free(cache1, data1);
-			if (data2)
-				slab_free(cache2, data2);
-			break;
-		}
-		memsetb(data1, ITEM_SIZE, 0);
-		memsetb(data2, ITEM_SIZE, 0);
-		*((void **) data1) = olddata1;
-		*((void **) data2) = olddata2;
-		olddata1 = data1;
-		olddata2 = data2;
-	} while (true);
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Deallocating cache2...");
-
-	/* We do not have memory - now deallocate cache2 */
-	while (olddata2) {
-		data2 = *((void **) olddata2);
-		slab_free(cache2, olddata2);
-		olddata2 = data2;
-	}
-
-	TPRINTF("done.\n");
-
-	TPRINTF("Allocating to cache1...\n");
-
-	for (i = 0; i < 30; i++) {
-		data1 = slab_alloc(cache1, FRAME_ATOMIC);
-		if (!data1) {
-			TPRINTF("Incorrect memory size - use another test.");
-			return;
-		}
-		memsetb(data1, ITEM_SIZE, 0);
-		*((void **) data1) = olddata1;
-		olddata1 = data1;
-	}
-	while (true) {
-		data1 = slab_alloc(cache1, FRAME_ATOMIC);
-		if (!data1)
-			break;
-		memsetb(data1, ITEM_SIZE, 0);
-		*((void **) data1) = olddata1;
-		olddata1 = data1;
-	}
-
-	TPRINTF("Deallocating cache1...");
-
-	while (olddata1) {
-		data1 = *((void **) olddata1);
-		slab_free(cache1, olddata1);
-		olddata1 = data1;
-	}
-
-	TPRINTF("done.\n");
-
-	if (!test_quiet)
-		slab_print_list();
-
-	slab_cache_destroy(cache1);
-	slab_cache_destroy(cache2);
-}
-
-static slab_cache_t *thr_cache;
-static CONDVAR_INITIALIZE(thread_starter);
-static MUTEX_INITIALIZE(starter_mutex, MUTEX_PASSIVE);
-
-#define THREADS  8
-
-static void slabtest(void *priv)
-{
-	void *data = NULL, *new;
-
-	mutex_lock(&starter_mutex);
-	condvar_wait(&thread_starter, &starter_mutex);
-	mutex_unlock(&starter_mutex);
-
-	TPRINTF("Starting thread #%" PRIu64 "...\n", THREAD->tid);
-
-	/* Alloc all */
-	TPRINTF("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
-
-	while (true) {
-		/* Call with atomic to detect end of memory */
-		new = slab_alloc(thr_cache, FRAME_ATOMIC);
-		if (!new)
-			break;
-		*((void **) new) = data;
-		data = new;
-	}
-
-	TPRINTF("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
-
-	while (data) {
-		new = *((void **)data);
-		*((void **) data) = NULL;
-		slab_free(thr_cache, data);
-		data = new;
-	}
-
-	TPRINTF("Thread #%" PRIu64 " allocating...\n", THREAD->tid);
-
-	while (true) {
-		/* Call with atomic to detect end of memory */
-		new = slab_alloc(thr_cache, FRAME_ATOMIC);
-		if (!new)
-			break;
-		*((void **) new) = data;
-		data = new;
-	}
-
-	TPRINTF("Thread #%" PRIu64 " releasing...\n", THREAD->tid);
-
-	while (data) {
-		new = *((void **)data);
-		*((void **) data) = NULL;
-		slab_free(thr_cache, data);
-		data = new;
-	}
-
-	TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
-
-	if (!test_quiet)
-		slab_print_list();
-}
-
-static void multitest(int size)
-{
-	/*
-	 * Start 8 threads that just allocate as much as possible,
-	 * then release everything, then again allocate, then release
-	 */
-
-	TPRINTF("Running stress test with size %d\n", size);
-
-	thr_cache = slab_cache_create("thread_cache", size, 0, NULL, NULL, 0);
-
-	thread_t *threads[THREADS] = { };
-
-	for (int i = 0; i < THREADS; i++) {
-		threads[i] = thread_create(slabtest, NULL,
-		    TASK, THREAD_FLAG_NONE, "slabtest");
-		if (threads[i]) {
-			thread_start(threads[i]);
-		} else {
-			TPRINTF("Could not create thread %d\n", i);
-		}
-	}
-
-	thread_sleep(1);
-	condvar_broadcast(&thread_starter);
-
-	for (int i = 0; i < THREADS; i++) {
-		if (threads[i] != NULL)
-			thread_join(threads[i]);
-	}
-
-	slab_cache_destroy(thr_cache);
-	TPRINTF("Stress test complete.\n");
-}
-
-const char *test_slab2(void)
-{
-	TPRINTF("Running reclaim single-thread test .. pass 1\n");
-	totalmemtest();
-
-	TPRINTF("Running reclaim single-thread test .. pass 2\n");
-	totalmemtest();
-
-	TPRINTF("Reclaim test OK.\n");
-
-	multitest(128);
-	multitest(2048);
-	multitest(8192);
-
-	return NULL;
-}
Index: rnel/test/mm/slab2.def
===================================================================
--- kernel/test/mm/slab2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"slab2",
-	"SLAB test 2",
-	&test_slab2,
-	true
-},
Index: rnel/test/print/print1.c
===================================================================
--- kernel/test/print/print1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <test.h>
-
-const char *test_print1(void)
-{
-	TPRINTF("Testing printf(\"%%*.*s\", 5, 3, \"text\"):\n");
-	TPRINTF("Expected output: \"  tex\"\n");
-	TPRINTF("Real output:     \"%*.*s\"\n\n", 5, 3, "text");
-
-	TPRINTF("Testing printf(\"%%10.8s\", \"very long text\"):\n");
-	TPRINTF("Expected output: \"  very lon\"\n");
-	TPRINTF("Real output:     \"%10.8s\"\n\n", "very long text");
-
-	TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n");
-	TPRINTF("Expected output: \"    text\"\n");
-	TPRINTF("Real output:     \"%8.10s\"\n\n", "text");
-
-	TPRINTF("Testing printf(\"%%8.10s\", \"very long text\"):\n");
-	TPRINTF("Expected output: \"very long \"\n");
-	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
-
-	TPRINTF("Testing printf(\"%%-*.*s\", 7, 7, \"text\"):\n");
-	TPRINTF("Expected output: \"text   \"\n");
-	TPRINTF("Real output:     \"%-*.*s\"\n\n", 7, 7, "text");
-
-	return NULL;
-}
Index: rnel/test/print/print1.def
===================================================================
--- kernel/test/print/print1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print1",
-	"String printf test",
-	&test_print1,
-	true
-},
Index: rnel/test/print/print2.c
===================================================================
--- kernel/test/print/print2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <test.h>
-#include <typedefs.h>
-
-const char *test_print2(void)
-{
-	TPRINTF("Testing printf(\"%%c\", 'a'):\n");
-	TPRINTF("Expected output: [a]\n");
-	TPRINTF("Real output:     [%c]\n\n", 'a');
-
-	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
-	TPRINTF("Expected output: [1] [ 02] [03 ] [004] [005]\n");
-	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", 1, 2, 3, 4, 5);
-
-	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", -1, -2, -3, -4, -5):\n");
-	TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
-	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5);
-
-	TPRINTF("Testing printf(\"%%lld %%3.2lld %%-3.2lld %%2.3lld %%-2.3lld\", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5):\n");
-	TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
-	TPRINTF("Real output:     [%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]\n\n", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5);
-
-	TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n");
-	TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n");
-	TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
-
-	char ch[12];
-	ptrdiff_t d, neg_d;
-
-	d = &ch[0] - &ch[12];
-	neg_d = (unsigned)(-d);
-	TPRINTF("Testing printf(\"%%td %%tu %%tx %%ti %%to\", d, neg_d, neg_d, d, neg_d):\n");
-	TPRINTF("Expected output: [-12] [12] [c] [-12] [14]\n");
-	TPRINTF("Real output:     [%td] [%tu] [%tx] [%ti] [%to]\n\n", d, neg_d, neg_d, d, neg_d);
-
-	sysarg_t nat = 0x12345678;
-
-	TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), \"Lovely string\"):\n");
-	TPRINTF("Expected output: [0x1234567887654321] [0x12345678] [0x1234] [0x12] [0x12345678] [0x1234567887654321] \"Lovely string\"\n");
-	TPRINTF("Real output:     [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), "Lovely string");
-
-	return NULL;
-}
Index: rnel/test/print/print2.def
===================================================================
--- kernel/test/print/print2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print2",
-	"Numeric printf test",
-	&test_print2,
-	true
-},
Index: rnel/test/print/print3.c
===================================================================
--- kernel/test/print/print3.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <macros.h>
-#include <stddef.h>
-#include <test.h>
-
-#define BUFFER_SIZE  32
-
-const char *test_print3(void)
-{
-	char buffer[BUFFER_SIZE];
-	int retval;
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short text without parameters.\"):\n");
-	TPRINTF("Expected result: retval=30 buffer=\"Short text without parameters.\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters.");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very very very long text without parameters.\"):\n");
-	TPRINTF("Expected result: retval=44 buffer=\"Very very very long text withou\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Very very very long text without parameters.");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short %%s.\", \"text\"):\n");
-	TPRINTF("Expected result: retval=11 buffer=\"Short text.\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Short %s.", "text");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very long %%s. This text's length is more than %%d. We are interested in the result.\", \"text\", " STRING(BUFFER_SIZE) "):\n");
-	TPRINTF("Expected result: retval=84 buffer=\"Very long text. This text's len\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text's length is more than %d. We are interested in the result.", "text", BUFFER_SIZE);
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	return NULL;
-}
Index: rnel/test/print/print3.def
===================================================================
--- kernel/test/print/print3.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print3",
-	"Buffered printf test",
-	&test_print3,
-	true
-},
Index: rnel/test/print/print4.c
===================================================================
--- kernel/test/print/print4.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stddef.h>
-#include <test.h>
-#include <typedefs.h>
-
-const char *test_print4(void)
-{
-	TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
-
-	uint8_t group;
-	for (group = 1; group < 4; group++) {
-		TPRINTF("%#x: ", group << 5);
-
-		uint8_t index;
-		for (index = 0; index < 32; index++)
-			TPRINTF("%c", (char) ((group << 5) + index));
-
-		TPRINTF("  ");
-		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wint_t) ((group << 5) + index));
-
-		TPRINTF("\n");
-	}
-
-	TPRINTF("\nExtended ASCII characters (160 - 255) using printf(\"%%lc\"):\n");
-
-	for (group = 5; group < 8; group++) {
-		TPRINTF("%#x: ", group << 5);
-
-		uint8_t index;
-		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wint_t) ((group << 5) + index));
-
-		TPRINTF("\n");
-	}
-
-	TPRINTF("\nUTF-8 strings using printf(\"%%s\"):\n");
-	TPRINTF("English:  %s\n", "Quick brown fox jumps over the lazy dog");
-	TPRINTF("Czech:    %s\n", "Příliš žluťoučký kůň úpěl ďábelské ódy");
-	TPRINTF("Greek:    %s\n", "Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-	TPRINTF("Hebrew:   %s\n", "משוואת ברנולי היא משוואה בהידרודינמיקה");
-	TPRINTF("Arabic:   %s\n", "التوزيع الجغرافي للحمل العنقودي");
-	TPRINTF("Russian:  %s\n", "Леннон познакомился с художницей-авангардисткой");
-	TPRINTF("Armenian: %s\n", "Սկսեց հրատարակվել Երուսաղեմի հայկական");
-
-	TPRINTF("\nUTF-32 strings using printf(\"%%ls\"):\n");
-	TPRINTF("English:  %ls\n", L"Quick brown fox jumps over the lazy dog");
-	TPRINTF("Czech:    %ls\n", L"Příliš žluťoučký kůň úpěl ďábelské ódy");
-	TPRINTF("Greek:    %ls\n", L"Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-	TPRINTF("Hebrew:   %ls\n", L"משוואת ברנולי היא משוואה בהידרודינמיקה");
-	TPRINTF("Arabic:   %ls\n", L"التوزيع الجغرافي للحمل العنقودي");
-	TPRINTF("Russian:  %ls\n", L"Леннон познакомился с художницей-авангардисткой");
-	TPRINTF("Armenian: %ls\n", L"Սկսեց հրատարակվել Երուսաղեմի հայկական");
-
-	return NULL;
-}
Index: rnel/test/print/print4.def
===================================================================
--- kernel/test/print/print4.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print4",
-	"Unicode test",
-	&test_print4,
-	true
-},
Index: rnel/test/print/print5.c
===================================================================
--- kernel/test/print/print5.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This test tests several features of the HelenOS
- * printf() implementation which go beyond the POSIX
- * specification and GNU printf() behaviour.
- *
- * Therefore we disable printf() argument checking by
- * the GCC compiler in this source file to avoid false
- * positives.
- *
- */
-#pragma GCC diagnostic ignored "-Wformat"
-
-#include <stddef.h>
-#include <test.h>
-
-const char *test_print5(void)
-{
-	TPRINTF("Testing printf(\"%%s\", NULL):\n");
-	TPRINTF("Expected output: \"(NULL)\"\n");
-	TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
-
-	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
-	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
-	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
-
-	return NULL;
-}
Index: rnel/test/print/print5.def
===================================================================
--- kernel/test/print/print5.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print5",
-	"Extended printf test",
-	&test_print5,
-	true
-},
Index: rnel/test/synch/semaphore1.c
===================================================================
--- kernel/test/synch/semaphore1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <arch.h>
-#include <atomic.h>
-#include <proc/thread.h>
-#include <synch/waitq.h>
-#include <synch/semaphore.h>
-
-#define AT_ONCE    3
-#define PRODUCERS  50
-#define CONSUMERS  50
-
-static semaphore_t sem;
-
-static waitq_t can_start;
-static atomic_size_t items_produced;
-static atomic_size_t items_consumed;
-
-static void producer(void *arg)
-{
-	waitq_sleep(&can_start);
-
-	semaphore_down(&sem);
-	atomic_inc(&items_produced);
-	thread_usleep(250);
-	semaphore_up(&sem);
-}
-
-static void consumer(void *arg)
-{
-	waitq_sleep(&can_start);
-
-	semaphore_down(&sem);
-	atomic_inc(&items_consumed);
-	thread_usleep(500);
-	semaphore_up(&sem);
-}
-
-const char *test_semaphore1(void)
-{
-	int i, j, k;
-	size_t consumers;
-	size_t producers;
-
-	waitq_initialize(&can_start);
-	semaphore_initialize(&sem, AT_ONCE);
-
-	for (i = 1; i <= 3; i++) {
-		thread_t *thrd;
-
-		atomic_store(&items_produced, 0);
-		atomic_store(&items_consumed, 0);
-
-		consumers = i * CONSUMERS;
-		producers = (4 - i) * PRODUCERS;
-
-		TPRINTF("Creating %zu consumers and %zu producers...",
-		    consumers, producers);
-
-		for (j = 0; j < (CONSUMERS + PRODUCERS) / 2; j++) {
-			for (k = 0; k < i; k++) {
-				thrd = thread_create(consumer, NULL, TASK,
-				    THREAD_FLAG_NONE, "consumer");
-				if (thrd) {
-					thread_start(thrd);
-					thread_detach(thrd);
-				} else {
-					TPRINTF("could not create consumer %d\n", i);
-				}
-			}
-			for (k = 0; k < (4 - i); k++) {
-				thrd = thread_create(producer, NULL, TASK,
-				    THREAD_FLAG_NONE, "producer");
-				if (thrd) {
-					thread_start(thrd);
-					thread_detach(thrd);
-				} else {
-					TPRINTF("could not create producer %d\n", i);
-				}
-			}
-		}
-
-		TPRINTF("ok\n");
-
-		thread_sleep(1);
-		waitq_wake_all(&can_start);
-
-		while ((items_consumed != consumers) || (items_produced != producers)) {
-			TPRINTF("%zu consumers remaining, %zu producers remaining\n",
-			    consumers - items_consumed, producers - items_produced);
-			thread_sleep(1);
-		}
-	}
-
-	return NULL;
-}
Index: rnel/test/synch/semaphore1.def
===================================================================
--- kernel/test/synch/semaphore1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"semaphore1",
-	"Semaphore test 1",
-	&test_semaphore1,
-	true
-},
Index: rnel/test/synch/semaphore2.c
===================================================================
--- kernel/test/synch/semaphore2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <arch.h>
-#include <atomic.h>
-#include <proc/thread.h>
-#include <typedefs.h>
-#include <arch/context.h>
-#include <synch/waitq.h>
-#include <synch/semaphore.h>
-#include <synch/spinlock.h>
-
-static semaphore_t sem;
-
-SPINLOCK_INITIALIZE(sem_lock);
-
-static waitq_t can_start;
-
-static uint32_t seed = 0xdeadbeef;
-
-static uint32_t random(uint32_t max)
-{
-	uint32_t rc;
-
-	spinlock_lock(&sem_lock);
-	rc = seed % max;
-	seed = (((seed << 2) ^ (seed >> 2)) * 487) + rc;
-	spinlock_unlock(&sem_lock);
-	return rc;
-}
-
-static void consumer(void *arg)
-{
-	errno_t rc;
-	int to;
-
-	waitq_sleep(&can_start);
-
-	to = random(20000);
-	TPRINTF("cpu%u, tid %" PRIu64 " down+ (%d)\n", CPU->id, THREAD->tid, to);
-	rc = semaphore_down_timeout(&sem, to);
-	if (rc != EOK) {
-		TPRINTF("cpu%u, tid %" PRIu64 " down!\n", CPU->id, THREAD->tid);
-		return;
-	}
-
-	TPRINTF("cpu%u, tid %" PRIu64 " down=\n", CPU->id, THREAD->tid);
-	thread_usleep(random(30000));
-
-	semaphore_up(&sem);
-	TPRINTF("cpu%u, tid %" PRIu64 " up\n", CPU->id, THREAD->tid);
-}
-
-const char *test_semaphore2(void)
-{
-	uint32_t i, k;
-
-	waitq_initialize(&can_start);
-	semaphore_initialize(&sem, 5);
-
-	thread_t *thrd;
-
-	k = random(7) + 1;
-	TPRINTF("Creating %" PRIu32 " consumers\n", k);
-	for (i = 0; i < k; i++) {
-		thrd = thread_create(consumer, NULL, TASK,
-		    THREAD_FLAG_NONE, "consumer");
-		if (thrd) {
-			thread_start(thrd);
-			thread_detach(thrd);
-		} else {
-			TPRINTF("Error creating thread\n");
-		}
-	}
-
-	thread_usleep(20000);
-	waitq_wake_all(&can_start);
-
-	return NULL;
-}
Index: rnel/test/synch/semaphore2.def
===================================================================
--- kernel/test/synch/semaphore2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"semaphore2",
-	"Semaphore test 2",
-	&test_semaphore2,
-	true
-},
Index: rnel/test/test.c
===================================================================
--- kernel/test/test.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#include <test.h>
-#include <stddef.h>
-#include <str.h>
-
-bool test_quiet;
-
-test_t tests[] = {
-#include <atomic/atomic1.def>
-#include <debug/mips1.def>
-#include <fault/fault1.def>
-#include <mm/falloc1.def>
-#include <mm/falloc2.def>
-#include <mm/mapping1.def>
-#include <mm/slab1.def>
-#include <mm/slab2.def>
-#include <synch/semaphore1.def>
-#include <synch/semaphore2.def>
-#include <print/print1.def>
-#include <print/print2.def>
-#include <print/print3.def>
-#include <print/print4.def>
-#include <print/print5.def>
-#include <thread/thread1.def>
-	{
-		.name = NULL,
-		.desc = NULL,
-		.entry = NULL
-	}
-};
-
-const char *tests_hints_enum(const char *input, const char **help,
-    void **ctx)
-{
-	size_t len = str_length(input);
-	test_t **test = (test_t **) ctx;
-
-	if (*test == NULL)
-		*test = tests;
-
-	for (; (*test)->name; (*test)++) {
-		const char *curname = (*test)->name;
-
-		if (str_length(curname) < len)
-			continue;
-
-		if (str_lcmp(input, curname, len) == 0) {
-			(*test)++;
-			if (help)
-				*help = (*test)->desc;
-			return (curname + str_lsize(curname, len));
-		}
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: rnel/test/test.h
===================================================================
--- kernel/test/test.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kernel_generic
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_TEST_H_
-#define KERN_TEST_H_
-
-#include <stdbool.h>
-#include <stdio.h>
-
-extern bool test_quiet;
-
-#define TPRINTF(format, ...) \
-	{ \
-		if (!test_quiet) { \
-			printf(format, ##__VA_ARGS__); \
-		} \
-	}
-
-typedef const char *(*test_entry_t)(void);
-
-typedef struct {
-	const char *name;
-	const char *desc;
-	test_entry_t entry;
-	bool safe;
-} test_t;
-
-extern const char *test_atomic1(void);
-extern const char *test_mips1(void);
-extern const char *test_fault1(void);
-extern const char *test_falloc1(void);
-extern const char *test_falloc2(void);
-extern const char *test_mapping1(void);
-extern const char *test_purge1(void);
-extern const char *test_slab1(void);
-extern const char *test_slab2(void);
-extern const char *test_semaphore1(void);
-extern const char *test_semaphore2(void);
-extern const char *test_print1(void);
-extern const char *test_print2(void);
-extern const char *test_print3(void);
-extern const char *test_print4(void);
-extern const char *test_print5(void);
-extern const char *test_thread1(void);
-
-extern test_t tests[];
-
-extern const char *tests_hints_enum(const char *, const char **, void **);
-
-#endif
-
-/** @}
- */
Index: rnel/test/thread/thread1.c
===================================================================
--- kernel/test/thread/thread1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <test.h>
-#include <atomic.h>
-#include <stdbool.h>
-#include <proc/thread.h>
-
-#include <arch.h>
-
-#define THREADS  5
-
-static atomic_bool finish;
-
-static void threadtest(void *data)
-{
-	while (atomic_load(&finish)) {
-		TPRINTF("%" PRIu64 " ", THREAD->tid);
-		thread_usleep(100000);
-	}
-}
-
-const char *test_thread1(void)
-{
-	atomic_store(&finish, true);
-
-	thread_t *threads[THREADS] = { };
-
-	for (int i = 0; i < THREADS; i++) {
-		threads[i] = thread_create(threadtest, NULL,
-		    TASK, THREAD_FLAG_NONE, "threadtest");
-
-		if (threads[i]) {
-			thread_start(threads[i]);
-		} else {
-			TPRINTF("Could not create thread %d\n", i);
-			break;
-		}
-	}
-
-	TPRINTF("Running threads for 10 seconds...\n");
-	thread_sleep(10);
-
-	atomic_store(&finish, false);
-
-	for (int i = 0; i < THREADS; i++) {
-		if (threads[i] != NULL)
-			thread_join(threads[i]);
-
-		TPRINTF("Threads left: %d\n", THREADS - i - 1);
-	}
-
-	return NULL;
-}
Index: rnel/test/thread/thread1.def
===================================================================
--- kernel/test/thread/thread1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"thread1",
-	"Thread test",
-	&test_thread1,
-	true
-},
Index: rnel/tools/amd64/decpt.py
===================================================================
--- kernel/tools/amd64/decpt.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-#!/usr/bin/env python
-"""
-Decode 64-bit address into components
-"""
-import sys
-
-def main():
-    if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
-        print("%s 0x..." % sys.argv[0])
-        sys.exit(1)
-
-    address = int(sys.argv[1],16)
-    offset = address & 0xfff
-    ptl3 = (address >> 12) & 0x1ff
-    ptl2 = (address >> 21) & 0x1ff
-    ptl1 = (address >> 30) & 0x1ff
-    ptl0 = (address >> 39) & 0x1ff
-    print("Ptl0:   %3d" % ptl0)
-    print("Ptl1:   %3d" % ptl1)
-    print("Ptl2:   %3d" % ptl2)
-    print("Ptl3:   %3d" % ptl3)
-    print("Offset: 0x%x" % offset)
-
-if __name__ == '__main__':
-    main()
Index: rnel/tools/ia32/decpt.py
===================================================================
--- kernel/tools/ia32/decpt.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,21 +1,0 @@
-#!/usr/bin/env python
-"""
-Decode 32-bit address into PTE components
-"""
-import sys
-
-def main():
-    if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
-        print("%s 0x..." % sys.argv[0])
-        sys.exit(1)
-
-    address = int(sys.argv[1],16)
-    offset = address & 0xfff
-    ptl1 = (address >> 12) & 0x3ff
-    ptl0 = (address >> 22) & 0x3ff
-    print("Ptl0:   %3d" % ptl0)
-    print("Ptl1:   %3d" % ptl1)
-    print("Offset: 0x%x" % offset)
-
-if __name__ == '__main__':
-    main()
Index: son.build
===================================================================
--- meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# TODO: Use vcs_tag() to generate version string
-# TODO: jobfile
-# TODO: lto in uspace
-# TODO: fix clang build
-
-project(
-    'HelenOS',
-    [ 'c', 'cpp' ],
-    default_options : ['buildtype=plain', 'c_std=gnu11', 'cpp_std=c++17', 'warning_level=2', 'werror=false', 'b_staticpic=false', 'prefix=/' ],
-    meson_version: '>=0.55.0',
-)
-
-debug_options = false
-debug_shell_scripts = false
-
-subdir('meson/part/tools')
-subdir('meson/part/read_config')
-subdir('meson/part/compiler_args')
-subdir('meson/part/initrd_manifest')
-subdir('meson' / 'arch' / UARCH)
-
-## The at-sign
-#
-# The `atsign` variable holds the ASCII character representing the at-sign
-# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
-# don't use '@' for starting a comment, `atsign` is merely '@'. However, on
-# those that do use it for starting a comment (e.g. arm32), `atsign` must be
-# defined as the percentile-sign ('%') in the architecture-dependent files.
-#
-if not is_variable('atsign')
-	atsign = '@'
-endif
-
-## Some architectures need a particular string at the beginning of assembly files.
-if not is_variable('uspace_as_prolog')
-	uspace_as_prolog = ''
-endif
-
-# The following variables are filled in by code in the kernel and uspace subdirs.
-
-# References to the actual binary artefacts that will be part of initrd image.
-rd_init_binaries = []
-# Installed files.
-install_files = []
-install_deps = []
-
-# Exported libraries and include files
-# Format: [ type, source_file, destination ]
-# See meson/part/exports/copy-export.sh for supported file types.
-exported_devel_files = [
-    [ 'includenamedsymlink', 'libc', 'common' ]
-]
-
-# Install script for headers.
-# TODO: Make a list of directories and turn into script later.
-uspace_lib_install_script_text = []
-
-subdir('kernel')
-subdir('uspace')
-
-subdir('meson/part/exports')
-subdir('meson/part/initrd')
-
-subdir('boot')
-
-# Copy the final image to the build root,
-# and write its name to a text file `image_path`.
-
-if is_variable('POST_INPUT')
-	image = custom_target(POST_OUTPUT,
-		output: POST_OUTPUT,
-		input: POST_INPUT,
-		command: [ cp, '@INPUT@', '@OUTPUT@' ],
-	)
-
-	custom_target('image_path',
-		output: 'image_path',
-		input: image,
-		command: [ 'echo', '@INPUT@' ],
-		capture: true,
-	)
-else
-	custom_target('image_path',
-		output: 'image_path',
-		command: [ 'echo' ],
-		capture: true,
-	)
-endif
-
-subdir('meson/part/extra_targets')
Index: son/arch/abs32le/meson.build
===================================================================
--- meson/arch/abs32le/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_kernel_c_args = [ '-D__LE__' ]
-arch_uspace_c_args = [ '-D__LE__' ]
-
-if CROSS_TARGET == 'arm32'
-	atsign = '%'
-elif CROSS_TARGET == 'mips32'
-	arch_kernel_c_args += [ '-mno-abicalls' ]
-endif
-
-arch_kernel_link_args = [ '-nostdlib' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
Index: son/arch/amd64/meson.build
===================================================================
--- meson/arch/amd64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_uspace_c_args = [
-	'-D__LE__',
-	'-fno-omit-frame-pointer',
-]
-
-arch_kernel_c_args = arch_uspace_c_args + [
-	'-mno-sse',
-	'-mno-sse2',
-	'-mcmodel=' + MEMORY_MODEL,
-	'-mno-red-zone',
-	'-fno-unwind-tables',
-]
-
-if PROCESSOR == 'opteron'
-	arch_kernel_c_args += '-march=opteron'
-endif
-
-arch_kernel_link_args = [ '-Wl,-z,max-page-size=0x1000', '-nostdlib' ]
-arch_uspace_link_args = [ '-Wl,-z,max-page-size=0x1000', '-nostdlib', '-lgcc' ]
-
-# Binaries to be included in a barebone build
-rd_essential += [
-	'app/edit',
-	'app/mixerctl',
-	'app/wavplay',
-
-	'srv/audio/hound',
-]
-
-# Drivers to be included in a barebone build
-rd_essential_drv += [
-	'drv/intctl/apic',
-	'drv/intctl/i8259',
-	'drv/platform/pc',
-	'drv/block/isa-ide',
-	'drv/bus/pci/pciintel',
-	'drv/bus/isa',
-	'drv/audio/sb16',
-	'drv/char/i8042',
-	'drv/hid/ps2mouse',
-	'drv/hid/xtkbd',
-]
-
-# Drivers to be included in a regular build
-rd_drv += [
-	'drv/audio/hdaudio',
-	'drv/audio/sb16',
-	'drv/block/ahci',
-	'drv/block/isa-ide',
-	'drv/block/pc-floppy',
-	'drv/block/pci-ide',
-	'drv/block/usbmast',
-	'drv/block/virtio-blk',
-	'drv/bus/isa',
-	'drv/bus/pci/pciintel',
-	'drv/bus/usb/ehci',
-	'drv/bus/usb/ohci',
-	'drv/bus/usb/uhci',
-	'drv/bus/usb/usbdiag',
-	'drv/bus/usb/usbflbk',
-	'drv/bus/usb/usbhub',
-	'drv/bus/usb/usbmid',
-	'drv/bus/usb/vhc',
-	'drv/bus/usb/xhci',
-	'drv/char/i8042',
-	'drv/char/ns8250',
-	'drv/char/pc-lpt',
-	'drv/hid/ps2mouse',
-	'drv/hid/xtkbd',
-	'drv/hid/usbhid',
-	'drv/intctl/apic',
-	'drv/intctl/i8259',
-	'drv/nic/ar9271',
-	'drv/nic/e1k',
-	'drv/nic/ne2k',
-	'drv/nic/rtl8139',
-	'drv/nic/rtl8169',
-	'drv/nic/virtio-net',
-	'drv/platform/pc',
-	'drv/time/cmos-rtc',
-]
Index: son/arch/arm32/meson.build
===================================================================
--- meson/arch/arm32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-atsign = '%'
-
-_cpudef = '-mcpu=' + '-'.join(PROCESSOR.split('_'))
-
-
-arch_uspace_c_args = [
-	_cpudef,
-	'-D__LE__',
-	'-fno-omit-frame-pointer',
-	'-mapcs-frame',
-	'-ffixed-r9',
-	'-mtp=soft',
-]
-
-arch_kernel_c_args = arch_uspace_c_args + [ '-mno-unaligned-access', '-mfpu=vfpv3' ]
-arch_kernel_c_args += cc.get_supported_arguments(['-mgeneral-regs-only' ])
-arch_kernel_link_args = [ '-nostdlib', '-Wl,-z,max-page-size=0x1000' ]
-
-if CONFIG_FPU
-    # Need to use softfp because our libgcc.a uses it too
-    # softfp - generate code with soft-float calling conventions but allow use
-    # of "hard" float instructions
-    arch_uspace_c_args += [ '-mfloat-abi=softfp' ]
-endif
-arch_uspace_link_args = [ '-nostdlib', '-lgcc', '-Wl,-z,max-page-size=0x1000' ]
-
-arch_boot_c_args = arch_kernel_c_args
-arch_boot_link_args = arch_kernel_link_args
-
-rd_essential_drv += [
-	'drv/bus/usb/ehci',
-	'drv/bus/usb/ohci',
-	'drv/bus/usb/usbdiag',
-	'drv/bus/usb/usbflbk',
-	'drv/bus/usb/usbhub',
-	'drv/bus/usb/usbmid',
-	'drv/block/usbmast',
-	'drv/hid/usbhid',
-]
-
-if MACHINE == 'gta02'
-	rd_essential += [
-		'srv/hid/s3c24xx_ts',
-		'srv/hw/char/s3c24xx_uart',
-	]
-
-elif MACHINE == 'beagleboardxm' or MACHINE == 'beaglebone'
-	rd_essential_drv += [
-		'drv/platform/amdm37x',
-		'drv/fb/amdm37x_dispc',
-	]
-
-elif MACHINE == 'integratorcp'
-	rd_essential_drv += [
-		'drv/char/pl050',
-		'drv/hid/atkbd',
-		'drv/hid/ps2mouse',
-		'drv/intctl/icp-ic',
-		'drv/platform/icp',
-	]
-endif
-
-rd_drv += rd_essential_drv
Index: son/arch/arm64/meson.build
===================================================================
--- meson/arch/arm64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_uspace_c_args = [
-	'-D__LE__',
-	'-fno-omit-frame-pointer',
-	cc.get_supported_arguments(['-mno-outline-atomics']),
-]
-arch_kernel_c_args = arch_uspace_c_args + [ '-march=armv8-a+nofp+nosimd', '-mgeneral-regs-only' ]
-arch_kernel_link_args = [ '-nostdlib' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-
-# UEFI binaries should be relocatable, the EFI boot service LoadImage() will
-# rebase the boot file using the .reloc information in the image if it cannot
-# load the binary at its preferred address. The ARM64 port does not provide this
-# information in its PE file (that would require manually creating it) but
-# instead the boot code is compiled with the -fpic option and the bootloader
-# relocates itself at runtime.
-#
-# N.B. The UEFI guarantees for AArch64 that during boot time the primary
-# processor is in the execution mode that has unaligned access enabled. The
-# -mstrict-align option is therefore not needed.
-arch_boot_c_args = arch_uspace_c_args + [ '-fpic', '-fvisibility=hidden' ]
-arch_boot_link_args = [ '-Wl,-shared' ] + ldflags_ignore_rwx_segments
-
-if MACHINE == 'virt'
-	rd_essential_drv += [
-		'drv/char/pl011',
-		'drv/intctl/gicv2',
-		'drv/platform/arm64virt',
-	]
-endif
-
-if MACHINE == 'hikey960'
-	rd_essential_drv += [
-		'drv/char/pl011',
-		'drv/intctl/gicv2',
-		'drv/platform/hikey960',
-	]
-endif
-
-rd_drv += rd_essential_drv
Index: son/arch/ia32/meson.build
===================================================================
--- meson/arch/ia32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-_march = '-march=' + '-'.join(PROCESSOR.split('_'))
-if PROCESSOR == 'core'
-	# FIXME
-	_march = '-march=prescott'
-endif
-
-
-arch_uspace_c_args = [
-	_march,
-	'-D__LE__',
-	'-mno-tls-direct-seg-refs',
-	'-fno-omit-frame-pointer',
-]
-
-arch_kernel_c_args = arch_uspace_c_args + [
-	_march,
-	'-mno-mmx',
-	'-mno-sse',
-	'-mno-sse2',
-	'-mno-sse3',
-	'-mno-3dnow',
-]
-
-arch_kernel_link_args = [ '-nostdlib' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-
-# Binaries to be included in a barebone build
-rd_essential += [
-	'app/edit',
-	'app/mixerctl',
-	'app/wavplay',
-
-	'srv/audio/hound',
-]
-
-# Drivers to be included in a barebone build
-rd_essential_drv += [
-	'drv/intctl/apic',
-	'drv/intctl/i8259',
-	'drv/platform/pc',
-	'drv/block/isa-ide',
-	'drv/bus/pci/pciintel',
-	'drv/bus/isa',
-	'drv/audio/sb16',
-	'drv/char/i8042',
-	'drv/hid/ps2mouse',
-	'drv/hid/xtkbd',
-]
-
-# Drivers to be included in a regular build
-rd_drv += [
-	'drv/audio/hdaudio',
-	'drv/audio/sb16',
-	'drv/block/ahci',
-	'drv/block/isa-ide',
-	'drv/block/pc-floppy',
-	'drv/block/pci-ide',
-	'drv/block/usbmast',
-	'drv/block/virtio-blk',
-	'drv/bus/isa',
-	'drv/bus/pci/pciintel',
-	'drv/bus/usb/ehci',
-	'drv/bus/usb/ohci',
-	'drv/bus/usb/uhci',
-	'drv/bus/usb/usbdiag',
-	'drv/bus/usb/usbflbk',
-	'drv/bus/usb/usbhub',
-	'drv/bus/usb/usbmid',
-	'drv/bus/usb/vhc',
-	'drv/bus/usb/xhci',
-	'drv/char/i8042',
-	'drv/char/ns8250',
-	'drv/char/pc-lpt',
-	'drv/hid/ps2mouse',
-	'drv/hid/xtkbd',
-	'drv/hid/usbhid',
-	'drv/intctl/apic',
-	'drv/intctl/i8259',
-	'drv/nic/ar9271',
-	'drv/nic/e1k',
-	'drv/nic/ne2k',
-	'drv/nic/rtl8139',
-	'drv/nic/rtl8169',
-	'drv/nic/virtio-net',
-	'drv/platform/pc',
-	'drv/time/cmos-rtc',
-]
Index: son/arch/ia64/meson.build
===================================================================
--- meson/arch/ia64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_uspace_c_args = [ '-D__LE__', '-fno-unwind-tables' ]
-arch_kernel_c_args = arch_uspace_c_args + [ '-mconstant-gp', '-mfixed-range=f32-f127' ]
-if MACHINE == 'i460GX'
-	arch_kernel_c_args += [ '-DI460GX' ]
-endif
-
-arch_boot_c_args = [ '-D__LE__', '-fno-unwind-tables', '-mfixed-range=f32-f127', '-mno-pic', '-mno-sdata' ]
-
-# work around GCC bug 112604
-arch_uspace_c_args += ['-fno-unswitch-loops']
-
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-arch_kernel_link_args = [ '-nostdlib', '-Wl,-EL', '-Wl,--no-warn-rwx-segments']
-arch_boot_link_args = ['-Wl,--no-warn-rwx-segments']
-
-
-if MACHINE == 'i460GX'
-	rd_essential_drv += [
-		'drv/platform/pc',
-		'drv/bus/pci/pciintel',
-		'drv/bus/isa',
-		'drv/char/i8042',
-		'drv/hid/xtkbd',
-	]
-
-elif MACHINE == 'ski'
-	rd_essential_drv += [
-		'drv/char/ski-con',
-		'drv/platform/ski',
-	]
-
-endif
-
-rd_drv += rd_essential_drv
Index: son/arch/mips32/meson.build
===================================================================
--- meson/arch/mips32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-if MACHINE == 'msim'
-	_march = '-march=r4000'
-	_endian = '-D__LE__'
-elif MACHINE == 'lmalta'
-	_march = '-march=4kc'
-	_endian = '-D__LE__'
-elif MACHINE == 'bmalta'
-	_march = '-march=4kc'
-	_endian = '-D__BE__'
-else
-	error('Unknown machine')
-endif
-
-arch_uspace_c_args = [
-	_march,
-	_endian,
-	'-fno-omit-frame-pointer',
-	'-msoft-float',
-	'-mabi=32',
-]
-
-arch_kernel_c_args = arch_uspace_c_args + [
-	'-mno-abicalls',
-	'-G', '0',
-	'-fno-zero-initialized-in-bss',
-]
-
-arch_boot_c_args = arch_kernel_c_args
-
-arch_kernel_link_args = [ '-nostdlib' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-arch_boot_link_args = []
-
-uspace_as_prolog = '.module softfloat;.abicalls;'
-
-if MACHINE == 'bmalta' or MACHINE == 'lmalta'
-	rd_essential_drv += [
-		'drv/platform/malta',
-		'drv/intctl/i8259',
-		'drv/block/isa-ide',
-		'drv/bus/pci/pciintel',
-		'drv/bus/isa',
-		'drv/char/i8042',
-		'drv/char/ns8250',
-		'drv/hid/ps2mouse',
-		'drv/hid/xtkbd',
-	]
-
-elif MACHINE == 'msim'
-	rd_essential_drv += [
-		'drv/platform/msim',
-		'drv/block/ddisk',
-		'drv/char/msim-con',
-	]
-
-endif
-
-rd_drv += rd_essential_drv
Index: son/arch/ppc32/meson.build
===================================================================
--- meson/arch/ppc32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-_common_c_args = [ '-D__BE__', '-fno-omit-frame-pointer', '-m32', '-Wa,-a32', '-mcpu=powerpc' ]
-
-arch_kernel_c_args = _common_c_args + [ '-msoft-float' ]
-arch_uspace_c_args = _common_c_args + [ CONFIG_FPU ? '-mhard-float' : '-msoft-float' ]
-arch_boot_c_args = arch_kernel_c_args
-arch_kernel_link_args = [ '-nostdlib', '-Wl,-z,max-page-size=0x1000' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc', '-Wl,-z,max-page-size=0x1000' ]
-arch_boot_link_args = ldflags_ignore_rwx_segments
-
-rd_essential += [
-	'app/ofw'
-]
-
-rd_essential_drv += [
-	'drv/platform/mac',
-	'drv/bus/adb/cuda_adb',
-	'drv/bus/pci/pciintel',
-	'drv/bus/usb/ohci',
-	'drv/bus/usb/usbdiag',
-	'drv/bus/usb/usbflbk',
-	'drv/bus/usb/usbhub',
-	'drv/bus/usb/usbmid',
-	'drv/bus/usb/vhc',
-	'drv/block/usbmast',
-	'drv/hid/adb-kbd',
-	'drv/hid/adb-mouse',
-	'drv/hid/usbhid',
-]
-
-rd_drv += rd_essential_drv
Index: son/arch/riscv64/meson.build
===================================================================
--- meson/arch/riscv64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_uspace_c_args = [ '-D__LE__', '-fno-omit-frame-pointer' ]
-arch_kernel_c_args = arch_uspace_c_args + [ '-mcmodel=medany' ]
-arch_boot_c_args = arch_kernel_c_args
-arch_kernel_link_args = [ '-nostdlib' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-arch_boot_link_args = ldflags_ignore_rwx_segments
-
-rd_essential += [
-]
-
-rd_drv += rd_essential_drv
Index: son/arch/sparc64/meson.build
===================================================================
--- meson/arch/sparc64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_uspace_c_args = [ '-D__BE__', '-m64', '-mcmodel=medlow', '-mhard-float', '-m' + QUADFLOAT + '-quad-float' ]
-
-if PROCESSOR == 'sun4v'
-	arch_uspace_c_args += [ '-mcpu=niagara', '-mno-vis' ]
-else
-	arch_uspace_c_args += [ '-mcpu=ultrasparc' ]
-endif
-
-if PROCESSOR == 'us' or PROCESSOR == 'us3'
-	arch_uspace_c_args += [ '-DSUN4U' ]
-elif PROCESSOR == 'sun4v'
-	arch_uspace_c_args += [ '-DSUN4V' ]
-else
-	error('Unknown PROCESSOR: ' + PROCESSOR)
-endif
-
-
-arch_kernel_c_args = [ '-D__BE__', '-m64', '-mcmodel=medlow', '-mcpu=ultrasparc', '-mno-fpu' ]
-arch_boot_c_args = arch_kernel_c_args
-
-if PROCESSOR == 'us'
-	arch_kernel_c_args += [
-		'-DUS',
-		'-DSUN4U',
-	]
-elif PROCESSOR == 'us3'
-	arch_kernel_c_args += [
-		'-DUS3',
-		'-DSUN4U',
-	]
-elif PROCESSOR == 'sun4v'
-	arch_kernel_c_args += [
-		'-DSUN4V',
-		#MH
-		'-DUS',
-	]
-endif
-
-arch_boot_link_args = []
-arch_kernel_link_args = [ '-nostdlib', '-Wl,-no-check-sections' ]
-arch_uspace_link_args = [ '-nostdlib', '-lgcc' ]
-
-if PROCESSOR == 'sun4v'
-	arch_uspace_link_args += [ '-Wl,-z,max-page-size=0x2000' ]
-else
-	arch_uspace_link_args += [ '-Wl,-z,max-page-size=0x4000' ]
-endif
-
-rd_essential += [
-	'app/ofw'
-]
-
-if PROCESSOR == 'sun4v'
-	rd_essential_drv += [
-		'drv/platform/sun4v',
-		'drv/char/sun4v-con',
-	]
-else
-	rd_essential_drv += [
-		'drv/platform/sun4u',
-		'drv/bus/pci/pciintel',
-		'drv/bus/isa',
-		'drv/intctl/obio',
-		'drv/char/ns8250',
-		'drv/char/i8042',
-		'drv/hid/ps2mouse',
-		'drv/hid/xtkbd',
-	]
-endif
-
-rd_drv += rd_essential_drv
Index: son/cross/amd64
===================================================================
--- meson/cross/amd64	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'amd64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'x86_64'
-cpu = 'x86_64'
-endian = 'little'
Index: son/cross/amd64_clang
===================================================================
--- meson/cross/amd64_clang	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,28 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@clang'
-cpp = '@COMPPREFIX@clang++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-c_args = [ '-nostdlibinc' ]
-cpp_args = [ '-nostdlibinc' ]
-link_args = [ '-nostdlib' ]
-
-cc_arch = 'amd64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'x86_64'
-cpu = 'x86_64'
-endian = 'little'
Index: son/cross/arm32
===================================================================
--- meson/cross/arm32	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'arm'
-bits = 32
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'arm'
-cpu = 'arm'
-endian = 'little'
Index: son/cross/arm64
===================================================================
--- meson/cross/arm64	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'aarch64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'aarch64'
-cpu = 'aarch64'
-endian = 'little'
Index: son/cross/ia32
===================================================================
--- meson/cross/ia32	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'i686'
-bits = 32
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'x86'
-cpu = 'x86'
-endian = 'little'
Index: son/cross/ia64
===================================================================
--- meson/cross/ia64	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'ia64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'ia64'
-cpu = 'ia64'
-endian = 'little'
Index: son/cross/mips32
===================================================================
--- meson/cross/mips32	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'mipsel'
-bits = 32
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'mips'
-cpu = 'mips'
-endian = 'little'
Index: son/cross/mips32eb
===================================================================
--- meson/cross/mips32eb	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'mips'
-bits = 32
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'mips'
-cpu = 'mips'
-endian = 'big'
Index: son/cross/ppc32
===================================================================
--- meson/cross/ppc32	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'ppc'
-bits = 32
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'ppc'
-cpu = 'powerpc'
-endian = 'big'
Index: son/cross/riscv64
===================================================================
--- meson/cross/riscv64	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'riscv64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'riscv64'
-cpu = 'riscv64'
-endian = 'little'
Index: son/cross/sparc64
===================================================================
--- meson/cross/sparc64	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# See http://mesonbuild.com/Cross-compilation.html
-
-[binaries]
-c = '@COMPPREFIX@gcc'
-cpp = '@COMPPREFIX@g++'
-ar = '@COMPPREFIX@ar'
-strip = '@COMPPREFIX@strip'
-nm = '@COMPPREFIX@nm'
-objcopy = '@COMPPREFIX@objcopy'
-objdump = '@COMPPREFIX@objdump'
-as = '@COMPPREFIX@as'
-ld = '@COMPPREFIX@ld'
-
-[properties]
-has_function_printf = true
-needs_exe_wrapper = true
-
-cc_arch = 'sparc64'
-bits = 64
-
-[host_machine]
-system = 'helenos'
-cpu_family = 'sparc64'
-cpu = 'sparc64'
-endian = 'big'
Index: son/part/compiler_args/meson.build
===================================================================
--- meson/part/compiler_args/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This file sets the architecture-independent compiler flags used throughout
-# this repository.
-# For architecture-specific flags, see $srcroot/meson/cross/$arch.
-
-add_project_arguments(
-	# TODO: Remove from project arguments and only use where necessary.
-	# Any change in config forces everything to rebuild due to lack of granularity here.
-	'-imacros', meson.build_root() / 'config.h',
-	language : [ 'c' ],
-)
-
-add_project_link_arguments(
-	'-Wl,--gc-sections',
-	'-Wl,--warn-common',
-	'-Wl,--fatal-warnings',
-	'-Wl,-z,text',
-	language : [ 'c', 'cpp' ],
-)
-
-# TODO: enable more warnings
-# FIXME: -fno-builtin-strftime works around seemingly spurious format warning.
-# We should investigate what's going on there.
-
-extra_common_flags = [
-	'-O' + OPTIMIZATION,
-	'-fexec-charset=UTF-8',
-	'-finput-charset=UTF-8',
-
-	'-D_HELENOS_SOURCE',
-
-	'-Wa,--fatal-warnings',
-	'-Wl,-z,text',
-
-	'-Wall',
-	'-Wextra',
-	'-Wwrite-strings',
-	'-Wunknown-pragmas',
-
-	'-Wno-unused-parameter',
-
-	'-pipe',
-
-	'-ffunction-sections',
-	'-fdata-sections',
-	'-fno-common',
-	'-fdebug-prefix-map=' + meson.source_root() + '/=',
-	'-fdebug-prefix-map=../../=',
-]
-
-if cc.get_id() != 'clang'
-	# Clang's own headers emit macro redefinition warnings.
-	extra_common_flags += '-Wsystem-headers'
-endif
-
-if UARCH != 'ia64'
-	extra_common_flags += [ '-fvar-tracking-assignments' ]
-endif
-
-if CONFIG_DEBUG
-	extra_common_flags += [ '-Werror' ]
-endif
-
-if CONFIG_LINE_DEBUG
-	extra_common_flags += [ '-gdwarf-5', '-g3' ]
-endif
-
-extra_cflags = extra_common_flags + [
-	'-Wmissing-prototypes',
-	'-Werror-implicit-function-declaration',
-
-	'-Wno-missing-braces',
-	'-Wno-missing-field-initializers',
-	'-Wno-unused-command-line-argument',
-	'-Wno-unused-parameter',
-	'-Wno-typedef-redefinition',
-	'-Wno-clobbered',
-	'-Wno-nonnull-compare',
-
-	'-fno-builtin-strftime',
-]
-
-if CONFIG_UBSAN
-	extra_cflags += '-fsanitize=undefined'
-endif
-
-extra_cppflags = extra_common_flags + [
-	'-fno-exceptions',
-	'-Wno-misleading-indentation',
-	'-frtti',
-]
-
-w_flags = {
-	'c': extra_cflags,
-	'cpp': extra_cppflags,
-}
-
-# TODO: To remove noise in Meson output, we may want to cut down on
-#       the explicitly checked flags and just enable those supported by
-#       both gcc and clang unconditionally.
-
-# Process flags. Only sets those that compiler supports.
-foreach lang : [ 'c', 'cpp' ]
-	extra_cflags = meson.get_compiler(lang).get_supported_arguments(w_flags.get(lang))
-	add_project_arguments(extra_cflags, language : [ lang ])
-	add_project_link_arguments(extra_cflags, language : [ lang ])
-endforeach
-
-# This flag is needed at several places, hence we define it here.
-#
-# For backwards compatibility we try to detect --no-warn-rwx-segments.
-# However, the autodetection done by Meson also results in
-# "cannot find entry symbol _start; defaulting to 00000000004000b0"
-# thus the option is never supported alone. So when detecting we also
-# specify --entry=main so that the stub source provided by Meson is build
-# correctly.
-ldflags_ignore_rwx_segments = []
-if cc.has_link_argument('-Wl,--no-warn-rwx-segments,--entry=main')
-    ldflags_ignore_rwx_segments += ['-Wl,--no-warn-rwx-segments']
-endif
Index: son/part/exports/config.mk.in
===================================================================
--- meson/part/exports/config.mk.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-# Generated from config.mk.in using Meson. Do not modify.
-# Do not forget to set HELENOS_EXPORT_ROOT when using the file.
-HELENOS_OVERLAY_PATH="@HELENOS_OVERLAY_PATH@"
-HELENOS_CROSS_PATH="@HELENOS_CROSS_PATH@"
-HELENOS_ARCH="@HELENOS_ARCH@"
-HELENOS_TARGET="@HELENOS_TARGET@"
-HELENOS_CPPFLAGS="@HELENOS_CPPFLAGS@"
-HELENOS_CFLAGS="@HELENOS_CFLAGS@"
-HELENOS_CXXFLAGS="@HELENOS_CXXFLAGS@"
-HELENOS_LDFLAGS="@HELENOS_LDFLAGS@"
-HELENOS_LDLIBS="@HELENOS_LDLIBS@"
Index: son/part/exports/copy-export.sh
===================================================================
--- meson/part/exports/copy-export.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2024 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-set -ue
-
-target_dir="${DESTDIR:-export-dev}"
-
-rm -rf "${target_dir:?}/lib"
-rm -rf "${target_dir}/include"
-
-mkdir -p "${target_dir}/lib"
-mkdir -p "${target_dir}/include"
-
-
-while [ "$#" -gt 0 ]; do
-    case "$1" in
-        staticlib)
-            ar -t "$2" | xargs ar crs "${target_dir}/lib/$3"
-            ;;
-        include)
-            mkdir -p "${target_dir}/include/$3"
-            cp -r -L -t "${target_dir}/include/$3" "$2"/*
-            ;;
-        includesymlink)
-            (
-                cd "${target_dir}/include/$3" && ln -s "../$2" .
-            )
-            ;;
-        includenamedsymlink)
-            (
-                cd "${target_dir}/include/" && ln -s "$2" "$3"
-            )
-            ;;
-        config)
-            cp -L "$2" "${target_dir}/$3"
-            ;;
-        *)
-            echo "Unknown type $1, aborting." >&2
-            exit 1
-            ;;
-    esac
-    shift 3
-done
Index: son/part/exports/meson.build
===================================================================
--- meson/part/exports/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-## Generate config.mk, config.sh
-
-# Get the directory where the compiler resides.
-
-cc_fullname = run_command(which, meson.get_compiler('c').cmd_array()[0].split(' ')[0], check: true).stdout().strip()
-cc_path = run_command(dirname, cc_fullname, check: true).stdout().strip()
-
-message(['Compiler directory is:', cc_path])
-
-export_cppflags = [
-	'-isystem', '$(HELENOS_EXPORT_ROOT)/include/libposix',
-	'-isystem', '$(HELENOS_EXPORT_ROOT)/include/libc',
-	'-idirafter', '$(HELENOS_EXPORT_ROOT)/include',
-]
-
-export_ldflags = [
-	'-nostdlib',
-	'-L$(HELENOS_EXPORT_ROOT)/lib',
-	'-Wl,--whole-archive',
-	'$(HELENOS_EXPORT_ROOT)/lib/libstartfiles.a',
-	'-Wl,--no-whole-archive',
-]
-
-export_ldlibs = [
-	'-Wl,--as-needed',
-	'-lposix',
-	'-lmath',
-	'-lc',
-	'-lgcc',
-	'-Wl,--no-as-needed',
-]
-
-cc_arch = meson.get_cross_property('cc_arch')
-
-conf_data = configuration_data({
-	'HELENOS_OVERLAY_PATH' : meson.source_root() / 'uspace/overlay',
-	'HELENOS_CROSS_PATH' : cc_path,
-	'HELENOS_ARCH' : cc_arch,
-	'HELENOS_CFLAGS' : ' '.join(arch_uspace_c_args),
-	'HELENOS_CXXFLAGS' : ' '.join(arch_uspace_c_args),
-	'HELENOS_CPPFLAGS' : ' '.join(export_cppflags),
-	'HELENOS_LDFLAGS' : ' '.join(export_ldflags),
-	'HELENOS_LDLIBS' : ' '.join(export_ldlibs),
-	'HELENOS_TARGET' : cc_arch + '-helenos',
-})
-
-config_mk = configure_file(
-	input: 'config.mk.in',
-	output: 'config.mk',
-	configuration: conf_data,
-)
-
-config_sh = custom_target('config.sh',
-	input: config_mk,
-	output: 'config.sh',
-	command: [ sed, 's:$(HELENOS_EXPORT_ROOT):${HELENOS_EXPORT_ROOT}:g', '@INPUT@' ],
-	capture: true,
-)
-
-run_target('export-dev',
-    command: [
-        sh,
-        meson.source_root() / 'meson' / 'part' / 'exports' / 'copy-export.sh',
-    ] + [
-        'config', config_mk, 'config.mk',
-        'config', config_sh, 'config.sh',
-    ] + exported_devel_files
-)
Index: son/part/extra_targets/doxygen.cfg.diff
===================================================================
--- meson/part/extra_targets/doxygen.cfg.diff	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
---- doxygen.cfg.gen	2018-08-29 17:07:57.439518972 +0200
-+++ doxygen.cfg	2018-08-30 00:03:23.790524052 +0200
-@@ -32,7 +32,7 @@
- # title of most generated pages and in a few other places.
- # The default value is: My Project.
- 
--PROJECT_NAME           = "My Project"
-+PROJECT_NAME           = "HelenOS"
- 
- # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
- # could be handy for archiving the generated documentation or if some version
-@@ -44,7 +44,7 @@
- # for a project that appears at the top of each page and should give viewer a
- # quick idea about the purpose of the project. Keep the description short.
- 
--PROJECT_BRIEF          =
-+PROJECT_BRIEF          = " HelenOS is a portable microkernel-based multiserver operating system designed and implemented from scratch."
- 
- # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
- # in the documentation. The maximum height of the logo should not exceed 55
-@@ -649,7 +649,7 @@
- # sections, marked by \if <section_label> ... \endif and \cond <section_label>
- # ... \endcond blocks.
- 
--ENABLED_SECTIONS       =
-+ENABLED_SECTIONS       = abs32le amd64 arm32 arm64 ia32 ia64 mips32 ppc32 riscv64 sparc64
- 
- # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
- # initial value of a variable or macro / define can have for it to appear in the
-@@ -791,7 +791,7 @@
- # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
- # Note: If this tag is empty the current directory is searched.
- 
--INPUT                  =
-+INPUT                  = ../README.md ../abi ../boot ../kernel ../uspace
- 
- # This tag can be used to specify the character encoding of the source files
- # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-@@ -865,7 +865,7 @@
- # be searched for input files as well.
- # The default value is: NO.
- 
--RECURSIVE              = NO
-+RECURSIVE              = YES
- 
- # The EXCLUDE tag can be used to specify files and/or directories that should be
- # excluded from the INPUT source files. This way you can easily exclude a
-@@ -1468,7 +1468,7 @@
- # The default value is: NO.
- # This tag requires that the tag GENERATE_HTML is set to YES.
- 
--GENERATE_TREEVIEW      = NO
-+GENERATE_TREEVIEW      = YES
- 
- # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
- # doxygen will group on one line in the generated HTML documentation.
Index: son/part/extra_targets/meson.build
===================================================================
--- meson/part/extra_targets/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-run_target('config',
-	command: [
-		sh,
-		'-c', 'cd $1 && $2 $3 $4 $5',
-		'--',
-		meson.build_root(),
-		config_py.full_path(),
-		meson.source_root() / 'HelenOS.config',
-		meson.source_root() / 'defaults',
-		'--mask-platform',
-	]
-)
-
-# TODO: Check when cross target has changed, since it won't work.
-
-if false
-	# TODO: doesn't work because it changes cross target
-	run_target('random-config',
-		command: [
-			sh,
-			'-c', 'cd $1 && $2 $3 $4 random',
-			'--',
-			meson.build_root(),
-			config_py.full_path(),
-			meson.source_root() / 'HelenOS.config',
-			meson.source_root() / 'defaults',
-		]
-	)
-endif
-
-if doxygen.found()
-	_patch_file = files('doxygen.cfg.diff')
-
-	_gen_cfg = custom_target('doxygen.cfg.gen',
-		output: 'doxygen.cfg.gen',
-		command: [ doxygen, '-g', '@OUTPUT@' ],
-	)
-
-	_dox_cfg = custom_target('doxygen.cfg',
-		output: 'doxygen.cfg',
-		input: [ _gen_cfg, _patch_file ],
-		command: [ patch, '-o', '@OUTPUT@', '@INPUT@' ],
-	)
-
-	run_target('doxygen', command: [
-		sh,
-		'-c', 'cd $1 && $2 $3',
-		'--',
-		meson.source_root() / 'doxygen',
-		doxygen.full_path(),
-		_dox_cfg,
-	])
-endif
-
-if cppcheck.found()
-	run_target('cppcheck', command: ['cppcheck', '--project=' +
-		join_paths(meson.build_root(), 'compile_commands.json'),
-		' -q --force --file-list=*.c* --platform=unix32 --enable=all' ])
-endif
-
-# TODO text-xcw
-#ifeq ($(CONFIG_DEVEL_FILES),y)
-#	export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
-#endif
-
-# TODO special target for posix and xcw exports, update coastline for it
Index: son/part/initrd/install.sh.in
===================================================================
--- meson/part/initrd/install.sh.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#!/bin/sh
-
-if [ "$#" -ge 1 ]; then
-	touch "$1"
-fi
-
-if [ "$#" -ge 2 ]; then
-	DESTDIR="$2"
-else
-	DESTDIR="${MESON_INSTALL_DESTDIR_PREFIX}"
-fi
-
-rm -rf "${DESTDIR}"
-
-mkdir -p "${DESTDIR}cfg/"
-mkdir -p "${DESTDIR}data/"
-mkdir -p "${DESTDIR}loc/"
-mkdir -p "${DESTDIR}log/"
-mkdir -p "${DESTDIR}tmp/"
-mkdir -p "${DESTDIR}vol/"
-mkdir -p "${DESTDIR}w/"
-
-@text@
Index: son/part/initrd/install_devel.sh.in
===================================================================
--- meson/part/initrd/install_devel.sh.in	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-#!/bin/sh
-
-if [ "$#" -ge 1 ]; then
-	DESTDIR="$1"
-else
-	DESTDIR="${MESON_INSTALL_DESTDIR_PREFIX}"
-fi
-
-@text@
Index: son/part/initrd/meson.build
===================================================================
--- meson/part/initrd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-if CONFIG_DEVEL_FILES
-	# If devel files are requested, we have to install libgcc.
-	# We have to explicitly use gcc for this, because clang only prints
-	# file name instead of whole path.
-	libgcc = run_command(cc_path / cc_arch + '-helenos-gcc',
-		arch_uspace_c_args, '-print-libgcc-file-name',
-		check: true,
-	).stdout().strip()
-
-	install_files += [[ 'lib', libgcc, 'libgcc.a' ]]
-	install_deps += [ files(libgcc) ]
-endif
-
-# Collect and install copyright information.
-copyrights_file = custom_target('COPYRIGHT',
-	output: 'COPYRIGHT',
-	command: cpc,
-	capture: true,
-)
-
-install_files += [[ '', copyrights_file.full_path(), 'COPYRIGHT' ]]
-install_deps += [ copyrights_file ]
-
-# Emit the install script.
-
-install_script_text = []
-
-# Copy uspace/dist.
-_uspace = meson.source_root() / 'uspace'
-install_script_text += 'cp -r -L -T -u "@0@/dist" "${DESTDIR}"'.format(_uspace)
-
-# Copy uspace/overlay
-install_script_text += 'if ls @0@/overlay/* >/dev/null 2>/dev/null; then'.format(_uspace)
-install_script_text += 'cp -r -L @0@/overlay/* "${DESTDIR}"'.format(_uspace)
-install_script_text += 'fi'
-
-
-foreach f : install_files
-	_cmd = 'mkdir -p "${DESTDIR}@0@" && cp -L -T "@1@" "${DESTDIR}@0@/@2@"'
-	install_script_text += _cmd.format(f[0], f[1], f[2])
-endforeach
-
-if CONFIG_DEVEL_FILES
-	install_script_text += uspace_lib_devel_install_script_text
-endif
-
-install_devel_script = configure_file(
-	configuration: { 'text' : '\n'.join(uspace_lib_devel_install_script_text) },
-	input: 'install_devel.sh.in',
-	output: 'install_devel.sh',
-)
-
-install_script_text += uspace_lib_install_script_text
-
-install_script = configure_file(
-	configuration: { 'text' : '\n'.join(install_script_text) },
-	input: 'install.sh.in',
-	output: 'install.sh',
-)
-
-# Build up dist
-
-dist_dir = meson.build_root() / 'dist/'
-
-run_target('devel-headers',
-	command: [ sh, install_devel_script, dist_dir ],
-)
-
-dist = custom_target('DIST',
-	output: 'dist.tag',
-	input: [ install_script, install_deps ],
-	command: [ sh, '@INPUT0@', '@OUTPUT@', dist_dir ],
-	build_always_stale: true,
-)
-
-# Build initrd image
-
-if RDFMT == 'tmpfs'
-	initrd_cmd = [ 'tar', '-c', '-f', '@OUTPUT@', '-C', dist_dir, '.' ]
-elif RDFMT == 'fat'
-	initrd_cmd = [ mkfat, '1048576', dist_dir, '@OUTPUT@' ]
-elif RDFMT == 'ext4fs'
-	initrd_cmd = [ mkext4, '1048576', dist_dir, '@OUTPUT@' ]
-else
-	error('Unknown RDFMT: ' + RDFMT)
-endif
-
-initrd_img = custom_target('initrd.img',
-	output: 'initrd.img',
-	input: dist,
-	command: initrd_cmd,
-)
-
-rd_init_binaries += [[ initrd_img, 'boot/initrd.img' ]]
Index: son/part/initrd_manifest/meson.build
===================================================================
--- meson/part/initrd_manifest/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Init binaries. These are actually baked into the bootloader.
-rd_init = [
-	# ELF file with DWARF debug sections for kernel.
-	# Kernel detects this entry by name.
-	'kernel.dbg',
-
-	# IMPORTANT: The order of entries is important for bootloader!
-	'srv/ns',
-	'srv/loader',
-	'app/init',
-	'srv/locsrv',
-	'srv/bd/rd',
-	'srv/vfs',
-	'srv/logger',
-	'srv/fs/' + RDFMT,
-]
-
-# Binaries allowed on the initrd image when CONFIG_BAREBONE is enabled.
-rd_essential = [
-	'app/bdsh',
-	'app/getterm',
-	'app/kio',
-	'app/tester',
-
-	'srv/devman',
-	'srv/fs/locfs',
-	'srv/hid/console',
-	'srv/hid/input',
-	'srv/hid/output',
-	'srv/klog',
-	'srv/system',
-]
-
-rd_essential_drv = [
-	'drv/root/root',
-	'drv/root/virt',
-	'drv/fb/kfb',
-]
-
-rd_drv = rd_essential_drv
-
-if CONFIG_FB
-	rd_essential += [
-		'app/taskbar',
-		'app/terminal',
-
-		'srv/hid/display',
-	]
-endif
Index: son/part/read_config/meson.build
===================================================================
--- meson/part/read_config/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,169 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Read variables from config file generated by config.py,
-# and version information from repository.
-
-# Workaround for current Meson (0.51.1) not producing dependency
-# on files outside source dir when just files() is used.
-_config_file = configure_file(
-	input: meson.build_root() / 'Makefile.config',
-	output: 'Makefile.config',
-	copy: true,
-)
-
-_version_file = files(meson.source_root() / 'version')
-
-_config_variables = [
-	# Uspace and kernel
-	'CONFIG_BAREBONE',
-	'CONFIG_BUILD_SHARED_LIBS',
-	'CONFIG_DEBUG',
-	'CONFIG_DEVEL_FILES',
-	'CONFIG_FPU',
-	'CONFIG_LINE_DEBUG',
-	'CONFIG_LTO',
-	'CONFIG_PCUT_SELF_TESTS',
-	'CONFIG_PCUT_TESTS',
-	'CONFIG_RTLD',
-	'CONFIG_STRIP_BINARIES',
-	'CONFIG_UBSAN',
-	'CONFIG_USE_SHARED_LIBS',
-	'CROSS_TARGET',
-	'MACHINE',
-	'OPTIMIZATION',
-	'PLATFORM',
-	'PROCESSOR',
-	'QUADFLOAT',
-	'RDFMT',
-
-	# Kernel only
-	'CONFIG_ACPI',
-	'CONFIG_AM335X_TIMERS',
-	'CONFIG_ASID',
-	'CONFIG_ASID_FIFO',
-	'CONFIG_AT_KBD',
-	'CONFIG_BCM2835_MAILBOX',
-	'CONFIG_DSRLNIN',
-	'CONFIG_DSRLNOUT',
-	'CONFIG_EGA',
-	'CONFIG_FB',
-	'CONFIG_GICV2',
-	'CONFIG_I8042',
-	'CONFIG_I8259',
-	'CONFIG_IOMAP_BITMAP',
-	'CONFIG_IOMAP_DUMMY',
-	'CONFIG_KCONSOLE',
-	'CONFIG_MAC_KBD',
-	'CONFIG_MULTIBOOT',
-	'CONFIG_NS16550',
-	'CONFIG_OFW_PCI',
-	'CONFIG_OFW_TREE',
-	'CONFIG_OMAP_UART',
-	'CONFIG_PAGE_HT',
-	'CONFIG_PAGE_PT',
-	'CONFIG_PC_KBD',
-	'CONFIG_PL011_UART',
-	'CONFIG_PL050',
-	'CONFIG_S3C24XX_IRQC',
-	'CONFIG_S3C24XX_UART',
-	'CONFIG_SMP',
-	'CONFIG_SOFTINT',
-	'CONFIG_SRLN',
-	'CONFIG_SUN_KBD',
-	'CONFIG_SYMTAB',
-	'CONFIG_TEST',
-	'CONFIG_TRACE',
-	'CONFIG_TSB',
-	'CONFIG_UDEBUG',
-	'CONFIG_VIA_CUDA',
-	'MEMORY_MODEL',
-
-	'UARCH',
-	'KARCH',
-	'BARCH',
-	'GRUB_ARCH',
-	'UIMAGE_OS',
-	'CONFIG_COMPRESSED_INIT',
-]
-
-foreach _varname : _config_variables
-	_c = run_command(grep, '^' + _varname + '\\b', _config_file)
-	if _c.returncode() != 0
-		# TODO: Output negative/inapplicable variables too in config, so that we can check for typos here.
-		#warning('Missing configuration variable ' + _varname + ' in Makefile.config')
-		set_variable(_varname, false)
-		continue
-	endif
-
-	_val = _c.stdout().split('\n')[0].strip().split('=')[1].strip()
-	if _val == 'y'
-		_val = true
-	elif _val == 'n'
-		_val = false
-	endif
-
-	set_variable(_varname, _val)
-	if debug_options
-		message([ _varname, get_variable(_varname) ])
-	endif
-endforeach
-
-# Also read version information.
-_version_variables = [
-	'HELENOS_COPYRIGHT',
-	'HELENOS_CODENAME',
-	'HELENOS_RELEASE',
-]
-
-foreach _varname : _version_variables
-	_line = run_command(grep, '^' + _varname + '\\b', _version_file, check: true).stdout().strip()
-	_val = _line.split('=')[1].strip()
-
-	set_variable(_varname, _val)
-	if debug_options
-		message([ _varname, get_variable(_varname) ])
-	endif
-endforeach
-
-# Check whether PLATFORM/MACHINE is unchanged
-
-_profile = '@0@/@1@'.format(PLATFORM, MACHINE)
-_profile_file = meson.build_root() / 'prev_profile'
-
-_cmd = run_command('cat', _profile_file)
-if _cmd.returncode() == 0
-	_prev_profile = _cmd.stdout().strip()
-
-	if _prev_profile != _profile
-		error('This build directory was initially configured for ' + _prev_profile +
-			', but now is configured for ' + _profile + '. This is not supported.')
-	endif
-else
-	run_command('sh', '-c', 'echo "' + _profile + '" > ' + _profile_file, check: true)
-endif
Index: son/part/tools/meson.build
===================================================================
--- meson/part/tools/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Find all the programs and tools used by meson.
-# Whenever you use an external command anywhere,
-# first find and assign it to a variable here. Don't use its name directly.
-# This way it's obvious what programs are used, and for some we can use
-# the same argument list everywhere.
-
-_tools_dir = meson.source_root() / 'tools'
-
-basename = find_program('basename')
-cc = meson.get_compiler('c')
-config_py = find_program(_tools_dir / 'config.py')
-cp = find_program('cp')
-dirname = find_program('dirname')
-doxygen = find_program('doxygen', required: false)
-find = find_program('find')
-grep = find_program('grep')
-mkarray = find_program(_tools_dir / 'mkarray_for_meson.sh')
-mkext4 = find_program(_tools_dir / 'mkext4.py')
-mkfat = find_program(_tools_dir / 'mkfat.py')
-mkuimage = find_program(_tools_dir / 'mkuimage.py')
-objcopy = find_program('objcopy')
-objdump = find_program('objdump')
-patch = find_program('patch')
-sed = find_program('sed')
-unzip = find_program('unzip')
-which = find_program('which')
-cpc = find_program(_tools_dir / 'cc.sh')
-cppcheck = find_program('cppcheck', required: false)
-
-sh = [ find_program('sh'), '-u', '-e' ]
-if debug_shell_scripts
-	sh += '-x'
-endif
-
-# On some distributions (e.g. Arch Linux), genisoimage is actually a symbolic
-# link to mkisofs. However, they do not accept exactly the same options.
-# Thus we check if genisoimage is a symbolic link to mkisofs and if it is so,
-# we switch to mkisofs as that is the native application available.
-fs = import('fs')
-genisoimage = find_program('genisoimage', required: false)
-_mkisofs = find_program('mkisofs', required: false)
-if genisoimage.found() and not (fs.is_symlink(genisoimage.full_path()) and _mkisofs.found() and fs.is_samepath(genisoimage.full_path(), _mkisofs.full_path()))
-	genisoimage_type = 'genisoimage'
-else
-	genisoimage = _mkisofs
-	if genisoimage.found()
-		genisoimage_type = 'mkisofs'
-	else
-		xorriso = find_program('xorriso', required: false)
-		if xorriso.found()
-			genisoimage = [ xorriso, '-as', 'genisoimage' ]
-			genisoimage_type = 'genisoimage'
-		else
-			error('Need genisoimage, mkisofs or xorriso.')
-		endif
-	endif
-endif
-
-
-autocheck = generator(find_program(_tools_dir / 'autocheck.awk'),
-	arguments: [ '@INPUT@' ],
-	output: '@PLAINNAME@.check.c',
-	capture: true,
-)
-
-# TODO: bug in Meson
-#gzip = generator(find_program('gzip'),
-#	arguments: [ '--no-name', '-9', '--stdout', '@INPUT@' ],
-#	output: '@PLAINNAME@.gz',
-#	capture: true,
-#)
-
-gzip = [ find_program('gzip'), '--no-name', '-9', '--stdout', '@INPUT@' ]
-
-# Tar's arguments make sure that the archive is reproducible.
-tar = [
-	find_program('tar'),
-	'-c',
-	'-f', '@OUTPUT@',
-	'--mtime=1970-01-01 00:00:00Z',
-	'--group=0',
-	'--owner=0',
-	'--numeric-owner',
-	'--mode=go=rX,u+rw,a-s',
-	'--no-acls',
-	'--no-selinux',
-	'--no-xattrs',
-	'--format=ustar',
-	'--transform', 's:@OUTDIR@/::',
-	'@INPUT@',
-]
Index: src/Makefile
===================================================================
--- src/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/Makefile	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,81 @@
+include Makefile.config
+include ../arch/$(ARCH)/Makefile.inc
+
+sources=cpu/cpu.c \
+	main/main.c \
+	main/kinit.c \
+	main/uinit.c \
+	proc/scheduler.c \
+	proc/thread.c \
+	proc/task.c \
+	mm/heap.c \
+	mm/frame.c \
+	mm/page.c \
+	mm/tlb.c \
+	mm/vm.c \
+	lib/func.c \
+	lib/list.c \
+	debug/print.c \
+	time/clock.c \
+	time/timeout.c \
+	time/delay.c \
+	synch/spinlock.c \
+	synch/condvar.c \
+	synch/rwlock.c \
+	synch/mutex.c \
+	synch/semaphore.c \
+	synch/waitq.c
+
+ifdef DEBUG_SPINLOCK
+CFLAGS+=-D$(DEBUG_SPINLOCK)
+endif
+
+ifdef TEST
+test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
+CFLAGS+=-D$(TEST)
+endif
+arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
+objects:=$(addsuffix .o,$(basename $(sources)))
+
+.PHONY : all config depend build clean dist-clean boot
+
+all: dist-clean config depend build
+
+-include Makefile.depend
+
+config:
+	find . ../include -name arch -type l -exec rm \{\} \;
+	ln -s ../arch/$(ARCH)/src arch
+	ln -s ../arch/$(ARCH)/include ../include/arch
+
+depend:
+	$(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
+
+build: kernel.bin boot
+
+clean:
+	find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
+	-rm *.bin kernel.map
+	$(MAKE) -C ../arch/$(ARCH)/boot clean
+
+dist-clean:
+	find . ../include -name arch -type l -exec rm \{\} \;
+	-rm Makefile.depend
+	-$(MAKE) clean
+
+kernel.bin: $(arch_objects) $(objects) $(test_objects)
+	$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ >kernel.map
+
+%.s: %.S
+	$(CC) $(CPPFLAGS) -E $< >$@
+
+%.o: %.s
+	$(AS) $< -o $@
+
+%.o: %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+KS=`cat kernel.bin | wc -c`
+
+boot:
+	$(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)
Index: src/Makefile.config
===================================================================
--- src/Makefile.config	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/Makefile.config	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,26 @@
+ARCH=ia32
+#ARCH=mips
+#ARCH=powerpc
+
+# Support for symetric multiprocessors
+SMP=__SMP__
+
+# Improved support for hyperthreading
+HT=__HT__
+
+# Deadlock detection support for spinlocks.
+DEBUG_SPINLOCK=DEBUG_SPINLOCK
+
+# Uncomment if you want to run in the test mode
+#TEST=__TEST__
+
+TEST_FILE=test.c
+
+# Select what test do you want to run
+#TEST_DIR=synch/rwlock1/
+#TEST_DIR=synch/rwlock2/
+#TEST_DIR=synch/rwlock3/
+#TEST_DIR=synch/rwlock4/
+TEST_DIR=synch/rwlock5/
+#TEST_DIR=synch/semaphore1/
+#TEST_DIR=synch/semaphore2/
Index: src/cpu/cpu.c
===================================================================
--- src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/cpu/cpu.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <cpu.h>
+#include <arch/cpu.h>
+#include <mm/heap.h>
+#include <mm/page.h>
+#include <mm/frame.h>
+#include <arch/types.h>
+#include <config.h>
+#include <panic.h>
+#include <typedefs.h>
+#include <memstr.h>
+#include <list.h>
+
+cpu_private_page_t *the = NULL;
+
+cpu_t *cpus;
+
+void cpu_init(void) {
+	int i, j;
+	
+	#ifdef __SMP__
+	if (config.cpu_active == 1) {
+	#endif /* __SMP__ */
+		cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count);
+		if (!cpus)
+			panic("malloc/cpus");
+
+		/* initialize everything */
+		memsetb((__address) cpus, sizeof(cpu_t) * config.cpu_count, 0);
+    
+		for (i=0; i < config.cpu_count; i++) {
+			cpus[i].stack = (__u8 *) malloc(CPU_STACK_SIZE);
+			if (!cpus[i].stack)
+				panic("malloc/cpus[%d].stack\n", i);
+			
+			cpus[i].id = i;
+			
+			#ifdef __SMP__
+			waitq_initialize(&cpus[i].kcpulb_wq);
+			#endif /* __SMP */
+			
+			for (j = 0; j < RQ_COUNT; j++) {
+				list_initialize(&cpus[i].rq[j].rq_head);
+			}
+		}
+		
+		the = (cpu_private_page_t *) frame_alloc(FRAME_KA | FRAME_PANIC);
+		memsetb((__address) the, PAGE_SIZE, 0);
+	#ifdef __SMP__
+	}
+	else {
+		__address frame;
+		
+		frame = frame_alloc(FRAME_KA | FRAME_PANIC);
+		memsetb(frame, PAGE_SIZE, 0);
+		map_page_to_frame((__address) the, frame, PAGE_CACHEABLE, 1);
+	}
+	#endif /* __SMP__ */
+	
+	the->cpu = &cpus[config.cpu_active-1];	
+	cpu_identify();
+	cpu_arch_init();
+}
Index: src/debug/print.c
===================================================================
--- src/debug/print.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/debug/print.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <putchar.h>
+#include <print.h>
+#include <synch/spinlock.h>
+
+static char digits[] = "0123456789abcdef";
+static spinlock_t printflock;
+
+void print_str(char *str)
+{
+        int i = 0;
+	char c;
+    
+	while (c = str[i++])
+	    putchar(c);
+}
+
+
+/* 
+ * This is a universal function for printing hexadecimal numbers of fixed
+ * width.
+ */
+void print_fixed_hex(__u32 num, int width)
+{
+	int i;
+    
+	for (i = width*8 - 4; i >= 0; i -= 4)
+	    putchar(digits[(num>>i) & 0xf]);
+}
+
+/* 
+ * This is a universal function for printing decimal and hexadecimal numbers.
+ * It prints only significant digits.
+ */
+void print_number(__u32 num, int base)
+{ 
+	char d[32+1];		/* this is good enough even for base == 2 */
+        int i = 31;
+    
+	do {
+		d[i--] = digits[num % base];
+	} while (num /= base);
+	
+	d[32] = 0;	
+	print_str(&d[i + 1]);
+}
+
+/*
+ * This is our function for printing formatted text.
+ * It's much simpler than the user-space one.
+ * We are greateful for this function.
+ */
+void printf(char *fmt, ...)
+{
+	int irqpri, i = 0, pos = 0;
+	char c;
+
+	irqpri = cpu_priority_high();
+	spinlock_lock(&printflock);
+	while (c = fmt[i++]) {
+		switch (c) {
+
+		    /* control character */
+		    case '%':
+			    switch (c = fmt[i++]) {
+
+				/* percentile itself */
+				case '%':
+					break;
+
+				/*
+				 * String and character conversions.
+				 */
+				case 's':
+					print_str((char *) *(((__address *) &fmt + (++pos))));
+					goto loop;
+
+				case 'c':
+					c = *((char *) ((__address *)(&fmt + (++pos))));
+					break;
+
+				/*
+		                 * Hexadecimal conversions with fixed width.
+		                 */
+				case 'L': 
+					print_str("0x");
+				case 'l':
+		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT32);
+					goto loop;
+
+				case 'W':
+					print_str("0x");
+				case 'w':
+		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT16);
+					goto loop;
+
+				case 'B':
+					print_str("0x");
+				case 'b':
+		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT8);
+					goto loop;
+
+				/*
+		                 * Decimal and hexadecimal conversions.
+		                 */
+				case 'd':
+		    			print_number(*((__address *)(&fmt + (++pos))), 10);
+					goto loop;
+
+				case 'X':
+			                print_str("0x");
+				case 'x':
+		    			print_number(*((__address *)(&fmt + (++pos))), 16);
+					goto loop;
+	    
+				/*
+				 * Bad formatting.
+				 */
+				default:
+					goto out;
+			    }
+
+		    default: putchar(c);
+		}
+	
+loop:
+		;
+	}
+
+out:
+	spinlock_unlock(&printflock);
+	cpu_priority_restore(irqpri);
+}
Index: src/lib/func.c
===================================================================
--- src/lib/func.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/lib/func.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <func.h>
+#include <print.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+__u32	haltstate = 0;
+
+void halt(void)
+{
+	haltstate = 1;
+	cpu_priority_high();
+	printf("cpu%d: halted\n", the->cpu->id);
+	cpu_halt();
+}
+
+
+/*
+ * returns 0 if src == dst
+ * otherwise returns 1
+ */
+int strcmp(char *src, char *dst)
+{
+	int i;
+	
+	i = 0;
+	while (src[i] == dst[i]) {
+		if (src[i] == '\0')
+			return 0;
+		i++;
+	}
+	return 1;
+}
+
+__address __u32_search(__address src, int cnt, __u32 x)
+{
+	__u32 *base = (__u32 *) src; 
+	int i;
+	
+	for (i=0; i<=cnt-sizeof(__u32); i++)
+		if (base[i] == x)
+			return (__address) &base[i];
+
+	return 0;
+}
Index: src/lib/list.c
===================================================================
--- src/lib/list.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/lib/list.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <list.h>
+
+int list_member(link_t *link, link_t *head)
+{
+	int found = 0;
+	link_t *hlp = head->next;
+	
+	while (hlp != head) {
+		if (hlp == link) {
+			found = 1;
+			break;
+		}
+		hlp = hlp->next;
+	}
+	
+	return found;
+}
+
+void list_concat(link_t *head1, link_t *head2)
+{
+	if (list_empty(head2))
+		return;
+
+	head2->next->prev = head1->prev;
+	head2->prev->next = head1;	
+	head1->prev->next = head2->next;
+	head1->prev = head2->prev;
+	list_initialize(head2);
+}
Index: src/main/kinit.c
===================================================================
--- src/main/kinit.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/main/kinit.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <config.h>
+#include <arch.h>
+#include <main/kinit.h>
+#include <main/uinit.h>
+#include <proc/scheduler.h>
+#include <proc/task.h>
+#include <proc/thread.h>
+#include <panic.h>
+#include <func.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <mm/page.h>
+#include <arch/mm/page.h>
+#include <mm/vm.h>
+
+#ifdef __SMP__
+#include <arch/mp.h>
+#endif /* __SMP__ */
+
+#include <synch/waitq.h>
+#include <synch/spinlock.h>
+
+#ifdef __TEST__
+#include <test.h>
+#endif /* __TEST__ */
+
+void kinit(void *arg)
+{
+	vm_t *m;
+	vm_area_t *a;
+	task_t *u;
+	thread_t *t;
+	int i;
+
+	cpu_priority_high();
+
+#ifdef __SMP__		 	
+	if (config.cpu_count > 1) {
+		/*
+		 * Create the kmp thread and wait for its completion.
+		 * cpu1 through cpuN-1 will come up consecutively and
+		 * not mess together with kcpulb and klwtm threads.
+		 * Just a beautification.
+		 */
+		if (t = thread_create(kmp, NULL, the->task, 0)) {
+			spinlock_lock(&t->lock);
+			t->flags |= X_WIRED;
+			t->cpu = &cpus[0];
+			spinlock_unlock(&t->lock);
+			thread_ready(t);
+			waitq_sleep(&kmp_completion_wq);
+			cpu_priority_high();
+		}
+		else panic("thread_create/kmp");
+	}
+#endif /* __SMP__ */
+	/*
+	 * Now that all CPUs are up, we can report what we've found.
+	 */
+	for (i = 0; i < config.cpu_count; i++)
+		cpu_print_report(&cpus[i]);
+
+#ifdef __SMP__
+	if (config.cpu_count > 1) {
+	        /*
+		 * For each CPU, create its load balancing thread.
+		 */
+		for (i = 0; i < config.cpu_count; i++) {
+
+			if (t = thread_create(kcpulb, NULL, the->task, 0)) {
+				spinlock_lock(&t->lock);			
+				t->flags |= X_WIRED;
+				t->cpu = &cpus[i];
+				spinlock_unlock(&t->lock);
+				thread_ready(t);
+			}
+			else panic("thread_create/kcpulb");
+
+		}
+	}
+#endif /* __SMP__ */
+
+	cpu_priority_low();
+
+	/*
+	 * Create the first user task.
+	 */
+	m = vm_create();
+	if (!m)	panic(PANIC "vm_create");
+	u = task_create(m);
+	if (!u)	panic(PANIC "task_create");
+	t = thread_create(uinit, NULL, u, THREAD_USER_STACK);
+	if (!t) panic(PANIC "thread_create");
+
+	/*
+	 * Create the text vm_area and copy the userspace code there.
+	 */	
+	a = vm_area_create(m, VMA_TEXT, 1, UTEXT_ADDRESS);
+	if (!a) panic(PANIC "vm_area_create: vm_text");
+	memcopy((__address) utext, PA2KA(a->mapping[0]), utext_size < PAGE_SIZE ? utext_size : PAGE_SIZE);		
+
+	/*
+	 * Create the data vm_area.
+	 */
+	a = vm_area_create(m, VMA_STACK, 1, USTACK_ADDRESS);
+	if (!a) panic(PANIC "vm_area_create: vm_stack");
+	
+	thread_ready(t);
+
+#ifdef __TEST__
+	test();
+#endif /* __TEST__ */
+
+
+	while (1) {
+		thread_usleep(1000000);
+		printf("kinit... ");
+	}
+
+}
Index: src/main/main.c
===================================================================
--- src/main/main.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/main/main.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/asm.h>
+#include <arch/context.h>
+#include <print.h>
+#include <config.h>
+#include <time/clock.h>
+#include <proc/scheduler.h>
+#include <proc/thread.h>
+#include <proc/task.h>
+#include <mm/vm.h>
+#include <main/kinit.h>
+#include <cpu.h>
+#include <mm/heap.h>
+
+#ifdef __SMP__
+#include <arch/apic.h>
+#include <arch/mp.h>
+#endif /* __SMP__ */
+
+#include <mm/frame.h>
+#include <mm/page.h>
+#include <synch/waitq.h>
+
+#include <arch.h>
+
+char *project = "SPARTAN kernel";
+char *copyright = "Copyright (C) 2001-2005 Jakub Jermar";
+
+config_t config;
+context_t ctx;
+
+/*
+ * These 'hardcoded' variables will be intialised by
+ * the linker with appropriate sizes and addresses.
+ */
+__u32 hardcoded_load_address = 0;
+__u32 hardcoded_ktext_size = 0;
+__u32 hardcoded_kdata_size = 0;
+
+void main_bsp(void);
+void main_ap(void);
+
+/*
+ * These two functions prevent stack from underflowing during the
+ * kernel boot phase when SP is set to the very top of the reserved
+ * space. The stack could get corrupted by a fooled compiler-generated
+ * pop sequence otherwise.
+ */
+static void main_bsp_separated_stack(void);
+static void main_ap_separated_stack(void);
+
+/*
+ * Executed by the bootstrap processor. cpu_priority_high()'d
+ */
+void main_bsp(void)
+{
+	config.cpu_count = 1;
+	config.cpu_active = 1;
+
+	config.base = hardcoded_load_address;
+	config.memory_size = CONFIG_MEMORY_SIZE;
+	config.kernel_size = hardcoded_ktext_size + hardcoded_kdata_size + CONFIG_HEAP_SIZE + CONFIG_STACK_SIZE;
+
+	context_save(&ctx);
+	ctx.sp = config.base + config.kernel_size - 8;
+	ctx.pc = (__address) main_bsp_separated_stack;
+	context_restore(&ctx);
+	/* not reached */
+}
+
+void main_bsp_separated_stack(void) {
+	vm_t *m;
+	task_t *k;
+	thread_t *t;
+
+	arch_init();
+
+	printf("%s, %s\n", project, copyright);
+
+	printf("%L: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",
+		config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024);
+
+	heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_HEAP_SIZE);
+	frame_init();
+	page_init();
+
+	#ifdef __SMP__
+	mp_init();	/* Multiprocessor */
+	#endif /* __SMP__ */
+
+	cpu_init();
+	calibrate_delay_loop();
+
+	timeout_init();
+	scheduler_init();
+	task_init();
+	thread_init();
+
+	/*
+	 * Create kernel vm mapping.
+	 */
+	m = vm_create();
+	if (!m) panic("can't create kernel vm address space\n");
+
+	/*
+	 * Create kernel task.
+	 */
+	k = task_create(m);
+	if (!k) panic("can't create kernel task\n");
+
+	/*
+	 * Create the first thread.
+	 */
+	t = thread_create(kinit, NULL, k, 0);
+	if (!t) panic("can't create kinit thread\n");
+
+	thread_ready(t);
+
+	/*
+	 * This call to scheduler() will return to kinit,
+	 * starting the thread of kernel threads.
+	 */
+	scheduler();
+	/* not reached */
+}
+
+#ifdef __SMP__
+/*
+ * Executed by application processors. cpu_priority_high()'d
+ * Temporary stack is at ctx.sp which was set during BP boot.
+ */
+void main_ap(void)
+{
+	/*
+	 * Incrementing the active CPU counter will guarantee that the
+	 * pm_init() will not attempt to build GDT and IDT tables again.
+	 * Neither frame_init() will do the complete thing. Neither cpu_init()
+	 * will do.
+	 */
+	config.cpu_active++;
+
+	arch_init();
+	frame_init();
+	page_init();
+
+	cpu_init();
+	calibrate_delay_loop();
+
+	l_apic_init();
+	l_apic_debug();
+
+
+	/*
+	 * If we woke kmp up before we left the kernel stack, we could
+	 * collide with another CPU coming up. To prevent this, we
+	 * switch to this cpu's private stack prior to waking kmp up.
+	 */
+	the->cpu->saved_context.sp = (__address) &the->cpu->stack[CPU_STACK_SIZE-8];
+	the->cpu->saved_context.pc = (__address) main_ap_separated_stack;
+	context_restore(&the->cpu->saved_context);
+	/* not reached */
+}
+
+void main_ap_separated_stack(void)
+{
+	/*
+	 * Configure timeouts for this cpu.
+	 */
+	timeout_init();
+
+	waitq_wakeup(&ap_completion_wq, WAKEUP_FIRST);
+	scheduler();
+	/* not reached */
+}
+#endif /* __SMP__*/
Index: src/main/uinit.c
===================================================================
--- src/main/uinit.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/main/uinit.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <main/uinit.h>
+#include <arch/types.h>
+#include <proc/thread.h>
+#include <userspace.h>
+
+void uinit(void *arg)
+{
+	printf("USER task, uinit thread: kernel mode\n");
+	userspace();
+}
Index: src/mm/frame.c
===================================================================
--- src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/mm/frame.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,251 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch/types.h>
+#include <func.h>
+
+#include <mm/heap.h>
+#include <mm/frame.h>
+#include <mm/page.h>
+#include <mm/vm.h>
+#include <arch/mm/page.h>
+
+#include <config.h>
+#include <memstr.h>
+
+#include <panic.h>
+
+#include <synch/spinlock.h>
+
+__u32 frames;
+__u32 frames_free;
+
+__u8 *frame_bitmap;
+__u32 frame_bitmap_octets;
+
+/*
+ * This is for kernel address space frames (allocated with FRAME_KA).
+ * Their addresses may not interfere with user address space.
+ */
+__u8 *frame_kernel_bitmap;
+__u32 kernel_frames;
+__u32 kernel_frames_free;
+
+static spinlock_t framelock;
+
+void frame_init(void)
+{
+        if (config.cpu_active == 1) {
+
+                /*
+                 * The bootstrap processor will allocate all necessary memory for frame allocation.
+                 */
+
+                frames = config.memory_size / FRAME_SIZE;
+                frame_bitmap_octets = frames / 8 + (frames % 8 > 0);
+
+                frame_bitmap = (__u8 *) malloc(frame_bitmap_octets);
+                if (!frame_bitmap)
+                        panic(PANIC "malloc/frame_bitmap\n");
+
+                /*
+                 * Mark all frames free.
+                 */
+                memsetb((__address) frame_bitmap, frame_bitmap_octets, 0);
+                frames_free = frames;
+
+		/*
+		 * Will be properly set up by architecture dependent frame init.
+		 */
+		frame_kernel_bitmap = NULL;
+		kernel_frames_free = 0;
+		kernel_frames = 0;	
+	}
+
+	/*
+	 * No frame allocations/reservations  prior this point.
+	 */
+
+	frame_arch_init();
+
+	if (config.cpu_active == 1) {
+                /*
+                 * Create the memory address space map. Marked frames and frame
+                 * regions cannot be used for allocation.
+                 */
+		frame_region_not_free(config.base, config.base + config.kernel_size);
+	}
+}
+
+/*
+ * Allocate a frame.
+ */
+__address frame_alloc(int flags)
+{
+	int i;
+	pri_t pri;
+	__u8 **frame_bitmap_ptr = &frame_bitmap;
+	__u32 *frames_ptr = &frames, *frames_free_ptr = &frames_free;
+	
+	if (flags & FRAME_KA) {
+		frame_bitmap_ptr = &frame_kernel_bitmap;
+		frames_ptr = &kernel_frames;
+		frames_free_ptr = &kernel_frames_free;
+	}
+	
+loop:
+	pri = cpu_priority_high();
+	spinlock_lock(&framelock);
+	if (*frames_free_ptr) {
+		for (i=0; i < *frames_ptr; i++) {
+			int m, n;
+		
+			m = i / 8;
+			n = i % 8;
+
+			if (((*frame_bitmap_ptr)[m] & (1<<n)) == 0) {
+				(*frame_bitmap_ptr)[m] |= (1<<n);
+				*frames_free_ptr--;
+				if (flags & FRAME_KA) {
+					/*
+					 * frames_free_ptr points to kernel_frames_free
+					 * It is still necessary to decrement frames_free.
+					 */
+					frames_free--;
+				}
+				spinlock_unlock(&framelock);
+				cpu_priority_restore(pri);
+				if (flags & FRAME_KA) return PA2KA(i*FRAME_SIZE);
+				return i*FRAME_SIZE;
+			}
+		}
+		panic(PANIC "frames_free inconsistent (%d)\n", frames_free);
+	}
+	spinlock_unlock(&framelock);
+	cpu_priority_restore(pri);
+
+	if (flags & FRAME_PANIC)
+		panic(PANIC "unable to allocate frame\n");
+		
+	/* TODO: implement sleeping logic here */
+	panic(PANIC "sleep not supported\n");
+	
+	goto loop;
+}
+
+/*
+ * Free a frame.
+ */
+void frame_free(__address addr)
+{
+	pri_t pri;
+	__u32 frame;
+	__u32 *frames_free_ptr = &frames_free, *frames_ptr = &frames;
+	__u8 **frame_bitmap_ptr = &frame_bitmap;
+
+	if (IS_KA(addr)) {
+		frames_free_ptr = &kernel_frames_free;
+		frame_bitmap_ptr = &frame_kernel_bitmap;
+	}
+
+	pri = cpu_priority_high();
+	spinlock_lock(&framelock);
+	
+	frame = IS_KA(addr) ? KA2PA(addr) : addr;
+	frame /= FRAME_SIZE;
+	if (frame < *frames_ptr) {
+		int m, n;
+	
+		m = frame / 8;
+		n = frame % 8;
+	
+		if ((*frame_bitmap_ptr)[m] & (1<<n)) {
+			(*frame_bitmap_ptr)[m] &= ~(1<<n);
+			*frames_free_ptr++;
+			if (IS_KA(addr)) {
+				/*
+				 * frames_free_ptr points to kernel_frames_free
+				 * It is still necessary to increment frames_free.
+				 */
+				 frames_free++;
+			}	
+		}
+		else panic(PANIC "frame_free: frame already free\n");
+	}
+	else panic(PANIC "frame_free: frame number too big\n");
+	
+	spinlock_unlock(&framelock);
+	cpu_priority_restore(pri);
+}
+
+/*
+ * Don't use this function for normal allocation. Use frame_alloc() instead.
+ * Use this function to declare that some special frame is not free.
+ */
+void frame_not_free(__address addr)
+{
+	pri_t pri;
+	__u32 frame;
+	__u32 *frames_ptr = &frames, *frames_free_ptr = &frames_free;
+	__u8 **frame_bitmap_ptr = &frame_bitmap;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&framelock);
+	frame = IS_KA(addr) ? KA2PA(addr) : addr;
+	frame /= FRAME_SIZE;
+	if (frame < *frames_ptr) {
+		int m, n;
+
+		m = frame / 8;
+		n = frame % 8;
+	
+		if (((*frame_bitmap_ptr)[m] & (1<<n)) == 0) {	
+			(*frame_bitmap_ptr)[m] |= (1<<n);
+			*frames_free_ptr--;	
+			if (IS_KA(addr)) {
+				/*
+				 * frames_free_ptr points to kernel_frames_free
+				 * It is still necessary to decrement frames_free.
+				 */
+				frames_free--;
+			}
+		}
+	}
+	spinlock_unlock(&framelock);
+	cpu_priority_restore(pri);
+}
+
+void frame_region_not_free(__address start, __address stop)
+{
+	__u32 i;
+
+	start /= FRAME_SIZE;
+	stop /= FRAME_SIZE;
+	for (i = start; i <= stop; i++)
+		frame_not_free(i * FRAME_SIZE);
+}
Index: src/mm/heap.c
===================================================================
--- src/mm/heap.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/mm/heap.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/heap.h>
+#include <synch/spinlock.h>
+#include <func.h>
+#include <memstr.h>
+#include <arch/types.h>
+
+/*
+ * First-fit algorithm.
+ * Simple, but hopefully correct.
+ * Chunks being freed are tested for mergability with their neighbours.
+ */
+
+static chunk_t *chunk0;
+static spinlock_t heaplock;
+
+void heap_init(__address heap, int size)
+{
+	spinlock_initialize(&heaplock);
+	memsetb(heap,size,0);
+	chunk0 = (chunk_t *) heap;
+	chunk0->used = 0;
+	chunk0->size = size - sizeof(chunk_t);
+	chunk0->next = NULL;
+	chunk0->prev = NULL;
+}
+
+/*
+ * Uses first-fit algorithm.
+ */
+void *malloc(int size)
+{
+	pri_t pri;
+	chunk_t *x, *y, *z;
+
+	if (size == 0)
+		panic("malloc: zero-size allocation request");
+		
+	x = chunk0;
+	pri = cpu_priority_high();
+	spinlock_lock(&heaplock);		
+	while (x) {
+		if (x->used || x->size < size) {
+			x = x->next;
+			continue;
+		}
+		
+		x->used = 1;
+    
+		/*
+		 * If the chunk exactly matches required size or if truncating
+		 * it would not provide enough space for storing a new chunk
+		 * header plus at least one byte of data, we are finished.
+		 */
+		if (x->size < size + sizeof(chunk_t) + 1) {
+			spinlock_unlock(&heaplock);
+			cpu_priority_restore(pri);
+			return &x->data[0];
+		}
+
+		/*
+		 * Truncate x and create a new chunk.
+		 */
+		y = (chunk_t *) (((__address) x) + size + sizeof(chunk_t));
+		y->used = 0;
+		y->size = x->size - size - sizeof(chunk_t);
+		y->prev = x;
+		y->next = NULL;
+		
+		if (z = x->next) {
+			z->prev = y;
+			y->next = z;
+		}
+		
+		x->size = size;
+		x->next = y;
+		spinlock_unlock(&heaplock);
+		cpu_priority_restore(pri);
+
+		return &x->data[0];
+	}
+	spinlock_unlock(&heaplock);
+	cpu_priority_restore(pri);
+	return NULL;
+}
+
+void free(void *ptr)
+{
+	pri_t pri;
+	chunk_t *x, *y, *z;
+
+	if (!ptr)
+		panic("free on NULL");
+
+
+	y = (chunk_t *) (((__u8 *) ptr) - sizeof(chunk_t));
+	if (y->used != 1)
+		panic("freeing unused/damaged chunk");
+
+	pri = cpu_priority_high();
+	spinlock_lock(&heaplock);
+	x = y->prev;
+	z = y->next;
+	/* merge x and y */
+	if (x && !x->used) {
+		x->size += y->size + sizeof(chunk_t);
+		x->next = z;
+		if (z)
+			z->prev = x;
+		y = x;
+	}
+	/* merge y and z or merge (x merged with y) and z */
+	if (z && !z->used) {
+		y->size += z->size + sizeof(chunk_t);
+		y->next = z->next;
+		if (z->next)  {
+			/* y is either y or x */
+			z->next->prev = y;
+		}
+	}
+	y->used = 0;
+	spinlock_unlock(&heaplock);
+	cpu_priority_restore(pri);
+}
Index: src/mm/page.c
===================================================================
--- src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/mm/page.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/page.h>
+#include <arch/mm/page.h>
+
+void page_init(void)
+{	
+	map_page_to_frame(0x0, 0x0, PAGE_NOT_PRESENT, 0);
+	page_arch_init();
+}
Index: src/mm/tlb.c
===================================================================
--- src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/mm/tlb.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/tlb.h>
+
+void tlb_shutdown(void)
+{
+	/* TODO: implement tlb_shutdown */
+}
Index: src/mm/vm.c
===================================================================
--- src/mm/vm.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/mm/vm.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <mm/vm.h>
+#include <mm/page.h>
+#include <mm/frame.h>
+#include <arch/mm/page.h>
+#include <arch/types.h>
+#include <typedefs.h>
+#include <synch/spinlock.h>
+#include <config.h>
+#include <list.h>
+#include <panic.h>
+
+vm_t *vm_create(void)
+{
+	vm_t *m;
+	
+	m = (vm_t *) malloc(sizeof(vm_t));
+	if (m) {
+		spinlock_initialize(&m->lock);
+		list_initialize(&m->vm_area_head);
+	}
+	
+	return m;
+}
+
+void vm_destroy(vm_t *m)
+{
+}
+
+vm_area_t *vm_area_create(vm_t *m, vm_type_t type, int size, __address addr)
+{
+	pri_t pri;
+	vm_area_t *a;
+	
+	if (addr % PAGE_SIZE)
+		panic(PANIC "addr not aligned to a page boundary");
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&m->lock);
+	
+	/*
+	 * TODO: test vm_area which is to be created doesn't overlap with an existing one.
+	 */
+	
+	a = (vm_area_t *) malloc(sizeof(vm_area_t));
+	if (a) {
+		int i;
+	
+		a->mapping = (__address *) malloc(size * sizeof(__address));
+		if (!a->mapping) {
+			free(a);
+			spinlock_unlock(&m->lock);
+			cpu_priority_restore(pri);
+			return NULL;
+		}
+		
+		for (i=0; i<size; i++)
+			a->mapping[i] = frame_alloc(0);
+		
+		spinlock_initialize(&a->lock);
+			
+		link_initialize(&a->link);			
+		a->type = type;
+		a->size = size;
+		a->address = addr;
+		
+		list_append(&a->link, &m->vm_area_head);
+
+	}
+
+	spinlock_unlock(&m->lock);
+	cpu_priority_restore(pri);
+	
+	return a;
+}
+
+void vm_area_destroy(vm_area_t *a)
+{
+}
+
+void vm_area_map(vm_area_t *a)
+{
+	int i, flags;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&a->lock);
+
+	switch (a->type) {
+		case VMA_TEXT:
+			flags = PAGE_EXEC | PAGE_READ | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE;
+			break;
+		case VMA_DATA:
+		case VMA_STACK:
+			flags = PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_PRESENT | PAGE_CACHEABLE;
+			break;
+		default:
+			panic(PANIC "unexpected vm_type_t %d", a->type); 
+	}
+	
+	for (i=0; i<a->size; i++)
+		map_page_to_frame(a->address + i*PAGE_SIZE, a->mapping[i], flags, 0);
+		
+	spinlock_unlock(&a->lock);
+	cpu_priority_restore(pri);
+}
+
+void vm_area_unmap(vm_area_t *a)
+{
+	int i;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&a->lock);
+
+	for (i=0; i<a->size; i++)		
+		map_page_to_frame(a->address + i*PAGE_SIZE, 0, PAGE_NOT_PRESENT, 0);
+		
+	spinlock_unlock(&a->lock);
+	cpu_priority_restore(pri);
+}
+
+void vm_install(vm_t *m)
+{
+	link_t *l;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&m->lock);
+
+	for(l = m->vm_area_head.next; l != &m->vm_area_head; l = l->next)
+		vm_area_map(list_get_instance(l, vm_area_t, link));
+
+	spinlock_unlock(&m->lock);
+	cpu_priority_restore(pri);
+}
+
+void vm_uninstall(vm_t *m)
+{
+	link_t *l;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&m->lock);
+
+	for(l = m->vm_area_head.next; l != &m->vm_area_head; l = l->next)
+		vm_area_unmap(list_get_instance(l, vm_area_t, link));
+
+	spinlock_unlock(&m->lock);
+	cpu_priority_restore(pri);
+}
Index: src/proc/scheduler.c
===================================================================
--- src/proc/scheduler.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/proc/scheduler.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,510 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <proc/scheduler.h>
+#include <proc/thread.h>
+#include <proc/task.h>
+#include <cpu.h>
+#include <mm/vm.h>
+#include <config.h>
+#include <context.h>
+#include <func.h>
+#include <arch.h>
+#include <arch/asm.h>
+#include <list.h>
+#include <typedefs.h>
+#include <mm/page.h>
+#include <synch/spinlock.h>
+
+#ifdef __SMP__
+#include <arch/atomic.h>
+#endif /* __SMP__ */
+
+/*
+ * NOTE ON ATOMIC READS:
+ * Some architectures cannot read __u32 atomically.
+ * For that reason, all accesses to nrdy and the likes must be protected by spinlock.
+ */
+
+spinlock_t nrdylock;
+volatile int nrdy;
+
+void scheduler_init(void)
+{
+	spinlock_initialize(&nrdylock);
+}
+
+/* cpu_priority_high()'d */
+struct thread *find_best_thread(void)
+{
+	thread_t *t;
+	runq_t *r;
+	int i, n;
+
+loop:
+	cpu_priority_high();
+
+	spinlock_lock(&the->cpu->lock);
+	n = the->cpu->nrdy;
+	spinlock_unlock(&the->cpu->lock);
+
+	cpu_priority_low();
+	
+	if (n == 0) {
+		#ifdef __SMP__
+		/*
+		 * If the load balancing thread is not running, wake it up and
+		 * set CPU-private flag that the kcpulb has been started.
+		 */
+		if (test_and_set(&the->cpu->kcpulbstarted) == 0) {
+    			waitq_wakeup(&the->cpu->kcpulb_wq, 0);
+			goto loop;
+		}
+		#endif /* __SMP__ */
+		
+		/*
+		 * For there was nothing to run, the CPU goes to sleep
+		 * until a hardware interrupt or an IPI comes.
+		 * This improves energy saving and hyperthreading.
+		 * On the other hand, several hardware interrupts can be ignored.
+		 */
+		 cpu_sleep();
+		 goto loop;
+	}
+
+	cpu_priority_high();
+
+	for (i = 0; i<RQ_COUNT; i++) {
+		r = &the->cpu->rq[i];
+		spinlock_lock(&r->lock);
+		if (r->n == 0) {
+			/*
+			 * If this queue is empty, try a lower-priority queue.
+			 */
+			spinlock_unlock(&r->lock);
+			continue;
+		}
+	
+		spinlock_lock(&nrdylock);
+		nrdy--;
+		spinlock_unlock(&nrdylock);		
+
+		spinlock_lock(&the->cpu->lock);
+		the->cpu->nrdy--;
+		spinlock_unlock(&the->cpu->lock);
+
+		r->n--;
+
+		/*
+		 * Take the first thread from the queue.
+		 */
+		t = list_get_instance(r->rq_head.next, thread_t, rq_link);
+		list_remove(&t->rq_link);
+
+		spinlock_unlock(&r->lock);
+
+		spinlock_lock(&t->lock);
+		t->cpu = the->cpu;
+
+		t->ticks = us2ticks((i+1)*10000);
+		t->pri = i;	/* eventually correct rq index */
+
+		/*
+		 * Clear the X_STOLEN flag so that t can be migrated when load balancing needs emerge.
+		 */
+		t->flags &= ~X_STOLEN;
+		spinlock_unlock(&t->lock);
+
+		return t;
+	}
+	goto loop;
+
+}
+
+/*
+ * This function prevents low priority threads from starving in rq's.
+ * When it decides to relink rq's, it reconnects respective pointers
+ * so that in result threads with 'pri' greater or equal 'start' are
+ * moved to a higher-priority queue.
+ */
+void relink_rq(int start)
+{
+	link_t head;
+	runq_t *r;
+	int i, n;
+
+	list_initialize(&head);
+	spinlock_lock(&the->cpu->lock);
+	if (the->cpu->needs_relink > NEEDS_RELINK_MAX) {
+		for (i = start; i<RQ_COUNT-1; i++) {
+			/* remember and empty rq[i + 1] */
+			r = &the->cpu->rq[i + 1];
+			spinlock_lock(&r->lock);
+			list_concat(&head, &r->rq_head);
+			n = r->n;
+			r->n = 0;
+			spinlock_unlock(&r->lock);
+		
+			/* append rq[i + 1] to rq[i] */
+			r = &the->cpu->rq[i];
+			spinlock_lock(&r->lock);
+			list_concat(&r->rq_head, &head);
+			r->n += n;
+			spinlock_unlock(&r->lock);
+		}
+		the->cpu->needs_relink = 0;
+	}
+	spinlock_unlock(&the->cpu->lock);				
+
+}
+
+/*
+ * The scheduler.
+ */
+void scheduler(void)
+{
+	volatile pri_t pri;
+
+	pri = cpu_priority_high();
+
+	if (haltstate)
+		halt();
+
+	if (the->thread) {
+		spinlock_lock(&the->thread->lock);
+		if (!context_save(&the->thread->saved_context)) {
+			/*
+			 * This is the place where threads leave scheduler();
+			 */
+		    	spinlock_unlock(&the->thread->lock);
+			cpu_priority_restore(the->thread->saved_context.pri);
+			return;
+		}
+		the->thread->saved_context.pri = pri;
+	}
+
+	/*
+	 * We may not keep the old stack.
+	 * Reason: If we kept the old stack and got blocked, for instance, in
+	 * find_best_thread(), the old thread could get rescheduled by another
+	 * CPU and overwrite the part of its own stack that was also used by
+	 * the scheduler on this CPU.
+	 *
+	 * Moreover, we have to bypass the compiler-generated POP sequence
+	 * which is fooled by SP being set to the very top of the stack.
+	 * Therefore the scheduler() function continues in
+	 * scheduler_separated_stack().
+	 */
+	context_save(&the->cpu->saved_context);
+	the->cpu->saved_context.sp = (__address) &the->cpu->stack[CPU_STACK_SIZE-8];
+	the->cpu->saved_context.pc = (__address) scheduler_separated_stack;
+	context_restore(&the->cpu->saved_context);
+	/* not reached */
+}
+
+void scheduler_separated_stack(void)
+{
+	int priority;
+
+	if (the->thread) {
+		switch (the->thread->state) {
+		    case Running:
+			    the->thread->state = Ready;
+			    spinlock_unlock(&the->thread->lock);
+			    thread_ready(the->thread);
+			    break;
+
+		    case Exiting:
+			    frame_free((__address) the->thread->kstack);
+			    if (the->thread->ustack) {
+				    frame_free((__address) the->thread->ustack);
+			    }
+			    
+			    /*
+			     * Detach from the containing task.
+			     */
+			    spinlock_lock(&the->task->lock);
+			    list_remove(&the->thread->th_link);
+			    spinlock_unlock(&the->task->lock);
+
+			    spinlock_unlock(&the->thread->lock);
+			    
+			    spinlock_lock(&threads_lock);
+			    list_remove(&the->thread->threads_link);
+			    spinlock_unlock(&threads_lock);
+			    
+			    free(the->thread);
+			    
+			    break;
+			    
+		    case Sleeping:
+			    /*
+			     * Prefer the thread after it's woken up.
+			     */
+			    the->thread->pri = -1;
+
+			    /*
+			     * We need to release wq->lock which we locked in waitq_sleep().
+			     * Address of wq->lock is kept in the->thread->sleep_queue.
+			     */
+			    spinlock_unlock(&the->thread->sleep_queue->lock);
+
+			    /*
+			     * Check for possible requests for out-of-context invocation.
+			     */
+			    if (the->thread->call_me) {
+				    the->thread->call_me(the->thread->call_me_with);
+				    the->thread->call_me = NULL;
+				    the->thread->call_me_with = NULL;
+			    }
+
+			    spinlock_unlock(&the->thread->lock);
+			    
+			    break;
+
+		    default:
+			    /*
+			     * Entering state is unexpected.
+			     */
+			    panic("tid%d: unexpected state %s\n", the->thread->tid, thread_states[the->thread->state]);
+			    break;
+		}
+		the->thread = NULL;
+	}
+    
+	the->thread = find_best_thread();
+	
+	spinlock_lock(&the->thread->lock);
+	priority = the->thread->pri;
+	spinlock_unlock(&the->thread->lock);	
+	
+	relink_rq(priority);		
+
+	spinlock_lock(&the->thread->lock);	
+
+	/*
+	 * If both the old and the new task are the same, lots of work is avoided.
+	 */
+	if (the->task != the->thread->task) {
+		vm_t *m1 = NULL;
+		vm_t *m2;
+
+		if (the->task) {
+			spinlock_lock(&the->task->lock);
+			m1 = the->task->vm;
+			spinlock_unlock(&the->task->lock);
+		}
+
+		spinlock_lock(&the->thread->task->lock);
+		m2 = the->thread->task->vm;
+		spinlock_unlock(&the->thread->task->lock);
+		
+		/*
+		 * Note that it is possible for two tasks to share one vm mapping.
+		 */
+		if (m1 != m2) {
+			/*
+			 * Both tasks and vm mappings are different.
+			 * Replace the old one with the new one.
+			 */
+			if (m1) {
+				vm_uninstall(m1);
+			}
+			vm_install(m2);
+		}
+		the->task = the->thread->task;	
+	}
+
+	the->thread->state = Running;
+
+	#ifdef SCHEDULER_VERBOSE
+	printf("cpu%d: tid %d (pri=%d,ticks=%d,nrdy=%d)\n", the->cpu->id, the->thread->tid, the->thread->pri, the->thread->ticks, the->cpu->nrdy);
+	#endif	
+
+	context_restore(&the->thread->saved_context);
+	/* not reached */
+}
+
+#ifdef __SMP__
+/*
+ * This is the load balancing thread. 
+ * It supervises thread supplies for the CPU it's wired to.
+ */
+void kcpulb(void *arg)
+{
+	thread_t *t;
+	int count, i, j, k = 0;
+	pri_t pri;
+
+loop:
+	/*
+	 * Sleep until there's some work to do.
+	 */
+	waitq_sleep(&the->cpu->kcpulb_wq);
+
+not_satisfied:
+	/*
+	 * Calculate the number of threads that will be migrated/stolen from
+	 * other CPU's. Note that situation can have changed between two
+	 * passes. Each time get the most up to date counts.
+	 */
+	pri = cpu_priority_high();
+	spinlock_lock(&the->cpu->lock);
+	count = nrdy / config.cpu_active;
+	count -= the->cpu->nrdy;
+	spinlock_unlock(&the->cpu->lock);
+	cpu_priority_restore(pri);
+
+	if (count <= 0)
+		goto satisfied;
+
+	/*
+	 * Searching least priority queues on all CPU's first and most priority queues on all CPU's last.
+	 */
+	for (j=RQ_COUNT-1; j >= 0; j--) {
+		for (i=0; i < config.cpu_active; i++) {
+			link_t *l;
+			runq_t *r;
+			cpu_t *cpu;
+
+			cpu = &cpus[(i + k) % config.cpu_active];
+			r = &cpu->rq[j];
+
+			/*
+			 * Not interested in ourselves.
+			 * Doesn't require interrupt disabling for kcpulb is X_WIRED.
+			 */
+			if (the->cpu == cpu)
+				continue;
+
+restart:		pri = cpu_priority_high();
+			spinlock_lock(&r->lock);
+			if (r->n == 0) {
+				spinlock_unlock(&r->lock);
+				cpu_priority_restore(pri);
+				continue;
+			}
+		
+			t = NULL;
+			l = r->rq_head.prev;	/* search rq from the back */
+			while (l != &r->rq_head) {
+				t = list_get_instance(l, thread_t, rq_link);
+				/*
+		    		 * We don't want to steal CPU-wired threads neither threads already stolen.
+				 * The latter prevents threads from migrating between CPU's without ever being run.
+		        	 */
+				spinlock_lock(&t->lock);
+				if (!(t->flags & (X_WIRED | X_STOLEN))) {
+					/*
+					 * Remove t from r.
+					 */
+
+					spinlock_unlock(&t->lock);
+					
+					/*
+					 * Here we have to avoid deadlock with relink_rq(),
+					 * because it locks cpu and r in a different order than we do.
+					 */
+					if (!spinlock_trylock(&cpu->lock)) {
+						/* Release all locks and try again. */ 
+						spinlock_unlock(&r->lock);
+						cpu_priority_restore(pri);
+						goto restart;
+					}
+					cpu->nrdy--;
+					spinlock_unlock(&cpu->lock);
+
+					spinlock_lock(&nrdylock);
+					nrdy--;
+					spinlock_unlock(&nrdylock);					
+
+			    		r->n--;
+					list_remove(&t->rq_link);
+
+					break;
+				}
+				spinlock_unlock(&t->lock);
+				l = l->prev;
+				t = NULL;
+			}
+			spinlock_unlock(&r->lock);
+
+			if (t) {
+				/*
+				 * Ready t on local CPU
+				 */
+				spinlock_lock(&t->lock);
+				#ifdef KCPULB_VERBOSE
+				printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", the->cpu->id, t->tid, the->cpu->id, the->cpu->nrdy, nrdy / config.cpu_active);
+				#endif
+				t->flags |= X_STOLEN;
+				spinlock_unlock(&t->lock);
+	
+				thread_ready(t);
+
+				cpu_priority_restore(pri);
+	
+				if (--count == 0)
+					goto satisfied;
+					
+				/*
+                    		 * We are not satisfied yet, focus on another CPU next time.
+				 */
+				k++;
+				
+				continue;
+			}
+			cpu_priority_restore(pri);
+		}
+	}
+
+	if (the->cpu->nrdy) {
+		/*
+		 * Be a little bit light-weight and let migrated threads run.
+		 */
+		scheduler();
+	} 
+	else {
+		/*
+		 * We failed to migrate a single thread.
+		 * Something more sophisticated should be done.
+		 */
+		scheduler();
+	}
+		
+	goto not_satisfied;
+    
+satisfied:
+	/*
+	 * Tell find_best_thread() to wake us up later again.
+	 */
+	the->cpu->kcpulbstarted = 0;
+	goto loop;
+}
+
+#endif /* __SMP__ */
Index: src/proc/task.c
===================================================================
--- src/proc/task.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/proc/task.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <proc/thread.h>
+#include <proc/task.h>
+#include <mm/vm.h>
+
+#include <synch/spinlock.h>
+#include <arch.h>
+#include <panic.h>
+#include <list.h>
+
+spinlock_t tasks_lock;
+link_t tasks_head;
+
+void task_init(void)
+{
+	the->task = NULL;
+	spinlock_initialize(&tasks_lock);
+	list_initialize(&tasks_head);
+}
+
+task_t *task_create(vm_t *m)
+{
+	pri_t pri;
+	task_t *ta;
+	
+	ta = (task_t *) malloc(sizeof(task_t));
+	if (ta) {
+		spinlock_initialize(&ta->lock);
+		list_initialize(&ta->th_head);
+		list_initialize(&ta->tasks_link);
+		ta->vm = m;
+		
+		pri = cpu_priority_high();
+		spinlock_lock(&tasks_lock);
+		list_append(&ta->tasks_link, &tasks_head);
+		spinlock_unlock(&tasks_lock);
+		cpu_priority_restore(pri);
+	}
+	return ta;
+}
+
Index: src/proc/thread.c
===================================================================
--- src/proc/thread.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/proc/thread.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <proc/scheduler.h>
+#include <proc/thread.h>
+#include <proc/task.h>
+#include <mm/heap.h>
+#include <mm/frame.h>
+#include <mm/page.h>
+#include <arch/asm.h>
+#include <arch.h>
+#include <synch/synch.h>
+#include <synch/spinlock.h>
+#include <synch/waitq.h>
+#include <synch/rwlock.h>
+#include <cpu.h>
+#include <func.h>
+#include <context.h>
+#include <list.h>
+#include <typedefs.h>
+#include <time/clock.h>
+#include <list.h>
+
+char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
+
+spinlock_t threads_lock;
+link_t threads_head;
+
+static spinlock_t tidlock;
+__u32 last_tid = 0;
+
+/*
+ * cushion() is provided to ensure that every thread
+ * makes a call to thread_exit() when its implementing
+ * function returns.
+ *
+ * cpu_priority_high()'d
+ */
+void cushion(void)
+{
+	void (*f)(void *) = the->thread->thread_code;
+	void *arg = the->thread->thread_arg;
+
+	/* this is where each thread wakes up after its creation */
+	spinlock_unlock(&the->thread->lock);
+	cpu_priority_low();
+
+	f(arg);
+	thread_exit();
+	/* not reached */
+}
+
+void thread_init(void)
+{
+	the->thread = NULL;
+	nrdy = 0;
+	spinlock_initialize(&threads_lock);
+	list_initialize(&threads_head);
+}
+
+void thread_ready(thread_t *t)
+{
+	cpu_t *cpu;
+	runq_t *r;
+	pri_t pri;
+	int i;
+
+	pri = cpu_priority_high();
+
+	spinlock_lock(&t->lock);
+
+	i = (t->pri < RQ_COUNT -1) ? ++t->pri : t->pri;
+	
+	cpu = the->cpu;
+	if (t->flags & X_WIRED) {
+		cpu = t->cpu;
+	}
+	spinlock_unlock(&t->lock);
+	
+        /*
+	 * Append t to respective ready queue on respective processor.
+	 */
+	r = &cpu->rq[i];
+	spinlock_lock(&r->lock);
+	list_append(&t->rq_link, &r->rq_head);
+	r->n++;
+	spinlock_unlock(&r->lock);
+
+	spinlock_lock(&nrdylock);
+	nrdy++;
+	spinlock_unlock(&nrdylock);
+
+	spinlock_lock(&cpu->lock);
+	cpu->nrdy++;
+	spinlock_unlock(&cpu->lock);
+    
+	cpu_priority_restore(pri);
+}
+
+thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags)
+{
+	thread_t *t;
+	__address frame_ks, frame_us = NULL;
+
+	t = (thread_t *) malloc(sizeof(thread_t));
+	if (t) {
+		pri_t pri;
+	
+		spinlock_initialize(&t->lock);
+	
+		frame_ks = frame_alloc(FRAME_KA);
+		if (THREAD_USER_STACK & flags) {
+			frame_us = frame_alloc(0);
+		}
+
+		pri = cpu_priority_high();
+		spinlock_lock(&tidlock);
+		t->tid = ++last_tid;
+		spinlock_unlock(&tidlock);
+		cpu_priority_restore(pri);
+
+		memsetb(frame_ks, THREAD_STACK_SIZE, 0);
+		link_initialize(&t->rq_link);
+		link_initialize(&t->wq_link);
+		link_initialize(&t->th_link);
+		link_initialize(&t->threads_link);
+		t->kstack = (__u8 *) frame_ks;
+		t->ustack = (__u8 *) frame_us;
+		
+		
+		context_save(&t->saved_context);
+		t->saved_context.pc = (__address) cushion;
+		t->saved_context.sp = (__address) &t->kstack[THREAD_STACK_SIZE-8];
+
+		pri = cpu_priority_high();
+		t->saved_context.pri = cpu_priority_read();
+		cpu_priority_restore(pri);
+		
+		t->thread_code = func;
+		t->thread_arg = arg;
+		t->ticks = -1;
+		t->pri = -1;		/* start in rq[0] */
+		t->cpu = NULL;
+		t->flags = 0;
+		t->state = Entering;
+		t->call_me = NULL;
+		t->call_me_with = NULL;
+		
+		timeout_initialize(&t->sleep_timeout);
+		t->sleep_queue = NULL;
+		t->timeout_pending = 0;
+		
+		t->rwlock_holder_type = RWLOCK_NONE;
+		
+		t->task = task;
+		
+		/*
+		 * Register this thread in the system-wide list.
+		 */
+		pri = cpu_priority_high();		
+		spinlock_lock(&threads_lock);
+		list_append(&t->threads_link, &threads_head);
+		spinlock_unlock(&threads_lock);
+
+		/*
+		 * Attach to the containing task.
+		 */
+		spinlock_lock(&task->lock);
+		list_append(&t->th_link, &task->th_head);
+		spinlock_unlock(&task->lock);
+
+		cpu_priority_restore(pri);
+	}
+
+	return t;
+}
+
+void thread_exit(void)
+{
+	pri_t pri;
+
+restart:
+	pri = cpu_priority_high();
+	spinlock_lock(&the->thread->lock);
+	if (the->thread->timeout_pending) { /* busy waiting for timeouts in progress */
+		spinlock_unlock(&the->thread->lock);
+		cpu_priority_restore(pri);
+		goto restart;
+	}
+	the->thread->state = Exiting;
+	spinlock_unlock(&the->thread->lock);
+	scheduler();
+}
+
+void thread_sleep(__u32 sec)
+{
+        thread_usleep(sec*1000000);
+}
+	
+/*
+ * Suspend execution of current thread for usec microseconds.
+ */
+void thread_usleep(__u32 usec)
+{
+	waitq_t wq;
+				  
+	waitq_initialize(&wq);
+
+	(void) waitq_sleep_timeout(&wq, usec, SYNCH_NON_BLOCKING);
+}
+
+void thread_register_call_me(void (* call_me)(void *), void *call_me_with)
+{
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&the->thread->lock);
+	the->thread->call_me = call_me;
+	the->thread->call_me_with = call_me_with;
+	spinlock_unlock(&the->thread->lock);
+	cpu_priority_restore(pri);
+}
Index: src/synch/condvar.c
===================================================================
--- src/synch/condvar.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/condvar.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <synch/synch.h>
+#include <synch/condvar.h>
+#include <synch/mutex.h>
+#include <synch/waitq.h>
+
+void condvar_initialize(condvar_t *cv)
+{
+	waitq_initialize(&cv->wq);
+}
+
+void condvar_signal(condvar_t *cv)
+{
+	waitq_wakeup(&cv->wq, WAKEUP_FIRST);
+}
+
+void condvar_broadcast(condvar_t *cv)
+{
+	waitq_wakeup(&cv->wq, WAKEUP_ALL);
+}
+
+int _condvar_wait_timeout(condvar_t *cv, mutex_t *mtx, __u32 usec, int trywait)
+{
+	int rc;
+
+	mutex_unlock(mtx);
+	rc = waitq_sleep_timeout(&cv->wq, usec, trywait);
+	mutex_lock(mtx);
+	return rc;
+}
Index: src/synch/mutex.c
===================================================================
--- src/synch/mutex.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/mutex.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <synch/synch.h>
+#include <synch/mutex.h>
+#include <synch/semaphore.h>
+
+void mutex_initialize(mutex_t *mtx)
+{
+	semaphore_initialize(&mtx->sem, 1);
+}
+
+int _mutex_lock_timeout(mutex_t *mtx, __u32 usec, int trylock)
+{
+	return _semaphore_down_timeout(&mtx->sem, usec, trylock);
+}
+
+void mutex_unlock(mutex_t *mtx)
+{
+	semaphore_up(&mtx->sem);
+}
Index: src/synch/rwlock.c
===================================================================
--- src/synch/rwlock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/rwlock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,310 @@
+/*
+ * Reader/Writer locks
+ */
+
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * These locks are not recursive.
+ * Neither readers nor writers will suffer starvation.
+ *
+ * If there is a writer followed by a reader waiting for the rwlock
+ * and the writer times out, all leading readers are automatically woken up
+ * and allowed in.
+ */
+
+/*
+ * NOTE ON rwlock_holder_type
+ * This field is set on an attempt to acquire the exclusive mutex
+ * to the respective value depending whether the caller is a reader
+ * or a writer. The field is examined only if the thread had been
+ * previously blocked on the exclusive mutex. Thus it is save
+ * to store the rwlock type in the thread structure, because
+ * each thread can block on only one rwlock at a time.
+ */
+ 
+#include <synch/synch.h>
+#include <synch/rwlock.h>
+#include <synch/spinlock.h>
+#include <synch/mutex.h>
+#include <synch/waitq.h>
+
+#include <list.h>
+#include <typedefs.h>
+#include <arch/asm.h>
+#include <arch.h>
+#include <proc/thread.h>
+#include <panic.h>
+
+#define ALLOW_ALL		0
+#define ALLOW_READERS_ONLY	1
+
+static void let_others_in(rwlock_t *rwl, int readers_only);
+static void release_spinlock(void *arg);
+
+void rwlock_initialize(rwlock_t *rwl) {
+	spinlock_initialize(&rwl->lock);
+	mutex_initialize(&rwl->exclusive);
+	rwl->readers_in = 0;
+}
+
+int _rwlock_write_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
+{
+	pri_t pri;
+	int rc;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&the->thread->lock);
+	the->thread->rwlock_holder_type = RWLOCK_WRITER;
+	spinlock_unlock(&the->thread->lock);	
+	cpu_priority_restore(pri);
+
+	/*
+	 * Writers take the easy part.
+	 * They just need to acquire the exclusive mutex.
+	 */
+	rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
+	if (SYNCH_FAILED(rc)) {
+
+		/*
+		 * Lock operation timed out.
+		 * The state of rwl is UNKNOWN at this point.
+		 * No claims about its holder can be made.
+		 */
+		 
+		pri = cpu_priority_high();
+		spinlock_lock(&rwl->lock);
+		/*
+		 * Now when rwl is locked, we can inspect it again.
+		 * If it is held by some readers already, we can let
+		 * readers from the head of the wait queue in.
+		 */
+		if (rwl->readers_in)
+			let_others_in(rwl, ALLOW_READERS_ONLY);
+		spinlock_unlock(&rwl->lock);
+		cpu_priority_restore(pri);
+	}
+	
+	return rc;
+}
+
+int _rwlock_read_lock_timeout(rwlock_t *rwl, __u32 usec, int trylock)
+{
+	int rc;
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&the->thread->lock);
+	the->thread->rwlock_holder_type = RWLOCK_READER;
+	spinlock_unlock(&the->thread->lock);	
+
+	spinlock_lock(&rwl->lock);
+
+	/*
+	 * Find out whether we can get what we want without blocking.
+	 */
+	rc = mutex_trylock(&rwl->exclusive);
+	if (SYNCH_FAILED(rc)) {
+
+		/*
+		 * 'exclusive' mutex is being held by someone else.
+		 * If the holder is a reader and there is no one
+		 * else waiting for it, we can enter the critical
+		 * section.
+		 */
+
+		if (rwl->readers_in) {
+			spinlock_lock(&rwl->exclusive.sem.wq.lock);
+			if (list_empty(&rwl->exclusive.sem.wq.head)) {
+				/*
+				 * We can enter.
+				 */
+				spinlock_unlock(&rwl->exclusive.sem.wq.lock);
+				goto shortcut;
+			}
+			spinlock_unlock(&rwl->exclusive.sem.wq.lock);
+		}
+
+		/*
+		 * In order to prevent a race condition when a reader
+		 * could block another reader at the head of the waitq,
+		 * we register a function to unlock rwl->lock
+		 * after this thread is put asleep.
+		 */
+		thread_register_call_me(release_spinlock, &rwl->lock);
+				 
+		rc = _mutex_lock_timeout(&rwl->exclusive, usec, trylock);
+		switch (rc) {
+			case ESYNCH_WOULD_BLOCK:
+				/*
+				 * release_spinlock() wasn't called
+				 */
+				thread_register_call_me(NULL, NULL);				 
+				spinlock_unlock(&rwl->lock);
+			case ESYNCH_TIMEOUT:
+				/*
+				 * The sleep timeouted.
+				 * We just restore the cpu priority.
+				 */
+			case ESYNCH_OK_BLOCKED:		
+				/*
+				 * We were woken with rwl->readers_in already incremented.
+				 * Note that this arrangement avoids race condition between
+				 * two concurrent readers. (Race is avoided if 'exclusive' is
+				 * locked at the same time as 'readers_in' is incremented.
+				 * Same time means both events happen atomically when
+				 * rwl->lock is held.)
+				 */
+				cpu_priority_restore(pri);
+				break;
+			case ESYNCH_OK_ATOMIC:
+				panic(PANIC "_mutex_lock_timeout()==ESYNCH_OK_ATOMIC");
+				break;
+			dafault:
+				panic(PANIC "invalid ESYNCH");
+				break;
+		}
+		return rc;
+	}
+
+shortcut:
+
+	/*
+	 * We can increment readers_in only if we didn't go to sleep.
+	 * For sleepers, rwlock_let_others_in() will do the job.
+	 */
+	rwl->readers_in++;
+	
+	spinlock_unlock(&rwl->lock);
+	cpu_priority_restore(pri);
+
+	return ESYNCH_OK_ATOMIC;
+}
+
+void rwlock_write_unlock(rwlock_t *rwl)
+{
+	pri_t pri;
+	
+	pri = cpu_priority_high();
+	spinlock_lock(&rwl->lock);
+	let_others_in(rwl, ALLOW_ALL);
+	spinlock_unlock(&rwl->lock);
+	cpu_priority_restore(pri);
+	
+}
+
+void rwlock_read_unlock(rwlock_t *rwl)
+{
+	pri_t pri;
+
+	pri = cpu_priority_high();
+	spinlock_lock(&rwl->lock);
+	if (!--rwl->readers_in)
+		let_others_in(rwl, ALLOW_ALL);
+	spinlock_unlock(&rwl->lock);
+	cpu_priority_restore(pri);
+}
+
+
+/*
+ * Must be called with rwl->lock locked.
+ * Must be called with cpu_priority_high'ed.
+ */
+/*
+ * If readers_only is false: (unlock scenario)
+ * Let the first sleeper on 'exclusive' mutex in, no matter
+ * whether it is a reader or a writer. If there are more leading
+ * readers in line, let each of them in.
+ *
+ * Otherwise: (timeout scenario)
+ * Let all leading readers in.
+ */
+void let_others_in(rwlock_t *rwl, int readers_only)
+{
+	rwlock_type_t type = RWLOCK_NONE;
+	thread_t *t = NULL;
+	int one_more = 1;
+	
+	spinlock_lock(&rwl->exclusive.sem.wq.lock);
+
+	if (!list_empty(&rwl->exclusive.sem.wq.head))
+		t = list_get_instance(rwl->exclusive.sem.wq.head.next, thread_t, wq_link);
+	do {
+		if (t) {
+			spinlock_lock(&t->lock);
+			type = t->rwlock_holder_type;
+			spinlock_unlock(&t->lock);			
+		}
+	
+		/*
+		 * If readers_only is true, we wake all leading readers
+		 * if and only if rwl is locked by another reader.
+		 * Assumption: readers_only ==> rwl->readers_in
+		 */
+		if (readers_only && (type != RWLOCK_READER))
+			break;
+
+
+		if (type == RWLOCK_READER) {
+			/*
+			 * Waking up a reader.
+			 * We are responsible for incrementing rwl->readers_in for it.
+			 */
+			 rwl->readers_in++;
+		}
+
+		/*
+		 * Only the last iteration through this loop can increment
+		 * rwl->exclusive.sem.wq.missed_wakeup's. All preceeding
+		 * iterations will wake up a thread.
+		 */
+		/* We call the internal version of waitq_wakeup, which
+		 * relies on the fact that the waitq is already locked.
+		 */
+		_waitq_wakeup_unsafe(&rwl->exclusive.sem.wq, WAKEUP_FIRST);
+		
+		t = NULL;
+		if (!list_empty(&rwl->exclusive.sem.wq.head)) {
+			t = list_get_instance(rwl->exclusive.sem.wq.head.next, thread_t, wq_link);
+			if (t) {
+				spinlock_lock(&t->lock);
+				if (t->rwlock_holder_type != RWLOCK_READER)
+					one_more = 0;
+				spinlock_unlock(&t->lock);	
+			}
+		}
+	} while ((type == RWLOCK_READER) && t && one_more);
+
+	spinlock_unlock(&rwl->exclusive.sem.wq.lock);
+}
+
+void release_spinlock(void *arg)
+{
+	spinlock_unlock((spinlock_t *) arg);
+}
Index: src/synch/semaphore.c
===================================================================
--- src/synch/semaphore.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/semaphore.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <synch/synch.h>
+#include <synch/semaphore.h>
+#include <synch/waitq.h>
+#include <synch/spinlock.h>
+
+void semaphore_initialize(semaphore_t *s, int val)
+{
+	pri_t pri;
+	
+	waitq_initialize(&s->wq);
+	
+	pri = cpu_priority_high();
+
+	spinlock_lock(&s->wq.lock);
+	s->wq.missed_wakeups = val;
+	spinlock_unlock(&s->wq.lock);
+
+	cpu_priority_restore(pri);
+}
+
+int _semaphore_down_timeout(semaphore_t *s, __u32 usec, int trydown)
+{
+	return waitq_sleep_timeout(&s->wq, usec, trydown); 
+}
+
+void semaphore_up(semaphore_t *s)
+{
+	waitq_wakeup(&s->wq, WAKEUP_FIRST);
+}
Index: src/synch/spinlock.c
===================================================================
--- src/synch/spinlock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/spinlock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <arch.h>
+
+#ifdef __SMP__
+#include <arch/atomic.h>
+#endif
+
+#include <synch/spinlock.h>
+
+#ifdef __SMP__
+
+void spinlock_initialize(spinlock_t *sl)
+{
+	sl->val = 0;
+}
+
+#ifdef DEBUG_SPINLOCK
+void spinlock_lock(spinlock_t *sl)
+{
+	int i = 0;
+	__address caller = ((__u32 *) &sl)[-1];
+
+	while (test_and_set(&sl->val)) {
+		if (i++ > 300000) {
+			printf("cpu%d: looping on spinlock %X, caller=%X\n", the->cpu->id, sl, caller);
+			i = 0;
+		}
+	}
+
+}
+#else
+void spinlock_lock(spinlock_t *sl)
+{
+	/*
+	 * Each architecture has its own efficient/recommended
+	 * implementation of spinlock.
+	 */
+	spinlock_arch(&sl->val);
+}
+#endif
+
+int spinlock_trylock(spinlock_t *sl)
+{
+	return !test_and_set(&sl->val);
+}
+
+void spinlock_unlock(spinlock_t *sl)
+{
+	sl->val = 0;
+}
+
+#endif
Index: src/synch/waitq.c
===================================================================
--- src/synch/waitq.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/synch/waitq.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <context.h>
+#include <proc/thread.h>
+
+#include <synch/synch.h>
+#include <synch/waitq.h>
+#include <synch/spinlock.h>
+
+#include <arch/asm.h>
+#include <arch/types.h>
+#include <arch.h>
+
+#include <list.h>
+
+#include <time/timeout.h>
+
+void waitq_initialize(waitq_t *wq)
+{
+	spinlock_initialize(&wq->lock);
+	list_initialize(&wq->head);
+	wq->missed_wakeups = 0;
+}
+
+/*
+ * Called with interrupts disabled from clock() when sleep_timeout
+ * timeouts. This function is not allowed to enable interrupts.
+ *
+ * It is supposed to try to remove 'its' thread from the waitqueue; it
+ * can eventually fail to achieve this goal when these two events
+ * overlap; in that case it behaves just as though there was no
+ * timeout at all
+ */
+void waitq_interrupted_sleep(void *data)
+{
+	thread_t *t = (thread_t *) data;
+	waitq_t *wq;
+	int do_wakeup = 0;
+
+	spinlock_lock(&threads_lock);
+	if (!list_member(&t->threads_link, &threads_head))
+		goto out;
+
+grab_locks:
+	spinlock_lock(&t->lock);
+	if (wq = t->sleep_queue) {
+		if (!spinlock_trylock(&wq->lock)) {
+			spinlock_unlock(&t->lock);
+			goto grab_locks; /* avoid deadlock */
+		}
+
+		list_remove(&t->wq_link);
+		t->saved_context = t->sleep_timeout_context;
+		do_wakeup = 1;
+		
+		spinlock_unlock(&wq->lock);
+		t->sleep_queue = NULL;
+	}
+	
+	t->timeout_pending = 0;
+	spinlock_unlock(&t->lock);
+	
+	if (do_wakeup) thread_ready(t);
+
+out:
+	spinlock_unlock(&threads_lock);
+}
+
+/*
+ * This is a sleep implementation which allows itself to be
+ * interrupted from the sleep, restoring a failover context.
+ *
+ * This function is really basic in that other functions as waitq_sleep()
+ * and all the *_timeout() functions use it.
+ *
+ * The third argument controls whether only a conditional sleep
+ * (non-blocking sleep) is called for when the second argument is 0.
+ *
+ * usec | nonblocking |	what happens if there is no missed_wakeup
+ * -----+-------------+--------------------------------------------
+ *  0	| 0	      |	blocks without timeout until wakeup
+ *  0	| <> 0	      |	immediately returns ESYNCH_WOULD_BLOCK
+ *  > 0	| x	      |	blocks with timeout until timeout or wakeup
+ *
+ * return values:
+ *  ESYNCH_WOULD_BLOCK 
+ *  ESYNCH_TIMEOUT 
+ *  ESYNCH_OK_ATOMIC 
+ *  ESYNCH_OK_BLOCKED
+ */
+int waitq_sleep_timeout(waitq_t *wq, __u32 usec, int nonblocking)
+{
+	volatile pri_t pri; /* must be live after context_restore() */
+	
+	
+restart:
+	pri = cpu_priority_high();
+	
+	/*
+	 * Busy waiting for a delayed timeout.
+	 * This is an important fix for the race condition between
+	 * a delayed timeout and a next call to waitq_sleep_timeout().
+	 * Simply, the thread is not allowed to go to sleep if
+	 * there are timeouts in progress.
+	 */
+	spinlock_lock(&the->thread->lock);
+	if (the->thread->timeout_pending) {
+		spinlock_unlock(&the->thread->lock);
+		cpu_priority_restore(pri);		
+		goto restart;
+	}
+	spinlock_unlock(&the->thread->lock);
+	
+	spinlock_lock(&wq->lock);
+	
+	/* checks whether to go to sleep at all */
+	if (wq->missed_wakeups) {
+		wq->missed_wakeups--;
+		spinlock_unlock(&wq->lock);
+		cpu_priority_restore(pri);
+		return ESYNCH_OK_ATOMIC;
+	}
+	else {
+		if (nonblocking && (usec == 0)) {
+			/* return immediatelly instead of going to sleep */
+			spinlock_unlock(&wq->lock);
+			cpu_priority_restore(pri);
+			return ESYNCH_WOULD_BLOCK;
+		}
+	}
+
+	
+	/*
+	 * Now we are firmly decided to go to sleep.
+	 */
+	spinlock_lock(&the->thread->lock);
+	if (usec) {
+		/* We use the timeout variant. */
+		if (!context_save(&the->thread->sleep_timeout_context)) {
+			/*
+			 * Short emulation of scheduler() return code.
+			 */
+			spinlock_unlock(&the->thread->lock);
+			cpu_priority_restore(pri);
+			return ESYNCH_TIMEOUT;
+		}
+		the->thread->timeout_pending = 1;
+		timeout_register(&the->thread->sleep_timeout, (__u64) usec, waitq_interrupted_sleep, the->thread);
+	}
+
+	list_append(&the->thread->wq_link, &wq->head);
+
+	/*
+	 * Suspend execution.
+	 */
+	the->thread->state = Sleeping;
+	the->thread->sleep_queue = wq;
+
+	spinlock_unlock(&the->thread->lock);
+
+	scheduler(); 	/* wq->lock is released in scheduler_separated_stack() */
+	cpu_priority_restore(pri);
+	
+	return ESYNCH_OK_BLOCKED;
+}
+
+
+/*
+ * This is the SMP- and IRQ-safe wrapper meant for general use.
+ */
+/*
+ * Besides its 'normal' wakeup operation, it attempts to unregister possible timeout.
+ */
+void waitq_wakeup(waitq_t *wq, int all)
+{
+	pri_t pri;
+
+	pri = cpu_priority_high();
+	spinlock_lock(&wq->lock);
+
+	_waitq_wakeup_unsafe(wq, all);
+
+	spinlock_unlock(&wq->lock);	
+	cpu_priority_restore(pri);	
+}
+
+/*
+ * This is the internal SMP- and IRQ-unsafe version of waitq_wakeup.
+ * It assumes wq->lock is already locked.
+ */
+void _waitq_wakeup_unsafe(waitq_t *wq, int all)
+{
+	thread_t *t;
+
+loop:	
+	if (list_empty(&wq->head)) {
+		wq->missed_wakeups++;
+		if (all) wq->missed_wakeups = 0;
+		return;
+	}
+
+	t = list_get_instance(wq->head.next, thread_t, wq_link);
+	
+	list_remove(&t->wq_link);
+	spinlock_lock(&t->lock);
+	if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))
+		t->timeout_pending = 0;
+	t->sleep_queue = NULL;
+	spinlock_unlock(&t->lock);
+
+	thread_ready(t);
+
+	if (all) goto loop;
+}
Index: src/time/clock.c
===================================================================
--- src/time/clock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/time/clock.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <time/clock.h>
+#include <time/timeout.h>
+#include <arch/types.h>
+#include <config.h>
+#include <synch/spinlock.h>
+#include <synch/waitq.h>
+#include <func.h>
+#include <proc/scheduler.h>
+#include <cpu.h>
+#include <print.h>
+#include <arch.h>
+#include <list.h>
+
+#ifdef __SMP__
+#include <arch/atomic.h>
+#endif
+
+/*
+ * Clock is called from an interrupt and is cpu_priority_high()'d.
+ */
+void clock(void)
+{
+	link_t *l;
+	timeout_t *h;
+	timeout_handler f;
+	void *arg;
+
+	/*
+	 * To avoid lock ordering problems,
+	 * run all expired timeouts as you visit them.
+	 */
+	spinlock_lock(&the->cpu->timeoutlock);
+	while ((l = the->cpu->timeout_active_head.next) != &the->cpu->timeout_active_head) {
+		h = list_get_instance(l, timeout_t, link);
+		spinlock_lock(&h->lock);
+		if (h->ticks-- != 0) {
+			spinlock_unlock(&h->lock);
+			break;
+		}
+		list_remove(l);
+		f = h->handler;
+		arg = h->arg;
+		timeout_reinitialize(h);
+		spinlock_unlock(&h->lock);	
+		spinlock_unlock(&the->cpu->timeoutlock);
+
+		f(arg);
+
+		spinlock_lock(&the->cpu->timeoutlock);
+	}
+	spinlock_unlock(&the->cpu->timeoutlock);
+
+	/*
+	 * Do CPU usage accounting and find out whether to preempt the->thread.
+	 */
+
+	if (the->thread) {
+		spinlock_lock(&the->cpu->lock);
+		the->cpu->needs_relink++;
+		spinlock_unlock(&the->cpu->lock);	
+	
+		spinlock_lock(&the->thread->lock);
+    		if (!the->thread->ticks--) {
+			spinlock_unlock(&the->thread->lock);
+			scheduler();
+		}
+		else {
+			spinlock_unlock(&the->thread->lock);
+		}
+	}
+
+}
Index: src/time/delay.c
===================================================================
--- src/time/delay.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/time/delay.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <time/delay.h>
+#include <arch/types.h>
+#include <cpu.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+/*
+ * Note that the delay loop is calibrated for each and every CPU in the system.
+ * Therefore it is necessary to cpu_priority_high() before calling the asm_delay_loop().
+ */
+void delay(__u32 microseconds)
+{
+	pri_t pri;
+
+	pri = cpu_priority_high();
+	asm_delay_loop(microseconds * the->cpu->delay_loop_const);
+	cpu_priority_restore(pri);
+}
Index: src/time/timeout.c
===================================================================
--- src/time/timeout.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/time/timeout.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <time/timeout.h>
+#include <typedefs.h>
+#include <arch/types.h>
+#include <config.h>
+#include <synch/spinlock.h>
+#include <func.h>
+#include <cpu.h>
+#include <print.h>
+#include <arch/asm.h>
+#include <arch.h>
+
+void timeout_init(void)
+{
+	spinlock_initialize(&the->cpu->timeoutlock);
+	list_initialize(&the->cpu->timeout_active_head);
+}
+
+
+void timeout_reinitialize(timeout_t *t)
+{
+	t->cpu = NULL;
+	t->ticks = 0;
+	t->handler = NULL;
+	t->arg = NULL;
+	link_initialize(&t->link);
+}
+
+void timeout_initialize(timeout_t *t)
+{
+	spinlock_initialize(&t->lock);
+	timeout_reinitialize(t);
+}
+
+/*
+ * This function registers f for execution in about time microseconds.
+ */
+void timeout_register(timeout_t *t, __u64 time, timeout_handler f, void *arg)
+{
+	timeout_t *hlp;
+	link_t *l, *m;
+	pri_t pri;
+	__u64 sum;
+
+	pri = cpu_priority_high();
+	spinlock_lock(&the->cpu->timeoutlock);
+	spinlock_lock(&t->lock);
+    
+	if (t->cpu)
+		panic("timeout_register: t->cpu != 0");
+
+	t->cpu = the->cpu;
+	t->ticks = us2ticks(time);
+	
+	t->handler = f;
+	t->arg = arg;
+    
+	/*
+	 * Insert t into the active timeouts list according to t->ticks.
+	 */
+	sum = 0;
+	l = the->cpu->timeout_active_head.next;
+	while (l != &the->cpu->timeout_active_head) {
+		hlp = list_get_instance(l, timeout_t, link);
+		spinlock_lock(&hlp->lock);
+		if (t->ticks < sum + hlp->ticks) {
+			spinlock_unlock(&hlp->lock);
+			break;
+		}
+		sum += hlp->ticks;
+		spinlock_unlock(&hlp->lock);
+		l = l->next;
+	}
+	m = l->prev;
+	list_prepend(&t->link, m); /* avoid using l->prev */
+
+	/*
+	 * Adjust t->ticks according to ticks accumulated in h's predecessors.
+	 */
+	t->ticks -= sum;
+
+	/*
+	 * Decrease ticks of t's immediate succesor by t->ticks.
+	 */
+	if (l != &the->cpu->timeout_active_head) {
+		spinlock_lock(&hlp->lock);
+		hlp->ticks -= t->ticks;
+		spinlock_unlock(&hlp->lock);
+	}
+
+	spinlock_unlock(&t->lock);
+	spinlock_unlock(&the->cpu->timeoutlock);
+	cpu_priority_restore(pri);
+}
+
+int timeout_unregister(timeout_t *t)
+{
+	timeout_t *hlp;
+	link_t *l;
+	pri_t pri;
+
+grab_locks:
+	pri = cpu_priority_high();
+	spinlock_lock(&t->lock);
+	if (!t->cpu) {
+		spinlock_unlock(&t->lock);
+		cpu_priority_restore(pri);
+		return 0;
+	}
+	if (!spinlock_trylock(&t->cpu->timeoutlock)) {
+		spinlock_unlock(&t->lock);
+		cpu_priority_restore(pri);		
+		goto grab_locks;
+	}
+	
+	/*
+	 * Now we know for sure that t hasn't been activated yet
+	 * and is lurking in t->cpu->timeout_active_head queue.
+	 */
+
+	l = t->link.next;
+	if (l != &t->cpu->timeout_active_head) {
+		hlp = list_get_instance(l, timeout_t, link);
+		spinlock_lock(&hlp->lock);
+		hlp->ticks += t->ticks;
+		spinlock_unlock(&hlp->lock);
+	}
+	
+	list_remove(&t->link);
+	spinlock_unlock(&t->cpu->timeoutlock);
+
+	timeout_reinitialize(t);
+	spinlock_unlock(&t->lock);
+
+	cpu_priority_restore(pri);
+	return 1;
+}
Index: test/synch/rwlock1/test.c
===================================================================
--- test/synch/rwlock1/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/rwlock1/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+
+#include <synch/waitq.h>
+#include <synch/rwlock.h>
+
+#define READERS		50
+#define WRITERS		50
+
+static rwlock_t rwlock;
+
+void test(void)
+{
+	printf("Read/write locks test #1\n");
+
+	rwlock_initialize(&rwlock);
+
+	rwlock_write_lock(&rwlock);
+	rwlock_write_unlock(&rwlock);	
+
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);	
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);
+
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);	
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+	
+	
+	rwlock_write_lock(&rwlock);
+	rwlock_write_unlock(&rwlock);	
+
+	rwlock_read_lock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+
+	rwlock_write_lock(&rwlock);
+	rwlock_write_unlock(&rwlock);	
+
+	rwlock_read_lock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+
+	printf("Test passed.\n");
+}
Index: test/synch/rwlock2/test.c
===================================================================
--- test/synch/rwlock2/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/rwlock2/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+
+#include <synch/rwlock.h>
+
+#define READERS		50
+#define WRITERS		50
+
+static rwlock_t rwlock;
+
+static void writer(void *arg);
+static void failed(void *arg);
+
+void writer(void *arg)
+{
+	printf("Trying to lock rwlock for writing....\n");    
+
+	rwlock_write_lock(&rwlock);
+	rwlock_write_unlock(&rwlock);
+	
+	printf("Trying to lock rwlock for reading....\n");    	
+	rwlock_read_lock(&rwlock);
+	rwlock_read_unlock(&rwlock);	
+	printf("Test passed.\n");
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	thread_t *thrd;
+	
+	printf("Read/write locks test #2\n");
+    
+	rwlock_initialize(&rwlock);
+
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);
+	rwlock_read_lock(&rwlock);	
+	
+	thrd = thread_create(writer, NULL, the->task, 0);
+	if (thrd)
+		thread_ready(thrd);
+	else
+		failed();
+
+
+	thread_sleep(1);
+	
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);
+	rwlock_read_unlock(&rwlock);	
+
+}
Index: test/synch/rwlock3/test.c
===================================================================
--- test/synch/rwlock3/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/rwlock3/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+
+#include <synch/rwlock.h>
+
+#define READERS		50
+#define WRITERS		50
+
+static rwlock_t rwlock;
+
+static void reader(void *arg);
+static void failed(void *arg);
+
+void reader(void *arg)
+{
+	printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", the->cpu->id, the->thread->tid);    	
+	rwlock_read_lock(&rwlock);
+	rwlock_read_unlock(&rwlock);	
+	printf("cpu%d, tid %d: success\n", the->cpu->id, the->thread->tid);    		
+
+	printf("cpu%d, tid %d: trying to lock rwlock for writing....\n", the->cpu->id, the->thread->tid);    	
+
+	rwlock_write_lock(&rwlock);
+	rwlock_write_unlock(&rwlock);
+	printf("cpu%d, tid %d: success\n", the->cpu->id, the->thread->tid);    			
+	
+	printf("Test passed.\n");	
+
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	int i;
+	thread_t *thrd;
+	
+	printf("Read/write locks test #2\n");
+    
+	rwlock_initialize(&rwlock);
+
+	rwlock_write_lock(&rwlock);
+	
+	for (i=0; i<4; i++) {
+		thrd = thread_create(reader, NULL, the->task, 0);
+		if (thrd)
+			thread_ready(thrd);
+		else
+			failed();
+	}
+
+
+	thread_sleep(1);
+	
+	rwlock_write_unlock(&rwlock);
+}
Index: test/synch/rwlock4/test.c
===================================================================
--- test/synch/rwlock4/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/rwlock4/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+#include <arch/types.h>
+#include <arch/context.h>
+
+#include <synch/waitq.h>
+#include <synch/rwlock.h>
+#include <synch/synch.h>
+
+#define READERS		50
+#define WRITERS		50
+
+static rwlock_t rwlock;
+
+static spinlock_t lock;
+
+static waitq_t can_start;
+
+__u32 seed = 0xdeadbeaf;
+
+static __u32 random(__u32 max);
+
+static void writer(void *arg);
+static void reader(void *arg);
+static void failed(void);
+
+__u32 random(__u32 max)
+{
+	__u32 rc;
+
+	spinlock_lock(&lock);	
+	rc = seed % max;
+	seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
+	spinlock_unlock(&lock);
+	return rc;
+}
+
+
+void writer(void *arg)
+{
+	int rc, to;
+	waitq_sleep(&can_start);
+
+	to = random(40000);
+	printf("cpu%d, tid %d w+ (%d)\n", the->cpu->id, the->thread->tid, to);
+	rc = rwlock_write_lock_timeout(&rwlock, to);
+	if (SYNCH_FAILED(rc)) {
+		printf("cpu%d, tid %d w!\n", the->cpu->id, the->thread->tid);
+		return;
+	};
+	printf("cpu%d, tid %d w=\n", the->cpu->id, the->thread->tid);
+
+	if (rwlock.readers_in) panic("Oops.");
+	thread_usleep(random(1000000));
+	if (rwlock.readers_in) panic("Oops.");	
+
+	rwlock_write_unlock(&rwlock);
+	printf("cpu%d, tid %d w-\n", the->cpu->id, the->thread->tid);	
+}
+
+void reader(void *arg)
+{
+	int rc, to;
+	waitq_sleep(&can_start);
+	
+	to = random(2000);
+	printf("cpu%d, tid %d r+ (%d)\n", the->cpu->id, the->thread->tid, to);
+	rc = rwlock_read_lock_timeout(&rwlock, to);
+	if (SYNCH_FAILED(rc)) {
+		printf("cpu%d, tid %d r!\n", the->cpu->id, the->thread->tid);
+		return;
+	}
+	printf("cpu%d, tid %d r=\n", the->cpu->id, the->thread->tid);
+	thread_usleep(30000);
+	rwlock_read_unlock(&rwlock);
+	printf("cpu%d, tid %d r-\n", the->cpu->id, the->thread->tid);		
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	context_t ctx;
+	__u32 i, k;
+	
+	printf("Read/write locks test #4\n");
+    
+	waitq_initialize(&can_start);
+	rwlock_initialize(&rwlock);
+	
+
+	
+	for (; ;) {
+		thread_t *thrd;
+		
+		context_save(&ctx);
+		printf("sp=%X, readers_in=%d\n", ctx.sp, rwlock.readers_in);
+		
+		k = random(7) + 1;
+		printf("Creating %d readers\n", k);
+		for (i=0; i<k; i++) {
+			thrd = thread_create(reader, NULL, the->task, 0);
+			if (thrd)
+				thread_ready(thrd);
+			else
+				failed();
+		}
+
+		k = random(5) + 1;
+		printf("Creating %d writers\n", k);
+		for (i=0; i<k; i++) {
+			thrd = thread_create(writer, NULL, the->task, 0);
+			if (thrd)
+				thread_ready(thrd);
+			else
+				failed();
+		}
+		
+		thread_usleep(20000);
+		waitq_wakeup(&can_start, WAKEUP_ALL);
+	}		
+
+}
Index: test/synch/rwlock5/test.c
===================================================================
--- test/synch/rwlock5/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/rwlock5/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+
+#include <synch/waitq.h>
+#include <synch/rwlock.h>
+
+#define READERS		50
+#define WRITERS		50
+
+static rwlock_t rwlock;
+
+static waitq_t can_start;
+static int items_read;
+static int items_written;
+
+static void writer(void *arg);
+static void reader(void *arg);
+static void failed(void);
+
+void writer(void *arg)
+{
+	waitq_sleep(&can_start);
+
+	rwlock_write_lock(&rwlock);
+	atomic_inc(&items_written);
+	rwlock_write_unlock(&rwlock);
+}
+
+void reader(void *arg)
+{
+	waitq_sleep(&can_start);
+	
+	rwlock_read_lock(&rwlock);
+	atomic_inc(&items_read);
+	rwlock_read_unlock(&rwlock);
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	int i, j, k;
+	int readers, writers;
+	
+	printf("Read/write locks test #5\n");
+    
+	waitq_initialize(&can_start);
+	rwlock_initialize(&rwlock);
+	
+	for (i=1; i<=3; i++) {
+		thread_t *thrd;
+
+		items_read = 0;
+		items_written = 0;
+
+		readers = i*READERS;
+		writers = (4-i)*WRITERS;
+
+		printf("Creating %d readers and %d writers...", readers, writers);
+		
+		for (j=0; j<(READERS+WRITERS)/2; j++) {
+			for (k=0; k<i; k++) {
+				thrd = thread_create(reader, NULL, the->task, 0);
+				if (thrd)
+					thread_ready(thrd);
+				else
+					failed();
+			}
+			for (k=0; k<(4-i); k++) {
+				thrd = thread_create(writer, NULL, the->task, 0);
+				if (thrd)
+					thread_ready(thrd);
+				else
+					failed();
+			}
+		}
+
+		printf("ok\n");
+
+		thread_sleep(1);
+		waitq_wakeup(&can_start, WAKEUP_ALL);
+	
+		while (items_read != readers || items_written != writers) {
+			printf("%d readers remaining, %d writers remaining, readers_in=%d\n", readers - items_read, writers - items_written, rwlock.readers_in);
+			thread_usleep(100000);
+		}
+	}
+	printf("Test passed.\n");
+}
Index: test/synch/semaphore1/test.c
===================================================================
--- test/synch/semaphore1/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/semaphore1/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+
+#include <synch/waitq.h>
+#include <synch/semaphore.h>
+
+#define AT_ONCE			3
+#define PRODUCERS		50
+#define CONSUMERS		50
+
+static semaphore_t sem;
+
+static waitq_t can_start;
+static int items_produced;
+static int items_consumed;
+
+static void consumer(void *arg);
+static void producer(void *arg);
+static void failed(void);
+
+void producer(void *arg)
+{
+	waitq_sleep(&can_start);
+	    
+	semaphore_down(&sem);
+	atomic_inc(&items_produced);
+	thread_usleep(250);
+	semaphore_up(&sem);
+}
+
+void consumer(void *arg)
+{
+	waitq_sleep(&can_start);
+	
+	semaphore_down(&sem);
+	atomic_inc(&items_consumed);
+	thread_usleep(500);
+	semaphore_up(&sem);
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	int i, j, k;
+	int consumers, producers;
+	
+	printf("Semaphore test #1\n");
+    
+	waitq_initialize(&can_start);
+	semaphore_initialize(&sem, AT_ONCE);
+
+
+	for (i=1; i<=3; i++) {
+		thread_t *thrd;
+
+		items_produced = 0;
+		items_consumed = 0;
+		
+		consumers = i * CONSUMERS;
+		producers = (4-i) * PRODUCERS;
+		
+		printf("Creating %d consumers and %d producers...", consumers, producers);
+	
+		for (j=0; j<(CONSUMERS+PRODUCERS)/2; j++) {
+			for (k=0; k<i; k++) {
+				thrd = thread_create(consumer, NULL, the->task, 0);
+				if (thrd)
+					thread_ready(thrd);
+				else
+					failed();
+			}
+			for (k=0; k<(4-i); k++) {
+				thrd = thread_create(producer, NULL, the->task, 0);
+				if (thrd)
+					thread_ready(thrd);
+				else
+					failed();
+			}
+		}
+
+		printf("ok\n");
+
+		thread_sleep(1);
+		waitq_wakeup(&can_start, WAKEUP_ALL);
+	
+		while (items_consumed != consumers || items_produced != producers) {
+			printf("%d consumers remaining, %d producers remaining\n", consumers - items_consumed, producers - items_produced);
+			thread_sleep(1);
+		}
+	}
+	printf("Test passed.\n");
+}
Index: test/synch/semaphore2/test.c
===================================================================
--- test/synch/semaphore2/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ test/synch/semaphore2/test.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2001-2004 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <test.h>
+#include <arch.h>
+#include <arch/atomic.h>
+#include <print.h>
+#include <proc/thread.h>
+#include <arch/types.h>
+#include <arch/context.h>
+
+#include <synch/waitq.h>
+#include <synch/semaphore.h>
+#include <synch/synch.h>
+
+static semaphore_t sem;
+
+static spinlock_t lock;
+
+static waitq_t can_start;
+
+__u32 seed = 0xdeadbeaf;
+
+static __u32 random(__u32 max);
+
+static void consumer(void *arg);
+static void failed(void);
+
+__u32 random(__u32 max)
+{
+	__u32 rc;
+
+	spinlock_lock(&lock);	
+	rc = seed % max;
+	seed = (((seed<<2) ^ (seed>>2)) * 487) + rc;
+	spinlock_unlock(&lock);
+	return rc;
+}
+
+
+void consumer(void *arg)
+{
+	int rc, to;
+	waitq_sleep(&can_start);
+	
+	to = random(20000);
+	printf("cpu%d, tid %d down+ (%d)\n", the->cpu->id, the->thread->tid, to);
+	rc = semaphore_down_timeout(&sem, to);
+	if (SYNCH_FAILED(rc)) {
+		printf("cpu%d, tid %d down!\n", the->cpu->id, the->thread->tid);
+		return;
+	}
+	
+	printf("cpu%d, tid %d down=\n", the->cpu->id, the->thread->tid);	
+	thread_usleep(random(30000));
+	
+	semaphore_up(&sem);
+	printf("cpu%d, tid %d up\n", the->cpu->id, the->thread->tid);
+}
+
+void failed(void)
+{
+	printf("Test failed prematurely.\n");
+	thread_exit();
+}
+
+void test(void)
+{
+	context_t ctx;
+	__u32 i, k;
+	
+	printf("Semaphore test #2\n");
+    
+	waitq_initialize(&can_start);
+	semaphore_initialize(&sem, 5);
+	
+
+	
+	for (; ;) {
+		thread_t *thrd;
+		
+		k = random(7) + 1;
+		printf("Creating %d consumers\n", k);
+		for (i=0; i<k; i++) {
+			thrd = thread_create(consumer, NULL, the->task, 0);
+			if (thrd)
+				thread_ready(thrd);
+			else
+				failed();
+		}
+		
+		thread_usleep(20000);
+		waitq_wakeup(&can_start, WAKEUP_ALL);
+	}		
+
+}
Index: ols/README
===================================================================
--- tools/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-## Tools
-
-This directory contains various scripts.
-Some of them are used by the build system itself and are not relevant for most
-people. Others are available for manual use, and that category further
-divides into those meant to be used in the source directory, and those that
-work on the build directory.
-
-
-### Source directory scripts
-
- * build_all.sh
-   - Builds (or incrementally rebuilds) all predefined HelenOS configurations.
-     Can be executed in arbitrary directory outside the source tree.
- * build-ccheck.sh
-   - Builds the ccheck tool.
- * ccheck.sh
-   - Runs the ccheck tool to verify coding style of C files in the repository.
- * srepl
-   - A refactoring tool for global search-and-replace operations. Sed wrapper.
- * toolchain.sh
-   - Builds the cross-compiler toolchains necessary to build HelenOS.
- * release.sh
-   - Builds everything (as in build_all.sh), and generates release artifacts.
-
-
-### Build directory scripts
-
- * ew.py
-   - Emulator Wrapper. After building the system image, some machines can be
-     run in an emulator, mostly QEMU. This script simplifies it.
- * export.sh
-   - Exports a subset of development files in a form suitable for cross-compiling
-     third-party software independently of the HelenOS source tree.
-     The exported files are specific for the currently built configuration.
-
-
-### Used by build scripts
-
- * autocheck.awk
- * cc.sh
- * config.py
- * mkarray.py, mkarray_for_meson.sh
- * mkuimage.py
-
-
-### Misc
-
- * filldir.py
-   - Fill a directory with N empty directories. Seems to be unused, purpose unclear.
- * gentestfile.py
-   - Generates test file for uspace/app/testread.
- * jobfile.py
-   - Obsolete tooling support. Replaced by Meson.
- * mkext2.py, mkext4.py, mkfat.py
-   - File system builders that don't require root privileges.
-     Used by build scripts and by ew.py.
- * travis.sh
-   - Runs Travis CI jobs. Not meant for human consumption.
- * imgutil.py, xstruct.py, xtui.py
-   - Libraries for other python scripts.
Index: ols/autocheck.awk
===================================================================
--- tools/autocheck.awk	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#!/usr/bin/awk -f
-#
-# Copyright (c) 2018 CZ.NIC, z.s.p.o.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Authors:
-# 	Jiří Zárevúcky <jiri.zarevucky@nic.cz>
-
-BEGIN {
-	filename = ARGV[1]
-	output_lines = 0
-	print "// Generated file. Fix the included header if static assert fails."
-	print "// Inlined \"" filename "\""
-}
-
-{
-	print $0
-}
-
-/}.*;/ {
-	pattern = "}( __attribute__\\(.*\\))? (" struct_name "_t)?;"
-	if ($0 !~ pattern) {
-		print("Bad struct ending: " $0) > "/dev/stderr"
-		exit 1
-	}
-	macro_name = toupper(struct_name) "_SIZE"
-	output[output_lines++] = "_Static_assert(" macro_name " == sizeof(struct " struct_name "), \"\");"
-	struct_name = ""
-}
-
-/;$/ {
-	if (struct_name != "") {
-		# Remove array subscript, if any.
-		sub("(\\[.*\\])?;", "", $0)
-		member = $NF
-
-		macro_name = toupper(struct_name) "_OFFSET_" toupper(member)
-		output[output_lines++] = "_Static_assert(" macro_name " == __builtin_offsetof(struct " struct_name ", " member "), \"\");"
-
-		macro_name = toupper(struct_name) "_SIZE_" toupper(member)
-		output[output_lines++] = "#ifdef " macro_name
-		output[output_lines++] = "_Static_assert(" macro_name " == sizeof(((struct " struct_name "){ })." member "), \"\");"
-		output[output_lines++] = "#endif"
-	}
-}
-
-/^typedef struct .* \{/ {
-	struct_name = $3
-}
-
-END {
-	for ( i = 0; i < output_lines; i++ ) {
-		print output[i]
-	}
-}
Index: ols/build-ccheck.sh
===================================================================
--- tools/build-ccheck.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-SYCEK_GIT="https://github.com/jxsvoboda/sycek"
-SYCEK_REV="e606f73fd875b5d9ff48261b23f69552a893f5d4"
-
-if [ ! -d sycek ]; then
-	git clone "$SYCEK_GIT" sycek
-fi
-
-cd sycek
-
-# Make sure we have the required revision
-echo "Making sure Sycek is up to date..."
-git checkout "$SYCEK_REV" 2>/dev/null
-rc=$?
-if [ $rc != 0 ]; then
-	echo "Pulling from Sycek repo..."
-	git checkout master
-	git pull
-	git checkout "$SYCEK_REV" 2>/dev/null
-	rc=$?
-	if [ $rc != 0 ]; then
-		echo "Error checking out Sycek rev $SYCEK_REV"
-		exit 1
-	fi
-
-	make clean || exit 1
-	make || exit 1
-else
-	make >/dev/null || exit 1
-fi
Index: ols/build_all.sh
===================================================================
--- tools/build_all.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Find out the path to the script.
-SOURCE_DIR=`which -- "$0" 2>/dev/null`
-# Maybe we are running bash.
-[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
-[ -z "$SOURCE_DIR" ] && exit 1
-SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
-SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
-
-# Check command line arguments.
-
-if [ "$#" -gt 1 ] || ( [ "$#" -eq 1 ] && [ "$1" != '--no-images' ] ); then
-	echo "Unknown command-line arguments."
-	echo "Usage:"
-	echo "    $0                    # Build everything."
-	echo "    $0 --no-images        # Build all code, but don't create bootable images."
-	exit 1
-fi
-
-if [ "$#" -eq 1 ]; then
-	NO_IMAGES=true
-else
-	NO_IMAGES=false
-fi
-
-# Make sure we don't make a mess in the source root.
-if [ "$PWD" = "$SOURCE_DIR" ]; then
-	mkdir -p build_all
-	cd build_all
-fi
-
-CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
-
-PROFILES=`sh ${SOURCE_DIR}/tools/list_profiles.sh`
-
-echo
-echo "###################### Configuring all profiles ######################"
-
-echo "Configuring profiles" $PROFILES
-
-for profile in $PROFILES; do
-	# echo "Configuring profile ${profile}"
-
-	mkdir -p ${profile} || exit 1
-	script -q -e /dev/null -c "cd '${profile}' && '${SOURCE_DIR}/configure.sh' '${profile}' && ninja build.ninja" </dev/null >"${profile}/configure_output.log" 2>&1  &
-	echo "$!" >"${profile}/configure.pid"
-done
-
-failed='no'
-
-for profile in $PROFILES; do
-	if ! wait `cat "${profile}/configure.pid"`; then
-		failed='yes'
-		cat "${profile}/configure_output.log"
-		echo
-		echo "Configuration of profile ${profile} failed."
-		echo
-	fi
-done
-
-if [ "$failed" = 'yes' ]; then
-	echo
-	echo "Some configuration jobs failed."
-	exit 1
-else
-	echo "All profiles configured."
-fi
-
-echo
-echo "###################### Building all profiles ######################"
-
-for profile in $PROFILES; do
-	echo
-	ninja -C ${profile} || exit 1
-done
-
-if [ "$NO_IMAGES" = 'true' ]; then
-	echo
-	echo "Bootable images not built due to argument --no-images."
-	exit 0
-fi
-
-echo
-echo "###################### Building all images ######################"
-
-for profile in $PROFILES; do
-	echo
-	ninja -C ${profile} image_path || exit 1
-done
-
-echo
-for profile in $PROFILES; do
-	path=`cat ${profile}/image_path`
-
-	if [ ! -z "$path" ]; then
-		echo "built ${profile}/${path}"
-	fi
-done
Index: ols/cc.sh
===================================================================
--- tools/cc.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2017 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-cat << EOF
-In order to comply with the license terms of the distributed software, we would
-like to reproduce the following copyright notices, that were automatically
-collected by our $0 script, followed by a list of conditions and
-disclaimer:
-EOF
-
-# Find out the path to the script.
-SOURCE_DIR=`which -- "$0" 2>/dev/null`
-# Maybe we are running bash.
-[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
-[ -z "$SOURCE_DIR" ] && exit 1
-SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
-SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
-
-echo ""
-
-git -C "$SOURCE_DIR" grep 'Copyright ([cC])' | \
-	sed -E -n 's/^.*(Copyright \([cC]\) (20[0-9][0-9]-)?20[0-9][0-9],? [-a-zA-Z., ]*[-a-zA-Z.]$)/\1/p' | \
-	sed -E 's/ ( )+/ /' | \
-	grep -v 'HelenOS project' | \
-	sort -u
-
-echo ""
-
-cat << EOF
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-- Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer in the
-  documentation and/or other materials provided with the distribution.
-- The name of the author may not be used to endorse or promote products
-  derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-EOF
-
Index: ols/ccheck.sh
===================================================================
--- tools/ccheck.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ccheck=tools/sycek/ccheck
-if [ ."$CCHECK" != . ]; then
-	ccheck="$CCHECK"
-fi
-
-if [ ."$1" = .--fix ]; then
-	opt=--fix
-else
-	opt=
-fi
-
-srepcnt=0
-snorepcnt=0
-fcnt=0
-
-find abi kernel boot uspace -type f -regex '^.*\.[ch]$' \
-  | grep -v -e '^uspace/lib/pcut/' \
-  | (
-while read fname; do
-	outfile="$(mktemp)"
-	"$ccheck" $opt $fname >"$outfile" 2>&1
-	if [ $? -eq 0 ]; then
-		if [ -s "$outfile" ] ; then
-			srepcnt=$((srepcnt + 1))
-			cat "$outfile"
-		else
-			snorepcnt=$((snorepcnt + 1))
-		fi
-	else
-		fcnt=$((fcnt + 1))
-		cat "$outfile"
-	fi
-
-	rm -f "$outfile"
-done
-
-if [ $srepcnt -eq 0 ] && [ $fcnt -eq 0 ]; then
-	echo "Ccheck passed."
-else
-	echo "Ccheck failed."
-	echo "Checked files with issues: $srepcnt"
-	echo "Checked files without issues: $snorepcnt"
-	echo "Files with parse errors: $fcnt"
-	exit 1
-fi
-)
Index: ols/checkers/clang.py
===================================================================
--- tools/checkers/clang.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Wrapper for Clang static analyzer
-"""
-
-import sys
-import os
-import subprocess
-import jobfile
-
-jobs = [
-	"kernel/kernel.job"
-]
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <ROOT>")
-
-def clang(root, job):
-	"Run Clang on a jobfile"
-
-	inname = os.path.join(root, job)
-
-	if (not os.path.isfile(inname)):
-		print("Unable to open %s" % inname)
-		print("Did you run \"make precheck\" on the source tree?")
-		return False
-
-	inf = open(inname, "r")
-	records = inf.read().splitlines()
-	inf.close()
-
-	for record in records:
-		arg = jobfile.parse_arg(record)
-		if (not arg):
-			return False
-
-		if (len(arg) < 6):
-			print("Not enough jobfile record arguments")
-			return False
-
-		srcfname = arg[0]
-		tgtfname = arg[1]
-		tool = arg[2]
-		category = arg[3]
-		base = arg[4]
-		options = arg[5].split()
-
-		srcfqname = os.path.join(base, srcfname)
-		if (not os.path.isfile(srcfqname)):
-			print("Source %s not found" % srcfqname)
-			return False
-
-		# Only C files are interesting for us
-		if (tool != "cc"):
-			continue
-
-		args = ['clang', '-Qunused-arguments', '--analyze',
-			'-Xanalyzer', '-analyzer-opt-analyze-headers',
-			'-Xanalyzer', '-checker-cfref']
-		args.extend(options)
-		args.extend(['-o', tgtfname, srcfname])
-
-		cwd = os.getcwd()
-		os.chdir(base)
-		retval = subprocess.Popen(args).wait()
-		os.chdir(cwd)
-
-		if (retval != 0):
-			return False
-
-	return True
-
-def main():
-	if (len(sys.argv) < 2):
-		usage(sys.argv[0])
-		return
-
-	rootdir = os.path.abspath(sys.argv[1])
-	config = os.path.join(rootdir, "HelenOS.config")
-
-	if (not os.path.isfile(config)):
-		print("%s not found." % config)
-		print("Please specify the path to HelenOS build tree root as the first argument.")
-		return
-
-	for job in jobs:
-		if (not clang(rootdir, job)):
-			print()
-			print("Failed job: %s" % job)
-			return
-
-	print
-	print("All jobs passed")
-
-if __name__ == '__main__':
-	main()
Index: ols/checkers/howto.txt
===================================================================
--- tools/checkers/howto.txt	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,28 +1,0 @@
-Basic instructions
-------------------
-This is a very brief and preliminary description of the usage of source
-code checkers and verifiers located in this directory. It is not intended
-to be perfect since the formal verification is still work-in-progress, but
-it should at least give you some basic hints.
-
-If you want to try, say, the Clang static analyzer, follow the steps:
-
-1. Go to the root directory of HelenOS source tree.
-
-2. Run
-
-      make precheck
-
-   Configure the kernel according to your preferences. Remember that many
-   checkers have specific limitation on the target platform. They might
-   require the abstract platform abs32le or they might be suitable only
-   for platforms supported by some toolchain (e.g. ia32 and amd64 in the
-   case of Clang).
-
-3. As HelenOS compiles, Jobfiles (e.g. kernel/kernel.job) are created.
-
-4. Execute the checker while still in the source tree root directory. Do
-   not forget the argument "." which indicates the path to the source tree
-   root directory.
-
-      ./tools/checkers/clang.py .
Index: ols/checkers/jobfile.py
===================================================================
--- tools/checkers/jobfile.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Helper routines for parsing jobfiles
-"""
-
-def parse_arg(record):
-	"Parse jobfile line arguments"
-
-	arg = []
-	i = 0
-	current = ""
-	nil = True
-	inside = False
-
-	while (i < len(record)):
-		if (inside):
-			if (record[i] == "}"):
-				inside = False
-			else:
-				current = "%s%s" % (current, record[i])
-		else:
-			if (record[i] == "{"):
-				nil = False
-				inside = True
-			elif (record[i] == ","):
-				arg.append(current)
-				current = ""
-				nil = True
-			else:
-				print("Unexpected '%s'" % record[i])
-				return False
-
-		i += 1
-
-	if (not nil):
-		arg.append(current)
-
-	return arg
Index: ols/checkers/stanse.py
===================================================================
--- tools/checkers/stanse.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Wrapper for Stanse static checker
-"""
-
-import sys
-import os
-import subprocess
-import jobfile
-
-jobs = [
-	"kernel/kernel.job",
-	"uspace/srv/clip/clip.job"
-]
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <ROOT>")
-
-def stanse(root, job):
-	"Run Stanse on a jobfile"
-
-	# Convert generic jobfile to Stanse-specific jobfile format
-
-	inname = os.path.join(root, job)
-	outname = os.path.join(root, "_%s" % os.path.basename(job))
-
-	if (not os.path.isfile(inname)):
-		print("Unable to open %s" % inname)
-		print("Did you run \"make precheck\" on the source tree?")
-		return False
-
-	inf = open(inname, "r")
-	records = inf.read().splitlines()
-	inf.close()
-
-	output = []
-	for record in records:
-		arg = jobfile.parse_arg(record)
-		if (not arg):
-			return False
-
-		if (len(arg) < 6):
-			print("Not enough jobfile record arguments")
-			return False
-
-		srcfname = arg[0]
-		tgtfname = arg[1]
-		tool = arg[2]
-		category = arg[3]
-		base = arg[4]
-		options = arg[5]
-
-		srcfqname = os.path.join(base, srcfname)
-		if (not os.path.isfile(srcfqname)):
-			print("Source %s not found" % srcfqname)
-			return False
-
-		# Only C files are interesting for us
-		if (tool != "cc"):
-			continue
-
-		output.append([srcfname, tgtfname, base, options])
-
-	outf = open(outname, "w")
-	for record in output:
-		outf.write("{%s},{%s},{%s},{%s}\n" % (record[0], record[1], record[2], record[3]))
-	outf.close()
-
-	# Run Stanse
-
-	retval = subprocess.Popen(['stanse', '--checker', 'ReachabilityChecker', '--jobfile', outname]).wait()
-
-	# Cleanup
-
-	os.remove(outname)
-	for record in output:
-		tmpfile = os.path.join(record[2], "%s.preproc" % record[1])
-		if (os.path.isfile(tmpfile)):
-			os.remove(tmpfile)
-
-	if (retval == 0):
-		return True
-
-	return False
-
-def main():
-	if (len(sys.argv) < 2):
-		usage(sys.argv[0])
-		return
-
-	rootdir = os.path.abspath(sys.argv[1])
-	config = os.path.join(rootdir, "HelenOS.config")
-
-	if (not os.path.isfile(config)):
-		print("%s not found." % config)
-		print("Please specify the path to HelenOS build tree root as the first argument.")
-		return
-
-	for job in jobs:
-		if (not stanse(rootdir, job)):
-			print()
-			print("Failed job: %s" % job)
-			return
-
-	print
-	print("All jobs passed")
-
-if __name__ == '__main__':
-	main()
Index: ols/checkers/stanse/ThreadChecker.xml
===================================================================
--- tools/checkers/stanse/ThreadChecker.xml	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-
- Copyright (c) 2009 Martin Decky
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
- - The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--->
-
-<threadChecker>
-	<analyseType type="local" />
-	<patterns>
-		<pattern name="lockFunction">
-			<nested>
-				<functionCall>
-					<id>_mutex_lock_timeout</id>
-					<var name="mtx" />
-				</functionCall>
-			</nested>
-		</pattern>
-		<pattern name="unlockFunction">
-			<nested>
-				<functionCall>
-					<id>mutex_unlock</id>
-					<var name="mtx" />
-				</functionCall>
-			</nested>
-		</pattern>
-	</patterns>
-</threadChecker>
Index: ols/checkers/vcc.h
===================================================================
--- tools/checkers/vcc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * VCC specifications tight to the HelenOS-specific annotations.
- *
- */
-
-#ifndef HELENOS_VCC_H_
-#define HELENOS_VCC_H_
-
-typedef _Bool bool;
-
-#define __concat_identifiers_str(a, b)  a ## b
-#define __concat_identifiers(a, b)      __concat_identifiers_str(a, b)
-
-#define __specification_attr(key, value) \
-	__declspec(System.Diagnostics.Contracts.CodeContract.StringVccAttr, \
-	    key, value)
-
-#define __specification_type(name) \
-	__specification( \
-		typedef struct __concat_identifiers(_vcc_math_type_, name) { \
-			char _vcc_marker_for_math_type; \
-		} __concat_identifiers(\, name); \
-	)
-
-__specification(typedef void * \object;)
-__specification(typedef __int64 \integer;)
-__specification(typedef unsigned __int64 \size_t;)
-
-__specification_type(objset)
-
-__specification(struct \TypeState {
-	__specification(ghost \integer \claim_count;)
-	__specification(ghost bool \consistent;)
-	__specification(ghost \objset \owns;)
-	__specification(ghost \object \owner;)
-	__specification(ghost bool \valid;)
-};)
-
-__specification(bool \extent_mutable(\object);)
-__specification(\objset \extent(\object);)
-__specification(\objset \array_range(\object, \size_t);)
-__specification(bool \mutable_array(\object, \size_t);)
-
-#endif
-
-/** @}
- */
Index: ols/checkers/vcc.py
===================================================================
--- tools/checkers/vcc.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2010 Martin Decky
-# Copyright (c) 2010 Ondrej Sery
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Wrapper for Vcc checker
-"""
-
-import sys
-import os
-import subprocess
-import jobfile
-import re
-
-jobs = [
-	"kernel/kernel.job"
-]
-
-re_attribute = re.compile("__attribute__\s*\(\(.*\)\)")
-re_va_list = re.compile("__builtin_va_list")
-
-specification = ""
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <ROOT> [VCC_PATH]")
-
-def cygpath(upath):
-	"Convert Unix (Cygwin) path to Windows path"
-
-	return subprocess.Popen(['cygpath', '--windows', '--absolute', upath], stdout = subprocess.PIPE).communicate()[0].strip()
-
-def preprocess(srcfname, tmpfname, base, options):
-	"Preprocess source using GCC preprocessor and compatibility tweaks"
-
-	global specification
-
-	args = ['gcc', '-E']
-	args.extend(options.split())
-	args.extend(['-DCONFIG_VERIFY_VCC=1', srcfname])
-
-	# Change working directory
-
-	cwd = os.getcwd()
-	os.chdir(base)
-
-	preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0]
-
-	tmpf = open(tmpfname, "w")
-	tmpf.write(specification)
-
-	for line in preproc.splitlines():
-
-		# Ignore preprocessor directives
-
-		if (line.startswith('#')):
-			continue
-
-		# Remove __attribute__((.*)) GCC extension
-
-		line = re.sub(re_attribute, "", line)
-
-		# Ignore unsupported __builtin_va_list type
-		# (a better solution replacing __builrin_va_list with
-		# an emulated implementation is needed)
-
-		line = re.sub(re_va_list, "void *", line)
-
-		tmpf.write("%s\n" % line)
-
-	tmpf.close()
-
-	os.chdir(cwd)
-
-	return True
-
-def vcc(vcc_path, root, job):
-	"Run Vcc on a jobfile"
-
-	# Parse jobfile
-
-	inname = os.path.join(root, job)
-
-	if (not os.path.isfile(inname)):
-		print("Unable to open %s" % inname)
-		print("Did you run \"make precheck\" on the source tree?")
-		return False
-
-	inf = open(inname, "r")
-	records = inf.read().splitlines()
-	inf.close()
-
-	for record in records:
-		arg = jobfile.parse_arg(record)
-		if (not arg):
-			return False
-
-		if (len(arg) < 6):
-			print("Not enough jobfile record arguments")
-			return False
-
-		srcfname = arg[0]
-		tgtfname = arg[1]
-		tool = arg[2]
-		category = arg[3]
-		base = arg[4]
-		options = arg[5]
-
-		srcfqname = os.path.join(base, srcfname)
-		if (not os.path.isfile(srcfqname)):
-			print("Source %s not found" % srcfqname)
-			return False
-
-		tmpfname = "%s.preproc" % srcfname
-		tmpfqname = os.path.join(base, tmpfname)
-
-		vccfname = "%s.i" % srcfname
-		vccfqname = os.path.join(base, vccfname);
-
-		# Only C files are interesting for us
-		if (tool != "cc"):
-			continue
-
-		# Preprocess sources
-
-		if (not preprocess(srcfname, tmpfname, base, options)):
-			return False
-
-		# Run Vcc
-		print(" -- %s --" % srcfname)
-		retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait()
-
-		if (retval != 0):
-			return False
-
-		# Cleanup, but only if verification was successful
-		# (to be able to examine the preprocessed file)
-
-		if (os.path.isfile(tmpfqname)):
-			os.remove(tmpfqname)
-			os.remove(vccfqname)
-
-	return True
-
-def main():
-	global specification
-
-	if (len(sys.argv) < 2):
-		usage(sys.argv[0])
-		return
-
-	rootdir = os.path.abspath(sys.argv[1])
-	if (len(sys.argv) > 2):
-		vcc_path = sys.argv[2]
-	else:
-		vcc_path = "/cygdrive/c/Program Files (x86)/Microsoft Research/Vcc/Binaries/vcc"
-
-	if (not os.path.isfile(vcc_path)):
-		print("%s is not a binary." % vcc_path)
-		print("Please supply the full Cygwin path to Vcc as the second argument.")
-		return
-
-	config = os.path.join(rootdir, "HelenOS.config")
-
-	if (not os.path.isfile(config)):
-		print("%s not found." % config)
-		print("Please specify the path to HelenOS build tree root as the first argument.")
-		return
-
-	specpath = os.path.join(rootdir, "tools/checkers/vcc.h")
-	if (not os.path.isfile(specpath)):
-		print("%s not found." % config)
-		return
-
-	specfile = file(specpath, "r")
-	specification = specfile.read()
-	specfile.close()
-
-	for job in jobs:
-		if (not vcc(vcc_path, rootdir, job)):
-			print()
-			print("Failed job: %s" % job)
-			return
-
-	print()
-	print("All jobs passed")
-
-if __name__ == '__main__':
-	main()
Index: ols/conf/msim.conf
===================================================================
--- tools/conf/msim.conf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-#
-# MSIM configuration script
-#
-
-add dr4kcpu cpu0
-add dr4kcpu cpu1
-
-add rwm mainmem 0x00000000
-mainmem generic 64M
-mainmem fill 0
-
-add rom bootmem 0x1fc00000
-bootmem generic 4096k
-bootmem load "image.boot"
-
-add dprinter printer 0x10000000
-add dkeyboard keyboard 0x10000000 2
-add dorder order 0x10000100 5
-
-add ddisk disk 0x10000200 6
-disk fmap "hdisk.img"
-
Index: ols/conf/ski.conf
===================================================================
--- tools/conf/ski.conf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-load image.boot
-c
Index: ols/config.py
===================================================================
--- tools/config.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,858 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2006 Ondrej Palkovsky
-# Copyright (c) 2009 Martin Decky
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-HelenOS configuration system
-"""
-
-import sys
-import os
-import re
-import time
-import subprocess
-import xtui
-import random
-
-ARGPOS_RULES = 1
-ARGPOS_PRESETS_DIR = 2
-ARGPOS_CHOICE = 3
-ARGPOS_PRESET = 4
-ARGPOS_MASK_PLATFORM = 3
-
-RULES_FILE = sys.argv[ARGPOS_RULES]
-MAKEFILE = 'Makefile.config'
-MACROS = 'config.h'
-PRESETS_DIR = sys.argv[ARGPOS_PRESETS_DIR]
-
-class BinaryOp:
-	def __init__(self, operator, left, right):
-		assert operator in ('&', '|', '=', '!=')
-
-		self._operator = operator
-		self._left = left
-		self._right = right
-
-	def evaluate(self, config):
-		if self._operator == '&':
-			return self._left.evaluate(config) and \
-			    self._right.evaluate(config)
-		if self._operator == '|':
-			return self._left.evaluate(config) or \
-			    self._right.evaluate(config)
-
-		# '=' or '!='
-		if not self._left in config:
-			config_val = ''
-		else:
-			config_val = config[self._left]
-			if config_val == '*':
-				config_val = 'y'
-
-		if self._operator == '=':
-			return self._right == config_val
-		return self._right != config_val
-
-# Expression parser
-class CondParser:
-	TOKEN_EOE = 0
-	TOKEN_SPECIAL = 1
-	TOKEN_STRING = 2
-
-	def __init__(self, text):
-		self._text = text
-
-	def parse(self):
-		self._position = -1
-		self._next_char()
-		self._next_token()
-
-		res = self._parse_expr()
-		if self._token_type != self.TOKEN_EOE:
-			self._error("Expected end of expression")
-		return res
-
-	def _next_char(self):
-		self._position += 1
-		if self._position >= len(self._text):
-			self._char = None
-		else:
-			self._char = self._text[self._position]
-		self._is_special_char = self._char in \
-		    ('&', '|', '=', '!', '(', ')')
-
-	def _error(self, msg):
-		raise RuntimeError("Error parsing expression: %s:\n%s\n%s^" %
-		    (msg, self._text, " " * self._token_position))
-
-	def _next_token(self):
-		self._token_position = self._position
-
-		# End of expression
-		if self._char == None:
-			self._token = None
-			self._token_type = self.TOKEN_EOE
-			return
-
-		# '&', '|', '=', '!=', '(', ')'
-		if self._is_special_char:
-			self._token = self._char
-			self._next_char()
-			if self._token == '!':
-				if self._char != '=':
-					self._error("Expected '='")
-				self._token += self._char
-				self._next_char()
-			self._token_type = self.TOKEN_SPECIAL
-			return
-
-		# <var> or <val>
-		self._token = ''
-		self._token_type = self.TOKEN_STRING
-		while True:
-			self._token += self._char
-			self._next_char()
-			if self._is_special_char or self._char == None:
-				break
-
-	def _parse_expr(self):
-		""" <expr> ::= <or_expr> ('&' <or_expr>)* """
-
-		left = self._parse_or_expr()
-		while self._token == '&':
-			self._next_token()
-			left = BinaryOp('&', left, self._parse_or_expr())
-		return left
-
-	def _parse_or_expr(self):
-		""" <or_expr> ::= <factor> ('|' <factor>)* """
-
-		left = self._parse_factor()
-		while self._token == '|':
-			self._next_token()
-			left = BinaryOp('|', left, self._parse_factor())
-		return left
-
-	def _parse_factor(self):
-		""" <factor> ::= <var> <cond> | '(' <expr> ')' """
-
-		if self._token == '(':
-			self._next_token()
-			res = self._parse_expr()
-			if self._token != ')':
-				self._error("Expected ')'")
-			self._next_token()
-			return res
-
-		if self._token_type == self.TOKEN_STRING:
-			var = self._token
-			self._next_token()
-			return self._parse_cond(var)
-
-		self._error("Expected '(' or <var>")
-
-	def _parse_cond(self, var):
-		""" <cond> ::= '=' <val> | '!=' <val> """
-
-		if self._token not in ('=', '!='):
-			self._error("Expected '=' or '!='")
-
-		oper = self._token
-		self._next_token()
-
-		if self._token_type != self.TOKEN_STRING:
-			self._error("Expected <val>")
-
-		val = self._token
-		self._next_token()
-
-		return BinaryOp(oper, var, val)
-
-def read_config(fname, config):
-	"Read saved values from last configuration run or a preset file"
-
-	inf = open(fname, 'r')
-
-	for line in inf:
-		res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
-		if res:
-			config[res.group(1)] = res.group(2)
-
-	inf.close()
-
-def parse_rules(fname, rules):
-	"Parse rules file"
-
-	inf = open(fname, 'r')
-
-	name = ''
-	choices = []
-
-	for line in inf:
-
-		if line.startswith('!'):
-			# Ask a question
-			res = re.search(r'!\s*(?:\[(.*?)\])?\s*([^\s]+)\s*\((.*)\)\s*$', line)
-
-			if not res:
-				raise RuntimeError("Weird line: %s" % line)
-
-			cond = res.group(1)
-			if cond:
-				cond = CondParser(cond).parse()
-			varname = res.group(2)
-			vartype = res.group(3)
-
-			rules.append((varname, vartype, name, choices, cond))
-			name = ''
-			choices = []
-			continue
-
-		if line.startswith('@'):
-			# Add new line into the 'choices' array
-			res = re.match(r'@\s*(?:\[(.*?)\])?\s*"(.*?)"\s*(.*)$', line)
-
-			if not res:
-				raise RuntimeError("Bad line: %s" % line)
-
-			choices.append((res.group(2), res.group(3)))
-			continue
-
-		if line.startswith('%'):
-			# Name of the option
-			name = line[1:].strip()
-			continue
-
-		if line.startswith('#') or (line == '\n'):
-			# Comment or empty line
-			continue
-
-
-		raise RuntimeError("Unknown syntax: %s" % line)
-
-	inf.close()
-
-def yes_no(default):
-	"Return '*' if yes, ' ' if no"
-
-	if default == 'y':
-		return '*'
-
-	return ' '
-
-def subchoice(screen, name, choices, default):
-	"Return choice of choices"
-
-	maxkey = 0
-	for key, val in choices:
-		length = len(key)
-		if (length > maxkey):
-			maxkey = length
-
-	options = []
-	position = None
-	cnt = 0
-	for key, val in choices:
-		if (default) and (key == default):
-			position = cnt
-
-		options.append(" %-*s  %s " % (maxkey, key, val))
-		cnt += 1
-
-	(button, value) = xtui.choice_window(screen, name, 'Choose value', options, position)
-
-	if button == 'cancel':
-		return None
-
-	return choices[value][0]
-
-## Infer and verify configuration values.
-#
-# Augment @a config with values that can be inferred, purge invalid ones
-# and verify that all variables have a value (previously specified or inferred).
-#
-# @param config Configuration to work on
-# @param rules  Rules
-#
-# @return True if configuration is complete and valid, False
-#         otherwise.
-#
-def infer_verify_choices(config, rules):
-	"Infer and verify configuration values."
-
-	for rule in rules:
-		varname, vartype, name, choices, cond = rule
-
-		if cond and not cond.evaluate(config):
-			continue
-
-		if not varname in config:
-			value = None
-		else:
-			value = config[varname]
-
-		if not validate_rule_value(rule, value):
-			value = None
-
-		default = get_default_rule(rule)
-
-		#
-		# If we don't have a value but we do have
-		# a default, use it.
-		#
-		if value == None and default != None:
-			value = default
-			config[varname] = default
-
-		if not varname in config:
-			return False
-
-	return True
-
-## Fill the configuration with random (but valid) values.
-#
-# The random selection takes next rule and if the condition does
-# not violate existing configuration, random value of the variable
-# is selected.
-# This happens recursively as long as there are more rules.
-# If a conflict is found, we backtrack and try other settings of the
-# variable or ignoring the variable altogether.
-#
-# @param config Configuration to work on
-# @param rules  Rules
-# @param start_index With which rule to start (initial call must specify 0 here).
-# @return True if able to find a valid configuration
-def random_choices(config, rules, start_index):
-	"Fill the configuration with random (but valid) values."
-	if start_index >= len(rules):
-		return True
-
-	varname, vartype, name, choices, cond = rules[start_index]
-
-	# First check that this rule would make sense
-	if cond and not cond.evaluate(config):
-		return random_choices(config, rules, start_index + 1)
-
-	# Remember previous choices for backtracking
-	yes_no = 0
-	choices_indexes = range(0, len(choices))
-	random.shuffle(choices_indexes)
-
-	# Remember current configuration value
-	old_value = None
-	try:
-		old_value = config[varname]
-	except KeyError:
-		old_value = None
-
-	# For yes/no choices, we ran the loop at most 2 times, for select
-	# choices as many times as there are options.
-	try_counter = 0
-	while True:
-		if vartype == 'choice':
-			if try_counter >= len(choices_indexes):
-				break
-			value = choices[choices_indexes[try_counter]][0]
-		elif vartype == 'y' or vartype == 'n':
-			if try_counter > 0:
-				break
-			value = vartype
-		elif vartype == 'y/n' or vartype == 'n/y':
-			if try_counter == 0:
-				yes_no = random.randint(0, 1)
-			elif try_counter == 1:
-				yes_no = 1 - yes_no
-			else:
-				break
-			if yes_no == 0:
-				value = 'n'
-			else:
-				value = 'y'
-		else:
-			raise RuntimeError("Unknown variable type: %s" % vartype)
-
-		config[varname] = value
-
-		ok = random_choices(config, rules, start_index + 1)
-		if ok:
-			return True
-
-		try_counter = try_counter + 1
-
-	# Restore the old value and backtrack
-	# (need to delete to prevent "ghost" variables that do not exist under
-	# certain configurations)
-	config[varname] = old_value
-	if old_value is None:
-		del config[varname]
-
-	return random_choices(config, rules, start_index + 1)
-
-
-## Get default value from a rule.
-def get_default_rule(rule):
-	varname, vartype, name, choices, cond = rule
-
-	default = None
-
-	if vartype == 'choice':
-		# If there is just one option, use it
-		if len(choices) == 1:
-			default = choices[0][0]
-	elif vartype == 'y':
-		default = '*'
-	elif vartype == 'n':
-		default = 'n'
-	elif vartype == 'y/n':
-		default = 'y'
-	elif vartype == 'n/y':
-		default = 'n'
-	else:
-		raise RuntimeError("Unknown variable type: %s" % vartype)
-
-	return default
-
-## Get option from a rule.
-#
-# @param rule  Rule for a variable
-# @param value Current value of the variable
-#
-# @return Option (string) to ask or None which means not to ask.
-#
-def get_rule_option(rule, value):
-	varname, vartype, name, choices, cond = rule
-
-	option = None
-
-	if vartype == 'choice':
-		# If there is just one option, don't ask
-		if len(choices) != 1:
-			if (value == None):
-				option = "?     %s --> " % name
-			else:
-				option = "      %s [%s] --> " % (name, value)
-	elif vartype == 'y':
-		pass
-	elif vartype == 'n':
-		pass
-	elif vartype == 'y/n':
-		option = "  <%s> %s " % (yes_no(value), name)
-	elif vartype == 'n/y':
-		option ="  <%s> %s " % (yes_no(value), name)
-	else:
-		raise RuntimeError("Unknown variable type: %s" % vartype)
-
-	return option
-
-## Check if variable value is valid.
-#
-# @param rule  Rule for the variable
-# @param value Value of the variable
-#
-# @return True if valid, False if not valid.
-#
-def validate_rule_value(rule, value):
-	varname, vartype, name, choices, cond = rule
-
-	if value == None:
-		return True
-
-	if vartype == 'choice':
-		if not value in [choice[0] for choice in choices]:
-			return False
-	elif vartype == 'y':
-		if value != 'y':
-			return False
-	elif vartype == 'n':
-		if value != 'n':
-			return False
-	elif vartype == 'y/n':
-		if not value in ['y', 'n']:
-			return False
-	elif vartype == 'n/y':
-		if not value in ['y', 'n']:
-			return False
-	else:
-		raise RuntimeError("Unknown variable type: %s" % vartype)
-
-	return True
-
-def preprocess_config(config, rules):
-	"Preprocess configuration"
-
-	varname_mode = 'CONFIG_BFB_MODE'
-	varname_width = 'CONFIG_BFB_WIDTH'
-	varname_height = 'CONFIG_BFB_HEIGHT'
-
-	if varname_mode in config:
-		mode = config[varname_mode].partition('x')
-
-		config[varname_width] = mode[0]
-		rules.append((varname_width, 'choice', 'Default framebuffer width', None, None))
-
-		config[varname_height] = mode[2]
-		rules.append((varname_height, 'choice', 'Default framebuffer height', None, None))
-
-def create_output(mkname, mcname, config, rules):
-	"Create output configuration"
-
-	varname_strip = 'CONFIG_STRIP_REVISION_INFO'
-	strip_rev_info = (varname_strip in config) and (config[varname_strip] == 'y')
-
-	if strip_rev_info:
-		timestamp_unix = int(0)
-	else:
-		# TODO: Use commit timestamp instead of build time.
-		timestamp_unix = int(time.time())
-
-	timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp_unix))
-
-	sys.stderr.write("Fetching current revision identifier ... ")
-
-	try:
-		version = subprocess.Popen(['git', '-C', os.path.dirname(RULES_FILE), 'log', '-1', '--pretty=%h'], stdout = subprocess.PIPE).communicate()[0].decode().strip()
-		sys.stderr.write("ok\n")
-	except:
-		version = None
-		sys.stderr.write("failed\n")
-
-	if (not strip_rev_info) and (version is not None):
-		revision = version
-	else:
-		revision = None
-
-	outmk = open(mkname, 'w')
-	outmc = open(mcname, 'w')
-
-	outmk.write('#########################################\n')
-	outmk.write('## AUTO-GENERATED FILE, DO NOT EDIT!!! ##\n')
-	outmk.write('## Generated by: tools/config.py       ##\n')
-	outmk.write('#########################################\n\n')
-
-	outmc.write('/***************************************\n')
-	outmc.write(' * AUTO-GENERATED FILE, DO NOT EDIT!!! *\n')
-	outmc.write(' * Generated by: tools/config.py       *\n')
-	outmc.write(' ***************************************/\n\n')
-
-	defs = 'CONFIG_DEFS ='
-
-	for varname, vartype, name, choices, cond in rules:
-		if cond and not cond.evaluate(config):
-			continue
-
-		if not varname in config:
-			value = ''
-		else:
-			value = config[varname]
-			if (value == '*'):
-				value = 'y'
-
-		outmk.write('# %s\n%s = %s\n\n' % (name, varname, value))
-
-		if vartype in ["y", "n", "y/n", "n/y"]:
-			if value == "y":
-				outmc.write('/* %s */\n#define %s\n\n' % (name, varname))
-				defs += ' -D%s' % varname
-		else:
-			outmc.write('/* %s */\n#define %s %s\n#define %s_%s\n\n' % (name, varname, value, varname, value))
-			defs += ' -D%s=%s -D%s_%s' % (varname, value, varname, value)
-
-	if revision is not None:
-		outmk.write('REVISION = %s\n' % revision)
-		outmc.write('#define REVISION %s\n' % revision)
-		defs += ' "-DREVISION=%s"' % revision
-
-	outmk.write('TIMESTAMP_UNIX = %d\n' % timestamp_unix)
-	outmc.write('#define TIMESTAMP_UNIX %d\n' % timestamp_unix)
-	defs += ' "-DTIMESTAMP_UNIX=%d"' % timestamp_unix
-
-	outmk.write('TIMESTAMP = %s\n' % timestamp)
-	outmc.write('#define TIMESTAMP %s\n' % timestamp)
-	defs += ' "-DTIMESTAMP=%s"' % timestamp
-
-	outmk.write('%s\n' % defs)
-
-	outmk.close()
-	outmc.close()
-
-def sorted_dir(root):
-	list = os.listdir(root)
-	list.sort()
-	return list
-
-## Ask user to choose a configuration profile.
-#
-def choose_profile(root, fname, screen, config):
-	options = []
-	opt2path = {}
-	cnt = 0
-
-	# Look for profiles
-	for name in sorted_dir(root):
-		path = os.path.join(root, name)
-		canon = os.path.join(path, fname)
-
-		if os.path.isdir(path) and os.path.exists(canon) and os.path.isfile(canon):
-			subprofile = False
-
-			# Look for subprofiles
-			for subname in sorted_dir(path):
-				subpath = os.path.join(path, subname)
-				subcanon = os.path.join(subpath, fname)
-
-				if os.path.isdir(subpath) and os.path.exists(subcanon) and os.path.isfile(subcanon):
-					subprofile = True
-					options.append("%s (%s)" % (name, subname))
-					opt2path[cnt] = [name, subname]
-					cnt += 1
-
-			if not subprofile:
-				options.append(name)
-				opt2path[cnt] = [name]
-				cnt += 1
-
-	(button, value) = xtui.choice_window(screen, 'Load preconfigured defaults', 'Choose configuration profile', options, None)
-
-	if button == 'cancel':
-		return None
-
-	return opt2path[value]
-
-## Read presets from a configuration profile.
-#
-# @param profile Profile to load from (a list of string components)
-# @param config  Output configuration
-#
-def read_presets(profile, config):
-	path = os.path.join(PRESETS_DIR, profile[0], MAKEFILE)
-	read_config(path, config)
-
-	if len(profile) > 1:
-		path = os.path.join(PRESETS_DIR, profile[0], profile[1], MAKEFILE)
-		read_config(path, config)
-
-## Parse profile name (relative OS path) into a list of components.
-#
-# @param profile_name Relative path (using OS separator)
-# @return             List of components
-#
-def parse_profile_name(profile_name):
-	profile = []
-
-	head, tail = os.path.split(profile_name)
-	if head != '':
-		profile.append(head)
-
-	profile.append(tail)
-	return profile
-
-def main():
-	profile = None
-	config = {}
-	rules = []
-
-	# Parse rules file
-	parse_rules(RULES_FILE, rules)
-
-	if len(sys.argv) > ARGPOS_CHOICE:
-		choice = sys.argv[ARGPOS_CHOICE]
-	else:
-		choice = None
-
-	if len(sys.argv) > ARGPOS_PRESET:
-		preset = sys.argv[ARGPOS_PRESET]
-	else:
-		preset = None
-
-	mask_platform = (len(sys.argv) > ARGPOS_MASK_PLATFORM and sys.argv[ARGPOS_MASK_PLATFORM] == "--mask-platform")
-
-	# Input configuration file can be specified on command line
-	# otherwise configuration from previous run is used.
-	if preset is not None:
-		profile = parse_profile_name(preset)
-		read_presets(profile, config)
-	elif os.path.exists(MAKEFILE):
-		read_config(MAKEFILE, config)
-
-	# Default mode: check values and regenerate configuration files
-	if choice == 'default':
-		if (infer_verify_choices(config, rules)):
-			preprocess_config(config, rules)
-			create_output(MAKEFILE, MACROS, config, rules)
-			return 0
-
-	# Hands-off mode: check values and regenerate configuration files,
-	# but no interactive fallback
-	if choice == 'hands-off':
-		# We deliberately test this because we do not want
-		# to read implicitly any possible previous run configuration
-		if preset is None:
-			sys.stderr.write("Configuration error: No presets specified\n")
-			return 2
-
-		if (infer_verify_choices(config, rules)):
-			preprocess_config(config, rules)
-			create_output(MAKEFILE, MACROS, config, rules)
-			return 0
-
-		sys.stderr.write("Configuration error: The presets are ambiguous\n")
-		return 1
-
-	# Check mode: only check configuration
-	if choice == 'check':
-		if infer_verify_choices(config, rules):
-			return 0
-		return 1
-
-	# Random mode
-	if choice == 'random':
-		ok = random_choices(config, rules, 0)
-		if not ok:
-			sys.stderr.write("Internal error: unable to generate random config.\n")
-			return 2
-		if not infer_verify_choices(config, rules):
-			sys.stderr.write("Internal error: random configuration not consistent.\n")
-			return 2
-		preprocess_config(config, rules)
-		create_output(MAKEFILE, MACROS, config, rules)
-
-		return 0
-
-	screen = xtui.screen_init()
-	try:
-		selname = None
-		position = None
-		while True:
-
-			# Cancel out all values which have to be deduced
-			for varname, vartype, name, choices, cond in rules:
-				if (vartype == 'y') and (varname in config) and (config[varname] == '*'):
-					config[varname] = None
-
-			options = []
-			opt2row = {}
-			cnt = 0
-
-			if not mask_platform:
-				cnt += 1
-				options.append("  --- Load preconfigured defaults ... ")
-
-			for rule in rules:
-				varname, vartype, name, choices, cond = rule
-
-				if cond and not cond.evaluate(config):
-					continue
-
-				if mask_platform and (varname == "PLATFORM" or varname == "MACHINE" or varname == "COMPILER"):
-					rule = varname, vartype, "(locked) " + name, choices, cond
-
-				if varname == selname:
-					position = cnt
-
-				if not varname in config:
-					value = None
-				else:
-					value = config[varname]
-
-				if not validate_rule_value(rule, value):
-					value = None
-
-				default = get_default_rule(rule)
-
-				#
-				# If we don't have a value but we do have
-				# a default, use it.
-				#
-				if value == None and default != None:
-					value = default
-					config[varname] = default
-
-				option = get_rule_option(rule, value)
-				if option != None:
-					options.append(option)
-				else:
-					continue
-
-				opt2row[cnt] = (varname, vartype, name, choices)
-
-				cnt += 1
-
-			if (position != None) and (position >= len(options)):
-				position = None
-
-			(button, value) = xtui.choice_window(screen, 'HelenOS configuration', 'Choose configuration option', options, position)
-
-			if button == 'cancel':
-				return 'Configuration canceled'
-
-			if button == 'done':
-				if (infer_verify_choices(config, rules)):
-					break
-				else:
-					xtui.error_dialog(screen, 'Error', 'Some options have still undefined values. These options are marked with the "?" sign.')
-					continue
-
-			if value == 0 and not mask_platform:
-				profile = choose_profile(PRESETS_DIR, MAKEFILE, screen, config)
-				if profile != None:
-					read_presets(profile, config)
-				position = 1
-				continue
-
-			position = None
-			if not value in opt2row:
-				raise RuntimeError("Error selecting value: %s" % value)
-
-			(selname, seltype, name, choices) = opt2row[value]
-
-			if not selname in config:
-				value = None
-			else:
-				value = config[selname]
-
-			if mask_platform and (selname == "PLATFORM" or selname == "MACHINE" or selname == "COMPILER"):
-					continue
-
-			if seltype == 'choice':
-				config[selname] = subchoice(screen, name, choices, value)
-			elif (seltype == 'y/n') or (seltype == 'n/y'):
-				if config[selname] == 'y':
-					config[selname] = 'n'
-				else:
-					config[selname] = 'y'
-	finally:
-		xtui.screen_done(screen)
-
-	preprocess_config(config, rules)
-	create_output(MAKEFILE, MACROS, config, rules)
-	return 0
-
-if __name__ == '__main__':
-	sys.exit(main())
Index: ols/deploy/hikey960/fastboot
===================================================================
--- tools/deploy/hikey960/fastboot	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2021 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This script allows to deploy HelenOS conveniently to the HiKey 960 board
-# using the fastboot protocol. The fastboot mechanism is provided as a part
-# of the default UEFI firmware on HiKey 960.
-#
-# The implementation of the fastboot mechanism on HiKey 960 has several
-# quirks and this script tries to accommodate for them:
-#
-# * The boot image must be compressed by GZip. Uncompressed boot images are
-#   rejected.
-#
-# * The compressed boot image must end with a device tree blob (even if
-#   the device tree is not actually processed). A missing device tree blob
-#   crashes the fastboot mechanism.
-#
-# * A RAM disk must be included in the final fastboot image. A missing RAM
-#   disk crashes the fastboot mechanism. We use a fake blob for that purpose.
-
-check_error() {
-	if [ "$1" -ne "0" ] ; then
-		echo
-		echo "Error: $2"
-
-		exit 1
-	fi
-}
-
-SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
-
-if [ "$#" -lt "1" ] ; then
-	echo "Usage: $0 <image.boot>"
-	exit 2
-fi
-
-IMAGE="$1"
-IMAGE_GZ="${IMAGE}.gz"
-IMAGE_GZ_DTB="${IMAGE_GZ}+dtb"
-IMAGE_FASTBOOT="${IMAGE}.fastboot"
-
-if [ ! -f "${IMAGE}" ] ; then
-	echo "Error: ${IMAGE} is not a file"
-	exit 3
-fi
-
-# Compress the image
-gzip -c "${IMAGE}" > "${IMAGE_GZ}"
-check_error $? "Compressing ${IMAGE}"
-
-# Append the DTB
-cat "${IMAGE_GZ}" "${SCRIPT_DIR}/hi3660-hikey960.dtb" > "${IMAGE_GZ_DTB}"
-check_error $? "Appending DTB to ${IMAGE_GZ}"
-
-# Create the fastboot image with a fake "RAM disk"
-"${SCRIPT_DIR}/mkfastboot" --kernel ${IMAGE_GZ_DTB} --ramdisk "${SCRIPT_DIR}/hikey960.rd" --base 0x0 --tags-addr 0x07a00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07c00000 --output "${IMAGE_FASTBOOT}"
-check_error $? "Converting ${IMAGE_GZ_DTB} to a fastboot image"
-
-# Deploy the fastboot image on a HiKey 960 board connected to the host machine
-fastboot boot "${IMAGE_FASTBOOT}"
-check_error $? "Deploying ${IMAGE_FASTBOOT}"
Index: ols/deploy/hikey960/hikey960.rd
===================================================================
--- tools/deploy/hikey960/hikey960.rd	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Index: ols/deploy/hikey960/mkfastboot
===================================================================
--- tools/deploy/hikey960/mkfastboot	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-#!/usr/bin/env python
-
-# Copyright 2015, The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from __future__ import print_function
-from sys import argv, exit, stderr
-from argparse import ArgumentParser, FileType, Action
-from os import fstat
-from struct import pack
-from hashlib import sha1
-import sys
-import re
-
-def filesize(f):
-    if f is None:
-        return 0
-    try:
-        return fstat(f.fileno()).st_size
-    except OSError:
-        return 0
-
-def update_sha(sha, f):
-    if f:
-        sha.update(f.read())
-        f.seek(0)
-        sha.update(pack('I', filesize(f)))
-    else:
-        sha.update(pack('I', 0))
-
-def pad_file(f, padding):
-    pad = (padding - (f.tell() & (padding - 1))) & (padding - 1)
-    f.write(pack(str(pad) + 'x'))
-
-def write_header(args):
-    BOOT_MAGIC = 'ANDROID!'.encode()
-    dt_addr = args.tags_addr
-
-    if 0 == dt_addr:
-        dt_addr = args.base + args.tags_offset
-
-    args.output.write(pack('8s', BOOT_MAGIC))
-    args.output.write(pack('10I',
-        filesize(args.kernel),                          # size in bytes
-        args.base + args.kernel_offset,                 # physical load addr
-        filesize(args.ramdisk),                         # size in bytes
-        args.base + args.ramdisk_offset,                # physical load addr
-        filesize(args.second),                          # size in bytes
-        args.base + args.second_offset,                 # physical load addr
-        dt_addr,                                        # physical addr for kernel tags
-        args.pagesize,                                  # flash page size we assume
-        0,                                              # future expansion: MUST be 0
-        (args.os_version << 11) | args.os_patch_level)) # os version and patch level
-    args.output.write(pack('16s', args.board.encode())) # asciiz product name
-    args.output.write(pack('512s', args.cmdline[:512].encode()))
-
-    sha = sha1()
-    update_sha(sha, args.kernel)
-    update_sha(sha, args.ramdisk)
-    update_sha(sha, args.second)
-    img_id = pack('32s', sha.digest())
-
-    args.output.write(img_id)
-    args.output.write(pack('1024s', args.cmdline[512:].encode()))
-    pad_file(args.output, args.pagesize)
-
-    return img_id
-
-class ValidateStrLenAction(Action):
-    def __init__(self, option_strings, dest, nargs=None, **kwargs):
-        if 'maxlen' not in kwargs:
-            raise ValueError('maxlen must be set')
-
-        self.maxlen = int(kwargs['maxlen'])
-        del kwargs['maxlen']
-        super(ValidateStrLenAction, self).__init__(option_strings, dest, **kwargs)
-
-    def __call__(self, parser, namespace, values, option_string=None):
-        if len(values) > self.maxlen:
-            raise ValueError('String argument too long: max {0:d}, got {1:d}'.
-                format(self.maxlen, len(values)))
-        setattr(namespace, self.dest, values)
-
-def write_padded_file(f_out, f_in, padding):
-    if f_in is None:
-        return
-
-    f_out.write(f_in.read())
-    pad_file(f_out, padding)
-
-def parse_int(x):
-    return int(x, 0)
-
-def parse_os_version(x):
-    match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)
-    if match:
-        a = int(match.group(1))
-        b = 0
-        c = 0
-
-        if match.lastindex >= 2:
-            b = int(match.group(2))
-
-        if match.lastindex == 3:
-            c = int(match.group(3))
-
-        # 7 bits allocated for each field
-        assert a < 128
-        assert b < 128
-        assert c < 128
-        return (a << 14) | (b << 7) | c
-
-    return 0
-
-def parse_os_patch_level(x):
-    match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x)
-    if match:
-        y = int(match.group(1)) - 2000
-        m = int(match.group(2))
-
-        # 7 bits allocated for the year, 4 bits for the month
-        assert y >= 0 and y < 128
-        assert m > 0 and m <= 12
-        return (y << 4) | m
-
-    return 0
-
-def parse_cmdline():
-    parser = ArgumentParser()
-    parser.add_argument('--kernel', help='path to the kernel', type=FileType('rb'),
-                        required=True)
-    parser.add_argument('--ramdisk', help='path to the ramdisk', type=FileType('rb'))
-    parser.add_argument('--second', help='path to the 2nd bootloader', type=FileType('rb'))
-    parser.add_argument('--cmdline', help='extra arguments to be passed on the '
-                        'kernel command line', default='', action=ValidateStrLenAction, maxlen=1536)
-    parser.add_argument('--base', help='base address', type=parse_int, default=0x10000000)
-    parser.add_argument('--tags-addr', help='tags addr', type=parse_int, default=0x0)
-    parser.add_argument('--kernel_offset', help='kernel offset', type=parse_int, default=0x00008000)
-    parser.add_argument('--ramdisk_offset', help='ramdisk offset', type=parse_int, default=0x01000000)
-    parser.add_argument('--second_offset', help='2nd bootloader offset', type=parse_int,
-                        default=0x00f00000)
-    parser.add_argument('--os_version', help='operating system version', type=parse_os_version,
-                        default=0)
-    parser.add_argument('--os_patch_level', help='operating system patch level',
-                        type=parse_os_patch_level, default=0)
-    parser.add_argument('--tags_offset', help='tags offset', type=parse_int, default=0x00000100)
-    parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction,
-                        maxlen=16)
-    parser.add_argument('--pagesize', help='page size', type=parse_int,
-                        choices=[2**i for i in range(11,15)], default=2048)
-    parser.add_argument('--id', help='print the image ID on standard output',
-                        action='store_true')
-    parser.add_argument('-o', '--output', help='output file name', type=FileType('wb'),
-                        required=True)
-    return parser.parse_args()
-
-def write_data(args):
-    write_padded_file(args.output, args.kernel, args.pagesize)
-    write_padded_file(args.output, args.ramdisk, args.pagesize)
-    write_padded_file(args.output, args.second, args.pagesize)
-
-def main():
-    args = parse_cmdline()
-    img_id = write_header(args)
-    write_data(args)
-    if args.id:
-        if isinstance(img_id, str):
-            # Python 2's struct.pack returns a string, but py3 returns bytes.
-            img_id = [ord(x) for x in img_id]
-
-        print('0x' + ''.join('{:02x}'.format(c) for c in img_id))
-
-if __name__ == '__main__':
-    main()
Index: ols/ew.py
===================================================================
--- tools/ew.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,564 +1,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (c) 2013 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-"""
-Emulator wrapper for running HelenOS
-"""
-
-import inspect
-import os
-import platform
-import re
-import subprocess
-import sys
-import _thread
-import time
-
-overrides = {}
-
-CONFIG = 'Makefile.config'
-
-TOOLS_DIR = os.path.dirname(inspect.getabsfile(inspect.currentframe()))
-
-def read_config():
-	"Read HelenOS build configuration"
-
-	inf = open(CONFIG, 'r')
-	config = {}
-
-	for line in inf:
-		res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
-		if (res):
-			config[res.group(1)] = res.group(2)
-
-	inf.close()
-	return config
-
-def is_override(str):
-	if str in overrides.keys():
-		return overrides[str]
-	return False
-
-def cfg_get(platform, machine, processor):
-	if machine == "" or "run" in emulators[platform]:
-		return emulators[platform]
-	elif processor == "" or "run" in emulators[platform][machine]:
-		return emulators[platform][machine]
-	else:
-		return emulators[platform][machine][processor]
-
-def termemu_detect():
-	emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
-	for termemu in emus:
-		try:
-			subprocess.check_output('which ' + termemu, shell = True, stderr = subprocess.STDOUT)
-			return termemu
-		except:
-			pass
-
-	print('Could not find any of the terminal emulators %s.'%(emus))
-	sys.exit(1)
-
-def run_in_console(cmd, title):
-	temu = termemu_detect()
-	if temu == 'gnome-terminal':
-		cmdline = temu + ' -- ' + cmd
-	else:
-		ecmd = cmd.replace('"', '\\"')
-		cmdline = temu + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
-
-	print(cmdline)
-	if not is_override('dryrun'):
-		subprocess.call(cmdline, shell = True)
-
-def get_host_native_width():
-	return int(platform.architecture()[0].strip('bit'))
-
-def pc_options(guest_width):
-	opts = ''
-
-	# Do not enable KVM if running 64 bits HelenOS
-	# on 32 bits host
-	host_width = get_host_native_width()
-	if guest_width <= host_width and not is_override('nokvm'):
-		opts = opts + ' -enable-kvm'
-
-	# Remove the leading space
-	return opts[1:]
-
-def malta_options():
-	return '-cpu 4Kc -append "console=devices/\\hw\\pci0\\00:0a.0\\com1\\a"'
-
-def find_firmware(name, environ_var, default_paths, extra_info=None):
-	"""Find firmware image(s)."""
-
-	if environ_var in os.environ:
-		return os.environ[environ_var]
-
-	for path in default_paths:
-		if os.path.exists(path):
-			return path
-
-	sys.stderr.write("Cannot find %s binary image(s)!\n" % name)
-	sys.stderr.write(
-	    "Either set %s environment variable accordingly or place the image(s) in one of the default locations: %s.\n" %
-	    (environ_var, ", ".join(default_paths)))
-	if extra_info is not None:
-		sys.stderr.write(extra_info)
-	return None
-
-def platform_to_qemu_options(platform, machine, processor):
-	if platform == 'amd64':
-		return 'system-x86_64', pc_options(64)
-	elif platform == 'arm32':
-		if machine == 'integratorcp':
-			return 'system-arm', '-M integratorcp'
-		elif machine == 'raspberrypi':
-			return 'system-arm', '-M raspi1ap'
-	elif platform == 'arm64':
-		if machine == 'virt':
-			# Search for the EDK2 firmware image
-			default_paths = (
-				'/usr/local/qemu-efi-aarch64/QEMU_EFI.fd', # Custom
-				'/usr/share/edk2/aarch64/QEMU_EFI.fd',     # Fedora
-				'/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', # Ubuntu
-			)
-			extra_info = ("Pre-compiled binary can be obtained from "
-			    "http://snapshots.linaro.org/components/kernel/leg-virt-tianocore-edk2-upstream/latest/QEMU-AARCH64/RELEASE_GCC5/QEMU_EFI.fd.\n")
-			efi_path = find_firmware(
-			    "EDK2", 'EW_QEMU_EFI_AARCH64', default_paths, extra_info)
-			if efi_path is None:
-				raise Exception
-
-			return 'system-aarch64', \
-			    '-M virt -cpu cortex-a57 -m 1024 -bios %s' % efi_path
-	elif platform == 'ia32':
-		return 'system-i386', pc_options(32)
-	elif platform == 'mips32':
-		if machine == 'lmalta':
-			return 'system-mipsel', malta_options()
-		elif machine == 'bmalta':
-			return 'system-mips', malta_options()
-	elif platform == 'ppc32':
-		return 'system-ppc', '-m 256'
-	elif platform == 'sparc64':
-		if machine != 'generic':
-			raise Exception
-		if processor == 'us':
-			cmdline = '-M sun4u'
-			if is_override('nographic'):
-			    cmdline += ' --prom-env boot-args="console=devices/\\hw\\pci0\\01:01.0\\com1\\a"'
-			return 'system-sparc64', cmdline
-
-		# processor = 'sun4v'
-		opensparc_bins = find_firmware(
-		    "OpenSPARC", 'OPENSPARC_BINARIES',
-		    ('/usr/local/opensparc/image/', ))
-		if opensparc_bins is None:
-			raise Exception
-
-		return 'system-sparc64', '-M niagara -m 256 -L %s' % (opensparc_bins)
-
-
-def hdisk_mk():
-	if not os.path.exists('hdisk.img'):
-		subprocess.call(TOOLS_DIR + '/mkfat.py 1048576 dist/data hdisk.img', shell = True)
-
-def qemu_bd_options():
-	if is_override('nohdd'):
-		return ''
-
-	hdisk_mk()
-
-	hdd_options = ''
-	if 'hdd' in overrides.keys():
-		if 'ata' in overrides['hdd'].keys():
-			hdd_options += ''
-		elif 'virtio-blk' in overrides['hdd'].keys():
-			hdd_options += ',if=virtio'
-
-	return ' -drive file=hdisk.img,index=0,media=disk,format=raw' + hdd_options
-
-def qemu_nic_ne2k_options():
-	return ' -device ne2k_isa,irq=5,netdev=n1'
-
-def qemu_nic_e1k_options():
-	return ' -device e1000,netdev=n1'
-
-def qemu_nic_rtl8139_options():
-	return ' -device rtl8139,netdev=n1'
-
-def qemu_nic_virtio_options():
-	return ' -device virtio-net,netdev=n1'
-
-def qemu_net_options():
-	if is_override('nonet'):
-		return ''
-
-	nic_options = ''
-	if 'net' in overrides.keys():
-		if 'e1k' in overrides['net'].keys():
-			nic_options += qemu_nic_e1k_options()
-		if 'rtl8139' in overrides['net'].keys():
-			nic_options += qemu_nic_rtl8139_options()
-		if 'ne2k' in overrides['net'].keys():
-			nic_options += qemu_nic_ne2k_options()
-		if 'virtio-net' in overrides['net'].keys():
-			nic_options += qemu_nic_virtio_options()
-	else:
-		# Use the default NIC
-		nic_options += qemu_nic_e1k_options()
-
-	return nic_options + ' -netdev user,id=n1,hostfwd=udp::8080-:8080,hostfwd=udp::8081-:8081,hostfwd=tcp::8080-:8080,hostfwd=tcp::8081-:8081,hostfwd=tcp::2223-:2223'
-
-def qemu_usb_options():
-	if is_override('nousb'):
-		return ''
-	return ' -usb'
-
-def qemu_xhci_options():
-	if is_override('noxhci'):
-		return ''
-	return ' -device nec-usb-xhci,id=xhci'
-
-def qemu_tablet_options():
-	if is_override('notablet') or (is_override('nousb') and is_override('noxhci')):
-		return ''
-	return ' -device usb-tablet'
-
-def qemu_audio_options():
-	if is_override('nosnd'):
-		return ''
-	return ' -device intel-hda -device hda-duplex'
-
-def qemu_run(platform, machine, processor):
-	cfg = cfg_get(platform, machine, processor)
-	suffix, options = platform_to_qemu_options(platform, machine, processor)
-	cmd = 'qemu-' + suffix
-
-	cmdline = cmd
-	if 'qemu_path' in overrides.keys():
-		cmdline = overrides['qemu_path'] + cmd
-
-	if options != '':
-		cmdline += ' ' + options
-
-	if (not 'hdd' in cfg.keys() or cfg['hdd']):
-		cmdline += qemu_bd_options()
-	if (not 'net' in cfg.keys()) or cfg['net']:
-		cmdline += qemu_net_options()
-	if (not 'usb' in cfg.keys()) or cfg['usb']:
-		cmdline += qemu_usb_options()
-	if (not 'xhci' in cfg.keys()) or cfg['xhci']:
-		cmdline += qemu_xhci_options()
-	if (not 'tablet' in cfg.keys()) or cfg['tablet']:
-		cmdline += qemu_tablet_options()
-	if (not 'audio' in cfg.keys()) or cfg['audio']:
-		cmdline += qemu_audio_options()
-
-	console = ('console' in cfg.keys() and cfg['console'])
-
-	if (is_override('nographic')):
-		cmdline += ' -nographic'
-		console = True
-
-	if (not console and (not is_override('nographic')) and not is_override('noserial')):
-		cmdline += ' -serial stdio'
-
-	if (is_override('bigmem')):
-		cmdline += ' -m 4G'
-
-	if cfg['image'] == 'image.iso':
-		cmdline += ' -boot d -cdrom image.iso'
-	elif cfg['image'] == 'image.iso@arm64':
-		# Define image.iso cdrom backend.
-		cmdline += ' -drive if=none,file=image.iso,id=cdrom,media=cdrom'
-		# Define scsi bus.
-		cmdline += ' -device virtio-scsi-device'
-		# Define cdrom frontend connected to this scsi bus.
-		cmdline += ' -device scsi-cd,drive=cdrom'
-	elif cfg['image'] == 'image.boot':
-		cmdline += ' -kernel image.boot'
-	elif cfg['image'] == 'kernel.img@rpi':
-		cmdline += ' -bios boot/image.boot.bin'
-	else:
-		cmdline += ' ' + cfg['image']
-
-	if console:
-		cmdline += ' -nographic'
-
-		title = 'HelenOS/' + platform
-		if machine != '':
-			title += ' on ' + machine
-		if 'expect' in cfg.keys():
-			cmdline = 'expect -c \'spawn %s; expect "%s" { send "%s" } timeout exp_continue; interact\'' % (cmdline, cfg['expect']['src'], cfg['expect']['dst'])
-		run_in_console(cmdline, title)
-	else:
-		print(cmdline)
-		if not is_override('dryrun'):
-			subprocess.call(cmdline, shell = True)
-
-def ski_run(platform, machine, processor):
-	run_in_console('ski -i ' + TOOLS_DIR + '/conf/ski.conf', 'HelenOS/ia64 on ski')
-
-def msim_run(platform, machine, processor):
-	hdisk_mk()
-	run_in_console('msim -n -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
-
-def spike_run(platform, machine, processor):
-	run_in_console('spike -m1073741824:1073741824 image.boot', 'HelenOS/risvc64 on Spike')
-
-emulators = {
-	'amd64' : {
-		'run' : qemu_run,
-		'image' : 'image.iso'
-	},
-	'arm32' : {
-		'integratorcp' : {
-			'run' : qemu_run,
-			'image' : 'image.boot',
-			'net' : False,
-			'audio' : False,
-			'xhci' : False,
-			'tablet' : False
-		},
-		'raspberrypi' : {
-			'run' : qemu_run,
-			'image' : 'kernel.img@rpi',
-			'audio' : False,
-			'console' : True,
-			'hdd' : False,
-			'net' : False,
-			'tablet' : False,
-			'usb' : False,
-			'xhci' : False
-		},
-	},
-	'arm64' : {
-		'virt' : {
-			'run' : qemu_run,
-			'image' : 'image.iso@arm64',
-			'audio' : False,
-			'console' : True,
-			'hdd' : False,
-			'net' : False,
-			'tablet' : False,
-			'usb' : False,
-			'xhci' : False
-		}
-	},
-	'ia32' : {
-		'run' : qemu_run,
-		'image' : 'image.iso'
-	},
-	'ia64' : {
-		'ski' : {
-			'run' : ski_run
-		}
-	},
-	'mips32' : {
-		'msim' : {
-			'run' : msim_run
-		},
-		'lmalta' : {
-			'run' : qemu_run,
-			'image' : 'image.boot',
-			'console' : True
-		},
-		'bmalta' : {
-			'run' : qemu_run,
-			'image' : 'image.boot',
-			'console' : True
-		},
-	},
-	'ppc32' : {
-		'run' : qemu_run,
-		'image' : 'image.iso',
-		'audio' : False
-	},
-	'riscv64' : {
-		'run' : spike_run,
-		'image' : 'image.boot'
-	},
-	'sparc64' : {
-		'generic' : {
-			'us' : {
-				'run' : qemu_run,
-				'image' : 'image.iso',
-				'audio' : False,
-				'console' : False,
-				'net' : False,
-				'usb' : False,
-				'xhci' : False,
-				'tablet' : False
-			},
-			'sun4v' : {
-				'run' : qemu_run,
-				# QEMU 8.0.0 ignores the 'file' argument and instead uses 'id',
-				# which defaults to 'pflash0', but can be changed to the same value
-				# as 'file'
-				'image' : '-drive if=pflash,id=image.iso,readonly=on,file=image.iso',
-				'audio' : False,
-				'console' : True,
-				'net' : False,
-				'usb' : False,
-				'xhci' : False,
-				'tablet' : False,
-				'expect' : {
-					'src' : 'ok ',
-					'dst' : 'boot\n'
-				},
-			}
-		}
-	},
-}
-
-def usage():
-	print("%s - emulator wrapper for running HelenOS\n" % os.path.basename(sys.argv[0]))
-	print("%s [-d] [-h] [-net e1k|rtl8139|ne2k|virtio-net] [-hdd ata|virtio-blk] [-nohdd] [-nokvm] [-nonet] [-nosnd] [-nousb] [-noxhci] [-notablet]\n" %
-	    os.path.basename(sys.argv[0]))
-	print("-d\tDry run: do not run the emulation, just print the command line.")
-	print("-h\tPrint the usage information and exit.")
-	print("-nohdd\tDisable hard disk, if applicable.")
-	print("-nokvm\tDisable KVM, if applicable.")
-	print("-nonet\tDisable networking support, if applicable.")
-	print("-nosnd\tDisable sound, if applicable.")
-	print("-nousb\tDisable USB support, if applicable.")
-	print("-noxhci\tDisable XHCI support, if applicable.")
-	print("-notablet\tDisable USB tablet (use only relative-position PS/2 mouse instead), if applicable.")
-	print("-nographic\tDisable graphical output. Serial port output must be enabled for this to be useful.")
-	print("-noserial\tDisable serial port output in the terminal.")
-	print("-bigmem\tSets maximum RAM size to 4GB.")
-
-def fail(platform, machine):
-	print("Cannot start emulation for the chosen configuration. (%s/%s)" % (platform, machine))
-
-
-def run():
-	expect_nic = False
-	expect_hdd = False
-	expect_qemu = False
-
-	for i in range(1, len(sys.argv)):
-
-		if expect_nic:
-			expect_nic = False
-			if not 'net' in overrides.keys():
-				overrides['net'] = {}
-			if sys.argv[i] == 'e1k':
-				overrides['net']['e1k'] = True
-			elif sys.argv[i] == 'rtl8139':
-				overrides['net']['rtl8139'] = True
-			elif sys.argv[i] == 'ne2k':
-				overrides['net']['ne2k'] = True
-			elif sys.argv[i] == 'virtio-net':
-				overrides['net']['virtio-net'] = True
-			else:
-				usage()
-				exit()
-			continue
-
-		if expect_hdd:
-			expect_hdd = False
-			if not 'hdd' in overrides.keys():
-				overrides['hdd'] = {}
-			if sys.argv[i] == 'ata':
-				overrides['hdd']['ata'] = True
-			elif sys.argv[i] == 'virtio-blk':
-				overrides['hdd']['virtio-blk'] = True
-			else:
-				usage()
-				exit()
-			continue
-
-		if expect_qemu:
-			expect_qemu = False
-			overrides['qemu_path'] = sys.argv[i]
-
-		elif sys.argv[i] == '-h':
-			usage()
-			exit()
-		elif sys.argv[i] == '-d':
-			overrides['dryrun'] = True
-		elif sys.argv[i] == '-net' and i < len(sys.argv) - 1:
-			expect_nic = True
-		elif sys.argv[i] == '-hdd' and i < len(sys.argv) - 1:
-			expect_hdd = True
-		elif sys.argv[i] == '-nohdd':
-			overrides['nohdd'] = True
-		elif sys.argv[i] == '-nokvm':
-			overrides['nokvm'] = True
-		elif sys.argv[i] == '-nonet':
-			overrides['nonet'] = True
-		elif sys.argv[i] == '-nosnd':
-			overrides['nosnd'] = True
-		elif sys.argv[i] == '-nousb':
-			overrides['nousb'] = True
-		elif sys.argv[i] == '-noxhci':
-			overrides['noxhci'] = True
-		elif sys.argv[i] == '-notablet':
-			overrides['notablet'] = True
-		elif sys.argv[i] == '-nographic':
-			overrides['nographic'] = True
-		elif sys.argv[i] == '-bigmem':
-			overrides['bigmem'] = True
-		elif sys.argv[i] == '-noserial':
-			overrides['noserial'] = True
-		elif sys.argv[i] == '-qemu_path' and i < len(sys.argv) - 1:
-			expect_qemu = True
-		else:
-			usage()
-			exit()
-
-	config = read_config()
-
-	if 'PLATFORM' in config.keys():
-		platform = config['PLATFORM']
-	else:
-		platform = ''
-
-	if 'MACHINE' in config.keys():
-		mach = config['MACHINE']
-	else:
-		mach = ''
-
-	if 'PROCESSOR' in config.keys():
-		processor = config['PROCESSOR']
-	else:
-		processor = ''
-
-	try:
-		emu_run = cfg_get(platform, mach, processor)['run']
-		emu_run(platform, mach, processor)
-	except:
-		fail(platform, mach)
-		return
-
-run()
Index: ols/export.sh
===================================================================
--- tools/export.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-if [ "$#" -ne 1 ]; then
-	echo "Must define export directory."
-	exit 1
-fi
-
-EXPORT_DIR="$1"
-
-# Only (re)build files we actually want to export.
-
-EXPORT_LIBS=" \
-	uspace/lib/c/libstartfiles.a \
-	uspace/lib/libclui.a \
-	uspace/lib/libc.a \
-	uspace/lib/libcongfx.a \
-	uspace/lib/libconsole.a \
-	uspace/lib/libcpp.a \
-	uspace/lib/libdisplay.a \
-	uspace/lib/libgfx.a \
-	uspace/lib/libgfxfont.a \
-	uspace/lib/libgfximage.a \
-	uspace/lib/libinput.a \
-	uspace/lib/libhound.a \
-	uspace/lib/libipcgfx.a \
-	uspace/lib/libmath.a \
-	uspace/lib/libmemgfx.a \
-	uspace/lib/liboutput.a \
-	uspace/lib/libpcm.a \
-	uspace/lib/libpixconv.a \
-	uspace/lib/libposix.a \
-	uspace/lib/libriff.a \
-	uspace/lib/libui.a \
-"
-
-EXPORT_CONFIGS=" \
-	meson/part/exports/config.mk \
-	meson/part/exports/config.sh \
-"
-
-ninja $EXPORT_LIBS $EXPORT_CONFIGS
-ninja devel-headers
-
-#
-# Meson may produce thin archives. These cannot be simply copied to another
-# location. Copy them using ar instead, converting them to regular,
-# non-thin archives in the process.
-#
-mkdir -p "$EXPORT_DIR/lib"
-for lpath in $EXPORT_LIBS; do
-	dest="$EXPORT_DIR/lib/$(basename $lpath)"
-	ar -t $lpath | xargs ar crs $dest
-done
-
-rm -rf "$EXPORT_DIR/include"
-cp -R dist/include "$EXPORT_DIR/include"
-cp -t "$EXPORT_DIR" $EXPORT_CONFIGS
Index: ols/filldir.py
===================================================================
--- tools/filldir.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-Fill a directory with N empty directories
-"""
-
-import sys
-import os
-import os.path
-
-if len(sys.argv) < 3:
-	print('Usage: filldir <parent-dir> <count>')
-	exit(2)
-
-parent = sys.argv[1]
-num = int(sys.argv[2])
-
-i = 0
-while i < num:
-	name = hex(i)[2:].zfill(5)
-	path = os.path.join(parent, name)
-	os.mkdir(path)
-	i += 1
Index: ols/gentestfile.py
===================================================================
--- tools/gentestfile.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-Generate a file to be used by app/testread
-"""
-
-import struct
-import sys
-
-if len(sys.argv) < 2:
-	print("Usage: gentestfile.py <count of 64-bit numbers to output>")
-	exit()
-
-m = int(sys.argv[1])
-i = 0
-pow_2_64 = 2 ** 64
-st = struct.Struct('<Q')
-while i < m:
-	sys.stdout.write(st.pack(i))
-	i = (i + 1) % pow_2_64
-
Index: ols/grub/getimage.sh
===================================================================
--- tools/grub/getimage.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Fake xorriso utility for extracting El Torrito boot image passed to it
-# by the caller
-#
-
-while [ ."$1" != . ] ; do
-	if [ ."$1" == .-b ] ; then
-		shift 1
-		image="$1"
-		output=pc.img
-	elif [ ."$1" == .--efi-boot ] ; then
-		shift 1
-		image="$1"
-		output=efi.img
-	elif [ ."$1" == .-r ] ; then
-		shift 1
-		root="$1"
-	fi
-	shift 1
-done
-
-echo image is "$root/$image"
-cp "$root/$image" "$output"
Index: ols/grub/grub-update.sh
===================================================================
--- tools/grub/grub-update.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Script to generate/update prebuilt Grub2 in HelenOS source tree
-# Be sure you know what you are doing!
-#
-
-origdir="$(cd "$(dirname "$0")" && pwd)"
-helenosdir="$origdir/../.."
-workdir="$origdir/grub-src"
-builddir="$origdir/grub-build"
-git_repo="git://git.savannah.gnu.org/grub.git"
-grub_rev="bc220962e366b1b46769ed6f9fa5be603ba58ab5"
-
-build_ia32amd64_pc=false
-build_ia32amd64_efi=false
-build_arm64_efi=false
-
-function grub_build()
-{
-	platform="$1"
-	conf_target="$2"
-	conf_platform="$3"
-
-	./configure --prefix="$builddir/$platform" --target="$conf_target" --with-platform="$conf_platform" --disable-werror || exit 1
-	make clean || exit 1
-	make install || exit 1
-}
-
-function grub_files_update()
-{
-	gdir="$1"
-	platform="$2"
-
-	echo "$grub_rev" > "$helenosdir"/boot/grub/"$gdir"/REVISION || exit 1
-	rm -rf "$helenosdir"/boot/grub/"$gdir"/"$platform" || exit 1
-	cp -R "$builddir"/"$platform"/lib*/grub/"$platform" "$helenosdir"/boot/grub/"$gdir" || exit 1
-	rm -f "$helenosdir"/boot/grub/"$gdir"/"$platform"/*.image || exit 1
-	rm -f "$helenosdir"/boot/grub/"$gdir"/"$platform"/*.module || exit 1
-	git add "$helenosdir"/boot/grub/"$gdir"/"$platform" || exit 1
-}
-
-function show_usage()
-{
-	echo "Script to generate/update prebuild Grub2 in HelenOS source tree"
-	echo
-	echo "Syntax:"
-	echo " $0 <target>"
-	echo
-	echo "Possible targets are:"
-	echo " ia32+amd64-pc"
-	echo " ia32+amd64-efi"
-	echo " arm64-efi"
-	echo " all             build all targets"
-	echo
-
-	exit 3
-}
-
-if [ "$#" -ne "1" ] ; then
-	show_usage
-fi
-
-case "$1" in
-	ia32+amd64-pc)
-		build_ia32amd64_pc=true
-		;;
-	ia32+amd64-efi)
-		build_ia32amd64_efi=true
-		;;
-	arm64-efi)
-		build_arm64_efi=true
-		;;
-	all)
-		build_ia32amd64_pc=true
-		build_ia32amd64_efi=true
-		build_arm64_efi=true
-		;;
-	*)
-		show_usage
-		;;
-esac
-
-# Prepare a clone of Grub2 repo
-if [ ! -d "$workdir" ] ; then
-	rm -rf "$workdir" "$builddir" || exit 1
-	git clone "$git_repo" "$workdir" || exit 1
-fi
-
-cd "$workdir" || exit 1
-git pull || exit 1
-git reset --hard "$grub_rev" || exit 1
-
-./autogen.sh || exit 1
-
-if $build_ia32amd64_pc ; then
-	cd "$workdir" || exit 1
-	grub_build i386-pc i386 pc
-
-	# Extract El Torrito boot image for i386-pc
-	cd "$helenosdir"/boot/grub/ia32-pc || exit 1
-	rm -f pc.img || exit 1
-	"$builddir"/i386-pc/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
-
-	grub_files_update ia32-pc i386-pc
-fi
-
-if $build_ia32amd64_efi ; then
-	cd "$workdir" || exit 1
-
-	# Build each platform to a different directory
-	grub_build i386-efi i386 efi
-	grub_build x86_64-efi x86_64 efi
-
-	# Extract El Torrito boot image for i386-efi
-	cd "$helenosdir"/boot/grub/ia32-efi || exit 1
-	rm -f efi.img.gz || exit 1
-	"$builddir"/i386-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
-	mv efi.img i386-efi.img
-
-	# Extract El Torrito boot image for x86_64-efi
-	cd "$helenosdir"/boot/grub/ia32-efi || exit 1
-	rm -f efi.img.gz || exit 1
-	"$builddir"/x86_64-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
-
-	# Combine El Torrito boot images for x86_64-efi and i386-efi
-	mkdir tmp || exit 1
-	mcopy -ns -i i386-efi.img ::efi tmp || exit 1
-	mcopy -s -i efi.img tmp/* :: || exit 1
-	gzip efi.img || exit 1
-	rm -rf tmp || exit 1
-	rm -f i386-efi.img || exit 1
-
-	# Update Grub files for all platforms
-	grub_files_update ia32-efi i386-efi
-	grub_files_update ia32-efi x86_64-efi
-fi
-
-if $build_arm64_efi ; then
-	cd "$workdir" || exit 1
-
-	# Check that the expected compiler is present on PATH
-	if ! [ -x "$(command -v aarch64-linux-gnu-gcc)" ] ; then
-		echo "Error: aarch64-linux-gnu-gcc is missing" >&2
-		exit 1
-	fi
-
-	grub_build arm64-efi aarch64-linux-gnu efi
-
-	# Extract El Torrito boot image for arm64-efi
-	cd "$helenosdir"/boot/grub/arm64-efi || exit 1
-	rm -f efi.img.gz || exit 1
-	"$builddir"/arm64-efi/bin/grub-mkrescue -o phony --xorriso="$origdir/getimage.sh" || exit 1
-	gzip efi.img || exit 1
-
-	grub_files_update arm64-efi arm64-efi
-fi
-
-echo "GRUB update successful."
Index: ols/grub/load.cfg
===================================================================
--- tools/grub/load.cfg	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-set root=(hd0,1)
-set prefix=($root)/boot/grub
Index: ols/grub/mkimage.sh
===================================================================
--- tools/grub/mkimage.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Build core.img GRUB image file for use by HelenOS installer (sysinst)
-# Note that we need a suitable build of Grub2 utilities, such as the one
-# we get by running grub-update.sh
-#
-# When sysinst can build core.img itself, this script (and its product,
-# prebuilt core.img in the source tree) will be no longer needed.
-#
-
-orig_dir="$(cd "$(dirname "$0")" && pwd)"
-grub_tools_dir="$orig_dir/grub-build/i386-pc/bin"
-grub_mod_dir="$orig_dir/../../boot/grub/ia32-pc/i386-pc"
-
-"$grub_tools_dir"/grub-mkimage --directory "$grub_mod_dir" \
-    --prefix "$grub_mod_dir" --output "$grub_mod_dir/core.img" \
-    --format 'i386-pc' --compression 'auto' --config "$orig_dir/load.cfg" \
-    "ext2" "part_msdos" "biosdisk" "search_fs_uuid"
Index: ols/imgutil.py
===================================================================
--- tools/imgutil.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2008 Martin Decky
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-Utilities for filesystem image creators
-"""
-
-import os
-import stat
-
-exclude_names = set(['.svn', '.bzr', '.git'])
-
-def align_up(size, alignment):
-	"Return size aligned up to alignment"
-
-	if (size % alignment == 0):
-		return size
-
-	return ((size // alignment) + 1) * alignment
-
-def count_up(size, alignment):
-	"Return units necessary to fit the size"
-
-	if (size % alignment == 0):
-		return (size // alignment)
-
-	return ((size // alignment) + 1)
-
-def num_of_trailing_bin_zeros(num):
-	"Return number of trailing zeros in binary representation"
-
-	i = 0
-	if (num == 0): raise ValueError()
-	while num & 1 == 0:
-		i += 1
-		num = num >> 1
-	return i
-
-def get_bit(number, n):
-	"Return True if n-th least-significant bit is set in the given number"
-
-	return bool((number >> n) & 1)
-
-def set_bit(number, n):
-	"Return the number with n-th least-significant bit set"
-
-	return number | (1 << n)
-
-class ItemToPack:
-	"Stores information about one directory item to be added to the image"
-
-	def __init__(self, parent, name):
-		self.parent = parent
-		self.name = name
-		self.path = os.path.join(parent, name)
-		self.stat = os.stat(self.path)
-		self.is_dir = stat.S_ISDIR(self.stat.st_mode)
-		self.is_file = stat.S_ISREG(self.stat.st_mode)
-		self.size = self.stat.st_size
-
-def listdir_items(path):
-	"Return a list of items to be packed inside a fs image"
-
-	for name in os.listdir(path):
-		if name in exclude_names:
-			continue
-
-		item = ItemToPack(path, name)
-
-		if not (item.is_dir or item.is_file):
-			continue
-
-		yield item
-
-def chunks(item, chunk_size):
-	"Iterate contents of a file in chunks of a given size"
-
-	inf = open(item.path, 'rb')
-	rd = 0
-
-	while (rd < item.size):
-		data = bytes(inf.read(chunk_size))
-		yield data
-		rd += len(data)
-
-	inf.close()
Index: ols/jobfile.py
===================================================================
--- tools/jobfile.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-Add a source/object file pair to a checker jobfile
-"""
-
-import sys
-import os
-import fcntl
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <JOBFILE> <CC> <INPUT> -o <OUTPUT> [CC_ARGUMENTS ...]")
-
-def main():
-	if (len(sys.argv) < 6):
-		usage(sys.argv[0])
-		return
-
-	jobfname = sys.argv[1]
-	ccname = sys.argv[2]
-	srcfname = sys.argv[3]
-	assert(not srcfname.startswith("-"))
-	assert(sys.argv[4] == "-o")
-	tgtfname = sys.argv[5]
-	options = " ".join(sys.argv[6:])
-	cwd = os.getcwd()
-
-	if srcfname.endswith(".c"):
-		toolname = "cc"
-		category = "core"
-
-	if srcfname.endswith(".s"):
-		toolname = "as"
-		category = "asm"
-
-	if srcfname.endswith(".S"):
-		toolname = "as"
-		category = "asm/preproc"
-
-	jobfile = open(jobfname, "a")
-	fcntl.lockf(jobfile, fcntl.LOCK_EX)
-	jobfile.write("{%s},{%s},{%s},{%s},{%s},{%s}\n" % (srcfname, tgtfname, toolname, category, cwd, options))
-	fcntl.lockf(jobfile, fcntl.LOCK_UN)
-	jobfile.close()
-
-	# Run the compiler proper.
-	os.execvp(ccname, sys.argv[2:])
-
-if __name__ == '__main__':
-	main()
Index: ols/list_profiles.sh
===================================================================
--- tools/list_profiles.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Find out the path to the script.
-SOURCE_DIR=`which -- "$0" 2>/dev/null`
-# Maybe we are running bash.
-[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
-[ -z "$SOURCE_DIR" ] && exit 1
-SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
-SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
-
-CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
-
-# Find the leaf subdirectories in the defaults directory.
-level1dirs=`ls "$CONFIG_DEFAULTS"`
-for dname in $level1dirs; do
-	l2dirs=`ls "$CONFIG_DEFAULTS"/"$dname"`
-	havel2=
-	for dn in $l2dirs; do
-		if [ -d "$CONFIG_DEFAULTS/$dname/$dn" ]; then
-			echo "$dname/$dn"
-			havel2=true
-		fi
-	done
-	if [ -z "$havel2" ]; then
-		echo "$dname"
-	fi
-done
Index: ols/mkarray.py
===================================================================
--- tools/mkarray.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,197 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2011 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Binary inline data packer
-"""
-
-import sys
-import os
-import zlib
-import zipfile
-import binascii
-
-def usage(prname):
-	"Print usage syntax"
-	print("%s [--deflate] <DESTINATION> <TYPENAME> <LABEL> <AS_PROLOG> <SECTION> [SOURCE ...]" % prname)
-
-def arg_check():
-	if (len(sys.argv) < 6):
-		usage(sys.argv[0])
-		sys.exit()
-
-def deflate(data):
-	"Compress using deflate algorithm (without any headers)"
-	return zlib.compress(data, 9)[2:-4]
-
-def chunks(string, length):
-	"Produce string chunks"
-	for start in range(0, len(string), length):
-		yield string[start:start + length]
-
-def main():
-	arg_check()
-
-	if sys.argv[1] == "--deflate":
-		sys.argv.pop(1)
-		arg_check()
-		compress = True
-	else:
-		compress = False
-
-	dest = sys.argv[1]
-	typename = sys.argv[2]
-	label = sys.argv[3]
-	as_prolog = sys.argv[4]
-	section = sys.argv[5]
-
-	timestamp = (1980, 1, 1, 0, 0, 0)
-
-	header_ctx = []
-	desc_ctx = []
-	size_ctx = []
-	data_ctx = []
-
-	src_cnt = 0
-
-	archive = zipfile.ZipFile("%s.zip" % dest, "w", zipfile.ZIP_STORED)
-
-	for src in sys.argv[6:]:
-		basename = os.path.basename(src)
-		plainname = os.path.splitext(basename)[0]
-		symbol = basename.replace(".", "_")
-
-		print("%s -> %s" % (src, symbol))
-
-		src_in = open(src, "rb")
-		src_data = src_in.read()
-		src_in.close()
-
-		length = len(src_data)
-
-		if compress:
-			src_data = deflate(src_data)
-			src_fname = os.path.basename("%s.deflate" % src)
-			zipinfo = zipfile.ZipInfo(src_fname, timestamp)
-			archive.writestr(zipinfo, src_data)
-		else:
-			src_fname = src
-
-		if sys.version_info < (3,):
-			src_data = bytearray(src_data)
-
-		length_out = len(src_data)
-
-		header_ctx.append("extern uint8_t %s[];" % symbol)
-		header_ctx.append("extern size_t %s_size;" % symbol)
-
-		data_ctx.append(".globl %s" % symbol)
-		data_ctx.append(".balign 8")
-		data_ctx.append(".size %s, %u" % (symbol, length_out))
-		data_ctx.append("%s:" % symbol)
-		data_ctx.append("\t.incbin \"%s\"\n" % src_fname)
-
-		desc_field = []
-		desc_field.append("\t{")
-		desc_field.append("\t\t.name = \"%s\"," % plainname)
-		desc_field.append("\t\t.addr = (void *) %s," % symbol)
-		desc_field.append("\t\t.size = %u," % length_out)
-		desc_field.append("\t\t.inflated = %u," % length)
-
-		if compress:
-			desc_field.append("\t\t.compressed = true")
-		else:
-			desc_field.append("\t\t.compressed = false")
-
-		desc_field.append("\t}")
-
-		desc_ctx.append("\n".join(desc_field))
-
-		size_ctx.append("size_t %s_size = %u;" % (symbol, length_out))
-
-		src_cnt += 1
-
-	data = ''
-	data += '/*\n'
-	data += ' * AUTO-GENERATED FILE, DO NOT EDIT!!!\n'
-	data += ' * Generated by: tools/mkarray.py\n'
-	data += ' */\n\n'
-	data += "#ifndef %sS_H_\n" % label.upper()
-	data += "#define %sS_H_\n\n" % label.upper()
-	data += "#include <stddef.h>\n"
-	data += "#include <stdint.h>\n"
-	data += "#include <stdbool.h>\n\n"
-	data += "#define %sS  %u\n\n" % (label.upper(), src_cnt)
-	data += "#ifndef %sS_T_\n" % typename.upper()
-	data += "#define %sS_T_\n\n" % typename.upper()
-	data += "typedef struct {\n"
-	data += "\tconst char *name;\n"
-	data += "\tvoid *addr;\n"
-	data += "\tsize_t size;\n"
-	data += "\tsize_t inflated;\n"
-	data += "\tbool compressed;\n"
-	data += "} %s_t;\n\n" % typename
-	data += "#endif\n"
-	data += "extern %s_t %ss[];\n\n" % (typename, label)
-	data += "\n".join(header_ctx)
-	data += "\n\n"
-	data += "#endif\n"
-	zipinfo = zipfile.ZipInfo("%s.h" % dest, timestamp)
-	archive.writestr(zipinfo, data)
-
-	data = ''
-	data += '/*\n'
-	data += ' * AUTO-GENERATED FILE, DO NOT EDIT!!!\n'
-	data += ' * Generated by: tools/mkarray.py\n'
-	data += ' */\n\n'
-	data += as_prolog
-	data += "%s\n\n" % section
-	data += "\n".join(data_ctx)
-	data += "\n"
-	zipinfo = zipfile.ZipInfo("%s.s" % dest, timestamp)
-	archive.writestr(zipinfo, data)
-
-	data = ''
-	data += '/*\n'
-	data += ' * AUTO-GENERATED FILE, DO NOT EDIT!!!\n'
-	data += ' * Generated by: tools/mkarray.py\n'
-	data += ' */\n\n'
-	data += "#include \"%s.h\"\n\n" % dest
-	data += "%s_t %ss[] = {\n" % (typename, label)
-	data += ",\n".join(desc_ctx)
-	data += "\n"
-	data += "};\n\n"
-	data += "\n".join(size_ctx)
-	data += "\n"
-	zipinfo = zipfile.ZipInfo("%s_desc.c" % dest, timestamp)
-	archive.writestr(zipinfo, data)
-
-	archive.close()
-
-if __name__ == '__main__':
-	main()
Index: ols/mkarray_for_meson.sh
===================================================================
--- tools/mkarray_for_meson.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-TOOLS_DIR=`which -- "$0" 2>/dev/null`
-if [ -z "$TOOLS_DIR" ]; then
-	TOOLS_DIR=`which -- "$BASH_SOURCE" 2>/dev/null`
-fi
-TOOLS_DIR=`dirname $TOOLS_DIR`
-TOOLS_DIR=`cd $TOOLS_DIR && echo $PWD`
-
-
-_outdir="$1"
-_arg1="$2"
-_arg2="$3"
-_arg3="$4"
-_arg4="$5"
-_arg5="$6"
-_inputs=""
-
-shift 6
-
-for file in "$@"; do
-	_inputs="$_inputs $PWD/${file}"
-done
-
-cd $_outdir
-$TOOLS_DIR/mkarray.py "$_arg1" "$_arg2" "$_arg3" "$_arg4" "$_arg5" $_inputs > /dev/null
Index: ols/mkext2.py
===================================================================
--- tools/mkext2.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,685 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-EXT2 creator
-"""
-
-import sys
-import os
-import xstruct
-import array
-import time
-import uuid
-from imgutil import *
-
-if sys.version >= '3':
-	xrange = range
-
-GDE_SIZE = 32
-
-STRUCT_DIR_ENTRY_HEAD = """little:
-	uint32_t inode       /* inode number */
-	uint16_t skip        /* byte offset to the next record */
-	uint8_t  name_length /* file attributes */
-	uint8_t  inode_type  /* type of the referenced inode */
-"""
-
-STRUCT_SUPERBLOCK = """little:
-	uint32_t total_inode_count    /* Total number of inodes */
-	uint32_t total_block_count    /* Total number of blocks */
-	uint32_t reserved_block_count /* Total number of reserved blocks */
-	uint32_t free_block_count     /* Total number of free blocks */
-	uint32_t free_inode_count     /* Total number of free inodes */
-	uint32_t first_block          /* Block containing the superblock */
-	uint32_t block_size_log2      /* log_2(block_size) */
-	int32_t  fragment_size_log2   /* log_2(fragment size) */
-	uint32_t blocks_per_group     /* Number of blocks in one block group */
-	uint32_t fragments_per_group  /* Number of fragments per block group */
-	uint32_t inodes_per_group     /* Number of inodes per block group */
-	uint32_t mount_time           /* Time when the filesystem was last mounted */
-	uint32_t write_time           /* Time when the filesystem was last written */
-	uint16_t mount_count          /* Mount count since last full filesystem check */
-	uint16_t max_mount_count      /* Number of mounts after which the fs must be checked */
-	uint16_t magic                /* Magic value */
-	uint16_t state                /* State (mounted/unmounted) */
-	uint16_t error_behavior       /* What to do when errors are encountered */
-	uint16_t rev_minor            /* Minor revision level */
-	uint32_t last_check_time      /* Unix time of last fs check */
-	uint32_t max_check_interval   /* Max unix time interval between checks */
-	uint32_t os                   /* OS that created the filesystem */
-	uint32_t rev_major            /* Major revision level */
-	padding[4] /* default reserved uid and gid */
-
-	/* Following is for ext2 revision 1 only */
-	uint32_t first_inode
-	uint16_t inode_size
-	uint16_t block_group_number /* Block group where this SB is stored */
-	uint32_t features_compatible
-	uint32_t features_incompatible
-	uint32_t features_read_only
-	char     uuid[16]
-	char     volume_name[16]
-"""
-
-STRUCT_BLOCK_GROUP_DESCRIPTOR = """little:
-	uint32_t block_bitmap_block      /* Block ID for block bitmap */
-	uint32_t inode_bitmap_block      /* Block ID for inode bitmap */
-	uint32_t inode_table_first_block /* Block ID of first block of inode table */
-	uint16_t free_block_count        /* Count of free blocks */
-	uint16_t free_inode_count        /* Count of free inodes */
-	uint16_t directory_inode_count   /* Number of inodes allocated to directories */
-"""
-
-STRUCT_INODE = """little:
-	uint16_t mode
-	uint16_t user_id
-	uint32_t size
-	uint32_t access_time
-	uint32_t creation_time
-	uint32_t modification_time
-	uint32_t deletion_time
-	uint16_t group_id
-	uint16_t usage_count /* Hard link count, when 0 the inode is to be freed */
-	uint32_t reserved_512_blocks /* Size of this inode in 512-byte blocks */
-	uint32_t flags
-	padding[4]
-	uint32_t direct_blocks[12] /* Direct block ids stored in this inode */
-	uint32_t indirect_blocks[3]
-	uint32_t version
-	uint32_t file_acl
-	uint32_t size_high /* For regular files in version >= 1, dir_acl if dir */
-	padding[6]
-	uint16_t mode_high /* Hurd only */
-	uint16_t user_id_high /* Linux/Hurd only */
-	uint16_t group_id_high /* Linux/Hurd only */
-"""
-
-# The following is here to handle byte-order conversion in indirect block lookups
-STRUCT_BLOCK_REFERENCE = """little:
-	uint32_t block_id /* Referenced block ID */
-"""
-
-class Filesystem:
-	def __init__(self, filename, block_groups, blocks_per_group, inodes_per_group, block_size, inode_size, reserved_inode_count):
-		"Initialize the filesystem writer"
-
-		outf = open(filename, "w+b")
-		# Set the correct size of the image, so that we can read arbitrary position
-		outf.truncate(block_size * blocks_per_group * block_groups)
-		self.outf = outf
-		self.uuid = uuid.uuid4()
-		self.block_size = block_size
-		self.inode_size = inode_size
-		self.block_groups = block_groups
-		self.blocks_per_group = blocks_per_group
-		self.inodes_per_group = inodes_per_group
-		self.reserved_inode_count = reserved_inode_count
-		self.gdt_blocks = count_up(block_groups * GDE_SIZE, block_size)
-		self.inode_table_blocks_per_group = (inodes_per_group * inode_size) // block_size
-		self.inode_bitmap_blocks_per_group = count_up(inodes_per_group // 8, block_size)
-		self.block_bitmap_blocks_per_group = count_up(blocks_per_group // 8, block_size)
-		self.total_block_count = self.blocks_per_group * self.block_groups
-		self.total_inode_count = self.inodes_per_group * self.block_groups
-		self.inode_table_blocks = count_up(self.total_inode_count * inode_size, block_size)
-		self.inodes = {}
-		self.superblock_at_block = 2047 // block_size
-		self.block_ids_per_block = self.block_size // 4
-		self.indirect_limits = [12, None, None, None]
-		self.indirect_blocks_per_level = [1, None, None, None]
-		for i in range(1,4):
-			self.indirect_blocks_per_level[i] = self.indirect_blocks_per_level[i-1] * self.block_ids_per_block
-			self.indirect_limits[i] = self.indirect_limits[i-1] + self.indirect_blocks_per_level[i]
-		self.block_allocator = Allocator(0, self.total_block_count)
-		self.inode_allocator = Allocator(1, self.total_inode_count)
-		self.init_gdt()
-		# Set the callbacks after GDT has been initialized
-		self.block_allocator.mark_cb = self.mark_block_cb
-		self.inode_allocator.mark_cb = self.mark_inode_cb
-		self.block_allocator.mark_used_all(range(self.superblock_at_block))
-		self.inode_allocator.mark_used_all(range(1, self.reserved_inode_count + 1))
-		self.root_inode = Inode(self, 2, Inode.TYPE_DIR)
-		self.gdt[0].directory_inode_count += 1
-		self.lost_plus_found = Inode(self, self.inode_allocator.alloc(directory=True), Inode.TYPE_DIR)
-		lpf_dir = DirWriter(self.lost_plus_found)
-		lpf_dir.add(self.lost_plus_found.as_dirent('.'))
-		lpf_dir.add(self.root_inode.as_dirent('..'))
-		lpf_dir.finish()
-
-	def init_gdt(self):
-		"Initialize block group descriptor table"
-
-		self.superblock_positions = []
-		self.gdt = []
-		consumed_blocks_per_group = (1 + self.gdt_blocks +
-			    self.inode_bitmap_blocks_per_group +
-			    self.block_bitmap_blocks_per_group +
-			    self.inode_table_blocks_per_group)
-		initial_free_blocks = self.blocks_per_group - consumed_blocks_per_group
-		for bg in range(self.block_groups):
-			base = bg * self.blocks_per_group
-			if (bg == 0):
-				base = self.superblock_at_block
-				self.superblock_positions.append(1024)
-			else:
-				self.superblock_positions.append(base * self.block_size)
-			self.block_allocator.mark_used_all(range(base, base+consumed_blocks_per_group))
-			pos = base + 1 + self.gdt_blocks
-			gde = xstruct.create(STRUCT_BLOCK_GROUP_DESCRIPTOR)
-			gde.block_bitmap_block = pos
-			pos += self.block_bitmap_blocks_per_group
-			gde.inode_bitmap_block = pos
-			pos += self.inode_bitmap_blocks_per_group
-			gde.inode_table_first_block = pos
-			gde.free_block_count = initial_free_blocks
-			gde.free_inode_count = self.inodes_per_group
-			gde.directory_inode_count = 0
-			self.gdt.append(gde)
-
-	def mark_block_cb(self, block):
-		"Called after a block has been allocated"
-
-		self.gdt[block // self.blocks_per_group].free_block_count -= 1
-
-	def mark_inode_cb(self, index, directory=False):
-		"Called after an inode has been allocated"
-
-		index -= 1
-		gde = self.gdt[index // self.inodes_per_group]
-		gde.free_inode_count -= 1
-		if directory:
-			gde.directory_inode_count += 1
-
-	def seek_to_block(self, block, offset=0):
-		"Seek to offset bytes after the start of the given block"
-
-		if offset < 0 or offset > self.block_size:
-			raise Exception("Invalid in-block offset")
-		self.outf.seek(block * self.block_size + offset)
-
-	def seek_to_inode(self, index):
-		"Seek to the start of the inode structure for the inode number index"
-
-		index -= 1
-		if index < 0:
-			raise Exception("Invalid inode number")
-		gde = self.gdt[index // self.inodes_per_group]
-		base_block = gde.inode_table_first_block
-		offset = (index % self.inodes_per_group) * self.inode_size
-		block = base_block + (offset // self.block_size)
-		self.seek_to_block(block, offset % self.block_size)
-
-	def subtree_add(self, inode, parent_inode, dirpath, is_root=False):
-		"Recursively add files to the filesystem"
-
-		dir_writer = DirWriter(inode)
-		dir_writer.add(inode.as_dirent('.'))
-		dir_writer.add(parent_inode.as_dirent('..'))
-
-		if is_root:
-			dir_writer.add(self.lost_plus_found.as_dirent('lost+found'))
-
-		for item in listdir_items(dirpath):
-			newidx = self.inode_allocator.alloc(directory = item.is_dir)
-			if item.is_file:
-				child_inode = Inode(self, newidx, Inode.TYPE_FILE)
-				for data in chunks(item, self.block_size):
-					child_inode.write(data)
-			elif item.is_dir:
-				child_inode = Inode(self, newidx, Inode.TYPE_DIR)
-				self.subtree_add(child_inode, inode, item.path)
-
-			dir_writer.add(child_inode.as_dirent(item.name))
-			self.write_inode(child_inode)
-
-		dir_writer.finish()
-
-	def write_inode(self, inode):
-		"Write inode information into the inode table"
-
-		self.seek_to_inode(inode.index)
-		self.outf.write(inode.pack())
-
-	def write_gdt(self):
-		"Write group descriptor table at the current file position"
-
-		for gde in self.gdt:
-			data = bytes(gde.pack())
-			self.outf.write(data)
-			self.outf.seek(GDE_SIZE-len(data), os.SEEK_CUR)
-
-	def write_superblock(self, block_group):
-		"Write superblock at the current position"
-
-		sb = xstruct.create(STRUCT_SUPERBLOCK)
-		sb.total_inode_count = self.total_inode_count
-		sb.total_block_count = self.total_block_count
-		sb.reserved_block_count = 0
-		sb.free_block_count = self.block_allocator.free
-		sb.free_inode_count = self.inode_allocator.free
-		sb.first_block = self.superblock_at_block
-		sb.block_size_log2 = num_of_trailing_bin_zeros(self.block_size) - 10
-		sb.fragment_size_log2 = sb.block_size_log2
-		sb.blocks_per_group = self.blocks_per_group
-		sb.fragments_per_group = self.blocks_per_group
-		sb.inodes_per_group = self.inodes_per_group
-		curtime = int(time.time())
-		sb.mount_time = curtime
-		sb.write_time = curtime
-		sb.mount_count = 0
-		sb.max_mount_count = 21
-		sb.magic = 0xEF53
-		sb.state = 5 # clean
-		sb.error_behavior = 1 # continue on errors
-		sb.rev_minor = 0
-		sb.last_check_time = curtime
-		sb.max_check_interval = 15552000 # 6 months
-		sb.os = 0 # Linux
-		sb.rev_major = 1
-		sb.first_inode = self.reserved_inode_count + 1
-		sb.inode_size = self.inode_size
-		sb.block_group_number = block_group
-		sb.features_compatible = 0
-		sb.features_incompatible = 2 # filetype
-		sb.features_read_only = 0
-		sb.uuid = self.uuid.bytes_le
-		sb.volume_name = 'HelenOS-rd\0\0\0\0\0\0'
-		self.outf.write(bytes(sb.pack()))
-
-	def write_all_metadata(self):
-		"Write superblocks, block group tables, block and inode bitmaps"
-
-		bbpg = self.blocks_per_group // 8
-		bipg = self.inodes_per_group // 8
-		def window(arr, index, size):
-			return arr[index * size:(index + 1) * size]
-
-		for bg_index in xrange(len(self.gdt)):
-			sbpos = self.superblock_positions[bg_index]
-			sbblock = (sbpos + 1023) // self.block_size
-			gde = self.gdt[bg_index]
-
-			self.outf.seek(sbpos)
-			self.write_superblock(bg_index)
-
-			self.seek_to_block(sbblock+1)
-			self.write_gdt()
-
-			self.seek_to_block(gde.block_bitmap_block)
-			self.outf.write(window(self.block_allocator.bitmap, bg_index, bbpg))
-
-			self.seek_to_block(gde.inode_bitmap_block)
-			self.outf.write(window(self.inode_allocator.bitmap, bg_index, bipg))
-
-	def close(self):
-		"Write all remaining data to the filesystem and close the file"
-
-		self.write_inode(self.root_inode)
-		self.write_inode(self.lost_plus_found)
-		self.write_all_metadata()
-		self.outf.close()
-
-class Allocator:
-	def __init__(self, base, count):
-		self.count = count
-		self.base = base
-		self.free = count
-		self.nextidx = 0
-		self.bitmap = array.array('B', [0] * (count // 8))
-		self.mark_cb = None
-
-	def __contains__(self, item):
-		"Check if the item is already used"
-
-		bitidx = item - self.base
-		return get_bit(self.bitmap[bitidx // 8], bitidx % 8)
-
-	def alloc(self, **options):
-		"Allocate a new item"
-
-		while self.nextidx < self.count and (self.base + self.nextidx) in self:
-			self.nextidx += 1
-		if self.nextidx == self.count:
-			raise Exception("No free item available")
-		item = self.base + self.nextidx
-		self.nextidx += 1
-		self.mark_used(item, **options)
-		return item
-
-	def mark_used(self, item, **options):
-		"Mark the specified item as used"
-
-		bitidx = item - self.base
-		if item in self:
-			raise Exception("Item already used: " + str(item))
-		self.free -= 1
-		index = bitidx // 8
-		self.bitmap[index] = set_bit(self.bitmap[index], bitidx % 8)
-		if self.mark_cb:
-			self.mark_cb(item, **options)
-
-	def mark_used_all(self, items, **options):
-		"Mark all specified items as used"
-
-		for item in items:
-			self.mark_used(item, **options)
-
-class Inode:
-	TYPE_FILE = 1
-	TYPE_DIR = 2
-	TYPE2MODE = {TYPE_FILE: 8, TYPE_DIR: 4}
-
-	def __init__(self, fs, index, typ):
-		self.fs = fs
-		self.direct = [None] * 12
-		self.indirect = [None] * 3
-		self.pos = 0
-		self.size = 0
-		self.blocks = 0
-		self.index = index
-		self.type = typ
-		self.refcount = 0
-
-	def as_dirent(self, name):
-		"Return a DirEntry corresponding to this inode"
-		self.refcount += 1
-		return DirEntry(name, self.index, self.type)
-
-	def new_block(self, data=True):
-		"Get a new block index from allocator and count it here as belonging to the file"
-
-		block = self.fs.block_allocator.alloc()
-		self.blocks += 1
-		return block
-
-	def get_or_add_block(self, block):
-		"Get or add a real block to the file"
-
-		if block < 12:
-			return self.get_or_add_block_direct(block)
-		return self.get_or_add_block_indirect(block)
-
-	def get_or_add_block_direct(self, block):
-		"Get or add a real block to the file (direct blocks)"
-
-		if self.direct[block] == None:
-			self.direct[block] = self.new_block()
-		return self.direct[block]
-
-	def get_or_add_block_indirect(self, block):
-		"Get or add a real block to the file (indirect blocks)"
-
-		# Determine the indirection level for the desired block
-		level = None
-		for i in range(4):
-			if block < self.fs.indirect_limits[i]:
-				level = i
-				break
-
-		assert level != None
-
-		# Compute offsets for the topmost level
-		block_offset_in_level = block - self.fs.indirect_limits[level-1];
-		if self.indirect[level-1] == None:
-			self.indirect[level-1] = self.new_block(data = False)
-		current_block = xstruct.create(STRUCT_BLOCK_REFERENCE)
-		current_block.block_id = self.indirect[level-1]
-		offset_in_block = block_offset_in_level // self.fs.indirect_blocks_per_level[level-1]
-
-		# Navigate through other levels
-		while level > 0:
-			assert offset_in_block < self.fs.block_ids_per_block
-
-			level -= 1
-
-			self.fs.seek_to_block(current_block.block_id, offset_in_block*4)
-			current_block.unpack(self.fs.outf.read(4))
-
-			if current_block.block_id == 0:
-				# The block does not exist, so alloc one and write it there
-				self.fs.outf.seek(-4, os.SEEK_CUR)
-				current_block.block_id = self.new_block(data=(level==0))
-				self.fs.outf.write(current_block.pack())
-
-			# If we are on the last level, break here as
-			# there is no next level to visit
-			if level == 0:
-				break
-
-			# Visit the next level
-			block_offset_in_level %= self.fs.indirect_blocks_per_level[level];
-			offset_in_block = block_offset_in_level // self.fs.indirect_blocks_per_level[level-1]
-
-		return current_block.block_id
-
-	def do_seek(self):
-		"Perform a seek to the position indicated by self.pos"
-
-		block = self.pos // self.fs.block_size
-		real_block = self.get_or_add_block(block)
-		offset = self.pos % self.fs.block_size
-		self.fs.seek_to_block(real_block, offset)
-
-	def write(self, data):
-		"Write a piece of data (arbitrarily long) as the contents of the inode"
-
-		data_pos = 0
-		while data_pos < len(data):
-			bytes_remaining_in_block = self.fs.block_size - (self.pos % self.fs.block_size)
-			bytes_to_write = min(bytes_remaining_in_block, len(data)-data_pos)
-			self.do_seek()
-			self.fs.outf.write(data[data_pos:data_pos + bytes_to_write])
-			self.pos += bytes_to_write
-			data_pos += bytes_to_write
-			self.size = max(self.pos, self.size)
-
-	def align_size_to_block(self):
-		"Align the size of the inode up to block size"
-
-		self.size = align_up(self.size, self.fs.block_size)
-
-	def align_pos(self, bytes):
-		"Align the current position up to bytes boundary"
-
-		self.pos = align_up(self.pos, bytes)
-
-	def set_pos(self, pos):
-		"Set the current position"
-
-		self.pos = pos
-
-	def pack(self):
-		"Pack the inode structure and return the result"
-
-		data = xstruct.create(STRUCT_INODE)
-		data.mode = (Inode.TYPE2MODE[self.type] << 12)
-		data.mode |= 0x1ff # ugo+rwx
-		data.user_id = 0
-		data.size = self.size & 0xFFFFFFFF
-		data.group_id = 0
-		curtime = int(time.time())
-		data.access_time = curtime
-		data.modification_time = curtime
-		data.creation_time = curtime
-		data.deletion_time = 0
-		data.usage_count = self.refcount
-		data.reserved_512_blocks = self.blocks * (self.fs.block_size // 512)
-		data.flags = 0
-		blockconv = lambda x: 0 if x == None else x
-		data.direct_blocks = list(map(blockconv, self.direct))
-		data.indirect_blocks = list(map(blockconv, self.indirect))
-		data.version = 0
-		data.file_acl = 0
-		if self.type == Inode.TYPE_FILE:
-			data.size_high = (self.size >> 32)
-		else:
-			# size_high represents dir_acl in this case
-			data.size_high = 0
-		data.mode_high = 0
-		data.user_id_high = 0
-		data.group_id_high = 0
-		return data.pack()
-
-class DirEntry:
-	"Represents a linked list directory entry"
-
-	def __init__(self, name, inode, typ):
-		self.name = name.encode('UTF-8')
-		self.inode = inode
-		self.skip = None
-		self.type = typ
-
-	def size(self):
-		"Return size of the entry in bytes"
-
-		return align_up(8 + len(self.name)+1, 4)
-
-	def write(self, inode):
-		"Write the directory entry into the inode"
-
-		head = xstruct.create(STRUCT_DIR_ENTRY_HEAD)
-		head.inode = self.inode
-		head.skip = self.skip
-		head.name_length = len(self.name)
-		head.inode_type = self.type
-		inode.write(head.pack())
-		inode.write(self.name+'\0'.encode())
-		inode.align_pos(4)
-
-class DirWriter:
-	"Manages writing directory entries into an inode (alignment, etc.)"
-
-	def __init__(self, inode):
-		self.pos = 0
-		self.inode = inode
-		self.prev_entry = None
-		self.prev_pos = None
-
-	def prev_write(self):
-		"Write a previously remembered entry"
-
-		if self.prev_entry:
-			self.prev_entry.skip = self.pos - self.prev_pos
-			if self.inode:
-				self.prev_entry.write(self.inode)
-				self.inode.set_pos(self.pos)
-
-	def add(self, entry):
-		"Add a directory entry to the directory"
-
-		size = entry.size()
-		block_size = self.inode.fs.block_size
-		if align_up(self.pos, block_size) < align_up(self.pos + size, block_size):
-			self.pos = align_up(self.pos, block_size)
-		self.prev_write()
-		self.prev_entry = entry
-		self.prev_pos = self.pos
-		self.pos += size
-
-	def finish(self):
-		"Write the last entry and finish writing the directory contents"
-
-		if not self.inode:
-			return
-		self.pos = align_up(self.pos, self.inode.fs.block_size)
-		self.prev_write()
-		self.inode.align_size_to_block()
-
-def subtree_stats(root, block_size):
-	"Recursively calculate statistics"
-
-	blocks = 0
-	inodes = 1
-	dir_writer = DirWriter(None)
-
-	for item in listdir_items(root):
-		inodes += 1
-		if item.is_file:
-			blocks += count_up(item.size, block_size)
-		elif item.is_dir:
-			subtree_blocks, subtree_inodes = subtree_stats(item.path, block_size)
-			blocks += subtree_blocks
-			inodes += subtree_inodes
-
-	dir_writer.finish()
-	blocks += count_up(dir_writer.pos, block_size)
-	return (blocks, inodes)
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>")
-
-def main():
-	if (len(sys.argv) < 4):
-		usage(sys.argv[0])
-		return
-
-	if (not sys.argv[1].isdigit()):
-		print("<EXTRA_BYTES> must be a number")
-		return
-
-	extra_bytes = int(sys.argv[1])
-
-	path = os.path.abspath(sys.argv[2])
-	if (not os.path.isdir(path)):
-		print("<PATH> must be a directory")
-		return
-
-	block_size = 4096
-	inode_size = 128
-	reserved_inode_count = 10
-	blocks_per_group = 1024
-	inodes_per_group = 512
-
-	blocks, inodes = subtree_stats(path, block_size)
-	blocks += count_up(extra_bytes, block_size)
-	inodes += reserved_inode_count
-
-	inodes_per_group = align_up(inodes_per_group, 8)
-	blocks_per_group = align_up(blocks_per_group, 8)
-
-	inode_table_blocks_per_group = (inodes_per_group * inode_size) // block_size
-	inode_bitmap_blocks_per_group = count_up(inodes_per_group // 8, block_size)
-	block_bitmap_blocks_per_group = count_up(blocks_per_group // 8, block_size)
-	free_blocks_per_group = blocks_per_group
-	free_blocks_per_group -= inode_table_blocks_per_group
-	free_blocks_per_group -= inode_bitmap_blocks_per_group
-	free_blocks_per_group -= block_bitmap_blocks_per_group
-	free_blocks_per_group -= 10 # one for SB and some reserve for GDT
-
-	block_groups = max(count_up(inodes, inodes_per_group), count_up(blocks, free_blocks_per_group))
-
-	fs = Filesystem(sys.argv[3], block_groups, blocks_per_group, inodes_per_group,
-	                        block_size, inode_size, reserved_inode_count)
-
-	fs.subtree_add(fs.root_inode, fs.root_inode, path, is_root=True)
-	fs.close()
-
-if __name__ == '__main__':
-	main()
Index: ols/mkext4.py
===================================================================
--- tools/mkext4.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-mkext2.py
Index: ols/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,547 +1,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (c) 2008 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-FAT creator
-"""
-
-import sys
-import os
-import random
-import xstruct
-import array
-from imgutil import *
-
-def subtree_size(root, cluster_size, dirent_size):
-	"Recursive directory walk and calculate size"
-
-	size = 0
-	files = 2
-
-	for item in listdir_items(root):
-		if item.is_file:
-			size += align_up(item.size, cluster_size)
-			files += 1
-		elif item.is_dir:
-			size += subtree_size(item.path, cluster_size, dirent_size)
-			files += 1
-
-	return size + align_up(files * dirent_size, cluster_size)
-
-def root_entries(root):
-	"Return number of root directory entries"
-
-	return len(os.listdir(root))
-
-def write_file(item, outf, cluster_size, data_start, fat, reserved_clusters):
-	"Store the contents of a file"
-
-	prev = -1
-	first = 0
-
-	for data in chunks(item, cluster_size):
-		empty_cluster = fat.index(0)
-		fat[empty_cluster] = 0xffff
-
-		if (prev != -1):
-			fat[prev] = empty_cluster
-		else:
-			first = empty_cluster
-
-		prev = empty_cluster
-
-		outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size)
-		outf.write(data)
-
-	return first, item.size
-
-def write_directory(directory, outf, cluster_size, data_start, fat, reserved_clusters, dirent_size, empty_cluster):
-	"Store the contents of a directory"
-
-	length = len(directory)
-	size = length * dirent_size
-	prev = -1
-	first = 0
-
-	i = 0
-	rd = 0;
-	while (rd < size):
-		if (prev != -1):
-			empty_cluster = fat.index(0)
-			fat[empty_cluster] = 0xffff
-			fat[prev] = empty_cluster
-		else:
-			first = empty_cluster
-
-		prev = empty_cluster
-
-		data = bytes()
-		data_len = 0
-		while ((i < length) and (data_len < cluster_size)):
-			if (i == 0):
-				directory[i].cluster = empty_cluster
-
-			data += directory[i].pack()
-			data_len += dirent_size
-			i += 1
-
-		outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size)
-		outf.write(data)
-		rd += len(data)
-
-	return first, size
-
-DIR_ENTRY = """little:
-	char name[8]               /* file name */
-	char ext[3]                /* file extension */
-	uint8_t attr               /* file attributes */
-	uint8_t lcase              /* file name case (NT extension) */
-	uint8_t ctime_fine         /* create time (fine resolution) */
-	uint16_t ctime             /* create time */
-	uint16_t cdate             /* create date */
-	uint16_t adate             /* access date */
-	padding[2]                 /* EA-index */
-	uint16_t mtime             /* modification time */
-	uint16_t mdate             /* modification date */
-	uint16_t cluster           /* first cluster */
-	uint32_t size              /* file size */
-"""
-
-DOT_DIR_ENTRY = """little:
-	uint8_t signature          /* 0x2e signature */
-	char name[7]               /* empty */
-	char ext[3]                /* empty */
-	uint8_t attr               /* file attributes */
-	padding[1]                 /* reserved for NT */
-	uint8_t ctime_fine         /* create time (fine resolution) */
-	uint16_t ctime             /* create time */
-	uint16_t cdate             /* create date */
-	uint16_t adate             /* access date */
-	padding[2]                 /* EA-index */
-	uint16_t mtime             /* modification time */
-	uint16_t mdate             /* modification date */
-	uint16_t cluster           /* first cluster */
-	uint32_t size              /* file size */
-"""
-
-DOTDOT_DIR_ENTRY = """little:
-	uint8_t signature[2]       /* 0x2e signature */
-	char name[6]               /* empty */
-	char ext[3]                /* empty */
-	uint8_t attr               /* file attributes */
-	padding[1]                 /* reserved for NT */
-	uint8_t ctime_fine         /* create time (fine resolution) */
-	uint16_t ctime             /* create time */
-	uint16_t cdate             /* create date */
-	uint16_t adate             /* access date */
-	padding[2]                 /* EA-index */
-	uint16_t mtime             /* modification time */
-	uint16_t mdate             /* modification date */
-	uint16_t cluster           /* first cluster */
-	uint32_t size              /* file size */
-"""
-
-LFN_DIR_ENTRY = """little:
-	uint8_t seq                /* sequence number */
-	char name1[10]             /* first part of the name */
-	uint8_t attr               /* attributes */
-	uint8_t rec_type           /* LFN record type */
-	uint8_t checksum           /* LFN checksum */
-	char name2[12]             /* second part of the name */
-	uint16_t cluster           /* cluster */
-	char name3[4]              /* third part of the name */
-"""
-
-lchars = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
-              'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
-              'U', 'V', 'W', 'X', 'Y', 'Z',
-              '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-              '!', '#', '$', '%', '&', '\'', '(', ')', '-', '@',
-              '^', '_', '`', '{', '}', '~', '.'])
-
-def fat_lchars(name):
-	"Filter FAT legal characters"
-
-	filtered_name = b''
-	filtered = False
-
-	for char in name.encode('ascii', 'replace').upper():
-		if chr(char) in lchars:
-			filtered_name += str.encode(chr(char))
-		else:
-			filtered_name += b'_'
-			filtered = True
-
-	return (filtered_name, filtered)
-
-def fat_name83(name, name83_list):
-	"Create a 8.3 name for the given name"
-
-	ascii_name, lfn = fat_lchars(name)
-	# Splitting works only on strings, not on bytes
-	ascii_parts = ascii_name.decode('utf8').split('.')
-
-	short_name = ''
-	short_ext = ''
-
-	if len(ascii_name) > 11:
-		lfn = True
-
-	if len(ascii_parts) > 0:
-		short_name = ascii_parts[0]
-		if len(short_name) > 8:
-			lfn = True
-
-	if len(ascii_parts) > 1:
-		short_ext = ascii_parts[-1]
-		if len(short_ext) > 3:
-			lfn = True
-
-	if len(ascii_parts) > 2:
-		lfn = True
-
-	if lfn == False:
-		name83_list.append(short_name + '.' + short_ext)
-		return (short_name.ljust(8)[0:8], short_ext.ljust(3)[0:3], False)
-
-	# For filenames with multiple extensions, we treat the last one
-	# as the actual extension. The rest of the filename is stripped
-	# of dots and concatenated to form the short name
-	for part in ascii_parts[1:-1]:
-		short_name += part
-
-	for number in range(1, 999999):
-		number_str = ('~' + str(number)).upper()
-
-		if len(short_name) + len(number_str) > 8:
-			short_name = short_name[0:8 - len(number_str)]
-
-		short_name += number_str;
-
-		if not (short_name + '.' + short_ext) in name83_list:
-			break
-
-	name83_list.append(short_name + '.' + short_ext)
-	return (short_name.ljust(8)[0:8], short_ext.ljust(3)[0:3], True)
-
-def create_lfn_dirent(name, seq, checksum):
-	"Create LFN directory entry"
-
-	entry = xstruct.create(LFN_DIR_ENTRY)
-	name_rest = name[26:]
-
-	if len(name_rest) > 0:
-		entry.seq = seq
-	else:
-		entry.seq = seq | 0x40
-
-	entry.name1 = name[0:10]
-	entry.name2 = name[10:22]
-	entry.name3 = name[22:26]
-
-	entry.attr = 0x0F
-	entry.rec_type = 0
-	entry.checksum = checksum
-	entry.cluster = 0
-
-	return (entry, name_rest)
-
-def lfn_checksum(name):
-	"Calculate LFN checksum"
-
-	checksum = 0
-	for i in range(0, 11):
-		checksum = (((checksum & 1) << 7) + (checksum >> 1) + ord(name[i])) & 0xFF
-
-	return checksum
-
-def create_dirent(name, name83_list, directory, cluster, size):
-	short_name, short_ext, lfn = fat_name83(name, name83_list)
-
-	dir_entry = xstruct.create(DIR_ENTRY)
-
-	dir_entry.name = short_name
-	dir_entry.ext = short_ext
-
-	if (directory):
-		dir_entry.attr = 0x30
-	else:
-		dir_entry.attr = 0x20
-
-	dir_entry.lcase = 0x18
-	dir_entry.ctime_fine = 0 # FIXME
-	dir_entry.ctime = 0 # FIXME
-	dir_entry.cdate = 0 # FIXME
-	dir_entry.adate = 0 # FIXME
-	dir_entry.mtime = 0 # FIXME
-	dir_entry.mdate = 0 # FIXME
-	dir_entry.cluster = cluster
-
-	if (directory):
-		dir_entry.size = 0
-	else:
-		dir_entry.size = size
-
-	if not lfn:
-		return [dir_entry]
-
-	long_name = name.encode('utf_16_le')
-	entries = [dir_entry]
-
-	seq = 1
-	checksum = lfn_checksum(dir_entry.name + dir_entry.ext)
-
-	while len(long_name) > 0:
-		long_entry, long_name = create_lfn_dirent(long_name, seq, checksum)
-		entries.append(long_entry)
-		seq += 1
-
-	entries.reverse()
-	return entries
-
-def create_dot_dirent(empty_cluster):
-	dir_entry = xstruct.create(DOT_DIR_ENTRY)
-
-	dir_entry.signature = 0x2e
-	dir_entry.name = b'       '
-	dir_entry.ext = b'   '
-	dir_entry.attr = 0x10
-
-	dir_entry.ctime_fine = 0 # FIXME
-	dir_entry.ctime = 0 # FIXME
-	dir_entry.cdate = 0 # FIXME
-	dir_entry.adate = 0 # FIXME
-	dir_entry.mtime = 0 # FIXME
-	dir_entry.mdate = 0 # FIXME
-	dir_entry.cluster = empty_cluster
-	dir_entry.size = 0
-
-	return dir_entry
-
-def create_dotdot_dirent(parent_cluster):
-	dir_entry = xstruct.create(DOTDOT_DIR_ENTRY)
-
-	dir_entry.signature = [0x2e, 0x2e]
-	dir_entry.name = b'      '
-	dir_entry.ext = b'   '
-	dir_entry.attr = 0x10
-
-	dir_entry.ctime_fine = 0 # FIXME
-	dir_entry.ctime = 0 # FIXME
-	dir_entry.cdate = 0 # FIXME
-	dir_entry.adate = 0 # FIXME
-	dir_entry.mtime = 0 # FIXME
-	dir_entry.mdate = 0 # FIXME
-	dir_entry.cluster = parent_cluster
-	dir_entry.size = 0
-
-	return dir_entry
-
-def recursion(head, root, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, parent_cluster):
-	"Recursive directory walk"
-
-	directory = []
-	name83_list = []
-
-	if not head:
-		# Directory cluster preallocation
-		empty_cluster = fat.index(0)
-		fat[empty_cluster] = 0xFFFF
-
-		directory.append(create_dot_dirent(empty_cluster))
-		directory.append(create_dotdot_dirent(parent_cluster))
-	else:
-		empty_cluster = 0
-
-	for item in listdir_items(root):
-		if item.is_file:
-			rv = write_file(item, outf, cluster_size, data_start, fat, reserved_clusters)
-			directory.extend(create_dirent(item.name, name83_list, False, rv[0], rv[1]))
-		elif item.is_dir:
-			rv = recursion(False, item.path, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, empty_cluster)
-			directory.extend(create_dirent(item.name, name83_list, True, rv[0], rv[1]))
-
-	if head:
-		outf.seek(root_start)
-		for dir_entry in directory:
-			outf.write(dir_entry.pack())
-	else:
-		return write_directory(directory, outf, cluster_size, data_start, fat, reserved_clusters, dirent_size, empty_cluster)
-
-BOOT_SECTOR = """little:
-	uint8_t jmp[3]             /* jump instruction */
-	char oem[8]                /* OEM string */
-	uint16_t sector            /* bytes per sector */
-	uint8_t cluster            /* sectors per cluster */
-	uint16_t reserved          /* reserved sectors */
-	uint8_t fats               /* number of FATs */
-	uint16_t rootdir           /* root directory entries */
-	uint16_t sectors           /* total number of sectors */
-	uint8_t descriptor         /* media descriptor */
-	uint16_t fat_sectors       /* sectors per single FAT */
-	uint16_t track_sectors     /* sectors per track */
-	uint16_t heads             /* number of heads */
-	uint32_t hidden            /* hidden sectors */
-	uint32_t sectors_big       /* total number of sectors (if sectors == 0) */
-
-	/* Extended BIOS Parameter Block */
-	uint8_t drive              /* physical drive number */
-	padding[1]                 /* reserved (current head) */
-	uint8_t extboot_signature  /* extended boot signature */
-	uint32_t serial            /* serial number */
-	char label[11]             /* volume label */
-	char fstype[8]             /* filesystem type */
-	padding[448]               /* boot code */
-	uint8_t boot_signature[2]  /* boot signature */
-"""
-
-EMPTY_SECTOR = """little:
-	padding[512]               /* empty sector data */
-"""
-
-FAT_ENTRY = """little:
-	uint16_t next              /* FAT16 entry */
-"""
-
-def usage(prname):
-	"Print usage syntax"
-	print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>")
-
-def main():
-	if (len(sys.argv) < 4):
-		usage(sys.argv[0])
-		return
-
-	if (not sys.argv[1].isdigit()):
-		print("<EXTRA_BYTES> must be a number")
-		return
-
-	extra_bytes = int(sys.argv[1])
-
-	path = os.path.abspath(sys.argv[2])
-	if (not os.path.isdir(path)):
-		print("<PATH> must be a directory")
-		return
-
-	fat16_clusters = 4096
-
-	sector_size = 512
-	cluster_size = 4096
-	dirent_size = 32
-	fatent_size = 2
-	fat_count = 2
-	reserved_clusters = 2
-
-	# Make sure the filesystem is large enough for FAT16
-	size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
-	while (size // cluster_size < fat16_clusters):
-		if (cluster_size > sector_size):
-			cluster_size = cluster_size // 2
-			size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
-		else:
-			size = fat16_clusters * cluster_size + reserved_clusters * cluster_size
-
-	root_size = align_up(root_entries(path) * dirent_size, cluster_size)
-
-	fat_size = align_up(align_up(size, cluster_size) // cluster_size * fatent_size, sector_size)
-
-	sectors = (cluster_size + fat_count * fat_size + root_size + size) // sector_size
-	root_start = cluster_size + fat_count * fat_size
-	data_start = root_start + root_size
-
-	outf = open(sys.argv[3], "wb")
-
-	boot_sector = xstruct.create(BOOT_SECTOR)
-	boot_sector.jmp = [0xEB, 0x3C, 0x90]
-	boot_sector.oem = b'MSDOS5.0'
-	boot_sector.sector = sector_size
-	boot_sector.cluster = cluster_size // sector_size
-	boot_sector.reserved = cluster_size // sector_size
-	boot_sector.fats = fat_count
-	boot_sector.rootdir = root_size // dirent_size
-	if (sectors <= 65535):
-		boot_sector.sectors = sectors
-	else:
-		boot_sector.sectors = 0
-	boot_sector.descriptor = 0xF8
-	boot_sector.fat_sectors = fat_size // sector_size
-	boot_sector.track_sectors = 63
-	boot_sector.heads = 6
-	boot_sector.hidden = 0
-	if (sectors > 65535):
-		boot_sector.sectors_big = sectors
-	else:
-		boot_sector.sectors_big = 0
-
-	boot_sector.drive = 0x80
-	boot_sector.extboot_signature = 0x29
-	boot_sector.serial = random.randint(0, 0x7fffffff)
-	boot_sector.label = b'HELENOS'
-	boot_sector.fstype = b'FAT16   '
-	boot_sector.boot_signature = [0x55, 0xAA]
-
-	outf.write(boot_sector.pack())
-
-	empty_sector = xstruct.create(EMPTY_SECTOR)
-
-	# Reserved sectors
-	for i in range(1, cluster_size // sector_size):
-		outf.write(empty_sector.pack())
-
-	# FAT tables
-	for i in range(0, fat_count):
-		for j in range(0, fat_size // sector_size):
-			outf.write(empty_sector.pack())
-
-	# Root directory
-	for i in range(0, root_size // sector_size):
-		outf.write(empty_sector.pack())
-
-	# Data
-	for i in range(0, size // sector_size):
-		outf.write(empty_sector.pack())
-
-	fat = array.array('L', [0] * (fat_size // fatent_size))
-	fat[0] = 0xfff8
-	fat[1] = 0xffff
-
-	recursion(True, path, outf, cluster_size, root_start, data_start, fat, reserved_clusters, dirent_size, 0)
-
-	# Store FAT
-	fat_entry = xstruct.create(FAT_ENTRY)
-	for i in range(0, fat_count):
-		outf.seek(cluster_size + i * fat_size)
-		for j in range(0, fat_size // fatent_size):
-			fat_entry.next = fat[j]
-			outf.write(fat_entry.pack())
-
-	outf.close()
-
-if __name__ == '__main__':
-	main()
Index: ols/mkuimage.py
===================================================================
--- tools/mkuimage.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-"""
-Create legacy uImage (U-Boot image)
-"""
-
-from collections import deque
-import os
-import sys
-import xstruct
-import zlib
-
-UIMAGE_HEADER = """big:
-	uint32_t magic
-	uint32_t header_crc
-	uint32_t c_tstamp
-	uint32_t data_size
-	uint32_t load_addr
-	uint32_t start_addr
-	uint32_t data_crc
-	uint8_t os
-	uint8_t arch
-	uint8_t img_type
-	uint8_t compression
-	char img_name[32]
-"""
-
-def main():
-	args = deque(sys.argv)
-	cmd_name = args.popleft()
-	base_name = os.path.basename(cmd_name)
-	image_name = 'Noname'
-	load_addr = 0
-	start_addr = 0
-	os_type = 5 #Linux is the default
-
-	while len(args) >= 2 and args[0][0] == '-':
-		opt = args.popleft()[1:]
-		optarg = args.popleft()
-
-		if opt == 'name':
-			image_name = optarg
-		elif opt == 'laddr':
-			load_addr = (int)(optarg, 0)
-		elif opt == 'saddr':
-			start_addr = (int)(optarg, 0)
-		elif opt == 'ostype':
-			os_type = (int)(optarg, 0)
-		else:
-			print(base_name + ": Unrecognized option.")
-			print_syntax(cmd_name)
-			return
-
-	if len(args) < 2:
-		print(base_name + ": Argument missing.")
-		print_syntax(cmd_name)
-		return
-
-	inf_name = args[0]
-	outf_name = args[1]
-
-	try:
-		mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type)
-	except:
-		os.remove(outf_name)
-		raise
-
-def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr, os_type):
-	inf = open(inf_name, 'rb')
-	outf = open(outf_name, 'wb')
-
-	header = xstruct.create(UIMAGE_HEADER)
-	header_size = header.size()
-
-	#
-	# Write data
-	#
-	outf.seek(header_size, os.SEEK_SET)
-	data = inf.read()
-	data_size = inf.tell()
-	data_crc = calc_crc32(data)
-	data_tstamp = (int)(os.path.getmtime(inf_name))
-	outf.write(data)
-	data = ''
-
-	#
-	# Write header
-	#
-	outf.seek(0, os.SEEK_SET)
-
-	header.magic = 0x27051956	# uImage magic
-	header.header_crc = 0
-	header.c_tstamp = data_tstamp
-	header.data_size = data_size
-	header.load_addr = load_addr	# Address where to load image
-	header.start_addr = start_addr	# Address of entry point
-	header.data_crc = data_crc
-	header.os = os_type
-	header.arch = 2			# ARM
-	header.img_type = 2		# Kernel
-	header.compression = 0		# None
-	header.img_name = image_name.encode('ascii')
-
-	header_crc = calc_crc32(header.pack())
-	header.header_crc = header_crc
-
-	outf.write(header.pack())
-	outf.close()
-
-## Compute CRC32 of binary string.
-#
-# Works around bug in zlib.crc32() which returns signed int32 result
-# in Python < 3.0.
-#
-def calc_crc32(byteseq):
-	signed_crc = zlib.crc32(byteseq, 0)
-	if signed_crc < 0:
-		return signed_crc + (1 << 32)
-	else:
-		return signed_crc
-
-## Print command-line syntax.
-#
-def print_syntax(cmd):
-	print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
-	print()
-	print("\traw_image\tInput image name (raw binary data)")
-	print("\tuImage\t\tOutput uImage name (U-Boot image)")
-	print()
-	print("options:")
-	print("\t-name <name>\tImage name (default: 'Noname')")
-	print("\t-laddr <name>\tLoad address (default: 0x00000000)")
-	print("\t-saddr <name>\tStart address (default: 0x00000000)")
-
-if __name__ == '__main__':
-	main()
Index: ols/release.sh
===================================================================
--- tools/release.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# Find out the path to the script.
-SOURCE_DIR=`which -- "$0" 2>/dev/null`
-# Maybe we are running bash.
-[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
-[ -z "$SOURCE_DIR" ] && exit 1
-SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
-SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
-
-
-echo "Running tools/build_all.sh"
-
-mkdir -p build_all
-cd build_all
-sh "${SOURCE_DIR}/tools/build_all.sh"
-cd ..
-
-echo
-echo
-
-PROFILES=`sh ${SOURCE_DIR}/tools/list_profiles.sh`
-RELEASE=`sed -n 's:^HELENOS_RELEASE \?= \?\(.*\)$:\1:p' "${SOURCE_DIR}/version"`
-SRC_ARCHIVE="HelenOS-${RELEASE}-src.tar"
-
-git -C "${SOURCE_DIR}" archive master -o "${PWD}/${SRC_ARCHIVE}"
-bzip2 -f "${SRC_ARCHIVE}"
-echo "Created ${SRC_ARCHIVE}.bz2"
-
-for profile in $PROFILES; do
-	image_name=`cat build_all/$profile/image_path`
-	if [ -z "$image_name" ]; then
-		continue
-	fi
-
-	image_path="build_all/$profile/`cat build_all/$profile/image_path`"
-	image_suffix=`echo "$image_name" | sed 's:.*\.::'`
-
-	release_name="HelenOS-${RELEASE}-`echo $profile | tr '/' '-'`.$image_suffix"
-	cp "$image_path" "$release_name"
-
-	echo "Created $release_name"
-done
Index: ols/srepl
===================================================================
--- tools/srepl	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-usage()
-{
-	echo "Usage:"
-	echo
-	echo "	$0 search_pattern [-- <pathspec> ]"
-	echo "	$0 search_pattern replacement [-- <pathspec> ]"
-	echo
-	echo "Pattern should be a basic regexp as accepted by grep and sed."
-	echo "For information on pathspec syntax, see git documentation."
-	echo
-	exit 1
-}
-
-check_unstaged()
-{
-	if ( git status --porcelain | grep '^.[^ ]' ); then
-		echo "You have unstaged changes in your tree."
-		echo "Either stage them with 'git add', commit them,"
-		echo "or discard them with 'git checkout -- .'"
-		exit 1
-	fi
-}
-
-_slashify()
-{
-	# Some shells have shoddy handling of backslashes in echo.
-	printf '%s\n' "$1" | sed 's/\([^\\]\)\//\1\\\//g'
-}
-
-if [ "$1" = "--" ]; then
-	usage
-elif [ "$1" = "-d" ]; then
-	check_unstaged
-
-	pattern=`_slashify "$2"`
-	shift
-	shift
-	git grep -I -l "$pattern" "$@" | xargs sed -i "/$pattern/d"
-
-elif [ "$#" -eq 1 ]  || [ "$2" = "--" ]; then
-	pattern=`_slashify "$1"`
-	shift
-	git grep -I -n "$pattern" "$@"
-elif [ "$#" -eq 2 ] || [ "$3" = "--" ]; then
-	check_unstaged
-
-	pattern=`_slashify "$1"`
-	replacement=`_slashify "$2"`
-	shift
-	shift
-	git grep -I -l "$pattern" "$@" | xargs sed -i "s/$pattern/$replacement/g"
-else
-	usage
-fi
Index: ols/toolchain.sh
===================================================================
--- tools/toolchain.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,649 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-BINUTILS_GDB_GIT="https://github.com/HelenOS/binutils-gdb.git"
-
-BINUTILS_BRANCH="binutils-2_43-helenos"
-BINUTILS_VERSION="2.43"
-
-GDB_BRANCH="gdb-13.2-helenos"
-GDB_VERSION="13.2"
-
-GCC_GIT="https://github.com/HelenOS/gcc.git"
-GCC_BRANCH="14_2_0-helenos"
-GCC_VERSION="14.2"
-
-BASEDIR="$PWD"
-SRCDIR="$(readlink -f $(dirname "$0"))"
-
-# If we install into a temporary directory and copy from there,
-# we don't have to trust the upstream makefiles respect the prefix for
-# all files, and we also have a ready-made package for distribution.
-INSTALL_DIR="${BASEDIR}/PKG"
-
-SYSTEM_INSTALL=false
-
-BUILD_GDB=false
-BUILD_BINUTILS=true
-BUILD_GCC=true
-
-if [ -z "$JOBS" ] ; then
-	JOBS="`nproc`"
-fi
-
-check_error() {
-	if [ "$1" -ne "0" ] ; then
-		echo
-		echo "Script failed: $2"
-
-		exit 1
-	fi
-}
-
-show_usage() {
-	echo "HelenOS cross-compiler toolchain build script"
-	echo
-	echo "Syntax:"
-	echo " $0 [--system-wide] [--with-gdb|--only-gdb] <platform>"
-	echo " $0 [--system-wide] --test-version [<platform>]"
-	echo
-	echo "Possible target platforms are:"
-	echo " amd64      AMD64 (x86-64, x64)"
-	echo " arm32      ARM 32b"
-	echo " arm64      AArch64"
-	echo " ia32       IA-32 (x86, i386)"
-	echo " ia64       IA-64 (Itanium)"
-	echo " mips32     MIPS little-endian 32b"
-	echo " mips32eb   MIPS big-endian 32b"
-	echo " ppc32      PowerPC 32b"
-	echo " riscv64    RISC-V 64b"
-	echo " sparc64    SPARC V9"
-	echo " all        build all targets"
-	echo " parallel   same as 'all', but all in parallel"
-	echo " 2-way      same as 'all', but 2-way parallel"
-	echo
-	echo "The toolchain target installation directory is determined by matching"
-	echo "the first of the following conditions:"
-	echo
-	echo " (1) If the \$CROSS_PREFIX environment variable is set, then it is"
-	echo "     used as the target installation directory."
-	echo " (2) If the --system-wide option is used, then /opt/HelenOS/cross"
-	echo "     is used as the target installation directory. This usually"
-	echo "     requires running this script with super user privileges."
-	echo " (3) In other cases, \$XDG_DATA_HOME/HelenOS/cross is used as the"
-	echo "     target installation directory. If the \$XDG_DATA_HOME environment"
-	echo "     variable is not set, then the default value of \$HOME/.local/share"
-	echo "     is assumed."
-	echo
-	echo "The --non-helenos-target option will build non-HelenOS-specific"
-	echo "toolchain (i.e. it will use *-linux-* triplet instead of *-helenos)."
-	echo "Using this toolchain for building HelenOS is not supported."
-	echo
-	echo "The --test-version mode tests the currently installed version of the"
-	echo "toolchain."
-
-	exit 3
-}
-
-set_cross_prefix() {
-	if [ -z "$CROSS_PREFIX" ] ; then
-		if $SYSTEM_INSTALL ; then
-			CROSS_PREFIX="/opt/HelenOS/cross"
-		else
-			if [ -z "$XDG_DATA_HOME" ] ; then
-				XDG_DATA_HOME="$HOME/.local/share"
-			fi
-			CROSS_PREFIX="$XDG_DATA_HOME/HelenOS/cross"
-		fi
-	fi
-}
-
-test_version() {
-	set_cross_prefix
-
-	echo "HelenOS cross-compiler toolchain build script"
-	echo
-	echo "Testing the version of the installed software in $CROSS_PREFIX"
-	echo
-
-	if [ -z "$1" ] || [ "$1" = "all" ] ; then
-		PLATFORMS='amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64'
-	else
-		PLATFORMS="$1"
-	fi
-
-	for PLATFORM in $PLATFORMS ; do
-		set_target_from_platform "$PLATFORM"
-		PREFIX="${CROSS_PREFIX}/bin/${TARGET}"
-
-		echo "== $PLATFORM =="
-		test_app_version "Binutils" "ld" "GNU ld (.*) \([.0-9]*\)" "$BINUTILS_VERSION"
-		test_app_version "GCC" "gcc" "gcc version \([.0-9]*\)" "$GCC_VERSION"
-		test_app_version "GDB" "gdb" "GNU gdb (.*)[[:space:]]\+\([.0-9]*\)" "$GDB_VERSION"
-	done
-}
-
-test_app_version() {
-	PKGNAME="$1"
-	APPNAME="$2"
-	REGEX="$3"
-	INS_VERSION="$4"
-
-	APP="${PREFIX}-${APPNAME}"
-	if [ ! -e $APP ]; then
-		echo "- $PKGNAME is missing"
-	else
-		VERSION=`${APP} -v 2>&1 | sed -n "s:^${REGEX}.*:\1:p"`
-
-		if [ -z "$VERSION" ]; then
-			echo "- $PKGNAME Unexpected output"
-			return 1
-		fi
-
-		if [ "$INS_VERSION" = "$VERSION" ]; then
-			echo "+ $PKGNAME is up-to-date ($INS_VERSION)"
-		else
-			echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
-		fi
-	fi
-}
-
-change_title() {
-	printf "\e]0;$1\a"
-}
-
-ring_bell() {
-	printf '\a'
-	sleep 0.1
-	printf '\a'
-	sleep 0.1
-	printf '\a'
-	sleep 0.1
-	printf '\a'
-	sleep 0.1
-	printf '\a'
-}
-
-show_countdown() {
-	TM="$1"
-
-	if [ "${TM}" -eq 0 ] ; then
-		echo
-		return 0
-	fi
-
-	printf "${TM} "
-	change_title "${TM}"
-	sleep 1
-
-	TM="`expr "${TM}" - 1`"
-	show_countdown "${TM}"
-}
-
-show_dependencies() {
-	set_cross_prefix
-
-	echo "HelenOS cross-compiler toolchain build script"
-	echo
-	echo "Installing software to $CROSS_PREFIX"
-	echo
-	echo
-	echo "IMPORTANT NOTICE:"
-	echo
-	echo "For a successful compilation and use of the cross-compiler"
-	echo "toolchain you need at least the following dependencies."
-	echo
-	echo "Please make sure that the dependencies are present in your"
-	echo "system. Otherwise the compilation process might fail after"
-	echo "a few seconds or minutes."
-	echo
-	echo " - SED, AWK, Flex, Bison, gzip, bzip2, Bourne Shell"
-	echo " - gettext, zlib, Texinfo, libelf, libgomp"
-	echo " - GNU Make, Coreutils, Sharutils, tar"
-	echo " - native C and C++ compiler, assembler and linker"
-	echo " - native C and C++ standard library with headers"
-	echo
-}
-
-cleanup_dir() {
-	DIR="$1"
-
-	if [ -d "${DIR}" ] ; then
-		change_title "Removing ${DIR}"
-		echo " >>> Removing ${DIR}"
-		rm -fr "${DIR}"
-	fi
-}
-
-create_dir() {
-	DIR="$1"
-	DESC="$2"
-
-	change_title "Creating ${DESC}"
-	echo ">>> Creating ${DESC}"
-
-	mkdir -p "${DIR}"
-	test -d "${DIR}"
-	check_error $? "Unable to create ${DIR}."
-}
-
-check_dirs() {
-	cd "${BASEDIR}"
-	check_error $? "Unable to change directory to ${BASEDIR}."
-	ABS_BASE="$PWD"
-
-	if $SYSTEM_INSTALL && [ ! -d "${CROSS_PREFIX}" ]; then
-		ring_bell
-		( set -x ; sudo -k mkdir -p "${CROSS_PREFIX}" )
-	else
-		mkdir -p "${CROSS_PREFIX}"
-	fi
-
-	cd "${CROSS_PREFIX}"
-	check_error $? "Unable to change directory to ${CROSS_PREFIX}."
-
-	while [ "${#PWD}" -gt "${#ABS_BASE}" ]; do
-		cd ..
-	done
-
-	if [ "$PWD" = "$ABS_BASE" ]; then
-		echo
-		echo "CROSS_PREFIX cannot reside within the working directory."
-
-		exit 5
-	fi
-
-	cd "${BASEDIR}"
-}
-
-prepare() {
-	show_dependencies
-	show_countdown 10
-
-	mkdir -p "${BASEDIR}/downloads"
-	cd "${BASEDIR}/downloads"
-	check_error $? "Change directory failed."
-
-	change_title "Downloading sources"
-	echo ">>> Downloading sources"
-
-	if $BUILD_BINUTILS ; then
-		git clone --depth 1 -b "$BINUTILS_BRANCH" "$BINUTILS_GDB_GIT" "binutils-$BINUTILS_VERSION"
-		# If the directory already existed, pull upstream changes.
-		git -C "binutils-$BINUTILS_VERSION" pull
-	fi
-
-	if $BUILD_GCC ; then
-		git clone --depth 1 -b "$GCC_BRANCH" "$GCC_GIT" "gcc-$GCC_VERSION"
-		git -C "gcc-$GCC_VERSION" pull
-
-		change_title "Downloading GCC prerequisites"
-		echo ">>> Downloading GCC prerequisites"
-		cd "gcc-${GCC_VERSION}"
-		./contrib/download_prerequisites
-		cd ..
-	fi
-
-	if $BUILD_GDB ; then
-		git clone --depth 1 -b "$GDB_BRANCH" "$BINUTILS_GDB_GIT" "gdb-$GDB_VERSION"
-		git -C "gdb-$GDB_VERSION" pull
-	fi
-
-	# This sets the CROSS_PREFIX variable
-	set_cross_prefix
-
-	DESTDIR_SPEC="DESTDIR=${INSTALL_DIR}"
-
-	check_dirs
-}
-
-set_target_from_platform() {
-	case "$1" in
-		"arm32")
-			GNU_ARCH="arm"
-			;;
-		"arm64")
-			GNU_ARCH="aarch64"
-			;;
-		"ia32")
-			GNU_ARCH="i686"
-			;;
-		"mips32")
-			GNU_ARCH="mipsel"
-			;;
-		"mips32eb")
-			GNU_ARCH="mips"
-			;;
-		"ppc32")
-			GNU_ARCH="ppc"
-			;;
-		*)
-			GNU_ARCH="$1"
-			;;
-	esac
-
-	TARGET="${GNU_ARCH}-helenos"
-}
-
-build_binutils() {
-	# This sets the TARGET variable
-	set_target_from_platform "$1"
-
-	WORKDIR="${BASEDIR}/${TARGET}"
-	BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
-
-	echo ">>> Removing previous content"
-	cleanup_dir "${WORKDIR}"
-	mkdir -p "${WORKDIR}"
-
-	echo ">>> Processing binutils (${TARGET})"
-	mkdir -p "${BINUTILSDIR}"
-	cd "${BINUTILSDIR}"
-	check_error $? "Change directory failed."
-
-	change_title "binutils: configure (${TARGET})"
-	CFLAGS="-Wno-error -fcommon" "${BASEDIR}/downloads/binutils-${BINUTILS_VERSION}/configure" \
-		"--target=${TARGET}" \
-		"--prefix=${CROSS_PREFIX}" \
-		"--program-prefix=${TARGET}-" \
-		--disable-nls \
-		--disable-werror \
-		--enable-gold \
-		--enable-deterministic-archives \
-		--disable-gdb \
-		--with-sysroot
-	check_error $? "Error configuring binutils."
-
-	change_title "binutils: make (${TARGET})"
-	make all -j$JOBS
-	check_error $? "Error compiling binutils."
-
-	change_title "binutils: install (${TARGET})"
-	make install $DESTDIR_SPEC
-	check_error $? "Error installing binutils."
-}
-
-build_gcc() {
-	# This sets the TARGET variable
-	set_target_from_platform "$1"
-
-	WORKDIR="${BASEDIR}/${TARGET}"
-	GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
-
-	echo ">>> Removing previous content"
-	cleanup_dir "${WORKDIR}"
-	mkdir -p "${WORKDIR}"
-
-	echo ">>> Processing GCC (${TARGET})"
-	mkdir -p "${GCCDIR}"
-	cd "${GCCDIR}"
-	check_error $? "Change directory failed."
-
-	BUILDPATH="${CROSS_PREFIX}/bin:${PATH}"
-
-	change_title "GCC: configure (${TARGET})"
-	PATH="${BUILDPATH}" "${BASEDIR}/downloads/gcc-${GCC_VERSION}/configure" \
-		"--target=${TARGET}" \
-		"--prefix=${CROSS_PREFIX}" \
-		"--program-prefix=${TARGET}-" \
-		--with-gnu-as \
-		--with-gnu-ld \
-		--disable-nls \
-		--enable-languages=c,c++,go \
-		--enable-lto \
-		--enable-obsolete \
-		--disable-shared \
-		--disable-werror \
-		--without-headers  # TODO: Replace with proper sysroot so we can build more libs
-	check_error $? "Error configuring GCC."
-
-	change_title "GCC: make (${TARGET})"
-	PATH="${BUILDPATH}" make all-gcc -j$JOBS
-	check_error $? "Error compiling GCC."
-
-	change_title "GCC: install (${TARGET})"
-	PATH="${BUILDPATH}" make install-gcc $DESTDIR_SPEC
-	check_error $? "Error installing GCC."
-}
-
-build_libgcc() {
-	# This sets the TARGET variable
-	set_target_from_platform "$1"
-
-	WORKDIR="${BASEDIR}/${TARGET}"
-	GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
-
-	# No removing previous content here, we need the previous GCC build
-
-	cd "${GCCDIR}"
-	check_error $? "Change directory failed."
-
-	BUILDPATH="${CROSS_PREFIX}/bin:${PATH}"
-
-	change_title "libgcc: make (${TARGET})"
-
-	PATH="${BUILDPATH}" make all-target-libgcc -j$JOBS
-	check_error $? "Error compiling libgcc."
-	# TODO: libatomic and libstdc++ need some extra care
-	#    PATH="${BUILDPATH}" make all-target-libatomic -j$JOBS
-	#    check_error $? "Error compiling libatomic."
-	#    PATH="${BUILDPATH}" make all-target-libstdc++-v3 -j$JOBS
-	#    check_error $? "Error compiling libstdc++."
-
-	change_title "libgcc: install (${TARGET})"
-
-	PATH="${BUILDPATH}" make install-target-libgcc $DESTDIR_SPEC
-	#    PATH="${BUILDPATH}" make install-target-libatomic $DESTDIR_SPEC
-	#    PATH="${BUILDPATH}" make install-target-libstdc++-v3 $DESTDIR_SPEC
-	check_error $? "Error installing libgcc."
-}
-
-build_gdb() {
-	# This sets the TARGET variable
-	set_target_from_platform "$1"
-
-	WORKDIR="${BASEDIR}/${TARGET}"
-	GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}"
-
-	echo ">>> Removing previous content"
-	cleanup_dir "${WORKDIR}"
-	mkdir -p "${WORKDIR}"
-
-	echo ">>> Processing GDB (${TARGET})"
-	mkdir -p "${GDBDIR}"
-	cd "${GDBDIR}"
-	check_error $? "Change directory failed."
-
-	change_title "GDB: configure (${TARGET})"
-	CFLAGS="-fcommon" "${BASEDIR}/downloads/gdb-${GDB_VERSION}/configure" \
-		"--target=${TARGET}" \
-		"--prefix=${CROSS_PREFIX}" \
-		"--program-prefix=${TARGET}-" \
-		--enable-werror=no
-	check_error $? "Error configuring GDB."
-
-	change_title "GDB: make (${TARGET})"
-	make all-gdb -j$JOBS
-	check_error $? "Error compiling GDB."
-
-	change_title "GDB: install (${TARGET})"
-	make install-gdb $DESTDIR_SPEC
-	check_error $? "Error installing GDB."
-}
-
-install_pkg() {
-	echo ">>> Moving to the destination directory."
-	if $SYSTEM_INSTALL ; then
-		ring_bell
-		( set -x ; sudo -k cp -r -t "${CROSS_PREFIX}" "${INSTALL_DIR}${CROSS_PREFIX}/"* )
-	else
-		( set -x ; cp -r -t "${CROSS_PREFIX}" "${INSTALL_DIR}${CROSS_PREFIX}/"* )
-	fi
-}
-
-link_clang() {
-	# Symlink clang and lld to the install path.
-	CLANG="`which clang 2> /dev/null || echo "/usr/bin/clang"`"
-	CLANGPP="`which clang++ 2> /dev/null || echo "/usr/bin/clang++"`"
-	LLD="`which ld.lld 2> /dev/null || echo "/usr/bin/ld.lld"`"
-
-	ln -s $CLANG "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-clang"
-	ln -s $CLANGPP "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-clang++"
-	ln -s $LLD "${INSTALL_DIR}${CROSS_PREFIX}/bin/${TARGET}-ld.lld"
-}
-
-while [ "$#" -gt 1 ] ; do
-	case "$1" in
-		--system-wide)
-			SYSTEM_INSTALL=true
-			shift
-			;;
-		--test-version)
-			test_version "$2"
-			exit
-			;;
-		--with-gdb)
-			BUILD_GDB=true
-			shift
-			;;
-		--only-gdb)
-			BUILD_GDB=true
-			BUILD_BINUTILS=false
-			BUILD_GCC=false
-			shift
-			;;
-		*)
-			show_usage
-			;;
-	esac
-done
-
-if [ "$#" -lt "1" ] ; then
-	show_usage
-fi
-
-PLATFORMS="amd64 arm32 arm64 ia32 ia64 mips32 mips32eb ppc32 riscv64 sparc64"
-
-run_one() {
-	$1 $PLATFORM
-}
-
-run_all() {
-	for x in $PLATFORMS ; do
-		$1 $x
-	done
-}
-
-run_parallel() {
-	for x in $PLATFORMS ; do
-		$1 $x &
-	done
-	wait
-}
-
-run_2way() {
-	$1 amd64 &
-	$1 arm32 &
-	wait
-
-	$1 arm64 &
-	$1 ia32 &
-	wait
-
-	$1 ia64 &
-	$1 mips32 &
-	wait
-
-	$1 mips32eb &
-	$1 ppc32 &
-	wait
-
-	$1 riscv64 &
-	$1 sparc64 &
-	wait
-}
-
-everything() {
-	RUNNER="$1"
-
-	prepare
-
-	if $BUILD_BINUTILS ; then
-		$RUNNER build_binutils
-
-		if $BUILD_GCC ; then
-			# gcc/libgcc may fail to build correctly if binutils is not installed first
-			echo ">>> Installing binutils"
-			install_pkg
-		fi
-	fi
-
-	if $BUILD_GCC ; then
-		$RUNNER build_gcc
-
-		# libgcc may fail to build correctly if gcc is not installed first
-		echo ">>> Installing GCC"
-		install_pkg
-
-		$RUNNER build_libgcc
-	fi
-
-	if $BUILD_GDB ; then
-		$RUNNER build_gdb
-	fi
-
-	echo ">>> Installing all files"
-	install_pkg
-
-	link_clang
-}
-
-case "$1" in
-	--test-version)
-		test_version
-		exit
-		;;
-	amd64|arm32|arm64|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
-		PLATFORM="$1"
-		everything run_one
-		;;
-	"all")
-		everything run_all
-		;;
-	"parallel")
-		everything run_parallel
-		;;
-	"2-way")
-		everything run_2way
-		;;
-	*)
-		show_usage
-		;;
-esac
Index: ols/travis.sh
===================================================================
--- tools/travis.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,237 +1,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2018 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# This is wrapper script for testing build of HelenOS under Travis CI [1].
-#
-# You probably do not want to run this script directly. If you wish to test
-# that HelenOS builds for all architectures, consider using either check.sh
-# script or running our CI solution [2] (if you want to test ported software
-# too).
-#
-# [1] https://travis-ci.org/
-# [2] https://www.helenos.org/wiki/CI
-#
-
-H_ARCH_CONFIG_CROSS_TARGET=2
-H_ARCH_CONFIG_OUTPUT_FILENAME=3
-
-h_get_arch_config_space() {
-    cat <<'EOF_CONFIG_SPACE'
-amd64:amd64-helenos:image.iso
-arm32/beagleboardxm:arm-helenos:uImage.bin
-arm32/beaglebone:arm-helenos:uImage.bin
-arm32/gta02:arm-helenos:uImage.bin
-arm32/integratorcp:arm-helenos:image.boot
-arm32/raspberrypi:arm-helenos:uImage.bin
-arm64/virt:aarch64-helenos:image.iso
-ia32:i686-helenos:image.iso
-ia64/i460GX:ia64-helenos:image.boot
-ia64/ski:ia64-helenos:image.boot
-mips32/malta-be:mips-helenos:image.boot
-mips32/malta-le:mipsel-helenos:image.boot
-mips32/msim:mipsel-helenos:image.boot
-ppc32:ppc-helenos:image.iso
-sparc64/niagara:sparc64-helenos:image.iso
-sparc64/ultra:sparc64-helenos:image.iso
-EOF_CONFIG_SPACE
-}
-
-h_get_arch_config() {
-    h_get_arch_config_space | grep "^$H_ARCH:" | cut '-d:' -f "$1"
-}
-
-H_DEFAULT_HARBOURS_LIST="binutils fdlibm jainja libgmp libiconv msim pcc zlib libisl libmpfr libpng python2 libmpc gcc"
-
-
-
-#
-# main script starts here
-#
-
-# Check we are actually running inside Travis
-if [ -z "$TRAVIS" ]; then
-    echo "\$TRAVIS env not set. Are you running me inside Travis?" >&2
-    exit 5
-fi
-
-# C style check
-if [ -n "$H_CCHECK" ]; then
-    echo "Will try to run C style check."
-    echo
-    cd tools
-    ./build-ccheck.sh || exit 1
-    cd ..
-    tools/ccheck.sh || exit 1
-    echo "C style check passed."
-    exit 0
-fi
-
-# Check HelenOS configuration was set-up
-if [ -z "$H_ARCH" ]; then
-    echo "\$H_ARCH env not set. Are you running me inside Travis?" >&2
-    exit 5
-fi
-
-# Check cross-compiler target
-H_CROSS_TARGET=`h_get_arch_config $H_ARCH_CONFIG_CROSS_TARGET`
-if [ -z "$H_CROSS_TARGET" ]; then
-    echo "No suitable cross-target found for '$H_ARCH.'" >&2
-    exit 1
-fi
-
-# Default Harbours repository
-if [ -z "$H_HARBOURS_REPOSITORY" ]; then
-    H_HARBOURS_REPOSITORY="https://github.com/HelenOS/harbours.git"
-fi
-
-if [ "$1" = "help" ]; then
-    echo
-    echo "Following variables needs to be set prior running this script."
-    echo "Example settings follows:"
-    echo
-    echo "export H_ARCH=$H_ARCH"
-    echo "export TRAVIS_BUILD_ID=`date +%s`"
-    echo
-    echo "export H_HARBOURS=true"
-    echo "export H_HARBOUR_LIST=\"$H_DEFAULT_HARBOURS_LIST\""
-    echo
-    echo "or"
-    echo
-    echo "export H_CCHECK=true"
-    echo
-    exit 0
-
-elif [ "$1" = "install" ]; then
-    set -x
-
-    # Fetch and install cross-compiler
-    wget "https://helenos.s3.amazonaws.com/toolchain/$H_CROSS_TARGET.tar.xz" -O "/tmp/$H_CROSS_TARGET.tar.xz" || exit 1
-    sudo tar -xJ -C "/" -f "/tmp/$H_CROSS_TARGET.tar.xz" || exit 1
-    exit 0
-
-elif [ "$1" = "run" ]; then
-    set -x
-
-    # Expected output filename (bootable image)
-    H_OUTPUT_FILENAME=`h_get_arch_config $H_ARCH_CONFIG_OUTPUT_FILENAME`
-    if [ -z "$H_OUTPUT_FILENAME" ]; then
-        echo "No suitable output image found for '$H_ARCH.'" >&2
-        exit 1
-    fi
-
-    # Build HARBOURs too?
-    H_HARBOURS=`echo "$H_HARBOURS" | grep -e '^true$' -e '^false$'`
-    if [ -z "$H_HARBOURS" ]; then
-        H_HARBOURS=false
-    fi
-    if [ -z "$H_HARBOUR_LIST" ]; then
-        H_HARBOUR_LIST="$H_DEFAULT_HARBOURS_LIST"
-    fi
-
-    # Build it
-    SRCDIR="$PWD"
-
-    mkdir -p build/$H_ARCH || exit 1
-    cd build/$H_ARCH
-
-    export PATH="/usr/local/cross/bin:$PATH"
-
-    $SRCDIR/configure.sh $H_ARCH || exit 1
-    ninja || exit 1
-    ninja image_path || exit 1
-
-    cd $SRCDIR
-
-    echo
-    echo "HelenOS for $H_ARCH built okay."
-    echo
-
-    # Build harbours
-    if $H_HARBOURS; then
-        echo
-        echo "Will try to build ported software for $H_ARCH."
-        echo "Repository used is $H_HARBOURS_REPOSITORY."
-        echo
-
-        H_HELENOS_HOME=`pwd`
-        cd "$HOME" || exit 1
-        git clone --depth 10 "$H_HARBOURS_REPOSITORY" helenos-harbours || exit 1
-        mkdir "build-harbours-$TRAVIS_BUILD_ID" || exit 1
-        (
-            cd "build-harbours-$TRAVIS_BUILD_ID" || exit 1
-            mkdir build || exit 1
-            cd build
-
-            (
-                #[ "$H_ARCH" = "mips32/malta-be" ] && H_ARCH="mips32eb/malta-be"
-                echo "root = $H_HELENOS_HOME"
-                echo "arch =" `echo "$H_ARCH" | cut -d/ -f 1`
-                echo "machine =" `echo "$H_ARCH" | cut -d/ -f 2`
-            ) >hsct.conf || exit 1
-
-            "$HOME/helenos-harbours/hsct.sh" init "$H_HELENOS_HOME" $H_ARCH || exit 1
-
-            # We cannot flood the output as Travis has limit of maximum output size
-            # (reason is to prevent endless stacktraces going forever). But also Travis
-            # kills a job that does not print anything for a while.
-            #
-            # So we store the full output into a file  and print single dot for each line.
-            # As pipe tends to hide errors we check the success by checking that archive
-            # exists.
-            #
-            FAILED_HARBOURS=""
-            for HARBOUR in $H_HARBOUR_LIST; do
-                "$HOME/helenos-harbours/hsct.sh" archive --no-deps "$HARBOUR" 2>&1 | tee "run-$HARBOUR.log" | awk '// {printf "."}'
-
-                test -s "archives/$HARBOUR.tar.xz"
-                if [ $? -eq 0 ]; then
-                    tail -n 10 "run-$HARBOUR.log"
-                else
-                    FAILED_HARBOURS="$FAILED_HARBOURS $HARBOUR"
-                    cat build/$HARBOUR/*/config.log
-                    tail -n 100 "run-$HARBOUR.log"
-                fi
-
-            done
-
-            if [ -n "$FAILED_HARBOURS" ]; then
-                echo
-                echo "ERROR: following packages were not built:$FAILED_HARBOURS."
-                echo
-                exit 1
-            fi
-        ) || exit 1
-    fi
-else
-    echo "Invalid action specified." >&2
-    exit 5
-fi
-
Index: ols/xcw/bin/helenos-bld-config
===================================================================
--- tools/xcw/bin/helenos-bld-config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Get build configration information
-# HelenOS Cross Compiler Wrapper (XCW)
-# Facilitate cross-compiling external software to HelenOS
-#
-
-XCW="$(dirname "$0")"
-BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
-if [ -z "$EXPORT_DIR" ]; then
-	EXPORT_DIR="$BUILD_ROOT/export"
-fi
-
-HELENOS_EXPORT_ROOT="$EXPORT_DIR"
-
-source "${EXPORT_DIR}/config.sh"
-
-case ".$1" in
-*.--install-dir) echo "$HELENOS_OVERLAY_PATH";;
-(*)
-	echo "Unknown option $1" >&2
-	echo "Usage: helenos-bld-config <option>" >&2
-	echo "        --install-dir Print directory where files should be installed" >&2
-	exit 1;;
-esac
Index: ols/xcw/bin/helenos-cc
===================================================================
--- tools/xcw/bin/helenos-cc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# C Compiler (cc) wrapper
-# HelenOS Cross Compiler Wrapper (XCW)
-# Facilitate cross-compiling external software to HelenOS
-#
-
-
-
-XCW="$(dirname "$0")"
-BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
-if [ -z "$EXPORT_DIR" ]; then
-	EXPORT_DIR="$BUILD_ROOT/export"
-fi
-
-HELENOS_EXPORT_ROOT="$EXPORT_DIR"
-
-source "${EXPORT_DIR}/config.sh"
-
-# CC is a compilation driver, so we should check which stage of compilation
-# is actually running and select which flags to provide. This makes no
-# difference for GCC, but e.g. clang warns when a flag is provided that is
-# unused
-
-needs_cflags=true
-needs_ldflags=true
-
-for flag in "$@"; do
-	case "$flag" in
-		-E)
-			needs_cflags=false
-			needs_ldflags=false
-			break
-			;;
-		-c|-S)
-			needs_ldflags=false
-			break
-			;;
-	esac
-done
-
-flags="-fwide-exec-charset=UTF-32LE -finput-charset=UTF-8 -fexec-charset=UTF-8"
-flags="$flags -isystem ${HELENOS_EXPORT_ROOT}/include/libc -idirafter ${HELENOS_EXPORT_ROOT}/include"
-
-if $needs_cflags; then
-	flags="$flags -O3 \
-	    -Wall -Wextra -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes \
-	    -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings -ggdb"
-
-	flags="$flags $HELENOS_CFLAGS"
-fi
-
-if $needs_ldflags; then
-	flags="$flags $HELENOS_LDFLAGS"
-fi
-
-flags="$flags $@"
-
-if $needs_ldflags; then
-	flags="$flags $HELENOS_LDLIBS"
-fi
-
-echo "helenos-cc" "$@"
-PATH="$HELENOS_CROSS_PATH:$PATH" "${HELENOS_TARGET}-gcc" $flags
Index: ols/xcw/bin/helenos-ld
===================================================================
--- tools/xcw/bin/helenos-ld	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-helenos-cc
Index: ols/xcw/bin/helenos-pkg-config
===================================================================
--- tools/xcw/bin/helenos-pkg-config	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-#!/usr/bin/env python3
-
-#
-# Copyright (c) 2024 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# pkg-config-like tool for HelenOS libraries
-# HelenOS Cross Compiler Wrapper (XCW)
-# Facilitate cross-compiling external software to HelenOS
-#
-
-
-import argparse
-import os
-import sys
-
-# Package dependencies: always list only immediate dependencies so that
-# we can get proper ordering for static libraries
-CONFIG_DEPENDENCIES = {
-    'libui': ['libdisplay', 'libcongfx', 'libgfxfont', 'libriff', 'libmemgfx', 'libconsole'],
-    'libdisplay': ['libgfx', 'libipcgfx', 'libinput'],
-    'libconsole': ['libinput', 'liboutput'],
-    'libipcfgfx': ['libgfx'],
-    'libgfximage': ['libpixconv'],
-}
-
-CONFIG_CFLAGS = {
-}
-
-CONFIG_LIBS = {
-}
-
-def get_with_dependencies(package, dependencies_first=True):
-    deps = CONFIG_DEPENDENCIES.get(package, [])
-    all_deps = [
-        i
-        for d in deps
-        for i in get_with_dependencies(d, dependencies_first)
-    ]
-    result = (all_deps if dependencies_first else []) + [package] + ([] if dependencies_first else all_deps)
-    seen = set()
-    return [
-        i
-        for i in result
-        if not (i in seen or seen.add(i))
-    ]
-
-def get_build_root():
-    dn = lambda x : os.path.dirname(x)
-    return dn(dn(dn(dn(os.path.abspath(sys.argv[0])))))
-
-def main():
-    args = argparse.ArgumentParser(description='pkg-config-like tool for HelenOS')
-    args.add_argument(
-        '--cflags',
-        dest='cflags',
-        action='store_true',
-        default=False,
-        help='Print required C compiler flags to stdout.'
-    )
-    args.add_argument(
-        '--libs',
-        dest='libs',
-        action='store_true',
-        default=False,
-        help='Print required linker flags to stdout.'
-    )
-    args.add_argument('packages', metavar='PACKAGE', nargs='+')
-
-    config = args.parse_args()
-
-    export_dir = os.getenv('EXPORT_DIR', get_build_root() + '/export')
-
-    result = []
-    for package in config.packages:
-        if config.cflags:
-            for i in get_with_dependencies(package, False):
-                if i in CONFIG_CFLAGS:
-                    result.extend(CONFIG_CFLAGS[i])
-                else:
-                    result.append(f'-I{export_dir}/include/{i}')
-        if config.libs:
-            for i in get_with_dependencies(package, False):
-                if i in CONFIG_LIBS:
-                    result.extend(CONFIG_LIBS[i])
-                else:
-                    result.append(f'{export_dir}/lib/{i}.a')
-
-    print(' '.join(result))
-
-
-if __name__ == '__main__':
-    main()
Index: ols/xcw/bin/helenos-test
===================================================================
--- tools/xcw/bin/helenos-test	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Test run in emulator
-# HelenOS Cross Compiler Wrapper (XCW)
-# Facilitate cross-compiling external software to HelenOS
-#
-
-XCW="$(dirname "$0")"
-BUILD_ROOT="$(dirname "$(dirname "$(dirname "$XCW")")")"
-
-cd "$BUILD_ROOT"
-ninja image_path
-tools/ew.py
Index: ols/xcw/demo/Makefile
===================================================================
--- tools/xcw/demo/Makefile	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Example cross-build for HelenOS using XCW (HelenOS Cross Compiler Wrapper)
-# This allows an external (cross-platform) application to be compiled for
-# HelenOS by changing the compiler/linker helenos-cc/helenos-ld and adding
-# platform-specific support. To configure use of HelenOS libraries one can use
-# helenos-pkg-config. The HelenOS source tree containing XCW must be configured
-# and build for XCW to work as a cross compiler.
-#
-# Example commands to build this demo:
-#
-#    cd <helenos-source-dir>
-#    mkdir build
-#    cd build
-#    ../configure.sh
-#    ninja
-#    ../tools/export.sh export
-#    cd ../tools/xcw/demo
-#    export PATH=$PATH:<helenos-source-dir>/build/tools/xcw/bin
-#    make
-#
-
-CC = helenos-cc
-LD = helenos-ld
-INSTALL = install
-TEST = helenos-test
-CFLAGS = -std=gnu11 -Wall `helenos-pkg-config --cflags libui libgfximage` \
-    -D_HELENOS_SOURCE
-LIBS = `helenos-pkg-config --libs libui libgfximage`
-PREFIX = `helenos-bld-config --install-dir`
-output = viewer
-objects = viewer.o
-
-default: $(output)
-all: $(output)
-
-clean:
-	rm -f $(output) $(objects)
-
-install: $(output)
-	mkdir -p $(PREFIX)/app
-	$(INSTALL) -T $(output) $(PREFIX)/app/$(output)-xcw
-
-uninstall:
-	rm -f $(PREFIX)/app/$(output)-xcw
-
-test: install
-	$(TEST)
-
-$(output): $(objects)
-	$(CC) -o $@ $^ $(LIBS)
-
-%.o: %.c
-	$(CC) -c $(CFLAGS) -o $@ $<
Index: ols/xcw/demo/viewer.c
===================================================================
--- tools/xcw/demo/viewer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../uspace/app/viewer/viewer.c
Index: ols/xstruct.py
===================================================================
--- tools/xstruct.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-#
-# Copyright (c) 2008 Martin Decky
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Convert descriptive structure definitions to structure object
-"""
-
-import struct
-import sys
-import types
-
-# Handle long integer conversions nicely in both Python 2 and Python 3
-integer_types = (int, long) if sys.version < '3' else (int,)
-
-# Ensure that 's' format for struct receives correct data type depending
-# on Python version (needed due to different way to encode into bytes)
-ensure_string = \
-	(lambda value: value if type(value) is str else bytes(value)) \
-		if sys.version < '3' else \
-	(lambda value: bytes(value, 'ascii') if type(value) is str else value)
-
-ranges = {
-	'B': (integer_types, 0x00, 0xff),
-	'H': (integer_types, 0x0000, 0xffff),
-	'L': (integer_types, 0x00000000, 0xffffffff),
-	'Q': (integer_types, 0x0000000000000000, 0xffffffffffffffff),
-	'b': (integer_types, -0x80, 0x7f),
-	'h': (integer_types, -0x8000, 0x7fff),
-	'l': (integer_types, -0x80000000, 0x7fffffff) ,
-	'q': (integer_types, -0x8000000000000000, 0x7fffffffffffffff),
-}
-
-def check_range(varname, fmt, value):
-	if value == None:
-		raise ValueError('Variable "%s" not set' % varname)
-	if not fmt in ranges:
-		return
-	vartype, varmin, varmax = ranges[fmt]
-	if not isinstance(value, vartype):
-		raise ValueError('Variable "%s" is %s but should be %s' %
-		                 (varname, str(type(value)), str(vartype)))
-	if value < varmin or value > varmax:
-		raise ValueError('Variable "%s" value %s out of range %s..%s' %
-		                 (varname, repr(value), repr(varmin), repr(varmax)))
-
-class Struct:
-	def size(self):
-		return struct.calcsize(self._format_)
-
-	def pack(self):
-		args = []
-		for variable, fmt, length in self._args_:
-			value = self.__dict__[variable]
-			if isinstance(value, list):
-				if length != None and length != len(value):
-					raise ValueError('Variable "%s" length %u does not match %u' %
-				                      (variable, len(value), length))
-				for index, item in enumerate(value):
-					check_range(variable + '[' + repr(index) + ']', fmt, item)
-					args.append(item)
-			else:
-				if (fmt == "s"):
-					value = ensure_string(value)
-				check_range(variable, fmt, value)
-				args.append(value)
-		return struct.pack(self._format_, *args)
-
-	def unpack(self, data):
-		values = struct.unpack(self._format_, data)
-		i = 0
-		for variable, fmt, length in self._args_:
-			self.__dict__[variable] = values[i]
-			i += 1
-
-def create(definition):
-	"Create structure object"
-
-	tokens = definition.split(None)
-
-	# Initial byte order tag
-	format = {
-		"little:":  lambda: "<",
-		"big:":     lambda: ">",
-		"network:": lambda: "!"
-	}[tokens[0]]()
-	inst = Struct()
-	args = []
-
-	# Member tags
-	comment = False
-	variable = None
-	for token in tokens[1:]:
-		if (comment):
-			if (token == "*/"):
-				comment = False
-			continue
-
-		if (token == "/*"):
-			comment = True
-			continue
-
-		if (variable != None):
-			subtokens = token.split("[")
-
-			length = None
-			if (len(subtokens) > 1):
-				length = int(subtokens[1].split("]")[0])
-				format += "%d" % length
-
-			format += variable
-
-			inst.__dict__[subtokens[0]] = None
-			args.append((subtokens[0], variable, length))
-
-			variable = None
-			continue
-
-		if (token[0:8] == "padding["):
-			size = token[8:].split("]")[0]
-			format += "%dx" % int(size)
-			continue
-
-		variable = {
-			"char":     lambda: "s",
-			"uint8_t":  lambda: "B",
-			"uint16_t": lambda: "H",
-			"uint32_t": lambda: "L",
-			"uint64_t": lambda: "Q",
-
-			"int8_t":   lambda: "b",
-			"int16_t":  lambda: "h",
-			"int32_t":  lambda: "l",
-			"int64_t":  lambda: "q"
-		}[token]()
-
-	inst.__dict__['_format_'] = format
-	inst.__dict__['_args_'] = args
-	return inst
Index: ols/xtui.py
===================================================================
--- tools/xtui.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-#
-# Copyright (c) 2009 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-"""
-Text User Interface wrapper
-"""
-
-import sys
-import os
-
-def call_dlg(dlgcmd, *args, **kw):
-	"Wrapper for calling 'dialog' program"
-
-	indesc, outdesc = os.pipe()
-	pid = os.fork()
-	if (not pid):
-		os.dup2(outdesc, 2)
-		os.close(indesc)
-
-		dlgargs = [dlgcmd]
-		for key, val in kw.items():
-			dlgargs.append('--' + key)
-			dlgargs.append(val)
-
-		dlgargs += args
-		os.execlp(dlgcmd, *dlgargs)
-
-	os.close(outdesc)
-
-	try:
-		errout = os.fdopen(indesc, 'r')
-		data = errout.read()
-		errout.close()
-		pid, status = os.wait()
-	except:
-		# Reset terminal
-		os.system('reset')
-		raise
-
-	if (not os.WIFEXITED(status)):
-		# Reset terminal
-		os.system('reset')
-		raise EOFError
-
-	status = os.WEXITSTATUS(status)
-	if (status == 255):
-		raise EOFError
-
-	return (status, data)
-
-try:
-	import snack
-	newt = True
-	dialog = False
-except ImportError:
-	newt = False
-
-	dlgcmd = os.environ.get('DIALOG', 'dialog')
-	if (call_dlg(dlgcmd, '--print-maxsize')[0] != 0):
-		dialog = False
-	else:
-		dialog = True
-
-width_extra = 13
-height_extra = 11
-
-def width_fix(screen, width):
-	"Correct width to screen size"
-
-	if (width + width_extra > screen.width):
-		width = screen.width - width_extra
-
-	if (width <= 0):
-		width = screen.width
-
-	return width
-
-def height_fix(screen, height):
-	"Correct height to screen size"
-
-	if (height + height_extra > screen.height):
-		height = screen.height - height_extra
-
-	if (height <= 0):
-		height = screen.height
-
-	return height
-
-def screen_init():
-	"Initialize the screen"
-
-	if (newt):
-		return snack.SnackScreen()
-
-	return None
-
-def screen_done(screen):
-	"Cleanup the screen"
-
-	if (newt):
-		screen.finish()
-
-def choice_window(screen, title, text, options, position):
-	"Create options menu"
-
-	maxopt = 0
-	for option in options:
-		length = len(option)
-		if (length > maxopt):
-			maxopt = length
-
-	width = maxopt
-	height = len(options)
-
-	if (newt):
-		width = width_fix(screen, width + width_extra)
-		height = height_fix(screen, height)
-
-		if (height > 3):
-			large = True
-		else:
-			large = False
-
-		buttonbar = snack.ButtonBar(screen, ('Done', 'Cancel'))
-		textbox = snack.TextboxReflowed(width, text)
-		listbox = snack.Listbox(height, scroll = large, returnExit = 1)
-
-		cnt = 0
-		for option in options:
-			listbox.append(option, cnt)
-			cnt += 1
-
-		if (position != None):
-			listbox.setCurrent(position)
-
-		grid = snack.GridForm(screen, title, 1, 3)
-		grid.add(textbox, 0, 0)
-		grid.add(listbox, 0, 1, padding = (0, 1, 0, 1))
-		grid.add(buttonbar, 0, 2, growx = 1)
-
-		retval = grid.runOnce()
-
-		return (buttonbar.buttonPressed(retval), listbox.current())
-	elif (dialog):
-		if (width < 35):
-			width = 35
-
-		args = []
-		cnt = 0
-		for option in options:
-			args.append(str(cnt + 1))
-			args.append(option)
-
-			cnt += 1
-
-		kw = {}
-		if (position != None):
-			kw['default-item'] = str(position + 1)
-
-		status, data = call_dlg(dlgcmd, '--title', title, '--extra-button', '--extra-label', 'Done', '--menu', text, str(height + height_extra), str(width + width_extra), str(cnt), *args, **kw)
-
-		if (status == 1):
-			return ('cancel', None)
-
-		try:
-			choice = int(data) - 1
-		except ValueError:
-			return ('cancel', None)
-
-		if (status == 0):
-			return (None, choice)
-
-		return ('done', choice)
-
-	sys.stdout.write("\n *** %s *** \n%s\n\n" % (title, text))
-
-	maxcnt = len(str(len(options)))
-	cnt = 0
-	for option in options:
-		sys.stdout.write("%*s. %s\n" % (maxcnt, cnt + 1, option))
-		cnt += 1
-
-	sys.stdout.write("\n%*s. Done\n" % (maxcnt, '0'))
-	sys.stdout.write("%*s. Quit\n\n" % (maxcnt, 'q'))
-
-	while True:
-		if (position != None):
-			sys.stdout.write("Selection[%s]: " % str(position + 1))
-		else:
-			if (cnt > 0):
-				sys.stdout.write("Selection[1]: ")
-			else:
-				sys.stdout.write("Selection[0]: ")
-		inp = sys.stdin.readline()
-
-		if (not inp):
-			raise EOFError
-
-		if (not inp.strip()):
-			if (position != None):
-				return (None, position)
-			else:
-				if (cnt > 0):
-					inp = '1'
-				else:
-					inp = '0'
-
-		if (inp.strip() == 'q'):
-			return ('cancel', None)
-
-		try:
-			choice = int(inp.strip())
-		except ValueError:
-			continue
-
-		if (choice == 0):
-			return ('done', 0)
-
-		if (choice < 1) or (choice > len(options)):
-			continue
-
-		return (None, choice - 1)
-
-def error_dialog(screen, title, msg):
-	"Print error dialog"
-
-	width = len(msg)
-
-	if (newt):
-		width = width_fix(screen, width)
-
-		buttonbar = snack.ButtonBar(screen, ['Ok'])
-		textbox = snack.TextboxReflowed(width, msg)
-
-		grid = snack.GridForm(screen, title, 1, 2)
-		grid.add(textbox, 0, 0, padding = (0, 0, 0, 1))
-		grid.add(buttonbar, 0, 1, growx = 1)
-		grid.runOnce()
-	elif (dialog):
-		call_dlg(dlgcmd, '--title', title, '--msgbox', msg, '6', str(width + width_extra))
-	else:
-		sys.stdout.write("\n%s: %s\n" % (title, msg))
Index: pace/app/aboutos/aboutos.c
===================================================================
--- uspace/app/aboutos/aboutos.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,374 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup aboutos
- * @{
- */
-/** @file About HelenOS
- */
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <gfximage/tga.h>
-#include <macros.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <ui/fixed.h>
-#include <ui/image.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-#include "aboutos.h"
-#include "images.h"
-
-#define NAME  "aboutos"
-
-static void aboutos_wnd_close(ui_window_t *, void *);
-static void aboutos_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = aboutos_wnd_close,
-	.kbd = aboutos_wnd_kbd
-};
-
-static void pb_clicked(ui_pbutton_t *, void *);
-
-static ui_pbutton_cb_t pbutton_cb = {
-	.clicked = pb_clicked
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (aboutos)
- */
-static void aboutos_wnd_close(ui_window_t *window, void *arg)
-{
-	aboutos_t *aboutos = (aboutos_t *) arg;
-
-	ui_quit(aboutos->ui);
-}
-
-/** About HelenOS window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (ui_prompt_dialog_t *)
- * @param event Keyboard event
- */
-static void aboutos_wnd_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	aboutos_t *aboutos = (aboutos_t *) arg;
-
-	(void)window;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_SHIFT | KM_ALT)) == 0) {
-		if (event->key == KC_ENTER) {
-			/* Quit */
-			ui_quit(aboutos->ui);
-
-		}
-	}
-
-	ui_window_def_kbd(window, event);
-}
-
-/** Push button was clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (aboutos)
- */
-static void pb_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	aboutos_t *aboutos = (aboutos_t *) arg;
-
-	ui_quit(aboutos->ui);
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [-d <display-spec>]\n", NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	int i;
-	aboutos_t aboutos;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_resource_t *ui_res;
-	gfx_bitmap_params_t logo_params;
-	gfx_bitmap_t *logo_bmp;
-	gfx_context_t *gc;
-	gfx_rect_t logo_rect;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	const char *dspec = UI_ANY_DEFAULT;
-	errno_t rc;
-
-	i = 1;
-	while (i < argc) {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			dspec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	rc = ui_create(dspec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", dspec);
-		return rc;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "About HelenOS";
-	params.placement = ui_wnd_place_center;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 45;
-		params.rect.p1.y = 15;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 350;
-		params.rect.p1.y = 275;
-	}
-
-	memset((void *) &aboutos, 0, sizeof(aboutos));
-	aboutos.ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &aboutos);
-	aboutos.window = window;
-
-	ui_res = ui_window_get_res(window);
-	gc = ui_window_get_gc(window);
-
-	rc = decode_tga(gc, (void *) helenos_tga, helenos_tga_size,
-	    &logo_bmp, &logo_rect);
-	if (rc != EOK) {
-		printf("Unable to decode logo.\n");
-		return 1;
-	}
-
-	gfx_bitmap_params_init(&logo_params);
-	logo_params.rect = logo_rect;
-
-	rc = ui_fixed_create(&aboutos.fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_image_create(ui_res, logo_bmp, &logo_rect, &aboutos.image);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	off.x = 76;
-	off.y = 42;
-	gfx_rect_translate(&off, &logo_rect, &rect);
-
-	/* Adjust for frame width (2 x 1 pixel) */
-	rect.p1.x += 2;
-	rect.p1.y += 2;
-	ui_image_set_rect(aboutos.image, &rect);
-	ui_image_set_flags(aboutos.image, ui_imgf_frame);
-
-	rc = ui_fixed_add(aboutos.fixed, ui_image_ctl(aboutos.image));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	/* Release label */
-
-	rc = ui_label_create(ui_res, "HelenOS " STRING(HELENOS_RELEASE)
-	    " (" STRING(HELENOS_CODENAME) ")", &aboutos.lrelease);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 1;
-		rect.p0.y = 5;
-		rect.p1.x = 44;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 140;
-		rect.p1.x = 340;
-		rect.p1.y = 160;
-	}
-
-	ui_label_set_rect(aboutos.lrelease, &rect);
-	ui_label_set_halign(aboutos.lrelease, gfx_halign_center);
-
-	rc = ui_fixed_add(aboutos.fixed, ui_label_ctl(aboutos.lrelease));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	/* Copyright label */
-
-	rc = ui_label_create(ui_res, STRING(HELENOS_COPYRIGHT), &aboutos.lcopy);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 1;
-		rect.p0.y = 6;
-		rect.p1.x = 44;
-		rect.p1.y = 7;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 160;
-		rect.p1.x = 340;
-		rect.p1.y = 180;
-	}
-
-	ui_label_set_rect(aboutos.lcopy, &rect);
-	ui_label_set_halign(aboutos.lcopy, gfx_halign_center);
-
-	rc = ui_fixed_add(aboutos.fixed, ui_label_ctl(aboutos.lcopy));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	/* Architecture label */
-
-	rc = ui_label_create(ui_res, "Running on " STRING(UARCH), &aboutos.larch);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 1;
-		rect.p0.y = 9;
-		rect.p1.x = 44;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 190;
-		rect.p1.x = 340;
-		rect.p1.y = 210;
-	}
-
-	ui_label_set_rect(aboutos.larch, &rect);
-	ui_label_set_halign(aboutos.larch, gfx_halign_center);
-
-	rc = ui_fixed_add(aboutos.fixed, ui_label_ctl(aboutos.larch));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	/* OK button */
-
-	rc = ui_pbutton_create(ui_res, "OK", &aboutos.pbok);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(aboutos.pbok, &pbutton_cb, (void *) &aboutos);
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 17;
-		rect.p0.y = 13;
-		rect.p1.x = 28;
-		rect.p1.y = 14;
-	} else {
-		rect.p0.x = 125;
-		rect.p0.y = 235;
-		rect.p1.x = 225;
-		rect.p1.y = rect.p0.y + 28;
-	}
-
-	ui_pbutton_set_rect(aboutos.pbok, &rect);
-	ui_pbutton_set_default(aboutos.pbok, true);
-
-	rc = ui_fixed_add(aboutos.fixed, ui_pbutton_ctl(aboutos.pbok));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(aboutos.fixed));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/aboutos/aboutos.h
===================================================================
--- uspace/app/aboutos/aboutos.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup aboutos
- * @{
- */
-/**
- * @file About HelenOS
- */
-
-#ifndef ABOUTOS_H
-#define ABOUTOS_H
-
-#include <ui/fixed.h>
-#include <ui/image.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** About HelenOS */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-
-	ui_image_t *image;
-	ui_label_t *lrelease;
-	ui_label_t *lcopy;
-	ui_label_t *larch;
-
-	ui_pbutton_t *pbok;
-} aboutos_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/aboutos/doc/doxygroups.h
===================================================================
--- uspace/app/aboutos/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup aboutos aboutos
- * @brief About HelenOS
- * @ingroup apps
- */
Index: pace/app/aboutos/meson.build
===================================================================
--- uspace/app/aboutos/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2012 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfximage', 'ui' ]
-
-_images = files('gfx/helenos.tga')
-
-_images_zip = custom_target('aboutos_images.zip',
-	input : _images,
-	output : [ 'images.zip' ],
-	command : [ mkarray, '@OUTDIR@', 'images', 'image', 'image', uspace_as_prolog, '.data', '@INPUT@' ],
-)
-_imgs_s = custom_target('aboutos_images.s',
-	input : _images_zip,
-	output : [ 'images.s' ],
-	command : [ unzip, '-p', '@INPUT@', 'images.s' ],
-	capture : true,
-)
-_imgs_h = custom_target('aboutos_images.h',
-	input : _images_zip,
-	output : [ 'images.h' ],
-	command : [ unzip, '-p', '@INPUT@', 'images.h' ],
-	capture : true,
-)
-_imgs_desc_c = custom_target('aboutos_images_desc.c',
-	input : _images_zip,
-	output : [ 'images_desc.c' ],
-	command : [ unzip, '-p', '@INPUT@', 'images_desc.c' ],
-	capture : true,
-)
-
-c_args += [ '-DHELENOS_RELEASE=' + HELENOS_RELEASE, '-DHELENOS_COPYRIGHT=' + HELENOS_COPYRIGHT, '-DHELENOS_CODENAME=' + HELENOS_CODENAME ]
-src = [ files('aboutos.c'), _imgs_s, _imgs_h, _imgs_desc_c ]
Index: pace/app/barber/barber.c
===================================================================
--- uspace/app/barber/barber.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,481 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup barber
- * @{
- */
-/** @file
- */
-
-#include <device/led_dev.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <gfximage/tga_gz.h>
-#include <io/pixel.h>
-#include <loc.h>
-#include <stats.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include <ui/image.h>
-#include "images.h"
-#include "images_tiny.h"
-
-#define NAME  "barber"
-
-#define FRAMES  IMAGES
-
-#define MIN_FPS  1
-#define MAX_FPS  25
-
-#define MIN_LOAD  (LOAD_UNIT / 4)
-#define MAX_LOAD  (LOAD_UNIT / 3)
-
-#define LED_PERIOD  1000000
-#define LED_COLORS  7
-
-typedef struct {
-	link_t link;
-	service_id_t svc_id;
-	async_sess_t *sess;
-} led_dev_t;
-
-typedef struct {
-	ui_t *ui;
-} barber_t;
-
-static fibril_timer_t *led_timer = NULL;
-static list_t led_devs;
-static unsigned int led_color = 0;
-
-static pixel_t led_colors[LED_COLORS] = {
-	PIXEL(0xff, 0xff, 0x00, 0x00),
-	PIXEL(0xff, 0x00, 0xff, 0x00),
-	PIXEL(0xff, 0x00, 0x00, 0xff),
-	PIXEL(0xff, 0xff, 0xff, 0x00),
-	PIXEL(0xff, 0xff, 0x00, 0xff),
-	PIXEL(0xff, 0x00, 0xff, 0xff),
-	PIXEL(0xff, 0xff, 0xff, 0xff)
-};
-
-static fibril_timer_t *frame_timer = NULL;
-static ui_image_t *frame_img;
-static gfx_bitmap_t *frame_bmp[FRAMES];
-
-static unsigned int frame = 0;
-static unsigned int fps = MIN_FPS;
-static gfx_coord_t frame_width;
-static gfx_coord_t frame_height;
-
-static void led_timer_callback(void *);
-static void frame_timer_callback(void *);
-
-static void wnd_close(ui_window_t *, void *);
-static void wnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close,
-	.kbd = wnd_kbd_event
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (barber)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	barber_t *barber = (barber_t *) arg;
-
-	ui_quit(barber->ui);
-}
-
-/** Barber unmodified key press.
- *
- * @param barber Barber
- * @param event Keyboard event
- */
-static void barber_kbd_event_unmod(barber_t *barber, kbd_event_t *event)
-{
-	if (event->key == KC_ESCAPE)
-		ui_quit(barber->ui);
-}
-
-/** Barber ctrl-key key press.
- *
- * @param barber Barber
- * @param event Keyboard event
- */
-static void barber_kbd_event_ctrl(barber_t *barber, kbd_event_t *event)
-{
-	if (event->key == KC_Q)
-		ui_quit(barber->ui);
-}
-
-/** Barber window keyboard event.
- *
- * @param window UI window
- * @param arg Argument (barber_t *)
- * @param event Keyboard event
- */
-static void wnd_kbd_event(ui_window_t *window, void *arg, kbd_event_t *event)
-{
-	barber_t *barber = (barber_t *)arg;
-
-	if (event->type != KEY_PRESS)
-		return;
-
-	if ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
-		barber_kbd_event_unmod(barber, event);
-
-	if ((event->mods & KM_CTRL) != 0 &&
-	    (event->mods & (KM_ALT | KM_SHIFT)) == 0)
-		barber_kbd_event_ctrl(barber, event);
-
-	ui_window_def_kbd(window, event);
-}
-
-static bool decode_frames(gfx_context_t *gc, image_t *img)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	for (unsigned int i = 0; i < FRAMES; i++) {
-		rc = decode_tga_gz(gc, img[i].addr, img[i].size,
-		    &frame_bmp[i], &rect);
-		if (rc != EOK) {
-			printf("Unable to decode frame %u.\n", i);
-			return false;
-		}
-
-		(void)rect;
-	}
-
-	return true;
-}
-
-static void destroy_frames(void)
-{
-	unsigned i;
-
-	for (i = 0; i < FRAMES; i++) {
-		gfx_bitmap_destroy(frame_bmp[i]);
-		frame_bmp[i] = NULL;
-	}
-}
-
-static void plan_led_timer(void)
-{
-	fibril_timer_set(led_timer, LED_PERIOD, led_timer_callback, NULL);
-}
-
-static load_t get_load(void)
-{
-	size_t count;
-	load_t *load = stats_get_load(&count);
-	load_t load_val;
-
-	if ((load != NULL) && (count > 0)) {
-		load_val = load[0];
-		free(load);
-	} else
-		load_val = 0;
-
-	return load_val;
-}
-
-static void plan_frame_timer(usec_t render_time)
-{
-	/*
-	 * Crank up the FPS unless we lack
-	 * behind with the rendering and
-	 * unless the load is not above
-	 * a lower threshold.
-	 */
-
-	usec_t delta = 1000000 / fps;
-	load_t load = get_load();
-
-	if ((delta >= render_time) && (load < MIN_LOAD))
-		fps++;
-
-	if (fps > MAX_FPS)
-		fps = MAX_FPS;
-
-	/*
-	 * If we lack behind then immediately
-	 * go to the lowest FPS.
-	 */
-
-	if (delta < render_time)
-		fps = MIN_FPS;
-
-	/*
-	 * Crank down the FPS if the current
-	 * load is above an upper threshold.
-	 */
-
-	if (load > MAX_LOAD)
-		fps--;
-
-	if (fps < MIN_FPS)
-		fps = MIN_FPS;
-
-	delta = 1000000 / fps;
-
-	fibril_timer_set(frame_timer, delta, frame_timer_callback, NULL);
-}
-
-static void led_timer_callback(void *data)
-{
-	pixel_t next_led_color = led_colors[led_color];
-
-	led_color++;
-	if (led_color >= LED_COLORS)
-		led_color = 0;
-
-	list_foreach(led_devs, link, led_dev_t, dev) {
-		if (dev->sess)
-			led_dev_color_set(dev->sess, next_led_color);
-	}
-
-	plan_led_timer();
-}
-
-static void frame_timer_callback(void *data)
-{
-	struct timespec prev;
-	gfx_rect_t rect;
-	getuptime(&prev);
-
-	frame++;
-	if (frame >= FRAMES)
-		frame = 0;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = frame_width;
-	rect.p1.y = frame_height;
-
-	ui_image_set_bmp(frame_img, frame_bmp[frame], &rect);
-	(void) ui_image_paint(frame_img);
-
-	struct timespec cur;
-	getuptime(&cur);
-
-	plan_frame_timer(NSEC2USEC(ts_sub_diff(&cur, &prev)));
-}
-
-static void loc_callback(void *arg)
-{
-	category_id_t led_cat;
-	errno_t rc = loc_category_get_id("led", &led_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return;
-
-	service_id_t *svcs;
-	size_t count;
-	rc = loc_category_get_svcs(led_cat, &svcs, &count);
-	if (rc != EOK)
-		return;
-
-	for (size_t i = 0; i < count; i++) {
-		bool known = false;
-
-		/* Determine whether we already know this device. */
-		list_foreach(led_devs, link, led_dev_t, dev) {
-			if (dev->svc_id == svcs[i]) {
-				known = true;
-				break;
-			}
-		}
-
-		if (!known) {
-			led_dev_t *dev = (led_dev_t *) calloc(1, sizeof(led_dev_t));
-			if (!dev)
-				continue;
-
-			link_initialize(&dev->link);
-			dev->svc_id = svcs[i];
-			dev->sess = loc_service_connect(svcs[i], INTERFACE_DDF, 0);
-
-			list_append(&dev->link, &led_devs);
-		}
-	}
-
-	// FIXME: Handle LED device removal
-
-	free(svcs);
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [-d <display>]\n", NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	barber_t barber;
-	ui_t *ui;
-	ui_wnd_params_t params;
-	ui_window_t *window;
-	ui_resource_t *ui_res;
-	gfx_rect_t rect;
-	gfx_rect_t wrect;
-	gfx_rect_t app_rect;
-	gfx_context_t *gc;
-	gfx_coord2_t off;
-	image_t *img;
-	int i;
-
-	i = 1;
-	while (i < argc) {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	list_initialize(&led_devs);
-	errno_t rc = loc_register_cat_change_cb(loc_callback, NULL);
-	if (rc != EOK) {
-		printf("Unable to register callback for device discovery.\n");
-		return 1;
-	}
-
-	led_timer = fibril_timer_create(NULL);
-	if (!led_timer) {
-		printf("Unable to create LED timer.\n");
-		return 1;
-	}
-
-	frame_timer = fibril_timer_create(NULL);
-	if (!frame_timer) {
-		printf("Unable to create frame timer.\n");
-		return 1;
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return 1;
-	}
-
-	if (ui_is_textmode(ui)) {
-		frame_width = 10;
-		frame_height = 16;
-	} else {
-		frame_width = 59;
-		frame_height = 192;
-	}
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = frame_width;
-	rect.p1.y = frame_height;
-
-	ui_wnd_params_init(&params);
-	params.caption = "Barber Pole";
-	params.placement = ui_wnd_place_bottom_right;
-	/*
-	 * Compute window rectangle such that application area corresponds
-	 * to rect
-	 */
-	ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect);
-	off = wrect.p0;
-	gfx_rect_rtranslate(&off, &wrect, &params.rect);
-
-	barber.ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return 1;
-	}
-
-	ui_res = ui_window_get_res(window);
-	gc = ui_window_get_gc(window);
-	ui_window_get_app_rect(window, &app_rect);
-	ui_window_set_cb(window, &window_cb, (void *) &barber);
-
-	img = ui_is_textmode(ui) ? image_tinys : images;
-
-	if (!decode_frames(gc, img))
-		return 1;
-
-	rc = ui_image_create(ui_res, frame_bmp[frame], &rect,
-	    &frame_img);
-	if (rc != EOK) {
-		printf("Error creating UI.\n");
-		return 1;
-	}
-
-	ui_image_set_rect(frame_img, &app_rect);
-
-	ui_window_add(window, ui_image_ctl(frame_img));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return 1;
-	}
-
-	plan_led_timer();
-	plan_frame_timer(0);
-
-	ui_run(ui);
-
-	/* Unlink bitmap from image so it is not destroyed along with it */
-	ui_image_set_bmp(frame_img, NULL, &rect);
-
-	destroy_frames();
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/barber/doc/doxygroups.h
===================================================================
--- uspace/app/barber/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup barber barber
- * @brief Activity indicator
- * @ingroup apps
- */
Index: pace/app/barber/meson.build
===================================================================
--- uspace/app/barber/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-#
-# Copyright (c) 2014 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui', 'gfximage', 'compress', 'device' ]
-
-_images = files(
-	'gfx/frame01.tga.gz',
-	'gfx/frame02.tga.gz',
-	'gfx/frame03.tga.gz',
-	'gfx/frame04.tga.gz',
-	'gfx/frame05.tga.gz',
-	'gfx/frame06.tga.gz',
-	'gfx/frame07.tga.gz',
-	'gfx/frame08.tga.gz',
-	'gfx/frame09.tga.gz',
-	'gfx/frame10.tga.gz',
-	'gfx/frame11.tga.gz',
-	'gfx/frame12.tga.gz',
-	'gfx/frame13.tga.gz',
-	'gfx/frame14.tga.gz',
-	'gfx/frame15.tga.gz',
-	'gfx/frame16.tga.gz',
-	'gfx/frame17.tga.gz',
-	'gfx/frame18.tga.gz',
-	'gfx/frame19.tga.gz',
-	'gfx/frame20.tga.gz',
-	'gfx/frame21.tga.gz',
-	'gfx/frame22.tga.gz',
-	'gfx/frame23.tga.gz',
-	'gfx/frame24.tga.gz',
-	'gfx/frame25.tga.gz',
-	'gfx/frame26.tga.gz',
-	'gfx/frame27.tga.gz',
-	'gfx/frame28.tga.gz',
-	'gfx/frame29.tga.gz',
-	'gfx/frame30.tga.gz',
-)
-
-_images_tiny = files(
-	'gfx-tiny/frame01t.tga.gz',
-	'gfx-tiny/frame02t.tga.gz',
-	'gfx-tiny/frame03t.tga.gz',
-	'gfx-tiny/frame04t.tga.gz',
-	'gfx-tiny/frame05t.tga.gz',
-	'gfx-tiny/frame06t.tga.gz',
-	'gfx-tiny/frame07t.tga.gz',
-	'gfx-tiny/frame08t.tga.gz',
-	'gfx-tiny/frame09t.tga.gz',
-	'gfx-tiny/frame10t.tga.gz',
-	'gfx-tiny/frame11t.tga.gz',
-	'gfx-tiny/frame12t.tga.gz',
-	'gfx-tiny/frame13t.tga.gz',
-	'gfx-tiny/frame14t.tga.gz',
-	'gfx-tiny/frame15t.tga.gz',
-	'gfx-tiny/frame16t.tga.gz',
-	'gfx-tiny/frame17t.tga.gz',
-	'gfx-tiny/frame18t.tga.gz',
-	'gfx-tiny/frame19t.tga.gz',
-	'gfx-tiny/frame20t.tga.gz',
-	'gfx-tiny/frame21t.tga.gz',
-	'gfx-tiny/frame22t.tga.gz',
-	'gfx-tiny/frame23t.tga.gz',
-	'gfx-tiny/frame24t.tga.gz',
-	'gfx-tiny/frame25t.tga.gz',
-	'gfx-tiny/frame26t.tga.gz',
-	'gfx-tiny/frame27t.tga.gz',
-	'gfx-tiny/frame28t.tga.gz',
-	'gfx-tiny/frame29t.tga.gz',
-	'gfx-tiny/frame30t.tga.gz',
-)
-
-_tarball = custom_target('barber_images.tar',
-	input: _images,
-	output: 'barber_images.tar',
-	command: tar,
-)
-
-# TODO
-
-# Normal images
-
-_images_zip = custom_target('barber_images.zip',
-	input : _images,
-	output : [ 'images.zip' ],
-	command : [ mkarray, '@OUTDIR@', 'images', 'image', 'image', uspace_as_prolog, '.data', '@INPUT@' ],
-)
-_imgs_s = custom_target('barber_images.s',
-	input : _images_zip,
-	output : [ 'images.s' ],
-	command : [ unzip, '-p', '@INPUT@', 'images.s' ],
-	capture : true,
-)
-_imgs_h = custom_target('barber_images.h',
-	input : _images_zip,
-	output : [ 'images.h' ],
-	command : [ unzip, '-p', '@INPUT@', 'images.h' ],
-	capture : true,
-)
-_imgs_desc_c = custom_target('barber_images_desc.c',
-	input : _images_zip,
-	output : [ 'images_desc.c' ],
-	command : [ unzip, '-p', '@INPUT@', 'images_desc.c' ],
-	capture : true,
-)
-
-# Tiny images
-
-_images_tiny_zip = custom_target('barber_images_tiny.zip',
-	input : _images_tiny,
-	output : [ 'images_tiny.zip' ],
-	command : [ mkarray, '@OUTDIR@', 'images_tiny', 'image', 'image_tiny', uspace_as_prolog, '.data', '@INPUT@' ],
-)
-_imgs_tiny_s = custom_target('barber_images_tiny.s',
-	input : _images_tiny_zip,
-	output : [ 'images_tiny.s' ],
-	command : [ unzip, '-p', '@INPUT@', 'images_tiny.s' ],
-	capture : true,
-)
-_imgs_tiny_h = custom_target('barber_images_tiny.h',
-	input : _images_tiny_zip,
-	output : [ 'images_tiny.h' ],
-	command : [ unzip, '-p', '@INPUT@', 'images_tiny.h' ],
-	capture : true,
-)
-_imgs_tiny_desc_c = custom_target('barber_images_tiny_desc.c',
-	input : _images_tiny_zip,
-	output : [ 'images_tiny_desc.c' ],
-	command : [ unzip, '-p', '@INPUT@', 'images_tiny_desc.c' ],
-	capture : true,
-)
-
-src = [ files('barber.c'), _imgs_s, _imgs_h, _imgs_desc_c,
-    _imgs_tiny_s, _imgs_tiny_h, _imgs_tiny_desc_c ]
Index: pace/app/bdsh/AUTHORS
===================================================================
--- uspace/app/bdsh/AUTHORS	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-
-Written by Tim Post <echo@echoreply.us> to serve as a primitive shell
-for HelenOS, or as a template to make a command line interface that
-offers shell like creature comforts.
-
-This program was mostly written from scratch, some existing code was
-used from other various free software projects:
-
-* Based on the HelenOS testing sub-system written by Martin Decky
-
-* read_line() (input.c) was written by Jiri Svoboda
-
-Individual author copyrights are listed in the headers of each file.
-
Index: pace/app/bdsh/LICENSE
===================================================================
--- uspace/app/bdsh/LICENSE	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,28 +1,0 @@
-Copyright (c) 2008, Tim Post <tinkertim@gmail.com>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-
-Neither the name of the original program's authors nor the names of its
-contributors may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
Index: pace/app/bdsh/README
===================================================================
--- uspace/app/bdsh/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,252 +1,0 @@
-BDSH - The Brain Dead Shell | Design Documentation
---------------------------------------------------
-
-Overview:
-=========
-
-BDSH was written as a drop in command line interface for HelenOS to permit
-interactive access to persistent file systems in development. BDSH was
-written from scratch with a very limited userspace standard C library in
-mind. Much like the popular Busybox program, BDSH provides a very limited
-shell with limited common UNIX creature comforts built in.
-
-Porting Busybox (and by extension ASH) would have taken much longer to
-complete, much less make stable due to stark differences between Linux and
-Spartan with regards to IPC, term I/O and process creation. BDSH was written
-and made stable within the space of less than 30 days.
-
-BDSH will eventually evolve and be refined into the HelenOS equivalent
-of Busybox. While BDSH is now very intrinsic to HelenOS, its structure and
-use of strictly lower level functions makes it extremely easy to port.
-
-Design:
-=======
-
-BDSH is made up of three basic components:
-
- 1. Main i/o, error handling and task management
- 2. The builtin sub system
- 3. The module sub system
-
-The main part handles user input, reports errors, spawns external tasks and
-provides a convenient entry point for built-in and modular commands. A simple
-structure, cliuser_t keeps track of the user's vitals, such as their current
-working directory (and eventually uid, home directory, etc if they apply).
-
-This part defines and exposes all functions that are not intrinsic to a
-certain built in or modular command. For instance: string handlers,
-module/builtin search and launch functions, error handlers and other things
-can be found here.
-
-Builtin commands are commands that must have access to cliuser_t, which is
-not exposed to modular commands. For instance, the 'cd' command must update
-the current working directory, which is stored in cliuser_t. As such, the
-entry types for builtin commands are slightly different.
-
-Modular commands do not need anything more than the basic functions that are
-exposed by default. They do not need to modify cliuser_t, they are just self
-contained. A modular command could very easily be made into a stand alone
-program, likewise any stand alone program could easily become a modular
-command.
-
-Both modular and builtin commands share two things in common. Both must have
-two entry points, one to invoke the command and one to invoke a help display
-for the command. Exec (main()) entry points are int * and are expected to
-return a value. Help entry points are void *, no return value is expected.
-
-They are typed as such (from cmds.h):
-
-/* Types for module command entry and help */
-typedef int (* mod_entry_t)(char **);
-typedef void (* mod_help_t)(unsigned int);
-
-/* Built-in commands need to be able to modify cliuser_t */
-typedef int (* builtin_entry_t)(char **, cliuser_t *);
-typedef void (* builtin_help_t)(unsigned int);
-
-As you can see, both modular and builtin commands expect an array of
-arguments, however bulitins also expect to be pointed to cliuser_t.
-
-Both are defined with the same simple structure:
-
-/* Module structure */
-typedef struct {
-	char *name;         /* Name of the command */
-	char *desc;         /* Description of the command */
-	mod_entry_t entry;  /* Command (exec) entry function */
-	mod_help_t help;    /* Command (help) entry function */
-	int restricted;     /* Restricts to interactive/non-interactive only */
-} module_t;
-
-NOTE: Builtin commands may grow in this respect, that is why they are
-defined separately.
-
-Builtins, of course, would use the builtin_entry_t type. The name of the
-command is used to associate user input to a possible entry point. The
-description is a short (40 - 60 chars) summary of what the command does. Both
-entry points are then defined, and the restrict value is used to determine a
-commands availability.
-
-Restriction levels are easy, a command is either available exclusively within
-interactive mode, exclusively within non-interactive mode or both. If you are
-looking at a prompt, you are in interactive mode. If you issue a command like
-this:
-
-/sbin/bdsh command [arg1] [arg2]
-
-... you are in non interactive mode. This is done when you need to force the
-parent shell to be the one who actually handles the command, or ensure that
-/sbin/ls was used in lieu of the built in 'ls' when in non-interactive mode.
-
-The values are:
-  0 : Unrestricted
- -1 : Interactive only
-  1 : Non-interactive only
-
-A script to generate skeletal files for a new command is included, it can be
-found in cmds/mknewcmd. To generate a new modular command named 'foo', which
-should also be reachable by typing 'f00', you would issue this command:
-
-./mknewcmd -n foo -a f00 -t module
-
-This generates all needed files and instructs you on how to include your new
-command in the build and make it accessible. By default, the command will be
-unrestricted. Builtin commands can be created by changing 'module' to
-'builtin'
-
-There are more options to mknewcmd, which allow you to specify the
-description, entry point, help entry point, or restriction. By default, names
-just follow the command such as cmd_foo(), help_cmd_foo(), 'The foo command',
-etc. If you want to see the options and explanations in detail, use
-./mknewcmd --help.
-
-When working with commands, keep in mind that only the main and help entry
-points need to be exposed. If commands share the same functions, put them
-where they are exposed to all commands, without the potential oops of those
-functions going away if the command is eliminated in favor of a stand alone
-external program.
-
-The util.c file is a great place to put those types of functions.
-
-Also, be careful with globals, option structures, etc. The compiler will
-generally tell you if you've made a mistake, however declaring:
-
-volatile int foo
-
-... in a command will allow for anything else to pick it up. Sometimes
-this could be desirable .. other times not. When communicating between
-builtins and the main system, try to use cliuser_t. The one exception
-for this is the cli_quit global, since everything may at some point
-need to check it. Modules should only communicate their return value.
-
-Symbolic constants that everything needs should go in the config.h file,
-however this is not the place to define shared macros.
-
-Making a program into a module
-==============================
-
-If you have some neat program that would be useful as a modular command,
-converting it is not very hard. The following steps should get you through
-the process easily (assuming your program is named 'foo'):
-
-1: Use mknewcmd to generate the skeletal files.
-
-2: Change your "usage()" command as shown:
-     -- void usage(...)
-     ++ void help_cmd_foo(unsigned int level)
-
-     'level' is either 0 or 1, indicating the level of help requested.
-     If the help / usage function currently exits based on how it is
-     called, you'll need to change it.
-
-3: Change the programs "main()" as shown:
-     -- int main(int argc, char **argv)
-     ++ int cmd_foo(char **argv)
-     -- return 1;
-     ++ return CMD_FAILURE;
-     -- return 0;
-     ++ return CMD_SUCCESS;
-
-     NOTE: If main is void, you'll need to change it and ensure that its
-     expecting an array of arguments, even if they'll never be read or
-     used. I.e.:
-
-     -- void main(void)
-     ++ int cmd_foo(char **argv)
-
-4: Don't expose more than the entry and help points:
-     -- void my_function(int n)
-     ++ static void my_function(int n)
-
-5: Copy/paste to the stub generated by mknewcmd then add your files to the
-   Makefile. Be sure to add any directories that you made to the SUBDIRS so
-   that a 'make clean' will clean them.
-
-Provided that all functions that your calling are available in the
-userspace C library, your program should compile just fine and appear
-as a modular command.
-
-Overcoming userspace libc obstacles
-===================================
-
-A quick glance through the util.c file will reveal functions like
-cli_strdup(), cli_strtok(), cli_strtok_r() and more. Those are functions
-that were missing from userspace libc when BDSH was born. Later, after
-porting what was needed from FBSD/NBSD, the real functions appeared in
-the userspace libc after being tested in their cli_* implementations.
-
-Those functions remain because they guarantee that bdsh will work even
-on systems that lack them. Additionally, more BDSH specific stuff can
-go into them, such as error handling and reporting when malloc() fails.
-
-You will also notice that FILE, fopen() (and all friends), ato*() and
-other common things might be missing. The HelenOS userspace C library is
-still very young, you are sure to run into something that you want/need
-which is missing.
-
-When that happens, you have three options:
-
-1 - Implement it internally in util.c , when its tested and stable send a
-patch to HelenOS asking for your function to be included in libc. This is
-the best option, as you not only improve BDSH .. but HelenOS as a whole.
-
-2 - Work around it. Not everyone can implement / port fopen() and all of
-its friends. Make open(), read(), write() (etc) work if at all possible.
-
-3 - Send an e-mail to the HelenOS development mailing list. Explain why you
-need the function and what its absence is holding up.
-
-If what you need is part of a library that is typically a shared object, try
-to implement a 'mini' version of it. Currently, all userspace applications
-are statically linked. Giving up creature comforts for size while avoiding
-temporary 'band aids' is never frowned upon.
-
-Most of all, don't get discouraged .. ask for some help prior to giving up
-if you just can't accomplish something with the limited means provided.
-
-Contributing
-============
-
-I will take any well written patch that sanely improves or expands BDSH. Send
-me a patch against the trunk revision, or, if you like a Mercurial repository
-is also maintained at http://echoreply.us/hg/bdsh.hg and kept in sync with
-the trunk.
-
-Please be sure to follow the simple coding standards outlined at
-http://www.helenos.eu/cstyle (mostly just regarding formatting), test your
-changes and make sure your patch applies cleanly against the latest revision.
-
-All patches submitted must be your original code, or a derivative work of
-something licensed under the same 3 clause BSD license as BDSH. See LICENSE
-for more information.
-
-When sending patches, you agree that your work will be published under the
-same 3 clause BSD license as BDSH itself. Failure to ensure that anything
-you used is not under the same or less restrictive license could cause major
-issues for BDSH in the future .. please be sure. Also, please don't forget
-to add yourself in the AUTHORS file, as I am horrible about keeping such
-things up to date.
-
-
-
-
Index: pace/app/bdsh/TODO
===================================================================
--- uspace/app/bdsh/TODO	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-This is a very brain dead shell. It needs some love, coffee or perhaps beer.
-Currently, you can't even really call it a shell, its more of a CLI that
-offers some shell like creature comforts.
-
-This was written in a hurry to provide some means of testing persistent file
-systems in HelenOS. It does its job, its nowhere near complete but it is
-actively developed. If your reading this, its likely that you're looking for
-some functionality that is not yet present. Prior to filing a bug report,
-please make sure that what you want is not on the list below.
-
-A list of things to do:
------------------------
-
-* rm: add support for recursively removing directories and files therein
-
-* Port an editor (vim?)
-
-* Finish cat / cp
-
-* Support basic redirection (i.e ls > foo.txt)
-
-* Expand wildcards (i.e. *.txt), don't worry about variables for now
-
-* Basic scripting
-
-* Hash previously found commands
-
-* Improve input, add history / etc (port libedit?)
-
-* Add wrappers for signal, sigaction to make ports to modules easier
-
-Regarding POSIX:
-----------------
-POSIX is a standard for Unix-like operating systems. HelenOS is (mostly) just
-a kernel at this point with a few userspace programs that facilitate testing
-of the kernel and file systems.
-
-HelenOS is not a Unix-like operating system. HelenOS is its own thing, a modern
-microkernel OS and many directions are not yet set.
-
-Please do not e-mail me to point out that modular implementations that resemble
-typical core utilities do not conform to some POSIX standard, these are temporary
-and serve the useful purpose of testing persistent file systems.
-
-Contributing:
--------------
-If you feel like doing any of the above to-do items, I am echo@echoreply.us. Please
-e-mail me and let me know your working on something so that I do not unwittingly
-duplicate your efforts. You can also e-mail the HelenOS list directly:
-
-HelenOS development mailing list <helenos-devel@lists.modry.cz>
-Subscribe here if you like: http://lists.modry.cz/cgi-bin/listinfo/helenos-devel
-
-Cheers and happy hacking!
---Tim
Index: pace/app/bdsh/cmds/builtin_cmds.c
===================================================================
--- uspace/app/bdsh/cmds/builtin_cmds.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Almost identical (for now) to mod_cmds.c, however this will not be the case
- * soon as builtin_t is going to grow way beyond module_t
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include "errors.h"
-#include "cmds.h"
-#include "builtin_aliases.h"
-#include "scli.h"
-
-extern volatile unsigned int cli_interactive;
-
-int is_builtin(const char *command)
-{
-	builtin_t *cmd;
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return -2;
-
-	for (cmd = builtins; cmd->name != NULL; cmd++, i++) {
-		if (!str_cmp(cmd->name, command))
-			return i;
-	}
-
-	return -1;
-}
-
-int is_builtin_alias(const char *command)
-{
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return -1;
-
-	for (i = 0; builtin_aliases[i] != NULL; i += 2) {
-		if (!str_cmp(builtin_aliases[i], command))
-			return 1;
-	}
-
-	return 0;
-}
-
-char *alias_for_builtin(const char *command)
-{
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return (char *)NULL;
-
-	for (i = 0; builtin_aliases[i] != NULL; i += 2) {
-		if (!str_cmp(builtin_aliases[i], command))
-			return (char *)builtin_aliases[i + 1];
-	}
-
-	return (char *)NULL;
-}
-
-int help_builtin(int builtin, unsigned int extended)
-{
-	builtin_t *cmd = builtins;
-
-	cmd += builtin;
-
-	if (NULL != cmd->help) {
-		cmd->help(extended);
-		return CL_EOK;
-	} else {
-		return CL_ENOENT;
-	}
-}
-
-int run_builtin(int builtin, char *argv[], cliuser_t *usr, iostate_t *new_iostate)
-{
-	int rc;
-	builtin_t *cmd = builtins;
-
-	cmd += builtin;
-
-	iostate_t *old_iostate = get_iostate();
-	set_iostate(new_iostate);
-
-	if (NULL != cmd->entry) {
-		rc = ((int)cmd->entry(argv, usr));
-	} else {
-		rc = CL_ENOENT;
-	}
-
-	set_iostate(old_iostate);
-
-	return rc;
-}
Index: pace/app/bdsh/cmds/builtins/README
===================================================================
--- uspace/app/bdsh/cmds/builtins/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,21 +1,0 @@
-Commands that need to modify the running user structure defined in scli.h
-should reside here. They (will) have a slightly different prototype that
-allows passing the user structure to them for ease of modifications.
-
-Examples of what should be a built-in and not a module would be:
-
-cd     (cliuser_t->cwd needs to be updated)
-
-In the future, more user preferences will be set via built-in commands,
-such as the formatting of the prompt string (HelenOS doesn't yet have
-an environment, much less PS*, even if it did we'd likely do it a little
-differently).
-
-.... etc.
-
-Anything that does _not_ need to use this structure should be included
-as a module, not a built in. If you want to include a new command, there
-is a 99% chance that you want it to be a module.
-
-
-
Index: pace/app/bdsh/cmds/builtins/batch/batch.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/batch/batch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <errno.h>
-#include <str.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "batch.h"
-#include "cmds.h"
-#include "input.h"
-
-static const char *cmdname = "batch";
-
-/* Dispays help for batch in various levels */
-void help_cmd_batch(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf(
-		    "\n  batch [filename] [-c]\n"
-		    "  Issues commands stored in the file.\n"
-		    "  Each command must correspond to the single line in the file.\n\n");
-	} else {
-		printf(
-		    "\n  `batch' - issues a batch of commands\n"
-		    "  Issues commands stored in the file. Each command must correspond\n"
-		    "  to the single line in the file. Empty lines can be used to visually\n"
-		    "  separate groups of commands. There is no support for comments,\n"
-		    "  variables, recursion or other programming constructs - the `batch'\n"
-		    "  command is indeed very trivial.\n"
-		    "  If the filename is followed by -c, execution continues even if some\n"
-		    "  of the commands failed.\n\n");
-	}
-
-	return;
-}
-
-/** Main entry point for batch, accepts an array of arguments and a
- * pointer to the cliuser_t structure
- */
-int cmd_batch(char **argv, cliuser_t *usr)
-{
-	unsigned int argc;
-	bool continue_despite_errors = false;
-
-	/* Count the arguments */
-	argc = 0;
-	while (argv[argc] != NULL)
-		argc++;
-
-	if (argc < 2) {
-		printf("%s - no input file provided.\n", cmdname);
-		return CMD_FAILURE;
-	}
-
-	if (argc > 2) {
-		if (str_cmp(argv[2], "-c") == 0)
-			continue_despite_errors = true;
-	}
-
-	errno_t rc = EOK;
-	FILE *batch = fopen(argv[1], "r");
-	if (batch == NULL) {
-		printf("%s - Cannot open file %s\n", cmdname, argv[1]);
-		return CMD_FAILURE;
-	} else {
-		cliuser_t fusr;
-		fusr.name = usr->name;
-		fusr.cwd = usr->cwd;
-		fusr.prompt = usr->prompt;
-		fusr.line = malloc(INPUT_MAX + 1);
-		char *cur = fusr.line;
-		char *end = fusr.line + INPUT_MAX;
-		int c = fgetc(batch);
-		while (fusr.line != NULL) {
-			if (c == '\n' || c == EOF || cur == end) {
-				*cur = '\0';
-				if (cur == fusr.line) {
-					/* skip empty line */
-					rc = EOK;
-					free(cur);
-				} else {
-					printf(">%s\n", fusr.line);
-					rc = process_input(&fusr);
-					/* fusr->line was freed by process_input() */
-					if ((rc != EOK) && continue_despite_errors) {
-						/* Mute the error. */
-						rc = EOK;
-					}
-				}
-				if (rc == 0 && c != EOF) {
-					fusr.line = malloc(INPUT_MAX + 1);
-					cur = fusr.line;
-					end = fusr.line + INPUT_MAX;
-				} else {
-					break;
-				}
-			} else {
-				*cur++ = c;
-			}
-			c = fgetc(batch);
-		}
-		fclose(batch);
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/builtins/batch/batch.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/batch/batch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef BATCH_H
-#define BATCH_H
-
-/* Prototypes for the batch command, excluding entry points */
-
-#endif /* BATCH_H */
Index: pace/app/bdsh/cmds/builtins/batch/batch_def.inc
===================================================================
--- uspace/app/bdsh/cmds/builtins/batch/batch_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"batch",
-	"Issue batch of commands",
-	&cmd_batch,
-	&help_cmd_batch,
-	0
-},
Index: pace/app/bdsh/cmds/builtins/batch/entry.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/batch/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#ifndef BATCH_ENTRY_H
-#define BATCH_ENTRY_H
-
-/* Pick up cliuser_t */
-#include "scli.h"
-
-/* Entry points for the batch command */
-extern int cmd_batch(char **, cliuser_t *);
-extern void help_cmd_batch(unsigned int);
-
-#endif /* BATCH_ENTRY_H */
Index: pace/app/bdsh/cmds/builtins/builtin_aliases.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/builtin_aliases.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BUILTIN_ALIASES_H
-#define BUILTIN_ALIASES_H
-
-#include <stdlib.h>
-#include "builtin_aliases.h"
-
-/* See modules/module_aliases.h for an explanation of this file */
-
-char *builtin_aliases[] = {
-	NULL, NULL
-};
-
-#endif
Index: pace/app/bdsh/cmds/builtins/builtin_aliases.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/builtin_aliases.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BUILTIN_ALIASES_H
-#define BUILTIN_ALIASES_H
-
-extern char *builtin_aliases[];
-
-#endif
Index: pace/app/bdsh/cmds/builtins/builtins.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/builtins.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include "builtins.h"
-
-#include "batch/entry.h"
-#include "cd/entry.h"
-#include "exit/entry.h"
-
-builtin_t builtins[] = {
-#include "batch/batch_def.inc"
-#include "cd/cd_def.inc"
-#include "exit/exit_def.inc"
-	{ NULL, NULL, NULL, NULL, 0 }
-};
Index: pace/app/bdsh/cmds/builtins/builtins.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/builtins.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BUILTINS_H
-#define BUILTINS_H
-
-#include "../cmds.h"
-
-extern builtin_t builtins[];
-
-#endif
Index: pace/app/bdsh/cmds/builtins/cd/cd.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/cd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "cmds.h"
-#include "cd.h"
-
-static const char *cmdname = "cd";
-
-/*
- * Previous directory variables.
- *
- * Declaring them static to avoid many "== NULL" checks.
- * PATH_MAX is not that big to cause any problems with memory overhead.
- */
-static char previous_directory[PATH_MAX] = "";
-static char previous_directory_tmp[PATH_MAX];
-static bool previous_directory_valid = true;
-static bool previous_directory_set = false;
-
-static errno_t chdir_and_remember(const char *new_dir)
-{
-
-	errno_t rc = vfs_cwd_get(previous_directory_tmp, PATH_MAX);
-	previous_directory_valid = (rc == EOK);
-	previous_directory_set = true;
-
-	rc = vfs_cwd_set(new_dir);
-	if (rc != EOK)
-		return rc;
-
-	str_cpy(previous_directory, PATH_MAX, previous_directory_tmp);
-	return EOK;
-}
-
-void help_cmd_cd(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' changes the current working directory.\n", cmdname);
-	} else {
-		printf(
-		    "  %s <directory>\n"
-		    "  Change directory to <directory>, e.g `%s /sbin'\n",
-		    cmdname, cmdname);
-	}
-
-	return;
-}
-
-/* This is a very rudamentary 'cd' command. It is not 'link smart' (yet) */
-
-int cmd_cd(char **argv, cliuser_t *usr)
-{
-	int argc;
-	errno_t rc = EOK;
-
-	argc = cli_count_args(argv);
-
-	/* Handle cd -- -. Override to switch to a directory named '-' */
-	bool hyphen_override = false;
-	char *target_directory = argv[1];
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--")) {
-			hyphen_override = true;
-			argc--;
-			target_directory = argv[2];
-		}
-	}
-
-	/*
-	 * We don't yet play nice with whitespace, a getopt implementation should
-	 * protect "quoted\ destination" as a single argument. Its not our job to
-	 * look for && || or redirection as the tokenizer should have done that
-	 * (currently, it does not)
-	 */
-
-	if (argc > 2) {
-		cli_error(CL_EFAIL, "Too many arguments to `%s'", cmdname);
-		return CMD_FAILURE;
-	}
-
-	if (argc < 2) {
-		printf("%s - no directory specified. Try `help %s extended'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	/* We have the correct # of arguments */
-	// TODO: handle tidle (~) expansion? */
-
-	/* Handle 'cd -' first. */
-	if (!str_cmp(target_directory, "-") && !hyphen_override) {
-		if (!previous_directory_valid) {
-			cli_error(CL_EFAIL, "Cannot switch to previous directory");
-			return CMD_FAILURE;
-		}
-		if (!previous_directory_set) {
-			cli_error(CL_EFAIL, "No previous directory to switch to");
-			return CMD_FAILURE;
-		}
-		char *prev_dup = str_dup(previous_directory);
-		if (prev_dup == NULL) {
-			cli_error(CL_ENOMEM, "Cannot switch to previous directory");
-			return CMD_FAILURE;
-		}
-		rc = chdir_and_remember(prev_dup);
-		free(prev_dup);
-	} else {
-		rc = chdir_and_remember(target_directory);
-	}
-
-	if (rc == 0) {
-		cli_set_prompt(usr);
-		return CMD_SUCCESS;
-	} else {
-		switch (rc) {
-		case ENOMEM:
-			cli_error(CL_EFAIL, "Destination path too long");
-			break;
-		case ENOENT:
-			cli_error(CL_ENOENT, "Invalid directory `%s'", target_directory);
-			break;
-		default:
-			cli_error(CL_EFAIL, "Unable to change to `%s'", target_directory);
-			break;
-		}
-	}
-
-	return CMD_FAILURE;
-}
Index: pace/app/bdsh/cmds/builtins/cd/cd.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/cd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef CD_H
-#define CD_H
-
-/* Prototypes for the cd command (excluding entry points) */
-
-#endif
Index: pace/app/bdsh/cmds/builtins/cd/cd_def.inc
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/cd_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"cd",
-	"Change the current working directory",
-	&cmd_cd,
-	&help_cmd_cd,
-	0
-},
Index: pace/app/bdsh/cmds/builtins/cd/entry.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/cd/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-#ifndef CD_ENTRY_H_
-#define CD_ENTRY_H_
-
-#include "scli.h"
-
-/* Entry points for the cd command */
-extern void help_cmd_cd(unsigned int);
-extern int cmd_cd(char **, cliuser_t *);
-
-#endif
Index: pace/app/bdsh/cmds/builtins/exit/entry.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/exit/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-#ifndef EXIT_ENTRY_H_
-#define EXIT_ENTRY_H_
-
-#include "scli.h"
-
-/* Entry points for the quit command */
-extern void help_cmd_exit(unsigned int);
-extern int cmd_exit(char *[], cliuser_t *);
-
-#endif
Index: pace/app/bdsh/cmds/builtins/exit/exit.c
===================================================================
--- uspace/app/bdsh/cmds/builtins/exit/exit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "entry.h"
-#include "exit.h"
-#include "cmds.h"
-
-static const char *cmdname = "exit";
-
-extern volatile unsigned int cli_quit;
-extern const char *progname;
-
-void help_cmd_exit(unsigned int level)
-{
-	printf("Type `%s' to exit %s\n", cmdname, progname);
-	return;
-}
-
-/** Quits the program and returns the status of whatever command
- * came before invoking 'quit'
- */
-int cmd_exit(char *argv[], cliuser_t *usr)
-{
-	/* Inform that we're outta here */
-	cli_quit = 1;
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/builtins/exit/exit.h
===================================================================
--- uspace/app/bdsh/cmds/builtins/exit/exit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef EXIT_H
-#define EXIT_H
-
-/* Prototypes for the quit command (excluding entry points) */
-
-#endif
Index: pace/app/bdsh/cmds/builtins/exit/exit_def.inc
===================================================================
--- uspace/app/bdsh/cmds/builtins/exit/exit_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"exit",
-	"Exit the shell",
-	&cmd_exit,
-	&help_cmd_exit,
-	0
-},
Index: pace/app/bdsh/cmds/cmds.h
===================================================================
--- uspace/app/bdsh/cmds/cmds.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CMDS_H
-#define CMDS_H
-
-#include "config.h"
-#include "scli.h"
-
-/* Temporary to store strings */
-#define EXT_HELP      "extended"
-#define SHORT_HELP    "short"
-#define TEST_ANNOUNCE "Hello, this is :"
-
-/* Simple levels of help displays */
-#define HELP_SHORT 0
-#define HELP_LONG  1
-
-/* Acceptable buffer sizes (for strn functions) */
-/* TODO: Move me, other files duplicate these needlessly */
-#define BUFF_LARGE  1024
-#define BUFF_SMALL  255
-
-/* Return macros for int type entry points */
-#define CMD_FAILURE 1
-#define CMD_SUCCESS 0
-
-/* Types for module command entry and help */
-typedef int (*mod_entry_t)(char **);
-typedef void (*mod_help_t)(unsigned int);
-
-/* Built-in commands need to be able to modify cliuser_t */
-typedef int (*builtin_entry_t)(char **, cliuser_t *);
-typedef void (*builtin_help_t)(unsigned int);
-
-/* Module structure */
-typedef struct {
-	const char *name;   /* Name of the command */
-	const char *desc;   /* Description of the command */
-	mod_entry_t entry;  /* Command (exec) entry function */
-	mod_help_t help;    /* Command (help) entry function */
-} module_t;
-
-/* Builtin structure, same as modules except different types of entry points */
-typedef struct {
-	const char *name;
-	const char *desc;
-	builtin_entry_t entry;
-	builtin_help_t help;
-	int restricted;
-} builtin_t;
-
-/*
- * Declared in cmds/modules/modules.h and cmds/builtins/builtins.h
- * respectively
- */
-extern module_t modules[];
-extern builtin_t builtins[];
-
-/* Prototypes for module launchers */
-extern int module_is_restricted(int);
-extern int is_module(const char *);
-extern int is_module_alias(const char *);
-extern char *alias_for_module(const char *);
-extern int help_module(int, unsigned int);
-extern int run_module(int, char *[], iostate_t *);
-
-/* Prototypes for builtin launchers */
-extern int builtin_is_restricted(int);
-extern int is_builtin(const char *);
-extern int is_builtin_alias(const char *);
-extern char *alias_for_builtin(const char *);
-extern int help_builtin(int, unsigned int);
-extern int run_builtin(int, char *[], cliuser_t *, iostate_t *);
-
-#endif
Index: pace/app/bdsh/cmds/mknewcmd
===================================================================
--- uspace/app/bdsh/cmds/mknewcmd	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,316 +1,0 @@
-#!/bin/sh
-# Copyright (C) 2008 Tim Post
-# All Rights Reserved
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# Neither the name of the original program's authors nor the names of its
-# contributors may be used to endorse or promote products derived from this
-# software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# Script to generate skeletal files for a new command
-# Uses `getopt', not quite a bash-ism but might be
-# lacking on some legacy systems.
-
-# If your shell does not support eval, shift (x) or
-# here-now documents, sorry :)
-
-usage()
-{
-	def="$DEFAULT_COMMAND"
-	cat << EOF
-\`$PROGNAME' generates skeletal command files to simplify adding commands
-Usage: $PROGNAME [options] <location>
-Options:
-  -n, --name         Name of the command (default: ${def})
-  -d, --desc         Short (20 30 chars) description of the command
-                     (def: "The $def command")
-  -e, --entry        Entry function of the command (def: cmd_${def})
-  -h, --help-entry   Entry function for command help (def: help_cmd_${def})
-  -a, --alias        Alias (nickname) for this command (def: none)
-  -t, --type         Type of command (module or builtin) (def: module)
-  -H, --help         This help summary
-  -V, --version      Print $PROGNAME version and exit normally
-
-Notes:
-  You must supply at least the name of the command.
-
-  If you do not specify a location (i.e. modules/foo), the command will be
-  created in modules/command_name or builtins/command_name depending on your
-  selection.
-
-  This script will only create skeletal files and inform you what headers
-  need to be modified to incorporate the command. You will also have to
-  manually update the main Makefile.
-
-  This script is intended only to be a convenience for developers. Example use:
-    $PROGNAME -n foo -d "Foo power" -a bar -r both -t module modules/foo
-
-  The example would generate a modular command named 'foo', which is also
-  reached by typing 'bar'.
-
-  Skeletal files do *not* depend on the autoconf generated "config.h" unless you
-  include it. This may or may not be desirable depending on your use.
-
-Report bugs to $PROGMAINT
-
-EOF
-}
-
-# Convert a string to all uppercase
-toupper()
-{
-	local str="$1"
-
-	echo "${str}" | tr 'a-z' 'A-Z'
-}
-
-# Template stored `here-now' style, this generates all files needed
-# for a new command according to arguments passed.
-generate_code()
-{
-	echo "Creating ${OUTDIR}/${CMDNAME}_def.inc ..."
-	cat << EOF > ${OUTDIR}/${CMDNAME}_def.inc
-{
-	"${CMDNAME}",
-	"${CMDDESC}",
-	&${CMDENTRY},
-	&${HELPENTRY},
-},
-
-EOF
-	[ -n "${CMDALIAS}" ] && cat << EOF >> ${OUTDIR}/${CMDNAME}_def.inc
-{
-	"${CMDALIAS}",
-	NULL,
-	&${CMDENTRY},
-	&${HELPENTRY},
-},
-
-EOF
-	local defname=$(toupper "${CMDNAME}")
-	echo "Creating ${OUTDIR}/entry.h ..."
-	cat << EOF > ${OUTDIR}/entry.h
-#ifndef ${defname}_ENTRY_H
-#define ${defname}_ENTRY_H
-
-EOF
-	[ "${CMDTYPE}" = "module" ] && cat << EOF >> ${OUTDIR}/entry.h
-/* Entry points for the ${CMDNAME} command */
-extern int ${CMDENTRY}(char **);
-extern void ${HELPENTRY}(unsigned int);
-
-#endif /* ${defname}_ENTRY_H */
-
-EOF
-	[ "${CMDTYPE}" = "builtin" ] && cat << EOF >> ${OUTDIR}/entry.h
-/* Pick up cliuser_t */
-#include "scli.h"
-
-/* Entry points for the ${CMDNAME} command */
-extern int * ${CMDENTRY}(char **, cliuser_t *);
-extern void * ${HELPENTRY}(unsigned int);
-
-#endif /* ${defname}_ENTRY_H */
-
-EOF
-	echo "Creating ${OUTDIR}/${CMDNAME}.h ..."
-	cat << EOF > ${OUTDIR}/${CMDNAME}.h
-#ifndef ${defname}_H
-#define ${defname}_H
-
-/* Prototypes for the ${CMDNAME} command, excluding entry points */
-
-
-#endif /* ${defname}_H */
-
-EOF
-	echo "Creating ${OUTDIR}/${CMDNAME}.c ..."
-	cat << EOF > ${OUTDIR}/${CMDNAME}.c
-/* Automatically generated by ${PROGNAME} on ${TIMESTAMP}
- * This is machine generated output. The author of ${PROGNAME} claims no
- * copyright over the contents of this file. Where legally permitted, the
- * contents herein are donated to the public domain.
- *
- * You should apply any license and copyright that you wish to this file,
- * replacing this header in its entirety. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "${CMDNAME}.h"
-#include "cmds.h"
-
-static const char *cmdname = "${CMDNAME}";
-
-/* Dispays help for ${CMDNAME} in various levels */
-void ${HELPENTRY}(unsigned int level)
-{
-	printf("This is the %s help for '%s'.\n",
-		level ? EXT_HELP : SHORT_HELP, cmdname);
-	return;
-}
-
-EOF
-	[ "${CMDTYPE}" = "module" ] && cat << EOF >> ${OUTDIR}/${CMDNAME}.c
-/* Main entry point for ${CMDNAME}, accepts an array of arguments */
-int ${CMDENTRY}(char **argv)
-EOF
-	[ "${CMDTYPE}" = "builtin" ] && cat << EOF >> ${OUTDIR}/${CMDNAME}.c
-/* Main entry point for ${CMDNAME}, accepts an array of arguments and a
- * pointer to the cliuser_t structure */
-int ${CMDENTRY}(char **argv, cliuser_t *usr)
-EOF
-	cat << EOF >> ${OUTDIR}/${CMDNAME}.c
-{
-	unsigned int argc;
-	unsigned int i;
-
-	/* Count the arguments */
-	for (argc = 0; argv[argc] != NULL; argc ++);
-
-	printf("%s %s\n", TEST_ANNOUNCE, cmdname);
-	printf("%d arguments passed to %s", argc - 1, cmdname);
-
-	if (argc < 2) {
-		printf("\n");
-		return CMD_SUCCESS;
-	}
-
-	printf(":\n");
-	for (i = 1; i < argc; i++)
-		printf("[%d] -> %s\n", i, argv[i]);
-
-	return CMD_SUCCESS;
-}
-
-EOF
-	printf "Done.\n\nYou should now modify %ss/%ss.h and ../Makefile" \
-		"${CMDTYPE}" "${CMDTYPE}"
-	printf " to include your new command.\n"
-	[ -n "$CMDALIAS" ] &&  {
-		printf "\nYou should also modify %ss/%s_aliases.c and " \
-			"${CMDTYPE}" "${CMDTYPE}"
-		printf "add %s as an alias for %s\n" \
-			"${CMDALIAS}" "${CMDNAME}"
-	}
-	printf "\nOnce completed, re-run make\n\n"
-}
-
-# Main program
-
-TIMESTAMP="$(date)"
-PROGNAME=$(basename $0)
-PROGVER="0.0.1"
-PROGMAINT="Tim Post <echo@echoreply.us>"
-DEFAULT_COMMAND="cmdname"
-
-# We need at least one
-[ $# = 0 ] && usage && exit 1;
-
-TEMP=$(getopt -o n:d:e:h:a:t:HV \
---long name:,desc:,entry:,help-entry:,alias:,type:,help,version \
--- "$@") || {
-	echo "Try $PROGNAME --help for help"
-}
-
-eval set -- "$TEMP"
-
-while true; do
-	case "$1" in
-	-n | --name)
-		CMDNAME="$2"
-		shift 2
-		continue
-	;;
-	-d | --desc)
-		CMDDESC="$2"
-		shift 2
-		continue
-	;;
-	-e | --entry)
-		CMDENTRY="$2"
-		shift 2
-		continue
-	;;
-	-h | --help-entry)
-		HELPENTRY="$2"
-		shift 2
-		continue
-	;;
-	-a | --alias)
-		CMDALIAS="$2"
-		shift 2
-		continue
-	;;
-	-t | --type)
-		CMDTYPE="$2"
-		shift 2
-		continue
-	;;
-	-H | --help)
-		usage
-		exit 0
-	;;
-	-V | --version)
-		echo "$PROGVER"
-		exit 0
-	;;
-	--)
-		break
-	;;
-	esac
-done
-
-# Pick up a location if one was specified
-eval set -- "$*"
-[ -n "$2" ] && OUTDIR="$2"
-
-# Fill in defaults for whatever was not specified
-[ -n "$CMDNAME" ] || CMDNAME="$DEFAULT_COMMAND"
-[ -n "$CMDDESC" ] || CMDDESC="The $CMDNAME command"
-[ -n "$CMDENTRY" ] || CMDENTRY="cmd_${CMDNAME}"
-[ -n "$HELPENTRY" ] || HELPENTRY="help_cmd_${CMDNAME}"
-[ -n "$CMDTYPE" ] || CMDTYPE="module"
-[ -n "$OUTDIR" ] || OUTDIR="${CMDTYPE}s/${CMDNAME}"
-
-
-# Do a little sanity
-[ -d $OUTDIR ] && {
-	echo "$OUTDIR already exists, remove it to proceed."
-	exit 1
-}
-
-mkdir -p ${OUTDIR} >/dev/null 2>&1 || {
-	echo "Could not create ${OUTDIR}, aborting!"
-	exit 1
-}
-
-# Generate the files and inform on how to include them based on options
-generate_code
-
-exit 0
-
Index: pace/app/bdsh/cmds/mod_cmds.c
===================================================================
--- uspace/app/bdsh/cmds/mod_cmds.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * NOTES:
- * module_* functions are pretty much identical to builtin_* functions at this
- * point. On the surface, it would appear that making each function dual purpose
- * would be economical.
- *
- * These are kept separate because the structures (module_t and builtin_t) may
- * grow apart and become rather different, even though they're identical at this
- * point.
- *
- * To keep things easy to hack, everything is separated. In reality this only adds
- * 6 - 8 extra functions, but keeps each function very easy to read and modify.
- */
-
-/*
- * TODO:
- * Many of these could be unsigned, provided the modules and builtins themselves
- * can follow suit. Long term goal.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include "errors.h"
-#include "cmds.h"
-#include "module_aliases.h"
-
-extern volatile unsigned int cli_interactive;
-
-/** Checks if an entry function matching command exists in modules[]
- *
- * If so, its position in the array is returned
- */
-int is_module(const char *command)
-{
-	module_t *mod;
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return -2;
-
-	for (mod = modules; mod->name != NULL; mod++, i++) {
-		if (!str_cmp(mod->name, command))
-			return i;
-	}
-
-	return -1;
-}
-
-/*
- * Checks if a module is an alias (sharing an entry point with another
- * module). Returns 1 if so
- */
-int is_module_alias(const char *command)
-{
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return -1;
-
-	for (i = 0; mod_aliases[i] != NULL; i += 2) {
-		if (!str_cmp(mod_aliases[i], command))
-			return 1;
-	}
-
-	return 0;
-}
-
-/* Returns the name of the module that an alias points to */
-char *alias_for_module(const char *command)
-{
-	unsigned int i = 0;
-
-	if (NULL == command)
-		return (char *)NULL;
-
-	for (i = 0; mod_aliases[i] != NULL; i += 2) {
-		if (!str_cmp(mod_aliases[i], command))
-			return (char *)mod_aliases[i + 1];
-	}
-
-	return (char *)NULL;
-}
-
-/** Invokes the 'help' entry function for the module at position (int) module
- *
- * which wants an unsigned int to determine brief or extended display.
- */
-int help_module(int module, unsigned int extended)
-{
-	module_t *mod = modules;
-
-	mod += module;
-
-	if (NULL != mod->help) {
-		mod->help(extended);
-		return CL_EOK;
-	} else {
-		return CL_ENOENT;
-	}
-}
-
-/** Invokes the module entry point modules[module]
- *
- * passing argv[] as an argument stack.
- */
-int run_module(int module, char *argv[], iostate_t *new_iostate)
-{
-	int rc;
-	module_t *mod = modules;
-
-	mod += module;
-
-	iostate_t *old_iostate = get_iostate();
-	set_iostate(new_iostate);
-
-	if (NULL != mod->entry) {
-		rc = ((int)mod->entry(argv));
-	} else {
-		rc = CL_ENOENT;
-	}
-
-	set_iostate(old_iostate);
-
-	return rc;
-}
Index: pace/app/bdsh/cmds/modules/README
===================================================================
--- uspace/app/bdsh/cmds/modules/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-Modules are commands or full programs (anything can be made into a module
-that can return int type) should go here. Note, modules do not (can not)
-update or read cliuser_t.
-
-Stuff that needs to write to the user structures contained in scli.h should
-be made as built-in commands, not modules, but there are very few times when
-you would want to do that.
-
-See the README file in the bdsh root directory for a quick overview of how to
-write a new command, or convert an existig stand-alone program into a module
-for BDSH.
-
-
-
-
Index: pace/app/bdsh/cmds/modules/alias/alias.c
===================================================================
--- uspace/app/bdsh/cmds/modules/alias/alias.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2018 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "alias.h"
-#include "cmds.h"
-
-#include <adt/odict.h>
-
-static const char *cmdname = "alias";
-static const char *alias_format = "%s='%s'\n";
-
-static void list_aliases()
-{
-	odlink_t *alias_link = odict_first(&alias_dict);
-	while (alias_link != NULL) {
-		alias_t *data = odict_get_instance(alias_link, alias_t, odict);
-		printf(alias_format, data->name, data->value);
-		alias_link = odict_next(alias_link, &alias_dict);
-	}
-}
-
-static bool print_alias(const char *name)
-{
-	odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)name, NULL);
-	if (alias_link != NULL) {
-		alias_t *data = odict_get_instance(alias_link, alias_t, odict);
-		printf(alias_format, data->name, data->value);
-		return true;
-	}
-
-	cli_error(CL_ENOENT, "%s: No alias with the name '%s' exists\n", cmdname, name);
-	return false;
-}
-
-static errno_t set_alias(const char *name, const char *value)
-{
-	odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)name, NULL);
-
-	if (alias_link != NULL) {
-		/* update existing value */
-		alias_t *data = odict_get_instance(alias_link, alias_t, odict);
-		char *dup_value = str_dup(value);
-
-		if (dup_value == NULL) {
-			cli_error(CL_ENOMEM, "%s: failing to allocate memory for value\n", cmdname);
-			return ENOMEM;
-		}
-
-		free(data->value);
-		data->value = dup_value;
-	} else {
-		/* add new value */
-		alias_t *data = (alias_t *)calloc(1, sizeof(alias_t));
-		if (data == NULL) {
-			cli_error(CL_ENOMEM, "%s: failing to allocate memory for data container\n", cmdname);
-			return ENOMEM;
-		}
-
-		data->name = str_dup(name);
-		if (data->name == NULL) {
-			cli_error(CL_ENOMEM, "%s: failing to allocate memory for name\n", cmdname);
-			free(data);
-			return ENOMEM;
-		}
-
-		data->value = str_dup(value);
-		if (data->value == NULL) {
-			cli_error(CL_ENOMEM, "%s: failing to allocate memory for value\n", cmdname);
-			free(data->name);
-			free(data);
-			return ENOMEM;
-		}
-		odict_insert(&data->odict, &alias_dict, NULL);
-	}
-
-	return EOK;
-}
-
-static bool validate_name(const char *name)
-{
-	while (*name != '\0') {
-		if (*name == '/')
-			return false;
-		if (*name == ' ')
-			return false;
-		if (*name == '\"')
-			return false;
-		if (*name == '\'')
-			return false;
-		if (*name == '|')
-			return false;
-
-		name++;
-	}
-
-	return true;
-}
-
-/* Dispays help for alias in various levels */
-void help_cmd_alias(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' sets an alias, displays an alias or lists all aliases\n", cmdname);
-	} else {
-		help_cmd_alias(HELP_SHORT);
-		printf("Usage: `%s' [newalias[='existingCMD --flags] ...]'\n\n"
-		    "If no parameters are given it will display all existing aliases.\n"
-		    "If a parameter without an assignment is given, the value of the given alias will be returned.\n"
-		    "If a parameter with an assignment is given, the alias will be created or updated for the given value. "
-		    "It is possible to create an alias to a different alias. A circularity will prevent an alias to be resolved.\n",
-		    cmdname);
-	}
-}
-
-/* Main entry point for alias, accepts an array of arguments */
-int cmd_alias(char **argv)
-{
-
-	if (argv[1] == NULL) {
-		list_aliases();
-		return CMD_SUCCESS;
-	}
-
-	size_t i;
-	for (i = 1; argv[i] != NULL; i++) {
-		char *name = argv[i];
-		char *value;
-		if ((value = str_chr(name, '=')) != NULL) {
-			name[value - name] = '\0';
-
-			if (!validate_name(name)) {
-				cli_error(CL_EFAIL, "%s: invalid alias name given\n", cmdname);
-				return CMD_FAILURE;
-			}
-
-			if (set_alias(name, value + 1) != EOK) {
-				return CMD_FAILURE;
-			}
-		} else {
-			if (!print_alias(name)) {
-				return CMD_FAILURE;
-			}
-		}
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/alias/alias.h
===================================================================
--- uspace/app/bdsh/cmds/modules/alias/alias.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef ALIAS_H
-#define ALIAS_H
-
-/* Prototypes for the alias command, excluding entry points */
-
-#endif /* ALIAS_H */
Index: pace/app/bdsh/cmds/modules/alias/alias_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/alias/alias_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"alias",
-	"setting, show or list aliases",
-	&cmd_alias,
-	&help_cmd_alias,
-},
-
Index: pace/app/bdsh/cmds/modules/alias/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/alias/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef ALIAS_ENTRY_H
-#define ALIAS_ENTRY_H
-
-/* Entry points for the alias command */
-extern int cmd_alias(char **);
-extern void help_cmd_alias(unsigned int);
-
-#endif /* ALIAS_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/cat/cat.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,420 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * Copyright (c) 2011, Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/color.h>
-#include <io/style.h>
-#include <io/keycode.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-#include <assert.h>
-
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "cat.h"
-#include "cmds.h"
-
-static const char *cmdname = "cat";
-#define CAT_VERSION "0.0.1"
-#define CAT_DEFAULT_BUFLEN 1024
-#define CAT_FULL_FILE 0
-
-static const char *hexchars = "0123456789abcdef";
-
-static bool paging_enabled = false;
-static size_t chars_remaining = 0;
-static size_t lines_remaining = 0;
-static sysarg_t console_cols = 0;
-static sysarg_t console_rows = 0;
-static bool should_quit = false;
-static bool dash_represents_stdin = false;
-static unsigned int lineno = 0;
-static bool number = false;
-static bool last_char_was_newline = false;
-
-static console_ctrl_t *console = NULL;
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "version", no_argument, 0, 'v' },
-	{ "head", required_argument, 0, 'H' },
-	{ "tail", required_argument, 0, 't' },
-	{ "buffer", required_argument, 0, 'b' },
-	{ "more", no_argument, 0, 'm' },
-	{ "hex", no_argument, 0, 'x' },
-	{ "stdin", no_argument, 0, 's' },
-	{ "number", no_argument, 0, 'n' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Dispays help for cat in various levels */
-void help_cmd_cat(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' shows the contents of files\n", cmdname);
-	} else {
-		help_cmd_cat(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] <file1> [file2] [...]\n"
-		    "Options:\n"
-		    "  -h, --help       A short option summary\n"
-		    "  -v, --version    Print version information and exit\n"
-		    "  -H, --head ##    Print only the first ## bytes\n"
-		    "  -t, --tail ##    Print only the last ## bytes\n"
-		    "  -b, --buffer ##  Set the read buffer size to ##\n"
-		    "  -m, --more       Pause after each screen full\n"
-		    "  -x, --hex        Print bytes as hex values\n"
-		    "  -s, --stdin      Treat `-' in file list as standard input\n"
-		    "  -n, --number     Number all output lines\n"
-		    "Currently, %s is under development, some options don't work.\n",
-		    cmdname, cmdname);
-	}
-
-	return;
-}
-
-static void waitprompt(void)
-{
-	console_set_pos(console, 0, console_rows - 1);
-	console_set_color(console, COLOR_WHITE, COLOR_BLUE, 0);
-
-	printf("ENTER/SPACE/PAGE DOWN - next page, "
-	    "ESC/Q - quit, C - continue unpaged");
-	fflush(stdout);
-
-	console_set_style(console, STYLE_NORMAL);
-}
-
-static void waitkey(void)
-{
-	cons_event_t ev;
-	kbd_event_t *kev;
-	errno_t rc;
-
-	while (true) {
-		rc = console_get_event(console, &ev);
-		if (rc != EOK)
-			return;
-		if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
-			kev = &ev.ev.key;
-
-			if (kev->key == KC_ESCAPE || kev->key == KC_Q) {
-				should_quit = true;
-				return;
-			}
-			if (kev->key == KC_C) {
-				paging_enabled = false;
-				return;
-			}
-			if (kev->key == KC_ENTER || kev->key == KC_SPACE ||
-			    kev->key == KC_PAGE_DOWN) {
-				return;
-			}
-		}
-	}
-	assert(false);
-}
-
-static void newpage(void)
-{
-	console_clear(console);
-	chars_remaining = console_cols;
-	lines_remaining = console_rows - 1;
-}
-
-static void paged_char(char32_t c)
-{
-	if (last_char_was_newline && number) {
-		lineno++;
-		printf("%6u  ", lineno);
-	}
-	putuchar(c);
-	last_char_was_newline = c == '\n';
-	if (paging_enabled) {
-		chars_remaining--;
-		if (c == '\n' || chars_remaining == 0) {
-			chars_remaining = console_cols;
-			lines_remaining--;
-		}
-		if (lines_remaining == 0) {
-			fflush(stdout);
-			waitprompt();
-			waitkey();
-			newpage();
-		}
-	}
-}
-
-static unsigned int cat_file(const char *fname, size_t blen, bool hex,
-    off64_t head, off64_t tail, bool tail_first)
-{
-	int fd, count = 0, reads = 0;
-	size_t bytes;
-	char *buff = NULL;
-	size_t i;
-	size_t offset = 0, copied_bytes = 0;
-	off64_t file_size = 0, length = 0;
-	aoff64_t pos = 0;
-	errno_t rc;
-
-	bool reading_stdin = dash_represents_stdin && (str_cmp(fname, "-") == 0);
-
-	if (reading_stdin) {
-		fd = fileno(stdin);
-		/* Allow storing the whole UTF-8 character. */
-		blen = STR_BOUNDS(1);
-	} else {
-		errno_t rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-		if (rc != EOK) {
-			fd = -1;
-		}
-	}
-
-	if (fd < 0) {
-		printf("Unable to open %s\n", fname);
-		return 1;
-	}
-
-	if (NULL == (buff = (char *) malloc(blen + 1))) {
-		vfs_put(fd);
-		printf("Unable to allocate enough memory to read %s\n",
-		    fname);
-		return 1;
-	}
-
-	if (tail != CAT_FULL_FILE) {
-		vfs_stat_t st;
-
-		if (vfs_stat(fd, &st) != EOK) {
-			vfs_put(fd);
-			free(buff);
-			printf("Unable to vfs_stat %d\n", fd);
-			return 1;
-		}
-		file_size = st.size;
-		if (head == CAT_FULL_FILE) {
-			head = file_size;
-			length = tail;
-		} else if (tail_first) {
-			length = head;
-		} else {
-			if (tail > head)
-				tail = head;
-			length = tail;
-		}
-
-		if (tail_first) {
-			pos = (tail >= file_size) ? 0 : (file_size - tail);
-		} else {
-			pos = ((head - tail) >= file_size) ? 0 : (head - tail);
-		}
-	} else
-		length = head;
-
-	do {
-		size_t bytes_to_read;
-		if (reading_stdin) {
-			bytes_to_read = 1;
-		} else {
-			if ((length != CAT_FULL_FILE) &&
-			    (length - (off64_t)count <= (off64_t)(blen - copied_bytes))) {
-				bytes_to_read = (size_t) (length - count);
-			} else {
-				bytes_to_read = blen - copied_bytes;
-			}
-		}
-
-		rc = vfs_read(fd, &pos, buff + copied_bytes, bytes_to_read,
-		    &bytes);
-		copied_bytes = 0;
-
-		if (rc == EOK && bytes > 0) {
-			buff[bytes] = '\0';
-			offset = 0;
-			for (i = 0; i < bytes && !should_quit; i++) {
-				if (hex) {
-					paged_char(hexchars[((uint8_t)buff[i]) / 16]);
-					paged_char(hexchars[((uint8_t)buff[i]) % 16]);
-					paged_char(((count + i + 1) & 0xf) == 0 ? '\n' : ' ');
-				} else {
-					char32_t c = str_decode(buff, &offset, bytes);
-					if (c == 0) {
-						/* Reached end of string */
-						break;
-					} else if (c == U_SPECIAL && offset + 2 >= (size_t)bytes) {
-						/*
-						 * If an extended character is cut off due to the size of the buffer,
-						 * we will copy it over to the next buffer so it can be read correctly.
-						 */
-						copied_bytes = bytes - offset + 1;
-						memcpy(buff, buff + offset - 1, copied_bytes);
-						break;
-					}
-					paged_char(c);
-				}
-
-			}
-			count += bytes;
-			reads++;
-		}
-
-		if (reading_stdin)
-			fflush(stdout);
-	} while (rc == EOK && bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE));
-
-	vfs_put(fd);
-	if (rc != EOK) {
-		printf("Error reading %s\n", fname);
-		free(buff);
-		return 1;
-	}
-
-	free(buff);
-
-	return 0;
-}
-
-/* Main entry point for cat, accepts an array of arguments */
-int cmd_cat(char **argv)
-{
-	unsigned int argc, i, ret = 0;
-	size_t buffer = 0;
-	int c, opt_ind;
-	aoff64_t head = CAT_FULL_FILE, tail = CAT_FULL_FILE;
-	bool hex = false;
-	bool more = false;
-	bool tailFirst = false;
-	sysarg_t rows, cols;
-	errno_t rc;
-
-	/*
-	 * reset global state
-	 * TODO: move to structure?
-	 */
-	paging_enabled = false;
-	chars_remaining = 0;
-	lines_remaining = 0;
-	console_cols = 0;
-	console_rows = 0;
-	should_quit = false;
-	dash_represents_stdin = false;
-	console = console_init(stdin, stdout);
-	number = false;
-	lineno = 0;
-	/* This enables printing of the first number. */
-	last_char_was_newline = true;
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "xhvmH:t:b:sn", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_cat(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'v':
-			printf("%s\n", CAT_VERSION);
-			return CMD_SUCCESS;
-		case 'H':
-			if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK) {
-				puts("Invalid head size");
-				return CMD_FAILURE;
-			}
-			break;
-		case 't':
-			if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK) {
-				puts("Invalid tail size");
-				return CMD_FAILURE;
-			}
-			if (head == CAT_FULL_FILE)
-				tailFirst = true;
-			break;
-		case 'b':
-			if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK) {
-				puts("Invalid buffer size");
-				return CMD_FAILURE;
-			}
-			break;
-		case 'm':
-			more = true;
-			break;
-		case 'x':
-			hex = true;
-			break;
-		case 's':
-			dash_represents_stdin = true;
-			break;
-		case 'n':
-			number = true;
-			break;
-		}
-	}
-
-	argc -= optind;
-
-	if (argc < 1) {
-		printf("%s - incorrect number of arguments. Try `%s --help'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	if (buffer < 4)
-		buffer = CAT_DEFAULT_BUFLEN;
-
-	if (more) {
-		rc = console_get_size(console, &cols, &rows);
-		if (rc != EOK) {
-			printf("%s - cannot get console size\n", cmdname);
-			return CMD_FAILURE;
-		}
-		console_cols = cols;
-		console_rows = rows;
-		paging_enabled = true;
-		newpage();
-	}
-
-	for (i = optind; argv[i] != NULL && !should_quit; i++)
-		ret += cat_file(argv[i], buffer, hex, head, tail, tailFirst);
-
-	if (ret)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/cat/cat.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef CAT_H
-#define CAT_H
-
-/* Prototypes for the cat command, excluding entry points */
-
-#endif /* CAT_H */
Index: pace/app/bdsh/cmds/modules/cat/cat_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/cat_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"cat",
-	"Show the contents of a file",
-	&cmd_cat,
-	&help_cmd_cat,
-},
-
Index: pace/app/bdsh/cmds/modules/cat/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cat/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef CAT_ENTRY_H
-#define CAT_ENTRY_H
-
-/* Entry points for the cat command */
-extern int cmd_cat(char **);
-extern void help_cmd_cat(unsigned int);
-
-#endif /* CAT_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/cmp/cmp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <getopt.h>
-#include <mem.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-
-#include "cmds.h"
-#include "cmp.h"
-#include "config.h"
-#include "entry.h"
-#include "errors.h"
-#include "util.h"
-
-static const char *cmdname = "cmp";
-#define CMP_VERSION "0.0.1"
-#define CMP_BUFLEN 1024
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "version", no_argument, 0, 'v' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Dispays help for cat in various levels */
-void help_cmd_cmp(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' compares the contents of two files\n", cmdname);
-	} else {
-		help_cmd_cmp(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] <file1> <file2>\n"
-		    "Options:\n"
-		    "  -h, --help       A short option summary\n"
-		    "  -v, --version    Print version information and exit\n"
-		    "No output is printed; the return code is 1 if the files differ.\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-static errno_t cmp_files(const char *fn0, const char *fn1)
-{
-	errno_t rc = EOK;
-	const char *fn[2] = { fn0, fn1 };
-	int fd[2] = { -1, -1 };
-	char buffer[2][CMP_BUFLEN];
-	size_t offset[2];
-	aoff64_t pos[2] = { };
-
-	for (int i = 0; i < 2; i++) {
-		rc = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ, &(fd[i]));
-		if (rc != EOK) {
-			printf("Unable to open %s\n", fn[i]);
-			goto end;
-		}
-	}
-
-	do {
-		for (int i = 0; i < 2; i++) {
-			rc = vfs_read(fd[i], &pos[i], buffer[i], CMP_BUFLEN,
-			    &offset[i]);
-			if (rc != EOK) {
-				printf("Error reading from %s\n",
-				    fn[i]);
-				goto end;
-			}
-		}
-
-		if (offset[0] != offset[1] ||
-		    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
-			printf("Return 1\n");
-			rc = EBUSY;
-			goto end;
-		}
-	} while (offset[0] == CMP_BUFLEN);
-
-end:
-	if (fd[0] >= 0)
-		vfs_put(fd[0]);
-	if (fd[1] >= 0)
-		vfs_put(fd[1]);
-	return rc;
-}
-
-/* Main entry point for cmd, accepts an array of arguments */
-int cmd_cmp(char **argv)
-{
-	errno_t rc;
-	unsigned int argc;
-	int c, opt_ind;
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "hv", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_cmp(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'v':
-			printf("%s\n", CMP_VERSION);
-			return CMD_SUCCESS;
-		}
-	}
-
-	if (argc - optind != 2) {
-		printf("%s - incorrect number of arguments. Try `%s --help'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	rc = cmp_files(argv[optind], argv[optind + 1]);
-	if (rc != EOK)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/cmp/cmp.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef CMP_H
-#define CMP_H
-
-/* Prototypes for the cmp command, excluding entry points */
-
-#endif /* CMP_H */
Index: pace/app/bdsh/cmds/modules/cmp/cmp_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"cmp",
-	"Compare the contents of two files",
-	&cmd_cmp,
-	&help_cmd_cmp,
-},
-
Index: pace/app/bdsh/cmds/modules/cmp/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef CMP_ENTRY_H
-#define CMP_ENTRY_H
-
-/* Entry points for the cat command */
-extern int cmd_cmp(char **);
-extern void help_cmd_cmp(unsigned int);
-
-#endif /* CAT_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,557 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <getopt.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <dirent.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "cp.h"
-#include "cmds.h"
-
-#define CP_VERSION "0.0.1"
-#define CP_DEFAULT_BUFLEN  1024
-
-static const char *cmdname = "cp";
-static console_ctrl_t *con;
-
-static struct option const long_options[] = {
-	{ "buffer", required_argument, 0, 'b' },
-	{ "force", no_argument, 0, 'f' },
-	{ "interactive", no_argument, 0, 'i' },
-	{ "recursive", no_argument, 0, 'r' },
-	{ "help", no_argument, 0, 'h' },
-	{ "version", no_argument, 0, 'v' },
-	{ "verbose", no_argument, 0, 'V' },
-	{ 0, 0, 0, 0 }
-};
-
-typedef enum {
-	TYPE_NONE,
-	TYPE_FILE,
-	TYPE_DIR
-} dentry_type_t;
-
-static int copy_file(const char *src, const char *dest,
-    size_t blen, int vb);
-
-/** Get the type of a directory entry.
- *
- * @param path	Path of the directory entry.
- *
- * @return TYPE_DIR if the dentry is a directory.
- * @return TYPE_FILE if the dentry is a file.
- * @return TYPE_NONE if the dentry does not exists.
- */
-static dentry_type_t get_type(const char *path)
-{
-	vfs_stat_t s;
-
-	errno_t r = vfs_stat_path(path, &s);
-
-	if (r != EOK)
-		return TYPE_NONE;
-	else if (s.is_directory)
-		return TYPE_DIR;
-	else if (s.is_file)
-		return TYPE_FILE;
-
-	return TYPE_NONE;
-}
-
-static int strtoint(const char *s1)
-{
-	long t1;
-
-	if (-1 == (t1 = strtol(s1, (char **) NULL, 10)))
-		return -1;
-
-	if (t1 <= 0)
-		return -1;
-
-	return (int) t1;
-}
-
-/** Get the last component of a path.
- *
- * e.g. /data/a  ---> a
- *
- * @param path	Pointer to the path.
- *
- * @return	Pointer to the last component or to the path itself.
- */
-static char *get_last_path_component(char *path)
-{
-	char *ptr;
-
-	ptr = str_rchr(path, '/');
-	if (!ptr)
-		return path;
-	else
-		return ptr + 1;
-}
-
-/** Merge two paths together.
- *
- * e.g. (path1 = /data/dir, path2 = a/b) --> /data/dir/a/b
- *
- * @param path1		Path to which path2 will be appended.
- * @param path1_size	Size of the path1 buffer.
- * @param path2		Path that will be appended to path1.
- */
-static void merge_paths(char *path1, size_t path1_size, char *path2)
-{
-	const char *delim = "/";
-
-	str_rtrim(path1, '/');
-	str_append(path1, path1_size, delim);
-	str_append(path1, path1_size, path2);
-}
-
-static bool get_user_decision(bool bdefault, const char *message, ...)
-{
-	va_list args;
-	errno_t rc;
-
-	va_start(args, message);
-	vprintf(message, args);
-	va_end(args);
-
-	while (true) {
-		cons_event_t ev;
-		console_flush(con);
-		rc = console_get_event(con, &ev);
-		if (rc != EOK)
-			exit(1);
-		if (ev.type != CEV_KEY || ev.ev.key.type != KEY_PRESS ||
-		    (ev.ev.key.mods & (KM_CTRL | KM_ALT)) != 0) {
-			continue;
-		}
-
-		switch (ev.ev.key.key) {
-		case KC_Y:
-			printf("y\n");
-			return true;
-		case KC_N:
-			printf("n\n");
-			return false;
-		case KC_ENTER:
-			printf("%c\n", bdefault ? 'Y' : 'N');
-			return bdefault;
-		default:
-			break;
-		}
-	}
-}
-
-static errno_t do_copy(const char *src, const char *dest,
-    size_t blen, int vb, int recursive, int force, int interactive)
-{
-	errno_t rc = EOK;
-	char dest_path[PATH_MAX];
-	char src_path[PATH_MAX];
-	DIR *dir = NULL;
-	struct dirent *dp;
-
-	dentry_type_t src_type = get_type(src);
-	dentry_type_t dest_type = get_type(dest);
-
-	const size_t src_len = str_size(src);
-
-	if (src_type == TYPE_FILE) {
-		char *src_fname;
-
-		/* Initialize the src_path with the src argument */
-		str_cpy(src_path, src_len + 1, src);
-		str_rtrim(src_path, '/');
-
-		/* Get the last component name from the src path */
-		src_fname = get_last_path_component(src_path);
-
-		/* Initialize dest_path with the dest argument */
-		str_cpy(dest_path, PATH_MAX, dest);
-
-		if (dest_type == TYPE_DIR) {
-			/* e.g. cp file_name /data */
-			/* e.g. cp file_name /data/ */
-
-			/*
-			 * dest is a directory,
-			 * append the src filename to it.
-			 */
-			merge_paths(dest_path, PATH_MAX, src_fname);
-			dest_type = get_type(dest_path);
-		} else if (dest_type == TYPE_NONE) {
-			if (dest_path[str_size(dest_path) - 1] == '/') {
-				/* e.g. cp /textdemo /data/dirnotexists/ */
-
-				printf("The dest directory %s does not exists",
-				    dest_path);
-				rc = ENOENT;
-				goto exit;
-			}
-		}
-
-		if (dest_type == TYPE_DIR) {
-			printf("Cannot overwrite existing directory %s\n",
-			    dest_path);
-			rc = EEXIST;
-			goto exit;
-		} else if (dest_type == TYPE_FILE) {
-			/* e.g. cp file_name existing_file */
-
-			/*
-			 * dest already exists,
-			 * if force is set we will try to remove it.
-			 * if interactive is set user input is required.
-			 */
-			if (force && !interactive) {
-				rc = vfs_unlink_path(dest_path);
-				if (rc != EOK) {
-					printf("Unable to remove %s\n",
-					    dest_path);
-					goto exit;
-				}
-			} else if (!force && interactive) {
-				bool overwrite = get_user_decision(false,
-				    "File already exists: %s. Overwrite? [y/N]: ",
-				    dest_path);
-				if (overwrite) {
-					printf("Overwriting file: %s\n", dest_path);
-					rc = vfs_unlink_path(dest_path);
-					if (rc != EOK) {
-						printf("Unable to remove %s\n", dest_path);
-						goto exit;
-					}
-				} else {
-					printf("Not overwriting file: %s\n", dest_path);
-					rc = EOK;
-					goto exit;
-				}
-			} else {
-				printf("File already exists: %s\n", dest_path);
-				rc = EEXIST;
-				goto exit;
-			}
-		}
-
-		/* call copy_file and exit */
-		if (copy_file(src, dest_path, blen, vb) < 0) {
-			rc = EIO;
-		}
-
-	} else if (src_type == TYPE_DIR) {
-		/* e.g. cp -r /x/srcdir /y/destdir/ */
-
-		if (!recursive) {
-			printf("Cannot copy the %s directory without the "
-			    "-r option\n", src);
-			rc = EINVAL;
-			goto exit;
-		} else if (dest_type == TYPE_FILE) {
-			printf("Cannot overwrite a file with a directory\n");
-			rc = EEXIST;
-			goto exit;
-		}
-
-		char *src_dirname;
-
-		/* Initialize src_path with the content of src */
-		str_cpy(src_path, src_len + 1, src);
-		str_rtrim(src_path, '/');
-
-		src_dirname = get_last_path_component(src_path);
-
-		str_cpy(dest_path, PATH_MAX, dest);
-
-		switch (dest_type) {
-		case TYPE_DIR:
-			if (str_cmp(src_dirname, "..") &&
-			    str_cmp(src_dirname, ".")) {
-				/*
-				 * The last component of src_path is
-				 * not '.' or '..'
-				 */
-				merge_paths(dest_path, PATH_MAX, src_dirname);
-
-				rc = vfs_link_path(dest_path, KIND_DIRECTORY,
-				    NULL);
-				if (rc != EOK) {
-					printf("Unable to create "
-					    "dest directory %s\n", dest_path);
-					goto exit;
-				}
-			}
-			break;
-		default:
-		case TYPE_NONE:
-			/*
-			 * dest does not exists, this means the user wants
-			 * to specify the name of the destination directory
-			 *
-			 * e.g. cp -r /src /data/new_dir_src
-			 */
-			rc = vfs_link_path(dest_path, KIND_DIRECTORY, NULL);
-			if (rc != EOK) {
-				printf("Unable to create "
-				    "dest directory %s\n", dest_path);
-				goto exit;
-			}
-			break;
-		}
-
-		dir = opendir(src);
-		if (!dir) {
-			/* Something strange is happening... */
-			printf("Unable to open src %s directory\n", src);
-			rc = ENOENT;
-			goto exit;
-		}
-
-		/*
-		 * Copy every single directory entry of src into the
-		 * destination directory.
-		 */
-		while ((dp = readdir(dir))) {
-			vfs_stat_t src_s;
-			vfs_stat_t dest_s;
-
-			char src_dent[PATH_MAX];
-			char dest_dent[PATH_MAX];
-
-			str_cpy(src_dent, PATH_MAX, src);
-			merge_paths(src_dent, PATH_MAX, dp->d_name);
-
-			str_cpy(dest_dent, PATH_MAX, dest_path);
-			merge_paths(dest_dent, PATH_MAX, dp->d_name);
-
-			/* Check if we are copying a directory into itself */
-			vfs_stat_path(src_dent, &src_s);
-			vfs_stat_path(dest_path, &dest_s);
-
-			if (dest_s.index == src_s.index &&
-			    dest_s.fs_handle == src_s.fs_handle) {
-				printf("Cannot copy a directory "
-				    "into itself\n");
-				rc = EEXIST;
-				goto exit;
-			}
-
-			if (vb)
-				printf("copy %s %s\n", src_dent, dest_dent);
-
-			/* Recursively call do_copy() */
-			rc = do_copy(src_dent, dest_dent, blen, vb, recursive,
-			    force, interactive);
-			if (rc != EOK)
-				goto exit;
-
-		}
-	} else
-		printf("Unable to open source file %s\n", src);
-
-exit:
-	if (dir)
-		closedir(dir);
-	return rc;
-}
-
-static int copy_file(const char *src, const char *dest,
-    size_t blen, int vb)
-{
-	int fd1, fd2;
-	size_t rbytes, wbytes;
-	errno_t rc;
-	off64_t total;
-	char *buff = NULL;
-	aoff64_t posr = 0, posw = 0;
-	vfs_stat_t st;
-
-	if (vb)
-		printf("Copying %s to %s\n", src, dest);
-
-	rc = vfs_lookup_open(src, WALK_REGULAR, MODE_READ, &fd1);
-	if (rc != EOK) {
-		printf("Unable to open source file %s\n", src);
-		return -1;
-	}
-
-	rc = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &fd2);
-	if (rc != EOK) {
-		printf("Unable to open destination file %s\n", dest);
-		vfs_put(fd1);
-		return -1;
-	}
-
-	if (vfs_stat(fd1, &st) != EOK) {
-		printf("Unable to fstat %d\n", fd1);
-		vfs_put(fd1);
-		vfs_put(fd2);
-		return -1;
-	}
-
-	total = st.size;
-	if (vb)
-		printf("%" PRIu64 " bytes to copy\n", total);
-
-	if (NULL == (buff = (char *) malloc(blen))) {
-		printf("Unable to allocate enough memory to read %s\n",
-		    src);
-		rc = ENOMEM;
-		goto out;
-	}
-
-	while ((rc = vfs_read(fd1, &posr, buff, blen, &rbytes)) == EOK &&
-	    rbytes > 0) {
-		if ((rc = vfs_write(fd2, &posw, buff, rbytes, &wbytes)) != EOK)
-			break;
-	}
-
-	if (rc != EOK) {
-		printf("\nError copying %s: %s\n", src, str_error(rc));
-		return -1;
-	}
-
-out:
-	vfs_put(fd1);
-	vfs_put(fd2);
-	if (buff)
-		free(buff);
-	if (rc != EOK) {
-		return -1;
-	} else {
-		return 0;
-	}
-}
-
-void help_cmd_cp(unsigned int level)
-{
-	static char helpfmt[] =
-	    "Usage:  %s [options] <source> <dest>\n"
-	    "Options:\n"
-	    "  -h, --help       A short option summary\n"
-	    "  -v, --version    Print version information and exit\n"
-	    "  -V, --verbose    Be annoyingly noisy about what's being done\n"
-	    "  -f, --force      Do not complain when <dest> exists (overrides a previous -i)\n"
-	    "  -i, --interactive Ask what to do when <dest> exists (overrides a previous -f)\n"
-	    "  -r, --recursive  Copy entire directories\n"
-	    "  -b, --buffer ## Set the read buffer size to ##\n";
-	if (level == HELP_SHORT) {
-		printf("`%s' copies files and directories\n", cmdname);
-	} else {
-		help_cmd_cp(HELP_SHORT);
-		printf(helpfmt, cmdname);
-	}
-
-	return;
-}
-
-int cmd_cp(char **argv)
-{
-	unsigned int argc, verbose = 0;
-	int buffer = 0, recursive = 0;
-	int force = 0, interactive = 0;
-	int c, opt_ind;
-	errno_t ret;
-
-	con = console_init(stdin, stdout);
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_cp(1);
-			return CMD_SUCCESS;
-		case 'v':
-			printf("%s\n", CP_VERSION);
-			return CMD_SUCCESS;
-		case 'V':
-			verbose = 1;
-			break;
-		case 'f':
-			interactive = 0;
-			force = 1;
-			break;
-		case 'i':
-			force = 0;
-			interactive = 1;
-			break;
-		case 'r':
-			recursive = 1;
-			break;
-		case 'b':
-			if (-1 == (buffer = strtoint(optarg))) {
-				printf("%s: Invalid buffer specification, "
-				    "(should be a number greater than zero)\n",
-				    cmdname);
-				console_done(con);
-				return CMD_FAILURE;
-			}
-			if (verbose)
-				printf("Buffer = %d\n", buffer);
-			break;
-		}
-	}
-
-	if (buffer == 0)
-		buffer = CP_DEFAULT_BUFLEN;
-
-	argc -= optind;
-
-	if (argc != 2) {
-		printf("%s: invalid number of arguments. Try %s --help\n",
-		    cmdname, cmdname);
-		console_done(con);
-		return CMD_FAILURE;
-	}
-
-	ret = do_copy(argv[optind], argv[optind + 1], buffer, verbose,
-	    recursive, force, interactive);
-
-	console_done(con);
-
-	if (ret == 0)
-		return CMD_SUCCESS;
-	else
-		return CMD_FAILURE;
-}
Index: pace/app/bdsh/cmds/modules/cp/cp.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef CP_H
-#define CP_H
-
-/* Prototypes for the cp command, excluding entry points */
-
-#endif /* CP_H */
Index: pace/app/bdsh/cmds/modules/cp/cp_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"cp",
-	"Copy files and directories",
-	&cmd_cp,
-	&help_cmd_cp,
-},
-
Index: pace/app/bdsh/cmds/modules/cp/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef CP_ENTRY_H
-#define CP_ENTRY_H
-
-/* Entry points for the cp command */
-extern int cmd_cp(char **);
-extern void help_cmd_cp(unsigned int);
-
-#endif /* CP_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/echo/echo.c
===================================================================
--- uspace/app/bdsh/cmds/modules/echo/echo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2012 Alexander Prutkov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "echo.h"
-#include "cmds.h"
-#include "errno.h"
-
-static const char *cmdname = "echo";
-
-void help_cmd_echo(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' prints arguments as they are, followed by a new line.\n", cmdname);
-	} else {
-		help_cmd_echo(HELP_SHORT);
-		printf("Usage:  %s [arg ...]\n", cmdname);
-	}
-
-	return;
-}
-
-/* Main entry point for echo, accepts an array of arguments */
-int cmd_echo(char **argv)
-{
-	unsigned int argc;
-
-	for (argc = 1; argv[argc] != NULL; argc++) {
-		printf("%s ", argv[argc]);
-	}
-	printf("\n");
-	return CMD_SUCCESS;
-
-}
Index: pace/app/bdsh/cmds/modules/echo/echo.h
===================================================================
--- uspace/app/bdsh/cmds/modules/echo/echo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef ECHO_H
-#define ECHO_H
-
-/* Prototypes for the echo command, excluding entry points */
-
-#endif /* ECHO_H */
Index: pace/app/bdsh/cmds/modules/echo/echo_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/echo/echo_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"echo",
-	"Prints arguments as they are",
-	&cmd_echo,
-	&help_cmd_echo,
-},
-
Index: pace/app/bdsh/cmds/modules/echo/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/echo/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef ECHO_ENTRY_H
-#define ECHO_ENTRY_H
-
-/* Entry points for the echo command */
-extern int cmd_echo(char **);
-extern void help_cmd_echo(unsigned int);
-
-#endif /* ECHO_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/help/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/help/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef HELP_ENTRY_H_
-#define HELP_ENTRY_H_
-
-/* Entry points for the help command */
-extern void help_cmd_help(unsigned int);
-extern int cmd_help(char *[]);
-
-#endif
Index: pace/app/bdsh/cmds/modules/help/help.c
===================================================================
--- uspace/app/bdsh/cmds/modules/help/help.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <fmtutil.h>
-
-#include "config.h"
-#include "entry.h"
-#include "help.h"
-#include "cmds.h"
-#include "modules.h"
-#include "builtins.h"
-#include "errors.h"
-#include "util.h"
-
-static const char *cmdname = "help";
-extern const char *progname;
-
-#define HELP_IS_COMMANDS	2
-#define HELP_IS_MODULE		1
-#define HELP_IS_BUILTIN		0
-#define HELP_IS_RUBBISH 	-1
-
-volatile int mod_switch = -1;
-
-/* Just use a pointer here, no need for mod_switch */
-static int is_mod_or_builtin(char *cmd)
-{
-	int rc = HELP_IS_RUBBISH;
-
-	if (str_cmp(cmd, "commands") == 0)
-		return HELP_IS_COMMANDS;
-
-	rc = is_builtin(cmd);
-	if (rc > -1) {
-		mod_switch = rc;
-		return HELP_IS_BUILTIN;
-	}
-	rc = is_module(cmd);
-	if (rc > -1) {
-		mod_switch = rc;
-		return HELP_IS_MODULE;
-	}
-
-	return HELP_IS_RUBBISH;
-}
-
-void help_cmd_help(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf(
-		    "\n  %s [command] <extended>\n"
-		    "  Use help [command] extended for detailed help on [command] "
-		    ", even `help'\n\n", cmdname);
-	} else {
-		printf(
-		    "\n  `%s' - shows help for commands\n"
-		    "  Examples:\n"
-		    "   %s [command]           Show help for [command]\n"
-		    "   %s [command] extended  Show extended help for [command]\n"
-		    "\n  If no argument is given to %s, a list of commands are shown\n\n",
-		    cmdname, cmdname, cmdname, cmdname);
-	}
-
-	return;
-}
-
-static void help_commands(void)
-{
-	builtin_t *cmd;
-	module_t *mod;
-
-	printf("\n  Bdsh built-in commands:\n");
-	printf("  ------------------------------------------------------------\n");
-
-	/* First, show a list of built in commands that are available in this mode */
-	for (cmd = builtins; cmd->name != NULL; cmd++) {
-		if (is_builtin_alias(cmd->name))
-			printf("   %-16s\tAlias for `%s'\n", cmd->name,
-			    alias_for_builtin(cmd->name));
-		else
-			printf("   %-16s\t%s\n", cmd->name, cmd->desc);
-	}
-
-	/* Now, show a list of module commands that are available in this mode */
-	for (mod = modules; mod->name != NULL; mod++) {
-		if (is_module_alias(mod->name))
-			printf("   %-16s\tAlias for `%s'\n", mod->name,
-			    alias_for_module(mod->name));
-		else
-			printf("   %-16s\t%s\n", mod->name, mod->desc);
-	}
-
-	printf("\n  Try %s %s for more information on how `%s' works.\n\n",
-	    cmdname, cmdname, cmdname);
-}
-
-/** Display survival tips. ('help' without arguments) */
-static void help_survival(void)
-{
-	print_wrapped_console(
-	    "Don't panic!\n\n"
-
-	    "This is Bdsh, the Brain dead shell, the HelenOS "
-	    "command-line interface. Bdsh allows you to enter "
-	    "commands and supports history (Up, Down arrow keys), "
-	    "line editing (Left Arrow, Right Arrow, Home, End, Backspace), "
-	    "selection (Shift + movement keys), copy and paste (Ctrl-C, "
-	    "Ctrl-V). You can also click your mouse within the input line "
-	    "to seek and use your mouse wheel to scroll through history.\n\n"
-
-	    "The most basic filesystem commands are Bdsh builtins. Type "
-	    "'help commands' [Enter] to see the list of Bdsh builtin commands. "
-	    "Other commands are external executables located in the /app "
-	    "directory. Type 'ls /app' [Enter] to see their list. "
-	    "You can execute an external command simply "
-	    "by entering its name. E.g., type 'nav' [Enter] to start "
-	    "Navigator, HelenOS interactive file manager).\n\n"
-
-	    "If you are not running in GUI mode, (where you can start "
-	    "multiple Terminal windows,) HelenOS console supports "
-	    "virtual consoles (VCs). You can switch between "
-	    "these using the F1-F11 keys.\n\n"
-
-	    "This is but a small glimpse of what you can do with HelenOS. "
-	    "To learn more please point your browser to the HelenOS User's "
-	    "Guide: https://www.helenos.org/wiki/UsersGuide\n\n",
-	    ALIGN_LEFT);
-}
-
-int cmd_help(char *argv[])
-{
-	int rc = 0;
-	int argc;
-	int level = HELP_SHORT;
-
-	argc = cli_count_args(argv);
-
-	if (argc > 3) {
-		printf("\nToo many arguments to `%s', try:\n", cmdname);
-		help_cmd_help(HELP_SHORT);
-		return CMD_FAILURE;
-	}
-
-	if (argc == 3) {
-		if (!str_cmp("extended", argv[2]))
-			level = HELP_LONG;
-		else
-			level = HELP_SHORT;
-	}
-
-	if (argc > 1) {
-		rc = is_mod_or_builtin(argv[1]);
-		switch (rc) {
-		case HELP_IS_RUBBISH:
-			printf("Invalid topic %s\n", argv[1]);
-			return CMD_FAILURE;
-		case HELP_IS_COMMANDS:
-			help_commands();
-			return CMD_SUCCESS;
-		case HELP_IS_MODULE:
-			help_module(mod_switch, level);
-			return CMD_SUCCESS;
-		case HELP_IS_BUILTIN:
-			help_builtin(mod_switch, level);
-			return CMD_SUCCESS;
-		}
-	}
-
-	help_survival();
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/help/help.h
===================================================================
--- uspace/app/bdsh/cmds/modules/help/help.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef HELP_H
-#define HELP_H
-
-/* Prototypes for the help command (excluding entry points) */
-
-#endif
Index: pace/app/bdsh/cmds/modules/help/help_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/help/help_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"help",
-	"Show help for commands",
-	&cmd_help,
-	&help_cmd_help,
-},
Index: pace/app/bdsh/cmds/modules/kcon/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/kcon/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef KCON_ENTRY_H
-#define KCON_ENTRY_H
-
-/* Entry points for the kcon command */
-extern int cmd_kcon(char **);
-extern void help_cmd_kcon(unsigned int);
-
-#endif /* KCON_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/kcon/kcon.c
===================================================================
--- uspace/app/bdsh/cmds/modules/kcon/kcon.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <io/console.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "kcon.h"
-#include "cmds.h"
-
-static const char *cmdname = "kcon";
-
-/* Display help for kcon in various levels */
-void help_cmd_kcon(unsigned int level)
-{
-	printf("`kcon' switches to the kernel debug console.\n");
-
-	if (level != HELP_SHORT)
-		printf("Usage: %s\n", cmdname);
-
-	return;
-}
-
-/* Main entry point for kcon, accepts an array of arguments */
-int cmd_kcon(char **argv)
-{
-	unsigned int argc = cli_count_args(argv);
-
-	if (argc != 1) {
-		printf("%s - incorrect number of arguments. Try `%s --help'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	if (console_kcon())
-		return CMD_SUCCESS;
-	else
-		return CMD_FAILURE;
-}
Index: pace/app/bdsh/cmds/modules/kcon/kcon.h
===================================================================
--- uspace/app/bdsh/cmds/modules/kcon/kcon.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef KCON_H
-#define KCON_H
-
-/* Prototypes for the kcon command, excluding entry points */
-
-#endif /* KCON_H */
Index: pace/app/bdsh/cmds/modules/kcon/kcon_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/kcon/kcon_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"kcon",
-	"Switch to kernel console",
-	&cmd_kcon,
-	&help_cmd_kcon,
-},
-
Index: pace/app/bdsh/cmds/modules/ls/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef LS_ENTRY_H
-#define LS_ENTRY_H
-
-/* Entry points for the ls command */
-extern int cmd_ls(char **);
-extern void help_cmd_ls(unsigned int);
-
-#endif /* LS_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/ls/ls.c
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,509 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * NOTE:
- * This is a bit of an ugly hack, working around the absence of fstat / etc.
- * As more stuff is completed and exposed in libc, this will improve
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <dirent.h>
-#include <getopt.h>
-#include <vfs/vfs.h>
-#include <str.h>
-#include <capa.h>
-
-#include "ls.h"
-#include "errors.h"
-#include "config.h"
-#include "util.h"
-#include "entry.h"
-#include "cmds.h"
-
-static const char *cmdname = "ls";
-
-static ls_job_t ls;
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "unsort", no_argument, 0, 'u' },
-	{ "recursive", no_argument, 0, 'r' },
-	{ "exact-size", no_argument, 0, 'e' },
-	{ "single-column", no_argument, 0, '1' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Prototypes for the ls command, excluding entry points. */
-static unsigned int ls_start(ls_job_t *);
-static errno_t ls_print(struct dir_elem_t *);
-static errno_t ls_print_single_column(struct dir_elem_t *);
-static int ls_cmp_type_name(const void *, const void *);
-static int ls_cmp_name(const void *, const void *);
-static signed int ls_scan_dir(const char *, DIR *, struct dir_elem_t **);
-static unsigned int ls_recursive(const char *, DIR *);
-static unsigned int ls_scope(const char *, struct dir_elem_t *);
-
-static unsigned int ls_start(ls_job_t *ls)
-{
-	ls->recursive = 0;
-	ls->sort = 1;
-
-	ls->exact_size = false;
-	ls->single_column = false;
-	ls->printer = ls_print;
-	return 1;
-}
-
-/** Print an entry.
- *
- * ls_print currently does nothing more than print the entry.
- * In the future, we will likely pass the absolute path, and
- * some sort of ls_options structure that controls how each
- * entry is printed and what is printed about it.
- *
- * Now we just print basic DOS style lists.
- *
- * @param de		Directory element.
- */
-static errno_t ls_print(struct dir_elem_t *de)
-{
-	int width = 13;
-
-	if (de->s.is_file) {
-		if (ls.exact_size) {
-			printf("%-40s\t%*llu\n", de->name, width, (long long) de->s.size);
-			return EOK;
-		}
-
-		capa_spec_t capa;
-		capa_from_blocks(de->s.size, 1, &capa);
-		capa_simplify(&capa);
-
-		char *rptr;
-		errno_t rc = capa_format(&capa, &rptr);
-		if (rc != EOK) {
-			return rc;
-		}
-
-		char *sep = str_rchr(rptr, ' ');
-		if (sep == NULL) {
-			free(rptr);
-			return ENOENT;
-		}
-
-		*sep = '\0';
-
-		printf("%-40s\t%*s %2s\n", de->name, width - 3, rptr, sep + 1);
-		free(rptr);
-	} else if (de->s.is_directory)
-		printf("%-40s\t%*s\n", de->name, width, "<dir>");
-	else
-		printf("%-40s\n", de->name);
-
-	return EOK;
-}
-
-static errno_t ls_print_single_column(struct dir_elem_t *de)
-{
-	if (de->s.is_file) {
-		printf("%s\n", de->name);
-	} else {
-		printf("%s/\n", de->name);
-	}
-
-	return EOK;
-}
-
-/** Compare 2 directory elements.
- *
- * It compares 2 elements of a directory : a file is considered
- * as bigger than a directory, and if they have the same type,
- * they are compared alphabetically.
- *
- * @param a		Pointer to the structure of the first element.
- * @param b		Pointer to the structure of the second element.
- *
- * @return		-1 if a < b, 1 otherwise.
- */
-static int ls_cmp_type_name(const void *a, const void *b)
-{
-	struct dir_elem_t const *da = a;
-	struct dir_elem_t const *db = b;
-
-	if ((da->s.is_directory && db->s.is_file) ||
-	    ((da->s.is_directory == db->s.is_directory) &&
-	    str_cmp(da->name, db->name) < 0))
-		return -1;
-	else
-		return 1;
-}
-
-/** Compare directories/files per name
- *
- * This comparision ignores the type of
- * the node. Sorted will strictly by name.
- *
- */
-static int ls_cmp_name(const void *a, const void *b)
-{
-	struct dir_elem_t const *da = a;
-	struct dir_elem_t const *db = b;
-
-	return str_cmp(da->name, db->name);
-}
-
-/** Scan a directory.
- *
- * Scan the content of a directory and print it.
- *
- * @param d		Name of the directory.
- * @param dirp	Directory stream.
- * @param sort	1 if the output must be sorted,
- *				0 otherwise.
- */
-static signed int ls_scan_dir(const char *d, DIR *dirp,
-    struct dir_elem_t **dir_list_ptr)
-{
-	int alloc_blocks = 20;
-	int i;
-	int nbdirs = 0;
-	errno_t rc;
-	int len;
-	char *buff;
-	struct dir_elem_t *tmp;
-	struct dir_elem_t *tosort;
-	struct dirent *dp;
-
-	if (!dirp)
-		return -1;
-
-	buff = (char *) malloc(PATH_MAX);
-	if (!buff) {
-		cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-		return -1;
-	}
-
-	tosort = (struct dir_elem_t *) malloc(alloc_blocks * sizeof(*tosort));
-	if (!tosort) {
-		cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-		free(buff);
-		return -1;
-	}
-
-	while ((dp = readdir(dirp))) {
-		if (nbdirs + 1 > alloc_blocks) {
-			alloc_blocks += alloc_blocks;
-
-			tmp = (struct dir_elem_t *) realloc(tosort,
-			    alloc_blocks * sizeof(struct dir_elem_t));
-			if (!tmp) {
-				cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-				goto out;
-			}
-			tosort = tmp;
-		}
-
-		/* fill the name field */
-		tosort[nbdirs].name = (char *) malloc(str_size(dp->d_name) + 1);
-		if (!tosort[nbdirs].name) {
-			cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-			goto out;
-		}
-
-		str_cpy(tosort[nbdirs].name, str_size(dp->d_name) + 1, dp->d_name);
-		len = snprintf(buff, PATH_MAX - 1, "%s/%s", d, tosort[nbdirs].name);
-		buff[len] = '\0';
-
-		rc = vfs_stat_path(buff, &tosort[nbdirs++].s);
-		if (rc != EOK) {
-			printf("ls: skipping bogus node %s\n", buff);
-			printf("error=%s\n", str_error_name(rc));
-			goto out;
-		}
-	}
-
-	if (ls.sort) {
-		int (*compar)(const void *, const void *);
-		compar = ls.single_column ? ls_cmp_name : ls_cmp_type_name;
-		qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t), compar);
-	}
-
-	for (i = 0; i < nbdirs; i++) {
-		if (ls.printer(&tosort[i]) != EOK) {
-			cli_error(CL_ENOMEM, "%s: Out of memory", cmdname);
-			goto out;
-		}
-	}
-
-	/* Populate the directory list. */
-	if (ls.recursive && nbdirs > 0) {
-		tmp = (struct dir_elem_t *) realloc(*dir_list_ptr,
-		    nbdirs * sizeof(struct dir_elem_t));
-		if (!tmp) {
-			cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-			goto out;
-		}
-		*dir_list_ptr = tmp;
-
-		for (i = 0; i < nbdirs; i++) {
-			(*dir_list_ptr)[i].name = str_dup(tosort[i].name);
-			if (!(*dir_list_ptr)[i].name) {
-				cli_error(CL_ENOMEM, "ls: failed to scan %s", d);
-				goto out;
-			}
-		}
-	}
-
-out:
-	for (i = 0; i < nbdirs; i++)
-		free(tosort[i].name);
-	free(tosort);
-	free(buff);
-
-	return nbdirs;
-}
-
-/** Visit a directory recursively.
- *
- * ls_recursive visits all the subdirectories recursively and
- * prints the files and directories in them.
- *
- * @param path	Path the current directory being visited.
- * @param dirp	Directory stream.
- */
-static unsigned int ls_recursive(const char *path, DIR *dirp)
-{
-	int i, nbdirs, ret;
-	unsigned int scope;
-	char *subdir_path;
-	DIR *subdirp;
-	struct dir_elem_t *dir_list;
-
-	const char *const trailing_slash = "/";
-
-	nbdirs = 0;
-	dir_list = (struct dir_elem_t *) malloc(sizeof(struct dir_elem_t));
-
-	printf("\n%s:\n", path);
-
-	subdir_path = (char *) malloc(PATH_MAX);
-	if (!subdir_path) {
-		ret = CMD_FAILURE;
-		goto out;
-	}
-
-	nbdirs = ls_scan_dir(path, dirp, &dir_list);
-	if (nbdirs == -1) {
-		ret = CMD_FAILURE;
-		goto out;
-	}
-
-	for (i = 0; i < nbdirs; ++i) {
-		memset(subdir_path, 0, PATH_MAX);
-
-		if (str_size(subdir_path) + str_size(path) + 1 <= PATH_MAX)
-			str_append(subdir_path, PATH_MAX, path);
-		if (path[str_size(path) - 1] != '/' &&
-		    str_size(subdir_path) + str_size(trailing_slash) + 1 <= PATH_MAX)
-			str_append(subdir_path, PATH_MAX, trailing_slash);
-		if (str_size(subdir_path) +
-		    str_size(dir_list[i].name) + 1 <= PATH_MAX)
-			str_append(subdir_path, PATH_MAX, dir_list[i].name);
-
-		scope = ls_scope(subdir_path, &dir_list[i]);
-		switch (scope) {
-		case LS_FILE:
-			break;
-		case LS_DIR:
-			subdirp = opendir(subdir_path);
-			if (!subdirp) {
-				/* May have been deleted between scoping it and opening it */
-				cli_error(CL_EFAIL, "Could not stat %s", dir_list[i].name);
-				ret = CMD_FAILURE;
-				goto out;
-			}
-
-			ret = ls_recursive(subdir_path, subdirp);
-			closedir(subdirp);
-			if (ret == CMD_FAILURE)
-				goto out;
-			break;
-		case LS_BOGUS:
-			ret = CMD_FAILURE;
-			goto out;
-		}
-	}
-
-	ret = CMD_SUCCESS;
-
-out:
-	for (i = 0; i < nbdirs; i++)
-		free(dir_list[i].name);
-	free(dir_list);
-	free(subdir_path);
-
-	return ret;
-}
-
-static unsigned int ls_scope(const char *path, struct dir_elem_t *de)
-{
-	if (vfs_stat_path(path, &de->s) != EOK) {
-		cli_error(CL_ENOENT, "%s", path);
-		return LS_BOGUS;
-	}
-
-	if (de->s.is_file)
-		return LS_FILE;
-	else if (de->s.is_directory)
-		return LS_DIR;
-
-	return LS_BOGUS;
-}
-
-void help_cmd_ls(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' lists files and directories.\n", cmdname);
-	} else {
-		help_cmd_ls(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] [path]\n"
-		    "If not path is given, the current working directory is used.\n"
-		    "Options:\n"
-		    "  -h, --help            A short option summary\n"
-		    "  -u, --unsort          Do not sort directory entries\n"
-		    "  -r, --recursive       List subdirectories recursively\n"
-		    "  -e, --exact-size      File sizes will be unformatted (raw bytes count)\n"
-		    "  -1, --single-column   Only the names will be returned\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-int cmd_ls(char **argv)
-{
-	unsigned int argc;
-	struct dir_elem_t de;
-	DIR *dirp;
-	int c, opt_ind;
-	int ret = 0;
-	unsigned int scope;
-
-	if (!ls_start(&ls)) {
-		cli_error(CL_EFAIL, "%s: Could not initialize", cmdname);
-		return CMD_FAILURE;
-	}
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "hure1", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_ls(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'u':
-			ls.sort = 0;
-			break;
-		case 'r':
-			ls.recursive = 1;
-			break;
-		case 'e':
-			ls.exact_size = true;
-			break;
-		case '1':
-			ls.single_column = true;
-			ls.printer = ls_print_single_column;
-			break;
-		}
-	}
-
-	argc -= optind;
-
-	de.name = (char *) malloc(PATH_MAX);
-	if (!de.name) {
-		cli_error(CL_ENOMEM, "%s: Out of memory", cmdname);
-		return CMD_FAILURE;
-	}
-	memset(de.name, 0, PATH_MAX);
-
-	if (argc == 0) {
-		if (vfs_cwd_get(de.name, PATH_MAX) != EOK) {
-			cli_error(CL_EFAIL, "%s: Failed determining working "
-			    "directory", cmdname);
-			return CMD_FAILURE;
-		}
-	} else {
-		str_cpy(de.name, PATH_MAX, argv[optind]);
-	}
-
-	scope = ls_scope(de.name, &de);
-	switch (scope) {
-	case LS_FILE:
-		if (ls.printer(&de) != EOK) {
-			cli_error(CL_ENOMEM, "%s: Out of memory", cmdname);
-			return CMD_FAILURE;
-		}
-		break;
-	case LS_DIR:
-		dirp = opendir(de.name);
-		if (!dirp) {
-			/* May have been deleted between scoping it and opening it */
-			cli_error(CL_EFAIL, "Could not stat %s", de.name);
-			free(de.name);
-			return CMD_FAILURE;
-		}
-		if (ls.recursive)
-			ret = ls_recursive(de.name, dirp);
-		else
-			ret = ls_scan_dir(de.name, dirp, NULL);
-
-		closedir(dirp);
-		break;
-	case LS_BOGUS:
-		return CMD_FAILURE;
-	}
-
-	free(de.name);
-
-	if (ret == -1 || ret == CMD_FAILURE)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/ls/ls.h
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#ifndef LS_H
-#define LS_H
-
-#include <vfs/vfs.h>
-
-/* Various values that can be returned by ls_scope() */
-#define LS_BOGUS 0
-#define LS_FILE  1
-#define LS_DIR   2
-
-/** Structure to represent a directory entry.
- *
- * Useful to keep together important information
- * for sorting directory entries.
- */
-struct dir_elem_t {
-	char *name;
-	vfs_stat_t s;
-};
-
-typedef struct {
-	/* Options set at runtime. */
-	unsigned int recursive;
-	unsigned int sort;
-
-	bool single_column;
-	bool exact_size;
-
-	errno_t (*printer)(struct dir_elem_t *);
-} ls_job_t;
-
-#endif
Index: pace/app/bdsh/cmds/modules/ls/ls_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/ls/ls_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"ls",
-	"List files and directories",
-	&cmd_ls,
-	&help_cmd_ls,
-},
Index: pace/app/bdsh/cmds/modules/mkdir/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef MKDIR_ENTRY_H
-#define MKDIR_ENTRY_H
-
-/* Entry points for the mkdir command */
-extern int cmd_mkdir(char **);
-extern void help_cmd_mkdir(unsigned int);
-
-#endif /* MKDIR_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/mkdir/mkdir.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <dirent.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <str.h>
-#include <errno.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-
-#include "config.h"
-#include "errors.h"
-#include "util.h"
-#include "entry.h"
-#include "mkdir.h"
-#include "cmds.h"
-
-#define MKDIR_VERSION "0.0.1"
-
-static const char *cmdname = "mkdir";
-
-static struct option const long_options[] = {
-	{ "parents", no_argument, 0, 'p' },
-	{ "verbose", no_argument, 0, 'v' },
-	{ "mode", required_argument, 0, 'm' },
-	{ "help", no_argument, 0, 'h' },
-	{ "version", no_argument, 0, 'V' },
-	{ "follow", no_argument, 0, 'f' },
-	{ 0, 0, 0, 0 }
-};
-
-void help_cmd_mkdir(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' creates a new directory\n", cmdname);
-	} else {
-		help_cmd_mkdir(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] <path>\n"
-		    "Options:\n"
-		    "  -h, --help       A short option summary\n"
-		    "  -V, --version    Print version information and exit\n"
-		    "  -p, --parents    Create needed parents for <path>\n"
-		    "  -m, --mode       Set permissions to [mode] (UNUSED)\n"
-		    "  -v, --verbose    Be extremely noisy about what is happening\n"
-		    "  -f, --follow     Go to the new directory once created\n"
-		    "Currently, %s is under development, some options don't work.\n",
-		    cmdname, cmdname);
-	}
-
-	return;
-}
-
-/* This is kind of clunky, but effective for now */
-static unsigned int
-create_directory(const char *user_path, bool create_parents)
-{
-	/* Ensure we would always work with absolute and canonified path. */
-	char *path = vfs_absolutize(user_path, NULL);
-	if (path == NULL) {
-		cli_error(CL_ENOMEM, "%s: path too big?", cmdname);
-		return 1;
-	}
-
-	int ret = 0;
-	errno_t rc;
-
-	if (!create_parents) {
-		rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
-			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-			    cmdname, path, str_error(rc));
-			ret = 1;
-		}
-	} else {
-		/* Create the parent directories as well. */
-		size_t off = 0;
-		while (true) {
-			size_t prev_off = off;
-			char32_t cur_char = str_decode(path, &off, STR_NO_LIMIT);
-			if ((cur_char == 0) || (cur_char == U_SPECIAL)) {
-				break;
-			}
-			if (cur_char != '/') {
-				continue;
-			}
-			if (prev_off == 0) {
-				continue;
-			}
-			/*
-			 * If we are here, it means that:
-			 * - we found /
-			 * - it is not the first / (no need to create root
-			 *   directory)
-			 *
-			 * We would now overwrite the / with 0 to terminate the
-			 * string (that shall be okay because we are
-			 * overwriting at the beginning of UTF sequence).
-			 * That would allow us to create the directories
-			 * in correct nesting order.
-			 *
-			 * Notice that we ignore EEXIST errors as some of
-			 * the parent directories may already exist.
-			 */
-			char slash_char = path[prev_off];
-			path[prev_off] = 0;
-
-			rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-			if (rc != EOK && rc != EEXIST) {
-				cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-				    cmdname, path, str_error(rc));
-				ret = 1;
-				goto leave;
-			}
-
-			path[prev_off] = slash_char;
-		}
-		/* Create the final directory. */
-		rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
-			cli_error(CL_EFAIL, "%s: could not create %s (%s)",
-			    cmdname, path, str_error(rc));
-			ret = 1;
-		}
-	}
-
-leave:
-	free(path);
-	return ret;
-}
-
-int cmd_mkdir(char **argv)
-{
-	unsigned int argc, i, ret = 0;
-	bool create_parents = false, follow = false, verbose = false;
-	int c, opt_ind;
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "pvhVfm:", long_options, &opt_ind);
-		switch (c) {
-		case 'p':
-			create_parents = true;
-			break;
-		case 'v':
-			verbose = true;
-			break;
-		case 'h':
-			help_cmd_mkdir(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'V':
-			printf("%s\n", MKDIR_VERSION);
-			return CMD_SUCCESS;
-		case 'f':
-			follow = true;
-			break;
-		case 'm':
-			printf("%s: [W] Ignoring mode %s\n", cmdname, optarg);
-			break;
-		}
-	}
-
-	argc -= optind;
-
-	if (argc < 1) {
-		printf("%s - incorrect number of arguments. Try `%s --help'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	for (i = optind; argv[i] != NULL; i++) {
-		if (verbose)
-			printf("%s: creating %s%s\n",
-			    cmdname, argv[i],
-			    create_parents ? " (and all parents)" : "");
-		ret += create_directory(argv[i], create_parents);
-	}
-
-	if (follow && (argv[optind] != NULL)) {
-		if (vfs_cwd_set(argv[optind]) != EOK)
-			printf("%s: Error switching to directory.", cmdname);
-	}
-
-	if (ret)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/mkdir/mkdir.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef MKDIR_H
-#define MKDIR_H
-
-/* Prototypes for the mkdir command, excluding entry points */
-
-#endif /* MKDIR_H */
Index: pace/app/bdsh/cmds/modules/mkdir/mkdir_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/mkdir/mkdir_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-{
-	"mkdir",
-	"Create new directories",
-	&cmd_mkdir,
-	&help_cmd_mkdir,
-},
-
-
Index: pace/app/bdsh/cmds/modules/mkfile/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef MKFILE_ENTRY_H
-#define MKFILE_ENTRY_H
-
-/* Entry points for the mkfile command */
-extern int cmd_mkfile(char **);
-extern void help_cmd_mkfile(unsigned int);
-
-#endif /* MKFILE_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/mkfile/mkfile.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str_error.h>
-#include <dirent.h>
-#include <macros.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <str.h>
-#include <ctype.h>
-#include <vfs/vfs.h>
-
-#include "config.h"
-#include "errors.h"
-#include "util.h"
-#include "entry.h"
-#include "mkfile.h"
-#include "cmds.h"
-
-/** Number of bytes to write at a time */
-#define BUFFER_SIZE 16384
-
-static const char *cmdname = "mkfile";
-
-static struct option const long_options[] = {
-	{ "size", required_argument, 0, 's' },
-	{ "sparse", no_argument, 0, 'p' },
-	{ "help", no_argument, 0, 'h' },
-	{ 0, 0, 0, 0 }
-};
-
-void help_cmd_mkfile(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' creates a new zero-filled file\n", cmdname);
-	} else {
-		help_cmd_mkfile(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] <path>\n"
-		    "Options:\n"
-		    "  -h, --help       A short option summary\n"
-		    "  -s, --size sz    Size of the file\n"
-		    "  -p, --sparse     Create a sparse file\n"
-		    "\n"
-		    "Size is a number followed by 'k', 'm' or 'g' for kB, MB, GB.\n"
-		    "E.g. 100k, 2m, 1g.\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-/** Parse size specification.
- *
- * Size specification is in the form <decimal_number><unit> where
- * <unit> is 'k', 'm' or 'g' for kB, MB, GB.
- *
- * @param str	String containing the size specification.
- * @param rsize	Place to store size in bytes
- * @return	EOK on success or an error code
- */
-static errno_t read_size(const char *str, size_t *rsize)
-{
-	size_t number, unit;
-	char *ep;
-
-	number = strtol(str, &ep, 10);
-	if (ep[0] == '\0') {
-		*rsize = number;
-		return EOK;
-	}
-
-	if (ep[1] != '\0')
-		return EINVAL;
-
-	switch (tolower(ep[0])) {
-	case 'k':
-		unit = 1024;
-		break;
-	case 'm':
-		unit = 1024 * 1024;
-		break;
-	case 'g':
-		unit = 1024 * 1024 * 1024;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	*rsize = number * unit;
-	return EOK;
-}
-
-int cmd_mkfile(char **argv)
-{
-	unsigned int argc;
-	int c, opt_ind;
-	int fd;
-	size_t file_size;
-	size_t total_written;
-	size_t to_write;
-	size_t nwritten;
-	errno_t rc;
-	char *file_name;
-	void *buffer;
-	bool create_sparse = false;
-	aoff64_t pos = 0;
-
-	file_size = 0;
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "ps:h", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_mkfile(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'p':
-			create_sparse = true;
-			break;
-		case 's':
-			rc = read_size(optarg, &file_size);
-			if (rc != EOK) {
-				printf("%s: Invalid file size specification.\n",
-				    cmdname);
-				return CMD_FAILURE;
-			}
-			break;
-		}
-	}
-
-	argc -= optind;
-
-	if (argc != 1) {
-		printf("%s: incorrect number of arguments. Try `%s --help'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	file_name = argv[optind];
-
-	rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE, &fd);
-	if (rc != EOK) {
-		printf("%s: failed to create file %s.\n", cmdname, file_name);
-		return CMD_FAILURE;
-	}
-
-	if (create_sparse && file_size > 0) {
-		const char byte = 0x00;
-
-		pos = file_size - 1;
-		rc = vfs_write(fd, &pos, &byte, sizeof(char), &nwritten);
-		if (rc != EOK) {
-			vfs_put(fd);
-			goto error;
-		}
-		return CMD_SUCCESS;
-	}
-
-	buffer = calloc(BUFFER_SIZE, 1);
-	if (buffer == NULL) {
-		printf("%s: Error, out of memory.\n", cmdname);
-		return CMD_FAILURE;
-	}
-
-	total_written = 0;
-	while (total_written < file_size) {
-		to_write = min(file_size - total_written, BUFFER_SIZE);
-		rc = vfs_write(fd, &pos, buffer, to_write, &nwritten);
-		if (rc != EOK) {
-			printf("%s: Error writing file (%s).\n", cmdname, str_error(rc));
-			vfs_put(fd);
-			free(buffer);
-			return CMD_FAILURE;
-		}
-		total_written += nwritten;
-	}
-
-	free(buffer);
-
-	rc = vfs_put(fd);
-	if (rc != EOK)
-		goto error;
-
-	return CMD_SUCCESS;
-error:
-	printf("%s: Error writing file (%s).\n", cmdname, str_error(rc));
-	return CMD_FAILURE;
-}
Index: pace/app/bdsh/cmds/modules/mkfile/mkfile.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef MKFILE_H
-#define MKFILE_H
-
-/* Prototypes for the mkfile command, excluding entry points */
-
-#endif /* MKFILE_H */
Index: pace/app/bdsh/cmds/modules/mkfile/mkfile_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/mkfile/mkfile_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-{
-	"mkfile",
-	"Create new file",
-	&cmd_mkfile,
-	&help_cmd_mkfile,
-},
-
-
Index: pace/app/bdsh/cmds/modules/module_aliases.c
===================================================================
--- uspace/app/bdsh/cmds/modules/module_aliases.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include "module_aliases.h"
-
-/*
- * Modules that declare multiple names for themselves but use the
- * same entry functions are aliases. This array helps to determine if
- * a module is an alias, as such it can be invoked differently.
- * format is alias , real_name
- */
-
-/*
- * So far, this is only used in the help display but could be used to
- * handle a module differently even prior to reaching its entry code.
- * For instance, 'exit' could behave differently than 'quit', prior to
- * the entry point being reached.
- */
-
-const char *mod_aliases[] = {
-	"ren", "mv",
-	"umount", "unmount",
-	NULL, NULL
-};
Index: pace/app/bdsh/cmds/modules/module_aliases.h
===================================================================
--- uspace/app/bdsh/cmds/modules/module_aliases.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MODULE_ALIASES_H
-#define MODULE_ALIASES_H
-
-extern const char *mod_aliases[];
-
-#endif
Index: pace/app/bdsh/cmds/modules/modules.c
===================================================================
--- uspace/app/bdsh/cmds/modules/modules.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Each built in function has two files, one being an entry.h file which
- * prototypes the run/help entry functions, the other being a .def file
- * which fills the modules[] array according to the cmd_t structure
- * defined in cmds.h.
- *
- * To add or remove a module, just make a new directory in cmds/modules
- * for it and copy the 'show' example for basics, then include it here.
- * (or reverse the process to remove one)
- *
- * NOTE: See module_ aliases.h as well, this is where aliases (commands that
- * share an entry point with others) are indexed
- */
-
-#include "config.h"
-#include "modules.h"
-
-/* Prototypes for each module's entry (help/exec) points */
-
-#include "help/entry.h"
-#include "mkdir/entry.h"
-#include "mkfile/entry.h"
-#include "rm/entry.h"
-#include "cat/entry.h"
-#include "touch/entry.h"
-#include "ls/entry.h"
-#include "pwd/entry.h"
-#include "sleep/entry.h"
-#include "cp/entry.h"
-#include "mv/entry.h"
-#include "mount/entry.h"
-#include "unmount/entry.h"
-#include "kcon/entry.h"
-#include "printf/entry.h"
-#include "echo/entry.h"
-#include "cmp/entry.h"
-#include "alias/entry.h"
-#include "unalias/entry.h"
-
-/*
- * Each .def function fills the module_t struct with the individual name, entry
- * point, help entry point, etc. You can use config.h to control what modules
- * are loaded based on what libraries exist on the system.
- */
-
-module_t modules[] = {
-#include "help/help_def.inc"
-#include "mkdir/mkdir_def.inc"
-#include "mkfile/mkfile_def.inc"
-#include "rm/rm_def.inc"
-#include "cat/cat_def.inc"
-#include "touch/touch_def.inc"
-#include "ls/ls_def.inc"
-#include "pwd/pwd_def.inc"
-#include "sleep/sleep_def.inc"
-#include "cp/cp_def.inc"
-#include "mv/mv_def.inc"
-#include "mount/mount_def.inc"
-#include "unmount/unmount_def.inc"
-#include "kcon/kcon_def.inc"
-#include "printf/printf_def.inc"
-#include "echo/echo_def.inc"
-#include "cmp/cmp_def.inc"
-#include "alias/alias_def.inc"
-#include "unalias/unalias_def.inc"
-
-	{ NULL, NULL, NULL, NULL }
-};
Index: pace/app/bdsh/cmds/modules/modules.h
===================================================================
--- uspace/app/bdsh/cmds/modules/modules.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MODULES_H
-#define MODULES_H
-
-#include "../cmds.h"
-
-extern module_t modules[];
-
-#endif
Index: pace/app/bdsh/cmds/modules/mount/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mount/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef MOUNT_ENTRY_H
-#define MOUNT_ENTRY_H
-
-/* Entry points for the mount command */
-extern int cmd_mount(char **);
-extern void help_cmd_mount(unsigned int);
-
-#endif /* MOUNT_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/mount/mount.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mount/mount.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-#include <vfs/vfs_mtab.h>
-#include <adt/list.h>
-#include <errno.h>
-#include <getopt.h>
-#include <inttypes.h>
-#include <str.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "mount.h"
-#include "cmds.h"
-
-static const char *cmdname = "mount";
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "instance", required_argument, 0, 'i' },
-	{ "types", no_argument, 0, 't' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Displays help for mount in various levels */
-void help_cmd_mount(unsigned int level)
-{
-	static char helpfmt[] =
-	    "Usage:  %s <fstype> <mp> [dev] [<moptions>]\n"
-	    "Options:\n"
-	    "  -h, --help       A short option summary\n"
-	    "  -i, --instance ## Mount a specific instance\n"
-	    "  -t, --types      List available file system types\n";
-
-	if (level == HELP_SHORT) {
-		printf("'%s' mounts a file system.\n", cmdname);
-	} else {
-		help_cmd_mount(HELP_SHORT);
-		printf(helpfmt, cmdname);
-	}
-	return;
-}
-
-static void print_mtab_list(void)
-{
-	LIST_INITIALIZE(mtab_list);
-	mtab_ent_t *old_ent = NULL;
-	char *svc_name;
-	errno_t rc;
-
-	vfs_get_mtab_list(&mtab_list);
-
-	list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {
-		if (old_ent)
-			free(old_ent);
-
-		old_ent = mtab_ent;
-
-		printf("%s", mtab_ent->fs_name);
-
-		printf(" %s", mtab_ent->mp);
-
-		rc = loc_service_get_name(mtab_ent->service_id, &svc_name);
-		if (rc == EOK) {
-			printf(" %s", svc_name);
-			free(svc_name);
-		} else {
-			printf(" (%" PRIun ")", mtab_ent->service_id);
-		}
-
-		putchar('\n');
-	}
-
-	if (old_ent)
-		free(old_ent);
-}
-
-static void print_fstypes(void)
-{
-	errno_t rc;
-	vfs_fstypes_t fstypes;
-	char **p;
-
-	rc = vfs_fstypes(&fstypes);
-	if (rc != EOK) {
-		printf("Error getting list of available file system types.\n");
-		return;
-	}
-
-	printf("Available file system types:\n");
-	p = fstypes.fstypes;
-	while (*p != NULL)
-		printf("\t%s\n", *p++);
-	vfs_fstypes_free(&fstypes);
-}
-
-/* Main entry point for mount, accepts an array of arguments */
-int cmd_mount(char **argv)
-{
-	unsigned int argc;
-	const char *mopts = "";
-	const char *dev = "";
-	errno_t rc;
-	int c, opt_ind;
-	unsigned int instance = 0;
-	bool instance_set = false;
-	char **t_argv;
-
-	argc = cli_count_args(argv);
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "i:ht", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_mount(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'i':
-			instance = (unsigned int) strtol(optarg, NULL, 10);
-			instance_set = true;
-			break;
-		case 't':
-			print_fstypes();
-			return CMD_SUCCESS;
-		}
-	}
-
-	if (instance_set) {
-		argc -= 2;
-		t_argv = &argv[2];
-	} else
-		t_argv = &argv[0];
-
-	if ((argc == 2) || (argc > 5)) {
-		printf("%s: invalid number of arguments. Try `mount --help'\n",
-		    cmdname);
-		return CMD_FAILURE;
-	}
-	if (argc == 1) {
-		print_mtab_list();
-		return CMD_SUCCESS;
-	}
-	if (argc > 3)
-		dev = t_argv[3];
-	if (argc == 5)
-		mopts = t_argv[4];
-
-	rc = vfs_mount_path(t_argv[2], t_argv[1], dev, mopts, 0, instance);
-	if (rc != EOK) {
-		printf("Unable to mount %s filesystem to %s on %s (rc=%s)\n",
-		    t_argv[2], t_argv[1], t_argv[3], str_error(rc));
-		if (rc == ENOFS)
-			print_fstypes();
-		return CMD_FAILURE;
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/mount/mount.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mount/mount.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef MOUNT_H
-#define MOUNT_H
-
-/* Prototypes for the mount command, excluding entry points */
-
-#endif /* MOUNT_H */
Index: pace/app/bdsh/cmds/modules/mount/mount_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/mount/mount_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"mount",
-	"The mount command",
-	&cmd_mount,
-	&help_cmd_mount,
-},
-
Index: pace/app/bdsh/cmds/modules/mv/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mv/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef MV_ENTRY_H
-#define MV_ENTRY_H
-
-/* Entry points for the mv command */
-extern int cmd_mv(char **);
-extern void help_cmd_mv(unsigned int);
-
-#endif /* MV_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/mv/mv.c
===================================================================
--- uspace/app/bdsh/cmds/modules/mv/mv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "mv.h"
-#include "cmds.h"
-
-static const char *cmdname = "mv";
-
-/* Dispays help for mv in various levels */
-void help_cmd_mv(unsigned int level)
-{
-	printf("'%s' renames files\n", cmdname);
-	return;
-}
-
-/* Main entry point for mv, accepts an array of arguments */
-int cmd_mv(char **argv)
-{
-	unsigned int argc;
-	errno_t rc;
-
-	argc = cli_count_args(argv);
-	if (argc != 3) {
-		printf("%s: invalid number of arguments.\n",
-		    cmdname);
-		return CMD_FAILURE;
-	}
-
-	rc = vfs_rename_path(argv[1], argv[2]);
-	if (rc != EOK) {
-		printf("Unable to rename %s to %s: %s)\n",
-		    argv[1], argv[2], str_error(rc));
-		return CMD_FAILURE;
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/mv/mv.h
===================================================================
--- uspace/app/bdsh/cmds/modules/mv/mv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef MV_H
-#define MV_H
-
-/* Prototypes for the mv command, excluding entry points */
-
-#endif /* MV_H */
Index: pace/app/bdsh/cmds/modules/mv/mv_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/mv/mv_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-{
-	"mv",
-	"The mv command",
-	&cmd_mv,
-	&help_cmd_mv,
-},
-
-{
-	"ren",
-	NULL,
-	&cmd_mv,
-	&help_cmd_mv,
-},
-
Index: pace/app/bdsh/cmds/modules/printf/TODO
===================================================================
--- uspace/app/bdsh/cmds/modules/printf/TODO	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,12 +1,0 @@
-At this stage printf is very young and limited, as it hopefully
-will be developed along with BDSH. Functionality is heavily related
-on libc printf already available. BDSH printf implements only 3 format
-flags, with no options/precision/width modifiers allowed. Also,
-one output control is available - '\n'. '\' character stands
-as an escape character, i.e. every special character after it
-will be treated as general char and will be printed out.
-What's missing:
- * Error checking for format string.
- * Add more output controls (\t \r ...)
- * Add width/precision options for number printings
- * Add more format flags (%f %b ...)
Index: pace/app/bdsh/cmds/modules/printf/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/printf/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef PRINTF_ENTRY_H
-#define PRINTF_ENTRY_H
-
-/* Entry points for the printf command */
-extern int cmd_printf(char **);
-extern void help_cmd_printf(unsigned int);
-
-#endif /* PRINTF_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/printf/printf.c
===================================================================
--- uspace/app/bdsh/cmds/modules/printf/printf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2012 Alexander Prutkov
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "printf.h"
-#include "cmds.h"
-#include "str.h"
-
-static const char *cmdname = "printf";
-
-/* Dispays help for printf in various levels */
-void help_cmd_printf(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' prints formatted data.\n", cmdname);
-	} else {
-		help_cmd_printf(HELP_SHORT);
-		printf(
-		    "Usage:  %s FORMAT [ARGS ...] \n"
-		    "Prints ARGS according to FORMAT. Number of expected arguments in\n"
-		    "FORMAT must be equals to the number of ARGS. Currently supported\n"
-		    "format flags are:\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-/** Print a formatted data with lib printf.
- *
- * Currently available format flags are:
- * '%d' - integer.
- * '%u' - unsigned integer.
- * '%s' - null-terminated string.
- *
- * @param ch  formatted flag.
- * @param arg string with data to print.
- */
-static int print_arg(char32_t ch, const char *arg)
-{
-	switch (ch) {
-	case 'd':
-		printf("%d", (int)(strtol(arg, NULL, 10)));
-		break;
-	case 'u':
-		printf("%u", (unsigned int)(strtoul(arg, NULL, 10)));
-		break;
-	case 's':
-		printf("%s", arg);
-		break;
-	default:
-		return CMD_FAILURE;
-	}
-	return CMD_SUCCESS;
-}
-
-/** Process a control character.
- *
- * Currently available characters are:
- * '\n' - new line.
- *
- * @param ch  Control character.
- */
-static int process_ctl(char32_t ch)
-{
-	switch (ch) {
-	case 'n':
-		printf("\n");
-		break;
-	default:
-		return CMD_FAILURE;
-	}
-	return CMD_SUCCESS;
-}
-
-/** Prints formatted data.
- *
- * Accepted format flags:
- * %d - print an integer
- * %u - print an unsigned integer
- * %s - print a null terminated string
- *
- * Accepted output controls:
- * \n - new line
- */
-int cmd_printf(char **argv)
-{
-	unsigned int argc;
-	char *fmt;
-	size_t pos, fmt_sz;
-	char32_t ch;
-	bool esc_flag = false;
-	unsigned int carg;     // Current argument
-
-	/* Count the arguments */
-	argc = 0;
-	while (argv[argc] != NULL)
-		argc++;
-
-	if (argc < 2) {
-		printf("Usage:  %s FORMAT [ARGS ...] \n", cmdname);
-		return CMD_SUCCESS;
-	}
-
-	fmt = argv[1];
-	fmt_sz = str_size(fmt);
-	pos = 0;
-	carg = 2;
-
-	while ((ch = str_decode(fmt, &pos, fmt_sz))) {
-		switch (ch) {
-
-		case '\\':
-			if (esc_flag)
-				goto emit;
-			esc_flag = true;
-			break;
-
-		case '%':
-			if (esc_flag)
-				goto emit;
-			ch = str_decode(fmt, &pos, fmt_sz);
-			if (!ch) {
-				putchar('%');
-				break;
-			}
-			if (carg == argc) {
-				printf("\nBad parameter number. Aborted.\n");
-				return CMD_FAILURE;
-			}
-			print_arg(ch, argv[carg]);
-			++carg;
-			break;
-
-		default:
-			if (esc_flag) {
-				process_ctl(ch);
-				esc_flag = false;
-				break;
-			}
-			putuchar(ch);
-			break;
-
-		emit:
-			putuchar(ch);
-			esc_flag = false;
-		}
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/printf/printf.h
===================================================================
--- uspace/app/bdsh/cmds/modules/printf/printf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef PRINTF_H
-#define PRINTF_H
-
-/* Prototypes for the printf command, excluding entry points */
-
-#endif /* PRINTF_H */
Index: pace/app/bdsh/cmds/modules/printf/printf_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/printf/printf_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"printf",
-	"Format and print data",
-	&cmd_printf,
-	&help_cmd_printf,
-},
-
Index: pace/app/bdsh/cmds/modules/pwd/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/pwd/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-#ifndef PWD_ENTRY_H
-#define PWD_ENTRY_H
-
-#include "scli.h"
-
-/* Entry points for the pwd command */
-extern void help_cmd_pwd(unsigned int);
-extern int cmd_pwd(char **);
-
-#endif
Index: pace/app/bdsh/cmds/modules/pwd/pwd.c
===================================================================
--- uspace/app/bdsh/cmds/modules/pwd/pwd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <vfs/vfs.h>
-#include <abi/errno.h>
-
-#include "config.h"
-#include "errors.h"
-#include "entry.h"
-#include "cmds.h"
-#include "pwd.h"
-
-static const char *cmdname = "pwd";
-
-void help_cmd_pwd(unsigned int level)
-{
-	printf("`%s' prints your current working directory.\n", cmdname);
-	return;
-}
-
-int cmd_pwd(char *argv[])
-{
-	char *buff;
-
-	buff = (char *) malloc(PATH_MAX);
-	if (NULL == buff) {
-		cli_error(CL_ENOMEM, "%s:", cmdname);
-		return CMD_FAILURE;
-	}
-
-	memset(buff, 0, PATH_MAX);
-
-	if (vfs_cwd_get(buff, PATH_MAX) != EOK) {
-		cli_error(CL_EFAIL,
-		    "Unable to determine the current working directory");
-		free(buff);
-		return CMD_FAILURE;
-	} else {
-		printf("%s\n", buff);
-		free(buff);
-		return CMD_SUCCESS;
-	}
-}
Index: pace/app/bdsh/cmds/modules/pwd/pwd.h
===================================================================
--- uspace/app/bdsh/cmds/modules/pwd/pwd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef PWD_H_
-#define PWD_H_
-
-/* Prototypes for the pwd command (excluding entry points) */
-
-#endif
Index: pace/app/bdsh/cmds/modules/pwd/pwd_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/pwd/pwd_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"pwd",
-	"Prints the current working directory",
-	&cmd_pwd,
-	&help_cmd_pwd,
-},
Index: pace/app/bdsh/cmds/modules/rm/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef RM_ENTRY_H
-#define RM_ENTRY_H
-
-/* Entry points for the rm command */
-extern int cmd_rm(char **);
-extern void help_cmd_rm(unsigned int);
-
-#endif /* RM_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/rm/rm.c
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,341 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <getopt.h>
-#include <mem.h>
-#include <str.h>
-#include <vfs/vfs.h>
-
-#include "config.h"
-#include "errors.h"
-#include "util.h"
-#include "entry.h"
-#include "rm.h"
-#include "cmds.h"
-
-static const char *cmdname = "rm";
-#define RM_VERSION "0.0.1"
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "version", no_argument, 0, 'v' },
-	{ "recursive", no_argument, 0, 'r' },
-	{ "force", no_argument, 0, 'f' },
-	{ "safe", no_argument, 0, 's' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Return values for rm_scope() */
-#define RM_BOGUS 0
-#define RM_FILE  1
-#define RM_DIR   2
-
-/* Flags for rm_update() */
-#define _RM_ENTRY   0
-#define _RM_ADVANCE 1
-#define _RM_REWIND  2
-#define _RM_EXIT    3
-
-/* A simple job structure */
-typedef struct {
-	/* Options set at run time */
-	unsigned int force;      /* -f option */
-	unsigned int recursive;  /* -r option */
-	unsigned int safe;       /* -s option */
-
-	/* Keeps track of the job in progress */
-	int advance; /* How far deep we've gone since entering */
-	DIR *entry;  /* Entry point to the tree being removed */
-	char *owd;   /* Where we were when we invoked rm */
-	char *cwd;   /* Current directory being transversed */
-	char *nwd;   /* Next directory to be transversed */
-
-	/* Counters */
-	int f_removed; /* Number of files unlinked */
-	int d_removed; /* Number of directories unlinked */
-} rm_job_t;
-
-static rm_job_t rm;
-
-static unsigned int rm_recursive(const char *);
-
-static unsigned int rm_start(rm_job_t *rm)
-{
-	rm->recursive = 0;
-	rm->force = 0;
-	rm->safe = 0;
-
-	/*
-	 * Make sure we can allocate enough memory to store
-	 * what is needed in the job structure
-	 */
-	if (NULL == (rm->nwd = (char *) malloc(PATH_MAX)))
-		return 0;
-	memset(rm->nwd, 0, PATH_MAX);
-
-	if (NULL == (rm->owd = (char *) malloc(PATH_MAX)))
-		return 0;
-	memset(rm->owd, 0, PATH_MAX);
-
-	if (NULL == (rm->cwd = (char *) malloc(PATH_MAX)))
-		return 0;
-	memset(rm->cwd, 0, PATH_MAX);
-
-	vfs_cwd_set(".");
-
-	if (EOK != vfs_cwd_get(rm->owd, PATH_MAX))
-		return 0;
-
-	return 1;
-}
-
-static void rm_end(rm_job_t *rm)
-{
-	if (NULL != rm->nwd)
-		free(rm->nwd);
-
-	if (NULL != rm->owd)
-		free(rm->owd);
-
-	if (NULL != rm->cwd)
-		free(rm->cwd);
-}
-
-static unsigned int rm_single(const char *path)
-{
-	if (vfs_unlink_path(path) != EOK) {
-		cli_error(CL_EFAIL, "rm: could not remove file %s", path);
-		return 1;
-	}
-	return 0;
-}
-
-static unsigned int rm_scope(const char *path)
-{
-	int fd;
-	DIR *dirp;
-
-	dirp = opendir(path);
-	if (dirp) {
-		closedir(dirp);
-		return RM_DIR;
-	}
-
-	if (vfs_lookup(path, WALK_REGULAR, &fd) == EOK) {
-		vfs_put(fd);
-		return RM_FILE;
-	}
-
-	return RM_BOGUS;
-}
-
-static unsigned int rm_recursive_not_empty_dirs(const char *path)
-{
-	DIR *dirp;
-	struct dirent *dp;
-	char buff[PATH_MAX];
-	unsigned int scope;
-	unsigned int ret = 0;
-
-	dirp = opendir(path);
-	if (!dirp) {
-		/* May have been deleted between scoping it and opening it */
-		cli_error(CL_EFAIL, "Could not open %s", path);
-		return ret;
-	}
-
-	memset(buff, 0, sizeof(buff));
-	while ((dp = readdir(dirp))) {
-		int len = snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
-		if (len > PATH_MAX - 1) {
-			// TODO: Do not enforce arbitrary static limits.
-			cli_error(CL_EFAIL, "Path too long for %s/%s", path, dp->d_name);
-			continue;
-		}
-		scope = rm_scope(buff);
-		switch (scope) {
-		case RM_BOGUS:
-			break;
-		case RM_FILE:
-			ret += rm_single(buff);
-			break;
-		case RM_DIR:
-			ret += rm_recursive(buff);
-			break;
-		}
-	}
-
-	closedir(dirp);
-
-	return ret;
-}
-
-static unsigned int rm_recursive(const char *path)
-{
-	errno_t rc;
-	unsigned int ret = 0;
-
-	/* First see if it will just go away */
-	rc = vfs_unlink_path(path);
-	if (rc == EOK)
-		return 0;
-
-	/* Its not empty, recursively scan it */
-	ret = rm_recursive_not_empty_dirs(path);
-
-	/* Delete directory */
-	rc = vfs_unlink_path(path);
-	if (rc == EOK)
-		return 0;
-
-	cli_error(CL_ENOTSUP, "Can not remove %s", path);
-
-	return ret + 1;
-}
-
-/* Dispays help for rm in various levels */
-void help_cmd_rm(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' removes files and directories.\n", cmdname);
-	} else {
-		help_cmd_rm(HELP_SHORT);
-		printf(
-		    "Usage:  %s [options] <path>\n"
-		    "Options:\n"
-		    "  -h, --help       A short option summary\n"
-		    "  -v, --version    Print version information and exit\n"
-		    "  -r, --recursive  Recursively remove sub directories\n"
-		    "  -f, --force      Do not prompt prior to removing files\n"
-		    "  -s, --safe       Stop if directories change during removal\n\n"
-		    "Currently, %s is under development, some options don't work.\n",
-		    cmdname, cmdname);
-	}
-	return;
-}
-
-/* Main entry point for rm, accepts an array of arguments */
-int cmd_rm(char **argv)
-{
-	unsigned int argc;
-	unsigned int i, scope, ret = 0;
-	int c, opt_ind;
-	size_t len;
-	char *buff = NULL;
-
-	argc = cli_count_args(argv);
-
-	if (argc < 2) {
-		cli_error(CL_EFAIL,
-		    "%s: insufficient arguments. Try %s --help", cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	if (!rm_start(&rm)) {
-		cli_error(CL_ENOMEM, "%s: could not initialize", cmdname);
-		rm_end(&rm);
-		return CMD_FAILURE;
-	}
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	opt_ind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "hvrfs", long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_rm(HELP_LONG);
-			return CMD_SUCCESS;
-		case 'v':
-			printf("%s\n", RM_VERSION);
-			return CMD_SUCCESS;
-		case 'r':
-			rm.recursive = 1;
-			break;
-		case 'f':
-			rm.force = 1;
-			break;
-		case 's':
-			rm.safe = 1;
-			break;
-		}
-	}
-
-	if ((unsigned) optind == argc) {
-		cli_error(CL_EFAIL,
-		    "%s: insufficient arguments. Try %s --help", cmdname, cmdname);
-		rm_end(&rm);
-		return CMD_FAILURE;
-	}
-
-	i = optind;
-	while (NULL != argv[i]) {
-		len = str_size(argv[i]) + 2;
-		buff = (char *) realloc(buff, len);
-		if (buff == NULL) {
-			printf("rm: out of memory\n");
-			ret = 1;
-			break;
-		}
-		memset(buff, 0, len);
-		snprintf(buff, len, "%s", argv[i]);
-
-		scope = rm_scope(buff);
-		switch (scope) {
-		case RM_BOGUS: /* FIXME */
-		case RM_FILE:
-			ret += rm_single(buff);
-			break;
-		case RM_DIR:
-			if (!rm.recursive) {
-				printf("%s is a directory, use -r to remove it.\n", buff);
-				ret++;
-			} else {
-				ret += rm_recursive(buff);
-			}
-			break;
-		}
-		i++;
-	}
-
-	if (NULL != buff)
-		free(buff);
-
-	rm_end(&rm);
-
-	if (ret)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/rm/rm.h
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef RM_H
-#define RM_H
-
-/* Prototypes for the rm command, excluding entry points */
-
-#endif /* RM_H */
Index: pace/app/bdsh/cmds/modules/rm/rm_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/rm/rm_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"rm",
-	"Remove files and directories",
-	&cmd_rm,
-	&help_cmd_rm,
-},
-
Index: pace/app/bdsh/cmds/modules/sleep/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef SLEEP_ENTRY_H
-#define SLEEP_ENTRY_H
-
-/* Entry points for the sleep command */
-extern int cmd_sleep(char **);
-extern void help_cmd_sleep(unsigned int);
-
-#endif /* SLEEP_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/sleep/sleep.c
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/sleep.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <fibril.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "sleep.h"
-#include "cmds.h"
-
-static const char *cmdname = "sleep";
-
-/* Dispays help for sleep in various levels */
-void help_cmd_sleep(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' pauses for a given time interval\n", cmdname);
-	} else {
-		help_cmd_sleep(HELP_SHORT);
-		printf(
-		    "Usage:  %s <duration>\n"
-		    "The duration is a decimal number of seconds.\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-/** Convert string containing decimal seconds to usec_t.
- *
- * @param nptr   Pointer to string.
- * @param result Result of the conversion.
- * @return EOK if conversion was successful.
- */
-static errno_t decimal_to_useconds(const char *nptr, usec_t *result)
-{
-	errno_t ret;
-	int64_t whole_seconds;
-	int64_t frac_seconds;
-	const char *endptr;
-
-	/* Check for whole seconds */
-	if (*nptr == '.') {
-		whole_seconds = 0;
-		endptr = (char *)nptr;
-	} else {
-		ret = str_int64_t(nptr, &endptr, 10, false, &whole_seconds);
-		if (ret != EOK)
-			return ret;
-	}
-
-	/* Check for fractional seconds */
-	if (*endptr == '\0') {
-		frac_seconds = 0;
-	} else if (*endptr == '.' && endptr[1] == '\0') {
-		frac_seconds = 0;
-	} else if (*endptr == '.') {
-		nptr = endptr + 1;
-		ret = str_int64_t(nptr, &endptr, 10, true, &frac_seconds);
-		if (ret != EOK)
-			return ret;
-
-		int ndigits = endptr - nptr;
-		for (; ndigits < 6; ndigits++)
-			frac_seconds *= 10;
-		for (; ndigits > 6; ndigits--)
-			frac_seconds /= 10;
-	} else {
-		return EINVAL;
-	}
-
-	/* Check for overflow */
-	usec_t total = SEC2USEC(whole_seconds) + frac_seconds;
-	if (USEC2SEC(total) != whole_seconds)
-		return EOVERFLOW;
-
-	*result = total;
-
-	return EOK;
-}
-
-/* Main entry point for sleep, accepts an array of arguments */
-int cmd_sleep(char **argv)
-{
-	errno_t ret;
-	unsigned int argc;
-	usec_t duration = 0;
-
-	/* Count the arguments */
-	argc = cli_count_args(argv);
-
-	if (argc != 2) {
-		printf("%s - incorrect number of arguments. Try `help %s'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	ret = decimal_to_useconds(argv[1], &duration);
-	if (ret != EOK) {
-		printf("%s - invalid duration.\n", cmdname);
-		return CMD_FAILURE;
-	}
-
-	fibril_usleep(duration);
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/sleep/sleep.h
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/sleep.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef SLEEP_H
-#define SLEEP_H
-
-/* Prototypes for the sleep command, excluding entry points */
-
-#endif /* SLEEP_H */
Index: pace/app/bdsh/cmds/modules/sleep/sleep_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/sleep/sleep_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"sleep",
-	"Pause for given time interval (in seconds)",
-	&cmd_sleep,
-	&help_cmd_sleep,
-},
-
Index: pace/app/bdsh/cmds/modules/touch/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef TOUCH_ENTRY_H
-#define TOUCH_ENTRY_H
-
-/* Entry points for the touch command */
-extern int cmd_touch(char **);
-extern void help_cmd_touch(unsigned int);
-
-#endif /* TOUCH_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/touch/touch.c
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/touch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * TODO: Options that people would expect, such as specifying the access time,
- * etc.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <dirent.h>
-#include <str.h>
-#include <getopt.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-
-#include "config.h"
-#include "errors.h"
-#include "util.h"
-#include "entry.h"
-#include "touch.h"
-#include "cmds.h"
-
-static const char *cmdname = "touch";
-
-static struct option const long_options[] = {
-	{ "no-create", no_argument, 0, 'c' },
-	{ 0, 0, 0, 0 }
-};
-
-/* Dispays help for touch in various levels */
-void help_cmd_touch(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' updates access times of files\n", cmdname);
-	} else {
-		help_cmd_touch(HELP_SHORT);
-		printf("Usage: `%s' [-c|--no-create] <file>...\n\n"
-		    "If the file does not exist it will be created empty,\n"
-		    "unless -c (--no-create) is supplied.\n\n"
-		    "Options:\n"
-		    "   -c, --no-create  Do not create new files\n",
-		    cmdname);
-	}
-
-	return;
-}
-
-/* Main entry point for touch, accepts an array of arguments */
-int cmd_touch(char **argv)
-{
-	unsigned int argc = cli_count_args(argv);
-	unsigned int i = 0;
-	unsigned int ret = 0;
-	int c;
-	int longind;
-	bool no_create = false;
-	vfs_stat_t file_stat;
-	int fd = -1;
-	char *buff = NULL;
-
-	DIR *dirp;
-
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	longind = 0;
-
-	while (c != -1) {
-		c = getopt_long(argc, argv, "c", long_options, &longind);
-		switch (c) {
-		case 'c':
-			no_create = true;
-			break;
-		}
-	}
-
-	if (argc - optind < 1) {
-		printf("%s: Incorrect number of arguments. Try `help %s extended'\n",
-		    cmdname, cmdname);
-		return CMD_FAILURE;
-	}
-
-	for (i = optind; argv[i] != NULL; i++) {
-		buff = str_dup(argv[i]);
-		if (buff == NULL) {
-			cli_error(CL_ENOMEM, "Out of memory");
-			ret++;
-			continue;
-		}
-
-		dirp = opendir(buff);
-		if (dirp) {
-			cli_error(CL_ENOTSUP, "`%s' is a directory", buff);
-			closedir(dirp);
-			free(buff);
-			ret++;
-			continue;
-		}
-
-		/* Check whether file exists if -c (--no-create) option is given */
-		if ((!no_create) ||
-		    ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) {
-			errno_t rc = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE, &fd);
-			if (rc != EOK) {
-				fd = -1;
-			}
-		}
-
-		if (fd < 0) {
-			cli_error(CL_EFAIL, "Could not update or create `%s'", buff);
-			free(buff);
-			ret++;
-			continue;
-		} else {
-			vfs_put(fd);
-			fd = -1;
-		}
-
-		free(buff);
-	}
-
-	if (ret)
-		return CMD_FAILURE;
-	else
-		return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/touch/touch.h
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/touch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef TOUCH_H
-#define TOUCH_H
-
-/* Prototypes for the touch command, excluding entry points */
-
-#endif /* TOUCH_H */
Index: pace/app/bdsh/cmds/modules/touch/touch_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/touch/touch_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"touch",
-	"Create files or update access times",
-	&cmd_touch,
-	&help_cmd_touch,
-},
Index: pace/app/bdsh/cmds/modules/unalias/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/unalias/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef UNALIAS_ENTRY_H
-#define UNALIAS_ENTRY_H
-
-/* Entry points for the unalias command */
-extern int cmd_unalias(char **);
-extern void help_cmd_unalias(unsigned int);
-
-#endif /* UNALIAS_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/unalias/unalias.c
===================================================================
--- uspace/app/bdsh/cmds/modules/unalias/unalias.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2018 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <adt/odict.h>
-
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "unalias.h"
-#include "cmds.h"
-
-static const char *cmdname = "unalias";
-
-static void free_alias(odlink_t *alias_link)
-{
-	alias_t *data = odict_get_instance(alias_link, alias_t, odict);
-	odict_remove(alias_link);
-
-	free(data->name);
-	free(data->value);
-	free(data);
-}
-
-/* Dispays help for unalias in various levels */
-void help_cmd_unalias(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("`%s' removes an alias or all aliases with -a\n", cmdname);
-	} else {
-		help_cmd_unalias(HELP_SHORT);
-		printf("Usage: `%s' -a'\n"
-		    "`%s' name [name ...]'\n\n"
-		    "If no parameters are given it will display this help message.\n"
-		    "If the flag -a is given, all existing aliases will be removed.\n"
-		    "If one or multiple parameters are given, then those aliases will be removed.\n",
-		    cmdname, cmdname);
-	}
-}
-
-/* Main entry point for unalias, accepts an array of arguments */
-int cmd_unalias(char **argv)
-{
-
-	if (argv[1] == NULL) {
-		help_cmd_unalias(HELP_LONG);
-		return CMD_SUCCESS;
-	}
-
-	odlink_t *alias_link;
-
-	unsigned int argc = cli_count_args(argv);
-	if (argc == 2) {
-		if (str_cmp(argv[1], "-a") == 0) {
-			alias_link = odict_first(&alias_dict);
-			while (alias_link != NULL) {
-				odlink_t *old_alias_link = alias_link;
-				alias_link = odict_next(old_alias_link, &alias_dict);
-				free_alias(old_alias_link);
-			}
-
-			return CMD_SUCCESS;
-		}
-	}
-
-	int rc = CMD_SUCCESS;
-	size_t i;
-	for (i = 1; argv[i] != NULL; i++) {
-		alias_link = odict_find_eq(&alias_dict, (void *)argv[i], NULL);
-
-		if (alias_link == NULL) {
-			cli_error(CL_ENOENT, "%s: No alias '%s' found\n", cmdname, argv[i]);
-			rc = CMD_FAILURE;
-		} else {
-			free_alias(alias_link);
-		}
-	}
-
-	return rc;
-}
Index: pace/app/bdsh/cmds/modules/unalias/unalias.h
===================================================================
--- uspace/app/bdsh/cmds/modules/unalias/unalias.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef UNALIAS_H
-#define UNALIAS_H
-
-/* Prototypes for the unalias command, excluding entry points */
-
-#endif /* UNALIAS_H */
Index: pace/app/bdsh/cmds/modules/unalias/unalias_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/unalias/unalias_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-{
-	"unalias",
-	"Removes an alias",
-	&cmd_unalias,
-	&help_cmd_unalias,
-},
-
Index: pace/app/bdsh/cmds/modules/unmount/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-#ifndef UNMOUNT_ENTRY_H
-#define UNMOUNT_ENTRY_H
-
-/* Entry points for the unmount command */
-extern int cmd_unmount(char **);
-extern void help_cmd_unmount(unsigned int);
-
-#endif /* UNMOUNT_ENTRY_H */
Index: pace/app/bdsh/cmds/modules/unmount/unmount.c
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/unmount.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-#include <errno.h>
-#include <str_error.h>
-#include "config.h"
-#include "util.h"
-#include "errors.h"
-#include "entry.h"
-#include "unmount.h"
-#include "cmds.h"
-
-static const char *cmdname = "unmount";
-
-/* Dispays help for unmount in various levels */
-void help_cmd_unmount(unsigned int level)
-{
-	if (level == HELP_SHORT) {
-		printf("'%s' unmount a file system.\n", cmdname);
-	} else {
-		help_cmd_unmount(HELP_SHORT);
-		printf("Usage: %s <mp>\n", cmdname);
-	}
-	return;
-}
-
-/* Main entry point for unmount, accepts an array of arguments */
-int cmd_unmount(char **argv)
-{
-	unsigned int argc;
-	errno_t rc;
-
-	argc = cli_count_args(argv);
-
-	if (argc != 2) {
-		printf("%s: invalid number of arguments.\n",
-		    cmdname);
-		return CMD_FAILURE;
-	}
-
-	rc = vfs_unmount_path(argv[1]);
-	if (rc != EOK) {
-		printf("Unable to unmount %s: %s\n", argv[1], str_error(rc));
-		return CMD_FAILURE;
-	}
-
-	return CMD_SUCCESS;
-}
Index: pace/app/bdsh/cmds/modules/unmount/unmount.h
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/unmount.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-#ifndef UNMOUNT_H
-#define UNMOUNT_H
-
-/* Prototypes for the unmount command, excluding entry points */
-
-#endif /* UNMOUNT_H */
Index: pace/app/bdsh/cmds/modules/unmount/unmount_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/unmount/unmount_def.inc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-{
-	"unmount",
-	"The unmount command",
-	&cmd_unmount,
-	&help_cmd_unmount,
-},
-
-{
-	"umount",
-	NULL,
-	&cmd_unmount,
-	&help_cmd_unmount,
-},
-
Index: pace/app/bdsh/compl.c
===================================================================
--- uspace/app/bdsh/compl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,463 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdbool.h>
-#include <dirent.h>
-#include <errno.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-#include <str.h>
-#include <adt/odict.h>
-
-#include "scli.h"
-#include "cmds/cmds.h"
-#include "compl.h"
-#include "exec.h"
-#include "tok.h"
-#include "util.h"
-
-static errno_t compl_init(char32_t *text, size_t pos, size_t *cstart, void **state);
-static errno_t compl_get_next(void *state, char **compl);
-static void compl_fini(void *state);
-
-/** Bdsh implementation of completion ops. */
-tinput_compl_ops_t compl_ops = {
-	.init = compl_init,
-	.get_next = compl_get_next,
-	.fini = compl_fini
-};
-
-/** Completion state object.
- *
- * The state object contains 'iterators' for modules, builtins and
- * executables in directories.
- */
-typedef struct {
-	/** String prefix which we are trying to complete. */
-	char *prefix;
-	/** Length of string prefix (number of characters) */
-	size_t prefix_len;
-
-	/* Pointer to the current alias */
-	odlink_t *alias_link;
-
-	/** Pointer inside list of modules */
-	module_t *module;
-	/** Pointer inside list of builtins */
-	builtin_t *builtin;
-
-	/** Pointer inside list of directories */
-	const char *const *path;
-	/** If not @c NULL, should be freed in the end. */
-	char **path_list;
-	/** Current open directory */
-	DIR *dir;
-
-	char *last_compl;
-
-	/**
-	 * @c true if we are completing a command, @c false if we are
-	 * completing an argument
-	 */
-	bool is_command;
-} compl_t;
-
-/** Init completion.
- *
- * Set up iterators in completion object, based on current token.
- */
-static errno_t compl_init(char32_t *text, size_t pos, size_t *cstart, void **state)
-{
-	compl_t *cs = NULL;
-	char *stext = NULL;
-	char *prefix = NULL;
-	char *dirname = NULL;
-	errno_t retval;
-
-	token_t *tokens = calloc(WORD_MAX, sizeof(token_t));
-	if (tokens == NULL) {
-		retval = ENOMEM;
-		goto error;
-	}
-
-	size_t pref_size;
-	char *rpath_sep;
-	static const char *dirlist_arg[] = { ".", NULL };
-	tokenizer_t tok;
-	ssize_t current_token;
-	size_t tokens_length;
-
-	cs = calloc(1, sizeof(compl_t));
-	if (!cs) {
-		retval = ENOMEM;
-		goto error;
-	}
-
-	/* Convert text buffer to string */
-	stext = wstr_to_astr(text);
-	if (stext == NULL) {
-		retval = ENOMEM;
-		goto error;
-	}
-
-	/* Tokenize the input string */
-	retval = tok_init(&tok, stext, tokens, WORD_MAX);
-	if (retval != EOK) {
-		goto error;
-	}
-
-	retval = tok_tokenize(&tok, &tokens_length);
-	if (retval != EOK) {
-		goto error;
-	}
-
-	/* Find the current token */
-	for (current_token = 0; current_token < (ssize_t) tokens_length;
-	    current_token++) {
-		token_t *t = &tokens[current_token];
-		size_t end = t->char_start + t->char_length;
-
-		/*
-		 * Check if the caret lies inside the token or immediately
-		 * after it
-		 */
-		if (t->char_start <= pos && pos <= end) {
-			break;
-		}
-	}
-
-	if (tokens_length == 0)
-		current_token = -1;
-
-	if ((current_token >= 0) && (tokens[current_token].type != TOKTYPE_SPACE))
-		*cstart = tokens[current_token].char_start;
-	else
-		*cstart = pos;
-
-	/*
-	 * Extract the prefix being completed
-	 * XXX: handle strings, etc.
-	 */
-	pref_size = str_lsize(stext, pos - *cstart);
-	prefix = malloc(pref_size + 1);
-	if (prefix == NULL) {
-		retval = ENOMEM;
-		goto error;
-	}
-	prefix[pref_size] = 0;
-
-	if (current_token >= 0) {
-		str_ncpy(prefix, pref_size + 1, stext +
-		    tokens[current_token].byte_start, pref_size);
-	}
-
-	/*
-	 * Determine if the token being completed is a command or argument.
-	 * We look at the previous token. If there is none or it is a pipe
-	 * ('|'), it is a command, otherwise it is an argument.
-	 */
-
-	/* Skip any whitespace before current token */
-	ssize_t prev_token = current_token - 1;
-	if ((prev_token >= 0) && (tokens[prev_token].type == TOKTYPE_SPACE))
-		prev_token--;
-
-	/*
-	 * It is a command if it is the first token or if it immediately
-	 * follows a pipe token.
-	 */
-	if ((prev_token < 0) || (tokens[prev_token].type == TOKTYPE_SPACE))
-		cs->is_command = true;
-	else
-		cs->is_command = false;
-
-	rpath_sep = str_rchr(prefix, '/');
-	if (rpath_sep != NULL) {
-		/* Extract path. For path beginning with '/' keep the '/'. */
-		dirname = str_ndup(prefix, max(1, rpath_sep - prefix));
-		if (dirname == NULL) {
-			retval = ENOMEM;
-			goto error;
-		}
-
-		/* Extract name prefix */
-		cs->prefix = str_dup(rpath_sep + 1);
-		if (cs->prefix == NULL) {
-			retval = ENOMEM;
-			goto error;
-		}
-		*cstart += rpath_sep + 1 - prefix;
-
-		cs->path_list = malloc(sizeof(char *) * 2);
-		if (cs->path_list == NULL) {
-			retval = ENOMEM;
-			goto error;
-		}
-
-		if (!is_path(prefix) && cs->is_command) {
-			cs->path_list[0] = malloc(sizeof(char) * PATH_MAX);
-			if (cs->path_list[0] == NULL) {
-				retval = ENOMEM;
-				goto error;
-			}
-
-			int ret = snprintf(cs->path_list[0], PATH_MAX, "%s/%s", search_dir[0], dirname);
-			if (ret < 0 || ret >= PATH_MAX) {
-				retval = ENOMEM;
-				goto error;
-			}
-		} else {
-			cs->path_list[0] = dirname;
-		}
-
-		free(prefix);
-		cs->path_list[1] = NULL;
-		/*
-		 * The second const ensures that we can't assign a const
-		 * string to the non-const array.
-		 */
-		cs->path = (const char *const *) cs->path_list;
-
-	} else if (cs->is_command) {
-		/* Command without path */
-		cs->alias_link = odict_first(&alias_dict);
-		cs->module = modules;
-		cs->builtin = builtins;
-		cs->prefix = prefix;
-		cs->path = &search_dir[0];
-	} else {
-		/* Argument without path */
-		cs->prefix = prefix;
-		cs->path = &dirlist_arg[0];
-	}
-
-	cs->prefix_len = str_length(cs->prefix);
-
-	tok_fini(&tok);
-
-	*state = cs;
-	return EOK;
-
-error:
-	/* Error cleanup */
-
-	tok_fini(&tok);
-
-	if (cs != NULL && cs->path_list != NULL) {
-		size_t i = 0;
-		while (cs->path_list[i] != NULL) {
-			free(cs->path_list[i]);
-			++i;
-		}
-		free(cs->path_list);
-	}
-
-	if ((cs != NULL) && (cs->prefix != NULL))
-		free(cs->prefix);
-
-	if (dirname != NULL)
-		free(dirname);
-
-	if (prefix != NULL)
-		free(prefix);
-
-	if (stext != NULL)
-		free(stext);
-
-	if (cs != NULL)
-		free(cs);
-
-	if (tokens != NULL)
-		free(tokens);
-
-	return retval;
-}
-
-/** Determine if completion matches the required prefix.
- *
- * Required prefix is stored in @a cs->prefix.
- *
- * @param cs	Completion state object
- * @param compl	Completion string
- * @return	@c true when @a compl matches, @c false otherwise
- */
-static bool compl_match_prefix(compl_t *cs, const char *compl)
-{
-	return str_lcmp(compl, cs->prefix, cs->prefix_len) == 0;
-}
-
-/** Get next match. */
-static errno_t compl_get_next(void *state, char **compl)
-{
-	compl_t *cs = (compl_t *) state;
-	struct dirent *dent;
-
-	*compl = NULL;
-
-	if (cs->last_compl != NULL) {
-		free(cs->last_compl);
-		cs->last_compl = NULL;
-	}
-
-	/* Alias */
-	if (cs->alias_link != NULL) {
-		while (*compl == NULL && cs->alias_link != NULL) {
-			alias_t *data = odict_get_instance(cs->alias_link, alias_t, odict);
-			if (compl_match_prefix(cs, data->name)) {
-				asprintf(compl, "%s ", data->name);
-				cs->last_compl = *compl;
-				if (*compl == NULL)
-					return ENOMEM;
-			}
-			cs->alias_link = odict_next(cs->alias_link, &alias_dict);
-		}
-	}
-
-	/* Modules */
-	if (cs->module != NULL) {
-		while (*compl == NULL && cs->module->name != NULL) {
-			/* prevents multiple listing of an overriden cmd */
-			if (compl_match_prefix(cs, cs->module->name)) {
-				odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cs->module->name, NULL);
-				if (alias_link == NULL) {
-					asprintf(compl, "%s ", cs->module->name);
-					cs->last_compl = *compl;
-					if (*compl == NULL)
-						return ENOMEM;
-				}
-			}
-			cs->module++;
-		}
-	}
-
-	/* Builtins */
-	if (cs->builtin != NULL) {
-		while (*compl == NULL && cs->builtin->name != NULL) {
-			if (compl_match_prefix(cs, cs->builtin->name)) {
-				/* prevents multiple listing of an overriden cmd */
-				odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cs->module->name, NULL);
-				if (alias_link == NULL) {
-					asprintf(compl, "%s ", cs->builtin->name);
-					cs->last_compl = *compl;
-					if (*compl == NULL)
-						return ENOMEM;
-				}
-			}
-			cs->builtin++;
-		}
-	}
-
-	/* Files and directories. We scan entries from a set of directories. */
-	if (cs->path != NULL) {
-		while (*compl == NULL) {
-			/* Open next directory */
-			while (cs->dir == NULL) {
-				if (*cs->path == NULL)
-					break;
-
-				cs->dir = opendir(*cs->path);
-
-				/* Skip directories that we fail to open. */
-				if (cs->dir == NULL)
-					cs->path++;
-			}
-
-			/* If it was the last one, we are done */
-			if (cs->dir == NULL)
-				break;
-
-			/* Read next directory entry */
-			dent = readdir(cs->dir);
-			if (dent == NULL) {
-				/* Error. Close directory, go to next one */
-				closedir(cs->dir);
-				cs->dir = NULL;
-				cs->path++;
-				continue;
-			}
-
-			if (compl_match_prefix(cs, dent->d_name)) {
-				/* Construct pathname */
-				char *ent_path;
-				asprintf(&ent_path, "%s/%s", *cs->path, dent->d_name);
-				vfs_stat_t ent_stat;
-				if (vfs_stat_path(ent_path, &ent_stat) != EOK) {
-					/* Error */
-					free(ent_path);
-					continue;
-				}
-
-				free(ent_path);
-
-				/* prevents multiple listing of an overriden cmd */
-				if (cs->is_command && !ent_stat.is_directory) {
-					odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)dent->d_name, NULL);
-					if (alias_link != NULL) {
-						continue;
-					}
-				}
-
-				asprintf(compl, "%s%c", dent->d_name,
-				    ent_stat.is_directory ? '/' : ' ');
-				cs->last_compl = *compl;
-				if (*compl == NULL)
-					return ENOMEM;
-			}
-		}
-	}
-
-	if (*compl == NULL)
-		return ENOENT;
-
-	return EOK;
-}
-
-/** Finish completion operation. */
-static void compl_fini(void *state)
-{
-	compl_t *cs = (compl_t *) state;
-
-	if (cs->path_list != NULL) {
-		size_t i = 0;
-		while (cs->path_list[i] != NULL) {
-			free(cs->path_list[i]);
-			++i;
-		}
-		free(cs->path_list);
-	}
-
-	if (cs->last_compl != NULL)
-		free(cs->last_compl);
-	if (cs->dir != NULL)
-		closedir(cs->dir);
-
-	free(cs->prefix);
-	free(cs);
-}
Index: pace/app/bdsh/compl.h
===================================================================
--- uspace/app/bdsh/compl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef COMPL_H
-#define COMPL_H
-
-#include <tinput.h>
-
-extern tinput_compl_ops_t compl_ops;
-
-#endif
Index: pace/app/bdsh/config.h
===================================================================
--- uspace/app/bdsh/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Various things that are used in many places including a few
- * tidbits left over from autoconf prior to the HelenOS port
- */
-
-/* Specific port work-arounds : */
-#ifndef PATH_MAX
-#define PATH_MAX 255
-#endif
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
-#endif
-
-/* define maximal nested aliases */
-#ifndef HUBS_MAX
-#define HUBS_MAX 20
-#endif
-
-/* Used in many places */
-#define SMALL_BUFLEN 256
-#define LARGE_BUFLEN 1024
-
-/*
- * How many words (arguments) are permitted, how big can a whole
- * sentence be? Similar to ARG_MAX
- */
-#define WORD_MAX 1023
-#define INPUT_MAX 4096
-
-/* Leftovers from Autoconf */
-#define PACKAGE_MAINTAINER "Tim Post"
-#define PACKAGE_BUGREPORT "echo@echoreply.us"
-#define PACKAGE_NAME "bdsh"
-#define PACKAGE_STRING "The brain dead shell"
-#define PACKAGE_TARNAME "bdsh"
-#define PACKAGE_VERSION "0.1.0"
Index: pace/app/bdsh/demo.txt
===================================================================
--- uspace/app/bdsh/demo.txt	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-Multilingual text test
-----------------------
-
-English:  Quick brown fox jumps over the lazy dog
-Czech:    Příliš žluťoučký kůň úpěl ďábelské ódy
-Greek:    Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε
-Hebrew:   משוואת ברנולי היא משוואה בהידרודינמיקה
-Arabic:   التوزيع الجغرافي للحمل العنقودي
-Russian:  Леннон познакомился с художницей-авангардисткой
-Armenian: Սկսեց հրատարակվել Երուսաղեմի հայկական
Index: pace/app/bdsh/errors.c
===================================================================
--- uspace/app/bdsh/errors.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <str.h>
-
-#include "config.h"
-#include "errors.h"
-#include "errstr.h"
-#include "scli.h"
-
-volatile int cli_errno = CL_EOK;
-extern volatile unsigned int cli_quit;
-
-/* Error printing, translation and handling functions */
-
-/** Look up errno in cl_errors and return the corresponding string.
- *
- * Return NULL if not found
- */
-static const char *err2str(int err)
-{
-
-	if (NULL != cl_errors[err])
-		return cl_errors[err];
-
-	return (char *)NULL;
-}
-
-/** Print an error report signifying errno
- *
- * errno is translated to its corresponding human readable string.
- * If errno > 0, raise the cli_quit int that tells the main program loop
- * to exit immediately
- */
-void cli_error(int err, const char *fmt, ...)
-{
-	va_list vargs;
-	va_start(vargs, fmt);
-	vprintf(fmt, vargs);
-	va_end(vargs);
-
-	if (NULL != err2str(err))
-		printf(" (%s)\n", err2str(err));
-	else
-		printf(" (Unknown Error %d)\n", err);
-
-	/*
-	 * If fatal, raise cli_quit so that we try to exit
-	 * gracefully. This will break the main loop and
-	 * invoke the destructor
-	 */
-	if (err == CL_EFATAL)
-		cli_quit = 1;
-
-	return;
-
-}
Index: pace/app/bdsh/errors.h
===================================================================
--- uspace/app/bdsh/errors.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ERRORS_H
-#define ERRORS_H
-
-#include <io/verify.h>
-
-/* Various error levels */
-#define CL_EFATAL  -1
-#define CL_EOK     0
-#define CL_EFAIL   1
-#define CL_EBUSY   2
-#define CL_ENOENT  3
-#define CL_ENOMEM  4
-#define CL_EPERM   5
-#define CL_ENOTSUP 6
-#define CL_EEXEC   7
-#define CL_EEXIST  8
-#define CL_ETOOBIG 9
-
-/* Just like 'errno' */
-extern volatile int cli_errno;
-
-extern void cli_error(int, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-
-#endif
Index: pace/app/bdsh/errstr.h
===================================================================
--- uspace/app/bdsh/errstr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ERRSTR_H
-#define ERRSTR_H
-
-/* Simple array to translate error codes to meaningful strings */
-
-static const char *cl_errors[] = {
-	"Success",
-	"Failure",
-	"Busy",
-	"No Such Entry",
-	"Not Enough Memory",
-	"Permission Denied",
-	"Method Not Supported",
-	"Bad command or file name",
-	"Entry already exists",
-	"Object too large",
-	NULL
-};
-
-static const char *err2str(int);
-
-#endif
Index: pace/app/bdsh/exec.c
===================================================================
--- uspace/app/bdsh/exec.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * The VERY basics of execute in place support. These are buggy, leaky
- * and not nearly done. Only here for beta testing!! You were warned!!
- * TODO:
- * Hash command lookups to save time
- * Create a running pointer to **path and advance/rewind it as we go
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-
-#include "config.h"
-#include "util.h"
-#include "exec.h"
-#include "errors.h"
-
-static errno_t find_command(char *, char **);
-static int try_access(const char *);
-
-const char *search_dir[] = { "/app", NULL };
-
-/* work-around for access() */
-static int try_access(const char *f)
-{
-	int fd;
-
-	errno_t rc = vfs_lookup_open(f, WALK_REGULAR, MODE_READ, &fd);
-	if (rc == EOK) {
-		vfs_put(fd);
-		return 0;
-	} else
-		return -1;
-}
-
-/** Returns EOK if no internal failure or else ENOMEM
- *
- * When the parameter `cmd` can be found then the absolute path will be set in `found`.
- * Or else `found` will be NULL.
- * `found` will be newly allocated and must be freed by the caller
- */
-static errno_t find_command(char *cmd, char **found)
-{
-	/* The user has specified a full or relative path, just give it back. */
-	if (is_path(cmd)) {
-		if (-1 != try_access(cmd)) {
-			*found = str_dup(cmd);
-			return EOK;
-		}
-
-		*found = NULL;
-		return EOK;
-	}
-
-	*found = (char *)malloc(PATH_MAX);
-	if (*found == NULL) {
-		return ENOMEM;
-	}
-
-	/* We now have n places to look for the command */
-	size_t i;
-	size_t cmd_length = str_length(cmd);
-	for (i = 0; search_dir[i] != NULL; i++) {
-		if (str_length(search_dir[i]) + cmd_length + 2 > PATH_MAX) {
-			free(*found);
-			return ENOMEM;
-		}
-
-		memset(*found, 0, PATH_MAX);
-		snprintf(*found, PATH_MAX, "%s/%s", search_dir[i], cmd);
-		if (-1 != try_access(*found)) {
-			return EOK;
-		}
-	}
-	free(*found);
-	*found = NULL;
-
-	/* We didn't find it, return NULL */
-	return EOK;
-}
-
-unsigned int try_exec(char *cmd, char **argv, iostate_t *io)
-{
-	task_id_t tid;
-	task_wait_t twait;
-	task_exit_t texit;
-	char *tmp;
-	errno_t rc;
-	int retval, i;
-	int file_handles[3] = { -1, -1, -1 };
-	FILE *files[3];
-
-	rc = find_command(cmd, &tmp);
-	if (rc != EOK) {
-		cli_error(CL_ENOMEM, "%s: failure executing find_command()", progname);
-		return 1;
-	}
-
-	if (tmp == NULL) {
-		cli_error(CL_EEXEC, "%s: Command not found '%s'", progname, cmd);
-		return 1;
-	}
-
-	files[0] = io->stdin;
-	files[1] = io->stdout;
-	files[2] = io->stderr;
-
-	for (i = 0; i < 3 && files[i] != NULL; i++) {
-		vfs_fhandle(files[i], &file_handles[i]);
-	}
-
-	rc = task_spawnvf(&tid, &twait, tmp, (const char **) argv,
-	    file_handles[0], file_handles[1], file_handles[2]);
-	free(tmp);
-
-	if (rc != EOK) {
-		cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
-		    str_error(rc));
-		return 1;
-	}
-
-	rc = task_wait(&twait, &texit, &retval);
-	if (rc != EOK) {
-		printf("%s: Failed waiting for command (%s)\n", progname,
-		    str_error(rc));
-		return 1;
-	} else if (texit != TASK_EXIT_NORMAL) {
-		printf("%s: Command failed (unexpectedly terminated)\n", progname);
-		return 1;
-	} else if (retval != 0) {
-		printf("%s: Command failed (exit code %d)\n",
-		    progname, retval);
-		return 1;
-	}
-
-	return 0;
-}
Index: pace/app/bdsh/exec.h
===================================================================
--- uspace/app/bdsh/exec.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EXEC_H
-#define EXEC_H
-
-#include <task.h>
-#include "scli.h"
-
-extern const char *search_dir[];
-
-extern unsigned int try_exec(char *, char **, iostate_t *);
-
-#endif
Index: pace/app/bdsh/input.c
===================================================================
--- uspace/app/bdsh/input.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,391 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2018 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <io/style.h>
-#include <io/color.h>
-#include <vfs/vfs.h>
-#include <clipboard.h>
-#include <macros.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <tinput.h>
-#include <adt/odict.h>
-#include <adt/list.h>
-
-#include "config.h"
-#include "compl.h"
-#include "util.h"
-#include "scli.h"
-#include "input.h"
-#include "errors.h"
-#include "exec.h"
-#include "tok.h"
-
-extern volatile unsigned int cli_quit;
-
-/** Text input field. */
-static tinput_t *tinput;
-
-/* Private helpers */
-static int run_command(char **, cliuser_t *, iostate_t *);
-static void print_pipe_usage(void);
-
-typedef struct {
-	link_t alias_hup_link;
-	alias_t *alias;
-} alias_hup_t;
-
-static bool find_alias_hup(alias_t *alias, list_t *alias_hups)
-{
-	list_foreach(*alias_hups, alias_hup_link, alias_hup_t, link) {
-		if (alias == link->alias) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/*
- * Tokenizes input from console, sees if the first word is a built-in, if so
- * invokes the built-in entry point (a[0]) passing all arguments in a[] to
- * the handler
- */
-static errno_t process_input_nohup(cliuser_t *usr, list_t *alias_hups, size_t count_executed_hups)
-{
-	if (count_executed_hups >= HUBS_MAX) {
-		cli_error(CL_EFAIL, "%s: maximal alias hubs reached\n", PACKAGE_NAME);
-		return ELIMIT;
-	}
-
-	token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t));
-	if (tokens_buf == NULL)
-		return ENOMEM;
-	token_t *tokens = tokens_buf;
-
-	char *cmd[WORD_MAX];
-	errno_t rc = EOK;
-	tokenizer_t tok;
-	unsigned int i, pipe_count, processed_pipes;
-	unsigned int pipe_pos[2];
-	char *redir_from = NULL;
-	char *redir_to = NULL;
-
-	if (usr->line == NULL) {
-		free(tokens_buf);
-		return EINVAL;
-	}
-
-	rc = tok_init(&tok, usr->line, tokens, WORD_MAX);
-	if (rc != EOK) {
-		goto finit;
-	}
-
-	size_t tokens_length;
-	rc = tok_tokenize(&tok, &tokens_length);
-	if (rc != EOK) {
-		goto finit;
-	}
-
-	if (tokens_length > 0 && tokens[0].type == TOKTYPE_SPACE) {
-		tokens++;
-		tokens_length--;
-	}
-
-	if (tokens_length > 0 && tokens[tokens_length - 1].type == TOKTYPE_SPACE) {
-		tokens_length--;
-	}
-
-	/*
-	 * Until full support for pipes is implemented, allow for a simple case:
-	 * [from <file> |] command [| to <file>]
-	 *
-	 * First find the pipes and check that there are no more
-	 */
-	for (i = 0, pipe_count = 0; i < tokens_length; i++) {
-		if (tokens[i].type == TOKTYPE_PIPE) {
-			if (pipe_count >= 2) {
-				print_pipe_usage();
-				rc = ENOTSUP;
-				goto finit;
-			}
-			pipe_pos[pipe_count] = i;
-			pipe_count++;
-		}
-	}
-
-	unsigned int cmd_token_start = 0;
-	unsigned int cmd_token_end = tokens_length;
-
-	processed_pipes = 0;
-
-	/* Check if the first part (from <file> |) is present */
-	if (pipe_count > 0 && (pipe_pos[0] == 3 || pipe_pos[0] == 4) && str_cmp(tokens[0].text, "from") == 0) {
-		/* Ignore the first three tokens (from, file, pipe) and set from */
-		redir_from = tokens[2].text;
-		cmd_token_start = pipe_pos[0] + 1;
-		processed_pipes++;
-	}
-
-	/* Check if the second part (| to <file>) is present */
-	if ((pipe_count - processed_pipes) > 0 &&
-	    (pipe_pos[processed_pipes] == tokens_length - 4 ||
-	    (pipe_pos[processed_pipes] == tokens_length - 5 &&
-	    tokens[tokens_length - 4].type == TOKTYPE_SPACE)) &&
-	    str_cmp(tokens[tokens_length - 3].text, "to") == 0) {
-		/* Ignore the last three tokens (pipe, to, file) and set to */
-		redir_to = tokens[tokens_length - 1].text;
-		cmd_token_end = pipe_pos[processed_pipes];
-		processed_pipes++;
-	}
-
-	if (processed_pipes != pipe_count) {
-		print_pipe_usage();
-		rc = ENOTSUP;
-		goto finit;
-	}
-
-	/* Convert tokens of the command to string array */
-	unsigned int cmd_pos = 0;
-	for (i = cmd_token_start; i < cmd_token_end; i++) {
-		if (tokens[i].type != TOKTYPE_SPACE) {
-			cmd[cmd_pos++] = tokens[i].text;
-		}
-	}
-	cmd[cmd_pos++] = NULL;
-
-	if (cmd[0] == NULL) {
-		print_pipe_usage();
-		rc = ENOTSUP;
-		goto finit;
-	}
-
-	/* test if the passed cmd is an alias */
-	odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cmd[0], NULL);
-	if (alias_link != NULL) {
-		alias_t *data = odict_get_instance(alias_link, alias_t, odict);
-		/* check if the alias already has been resolved once */
-		if (!find_alias_hup(data, alias_hups)) {
-			alias_hup_t *hup = (alias_hup_t *)calloc(1, sizeof(alias_hup_t));
-			if (hup == NULL) {
-				cli_error(CL_EFAIL, "%s: cannot allocate alias structure\n", PACKAGE_NAME);
-				rc = ENOMEM;
-				goto finit;
-			}
-
-			hup->alias = data;
-			list_append(&hup->alias_hup_link, alias_hups);
-
-			char *oldLine = usr->line;
-			const size_t input_length = str_size(usr->line) - str_size(cmd[0]) + str_size(data->value) + 1;
-			usr->line = (char *)malloc(input_length);
-			if (usr->line == NULL) {
-				cli_error(CL_EFAIL, "%s: cannot allocate input structure\n", PACKAGE_NAME);
-				rc = ENOMEM;
-				goto finit;
-			}
-
-			usr->line[0] = '\0';
-
-			unsigned int cmd_replace_index = cmd_token_start;
-			for (i = 0; i < tokens_length; i++) {
-				if (i == cmd_replace_index) {
-					/* if there is a pipe symbol than cmd_token_start will point at the SPACE after the pipe symbol */
-					if (tokens[i].type == TOKTYPE_SPACE) {
-						cmd_replace_index++;
-						str_append(usr->line, input_length, tokens[i].text);
-						continue;
-					}
-
-					str_append(usr->line, input_length, data->value);
-				} else {
-					str_append(usr->line, input_length, tokens[i].text);
-				}
-			}
-
-			/* reprocess input after string replace */
-			rc = process_input_nohup(usr, alias_hups, count_executed_hups + 1);
-			usr->line = oldLine;
-			goto finit;
-		}
-	}
-
-	iostate_t new_iostate = {
-		.stdin = stdin,
-		.stdout = stdout,
-		.stderr = stderr
-	};
-
-	FILE *from = NULL;
-	FILE *to = NULL;
-
-	if (redir_from) {
-		from = fopen(redir_from, "r");
-		if (from == NULL) {
-			printf("Cannot open file %s\n", redir_from);
-			rc = errno;
-			goto finit_with_files;
-		}
-		new_iostate.stdin = from;
-	}
-
-	if (redir_to) {
-		to = fopen(redir_to, "w");
-		if (to == NULL) {
-			printf("Cannot open file %s\n", redir_to);
-			rc = errno;
-			goto finit_with_files;
-		}
-		new_iostate.stdout = to;
-	}
-
-	if (run_command(cmd, usr, &new_iostate) == 0) {
-		rc = EOK;
-	} else {
-		rc = EINVAL;
-	}
-
-finit_with_files:
-	if (from != NULL) {
-		fclose(from);
-	}
-	if (to != NULL) {
-		fclose(to);
-	}
-
-finit:
-	if (NULL != usr->line) {
-		free(usr->line);
-		usr->line = (char *) NULL;
-	}
-	tok_fini(&tok);
-	free(tokens_buf);
-
-	return rc;
-}
-
-errno_t process_input(cliuser_t *usr)
-{
-	list_t alias_hups;
-	list_initialize(&alias_hups);
-
-	errno_t rc = process_input_nohup(usr, &alias_hups, 0);
-
-	list_foreach_safe(alias_hups, cur_link, next_link) {
-		alias_hup_t *cur_item = list_get_instance(cur_link, alias_hup_t, alias_hup_link);
-		free(cur_item);
-	}
-
-	return rc;
-}
-
-void print_pipe_usage(void)
-{
-	printf("Invalid syntax!\n");
-	printf("Usage of redirection (pipes in the future):\n");
-	printf("from filename | command ...\n");
-	printf("from filename | command ... | to filename\n");
-	printf("command ... | to filename\n");
-
-}
-
-int run_command(char **cmd, cliuser_t *usr, iostate_t *new_iostate)
-{
-	int id = 0;
-
-	/* We have rubbish */
-	if (NULL == cmd[0]) {
-		return CL_ENOENT;
-	}
-
-	/* Is it a builtin command ? */
-	if ((id = (is_builtin(cmd[0]))) > -1) {
-		return run_builtin(id, cmd, usr, new_iostate);
-	}
-
-	/* Is it a module ? */
-	if ((id = (is_module(cmd[0]))) > -1) {
-		return run_module(id, cmd, new_iostate);
-	}
-
-	/* See what try_exec thinks of it */
-	return try_exec(cmd[0], cmd, new_iostate);
-}
-
-void get_input(cliuser_t *usr)
-{
-	char *str;
-	errno_t rc;
-
-	tinput_set_prompt(tinput, usr->prompt);
-
-	rc = tinput_read(tinput, &str);
-	if (rc == ENOENT) {
-		/* User requested exit */
-		cli_quit = 1;
-		putchar('\n');
-		return;
-	}
-
-	if (rc != EOK) {
-		/* Error in communication with console */
-		cli_quit = 1;
-		return;
-	}
-
-	/* Check for empty input. */
-	if (str_cmp(str, "") == 0) {
-		free(str);
-		return;
-	}
-
-	usr->line = str;
-	return;
-}
-
-int input_init(void)
-{
-	tinput = tinput_new();
-	if (tinput == NULL) {
-		printf("Failed to initialize input.\n");
-		return 1;
-	}
-
-	tinput_set_compl_ops(tinput, &compl_ops);
-
-	return 0;
-}
Index: pace/app/bdsh/input.h
===================================================================
--- uspace/app/bdsh/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef INPUT_H
-#define INPUT_H
-
-#include "cmds/cmds.h"
-
-/* prototypes */
-
-extern void get_input(cliuser_t *);
-extern errno_t process_input(cliuser_t *);
-extern int input_init(void);
-
-#endif
Index: pace/app/bdsh/meson.build
===================================================================
--- uspace/app/bdsh/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clui', 'fmtutil' ]
-includes += include_directories('.', 'cmds', 'cmds/builtins', 'cmds/modules')
-src = files(
-	'cmds/builtin_cmds.c',
-	'cmds/builtins/batch/batch.c',
-	'cmds/builtins/builtin_aliases.c',
-	'cmds/builtins/builtins.c',
-	'cmds/builtins/cd/cd.c',
-	'cmds/builtins/exit/exit.c',
-	'cmds/mod_cmds.c',
-	'cmds/modules/alias/alias.c',
-	'cmds/modules/cat/cat.c',
-	'cmds/modules/cmp/cmp.c',
-	'cmds/modules/cp/cp.c',
-	'cmds/modules/echo/echo.c',
-	'cmds/modules/help/help.c',
-	'cmds/modules/kcon/kcon.c',
-	'cmds/modules/ls/ls.c',
-	'cmds/modules/mkdir/mkdir.c',
-	'cmds/modules/mkfile/mkfile.c',
-	'cmds/modules/module_aliases.c',
-	'cmds/modules/modules.c',
-	'cmds/modules/mount/mount.c',
-	'cmds/modules/mv/mv.c',
-	'cmds/modules/printf/printf.c',
-	'cmds/modules/pwd/pwd.c',
-	'cmds/modules/rm/rm.c',
-	'cmds/modules/sleep/sleep.c',
-	'cmds/modules/touch/touch.c',
-	'cmds/modules/unalias/unalias.c',
-	'cmds/modules/unmount/unmount.c',
-	'compl.c',
-	'errors.c',
-	'exec.c',
-	'input.c',
-	'scli.c',
-	'tok.c',
-	'util.c',
-)
-
-test_src = files(
-	'tok.c',
-	'test/toktest.c',
-)
-
-# TODO: install this file somewhere sane
-installed_data += { 'name': 'demo.txt', 'dir': '/' }
Index: pace/app/bdsh/scli.c
===================================================================
--- uspace/app/bdsh/scli.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * Copyright (c) 2018 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <adt/odict.h>
-#include "config.h"
-#include "scli.h"
-#include "input.h"
-#include "util.h"
-#include "errors.h"
-#include "cmds/cmds.h"
-
-/* See scli.h */
-static cliuser_t usr;
-static iostate_t *iostate;
-static iostate_t stdiostate;
-
-odict_t alias_dict;
-
-/*
- * Globals that are modified during start-up that modules/builtins
- * should be aware of.
- */
-volatile unsigned int cli_quit = 0;
-volatile unsigned int cli_verbocity = 1;
-
-/*
- * The official name of this program
- * (change to your liking in configure.ac and re-run autoconf)
- */
-const char *progname = PACKAGE_NAME;
-
-static int alias_cmp(void *a, void *b)
-{
-	return str_cmp((char *)a, (char *)b);
-}
-
-static void *alias_key(odlink_t *odlink)
-{
-	return (void *)odict_get_instance(odlink, alias_t, odict)->name;
-}
-
-/* These are not exposed, even to builtins */
-static int cli_init(cliuser_t *);
-static void cli_finit(cliuser_t *);
-
-/* Constructor */
-static int cli_init(cliuser_t *usr)
-{
-	usr->line = (char *) NULL;
-	usr->name = "root";
-	usr->cwd = (char *) NULL;
-	usr->prompt = (char *) NULL;
-	usr->lasterr = 0;
-
-	if (input_init() != 0)
-		return 1;
-
-	return (int) cli_set_prompt(usr);
-}
-
-/* Destructor */
-static void cli_finit(cliuser_t *usr)
-{
-	if (NULL != usr->line)
-		free(usr->line);
-	if (NULL != usr->prompt)
-		free(usr->prompt);
-	if (NULL != usr->cwd)
-		free(usr->cwd);
-}
-
-iostate_t *get_iostate(void)
-{
-	return iostate;
-}
-
-void set_iostate(iostate_t *ios)
-{
-	iostate = ios;
-	stdin = ios->stdin;
-	stdout = ios->stdout;
-	stderr = ios->stderr;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t ret = 0;
-
-	stdiostate.stdin = stdin;
-	stdiostate.stdout = stdout;
-	stdiostate.stderr = stderr;
-	iostate = &stdiostate;
-
-	odict_initialize(&alias_dict, alias_key, alias_cmp);
-
-	if (cli_init(&usr))
-		exit(EXIT_FAILURE);
-
-	while (!cli_quit) {
-		get_input(&usr);
-		if (NULL != usr.line) {
-			ret = process_input(&usr);
-			cli_set_prompt(&usr);
-			usr.lasterr = ret;
-		}
-	}
-
-	printf("Leaving %s.\n", progname);
-
-	cli_finit(&usr);
-	return ret;
-}
Index: pace/app/bdsh/scli.h
===================================================================
--- uspace/app/bdsh/scli.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * Copyright (c) 2018 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SCLI_H
-#define SCLI_H
-
-#include "config.h"
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <types/adt/odict.h>
-
-typedef struct {
-	const char *name;
-	char *line;
-	char *cwd;
-	char *prompt;
-	errno_t lasterr;
-} cliuser_t;
-
-typedef struct {
-	FILE *stdin;
-	FILE *stdout;
-	FILE *stderr;
-} iostate_t;
-
-extern const char *progname;
-
-extern iostate_t *get_iostate(void);
-extern void set_iostate(iostate_t *);
-
-extern odict_t alias_dict;
-
-typedef struct {
-	odlink_t odict;
-	char *name;
-	char *value;
-} alias_t;
-
-#endif
Index: pace/app/bdsh/test/toktest.c
===================================================================
--- uspace/app/bdsh/test/toktest.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str.h>
-#include <stdlib.h>
-
-#include "../tok.h"
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-#define MAX_TOKENS 32
-#define MAX_INPUT 256
-static tokenizer_t tokenizer;
-static token_t tokens[MAX_TOKENS];
-static char input_buffer[MAX_INPUT];
-
-/* Tokenize the input, asserts that number of tokens is okay. */
-static void prepare(const char *input, size_t expected_token_count)
-{
-	str_cpy(input_buffer, MAX_INPUT, input);
-
-	errno_t rc = tok_init(&tokenizer, input_buffer, tokens, MAX_TOKENS);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	size_t token_count;
-	rc = tok_tokenize(&tokenizer, &token_count);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(expected_token_count, token_count);
-}
-
-#define ASSERT_TOKEN(index, token_type, token_text) \
-	do { \
-		PCUT_ASSERT_INT_EQUALS(token_type, tokens[index].type); \
-		PCUT_ASSERT_STR_EQUALS(token_text, tokens[index].text); \
-	} while (0)
-
-PCUT_TEST_SUITE(tokenizer);
-
-PCUT_TEST_AFTER
-{
-	/* Destroy the tokenizer. */
-	tok_fini(&tokenizer);
-}
-
-PCUT_TEST(empty_input)
-{
-	prepare("", 0);
-}
-
-PCUT_TEST(only_spaces)
-{
-	prepare("   ", 1);
-
-	ASSERT_TOKEN(0, TOKTYPE_SPACE, "   ");
-}
-
-PCUT_TEST(two_text_tokens)
-{
-	prepare("alpha  bravo", 3);
-
-	ASSERT_TOKEN(0, TOKTYPE_TEXT, "alpha");
-	ASSERT_TOKEN(1, TOKTYPE_SPACE, "  ");
-	ASSERT_TOKEN(2, TOKTYPE_TEXT, "bravo");
-}
-
-PCUT_MAIN();
Index: pace/app/bdsh/tok.c
===================================================================
--- uspace/app/bdsh/tok.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <str.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-
-#include "tok.h"
-
-/* Forward declarations of static functions */
-static char32_t tok_get_char(tokenizer_t *);
-static char32_t tok_look_char(tokenizer_t *);
-static errno_t tok_push_char(tokenizer_t *, char32_t);
-static errno_t tok_push_token(tokenizer_t *);
-static bool tok_pending_chars(tokenizer_t *);
-static errno_t tok_finish_string(tokenizer_t *);
-static void tok_start_token(tokenizer_t *, token_type_t);
-
-/** Initialize the token parser
- *
- * @param tok the tokenizer structure to initialize
- * @param input the input string to tokenize
- * @param out_tokens array of strings where to store the result
- * @param max_tokens number of elements of the out_tokens array
- */
-errno_t tok_init(tokenizer_t *tok, char *input, token_t *out_tokens,
-    size_t max_tokens)
-{
-	tok->in = input;
-	tok->in_offset = 0;
-	tok->last_in_offset = 0;
-	tok->in_char_offset = 0;
-	tok->last_in_char_offset = 0;
-
-	tok->outtok = out_tokens;
-	tok->outtok_offset = 0;
-	tok->outtok_size = max_tokens;
-
-	/* Prepare a buffer where all the token strings will be stored */
-	size_t len = str_size(input) + max_tokens + 1;
-	char *tmp = malloc(len);
-
-	if (tmp == NULL) {
-		return ENOMEM;
-	}
-
-	tok->outbuf = tmp;
-	tok->outbuf_offset = 0;
-	tok->outbuf_size = len;
-	tok->outbuf_last_start = 0;
-
-	return EOK;
-}
-
-/** Finalize the token parser */
-void tok_fini(tokenizer_t *tok)
-{
-	if (tok->outbuf != NULL) {
-		free(tok->outbuf);
-	}
-}
-
-/** Tokenize the input string into the tokens */
-errno_t tok_tokenize(tokenizer_t *tok, size_t *tokens_length)
-{
-	errno_t rc;
-	char32_t next_char;
-
-	/* Read the input line char by char and append tokens */
-	while ((next_char = tok_look_char(tok)) != 0) {
-		if (next_char == ' ') {
-			/*
-			 * Push the token if there is any.
-			 * There may not be any pending char for a token in case
-			 * there are several spaces in the input.
-			 */
-			if (tok_pending_chars(tok)) {
-				rc = tok_push_token(tok);
-				if (rc != EOK) {
-					return rc;
-				}
-			}
-			tok_start_token(tok, TOKTYPE_SPACE);
-			/* Eat all the spaces */
-			while (tok_look_char(tok) == ' ') {
-				tok_push_char(tok, tok_get_char(tok));
-			}
-			tok_push_token(tok);
-
-		} else if (next_char == '|') {
-			/*
-			 * Pipes are tokens that are delimiters and should be
-			 * output as a separate token
-			 */
-			if (tok_pending_chars(tok)) {
-				rc = tok_push_token(tok);
-				if (rc != EOK) {
-					return rc;
-				}
-			}
-
-			tok_start_token(tok, TOKTYPE_PIPE);
-
-			rc = tok_push_char(tok, tok_get_char(tok));
-			if (rc != EOK) {
-				return rc;
-			}
-
-			rc = tok_push_token(tok);
-			if (rc != EOK) {
-				return rc;
-			}
-		} else if (next_char == '\'') {
-			/*
-			 * A string starts with a quote (') and ends again with a quote.
-			 * A literal quote is written as ''
-			 */
-			tok_start_token(tok, TOKTYPE_TEXT);
-			/* Eat the quote */
-			tok_get_char(tok);
-			rc = tok_finish_string(tok);
-			if (rc != EOK) {
-				return rc;
-			}
-		} else {
-			if (!tok_pending_chars(tok)) {
-				tok_start_token(tok, TOKTYPE_TEXT);
-			}
-			/*
-			 * If we are handling any other character, just append it to
-			 * the current token.
-			 */
-			rc = tok_push_char(tok, tok_get_char(tok));
-			if (rc != EOK) {
-				return rc;
-			}
-		}
-	}
-
-	/* Push the last token */
-	if (tok_pending_chars(tok)) {
-		rc = tok_push_token(tok);
-		if (rc != EOK) {
-			return rc;
-		}
-	}
-
-	*tokens_length = tok->outtok_offset;
-
-	return EOK;
-}
-
-/** Finish tokenizing an opened string */
-errno_t tok_finish_string(tokenizer_t *tok)
-{
-	errno_t rc;
-	char32_t next_char;
-
-	while ((next_char = tok_look_char(tok)) != 0) {
-		if (next_char == '\'') {
-			/* Eat the quote */
-			tok_get_char(tok);
-			if (tok_look_char(tok) == '\'') {
-				/* Encode a single literal quote */
-				rc = tok_push_char(tok, '\'');
-				if (rc != EOK) {
-					return rc;
-				}
-
-				/* Swallow the additional one in the input */
-				tok_get_char(tok);
-			} else {
-				/* The string end */
-				return tok_push_token(tok);
-			}
-		} else {
-			rc = tok_push_char(tok, tok_get_char(tok));
-			if (rc != EOK) {
-				return rc;
-			}
-		}
-	}
-
-	/* If we are here, the string run to the end without being closed */
-	return EINVAL;
-}
-
-/** Get a char from input, advancing the input position */
-char32_t tok_get_char(tokenizer_t *tok)
-{
-	tok->in_char_offset++;
-	return str_decode(tok->in, &tok->in_offset, STR_NO_LIMIT);
-}
-
-/** Get a char from input, while staying on the same input position */
-char32_t tok_look_char(tokenizer_t *tok)
-{
-	size_t old_offset = tok->in_offset;
-	size_t old_char_offset = tok->in_char_offset;
-	char32_t ret = tok_get_char(tok);
-	tok->in_offset = old_offset;
-	tok->in_char_offset = old_char_offset;
-	return ret;
-}
-
-/** Append a char to the end of the current token */
-errno_t tok_push_char(tokenizer_t *tok, char32_t ch)
-{
-	return chr_encode(ch, tok->outbuf, &tok->outbuf_offset, tok->outbuf_size);
-}
-
-void tok_start_token(tokenizer_t *tok, token_type_t type)
-{
-	tok->current_type = type;
-}
-
-/** Push the current token to the output array */
-errno_t tok_push_token(tokenizer_t *tok)
-{
-	if (tok->outtok_offset >= tok->outtok_size) {
-		return EOVERFLOW;
-	}
-
-	if (tok->outbuf_offset >= tok->outbuf_size) {
-		return EOVERFLOW;
-	}
-
-	tok->outbuf[tok->outbuf_offset++] = 0;
-	token_t *tokinfo = &tok->outtok[tok->outtok_offset++];
-	tokinfo->type = tok->current_type;
-	tokinfo->text = tok->outbuf + tok->outbuf_last_start;
-	tokinfo->byte_start = tok->last_in_offset;
-	tokinfo->byte_length = tok->in_offset - tok->last_in_offset;
-	tokinfo->char_start = tok->last_in_char_offset;
-	tokinfo->char_length = tok->in_char_offset - tok->last_in_char_offset;
-	tok->outbuf_last_start = tok->outbuf_offset;
-
-	/* We have consumed the first char of the next token already */
-	tok->last_in_offset = tok->in_offset;
-	tok->last_in_char_offset = tok->in_char_offset;
-
-	return EOK;
-}
-
-/** Return true, if the current token is not empty */
-bool tok_pending_chars(tokenizer_t *tok)
-{
-	assert(tok->outbuf_offset >= tok->outbuf_last_start);
-	return (tok->outbuf_offset != tok->outbuf_last_start);
-}
Index: pace/app/bdsh/tok.h
===================================================================
--- uspace/app/bdsh/tok.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TOK_H
-#define TOK_H
-
-typedef enum {
-	TOKTYPE_TEXT,
-	TOKTYPE_PIPE,
-	TOKTYPE_SPACE
-} token_type_t;
-
-typedef struct {
-	char *text;
-	size_t byte_start;
-	size_t char_start;
-	size_t byte_length;
-	size_t char_length;
-	token_type_t type;
-} token_t;
-
-typedef struct {
-	char *in;
-	size_t in_offset;
-	size_t last_in_offset;
-	size_t in_char_offset;
-	size_t last_in_char_offset;
-
-	char *outbuf;
-	size_t outbuf_offset;
-	size_t outbuf_size;
-	size_t outbuf_last_start;
-
-	token_t *outtok;
-	token_type_t current_type;
-	size_t outtok_offset;
-	size_t outtok_size;
-} tokenizer_t;
-
-extern errno_t tok_init(tokenizer_t *, char *, token_t *, size_t);
-extern void tok_fini(tokenizer_t *);
-extern errno_t tok_tokenize(tokenizer_t *, size_t *);
-
-#endif
Index: pace/app/bdsh/util.c
===================================================================
--- uspace/app/bdsh/util.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-#include <abi/errno.h>
-
-#include "config.h"
-#include "errors.h"
-#include "util.h"
-
-extern volatile int cli_errno;
-
-/* Count and return the # of elements in an array */
-unsigned int cli_count_args(char **args)
-{
-	unsigned int i;
-
-	i = 0;
-	while (args[i] != NULL)
-		i++;
-
-	return i;
-}
-
-/*
- * (re)allocates memory to store the current working directory, gets
- * and updates the current working directory, formats the prompt
- * string
- */
-unsigned int cli_set_prompt(cliuser_t *usr)
-{
-	usr->cwd = (char *) realloc(usr->cwd, PATH_MAX);
-	if (NULL == usr->cwd) {
-		cli_error(CL_ENOMEM, "Can not allocate cwd");
-		cli_errno = CL_ENOMEM;
-		return 1;
-	}
-	if (vfs_cwd_get(usr->cwd, PATH_MAX) != EOK)
-		snprintf(usr->cwd, PATH_MAX, "(unknown)");
-
-	if (usr->prompt)
-		free(usr->prompt);
-	asprintf(&usr->prompt, "%s # ", usr->cwd);
-
-	return 0;
-}
-
-/*
- * Returns true if the string is a relative or an absolute path
- */
-bool is_path(const char *cmd)
-{
-
-	bool ret = str_lcmp(cmd, "/", 1) == 0;
-	ret = ret || str_lcmp(cmd, "./", 2) == 0;
-	ret = ret || str_lcmp(cmd, "../", 3) == 0;
-
-	return ret;
-}
Index: pace/app/bdsh/util.h
===================================================================
--- uspace/app/bdsh/util.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2008 Tim Post
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#include "scli.h"
-#include <stdbool.h>
-
-/* Utility functions */
-extern unsigned int cli_count_args(char **);
-extern unsigned int cli_set_prompt(cliuser_t *usr);
-extern bool is_path(const char *cmd);
-
-#endif
Index: pace/app/bithenge/Makefile.linux
===================================================================
--- uspace/app/bithenge/Makefile.linux	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CFLAGS += -fexec-charset=UTF-8 -finput-charset=UTF-8 -std=gnu99 -pipe
-CFLAGS += -Wall -Wextra -Werror -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes -Werror-implicit-function-declaration -Wwrite-strings
-CFLAGS += -ftrapv
-CFLAGS += -g
-
-LIBBITHENGE_PREFIX = ../../lib/bithenge
-CFLAGS += -I$(LIBBITHENGE_PREFIX)/include
-LIBS += $(LIBBITHENGE_PREFIX)/libbithenge.a
-
-BINARY = bithenge
-
-SOURCES = \
-	test.c
-
-ifdef COVERAGE
-	CFLAGS += -fprofile-arcs -ftest-coverage
-endif
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-$(BINARY): $(OBJECTS)
-	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
-
-clean:
-	find . -name '*.o' -follow -exec rm \{\} \;
-	rm -f $(BINARY)
Index: pace/app/bithenge/doc/doxygroups.h
===================================================================
--- uspace/app/bithenge/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup bithenge bithenge
- * @brief Simple program to test bithenge
- * @ingroup apps
- */
Index: pace/app/bithenge/meson.build
===================================================================
--- uspace/app/bithenge/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'bithenge' ]
-c_args += '-D__HELENOS__'
-src = files('test.c')
Index: pace/app/bithenge/test.c
===================================================================
--- uspace/app/bithenge/test.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Simple program to test Bithenge.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <bithenge/blob.h>
-#include <bithenge/source.h>
-#include <bithenge/print.h>
-#include <bithenge/script.h>
-#include <bithenge/transform.h>
-#include <bithenge/tree.h>
-#include <bithenge/os.h>
-
-#ifdef __HELENOS__
-#include <str_error.h>
-#else
-#include <string.h>
-#define str_error strerror
-#endif
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	if (argc < 3) {
-		fprintf(stderr, "Usage: %s <script> <source>\n", argv[0]);
-		return 1;
-	} else {
-		bithenge_scope_t *scope = NULL;
-		bithenge_transform_t *transform = NULL;
-		bithenge_node_t *node = NULL, *node2 = NULL;
-
-		rc = bithenge_scope_new(&scope, NULL);
-		if (rc != EOK) {
-			printf("Error creating scope: %s\n", str_error(rc));
-			scope = NULL;
-			goto error;
-		}
-
-		rc = bithenge_parse_script(argv[1], &transform);
-		if (rc != EOK) {
-			printf("Error parsing script: %s\n", str_error(rc));
-			transform = NULL;
-			goto error;
-		}
-
-		rc = bithenge_node_from_source(&node, argv[2]);
-		if (rc != EOK) {
-			printf("Error creating node from source: %s\n", str_error(rc));
-			node = NULL;
-			goto error;
-		}
-
-		rc = bithenge_transform_apply(transform, scope, node, &node2);
-		if (rc != EOK) {
-			const char *message = bithenge_scope_get_error(scope);
-			printf("Error applying transform: %s\n",
-			    message ? message : str_error(rc));
-			node2 = NULL;
-			goto error;
-		}
-
-		bithenge_node_dec_ref(node);
-		node = NULL;
-		bithenge_transform_dec_ref(transform);
-		transform = NULL;
-
-		rc = bithenge_print_node(BITHENGE_PRINT_PYTHON, node2);
-		if (rc != EOK) {
-			const char *message = bithenge_scope_get_error(scope);
-			printf("Error printing node: %s\n",
-			    message ? message : str_error(rc));
-			goto error;
-		}
-		bithenge_node_dec_ref(node2);
-		node2 = NULL;
-		bithenge_scope_dec_ref(scope);
-		scope = NULL;
-		printf("\n");
-
-		return 0;
-
-	error:
-		bithenge_node_dec_ref(node);
-		bithenge_node_dec_ref(node2);
-		bithenge_transform_dec_ref(transform);
-		bithenge_scope_dec_ref(scope);
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/blkdump/blkdump.c
===================================================================
--- uspace/app/blkdump/blkdump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,293 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup blkdump
- * @{
- */
-
-/**
- * @file	blockdump.c
- * @brief	Tool for dumping content of block devices
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <block.h>
-#include <mem.h>
-#include <loc.h>
-#include <byteorder.h>
-#include <scsi/mmc.h>
-#include <offset.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <str.h>
-
-#define NAME	"blkdump"
-
-static void syntax_print(void);
-static int print_blocks(aoff64_t block_offset, aoff64_t block_count, size_t block_size);
-static int print_toc(void);
-static void print_hex_row(uint8_t *data, size_t length, size_t bytes_per_row);
-
-static bool relative = false;
-static service_id_t service_id;
-
-int main(int argc, char **argv)
-{
-
-	errno_t rc;
-	char *dev_path;
-	size_t block_size;
-	char *endptr;
-	aoff64_t block_offset = 0;
-	aoff64_t block_count = 1;
-	aoff64_t dev_nblocks;
-	bool toc = false;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	--argc;
-	++argv;
-
-	if (str_cmp(*argv, "--toc") == 0) {
-		--argc;
-		++argv;
-		toc = true;
-		goto devname;
-	}
-
-	if (str_cmp(*argv, "--relative") == 0) {
-		--argc;
-		++argv;
-		relative = true;
-	}
-
-	if (str_cmp(*argv, "--offset") == 0) {
-		--argc;
-		++argv;
-		if (*argv == NULL) {
-			printf(NAME ": Error, argument missing (offset).\n");
-			syntax_print();
-			return 1;
-		}
-
-		block_offset = strtol(*argv, &endptr, 10);
-		if (*endptr != '\0') {
-			printf(NAME ": Error, invalid argument (offset).\n");
-			syntax_print();
-			return 1;
-		}
-
-		--argc;
-		++argv;
-	}
-
-	if (str_cmp(*argv, "--count") == 0) {
-		--argc;
-		++argv;
-		if (*argv == NULL) {
-			printf(NAME ": Error, argument missing (count).\n");
-			syntax_print();
-			return 1;
-		}
-
-		block_count = strtol(*argv, &endptr, 10);
-		if (*endptr != '\0') {
-			printf(NAME ": Error, invalid argument (count).\n");
-			syntax_print();
-			return 1;
-		}
-
-		--argc;
-		++argv;
-	}
-
-devname:
-	if (argc != 1) {
-		printf(NAME ": Error, unexpected argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	dev_path = *argv;
-
-	rc = loc_service_get_id(dev_path, &service_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device `%s'.\n", dev_path);
-		return 2;
-	}
-
-	rc = block_init(service_id);
-	if (rc != EOK)  {
-		printf(NAME ": Error initializing libblock.\n");
-		return 2;
-	}
-
-	rc = block_get_bsize(service_id, &block_size);
-	if (rc != EOK) {
-		printf(NAME ": Error determining device block size.\n");
-		return 2;
-	}
-
-	rc = block_get_nblocks(service_id, &dev_nblocks);
-	if (rc != EOK) {
-		printf(NAME ": Warning, failed to obtain block device size.\n");
-	}
-
-	printf("Device %s has %" PRIuOFF64 " blocks, %" PRIuOFF64 " bytes each\n", dev_path, dev_nblocks, (aoff64_t) block_size);
-
-	int ret;
-	if (toc)
-		ret = print_toc();
-	else
-		ret = print_blocks(block_offset, block_count, block_size);
-
-	block_fini(service_id);
-
-	return ret;
-}
-
-static int print_blocks(aoff64_t block_offset, aoff64_t block_count, size_t block_size)
-{
-	uint8_t *data;
-	aoff64_t current;
-	aoff64_t limit;
-	size_t data_offset;
-	errno_t rc;
-
-	data = malloc(block_size);
-	if (data == NULL) {
-		printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size);
-		return 3;
-	}
-
-	limit = block_offset + block_count;
-	for (current = block_offset; current < limit; current++) {
-		rc = block_read_direct(service_id, current, 1, data);
-		if (rc != EOK) {
-			printf(NAME ": Error reading block at %" PRIuOFF64 " \n", current);
-			free(data);
-			return 3;
-		}
-
-		printf("---- Block %" PRIuOFF64 " (at %" PRIuOFF64 ") ----\n", current, current * block_size);
-
-		for (data_offset = 0; data_offset < block_size; data_offset += 16) {
-			if (relative) {
-				printf("%8" PRIxOFF64 ": ", (aoff64_t) data_offset);
-			} else {
-				printf("%8" PRIxOFF64 ": ", current * block_size + data_offset);
-			}
-			print_hex_row(data + data_offset, block_size - data_offset, 16);
-			printf("\n");
-		}
-		printf("\n");
-	}
-
-	free(data);
-	return 0;
-}
-
-static int print_toc(void)
-{
-	scsi_toc_multisess_data_t toc;
-	errno_t rc;
-
-	rc = block_read_toc(service_id, 0, &toc, sizeof(toc));
-	if (rc != EOK)
-		return 1;
-
-	printf("Multisession Information:\n");
-	printf("\tFirst complete session: %" PRIu8 "\n", toc.first_sess);
-	printf("\tLast complete session: %" PRIu8 "\n", toc.last_sess);
-	printf("\tFirst track of last complete session:\n");
-	printf("\t\tADR / Control: 0x%" PRIx8 "\n", toc.ftrack_lsess.adr_control);
-	printf("\t\tTrack number: %" PRIu8 "\n", toc.ftrack_lsess.track_no);
-	printf("\t\tStart block address: %" PRIu32 "\n", toc.ftrack_lsess.start_addr);
-
-	return 0;
-}
-
-/**
- * Print a row of 16 bytes as commonly seen in hexadecimal dumps
- */
-static void print_hex_row(uint8_t *data, size_t length, size_t bytes_per_row)
-{
-	size_t pos;
-	uint8_t b;
-
-	if (length > bytes_per_row) {
-		length = bytes_per_row;
-	}
-
-	/* Print hexadecimal values */
-	for (pos = 0; pos < length; pos++) {
-		if (pos == length / 2) {
-			printf(" ");
-		}
-		printf("%02hhX ", data[pos]);
-	}
-
-	/* Pad with spaces if we have less than 16 bytes */
-	for (pos = length; pos < bytes_per_row; pos++) {
-		if (pos == length / 2) {
-			printf(" ");
-		}
-		printf("   ");
-	}
-
-	/* Print printable characters */
-	for (pos = 0; pos < length; pos++) {
-		if (pos == length / 2) {
-			printf(" ");
-		}
-		b = data[pos];
-		if (b >= 32 && b < 128) {
-			putchar(b);
-		} else {
-			putchar('.');
-		}
-	}
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: blkdump [--toc] [--relative] [--offset <num_blocks>] "
-	    "[--count <num_blocks>] <device_name>\n");
-}
-
-/**
- * @}
- */
Index: pace/app/blkdump/doc/doxygroups.h
===================================================================
--- uspace/app/blkdump/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup blkdump blkdump
- * @brief Tool for dumping content of block devices
- * @ingroup apps
- */
Index: pace/app/blkdump/meson.build
===================================================================
--- uspace/app/blkdump/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'scsi' ]
-src = files('blkdump.c')
Index: pace/app/calculator/calculator.c
===================================================================
--- uspace/app/calculator/calculator.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1054 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup calculator
- * @{
- */
-/** @file
- *
- * Inspired by the code released at https://github.com/osgroup/HelenOSProject
- *
- */
-
-#include <clipboard.h>
-#include <ctype.h>
-#include <io/kbd_event.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/entry.h>
-#include <ui/fixed.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-#define NAME  "calculator"
-
-#define NULL_DISPLAY  "0"
-
-#define SYNTAX_ERROR_DISPLAY   "Syntax error"
-#define NUMERIC_ERROR_DISPLAY  "Numerical error"
-#define UNKNOWN_ERROR_DISPLAY  "Unknown error"
-
-#define EXPR_MAX_LEN 22
-
-typedef enum {
-	STATE_INITIAL = 0,
-	STATE_FINISH,
-	STATE_ERROR,
-	STATE_DIGIT,
-	STATE_VALUE
-} parser_state_t;
-
-typedef enum {
-	ERROR_SYNTAX = 0,
-	ERROR_NUMERIC
-} error_type_t;
-
-typedef enum {
-	OPERATOR_NONE = 0,
-	OPERATOR_ADD,
-	OPERATOR_SUB,
-	OPERATOR_MUL,
-	OPERATOR_DIV
-} operator_t;
-
-typedef enum {
-	ITEM_VALUE = 0,
-	ITEM_OPERATOR
-} stack_item_type_t;
-
-typedef struct {
-	link_t link;
-
-	stack_item_type_t type;
-	union {
-		int64_t value;
-		operator_t operator;
-	} data;
-} stack_item_t;
-
-/** Dimensions. Most of this should not be needed with auto layout */
-typedef struct {
-	gfx_rect_t menubar_rect;
-	gfx_rect_t entry_rect;
-	gfx_coord2_t btn_orig;
-	gfx_coord2_t btn_stride;
-	gfx_coord2_t btn_dim;
-} calc_geom_t;
-
-typedef struct {
-	ui_t *ui;
-	ui_resource_t *ui_res;
-	ui_pbutton_t *btn_eval;
-	ui_pbutton_t *btn_clear;
-	ui_pbutton_t *btn_add;
-	ui_pbutton_t *btn_sub;
-	ui_pbutton_t *btn_mul;
-	ui_pbutton_t *btn_div;
-	ui_pbutton_t *btn_0;
-	ui_pbutton_t *btn_1;
-	ui_pbutton_t *btn_2;
-	ui_pbutton_t *btn_3;
-	ui_pbutton_t *btn_4;
-	ui_pbutton_t *btn_5;
-	ui_pbutton_t *btn_6;
-	ui_pbutton_t *btn_7;
-	ui_pbutton_t *btn_8;
-	ui_pbutton_t *btn_9;
-	ui_menu_bar_t *menubar;
-	calc_geom_t geom;
-} calc_t;
-
-static void display_update(void);
-
-static void calc_file_exit(ui_menu_entry_t *, void *);
-static void calc_edit_copy(ui_menu_entry_t *, void *);
-static void calc_edit_paste(ui_menu_entry_t *, void *);
-
-static void calc_pb_clicked(ui_pbutton_t *, void *);
-static void calc_eval_clicked(ui_pbutton_t *, void *);
-static void calc_clear_clicked(ui_pbutton_t *, void *);
-
-static ui_pbutton_cb_t calc_pbutton_cb = {
-	.clicked = calc_pb_clicked
-};
-
-static ui_pbutton_cb_t calc_clear_cb = {
-	.clicked = calc_clear_clicked
-};
-
-static ui_pbutton_cb_t calc_eval_cb = {
-	.clicked = calc_eval_clicked
-};
-
-static void wnd_close(ui_window_t *, void *);
-static void wnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close,
-	.kbd = wnd_kbd_event
-};
-
-static char *expr = NULL;
-static ui_entry_t *display;
-
-/** Window close request
- *
- * @param window Window
- * @param arg Argument (calc_t *)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	calc_t *calc = (calc_t *) arg;
-
-	ui_quit(calc->ui);
-}
-
-/** Window keyboard event
- *
- * @param window Window
- * @param arg Argument (calc_t *)
- * @param event Keyboard event
- */
-static void wnd_kbd_event(ui_window_t *window, void *arg, kbd_event_t *event)
-{
-	calc_t *calc = (calc_t *) arg;
-
-	if (ui_window_def_kbd(window, event) == ui_claimed)
-		return;
-
-	if (event->type == KEY_PRESS && (event->mods & KM_CTRL) != 0) {
-		switch (event->key) {
-		case KC_C:
-			calc_edit_copy(NULL, calc);
-			break;
-		case KC_V:
-			calc_edit_paste(NULL, calc);
-			break;
-		default:
-			break;
-		}
-	}
-
-	switch (event->key) {
-	case KC_ENTER:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_eval);
-		else
-			ui_pbutton_release(calc->btn_eval);
-		break;
-	case KC_BACKSPACE:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_clear);
-		else
-			ui_pbutton_release(calc->btn_clear);
-		break;
-	case KC_MINUS:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_sub);
-		else
-			ui_pbutton_release(calc->btn_sub);
-		break;
-	case KC_EQUALS:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_add);
-		else
-			ui_pbutton_release(calc->btn_add);
-		break;
-	case KC_SLASH:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_div);
-		else
-			ui_pbutton_release(calc->btn_div);
-		break;
-	case KC_0:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_0);
-		else
-			ui_pbutton_release(calc->btn_0);
-		break;
-	case KC_1:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_1);
-		else
-			ui_pbutton_release(calc->btn_1);
-		break;
-	case KC_2:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_2);
-		else
-			ui_pbutton_release(calc->btn_2);
-		break;
-	case KC_3:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_3);
-		else
-			ui_pbutton_release(calc->btn_3);
-		break;
-	case KC_4:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_4);
-		else
-			ui_pbutton_release(calc->btn_4);
-		break;
-	case KC_5:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_5);
-		else
-			ui_pbutton_release(calc->btn_5);
-		break;
-	case KC_6:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_6);
-		else
-			ui_pbutton_release(calc->btn_6);
-		break;
-	case KC_7:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_7);
-		else
-			ui_pbutton_release(calc->btn_7);
-		break;
-	case KC_8:
-		if ((event->mods & KM_SHIFT) != 0) {
-			if (event->type == KEY_PRESS)
-				ui_pbutton_press(calc->btn_mul);
-			else
-				ui_pbutton_release(calc->btn_mul);
-		} else {
-			if (event->type == KEY_PRESS)
-				ui_pbutton_press(calc->btn_8);
-			else
-				ui_pbutton_release(calc->btn_8);
-		}
-		break;
-	case KC_9:
-		if (event->type == KEY_PRESS)
-			ui_pbutton_press(calc->btn_9);
-		else
-			ui_pbutton_release(calc->btn_9);
-		break;
-	default:
-		break;
-	}
-}
-
-/** File / Exit menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (calc_t *)
- */
-static void calc_file_exit(ui_menu_entry_t *mentry, void *arg)
-{
-	calc_t *calc = (calc_t *) arg;
-
-	ui_quit(calc->ui);
-}
-
-/** Edit / Copy menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (calc_t *)
- */
-static void calc_edit_copy(ui_menu_entry_t *mentry, void *arg)
-{
-	const char *str;
-
-	(void) arg;
-	str = (expr != NULL) ? expr : NULL_DISPLAY;
-
-	(void) clipboard_put_str(str);
-}
-
-/** Edit / Paste menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (calc_t *)
- */
-static void calc_edit_paste(ui_menu_entry_t *mentry, void *arg)
-{
-	char *str;
-	char *old;
-	char *cp;
-	errno_t rc;
-
-	(void) arg;
-
-	rc = clipboard_get_str(&str);
-	if (rc != EOK)
-		return;
-
-	/* Make sure string only contains allowed characters */
-	cp = str;
-	while (*cp != '\0') {
-		if (!isdigit(*cp) && *cp != '+' && *cp != '-' &&
-		    *cp != '*' && *cp != '/')
-			return;
-		++cp;
-	}
-
-	/* Update expression */
-	old = expr;
-	expr = str;
-	free(old);
-
-	display_update();
-}
-
-static bool is_digit(char c)
-{
-	return ((c >= '0') && (c <= '9'));
-}
-
-static int get_digit(char c)
-{
-	assert(is_digit(c));
-
-	return (c - '0');
-}
-
-static bool is_plus(char c)
-{
-	return (c == '+');
-}
-
-static bool is_minus(char c)
-{
-	return (c == '-');
-}
-
-static bool is_finish(char c)
-{
-	return (c == 0);
-}
-
-static operator_t get_operator(char c)
-{
-	switch (c) {
-	case '+':
-		return OPERATOR_ADD;
-	case '-':
-		return OPERATOR_SUB;
-	case '*':
-		return OPERATOR_MUL;
-	case '/':
-		return OPERATOR_DIV;
-	default:
-		return OPERATOR_NONE;
-	}
-}
-
-static bool is_operator(char c)
-{
-	return (get_operator(c) != OPERATOR_NONE);
-}
-
-static bool stack_push_value(list_t *stack, int64_t value, bool value_neg)
-{
-	stack_item_t *item = malloc(sizeof(stack_item_t));
-	if (!item)
-		return false;
-
-	link_initialize(&item->link);
-	item->type = ITEM_VALUE;
-
-	if (value_neg)
-		item->data.value = -value;
-	else
-		item->data.value = value;
-
-	list_prepend(&item->link, stack);
-
-	return true;
-}
-
-static bool stack_push_operator(list_t *stack, operator_t operator)
-{
-	stack_item_t *item = malloc(sizeof(stack_item_t));
-	if (!item)
-		return false;
-
-	link_initialize(&item->link);
-	item->type = ITEM_OPERATOR;
-	item->data.operator = operator;
-	list_prepend(&item->link, stack);
-
-	return true;
-}
-
-static bool stack_pop_value(list_t *stack, int64_t *value)
-{
-	link_t *link = list_first(stack);
-	if (!link)
-		return false;
-
-	stack_item_t *item = list_get_instance(link, stack_item_t, link);
-	if (item->type != ITEM_VALUE)
-		return false;
-
-	*value = item->data.value;
-
-	list_remove(link);
-	free(item);
-
-	return true;
-}
-
-static bool stack_pop_operator(list_t *stack, operator_t *operator)
-{
-	link_t *link = list_first(stack);
-	if (!link)
-		return false;
-
-	stack_item_t *item = list_get_instance(link, stack_item_t, link);
-	if (item->type != ITEM_OPERATOR)
-		return false;
-
-	*operator = item->data.operator;
-
-	list_remove(link);
-	free(item);
-
-	return true;
-}
-
-static void stack_cleanup(list_t *stack)
-{
-	while (!list_empty(stack)) {
-		link_t *link = list_first(stack);
-		if (link) {
-			stack_item_t *item = list_get_instance(link, stack_item_t,
-			    link);
-
-			list_remove(link);
-			free(item);
-		}
-	}
-}
-
-static bool compute(int64_t a, operator_t operator, int64_t b, int64_t *value)
-{
-	switch (operator) {
-	case OPERATOR_ADD:
-		*value = a + b;
-		break;
-	case OPERATOR_SUB:
-		*value = a - b;
-		break;
-	case OPERATOR_MUL:
-		*value = a * b;
-		break;
-	case OPERATOR_DIV:
-		if (b == 0)
-			return false;
-
-		*value = a / b;
-		break;
-	default:
-		return false;
-	}
-
-	return true;
-}
-
-static unsigned int get_priority(operator_t operator)
-{
-	switch (operator) {
-	case OPERATOR_ADD:
-		return 0;
-	case OPERATOR_SUB:
-		return 0;
-	case OPERATOR_MUL:
-		return 1;
-	case OPERATOR_DIV:
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-static void evaluate(list_t *stack, int64_t *value, parser_state_t *state,
-    error_type_t *error_type)
-{
-	while (!list_empty(stack)) {
-		if (!stack_pop_value(stack, value)) {
-			*state = STATE_ERROR;
-			*error_type = ERROR_SYNTAX;
-			break;
-		}
-
-		if (!list_empty(stack)) {
-			operator_t operator;
-			if (!stack_pop_operator(stack, &operator)) {
-				*state = STATE_ERROR;
-				*error_type = ERROR_SYNTAX;
-				break;
-			}
-
-			int64_t value_a;
-			if (!stack_pop_value(stack, &value_a)) {
-				*state = STATE_ERROR;
-				*error_type = ERROR_SYNTAX;
-				break;
-			}
-
-			if (!compute(value_a, operator, *value, value)) {
-				*state = STATE_ERROR;
-				*error_type = ERROR_NUMERIC;
-				break;
-			}
-
-			if (!stack_push_value(stack, *value, false)) {
-				*state = STATE_ERROR;
-				*error_type = ERROR_SYNTAX;
-				break;
-			}
-		}
-	}
-}
-
-static void display_update(void)
-{
-	if (expr != NULL)
-		(void) ui_entry_set_text(display, (void *) expr);
-	else
-		(void) ui_entry_set_text(display, (void *) NULL_DISPLAY);
-
-	ui_entry_paint(display);
-}
-
-static void display_error(error_type_t error_type)
-{
-	if (expr != NULL) {
-		free(expr);
-		expr = NULL;
-	}
-
-	switch (error_type) {
-	case ERROR_SYNTAX:
-		(void) ui_entry_set_text(display,
-		    (void *) SYNTAX_ERROR_DISPLAY);
-		break;
-	case ERROR_NUMERIC:
-		(void) ui_entry_set_text(display,
-		    (void *) NUMERIC_ERROR_DISPLAY);
-		break;
-	default:
-		(void) ui_entry_set_text(display,
-		    (void *) UNKNOWN_ERROR_DISPLAY);
-		break;
-	}
-
-	ui_entry_paint(display);
-}
-
-static void calc_pb_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	const char *subexpr = (const char *) arg;
-
-	if (expr != NULL) {
-		char *new_expr;
-
-		if (str_length(expr) < EXPR_MAX_LEN) {
-			asprintf(&new_expr, "%s%s", expr, subexpr);
-			free(expr);
-			expr = new_expr;
-		}
-	} else {
-		expr = str_dup(subexpr);
-	}
-
-	display_update();
-}
-
-static void calc_clear_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	if (expr != NULL) {
-		free(expr);
-		expr = NULL;
-	}
-
-	display_update();
-}
-
-static void calc_eval_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	if (expr == NULL)
-		return;
-
-	list_t stack;
-	list_initialize(&stack);
-
-	error_type_t error_type = ERROR_SYNTAX;
-	size_t i = 0;
-	parser_state_t state = STATE_INITIAL;
-	int64_t value = 0;
-	bool value_neg = false;
-	operator_t last_operator = OPERATOR_NONE;
-
-	while ((state != STATE_FINISH) && (state != STATE_ERROR)) {
-		switch (state) {
-		case STATE_INITIAL:
-			if (is_digit(expr[i])) {
-				value = get_digit(expr[i]);
-				i++;
-				state = STATE_VALUE;
-			} else if (is_plus(expr[i])) {
-				i++;
-				value_neg = false;
-				state = STATE_DIGIT;
-			} else if (is_minus(expr[i])) {
-				i++;
-				value_neg = true;
-				state = STATE_DIGIT;
-			} else
-				state = STATE_ERROR;
-			break;
-
-		case STATE_DIGIT:
-			if (is_digit(expr[i])) {
-				value = get_digit(expr[i]);
-				i++;
-				state = STATE_VALUE;
-			} else
-				state = STATE_ERROR;
-			break;
-
-		case STATE_VALUE:
-			if (is_digit(expr[i])) {
-				value *= 10;
-				value += get_digit(expr[i]);
-				i++;
-			} else if (is_operator(expr[i])) {
-				if (!stack_push_value(&stack, value, value_neg)) {
-					state = STATE_ERROR;
-					break;
-				}
-
-				value = 0;
-				value_neg = false;
-
-				operator_t operator = get_operator(expr[i]);
-
-				if (get_priority(operator) <= get_priority(last_operator)) {
-					evaluate(&stack, &value, &state, &error_type);
-					if (state == STATE_ERROR)
-						break;
-
-					if (!stack_push_value(&stack, value, value_neg)) {
-						state = STATE_ERROR;
-						break;
-					}
-				}
-
-				if (!stack_push_operator(&stack, operator)) {
-					state = STATE_ERROR;
-					break;
-				}
-
-				last_operator = operator;
-				i++;
-				state = STATE_DIGIT;
-			} else if (is_finish(expr[i])) {
-				if (!stack_push_value(&stack, value, value_neg)) {
-					state = STATE_ERROR;
-					break;
-				}
-
-				state = STATE_FINISH;
-			} else
-				state = STATE_ERROR;
-			break;
-
-		default:
-			state = STATE_ERROR;
-		}
-	}
-
-	evaluate(&stack, &value, &state, &error_type);
-	stack_cleanup(&stack);
-
-	if (state == STATE_ERROR) {
-		display_error(error_type);
-		return;
-	}
-
-	free(expr);
-	asprintf(&expr, "%" PRId64, value);
-	display_update();
-}
-
-static errno_t calc_button_create(calc_t *calc, ui_fixed_t *fixed,
-    int x, int y, const char *text, ui_pbutton_cb_t *cb, void *arg,
-    ui_pbutton_t **rbutton)
-{
-	ui_pbutton_t *pb;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_pbutton_create(calc->ui_res, text, &pb);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(pb, cb, arg);
-
-	rect.p0.x = calc->geom.btn_orig.x + calc->geom.btn_stride.x * x;
-	rect.p0.y = calc->geom.btn_orig.y + calc->geom.btn_stride.y * y;
-	rect.p1.x = rect.p0.x + calc->geom.btn_dim.x;
-	rect.p1.y = rect.p0.y + calc->geom.btn_dim.y;
-	ui_pbutton_set_rect(pb, &rect);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(pb));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	if (rbutton != NULL)
-		*rbutton = pb;
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [-d <display-spec>]\n", NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	ui_t *ui;
-	ui_resource_t *ui_res;
-	ui_fixed_t *fixed;
-	ui_wnd_params_t params;
-	ui_window_t *window;
-	ui_menu_t *mfile;
-	ui_menu_entry_t *mexit;
-	ui_menu_t *medit;
-	ui_menu_entry_t *mcopy;
-	ui_menu_entry_t *mpaste;
-	calc_t calc;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc) {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return rc;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Calculator";
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-
-	if (ui_is_textmode(ui)) {
-		params.rect.p1.x = 38;
-		params.rect.p1.y = 18;
-
-		calc.geom.menubar_rect.p0.x = 1;
-		calc.geom.menubar_rect.p0.y = 1;
-		calc.geom.menubar_rect.p1.x = params.rect.p1.x - 1;
-		calc.geom.menubar_rect.p1.y = 2;
-		calc.geom.entry_rect.p0.x = 4;
-		calc.geom.entry_rect.p0.y = 3;
-		calc.geom.entry_rect.p1.x = 34;
-		calc.geom.entry_rect.p1.y = 4;
-		calc.geom.btn_orig.x = 4;
-		calc.geom.btn_orig.y = 5;
-		calc.geom.btn_dim.x = 6;
-		calc.geom.btn_dim.y = 2;
-		calc.geom.btn_stride.x = 8;
-		calc.geom.btn_stride.y = 3;
-	} else {
-		params.rect.p1.x = 250;
-		params.rect.p1.y = 270;
-
-		calc.geom.menubar_rect.p0.x = 4;
-		calc.geom.menubar_rect.p0.y = 30;
-		calc.geom.menubar_rect.p1.x = params.rect.p1.x - 4;
-		calc.geom.menubar_rect.p1.y = 52;
-		calc.geom.entry_rect.p0.x = 10;
-		calc.geom.entry_rect.p0.y = 51;
-		calc.geom.entry_rect.p1.x = 240;
-		calc.geom.entry_rect.p1.y = 76;
-		calc.geom.btn_orig.x = 10;
-		calc.geom.btn_orig.y = 90;
-		calc.geom.btn_dim.x = 50;
-		calc.geom.btn_dim.y = 35;
-		calc.geom.btn_stride.x = 60;
-		calc.geom.btn_stride.y = 45;
-	}
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &calc);
-	calc.ui = ui;
-
-	ui_res = ui_window_get_res(window);
-	calc.ui_res = ui_res;
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_menu_bar_create(ui, window, &calc.menubar);
-	if (rc != EOK) {
-		printf("Error creating menu bar.\n");
-		return rc;
-	}
-
-	rc = ui_menu_dd_create(calc.menubar, "~F~ile", NULL, &mfile);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(mfile, "E~x~it", "Alt-F4", &mexit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mexit, calc_file_exit, (void *) &calc);
-
-	rc = ui_menu_dd_create(calc.menubar, "~E~dit", NULL, &medit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(medit, "~C~opy", "Ctrl-C", &mcopy);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mcopy, calc_edit_copy, (void *) &calc);
-
-	rc = ui_menu_entry_create(medit, "~P~aste", "Ctrl-V", &mpaste);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mpaste, calc_edit_paste, (void *) &calc);
-
-	ui_menu_bar_set_rect(calc.menubar, &calc.geom.menubar_rect);
-
-	rc = ui_fixed_add(fixed, ui_menu_bar_ctl(calc.menubar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_entry_create(window, NULL_DISPLAY, &display);
-	if (rc != EOK) {
-		printf("Error creating text lentry.\n");
-		return rc;
-	}
-
-	ui_entry_set_rect(display, &calc.geom.entry_rect);
-	ui_entry_set_halign(display, gfx_halign_right);
-	ui_entry_set_read_only(display, true);
-
-	rc = ui_fixed_add(fixed, ui_entry_ctl(display));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = calc_button_create(&calc, fixed, 0, 0, "7", &calc_pbutton_cb,
-	    (void *) "7", &calc.btn_7);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 1, 0, "8", &calc_pbutton_cb,
-	    (void *) "8", &calc.btn_8);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 2, 0, "9", &calc_pbutton_cb,
-	    (void *) "9", &calc.btn_9);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 3, 0, "/", &calc_pbutton_cb,
-	    (void *) "/", &calc.btn_div);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 0, 1, "4", &calc_pbutton_cb,
-	    (void *) "4", &calc.btn_4);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 1, 1, "5", &calc_pbutton_cb,
-	    (void *) "5", &calc.btn_5);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 2, 1, "6", &calc_pbutton_cb,
-	    (void *) "6", &calc.btn_6);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 3, 1, "*", &calc_pbutton_cb,
-	    (void *) "*", &calc.btn_mul);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 0, 2, "1", &calc_pbutton_cb,
-	    (void *) "1", &calc.btn_1);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 1, 2, "2", &calc_pbutton_cb,
-	    (void *) "2", &calc.btn_2);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 2, 2, "3", &calc_pbutton_cb,
-	    (void *) "3", &calc.btn_3);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 3, 2, "-", &calc_pbutton_cb,
-	    (void *) "-", &calc.btn_sub);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 0, 3, "0", &calc_pbutton_cb,
-	    (void *) "0", &calc.btn_0);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 1, 3, "C", &calc_clear_cb,
-	    (void *) "C", &calc.btn_clear);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 2, 3, "=", &calc_eval_cb,
-	    (void *) "=", &calc.btn_eval);
-	if (rc != EOK)
-		return rc;
-
-	rc = calc_button_create(&calc, fixed, 3, 3, "+", &calc_pbutton_cb,
-	    (void *) "+", &calc.btn_add);
-	if (rc != EOK)
-		return rc;
-
-	ui_pbutton_set_default(calc.btn_eval, true);
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return 0;
-}
Index: pace/app/calculator/doc/doxygroups.h
===================================================================
--- uspace/app/calculator/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup calculator calculator
- * @brief Calculator
- * @ingroup apps
- */
Index: pace/app/calculator/meson.build
===================================================================
--- uspace/app/calculator/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files('calculator.c')
Index: pace/app/clock_widget/clock_widget.c
===================================================================
--- uspace/app/clock_widget/clock_widget.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup clock_widget
- * @{
- */
-/** @file Clock widget application (in UI)
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <str.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/entry.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <device/clock_dev.h>
-#include <loc.h>
-#include <time.h>
-#include "clock_widget.h"
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (clock_widget)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	clock_widget_t *clock_widget = (clock_widget_t *) arg;
-	ui_quit(clock_widget->ui);
-}
-
-/** Run Clock Widget on display server. */
-static errno_t clock_widget(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	clock_widget_t clock_widget;
-	errno_t rc;
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return rc;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Clock Widget";
-	params.placement = ui_wnd_place_center;
-
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 45;
-		params.rect.p1.y = 15;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 350;
-		params.rect.p1.y = 275;
-	}
-
-	memset((void *) &clock_widget, 0, sizeof(clock_widget));
-	clock_widget.ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &clock_widget);
-	clock_widget.window = window;
-
-	rc = ui_fixed_create(&clock_widget.fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: clock_widget [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = clock_widget(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/clock_widget/clock_widget.h
===================================================================
--- uspace/app/clock_widget/clock_widget.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup clock_widget
- * @{
- */
-/**
- * @file Clock widget application (in UI)
- */
-
-#ifndef CLOCK_WIDGET_H
-#define CLOCK_WIDGET_H
-
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <ui/entry.h>
-
-/** Clock widget UI application */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_label_t *date_label;
-	ui_label_t *time_label;
-	ui_entry_t *date_entry;
-	ui_entry_t *time_entry;
-	ui_pbutton_t *ok_button;
-	ui_pbutton_t *set_button;
-	struct tm current_time;
-} clock_widget_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/clock_widget/doc/doxygroups.h
===================================================================
--- uspace/app/clock_widget/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup clock_widget clock_widget
- * @brief Clock widget application (in UI)
- * @ingroup apps
- */
Index: pace/app/clock_widget/meson.build
===================================================================
--- uspace/app/clock_widget/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files('clock_widget.c')
Index: pace/app/corecfg/corecfg.c
===================================================================
--- uspace/app/corecfg/corecfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup corecfg
- * @{
- */
-/** @file Core file configuration utility.
- */
-
-#include <corecfg.h>
-#include <errno.h>
-#include <stdio.h>
-#include <str.h>
-
-#define NAME "corecfg"
-
-static void print_syntax(void)
-{
-	printf("Syntax:\n");
-	printf("\t%s [get]\n", NAME);
-	printf("\t%s enable\n", NAME);
-	printf("\t%s disable\n", NAME);
-}
-
-static int corecfg_print(void)
-{
-	bool enable;
-	errno_t rc;
-
-	rc = corecfg_get_enable(&enable);
-	if (rc != EOK) {
-		printf("Failed getting core file setting.\n");
-		return 1;
-	}
-
-	printf("Core files: %s.\n", enable ? "enabled" : "disabled");
-
-	return 0;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	rc = corecfg_init();
-	if (rc != EOK) {
-		printf("Failed contacting corecfg service.\n");
-		return 1;
-	}
-
-	if ((argc < 2) || (str_cmp(argv[1], "get") == 0))
-		return corecfg_print();
-	else if (str_cmp(argv[1], "enable") == 0)
-		return corecfg_set_enable(true);
-	else if (str_cmp(argv[1], "disable") == 0)
-		return corecfg_set_enable(false);
-	else {
-		printf("%s: Unknown command '%s'.\n", NAME, argv[1]);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/corecfg/doc/doxygroups.h
===================================================================
--- uspace/app/corecfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup corecfg corecfg
- * @brief Core file configuration utility
- * @ingroup apps
- */
Index: pace/app/corecfg/meson.build
===================================================================
--- uspace/app/corecfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'corecfg' ]
-src = files('corecfg.c')
Index: pace/app/cpptest/main.cpp
===================================================================
--- uspace/app/cpptest/main.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-
-/* using namespace std::chrono_literals; */
-
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cinttypes>
-#include <climits>
-#include <csetjmp>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <cwchar>
-
-#include <algorithm>
-#include <array>
-#include <chrono>
-#include <condition_variable>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <initializer_list>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <memory>
-#include <mutex>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <ratio>
-#include <sstream>
-#include <stack>
-#include <streambuf>
-#include <string>
-#include <system_error>
-#include <thread>
-#include <tuple>
-#include <type_traits>
-#include <typeindex>
-#include <typeinfo>
-#include <utility>
-#include <vector>
-#include <unordered_map>
-#include <unordered_set>
-#include <queue>
-#include <set>
-#include <map>
-#include <bitset>
-#include <random>
-#include <iomanip>
-#include <system_error>
-#include <stdexcept>
-#include <complex>
-#include <future>
-#include <shared_mutex>
-
-#include <__bits/adt/hash_table.hpp>
-#include <__bits/adt/rbtree.hpp>
-#include <__bits/builtins.hpp>
-
-#include <__bits/trycatch.hpp>
-
-int main()
-{
-    std::test::test_set ts{};
-    ts.add<std::test::vector_test>();
-    ts.add<std::test::string_test>();
-    ts.add<std::test::array_test>();
-    ts.add<std::test::bitset_test>();
-    ts.add<std::test::deque_test>();
-    ts.add<std::test::tuple_test>();
-    ts.add<std::test::map_test>();
-    ts.add<std::test::set_test>();
-    ts.add<std::test::unordered_map_test>();
-    ts.add<std::test::unordered_set_test>();
-    ts.add<std::test::numeric_test>();
-    ts.add<std::test::adaptors_test>();
-    ts.add<std::test::memory_test>();
-    ts.add<std::test::list_test>();
-    ts.add<std::test::ratio_test>();
-    ts.add<std::test::functional_test>();
-    ts.add<std::test::algorithm_test>();
-    ts.add<std::test::future_test>();
-
-    return ts.run(true) ? 0 : 1;
-}
Index: pace/app/cpptest/meson.build
===================================================================
--- uspace/app/cpptest/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2018 Jaroslav Jindrak
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-language = 'cpp'
-src = files('main.cpp')
Index: pace/app/date/date.c
===================================================================
--- uspace/app/date/date.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,356 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <device/clock_dev.h>
-#include <errno.h>
-#include <loc.h>
-#include <time.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <ctype.h>
-#include <str.h>
-
-#define NAME   "date"
-
-static errno_t read_date_from_arg(char *wdate, struct tm *t);
-static errno_t read_time_from_arg(char *wdate, struct tm *t);
-static errno_t tm_sanity_check(struct tm *t);
-static bool is_leap_year(int year);
-
-static void usage(void);
-
-static int days_month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
-int
-main(int argc, char **argv)
-{
-	errno_t rc;
-	int c;
-	category_id_t cat_id;
-	size_t        svc_cnt;
-	service_id_t  *svc_ids = NULL;
-	service_id_t  svc_id;
-	char          *svc_name = NULL;
-	bool          read_only = true;
-	char          *wdate = NULL;
-	char          *wtime = NULL;
-	struct tm     t;
-	int           n_args = argc;
-
-	while ((c = getopt(argc, argv, "hd:t:")) != -1) {
-		switch (c) {
-		case 'h':
-			usage();
-			return 0;
-		case 'd':
-			if (wdate) {
-				usage();
-				return 1;
-			}
-			wdate = (char *)optarg;
-			read_only = false;
-			n_args -= 2;
-			break;
-		case 't':
-			if (wtime) {
-				usage();
-				return 1;
-			}
-			wtime = (char *)optarg;
-			read_only = false;
-			n_args -= 2;
-			break;
-		case '?':
-			usage();
-			return 1;
-		}
-	}
-
-	if (n_args != 1) {
-		printf(NAME ": Unrecognized parameter\n");
-		usage();
-		return 1;
-	}
-
-	/* Get the id of the clock category */
-	rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf(NAME ": Cannot get clock category id\n");
-		goto exit;
-	}
-
-	/* Get the list of available services in the clock category */
-	rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
-	if (rc != EOK) {
-		printf(NAME ": Cannot get the list of services in the clock "
-		    "category\n");
-		goto exit;
-	}
-
-	/* Check if there are available services in the clock category */
-	if (svc_cnt == 0) {
-		printf(NAME ": No available service found in "
-		    "the clock category\n");
-		goto exit;
-	}
-
-	/* Get the name of the clock service */
-	rc = loc_service_get_name(svc_ids[0], &svc_name);
-	if (rc != EOK) {
-		printf(NAME ": Cannot get the name of the service\n");
-		goto exit;
-	}
-
-	/* Get the service id for the device */
-	rc = loc_service_get_id(svc_name, &svc_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Cannot get the service id for device %s",
-		    svc_name);
-		goto exit;
-	}
-
-	/* Connect to the device */
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 0);
-	if (!sess) {
-		printf(NAME ": Cannot connect to the device\n");
-		goto exit;
-	}
-
-	/* Read the current date/time */
-	rc = clock_dev_time_get(sess, &t);
-	if (rc != EOK) {
-		printf(NAME ": Cannot read the current time\n");
-		goto exit;
-	}
-
-	if (read_only) {
-		/* Print the current time and exit */
-		printf("%02d/%02d/%d ", t.tm_mday,
-		    t.tm_mon + 1, 1900 + t.tm_year);
-		printf("%02d:%02d:%02d\n", t.tm_hour, t.tm_min, t.tm_sec);
-	} else {
-		if (wdate) {
-			rc = read_date_from_arg(wdate, &t);
-			if (rc != EOK) {
-				printf(NAME ": error, date format not "
-				    "recognized\n");
-				usage();
-				goto exit;
-			}
-		}
-		if (wtime) {
-			rc = read_time_from_arg(wtime, &t);
-			if (rc != EOK) {
-				printf(NAME ": error, time format not "
-				    "recognized\n");
-				usage();
-				goto exit;
-			}
-		}
-
-		rc = tm_sanity_check(&t);
-		if (rc != EOK) {
-			printf(NAME ": error, invalid date/time\n");
-			goto exit;
-		}
-
-		rc = clock_dev_time_set(sess, &t);
-		if (rc != EOK) {
-			printf(NAME ": error, Unable to set date/time\n");
-			goto exit;
-		}
-	}
-
-exit:
-	free(svc_name);
-	free(svc_ids);
-	return rc;
-}
-
-/** Read the day, month and year from a string
- *  with the following format: DD/MM/YYYY or MM/DD/YYYY
- */
-static errno_t
-read_date_from_arg(char *wdate, struct tm *t)
-{
-	errno_t rc;
-	uint32_t tmp;
-	uint32_t first_num;
-	uint32_t second_num;
-
-	if (str_size(wdate) != 10) /* str_size("DD/MM/YYYY") == 10 */
-		return EINVAL;
-
-	if (wdate[2] != '/' ||
-	    wdate[5] != '/') {
-		return EINVAL;
-	}
-
-	/* Parse first number */
-	rc = str_uint32_t(&wdate[0], NULL, 10, false, &first_num);
-	if (rc != EOK)
-		return rc;
-
-	/* Parse second number */
-	rc = str_uint32_t(&wdate[3], NULL, 10, false, &second_num);
-	if (rc != EOK)
-		return rc;
-
-	/* Determine format based on first number */
-	if (first_num > 12) {
-		/* First number is day (DD/MM/YYYY format) */
-		t->tm_mday = first_num;
-		t->tm_mon = second_num - 1;
-	} else if (second_num > 12) {
-		/* Second number is day (MM/DD/YYYY format) */
-		t->tm_mon = first_num - 1;
-		t->tm_mday = second_num;
-	} else {
-		/* Ambiguous case - assume DD/MM/YYYY format */
-		t->tm_mday = first_num;
-		t->tm_mon = second_num - 1;
-	}
-
-	rc = str_uint32_t(&wdate[6], NULL, 10, false, &tmp);
-	if (rc != EOK)
-		return rc;
-
-	t->tm_year = tmp - 1900;
-
-	return EOK;
-}
-
-/** Read the hours, minutes and seconds from a string
- *  with the following format: HH:MM:SS or HH:MM
- */
-static errno_t
-read_time_from_arg(char *wtime, struct tm *t)
-{
-	errno_t rc;
-	size_t len = str_size(wtime);
-	bool sec_present = len == 8;
-	uint32_t tmp;
-
-	/* str_size("HH:MM") == 5 */
-	/* str_size("HH:MM:SS") == 8 */
-	if (len != 8 && len != 5)
-		return EINVAL;
-
-	if (sec_present && wtime[5] != ':')
-		return EINVAL;
-
-	if (wtime[2] != ':')
-		return EINVAL;
-
-	rc = str_uint32_t(&wtime[0], NULL, 10, false, &tmp);
-	if (rc != EOK)
-		return rc;
-
-	t->tm_hour = tmp;
-
-	rc = str_uint32_t(&wtime[3], NULL, 10, false, &tmp);
-	if (rc != EOK)
-		return rc;
-
-	t->tm_min = tmp;
-
-	if (sec_present) {
-		rc = str_uint32_t(&wtime[6], NULL, 10, false, &tmp);
-		t->tm_sec = tmp;
-	} else
-		t->tm_sec = 0;
-
-	return rc;
-}
-
-/** Check if the tm structure contains valid values
- *
- * @param t     The tm structure to check
- *
- * @return      EOK on success or EINVAL
- */
-static errno_t
-tm_sanity_check(struct tm *t)
-{
-	int ndays;
-
-	if (t->tm_sec < 0 || t->tm_sec > 59)
-		return EINVAL;
-	else if (t->tm_min < 0 || t->tm_min > 59)
-		return EINVAL;
-	else if (t->tm_hour < 0 || t->tm_hour > 23)
-		return EINVAL;
-	else if (t->tm_mday < 1 || t->tm_mday > 31)
-		return EINVAL;
-	else if (t->tm_mon < 0 || t->tm_mon > 11)
-		return EINVAL;
-	else if (t->tm_year < 0 || t->tm_year > 199)
-		return EINVAL;
-
-	if (t->tm_mon == 1/* FEB */ && is_leap_year(t->tm_year))
-		ndays = 29;
-	else
-		ndays = days_month[t->tm_mon];
-
-	if (t->tm_mday > ndays)
-		return EINVAL;
-
-	return EOK;
-}
-
-/** Check if a year is a leap year
- *
- * @param year   The year to check
- *
- * @return       true if it is a leap year, false otherwise
- */
-static bool
-is_leap_year(int year)
-{
-	bool r = false;
-
-	if (year % 4 == 0) {
-		if (year % 100 == 0)
-			r = year % 400 == 0;
-		else
-			r = true;
-	}
-
-	return r;
-}
-
-static void
-usage(void)
-{
-	printf("Usage: date [-d DD/MM/YYYY|MM/DD/YYYY] [-t HH:MM[:SS]]\n");
-	printf("       -d   Change the current date (supports both DD/MM/YYYY and MM/DD/YYYY formats)\n");
-	printf("       -t   Change the current time\n");
-	printf("       -h   Display this information\n");
-}
Index: pace/app/date/meson.build
===================================================================
--- uspace/app/date/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2012 Maurizio Lombardi
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('date.c')
Index: pace/app/date_cfg/date_cfg.c
===================================================================
--- uspace/app/date_cfg/date_cfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup date_cfg
- * @{
- */
-/** @file Date configuration application (in UI)
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <str.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/entry.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <device/clock_dev.h>
-#include <loc.h>
-#include <time.h>
-#include "date_cfg.h"
-
-static void wnd_close(ui_window_t *, void *);
-static void ok_clicked(ui_pbutton_t *, void *);
-static void set_clicked(ui_pbutton_t *, void *);
-static errno_t get_current_time(struct tm *);
-static errno_t set_system_time(struct tm *);
-static void update_time_display(date_cfg_t *);
-static errno_t parse_date_time(date_cfg_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-static ui_pbutton_cb_t button_cb = {
-	.clicked = ok_clicked
-};
-
-static ui_pbutton_cb_t set_button_cb = {
-	.clicked = set_clicked
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (date_cfg)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	date_cfg_t *date_cfg = (date_cfg_t *) arg;
-	ui_quit(date_cfg->ui);
-}
-
-/** OK button was clicked.
- *
- * @param button Button that was clicked
- * @param arg Argument (date_cfg)
- */
-static void ok_clicked(ui_pbutton_t *button, void *arg)
-{
-	date_cfg_t *date_cfg = (date_cfg_t *) arg;
-	ui_quit(date_cfg->ui);
-}
-
-/** Set button was clicked.
- *
- * @param button Button that was clicked
- * @param arg Argument (date_cfg)
- */
-static void set_clicked(ui_pbutton_t *button, void *arg)
-{
-	date_cfg_t *date_cfg = (date_cfg_t *) arg;
-	errno_t rc;
-
-	rc = parse_date_time(date_cfg);
-	if (rc != EOK) {
-		printf("Error parsing date/time. Please use format DD/MM/YYYY and HH:MM:SS\n");
-		return;
-	}
-
-	rc = set_system_time(&date_cfg->current_time);
-	if (rc != EOK) {
-		printf("Error setting system time.\n");
-		return;
-	}
-
-	update_time_display(date_cfg);
-}
-
-/** Get current system time.
- *
- * @param t Pointer to tm structure to store time
- * @return EOK on success, error code otherwise
- */
-static errno_t get_current_time(struct tm *t)
-{
-	category_id_t cat_id;
-	service_id_t *svc_ids = NULL;
-	size_t svc_cnt;
-	service_id_t svc_id;
-	char *svc_name = NULL;
-	errno_t rc;
-
-	rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return rc;
-
-	rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
-	if (rc != EOK)
-		return rc;
-
-	if (svc_cnt == 0) {
-		free(svc_ids);
-		return ENOENT;
-	}
-
-	rc = loc_service_get_name(svc_ids[0], &svc_name);
-	if (rc != EOK) {
-		free(svc_ids);
-		return rc;
-	}
-
-	rc = loc_service_get_id(svc_name, &svc_id, 0);
-	if (rc != EOK) {
-		free(svc_name);
-		free(svc_ids);
-		return rc;
-	}
-
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 0);
-	if (!sess) {
-		free(svc_name);
-		free(svc_ids);
-		return EIO;
-	}
-
-	rc = clock_dev_time_get(sess, t);
-
-	free(svc_name);
-	free(svc_ids);
-	return rc;
-}
-
-/** Set system time.
- *
- * @param t Pointer to tm structure containing new time
- * @return EOK on success, error code otherwise
- */
-static errno_t set_system_time(struct tm *t)
-{
-	category_id_t cat_id;
-	service_id_t *svc_ids = NULL;
-	size_t svc_cnt;
-	service_id_t svc_id;
-	char *svc_name = NULL;
-	errno_t rc;
-
-	rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return rc;
-
-	rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
-	if (rc != EOK)
-		return rc;
-
-	if (svc_cnt == 0) {
-		free(svc_ids);
-		return ENOENT;
-	}
-
-	rc = loc_service_get_name(svc_ids[0], &svc_name);
-	if (rc != EOK) {
-		free(svc_ids);
-		return rc;
-	}
-
-	rc = loc_service_get_id(svc_name, &svc_id, 0);
-	if (rc != EOK) {
-		free(svc_name);
-		free(svc_ids);
-		return rc;
-	}
-
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 0);
-	if (!sess) {
-		free(svc_name);
-		free(svc_ids);
-		return EIO;
-	}
-
-	rc = clock_dev_time_set(sess, t);
-
-	free(svc_name);
-	free(svc_ids);
-	return rc;
-}
-
-/** Update time display entry fields.
- *
- * @param date_cfg Date configuration structure
- */
-static void update_time_display(date_cfg_t *date_cfg)
-{
-	char date_str[32];
-	char time_str[32];
-
-	snprintf(date_str, sizeof(date_str), "%02d/%02d/%d",
-	    date_cfg->current_time.tm_mday,
-	    date_cfg->current_time.tm_mon + 1,
-	    1900 + date_cfg->current_time.tm_year);
-
-	snprintf(time_str, sizeof(time_str), "%02d:%02d:%02d",
-	    date_cfg->current_time.tm_hour,
-	    date_cfg->current_time.tm_min,
-	    date_cfg->current_time.tm_sec);
-
-	ui_entry_set_text(date_cfg->date_entry, date_str);
-	ui_entry_set_text(date_cfg->time_entry, time_str);
-}
-
-/** Parse date and time from entry fields.
- *
- * @param date_cfg Date configuration structure
- * @return EOK on success, error code otherwise
- */
-static errno_t parse_date_time(date_cfg_t *date_cfg)
-{
-	const char *date_str = ui_entry_get_text(date_cfg->date_entry);
-	const char *time_str = ui_entry_get_text(date_cfg->time_entry);
-	int first_num, second_num, year;
-	int hour, min, sec;
-
-	if (sscanf(date_str, "%d/%d/%d", &first_num, &second_num, &year) != 3)
-		return EINVAL;
-
-	if (sscanf(time_str, "%d:%d:%d", &hour, &min, &sec) != 3)
-		return EINVAL;
-
-	/* Determine format based on first number */
-	if (first_num > 12) {
-		/* First number is day (DD/MM/YYYY format) */
-		date_cfg->current_time.tm_mday = first_num;
-		date_cfg->current_time.tm_mon = second_num - 1;
-	} else if (second_num > 12) {
-		/* Second number is day (MM/DD/YYYY format) */
-		date_cfg->current_time.tm_mon = first_num - 1;
-		date_cfg->current_time.tm_mday = second_num;
-	} else {
-		/* Ambiguous case - assume DD/MM/YYYY format */
-		date_cfg->current_time.tm_mday = first_num;
-		date_cfg->current_time.tm_mon = second_num - 1;
-	}
-
-	if (date_cfg->current_time.tm_mday < 1 || date_cfg->current_time.tm_mday > 31 || 
-	    date_cfg->current_time.tm_mon < 0 || date_cfg->current_time.tm_mon > 11 || 
-	    year < 1900)
-		return EINVAL;
-
-	if (hour < 0 || hour > 23 || min < 0 || min > 59 || sec < 0 || sec > 59)
-		return EINVAL;
-
-	date_cfg->current_time.tm_year = year - 1900;
-	date_cfg->current_time.tm_hour = hour;
-	date_cfg->current_time.tm_min = min;
-	date_cfg->current_time.tm_sec = sec;
-
-	return EOK;
-}
-
-/** Run Date Configuration on display server. */
-static errno_t date_cfg(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	date_cfg_t date_cfg;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-	errno_t rc;
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return rc;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Date Configuration";
-	params.placement = ui_wnd_place_center;
-
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 45;
-		params.rect.p1.y = 15;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 350;
-		params.rect.p1.y = 275;
-	}
-
-	memset((void *) &date_cfg, 0, sizeof(date_cfg));
-	date_cfg.ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &date_cfg);
-	date_cfg.window = window;
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&date_cfg.fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	/* Create date label */
-	rc = ui_label_create(ui_res, "Date:", &date_cfg.date_label);
-	if (rc != EOK) {
-		printf("Error creating date label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 2;
-		rect.p0.y = 5;
-		rect.p1.x = 7;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 80;
-		rect.p1.x = 100;
-		rect.p1.y = 100;
-	}
-
-	ui_label_set_rect(date_cfg.date_label, &rect);
-	ui_fixed_add(date_cfg.fixed, ui_label_ctl(date_cfg.date_label));
-
-	/* Create date entry */
-	rc = ui_entry_create(window, "", &date_cfg.date_entry);
-	if (rc != EOK) {
-		printf("Error creating date entry.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 8;
-		rect.p0.y = 5;
-		rect.p1.x = 28;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 120;
-		rect.p0.y = 80;
-		rect.p1.x = 250;
-		rect.p1.y = 100;
-	}
-
-	ui_entry_set_rect(date_cfg.date_entry, &rect);
-	ui_fixed_add(date_cfg.fixed, ui_entry_ctl(date_cfg.date_entry));
-
-	/* Create time label */
-	rc = ui_label_create(ui_res, "Time:", &date_cfg.time_label);
-	if (rc != EOK) {
-		printf("Error creating time label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 2;
-		rect.p0.y = 7;
-		rect.p1.x = 7;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 120;
-		rect.p1.x = 100;
-		rect.p1.y = 140;
-	}
-
-	ui_label_set_rect(date_cfg.time_label, &rect);
-	ui_fixed_add(date_cfg.fixed, ui_label_ctl(date_cfg.time_label));
-
-	/* Create time entry */
-	rc = ui_entry_create(window, "", &date_cfg.time_entry);
-	if (rc != EOK) {
-		printf("Error creating time entry.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 8;
-		rect.p0.y = 7;
-		rect.p1.x = 28;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 120;
-		rect.p0.y = 120;
-		rect.p1.x = 250;
-		rect.p1.y = 140;
-	}
-
-	ui_entry_set_rect(date_cfg.time_entry, &rect);
-	ui_fixed_add(date_cfg.fixed, ui_entry_ctl(date_cfg.time_entry));
-
-	/* Create Set button */
-	rc = ui_pbutton_create(ui_res, "Set", &date_cfg.set_button);
-	if (rc != EOK) {
-		printf("Error creating Set button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(date_cfg.set_button, &set_button_cb, (void *) &date_cfg);
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 2;
-		rect.p0.y = 13;
-		rect.p1.x = 13;
-		rect.p1.y = 14;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 235;
-		rect.p1.x = 120;
-		rect.p1.y = rect.p0.y + 28;
-	}
-
-	ui_pbutton_set_rect(date_cfg.set_button, &rect);
-	ui_fixed_add(date_cfg.fixed, ui_pbutton_ctl(date_cfg.set_button));
-
-	/* Create OK button */
-	rc = ui_pbutton_create(ui_res, "OK", &date_cfg.ok_button);
-	if (rc != EOK) {
-		printf("Error creating OK button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(date_cfg.ok_button, &button_cb, (void *) &date_cfg);
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 17;
-		rect.p0.y = 13;
-		rect.p1.x = 28;
-		rect.p1.y = 14;
-	} else {
-		rect.p0.x = 125;
-		rect.p0.y = 235;
-		rect.p1.x = 225;
-		rect.p1.y = rect.p0.y + 28;
-	}
-
-	ui_pbutton_set_rect(date_cfg.ok_button, &rect);
-	ui_pbutton_set_default(date_cfg.ok_button, true);
-
-	ui_fixed_add(date_cfg.fixed, ui_pbutton_ctl(date_cfg.ok_button));
-
-	ui_window_add(window, ui_fixed_ctl(date_cfg.fixed));
-
-	/* Get current time and update display */
-	rc = get_current_time(&date_cfg.current_time);
-	if (rc != EOK) {
-		printf("Error getting current time.\n");
-		return rc;
-	}
-
-	update_time_display(&date_cfg);
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: date_cfg [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = date_cfg(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/date_cfg/date_cfg.h
===================================================================
--- uspace/app/date_cfg/date_cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup date_cfg
- * @{
- */
-/**
- * @file Date configuration application (in UI)
- */
-
-#ifndef DATE_CFG_H
-#define DATE_CFG_H
-
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <ui/entry.h>
-
-/** Date configuration UI application */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_label_t *date_label;
-	ui_label_t *time_label;
-	ui_entry_t *date_entry;
-	ui_entry_t *time_entry;
-	ui_pbutton_t *ok_button;
-	ui_pbutton_t *set_button;
-	struct tm current_time;
-} date_cfg_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/date_cfg/doc/doxygroups.h
===================================================================
--- uspace/app/date_cfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup date_cfg date_cfg
- * @brief Date configuration application (in UI)
- * @ingroup apps
- */
Index: pace/app/date_cfg/meson.build
===================================================================
--- uspace/app/date_cfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files('date_cfg.c')
Index: pace/app/devctl/devctl.c
===================================================================
--- uspace/app/devctl/devctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,489 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devctl
- * @{
- */
-/** @file Control device framework (devman server).
- */
-
-#include <devman.h>
-#include <errno.h>
-#include <io/table.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME "devctl"
-
-#define MAX_NAME_LENGTH 1024
-
-static char name[MAX_NAME_LENGTH];
-static char drv_name[MAX_NAME_LENGTH];
-static bool verbose = false;
-
-static const char *drv_state_str(driver_state_t state)
-{
-	const char *sstate;
-
-	switch (state) {
-	case DRIVER_NOT_STARTED:
-		sstate = "not started";
-		break;
-	case DRIVER_STARTING:
-		sstate = "starting";
-		break;
-	case DRIVER_RUNNING:
-		sstate = "running";
-		break;
-	default:
-		sstate = "unknown";
-	}
-
-	return sstate;
-}
-
-static errno_t fun_subtree_print(devman_handle_t funh, int lvl)
-{
-	devman_handle_t devh;
-	devman_handle_t *cfuns;
-	size_t count, i;
-	unsigned int score;
-	errno_t rc;
-	int j;
-
-	for (j = 0; j < lvl; j++)
-		printf("    ");
-
-	rc = devman_fun_get_name(funh, name, MAX_NAME_LENGTH);
-	if (rc != EOK)
-		return ELIMIT;
-
-	if (name[0] == '\0')
-		str_cpy(name, MAX_NAME_LENGTH, "/");
-
-	rc = devman_fun_get_driver_name(funh, drv_name, MAX_NAME_LENGTH);
-	if (rc != EOK && rc != EINVAL)
-		return ELIMIT;
-
-	if (rc == EINVAL)
-		printf("%s\n", name);
-	else
-		printf("%s : %s\n", name, drv_name);
-
-	if (verbose) {
-		for (i = 0; true; i++) {
-			rc = devman_fun_get_match_id(funh, i, name, MAX_NAME_LENGTH,
-			    &score);
-			if (rc != EOK)
-				break;
-
-			for (j = 0; j < lvl; j++)
-				printf("    ");
-
-			printf("    %u %s\n", score, name);
-		}
-	}
-
-	rc = devman_fun_get_child(funh, &devh);
-	if (rc == ENOENT)
-		return EOK;
-
-	if (rc != EOK) {
-		printf(NAME ": Failed getting child device for function "
-		    "%s.\n", "xxx");
-		return rc;
-	}
-
-	rc = devman_dev_get_functions(devh, &cfuns, &count);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting list of functions for "
-		    "device %s.\n", "xxx");
-		return rc;
-	}
-
-	for (i = 0; i < count; i++)
-		fun_subtree_print(cfuns[i], lvl + 1);
-
-	free(cfuns);
-	return EOK;
-}
-
-static errno_t fun_tree_print(void)
-{
-	devman_handle_t root_fun;
-	errno_t rc;
-
-	rc = devman_fun_get_handle("/", &root_fun, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving root function.\n");
-		return EIO;
-	}
-
-	rc = fun_subtree_print(root_fun, 0);
-	if (rc != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-static errno_t fun_online(const char *path)
-{
-	devman_handle_t funh;
-	errno_t rc;
-
-	rc = devman_fun_get_handle(path, &funh, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device function '%s' (%s)\n",
-		    path, str_error(rc));
-		return rc;
-	}
-
-	rc = devman_fun_online(funh);
-	if (rc != EOK) {
-		printf(NAME ": Failed to online function '%s'.\n", path);
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t fun_offline(const char *path)
-{
-	devman_handle_t funh;
-	errno_t rc;
-
-	rc = devman_fun_get_handle(path, &funh, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device function '%s' (%s)\n",
-		    path, str_error(rc));
-		return rc;
-	}
-
-	rc = devman_fun_offline(funh);
-	if (rc != EOK) {
-		printf(NAME ": Failed to offline function '%s' (%s)\n", path,
-		    str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t fun_quiesce(const char *path)
-{
-	devman_handle_t funh;
-	errno_t rc;
-
-	rc = devman_fun_get_handle(path, &funh, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device function '%s' (%s)\n",
-		    path, str_error(rc));
-		return rc;
-	}
-
-	rc = devman_fun_quiesce(funh);
-	if (rc != EOK) {
-		printf(NAME ": Failed to offline function '%s' (%s)\n", path,
-		    str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t drv_list(void)
-{
-	devman_handle_t *devs;
-	devman_handle_t *drvs;
-	driver_state_t state;
-	const char *sstate;
-	size_t ndrvs;
-	size_t ndevs;
-	size_t i;
-	table_t *table = NULL;
-	errno_t rc;
-
-	rc = devman_get_drivers(&drvs, &ndrvs);
-	if (rc != EOK)
-		return rc;
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Driver\t" "Devs\t" "State\n");
-
-	for (i = 0; i < ndrvs; i++) {
-		devs = NULL;
-
-		rc = devman_driver_get_name(drvs[i], drv_name, MAX_NAME_LENGTH);
-		if (rc != EOK)
-			goto skip;
-		rc = devman_driver_get_state(drvs[i], &state);
-		if (rc != EOK)
-			goto skip;
-		rc = devman_driver_get_devices(drvs[i], &devs, &ndevs);
-		if (rc != EOK)
-			goto skip;
-
-		sstate = drv_state_str(state);
-
-		table_printf(table, "%s\t" "%zu\t" "%s\n", drv_name, ndevs, sstate);
-	skip:
-		free(devs);
-	}
-
-	rc = table_print_out(table, stdout);
-	if (rc != EOK)
-		printf("Error printing driver table.\n");
-out:
-	free(drvs);
-	table_destroy(table);
-
-	return rc;
-}
-
-static errno_t drv_show(char *drvname)
-{
-	devman_handle_t *devs;
-	devman_handle_t drvh;
-	devman_handle_t funh;
-	driver_state_t state;
-	const char *sstate;
-	unsigned int score;
-	size_t ndevs;
-	size_t i;
-	errno_t rc;
-
-	rc = devman_driver_get_handle(drvname, &drvh);
-	if (rc != EOK)
-		return rc;
-
-	devs = NULL;
-
-	rc = devman_driver_get_name(drvh, drv_name, MAX_NAME_LENGTH);
-	if (rc != EOK)
-		return rc;
-
-	rc = devman_driver_get_state(drvh, &state);
-	if (rc != EOK)
-		return rc;
-
-	rc = devman_driver_get_devices(drvh, &devs, &ndevs);
-	if (rc != EOK)
-		return rc;
-
-	sstate = drv_state_str(state);
-
-	printf("Driver: %s\n", drv_name);
-	printf("State: %s\n", sstate);
-
-	printf("Attached devices:\n");
-
-	for (i = 0; i < ndevs; i++) {
-		rc = devman_dev_get_parent(devs[i], &funh);
-		if (rc != EOK)
-			goto error;
-
-		rc = devman_fun_get_path(funh, name, MAX_NAME_LENGTH);
-		if (rc != EOK)
-			goto error;
-		printf("\t%s\n", name);
-	}
-
-	printf("Match IDs:\n");
-
-	for (i = 0; true; i++) {
-		rc = devman_driver_get_match_id(drvh, i, name, MAX_NAME_LENGTH,
-		    &score);
-		if (rc != EOK)
-			break;
-
-		printf("\t%u %s\n", score, name);
-	}
-
-error:
-	free(devs);
-
-	return EOK;
-}
-
-static errno_t drv_load(const char *drvname)
-{
-	errno_t rc;
-	devman_handle_t drvh;
-
-	rc = devman_driver_get_handle(drvname, &drvh);
-	if (rc != EOK) {
-		printf("Failed resolving driver '%s': %s.\n", drvname, str_error(rc));
-		return rc;
-	}
-
-	rc = devman_driver_load(drvh);
-	if (rc != EOK) {
-		printf("Failed loading driver '%s': %s.\n", drvname, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t drv_unload(const char *drvname)
-{
-	errno_t rc;
-	devman_handle_t drvh;
-
-	rc = devman_driver_get_handle(drvname, &drvh);
-	if (rc != EOK) {
-		printf("Failed resolving driver '%s': %s.\n", drvname, str_error(rc));
-		return rc;
-	}
-
-	rc = devman_driver_unload(drvh);
-	if (rc != EOK) {
-		printf("Failed unloading driver '%s': %s.\n", drvname, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("syntax:\n");
-	printf("\tdevctl\n");
-	printf("\tdevctl online <function>]\n");
-	printf("\tdevctl offline <function>]\n");
-	printf("\tdevctl list-drv\n");
-	printf("\tdevctl show-drv <driver-name>\n");
-	printf("\tdevctl load-drv <driver-name>\n");
-	printf("\tdevctl unload-drv <driver-name>\n");
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	if (argc == 1 || argv[1][0] == '-') {
-		if (argc > 1) {
-			if (str_cmp(argv[1], "-v") == 0) {
-				verbose = true;
-			} else {
-				printf(NAME ": Invalid argument '%s'\n", argv[1]);
-				print_syntax();
-				return 1;
-			}
-		}
-		rc = fun_tree_print();
-		if (rc != EOK)
-			return 2;
-	} else if (str_cmp(argv[1], "online") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = fun_online(argv[2]);
-		if (rc != EOK) {
-			return 2;
-		}
-	} else if (str_cmp(argv[1], "offline") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = fun_offline(argv[2]);
-		if (rc != EOK) {
-			return 2;
-		}
-	} else if (str_cmp(argv[1], "quiesce") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = fun_quiesce(argv[2]);
-		if (rc != EOK) {
-			return 2;
-		}
-	} else if (str_cmp(argv[1], "list-drv") == 0) {
-		rc = drv_list();
-		if (rc != EOK)
-			return 2;
-	} else if (str_cmp(argv[1], "show-drv") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = drv_show(argv[2]);
-		if (rc != EOK) {
-			return 2;
-		}
-	} else if (str_cmp(argv[1], "load-drv") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = drv_load(argv[2]);
-		if (rc != EOK)
-			return 2;
-	} else if (str_cmp(argv[1], "unload-drv") == 0) {
-		if (argc < 3) {
-			printf(NAME ": Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		rc = drv_unload(argv[2]);
-		if (rc != EOK)
-			return 2;
-	} else {
-		printf(NAME ": Invalid argument '%s'.\n", argv[1]);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/devctl/doc/doxygroups.h
===================================================================
--- uspace/app/devctl/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup devctl devctl
- * @brief Device manager control utility
- * @ingroup apps
- */
Index: pace/app/devctl/meson.build
===================================================================
--- uspace/app/devctl/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('devctl.c')
Index: pace/app/df/df.c
===================================================================
--- uspace/app/df/df.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- * Copyright (c) 2013 Manuele Conti
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup df
- * @brief Print amounts of free and used disk space.
- * @{
- */
-/**
- * @file
- */
-
-#include <capa.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str_error.h>
-#include <getopt.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <vfs/vfs.h>
-#include <vfs/vfs_mtab.h>
-
-#define NAME  "df"
-
-#define HEADER_TABLE     "Filesystem           Size           Used      Available Used%% Mounted on"
-#define HEADER_TABLE_BLK "Filesystem  Blk. Size     Total        Used   Available Used%% Mounted on"
-
-#define PERCENTAGE(x, tot) (tot ? (100ULL * (x) / (tot)) : 0)
-
-static bool display_blocks;
-
-static errno_t size_to_human_readable(uint64_t, size_t, char **);
-static void print_header(void);
-static errno_t print_statfs(vfs_statfs_t *, char *, char *);
-static void print_usage(void);
-
-int main(int argc, char *argv[])
-{
-	int optres, errflg = 0;
-	vfs_statfs_t st;
-	errno_t rc;
-
-	display_blocks = false;
-
-	/* Parse command-line options */
-	while ((optres = getopt(argc, argv, "ubh")) != -1) {
-		switch (optres) {
-		case 'h':
-			print_usage();
-			return 0;
-
-		case 'b':
-			display_blocks = true;
-			break;
-
-		case '?':
-			fprintf(stderr, "Unrecognized option: -%c\n", optopt);
-			errflg++;
-			break;
-
-		default:
-			fprintf(stderr,
-			    "Unknown error while parsing command line options");
-			errflg++;
-			break;
-		}
-	}
-
-	if (optind > argc) {
-		fprintf(stderr, "Too many input parameters\n");
-		errflg++;
-	}
-
-	if (errflg) {
-		print_usage();
-		return 1;
-	}
-
-	LIST_INITIALIZE(mtab_list);
-	vfs_get_mtab_list(&mtab_list);
-
-	print_header();
-	list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) {
-		if (vfs_statfs_path(mtab_ent->mp, &st) == 0) {
-			rc = print_statfs(&st, mtab_ent->fs_name, mtab_ent->mp);
-			if (rc != EOK)
-				return 1;
-		} else {
-			fprintf(stderr, "Cannot get information for '%s' (%s).\n",
-			    mtab_ent->mp, str_error(errno));
-		}
-	}
-
-	putchar('\n');
-	return 0;
-}
-
-static errno_t size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr)
-{
-	capa_spec_t capa;
-
-	capa_from_blocks(nblocks, block_size, &capa);
-	capa_simplify(&capa);
-	return capa_format(&capa, rptr);
-}
-
-static void print_header(void)
-{
-	if (!display_blocks)
-		printf(HEADER_TABLE);
-	else
-		printf(HEADER_TABLE_BLK);
-
-	putchar('\n');
-}
-
-static errno_t print_statfs(vfs_statfs_t *st, char *name, char *mountpoint)
-{
-	uint64_t const used_blocks = st->f_blocks - st->f_bfree;
-	unsigned const perc_used = PERCENTAGE(used_blocks, st->f_blocks);
-	char *str;
-	errno_t rc;
-
-	printf("%10s", name);
-
-	if (!display_blocks) {
-		/* Print size */
-		rc = size_to_human_readable(st->f_blocks, st->f_bsize, &str);
-		if (rc != EOK)
-			goto error;
-		printf(" %14s", str);
-		free(str);
-
-		/* Number of used blocks */
-		rc = size_to_human_readable(used_blocks, st->f_bsize, &str);
-		if (rc != EOK)
-			goto error;
-		printf(" %14s", str);
-		free(str);
-
-		/* Number of available blocks */
-		rc = size_to_human_readable(st->f_bfree, st->f_bsize, &str);
-		if (rc != EOK)
-			goto error;
-		printf(" %14s", str);
-		free(str);
-
-		/* Percentage of used blocks */
-		printf(" %4u%%", perc_used);
-
-		/* Mount point */
-		printf(" %s\n", mountpoint);
-	} else {
-		/* Block size / Blocks / Used blocks / Available blocks / Used% / Mounted on */
-		printf(" %10" PRIu32 " %9" PRIu64 " %11" PRIu64 " %11" PRIu64 " %4u%% %s\n",
-		    st->f_bsize, st->f_blocks, used_blocks, st->f_bfree,
-		    perc_used, mountpoint);
-	}
-
-	return EOK;
-error:
-	printf("\nError: Out of memory.\n");
-	return ENOMEM;
-}
-
-static void print_usage(void)
-{
-	printf("Syntax: %s [<options>] \n", NAME);
-	printf("Options:\n");
-	printf("  -h Print help\n");
-	printf("  -b Print exact block sizes and numbers\n");
-}
-
-/** @}
- */
Index: pace/app/df/doc/doxygroups.h
===================================================================
--- uspace/app/df/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup df df
- * @brief Print amounts of free and used disk space
- * @ingroup apps
- */
Index: pace/app/df/meson.build
===================================================================
--- uspace/app/df/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2013 Manuele Conti
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('df.c')
Index: pace/app/disp/disp.c
===================================================================
--- uspace/app/disp/disp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,531 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup disp
- * @{
- */
-/** @file Display configuration utility.
- *
- * Configures the display service.
- */
-
-#include <errno.h>
-#include <dispcfg.h>
-#include <io/table.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME  "disp"
-
-static void print_syntax(void)
-{
-	printf("%s: Display configuration utility.\n", NAME);
-	printf("Syntax:\n");
-	printf("  %s list-seat\n", NAME);
-	printf("  %s create-seat <name>\n", NAME);
-	printf("  %s delete-seat <name>\n", NAME);
-	printf("  %s assign-dev <device> <seat>\n", NAME);
-	printf("  %s unassign-dev <device>\n", NAME);
-	printf("  %s list-dev <seat>\n", NAME);
-}
-
-/** Find seat by name.
- *
- * @param dispcfg Display configuration
- * @param name Seat name
- * @param rseat_id Place to store seat ID
- * @return EOK on success or an error code
- */
-static errno_t seat_find_by_name(dispcfg_t *dispcfg, const char *name,
-    sysarg_t *rseat_id)
-{
-	dispcfg_seat_list_t *seat_list;
-	dispcfg_seat_info_t *sinfo;
-
-	size_t i;
-	errno_t rc;
-
-	rc = dispcfg_get_seat_list(dispcfg, &seat_list);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting seat list.\n");
-		return rc;
-	}
-
-	for (i = 0; i < seat_list->nseats; i++) {
-		rc = dispcfg_get_seat_info(dispcfg, seat_list->seats[i],
-		    &sinfo);
-		if (rc != EOK)
-			continue;
-
-		if (str_cmp(sinfo->name, name) == 0) {
-			*rseat_id = seat_list->seats[i];
-			dispcfg_free_seat_info(sinfo);
-			return EOK;
-		}
-
-		dispcfg_free_seat_info(sinfo);
-	}
-
-	return ENOENT;
-}
-
-/** Create seat subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t create_seat(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	char *seat_name;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	if (argc < 1) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	seat_name = argv[0];
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = dispcfg_seat_create(dispcfg, seat_name, &seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed creating seat '%s' (%s)\n",
-		    seat_name, str_error(rc));
-		dispcfg_close(dispcfg);
-		return EIO;
-	}
-
-	(void)seat_id;
-	dispcfg_close(dispcfg);
-	return EOK;
-}
-
-/** Delete seat subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t delete_seat(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	char *seat_name;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	if (argc < 1) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	seat_name = argv[0];
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = seat_find_by_name(dispcfg, seat_name, &seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Seat '%s' not found.\n", seat_name);
-		dispcfg_close(dispcfg);
-		return ENOENT;
-	}
-
-	rc = dispcfg_seat_delete(dispcfg, seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed deleting seat '%s': %s\n", seat_name,
-		    str_error(rc));
-		dispcfg_close(dispcfg);
-		return EIO;
-	}
-
-	dispcfg_close(dispcfg);
-	return EOK;
-}
-
-/** List seats subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t list_seat(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	dispcfg_seat_list_t *seat_list;
-	dispcfg_seat_info_t *sinfo;
-	table_t *table = NULL;
-	size_t i;
-	errno_t rc;
-
-	if (argc > 0) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = dispcfg_get_seat_list(dispcfg, &seat_list);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting seat list.\n");
-		dispcfg_close(dispcfg);
-		return rc;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Memory allocation failed.\n");
-		dispcfg_close(dispcfg);
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Seat Name\n");
-
-	for (i = 0; i < seat_list->nseats; i++) {
-		rc = dispcfg_get_seat_info(dispcfg, seat_list->seats[i],
-		    &sinfo);
-		if (rc != EOK) {
-			printf("Failed getting properties of seat %zu.\n",
-			    (size_t)seat_list->seats[i]);
-			continue;
-		}
-
-		table_printf(table, "%s\n", sinfo->name);
-
-		dispcfg_free_seat_info(sinfo);
-	}
-
-	if (seat_list->nseats != 0) {
-		rc = table_print_out(table, stdout);
-		if (rc != EOK) {
-			printf("Error printing table.\n");
-			goto out;
-		}
-	}
-
-	rc = EOK;
-out:
-	table_destroy(table);
-	dispcfg_close(dispcfg);
-	return rc;
-}
-
-/** Assign device subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t dev_assign(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	char *dev_name;
-	service_id_t svc_id;
-	char *seat_name;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	if (argc < 2) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 2) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	dev_name = argv[0];
-	seat_name = argv[1];
-
-	rc = loc_service_get_id(dev_name, &svc_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Device service '%s' not found.\n",
-		    dev_name);
-		return ENOENT;
-	}
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = seat_find_by_name(dispcfg, seat_name, &seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Seat '%s' not found.\n", seat_name);
-		dispcfg_close(dispcfg);
-		return ENOENT;
-	}
-
-	rc = dispcfg_dev_assign(dispcfg, svc_id, seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed assigning device '%s' to seat '%s': "
-		    "%s\n", dev_name, seat_name, str_error(rc));
-		dispcfg_close(dispcfg);
-		return EIO;
-	}
-
-	dispcfg_close(dispcfg);
-	return EOK;
-}
-
-/** Unassign device subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t dev_unassign(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	char *dev_name;
-	service_id_t svc_id;
-	errno_t rc;
-
-	if (argc < 1) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	dev_name = argv[0];
-
-	rc = loc_service_get_id(dev_name, &svc_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Device service '%s' not found.\n",
-		    dev_name);
-		return ENOENT;
-	}
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = dispcfg_dev_unassign(dispcfg, svc_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed unassigning device '%s': %s\n",
-		    dev_name, str_error(rc));
-		dispcfg_close(dispcfg);
-		return EIO;
-	}
-
-	dispcfg_close(dispcfg);
-	return EOK;
-}
-
-/** List dev subcommand.
- *
- * @param dcfg_svc Display configuration service name
- * @param argc Number of arguments
- * @param argv Arguments
- * @return EOK on success or an erro code
- */
-static errno_t list_dev(const char *dcfg_svc, int argc, char *argv[])
-{
-	dispcfg_t *dispcfg;
-	char *seat_name;
-	sysarg_t seat_id;
-	dispcfg_dev_list_t *dev_list;
-	size_t i;
-	char *svc_name;
-	table_t *table = NULL;
-	errno_t rc;
-
-	if (argc < 1) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	seat_name = argv[0];
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dispcfg);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to display configuration "
-		    "service: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = seat_find_by_name(dispcfg, seat_name, &seat_id);
-	if (rc != EOK) {
-		printf(NAME ": Seat '%s' not found.\n", seat_name);
-		dispcfg_close(dispcfg);
-		return ENOENT;
-	}
-
-	rc = dispcfg_get_asgn_dev_list(dispcfg, seat_id, &dev_list);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting seat list.\n");
-		dispcfg_close(dispcfg);
-		return rc;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Memory allocation failed.\n");
-		dispcfg_free_dev_list(dev_list);
-		dispcfg_close(dispcfg);
-		return rc;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Device Name\n");
-
-	for (i = 0; i < dev_list->ndevs; i++) {
-		rc = loc_service_get_name(dev_list->devs[i], &svc_name);
-		if (rc != EOK) {
-			printf("Failed getting name of service %zu\n",
-			    (size_t)dev_list->devs[i]);
-			continue;
-		}
-
-		table_printf(table, "%s\n", svc_name);
-		free(svc_name);
-	}
-
-	if (dev_list->ndevs != 0) {
-		rc = table_print_out(table, stdout);
-		if (rc != EOK) {
-			printf("Error printing table.\n");
-			table_destroy(table);
-			dispcfg_free_dev_list(dev_list);
-			dispcfg_close(dispcfg);
-			return rc;
-		}
-	}
-
-	dispcfg_close(dispcfg);
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	const char *dispcfg_svc = DISPCFG_DEFAULT;
-	errno_t rc;
-
-	if (argc < 2 || str_cmp(argv[1], "-h") == 0) {
-		print_syntax();
-		return 0;
-	}
-
-	if (str_cmp(argv[1], "list-seat") == 0) {
-		rc = list_seat(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "create-seat") == 0) {
-		rc = create_seat(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "delete-seat") == 0) {
-		rc = delete_seat(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "assign-dev") == 0) {
-		rc = dev_assign(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "unassign-dev") == 0) {
-		rc = dev_unassign(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "list-dev") == 0) {
-		rc = list_dev(dispcfg_svc, argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else {
-		printf(NAME ": Unknown command '%s'.\n", argv[1]);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/disp/doc/doxygroups.h
===================================================================
--- uspace/app/disp/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup disp disp
- * @brief Display configuration utility
- * @ingroup apps
- */
Index: pace/app/disp/meson.build
===================================================================
--- uspace/app/disp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'dispcfg' ]
-src = files('disp.c')
Index: pace/app/display-cfg/display-cfg.c
===================================================================
--- uspace/app/display-cfg/display-cfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,218 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/** @file Display configuration utility (UI)
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/resource.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "display-cfg.h"
-#include "seats.h"
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (dcfg)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	display_cfg_t *dcfg = (display_cfg_t *) arg;
-
-	ui_quit(dcfg->ui);
-}
-
-/** Create display configuration dialog.
- *
- * @param display_spec Display specification
- * @param dcfg_svc Display configuration service name or DISPCFG_DEFAULT
- * @param rdcfg Place to store pointer to new display configuration
- * @return EOK on success or an error code
- */
-errno_t display_cfg_create(const char *display_spec, display_cfg_t **rdcfg)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	display_cfg_t *dcfg = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-	errno_t rc;
-
-	dcfg = calloc(1, sizeof(display_cfg_t));
-	if (dcfg == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Display Configuration";
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 70;
-		params.rect.p1.y = 23;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 470;
-		params.rect.p1.y = 350;
-	}
-
-	dcfg->ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *)dcfg);
-	dcfg->window = window;
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&dcfg->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_tab_set_create(ui_res, &dcfg->tabset);
-	if (rc != EOK) {
-		printf("Error creating tab set.\n");
-		return rc;
-	}
-
-	ui_window_get_app_rect(window, &rect);
-	ui_tab_set_set_rect(dcfg->tabset, &rect);
-
-	rc = ui_fixed_add(dcfg->fixed, ui_tab_set_ctl(dcfg->tabset));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = dcfg_seats_create(dcfg, &dcfg->seats);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_add(window, ui_fixed_ctl(dcfg->fixed));
-
-	*rdcfg = dcfg;
-	return EOK;
-error:
-	if (dcfg->seats != NULL)
-		dcfg_seats_destroy(dcfg->seats);
-	if (dcfg->tabset != NULL)
-		ui_tab_set_destroy(dcfg->tabset);
-	if (dcfg->fixed != NULL)
-		ui_fixed_destroy(dcfg->fixed);
-	if (dcfg->ui != NULL)
-		ui_destroy(ui);
-	free(dcfg);
-	return rc;
-}
-
-/** Open display configuration service.
- *
- * @param dcfg Display configuration dialog
- * @param dcfg_svc Display configuration service name or DISPCFG_DEFAULT
- * @return EOK on success or an error code
- */
-errno_t display_cfg_open(display_cfg_t *dcfg, const char *dcfg_svc)
-{
-	errno_t rc;
-
-	rc = dispcfg_open(dcfg_svc, NULL, NULL, &dcfg->dispcfg);
-	if (rc != EOK) {
-		printf("Error opening display configuration service.\n");
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Populate display configuration from isplay configuration service.
- *
- * @param dcfg Display configuration dialog
- * @return EOK on success or an error code
- */
-errno_t display_cfg_populate(display_cfg_t *dcfg)
-{
-	errno_t rc;
-
-	rc = dcfg_seats_populate(dcfg->seats);
-	if (rc != EOK)
-		return rc;
-
-	rc = ui_window_paint(dcfg->window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Destroy display configuration dialog.
- *
- * @param dcfg Display configuration dialog
- */
-void display_cfg_destroy(display_cfg_t *dcfg)
-{
-	if (dcfg->dispcfg != NULL)
-		dispcfg_close(dcfg->dispcfg);
-	ui_window_destroy(dcfg->window);
-	ui_destroy(dcfg->ui);
-}
-
-/** @}
- */
Index: pace/app/display-cfg/display-cfg.h
===================================================================
--- uspace/app/display-cfg/display-cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/**
- * @file Display configuration utility (in UI)
- */
-
-#ifndef DISPLAY_CFG_H
-#define DISPLAY_CFG_H
-
-#include "types/display-cfg.h"
-
-extern errno_t display_cfg_create(const char *, display_cfg_t **);
-extern errno_t display_cfg_open(display_cfg_t *, const char *);
-extern errno_t display_cfg_populate(display_cfg_t *);
-extern void display_cfg_destroy(display_cfg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/display-cfg/doc/doxygroups.h
===================================================================
--- uspace/app/display-cfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup display-cfg display-cfg
- * @brief Display configuration utility (UI)
- * @ingroup apps
- */
Index: pace/app/display-cfg/main.c
===================================================================
--- uspace/app/display-cfg/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/** @file Display configuration utility (UI) main
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <ui/ui.h>
-#include "display-cfg.h"
-
-static void print_syntax(void)
-{
-	printf("Syntax: display-cfg [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	display_cfg_t *dcfg;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = display_cfg_create(display_spec, &dcfg);
-	if (rc != EOK)
-		return 1;
-
-	rc = display_cfg_open(dcfg, DISPCFG_DEFAULT);
-	if (rc != EOK) {
-		display_cfg_destroy(dcfg);
-		printf("Error opening display configuration service '%s'.\n",
-		    DISPCFG_DEFAULT);
-		return 1;
-	}
-
-	rc = display_cfg_populate(dcfg);
-	if (rc != EOK) {
-		display_cfg_destroy(dcfg);
-		printf("Error reading display configuration.\n");
-		return 1;
-	}
-
-	ui_run(dcfg->ui);
-	display_cfg_destroy(dcfg);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/display-cfg/meson.build
===================================================================
--- uspace/app/display-cfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'dispcfg', 'ui' ]
-src = files(
-	'display-cfg.c',
-	'main.c',
-	'seats.c'
-)
-
-test_src = files(
-	'display-cfg.c',
-	'seats.c',
-	'test/display-cfg.c',
-	'test/main.c',
-	'test/seats.c'
-)
Index: pace/app/display-cfg/seats.c
===================================================================
--- uspace/app/display-cfg/seats.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1126 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/** @file Seat configuration tab
- */
-
-#include <gfx/coord.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/pbutton.h>
-#include <ui/promptdialog.h>
-#include <ui/resource.h>
-#include <ui/selectdialog.h>
-#include <ui/tab.h>
-#include <ui/window.h>
-#include "display-cfg.h"
-#include "seats.h"
-
-static errno_t dcfg_seats_asgn_dev_list_populate(dcfg_seats_t *);
-static errno_t dcfg_seats_avail_dev_list_populate(dcfg_seats_t *,
-    ui_select_dialog_t *);
-static dcfg_seats_entry_t *dcfg_seats_get_selected(dcfg_seats_t *);
-static void dcfg_seats_list_selected(ui_list_entry_t *, void *);
-static void dcfg_add_seat_clicked(ui_pbutton_t *, void *);
-static void dcfg_remove_seat_clicked(ui_pbutton_t *, void *);
-static void dcfg_add_device_clicked(ui_pbutton_t *, void *);
-static void dcfg_remove_device_clicked(ui_pbutton_t *, void *);
-
-/** Seat list callbacks */
-ui_list_cb_t dcfg_seats_list_cb = {
-	.selected = dcfg_seats_list_selected
-};
-
-/** Add seat button callbacks */
-ui_pbutton_cb_t dcfg_add_seat_button_cb = {
-	.clicked = dcfg_add_seat_clicked
-};
-
-/** Remove seat button callbacks */
-ui_pbutton_cb_t dcfg_remove_seat_button_cb = {
-	.clicked = dcfg_remove_seat_clicked
-};
-
-/** Add device button callbacks */
-ui_pbutton_cb_t dcfg_add_device_button_cb = {
-	.clicked = dcfg_add_device_clicked
-};
-
-/** Remove device button callbacks */
-ui_pbutton_cb_t dcfg_remove_device_button_cb = {
-	.clicked = dcfg_remove_device_clicked
-};
-
-static void add_seat_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void add_seat_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void add_seat_dialog_close(ui_prompt_dialog_t *, void *);
-
-/** Add seat dialog callbacks */
-ui_prompt_dialog_cb_t add_seat_dialog_cb = {
-	.bok = add_seat_dialog_bok,
-	.bcancel = add_seat_dialog_bcancel,
-	.close = add_seat_dialog_close
-};
-
-static void add_device_dialog_bok(ui_select_dialog_t *, void *, void *);
-static void add_device_dialog_bcancel(ui_select_dialog_t *, void *);
-static void add_device_dialog_close(ui_select_dialog_t *, void *);
-
-/** Add device dialog callbacks */
-ui_select_dialog_cb_t add_device_dialog_cb = {
-	.bok = add_device_dialog_bok,
-	.bcancel = add_device_dialog_bcancel,
-	.close = add_device_dialog_close
-};
-
-/** Create seat configuration tab
- *
- * @param dcfg Display configuration dialog
- * @param rseats Place to store pointer to new seat configuration tab
- * @return EOK on success or an error code
- */
-errno_t dcfg_seats_create(display_cfg_t *dcfg, dcfg_seats_t **rseats)
-{
-	ui_resource_t *ui_res;
-	dcfg_seats_t *seats;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	ui_res = ui_window_get_res(dcfg->window);
-
-	seats = calloc(1, sizeof(dcfg_seats_t));
-	if (dcfg == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	seats->dcfg = dcfg;
-
-	/* 'Seats' tab */
-
-	rc = ui_tab_create(dcfg->tabset, "Seats", &seats->tab);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_fixed_create(&seats->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	/* 'Configured seats:' label */
-
-	rc = ui_label_create(ui_res, "Configured seats:", &seats->seats_label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 4;
-		rect.p1.x = 36;
-		rect.p1.y = 5;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 60;
-		rect.p1.x = 360;
-		rect.p1.y = 80;
-	}
-
-	ui_label_set_rect(seats->seats_label, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_label_ctl(seats->seats_label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* List of seats */
-
-	rc = ui_list_create(dcfg->window, false, &seats->seat_list);
-	if (rc != EOK) {
-		printf("Error creating list.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 56;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 80;
-		rect.p1.x = 360;
-		rect.p1.y = 180;
-	}
-
-	ui_list_set_rect(seats->seat_list, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_list_ctl(seats->seat_list));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_list_set_cb(seats->seat_list, &dcfg_seats_list_cb, (void *)seats);
-
-	/* 'Add...' seat button */
-
-	rc = ui_pbutton_create(ui_res, "Add...", &seats->add_seat);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 5;
-		rect.p1.x = 68;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 80;
-		rect.p1.x = 450;
-		rect.p1.y = 105;
-	}
-
-	ui_pbutton_set_rect(seats->add_seat, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_pbutton_ctl(seats->add_seat));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(seats->add_seat, &dcfg_add_seat_button_cb,
-	    (void *)seats);
-
-	/* 'Remove' seat button */
-
-	rc = ui_pbutton_create(ui_res, "Remove", &seats->remove_seat);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 7;
-		rect.p1.x = 68;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 110;
-		rect.p1.x = 450;
-		rect.p1.y = 135;
-	}
-
-	ui_pbutton_set_rect(seats->remove_seat, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_pbutton_ctl(seats->remove_seat));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(seats->remove_seat, &dcfg_remove_seat_button_cb,
-	    (void *)seats);
-
-	/* 'Devices assigned to seat 'xxx':' label */
-
-	rc = ui_label_create(ui_res, "Devices assigned to seat 'xxx':",
-	    &seats->devices_label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 11;
-		rect.p1.x = 36;
-		rect.p1.y = 12;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 200;
-		rect.p1.x = 360;
-		rect.p1.y = 220;
-	}
-
-	ui_label_set_rect(seats->devices_label, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_label_ctl(seats->devices_label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* List of devices */
-
-	rc = ui_list_create(dcfg->window, false, &seats->device_list);
-	if (rc != EOK) {
-		printf("Error creating list.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 12;
-		rect.p1.x = 56;
-		rect.p1.y = 17;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 220;
-		rect.p1.x = 360;
-		rect.p1.y = 320;
-	}
-
-	ui_list_set_rect(seats->device_list, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_list_ctl(seats->device_list));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* 'Add...' device button */
-
-	rc = ui_pbutton_create(ui_res, "Add...", &seats->add_device);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 12;
-		rect.p1.x = 68;
-		rect.p1.y = 13;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 220;
-		rect.p1.x = 450;
-		rect.p1.y = 245;
-	}
-
-	ui_pbutton_set_rect(seats->add_device, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_pbutton_ctl(seats->add_device));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(seats->add_device, &dcfg_add_device_button_cb,
-	    (void *)seats);
-
-	/* 'Remove' device button */
-
-	rc = ui_pbutton_create(ui_res, "Remove", &seats->remove_device);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 14;
-		rect.p1.x = 68;
-		rect.p1.y = 15;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 250;
-		rect.p1.x = 450;
-		rect.p1.y = 275;
-	}
-
-	ui_pbutton_set_rect(seats->remove_device, &rect);
-
-	rc = ui_fixed_add(seats->fixed, ui_pbutton_ctl(seats->remove_device));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(seats->remove_device, &dcfg_remove_device_button_cb,
-	    (void *)seats);
-
-	ui_tab_add(seats->tab, ui_fixed_ctl(seats->fixed));
-
-	*rseats = seats;
-	return EOK;
-error:
-	if (seats->remove_device != NULL)
-		ui_pbutton_destroy(seats->remove_device);
-	if (seats->add_device != NULL)
-		ui_pbutton_destroy(seats->add_device);
-	if (seats->devices_label != NULL)
-		ui_label_destroy(seats->devices_label);
-	if (seats->device_list != NULL)
-		ui_list_destroy(seats->device_list);
-	if (seats->remove_seat != NULL)
-		ui_pbutton_destroy(seats->remove_seat);
-	if (seats->add_seat != NULL)
-		ui_pbutton_destroy(seats->add_seat);
-	if (seats->seats_label != NULL)
-		ui_label_destroy(seats->seats_label);
-	if (seats->seat_list != NULL)
-		ui_list_destroy(seats->seat_list);
-	if (seats->fixed != NULL)
-		ui_fixed_destroy(seats->fixed);
-	free(dcfg);
-	return rc;
-}
-
-/** Populate seats tab with display configuration service data
- *
- * @param dcfg Display configuration dialog
- * @param rseats Place to store pointer to new seat configuration tab
- * @return EOK on success or an error code
- */
-errno_t dcfg_seats_populate(dcfg_seats_t *seats)
-{
-	dcfg_seats_entry_t *entry;
-	errno_t rc;
-
-	rc = dcfg_seats_list_populate(seats);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Update "Devices assigned to seat 'xxx'" label and populate
-	 * assigned devices list.
-	 */
-	entry = dcfg_seats_get_selected(seats);
-	dcfg_seats_list_selected(entry->lentry, (void *)entry);
-	return EOK;
-}
-
-/** Destroy display configuration dialog.
- *
- * @param dcfg Display configuration dialog
- */
-void dcfg_seats_destroy(dcfg_seats_t *seats)
-{
-	ui_list_entry_t *lentry;
-	dcfg_seats_entry_t *entry;
-	dcfg_devices_entry_t *dentry;
-
-	lentry = ui_list_first(seats->device_list);
-	while (lentry != NULL) {
-		dentry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-		free(dentry->name);
-		free(dentry);
-		ui_list_entry_delete(lentry);
-		lentry = ui_list_first(seats->device_list);
-	}
-
-	lentry = ui_list_first(seats->seat_list);
-	while (lentry != NULL) {
-		entry = (dcfg_seats_entry_t *)ui_list_entry_get_arg(lentry);
-		free(entry->name);
-		free(entry);
-		ui_list_entry_delete(lentry);
-		lentry = ui_list_first(seats->seat_list);
-	}
-
-	/* This will automatically destroy all controls in the tab */
-	ui_tab_destroy(seats->tab);
-	free(seats);
-}
-
-/** Insert new entry into seats list.
- *
- * @param seats Seat configuration tab
- * @param name Seat name
- * @param seat_id Seat ID
- * @param rentry Place to store pointer to new entry or NULL
- * @return EOK on success or an error code
- */
-errno_t dcfg_seats_insert(dcfg_seats_t *seats, const char *name,
-    sysarg_t seat_id, dcfg_seats_entry_t **rentry)
-{
-	dcfg_seats_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(dcfg_seats_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->seats = seats;
-	entry->seat_id = seat_id;
-	entry->name = str_dup(name);
-	if (entry->name == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = name;
-	attr.arg = (void *)entry;
-	rc = ui_list_entry_append(seats->seat_list, &attr, &entry->lentry);
-	if (rc != EOK) {
-		free(entry->name);
-		free(entry);
-		return rc;
-	}
-
-	if (rentry != NULL)
-		*rentry = entry;
-	return EOK;
-}
-
-/** Populate seat list.
- *
- * @param seats Seat configuration tab
- * @return EOK on success or an error code
- */
-errno_t dcfg_seats_list_populate(dcfg_seats_t *seats)
-{
-	size_t i;
-	dispcfg_seat_list_t *seat_list = NULL;
-	dispcfg_seat_info_t *sinfo = NULL;
-	errno_t rc;
-
-	rc = dispcfg_get_seat_list(seats->dcfg->dispcfg, &seat_list);
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < seat_list->nseats; i++) {
-		rc = dispcfg_get_seat_info(seats->dcfg->dispcfg,
-		    seat_list->seats[i], &sinfo);
-		if (rc != EOK)
-			goto error;
-
-		rc = dcfg_seats_insert(seats, sinfo->name, seat_list->seats[i],
-		    NULL);
-		if (rc != EOK)
-			goto error;
-
-		dispcfg_free_seat_info(sinfo);
-		sinfo = NULL;
-	}
-
-	dispcfg_free_seat_list(seat_list);
-	return EOK;
-error:
-	if (sinfo != NULL)
-		dispcfg_free_seat_info(sinfo);
-	if (seat_list != NULL)
-		dispcfg_free_seat_list(seat_list);
-	return rc;
-}
-
-/** Insert new entry into devices list.
- *
- * @param seats Seat configuration tab
- * @param name Device name
- * @param svc_id Service ID
- * @return EOK on success or an error code
- */
-errno_t dcfg_devices_insert(dcfg_seats_t *seats, const char *name,
-    service_id_t svc_id)
-{
-	dcfg_devices_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(dcfg_devices_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->seats = seats;
-	entry->svc_id = svc_id;
-	entry->name = str_dup(name);
-	if (entry->name == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = name;
-	attr.arg = (void *)entry;
-	rc = ui_list_entry_append(seats->device_list, &attr, &entry->lentry);
-	if (rc != EOK) {
-		free(entry->name);
-		free(entry);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Insert new entry into available devices list.
- *
- * @param seats Seat configuration tab
- * @param dialog 'Add Device' dialog
- * @param name Device name
- * @param svc_id Service ID
- * @return EOK on success or an error code
- */
-errno_t dcfg_avail_devices_insert(dcfg_seats_t *seats,
-    ui_select_dialog_t *dialog, const char *name, service_id_t svc_id)
-{
-	dcfg_devices_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(dcfg_devices_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->seats = seats;
-	entry->svc_id = svc_id;
-	entry->name = str_dup(name);
-	if (entry->name == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = name;
-	attr.arg = (void *)entry;
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		free(entry->name);
-		free(entry);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Populate assigned device list.
- *
- * @param seats Seat configuration tab
- * @return EOK on success or an error code
- */
-static errno_t dcfg_seats_asgn_dev_list_populate(dcfg_seats_t *seats)
-{
-	size_t i;
-	dispcfg_dev_list_t *dev_list = NULL;
-	char *svc_name = NULL;
-	dcfg_seats_entry_t *seats_entry;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	/* Get active seat entry */
-	seats_entry = dcfg_seats_get_selected(seats);
-	seat_id = seats_entry->seat_id;
-
-	rc = dispcfg_get_asgn_dev_list(seats->dcfg->dispcfg, seat_id, &dev_list);
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < dev_list->ndevs; i++) {
-		rc = loc_service_get_name(dev_list->devs[i], &svc_name);
-		if (rc != EOK)
-			goto error;
-
-		rc = dcfg_devices_insert(seats, svc_name, dev_list->devs[i]);
-		if (rc != EOK)
-			goto error;
-
-		free(svc_name);
-		svc_name = NULL;
-	}
-
-	dispcfg_free_dev_list(dev_list);
-	return EOK;
-error:
-	if (svc_name != NULL)
-		free(svc_name);
-	if (dev_list != NULL)
-		dispcfg_free_dev_list(dev_list);
-	return rc;
-}
-
-/** Populate available device list in 'Add Device' dialog.
- *
- * @param seats Seat configuration tab
- * @param dialog 'Add Device' dialog
- * @return EOK on success or an error code
- */
-static errno_t dcfg_seats_avail_dev_list_populate(dcfg_seats_t *seats,
-    ui_select_dialog_t *dialog)
-{
-	size_t i, j, k;
-	category_id_t cat_id;
-	service_id_t *kbd_svcs = NULL;
-	size_t nkbd_svcs;
-	service_id_t *mouse_svcs = NULL;
-	size_t nmouse_svcs;
-	dispcfg_seat_list_t *seat_list = NULL;
-	dispcfg_dev_list_t *adev_list;
-	char *svc_name = NULL;
-	errno_t rc;
-
-	/* Get list of keyboard devices */
-
-	rc = loc_category_get_id("keyboard", &cat_id, 0);
-	if (rc != EOK) {
-		printf("Error getting category ID.\n");
-		goto error;
-	}
-
-	rc = loc_category_get_svcs(cat_id, &kbd_svcs, &nkbd_svcs);
-	if (rc != EOK) {
-		printf("Error getting service list.\n");
-		goto error;
-	}
-
-	/* Get list of mouse devices */
-
-	rc = loc_category_get_id("mouse", &cat_id, 0);
-	if (rc != EOK) {
-		printf("Error getting category ID.\n");
-		goto error;
-	}
-
-	rc = loc_category_get_svcs(cat_id, &mouse_svcs, &nmouse_svcs);
-	if (rc != EOK) {
-		printf("Error getting service list.\n");
-		goto error;
-	}
-
-	/* Filter out assigned devices */
-	rc = dispcfg_get_seat_list(seats->dcfg->dispcfg, &seat_list);
-	if (rc != EOK) {
-		printf("Error getting seat list.\n");
-		goto error;
-	}
-
-	for (i = 0; i < seat_list->nseats; i++) {
-		rc = dispcfg_get_asgn_dev_list(seats->dcfg->dispcfg,
-		    seat_list->seats[i], &adev_list);
-		if (rc != EOK) {
-			printf("Error getting device list.\n");
-			goto error;
-		}
-
-		for (j = 0; j < adev_list->ndevs; j++) {
-			/* Filter out assigned keyboard devices */
-			for (k = 0; k < nkbd_svcs; k++) {
-				if (kbd_svcs[k] == adev_list->devs[j])
-					kbd_svcs[k] = 0;
-			}
-
-			/* Filter out assigned mouse devices */
-			for (k = 0; k < nmouse_svcs; k++) {
-				if (mouse_svcs[k] == adev_list->devs[j])
-					mouse_svcs[k] = 0;
-			}
-		}
-
-		dispcfg_free_dev_list(adev_list);
-	}
-
-	dispcfg_free_seat_list(seat_list);
-	seat_list = NULL;
-
-	/* Add keyboard devices */
-
-	for (i = 0; i < nkbd_svcs; i++) {
-		if (kbd_svcs[i] == 0)
-			continue;
-
-		rc = loc_service_get_name(kbd_svcs[i], &svc_name);
-		if (rc != EOK)
-			goto error;
-
-		rc = dcfg_avail_devices_insert(seats, dialog, svc_name,
-		    kbd_svcs[i]);
-		if (rc != EOK)
-			goto error;
-
-		free(svc_name);
-		svc_name = NULL;
-	}
-
-	/* Add mouse devices */
-
-	for (i = 0; i < nmouse_svcs; i++) {
-		if (mouse_svcs[i] == 0)
-			continue;
-
-		rc = loc_service_get_name(mouse_svcs[i], &svc_name);
-		if (rc != EOK)
-			goto error;
-
-		rc = dcfg_avail_devices_insert(seats, dialog, svc_name,
-		    mouse_svcs[i]);
-		if (rc != EOK)
-			goto error;
-
-		free(svc_name);
-		svc_name = NULL;
-	}
-
-	free(kbd_svcs);
-	free(mouse_svcs);
-	return EOK;
-error:
-	if (svc_name != NULL)
-		free(svc_name);
-	if (seat_list != NULL)
-		dispcfg_free_seat_list(seat_list);
-	if (kbd_svcs != NULL)
-		free(kbd_svcs);
-	if (mouse_svcs != NULL)
-		free(mouse_svcs);
-	return rc;
-}
-
-/** Get selected seat entry.
- *
- * @param seats Seat configuration tab
- * @return Selected entry
- */
-static dcfg_seats_entry_t *dcfg_seats_get_selected(dcfg_seats_t *seats)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_get_cursor(seats->seat_list);
-	return (dcfg_seats_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Get selected device entry.
- *
- * @param seats Seat configuration tab
- * @return Selected entry
- */
-static dcfg_devices_entry_t *dcfg_devices_get_selected(dcfg_seats_t *seats)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_get_cursor(seats->device_list);
-	return (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Entry in seats list is selected.
- *
- * @param lentry UI list entry
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void dcfg_seats_list_selected(ui_list_entry_t *lentry, void *arg)
-{
-	dcfg_seats_entry_t *entry = (dcfg_seats_entry_t *)arg;
-	dcfg_devices_entry_t *dentry;
-	ui_list_entry_t *le;
-	char *caption;
-	errno_t rc;
-	int rv;
-
-	(void) lentry;
-
-	/* Update 'Devices assigned to seat 'xxx':' label */
-
-	rv = asprintf(&caption, "Devices assigned to seat '%s':", entry->name);
-	if (rv < 0) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = ui_label_set_text(entry->seats->devices_label, caption);
-	if (rc != EOK) {
-		printf("Error setting label.\n");
-		return;
-	}
-
-	free(caption);
-
-	(void) ui_control_paint(ui_label_ctl(entry->seats->devices_label));
-
-	/* Clear device list */
-	le = ui_list_first(entry->seats->device_list);
-	while (le != NULL) {
-		dentry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(le);
-		free(dentry->name);
-		free(dentry);
-		ui_list_entry_delete(le);
-		le = ui_list_first(entry->seats->device_list);
-	}
-
-	/* Re-populate it */
-	(void) dcfg_seats_asgn_dev_list_populate(entry->seats);
-	(void) ui_control_paint(ui_list_ctl(entry->seats->device_list));
-}
-
-/** "Add' seat button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void dcfg_add_seat_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	ui_prompt_dialog_params_t pdparams;
-	errno_t rc;
-
-	ui_prompt_dialog_params_init(&pdparams);
-	pdparams.caption = "Add Seat";
-	pdparams.prompt = "New Seat Name";
-
-	rc = ui_prompt_dialog_create(seats->dcfg->ui, &pdparams,
-	    &seats->add_seat_dlg);
-	if (rc != EOK)
-		printf("Error creating dialog.\n");
-
-	ui_prompt_dialog_set_cb(seats->add_seat_dlg, &add_seat_dialog_cb,
-	    (void *)seats);
-}
-
-/** "Remove' seat button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void dcfg_remove_seat_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	dcfg_seats_entry_t *entry;
-	errno_t rc;
-
-	(void)pbutton;
-	entry = dcfg_seats_get_selected(seats);
-
-	rc = dispcfg_seat_delete(seats->dcfg->dispcfg, entry->seat_id);
-	if (rc != EOK) {
-		/*
-		 * EBUSY is returned when we attempt to delete the last
-		 * seat. No need to complain about it.
-		 */
-		if (rc == EBUSY)
-			return;
-
-		printf("Error removing seat '%s'.\n", entry->name);
-		return;
-	}
-
-	ui_list_entry_delete(entry->lentry);
-	free(entry->name);
-	free(entry);
-
-	(void) ui_control_paint(ui_list_ctl(seats->seat_list));
-
-	/* Since selected seat changed we need to update device list */
-	entry = dcfg_seats_get_selected(seats);
-	dcfg_seats_list_selected(entry->lentry, (void *)entry);
-}
-
-/** Add seat dialog OK button was pressed.
- *
- * @param dialog Add seat dialog
- * @param arg Argument (dcfg_seats_t *)
- * @param text Submitted text
- */
-void add_seat_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *text)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	sysarg_t seat_id;
-	dcfg_seats_entry_t *entry;
-	errno_t rc;
-
-	seats->add_seat_dlg = NULL;
-	ui_prompt_dialog_destroy(dialog);
-
-	rc = dispcfg_seat_create(seats->dcfg->dispcfg, text, &seat_id);
-	if (rc != EOK) {
-		printf("Error creating seat '%s'.\n", text);
-		return;
-	}
-
-	rc = dcfg_seats_insert(seats, text, seat_id, &entry);
-	if (rc != EOK)
-		return;
-
-	(void) ui_control_paint(ui_list_ctl(seats->seat_list));
-
-	/* Select new seat and update device list */
-	ui_list_set_cursor(seats->seat_list, entry->lentry);
-	dcfg_seats_list_selected(entry->lentry, (void *)entry);
-}
-
-/** Add seat dialog Cancel button was pressed.
- *
- * @param dialog Add seat dialog
- * @param arg Argument (dcfg_seats_t *)
- */
-void add_seat_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-
-	seats->add_seat_dlg = NULL;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Add seat dialog close request.
- *
- * @param dialog Add seat dialog
- * @param arg Argument (dcfg_seats_t *)
- */
-void add_seat_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-
-	seats->add_seat_dlg = NULL;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** "Add' device button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void dcfg_add_device_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	ui_select_dialog_params_t sdparams;
-	errno_t rc;
-
-	ui_select_dialog_params_init(&sdparams);
-	sdparams.caption = "Add Device";
-	sdparams.prompt = "Device Name";
-
-	rc = ui_select_dialog_create(seats->dcfg->ui, &sdparams,
-	    &seats->add_device_dlg);
-	if (rc != EOK)
-		printf("Error creating dialog.\n");
-
-	ui_select_dialog_set_cb(seats->add_device_dlg, &add_device_dialog_cb,
-	    (void *)seats);
-
-	(void) dcfg_seats_avail_dev_list_populate(seats,
-	    seats->add_device_dlg);
-	ui_select_dialog_paint(seats->add_device_dlg);
-}
-
-/** "Remove' device button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void dcfg_remove_device_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	dcfg_devices_entry_t *entry;
-	errno_t rc;
-
-	(void)pbutton;
-	entry = dcfg_devices_get_selected(seats);
-
-	rc = dispcfg_dev_unassign(seats->dcfg->dispcfg, entry->svc_id);
-	if (rc != EOK) {
-		printf("Error removing device '%s'.\n", entry->name);
-		return;
-	}
-
-	ui_list_entry_delete(entry->lentry);
-	free(entry->name);
-	free(entry);
-
-	(void) ui_control_paint(ui_list_ctl(seats->device_list));
-}
-
-/** Add device dialog OK button was pressed.
- *
- * @param dialog Add device dialog
- * @param arg Argument (dcfg_seats_t *)
- * @param text Submitted text
- */
-void add_device_dialog_bok(ui_select_dialog_t *dialog, void *arg,
-    void *earg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-	dcfg_devices_entry_t *entry;
-	dcfg_seats_entry_t *seat;
-	errno_t rc;
-
-	seat = dcfg_seats_get_selected(seats);
-	entry = (dcfg_devices_entry_t *)earg;
-
-	seats->add_device_dlg = NULL;
-	ui_select_dialog_destroy(dialog);
-
-	rc = dispcfg_dev_assign(seats->dcfg->dispcfg, entry->svc_id,
-	    seat->seat_id);
-	if (rc != EOK) {
-		printf("Error assigning device '%s' seat '%s'.\n",
-		    entry->name, seat->name);
-		return;
-	}
-
-	rc = dcfg_devices_insert(seats, entry->name, entry->svc_id);
-	if (rc != EOK) {
-		printf("Error inserting device to list.\n");
-		return;
-	}
-
-	(void) ui_control_paint(ui_list_ctl(seats->device_list));
-}
-
-/** Add device dialog Cancel button was pressed.
- *
- * @param dialog Add device dialog
- * @param arg Argument (dcfg_seats_t *)
- */
-void add_device_dialog_bcancel(ui_select_dialog_t *dialog, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-
-	seats->add_device_dlg = NULL;
-	ui_select_dialog_destroy(dialog);
-}
-
-/** Add device dialog close request.
- *
- * @param dialog Add device dialog
- * @param arg Argument (dcfg_seats_t *)
- */
-void add_device_dialog_close(ui_select_dialog_t *dialog, void *arg)
-{
-	dcfg_seats_t *seats = (dcfg_seats_t *)arg;
-
-	seats->add_device_dlg = NULL;
-	ui_select_dialog_destroy(dialog);
-}
-
-/** @}
- */
Index: pace/app/display-cfg/seats.h
===================================================================
--- uspace/app/display-cfg/seats.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/**
- * @file Seat configuration tab
- */
-
-#ifndef SEATS_H
-#define SEATS_H
-
-#include "types/display-cfg.h"
-#include "types/seats.h"
-
-extern errno_t dcfg_seats_create(display_cfg_t *, dcfg_seats_t **);
-extern errno_t dcfg_seats_populate(dcfg_seats_t *);
-extern void dcfg_seats_destroy(dcfg_seats_t *);
-extern errno_t dcfg_seats_insert(dcfg_seats_t *, const char *, sysarg_t,
-    dcfg_seats_entry_t **);
-extern errno_t dcfg_devices_insert(dcfg_seats_t *, const char *,
-    service_id_t);
-extern errno_t dcfg_avail_devices_insert(dcfg_seats_t *seats,
-    ui_select_dialog_t *dialog, const char *name, service_id_t svc_id);
-extern errno_t dcfg_seats_list_populate(dcfg_seats_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/display-cfg/test/display-cfg.c
===================================================================
--- uspace/app/display-cfg/test/display-cfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <ui/ui.h>
-#include "../display-cfg.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(display_cfg);
-
-/** Test display_cfg_create() and display_cfg_destroy() */
-PCUT_TEST(create_destroy)
-{
-	display_cfg_t *dcfg;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_cfg_destroy(dcfg);
-}
-
-PCUT_EXPORT(display_cfg);
Index: pace/app/display-cfg/test/main.c
===================================================================
--- uspace/app/display-cfg/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(display_cfg);
-PCUT_IMPORT(seats);
-
-PCUT_MAIN();
Index: pace/app/display-cfg/test/seats.c
===================================================================
--- uspace/app/display-cfg/test/seats.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <dispcfg.h>
-#include <dispcfg_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include <testdc.h>
-#include "../display-cfg.h"
-#include "../seats.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(seats);
-
-static const char *test_dispcfg_server = "test-dispcfg";
-static const char *test_dispcfg_svc = "test/dispcfg";
-
-/** Test dcfg_seats_create() and dcfg_seats_destroy() */
-PCUT_TEST(create_destroy)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_seats_insert() inserts an entry into the seat list */
-PCUT_TEST(seats_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	dcfg_seats_entry_t *entry = NULL;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_insert(seats, "Alice", 42, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("Alice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->seat_id);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_seats_list_populate() populates seat list */
-PCUT_TEST(seats_list_populate)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_cfg_open(dcfg, test_dispcfg_svc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * dcfg_seat_list_populate() calls dispcfg_get_seat_list()
-	 * and dispcfg_get_seat_info()
-	 */
-	resp.rc = EOK;
-	resp.get_seat_list_rlist = calloc(1, sizeof(dispcfg_seat_list_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist);
-	resp.get_seat_list_rlist->nseats = 1;
-	resp.get_seat_list_rlist->seats = calloc(1, sizeof(sysarg_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist->seats);
-	resp.get_seat_list_rlist->seats[0] = 42;
-
-	resp.get_seat_info_rinfo = calloc(1, sizeof(dispcfg_seat_info_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo);
-	resp.get_seat_info_rinfo->name = str_dup("Alice");
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo->name);
-
-	rc = dcfg_seats_list_populate(seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dcfg_devices_insert() inserts an entry into the device list */
-PCUT_TEST(devices_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	ui_list_entry_t *lentry;
-	dcfg_devices_entry_t *entry;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_devices_insert(seats, "mydevice", 42);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lentry = ui_list_first(seats->device_list);
-	PCUT_ASSERT_NOT_NULL(lentry);
-	entry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("mydevice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->svc_id);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_avail_devices_insert() inserts entry into available devices list */
-PCUT_TEST(avail_devices_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	ui_list_entry_t *lentry;
-	dcfg_devices_entry_t *entry;
-	ui_select_dialog_t *dialog;
-	ui_select_dialog_params_t sdparams;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&sdparams);
-	sdparams.caption = "Dialog";
-	sdparams.prompt = "Select";
-
-	rc = ui_select_dialog_create(seats->dcfg->ui, &sdparams, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_avail_devices_insert(seats, dialog, "mydevice", 42);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lentry = ui_list_first(ui_select_dialog_list(dialog));
-	PCUT_ASSERT_NOT_NULL(lentry);
-	entry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("mydevice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->svc_id);
-
-	ui_select_dialog_destroy(dialog);
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-PCUT_TEST(asgn_dev_list_populate)
-{
-}
-
-PCUT_TEST(avail_dev_list_populate)
-{
-}
-
-PCUT_TEST(seats_get_selected)
-{
-}
-
-PCUT_TEST(devices_get_selected)
-{
-}
-
-PCUT_TEST(seats_list_selected)
-{
-}
-
-PCUT_TEST(add_seat_clicked)
-{
-}
-
-PCUT_TEST(remove_seat_clicked)
-{
-}
-
-PCUT_TEST(add_seat_dialog_bok)
-{
-}
-
-PCUT_TEST(add_seat_dialog_bcancel)
-{
-}
-
-PCUT_TEST(add_seat_dialog_close)
-{
-}
-
-PCUT_TEST(add_device_clicked)
-{
-}
-
-PCUT_TEST(remove_device_clicked)
-{
-}
-
-PCUT_TEST(add_device_dialog_bok)
-{
-}
-
-PCUT_TEST(add_device_dialog_bcancel)
-{
-}
-
-PCUT_TEST(add_device_dialog_close)
-{
-}
-
-PCUT_EXPORT(seats);
Index: pace/app/display-cfg/types/display-cfg.h
===================================================================
--- uspace/app/display-cfg/types/display-cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/**
- * @file Display configuration utility (UI) types
- */
-
-#ifndef TYPES_DISPLAY_CFG_H
-#define TYPES_DISPLAY_CFG_H
-
-#include <dispcfg.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Display configuration utility (UI) */
-typedef struct display_cfg {
-	/** Display configuration session */
-	dispcfg_t *dispcfg;
-	/** UI */
-	ui_t *ui;
-	/** Containing window */
-	ui_window_t *window;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** Tab set */
-	ui_tab_set_t *tabset;
-	/** Seat configuration tab */
-	struct dcfg_seats *seats;
-} display_cfg_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/display-cfg/types/seats.h
===================================================================
--- uspace/app/display-cfg/types/seats.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display-cfg
- * @{
- */
-/**
- * @file Seat configuration tab
- */
-
-#ifndef TYPES_SEATS_H
-#define TYPES_SEATS_H
-
-#include <loc.h>
-#include <types/common.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/pbutton.h>
-#include <ui/promptdialog.h>
-#include <ui/selectdialog.h>
-#include <ui/tab.h>
-
-/** Seat configuration tab */
-typedef struct dcfg_seats {
-	/** Containing display configuration */
-	struct display_cfg *dcfg;
-	/** UI tab */
-	ui_tab_t *tab;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** 'Configured seats' label */
-	ui_label_t *seats_label;
-	/** List of configured seats */
-	ui_list_t *seat_list;
-	/** Add seat button */
-	ui_pbutton_t *add_seat;
-	/** Remove seat button */
-	ui_pbutton_t *remove_seat;
-	/** Add seat dialog */
-	ui_prompt_dialog_t *add_seat_dlg;
-	/** 'Devices assigned to xxx' label */
-	ui_label_t *devices_label;
-	/** List of assigned devices */
-	ui_list_t *device_list;
-	/** Add device button */
-	ui_pbutton_t *add_device;
-	/** Remove device button */
-	ui_pbutton_t *remove_device;
-	/** Add device dialog */
-	ui_select_dialog_t *add_device_dlg;
-} dcfg_seats_t;
-
-/** Entry in seat list */
-typedef struct {
-	/** Containing seat configuration tab */
-	struct dcfg_seats *seats;
-	/** List entry */
-	ui_list_entry_t *lentry;
-	/** Seat ID */
-	sysarg_t seat_id;
-	/** Seat name */
-	char *name;
-} dcfg_seats_entry_t;
-
-/** Entry in device list */
-typedef struct {
-	/** Containing seat configuration tab */
-	struct dcfg_seats *seats;
-	/** List entry */
-	ui_list_entry_t *lentry;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Device name */
-	char *name;
-} dcfg_devices_entry_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/dltest/dltest.c
===================================================================
--- uspace/app/dltest/dltest.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1070 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dltest
- * @{
- */
-
-/**
- * @file
- * @brief	Test dynamic linking
- */
-
-#include <dlfcn.h>
-#include <libdltest.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-/** libdltest library handle */
-static void *handle;
-
-/** If true, do not run dlfcn tests */
-static bool no_dlfcn = false;
-
-/** Test dlsym() function */
-static bool test_dlsym(void)
-{
-	int (*p_dl_get_constant)(void);
-
-	printf("dlsym()... ");
-	p_dl_get_constant = dlsym(handle, "dl_get_constant");
-	if (p_dl_get_constant == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling function that returns a constant */
-static bool test_dlfcn_dl_get_constant(void)
-{
-	int (*p_dl_get_constant)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_constant...\n");
-
-	p_dl_get_constant = dlsym(handle, "dl_get_constant");
-	if (p_dl_get_constant == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_constant();
-
-	printf("Got %d, expected %d... ", val, dl_constant);
-	if (val != dl_constant) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling function that calls a function that returns a constant */
-static bool test_dlfcn_dl_get_constant_via_call(void)
-{
-	int (*p_dl_get_constant)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_constant_via_call...\n");
-
-	p_dl_get_constant = dlsym(handle, "dl_get_constant_via_call");
-	if (p_dl_get_constant == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_constant();
-
-	printf("Got %d, expected %d... ", val, dl_constant);
-	if (val != dl_constant) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns contents of a private initialized
- * variable.
- */
-static bool test_dlfcn_dl_get_private_var(void)
-{
-	int (*p_dl_get_private_var)(void);
-	int *(*p_dl_get_private_var_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_private_var...\n");
-
-	p_dl_get_private_var = dlsym(handle, "dl_get_private_var");
-	if (p_dl_get_private_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_private_var_addr = dlsym(handle, "dl_get_private_var_addr");
-	if (p_dl_get_private_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_private_var();
-
-	printf("Got %d, expected %d... ", val, dl_private_var_val);
-	if (val != dl_private_var_val) {
-		printf("dl_get_private_var_addr -> %p\n",
-		    p_dl_get_private_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns contents of a private uninitialized
- * variable.
- */
-static bool test_dlfcn_dl_get_private_uvar(void)
-{
-	int (*p_dl_get_private_uvar)(void);
-	int *(*p_dl_get_private_uvar_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_private_uvar...\n");
-
-	p_dl_get_private_uvar = dlsym(handle, "dl_get_private_uvar");
-	if (p_dl_get_private_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_private_uvar_addr = dlsym(handle, "dl_get_private_uvar_addr");
-	if (p_dl_get_private_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_private_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_private_uvar_addr -> %p\n",
-		    p_dl_get_private_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns the contents of a public initialized
- * variable.
- */
-static bool test_dlfcn_dl_get_public_var(void)
-{
-	int (*p_dl_get_public_var)(void);
-	int *(*p_dl_get_public_var_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_public_var...\n");
-
-	p_dl_get_public_var = dlsym(handle, "dl_get_public_var");
-	if (p_dl_get_public_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_var_addr = dlsym(handle, "dl_get_public_var_addr");
-	if (p_dl_get_public_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_public_var();
-
-	printf("Got %d, expected %d... ", val, dl_public_var_val);
-	if (val != dl_public_var_val) {
-		printf("dl_get_public_var_addr -> %p\n",
-		    p_dl_get_public_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns the contents of a public uninitialized
- * variable.
- */
-static bool test_dlfcn_dl_get_public_uvar(void)
-{
-	int (*p_dl_get_public_uvar)(void);
-	int *(*p_dl_get_public_uvar_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_public_uvar...\n");
-
-	p_dl_get_public_uvar = dlsym(handle, "dl_get_public_uvar");
-	if (p_dl_get_public_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_uvar_addr = dlsym(handle, "dl_get_public_uvar_addr");
-	if (p_dl_get_public_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_public_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_public_uvar_addr -> %p\n",
-		    p_dl_get_public_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public initialized variable whose address was
- * obtained using dlsym.
- */
-static bool test_dlfcn_read_public_var(void)
-{
-	int *p_dl_public_var;
-	int *(*p_dl_get_public_var_addr)(void);
-	int val;
-
-	printf("Read dlsym/dl_public_var...\n");
-
-	p_dl_public_var = dlsym(handle, "dl_public_var");
-	if (p_dl_public_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_var_addr = dlsym(handle, "dl_get_public_var_addr");
-	if (p_dl_get_public_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = *p_dl_public_var;
-
-	printf("Got %d, expected %d... ", val, dl_public_var_val);
-	if (val != dl_public_var_val) {
-		printf("&dl_public_var = %p, "
-		    "dl_get_public_var_addr -> %p\n",
-		    p_dl_public_var, p_dl_get_public_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public uninitialized variable whose address was
- * obtained using dlsym.
- */
-static bool test_dlfcn_read_public_uvar(void)
-{
-	int *p_dl_public_uvar;
-	int *(*p_dl_get_public_uvar_addr)(void);
-	int val;
-
-	printf("Read dlsym/dl_public_uvar...\n");
-
-	p_dl_public_uvar = dlsym(handle, "dl_public_uvar");
-	if (p_dl_public_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_uvar_addr = dlsym(handle, "dl_get_public_uvar_addr");
-	if (p_dl_get_public_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = *p_dl_public_uvar;
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("&dl_public_uvar = %p, "
-		    "dl_get_public_uvar_addr -> %p\n",
-		    p_dl_public_uvar, p_dl_get_public_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-#ifndef STATIC_EXE
-
-/** Test calling a function that returns contents of a private initialized
- * fibril-local variable.
- */
-static bool test_dlfcn_dl_get_private_fib_var(void)
-{
-	int (*p_dl_get_private_fib_var)(void);
-	int *(*p_dl_get_private_fib_var_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_private_fib_var...\n");
-
-	p_dl_get_private_fib_var = dlsym(handle, "dl_get_private_fib_var");
-	if (p_dl_get_private_fib_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_private_fib_var_addr = dlsym(handle, "dl_get_private_fib_var_addr");
-	if (p_dl_get_private_fib_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_private_fib_var();
-
-	printf("Got %d, expected %d... ", val, dl_private_fib_var_val);
-	if (val != dl_private_fib_var_val) {
-		printf("dl_get_private_fib_var_addr -> %p\n",
-		    p_dl_get_private_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns contents of a private uninitialized
- * fibril-local variable.
- */
-static bool test_dlfcn_dl_get_private_fib_uvar(void)
-{
-	int (*p_dl_get_private_fib_uvar)(void);
-	int *(*p_dl_get_private_fib_uvar_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_private_fib_uvar...\n");
-
-	p_dl_get_private_fib_uvar = dlsym(handle, "dl_get_private_fib_uvar");
-	if (p_dl_get_private_fib_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_private_fib_uvar_addr = dlsym(handle, "dl_get_private_fib_uvar_addr");
-	if (p_dl_get_private_fib_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_private_fib_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_private_fib_uvar_addr -> %p\n",
-		    p_dl_get_private_fib_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns the contents of a public initialized
- * fibril-local variable.
- */
-static bool test_dlfcn_dl_get_public_fib_var(void)
-{
-	int (*p_dl_get_public_fib_var)(void);
-	int *(*p_dl_get_public_fib_var_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_public_fib_var...\n");
-
-	p_dl_get_public_fib_var = dlsym(handle, "dl_get_public_fib_var");
-	if (p_dl_get_public_fib_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_fib_var_addr = dlsym(handle, "dl_get_public_fib_var_addr");
-	if (p_dl_get_public_fib_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_public_fib_var();
-
-	printf("Got %d, expected %d... ", val, dl_public_fib_var_val);
-	if (val != dl_public_fib_var_val) {
-		printf("dl_get_public_fib_var_addr -> %p\n",
-		    p_dl_get_public_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test calling a function that returns the contents of a public uninitialized
- * fibril-local variable.
- */
-static bool test_dlfcn_dl_get_public_fib_uvar(void)
-{
-	int (*p_dl_get_public_fib_uvar)(void);
-	int *(*p_dl_get_public_fib_uvar_addr)(void);
-	int val;
-
-	printf("Call dlsym/dl_get_public_fib_uvar...\n");
-
-	p_dl_get_public_fib_uvar = dlsym(handle, "dl_get_public_fib_uvar");
-	if (p_dl_get_public_fib_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_fib_uvar_addr = dlsym(handle, "dl_get_public_fib_uvar_addr");
-	if (p_dl_get_public_fib_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = p_dl_get_public_fib_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_public_fib_uvar_addr -> %p\n",
-		    p_dl_get_public_fib_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public initialized fibril-local variable
- * whose address was obtained using dlsym.
- */
-static bool test_dlfcn_read_public_fib_var(void)
-{
-	int *p_dl_public_fib_var;
-	int *(*p_dl_get_public_fib_var_addr)(void);
-	int val;
-
-	printf("Read dlsym/dl_public_fib_var...\n");
-
-	p_dl_public_fib_var = dlsym(handle, "dl_public_fib_var");
-	if (p_dl_public_fib_var == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_fib_var_addr = dlsym(handle, "dl_get_public_fib_var_addr");
-	if (p_dl_get_public_fib_var_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = *p_dl_public_fib_var;
-
-	printf("Got %d, expected %d... ", val, dl_public_fib_var_val);
-	if (val != dl_public_fib_var_val) {
-		printf("&dl_public_fib_var = %p, "
-		    "dl_get_public_fib_var_addr -> %p\n",
-		    p_dl_public_fib_var, p_dl_get_public_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public uninitialized fibril-local variable
- * whose address was obtained using dlsym.
- */
-static bool test_dlfcn_read_public_fib_uvar(void)
-{
-	int *p_dl_public_fib_uvar;
-	int *(*p_dl_get_public_fib_uvar_addr)(void);
-	int val;
-
-	printf("Read dlsym/dl_public_fib_uvar...\n");
-
-	p_dl_public_fib_uvar = dlsym(handle, "dl_public_fib_uvar");
-	if (p_dl_public_fib_uvar == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	p_dl_get_public_fib_uvar_addr = dlsym(handle, "dl_get_public_fib_uvar_addr");
-	if (p_dl_get_public_fib_uvar_addr == NULL) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	val = *p_dl_public_fib_uvar;
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("&dl_public_fib_uvar = %p, "
-		    "dl_get_public_fib_uvar_addr -> %p\n",
-		    p_dl_public_fib_uvar, p_dl_get_public_fib_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-#endif /* STATIC_EXE */
-
-#ifdef DLTEST_LINKED
-
-/** Test if we can read the correct value of a public pointer variable.
- *
- * dl_public_ptr_var is initialized in libdltest to point to dl_public_var.
- * This is done using a relocation. The main program (unless compiled with
- * PIC or PIE) will contain a copy of dl_public_ptr_var. This needs
- * to be copied using a COPY relocation. The relocations in the main
- * program need to be processed after the relocations in the shared
- * libraries (so that we copy the correct value).
- */
-static bool test_public_ptr_var(void)
-{
-	int *ptr;
-
-	printf("Read dl_public_ptr_var directly...\n");
-	ptr = dl_public_ptr_var;
-
-	if (ptr != &dl_public_var) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling function that returns a constant */
-static bool test_lnk_dl_get_constant(void)
-{
-	int val;
-
-	printf("Call linked dl_get_constant...\n");
-
-	val = dl_get_constant();
-
-	printf("Got %d, expected %d... ", val, dl_constant);
-	if (val != dl_constant) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling function that calls a function that returns a constant */
-static bool test_lnk_dl_get_constant_via_call(void)
-{
-	int val;
-
-	printf("Call linked dl_get_constant_via_call...\n");
-
-	val = dl_get_constant_via_call();
-
-	printf("Got %d, expected %d... ", val, dl_constant);
-	if (val != dl_constant) {
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test dircetly calling a function that returns contents of a private
- * initialized variable.
- */
-static bool test_lnk_dl_get_private_var(void)
-{
-	int val;
-
-	printf("Call linked dl_get_private_var...\n");
-
-	val = dl_get_private_var();
-
-	printf("Got %d, expected %d... ", val, dl_private_var_val);
-	if (val != dl_private_var_val) {
-		printf("dl_get_private_var_addr -> %p\n",
-		    dl_get_private_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test dircetly calling a function that returns contents of a private
- * uninitialized variable.
- */
-static bool test_lnk_dl_get_private_uvar(void)
-{
-	int val;
-
-	printf("Call linked dl_get_private_uvar...\n");
-
-	val = dl_get_private_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_private_uvar_addr -> %p\n",
-		    dl_get_private_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling a function that returns the contents of a public
- * initialized variable.
- */
-static bool test_lnk_dl_get_public_var(void)
-{
-	int val;
-
-	printf("Call linked dl_get_public_var...\n");
-
-	val = dl_get_public_var();
-
-	printf("Got %d, expected %d... ", val, dl_public_var_val);
-	if (val != dl_public_var_val) {
-		printf("dl_get_public_var_addr -> %p\n",
-		    dl_get_public_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling a function that returns the contents of a public
- * uninitialized variable.
- */
-static bool test_lnk_dl_get_public_uvar(void)
-{
-	int val;
-
-	printf("Call linked dl_get_public_uvar...\n");
-
-	val = dl_get_public_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_public_uvar_addr -> %p\n",
-		    dl_get_public_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public initialized variable. */
-static bool test_lnk_read_public_var(void)
-{
-	int val;
-
-	printf("Read linked dl_public_var...\n");
-
-	val = dl_public_var;
-
-	printf("Got %d, expected %d... ", val, dl_public_var_val);
-	if (val != dl_public_var_val) {
-		printf("&dl_public_var = %p, dl_get_public_var_addr -> %p\n",
-		    &dl_public_var, dl_get_public_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public uninitialized variable. */
-static bool test_lnk_read_public_uvar(void)
-{
-	int val;
-
-	printf("Read linked dl_public_uvar...\n");
-
-	val = dl_public_uvar;
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("&dl_public_uvar = %p, dl_get_public_uvar_addr -> %p\n",
-		    &dl_public_uvar, dl_get_public_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test dircetly calling a function that returns contents of a private
- * initialized fibril-local variable.
- */
-static bool test_lnk_dl_get_private_fib_var(void)
-{
-	int val;
-
-	printf("Call linked dl_get_private_fib_var...\n");
-
-	val = dl_get_private_fib_var();
-
-	printf("Got %d, expected %d... ", val, dl_private_fib_var_val);
-	if (val != dl_private_fib_var_val) {
-		printf("dl_get_private_fib_var_addr -> %p\n",
-		    dl_get_private_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test dircetly calling a function that returns contents of a private
- * uninitialized fibril-local variable.
- */
-static bool test_lnk_dl_get_private_fib_uvar(void)
-{
-	int val;
-
-	printf("Call linked dl_get_private_fib_uvar...\n");
-
-	val = dl_get_private_fib_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_private_fib_uvar_addr -> %p\n",
-		    dl_get_private_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling a function that returns the contents of a public
- * initialized fibril-local variable.
- */
-static bool test_lnk_dl_get_public_fib_var(void)
-{
-	int val;
-
-	printf("Call linked dl_get_public_fib_var...\n");
-
-	val = dl_get_public_fib_var();
-
-	printf("Got %d, expected %d... ", val, dl_public_fib_var_val);
-	if (val != dl_public_fib_var_val) {
-		printf("dl_get_public_fib_var_addr -> %p\n",
-		    dl_get_public_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly calling a function that returns the contents of a public
- * uninitialized fibril-local variable.
- */
-static bool test_lnk_dl_get_public_fib_uvar(void)
-{
-	int val;
-
-	printf("Call linked dl_get_public_fib_uvar...\n");
-
-	val = dl_get_public_fib_uvar();
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("dl_get_public_fib_uvar_addr -> %p\n",
-		    dl_get_public_fib_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public initialized fibril-local variable. */
-static bool test_lnk_read_public_fib_var(void)
-{
-	int val;
-
-	printf("Read linked dl_public_fib_var...\n");
-
-	val = dl_public_fib_var;
-
-	printf("Got %d, expected %d... ", val, dl_public_fib_var_val);
-	if (val != dl_public_fib_var_val) {
-		printf("&dl_public_fib_var = %p, "
-		    "dl_get_public_fib_var_addr -> %p\n",
-		    &dl_public_fib_var, dl_get_public_fib_var_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-/** Test directly reading a public uninitialized fibril-local variable. */
-static bool test_lnk_read_public_fib_uvar(void)
-{
-	int val;
-
-	printf("Read linked dl_public_fib_uvar...\n");
-
-	val = dl_public_fib_uvar;
-
-	printf("Got %d, expected %d... ", val, 0);
-	if (val != 0) {
-		printf("&dl_public_fib_uvar = %p, "
-		    "dl_get_public_fib_uvar_addr -> %p\n",
-		    &dl_public_fib_uvar, dl_get_public_fib_uvar_addr());
-		printf("FAILED\n");
-		return false;
-	}
-
-	printf("Passed\n");
-	return true;
-}
-
-#endif /* DLTEST_LINKED */
-
-static int test_dlfcn(void)
-{
-	printf("dlopen()... ");
-	handle = dlopen("libdltest.so.0", 0);
-	if (handle == NULL) {
-		printf("FAILED\n");
-		return 1;
-	}
-
-	printf("Passed\n");
-
-	if (!test_dlsym())
-		return 1;
-
-	if (!test_dlfcn_dl_get_constant())
-		return 1;
-
-	if (!test_dlfcn_dl_get_constant_via_call())
-		return 1;
-
-	if (!test_dlfcn_dl_get_private_var())
-		return 1;
-
-	if (!test_dlfcn_dl_get_private_uvar())
-		return 1;
-
-	if (!test_dlfcn_dl_get_public_var())
-		return 1;
-
-	if (!test_dlfcn_dl_get_public_uvar())
-		return 1;
-
-	if (!test_dlfcn_read_public_var())
-		return 1;
-
-	if (!test_dlfcn_read_public_uvar())
-		return 1;
-
-#ifndef STATIC_EXE // FIXME: this define is not set anywhere
-
-	if (!test_dlfcn_dl_get_private_fib_var())
-		return 1;
-
-	if (!test_dlfcn_dl_get_private_fib_uvar())
-		return 1;
-
-	if (!test_dlfcn_dl_get_public_fib_var())
-		return 1;
-
-	if (!test_dlfcn_dl_get_public_fib_uvar())
-		return 1;
-
-	if (!test_dlfcn_read_public_fib_var())
-		return 1;
-
-	if (!test_dlfcn_read_public_fib_uvar())
-		return 1;
-#endif /* STATIC_EXE */
-
-#if 0
-	printf("dlclose()... ");
-	dlclose(handle);
-	printf("Passed\n");
-#endif
-
-	return 0;
-}
-
-#ifdef DLTEST_LINKED
-
-static int test_lnk(void)
-{
-	if (!test_lnk_dl_get_constant())
-		return 1;
-
-	if (!test_lnk_dl_get_constant_via_call())
-		return 1;
-
-	if (!test_lnk_dl_get_private_var())
-		return 1;
-
-	if (!test_lnk_dl_get_private_uvar())
-		return 1;
-
-	if (!test_lnk_dl_get_public_var())
-		return 1;
-
-	if (!test_lnk_dl_get_public_uvar())
-		return 1;
-
-	if (!test_lnk_read_public_var())
-		return 1;
-
-	if (!test_lnk_read_public_uvar())
-		return 1;
-
-	if (!test_public_ptr_var())
-		return 1;
-
-	if (!test_lnk_dl_get_private_fib_var())
-		return 1;
-
-	if (!test_lnk_dl_get_private_fib_uvar())
-		return 1;
-
-	if (!test_lnk_dl_get_public_fib_var())
-		return 1;
-
-	if (!test_lnk_dl_get_public_fib_uvar())
-		return 1;
-
-	if (!test_lnk_read_public_fib_var())
-		return 1;
-
-	if (!test_lnk_read_public_fib_uvar())
-		return 1;
-
-	return 0;
-}
-
-#endif /* DLTEST_LINKED */
-
-static void print_syntax(void)
-{
-	fprintf(stderr, "syntax: dltest [-n]\n");
-	fprintf(stderr, "\t-n Do not run dlfcn tests\n");
-}
-
-int main(int argc, char *argv[])
-{
-	printf("Dynamic linking test\n");
-
-	if (argc > 1) {
-		if (argc > 2) {
-			print_syntax();
-			return 1;
-		}
-
-		if (str_cmp(argv[1], "-n") == 0) {
-			no_dlfcn = true;
-		} else {
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (!no_dlfcn) {
-		if (test_dlfcn() != 0)
-			return 1;
-	}
-
-#ifdef DLTEST_LINKED
-	if (test_lnk() != 0)
-		return 1;
-#endif
-
-	printf("All passed.\n");
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/app/dltest/doc/doxygroups.h
===================================================================
--- uspace/app/dltest/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup dltest dltest
- * @brief Test dynamic linking
- * @ingroup apps
- */
Index: pace/app/dltest/meson.build
===================================================================
--- uspace/app/dltest/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'dltest' ]
-src = files('dltest.c')
-c_args += '-DDLTEST_LINKED'
Index: pace/app/dltests/dltests.c
===================================================================
--- uspace/app/dltests/dltests.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../dltest/dltest.c
Index: pace/app/dltests/meson.build
===================================================================
--- uspace/app/dltests/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-includes += libdltest_includes
-src = files('dltests.c')
-link_args += '-Wl,-Bdynamic'
Index: pace/app/dnscfg/dnscfg.c
===================================================================
--- uspace/app/dnscfg/dnscfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnscfg
- * @{
- */
-/** @file DNS configuration utility.
- *
- * Controls the DNS resolution server (@c dnsrsrv).
- */
-
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/dnsr.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME "dnscfg"
-
-static void print_syntax(void)
-{
-	printf("Syntax:\n");
-	printf("\t%s get-ns\n", NAME);
-	printf("\t%s set-ns <server-addr>\n", NAME);
-	printf("\t%s unset-ns\n", NAME);
-}
-
-static errno_t dnscfg_set_ns(int argc, char *argv[])
-{
-	if (argc < 1) {
-		printf("%s: Missing arguments.\n", NAME);
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf("%s: Too many arguments.\n", NAME);
-		print_syntax();
-		return EINVAL;
-	}
-
-	char *srv_addr  = argv[0];
-
-	inet_addr_t addr;
-	errno_t rc = inet_addr_parse(srv_addr, &addr, NULL);
-
-	if (rc != EOK) {
-		printf("%s: Invalid address format '%s'.\n", NAME, srv_addr);
-		return rc;
-	}
-
-	rc = dnsr_set_srvaddr(&addr);
-	if (rc != EOK) {
-		printf("%s: Failed setting nameserver address '%s' (%s)\n",
-		    NAME, srv_addr, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t dnscfg_unset_ns(void)
-{
-	inet_addr_t addr;
-	inet_addr_any(&addr);
-
-	errno_t rc = dnsr_set_srvaddr(&addr);
-	if (rc != EOK) {
-		printf("%s: Failed unsetting server address (%s)\n",
-		    NAME, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t dnscfg_print(void)
-{
-	inet_addr_t addr;
-	errno_t rc = dnsr_get_srvaddr(&addr);
-	if (rc != EOK) {
-		printf("%s: Failed getting DNS server address.\n", NAME);
-		return rc;
-	}
-
-	char *addr_str;
-	rc = inet_addr_format(&addr, &addr_str);
-	if (rc != EOK) {
-		printf("%s: Out of memory.\n", NAME);
-		return rc;
-	}
-
-	printf("Nameserver: %s\n", addr_str);
-	free(addr_str);
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	if ((argc < 2) || (str_cmp(argv[1], "get-ns") == 0))
-		return dnscfg_print();
-	else if (str_cmp(argv[1], "set-ns") == 0)
-		return dnscfg_set_ns(argc - 2, argv + 2);
-	else if (str_cmp(argv[1], "unset-ns") == 0)
-		return dnscfg_unset_ns();
-	else {
-		printf("%s: Unknown command '%s'.\n", NAME, argv[1]);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/dnscfg/doc/doxygroups.h
===================================================================
--- uspace/app/dnscfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup dnscfg dnscfg
- * @brief DNS configuration utility
- * @ingroup apps
- */
Index: pace/app/dnscfg/meson.build
===================================================================
--- uspace/app/dnscfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files('dnscfg.c')
Index: pace/app/dnsres/dnsres.c
===================================================================
--- uspace/app/dnsres/dnsres.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsres
- * @{
- */
-/** @file DNS query utility.
- */
-
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/dnsr.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define NAME  "dnsres"
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [-4|-6] <host-name>\n", NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	if ((argc < 2) || (argc > 3)) {
-		print_syntax();
-		return 1;
-	}
-
-	uint16_t ver;
-	char *hname;
-
-	if (str_cmp(argv[1], "-4") == 0) {
-		if (argc < 3) {
-			print_syntax();
-			return 1;
-		}
-
-		ver = ip_v4;
-		hname = argv[2];
-	} else if (str_cmp(argv[1], "-6") == 0) {
-		if (argc < 3) {
-			print_syntax();
-			return 1;
-		}
-
-		ver = ip_v6;
-		hname = argv[2];
-	} else {
-		ver = ip_any;
-		hname = argv[1];
-	}
-
-	dnsr_hostinfo_t *hinfo;
-	errno_t rc = dnsr_name2host(hname, &hinfo, ver);
-	if (rc != EOK) {
-		printf("%s: Error resolving '%s'.\n", NAME, hname);
-		return rc;
-	}
-
-	char *saddr;
-	rc = inet_addr_format(&hinfo->addr, &saddr);
-	if (rc != EOK) {
-		dnsr_hostinfo_destroy(hinfo);
-		printf("%s: Error formatting address.\n", NAME);
-		return rc;
-	}
-
-	printf("Host name: %s\n", hname);
-
-	if (str_cmp(hname, hinfo->cname) != 0)
-		printf("Canonical name: %s\n", hinfo->cname);
-
-	printf("Address: %s\n", saddr);
-
-	dnsr_hostinfo_destroy(hinfo);
-	free(saddr);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/dnsres/doc/doxygroups.h
===================================================================
--- uspace/app/dnsres/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup dnsres dnsres
- * @brief DNS query utility
- * @ingroup apps
- */
Index: pace/app/dnsres/meson.build
===================================================================
--- uspace/app/dnsres/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files('dnsres.c')
Index: pace/app/download/doc/doxygroups.h
===================================================================
--- uspace/app/download/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup download download
- * @brief Download a file from a HTTP server
- * @ingroup apps
- */
Index: pace/app/download/main.c
===================================================================
--- uspace/app/download/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup download
- * @{
- */
-
-/** @file
- * Download a file from a HTTP server
- *
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <task.h>
-#include <macros.h>
-
-#include <http/http.h>
-#include <uri.h>
-
-#define NAME "download"
-#ifdef TIMESTAMP_UNIX
-#define VERSION STRING(HELENOS_RELEASE) "-" STRING(TIMESTAMP_UNIX)
-#else
-#define VERSION STRING(HELENOS_RELEASE)
-#endif
-#define USER_AGENT "HelenOS-" NAME "/" VERSION
-
-static void syntax_print(void)
-{
-	fprintf(stderr, "Usage: download [-o <outfile>] <url>\n");
-	fprintf(stderr, "  Without -o, data will be written to stdout, so you may want\n");
-	fprintf(stderr, "  to redirect the output, e.g.\n");
-	fprintf(stderr, "\n");
-	fprintf(stderr, "    download http://test-ipv4.helenos.org/ | to test.html\n\n");
-}
-
-int main(int argc, char *argv[])
-{
-	int i;
-	char *ofname = NULL;
-	FILE *ofile = NULL;
-	size_t buf_size = 4096;
-	void *buf = NULL;
-	uri_t *uri = NULL;
-	http_t *http = NULL;
-	errno_t rc;
-	int ret;
-
-	if (argc < 2) {
-		syntax_print();
-		rc = EINVAL;
-		goto error;
-	}
-
-	i = 1;
-
-	if (str_cmp(argv[i], "-o") == 0) {
-		++i;
-		if (argc < i + 1) {
-			syntax_print();
-			rc = EINVAL;
-			goto error;
-		}
-
-		ofname = argv[i++];
-		ofile = fopen(ofname, "wb");
-		if (ofile == NULL) {
-			fprintf(stderr, "Error creating '%s'.\n", ofname);
-			rc = EINVAL;
-			goto error;
-		}
-	}
-
-	if (argc != i + 1) {
-		syntax_print();
-		rc = EINVAL;
-		goto error;
-	}
-
-	uri = uri_parse(argv[i]);
-	if (uri == NULL) {
-		fprintf(stderr, "Failed parsing URI\n");
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (!uri_validate(uri)) {
-		fprintf(stderr, "The URI is invalid\n");
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* TODO uri_normalize(uri) */
-
-	if (str_cmp(uri->scheme, "http") != 0) {
-		fprintf(stderr, "Only http scheme is supported at the moment\n");
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uri->host == NULL) {
-		fprintf(stderr, "host not set\n");
-		rc = EINVAL;
-		goto error;
-	}
-
-	uint16_t port = 80;
-	if (uri->port != NULL) {
-		rc = str_uint16_t(uri->port, NULL, 10, true, &port);
-		if (rc != EOK) {
-			fprintf(stderr, "Invalid port number: %s\n", uri->port);
-			rc = EINVAL;
-			goto error;
-		}
-	}
-
-	const char *path = uri->path;
-	if (path == NULL || *path == 0)
-		path = "/";
-	char *server_path = NULL;
-	if (uri->query == NULL) {
-		server_path = str_dup(path);
-		if (server_path == NULL) {
-			fprintf(stderr, "Failed allocating path\n");
-			rc = ENOMEM;
-			goto error;
-		}
-	} else {
-		ret = asprintf(&server_path, "%s?%s", path, uri->query);
-		if (ret < 0) {
-			fprintf(stderr, "Failed allocating path\n");
-			rc = ENOMEM;
-			goto error;
-		}
-	}
-
-	http_request_t *req = http_request_create("GET", server_path);
-	free(server_path);
-	if (req == NULL) {
-		fprintf(stderr, "Failed creating request\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = http_headers_append(&req->headers, "Host", uri->host);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed setting Host header: %s\n", str_error(rc));
-		goto error;
-	}
-
-	rc = http_headers_append(&req->headers, "User-Agent", USER_AGENT);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed creating User-Agent header: %s\n", str_error(rc));
-		goto error;
-	}
-
-	http = http_create(uri->host, port);
-	if (http == NULL) {
-		fprintf(stderr, "Failed creating HTTP object\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = http_connect(http);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed connecting: %s\n", str_error(rc));
-		rc = EIO;
-		goto error;
-	}
-
-	rc = http_send_request(http, req);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed sending request: %s\n", str_error(rc));
-		rc = EIO;
-		goto error;
-	}
-
-	http_response_t *response = NULL;
-	rc = http_receive_response(&http->recv_buffer, &response, 16 * 1024,
-	    100);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed receiving response: %s\n", str_error(rc));
-		rc = EIO;
-		goto error;
-	}
-
-	if (response->status != 200) {
-		fprintf(stderr, "Server returned status %d %s\n", response->status,
-		    response->message);
-	} else {
-		buf = malloc(buf_size);
-		if (buf == NULL) {
-			fprintf(stderr, "Failed allocating buffer\n)");
-			rc = ENOMEM;
-			goto error;
-		}
-
-		size_t body_size;
-		while ((rc = recv_buffer(&http->recv_buffer, buf, buf_size, &body_size)) == EOK && body_size > 0) {
-			fwrite(buf, 1, body_size, ofile != NULL ? ofile : stdout);
-		}
-
-		if (rc != EOK) {
-			fprintf(stderr, "Failed receiving body: %s", str_error(rc));
-		}
-	}
-
-	free(buf);
-	http_destroy(http);
-	uri_destroy(uri);
-	if (ofile != NULL && fclose(ofile) != 0) {
-		printf("Error writing '%s'.\n", ofname);
-		return EIO;
-	}
-
-	return EOK;
-error:
-	free(buf);
-	if (http != NULL)
-		http_destroy(http);
-	if (uri != NULL)
-		uri_destroy(uri);
-	if (ofile != NULL)
-		fclose(ofile);
-	return rc;
-}
-
-/** @}
- */
Index: pace/app/download/meson.build
===================================================================
--- uspace/app/download/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'http', 'uri' ]
-c_args += ('-DRELEASE=' + HELENOS_RELEASE)
-src = files('main.c')
Index: pace/app/edit/doc/doxygroups.h
===================================================================
--- uspace/app/edit/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup edit edit
- * @brief Text editor
- * @ingroup apps
- */
Index: pace/app/edit/edit.c
===================================================================
--- uspace/app/edit/edit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2851 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @brief Text editor.
- * @{
- */
-/**
- * @file
- */
-
-#include <align.h>
-#include <clipboard.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/cursor.h>
-#include <gfx/font.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/kbd_event.h>
-#include <io/keycode.h>
-#include <io/pos_event.h>
-#include <io/style.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <ui/control.h>
-#include <ui/filedialog.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
-#include <ui/promptdialog.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <vfs/vfs.h>
-
-#include "sheet.h"
-#include "search.h"
-
-enum redraw_flags {
-	REDRAW_TEXT	= (1 << 0),
-	REDRAW_ROW	= (1 << 1),
-	REDRAW_STATUS	= (1 << 2),
-	REDRAW_CARET	= (1 << 3)
-};
-
-/** Pane
- *
- * A rectangular area of the screen used to edit a document. Different
- * panes can be possibly used to edit the same document. This is a custom
- * UI control.
- */
-typedef struct {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	ui_window_t *window;
-
-	/** UI resource */
-	struct ui_resource *res;
-
-	/** Pane rectangle */
-	gfx_rect_t rect;
-
-	/** Pane color */
-	gfx_color_t *color;
-
-	/** Selection color */
-	gfx_color_t *sel_color;
-
-	/* Pane dimensions */
-	int rows, columns;
-
-	/* Position of the visible area */
-	int sh_row, sh_column;
-
-	/** Bitmask of components that need redrawing */
-	enum redraw_flags rflags;
-
-	/** Current position of the caret */
-	tag_t caret_pos;
-
-	/** Start of selection */
-	tag_t sel_start;
-
-	/** Active keyboard modifiers */
-	keymod_t keymod;
-
-	/**
-	 * Ideal column where the caret should try to get. This is used
-	 * for maintaining the same column during vertical movement.
-	 */
-	int ideal_column;
-
-	bool search_reverse;
-	char *previous_search;
-	bool previous_search_reverse;
-} pane_t;
-
-/** Text editor */
-typedef struct {
-	/** User interface */
-	ui_t *ui;
-	/** Editor window */
-	ui_window_t *window;
-	/** UI resource */
-	ui_resource_t *ui_res;
-	/** Menu bar */
-	ui_menu_bar_t *menubar;
-	/** Status bar */
-	ui_label_t *status;
-} edit_t;
-
-/** Document
- *
- * Associates a sheet with a file where it can be saved to.
- */
-typedef struct {
-	char *file_name;
-	sheet_t *sh;
-} doc_t;
-
-static edit_t edit;
-static doc_t doc;
-static pane_t pane;
-
-#define ROW_BUF_SIZE 4096
-#define BUF_SIZE 64
-#define TAB_WIDTH 8
-
-/** Maximum filename length that can be entered. */
-#define INFNAME_MAX_LEN 128
-
-static void cursor_setvis(bool visible);
-
-static void key_handle_press(kbd_event_t *ev);
-static void key_handle_unmod(kbd_event_t const *ev);
-static void key_handle_ctrl(kbd_event_t const *ev);
-static void key_handle_shift(kbd_event_t const *ev);
-static void key_handle_shift_ctrl(kbd_event_t const *ev);
-static void key_handle_movement(unsigned int key, bool shift);
-
-static void pos_handle(pos_event_t *ev);
-
-static errno_t file_new(void);
-static void file_open(void);
-static errno_t file_open_file(const char *fname);
-static errno_t file_save(char const *fname);
-static void file_save_as(void);
-static errno_t file_insert(const char *fname);
-static errno_t file_save_range(char const *fname, spt_t const *spos,
-    spt_t const *epos);
-static char *range_get_str(spt_t const *spos, spt_t const *epos);
-
-static errno_t pane_init(ui_window_t *, pane_t *);
-static void pane_fini(pane_t *);
-static ui_control_t *pane_ctl(pane_t *);
-static errno_t pane_update(pane_t *);
-static errno_t pane_text_display(pane_t *);
-static void pane_row_display(void);
-static errno_t pane_row_range_display(pane_t *, int r0, int r1);
-static void pane_status_display(pane_t *);
-static void pane_caret_display(pane_t *);
-
-static void insert_char(char32_t c);
-static void delete_char_before(void);
-static void delete_char_after(void);
-static void caret_update(void);
-static void caret_move_relative(int drow, int dcolumn, enum dir_spec align_dir, bool select);
-static void caret_move_absolute(int row, int column, enum dir_spec align_dir, bool select);
-static void caret_move(spt_t spt, bool select, bool update_ideal_column);
-static void caret_move_word_left(bool select);
-static void caret_move_word_right(bool select);
-static void caret_go_to_line_ask(void);
-
-static bool selection_active(void);
-static void selection_sel_all(void);
-static void selection_sel_range(spt_t pa, spt_t pb);
-static void selection_get_points(spt_t *pa, spt_t *pb);
-static void selection_delete(void);
-static void selection_copy(void);
-static void edit_cut(void);
-static void edit_paste(void);
-static void insert_clipboard_data(void);
-
-static void search(char *pattern, bool reverse);
-static void search_prompt(bool reverse);
-static void search_repeat(void);
-
-static void pt_get_sof(spt_t *pt);
-static void pt_get_eof(spt_t *pt);
-static void pt_get_sol(spt_t *cpt, spt_t *spt);
-static void pt_get_eol(spt_t *cpt, spt_t *ept);
-static bool pt_is_word_beginning(spt_t *pt);
-static bool pt_is_delimiter(spt_t *pt);
-static bool pt_is_punctuation(spt_t *pt);
-static spt_t pt_find_word_left(spt_t spt);
-static spt_t pt_find_word_left(spt_t spt);
-
-static int tag_cmp(tag_t const *a, tag_t const *b);
-static int spt_cmp(spt_t const *a, spt_t const *b);
-static int coord_cmp(coord_t const *a, coord_t const *b);
-
-static void status_display(char const *str);
-static errno_t edit_ui_create(edit_t *);
-static void edit_ui_destroy(edit_t *);
-
-static void edit_wnd_close(ui_window_t *, void *);
-static void edit_wnd_focus(ui_window_t *, void *, unsigned);
-static void edit_wnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
-static void edit_wnd_unfocus(ui_window_t *, void *, unsigned);
-
-static ui_window_cb_t edit_window_cb = {
-	.close = edit_wnd_close,
-	.focus = edit_wnd_focus,
-	.kbd = edit_wnd_kbd_event,
-	.unfocus = edit_wnd_unfocus
-};
-
-static void edit_menubar_activate(ui_menu_bar_t *, void *);
-static void edit_menubar_deactivate(ui_menu_bar_t *, void *);
-
-static ui_menu_bar_cb_t edit_menubar_cb = {
-	.activate = edit_menubar_activate,
-	.deactivate = edit_menubar_deactivate
-};
-
-static void edit_file_new(ui_menu_entry_t *, void *);
-static void edit_file_open(ui_menu_entry_t *, void *);
-static void edit_file_save(ui_menu_entry_t *, void *);
-static void edit_file_save_as(ui_menu_entry_t *, void *);
-static void edit_file_exit(ui_menu_entry_t *, void *);
-static void edit_edit_cut(ui_menu_entry_t *, void *);
-static void edit_edit_copy(ui_menu_entry_t *, void *);
-static void edit_edit_paste(ui_menu_entry_t *, void *);
-static void edit_edit_delete(ui_menu_entry_t *, void *);
-static void edit_edit_select_all(ui_menu_entry_t *, void *);
-static void edit_search_find(ui_menu_entry_t *, void *);
-static void edit_search_reverse_find(ui_menu_entry_t *, void *);
-static void edit_search_find_next(ui_menu_entry_t *, void *);
-static void edit_search_go_to_line(ui_menu_entry_t *, void *);
-
-static void pane_ctl_destroy(void *);
-static errno_t pane_ctl_paint(void *);
-static ui_evclaim_t pane_ctl_pos_event(void *, pos_event_t *);
-
-/** Pabe control ops */
-ui_control_ops_t pane_ctl_ops = {
-	.destroy = pane_ctl_destroy,
-	.paint = pane_ctl_paint,
-	.pos_event = pane_ctl_pos_event
-};
-
-static void open_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void open_dialog_bcancel(ui_file_dialog_t *, void *);
-static void open_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t open_dialog_cb = {
-	.bok = open_dialog_bok,
-	.bcancel = open_dialog_bcancel,
-	.close = open_dialog_close
-};
-
-static void save_as_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void save_as_dialog_bcancel(ui_file_dialog_t *, void *);
-static void save_as_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t save_as_dialog_cb = {
-	.bok = save_as_dialog_bok,
-	.bcancel = save_as_dialog_bcancel,
-	.close = save_as_dialog_close
-};
-
-static void go_to_line_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void go_to_line_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void go_to_line_dialog_close(ui_prompt_dialog_t *, void *);
-
-static ui_prompt_dialog_cb_t go_to_line_dialog_cb = {
-	.bok = go_to_line_dialog_bok,
-	.bcancel = go_to_line_dialog_bcancel,
-	.close =  go_to_line_dialog_close
-};
-
-static void search_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void search_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void search_dialog_close(ui_prompt_dialog_t *, void *);
-
-static ui_prompt_dialog_cb_t search_dialog_cb = {
-	.bok = search_dialog_bok,
-	.bcancel = search_dialog_bcancel,
-	.close =  search_dialog_close
-};
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	pane.sh_row = 1;
-	pane.sh_column = 1;
-
-	/* Create UI */
-	rc = edit_ui_create(&edit);
-	if (rc != EOK)
-		return 1;
-
-	if (argc == 2) {
-		doc.file_name = str_dup(argv[1]);
-		rc = file_open_file(argv[1]);
-		if (rc != EOK) {
-			status_display("File not found. Starting empty file.");
-			rc = file_new();
-		}
-	} else if (argc > 1) {
-		printf("Invalid arguments.\n");
-		return -2;
-	} else {
-		rc = file_new();
-	}
-
-	/* Initial display */
-	rc = ui_window_paint(edit.window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(edit.ui);
-
-	edit_ui_destroy(&edit);
-	return 0;
-}
-
-/** Create text editor UI.
- *
- * @param edit Editor
- * @return EOK on success or an error code
- */
-static errno_t edit_ui_create(edit_t *edit)
-{
-	errno_t rc;
-	ui_wnd_params_t params;
-	ui_fixed_t *fixed = NULL;
-	ui_menu_t *mfile = NULL;
-	ui_menu_t *medit = NULL;
-	ui_menu_entry_t *mnew = NULL;
-	ui_menu_entry_t *mopen = NULL;
-	ui_menu_entry_t *msave = NULL;
-	ui_menu_entry_t *msaveas = NULL;
-	ui_menu_entry_t *mfsep = NULL;
-	ui_menu_entry_t *mexit = NULL;
-	ui_menu_entry_t *mcut = NULL;
-	ui_menu_entry_t *mcopy = NULL;
-	ui_menu_entry_t *mpaste = NULL;
-	ui_menu_entry_t *mdelete = NULL;
-	ui_menu_entry_t *mesep = NULL;
-	ui_menu_entry_t *mselall = NULL;
-	ui_menu_t *msearch = NULL;
-	ui_menu_entry_t *mfind = NULL;
-	ui_menu_entry_t *mfindr = NULL;
-	ui_menu_entry_t *mfindn = NULL;
-	ui_menu_entry_t *mssep = NULL;
-	ui_menu_entry_t *mgoto = NULL;
-	gfx_rect_t arect;
-	gfx_rect_t rect;
-
-	rc = ui_create(UI_CONSOLE_DEFAULT, &edit->ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n",
-		    UI_CONSOLE_DEFAULT);
-		goto error;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Text Editor";
-	params.style &= ~ui_wds_decorated;
-	params.placement = ui_wnd_place_full_screen;
-
-	rc = ui_window_create(edit->ui, &params, &edit->window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(edit->window, &edit_window_cb, (void *) edit);
-
-	edit->ui_res = ui_window_get_res(edit->window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_menu_bar_create(edit->ui, edit->window, &edit->menubar);
-	if (rc != EOK) {
-		printf("Error creating menu bar.\n");
-		return rc;
-	}
-
-	ui_menu_bar_set_cb(edit->menubar, &edit_menubar_cb, (void *) edit);
-
-	rc = ui_menu_dd_create(edit->menubar, "~F~ile", NULL, &mfile);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(mfile, "~N~ew", "Ctrl-N", &mnew);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mnew, edit_file_new, (void *) edit);
-
-	rc = ui_menu_entry_create(mfile, "~O~pen", "Ctrl-O", &mopen);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mopen, edit_file_open, (void *) edit);
-
-	rc = ui_menu_entry_create(mfile, "~S~ave", "Ctrl-S", &msave);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(msave, edit_file_save, (void *) edit);
-
-	rc = ui_menu_entry_create(mfile, "Save ~A~s", "Ctrl-E", &msaveas);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(msaveas, edit_file_save_as, (void *) edit);
-
-	rc = ui_menu_entry_sep_create(mfile, &mfsep);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(mfile, "E~x~it", "Ctrl-Q", &mexit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mexit, edit_file_exit, (void *) edit);
-
-	rc = ui_menu_dd_create(edit->menubar, "~E~dit", NULL, &medit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(medit, "Cu~t~", "Ctrl-X", &mcut);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mcut, edit_edit_cut, (void *) edit);
-
-	rc = ui_menu_entry_create(medit, "~C~opy", "Ctrl-C", &mcopy);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mcopy, edit_edit_copy, (void *) edit);
-
-	rc = ui_menu_entry_create(medit, "~P~aste", "Ctrl-V", &mpaste);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mpaste, edit_edit_paste, (void *) edit);
-
-	rc = ui_menu_entry_create(medit, "~D~elete", "Del", &mdelete);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mdelete, edit_edit_delete, (void *) edit);
-
-	rc = ui_menu_entry_sep_create(medit, &mesep);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(medit, "Select ~A~ll", "Ctrl-A", &mselall);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mselall, edit_edit_select_all, (void *) edit);
-
-	rc = ui_menu_dd_create(edit->menubar, "~S~earch", NULL, &msearch);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(msearch, "~F~ind", "Ctrl-F", &mfind);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mfind, edit_search_find, (void *) edit);
-
-	rc = ui_menu_entry_create(msearch, "~R~everse Find", "Ctrl-Shift-F", &mfindr);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mfindr, edit_search_reverse_find, (void *) edit);
-
-	rc = ui_menu_entry_create(msearch, "Find ~N~ext", "Ctrl-R", &mfindn);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mfindn, edit_search_find_next, (void *) edit);
-
-	rc = ui_menu_entry_sep_create(msearch, &mssep);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(msearch, "Go To ~L~ine", "Ctrl-L", &mgoto);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mgoto, edit_search_go_to_line, (void *) edit);
-
-	ui_window_get_app_rect(edit->window, &arect);
-
-	rect.p0 = arect.p0;
-	rect.p1.x = arect.p1.x;
-	rect.p1.y = arect.p0.y + 1;
-	ui_menu_bar_set_rect(edit->menubar, &rect);
-
-	rc = ui_fixed_add(fixed, ui_menu_bar_ctl(edit->menubar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = pane_init(edit->window, &pane);
-	if (rc != EOK) {
-		printf("Error initializing pane.\n");
-		return rc;
-	}
-
-	rc = ui_fixed_add(fixed, pane_ctl(&pane));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_label_create(edit->ui_res, "", &edit->status);
-	if (rc != EOK) {
-		printf("Error creating menu bar.\n");
-		return rc;
-	}
-
-	rect.p0.x = arect.p0.x;
-	rect.p0.y = arect.p1.y - 1;
-	rect.p1 = arect.p1;
-	ui_label_set_rect(edit->status, &rect);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(edit->status));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_window_add(edit->window, ui_fixed_ctl(fixed));
-	return EOK;
-error:
-	if (edit->window != NULL)
-		ui_window_destroy(edit->window);
-	if (edit->ui != NULL)
-		ui_destroy(edit->ui);
-	return rc;
-}
-
-/** Destroy text editor UI.
- *
- * @param edit Editor
- */
-static void edit_ui_destroy(edit_t *edit)
-{
-	ui_window_destroy(edit->window);
-	ui_destroy(edit->ui);
-}
-
-/* Handle key press. */
-static void key_handle_press(kbd_event_t *ev)
-{
-	if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_SHIFT) == 0) &&
-	    (ev->mods & KM_CTRL) != 0) {
-		key_handle_ctrl(ev);
-	} else if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_CTRL) == 0) &&
-	    (ev->mods & KM_SHIFT) != 0) {
-		key_handle_shift(ev);
-	} else if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_CTRL) != 0) &&
-	    (ev->mods & KM_SHIFT) != 0) {
-		key_handle_shift_ctrl(ev);
-	} else if ((ev->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) {
-		key_handle_unmod(ev);
-	}
-}
-
-static void cursor_setvis(bool visible)
-{
-	gfx_context_t *gc = ui_window_get_gc(edit.window);
-
-	(void) gfx_cursor_set_visible(gc, visible);
-}
-
-/** Handle key without modifier. */
-static void key_handle_unmod(kbd_event_t const *ev)
-{
-	switch (ev->key) {
-	case KC_ENTER:
-		selection_delete();
-		insert_char('\n');
-		caret_update();
-		break;
-	case KC_LEFT:
-	case KC_RIGHT:
-	case KC_UP:
-	case KC_DOWN:
-	case KC_HOME:
-	case KC_END:
-	case KC_PAGE_UP:
-	case KC_PAGE_DOWN:
-		key_handle_movement(ev->key, false);
-		break;
-	case KC_BACKSPACE:
-		if (selection_active())
-			selection_delete();
-		else
-			delete_char_before();
-		caret_update();
-		break;
-	case KC_DELETE:
-		if (selection_active())
-			selection_delete();
-		else
-			delete_char_after();
-		caret_update();
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t') {
-			selection_delete();
-			insert_char(ev->c);
-			caret_update();
-		}
-		break;
-	}
-}
-
-/** Handle Shift-key combination. */
-static void key_handle_shift(kbd_event_t const *ev)
-{
-	switch (ev->key) {
-	case KC_LEFT:
-	case KC_RIGHT:
-	case KC_UP:
-	case KC_DOWN:
-	case KC_HOME:
-	case KC_END:
-	case KC_PAGE_UP:
-	case KC_PAGE_DOWN:
-		key_handle_movement(ev->key, true);
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t') {
-			selection_delete();
-			insert_char(ev->c);
-			caret_update();
-		}
-		break;
-	}
-}
-
-/** Handle Ctrl-key combination. */
-static void key_handle_ctrl(kbd_event_t const *ev)
-{
-	spt_t pt;
-	switch (ev->key) {
-	case KC_Q:
-		ui_quit(edit.ui);
-		break;
-	case KC_N:
-		file_new();
-		break;
-	case KC_O:
-		file_open();
-		break;
-	case KC_S:
-		if (doc.file_name != NULL)
-			file_save(doc.file_name);
-		else
-			file_save_as();
-		break;
-	case KC_E:
-		file_save_as();
-		break;
-	case KC_C:
-		selection_copy();
-		break;
-	case KC_V:
-		edit_paste();
-		break;
-	case KC_X:
-		edit_cut();
-		break;
-	case KC_A:
-		selection_sel_all();
-		break;
-	case KC_RIGHT:
-		caret_move_word_right(false);
-		break;
-	case KC_LEFT:
-		caret_move_word_left(false);
-		break;
-	case KC_L:
-		caret_go_to_line_ask();
-		break;
-	case KC_F:
-		search_prompt(false);
-		break;
-	case KC_R:
-		search_repeat();
-		break;
-	case KC_HOME:
-		pt_get_sof(&pt);
-		caret_move(pt, false, true);
-		break;
-	case KC_END:
-		pt_get_eof(&pt);
-		caret_move(pt, false, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void key_handle_shift_ctrl(kbd_event_t const *ev)
-{
-	spt_t pt;
-	switch (ev->key) {
-	case KC_LEFT:
-		caret_move_word_left(true);
-		break;
-	case KC_RIGHT:
-		caret_move_word_right(true);
-		break;
-	case KC_F:
-		search_prompt(true);
-		break;
-	case KC_HOME:
-		pt_get_sof(&pt);
-		caret_move(pt, true, true);
-		break;
-	case KC_END:
-		pt_get_eof(&pt);
-		caret_move(pt, true, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void pos_handle(pos_event_t *ev)
-{
-	coord_t bc;
-	spt_t pt;
-	bool select;
-
-	if (ev->type == POS_PRESS && ev->vpos < (unsigned)pane.rows) {
-		bc.row = pane.sh_row + ev->vpos - pane.rect.p0.y;
-		bc.column = pane.sh_column + ev->hpos - pane.rect.p0.x;
-		sheet_get_cell_pt(doc.sh, &bc, dir_before, &pt);
-
-		select = (pane.keymod & KM_SHIFT) != 0;
-
-		caret_move(pt, select, true);
-		pane_update(&pane);
-	}
-}
-
-/** Move caret while preserving or resetting selection. */
-static void caret_move(spt_t new_caret_pt, bool select, bool update_ideal_column)
-{
-	spt_t old_caret_pt, old_sel_pt;
-	coord_t c_old, c_new;
-	bool had_sel;
-
-	/* Check if we had selection before. */
-	tag_get_pt(&pane.caret_pos, &old_caret_pt);
-	tag_get_pt(&pane.sel_start, &old_sel_pt);
-	had_sel = !spt_equal(&old_caret_pt, &old_sel_pt);
-
-	/* Place tag of the caret */
-	sheet_remove_tag(doc.sh, &pane.caret_pos);
-	sheet_place_tag(doc.sh, &new_caret_pt, &pane.caret_pos);
-
-	if (select == false) {
-		/* Move sel_start to the same point as caret. */
-		sheet_remove_tag(doc.sh, &pane.sel_start);
-		sheet_place_tag(doc.sh, &new_caret_pt, &pane.sel_start);
-	}
-
-	spt_get_coord(&new_caret_pt, &c_new);
-	if (select) {
-		spt_get_coord(&old_caret_pt, &c_old);
-
-		if (c_old.row == c_new.row)
-			pane.rflags |= REDRAW_ROW;
-		else
-			pane.rflags |= REDRAW_TEXT;
-
-	} else if (had_sel == true) {
-		/* Redraw because text was unselected. */
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (update_ideal_column)
-		pane.ideal_column = c_new.column;
-
-	caret_update();
-}
-
-static void key_handle_movement(unsigned int key, bool select)
-{
-	spt_t pt;
-	switch (key) {
-	case KC_LEFT:
-		caret_move_relative(0, -1, dir_before, select);
-		break;
-	case KC_RIGHT:
-		caret_move_relative(0, 0, dir_after, select);
-		break;
-	case KC_UP:
-		caret_move_relative(-1, 0, dir_before, select);
-		break;
-	case KC_DOWN:
-		caret_move_relative(+1, 0, dir_before, select);
-		break;
-	case KC_HOME:
-		tag_get_pt(&pane.caret_pos, &pt);
-		pt_get_sol(&pt, &pt);
-		caret_move(pt, select, true);
-		break;
-	case KC_END:
-		tag_get_pt(&pane.caret_pos, &pt);
-		pt_get_eol(&pt, &pt);
-		caret_move(pt, select, true);
-		break;
-	case KC_PAGE_UP:
-		caret_move_relative(-pane.rows, 0, dir_before, select);
-		break;
-	case KC_PAGE_DOWN:
-		caret_move_relative(+pane.rows, 0, dir_before, select);
-		break;
-	default:
-		break;
-	}
-}
-
-/** Create new document. */
-static errno_t file_new(void)
-{
-	errno_t rc;
-	sheet_t *sh;
-
-	/* Create empty sheet. */
-	rc = sheet_create(&sh);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	if (doc.sh != NULL)
-		sheet_destroy(doc.sh);
-
-	doc.sh = sh;
-
-	/* Place caret at the beginning of file. */
-	spt_t sof;
-	pt_get_sof(&sof);
-	sheet_place_tag(doc.sh, &sof, &pane.caret_pos);
-	pane.ideal_column = 1;
-
-	doc.file_name = NULL;
-
-	/* Place selection start tag. */
-	sheet_place_tag(doc.sh, &sof, &pane.sel_start);
-
-	/* Move to beginning of file. */
-	pt_get_sof(&sof);
-
-	caret_move(sof, true, true);
-
-	pane_status_display(&pane);
-	pane_caret_display(&pane);
-	pane_text_display(&pane);
-	cursor_setvis(true);
-
-	return EOK;
-}
-
-/** Open Open File dialog. */
-static void file_open(void)
-{
-	const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
-	ui_file_dialog_params_t fdparams;
-	ui_file_dialog_t *dialog;
-	errno_t rc;
-
-	ui_file_dialog_params_init(&fdparams);
-	fdparams.caption = "Open File";
-	fdparams.ifname = old_fname;
-
-	rc = ui_file_dialog_create(edit.ui, &fdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_file_dialog_set_cb(dialog, &open_dialog_cb, &edit);
-}
-
-/** Open exising document. */
-static errno_t file_open_file(const char *fname)
-{
-	errno_t rc;
-	sheet_t *sh;
-	char *fn;
-
-	/* Create empty sheet. */
-	rc = sheet_create(&sh);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	fn = str_dup(fname);
-	if (fn == NULL) {
-		sheet_destroy(sh);
-		return ENOMEM;
-	}
-
-	if (doc.sh != NULL)
-		sheet_destroy(doc.sh);
-
-	doc.sh = sh;
-
-	/* Place caret at the beginning of file. */
-	spt_t sof;
-	pt_get_sof(&sof);
-	sheet_place_tag(doc.sh, &sof, &pane.caret_pos);
-	pane.ideal_column = 1;
-
-	rc = file_insert(fname);
-	if (rc != EOK)
-		return rc;
-
-	doc.file_name = fn;
-
-	/* Place selection start tag. */
-	sheet_place_tag(doc.sh, &sof, &pane.sel_start);
-
-	/* Move to beginning of file. */
-	pt_get_sof(&sof);
-
-	caret_move(sof, true, true);
-
-	pane_status_display(&pane);
-	pane_caret_display(&pane);
-	pane_text_display(&pane);
-	cursor_setvis(true);
-
-	return EOK;
-}
-
-/** Save the document. */
-static errno_t file_save(char const *fname)
-{
-	spt_t sp, ep;
-	errno_t rc;
-
-	status_display("Saving...");
-	pt_get_sof(&sp);
-	pt_get_eof(&ep);
-
-	rc = file_save_range(fname, &sp, &ep);
-
-	switch (rc) {
-	case EINVAL:
-		status_display("Error opening file!");
-		break;
-	case EIO:
-		status_display("Error writing data!");
-		break;
-	default:
-		status_display("File saved.");
-		break;
-	}
-
-	return rc;
-}
-
-/** Open Save As dialog. */
-static void file_save_as(void)
-{
-	const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
-	ui_file_dialog_params_t fdparams;
-	ui_file_dialog_t *dialog;
-	errno_t rc;
-
-	ui_file_dialog_params_init(&fdparams);
-	fdparams.caption = "Save As";
-	fdparams.ifname = old_fname;
-
-	rc = ui_file_dialog_create(edit.ui, &fdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_file_dialog_set_cb(dialog, &save_as_dialog_cb, &edit);
-}
-
-/** Insert file at caret position.
- *
- * Reads in the contents of a file and inserts them at the current position
- * of the caret.
- */
-static errno_t file_insert(const char *fname)
-{
-	FILE *f;
-	char32_t c;
-	char buf[BUF_SIZE];
-	int bcnt;
-	int n_read;
-	size_t off;
-
-	f = fopen(fname, "rt");
-	if (f == NULL)
-		return EINVAL;
-
-	bcnt = 0;
-
-	while (true) {
-		if (bcnt < STR_BOUNDS(1)) {
-			n_read = fread(buf + bcnt, 1, BUF_SIZE - bcnt, f);
-			bcnt += n_read;
-		}
-
-		off = 0;
-		c = str_decode(buf, &off, bcnt);
-		if (c == '\0')
-			break;
-
-		bcnt -= off;
-		memmove(buf, buf + off, bcnt);
-
-		insert_char(c);
-	}
-
-	fclose(f);
-
-	return EOK;
-}
-
-/** Save a range of text into a file. */
-static errno_t file_save_range(char const *fname, spt_t const *spos,
-    spt_t const *epos)
-{
-	FILE *f;
-	char buf[BUF_SIZE];
-	spt_t sp, bep;
-	size_t bytes, n_written;
-
-	f = fopen(fname, "wt");
-	if (f == NULL)
-		return EINVAL;
-
-	sp = *spos;
-
-	do {
-		sheet_copy_out(doc.sh, &sp, epos, buf, BUF_SIZE, &bep);
-		bytes = str_size(buf);
-
-		n_written = fwrite(buf, 1, bytes, f);
-		if (n_written != bytes) {
-			return EIO;
-		}
-
-		sp = bep;
-	} while (!spt_equal(&bep, epos));
-
-	if (fclose(f) < 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Return contents of range as a new string. */
-static char *range_get_str(spt_t const *spos, spt_t const *epos)
-{
-	char *buf;
-	spt_t sp, bep;
-	size_t bytes;
-	size_t buf_size, bpos;
-
-	buf_size = 1;
-
-	buf = malloc(buf_size);
-	if (buf == NULL)
-		return NULL;
-
-	bpos = 0;
-	sp = *spos;
-
-	while (true) {
-		sheet_copy_out(doc.sh, &sp, epos, &buf[bpos], buf_size - bpos,
-		    &bep);
-		bytes = str_size(&buf[bpos]);
-		bpos += bytes;
-		sp = bep;
-
-		if (spt_equal(&bep, epos))
-			break;
-
-		buf_size *= 2;
-		char *tmp = realloc(buf, buf_size);
-		if (tmp == NULL) {
-			free(buf);
-			return NULL;
-		}
-		buf = tmp;
-	}
-
-	return buf;
-}
-
-/** Initialize pane.
- *
- * TODO: Replace with pane_create() that allocates the pane.
- *
- * @param window Editor window
- * @param pane Pane
- * @return EOK on success or an error code
- */
-static errno_t pane_init(ui_window_t *window, pane_t *pane)
-{
-	errno_t rc;
-	gfx_rect_t arect;
-
-	pane->control = NULL;
-	pane->color = NULL;
-	pane->sel_color = NULL;
-
-	rc = ui_control_new(&pane_ctl_ops, (void *) pane, &pane->control);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &pane->color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x1e, &pane->sel_color);
-	if (rc != EOK)
-		goto error;
-
-	pane->res = ui_window_get_res(window);
-	pane->window = window;
-
-	ui_window_get_app_rect(window, &arect);
-	pane->rect.p0.x = arect.p0.x;
-	pane->rect.p0.y = arect.p0.y + 1;
-	pane->rect.p1.x = arect.p1.x;
-	pane->rect.p1.y = arect.p1.y - 1;
-
-	pane->columns = pane->rect.p1.x - pane->rect.p0.x;
-	pane->rows = pane->rect.p1.y - pane->rect.p0.y;
-
-	return EOK;
-error:
-	if (pane->control != NULL) {
-		ui_control_delete(pane->control);
-		pane->control = NULL;
-	}
-
-	if (pane->color != NULL) {
-		gfx_color_delete(pane->color);
-		pane->color = NULL;
-	}
-
-	return rc;
-}
-
-/** Finalize pane.
- *
- * TODO: Replace with pane_destroy() that deallocates the pane.
- *
- * @param pane Pane
- */
-static void pane_fini(pane_t *pane)
-{
-	gfx_color_delete(pane->color);
-	pane->color = NULL;
-	gfx_color_delete(pane->sel_color);
-	pane->sel_color = NULL;
-	ui_control_delete(pane->control);
-	pane->control = NULL;
-}
-
-/** Return base control object for a pane.
- *
- * @param pane Pane
- * @return Base UI cntrol
- */
-static ui_control_t *pane_ctl(pane_t *pane)
-{
-	return pane->control;
-}
-
-/** Repaint parts of pane that need updating.
- *
- * @param pane Pane
- * @return EOK on succes or an error code
- */
-static errno_t pane_update(pane_t *pane)
-{
-	errno_t rc;
-
-	if (pane->rflags & REDRAW_TEXT) {
-		rc = pane_text_display(pane);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (pane->rflags & REDRAW_ROW)
-		pane_row_display();
-
-	if (pane->rflags & REDRAW_STATUS)
-		pane_status_display(pane);
-
-	if (pane->rflags & REDRAW_CARET)
-		pane_caret_display(pane);
-
-	pane->rflags &= ~(REDRAW_TEXT | REDRAW_ROW | REDRAW_STATUS |
-	    REDRAW_CARET);
-	return EOK;
-}
-
-/** Display pane text.
- *
- * @param pane Pane
- * @return EOK on success or an error code
- */
-static errno_t pane_text_display(pane_t *pane)
-{
-	gfx_rect_t rect;
-	gfx_context_t *gc;
-	errno_t rc;
-	int sh_rows, rows;
-
-	sheet_get_num_rows(doc.sh, &sh_rows);
-	rows = min(sh_rows - pane->sh_row + 1, pane->rows);
-
-	/* Draw rows from the sheet. */
-
-	rc = pane_row_range_display(pane, 0, rows);
-	if (rc != EOK)
-		return rc;
-
-	/* Clear the remaining rows if file is short. */
-
-	gc = ui_window_get_gc(pane->window);
-
-	rc = gfx_set_color(gc, pane->color);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pane->rect.p0.x;
-	rect.p0.y = pane->rect.p0.y + rows;
-	rect.p1.x = pane->rect.p1.x;
-	rect.p1.y = pane->rect.p1.y;
-
-	rc = gfx_fill_rect(gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	pane->rflags &= ~REDRAW_ROW;
-	return EOK;
-error:
-	return rc;
-}
-
-/** Display just the row where the caret is. */
-static void pane_row_display(void)
-{
-	spt_t caret_pt;
-	coord_t coord;
-	int ridx;
-
-	tag_get_pt(&pane.caret_pos, &caret_pt);
-	spt_get_coord(&caret_pt, &coord);
-
-	ridx = coord.row - pane.sh_row;
-	(void) pane_row_range_display(&pane, ridx, ridx + 1);
-	pane.rflags |= (REDRAW_STATUS | REDRAW_CARET);
-}
-
-/** Display a range of rows of text.
- *
- * @param r0 Start row (inclusive)
- * @param r1 End row (exclusive)
- * @return EOk on success or an error code
- */
-static errno_t pane_row_range_display(pane_t *pane, int r0, int r1)
-{
-	int i, fill;
-	spt_t rb, re, dep, pt;
-	coord_t rbc, rec;
-	char row_buf[ROW_BUF_SIZE];
-	char cbuf[STR_BOUNDS(1) + 1];
-	char32_t c;
-	size_t pos, size;
-	size_t cpos;
-	int s_column;
-	coord_t csel_start, csel_end, ctmp;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t tpos;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	font = ui_resource_get_font(edit.ui_res);
-	gc = ui_window_get_gc(edit.window);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = pane->color;
-
-	/* Determine selection start and end. */
-
-	tag_get_pt(&pane->sel_start, &pt);
-	spt_get_coord(&pt, &csel_start);
-
-	tag_get_pt(&pane->caret_pos, &pt);
-	spt_get_coord(&pt, &csel_end);
-
-	if (coord_cmp(&csel_start, &csel_end) > 0) {
-		ctmp = csel_start;
-		csel_start = csel_end;
-		csel_end = ctmp;
-	}
-
-	/* Draw rows from the sheet. */
-
-	for (i = r0; i < r1; ++i) {
-		tpos.x = pane->rect.p0.x;
-		tpos.y = pane->rect.p0.y + i;
-
-		/* Starting point for row display */
-		rbc.row = pane->sh_row + i;
-		rbc.column = pane->sh_column;
-		sheet_get_cell_pt(doc.sh, &rbc, dir_before, &rb);
-
-		/* Ending point for row display */
-		rec.row = pane->sh_row + i;
-		rec.column = pane->sh_column + pane->columns;
-		sheet_get_cell_pt(doc.sh, &rec, dir_before, &re);
-
-		/* Copy the text of the row to the buffer. */
-		sheet_copy_out(doc.sh, &rb, &re, row_buf, ROW_BUF_SIZE, &dep);
-
-		/* Display text from the buffer. */
-
-		if (coord_cmp(&csel_start, &rbc) <= 0 &&
-		    coord_cmp(&rbc, &csel_end) < 0) {
-			fmt.color = pane->sel_color;
-		}
-
-		size = str_size(row_buf);
-		pos = 0;
-		s_column = pane->sh_column;
-		while (pos < size) {
-			if ((csel_start.row == rbc.row) && (csel_start.column == s_column))
-				fmt.color = pane->sel_color;
-
-			if ((csel_end.row == rbc.row) && (csel_end.column == s_column))
-				fmt.color = pane->color;
-
-			c = str_decode(row_buf, &pos, size);
-			if (c != '\t') {
-				cpos = 0;
-				rc = chr_encode(c, cbuf, &cpos, sizeof(cbuf));
-				if (rc != EOK)
-					return rc;
-
-				rc = gfx_puttext(&tpos, &fmt, cbuf);
-				if (rc != EOK)
-					return rc;
-
-				s_column += 1;
-				tpos.x++;
-			} else {
-				fill = 1 + ALIGN_UP(s_column, TAB_WIDTH) -
-				    s_column;
-
-				rc = gfx_set_color(gc, fmt.color);
-				if (rc != EOK)
-					return rc;
-
-				rect.p0.x = tpos.x;
-				rect.p0.y = tpos.y;
-				rect.p1.x = tpos.x + fill;
-				rect.p1.y = tpos.y + 1;
-
-				rc = gfx_fill_rect(gc, &rect);
-				if (rc != EOK)
-					return rc;
-
-				s_column += fill;
-				tpos.x += fill;
-			}
-		}
-
-		if ((csel_end.row == rbc.row) && (csel_end.column == s_column))
-			fmt.color = pane->color;
-
-		/* Fill until the end of display area. */
-
-		rc = gfx_set_color(gc, fmt.color);
-		if (rc != EOK)
-			return rc;
-
-		rect.p0.x = tpos.x;
-		rect.p0.y = tpos.y;
-		rect.p1.x = pane->rect.p1.x;
-		rect.p1.y = tpos.y + 1;
-
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Display pane status in the status line.
- *
- * @param pane Pane
- */
-static void pane_status_display(pane_t *pane)
-{
-	spt_t caret_pt;
-	coord_t coord;
-	int last_row;
-	char *fname;
-	char *p;
-	char *text;
-	size_t n;
-	size_t nextra;
-	size_t fnw;
-
-	tag_get_pt(&pane->caret_pos, &caret_pt);
-	spt_get_coord(&caret_pt, &coord);
-
-	sheet_get_num_rows(doc.sh, &last_row);
-
-	if (doc.file_name != NULL) {
-		/* Remove directory component */
-		p = str_rchr(doc.file_name, '/');
-		if (p != NULL)
-			fname = str_dup(p + 1);
-		else
-			fname = str_dup(doc.file_name);
-	} else {
-		fname = str_dup("<unnamed>");
-	}
-
-	if (fname == NULL)
-		return;
-
-	/*
-	 * Make sure the status fits on the screen. This loop should
-	 * be executed at most twice.
-	 */
-	while (true) {
-		int rc = asprintf(&text, "%d, %d (%d): File '%s'. Ctrl-Q Quit  "
-		    "F10 Menu", coord.row, coord.column, last_row, fname);
-		if (rc < 0) {
-			n = 0;
-			goto finish;
-		}
-
-		/* If it already fits, we're done */
-		n = str_width(text);
-		if ((int)n <= pane->columns - 2)
-			break;
-
-		/* Compute number of excess characters */
-		nextra = n - (pane->columns - 2);
-		/** With of the file name part */
-		fnw = str_width(fname);
-
-		/*
-		 * If reducing file name to two characters '..' won't help,
-		 * just give up and print a blank status.
-		 */
-		if (nextra > fnw - 2) {
-			text[0] = '\0';
-			goto finish;
-		}
-
-		/* Compute position where we overwrite with '..\0' */
-		if (fnw >= nextra + 2) {
-			p = fname + str_lsize(fname, fnw - nextra - 2);
-		} else {
-			p = fname;
-		}
-
-		/* Shorten the string */
-		p[0] = p[1] = '.';
-		p[2] = '\0';
-
-		/* Need to format the string once more. */
-		free(text);
-	}
-
-finish:
-	(void) ui_label_set_text(edit.status, text);
-	(void) ui_label_paint(edit.status);
-	free(text);
-	free(fname);
-}
-
-/** Set cursor to reflect position of the caret.
- *
- * @param pane Pane
- */
-static void pane_caret_display(pane_t *pane)
-{
-	spt_t caret_pt;
-	coord_t coord;
-	gfx_coord2_t pos;
-	gfx_context_t *gc;
-
-	tag_get_pt(&pane->caret_pos, &caret_pt);
-
-	spt_get_coord(&caret_pt, &coord);
-
-	gc = ui_window_get_gc(edit.window);
-	pos.x = pane->rect.p0.x + coord.column - pane->sh_column;
-	pos.y = pane->rect.p0.y + coord.row - pane->sh_row;
-
-	(void) gfx_cursor_set_pos(gc, &pos);
-}
-
-/** Destroy pane control.
- *
- * @param arg Argument (pane_t *)
- */
-static void pane_ctl_destroy(void *arg)
-{
-	pane_t *pane = (pane_t *)arg;
-
-	pane_fini(pane);
-}
-
-/** Paint pane control.
- *
- * @param arg Argument (pane_t *)
- */
-static errno_t pane_ctl_paint(void *arg)
-{
-	pane_t *pane = (pane_t *)arg;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	gc = ui_window_get_gc(pane->window);
-
-	rc = pane_text_display(pane);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		goto error;
-
-error:
-	return rc;
-}
-
-/** Handle pane control position event.
- *
- * @param arg Argument (pane_t *)
- * @param event Position event
- */
-static ui_evclaim_t pane_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	if (!gfx_pix_inside_rect(&pos, &pane.rect))
-		return ui_unclaimed;
-
-	pos_handle(event);
-	(void) gfx_update(ui_window_get_gc(edit.window));
-	return ui_claimed;
-}
-
-/** Insert a character at caret position. */
-static void insert_char(char32_t c)
-{
-	spt_t pt;
-	char cbuf[STR_BOUNDS(1) + 1];
-	size_t offs;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-
-	offs = 0;
-	chr_encode(c, cbuf, &offs, STR_BOUNDS(1) + 1);
-	cbuf[offs] = '\0';
-
-	(void) sheet_insert(doc.sh, &pt, dir_before, cbuf);
-
-	pane.rflags |= REDRAW_ROW;
-	if (c == '\n')
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Delete the character before the caret. */
-static void delete_char_before(void)
-{
-	spt_t sp, ep;
-	coord_t coord;
-
-	tag_get_pt(&pane.caret_pos, &ep);
-	spt_get_coord(&ep, &coord);
-
-	coord.column -= 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, &sp);
-
-	(void) sheet_delete(doc.sh, &sp, &ep);
-
-	pane.rflags |= REDRAW_ROW;
-	if (coord.column < 1)
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Delete the character after the caret. */
-static void delete_char_after(void)
-{
-	spt_t sp, ep;
-	coord_t sc, ec;
-
-	tag_get_pt(&pane.caret_pos, &sp);
-	spt_get_coord(&sp, &sc);
-
-	sheet_get_cell_pt(doc.sh, &sc, dir_after, &ep);
-	spt_get_coord(&ep, &ec);
-
-	(void) sheet_delete(doc.sh, &sp, &ep);
-
-	pane.rflags |= REDRAW_ROW;
-	if (ec.row != sc.row)
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Scroll pane after caret has moved.
- *
- * After modifying the position of the caret, this is called to scroll
- * the pane to ensure that the caret is in the visible area.
- */
-static void caret_update(void)
-{
-	spt_t pt;
-	coord_t coord;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_get_coord(&pt, &coord);
-
-	/* Scroll pane vertically. */
-
-	if (coord.row < pane.sh_row) {
-		pane.sh_row = coord.row;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (coord.row > pane.sh_row + pane.rows - 1) {
-		pane.sh_row = coord.row - pane.rows + 1;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	/* Scroll pane horizontally. */
-
-	if (coord.column < pane.sh_column) {
-		pane.sh_column = coord.column;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (coord.column > pane.sh_column + pane.columns - 1) {
-		pane.sh_column = coord.column - pane.columns + 1;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	pane.rflags |= (REDRAW_CARET | REDRAW_STATUS);
-}
-
-/** Relatively move caret position.
- *
- * Moves caret relatively to the current position. Looking at the first
- * character cell after the caret and moving by @a drow and @a dcolumn, we get
- * to a new character cell, and thus a new character. Then we either go to the
- * point before the the character or after it, depending on @a align_dir.
- *
- * @param select true if the selection tag should stay where it is
- */
-static void caret_move_relative(int drow, int dcolumn, enum dir_spec align_dir,
-    bool select)
-{
-	spt_t pt;
-	coord_t coord;
-	int num_rows;
-	bool pure_vertical;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_get_coord(&pt, &coord);
-	coord.row += drow;
-	coord.column += dcolumn;
-
-	/* Clamp coordinates. */
-	if (drow < 0 && coord.row < 1)
-		coord.row = 1;
-	if (dcolumn < 0 && coord.column < 1) {
-		if (coord.row < 2)
-			coord.column = 1;
-		else {
-			coord.row--;
-			sheet_get_row_width(doc.sh, coord.row, &coord.column);
-		}
-	}
-	if (drow > 0) {
-		sheet_get_num_rows(doc.sh, &num_rows);
-		if (coord.row > num_rows)
-			coord.row = num_rows;
-	}
-
-	/* For purely vertical movement try attaining @c ideal_column. */
-	pure_vertical = (dcolumn == 0 && align_dir == dir_before);
-	if (pure_vertical)
-		coord.column = pane.ideal_column;
-
-	/*
-	 * Select the point before or after the character at the designated
-	 * coordinates. The character can be wider than one cell (e.g. tab).
-	 */
-	sheet_get_cell_pt(doc.sh, &coord, align_dir, &pt);
-
-	/* For non-vertical movement set the new value for @c ideal_column. */
-	caret_move(pt, select, !pure_vertical);
-}
-
-/** Absolutely move caret position.
- *
- * Moves caret to a specified position. We get to a new character cell, and
- * thus a new character. Then we either go to the point before the the character
- * or after it, depending on @a align_dir.
- *
- * @param select true if the selection tag should stay where it is
- */
-static void caret_move_absolute(int row, int column, enum dir_spec align_dir,
-    bool select)
-{
-	coord_t coord;
-	coord.row = row;
-	coord.column = column;
-
-	spt_t pt;
-	sheet_get_cell_pt(doc.sh, &coord, align_dir, &pt);
-
-	caret_move(pt, select, true);
-}
-
-/** Find beginning of a word to the left of spt */
-static spt_t pt_find_word_left(spt_t spt)
-{
-	do {
-		spt_prev_char(spt, &spt);
-	} while (!pt_is_word_beginning(&spt));
-	return spt;
-}
-
-/** Find beginning of a word to the right of spt */
-static spt_t pt_find_word_right(spt_t spt)
-{
-	do {
-		spt_next_char(spt, &spt);
-	} while (!pt_is_word_beginning(&spt));
-	return spt;
-}
-
-static void caret_move_word_left(bool select)
-{
-	spt_t pt;
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_t word_left = pt_find_word_left(pt);
-	caret_move(word_left, select, true);
-}
-
-static void caret_move_word_right(bool select)
-{
-	spt_t pt;
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_t word_right = pt_find_word_right(pt);
-	caret_move(word_right, select, true);
-}
-
-/** Ask for line and go to it. */
-static void caret_go_to_line_ask(void)
-{
-	ui_prompt_dialog_params_t pdparams;
-	ui_prompt_dialog_t *dialog;
-	errno_t rc;
-
-	ui_prompt_dialog_params_init(&pdparams);
-	pdparams.caption = "Go To Line";
-	pdparams.prompt = "Line Number";
-
-	rc = ui_prompt_dialog_create(edit.ui, &pdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating prompt dialog.\n");
-		return;
-	}
-
-	ui_prompt_dialog_set_cb(dialog, &go_to_line_dialog_cb, &edit);
-}
-
-/* Search operations */
-static errno_t search_spt_producer(void *data, char32_t *ret)
-{
-	assert(data != NULL);
-	assert(ret != NULL);
-	spt_t *spt = data;
-	*ret = spt_next_char(*spt, spt);
-	return EOK;
-}
-
-static errno_t search_spt_reverse_producer(void *data, char32_t *ret)
-{
-	assert(data != NULL);
-	assert(ret != NULL);
-	spt_t *spt = data;
-	*ret = spt_prev_char(*spt, spt);
-	return EOK;
-}
-
-static errno_t search_spt_mark(void *data, void **mark)
-{
-	assert(data != NULL);
-	assert(mark != NULL);
-	spt_t *spt = data;
-	spt_t *new = calloc(1, sizeof(spt_t));
-	*mark = new;
-	if (new == NULL)
-		return ENOMEM;
-	*new = *spt;
-	return EOK;
-}
-
-static void search_spt_mark_free(void *data)
-{
-	free(data);
-}
-
-static search_ops_t search_spt_ops = {
-	.equals = char_exact_equals,
-	.producer = search_spt_producer,
-	.mark = search_spt_mark,
-	.mark_free = search_spt_mark_free,
-};
-
-static search_ops_t search_spt_reverse_ops = {
-	.equals = char_exact_equals,
-	.producer = search_spt_reverse_producer,
-	.mark = search_spt_mark,
-	.mark_free = search_spt_mark_free,
-};
-
-/** Ask for line and go to it. */
-static void search_prompt(bool reverse)
-{
-	ui_prompt_dialog_params_t pdparams;
-	ui_prompt_dialog_t *dialog;
-	errno_t rc;
-
-	ui_prompt_dialog_params_init(&pdparams);
-	pdparams.caption = reverse ? "Reverse Search" : "Search";
-	pdparams.prompt = "Search text";
-	pdparams.itext = "";
-
-	if (pane.previous_search)
-		pdparams.itext = pane.previous_search;
-
-	rc = ui_prompt_dialog_create(edit.ui, &pdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating prompt dialog.\n");
-		return;
-	}
-
-	ui_prompt_dialog_set_cb(dialog, &search_dialog_cb, &edit);
-	pane.search_reverse = reverse;
-}
-
-static void search_repeat(void)
-{
-	if (pane.previous_search == NULL) {
-		status_display("No previous search to repeat.");
-		return;
-	}
-
-	search(pane.previous_search, pane.previous_search_reverse);
-}
-
-static void search(char *pattern, bool reverse)
-{
-	status_display("Searching...");
-
-	spt_t sp, producer_pos;
-	tag_get_pt(&pane.caret_pos, &sp);
-
-	/* Start searching on the position before/after caret */
-	if (!reverse) {
-		spt_next_char(sp, &sp);
-	} else {
-		spt_prev_char(sp, &sp);
-	}
-	producer_pos = sp;
-
-	search_ops_t ops = search_spt_ops;
-	if (reverse)
-		ops = search_spt_reverse_ops;
-
-	search_t *search = search_init(pattern, &producer_pos, ops, reverse);
-	if (search == NULL) {
-		status_display("Failed initializing search.");
-		return;
-	}
-
-	match_t match;
-	errno_t rc = search_next_match(search, &match);
-	if (rc != EOK) {
-		status_display("Failed searching.");
-		search_fini(search);
-	}
-
-	if (match.end) {
-		status_display("Match found.");
-		assert(match.end != NULL);
-		spt_t *end = match.end;
-		caret_move(*end, false, true);
-		while (match.length > 0) {
-			match.length--;
-			if (reverse) {
-				spt_next_char(*end, end);
-			} else {
-				spt_prev_char(*end, end);
-			}
-		}
-		caret_move(*end, true, true);
-		free(end);
-	} else {
-		status_display("Not found.");
-	}
-
-	search_fini(search);
-}
-
-/** Check for non-empty selection. */
-static bool selection_active(void)
-{
-	return (tag_cmp(&pane.caret_pos, &pane.sel_start) != 0);
-}
-
-static void selection_get_points(spt_t *pa, spt_t *pb)
-{
-	spt_t pt;
-
-	tag_get_pt(&pane.sel_start, pa);
-	tag_get_pt(&pane.caret_pos, pb);
-
-	if (spt_cmp(pa, pb) > 0) {
-		pt = *pa;
-		*pa = *pb;
-		*pb = pt;
-	}
-}
-
-/** Delete selected text. */
-static void selection_delete(void)
-{
-	spt_t pa, pb;
-	coord_t ca, cb;
-	int rel;
-
-	tag_get_pt(&pane.sel_start, &pa);
-	tag_get_pt(&pane.caret_pos, &pb);
-	spt_get_coord(&pa, &ca);
-	spt_get_coord(&pb, &cb);
-	rel = coord_cmp(&ca, &cb);
-
-	if (rel == 0)
-		return;
-
-	if (rel < 0)
-		sheet_delete(doc.sh, &pa, &pb);
-	else
-		sheet_delete(doc.sh, &pb, &pa);
-
-	if (ca.row == cb.row)
-		pane.rflags |= REDRAW_ROW;
-	else
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Select all text in the editor */
-static void selection_sel_all(void)
-{
-	spt_t spt, ept;
-
-	pt_get_sof(&spt);
-	pt_get_eof(&ept);
-
-	selection_sel_range(spt, ept);
-}
-
-/** Select select all text in a given range with the given direction */
-static void selection_sel_range(spt_t pa, spt_t pb)
-{
-	sheet_remove_tag(doc.sh, &pane.sel_start);
-	sheet_place_tag(doc.sh, &pa, &pane.sel_start);
-	sheet_remove_tag(doc.sh, &pane.caret_pos);
-	sheet_place_tag(doc.sh, &pb, &pane.caret_pos);
-
-	pane.rflags |= REDRAW_TEXT;
-	caret_update();
-}
-
-static void selection_copy(void)
-{
-	spt_t pa, pb;
-	char *str;
-
-	selection_get_points(&pa, &pb);
-	str = range_get_str(&pa, &pb);
-	if (str == NULL || clipboard_put_str(str) != EOK) {
-		status_display("Copying to clipboard failed!");
-	}
-	free(str);
-}
-
-static void edit_paste(void)
-{
-	selection_delete();
-	insert_clipboard_data();
-	pane.rflags |= (REDRAW_TEXT | REDRAW_CARET);
-	pane_update(&pane);
-}
-
-static void edit_cut(void)
-{
-	selection_copy();
-	selection_delete();
-	pane.rflags |= (REDRAW_TEXT | REDRAW_CARET);
-	pane_update(&pane);
-}
-
-static void insert_clipboard_data(void)
-{
-	char *str;
-	size_t off;
-	char32_t c;
-	errno_t rc;
-
-	rc = clipboard_get_str(&str);
-	if (rc != EOK || str == NULL)
-		return;
-
-	off = 0;
-
-	while (true) {
-		c = str_decode(str, &off, STR_NO_LIMIT);
-		if (c == '\0')
-			break;
-
-		insert_char(c);
-	}
-
-	free(str);
-}
-
-/** Get start-of-file s-point. */
-static void pt_get_sof(spt_t *pt)
-{
-	coord_t coord;
-
-	coord.row = coord.column = 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, pt);
-}
-
-/** Get end-of-file s-point. */
-static void pt_get_eof(spt_t *pt)
-{
-	coord_t coord;
-	int num_rows;
-
-	sheet_get_num_rows(doc.sh, &num_rows);
-	coord.row = num_rows + 1;
-	coord.column = 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, pt);
-}
-
-/** Get start-of-line s-point for given s-point cpt */
-static void pt_get_sol(spt_t *cpt, spt_t *spt)
-{
-	coord_t coord;
-
-	spt_get_coord(cpt, &coord);
-	coord.column = 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, spt);
-}
-
-/** Get end-of-line s-point for given s-point cpt */
-static void pt_get_eol(spt_t *cpt, spt_t *ept)
-{
-	coord_t coord;
-	int row_width;
-
-	spt_get_coord(cpt, &coord);
-	sheet_get_row_width(doc.sh, coord.row, &row_width);
-	coord.column = row_width - 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, ept);
-}
-
-/** Check whether the spt is at a beginning of a word */
-static bool pt_is_word_beginning(spt_t *pt)
-{
-	spt_t lp, sfp, efp, slp, elp;
-	coord_t coord;
-
-	pt_get_sof(&sfp);
-	pt_get_eof(&efp);
-	pt_get_sol(pt, &slp);
-	pt_get_eol(pt, &elp);
-
-	/* the spt is at the beginning or end of the file or line */
-	if ((spt_cmp(&sfp, pt) == 0) || (spt_cmp(&efp, pt) == 0) ||
-	    (spt_cmp(&slp, pt) == 0) || (spt_cmp(&elp, pt) == 0))
-		return true;
-
-	/* the spt is a delimiter */
-	if (pt_is_delimiter(pt))
-		return false;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column -= 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, &lp);
-
-	return pt_is_delimiter(&lp) ||
-	    (pt_is_punctuation(pt) && !pt_is_punctuation(&lp)) ||
-	    (pt_is_punctuation(&lp) && !pt_is_punctuation(pt));
-}
-
-static char32_t get_first_wchar(const char *str)
-{
-	size_t offset = 0;
-	return str_decode(str, &offset, str_size(str));
-}
-
-static bool pt_is_delimiter(spt_t *pt)
-{
-	spt_t rp;
-	coord_t coord;
-	char *ch = NULL;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column += 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, &rp);
-
-	ch = range_get_str(pt, &rp);
-	if (ch == NULL)
-		return false;
-
-	char32_t first_char = get_first_wchar(ch);
-	switch (first_char) {
-	case ' ':
-	case '\t':
-	case '\n':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static bool pt_is_punctuation(spt_t *pt)
-{
-	spt_t rp;
-	coord_t coord;
-	char *ch = NULL;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column += 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, &rp);
-
-	ch = range_get_str(pt, &rp);
-	if (ch == NULL)
-		return false;
-
-	char32_t first_char = get_first_wchar(ch);
-	switch (first_char) {
-	case ',':
-	case '.':
-	case ';':
-	case ':':
-	case '/':
-	case '?':
-	case '\\':
-	case '|':
-	case '_':
-	case '+':
-	case '-':
-	case '*':
-	case '=':
-	case '<':
-	case '>':
-		return true;
-	default:
-		return false;
-	}
-}
-
-/** Compare tags. */
-static int tag_cmp(tag_t const *a, tag_t const *b)
-{
-	spt_t pa, pb;
-
-	tag_get_pt(a, &pa);
-	tag_get_pt(b, &pb);
-
-	return spt_cmp(&pa, &pb);
-}
-
-/** Compare s-points. */
-static int spt_cmp(spt_t const *a, spt_t const *b)
-{
-	coord_t ca, cb;
-
-	spt_get_coord(a, &ca);
-	spt_get_coord(b, &cb);
-
-	return coord_cmp(&ca, &cb);
-}
-
-/** Compare coordinats. */
-static int coord_cmp(coord_t const *a, coord_t const *b)
-{
-	if (a->row - b->row != 0)
-		return a->row - b->row;
-
-	return a->column - b->column;
-}
-
-/** Display text in the status line. */
-static void status_display(char const *str)
-{
-	(void) ui_label_set_text(edit.status, str);
-	(void) ui_label_paint(edit.status);
-}
-
-/** Window close request
- *
- * @param window Window
- * @param arg Argument (edit_t *)
- */
-static void edit_wnd_close(ui_window_t *window, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	ui_quit(edit->ui);
-}
-
-/** Window focus event
- *
- * @param window Window
- * @param arg Argument (edit_t *)
- * @param focus Focus number
- */
-static void edit_wnd_focus(ui_window_t *window, void *arg, unsigned focus)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	pane_caret_display(&pane);
-	cursor_setvis(true);
-}
-
-/** Window keyboard event
- *
- * @param window Window
- * @param arg Argument (edit_t *)
- * @param event Keyboard event
- */
-static void edit_wnd_kbd_event(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	pane.keymod = event->mods;
-
-	if (ui_window_def_kbd(window, event) == ui_claimed)
-		return;
-
-	if (event->type == KEY_PRESS) {
-		key_handle_press(event);
-		(void) pane_update(&pane);
-		(void) gfx_update(ui_window_get_gc(window));
-	}
-}
-
-/** Window unfocus event
- *
- * @param window Window
- * @param arg Argument (edit_t *)
- * @param focus Focus number
- */
-static void edit_wnd_unfocus(ui_window_t *window, void *arg, unsigned focus)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	cursor_setvis(false);
-}
-
-/** Menu bar activate event
- *
- * @param mbar Menu bar
- * @param arg Argument (edit_t *)
- */
-static void edit_menubar_activate(ui_menu_bar_t *mbar, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	cursor_setvis(false);
-}
-
-/** Menu bar deactivate event
- *
- * @param mbar Menu bar
- * @param arg Argument (edit_t *)
- */
-static void edit_menubar_deactivate(ui_menu_bar_t *mbar, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	pane_caret_display(&pane);
-	cursor_setvis(true);
-}
-
-/** File / New menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_file_new(ui_menu_entry_t *mentry, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	file_new();
-	(void) gfx_update(ui_window_get_gc(edit->window));
-}
-
-/** File / Open menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_file_open(ui_menu_entry_t *mentry, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	file_open();
-}
-
-/** File / Save menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_file_save(ui_menu_entry_t *mentry, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-
-	if (doc.file_name != NULL)
-		file_save(doc.file_name);
-	else
-		file_save_as();
-}
-
-/** File / Save As menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_file_save_as(ui_menu_entry_t *mentry, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	file_save_as();
-}
-
-/** File / Exit menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_file_exit(ui_menu_entry_t *mentry, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	ui_quit(edit->ui);
-}
-
-/** Edit / Cut menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_edit_cut(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	edit_cut();
-	(void) gfx_update(ui_window_get_gc(edit.window));
-}
-
-/** Edit / Copy menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_edit_copy(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	selection_copy();
-}
-
-/** Edit / Paste menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_edit_paste(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	edit_paste();
-	(void) gfx_update(ui_window_get_gc(edit.window));
-}
-
-/** Edit / Delete menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_edit_delete(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-
-	if (selection_active())
-		selection_delete();
-
-	pane.rflags |= REDRAW_CARET;
-	(void) pane_update(&pane);
-	(void) gfx_update(ui_window_get_gc(edit.window));
-}
-
-/** Edit / Select All menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_edit_select_all(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-
-	selection_sel_all();
-	pane.rflags |= (REDRAW_CARET | REDRAW_TEXT | REDRAW_STATUS);
-	pane_update(&pane);
-	(void) gfx_update(ui_window_get_gc(edit.window));
-}
-
-/** Search / Find menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_search_find(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	search_prompt(false);
-}
-
-/** Search / Reverse Find menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_search_reverse_find(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	search_prompt(true);
-}
-
-/** Search / Find Next menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_search_find_next(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	search_repeat();
-	(void) pane_update(&pane);
-	(void) gfx_update(ui_window_get_gc(edit.window));
-}
-
-/** Search / Go To Line menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (edit_t *)
- */
-static void edit_search_go_to_line(ui_menu_entry_t *mentry, void *arg)
-{
-	(void) arg;
-	caret_go_to_line_ask();
-}
-
-/** Open File dialog OK button press.
- *
- * @param dialog Open File dialog
- * @param arg Argument (ui_demo_t *)
- * @param fname File name
- */
-static void open_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	edit_t *edit = (edit_t *)arg;
-	char *cname;
-	errno_t rc;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-
-	cname = str_dup(fname);
-	if (cname == NULL) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = file_open_file(fname);
-	if (rc != EOK)
-		return;
-
-	if (doc.file_name != NULL)
-		free(doc.file_name);
-	doc.file_name = cname;
-
-	(void) gfx_update(ui_window_get_gc(edit->window));
-}
-
-/** Open File dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void open_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Open File dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void open_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Save As dialog OK button press.
- *
- * @param dialog Save As dialog
- * @param arg Argument (ui_demo_t *)
- * @param fname File name
- */
-static void save_as_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	edit_t *edit = (edit_t *)arg;
-	char *cname;
-	errno_t rc;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-
-	cname = str_dup(fname);
-	if (cname == NULL) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = file_save(fname);
-	if (rc != EOK)
-		return;
-
-	if (doc.file_name != NULL)
-		free(doc.file_name);
-	doc.file_name = cname;
-
-}
-
-/** Save As dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void save_as_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Save As dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void save_as_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *)arg;
-
-	(void)edit;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Go To Line dialog OK button press.
- *
- * @param dialog Go To Line dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void go_to_line_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *text)
-{
-	edit_t *edit = (edit_t *) arg;
-	char *endptr;
-	int line;
-
-	ui_prompt_dialog_destroy(dialog);
-	line = strtol(text, &endptr, 10);
-	if (*endptr != '\0') {
-		status_display("Invalid number entered.");
-		return;
-	}
-
-	caret_move_absolute(line, pane.ideal_column, dir_before, false);
-	(void)edit;
-	(void) pane_update(&pane);
-}
-
-/** Go To Line dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void go_to_line_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Go To Line dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void go_to_line_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Search dialog OK button press.
- *
- * @param dialog Search dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void search_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *text)
-{
-	edit_t *edit = (edit_t *) arg;
-	char *pattern;
-	bool reverse;
-
-	(void)edit;
-	ui_prompt_dialog_destroy(dialog);
-
-	/* Abort if search phrase is empty */
-	if (text[0] == '\0')
-		return;
-
-	pattern = str_dup(text);
-	reverse = pane.search_reverse;
-
-	if (pane.previous_search)
-		free(pane.previous_search);
-	pane.previous_search = pattern;
-	pane.previous_search_reverse = reverse;
-
-	search(pattern, reverse);
-
-	(void) pane_update(&pane);
-}
-
-/** Search dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void search_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Search dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void search_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	edit_t *edit = (edit_t *) arg;
-
-	(void)edit;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** @}
- */
Index: pace/app/edit/meson.build
===================================================================
--- uspace/app/edit/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files(
-	'edit.c',
-	'search.c',
-	'sheet.c',
-)
Index: pace/app/edit/search.c
===================================================================
--- uspace/app/edit/search.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- * @brief Simple searching facility.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <types/common.h>
-
-#include "search.h"
-#include "search_impl.h"
-
-search_t *search_init(const char *pattern, void *client_data, search_ops_t ops,
-    bool reverse)
-{
-	search_t *search = calloc(1, sizeof(search_t));
-	if (search == NULL)
-		return NULL;
-
-	char32_t *p = str_to_awstr(pattern);
-	if (p == NULL) {
-		free(search);
-		return NULL;
-	}
-
-	search->pattern_length = wstr_length(p);
-
-	if (reverse) {
-		/* Reverse the pattern */
-		size_t pos, half;
-		half = search->pattern_length / 2;
-		for (pos = 0; pos < half; pos++) {
-			char32_t tmp = p[pos];
-			p[pos] = p[search->pattern_length - pos - 1];
-			p[search->pattern_length - pos - 1] = tmp;
-		}
-	}
-
-	search->pattern = p;
-
-	search->client_data = client_data;
-	search->ops = ops;
-	search->back_table = calloc(search->pattern_length, sizeof(ssize_t));
-	if (search->back_table == NULL) {
-		free(search->pattern);
-		free(search);
-		return NULL;
-	}
-
-	search->pattern_pos = 0;
-
-	search->back_table[0] = -1;
-	search->back_table[1] = 0;
-	size_t table_idx = 2;
-	size_t pattern_idx = 0;
-	while (table_idx < search->pattern_length) {
-		if (ops.equals(search->pattern[table_idx - 1],
-		    search->pattern[pattern_idx])) {
-			pattern_idx++;
-			search->back_table[table_idx] = pattern_idx;
-			table_idx++;
-		} else if (pattern_idx > 0) {
-			pattern_idx = search->back_table[pattern_idx];
-		} else {
-			pattern_idx = 0;
-			table_idx++;
-		}
-	}
-
-	return search;
-}
-
-errno_t search_next_match(search_t *s, match_t *match)
-{
-	search_equals_fn eq = s->ops.equals;
-
-	char32_t cur_char;
-	errno_t rc = EOK;
-	while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) {
-		/* Deal with mismatches */
-		while (s->pattern_pos > 0 && !eq(cur_char, s->pattern[s->pattern_pos])) {
-			s->pattern_pos = s->back_table[s->pattern_pos];
-		}
-		/* Check if the character matched */
-		if (eq(cur_char, s->pattern[s->pattern_pos])) {
-			s->pattern_pos++;
-			if (s->pattern_pos == s->pattern_length) {
-				s->pattern_pos = s->back_table[s->pattern_pos];
-				rc = s->ops.mark(s->client_data, &match->end);
-				if (rc != EOK)
-					return rc;
-				match->length = s->pattern_length;
-				return EOK;
-			}
-		}
-	}
-
-	match->end = NULL;
-	match->length = 0;
-
-	return rc;
-}
-
-void search_fini(search_t *search)
-{
-	free(search->pattern);
-	free(search->back_table);
-
-}
-
-bool char_exact_equals(const char32_t a, const char32_t b)
-{
-	return a == b;
-}
-
-/** @}
- */
Index: pace/app/edit/search.h
===================================================================
--- uspace/app/edit/search.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SEARCH_H__
-#define SEARCH_H__
-
-#include <str.h>
-#include <offset.h>
-
-struct search;
-typedef struct search search_t;
-typedef bool (*search_equals_fn)(const char32_t, const char32_t);
-typedef errno_t (*search_producer_fn)(void *, char32_t *);
-typedef errno_t (*search_mark_fn)(void *, void **);
-typedef void (*search_mark_free_fn)(void *);
-
-typedef struct match {
-	aoff64_t length;
-	void *end;
-} match_t;
-
-typedef struct search_ops {
-	search_equals_fn equals;
-	search_producer_fn producer;
-	search_mark_fn mark;
-	search_mark_free_fn mark_free;
-} search_ops_t;
-
-extern bool char_exact_equals(const char32_t, const char32_t);
-extern search_t *search_init(const char *, void *, search_ops_t, bool);
-extern errno_t search_next_match(search_t *, match_t *);
-extern void search_fini(search_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/edit/search_impl.h
===================================================================
--- uspace/app/edit/search_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SEARCH_IMPL_H__
-#define SEARCH_IMPL_H__
-
-#include "search.h"
-
-/** Search state */
-struct search {
-	/* Note: This structure is opaque for the user. */
-
-	char32_t *pattern;
-	size_t pattern_length;
-	ssize_t *back_table;
-	size_t pattern_pos;
-	void *client_data;
-	search_ops_t ops;
-};
-
-#endif
-
-/** @}
- */
Index: pace/app/edit/sheet.c
===================================================================
--- uspace/app/edit/sheet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,367 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- * @brief Prototype implementation of Sheet data structure.
- *
- * The sheet is an abstract data structure representing a piece of text.
- * On top of this data structure we can implement a text editor. It is
- * possible to implement the sheet such that the editor can make small
- * changes to large files or files containing long lines efficiently.
- *
- * The sheet structure allows basic operations of text insertion, deletion,
- * retrieval and mapping of coordinates to position in the file and vice
- * versa. The text that is inserted or deleted can contain tabs and newlines
- * which are interpreted and properly acted upon.
- *
- * This is a trivial implementation with poor efficiency with O(N+n)
- * insertion and deletion and O(N) mapping (in both directions), where
- * N is the size of the file and n is the size of the inserted/deleted text.
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <align.h>
-#include <macros.h>
-
-#include "sheet.h"
-#include "sheet_impl.h"
-
-enum {
-	TAB_WIDTH	= 8,
-
-	/** Initial  of dat buffer in bytes */
-	INITIAL_SIZE	= 32
-};
-
-/** Initialize an empty sheet. */
-errno_t sheet_create(sheet_t **rsh)
-{
-	sheet_t *sh;
-
-	sh = calloc(1, sizeof(sheet_t));
-	if (sh == NULL)
-		return ENOMEM;
-
-	sh->dbuf_size = INITIAL_SIZE;
-	sh->text_size = 0;
-
-	sh->data = malloc(sh->dbuf_size);
-	if (sh->data == NULL) {
-		free(sh);
-		return ENOMEM;
-	}
-
-	list_initialize(&sh->tags);
-
-	*rsh = sh;
-	return EOK;
-}
-
-/** Destroy sheet. */
-void sheet_destroy(sheet_t *sh)
-{
-	free(sh->data);
-	free(sh);
-}
-
-/** Insert text into sheet.
- *
- * @param sh	Sheet to insert to.
- * @param pos	Point where to insert.
- * @param dir	Whether to insert before or after the point (affects tags).
- * @param str	The text to insert (printable characters, tabs, newlines).
- *
- * @return	EOK on success or an error code.
- *
- * @note	@a dir affects which way tags that were placed on @a pos will
- * 		move. If @a dir is @c dir_before, the tags will move forward
- *		and vice versa.
- */
-errno_t sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
-{
-	char *ipp;
-	size_t sz;
-	char *newp;
-
-	sz = str_size(str);
-	if (sh->text_size + sz > sh->dbuf_size) {
-		/* Enlarge data buffer. */
-		newp = realloc(sh->data, sh->dbuf_size * 2);
-		if (newp == NULL)
-			return ELIMIT;
-
-		sh->data = newp;
-		sh->dbuf_size = sh->dbuf_size * 2;
-	}
-
-	ipp = sh->data + pos->b_off;
-
-	/* Copy data. */
-	memmove(ipp + sz, ipp, sh->text_size - pos->b_off);
-	memcpy(ipp, str, sz);
-	sh->text_size += sz;
-
-	/* Adjust tags. */
-
-	list_foreach(sh->tags, link, tag_t, tag) {
-		if (tag->b_off > pos->b_off)
-			tag->b_off += sz;
-		else if (tag->b_off == pos->b_off && dir == dir_before)
-			tag->b_off += sz;
-	}
-
-	return EOK;
-}
-
-/** Delete text from sheet.
- *
- * Deletes the range of text between two points from the sheet.
- *
- * @param sh	Sheet to delete from.
- * @param spos	Starting point.
- * @param epos	Ending point.
- *
- * @return	EOK on success or an error code.
- */
-errno_t sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
-{
-	char *spp;
-	size_t sz;
-	char *newp;
-	size_t shrink_size;
-
-	spp = sh->data + spos->b_off;
-	sz = epos->b_off - spos->b_off;
-
-	memmove(spp, spp + sz, sh->text_size - (spos->b_off + sz));
-	sh->text_size -= sz;
-
-	/* Adjust tags. */
-	list_foreach(sh->tags, link, tag_t, tag) {
-		if (tag->b_off >= epos->b_off)
-			tag->b_off -= sz;
-		else if (tag->b_off >= spos->b_off)
-			tag->b_off = spos->b_off;
-	}
-
-	/* See if we should free up some memory. */
-	shrink_size = max(sh->dbuf_size / 4, INITIAL_SIZE);
-	if (sh->text_size <= shrink_size && sh->dbuf_size > INITIAL_SIZE) {
-		/* Shrink data buffer. */
-		newp = realloc(sh->data, shrink_size);
-		if (newp == NULL) {
-			/* Failed to shrink buffer... no matter. */
-			return EOK;
-		}
-
-		sh->data = newp;
-		sh->dbuf_size = shrink_size;
-	}
-
-	return EOK;
-}
-
-/** Read text from sheet. */
-void sheet_copy_out(sheet_t *sh, spt_t const *spos, spt_t const *epos,
-    char *buf, size_t bufsize, spt_t *fpos)
-{
-	char *spp;
-	size_t range_sz;
-	size_t copy_sz;
-	size_t off, prev;
-	char32_t c;
-
-	spp = sh->data + spos->b_off;
-	range_sz = epos->b_off - spos->b_off;
-	copy_sz = (range_sz < bufsize - 1) ? range_sz : bufsize - 1;
-
-	prev = off = 0;
-	do {
-		prev = off;
-		c = str_decode(spp, &off, copy_sz);
-	} while (c != '\0');
-
-	/* Crop copy_sz down to the last full character. */
-	copy_sz = prev;
-
-	memcpy(buf, spp, copy_sz);
-	buf[copy_sz] = '\0';
-
-	fpos->b_off = spos->b_off + copy_sz;
-	fpos->sh = sh;
-}
-
-/** Get point preceding or following character cell. */
-void sheet_get_cell_pt(sheet_t *sh, coord_t const *coord, enum dir_spec dir,
-    spt_t *pt)
-{
-	size_t cur_pos, prev_pos;
-	char32_t c;
-	coord_t cc;
-
-	cc.row = cc.column = 1;
-	cur_pos = prev_pos = 0;
-	while (true) {
-		if (prev_pos >= sh->text_size) {
-			/* Cannot advance any further. */
-			break;
-		}
-
-		if ((cc.row >= coord->row && cc.column > coord->column) ||
-		    cc.row > coord->row) {
-			/* We are past the requested coordinates. */
-			break;
-		}
-
-		prev_pos = cur_pos;
-
-		c = str_decode(sh->data, &cur_pos, sh->text_size);
-		if (c == '\n') {
-			++cc.row;
-			cc.column = 1;
-		} else if (c == '\t') {
-			cc.column = 1 + ALIGN_UP(cc.column, TAB_WIDTH);
-		} else {
-			++cc.column;
-		}
-	}
-
-	pt->sh = sh;
-	pt->b_off = (dir == dir_before) ? prev_pos : cur_pos;
-}
-
-/** Get the number of character cells a row occupies. */
-void sheet_get_row_width(sheet_t *sh, int row, int *length)
-{
-	coord_t coord;
-	spt_t pt;
-
-	/* Especially nasty hack */
-	coord.row = row;
-	coord.column = 65536;
-
-	sheet_get_cell_pt(sh, &coord, dir_before, &pt);
-	spt_get_coord(&pt, &coord);
-	*length = coord.column;
-}
-
-/** Get the number of rows in a sheet. */
-void sheet_get_num_rows(sheet_t *sh, int *rows)
-{
-	int cnt;
-	size_t bo;
-
-	cnt = 1;
-	for (bo = 0; bo < sh->dbuf_size; ++bo) {
-		if (sh->data[bo] == '\n')
-			cnt += 1;
-	}
-
-	*rows = cnt;
-}
-
-/** Get the coordinates of an s-point. */
-void spt_get_coord(spt_t const *pos, coord_t *coord)
-{
-	size_t off;
-	coord_t cc;
-	char32_t c;
-	sheet_t *sh;
-
-	sh = pos->sh;
-	cc.row = cc.column = 1;
-
-	off = 0;
-	while (off < pos->b_off && off < sh->text_size) {
-		c = str_decode(sh->data, &off, sh->text_size);
-		if (c == '\n') {
-			++cc.row;
-			cc.column = 1;
-		} else if (c == '\t') {
-			cc.column = 1 + ALIGN_UP(cc.column, TAB_WIDTH);
-		} else {
-			++cc.column;
-		}
-	}
-
-	*coord = cc;
-}
-
-/** Test if two s-points are equal. */
-bool spt_equal(spt_t const *a, spt_t const *b)
-{
-	return a->b_off == b->b_off;
-}
-
-/** Get a character at spt and return next spt */
-char32_t spt_next_char(spt_t spt, spt_t *next)
-{
-	char32_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size);
-	if (next)
-		*next = spt;
-	return ch;
-}
-
-char32_t spt_prev_char(spt_t spt, spt_t *prev)
-{
-	char32_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size);
-	if (prev)
-		*prev = spt;
-	return ch;
-}
-
-/** Place a tag on the specified s-point. */
-void sheet_place_tag(sheet_t *sh, spt_t const *pt, tag_t *tag)
-{
-	tag->b_off = pt->b_off;
-	tag->sh = sh;
-	list_append(&tag->link, &sh->tags);
-}
-
-/** Remove a tag from the sheet. */
-void sheet_remove_tag(sheet_t *sh, tag_t *tag)
-{
-	list_remove(&tag->link);
-}
-
-/** Get s-point on which the tag is located right now. */
-void tag_get_pt(tag_t const *tag, spt_t *pt)
-{
-	pt->b_off = tag->b_off;
-	pt->sh = tag->sh;
-}
-
-/** @}
- */
Index: pace/app/edit/sheet.h
===================================================================
--- uspace/app/edit/sheet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SHEET_H__
-#define SHEET_H__
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-/** Direction (in linear space) */
-enum dir_spec {
-	/** Before specified point */
-	dir_before,
-	/** After specified point */
-	dir_after
-};
-
-/** Sheet */
-struct sheet;
-typedef struct sheet sheet_t;
-
-/** Character cell coordinates
- *
- * These specify a character cell. The first cell is (1,1).
- */
-typedef struct {
-	int row;
-	int column;
-} coord_t;
-
-/** S-point
- *
- * An s-point specifies the boundary between two successive characters
- * in the linear file space (including the beginning of file or the end
- * of file. An s-point only remains valid as long as no modifications
- * (insertions/deletions) are performed on the sheet.
- */
-typedef struct {
-	/* Note: This structure is opaque for the user. */
-	sheet_t *sh;
-	size_t b_off;
-} spt_t;
-
-/** Tag
- *
- * A tag is similar to an s-point, but remains valid over modifications
- * to the sheet. A tag tends to 'stay put'. Any tag must be properly
- * removed from the sheet before it is deallocated by the user.
- */
-typedef struct {
-	/* Note: This structure is opaque for the user. */
-
-	/** Link to list of all tags in the sheet (see sheet_t.tags) */
-	link_t link;
-	sheet_t *sh;
-	size_t b_off;
-} tag_t;
-
-extern errno_t sheet_create(sheet_t **);
-extern void sheet_destroy(sheet_t *);
-extern errno_t sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
-extern errno_t sheet_delete(sheet_t *, spt_t *, spt_t *);
-extern void sheet_copy_out(sheet_t *, spt_t const *, spt_t const *, char *,
-    size_t, spt_t *);
-extern void sheet_get_cell_pt(sheet_t *, coord_t const *, enum dir_spec,
-    spt_t *);
-extern void sheet_get_row_width(sheet_t *, int, int *);
-extern void sheet_get_num_rows(sheet_t *, int *);
-extern void spt_get_coord(spt_t const *, coord_t *);
-extern bool spt_equal(spt_t const *, spt_t const *);
-extern char32_t spt_next_char(spt_t, spt_t *);
-extern char32_t spt_prev_char(spt_t, spt_t *);
-
-extern void sheet_place_tag(sheet_t *, spt_t const *, tag_t *);
-extern void sheet_remove_tag(sheet_t *, tag_t *);
-extern void tag_get_pt(tag_t const *, spt_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/edit/sheet_impl.h
===================================================================
--- uspace/app/edit/sheet_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SHEET_IMPL_H__
-#define SHEET_IMPL_H__
-
-#include "sheet.h"
-
-/** Sheet */
-struct sheet {
-	/* Note: This structure is opaque for the user. */
-
-	size_t text_size;
-	size_t dbuf_size;
-	char *data;
-
-	list_t tags;
-};
-
-#endif
-
-/** @}
- */
Index: pace/app/fdisk/doc/doxygroups.h
===================================================================
--- uspace/app/fdisk/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup fdisk fdisk
- * @brief Disk management tool
- * @ingroup apps
- */
Index: pace/app/fdisk/fdisk.c
===================================================================
--- uspace/app/fdisk/fdisk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1331 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fdisk
- * @{
- */
-/**
- * @file
- */
-
-#include <capa.h>
-#include <errno.h>
-#include <fdisk.h>
-#include <io/label.h>
-#include <nchoice.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vol.h>
-
-#define NO_LABEL_CAPTION "(No name)"
-
-static bool quit = false;
-static fdisk_t *fdisk;
-
-/** Device menu actions */
-typedef enum {
-	/** Create label */
-	devac_create_label,
-	/** Delete label */
-	devac_delete_label,
-	/** Erase disk */
-	devac_erase_disk,
-	/** Create (primary) partition */
-	devac_create_pri_part,
-	/** Create extended partition */
-	devac_create_ext_part,
-	/** Create logical partition */
-	devac_create_log_part,
-	/** Modify partition */
-	devac_modify_part,
-	/** Delete partition */
-	devac_delete_part,
-	/** Exit */
-	devac_exit
-} devac_t;
-
-/** Partition property to modify */
-typedef enum {
-	/** Modify mount point */
-	pm_mountp,
-	/** Cancel */
-	pm_cancel
-} pmprop_t;
-
-/** Confirm user selection. */
-static errno_t fdsk_confirm(const char *msg, bool *rconfirm)
-{
-	tinput_t *tinput = NULL;
-	char *answer;
-	errno_t rc;
-
-	tinput = tinput_new();
-	if (tinput == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = tinput_set_prompt(tinput, "y/n> ");
-	if (rc != EOK)
-		goto error;
-
-	while (true) {
-		printf("%s\n", msg);
-
-		rc = tinput_read(tinput, &answer);
-		if (rc == ENOENT) {
-			*rconfirm = false;
-			free(answer);
-			break;
-		}
-
-		if (rc != EOK)
-			goto error;
-
-		if (str_cmp(answer, "y") == 0) {
-			*rconfirm = true;
-			free(answer);
-			break;
-		} else if (str_cmp(answer, "n") == 0) {
-			*rconfirm = false;
-			free(answer);
-			break;
-		}
-	}
-
-	tinput_destroy(tinput);
-	return EOK;
-error:
-	if (tinput != NULL)
-		tinput_destroy(tinput);
-	return rc;
-}
-
-/** Device selection */
-static errno_t fdsk_dev_sel_choice(service_id_t *rsvcid)
-{
-	fdisk_dev_list_t *devlist = NULL;
-	fdisk_dev_info_t *info;
-	nchoice_t *choice = NULL;
-	char *svcname = NULL;
-	capa_spec_t capa;
-	fdisk_dev_info_t *sdev;
-	char *scapa = NULL;
-	char *dtext = NULL;
-	service_id_t svcid;
-	void *sel;
-	int ndevs;
-	errno_t rc;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select device");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = fdisk_dev_list_get(fdisk, &devlist);
-	if (rc != EOK) {
-		printf("Error getting device list.\n");
-		goto error;
-	}
-
-	info = fdisk_dev_first(devlist);
-	ndevs = 0;
-	while (info != NULL) {
-		rc = fdisk_dev_info_get_svcname(info, &svcname);
-		if (rc != EOK) {
-			fdisk_dev_info_get_svcid(info, &svcid);
-			printf("Error getting device service name "
-			    "(service ID %zu).\n", svcid);
-			info = fdisk_dev_next(info);
-			continue;
-		}
-
-		rc = fdisk_dev_info_capacity(info, &capa);
-		if (rc != EOK) {
-			printf("Error getting device capacity "
-			    "(device %s).\n", svcname);
-			info = fdisk_dev_next(info);
-			continue;
-		}
-
-		capa_simplify(&capa);
-
-		rc = capa_format(&capa, &scapa);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		int ret = asprintf(&dtext, "%s (%s)", svcname, scapa);
-		if (ret < 0) {
-			rc = ENOMEM;
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		free(svcname);
-		svcname = NULL;
-		free(scapa);
-		scapa = NULL;
-
-		rc = nchoice_add(choice, dtext, info, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		++ndevs;
-
-		free(dtext);
-		dtext = NULL;
-
-		info = fdisk_dev_next(info);
-	}
-
-	if (ndevs == 0) {
-		printf("No disk devices found.\n");
-		rc = ENOENT;
-		goto error;
-	}
-
-	rc = nchoice_add(choice, "Exit", NULL, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		return rc;
-	}
-
-	sdev = (fdisk_dev_info_t *)sel;
-	if (sdev != NULL) {
-		fdisk_dev_info_get_svcid(sdev, &svcid);
-	} else {
-		svcid = 0;
-	}
-
-	fdisk_dev_list_free(devlist);
-
-	nchoice_destroy(choice);
-	*rsvcid = svcid;
-	return EOK;
-error:
-	assert(rc != EOK);
-	*rsvcid = 0;
-	if (devlist != NULL)
-		fdisk_dev_list_free(devlist);
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	free(dtext);
-	free(svcname);
-	free(scapa);
-	return rc;
-}
-
-static errno_t fdsk_create_label(fdisk_dev_t *dev)
-{
-	nchoice_t *choice = NULL;
-	void *sel;
-	char *sltype = NULL;
-	int i;
-	errno_t rc;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select label type");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	for (i = LT_FIRST; i < LT_LIMIT; i++) {
-		rc = label_type_format(i, &sltype);
-		if (rc != EOK)
-			goto error;
-
-		rc = nchoice_add(choice, sltype, (void *)(uintptr_t)i,
-		    i == LT_DEFAULT);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		free(sltype);
-		sltype = NULL;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		goto error;
-	}
-
-	rc = fdisk_label_create(dev, (label_type_t)sel);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		goto error;
-	}
-
-	nchoice_destroy(choice);
-	return EOK;
-error:
-	free(sltype);
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	return rc;
-}
-
-static errno_t fdsk_delete_label(fdisk_dev_t *dev)
-{
-	bool confirm;
-	errno_t rc;
-
-	rc = fdsk_confirm("Warning. Any data on disk will be lost. "
-	    "Really delete label?", &confirm);
-	if (rc != EOK) {
-		printf("Error getting user confirmation.\n");
-		return rc;
-	}
-
-	if (!confirm)
-		return EOK;
-
-	rc = fdisk_label_destroy(dev);
-	if (rc != EOK) {
-		printf("Error deleting label.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t fdsk_erase_disk(fdisk_dev_t *dev)
-{
-	bool confirm;
-	errno_t rc;
-
-	rc = fdsk_confirm("Warning. Any data on disk will be lost. "
-	    "Really erase disk?", &confirm);
-	if (rc != EOK) {
-		printf("Error getting user confirmation.\n");
-		return rc;
-	}
-
-	if (!confirm)
-		return EOK;
-
-	rc = fdisk_dev_erase(dev);
-	if (rc != EOK) {
-		printf("Error erasing disk.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t fdsk_select_fstype(vol_fstype_t *fstype)
-{
-	nchoice_t *choice = NULL;
-	void *sel;
-	char *sfstype = NULL;
-	int i;
-	errno_t rc;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select file system type");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	for (i = 0; i < VOL_FSTYPE_LIMIT; i++) {
-		rc = vol_fstype_format(i, &sfstype);
-		if (rc != EOK)
-			goto error;
-
-		rc = nchoice_add(choice, sfstype, (void *)(uintptr_t)i,
-		    i == VOL_FSTYPE_DEFAULT);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		free(sfstype);
-		sfstype = NULL;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		goto error;
-	}
-
-	nchoice_destroy(choice);
-	*fstype = (vol_fstype_t)sel;
-	return EOK;
-error:
-	free(sfstype);
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	return rc;
-}
-
-static errno_t fdsk_create_part(fdisk_dev_t *dev, label_pkind_t pkind)
-{
-	errno_t rc;
-	fdisk_part_spec_t pspec;
-	capa_spec_t capa;
-	capa_spec_t mcapa;
-	vol_label_supp_t vlsupp;
-	vol_fstype_t fstype = 0;
-	tinput_t *tinput = NULL;
-	fdisk_spc_t spc;
-	char *scapa;
-	char *smcapa = NULL;
-	char *label = NULL;
-	char *mountp = NULL;
-
-	if (pkind == lpk_logical)
-		spc = spc_log;
-	else
-		spc = spc_pri;
-
-	rc = fdisk_part_get_max_avail(dev, spc, &mcapa);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	capa_simplify(&mcapa);
-
-	rc = capa_format(&mcapa, &smcapa);
-	if (rc != EOK) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	tinput = tinput_new();
-	if (tinput == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = tinput_set_prompt(tinput, "?> ");
-	if (rc != EOK)
-		goto error;
-
-	while (true) {
-		printf("Enter capacity of new partition.\n");
-		rc = tinput_read_i(tinput, smcapa, &scapa);
-		if (rc != EOK)
-			goto error;
-
-		rc = capa_parse(scapa, &capa);
-		if (rc == EOK)
-			break;
-	}
-
-	tinput_destroy(tinput);
-	tinput = NULL;
-	free(smcapa);
-	smcapa = NULL;
-
-	if (pkind != lpk_extended) {
-		rc = fdsk_select_fstype(&fstype);
-		if (rc != EOK)
-			goto error;
-	}
-
-	fdisk_get_vollabel_support(dev, fstype, &vlsupp);
-	if (vlsupp.supported) {
-		tinput = tinput_new();
-		if (tinput == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = tinput_set_prompt(tinput, "?> ");
-		if (rc != EOK)
-			goto error;
-
-		/* Ask for volume label */
-		printf("Enter volume label for new partition.\n");
-		rc = tinput_read_i(tinput, "New volume", &label);
-		if (rc != EOK)
-			goto error;
-
-		tinput_destroy(tinput);
-		tinput = NULL;
-	}
-
-	/* Ask for mount point */
-	tinput = tinput_new();
-	if (tinput == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = tinput_set_prompt(tinput, "?> ");
-	if (rc != EOK)
-		goto error;
-
-	while (true) {
-		printf("Enter mount point for new partition (Auto, None or /path).\n");
-		rc = tinput_read_i(tinput, "Auto", &mountp);
-		if (rc != EOK)
-			goto error;
-
-		rc = vol_mountp_validate(mountp);
-		if (rc == EOK)
-			break;
-
-		free(mountp);
-		mountp = NULL;
-	}
-
-	tinput_destroy(tinput);
-	tinput = NULL;
-
-	fdisk_pspec_init(&pspec);
-	pspec.capacity = capa;
-	pspec.pkind = pkind;
-	pspec.fstype = fstype;
-	pspec.label = label;
-	pspec.mountp = mountp;
-
-	rc = fdisk_part_create(dev, &pspec, NULL);
-	if (rc != EOK) {
-		printf("Error creating partition.\n");
-		goto error;
-	}
-
-	free(label);
-	free(mountp);
-	return EOK;
-error:
-	free(smcapa);
-	free(label);
-	free(mountp);
-	if (tinput != NULL)
-		tinput_destroy(tinput);
-	return rc;
-}
-
-/** Add an option to choice for each partition.
- *
- * @param dev Fdisk device
- * @param choice Choice to add optionts to
- *
- * @return EOK on sucess or error code
- */
-static errno_t fdsk_add_part_choices(fdisk_dev_t *dev,
-    nchoice_t *choice)
-{
-	fdisk_part_t *part;
-	fdisk_part_info_t pinfo;
-	char *scapa = NULL;
-	char *spkind = NULL;
-	char *sfstype = NULL;
-	char *sdesc = NULL;
-	const char *label;
-	errno_t rc;
-
-	part = fdisk_part_first(dev);
-	while (part != NULL) {
-		rc = fdisk_part_get_info(part, &pinfo);
-		if (rc != EOK) {
-			printf("Error getting partition information.\n");
-			goto error;
-		}
-
-		capa_simplify(&pinfo.capacity);
-
-		rc = capa_format(&pinfo.capacity, &scapa);
-		if (rc != EOK) {
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		rc = label_pkind_format(pinfo.pkind, &spkind);
-		if (rc != EOK) {
-			printf("\nOut of memory.\n");
-			goto error;
-		}
-
-		if (pinfo.pkind != lpk_extended) {
-			rc = vol_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype);
-			if (rc != EOK) {
-				printf("Out of memory.\n");
-				goto error;
-			}
-
-			if (str_size(pinfo.label) > 0)
-				label = pinfo.label;
-			else
-				label = "(No name)";
-
-			int ret = asprintf(&sdesc, "%s %s, %s, %s", label,
-			    scapa, spkind, sfstype);
-			if (ret < 0) {
-				rc = ENOMEM;
-				goto error;
-			}
-
-		} else {
-			int ret = asprintf(&sdesc, "%s, %s", scapa, spkind);
-			if (ret < 0) {
-				rc = ENOMEM;
-				goto error;
-			}
-		}
-
-		rc = nchoice_add(choice, sdesc, (void *)part, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		free(scapa);
-		scapa = NULL;
-		free(spkind);
-		spkind = NULL;
-		free(sfstype);
-		sfstype = NULL;
-		free(sdesc);
-		sdesc = NULL;
-
-		part = fdisk_part_next(part);
-	}
-
-	return EOK;
-error:
-	free(scapa);
-	free(spkind);
-	free(sfstype);
-	free(sdesc);
-
-	return rc;
-}
-
-/** Modify partition mount point.
- *
- * Run the interaction to modify a partition mount point
- *
- * @part Fdisk partition
- * @return EOK on success or error code
- */
-static errno_t fdsk_modify_mountp(fdisk_part_t *part)
-{
-	tinput_t *tinput = NULL;
-	errno_t rc;
-	char *mountp = NULL;
-
-	/* Ask for mount point */
-	tinput = tinput_new();
-	if (tinput == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = tinput_set_prompt(tinput, "?> ");
-	if (rc != EOK)
-		goto error;
-
-	while (true) {
-		printf("Enter mount point for new partition (Auto, None or /path).\n");
-		rc = tinput_read_i(tinput, "Auto", &mountp);
-		if (rc != EOK)
-			goto error;
-
-		rc = vol_mountp_validate(mountp);
-		if (rc == EOK)
-			break;
-
-		free(mountp);
-		mountp = NULL;
-	}
-
-	rc = fdisk_part_set_mountp(part, mountp);
-	if (rc != EOK)
-		goto error;
-
-	free(mountp);
-
-	tinput_destroy(tinput);
-	tinput = NULL;
-	return EOK;
-error:
-	if (mountp != NULL)
-		free(mountp);
-	if (tinput != NULL)
-		tinput_destroy(tinput);
-	return rc;
-}
-
-/** Modify partition.
- *
- * Run the interaction to modify a partition.
- *
- * @param dev Fdisk device
- * @return EOK on success or error code
- */
-static errno_t fdsk_modify_part(fdisk_dev_t *dev)
-{
-	nchoice_t *choice = NULL;
-	fdisk_part_t *part;
-	void *sel;
-	errno_t rc;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select partition to modify");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = fdsk_add_part_choices(dev, choice);
-	if (rc != EOK)
-		goto error;
-
-	rc = nchoice_add(choice, "Cancel", NULL, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc == ENOENT)
-		return EOK;
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		goto error;
-	}
-
-	nchoice_destroy(choice);
-	choice = NULL;
-
-	if (sel == NULL)
-		return EOK;
-
-	part = (fdisk_part_t *)sel;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select property to modify");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_add(choice, "Mount point", (void *)pm_mountp, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_add(choice, "Cancel", (void *)pm_cancel, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc == ENOENT)
-		return EOK;
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		goto error;
-	}
-
-	nchoice_destroy(choice);
-	choice = NULL;
-
-	switch ((pmprop_t)sel) {
-	case pm_mountp:
-		rc = fdsk_modify_mountp(part);
-		break;
-	case pm_cancel:
-		rc = EOK;
-		break;
-	}
-
-	return rc;
-error:
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	return rc;
-}
-
-static errno_t fdsk_delete_part(fdisk_dev_t *dev)
-{
-	nchoice_t *choice = NULL;
-	bool confirm;
-	void *sel;
-	errno_t rc;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select partition to delete");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = fdsk_add_part_choices(dev, choice);
-	if (rc != EOK)
-		goto error;
-
-	rc = nchoice_add(choice, "Cancel", NULL, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc == ENOENT)
-		return EOK;
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		goto error;
-	}
-
-	nchoice_destroy(choice);
-	choice = NULL;
-
-	if (sel == NULL)
-		return EOK;
-
-	rc = fdsk_confirm("Warning. Any data in partition will be lost. "
-	    "Really delete partition?", &confirm);
-	if (rc != EOK) {
-		printf("Error getting user confirmation.\n");
-		goto error;
-	}
-
-	if (!confirm)
-		return EOK;
-
-	rc = fdisk_part_destroy((fdisk_part_t *)sel);
-	if (rc != EOK) {
-		printf("Error deleting partition.\n");
-		return rc;
-	}
-
-	return EOK;
-error:
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	return rc;
-}
-
-/** Device menu */
-static errno_t fdsk_dev_menu(fdisk_dev_t *dev)
-{
-	nchoice_t *choice = NULL;
-	fdisk_label_info_t linfo;
-	fdisk_part_t *part;
-	fdisk_part_info_t pinfo;
-	capa_spec_t capa;
-	capa_spec_t mcapa;
-	fdisk_dev_flags_t dflags;
-	char *sltype = NULL;
-	char *sdcapa = NULL;
-	char *scapa = NULL;
-	char *smcapa = NULL;
-	char *sfstype = NULL;
-	char *svcname = NULL;
-	char *spkind;
-	const char *label;
-	errno_t rc;
-	int npart;
-	void *sel;
-
-	rc = nchoice_create(&choice);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select action");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = fdisk_dev_capacity(dev, &capa);
-	if (rc != EOK) {
-		printf("Error getting device capacity.\n");
-		goto error;
-	}
-
-	capa_simplify(&capa);
-
-	rc = capa_format(&capa, &sdcapa);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = fdisk_dev_get_svcname(dev, &svcname);
-	if (rc != EOK) {
-		printf("Error getting device service name.\n");
-		goto error;
-	}
-
-	fdisk_dev_get_flags(dev, &dflags);
-
-	printf("Device: %s (%s)\n", svcname, sdcapa);
-	free(sdcapa);
-	sdcapa = NULL;
-
-	rc = fdisk_label_get_info(dev, &linfo);
-	if (rc != EOK) {
-		printf("Error getting label information.\n");
-		goto error;
-	}
-
-	switch (linfo.ltype) {
-	case lt_none:
-		printf("Disk contains no label.\n");
-		break;
-	default:
-		rc = label_type_format(linfo.ltype, &sltype);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		printf("Label type: %s\n", sltype);
-		free(sltype);
-		sltype = NULL;
-		break;
-	}
-
-	part = fdisk_part_first(dev);
-	npart = 0;
-	while (part != NULL) {
-		++npart;
-		rc = fdisk_part_get_info(part, &pinfo);
-		if (rc != EOK) {
-			printf("Error getting partition information.\n");
-			goto error;
-		}
-
-		capa_simplify(&pinfo.capacity);
-
-		rc = capa_format(&pinfo.capacity, &scapa);
-		if (rc != EOK) {
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		rc = vol_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype);
-		if (rc != EOK) {
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		if (str_size(pinfo.label) > 0)
-			label = pinfo.label;
-		else
-			label = "(No name)";
-
-		if (linfo.ltype == lt_none)
-			printf("Entire disk: %s %s", label, scapa);
-		else
-			printf("Partition %d: %s %s", npart, label, scapa);
-
-		if ((linfo.flags & lf_ext_supp) != 0) {
-			rc = label_pkind_format(pinfo.pkind, &spkind);
-			if (rc != EOK) {
-				printf("\nOut of memory.\n");
-				goto error;
-			}
-
-			printf(", %s", spkind);
-			free(spkind);
-		}
-
-		if (pinfo.pkind != lpk_extended) {
-			printf(", %s", sfstype);
-		}
-
-		printf("\n");
-
-		free(scapa);
-		scapa = NULL;
-		free(sfstype);
-		sfstype = NULL;
-
-		part = fdisk_part_next(part);
-	}
-
-	/* Display available space */
-	if ((linfo.flags & lf_can_create_pri) != 0) {
-		rc = fdisk_part_get_max_avail(dev, spc_pri, &mcapa);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		capa_simplify(&mcapa);
-
-		rc = capa_format(&mcapa, &smcapa);
-		if (rc != EOK) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		if ((linfo.flags & lf_ext_supp) != 0)
-			printf("Maximum free primary block: %s\n", smcapa);
-		else
-			printf("Maximum free block: %s\n", smcapa);
-
-		free(smcapa);
-		smcapa = NULL;
-
-		rc = fdisk_part_get_tot_avail(dev, spc_pri, &mcapa);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		capa_simplify(&mcapa);
-
-		rc = capa_format(&mcapa, &smcapa);
-		if (rc != EOK) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		if ((linfo.flags & lf_ext_supp) != 0)
-			printf("Total free primary space: %s\n", smcapa);
-		else
-			printf("Total free space: %s\n", smcapa);
-
-		free(smcapa);
-		smcapa = NULL;
-	}
-
-	/* Display available space */
-	if ((linfo.flags & lf_can_create_log) != 0) {
-		rc = fdisk_part_get_max_avail(dev, spc_log, &mcapa);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		capa_simplify(&mcapa);
-
-		rc = capa_format(&mcapa, &smcapa);
-		if (rc != EOK) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		printf("Maximum free logical block: %s\n", smcapa);
-		free(smcapa);
-		smcapa = NULL;
-
-		rc = fdisk_part_get_tot_avail(dev, spc_log, &mcapa);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		capa_simplify(&mcapa);
-
-		rc = capa_format(&mcapa, &smcapa);
-		if (rc != EOK) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		printf("Total free logical space: %s\n", smcapa);
-		free(smcapa);
-		smcapa = NULL;
-	}
-
-	rc = nchoice_set_prompt(choice, "Select action");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	if ((linfo.flags & lf_ext_supp) != 0) {
-		if ((linfo.flags & lf_can_create_pri) != 0) {
-			rc = nchoice_add(choice, "Create primary "
-			    "partition",
-			    (void *)devac_create_pri_part, 0);
-			if (rc != EOK) {
-				assert(rc == ENOMEM);
-				printf("Out of memory.\n");
-				goto error;
-			}
-		}
-
-		if ((linfo.flags & lf_can_create_ext) != 0) {
-			rc = nchoice_add(choice, "Create extended "
-			    "partition",
-			    (void *)devac_create_ext_part, 0);
-			if (rc != EOK) {
-				assert(rc == ENOMEM);
-				printf("Out of memory.\n");
-				goto error;
-			}
-		}
-
-		if ((linfo.flags & lf_can_create_log) != 0) {
-			rc = nchoice_add(choice, "Create logical "
-			    "partition",
-			    (void *)devac_create_log_part, 0);
-			if (rc != EOK) {
-				assert(rc == ENOMEM);
-				printf("Out of memory.\n");
-				goto error;
-			}
-		}
-	} else { /* (linfo.flags & lf_ext_supp) == 0 */
-		if ((linfo.flags & lf_can_create_pri) != 0) {
-			rc = nchoice_add(choice, "Create partition",
-			    (void *)devac_create_pri_part, 0);
-			if (rc != EOK) {
-				assert(rc == ENOMEM);
-				printf("Out of memory.\n");
-				goto error;
-			}
-		}
-	}
-
-	if ((linfo.flags & lf_can_modify_part) != 0) {
-		rc = nchoice_add(choice, "Modify partition",
-		    (void *)devac_modify_part, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-	}
-
-	if ((linfo.flags & lf_can_delete_part) != 0) {
-		rc = nchoice_add(choice, "Delete partition",
-		    (void *)devac_delete_part, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-	}
-
-	if ((dflags & fdf_can_create_label) != 0) {
-		rc = nchoice_add(choice, "Create label",
-		    (void *)devac_create_label, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-	}
-
-	if ((dflags & fdf_can_delete_label) != 0) {
-		rc = nchoice_add(choice, "Delete label",
-		    (void *)devac_delete_label, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-	}
-
-	if ((dflags & fdf_can_erase_dev) != 0) {
-		rc = nchoice_add(choice, "Erase disk",
-		    (void *)devac_erase_disk, 0);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			printf("Out of memory.\n");
-			goto error;
-		}
-	}
-
-	rc = nchoice_add(choice, "Exit", (void *)devac_exit, 0);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(choice, &sel);
-	if (rc != EOK) {
-		printf("Error getting user selection.\n");
-		return rc;
-	}
-
-	switch ((devac_t)sel) {
-	case devac_create_label:
-		(void) fdsk_create_label(dev);
-		break;
-	case devac_delete_label:
-		(void) fdsk_delete_label(dev);
-		break;
-	case devac_erase_disk:
-		(void) fdsk_erase_disk(dev);
-		break;
-	case devac_create_pri_part:
-		(void) fdsk_create_part(dev, lpk_primary);
-		break;
-	case devac_create_ext_part:
-		(void) fdsk_create_part(dev, lpk_extended);
-		break;
-	case devac_create_log_part:
-		(void) fdsk_create_part(dev, lpk_logical);
-		break;
-	case devac_modify_part:
-		(void) fdsk_modify_part(dev);
-		break;
-	case devac_delete_part:
-		(void) fdsk_delete_part(dev);
-		break;
-	case devac_exit:
-		quit = true;
-		break;
-	}
-
-	nchoice_destroy(choice);
-	return EOK;
-error:
-	free(sdcapa);
-	free(scapa);
-	free(smcapa);
-	free(sfstype);
-	free(svcname);
-	if (choice != NULL)
-		nchoice_destroy(choice);
-	return rc;
-}
-
-int main(int argc, char *argv[])
-{
-	service_id_t svcid;
-	fdisk_dev_t *dev;
-	errno_t rc;
-
-	rc = fdisk_create(&fdisk);
-	if (rc != EOK) {
-		printf("Error initializing Fdisk.\n");
-		return 1;
-	}
-
-	rc = fdsk_dev_sel_choice(&svcid);
-	if (rc != EOK)
-		return 1;
-
-	if (svcid == 0)
-		return 0;
-
-	rc = fdisk_dev_open(fdisk, svcid, &dev);
-	if (rc != EOK) {
-		printf("Error opening device.\n");
-		return 1;
-	}
-
-	while (!quit) {
-		rc = fdsk_dev_menu(dev);
-		if (rc != EOK) {
-			fdisk_dev_close(dev);
-			return 1;
-		}
-	}
-
-	fdisk_dev_close(dev);
-	fdisk_destroy(fdisk);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/fdisk/meson.build
===================================================================
--- uspace/app/fdisk/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clui', 'device', 'fdisk' ]
-src = files('fdisk.c')
Index: pace/app/fontedit/doc/doxygroups.h
===================================================================
--- uspace/app/fontedit/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup fontedit fontedit
- * @brief Font editor
- * @ingroup apps
- */
Index: pace/app/fontedit/fontedit.c
===================================================================
--- uspace/app/fontedit/fontedit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,974 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fontedit
- * @{
- */
-/** @file Font editor
- */
-
-#include <fibril.h>
-#include <gfx/color.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <gfx/typeface.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include "fontedit.h"
-
-enum {
-	glyph_scale = 8,
-	glyph_orig_x = 100,
-	glyph_orig_y = 200
-};
-
-static errno_t font_edit_paint(font_edit_t *);
-
-static void font_edit_close_event(ui_window_t *, void *);
-static void font_edit_kbd_event(ui_window_t *, void *, kbd_event_t *);
-static void font_edit_pos_event(ui_window_t *, void *, pos_event_t *);
-
-static ui_window_cb_t font_edit_window_cb = {
-	.close = font_edit_close_event,
-	.kbd = font_edit_kbd_event,
-	.pos = font_edit_pos_event
-};
-
-/** Clear screen.
- *
- * @param gc Graphic context
- * @param w Screen width
- * @param h Screen height
- */
-static errno_t clear_scr(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = w;
-	rect.p1.y = h;
-
-	rc = gfx_fill_rect(gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-	return EOK;
-error:
-	if (color != NULL)
-		gfx_color_delete(color);
-	return rc;
-}
-
-/** Adjust advance of the current glyph.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_advance(font_edit_t *fedit, gfx_coord_t change)
-{
-	gfx_glyph_metrics_t gmetrics;
-
-	gfx_glyph_get_metrics(fedit->glyph, &gmetrics);
-	gmetrics.advance += change;
-	(void) gfx_glyph_set_metrics(fedit->glyph, &gmetrics);
-
-	font_edit_paint(fedit);
-}
-
-/** Adjust font ascent.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_ascent(font_edit_t *fedit, gfx_coord_t change)
-{
-	gfx_font_metrics_t fmetrics;
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-	fmetrics.ascent += change;
-	(void) gfx_font_set_metrics(fedit->font, &fmetrics);
-
-	printf("New ascent: %d\n", fmetrics.ascent);
-	font_edit_paint(fedit);
-}
-
-/** Adjust font descent.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_descent(font_edit_t *fedit, gfx_coord_t change)
-{
-	gfx_font_metrics_t fmetrics;
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-	fmetrics.descent += change;
-	(void) gfx_font_set_metrics(fedit->font, &fmetrics);
-
-	printf("New descent: %d\n", fmetrics.descent);
-	font_edit_paint(fedit);
-}
-
-/** Adjust font leading.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_leading(font_edit_t *fedit, gfx_coord_t change)
-{
-	gfx_font_metrics_t fmetrics;
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-	fmetrics.leading += change;
-	(void) gfx_font_set_metrics(fedit->font, &fmetrics);
-
-	printf("New leading: %d\n", fmetrics.leading);
-	font_edit_paint(fedit);
-}
-
-/** Adjust font underline Y0.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_underline_y0(font_edit_t *fedit,
-    gfx_coord_t change)
-{
-	gfx_font_metrics_t fmetrics;
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-	fmetrics.underline_y0 += change;
-	(void) gfx_font_set_metrics(fedit->font, &fmetrics);
-
-	printf("New underline Y0: %d\n", fmetrics.underline_y0);
-	font_edit_paint(fedit);
-}
-
-/** Adjust font underline Y1.
- *
- * @param fedit Font editor
- */
-static void font_edit_adjust_underline_y1(font_edit_t *fedit,
-    gfx_coord_t change)
-{
-	gfx_font_metrics_t fmetrics;
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-	fmetrics.underline_y1 += change;
-	(void) gfx_font_set_metrics(fedit->font, &fmetrics);
-
-	printf("New underline Y1: %d\n", fmetrics.underline_y1);
-	font_edit_paint(fedit);
-}
-
-/** Handle font editor close event.
- *
- * @param window Window
- * @param arg Argument (font_edit_t *)
- */
-static void font_edit_close_event(ui_window_t *window, void *arg)
-{
-	font_edit_t *fedit = (font_edit_t *) arg;
-
-	ui_quit(fedit->ui);
-}
-
-/** Handle font editor position event.
- *
- * @param window Window
- * @param arg Argument (font_edit_t *)
- * @param event Position event
- */
-static void font_edit_pos_event(ui_window_t *window, void *arg,
-    pos_event_t *event)
-{
-	font_edit_t *fedit = (font_edit_t *) arg;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	int x, y;
-
-	ui_window_get_app_rect(window, &rect);
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	if (event->type != POS_PRESS)
-		return;
-
-	if (!gfx_pix_inside_rect(&pos, &rect))
-		return;
-
-	x = gfx_coord_div_rneg(pos.x - glyph_orig_x -
-	    rect.p0.x, glyph_scale);
-	y = gfx_coord_div_rneg(pos.y - glyph_orig_y -
-	    rect.p0.y, glyph_scale);
-
-	printf("x=%d y=%d\n", x, y);
-	gfx_glyph_bmp_setpix(fedit->gbmp, x, y, fedit->pen_color);
-	font_edit_paint(fedit);
-}
-
-/** Duplicate previously selected glyph to the current glyph.
- *
- * @param fedit Font editor
- */
-static void font_edit_copy_paste(font_edit_t *fedit)
-{
-	gfx_glyph_bmp_t *src_bmp;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_rect_t rect;
-	gfx_coord_t x, y;
-	int pix;
-	errno_t rc;
-
-	/* If source and destination are the same, there is nothing to do. */
-	if (fedit->glyph == fedit->src_glyph)
-		return;
-
-	rc = gfx_glyph_bmp_open(fedit->src_glyph, &src_bmp);
-	if (rc != EOK) {
-		printf("Error opening source glyph.\n");
-		return;
-	}
-
-	gfx_glyph_bmp_get_rect(src_bmp, &rect);
-
-	rc = gfx_glyph_bmp_clear(fedit->gbmp);
-	if (rc != EOK) {
-		printf("Error clearing glyph bitmap.\n");
-		return;
-	}
-
-	for (y = rect.p0.y; y < rect.p1.y; y++) {
-		for (x = rect.p0.x; x < rect.p1.x; x++) {
-			pix = gfx_glyph_bmp_getpix(src_bmp, x, y);
-			rc = gfx_glyph_bmp_setpix(fedit->gbmp, x, y, pix);
-			if (rc != EOK) {
-				printf("Error setting pixel.\n");
-				return;
-			}
-		}
-	}
-
-	/* Copy metrics over */
-	gfx_glyph_get_metrics(fedit->src_glyph, &gmetrics);
-	(void) gfx_glyph_set_metrics(fedit->glyph, &gmetrics);
-
-	font_edit_paint(fedit);
-
-}
-
-/** Handle font editor control-key press.
- *
- * @param widget Canvas widget
- * @param data Position event
- */
-static void font_edit_ctrl_key(font_edit_t *fedit, kbd_event_t *event)
-{
-	errno_t rc;
-
-	switch (event->key) {
-	case KC_S:
-		printf("Save!\n");
-		(void) gfx_glyph_bmp_save(fedit->gbmp);
-		rc = gfx_typeface_save(fedit->typeface, fedit->fname);
-		if (rc != EOK)
-			printf("Error saving typeface.\n");
-		font_edit_paint(fedit);
-		break;
-	case KC_1:
-		printf("Set pixels\n");
-		fedit->pen_color = 1;
-		break;
-	case KC_2:
-		printf("Clear pixels\n");
-		fedit->pen_color = 0;
-		break;
-	case KC_3:
-		font_edit_adjust_advance(fedit, -1);
-		break;
-	case KC_4:
-		font_edit_adjust_advance(fedit, +1);
-		break;
-	case KC_5:
-		font_edit_adjust_ascent(fedit, -1);
-		break;
-	case KC_6:
-		font_edit_adjust_ascent(fedit, +1);
-		break;
-	case KC_7:
-		font_edit_adjust_descent(fedit, -1);
-		break;
-	case KC_8:
-		font_edit_adjust_descent(fedit, +1);
-		break;
-	case KC_9:
-		font_edit_adjust_leading(fedit, -1);
-		break;
-	case KC_0:
-		font_edit_adjust_leading(fedit, +1);
-		break;
-	case KC_U:
-		font_edit_adjust_underline_y0(fedit, -1);
-		break;
-	case KC_I:
-		font_edit_adjust_underline_y0(fedit, +1);
-		break;
-	case KC_O:
-		font_edit_adjust_underline_y1(fedit, -1);
-		break;
-	case KC_P:
-		font_edit_adjust_underline_y1(fedit, +1);
-		break;
-	case KC_X:
-		(void) gfx_glyph_bmp_clear(fedit->gbmp);
-		font_edit_paint(fedit);
-		break;
-	case KC_C:
-		/* Select source glyph for copying */
-		fedit->src_glyph = fedit->glyph;
-		break;
-	case KC_V:
-		/* Duplicate another glyph */
-		font_edit_copy_paste(fedit);
-		break;
-	default:
-		break;
-	}
-}
-
-/** Handle font editor unmodified key press.
- *
- * @param widget Canvas widget
- * @param data Position event
- */
-static void font_edit_unmod_key(font_edit_t *fedit, kbd_event_t *event)
-{
-	char str[5];
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_glyph_bmp_t *bmp;
-	size_t stradv;
-	errno_t rc;
-
-	if (event->c == '\0')
-		return;
-
-	printf("Character '%lc'\n", event->c);
-	snprintf(str, sizeof(str), "%lc", event->c);
-
-	rc = gfx_font_search_glyph(fedit->font, str, &glyph, &stradv);
-	if (rc == EOK) {
-		/* Found an existing glyph */
-		rc = gfx_glyph_bmp_open(glyph, &bmp);
-		if (rc != EOK) {
-			printf("Error opening glyph bitmap.\n");
-			return;
-		}
-
-		gfx_glyph_bmp_close(fedit->gbmp);
-		fedit->glyph = glyph;
-		fedit->gbmp = bmp;
-		font_edit_paint(fedit);
-		return;
-	}
-
-	/* Create new glyph */
-
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(fedit->font, &gmetrics, &glyph);
-	if (rc != EOK) {
-		printf("Error creating glyph.\n");
-		goto error;
-	}
-
-	rc = gfx_glyph_set_pattern(glyph, str);
-	if (rc != EOK) {
-		printf("Error setting glyph pattern.\n");
-		goto error;
-	}
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	if (rc != EOK) {
-		printf("Error opening glyph bitmap.\n");
-		goto error;
-	}
-
-	gfx_glyph_bmp_close(fedit->gbmp);
-	fedit->glyph = glyph;
-	fedit->gbmp = bmp;
-	font_edit_paint(fedit);
-	return;
-error:
-	if (glyph != NULL)
-		gfx_glyph_destroy(glyph);
-	return;
-}
-
-/** Handle font editor keyboard event.
- *
- * @param window Window
- * @param arg Argument (font_edit_t *)
- * @param event Keyboard event
- */
-static void font_edit_kbd_event(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	font_edit_t *fedit = (font_edit_t *) arg;
-
-	if (event->type != KEY_PRESS)
-		return;
-
-	if ((event->mods & KM_CTRL) != 0 &&
-	    (event->mods & (KM_ALT | KM_SHIFT)) == 0) {
-		font_edit_ctrl_key(fedit, event);
-	} else if ((event->mods & (KM_CTRL | KM_ALT)) == 0) {
-		font_edit_unmod_key(fedit, event);
-	}
-}
-
-/** Convert glyph pixel coordinates to displayed rectangle.
- *
- * Since we upscale the glyph a pixel in the glyph corresponds to a rectangle
- * on the screen.
- *
- * @param fedit Font editor
- * @param x X coordinate in glyph
- * @param y Y coordinate in glyph
- * @param drect Place to store displayed rectangle coordinates
- */
-static void font_edit_gpix_to_disp(font_edit_t *fedit, int x, int y,
-    gfx_rect_t *drect)
-{
-	(void) fedit;
-
-	drect->p0.x = glyph_orig_x + x * glyph_scale;
-	drect->p0.y = glyph_orig_y + y * glyph_scale;
-	drect->p1.x = glyph_orig_x + (x + 1) * glyph_scale;
-	drect->p1.y = glyph_orig_y + (y + 1) * glyph_scale;
-}
-
-/** Paint font preview string.
- *
- * @param fedit Font editor
- * @param x Starting X coordinate
- * @param y Starting Y coordinate
- * @param color Color
- * @param str String
- */
-static errno_t font_edit_paint_preview_str(font_edit_t *fedit,
-    gfx_coord_t x, gfx_coord_t y, gfx_color_t *color, const char *str)
-{
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = fedit->font;
-	fmt.color = color;
-
-	pos.x = x;
-	pos.y = y;
-
-	return gfx_puttext(&pos, &fmt, str);
-}
-
-/** Paint font preview.
- *
- * @param fedit Font editor
- */
-static errno_t font_edit_paint_preview(font_edit_t *fedit)
-{
-	gfx_color_t *color;
-	errno_t rc;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_set_color(fedit->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rc = font_edit_paint_preview_str(fedit, 20, 20, color,
-	    "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-	if (rc != EOK)
-		goto error;
-
-	rc = font_edit_paint_preview_str(fedit, 20, 40, color,
-	    "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG");
-	if (rc != EOK)
-		goto error;
-
-	rc = font_edit_paint_preview_str(fedit, 20, 60, color,
-	    "abcdefghijklmnopqrstuvwxyz");
-	if (rc != EOK)
-		goto error;
-
-	rc = font_edit_paint_preview_str(fedit, 20, 80, color,
-	    "the quick brown fox jumps over the lazy dog");
-	if (rc != EOK)
-		goto error;
-
-	rc = font_edit_paint_preview_str(fedit, 20, 100, color,
-	    "0123456789,./<>?;'\\:\"|[]{}`~!@#$%^&*()-_=+");
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	gfx_color_delete(color);
-	return rc;
-}
-
-/** Paint glyph bitmap.
- *
- * @param fedit Font editor
- */
-static errno_t font_edit_paint_gbmp(font_edit_t *fedit)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	gfx_rect_t rect2;
-	gfx_rect_t grect;
-	gfx_font_metrics_t fmetrics;
-	gfx_glyph_metrics_t gmetrics;
-	errno_t rc;
-	int x, y;
-	int pix;
-
-	/* Display font baseline, ascent, descent, leading */
-
-	gfx_font_get_metrics(fedit->font, &fmetrics);
-
-	rc = gfx_color_new_rgb_i16(0, 0x4000, 0x4000, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(fedit->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, 0, &rect);
-	rect.p1.x += 100;
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, -fmetrics.ascent, &rect);
-	rect.p1.x += 100;
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, fmetrics.descent, &rect);
-	rect.p1.x += 100;
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, fmetrics.descent +
-	    fmetrics.leading, &rect);
-	rect.p1.x += 100;
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-
-	/* Display underline */
-
-	rc = gfx_color_new_rgb_i16(0x4000, 0x4000, 0, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(fedit->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, fmetrics.underline_y0, &rect);
-	font_edit_gpix_to_disp(fedit, 10, fmetrics.underline_y1, &rect2);
-	rect.p1 = rect2.p0;
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-
-	/* Display glyph */
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(fedit->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	gfx_glyph_bmp_get_rect(fedit->gbmp, &grect);
-	printf("grect=%d,%d,%d,%d\n", grect.p0.x, grect.p0.y,
-	    grect.p1.x, grect.p1.y);
-
-	for (y = grect.p0.y; y < grect.p1.y; y++) {
-		for (x = grect.p0.x; x < grect.p1.x; x++) {
-			pix = gfx_glyph_bmp_getpix(fedit->gbmp, x, y);
-
-			if (pix != 0) {
-				font_edit_gpix_to_disp(fedit, x, y, &rect);
-
-				rc = gfx_fill_rect(fedit->gc, &rect);
-				if (rc != EOK)
-					goto error;
-			}
-		}
-	}
-
-	gfx_color_delete(color);
-
-	/* Display glyph origin and advance */
-
-	rc = gfx_color_new_rgb_i16(0, 0xffff, 0, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(fedit->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	font_edit_gpix_to_disp(fedit, 0, 0, &rect);
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_glyph_get_metrics(fedit->glyph, &gmetrics);
-
-	font_edit_gpix_to_disp(fedit, gmetrics.advance, 0, &rect);
-
-	rc = gfx_fill_rect(fedit->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-
-	return EOK;
-error:
-	if (color != NULL)
-		gfx_color_delete(color);
-	return rc;
-}
-
-/** Paint font editor.
- *
- * @param fedit Font editor
- */
-static errno_t font_edit_paint(font_edit_t *fedit)
-{
-	int w, h;
-	errno_t rc;
-
-	w = fedit->width;
-	h = fedit->height;
-
-	rc = clear_scr(fedit->gc, w, h);
-	if (rc != EOK)
-		return rc;
-
-	rc = font_edit_paint_gbmp(fedit);
-	if (rc != EOK)
-		return rc;
-
-	rc = font_edit_paint_preview(fedit);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Create font editor.
- *
- * @param display_spec Display specifier
- * @param fname Font file to open or @c NULL to create new font
- * @param rfedit Place to store pointer to new font editor
- * @return EOK on success or an error code
- */
-static errno_t font_edit_create(const char *display_spec, const char *fname,
-    font_edit_t **rfedit)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	gfx_rect_t rect;
-	gfx_rect_t wrect;
-	gfx_coord2_t off;
-	ui_window_t *window = NULL;
-	gfx_context_t *gc = NULL;
-	font_edit_t *fedit = NULL;
-	gfx_typeface_t *tface = NULL;
-	gfx_font_t *font = NULL;
-	gfx_font_info_t *finfo;
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_glyph_bmp_t *bmp;
-	gfx_coord_t vw, vh;
-	errno_t rc;
-
-	fedit = calloc(1, sizeof(font_edit_t));
-	if (fedit == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	printf("Init UI..\n");
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error initializing UI (%s)\n", display_spec);
-		goto error;
-	}
-
-	vw = 400;
-	vh = 300;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = vw;
-	rect.p1.y = vh;
-
-	ui_wnd_params_init(&params);
-	params.caption = "Font Editor";
-
-	/*
-	 * Compute window rectangle such that application area corresponds
-	 * to rect
-	 */
-	ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect);
-	off = wrect.p0;
-	gfx_rect_rtranslate(&off, &wrect, &params.rect);
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &font_edit_window_cb, (void *) fedit);
-
-	rc = ui_window_get_app_gc(window, &gc);
-	if (rc != EOK) {
-		printf("Error creating graphic context.\n");
-		goto error;
-	}
-
-	if (fname == NULL) {
-		rc = gfx_typeface_create(gc, &tface);
-		if (rc != EOK) {
-			printf("Error creating typeface.\n");
-			goto error;
-		}
-
-		gfx_font_props_init(&props);
-		gfx_font_metrics_init(&metrics);
-
-		rc = gfx_font_create(tface, &props, &metrics, &font);
-		if (rc != EOK) {
-			printf("Error creating font.\n");
-			goto error;
-		}
-
-		gfx_glyph_metrics_init(&gmetrics);
-
-		rc = gfx_glyph_create(font, &gmetrics, &glyph);
-		if (rc != EOK) {
-			printf("Error creating glyph.\n");
-			goto error;
-		}
-
-		rc = gfx_glyph_set_pattern(glyph, "A");
-		if (rc != EOK) {
-			printf("Error setting glyph pattern.\n");
-			goto error;
-		}
-	} else {
-		rc = gfx_typeface_open(gc, fname, &tface);
-		if (rc != EOK) {
-			printf("Error opening typeface '%s.\n",
-			    fname);
-			goto error;
-		}
-
-		finfo = gfx_typeface_first_font(tface);
-		rc = gfx_font_open(finfo, &font);
-		if (rc != EOK) {
-			printf("Error opening font.\n");
-			goto error;
-		}
-
-		glyph = gfx_font_first_glyph(font);
-	}
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	if (rc != EOK) {
-		printf("Error opening glyph bitmap.\n");
-		goto error;
-	}
-
-	if (fname == NULL)
-		fname = "new.tpf";
-
-	fedit->ui = ui;
-	fedit->window = window;
-	fedit->gc = gc;
-	fedit->width = vw;
-	fedit->height = vh;
-	fedit->pen_color = 1;
-	fedit->fname = fname;
-	fedit->typeface = tface;
-	fedit->font = font;
-	fedit->glyph = glyph;
-	fedit->gbmp = bmp;
-
-	*rfedit = fedit;
-	return EOK;
-error:
-	/*
-	 * Once the window is created it would be probably more correct
-	 * to leave destruction of these resources to a window destroy
-	 * handler (which we have no way of registering)
-	 */
-	if (bmp != NULL)
-		gfx_glyph_bmp_close(bmp);
-	if (glyph != NULL)
-		gfx_glyph_destroy(glyph);
-	if (font != NULL)
-		gfx_font_close(font);
-	if (tface != NULL)
-		gfx_typeface_destroy(tface);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (ui != NULL)
-		ui_destroy(ui);
-	if (fedit != NULL)
-		free(fedit);
-	return rc;
-}
-
-/** Destroy font editor.
- *
- * @param fedit Font editor
- */
-static void font_edit_destroy(font_edit_t *fedit)
-{
-	gfx_glyph_bmp_close(fedit->gbmp);
-	gfx_glyph_destroy(fedit->glyph);
-	gfx_font_close(fedit->font);
-	gfx_typeface_destroy(fedit->typeface);
-	ui_window_destroy(fedit->window);
-	ui_destroy(fedit->ui);
-	free(fedit);
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: fontedit [-d <display-spec>] [<file.tpf>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	const char *display_spec = UI_DISPLAY_DEFAULT;
-	const char *fname = NULL;
-	font_edit_t *fedit;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	/* File name argument? */
-	if (i < argc) {
-		fname = argv[i];
-		++i;
-	}
-
-	/* Extra arguments? */
-	if (i < argc) {
-		printf("Unexpected argument '%s'.\n", argv[i]);
-		print_syntax();
-		return 1;
-	}
-
-	rc = font_edit_create(display_spec, fname, &fedit);
-	if (rc != EOK)
-		return 1;
-
-	(void) font_edit_paint(fedit);
-
-	ui_run(fedit->ui);
-	font_edit_destroy(fedit);
-
-	(void) font_edit_kbd_event;
-	(void) font_edit_pos_event;
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/fontedit/fontedit.h
===================================================================
--- uspace/app/fontedit/fontedit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef FONTEDIT_H
-#define FONTEDIT_H
-
-#include <gfx/glyph.h>
-#include <gfx/glyph_bmp.h>
-#include <gfx/typeface.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Font editor */
-typedef struct {
-	/** UI */
-	ui_t *ui;
-	/** Window */
-	ui_window_t *window;
-	/** Graphic context */
-	gfx_context_t *gc;
-	/** Window width */
-	int width;
-	/** Window height */
-	int height;
-	/** Pen color (1 = set, 0 = reset) */
-	int pen_color;
-	/** File name */
-	const char *fname;
-	/** Typeface */
-	gfx_typeface_t *typeface;
-	/** Font */
-	gfx_font_t *font;
-	/** Glyph */
-	gfx_glyph_t *glyph;
-	/** Glyph bitmap */
-	gfx_glyph_bmp_t *gbmp;
-	/** Glyph used as source for copy/paste */
-	gfx_glyph_t *src_glyph;
-} font_edit_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/fontedit/meson.build
===================================================================
--- uspace/app/fontedit/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui', 'gfx', 'gfxfont' ]
-src = files(
-	'fontedit.c',
-)
Index: pace/app/getterm/doc/doxygroups.h
===================================================================
--- uspace/app/getterm/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup getterm getterm
- * @brief Console initialization task
- * @ingroup apps
- */
Index: pace/app/getterm/getterm.c
===================================================================
--- uspace/app/getterm/getterm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <task.h>
-#include <str_error.h>
-#include <errno.h>
-#include <loc.h>
-#include <vfs/vfs.h>
-#include <str.h>
-#include "version.h"
-#include "welcome.h"
-
-#define APP_NAME  "getterm"
-
-static void usage(void)
-{
-	printf("Usage: %s <terminal> <locfs> [--msg] [--wait] -- "
-	    "<command> [<arguments...>]\n", APP_NAME);
-	printf(" <terminal>    Terminal device\n");
-	printf(" <locfs>       Mount point of locfs\n");
-	printf(" --msg         Print welcome message\n");
-	printf(" --wait        Wait for the terminal to be ready\n");
-}
-
-static void reopen(FILE **stream, int fd, const char *path, int mode,
-    const char *fmode)
-{
-	if (fclose(*stream))
-		return;
-
-	*stream = NULL;
-
-	int oldfd;
-	errno_t rc = vfs_lookup_open(path, WALK_REGULAR, mode, &oldfd);
-	if (rc != EOK)
-		return;
-
-	if (oldfd != fd) {
-		int newfd;
-		if (vfs_clone(oldfd, fd, false, &newfd) != EOK)
-			return;
-
-		assert(newfd == fd);
-
-		if (vfs_put(oldfd))
-			return;
-	}
-
-	*stream = fdopen(fd, fmode);
-}
-
-int main(int argc, char *argv[])
-{
-	argv++;
-	argc--;
-	if (argc < 4) {
-		usage();
-		return 1;
-	}
-
-	char *term = *argv;
-	argv++;
-	argc--;
-
-	char *locfs = *argv;
-	argv++;
-	argc--;
-
-	bool print_msg = false;
-	bool wait = false;
-
-	while ((argc > 0) && (str_cmp(*argv, "--") != 0)) {
-		if (str_cmp(*argv, "--msg") == 0) {
-			print_msg = true;
-		} else if (str_cmp(*argv, "--wait") == 0) {
-			wait = true;
-		} else {
-			usage();
-			return 2;
-		}
-
-		argv++;
-		argc--;
-	}
-
-	if (argc < 1) {
-		usage();
-		return 3;
-	}
-
-	/* Skip "--" */
-	argv++;
-	argc--;
-
-	char *cmd = *argv;
-	char **args = argv;
-
-	if (wait) {
-		/* Wait for the terminal service to be ready */
-		service_id_t service_id;
-		errno_t rc = loc_service_get_id(term, &service_id, IPC_FLAG_BLOCKING);
-		if (rc != EOK) {
-			printf("%s: Error waiting on %s (%s)\n", APP_NAME, term,
-			    str_error(rc));
-			return rc;
-		}
-	}
-
-	char term_node[LOC_NAME_MAXLEN];
-	snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term);
-
-	reopen(&stdin, 0, term_node, MODE_READ, "r");
-	reopen(&stdout, 1, term_node, MODE_WRITE, "w");
-	reopen(&stderr, 2, term_node, MODE_WRITE, "w");
-
-	if (stdin == NULL)
-		return 4;
-
-	if (stdout == NULL)
-		return 5;
-
-	if (stderr == NULL)
-		return 6;
-
-	/*
-	 * FIXME: fdopen() should actually detect that we are opening a console
-	 * and it should set line-buffering mode automatically.
-	 */
-	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
-
-	version_print(term);
-	if (print_msg)
-		welcome_msg_print();
-
-	task_id_t id;
-	task_wait_t twait;
-
-	errno_t rc = task_spawnv(&id, &twait, cmd, (const char *const *) args);
-	if (rc != EOK) {
-		printf("%s: Error spawning %s (%s)\n", APP_NAME, cmd,
-		    str_error(rc));
-		return rc;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&twait, &texit, &retval);
-	if (rc != EOK) {
-		printf("%s: Error waiting for %s (%s)\n", APP_NAME, cmd,
-		    str_error(rc));
-		return rc;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/getterm/getterm.h
===================================================================
--- uspace/app/getterm/getterm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef GETTERM_H__
-#define GETTERM_H__
-
-#endif
-
-/** @}
- */
Index: pace/app/getterm/meson.build
===================================================================
--- uspace/app/getterm/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-c_args += [ '-DHELENOS_RELEASE=' + HELENOS_RELEASE, '-DHELENOS_COPYRIGHT=' + HELENOS_COPYRIGHT, '-DHELENOS_CODENAME=' + HELENOS_CODENAME ]
-src = files(
-	'getterm.c',
-	'version.c',
-	'welcome.c',
-)
Index: pace/app/getterm/version.c
===================================================================
--- uspace/app/getterm/version.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <macros.h>
-#include "getterm.h"
-#include "version.h"
-
-static const char *copyright = STRING(HELENOS_COPYRIGHT);
-static const char *release = STRING(HELENOS_RELEASE);
-static const char *name = STRING(HELENOS_CODENAME);
-static const char *arch = STRING(UARCH);
-
-#ifdef REVISION
-static const char *revision = ", revision " STRING(REVISION);
-#else
-static const char *revision = "";
-#endif
-
-#ifdef TIMESTAMP
-static const char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
-#else
-static const char *timestamp = "";
-#endif
-
-/** Print version information. */
-void version_print(const char *term)
-{
-	printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp);
-	printf("Running on %s (%s)\n", arch, term);
-	printf("%s\n\n", copyright);
-}
-
-/** @}
- */
Index: pace/app/getterm/version.h
===================================================================
--- uspace/app/getterm/version.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef VERSION_H__
-#define VERSION_H__
-
-extern void version_print(const char *term);
-
-#endif
-
-/** @}
- */
Index: pace/app/getterm/welcome.c
===================================================================
--- uspace/app/getterm/welcome.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include "welcome.h"
-
-/** Welcome message and survival tips. */
-void welcome_msg_print(void)
-{
-	printf("Welcome to HelenOS!\n");
-	printf("https://www.helenos.org/\n\n");
-	printf("Type 'help' [Enter] to see a few survival tips.\n\n");
-}
-
-/** @}
- */
Index: pace/app/getterm/welcome.h
===================================================================
--- uspace/app/getterm/welcome.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup getterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef WELCOME_H__
-#define WELCOME_H__
-
-extern void welcome_msg_print(void);
-
-#endif
-
-/** @}
- */
Index: pace/app/gfxdemo/doc/doxygroups.h
===================================================================
--- uspace/app/gfxdemo/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup gfxdemo gfxdemo
- * @brief Graphic demo
- * @ingroup apps
- */
Index: pace/app/gfxdemo/gfxdemo.c
===================================================================
--- uspace/app/gfxdemo/gfxdemo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1376 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup gfxdemo
- * @{
- */
-/** @file Graphic demo
- */
-
-#include <congfx/console.h>
-#include <display.h>
-#include <fibril.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/render.h>
-#include <gfx/font.h>
-#include <gfx/text.h>
-#include <gfx/typeface.h>
-#include <io/console.h>
-#include <io/pixelmap.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <ui/wdecor.h>
-#include "gfxdemo.h"
-
-static void wnd_close_event(void *);
-static void wnd_kbd_event(void *, kbd_event_t *);
-
-static display_wnd_cb_t wnd_cb = {
-	.close_event = wnd_close_event,
-	.kbd_event = wnd_kbd_event
-};
-
-static void uiwnd_close_event(ui_window_t *, void *);
-static void uiwnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t ui_window_cb = {
-	.close = uiwnd_close_event,
-	.kbd = uiwnd_kbd_event
-};
-
-static void demo_kbd_event(kbd_event_t *);
-
-static bool quit = false;
-static FIBRIL_MUTEX_INITIALIZE(quit_lock);
-static FIBRIL_CONDVAR_INITIALIZE(quit_cv);
-static gfx_typeface_t *tface;
-static gfx_font_t *font;
-static gfx_coord_t vpad;
-static console_ctrl_t *con = NULL;
-static bool textmode;
-static ui_t *ui;
-
-/** Determine if we are running in text mode.
- *
- * @return @c true iff we are running in text mode
- */
-static bool demo_is_text(void)
-{
-	return textmode;
-}
-
-/** Sleep until timeout or quit request.
- *
- * @param msec Number of microseconds to sleep for
- */
-static void demo_msleep(unsigned msec)
-{
-	errno_t rc;
-	usec_t usec;
-	cons_event_t cevent;
-
-	if (ui != NULL)
-		ui_unlock(ui);
-	fibril_mutex_lock(&quit_lock);
-	if (!quit) {
-		if (con != NULL) {
-			usec = (usec_t)msec * 1000;
-			while (usec > 0 && !quit) {
-				rc = console_get_event_timeout(con, &cevent, &usec);
-				if (rc == EOK) {
-					if (cevent.type == CEV_KEY) {
-						fibril_mutex_unlock(&quit_lock);
-						demo_kbd_event(&cevent.ev.key);
-						fibril_mutex_lock(&quit_lock);
-					}
-				}
-			}
-		} else {
-			(void) fibril_condvar_wait_timeout(&quit_cv, &quit_lock,
-			    (usec_t)msec * 1000);
-		}
-	}
-	fibril_mutex_unlock(&quit_lock);
-	if (ui != NULL)
-		ui_lock(ui);
-}
-
-/** Clear screen.
- *
- * @param gc Graphic context
- * @param w Screen width
- * @param h Screen height
- */
-static errno_t clear_scr(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = w;
-	rect.p1.y = h;
-
-	rc = gfx_fill_rect(gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-	return EOK;
-error:
-	if (color != NULL)
-		gfx_color_delete(color);
-	return rc;
-}
-
-/** Initialize demo font.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- * @return EOK on success or an error code
- */
-static errno_t demo_font_init(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_font_info_t *finfo;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	/* XXX Crude way of detecting text mode */
-	if (demo_is_text()) {
-		/* Create dummy font for text mode */
-		rc = gfx_typeface_create(gc, &tface);
-		if (rc != EOK) {
-			printf("Error creating typeface\n");
-			goto error;
-		}
-
-		rc = gfx_font_create_textmode(tface, &font);
-		if (rc != EOK) {
-			printf("Error creating font\n");
-			goto error;
-		}
-
-		vpad = 0;
-	} else {
-		/* Load font */
-		rc = gfx_typeface_open(gc, "/data/font/helena.tpf", &tface);
-		if (rc != EOK) {
-			printf("Error opening typeface\n");
-			goto error;
-		}
-
-		finfo = gfx_typeface_first_font(tface);
-		if (finfo == NULL) {
-			printf("Typeface contains no font.\n");
-			rc = ENOENT;
-			goto error;
-		}
-
-		rc = gfx_font_open(finfo, &font);
-		if (rc != EOK) {
-			printf("Error opening font.\n");
-			goto error;
-		}
-
-		vpad = 5;
-	}
-
-	return EOK;
-error:
-	if (tface != NULL)
-		gfx_typeface_destroy(tface);
-	return rc;
-}
-
-/** Finalize demo font. */
-static void demo_font_fini(void)
-{
-	if (font == NULL)
-		return;
-
-	gfx_font_close(font);
-	font = NULL;
-
-	gfx_typeface_destroy(tface);
-	tface = NULL;
-}
-
-/** Start a new demo screen.
- *
- * Clear the screen, display a status line and set up clipping.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- * @param text Demo screen description
- * @return EOK on success or an error code
- */
-static errno_t demo_begin(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h,
-    const char *text)
-{
-	gfx_text_fmt_t fmt;
-	gfx_font_metrics_t metrics;
-	gfx_coord2_t pos;
-	gfx_color_t *color;
-	gfx_rect_t rect;
-	gfx_coord_t height;
-	errno_t rc;
-
-	rc = gfx_set_clip_rect(gc, NULL);
-	if (rc != EOK)
-		return rc;
-
-	rc = clear_scr(gc, w, h);
-	if (rc != EOK)
-		return rc;
-
-	if (font != NULL) {
-		if (demo_is_text()) {
-			rc = gfx_color_new_ega(0x1e, &color);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-			if (rc != EOK)
-				goto error;
-		}
-
-		gfx_text_fmt_init(&fmt);
-		fmt.font = font;
-		fmt.color = color;
-		fmt.halign = gfx_halign_center;
-		fmt.valign = gfx_valign_bottom;
-
-		pos.x = w / 2;
-		pos.y = h;
-		rc = gfx_puttext(&pos, &fmt, text);
-		if (rc != EOK) {
-			printf("Error rendering text.\n");
-			gfx_color_delete(color);
-			goto error;
-		}
-
-		gfx_color_delete(color);
-
-		gfx_font_get_metrics(font, &metrics);
-		height = metrics.ascent + metrics.descent + 1;
-	} else {
-		height = 0;
-	}
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = w;
-	rect.p1.y = h - height - vpad;
-	rc = gfx_set_clip_rect(gc, &rect);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Run rectangle demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_rects(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	int i, j;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Rectangle rendering");
-	if (rc != EOK)
-		return rc;
-
-	for (j = 0; j < 10; j++) {
-		rc = gfx_color_new_rgb_i16(rand() % 0x10000, rand() % 0x10000,
-		    rand() % 0x10000, &color);
-		if (rc != EOK)
-			return rc;
-
-		rc = gfx_set_color(gc, color);
-		if (rc != EOK)
-			return rc;
-
-		for (i = 0; i < 10; i++) {
-			rect.p0.x = rand() % (w - 1);
-			rect.p0.y = rand() % (h - 1);
-			rect.p1.x = rect.p0.x + rand() % (w - 1 - rect.p0.x);
-			rect.p1.y = rect.p0.y + rand() % (h - 1 - rect.p0.y);
-
-			rc = gfx_fill_rect(gc, &rect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		gfx_color_delete(color);
-
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	return EOK;
-}
-
-/** Fill bitmap with tartan pattern.
- *
- * @param bitmap Bitmap
- * @param w Bitmap width
- * @param h Bitmap height
- * @return EOK on success or an error code
- */
-static errno_t bitmap_tartan(gfx_bitmap_t *bitmap, gfx_coord_t w, gfx_coord_t h)
-{
-	int i, j;
-	pixelmap_t pixelmap;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	/* In absence of anything else, use pixelmap */
-	pixelmap.width = w;
-	pixelmap.height = h;
-	pixelmap.data = alloc.pixels;
-
-	for (i = 0; i < w; i++) {
-		for (j = 0; j < h; j++) {
-			pixelmap_put_pixel(&pixelmap, i, j,
-			    PIXEL(255, (i % 30) < 3 ? 255 : 0,
-			    (j % 30) < 3 ? 255 : 0, i / 2));
-		}
-	}
-
-	return EOK;
-}
-
-/** Fill bitmap with moire pattern.
- *
- * @param bitmap Bitmap
- * @param w Bitmap width
- * @param h Bitmap height
- * @return EOK on success or an error code
- */
-static errno_t bitmap_moire(gfx_bitmap_t *bitmap, gfx_coord_t w, gfx_coord_t h)
-{
-	int i, j;
-	int k;
-	pixelmap_t pixelmap;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	/* In absence of anything else, use pixelmap */
-	pixelmap.width = w;
-	pixelmap.height = h;
-	pixelmap.data = alloc.pixels;
-
-	for (i = 0; i < w; i++) {
-		for (j = 0; j < h; j++) {
-			k = i * i + j * j;
-			pixelmap_put_pixel(&pixelmap, i, j,
-			    PIXEL(255, k, k, k));
-		}
-	}
-
-	return EOK;
-}
-
-/** Render circle to a bitmap.
- *
- * @param bitmap Bitmap
- * @param w Bitmap width
- * @param h Bitmap height
- * @return EOK on success or an error code
- */
-static errno_t bitmap_circle(gfx_bitmap_t *bitmap, gfx_coord_t w, gfx_coord_t h)
-{
-	int i, j;
-	int k;
-	pixelmap_t pixelmap;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	/* In absence of anything else, use pixelmap */
-	pixelmap.width = w;
-	pixelmap.height = h;
-	pixelmap.data = alloc.pixels;
-
-	for (i = 0; i < w; i++) {
-		for (j = 0; j < h; j++) {
-			k = i * i + j * j;
-			pixelmap_put_pixel(&pixelmap, i, j,
-			    k < w * w / 2 ? PIXEL(255, 0, 255, 0) :
-			    PIXEL(255, 255, 0, 255));
-		}
-	}
-
-	return EOK;
-}
-
-/** Run bitmap demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_bitmap(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_params_t params;
-	int i, j;
-	gfx_coord2_t offs;
-	gfx_rect_t srect;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Bitmap rendering without offset");
-	if (rc != EOK)
-		return rc;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = w;
-	params.rect.p1.y = h;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = bitmap_tartan(bitmap, w, h);
-	if (rc != EOK)
-		goto error;
-
-	for (j = 0; j < 10; j++) {
-		for (i = 0; i < 5; i++) {
-			srect.p0.x = rand() % (w - 40);
-			srect.p0.y = rand() % (h - 20);
-			srect.p1.x = srect.p0.x + rand() % (w - srect.p0.x);
-			srect.p1.y = srect.p0.y + rand() % (h - srect.p0.y);
-			offs.x = 0;
-			offs.y = 0;
-
-			rc = gfx_bitmap_render(bitmap, &srect, &offs);
-			if (rc != EOK)
-				goto error;
-
-			demo_msleep(250);
-			if (quit)
-				goto out;
-		}
-	}
-
-out:
-	gfx_bitmap_destroy(bitmap);
-
-	return EOK;
-error:
-	gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Run second bitmap demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_bitmap2(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_params_t params;
-	int i, j;
-	gfx_coord2_t offs;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Bitmap rendering with offset");
-	if (rc != EOK)
-		return rc;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 40;
-	params.rect.p1.y = 20;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = bitmap_moire(bitmap, 40, 20);
-	if (rc != EOK)
-		goto error;
-
-	for (j = 0; j < 10; j++) {
-		for (i = 0; i < 10; i++) {
-			offs.x = rand() % (w - 40);
-			offs.y = rand() % (h - 20);
-
-			rc = gfx_bitmap_render(bitmap, NULL, &offs);
-			if (rc != EOK)
-				goto error;
-		}
-
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	gfx_bitmap_destroy(bitmap);
-
-	return EOK;
-error:
-	gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Run bitmap color key demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_bitmap_kc(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_params_t params;
-	int i, j;
-	gfx_coord2_t offs;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Bitmap rendering with color key");
-	if (rc != EOK)
-		return rc;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 40;
-	params.rect.p1.y = 40;
-	params.flags = bmpf_color_key;
-	params.key_color = PIXEL(255, 255, 0, 255);
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = bitmap_circle(bitmap, 40, 40);
-	if (rc != EOK)
-		goto error;
-
-	for (j = 0; j < 10; j++) {
-		for (i = 0; i < 10; i++) {
-			offs.x = j * 20 + i * 20;
-			offs.y = i * 20;
-
-			rc = gfx_bitmap_render(bitmap, NULL, &offs);
-			if (rc != EOK)
-				goto error;
-		}
-
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	gfx_bitmap_destroy(bitmap);
-
-	return EOK;
-error:
-	gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Run text demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_text(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	int i;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Text rendering");
-	if (rc != EOK)
-		goto error;
-
-	/* Vertical bars */
-
-	for (i = 0; i < 20; i++) {
-		rc = gfx_color_new_rgb_i16(0, 0x8000 * i / 20,
-		    0x8000 * i / 20, &color);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_set_color(gc, color);
-		if (rc != EOK)
-			goto error;
-
-		rect.p0.x = w * i / 20;
-		rect.p0.y = 0;
-		rect.p1.x = w * (i + 1) / 20;
-		rect.p1.y = h;
-
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			goto error;
-
-		gfx_color_delete(color);
-	}
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0x8000, &color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = w / 20;
-	rect.p0.y = 1 * h / 15;
-	rect.p1.x = w - w / 20;
-	rect.p1.y = 4 * h / 15;
-
-	rc = gfx_fill_rect(gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-
-	if (demo_is_text()) {
-		rc = gfx_color_new_ega(0x1f, &color);
-		if (rc != EOK)
-			goto error;
-	} else {
-		rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-		if (rc != EOK)
-			goto error;
-	}
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = color;
-
-	pos.x = rect.p0.x;
-	pos.y = rect.p0.y;
-	rc = gfx_puttext(&pos, &fmt, "Top left");
-	if (rc != EOK) {
-		printf("Error rendering text.\n");
-		goto error;
-	}
-
-	pos.x = (rect.p0.x + rect.p1.x - 1) / 2;
-	pos.y = rect.p0.y;
-	fmt.halign = gfx_halign_center;
-	rc = gfx_puttext(&pos, &fmt, "Top center");
-	if (rc != EOK)
-		goto error;
-
-	pos.x = rect.p1.x;
-	pos.y = rect.p0.y;
-	fmt.halign = gfx_halign_right;
-	rc = gfx_puttext(&pos, &fmt, "Top right");
-	if (rc != EOK)
-		goto error;
-
-	fmt.valign = gfx_valign_center;
-
-	pos.x = rect.p0.x;
-	pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
-	fmt.halign = gfx_halign_left;
-	rc = gfx_puttext(&pos, &fmt, "Center left");
-	if (rc != EOK)
-		goto error;
-
-	pos.x = (rect.p0.x + rect.p1.x - 1) / 2;
-	pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
-	fmt.halign = gfx_halign_center;
-	rc = gfx_puttext(&pos, &fmt, "Center");
-	if (rc != EOK)
-		goto error;
-
-	pos.x = rect.p1.x;
-	pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
-	fmt.halign = gfx_halign_right;
-	rc = gfx_puttext(&pos, &fmt, "Center right");
-	if (rc != EOK)
-		goto error;
-
-	fmt.valign = gfx_valign_bottom;
-
-	pos.x = rect.p0.x;
-	pos.y = rect.p1.y - 1;
-	fmt.halign = gfx_halign_left;
-	rc = gfx_puttext(&pos, &fmt, "Bottom left");
-	if (rc != EOK)
-		goto error;
-
-	pos.x = (rect.p0.x + rect.p1.x - 1) / 2;
-	pos.y = rect.p1.y;
-	fmt.halign = gfx_halign_center;
-	rc = gfx_puttext(&pos, &fmt, "Bottom center");
-	if (rc != EOK)
-		goto error;
-
-	pos.x = rect.p1.x;
-	pos.y = rect.p1.y;
-	fmt.halign = gfx_halign_right;
-	rc = gfx_puttext(&pos, &fmt, "Bottom right");
-	if (rc != EOK)
-		goto error;
-
-	gfx_color_delete(color);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-
-	for (i = 0; i < 8; i++) {
-		if (demo_is_text()) {
-			rc = gfx_color_new_ega(i != 0 ? i : 0x10, &color);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0,
-			    (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color);
-			if (rc != EOK)
-				goto error;
-		}
-
-		fmt.color = color;
-		fmt.underline = !fmt.underline;
-
-		pos.x = w / 20;
-		pos.y = (6 + i) * h / 15;
-		rc = gfx_puttext(&pos, &fmt, "The quick brown fox jumps over the lazy dog.");
-		if (rc != EOK)
-			goto error;
-
-		gfx_color_delete(color);
-	}
-
-	for (i = 0; i < 10; i++) {
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Run text abbreviation demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_text_abbr(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_color_t *color = NULL;
-	gfx_rect_t rect;
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	int i;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Text abbreviation");
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < 11; i++) {
-
-		rc = gfx_color_new_rgb_i16(0, 0, 0x8000, &color);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_set_color(gc, color);
-		if (rc != EOK)
-			goto error;
-
-		rect.p0.x = w / 20;
-		rect.p0.y = (2 + 2 * i) * h / 25;
-		rect.p1.x = w - w / 20 - w * i / 12;
-		rect.p1.y = (3 + 2 * i) * h / 25;
-
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			goto error;
-
-		gfx_color_delete(color);
-
-		if (demo_is_text()) {
-			rc = gfx_color_new_ega(0x1f, &color);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-			    &color);
-			if (rc != EOK)
-				goto error;
-		}
-
-		gfx_text_fmt_init(&fmt);
-		fmt.font = font;
-		fmt.color = color;
-		fmt.abbreviate = true;
-		fmt.width = rect.p1.x - rect.p0.x;
-
-		pos.x = rect.p0.x;
-		pos.y = rect.p0.y;
-		rc = gfx_puttext(&pos, &fmt,
-		    "The quick brow fox jumps over the lazy dog!");
-		if (rc != EOK) {
-			printf("Error rendering text.\n");
-			goto error;
-		}
-	}
-
-	for (i = 0; i < 10; i++) {
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Run clipping demo on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_clip(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_bitmap_t *bitmap;
-	gfx_color_t *color;
-	gfx_bitmap_params_t params;
-	int i, j;
-	gfx_coord2_t offs;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	if (quit)
-		return EOK;
-
-	rc = demo_begin(gc, w, h, "Clipping demonstration");
-	if (rc != EOK)
-		return rc;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 40;
-	params.rect.p1.y = 20;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = bitmap_moire(bitmap, 40, 20);
-	if (rc != EOK)
-		goto error;
-
-	for (j = 0; j < 10; j++) {
-		rect.p0.x = w / 8;
-		rect.p0.y = h / 8;
-		rect.p1.x = w * 7 / 8;
-		rect.p1.y = h * 3 / 8;
-
-		rc = gfx_set_clip_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-
-		rc = gfx_color_new_rgb_i16(rand() % 0x10000, rand() % 0x10000,
-		    rand() % 0x10000, &color);
-		if (rc != EOK)
-			return rc;
-
-		rc = gfx_set_color(gc, color);
-		if (rc != EOK)
-			return rc;
-
-		for (i = 0; i < 10; i++) {
-			rect.p0.x = rand() % (w - 1);
-			rect.p0.y = rand() % (h - 1);
-			rect.p1.x = rect.p0.x + rand() % (w - 1 - rect.p0.x);
-			rect.p1.y = rect.p0.y + rand() % (h - 1 - rect.p0.y);
-
-			rc = gfx_fill_rect(gc, &rect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		gfx_color_delete(color);
-
-		rect.p0.x = w / 8;
-		rect.p0.y = h * 5 / 8;
-		rect.p1.x = w * 7 / 8;
-		rect.p1.y = h * 7 / 8;
-
-		rc = gfx_set_clip_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-
-		for (i = 0; i < 10; i++) {
-			offs.x = rand() % (w - 40);
-			offs.y = rand() % (h - 20);
-
-			rc = gfx_bitmap_render(bitmap, NULL, &offs);
-			if (rc != EOK)
-				goto error;
-		}
-
-		demo_msleep(500);
-		if (quit)
-			break;
-	}
-
-	(void) gfx_set_clip_rect(gc, NULL);
-	gfx_bitmap_destroy(bitmap);
-	return EOK;
-error:
-	(void) gfx_set_clip_rect(gc, NULL);
-	gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Run demo loop on a graphic context.
- *
- * @param gc Graphic context
- * @param w Width
- * @param h Height
- */
-static errno_t demo_loop(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
-{
-	errno_t rc;
-
-	(void) demo_font_init(gc, w, h);
-
-	while (!quit) {
-		rc = demo_rects(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_bitmap(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_bitmap2(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_bitmap_kc(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_text(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_text_abbr(gc, w, h);
-		if (rc != EOK)
-			goto error;
-
-		rc = demo_clip(gc, w, h);
-		if (rc != EOK)
-			goto error;
-	}
-
-	demo_font_fini();
-	return EOK;
-error:
-	demo_font_fini();
-	return rc;
-}
-
-/** Run demo on console. */
-static errno_t demo_console(void)
-{
-	console_gc_t *cgc = NULL;
-	gfx_context_t *gc;
-	sysarg_t cols, rows;
-	errno_t rc;
-
-	con = console_init(stdin, stdout);
-	if (con == NULL)
-		return EIO;
-
-	rc = console_get_size(con, &cols, &rows);
-	if (rc != EOK)
-		return rc;
-
-	rc = console_gc_create(con, stdout, &cgc);
-	if (rc != EOK)
-		return rc;
-
-	gc = console_gc_get_ctx(cgc);
-
-	/* Currently console is always text. */
-	textmode = true;
-
-	rc = demo_loop(gc, cols, rows);
-	if (rc != EOK)
-		return rc;
-
-	rc = console_gc_delete(cgc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t demo_ui_fibril(void *arg)
-{
-	demo_ui_args_t *args = (demo_ui_args_t *)arg;
-	errno_t rc;
-
-	ui_lock(args->ui);
-	rc = demo_loop(args->gc, args->dims.x, args->dims.y);
-	ui_unlock(args->ui);
-	ui_quit(args->ui);
-	return rc;
-}
-
-/** Run demo on UI. */
-static errno_t demo_ui(const char *display_spec)
-{
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	gfx_rect_t wrect;
-	gfx_coord2_t off;
-	gfx_rect_t ui_rect;
-	gfx_coord2_t dims;
-	demo_ui_args_t args;
-	fid_t fid;
-	errno_t rc;
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error initializing UI (%s)\n", display_spec);
-		goto error;
-	}
-
-	rc = ui_get_rect(ui, &ui_rect);
-	if (rc != EOK) {
-		printf("Error getting display size.\n");
-		goto error;
-	}
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 400;
-	rect.p1.y = 300;
-
-	ui_wnd_params_init(&params);
-	params.caption = "GFX Demo";
-
-	/* Do not decorate the window in fullscreen mode */
-	if (ui_is_fullscreen(ui))
-		params.style &= ~ui_wds_decorated;
-
-	/*
-	 * Compute window rectangle such that application area corresponds
-	 * to rect
-	 */
-	ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect);
-	off = wrect.p0;
-	gfx_rect_rtranslate(&off, &wrect, &params.rect);
-
-	gfx_rect_dims(&ui_rect, &dims);
-
-	/* Make sure window is not larger than the entire screen */
-	if (params.rect.p1.x > dims.x)
-		params.rect.p1.x = dims.x;
-	if (params.rect.p1.y > dims.y)
-		params.rect.p1.y = dims.y;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &ui_window_cb, NULL);
-
-	rc = ui_window_get_app_gc(window, &gc);
-	if (rc != EOK) {
-		printf("Error creating graphic context.\n");
-		goto error;
-	}
-
-	ui_window_get_app_rect(window, &rect);
-	gfx_rect_dims(&rect, &dims);
-
-	if (!ui_is_fullscreen(ui))
-		task_retval(0);
-
-	textmode = ui_is_textmode(ui);
-
-	args.gc = gc;
-	args.dims = dims;
-	args.ui = ui;
-
-	fid = fibril_create(demo_ui_fibril, (void *)&args);
-	if (fid == 0) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_add_ready(fid);
-
-	ui_run(ui);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return EOK;
-error:
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (ui != NULL)
-		ui_destroy(ui);
-	return rc;
-}
-
-/** Run demo on display server. */
-static errno_t demo_display(const char *display_svc)
-{
-	display_t *display = NULL;
-	gfx_context_t *gc;
-	display_wnd_params_t params;
-	display_window_t *window = NULL;
-	errno_t rc;
-
-	rc = display_open(display_svc, &display);
-	if (rc != EOK) {
-		printf("Error opening display.\n");
-		return rc;
-	}
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 400;
-	params.rect.p1.y = 300;
-	params.caption = "GFX Demo";
-
-	rc = display_window_create(display, &params, &wnd_cb, NULL, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	rc = display_window_get_gc(window, &gc);
-	if (rc != EOK) {
-		printf("Error getting graphics context.\n");
-		return rc;
-	}
-
-	task_retval(0);
-
-	/* FIXME Assuming display service is not text mode. */
-	textmode = false;
-
-	rc = demo_loop(gc, 400, 300);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_context_delete(gc);
-	if (rc != EOK)
-		return rc;
-
-	display_window_destroy(window);
-	display_close(display);
-
-	return EOK;
-}
-
-static void demo_quit(void)
-{
-	fibril_mutex_lock(&quit_lock);
-	quit = true;
-	fibril_mutex_unlock(&quit_lock);
-	fibril_condvar_broadcast(&quit_cv);
-}
-
-static void wnd_close_event(void *arg)
-{
-	demo_quit();
-}
-
-static void demo_kbd_event(kbd_event_t *event)
-{
-	if (event->type == KEY_PRESS) {
-		/* Ctrl-Q */
-		if ((event->mods & KM_CTRL) != 0 &&
-		    (event->mods & KM_ALT) == 0 &&
-		    (event->mods & KM_SHIFT) == 0 &&
-		    event->key == KC_Q) {
-			demo_quit();
-		}
-
-		/* Escape */
-		if ((event->mods & KM_CTRL) == 0 &&
-		    (event->mods & KM_ALT) == 0 &&
-		    (event->mods & KM_SHIFT) == 0 &&
-		    event->key == KC_ESCAPE) {
-			demo_quit();
-		}
-	}
-}
-
-static void wnd_kbd_event(void *arg, kbd_event_t *event)
-{
-	(void)arg;
-	demo_kbd_event(event);
-}
-
-static void uiwnd_close_event(ui_window_t *window, void *arg)
-{
-	demo_quit();
-}
-
-static void uiwnd_kbd_event(ui_window_t *window, void *arg, kbd_event_t *event)
-{
-	(void)window;
-	(void)arg;
-	demo_kbd_event(event);
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: gfxdemo [-d <display>] {console|display|ui}\n");
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	const char *display_svc = DISPLAY_DEFAULT;
-	const char *ui_display_spec = UI_ANY_DEFAULT;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_svc = ui_display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i >= argc || str_cmp(argv[i], "ui") == 0) {
-		rc = demo_ui(ui_display_spec);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[i], "console") == 0) {
-		rc = demo_console();
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[i], "display") == 0) {
-		rc = demo_display(display_svc);
-		if (rc != EOK)
-			return 1;
-	} else {
-		print_syntax();
-		return 1;
-	}
-}
-
-/** @}
- */
Index: pace/app/gfxdemo/gfxdemo.h
===================================================================
--- uspace/app/gfxdemo/gfxdemo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup gfxdemo
- * @{
- */
-/**
- * @file Graphic demo
- */
-
-#ifndef GFXDEMO_H
-#define GFXDEMO_H
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <ui/ui.h>
-
-typedef struct {
-	gfx_context_t *gc;
-	gfx_coord2_t dims;
-	ui_t *ui;
-} demo_ui_args_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/gfxdemo/meson.build
===================================================================
--- uspace/app/gfxdemo/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'gfxfont', 'ui', 'congfx', 'ipcgfx', 'display' ]
-src = files(
-	'gfxdemo.c',
-)
Index: pace/app/gunzip/doc/doxygroups.h
===================================================================
--- uspace/app/gunzip/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup gunzip gunzip
- * @brief Unzip a .gz file
- * @ingroup apps
- */
Index: pace/app/gunzip/gunzip.c
===================================================================
--- uspace/app/gunzip/gunzip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup gunzip
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <gzip.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	void *data, *ddata;
-	size_t size, dsize;
-	size_t nread, nwr;
-	long len;
-	FILE *f, *wf;
-
-	if (argc != 3) {
-		printf("syntax: gunzip <src.gz> <dest>\n");
-		return 1;
-	}
-
-	f = fopen(argv[1], "rb");
-	if (f == NULL) {
-		printf("Error opening '%s'\n", argv[1]);
-		return 1;
-	}
-
-	if (fseek(f, 0, SEEK_END) < 0) {
-		printf("Error determining size of '%s'\n", argv[1]);
-		fclose(f);
-		return 1;
-	}
-
-	len = ftell(f);
-	if (len < 0) {
-		printf("Error determining size of '%s'\n", argv[1]);
-		fclose(f);
-		return 1;
-	}
-
-	if (fseek(f, 0, SEEK_SET) < 0) {
-		printf ("Error rewinding '%s'\n", argv[1]);
-		fclose(f);
-		return 1;
-	}
-
-	data = malloc(len);
-	if (data == NULL) {
-		printf("Error allocating %ld bytes.\n", len);
-		fclose(f);
-		return 1;
-	}
-
-	nread = fread(data, 1, len, f);
-	if (nread != (size_t)len) {
-		printf("Error reading '%s'\n", argv[1]);
-		fclose(f);
-		return 1;
-	}
-
-	fclose(f);
-
-	size = (size_t) len;
-
-	rc = gzip_expand(data, size, &ddata, &dsize);
-	if (rc != EOK) {
-		printf("Error decompressing data.\n");
-		return 1;
-	}
-
-	wf = fopen(argv[2], "wb");
-	if (wf == NULL) {
-		printf("Error creating file '%s'\n", argv[2]);
-		return 1;
-	}
-
-	nwr = fwrite(ddata, 1, dsize, wf);
-	if (nwr != dsize) {
-		printf("Error writing '%s'\n", argv[2]);
-		fclose(wf);
-		return 1;
-	}
-
-	if (fclose(wf) != 0) {
-		printf("Error writing '%s'\n", argv[2]);
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/gunzip/meson.build
===================================================================
--- uspace/app/gunzip/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'compress' ]
-src = files('gunzip.c')
Index: pace/app/hbench/benchlist.c
===================================================================
--- uspace/app/hbench/benchlist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include "hbench.h"
-
-benchmark_t *benchmarks[] = {
-	&benchmark_dir_read,
-	&benchmark_fibril_mutex,
-	&benchmark_file_read,
-	&benchmark_rand_read,
-	&benchmark_seq_read,
-	&benchmark_malloc1,
-	&benchmark_malloc2,
-	&benchmark_ns_ping,
-	&benchmark_ping_pong,
-	&benchmark_read1k,
-	&benchmark_taskgetid,
-	&benchmark_write1k,
-};
-
-size_t benchmark_count = sizeof(benchmarks) / sizeof(benchmarks[0]);
-
-/** @}
- */
Index: pace/app/hbench/csv.c
===================================================================
--- uspace/app/hbench/csv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "hbench.h"
-
-static FILE *csv_output = NULL;
-
-/** Open CSV benchmark report.
- *
- * @param filename Filename where to store the CSV.
- * @return Whether it was possible to open the file.
- */
-errno_t csv_report_open(const char *filename)
-{
-	csv_output = fopen(filename, "w");
-	if (csv_output == NULL) {
-		return errno;
-	}
-
-	fprintf(csv_output, "benchmark,run,size,duration_nanos\n");
-
-	return EOK;
-}
-
-/** Add one entry to the report.
- *
- * When csv_report_open() was not called or failed, the function does
- * nothing.
- *
- * @param run Performance data of the entry.
- * @param run_index Run index, use negative values for warm-up.
- * @param bench Benchmark information.
- * @param workload_size Workload size.
- */
-void csv_report_add_entry(bench_run_t *run, int run_index,
-    benchmark_t *bench, uint64_t workload_size)
-{
-	if (csv_output == NULL) {
-		return;
-	}
-
-	fprintf(csv_output, "%s,%d,%" PRIu64 ",%lld\n",
-	    bench->name, run_index, workload_size,
-	    (long long) stopwatch_get_nanos(&run->stopwatch));
-}
-
-/** Close CSV report.
- *
- * When csv_report_open() was not called or failed, the function does
- * nothing.
- */
-void csv_report_close(void)
-{
-	if (csv_output != NULL) {
-		fclose(csv_output);
-	}
-}
-
-/** @}
- */
Index: pace/app/hbench/disk/randread.c
===================================================================
--- uspace/app/hbench/disk/randread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <block.h>
-#include <loc.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../hbench.h"
-
-/** Execute disk random read benchmark. */
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	const char *disk;
-	const char *nbstr;
-	service_id_t svcid;
-	size_t block_size;
-	aoff64_t dev_nblocks;
-	aoff64_t baddr;
-	bool block_inited = false;
-	char *buf = NULL;
-	uint64_t i;
-	errno_t rc;
-	int nitem;
-	unsigned nb;
-
-	disk = bench_env_param_get(env, "disk", NULL);
-	if (disk == NULL) {
-		bench_run_fail(run, "You must specify 'disk' parameter.");
-		goto error;
-	}
-
-	nbstr = bench_env_param_get(env, "nb", "1");
-	nitem = sscanf(nbstr, "%u", &nb);
-	if (nitem < 1) {
-		bench_run_fail(run, "'nb' must be an integer number of blocks.");
-		goto error;
-	}
-
-	rc = loc_service_get_id(disk, &svcid, 0);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed resolving device '%s'", disk);
-		goto error;
-	}
-
-	rc = block_init(svcid);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed opening block device '%s'",
-		    disk);
-	}
-
-	block_inited = true;
-
-	rc = block_get_bsize(svcid, &block_size);
-	if (rc != EOK) {
-		bench_run_fail(run, "error determining device block size.");
-		goto error;
-	}
-
-	rc = block_get_nblocks(svcid, &dev_nblocks);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed to obtain block device size.\n");
-		goto error;
-	}
-
-	if (dev_nblocks < nb) {
-		bench_run_fail(run, "device is smaller than %u blocks.\n",
-		    nb);
-		goto error;
-	}
-
-	buf = malloc(block_size * nb);
-	if (buf == NULL) {
-		bench_run_fail(run, "failed to allocate buffer (%zu bytes)",
-		    block_size * nb);
-		goto error;
-	}
-
-	bench_run_start(run);
-	for (i = 0; i < size; i++) {
-		/* Generate pseudo-random block address */
-		baddr = (rand() + rand() * RAND_MAX) % (dev_nblocks - nb + 1);
-
-		rc = block_read_direct(svcid, baddr, nb, buf);
-		if (rc != EOK) {
-			bench_run_fail(run, "failed to read blockd %llu-%llu: "
-			    "%s", (unsigned long long)baddr,
-			    (unsigned long long)(baddr + nb - 1),
-			    str_error(errno));
-			goto error;
-		}
-	}
-
-	bench_run_stop(run);
-	block_fini(svcid);
-	free(buf);
-
-	return true;
-error:
-	if (buf != NULL)
-		free(buf);
-	if (block_inited)
-		block_fini(svcid);
-	return false;
-}
-
-benchmark_t benchmark_rand_read = {
-	.name = "rand_read",
-	.desc = "Random disk read (must set 'disk' parameter).",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/hbench/disk/seqread.c
===================================================================
--- uspace/app/hbench/disk/seqread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <block.h>
-#include <loc.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../hbench.h"
-
-/** Execute disk sequential read benchmark. */
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	const char *disk;
-	const char *nbstr;
-	service_id_t svcid;
-	size_t block_size;
-	aoff64_t dev_nblocks;
-	aoff64_t baddr;
-	bool block_inited = false;
-	char *buf = NULL;
-	uint64_t i;
-	errno_t rc;
-	int nitem;
-	unsigned nb;
-
-	disk = bench_env_param_get(env, "disk", NULL);
-	if (disk == NULL) {
-		bench_run_fail(run, "Yo must specify 'disk' parameter.");
-		goto error;
-	}
-
-	nbstr = bench_env_param_get(env, "nb", "1");
-	nitem = sscanf(nbstr, "%u", &nb);
-	if (nitem < 1) {
-		bench_run_fail(run, "'nb' must be an integer number of blocks.");
-		goto error;
-	}
-
-	rc = loc_service_get_id(disk, &svcid, 0);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed resolving device '%s'", disk);
-		goto error;
-	}
-
-	rc = block_init(svcid);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed opening block device '%s'",
-		    disk);
-	}
-
-	block_inited = true;
-
-	rc = block_get_bsize(svcid, &block_size);
-	if (rc != EOK) {
-		bench_run_fail(run, "error determining device block size.");
-		goto error;
-	}
-
-	rc = block_get_nblocks(svcid, &dev_nblocks);
-	if (rc != EOK) {
-		bench_run_fail(run, "failed to obtain block device size.\n");
-		goto error;
-	}
-
-	if (dev_nblocks < nb) {
-		bench_run_fail(run, "device is smaller than %u blocks.\n",
-		    nb);
-		goto error;
-	}
-
-	buf = malloc(block_size);
-	if (buf == NULL) {
-		bench_run_fail(run, "failed to allocate buffer (%zu bytes)",
-		    block_size);
-		goto error;
-	}
-
-	bench_run_start(run);
-	for (i = 0; i < size; i++) {
-		baddr = i % (dev_nblocks - nb + 1);
-
-		rc = block_read_direct(svcid, baddr, 1, buf);
-		if (rc != EOK) {
-			bench_run_fail(run, "failed to read blocks %llu-%llu: "
-			    "%s", (unsigned long long)baddr,
-			    (unsigned long long)(baddr + nb - 1),
-			    str_error(errno));
-			goto error;
-		}
-	}
-
-	bench_run_stop(run);
-	block_fini(svcid);
-	free(buf);
-
-	return true;
-error:
-	if (buf != NULL)
-		free(buf);
-	if (block_inited)
-		block_fini(svcid);
-	return false;
-}
-
-benchmark_t benchmark_seq_read = {
-	.name = "seq_read",
-	.desc = "Sequential disk read (must set 'disk' parameter).",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/hbench/doc/doxygroups.h
===================================================================
--- uspace/app/hbench/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/** @addtogroup hbench hbench
- * @brief User space benchmarks
- * @ingroup apps
- *
- * @details
- *
- * To add a new benchmark, you need to implement the actual benchmarking
- * code and register it.
- *
- * Registration is done by adding
- * <code>extern benchmark_t bench_YOUR_NAME</code> reference to benchlist.h
- * and by adding it to the array in benchlist.c.
- *
- * The actual benchmark should reside in a separate file (see malloc/malloc1.c
- * for example) and has to (at least) declare one function (the actual
- * benchmark) and fill-in the benchmark_t structure.
- *
- * Fill-in the name of the benchmark, its description and a reference to the
- * benchmark function to the benchmark_t.
- *
- * The benchmarking function has to accept trhee arguments:
- *  @li bench_env_t: benchmark environment configuration
- *  @li bench_run_t: call bench_run_start and bench_run_stop around the
- *      actual benchmarking code
- *  @li uint64_t: size of the workload - typically number of inner loops in
- *      your benchmark (used to self-calibrate benchmark size)
- *
- * Typically, the structure of the function is following:
- * @code{c}
- * static bool runnerconst bench_env_t const *envbench_run_t *run, uint64_t size)
- * {
- * 	bench_run_start(run);
- * 	for (uint64_t i = 0; i < size; i++) {
- * 		// measured action
- * 		if (something_fails) {
- * 		    return bench_run_fail(run, "oops: %s (%d)", str_error(rc), rc);
- * 		}
- * 	}
- * 	bench_run_stop(run);
- *
- * 	return true;
- * }
- * @endcode
- */
Index: pace/app/hbench/env.c
===================================================================
--- uspace/app/hbench/env.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,150 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <adt/hash.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <str.h>
-#include "hbench.h"
-
-typedef struct {
-	ht_link_t link;
-
-	size_t hash;
-	char *key;
-	char *value;
-} param_t;
-
-static size_t param_hash(const ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	return param->hash;
-}
-
-static size_t param_key_hash(const void *key)
-{
-	return hash_string(key);
-}
-
-static bool param_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-
-	if (param->hash != hash)
-		return false;
-
-	const char *key_str = key;
-	return str_cmp(param->key, key_str) == 0;
-}
-
-static bool param_equal(const ht_link_t *link_a, const ht_link_t *link_b)
-{
-	param_t *a = hash_table_get_inst(link_a, param_t, link);
-	param_t *b = hash_table_get_inst(link_b, param_t, link);
-
-	return a->hash == b->hash && str_cmp(a->key, b->key) == 0;
-}
-
-static void param_remove(ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	free(param->key);
-	free(param->value);
-}
-
-static const hash_table_ops_t param_hash_table_ops = {
-	.hash = param_hash,
-	.key_hash = param_key_hash,
-	.key_equal = param_key_equal,
-	.equal = param_equal,
-	.remove_callback = param_remove
-};
-
-errno_t bench_env_init(bench_env_t *env)
-{
-	bool ok = hash_table_create(&env->parameters, 0, 0, &param_hash_table_ops);
-	if (!ok) {
-		return ENOMEM;
-	}
-
-	env->run_count = DEFAULT_RUN_COUNT;
-	env->minimal_run_duration_nanos = MSEC2NSEC(DEFAULT_MIN_RUN_DURATION_MSEC);
-
-	return EOK;
-}
-
-void bench_env_cleanup(bench_env_t *env)
-{
-	hash_table_destroy(&env->parameters);
-}
-
-errno_t bench_env_param_set(bench_env_t *env, const char *key, const char *value)
-{
-	param_t *param = malloc(sizeof(param_t));
-	if (param == NULL) {
-		return ENOMEM;
-	}
-
-	param->key = str_dup(key);
-	param->value = str_dup(value);
-	param->hash = hash_string(key);
-
-	if ((param->key == NULL) || (param->value == NULL)) {
-		free(param->key);
-		free(param->value);
-		free(param);
-
-		return ENOMEM;
-	}
-
-	hash_table_insert(&env->parameters, &param->link);
-
-	return EOK;
-}
-
-const char *bench_env_param_get(bench_env_t *env, const char *key, const char *default_value)
-{
-	ht_link_t *item = hash_table_find(&env->parameters, key);
-
-	if (item == NULL) {
-		return default_value;
-	}
-
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	return param->value;
-}
-
-/** @}
- */
Index: pace/app/hbench/fs/dirread.c
===================================================================
--- uspace/app/hbench/fs/dirread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <dirent.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../hbench.h"
-
-/** Execute directory listing benchmark.
- *
- * Note that while this benchmark tries to measure speed of direct
- * read, it rather measures speed of FS cache as it is highly probable
- * that the corresponding blocks would be cached after first run.
- */
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	const char *path = bench_env_param_get(env, "dirname", "/");
-
-	bench_run_start(run);
-	for (uint64_t i = 0; i < size; i++) {
-		DIR *dir = opendir(path);
-		if (dir == NULL) {
-			return bench_run_fail(run, "failed to open %s for reading: %s",
-			    path, str_error(errno));
-		}
-
-		struct dirent *dp;
-		while ((dp = readdir(dir))) {
-			/* Do nothing */
-		}
-
-		closedir(dir);
-	}
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_dir_read = {
-	.name = "dir_read",
-	.desc = "Read contents of a directory (use 'dirname' param to alter the default).",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/hbench/fs/fileread.c
===================================================================
--- uspace/app/hbench/fs/fileread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../hbench.h"
-
-#define BUFFER_SIZE 4096
-
-/** Execute file reading benchmark.
- *
- * Note that while this benchmark tries to measure speed of file reading,
- * it rather measures speed of FS cache as it is highly probable that the
- * corresponding blocks would be cached after first run.
- */
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	const char *path = bench_env_param_get(env, "filename", "/data/web/helenos.png");
-
-	char *buf = malloc(BUFFER_SIZE);
-	if (buf == NULL) {
-		return bench_run_fail(run, "failed to allocate %dB buffer", BUFFER_SIZE);
-	}
-
-	bool ret = true;
-
-	FILE *file = fopen(path, "r");
-	if (file == NULL) {
-		bench_run_fail(run, "failed to open %s for reading: %s",
-		    path, str_error(errno));
-		ret = false;
-		goto leave_free_buf;
-	}
-
-	bench_run_start(run);
-	for (uint64_t i = 0; i < size; i++) {
-		int rc = fseek(file, 0, SEEK_SET);
-		if (rc != 0) {
-			bench_run_fail(run, "failed to rewind %s: %s",
-			    path, str_error(errno));
-			ret = false;
-			goto leave_close;
-		}
-		while (!feof(file)) {
-			fread(buf, 1, BUFFER_SIZE, file);
-			if (ferror(file)) {
-				bench_run_fail(run, "failed to read from %s: %s",
-				    path, str_error(errno));
-				ret = false;
-				goto leave_close;
-			}
-		}
-	}
-	bench_run_stop(run);
-
-leave_close:
-	fclose(file);
-
-leave_free_buf:
-	free(buf);
-
-	return ret;
-}
-
-benchmark_t benchmark_file_read = {
-	.name = "file_read",
-	.desc = "Sequentially read contents of a file (use 'filename' param to alter the default).",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/hbench/hbench.h
===================================================================
--- uspace/app/hbench/hbench.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,150 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/** @file
- */
-
-#ifndef HBENCH_H_
-#define HBENCH_H_
-
-#include <adt/hash_table.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <perf.h>
-
-#define DEFAULT_RUN_COUNT 10
-#define DEFAULT_MIN_RUN_DURATION_MSEC 1000
-
-/** Single run information.
- *
- * Used to store both performance information (now, only wall-clock
- * time) as well as information about error.
- *
- * Use proper access functions when modifying data inside this structure.
- *
- * Eventually, we could collection of hardware counters etc. without
- * modifying signatures of any existing benchmark.
- */
-typedef struct {
-	stopwatch_t stopwatch;
-	char *error_message;
-	size_t error_message_buffer_size;
-} bench_run_t;
-
-/** Benchmark environment configuration.
- *
- * Benchmarking code (runners) should use access functions to read
- * data from this structure (now only bench_env_param_get).
- *
- * Harness can access it directly.
- */
-typedef struct {
-	hash_table_t parameters;
-	size_t run_count;
-	nsec_t minimal_run_duration_nanos;
-} bench_env_t;
-
-/** Actual benchmark runner.
- *
- * The first argument describes the environment, second is used to store
- * information about the run (performance data or error message) and
- * third describes workload size (number of iterations).
- */
-typedef bool (*benchmark_entry_t)(bench_env_t *, bench_run_t *, uint64_t);
-
-/** Setup and teardown callback type.
- *
- * Unlike in benchmark_entry_t, we do not need to pass in number of
- * iterations to execute (note that we use bench_run_t only to simplify
- * creation of error messages).
- */
-typedef bool (*benchmark_helper_t)(bench_env_t *, bench_run_t *);
-
-typedef struct {
-	const char *name;
-	const char *desc;
-	benchmark_entry_t entry;
-	benchmark_helper_t setup;
-	benchmark_helper_t teardown;
-} benchmark_t;
-
-extern void bench_run_init(bench_run_t *, char *, size_t);
-extern bool bench_run_fail(bench_run_t *, const char *, ...);
-
-/*
- * We keep the following two functions inline to ensure that we start
- * measurement as close to the surrounding code as possible. Note that
- * this inlining is done at least on the level of individual wrappers
- * (this one and the one provided by stopwatch_t) to pass the control
- * as fast as possible to the actual timer used.
- */
-
-static inline void bench_run_start(bench_run_t *run)
-{
-	stopwatch_start(&run->stopwatch);
-}
-
-static inline void bench_run_stop(bench_run_t *run)
-{
-	stopwatch_stop(&run->stopwatch);
-}
-
-extern errno_t csv_report_open(const char *);
-extern void csv_report_add_entry(bench_run_t *, int, benchmark_t *, uint64_t);
-extern void csv_report_close(void);
-
-extern errno_t bench_env_init(bench_env_t *);
-extern errno_t bench_env_param_set(bench_env_t *, const char *, const char *);
-extern const char *bench_env_param_get(bench_env_t *, const char *, const char *);
-extern void bench_env_cleanup(bench_env_t *);
-
-extern benchmark_t *benchmarks[];
-extern size_t benchmark_count;
-
-/* Put your benchmark descriptors here (and also to benchlist.c). */
-extern benchmark_t benchmark_dir_read;
-extern benchmark_t benchmark_fibril_mutex;
-extern benchmark_t benchmark_file_read;
-extern benchmark_t benchmark_rand_read;
-extern benchmark_t benchmark_seq_read;
-extern benchmark_t benchmark_malloc1;
-extern benchmark_t benchmark_malloc2;
-extern benchmark_t benchmark_ns_ping;
-extern benchmark_t benchmark_ping_pong;
-extern benchmark_t benchmark_read1k;
-extern benchmark_t benchmark_taskgetid;
-extern benchmark_t benchmark_write1k;
-
-#endif
-
-/** @}
- */
Index: pace/app/hbench/ipc/ns_ping.c
===================================================================
--- uspace/app/hbench/ipc/ns_ping.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdio.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include "../hbench.h"
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	bench_run_start(run);
-
-	for (uint64_t count = 0; count < niter; count++) {
-		errno_t rc = ns_ping();
-
-		if (rc != EOK) {
-			return bench_run_fail(run, "failed sending ping message: %s (%d)",
-			    str_error(rc), rc);
-		}
-	}
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_ns_ping = {
-	.name = "ns_ping",
-	.desc = "Name service IPC ping-pong benchmark",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/** @}
- */
Index: pace/app/hbench/ipc/ping_pong.c
===================================================================
--- uspace/app/hbench/ipc/ping_pong.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdio.h>
-#include <ipc_test.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include "../hbench.h"
-
-static ipc_test_t *test = NULL;
-
-static bool setup(bench_env_t *env, bench_run_t *run)
-{
-	errno_t rc = ipc_test_create(&test);
-	if (rc != EOK) {
-		return bench_run_fail(run,
-		    "failed contacting IPC test server (have you run /srv/test/ipc-test?): %s (%d)",
-		    str_error(rc), rc);
-	}
-
-	return true;
-}
-
-static bool teardown(bench_env_t *env, bench_run_t *run)
-{
-	ipc_test_destroy(test);
-	return true;
-}
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	bench_run_start(run);
-
-	for (uint64_t count = 0; count < niter; count++) {
-		errno_t rc = ipc_test_ping(test);
-
-		if (rc != EOK) {
-			return bench_run_fail(run, "failed sending ping message: %s (%d)",
-			    str_error(rc), rc);
-		}
-	}
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_ping_pong = {
-	.name = "ping_pong",
-	.desc = "IPC ping-pong benchmark",
-	.entry = &runner,
-	.setup = &setup,
-	.teardown = &teardown
-};
-
-/** @}
- */
Index: pace/app/hbench/ipc/read1k.c
===================================================================
--- uspace/app/hbench/ipc/read1k.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdio.h>
-#include <ipc_test.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include "../hbench.h"
-
-enum {
-	rw_buf_size = 1024
-};
-
-static ipc_test_t *test = NULL;
-static uint8_t rw_buf[rw_buf_size];
-
-static bool setup(bench_env_t *env, bench_run_t *run)
-{
-	errno_t rc;
-
-	rc = ipc_test_create(&test);
-	if (rc != EOK) {
-		return bench_run_fail(run,
-		    "failed contacting IPC test server (have you run /srv/test/ipc-test?): %s (%d)",
-		    str_error(rc), rc);
-	}
-
-	rc = ipc_test_set_rw_buf_size(test, rw_buf_size);
-	if (rc != EOK) {
-		return bench_run_fail(run,
-		    "failed setting read/write buffer size.");
-	}
-
-	return true;
-}
-
-static bool teardown(bench_env_t *env, bench_run_t *run)
-{
-	ipc_test_destroy(test);
-	return true;
-}
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	errno_t rc;
-
-	bench_run_start(run);
-
-	for (uint64_t count = 0; count < niter; count++) {
-		rc = ipc_test_read(test, rw_buf, rw_buf_size);
-
-		if (rc != EOK) {
-			return bench_run_fail(run, "failed reading buffer: %s (%d)",
-			    str_error(rc), rc);
-		}
-	}
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_read1k = {
-	.name = "read1k",
-	.desc = "IPC read 1kB buffer benchmark",
-	.entry = &runner,
-	.setup = &setup,
-	.teardown = &teardown
-};
-
-/** @}
- */
Index: pace/app/hbench/ipc/write1k.c
===================================================================
--- uspace/app/hbench/ipc/write1k.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdio.h>
-#include <ipc_test.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include "../hbench.h"
-
-enum {
-	rw_buf_size = 1024
-};
-
-static ipc_test_t *test = NULL;
-static uint8_t rw_buf[rw_buf_size];
-
-static bool setup(bench_env_t *env, bench_run_t *run)
-{
-	errno_t rc;
-
-	rc = ipc_test_create(&test);
-	if (rc != EOK) {
-		return bench_run_fail(run,
-		    "failed contacting IPC test server (have you run /srv/test/ipc-test?): %s (%d)",
-		    str_error(rc), rc);
-	}
-
-	rc = ipc_test_set_rw_buf_size(test, rw_buf_size);
-	if (rc != EOK) {
-		return bench_run_fail(run,
-		    "failed setting read/write buffer size.");
-	}
-
-	return true;
-}
-
-static bool teardown(bench_env_t *env, bench_run_t *run)
-{
-	ipc_test_destroy(test);
-	return true;
-}
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	errno_t rc;
-
-	bench_run_start(run);
-
-	for (uint64_t count = 0; count < niter; count++) {
-		rc = ipc_test_write(test, rw_buf, rw_buf_size);
-
-		if (rc != EOK) {
-			return bench_run_fail(run, "failed writing buffer: %s (%d)",
-			    str_error(rc), rc);
-		}
-	}
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_write1k = {
-	.name = "write1k",
-	.desc = "IPC write 1kB buffer benchmark",
-	.entry = &runner,
-	.setup = &setup,
-	.teardown = &teardown
-};
-
-/** @}
- */
Index: pace/app/hbench/main.c
===================================================================
--- uspace/app/hbench/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,429 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <getopt.h>
-#include <math.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <str.h>
-#include <time.h>
-#include <errno.h>
-#include <str_error.h>
-#include <perf.h>
-#include <types/casting.h>
-#include "hbench.h"
-
-#define MAX_ERROR_STR_LENGTH 1024
-
-static void short_report(bench_run_t *info, int run_index,
-    benchmark_t *bench, uint64_t workload_size)
-{
-	csv_report_add_entry(info, run_index, bench, workload_size);
-
-	usec_t duration_usec = NSEC2USEC(stopwatch_get_nanos(&info->stopwatch));
-
-	printf("Completed %" PRIu64 " operations in %llu us",
-	    workload_size, duration_usec);
-	if (duration_usec > 0) {
-		double nanos = stopwatch_get_nanos(&info->stopwatch);
-		double thruput = (double) workload_size / (nanos / 1000000000.0l);
-		printf(", %.0f ops/s.\n", thruput);
-	} else {
-		printf(".\n");
-	}
-}
-
-/** Estimate square root value.
- *
- * @param value The value to compute square root of.
- * @param precision Required precision (e.g. 0.00001).
- *
- * @details
- *
- * This is a temporary solution until we have proper sqrt() implementation
- * in libmath.
- *
- * The algorithm uses Babylonian method [1].
- *
- * [1] https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
- */
-static double estimate_square_root(double value, double precision)
-{
-	double estimate = 1.;
-	double prev_estimate = estimate + 10 * precision;
-
-	while (fabs(estimate - prev_estimate) > precision) {
-		prev_estimate = estimate;
-		estimate = (prev_estimate + value / prev_estimate) / 2.;
-	}
-
-	return estimate;
-}
-
-/** Compute available statistics from given stopwatches.
- *
- * We compute normal mean for average duration of the workload and geometric
- * mean for average thruput. Note that geometric mean is necessary to compute
- * average throughput correctly - consider the following example:
- *  - we run always 60 operations,
- *  - first run executes in 30 s (i.e. 2 ops/s)
- *  - and second one in 10 s (6 ops/s).
- * Then, naively, average throughput would be (2+6)/2 = 4 [ops/s]. However, we
- * actually executed 60 + 60 ops in 30 + 10 seconds. So the actual average
- * throughput is 3 ops/s (which is exactly what geometric mean means).
- *
- */
-static void compute_stats(bench_run_t *runs, size_t run_count,
-    uint64_t workload_size, double precision, double *out_duration_avg,
-    double *out_duration_sigma, double *out_thruput_avg)
-{
-	double inv_thruput_sum = 0.0;
-	double nanos_sum = 0.0;
-	double nanos_sum2 = 0.0;
-
-	for (size_t i = 0; i < run_count; i++) {
-		double nanos = stopwatch_get_nanos(&runs[i].stopwatch);
-		double thruput = (double) workload_size / nanos;
-
-		inv_thruput_sum += 1.0 / thruput;
-		nanos_sum += nanos;
-		nanos_sum2 += nanos * nanos;
-	}
-	*out_duration_avg = nanos_sum / run_count;
-	double sigma2 = (nanos_sum2 - nanos_sum * (*out_duration_avg)) /
-	    ((double) run_count - 1);
-	// FIXME: implement sqrt properly
-	if (run_count > 1) {
-		*out_duration_sigma = estimate_square_root(sigma2, precision);
-	} else {
-		*out_duration_sigma = NAN;
-	}
-	*out_thruput_avg = 1.0 / (inv_thruput_sum / run_count);
-}
-
-static void summary_stats(bench_run_t *runs, size_t run_count,
-    benchmark_t *bench, uint64_t workload_size)
-{
-	double duration_avg, duration_sigma, thruput_avg;
-	compute_stats(runs, run_count, workload_size, 0.001,
-	    &duration_avg, &duration_sigma, &thruput_avg);
-
-	printf("Average: %" PRIu64 " ops in %.0f us (sd %.0f us); "
-	    "%.0f ops/s; Samples: %zu\n",
-	    workload_size, duration_avg / 1000.0, duration_sigma / 1000.0,
-	    thruput_avg * 1000000000.0, run_count);
-}
-
-static bool run_benchmark(bench_env_t *env, benchmark_t *bench)
-{
-	printf("Warm up and determine workload size...\n");
-
-	/*
-	 * We share this buffer across all runs as we know that it is
-	 * used only on failure (and we abort after first error).
-	 */
-	char *error_msg = malloc(MAX_ERROR_STR_LENGTH + 1);
-	if (error_msg == NULL) {
-		printf("Out of memory!\n");
-		return false;
-	}
-	str_cpy(error_msg, MAX_ERROR_STR_LENGTH, "");
-
-	bench_run_t helper_run;
-	bench_run_init(&helper_run, error_msg, MAX_ERROR_STR_LENGTH);
-
-	bool ret = true;
-
-	if (bench->setup != NULL) {
-		ret = bench->setup(env, &helper_run);
-		if (!ret) {
-			goto leave_error;
-		}
-	}
-
-	/*
-	 * Find workload size that is big enough to last few seconds.
-	 * We also check that uint64_t is big enough.
-	 */
-	uint64_t workload_size = 0;
-	for (size_t bits = 0; bits <= 64; bits++) {
-		if (bits == 64) {
-			str_cpy(error_msg, MAX_ERROR_STR_LENGTH, "Workload too small even for 1 << 63");
-			goto leave_error;
-		}
-		workload_size = ((uint64_t) 1) << bits;
-
-		bench_run_t run;
-		bench_run_init(&run, error_msg, MAX_ERROR_STR_LENGTH);
-
-		bool ok = bench->entry(env, &run, workload_size);
-		if (!ok) {
-			goto leave_error;
-		}
-		short_report(&run, -1, bench, workload_size);
-
-		nsec_t duration = stopwatch_get_nanos(&run.stopwatch);
-		if (duration > env->minimal_run_duration_nanos) {
-			break;
-		}
-	}
-
-	printf("Workload size set to %" PRIu64 ", measuring %zu samples.\n",
-	    workload_size, env->run_count);
-
-	bench_run_t *runs = calloc(env->run_count, sizeof(bench_run_t));
-	if (runs == NULL) {
-		snprintf(error_msg, MAX_ERROR_STR_LENGTH, "failed allocating memory");
-		goto leave_error;
-	}
-	for (size_t i = 0; i < env->run_count; i++) {
-		bench_run_init(&runs[i], error_msg, MAX_ERROR_STR_LENGTH);
-
-		bool ok = bench->entry(env, &runs[i], workload_size);
-		if (!ok) {
-			free(runs);
-			goto leave_error;
-		}
-		short_report(&runs[i], i, bench, workload_size);
-	}
-
-	summary_stats(runs, env->run_count, bench, workload_size);
-	printf("\nBenchmark completed\n");
-
-	free(runs);
-
-	goto leave;
-
-leave_error:
-	printf("Error: %s\n", error_msg);
-	ret = false;
-
-leave:
-	if (bench->teardown != NULL) {
-		bool ok = bench->teardown(env, &helper_run);
-		if (!ok) {
-			printf("Error: %s\n", error_msg);
-			ret = false;
-		}
-	}
-
-	free(error_msg);
-
-	return ret;
-}
-
-static int run_benchmarks(bench_env_t *env)
-{
-	unsigned int count_ok = 0;
-	unsigned int count_fail = 0;
-
-	char *failed_names = NULL;
-
-	printf("\n*** Running all benchmarks ***\n\n");
-
-	for (size_t it = 0; it < benchmark_count; it++) {
-		printf("%s (%s)\n", benchmarks[it]->name, benchmarks[it]->desc);
-		if (run_benchmark(env, benchmarks[it])) {
-			count_ok++;
-			continue;
-		}
-
-		if (!failed_names) {
-			failed_names = str_dup(benchmarks[it]->name);
-		} else {
-			char *f = NULL;
-			asprintf(&f, "%s, %s", failed_names, benchmarks[it]->name);
-			if (!f) {
-				printf("Out of memory.\n");
-				abort();
-			}
-			free(failed_names);
-			failed_names = f;
-		}
-		count_fail++;
-	}
-
-	printf("\nCompleted, %u benchmarks run, %u succeeded.\n",
-	    count_ok + count_fail, count_ok);
-	if (failed_names)
-		printf("Failed benchmarks: %s\n", failed_names);
-
-	return count_fail;
-}
-
-static void list_benchmarks(void)
-{
-	size_t len = 0;
-	for (size_t i = 0; i < benchmark_count; i++) {
-		size_t len_now = str_length(benchmarks[i]->name);
-		if (len_now > len)
-			len = len_now;
-	}
-
-	assert(can_cast_size_t_to_int(len) && "benchmark name length overflow");
-
-	for (size_t i = 0; i < benchmark_count; i++)
-		printf("  %-*s %s\n", (int) len, benchmarks[i]->name, benchmarks[i]->desc);
-
-	printf("  %-*s Run all benchmarks\n", (int) len, "*");
-}
-
-static void print_usage(const char *progname)
-{
-	printf("Usage: %s [options] <benchmark>\n", progname);
-	printf("-h, --help                 "
-	    "Print this help and exit\n");
-	printf("-d, --duration MILLIS      "
-	    "Set minimal run duration (milliseconds)\n");
-	printf("-n, --count N              "
-	    "Set number of measured runs\n");
-	printf("-o, --output filename.csv  "
-	    "Store machine-readable data in filename.csv\n");
-	printf("-p, --param KEY=VALUE      "
-	    "Additional parameters for the benchmark\n");
-	printf("<benchmark> is one of the following:\n");
-	list_benchmarks();
-}
-
-static void handle_param_arg(bench_env_t *env, char *arg)
-{
-	char *value = NULL;
-	char *key = str_tok(arg, "=", &value);
-	bench_env_param_set(env, key, value);
-}
-
-int main(int argc, char *argv[])
-{
-	bench_env_t bench_env;
-	errno_t rc = bench_env_init(&bench_env);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed to initialize internal params structure: %s\n",
-		    str_error(rc));
-		return -5;
-	}
-
-	const char *short_options = "ho:p:n:d:";
-	struct option long_options[] = {
-		{ "duration", required_argument, NULL, 'd' },
-		{ "help", optional_argument, NULL, 'h' },
-		{ "count", required_argument, NULL, 'n' },
-		{ "output", required_argument, NULL, 'o' },
-		{ "param", required_argument, NULL, 'p' },
-		{ 0, 0, NULL, 0 }
-	};
-
-	char *csv_output_filename = NULL;
-
-	int opt = 0;
-	while ((opt = getopt_long(argc, argv, short_options, long_options, NULL)) > 0) {
-		switch (opt) {
-		case 'd':
-			errno = EOK;
-			bench_env.minimal_run_duration_nanos = MSEC2NSEC(atoll(optarg));
-			if ((errno != EOK) || (bench_env.minimal_run_duration_nanos <= 0)) {
-				fprintf(stderr, "Invalid -d argument.\n");
-				return -3;
-			}
-			break;
-		case 'h':
-			print_usage(*argv);
-			return 0;
-		case 'n':
-			errno = EOK;
-			bench_env.run_count = (nsec_t) atoll(optarg);
-			if ((errno != EOK) || (bench_env.run_count <= 0)) {
-				fprintf(stderr, "Invalid -n argument.\n");
-				return -3;
-			}
-			break;
-		case 'o':
-			csv_output_filename = optarg;
-			break;
-		case 'p':
-			handle_param_arg(&bench_env, optarg);
-			break;
-		case -1:
-		default:
-			break;
-		}
-	}
-
-	if (optind + 1 != argc) {
-		print_usage(*argv);
-		fprintf(stderr, "Error: specify one benchmark to run or * for all.\n");
-		return -3;
-	}
-
-	const char *benchmark = argv[optind];
-
-	if (csv_output_filename != NULL) {
-		errno_t rc = csv_report_open(csv_output_filename);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed to open CSV report '%s': %s\n",
-			    csv_output_filename, str_error(rc));
-			return -4;
-		}
-	}
-
-	int exit_code = 0;
-
-	if (str_cmp(benchmark, "*") == 0) {
-		exit_code = run_benchmarks(&bench_env);
-	} else {
-		bool benchmark_exists = false;
-		for (size_t i = 0; i < benchmark_count; i++) {
-			if (str_cmp(benchmark, benchmarks[i]->name) == 0) {
-				benchmark_exists = true;
-				exit_code = run_benchmark(&bench_env, benchmarks[i]) ? 0 : -1;
-				break;
-			}
-		}
-		if (!benchmark_exists) {
-			printf("Unknown benchmark \"%s\"\n", benchmark);
-			exit_code = -2;
-		}
-	}
-
-	csv_report_close();
-	bench_env_cleanup(&bench_env);
-
-	return exit_code;
-}
-
-/** @}
- */
Index: pace/app/hbench/malloc/malloc1.c
===================================================================
--- uspace/app/hbench/malloc/malloc1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../hbench.h"
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	bench_run_start(run);
-	for (uint64_t i = 0; i < size; i++) {
-		void *p = malloc(1);
-		if (p == NULL) {
-			return bench_run_fail(run,
-			    "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")",
-			    i, size);
-		}
-		free(p);
-	}
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_malloc1 = {
-	.name = "malloc1",
-	.desc = "User-space memory allocator benchmark, repeatedly allocate one block",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/** @}
- */
Index: pace/app/hbench/malloc/malloc2.c
===================================================================
--- uspace/app/hbench/malloc/malloc2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "../hbench.h"
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	bench_run_start(run);
-
-	void **p = malloc(niter * sizeof(void *));
-	if (p == NULL) {
-		return bench_run_fail(run, "failed to allocate backend array (%" PRIu64 "B)",
-		    niter * sizeof(void *));
-	}
-
-	for (uint64_t count = 0; count < niter; count++) {
-		p[count] = malloc(1);
-		if (p[count] == NULL) {
-			for (uint64_t j = 0; j < count; j++) {
-				free(p[j]);
-			}
-			free(p);
-			return bench_run_fail(run,
-			    "failed to allocate 1B in run %" PRIu64 " (out of %" PRIu64 ")",
-			    count, niter);
-		}
-	}
-
-	for (uint64_t count = 0; count < niter; count++)
-		free(p[count]);
-
-	free(p);
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_malloc2 = {
-	.name = "malloc2",
-	.desc = "User-space memory allocator benchmark, allocate many small blocks",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/** @}
- */
Index: pace/app/hbench/meson.build
===================================================================
--- uspace/app/hbench/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'math', 'ipctest' ]
-src = files(
-	'benchlist.c',
-	'csv.c',
-	'env.c',
-	'main.c',
-	'utils.c',
-	'disk/randread.c',
-	'disk/seqread.c',
-	'fs/dirread.c',
-	'fs/fileread.c',
-	'ipc/ns_ping.c',
-	'ipc/ping_pong.c',
-	'ipc/read1k.c',
-	'ipc/write1k.c',
-	'malloc/malloc1.c',
-	'malloc/malloc2.c',
-	'synch/fibril_mutex.c',
-	'syscall/taskgetid.c'
-)
Index: pace/app/hbench/synch/fibril_mutex.c
===================================================================
--- uspace/app/hbench/synch/fibril_mutex.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <fibril_synch.h>
-#include <stdatomic.h>
-#include "../hbench.h"
-
-/*
- * Simple benchmark for fibril mutexes. There are two fibrils that compete
- * over the same mutex as that is the simplest scenario.
- */
-
-typedef struct {
-	fibril_mutex_t mutex;
-	uint64_t counter;
-	atomic_bool done;
-} shared_t;
-
-static errno_t competitor(void *arg)
-{
-	shared_t *shared = arg;
-	fibril_detach(fibril_get_id());
-
-	while (true) {
-		fibril_mutex_lock(&shared->mutex);
-		uint64_t local = shared->counter;
-		fibril_mutex_unlock(&shared->mutex);
-		if (local == 0) {
-			break;
-		}
-	}
-
-	atomic_store(&shared->done, true);
-
-	return EOK;
-}
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
-{
-	shared_t shared;
-	fibril_mutex_initialize(&shared.mutex);
-	shared.counter = size;
-	atomic_store(&shared.done, false);
-
-	fid_t other = fibril_create(competitor, &shared);
-	fibril_add_ready(other);
-
-	bench_run_start(run);
-	for (uint64_t i = 0; i < size; i++) {
-		fibril_mutex_lock(&shared.mutex);
-		shared.counter--;
-		fibril_mutex_unlock(&shared.mutex);
-	}
-	bench_run_stop(run);
-
-	while (!atomic_load(&shared.done)) {
-		fibril_yield();
-	}
-
-	return true;
-}
-
-benchmark_t benchmark_fibril_mutex = {
-	.name = "fibril_mutex",
-	.desc = "Speed of mutex lock/unlock operations",
-	.entry = &runner,
-	.setup = NULL,
-	.teardown = NULL
-};
-
-/** @}
- */
Index: pace/app/hbench/syscall/taskgetid.c
===================================================================
--- uspace/app/hbench/syscall/taskgetid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include "../hbench.h"
-
-static volatile task_id_t tid;
-
-static bool setup(bench_env_t *env, bench_run_t *run)
-{
-	return true;
-}
-
-static bool teardown(bench_env_t *env, bench_run_t *run)
-{
-	return true;
-}
-
-static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
-{
-	bench_run_start(run);
-
-	for (uint64_t count = 0; count < niter; count++) {
-		tid = task_get_id();
-		(void)tid;
-	}
-
-	bench_run_stop(run);
-
-	return true;
-}
-
-benchmark_t benchmark_taskgetid = {
-	.name = "taskgetid",
-	.desc = "task_get_id system call benchmark",
-	.entry = &runner,
-	.setup = &setup,
-	.teardown = &teardown
-};
-
-/** @}
- */
Index: pace/app/hbench/utils.c
===================================================================
--- uspace/app/hbench/utils.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include "hbench.h"
-
-/** Initialize bench run structure.
- *
- * @param run Structure to intialize.
- * @param error_buffer Pre-allocated memory to use for error messages.
- * @param error_buffer_size Size of error_buffer.
- */
-void bench_run_init(bench_run_t *run, char *error_buffer, size_t error_buffer_size)
-{
-	stopwatch_init(&run->stopwatch);
-	run->error_message = error_buffer;
-	run->error_message_buffer_size = error_buffer_size;
-}
-
-/** Format error message on benchmark failure.
- *
- * This function always returns false so it can be easily used in benchmark
- * runners as
- *
- * @code
- * if (error) {
- *     return bench_run_fail(run, "we failed");
- * }
- * @endcode
- *
- * @param run Current benchmark run.
- * @param fmt printf-style message followed by extra arguments.
- * @retval false Always.
- */
-bool bench_run_fail(bench_run_t *run, const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-	vsnprintf(run->error_message, run->error_message_buffer_size, fmt, args);
-	va_end(args);
-
-	return false;
-}
-
-/** @}
- */
Index: pace/app/hello/doc/doxygroups.h
===================================================================
--- uspace/app/hello/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup hello hello
- * @brief Hello world (in UI)
- * @ingroup apps
- */
Index: pace/app/hello/hello.c
===================================================================
--- uspace/app/hello/hello.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hello
- * @{
- */
-/** @file Hello world (in UI)
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <str.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "hello.h"
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (hello)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	hello_t *hello = (hello_t *) arg;
-
-	ui_quit(hello->ui);
-}
-
-/** Run hello world on display server. */
-static errno_t hello(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	hello_t hello;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-	errno_t rc;
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return rc;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello World";
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 24;
-		params.rect.p1.y = 5;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 200;
-		params.rect.p1.y = 60;
-	}
-
-	memset((void *) &hello, 0, sizeof(hello));
-	hello.ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &hello);
-	hello.window = window;
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&hello.fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_label_create(ui_res, "Hello, world!", &hello.label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	ui_window_get_app_rect(window, &rect);
-	ui_label_set_rect(hello.label, &rect);
-	ui_label_set_halign(hello.label, gfx_halign_center);
-	ui_label_set_valign(hello.label, gfx_valign_center);
-
-	rc = ui_fixed_add(hello.fixed, ui_label_ctl(hello.label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(hello.fixed));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: hello [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = hello(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/hello/hello.h
===================================================================
--- uspace/app/hello/hello.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hello
- * @{
- */
-/**
- * @file Hello world (in UI)
- */
-
-#ifndef HELLO_H
-#define HELLO_H
-
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Hello world UI application */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_label_t *label;
-} hello_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/hello/meson.build
===================================================================
--- uspace/app/hello/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files(
-	'hello.c',
-)
Index: pace/app/inet/doc/doxygroups.h
===================================================================
--- uspace/app/inet/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup inet inet
- * @brief Internet configuration utility
- * @ingroup apps
- */
Index: pace/app/inet/inet.c
===================================================================
--- uspace/app/inet/inet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,538 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/** @file Internet configuration utility.
- *
- * Controls the internet service (@c inet).
- */
-
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/inetcfg.h>
-#include <io/table.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME  "inet"
-
-static void print_syntax(void)
-{
-	printf("%s: Internet configuration utility.\n", NAME);
-	printf("Syntax:\n");
-	printf("  %s list-addr\n", NAME);
-	printf("  %s create-addr <addr>/<width> <link-name> <addr-name>\n", NAME);
-	printf("  %s delete-addr <link-name> <addr-name>\n", NAME);
-	printf("  %s list-sr\n", NAME);
-	printf("  %s create-sr <dest-addr>/<width> <router-addr> <route-name>\n", NAME);
-	printf("  %s delete-sr <route-name>\n", NAME);
-	printf("  %s list-link\n", NAME);
-}
-
-static errno_t addr_create_static(int argc, char *argv[])
-{
-	char *aobj_name;
-	char *addr_spec;
-	char *link_name;
-
-	inet_naddr_t naddr;
-	sysarg_t link_id;
-	sysarg_t addr_id;
-	errno_t rc;
-
-	if (argc < 3) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 3) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	addr_spec = argv[0];
-	link_name = argv[1];
-	aobj_name = argv[2];
-
-	rc = loc_service_get_id(link_name, &link_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Service '%s' not found: %s.\n", link_name, str_error(rc));
-		return ENOENT;
-	}
-
-	rc = inet_naddr_parse(addr_spec, &naddr, NULL);
-	if (rc != EOK) {
-		printf(NAME ": Invalid network address format '%s'.\n",
-		    addr_spec);
-		return EINVAL;
-	}
-
-	rc = inetcfg_addr_create_static(aobj_name, &naddr, link_id, &addr_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed creating static address '%s' (%s)\n",
-		    aobj_name, str_error(rc));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t addr_delete(int argc, char *argv[])
-{
-	char *aobj_name;
-	char *link_name;
-	sysarg_t link_id;
-	sysarg_t addr_id;
-	errno_t rc;
-
-	if (argc < 2) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 2) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	link_name = argv[0];
-	aobj_name = argv[1];
-
-	rc = loc_service_get_id(link_name, &link_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Service '%s' not found: %s.\n", link_name,
-		    str_error(rc));
-		return ENOENT;
-	}
-
-	rc = inetcfg_addr_get_id(aobj_name, link_id, &addr_id);
-	if (rc != EOK) {
-		printf(NAME ": Address '%s' not found: %s.\n", aobj_name,
-		    str_error(rc));
-		return ENOENT;
-	}
-
-	rc = inetcfg_addr_delete(addr_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed deleting address '%s': %s\n", aobj_name,
-		    str_error(rc));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t sroute_create(int argc, char *argv[])
-{
-	char *dest_str;
-	char *router_str;
-	char *route_name;
-
-	inet_naddr_t dest;
-	inet_addr_t router;
-	sysarg_t sroute_id;
-	errno_t rc;
-
-	if (argc < 3) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 3) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	dest_str   = argv[0];
-	router_str = argv[1];
-	route_name = argv[2];
-
-	rc = inet_naddr_parse(dest_str, &dest, NULL);
-	if (rc != EOK) {
-		printf(NAME ": Invalid network address format '%s'.\n",
-		    dest_str);
-		return EINVAL;
-	}
-
-	rc = inet_addr_parse(router_str, &router, NULL);
-	if (rc != EOK) {
-		printf(NAME ": Invalid address format '%s'.\n", router_str);
-		return EINVAL;
-	}
-
-	rc = inetcfg_sroute_create(route_name, &dest, &router, &sroute_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed creating static route '%s': %s\n",
-		    route_name, str_error(rc));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t sroute_delete(int argc, char *argv[])
-{
-	char *route_name;
-	sysarg_t sroute_id;
-	errno_t rc;
-
-	if (argc < 1) {
-		printf(NAME ": Missing arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	if (argc > 1) {
-		printf(NAME ": Too many arguments.\n");
-		print_syntax();
-		return EINVAL;
-	}
-
-	route_name = argv[0];
-
-	rc = inetcfg_sroute_get_id(route_name, &sroute_id);
-	if (rc != EOK) {
-		printf(NAME ": Static route '%s' not found: %s.\n",
-		    route_name, str_error(rc));
-		return ENOENT;
-	}
-
-	rc = inetcfg_sroute_delete(sroute_id);
-	if (rc != EOK) {
-		printf(NAME ": Failed deleting static route '%s': %s\n",
-		    route_name, str_error(rc));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t addr_list(void)
-{
-	sysarg_t *addr_list;
-	inet_addr_info_t ainfo;
-	inet_link_info_t linfo;
-	table_t *table = NULL;
-
-	size_t count;
-	size_t i;
-	errno_t rc;
-	char *astr = NULL;
-
-	ainfo.name = NULL;
-	linfo.name = NULL;
-
-	rc = inetcfg_get_addr_list(&addr_list, &count);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting address list.\n");
-		return rc;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Memory allocation failed.\n");
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Addr/Width\t" "Link-Name\t" "Addr-Name\t"
-	    "Def-MTU\n");
-
-	for (i = 0; i < count; i++) {
-		rc = inetcfg_addr_get(addr_list[i], &ainfo);
-		if (rc != EOK) {
-			printf("Failed getting properties of address %zu.\n",
-			    (size_t)addr_list[i]);
-			ainfo.name = NULL;
-			continue;
-		}
-
-		rc = inetcfg_link_get(ainfo.ilink, &linfo);
-		if (rc != EOK) {
-			printf("Failed getting properties of link %zu.\n",
-			    (size_t)ainfo.ilink);
-			linfo.name = NULL;
-			continue;
-		}
-
-		rc = inet_naddr_format(&ainfo.naddr, &astr);
-		if (rc != EOK) {
-			printf("Memory allocation failed.\n");
-			astr = NULL;
-			goto out;
-		}
-
-		table_printf(table, "%s\t" "%s\t" "%s\t" "%zu\n", astr,
-		    linfo.name, ainfo.name, linfo.def_mtu);
-
-		free(ainfo.name);
-		free(linfo.name);
-		free(astr);
-
-		ainfo.name = NULL;
-		linfo.name = NULL;
-		astr = NULL;
-	}
-
-	if (count != 0) {
-		rc = table_print_out(table, stdout);
-		if (rc != EOK) {
-			printf("Error printing table.\n");
-			goto out;
-		}
-	}
-
-	rc = EOK;
-out:
-	table_destroy(table);
-	if (ainfo.name != NULL)
-		free(ainfo.name);
-	if (linfo.name != NULL)
-		free(linfo.name);
-	if (astr != NULL)
-		free(astr);
-
-	free(addr_list);
-
-	return rc;
-}
-
-static errno_t link_list(void)
-{
-	sysarg_t *link_list = NULL;
-	inet_link_info_t linfo;
-	table_t *table = NULL;
-	eth_addr_str_t saddr;
-
-	size_t count;
-	size_t i;
-	errno_t rc;
-
-	rc = inetcfg_get_link_list(&link_list, &count);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting link list.\n");
-		return rc;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Memory allocation failed.\n");
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Link-layer Address\t" "Link-Name\t" "Def-MTU\n");
-
-	for (i = 0; i < count; i++) {
-		rc = inetcfg_link_get(link_list[i], &linfo);
-		if (rc != EOK) {
-			printf("Failed getting properties of link %zu.\n",
-			    (size_t)link_list[i]);
-			continue;
-		}
-
-		eth_addr_format(&linfo.mac_addr, &saddr);
-		table_printf(table, "%s\t %s\t %zu\n", saddr.str, linfo.name,
-		    linfo.def_mtu);
-
-		free(linfo.name);
-
-		linfo.name = NULL;
-	}
-
-	if (count != 0) {
-		rc = table_print_out(table, stdout);
-		if (rc != EOK) {
-			printf("Error printing table.\n");
-			goto out;
-		}
-	}
-
-	rc = EOK;
-out:
-	table_destroy(table);
-	free(link_list);
-
-	return rc;
-}
-
-static errno_t sroute_list(void)
-{
-	sysarg_t *sroute_list = NULL;
-	inet_sroute_info_t srinfo;
-	table_t *table = NULL;
-
-	size_t count;
-	size_t i;
-	errno_t rc;
-	char *dest_str = NULL;
-	char *router_str = NULL;
-
-	srinfo.name = NULL;
-
-	rc = inetcfg_get_sroute_list(&sroute_list, &count);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting address list.\n");
-		return rc;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Memory allocation failed.\n");
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Dest/Width\t" "Router-Addr\t" "Route-Name\n");
-
-	for (i = 0; i < count; i++) {
-		rc = inetcfg_sroute_get(sroute_list[i], &srinfo);
-		if (rc != EOK) {
-			printf("Failed getting properties of static route %zu.\n",
-			    (size_t)sroute_list[i]);
-			srinfo.name = NULL;
-			continue;
-		}
-
-		rc = inet_naddr_format(&srinfo.dest, &dest_str);
-		if (rc != EOK) {
-			printf("Memory allocation failed.\n");
-			dest_str = NULL;
-			goto out;
-		}
-
-		rc = inet_addr_format(&srinfo.router, &router_str);
-		if (rc != EOK) {
-			printf("Memory allocation failed.\n");
-			router_str = NULL;
-			goto out;
-		}
-
-		table_printf(table, "%s\t" "%s\t" "%s\n", dest_str, router_str,
-		    srinfo.name);
-
-		free(srinfo.name);
-		free(dest_str);
-		free(router_str);
-
-		router_str = NULL;
-		srinfo.name = NULL;
-		dest_str = NULL;
-	}
-
-	if (count != 0) {
-		rc = table_print_out(table, stdout);
-		if (rc != EOK) {
-			printf("Error printing table.\n");
-			goto out;
-		}
-	}
-
-	rc = EOK;
-out:
-	table_destroy(table);
-	if (srinfo.name != NULL)
-		free(srinfo.name);
-	if (dest_str != NULL)
-		free(dest_str);
-	if (router_str != NULL)
-		free(router_str);
-
-	free(sroute_list);
-
-	return rc;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	rc = inetcfg_init();
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting to internet service: %s.\n",
-		    str_error(rc));
-		return 1;
-	}
-
-	if (argc < 2 || str_cmp(argv[1], "-h") == 0) {
-		print_syntax();
-		return 0;
-	}
-
-	if (str_cmp(argv[1], "list-addr") == 0) {
-		rc = addr_list();
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "create-addr") == 0) {
-		rc = addr_create_static(argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "delete-addr") == 0) {
-		rc = addr_delete(argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "list-sr") == 0) {
-		rc = sroute_list();
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "create-sr") == 0) {
-		rc = sroute_create(argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "delete-sr") == 0) {
-		rc = sroute_delete(argc - 2, argv + 2);
-		if (rc != EOK)
-			return 1;
-	} else if (str_cmp(argv[1], "list-link") == 0) {
-		rc = link_list();
-		if (rc != EOK)
-			return 1;
-	} else {
-		printf(NAME ": Unknown command '%s'.\n", argv[1]);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/inet/meson.build
===================================================================
--- uspace/app/inet/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files('inet.c')
Index: pace/app/init/doc/doxygroups.h
===================================================================
--- uspace/app/init/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup init init
- * @brief Init process for user space environment configuration
- * @ingroup apps
- */
Index: pace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup init
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <vfs/vfs.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <task.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <str.h>
-#include <loc.h>
-#include <str_error.h>
-#include <io/logctl.h>
-#include <vfs/vfs.h>
-#include "untar.h"
-#include "init.h"
-
-#define BANNER_LEFT   "######> "
-#define BANNER_RIGHT  " <######"
-
-#define ROOT_DEVICE       "bd/initrd"
-#define ROOT_MOUNT_POINT  "/"
-
-#define srv_start(path, ...) \
-	srv_startl(path, path, ##__VA_ARGS__, NULL)
-
-/** Print banner */
-static void info_print(void)
-{
-	printf("%s: HelenOS init\n", NAME);
-}
-
-static void oom_check(errno_t rc, const char *path)
-{
-	if (rc == ENOMEM) {
-		printf("%sOut-of-memory condition detected%s\n", BANNER_LEFT,
-		    BANNER_RIGHT);
-		printf("%sBailing out of the boot process after %s%s\n",
-		    BANNER_LEFT, path, BANNER_RIGHT);
-		printf("%sMore physical memory is required%s\n", BANNER_LEFT,
-		    BANNER_RIGHT);
-		exit(ENOMEM);
-	}
-}
-
-/** Report mount operation success */
-static bool mount_report(const char *desc, const char *mntpt,
-    const char *fstype, const char *dev, errno_t rc)
-{
-	switch (rc) {
-	case EOK:
-		if ((dev != NULL) && (str_cmp(dev, "") != 0))
-			printf("%s: %s mounted on %s (%s at %s)\n", NAME, desc, mntpt,
-			    fstype, dev);
-		else
-			printf("%s: %s mounted on %s (%s)\n", NAME, desc, mntpt, fstype);
-		break;
-	case EBUSY:
-		printf("%s: %s already mounted on %s\n", NAME, desc, mntpt);
-		return false;
-	case ELIMIT:
-		printf("%s: %s limit exceeded\n", NAME, desc);
-		return false;
-	case ENOENT:
-		printf("%s: %s unknown type (%s)\n", NAME, desc, fstype);
-		return false;
-	default:
-		printf("%s: %s not mounted on %s (%s)\n", NAME, desc, mntpt,
-		    str_error(rc));
-		return false;
-	}
-
-	return true;
-}
-
-/** Mount root file system
- *
- * The operation blocks until the root file system
- * server is ready for mounting.
- *
- * @param[in] fstype Root file system type.
- *
- * @return True on success.
- * @return False on failure.
- *
- */
-static bool mount_root(const char *fstype)
-{
-	const char *root_device = "";
-
-	if (str_cmp(fstype, "tmpfs") != 0)
-		root_device = ROOT_DEVICE;
-
-	errno_t rc = vfs_mount_path(ROOT_MOUNT_POINT, fstype, root_device, "",
-	    IPC_FLAG_BLOCKING, 0);
-	if (rc == EOK)
-		logctl_set_root();
-
-	bool ret = mount_report("Root file system", ROOT_MOUNT_POINT, fstype,
-	    root_device, rc);
-
-	rc = vfs_cwd_set(ROOT_MOUNT_POINT);
-	if (rc != EOK) {
-		printf("%s: Unable to set current directory to %s (%s)\n",
-		    NAME, ROOT_MOUNT_POINT, str_error(ret));
-		return false;
-	}
-
-	if ((ret) && (str_cmp(fstype, "tmpfs") == 0)) {
-		printf("%s: Extracting root file system archive\n", NAME);
-		ret = bd_untar(ROOT_DEVICE);
-	}
-
-	return ret;
-}
-
-static errno_t srv_startl(const char *path, ...)
-{
-	vfs_stat_t s;
-	if (vfs_stat_path(path, &s) != EOK) {
-		printf("%s: Unable to stat %s\n", NAME, path);
-		return ENOENT;
-	}
-
-	printf("%s: Starting %s\n", NAME, path);
-
-	va_list ap;
-	const char *arg;
-	int cnt = 0;
-
-	va_start(ap, path);
-	do {
-		arg = va_arg(ap, const char *);
-		cnt++;
-	} while (arg != NULL);
-	va_end(ap);
-
-	va_start(ap, path);
-	task_id_t id;
-	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
-	va_end(ap);
-
-	if (rc != EOK) {
-		oom_check(rc, path);
-		printf("%s: Error spawning %s (%s)\n", NAME, path,
-		    str_error(rc));
-		return rc;
-	}
-
-	if (!id) {
-		printf("%s: Error spawning %s (invalid task id)\n", NAME,
-		    path);
-		return EINVAL;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&wait, &texit, &retval);
-	if (rc != EOK) {
-		printf("%s: Error waiting for %s (%s)\n", NAME, path,
-		    str_error(rc));
-		return rc;
-	}
-
-	if (texit != TASK_EXIT_NORMAL) {
-		printf("%s: Server %s failed to start (unexpectedly "
-		    "terminated)\n", NAME, path);
-		return EINVAL;
-	}
-
-	if (retval != 0)
-		printf("%s: Server %s failed to start (exit code %d)\n", NAME,
-		    path, retval);
-
-	return retval == 0 ? EOK : EPARTY;
-}
-
-int main(int argc, char *argv[])
-{
-	info_print();
-
-	if (!mount_root(STRING(RDFMT))) {
-		printf("%s: Exiting\n", NAME);
-		return 1;
-	}
-
-	/* System server takes over once root is mounted */
-	srv_start("/srv/system");
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/init/init.h
===================================================================
--- uspace/app/init/init.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup init
- * @{
- */
-/**
- * @file
- */
-
-#ifndef __INIT_H__
-#define __INIT_H__
-
-#define NAME  "init"
-
-#endif
-
-/** @}
- */
Index: pace/app/init/meson.build
===================================================================
--- uspace/app/init/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'untar' ]
-link_args += '-static'
-src = files('init.c', 'untar.c')
Index: pace/app/init/untar.c
===================================================================
--- uspace/app/init/untar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2018 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup init
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <loc.h>
-#include <untar.h>
-#include <block.h>
-#include "init.h"
-#include "untar.h"
-
-typedef struct {
-	const char *dev;
-
-	service_id_t sid;
-	aoff64_t offset;
-} tar_state_t;
-
-static int bd_tar_open(tar_file_t *tar)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-
-	errno_t ret = loc_service_get_id(state->dev, &state->sid,
-	    IPC_FLAG_BLOCKING);
-	if (ret != EOK)
-		return ret;
-
-	ret = block_init(state->sid);
-	if (ret != EOK)
-		return ret;
-
-	state->offset = 0;
-	return EOK;
-}
-
-static void bd_tar_close(tar_file_t *tar)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-	block_fini(state->sid);
-}
-
-static size_t bd_tar_read(tar_file_t *tar, void *data, size_t size)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-
-	if (block_read_bytes_direct(state->sid, state->offset, size,
-	    data) != EOK)
-		return 0;
-
-	state->offset += size;
-	return size;
-}
-
-static void bd_tar_vreport(tar_file_t *tar, const char *fmt, va_list args)
-{
-	vprintf(fmt, args);
-}
-
-tar_file_t tar = {
-	.open = bd_tar_open,
-	.close = bd_tar_close,
-
-	.read = bd_tar_read,
-	.vreport = bd_tar_vreport
-};
-
-bool bd_untar(const char *dev)
-{
-	tar_state_t state;
-	state.dev = dev;
-
-	tar.data = (void *) &state;
-	return (untar(&tar) == EOK);
-}
-
-/** @}
- */
Index: pace/app/init/untar.h
===================================================================
--- uspace/app/init/untar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup init
- * @{
- */
-/**
- * @file
- */
-
-#ifndef __UNTAR_H__
-#define __UNTAR_H__
-
-#include <stdbool.h>
-
-extern bool bd_untar(const char *);
-
-#endif
-
-/** @}
- */
Index: pace/app/kill/doc/doxygroups.h
===================================================================
--- uspace/app/kill/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup kill kill
- * @brief Forcefully terminate a task
- * @ingroup apps
- */
Index: pace/app/kill/kill.c
===================================================================
--- uspace/app/kill/kill.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kill
- * @{
- */
-/**
- * @file Forcefully terminate a task.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <task.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME  "kill"
-
-static void print_syntax(void)
-{
-	printf("Syntax: " NAME " <task ID>\n");
-}
-
-int main(int argc, char *argv[])
-{
-	char *eptr;
-	task_id_t taskid;
-	errno_t rc;
-
-	if (argc != 2) {
-		print_syntax();
-		return 1;
-	}
-
-	taskid = strtoul(argv[1], &eptr, 0);
-	if (*eptr != '\0') {
-		printf("Invalid task ID argument '%s'.\n", argv[1]);
-		return 2;
-	}
-
-	rc = task_kill(taskid);
-	if (rc != EOK) {
-		printf("Failed to kill task ID %" PRIu64 ": %s\n",
-		    taskid, str_error(rc));
-		return 3;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/kill/meson.build
===================================================================
--- uspace/app/kill/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('kill.c')
Index: pace/app/killall/doc/doxygroups.h
===================================================================
--- uspace/app/killall/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup killall killall
- * @brief Forcefully terminate a task specified by name
- * @ingroup apps
- */
Index: pace/app/killall/killall.c
===================================================================
--- uspace/app/killall/killall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup killall
- * @{
- */
-/**
- * @file Forcefully terminate a task specified by name.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <task.h>
-#include <stats.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define NAME  "killall"
-
-static void print_syntax(void)
-{
-	printf("Syntax: " NAME " <task name>\n");
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc != 2) {
-		print_syntax();
-		return 1;
-	}
-
-	size_t count;
-	stats_task_t *stats_tasks = stats_get_tasks(&count);
-
-	if (stats_tasks == NULL) {
-		fprintf(stderr, "%s: Unable to get tasks\n", NAME);
-		return 2;
-	}
-
-	size_t i;
-	for (i = 0; i < count; i++) {
-		if (str_cmp(stats_tasks[i].name, argv[1]) == 0) {
-			task_id_t taskid = stats_tasks[i].task_id;
-			errno_t rc = task_kill(taskid);
-			if (rc != EOK)
-				printf("Failed to kill task ID %" PRIu64 ": %s\n",
-				    taskid, str_error(rc));
-			else
-				printf("Killed task ID %" PRIu64 "\n", taskid);
-		}
-	}
-
-	free(stats_tasks);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/killall/meson.build
===================================================================
--- uspace/app/killall/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('killall.c')
Index: pace/app/kio/doc/doxygroups.h
===================================================================
--- uspace/app/kio/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup kio kio
- * @brief Interactive tool to interact with kconsole
- * @ingroup apps
- */
Index: pace/app/kio/kio.c
===================================================================
--- uspace/app/kio/kio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kio
- * @{
- */
-/**
- * @file
- */
-
-#include <_bits/decls.h>
-#include <libarch/config.h>
-#include <stdio.h>
-#include <async.h>
-#include <as.h>
-#include <ddi.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/kio.h>
-#include <sysinfo.h>
-#include <stdlib.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <adt/prodcons.h>
-#include <tinput.h>
-#include <uchar.h>
-#include <vfs/vfs.h>
-
-#define NAME       "kio"
-#define LOG_FNAME  "/log/kio"
-
-/* Producer/consumer buffers */
-typedef struct {
-	link_t link;
-	size_t bytes;
-	char *data;
-} item_t;
-
-static prodcons_t pc;
-
-/* Notification mutex */
-static FIBRIL_MUTEX_INITIALIZE(mtx);
-
-#define READ_BUFFER_SIZE PAGE_SIZE
-
-static size_t current_at;
-static char read_buffer[READ_BUFFER_SIZE];
-
-/** Klog producer
- *
- * Copies the contents of a character buffer to local
- * producer/consumer queue.
- *
- * @param length Number of characters to copy.
- * @param data   Pointer to the kernel kio buffer.
- *
- */
-static void producer(size_t bytes, char *data)
-{
-	item_t *item = malloc(sizeof(item_t));
-	if (item == NULL)
-		return;
-
-	item->bytes = bytes;
-	item->data = malloc(bytes);
-	if (!item->data) {
-		free(item);
-		return;
-	}
-
-	memcpy(item->data, data, bytes);
-
-	link_initialize(&item->link);
-	prodcons_produce(&pc, &item->link);
-}
-
-/** Klog consumer
- *
- * Waits in an infinite loop for the character data created by
- * the producer and outputs them to stdout and optionally into
- * a file.
- *
- * @param data Unused.
- *
- * @return Always EOK (unreachable).
- *
- */
-static errno_t consumer(void *data)
-{
-	FILE *log = fopen(LOG_FNAME, "a");
-	if (log == NULL)
-		printf("%s: Unable to create log file %s (%s)\n", NAME, LOG_FNAME,
-		    str_error(errno));
-
-	while (true) {
-		link_t *link = prodcons_consume(&pc);
-		item_t *item = list_get_instance(link, item_t, link);
-
-		fwrite(item->data, 1, item->bytes, stdout);
-
-		if (log) {
-			fwrite(item->data, 1, item->bytes, log);
-			fflush(log);
-			vfs_sync(fileno(log));
-		}
-
-		free(item->data);
-		free(item);
-	}
-
-	fclose(log);
-	return EOK;
-}
-
-/** Kernel notification handler
- *
- * Receives kernel kio notifications.
- *
- * @param call   IPC call structure
- * @param arg    Local argument
- *
- */
-static void kio_notification_handler(ipc_call_t *call, void *arg)
-{
-	size_t kio_written = (size_t) ipc_get_arg1(call);
-
-	/*
-	 * Make sure we process only a single notification
-	 * at any time to limit the chance of the consumer
-	 * starving.
-	 */
-
-	fibril_mutex_lock(&mtx);
-
-	while (current_at != kio_written) {
-		size_t read = kio_read(read_buffer, READ_BUFFER_SIZE, current_at);
-		if (read == 0)
-			break;
-
-		current_at += read;
-
-		if (read > READ_BUFFER_SIZE) {
-			/* We missed some data. */
-			// TODO: Send a message with the number of lost characters to the consumer.
-			read = READ_BUFFER_SIZE;
-		}
-
-		producer(read, read_buffer);
-	}
-
-	async_event_unmask(EVENT_KIO);
-	fibril_mutex_unlock(&mtx);
-}
-
-int main(int argc, char *argv[])
-{
-	prodcons_initialize(&pc);
-	errno_t rc = async_event_subscribe(EVENT_KIO, kio_notification_handler, NULL);
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Unable to register kio notifications\n",
-		    NAME);
-		return rc;
-	}
-
-	fid_t fid = fibril_create(consumer, NULL);
-	if (!fid) {
-		fprintf(stderr, "%s: Unable to create consumer fibril\n",
-		    NAME);
-		return ENOMEM;
-	}
-
-	tinput_t *input = tinput_new();
-	if (!input) {
-		fprintf(stderr, "%s: Could not create input\n", NAME);
-		return ENOMEM;
-	}
-
-	fibril_add_ready(fid);
-	async_event_unmask(EVENT_KIO);
-	kio_update();
-
-	tinput_set_prompt(input, "kio> ");
-
-	char *str;
-	while ((rc = tinput_read(input, &str)) == EOK) {
-		if (str_cmp(str, "") == 0) {
-			free(str);
-			continue;
-		}
-
-		kio_command(str, str_size(str));
-		free(str);
-	}
-
-	if (rc == ENOENT)
-		rc = EOK;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/kio/meson.build
===================================================================
--- uspace/app/kio/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clui' ]
-src = files('kio.c')
Index: pace/app/loc/doc/doxygroups.h
===================================================================
--- uspace/app/loc/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup loc loc
- * @brief Print information from location service
- * @ingroup apps
- */
Index: pace/app/loc/loc.c
===================================================================
--- uspace/app/loc/loc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup loc
- * @{
- */
-/** @file loc.c Print information from location service.
- */
-
-#include <errno.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <str.h>
-
-#define NAME "loc"
-
-static errno_t show_cat(const char *cat_name, category_id_t cat_id)
-{
-	service_id_t *svc_ids;
-	size_t svc_cnt;
-	char *svc_name;
-	char *server_name;
-	errno_t rc;
-	size_t j;
-
-	printf("%s:\n", cat_name);
-
-	rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting list of services in "
-		    "category %s, skipping.\n", cat_name);
-		return rc;
-	}
-
-	for (j = 0; j < svc_cnt; j++) {
-		rc = loc_service_get_name(svc_ids[j], &svc_name);
-		if (rc != EOK) {
-			printf(NAME ": Unknown service name (SID %"
-			    PRIun ").\n", svc_ids[j]);
-			continue;
-		}
-
-		rc = loc_service_get_server_name(svc_ids[j], &server_name);
-		if (rc != EOK && rc != EINVAL) {
-			free(svc_name);
-			printf(NAME ": Unknown service name (SID %"
-			    PRIun ").\n", svc_ids[j]);
-			continue;
-		}
-
-		if (rc == EOK)
-			printf("\t%s : %s\n", svc_name, server_name);
-		else
-			printf("\t%s\n", svc_name);
-
-		free(svc_name);
-		free(server_name);
-	}
-
-	free(svc_ids);
-	return EOK;
-}
-
-static errno_t list_svcs_by_cat(void)
-{
-	category_id_t *cat_ids;
-	size_t cat_cnt;
-
-	size_t i;
-	char *cat_name;
-	errno_t rc;
-
-	rc = loc_get_categories(&cat_ids, &cat_cnt);
-	if (rc != EOK) {
-		printf(NAME ": Error getting list of categories.\n");
-		return rc;
-	}
-
-	for (i = 0; i < cat_cnt; i++) {
-		rc = loc_category_get_name(cat_ids[i], &cat_name);
-		if (rc != EOK)
-			cat_name = str_dup("<unknown>");
-
-		if (cat_name == NULL) {
-			printf(NAME ": Error allocating memory.\n");
-			free(cat_ids);
-			return rc;
-		}
-
-		rc = show_cat(cat_name, cat_ids[i]);
-		(void) rc;
-
-		free(cat_name);
-	}
-
-	free(cat_ids);
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("syntax:\n"
-	    "\t" NAME "                      List categories and services "
-	    "they contain\n"
-	    "\t" NAME " show-cat <category>  List services in category\n");
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	char *cmd;
-	char *cat_name;
-	category_id_t cat_id;
-
-	if (argc <= 1) {
-		rc = list_svcs_by_cat();
-		if (rc != EOK)
-			return 1;
-		return 0;
-	}
-
-	cmd = argv[1];
-	if (str_cmp(cmd, "show-cat") == 0) {
-		if (argc < 3) {
-			printf("Argument missing.\n");
-			print_syntax();
-			return 1;
-		}
-
-		cat_name = argv[2];
-		rc = loc_category_get_id(cat_name, &cat_id, 0);
-		if (rc != EOK) {
-			printf("Error looking up category '%s'.\n", cat_name);
-			return 1;
-		}
-
-		rc = show_cat(cat_name, cat_id);
-		if (rc != EOK)
-			return 1;
-	} else {
-		printf("Invalid command '%s'\n", cmd);
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/loc/meson.build
===================================================================
--- uspace/app/loc/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('loc.c')
Index: pace/app/logset/doc/doxygroups.h
===================================================================
--- uspace/app/logset/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup logset logset
- * @brief Change logger behavior
- * @ingroup apps
- */
Index: pace/app/logset/main.c
===================================================================
--- uspace/app/logset/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup logset
- * @{
- */
-/** @file Change logger behavior.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/logctl.h>
-
-static log_level_t parse_log_level_or_die(const char *log_level)
-{
-	log_level_t result;
-	errno_t rc = log_level_from_str(log_level, &result);
-	if (rc != EOK) {
-		fprintf(stderr, "Unrecognised log level '%s': %s.\n",
-		    log_level, str_error(rc));
-		exit(2);
-	}
-	return result;
-}
-
-static void usage(const char *progname)
-{
-	fprintf(stderr, "Usage:\n");
-	fprintf(stderr, "  %s <default-logging-level>\n", progname);
-	fprintf(stderr, "  %s <log-name> <logging-level>\n", progname);
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc == 2) {
-		log_level_t new_default_level = parse_log_level_or_die(argv[1]);
-		errno_t rc = logctl_set_default_level(new_default_level);
-
-		if (rc != EOK) {
-			fprintf(stderr, "Failed to change default logging level: %s.\n",
-			    str_error(rc));
-			return 2;
-		}
-	} else if (argc == 3) {
-		log_level_t new_level = parse_log_level_or_die(argv[2]);
-		const char *logname = argv[1];
-		errno_t rc = logctl_set_log_level(logname, new_level);
-
-		if (rc != EOK) {
-			fprintf(stderr, "Failed to change logging level: %s.\n",
-			    str_error(rc));
-			return 2;
-		}
-	} else {
-		usage(argv[0]);
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/logset/meson.build
===================================================================
--- uspace/app/logset/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2012 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c')
Index: pace/app/lprint/doc/doxygroups.h
===================================================================
--- uspace/app/lprint/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup lprint lprint
- * @brief Print on a printer
- * @ingroup apps
- */
Index: pace/app/lprint/lprint.c
===================================================================
--- uspace/app/lprint/lprint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,309 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup lprint
- * @{
- */
-
-/**
- * @file
- * @brief Print on a printer
- *
- */
-
-#include <errno.h>
-#include <io/chardev.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define NAME	"lprint"
-
-#define BUF_SIZE 1024
-
-static void syntax_print(void);
-
-/** Get default printer port.
- *
- * @param sid Place to store service ID of the printer port
- * @return EOK on success or error code
- */
-static errno_t lprint_get_def_printer_port(service_id_t *sid)
-{
-	category_id_t cid;
-	service_id_t *sids;
-	size_t nsids;
-	errno_t rc;
-
-	rc = loc_category_get_id("printer-port", &cid, 0);
-	if (rc != EOK)
-		return EIO;
-
-	rc = loc_category_get_svcs(cid, &sids, &nsids);
-	if (rc != EOK)
-		return EIO;
-
-	if (nsids < 1) {
-		free(sids);
-		return EIO;
-	}
-
-	*sid = sids[0];
-	free(sids);
-	return EOK;
-}
-
-/** Print a message.
- *
- * @param chardev Character device
- * @param argc Number of arguments
- * @param argv Arguments - strings to print
- *
- * @return EOK on success or error code
- */
-static errno_t lprint_msg(chardev_t *chardev, int argc, char *argv[])
-{
-	const char *msg;
-	size_t nbytes;
-	const char *sep;
-	errno_t rc;
-
-	while (argc > 0) {
-		msg = *argv;
-		--argc;
-		++argv;
-
-		rc = chardev_write(chardev, msg, str_size(msg), &nbytes);
-		if (rc != EOK) {
-			printf(NAME ": Failed sending data.\n");
-			return EIO;
-		}
-
-		sep = argc > 0 ? " " : "\n";
-
-		rc = chardev_write(chardev, sep, str_size(sep), &nbytes);
-		if (rc != EOK) {
-			printf(NAME ": Failed sending data.\n");
-			return EIO;
-		}
-	}
-
-	return EOK;
-}
-
-/** Print a file.
- *
- * @param chardev Character device
- * @param fname File name
- *
- * @return EOK on success or error code
- */
-static errno_t lprint_file(chardev_t *chardev, const char *fname)
-{
-	void *buf;
-	size_t nread, nwritten;
-	FILE *f = NULL;
-	errno_t rc;
-
-	buf = malloc(BUF_SIZE);
-	if (buf == NULL) {
-		printf(NAME ": Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	f = fopen(fname, "rb");
-	if (f == NULL) {
-		printf(NAME ": Cannot open '%s'.\n", fname);
-		rc = EIO;
-		goto error;
-	}
-
-	while (true) {
-		nread = fread(buf, 1, BUF_SIZE, f);
-		if (ferror(f)) {
-			printf(NAME ": Error reading file.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		if (nread == 0)
-			break;
-
-		rc = chardev_write(chardev, buf, nread, &nwritten);
-		if (rc != EOK) {
-			printf(NAME ": Failed sending data.\n");
-			rc = EIO;
-			goto error;
-		}
-
-	}
-
-	fclose(f);
-	return EOK;
-error:
-	if (buf != NULL)
-		free(buf);
-	if (f != NULL)
-		fclose(f);
-	return rc;
-}
-
-int main(int argc, char **argv)
-{
-	chardev_t *chardev;
-	errno_t rc;
-	async_sess_t *sess;
-	service_id_t sid;
-	const char *svc_name = NULL;
-	bool msg_mode = false;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	--argc;
-	++argv;
-
-	while (*argv != NULL && *argv[0] == '-') {
-		if (str_cmp(*argv, "-d") == 0) {
-			--argc;
-			++argv;
-
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			svc_name = *argv;
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "-m") == 0) {
-			msg_mode = true;
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "--help") == 0) {
-			--argc;
-			++argv;
-
-			if (*argv != NULL) {
-				printf(NAME ": Error, unexpected argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			syntax_print();
-			return 0;
-		}
-
-		printf(NAME ": Error, invalid argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	if (argc < 1) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	if (!msg_mode && argc > 1) {
-		printf(NAME ": Error, too many arguments.\n");
-		syntax_print();
-		return 1;
-	}
-
-	if (svc_name != NULL) {
-		rc = loc_service_get_id(svc_name, &sid, 0);
-		if (rc != EOK) {
-			printf(NAME ": Failed resolving printer port service "
-			    "'%s'.\n", svc_name);
-			return 1;
-		}
-	} else {
-		rc = lprint_get_def_printer_port(&sid);
-		if (rc != EOK) {
-			printf(NAME ": No printer found.\n");
-			return 1;
-		}
-	}
-
-	sess = loc_service_connect(sid, INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf(NAME ": Failed connecting printer port service.\n");
-		return 1;
-	}
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		async_hangup(sess);
-		printf(NAME ": Failed opening printer port device.\n");
-		return 1;
-	}
-
-	if (msg_mode) {
-		rc = lprint_msg(chardev, argc, argv);
-		if (rc != EOK) {
-			chardev_close(chardev);
-			return 1;
-		}
-	} else {
-		rc = lprint_file(chardev, argv[0]);
-		if (rc != EOK) {
-			chardev_close(chardev);
-			return 1;
-		}
-	}
-
-	chardev_close(chardev);
-	return 0;
-}
-
-/** Print syntax help. */
-static void syntax_print(void)
-{
-	printf("syntax:\n"
-	    "\tlprint [<options>] <file>\n"
-	    "\tlprint [<options>] -m <message...>\n"
-	    "options:\n"
-	    "\t-d <device>Print to the specified device\n");
-}
-
-/**
- * @}
- */
Index: pace/app/lprint/meson.build
===================================================================
--- uspace/app/lprint/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('lprint.c')
Index: pace/app/meson.build
===================================================================
--- uspace/app/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-apps = [
-	'aboutos',
-	'barber',
-	'bdsh',
-	'bithenge',
-	'blkdump',
-	'calculator',
-	'clock_widget',
-	'corecfg',
-	'cpptest',
-	'date',
-	'date_cfg',
-	'devctl',
-	'df',
-	'disp',
-	'display-cfg',
-	'dnscfg',
-	'dnsres',
-	'download',
-	'edit',
-	'fdisk',
-	'fontedit',
-	'getterm',
-	'gfxdemo',
-	'gunzip',
-	'hbench',
-	'hello',
-	'inet',
-	'init',
-	'kill',
-	'killall',
-	'kio',
-	'loc',
-	'logset',
-	'lprint',
-	'mixerctl',
-	'mkbd',
-	'mkexfat',
-	'mkext4',
-	'mkfat',
-	'mkmfs',
-	'modplay',
-	'nav',
-	'netecho',
-	'nic',
-	'nterm',
-	'ofw',
-	'pci',
-	'ping',
-	'pkg',
-	'redir',
-	'sbi',
-	'shutdown',
-	'shutdown-dlg',
-	'sportdmp',
-	'stats',
-	'sysinfo',
-	'sysinst',
-	'taskbar',
-	'taskbar-cfg',
-	'taskdump',
-	'terminal',
-	'tester',
-	'testread',
-	'testrunner',
-	'testwrit',
-	'tetris',
-	'tmon',
-	'top',
-	'trace',
-	'uidemo',
-	'untar',
-	'usbinfo',
-	'viewer',
-	'vol',
-	'vuhid',
-	'wavplay',
-	'websrv',
-	'wifi_supplicant',
-]
-
-if CONFIG_BUILD_SHARED_LIBS
-	apps += [
-		'dltest',
-		'dltests',
-	]
-endif
Index: pace/app/mixerctl/doc/doxygroups.h
===================================================================
--- uspace/app/mixerctl/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mixerctl mixerctl
- * @brief Mixer control for audio devices
- * @ingroup apps
- */
Index: pace/app/mixerctl/meson.build
===================================================================
--- uspace/app/mixerctl/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('mixerctl.c')
Index: pace/app/mixerctl/mixerctl.c
===================================================================
--- uspace/app/mixerctl/mixerctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mixerctl
- * @{
- */
-/** @file Mixer control for audio devices
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <loc.h>
-#include <str_error.h>
-#include <str.h>
-#include <audio_mixer_iface.h>
-#include <stdio.h>
-
-#define DEFAULT_SERVICE "devices/\\hw\\pci0\\00:01.0\\sb16\\control"
-
-/**
- * Print volume levels on all channels on all control items.
- * @param exch IPC exchange
- */
-static void print_levels(async_exch_t *exch)
-{
-	char *name = NULL;
-	unsigned count = 0;
-	errno_t ret = audio_mixer_get_info(exch, &name, &count);
-	if (ret != EOK) {
-		printf("Failed to get mixer info: %s.\n", str_error(ret));
-		return;
-	}
-	printf("MIXER %s:\n\n", name);
-
-	for (unsigned i = 0; i < count; ++i) {
-		char *name = NULL;
-		unsigned levels = 0, current = 0;
-		errno_t ret =
-		    audio_mixer_get_item_info(exch, i, &name, &levels);
-		if (ret != EOK) {
-			printf("Failed to get item %u info: %s.\n",
-			    i, str_error(ret));
-			continue;
-		}
-		ret = audio_mixer_get_item_level(exch, i, &current);
-		if (ret != EOK) {
-			printf("Failed to get item %u info: %s.\n",
-			    i, str_error(ret));
-			continue;
-		}
-
-		printf("Control item %u `%s' : %u/%u.\n",
-		    i, name, current, levels - 1);
-		free(name);
-
-	}
-}
-
-static unsigned get_number(const char *str)
-{
-	uint16_t num;
-	str_uint16_t(str, NULL, 10, false, &num);
-	return num;
-}
-
-static void set_level(async_exch_t *exch, int argc, char *argv[])
-{
-	assert(exch);
-	if (argc != 4 && argc != 5) {
-		printf("%s [device] setlevel item value\n", argv[0]);
-		return;
-	}
-	unsigned params = argc == 5 ? 3 : 2;
-	const unsigned item = get_number(argv[params++]);
-	const unsigned value = get_number(argv[params]);
-	errno_t ret = audio_mixer_set_item_level(exch, item, value);
-	if (ret != EOK) {
-		printf("Failed to set item level: %s.\n", str_error(ret));
-		return;
-	}
-	printf("Control item %u new level is %u.\n", item, value);
-}
-
-static void get_level(async_exch_t *exch, int argc, char *argv[])
-{
-	assert(exch);
-	if (argc != 3 && argc != 4) {
-		printf("%s [device] getlevel item \n", argv[0]);
-		return;
-	}
-	unsigned params = argc == 4 ? 3 : 2;
-	const unsigned item = get_number(argv[params++]);
-	unsigned value = 0;
-
-	errno_t ret = audio_mixer_get_item_level(exch, item, &value);
-	if (ret != EOK) {
-		printf("Failed to get item level: %s.\n", str_error(ret));
-		return;
-	}
-	printf("Control item %u level: %u.\n", item, value);
-}
-
-int main(int argc, char *argv[])
-{
-	const char *service = DEFAULT_SERVICE;
-	void (*command)(async_exch_t *, int, char *[]) = NULL;
-
-	if (argc >= 2 && str_cmp(argv[1], "setlevel") == 0) {
-		command = set_level;
-		if (argc == 5)
-			service = argv[1];
-	}
-
-	if (argc >= 2 && str_cmp(argv[1], "getlevel") == 0) {
-		command = get_level;
-		if (argc == 4)
-			service = argv[1];
-	}
-
-	if ((argc == 2 && command == NULL))
-		service = argv[1];
-
-	service_id_t mixer_sid;
-	errno_t rc = loc_service_get_id(service, &mixer_sid, 0);
-	if (rc != EOK) {
-		printf("Failed to resolve service '%s': %s.\n",
-		    service, str_error(rc));
-		return 1;
-	}
-
-	async_sess_t *session = loc_service_connect(mixer_sid, INTERFACE_DDF, 0);
-	if (!session) {
-		printf("Failed connecting mixer service '%s'.\n", service);
-		return 1;
-	}
-
-	async_exch_t *exch = async_exchange_begin(session);
-	if (!exch) {
-		printf("Failed to start session exchange.\n");
-		async_hangup(session);
-		return 1;
-	}
-
-	if (command) {
-		command(exch, argc, argv);
-	} else {
-		print_levels(exch);
-		printf("\n%s:\n", argv[0]);
-		printf("Use '%s getlevel idx' command to read individual "
-		    "settings\n", argv[0]);
-		printf("Use '%s setlevel idx' command to change "
-		    "settings\n", argv[0]);
-	}
-
-	async_exchange_end(exch);
-	async_hangup(session);
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/mkbd/doc/doxygroups.h
===================================================================
--- uspace/app/mkbd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mkbd mkbd
- * @brief Sample application using the data from multimedia keys on keyboard
- * @ingroup apps
- */
Index: pace/app/mkbd/main.c
===================================================================
--- uspace/app/mkbd/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,304 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkbd
- * @{
- */
-/**
- * @file
- * Sample application using the data from multimedia keys on keyboard
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fibril.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <getopt.h>
-#include <devman.h>
-#include <loc.h>
-#include <usbhid_iface.h>
-#include <usb/dev/pipes.h>
-#include <async.h>
-#include <usb/dev.h>
-#include <usb/hid/usages/core.h>
-#include <usb/hid/hidparser.h>
-#include <usb/hid/hiddescriptor.h>
-#include <usb/hid/usages/consumer.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <assert.h>
-
-#define NAME "mkbd"
-
-static async_sess_t *dev_sess = NULL;
-
-static errno_t initialize_report_parser(async_sess_t *dev_sess,
-    usb_hid_report_t **report)
-{
-	*report = (usb_hid_report_t *) malloc(sizeof(usb_hid_report_t));
-	if (*report == NULL)
-		return ENOMEM;
-
-	errno_t rc = usb_hid_report_init(*report);
-	if (rc != EOK) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		return rc;
-	}
-
-	/* Get the report descriptor length from the device */
-	size_t report_desc_size;
-	rc = usbhid_dev_get_report_descriptor_length(dev_sess,
-	    &report_desc_size);
-	if (rc != EOK) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		return rc;
-	}
-
-	if (report_desc_size == 0) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		// TODO: other error code?
-		return EINVAL;
-	}
-
-	uint8_t *desc = (uint8_t *) malloc(report_desc_size);
-	if (desc == NULL) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		return ENOMEM;
-	}
-
-	/* Get the report descriptor from the device */
-	size_t actual_size;
-	rc = usbhid_dev_get_report_descriptor(dev_sess, desc, report_desc_size,
-	    &actual_size);
-	if (rc != EOK) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		free(desc);
-		return rc;
-	}
-
-	if (actual_size != report_desc_size) {
-		usb_hid_report_deinit(*report);
-		*report = NULL;
-		free(desc);
-		// TODO: other error code?
-		return EINVAL;
-	}
-
-	/* Initialize the report parser */
-
-	rc = usb_hid_parse_report_descriptor(*report, desc, report_desc_size);
-	free(desc);
-
-	return rc;
-}
-
-static void print_key(uint8_t *buffer, size_t size, usb_hid_report_t *report)
-{
-	assert(buffer != NULL);
-	assert(report != NULL);
-
-	uint8_t report_id;
-	errno_t rc = usb_hid_parse_report(report, buffer, size, &report_id);
-	if (rc != EOK)
-		return;
-
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	if (path == NULL) {
-		return;
-	}
-
-	usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
-
-	usb_hid_report_path_set_report_id(path, report_id);
-
-	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    report, NULL, path, USB_HID_PATH_COMPARE_END |
-	    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-	    USB_HID_REPORT_TYPE_INPUT);
-
-	while (field != NULL) {
-		if (field->value != 0) {
-			const char *key_str =
-			    usbhid_multimedia_usage_to_str(field->usage);
-			printf("Pressed key: %s\n", key_str);
-		}
-
-		field = usb_hid_report_get_sibling(
-		    report, field, path, USB_HID_PATH_COMPARE_END |
-		    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_INPUT);
-	}
-
-	usb_hid_report_path_free(path);
-}
-
-static errno_t wait_for_quit_fibril(void *arg)
-{
-	console_ctrl_t *con = console_init(stdin, stdout);
-
-	printf("Press <ESC> to quit the application.\n");
-
-	while (true) {
-		cons_event_t ev;
-		errno_t rc = console_get_event(con, &ev);
-		if (rc != EOK) {
-			printf("Connection with console broken: %s.\n",
-			    str_error(errno));
-			break;
-		}
-
-		if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS &&
-		    ev.ev.key.key == KC_ESCAPE) {
-			break;
-		}
-	}
-
-	console_done(con);
-
-	exit(0);
-
-	return EOK;
-}
-
-#define MAX_PATH_LENGTH 1024
-
-static void print_usage(char *app_name)
-{
-#define _INDENT "      "
-	printf(NAME ": Print out what multimedia keys were pressed.\n\n");
-	printf("Usage: %s device\n", app_name);
-	printf(_INDENT "The device is a devman path to the device.\n");
-#undef _OPTION
-#undef _INDENT
-}
-
-int main(int argc, char *argv[])
-{
-	int act_event = -1;
-
-	if (argc <= 1) {
-		print_usage(argv[0]);
-		return -1;
-	}
-
-	char *devpath = argv[1];
-
-	devman_handle_t dev_handle = 0;
-
-	errno_t rc = usb_resolve_device_handle(devpath, &dev_handle);
-	if (rc != EOK) {
-		printf("Device not found or not of USB kind: %s.\n",
-		    str_error(rc));
-		return rc;
-	}
-
-	async_sess_t *sess = devman_device_connect(dev_handle, 0);
-	if (!sess) {
-		printf(NAME ": failed to connect to the device (handle %"
-		    PRIun "): %s.\n", dev_handle, str_error(errno));
-		return errno;
-	}
-
-	dev_sess = sess;
-
-	char path[MAX_PATH_LENGTH];
-	rc = devman_fun_get_path(dev_handle, path, MAX_PATH_LENGTH);
-	if (rc != EOK) {
-		printf(NAME ": failed to get path (handle %"
-		    PRIun "): %s.\n", dev_handle, str_error(errno));
-		return ENOMEM;
-	}
-
-	printf("Device path: %s\n", path);
-
-	usb_hid_report_t *report = NULL;
-	rc = initialize_report_parser(dev_sess, &report);
-	if (rc != EOK) {
-		printf("Failed to initialize report parser: %s\n",
-		    str_error(rc));
-		return rc;
-	}
-
-	assert(report != NULL);
-
-	size_t size;
-	rc = usbhid_dev_get_event_length(dev_sess, &size);
-	if (rc != EOK) {
-		printf("Failed to get event length: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	uint8_t *event = (uint8_t *)malloc(size);
-	if (event == NULL) {
-		printf("Out of memory.\n");
-		// TODO: hangup phone?
-		return ENOMEM;
-	}
-
-	fid_t quit_fibril = fibril_create(wait_for_quit_fibril, NULL);
-	if (quit_fibril == 0) {
-		printf("Failed to start extra fibril.\n");
-		return -1;
-	}
-	fibril_add_ready(quit_fibril);
-
-	size_t actual_size;
-	int event_nr;
-
-	while (true) {
-		/** @todo Try blocking call. */
-		rc = usbhid_dev_get_event(dev_sess, event, size, &actual_size,
-		    &event_nr, 0);
-		if (rc != EOK) {
-			// TODO: hangup phone?
-			printf("Error in getting event from the HID driver:"
-			    "%s.\n", str_error(rc));
-			break;
-		}
-
-		if (event_nr > act_event) {
-			print_key(event, size, report);
-			act_event = event_nr;
-		}
-
-		fibril_usleep(10000);
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/mkbd/meson.build
===================================================================
--- uspace/app/mkbd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usb', 'usbdev', 'usbhid', 'drv', 'console' ]
-src = files('main.c')
Index: pace/app/mkexfat/doc/doxygroups.h
===================================================================
--- uspace/app/mkexfat/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mkexfat mkexfat
- * @brief Tool for creating new exFAT file systems
- * @ingroup apps
- */
Index: pace/app/mkexfat/exfat.h
===================================================================
--- uspace/app/mkexfat/exfat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkexfat
- * @{
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#define EXFAT_FILENAME_LEN	255
-#define EXFAT_NAME_PART_LEN	15
-#define EXFAT_VOLLABEL_LEN	11
-
-#define EXFAT_TYPE_UNUSED	0x00
-#define EXFAT_TYPE_USED		0x80
-#define EXFAT_TYPE_VOLLABEL	0x83
-#define EXFAT_TYPE_BITMAP	0x81
-#define EXFAT_TYPE_UCTABLE	0x82
-#define EXFAT_TYPE_GUID		0xA0
-#define EXFAT_TYPE_FILE		0x85
-#define EXFAT_TYPE_STREAM	0xC0
-#define EXFAT_TYPE_NAME		0xC1
-
-#define EXFAT_ATTR_RDONLY	0x01
-#define EXFAT_ATTR_HIDDEN	0x02
-#define EXFAT_ATTR_SYSTEM	0x04
-#define EXFAT_ATTR_SUBDIR	0x10
-#define EXFAT_ATTR_ARCHIVE	0x20
-
-/* All dentry structs should have 31 byte size */
-typedef struct {
-	uint8_t 	size;
-	uint16_t 	label[11];
-	uint8_t 	_reserved[8];
-} __attribute__((packed)) exfat_vollabel_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint8_t 	_reserved[18];
-	uint32_t 	firstc;
-	uint64_t 	size;
-} __attribute__((packed)) exfat_bitmap_dentry_t;
-
-typedef struct {
-	uint8_t 	_reserved1[3];
-	uint32_t 	checksum;
-	uint8_t 	_reserved2[12];
-	uint32_t 	firstc;
-	uint64_t 	size;
-} __attribute__((packed)) exfat_uctable_dentry_t;
-
-typedef struct {
-	uint8_t 	count; /* Always zero */
-	uint16_t 	checksum;
-	uint16_t 	flags;
-	uint8_t 	guid[16];
-	uint8_t 	_reserved[10];
-} __attribute__((packed)) exfat_guid_dentry_t;
-
-typedef struct {
-	uint8_t 	count;
-	uint16_t 	checksum;
-	uint16_t 	attr;
-	uint8_t 	_reserved1[2];
-	uint32_t 	ctime;
-	uint32_t 	mtime;
-	uint32_t 	atime;
-	uint8_t 	ctime_fine;
-	uint8_t 	mtime_fine;
-	uint8_t 	ctime_tz;
-	uint8_t 	mtime_tz;
-	uint8_t 	atime_tz;
-	uint8_t 	_reserved2[7];
-} __attribute__((packed)) exfat_file_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint8_t 	_reserved1[1];
-	uint8_t 	name_size;
-	uint16_t 	hash;
-	uint8_t 	_reserved2[2];
-	uint64_t 	valid_data_size;
-	uint8_t 	_reserved3[4];
-	uint32_t 	firstc;
-	uint64_t 	data_size;
-} __attribute__((packed)) exfat_stream_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint16_t 	name[EXFAT_NAME_PART_LEN];
-} __attribute__((packed)) exfat_name_dentry_t;
-
-typedef struct {
-	uint8_t type;
-	union {
-		exfat_vollabel_dentry_t	vollabel;
-		exfat_bitmap_dentry_t 	bitmap;
-		exfat_uctable_dentry_t 	uctable;
-		exfat_guid_dentry_t 	guid;
-		exfat_file_dentry_t 	file;
-		exfat_stream_dentry_t 	stream;
-		exfat_name_dentry_t 	name;
-	};
-} __attribute__((packed)) exfat_dentry_t;
-
-typedef enum {
-	EXFAT_DENTRY_SKIP,
-	EXFAT_DENTRY_LAST,
-	EXFAT_DENTRY_FREE,
-	EXFAT_DENTRY_VOLLABEL,
-	EXFAT_DENTRY_BITMAP,
-	EXFAT_DENTRY_UCTABLE,
-	EXFAT_DENTRY_GUID,
-	EXFAT_DENTRY_FILE,
-	EXFAT_DENTRY_STREAM,
-	EXFAT_DENTRY_NAME
-} exfat_dentry_clsf_t;
-
-typedef struct exfat_bs {
-	uint8_t jump[3];            /* 0x00 jmp and nop instructions */
-	uint8_t oem_name[8];        /* 0x03 "EXFAT   " */
-	uint8_t	__reserved[53];     /* 0x0B always 0 */
-	uint64_t volume_start;      /* 0x40 partition first sector */
-	uint64_t volume_count;      /* 0x48 partition sectors count */
-	uint32_t fat_sector_start;  /* 0x50 FAT first sector */
-	uint32_t fat_sector_count;  /* 0x54 FAT sectors count */
-	uint32_t data_start_sector; /* 0x58 Data region first cluster sector */
-	uint32_t data_clusters;     /* 0x5C total clusters count */
-	uint32_t rootdir_cluster;   /* 0x60 first cluster of the root dir */
-	uint32_t volume_serial;     /* 0x64 volume serial number */
-	struct {                    /* 0x68 FS version */
-		uint8_t minor;
-		uint8_t major;
-	} __attribute__((packed)) version;
-	uint16_t volume_flags;     /* 0x6A volume state flags */
-	uint8_t bytes_per_sector;  /* 0x6C sector size as (1 << n) */
-	uint8_t sec_per_cluster;   /* 0x6D sectors per cluster as (1 << n) */
-	uint8_t fat_count;         /* 0x6E always 1 */
-	uint8_t drive_no;          /* 0x6F always 0x80 */
-	uint8_t allocated_percent; /* 0x70 percentage of allocated space */
-	uint8_t _reserved2[7];     /* 0x71 reserved */
-	uint8_t bootcode[390];     /* Boot code */
-	uint16_t signature;        /* the value of 0xAA55 */
-} __attribute__((__packed__)) exfat_bs_t;
-
-/**
- * @}
- */
Index: pace/app/mkexfat/meson.build
===================================================================
--- uspace/app/mkexfat/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2012 Maurizio Lombardi
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block' ]
-src = files('mkexfat.c')
Index: pace/app/mkexfat/mkexfat.c
===================================================================
--- uspace/app/mkexfat/mkexfat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1006 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkexfat
- * @{
- */
-
-/**
- * @file	mkexfat.c
- * @brief	Tool for creating new exFAT file systems.
- *
- */
-
-#include <stdio.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <block.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <byteorder.h>
-#include <align.h>
-#include <rndgen.h>
-#include <str.h>
-#include <getopt.h>
-#include <macros.h>
-#include "exfat.h"
-#include "upcase.h"
-
-#define NAME    "mkexfat"
-
-/** First sector of the FAT */
-#define FAT_SECTOR_START 128
-
-/** First sector of the Main Extended Boot Region */
-#define EBS_SECTOR_START 1
-
-/** First sector of the Main Extended Boot Region Backup */
-#define EBS_BACKUP_SECTOR_START 13
-
-/** First sector of the Main Boot Sector */
-#define MBS_SECTOR 0
-
-/** First sector of the Main Boot Sector Backup */
-#define MBS_BACKUP_SECTOR 12
-
-/** VBR Checksum sector */
-#define VBR_CHECKSUM_SECTOR 11
-
-/** VBR Backup Checksum sector */
-#define VBR_BACKUP_CHECKSUM_SECTOR 23
-
-/** Size of the Main Extended Boot Region */
-#define EBS_SIZE 8
-
-/** Divide and round up. */
-#define div_round_up(a, b) (((a) + (b) - 1) / (b))
-
-/** The default size of each cluster is 4096 byte */
-#define DEFAULT_CLUSTER_SIZE 4096
-
-/** Index of the first free cluster on the device */
-#define FIRST_FREE_CLUSTER   2
-
-typedef struct exfat_cfg {
-	aoff64_t volume_start;
-	aoff64_t volume_count;
-	unsigned long fat_sector_count;
-	unsigned long data_start_sector;
-	unsigned long rootdir_cluster;
-	unsigned long upcase_table_cluster;
-	unsigned long bitmap_cluster;
-	unsigned long total_clusters;
-	unsigned long allocated_clusters;
-	size_t   bitmap_size;
-	size_t   sector_size;
-	size_t   cluster_size;
-	const char *label;
-} exfat_cfg_t;
-
-static unsigned log2i(unsigned n);
-
-static uint32_t
-vbr_checksum_start(void const *octets, size_t nbytes);
-
-static void
-vbr_checksum_update(void const *octets, size_t nbytes, uint32_t *checksum);
-
-static errno_t
-ebs_write(service_id_t service_id, exfat_cfg_t *cfg,
-    int base, uint32_t *chksum);
-
-static errno_t
-bitmap_write(service_id_t service_id, exfat_cfg_t *cfg);
-
-static uint32_t
-upcase_table_checksum(void const *data, size_t nbytes);
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "cluster-size", required_argument, 0, 'c' },
-	{ "fs-size", required_argument, 0, 's' },
-	{ "label", required_argument, 0, 'L' },
-};
-
-static void usage(void)
-{
-	printf("Usage: mkexfat [options] <device>\n"
-	    "-c, --cluster-size ## Specify the cluster size (Kb)\n"
-	    "-s, --fs-size ##      Specify the filesystem size (sectors)\n"
-	    "    --label ##        Volume label\n");
-}
-
-/** Initialize the exFAT params structure.
- *
- * @param cfg Pointer to the exFAT params structure to initialize.
- */
-static void
-cfg_params_initialize(exfat_cfg_t *cfg)
-{
-	unsigned long fat_bytes;
-	unsigned long fat_cls;
-	aoff64_t const volume_bytes = (cfg->volume_count - FAT_SECTOR_START) *
-	    cfg->sector_size;
-
-	if (cfg->cluster_size != 0) {
-		/* The user already choose the cluster size he wants */
-		cfg->total_clusters = volume_bytes / cfg->cluster_size;
-		goto skip_cluster_size_set;
-	}
-
-	cfg->total_clusters = volume_bytes / DEFAULT_CLUSTER_SIZE;
-	cfg->cluster_size = DEFAULT_CLUSTER_SIZE;
-
-	/*
-	 * Compute the required cluster size to index
-	 * the entire storage device and to keep the FAT
-	 * size less or equal to 64 Mb.
-	 */
-	while (cfg->total_clusters > 16000000ULL &&
-	    (cfg->cluster_size < 32 * 1024 * 1024)) {
-
-		cfg->cluster_size <<= 1;
-		cfg->total_clusters = volume_bytes / cfg->cluster_size;
-	}
-
-skip_cluster_size_set:
-
-	/* Compute the FAT size in sectors */
-	fat_bytes = (cfg->total_clusters + 3) * sizeof(uint32_t);
-	cfg->fat_sector_count = div_round_up(fat_bytes, cfg->sector_size);
-
-	/* Compute the number of the first data sector */
-	cfg->data_start_sector = ROUND_UP(FAT_SECTOR_START +
-	    cfg->fat_sector_count, cfg->cluster_size / cfg->sector_size);
-
-	/*
-	 * Subtract the FAT space from the total
-	 * number of available clusters.
-	 */
-	fat_cls = div_round_up((cfg->data_start_sector -
-	    FAT_SECTOR_START) * cfg->sector_size,
-	    cfg->cluster_size);
-	if (fat_cls >= cfg->total_clusters) {
-		/* Insufficient disk space on device */
-		cfg->total_clusters = 0;
-		return;
-	}
-	cfg->total_clusters -= fat_cls;
-
-	/* Compute the bitmap size */
-	cfg->bitmap_size = div_round_up(cfg->total_clusters, 8);
-
-	/* Compute the number of clusters reserved to the bitmap */
-	cfg->allocated_clusters = div_round_up(cfg->bitmap_size,
-	    cfg->cluster_size);
-
-	/* This account for the root directory */
-	cfg->allocated_clusters++;
-
-	/* Compute the number of clusters reserved to the upcase table */
-	cfg->allocated_clusters += div_round_up(sizeof(upcase_table),
-	    cfg->cluster_size);
-
-	/* Will be set later */
-	cfg->rootdir_cluster = 0;
-
-	/* Bitmap always starts at the first free cluster */
-	cfg->bitmap_cluster = FIRST_FREE_CLUSTER;
-
-	/* The first sector of the partition is zero */
-	cfg->volume_start = 0;
-}
-
-/** Prints the exFAT structure values
- *
- * @param cfg Pointer to the exfat_cfg_t structure.
- */
-static void
-cfg_print_info(exfat_cfg_t *cfg)
-{
-	printf("Sector size:           %lu\n",
-	    (unsigned long) cfg->sector_size);
-	printf("Cluster size:          %lu\n",
-	    (unsigned long) cfg->cluster_size);
-	printf("FAT size in sectors:   %lu\n", cfg->fat_sector_count);
-	printf("Data start sector:     %lu\n", cfg->data_start_sector);
-	printf("Total num of clusters: %lu\n", cfg->total_clusters);
-	printf("Total used clusters:   %lu\n", cfg->allocated_clusters);
-	printf("Bitmap size:           %lu\n", (unsigned long)
-	    div_round_up(cfg->bitmap_size, cfg->cluster_size));
-	printf("Upcase table size:     %lu\n", (unsigned long)
-	    div_round_up(sizeof(upcase_table), cfg->cluster_size));
-}
-
-/** Initialize the Main Boot Sector fields.
- *
- * @param mbs Pointer to the Main Boot Sector structure.
- * @param cfg Pointer to the exFAT configuration structure.
- * @param chksum Place to store initial checksum value.
- * @return EOK on success or error code
- */
-static uint32_t
-vbr_initialize(exfat_bs_t *mbs, exfat_cfg_t *cfg, uint32_t *chksum)
-{
-	rndgen_t *rndgen;
-	errno_t rc;
-	uint32_t vsn;
-
-	/* Generate volume serial number */
-
-	rc = rndgen_create(&rndgen);
-	if (rc != EOK)
-		return rc;
-
-	rc = rndgen_uint32(rndgen, &vsn);
-	if (rc != EOK) {
-		rndgen_destroy(rndgen);
-		return rc;
-	}
-
-	rndgen_destroy(rndgen);
-
-	/* Fill the structure with zeroes */
-	memset(mbs, 0, sizeof(exfat_bs_t));
-
-	/* Init Jump Boot section */
-	mbs->jump[0] = 0xEB;
-	mbs->jump[1] = 0x76;
-	mbs->jump[2] = 0x90;
-
-	/* Set the filesystem name */
-	memcpy(mbs->oem_name, "EXFAT   ", sizeof(mbs->oem_name));
-
-	mbs->volume_start = host2uint64_t_le(cfg->volume_start);
-	mbs->volume_count = host2uint64_t_le(cfg->volume_count);
-	mbs->fat_sector_start = host2uint32_t_le(FAT_SECTOR_START);
-	mbs->fat_sector_count = host2uint32_t_le(cfg->fat_sector_count);
-	mbs->data_start_sector = host2uint32_t_le(cfg->data_start_sector);
-
-	mbs->data_clusters = host2uint32_t_le(cfg->total_clusters);
-
-	mbs->rootdir_cluster = host2uint32_t_le(cfg->rootdir_cluster);
-	mbs->volume_serial = host2uint32_t_le(vsn);
-	mbs->version.major = 1;
-	mbs->version.minor = 0;
-	mbs->volume_flags = host2uint16_t_le(0);
-	mbs->bytes_per_sector = log2i(cfg->sector_size);
-	mbs->sec_per_cluster = log2i(cfg->cluster_size / cfg->sector_size);
-
-	/* Maximum cluster size is 32 Mb */
-	assert((mbs->bytes_per_sector + mbs->sec_per_cluster) <= 25);
-
-	mbs->fat_count = 1;
-	mbs->drive_no = 0x80;
-	mbs->allocated_percent = 0;
-	mbs->signature = host2uint16_t_le(0xAA55);
-
-	*chksum = vbr_checksum_start(mbs, sizeof(exfat_bs_t));
-	return EOK;
-}
-
-static errno_t
-bootsec_write(service_id_t service_id, exfat_cfg_t *cfg)
-{
-	exfat_bs_t mbs;
-	uint32_t vbr_checksum;
-	uint32_t *chksum_sector;
-	errno_t rc;
-	unsigned idx;
-
-	chksum_sector = calloc(cfg->sector_size, sizeof(uint8_t));
-	if (!chksum_sector)
-		return ENOMEM;
-
-	rc = vbr_initialize(&mbs, cfg, &vbr_checksum);
-	if (rc != EOK)
-		goto exit;
-
-	/* Write the Main Boot Sector to disk */
-	rc = block_write_direct(service_id, MBS_SECTOR, 1, &mbs);
-	if (rc != EOK)
-		goto exit;
-
-	/* Write the Main extended boot sectors to disk */
-	rc = ebs_write(service_id, cfg, EBS_SECTOR_START, &vbr_checksum);
-	if (rc != EOK)
-		goto exit;
-
-	/* Write the Main Boot Sector backup to disk */
-	rc = block_write_direct(service_id, MBS_BACKUP_SECTOR, 1, &mbs);
-	if (rc != EOK)
-		goto exit;
-
-	/* Initialize the checksum sectors */
-	for (idx = 0; idx < cfg->sector_size / sizeof(uint32_t); ++idx)
-		chksum_sector[idx] = host2uint32_t_le(vbr_checksum);
-
-	/* Write the main checksum sector to disk */
-	rc = block_write_direct(service_id,
-	    VBR_CHECKSUM_SECTOR, 1, chksum_sector);
-	if (rc != EOK)
-		goto exit;
-
-	/* Write the backup checksum sector to disk */
-	rc = block_write_direct(service_id,
-	    VBR_BACKUP_CHECKSUM_SECTOR, 1, chksum_sector);
-	if (rc != EOK)
-		goto exit;
-
-	/* Write the Main extended boot sectors backup to disk */
-	rc = ebs_write(service_id, cfg,
-	    EBS_BACKUP_SECTOR_START, &vbr_checksum);
-
-exit:
-	free(chksum_sector);
-	return rc;
-}
-
-/** Write the Main Extended Boot Sector to disk
- *
- * @param service_id  The service id.
- * @param cfg  Pointer to the exFAT configuration structure.
- * @param base Base sector of the EBS.
- * @return  EOK on success or an error code.
- */
-static errno_t
-ebs_write(service_id_t service_id, exfat_cfg_t *cfg, int base,
-    uint32_t *chksum)
-{
-	uint32_t *ebs = calloc(cfg->sector_size, sizeof(uint8_t));
-	int i;
-	errno_t rc;
-
-	if (!ebs)
-		return ENOMEM;
-
-	ebs[cfg->sector_size / 4 - 1] = host2uint32_t_le(0xAA550000);
-
-	for (i = 0; i < EBS_SIZE; ++i) {
-		vbr_checksum_update(ebs, cfg->sector_size, chksum);
-
-		rc = block_write_direct(service_id,
-		    i + base, 1, ebs);
-
-		if (rc != EOK)
-			goto exit;
-	}
-
-	/*
-	 * The OEM record is not yet used
-	 * by the official exFAT implementation, we'll fill
-	 * it with zeroes.
-	 */
-
-	memset(ebs, 0, cfg->sector_size);
-	vbr_checksum_update(ebs, cfg->sector_size, chksum);
-
-	rc = block_write_direct(service_id, i++ + base, 1, ebs);
-	if (rc != EOK)
-		goto exit;
-
-	/* The next sector is reserved, fill it with zeroes too */
-	vbr_checksum_update(ebs, cfg->sector_size, chksum);
-
-	rc = block_write_direct(service_id, i + base, 1, ebs);
-	if (rc != EOK)
-		goto exit;
-
-exit:
-	free(ebs);
-	return rc;
-}
-
-/** Initialize the FAT table.
- *
- * @param service_id  The service id.
- * @param cfg Pointer to the exfat_cfg structure.
- * @return EOK on success or an error code.
- */
-static errno_t
-fat_initialize(service_id_t service_id, exfat_cfg_t *cfg)
-{
-	unsigned long i;
-	uint32_t *pfat;
-	errno_t rc;
-
-	pfat = calloc(cfg->sector_size, 1);
-	if (!pfat)
-		return ENOMEM;
-
-	pfat[0] = host2uint32_t_le(0xFFFFFFF8);
-	pfat[1] = host2uint32_t_le(0xFFFFFFFF);
-
-	rc = block_write_direct(service_id, FAT_SECTOR_START, 1, pfat);
-	if (rc != EOK)
-		goto error;
-
-	pfat[0] = pfat[1] = 0;
-
-	for (i = 1; i < cfg->fat_sector_count; ++i) {
-		rc = block_write_direct(service_id,
-		    FAT_SECTOR_START + i, 1, pfat);
-		if (rc != EOK)
-			goto error;
-	}
-
-error:
-	free(pfat);
-	return rc;
-}
-
-/** Allocate a given number of clusters and create a cluster chain.
- *
- * @param service_id  The service id.
- * @param cfg  Pointer to the exfat configuration structure.
- * @param cur_cls  Cluster index from where to start the allocation.
- * @param ncls  Number of clusters to allocate.
- * @return EOK on success or an error code.
- */
-static errno_t
-fat_allocate_clusters(service_id_t service_id, exfat_cfg_t *cfg,
-    uint32_t cur_cls, unsigned long ncls)
-{
-	errno_t rc;
-	unsigned const fat_entries = cfg->sector_size / sizeof(uint32_t);
-	aoff64_t fat_sec = cur_cls / fat_entries + FAT_SECTOR_START;
-	uint32_t *fat;
-	uint32_t next_cls = cur_cls;
-
-	cur_cls %= fat_entries;
-
-	fat = malloc(cfg->sector_size);
-	if (!fat)
-		return ENOMEM;
-
-loop:
-	rc = block_read_direct(service_id, fat_sec, 1, fat);
-	if (rc != EOK)
-		goto exit;
-
-	assert(fat[cur_cls] == 0);
-	assert(ncls > 0);
-
-	for (; cur_cls < fat_entries && ncls > 1; ++cur_cls, --ncls)
-		fat[cur_cls] = host2uint32_t_le(++next_cls);
-
-	if (cur_cls == fat_entries) {
-		/*
-		 * This sector is full, there are no more free entries,
-		 * commit the changes to disk and restart from the next
-		 * sector.
-		 */
-		rc = block_write_direct(service_id, fat_sec++, 1, fat);
-		if (rc != EOK)
-			goto exit;
-		cur_cls = 0;
-		goto loop;
-	} else if (ncls == 1) {
-		/*
-		 * This is the last cluster of this chain, mark it
-		 * with EOF.
-		 */
-		fat[cur_cls] = host2uint32_t_le(0xFFFFFFFF);
-	}
-
-	rc = block_write_direct(service_id, fat_sec, 1, fat);
-
-exit:
-	free(fat);
-	return rc;
-}
-
-/** Initialize the allocation bitmap.
- *
- * @param service_id   The service id.
- * @param cfg  Pointer to the exfat configuration structure.
- * @return  EOK on success or an error code.
- */
-static errno_t
-bitmap_write(service_id_t service_id, exfat_cfg_t *cfg)
-{
-	unsigned long i, sec;
-	unsigned long allocated_cls;
-	errno_t rc = EOK;
-	bool need_reset = true;
-
-	/* Bitmap size in sectors */
-	size_t const bss = div_round_up(cfg->bitmap_size, cfg->sector_size);
-
-	uint8_t *bitmap = malloc(cfg->sector_size);
-	if (!bitmap)
-		return ENOMEM;
-
-	allocated_cls = cfg->allocated_clusters;
-
-	for (sec = 0; sec < bss; ++sec) {
-		if (need_reset) {
-			need_reset = false;
-			memset(bitmap, 0, cfg->sector_size);
-		}
-		if (allocated_cls > 0) {
-			for (i = 0; i < allocated_cls; ++i) {
-				unsigned byte_idx = i / 8;
-				unsigned bit_idx = i % 8;
-
-				if (byte_idx == cfg->sector_size)
-					break;
-				bitmap[byte_idx] |= 1 << bit_idx;
-			}
-
-			allocated_cls -= i;
-			need_reset = true;
-		}
-
-		rc = block_write_direct(service_id,
-		    cfg->data_start_sector + sec, 1, bitmap);
-		if (rc != EOK)
-			goto exit;
-	}
-
-exit:
-	free(bitmap);
-	return rc;
-}
-
-/** Write the upcase table to disk. */
-static errno_t
-upcase_table_write(service_id_t service_id, exfat_cfg_t *cfg)
-{
-	errno_t rc = EOK;
-	aoff64_t start_sec, nsecs, i;
-	uint8_t *table_ptr;
-	uint8_t *buf;
-	size_t table_size = sizeof(upcase_table);
-
-	buf = malloc(cfg->sector_size);
-	if (!buf)
-		return ENOENT;
-
-	/* Compute the start sector of the upcase table */
-	start_sec = cfg->data_start_sector;
-	start_sec += ((cfg->upcase_table_cluster - 2) * cfg->cluster_size) /
-	    cfg->sector_size;
-
-	/* Compute the number of sectors needed to store the table on disk */
-	nsecs = div_round_up(sizeof(upcase_table), cfg->sector_size);
-	table_ptr = (uint8_t *) upcase_table;
-
-	for (i = 0; i < nsecs; ++i,
-	    table_ptr += min(table_size, cfg->sector_size),
-	    table_size -= cfg->sector_size) {
-
-		if (table_size < cfg->sector_size) {
-			/*
-			 * Reset the content of the unused part
-			 * of the last sector.
-			 */
-			memset(buf, 0, cfg->sector_size);
-		}
-		memcpy(buf, table_ptr, min(table_size, cfg->sector_size));
-
-		rc = block_write_direct(service_id,
-		    start_sec + i, 1, buf);
-		if (rc != EOK)
-			goto exit;
-	}
-
-exit:
-	free(buf);
-	return rc;
-}
-
-/** Initialize and write the root directory entries to disk.
- *
- * @param service_id   The service id.
- * @param cfg   Pointer to the exFAT configuration structure.
- * @return   EOK on success or an error code.
- */
-static errno_t
-root_dentries_write(service_id_t service_id, exfat_cfg_t *cfg)
-{
-	exfat_dentry_t *d;
-	aoff64_t rootdir_sec;
-	uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1];
-	errno_t rc;
-	uint8_t *data;
-	unsigned long i;
-
-	data = calloc(cfg->sector_size, 1);
-	if (!data)
-		return ENOMEM;
-
-	d = (exfat_dentry_t *) data;
-
-	/* Initialize the volume label dentry */
-
-	if (cfg->label != NULL) {
-		memset(wlabel, 0, (EXFAT_VOLLABEL_LEN + 1) * sizeof(uint16_t));
-		rc = str_to_utf16(wlabel, EXFAT_VOLLABEL_LEN + 1, cfg->label);
-		if (rc != EOK) {
-			rc = EINVAL;
-			goto exit;
-		}
-
-		d->type = EXFAT_TYPE_VOLLABEL;
-		memcpy(d->vollabel.label, wlabel, EXFAT_VOLLABEL_LEN * 2);
-		d->vollabel.size = utf16_wsize(wlabel);
-		assert(d->vollabel.size <= EXFAT_VOLLABEL_LEN);
-
-		d++;
-	} else {
-		d->type = EXFAT_TYPE_VOLLABEL & ~EXFAT_TYPE_USED;
-	}
-
-	/* Initialize the allocation bitmap dentry */
-	d->type = EXFAT_TYPE_BITMAP;
-	d->bitmap.flags = 0; /* First FAT */
-	d->bitmap.firstc = host2uint32_t_le(cfg->bitmap_cluster);
-	d->bitmap.size = host2uint64_t_le(cfg->bitmap_size);
-
-	d++;
-
-	/* Initialize the upcase table dentry */
-	d->type = EXFAT_TYPE_UCTABLE;
-	d->uctable.checksum = host2uint32_t_le(upcase_table_checksum(
-	    upcase_table, sizeof(upcase_table)));
-	d->uctable.firstc = host2uint32_t_le(cfg->upcase_table_cluster);
-	d->uctable.size = host2uint64_t_le(sizeof(upcase_table));
-
-	/* Compute the number of the sector where the rootdir resides */
-
-	rootdir_sec = cfg->data_start_sector;
-	rootdir_sec += ((cfg->rootdir_cluster - 2) * cfg->cluster_size) /
-	    cfg->sector_size;
-
-	rc = block_write_direct(service_id, rootdir_sec, 1, data);
-	if (rc != EOK)
-		goto exit;
-
-	/*
-	 * Fill the content of the sectors not used by the
-	 * root directory with zeroes.
-	 */
-	memset(data, 0, cfg->sector_size);
-	for (i = 1; i < cfg->cluster_size / cfg->sector_size; ++i) {
-		rc = block_write_direct(service_id, rootdir_sec + i, 1, data);
-		if (rc != EOK)
-			goto exit;
-	}
-
-exit:
-	free(data);
-	return rc;
-}
-
-/** Given a number (n), returns the result of log2(n).
- *
- * It works only if n is a power of two.
- */
-static unsigned
-log2i(unsigned n)
-{
-	unsigned r;
-
-	r = 0;
-	while (n >> r != 1)
-		++r;
-
-	return r;
-}
-
-/** Initialize the VBR checksum calculation */
-static uint32_t
-vbr_checksum_start(void const *data, size_t nbytes)
-{
-	uint32_t checksum = 0;
-	size_t index;
-	uint8_t const *octets = (uint8_t *) data;
-
-	for (index = 0; index < nbytes; ++index) {
-		if (index == 106 || index == 107 || index == 112) {
-			/* Skip volume_flags and allocated_percent fields */
-			continue;
-		}
-
-		checksum = ((checksum << 31) | (checksum >> 1)) +
-		    octets[index];
-	}
-
-	return checksum;
-}
-
-/** Update the VBR checksum */
-static void
-vbr_checksum_update(void const *data, size_t nbytes, uint32_t *checksum)
-{
-	size_t index;
-	uint8_t const *octets = (uint8_t *) data;
-
-	for (index = 0; index < nbytes; ++index) {
-		*checksum = ((*checksum << 31) | (*checksum >> 1)) +
-		    octets[index];
-	}
-}
-
-/** Compute the checksum of the upcase table.
- *
- * @param data   Pointer to the upcase table.
- * @param nbytes size of the upcase table in bytes.
- * @return   Checksum value.
- */
-static uint32_t
-upcase_table_checksum(void const *data, size_t nbytes)
-{
-	size_t index;
-	uint32_t chksum = 0;
-	uint8_t const *octets = (uint8_t *) data;
-
-	for (index = 0; index < nbytes; ++index)
-		chksum = ((chksum << 31) | (chksum >> 1)) + octets[index];
-
-	return chksum;
-}
-
-/** Check if a given number is a power of two.
- *
- * @param n   The number to check.
- * @return    true if n is a power of two, false otherwise.
- */
-static bool
-is_power_of_two(unsigned long n)
-{
-	if (n == 0)
-		return false;
-
-	return (n & (n - 1)) == 0;
-}
-
-int main (int argc, char **argv)
-{
-	exfat_cfg_t cfg;
-	uint32_t next_cls;
-	char *dev_path;
-	service_id_t service_id;
-	errno_t rc;
-	int c, opt_ind;
-	aoff64_t user_fs_size = 0;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing\n");
-		usage();
-		return 1;
-	}
-
-	cfg.cluster_size = 0;
-	cfg.label = NULL;
-
-	c = 0;
-	optind = 0;
-	opt_ind = 0;
-	while (c != -1) {
-		c = getopt_long(argc, argv, "hs:c:L:",
-		    long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			usage();
-			return 0;
-		case 's':
-			user_fs_size = (aoff64_t) strtol(optarg, NULL, 10);
-			break;
-
-		case 'c':
-			cfg.cluster_size = strtol(optarg, NULL, 10) * 1024;
-			if (cfg.cluster_size < 4096) {
-				printf(NAME ": Error, cluster size can't"
-				    " be less than 4096 byte.\n");
-				return 1;
-			} else if (cfg.cluster_size > 32 * 1024 * 1024) {
-				printf(NAME ": Error, cluster size can't"
-				    " be greater than 32 Mb");
-				return 1;
-			}
-
-			if (!is_power_of_two(cfg.cluster_size)) {
-				printf(NAME ": Error, the size of the cluster"
-				    " must be a power of two.\n");
-				return 1;
-			}
-			break;
-		case 'L':
-			cfg.label = optarg;
-			break;
-		}
-	}
-
-	argv += optind;
-	dev_path = *argv;
-
-	if (!dev_path) {
-		printf(NAME ": Error, you must specify a valid block"
-		    " device.\n");
-		usage();
-		return 1;
-	}
-
-	printf("Device = %s\n", dev_path);
-
-	rc = loc_service_get_id(dev_path, &service_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device `%s'.\n", dev_path);
-		return 2;
-	}
-
-	rc = block_init(service_id);
-	if (rc != EOK) {
-		printf(NAME ": Error initializing libblock.\n");
-		return 2;
-	}
-
-	rc = block_get_bsize(service_id, &cfg.sector_size);
-	if (rc != EOK) {
-		printf(NAME ": Error determining device sector size.\n");
-		return 2;
-	}
-
-	user_fs_size *= cfg.sector_size;
-	if (user_fs_size > 0 && user_fs_size < 1024 * 1024) {
-		printf(NAME ": Error, fs size can't be less"
-		    " than 1 Mb.\n");
-		return 1;
-	}
-
-	if (cfg.sector_size > 4096) {
-		printf(NAME ": Error, sector size can't be greater"
-		    " than 4096 bytes.\n");
-		return 2;
-	}
-
-	rc = block_get_nblocks(service_id, &cfg.volume_count);
-	if (rc != EOK) {
-		printf(NAME ": Warning, failed to obtain"
-		    " block device size.\n");
-
-		if (user_fs_size == 0) {
-			printf(NAME ": You must specify the"
-			    " filesystem size.\n");
-			return 1;
-		}
-	} else {
-		printf("Block device has %" PRIuOFF64 " blocks.\n",
-		    cfg.volume_count);
-	}
-
-	if (user_fs_size != 0) {
-		if (user_fs_size > cfg.volume_count * cfg.sector_size) {
-			printf(NAME ": Error, the device is not big enough"
-			    " to create a filesystem of"
-			    " the specified size.\n");
-			return 1;
-		}
-
-		cfg.volume_count = user_fs_size / cfg.sector_size;
-	}
-
-	cfg_params_initialize(&cfg);
-	cfg_print_info(&cfg);
-
-	if (cfg.total_clusters <= cfg.allocated_clusters + 2) {
-		printf(NAME ": Error, insufficient disk space on device.\n");
-		return 2;
-	}
-
-	printf("Writing the allocation table.\n");
-
-	/* Initialize the FAT table */
-	rc = fat_initialize(service_id, &cfg);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to write the FAT to disk\n");
-		return 2;
-	}
-
-	/* Allocate clusters for the bitmap */
-	rc = fat_allocate_clusters(service_id, &cfg, cfg.bitmap_cluster,
-	    div_round_up(cfg.bitmap_size, cfg.cluster_size));
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to allocate"
-		    " clusters for bitmap.\n");
-		return 2;
-	}
-
-	next_cls = cfg.bitmap_cluster +
-	    div_round_up(cfg.bitmap_size, cfg.cluster_size);
-	cfg.upcase_table_cluster = next_cls;
-
-	/* Allocate clusters for the upcase table */
-	rc = fat_allocate_clusters(service_id, &cfg, next_cls,
-	    div_round_up(sizeof(upcase_table), cfg.cluster_size));
-	if (rc != EOK) {
-		printf(NAME ":Error, failed to allocate clusters"
-		    " for the upcase table.\n");
-		return 2;
-	}
-
-	next_cls += div_round_up(sizeof(upcase_table), cfg.cluster_size);
-	cfg.rootdir_cluster = next_cls;
-
-	/* Allocate a cluster for the root directory entry */
-	rc = fat_allocate_clusters(service_id, &cfg, next_cls, 1);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to allocate cluster"
-		    " for the root dentry.\n");
-		return 2;
-	}
-
-	printf("Writing the allocation bitmap.\n");
-
-	/* Write the allocation bitmap to disk */
-	rc = bitmap_write(service_id, &cfg);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to write the allocation"
-		    " bitmap to disk.\n");
-		return 2;
-	}
-
-	printf("Writing the upcase table.\n");
-
-	/* Write the upcase table to disk */
-	rc = upcase_table_write(service_id, &cfg);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to write the"
-		    " upcase table to disk.\n");
-		return 2;
-	}
-
-	printf("Writing the root directory.\n");
-
-	rc = root_dentries_write(service_id, &cfg);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to write the root directory"
-		    " entries to disk.\n");
-		return 2;
-	}
-
-	printf("Writing the boot sectors.\n");
-
-	rc = bootsec_write(service_id, &cfg);
-	if (rc != EOK) {
-		printf(NAME ": Error, failed to write the VBR to disk\n");
-		return 2;
-	}
-
-	printf("Success.\n");
-
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/app/mkexfat/upcase.h
===================================================================
--- uspace/app/mkexfat/upcase.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2962 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkexfat
- * @{
- */
-
-#ifndef _UPCASE_H_
-#define _UPCASE_H_
-
-/** Up-case unicode table */
-static uint8_t const upcase_table[] = {
-	0x00, 0x00,
-	0x01, 0x00,
-	0x02, 0x00,
-	0x03, 0x00,
-	0x04, 0x00,
-	0x05, 0x00,
-	0x06, 0x00,
-	0x07, 0x00,
-	0x08, 0x00,
-	0x09, 0x00,
-	0x0a, 0x00,
-	0x0b, 0x00,
-	0x0c, 0x00,
-	0x0d, 0x00,
-	0x0e, 0x00,
-	0x0f, 0x00,
-	0x10, 0x00,
-	0x11, 0x00,
-	0x12, 0x00,
-	0x13, 0x00,
-	0x14, 0x00,
-	0x15, 0x00,
-	0x16, 0x00,
-	0x17, 0x00,
-	0x18, 0x00,
-	0x19, 0x00,
-	0x1a, 0x00,
-	0x1b, 0x00,
-	0x1c, 0x00,
-	0x1d, 0x00,
-	0x1e, 0x00,
-	0x1f, 0x00,
-	0x20, 0x00,
-	0x21, 0x00,
-	0x22, 0x00,
-	0x23, 0x00,
-	0x24, 0x00,
-	0x25, 0x00,
-	0x26, 0x00,
-	0x27, 0x00,
-	0x28, 0x00,
-	0x29, 0x00,
-	0x2a, 0x00,
-	0x2b, 0x00,
-	0x2c, 0x00,
-	0x2d, 0x00,
-	0x2e, 0x00,
-	0x2f, 0x00,
-	0x30, 0x00,
-	0x31, 0x00,
-	0x32, 0x00,
-	0x33, 0x00,
-	0x34, 0x00,
-	0x35, 0x00,
-	0x36, 0x00,
-	0x37, 0x00,
-	0x38, 0x00,
-	0x39, 0x00,
-	0x3a, 0x00,
-	0x3b, 0x00,
-	0x3c, 0x00,
-	0x3d, 0x00,
-	0x3e, 0x00,
-	0x3f, 0x00,
-	0x40, 0x00,
-	0x41, 0x00,
-	0x42, 0x00,
-	0x43, 0x00,
-	0x44, 0x00,
-	0x45, 0x00,
-	0x46, 0x00,
-	0x47, 0x00,
-	0x48, 0x00,
-	0x49, 0x00,
-	0x4a, 0x00,
-	0x4b, 0x00,
-	0x4c, 0x00,
-	0x4d, 0x00,
-	0x4e, 0x00,
-	0x4f, 0x00,
-	0x50, 0x00,
-	0x51, 0x00,
-	0x52, 0x00,
-	0x53, 0x00,
-	0x54, 0x00,
-	0x55, 0x00,
-	0x56, 0x00,
-	0x57, 0x00,
-	0x58, 0x00,
-	0x59, 0x00,
-	0x5a, 0x00,
-	0x5b, 0x00,
-	0x5c, 0x00,
-	0x5d, 0x00,
-	0x5e, 0x00,
-	0x5f, 0x00,
-	0x60, 0x00,
-	0x41, 0x00,
-	0x42, 0x00,
-	0x43, 0x00,
-	0x44, 0x00,
-	0x45, 0x00,
-	0x46, 0x00,
-	0x47, 0x00,
-	0x48, 0x00,
-	0x49, 0x00,
-	0x4a, 0x00,
-	0x4b, 0x00,
-	0x4c, 0x00,
-	0x4d, 0x00,
-	0x4e, 0x00,
-	0x4f, 0x00,
-	0x50, 0x00,
-	0x51, 0x00,
-	0x52, 0x00,
-	0x53, 0x00,
-	0x54, 0x00,
-	0x55, 0x00,
-	0x56, 0x00,
-	0x57, 0x00,
-	0x58, 0x00,
-	0x59, 0x00,
-	0x5a, 0x00,
-	0x7b, 0x00,
-	0x7c, 0x00,
-	0x7d, 0x00,
-	0x7e, 0x00,
-	0x7f, 0x00,
-	0x80, 0x00,
-	0x81, 0x00,
-	0x82, 0x00,
-	0x83, 0x00,
-	0x84, 0x00,
-	0x85, 0x00,
-	0x86, 0x00,
-	0x87, 0x00,
-	0x88, 0x00,
-	0x89, 0x00,
-	0x8a, 0x00,
-	0x8b, 0x00,
-	0x8c, 0x00,
-	0x8d, 0x00,
-	0x8e, 0x00,
-	0x8f, 0x00,
-	0x90, 0x00,
-	0x91, 0x00,
-	0x92, 0x00,
-	0x93, 0x00,
-	0x94, 0x00,
-	0x95, 0x00,
-	0x96, 0x00,
-	0x97, 0x00,
-	0x98, 0x00,
-	0x99, 0x00,
-	0x9a, 0x00,
-	0x9b, 0x00,
-	0x9c, 0x00,
-	0x9d, 0x00,
-	0x9e, 0x00,
-	0x9f, 0x00,
-	0xa0, 0x00,
-	0xa1, 0x00,
-	0xa2, 0x00,
-	0xa3, 0x00,
-	0xa4, 0x00,
-	0xa5, 0x00,
-	0xa6, 0x00,
-	0xa7, 0x00,
-	0xa8, 0x00,
-	0xa9, 0x00,
-	0xaa, 0x00,
-	0xab, 0x00,
-	0xac, 0x00,
-	0xad, 0x00,
-	0xae, 0x00,
-	0xaf, 0x00,
-	0xb0, 0x00,
-	0xb1, 0x00,
-	0xb2, 0x00,
-	0xb3, 0x00,
-	0xb4, 0x00,
-	0xb5, 0x00,
-	0xb6, 0x00,
-	0xb7, 0x00,
-	0xb8, 0x00,
-	0xb9, 0x00,
-	0xba, 0x00,
-	0xbb, 0x00,
-	0xbc, 0x00,
-	0xbd, 0x00,
-	0xbe, 0x00,
-	0xbf, 0x00,
-	0xc0, 0x00,
-	0xc1, 0x00,
-	0xc2, 0x00,
-	0xc3, 0x00,
-	0xc4, 0x00,
-	0xc5, 0x00,
-	0xc6, 0x00,
-	0xc7, 0x00,
-	0xc8, 0x00,
-	0xc9, 0x00,
-	0xca, 0x00,
-	0xcb, 0x00,
-	0xcc, 0x00,
-	0xcd, 0x00,
-	0xce, 0x00,
-	0xcf, 0x00,
-	0xd0, 0x00,
-	0xd1, 0x00,
-	0xd2, 0x00,
-	0xd3, 0x00,
-	0xd4, 0x00,
-	0xd5, 0x00,
-	0xd6, 0x00,
-	0xd7, 0x00,
-	0xd8, 0x00,
-	0xd9, 0x00,
-	0xda, 0x00,
-	0xdb, 0x00,
-	0xdc, 0x00,
-	0xdd, 0x00,
-	0xde, 0x00,
-	0xdf, 0x00,
-	0xc0, 0x00,
-	0xc1, 0x00,
-	0xc2, 0x00,
-	0xc3, 0x00,
-	0xc4, 0x00,
-	0xc5, 0x00,
-	0xc6, 0x00,
-	0xc7, 0x00,
-	0xc8, 0x00,
-	0xc9, 0x00,
-	0xca, 0x00,
-	0xcb, 0x00,
-	0xcc, 0x00,
-	0xcd, 0x00,
-	0xce, 0x00,
-	0xcf, 0x00,
-	0xd0, 0x00,
-	0xd1, 0x00,
-	0xd2, 0x00,
-	0xd3, 0x00,
-	0xd4, 0x00,
-	0xd5, 0x00,
-	0xd6, 0x00,
-	0xf7, 0x00,
-	0xd8, 0x00,
-	0xd9, 0x00,
-	0xda, 0x00,
-	0xdb, 0x00,
-	0xdc, 0x00,
-	0xdd, 0x00,
-	0xde, 0x00,
-	0x78, 0x01,
-	0x00, 0x01,
-	0x00, 0x01,
-	0x02, 0x01,
-	0x02, 0x01,
-	0x04, 0x01,
-	0x04, 0x01,
-	0x06, 0x01,
-	0x06, 0x01,
-	0x08, 0x01,
-	0x08, 0x01,
-	0x0a, 0x01,
-	0x0a, 0x01,
-	0x0c, 0x01,
-	0x0c, 0x01,
-	0x0e, 0x01,
-	0x0e, 0x01,
-	0x10, 0x01,
-	0x10, 0x01,
-	0x12, 0x01,
-	0x12, 0x01,
-	0x14, 0x01,
-	0x14, 0x01,
-	0x16, 0x01,
-	0x16, 0x01,
-	0x18, 0x01,
-	0x18, 0x01,
-	0x1a, 0x01,
-	0x1a, 0x01,
-	0x1c, 0x01,
-	0x1c, 0x01,
-	0x1e, 0x01,
-	0x1e, 0x01,
-	0x20, 0x01,
-	0x20, 0x01,
-	0x22, 0x01,
-	0x22, 0x01,
-	0x24, 0x01,
-	0x24, 0x01,
-	0x26, 0x01,
-	0x26, 0x01,
-	0x28, 0x01,
-	0x28, 0x01,
-	0x2a, 0x01,
-	0x2a, 0x01,
-	0x2c, 0x01,
-	0x2c, 0x01,
-	0x2e, 0x01,
-	0x2e, 0x01,
-	0x30, 0x01,
-	0x31, 0x01,
-	0x32, 0x01,
-	0x32, 0x01,
-	0x34, 0x01,
-	0x34, 0x01,
-	0x36, 0x01,
-	0x36, 0x01,
-	0x38, 0x01,
-	0x39, 0x01,
-	0x39, 0x01,
-	0x3b, 0x01,
-	0x3b, 0x01,
-	0x3d, 0x01,
-	0x3d, 0x01,
-	0x3f, 0x01,
-	0x3f, 0x01,
-	0x41, 0x01,
-	0x41, 0x01,
-	0x43, 0x01,
-	0x43, 0x01,
-	0x45, 0x01,
-	0x45, 0x01,
-	0x47, 0x01,
-	0x47, 0x01,
-	0x49, 0x01,
-	0x4a, 0x01,
-	0x4a, 0x01,
-	0x4c, 0x01,
-	0x4c, 0x01,
-	0x4e, 0x01,
-	0x4e, 0x01,
-	0x50, 0x01,
-	0x50, 0x01,
-	0x52, 0x01,
-	0x52, 0x01,
-	0x54, 0x01,
-	0x54, 0x01,
-	0x56, 0x01,
-	0x56, 0x01,
-	0x58, 0x01,
-	0x58, 0x01,
-	0x5a, 0x01,
-	0x5a, 0x01,
-	0x5c, 0x01,
-	0x5c, 0x01,
-	0x5e, 0x01,
-	0x5e, 0x01,
-	0x60, 0x01,
-	0x60, 0x01,
-	0x62, 0x01,
-	0x62, 0x01,
-	0x64, 0x01,
-	0x64, 0x01,
-	0x66, 0x01,
-	0x66, 0x01,
-	0x68, 0x01,
-	0x68, 0x01,
-	0x6a, 0x01,
-	0x6a, 0x01,
-	0x6c, 0x01,
-	0x6c, 0x01,
-	0x6e, 0x01,
-	0x6e, 0x01,
-	0x70, 0x01,
-	0x70, 0x01,
-	0x72, 0x01,
-	0x72, 0x01,
-	0x74, 0x01,
-	0x74, 0x01,
-	0x76, 0x01,
-	0x76, 0x01,
-	0x78, 0x01,
-	0x79, 0x01,
-	0x79, 0x01,
-	0x7b, 0x01,
-	0x7b, 0x01,
-	0x7d, 0x01,
-	0x7d, 0x01,
-	0x7f, 0x01,
-	0x43, 0x02,
-	0x81, 0x01,
-	0x82, 0x01,
-	0x82, 0x01,
-	0x84, 0x01,
-	0x84, 0x01,
-	0x86, 0x01,
-	0x87, 0x01,
-	0x87, 0x01,
-	0x89, 0x01,
-	0x8a, 0x01,
-	0x8b, 0x01,
-	0x8b, 0x01,
-	0x8d, 0x01,
-	0x8e, 0x01,
-	0x8f, 0x01,
-	0x90, 0x01,
-	0x91, 0x01,
-	0x91, 0x01,
-	0x93, 0x01,
-	0x94, 0x01,
-	0xf6, 0x01,
-	0x96, 0x01,
-	0x97, 0x01,
-	0x98, 0x01,
-	0x98, 0x01,
-	0x3d, 0x02,
-	0x9b, 0x01,
-	0x9c, 0x01,
-	0x9d, 0x01,
-	0x20, 0x02,
-	0x9f, 0x01,
-	0xa0, 0x01,
-	0xa0, 0x01,
-	0xa2, 0x01,
-	0xa2, 0x01,
-	0xa4, 0x01,
-	0xa4, 0x01,
-	0xa6, 0x01,
-	0xa7, 0x01,
-	0xa7, 0x01,
-	0xa9, 0x01,
-	0xaa, 0x01,
-	0xab, 0x01,
-	0xac, 0x01,
-	0xac, 0x01,
-	0xae, 0x01,
-	0xaf, 0x01,
-	0xaf, 0x01,
-	0xb1, 0x01,
-	0xb2, 0x01,
-	0xb3, 0x01,
-	0xb3, 0x01,
-	0xb5, 0x01,
-	0xb5, 0x01,
-	0xb7, 0x01,
-	0xb8, 0x01,
-	0xb8, 0x01,
-	0xba, 0x01,
-	0xbb, 0x01,
-	0xbc, 0x01,
-	0xbc, 0x01,
-	0xbe, 0x01,
-	0xf7, 0x01,
-	0xc0, 0x01,
-	0xc1, 0x01,
-	0xc2, 0x01,
-	0xc3, 0x01,
-	0xc4, 0x01,
-	0xc5, 0x01,
-	0xc4, 0x01,
-	0xc7, 0x01,
-	0xc8, 0x01,
-	0xc7, 0x01,
-	0xca, 0x01,
-	0xcb, 0x01,
-	0xca, 0x01,
-	0xcd, 0x01,
-	0xcd, 0x01,
-	0xcf, 0x01,
-	0xcf, 0x01,
-	0xd1, 0x01,
-	0xd1, 0x01,
-	0xd3, 0x01,
-	0xd3, 0x01,
-	0xd5, 0x01,
-	0xd5, 0x01,
-	0xd7, 0x01,
-	0xd7, 0x01,
-	0xd9, 0x01,
-	0xd9, 0x01,
-	0xdb, 0x01,
-	0xdb, 0x01,
-	0x8e, 0x01,
-	0xde, 0x01,
-	0xde, 0x01,
-	0xe0, 0x01,
-	0xe0, 0x01,
-	0xe2, 0x01,
-	0xe2, 0x01,
-	0xe4, 0x01,
-	0xe4, 0x01,
-	0xe6, 0x01,
-	0xe6, 0x01,
-	0xe8, 0x01,
-	0xe8, 0x01,
-	0xea, 0x01,
-	0xea, 0x01,
-	0xec, 0x01,
-	0xec, 0x01,
-	0xee, 0x01,
-	0xee, 0x01,
-	0xf0, 0x01,
-	0xf1, 0x01,
-	0xf2, 0x01,
-	0xf1, 0x01,
-	0xf4, 0x01,
-	0xf4, 0x01,
-	0xf6, 0x01,
-	0xf7, 0x01,
-	0xf8, 0x01,
-	0xf8, 0x01,
-	0xfa, 0x01,
-	0xfa, 0x01,
-	0xfc, 0x01,
-	0xfc, 0x01,
-	0xfe, 0x01,
-	0xfe, 0x01,
-	0x00, 0x02,
-	0x00, 0x02,
-	0x02, 0x02,
-	0x02, 0x02,
-	0x04, 0x02,
-	0x04, 0x02,
-	0x06, 0x02,
-	0x06, 0x02,
-	0x08, 0x02,
-	0x08, 0x02,
-	0x0a, 0x02,
-	0x0a, 0x02,
-	0x0c, 0x02,
-	0x0c, 0x02,
-	0x0e, 0x02,
-	0x0e, 0x02,
-	0x10, 0x02,
-	0x10, 0x02,
-	0x12, 0x02,
-	0x12, 0x02,
-	0x14, 0x02,
-	0x14, 0x02,
-	0x16, 0x02,
-	0x16, 0x02,
-	0x18, 0x02,
-	0x18, 0x02,
-	0x1a, 0x02,
-	0x1a, 0x02,
-	0x1c, 0x02,
-	0x1c, 0x02,
-	0x1e, 0x02,
-	0x1e, 0x02,
-	0x20, 0x02,
-	0x21, 0x02,
-	0x22, 0x02,
-	0x22, 0x02,
-	0x24, 0x02,
-	0x24, 0x02,
-	0x26, 0x02,
-	0x26, 0x02,
-	0x28, 0x02,
-	0x28, 0x02,
-	0x2a, 0x02,
-	0x2a, 0x02,
-	0x2c, 0x02,
-	0x2c, 0x02,
-	0x2e, 0x02,
-	0x2e, 0x02,
-	0x30, 0x02,
-	0x30, 0x02,
-	0x32, 0x02,
-	0x32, 0x02,
-	0x34, 0x02,
-	0x35, 0x02,
-	0x36, 0x02,
-	0x37, 0x02,
-	0x38, 0x02,
-	0x39, 0x02,
-	0x65, 0x2c,
-	0x3b, 0x02,
-	0x3b, 0x02,
-	0x3d, 0x02,
-	0x66, 0x2c,
-	0x3f, 0x02,
-	0x40, 0x02,
-	0x41, 0x02,
-	0x41, 0x02,
-	0x43, 0x02,
-	0x44, 0x02,
-	0x45, 0x02,
-	0x46, 0x02,
-	0x46, 0x02,
-	0x48, 0x02,
-	0x48, 0x02,
-	0x4a, 0x02,
-	0x4a, 0x02,
-	0x4c, 0x02,
-	0x4c, 0x02,
-	0x4e, 0x02,
-	0x4e, 0x02,
-	0x50, 0x02,
-	0x51, 0x02,
-	0x52, 0x02,
-	0x81, 0x01,
-	0x86, 0x01,
-	0x55, 0x02,
-	0x89, 0x01,
-	0x8a, 0x01,
-	0x58, 0x02,
-	0x8f, 0x01,
-	0x5a, 0x02,
-	0x90, 0x01,
-	0x5c, 0x02,
-	0x5d, 0x02,
-	0x5e, 0x02,
-	0x5f, 0x02,
-	0x93, 0x01,
-	0x61, 0x02,
-	0x62, 0x02,
-	0x94, 0x01,
-	0x64, 0x02,
-	0x65, 0x02,
-	0x66, 0x02,
-	0x67, 0x02,
-	0x97, 0x01,
-	0x96, 0x01,
-	0x6a, 0x02,
-	0x62, 0x2c,
-	0x6c, 0x02,
-	0x6d, 0x02,
-	0x6e, 0x02,
-	0x9c, 0x01,
-	0x70, 0x02,
-	0x71, 0x02,
-	0x9d, 0x01,
-	0x73, 0x02,
-	0x74, 0x02,
-	0x9f, 0x01,
-	0x76, 0x02,
-	0x77, 0x02,
-	0x78, 0x02,
-	0x79, 0x02,
-	0x7a, 0x02,
-	0x7b, 0x02,
-	0x7c, 0x02,
-	0x64, 0x2c,
-	0x7e, 0x02,
-	0x7f, 0x02,
-	0xa6, 0x01,
-	0x81, 0x02,
-	0x82, 0x02,
-	0xa9, 0x01,
-	0x84, 0x02,
-	0x85, 0x02,
-	0x86, 0x02,
-	0x87, 0x02,
-	0xae, 0x01,
-	0x44, 0x02,
-	0xb1, 0x01,
-	0xb2, 0x01,
-	0x45, 0x02,
-	0x8d, 0x02,
-	0x8e, 0x02,
-	0x8f, 0x02,
-	0x90, 0x02,
-	0x91, 0x02,
-	0xb7, 0x01,
-	0x93, 0x02,
-	0x94, 0x02,
-	0x95, 0x02,
-	0x96, 0x02,
-	0x97, 0x02,
-	0x98, 0x02,
-	0x99, 0x02,
-	0x9a, 0x02,
-	0x9b, 0x02,
-	0x9c, 0x02,
-	0x9d, 0x02,
-	0x9e, 0x02,
-	0x9f, 0x02,
-	0xa0, 0x02,
-	0xa1, 0x02,
-	0xa2, 0x02,
-	0xa3, 0x02,
-	0xa4, 0x02,
-	0xa5, 0x02,
-	0xa6, 0x02,
-	0xa7, 0x02,
-	0xa8, 0x02,
-	0xa9, 0x02,
-	0xaa, 0x02,
-	0xab, 0x02,
-	0xac, 0x02,
-	0xad, 0x02,
-	0xae, 0x02,
-	0xaf, 0x02,
-	0xb0, 0x02,
-	0xb1, 0x02,
-	0xb2, 0x02,
-	0xb3, 0x02,
-	0xb4, 0x02,
-	0xb5, 0x02,
-	0xb6, 0x02,
-	0xb7, 0x02,
-	0xb8, 0x02,
-	0xb9, 0x02,
-	0xba, 0x02,
-	0xbb, 0x02,
-	0xbc, 0x02,
-	0xbd, 0x02,
-	0xbe, 0x02,
-	0xbf, 0x02,
-	0xc0, 0x02,
-	0xc1, 0x02,
-	0xc2, 0x02,
-	0xc3, 0x02,
-	0xc4, 0x02,
-	0xc5, 0x02,
-	0xc6, 0x02,
-	0xc7, 0x02,
-	0xc8, 0x02,
-	0xc9, 0x02,
-	0xca, 0x02,
-	0xcb, 0x02,
-	0xcc, 0x02,
-	0xcd, 0x02,
-	0xce, 0x02,
-	0xcf, 0x02,
-	0xd0, 0x02,
-	0xd1, 0x02,
-	0xd2, 0x02,
-	0xd3, 0x02,
-	0xd4, 0x02,
-	0xd5, 0x02,
-	0xd6, 0x02,
-	0xd7, 0x02,
-	0xd8, 0x02,
-	0xd9, 0x02,
-	0xda, 0x02,
-	0xdb, 0x02,
-	0xdc, 0x02,
-	0xdd, 0x02,
-	0xde, 0x02,
-	0xdf, 0x02,
-	0xe0, 0x02,
-	0xe1, 0x02,
-	0xe2, 0x02,
-	0xe3, 0x02,
-	0xe4, 0x02,
-	0xe5, 0x02,
-	0xe6, 0x02,
-	0xe7, 0x02,
-	0xe8, 0x02,
-	0xe9, 0x02,
-	0xea, 0x02,
-	0xeb, 0x02,
-	0xec, 0x02,
-	0xed, 0x02,
-	0xee, 0x02,
-	0xef, 0x02,
-	0xf0, 0x02,
-	0xf1, 0x02,
-	0xf2, 0x02,
-	0xf3, 0x02,
-	0xf4, 0x02,
-	0xf5, 0x02,
-	0xf6, 0x02,
-	0xf7, 0x02,
-	0xf8, 0x02,
-	0xf9, 0x02,
-	0xfa, 0x02,
-	0xfb, 0x02,
-	0xfc, 0x02,
-	0xfd, 0x02,
-	0xfe, 0x02,
-	0xff, 0x02,
-	0x00, 0x03,
-	0x01, 0x03,
-	0x02, 0x03,
-	0x03, 0x03,
-	0x04, 0x03,
-	0x05, 0x03,
-	0x06, 0x03,
-	0x07, 0x03,
-	0x08, 0x03,
-	0x09, 0x03,
-	0x0a, 0x03,
-	0x0b, 0x03,
-	0x0c, 0x03,
-	0x0d, 0x03,
-	0x0e, 0x03,
-	0x0f, 0x03,
-	0x10, 0x03,
-	0x11, 0x03,
-	0x12, 0x03,
-	0x13, 0x03,
-	0x14, 0x03,
-	0x15, 0x03,
-	0x16, 0x03,
-	0x17, 0x03,
-	0x18, 0x03,
-	0x19, 0x03,
-	0x1a, 0x03,
-	0x1b, 0x03,
-	0x1c, 0x03,
-	0x1d, 0x03,
-	0x1e, 0x03,
-	0x1f, 0x03,
-	0x20, 0x03,
-	0x21, 0x03,
-	0x22, 0x03,
-	0x23, 0x03,
-	0x24, 0x03,
-	0x25, 0x03,
-	0x26, 0x03,
-	0x27, 0x03,
-	0x28, 0x03,
-	0x29, 0x03,
-	0x2a, 0x03,
-	0x2b, 0x03,
-	0x2c, 0x03,
-	0x2d, 0x03,
-	0x2e, 0x03,
-	0x2f, 0x03,
-	0x30, 0x03,
-	0x31, 0x03,
-	0x32, 0x03,
-	0x33, 0x03,
-	0x34, 0x03,
-	0x35, 0x03,
-	0x36, 0x03,
-	0x37, 0x03,
-	0x38, 0x03,
-	0x39, 0x03,
-	0x3a, 0x03,
-	0x3b, 0x03,
-	0x3c, 0x03,
-	0x3d, 0x03,
-	0x3e, 0x03,
-	0x3f, 0x03,
-	0x40, 0x03,
-	0x41, 0x03,
-	0x42, 0x03,
-	0x43, 0x03,
-	0x44, 0x03,
-	0x45, 0x03,
-	0x46, 0x03,
-	0x47, 0x03,
-	0x48, 0x03,
-	0x49, 0x03,
-	0x4a, 0x03,
-	0x4b, 0x03,
-	0x4c, 0x03,
-	0x4d, 0x03,
-	0x4e, 0x03,
-	0x4f, 0x03,
-	0x50, 0x03,
-	0x51, 0x03,
-	0x52, 0x03,
-	0x53, 0x03,
-	0x54, 0x03,
-	0x55, 0x03,
-	0x56, 0x03,
-	0x57, 0x03,
-	0x58, 0x03,
-	0x59, 0x03,
-	0x5a, 0x03,
-	0x5b, 0x03,
-	0x5c, 0x03,
-	0x5d, 0x03,
-	0x5e, 0x03,
-	0x5f, 0x03,
-	0x60, 0x03,
-	0x61, 0x03,
-	0x62, 0x03,
-	0x63, 0x03,
-	0x64, 0x03,
-	0x65, 0x03,
-	0x66, 0x03,
-	0x67, 0x03,
-	0x68, 0x03,
-	0x69, 0x03,
-	0x6a, 0x03,
-	0x6b, 0x03,
-	0x6c, 0x03,
-	0x6d, 0x03,
-	0x6e, 0x03,
-	0x6f, 0x03,
-	0x70, 0x03,
-	0x71, 0x03,
-	0x72, 0x03,
-	0x73, 0x03,
-	0x74, 0x03,
-	0x75, 0x03,
-	0x76, 0x03,
-	0x77, 0x03,
-	0x78, 0x03,
-	0x79, 0x03,
-	0x7a, 0x03,
-	0xfd, 0x03,
-	0xfe, 0x03,
-	0xff, 0x03,
-	0x7e, 0x03,
-	0x7f, 0x03,
-	0x80, 0x03,
-	0x81, 0x03,
-	0x82, 0x03,
-	0x83, 0x03,
-	0x84, 0x03,
-	0x85, 0x03,
-	0x86, 0x03,
-	0x87, 0x03,
-	0x88, 0x03,
-	0x89, 0x03,
-	0x8a, 0x03,
-	0x8b, 0x03,
-	0x8c, 0x03,
-	0x8d, 0x03,
-	0x8e, 0x03,
-	0x8f, 0x03,
-	0x90, 0x03,
-	0x91, 0x03,
-	0x92, 0x03,
-	0x93, 0x03,
-	0x94, 0x03,
-	0x95, 0x03,
-	0x96, 0x03,
-	0x97, 0x03,
-	0x98, 0x03,
-	0x99, 0x03,
-	0x9a, 0x03,
-	0x9b, 0x03,
-	0x9c, 0x03,
-	0x9d, 0x03,
-	0x9e, 0x03,
-	0x9f, 0x03,
-	0xa0, 0x03,
-	0xa1, 0x03,
-	0xa2, 0x03,
-	0xa3, 0x03,
-	0xa4, 0x03,
-	0xa5, 0x03,
-	0xa6, 0x03,
-	0xa7, 0x03,
-	0xa8, 0x03,
-	0xa9, 0x03,
-	0xaa, 0x03,
-	0xab, 0x03,
-	0x86, 0x03,
-	0x88, 0x03,
-	0x89, 0x03,
-	0x8a, 0x03,
-	0xb0, 0x03,
-	0x91, 0x03,
-	0x92, 0x03,
-	0x93, 0x03,
-	0x94, 0x03,
-	0x95, 0x03,
-	0x96, 0x03,
-	0x97, 0x03,
-	0x98, 0x03,
-	0x99, 0x03,
-	0x9a, 0x03,
-	0x9b, 0x03,
-	0x9c, 0x03,
-	0x9d, 0x03,
-	0x9e, 0x03,
-	0x9f, 0x03,
-	0xa0, 0x03,
-	0xa1, 0x03,
-	0xa3, 0x03,
-	0xa3, 0x03,
-	0xa4, 0x03,
-	0xa5, 0x03,
-	0xa6, 0x03,
-	0xa7, 0x03,
-	0xa8, 0x03,
-	0xa9, 0x03,
-	0xaa, 0x03,
-	0xab, 0x03,
-	0x8c, 0x03,
-	0x8e, 0x03,
-	0x8f, 0x03,
-	0xcf, 0x03,
-	0xd0, 0x03,
-	0xd1, 0x03,
-	0xd2, 0x03,
-	0xd3, 0x03,
-	0xd4, 0x03,
-	0xd5, 0x03,
-	0xd6, 0x03,
-	0xd7, 0x03,
-	0xd8, 0x03,
-	0xd8, 0x03,
-	0xda, 0x03,
-	0xda, 0x03,
-	0xdc, 0x03,
-	0xdc, 0x03,
-	0xde, 0x03,
-	0xde, 0x03,
-	0xe0, 0x03,
-	0xe0, 0x03,
-	0xe2, 0x03,
-	0xe2, 0x03,
-	0xe4, 0x03,
-	0xe4, 0x03,
-	0xe6, 0x03,
-	0xe6, 0x03,
-	0xe8, 0x03,
-	0xe8, 0x03,
-	0xea, 0x03,
-	0xea, 0x03,
-	0xec, 0x03,
-	0xec, 0x03,
-	0xee, 0x03,
-	0xee, 0x03,
-	0xf0, 0x03,
-	0xf1, 0x03,
-	0xf9, 0x03,
-	0xf3, 0x03,
-	0xf4, 0x03,
-	0xf5, 0x03,
-	0xf6, 0x03,
-	0xf7, 0x03,
-	0xf7, 0x03,
-	0xf9, 0x03,
-	0xfa, 0x03,
-	0xfa, 0x03,
-	0xfc, 0x03,
-	0xfd, 0x03,
-	0xfe, 0x03,
-	0xff, 0x03,
-	0x00, 0x04,
-	0x01, 0x04,
-	0x02, 0x04,
-	0x03, 0x04,
-	0x04, 0x04,
-	0x05, 0x04,
-	0x06, 0x04,
-	0x07, 0x04,
-	0x08, 0x04,
-	0x09, 0x04,
-	0x0a, 0x04,
-	0x0b, 0x04,
-	0x0c, 0x04,
-	0x0d, 0x04,
-	0x0e, 0x04,
-	0x0f, 0x04,
-	0x10, 0x04,
-	0x11, 0x04,
-	0x12, 0x04,
-	0x13, 0x04,
-	0x14, 0x04,
-	0x15, 0x04,
-	0x16, 0x04,
-	0x17, 0x04,
-	0x18, 0x04,
-	0x19, 0x04,
-	0x1a, 0x04,
-	0x1b, 0x04,
-	0x1c, 0x04,
-	0x1d, 0x04,
-	0x1e, 0x04,
-	0x1f, 0x04,
-	0x20, 0x04,
-	0x21, 0x04,
-	0x22, 0x04,
-	0x23, 0x04,
-	0x24, 0x04,
-	0x25, 0x04,
-	0x26, 0x04,
-	0x27, 0x04,
-	0x28, 0x04,
-	0x29, 0x04,
-	0x2a, 0x04,
-	0x2b, 0x04,
-	0x2c, 0x04,
-	0x2d, 0x04,
-	0x2e, 0x04,
-	0x2f, 0x04,
-	0x10, 0x04,
-	0x11, 0x04,
-	0x12, 0x04,
-	0x13, 0x04,
-	0x14, 0x04,
-	0x15, 0x04,
-	0x16, 0x04,
-	0x17, 0x04,
-	0x18, 0x04,
-	0x19, 0x04,
-	0x1a, 0x04,
-	0x1b, 0x04,
-	0x1c, 0x04,
-	0x1d, 0x04,
-	0x1e, 0x04,
-	0x1f, 0x04,
-	0x20, 0x04,
-	0x21, 0x04,
-	0x22, 0x04,
-	0x23, 0x04,
-	0x24, 0x04,
-	0x25, 0x04,
-	0x26, 0x04,
-	0x27, 0x04,
-	0x28, 0x04,
-	0x29, 0x04,
-	0x2a, 0x04,
-	0x2b, 0x04,
-	0x2c, 0x04,
-	0x2d, 0x04,
-	0x2e, 0x04,
-	0x2f, 0x04,
-	0x00, 0x04,
-	0x01, 0x04,
-	0x02, 0x04,
-	0x03, 0x04,
-	0x04, 0x04,
-	0x05, 0x04,
-	0x06, 0x04,
-	0x07, 0x04,
-	0x08, 0x04,
-	0x09, 0x04,
-	0x0a, 0x04,
-	0x0b, 0x04,
-	0x0c, 0x04,
-	0x0d, 0x04,
-	0x0e, 0x04,
-	0x0f, 0x04,
-	0x60, 0x04,
-	0x60, 0x04,
-	0x62, 0x04,
-	0x62, 0x04,
-	0x64, 0x04,
-	0x64, 0x04,
-	0x66, 0x04,
-	0x66, 0x04,
-	0x68, 0x04,
-	0x68, 0x04,
-	0x6a, 0x04,
-	0x6a, 0x04,
-	0x6c, 0x04,
-	0x6c, 0x04,
-	0x6e, 0x04,
-	0x6e, 0x04,
-	0x70, 0x04,
-	0x70, 0x04,
-	0x72, 0x04,
-	0x72, 0x04,
-	0x74, 0x04,
-	0x74, 0x04,
-	0x76, 0x04,
-	0x76, 0x04,
-	0x78, 0x04,
-	0x78, 0x04,
-	0x7a, 0x04,
-	0x7a, 0x04,
-	0x7c, 0x04,
-	0x7c, 0x04,
-	0x7e, 0x04,
-	0x7e, 0x04,
-	0x80, 0x04,
-	0x80, 0x04,
-	0x82, 0x04,
-	0x83, 0x04,
-	0x84, 0x04,
-	0x85, 0x04,
-	0x86, 0x04,
-	0x87, 0x04,
-	0x88, 0x04,
-	0x89, 0x04,
-	0x8a, 0x04,
-	0x8a, 0x04,
-	0x8c, 0x04,
-	0x8c, 0x04,
-	0x8e, 0x04,
-	0x8e, 0x04,
-	0x90, 0x04,
-	0x90, 0x04,
-	0x92, 0x04,
-	0x92, 0x04,
-	0x94, 0x04,
-	0x94, 0x04,
-	0x96, 0x04,
-	0x96, 0x04,
-	0x98, 0x04,
-	0x98, 0x04,
-	0x9a, 0x04,
-	0x9a, 0x04,
-	0x9c, 0x04,
-	0x9c, 0x04,
-	0x9e, 0x04,
-	0x9e, 0x04,
-	0xa0, 0x04,
-	0xa0, 0x04,
-	0xa2, 0x04,
-	0xa2, 0x04,
-	0xa4, 0x04,
-	0xa4, 0x04,
-	0xa6, 0x04,
-	0xa6, 0x04,
-	0xa8, 0x04,
-	0xa8, 0x04,
-	0xaa, 0x04,
-	0xaa, 0x04,
-	0xac, 0x04,
-	0xac, 0x04,
-	0xae, 0x04,
-	0xae, 0x04,
-	0xb0, 0x04,
-	0xb0, 0x04,
-	0xb2, 0x04,
-	0xb2, 0x04,
-	0xb4, 0x04,
-	0xb4, 0x04,
-	0xb6, 0x04,
-	0xb6, 0x04,
-	0xb8, 0x04,
-	0xb8, 0x04,
-	0xba, 0x04,
-	0xba, 0x04,
-	0xbc, 0x04,
-	0xbc, 0x04,
-	0xbe, 0x04,
-	0xbe, 0x04,
-	0xc0, 0x04,
-	0xc1, 0x04,
-	0xc1, 0x04,
-	0xc3, 0x04,
-	0xc3, 0x04,
-	0xc5, 0x04,
-	0xc5, 0x04,
-	0xc7, 0x04,
-	0xc7, 0x04,
-	0xc9, 0x04,
-	0xc9, 0x04,
-	0xcb, 0x04,
-	0xcb, 0x04,
-	0xcd, 0x04,
-	0xcd, 0x04,
-	0xc0, 0x04,
-	0xd0, 0x04,
-	0xd0, 0x04,
-	0xd2, 0x04,
-	0xd2, 0x04,
-	0xd4, 0x04,
-	0xd4, 0x04,
-	0xd6, 0x04,
-	0xd6, 0x04,
-	0xd8, 0x04,
-	0xd8, 0x04,
-	0xda, 0x04,
-	0xda, 0x04,
-	0xdc, 0x04,
-	0xdc, 0x04,
-	0xde, 0x04,
-	0xde, 0x04,
-	0xe0, 0x04,
-	0xe0, 0x04,
-	0xe2, 0x04,
-	0xe2, 0x04,
-	0xe4, 0x04,
-	0xe4, 0x04,
-	0xe6, 0x04,
-	0xe6, 0x04,
-	0xe8, 0x04,
-	0xe8, 0x04,
-	0xea, 0x04,
-	0xea, 0x04,
-	0xec, 0x04,
-	0xec, 0x04,
-	0xee, 0x04,
-	0xee, 0x04,
-	0xf0, 0x04,
-	0xf0, 0x04,
-	0xf2, 0x04,
-	0xf2, 0x04,
-	0xf4, 0x04,
-	0xf4, 0x04,
-	0xf6, 0x04,
-	0xf6, 0x04,
-	0xf8, 0x04,
-	0xf8, 0x04,
-	0xfa, 0x04,
-	0xfa, 0x04,
-	0xfc, 0x04,
-	0xfc, 0x04,
-	0xfe, 0x04,
-	0xfe, 0x04,
-	0x00, 0x05,
-	0x00, 0x05,
-	0x02, 0x05,
-	0x02, 0x05,
-	0x04, 0x05,
-	0x04, 0x05,
-	0x06, 0x05,
-	0x06, 0x05,
-	0x08, 0x05,
-	0x08, 0x05,
-	0x0a, 0x05,
-	0x0a, 0x05,
-	0x0c, 0x05,
-	0x0c, 0x05,
-	0x0e, 0x05,
-	0x0e, 0x05,
-	0x10, 0x05,
-	0x10, 0x05,
-	0x12, 0x05,
-	0x12, 0x05,
-	0x14, 0x05,
-	0x15, 0x05,
-	0x16, 0x05,
-	0x17, 0x05,
-	0x18, 0x05,
-	0x19, 0x05,
-	0x1a, 0x05,
-	0x1b, 0x05,
-	0x1c, 0x05,
-	0x1d, 0x05,
-	0x1e, 0x05,
-	0x1f, 0x05,
-	0x20, 0x05,
-	0x21, 0x05,
-	0x22, 0x05,
-	0x23, 0x05,
-	0x24, 0x05,
-	0x25, 0x05,
-	0x26, 0x05,
-	0x27, 0x05,
-	0x28, 0x05,
-	0x29, 0x05,
-	0x2a, 0x05,
-	0x2b, 0x05,
-	0x2c, 0x05,
-	0x2d, 0x05,
-	0x2e, 0x05,
-	0x2f, 0x05,
-	0x30, 0x05,
-	0x31, 0x05,
-	0x32, 0x05,
-	0x33, 0x05,
-	0x34, 0x05,
-	0x35, 0x05,
-	0x36, 0x05,
-	0x37, 0x05,
-	0x38, 0x05,
-	0x39, 0x05,
-	0x3a, 0x05,
-	0x3b, 0x05,
-	0x3c, 0x05,
-	0x3d, 0x05,
-	0x3e, 0x05,
-	0x3f, 0x05,
-	0x40, 0x05,
-	0x41, 0x05,
-	0x42, 0x05,
-	0x43, 0x05,
-	0x44, 0x05,
-	0x45, 0x05,
-	0x46, 0x05,
-	0x47, 0x05,
-	0x48, 0x05,
-	0x49, 0x05,
-	0x4a, 0x05,
-	0x4b, 0x05,
-	0x4c, 0x05,
-	0x4d, 0x05,
-	0x4e, 0x05,
-	0x4f, 0x05,
-	0x50, 0x05,
-	0x51, 0x05,
-	0x52, 0x05,
-	0x53, 0x05,
-	0x54, 0x05,
-	0x55, 0x05,
-	0x56, 0x05,
-	0x57, 0x05,
-	0x58, 0x05,
-	0x59, 0x05,
-	0x5a, 0x05,
-	0x5b, 0x05,
-	0x5c, 0x05,
-	0x5d, 0x05,
-	0x5e, 0x05,
-	0x5f, 0x05,
-	0x60, 0x05,
-	0x31, 0x05,
-	0x32, 0x05,
-	0x33, 0x05,
-	0x34, 0x05,
-	0x35, 0x05,
-	0x36, 0x05,
-	0x37, 0x05,
-	0x38, 0x05,
-	0x39, 0x05,
-	0x3a, 0x05,
-	0x3b, 0x05,
-	0x3c, 0x05,
-	0x3d, 0x05,
-	0x3e, 0x05,
-	0x3f, 0x05,
-	0x40, 0x05,
-	0x41, 0x05,
-	0x42, 0x05,
-	0x43, 0x05,
-	0x44, 0x05,
-	0x45, 0x05,
-	0x46, 0x05,
-	0x47, 0x05,
-	0x48, 0x05,
-	0x49, 0x05,
-	0x4a, 0x05,
-	0x4b, 0x05,
-	0x4c, 0x05,
-	0x4d, 0x05,
-	0x4e, 0x05,
-	0x4f, 0x05,
-	0x50, 0x05,
-	0x51, 0x05,
-	0x52, 0x05,
-	0x53, 0x05,
-	0x54, 0x05,
-	0x55, 0x05,
-	0x56, 0x05,
-	0xff, 0xff,
-	0xf6, 0x17,
-	0x63, 0x2c,
-	0x7e, 0x1d,
-	0x7f, 0x1d,
-	0x80, 0x1d,
-	0x81, 0x1d,
-	0x82, 0x1d,
-	0x83, 0x1d,
-	0x84, 0x1d,
-	0x85, 0x1d,
-	0x86, 0x1d,
-	0x87, 0x1d,
-	0x88, 0x1d,
-	0x89, 0x1d,
-	0x8a, 0x1d,
-	0x8b, 0x1d,
-	0x8c, 0x1d,
-	0x8d, 0x1d,
-	0x8e, 0x1d,
-	0x8f, 0x1d,
-	0x90, 0x1d,
-	0x91, 0x1d,
-	0x92, 0x1d,
-	0x93, 0x1d,
-	0x94, 0x1d,
-	0x95, 0x1d,
-	0x96, 0x1d,
-	0x97, 0x1d,
-	0x98, 0x1d,
-	0x99, 0x1d,
-	0x9a, 0x1d,
-	0x9b, 0x1d,
-	0x9c, 0x1d,
-	0x9d, 0x1d,
-	0x9e, 0x1d,
-	0x9f, 0x1d,
-	0xa0, 0x1d,
-	0xa1, 0x1d,
-	0xa2, 0x1d,
-	0xa3, 0x1d,
-	0xa4, 0x1d,
-	0xa5, 0x1d,
-	0xa6, 0x1d,
-	0xa7, 0x1d,
-	0xa8, 0x1d,
-	0xa9, 0x1d,
-	0xaa, 0x1d,
-	0xab, 0x1d,
-	0xac, 0x1d,
-	0xad, 0x1d,
-	0xae, 0x1d,
-	0xaf, 0x1d,
-	0xb0, 0x1d,
-	0xb1, 0x1d,
-	0xb2, 0x1d,
-	0xb3, 0x1d,
-	0xb4, 0x1d,
-	0xb5, 0x1d,
-	0xb6, 0x1d,
-	0xb7, 0x1d,
-	0xb8, 0x1d,
-	0xb9, 0x1d,
-	0xba, 0x1d,
-	0xbb, 0x1d,
-	0xbc, 0x1d,
-	0xbd, 0x1d,
-	0xbe, 0x1d,
-	0xbf, 0x1d,
-	0xc0, 0x1d,
-	0xc1, 0x1d,
-	0xc2, 0x1d,
-	0xc3, 0x1d,
-	0xc4, 0x1d,
-	0xc5, 0x1d,
-	0xc6, 0x1d,
-	0xc7, 0x1d,
-	0xc8, 0x1d,
-	0xc9, 0x1d,
-	0xca, 0x1d,
-	0xcb, 0x1d,
-	0xcc, 0x1d,
-	0xcd, 0x1d,
-	0xce, 0x1d,
-	0xcf, 0x1d,
-	0xd0, 0x1d,
-	0xd1, 0x1d,
-	0xd2, 0x1d,
-	0xd3, 0x1d,
-	0xd4, 0x1d,
-	0xd5, 0x1d,
-	0xd6, 0x1d,
-	0xd7, 0x1d,
-	0xd8, 0x1d,
-	0xd9, 0x1d,
-	0xda, 0x1d,
-	0xdb, 0x1d,
-	0xdc, 0x1d,
-	0xdd, 0x1d,
-	0xde, 0x1d,
-	0xdf, 0x1d,
-	0xe0, 0x1d,
-	0xe1, 0x1d,
-	0xe2, 0x1d,
-	0xe3, 0x1d,
-	0xe4, 0x1d,
-	0xe5, 0x1d,
-	0xe6, 0x1d,
-	0xe7, 0x1d,
-	0xe8, 0x1d,
-	0xe9, 0x1d,
-	0xea, 0x1d,
-	0xeb, 0x1d,
-	0xec, 0x1d,
-	0xed, 0x1d,
-	0xee, 0x1d,
-	0xef, 0x1d,
-	0xf0, 0x1d,
-	0xf1, 0x1d,
-	0xf2, 0x1d,
-	0xf3, 0x1d,
-	0xf4, 0x1d,
-	0xf5, 0x1d,
-	0xf6, 0x1d,
-	0xf7, 0x1d,
-	0xf8, 0x1d,
-	0xf9, 0x1d,
-	0xfa, 0x1d,
-	0xfb, 0x1d,
-	0xfc, 0x1d,
-	0xfd, 0x1d,
-	0xfe, 0x1d,
-	0xff, 0x1d,
-	0x00, 0x1e,
-	0x00, 0x1e,
-	0x02, 0x1e,
-	0x02, 0x1e,
-	0x04, 0x1e,
-	0x04, 0x1e,
-	0x06, 0x1e,
-	0x06, 0x1e,
-	0x08, 0x1e,
-	0x08, 0x1e,
-	0x0a, 0x1e,
-	0x0a, 0x1e,
-	0x0c, 0x1e,
-	0x0c, 0x1e,
-	0x0e, 0x1e,
-	0x0e, 0x1e,
-	0x10, 0x1e,
-	0x10, 0x1e,
-	0x12, 0x1e,
-	0x12, 0x1e,
-	0x14, 0x1e,
-	0x14, 0x1e,
-	0x16, 0x1e,
-	0x16, 0x1e,
-	0x18, 0x1e,
-	0x18, 0x1e,
-	0x1a, 0x1e,
-	0x1a, 0x1e,
-	0x1c, 0x1e,
-	0x1c, 0x1e,
-	0x1e, 0x1e,
-	0x1e, 0x1e,
-	0x20, 0x1e,
-	0x20, 0x1e,
-	0x22, 0x1e,
-	0x22, 0x1e,
-	0x24, 0x1e,
-	0x24, 0x1e,
-	0x26, 0x1e,
-	0x26, 0x1e,
-	0x28, 0x1e,
-	0x28, 0x1e,
-	0x2a, 0x1e,
-	0x2a, 0x1e,
-	0x2c, 0x1e,
-	0x2c, 0x1e,
-	0x2e, 0x1e,
-	0x2e, 0x1e,
-	0x30, 0x1e,
-	0x30, 0x1e,
-	0x32, 0x1e,
-	0x32, 0x1e,
-	0x34, 0x1e,
-	0x34, 0x1e,
-	0x36, 0x1e,
-	0x36, 0x1e,
-	0x38, 0x1e,
-	0x38, 0x1e,
-	0x3a, 0x1e,
-	0x3a, 0x1e,
-	0x3c, 0x1e,
-	0x3c, 0x1e,
-	0x3e, 0x1e,
-	0x3e, 0x1e,
-	0x40, 0x1e,
-	0x40, 0x1e,
-	0x42, 0x1e,
-	0x42, 0x1e,
-	0x44, 0x1e,
-	0x44, 0x1e,
-	0x46, 0x1e,
-	0x46, 0x1e,
-	0x48, 0x1e,
-	0x48, 0x1e,
-	0x4a, 0x1e,
-	0x4a, 0x1e,
-	0x4c, 0x1e,
-	0x4c, 0x1e,
-	0x4e, 0x1e,
-	0x4e, 0x1e,
-	0x50, 0x1e,
-	0x50, 0x1e,
-	0x52, 0x1e,
-	0x52, 0x1e,
-	0x54, 0x1e,
-	0x54, 0x1e,
-	0x56, 0x1e,
-	0x56, 0x1e,
-	0x58, 0x1e,
-	0x58, 0x1e,
-	0x5a, 0x1e,
-	0x5a, 0x1e,
-	0x5c, 0x1e,
-	0x5c, 0x1e,
-	0x5e, 0x1e,
-	0x5e, 0x1e,
-	0x60, 0x1e,
-	0x60, 0x1e,
-	0x62, 0x1e,
-	0x62, 0x1e,
-	0x64, 0x1e,
-	0x64, 0x1e,
-	0x66, 0x1e,
-	0x66, 0x1e,
-	0x68, 0x1e,
-	0x68, 0x1e,
-	0x6a, 0x1e,
-	0x6a, 0x1e,
-	0x6c, 0x1e,
-	0x6c, 0x1e,
-	0x6e, 0x1e,
-	0x6e, 0x1e,
-	0x70, 0x1e,
-	0x70, 0x1e,
-	0x72, 0x1e,
-	0x72, 0x1e,
-	0x74, 0x1e,
-	0x74, 0x1e,
-	0x76, 0x1e,
-	0x76, 0x1e,
-	0x78, 0x1e,
-	0x78, 0x1e,
-	0x7a, 0x1e,
-	0x7a, 0x1e,
-	0x7c, 0x1e,
-	0x7c, 0x1e,
-	0x7e, 0x1e,
-	0x7e, 0x1e,
-	0x80, 0x1e,
-	0x80, 0x1e,
-	0x82, 0x1e,
-	0x82, 0x1e,
-	0x84, 0x1e,
-	0x84, 0x1e,
-	0x86, 0x1e,
-	0x86, 0x1e,
-	0x88, 0x1e,
-	0x88, 0x1e,
-	0x8a, 0x1e,
-	0x8a, 0x1e,
-	0x8c, 0x1e,
-	0x8c, 0x1e,
-	0x8e, 0x1e,
-	0x8e, 0x1e,
-	0x90, 0x1e,
-	0x90, 0x1e,
-	0x92, 0x1e,
-	0x92, 0x1e,
-	0x94, 0x1e,
-	0x94, 0x1e,
-	0x96, 0x1e,
-	0x97, 0x1e,
-	0x98, 0x1e,
-	0x99, 0x1e,
-	0x9a, 0x1e,
-	0x9b, 0x1e,
-	0x9c, 0x1e,
-	0x9d, 0x1e,
-	0x9e, 0x1e,
-	0x9f, 0x1e,
-	0xa0, 0x1e,
-	0xa0, 0x1e,
-	0xa2, 0x1e,
-	0xa2, 0x1e,
-	0xa4, 0x1e,
-	0xa4, 0x1e,
-	0xa6, 0x1e,
-	0xa6, 0x1e,
-	0xa8, 0x1e,
-	0xa8, 0x1e,
-	0xaa, 0x1e,
-	0xaa, 0x1e,
-	0xac, 0x1e,
-	0xac, 0x1e,
-	0xae, 0x1e,
-	0xae, 0x1e,
-	0xb0, 0x1e,
-	0xb0, 0x1e,
-	0xb2, 0x1e,
-	0xb2, 0x1e,
-	0xb4, 0x1e,
-	0xb4, 0x1e,
-	0xb6, 0x1e,
-	0xb6, 0x1e,
-	0xb8, 0x1e,
-	0xb8, 0x1e,
-	0xba, 0x1e,
-	0xba, 0x1e,
-	0xbc, 0x1e,
-	0xbc, 0x1e,
-	0xbe, 0x1e,
-	0xbe, 0x1e,
-	0xc0, 0x1e,
-	0xc0, 0x1e,
-	0xc2, 0x1e,
-	0xc2, 0x1e,
-	0xc4, 0x1e,
-	0xc4, 0x1e,
-	0xc6, 0x1e,
-	0xc6, 0x1e,
-	0xc8, 0x1e,
-	0xc8, 0x1e,
-	0xca, 0x1e,
-	0xca, 0x1e,
-	0xcc, 0x1e,
-	0xcc, 0x1e,
-	0xce, 0x1e,
-	0xce, 0x1e,
-	0xd0, 0x1e,
-	0xd0, 0x1e,
-	0xd2, 0x1e,
-	0xd2, 0x1e,
-	0xd4, 0x1e,
-	0xd4, 0x1e,
-	0xd6, 0x1e,
-	0xd6, 0x1e,
-	0xd8, 0x1e,
-	0xd8, 0x1e,
-	0xda, 0x1e,
-	0xda, 0x1e,
-	0xdc, 0x1e,
-	0xdc, 0x1e,
-	0xde, 0x1e,
-	0xde, 0x1e,
-	0xe0, 0x1e,
-	0xe0, 0x1e,
-	0xe2, 0x1e,
-	0xe2, 0x1e,
-	0xe4, 0x1e,
-	0xe4, 0x1e,
-	0xe6, 0x1e,
-	0xe6, 0x1e,
-	0xe8, 0x1e,
-	0xe8, 0x1e,
-	0xea, 0x1e,
-	0xea, 0x1e,
-	0xec, 0x1e,
-	0xec, 0x1e,
-	0xee, 0x1e,
-	0xee, 0x1e,
-	0xf0, 0x1e,
-	0xf0, 0x1e,
-	0xf2, 0x1e,
-	0xf2, 0x1e,
-	0xf4, 0x1e,
-	0xf4, 0x1e,
-	0xf6, 0x1e,
-	0xf6, 0x1e,
-	0xf8, 0x1e,
-	0xf8, 0x1e,
-	0xfa, 0x1e,
-	0xfb, 0x1e,
-	0xfc, 0x1e,
-	0xfd, 0x1e,
-	0xfe, 0x1e,
-	0xff, 0x1e,
-	0x08, 0x1f,
-	0x09, 0x1f,
-	0x0a, 0x1f,
-	0x0b, 0x1f,
-	0x0c, 0x1f,
-	0x0d, 0x1f,
-	0x0e, 0x1f,
-	0x0f, 0x1f,
-	0x08, 0x1f,
-	0x09, 0x1f,
-	0x0a, 0x1f,
-	0x0b, 0x1f,
-	0x0c, 0x1f,
-	0x0d, 0x1f,
-	0x0e, 0x1f,
-	0x0f, 0x1f,
-	0x18, 0x1f,
-	0x19, 0x1f,
-	0x1a, 0x1f,
-	0x1b, 0x1f,
-	0x1c, 0x1f,
-	0x1d, 0x1f,
-	0x16, 0x1f,
-	0x17, 0x1f,
-	0x18, 0x1f,
-	0x19, 0x1f,
-	0x1a, 0x1f,
-	0x1b, 0x1f,
-	0x1c, 0x1f,
-	0x1d, 0x1f,
-	0x1e, 0x1f,
-	0x1f, 0x1f,
-	0x28, 0x1f,
-	0x29, 0x1f,
-	0x2a, 0x1f,
-	0x2b, 0x1f,
-	0x2c, 0x1f,
-	0x2d, 0x1f,
-	0x2e, 0x1f,
-	0x2f, 0x1f,
-	0x28, 0x1f,
-	0x29, 0x1f,
-	0x2a, 0x1f,
-	0x2b, 0x1f,
-	0x2c, 0x1f,
-	0x2d, 0x1f,
-	0x2e, 0x1f,
-	0x2f, 0x1f,
-	0x38, 0x1f,
-	0x39, 0x1f,
-	0x3a, 0x1f,
-	0x3b, 0x1f,
-	0x3c, 0x1f,
-	0x3d, 0x1f,
-	0x3e, 0x1f,
-	0x3f, 0x1f,
-	0x38, 0x1f,
-	0x39, 0x1f,
-	0x3a, 0x1f,
-	0x3b, 0x1f,
-	0x3c, 0x1f,
-	0x3d, 0x1f,
-	0x3e, 0x1f,
-	0x3f, 0x1f,
-	0x48, 0x1f,
-	0x49, 0x1f,
-	0x4a, 0x1f,
-	0x4b, 0x1f,
-	0x4c, 0x1f,
-	0x4d, 0x1f,
-	0x46, 0x1f,
-	0x47, 0x1f,
-	0x48, 0x1f,
-	0x49, 0x1f,
-	0x4a, 0x1f,
-	0x4b, 0x1f,
-	0x4c, 0x1f,
-	0x4d, 0x1f,
-	0x4e, 0x1f,
-	0x4f, 0x1f,
-	0x50, 0x1f,
-	0x59, 0x1f,
-	0x52, 0x1f,
-	0x5b, 0x1f,
-	0x54, 0x1f,
-	0x5d, 0x1f,
-	0x56, 0x1f,
-	0x5f, 0x1f,
-	0x58, 0x1f,
-	0x59, 0x1f,
-	0x5a, 0x1f,
-	0x5b, 0x1f,
-	0x5c, 0x1f,
-	0x5d, 0x1f,
-	0x5e, 0x1f,
-	0x5f, 0x1f,
-	0x68, 0x1f,
-	0x69, 0x1f,
-	0x6a, 0x1f,
-	0x6b, 0x1f,
-	0x6c, 0x1f,
-	0x6d, 0x1f,
-	0x6e, 0x1f,
-	0x6f, 0x1f,
-	0x68, 0x1f,
-	0x69, 0x1f,
-	0x6a, 0x1f,
-	0x6b, 0x1f,
-	0x6c, 0x1f,
-	0x6d, 0x1f,
-	0x6e, 0x1f,
-	0x6f, 0x1f,
-	0xba, 0x1f,
-	0xbb, 0x1f,
-	0xc8, 0x1f,
-	0xc9, 0x1f,
-	0xca, 0x1f,
-	0xcb, 0x1f,
-	0xda, 0x1f,
-	0xdb, 0x1f,
-	0xf8, 0x1f,
-	0xf9, 0x1f,
-	0xea, 0x1f,
-	0xeb, 0x1f,
-	0xfa, 0x1f,
-	0xfb, 0x1f,
-	0x7e, 0x1f,
-	0x7f, 0x1f,
-	0x88, 0x1f,
-	0x89, 0x1f,
-	0x8a, 0x1f,
-	0x8b, 0x1f,
-	0x8c, 0x1f,
-	0x8d, 0x1f,
-	0x8e, 0x1f,
-	0x8f, 0x1f,
-	0x88, 0x1f,
-	0x89, 0x1f,
-	0x8a, 0x1f,
-	0x8b, 0x1f,
-	0x8c, 0x1f,
-	0x8d, 0x1f,
-	0x8e, 0x1f,
-	0x8f, 0x1f,
-	0x98, 0x1f,
-	0x99, 0x1f,
-	0x9a, 0x1f,
-	0x9b, 0x1f,
-	0x9c, 0x1f,
-	0x9d, 0x1f,
-	0x9e, 0x1f,
-	0x9f, 0x1f,
-	0x98, 0x1f,
-	0x99, 0x1f,
-	0x9a, 0x1f,
-	0x9b, 0x1f,
-	0x9c, 0x1f,
-	0x9d, 0x1f,
-	0x9e, 0x1f,
-	0x9f, 0x1f,
-	0xa8, 0x1f,
-	0xa9, 0x1f,
-	0xaa, 0x1f,
-	0xab, 0x1f,
-	0xac, 0x1f,
-	0xad, 0x1f,
-	0xae, 0x1f,
-	0xaf, 0x1f,
-	0xa8, 0x1f,
-	0xa9, 0x1f,
-	0xaa, 0x1f,
-	0xab, 0x1f,
-	0xac, 0x1f,
-	0xad, 0x1f,
-	0xae, 0x1f,
-	0xaf, 0x1f,
-	0xb8, 0x1f,
-	0xb9, 0x1f,
-	0xb2, 0x1f,
-	0xbc, 0x1f,
-	0xb4, 0x1f,
-	0xb5, 0x1f,
-	0xb6, 0x1f,
-	0xb7, 0x1f,
-	0xb8, 0x1f,
-	0xb9, 0x1f,
-	0xba, 0x1f,
-	0xbb, 0x1f,
-	0xbc, 0x1f,
-	0xbd, 0x1f,
-	0xbe, 0x1f,
-	0xbf, 0x1f,
-	0xc0, 0x1f,
-	0xc1, 0x1f,
-	0xc2, 0x1f,
-	0xc3, 0x1f,
-	0xc4, 0x1f,
-	0xc5, 0x1f,
-	0xc6, 0x1f,
-	0xc7, 0x1f,
-	0xc8, 0x1f,
-	0xc9, 0x1f,
-	0xca, 0x1f,
-	0xcb, 0x1f,
-	0xc3, 0x1f,
-	0xcd, 0x1f,
-	0xce, 0x1f,
-	0xcf, 0x1f,
-	0xd8, 0x1f,
-	0xd9, 0x1f,
-	0xd2, 0x1f,
-	0xd3, 0x1f,
-	0xd4, 0x1f,
-	0xd5, 0x1f,
-	0xd6, 0x1f,
-	0xd7, 0x1f,
-	0xd8, 0x1f,
-	0xd9, 0x1f,
-	0xda, 0x1f,
-	0xdb, 0x1f,
-	0xdc, 0x1f,
-	0xdd, 0x1f,
-	0xde, 0x1f,
-	0xdf, 0x1f,
-	0xe8, 0x1f,
-	0xe9, 0x1f,
-	0xe2, 0x1f,
-	0xe3, 0x1f,
-	0xe4, 0x1f,
-	0xec, 0x1f,
-	0xe6, 0x1f,
-	0xe7, 0x1f,
-	0xe8, 0x1f,
-	0xe9, 0x1f,
-	0xea, 0x1f,
-	0xeb, 0x1f,
-	0xec, 0x1f,
-	0xed, 0x1f,
-	0xee, 0x1f,
-	0xef, 0x1f,
-	0xf0, 0x1f,
-	0xf1, 0x1f,
-	0xf2, 0x1f,
-	0xf3, 0x1f,
-	0xf4, 0x1f,
-	0xf5, 0x1f,
-	0xf6, 0x1f,
-	0xf7, 0x1f,
-	0xf8, 0x1f,
-	0xf9, 0x1f,
-	0xfa, 0x1f,
-	0xfb, 0x1f,
-	0xf3, 0x1f,
-	0xfd, 0x1f,
-	0xfe, 0x1f,
-	0xff, 0x1f,
-	0x00, 0x20,
-	0x01, 0x20,
-	0x02, 0x20,
-	0x03, 0x20,
-	0x04, 0x20,
-	0x05, 0x20,
-	0x06, 0x20,
-	0x07, 0x20,
-	0x08, 0x20,
-	0x09, 0x20,
-	0x0a, 0x20,
-	0x0b, 0x20,
-	0x0c, 0x20,
-	0x0d, 0x20,
-	0x0e, 0x20,
-	0x0f, 0x20,
-	0x10, 0x20,
-	0x11, 0x20,
-	0x12, 0x20,
-	0x13, 0x20,
-	0x14, 0x20,
-	0x15, 0x20,
-	0x16, 0x20,
-	0x17, 0x20,
-	0x18, 0x20,
-	0x19, 0x20,
-	0x1a, 0x20,
-	0x1b, 0x20,
-	0x1c, 0x20,
-	0x1d, 0x20,
-	0x1e, 0x20,
-	0x1f, 0x20,
-	0x20, 0x20,
-	0x21, 0x20,
-	0x22, 0x20,
-	0x23, 0x20,
-	0x24, 0x20,
-	0x25, 0x20,
-	0x26, 0x20,
-	0x27, 0x20,
-	0x28, 0x20,
-	0x29, 0x20,
-	0x2a, 0x20,
-	0x2b, 0x20,
-	0x2c, 0x20,
-	0x2d, 0x20,
-	0x2e, 0x20,
-	0x2f, 0x20,
-	0x30, 0x20,
-	0x31, 0x20,
-	0x32, 0x20,
-	0x33, 0x20,
-	0x34, 0x20,
-	0x35, 0x20,
-	0x36, 0x20,
-	0x37, 0x20,
-	0x38, 0x20,
-	0x39, 0x20,
-	0x3a, 0x20,
-	0x3b, 0x20,
-	0x3c, 0x20,
-	0x3d, 0x20,
-	0x3e, 0x20,
-	0x3f, 0x20,
-	0x40, 0x20,
-	0x41, 0x20,
-	0x42, 0x20,
-	0x43, 0x20,
-	0x44, 0x20,
-	0x45, 0x20,
-	0x46, 0x20,
-	0x47, 0x20,
-	0x48, 0x20,
-	0x49, 0x20,
-	0x4a, 0x20,
-	0x4b, 0x20,
-	0x4c, 0x20,
-	0x4d, 0x20,
-	0x4e, 0x20,
-	0x4f, 0x20,
-	0x50, 0x20,
-	0x51, 0x20,
-	0x52, 0x20,
-	0x53, 0x20,
-	0x54, 0x20,
-	0x55, 0x20,
-	0x56, 0x20,
-	0x57, 0x20,
-	0x58, 0x20,
-	0x59, 0x20,
-	0x5a, 0x20,
-	0x5b, 0x20,
-	0x5c, 0x20,
-	0x5d, 0x20,
-	0x5e, 0x20,
-	0x5f, 0x20,
-	0x60, 0x20,
-	0x61, 0x20,
-	0x62, 0x20,
-	0x63, 0x20,
-	0x64, 0x20,
-	0x65, 0x20,
-	0x66, 0x20,
-	0x67, 0x20,
-	0x68, 0x20,
-	0x69, 0x20,
-	0x6a, 0x20,
-	0x6b, 0x20,
-	0x6c, 0x20,
-	0x6d, 0x20,
-	0x6e, 0x20,
-	0x6f, 0x20,
-	0x70, 0x20,
-	0x71, 0x20,
-	0x72, 0x20,
-	0x73, 0x20,
-	0x74, 0x20,
-	0x75, 0x20,
-	0x76, 0x20,
-	0x77, 0x20,
-	0x78, 0x20,
-	0x79, 0x20,
-	0x7a, 0x20,
-	0x7b, 0x20,
-	0x7c, 0x20,
-	0x7d, 0x20,
-	0x7e, 0x20,
-	0x7f, 0x20,
-	0x80, 0x20,
-	0x81, 0x20,
-	0x82, 0x20,
-	0x83, 0x20,
-	0x84, 0x20,
-	0x85, 0x20,
-	0x86, 0x20,
-	0x87, 0x20,
-	0x88, 0x20,
-	0x89, 0x20,
-	0x8a, 0x20,
-	0x8b, 0x20,
-	0x8c, 0x20,
-	0x8d, 0x20,
-	0x8e, 0x20,
-	0x8f, 0x20,
-	0x90, 0x20,
-	0x91, 0x20,
-	0x92, 0x20,
-	0x93, 0x20,
-	0x94, 0x20,
-	0x95, 0x20,
-	0x96, 0x20,
-	0x97, 0x20,
-	0x98, 0x20,
-	0x99, 0x20,
-	0x9a, 0x20,
-	0x9b, 0x20,
-	0x9c, 0x20,
-	0x9d, 0x20,
-	0x9e, 0x20,
-	0x9f, 0x20,
-	0xa0, 0x20,
-	0xa1, 0x20,
-	0xa2, 0x20,
-	0xa3, 0x20,
-	0xa4, 0x20,
-	0xa5, 0x20,
-	0xa6, 0x20,
-	0xa7, 0x20,
-	0xa8, 0x20,
-	0xa9, 0x20,
-	0xaa, 0x20,
-	0xab, 0x20,
-	0xac, 0x20,
-	0xad, 0x20,
-	0xae, 0x20,
-	0xaf, 0x20,
-	0xb0, 0x20,
-	0xb1, 0x20,
-	0xb2, 0x20,
-	0xb3, 0x20,
-	0xb4, 0x20,
-	0xb5, 0x20,
-	0xb6, 0x20,
-	0xb7, 0x20,
-	0xb8, 0x20,
-	0xb9, 0x20,
-	0xba, 0x20,
-	0xbb, 0x20,
-	0xbc, 0x20,
-	0xbd, 0x20,
-	0xbe, 0x20,
-	0xbf, 0x20,
-	0xc0, 0x20,
-	0xc1, 0x20,
-	0xc2, 0x20,
-	0xc3, 0x20,
-	0xc4, 0x20,
-	0xc5, 0x20,
-	0xc6, 0x20,
-	0xc7, 0x20,
-	0xc8, 0x20,
-	0xc9, 0x20,
-	0xca, 0x20,
-	0xcb, 0x20,
-	0xcc, 0x20,
-	0xcd, 0x20,
-	0xce, 0x20,
-	0xcf, 0x20,
-	0xd0, 0x20,
-	0xd1, 0x20,
-	0xd2, 0x20,
-	0xd3, 0x20,
-	0xd4, 0x20,
-	0xd5, 0x20,
-	0xd6, 0x20,
-	0xd7, 0x20,
-	0xd8, 0x20,
-	0xd9, 0x20,
-	0xda, 0x20,
-	0xdb, 0x20,
-	0xdc, 0x20,
-	0xdd, 0x20,
-	0xde, 0x20,
-	0xdf, 0x20,
-	0xe0, 0x20,
-	0xe1, 0x20,
-	0xe2, 0x20,
-	0xe3, 0x20,
-	0xe4, 0x20,
-	0xe5, 0x20,
-	0xe6, 0x20,
-	0xe7, 0x20,
-	0xe8, 0x20,
-	0xe9, 0x20,
-	0xea, 0x20,
-	0xeb, 0x20,
-	0xec, 0x20,
-	0xed, 0x20,
-	0xee, 0x20,
-	0xef, 0x20,
-	0xf0, 0x20,
-	0xf1, 0x20,
-	0xf2, 0x20,
-	0xf3, 0x20,
-	0xf4, 0x20,
-	0xf5, 0x20,
-	0xf6, 0x20,
-	0xf7, 0x20,
-	0xf8, 0x20,
-	0xf9, 0x20,
-	0xfa, 0x20,
-	0xfb, 0x20,
-	0xfc, 0x20,
-	0xfd, 0x20,
-	0xfe, 0x20,
-	0xff, 0x20,
-	0x00, 0x21,
-	0x01, 0x21,
-	0x02, 0x21,
-	0x03, 0x21,
-	0x04, 0x21,
-	0x05, 0x21,
-	0x06, 0x21,
-	0x07, 0x21,
-	0x08, 0x21,
-	0x09, 0x21,
-	0x0a, 0x21,
-	0x0b, 0x21,
-	0x0c, 0x21,
-	0x0d, 0x21,
-	0x0e, 0x21,
-	0x0f, 0x21,
-	0x10, 0x21,
-	0x11, 0x21,
-	0x12, 0x21,
-	0x13, 0x21,
-	0x14, 0x21,
-	0x15, 0x21,
-	0x16, 0x21,
-	0x17, 0x21,
-	0x18, 0x21,
-	0x19, 0x21,
-	0x1a, 0x21,
-	0x1b, 0x21,
-	0x1c, 0x21,
-	0x1d, 0x21,
-	0x1e, 0x21,
-	0x1f, 0x21,
-	0x20, 0x21,
-	0x21, 0x21,
-	0x22, 0x21,
-	0x23, 0x21,
-	0x24, 0x21,
-	0x25, 0x21,
-	0x26, 0x21,
-	0x27, 0x21,
-	0x28, 0x21,
-	0x29, 0x21,
-	0x2a, 0x21,
-	0x2b, 0x21,
-	0x2c, 0x21,
-	0x2d, 0x21,
-	0x2e, 0x21,
-	0x2f, 0x21,
-	0x30, 0x21,
-	0x31, 0x21,
-	0x32, 0x21,
-	0x33, 0x21,
-	0x34, 0x21,
-	0x35, 0x21,
-	0x36, 0x21,
-	0x37, 0x21,
-	0x38, 0x21,
-	0x39, 0x21,
-	0x3a, 0x21,
-	0x3b, 0x21,
-	0x3c, 0x21,
-	0x3d, 0x21,
-	0x3e, 0x21,
-	0x3f, 0x21,
-	0x40, 0x21,
-	0x41, 0x21,
-	0x42, 0x21,
-	0x43, 0x21,
-	0x44, 0x21,
-	0x45, 0x21,
-	0x46, 0x21,
-	0x47, 0x21,
-	0x48, 0x21,
-	0x49, 0x21,
-	0x4a, 0x21,
-	0x4b, 0x21,
-	0x4c, 0x21,
-	0x4d, 0x21,
-	0x32, 0x21,
-	0x4f, 0x21,
-	0x50, 0x21,
-	0x51, 0x21,
-	0x52, 0x21,
-	0x53, 0x21,
-	0x54, 0x21,
-	0x55, 0x21,
-	0x56, 0x21,
-	0x57, 0x21,
-	0x58, 0x21,
-	0x59, 0x21,
-	0x5a, 0x21,
-	0x5b, 0x21,
-	0x5c, 0x21,
-	0x5d, 0x21,
-	0x5e, 0x21,
-	0x5f, 0x21,
-	0x60, 0x21,
-	0x61, 0x21,
-	0x62, 0x21,
-	0x63, 0x21,
-	0x64, 0x21,
-	0x65, 0x21,
-	0x66, 0x21,
-	0x67, 0x21,
-	0x68, 0x21,
-	0x69, 0x21,
-	0x6a, 0x21,
-	0x6b, 0x21,
-	0x6c, 0x21,
-	0x6d, 0x21,
-	0x6e, 0x21,
-	0x6f, 0x21,
-	0x60, 0x21,
-	0x61, 0x21,
-	0x62, 0x21,
-	0x63, 0x21,
-	0x64, 0x21,
-	0x65, 0x21,
-	0x66, 0x21,
-	0x67, 0x21,
-	0x68, 0x21,
-	0x69, 0x21,
-	0x6a, 0x21,
-	0x6b, 0x21,
-	0x6c, 0x21,
-	0x6d, 0x21,
-	0x6e, 0x21,
-	0x6f, 0x21,
-	0x80, 0x21,
-	0x81, 0x21,
-	0x82, 0x21,
-	0x83, 0x21,
-	0x83, 0x21,
-	0xff, 0xff,
-	0x4b, 0x03,
-	0xb6, 0x24,
-	0xb7, 0x24,
-	0xb8, 0x24,
-	0xb9, 0x24,
-	0xba, 0x24,
-	0xbb, 0x24,
-	0xbc, 0x24,
-	0xbd, 0x24,
-	0xbe, 0x24,
-	0xbf, 0x24,
-	0xc0, 0x24,
-	0xc1, 0x24,
-	0xc2, 0x24,
-	0xc3, 0x24,
-	0xc4, 0x24,
-	0xc5, 0x24,
-	0xc6, 0x24,
-	0xc7, 0x24,
-	0xc8, 0x24,
-	0xc9, 0x24,
-	0xca, 0x24,
-	0xcb, 0x24,
-	0xcc, 0x24,
-	0xcd, 0x24,
-	0xce, 0x24,
-	0xcf, 0x24,
-	0xff, 0xff,
-	0x46, 0x07,
-	0x00, 0x2c,
-	0x01, 0x2c,
-	0x02, 0x2c,
-	0x03, 0x2c,
-	0x04, 0x2c,
-	0x05, 0x2c,
-	0x06, 0x2c,
-	0x07, 0x2c,
-	0x08, 0x2c,
-	0x09, 0x2c,
-	0x0a, 0x2c,
-	0x0b, 0x2c,
-	0x0c, 0x2c,
-	0x0d, 0x2c,
-	0x0e, 0x2c,
-	0x0f, 0x2c,
-	0x10, 0x2c,
-	0x11, 0x2c,
-	0x12, 0x2c,
-	0x13, 0x2c,
-	0x14, 0x2c,
-	0x15, 0x2c,
-	0x16, 0x2c,
-	0x17, 0x2c,
-	0x18, 0x2c,
-	0x19, 0x2c,
-	0x1a, 0x2c,
-	0x1b, 0x2c,
-	0x1c, 0x2c,
-	0x1d, 0x2c,
-	0x1e, 0x2c,
-	0x1f, 0x2c,
-	0x20, 0x2c,
-	0x21, 0x2c,
-	0x22, 0x2c,
-	0x23, 0x2c,
-	0x24, 0x2c,
-	0x25, 0x2c,
-	0x26, 0x2c,
-	0x27, 0x2c,
-	0x28, 0x2c,
-	0x29, 0x2c,
-	0x2a, 0x2c,
-	0x2b, 0x2c,
-	0x2c, 0x2c,
-	0x2d, 0x2c,
-	0x2e, 0x2c,
-	0x5f, 0x2c,
-	0x60, 0x2c,
-	0x60, 0x2c,
-	0x62, 0x2c,
-	0x63, 0x2c,
-	0x64, 0x2c,
-	0x65, 0x2c,
-	0x66, 0x2c,
-	0x67, 0x2c,
-	0x67, 0x2c,
-	0x69, 0x2c,
-	0x69, 0x2c,
-	0x6b, 0x2c,
-	0x6b, 0x2c,
-	0x6d, 0x2c,
-	0x6e, 0x2c,
-	0x6f, 0x2c,
-	0x70, 0x2c,
-	0x71, 0x2c,
-	0x72, 0x2c,
-	0x73, 0x2c,
-	0x74, 0x2c,
-	0x75, 0x2c,
-	0x75, 0x2c,
-	0x77, 0x2c,
-	0x78, 0x2c,
-	0x79, 0x2c,
-	0x7a, 0x2c,
-	0x7b, 0x2c,
-	0x7c, 0x2c,
-	0x7d, 0x2c,
-	0x7e, 0x2c,
-	0x7f, 0x2c,
-	0x80, 0x2c,
-	0x80, 0x2c,
-	0x82, 0x2c,
-	0x82, 0x2c,
-	0x84, 0x2c,
-	0x84, 0x2c,
-	0x86, 0x2c,
-	0x86, 0x2c,
-	0x88, 0x2c,
-	0x88, 0x2c,
-	0x8a, 0x2c,
-	0x8a, 0x2c,
-	0x8c, 0x2c,
-	0x8c, 0x2c,
-	0x8e, 0x2c,
-	0x8e, 0x2c,
-	0x90, 0x2c,
-	0x90, 0x2c,
-	0x92, 0x2c,
-	0x92, 0x2c,
-	0x94, 0x2c,
-	0x94, 0x2c,
-	0x96, 0x2c,
-	0x96, 0x2c,
-	0x98, 0x2c,
-	0x98, 0x2c,
-	0x9a, 0x2c,
-	0x9a, 0x2c,
-	0x9c, 0x2c,
-	0x9c, 0x2c,
-	0x9e, 0x2c,
-	0x9e, 0x2c,
-	0xa0, 0x2c,
-	0xa0, 0x2c,
-	0xa2, 0x2c,
-	0xa2, 0x2c,
-	0xa4, 0x2c,
-	0xa4, 0x2c,
-	0xa6, 0x2c,
-	0xa6, 0x2c,
-	0xa8, 0x2c,
-	0xa8, 0x2c,
-	0xaa, 0x2c,
-	0xaa, 0x2c,
-	0xac, 0x2c,
-	0xac, 0x2c,
-	0xae, 0x2c,
-	0xae, 0x2c,
-	0xb0, 0x2c,
-	0xb0, 0x2c,
-	0xb2, 0x2c,
-	0xb2, 0x2c,
-	0xb4, 0x2c,
-	0xb4, 0x2c,
-	0xb6, 0x2c,
-	0xb6, 0x2c,
-	0xb8, 0x2c,
-	0xb8, 0x2c,
-	0xba, 0x2c,
-	0xba, 0x2c,
-	0xbc, 0x2c,
-	0xbc, 0x2c,
-	0xbe, 0x2c,
-	0xbe, 0x2c,
-	0xc0, 0x2c,
-	0xc0, 0x2c,
-	0xc2, 0x2c,
-	0xc2, 0x2c,
-	0xc4, 0x2c,
-	0xc4, 0x2c,
-	0xc6, 0x2c,
-	0xc6, 0x2c,
-	0xc8, 0x2c,
-	0xc8, 0x2c,
-	0xca, 0x2c,
-	0xca, 0x2c,
-	0xcc, 0x2c,
-	0xcc, 0x2c,
-	0xce, 0x2c,
-	0xce, 0x2c,
-	0xd0, 0x2c,
-	0xd0, 0x2c,
-	0xd2, 0x2c,
-	0xd2, 0x2c,
-	0xd4, 0x2c,
-	0xd4, 0x2c,
-	0xd6, 0x2c,
-	0xd6, 0x2c,
-	0xd8, 0x2c,
-	0xd8, 0x2c,
-	0xda, 0x2c,
-	0xda, 0x2c,
-	0xdc, 0x2c,
-	0xdc, 0x2c,
-	0xde, 0x2c,
-	0xde, 0x2c,
-	0xe0, 0x2c,
-	0xe0, 0x2c,
-	0xe2, 0x2c,
-	0xe2, 0x2c,
-	0xe4, 0x2c,
-	0xe5, 0x2c,
-	0xe6, 0x2c,
-	0xe7, 0x2c,
-	0xe8, 0x2c,
-	0xe9, 0x2c,
-	0xea, 0x2c,
-	0xeb, 0x2c,
-	0xec, 0x2c,
-	0xed, 0x2c,
-	0xee, 0x2c,
-	0xef, 0x2c,
-	0xf0, 0x2c,
-	0xf1, 0x2c,
-	0xf2, 0x2c,
-	0xf3, 0x2c,
-	0xf4, 0x2c,
-	0xf5, 0x2c,
-	0xf6, 0x2c,
-	0xf7, 0x2c,
-	0xf8, 0x2c,
-	0xf9, 0x2c,
-	0xfa, 0x2c,
-	0xfb, 0x2c,
-	0xfc, 0x2c,
-	0xfd, 0x2c,
-	0xfe, 0x2c,
-	0xff, 0x2c,
-	0xa0, 0x10,
-	0xa1, 0x10,
-	0xa2, 0x10,
-	0xa3, 0x10,
-	0xa4, 0x10,
-	0xa5, 0x10,
-	0xa6, 0x10,
-	0xa7, 0x10,
-	0xa8, 0x10,
-	0xa9, 0x10,
-	0xaa, 0x10,
-	0xab, 0x10,
-	0xac, 0x10,
-	0xad, 0x10,
-	0xae, 0x10,
-	0xaf, 0x10,
-	0xb0, 0x10,
-	0xb1, 0x10,
-	0xb2, 0x10,
-	0xb3, 0x10,
-	0xb4, 0x10,
-	0xb5, 0x10,
-	0xb6, 0x10,
-	0xb7, 0x10,
-	0xb8, 0x10,
-	0xb9, 0x10,
-	0xba, 0x10,
-	0xbb, 0x10,
-	0xbc, 0x10,
-	0xbd, 0x10,
-	0xbe, 0x10,
-	0xbf, 0x10,
-	0xc0, 0x10,
-	0xc1, 0x10,
-	0xc2, 0x10,
-	0xc3, 0x10,
-	0xc4, 0x10,
-	0xc5, 0x10,
-	0xff, 0xff,
-	0x1b, 0xd2,
-	0x21, 0xff,
-	0x22, 0xff,
-	0x23, 0xff,
-	0x24, 0xff,
-	0x25, 0xff,
-	0x26, 0xff,
-	0x27, 0xff,
-	0x28, 0xff,
-	0x29, 0xff,
-	0x2a, 0xff,
-	0x2b, 0xff,
-	0x2c, 0xff,
-	0x2d, 0xff,
-	0x2e, 0xff,
-	0x2f, 0xff,
-	0x30, 0xff,
-	0x31, 0xff,
-	0x32, 0xff,
-	0x33, 0xff,
-	0x34, 0xff,
-	0x35, 0xff,
-	0x36, 0xff,
-	0x37, 0xff,
-	0x38, 0xff,
-	0x39, 0xff,
-	0x3a, 0xff,
-	0x5b, 0xff,
-	0x5c, 0xff,
-	0x5d, 0xff,
-	0x5e, 0xff,
-	0x5f, 0xff,
-	0x60, 0xff,
-	0x61, 0xff,
-	0x62, 0xff,
-	0x63, 0xff,
-	0x64, 0xff,
-	0x65, 0xff,
-	0x66, 0xff,
-	0x67, 0xff,
-	0x68, 0xff,
-	0x69, 0xff,
-	0x6a, 0xff,
-	0x6b, 0xff,
-	0x6c, 0xff,
-	0x6d, 0xff,
-	0x6e, 0xff,
-	0x6f, 0xff,
-	0x70, 0xff,
-	0x71, 0xff,
-	0x72, 0xff,
-	0x73, 0xff,
-	0x74, 0xff,
-	0x75, 0xff,
-	0x76, 0xff,
-	0x77, 0xff,
-	0x78, 0xff,
-	0x79, 0xff,
-	0x7a, 0xff,
-	0x7b, 0xff,
-	0x7c, 0xff,
-	0x7d, 0xff,
-	0x7e, 0xff,
-	0x7f, 0xff,
-	0x80, 0xff,
-	0x81, 0xff,
-	0x82, 0xff,
-	0x83, 0xff,
-	0x84, 0xff,
-	0x85, 0xff,
-	0x86, 0xff,
-	0x87, 0xff,
-	0x88, 0xff,
-	0x89, 0xff,
-	0x8a, 0xff,
-	0x8b, 0xff,
-	0x8c, 0xff,
-	0x8d, 0xff,
-	0x8e, 0xff,
-	0x8f, 0xff,
-	0x90, 0xff,
-	0x91, 0xff,
-	0x92, 0xff,
-	0x93, 0xff,
-	0x94, 0xff,
-	0x95, 0xff,
-	0x96, 0xff,
-	0x97, 0xff,
-	0x98, 0xff,
-	0x99, 0xff,
-	0x9a, 0xff,
-	0x9b, 0xff,
-	0x9c, 0xff,
-	0x9d, 0xff,
-	0x9e, 0xff,
-	0x9f, 0xff,
-	0xa0, 0xff,
-	0xa1, 0xff,
-	0xa2, 0xff,
-	0xa3, 0xff,
-	0xa4, 0xff,
-	0xa5, 0xff,
-	0xa6, 0xff,
-	0xa7, 0xff,
-	0xa8, 0xff,
-	0xa9, 0xff,
-	0xaa, 0xff,
-	0xab, 0xff,
-	0xac, 0xff,
-	0xad, 0xff,
-	0xae, 0xff,
-	0xaf, 0xff,
-	0xb0, 0xff,
-	0xb1, 0xff,
-	0xb2, 0xff,
-	0xb3, 0xff,
-	0xb4, 0xff,
-	0xb5, 0xff,
-	0xb6, 0xff,
-	0xb7, 0xff,
-	0xb8, 0xff,
-	0xb9, 0xff,
-	0xba, 0xff,
-	0xbb, 0xff,
-	0xbc, 0xff,
-	0xbd, 0xff,
-	0xbe, 0xff,
-	0xbf, 0xff,
-	0xc0, 0xff,
-	0xc1, 0xff,
-	0xc2, 0xff,
-	0xc3, 0xff,
-	0xc4, 0xff,
-	0xc5, 0xff,
-	0xc6, 0xff,
-	0xc7, 0xff,
-	0xc8, 0xff,
-	0xc9, 0xff,
-	0xca, 0xff,
-	0xcb, 0xff,
-	0xcc, 0xff,
-	0xcd, 0xff,
-	0xce, 0xff,
-	0xcf, 0xff,
-	0xd0, 0xff,
-	0xd1, 0xff,
-	0xd2, 0xff,
-	0xd3, 0xff,
-	0xd4, 0xff,
-	0xd5, 0xff,
-	0xd6, 0xff,
-	0xd7, 0xff,
-	0xd8, 0xff,
-	0xd9, 0xff,
-	0xda, 0xff,
-	0xdb, 0xff,
-	0xdc, 0xff,
-	0xdd, 0xff,
-	0xde, 0xff,
-	0xdf, 0xff,
-	0xe0, 0xff,
-	0xe1, 0xff,
-	0xe2, 0xff,
-	0xe3, 0xff,
-	0xe4, 0xff,
-	0xe5, 0xff,
-	0xe6, 0xff,
-	0xe7, 0xff,
-	0xe8, 0xff,
-	0xe9, 0xff,
-	0xea, 0xff,
-	0xeb, 0xff,
-	0xec, 0xff,
-	0xed, 0xff,
-	0xee, 0xff,
-	0xef, 0xff,
-	0xf0, 0xff,
-	0xf1, 0xff,
-	0xf2, 0xff,
-	0xf3, 0xff,
-	0xf4, 0xff,
-	0xf5, 0xff,
-	0xf6, 0xff,
-	0xf7, 0xff,
-	0xf8, 0xff,
-	0xf9, 0xff,
-	0xfa, 0xff,
-	0xfb, 0xff,
-	0xfc, 0xff,
-	0xfd, 0xff,
-	0xfe, 0xff,
-	0xff, 0xff
-};
-
-#endif
-
-/**
- * @}
- */
Index: pace/app/mkext4/doc/doxygroups.h
===================================================================
--- uspace/app/mkext4/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mkext4 mkext4
- * @brief Tool for creating Ext4 file systems
- * @ingroup apps
- */
Index: pace/app/mkext4/meson.build
===================================================================
--- uspace/app/mkext4/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# FIXME remove transitive deps
-deps = [ 'ext4', 'fs', 'block', 'crypto' ]
-src = files('mkext4.c')
Index: pace/app/mkext4/mkext4.c
===================================================================
--- uspace/app/mkext4/mkext4.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkext4
- * @{
- */
-
-/**
- * @file
- * @brief Tool for creating new Ext4 file systems.
- */
-
-#include <errno.h>
-#include <ext4/filesystem.h>
-#include <loc.h>
-#include <stdio.h>
-#include <str.h>
-
-#define NAME	"mkext4"
-
-static void syntax_print(void);
-static errno_t ext4_version_parse(const char *, ext4_cfg_ver_t *);
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	char *dev_path;
-	service_id_t service_id;
-	ext4_cfg_t cfg;
-	char *endptr;
-	aoff64_t nblocks;
-	const char *label = "";
-	unsigned int bsize = 4096;
-
-	cfg.version = ext4_def_fs_version;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	--argc;
-	++argv;
-
-	while (*argv && *argv[0] == '-') {
-		if (str_cmp(*argv, "--size") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			nblocks = strtol(*argv, &endptr, 10);
-			if (*endptr != '\0') {
-				printf(NAME ": Error, invalid argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "--bsize") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			bsize = strtol(*argv, &endptr, 10);
-			if (*endptr != '\0') {
-				printf(NAME ": Error, invalid argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "--type") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			rc = ext4_version_parse(*argv, &cfg.version);
-			if (rc != EOK) {
-				printf(NAME ": Error, invalid argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "--label") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			label = *argv;
-
-			--argc;
-			++argv;
-			continue;
-		}
-
-		if (str_cmp(*argv, "--help") == 0) {
-			syntax_print();
-			return 0;
-		}
-
-		if (str_cmp(*argv, "-") == 0) {
-			--argc;
-			++argv;
-			break;
-		} else {
-			printf(NAME ": Invalid argument: %s\n", *argv);
-			syntax_print();
-			return 1;
-		}
-	}
-
-	if (argc != 1) {
-		printf(NAME ": Error, unexpected argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	dev_path = *argv;
-	printf("Device: %s\n", dev_path);
-
-	rc = loc_service_get_id(dev_path, &service_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device `%s'.\n", dev_path);
-		return 2;
-	}
-
-	cfg.volume_name = label;
-	cfg.bsize = bsize;
-	(void) nblocks;
-
-	rc = ext4_filesystem_create(&cfg, service_id);
-	if (rc != EOK) {
-		printf(NAME ": Error initializing file system.\n");
-		return 3;
-	}
-
-	printf("Success.\n");
-
-	return 0;
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: mkext4 [<options>...] <device_name>\n");
-	printf("options:\n"
-	    "\t--size <sectors> Filesystem size, overrides device size\n"
-	    "\t--label <label>  Volume label\n"
-	    "\t--type <fstype>  Filesystem type (ext2, ext2old)\n"
-	    "\t--bsize <bytes>  Filesystem block size in bytes (default = 4096)\n");
-}
-
-static errno_t ext4_version_parse(const char *str, ext4_cfg_ver_t *ver)
-{
-	if (str_cmp(str, "ext2old") == 0) {
-		*ver = extver_ext2_old;
-		return EOK;
-	}
-
-	if (str_cmp(str, "ext2") == 0) {
-		*ver = extver_ext2;
-		return EOK;
-	}
-
-	return EINVAL;
-}
-
-/**
- * @}
- */
Index: pace/app/mkfat/doc/doxygroups.h
===================================================================
--- uspace/app/mkfat/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mkfat mkfat
- * @brief Tool for creating FAT file systems
- * @ingroup apps
- */
Index: pace/app/mkfat/fat.h
===================================================================
--- uspace/app/mkfat/fat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkfat
- * @{
- */
-
-#ifndef FAT_FAT_H_
-#define FAT_FAT_H_
-
-#include <stdint.h>
-
-#define BS_BLOCK		0
-#define BS_SIZE			512
-#define DIRENT_SIZE		32
-
-#define FAT12_CLST_MAX    4085
-#define FAT16_CLST_MAX    65525
-
-#define FATAUTO	0
-#define FAT12	12
-#define FAT16	16
-#define FAT32	32
-
-#define FAT_CLUSTER_DOUBLE_SIZE(a) ((a) / 4)
-
-typedef struct fat_bs {
-	/** Jump instruction */
-	uint8_t		ji[3];
-	uint8_t		oem_name[8];
-
-	/* BIOS Parameter Block */
-
-	/** Bytes per sector */
-	uint16_t	bps;
-	/** Sectors per cluster */
-	uint8_t		spc;
-	/** Reserved sector count */
-	uint16_t	rscnt;
-	/** Number of FATs */
-	uint8_t		fatcnt;
-	/** Maximum number of root directory entries */
-	uint16_t	root_ent_max;
-	/** Total sectors. 16-bit version */
-	uint16_t	totsec16;
-	/** Media descriptor */
-	uint8_t		mdesc;
-	/** Sectors per FAT12/FAT16 */
-	uint16_t	sec_per_fat;
-	/** Sectors per track */
-	uint16_t	sec_per_track;
-	/** Number of heads */
-	uint16_t	headcnt;
-	/** Hidden sectors */
-	uint32_t	hidden_sec;
-	/** Total sectors. 32-bit version */
-	uint32_t	totsec32;
-
-	union {
-		struct {
-			/* FAT12/FAT16 only: Extended BIOS Parameter Block */
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[448];
-			/** Boot sector signature. */
-			uint16_t	signature;
-		} __attribute__((packed));
-		struct {
-			/* FAT32 only */
-			/** Sectors per FAT. */
-			uint32_t	sectors_per_fat;
-			/** FAT flags. */
-			uint16_t	flags;
-			/** Version. */
-			uint16_t	version;
-			/** Cluster number of root directory. */
-			uint32_t	root_cluster;
-			/** Sector number of file system information sector. */
-			uint16_t	fsinfo_sec;
-			/** Sector number of boot sector copy. */
-			uint16_t	bscopy_sec;
-			uint8_t		reserved1[12];
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved2;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[420];
-			/** Signature. */
-			uint16_t	signature;
-		} __attribute__((packed)) fat32;
-	};
-} __attribute__((packed)) fat_bs_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/app/mkfat/fat_dentry.h
===================================================================
--- uspace/app/mkfat/fat_dentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkfat
- * @{
- */
-
-#ifndef FAT_FAT_DENTRY_H_
-#define FAT_FAT_DENTRY_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <unaligned.h>
-
-#define IS_D_CHAR(ch) (isalnum(ch) || ch == '_')
-#define FAT_STOP_CHARS "*?/\\\n\t|'"
-
-#define FAT_NAME_LEN		8
-#define FAT_EXT_LEN		3
-#define FAT_VOLLABEL_LEN	11
-
-#define FAT_NAME_DOT		".       "
-#define FAT_NAME_DOT_DOT	"..      "
-#define FAT_EXT_PAD		"   "
-
-#define FAT_ATTR_RDONLY   0x01
-#define FAT_ATTR_HIDDEN   0x02
-#define FAT_ATTR_SYSTEM   0x04
-#define FAT_ATTR_VOLLABEL 0x08
-#define FAT_ATTR_SUBDIR   0x10
-#define FAT_ATTR_ARCHIVE  0x20
-#define FAT_ATTR_LFN \
-    (FAT_ATTR_RDONLY | FAT_ATTR_HIDDEN | FAT_ATTR_SYSTEM | FAT_ATTR_VOLLABEL)
-
-#define FAT_LCASE_LOWER_NAME	0x08
-#define FAT_LCASE_LOWER_EXT	0x10
-
-#define FAT_PAD			' '
-#define FAT_LFN_PAD	0xffff
-#define FAT_SFN_CHAR '_'
-
-#define FAT_DENTRY_UNUSED	0x00
-#define FAT_DENTRY_E5_ESC	0x05
-#define FAT_DENTRY_DOT		0x2e
-#define FAT_DENTRY_ERASED	0xe5
-#define FAT_LFN_LAST		0x40
-#define FAT_LFN_ERASED		0x80
-
-#define FAT_LFN_ORDER(d) ((d)->lfn.order)
-#define FAT_IS_LFN(d) \
-    ((FAT_LFN_ORDER((d)) & FAT_LFN_LAST) == FAT_LFN_LAST)
-#define FAT_LFN_COUNT(d) \
-    (FAT_LFN_ORDER((d)) ^ FAT_LFN_LAST)
-#define FAT_LFN_PART1(d) ((d)->lfn.part1)
-#define FAT_LFN_PART2(d) ((d)->lfn.part2)
-#define FAT_LFN_PART3(d) ((d)->lfn.part3)
-#define FAT_LFN_ATTR(d) ((d)->lfn.attr)
-#define FAT_LFN_CHKSUM(d) ((d)->lfn.check_sum)
-
-#define FAT_LFN_NAME_LEN    260                           /* characters */
-#define FAT_LFN_NAME_SIZE   STR_BOUNDS(FAT_LFN_NAME_LEN)  /* bytes */
-#define FAT_LFN_MAX_COUNT   20
-#define FAT_LFN_PART1_SIZE  5
-#define FAT_LFN_PART2_SIZE  6
-#define FAT_LFN_PART3_SIZE  2
-#define FAT_LFN_ENTRY_SIZE \
-    (FAT_LFN_PART1_SIZE + FAT_LFN_PART2_SIZE + FAT_LFN_PART3_SIZE)
-
-typedef enum {
-	FAT_DENTRY_SKIP,
-	FAT_DENTRY_LAST,
-	FAT_DENTRY_FREE,
-	FAT_DENTRY_VALID,
-	FAT_DENTRY_LFN,
-	FAT_DENTRY_VOLLABEL
-} fat_dentry_clsf_t;
-
-typedef union {
-	struct {
-		uint8_t		name[8];
-		uint8_t		ext[3];
-		uint8_t		attr;
-		uint8_t		lcase;
-		uint8_t		ctime_fine;
-		uint16_t	ctime;
-		uint16_t	cdate;
-		uint16_t	adate;
-		union {
-			uint16_t	eaidx;		/* FAT12/FAT16 */
-			uint16_t	firstc_hi;	/* FAT32 */
-		} __attribute__((packed));
-		uint16_t	mtime;
-		uint16_t	mdate;
-		union {
-			uint16_t	firstc;		/* FAT12/FAT16 */
-			uint16_t	firstc_lo;	/* FAT32 */
-		} __attribute__((packed));
-		uint32_t	size;
-	} __attribute__((packed));
-	struct {
-		uint8_t		order;
-		uint16_t	part1[FAT_LFN_PART1_SIZE];
-		uint8_t		attr;
-		uint8_t		type;
-		uint8_t		check_sum;
-		uint16_t	part2[FAT_LFN_PART2_SIZE];
-		uint16_t	firstc_lo; /* MUST be 0 */
-		uint16_t	part3[FAT_LFN_PART3_SIZE];
-	} __attribute__((packed)) lfn;
-} __attribute__((packed)) fat_dentry_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/app/mkfat/meson.build
===================================================================
--- uspace/app/mkfat/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block' ]
-src = files('mkfat.c')
Index: pace/app/mkfat/mkfat.c
===================================================================
--- uspace/app/mkfat/mkfat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,559 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkfat
- * @{
- */
-
-/**
- * @file	mkfat.c
- * @brief	Tool for creating new FAT file systems.
- *
- * Currently we can create 12/16/32-bit FAT.
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <block.h>
-#include <mem.h>
-#include <loc.h>
-#include <byteorder.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <rndgen.h>
-#include <str.h>
-#include "fat.h"
-#include "fat_dentry.h"
-
-#define NAME	"mkfat"
-
-#define LABEL_NONAME "NO NAME"
-
-/** Divide and round up. */
-#define div_round_up(a, b) (((a) + (b) - 1) / (b))
-
-/** Default file-system parameters */
-enum {
-	default_sector_size		= 512,
-	default_sectors_per_cluster	= 4,
-	default_fat_count		= 2,
-	default_reserved_clusters	= 2,
-	default_media_descriptor	= 0xF8 /**< fixed disk */,
-	fat32_root_cluster		= 2
-};
-
-/** Configurable file-system parameters */
-typedef struct fat_cfg {
-	int fat_type; /* FAT12 = 12, FAT16 = 16, FAT32 = 32 */
-	size_t sector_size;
-	uint32_t total_sectors;
-	uint16_t root_ent_max;
-	uint32_t addt_res_sectors;
-	uint8_t sectors_per_cluster;
-
-	uint16_t reserved_sectors;
-	uint32_t rootdir_sectors;
-	uint32_t fat_sectors;
-	uint32_t total_clusters;
-	uint8_t fat_count;
-	const char *label;
-} fat_cfg_t;
-
-static void syntax_print(void);
-
-static errno_t fat_params_compute(struct fat_cfg *cfg);
-static errno_t fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id);
-static errno_t fat_bootsec_create(struct fat_cfg const *cfg, struct fat_bs *bs);
-
-int main(int argc, char **argv)
-{
-	struct fat_cfg cfg;
-
-	errno_t rc;
-	char *dev_path;
-	service_id_t service_id;
-	char *endptr;
-	aoff64_t dev_nblocks;
-
-	cfg.sector_size = default_sector_size;
-	cfg.sectors_per_cluster = default_sectors_per_cluster;
-	cfg.fat_count = default_fat_count;
-	cfg.total_sectors = 0;
-	cfg.addt_res_sectors = 0;
-	cfg.root_ent_max = 128;
-	cfg.fat_type = FATAUTO;
-	cfg.label = NULL;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	--argc;
-	++argv;
-
-	while (*argv[0] == '-') {
-		if (str_cmp(*argv, "--size") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			cfg.total_sectors = strtol(*argv, &endptr, 10);
-			if (*endptr != '\0') {
-				printf(NAME ": Error, invalid argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			--argc;
-			++argv;
-		}
-
-		if (str_cmp(*argv, "--type") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			cfg.fat_type = strtol(*argv, &endptr, 10);
-			if (*endptr != '\0') {
-				printf(NAME ": Error, invalid argument.\n");
-				syntax_print();
-				return 1;
-			}
-
-			--argc;
-			++argv;
-		}
-
-		if (str_cmp(*argv, "--label") == 0) {
-			--argc;
-			++argv;
-			if (*argv == NULL) {
-				printf(NAME ": Error, argument missing.\n");
-				syntax_print();
-				return 1;
-			}
-
-			cfg.label = *argv;
-
-			--argc;
-			++argv;
-		}
-
-		if (str_cmp(*argv, "-") == 0) {
-			--argc;
-			++argv;
-			break;
-		}
-	}
-
-	if (argc != 1) {
-		printf(NAME ": Error, unexpected argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	dev_path = *argv;
-	printf("Device: %s\n", dev_path);
-
-	rc = loc_service_get_id(dev_path, &service_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device `%s'.\n", dev_path);
-		return 2;
-	}
-
-	rc = block_init(service_id);
-	if (rc != EOK)  {
-		printf(NAME ": Error initializing libblock.\n");
-		return 2;
-	}
-
-	rc = block_get_bsize(service_id, &cfg.sector_size);
-	if (rc != EOK) {
-		printf(NAME ": Error determining device block size.\n");
-		return 2;
-	}
-
-	rc = block_get_nblocks(service_id, &dev_nblocks);
-	if (rc != EOK) {
-		printf(NAME ": Warning, failed to obtain block device size.\n");
-	} else {
-		printf(NAME ": Block device has %" PRIuOFF64 " blocks.\n",
-		    dev_nblocks);
-		if (!cfg.total_sectors || dev_nblocks < cfg.total_sectors)
-			cfg.total_sectors = dev_nblocks;
-	}
-
-	if (cfg.total_sectors == 0) {
-		printf(NAME ": Error. You must specify filesystem size.\n");
-		return 1;
-	}
-
-	if (cfg.fat_type != FATAUTO && cfg.fat_type != FAT12 && cfg.fat_type != FAT16 &&
-	    cfg.fat_type != FAT32) {
-		printf(NAME ": Error. Unknown FAT type.\n");
-		return 2;
-	}
-
-	printf(NAME ": Creating FAT filesystem on device %s.\n", dev_path);
-
-	rc = fat_params_compute(&cfg);
-	if (rc != EOK) {
-		printf(NAME ": Invalid file-system parameters.\n");
-		return 2;
-	}
-
-	printf(NAME ": Filesystem type FAT%d.\n", cfg.fat_type);
-
-	rc = fat_blocks_write(&cfg, service_id);
-	if (rc != EOK) {
-		printf(NAME ": Error writing device.\n");
-		return 2;
-	}
-
-	block_fini(service_id);
-	printf("Success.\n");
-
-	return 0;
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: mkfat [<options>...] <device_name>\n");
-	printf("options:\n"
-	    "\t--size <sectors> Filesystem size, overrides device size\n"
-	    "\t--type 12|16|32  FAT type (auto-detected by default)\n"
-	    "\t--label <label>  Volume label\n");
-}
-
-static errno_t fat_label_encode(void *dest, const char *src)
-{
-	int i;
-	const char *sp;
-	uint8_t *dp;
-
-	i = 0;
-	sp = src;
-	dp = (uint8_t *)dest;
-
-	while (*sp != '\0' && i < FAT_VOLLABEL_LEN) {
-		if (!ascii_check(*sp))
-			return EINVAL;
-		if (dp != NULL)
-			dp[i] = toupper(*sp);
-		++i;
-		++sp;
-	}
-
-	while (i < FAT_VOLLABEL_LEN) {
-		if (dp != NULL)
-			dp[i] = FAT_PAD;
-		++i;
-	}
-
-	return EOK;
-}
-
-/** Derive sizes of different filesystem structures.
- *
- * This function concentrates all the different computations of FAT
- * file system params.
- */
-static errno_t fat_params_compute(struct fat_cfg *cfg)
-{
-	uint32_t fat_bytes;
-	uint32_t non_data_sectors_lb_16;
-	uint32_t non_data_sectors_lb;
-	uint32_t rd_sectors;
-	uint32_t tot_clust_16;
-
-	/*
-	 * Make a conservative guess on the FAT size needed for the file
-	 * system. The optimum could be potentially smaller since we
-	 * do not subtract size of the FAT itself when computing the
-	 * size of the data region. Also the root dir area might not
-	 * need FAT entries if we decide to make a FAT32.
-	 */
-
-	cfg->reserved_sectors = 1 + cfg->addt_res_sectors;
-
-	/* Only correct for FAT12/16 (FAT32 has root dir stored in clusters) */
-	rd_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE,
-	    cfg->sector_size);
-	non_data_sectors_lb_16 = cfg->reserved_sectors + rd_sectors;
-
-	/* Only correct for FAT12/16 */
-	tot_clust_16 = div_round_up(cfg->total_sectors - non_data_sectors_lb_16,
-	    cfg->sectors_per_cluster);
-
-	/* Now detect FAT type */
-	if (tot_clust_16 <= FAT12_CLST_MAX) {
-		if (cfg->fat_type == FATAUTO)
-			cfg->fat_type = FAT12;
-		else if (cfg->fat_type != FAT12)
-			return EINVAL;
-	} else if (tot_clust_16 <= FAT16_CLST_MAX) {
-		if (cfg->fat_type == FATAUTO)
-			cfg->fat_type = FAT16;
-		else if (cfg->fat_type != FAT16)
-			return EINVAL;
-	} else {
-		if (cfg->fat_type == FATAUTO)
-			cfg->fat_type = FAT32;
-		else if (cfg->fat_type != FAT32)
-			return EINVAL;
-	}
-
-	/* Actual root directory size, non-data sectors */
-	if (cfg->fat_type != FAT32) {
-		cfg->rootdir_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE,
-		    cfg->sector_size);
-		non_data_sectors_lb = cfg->reserved_sectors + cfg->rootdir_sectors;
-
-	} else {
-		/* We create a single-cluster root dir */
-		cfg->rootdir_sectors = cfg->sectors_per_cluster;
-		non_data_sectors_lb = cfg->reserved_sectors;
-	}
-
-	/* Actual total number of clusters */
-	cfg->total_clusters = div_round_up(cfg->total_sectors - non_data_sectors_lb,
-	    cfg->sectors_per_cluster);
-
-	fat_bytes = div_round_up((cfg->total_clusters + 2) *
-	    FAT_CLUSTER_DOUBLE_SIZE(cfg->fat_type), 2);
-	cfg->fat_sectors = div_round_up(fat_bytes, cfg->sector_size);
-
-	if (cfg->label != NULL && fat_label_encode(NULL, cfg->label) != EOK)
-		return EINVAL;
-
-	return EOK;
-}
-
-/** Create file system with the given parameters. */
-static errno_t fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id)
-{
-	aoff64_t addr;
-	uint8_t *buffer;
-	int i;
-	uint32_t j;
-	errno_t rc;
-	struct fat_bs bs;
-	fat_dentry_t *de;
-
-	rc = fat_bootsec_create(cfg, &bs);
-	if (rc != EOK)
-		return rc;
-
-	rc = block_write_direct(service_id, BS_BLOCK, 1, &bs);
-	if (rc != EOK)
-		return EIO;
-
-	addr = BS_BLOCK + 1;
-
-	buffer = calloc(cfg->sector_size, 1);
-	if (buffer == NULL)
-		return ENOMEM;
-	memset(buffer, 0, cfg->sector_size);
-
-	/* Reserved sectors */
-	for (i = 0; i < cfg->reserved_sectors - 1; ++i) {
-		rc = block_write_direct(service_id, addr, 1, buffer);
-		if (rc != EOK)
-			return EIO;
-
-		++addr;
-	}
-
-	/* File allocation tables */
-	for (i = 0; i < cfg->fat_count; ++i) {
-		printf("Writing allocation table %d.\n", i + 1);
-
-		for (j = 0; j < cfg->fat_sectors; ++j) {
-			memset(buffer, 0, cfg->sector_size);
-			if (j == 0) {
-				buffer[0] = default_media_descriptor;
-				buffer[1] = 0xFF;
-				buffer[2] = 0xFF;
-				if (cfg->fat_type == FAT16) {
-					buffer[3] = 0xFF;
-				} else if (cfg->fat_type == FAT32) {
-					buffer[3] = 0x0F;
-					buffer[4] = 0xFF;
-					buffer[5] = 0xFF;
-					buffer[6] = 0xFF;
-					buffer[7] = 0x0F;
-					buffer[8] = 0xF8;
-					buffer[9] = 0xFF;
-					buffer[10] = 0xFF;
-					buffer[11] = 0x0F;
-				}
-			}
-
-			rc = block_write_direct(service_id, addr, 1, buffer);
-			if (rc != EOK)
-				return EIO;
-
-			++addr;
-		}
-	}
-
-	if (cfg->fat_type == FAT32) {
-		/* Root dir is stored in cluster fat32_root_cluster */
-		addr += fat32_root_cluster * cfg->sectors_per_cluster;
-	}
-
-	/* Root directory */
-	printf("Writing root directory.\n");
-	memset(buffer, 0, cfg->sector_size);
-	de = (fat_dentry_t *)buffer;
-	size_t idx;
-	for (idx = 0; idx < cfg->rootdir_sectors; ++idx) {
-
-		if (idx == 0 && cfg->label != NULL) {
-			/* Set up volume label entry */
-			(void) fat_label_encode(&de->name, cfg->label);
-			de->attr = FAT_ATTR_VOLLABEL;
-			de->mtime = 0x1234; // XXX Proper time
-			de->mdate = 0x1234; // XXX Proper date
-		} else if (idx == 1) {
-			/* Clear volume label entry */
-			memset(buffer, 0, cfg->sector_size);
-		}
-
-		rc = block_write_direct(service_id, addr, 1, buffer);
-		if (rc != EOK)
-			return EIO;
-
-		++addr;
-	}
-
-	free(buffer);
-
-	return EOK;
-}
-
-/** Construct boot sector with the given parameters. */
-static errno_t fat_bootsec_create(struct fat_cfg const *cfg, struct fat_bs *bs)
-{
-	const char *bs_label;
-	rndgen_t *rndgen;
-	uint32_t vsn;
-	errno_t rc;
-
-	/* Generate a volume serial number */
-	rc = rndgen_create(&rndgen);
-	if (rc != EOK)
-		return rc;
-
-	rc = rndgen_uint32(rndgen, &vsn);
-	if (rc != EOK) {
-		rndgen_destroy(rndgen);
-		return rc;
-	}
-
-	rndgen_destroy(rndgen);
-
-	/*
-	 * The boot sector must always contain a valid label. If there
-	 * is no label, there should be 'NO NAME'
-	 */
-	if (cfg->label != NULL)
-		bs_label = cfg->label;
-	else
-		bs_label = LABEL_NONAME;
-	memset(bs, 0, sizeof(*bs));
-
-	bs->ji[0] = 0xEB;
-	bs->ji[1] = 0x3C;
-	bs->ji[2] = 0x90;
-
-	memcpy(bs->oem_name, "HELENOS ", 8);
-
-	/* BIOS Parameter Block */
-	bs->bps = host2uint16_t_le(cfg->sector_size);
-	bs->spc = cfg->sectors_per_cluster;
-	bs->rscnt = host2uint16_t_le(cfg->reserved_sectors);
-	bs->fatcnt = cfg->fat_count;
-	bs->root_ent_max = host2uint16_t_le(cfg->root_ent_max);
-
-	if (cfg->total_sectors < 0x10000) {
-		bs->totsec16 = host2uint16_t_le(cfg->total_sectors);
-		bs->totsec32 = 0;
-	} else {
-		bs->totsec16 = 0;
-		bs->totsec32 = host2uint32_t_le(cfg->total_sectors);
-	}
-
-	bs->mdesc = default_media_descriptor;
-	bs->sec_per_track = host2uint16_t_le(63);
-	bs->signature = host2uint16_t_be(0x55AA);
-	bs->headcnt = host2uint16_t_le(6);
-	bs->hidden_sec = host2uint32_t_le(0);
-
-	if (cfg->fat_type == FAT32) {
-		bs->sec_per_fat = 0;
-		bs->fat32.sectors_per_fat = host2uint32_t_le(cfg->fat_sectors);
-
-		bs->fat32.pdn = 0x80;
-		bs->fat32.ebs = 0x29;
-		bs->fat32.id = host2uint32_t_be(vsn);
-		bs->fat32.root_cluster = fat32_root_cluster;
-
-		(void) fat_label_encode(&bs->fat32.label, bs_label);
-		memcpy(bs->fat32.type, "FAT32   ", 8);
-	} else {
-		bs->sec_per_fat = host2uint16_t_le(cfg->fat_sectors);
-		bs->pdn = 0x80;
-		bs->ebs = 0x29;
-		bs->id = host2uint32_t_be(vsn);
-
-		(void) fat_label_encode(&bs->label, bs_label);
-		if (cfg->fat_type == FAT12)
-			memcpy(bs->type, "FAT12   ", 8);
-		else
-			memcpy(bs->type, "FAT16   ", 8);
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/app/mkmfs/doc/doxygroups.h
===================================================================
--- uspace/app/mkmfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mkmfs mkmfs
- * @brief Tool for creating Minix file systems
- * @ingroup apps
- */
Index: pace/app/mkmfs/meson.build
===================================================================
--- uspace/app/mkmfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block' , 'minix' ]
-src = files('mkmfs.c')
Index: pace/app/mkmfs/mkmfs.c
===================================================================
--- uspace/app/mkmfs/mkmfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,763 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mkmfs
- * @{
- */
-
-/**
- * @file	mkmfs.c
- * @brief	Tool for creating new Minix file systems.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <block.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <getopt.h>
-#include <mem.h>
-#include <str.h>
-#include <time.h>
-#include <minix.h>
-
-#define NAME	"mkmfs"
-
-#define FREE	0
-#define USED	1
-
-#define UPPER(n, size) 		(((n) / (size)) + (((n) % (size)) != 0))
-#define NEXT_DENTRY(p, dirsize)	(p += (dirsize))
-
-typedef enum {
-	HELP_SHORT,
-	HELP_LONG
-} help_level_t;
-
-/* Generic MFS superblock */
-struct mfs_sb_info {
-	uint64_t n_inodes;
-	uint64_t n_zones;
-	aoff64_t dev_nblocks;
-	unsigned long ibmap_blocks;
-	unsigned long zbmap_blocks;
-	unsigned long first_data_zone;
-	unsigned long itable_size;
-	int log2_zone_size;
-	int ino_per_block;
-	int dirsize;
-	uint32_t max_file_size;
-	uint16_t magic;
-	uint32_t block_size;
-	int fs_version;
-	bool longnames;
-};
-
-static void	help_cmd_mkmfs(help_level_t level);
-static bool	is_power_of_two(uint32_t n);
-static errno_t	init_superblock(struct mfs_sb_info *sb);
-static errno_t	write_superblock(const struct mfs_sb_info *sbi);
-static errno_t	write_superblock3(const struct mfs_sb_info *sbi);
-static errno_t	init_bitmaps(const struct mfs_sb_info *sb);
-static errno_t	init_inode_table(const struct mfs_sb_info *sb);
-static errno_t	make_root_ino(const struct mfs_sb_info *sb);
-static errno_t	make_root_ino2(const struct mfs_sb_info *sb);
-static void	mark_bmap(uint32_t *bmap, int idx, int v);
-static errno_t	insert_dentries(const struct mfs_sb_info *sb);
-
-static inline errno_t write_block(aoff64_t off, size_t size, const void *data);
-
-static service_id_t service_id;
-static int shift;
-
-static struct option const long_options[] = {
-	{ "help", no_argument, 0, 'h' },
-	{ "long-names", no_argument, 0, 'l' },
-	{ "block-size", required_argument, 0, 'b' },
-	{ "inodes", required_argument, 0, 'i' },
-	{ NULL, no_argument, 0, '1' },
-	{ NULL, no_argument, 0, '2' },
-	{ 0, 0, 0, 0 }
-};
-
-int main (int argc, char **argv)
-{
-	errno_t rc;
-	int c, opt_ind;
-	char *device_name;
-	size_t devblock_size;
-
-	struct mfs_sb_info sb;
-
-	/* Default is MinixFS V3 */
-	sb.magic = MFS_MAGIC_V3;
-	sb.fs_version = 3;
-
-	/* Default block size is 4Kb */
-	sb.block_size = MFS_MAX_BLOCKSIZE;
-	sb.dirsize = MFS3_DIRSIZE;
-	sb.n_inodes = 0;
-	sb.longnames = false;
-	sb.ino_per_block = V3_INODES_PER_BLOCK(MFS_MAX_BLOCKSIZE);
-
-	if (argc == 1) {
-		help_cmd_mkmfs(HELP_SHORT);
-		printf("Incorrect number of arguments, try `mkmfs --help'\n");
-		exit(0);
-	}
-
-	c = 0;
-	optind = 0;
-	opt_ind = 0;
-	while (c != -1) {
-		c = getopt_long(argc, argv, "lh12b:i:",
-		    long_options, &opt_ind);
-		switch (c) {
-		case 'h':
-			help_cmd_mkmfs(HELP_LONG);
-			exit(0);
-		case '1':
-			sb.magic = MFS_MAGIC_V1;
-			sb.block_size = MFS_BLOCKSIZE;
-			sb.fs_version = 1;
-			sb.ino_per_block = V1_INODES_PER_BLOCK;
-			sb.dirsize = MFS_DIRSIZE;
-			break;
-		case '2':
-			sb.magic = MFS_MAGIC_V2;
-			sb.block_size = MFS_BLOCKSIZE;
-			sb.fs_version = 2;
-			sb.ino_per_block = V2_INODES_PER_BLOCK;
-			sb.dirsize = MFS_DIRSIZE;
-			break;
-		case 'b':
-			sb.block_size = (uint32_t) strtol(optarg, NULL, 10);
-			break;
-		case 'i':
-			sb.n_inodes = (uint64_t) strtol(optarg, NULL, 10);
-			break;
-		case 'l':
-			sb.longnames = true;
-			sb.dirsize = MFSL_DIRSIZE;
-			break;
-		}
-	}
-
-	if (sb.block_size < MFS_MIN_BLOCKSIZE ||
-	    sb.block_size > MFS_MAX_BLOCKSIZE) {
-		printf(NAME ":Error! Invalid block size.\n");
-		exit(0);
-	} else if (!is_power_of_two(sb.block_size)) {
-		/* Block size must be a power of 2. */
-		printf(NAME ":Error! Invalid block size.\n");
-		exit(0);
-	} else if (sb.block_size > MFS_BLOCKSIZE &&
-	    sb.fs_version != 3) {
-		printf(NAME ":Error! Block size > 1024 is "
-		    "supported by V3 filesystem only.\n");
-		exit(0);
-	} else if (sb.fs_version == 3 && sb.longnames) {
-		printf(NAME ":Error! Long filenames are supported "
-		    "by V1/V2 filesystem only.\n");
-		exit(0);
-	}
-
-	if (sb.block_size == MFS_MIN_BLOCKSIZE)
-		shift = 1;
-	else if (sb.block_size == MFS_MAX_BLOCKSIZE)
-		shift = 3;
-	else
-		shift = 2;
-
-	argv += optind;
-
-	device_name = argv[0];
-
-	if (!device_name) {
-		help_cmd_mkmfs(HELP_LONG);
-		exit(0);
-	}
-
-	rc = loc_service_get_id(device_name, &service_id, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving device `%s'.\n", device_name);
-		return 2;
-	}
-
-	rc = block_init(service_id);
-	if (rc != EOK)  {
-		printf(NAME ": Error initializing libblock.\n");
-		return 2;
-	}
-
-	rc = block_get_bsize(service_id, &devblock_size);
-	if (rc != EOK) {
-		printf(NAME ": Error determining device block size.\n");
-		return 2;
-	}
-
-	rc = block_get_nblocks(service_id, &sb.dev_nblocks);
-	if (rc != EOK) {
-		printf(NAME ": Warning, failed to obtain "
-		    "block device size.\n");
-	} else {
-		printf(NAME ": Block device has %" PRIuOFF64 " blocks.\n",
-		    sb.dev_nblocks);
-	}
-
-	if (devblock_size != 512) {
-		printf(NAME ": Error. Device block size is not 512 bytes.\n");
-		return 2;
-	}
-
-	/* Minimum block size is 1 Kb */
-	sb.dev_nblocks /= 2;
-
-	printf(NAME ": Creating Minix file system on device\n");
-	printf(NAME ": Writing superblock\n");
-
-	/* Initialize superblock */
-	if (init_superblock(&sb) != EOK) {
-		printf(NAME ": Error. Superblock initialization failed\n");
-		return 2;
-	}
-
-	printf(NAME ": Initializing bitmaps\n");
-
-	/* Initialize bitmaps */
-	if (init_bitmaps(&sb) != EOK) {
-		printf(NAME ": Error. Bitmaps initialization failed\n");
-		return 2;
-	}
-
-	printf(NAME ": Initializing the inode table\n");
-
-	/* Init inode table */
-	if (init_inode_table(&sb) != EOK) {
-		printf(NAME ": Error. Inode table initialization failed\n");
-		return 2;
-	}
-
-	printf(NAME ": Creating the root directory inode\n");
-
-	/* Make the root inode */
-	if (sb.fs_version == 1)
-		rc = make_root_ino(&sb);
-	else
-		rc = make_root_ino2(&sb);
-
-	if (rc != EOK) {
-		printf(NAME ": Error. Root inode initialization failed\n");
-		return 2;
-	}
-
-	/* Insert directory entries . and .. */
-	if (insert_dentries(&sb) != EOK) {
-		printf(NAME ": Error. Root directory initialization failed\n");
-		return 2;
-	}
-
-	block_fini(service_id);
-
-	return 0;
-}
-
-/**Inserts the '.' and '..' directory entries in the root directory.
- *
- * @param sb		Pointer to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t insert_dentries(const struct mfs_sb_info *sb)
-{
-	void *root_block;
-	uint8_t *dentry_ptr;
-	errno_t rc;
-	const long root_dblock = sb->first_data_zone;
-
-	root_block = malloc(sb->block_size);
-	memset(root_block, 0x00, sb->block_size);
-
-	if (!root_block)
-		return ENOMEM;
-
-	dentry_ptr = root_block;
-
-	if (sb->fs_version != 3) {
-		/* Directory entries for V1/V2 filesystem */
-		struct mfs_dentry *dentry = root_block;
-
-		dentry->d_inum = MFS_ROOT_INO;
-		memcpy(dentry->d_name, ".\0", 2);
-
-		dentry = (struct mfs_dentry *) NEXT_DENTRY(dentry_ptr,
-		    sb->dirsize);
-
-		dentry->d_inum = MFS_ROOT_INO;
-		memcpy(dentry->d_name, "..\0", 3);
-	} else {
-		/* Directory entries for V3 filesystem */
-		struct mfs3_dentry *dentry = root_block;
-
-		dentry->d_inum = MFS_ROOT_INO;
-		memcpy(dentry->d_name, ".\0", 2);
-
-		dentry = (struct mfs3_dentry *) NEXT_DENTRY(dentry_ptr,
-		    sb->dirsize);
-
-		dentry->d_inum = MFS_ROOT_INO;
-		memcpy(dentry->d_name, "..\0", 3);
-	}
-
-	rc = write_block(root_dblock, 1, root_block);
-
-	free(root_block);
-	return rc;
-}
-
-/**Initialize the inode table.
- *
- * @param sb		Pointer to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t init_inode_table(const struct mfs_sb_info *sb)
-{
-	unsigned int i;
-	uint8_t *itable_buf;
-	errno_t rc = EOK;
-
-	long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
-	unsigned long itable_size = sb->itable_size;
-
-	itable_buf = malloc(sb->block_size);
-
-	if (!itable_buf)
-		return ENOMEM;
-
-	memset(itable_buf, 0x00, sb->block_size);
-
-	for (i = 0; i < itable_size; ++i, ++itable_off) {
-		rc = write_block(itable_off, 1, itable_buf);
-
-		if (rc != EOK)
-			break;
-	}
-
-	free(itable_buf);
-	return rc;
-}
-
-/**Initialize a V1 root inode.
- *
- * @param sb		Ponter to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t make_root_ino(const struct mfs_sb_info *sb)
-{
-	struct mfs_inode *ino_buf;
-	errno_t rc;
-
-	const long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
-
-	const time_t sec = time(NULL);
-
-	ino_buf = malloc(MFS_BLOCKSIZE);
-
-	if (!ino_buf)
-		return ENOMEM;
-
-	memset(ino_buf, 0x00, MFS_BLOCKSIZE);
-
-	ino_buf[MFS_ROOT_INO - 1].i_mode = S_IFDIR;
-	ino_buf[MFS_ROOT_INO - 1].i_uid = 0;
-	ino_buf[MFS_ROOT_INO - 1].i_gid = 0;
-	ino_buf[MFS_ROOT_INO - 1].i_size = (sb->longnames ? MFSL_DIRSIZE :
-	    MFS_DIRSIZE) * 2;
-	ino_buf[MFS_ROOT_INO - 1].i_mtime = sec;
-	ino_buf[MFS_ROOT_INO - 1].i_nlinks = 2;
-	ino_buf[MFS_ROOT_INO - 1].i_dzone[0] = sb->first_data_zone;
-
-	rc = write_block(itable_off, 1, ino_buf);
-
-	free(ino_buf);
-	return rc;
-}
-
-/**Initialize a Minix V2 root inode on disk, also valid for V3 filesystem.
- *
- * @param sb		Pointer to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t make_root_ino2(const struct mfs_sb_info *sb)
-{
-	struct mfs2_inode *ino_buf;
-	errno_t rc;
-
-	/* Compute offset of the first inode table block */
-	const long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
-
-	const time_t sec = time(NULL);
-
-	ino_buf = malloc(sb->block_size);
-
-	if (!ino_buf)
-		return ENOMEM;
-
-	memset(ino_buf, 0x00, sb->block_size);
-
-	ino_buf[MFS_ROOT_INO - 1].i_mode = S_IFDIR;
-	ino_buf[MFS_ROOT_INO - 1].i_uid = 0;
-	ino_buf[MFS_ROOT_INO - 1].i_gid = 0;
-	ino_buf[MFS_ROOT_INO - 1].i_size = MFS3_DIRSIZE * 2;
-	ino_buf[MFS_ROOT_INO - 1].i_mtime = sec;
-	ino_buf[MFS_ROOT_INO - 1].i_atime = sec;
-	ino_buf[MFS_ROOT_INO - 1].i_ctime = sec;
-	ino_buf[MFS_ROOT_INO - 1].i_nlinks = 2;
-	ino_buf[MFS_ROOT_INO - 1].i_dzone[0] = sb->first_data_zone;
-
-	rc = write_block(itable_off, 1, ino_buf);
-
-	free(ino_buf);
-	return rc;
-}
-
-/**Initialize the superblock structure on disk.
- *
- * @param sb		Pointer to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t init_superblock(struct mfs_sb_info *sb)
-{
-	aoff64_t inodes;
-	unsigned long ind;
-	unsigned long ind2;
-	unsigned long zones;
-	errno_t rc;
-
-	if (sb->longnames)
-		sb->magic = sb->fs_version == 1 ? MFS_MAGIC_V1L :
-		    MFS_MAGIC_V2L;
-
-	/* Compute the number of zones on disk */
-
-	if (sb->fs_version == 1) {
-		/* Valid only for MFS V1 */
-		sb->n_zones = sb->dev_nblocks > UINT16_MAX ?
-		    UINT16_MAX : sb->dev_nblocks;
-		ind = MFS_BLOCKSIZE / sizeof(uint16_t);
-		ind2 = ind * ind;
-		sb->max_file_size = (V1_NR_DIRECT_ZONES + ind + ind2) *
-		    MFS_BLOCKSIZE;
-	} else {
-		/* Valid for MFS V2/V3 */
-		size_t ptrsize;
-		if (sb->fs_version == 2)
-			ptrsize = sizeof(uint16_t);
-		else
-			ptrsize = sizeof(uint32_t);
-
-		ind = sb->block_size / ptrsize;
-		ind2 = ind * ind;
-		zones = V2_NR_DIRECT_ZONES + ind + ind2;
-		sb->max_file_size = zones * sb->block_size;
-		sb->n_zones = sb->dev_nblocks > UINT32_MAX ?
-		    UINT32_MAX : sb->dev_nblocks;
-
-		if (sb->fs_version == 3) {
-			if (INT32_MAX / sb->block_size < zones)
-				sb->max_file_size = INT32_MAX;
-			sb->ino_per_block = V3_INODES_PER_BLOCK(sb->block_size);
-			sb->n_zones /= (sb->block_size / MFS_MIN_BLOCKSIZE);
-		}
-	}
-
-	/* Round up the number of inodes to fill block size */
-	if (sb->n_inodes == 0)
-		inodes = sb->dev_nblocks / 3;
-	else
-		inodes = sb->n_inodes;
-
-	if (inodes % sb->ino_per_block)
-		inodes = ((inodes / sb->ino_per_block) + 1) *
-		    sb->ino_per_block;
-
-	if (sb->fs_version < 3)
-		sb->n_inodes = inodes > UINT16_MAX ? UINT16_MAX : inodes;
-	else
-		sb->n_inodes = inodes > UINT32_MAX ? UINT32_MAX : inodes;
-
-	/* Compute inode bitmap size in blocks */
-	sb->ibmap_blocks = UPPER(sb->n_inodes, sb->block_size * 8);
-
-	/* Compute inode table size */
-	sb->itable_size = sb->n_inodes / sb->ino_per_block;
-
-	/* Compute zone bitmap size in blocks */
-	sb->zbmap_blocks = UPPER(sb->n_zones, sb->block_size * 8);
-
-	/* Compute first data zone position */
-	sb->first_data_zone = 2 + sb->itable_size +
-	    sb->zbmap_blocks + sb->ibmap_blocks;
-
-	/* Set log2 of zone to block ratio to zero */
-	sb->log2_zone_size = 0;
-
-	/* Check for errors */
-	if (sb->first_data_zone >= sb->n_zones) {
-		printf(NAME ": Error! Insufficient disk space");
-		return ENOMEM;
-	}
-
-	/* Superblock is now ready to be written on disk */
-	printf(NAME ": %d block size\n", sb->block_size);
-	printf(NAME ": %d inodes\n", (uint32_t) sb->n_inodes);
-	printf(NAME ": %d zones\n", (uint32_t) sb->n_zones);
-	printf(NAME ": inode table blocks = %ld\n", sb->itable_size);
-	printf(NAME ": inode bitmap blocks = %ld\n", sb->ibmap_blocks);
-	printf(NAME ": zone bitmap blocks = %ld\n", sb->zbmap_blocks);
-	printf(NAME ": first data zone = %d\n", (uint32_t)sb->first_data_zone);
-	printf(NAME ": max file size = %u\n", sb->max_file_size);
-	printf(NAME ": long fnames = %s\n", sb->longnames ? "Yes" : "No");
-
-	if (sb->fs_version == 3)
-		rc = write_superblock3(sb);
-	else
-		rc = write_superblock(sb);
-
-	return rc;
-}
-
-/**Write the V1/V2 superblock on disk.
- *
- * @param sbi		Pointer to the superblock structure to write on disk.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t write_superblock(const struct mfs_sb_info *sbi)
-{
-	struct mfs_superblock *sb;
-	errno_t rc;
-
-	sb = malloc(MFS_SUPERBLOCK_SIZE);
-
-	if (!sb)
-		return ENOMEM;
-
-	sb->s_ninodes = (uint16_t) sbi->n_inodes;
-	sb->s_nzones = (uint16_t) sbi->n_zones;
-	sb->s_nzones2 = (uint32_t) sbi->n_zones;
-	sb->s_ibmap_blocks = (uint16_t) sbi->ibmap_blocks;
-	sb->s_zbmap_blocks = (uint16_t) sbi->zbmap_blocks;
-	sb->s_first_data_zone = (uint16_t) sbi->first_data_zone;
-	sb->s_log2_zone_size = sbi->log2_zone_size;
-	sb->s_max_file_size = sbi->max_file_size;
-	sb->s_magic = sbi->magic;
-	sb->s_state = MFS_VALID_FS;
-
-	rc = write_block(MFS_SUPERBLOCK, 1, sb);
-	free(sb);
-
-	return rc;
-}
-
-/**Write the V3s superblock on disk.
- *
- * @param sbi		Pointer to the superblock structure to write on disk.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t write_superblock3(const struct mfs_sb_info *sbi)
-{
-	struct mfs3_superblock *sb;
-	errno_t rc;
-
-	sb = malloc(MFS_SUPERBLOCK_SIZE);
-
-	if (!sb)
-		return ENOMEM;
-
-	sb->s_ninodes = (uint32_t) sbi->n_inodes;
-	sb->s_nzones = (uint32_t) sbi->n_zones;
-	sb->s_ibmap_blocks = (uint16_t) sbi->ibmap_blocks;
-	sb->s_zbmap_blocks = (uint16_t) sbi->zbmap_blocks;
-	sb->s_first_data_zone = (uint16_t) sbi->first_data_zone;
-	sb->s_log2_zone_size = sbi->log2_zone_size;
-	sb->s_max_file_size = sbi->max_file_size;
-	sb->s_magic = sbi->magic;
-	sb->s_block_size = sbi->block_size;
-	sb->s_disk_version = 3;
-
-	rc = block_write_direct(service_id, MFS_SUPERBLOCK << 1, 1 << 1, sb);
-	free(sb);
-
-	return rc;
-}
-
-/**Initialize the inode and block bitmaps on disk.
- *
- * @param sb		Pointer to the superblock structure.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t init_bitmaps(const struct mfs_sb_info *sb)
-{
-	uint32_t *ibmap_buf, *zbmap_buf;
-	uint8_t *ibmap_buf8, *zbmap_buf8;
-	const unsigned int ibmap_nblocks = sb->ibmap_blocks;
-	const unsigned int zbmap_nblocks = sb->zbmap_blocks;
-	unsigned int i;
-	errno_t rc = EOK;
-
-	ibmap_buf = malloc(ibmap_nblocks * sb->block_size);
-	zbmap_buf = malloc(zbmap_nblocks * sb->block_size);
-
-	if (!ibmap_buf || !zbmap_buf) {
-		rc = ENOMEM;
-		goto exit;
-	}
-
-	memset(ibmap_buf, 0xFF, ibmap_nblocks * sb->block_size);
-	memset(zbmap_buf, 0xFF, zbmap_nblocks * sb->block_size);
-
-	for (i = 2; i < sb->n_inodes + 1; ++i)
-		mark_bmap(ibmap_buf, i, FREE);
-
-	for (i = 2; i < sb->n_zones - sb->first_data_zone; ++i)
-		mark_bmap(zbmap_buf, i, FREE);
-
-	ibmap_buf8 = (uint8_t *) ibmap_buf;
-	zbmap_buf8 = (uint8_t *) zbmap_buf;
-
-	int start_block = 2;
-
-	for (i = 0; i < ibmap_nblocks; ++i) {
-		if ((rc = write_block(start_block + i,
-		    1, (ibmap_buf8 + i * sb->block_size))) != EOK)
-			goto exit;
-	}
-
-	start_block = 2 + ibmap_nblocks;
-
-	for (i = 0; i < zbmap_nblocks; ++i) {
-		if ((rc = write_block(start_block + i,
-		    1, (zbmap_buf8 + i * sb->block_size))) != EOK)
-			goto exit;
-	}
-
-exit:
-	free(ibmap_buf);
-	free(zbmap_buf);
-
-	return rc;
-}
-
-/**Mark a bitmap entry as used or free.
- *
- * @param bmap		32-bit pointer to the bitmap in memory.
- * @param idx		The index in the bitmap of the bit to set at 1 or 0.
- * @param v		FREE to clear the bit, USED to set the bit.
- */
-static void mark_bmap(uint32_t *bmap, int idx, int v)
-{
-	if (v == FREE)
-		bmap[idx / 32] &= ~(1 << (idx % 32));
-	else
-		bmap[idx / 32] |= 1 << (idx % 32);
-}
-
-/**Write a block on disk.
- *
- * @param off		64-bit block offset on disk.
- * @param size		size of the block.
- * @param data		Pointer to the block content.
- *
- * @return		EOK on success or a error number.
- */
-static inline errno_t write_block(aoff64_t off, size_t size, const void *data)
-{
-	if (shift == 3) {
-		errno_t rc;
-		aoff64_t tmp_off = off << 1;
-		uint8_t *data_ptr = (uint8_t *) data;
-
-		rc = block_write_direct(service_id, tmp_off << 2,
-		    size << 2, data_ptr);
-
-		if (rc != EOK)
-			return rc;
-
-		data_ptr += 2048;
-		tmp_off++;
-
-		return block_write_direct(service_id, tmp_off << 2,
-		    size << 2, data_ptr);
-	}
-	return block_write_direct(service_id, off << shift,
-	    size << shift, data);
-}
-
-static void help_cmd_mkmfs(help_level_t level)
-{
-	if (level == HELP_SHORT) {
-		printf(NAME ": tool to create new Minix file systems\n");
-	} else {
-		printf("Usage: [options] device\n"
-		    "-1         Make a Minix version 1 filesystem\n"
-		    "-2         Make a Minix version 2 filesystem\n"
-		    "-b ##      Specify the block size in bytes (V3 only),\n"
-		    "           valid block size values are 1024, 2048 and"
-		    /* ...   */ " 4096 bytes per block\n"
-		    "-i ##      Specify the number of inodes"
-		    /* ...   */ " for the filesystem\n"
-		    "-l         Use 30-char long filenames (V1/V2 only)\n");
-	}
-}
-
-/** Check if a given number is a power of two.
- *
- * @param n	The number to check.
- *
- * @return	true if it is a power of two, false otherwise.
- */
-static bool is_power_of_two(uint32_t n)
-{
-	if (n == 0)
-		return false;
-
-	return (n & (n - 1)) == 0;
-}
-
-/**
- * @}
- */
Index: pace/app/modplay/doc/doxygroups.h
===================================================================
--- uspace/app/modplay/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup modplay modplay
- * @brief Amiga music module player
- * @ingroup apps
- */
Index: pace/app/modplay/meson.build
===================================================================
--- uspace/app/modplay/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'trackmod', 'hound', 'pcm', 'console' ]
-src = files('modplay.c')
-
-if install_nonessential_data
-	# TODO: install this file somewhere sane
-	installed_data += { 'name': 'demo.xm', 'dir': '/' }
-endif
Index: pace/app/modplay/modplay.c
===================================================================
--- uspace/app/modplay/modplay.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup modplay
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <hound/client.h>
-#include <io/console.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <trackmod.h>
-
-static bool quit = false;
-
-static void modplay_key_press(kbd_event_t *ev)
-{
-	if ((ev->mods & KM_ALT) == 0 &&
-	    (ev->mods & KM_SHIFT) == 0 &&
-	    (ev->mods & KM_CTRL) != 0) {
-		if (ev->key == KC_Q)
-			quit = true;
-	}
-}
-
-static void modplay_event(cons_event_t *event)
-{
-	switch (event->type) {
-	case CEV_KEY:
-		if (event->ev.key.type == KEY_PRESS) {
-			modplay_key_press(&event->ev.key);
-		}
-		break;
-	default:
-		break;
-	}
-}
-
-static void print_syntax(void)
-{
-	printf("syntax: modplay [<options>] <filename.mod>\n");
-	printf("options:\n");
-	printf("\t-t <target>\tOutput to specified audio target.\n");
-}
-
-int main(int argc, char *argv[])
-{
-	trackmod_module_t *mod;
-	trackmod_modplay_t *modplay;
-	hound_context_t *hound;
-	console_ctrl_t *con;
-	cons_event_t event;
-	usec_t timeout;
-	pcm_format_t format;
-	void *buffer;
-	size_t buffer_size;
-	const char *target = HOUND_DEFAULT_TARGET;
-	errno_t rc;
-
-	++argv;
-	--argc;
-
-	while (argc > 0 && (*argv)[0] == '-') {
-		if (str_cmp(*argv, "-t") == 0) {
-			++argv;
-			--argc;
-
-			if (argc < 1) {
-				printf("Option '-t' requires an argument.\n");
-				print_syntax();
-				return 1;
-			}
-
-			target = *argv++;
-			--argc;
-			continue;
-		}
-
-		printf("Invalid option '%s'\n", *argv);
-		print_syntax();
-		return 1;
-	}
-
-	if (argc != 1) {
-		print_syntax();
-		return 1;
-	}
-
-	con = console_init(stdin, stdout);
-
-	rc = trackmod_module_load(argv[0], &mod);
-	if (rc != EOK) {
-		printf("Error loading %s.\n", argv[0]);
-		return 1;
-	}
-
-	format.channels = 1;
-	format.sampling_rate = 44100;
-#ifdef __LE__
-	format.sample_format = PCM_SAMPLE_SINT16_LE;
-#else
-	format.sample_format = PCM_SAMPLE_SINT16_BE;
-#endif
-	buffer_size = 64 * 1024;
-
-	buffer = malloc(buffer_size);
-	if (buffer == NULL) {
-		printf("Error allocating audio buffer.\n");
-		return 1;
-	}
-
-	hound = hound_context_create_playback(argv[1], format, buffer_size);
-	if (hound == NULL) {
-		printf("Error creating playback context.\n");
-		return 1;
-	}
-
-	rc = hound_context_connect_target(hound, target);
-	if (rc != EOK) {
-		printf("Error connecting audio target '%s': %s.\n",
-		    target, str_error(rc));
-
-		char **names = NULL;
-		size_t count = 0;
-		rc = hound_context_get_available_targets(hound, &names, &count);
-		if (rc == EOK) {
-			printf("Available targets:\n");
-			for (size_t i = 0; i < count; i++)
-				printf(" - %s\n", names[i]);
-		}
-
-		return 1;
-	}
-
-	rc = trackmod_modplay_create(mod, format.sampling_rate, &modplay);
-	if (rc != EOK) {
-		printf("Error setting up playback.\n");
-		return 1;
-	}
-
-	printf("Playing '%s'. Press Ctrl+Q to quit.\n", argv[1]);
-
-	while (true) {
-		timeout = 0;
-		rc = console_get_event_timeout(con, &event, &timeout);
-		if (rc == EOK)
-			modplay_event(&event);
-		else if (rc != ETIMEOUT)
-			break;
-
-		if (quit)
-			break;
-
-		trackmod_modplay_get_samples(modplay, buffer, buffer_size / 4);
-
-		rc = hound_write_main_stream(hound, buffer, buffer_size / 4);
-		if (rc != EOK) {
-			printf("Error writing audio stream.\n");
-			break;
-		}
-	}
-
-	hound_context_destroy(hound);
-	trackmod_modplay_destroy(modplay);
-	trackmod_module_destroy(mod);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/nav/doc/doxygroups.h
===================================================================
--- uspace/app/nav/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup nav nav
- * @brief Navigator
- * @ingroup apps
- */
Index: pace/app/nav/main.c
===================================================================
--- uspace/app/nav/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/** @file Navigator main.
- *
- * HelenOS file manager.
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <ui/ui.h>
-#include "nav.h"
-
-static void print_syntax(void)
-{
-	printf("Syntax: nav [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_CONSOLE_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = navigator_run(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/nav/menu.c
===================================================================
--- uspace/app/nav/menu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/** @file Navigator.
- *
- * HelenOS file manager.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
-#include "menu.h"
-#include "nav.h"
-
-/** Create navigator menu.
- *
- * @param window Navigator window
- * @param rmenu Place to store pointer to new menu
- * @return EOK on success or an error code
- */
-errno_t nav_menu_create(ui_window_t *window, nav_menu_t **rmenu)
-{
-	nav_menu_t *menu;
-	ui_menu_t *mfile;
-	ui_menu_entry_t *mopen;
-	ui_menu_entry_t *medit;
-	ui_menu_entry_t *mfsep;
-	ui_menu_entry_t *mexit;
-	gfx_rect_t arect;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	menu = calloc(1, sizeof(nav_menu_t));
-	if (menu == NULL)
-		return ENOMEM;
-
-	menu->window = window;
-	menu->ui = ui_window_get_ui(window);
-
-	rc = ui_menu_bar_create(menu->ui, menu->window,
-	    &menu->menubar);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_menu_dd_create(menu->menubar, "~F~ile", NULL, &mfile);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_menu_entry_create(mfile, "~O~pen", "Enter", &mopen);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_entry_set_cb(mopen, nav_menu_file_open, (void *) menu);
-
-	rc = ui_menu_entry_create(mfile, "~E~dit", "Ctrl-E", &medit);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_entry_set_cb(medit, nav_menu_file_edit, (void *) menu);
-
-	rc = ui_menu_entry_sep_create(mfile, &mfsep);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_menu_entry_create(mfile, "E~x~it", "Ctrl-Q", &mexit);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_entry_set_cb(mexit, nav_menu_file_exit, (void *) menu);
-
-	ui_window_get_app_rect(menu->window, &arect);
-
-	rect.p0 = arect.p0;
-	rect.p1.x = arect.p1.x;
-	rect.p1.y = arect.p0.y + 1;
-	ui_menu_bar_set_rect(menu->menubar, &rect);
-
-	*rmenu = menu;
-	return EOK;
-error:
-	nav_menu_destroy(menu);
-	return rc;
-}
-
-/** Set navigator menu callbacks.
- *
- * @param menu Menu
- * @param cb Callbacks
- * @param arg Argument to callback functions
- */
-void nav_menu_set_cb(nav_menu_t *menu, nav_menu_cb_t *cb, void *arg)
-{
-	menu->cb = cb;
-	menu->cb_arg = arg;
-}
-
-/** Destroy navigator menu.
- *
- * @param menu Menu
- */
-void nav_menu_destroy(nav_menu_t *menu)
-{
-	if (menu->menubar != NULL)
-		ui_menu_bar_destroy(menu->menubar);
-
-	free(menu);
-}
-
-/** Return base UI control for the menu bar.
- *
- * @param menu Navigator menu
- * @return UI control
- */
-ui_control_t *nav_menu_ctl(nav_menu_t *menu)
-{
-	return ui_menu_bar_ctl(menu->menubar);
-}
-
-/** File / Open menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (navigator_t *)
- */
-void nav_menu_file_open(ui_menu_entry_t *mentry, void *arg)
-{
-	nav_menu_t *menu = (nav_menu_t *)arg;
-
-	if (menu->cb != NULL && menu->cb->file_open != NULL)
-		menu->cb->file_open(menu->cb_arg);
-}
-
-/** File / Edit menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (navigator_t *)
- */
-void nav_menu_file_edit(ui_menu_entry_t *mentry, void *arg)
-{
-	nav_menu_t *menu = (nav_menu_t *)arg;
-
-	if (menu->cb != NULL && menu->cb->file_edit != NULL)
-		menu->cb->file_edit(menu->cb_arg);
-}
-
-/** File / Exit menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (navigator_t *)
- */
-void nav_menu_file_exit(ui_menu_entry_t *mentry, void *arg)
-{
-	nav_menu_t *menu = (nav_menu_t *)arg;
-
-	if (menu->cb != NULL && menu->cb->file_exit != NULL)
-		menu->cb->file_exit(menu->cb_arg);
-}
-
-/** @}
- */
Index: pace/app/nav/menu.h
===================================================================
--- uspace/app/nav/menu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator menu
- */
-
-#ifndef MENU_H
-#define MENU_H
-
-#include <errno.h>
-#include <ui/menuentry.h>
-#include <ui/window.h>
-#include "types/menu.h"
-
-extern errno_t nav_menu_create(ui_window_t *, nav_menu_t **);
-extern void nav_menu_set_cb(nav_menu_t *, nav_menu_cb_t *, void *);
-extern void nav_menu_destroy(nav_menu_t *);
-extern ui_control_t *nav_menu_ctl(nav_menu_t *);
-extern void nav_menu_file_open(ui_menu_entry_t *, void *);
-extern void nav_menu_file_edit(ui_menu_entry_t *, void *);
-extern void nav_menu_file_exit(ui_menu_entry_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/app/nav/meson.build
===================================================================
--- uspace/app/nav/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files(
-	'main.c',
-	'menu.c',
-	'nav.c',
-	'panel.c',
-)
-
-test_src = files(
-	'menu.c',
-	'nav.c',
-	'panel.c',
-	'test/main.c',
-	'test/menu.c',
-	'test/nav.c',
-	'test/panel.c',
-)
Index: pace/app/nav/nav.c
===================================================================
--- uspace/app/nav/nav.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,485 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/** @file Navigator.
- *
- * HelenOS file manager.
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <ui/fixed.h>
-#include <ui/filelist.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "menu.h"
-#include "nav.h"
-#include "panel.h"
-
-#define EDITOR_CMD "/app/edit"
-
-static void wnd_close(ui_window_t *, void *);
-static void wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close,
-	.kbd = wnd_kbd
-};
-
-static void navigator_file_open(void *);
-static void navigator_file_edit(void *);
-static void navigator_file_exit(void *);
-
-static nav_menu_cb_t navigator_menu_cb = {
-	.file_open = navigator_file_open,
-	.file_edit = navigator_file_edit,
-	.file_exit = navigator_file_exit
-};
-
-static void navigator_panel_activate_req(void *, panel_t *);
-static void navigator_panel_file_open(void *, panel_t *, const char *);
-
-static panel_cb_t navigator_panel_cb = {
-	.activate_req = navigator_panel_activate_req,
-	.file_open = navigator_panel_file_open
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (navigator)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	navigator_t *navigator = (navigator_t *) arg;
-
-	ui_quit(navigator->ui);
-}
-
-/** Window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (navigator)
- * @param event Keyboard event
- */
-static void wnd_kbd(ui_window_t *window, void *arg, kbd_event_t *event)
-{
-	navigator_t *navigator = (navigator_t *) arg;
-
-	if (event->type == KEY_PRESS &&
-	    ((event->mods & KM_ALT) == 0) &&
-	    ((event->mods & KM_SHIFT) == 0) &&
-	    (event->mods & KM_CTRL) != 0) {
-		switch (event->key) {
-		case KC_E:
-			navigator_file_edit((void *)navigator);
-			break;
-		case KC_Q:
-			ui_quit(navigator->ui);
-			break;
-		default:
-			break;
-		}
-	}
-
-	if (event->type == KEY_PRESS &&
-	    ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)) {
-		switch (event->key) {
-		case KC_TAB:
-			navigator_switch_panel(navigator);
-			break;
-		default:
-			break;
-		}
-	}
-
-	ui_window_def_kbd(window, event);
-}
-
-/** Create navigator.
- *
- * @param display_spec Display specification
- * @param rnavigator Place to store pointer to new navigator
- * @return EOK on success or ane error code
- */
-errno_t navigator_create(const char *display_spec,
-    navigator_t **rnavigator)
-{
-	navigator_t *navigator;
-	ui_wnd_params_t params;
-	gfx_rect_t rect;
-	gfx_rect_t arect;
-	gfx_coord_t pw;
-	unsigned i;
-	errno_t rc;
-
-	navigator = calloc(1, sizeof(navigator_t));
-	if (navigator == NULL)
-		return ENOMEM;
-
-	rc = ui_create(display_spec, &navigator->ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Navigator";
-	params.style &= ~ui_wds_decorated;
-	params.placement = ui_wnd_place_full_screen;
-
-	rc = ui_window_create(navigator->ui, &params, &navigator->window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(navigator->window, &window_cb, (void *) navigator);
-	ui_window_get_app_rect(navigator->window, &arect);
-
-	rc = ui_fixed_create(&navigator->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	ui_window_add(navigator->window, ui_fixed_ctl(navigator->fixed));
-
-	rc = nav_menu_create(navigator->window, &navigator->menu);
-	if (rc != EOK)
-		goto error;
-
-	nav_menu_set_cb(navigator->menu, &navigator_menu_cb,
-	    (void *)navigator);
-
-	rc = ui_fixed_add(navigator->fixed, nav_menu_ctl(navigator->menu));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	/* Panel width */
-	pw = (arect.p1.x - arect.p0.x) / 2;
-
-	for (i = 0; i < 2; i++) {
-		rc = panel_create(navigator->window, i == 0,
-		    &navigator->panel[i]);
-		if (rc != EOK)
-			goto error;
-
-		rect.p0.x = arect.p0.x + pw * i;
-		rect.p0.y = arect.p0.y + 1;
-		rect.p1.x = arect.p0.x + pw * (i + 1);
-		rect.p1.y = arect.p1.y - 1;
-		panel_set_rect(navigator->panel[i], &rect);
-
-		panel_set_cb(navigator->panel[i], &navigator_panel_cb,
-		    navigator);
-
-		rc = ui_fixed_add(navigator->fixed,
-		    panel_ctl(navigator->panel[i]));
-		if (rc != EOK) {
-			printf("Error adding control to layout.\n");
-			goto error;
-		}
-
-		rc = panel_read_dir(navigator->panel[i], ".");
-		if (rc != EOK) {
-			printf("Error reading directory.\n");
-			goto error;
-		}
-	}
-
-	rc = ui_window_paint(navigator->window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	*rnavigator = navigator;
-	return EOK;
-error:
-	navigator_destroy(navigator);
-	return rc;
-}
-
-void navigator_destroy(navigator_t *navigator)
-{
-	unsigned i;
-
-	for (i = 0; i < 2; i++) {
-		if (navigator->panel[i] != NULL) {
-			ui_fixed_remove(navigator->fixed,
-			    panel_ctl(navigator->panel[i]));
-			panel_destroy(navigator->panel[i]);
-		}
-	}
-
-	if (navigator->menu != NULL) {
-		ui_fixed_remove(navigator->fixed, nav_menu_ctl(navigator->menu));
-		nav_menu_destroy(navigator->menu);
-	}
-
-	if (navigator->window != NULL)
-		ui_window_destroy(navigator->window);
-	if (navigator->ui != NULL)
-		ui_destroy(navigator->ui);
-	free(navigator);
-}
-
-/** Run navigator on the specified display. */
-errno_t navigator_run(const char *display_spec)
-{
-	navigator_t *navigator;
-	errno_t rc;
-
-	rc = navigator_create(display_spec, &navigator);
-	if (rc != EOK)
-		return rc;
-
-	ui_run(navigator->ui);
-
-	navigator_destroy(navigator);
-	return EOK;
-}
-
-/** Get the currently active navigator panel.
- *
- * @param navigator Navigator
- * @return Currently active panel
- */
-panel_t *navigator_get_active_panel(navigator_t *navigator)
-{
-	int i;
-
-	for (i = 0; i < navigator_panels; i++) {
-		if (panel_is_active(navigator->panel[i]))
-			return navigator->panel[i];
-	}
-
-	/* This should not happen */
-	assert(false);
-	return NULL;
-}
-
-/** Switch to another navigator panel.
- *
- * Changes the currently active navigator panel to the next panel.
- *
- * @param navigator Navigator
- */
-void navigator_switch_panel(navigator_t *navigator)
-{
-	errno_t rc;
-
-	if (panel_is_active(navigator->panel[0])) {
-		rc = panel_activate(navigator->panel[1]);
-		if (rc != EOK)
-			return;
-		panel_deactivate(navigator->panel[0]);
-	} else {
-		rc = panel_activate(navigator->panel[0]);
-		if (rc != EOK)
-			return;
-		panel_deactivate(navigator->panel[1]);
-	}
-}
-
-/** File / Open menu entry selected */
-static void navigator_file_open(void *arg)
-{
-	navigator_t *navigator = (navigator_t *)arg;
-	panel_t *panel;
-
-	panel = navigator_get_active_panel(navigator);
-	ui_file_list_open(panel->flist, ui_file_list_get_cursor(panel->flist));
-}
-
-/** Open file in text editor.
- *
- * @param navigator Navigator
- * @param fname File name
- *
- * @return EOK on success or an error code
- */
-static errno_t navigator_edit_file(navigator_t *navigator, const char *fname)
-{
-	task_id_t id;
-	task_wait_t wait;
-	task_exit_t texit;
-	int retval;
-	errno_t rc;
-
-	/* Free up and clean console for the child task. */
-	rc = ui_suspend(navigator->ui);
-	if (rc != EOK)
-		return rc;
-
-	rc = task_spawnl(&id, &wait, EDITOR_CMD, EDITOR_CMD, fname, NULL);
-	if (rc != EOK)
-		goto error;
-
-	rc = task_wait(&wait, &texit, &retval);
-	if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))
-		goto error;
-
-	/* Resume UI operation */
-	rc = ui_resume(navigator->ui);
-	if (rc != EOK)
-		return rc;
-
-	(void) ui_paint(navigator->ui);
-	return EOK;
-error:
-	(void) ui_resume(navigator->ui);
-	(void) ui_paint(navigator->ui);
-	return rc;
-}
-
-/** Execute file entry.
- *
- * @param navigator Navigator
- * @param fname File name
- *
- * @return EOK on success or an error code
- */
-static errno_t navigator_exec_file(navigator_t *navigator, const char *fname)
-{
-	task_id_t id;
-	task_wait_t wait;
-	task_exit_t texit;
-	int retval;
-	errno_t rc;
-
-	/* Free up and clean console for the child task. */
-	rc = ui_suspend(navigator->ui);
-	if (rc != EOK)
-		return rc;
-
-	rc = task_spawnl(&id, &wait, fname, fname, NULL);
-	if (rc != EOK)
-		goto error;
-
-	rc = task_wait(&wait, &texit, &retval);
-	if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))
-		goto error;
-
-	/* Resume UI operation */
-	rc = ui_resume(navigator->ui);
-	if (rc != EOK)
-		return rc;
-
-	(void) ui_paint(navigator->ui);
-	return EOK;
-error:
-	(void) ui_resume(navigator->ui);
-	(void) ui_paint(navigator->ui);
-	return rc;
-}
-
-/** Open panel file entry.
- *
- * Perform Open action on a file entry (based on extension).
- *
- * @param navigator Navigator
- * @param fname File name
- *
- * @return EOK on success or an error code
- */
-static errno_t navigator_open_file(navigator_t *navigator, const char *fname)
-{
-	const char *ext;
-
-	ext = str_rchr(fname, '.');
-	if (ext != NULL) {
-		if (str_casecmp(ext, ".txt") == 0)
-			return navigator_edit_file(navigator, fname);
-	}
-
-	return navigator_exec_file(navigator, fname);
-}
-
-/** File / Edit menu entry selected */
-static void navigator_file_edit(void *arg)
-{
-	navigator_t *navigator = (navigator_t *)arg;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	panel_t *panel;
-
-	panel = navigator_get_active_panel(navigator);
-	entry = ui_file_list_get_cursor(panel->flist);
-	ui_file_list_entry_get_attr(entry, &attr);
-
-	(void)navigator_edit_file(navigator, attr.name);
-}
-
-/** File / Exit menu entry selected */
-static void navigator_file_exit(void *arg)
-{
-	navigator_t *navigator = (navigator_t *)arg;
-
-	ui_quit(navigator->ui);
-}
-
-/** Panel callback requesting panel activation.
- *
- * @param arg Argument (navigator_t *)
- * @param panel Panel
- */
-void navigator_panel_activate_req(void *arg, panel_t *panel)
-{
-	navigator_t *navigator = (navigator_t *)arg;
-
-	if (!panel_is_active(panel))
-		navigator_switch_panel(navigator);
-}
-
-/** Panel callback requesting file open.
- *
- * @param arg Argument (navigator_t *)
- * @param panel Panel
- * @param fname File name
- */
-void navigator_panel_file_open(void *arg, panel_t *panel, const char *fname)
-{
-	navigator_t *navigator = (navigator_t *)arg;
-
-	(void)panel;
-	navigator_open_file(navigator, fname);
-}
-
-/** @}
- */
Index: pace/app/nav/nav.h
===================================================================
--- uspace/app/nav/nav.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator
- */
-
-#ifndef NAV_H
-#define NAV_H
-
-#include <errno.h>
-#include "types/nav.h"
-#include "types/panel.h"
-
-extern errno_t navigator_create(const char *, navigator_t **);
-extern void navigator_destroy(navigator_t *);
-extern errno_t navigator_run(const char *);
-extern panel_t *navigator_get_active_panel(navigator_t *);
-extern void navigator_switch_panel(navigator_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/nav/panel.c
===================================================================
--- uspace/app/nav/panel.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,407 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/** @file Navigator panel.
- *
- * Displays a file listing.
- */
-
-#include <errno.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <stdlib.h>
-#include <task.h>
-#include <ui/control.h>
-#include <ui/filelist.h>
-#include <ui/paint.h>
-#include <ui/resource.h>
-#include "panel.h"
-#include "nav.h"
-
-static void panel_ctl_destroy(void *);
-static errno_t panel_ctl_paint(void *);
-static ui_evclaim_t panel_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t panel_ctl_pos_event(void *, pos_event_t *);
-
-/** Panel control ops */
-static ui_control_ops_t panel_ctl_ops = {
-	.destroy = panel_ctl_destroy,
-	.paint = panel_ctl_paint,
-	.kbd_event = panel_ctl_kbd_event,
-	.pos_event = panel_ctl_pos_event
-};
-
-static void panel_flist_activate_req(ui_file_list_t *, void *);
-static void panel_flist_selected(ui_file_list_t *, void *, const char *);
-
-/** Panel file list callbacks */
-static ui_file_list_cb_t panel_flist_cb = {
-	.activate_req = panel_flist_activate_req,
-	.selected = panel_flist_selected,
-};
-
-/** Create panel.
- *
- * @param window Containing window
- * @param active @c true iff panel should be active
- * @param rpanel Place to store pointer to new panel
- * @return EOK on success or an error code
- */
-errno_t panel_create(ui_window_t *window, bool active, panel_t **rpanel)
-{
-	panel_t *panel;
-	errno_t rc;
-
-	panel = calloc(1, sizeof(panel_t));
-	if (panel == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&panel_ctl_ops, (void *)panel,
-	    &panel->control);
-	if (rc != EOK) {
-		free(panel);
-		return rc;
-	}
-
-	rc = gfx_color_new_ega(0x07, &panel->color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x0f, &panel->act_border_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_file_list_create(window, active, &panel->flist);
-	if (rc != EOK)
-		goto error;
-
-	ui_file_list_set_cb(panel->flist, &panel_flist_cb, (void *)panel);
-
-	panel->window = window;
-	panel->active = active;
-	*rpanel = panel;
-	return EOK;
-error:
-	if (panel->color != NULL)
-		gfx_color_delete(panel->color);
-	if (panel->act_border_color != NULL)
-		gfx_color_delete(panel->act_border_color);
-	if (panel->flist != NULL)
-		ui_file_list_destroy(panel->flist);
-	ui_control_delete(panel->control);
-	free(panel);
-	return rc;
-}
-
-/** Destroy panel.
- *
- * @param panel Panel
- */
-void panel_destroy(panel_t *panel)
-{
-	gfx_color_delete(panel->color);
-	gfx_color_delete(panel->act_border_color);
-	ui_control_delete(panel->control);
-	free(panel);
-}
-
-/** Set panel callbacks.
- *
- * @param panel Panel
- * @param cb Callbacks
- * @param arg Argument to callback functions
- */
-void panel_set_cb(panel_t *panel, panel_cb_t *cb, void *arg)
-{
-	panel->cb = cb;
-	panel->cb_arg = arg;
-}
-
-/** Paint panel.
- *
- * @param panel Panel
- */
-errno_t panel_paint(panel_t *panel)
-{
-	gfx_context_t *gc = ui_window_get_gc(panel->window);
-	ui_resource_t *res = ui_window_get_res(panel->window);
-	ui_box_style_t bstyle;
-	gfx_color_t *bcolor;
-	ui_control_t *ctl;
-	errno_t rc;
-
-	rc = gfx_set_color(gc, panel->color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(gc, &panel->rect);
-	if (rc != EOK)
-		return rc;
-
-	if (panel->active) {
-		bstyle = ui_box_double;
-		bcolor = panel->act_border_color;
-	} else {
-		bstyle = ui_box_single;
-		bcolor = panel->color;
-	}
-
-	rc = ui_paint_text_box(res, &panel->rect, bstyle, bcolor);
-	if (rc != EOK)
-		return rc;
-
-	ctl = ui_file_list_ctl(panel->flist);
-	rc = ui_control_paint(ctl);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Handle panel keyboard event.
- *
- * @param panel Panel
- * @param event Keyboard event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t panel_kbd_event(panel_t *panel, kbd_event_t *event)
-{
-	ui_control_t *ctl;
-
-	if (!panel->active)
-		return ui_unclaimed;
-
-	ctl = ui_file_list_ctl(panel->flist);
-	return ui_control_kbd_event(ctl, event);
-}
-
-/** Handle panel position event.
- *
- * @param panel Panel
- * @param event Position event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t panel_pos_event(panel_t *panel, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	ui_control_t *ctl;
-	ui_evclaim_t claim;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	if (!gfx_pix_inside_rect(&pos, &panel->rect))
-		return ui_unclaimed;
-
-	ctl = ui_file_list_ctl(panel->flist);
-	claim = ui_control_pos_event(ctl, event);
-	if (claim == ui_claimed)
-		return ui_claimed;
-
-	if (!panel->active && event->type == POS_PRESS)
-		panel_activate_req(panel);
-
-	return ui_claimed;
-}
-
-/** Get base control for panel.
- *
- * @param panel Panel
- * @return Base UI control
- */
-ui_control_t *panel_ctl(panel_t *panel)
-{
-	return panel->control;
-}
-
-/** Set panel rectangle.
- *
- * @param panel Panel
- * @param rect Rectangle
- */
-void panel_set_rect(panel_t *panel, gfx_rect_t *rect)
-{
-	gfx_rect_t irect;
-
-	panel->rect = *rect;
-
-	irect.p0.x = panel->rect.p0.x + 1;
-	irect.p0.y = panel->rect.p0.y + 1;
-	irect.p1.x = panel->rect.p1.x;
-	irect.p1.y = panel->rect.p1.y - 1;
-
-	ui_file_list_set_rect(panel->flist, &irect);
-}
-
-/** Determine if panel is active.
- *
- * @param panel Panel
- * @return @c true iff panel is active
- */
-bool panel_is_active(panel_t *panel)
-{
-	return panel->active;
-}
-
-/** Activate panel.
- *
- * @param panel Panel
- *
- * @return EOK on success or an error code
- */
-errno_t panel_activate(panel_t *panel)
-{
-	errno_t rc;
-
-	rc = ui_file_list_activate(panel->flist);
-	if (rc != EOK)
-		return rc;
-
-	panel->active = true;
-	(void) panel_paint(panel);
-	return EOK;
-}
-
-/** Deactivate panel.
- *
- * @param panel Panel
- */
-void panel_deactivate(panel_t *panel)
-{
-	ui_file_list_deactivate(panel->flist);
-	panel->active = false;
-	(void) panel_paint(panel);
-}
-
-/** Destroy panel control.
- *
- * @param arg Argument (panel_t *)
- */
-void panel_ctl_destroy(void *arg)
-{
-	panel_t *panel = (panel_t *) arg;
-
-	panel_destroy(panel);
-}
-
-/** Paint panel control.
- *
- * @param arg Argument (panel_t *)
- * @return EOK on success or an error code
- */
-errno_t panel_ctl_paint(void *arg)
-{
-	panel_t *panel = (panel_t *) arg;
-
-	return panel_paint(panel);
-}
-
-/** Handle panel control keyboard event.
- *
- * @param arg Argument (panel_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t panel_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	panel_t *panel = (panel_t *) arg;
-
-	return panel_kbd_event(panel, event);
-}
-
-/** Handle panel control position event.
- *
- * @param arg Argument (panel_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t panel_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	panel_t *panel = (panel_t *) arg;
-
-	return panel_pos_event(panel, event);
-}
-
-/** Read directory into panel entry list.
- *
- * @param panel Panel
- * @param dirname Directory path
- * @return EOK on success or an error code
- */
-errno_t panel_read_dir(panel_t *panel, const char *dirname)
-{
-	return ui_file_list_read_dir(panel->flist, dirname);
-}
-
-/** Request panel activation.
- *
- * Call back to request panel activation.
- *
- * @param panel Panel
- */
-void panel_activate_req(panel_t *panel)
-{
-	if (panel->cb != NULL && panel->cb->activate_req != NULL)
-		panel->cb->activate_req(panel->cb_arg, panel);
-}
-
-/** File list in panel requests activation.
- *
- * @param flist File list
- * @param arg Argument (panel_t *)
- */
-static void panel_flist_activate_req(ui_file_list_t *flist, void *arg)
-{
-	panel_t *panel = (panel_t *)arg;
-
-	panel_activate_req(panel);
-}
-
-/** File in panel file list was selected.
- *
- * @param flist File list
- * @param arg Argument (panel_t *)
- * @param fname File name
- */
-static void panel_flist_selected(ui_file_list_t *flist, void *arg,
-    const char *fname)
-{
-	panel_t *panel = (panel_t *)arg;
-
-	if (panel->cb != NULL && panel->cb->file_open != NULL)
-		panel->cb->file_open(panel->cb_arg, panel, fname);
-}
-
-/** @}
- */
Index: pace/app/nav/panel.h
===================================================================
--- uspace/app/nav/panel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator panel
- */
-
-#ifndef PANEL_H
-#define PANEL_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <ui/control.h>
-#include <ui/window.h>
-#include <stdbool.h>
-#include "types/panel.h"
-
-extern errno_t panel_create(ui_window_t *, bool, panel_t **);
-extern void panel_destroy(panel_t *);
-extern void panel_set_cb(panel_t *, panel_cb_t *, void *);
-extern errno_t panel_paint(panel_t *);
-extern ui_evclaim_t panel_kbd_event(panel_t *, kbd_event_t *);
-extern ui_evclaim_t panel_pos_event(panel_t *, pos_event_t *);
-extern ui_control_t *panel_ctl(panel_t *);
-extern void panel_set_rect(panel_t *, gfx_rect_t *);
-extern bool panel_is_active(panel_t *);
-extern errno_t panel_activate(panel_t *);
-extern void panel_deactivate(panel_t *);
-extern errno_t panel_read_dir(panel_t *, const char *);
-extern void panel_activate_req(panel_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/nav/test/main.c
===================================================================
--- uspace/app/nav/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(menu);
-PCUT_IMPORT(nav);
-PCUT_IMPORT(panel);
-
-PCUT_MAIN();
Index: pace/app/nav/test/menu.c
===================================================================
--- uspace/app/nav/test/menu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include "../menu.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(menu);
-
-static void test_menu_file_open(void *);
-static void test_menu_file_edit(void *);
-static void test_menu_file_exit(void *);
-
-static nav_menu_cb_t dummy_cb;
-static nav_menu_cb_t test_cb = {
-	.file_open = test_menu_file_open,
-	.file_edit = test_menu_file_edit,
-	.file_exit = test_menu_file_exit
-};
-
-/** Test response */
-typedef struct {
-	bool file_open;
-	bool file_edit;
-	bool file_exit;
-} test_resp_t;
-
-/** Create and destroy menu. */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	nav_menu_t *menu;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = nav_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	nav_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** nav_menu_set_cb() */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	nav_menu_t *menu;
-	int foo;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = nav_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	nav_menu_set_cb(menu, &test_cb, &foo);
-	PCUT_ASSERT_EQUALS(&test_cb, menu->cb);
-	PCUT_ASSERT_EQUALS(&foo, menu->cb_arg);
-
-	nav_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** File / Open callback */
-PCUT_TEST(file_open)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	nav_menu_t *menu;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = nav_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Call back with no callbacks set */
-	nav_menu_file_open(NULL, menu);
-
-	/* Call back with dummy callbacks set */
-	nav_menu_set_cb(menu, &dummy_cb, &resp);
-	nav_menu_file_open(NULL, menu);
-
-	/* Call back with test callbacks set */
-	resp.file_open = false;
-	nav_menu_set_cb(menu, &test_cb, &resp);
-	nav_menu_file_open(NULL, menu);
-	PCUT_ASSERT_TRUE(resp.file_open);
-
-	nav_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** File / Edit callback */
-PCUT_TEST(file_edit)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	nav_menu_t *menu;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = nav_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Call back with no callbacks set */
-	nav_menu_file_edit(NULL, menu);
-
-	/* Call back with dummy callbacks set */
-	nav_menu_set_cb(menu, &dummy_cb, &resp);
-	nav_menu_file_edit(NULL, menu);
-
-	/* Call back with test callbacks set */
-	resp.file_edit = false;
-	nav_menu_set_cb(menu, &test_cb, &resp);
-	nav_menu_file_edit(NULL, menu);
-	PCUT_ASSERT_TRUE(resp.file_edit);
-
-	nav_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** File / Exit callback */
-PCUT_TEST(file_exit)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	nav_menu_t *menu;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = nav_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Call back with no callbacks set */
-	nav_menu_file_exit(NULL, menu);
-
-	/* Call back with dummy callbacks set */
-	nav_menu_set_cb(menu, &dummy_cb, &resp);
-	nav_menu_file_exit(NULL, menu);
-
-	/* Call back with test callbacks set */
-	resp.file_exit = false;
-	nav_menu_set_cb(menu, &test_cb, &resp);
-	nav_menu_file_exit(NULL, menu);
-	PCUT_ASSERT_TRUE(resp.file_exit);
-
-	nav_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Testing File / Open callback */
-static void test_menu_file_open(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->file_open = true;
-}
-
-/** Testing File / Edit callback */
-static void test_menu_file_edit(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->file_edit = true;
-}
-
-/** Testing File / Exit callback */
-static void test_menu_file_exit(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->file_exit = true;
-}
-
-PCUT_EXPORT(menu);
Index: pace/app/nav/test/nav.c
===================================================================
--- uspace/app/nav/test/nav.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include "../nav.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(nav);
-
-/** Create and destroy navigator. */
-PCUT_TEST(create_destroy)
-{
-	navigator_t *nav;
-	errno_t rc;
-
-	rc = navigator_create(UI_DISPLAY_NULL, &nav);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	navigator_destroy(nav);
-}
-
-/** navigator_get_active_panel() returns the active panel */
-PCUT_TEST(get_active_panel)
-{
-	navigator_t *nav;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = navigator_create(UI_DISPLAY_NULL, &nav);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* First panel should be active at the beginning */
-	panel = navigator_get_active_panel(nav);
-	PCUT_ASSERT_EQUALS(nav->panel[0], panel);
-
-	navigator_destroy(nav);
-}
-
-/** navigator_switch_panel() switches to a different panel */
-PCUT_TEST(switch_panel)
-{
-	navigator_t *nav;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = navigator_create(UI_DISPLAY_NULL, &nav);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* First panel should be active at the beginning */
-	panel = navigator_get_active_panel(nav);
-	PCUT_ASSERT_EQUALS(nav->panel[0], panel);
-
-	navigator_switch_panel(nav);
-
-	/* Second panel should be active now */
-	panel = navigator_get_active_panel(nav);
-	PCUT_ASSERT_EQUALS(nav->panel[1], panel);
-
-	navigator_switch_panel(nav);
-
-	/* First panel should be active again */
-	panel = navigator_get_active_panel(nav);
-	PCUT_ASSERT_EQUALS(nav->panel[0], panel);
-
-	navigator_destroy(nav);
-}
-
-PCUT_EXPORT(nav);
Index: pace/app/nav/test/panel.c
===================================================================
--- uspace/app/nav/test/panel.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,402 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <ui/ui.h>
-#include <vfs/vfs.h>
-#include "../panel.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(panel);
-
-/** Test response */
-typedef struct {
-	bool activate_req;
-	panel_t *activate_req_panel;
-} test_resp_t;
-
-static void test_panel_activate_req(void *, panel_t *);
-
-static panel_cb_t test_cb = {
-	.activate_req = test_panel_activate_req
-};
-
-/** Create and destroy panel. */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_set_cb() sets callback */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	panel_set_cb(panel, &test_cb, &resp);
-	PCUT_ASSERT_EQUALS(&test_cb, panel->cb);
-	PCUT_ASSERT_EQUALS(&resp, panel->cb_arg);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test panel_paint() */
-PCUT_TEST(paint)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_paint(panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_ctl() returns a valid UI control */
-PCUT_TEST(ctl)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = panel_ctl(panel);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test panel_kbd_event() */
-PCUT_TEST(kbd_event)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	ui_evclaim_t claimed;
-	kbd_event_t event;
-	errno_t rc;
-
-	/* Active panel should claim events */
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ESCAPE;
-	event.mods = 0;
-	event.c = '\0';
-
-	claimed = panel_kbd_event(panel, &event);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	panel_destroy(panel);
-
-	/* Inactive panel should not claim events */
-
-	rc = panel_create(window, false, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ESCAPE;
-	event.mods = 0;
-	event.c = '\0';
-
-	claimed = panel_kbd_event(panel, &event);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claimed);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test panel_pos_event() */
-PCUT_TEST(pos_event)
-{
-}
-
-/** panel_set_rect() sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	panel_set_rect(panel, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, panel->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, panel->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, panel->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, panel->rect.p1.y);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_is_active() returns panel activity state */
-PCUT_TEST(is_active)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(panel_is_active(panel));
-	panel_destroy(panel);
-
-	rc = panel_create(window, false, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(panel_is_active(panel));
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_activate() activates panel */
-PCUT_TEST(activate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, false, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(panel_is_active(panel));
-	rc = panel_activate(panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(panel_is_active(panel));
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_deactivate() deactivates panel */
-PCUT_TEST(deactivate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(panel_is_active(panel));
-	panel_deactivate(panel);
-	PCUT_ASSERT_FALSE(panel_is_active(panel));
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** panel_activate_req() sends activation request */
-PCUT_TEST(activate_req)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	panel_t *panel;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = panel_create(window, true, &panel);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	panel_set_cb(panel, &test_cb, &resp);
-
-	resp.activate_req = false;
-	resp.activate_req_panel = NULL;
-
-	panel_activate_req(panel);
-	PCUT_ASSERT_TRUE(resp.activate_req);
-	PCUT_ASSERT_EQUALS(panel, resp.activate_req_panel);
-
-	panel_destroy(panel);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_panel_activate_req(void *arg, panel_t *panel)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->activate_req = true;
-	resp->activate_req_panel = panel;
-}
-
-PCUT_EXPORT(panel);
Index: pace/app/nav/types/menu.h
===================================================================
--- uspace/app/nav/types/menu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator menu types
- */
-
-#ifndef TYPES_MENU_H
-#define TYPES_MENU_H
-
-#include <ui/menubar.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Navigator menu callbacks */
-typedef struct nav_menu_cb {
-	/** File / Open */
-	void (*file_open)(void *);
-	/** File / Edit */
-	void (*file_edit)(void *);
-	/** File / Exit */
-	void (*file_exit)(void *);
-} nav_menu_cb_t;
-
-/** Navigator menu */
-typedef struct nav_menu {
-	/** UI */
-	ui_t *ui;
-	/** Containing window */
-	ui_window_t *window;
-	/** Menu bar */
-	ui_menu_bar_t *menubar;
-	/** Callbacks */
-	nav_menu_cb_t *cb;
-	/** Callback argument */
-	void *cb_arg;
-} nav_menu_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/nav/types/nav.h
===================================================================
--- uspace/app/nav/types/nav.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator types
- */
-
-#ifndef TYPES_NAV_H
-#define TYPES_NAV_H
-
-#include <ui/fixed.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-enum {
-	navigator_panels = 2
-};
-
-/** Navigator */
-typedef struct navigator {
-	/** User interface */
-	ui_t *ui;
-	/** Window */
-	ui_window_t *window;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** Menu */
-	struct nav_menu *menu;
-	/** Panels */
-	struct panel *panel[navigator_panels];
-} navigator_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/nav/types/panel.h
===================================================================
--- uspace/app/nav/types/panel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nav
- * @{
- */
-/**
- * @file Navigator panel types
- */
-
-#ifndef TYPES_PANEL_H
-#define TYPES_PANEL_H
-
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <ui/filelist.h>
-#include <ui/window.h>
-#include <stdint.h>
-
-/** Navigator panel
- *
- * This is a custom UI control.
- */
-typedef struct panel {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	ui_window_t *window;
-
-	/** Callbacks */
-	struct panel_cb *cb;
-
-	/** Callback argument */
-	void *cb_arg;
-
-	/** Panel rectangle */
-	gfx_rect_t rect;
-
-	/** Panel color */
-	gfx_color_t *color;
-
-	/** Active border color */
-	gfx_color_t *act_border_color;
-
-	/** @c true iff the panel is active */
-	bool active;
-
-	/** File list */
-	ui_file_list_t *flist;
-} panel_t;
-
-/** Panel callbacks */
-typedef struct panel_cb {
-	/** Request panel activation */
-	void (*activate_req)(void *, panel_t *);
-	/** Open file */
-	void (*file_open)(void *, panel_t *, const char *);
-} panel_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/netecho/comm.c
===================================================================
--- uspace/app/netecho/comm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netecho
- * @{
- */
-/** @file
- */
-
-#include <byteorder.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <fibril.h>
-#include <inet/endpoint.h>
-#include <inet/hostport.h>
-#include <inet/udp.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <str_error.h>
-
-#include "comm.h"
-#include "netecho.h"
-
-static udp_t *udp;
-static udp_assoc_t *assoc;
-
-#define RECV_BUF_SIZE 1024
-static uint8_t recv_buf[RECV_BUF_SIZE];
-
-static void comm_udp_recv_msg(udp_assoc_t *, udp_rmsg_t *);
-static void comm_udp_recv_err(udp_assoc_t *, udp_rerr_t *);
-static void comm_udp_link_state(udp_assoc_t *, udp_link_state_t);
-
-static udp_cb_t comm_udp_cb = {
-	.recv_msg = comm_udp_recv_msg,
-	.recv_err = comm_udp_recv_err,
-	.link_state = comm_udp_link_state
-};
-
-static void comm_udp_recv_msg(udp_assoc_t *assoc, udp_rmsg_t *rmsg)
-{
-	size_t size;
-	size_t pos;
-	size_t now;
-	errno_t rc;
-
-	size = udp_rmsg_size(rmsg);
-	pos = 0;
-	while (pos < size) {
-		now = min(size - pos, RECV_BUF_SIZE);
-		rc = udp_rmsg_read(rmsg, pos, recv_buf, now);
-		if (rc != EOK) {
-			printf("Error reading message.\n");
-			return;
-		}
-
-		netecho_received(recv_buf, now);
-		pos += now;
-	}
-}
-
-static void comm_udp_recv_err(udp_assoc_t *assoc, udp_rerr_t *rerr)
-{
-	printf("Got ICMP error message.\n");
-}
-
-static void comm_udp_link_state(udp_assoc_t *assoc, udp_link_state_t lstate)
-{
-	const char *sstate = NULL;
-
-	switch (lstate) {
-	case udp_ls_down:
-		sstate = "Down";
-		break;
-	case udp_ls_up:
-		sstate = "Up";
-		break;
-	}
-
-	printf("Link state change: %s.\n", sstate);
-}
-
-errno_t comm_open_listen(const char *port_s)
-{
-	inet_ep2_t epp;
-	errno_t rc;
-
-	char *endptr;
-	uint16_t port = strtol(port_s, &endptr, 10);
-	if (*endptr != '\0') {
-		printf("Invalid port number %s\n", port_s);
-		goto error;
-	}
-
-	inet_ep2_init(&epp);
-	epp.local.port = port;
-
-	printf("Listening on port %u\n", port);
-
-	rc = udp_create(&udp);
-	if (rc != EOK)
-		goto error;
-
-	rc = udp_assoc_create(udp, &epp, &comm_udp_cb, NULL, &assoc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	udp_assoc_destroy(assoc);
-	udp_destroy(udp);
-
-	return EIO;
-}
-
-errno_t comm_open_talkto(const char *hostport)
-{
-	inet_ep2_t epp;
-	const char *errmsg;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	rc = inet_hostport_plookup_one(hostport, ip_any, &epp.remote, NULL,
-	    &errmsg);
-	if (rc != EOK) {
-		printf("Error: %s (host:port %s).\n", errmsg, hostport);
-		goto error;
-	}
-
-	printf("Talking to %s\n", hostport);
-
-	rc = udp_create(&udp);
-	if (rc != EOK)
-		goto error;
-
-	rc = udp_assoc_create(udp, &epp, &comm_udp_cb, NULL, &assoc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	udp_assoc_destroy(assoc);
-	udp_destroy(udp);
-
-	return EIO;
-}
-
-void comm_close(void)
-{
-	if (assoc != NULL)
-		udp_assoc_destroy(assoc);
-	if (udp != NULL)
-		udp_destroy(udp);
-}
-
-errno_t comm_send(void *data, size_t size)
-{
-	errno_t rc = udp_assoc_send_msg(assoc, NULL, data, size);
-	if (rc != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/netecho/comm.h
===================================================================
--- uspace/app/netecho/comm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netecho
- * @{
- */
-/**
- * @file
- */
-
-#ifndef COMM_H
-#define COMM_H
-
-#include <stddef.h>
-
-extern errno_t comm_open_listen(const char *);
-extern errno_t comm_open_talkto(const char *);
-extern void comm_close(void);
-extern errno_t comm_send(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/netecho/doc/doxygroups.h
===================================================================
--- uspace/app/netecho/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup netecho netecho
- * @brief Network UDP echo diagnostic utility
- * @ingroup apps
- */
Index: pace/app/netecho/meson.build
===================================================================
--- uspace/app/netecho/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'console' ]
-src = files('comm.c', 'netecho.c')
Index: pace/app/netecho/netecho.c
===================================================================
--- uspace/app/netecho/netecho.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netecho
- * @{
- */
-/** @file Network UDP echo diagnostic utility.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <io/console.h>
-#include <stdio.h>
-#include <str.h>
-
-#include "comm.h"
-#include "netecho.h"
-
-#define NAME "netecho"
-
-static console_ctrl_t *con;
-static bool done;
-
-void netecho_received(void *data, size_t size)
-{
-	char *p;
-	size_t i;
-
-	printf("Received message '");
-	p = data;
-
-	for (i = 0; i < size; i++)
-		putchar(p[i]);
-	printf("'.\n");
-}
-
-static void key_handle_ctrl(kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_Q:
-		done = true;
-		break;
-	default:
-		break;
-	}
-}
-
-static void send_char(char32_t c)
-{
-	char cbuf[STR_BOUNDS(1)];
-	size_t offs;
-	errno_t rc;
-
-	offs = 0;
-	chr_encode(c, cbuf, &offs, STR_BOUNDS(1));
-
-	rc = comm_send(cbuf, offs);
-	if (rc != EOK) {
-		printf("[Failed sending data]\n");
-	}
-}
-
-static void key_handle_unmod(kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_ENTER:
-		send_char('\n');
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t' || ev->c == '\b') {
-			send_char(ev->c);
-		}
-	}
-}
-
-static void key_handle(kbd_event_t *ev)
-{
-	if ((ev->mods & KM_ALT) == 0 &&
-	    (ev->mods & KM_SHIFT) == 0 &&
-	    (ev->mods & KM_CTRL) != 0) {
-		key_handle_ctrl(ev);
-	} else if ((ev->mods & (KM_CTRL | KM_ALT)) == 0) {
-		key_handle_unmod(ev);
-	}
-}
-
-static void print_syntax(void)
-{
-	printf("syntax:\n");
-	printf("\t%s -l <port>\n", NAME);
-	printf("\t%s -d <host>:<port> [<message> [<message...>]]\n", NAME);
-}
-
-/* Interactive mode */
-static void netecho_interact(void)
-{
-	cons_event_t ev;
-	errno_t rc;
-
-	printf("Communication started. Press Ctrl-Q to quit.\n");
-
-	con = console_init(stdin, stdout);
-
-	done = false;
-	while (!done) {
-		rc = console_get_event(con, &ev);
-		if (rc != EOK)
-			break;
-
-		if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS)
-			key_handle(&ev.ev.key);
-	}
-}
-
-static void netecho_send_messages(char **msgs)
-{
-	errno_t rc;
-
-	while (*msgs != NULL) {
-		rc = comm_send(*msgs, str_size(*msgs));
-		if (rc != EOK) {
-			printf("[Failed sending data]\n");
-		}
-
-		++msgs;
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	char *hostport;
-	char *port;
-	char **msgs;
-	errno_t rc;
-
-	if (argc < 2) {
-		print_syntax();
-		return 1;
-	}
-
-	if (str_cmp(argv[1], "-l") == 0) {
-		if (argc != 3) {
-			print_syntax();
-			return 1;
-		}
-
-		port = argv[2];
-		msgs = NULL;
-
-		rc = comm_open_listen(port);
-		if (rc != EOK) {
-			printf("Error setting up communication.\n");
-			return 1;
-		}
-	} else if (str_cmp(argv[1], "-d") == 0) {
-		if (argc < 3) {
-			print_syntax();
-			return 1;
-		}
-
-		hostport = argv[2];
-		port = NULL;
-		msgs = argv + 3;
-
-		rc = comm_open_talkto(hostport);
-		if (rc != EOK) {
-			printf("Error setting up communication.\n");
-			return 1;
-		}
-	} else {
-		print_syntax();
-		return 1;
-	}
-
-	if (msgs != NULL && *msgs != NULL) {
-		/* Just send messages and quit */
-		netecho_send_messages(msgs);
-	} else {
-		/* Interactive mode */
-		netecho_interact();
-	}
-
-	comm_close();
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/netecho/netecho.h
===================================================================
--- uspace/app/netecho/netecho.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup netecho
- * @{
- */
-/**
- * @file
- */
-
-#ifndef NETECHO_H
-#define NETECHO_H
-
-#include <stddef.h>
-
-extern void netecho_received(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/nic/doc/doxygroups.h
===================================================================
--- uspace/app/nic/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup nic nic
- * @brief NIC configuration utility
- * @ingroup apps
- */
Index: pace/app/nic/meson.build
===================================================================
--- uspace/app/nic/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('nic.c')
Index: pace/app/nic/nic.c
===================================================================
--- uspace/app/nic/nic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,605 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nic
- * @{
- */
-/** @file NIC configuration utility.
- *
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <loc.h>
-#include <nic_iface.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME  "nic"
-
-typedef struct {
-	nic_device_info_t device_info;
-	nic_address_t address;
-	nic_cable_state_t link_state;
-	nic_channel_mode_t duplex;
-	nic_unicast_mode_t unicast_mode;
-	nic_multicast_mode_t multicast_mode;
-	nic_broadcast_mode_t broadcast_mode;
-	int speed;
-} nic_info_t;
-
-static void print_syntax(void)
-{
-	printf("syntax:\n");
-	printf("\t" NAME " [<index> <cmd> [<args...>]]\n");
-	printf("\t<index> is NIC index number reported by the tool\n");
-	printf("\t<cmd> is:\n");
-	printf("\taddr <mac_address> - set MAC address\n");
-	printf("\tspeed <10|100|1000> - set NIC speed\n");
-	printf("\tduplex <half|full|simplex> - set duplex mode\n");
-	printf("\tauto - enable autonegotiation\n");
-	printf("\tunicast <block|default|list|promisc> - set unicast receive filtering\n");
-	printf("\tmulticast <block|list|promisc> - set multicast receive filtering\n");
-	printf("\tbroadcast <block|allow> - block or allow incoming broadcast frames\n");
-}
-
-static async_sess_t *get_nic_by_index(size_t i)
-{
-	errno_t rc;
-	size_t count;
-	char *svc_name;
-	category_id_t nic_cat;
-	service_id_t *nics = NULL;
-	async_sess_t *sess;
-
-	rc = loc_category_get_id("nic", &nic_cat, 0);
-	if (rc != EOK) {
-		printf("Error resolving category 'nic'.\n");
-		goto error;
-	}
-
-	rc = loc_category_get_svcs(nic_cat, &nics, &count);
-	if (rc != EOK) {
-		printf("Error getting list of NICs.\n");
-		goto error;
-	}
-
-	rc = loc_service_get_name(nics[i], &svc_name);
-	if (rc != EOK) {
-		printf("Error getting service name.\n");
-		goto error;
-	}
-
-	printf("Using device: %s\n", svc_name);
-
-	sess = loc_service_connect(nics[i], INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf("Error connecting to service.\n");
-		goto error;
-	}
-
-	return sess;
-error:
-	return NULL;
-}
-
-static errno_t nic_get_info(service_id_t svc_id, char *svc_name,
-    nic_info_t *info)
-{
-	async_sess_t *sess;
-	nic_role_t role;
-	errno_t rc;
-
-	sess = loc_service_connect(svc_id, INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf("Error connecting to service.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_get_address(sess, &info->address);
-	if (rc != EOK) {
-		printf("Error getting NIC address.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_get_device_info(sess, &info->device_info);
-	if (rc != EOK) {
-		printf("Error getting NIC device info.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_get_cable_state(sess, &info->link_state);
-	if (rc != EOK) {
-		printf("Error getting link state.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_get_operation_mode(sess, &info->speed, &info->duplex, &role);
-	if (rc != EOK) {
-		printf("Error getting NIC speed and duplex mode.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_unicast_get_mode(sess, &info->unicast_mode, 0, NULL, NULL);
-	if (rc != EOK) {
-		printf("Error gettinc NIC unicast receive mode.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_multicast_get_mode(sess, &info->multicast_mode, 0, NULL, NULL);
-	if (rc != EOK) {
-		printf("Error gettinc NIC multicast receive mode.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = nic_broadcast_get_mode(sess, &info->broadcast_mode);
-	if (rc != EOK) {
-		printf("Error gettinc NIC broadcast receive mode.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-static const char *nic_link_state_str(nic_cable_state_t link_state)
-{
-	switch (link_state) {
-	case NIC_CS_UNKNOWN:
-		return "unknown";
-	case NIC_CS_PLUGGED:
-		return "up";
-	case NIC_CS_UNPLUGGED:
-		return "down";
-	default:
-		assert(false);
-		return NULL;
-	}
-}
-
-static const char *nic_duplex_mode_str(nic_channel_mode_t mode)
-{
-	switch (mode) {
-	case NIC_CM_FULL_DUPLEX:
-		return "full-duplex";
-	case NIC_CM_HALF_DUPLEX:
-		return "half-duplex";
-	case NIC_CM_SIMPLEX:
-		return "simplex";
-	default:
-		assert(false);
-		return NULL;
-	}
-}
-
-static const char *nic_unicast_mode_str(nic_unicast_mode_t mode)
-{
-	switch (mode) {
-	case NIC_UNICAST_UNKNOWN:
-		return "unknown";
-	case NIC_UNICAST_BLOCKED:
-		return "blocked";
-	case NIC_UNICAST_DEFAULT:
-		return "default";
-	case NIC_UNICAST_LIST:
-		return "list";
-	case NIC_UNICAST_PROMISC:
-		return "promisc";
-	default:
-		assert(false);
-		return NULL;
-	}
-}
-
-static const char *nic_multicast_mode_str(nic_multicast_mode_t mode)
-{
-	switch (mode) {
-	case NIC_MULTICAST_UNKNOWN:
-		return "unknown";
-	case NIC_MULTICAST_BLOCKED:
-		return "blocked";
-	case NIC_MULTICAST_LIST:
-		return "list";
-	case NIC_MULTICAST_PROMISC:
-		return "promisc";
-	default:
-		assert(false);
-		return NULL;
-	}
-}
-
-static const char *nic_broadcast_mode_str(nic_broadcast_mode_t mode)
-{
-	switch (mode) {
-	case NIC_BROADCAST_UNKNOWN:
-		return "unknown";
-	case NIC_BROADCAST_BLOCKED:
-		return "blocked";
-	case NIC_BROADCAST_ACCEPTED:
-		return "accepted";
-	default:
-		assert(false);
-		return NULL;
-	}
-}
-
-static char *nic_addr_format(nic_address_t *a)
-{
-	int rc;
-	char *s;
-
-	rc = asprintf(&s, "%02x:%02x:%02x:%02x:%02x:%02x",
-	    a->address[0], a->address[1], a->address[2],
-	    a->address[3], a->address[4], a->address[5]);
-	if (rc < 0)
-		return NULL;
-
-	return s;
-}
-
-static errno_t nic_list(void)
-{
-	category_id_t nic_cat;
-	service_id_t *nics = NULL;
-	nic_info_t nic_info;
-	size_t count, i;
-	char *svc_name;
-	char *addr_str;
-	errno_t rc;
-
-	rc = loc_category_get_id("nic", &nic_cat, 0);
-	if (rc != EOK) {
-		printf("Error resolving category 'nic'.\n");
-		goto error;
-	}
-
-	rc = loc_category_get_svcs(nic_cat, &nics, &count);
-	if (rc != EOK) {
-		printf("Error getting list of NICs.\n");
-		goto error;
-	}
-
-	printf("[Index]: [Service Name]\n");
-	for (i = 0; i < count; i++) {
-		rc = loc_service_get_name(nics[i], &svc_name);
-		if (rc != EOK) {
-			printf("Error getting service name.\n");
-			goto error;
-		}
-
-		rc = nic_get_info(nics[i], svc_name, &nic_info);
-		if (rc != EOK)
-			goto error;
-
-		addr_str = nic_addr_format(&nic_info.address);
-		if (addr_str == NULL) {
-			printf("Out of memory.\n");
-			rc = ENOMEM;
-			goto error;
-		}
-
-		printf("%zu: %s\n", i, svc_name);
-		printf("\tMAC address: %s\n", addr_str);
-		printf("\tVendor name: %s\n",
-		    nic_info.device_info.vendor_name);
-		printf("\tModel name: %s\n",
-		    nic_info.device_info.model_name);
-		printf("\tLink state: %s\n",
-		    nic_link_state_str(nic_info.link_state));
-		printf("\tUnicast receive mode: %s\n",
-		    nic_unicast_mode_str(nic_info.unicast_mode));
-		printf("\tMulticast receive mode: %s\n",
-		    nic_multicast_mode_str(nic_info.multicast_mode));
-		printf("\tBroadcast receive mode: %s\n",
-		    nic_broadcast_mode_str(nic_info.broadcast_mode));
-
-		if (nic_info.link_state == NIC_CS_PLUGGED) {
-			printf("\tSpeed: %dMbps %s\n", nic_info.speed,
-			    nic_duplex_mode_str(nic_info.duplex));
-		}
-
-		free(svc_name);
-		free(addr_str);
-	}
-
-	return EOK;
-error:
-	free(nics);
-	return rc;
-}
-
-static errno_t nic_set_speed(int i, char *str)
-{
-	async_sess_t *sess;
-	uint32_t speed;
-	int oldspeed;
-	nic_channel_mode_t oldduplex;
-	nic_role_t oldrole;
-	errno_t rc;
-
-	rc = str_uint32_t(str, NULL, 10, false, &speed);
-	if (rc != EOK) {
-		printf("Speed must be a numeric value.\n");
-		return rc;
-	}
-
-	if (speed != 10 && speed != 100 && speed != 1000) {
-		printf("Speed must be one of: 10, 100, 1000.\n");
-		return EINVAL;
-	}
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	rc = nic_get_operation_mode(sess, &oldspeed, &oldduplex, &oldrole);
-	if (rc != EOK) {
-		printf("Error getting NIC speed and duplex mode.\n");
-		return EIO;
-	}
-
-	return nic_set_operation_mode(sess, speed, oldduplex, oldrole);
-}
-
-static errno_t nic_set_duplex(int i, char *str)
-{
-	async_sess_t *sess;
-	int oldspeed;
-	nic_channel_mode_t duplex = NIC_CM_UNKNOWN;
-	nic_channel_mode_t oldduplex;
-	nic_role_t oldrole;
-	errno_t rc;
-
-	if (!str_cmp(str, "half"))
-		duplex = NIC_CM_HALF_DUPLEX;
-
-	if (!str_cmp(str, "full"))
-		duplex = NIC_CM_FULL_DUPLEX;
-
-	if (!str_cmp(str, "simplex"))
-		duplex = NIC_CM_SIMPLEX;
-
-	if (duplex == NIC_CM_UNKNOWN) {
-		printf("Invalid duplex specification.\n");
-		return EINVAL;
-	}
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	rc = nic_get_operation_mode(sess, &oldspeed, &oldduplex, &oldrole);
-	if (rc != EOK) {
-		printf("Error getting NIC speed and duplex mode.\n");
-		return EIO;
-	}
-
-	return nic_set_operation_mode(sess, oldspeed, duplex, oldrole);
-}
-
-static errno_t nic_set_autoneg(int i)
-{
-	async_sess_t *sess;
-	errno_t rc;
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	rc = nic_autoneg_restart(sess);
-	if (rc != EOK) {
-		printf("Error restarting NIC autonegotiation.\n");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t nic_set_addr(int i, char *str)
-{
-	async_sess_t *sess;
-	nic_address_t addr;
-	errno_t rc;
-	int idx;
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	if (str_size(str) != 17) {
-		printf("Invalid MAC address specified");
-		return EINVAL;
-	}
-
-	for (idx = 0; idx < 6; idx++) {
-		rc = str_uint8_t(&str[idx * 3], NULL, 16, false, &addr.address[idx]);
-		if (rc != EOK) {
-			printf("Invalid MAC address specified");
-			return EINVAL;
-		}
-	}
-
-	return nic_set_address(sess, &addr);
-}
-
-static errno_t nic_set_rx_unicast(int i, char *str)
-{
-	async_sess_t *sess;
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	if (!str_cmp(str, "block")) {
-		nic_unicast_set_mode(sess, NIC_UNICAST_BLOCKED, NULL, 0);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "default")) {
-		nic_unicast_set_mode(sess, NIC_UNICAST_DEFAULT, NULL, 0);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "list")) {
-		nic_unicast_set_mode(sess, NIC_UNICAST_LIST, NULL, 0);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "promisc")) {
-		nic_unicast_set_mode(sess, NIC_UNICAST_PROMISC, NULL, 0);
-		return EOK;
-	}
-
-	printf("Invalid pameter - should be one of: block, default, promisc\n");
-	return EINVAL;
-}
-
-static errno_t nic_set_rx_multicast(int i, char *str)
-{
-	async_sess_t *sess;
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	if (!str_cmp(str, "block")) {
-		nic_multicast_set_mode(sess, NIC_MULTICAST_BLOCKED, NULL, 0);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "list")) {
-		nic_multicast_set_mode(sess, NIC_MULTICAST_LIST, NULL, 0);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "promisc")) {
-		nic_multicast_set_mode(sess, NIC_MULTICAST_PROMISC, NULL, 0);
-		return EOK;
-	}
-
-	printf("Invalid pameter - should be one of: block, promisc\n");
-	return EINVAL;
-}
-
-static errno_t nic_set_rx_broadcast(int i, char *str)
-{
-	async_sess_t *sess;
-
-	sess = get_nic_by_index(i);
-	if (sess == NULL) {
-		printf("Specified NIC doesn't exist or cannot connect to it.\n");
-		return EINVAL;
-	}
-
-	if (!str_cmp(str, "block")) {
-		nic_broadcast_set_mode(sess, NIC_BROADCAST_BLOCKED);
-		return EOK;
-	}
-
-	if (!str_cmp(str, "accept")) {
-		nic_broadcast_set_mode(sess, NIC_BROADCAST_ACCEPTED);
-		return EOK;
-	}
-
-	printf("Invalid pameter - should be 'block' or 'accept'\n");
-	return EINVAL;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	uint32_t index;
-
-	if (argc == 1) {
-		rc = nic_list();
-		if (rc != EOK)
-			return 1;
-	} else if (argc >= 3) {
-		rc = str_uint32_t(argv[1], NULL, 10, false, &index);
-		if (rc != EOK) {
-			printf(NAME ": Invalid argument.\n");
-			print_syntax();
-			return 1;
-		}
-
-		if (!str_cmp(argv[2], "addr"))
-			return nic_set_addr(index, argv[3]);
-
-		if (!str_cmp(argv[2], "speed"))
-			return nic_set_speed(index, argv[3]);
-
-		if (!str_cmp(argv[2], "duplex"))
-			return nic_set_duplex(index, argv[3]);
-
-		if (!str_cmp(argv[2], "auto"))
-			return nic_set_autoneg(index);
-
-		if (!str_cmp(argv[2], "unicast"))
-			return nic_set_rx_unicast(index, argv[3]);
-
-		if (!str_cmp(argv[2], "multicast"))
-			return nic_set_rx_multicast(index, argv[3]);
-
-		if (!str_cmp(argv[2], "broadcast"))
-			return nic_set_rx_broadcast(index, argv[3]);
-
-	} else {
-		printf(NAME ": Invalid argument.\n");
-		print_syntax();
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/nterm/conn.c
===================================================================
--- uspace/app/nterm/conn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nterm
- * @{
- */
-/** @file
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <fibril.h>
-#include <inet/endpoint.h>
-#include <inet/hostport.h>
-#include <inet/tcp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <str_error.h>
-
-#include "conn.h"
-#include "nterm.h"
-
-static tcp_t *tcp;
-static tcp_conn_t *conn;
-
-#define RECV_BUF_SIZE 1024
-static uint8_t recv_buf[RECV_BUF_SIZE];
-
-static void conn_conn_reset(tcp_conn_t *);
-static void conn_data_avail(tcp_conn_t *);
-
-static tcp_cb_t conn_cb = {
-	.conn_reset = conn_conn_reset,
-	.data_avail = conn_data_avail
-};
-
-static void conn_conn_reset(tcp_conn_t *conn)
-{
-	printf("\n[Connection reset]\n");
-}
-
-static void conn_data_avail(tcp_conn_t *conn)
-{
-	errno_t rc;
-	size_t nrecv;
-
-	while (true) {
-		rc = tcp_conn_recv(conn, recv_buf, RECV_BUF_SIZE, &nrecv);
-		if (rc != EOK) {
-			printf("\n[Receive error: %s]\n", str_error_name(rc));
-			break;
-		}
-
-		nterm_received(recv_buf, nrecv);
-
-		if (nrecv != RECV_BUF_SIZE)
-			break;
-	}
-}
-
-errno_t conn_open(const char *hostport)
-{
-	inet_ep2_t epp;
-	const char *errmsg;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	rc = inet_hostport_plookup_one(hostport, ip_any, &epp.remote, NULL,
-	    &errmsg);
-	if (rc != EOK) {
-		printf("Error: %s (host:port %s).\n", errmsg, hostport);
-		goto error;
-	}
-
-	printf("Connecting to %s\n", hostport);
-	char *s;
-	rc = inet_addr_format(&epp.remote.addr, &s);
-	if (rc != EOK)
-		goto error;
-
-	rc = tcp_create(&tcp);
-	if (rc != EOK)
-		goto error;
-
-	rc = tcp_conn_create(tcp, &epp, &conn_cb, NULL, &conn);
-	if (rc != EOK)
-		goto error;
-
-	rc = tcp_conn_wait_connected(conn);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	tcp_conn_destroy(conn);
-	tcp_destroy(tcp);
-
-	return EIO;
-}
-
-errno_t conn_send(void *data, size_t size)
-{
-	errno_t rc = tcp_conn_send(conn, data, size);
-	if (rc != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/nterm/conn.h
===================================================================
--- uspace/app/nterm/conn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef CONN_H
-#define CONN_H
-
-#include <stddef.h>
-
-extern errno_t conn_open(const char *);
-extern errno_t conn_send(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/nterm/doc/doxygroups.h
===================================================================
--- uspace/app/nterm/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup nterm nterm
- * @brief Network serial terminal emulator
- * @ingroup apps
- */
Index: pace/app/nterm/meson.build
===================================================================
--- uspace/app/nterm/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'console' ]
-src = files('conn.c', 'nterm.c')
Index: pace/app/nterm/nterm.c
===================================================================
--- uspace/app/nterm/nterm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nterm
- * @{
- */
-/** @file Network serial terminal emulator.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <io/console.h>
-#include <stdio.h>
-#include <str.h>
-
-#include "conn.h"
-#include "nterm.h"
-
-#define NAME "nterm"
-
-static console_ctrl_t *con;
-static bool done;
-
-static void key_handle_ctrl(kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_Q:
-		done = true;
-		break;
-	default:
-		break;
-	}
-}
-
-static void send_char(char32_t c)
-{
-	char cbuf[STR_BOUNDS(1)];
-	size_t offs;
-	errno_t rc;
-
-	offs = 0;
-	chr_encode(c, cbuf, &offs, STR_BOUNDS(1));
-
-	rc = conn_send(cbuf, offs);
-	if (rc != EOK) {
-		printf("[Failed sending data]\n");
-	}
-}
-
-static void key_handle_unmod(kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_ENTER:
-		send_char('\n');
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t' || ev->c == '\b') {
-			send_char(ev->c);
-		}
-	}
-}
-
-static void key_handle(kbd_event_t *ev)
-{
-	if ((ev->mods & KM_ALT) == 0 &&
-	    (ev->mods & KM_SHIFT) == 0 &&
-	    (ev->mods & KM_CTRL) != 0) {
-		key_handle_ctrl(ev);
-	} else if ((ev->mods & (KM_CTRL | KM_ALT)) == 0) {
-		key_handle_unmod(ev);
-	}
-}
-
-void nterm_received(void *data, size_t size)
-{
-	fwrite(data, size, 1, stdout);
-	fflush(stdout);
-}
-
-static void print_syntax(void)
-{
-	printf("syntax: nterm <host>:<port>\n");
-}
-
-int main(int argc, char *argv[])
-{
-	cons_event_t ev;
-	errno_t rc;
-
-	if (argc != 2) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = conn_open(argv[1]);
-	if (rc != EOK) {
-		printf("Error connecting.\n");
-		return 1;
-	}
-
-	printf("Connection established.\n");
-
-	con = console_init(stdin, stdout);
-
-	done = false;
-	while (!done) {
-		rc = console_get_event(con, &ev);
-		if (rc != EOK)
-			break;
-
-		if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS)
-			key_handle(&ev.ev.key);
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/nterm/nterm.h
===================================================================
--- uspace/app/nterm/nterm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nterm
- * @{
- */
-/**
- * @file
- */
-
-#ifndef NTERM_H
-#define NTERM_H
-
-#include <stddef.h>
-
-extern void nterm_received(void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/ofw/doc/doxygroups.h
===================================================================
--- uspace/app/ofw/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ofw ofw
- * @brief Tool for printing the OpenFirmware device tree
- * @ingroup apps
- */
Index: pace/app/ofw/meson.build
===================================================================
--- uspace/app/ofw/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-platform_specific = true
-
-deps = [ 'ofw' ]
-src = files('ofw.c')
Index: pace/app/ofw/ofw.c
===================================================================
--- uspace/app/ofw/ofw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ofw
- * @{
- */
-
-/**
- * @file
- * @brief Tool for printing the OpenFirmware device tree
- */
-
-#include <errno.h>
-#include <ofw.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define NAME	"ofw"
-
-#define MAX_NAME_LENGTH 1024
-
-static void syntax_print(void);
-static errno_t ofw_print_subtree(const char *, bool);
-static errno_t ofw_print_properties(const char *);
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	const char *path = "/";
-	bool verbose = false;
-
-	--argc;
-	++argv;
-
-	while (argc > 0 && argv[0][0] == '-') {
-		if (str_cmp(argv[0], "-p") == 0) {
-			--argc;
-			++argv;
-			if (argc < 1) {
-				printf("Option argument missing.\n");
-				return 1;
-			}
-
-			path = argv[0];
-			--argc;
-			++argv;
-		} else if (str_cmp(argv[0], "-v") == 0) {
-			--argc;
-			++argv;
-
-			verbose = true;
-		} else {
-			syntax_print();
-			return 1;
-		}
-	}
-
-	if (argc != 0) {
-		syntax_print();
-		return 1;
-	}
-
-	rc = ofw_print_subtree(path, verbose);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: %s [<options>]\n", NAME);
-	printf("options:\n"
-	    "\t-v        Verbose mode (print properties and their values)\n"
-	    "\t-p <path> Only print devices under <path>\n");
-}
-
-/** List OpenFirmware device nodes under a specific node.
- *
- * @param path Path of node where to start printing
- * @param verbose If @c true, print properties
- * @return EOK on success or an error code
- */
-static errno_t ofw_print_subtree(const char *path, bool verbose)
-{
-	char *subpath;
-	ofw_child_it_t it;
-	errno_t rc;
-
-	printf("%s\n", path);
-
-	if (verbose) {
-		rc = ofw_print_properties(path);
-		if (rc != EOK)
-			return rc;
-	}
-
-	rc = ofw_child_it_first(&it, path);
-	while (!ofw_child_it_end(&it)) {
-		rc = ofw_child_it_get_path(&it, &subpath);
-		if (rc != EOK)
-			goto error;
-
-		rc = ofw_print_subtree(subpath, verbose);
-		if (rc != EOK)
-			goto error;
-
-		free(subpath);
-		subpath = NULL;
-
-		ofw_child_it_next(&it);
-	}
-
-	ofw_child_it_fini(&it);
-	return EOK;
-error:
-	if (subpath != NULL)
-		free(subpath);
-	ofw_child_it_fini(&it);
-	return rc;
-}
-
-static errno_t ofw_print_properties(const char *ofwpath)
-{
-	const char *propname;
-	const uint8_t *propval;
-	size_t val_sz;
-	ofw_prop_it_t it;
-	errno_t rc;
-	size_t i;
-
-	rc = ofw_prop_it_first(&it, ofwpath);
-	if (rc != EOK)
-		return rc;
-
-	while (!ofw_prop_it_end(&it)) {
-		propname = ofw_prop_it_get_name(&it);
-		printf("'%s' =", propname);
-
-		propval = ofw_prop_it_get_data(&it, &val_sz);
-
-		for (i = 0; i < val_sz; i++)
-			printf(" %02x", propval[i]);
-
-		printf(" ('%*s')\n", (int)val_sz - 1, (char *)propval);
-		ofw_prop_it_next(&it);
-	}
-
-	ofw_prop_it_fini(&it);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/app/pci/doc/doxygroups.h
===================================================================
--- uspace/app/pci/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pci pci
- * @brief Tool for listing PCI devices
- * @ingroup apps
- */
Index: pace/app/pci/meson.build
===================================================================
--- uspace/app/pci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('pci.c')
Index: pace/app/pci/pci.c
===================================================================
--- uspace/app/pci/pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci
- * @{
- */
-
-/**
- * @file
- * @brief Tool for listing PCI devices.
- */
-
-#include <devman.h>
-#include <errno.h>
-#include <io/table.h>
-#include <loc.h>
-#include <pci.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define NAME	"mkext4"
-
-#define MAX_NAME_LENGTH 1024
-
-static void syntax_print(void);
-static errno_t pci_list(void);
-static errno_t pci_list_bridge(const char *);
-static errno_t pci_list_bridge_id(service_id_t);
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	const char *bridge = NULL;
-
-	--argc;
-	++argv;
-
-	while (argc > 0 && argv[0][0] == '-') {
-		if (str_cmp(argv[0], "--bridge") == 0) {
-			--argc;
-			++argv;
-			if (argc < 1) {
-				printf("Option argument missing.\n");
-				return 1;
-			}
-
-			bridge = argv[0];
-			--argc;
-			++argv;
-		} else {
-			syntax_print();
-			return 1;
-		}
-	}
-
-	if (argc != 0) {
-		syntax_print();
-		return 1;
-	}
-
-	if (bridge != NULL)
-		rc = pci_list_bridge(bridge);
-	else
-		rc = pci_list();
-
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: pci [<options>]\n");
-	printf("options:\n"
-	    "\t--bridge <svc-name> Only devices under host bridge <svc-name>\n");
-}
-
-/** List PCI devices. */
-static errno_t pci_list(void)
-{
-	errno_t rc;
-	category_id_t pci_cat_id;
-	service_id_t *svc_ids = NULL;
-	size_t svc_cnt;
-	size_t i;
-
-	rc = loc_category_get_id("pci", &pci_cat_id, 0);
-	if (rc != EOK) {
-		printf("Error getting 'pci' category ID.\n");
-		goto error;
-	}
-
-	rc = loc_category_get_svcs(pci_cat_id, &svc_ids, &svc_cnt);
-	if (rc != EOK) {
-		printf("Error getting list of PCI services.\n");
-		goto error;
-	}
-
-	for (i = 0; i < svc_cnt; i++) {
-		if (i > 0)
-			putchar('\n');
-
-		rc = pci_list_bridge_id(svc_ids[i]);
-		if (rc != EOK)
-			goto error;
-	}
-
-	free(svc_ids);
-	return EOK;
-error:
-	if (svc_ids != NULL)
-		free(svc_ids);
-	return rc;
-}
-
-/** List PCI devices under a host bridge specified by name.
- *
- * @param svc_name PCI service name
- * @return EOK on success or an error code
- */
-static errno_t pci_list_bridge(const char *svc_name)
-{
-	errno_t rc;
-	service_id_t svc_id;
-
-	rc = loc_service_get_id(svc_name, &svc_id, 0);
-	if (rc != EOK) {
-		printf("Error looking up host bridge '%s'.\n", svc_name);
-		return rc;
-	}
-
-	return pci_list_bridge_id(svc_id);
-}
-
-/** List PCI devices under a host bridge specified by ID.
- *
- * @param svc_id PCI service ID
- * @return EOK on success or an error code
- */
-static errno_t pci_list_bridge_id(service_id_t svc_id)
-{
-	errno_t rc;
-	devman_handle_t *dev_ids = NULL;
-	size_t dev_cnt;
-	pci_dev_info_t dev_info;
-	size_t i;
-	pci_t *pci = NULL;
-	char *svc_name = NULL;
-	char *drv_name = NULL;
-	table_t *table = NULL;
-
-	drv_name = malloc(MAX_NAME_LENGTH);
-	if (drv_name == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Address\t" "Type\t" "Driver\n");
-
-	rc = loc_service_get_name(svc_id, &svc_name);
-	if (rc != EOK) {
-		printf("Error getting service name.\n");
-		goto error;
-	}
-
-	rc = pci_open(svc_id, &pci);
-	if (rc != EOK) {
-		printf("Error opening PCI service '%s'.\n", svc_name);
-		goto error;
-	}
-
-	rc = pci_get_devices(pci, &dev_ids, &dev_cnt);
-	if (rc != EOK) {
-		printf("Error getting PCI device list.\n");
-		goto error;
-	}
-
-	for (i = 0; i < dev_cnt; i++) {
-		rc = pci_dev_get_info(pci, dev_ids[i], &dev_info);
-		if (rc != EOK) {
-			printf("Error getting PCI device info.\n");
-			goto error;
-		}
-
-		rc = devman_fun_get_driver_name(dev_info.dev_handle,
-		    drv_name, MAX_NAME_LENGTH);
-		if (rc != EOK && rc != EINVAL) {
-			printf("Error getting driver name.\n");
-			goto error;
-		}
-
-		if (rc == EINVAL)
-			drv_name[0] = '\0';
-
-		table_printf(table, "%02x.%02x.%x\t" "%04x:%04x\t"
-		    "%s\n", dev_info.bus_num, dev_info.dev_num,
-		    dev_info.fn_num, dev_info.vendor_id,
-		    dev_info.device_id, drv_name);
-	}
-
-	printf("Device listing for host bridge %s:\n\n", svc_name);
-	rc = table_print_out(table, stdout);
-	if (rc != EOK) {
-		printf("Error printing table.\n");
-		goto error;
-	}
-
-	table_destroy(table);
-	table = NULL;
-	free(dev_ids);
-	dev_ids = NULL;
-	pci_close(pci);
-	pci = NULL;
-	free(svc_name);
-	svc_name = NULL;
-
-	free(drv_name);
-	return EOK;
-error:
-	if (drv_name != NULL)
-		free(drv_name);
-	if (table != NULL)
-		table_destroy(table);
-	if (pci != NULL)
-		pci_close(pci);
-	if (svc_name != NULL)
-		free(svc_name);
-	if (dev_ids != NULL)
-		free(dev_ids);
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/app/ping/doc/doxygroups.h
===================================================================
--- uspace/app/ping/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ping ping
- * @brief ICMP echo utility
- * @ingroup apps
- */
Index: pace/app/ping/meson.build
===================================================================
--- uspace/app/ping/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'console' ]
-src = files('ping.c')
Index: pace/app/ping/ping.c
===================================================================
--- uspace/app/ping/ping.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,338 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ping
- * @{
- */
-/** @file ICMP echo utility.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/host.h>
-#include <inet/inetping.h>
-#include <io/console.h>
-#include <getopt.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME "ping"
-
-/** Delay between subsequent ping requests in microseconds */
-#define PING_DELAY (1000 * 1000)
-
-/** Ping request timeout in microseconds */
-#define PING_TIMEOUT (1000 * 1000)
-
-typedef enum {
-	RECEIVED_NONE,
-	RECEIVED_SUCCESS,
-	RECEIVED_INTERRUPT
-} received_t;
-
-static received_t received;
-static FIBRIL_CONDVAR_INITIALIZE(received_cv);
-static FIBRIL_MUTEX_INITIALIZE(received_lock);
-
-static bool quit = false;
-static FIBRIL_CONDVAR_INITIALIZE(quit_cv);
-static FIBRIL_MUTEX_INITIALIZE(quit_lock);
-
-static errno_t ping_ev_recv(inetping_sdu_t *);
-
-static inetping_ev_ops_t ev_ops = {
-	.recv = ping_ev_recv
-};
-
-static inet_addr_t src_addr;
-static inet_addr_t dest_addr;
-
-static bool repeat_forever = false;
-static size_t repeat_count = 1;
-
-static const char *short_options = "46rn:";
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [<options>] <host>\n", NAME);
-	printf("\t-n <count> Repeat the specified number of times\n");
-	printf("\t-r         Repeat forever\n");
-	printf("\t-4|-6      Use IPv4 or IPv6 destination host address\n");
-}
-
-static void ping_signal_received(received_t value)
-{
-	fibril_mutex_lock(&received_lock);
-	received = value;
-	fibril_mutex_unlock(&received_lock);
-	fibril_condvar_broadcast(&received_cv);
-}
-
-static void ping_signal_quit(void)
-{
-	fibril_mutex_lock(&quit_lock);
-	quit = true;
-	fibril_mutex_unlock(&quit_lock);
-	fibril_condvar_broadcast(&quit_cv);
-}
-
-static errno_t ping_ev_recv(inetping_sdu_t *sdu)
-{
-	char *asrc;
-	errno_t rc = inet_addr_format(&src_addr, &asrc);
-	if (rc != EOK)
-		return ENOMEM;
-
-	char *adest;
-	rc = inet_addr_format(&dest_addr, &adest);
-	if (rc != EOK) {
-		free(asrc);
-		return ENOMEM;
-	}
-
-	printf("Received ICMP echo reply: from %s to %s, seq. no %u, "
-	    "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size);
-
-	ping_signal_received(RECEIVED_SUCCESS);
-
-	free(asrc);
-	free(adest);
-	return EOK;
-}
-
-static errno_t ping_send(uint16_t seq_no)
-{
-	inetping_sdu_t sdu;
-
-	sdu.src = src_addr;
-	sdu.dest = dest_addr;
-	sdu.seq_no = seq_no;
-	sdu.data = (void *) "foo";
-	sdu.size = 3;
-
-	errno_t rc = inetping_send(&sdu);
-	if (rc != EOK)
-		printf("Failed sending echo request: %s: %s.\n",
-		    str_error_name(rc), str_error(rc));
-
-	return rc;
-}
-
-static errno_t transmit_fibril(void *arg)
-{
-	uint16_t seq_no = 0;
-
-	while ((repeat_count--) || (repeat_forever)) {
-		fibril_mutex_lock(&received_lock);
-		received = RECEIVED_NONE;
-		fibril_mutex_unlock(&received_lock);
-
-		(void) ping_send(++seq_no);
-
-		fibril_mutex_lock(&received_lock);
-		errno_t rc = fibril_condvar_wait_timeout(&received_cv, &received_lock,
-		    PING_TIMEOUT);
-		received_t recv = received;
-		fibril_mutex_unlock(&received_lock);
-
-		if ((rc == ETIMEOUT) || (recv == RECEIVED_NONE))
-			printf("Echo request timed out (seq. no %u)\n", seq_no);
-
-		if (recv == RECEIVED_INTERRUPT)
-			break;
-
-		if ((repeat_count > 0) || (repeat_forever)) {
-			fibril_mutex_lock(&received_lock);
-			rc = fibril_condvar_wait_timeout(&received_cv, &received_lock,
-			    PING_DELAY);
-			recv = received;
-			fibril_mutex_unlock(&received_lock);
-
-			if (recv == RECEIVED_INTERRUPT)
-				break;
-		}
-	}
-
-	ping_signal_quit();
-	return 0;
-}
-
-static errno_t input_fibril(void *arg)
-{
-	console_ctrl_t *con = console_init(stdin, stdout);
-
-	while (true) {
-		cons_event_t ev;
-		errno_t rc;
-		rc = console_get_event(con, &ev);
-		if (rc != EOK) {
-			ping_signal_received(RECEIVED_INTERRUPT);
-			break;
-		}
-
-		if ((ev.type == CEV_KEY) && (ev.ev.key.type == KEY_PRESS) &&
-		    ((ev.ev.key.mods & (KM_ALT | KM_SHIFT)) == 0) &&
-		    ((ev.ev.key.mods & KM_CTRL) != 0)) {
-			/* Ctrl+key */
-			if (ev.ev.key.key == KC_Q) {
-				ping_signal_received(RECEIVED_INTERRUPT);
-				break;
-			}
-		}
-	}
-
-	return 0;
-}
-
-int main(int argc, char *argv[])
-{
-	char *asrc = NULL;
-	char *adest = NULL;
-	char *sdest = NULL;
-	char *host;
-	const char *errmsg;
-	ip_ver_t ip_ver = ip_any;
-
-	errno_t rc = inetping_init(&ev_ops);
-	if (rc != EOK) {
-		printf("Failed connecting to internet ping service: "
-		    "%s: %s.\n", str_error_name(rc), str_error(rc));
-		goto error;
-	}
-
-	int c;
-	while ((c = getopt(argc, argv, short_options)) != -1) {
-		switch (c) {
-		case 'r':
-			repeat_forever = true;
-			break;
-		case 'n':
-			rc = str_size_t(optarg, NULL, 10, true, &repeat_count);
-			if (rc != EOK) {
-				printf("Invalid repeat count.\n");
-				print_syntax();
-				goto error;
-			}
-			break;
-		case '4':
-			ip_ver = ip_v4;
-			break;
-		case '6':
-			ip_ver = ip_v6;
-			break;
-		default:
-			printf("Unknown option passed.\n");
-			print_syntax();
-			goto error;
-		}
-	}
-
-	if (optind >= argc) {
-		printf("IP address or host name not supplied.\n");
-		print_syntax();
-		goto error;
-	}
-
-	host = argv[optind];
-
-	/* Look up host */
-	rc = inet_host_plookup_one(host, ip_ver, &dest_addr, NULL, &errmsg);
-	if (rc != EOK) {
-		printf("Error resolving host '%s' (%s).\n", host, errmsg);
-		goto error;
-	}
-
-	/* Determine source address */
-	rc = inetping_get_srcaddr(&dest_addr, &src_addr);
-	if (rc != EOK) {
-		printf("Failed determining source address.\n");
-		goto error;
-	}
-
-	rc = inet_addr_format(&src_addr, &asrc);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = inet_addr_format(&dest_addr, &adest);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	if (asprintf(&sdest, "%s (%s)", host, adest) < 0) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	printf("Sending ICMP echo request from %s to %s (Ctrl+Q to quit)\n",
-	    asrc, sdest);
-
-	fid_t fid = fibril_create(transmit_fibril, NULL);
-	if (fid == 0) {
-		printf("Failed creating transmit fibril.\n");
-		goto error;
-	}
-
-	fibril_add_ready(fid);
-
-	fid = fibril_create(input_fibril, NULL);
-	if (fid == 0) {
-		printf("Failed creating input fibril.\n");
-		goto error;
-	}
-
-	fibril_add_ready(fid);
-
-	fibril_mutex_lock(&quit_lock);
-	while (!quit)
-		fibril_condvar_wait(&quit_cv, &quit_lock);
-	fibril_mutex_unlock(&quit_lock);
-
-	free(asrc);
-	free(adest);
-	free(sdest);
-	return 0;
-
-error:
-	free(asrc);
-	free(adest);
-	free(sdest);
-	return 1;
-}
-
-/** @}
- */
Index: pace/app/pkg/doc/doxygroups.h
===================================================================
--- uspace/app/pkg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pkg pkg
- * @brief Package installer
- * @ingroup apps
- */
Index: pace/app/pkg/meson.build
===================================================================
--- uspace/app/pkg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('pkg.c')
Index: pace/app/pkg/pkg.c
===================================================================
--- uspace/app/pkg/pkg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,207 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pkg
- * @{
- */
-/** @file Package installer
- *
- * Utility to simplify installation of coastline packages
- */
-
-#include <errno.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <task.h>
-
-#define NAME "pkg"
-
-static void print_syntax(void)
-{
-	fprintf(stderr, "syntax: " NAME " install <package-name>\n");
-}
-
-static errno_t cmd_runl(const char *path, ...)
-{
-	va_list ap;
-	const char *arg;
-	int cnt = 0;
-
-	va_start(ap, path);
-	do {
-		arg = va_arg(ap, const char *);
-		cnt++;
-	} while (arg != NULL);
-	va_end(ap);
-
-	va_start(ap, path);
-	task_id_t id;
-	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
-	va_end(ap);
-
-	if (rc != EOK) {
-		printf("Error spawning %s (%s)\n", path, str_error(rc));
-		return rc;
-	}
-
-	if (!id) {
-		printf("Error spawning %s (invalid task ID)\n", path);
-		return EINVAL;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&wait, &texit, &retval);
-	if (rc != EOK) {
-		printf("Error waiting for %s (%s)\n", path, str_error(rc));
-		return rc;
-	}
-
-	if (texit != TASK_EXIT_NORMAL) {
-		printf("Command %s unexpectedly terminated\n", path);
-		return EINVAL;
-	}
-
-	if (retval != 0) {
-		printf("Command %s returned non-zero exit code %d)\n",
-		    path, retval);
-	}
-
-	return retval == 0 ? EOK : EPARTY;
-}
-
-static errno_t pkg_install(int argc, char *argv[])
-{
-	char *pkg_name;
-	char *src_uri;
-	char *fname;
-	char *fnunpack;
-	errno_t rc;
-	int ret;
-
-	if (argc != 3) {
-		print_syntax();
-		return EINVAL;
-	}
-
-	pkg_name = argv[2];
-
-	ret = asprintf(&src_uri, "http://ci-ipv4.helenos.org/latest/" STRING(UARCH)
-	    "/%s-for-helenos-" STRING(UARCH) ".tar.gz",
-	    pkg_name);
-	if (ret < 0) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	ret = asprintf(&fname, "/tmp/%s-for-helenos-" STRING(UARCH)
-	    ".tar.gz", pkg_name);
-	if (ret < 0) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	ret = asprintf(&fnunpack, "/tmp/%s-for-helenos-" STRING(UARCH) ".tar",
-	    pkg_name);
-	if (ret < 0) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-	/* XXX error cleanup */
-
-	printf("Downloading '%s'.\n", src_uri);
-
-	rc = cmd_runl("/app/download", "/app/download", "-o", fname,
-	    src_uri, NULL);
-	if (rc != EOK) {
-		printf("Error downloading package archive.\n");
-		return rc;
-	}
-
-	printf("Extracting package\n");
-
-	rc = cmd_runl("/app/gunzip", "/app/gunzip", fname, fnunpack, NULL);
-	if (rc != EOK) {
-		printf("Error uncompressing package archive.\n");
-		return rc;
-	}
-
-	if (remove(fname) != 0) {
-		printf("Error deleting package archive.\n");
-		return rc;
-	}
-
-	rc = cmd_runl("/app/untar", "/app/untar", fnunpack, NULL);
-	if (rc != EOK) {
-		printf("Error extracting package archive.\n");
-		return rc;
-	}
-
-	if (remove(fnunpack) != 0) {
-		printf("Error deleting package archive.\n");
-		return rc;
-	}
-
-	printf("Package '%s' installed.\n", pkg_name);
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	char *cmd;
-	errno_t rc;
-
-	if (argc < 2) {
-		fprintf(stderr, "Arguments missing.\n");
-		print_syntax();
-		return 1;
-	}
-
-	cmd = argv[1];
-
-	if (str_cmp(cmd, "install") == 0) {
-		rc = pkg_install(argc, argv);
-	} else {
-		fprintf(stderr, "Unknown command.\n");
-		print_syntax();
-		return 1;
-	}
-
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/redir/doc/doxygroups.h
===================================================================
--- uspace/app/redir/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup redir redir
- * @brief Redirect stdin/stdout/stderr
- * @ingroup apps
- */
Index: pace/app/redir/meson.build
===================================================================
--- uspace/app/redir/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('redir.c')
Index: pace/app/redir/redir.c
===================================================================
--- uspace/app/redir/redir.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup redir
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <stdio.h>
-#include <task.h>
-#include <str_error.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-
-#define NAME  "redir"
-
-static void usage(void)
-{
-	fprintf(stderr, "Usage: %s [-i <stdin>] [-o <stdout>] [-e <stderr>] -- <cmd> [args ...]\n",
-	    NAME);
-}
-
-static void reopen(FILE **stream, int fd, const char *path, int flags, int mode,
-    const char *fmode)
-{
-	if (fclose(*stream))
-		return;
-
-	*stream = NULL;
-
-	int oldfd;
-	errno_t rc = vfs_lookup_open(path, WALK_REGULAR | flags, mode, &oldfd);
-	if (rc != EOK)
-		return;
-
-	if (oldfd != fd) {
-		int newfd;
-		if (vfs_clone(oldfd, fd, false, &newfd) != EOK)
-			return;
-
-		assert(newfd == fd);
-
-		if (vfs_put(oldfd))
-			return;
-	}
-
-	*stream = fdopen(fd, fmode);
-}
-
-static task_id_t spawn(task_wait_t *wait, int argc, char *argv[])
-{
-	const char **args;
-	task_id_t id = 0;
-	errno_t rc;
-
-	args = (const char **) calloc(argc + 1, sizeof(char *));
-	if (!args) {
-		fprintf(stderr, "No memory available\n");
-		return 0;
-	}
-
-	int i;
-	for (i = 0; i < argc; i++)
-		args[i] = argv[i];
-
-	args[argc] = NULL;
-
-	rc = task_spawnv(&id, wait, argv[0], args);
-
-	free(args);
-
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Error spawning %s (%s)\n", NAME, argv[0],
-		    str_error(rc));
-		return 0;
-	}
-
-	return id;
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc < 3) {
-		usage();
-		return -1;
-	}
-
-	int i;
-	for (i = 1; i < argc; i++) {
-		if (str_cmp(argv[i], "-i") == 0) {
-			i++;
-			if (i >= argc) {
-				usage();
-				return -2;
-			}
-			reopen(&stdin, 0, argv[i], 0, MODE_READ, "r");
-		} else if (str_cmp(argv[i], "-o") == 0) {
-			i++;
-			if (i >= argc) {
-				usage();
-				return -3;
-			}
-			reopen(&stdout, 1, argv[i], WALK_MAY_CREATE, MODE_WRITE,
-			    "w");
-		} else if (str_cmp(argv[i], "-e") == 0) {
-			i++;
-			if (i >= argc) {
-				usage();
-				return -4;
-			}
-			reopen(&stderr, 2, argv[i], WALK_MAY_CREATE, MODE_WRITE,
-			    "w");
-		} else if (str_cmp(argv[i], "--") == 0) {
-			i++;
-			break;
-		}
-	}
-
-	if (i >= argc) {
-		usage();
-		return -5;
-	}
-
-	/*
-	 * FIXME: fdopen() should actually detect that we are opening a console
-	 * and it should set line-buffering mode automatically.
-	 */
-	setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
-
-	task_wait_t wait;
-	task_id_t id = spawn(&wait, argc - i, argv + i);
-
-	if (id != 0) {
-		task_exit_t texit;
-		int retval;
-		task_wait(&wait, &texit, &retval);
-
-		return retval;
-	}
-
-	return -6;
-}
-
-/** @}
- */
Index: pace/app/sbi/meson.build
===================================================================
--- uspace/app/sbi/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clui' ]
-c_args += '-D__HELENOS__'
-src = files(
-	'src/builtin/bi_boxed.c',
-	'src/builtin/bi_error.c',
-	'src/builtin/bi_char.c',
-	'src/builtin/bi_console.c',
-	'src/builtin/bi_int.c',
-	'src/builtin/bi_task.c',
-	'src/builtin/bi_textfile.c',
-	'src/builtin/bi_string.c',
-	'src/os/helenos.c',
-	'src/ancr.c',
-	'src/bigint.c',
-	'src/builtin.c',
-	'src/cspan.c',
-	'src/imode.c',
-	'src/input.c',
-	'src/intmap.c',
-	'src/lex.c',
-	'src/list.c',
-	'src/main.c',
-	'src/p_expr.c',
-	'src/p_type.c',
-	'src/parse.c',
-	'src/program.c',
-	'src/rdata.c',
-	'src/run.c',
-	'src/run_expr.c',
-	'src/run_texpr.c',
-	'src/stree.c',
-	'src/strtab.c',
-	'src/stype.c',
-	'src/stype_expr.c',
-	'src/symbol.c',
-	'src/tdata.c',
-)
Index: pace/app/sbi/src/ancr.c
===================================================================
--- uspace/app/sbi/src/ancr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,320 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Ancestry resolver.
- *
- * A chicken-and-egg problem is that in order to match identifiers to CSI
- * definitions we need to know CSI ancestry. To know CSI ancestry we need
- * to match identifiers to CSI definitions. Thus both must be done at the
- * same time. Once we know the ancestry of some CSI, we are able to resolve
- * symbols referenced within the scope of that CSI (but not in nested scopes).
- *
- * Here lies probably the most complicated (although not so complicated)
- * algorithm. To process node N we must first process outer(N). This allows
- * us to find all base(N) nodes and process them.
- *
- * To ensure all nodes get processed correctly, we use a two-layer walk.
- * In the lower layer (ancr_csi_process) we follow the dependencies.
- * ancr_csi_process(N) ensures N (and possibly other nodes) get resolved.
- *
- * In the second layer we simply do a DFS of the CSI tree, calling
- * ancr_csi_process() on each node. This ensures that eventually all
- * nodes get processed.
- */
-
-#include <stdlib.h>
-#include <assert.h>
-#include "builtin.h"
-#include "cspan.h"
-#include "list.h"
-#include "mytypes.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-
-#include "ancr.h"
-
-static void ancr_csi_dfs(stree_program_t *prog, stree_csi_t *csi);
-static void ancr_csi_process(stree_program_t *prog, stree_csi_t *node);
-static stree_csi_t *ancr_csi_get_pred(stree_program_t *prog, stree_csi_t *csi,
-    stree_texpr_t *pred_ref);
-static void ancr_csi_print_cycle(stree_program_t *prog, stree_csi_t *node);
-
-/** Process ancestry of all CSIs in a module.
- *
- * Note that currently we expect there to be exactly one module in the
- * whole program.
- *
- * @param prog		Program being processed.
- * @param module	Module to process.
- */
-void ancr_module_process(stree_program_t *prog, stree_module_t *module)
-{
-	list_node_t *node;
-	stree_modm_t *modm;
-
-	(void) module;
-	node = list_first(&prog->module->members);
-
-	while (node != NULL) {
-		modm = list_node_data(node, stree_modm_t *);
-
-		switch (modm->mc) {
-		case mc_csi:
-			ancr_csi_dfs(prog, modm->u.csi);
-			break;
-		case mc_enum:
-			break;
-		}
-
-		node = list_next(&prog->module->members, node);
-	}
-}
-
-/** Walk CSI node tree depth-first.
- *
- * This is the outer depth-first walk whose purpose is to eventually
- * process all CSI nodes by calling ancr_csi_process() on them.
- * (Which causes that and possibly some other nodes to be processed).
- *
- * @param prog		Program being processed.
- * @param csi		CSI node to visit.
- */
-static void ancr_csi_dfs(stree_program_t *prog, stree_csi_t *csi)
-{
-	list_node_t *node;
-	stree_csimbr_t *csimbr;
-
-	/* Process this node first. */
-	ancr_csi_process(prog, csi);
-
-	/* Now visit all children. */
-	node = list_first(&csi->members);
-	while (node != NULL) {
-		csimbr = list_node_data(node, stree_csimbr_t *);
-		if (csimbr->cc == csimbr_csi)
-			ancr_csi_dfs(prog, csimbr->u.csi);
-
-		node = list_next(&csi->members, node);
-	}
-}
-
-/** Process csi node.
- *
- * Fist processes the pre-required nodes (outer CSI and base CSIs),
- * then processes @a node. This is the core 'outward-and-baseward' walk.
- *
- * @param prog		Program being processed.
- * @param csi		CSI node to process.
- */
-static void ancr_csi_process(stree_program_t *prog, stree_csi_t *csi)
-{
-	stree_csi_t *base_csi, *outer_csi;
-	stree_csi_t *gf_class;
-
-	list_node_t *pred_n;
-	stree_texpr_t *pred;
-	stree_csi_t *pred_csi;
-
-	if (csi->ancr_state == ws_visited) {
-		/* Node already processed */
-		return;
-	}
-
-	if (csi->ancr_state == ws_active) {
-		/* Error, closed reference loop. */
-		printf("Error: Circular class, struct or interface chain: ");
-		ancr_csi_print_cycle(prog, csi);
-		printf(".\n");
-		exit(1);
-	}
-
-	csi->ancr_state = ws_active;
-
-	outer_csi = csi_to_symbol(csi)->outer_csi;
-	gf_class = builtin_get_gf_class(prog->builtin);
-
-	if (csi != gf_class) {
-		/* Implicit inheritance from grandfather class. */
-		base_csi = gf_class;
-	} else {
-		/* Grandfather class has no base class. */
-		base_csi = NULL;
-	}
-
-	/* Process outer CSI */
-	if (outer_csi != NULL)
-		ancr_csi_process(prog, outer_csi);
-
-	/*
-	 * Process inheritance list.
-	 */
-	pred_n = list_first(&csi->inherit);
-
-	/* For a class node, the first entry can be a class. */
-	if (csi->cc == csi_class && pred_n != NULL) {
-		pred = list_node_data(pred_n, stree_texpr_t *);
-		pred_csi = ancr_csi_get_pred(prog, csi, pred);
-		assert(pred_csi != NULL);
-
-		if (pred_csi->cc == csi_class) {
-			/* Process base class */
-			base_csi = pred_csi;
-			ancr_csi_process(prog, pred_csi);
-
-			pred_n = list_next(&csi->inherit, pred_n);
-		}
-	}
-
-	/* Following entires can only be interfaces. */
-	while (pred_n != NULL) {
-		pred = list_node_data(pred_n, stree_texpr_t *);
-		pred_csi = ancr_csi_get_pred(prog, csi, pred);
-		assert(pred_csi != NULL);
-
-		/* Process implemented or accumulated interface. */
-		ancr_csi_process(prog, pred_csi);
-
-		switch (pred_csi->cc) {
-		case csi_class:
-			switch (csi->cc) {
-			case csi_class:
-				cspan_print(csi->name->cspan);
-				printf(" Error: Only the first predecessor "
-				    "can be a class. ('");
-				symbol_print_fqn(csi_to_symbol(csi));
-				printf("' deriving from '");
-				symbol_print_fqn(csi_to_symbol(pred_csi));
-				printf("').\n");
-				exit(1);
-				break;
-			case csi_struct:
-				assert(b_false); /* XXX */
-				break;
-			case csi_interface:
-				cspan_print(csi->name->cspan);
-				printf(" Error: Interface predecessor must be "
-				    "an interface ('");
-				symbol_print_fqn(csi_to_symbol(csi));
-				printf("' deriving from '");
-				symbol_print_fqn(csi_to_symbol(pred_csi));
-				printf("').\n");
-				exit(1);
-				break;
-			}
-			break;
-		case csi_struct:
-			assert(b_false); /* XXX */
-			break;
-		case csi_interface:
-			break;
-		}
-
-		pred_n = list_next(&csi->inherit, pred_n);
-	}
-
-	/* Store base CSI and update node state. */
-	csi->ancr_state = ws_visited;
-	csi->base_csi = base_csi;
-}
-
-/** Resolve CSI predecessor reference.
- *
- * Returns the CSI predecessor referenced by @a pred_ref.
- * If the referenced CSI does not exist, an error is generated.
- *
- * @param prog		Program being processed.
- * @param csi		CSI node to process.
- * @param pred_ref	Type expression referencing the predecessor.
- * @return		Predecessor CSI.
- */
-static stree_csi_t *ancr_csi_get_pred(stree_program_t *prog, stree_csi_t *csi,
-    stree_texpr_t *pred_ref)
-{
-	stree_csi_t *outer_csi;
-	stree_symbol_t *pred_sym;
-	stree_csi_t *pred_csi;
-
-	outer_csi = csi_to_symbol(csi)->outer_csi;
-	pred_sym = symbol_xlookup_in_csi(prog, outer_csi, pred_ref);
-	pred_csi = symbol_to_csi(pred_sym);
-	assert(pred_csi != NULL); /* XXX */
-
-	return pred_csi;
-}
-
-/** Print loop in CSI ancestry.
- *
- * We have detected a loop in CSI ancestry. Traverse it (by following the
- * nodes in ws_active state and print it.
- *
- * @param prog		Program.
- * @param node		CSI node participating in an ancestry cycle.
- */
-static void ancr_csi_print_cycle(stree_program_t *prog, stree_csi_t *node)
-{
-	stree_csi_t *n;
-	stree_symbol_t *pred_sym, *node_sym;
-	stree_csi_t *pred_csi, *outer_csi;
-	stree_texpr_t *pred;
-	list_node_t *pred_n;
-
-	n = node;
-	do {
-		node_sym = csi_to_symbol(node);
-		symbol_print_fqn(node_sym);
-		printf(", ");
-
-		outer_csi = node_sym->outer_csi;
-
-		if (outer_csi != NULL && outer_csi->ancr_state == ws_active) {
-			node = outer_csi;
-		} else {
-			node = NULL;
-
-			pred_n = list_first(&node->inherit);
-			while (pred_n != NULL) {
-				pred = list_node_data(pred_n, stree_texpr_t *);
-				pred_sym = symbol_xlookup_in_csi(prog,
-				    outer_csi, pred);
-				pred_csi = symbol_to_csi(pred_sym);
-				assert(pred_csi != NULL);
-
-				if (pred_csi->ancr_state == ws_active) {
-					node = pred_csi;
-					break;
-				}
-			}
-
-			assert(node != NULL);
-		}
-	} while (n != node);
-
-	node_sym = csi_to_symbol(node);
-	symbol_print_fqn(node_sym);
-}
Index: pace/app/sbi/src/ancr.h
===================================================================
--- uspace/app/sbi/src/ancr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ANCR_H_
-#define ANCR_H_
-
-#include "mytypes.h"
-
-void ancr_module_process(stree_program_t *prog, stree_module_t *module);
-
-#endif
Index: pace/app/sbi/src/bigint.c
===================================================================
--- uspace/app/sbi/src/bigint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,691 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Big integers.
- *
- * Sysel type @c int should accomodate large numbers. This implementation
- * is limited by the available memory and range of the @c size_t type used
- * to index digits.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "debug.h"
-#include "mytypes.h"
-
-#include "bigint.h"
-
-static void bigint_sign_comb(bool_t srf_a, bigint_t *a, bool_t srf_b,
-    bigint_t *b, bigint_t *dest);
-static void bigint_add_abs(bigint_t *a, bigint_t *b, bigint_t *dest);
-static void bigint_sub_abs(bigint_t *a, bigint_t *b, bigint_t *dest);
-static void bigint_shift_mul_dig(bigint_t *a, bigint_word_t b, size_t shift,
-    bigint_t *dest);
-
-static void bigint_alloc(bigint_t *bigint, size_t length);
-static void bigint_refine_len(bigint_t *bigint);
-
-/** Initialize bigint with value from small integer.
- *
- * Initializes a bigint structure with the provided small value.
- *
- * @param value		Initial value (small int).
- */
-void bigint_init(bigint_t *bigint, int value)
-{
-	size_t length;
-	size_t idx;
-	int t;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Initialize bigint with int value %d.\n", value);
-#endif
-
-	if (value < 0) {
-		bigint->negative = b_true;
-		value = -value;
-	} else {
-		bigint->negative = b_false;
-	}
-
-	/* Determine length. */
-	length = 0;
-	t = value;
-	while (t > 0) {
-		length += 1;
-		t = t / BIGINT_BASE;
-	}
-
-	/* Allocate digit array. */
-	bigint_alloc(bigint, length);
-
-	/* Compute digits. */
-	t = value;
-	for (idx = 0; idx < length; ++idx) {
-		bigint->digit[idx] = t % BIGINT_BASE;
-		t = t / BIGINT_BASE;
-	}
-}
-
-/** Shallow copy of integer.
- *
- * @param src		Source.
- * @param dest		Destination.
- */
-void bigint_shallow_copy(bigint_t *src, bigint_t *dest)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Shallow copy of bigint.\n");
-#endif
-	dest->negative = src->negative;
-	dest->digit = src->digit;
-	dest->length = src->length;
-}
-/** Clone big integer.
- *
- * @param src		Source.
- * @param dest		Destination.
- */
-void bigint_clone(bigint_t *src, bigint_t *dest)
-{
-	size_t idx;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Clone bigint.\n");
-#endif
-	/* Copy sign. */
-	dest->negative = src->negative;
-
-	/* Allocate dest digit array. */
-	bigint_alloc(dest, src->length);
-
-	/* Copy digits. */
-	for (idx = 0; idx < dest->length; ++idx)
-		dest->digit[idx] = src->digit[idx];
-}
-
-/** Compute big integer with reversed sign.
- *
- * @param src		Source.
- * @param dest		Destination.
- */
-void bigint_reverse_sign(bigint_t *src, bigint_t *dest)
-{
-	size_t idx;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Reverse-sign copy of bigint.\n");
-#endif
-	/* Copy reversed sign. */
-	dest->negative = !src->negative;
-
-	/* Allocate dest digit array. */
-	bigint_alloc(dest, src->length);
-
-	/* Copy digits. */
-	for (idx = 0; idx < dest->length; ++idx)
-		dest->digit[idx] = src->digit[idx];
-}
-
-/** Destroy big integer.
- *
- * Any bigint that is initialized via bigint_init() or any other bigint
- * function that constructs a new bigint value should be destroyed with
- * this function to free memory associated with the bigint. It should
- * also be used to destroy a bigint before it is reused.
- *
- * @param bigint	The bigint to destroy.
- */
-void bigint_destroy(bigint_t *bigint)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Destroy bigint.\n");
-#endif
-	bigint->negative = b_false;
-
-	bigint->length = 0;
-
-	free(bigint->digit);
-	bigint->digit = NULL;
-}
-
-/** Get value of big integer.
- *
- * Allows to obtain the value of big integer, provided that it fits
- * into a small integer.
- *
- * @param bigint	Bigint to obtain value from.
- * @param dval		Place to store value.
- * @return		EOK on success, ELIMIT if bigint is too big to fit
- *			to @a dval.
- */
-errno_t bigint_get_value_int(bigint_t *bigint, int *dval)
-{
-	bigint_t vval, diff;
-	size_t idx;
-	int val;
-	bool_t zf;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Get int value of bigint.\n");
-#endif
-	val = 0;
-	for (idx = 0; idx < bigint->length; ++idx) {
-		val = val * BIGINT_BASE + bigint->digit[idx];
-	}
-
-	if (bigint->negative)
-		val = -val;
-
-	/* If the value did not fit @c val now contains garbage. Verify. */
-	bigint_init(&vval, val);
-
-	bigint_sub(bigint, &vval, &diff);
-	zf = bigint_is_zero(&diff);
-
-	bigint_destroy(&vval);
-	bigint_destroy(&diff);
-
-	/* If the difference is not zero, the verification failed. */
-	if (zf != b_true)
-		return EINVAL;
-
-	*dval = val;
-	return EOK;
-}
-
-/** Determine if bigint is zero.
- *
- * @param bigint	Big integer.
- * @return		b_true if @a bigint is zero, b_false otherwise.
- */
-bool_t bigint_is_zero(bigint_t *bigint)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Determine if bigint is zero.\n");
-#endif
-	return (bigint->length == 0);
-}
-
-/** Determine if bigint is negative.
- *
- * @param bigint	Big integer.
- * @return		b_true if @a bigint is negative, b_false otherwise.
- */
-bool_t bigint_is_negative(bigint_t *bigint)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Determine if bigint is negative\n");
-#endif
-	/* Verify that we did not accidentaly introduce a negative zero. */
-	assert(bigint->negative == b_false || bigint->length > 0);
-
-	return bigint->negative;
-}
-
-/** Divide bigint by (unsigned) digit.
- *
- * @param a		Bigint dividend.
- * @param b		Divisor digit.
- * @param quot		Output bigint quotient.
- * @param rem		Output remainder digit.
- */
-void bigint_div_digit(bigint_t *a, bigint_word_t b, bigint_t *quot,
-    bigint_word_t *rem)
-{
-	size_t lbound;
-	size_t idx;
-	bigint_dword_t da, db;
-	bigint_dword_t q, r;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Divide bigint by digit.\n");
-#endif
-	lbound = a->length;
-	bigint_alloc(quot, lbound);
-
-	quot->negative = a->negative;
-
-	r = 0;
-	idx = lbound;
-	while (idx > 0) {
-		--idx;
-
-		da = a->digit[idx] + r * BIGINT_BASE;
-		db = b;
-
-		q = da / db;
-		r = da % db;
-
-		quot->digit[idx] = q;
-	}
-
-	bigint_refine_len(quot);
-	*rem = r;
-}
-
-/** Add two big integers.
- *
- * The big integers @a a and @a b are added and the result is stored in
- * @a dest.
- *
- * @param a		First addend.
- * @param b		Second addend.
- * @param dest		Destination bigint.
- */
-void bigint_add(bigint_t *a, bigint_t *b, bigint_t *dest)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Add bigints.\n");
-#endif
-	bigint_sign_comb(b_false, a, b_false, b, dest);
-}
-
-/** Subtract two big integers.
- *
- * The big integers @a a and @a b are subtracted and the result is stored in
- * @a dest.
- *
- * @param a		Minuend.
- * @param b		Subtrahend.
- * @param dest		Destination bigint.
- */
-void bigint_sub(bigint_t *a, bigint_t *b, bigint_t *dest)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Subtract bigints.\n");
-#endif
-	bigint_sign_comb(b_false, a, b_true, b, dest);
-}
-
-/** Multiply two big integers.
- *
- * The big integers @a a and @a b are multiplied and the result is stored in
- * @a dest.
- *
- * @param a		First factor.
- * @param b		Second factor.
- * @param dest		Destination bigint.
- */
-void bigint_mul(bigint_t *a, bigint_t *b, bigint_t *dest)
-{
-	size_t idx;
-	bigint_t dprod;
-	bigint_t sum;
-	bigint_t tmp;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Multiply bigints.\n");
-#endif
-	bigint_init(&sum, 0);
-	for (idx = 0; idx < b->length; ++idx) {
-		bigint_shift_mul_dig(a, b->digit[idx], idx, &dprod);
-		bigint_add(&dprod, &sum, &tmp);
-		bigint_destroy(&dprod);
-
-		bigint_destroy(&sum);
-		bigint_shallow_copy(&tmp, &sum);
-	}
-
-	if (b->negative)
-		sum.negative = !sum.negative;
-
-	bigint_shallow_copy(&sum, dest);
-}
-
-/** Convert bigint to string.
- *
- * @param bigint	Bigint to convert.
- * @param dptr		Place to store pointer to new string.
- */
-void bigint_get_as_string(bigint_t *bigint, char **dptr)
-{
-	static const char digits[] = { '0', '1', '2', '3', '4', '5', '6',
-		'7', '8', '9' };
-
-	bigint_t val, tmp;
-	bigint_word_t rem;
-	size_t nchars;
-	char *str;
-	size_t idx;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Convert bigint to string.\n");
-#endif
-	static_assert(BIGINT_BASE >= 10, "");
-
-	/* Compute number of characters. */
-	nchars = 0;
-
-	if (bigint_is_zero(bigint) || bigint->negative)
-		nchars += 1; /* '0' or '-' */
-
-	bigint_clone(bigint, &val);
-	while (bigint_is_zero(&val) != b_true) {
-		bigint_div_digit(&val, 10, &tmp, &rem);
-		bigint_destroy(&val);
-		bigint_shallow_copy(&tmp, &val);
-
-		nchars += 1;
-	}
-	bigint_destroy(&val);
-
-	/* Store characters to array. */
-
-	str = malloc(nchars * sizeof(char) + 1);
-	if (str == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	if (bigint_is_zero(bigint)) {
-		str[0] = '0';
-	} else if (bigint->negative) {
-		str[0] = '-';
-	}
-
-	idx = 1;
-	bigint_clone(bigint, &val);
-	while (bigint_is_zero(&val) != b_true) {
-		bigint_div_digit(&val, 10, &tmp, &rem);
-		bigint_destroy(&val);
-		bigint_shallow_copy(&tmp, &val);
-
-		str[nchars - idx] = digits[(int) rem];
-		++idx;
-	}
-
-	bigint_destroy(&val);
-	str[nchars] = '\0';
-	*dptr = str;
-}
-
-/** Print bigint to standard output.
- *
- * @param bigint	Bigint to print.
- */
-void bigint_print(bigint_t *bigint)
-{
-	char *str;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Print bigint.\n");
-#endif
-	bigint_get_as_string(bigint, &str);
-	printf("%s", str);
-	free(str);
-}
-
-/** Compute sign combination of two big integers.
- *
- * Of the big integers @a a and @a b each is optionally sign-reversed and then
- * they are added and the result is stored in @a dest.
- *
- * @param srf_a		First sign reversal flag.
- * @param a		First bigint.
- * @param srf_b		Second sign reversal flag.
- * @param b		Second bigint.
- * @param dest		Destination bigint.
- */
-static void bigint_sign_comb(bool_t srf_a, bigint_t *a, bool_t srf_b,
-    bigint_t *b, bigint_t *dest)
-{
-	bool_t neg_a, neg_b;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Signed combination of two bigints.\n");
-#endif
-	/* Compute resulting signs of combination elements. */
-	neg_a = (srf_a != a->negative);
-	neg_b = (srf_b != b->negative);
-
-	if (neg_a == neg_b) {
-		bigint_add_abs(a, b, dest);
-		dest->negative = neg_a;
-	} else {
-		bigint_sub_abs(a, b, dest);
-		dest->negative = (neg_a != dest->negative);
-	}
-}
-
-/** Add absolute values of two big integers.
- *
- * The absolute values of big integers @a a and @a b are added and the result
- * is stored in @a dest.
- *
- * @param a		First addend.
- * @param b		Second addend.
- * @param dest		Destination bigint.
- */
-static void bigint_add_abs(bigint_t *a, bigint_t *b, bigint_t *dest)
-{
-	size_t lbound;
-	size_t idx;
-	bigint_dword_t da, db;
-	bigint_dword_t tmp;
-	bigint_word_t res, carry;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Add absolute values of bigints.\n");
-#endif
-	/* max(a->length, b->length) + 1 */
-	lbound = (a->length > b->length ? a->length : b->length) + 1;
-	dest->negative = b_false;
-
-	bigint_alloc(dest, lbound);
-	carry = 0;
-
-	for (idx = 0; idx < lbound; ++idx) {
-		da = idx < a->length ? a->digit[idx] : 0;
-		db = idx < b->length ? b->digit[idx] : 0;
-
-		tmp = da + db + (bigint_word_t) carry;
-
-		carry = (bigint_word_t) (tmp / BIGINT_BASE);
-		res = (bigint_word_t) (tmp % BIGINT_BASE);
-
-		dest->digit[idx] = res;
-	}
-
-	/* If our lbound is correct, carry must be zero. */
-	assert(carry == 0);
-
-	bigint_refine_len(dest);
-}
-
-/** Subtract absolute values of two big integers.
- *
- * The absolute values of big integers @a a and @a b are subtracted and the
- * result is stored in @a dest.
- *
- * @param a		Minuend.
- * @param b		Subtrahend.
- * @param dest		Destination bigint.
- */
-static void bigint_sub_abs(bigint_t *a, bigint_t *b, bigint_t *dest)
-{
-	size_t lbound;
-	size_t idx;
-	bigint_dword_t da, db;
-	bigint_dword_t tmp;
-	bigint_word_t res, borrow;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Subtract absolute values of bigints.\n");
-#endif
-	/* max(a->length, b->length) */
-	lbound = a->length > b->length ? a->length : b->length;
-
-	bigint_alloc(dest, lbound);
-	borrow = 0;
-
-	for (idx = 0; idx < lbound; ++idx) {
-		da = idx < a->length ? a->digit[idx] : 0;
-		db = idx < b->length ? b->digit[idx] : 0;
-
-		if (da > db + borrow) {
-			tmp = da - db - borrow;
-			borrow = 0;
-		} else {
-			tmp = da + BIGINT_BASE - db - borrow;
-			borrow = 1;
-		}
-
-		res = (bigint_word_t) tmp;
-		dest->digit[idx] = res;
-	}
-
-	if (borrow != 0) {
-		/* We subtracted the greater number from the smaller. */
-		dest->negative = b_true;
-
-		/*
-		 * Now we must complement the number to get the correct
-		 * absolute value. We do this by subtracting from 10..0
-		 * (0 repeated lbound-times).
-		 */
-		borrow = 0;
-
-		for (idx = 0; idx < lbound; ++idx) {
-			da = 0;
-			db = dest->digit[idx];
-
-			if (da > db + borrow) {
-				tmp = da - db - borrow;
-				borrow = 0;
-			} else {
-				tmp = da + BIGINT_BASE - db - borrow;
-				borrow = 1;
-			}
-
-			res = (bigint_word_t) tmp;
-			dest->digit[idx] = res;
-		}
-
-		/* The last step is the '1'. */
-		assert(borrow == 1);
-	} else {
-		dest->negative = b_false;
-	}
-
-	bigint_refine_len(dest);
-}
-
-/** Multiply big integer by digit.
- *
- * @param a		Bigint factor.
- * @param b		Digit factor.
- * @param dest		Destination bigint.
- */
-static void bigint_shift_mul_dig(bigint_t *a, bigint_word_t b, size_t shift,
-    bigint_t *dest)
-{
-	size_t lbound;
-	size_t idx;
-
-	bigint_dword_t da, db;
-	bigint_dword_t tmp;
-	bigint_word_t res, carry;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Multiply bigint by digit.\n");
-#endif
-	/* Compute length bound and allocate. */
-	lbound = a->length + shift + 1;
-	bigint_alloc(dest, lbound);
-
-	/* Copy sign. */
-	dest->negative = a->negative;
-
-	for (idx = 0; idx < shift; ++idx)
-		dest->digit[idx] = 0;
-
-	carry = 0;
-	for (idx = 0; idx < lbound - shift; ++idx) {
-		da = idx < a->length ? a->digit[idx] : 0;
-		db = b;
-
-		tmp = da * db + (bigint_word_t) carry;
-
-		carry = (bigint_word_t) (tmp / BIGINT_BASE);
-		res = (bigint_word_t) (tmp % BIGINT_BASE);
-
-		dest->digit[shift + idx] = res;
-	}
-
-	/* If our lbound is correct, carry must be zero. */
-	assert(carry == 0);
-
-	bigint_refine_len(dest);
-}
-
-/** Allocate bigint of the given length.
- *
- * @param bigint	Bigint whose digit array should be allocated.
- * @param length	Length of array (also set as bigint length).
- */
-static void bigint_alloc(bigint_t *bigint, size_t length)
-{
-	size_t a_length;
-
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Allocate bigint digit array.\n");
-#endif
-	/* malloc() sometimes cannot allocate blocks of zero size. */
-	if (length == 0)
-		a_length = 1;
-	else
-		a_length = length;
-
-	bigint->digit = malloc(a_length * sizeof(bigint_word_t));
-	if (bigint->digit == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	bigint->length = length;
-}
-
-/** Adjust length field of bigint to be exact.
- *
- * When bigint is allocated with bigint_alloc() its length can be
- * imprecise (higher than actually number of non-zero digits).
- * Then this function is used to lower @c length to the exact value.
- */
-static void bigint_refine_len(bigint_t *bigint)
-{
-#ifdef DEBUG_BIGINT_TRACE
-	printf("Refine bigint length.\n");
-#endif
-	while (bigint->length > 0 && bigint->digit[bigint->length - 1] == 0)
-		bigint->length -= 1;
-
-	if (bigint->length == 0)
-		bigint->negative = b_false;
-}
Index: pace/app/sbi/src/bigint.h
===================================================================
--- uspace/app/sbi/src/bigint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BIGINT_H_
-#define BIGINT_H_
-
-#include "mytypes.h"
-
-void bigint_init(bigint_t *bigint, int value);
-void bigint_shallow_copy(bigint_t *src, bigint_t *dest);
-void bigint_clone(bigint_t *src, bigint_t *dest);
-void bigint_reverse_sign(bigint_t *src, bigint_t *dest);
-void bigint_destroy(bigint_t *bigint);
-
-errno_t bigint_get_value_int(bigint_t *bigint, int *dval);
-bool_t bigint_is_zero(bigint_t *bigint);
-bool_t bigint_is_negative(bigint_t *bigint);
-
-void bigint_div_digit(bigint_t *a, bigint_word_t b, bigint_t *quot,
-    bigint_word_t *rem);
-
-void bigint_add(bigint_t *a, bigint_t *b, bigint_t *dest);
-void bigint_sub(bigint_t *a, bigint_t *b, bigint_t *dest);
-void bigint_mul(bigint_t *a, bigint_t *b, bigint_t *dest);
-
-void bigint_get_as_string(bigint_t *bigint, char **dptr);
-void bigint_print(bigint_t *bigint);
-
-#endif
Index: pace/app/sbi/src/bigint_t.h
===================================================================
--- uspace/app/sbi/src/bigint_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BIGINT_T_H_
-#define BIGINT_T_H_
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-typedef uint8_t bigint_word_t;
-typedef uint16_t bigint_dword_t;
-
-#define BIGINT_BASE ((bigint_dword_t) 256UL)
-
-/** Big integer.
- *
- * Used to implement Sysel @c int type.
- */
-typedef struct bigint {
-	/** Number of non-zero digits in the @c digit array. */
-	size_t length;
-
-	/** Sign. */
-	bool negative;
-
-	/** Digits starting from the least significant. */
-	bigint_word_t *digit;
-} bigint_t;
-
-#endif
Index: pace/app/sbi/src/builtin.c
===================================================================
--- uspace/app/sbi/src/builtin.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,414 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Builtin symbol binding.
- *
- * 'Builtin' symbols are implemented outside of the language itself.
- * Here we refer to entities residing within the interpreted universe
- * as 'internal', while anything implemented outside this universe
- * as 'external'. This module facilitates declaration of builtin
- * symbols and the binding of these symbols to their external
- * implementation.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "builtin/bi_boxed.h"
-#include "builtin/bi_error.h"
-#include "builtin/bi_char.h"
-#include "builtin/bi_console.h"
-#include "builtin/bi_int.h"
-#include "builtin/bi_task.h"
-#include "builtin/bi_textfile.h"
-#include "builtin/bi_string.h"
-#include "input.h"
-#include "intmap.h"
-#include "lex.h"
-#include "list.h"
-#include "mytypes.h"
-#include "os/os.h"
-#include "parse.h"
-#include "rdata.h"
-#include "run.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-
-#include "builtin.h"
-
-static builtin_t *builtin_new(void);
-
-/** Declare builtin symbols in the program.
- *
- * Declares symbols that will be hooked to builtin interpreter procedures.
- *
- * @param program	Program in which to declare builtin symbols.
- */
-void builtin_declare(stree_program_t *program)
-{
-	builtin_t *bi;
-
-	bi = builtin_new();
-	bi->program = program;
-	program->builtin = bi;
-
-	/*
-	 * Declare grandfather class.
-	 */
-
-	builtin_code_snippet(bi,
-	    "class Object is\n"
-	    "end\n");
-	bi->gf_class = builtin_find_lvl0(bi, "Object");
-
-	/*
-	 * Declare other builtin classes/functions.
-	 */
-
-	bi_error_declare(bi);
-	bi_char_declare(bi);
-	bi_console_declare(bi);
-	bi_int_declare(bi);
-	bi_task_declare(bi);
-	bi_textfile_declare(bi);
-	bi_string_declare(bi);
-}
-
-/** Bind internal interpreter references to symbols in the program.
- *
- * This is performed in separate phase for several reasons. First,
- * symbol lookups do not work until ancestry is processed. Second,
- * this gives a chance to process the library first and thus bind
- * to symbols defined there.
- */
-void builtin_bind(builtin_t *bi)
-{
-	bi_boxed_bind(bi);
-	bi_error_bind(bi);
-	bi_char_bind(bi);
-	bi_console_bind(bi);
-	bi_int_bind(bi);
-	bi_task_bind(bi);
-	bi_textfile_bind(bi);
-	bi_string_bind(bi);
-}
-
-/** Get grandfather class.
- *
- * Grandfather class is the class from which all other classes are
- * (directly or indirectly) derived.
- *
- * @param builtin	Builtin context (corresponsds to program).
- * @return		Grandfather class (CSI).
- */
-stree_csi_t *builtin_get_gf_class(builtin_t *builtin)
-{
-	if (builtin->gf_class == NULL)
-		return NULL;
-
-	return symbol_to_csi(builtin->gf_class);
-}
-
-/** Allocate new builtin context object.
- *
- * @return	Builtin context object.
- */
-static builtin_t *builtin_new(void)
-{
-	builtin_t *builtin;
-
-	builtin = calloc(1, sizeof(builtin_t));
-	if (builtin == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return builtin;
-}
-
-/** Parse a declaration code snippet.
- *
- * Parses a piece of code from a string at the module level. This can be
- * used to declare builtin symbols easily and without need for an external
- * file.
- */
-void builtin_code_snippet(builtin_t *bi, const char *snippet)
-{
-	input_t *input;
-	lex_t lex;
-	parse_t parse;
-
-	input_new_string(&input, snippet);
-	lex_init(&lex, input);
-	parse_init(&parse, bi->program, &lex);
-	parse_module(&parse);
-}
-
-/** Simplifed search for a global symbol.
- *
- * The specified symbol must exist.
- *
- * @param bi		Builtin context object.
- * @param sym_name	Name of symbol to find.
- * @return		Symbol.
- */
-stree_symbol_t *builtin_find_lvl0(builtin_t *bi, const char *sym_name)
-{
-	stree_symbol_t *sym;
-	stree_ident_t *ident;
-
-	ident = stree_ident_new();
-
-	ident->sid = strtab_get_sid(sym_name);
-	sym = symbol_lookup_in_csi(bi->program, NULL, ident);
-	assert(sym != NULL);
-
-	return sym;
-}
-
-/** Simplifed search for a level 1 symbol.
- *
- * The specified symbol must exist.
- *
- * @param bi		Builtin context object.
- * @param csi_name	CSI in which to look for symbol.
- * @param sym_name	Name of symbol to find.
- * @return		Symbol.
- */
-stree_symbol_t *builtin_find_lvl1(builtin_t *bi, const char *csi_name,
-    const char *sym_name)
-{
-	stree_symbol_t *csi_sym;
-	stree_csi_t *csi;
-
-	stree_symbol_t *mbr_sym;
-	stree_ident_t *ident;
-
-	ident = stree_ident_new();
-
-	ident->sid = strtab_get_sid(csi_name);
-	csi_sym = symbol_lookup_in_csi(bi->program, NULL, ident);
-	assert(csi_sym != NULL);
-	csi = symbol_to_csi(csi_sym);
-	assert(csi != NULL);
-
-	ident->sid = strtab_get_sid(sym_name);
-	mbr_sym = symbol_lookup_in_csi(bi->program, csi, ident);
-	assert(mbr_sym != NULL);
-
-	return mbr_sym;
-}
-
-/** Bind level 1 member function to external implementation.
- *
- * Binds a member function (of a global class) to external implementation.
- * The specified CSI and member function must exist.
- *
- * @param bi		Builtin context object.
- * @param csi_name	CSI which contains the function.
- * @param sym_name	Function name.
- * @param bproc		Pointer to C function implementation.
- */
-void builtin_fun_bind(builtin_t *bi, const char *csi_name,
-    const char *sym_name, builtin_proc_t bproc)
-{
-	stree_symbol_t *fun_sym;
-	stree_fun_t *fun;
-
-	fun_sym = builtin_find_lvl1(bi, csi_name, sym_name);
-	assert(fun_sym != NULL);
-	fun = symbol_to_fun(fun_sym);
-	assert(fun != NULL);
-
-	fun->proc->bi_handler = bproc;
-}
-
-/** Execute a builtin procedure.
- *
- * Executes a procedure that has an external implementation.
- *
- * @param run		Runner object.
- * @param proc		Procedure that has an external implementation.
- */
-void builtin_run_proc(run_t *run, stree_proc_t *proc)
-{
-	stree_symbol_t *fun_sym;
-	builtin_proc_t bproc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run builtin procedure.\n");
-#endif
-	fun_sym = proc->outer_symbol;
-
-	bproc = proc->bi_handler;
-	if (bproc == NULL) {
-		printf("Error: Unrecognized builtin function '");
-		symbol_print_fqn(fun_sym);
-		printf("'.\n");
-		exit(1);
-	}
-
-	/* Run the builtin procedure handler. */
-	(*bproc)(run);
-}
-
-/** Get pointer to member var of current object.
- *
- * Returns the var node that corresponds to a member of the currently
- * active object with the given name. This member must exist.
- *
- * @param run		Runner object.
- * @param mbr_name	Name of member to find.
- * @return		Var node of the member.
- */
-rdata_var_t *builtin_get_self_mbr_var(run_t *run, const char *mbr_name)
-{
-	run_proc_ar_t *proc_ar;
-	rdata_object_t *object;
-	sid_t mbr_name_sid;
-	rdata_var_t *mbr_var;
-
-	proc_ar = run_get_current_proc_ar(run);
-	assert(proc_ar->obj->vc == vc_object);
-	object = proc_ar->obj->u.object_v;
-
-	mbr_name_sid = strtab_get_sid(mbr_name);
-	mbr_var = intmap_get(&object->fields, mbr_name_sid);
-	assert(mbr_var != NULL);
-
-	return mbr_var;
-}
-
-/** Return string value from builtin procedure.
- *
- * Makes it easy for a builtin procedure to return value of type @c string.
- *
- * @param run		Runner object
- * @param str		String value. Must be allocated from heap and its
- *			ownership is hereby given up.
- */
-void builtin_return_string(run_t *run, const char *astr)
-{
-	rdata_string_t *rstring;
-	rdata_var_t *rvar;
-	rdata_value_t *rval;
-	rdata_item_t *ritem;
-
-	run_proc_ar_t *proc_ar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Return string '%s' from builtin function.\n", astr);
-#endif
-	rstring = rdata_string_new();
-	rstring->value = astr;
-
-	rvar = rdata_var_new(vc_string);
-	rvar->u.string_v = rstring;
-	rval = rdata_value_new();
-	rval->var = rvar;
-
-	ritem = rdata_item_new(ic_value);
-	ritem->u.value = rval;
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = ritem;
-}
-
-/** Declare a static builtin function in @a csi.
- *
- * Declare a builtin function member of CSI @a csi. Deprecated in favor
- * of builtin_code_snippet().
- *
- * @param csi		CSI in which to declare function.
- * @param name		Name of member function to declare.
- * @return		Symbol of newly declared function.
- */
-stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name)
-{
-	stree_ident_t *ident;
-	stree_fun_t *fun;
-	stree_fun_sig_t *sig;
-	stree_csimbr_t *csimbr;
-	stree_symbol_t *fun_sym;
-	stree_symbol_attr_t *sym_attr;
-
-	ident = stree_ident_new();
-	ident->sid = strtab_get_sid(name);
-
-	fun = stree_fun_new();
-	fun->name = ident;
-	fun->proc = stree_proc_new();
-	fun->proc->body = NULL;
-	sig = stree_fun_sig_new();
-	fun->sig = sig;
-
-	list_init(&fun->sig->args);
-
-	csimbr = stree_csimbr_new(csimbr_fun);
-	csimbr->u.fun = fun;
-
-	fun_sym = stree_symbol_new(sc_fun);
-	fun_sym->u.fun = fun;
-	fun_sym->outer_csi = csi;
-
-	sym_attr = stree_symbol_attr_new(sac_static);
-	list_append(&fun_sym->attr, sym_attr);
-
-	fun->symbol = fun_sym;
-	fun->proc->outer_symbol = fun_sym;
-
-	list_append(&csi->members, csimbr);
-
-	return fun_sym;
-}
-
-/** Add one formal parameter to function.
- *
- * Used to incrementally construct formal parameter list of a builtin
- * function. Deprecated in favor of builtin_code_snippet(). Does not
- * support type checking.
- *
- * @param fun_sym	Symbol of function to add parameters to.
- * @param name		Name of parameter to add.
- */
-void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name)
-{
-	stree_proc_arg_t *proc_arg;
-	stree_fun_t *fun;
-
-	fun = symbol_to_fun(fun_sym);
-	assert(fun != NULL);
-
-	proc_arg = stree_proc_arg_new();
-	proc_arg->name = stree_ident_new();
-	proc_arg->name->sid = strtab_get_sid(name);
-	proc_arg->type = NULL; /* XXX */
-
-	list_append(&fun->sig->args, proc_arg);
-}
Index: pace/app/sbi/src/builtin.h
===================================================================
--- uspace/app/sbi/src/builtin.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BUILTIN_H_
-#define BUILTIN_H_
-
-#include "mytypes.h"
-
-void builtin_declare(stree_program_t *program);
-void builtin_bind(builtin_t *bi);
-void builtin_code_snippet(builtin_t *bi, const char *snippet);
-
-stree_csi_t *builtin_get_gf_class(builtin_t *builtin);
-void builtin_run_proc(run_t *run, stree_proc_t *proc);
-
-rdata_var_t *builtin_get_self_mbr_var(run_t *run, const char *mbr_name);
-void builtin_return_string(run_t *run, const char *str);
-
-stree_symbol_t *builtin_declare_fun(stree_csi_t *csi, const char *name);
-void builtin_fun_add_arg(stree_symbol_t *fun_sym, const char *name);
-
-stree_symbol_t *builtin_find_lvl0(builtin_t *bi, const char *sym_name);
-stree_symbol_t *builtin_find_lvl1(builtin_t *bi, const char *csi_name,
-    const char *sym_name);
-
-void builtin_fun_bind(builtin_t *bi, const char *csi_name,
-    const char *sym_name, builtin_proc_t bproc);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_boxed.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_boxed.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Boxed primitive types binding. */
-
-#include "../builtin.h"
-#include "../mytypes.h"
-
-#include "bi_boxed.h"
-
-/** No declaration function. Boxed types are declared in the library. */
-
-/** Bind boxed types.
- *
- * @param bi	Builtin object
- */
-void bi_boxed_bind(builtin_t *bi)
-{
-	bi->boxed_bool = builtin_find_lvl0(bi, "Bool");
-	bi->boxed_char = builtin_find_lvl0(bi, "Char");
-	bi->boxed_int = builtin_find_lvl0(bi, "Int");
-	bi->boxed_string = builtin_find_lvl0(bi, "String");
-}
Index: pace/app/sbi/src/builtin/bi_boxed.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_boxed.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_BOXED_H_
-#define BI_BOXED_H_
-
-#include "../mytypes.h"
-
-void bi_boxed_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_char.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_char.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Char builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../bigint.h"
-#include "../builtin.h"
-#include "../debug.h"
-#include "../mytypes.h"
-#include "../os/os.h"
-#include "../rdata.h"
-#include "../run.h"
-#include "../strtab.h"
-
-#include "bi_char.h"
-
-static void bi_char_get_as_string(run_t *run);
-
-/** Declare Char builtin.
- *
- * @param bi	Builtin object
- */
-void bi_char_declare(builtin_t *bi)
-{
-	(void) bi;
-}
-
-/** Bind Char builtin.
- *
- * @param bi	Builtin object
- */
-void bi_char_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "Char", "get_as_string", bi_char_get_as_string);
-}
-
-/** Return string representation.
- *
- * @param run	Runner object
- */
-static void bi_char_get_as_string(run_t *run)
-{
-	rdata_var_t *self_value_var;
-	bigint_t *cval;
-	char *str;
-	int char_val;
-	errno_t rc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Convert char to string.\n");
-#endif
-	/* Extract self.Value */
-	self_value_var = builtin_get_self_mbr_var(run, "Value");
-	assert(self_value_var->vc == vc_char);
-	cval = &self_value_var->u.char_v->value;
-
-	rc = bigint_get_value_int(cval, &char_val);
-	if (rc != EOK) {
-		/* XXX Should raise exception. */
-		builtin_return_string(run, os_str_dup("?"));
-		return;
-	}
-
-	str = os_chr_to_astr((char32_t) char_val);
-
-	/* Ownership of str is transferred. */
-	builtin_return_string(run, str);
-}
Index: pace/app/sbi/src/builtin/bi_char.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_char.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_CHAR_H_
-#define BI_CHAR_H_
-
-#include "../mytypes.h"
-
-void bi_char_declare(builtin_t *bi);
-void bi_char_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_console.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Console builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../bigint.h"
-#include "../builtin.h"
-#include "../list.h"
-#include "../mytypes.h"
-#include "../run.h"
-#include "../stree.h"
-#include "../strtab.h"
-#include "../symbol.h"
-
-#include "bi_console.h"
-
-static void bi_console_write(run_t *run);
-static void bi_console_writeline(run_t *run);
-
-/** Declare Console builtin.
- *
- * @param bi	Builtin object
- */
-void bi_console_declare(builtin_t *bi)
-{
-	stree_modm_t *modm;
-	stree_csi_t *csi;
-	stree_ident_t *ident;
-	stree_symbol_t *symbol;
-	stree_symbol_t *fun_sym;
-
-	/* Declare class Builtin */
-
-	ident = stree_ident_new();
-	ident->sid = strtab_get_sid("Console");
-
-	csi = stree_csi_new(csi_class);
-	csi->name = ident;
-	list_init(&csi->targ);
-	list_init(&csi->members);
-
-	modm = stree_modm_new(mc_csi);
-	modm->u.csi = csi;
-
-	symbol = stree_symbol_new(sc_csi);
-	symbol->u.csi = csi;
-	symbol->outer_csi = NULL;
-	csi->symbol = symbol;
-
-	list_append(&bi->program->module->members, modm);
-
-	/* Declare Builtin.Write(). */
-
-	fun_sym = builtin_declare_fun(csi, "Write");
-	builtin_fun_add_arg(fun_sym, "arg");
-
-	/* Declare Builtin.WriteLine(). */
-
-	fun_sym = builtin_declare_fun(csi, "WriteLine");
-	builtin_fun_add_arg(fun_sym, "arg");
-}
-
-/** Bind builtin functions.
- *
- * @param bi	Builtin object
- */
-void bi_console_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "Console", "Write", bi_console_write);
-	builtin_fun_bind(bi, "Console", "WriteLine", bi_console_writeline);
-}
-
-/** Write to the console.
- *
- * @param run	Runner object
- */
-static void bi_console_write(run_t *run)
-{
-	rdata_var_t *var;
-	int char_val;
-	errno_t rc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Called Console.Write()\n");
-#endif
-	var = run_local_vars_lookup(run, strtab_get_sid("arg"));
-	assert(var);
-
-	switch (var->vc) {
-	case vc_bool:
-		printf("%s", var->u.bool_v->value ? "true" : "false");
-		break;
-	case vc_char:
-		rc = bigint_get_value_int(&var->u.char_v->value, &char_val);
-		if (rc == EOK)
-			printf("%lc", char_val);
-		else
-			printf("???");
-		break;
-	case vc_int:
-		bigint_print(&var->u.int_v->value);
-		break;
-	case vc_string:
-		printf("%s", var->u.string_v->value);
-		break;
-	default:
-		printf("Unimplemented: Write() with unsupported type.\n");
-		exit(1);
-	}
-}
-
-/** Write a line of output.
- *
- * @param run	Runner object
- */
-static void bi_console_writeline(run_t *run)
-{
-#ifdef DEBUG_RUN_TRACE
-	printf("Called Console.WriteLine()\n");
-#endif
-	bi_console_write(run);
-	putchar('\n');
-}
Index: pace/app/sbi/src/builtin/bi_console.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_CONSOLE_H_
-#define BI_CONSOLE_H_
-
-#include "../mytypes.h"
-
-void bi_console_declare(builtin_t *bi);
-void bi_console_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_error.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_error.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Error classes (used with exception handling). */
-
-#include <assert.h>
-#include "../builtin.h"
-#include "../mytypes.h"
-#include "../symbol.h"
-
-#include "bi_error.h"
-
-/** Declare error class hierarchy.
- *
- * @param bi	Builtin object
- */
-void bi_error_declare(builtin_t *bi)
-{
-	/*
-	 * Declare class Error and its subclasses.
-	 * Here, class Error supplants a package or namespace.
-	 */
-
-	builtin_code_snippet(bi,
-	    "class Error is\n"
-	    "    -- Common ancestor of all error classes\n"
-	    "    class Base is\n"
-	    "    end\n"
-	    "    -- Accessing nil reference\n"
-	    "    class NilReference : Base is\n"
-	    "    end\n"
-	    "    -- Array index out of bounds\n"
-	    "    class OutOfBounds : Base is\n"
-	    "    end\n"
-	    "end\n");
-}
-
-/** Bind error class hierarchy.
- *
- * @param bi	Builtin object
- */
-void bi_error_bind(builtin_t *bi)
-{
-	stree_symbol_t *sym;
-
-	/* Declare class Error and its subclasses. */
-
-	sym = builtin_find_lvl1(bi, "Error", "OutOfBounds");
-	bi->error_outofbounds = symbol_to_csi(sym);
-	assert(bi->error_outofbounds != NULL);
-
-	sym = builtin_find_lvl1(bi, "Error", "NilReference");
-	bi->error_nilreference = symbol_to_csi(sym);
-	assert(bi->error_nilreference != NULL);
-}
Index: pace/app/sbi/src/builtin/bi_error.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_error.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_ERROR_H_
-#define BI_ERROR_H_
-
-#include "../mytypes.h"
-
-void bi_error_declare(builtin_t *bi);
-void bi_error_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_int.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_int.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Int builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../bigint.h"
-#include "../builtin.h"
-#include "../debug.h"
-#include "../mytypes.h"
-#include "../os/os.h"
-#include "../rdata.h"
-#include "../run.h"
-#include "../strtab.h"
-
-#include "bi_int.h"
-
-static void bi_int_get_as_string(run_t *run);
-
-/** Declare Int builtin.
- *
- * @param bi	Builtin object
- */
-void bi_int_declare(builtin_t *bi)
-{
-	(void) bi;
-}
-
-/** Bind Int builtin.
- *
- * @param bi	Builtin object
- */
-void bi_int_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "Int", "get_as_string", bi_int_get_as_string);
-}
-
-/** Return string representation.
- *
- * @param run	Runner object
- */
-static void bi_int_get_as_string(run_t *run)
-{
-	rdata_var_t *self_value_var;
-	bigint_t *ival;
-	char *str;
-
-	/* Extract self.Value */
-	self_value_var = builtin_get_self_mbr_var(run, "Value");
-	assert(self_value_var->vc == vc_int);
-	ival = &self_value_var->u.int_v->value;
-
-	bigint_get_as_string(ival, &str);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Convert int to string '%s'.\n", str);
-#endif
-	/* Ownership of str is transferred. */
-	builtin_return_string(run, str);
-}
Index: pace/app/sbi/src/builtin/bi_int.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_int.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_INT_H_
-#define BI_INT_H_
-
-#include "../mytypes.h"
-
-void bi_int_declare(builtin_t *bi);
-void bi_int_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_string.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_string.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,165 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file String builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../bigint.h"
-#include "../builtin.h"
-#include "../debug.h"
-#include "../mytypes.h"
-#include "../os/os.h"
-#include "../rdata.h"
-#include "../run.h"
-#include "../strtab.h"
-
-#include "bi_string.h"
-
-static void bi_string_length(run_t *run);
-static void bi_string_slice(run_t *run);
-
-/** Declare String builtin.
- *
- * @param bi	Builtin object
- */
-void bi_string_declare(builtin_t *bi)
-{
-	(void) bi;
-}
-
-/** Bind String builtin.
- *
- * @param bi	Builtin object
- */
-void bi_string_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "String", "get_length", bi_string_length);
-	builtin_fun_bind(bi, "String", "Slice", bi_string_slice);
-}
-
-/** Return length of the string.
- *
- * @param run	Runner object
- */
-static void bi_string_length(run_t *run)
-{
-	rdata_var_t *self_value_var;
-	const char *str;
-	size_t str_l;
-
-	rdata_int_t *rint;
-	rdata_var_t *rvar;
-	rdata_value_t *rval;
-	rdata_item_t *ritem;
-
-	run_proc_ar_t *proc_ar;
-
-	/* Extract self.Value */
-	self_value_var = builtin_get_self_mbr_var(run, "Value");
-	assert(self_value_var->vc == vc_string);
-	str = self_value_var->u.string_v->value;
-	str_l = os_str_length(str);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Get length of string '%s'.\n", str);
-#endif
-
-	/* Construct return value. */
-	rint = rdata_int_new();
-	bigint_init(&rint->value, (int) str_l);
-
-	rvar = rdata_var_new(vc_int);
-	rvar->u.int_v = rint;
-	rval = rdata_value_new();
-	rval->var = rvar;
-
-	ritem = rdata_item_new(ic_value);
-	ritem->u.value = rval;
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = ritem;
-}
-
-/** Return slice (substring) of the string.
- *
- * @param run	Runner object
- */
-static void bi_string_slice(run_t *run)
-{
-	rdata_var_t *self_value_var;
-	const char *str;
-	const char *slice;
-	size_t str_l;
-
-	rdata_var_t *start_var;
-	int start;
-
-	rdata_var_t *length_var;
-	int length;
-
-	errno_t rc;
-
-	/* Extract self.Value */
-	self_value_var = builtin_get_self_mbr_var(run, "Value");
-	assert(self_value_var->vc == vc_string);
-	str = self_value_var->u.string_v->value;
-	str_l = os_str_length(str);
-
-	/* Get argument @a start. */
-	start_var = run_local_vars_lookup(run, strtab_get_sid("start"));
-	assert(start_var);
-	assert(start_var->vc == vc_int);
-
-	rc = bigint_get_value_int(&start_var->u.int_v->value, &start);
-	if (rc != EOK || start < 0 || (size_t) start > str_l) {
-		printf("Error: Parameter 'start' to Slice() out of range.\n");
-		exit(1);
-	}
-
-	/* Get argument @a length. */
-	length_var = run_local_vars_lookup(run, strtab_get_sid("length"));
-	assert(length_var);
-	assert(length_var->vc == vc_int);
-
-	rc = bigint_get_value_int(&length_var->u.int_v->value, &length);
-	if (rc != EOK || length < 0 || (size_t) (start + length) > str_l) {
-		printf("Error: Parameter 'length' to Slice() out of range.\n");
-		exit(1);
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Construct Slice(%d, %d) from string '%s'.\n",
-	    start, length, str);
-#endif
-	slice = os_str_aslice(str, start, length);
-
-	/* Ownership of slice is transferred. */
-	builtin_return_string(run, slice);
-}
Index: pace/app/sbi/src/builtin/bi_string.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_string.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_STRING_H_
-#define BI_STRING_H_
-
-#include "../mytypes.h"
-
-void bi_string_declare(builtin_t *bi);
-void bi_string_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_task.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Task builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../builtin.h"
-#include "../list.h"
-#include "../mytypes.h"
-#include "../os/os.h"
-#include "../run.h"
-#include "../strtab.h"
-
-#include "bi_task.h"
-
-static void bi_task_exec(run_t *run);
-
-/** Declare task builtin.
- *
- * @param bi	Builtin object
- */
-void bi_task_declare(builtin_t *bi)
-{
-	builtin_code_snippet(bi,
-	    "class Task is\n"
-	    "fun Exec(args : string[], packed), static, builtin;\n"
-	    "end\n");
-}
-
-/** Bind builtin functions.
- *
- * @param bi	Builtin object
- */
-void bi_task_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "Task", "Exec", bi_task_exec);
-}
-
-/** Start an executable and wait for it to finish.
- *
- * @param run	Runner object
- */
-static void bi_task_exec(run_t *run)
-{
-	rdata_var_t *args;
-	rdata_var_t *var;
-	rdata_array_t *array;
-	rdata_var_t *arg;
-	int idx, dim;
-	const char **cmd;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Called Task.Exec()\n");
-#endif
-	args = run_local_vars_lookup(run, strtab_get_sid("args"));
-
-	assert(args);
-	assert(args->vc == vc_ref);
-
-	var = args->u.ref_v->vref;
-	assert(var->vc == vc_array);
-
-	array = var->u.array_v;
-	assert(array->rank == 1);
-	dim = array->extent[0];
-
-	if (dim == 0) {
-		printf("Error: Builtin.Exec() expects at least one argument.\n");
-		exit(1);
-	}
-
-	cmd = calloc(dim + 1, sizeof(char *));
-	if (cmd == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	for (idx = 0; idx < dim; ++idx) {
-		arg = array->element[idx];
-		if (arg->vc != vc_string) {
-			printf("Error: Argument to Builtin.Exec() must be "
-			    "string (found %d).\n", arg->vc);
-			exit(1);
-		}
-
-		cmd[idx] = arg->u.string_v->value;
-	}
-
-	cmd[dim] = NULL;
-
-	if (os_exec((char *const *)cmd) != EOK) {
-		printf("Error: Exec failed.\n");
-		exit(1);
-	}
-}
Index: pace/app/sbi/src/builtin/bi_task.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_TASK_H_
-#define BI_TASK_H_
-
-#include "../mytypes.h"
-
-void bi_task_declare(builtin_t *bi);
-void bi_task_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin/bi_textfile.c
===================================================================
--- uspace/app/sbi/src/builtin/bi_textfile.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,382 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file TextFile builtin binding. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "../bigint.h"
-#include "../builtin.h"
-#include "../debug.h"
-#include "../mytypes.h"
-#include "../os/os.h"
-#include "../rdata.h"
-#include "../run.h"
-#include "../strtab.h"
-
-#include "bi_textfile.h"
-
-#define LINE_BUF_SIZE 256
-static char line_buf[LINE_BUF_SIZE];
-
-static void bi_textfile_openread(run_t *run);
-static void bi_textfile_openwrite(run_t *run);
-static void bi_textfile_close(run_t *run);
-static void bi_textfile_readline(run_t *run);
-static void bi_textfile_writeline(run_t *run);
-static void bi_textfile_is_eof(run_t *run);
-
-/** Declare TextFile builtin.
- *
- * @param bi	Builtin object
- */
-void bi_textfile_declare(builtin_t *bi)
-{
-	/* Declare class TextFile. */
-
-	builtin_code_snippet(bi,
-	    "class TextFile is\n"
-	    "    var f : resource;\n"
-	    "\n"
-	    "    fun OpenRead(fname : string), builtin;\n"
-	    "    fun OpenWrite(fname : string), builtin;\n"
-	    "    fun Close(), builtin;\n"
-	    "    fun ReadLine() : string, builtin;\n"
-	    "    fun WriteLine(line : string), builtin;\n"
-	    "\n"
-	    "    prop EOF : bool is\n"
-	    "        get is\n"
-	    "            return is_eof();\n"
-	    "        end\n"
-	    "    end\n"
-	    "\n"
-	    "    fun is_eof() : bool, builtin;\n"
-	    "end\n");
-
-}
-
-/** Bind TextFile builtin.
- *
- * @param bi	Builtin object
- */
-void bi_textfile_bind(builtin_t *bi)
-{
-	builtin_fun_bind(bi, "TextFile", "OpenRead", bi_textfile_openread);
-	builtin_fun_bind(bi, "TextFile", "OpenWrite", bi_textfile_openwrite);
-	builtin_fun_bind(bi, "TextFile", "Close", bi_textfile_close);
-	builtin_fun_bind(bi, "TextFile", "ReadLine", bi_textfile_readline);
-	builtin_fun_bind(bi, "TextFile", "WriteLine", bi_textfile_writeline);
-	builtin_fun_bind(bi, "TextFile", "is_eof", bi_textfile_is_eof);
-}
-
-/** Open a text file for reading.
- *
- * @param run	Runner object
- */
-static void bi_textfile_openread(run_t *run)
-{
-	rdata_var_t *fname_var;
-	const char *fname;
-	FILE *file;
-
-	rdata_resource_t *resource;
-	rdata_var_t *res_var;
-	rdata_value_t *res_val;
-	rdata_var_t *self_f_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Called TextFile.OpenRead()\n");
-#endif
-	fname_var = run_local_vars_lookup(run, strtab_get_sid("fname"));
-	assert(fname_var);
-	assert(fname_var->vc == vc_string);
-
-	fname = fname_var->u.string_v->value;
-	file = fopen(fname, "rt");
-	if (file == NULL) {
-		printf("Error: Failed opening file '%s' for reading.\n",
-		    fname);
-		exit(1);
-	}
-
-	resource = rdata_resource_new();
-	resource->data = (void *) file;
-	res_var = rdata_var_new(vc_resource);
-	res_var->u.resource_v = resource;
-
-	res_val = rdata_value_new();
-	res_val->var = res_var;
-
-	/* Store resource handle into self.f */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	rdata_var_write(self_f_var, res_val);
-}
-
-/** Open a text file for writing.
- *
- * @param run	Runner object
- */
-static void bi_textfile_openwrite(run_t *run)
-{
-	rdata_var_t *fname_var;
-	const char *fname;
-	FILE *file;
-
-	rdata_resource_t *resource;
-	rdata_var_t *res_var;
-	rdata_value_t *res_val;
-	rdata_var_t *self_f_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Called TextFile.OpenWrite()\n");
-#endif
-	fname_var = run_local_vars_lookup(run, strtab_get_sid("fname"));
-	assert(fname_var);
-	assert(fname_var->vc == vc_string);
-
-	fname = fname_var->u.string_v->value;
-	file = fopen(fname, "wt");
-	if (file == NULL) {
-		printf("Error: Failed opening file '%s' for writing.\n",
-		    fname);
-		exit(1);
-	}
-
-	resource = rdata_resource_new();
-	resource->data = (void *) file;
-	res_var = rdata_var_new(vc_resource);
-	res_var->u.resource_v = resource;
-
-	res_val = rdata_value_new();
-	res_val->var = res_var;
-
-	/* Store resource handle into self.f */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	rdata_var_write(self_f_var, res_val);
-}
-
-/** Close a text file.
- *
- * @param run	Runner object
- */
-static void bi_textfile_close(run_t *run)
-{
-	FILE *file;
-	rdata_var_t *self_f_var;
-	run_proc_ar_t *proc_ar;
-
-	/* Extract pointer to file structure. */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	assert(self_f_var->vc == vc_resource);
-	file = (FILE *) self_f_var->u.resource_v->data;
-
-	if (file == NULL) {
-		printf("Error: TextFile not valid for Close.\n");
-		exit(1);
-	}
-
-	/* Close the file. */
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Close text file.\n");
-#endif
-	if (fclose(file) != 0) {
-		printf("Error: I/O error while closing file.\n");
-		exit(1);
-	}
-
-	/* Invalidate the resource handle. */
-	self_f_var->u.resource_v->data = NULL;
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = NULL;
-}
-
-/** Read one line from a text file.
- *
- * @param run	Runner object
- */
-static void bi_textfile_readline(run_t *run)
-{
-	FILE *file;
-	rdata_var_t *self_f_var;
-
-	rdata_string_t *str;
-	rdata_var_t *str_var;
-	rdata_value_t *str_val;
-	rdata_item_t *str_item;
-
-	run_proc_ar_t *proc_ar;
-	char *cp;
-
-	/* Extract pointer to file structure. */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	assert(self_f_var->vc == vc_resource);
-	file = (FILE *) self_f_var->u.resource_v->data;
-
-	if (file == NULL) {
-		printf("Error: TextFile not valid for ReadLine.\n");
-		exit(1);
-	}
-
-	/* Check and read. */
-
-	if (feof(file)) {
-		printf("Error: Reading beyond end of file.\n");
-		exit(1);
-	}
-
-	if (fgets(line_buf, LINE_BUF_SIZE, file) == NULL)
-		line_buf[0] = '\0';
-
-	if (ferror(file)) {
-		printf("Error: I/O error while reading file.\n");
-		exit(1);
-	}
-
-	/* Remove trailing newline, if present. */
-
-	cp = line_buf;
-	while (*cp != '\0')
-		++cp;
-
-	if (cp != line_buf && cp[-1] == '\n')
-		cp[-1] = '\0';
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Read '%s' from file.\n", line_buf);
-#endif
-	/* Construct return value. */
-	str = rdata_string_new();
-	str->value = os_str_dup(line_buf);
-
-	str_var = rdata_var_new(vc_string);
-	str_var->u.string_v = str;
-	str_val = rdata_value_new();
-	str_val->var = str_var;
-
-	str_item = rdata_item_new(ic_value);
-	str_item->u.value = str_val;
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = str_item;
-}
-
-/** Write one line to a text file.
- *
- * @param run	Runner object
- */
-static void bi_textfile_writeline(run_t *run)
-{
-	FILE *file;
-	rdata_var_t *self_f_var;
-	rdata_var_t *line_var;
-	const char *line;
-
-	run_proc_ar_t *proc_ar;
-
-	/* Get 'line' argument. */
-	line_var = run_local_vars_lookup(run, strtab_get_sid("line"));
-	assert(line_var);
-	assert(line_var->vc == vc_string);
-	line = line_var->u.string_v->value;
-
-	/* Extract pointer to file structure. */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	assert(self_f_var->vc == vc_resource);
-	file = (FILE *) self_f_var->u.resource_v->data;
-
-	if (file == NULL) {
-		printf("Error: TextFile not valid for WriteLine.\n");
-		exit(1);
-	}
-
-	/* Write and check. */
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Write '%s' to file.\n", line);
-#endif
-	if (fprintf(file, "%s\n", line) < 0) {
-		printf("Error: I/O error while writing file.\n");
-		exit(1);
-	}
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = NULL;
-}
-
-/** Return value of EOF flag.
- *
- * @param run	Runner object
- */
-static void bi_textfile_is_eof(run_t *run)
-{
-	FILE *file;
-	rdata_var_t *self_f_var;
-
-	bool_t eof_flag;
-	rdata_bool_t *eof_bool;
-	rdata_var_t *eof_var;
-	rdata_value_t *eof_val;
-	rdata_item_t *eof_item;
-
-	run_proc_ar_t *proc_ar;
-
-	/* Extract pointer to file structure. */
-	self_f_var = builtin_get_self_mbr_var(run, "f");
-	assert(self_f_var->vc == vc_resource);
-	file = (FILE *) self_f_var->u.resource_v->data;
-
-	if (file == NULL) {
-		printf("Error: TextFile not valid for EOF check.\n");
-		exit(1);
-	}
-
-	/* Get status of EOF flag. */
-
-	eof_flag = feof(file) ? b_true : b_false;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Read EOF flag '%s'.\n", eof_flag ? "true" : "false");
-#endif
-	/* Construct return value. */
-	eof_bool = rdata_bool_new();
-	eof_bool->value = eof_flag;
-
-	eof_var = rdata_var_new(vc_bool);
-	eof_var->u.bool_v = eof_bool;
-	eof_val = rdata_value_new();
-	eof_val->var = eof_var;
-
-	eof_item = rdata_item_new(ic_value);
-	eof_item->u.value = eof_val;
-
-	proc_ar = run_get_current_proc_ar(run);
-	proc_ar->retval = eof_item;
-}
Index: pace/app/sbi/src/builtin/bi_textfile.h
===================================================================
--- uspace/app/sbi/src/builtin/bi_textfile.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BI_TEXTFILE_H_
-#define BI_TEXTFILE_H_
-
-#include "../mytypes.h"
-
-void bi_textfile_declare(builtin_t *bi);
-void bi_textfile_bind(builtin_t *bi);
-
-#endif
Index: pace/app/sbi/src/builtin_t.h
===================================================================
--- uspace/app/sbi/src/builtin_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BUILTIN_T_H_
-#define BUILTIN_T_H_
-
-#include "run_t.h"
-
-/** Builtin symbols object
- *
- * Aggregates references to builtin symbols.
- */
-typedef struct builtin {
-	/** Containing program object */
-	struct stree_program *program;
-
-	/** Grandfather object */
-	struct stree_symbol *gf_class;
-
-	/** Boxed variants of primitive types */
-	struct stree_symbol *boxed_bool;
-	struct stree_symbol *boxed_char;
-	struct stree_symbol *boxed_int;
-	struct stree_symbol *boxed_string;
-
-	/** Error class for nil reference access */
-	struct stree_csi *error_nilreference;
-
-	/** Error class for out-of-bounds array access */
-	struct stree_csi *error_outofbounds;
-} builtin_t;
-
-/** Callback to run for a builtin procedure */
-typedef void (*builtin_proc_t)(run_t *);
-
-#endif
Index: pace/app/sbi/src/compat.h
===================================================================
--- uspace/app/sbi/src/compat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file HelenOS compatibility hacks.
- *
- * This must be included later than HelenOS's list.h.
- * XXX A better way must be found than this.
- */
-
-#ifndef COMPAT_H_
-#define COMPAT_H_
-
-#ifdef __HELENOS__
-
-#define list sbi_list
-#define list_t sbi_list_t
-
-/*
- * Avoid name conflicts with ADT library.
- */
-#define list_append sbi_list_append
-#define list_prepend sbi_list_prepend
-#define list_remove sbi_list_remove
-#define list_first sbi_list_first
-#define list_last sbi_list_last
-
-#endif
-
-#endif
Index: pace/app/sbi/src/cspan.c
===================================================================
--- uspace/app/sbi/src/cspan.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Coordinate span
- *
- * Captures the origin (input object, starting and ending line number and
- * columnt number) of a code fragment.
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "mytypes.h"
-
-#include "cspan.h"
-
-/** Allocate new coordinate span.
- *
- * @param	input	Input object.
- * @param	line	Starting line number.
- * @param	col0	Starting column number.
- * @param	line	Ending number (inclusive).
- * @param	col1	Ending column number (inclusive).
- *
- * @return	New coordinate span.
- */
-cspan_t *cspan_new(input_t *input, int line0, int col0, int line1, int col1)
-{
-	cspan_t *cspan;
-
-	cspan = calloc(1, sizeof(cspan_t));
-	if (cspan == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	cspan->input = input;
-	cspan->line0 = line0;
-	cspan->col0 = col0;
-	cspan->line1 = line1;
-	cspan->col1 = col1;
-
-	return cspan;
-}
-
-/** Create a merged coordinate span.
- *
- * Creates the smalles cspan covering cpans @a a and @a b. Both spans
- * must be from the same input object and @a a must start earlier
- * than @a b terminates.
- *
- * @param	a	First coordinate span
- * @param	b	Second coordinate span
- * @return	New coordinate span.
- */
-cspan_t *cspan_merge(cspan_t *a, cspan_t *b)
-{
-	assert(a != NULL);
-	assert(b != NULL);
-	assert(a->input == b->input);
-
-	return cspan_new(a->input, a->line0, a->col0, b->line1, b->col1);
-}
-
-/** Print coordinate span.
- *
- * @param cspan		Coordinate span
- */
-void cspan_print(cspan_t *cspan)
-{
-	printf("%s:", cspan->input->name);
-
-	if (cspan->line0 != cspan->line1) {
-		printf("%d:%d-%d:%d", cspan->line0, cspan->col0, cspan->line1,
-		    cspan->col1);
-	} else {
-		printf("%d:%d-%d", cspan->line0, cspan->col0, cspan->col1);
-	}
-}
Index: pace/app/sbi/src/cspan.h
===================================================================
--- uspace/app/sbi/src/cspan.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CSPAN_H_
-#define CSPAN_H_
-
-#include "mytypes.h"
-
-cspan_t *cspan_new(input_t *input, int line0, int col0, int line1, int col1);
-cspan_t *cspan_merge(cspan_t *a, cspan_t *b);
-void cspan_print(cspan_t *cspan);
-
-#endif
Index: pace/app/sbi/src/cspan_t.h
===================================================================
--- uspace/app/sbi/src/cspan_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CSPAN_T_H_
-#define CSPAN_T_H_
-
-/** Coordinate span
- *
- * A coordinate span records the coordinates of a source code fragment.
- * It can span multiple lines, but not multiple input objects.
- */
-typedef struct cspan {
-	/** Input object where the span comes from */
-	struct input *input;
-
-	/* Starting line and column */
-	int line0, col0;
-
-	/* Ending line and column, inclusive. */
-	int line1, col1;
-} cspan_t;
-
-#endif
Index: pace/app/sbi/src/debug.h
===================================================================
--- uspace/app/sbi/src/debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DEBUG_H_
-#define DEBUG_H_
-
-/** Uncomment this to get verbose debugging messages during parsing. */
-//#define DEBUG_PARSE_TRACE
-
-/**
- * Uncomment this to get extra verbose messages from parser's lexing
- * primitives.
- */
-//#define DEBUG_LPARSE_TRACE
-
-/** Uncomment this to get verbose debugging messagges during typing. */
-//#define DEBUG_TYPE_TRACE
-
-/** Uncomment this to get verbose debugging messages during execution. */
-//#define DEBUG_RUN_TRACE
-
-/** Uncomment this to get verbose debugging messages for bigint computation. */
-//#define DEBUG_BIGINT_TRACE
-
-#endif
Index: pace/app/sbi/src/imode.c
===================================================================
--- uspace/app/sbi/src/imode.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Interactive mode.
- *
- * In interactive mode the user types in statements. As soon as the outermost
- * statement is complete (terminated with ';' or 'end'), the interpreter
- * executes it. Otherwise it prompts the user until the entire statement
- * is read in.
- *
- * The user interface depends on the OS. In HelenOS we use the CLUI library
- * which gives us rich line editing capabilities.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "os/os.h"
-#include "ancr.h"
-#include "assert.h"
-#include "builtin.h"
-#include "intmap.h"
-#include "list.h"
-#include "mytypes.h"
-#include "program.h"
-#include "rdata.h"
-#include "stree.h"
-#include "strtab.h"
-#include "stype.h"
-#include "input.h"
-#include "lex.h"
-#include "parse.h"
-#include "run.h"
-
-#include "imode.h"
-
-/** Run in interactive mode.
- *
- * Repeatedly read in statements from the user and execute them.
- */
-void imode_run(void)
-{
-	input_t *input;
-	lex_t lex;
-	parse_t parse;
-	stree_program_t *program;
-	stree_stat_t *stat;
-	stree_proc_t *proc;
-	stree_fun_t *fun;
-	stree_symbol_t *fun_sym;
-	stype_t stype;
-	stype_block_vr_t *block_vr;
-	list_node_t *bvr_n;
-	rdata_item_t *rexpr;
-	rdata_item_t *rexpr_vi;
-
-	run_t run;
-	run_proc_ar_t *proc_ar;
-
-	bool_t quit_im;
-
-	/* Create an empty program. */
-	program = stree_program_new();
-	program->module = stree_module_new();
-
-	/* Declare builtin symbols. */
-	builtin_declare(program);
-
-	/* Process the library. */
-	if (program_lib_process(program) != EOK)
-		exit(1);
-
-	/* Resolve ancestry. */
-	ancr_module_process(program, program->module);
-
-	/* Bind internal interpreter references to symbols. */
-	builtin_bind(program->builtin);
-
-	/* Resolve ancestry. */
-	ancr_module_process(program, program->module);
-
-	/* Construct typing context. */
-	stype.program = program;
-	stype.proc_vr = stype_proc_vr_new();
-	list_init(&stype.proc_vr->block_vr);
-	stype.current_csi = NULL;
-	proc = stree_proc_new();
-
-	fun = stree_fun_new();
-	fun_sym = stree_symbol_new(sc_fun);
-	fun_sym->u.fun = fun;
-	fun->name = stree_ident_new();
-	fun->name->sid = strtab_get_sid("$imode");
-	fun->sig = stree_fun_sig_new();
-
-	stype.proc_vr->proc = proc;
-	fun->symbol = fun_sym;
-	proc->outer_symbol = fun_sym;
-
-	/* Create block visit record. */
-	block_vr = stype_block_vr_new();
-	intmap_init(&block_vr->vdecls);
-
-	/* Add block visit record to the stack. */
-	list_append(&stype.proc_vr->block_vr, block_vr);
-
-	/* Construct run context. */
-	run_gdata_init(&run);
-
-	run.thread_ar = run_thread_ar_new();
-	list_init(&run.thread_ar->proc_ar);
-	run_proc_ar_create(&run, run.gdata, proc, &proc_ar);
-	list_append(&run.thread_ar->proc_ar, proc_ar);
-
-	printf("SBI interactive mode. ");
-	os_input_disp_help();
-
-	quit_im = b_false;
-	while (quit_im != b_true) {
-		parse.error = b_false;
-		stype.error = b_false;
-		run.thread_ar->exc_payload = NULL;
-		run.thread_ar->bo_mode = bm_none;
-
-		input_new_interactive(&input);
-
-		/* Parse input. */
-		lex_init(&lex, input);
-		parse_init(&parse, program, &lex);
-
-		if (lcur_lc(&parse) == lc_eof)
-			break;
-
-		stat = parse_stat(&parse);
-
-		if (parse.error != b_false)
-			continue;
-
-		/* Type statement. */
-		stype_stat(&stype, stat, b_true);
-
-		if (stype.error != b_false)
-			continue;
-
-		/* Run statement. */
-		run_init(&run);
-		run.program = program;
-		run_stat(&run, stat, &rexpr);
-
-		/* Check for unhandled exceptions. */
-		run_exc_check_unhandled(&run);
-
-		if (rexpr != NULL) {
-			/* Convert expression result to value item. */
-			run_cvt_value_item(&run, rexpr, &rexpr_vi);
-			rdata_item_destroy(rexpr);
-
-			/* Check for unhandled exceptions. */
-			run_exc_check_unhandled(&run);
-		} else {
-			rexpr_vi = NULL;
-		}
-
-		/*
-		 * rexpr_vi can be NULL if either repxr was null or
-		 * if the conversion to value item raised an exception.
-		 */
-		if (rexpr_vi != NULL) {
-			assert(rexpr_vi->ic == ic_value);
-
-			/* Print result. */
-			printf("Result: ");
-			rdata_value_print(rexpr_vi->u.value);
-			printf("\n");
-
-			rdata_item_destroy(rexpr_vi);
-		}
-	}
-
-	run_proc_ar_destroy(&run, proc_ar);
-
-	/* Remove block visit record from the stack, */
-	bvr_n = list_last(&stype.proc_vr->block_vr);
-	assert(list_node_data(bvr_n, stype_block_vr_t *) == block_vr);
-	list_remove(&stype.proc_vr->block_vr, bvr_n);
-
-	printf("\nBye!\n");
-}
Index: pace/app/sbi/src/imode.h
===================================================================
--- uspace/app/sbi/src/imode.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IMODE_H_
-#define IMODE_H_
-
-void imode_run(void);
-
-#endif
Index: pace/app/sbi/src/input.c
===================================================================
--- uspace/app/sbi/src/input.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,239 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Input module
- *
- * Reads source code. Currently input can be read from a file (standard
- * case), from a string literal (when parsing builtin code) or interactively
- * from the user.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "mytypes.h"
-#include "os/os.h"
-#include "strtab.h"
-
-#include "input.h"
-
-/** Size of input buffer. XXX This limits the maximum line length. */
-#define INPUT_BUFFER_SIZE 256
-
-static errno_t input_init_file(input_t *input, const char *fname);
-static void input_init_interactive(input_t *input);
-static void input_init_string(input_t *input, const char *str);
-
-/** Create new input object for reading from file.
- *
- * @param input		Place to store pointer to new input object.
- * @param fname		Name of file to read from.
- *
- * @return		EOK on success, ENOMEM when allocation fails,
- *			ENOENT when opening file fails.
- */
-errno_t input_new_file(input_t **input, const char *fname)
-{
-	*input = malloc(sizeof(input_t));
-	if (*input == NULL)
-		return ENOMEM;
-
-	return input_init_file(*input, fname);
-}
-
-/** Create new input object for reading from interactive input.
- *
- * @param input		Place to store pointer to new input object.
- * @return		EOK on success, ENOMEM when allocation fails.
- */
-errno_t input_new_interactive(input_t **input)
-{
-	*input = malloc(sizeof(input_t));
-	if (*input == NULL)
-		return ENOMEM;
-
-	input_init_interactive(*input);
-	return EOK;
-}
-
-/** Create new input object for reading from string.
- *
- * @param input		Place to store pointer to new input object.
- * @param str		String literal from which to read input.
- * @return		EOK on success, ENOMEM when allocation fails.
- */
-errno_t input_new_string(input_t **input, const char *str)
-{
-	*input = malloc(sizeof(input_t));
-	if (*input == NULL)
-		return ENOMEM;
-
-	input_init_string(*input, str);
-	return EOK;
-}
-
-/** Initialize input object for reading from file.
- *
- * @param input		Input object.
- * @param fname		Name of file to read from.
- *
- * @return		EOK on success, ENOENT when opening file fails.
- */
-static errno_t input_init_file(input_t *input, const char *fname)
-{
-	FILE *f;
-
-	f = fopen(fname, "rt");
-	if (f == NULL)
-		return ENOENT;
-
-	input->buffer = malloc(INPUT_BUFFER_SIZE);
-	if (input->buffer == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	input->name = os_str_dup(fname);
-	input->str = NULL;
-	input->line_no = 0;
-	input->fin = f;
-	return EOK;
-}
-
-/** Initialize input object for reading from interactive input.
- *
- * @param input		Input object.
- */
-static void input_init_interactive(input_t *input)
-{
-	input->buffer = malloc(INPUT_BUFFER_SIZE);
-	if (input->buffer == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	input->name = "<user-input>";
-	input->str = NULL;
-	input->line_no = 0;
-	input->fin = NULL;
-}
-
-/** Initialize input object for reading from string.
- *
- * @param input		Input object.
- * @param str		String literal from which to read input.
- */
-static void input_init_string(input_t *input, const char *str)
-{
-	input->buffer = malloc(INPUT_BUFFER_SIZE);
-	if (input->buffer == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	input->name = "<builtin>";
-	input->str = str;
-	input->line_no = 0;
-	input->fin = NULL;
-}
-
-/** Get next line of input.
- *
- * The pointer stored in @a line is owned by @a input and is valid until the
- * next call to input_get_line(). The caller is not to free it. The returned
- * line is terminated with '\n' if another line is coming (potentially empty).
- * An empty line ("") signals end of input.
- *
- * @param input		Input object.
- * @param line		Place to store pointer to next line.
- *
- * @return		EOK on success, EIO on failure.
- */
-errno_t input_get_line(input_t *input, char **line)
-{
-	const char *prompt;
-	const char *sp;
-	char *dp;
-	char *line_p;
-	size_t cnt;
-
-	if (input->fin != NULL) {
-		/* Reading from file. */
-		if (fgets(input->buffer, INPUT_BUFFER_SIZE, input->fin) == NULL)
-			input->buffer[0] = '\0';
-
-		if (ferror(input->fin))
-			return EIO;
-
-		*line = input->buffer;
-	} else if (input->str != NULL) {
-		/* Reading from a string constant. */
-
-		/* Copy one line. */
-		sp = input->str;
-		dp = input->buffer;
-		cnt = 0;
-		while (*sp != '\n' && *sp != '\0' &&
-		    cnt < INPUT_BUFFER_SIZE - 2) {
-			*dp++ = *sp++;
-		}
-
-		/* Advance to start of next line. */
-		if (*sp == '\n')
-			*dp++ = *sp++;
-
-		*dp = '\0';
-		input->str = sp;
-		*line = input->buffer;
-	} else {
-		/* Interactive mode */
-		if (input->line_no == 0)
-			prompt = "sbi> ";
-		else
-			prompt = "...  ";
-
-		fflush(stdout);
-		if (os_input_line(prompt, &line_p) != EOK)
-			return EIO;
-
-		*line = line_p;
-	}
-
-	++input->line_no;
-	return EOK;
-}
-
-/** Get number of the last provided line of input.
- *
- * @param input		Input object.
- * @return		Line number of the last provided input line (counting
- *			from 1 up).
- */
-int input_get_line_no(input_t *input)
-{
-	return input->line_no;
-}
Index: pace/app/sbi/src/input.h
===================================================================
--- uspace/app/sbi/src/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef INPUT_H_
-#define INPUT_H_
-
-#include "mytypes.h"
-
-errno_t input_new_file(input_t **input, const char *fname);
-errno_t input_new_interactive(input_t **input);
-errno_t input_new_string(input_t **input, const char *str);
-
-errno_t input_get_line(input_t *input, char **line);
-int input_get_line_no(input_t *input);
-
-#endif
Index: pace/app/sbi/src/input_t.h
===================================================================
--- uspace/app/sbi/src/input_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef INPUT_T_H_
-#define INPUT_T_H_
-
-#include <stdio.h>
-
-/** Input state object */
-typedef struct input {
-	/** Input name (for error output) */
-	const char *name;
-
-	/** Input file if reading from file. */
-	FILE *fin;
-
-	/** Input string if reading from string. */
-	const char *str;
-
-	/** Buffer holding current line. */
-	char *buffer;
-
-	/** Current line number */
-	int line_no;
-} input_t;
-
-#endif
Index: pace/app/sbi/src/intmap.c
===================================================================
--- uspace/app/sbi/src/intmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Integer map.
- *
- * Maps integers to pointers (void *). Current implementation is trivial
- * (linked list of key-value pairs).
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "list.h"
-#include "mytypes.h"
-
-#include "intmap.h"
-
-/** Initialize map.
- *
- * @param intmap	Map to initialize.
- */
-void intmap_init(intmap_t *intmap)
-{
-	list_init(&intmap->elem);
-}
-
-/** Deinitialize map.
- *
- * The map must be already empty.
- *
- * @param intmap	Map to initialize.
- */
-void intmap_fini(intmap_t *intmap)
-{
-	list_fini(&intmap->elem);
-}
-
-/** Set value corresponding to a key.
- *
- * If there already exists a mapping for @a key in the map, it is
- * silently replaced. If @a value is @c NULL, the mapping for @a key
- * is removed from the map.
- *
- * @param intmap	Map
- * @param key		Key (integer)
- * @param value		Value (must be a pointer) or @c NULL
- */
-void intmap_set(intmap_t *intmap, int key, void *value)
-{
-	list_node_t *node;
-	map_elem_t *elem;
-
-	node = list_first(&intmap->elem);
-	while (node != NULL) {
-		elem = list_node_data(node, map_elem_t *);
-		if (elem->key == key) {
-			if (value != NULL) {
-				/* Replace existing value. */
-				elem->value = value;
-			} else {
-				/* Remove map element. */
-				list_remove(&intmap->elem, node);
-				free(elem);
-			}
-			return;
-		}
-		node = list_next(&intmap->elem, node);
-	}
-
-	/* Allocate new map element and add it to the list. */
-
-	elem = calloc(1, sizeof(map_elem_t));
-	if (elem == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	elem->key = key;
-	elem->value = value;
-	list_append(&intmap->elem, elem);
-}
-
-/** Get value corresponding to a key.
- *
- * @param intmap	Map
- * @param key		Key for which to retrieve mapping
- *
- * @return		Value correspoding to @a key or @c NULL if no mapping
- *			exists.
- */
-void *intmap_get(intmap_t *intmap, int key)
-{
-	list_node_t *node;
-	map_elem_t *elem;
-
-	node = list_first(&intmap->elem);
-	while (node != NULL) {
-		elem = list_node_data(node, map_elem_t *);
-		if (elem->key == key) {
-			return elem->value;
-		}
-		node = list_next(&intmap->elem, node);
-	}
-
-	/* Not found */
-	return NULL;
-}
-
-/** Get first element in the map.
- *
- * For iterating over the map, this returns the first element (in no
- * particular order).
- *
- * @param intmap	Map
- * @return		Map element or NULL if the map is empty
- */
-map_elem_t *intmap_first(intmap_t *intmap)
-{
-	list_node_t *node;
-
-	node = list_first(&intmap->elem);
-	if (node == NULL)
-		return NULL;
-
-	return list_node_data(node, map_elem_t *);
-}
-
-/** Get element key.
- *
- * Giver a map element, return the key.
- *
- * @param elem		Map element
- * @return		Key
- */
-int intmap_elem_get_key(map_elem_t *elem)
-{
-	return elem->key;
-}
-
-/** Get element value.
- *
- * Giver a map element, return the value.
- *
- * @param elem		Map element
- * @return		Value
- */
-void *intmap_elem_get_value(map_elem_t *elem)
-{
-	return elem->value;
-}
Index: pace/app/sbi/src/intmap.h
===================================================================
--- uspace/app/sbi/src/intmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef INTMAP_H_
-#define INTMAP_H_
-
-#include "mytypes.h"
-
-void intmap_init(intmap_t *intmap);
-void intmap_fini(intmap_t *intmap);
-void intmap_set(intmap_t *intmap, int key, void *data);
-void *intmap_get(intmap_t *intmap, int key);
-map_elem_t *intmap_first(intmap_t *intmap);
-int intmap_elem_get_key(map_elem_t *elem);
-void *intmap_elem_get_value(map_elem_t *elem);
-
-#endif
Index: pace/app/sbi/src/intmap_t.h
===================================================================
--- uspace/app/sbi/src/intmap_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef INTMAP_T_H_
-#define INTMAP_T_H_
-
-#include "list_t.h"
-
-typedef struct {
-	int key;
-	void *value;
-} map_elem_t;
-
-typedef struct intmap {
-	list_t elem; /* of (map_elem_t *) */
-} intmap_t;
-
-#endif
Index: pace/app/sbi/src/lex.c
===================================================================
--- uspace/app/sbi/src/lex.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,839 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Lexer (lexical analyzer).
- *
- * Consumes a text file and produces a sequence of lexical elements (lems).
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "bigint.h"
-#include "cspan.h"
-#include "mytypes.h"
-#include "input.h"
-#include "os/os.h"
-#include "strtab.h"
-
-#include "lex.h"
-
-#define TAB_WIDTH 8
-
-typedef enum {
-	cs_chr,
-	cs_str
-} chr_str_t;
-
-static void lex_touch(lex_t *lex);
-static bool_t lex_read_try(lex_t *lex);
-
-static void lex_skip_comment(lex_t *lex);
-static void lex_skip_ws(lex_t *lex);
-static bool_t is_wstart(char c);
-static bool_t is_wcont(char c);
-static bool_t is_digit(char c);
-static void lex_word(lex_t *lex);
-static void lex_char(lex_t *lex);
-static void lex_number(lex_t *lex);
-static void lex_string(lex_t *lex);
-static void lex_char_string_core(lex_t *lex, chr_str_t cs);
-static int digit_value(char c);
-
-/* Note: This imposes an implementation limit on identifier length. */
-#define IBUF_SIZE 128
-static char ident_buf[IBUF_SIZE + 1];
-
-/* XXX This imposes an implementation limit on string literal length. */
-#define SLBUF_SIZE 128
-static char strlit_buf[SLBUF_SIZE + 1];
-
-/** Lclass-string pair */
-struct lc_name {
-	lclass_t lclass;
-	const char *name;
-};
-
-/** Keyword names. Used both for printing and recognition. */
-static struct lc_name keywords[] = {
-	{ lc_and,	"and" },
-	{ lc_as,	"as" },
-	{ lc_bool,	"bool" },
-	{ lc_break,	"break" },
-	{ lc_builtin,	"builtin" },
-	{ lc_char,	"char" },
-	{ lc_class,	"class" },
-	{ lc_deleg,	"deleg" },
-	{ lc_do,	"do" },
-	{ lc_elif,	"elif" },
-	{ lc_else,	"else" },
-	{ lc_end,	"end" },
-	{ lc_enum,	"enum" },
-	{ lc_except,	"except" },
-	{ lc_false,	"false" },
-	{ lc_finally,	"finally" },
-	{ lc_for,	"for" },
-	{ lc_fun,	"fun" },
-	{ lc_get,	"get" },
-	{ lc_if,	"if" },
-	{ lc_in,	"in" },
-	{ lc_int,	"int" },
-	{ lc_interface,	"interface" },
-	{ lc_is,	"is" },
-	{ lc_new,	"new" },
-	{ lc_not,	"not" },
-	{ lc_nil,	"nil" },
-	{ lc_or,	"or" },
-	{ lc_override,	"override" },
-	{ lc_packed,	"packed" },
-	{ lc_private,	"private" },
-	{ lc_prop,	"prop" },
-	{ lc_protected,	"protected" },
-	{ lc_public,	"public" },
-	{ lc_raise,	"raise" },
-	{ lc_resource,	"resource" },
-	{ lc_return,	"return" },
-	{ lc_self,	"self" },
-	{ lc_set,	"set" },
-	{ lc_static,	"static" },
-	{ lc_string,	"string" },
-	{ lc_struct,	"struct" },
-	{ lc_switch,	"switch" },
-	{ lc_then,	"then" },
-	{ lc_this,	"this" },
-	{ lc_true,	"true" },
-	{ lc_var,	"var" },
-	{ lc_with,	"with" },
-	{ lc_when,	"when" },
-	{ lc_while,	"while" },
-	{ lc_yield,	"yield" },
-
-	{ 0,		NULL }
-};
-
-/** Other simple lclasses. Only used for printing. */
-static struct lc_name simple_lc[] = {
-	{ lc_invalid,	"INVALID" },
-	{ lc_eof,	"EOF" },
-
-	/* Operators */
-	{ lc_period,	"." },
-	{ lc_slash,	"/" },
-	{ lc_lparen,	"(" },
-	{ lc_rparen,	")" },
-	{ lc_lsbr,	"[" },
-	{ lc_rsbr,	"]" },
-	{ lc_equal,	"==" },
-	{ lc_notequal,	"!=" },
-	{ lc_lt,	"<" },
-	{ lc_gt,	">" },
-	{ lc_lt_equal,	"<=" },
-	{ lc_gt_equal,	">=" },
-	{ lc_assign,	"=" },
-	{ lc_plus,	"+" },
-	{ lc_minus,	"-" },
-	{ lc_mult,	"*" },
-	{ lc_increase,	"+=" },
-
-	/* Punctuators */
-	{ lc_comma,	"," },
-	{ lc_colon,	":" },
-	{ lc_scolon,	";" },
-
-	{ 0,		NULL },
-};
-
-/** Print lclass value.
- *
- * Prints lclass (lexical element class) value in human-readable form
- * (for debugging).
- *
- * @param lclass	Lclass value for display.
- */
-void lclass_print(lclass_t lclass)
-{
-	struct lc_name *dp;
-
-	dp = keywords;
-	while (dp->name != NULL) {
-		if (dp->lclass == lclass) {
-			printf("%s", dp->name);
-			return;
-		}
-		++dp;
-	}
-
-	dp = simple_lc;
-	while (dp->name != NULL) {
-		if (dp->lclass == lclass) {
-			printf("%s", dp->name);
-			return;
-		}
-		++dp;
-	}
-
-	switch (lclass) {
-	case lc_ident:
-		printf("ident");
-		break;
-	case lc_lit_int:
-		printf("int_literal");
-		break;
-	case lc_lit_string:
-		printf("string_literal");
-		break;
-	default:
-		printf("<unknown?>");
-		break;
-	}
-}
-
-/** Print lexical element.
- *
- * Prints lexical element in human-readable form (for debugging).
- *
- * @param lem		Lexical element for display.
- */
-void lem_print(lem_t *lem)
-{
-	lclass_print(lem->lclass);
-
-	switch (lem->lclass) {
-	case lc_ident:
-		printf("('%s')", strtab_get_str(lem->u.ident.sid));
-		break;
-	case lc_lit_int:
-		printf("(");
-		bigint_print(&lem->u.lit_int.value);
-		printf(")");
-		break;
-	case lc_lit_string:
-		printf("(\"%s\")", lem->u.lit_string.value);
-	default:
-		break;
-	}
-}
-
-/** Print lem coordinates.
- *
- * Print the coordinates (line number, column number) of a lexical element.
- *
- * @param lem		Lexical element for coordinate printing.
- */
-void lem_print_coords(lem_t *lem)
-{
-	cspan_print(lem->cspan);
-}
-
-/** Initialize lexer instance.
- *
- * @param lex		Lexer object to initialize.
- * @param input		Input to associate with lexer.
- */
-void lex_init(lex_t *lex, struct input *input)
-{
-	errno_t rc;
-
-	lex->input = input;
-
-	rc = input_get_line(lex->input, &lex->inbuf);
-	if (rc != EOK) {
-		printf("Error reading input.\n");
-		exit(1);
-	}
-
-	lex->ibp = lex->inbuf;
-	lex->col_adj = 0;
-	lex->prev_valid = b_false;
-	lex->current_valid = b_true;
-}
-
-/** Advance to next lexical element.
- *
- * The new element is read in lazily then it is actually accessed.
- *
- * @param lex		Lexer object.
- */
-void lex_next(lex_t *lex)
-{
-	/* Make sure the current lem has already been read in. */
-	lex_touch(lex);
-
-	/* Force a new lem to be read on next access. */
-	lex->current_valid = b_false;
-}
-
-/** Get current lem.
- *
- * The returned pointer is invalidated by next call to lex_next()
- *
- * @param lex		Lexer object.
- * @return		Pointer to current lem. Owned by @a lex and only valid
- *			until next call to lex_xxx().
- */
-lem_t *lex_get_current(lex_t *lex)
-{
-	lex_touch(lex);
-	return &lex->current;
-}
-
-/** Get previous lem if valid.
- *
- * The returned pointer is invalidated by next call to lex_next()
- *
- * @param lex		Lexer object.
- * @return		Pointer to previous lem. Owned by @a lex and only valid
- *			until next call to lex_xxx().
- */
-lem_t *lex_peek_prev(lex_t *lex)
-{
-	if (lex->current_valid == b_false) {
-		/*
-		 * This means the head is advanced but next lem was not read.
-		 * Thus the previous lem is still in @a current.
-		 */
-		return &lex->current;
-	}
-
-	if (lex->prev_valid != b_true) {
-		/* Looks like we are still at the first lem. */
-		return NULL;
-	}
-
-	/*
-	 * Current lem has been read in. Thus the previous lem was moved to
-	 * @a previous.
-	 */
-	return &lex->prev;
-}
-
-/** Read in the current lexical element (unless already read in).
- *
- * @param lex		Lexer object.
- */
-static void lex_touch(lex_t *lex)
-{
-	bool_t got_lem;
-
-	if (lex->current_valid == b_true)
-		return;
-
-	/* Copy previous lem */
-	lex->prev = lex->current;
-	lex->prev_valid = b_true;
-
-	do {
-		got_lem = lex_read_try(lex);
-	} while (got_lem == b_false);
-
-	lex->current_valid = b_true;
-}
-
-/** Try reading next lexical element.
- *
- * Attemps to read the next lexical element. In some cases (such as a comment)
- * this function will need to give it another try and returns @c b_false
- * in such case.
- *
- * @param lex		Lexer object.
- * @return		@c b_true on success or @c b_false if it needs
- *			restarting. On success the lem is stored to
- *			the current lem in @a lex.
- */
-static bool_t lex_read_try(lex_t *lex)
-{
-	char *bp, *lsp;
-	int line0, col0;
-
-	lex_skip_ws(lex);
-
-	/*
-	 * Record lem coordinates. Line number we already have. For column
-	 * number we start with position in the input buffer. This works
-	 * for all characters except tab. Thus we keep track of tabs
-	 * separately using col_adj.
-	 */
-	line0 = input_get_line_no(lex->input);
-	col0 = 1 + lex->col_adj + (lex->ibp - lex->inbuf);
-
-	lex->current.cspan = cspan_new(lex->input, line0, col0, line0, col0);
-
-	lsp = lex->ibp;
-	bp = lex->ibp;
-
-	if (bp[0] == '\0') {
-		/* End of input */
-		lex->current.lclass = lc_eof;
-		goto finish;
-	}
-
-	if (is_wstart(bp[0])) {
-		lex_word(lex);
-		goto finish;
-	}
-
-	if (bp[0] == '\'') {
-		lex_char(lex);
-		goto finish;
-	}
-
-	if (is_digit(bp[0])) {
-		lex_number(lex);
-		goto finish;
-	}
-
-	if (bp[0] == '"') {
-		lex_string(lex);
-		goto finish;
-	}
-
-	if (bp[0] == '-' && bp[1] == '-') {
-		lex_skip_comment(lex);
-
-		/* Compute ending column number */
-		lex->current.cspan->col1 = col0 + (lex->ibp - lsp) - 1;
-
-		/* Try again */
-		return b_false;
-	}
-
-	switch (bp[0]) {
-	case ',':
-		lex->current.lclass = lc_comma;
-		++bp;
-		break;
-	case ':':
-		lex->current.lclass = lc_colon;
-		++bp;
-		break;
-	case ';':
-		lex->current.lclass = lc_scolon;
-		++bp;
-		break;
-
-	case '.':
-		lex->current.lclass = lc_period;
-		++bp;
-		break;
-	case '/':
-		lex->current.lclass = lc_slash;
-		++bp;
-		break;
-	case '(':
-		lex->current.lclass = lc_lparen;
-		++bp;
-		break;
-	case ')':
-		lex->current.lclass = lc_rparen;
-		++bp;
-		break;
-	case '[':
-		lex->current.lclass = lc_lsbr;
-		++bp;
-		break;
-	case ']':
-		lex->current.lclass = lc_rsbr;
-		++bp;
-		break;
-
-	case '=':
-		if (bp[1] == '=') {
-			lex->current.lclass = lc_equal;
-			bp += 2;
-			break;
-		}
-		lex->current.lclass = lc_assign;
-		++bp;
-		break;
-
-	case '!':
-		if (bp[1] == '=') {
-			lex->current.lclass = lc_notequal;
-			bp += 2;
-			break;
-		}
-		goto invalid;
-
-	case '+':
-		if (bp[1] == '=') {
-			lex->current.lclass = lc_increase;
-			bp += 2;
-			break;
-		}
-		lex->current.lclass = lc_plus;
-		++bp;
-		break;
-
-	case '-':
-		lex->current.lclass = lc_minus;
-		++bp;
-		break;
-
-	case '*':
-		lex->current.lclass = lc_mult;
-		++bp;
-		break;
-
-	case '<':
-		if (bp[1] == '=') {
-			lex->current.lclass = lc_lt_equal;
-			bp += 2;
-			break;
-		}
-		lex->current.lclass = lc_lt;
-		++bp;
-		break;
-
-	case '>':
-		if (bp[1] == '=') {
-			lex->current.lclass = lc_gt_equal;
-			bp += 2;
-			break;
-		}
-		lex->current.lclass = lc_gt;
-		++bp;
-		break;
-
-	default:
-		goto invalid;
-	}
-
-	lex->ibp = bp;
-
-finish:
-	/* Compute ending column number */
-	lex->current.cspan->col1 = col0 + (lex->ibp - lsp) - 1;
-	return b_true;
-
-invalid:
-	lex->current.lclass = lc_invalid;
-	++bp;
-	lex->ibp = bp;
-
-	return b_true;
-}
-
-/** Lex a word (identifier or keyword).
- *
- * Read in a word. This may later turn out to be a keyword or a regular
- * identifier. It is stored in the current lem in @a lex.
- *
- * @param lex		Lexer object.
- */
-static void lex_word(lex_t *lex)
-{
-	struct lc_name *dp;
-	char *bp;
-	int idx;
-
-	bp = lex->ibp;
-	ident_buf[0] = bp[0];
-	idx = 1;
-
-	while (is_wcont(bp[idx])) {
-		if (idx >= IBUF_SIZE) {
-			printf("Error: Identifier too long.\n");
-			exit(1);
-		}
-
-		ident_buf[idx] = bp[idx];
-		++idx;
-	}
-
-	lex->ibp = bp + idx;
-
-	ident_buf[idx] = '\0';
-
-	dp = keywords;
-	while (dp->name != NULL) {
-		if (os_str_cmp(ident_buf, dp->name) == 0) {
-			/* Match */
-			lex->current.lclass = dp->lclass;
-			return;
-		}
-		++dp;
-	}
-
-	/* No matching keyword -- it must be an identifier. */
-	lex->current.lclass = lc_ident;
-	lex->current.u.ident.sid = strtab_get_sid(ident_buf);
-}
-
-/** Lex a character literal.
- *
- * Reads in a character literal and stores it in the current lem in @a lex.
- *
- * @param lex		Lexer object.
- */
-static void lex_char(lex_t *lex)
-{
-	size_t len;
-	int char_val;
-
-	lex_char_string_core(lex, cs_chr);
-
-	len = os_str_length(strlit_buf);
-	if (len != 1) {
-		printf("Character literal should contain one character, "
-		    "but contains %u characters instead.\n", (unsigned) len);
-		exit(1);
-	}
-
-	os_str_get_char(strlit_buf, 0, &char_val);
-	lex->current.lclass = lc_lit_char;
-	bigint_init(&lex->current.u.lit_char.value, char_val);
-}
-
-/** Lex a numeric literal.
- *
- * Reads in a numeric literal and stores it in the current lem in @a lex.
- *
- * @param lex		Lexer object.
- */
-static void lex_number(lex_t *lex)
-{
-	char *bp;
-	bigint_t value;
-	bigint_t dgval;
-	bigint_t base;
-	bigint_t tprod;
-
-	bp = lex->ibp;
-
-	bigint_init(&value, 0);
-	bigint_init(&base, 10);
-
-	while (is_digit(*bp)) {
-		bigint_mul(&value, &base, &tprod);
-		bigint_init(&dgval, digit_value(*bp));
-
-		bigint_destroy(&value);
-		bigint_add(&tprod, &dgval, &value);
-		bigint_destroy(&tprod);
-		bigint_destroy(&dgval);
-
-		++bp;
-	}
-
-	bigint_destroy(&base);
-
-	lex->ibp = bp;
-
-	lex->current.lclass = lc_lit_int;
-	bigint_shallow_copy(&value, &lex->current.u.lit_int.value);
-}
-
-/** Lex a string literal.
- *
- * Reads in a string literal and stores it in the current lem in @a lex.
- *
- * @param lex		Lexer object.
- */
-static void lex_string(lex_t *lex)
-{
-	lex_char_string_core(lex, cs_str);
-
-	lex->current.lclass = lc_lit_string;
-	lex->current.u.lit_string.value = os_str_dup(strlit_buf);
-}
-
-static void lex_char_string_core(lex_t *lex, chr_str_t cs)
-{
-	char *bp;
-	int sidx, didx;
-	char term;
-	const char *descr, *cap_descr;
-	char spchar;
-
-	/* Make compiler happy */
-	term = '\0';
-	descr = NULL;
-	cap_descr = NULL;
-
-	switch (cs) {
-	case cs_chr:
-		term = '\'';
-		descr = "character";
-		cap_descr = "Character";
-		break;
-	case cs_str:
-		term = '"';
-		descr = "string";
-		cap_descr = "String";
-		break;
-	}
-
-	bp = lex->ibp + 1;
-	sidx = didx = 0;
-
-	while (bp[sidx] != term) {
-		if (didx >= SLBUF_SIZE) {
-			printf("Error: %s literal too long.\n", cap_descr);
-			exit(1);
-		}
-
-		if (bp[sidx] == '\0') {
-			printf("Error: Unterminated %s literal.\n", descr);
-			exit(1);
-		}
-
-		if (bp[sidx] == '\\') {
-			switch (bp[sidx + 1]) {
-			case '\\':
-				spchar = '\\';
-				break;
-			case '\'':
-				spchar = '\'';
-				break;
-			case '"':
-				spchar = '"';
-				break;
-			case 'n':
-				spchar = '\n';
-				break;
-			case 't':
-				spchar = '\t';
-				break;
-			default:
-				printf("Error: Unknown character escape sequence.\n");
-				exit(1);
-			}
-
-			strlit_buf[didx] = spchar;
-			++didx;
-			sidx += 2;
-		} else {
-			strlit_buf[didx] = bp[sidx];
-			++sidx;
-			++didx;
-		}
-	}
-
-	lex->ibp = bp + sidx + 1;
-
-	strlit_buf[didx] = '\0';
-}
-
-/** Lex a single-line comment.
- *
- * This does not produce any lem. The comment is just skipped.
- *
- * @param lex		Lexer object.
- */
-static void lex_skip_comment(lex_t *lex)
-{
-	char *bp;
-
-	bp = lex->ibp + 2;
-
-	while (*bp != '\n' && *bp != '\0') {
-		++bp;
-	}
-
-	lex->ibp = bp;
-}
-
-/** Skip whitespace characters.
- *
- * This does not produce any lem. The whitespace is just skipped.
- *
- * @param lex		Lexer object.
- */
-static void lex_skip_ws(lex_t *lex)
-{
-	char *bp;
-	errno_t rc;
-
-	bp = lex->ibp;
-
-	while (b_true) {
-		while (*bp == ' ' || *bp == '\t') {
-			if (*bp == '\t') {
-				/* XXX This is too simplifed. */
-				lex->col_adj += (TAB_WIDTH - 1);
-			}
-			++bp;
-		}
-
-		if (*bp != '\n')
-			break;
-
-		/* Read next line */
-		rc = input_get_line(lex->input, &lex->inbuf);
-		if (rc != EOK) {
-			printf("Error reading input.\n");
-			exit(1);
-		}
-
-		bp = lex->inbuf;
-		lex->col_adj = 0;
-	}
-
-	lex->ibp = bp;
-}
-
-/** Determine if character can start a word.
- *
- * @param c 	Character.
- * @return	@c b_true if @a c can start a word, @c b_false otherwise.
- */
-static bool_t is_wstart(char c)
-{
-	return ((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
-	    (c == '_');
-}
-
-/** Determine if character can continue a word.
- *
- * @param c 	Character.
- * @return	@c b_true if @a c can start continue word, @c b_false
- *		otherwise.
- */
-static bool_t is_wcont(char c)
-{
-	return is_digit(c) || is_wstart(c);
-}
-
-/** Determine if character is a numeric digit.
- *
- * @param c 	Character.
- * @return	@c b_true if @a c is a numeric digit, @c b_false otherwise.
- */
-static bool_t is_digit(char c)
-{
-	return ((c >= '0') && (c <= '9'));
-}
-
-/** Determine numeric value of digit character.
- *
- * @param c 	Character, must be a valid decimal digit.
- * @return	Value of the digit (0-9).
- */
-static int digit_value(char c)
-{
-	return (c - '0');
-}
Index: pace/app/sbi/src/lex.h
===================================================================
--- uspace/app/sbi/src/lex.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LEX_H_
-#define LEX_H_
-
-#include "mytypes.h"
-
-void lclass_print(lclass_t lclass);
-void lem_print(lem_t *lem);
-void lem_print_coords(lem_t *lem);
-
-void lex_init(lex_t *lex, struct input *input);
-void lex_next(lex_t *lex);
-lem_t *lex_get_current(lex_t *lex);
-lem_t *lex_peek_prev(lex_t *lex);
-
-#endif
Index: pace/app/sbi/src/lex_t.h
===================================================================
--- uspace/app/sbi/src/lex_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LEX_T_H_
-#define LEX_T_H_
-
-#include "bigint_t.h"
-
-/** Lexical element class */
-typedef enum {
-	lc_invalid,
-	lc_eof,
-
-	lc_ident,
-	lc_lit_char,
-	lc_lit_int,
-	lc_lit_string,
-
-	/* Keywords */
-	lc_and,
-	lc_as,
-	lc_break,
-	lc_bool,
-	lc_builtin,
-	lc_char,
-	lc_class,
-	lc_deleg,
-	lc_do,
-	lc_elif,
-	lc_else,
-	lc_end,
-	lc_enum,
-	lc_except,
-	lc_false,
-	lc_finally,
-	lc_for,
-	lc_fun,
-	lc_new,
-	lc_get,
-	lc_if,
-	lc_in,
-	lc_int,
-	lc_interface,
-	lc_is,
-	lc_nil,
-	lc_not,
-	lc_or,
-	lc_override,
-	lc_packed,
-	lc_private,
-	lc_prop,
-	lc_protected,
-	lc_public,
-	lc_raise,
-	lc_resource,
-	lc_return,
-	lc_self,
-	lc_set,
-	lc_static,
-	lc_string,
-	lc_struct,
-	lc_switch,
-	lc_then,
-	lc_this,
-	lc_true,
-	lc_var,
-	lc_with,
-	lc_when,
-	lc_while,
-	lc_yield,
-
-	/* Operators */
-	lc_period,
-	lc_slash,
-	lc_lparen,
-	lc_rparen,
-	lc_lsbr,
-	lc_rsbr,
-	lc_equal,
-	lc_notequal,
-	lc_lt,
-	lc_gt,
-	lc_lt_equal,
-	lc_gt_equal,
-	lc_assign,
-	lc_plus,
-	lc_minus,
-	lc_mult,
-	lc_increase,
-
-	/* Punctuators */
-	lc_comma,
-	lc_colon,
-	lc_scolon,
-
-	lc__limit
-} lclass_t;
-
-typedef struct {
-	/* String ID */
-	int sid;
-} lem_ident_t;
-
-typedef struct {
-	/* Character value */
-	bigint_t value;
-} lem_lit_char_t;
-
-typedef struct {
-	/* Integer value */
-	bigint_t value;
-} lem_lit_int_t;
-
-typedef struct {
-	/* String value */
-	char *value;
-} lem_lit_string_t;
-
-/** Lexical element */
-typedef struct {
-	/* Lexical element class */
-	lclass_t lclass;
-
-	union {
-		lem_ident_t ident;
-		lem_lit_char_t lit_char;
-		lem_lit_int_t lit_int;
-		lem_lit_string_t lit_string;
-	} u;
-
-	/** Coordinates of this lexical element */
-	struct cspan *cspan;
-} lem_t;
-
-/** Lexer state object */
-typedef struct lex {
-	/** Input object */
-	struct input *input;
-
-	/** Lexing buffer */
-	char *inbuf;
-
-	/** Pointer to current position in lexing buffer */
-	char *ibp;
-
-	/** Number of the line currently in inbuf */
-	int ib_line;
-
-	/** Column number adjustment (due to tabs) */
-	int col_adj;
-
-	/** @c b_true if we have the previous lem in @c prev */
-	bool_t prev_valid;
-
-	/** Previous lem (only valid if @c current_valid is true) */
-	lem_t prev;
-
-	/** @c b_true if we have the current lem in @c current */
-	bool_t current_valid;
-
-	/** Curent lem (only valid if @c current_valid is true) */
-	lem_t current;
-} lex_t;
-
-#endif
Index: pace/app/sbi/src/list.c
===================================================================
--- uspace/app/sbi/src/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,300 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Doubly linked list.
- *
- * Circular, with a head. Nodes structures are allocated separately from data.
- * Data is stored as 'void *'. We implement several sanity checks to prevent
- * common usage errors.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "mytypes.h"
-
-#include "list.h"
-
-static list_node_t *list_node_new(void *data);
-static void list_node_delete(list_node_t *node);
-static void list_node_insert_between(list_node_t *n, list_node_t *a, list_node_t *b);
-static void list_node_unlink(list_node_t *n);
-static bool_t list_node_present(list_t *list, list_node_t *node);
-
-/** Initialize list.
- *
- * @param list	List to initialize.
- */
-void list_init(list_t *list)
-{
-	list->head.prev = &list->head;
-	list->head.next = &list->head;
-}
-
-/** Deinitialize list.
- *
- * @param list	List to deinitialize.
- */
-void list_fini(list_t *list)
-{
-	assert(list_is_empty(list));
-
-	list->head.prev = NULL;
-	list->head.next = NULL;
-}
-
-/** Append data to list.
- *
- * Create a new list node and append it at the end of the list.
- *
- * @param list	Linked list.
- * @param data	Data for the new node.
- */
-void list_append(list_t *list, void *data)
-{
-	list_node_t *node;
-
-	node = list_node_new(data);
-	list_node_insert_between(node, list->head.prev, &list->head);
-}
-
-/** Prepend data to list.
- *
- * Create a new list node and prepend it at the beginning of the list.
- *
- * @param list	Linked list.
- * @param data	Data for the new node.
- */
-void list_prepend(list_t *list, void *data)
-{
-	list_node_t *node;
-
-	node = list_node_new(data);
-	list_node_insert_between(node, list->head.prev, &list->head);
-}
-
-/** Remove data from list.
- *
- * Removes the given node from a list and destroys it. Any data the node might
- * have is ignored. If asserts are on, we check wheter node is really present
- * in the list the caller is requesting us to remove it from.
- *
- * @param list	Linked list.
- * @param node	List node to remove.
- */
-void list_remove(list_t *list, list_node_t *node)
-{
-	/* Check whether node is in the list as claimed. */
-	assert(list_node_present(list, node));
-	list_node_unlink(node);
-	node->data = NULL;
-	list_node_delete(node);
-}
-
-/** Return first list node or NULL if list is empty.
- *
- * @param list	Linked list.
- * @return	First node of the list or @c NULL if the list is empty.
- */
-list_node_t *list_first(list_t *list)
-{
-	list_node_t *node;
-
-	assert(list != NULL);
-	node = list->head.next;
-
-	return (node != &list->head) ? node : NULL;
-}
-
-/** Return last list node or NULL if list is empty.
- *
- * @param list	Linked list.
- * @return	Last node of the list or @c NULL if the list is empty.
- */
-list_node_t *list_last(list_t *list)
-{
-	list_node_t *node;
-
-	assert(list != NULL);
-	node = list->head.prev;
-
-	return (node != &list->head) ? node : NULL;
-}
-
-/** Return next list node or NULL if this was the last one.
- *
- * @param list	Linked list.
- * @param node	Node whose successor we are interested in.
- * @return	Following list node or @c NULL if @a node is last.
- */
-list_node_t *list_next(list_t *list, list_node_t *node)
-{
-	(void) list;
-	assert(list != NULL);
-	assert(node != NULL);
-
-	return (node->next != &list->head) ? node->next : NULL;
-}
-
-/** Return previous list node or NULL if this was the last one.
- *
- * @param list	Linked list.
- * @param node	Node whose predecessor we are interested in.
- * @return	Preceding list node or @c NULL if @a node is last.
- */
-list_node_t *list_prev(list_t *list, list_node_t *node)
-{
-	(void) list;
-	assert(list != NULL);
-	assert(node != NULL);
-
-	return (node->prev != &list->head) ? node->prev : NULL;
-}
-
-/** Return b_true if list is empty.
- *
- * @param list	Linked list.
- * @return	@c b_true if list is empty, @c b_false otherwise.
- */
-bool_t list_is_empty(list_t *list)
-{
-	return (list_first(list) == NULL);
-}
-
-/** Change node data.
- *
- * Change the data associated with a node.
- *
- * @param node	List node.
- * @param data	New data for node.
- */
-void list_node_setdata(list_node_t *node, void *data)
-{
-	node->data = data;
-}
-
-/** Create new node.
- *
- * @param data	Initial data for node.
- * @return	New list node.
- */
-static list_node_t *list_node_new(void *data)
-{
-	list_node_t *node;
-
-	node = malloc(sizeof(list_node_t));
-	if (node == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	node->prev = NULL;
-	node->next = NULL;
-	node->data = data;
-
-	return node;
-}
-
-/** Delete node.
- *
- * @param node	List node. Must not take part in any list.
- */
-static void list_node_delete(list_node_t *node)
-{
-	assert(node->prev == NULL);
-	assert(node->next == NULL);
-	assert(node->data == NULL);
-	free(node);
-}
-
-/** Insert node between two other nodes.
- *
- * Inserts @a n between neighboring nodes @a a and @a b.
- *
- * @param n	Node to insert.
- * @param a	Node to precede @a n.
- * @param b	Node to follow @a n.
- */
-static void list_node_insert_between(list_node_t *n, list_node_t *a,
-    list_node_t *b)
-{
-	assert(n->prev == NULL);
-	assert(n->next == NULL);
-	n->prev = a;
-	n->next = b;
-
-	assert(a->next == b);
-	assert(b->prev == a);
-	a->next = n;
-	b->prev = n;
-}
-
-/** Unlink node.
- *
- * Unlink node from the list it is currently in.
- *
- * @param n	Node to unlink from its current list.
- */
-static void list_node_unlink(list_node_t *n)
-{
-	list_node_t *a, *b;
-	assert(n->prev != NULL);
-	assert(n->next != NULL);
-
-	a = n->prev;
-	b = n->next;
-
-	assert(a->next == n);
-	assert(b->prev == n);
-
-	a->next = b;
-	b->prev = a;
-
-	n->prev = NULL;
-	n->next = NULL;
-}
-
-/** Check whether @a node is in list @a list.
- *
- * @param list	Linked list.
- * @param node	Node.
- * @return	@c b_true if @a node is part of @a list, @c b_false otherwise.
- */
-static bool_t list_node_present(list_t *list, list_node_t *node)
-{
-	list_node_t *m;
-
-	m = list->head.next;
-	while (m != &list->head) {
-		if (m == node)
-			return b_true;
-		m = m->next;
-	}
-
-	return b_false;
-}
Index: pace/app/sbi/src/list.h
===================================================================
--- uspace/app/sbi/src/list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIST_H_
-#define LIST_H_
-
-#include "mytypes.h"
-#include "compat.h"
-
-void list_init(list_t *list);
-void list_fini(list_t *list);
-void list_append(list_t *list, void *data);
-void list_prepend(list_t *list, void *data);
-void list_remove(list_t *list, list_node_t *node);
-
-list_node_t *list_first(list_t *list);
-list_node_t *list_last(list_t *list);
-list_node_t *list_next(list_t *list, list_node_t *node);
-list_node_t *list_prev(list_t *list, list_node_t *node);
-bool_t list_is_empty(list_t *list);
-
-void list_node_setdata(list_node_t *node, void *data);
-
-#define list_node_data(node, dtype) ((dtype)(node->data))
-
-#endif
Index: pace/app/sbi/src/list_t.h
===================================================================
--- uspace/app/sbi/src/list_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIST_T_H_
-#define LIST_T_H_
-
-#include "compat.h"
-
-typedef struct list_node {
-	struct list_node *prev, *next;
-	void *data;
-} list_node_t;
-
-typedef struct list {
-	/** Empty head (no data) */
-	list_node_t head;
-} list_t;
-
-#endif
Index: pace/app/sbi/src/main.c
===================================================================
--- uspace/app/sbi/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Main module.
- *
- * Main entry point for SBI, the Sysel Bootstrap Interpreter.
- * When run without parameters, the interpreter will enter interactive
- * mode.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "ancr.h"
-#include "os/os.h"
-#include "builtin.h"
-#include "imode.h"
-#include "mytypes.h"
-#include "program.h"
-#include "strtab.h"
-#include "stree.h"
-#include "stype.h"
-#include "input.h"
-#include "lex.h"
-#include "parse.h"
-#include "run.h"
-
-static void syntax_print(void);
-
-/** Main entry point.
- *
- * @return	Zero on success, non-zero on error.
- */
-int main(int argc, char *argv[])
-{
-	stree_program_t *program;
-	stype_t stype;
-	run_t run;
-	errno_t rc;
-
-	/* Store executable file path under which we have been invoked. */
-	os_store_ef_path(*argv);
-
-	argv += 1;
-	argc -= 1;
-
-	if (argc == 0) {
-		/* Enter interactive mode */
-		strtab_init();
-		imode_run();
-		return 0;
-	}
-
-	if (os_str_cmp(*argv, "-h") == 0) {
-		syntax_print();
-		return 0;
-	}
-
-	strtab_init();
-	program = stree_program_new();
-	program->module = stree_module_new();
-
-	/* Declare builtin symbols. */
-	builtin_declare(program);
-
-	/* Process source files in the library. */
-	if (program_lib_process(program) != EOK)
-		return 1;
-
-	/* Resolve ancestry. */
-	ancr_module_process(program, program->module);
-
-	/* Bind internal interpreter references to symbols. */
-	builtin_bind(program->builtin);
-
-	/* Process all source files specified in command-line arguments. */
-	while (argc > 0) {
-		rc = program_file_process(program, *argv);
-		if (rc != EOK)
-			return 1;
-
-		argv += 1;
-		argc -= 1;
-	}
-
-	/* Resolve ancestry. */
-	ancr_module_process(program, program->module);
-
-	/* Type program. */
-	stype.program = program;
-	stype.error = b_false;
-	stype_module(&stype, program->module);
-
-	/* Check for typing errors. */
-	if (stype.error)
-		return 1;
-
-	/* Run program. */
-	run_init(&run);
-	run_program(&run, program);
-
-	/* Check for run-time errors. */
-	if (run.thread_ar->error)
-		return 1;
-
-	return 0;
-}
-
-/** Print command-line syntax help. */
-static void syntax_print(void)
-{
-	printf("Syntax: sbi <source_file.sy>\n");
-}
Index: pace/app/sbi/src/mytypes.h
===================================================================
--- uspace/app/sbi/src/mytypes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MYTYPES_H_
-#define MYTYPES_H_
-
-/** Boolean type compatible with builtin C 'boolean' operators. */
-typedef enum {
-	b_false = 0,
-	b_true = 1
-} bool_t;
-
-/** Node state for walks. */
-typedef enum {
-	ws_unvisited,
-	ws_active,
-	ws_visited
-} walk_state_t;
-
-/** Static vs. nonstatic */
-typedef enum {
-	sn_nonstatic,
-	sn_static
-} statns_t;
-
-/** Error return codes. */
-#include <errno.h>
-/** We need NULL defined. */
-#include <stddef.h>
-
-#ifndef EOK
-#define EOK 0
-#endif
-
-#include "bigint_t.h"
-#include "builtin_t.h"
-#include "cspan_t.h"
-#include "input_t.h"
-#include "intmap_t.h"
-#include "lex_t.h"
-#include "list_t.h"
-#include "parse_t.h"
-#include "rdata_t.h"
-#include "run_t.h"
-#include "stree_t.h"
-#include "strtab_t.h"
-#include "stype_t.h"
-#include "tdata_t.h"
-
-#endif
Index: pace/app/sbi/src/os/helenos.c
===================================================================
--- uspace/app/sbi/src/os/helenos.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file HelenOS-specific code. */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <tinput.h>
-#include <str_error.h>
-
-#include "os.h"
-
-/** Path to executable file via which we have been invoked. */
-static char *ef_path;
-
-/*
- * Using HelenOS-specific string API.
- */
-
-static tinput_t *tinput = NULL;
-
-/** Concatenate two strings.
- *
- * @param a	First string
- * @param b	Second string
- * @return	New string, concatenation of @a a and @a b.
- */
-char *os_str_acat(const char *a, const char *b)
-{
-	int a_size, b_size;
-	char *str;
-
-	a_size = str_size(a);
-	b_size = str_size(b);
-
-	str = malloc(a_size + b_size + 1);
-	if (str == NULL) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	memcpy(str, a, a_size);
-	memcpy(str + a_size, b, b_size);
-	str[a_size + b_size] = '\0';
-
-	return str;
-}
-
-/** Return slice (substring) of a string.
- *
- * Copies the specified range of characters from @a str and returns it
- * as a newly allocated string. @a start + @a length must be less than
- * or equal to the length of @a str.
- *
- * @param str		String
- * @param start		Index of first character (starting from zero).
- * @param length	Number of characters to copy.
- *
- * @return		Newly allocated string holding the slice.
- */
-char *os_str_aslice(const char *str, size_t start, size_t length)
-{
-	char *slice;
-	size_t offset;
-	size_t i;
-	size_t size;
-	char32_t c;
-
-	assert(start + length <= str_length(str));
-
-	offset = 0;
-	for (i = 0; i < start; ++i) {
-		c = str_decode(str, &offset, STR_NO_LIMIT);
-		assert(c != '\0');
-		assert(c != U_SPECIAL);
-		(void) c;
-	}
-
-	size = str_lsize(str, length);
-	slice = str_ndup(str + offset, size);
-
-	return slice;
-}
-
-/** Compare two strings.
- *
- * @param a	First string
- * @param b	Second string
- * @return	Zero if equal, nonzero if not equal
- */
-int os_str_cmp(const char *a, const char *b)
-{
-	return str_cmp(a, b);
-}
-
-/** Return number of characters in string.
- *
- * @param str	String
- * @return	Number of characters in @a str.
- */
-size_t os_str_length(const char *str)
-{
-	return str_length(str);
-}
-
-/** Duplicate string.
- *
- * @param str	String
- * @return	New string, duplicate of @a str.
- */
-char *os_str_dup(const char *str)
-{
-	return str_dup(str);
-}
-
-/** Get character from string at the given index.
- *
- * @param str		String
- * @param index		Character index (starting from zero).
- * @param out_char	Place to store character.
- * @return		EOK on success, EINVAL if index is out of bounds,
- *			EIO on decoding error.
- */
-errno_t os_str_get_char(const char *str, int index, int *out_char)
-{
-	size_t offset;
-	int i;
-	char32_t c = 0;
-
-	if (index < 0)
-		return EINVAL;
-
-	offset = 0;
-	for (i = 0; i <= index; ++i) {
-		c = str_decode(str, &offset, STR_NO_LIMIT);
-		if (c == '\0')
-			return EINVAL;
-		if (c == U_SPECIAL)
-			return EIO;
-	}
-
-	*out_char = (int) c;
-	return EOK;
-}
-
-/** Convert character to new string.
- *
- * @param chr		Character
- * @return		Newly allocated string.
- */
-char *os_chr_to_astr(char32_t chr)
-{
-	char *str;
-	size_t offset;
-
-	str = malloc(STR_BOUNDS(1) + 1);
-	if (str == NULL) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	offset = 0;
-	if (chr_encode(chr, str, &offset, STR_BOUNDS(1)) != EOK) {
-		/* XXX Should handle gracefully */
-		printf("String conversion error.\n");
-		exit(1);
-	}
-
-	str[offset] = '\0';
-	return str;
-}
-
-/** Display survival help message. */
-void os_input_disp_help(void)
-{
-	printf("Press Ctrl-Q to quit.\n");
-}
-
-/** Read one line of input from the user.
- *
- * @param ptr	Place to store pointer to new string.
- */
-errno_t os_input_line(const char *prompt, char **ptr)
-{
-	char *line;
-	errno_t rc;
-
-	if (tinput == NULL) {
-		tinput = tinput_new();
-		if (tinput == NULL)
-			return EIO;
-
-		tinput_set_prompt(tinput, prompt);
-	}
-
-	rc = tinput_read(tinput, &line);
-	if (rc == ENOENT) {
-		/* User-requested abort */
-		*ptr = os_str_dup("");
-		return EOK;
-	}
-
-	if (rc != EOK) {
-		/* Error in communication with console */
-		return EIO;
-	}
-
-	/* XXX Input module needs trailing newline to keep going. */
-	*ptr = os_str_acat(line, "\n");
-	free(line);
-
-	return EOK;
-}
-
-/** Simple command execution.
- *
- * @param cmd	Command and arguments (NULL-terminated list of strings.)
- *		Command is present just one, not duplicated.
- */
-errno_t os_exec(char *const cmd[])
-{
-	task_id_t tid;
-	task_wait_t twait;
-	task_exit_t texit;
-	errno_t rc;
-	int retval;
-
-	rc = task_spawnv(&tid, &twait, cmd[0], (char const *const *) cmd);
-	if (rc != EOK) {
-		printf("Error: Failed spawning '%s' (%s).\n", cmd[0],
-		    str_error(rc));
-		exit(1);
-	}
-
-	/* XXX Handle exit status and return value. */
-	rc = task_wait(&twait, &texit, &retval);
-	(void) rc;
-
-	return EOK;
-}
-
-/** Store the executable file path via which we were executed.
- *
- * @param path	Executable path via which we were executed.
- */
-void os_store_ef_path(char *path)
-{
-	ef_path = path;
-}
-
-/** Return path to the Sysel library
- *
- * @return New string. Caller should deallocate it using @c free().
- */
-char *os_get_lib_path(void)
-{
-	return os_str_dup("/src/sysel/lib");
-}
Index: pace/app/sbi/src/os/os.h
===================================================================
--- uspace/app/sbi/src/os/os.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OS_H_
-#define OS_H_
-
-#include <errno.h>
-
-char *os_str_acat(const char *a, const char *b);
-char *os_str_aslice(const char *str, size_t start, size_t length);
-int os_str_cmp(const char *a, const char *b);
-char *os_str_dup(const char *str);
-size_t os_str_length(const char *str);
-errno_t os_str_get_char(const char *str, int index, int *out_char);
-char *os_chr_to_astr(char32_t chr);
-void os_input_disp_help(void);
-errno_t os_input_line(const char *prompt, char **ptr);
-errno_t os_exec(char *const cmd[]);
-
-void os_store_ef_path(char *path);
-char *os_get_lib_path(void);
-
-#endif
Index: pace/app/sbi/src/os/posix.c
===================================================================
--- uspace/app/sbi/src/os/posix.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,262 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file POSIX-specific code. */
-
-#include <assert.h>
-#include <libgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <types/common.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <errno.h>
-#include "../mytypes.h"
-
-#include "os.h"
-
-/** Path to executable file via which we have been invoked. */
-static char *ef_path;
-
-/*
- * The string functions are in fact standard C, but would not work under
- * HelenOS.
- *
- * XXX String functions used here only work with 8-bit text encoding.
- */
-
-/** Concatenate two strings.
- *
- * @param a	First string
- * @param b	Second string
- * @return	New string, concatenation of @a a and @a b.
- */
-char *os_str_acat(const char *a, const char *b)
-{
-	int a_len, b_len;
-	char *str;
-
-	a_len = strlen(a);
-	b_len = strlen(b);
-
-	str = malloc(a_len + b_len + 1);
-	if (str == NULL) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	memcpy(str, a, a_len);
-	memcpy(str + a_len, b, b_len);
-	str[a_len + b_len] = '\0';
-
-	return str;
-}
-
-/** Return slice (substring) of a string.
- *
- * Copies the specified range of characters from @a str and returns it
- * as a newly allocated string. @a start + @a length must be less than
- * or equal to the length of @a str.
- *
- * @param str		String
- * @param start		Index of first character (starting from zero).
- * @param length	Number of characters to copy.
- *
- * @return		Newly allocated string holding the slice.
- */
-char *os_str_aslice(const char *str, size_t start, size_t length)
-{
-	char *slice;
-
-	assert(start + length <= strlen(str));
-	slice = malloc(length + 1);
-	if (slice == NULL) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	strncpy(slice, str + start, length);
-	slice[length] = '\0';
-
-	return slice;
-}
-
-/** Compare two strings.
- *
- * @param a	First string
- * @param b	Second string
- * @return	Zero if equal, nonzero if not equal
- */
-errno_t os_str_cmp(const char *a, const char *b)
-{
-	return strcmp(a, b);
-}
-
-/** Return number of characters in string.
- *
- * @param str	String
- * @return	Number of characters in @a str.
- */
-size_t os_str_length(const char *str)
-{
-	return strlen(str);
-}
-
-/** Duplicate string.
- *
- * @param str	String
- * @return	New string, duplicate of @a str.
- */
-char *os_str_dup(const char *str)
-{
-	return strdup(str);
-}
-
-/** Get character from string at the given index.
- *
- * @param str		String
- * @param index		Character index (starting from zero).
- * @param out_char	Place to store character.
- * @return		EOK on success, EINVAL if index is out of bounds,
- *			EIO on decoding error.
- */
-errno_t os_str_get_char(const char *str, int index, int *out_char)
-{
-	size_t len;
-
-	len = strlen(str);
-	if (index < 0 || (size_t) index >= len)
-		return EINVAL;
-
-	*out_char = str[index];
-	return EOK;
-}
-
-/** Convert character to new string.
- *
- * @param chr		Character
- * @return		Newly allocated string.
- */
-char *os_chr_to_astr(char32_t chr)
-{
-	char *str;
-
-	str = malloc(2);
-	if (str == NULL) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	str[0] = (char) chr;
-	str[1] = '\0';
-
-	return str;
-}
-
-#define OS_INPUT_BUFFER_SIZE 256
-static char os_input_buffer[OS_INPUT_BUFFER_SIZE];
-
-/** Display survival help message. */
-void os_input_disp_help(void)
-{
-	printf("Send ^C (SIGINT) to quit.\n");
-}
-
-/** Read one line of input from the user.
- *
- * @param ptr	Place to store pointer to new string.
- */
-errno_t os_input_line(const char *prompt, char **ptr)
-{
-	printf("%s", prompt);
-
-	if (fgets(os_input_buffer, OS_INPUT_BUFFER_SIZE, stdin) == NULL)
-		os_input_buffer[0] = '\0';
-
-	if (ferror(stdin)) {
-		*ptr = NULL;
-		return EIO;
-	}
-
-	*ptr = strdup(os_input_buffer);
-	return EOK;
-}
-
-/** Simple command execution.
- *
- * @param cmd	Command and arguments (NULL-terminated list of strings.)
- *		Command is present just one, not duplicated.
- */
-errno_t os_exec(char *const cmd[])
-{
-	pid_t pid;
-	int status;
-
-	pid = vfork();
-
-	if (pid == 0) {
-		execvp(cmd[0], cmd);
-		/* If we get here, exec failed. */
-		exit(1);
-	} else if (pid == -1) {
-		/* fork() failed */
-		return EBUSY;
-	}
-
-	if (waitpid(pid, &status, 0) == -1) {
-		/* waitpid() failed */
-		printf("Error: Waitpid failed.\n");
-		exit(1);
-	}
-
-	if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
-		printf("Error: Exec failed or child returned non-zero "
-		    "exit status.\n");
-	}
-
-	return EOK;
-}
-
-/** Store the executable file path via which we were executed.
- *
- * @param path	Executable path via which we were executed.
- */
-void os_store_ef_path(char *path)
-{
-	ef_path = path;
-}
-
-/** Return path to the Sysel library
- *
- * @return New string. Caller should deallocate it using @c free().
- */
-char *os_get_lib_path(void)
-{
-	return os_str_acat(dirname(ef_path), "/lib");
-}
Index: pace/app/sbi/src/p_expr.c
===================================================================
--- uspace/app/sbi/src/p_expr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,898 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Parse arithmetic expressions. */
-
-#include <assert.h>
-#include <stdlib.h>
-#include "bigint.h"
-#include "cspan.h"
-#include "debug.h"
-#include "lex.h"
-#include "list.h"
-#include "mytypes.h"
-#include "p_type.h"
-#include "parse.h"
-#include "stree.h"
-
-#include "p_expr.h"
-
-static stree_expr_t *parse_assign(parse_t *parse);
-static stree_expr_t *parse_disjunctive(parse_t *parse);
-static stree_expr_t *parse_conjunctive(parse_t *parse);
-static stree_expr_t *parse_comparative(parse_t *parse);
-static stree_expr_t *parse_additive(parse_t *parse);
-static stree_expr_t *parse_multip(parse_t *parse);
-static stree_expr_t *parse_prefix(parse_t *parse);
-static stree_expr_t *parse_prefix_new(parse_t *parse);
-static stree_expr_t *parse_postfix(parse_t *parse);
-static stree_expr_t *parse_pf_access(parse_t *parse, stree_expr_t *a);
-static stree_expr_t *parse_pf_call(parse_t *parse, stree_expr_t *a);
-static stree_expr_t *parse_pf_index(parse_t *parse, stree_expr_t *a);
-static stree_expr_t *parse_pf_as(parse_t *parse, stree_expr_t *a);
-static stree_expr_t *parse_paren(parse_t *parse);
-static stree_expr_t *parse_primitive(parse_t *parse);
-static stree_expr_t *parse_nameref(parse_t *parse);
-static stree_expr_t *parse_lit_bool(parse_t *parse);
-static stree_expr_t *parse_lit_char(parse_t *parse);
-static stree_expr_t *parse_lit_int(parse_t *parse);
-static stree_expr_t *parse_lit_ref(parse_t *parse);
-static stree_expr_t *parse_lit_string(parse_t *parse);
-static stree_expr_t *parse_self_ref(parse_t *parse);
-
-static stree_expr_t *parse_recovery_expr(parse_t *parse);
-
-/** Parse expression.
- *
- * Input is read from the input object associated with @a parse. If any
- * error occurs, parse->error will @c b_true when this function
- * returns. parse->error_bailout will be @c b_true if the error has not
- * been recovered yet. Similar holds for other parsing functions in this
- * module.
- *
- * @param parse		Parser object.
- */
-stree_expr_t *parse_expr(parse_t *parse)
-{
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse expression.\n");
-#endif
-	if (parse_is_error(parse))
-		return parse_recovery_expr(parse);
-
-	return parse_assign(parse);
-}
-
-/** Parse assignment expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_assign(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_assign_t *assign;
-
-	a = parse_disjunctive(parse);
-
-	switch (lcur_lc(parse)) {
-	case lc_assign:
-		assign = stree_assign_new(ac_set);
-		break;
-	case lc_increase:
-		assign = stree_assign_new(ac_increase);
-		break;
-	default:
-		return a;
-	}
-
-	lskip(parse);
-	b = parse_disjunctive(parse);
-
-	assign->dest = a;
-	assign->src = b;
-
-	tmp = stree_expr_new(ec_assign);
-	tmp->u.assign = assign;
-	tmp->cspan = cspan_merge(a->cspan, b->cspan);
-
-	assign->expr = tmp;
-
-	return tmp;
-}
-
-/** Parse disjunctive expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_disjunctive(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_binop_t *binop;
-	cspan_t *cs;
-
-	a = parse_conjunctive(parse);
-	cs = a->cspan;
-
-	while (lcur_lc(parse) == lc_or) {
-		if (parse_is_error(parse))
-			break;
-
-		lskip(parse);
-		b = parse_conjunctive(parse);
-
-		binop = stree_binop_new(bo_or);
-		binop->arg1 = a;
-		binop->arg2 = b;
-
-		tmp = stree_expr_new(ec_binop);
-		tmp->u.binop = binop;
-		tmp->cspan = cspan_merge(cs, b->cspan);
-		binop->expr = tmp;
-
-		a = tmp;
-		cs = tmp->cspan;
-	}
-
-	return a;
-}
-
-/** Parse conjunctive expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_conjunctive(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_binop_t *binop;
-	cspan_t *cs;
-
-	a = parse_comparative(parse);
-	cs = a->cspan;
-
-	while (lcur_lc(parse) == lc_and) {
-		if (parse_is_error(parse))
-			break;
-
-		lskip(parse);
-		b = parse_comparative(parse);
-
-		binop = stree_binop_new(bo_and);
-		binop->arg1 = a;
-		binop->arg2 = b;
-
-		tmp = stree_expr_new(ec_binop);
-		tmp->u.binop = binop;
-		tmp->cspan = cspan_merge(cs, b->cspan);
-		binop->expr = tmp;
-
-		a = tmp;
-		cs = tmp->cspan;
-	}
-
-	return a;
-}
-
-/** Parse comparative expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_comparative(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_binop_t *binop;
-	binop_class_t bc;
-	cspan_t *cs;
-
-	a = parse_additive(parse);
-	cs = a->cspan;
-
-	while (lcur_lc(parse) == lc_equal || lcur_lc(parse) == lc_notequal ||
-	    lcur_lc(parse) == lc_lt || lcur_lc(parse) == lc_gt ||
-	    lcur_lc(parse) == lc_lt_equal || lcur_lc(parse) == lc_gt_equal) {
-
-		if (parse_is_error(parse))
-			break;
-
-		switch (lcur_lc(parse)) {
-		case lc_equal:
-			bc = bo_equal;
-			break;
-		case lc_notequal:
-			bc = bo_notequal;
-			break;
-		case lc_lt:
-			bc = bo_lt;
-			break;
-		case lc_gt:
-			bc = bo_gt;
-			break;
-		case lc_lt_equal:
-			bc = bo_lt_equal;
-			break;
-		case lc_gt_equal:
-			bc = bo_gt_equal;
-			break;
-		default:
-			assert(b_false);
-		}
-
-		lskip(parse);
-		b = parse_additive(parse);
-
-		binop = stree_binop_new(bc);
-		binop->arg1 = a;
-		binop->arg2 = b;
-
-		tmp = stree_expr_new(ec_binop);
-		tmp->u.binop = binop;
-		tmp->cspan = cspan_merge(cs, b->cspan);
-		binop->expr = tmp;
-
-		a = tmp;
-		cs = tmp->cspan;
-	}
-
-	return a;
-}
-
-/** Parse additive expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_additive(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_binop_t *binop;
-	binop_class_t bc;
-	cspan_t *cs;
-
-	a = parse_multip(parse);
-	cs = a->cspan;
-
-	while (lcur_lc(parse) == lc_plus || lcur_lc(parse) == lc_minus) {
-		if (parse_is_error(parse))
-			break;
-
-		switch (lcur_lc(parse)) {
-		case lc_plus:
-			bc = bo_plus;
-			break;
-		case lc_minus:
-			bc = bo_minus;
-			break;
-		default:
-			assert(b_false);
-		}
-
-		lskip(parse);
-		b = parse_multip(parse);
-
-		binop = stree_binop_new(bc);
-		binop->arg1 = a;
-		binop->arg2 = b;
-
-		tmp = stree_expr_new(ec_binop);
-		tmp->u.binop = binop;
-		tmp->cspan = cspan_merge(cs, b->cspan);
-		binop->expr = tmp;
-
-		a = tmp;
-		cs = tmp->cspan;
-	}
-
-	return a;
-}
-
-/** Parse multiplicative expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_multip(parse_t *parse)
-{
-	stree_expr_t *a, *b, *tmp;
-	stree_binop_t *binop;
-	binop_class_t bc;
-	cspan_t *cs;
-
-	a = parse_prefix(parse);
-	cs = a->cspan;
-
-	while (lcur_lc(parse) == lc_mult) {
-		if (parse_is_error(parse))
-			break;
-
-		switch (lcur_lc(parse)) {
-		case lc_mult:
-			bc = bo_mult;
-			break;
-		default:
-			assert(b_false);
-		}
-
-		lskip(parse);
-		b = parse_prefix(parse);
-
-		binop = stree_binop_new(bc);
-		binop->arg1 = a;
-		binop->arg2 = b;
-
-		tmp = stree_expr_new(ec_binop);
-		tmp->u.binop = binop;
-		tmp->cspan = cspan_merge(cs, b->cspan);
-		binop->expr = tmp;
-
-		a = tmp;
-		cs = tmp->cspan;
-	}
-
-	return a;
-}
-
-/** Parse prefix expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_prefix(parse_t *parse)
-{
-	stree_expr_t *a;
-	stree_expr_t *tmp;
-	stree_unop_t *unop;
-	unop_class_t uc;
-	cspan_t *cs0;
-
-	switch (lcur_lc(parse)) {
-	case lc_plus:
-	case lc_minus:
-	case lc_not:
-		if (parse_is_error(parse))
-			return parse_recovery_expr(parse);
-
-		switch (lcur_lc(parse)) {
-		case lc_plus:
-			uc = uo_plus;
-			break;
-		case lc_minus:
-			uc = uo_minus;
-			break;
-		case lc_not:
-			uc = uo_not;
-			break;
-		default:
-			assert(b_false);
-		}
-
-		cs0 = lcur_span(parse);
-		lskip(parse);
-		a = parse_postfix(parse);
-
-		unop = stree_unop_new(uc);
-		unop->arg = a;
-
-		tmp = stree_expr_new(ec_unop);
-		tmp->u.unop = unop;
-		tmp->cspan = cspan_merge(cs0, a->cspan);
-		unop->expr = tmp;
-		a = tmp;
-		break;
-	case lc_new:
-		a = parse_prefix_new(parse);
-		break;
-	default:
-		a = parse_postfix(parse);
-		break;
-	}
-
-	return a;
-}
-
-/** Parse @c new operator.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_prefix_new(parse_t *parse)
-{
-	stree_texpr_t *texpr;
-	stree_new_t *new_op;
-	stree_expr_t *expr;
-	stree_expr_t *arg;
-	cspan_t *cs0, *cs1;
-
-	cs0 = lcur_span(parse);
-	lmatch(parse, lc_new);
-	texpr = parse_texpr(parse);
-
-	/* XXX Take span from texpr */
-	cs1 = lprev_span(parse);
-
-	new_op = stree_new_new();
-	new_op->texpr = texpr;
-	expr = stree_expr_new(ec_new);
-	expr->u.new_op = new_op;
-
-	list_init(&new_op->ctor_args);
-
-	/* Parenthesized arguments should be present except for arrays. */
-	if (texpr->tc != tc_tindex) {
-		lmatch(parse, lc_lparen);
-
-		/* Parse constructor arguments */
-
-		if (lcur_lc(parse) != lc_rparen) {
-			while (!parse_is_error(parse)) {
-				arg = parse_expr(parse);
-				list_append(&new_op->ctor_args, arg);
-
-				if (lcur_lc(parse) == lc_rparen)
-					break;
-				lmatch(parse, lc_comma);
-			}
-		}
-
-		lmatch(parse, lc_rparen);
-		cs1 = cspan_merge(cs0, lprev_span(parse));
-	}
-
-	expr->cspan = cspan_merge(cs0, cs1);
-	new_op->expr = expr;
-
-	return expr;
-}
-
-/** Parse postfix expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_postfix(parse_t *parse)
-{
-	stree_expr_t *a;
-	stree_expr_t *tmp;
-
-	a = parse_paren(parse);
-
-	while (lcur_lc(parse) == lc_period || lcur_lc(parse) == lc_lparen ||
-	    lcur_lc(parse) == lc_lsbr || lcur_lc(parse) == lc_as) {
-
-		if (parse_is_error(parse))
-			break;
-
-		switch (lcur_lc(parse)) {
-		case lc_period:
-			tmp = parse_pf_access(parse, a);
-			break;
-		case lc_lparen:
-			tmp = parse_pf_call(parse, a);
-			break;
-		case lc_lsbr:
-			tmp = parse_pf_index(parse, a);
-			break;
-		case lc_as:
-			tmp = parse_pf_as(parse, a);
-			break;
-		default:
-			assert(b_false);
-		}
-
-		a = tmp;
-	}
-
-	return a;
-}
-
-/** Parse member access expression
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_pf_access(parse_t *parse, stree_expr_t *a)
-{
-	stree_ident_t *ident;
-	stree_expr_t *expr;
-	stree_access_t *access;
-	cspan_t *cs1;
-
-	lmatch(parse, lc_period);
-	ident = parse_ident(parse);
-
-	/* XXX Take span from ident */
-	cs1 = lprev_span(parse);
-
-	access = stree_access_new();
-	access->arg = a;
-	access->member_name = ident;
-
-	expr = stree_expr_new(ec_access);
-	expr->u.access = access;
-	expr->cspan = cspan_merge(a->cspan, cs1);
-
-	access->expr = expr;
-
-	return expr;
-}
-
-/** Parse function call expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_pf_call(parse_t *parse, stree_expr_t *a)
-{
-	stree_expr_t *expr;
-	stree_call_t *call;
-	stree_expr_t *arg;
-	cspan_t *cs1;
-
-	lmatch(parse, lc_lparen);
-
-	call = stree_call_new();
-	call->fun = a;
-	list_init(&call->args);
-
-	/* Parse function arguments */
-
-	if (lcur_lc(parse) != lc_rparen) {
-		while (!parse_is_error(parse)) {
-			arg = parse_expr(parse);
-			list_append(&call->args, arg);
-
-			if (lcur_lc(parse) == lc_rparen)
-				break;
-			lmatch(parse, lc_comma);
-		}
-	}
-
-	lmatch(parse, lc_rparen);
-	cs1 = lprev_span(parse);
-
-	expr = stree_expr_new(ec_call);
-	expr->u.call = call;
-	expr->cspan = cspan_merge(a->cspan, cs1);
-	call->expr = expr;
-
-	return expr;
-}
-
-/** Parse index expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_pf_index(parse_t *parse, stree_expr_t *a)
-{
-	stree_expr_t *expr;
-	stree_index_t *index;
-	stree_expr_t *arg;
-	cspan_t *cs1;
-
-	lmatch(parse, lc_lsbr);
-
-	index = stree_index_new();
-	index->base = a;
-	list_init(&index->args);
-
-	/* Parse indices */
-
-	if (lcur_lc(parse) != lc_rsbr) {
-		while (!parse_is_error(parse)) {
-			arg = parse_expr(parse);
-			list_append(&index->args, arg);
-
-			if (lcur_lc(parse) == lc_rsbr)
-				break;
-			lmatch(parse, lc_comma);
-		}
-	}
-
-	lmatch(parse, lc_rsbr);
-	cs1 = lprev_span(parse);
-
-	expr = stree_expr_new(ec_index);
-	expr->u.index = index;
-	expr->cspan = cspan_merge(a->cspan, cs1);
-	index->expr = expr;
-
-	return expr;
-}
-
-/** Parse @c as operator.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_pf_as(parse_t *parse, stree_expr_t *a)
-{
-	stree_expr_t *expr;
-	stree_texpr_t *texpr;
-	stree_as_t *as_op;
-	cspan_t *cs1;
-
-	lmatch(parse, lc_as);
-	texpr = parse_texpr(parse);
-
-	/* XXX Take span from texpr */
-	cs1 = lprev_span(parse);
-
-	as_op = stree_as_new();
-	as_op->arg = a;
-	as_op->dtype = texpr;
-
-	expr = stree_expr_new(ec_as);
-	expr->u.as_op = as_op;
-	expr->cspan = cspan_merge(a->cspan, cs1);
-
-	as_op->expr = expr;
-
-	return expr;
-}
-
-/** Parse possibly partenthesized expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_paren(parse_t *parse)
-{
-	stree_expr_t *expr;
-	cspan_t *cs0, *cs1;
-
-	if (lcur_lc(parse) == lc_lparen) {
-		cs0 = lcur_span(parse);
-		lskip(parse);
-		expr = parse_expr(parse);
-		lmatch(parse, lc_rparen);
-		cs1 = lprev_span(parse);
-
-		expr->cspan = cspan_merge(cs0, cs1);
-	} else {
-		expr = parse_primitive(parse);
-	}
-
-	return expr;
-}
-
-/** Parse primitive expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_primitive(parse_t *parse)
-{
-	stree_expr_t *expr;
-
-	switch (lcur_lc(parse)) {
-	case lc_ident:
-		expr = parse_nameref(parse);
-		break;
-	case lc_false:
-	case lc_true:
-		expr = parse_lit_bool(parse);
-		break;
-	case lc_lit_char:
-		expr = parse_lit_char(parse);
-		break;
-	case lc_lit_int:
-		expr = parse_lit_int(parse);
-		break;
-	case lc_nil:
-		expr = parse_lit_ref(parse);
-		break;
-	case lc_lit_string:
-		expr = parse_lit_string(parse);
-		break;
-	case lc_self:
-		expr = parse_self_ref(parse);
-		break;
-	default:
-		lunexpected_error(parse);
-		expr = parse_recovery_expr(parse);
-	}
-
-	return expr;
-}
-
-/** Parse name reference.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_nameref(parse_t *parse)
-{
-	stree_nameref_t *nameref;
-	stree_expr_t *expr;
-
-	nameref = stree_nameref_new();
-	nameref->name = parse_ident(parse);
-	expr = stree_expr_new(ec_nameref);
-	expr->u.nameref = nameref;
-	expr->cspan = lprev_span(parse);
-	nameref->expr = expr;
-
-	return expr;
-}
-
-/** Parse boolean literal.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_lit_bool(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-	bool_t value;
-
-	switch (lcur_lc(parse)) {
-	case lc_false:
-		value = b_false;
-		break;
-	case lc_true:
-		value = b_true;
-		break;
-	default:
-		assert(b_false);
-	}
-
-	lskip(parse);
-
-	literal = stree_literal_new(ltc_bool);
-	literal->u.lit_bool.value = value;
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	expr->cspan = lprev_span(parse);
-	literal->expr = expr;
-
-	return expr;
-}
-
-/** Parse character literal.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_lit_char(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-
-	lcheck(parse, lc_lit_char);
-
-	literal = stree_literal_new(ltc_char);
-	bigint_clone(&lcur(parse)->u.lit_char.value,
-	    &literal->u.lit_char.value);
-
-	lskip(parse);
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	expr->cspan = lprev_span(parse);
-	literal->expr = expr;
-
-	return expr;
-}
-
-/** Parse integer literal.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_lit_int(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-
-	lcheck(parse, lc_lit_int);
-
-	literal = stree_literal_new(ltc_int);
-	bigint_clone(&lcur(parse)->u.lit_int.value,
-	    &literal->u.lit_int.value);
-
-	lskip(parse);
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	expr->cspan = lprev_span(parse);
-	literal->expr = expr;
-
-	return expr;
-}
-
-/** Parse reference literal (@c nil).
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_lit_ref(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-
-	lmatch(parse, lc_nil);
-
-	literal = stree_literal_new(ltc_ref);
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	expr->cspan = lprev_span(parse);
-	literal->expr = expr;
-
-	return expr;
-}
-
-/** Parse string literal.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_lit_string(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-
-	lcheck(parse, lc_lit_string);
-
-	literal = stree_literal_new(ltc_string);
-	literal->u.lit_string.value = lcur(parse)->u.lit_string.value;
-
-	lskip(parse);
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	expr->cspan = lprev_span(parse);
-	literal->expr = expr;
-
-	return expr;
-}
-
-/** Parse @c self keyword.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_self_ref(parse_t *parse)
-{
-	stree_self_ref_t *self_ref;
-	stree_expr_t *expr;
-
-	lmatch(parse, lc_self);
-
-	self_ref = stree_self_ref_new();
-
-	expr = stree_expr_new(ec_self_ref);
-	expr->u.self_ref = self_ref;
-	expr->cspan = lprev_span(parse);
-	self_ref->expr = expr;
-
-	return expr;
-}
-
-/** Construct a special recovery expression.
- *
- * @param parse		Parser object.
- */
-static stree_expr_t *parse_recovery_expr(parse_t *parse)
-{
-	stree_literal_t *literal;
-	stree_expr_t *expr;
-
-	(void) parse;
-
-	literal = stree_literal_new(ltc_ref);
-
-	expr = stree_expr_new(ec_literal);
-	expr->u.literal = literal;
-	literal->expr = expr;
-
-	return expr;
-}
Index: pace/app/sbi/src/p_expr.h
===================================================================
--- uspace/app/sbi/src/p_expr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef P_EXPR_H_
-#define P_EXPR_H_
-
-#include "mytypes.h"
-
-stree_expr_t *parse_expr(parse_t *parse);
-
-#endif
Index: pace/app/sbi/src/p_type.c
===================================================================
--- uspace/app/sbi/src/p_type.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,365 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Parse arithmetic expressions. */
-
-#include <assert.h>
-#include <stdlib.h>
-#include "cspan.h"
-#include "debug.h"
-#include "lex.h"
-#include "list.h"
-#include "mytypes.h"
-#include "parse.h"
-#include "p_expr.h"
-#include "stree.h"
-
-#include "p_type.h"
-
-static stree_texpr_t *parse_tapply(parse_t *parse);
-static stree_texpr_t *parse_tpostfix(parse_t *parse);
-static stree_texpr_t *parse_pf_taccess(parse_t *parse, stree_texpr_t *a);
-static stree_texpr_t *parse_pf_tindex(parse_t *parse, stree_texpr_t *a);
-static stree_texpr_t *parse_tparen(parse_t *parse);
-static stree_texpr_t *parse_tprimitive(parse_t *parse);
-static stree_texpr_t *parse_tliteral(parse_t *parse);
-static stree_texpr_t *parse_tnameref(parse_t *parse);
-
-static stree_texpr_t *parse_recovery_texpr(parse_t *parse);
-
-/** Parse type expression.
- *
- * Input is read from the input object associated with @a parse. If any
- * error occurs, parse->error will @c b_true when this function
- * returns. parse->error_bailout will be @c b_true if the error has not
- * been recovered yet. Similar holds for other parsing functions in this
- * module.
- *
- * @param parse		Parser object.
- */
-stree_texpr_t *parse_texpr(parse_t *parse)
-{
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse type expression.\n");
-#endif
-	if (parse_is_error(parse))
-		return parse_recovery_texpr(parse);
-
-	return parse_tapply(parse);
-}
-
-/** Parse type application expression.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tapply(parse_t *parse)
-{
-	stree_texpr_t *gtype;
-	stree_texpr_t *aexpr;
-	stree_texpr_t *targ;
-	stree_tapply_t *tapply;
-
-	gtype = parse_tpostfix(parse);
-	if (lcur_lc(parse) != lc_slash)
-		return gtype;
-
-	tapply = stree_tapply_new();
-	tapply->gtype = gtype;
-	list_init(&tapply->targs);
-
-	targ = NULL;
-
-	while (lcur_lc(parse) == lc_slash) {
-
-		if (parse_is_error(parse))
-			break;
-
-		lskip(parse);
-		targ = parse_tpostfix(parse);
-
-		list_append(&tapply->targs, targ);
-	}
-
-	aexpr = stree_texpr_new(tc_tapply);
-	aexpr->u.tapply = tapply;
-	tapply->texpr = aexpr;
-
-	if (targ != NULL)
-		aexpr->cspan = cspan_merge(gtype->cspan, targ->cspan);
-	else
-		aexpr->cspan = gtype->cspan;
-
-	return aexpr;
-}
-
-/** Parse postfix type expression.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tpostfix(parse_t *parse)
-{
-	stree_texpr_t *a;
-	stree_texpr_t *tmp;
-
-	a = parse_tparen(parse);
-
-	while (lcur_lc(parse) == lc_period || lcur_lc(parse) == lc_lsbr) {
-
-		if (parse_is_error(parse))
-			break;
-
-		switch (lcur_lc(parse)) {
-		case lc_period:
-			tmp = parse_pf_taccess(parse, a);
-			break;
-		case lc_lsbr:
-			tmp = parse_pf_tindex(parse, a);
-			break;
-		default:
-			lunexpected_error(parse);
-			tmp = parse_recovery_texpr(parse);
-			break;
-		}
-
-		a = tmp;
-	}
-
-	return a;
-}
-
-/** Parse access type expression.
- *
- * @param parse		Parser object.
- * @param a		Base expression.
- */
-static stree_texpr_t *parse_pf_taccess(parse_t *parse, stree_texpr_t *a)
-{
-	stree_texpr_t *texpr;
-	stree_ident_t *ident;
-	stree_taccess_t *taccess;
-
-	lmatch(parse, lc_period);
-	ident = parse_ident(parse);
-
-	taccess = stree_taccess_new();
-	taccess->arg = a;
-	taccess->member_name = ident;
-
-	texpr = stree_texpr_new(tc_taccess);
-	texpr->u.taccess = taccess;
-	taccess->texpr = texpr;
-	texpr->cspan = cspan_merge(a->cspan, ident->cspan);
-
-	return texpr;
-}
-
-/** Parse index type expression.
- *
- * @param parse		Parser object.
- * @param a		Base expression.
- */
-static stree_texpr_t *parse_pf_tindex(parse_t *parse, stree_texpr_t *a)
-{
-	stree_texpr_t *texpr;
-	stree_tindex_t *tindex;
-	stree_expr_t *expr;
-	cspan_t *cs1;
-
-	tindex = stree_tindex_new();
-	tindex->base_type = a;
-
-	tindex->n_args = 0;
-	list_init(&tindex->args);
-
-	lmatch(parse, lc_lsbr);
-
-	if (lcur_lc(parse) != lc_rsbr && lcur_lc(parse) != lc_comma) {
-		while (b_true) {
-			if (parse_is_error(parse))
-				break;
-			expr = parse_expr(parse);
-			tindex->n_args += 1;
-			list_append(&tindex->args, expr);
-
-			if (lcur_lc(parse) == lc_rsbr)
-				break;
-
-			lmatch(parse, lc_comma);
-		}
-	} else {
-		tindex->n_args = 1;
-		while (lcur_lc(parse) == lc_comma) {
-			if (parse_is_error(parse))
-				break;
-			lskip(parse);
-			tindex->n_args += 1;
-		}
-	}
-
-	lmatch(parse, lc_rsbr);
-	cs1 = lprev_span(parse);
-
-	texpr = stree_texpr_new(tc_tindex);
-	texpr->u.tindex = tindex;
-	tindex->texpr = texpr;
-	texpr->cspan = cspan_merge(a->cspan, cs1);
-
-	return texpr;
-}
-
-/** Parse possibly partenthesized type expression.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tparen(parse_t *parse)
-{
-	stree_texpr_t *texpr;
-	cspan_t *cs0, *cs1;
-
-	if (lcur_lc(parse) == lc_lparen) {
-		cs0 = lcur_span(parse);
-		lskip(parse);
-		texpr = parse_texpr(parse);
-		lmatch(parse, lc_rparen);
-		cs1 = lprev_span(parse);
-		texpr->cspan = cspan_merge(cs0, cs1);
-	} else {
-		texpr = parse_tprimitive(parse);
-	}
-
-	return texpr;
-}
-
-/** Parse primitive type expression.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tprimitive(parse_t *parse)
-{
-	stree_texpr_t *texpr;
-
-	switch (lcur_lc(parse)) {
-	case lc_ident:
-		texpr = parse_tnameref(parse);
-		break;
-	case lc_bool:
-	case lc_char:
-	case lc_int:
-	case lc_string:
-	case lc_resource:
-		texpr = parse_tliteral(parse);
-		break;
-	default:
-		lunexpected_error(parse);
-		texpr = parse_recovery_texpr(parse);
-		break;
-	}
-
-	return texpr;
-}
-
-/** Parse type literal.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tliteral(parse_t *parse)
-{
-	stree_tliteral_t *tliteral;
-	tliteral_class_t tlc;
-	stree_texpr_t *texpr;
-
-	switch (lcur_lc(parse)) {
-	case lc_bool:
-		tlc = tlc_bool;
-		break;
-	case lc_char:
-		tlc = tlc_char;
-		break;
-	case lc_int:
-		tlc = tlc_int;
-		break;
-	case lc_string:
-		tlc = tlc_string;
-		break;
-	case lc_resource:
-		tlc = tlc_resource;
-		break;
-	default:
-		assert(b_false);
-	}
-
-	lskip(parse);
-
-	tliteral = stree_tliteral_new(tlc);
-	texpr = stree_texpr_new(tc_tliteral);
-	texpr->u.tliteral = tliteral;
-	tliteral->texpr = texpr;
-	texpr->cspan = lprev_span(parse);
-
-	return texpr;
-}
-
-/** Parse type identifier.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_tnameref(parse_t *parse)
-{
-	stree_tnameref_t *tnameref;
-	stree_texpr_t *texpr;
-
-	tnameref = stree_tnameref_new();
-	tnameref->name = parse_ident(parse);
-
-	texpr = stree_texpr_new(tc_tnameref);
-	texpr->u.tnameref = tnameref;
-	tnameref->texpr = texpr;
-	texpr->cspan = tnameref->name->cspan;
-
-	return texpr;
-}
-
-/** Construct a special type expression fore recovery.
- *
- * @param parse		Parser object.
- */
-static stree_texpr_t *parse_recovery_texpr(parse_t *parse)
-{
-	stree_tliteral_t *tliteral;
-	stree_texpr_t *texpr;
-
-	(void) parse;
-
-	tliteral = stree_tliteral_new(tlc_int);
-
-	texpr = stree_texpr_new(tc_tliteral);
-	texpr->u.tliteral = tliteral;
-	tliteral->texpr = texpr;
-
-	return texpr;
-}
Index: pace/app/sbi/src/p_type.h
===================================================================
--- uspace/app/sbi/src/p_type.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef P_TYPE_H_
-#define P_TYPE_H_
-
-#include "mytypes.h"
-
-stree_texpr_t *parse_texpr(parse_t *parse);
-
-#endif
Index: pace/app/sbi/src/parse.c
===================================================================
--- uspace/app/sbi/src/parse.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1730 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Parser
- *
- * Consumes a sequence of lexical elements and produces a syntax tree (stree).
- * Parsing primitives, module members, statements.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include "cspan.h"
-#include "debug.h"
-#include "lex.h"
-#include "list.h"
-#include "mytypes.h"
-#include "p_expr.h"
-#include "p_type.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-
-#include "parse.h"
-
-/*
- * Module and CSI members
- */
-static stree_csi_t *parse_csi(parse_t *parse, lclass_t dclass,
-    stree_csi_t *outer_csi);
-static stree_csimbr_t *parse_csimbr(parse_t *parse, stree_csi_t *outer_csi);
-
-static stree_ctor_t *parse_ctor(parse_t *parse, stree_csi_t *outer_csi);
-
-static stree_enum_t *parse_enum(parse_t *parse, stree_csi_t *outer_csi);
-static stree_embr_t *parse_embr(parse_t *parse, stree_enum_t *outer_enum);
-
-static stree_deleg_t *parse_deleg(parse_t *parse, stree_csi_t *outer_csi);
-static stree_fun_t *parse_fun(parse_t *parse, stree_csi_t *outer_csi);
-static stree_var_t *parse_var(parse_t *parse, stree_csi_t *outer_csi);
-static stree_prop_t *parse_prop(parse_t *parse, stree_csi_t *outer_csi);
-
-static void parse_symbol_attrs(parse_t *parse, stree_symbol_t *symbol);
-static stree_symbol_attr_t *parse_symbol_attr(parse_t *parse);
-
-static stree_proc_arg_t *parse_proc_arg(parse_t *parse);
-static stree_arg_attr_t *parse_arg_attr(parse_t *parse);
-static stree_fun_sig_t *parse_fun_sig(parse_t *parse);
-
-static void parse_prop_get(parse_t *parse, stree_prop_t *prop);
-static void parse_prop_set(parse_t *parse, stree_prop_t *prop);
-
-/*
- * Statements
- */
-static stree_block_t *parse_block(parse_t *parse);
-
-static stree_vdecl_t *parse_vdecl(parse_t *parse);
-static stree_if_t *parse_if(parse_t *parse);
-static stree_switch_t *parse_switch(parse_t *parse);
-static stree_while_t *parse_while(parse_t *parse);
-static stree_for_t *parse_for(parse_t *parse);
-static stree_raise_t *parse_raise(parse_t *parse);
-static stree_break_t *parse_break(parse_t *parse);
-static stree_return_t *parse_return(parse_t *parse);
-static stree_wef_t *parse_wef(parse_t *parse);
-static stree_exps_t *parse_exps(parse_t *parse);
-
-static stree_except_t *parse_except(parse_t *parse);
-
-/** Initialize parser object.
- *
- * Set up parser @a parse to use lexer @a lex for input and to store
- * output (i.e. new declarations) to program @a prog. @a prog is not
- * necessarily empty, the declarations being parsed are simply added
- * to it.
- *
- * @param parse		Parser object.
- * @param prog		Destination program stree.
- * @param lex		Input lexer.
- */
-void parse_init(parse_t *parse, stree_program_t *prog, struct lex *lex)
-{
-	parse->program = prog;
-	parse->cur_mod = parse->program->module;
-	parse->lex = lex;
-
-	parse->error = b_false;
-	parse->error_bailout = b_false;
-
-	lex_next(parse->lex);
-}
-
-/** Parse module.
- *
- * Parse a program module.
- *
- * The input is read using the lexer associated with @a parse. The resulting
- * declarations are added to existing declarations in the program associated
- * with @a parse.
- *
- * If any parse error occurs, parse->error will @c b_true when this function
- * returns. parse->error_bailout will be @c b_true if the error has not
- * been recovered yet. Similar holds for other parsing functions in this
- * module.
- *
- * @param parse		Parser object.
- */
-void parse_module(parse_t *parse)
-{
-	stree_csi_t *csi;
-	stree_enum_t *enum_d;
-	stree_modm_t *modm;
-
-	while (lcur_lc(parse) != lc_eof && !parse_is_error(parse)) {
-		switch (lcur_lc(parse)) {
-		case lc_class:
-		case lc_struct:
-		case lc_interface:
-			csi = parse_csi(parse, lcur_lc(parse), NULL);
-			modm = stree_modm_new(mc_csi);
-			modm->u.csi = csi;
-
-			list_append(&parse->cur_mod->members, modm);
-			break;
-		case lc_enum:
-			enum_d = parse_enum(parse, NULL);
-			modm = stree_modm_new(mc_enum);
-			modm->u.enum_d = enum_d;
-
-			list_append(&parse->cur_mod->members, modm);
-			break;
-		default:
-			lunexpected_error(parse);
-			lex_next(parse->lex);
-			break;
-		}
-
-	}
-}
-
-/** Parse class, struct or interface declaration.
- *
- * @param parse		Parser object.
- * @param dclass	What to parse: @c lc_class, @c lc_struct or @c lc_csi.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_csi_t *parse_csi(parse_t *parse, lclass_t dclass,
-    stree_csi_t *outer_csi)
-{
-	stree_csi_t *csi;
-	csi_class_t cc;
-	stree_csimbr_t *csimbr;
-	stree_symbol_t *symbol;
-	stree_ident_t *targ_name;
-	stree_targ_t *targ;
-	stree_texpr_t *pref;
-
-	switch (dclass) {
-	case lc_class:
-		cc = csi_class;
-		break;
-	case lc_struct:
-		cc = csi_struct;
-		break;
-	case lc_interface:
-		cc = csi_interface;
-		break;
-	default:
-		assert(b_false);
-	}
-
-	lskip(parse);
-
-	csi = stree_csi_new(cc);
-	csi->name = parse_ident(parse);
-
-	list_init(&csi->targ);
-
-	while (lcur_lc(parse) == lc_slash) {
-		lskip(parse);
-		targ_name = parse_ident(parse);
-
-		targ = stree_targ_new();
-		targ->name = targ_name;
-
-		list_append(&csi->targ, targ);
-	}
-
-	symbol = stree_symbol_new(sc_csi);
-	symbol->u.csi = csi;
-	symbol->outer_csi = outer_csi;
-	csi->symbol = symbol;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("parse_csi: csi=%p, csi->name = %p (%s)\n", csi, csi->name,
-	    strtab_get_str(csi->name->sid));
-#endif
-	if (lcur_lc(parse) == lc_colon) {
-		/* Inheritance list */
-		lskip(parse);
-
-		while (b_true) {
-			pref = parse_texpr(parse);
-			if (parse_is_error(parse))
-				break;
-
-			list_append(&csi->inherit, pref);
-			if (lcur_lc(parse) != lc_plus)
-				break;
-
-			lskip(parse);
-		}
-	}
-
-	lmatch(parse, lc_is);
-	list_init(&csi->members);
-
-	/* Parse class, struct or interface members. */
-	while (lcur_lc(parse) != lc_end && !parse_is_error(parse)) {
-		csimbr = parse_csimbr(parse, csi);
-		if (csimbr == NULL)
-			continue;
-
-		list_append(&csi->members, csimbr);
-	}
-
-	lmatch(parse, lc_end);
-
-	if (outer_csi != NULL) {
-		switch (outer_csi->cc) {
-		case csi_class:
-		case csi_struct:
-			break;
-		case csi_interface:
-			cspan_print(csi->name->cspan);
-			printf(" Error: CSI declared inside interface.\n");
-			parse_note_error(parse);
-			/* XXX Free csi */
-			return NULL;
-		}
-	}
-
-	return csi;
-}
-
-/** Parse class, struct or interface member.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration.
- * @return		New syntax tree node. In case of parse error,
- *			@c NULL may (but need not) be returned.
- */
-static stree_csimbr_t *parse_csimbr(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_csimbr_t *csimbr;
-
-	stree_csi_t *csi;
-	stree_ctor_t *ctor;
-	stree_deleg_t *deleg;
-	stree_enum_t *enum_d;
-	stree_fun_t *fun;
-	stree_var_t *var;
-	stree_prop_t *prop;
-
-	csimbr = NULL;
-
-	switch (lcur_lc(parse)) {
-	case lc_class:
-	case lc_struct:
-	case lc_interface:
-		csi = parse_csi(parse, lcur_lc(parse), outer_csi);
-		if (csi != NULL) {
-			csimbr = stree_csimbr_new(csimbr_csi);
-			csimbr->u.csi = csi;
-		}
-		break;
-	case lc_new:
-		ctor = parse_ctor(parse, outer_csi);
-		if (ctor != NULL) {
-			csimbr = stree_csimbr_new(csimbr_ctor);
-			csimbr->u.ctor = ctor;
-		}
-		break;
-	case lc_deleg:
-		deleg = parse_deleg(parse, outer_csi);
-		if (deleg != NULL) {
-			csimbr = stree_csimbr_new(csimbr_deleg);
-			csimbr->u.deleg = deleg;
-		}
-		break;
-	case lc_enum:
-		enum_d = parse_enum(parse, outer_csi);
-		if (enum_d != NULL) {
-			csimbr = stree_csimbr_new(csimbr_enum);
-			csimbr->u.enum_d = enum_d;
-		}
-		break;
-	case lc_fun:
-		fun = parse_fun(parse, outer_csi);
-		csimbr = stree_csimbr_new(csimbr_fun);
-		csimbr->u.fun = fun;
-		break;
-	case lc_var:
-		var = parse_var(parse, outer_csi);
-		if (var != NULL) {
-			csimbr = stree_csimbr_new(csimbr_var);
-			csimbr->u.var = var;
-		}
-		break;
-	case lc_prop:
-		prop = parse_prop(parse, outer_csi);
-		csimbr = stree_csimbr_new(csimbr_prop);
-		csimbr->u.prop = prop;
-		break;
-	default:
-		lunexpected_error(parse);
-		lex_next(parse->lex);
-		break;
-	}
-
-	return csimbr;
-}
-
-/** Parse constructor.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_ctor_t *parse_ctor(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_ctor_t *ctor;
-	stree_symbol_t *symbol;
-	cspan_t *cspan;
-
-	ctor = stree_ctor_new();
-	symbol = stree_symbol_new(sc_ctor);
-
-	symbol->u.ctor = ctor;
-	symbol->outer_csi = outer_csi;
-	ctor->symbol = symbol;
-
-	lmatch(parse, lc_new);
-	cspan = lprev_span(parse);
-
-	/* Fake identifier. */
-	ctor->name = stree_ident_new();
-	ctor->name->sid = strtab_get_sid(CTOR_IDENT);
-	ctor->name->cspan = lprev_span(parse);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsing constructor of CSI '");
-	symbol_print_fqn(csi_to_symbol(outer_csi));
-	printf("'.\n");
-#endif
-	ctor->sig = parse_fun_sig(parse);
-	if (ctor->sig->rtype != NULL) {
-		cspan_print(cspan);
-		printf(" Error: Constructor of CSI '");
-		symbol_print_fqn(csi_to_symbol(outer_csi));
-		printf("' has a return type.\n");
-		parse_note_error(parse);
-	}
-
-	/* Parse attributes. */
-	parse_symbol_attrs(parse, symbol);
-
-	ctor->proc = stree_proc_new();
-	ctor->proc->outer_symbol = symbol;
-
-	if (lcur_lc(parse) == lc_scolon) {
-		lskip(parse);
-
-		/* This constructor has no body. */
-		cspan_print(cspan);
-		printf(" Error: Constructor of CSI '");
-		symbol_print_fqn(csi_to_symbol(outer_csi));
-		printf("' has no body.\n");
-		parse_note_error(parse);
-
-		ctor->proc->body = NULL;
-	} else {
-		lmatch(parse, lc_is);
-		ctor->proc->body = parse_block(parse);
-		lmatch(parse, lc_end);
-	}
-
-	switch (outer_csi->cc) {
-	case csi_class:
-	case csi_struct:
-		break;
-	case csi_interface:
-		cspan_print(ctor->name->cspan);
-		printf(" Error: Constructor declared inside interface.\n");
-		parse_note_error(parse);
-		/* XXX Free ctor */
-		return NULL;
-	}
-
-	return ctor;
-}
-
-/** Parse @c enum declaration.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_enum_t *parse_enum(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_enum_t *enum_d;
-	stree_symbol_t *symbol;
-	stree_embr_t *embr;
-
-	enum_d = stree_enum_new();
-	symbol = stree_symbol_new(sc_enum);
-
-	symbol->u.enum_d = enum_d;
-	symbol->outer_csi = outer_csi;
-	enum_d->symbol = symbol;
-
-	lmatch(parse, lc_enum);
-	enum_d->name = parse_ident(parse);
-	list_init(&enum_d->members);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse enum '%s'.\n", strtab_get_str(enum_d->name->sid));
-#endif
-	lmatch(parse, lc_is);
-
-	/* Parse enum members. */
-	while (lcur_lc(parse) != lc_end && !parse_is_error(parse)) {
-		embr = parse_embr(parse, enum_d);
-		if (embr == NULL)
-			break;
-
-		list_append(&enum_d->members, embr);
-	}
-
-	if (list_is_empty(&enum_d->members)) {
-		cspan_print(enum_d->name->cspan);
-		printf("Error: Enum type '%s' has no members.\n",
-		    strtab_get_str(enum_d->name->sid));
-		parse_note_error(parse);
-	}
-
-	lmatch(parse, lc_end);
-
-	if (outer_csi != NULL) {
-		switch (outer_csi->cc) {
-		case csi_class:
-		case csi_struct:
-			break;
-		case csi_interface:
-			cspan_print(enum_d->name->cspan);
-			printf(" Error: Enum declared inside interface.\n");
-			parse_note_error(parse);
-			/* XXX Free enum */
-			return NULL;
-		}
-	}
-
-	return enum_d;
-}
-
-/** Parse enum member.
- *
- * @param parse		Parser object.
- * @param outer_enum	Enum containing this declaration.
- * @return		New syntax tree node. In case of parse error,
- *			@c NULL may (but need not) be returned.
- */
-static stree_embr_t *parse_embr(parse_t *parse, stree_enum_t *outer_enum)
-{
-	stree_embr_t *embr;
-
-	embr = stree_embr_new();
-	embr->outer_enum = outer_enum;
-	embr->name = parse_ident(parse);
-
-	lmatch(parse, lc_scolon);
-
-	return embr;
-}
-
-/** Parse delegate.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_deleg_t *parse_deleg(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_deleg_t *deleg;
-	stree_symbol_t *symbol;
-
-	deleg = stree_deleg_new();
-	symbol = stree_symbol_new(sc_deleg);
-
-	symbol->u.deleg = deleg;
-	symbol->outer_csi = outer_csi;
-	deleg->symbol = symbol;
-
-	lmatch(parse, lc_deleg);
-	deleg->name = parse_ident(parse);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsing delegate '%s'.\n", strtab_get_str(deleg->name->sid));
-#endif
-
-	deleg->sig = parse_fun_sig(parse);
-
-	/* Parse attributes. */
-	parse_symbol_attrs(parse, symbol);
-
-	lmatch(parse, lc_scolon);
-
-	switch (outer_csi->cc) {
-	case csi_class:
-	case csi_struct:
-		break;
-	case csi_interface:
-		cspan_print(deleg->name->cspan);
-		printf(" Error: Delegate declared inside interface.\n");
-		parse_note_error(parse);
-		/* XXX Free deleg */
-		return NULL;
-	}
-
-	return deleg;
-}
-
-/** Parse member function.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_fun_t *parse_fun(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_fun_t *fun;
-	stree_symbol_t *symbol;
-	bool_t body_expected;
-
-	fun = stree_fun_new();
-	symbol = stree_symbol_new(sc_fun);
-
-	symbol->u.fun = fun;
-	symbol->outer_csi = outer_csi;
-	fun->symbol = symbol;
-
-	lmatch(parse, lc_fun);
-	fun->name = parse_ident(parse);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsing function '%s'.\n", strtab_get_str(fun->name->sid));
-#endif
-	fun->sig = parse_fun_sig(parse);
-
-	/* Parse attributes. */
-	parse_symbol_attrs(parse, symbol);
-
-	body_expected = !stree_symbol_has_attr(symbol, sac_builtin) &&
-	    (outer_csi->cc != csi_interface);
-
-	fun->proc = stree_proc_new();
-	fun->proc->outer_symbol = symbol;
-
-	if (lcur_lc(parse) == lc_scolon) {
-		lskip(parse);
-
-		/* Body not present */
-		if (body_expected) {
-			cspan_print(fun->name->cspan);
-			printf(" Error: Function '");
-			symbol_print_fqn(symbol);
-			printf("' should have a body.\n");
-			parse_note_error(parse);
-		}
-
-		fun->proc->body = NULL;
-	} else {
-		lmatch(parse, lc_is);
-		fun->proc->body = parse_block(parse);
-		lmatch(parse, lc_end);
-
-		/* Body present */
-		if (!body_expected) {
-			cspan_print(fun->name->cspan);
-			printf(" Error: Function declaration '");
-			symbol_print_fqn(symbol);
-			printf("' should not have a body.\n");
-			parse_note_error(parse);
-		}
-	}
-
-	return fun;
-}
-
-/** Parse member variable.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_var_t *parse_var(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_var_t *var;
-	stree_symbol_t *symbol;
-
-	var = stree_var_new();
-	symbol = stree_symbol_new(sc_var);
-	symbol->u.var = var;
-	symbol->outer_csi = outer_csi;
-	var->symbol = symbol;
-
-	lmatch(parse, lc_var);
-	var->name = parse_ident(parse);
-	lmatch(parse, lc_colon);
-	var->type =  parse_texpr(parse);
-
-	parse_symbol_attrs(parse, symbol);
-
-	lmatch(parse, lc_scolon);
-
-	switch (outer_csi->cc) {
-	case csi_class:
-	case csi_struct:
-		break;
-	case csi_interface:
-		cspan_print(var->name->cspan);
-		printf(" Error: Variable declared inside interface.\n");
-		parse_note_error(parse);
-		/* XXX Free var */
-		return NULL;
-	}
-
-	return var;
-}
-
-/** Parse member property.
- *
- * @param parse		Parser object.
- * @param outer_csi	CSI containing this declaration or @c NULL if global.
- * @return		New syntax tree node.
- */
-static stree_prop_t *parse_prop(parse_t *parse, stree_csi_t *outer_csi)
-{
-	stree_prop_t *prop;
-	stree_symbol_t *symbol;
-
-	stree_ident_t *ident;
-	stree_proc_arg_t *arg;
-
-	prop = stree_prop_new();
-	list_init(&prop->args);
-
-	symbol = stree_symbol_new(sc_prop);
-	symbol->u.prop = prop;
-	symbol->outer_csi = outer_csi;
-	prop->symbol = symbol;
-
-	lmatch(parse, lc_prop);
-
-	if (lcur_lc(parse) == lc_self) {
-		/* Indexed property set */
-
-		/* Use some name that is impossible as identifier. */
-		ident = stree_ident_new();
-		ident->sid = strtab_get_sid(INDEXER_IDENT);
-		prop->name = ident;
-
-		lskip(parse);
-		lmatch(parse, lc_lsbr);
-
-		/* Parse formal parameters. */
-		while (!parse_is_error(parse)) {
-			arg = parse_proc_arg(parse);
-			if (stree_arg_has_attr(arg, aac_packed)) {
-				prop->varg = arg;
-				break;
-			} else {
-				list_append(&prop->args, arg);
-			}
-
-			if (lcur_lc(parse) == lc_rsbr)
-				break;
-
-			lmatch(parse, lc_scolon);
-		}
-
-		lmatch(parse, lc_rsbr);
-	} else {
-		/* Named property */
-		prop->name = parse_ident(parse);
-	}
-
-	lmatch(parse, lc_colon);
-	prop->type = parse_texpr(parse);
-
-	/* Parse attributes. */
-	parse_symbol_attrs(parse, symbol);
-
-	lmatch(parse, lc_is);
-
-	while (lcur_lc(parse) != lc_end && !parse_is_error(parse)) {
-		switch (lcur_lc(parse)) {
-		case lc_get:
-			parse_prop_get(parse, prop);
-			break;
-		case lc_set:
-			parse_prop_set(parse, prop);
-			break;
-		default:
-			lunexpected_error(parse);
-		}
-	}
-
-	lmatch(parse, lc_end);
-
-	return prop;
-}
-
-/** Parse symbol attributes.
- *
- * Parse list of attributes and add them to @a symbol.
- *
- * @param parse		Parser object
- * @param symbol	Symbol to add these attributes to
- */
-static void parse_symbol_attrs(parse_t *parse, stree_symbol_t *symbol)
-{
-	stree_symbol_attr_t *attr;
-
-	/* Parse attributes. */
-	while (lcur_lc(parse) == lc_comma && !parse_is_error(parse)) {
-		lskip(parse);
-		attr = parse_symbol_attr(parse);
-		list_append(&symbol->attr, attr);
-	}
-}
-
-/** Parse symbol attribute.
- *
- * @param parse		Parser object
- * @return		New syntax tree node
- */
-static stree_symbol_attr_t *parse_symbol_attr(parse_t *parse)
-{
-	stree_symbol_attr_t *attr;
-	symbol_attr_class_t sac;
-
-	/* Make compiler happy. */
-	sac = 0;
-
-	switch (lcur_lc(parse)) {
-	case lc_builtin:
-		sac = sac_builtin;
-		break;
-	case lc_static:
-		sac = sac_static;
-		break;
-	default:
-		cspan_print(lcur_span(parse));
-		printf(" Error: Unexpected attribute '");
-		lem_print(lcur(parse));
-		printf("'.\n");
-		parse_note_error(parse);
-		break;
-	}
-
-	lskip(parse);
-
-	attr = stree_symbol_attr_new(sac);
-	return attr;
-}
-
-/** Parse formal function argument.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_proc_arg_t *parse_proc_arg(parse_t *parse)
-{
-	stree_proc_arg_t *arg;
-	stree_arg_attr_t *attr;
-
-	arg = stree_proc_arg_new();
-	arg->name = parse_ident(parse);
-	lmatch(parse, lc_colon);
-	arg->type = parse_texpr(parse);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse procedure argument.\n");
-#endif
-	list_init(&arg->attr);
-
-	/* Parse attributes. */
-	while (lcur_lc(parse) == lc_comma && !parse_is_error(parse)) {
-		lskip(parse);
-		attr = parse_arg_attr(parse);
-		list_append(&arg->attr, attr);
-	}
-
-	return arg;
-}
-
-/** Parse argument attribute.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_arg_attr_t *parse_arg_attr(parse_t *parse)
-{
-	stree_arg_attr_t *attr;
-
-	if (lcur_lc(parse) != lc_packed) {
-		cspan_print(lcur_span(parse));
-		printf(" Error: Unexpected attribute '");
-		lem_print(lcur(parse));
-		printf("'.\n");
-		parse_note_error(parse);
-	}
-
-	lskip(parse);
-
-	attr = stree_arg_attr_new(aac_packed);
-	return attr;
-}
-
-/** Parse function signature.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_fun_sig_t *parse_fun_sig(parse_t *parse)
-{
-	stree_fun_sig_t *sig;
-	stree_proc_arg_t *arg;
-
-	sig = stree_fun_sig_new();
-
-	lmatch(parse, lc_lparen);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsing function signature.\n");
-#endif
-
-	list_init(&sig->args);
-
-	if (lcur_lc(parse) != lc_rparen) {
-
-		/* Parse formal parameters. */
-		while (!parse_is_error(parse)) {
-			arg = parse_proc_arg(parse);
-
-			if (stree_arg_has_attr(arg, aac_packed)) {
-				sig->varg = arg;
-				break;
-			} else {
-				list_append(&sig->args, arg);
-			}
-
-			if (lcur_lc(parse) == lc_rparen)
-				break;
-
-			lmatch(parse, lc_scolon);
-		}
-	}
-
-	lmatch(parse, lc_rparen);
-
-	if (lcur_lc(parse) == lc_colon) {
-		lskip(parse);
-		sig->rtype = parse_texpr(parse);
-	} else {
-		sig->rtype = NULL;
-	}
-
-	return sig;
-}
-
-/** Parse member property getter.
- *
- * @param parse		Parser object.
- * @param prop		Property containing this declaration.
- */
-static void parse_prop_get(parse_t *parse, stree_prop_t *prop)
-{
-	cspan_t *cspan;
-	stree_block_t *block;
-	stree_proc_t *getter;
-	bool_t body_expected;
-
-	body_expected = (prop->symbol->outer_csi->cc != csi_interface);
-
-	lskip(parse);
-	cspan = lprev_span(parse);
-
-	if (prop->getter != NULL) {
-		cspan_print(cspan);
-		printf(" Error: Duplicate getter.\n");
-		parse_note_error(parse);
-		return;
-	}
-
-	if (lcur_lc(parse) == lc_scolon) {
-		/* Body not present */
-		lskip(parse);
-		block = NULL;
-
-		if (body_expected) {
-			cspan_print(prop->name->cspan);
-			printf(" Error: Property '");
-			symbol_print_fqn(prop->symbol);
-			printf("' getter should have "
-			    "a body.\n");
-			parse_note_error(parse);
-		}
-	} else {
-		/* Body present */
-		lmatch(parse, lc_is);
-		block = parse_block(parse);
-		lmatch(parse, lc_end);
-
-		if (!body_expected) {
-			cspan_print(prop->name->cspan);
-			printf(" Error: Property '");
-			symbol_print_fqn(prop->symbol);
-			printf("' getter declaration should "
-			    "not have a body.\n");
-			parse_note_error(parse);
-
-			/* XXX Free block */
-			block = NULL;
-		}
-	}
-
-	/* Create getter procedure */
-	getter = stree_proc_new();
-	getter->body = block;
-	getter->outer_symbol = prop->symbol;
-
-	/* Store getter in property. */
-	prop->getter = getter;
-}
-
-/** Parse member property setter.
- *
- * @param parse		Parser object.
- * @param prop		Property containing this declaration.
- */
-static void parse_prop_set(parse_t *parse, stree_prop_t *prop)
-{
-	cspan_t *cspan;
-	stree_block_t *block;
-	stree_proc_t *setter;
-	bool_t body_expected;
-
-	body_expected = (prop->symbol->outer_csi->cc != csi_interface);
-
-	lskip(parse);
-	cspan = lprev_span(parse);
-
-	if (prop->setter != NULL) {
-		cspan_print(cspan);
-		printf(" Error: Duplicate setter.\n");
-		parse_note_error(parse);
-		return;
-	}
-
-	prop->setter_arg = stree_proc_arg_new();
-	prop->setter_arg->name = parse_ident(parse);
-	prop->setter_arg->type = prop->type;
-
-	if (lcur_lc(parse) == lc_scolon) {
-		/* Body not present */
-		lskip(parse);
-
-		block = NULL;
-
-		if (body_expected) {
-			cspan_print(prop->name->cspan);
-			printf(" Error: Property '");
-			symbol_print_fqn(prop->symbol);
-			printf("' setter should have "
-			    "a body.\n");
-			parse_note_error(parse);
-		}
-	} else {
-		/* Body present */
-		lmatch(parse, lc_is);
-		block = parse_block(parse);
-		lmatch(parse, lc_end);
-
-		if (!body_expected) {
-			cspan_print(prop->name->cspan);
-			printf(" Error: Property '");
-			symbol_print_fqn(prop->symbol);
-			printf("' setter declaration should "
-			    "not have a body.\n");
-			parse_note_error(parse);
-		}
-	}
-
-	/* Create setter procedure */
-	setter = stree_proc_new();
-	setter->body = block;
-	setter->outer_symbol = prop->symbol;
-
-	/* Store setter in property. */
-	prop->setter = setter;
-}
-
-/** Parse statement block.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_block_t *parse_block(parse_t *parse)
-{
-	stree_block_t *block;
-	stree_stat_t *stat;
-
-	block = stree_block_new();
-	list_init(&block->stats);
-
-	/* Avoid peeking if there is an error condition. */
-	if (parse_is_error(parse))
-		return block;
-
-	while (terminates_block(lcur_lc(parse)) != b_true &&
-	    !parse_is_error(parse)) {
-
-		stat = parse_stat(parse);
-		list_append(&block->stats, stat);
-	}
-
-	return block;
-}
-
-/** Parse statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-stree_stat_t *parse_stat(parse_t *parse)
-{
-	stree_stat_t *stat;
-
-	stree_vdecl_t *vdecl_s;
-	stree_if_t *if_s;
-	stree_switch_t *switch_s;
-	stree_while_t *while_s;
-	stree_for_t *for_s;
-	stree_raise_t *raise_s;
-	stree_break_t *break_s;
-	stree_return_t *return_s;
-	stree_wef_t *wef_s;
-	stree_exps_t *exp_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse statement.\n");
-#endif
-	switch (lcur_lc(parse)) {
-	case lc_var:
-		vdecl_s = parse_vdecl(parse);
-		stat = stree_stat_new(st_vdecl);
-		stat->u.vdecl_s = vdecl_s;
-		break;
-	case lc_if:
-		if_s = parse_if(parse);
-		stat = stree_stat_new(st_if);
-		stat->u.if_s = if_s;
-		break;
-	case lc_switch:
-		switch_s = parse_switch(parse);
-		stat = stree_stat_new(st_switch);
-		stat->u.switch_s = switch_s;
-		break;
-	case lc_while:
-		while_s = parse_while(parse);
-		stat = stree_stat_new(st_while);
-		stat->u.while_s = while_s;
-		break;
-	case lc_for:
-		for_s = parse_for(parse);
-		stat = stree_stat_new(st_for);
-		stat->u.for_s = for_s;
-		break;
-	case lc_raise:
-		raise_s = parse_raise(parse);
-		stat = stree_stat_new(st_raise);
-		stat->u.raise_s = raise_s;
-		break;
-	case lc_break:
-		break_s = parse_break(parse);
-		stat = stree_stat_new(st_break);
-		stat->u.break_s = break_s;
-		break;
-	case lc_return:
-		return_s = parse_return(parse);
-		stat = stree_stat_new(st_return);
-		stat->u.return_s = return_s;
-		break;
-	case lc_do:
-	case lc_with:
-		wef_s = parse_wef(parse);
-		stat = stree_stat_new(st_wef);
-		stat->u.wef_s = wef_s;
-		break;
-	default:
-		exp_s = parse_exps(parse);
-		stat = stree_stat_new(st_exps);
-		stat->u.exp_s = exp_s;
-		break;
-	}
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsed statement %p\n", stat);
-#endif
-	return stat;
-}
-
-/** Parse variable declaration statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_vdecl_t *parse_vdecl(parse_t *parse)
-{
-	stree_vdecl_t *vdecl;
-
-	vdecl = stree_vdecl_new();
-
-	lmatch(parse, lc_var);
-	vdecl->name = parse_ident(parse);
-	lmatch(parse, lc_colon);
-	vdecl->type = parse_texpr(parse);
-
-	if (lcur_lc(parse) == lc_assign) {
-		lskip(parse);
-		(void) parse_expr(parse);
-	}
-
-	lmatch(parse, lc_scolon);
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parsed vdecl for '%s'\n", strtab_get_str(vdecl->name->sid));
-	printf("vdecl = %p, vdecl->name = %p, sid=%d\n",
-	    vdecl, vdecl->name, vdecl->name->sid);
-#endif
-	return vdecl;
-}
-
-/** Parse @c if statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_if_t *parse_if(parse_t *parse)
-{
-	stree_if_t *if_s;
-	stree_if_clause_t *if_c;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'if' statement.\n");
-#endif
-	if_s = stree_if_new();
-	list_init(&if_s->if_clauses);
-
-	/* Parse @c if clause. */
-	lmatch(parse, lc_if);
-
-	if_c = stree_if_clause_new();
-	if_c->cond = parse_expr(parse);
-	lmatch(parse, lc_then);
-	if_c->block = parse_block(parse);
-
-	list_append(&if_s->if_clauses, if_c);
-
-	/* Parse @c elif clauses. */
-	while (lcur_lc(parse) == lc_elif) {
-		lskip(parse);
-		if_c = stree_if_clause_new();
-		if_c->cond = parse_expr(parse);
-		lmatch(parse, lc_then);
-		if_c->block = parse_block(parse);
-
-		list_append(&if_s->if_clauses, if_c);
-	}
-
-	/* Parse @c else clause. */
-	if (lcur_lc(parse) == lc_else) {
-		lskip(parse);
-		if_s->else_block = parse_block(parse);
-	} else {
-		if_s->else_block = NULL;
-	}
-
-	lmatch(parse, lc_end);
-	return if_s;
-}
-
-/** Parse @c switch statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_switch_t *parse_switch(parse_t *parse)
-{
-	stree_switch_t *switch_s;
-	stree_when_t *when_c;
-	stree_expr_t *expr;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'switch' statement.\n");
-#endif
-	lmatch(parse, lc_switch);
-
-	switch_s = stree_switch_new();
-	list_init(&switch_s->when_clauses);
-
-	switch_s->expr = parse_expr(parse);
-	lmatch(parse, lc_is);
-
-	/* Parse @c when clauses. */
-	while (lcur_lc(parse) == lc_when) {
-		lskip(parse);
-		when_c = stree_when_new();
-		list_init(&when_c->exprs);
-		while (b_true) {
-			expr = parse_expr(parse);
-			list_append(&when_c->exprs, expr);
-			if (lcur_lc(parse) != lc_comma)
-				break;
-			lskip(parse);
-		}
-
-		lmatch(parse, lc_do);
-		when_c->block = parse_block(parse);
-
-		list_append(&switch_s->when_clauses, when_c);
-	}
-
-	/* Parse @c else clause. */
-	if (lcur_lc(parse) == lc_else) {
-		lskip(parse);
-		lmatch(parse, lc_do);
-		switch_s->else_block = parse_block(parse);
-	} else {
-		switch_s->else_block = NULL;
-	}
-
-	lmatch(parse, lc_end);
-	return switch_s;
-}
-
-/** Parse @c while statement.
- *
- * @param parse		Parser object.
- */
-static stree_while_t *parse_while(parse_t *parse)
-{
-	stree_while_t *while_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'while' statement.\n");
-#endif
-	while_s = stree_while_new();
-
-	lmatch(parse, lc_while);
-	while_s->cond = parse_expr(parse);
-	lmatch(parse, lc_do);
-	while_s->body = parse_block(parse);
-	lmatch(parse, lc_end);
-
-	return while_s;
-}
-
-/** Parse @c for statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_for_t *parse_for(parse_t *parse)
-{
-	stree_for_t *for_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'for' statement.\n");
-#endif
-	for_s = stree_for_new();
-
-	lmatch(parse, lc_for);
-	lmatch(parse, lc_ident);
-	lmatch(parse, lc_colon);
-	(void) parse_texpr(parse);
-	lmatch(parse, lc_in);
-	(void) parse_expr(parse);
-	lmatch(parse, lc_do);
-	for_s->body = parse_block(parse);
-	lmatch(parse, lc_end);
-
-	return for_s;
-}
-
-/** Parse @c raise statement.
- *
- * @param parse		Parser object.
- */
-static stree_raise_t *parse_raise(parse_t *parse)
-{
-	stree_raise_t *raise_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'raise' statement.\n");
-#endif
-	raise_s = stree_raise_new();
-	lmatch(parse, lc_raise);
-	raise_s->expr = parse_expr(parse);
-	lmatch(parse, lc_scolon);
-
-	return raise_s;
-}
-
-/** Parse @c break statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_break_t *parse_break(parse_t *parse)
-{
-	stree_break_t *break_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'break' statement.\n");
-#endif
-	break_s = stree_break_new();
-
-	lmatch(parse, lc_break);
-	lmatch(parse, lc_scolon);
-
-	return break_s;
-}
-
-/** Parse @c return statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_return_t *parse_return(parse_t *parse)
-{
-	stree_return_t *return_s;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'return' statement.\n");
-#endif
-	return_s = stree_return_new();
-
-	lmatch(parse, lc_return);
-
-	if (lcur_lc(parse) != lc_scolon)
-		return_s->expr = parse_expr(parse);
-
-	lmatch(parse, lc_scolon);
-
-	return return_s;
-}
-
-/** Parse @c with-except-finally statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_wef_t *parse_wef(parse_t *parse)
-{
-	stree_wef_t *wef_s;
-	stree_except_t *except_c;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse WEF statement.\n");
-#endif
-	wef_s = stree_wef_new();
-	list_init(&wef_s->except_clauses);
-
-	if (lcur_lc(parse) == lc_with) {
-		lmatch(parse, lc_with);
-		lmatch(parse, lc_ident);
-		lmatch(parse, lc_colon);
-		(void) parse_texpr(parse);
-		lmatch(parse, lc_assign);
-		(void) parse_expr(parse);
-	}
-
-	lmatch(parse, lc_do);
-	wef_s->with_block = parse_block(parse);
-
-	while (lcur_lc(parse) == lc_except && !parse_is_error(parse)) {
-		except_c = parse_except(parse);
-		list_append(&wef_s->except_clauses, except_c);
-	}
-
-	if (lcur_lc(parse) == lc_finally) {
-		lmatch(parse, lc_finally);
-		lmatch(parse, lc_do);
-		wef_s->finally_block = parse_block(parse);
-	} else {
-		wef_s->finally_block = NULL;
-	}
-
-	lmatch(parse, lc_end);
-
-	return wef_s;
-}
-
-/** Parse expression statement.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_exps_t *parse_exps(parse_t *parse)
-{
-	stree_expr_t *expr;
-	stree_exps_t *exps;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse expression statement.\n");
-#endif
-	expr = parse_expr(parse);
-	lmatch(parse, lc_scolon);
-
-	exps = stree_exps_new();
-	exps->expr = expr;
-
-	return exps;
-}
-
-/** Parse @c except clause.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-static stree_except_t *parse_except(parse_t *parse)
-{
-	stree_except_t *except_c;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse 'except' statement.\n");
-#endif
-	except_c = stree_except_new();
-
-	lmatch(parse, lc_except);
-	except_c->evar = parse_ident(parse);
-	lmatch(parse, lc_colon);
-	except_c->etype = parse_texpr(parse);
-	lmatch(parse, lc_do);
-
-	except_c->block = parse_block(parse);
-
-	return except_c;
-}
-
-/** Parse identifier.
- *
- * @param parse		Parser object.
- * @return		New syntax tree node.
- */
-stree_ident_t *parse_ident(parse_t *parse)
-{
-	stree_ident_t *ident;
-
-#ifdef DEBUG_PARSE_TRACE
-	printf("Parse identifier.\n");
-#endif
-	lcheck(parse, lc_ident);
-	ident = stree_ident_new();
-	ident->sid = lcur(parse)->u.ident.sid;
-	ident->cspan = lcur_span(parse);
-	lskip(parse);
-
-	return ident;
-}
-
-/** Signal a parse error, start bailing out from parser.
- *
- * @param parse		Parser object.
- */
-void parse_raise_error(parse_t *parse)
-{
-	parse->error = b_true;
-	parse->error_bailout = b_true;
-}
-
-/** Note a parse error that has been immediately recovered.
- *
- * @param parse		Parser object.
- */
-void parse_note_error(parse_t *parse)
-{
-	parse->error = b_true;
-}
-
-/** Check if we are currently bailing out of parser due to a parse error.
- *
- * @param parse		Parser object.
- */
-bool_t parse_is_error(parse_t *parse)
-{
-	return parse->error_bailout;
-}
-
-/** Recover from parse error bailout.
- *
- * Still remember that there was an error, but stop bailing out.
- *
- * @param parse		Parser object.
- */
-void parse_recover_error(parse_t *parse)
-{
-	assert(parse->error == b_true);
-	assert(parse->error_bailout == b_true);
-
-	parse->error_bailout = b_false;
-}
-
-/** Return current lem.
- *
- * @param parse		Parser object.
- * @return		Pointer to current lem. Only valid until the lexing
- *			position is advanced.
- */
-lem_t *lcur(parse_t *parse)
-{
-#ifdef DEBUG_LPARSE_TRACE
-	printf("lcur()\n");
-#endif
-	return lex_get_current(parse->lex);
-}
-
-/** Return current lem lclass.
- *
- * @param parse		Parser object
- * @return		Lclass of the current lem
- */
-lclass_t lcur_lc(parse_t *parse)
-{
-	lem_t *lem;
-
-	/*
-	 * This allows us to skip error checking in many places. If there is an
-	 * active error, lcur_lc() returns lc_invalid without reading input.
-	 *
-	 * Without this measure we would have to check for error all the time
-	 * or risk requiring extra input from the user (in interactive mode)
-	 * before actually bailing out from the parser.
-	 */
-	if (parse_is_error(parse))
-		return lc_invalid;
-
-	lem = lcur(parse);
-	return lem->lclass;
-}
-
-/** Return coordinate span of current lem.
- *
- * @param parse		Parser object
- * @return		Coordinate span of current lem or @c NULL if a
- *			parse error is active
- */
-cspan_t *lcur_span(parse_t *parse)
-{
-	lem_t *lem;
-
-	if (parse_is_error(parse))
-		return NULL;
-
-	lem = lcur(parse);
-	return lem->cspan;
-}
-
-/** Return coordinate span of previous lem.
- *
- * @param parse		Parser object
- * @return		Coordinate span of previous lem or @c NULL if
- * 			parse error is active or previous lem is not
- *			available.
- */
-cspan_t *lprev_span(parse_t *parse)
-{
-	lem_t *lem;
-
-	if (parse_is_error(parse))
-		return NULL;
-
-	lem = lex_peek_prev(parse->lex);
-	if (lem == NULL)
-		return NULL;
-
-	return lem->cspan;
-}
-
-/** Skip to next lem.
- *
- * @param parse		Parser object.
- */
-void lskip(parse_t *parse)
-{
-#ifdef DEBUG_LPARSE_TRACE
-	printf("lskip()\n");
-#endif
-	lex_next(parse->lex);
-}
-
-/** Verify that lclass of current lem is @a lc.
- *
- * If a lem of different lclass is found, a parse error is raised and
- * a message is printed.
- *
- * @param parse		Parser object.
- * @param lc		Expected lclass.
- */
-void lcheck(parse_t *parse, lclass_t lc)
-{
-#ifdef DEBUG_LPARSE_TRACE
-	printf("lcheck(");
-	lclass_print(lc);
-	printf(")\n");
-#endif
-	if (lcur(parse)->lclass != lc) {
-		lem_print_coords(lcur(parse));
-		printf(" Error: expected '");
-		lclass_print(lc);
-		printf("', got '");
-		lem_print(lcur(parse));
-		printf("'.\n");
-		parse_raise_error(parse);
-	}
-}
-
-/** Verify that lclass of current lem is @a lc and go to next lem.
- *
- * If a lem of different lclass is found, a parse error is raised and
- * a message is printed.
- *
- * @param parse		Parser object.
- * @param lc		Expected lclass.
- */
-void lmatch(parse_t *parse, lclass_t lc)
-{
-#ifdef DEBUG_LPARSE_TRACE
-	printf("lmatch(");
-	lclass_print(lc);
-	printf(")\n");
-#endif
-	/*
-	 * This allows us to skip error checking in many places. If there is an
-	 * active error, lmatch() does nothing (similar to parse_block(), etc.
-	 *
-	 * Without this measure we would have to check for error all the time
-	 * or risk requiring extra input from the user (in interactive mode)
-	 * before actually bailing out from the parser.
-	 */
-	if (parse_is_error(parse))
-		return;
-
-	lcheck(parse, lc);
-	lskip(parse);
-}
-
-/** Raise and display generic parsing error.
- *
- * @param parse		Parser object.
- */
-void lunexpected_error(parse_t *parse)
-{
-	lem_print_coords(lcur(parse));
-	printf(" Error: unexpected token '");
-	lem_print(lcur(parse));
-	printf("'.\n");
-	parse_raise_error(parse);
-}
-
-/** Determine whether @a lclass is in follow(block).
- *
- * Tests whether @a lclass belongs to the follow(block) set, i.e. if it is
- * lclass of a lem that can follow a block in the program.
- *
- * @param lclass	Lclass.
- */
-bool_t terminates_block(lclass_t lclass)
-{
-	switch (lclass) {
-	case lc_elif:
-	case lc_else:
-	case lc_end:
-	case lc_except:
-	case lc_finally:
-	case lc_when:
-		return b_true;
-	default:
-		return b_false;
-	}
-}
Index: pace/app/sbi/src/parse.h
===================================================================
--- uspace/app/sbi/src/parse.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PARSE_H_
-#define PARSE_H_
-
-#include "mytypes.h"
-
-void parse_init(parse_t *parse, struct stree_program *prog, struct lex *lex);
-void parse_module(parse_t *parse);
-
-stree_stat_t *parse_stat(parse_t *parse);
-stree_ident_t *parse_ident(parse_t *parse);
-
-void parse_raise_error(parse_t *parse);
-void parse_note_error(parse_t *parse);
-bool_t parse_is_error(parse_t *parse);
-void parse_recover_error(parse_t *parse);
-
-/*
- * Parsing primitives
- */
-lem_t *lcur(parse_t *parse);
-lclass_t lcur_lc(parse_t *parse);
-cspan_t *lcur_span(parse_t *parse);
-cspan_t *lprev_span(parse_t *parse);
-
-void lskip(parse_t *parse);
-void lcheck(parse_t *parse, lclass_t lc);
-void lmatch(parse_t *parse, lclass_t lc);
-void lunexpected_error(parse_t *parse);
-
-bool_t terminates_block(lclass_t lclass);
-
-#endif
Index: pace/app/sbi/src/parse_t.h
===================================================================
--- uspace/app/sbi/src/parse_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PARSE_T_H_
-#define PARSE_T_H_
-
-/** Parser state object */
-typedef struct {
-	/** Lexer object */
-	struct lex *lex;
-
-	/** Program being parsed */
-	struct stree_program *program;
-
-	/** Module currently being parsed */
-	struct stree_module *cur_mod;
-
-	/** @c b_true if an error occured. */
-	bool_t error;
-
-	/** @c b_true if bailing out due to an error. */
-	bool_t error_bailout;
-} parse_t;
-
-#endif
Index: pace/app/sbi/src/program.c
===================================================================
--- uspace/app/sbi/src/program.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Main module.
- *
- * Main entry point for SBI, the Sysel Bootstrap Interpreter.
- * When run without parameters, the interpreter will enter interactive
- * mode.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "os/os.h"
-#include "mytypes.h"
-#include "stype.h"
-#include "input.h"
-#include "lex.h"
-#include "parse.h"
-
-#include "program.h"
-
-#define MAX_NAME_SIZE 64
-static char name_buf[MAX_NAME_SIZE + 1];
-
-/** Process one specified source file.
- *
- * @param program 	The program to which the parsed code is added.
- * @param fname		Name of file to read from.
- * @return		EOK on success, EIO if file is not found,
- *			EINVAL if file has syntax errors.
- */
-errno_t program_file_process(stree_program_t *program, const char *fname)
-{
-	input_t *input;
-	lex_t lex;
-	parse_t parse;
-	errno_t rc;
-
-	rc = input_new_file(&input, fname);
-	if (rc != EOK) {
-		printf("Failed opening source file '%s'.\n", fname);
-		return EIO;
-	}
-
-	/* Parse input file. */
-	lex_init(&lex, input);
-	parse_init(&parse, program, &lex);
-	parse_module(&parse);
-
-	/* Check for parse errors. */
-	if (parse.error)
-		return EINVAL;
-
-	return EOK;
-}
-
-/** Process sources of the library.
- *
- * Processes all source files in the library. The list of library source files
- * is read from '<libdir>/libflist'. Each line of the file contains one file
- * name relative to <libdir>.
- *
- * @param program 	The program to which the parsed code is added.
- * @return		EOK on success, EIO if some file comprising the
- *			library is not found, EINVAL if the library
- *			has syntax errors.
- */
-errno_t program_lib_process(stree_program_t *program)
-{
-	errno_t rc;
-	char *path, *fname;
-	char *tmp;
-	char *cp;
-
-	FILE *f;
-
-	path = os_get_lib_path();
-	fname = os_str_acat(path, "/libflist");
-
-	f = fopen(fname, "rt");
-	if (f == NULL) {
-		printf("Failed opening library list file '%s'.\n", fname);
-		free(path);
-		free(fname);
-		return EIO;
-	}
-
-	free(fname);
-
-	while (b_true) {
-		if (fgets(name_buf, MAX_NAME_SIZE + 1, f) == NULL)
-			break;
-
-		/*
-		 * Remove trailing newline, if present.
-		 */
-		cp = name_buf;
-		while (*cp != '\0' && *cp != '\n')
-			++cp;
-
-		if (*cp == '\n')
-			*cp = '\0';
-
-		tmp = os_str_acat(path, "/");
-		fname = os_str_acat(tmp, name_buf);
-		free(tmp);
-
-		rc = program_file_process(program, fname);
-		if (rc != EOK) {
-			free(fname);
-			free(path);
-			fclose(f);
-			return rc;
-		}
-
-		free(fname);
-	}
-
-	if (ferror(f)) {
-		printf("Error reading from library list file.\n");
-		free(path);
-		fclose(f);
-		return EIO;
-	}
-
-	free(path);
-	fclose(f);
-
-	return EOK;
-}
Index: pace/app/sbi/src/program.h
===================================================================
--- uspace/app/sbi/src/program.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PROGRAM_H_
-#define PROGRAM_H_
-
-#include "mytypes.h"
-
-errno_t program_file_process(stree_program_t *program, const char *fname);
-errno_t program_lib_process(stree_program_t *program);
-
-#endif
Index: pace/app/sbi/src/rdata.c
===================================================================
--- uspace/app/sbi/src/rdata.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1387 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Run-time data representation.
- *
- * At run time SBI represents all data as a graph of interconnected @c var
- * nodes (variable nodes). Any piece of memory addressable by the program
- * (i.e. all variables) are stored in var nodes. However, var nodes are also
- * used internally to implement value items. (I.e. values in value items
- * have exactly the same structure as program variables).
- *
- * Unlike byte- or word-oriented memory on a real machine, var nodes provide
- * structured and typed storage. (This typing is dynamic, however and has
- * nothing to do with the static type system).
- *
- * There are several types of var nodes, one for each primitive type,
- * reference, delegate, array, and object. A reference var node contains
- * a pointer to another var node. Delegate var node points to some stree
- * declaration. Array and object var nodes refer to a collection of child
- * nodes (fields, elements).
- */
-
-#include <stdlib.h>
-#include <assert.h>
-#include "bigint.h"
-#include "list.h"
-#include "mytypes.h"
-#include "stree.h"
-#include "symbol.h"
-#include "strtab.h"
-
-#include "rdata.h"
-
-static void rdata_bool_copy(rdata_bool_t *src, rdata_bool_t **dest);
-static void rdata_char_copy(rdata_char_t *src, rdata_char_t **dest);
-static void rdata_int_copy(rdata_int_t *src, rdata_int_t **dest);
-static void rdata_string_copy(rdata_string_t *src, rdata_string_t **dest);
-static void rdata_ref_copy(rdata_ref_t *src, rdata_ref_t **dest);
-static void rdata_deleg_copy(rdata_deleg_t *src, rdata_deleg_t **dest);
-static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest);
-static void rdata_array_copy(rdata_array_t *src, rdata_array_t **dest);
-static void rdata_object_copy(rdata_object_t *src, rdata_object_t **dest);
-static void rdata_resource_copy(rdata_resource_t *src,
-    rdata_resource_t **dest);
-static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest);
-
-static void rdata_var_destroy_inner(rdata_var_t *var);
-
-static void rdata_bool_destroy(rdata_bool_t *bool_v);
-static void rdata_char_destroy(rdata_char_t *char_v);
-static void rdata_int_destroy(rdata_int_t *int_v);
-static void rdata_string_destroy(rdata_string_t *string_v);
-static void rdata_ref_destroy(rdata_ref_t *ref_v);
-static void rdata_deleg_destroy(rdata_deleg_t *deleg_v);
-static void rdata_enum_destroy(rdata_enum_t *enum_v);
-static void rdata_array_destroy(rdata_array_t *array_v);
-static void rdata_object_destroy(rdata_object_t *object_v);
-static void rdata_resource_destroy(rdata_resource_t *resource_v);
-static void rdata_symbol_destroy(rdata_symbol_t *symbol_v);
-
-static int rdata_array_get_dim(rdata_array_t *array);
-static void rdata_var_copy_to(rdata_var_t *src, rdata_var_t *dest);
-
-static void rdata_address_print(rdata_address_t *address);
-static void rdata_var_print(rdata_var_t *var);
-
-/** Allocate new data item.
- *
- * @param ic	Item class.
- * @return	New item.
- */
-rdata_item_t *rdata_item_new(item_class_t ic)
-{
-	rdata_item_t *item;
-
-	item = calloc(1, sizeof(rdata_item_t));
-	if (item == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	item->ic = ic;
-	return item;
-}
-
-/** Allocate new address.
- *
- * @return	New address.
- */
-rdata_addr_var_t *rdata_addr_var_new(void)
-{
-	rdata_addr_var_t *addr_var;
-
-	addr_var = calloc(1, sizeof(rdata_addr_var_t));
-	if (addr_var == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return addr_var;
-}
-
-/** Allocate new named property address.
- *
- * @return	New named property address.
- */
-rdata_aprop_named_t *rdata_aprop_named_new(void)
-{
-	rdata_aprop_named_t *aprop_named;
-
-	aprop_named = calloc(1, sizeof(rdata_aprop_named_t));
-	if (aprop_named == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return aprop_named;
-}
-
-/** Allocate new indexed property address.
- *
- * @return	New indexed property address.
- */
-rdata_aprop_indexed_t *rdata_aprop_indexed_new(void)
-{
-	rdata_aprop_indexed_t *aprop_indexed;
-
-	aprop_indexed = calloc(1, sizeof(rdata_aprop_indexed_t));
-	if (aprop_indexed == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return aprop_indexed;
-}
-
-/** Allocate new property address.
- *
- * @param apc	Property address class.
- * @return	New property address.
- */
-rdata_addr_prop_t *rdata_addr_prop_new(aprop_class_t apc)
-{
-	rdata_addr_prop_t *addr_prop;
-
-	addr_prop = calloc(1, sizeof(rdata_addr_prop_t));
-	if (addr_prop == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	addr_prop->apc = apc;
-	return addr_prop;
-}
-
-/** Allocate new address.
- *
- * @param ac	Address class.
- * @return	New address.
- */
-rdata_address_t *rdata_address_new(address_class_t ac)
-{
-	rdata_address_t *address;
-
-	address = calloc(1, sizeof(rdata_address_t));
-	if (address == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	address->ac = ac;
-	return address;
-}
-
-/** Allocate new value.
- *
- * @return	New value.
- */
-rdata_value_t *rdata_value_new(void)
-{
-	rdata_value_t *value;
-
-	value = calloc(1, sizeof(rdata_value_t));
-	if (value == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return value;
-}
-
-/** Allocate new var node.
- *
- * @param vc	Var node class (varclass).
- * @return	New var node.
- */
-rdata_var_t *rdata_var_new(var_class_t vc)
-{
-	rdata_var_t *var;
-
-	var = calloc(1, sizeof(rdata_var_t));
-	if (var == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	var->vc = vc;
-	return var;
-}
-
-/** Allocate new reference.
- *
- * @return	New reference.
- */
-rdata_ref_t *rdata_ref_new(void)
-{
-	rdata_ref_t *ref;
-
-	ref = calloc(1, sizeof(rdata_ref_t));
-	if (ref == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return ref;
-}
-
-/** Allocate new delegate.
- *
- * @return	New delegate.
- */
-rdata_deleg_t *rdata_deleg_new(void)
-{
-	rdata_deleg_t *deleg;
-
-	deleg = calloc(1, sizeof(rdata_deleg_t));
-	if (deleg == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return deleg;
-}
-
-/** Allocate new enum value.
- *
- * @return	New enum value.
- */
-rdata_enum_t *rdata_enum_new(void)
-{
-	rdata_enum_t *enum_v;
-
-	enum_v = calloc(1, sizeof(rdata_enum_t));
-	if (enum_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return enum_v;
-}
-
-/** Allocate new array.
- *
- * @return	New array.
- */
-rdata_array_t *rdata_array_new(int rank)
-{
-	rdata_array_t *array;
-
-	array = calloc(1, sizeof(rdata_array_t));
-	if (array == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	array->rank = rank;
-	array->extent = calloc(rank, sizeof(int));
-	if (array == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return array;
-}
-
-/** Allocate new object.
- *
- * @return	New object.
- */
-rdata_object_t *rdata_object_new(void)
-{
-	rdata_object_t *object;
-
-	object = calloc(1, sizeof(rdata_object_t));
-	if (object == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return object;
-}
-
-/** Allocate new boolean.
- *
- * @return	New boolean.
- */
-rdata_bool_t *rdata_bool_new(void)
-{
-	rdata_bool_t *bool_v;
-
-	bool_v = calloc(1, sizeof(rdata_bool_t));
-	if (bool_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return bool_v;
-}
-
-/** Allocate new character.
- *
- * @return	New character.
- */
-rdata_char_t *rdata_char_new(void)
-{
-	rdata_char_t *char_v;
-
-	char_v = calloc(1, sizeof(rdata_char_t));
-	if (char_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return char_v;
-}
-
-/** Allocate new integer.
- *
- * @return	New integer.
- */
-rdata_int_t *rdata_int_new(void)
-{
-	rdata_int_t *int_v;
-
-	int_v = calloc(1, sizeof(rdata_int_t));
-	if (int_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return int_v;
-}
-
-/** Allocate new string.
- *
- * @return	New string.
- */
-rdata_string_t *rdata_string_new(void)
-{
-	rdata_string_t *string_v;
-
-	string_v = calloc(1, sizeof(rdata_string_t));
-	if (string_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return string_v;
-}
-
-/** Allocate new resource.
- *
- * @return	New resource.
- */
-rdata_resource_t *rdata_resource_new(void)
-{
-	rdata_resource_t *resource_v;
-
-	resource_v = calloc(1, sizeof(rdata_resource_t));
-	if (resource_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return resource_v;
-}
-
-/** Allocate new symbol reference.
- *
- * @return	New symbol reference.
- */
-rdata_symbol_t *rdata_symbol_new(void)
-{
-	rdata_symbol_t *symbol_v;
-
-	symbol_v = calloc(1, sizeof(rdata_symbol_t));
-	if (symbol_v == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return symbol_v;
-}
-
-/** Allocate array elements.
- *
- * Allocates element array of @a array.
- *
- * @param array		Array.
- */
-void rdata_array_alloc_element(rdata_array_t *array)
-{
-	int dim;
-
-	dim = rdata_array_get_dim(array);
-
-	array->element = calloc(dim, sizeof(rdata_var_t *));
-	if (array->element == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-}
-
-/** Get array dimension.
- *
- * Dimension is the total number of elements in an array, in other words,
- * the product of all extents.
- *
- * @param array		Array.
- */
-static int rdata_array_get_dim(rdata_array_t *array)
-{
-	int didx, dim;
-
-	dim = 1;
-	for (didx = 0; didx < array->rank; ++didx)
-		dim = dim * array->extent[didx];
-
-	return dim;
-}
-
-/** Deallocate item.
- *
- * @param item	Item node
- */
-void rdata_item_delete(rdata_item_t *item)
-{
-	assert(item != NULL);
-	free(item);
-}
-
-/** Deallocate variable address.
- *
- * @param addr_var	Variable address node
- */
-void rdata_addr_var_delete(rdata_addr_var_t *addr_var)
-{
-	assert(addr_var != NULL);
-	free(addr_var);
-}
-
-/** Deallocate property address.
- *
- * @param addr_prop	Variable address node
- */
-void rdata_addr_prop_delete(rdata_addr_prop_t *addr_prop)
-{
-	assert(addr_prop != NULL);
-	free(addr_prop);
-}
-
-/** Deallocate named property address.
- *
- * @param aprop_named	Variable address node
- */
-void rdata_aprop_named_delete(rdata_aprop_named_t *aprop_named)
-{
-	assert(aprop_named != NULL);
-	free(aprop_named);
-}
-
-/** Deallocate indexed property address.
- *
- * @param aprop_indexed	Variable address node
- */
-void rdata_aprop_indexed_delete(rdata_aprop_indexed_t *aprop_indexed)
-{
-	assert(aprop_indexed != NULL);
-	free(aprop_indexed);
-}
-
-/** Deallocate address.
- *
- * @param address	Address node
- */
-void rdata_address_delete(rdata_address_t *address)
-{
-	assert(address != NULL);
-	free(address);
-}
-
-/** Deallocate value.
- *
- * @param value		Value node
- */
-void rdata_value_delete(rdata_value_t *value)
-{
-	assert(value != NULL);
-	free(value);
-}
-
-/** Deallocate var node.
- *
- * @param var	Var node
- */
-void rdata_var_delete(rdata_var_t *var)
-{
-	assert(var != NULL);
-	free(var);
-}
-
-/** Deallocate boolean.
- *
- * @param bool_v		Boolean
- */
-void rdata_bool_delete(rdata_bool_t *bool_v)
-{
-	assert(bool_v != NULL);
-	free(bool_v);
-}
-
-/** Deallocate character.
- *
- * @param char_v	Character
- */
-void rdata_char_delete(rdata_char_t *char_v)
-{
-	assert(char_v != NULL);
-	free(char_v);
-}
-
-/** Deallocate integer.
- *
- * @param int_v		Integer
- */
-void rdata_int_delete(rdata_int_t *int_v)
-{
-	assert(int_v != NULL);
-	free(int_v);
-}
-
-/** Deallocate string.
- *
- * @param string_v	String
- */
-void rdata_string_delete(rdata_string_t *string_v)
-{
-	assert(string_v != NULL);
-	free(string_v);
-}
-
-/** Deallocate reference.
- *
- * @param ref_v		Reference
- */
-void rdata_ref_delete(rdata_ref_t *ref_v)
-{
-	assert(ref_v != NULL);
-	free(ref_v);
-}
-
-/** Deallocate delegate.
- *
- * @param deleg_v		Reference
- */
-void rdata_deleg_delete(rdata_deleg_t *deleg_v)
-{
-	assert(deleg_v != NULL);
-	free(deleg_v);
-}
-
-/** Deallocate enum.
- *
- * @param enum_v		Reference
- */
-void rdata_enum_delete(rdata_enum_t *enum_v)
-{
-	assert(enum_v != NULL);
-	free(enum_v);
-}
-
-/** Deallocate array.
- *
- * @param array_v		Array
- */
-void rdata_array_delete(rdata_array_t *array_v)
-{
-	assert(array_v != NULL);
-	free(array_v);
-}
-
-/** Deallocate object.
- *
- * @param object_v		Object
- */
-void rdata_object_delete(rdata_object_t *object_v)
-{
-	assert(object_v != NULL);
-	free(object_v);
-}
-
-/** Deallocate resource.
- *
- * @param resource_v		Resource
- */
-void rdata_resource_delete(rdata_resource_t *resource_v)
-{
-	assert(resource_v != NULL);
-	free(resource_v);
-}
-
-/** Deallocate symbol.
- *
- * @param symbol_v		Symbol
- */
-void rdata_symbol_delete(rdata_symbol_t *symbol_v)
-{
-	assert(symbol_v != NULL);
-	free(symbol_v);
-}
-
-/** Copy value.
- *
- * @param src		Input value
- * @param dest		Place to store pointer to new value
- */
-void rdata_value_copy(rdata_value_t *src, rdata_value_t **dest)
-{
-	assert(src != NULL);
-
-	*dest = rdata_value_new();
-	rdata_var_copy(src->var, &(*dest)->var);
-}
-
-/** Make copy of a variable.
- *
- * Creates a new var node that is an exact copy of an existing var node.
- * This can be thought of as a shallow copy.
- *
- * @param src		Source var node.
- * @param dest		Place to store pointer to new var node.
- */
-void rdata_var_copy(rdata_var_t *src, rdata_var_t **dest)
-{
-	rdata_var_t *nvar;
-
-	nvar = rdata_var_new(src->vc);
-	rdata_var_copy_to(src, nvar);
-
-	*dest = nvar;
-}
-
-/** Copy variable content to another variable.
- *
- * Writes an exact copy of an existing var node to another var node.
- * The varclass of @a src and @a dest must match. The content of
- * @a dest.u must be invalid.
- *
- * @param src		Source var node.
- * @param dest		Destination var node.
- */
-static void rdata_var_copy_to(rdata_var_t *src, rdata_var_t *dest)
-{
-	dest->vc = src->vc;
-
-	switch (src->vc) {
-	case vc_bool:
-		rdata_bool_copy(src->u.bool_v, &dest->u.bool_v);
-		break;
-	case vc_char:
-		rdata_char_copy(src->u.char_v, &dest->u.char_v);
-		break;
-	case vc_int:
-		rdata_int_copy(src->u.int_v, &dest->u.int_v);
-		break;
-	case vc_string:
-		rdata_string_copy(src->u.string_v, &dest->u.string_v);
-		break;
-	case vc_ref:
-		rdata_ref_copy(src->u.ref_v, &dest->u.ref_v);
-		break;
-	case vc_deleg:
-		rdata_deleg_copy(src->u.deleg_v, &dest->u.deleg_v);
-		break;
-	case vc_enum:
-		rdata_enum_copy(src->u.enum_v, &dest->u.enum_v);
-		break;
-	case vc_array:
-		rdata_array_copy(src->u.array_v, &dest->u.array_v);
-		break;
-	case vc_object:
-		rdata_object_copy(src->u.object_v, &dest->u.object_v);
-		break;
-	case vc_resource:
-		rdata_resource_copy(src->u.resource_v, &dest->u.resource_v);
-		break;
-	case vc_symbol:
-		rdata_symbol_copy(src->u.symbol_v, &dest->u.symbol_v);
-		break;
-	}
-}
-
-/** Copy boolean.
- *
- * @param src		Source boolean
- * @param dest		Place to store pointer to new boolean
- */
-static void rdata_bool_copy(rdata_bool_t *src, rdata_bool_t **dest)
-{
-	*dest = rdata_bool_new();
-	(*dest)->value = src->value;
-}
-
-/** Copy character.
- *
- * @param src		Source character
- * @param dest		Place to store pointer to new character
- */
-static void rdata_char_copy(rdata_char_t *src, rdata_char_t **dest)
-{
-	*dest = rdata_char_new();
-	bigint_clone(&src->value, &(*dest)->value);
-}
-
-/** Copy integer.
- *
- * @param src		Source integer
- * @param dest		Place to store pointer to new integer
- */
-static void rdata_int_copy(rdata_int_t *src, rdata_int_t **dest)
-{
-	*dest = rdata_int_new();
-	bigint_clone(&src->value, &(*dest)->value);
-}
-
-/** Copy string.
- *
- * @param src		Source string.
- * @param dest		Place to store pointer to new string.
- */
-static void rdata_string_copy(rdata_string_t *src, rdata_string_t **dest)
-{
-	*dest = rdata_string_new();
-	(*dest)->value = src->value;
-}
-
-/** Copy reference.
- *
- * @param src		Source reference.
- * @param dest		Place to store pointer to new reference.
- */
-static void rdata_ref_copy(rdata_ref_t *src, rdata_ref_t **dest)
-{
-	*dest = rdata_ref_new();
-	(*dest)->vref = src->vref;
-}
-
-/** Copy delegate.
- *
- * @param src		Source delegate.
- * @param dest		Place to store pointer to new delegate.
- */
-static void rdata_deleg_copy(rdata_deleg_t *src, rdata_deleg_t **dest)
-{
-	*dest = rdata_deleg_new();
-	(*dest)->obj = src->obj;
-	(*dest)->sym = src->sym;
-}
-
-/** Copy enum value.
- *
- * @param src		Source enum value.
- * @param dest		Place to store pointer to new enum value.
- */
-static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest)
-{
-	*dest = rdata_enum_new();
-	(*dest)->value = src->value;
-}
-
-/** Copy array.
- *
- * @param src		Source array.
- * @param dest		Place to store pointer to new array.
- */
-static void rdata_array_copy(rdata_array_t *src, rdata_array_t **dest)
-{
-	(void) src;
-	(void) dest;
-	printf("Unimplemented: Copy array.\n");
-	exit(1);
-}
-
-/** Copy object.
- *
- * @param src		Source object.
- * @param dest		Place to store pointer to new object.
- */
-static void rdata_object_copy(rdata_object_t *src, rdata_object_t **dest)
-{
-	(void) src;
-	(void) dest;
-	printf("Unimplemented: Copy object.\n");
-	abort();
-}
-
-/** Copy resource.
- *
- * @param src		Source resource.
- * @param dest		Place to store pointer to new resource.
- */
-static void rdata_resource_copy(rdata_resource_t *src, rdata_resource_t **dest)
-{
-	*dest = rdata_resource_new();
-	(*dest)->data = src->data;
-}
-
-/** Copy symbol.
- *
- * @param src		Source symbol.
- * @param dest		Place to store pointer to new symbol.
- */
-static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest)
-{
-	*dest = rdata_symbol_new();
-	(*dest)->sym = src->sym;
-}
-
-/** Destroy var node.
- *
- * @param var	Var node
- */
-void rdata_var_destroy(rdata_var_t *var)
-{
-	/* First destroy class-specific part */
-	rdata_var_destroy_inner(var);
-
-	/* Deallocate var node */
-	rdata_var_delete(var);
-}
-
-/** Destroy inside of var node.
- *
- * Destroy content of var node, but do not deallocate the var node
- * itself.
- *
- * @param var	Var node
- */
-static void rdata_var_destroy_inner(rdata_var_t *var)
-{
-	/* First destroy class-specific part */
-
-	switch (var->vc) {
-	case vc_bool:
-		rdata_bool_destroy(var->u.bool_v);
-		break;
-	case vc_char:
-		rdata_char_destroy(var->u.char_v);
-		break;
-	case vc_int:
-		rdata_int_destroy(var->u.int_v);
-		break;
-	case vc_string:
-		rdata_string_destroy(var->u.string_v);
-		break;
-	case vc_ref:
-		rdata_ref_destroy(var->u.ref_v);
-		break;
-	case vc_deleg:
-		rdata_deleg_destroy(var->u.deleg_v);
-		break;
-	case vc_enum:
-		rdata_enum_destroy(var->u.enum_v);
-		break;
-	case vc_array:
-		rdata_array_destroy(var->u.array_v);
-		break;
-	case vc_object:
-		rdata_object_destroy(var->u.object_v);
-		break;
-	case vc_resource:
-		rdata_resource_destroy(var->u.resource_v);
-		break;
-	case vc_symbol:
-		rdata_symbol_destroy(var->u.symbol_v);
-		break;
-	}
-}
-
-/** Destroy item.
- *
- * Destroy an item including the value or address within.
- *
- * @param item	Item
- */
-void rdata_item_destroy(rdata_item_t *item)
-{
-	/* First destroy class-specific part */
-
-	switch (item->ic) {
-	case ic_address:
-		rdata_address_destroy(item->u.address);
-		break;
-	case ic_value:
-		rdata_value_destroy(item->u.value);
-		break;
-	}
-
-	/* Deallocate item node */
-	rdata_item_delete(item);
-}
-
-/** Destroy address.
- *
- * Destroy an address node.
- *
- * @param address	Address
- */
-void rdata_address_destroy(rdata_address_t *address)
-{
-	switch (address->ac) {
-	case ac_var:
-		rdata_addr_var_destroy(address->u.var_a);
-		break;
-	case ac_prop:
-		rdata_addr_prop_destroy(address->u.prop_a);
-		break;
-	}
-
-	/* Deallocate address node */
-	rdata_address_delete(address);
-}
-
-/** Destroy variable address.
- *
- * Destroy a variable address node.
- *
- * @param addr_var	Variable address
- */
-void rdata_addr_var_destroy(rdata_addr_var_t *addr_var)
-{
-	addr_var->vref = NULL;
-
-	/* Deallocate variable address node */
-	rdata_addr_var_delete(addr_var);
-}
-
-/** Destroy property address.
- *
- * Destroy a property address node.
- *
- * @param addr_prop	Property address
- */
-void rdata_addr_prop_destroy(rdata_addr_prop_t *addr_prop)
-{
-	switch (addr_prop->apc) {
-	case apc_named:
-		rdata_aprop_named_destroy(addr_prop->u.named);
-		break;
-	case apc_indexed:
-		rdata_aprop_indexed_destroy(addr_prop->u.indexed);
-		break;
-	}
-
-	if (addr_prop->tvalue != NULL) {
-		rdata_value_destroy(addr_prop->tvalue);
-		addr_prop->tvalue = NULL;
-	}
-
-	addr_prop->tpos = NULL;
-
-	/* Deallocate property address node */
-	rdata_addr_prop_delete(addr_prop);
-}
-
-/** Destroy named property address.
- *
- * Destroy a named property address node.
- *
- * @param aprop_named	Named property address
- */
-void rdata_aprop_named_destroy(rdata_aprop_named_t *aprop_named)
-{
-	rdata_deleg_destroy(aprop_named->prop_d);
-
-	/* Deallocate named property address node */
-	rdata_aprop_named_delete(aprop_named);
-}
-
-/** Destroy indexed property address.
- *
- * Destroy a indexed property address node.
- *
- * @param aprop_indexed		Indexed property address
- */
-void rdata_aprop_indexed_destroy(rdata_aprop_indexed_t *aprop_indexed)
-{
-	list_node_t *arg_node;
-	rdata_item_t *arg_i;
-
-	/* Destroy the object delegate. */
-	rdata_deleg_destroy(aprop_indexed->object_d);
-
-	/*
-	 * Walk through all argument items (indices) and destroy them,
-	 * removing them from the list as well.
-	 */
-	while (!list_is_empty(&aprop_indexed->args)) {
-		arg_node = list_first(&aprop_indexed->args);
-		arg_i = list_node_data(arg_node, rdata_item_t *);
-
-		rdata_item_destroy(arg_i);
-		list_remove(&aprop_indexed->args, arg_node);
-	}
-
-	/* Destroy the now empty list */
-	list_fini(&aprop_indexed->args);
-
-	/* Deallocate indexed property address node */
-	rdata_aprop_indexed_delete(aprop_indexed);
-}
-
-/** Destroy value.
- *
- * Destroy a value node.
- *
- * @param value		Value
- */
-void rdata_value_destroy(rdata_value_t *value)
-{
-	/* Assumption: Var nodes in values are not shared. */
-	rdata_var_destroy(value->var);
-
-	/* Deallocate value node */
-	rdata_value_delete(value);
-}
-
-/** Destroy boolean.
- *
- * @param bool_v		Boolean
- */
-static void rdata_bool_destroy(rdata_bool_t *bool_v)
-{
-	rdata_bool_delete(bool_v);
-}
-
-/** Destroy character.
- *
- * @param char_v	Character
- */
-static void rdata_char_destroy(rdata_char_t *char_v)
-{
-	bigint_destroy(&char_v->value);
-	rdata_char_delete(char_v);
-}
-
-/** Destroy integer.
- *
- * @param int_v		Integer
- */
-static void rdata_int_destroy(rdata_int_t *int_v)
-{
-	bigint_destroy(&int_v->value);
-	rdata_int_delete(int_v);
-}
-
-/** Destroy string.
- *
- * @param string_v	String
- */
-static void rdata_string_destroy(rdata_string_t *string_v)
-{
-	/*
-	 * String values are shared so we cannot free them. Just deallocate
-	 * the node.
-	 */
-	rdata_string_delete(string_v);
-}
-
-/** Destroy reference.
- *
- * @param ref_v		Reference
- */
-static void rdata_ref_destroy(rdata_ref_t *ref_v)
-{
-	ref_v->vref = NULL;
-	rdata_ref_delete(ref_v);
-}
-
-/** Destroy delegate.
- *
- * @param deleg_v		Reference
- */
-static void rdata_deleg_destroy(rdata_deleg_t *deleg_v)
-{
-	deleg_v->obj = NULL;
-	deleg_v->sym = NULL;
-	rdata_deleg_delete(deleg_v);
-}
-
-/** Destroy enum.
- *
- * @param enum_v		Reference
- */
-static void rdata_enum_destroy(rdata_enum_t *enum_v)
-{
-	enum_v->value = NULL;
-	rdata_enum_delete(enum_v);
-}
-
-/** Destroy array.
- *
- * @param array_v		Array
- */
-static void rdata_array_destroy(rdata_array_t *array_v)
-{
-	int d;
-	size_t n_elems, p;
-
-	/*
-	 * Compute total number of elements in array.
-	 * At the same time zero out the extent array.
-	 */
-	n_elems = 1;
-	for (d = 0; d < array_v->rank; d++) {
-		n_elems = n_elems * array_v->extent[d];
-		array_v->extent[d] = 0;
-	}
-
-	/* Destroy all elements and zero out the array */
-	for (p = 0; p < n_elems; p++) {
-		rdata_var_delete(array_v->element[p]);
-		array_v->element[p] = NULL;
-	}
-
-	/* Free the arrays */
-	free(array_v->element);
-	free(array_v->extent);
-
-	array_v->rank = 0;
-
-	/* Deallocate the node */
-	rdata_array_delete(array_v);
-}
-
-/** Destroy object.
- *
- * @param object_v		Object
- */
-static void rdata_object_destroy(rdata_object_t *object_v)
-{
-	/* XXX TODO */
-	rdata_object_delete(object_v);
-}
-
-/** Destroy resource.
- *
- * @param resource_v		Resource
- */
-static void rdata_resource_destroy(rdata_resource_t *resource_v)
-{
-	/*
-	 * XXX Presumably this should be handled by the appropriate
-	 * built-in module, so, some call-back function would be required.
-	 */
-	resource_v->data = NULL;
-	rdata_resource_delete(resource_v);
-}
-
-/** Destroy symbol.
- *
- * @param symbol_v		Symbol
- */
-static void rdata_symbol_destroy(rdata_symbol_t *symbol_v)
-{
-	symbol_v->sym = NULL;
-	rdata_symbol_delete(symbol_v);
-}
-
-/** Read data from a variable.
- *
- * This copies data from the variable to a value item. Ideally any read access
- * to a program variable should go through this function. (Keep in mind
- * that although values are composed of var nodes internally, but are not
- * variables per se. Therefore this function is not used to read from values)
- *
- * @param var		Variable to read from (var node where it is stored).
- * @param ritem		Place to store pointer to new value item read from
- *			the variable.
- */
-void rdata_var_read(rdata_var_t *var, rdata_item_t **ritem)
-{
-	rdata_value_t *value;
-	rdata_var_t *rvar;
-
-	/* Perform a shallow copy of @a var. */
-	rdata_var_copy(var, &rvar);
-
-	value = rdata_value_new();
-	value->var = rvar;
-	*ritem = rdata_item_new(ic_value);
-	(*ritem)->u.value = value;
-}
-
-/** Write data to a variable.
- *
- * This copies data to the variable from a value. Ideally any write access
- * to a program variable should go through this function. (Keep in mind
- * that even though values are composed of var nodes internally, but are not
- * variables per se. Therefore this function is not used to write to values)
- *
- * @param var		Variable to write to (var node where it is stored).
- * @param value		The value to write.
- */
-void rdata_var_write(rdata_var_t *var, rdata_value_t *value)
-{
-	/* Free old content of var->u */
-	rdata_var_destroy_inner(var);
-
-	/* Perform a shallow copy of @c value->var. */
-	rdata_var_copy_to(value->var, var);
-}
-
-/** Print data item in human-readable form.
- *
- * @param item		Item to print.
- */
-void rdata_item_print(rdata_item_t *item)
-{
-	if (item == NULL) {
-		printf("none");
-		return;
-	}
-
-	switch (item->ic) {
-	case ic_address:
-		printf("address:");
-		rdata_address_print(item->u.address);
-		break;
-	case ic_value:
-		printf("value:");
-		rdata_value_print(item->u.value);
-		break;
-	}
-}
-
-/** Print address in human-readable form.
- *
- * Actually this displays contents of the var node that is being addressed.
- *
- * XXX Maybe we should really rather print the address and not the data
- * it is pointing to?
- *
- * @param item		Address to print.
- */
-static void rdata_address_print(rdata_address_t *address)
-{
-	switch (address->ac) {
-	case ac_var:
-		rdata_var_print(address->u.var_a->vref);
-		break;
-	case ac_prop:
-		printf("Warning: Unimplemented: Print property address.\n");
-		break;
-	}
-}
-
-/** Print value in human-readable form.
- *
- * @param value		Value to print.
- */
-void rdata_value_print(rdata_value_t *value)
-{
-	rdata_var_print(value->var);
-}
-
-/** Print contents of var node in human-readable form.
- *
- * @param item		Var node to print.
- */
-static void rdata_var_print(rdata_var_t *var)
-{
-	int val;
-
-	switch (var->vc) {
-	case vc_bool:
-		printf("bool(%s)", var->u.bool_v->value ? "true" : "false");
-		break;
-	case vc_char:
-		printf("char(");
-		if (bigint_get_value_int(&var->u.char_v->value, &val) == EOK)
-			printf("'%c'", val);
-		else
-			printf("???:x%x\n", (unsigned) val);
-		printf(")");
-		break;
-	case vc_int:
-		printf("int(");
-		bigint_print(&var->u.int_v->value);
-		printf(")");
-		break;
-	case vc_string:
-		printf("string(\"%s\")", var->u.string_v->value);
-		break;
-	case vc_ref:
-		if (var->u.ref_v->vref != NULL) {
-			printf("ref(");
-			rdata_var_print(var->u.ref_v->vref);
-			printf(")");
-		} else {
-			printf("nil");
-		}
-		break;
-	case vc_deleg:
-		printf("deleg(");
-		if (var->u.deleg_v->sym != NULL) {
-			if (var->u.deleg_v->obj != NULL) {
-				rdata_var_print(var->u.deleg_v->obj);
-				printf(",");
-			}
-			symbol_print_fqn(var->u.deleg_v->sym);
-		} else {
-			printf("nil");
-		}
-		printf(")");
-		break;
-	case vc_enum:
-		symbol_print_fqn(
-		    enum_to_symbol(var->u.enum_v->value->outer_enum));
-		printf(".%s",
-		    strtab_get_str(var->u.enum_v->value->name->sid));
-		break;
-	case vc_array:
-		printf("array");
-		break;
-	case vc_object:
-		printf("object");
-		break;
-	case vc_resource:
-		printf("resource(%p)", var->u.resource_v->data);
-		break;
-	case vc_symbol:
-		printf("symbol(");
-		if (var->u.symbol_v->sym != NULL) {
-			symbol_print_fqn(var->u.symbol_v->sym);
-		} else {
-			printf("nil");
-		}
-		printf(")");
-		break;
-	}
-}
Index: pace/app/sbi/src/rdata.h
===================================================================
--- uspace/app/sbi/src/rdata.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RDATA_H_
-#define RDATA_H_
-
-#include "mytypes.h"
-
-rdata_item_t *rdata_item_new(item_class_t ic);
-rdata_addr_var_t *rdata_addr_var_new(void);
-rdata_aprop_named_t *rdata_aprop_named_new(void);
-rdata_aprop_indexed_t *rdata_aprop_indexed_new(void);
-rdata_addr_prop_t *rdata_addr_prop_new(aprop_class_t apc);
-rdata_address_t *rdata_address_new(address_class_t ac);
-rdata_value_t *rdata_value_new(void);
-
-rdata_var_t *rdata_var_new(var_class_t vc);
-void rdata_var_delete(rdata_var_t *var);
-rdata_ref_t *rdata_ref_new(void);
-rdata_deleg_t *rdata_deleg_new(void);
-rdata_enum_t *rdata_enum_new(void);
-rdata_array_t *rdata_array_new(int rank);
-rdata_object_t *rdata_object_new(void);
-rdata_bool_t *rdata_bool_new(void);
-rdata_char_t *rdata_char_new(void);
-rdata_int_t *rdata_int_new(void);
-rdata_string_t *rdata_string_new(void);
-rdata_resource_t *rdata_resource_new(void);
-rdata_symbol_t *rdata_symbol_new(void);
-
-void rdata_address_delete(rdata_address_t *address);
-void rdata_value_delete(rdata_value_t *value);
-void rdata_var_delete(rdata_var_t *var);
-void rdata_item_delete(rdata_item_t *item);
-void rdata_addr_var_delete(rdata_addr_var_t *addr_var);
-void rdata_addr_prop_delete(rdata_addr_prop_t *addr_prop);
-void rdata_aprop_named_delete(rdata_aprop_named_t *aprop_named);
-void rdata_aprop_indexed_delete(rdata_aprop_indexed_t *aprop_indexed);
-
-void rdata_bool_delete(rdata_bool_t *bool_v);
-void rdata_char_delete(rdata_char_t *char_v);
-void rdata_int_delete(rdata_int_t *int_v);
-void rdata_string_delete(rdata_string_t *string_v);
-void rdata_ref_delete(rdata_ref_t *ref_v);
-void rdata_deleg_delete(rdata_deleg_t *deleg_v);
-void rdata_enum_delete(rdata_enum_t *enum_v);
-void rdata_array_delete(rdata_array_t *array_v);
-void rdata_object_delete(rdata_object_t *object_v);
-void rdata_resource_delete(rdata_resource_t *resource_v);
-void rdata_symbol_delete(rdata_symbol_t *symbol_v);
-
-void rdata_array_alloc_element(rdata_array_t *array);
-void rdata_value_copy(rdata_value_t *val, rdata_value_t **rval);
-void rdata_var_copy(rdata_var_t *src, rdata_var_t **dest);
-
-void rdata_address_destroy(rdata_address_t *address);
-void rdata_addr_var_destroy(rdata_addr_var_t *addr_var);
-void rdata_addr_prop_destroy(rdata_addr_prop_t *addr_prop);
-void rdata_aprop_named_destroy(rdata_aprop_named_t *aprop_named);
-void rdata_aprop_indexed_destroy(rdata_aprop_indexed_t *aprop_indexed);
-void rdata_value_destroy(rdata_value_t *value);
-void rdata_var_destroy(rdata_var_t *var);
-void rdata_item_destroy(rdata_item_t *item);
-
-void rdata_var_read(rdata_var_t *var, rdata_item_t **ritem);
-void rdata_var_write(rdata_var_t *var, rdata_value_t *value);
-
-void rdata_item_print(rdata_item_t *item);
-void rdata_value_print(rdata_value_t *value);
-
-#endif
Index: pace/app/sbi/src/rdata_t.h
===================================================================
--- uspace/app/sbi/src/rdata_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Run-time data representation. */
-
-#ifndef RDATA_T_H_
-#define RDATA_T_H_
-
-#include "intmap_t.h"
-
-/** Boolean variable. */
-typedef struct {
-	bool_t value;
-} rdata_bool_t;
-
-/** Character variable.
- *
- * Sysel character type should be able to store arbitrarily (or at least
- * very) large character sets.
- */
-typedef struct {
-	bigint_t value;
-} rdata_char_t;
-
-/** Integer variable.
- *
- * Sysel int type should be able to store arbitrarily (or at least
- * very) large numbers.
- */
-typedef struct {
-	bigint_t value;
-} rdata_int_t;
-
-/** String variable */
-typedef struct {
-	const char *value;
-} rdata_string_t;
-
-/** Reference variable */
-typedef struct {
-	struct rdata_var *vref;
-} rdata_ref_t;
-
-/** Delegate variable
- *
- * A delegate variable points to a static or non-static symbol. If the
- * symbol is non static, @c obj points to the object the symbol
- * belongs to.
- */
-typedef struct {
-	/** Object or @c NULL if deleg. points to a static function. */
-	struct rdata_var *obj;
-
-	/** Member symbol. */
-	struct stree_symbol *sym;
-} rdata_deleg_t;
-
-/** Enumerated type value. */
-typedef struct {
-	/** Enum member declaration */
-	struct stree_embr *value;
-} rdata_enum_t;
-
-/** Array variable */
-typedef struct {
-	/** Rank */
-	int rank;
-
-	/** Extents (@c rank entries) */
-	int *extent;
-
-	/**
-	 * Elements (extent[0] * extent[1] * ... extent[rank - 1] entries)
-	 * stored in lexicographical order. Each element is (rdata_var_t *).
-	 */
-	struct rdata_var **element;
-} rdata_array_t;
-
-/** Object variable */
-typedef struct {
-	/** Class of this object (symbol) */
-	struct stree_symbol *class_sym;
-
-	/** @c sn_static if this is a static object (i.e. class object) */
-	statns_t static_obj;
-
-	/** Map field name SID to field data */
-	intmap_t fields; /* of (rdata_var_t *) */
-} rdata_object_t;
-
-/** Resource handle
- *
- * Binding to external data. This type can be used to refer to data used
- * by builtin functions (such as files).
- */
-typedef struct {
-	/** Only understood by the right builtin function. */
-	void *data;
-} rdata_resource_t;
-
-/** Symbol reference variable
- *
- * A symbol reference points to a program symbol.
- */
-typedef struct {
-	/** Program symbol. */
-	struct stree_symbol *sym;
-} rdata_symbol_t;
-
-typedef enum var_class {
-	/** Boolean */
-	vc_bool,
-
-	/** Character */
-	vc_char,
-
-	/** Integer */
-	vc_int,
-
-	/** String */
-	vc_string,
-
-	/** Reference */
-	vc_ref,
-
-	/** Delegate */
-	vc_deleg,
-
-	/** Enumerated type value */
-	vc_enum,
-
-	/** Array */
-	vc_array,
-
-	/** Object */
-	vc_object,
-
-	/** Interpreter builtin resource */
-	vc_resource,
-
-	/** Symbol reference */
-	vc_symbol
-} var_class_t;
-
-/** Variable.
- *
- * A piece of memory holding one of the basic types of data element.
- * It is addressable (via rdata_var_t *) and mutable, at least from
- * internal point of view of the interpreter.
- */
-typedef struct rdata_var {
-	var_class_t vc;
-
-	union {
-		rdata_bool_t *bool_v;
-		rdata_char_t *char_v;
-		rdata_int_t *int_v;
-		rdata_string_t *string_v;
-		rdata_ref_t *ref_v;
-		rdata_deleg_t *deleg_v;
-		rdata_enum_t *enum_v;
-		rdata_array_t *array_v;
-		rdata_object_t *object_v;
-		rdata_resource_t *resource_v;
-		rdata_symbol_t *symbol_v;
-	} u;
-} rdata_var_t;
-
-/** Address class */
-typedef enum {
-	/** Variable address */
-	ac_var,
-
-	/** Property address */
-	ac_prop
-} address_class_t;
-
-/** Variable address */
-typedef struct {
-	/** Targeted variable */
-	rdata_var_t *vref;
-} rdata_addr_var_t;
-
-/** Named property address */
-typedef struct {
-	/** Delegate to the property */
-	rdata_deleg_t *prop_d;
-} rdata_aprop_named_t;
-
-/** Indexed property address */
-typedef struct {
-	/** Delegate to the object (or CSI) which is being indexed. */
-	rdata_deleg_t *object_d;
-
-	/** Arguments (indices) */
-	list_t args; /* of rdata_item_t */
-} rdata_aprop_indexed_t;
-
-typedef enum {
-	/* Named property address */
-	apc_named,
-
-	/* Indexed property address */
-	apc_indexed
-} aprop_class_t;
-
-/** Property address.
- *
- * When an access or index operation is performed on a property, the getter
- * is run and the prefetched value is stored in @c tvalue. If the property
- * is a non-scalar value type (a struct), then we might want to point to
- * the proper @c var node inside it. @c tpos is used for this purpose.
- *
- * The assignment operator will modify @c tvalue and at the end the setter
- * is called to store @c tvalue back into the property.
- */
-typedef struct {
-	aprop_class_t apc;
-
-	/** Temporary copy of property value or @c NULL when not used. */
-	struct rdata_value *tvalue;
-
-	/**
-	 * Points to the specific var node within @c tvalue that is addressed
-	 * or @c NULL when @c tvalue is not used.
-	 */
-	rdata_var_t *tpos;
-
-	union {
-		rdata_aprop_named_t *named;
-		rdata_aprop_indexed_t *indexed;
-	} u;
-} rdata_addr_prop_t;
-
-/** Address item */
-typedef struct rdata_address {
-	address_class_t ac;
-
-	union {
-		rdata_addr_var_t *var_a;
-		rdata_addr_prop_t *prop_a;
-	} u;
-} rdata_address_t;
-
-/** Value item. */
-typedef struct rdata_value {
-	/**
-	 * Read-only Variable holding a copy of the data. Currently we don't
-	 * allow sharing the same @c var node between different value nodes
-	 * so that when destroying the value we can destroy the var.
-	 *
-	 * We could share this, but would need to reference-count it.
-	 */
-	rdata_var_t *var;
-} rdata_value_t;
-
-typedef enum {
-	/** Address of a variable. */
-	ic_address,
-	/** Value */
-	ic_value
-} item_class_t;
-
-/** Data item.
- *
- * Data item is the result of evaluating an expression. An address expression
- * yields an address item (a.k.a. L-value), a value expression yields a data
- * item (a.k.a. R-value). This model is used to accomodate semantics of the
- * assignment operator.
- */
-typedef struct rdata_item {
-	item_class_t ic;
-
-	union {
-		rdata_address_t *address;
-		rdata_value_t *value;
-	} u;
-} rdata_item_t;
-
-#endif
Index: pace/app/sbi/src/run.c
===================================================================
--- uspace/app/sbi/src/run.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2090 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Runner (executes the code). */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "bigint.h"
-#include "builtin.h"
-#include "cspan.h"
-#include "debug.h"
-#include "intmap.h"
-#include "list.h"
-#include "mytypes.h"
-#include "rdata.h"
-#include "run_expr.h"
-#include "run_texpr.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-#include "tdata.h"
-
-#include "run.h"
-
-static void run_block(run_t *run, stree_block_t *block);
-static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res);
-static void run_vdecl(run_t *run, stree_vdecl_t *vdecl);
-static void run_if(run_t *run, stree_if_t *if_s);
-static void run_switch(run_t *run, stree_switch_t *switch_s);
-static void run_while(run_t *run, stree_while_t *while_s);
-static void run_raise(run_t *run, stree_raise_t *raise_s);
-static void run_break(run_t *run, stree_break_t *break_s);
-static void run_return(run_t *run, stree_return_t *return_s);
-static void run_wef(run_t *run, stree_wef_t *wef_s);
-
-static bool_t run_exc_match(run_t *run, stree_except_t *except_c);
-static stree_csi_t *run_exc_payload_get_csi(run_t *run);
-
-static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *aprop);
-
-static void run_aprop_read(run_t *run, rdata_addr_prop_t *addr_prop,
-    rdata_item_t **ritem);
-static void run_aprop_write(run_t *run, rdata_addr_prop_t *addr_prop,
-    rdata_value_t *value);
-
-static void run_var_new_tprimitive(run_t *run, tdata_primitive_t *tprimitive,
-    rdata_var_t **rvar);
-static void run_var_new_null_ref(run_t *run, rdata_var_t **rvar);
-static void run_var_new_deleg(run_t *run, rdata_var_t **rvar);
-static void run_var_new_enum(run_t *run, tdata_enum_t *tenum,
-    rdata_var_t **rvar);
-
-/** Initialize runner instance.
- *
- * @param run		Runner object
- */
-void run_init(run_t *run)
-{
-	(void) run;
-}
-
-/** Run program.
- *
- * Associates the program @a prog with the runner object and executes
- * it. If a run-time error occurs during the execution (e.g. an unhandled
- * exception), @a run->error will be set to @c b_true when this function
- * returns.
- *
- * @param run		Runner object
- * @param prog		Program to run
- */
-void run_program(run_t *run, stree_program_t *prog)
-{
-	stree_symbol_t *main_fun_sym;
-	stree_fun_t *main_fun;
-	rdata_var_t *main_obj;
-	stree_ident_t *fake_ident;
-	list_t main_args;
-	run_proc_ar_t *proc_ar;
-	rdata_item_t *res;
-
-	/* Note down link to program code. */
-	run->program = prog;
-
-	/* Initialize thread activation record. */
-	run->thread_ar = run_thread_ar_new();
-	list_init(&run->thread_ar->proc_ar);
-	run->thread_ar->bo_mode = bm_none;
-
-	/* Initialize global data structure. */
-	run_gdata_init(run);
-
-	/*
-	 * Find entry point @c Main().
-	 */
-	fake_ident = stree_ident_new();
-	fake_ident->sid = strtab_get_sid("Main");
-	main_fun_sym = symbol_find_epoint(prog, fake_ident);
-	if (main_fun_sym == NULL) {
-		printf("Error: Entry point 'Main' not found.\n");
-		exit(1);
-	}
-
-	main_fun = symbol_to_fun(main_fun_sym);
-	assert(main_fun != NULL);
-
-	main_obj = run_fun_sobject_find(run, main_fun);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found function '");
-	symbol_print_fqn(main_fun_sym);
-	printf("'.\n");
-#endif
-
-	/* Run function @c main. */
-	list_init(&main_args);
-	run_proc_ar_create(run, main_obj, main_fun->proc, &proc_ar);
-	run_proc_ar_set_args(run, proc_ar, &main_args);
-	run_proc(run, proc_ar, &res);
-	run_proc_ar_destroy(run, proc_ar);
-
-	run_exc_check_unhandled(run);
-}
-
-/** Initialize global data.
- *
- * @param run		Runner object
- */
-void run_gdata_init(run_t *run)
-{
-	rdata_object_t *gobject;
-
-	run->gdata = rdata_var_new(vc_object);
-	gobject = rdata_object_new();
-	run->gdata->u.object_v = gobject;
-
-	gobject->class_sym = NULL;
-	gobject->static_obj = sn_static;
-	intmap_init(&gobject->fields);
-}
-
-/** Run procedure.
- *
- * Inserts the provided procedure AR @a proc_ar on the execution stack
- * (in the thread AR) and executes the procedure. The return value
- * of the procedure is stored to *(@a res). @c NULL is stored if the
- * procedure returns no value.
- *
- * If the procedure execution bails out due to an exception, this
- * can be determined by looking at @c bo_mode in thread AR. Also,
- * in this case @c NULL is stored into *(@a res).
- *
- * @param run		Runner object
- * @param proc_ar	Procedure activation record
- * @param res		Place to store procedure return value
- */
-void run_proc(run_t *run, run_proc_ar_t *proc_ar, rdata_item_t **res)
-{
-	stree_proc_t *proc;
-	list_node_t *node;
-
-	proc = proc_ar->proc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Start executing function '");
-	symbol_print_fqn(proc->outer_symbol);
-	printf("'.\n");
-#endif
-	/* Add procedure AR to the stack. */
-	list_append(&run->thread_ar->proc_ar, proc_ar);
-
-	/* Run main procedure block. */
-	if (proc->body != NULL) {
-		run_block(run, proc->body);
-	} else {
-		builtin_run_proc(run, proc);
-	}
-
-	/* Handle bailout. */
-	switch (run->thread_ar->bo_mode) {
-	case bm_stat:
-		/* Break bailout was not caught. */
-		assert(b_false);
-		/* Fallthrough */
-	case bm_proc:
-		run->thread_ar->bo_mode = bm_none;
-		break;
-	default:
-		break;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Done executing procedure '");
-	symbol_print_fqn(proc->outer_symbol);
-	printf("'.\n");
-
-	run_print_fun_bt(run);
-#endif
-	/* Remove procedure activation record from the stack. */
-	node = list_last(&run->thread_ar->proc_ar);
-	assert(list_node_data(node, run_proc_ar_t *) == proc_ar);
-	list_remove(&run->thread_ar->proc_ar, node);
-
-	/* Procedure should not return an address. */
-	assert(proc_ar->retval == NULL || proc_ar->retval->ic == ic_value);
-	*res = proc_ar->retval;
-}
-
-/** Run code block.
- *
- * @param run		Runner object
- * @param block		Block to run
- */
-static void run_block(run_t *run, stree_block_t *block)
-{
-	run_proc_ar_t *proc_ar;
-	run_block_ar_t *block_ar;
-	list_node_t *node;
-	stree_stat_t *stat;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing one code block.\n");
-#endif
-
-	/* Create block activation record. */
-	block_ar = run_block_ar_new();
-	intmap_init(&block_ar->vars);
-
-	/* Add block activation record to the stack. */
-	proc_ar = run_get_current_proc_ar(run);
-	list_append(&proc_ar->block_ar, block_ar);
-
-	node = list_first(&block->stats);
-	while (node != NULL) {
-		stat = list_node_data(node, stree_stat_t *);
-		run_stat(run, stat, NULL);
-
-		if (run->thread_ar->bo_mode != bm_none)
-			break;
-
-		node = list_next(&block->stats, node);
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Done executing code block.\n");
-#endif
-
-	/* Remove block activation record from the stack. */
-	node = list_last(&proc_ar->block_ar);
-	assert(list_node_data(node, run_block_ar_t *) == block_ar);
-	list_remove(&proc_ar->block_ar, node);
-
-	/* Deallocate block activation record. */
-	run_block_ar_destroy(run, block_ar);
-}
-
-/** Run statement.
- *
- * Executes a statement. If @a res is not NULL and the statement is an
- * expression statement with a value, the value item will be stored to
- * @a res.
- *
- * @param run	Runner object
- * @param stat	Statement to run
- * @param res	Place to store exps result or NULL if not interested
- */
-void run_stat(run_t *run, stree_stat_t *stat, rdata_item_t **res)
-{
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing one statement %p.\n", stat);
-#endif
-
-	if (res != NULL)
-		*res = NULL;
-
-	switch (stat->sc) {
-	case st_exps:
-		run_exps(run, stat->u.exp_s, res);
-		break;
-	case st_vdecl:
-		run_vdecl(run, stat->u.vdecl_s);
-		break;
-	case st_if:
-		run_if(run, stat->u.if_s);
-		break;
-	case st_switch:
-		run_switch(run, stat->u.switch_s);
-		break;
-	case st_while:
-		run_while(run, stat->u.while_s);
-		break;
-	case st_raise:
-		run_raise(run, stat->u.raise_s);
-		break;
-	case st_break:
-		run_break(run, stat->u.break_s);
-		break;
-	case st_return:
-		run_return(run, stat->u.return_s);
-		break;
-	case st_wef:
-		run_wef(run, stat->u.wef_s);
-		break;
-	case st_for:
-		printf("Ignoring unimplemented statement type %d.\n", stat->sc);
-		break;
-	}
-}
-
-/** Run expression statement.
- *
- * Executes an expression statement. If @a res is not NULL then the value
- * of the expression (or NULL if it has no value) will be stored to @a res.
- *
- * @param run	Runner object
- * @param exps	Expression statement to run
- * @param res	Place to store exps result or NULL if not interested
- */
-static void run_exps(run_t *run, stree_exps_t *exps, rdata_item_t **res)
-{
-	rdata_item_t *rexpr;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing expression statement.\n");
-#endif
-	run_expr(run, exps->expr, &rexpr);
-
-	/*
-	 * If the expression has a value, the caller should have asked for it.
-	 */
-	assert(res != NULL || rexpr == NULL);
-
-	if (res != NULL)
-		*res = rexpr;
-}
-
-/** Run variable declaration statement.
- *
- * @param run	Runner object
- * @param vdecl	Variable declaration statement to run
- */
-static void run_vdecl(run_t *run, stree_vdecl_t *vdecl)
-{
-	run_block_ar_t *block_ar;
-	rdata_var_t *var, *old_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing variable declaration statement.\n");
-#endif
-	/* Create variable and initialize with default value. */
-	run_var_new(run, vdecl->titem, &var);
-
-	block_ar = run_get_current_block_ar(run);
-	old_var = (rdata_var_t *) intmap_get(&block_ar->vars, vdecl->name->sid);
-
-	if (old_var != NULL) {
-		printf("Error: Duplicate variable '%s'\n",
-		    strtab_get_str(vdecl->name->sid));
-		exit(1);
-	}
-
-	intmap_set(&block_ar->vars, vdecl->name->sid, var);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Declared variable '%s'\n", strtab_get_str(vdecl->name->sid));
-#endif
-}
-
-/** Run @c if statement.
- *
- * @param run	Runner object
- * @param if_s	If statement to run
- */
-static void run_if(run_t *run, stree_if_t *if_s)
-{
-	rdata_item_t *rcond;
-	list_node_t *ifc_node;
-	stree_if_clause_t *ifc;
-	bool_t rcond_b, clause_fired;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing if statement.\n");
-#endif
-	clause_fired = b_false;
-	ifc_node = list_first(&if_s->if_clauses);
-
-	/* Walk through all if/elif clauses and see if they fire. */
-
-	while (ifc_node != NULL) {
-		/* Get if/elif clause */
-		ifc = list_node_data(ifc_node, stree_if_clause_t *);
-
-		run_expr(run, ifc->cond, &rcond);
-		if (run_is_bo(run))
-			return;
-
-		rcond_b = run_item_boolean_value(run, rcond);
-		rdata_item_destroy(rcond);
-
-		if (rcond_b == b_true) {
-#ifdef DEBUG_RUN_TRACE
-			printf("Taking non-default path.\n");
-#endif
-			run_block(run, ifc->block);
-			clause_fired = b_true;
-			break;
-		}
-
-		ifc_node = list_next(&if_s->if_clauses, ifc_node);
-	}
-
-	/* If no if/elif clause fired, invoke the else clause. */
-	if (clause_fired == b_false && if_s->else_block != NULL) {
-#ifdef DEBUG_RUN_TRACE
-		printf("Taking default path.\n");
-#endif
-		run_block(run, if_s->else_block);
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("If statement terminated.\n");
-#endif
-}
-
-/** Run @c switch statement.
- *
- * @param run		Runner object
- * @param switch_s	Switch statement to run
- */
-static void run_switch(run_t *run, stree_switch_t *switch_s)
-{
-	rdata_item_t *rsexpr, *rsexpr_vi;
-	rdata_item_t *rwexpr, *rwexpr_vi;
-	list_node_t *whenc_node;
-	stree_when_t *whenc;
-	list_node_t *expr_node;
-	stree_expr_t *expr;
-	bool_t clause_fired;
-	bool_t equal;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing switch statement.\n");
-#endif
-	rsexpr_vi = NULL;
-
-	/* Evaluate switch expression */
-	run_expr(run, switch_s->expr, &rsexpr);
-	if (run_is_bo(run))
-		goto cleanup;
-
-	/* Convert to value item */
-	run_cvt_value_item(run, rsexpr, &rsexpr_vi);
-	rdata_item_destroy(rsexpr);
-	if (run_is_bo(run))
-		goto cleanup;
-
-	clause_fired = b_false;
-	whenc_node = list_first(&switch_s->when_clauses);
-
-	/* Walk through all when clauses and see if they fire. */
-
-	while (whenc_node != NULL) {
-		/* Get when clause */
-		whenc = list_node_data(whenc_node, stree_when_t *);
-
-		expr_node = list_first(&whenc->exprs);
-
-		/* Walk through all expressions in the when clause */
-		while (expr_node != NULL) {
-			/* Get expression */
-			expr = list_node_data(expr_node, stree_expr_t *);
-
-			/* Evaluate expression */
-			run_expr(run, expr, &rwexpr);
-			if (run_is_bo(run))
-				goto cleanup;
-
-			/* Convert to value item */
-			run_cvt_value_item(run, rwexpr, &rwexpr_vi);
-			rdata_item_destroy(rwexpr);
-			if (run_is_bo(run)) {
-				rdata_item_destroy(rwexpr_vi);
-				goto cleanup;
-			}
-
-			/* Check if values are equal ('==') */
-			run_equal(run, rsexpr_vi->u.value,
-			    rwexpr_vi->u.value, &equal);
-			rdata_item_destroy(rwexpr_vi);
-			if (run_is_bo(run))
-				goto cleanup;
-
-			if (equal) {
-#ifdef DEBUG_RUN_TRACE
-				printf("Taking non-default path.\n");
-#endif
-				run_block(run, whenc->block);
-				clause_fired = b_true;
-				break;
-			}
-
-			expr_node = list_next(&whenc->exprs, expr_node);
-		}
-
-		if (clause_fired)
-			break;
-
-		whenc_node = list_next(&switch_s->when_clauses, whenc_node);
-	}
-
-	/* If no when clause fired, invoke the else clause. */
-	if (clause_fired == b_false && switch_s->else_block != NULL) {
-#ifdef DEBUG_RUN_TRACE
-		printf("Taking default path.\n");
-#endif
-		run_block(run, switch_s->else_block);
-	}
-cleanup:
-	if (rsexpr_vi != NULL)
-		rdata_item_destroy(rsexpr_vi);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Switch statement terminated.\n");
-#endif
-}
-
-/** Run @c while statement.
- *
- * @param run		Runner object
- * @param while_s	While statement to run
- */
-static void run_while(run_t *run, stree_while_t *while_s)
-{
-	rdata_item_t *rcond;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing while statement.\n");
-#endif
-	run_expr(run, while_s->cond, &rcond);
-	if (run_is_bo(run))
-		return;
-
-	while (run_item_boolean_value(run, rcond) == b_true) {
-		rdata_item_destroy(rcond);
-		run_block(run, while_s->body);
-		run_expr(run, while_s->cond, &rcond);
-		if (run_is_bo(run))
-			break;
-	}
-
-	if (rcond != NULL)
-		rdata_item_destroy(rcond);
-
-	if (run->thread_ar->bo_mode == bm_stat) {
-		/* Bailout due to break statement */
-		run->thread_ar->bo_mode = bm_none;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("While statement terminated.\n");
-#endif
-}
-
-/** Run @c raise statement.
- *
- * @param run		Runner object
- * @param raise_s	Raise statement to run
- */
-static void run_raise(run_t *run, stree_raise_t *raise_s)
-{
-	rdata_item_t *rexpr;
-	rdata_item_t *rexpr_vi;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing raise statement.\n");
-#endif
-	run_expr(run, raise_s->expr, &rexpr);
-	if (run_is_bo(run))
-		return;
-
-	run_cvt_value_item(run, rexpr, &rexpr_vi);
-	rdata_item_destroy(rexpr);
-	if (run_is_bo(run))
-		return;
-
-	/* Store expression cspan in thread AR. */
-	run->thread_ar->exc_cspan = raise_s->expr->cspan;
-
-	/* Store expression result in thread AR. */
-	/* XXX rexpr_vi is leaked here, we only return ->u.value */
-	run->thread_ar->exc_payload = rexpr_vi->u.value;
-
-	/* Start exception bailout. */
-	run->thread_ar->bo_mode = bm_exc;
-}
-
-/** Run @c break statement.
- *
- * Forces control to return from the active breakable statement by setting
- * bailout mode to @c bm_stat.
- *
- * @param run		Runner object
- * @param break_s	Break statement to run
- */
-static void run_break(run_t *run, stree_break_t *break_s)
-{
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing 'break' statement.\n");
-#endif
-	(void) break_s;
-
-	/* Force control to ascend and leave the procedure. */
-	if (run->thread_ar->bo_mode == bm_none)
-		run->thread_ar->bo_mode = bm_stat;
-}
-
-/** Run @c return statement.
- *
- * Sets the return value in procedure AR and forces control to return
- * from the function by setting bailout mode to @c bm_proc.
- *
- * @param run		Runner object
- * @param return_s	Return statement to run
- */
-static void run_return(run_t *run, stree_return_t *return_s)
-{
-	rdata_item_t *rexpr;
-	rdata_item_t *rexpr_vi;
-	run_proc_ar_t *proc_ar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing return statement.\n");
-#endif
-	if (return_s->expr != NULL) {
-		run_expr(run, return_s->expr, &rexpr);
-		if (run_is_bo(run))
-			return;
-
-		run_cvt_value_item(run, rexpr, &rexpr_vi);
-		rdata_item_destroy(rexpr);
-		if (run_is_bo(run))
-			return;
-
-		/* Store expression result in procedure AR. */
-		proc_ar = run_get_current_proc_ar(run);
-		proc_ar->retval = rexpr_vi;
-	}
-
-	/* Force control to ascend and leave the procedure. */
-	if (run->thread_ar->bo_mode == bm_none)
-		run->thread_ar->bo_mode = bm_proc;
-}
-
-/** Run @c with-except-finally statement.
- *
- * Note: 'With' clause is not implemented.
- *
- * @param run		Runner object
- * @param wef_s		With-except-finally statement to run
- */
-static void run_wef(run_t *run, stree_wef_t *wef_s)
-{
-	list_node_t *except_n;
-	stree_except_t *except_c;
-	rdata_value_t *exc_payload;
-	run_bailout_mode_t bo_mode;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing with-except-finally statement.\n");
-#endif
-	run_block(run, wef_s->with_block);
-
-	if (run->thread_ar->bo_mode == bm_exc) {
-#ifdef DEBUG_RUN_TRACE
-		printf("With statement detected exception.\n");
-#endif
-		/* Reset to normal execution. */
-		run->thread_ar->bo_mode = bm_none;
-
-		/* Look for an except block. */
-		except_n = list_first(&wef_s->except_clauses);
-		while (except_n != NULL) {
-			except_c = list_node_data(except_n, stree_except_t *);
-			if (run_exc_match(run, except_c))
-				break;
-
-			except_n = list_next(&wef_s->except_clauses, except_n);
-		}
-
-		/* If one was found, execute it. */
-		if (except_n != NULL)
-			run_block(run, except_c->block);
-
-		/* Execute finally block */
-		if (wef_s->finally_block != NULL) {
-			/* Put exception on the side temporarily. */
-			bo_mode = run->thread_ar->bo_mode;
-			exc_payload = run->thread_ar->exc_payload;
-
-			run->thread_ar->bo_mode = bm_none;
-			run->thread_ar->exc_payload = NULL;
-
-			run_block(run, wef_s->finally_block);
-
-			if (bo_mode == bm_exc) {
-				/*
-				 * Restore the original exception. If another
-				 * exception occured in the finally block (i.e.
-				 * double fault), it is forgotten.
-				 */
-				run->thread_ar->bo_mode = bm_exc;
-				run->thread_ar->exc_payload = exc_payload;
-			}
-		}
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("With-except-finally statement terminated.\n");
-#endif
-}
-
-/** Determine whether currently active exception matches @c except clause.
- *
- * Checks if the currently active exception in the runner object @c run
- * matches except clause @c except_c.
- *
- * @param run		Runner object
- * @param except_c	@c except clause
- * @return		@c b_true if there is a match, @c b_false otherwise
- */
-static bool_t run_exc_match(run_t *run, stree_except_t *except_c)
-{
-	stree_csi_t *exc_csi;
-
-	/* Get CSI of active exception. */
-	exc_csi = run_exc_payload_get_csi(run);
-
-	/* Determine if active exc. is derived from type in exc. clause. */
-	/* XXX This is wrong, it does not work with generics. */
-	return tdata_is_csi_derived_from_ti(exc_csi, except_c->titem);
-}
-
-/** Return CSI of the active exception.
- *
- * @param run		Runner object
- * @return		CSI of the active exception
- */
-static stree_csi_t *run_exc_payload_get_csi(run_t *run)
-{
-	rdata_value_t *payload;
-	rdata_var_t *payload_v;
-	rdata_object_t *payload_o;
-
-	payload = run->thread_ar->exc_payload;
-	assert(payload != NULL);
-
-	if (payload->var->vc != vc_ref) {
-		/* XXX Prevent this via static type checking. */
-		printf("Error: Exception payload must be an object "
-		    "(found type %d).\n", payload->var->vc);
-		exit(1);
-	}
-
-	payload_v = payload->var->u.ref_v->vref;
-	if (payload_v->vc != vc_object) {
-		/* XXX Prevent this via static type checking. */
-		printf("Error: Exception payload must be an object "
-		    "(found type %d).\n", payload_v->vc);
-		exit(1);
-	}
-
-	payload_o = payload_v->u.object_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Active exception: '");
-	symbol_print_fqn(payload_o->class_sym);
-	printf("'.\n");
-#endif
-	assert(payload_o->class_sym != NULL);
-	assert(payload_o->class_sym->sc == sc_csi);
-
-	return payload_o->class_sym->u.csi;
-}
-
-/** Check for unhandled exception.
- *
- * Checks whether there is an active exception. If so, it prints an
- * error message and raises a run-time error.
- *
- * @param run		Runner object
- */
-void run_exc_check_unhandled(run_t *run)
-{
-	stree_csi_t *exc_csi;
-
-	if (run->thread_ar->bo_mode != bm_none) {
-		assert(run->thread_ar->bo_mode == bm_exc);
-
-		exc_csi = run_exc_payload_get_csi(run);
-
-		if (run->thread_ar->exc_cspan != NULL) {
-			cspan_print(run->thread_ar->exc_cspan);
-			putchar(' ');
-		}
-
-		printf("Error: Unhandled exception '");
-		symbol_print_fqn(csi_to_symbol(exc_csi));
-		printf("'.\n");
-
-		run_raise_error(run);
-	}
-}
-
-/** Raise an irrecoverable run-time error, start bailing out.
- *
- * Raises an error that cannot be handled by the user program.
- *
- * @param run		Runner object
- */
-void run_raise_error(run_t *run)
-{
-	run->thread_ar->bo_mode = bm_error;
-	run->thread_ar->error = b_true;
-}
-
-/** Construct a special recovery item.
- *
- * @param run		Runner object
- */
-rdata_item_t *run_recovery_item(run_t *run)
-{
-	(void) run;
-	return NULL;
-}
-
-/** Find a local variable in the currently active function.
- *
- * @param run		Runner object
- * @param name		Name SID of the local variable
- * @return		Pointer to var node or @c NULL if not found
- */
-rdata_var_t *run_local_vars_lookup(run_t *run, sid_t name)
-{
-	run_proc_ar_t *proc_ar;
-	run_block_ar_t *block_ar;
-	rdata_var_t *var;
-	list_node_t *node;
-
-	proc_ar = run_get_current_proc_ar(run);
-	node = list_last(&proc_ar->block_ar);
-
-	/* Walk through all block activation records. */
-	while (node != NULL) {
-		block_ar = list_node_data(node, run_block_ar_t *);
-		var = intmap_get(&block_ar->vars, name);
-		if (var != NULL)
-			return var;
-
-		node = list_prev(&proc_ar->block_ar, node);
-	}
-
-	/* No match */
-	return NULL;
-}
-
-/** Get current procedure activation record.
- *
- * @param run		Runner object
- * @return		Active procedure AR
- */
-run_proc_ar_t *run_get_current_proc_ar(run_t *run)
-{
-	list_node_t *node;
-
-	node = list_last(&run->thread_ar->proc_ar);
-	return list_node_data(node, run_proc_ar_t *);
-}
-
-/** Get current block activation record.
- *
- * @param run		Runner object
- * @return		Active block AR
- */
-run_block_ar_t *run_get_current_block_ar(run_t *run)
-{
-	run_proc_ar_t *proc_ar;
-	list_node_t *node;
-
-	proc_ar = run_get_current_proc_ar(run);
-
-	node = list_last(&proc_ar->block_ar);
-	return list_node_data(node, run_block_ar_t *);
-}
-
-/** Get current CSI.
- *
- * @param run		Runner object
- * @return		Active CSI
- */
-stree_csi_t *run_get_current_csi(run_t *run)
-{
-	run_proc_ar_t *proc_ar;
-
-	proc_ar = run_get_current_proc_ar(run);
-	return proc_ar->proc->outer_symbol->outer_csi;
-}
-
-/** Get static object (i.e. class object).
- *
- * Looks for a child static object named @a name in static object @a pobject.
- * If the child does not exist yet, it is created.
- *
- * @param run		Runner object
- * @param csi		CSI of the static object named @a name
- * @param pobject	Parent static object
- * @param name		Static object name
- *
- * @return		Static (class) object of the given name
- */
-rdata_var_t *run_sobject_get(run_t *run, stree_csi_t *csi,
-    rdata_var_t *pobj_var, sid_t name)
-{
-	rdata_object_t *pobject;
-	rdata_var_t *mbr_var;
-	rdata_var_t *rvar;
-	stree_ident_t *ident;
-
-	assert(pobj_var->vc == vc_object);
-	pobject = pobj_var->u.object_v;
-#ifdef DEBUG_RUN_TRACE
-	printf("Get static object '%s' in '", strtab_get_str(name));
-	if (pobject->class_sym != NULL)
-		symbol_print_fqn(pobject->class_sym);
-	else
-		printf("global");
-#endif
-
-	assert(pobject->static_obj == sn_static);
-
-	mbr_var = intmap_get(&pobject->fields, name);
-	if (mbr_var != NULL) {
-#ifdef DEBUG_RUN_TRACE
-		printf("Return exising static object (mbr_var=%p).\n", mbr_var);
-#endif
-		/* Return existing object. */
-		return mbr_var;
-	}
-
-	/* Construct new object. */
-#ifdef DEBUG_RUN_TRACE
-	printf("Construct new static object.\n");
-#endif
-	ident = stree_ident_new();
-	ident->sid = name;
-
-	run_new_csi_inst(run, csi, sn_static, &rvar);
-
-	/* Store static object reference for future use. */
-	intmap_set(&pobject->fields, name, rvar);
-
-	return rvar;
-}
-
-/** Get static object for CSI.
- *
- * In situations where we do not have the parent static object and need
- * to find static object for a CSI from the gdata root we use this.
- *
- * This is only used in special cases such as when invoking the entry
- * point. This is too slow to use during normal execution.
- *
- * @param run		Runner object
- * @param csi		CSI to get static object of
- *
- * @return		Static (class) object
- */
-rdata_var_t *run_sobject_find(run_t *run, stree_csi_t *csi)
-{
-	rdata_var_t *pobj_var;
-
-	if (csi == NULL)
-		return run->gdata;
-
-	assert(csi->ancr_state == ws_visited);
-	pobj_var = run_sobject_find(run, csi_to_symbol(csi)->outer_csi);
-
-	return run_sobject_get(run, csi, pobj_var, csi->name->sid);
-}
-
-/** Get static object for CSI containing function.
- *
- * This is used to obtain active object for invoking static function
- * @a fun. Only used in cases where we don't already have the object such
- * as when running the entry point. Otherwise this would be slow.
- *
- * @param run		Runner object
- * @param fun		Function to get static class object of
- *
- * @return		Static (class) object
- */
-rdata_var_t *run_fun_sobject_find(run_t *run, stree_fun_t *fun)
-{
-	return run_sobject_find(run, fun_to_symbol(fun)->outer_csi);
-}
-
-/** Construct variable from a value item.
- *
- * XXX This should be in fact implemented using existing code as:
- *
- * (1) Create a variable of the desired type.
- * (2) Initialize the variable with the provided value.
- *
- * @param item		Value item (initial value for variable).
- * @param var		Place to store new var node.
- */
-void run_value_item_to_var(rdata_item_t *item, rdata_var_t **var)
-{
-	rdata_bool_t *bool_v;
-	rdata_char_t *char_v;
-	rdata_deleg_t *deleg_v;
-	rdata_enum_t *enum_v;
-	rdata_int_t *int_v;
-	rdata_string_t *string_v;
-	rdata_ref_t *ref_v;
-	rdata_var_t *in_var;
-
-	assert(item->ic == ic_value);
-	in_var = item->u.value->var;
-
-	switch (in_var->vc) {
-	case vc_bool:
-		*var = rdata_var_new(vc_bool);
-		bool_v = rdata_bool_new();
-
-		(*var)->u.bool_v = bool_v;
-		bool_v->value = item->u.value->var->u.bool_v->value;
-		break;
-	case vc_char:
-		*var = rdata_var_new(vc_char);
-		char_v = rdata_char_new();
-
-		(*var)->u.char_v = char_v;
-		bigint_clone(&item->u.value->var->u.char_v->value,
-		    &char_v->value);
-		break;
-	case vc_deleg:
-		*var = rdata_var_new(vc_deleg);
-		deleg_v = rdata_deleg_new();
-
-		(*var)->u.deleg_v = deleg_v;
-		deleg_v->obj = item->u.value->var->u.deleg_v->obj;
-		deleg_v->sym = item->u.value->var->u.deleg_v->sym;
-		break;
-	case vc_enum:
-		*var = rdata_var_new(vc_enum);
-		enum_v = rdata_enum_new();
-
-		(*var)->u.enum_v = enum_v;
-		enum_v->value = item->u.value->var->u.enum_v->value;
-		break;
-	case vc_int:
-		*var = rdata_var_new(vc_int);
-		int_v = rdata_int_new();
-
-		(*var)->u.int_v = int_v;
-		bigint_clone(&item->u.value->var->u.int_v->value,
-		    &int_v->value);
-		break;
-	case vc_string:
-		*var = rdata_var_new(vc_string);
-		string_v = rdata_string_new();
-
-		(*var)->u.string_v = string_v;
-		string_v->value = item->u.value->var->u.string_v->value;
-		break;
-	case vc_ref:
-		*var = rdata_var_new(vc_ref);
-		ref_v = rdata_ref_new();
-
-		(*var)->u.ref_v = ref_v;
-		ref_v->vref = item->u.value->var->u.ref_v->vref;
-		break;
-	default:
-		printf("Error: Unimplemented argument type.\n");
-		exit(1);
-
-	}
-}
-
-/** Construct a procedure AR.
- *
- * @param run		Runner object
- * @param obj		Object whose procedure is being activated
- * @param proc		Procedure that is being activated
- * @param rproc_ar	Place to store pointer to new activation record
- */
-void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_proc_t *proc,
-    run_proc_ar_t **rproc_ar)
-{
-	run_proc_ar_t *proc_ar;
-	run_block_ar_t *block_ar;
-
-	(void) run;
-
-	/* Create procedure activation record. */
-	proc_ar = run_proc_ar_new();
-	proc_ar->obj = obj;
-	proc_ar->proc = proc;
-	list_init(&proc_ar->block_ar);
-
-	proc_ar->retval = NULL;
-
-	/* Create special block activation record to hold function arguments. */
-	block_ar = run_block_ar_new();
-	intmap_init(&block_ar->vars);
-	list_append(&proc_ar->block_ar, block_ar);
-
-	*rproc_ar = proc_ar;
-}
-
-/** Destroy a procedure AR.
- *
- * @param run		Runner object
- * @param proc_ar	Pointer to procedure activation record
- */
-void run_proc_ar_destroy(run_t *run, run_proc_ar_t *proc_ar)
-{
-	list_node_t *ar_node;
-	run_block_ar_t *block_ar;
-
-	(void) run;
-
-	/* Destroy special block activation record. */
-	ar_node = list_first(&proc_ar->block_ar);
-	block_ar = list_node_data(ar_node, run_block_ar_t *);
-	list_remove(&proc_ar->block_ar, ar_node);
-	run_block_ar_destroy(run, block_ar);
-
-	/* Destroy procedure activation record. */
-	proc_ar->obj = NULL;
-	proc_ar->proc = NULL;
-	list_fini(&proc_ar->block_ar);
-	proc_ar->retval = NULL;
-	run_proc_ar_delete(proc_ar);
-}
-
-/** Fill arguments in a procedure AR.
- *
- * When invoking a procedure this is used to store the argument values
- * in the activation record.
- *
- * @param run		Runner object
- * @param proc_ar	Existing procedure activation record where to store
- *			the values
- * @param arg_vals	List of value items (rdata_item_t *) -- real
- *			argument values
- */
-void run_proc_ar_set_args(run_t *run, run_proc_ar_t *proc_ar, list_t *arg_vals)
-{
-	stree_ctor_t *ctor;
-	stree_fun_t *fun;
-	stree_prop_t *prop;
-	list_t *args;
-	stree_proc_arg_t *varg;
-	stree_symbol_t *outer_symbol;
-
-	run_block_ar_t *block_ar;
-	list_node_t *block_ar_n;
-	list_node_t *rarg_n, *parg_n;
-	list_node_t *cn;
-	rdata_item_t *rarg;
-	stree_proc_arg_t *parg;
-	rdata_var_t *var;
-	rdata_var_t *ref_var;
-	rdata_ref_t *ref;
-	rdata_array_t *array;
-	rdata_var_t *elem_var;
-	int n_vargs, idx;
-
-	(void) run;
-
-	/* AR should have been created with run_proc_ar_create(). */
-	assert(proc_ar->proc != NULL);
-	outer_symbol = proc_ar->proc->outer_symbol;
-
-	/* Make compiler happy. */
-	args = NULL;
-	varg = NULL;
-
-	/*
-	 * The procedure being activated should belong to a member function or
-	 * property getter/setter.
-	 */
-	switch (outer_symbol->sc) {
-	case sc_ctor:
-		ctor = symbol_to_ctor(outer_symbol);
-		args = &ctor->sig->args;
-		varg = ctor->sig->varg;
-		break;
-	case sc_fun:
-		fun = symbol_to_fun(outer_symbol);
-		args = &fun->sig->args;
-		varg = fun->sig->varg;
-		break;
-	case sc_prop:
-		prop = symbol_to_prop(outer_symbol);
-		args = &prop->args;
-		varg = prop->varg;
-		break;
-	case sc_csi:
-	case sc_deleg:
-	case sc_enum:
-	case sc_var:
-		assert(b_false);
-	}
-
-	/* Fetch first block activation record. */
-	block_ar_n = list_first(&proc_ar->block_ar);
-	assert(block_ar_n != NULL);
-	block_ar = list_node_data(block_ar_n, run_block_ar_t *);
-
-	/* Declare local variables to hold argument values. */
-	rarg_n = list_first(arg_vals);
-	parg_n = list_first(args);
-
-	while (parg_n != NULL) {
-		if (rarg_n == NULL) {
-			printf("Error: Too few arguments to '");
-			symbol_print_fqn(outer_symbol);
-			printf("'.\n");
-			exit(1);
-		}
-
-		rarg = list_node_data(rarg_n, rdata_item_t *);
-		parg = list_node_data(parg_n, stree_proc_arg_t *);
-
-		assert(rarg->ic == ic_value);
-
-		/* Construct a variable from the argument value. */
-		run_value_item_to_var(rarg, &var);
-
-		/* Declare variable using name of formal argument. */
-		intmap_set(&block_ar->vars, parg->name->sid, var);
-
-		rarg_n = list_next(arg_vals, rarg_n);
-		parg_n = list_next(args, parg_n);
-	}
-
-	if (varg != NULL) {
-		/* Function is variadic. Count number of variadic arguments. */
-		cn = rarg_n;
-		n_vargs = 0;
-		while (cn != NULL) {
-			n_vargs += 1;
-			cn = list_next(arg_vals, cn);
-		}
-
-		/* Prepare array to store variadic arguments. */
-		array = rdata_array_new(1);
-		array->extent[0] = n_vargs;
-		rdata_array_alloc_element(array);
-
-		/* Read variadic arguments. */
-
-		idx = 0;
-		while (rarg_n != NULL) {
-			rarg = list_node_data(rarg_n, rdata_item_t *);
-			assert(rarg->ic == ic_value);
-
-			run_value_item_to_var(rarg, &elem_var);
-			array->element[idx] = elem_var;
-
-			rarg_n = list_next(arg_vals, rarg_n);
-			idx += 1;
-		}
-
-		var = rdata_var_new(vc_array);
-		var->u.array_v = array;
-
-		/* Create reference to the new array. */
-		ref_var = rdata_var_new(vc_ref);
-		ref = rdata_ref_new();
-		ref_var->u.ref_v = ref;
-		ref->vref = var;
-
-		/* Declare variable using name of formal argument. */
-		intmap_set(&block_ar->vars, varg->name->sid,
-		    ref_var);
-	}
-
-	/* Check for excess real parameters. */
-	if (rarg_n != NULL) {
-		printf("Error: Too many arguments to '");
-		symbol_print_fqn(outer_symbol);
-		printf("'.\n");
-		exit(1);
-	}
-}
-
-/** Fill setter argument in a procedure AR.
- *
- * When invoking a setter this is used to store its argument value in its
- * procedure activation record.
- *
- * @param run		Runner object
- * @param proc_ar	Existing procedure activation record where to store
- *			the setter argument
- * @param arg_val	Value items (rdata_item_t *) -- real argument value
- */
-void run_proc_ar_set_setter_arg(run_t *run, run_proc_ar_t *proc_ar,
-    rdata_item_t *arg_val)
-{
-	stree_prop_t *prop;
-	run_block_ar_t *block_ar;
-	list_node_t *block_ar_n;
-	rdata_var_t *var;
-
-	(void) run;
-
-	/* AR should have been created with run_proc_ar_create(). */
-	assert(proc_ar->proc != NULL);
-
-	/* The procedure being activated should belong to a property setter. */
-	prop = symbol_to_prop(proc_ar->proc->outer_symbol);
-	assert(prop != NULL);
-	assert(proc_ar->proc == prop->setter);
-
-	/* Fetch first block activation record. */
-	block_ar_n = list_first(&proc_ar->block_ar);
-	assert(block_ar_n != NULL);
-	block_ar = list_node_data(block_ar_n, run_block_ar_t *);
-
-	assert(arg_val->ic == ic_value);
-
-	/* Construct a variable from the argument value. */
-	run_value_item_to_var(arg_val, &var);
-
-	/* Declare variable using name of formal argument. */
-	intmap_set(&block_ar->vars, prop->setter_arg->name->sid, var);
-}
-
-/** Print function activation backtrace.
- *
- * Prints a backtrace of activated functions for debugging purposes.
- *
- * @param run		Runner object
- */
-void run_print_fun_bt(run_t *run)
-{
-	list_node_t *node;
-	run_proc_ar_t *proc_ar;
-
-	printf("Backtrace:\n");
-	node = list_last(&run->thread_ar->proc_ar);
-	while (node != NULL) {
-		printf(" * ");
-		proc_ar = list_node_data(node, run_proc_ar_t *);
-		symbol_print_fqn(proc_ar->proc->outer_symbol);
-		printf("\n");
-
-		node = list_prev(&run->thread_ar->proc_ar, node);
-	}
-}
-
-/** Destroy a block AR.
- *
- * @param run		Runner object
- * @param proc_ar	Pointer to block activation record
- */
-void run_block_ar_destroy(run_t *run, run_block_ar_t *block_ar)
-{
-	map_elem_t *elem;
-	rdata_var_t *var;
-	int key;
-
-	(void) run;
-
-	elem = intmap_first(&block_ar->vars);
-	while (elem != NULL) {
-		/* Destroy the variable */
-		var = intmap_elem_get_value(elem);
-		rdata_var_destroy(var);
-
-		/* Remove the map element */
-		key = intmap_elem_get_key(elem);
-		intmap_set(&block_ar->vars, key, NULL);
-
-		elem = intmap_first(&block_ar->vars);
-	}
-
-	intmap_fini(&block_ar->vars);
-	run_block_ar_delete(block_ar);
-}
-
-/** Convert item to value item.
- *
- * If @a item is a value, we just return a copy. If @a item is an address,
- * we read from the address.
- *
- * @param run		Runner object
- * @param item		Input item (value or address)
- * @param ritem		Place to store pointer to new value item
- */
-void run_cvt_value_item(run_t *run, rdata_item_t *item, rdata_item_t **ritem)
-{
-	rdata_value_t *value;
-
-	/*
-	 * This can happen when trying to use output of a function which
-	 * does not return a value.
-	 */
-	if (item == NULL) {
-		printf("Error: Sub-expression has no value.\n");
-		exit(1);
-	}
-
-	/* Address item. Perform read operation. */
-	if (item->ic == ic_address) {
-		run_address_read(run, item->u.address, ritem);
-		return;
-	}
-
-	/* Make a copy of the var node within. */
-	value = rdata_value_new();
-	rdata_var_copy(item->u.value->var, &value->var);
-	*ritem = rdata_item_new(ic_value);
-	(*ritem)->u.value = value;
-}
-
-/** Get item var-class.
- *
- * Get var-class of @a item, regardless whether it is a value or address.
- * (I.e. the var class of the value or variable at the given address).
- *
- * @param run		Runner object
- * @param item		Value or address item
- * @return		Varclass of @a item
- */
-var_class_t run_item_get_vc(run_t *run, rdata_item_t *item)
-{
-	var_class_t vc;
-	rdata_var_t *tpos;
-
-	(void) run;
-
-	switch (item->ic) {
-	case ic_value:
-		vc = item->u.value->var->vc;
-		break;
-	case ic_address:
-		switch (item->u.address->ac) {
-		case ac_var:
-			vc = item->u.address->u.var_a->vref->vc;
-			break;
-		case ac_prop:
-			/* Prefetch the value of the property. */
-			tpos = run_aprop_get_tpos(run, item->u.address);
-			vc = tpos->vc;
-			break;
-		default:
-			assert(b_false);
-		}
-		break;
-	default:
-		assert(b_false);
-	}
-
-	return vc;
-}
-
-/** Get pointer to current var node in temporary copy in property address.
- *
- * A property address refers to a specific @c var node in a property.
- * This function will fetch a copy of the property value (by running
- * its getter) if there is not a temporary copy in the address yet.
- * It returns a pointer to the relevant @c var node in the temporary
- * copy.
- *
- * @param run	Runner object
- * @param addr	Address of class @c ac_prop
- * @return	Pointer to var node
- */
-static rdata_var_t *run_aprop_get_tpos(run_t *run, rdata_address_t *addr)
-{
-	rdata_item_t *ritem;
-
-	assert(addr->ac == ac_prop);
-
-	if (addr->u.prop_a->tvalue == NULL) {
-		/* Fetch value of the property. */
-		run_address_read(run, addr, &ritem);
-		assert(ritem->ic == ic_value);
-		addr->u.prop_a->tvalue = ritem->u.value;
-		addr->u.prop_a->tpos = addr->u.prop_a->tvalue->var;
-	}
-
-	return addr->u.prop_a->tpos;
-}
-
-/** Read data from an address.
- *
- * Read value from the specified address.
- *
- * @param run		Runner object
- * @param address	Address to read
- * @param ritem		Place to store pointer to the value that was read
- */
-void run_address_read(run_t *run, rdata_address_t *address,
-    rdata_item_t **ritem)
-{
-	(void) run;
-	assert(ritem != NULL);
-
-	switch (address->ac) {
-	case ac_var:
-		rdata_var_read(address->u.var_a->vref, ritem);
-		break;
-	case ac_prop:
-		run_aprop_read(run, address->u.prop_a, ritem);
-		break;
-	}
-
-	assert(*ritem == NULL || (*ritem)->ic == ic_value);
-}
-
-/** Write data to an address.
- *
- * Store value @a value at address @a address.
- *
- * @param run		Runner object
- * @param address	Address to write
- * @param value		Value to store at the address
- */
-void run_address_write(run_t *run, rdata_address_t *address,
-    rdata_value_t *value)
-{
-	(void) run;
-
-	switch (address->ac) {
-	case ac_var:
-		rdata_var_write(address->u.var_a->vref, value);
-		break;
-	case ac_prop:
-		run_aprop_write(run, address->u.prop_a, value);
-		break;
-	}
-}
-
-/** Read data from a property address.
- *
- * This involves invoking the property getter procedure.
- *
- * @param run		Runner object.
- * @param addr_prop	Property address to read.
- * @param ritem		Place to store pointer to the value that was read.
- */
-static void run_aprop_read(run_t *run, rdata_addr_prop_t *addr_prop,
-    rdata_item_t **ritem)
-{
-	rdata_deleg_t *deleg;
-	rdata_var_t *obj;
-	stree_symbol_t *prop_sym;
-	stree_prop_t *prop;
-
-	run_proc_ar_t *proc_ar;
-
-	rdata_var_t *cvar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Read from property.\n");
-#endif
-	/*
-	 * If @c tvalue is present, we need to use the relevant part from that
-	 * instead of re-reading the whole thing.
-	 */
-	if (addr_prop->tvalue != NULL) {
-		/* Copy the value */
-		rdata_var_copy(addr_prop->tpos, &cvar);
-		*ritem = rdata_item_new(ic_value);
-		(*ritem)->u.value = rdata_value_new();
-		(*ritem)->u.value->var = cvar;
-		return;
-	}
-
-	if (addr_prop->apc == apc_named)
-		deleg = addr_prop->u.named->prop_d;
-	else
-		deleg = addr_prop->u.indexed->object_d;
-
-	obj = deleg->obj;
-	prop_sym = deleg->sym;
-	prop = symbol_to_prop(prop_sym);
-	assert(prop != NULL);
-
-	if (prop->getter == NULL) {
-		printf("Error: Property is not readable.\n");
-		exit(1);
-	}
-
-	/* Create procedure activation record. */
-	run_proc_ar_create(run, obj, prop->getter, &proc_ar);
-
-	/* Fill in arguments (indices). */
-	if (addr_prop->apc == apc_indexed) {
-		run_proc_ar_set_args(run, proc_ar,
-		    &addr_prop->u.indexed->args);
-	}
-
-	/* Run getter. */
-	run_proc(run, proc_ar, ritem);
-
-	/* Destroy procedure activation record. */
-	run_proc_ar_destroy(run, proc_ar);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Getter returns ");
-	rdata_item_print(*ritem);
-	printf(".\n");
-	printf("Done reading from property.\n");
-#endif
-}
-
-/** Write data to a property address.
- *
- * This involves invoking the property setter procedure.
- *
- * @param run		Runner object
- * @param addr_prop	Property address to write
- * @param value		Value to store at the address
- */
-static void run_aprop_write(run_t *run, rdata_addr_prop_t *addr_prop,
-    rdata_value_t *value)
-{
-	rdata_deleg_t *deleg;
-	rdata_var_t *obj;
-	stree_symbol_t *prop_sym;
-	stree_prop_t *prop;
-
-	run_proc_ar_t *proc_ar;
-	rdata_item_t *vitem;
-	rdata_item_t *ritem;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Write to property.\n");
-#endif
-	/* If @c tvalue is present, we need to modify it and write it back. */
-	if (addr_prop->tvalue != NULL) {
-		printf("Unimplemented: Read-modify-write property access.\n");
-		exit(1);
-	}
-
-	if (addr_prop->apc == apc_named)
-		deleg = addr_prop->u.named->prop_d;
-	else
-		deleg = addr_prop->u.indexed->object_d;
-
-	obj = deleg->obj;
-	prop_sym = deleg->sym;
-	prop = symbol_to_prop(prop_sym);
-	assert(prop != NULL);
-
-	if (prop->setter == NULL) {
-		printf("Error: Property is not writable.\n");
-		exit(1);
-	}
-
-	vitem = rdata_item_new(ic_value);
-	vitem->u.value = value;
-
-	/* Create procedure activation record. */
-	run_proc_ar_create(run, obj, prop->setter, &proc_ar);
-
-	/* Fill in arguments (indices). */
-	if (addr_prop->apc == apc_indexed) {
-		run_proc_ar_set_args(run, proc_ar,
-		    &addr_prop->u.indexed->args);
-	}
-
-	/* Fill in value argument for setter. */
-	run_proc_ar_set_setter_arg(run, proc_ar, vitem);
-
-	/* Run setter. */
-	run_proc(run, proc_ar, &ritem);
-
-	/* Setter should not return a value. */
-	assert(ritem == NULL);
-
-	/* Destroy procedure activation record. */
-	run_proc_ar_destroy(run, proc_ar);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Done writing to property.\n");
-#endif
-}
-
-/** Return reference to a variable.
- *
- * Constructs a reference (value item) pointing to @a var.
- *
- * @param run		Runner object
- * @param var		Variable node that is being referenced
- * @param res		Place to store pointer to new reference.
- */
-void run_reference(run_t *run, rdata_var_t *var, rdata_item_t **res)
-{
-	rdata_ref_t *ref;
-	rdata_var_t *ref_var;
-	rdata_value_t *ref_value;
-	rdata_item_t *ref_item;
-
-	(void) run;
-
-	/* Create reference to the variable. */
-	ref = rdata_ref_new();
-	ref_var = rdata_var_new(vc_ref);
-	ref->vref = var;
-	ref_var->u.ref_v = ref;
-
-	/* Construct value of the reference to return. */
-	ref_item = rdata_item_new(ic_value);
-	ref_value = rdata_value_new();
-	ref_item->u.value = ref_value;
-	ref_value->var = ref_var;
-
-	*res = ref_item;
-}
-
-/** Return address of reference target.
- *
- * Takes a reference (address or value) and returns the address (item) of
- * the target of the reference.
- *
- * @param run		Runner object
- * @param ref		Reference
- * @param cspan		Cspan to put into exception if reference is nil
- *			or @c NULL if no cspan is provided.
- * @param rtitem	Place to store pointer to the resulting address.
- */
-void run_dereference(run_t *run, rdata_item_t *ref, cspan_t *cspan,
-    rdata_item_t **ritem)
-{
-	rdata_item_t *ref_val;
-	rdata_item_t *item;
-	rdata_address_t *address;
-	rdata_addr_var_t *addr_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("run_dereference()\n");
-#endif
-	run_cvt_value_item(run, ref, &ref_val);
-	if (run_is_bo(run)) {
-		*ritem = run_recovery_item(run);
-		return;
-	}
-
-	assert(ref_val->u.value->var->vc == vc_ref);
-
-	item = rdata_item_new(ic_address);
-	address = rdata_address_new(ac_var);
-	addr_var = rdata_addr_var_new();
-	item->u.address = address;
-	address->u.var_a = addr_var;
-	addr_var->vref = ref_val->u.value->var->u.ref_v->vref;
-
-	rdata_item_destroy(ref_val);
-
-	if (addr_var->vref == NULL) {
-#ifdef DEBUG_RUN_TRACE
-		printf("Error: Accessing null reference.\n");
-#endif
-		/* Raise Error.NilReference */
-		run_raise_exc(run, run->program->builtin->error_nilreference,
-		    cspan);
-		*ritem = run_recovery_item(run);
-		return;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("vref set to %p\n", addr_var->vref);
-#endif
-	*ritem = item;
-}
-
-/** Raise an exception of the given class.
- *
- * Used when the interpreter generates an exception due to a run-time
- * error (not for the @c raise statement).
- *
- * @param run		Runner object
- * @param csi		Exception class
- * @param cspan		Cspan of code that caused exception (for debugging)
- */
-void run_raise_exc(run_t *run, stree_csi_t *csi, cspan_t *cspan)
-{
-	rdata_item_t *exc_vi;
-
-	/* Store exception cspan in thread AR. */
-	run->thread_ar->exc_cspan = cspan;
-
-	/* Create exception object. */
-	run_new_csi_inst_ref(run, csi, sn_nonstatic, &exc_vi);
-	assert(exc_vi->ic == ic_value);
-
-	/* Store exception object in thread AR. */
-	run->thread_ar->exc_payload = exc_vi->u.value;
-
-	/* Start exception bailout. */
-	run->thread_ar->bo_mode = bm_exc;
-}
-
-/** Determine if we are bailing out.
- *
- * @param run		Runner object
- * @return		@c b_true if we are bailing out, @c b_false otherwise
- */
-bool_t run_is_bo(run_t *run)
-{
-	return run->thread_ar->bo_mode != bm_none;
-}
-
-/** Construct a new variable of the given type.
- *
- * The variable is allocated and initialized with a default value
- * based on type item @a ti. For reference types the default value
- * is a null reference. At this point this does not work for generic
- * types (we need RTTI).
- *
- * @param run		Runner object
- * @param ti		Type of variable to create (type item)
- * @param rvar		Place to store pointer to new variable
- */
-void run_var_new(run_t *run, tdata_item_t *ti, rdata_var_t **rvar)
-{
-	rdata_var_t *var;
-
-	switch (ti->tic) {
-	case tic_tprimitive:
-		run_var_new_tprimitive(run, ti->u.tprimitive, rvar);
-		break;
-	case tic_tobject:
-	case tic_tarray:
-		run_var_new_null_ref(run, rvar);
-		break;
-	case tic_tdeleg:
-		run_var_new_deleg(run, rvar);
-		break;
-	case tic_tebase:
-		/*
-		 * One cannot declare variable of ebase type. It is just
-		 * type of expressions referring to enum types.
-		 */
-		assert(b_false);
-		/* Fallthrough */
-	case tic_tenum:
-		run_var_new_enum(run, ti->u.tenum, rvar);
-		break;
-	case tic_tfun:
-		run_var_new_deleg(run, rvar);
-		break;
-	case tic_tvref:
-		/*
-		 * XXX Need to obtain run-time value of type argument to
-		 * initialize variable properly.
-		 */
-		var = rdata_var_new(vc_int);
-		var->u.int_v = rdata_int_new();
-		bigint_init(&var->u.int_v->value, 0);
-		*rvar = var;
-		break;
-	case tic_ignore:
-		assert(b_false);
-	}
-}
-
-/** Construct a new variable of primitive type.
- *
- * The variable is allocated and initialized with a default value
- * based on primitive type item @a tprimitive.
- *
- * @param run		Runner object
- * @param ti		Primitive type of variable to create
- * @param rvar		Place to store pointer to new variable
- */
-static void run_var_new_tprimitive(run_t *run, tdata_primitive_t *tprimitive,
-    rdata_var_t **rvar)
-{
-	rdata_var_t *var;
-
-	(void) run;
-
-	/* Make compiler happy. */
-	var = NULL;
-
-	switch (tprimitive->tpc) {
-	case tpc_bool:
-		var = rdata_var_new(vc_bool);
-		var->u.bool_v = rdata_bool_new();
-		var->u.bool_v->value = b_false;
-		break;
-	case tpc_char:
-		var = rdata_var_new(vc_char);
-		var->u.char_v = rdata_char_new();
-		bigint_init(&var->u.char_v->value, 0);
-		break;
-	case tpc_int:
-		var = rdata_var_new(vc_int);
-		var->u.int_v = rdata_int_new();
-		bigint_init(&var->u.int_v->value, 0);
-		break;
-	case tpc_nil:
-		assert(b_false);
-		/* Fallthrough */
-	case tpc_string:
-		var = rdata_var_new(vc_string);
-		var->u.string_v = rdata_string_new();
-		var->u.string_v->value = "";
-		break;
-	case tpc_resource:
-		var = rdata_var_new(vc_resource);
-		var->u.resource_v = rdata_resource_new();
-		var->u.resource_v->data = NULL;
-		break;
-	}
-
-	*rvar = var;
-}
-
-/** Construct a new variable containing null reference.
- *
- * @param run		Runner object
- * @param rvar		Place to store pointer to new variable
- */
-static void run_var_new_null_ref(run_t *run, rdata_var_t **rvar)
-{
-	rdata_var_t *var;
-
-	(void) run;
-
-	/* Return null reference. */
-	var = rdata_var_new(vc_ref);
-	var->u.ref_v = rdata_ref_new();
-
-	*rvar = var;
-}
-
-/** Construct a new variable containing invalid delegate.
- *
- * @param run		Runner object
- * @param rvar		Place to store pointer to new variable
- */
-static void run_var_new_deleg(run_t *run, rdata_var_t **rvar)
-{
-	rdata_var_t *var;
-
-	(void) run;
-
-	/* Return null reference. */
-	var = rdata_var_new(vc_deleg);
-	var->u.deleg_v = rdata_deleg_new();
-
-	*rvar = var;
-}
-
-/** Construct a new variable containing default value of an enum type.
- *
- * @param run		Runner object
- * @param rvar		Place to store pointer to new variable
- */
-static void run_var_new_enum(run_t *run, tdata_enum_t *tenum,
-    rdata_var_t **rvar)
-{
-	rdata_var_t *var;
-	list_node_t *embr_n;
-	stree_embr_t *embr;
-
-	(void) run;
-
-	/* Get first member of enum which will serve as default value. */
-	embr_n = list_first(&tenum->enum_d->members);
-	assert(embr_n != NULL);
-
-	embr = list_node_data(embr_n, stree_embr_t *);
-
-	/* Return null reference. */
-	var = rdata_var_new(vc_enum);
-	var->u.enum_v = rdata_enum_new();
-	var->u.enum_v->value = embr;
-
-	*rvar = var;
-}
-
-/** Construct a new thread activation record.
- *
- * @param run	Runner object
- * @return	New thread AR.
- */
-run_thread_ar_t *run_thread_ar_new(void)
-{
-	run_thread_ar_t *thread_ar;
-
-	thread_ar = calloc(1, sizeof(run_thread_ar_t));
-	if (thread_ar == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return thread_ar;
-}
-
-/** Allocate a new procedure activation record.
- *
- * @return	New procedure AR.
- */
-run_proc_ar_t *run_proc_ar_new(void)
-{
-	run_proc_ar_t *proc_ar;
-
-	proc_ar = calloc(1, sizeof(run_proc_ar_t));
-	if (proc_ar == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return proc_ar;
-}
-
-/** Deallocate a procedure activation record.
- *
- * @return	New procedure AR.
- */
-void run_proc_ar_delete(run_proc_ar_t *proc_ar)
-{
-	assert(proc_ar != NULL);
-	free(proc_ar);
-}
-
-/** Allocate a new block activation record.
- *
- * @param run	Runner object
- * @return	New block AR.
- */
-run_block_ar_t *run_block_ar_new(void)
-{
-	run_block_ar_t *block_ar;
-
-	block_ar = calloc(1, sizeof(run_block_ar_t));
-	if (block_ar == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return block_ar;
-}
-
-/** Deallocate a new block activation record.
- *
- * @param run	Runner object
- * @return	New block AR.
- */
-void run_block_ar_delete(run_block_ar_t *block_ar)
-{
-	assert(block_ar != NULL);
-	free(block_ar);
-}
Index: pace/app/sbi/src/run.h
===================================================================
--- uspace/app/sbi/src/run.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RUN_H_
-#define RUN_H_
-
-#include "mytypes.h"
-
-void run_init(run_t *run);
-void run_gdata_init(run_t *run);
-void run_program(run_t *run, stree_program_t *prog);
-void run_proc(run_t *run, run_proc_ar_t *proc_ar, rdata_item_t **res);
-void run_stat(run_t *run, stree_stat_t *stat, rdata_item_t **res);
-
-void run_print_fun_bt(run_t *run);
-
-void run_exc_check_unhandled(run_t *run);
-void run_raise_error(run_t *run);
-rdata_item_t *run_recovery_item(run_t *run);
-
-rdata_var_t *run_local_vars_lookup(run_t *run, sid_t name);
-run_proc_ar_t *run_get_current_proc_ar(run_t *run);
-run_block_ar_t *run_get_current_block_ar(run_t *run);
-stree_csi_t *run_get_current_csi(run_t *run);
-
-rdata_var_t *run_sobject_get(run_t *run, stree_csi_t *pcsi,
-    rdata_var_t *pobj_var, sid_t name);
-rdata_var_t *run_sobject_find(run_t *run, stree_csi_t *csi);
-rdata_var_t *run_fun_sobject_find(run_t *run, stree_fun_t *fun);
-
-void run_value_item_to_var(rdata_item_t *item, rdata_var_t **var);
-void run_proc_ar_set_args(run_t *run, run_proc_ar_t *proc_ar,
-    list_t *arg_vals);
-void run_proc_ar_set_setter_arg(run_t *run, run_proc_ar_t *proc_ar,
-    rdata_item_t *arg_val);
-void run_proc_ar_create(run_t *run, rdata_var_t *obj, stree_proc_t *proc,
-    run_proc_ar_t **rproc_ar);
-void run_proc_ar_destroy(run_t *run, run_proc_ar_t *proc_ar);
-
-var_class_t run_item_get_vc(run_t *run, rdata_item_t *item);
-void run_cvt_value_item(run_t *run, rdata_item_t *item, rdata_item_t **ritem);
-void run_address_read(run_t *run, rdata_address_t *address,
-    rdata_item_t **ritem);
-void run_address_write(run_t *run, rdata_address_t *address,
-    rdata_value_t *value);
-void run_reference(run_t *run, rdata_var_t *var, rdata_item_t **res);
-void run_dereference(run_t *run, rdata_item_t *ref, cspan_t *cspan,
-    rdata_item_t **ritem);
-
-void run_raise_exc(run_t *run, stree_csi_t *csi, cspan_t *cspan);
-bool_t run_is_bo(run_t *run);
-
-void run_var_new(run_t *run, tdata_item_t *ti, rdata_var_t **rvar);
-
-run_thread_ar_t *run_thread_ar_new(void);
-run_proc_ar_t *run_proc_ar_new(void);
-void run_proc_ar_delete(run_proc_ar_t *proc_ar);
-run_block_ar_t *run_block_ar_new(void);
-void run_block_ar_delete(run_block_ar_t *block_ar);
-void run_proc_ar_delete(run_proc_ar_t *proc_ar);
-void run_block_ar_destroy(run_t *run, run_block_ar_t *block_ar);
-
-#endif
Index: pace/app/sbi/src/run_expr.c
===================================================================
--- uspace/app/sbi/src/run_expr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3012 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Run expressions. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "bigint.h"
-#include "debug.h"
-#include "intmap.h"
-#include "list.h"
-#include "mytypes.h"
-#include "os/os.h"
-#include "rdata.h"
-#include "run.h"
-#include "run_texpr.h"
-#include "symbol.h"
-#include "stree.h"
-#include "strtab.h"
-#include "tdata.h"
-
-#include "run_expr.h"
-
-static void run_nameref(run_t *run, stree_nameref_t *nameref,
-    rdata_item_t **res);
-
-static void run_literal(run_t *run, stree_literal_t *literal,
-    rdata_item_t **res);
-static void run_lit_bool(run_t *run, stree_lit_bool_t *lit_bool,
-    rdata_item_t **res);
-static void run_lit_char(run_t *run, stree_lit_char_t *lit_char,
-    rdata_item_t **res);
-static void run_lit_int(run_t *run, stree_lit_int_t *lit_int,
-    rdata_item_t **res);
-static void run_lit_ref(run_t *run, stree_lit_ref_t *lit_ref,
-    rdata_item_t **res);
-static void run_lit_string(run_t *run, stree_lit_string_t *lit_string,
-    rdata_item_t **res);
-
-static void run_self_ref(run_t *run, stree_self_ref_t *self_ref,
-    rdata_item_t **res);
-
-static void run_binop(run_t *run, stree_binop_t *binop, rdata_item_t **res);
-static void run_binop_bool(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-static void run_binop_char(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-static void run_binop_int(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-static void run_binop_string(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-static void run_binop_ref(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-static void run_binop_enum(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res);
-
-static void run_unop(run_t *run, stree_unop_t *unop, rdata_item_t **res);
-static void run_unop_bool(run_t *run, stree_unop_t *unop, rdata_value_t *val,
-    rdata_item_t **res);
-static void run_unop_int(run_t *run, stree_unop_t *unop, rdata_value_t *val,
-    rdata_item_t **res);
-
-static void run_new(run_t *run, stree_new_t *new_op, rdata_item_t **res);
-static void run_new_array(run_t *run, stree_new_t *new_op,
-    tdata_item_t *titem, rdata_item_t **res);
-static void run_new_object(run_t *run, stree_new_t *new_op,
-    tdata_item_t *titem, rdata_item_t **res);
-
-static void run_object_ctor(run_t *run, rdata_var_t *obj, list_t *arg_vals);
-
-static void run_access(run_t *run, stree_access_t *access, rdata_item_t **res);
-static void run_access_item(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res);
-static void run_access_ref(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res);
-static void run_access_deleg(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res);
-static void run_access_object(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res);
-static void run_access_object_static(run_t *run, stree_access_t *access,
-    rdata_var_t *obj_var, rdata_item_t **res);
-static void run_access_object_nonstatic(run_t *run, stree_access_t *access,
-    rdata_var_t *obj_var, rdata_item_t **res);
-static void run_access_symbol(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res);
-
-static void run_call(run_t *run, stree_call_t *call, rdata_item_t **res);
-static void run_call_args(run_t *run, list_t *args, list_t *arg_vals);
-static void run_destroy_arg_vals(list_t *arg_vals);
-
-static void run_index(run_t *run, stree_index_t *index, rdata_item_t **res);
-static void run_index_array(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res);
-static void run_index_object(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res);
-static void run_index_string(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res);
-static void run_assign(run_t *run, stree_assign_t *assign, rdata_item_t **res);
-static void run_as(run_t *run, stree_as_t *as_op, rdata_item_t **res);
-static void run_box(run_t *run, stree_box_t *box, rdata_item_t **res);
-
-/** Evaluate expression.
- *
- * Run the expression @a expr and store pointer to the result in *(@a res).
- * If the expression has on value (assignment) then @c NULL is returned.
- * @c NULL is also returned if an error or exception occurs.
- *
- * @param run		Runner object
- * @param expr		Expression to run
- * @param res		Place to store result
- */
-void run_expr(run_t *run, stree_expr_t *expr, rdata_item_t **res)
-{
-#ifdef DEBUG_RUN_TRACE
-	printf("Executing expression.\n");
-#endif
-
-	switch (expr->ec) {
-	case ec_nameref:
-		run_nameref(run, expr->u.nameref, res);
-		break;
-	case ec_literal:
-		run_literal(run, expr->u.literal, res);
-		break;
-	case ec_self_ref:
-		run_self_ref(run, expr->u.self_ref, res);
-		break;
-	case ec_binop:
-		run_binop(run, expr->u.binop, res);
-		break;
-	case ec_unop:
-		run_unop(run, expr->u.unop, res);
-		break;
-	case ec_new:
-		run_new(run, expr->u.new_op, res);
-		break;
-	case ec_access:
-		run_access(run, expr->u.access, res);
-		break;
-	case ec_call:
-		run_call(run, expr->u.call, res);
-		break;
-	case ec_index:
-		run_index(run, expr->u.index, res);
-		break;
-	case ec_assign:
-		run_assign(run, expr->u.assign, res);
-		break;
-	case ec_as:
-		run_as(run, expr->u.as_op, res);
-		break;
-	case ec_box:
-		run_box(run, expr->u.box, res);
-		break;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Expression result: ");
-	rdata_item_print(*res);
-	printf(".\n");
-#endif
-}
-
-/** Evaluate name reference expression.
- *
- * @param run		Runner object
- * @param nameref	Name reference
- * @param res		Place to store result
- */
-static void run_nameref(run_t *run, stree_nameref_t *nameref,
-    rdata_item_t **res)
-{
-	stree_symbol_t *sym;
-	rdata_item_t *item;
-	rdata_address_t *address;
-	rdata_addr_var_t *addr_var;
-	rdata_addr_prop_t *addr_prop;
-	rdata_aprop_named_t *aprop_named;
-	rdata_deleg_t *deleg_p;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_deleg_t *deleg_v;
-	rdata_symbol_t *symbol_v;
-
-	run_proc_ar_t *proc_ar;
-	stree_symbol_t *csi_sym;
-	stree_csi_t *csi;
-	rdata_object_t *obj;
-	rdata_var_t *member_var;
-
-	rdata_var_t *psobj;
-	rdata_var_t *sobj;
-	rdata_object_t *aobj;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run nameref.\n");
-#endif
-
-	/*
-	 * Look for a local variable.
-	 */
-	var = run_local_vars_lookup(run, nameref->name->sid);
-	if (var != NULL) {
-		/* Found a local variable. */
-		item = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_var);
-		addr_var = rdata_addr_var_new();
-
-		item->u.address = address;
-		address->u.var_a = addr_var;
-		addr_var->vref = var;
-
-		*res = item;
-#ifdef DEBUG_RUN_TRACE
-		printf("Found local variable.\n");
-#endif
-		return;
-	}
-
-	/*
-	 * Look for a class-wide or global symbol.
-	 */
-
-	/* Determine currently active object or CSI. */
-	proc_ar = run_get_current_proc_ar(run);
-
-	assert (proc_ar->obj != NULL);
-	assert(proc_ar->obj->vc == vc_object);
-	obj = proc_ar->obj->u.object_v;
-	csi_sym = obj->class_sym;
-
-	if (csi_sym != NULL) {
-		csi = symbol_to_csi(csi_sym);
-		assert(csi != NULL);
-	} else {
-		/* This happens in interactive mode. */
-		csi = NULL;
-	}
-
-	sym = symbol_lookup_in_csi(run->program, csi, nameref->name);
-
-	/* Existence should have been verified in type checking phase. */
-	assert(sym != NULL);
-
-	switch (sym->sc) {
-	case sc_csi:
-#ifdef DEBUG_RUN_TRACE
-		printf("Referencing CSI.\n");
-#endif
-		/* Obtain static object for the referenced CSI. */
-		psobj = run->gdata; /* XXX */
-		sobj = run_sobject_get(run, sym->u.csi, psobj,
-		    nameref->name->sid);
-
-		/* Return reference to the object. */
-		run_reference(run, sobj, res);
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_enum:
-#ifdef DEBUG_RUN_TRACE
-		printf("Referencing enum.\n");
-#endif
-		item = rdata_item_new(ic_value);
-		value = rdata_value_new();
-		var = rdata_var_new(vc_symbol);
-		symbol_v = rdata_symbol_new();
-
-		item->u.value = value;
-		value->var = var;
-		var->u.symbol_v = symbol_v;
-
-		symbol_v->sym = sym;
-		*res = item;
-		break;
-	case sc_deleg:
-		/* XXX TODO */
-		printf("Unimplemented: Delegate name reference.\n");
-		abort();
-		break;
-	case sc_fun:
-		/* There should be no global functions. */
-		assert(csi != NULL);
-
-		if (symbol_search_csi(run->program, csi, nameref->name) ==
-		    NULL) {
-			/* Function is not in the current object. */
-			printf("Error: Cannot access non-static member "
-			    "function '");
-			symbol_print_fqn(sym);
-			printf("' from nested CSI '");
-			symbol_print_fqn(csi_sym);
-			printf("'.\n");
-			exit(1);
-		}
-
-		/* Construct delegate. */
-		item = rdata_item_new(ic_value);
-		value = rdata_value_new();
-		item->u.value = value;
-
-		var = rdata_var_new(vc_deleg);
-		deleg_v = rdata_deleg_new();
-		value->var = var;
-		var->u.deleg_v = deleg_v;
-
-		deleg_v->obj = proc_ar->obj;
-		deleg_v->sym = sym;
-
-		*res = item;
-		break;
-	case sc_var:
-	case sc_prop:
-#ifdef DEBUG_RUN_TRACE
-		if (sym->sc == sc_var)
-			printf("Referencing member variable.\n");
-		else
-			printf("Referencing unqualified property.\n");
-#endif
-		/* There should be no global variables or properties. */
-		assert(csi != NULL);
-
-		if (symbol_search_csi(run->program, csi, nameref->name) ==
-		    NULL && !stree_symbol_is_static(sym)) {
-			/* Symbol is not in the current object. */
-			printf("Error: Cannot access non-static member "
-			    "variable '");
-			symbol_print_fqn(sym);
-			printf("' from nested CSI '");
-			symbol_print_fqn(csi_sym);
-			printf("'.\n");
-			exit(1);
-		}
-
-		/*
-		 * Determine object in which the symbol resides
-		 */
-		if (stree_symbol_is_static(sym)) {
-			/*
-			 * Class object
-			 * XXX This is too slow!
-			 *
-			 * However fixing this is non-trivial. We would
-			 * have to have pointer to static object available
-			 * for each object (therefore also for each object
-			 * type).
-			 */
-			sobj = run_sobject_find(run, sym->outer_csi);
-			assert(sobj->vc == vc_object);
-			aobj = sobj->u.object_v;
-		} else {
-			/*
-			 * Instance object. Currently we don't support
-			 * true inner classes, thus we know the symbol is
-			 * in the active object (there is no dynamic parent).
-			 */
-			sobj = proc_ar->obj;
-			aobj = sobj->u.object_v;
-		}
-
-		if (sym->sc == sc_var) {
-			/* Find member variable in object. */
-			member_var = intmap_get(&aobj->fields,
-			    nameref->name->sid);
-			assert(member_var != NULL);
-
-			/* Return address of the variable. */
-			item = rdata_item_new(ic_address);
-			address = rdata_address_new(ac_var);
-			addr_var = rdata_addr_var_new();
-
-			item->u.address = address;
-			address->u.var_a = addr_var;
-			addr_var->vref = member_var;
-
-			*res = item;
-		} else {
-			/* Construct named property address. */
-			item = rdata_item_new(ic_address);
-			address = rdata_address_new(ac_prop);
-			addr_prop = rdata_addr_prop_new(apc_named);
-			aprop_named = rdata_aprop_named_new();
-			item->u.address = address;
-			address->u.prop_a = addr_prop;
-			addr_prop->u.named = aprop_named;
-
-			deleg_p = rdata_deleg_new();
-			deleg_p->obj = sobj;
-			deleg_p->sym = sym;
-			addr_prop->u.named->prop_d = deleg_p;
-
-			*res = item;
-		}
-		break;
-	}
-}
-
-/** Evaluate literal.
- *
- * @param run		Runner object
- * @param literal	Literal
- * @param res		Place to store result
- */
-static void run_literal(run_t *run, stree_literal_t *literal,
-    rdata_item_t **res)
-{
-#ifdef DEBUG_RUN_TRACE
-	printf("Run literal.\n");
-#endif
-	switch (literal->ltc) {
-	case ltc_bool:
-		run_lit_bool(run, &literal->u.lit_bool, res);
-		break;
-	case ltc_char:
-		run_lit_char(run, &literal->u.lit_char, res);
-		break;
-	case ltc_int:
-		run_lit_int(run, &literal->u.lit_int, res);
-		break;
-	case ltc_ref:
-		run_lit_ref(run, &literal->u.lit_ref, res);
-		break;
-	case ltc_string:
-		run_lit_string(run, &literal->u.lit_string, res);
-		break;
-	}
-}
-
-/** Evaluate Boolean literal.
- *
- * @param run		Runner object
- * @param lit_bool	Boolean literal
- * @param res		Place to store result
- */
-static void run_lit_bool(run_t *run, stree_lit_bool_t *lit_bool,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run Boolean literal.\n");
-#endif
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.bool_v = bool_v;
-	bool_v->value = lit_bool->value;
-
-	*res = item;
-}
-
-/** Evaluate character literal. */
-static void run_lit_char(run_t *run, stree_lit_char_t *lit_char,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_char_t *char_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run character literal.\n");
-#endif
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_char);
-	char_v = rdata_char_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.char_v = char_v;
-	bigint_clone(&lit_char->value, &char_v->value);
-
-	*res = item;
-}
-
-/** Evaluate integer literal.
- *
- * @param run		Runner object
- * @param lit_int	Integer literal
- * @param res		Place to store result
- */
-static void run_lit_int(run_t *run, stree_lit_int_t *lit_int,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_int_t *int_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run integer literal.\n");
-#endif
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_int);
-	int_v = rdata_int_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.int_v = int_v;
-	bigint_clone(&lit_int->value, &int_v->value);
-
-	*res = item;
-}
-
-/** Evaluate reference literal (@c nil).
- *
- * @param run		Runner object
- * @param lit_ref	Reference literal
- * @param res		Place to store result
- */
-static void run_lit_ref(run_t *run, stree_lit_ref_t *lit_ref,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_ref_t *ref_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run reference literal (nil).\n");
-#endif
-	(void) run;
-	(void) lit_ref;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_ref);
-	ref_v = rdata_ref_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.ref_v = ref_v;
-	ref_v->vref = NULL;
-
-	*res = item;
-}
-
-/** Evaluate string literal.
- *
- * @param run		Runner object
- * @param lit_string	String literal
- * @param res		Place to store result
- */
-static void run_lit_string(run_t *run, stree_lit_string_t *lit_string,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_string_t *string_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run integer literal.\n");
-#endif
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_string);
-	string_v = rdata_string_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.string_v = string_v;
-	string_v->value = lit_string->value;
-
-	*res = item;
-}
-
-/** Evaluate @c self reference.
- *
- * @param run		Runner object
- * @param self_ref	Self reference
- * @param res		Place to store result
- */
-static void run_self_ref(run_t *run, stree_self_ref_t *self_ref,
-    rdata_item_t **res)
-{
-	run_proc_ar_t *proc_ar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run self reference.\n");
-#endif
-	(void) self_ref;
-	proc_ar = run_get_current_proc_ar(run);
-
-	/* Return reference to the currently active object. */
-	run_reference(run, proc_ar->obj, res);
-}
-
-/** Evaluate binary operation.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param res		Place to store result
- */
-static void run_binop(run_t *run, stree_binop_t *binop, rdata_item_t **res)
-{
-	rdata_item_t *rarg1_i, *rarg2_i;
-	rdata_item_t *rarg1_vi, *rarg2_vi;
-	rdata_value_t *v1, *v2;
-
-	rarg1_i = NULL;
-	rarg2_i = NULL;
-	rarg1_vi = NULL;
-	rarg2_vi = NULL;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run binary operation.\n");
-#endif
-	run_expr(run, binop->arg1, &rarg1_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Check binop argument result.\n");
-#endif
-	run_cvt_value_item(run, rarg1_i, &rarg1_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	run_expr(run, binop->arg2, &rarg2_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Check binop argument result.\n");
-#endif
-	run_cvt_value_item(run, rarg2_i, &rarg2_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	v1 = rarg1_vi->u.value;
-	v2 = rarg2_vi->u.value;
-
-	if (v1->var->vc != v2->var->vc) {
-		printf("Unimplemented: Binary operation arguments have "
-		    "different type.\n");
-		exit(1);
-	}
-
-	switch (v1->var->vc) {
-	case vc_bool:
-		run_binop_bool(run, binop, v1, v2, res);
-		break;
-	case vc_char:
-		run_binop_char(run, binop, v1, v2, res);
-		break;
-	case vc_int:
-		run_binop_int(run, binop, v1, v2, res);
-		break;
-	case vc_string:
-		run_binop_string(run, binop, v1, v2, res);
-		break;
-	case vc_ref:
-		run_binop_ref(run, binop, v1, v2, res);
-		break;
-	case vc_enum:
-		run_binop_enum(run, binop, v1, v2, res);
-		break;
-	case vc_deleg:
-	case vc_array:
-	case vc_object:
-	case vc_resource:
-	case vc_symbol:
-		assert(b_false);
-	}
-
-cleanup:
-	if (rarg1_i != NULL)
-		rdata_item_destroy(rarg1_i);
-	if (rarg2_i != NULL)
-		rdata_item_destroy(rarg2_i);
-	if (rarg1_vi != NULL)
-		rdata_item_destroy(rarg1_vi);
-	if (rarg2_vi != NULL)
-		rdata_item_destroy(rarg2_vi);
-}
-
-/** Evaluate binary operation on bool arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_bool(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-	bool_t b1, b2;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.bool_v = bool_v;
-
-	b1 = v1->var->u.bool_v->value;
-	b2 = v2->var->u.bool_v->value;
-
-	switch (binop->bc) {
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-		assert(b_false);
-		/* Fallthrough */
-
-	case bo_equal:
-		bool_v->value = (b1 == b2);
-		break;
-	case bo_notequal:
-		bool_v->value = (b1 != b2);
-		break;
-	case bo_lt:
-		bool_v->value = (b1 == b_false) && (b2 == b_true);
-		break;
-	case bo_gt:
-		bool_v->value = (b1 == b_true) && (b2 == b_false);
-		break;
-	case bo_lt_equal:
-		bool_v->value = (b1 == b_false) || (b2 == b_true);
-		break;
-	case bo_gt_equal:
-		bool_v->value = (b1 == b_true) || (b2 == b_false);
-		break;
-
-	case bo_and:
-		bool_v->value = (b1 == b_true) && (b2 == b_true);
-		break;
-	case bo_or:
-		bool_v->value = (b1 == b_true) || (b2 == b_true);
-		break;
-	}
-
-	*res = item;
-}
-
-/** Evaluate binary operation on char arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_char(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-	bigint_t *c1, *c2;
-	bigint_t diff;
-	bool_t zf, nf;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-
-	item->u.value = value;
-
-	c1 = &v1->var->u.char_v->value;
-	c2 = &v2->var->u.char_v->value;
-
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-	var->u.bool_v = bool_v;
-	value->var = var;
-
-	bigint_sub(c1, c2, &diff);
-	zf = bigint_is_zero(&diff);
-	nf = bigint_is_negative(&diff);
-
-	switch (binop->bc) {
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-		assert(b_false);
-		/* Fallthrough */
-
-	case bo_equal:
-		bool_v->value = zf;
-		break;
-	case bo_notequal:
-		bool_v->value = !zf;
-		break;
-	case bo_lt:
-		bool_v->value = (!zf && nf);
-		break;
-	case bo_gt:
-		bool_v->value = (!zf && !nf);
-		break;
-	case bo_lt_equal:
-		bool_v->value = (zf || nf);
-		break;
-	case bo_gt_equal:
-		bool_v->value = !nf;
-		break;
-
-	case bo_and:
-	case bo_or:
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Evaluate binary operation on int arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_int(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_int_t *int_v;
-	rdata_bool_t *bool_v;
-
-	bigint_t *i1, *i2;
-	bigint_t diff;
-	bool_t done;
-	bool_t zf, nf;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-
-	item->u.value = value;
-
-	i1 = &v1->var->u.int_v->value;
-	i2 = &v2->var->u.int_v->value;
-
-	done = b_true;
-
-	switch (binop->bc) {
-	case bo_plus:
-		int_v = rdata_int_new();
-		bigint_add(i1, i2, &int_v->value);
-		break;
-	case bo_minus:
-		int_v = rdata_int_new();
-		bigint_sub(i1, i2, &int_v->value);
-		break;
-	case bo_mult:
-		int_v = rdata_int_new();
-		bigint_mul(i1, i2, &int_v->value);
-		break;
-	default:
-		done = b_false;
-		break;
-	}
-
-	if (done) {
-		var = rdata_var_new(vc_int);
-		var->u.int_v = int_v;
-		value->var = var;
-		*res = item;
-		return;
-	}
-
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-	var->u.bool_v = bool_v;
-	value->var = var;
-
-	/* Relational operation. */
-
-	bigint_sub(i1, i2, &diff);
-	zf = bigint_is_zero(&diff);
-	nf = bigint_is_negative(&diff);
-
-	switch (binop->bc) {
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-		assert(b_false);
-		/* Fallthrough */
-
-	case bo_equal:
-		bool_v->value = zf;
-		break;
-	case bo_notequal:
-		bool_v->value = !zf;
-		break;
-	case bo_lt:
-		bool_v->value = (!zf && nf);
-		break;
-	case bo_gt:
-		bool_v->value = (!zf && !nf);
-		break;
-	case bo_lt_equal:
-		bool_v->value = (zf || nf);
-		break;
-	case bo_gt_equal:
-		bool_v->value = !nf;
-		break;
-	case bo_and:
-	case bo_or:
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Evaluate binary operation on string arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_string(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_string_t *string_v;
-	rdata_bool_t *bool_v;
-	bool_t done;
-	bool_t zf;
-
-	const char *s1, *s2;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-
-	item->u.value = value;
-
-	s1 = v1->var->u.string_v->value;
-	s2 = v2->var->u.string_v->value;
-
-	done = b_true;
-
-	switch (binop->bc) {
-	case bo_plus:
-		/* Concatenate strings. */
-		string_v = rdata_string_new();
-		string_v->value = os_str_acat(s1, s2);
-		break;
-	default:
-		done = b_false;
-		break;
-	}
-
-	if (done) {
-		var = rdata_var_new(vc_string);
-		var->u.string_v = string_v;
-		value->var = var;
-		*res = item;
-		return;
-	}
-
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-	var->u.bool_v = bool_v;
-	value->var = var;
-
-	/* Relational operation. */
-
-	zf = os_str_cmp(s1, s2) == 0;
-
-	switch (binop->bc) {
-	case bo_equal:
-		bool_v->value = zf;
-		break;
-	case bo_notequal:
-		bool_v->value = !zf;
-		break;
-	default:
-		printf("Error: Invalid binary operation on string "
-		    "arguments (%d).\n", binop->bc);
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Evaluate binary operation on ref arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_ref(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-	rdata_var_t *ref1, *ref2;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.bool_v = bool_v;
-
-	ref1 = v1->var->u.ref_v->vref;
-	ref2 = v2->var->u.ref_v->vref;
-
-	switch (binop->bc) {
-	case bo_equal:
-		bool_v->value = (ref1 == ref2);
-		break;
-	case bo_notequal:
-		bool_v->value = (ref1 != ref2);
-		break;
-	default:
-		printf("Error: Invalid binary operation on reference "
-		    "arguments (%d).\n", binop->bc);
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Evaluate binary operation on enum arguments.
- *
- * @param run		Runner object
- * @param binop		Binary operation
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result
- */
-static void run_binop_enum(run_t *run, stree_binop_t *binop, rdata_value_t *v1,
-    rdata_value_t *v2, rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-	stree_embr_t *e1, *e2;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.bool_v = bool_v;
-
-	e1 = v1->var->u.enum_v->value;
-	e2 = v2->var->u.enum_v->value;
-
-	switch (binop->bc) {
-	case bo_equal:
-		bool_v->value = (e1 == e2);
-		break;
-	case bo_notequal:
-		bool_v->value = (e1 != e2);
-		break;
-	default:
-		/* Should have been caught by static typing. */
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Evaluate unary operation.
- *
- * @param run		Runner object
- * @param unop		Unary operation
- * @param res		Place to store result
- */
-static void run_unop(run_t *run, stree_unop_t *unop, rdata_item_t **res)
-{
-	rdata_item_t *rarg_i;
-	rdata_item_t *rarg_vi;
-	rdata_value_t *val;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run unary operation.\n");
-#endif
-	rarg_i = NULL;
-	rarg_vi = NULL;
-
-	run_expr(run, unop->arg, &rarg_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Check unop argument result.\n");
-#endif
-	run_cvt_value_item(run, rarg_i, &rarg_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	val = rarg_vi->u.value;
-
-	switch (val->var->vc) {
-	case vc_bool:
-		run_unop_bool(run, unop, val, res);
-		break;
-	case vc_int:
-		run_unop_int(run, unop, val, res);
-		break;
-	default:
-		printf("Unimplemented: Unrary operation argument of "
-		    "type %d.\n", val->var->vc);
-		run_raise_error(run);
-		*res = run_recovery_item(run);
-		break;
-	}
-cleanup:
-	if (rarg_i != NULL)
-		rdata_item_destroy(rarg_i);
-	if (rarg_vi != NULL)
-		rdata_item_destroy(rarg_vi);
-}
-
-/** Evaluate unary operation on bool argument.
- *
- * @param run		Runner object
- * @param unop		Unary operation
- * @param val		Value of argument
- * @param res		Place to store result
- */
-static void run_unop_bool(run_t *run, stree_unop_t *unop, rdata_value_t *val,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_bool_t *bool_v;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_bool);
-	bool_v = rdata_bool_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.bool_v = bool_v;
-
-	switch (unop->uc) {
-	case uo_plus:
-	case uo_minus:
-		assert(b_false);
-		/* Fallthrough */
-
-	case uo_not:
-		bool_v->value = !val->var->u.bool_v->value;
-		break;
-	}
-
-	*res = item;
-}
-
-/** Evaluate unary operation on int argument.
- *
- * @param run		Runner object
- * @param unop		Unary operation
- * @param val		Value of argument
- * @param res		Place to store result
- */
-static void run_unop_int(run_t *run, stree_unop_t *unop, rdata_value_t *val,
-    rdata_item_t **res)
-{
-	rdata_item_t *item;
-	rdata_value_t *value;
-	rdata_var_t *var;
-	rdata_int_t *int_v;
-
-	(void) run;
-
-	item = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	var = rdata_var_new(vc_int);
-	int_v = rdata_int_new();
-
-	item->u.value = value;
-	value->var = var;
-	var->u.int_v = int_v;
-
-	switch (unop->uc) {
-	case uo_plus:
-		bigint_clone(&val->var->u.int_v->value, &int_v->value);
-		break;
-	case uo_minus:
-		bigint_reverse_sign(&val->var->u.int_v->value,
-		    &int_v->value);
-		break;
-	case uo_not:
-		assert(b_false);
-	}
-
-	*res = item;
-}
-
-/** Run equality comparison of two values
- *
- * This should be equivalent to equality ('==') binary operation.
- * XXX Duplicating code of run_binop_xxx().
- *
- * @param run		Runner object
- * @param v1		Value of first argument
- * @param v2		Value of second argument
- * @param res		Place to store result (plain boolean value)
- */
-void run_equal(run_t *run, rdata_value_t *v1, rdata_value_t *v2, bool_t *res)
-{
-	bool_t b1, b2;
-	bigint_t *c1, *c2;
-	bigint_t *i1, *i2;
-	bigint_t diff;
-	const char *s1, *s2;
-	rdata_var_t *ref1, *ref2;
-	stree_embr_t *e1, *e2;
-
-	(void) run;
-	assert(v1->var->vc == v2->var->vc);
-
-	switch (v1->var->vc) {
-	case vc_bool:
-		b1 = v1->var->u.bool_v->value;
-		b2 = v2->var->u.bool_v->value;
-
-		*res = (b1 == b2);
-		break;
-	case vc_char:
-		c1 = &v1->var->u.char_v->value;
-		c2 = &v2->var->u.char_v->value;
-
-		bigint_sub(c1, c2, &diff);
-		*res = bigint_is_zero(&diff);
-		break;
-	case vc_int:
-		i1 = &v1->var->u.int_v->value;
-		i2 = &v2->var->u.int_v->value;
-
-		bigint_sub(i1, i2, &diff);
-		*res = bigint_is_zero(&diff);
-		break;
-	case vc_string:
-		s1 = v1->var->u.string_v->value;
-		s2 = v2->var->u.string_v->value;
-
-		*res = os_str_cmp(s1, s2) == 0;
-		break;
-	case vc_ref:
-		ref1 = v1->var->u.ref_v->vref;
-		ref2 = v2->var->u.ref_v->vref;
-
-		*res = (ref1 == ref2);
-		break;
-	case vc_enum:
-		e1 = v1->var->u.enum_v->value;
-		e2 = v2->var->u.enum_v->value;
-
-		*res = (e1 == e2);
-		break;
-
-	case vc_deleg:
-	case vc_array:
-	case vc_object:
-	case vc_resource:
-	case vc_symbol:
-		assert(b_false);
-	}
-}
-
-/** Evaluate @c new operation.
- *
- * Evaluates operation per the @c new operator that creates a new
- * instance of some type.
- *
- * @param run		Runner object
- * @param unop		Unary operation
- * @param res		Place to store result
- */
-static void run_new(run_t *run, stree_new_t *new_op, rdata_item_t **res)
-{
-	tdata_item_t *titem;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run 'new' operation.\n");
-#endif
-	/* Evaluate type expression */
-	run_texpr(run->program, run_get_current_csi(run), new_op->texpr,
-	    &titem);
-
-	switch (titem->tic) {
-	case tic_tarray:
-		run_new_array(run, new_op, titem, res);
-		break;
-	case tic_tobject:
-		run_new_object(run, new_op, titem, res);
-		break;
-	default:
-		printf("Error: Invalid argument to operator 'new', "
-		    "expected object.\n");
-		exit(1);
-	}
-}
-
-/** Create new array.
- *
- * @param run		Runner object
- * @param new_op	New operation
- * @param titem		Type of new var node (tic_tarray)
- * @param res		Place to store result
- */
-static void run_new_array(run_t *run, stree_new_t *new_op,
-    tdata_item_t *titem, rdata_item_t **res)
-{
-	tdata_array_t *tarray;
-	rdata_array_t *array;
-	rdata_var_t *array_var;
-	rdata_var_t *elem_var;
-
-	rdata_item_t *rexpr, *rexpr_vi;
-	rdata_var_t *rexpr_var;
-
-	stree_expr_t *expr;
-
-	list_node_t *node;
-	int length;
-	int i;
-	errno_t rc;
-	int iextent;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Create new array.\n");
-#endif
-	(void) run;
-	(void) new_op;
-
-	assert(titem->tic == tic_tarray);
-	tarray = titem->u.tarray;
-
-	/* Create the array. */
-	assert(titem->u.tarray->rank > 0);
-	array = rdata_array_new(titem->u.tarray->rank);
-
-	/* Compute extents. */
-	node = list_first(&tarray->extents);
-	if (node == NULL) {
-		printf("Error: Extents must be specified when constructing "
-		    "an array with 'new'.\n");
-		exit(1);
-	}
-
-	i = 0;
-	length = 1;
-	while (node != NULL) {
-		expr = list_node_data(node, stree_expr_t *);
-
-		/* Evaluate extent argument. */
-		run_expr(run, expr, &rexpr);
-		if (run_is_bo(run)) {
-			*res = run_recovery_item(run);
-			return;
-		}
-
-		run_cvt_value_item(run, rexpr, &rexpr_vi);
-		if (run_is_bo(run)) {
-			*res = run_recovery_item(run);
-			return;
-		}
-
-		assert(rexpr_vi->ic == ic_value);
-		rexpr_var = rexpr_vi->u.value->var;
-
-		if (rexpr_var->vc != vc_int) {
-			printf("Error: Array extent must be an integer.\n");
-			exit(1);
-		}
-
-#ifdef DEBUG_RUN_TRACE
-		printf("Array extent: ");
-		bigint_print(&rexpr_var->u.int_v->value);
-		printf(".\n");
-#endif
-		rc = bigint_get_value_int(&rexpr_var->u.int_v->value,
-		    &iextent);
-		if (rc != EOK) {
-			printf("Memory allocation failed (big int used).\n");
-			exit(1);
-		}
-
-		array->extent[i] = iextent;
-		length = length * array->extent[i];
-
-		node = list_next(&tarray->extents, node);
-		i += 1;
-	}
-
-	array->element = calloc(length, sizeof(rdata_var_t *));
-	if (array->element == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	/* Create member variables */
-	for (i = 0; i < length; ++i) {
-		/* Create and initialize element. */
-		run_var_new(run, tarray->base_ti, &elem_var);
-
-		array->element[i] = elem_var;
-	}
-
-	/* Create array variable. */
-	array_var = rdata_var_new(vc_array);
-	array_var->u.array_v = array;
-
-	/* Create reference to the new array. */
-	run_reference(run, array_var, res);
-}
-
-/** Create new object.
- *
- * @param run		Runner object
- * @param new_op	New operation
- * @param titem		Type of new var node (tic_tobject)
- * @param res		Place to store result
- */
-static void run_new_object(run_t *run, stree_new_t *new_op,
-    tdata_item_t *titem, rdata_item_t **res)
-{
-	stree_csi_t *csi;
-	rdata_item_t *obj_i;
-	list_t arg_vals;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Create new object.\n");
-#endif
-	/* Lookup object CSI. */
-	assert(titem->tic == tic_tobject);
-	csi = titem->u.tobject->csi;
-
-	/* Evaluate constructor arguments. */
-	run_call_args(run, &new_op->ctor_args, &arg_vals);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	/* Create CSI instance. */
-	run_new_csi_inst_ref(run, csi, sn_nonstatic, res);
-
-	/* Run the constructor. */
-	run_dereference(run, *res, NULL, &obj_i);
-	assert(obj_i->ic == ic_address);
-	assert(obj_i->u.address->ac == ac_var);
-	run_object_ctor(run, obj_i->u.address->u.var_a->vref, &arg_vals);
-	rdata_item_destroy(obj_i);
-
-	/* Destroy argument values */
-	run_destroy_arg_vals(&arg_vals);
-}
-
-/** Evaluate member acccess.
- *
- * Evaluate operation per the member access ('.') operator.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param res		Place to store result
- */
-static void run_access(run_t *run, stree_access_t *access, rdata_item_t **res)
-{
-	rdata_item_t *rarg;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run access operation.\n");
-#endif
-	rarg = NULL;
-
-	run_expr(run, access->arg, &rarg);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	if (rarg == NULL) {
-		printf("Error: Sub-expression has no value.\n");
-		exit(1);
-	}
-
-	run_access_item(run, access, rarg, res);
-cleanup:
-	if (rarg != NULL)
-		rdata_item_destroy(rarg);
-}
-
-/** Evaluate member acccess (with base already evaluated).
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_item(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res)
-{
-	var_class_t vc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run access operation on pre-evaluated base.\n");
-#endif
-	vc = run_item_get_vc(run, arg);
-
-	switch (vc) {
-	case vc_ref:
-		run_access_ref(run, access, arg, res);
-		break;
-	case vc_deleg:
-		run_access_deleg(run, access, arg, res);
-		break;
-	case vc_object:
-		run_access_object(run, access, arg, res);
-		break;
-	case vc_symbol:
-		run_access_symbol(run, access, arg, res);
-		break;
-
-	case vc_bool:
-	case vc_char:
-	case vc_enum:
-	case vc_int:
-	case vc_string:
-	case vc_array:
-	case vc_resource:
-		printf("Unimplemented: Using access operator ('.') "
-		    "with unsupported data type (value/%d).\n", vc);
-		exit(1);
-	}
-}
-
-/** Evaluate reference acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_ref(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res)
-{
-	rdata_item_t *darg;
-
-	/* Implicitly dereference. */
-	run_dereference(run, arg, access->arg->cspan, &darg);
-
-	if (run->thread_ar->bo_mode != bm_none) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	/* Try again. */
-	run_access_item(run, access, darg, res);
-
-	/* Destroy temporary */
-	rdata_item_destroy(darg);
-}
-
-/** Evaluate delegate member acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_deleg(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res)
-{
-	(void) run;
-	(void) access;
-	(void) arg;
-	(void) res;
-
-	printf("Error: Using '.' with delegate.\n");
-	exit(1);
-}
-
-/** Evaluate object member acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_object(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res)
-{
-	rdata_var_t *obj_var;
-	rdata_object_t *object;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run object access operation.\n");
-#endif
-	assert(arg->ic == ic_address);
-	assert(arg->u.address->ac == ac_var);
-
-	obj_var = arg->u.address->u.var_a->vref;
-	assert(obj_var->vc == vc_object);
-
-	object = obj_var->u.object_v;
-
-	if (object->static_obj == sn_static)
-		run_access_object_static(run, access, obj_var, res);
-	else
-		run_access_object_nonstatic(run, access, obj_var, res);
-}
-
-/** Evaluate static object member acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_object_static(run_t *run, stree_access_t *access,
-    rdata_var_t *obj_var, rdata_item_t **res)
-{
-	rdata_object_t *object;
-	stree_symbol_t *member;
-	stree_csi_t *member_csi;
-
-	rdata_deleg_t *deleg_v;
-	rdata_item_t *ritem;
-	rdata_value_t *rvalue;
-	rdata_var_t *rvar;
-	rdata_address_t *address;
-	rdata_addr_var_t *addr_var;
-	rdata_addr_prop_t *addr_prop;
-	rdata_aprop_named_t *aprop_named;
-	rdata_deleg_t *deleg_p;
-	rdata_var_t *mvar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run static object access operation.\n");
-#endif
-	assert(obj_var->vc == vc_object);
-	object = obj_var->u.object_v;
-
-	assert(object->static_obj == sn_static);
-
-	member = symbol_search_csi(run->program, object->class_sym->u.csi,
-	    access->member_name);
-
-	/* Member existence should be ensured by static type checking. */
-	assert(member != NULL);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found member '%s'.\n",
-	    strtab_get_str(access->member_name->sid));
-#endif
-
-	switch (member->sc) {
-	case sc_csi:
-		/* Get child static object. */
-		member_csi = symbol_to_csi(member);
-		assert(member_csi != NULL);
-
-		mvar = run_sobject_get(run, member_csi, obj_var,
-		    access->member_name->sid);
-
-		ritem = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_var);
-		ritem->u.address = address;
-
-		addr_var = rdata_addr_var_new();
-		address->u.var_a = addr_var;
-		addr_var->vref = mvar;
-
-		*res = ritem;
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		printf("Error: Accessing object member which is a delegate.\n");
-		exit(1);
-	case sc_enum:
-		printf("Error: Accessing object member which is an enum.\n");
-		exit(1);
-	case sc_fun:
-		/* Construct anonymous delegate. */
-		ritem = rdata_item_new(ic_value);
-		rvalue = rdata_value_new();
-		ritem->u.value = rvalue;
-
-		rvar = rdata_var_new(vc_deleg);
-		rvalue->var = rvar;
-
-		deleg_v = rdata_deleg_new();
-		rvar->u.deleg_v = deleg_v;
-
-		deleg_v->obj = obj_var;
-		deleg_v->sym = member;
-		*res = ritem;
-		break;
-	case sc_var:
-		/* Get static object member variable. */
-		mvar = intmap_get(&object->fields, access->member_name->sid);
-
-		ritem = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_var);
-		ritem->u.address = address;
-
-		addr_var = rdata_addr_var_new();
-		address->u.var_a = addr_var;
-		addr_var->vref = mvar;
-
-		*res = ritem;
-		break;
-	case sc_prop:
-		/* Construct named property address. */
-		ritem = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_prop);
-		addr_prop = rdata_addr_prop_new(apc_named);
-		aprop_named = rdata_aprop_named_new();
-		ritem->u.address = address;
-		address->u.prop_a = addr_prop;
-		addr_prop->u.named = aprop_named;
-
-		deleg_p = rdata_deleg_new();
-		deleg_p->obj = obj_var;
-		deleg_p->sym = member;
-		addr_prop->u.named->prop_d = deleg_p;
-
-		*res = ritem;
-		break;
-	}
-}
-
-/** Evaluate object member acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_object_nonstatic(run_t *run, stree_access_t *access,
-    rdata_var_t *obj_var, rdata_item_t **res)
-{
-	rdata_object_t *object;
-	stree_symbol_t *member;
-	rdata_item_t *ritem;
-	rdata_address_t *address;
-	rdata_addr_var_t *addr_var;
-	rdata_addr_prop_t *addr_prop;
-	rdata_aprop_named_t *aprop_named;
-	rdata_deleg_t *deleg_p;
-
-	rdata_value_t *value;
-	rdata_deleg_t *deleg_v;
-	rdata_var_t *var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run nonstatic object access operation.\n");
-#endif
-	assert(obj_var->vc == vc_object);
-	object = obj_var->u.object_v;
-
-	assert(object->static_obj == sn_nonstatic);
-
-	member = symbol_search_csi(run->program, object->class_sym->u.csi,
-	    access->member_name);
-
-	if (member == NULL) {
-		printf("Error: Object of class '");
-		symbol_print_fqn(object->class_sym);
-		printf("' has no member named '%s'.\n",
-		    strtab_get_str(access->member_name->sid));
-		exit(1);
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found member '%s'.\n",
-	    strtab_get_str(access->member_name->sid));
-#endif
-
-	/* Make compiler happy. */
-	ritem = NULL;
-
-	switch (member->sc) {
-	case sc_csi:
-		printf("Error: Accessing object member which is nested CSI.\n");
-		exit(1);
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		printf("Error: Accessing object member which is a delegate.\n");
-		exit(1);
-	case sc_enum:
-		printf("Error: Accessing object member which is an enum.\n");
-		exit(1);
-	case sc_fun:
-		/* Construct anonymous delegate. */
-		ritem = rdata_item_new(ic_value);
-		value = rdata_value_new();
-		ritem->u.value = value;
-
-		var = rdata_var_new(vc_deleg);
-		value->var = var;
-		deleg_v = rdata_deleg_new();
-		var->u.deleg_v = deleg_v;
-
-		deleg_v->obj = obj_var;
-		deleg_v->sym = member;
-		break;
-	case sc_var:
-		/* Construct variable address item. */
-		ritem = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_var);
-		addr_var = rdata_addr_var_new();
-		ritem->u.address = address;
-		address->u.var_a = addr_var;
-
-		addr_var->vref = intmap_get(&object->fields,
-		    access->member_name->sid);
-		assert(addr_var->vref != NULL);
-		break;
-	case sc_prop:
-		/* Construct named property address. */
-		ritem = rdata_item_new(ic_address);
-		address = rdata_address_new(ac_prop);
-		addr_prop = rdata_addr_prop_new(apc_named);
-		aprop_named = rdata_aprop_named_new();
-		ritem->u.address = address;
-		address->u.prop_a = addr_prop;
-		addr_prop->u.named = aprop_named;
-
-		deleg_p = rdata_deleg_new();
-		deleg_p->obj = obj_var;
-		deleg_p->sym = member;
-		addr_prop->u.named->prop_d = deleg_p;
-		break;
-	}
-
-	*res = ritem;
-}
-
-/** Evaluate symbol member acccess.
- *
- * @param run		Runner object
- * @param access	Access operation
- * @param arg		Evaluated base expression
- * @param res		Place to store result
- */
-static void run_access_symbol(run_t *run, stree_access_t *access,
-    rdata_item_t *arg, rdata_item_t **res)
-{
-	rdata_item_t *arg_vi;
-	rdata_value_t *arg_val;
-	rdata_symbol_t *symbol_v;
-	stree_embr_t *embr;
-
-	rdata_item_t *ritem;
-	rdata_value_t *rvalue;
-	rdata_var_t *rvar;
-	rdata_enum_t *enum_v;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run symbol access operation.\n");
-#endif
-	run_cvt_value_item(run, arg, &arg_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	arg_val = arg_vi->u.value;
-	assert(arg_val->var->vc == vc_symbol);
-
-	symbol_v = arg_val->var->u.symbol_v;
-
-	/* XXX Port CSI symbol reference to using vc_symbol */
-	assert(symbol_v->sym->sc == sc_enum);
-
-	embr = stree_enum_find_mbr(symbol_v->sym->u.enum_d,
-	    access->member_name);
-
-	rdata_item_destroy(arg_vi);
-
-	/* Member existence should be ensured by static type checking. */
-	assert(embr != NULL);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found enum member '%s'.\n",
-	    strtab_get_str(access->member_name->sid));
-#endif
-	ritem = rdata_item_new(ic_value);
-	rvalue = rdata_value_new();
-	rvar = rdata_var_new(vc_enum);
-	enum_v = rdata_enum_new();
-
-	ritem->u.value = rvalue;
-	rvalue->var = rvar;
-	rvar->u.enum_v = enum_v;
-	enum_v->value = embr;
-
-	*res = ritem;
-}
-
-/** Call a function.
- *
- * Call a function and return the result in @a res.
- *
- * @param run		Runner object
- * @param call		Call operation
- * @param res		Place to store result
- */
-static void run_call(run_t *run, stree_call_t *call, rdata_item_t **res)
-{
-	rdata_item_t *rdeleg, *rdeleg_vi;
-	rdata_deleg_t *deleg_v;
-	list_t arg_vals;
-
-	stree_fun_t *fun;
-	run_proc_ar_t *proc_ar;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run call operation.\n");
-#endif
-	rdeleg = NULL;
-	rdeleg_vi = NULL;
-
-	run_expr(run, call->fun, &rdeleg);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	run_cvt_value_item(run, rdeleg, &rdeleg_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	assert(rdeleg_vi->ic == ic_value);
-
-	if (rdeleg_vi->u.value->var->vc != vc_deleg) {
-		printf("Unimplemented: Call expression of this type (");
-		rdata_item_print(rdeleg_vi);
-		printf(").\n");
-		exit(1);
-	}
-
-	deleg_v = rdeleg_vi->u.value->var->u.deleg_v;
-
-	if (deleg_v->sym->sc != sc_fun) {
-		printf("Error: Called symbol is not a function.\n");
-		exit(1);
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Call function '");
-	symbol_print_fqn(deleg_v->sym);
-	printf("'\n");
-#endif
-	/* Evaluate function arguments. */
-	run_call_args(run, &call->args, &arg_vals);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	fun = symbol_to_fun(deleg_v->sym);
-	assert(fun != NULL);
-
-	/* Create procedure activation record. */
-	run_proc_ar_create(run, deleg_v->obj, fun->proc, &proc_ar);
-
-	/* Fill in argument values. */
-	run_proc_ar_set_args(run, proc_ar, &arg_vals);
-
-	/* Destroy arg_vals, they are no longer needed. */
-	run_destroy_arg_vals(&arg_vals);
-
-	/* Run the function. */
-	run_proc(run, proc_ar, res);
-
-	if (!run_is_bo(run) && fun->sig->rtype != NULL && *res == NULL) {
-		printf("Error: Function '");
-		symbol_print_fqn(deleg_v->sym);
-		printf("' did not return a value.\n");
-		exit(1);
-	}
-
-	/* Destroy procedure activation record. */
-	run_proc_ar_destroy(run, proc_ar);
-
-cleanup:
-	if (rdeleg != NULL)
-		rdata_item_destroy(rdeleg);
-	if (rdeleg_vi != NULL)
-		rdata_item_destroy(rdeleg_vi);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Returned from function call.\n");
-#endif
-}
-
-/** Evaluate call arguments.
- *
- * Evaluate arguments to function or constructor.
- *
- * @param run		Runner object
- * @param args		Real arguments (list of stree_expr_t)
- * @param arg_vals	Address of uninitialized list to store argument values
- *			(list of rdata_item_t).
- */
-static void run_call_args(run_t *run, list_t *args, list_t *arg_vals)
-{
-	list_node_t *arg_n;
-	stree_expr_t *arg;
-	rdata_item_t *rarg_i, *rarg_vi;
-
-	/* Evaluate function arguments. */
-	list_init(arg_vals);
-	arg_n = list_first(args);
-
-	while (arg_n != NULL) {
-		arg = list_node_data(arg_n, stree_expr_t *);
-		run_expr(run, arg, &rarg_i);
-		if (run_is_bo(run))
-			goto error;
-
-		run_cvt_value_item(run, rarg_i, &rarg_vi);
-		rdata_item_destroy(rarg_i);
-		if (run_is_bo(run))
-			goto error;
-
-		list_append(arg_vals, rarg_vi);
-		arg_n = list_next(args, arg_n);
-	}
-	return;
-
-error:
-	/*
-	 * An exception or error occured while evaluating one of the
-	 * arguments. Destroy already obtained argument values and
-	 * dismantle the list.
-	 */
-	run_destroy_arg_vals(arg_vals);
-}
-
-/** Destroy list of evaluated arguments.
- *
- * Provided a list of evaluated arguments, destroy them, removing them
- * from the list and fini the list itself.
- *
- * @param arg_vals	List of evaluated arguments (value items,
- *			rdata_item_t).
- */
-static void run_destroy_arg_vals(list_t *arg_vals)
-{
-	list_node_t *val_n;
-	rdata_item_t *val_i;
-
-	/*
-	 * An exception or error occured while evaluating one of the
-	 * arguments. Destroy already obtained argument values and
-	 * dismantle the list.
-	 */
-	while (!list_is_empty(arg_vals)) {
-		val_n = list_first(arg_vals);
-		val_i = list_node_data(val_n, rdata_item_t *);
-
-		rdata_item_destroy(val_i);
-		list_remove(arg_vals, val_n);
-	}
-	list_fini(arg_vals);
-}
-
-/** Run index operation.
- *
- * Evaluate operation per the indexing ('[', ']') operator.
- *
- * @param run		Runner object
- * @param index		Index operation
- * @param res		Place to store result
- */
-static void run_index(run_t *run, stree_index_t *index, rdata_item_t **res)
-{
-	rdata_item_t *rbase;
-	rdata_item_t *base_i;
-	list_node_t *node;
-	stree_expr_t *arg;
-	rdata_item_t *rarg_i, *rarg_vi;
-	var_class_t vc;
-	list_t arg_vals;
-	list_node_t *val_n;
-	rdata_item_t *val_i;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run index operation.\n");
-#endif
-	run_expr(run, index->base, &rbase);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	vc = run_item_get_vc(run, rbase);
-
-	/* Implicitly dereference. */
-	if (vc == vc_ref) {
-		run_dereference(run, rbase, index->base->cspan, &base_i);
-		rdata_item_destroy(rbase);
-		if (run_is_bo(run)) {
-			*res = run_recovery_item(run);
-			return;
-		}
-	} else {
-		base_i = rbase;
-	}
-
-	vc = run_item_get_vc(run, base_i);
-
-	/* Evaluate arguments (indices). */
-	node = list_first(&index->args);
-	list_init(&arg_vals);
-
-	while (node != NULL) {
-		arg = list_node_data(node, stree_expr_t *);
-		run_expr(run, arg, &rarg_i);
-		if (run_is_bo(run)) {
-			*res = run_recovery_item(run);
-			goto cleanup;
-		}
-
-		run_cvt_value_item(run, rarg_i, &rarg_vi);
-		rdata_item_destroy(rarg_i);
-		if (run_is_bo(run)) {
-			*res = run_recovery_item(run);
-			goto cleanup;
-		}
-
-		list_append(&arg_vals, rarg_vi);
-
-		node = list_next(&index->args, node);
-	}
-
-	switch (vc) {
-	case vc_array:
-		run_index_array(run, index, base_i, &arg_vals, res);
-		break;
-	case vc_object:
-		run_index_object(run, index, base_i, &arg_vals, res);
-		break;
-	case vc_string:
-		run_index_string(run, index, base_i, &arg_vals, res);
-		break;
-	default:
-		printf("Error: Indexing object of bad type (%d).\n", vc);
-		exit(1);
-	}
-
-	/* Destroy the indexing base temporary */
-	rdata_item_destroy(base_i);
-cleanup:
-	/*
-	 * An exception or error occured while evaluating one of the
-	 * arguments. Destroy already obtained argument values and
-	 * dismantle the list.
-	 */
-	while (!list_is_empty(&arg_vals)) {
-		val_n = list_first(&arg_vals);
-		val_i = list_node_data(val_n, rdata_item_t *);
-
-		rdata_item_destroy(val_i);
-		list_remove(&arg_vals, val_n);
-	}
-
-	list_fini(&arg_vals);
-}
-
-/** Run index operation on array.
- *
- * @param run		Runner object
- * @param index		Index operation
- * @param base		Evaluated base expression
- * @param args		Evaluated indices (list of rdata_item_t)
- * @param res		Place to store result
- */
-static void run_index_array(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res)
-{
-	list_node_t *node;
-	rdata_array_t *array;
-	rdata_item_t *arg;
-
-	int i;
-	int elem_index;
-	int arg_val;
-	errno_t rc;
-
-	rdata_item_t *ritem;
-	rdata_address_t *address;
-	rdata_addr_var_t *addr_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run array index operation.\n");
-#endif
-	(void) run;
-
-	assert(base->ic == ic_address);
-	assert(base->u.address->ac == ac_var);
-	assert(base->u.address->u.var_a->vref->vc == vc_array);
-	array = base->u.address->u.var_a->vref->u.array_v;
-
-	/*
-	 * Linear index of the desired element. Elements are stored in
-	 * lexicographic order with the last index changing the fastest.
-	 */
-	elem_index = 0;
-
-	node = list_first(args);
-	i = 0;
-
-	while (node != NULL) {
-		if (i >= array->rank) {
-			printf("Error: Too many indices for array of rank %d",
-			    array->rank);
-			exit(1);
-		}
-
-		arg = list_node_data(node, rdata_item_t *);
-		assert(arg->ic == ic_value);
-
-		if (arg->u.value->var->vc != vc_int) {
-			printf("Error: Array index is not an integer.\n");
-			exit(1);
-		}
-
-		rc = bigint_get_value_int(
-		    &arg->u.value->var->u.int_v->value,
-		    &arg_val);
-
-		if (rc != EOK || arg_val < 0 || arg_val >= array->extent[i]) {
-#ifdef DEBUG_RUN_TRACE
-			printf("Error: Array index (value: %d) is out of range.\n",
-			    arg_val);
-#endif
-			/* Raise Error.OutOfBounds */
-			run_raise_exc(run,
-			    run->program->builtin->error_outofbounds,
-			    index->expr->cspan);
-			/* XXX It should be cspan of the argument. */
-			*res = run_recovery_item(run);
-			return;
-		}
-
-		elem_index = elem_index * array->extent[i] + arg_val;
-
-		node = list_next(args, node);
-		i += 1;
-	}
-
-	if (i < array->rank) {
-		printf("Error: Too few indices for array of rank %d",
-		    array->rank);
-		exit(1);
-	}
-
-	/* Construct variable address item. */
-	ritem = rdata_item_new(ic_address);
-	address = rdata_address_new(ac_var);
-	addr_var = rdata_addr_var_new();
-	ritem->u.address = address;
-	address->u.var_a = addr_var;
-
-	addr_var->vref = array->element[elem_index];
-
-	*res = ritem;
-}
-
-/** Index an object (via its indexer).
- *
- * @param run		Runner object
- * @param index		Index operation
- * @param base		Evaluated base expression
- * @param args		Evaluated indices (list of rdata_item_t)
- * @param res		Place to store result
- */
-static void run_index_object(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res)
-{
-	rdata_item_t *ritem;
-	rdata_address_t *address;
-	rdata_addr_prop_t *addr_prop;
-	rdata_aprop_indexed_t *aprop_indexed;
-	rdata_var_t *obj_var;
-	stree_csi_t *obj_csi;
-	rdata_deleg_t *object_d;
-	stree_symbol_t *indexer_sym;
-	stree_ident_t *indexer_ident;
-
-	list_node_t *node;
-	rdata_item_t *arg, *arg_copy;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run object index operation.\n");
-#endif
-	(void) index;
-
-	/* Construct property address item. */
-	ritem = rdata_item_new(ic_address);
-	address = rdata_address_new(ac_prop);
-	addr_prop = rdata_addr_prop_new(apc_indexed);
-	aprop_indexed = rdata_aprop_indexed_new();
-	ritem->u.address = address;
-	address->u.prop_a = addr_prop;
-	addr_prop->u.indexed = aprop_indexed;
-
-	if (base->ic != ic_address || base->u.address->ac != ac_var) {
-		/* XXX Several other cases can occur. */
-		printf("Unimplemented: Indexing object varclass via something "
-		    "which is not a simple variable reference.\n");
-		exit(1);
-	}
-
-	/* Find indexer symbol. */
-	obj_var = base->u.address->u.var_a->vref;
-	assert(obj_var->vc == vc_object);
-	indexer_ident = stree_ident_new();
-	indexer_ident->sid = strtab_get_sid(INDEXER_IDENT);
-	obj_csi = symbol_to_csi(obj_var->u.object_v->class_sym);
-	assert(obj_csi != NULL);
-	indexer_sym = symbol_search_csi(run->program, obj_csi, indexer_ident);
-
-	if (indexer_sym == NULL) {
-		printf("Error: Accessing object which does not have an "
-		    "indexer.\n");
-		exit(1);
-	}
-
-	/* Construct delegate. */
-	object_d = rdata_deleg_new();
-	object_d->obj = obj_var;
-	object_d->sym = indexer_sym;
-	aprop_indexed->object_d = object_d;
-
-	/* Copy list of argument values. */
-	list_init(&aprop_indexed->args);
-
-	node = list_first(args);
-	while (node != NULL) {
-		arg = list_node_data(node, rdata_item_t *);
-
-		/*
-		 * Clone argument so that original can
-		 * be freed.
-		 */
-		assert(arg->ic == ic_value);
-		arg_copy = rdata_item_new(ic_value);
-		rdata_value_copy(arg->u.value, &arg_copy->u.value);
-
-		list_append(&aprop_indexed->args, arg_copy);
-		node = list_next(args, node);
-	}
-
-	*res = ritem;
-}
-
-/** Run index operation on string.
- *
- * @param run		Runner object
- * @param index		Index operation
- * @param base		Evaluated base expression
- * @param args		Evaluated indices (list of rdata_item_t)
- * @param res		Place to store result
- */
-static void run_index_string(run_t *run, stree_index_t *index,
-    rdata_item_t *base, list_t *args, rdata_item_t **res)
-{
-	list_node_t *node;
-	rdata_string_t *string;
-	rdata_item_t *base_vi;
-	rdata_item_t *arg;
-
-	int i;
-	int elem_index;
-	int arg_val;
-	errno_t rc1, rc2;
-
-	rdata_value_t *value;
-	rdata_var_t *cvar;
-	rdata_item_t *ritem;
-	int cval;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run string index operation.\n");
-#endif
-	(void) run;
-
-	run_cvt_value_item(run, base, &base_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	assert(base_vi->u.value->var->vc == vc_string);
-	string = base_vi->u.value->var->u.string_v;
-
-	/*
-	 * Linear index of the desired element. Elements are stored in
-	 * lexicographic order with the last index changing the fastest.
-	 */
-	node = list_first(args);
-	elem_index = 0;
-
-	assert(node != NULL);
-
-	i = 0;
-	do {
-		if (i >= 1) {
-			printf("Error: Too many indices string.\n");
-			exit(1);
-		}
-
-		arg = list_node_data(node, rdata_item_t *);
-		assert(arg->ic == ic_value);
-
-		if (arg->u.value->var->vc != vc_int) {
-			printf("Error: String index is not an integer.\n");
-			exit(1);
-		}
-
-		rc1 = bigint_get_value_int(
-		    &arg->u.value->var->u.int_v->value,
-		    &arg_val);
-
-		elem_index = arg_val;
-
-		node = list_next(args, node);
-		i += 1;
-	} while (node != NULL);
-
-	if (i < 1) {
-		printf("Error: Too few indices for string.\n");
-		exit(1);
-	}
-
-	if (rc1 == EOK)
-		rc2 = os_str_get_char(string->value, elem_index, &cval);
-	else
-		rc2 = EOK;
-
-	if (rc1 != EOK || rc2 != EOK) {
-#ifdef DEBUG_RUN_TRACE
-		printf("Error: String index (value: %d) is out of range.\n",
-		    arg_val);
-#endif
-		/* Raise Error.OutOfBounds */
-		run_raise_exc(run, run->program->builtin->error_outofbounds,
-		    index->expr->cspan);
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	/* Construct character value. */
-	ritem = rdata_item_new(ic_value);
-	value = rdata_value_new();
-	ritem->u.value = value;
-
-	cvar = rdata_var_new(vc_char);
-	cvar->u.char_v = rdata_char_new();
-	bigint_init(&cvar->u.char_v->value, cval);
-	value->var = cvar;
-
-	*res = ritem;
-cleanup:
-	rdata_item_destroy(base_vi);
-}
-
-/** Run assignment.
- *
- * Executes an assignment. @c NULL is always stored to @a res because
- * an assignment does not have a value.
- *
- * @param run		Runner object
- * @param assign	Assignment expression
- * @param res		Place to store result
- */
-static void run_assign(run_t *run, stree_assign_t *assign, rdata_item_t **res)
-{
-	rdata_item_t *rdest_i, *rsrc_i;
-	rdata_item_t *rsrc_vi;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run assign operation.\n");
-#endif
-	rdest_i = NULL;
-	rsrc_i = NULL;
-	rsrc_vi = NULL;
-
-	run_expr(run, assign->dest, &rdest_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	run_expr(run, assign->src, &rsrc_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	run_cvt_value_item(run, rsrc_i, &rsrc_vi);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		goto cleanup;
-	}
-
-	assert(rsrc_vi->ic == ic_value);
-
-	if (rdest_i->ic != ic_address) {
-		printf("Error: Address expression required on left side of "
-		    "assignment operator.\n");
-		exit(1);
-	}
-
-	run_address_write(run, rdest_i->u.address, rsrc_vi->u.value);
-
-	*res = NULL;
-cleanup:
-	if (rdest_i != NULL)
-		rdata_item_destroy(rdest_i);
-	if (rsrc_i != NULL)
-		rdata_item_destroy(rsrc_i);
-	if (rsrc_vi != NULL)
-		rdata_item_destroy(rsrc_vi);
-}
-
-/** Execute @c as conversion.
- *
- * @param run		Runner object
- * @param as_op		@c as conversion expression
- * @param res		Place to store result
- */
-static void run_as(run_t *run, stree_as_t *as_op, rdata_item_t **res)
-{
-	rdata_item_t *rarg_i;
-	rdata_item_t *rarg_vi;
-	rdata_item_t *rarg_di;
-	rdata_var_t *arg_vref;
-	tdata_item_t *dtype;
-	run_proc_ar_t *proc_ar;
-
-	stree_symbol_t *obj_csi_sym;
-	stree_csi_t *obj_csi;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run @c as conversion operation.\n");
-#endif
-	run_expr(run, as_op->arg, &rarg_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	/*
-	 * This should always be a reference if the argument is indeed
-	 * a class instance.
-	 */
-	assert(run_item_get_vc(run, rarg_i) == vc_ref);
-	run_cvt_value_item(run, rarg_i, &rarg_vi);
-	rdata_item_destroy(rarg_i);
-
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	assert(rarg_vi->ic == ic_value);
-
-	if (rarg_vi->u.value->var->u.ref_v->vref == NULL) {
-		/* Nil reference is always okay. */
-		*res = rarg_vi;
-		return;
-	}
-
-	run_dereference(run, rarg_vi, NULL, &rarg_di);
-
-	/* Now we should have a variable address. */
-	assert(rarg_di->ic == ic_address);
-	assert(rarg_di->u.address->ac == ac_var);
-
-	arg_vref = rarg_di->u.address->u.var_a->vref;
-
-	proc_ar = run_get_current_proc_ar(run);
-	/* XXX Memoize to avoid recomputing. */
-	run_texpr(run->program, proc_ar->proc->outer_symbol->outer_csi,
-	    as_op->dtype, &dtype);
-
-	assert(arg_vref->vc == vc_object);
-	obj_csi_sym = arg_vref->u.object_v->class_sym;
-	obj_csi = symbol_to_csi(obj_csi_sym);
-	assert(obj_csi != NULL);
-
-	if (tdata_is_csi_derived_from_ti(obj_csi, dtype) != b_true) {
-		printf("Error: Run-time type conversion error. Object is "
-		    "of type '");
-		symbol_print_fqn(obj_csi_sym);
-		printf("' which is not derived from '");
-		tdata_item_print(dtype);
-		printf("'.\n");
-		exit(1);
-	}
-
-	/* The dereferenced item is not used anymore. */
-	rdata_item_destroy(rarg_di);
-
-	*res = rarg_vi;
-}
-
-/** Execute boxing operation.
- *
- * XXX We can scrap this special operation once we have constructors.
- *
- * @param run		Runner object
- * @param box		Boxing operation
- * @param res		Place to store result
- */
-static void run_box(run_t *run, stree_box_t *box, rdata_item_t **res)
-{
-	rdata_item_t *rarg_i;
-	rdata_item_t *rarg_vi;
-
-	stree_symbol_t *csi_sym;
-	stree_csi_t *csi;
-	builtin_t *bi;
-	rdata_var_t *var;
-	rdata_object_t *object;
-
-	sid_t mbr_name_sid;
-	rdata_var_t *mbr_var;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run boxing operation.\n");
-#endif
-	run_expr(run, box->arg, &rarg_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	run_cvt_value_item(run, rarg_i, &rarg_vi);
-	rdata_item_destroy(rarg_i);
-	if (run_is_bo(run)) {
-		*res = run_recovery_item(run);
-		return;
-	}
-
-	assert(rarg_vi->ic == ic_value);
-
-	bi = run->program->builtin;
-
-	/* Just to keep the compiler happy. */
-	csi_sym = NULL;
-
-	switch (rarg_vi->u.value->var->vc) {
-	case vc_bool:
-		csi_sym = bi->boxed_bool;
-		break;
-	case vc_char:
-		csi_sym = bi->boxed_char;
-		break;
-	case vc_int:
-		csi_sym = bi->boxed_int;
-		break;
-	case vc_string:
-		csi_sym = bi->boxed_string;
-		break;
-
-	case vc_ref:
-	case vc_deleg:
-	case vc_enum:
-	case vc_array:
-	case vc_object:
-	case vc_resource:
-	case vc_symbol:
-		assert(b_false);
-	}
-
-	csi = symbol_to_csi(csi_sym);
-	assert(csi != NULL);
-
-	/* Construct object of the relevant boxed type. */
-	run_new_csi_inst_ref(run, csi, sn_nonstatic, res);
-
-	/* Set the 'Value' field */
-
-	assert((*res)->ic == ic_value);
-	assert((*res)->u.value->var->vc == vc_ref);
-	var = (*res)->u.value->var->u.ref_v->vref;
-	assert(var->vc == vc_object);
-	object = var->u.object_v;
-
-	mbr_name_sid = strtab_get_sid("Value");
-	mbr_var = intmap_get(&object->fields, mbr_name_sid);
-	assert(mbr_var != NULL);
-
-	rdata_var_write(mbr_var, rarg_vi->u.value);
-	rdata_item_destroy(rarg_vi);
-}
-
-/** Create new CSI instance and return reference to it.
- *
- * Create a new object, instance of @a csi.
- * XXX This does not work with generics as @a csi cannot specify a generic
- * type.
- *
- * Initialize the fields with default values of their types, but do not
- * run any constructor.
- *
- * If @a sn is @c sn_nonstatic a regular object is created, containing all
- * non-static member variables. If @a sn is @c sn_static a static object
- * is created, containing all static member variables.
- *
- * @param run		Runner object
- * @param csi		CSI to create instance of
- * @param sn		@c sn_static to create a static (class) object,
- *			@c sn_nonstatic to create a regular object
- * @param res		Place to store result
- */
-void run_new_csi_inst_ref(run_t *run, stree_csi_t *csi, statns_t sn,
-    rdata_item_t **res)
-{
-	rdata_var_t *obj_var;
-
-	/* Create object. */
-	run_new_csi_inst(run, csi, sn, &obj_var);
-
-	/* Create reference to the new object. */
-	run_reference(run, obj_var, res);
-}
-
-/** Create new CSI instance.
- *
- * Create a new object, instance of @a csi.
- * XXX This does not work with generics as @a csi cannot specify a generic
- * type.
- *
- * Initialize the fields with default values of their types, but do not
- * run any constructor.
- *
- * If @a sn is @c sn_nonstatic a regular object is created, containing all
- * non-static member variables. If @a sn is @c sn_static a static object
- * is created, containing all static member variables.
- *
- * @param run		Runner object
- * @param csi		CSI to create instance of
- * @param sn		@c sn_static to create a static (class) object,
- *			@c sn_nonstatic to create a regular object
- * @param res		Place to store result
- */
-void run_new_csi_inst(run_t *run, stree_csi_t *csi, statns_t sn,
-    rdata_var_t **res)
-{
-	rdata_object_t *obj;
-	rdata_var_t *obj_var;
-
-	stree_symbol_t *csi_sym;
-	stree_csimbr_t *csimbr;
-	stree_var_t *var;
-	statns_t var_sn;
-
-	rdata_var_t *mbr_var;
-	list_node_t *node;
-	tdata_item_t *field_ti;
-
-	csi_sym = csi_to_symbol(csi);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Create new instance of CSI '");
-	symbol_print_fqn(csi_sym);
-	printf("'.\n");
-#endif
-
-	/* Create the object. */
-	obj = rdata_object_new();
-	obj->class_sym = csi_sym;
-	obj->static_obj = sn;
-	intmap_init(&obj->fields);
-
-	obj_var = rdata_var_new(vc_object);
-	obj_var->u.object_v = obj;
-
-	/* For this CSI and all base CSIs */
-	while (csi != NULL) {
-
-		/* For all members */
-		node = list_first(&csi->members);
-		while (node != NULL) {
-			csimbr = list_node_data(node, stree_csimbr_t *);
-
-			/* Is it a member variable? */
-			if (csimbr->cc == csimbr_var) {
-				var = csimbr->u.var;
-
-				/* Is it static/nonstatic? */
-				var_sn = stree_symbol_has_attr(
-				    var_to_symbol(var), sac_static) ? sn_static : sn_nonstatic;
-				if (var_sn == sn) {
-					/* Compute field type. XXX Memoize. */
-					run_texpr(run->program, csi, var->type,
-					    &field_ti);
-
-					/* Create and initialize field. */
-					run_var_new(run, field_ti, &mbr_var);
-
-					/* Add to field map. */
-					intmap_set(&obj->fields, var->name->sid,
-					    mbr_var);
-				}
-			}
-
-			node = list_next(&csi->members, node);
-		}
-
-		/* Continue with base CSI */
-		csi = csi->base_csi;
-	}
-
-	*res = obj_var;
-}
-
-/** Run constructor on an object.
- *
- * @param run		Runner object
- * @param obj		Object to run constructor on
- * @param arg_vals	Argument values (list of rdata_item_t)
- */
-static void run_object_ctor(run_t *run, rdata_var_t *obj, list_t *arg_vals)
-{
-	stree_ident_t *ctor_ident;
-	stree_symbol_t *csi_sym;
-	stree_csi_t *csi;
-	stree_symbol_t *ctor_sym;
-	stree_ctor_t *ctor;
-	run_proc_ar_t *proc_ar;
-	rdata_item_t *res;
-
-	csi_sym = obj->u.object_v->class_sym;
-	csi = symbol_to_csi(csi_sym);
-	assert(csi != NULL);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Run object constructor from CSI '");
-	symbol_print_fqn(csi_sym);
-	printf("'.\n");
-#endif
-	ctor_ident = stree_ident_new();
-	ctor_ident->sid = strtab_get_sid(CTOR_IDENT);
-
-	/* Find constructor. */
-	ctor_sym = symbol_search_csi_no_base(run->program, csi, ctor_ident);
-	if (ctor_sym == NULL) {
-#ifdef DEBUG_RUN_TRACE
-		printf("No constructor found.\n");
-#endif
-		return;
-	}
-
-	ctor = symbol_to_ctor(ctor_sym);
-	assert(ctor != NULL);
-
-	/* Create procedure activation record. */
-	run_proc_ar_create(run, obj, ctor->proc, &proc_ar);
-
-	/* Fill in argument values. */
-	run_proc_ar_set_args(run, proc_ar, arg_vals);
-
-	/* Run the procedure. */
-	run_proc(run, proc_ar, &res);
-
-	/* Constructor does not return a value. */
-	assert(res == NULL);
-
-	/* Destroy procedure activation record. */
-	run_proc_ar_destroy(run, proc_ar);
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Returned from constructor..\n");
-#endif
-}
-
-/** Return boolean value of an item.
- *
- * Try to interpret @a item as a boolean value. If it is not a boolean
- * value, generate an error.
- *
- * @param run		Runner object
- * @param item		Input item
- * @return		Resulting boolean value
- */
-bool_t run_item_boolean_value(run_t *run, rdata_item_t *item)
-{
-	rdata_item_t *vitem;
-	rdata_var_t *var;
-	bool_t res;
-
-	(void) run;
-	run_cvt_value_item(run, item, &vitem);
-	if (run_is_bo(run))
-		return b_true;
-
-	assert(vitem->ic == ic_value);
-	var = vitem->u.value->var;
-
-	assert(var->vc == vc_bool);
-	res = var->u.bool_v->value;
-
-	/* Free value item */
-	rdata_item_destroy(vitem);
-	return res;
-}
Index: pace/app/sbi/src/run_expr.h
===================================================================
--- uspace/app/sbi/src/run_expr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RUN_EXPR_H_
-#define RUN_EXPR_H_
-
-#include "mytypes.h"
-
-void run_expr(run_t *run, stree_expr_t *expr, rdata_item_t **res);
-
-void run_new_csi_inst_ref(run_t *run, stree_csi_t *csi, statns_t sn,
-    rdata_item_t **res);
-void run_new_csi_inst(run_t *run, stree_csi_t *csi, statns_t sn,
-    rdata_var_t **res);
-
-void run_equal(run_t *run, rdata_value_t *v1, rdata_value_t *v2, bool_t *res);
-bool_t run_item_boolean_value(run_t *run, rdata_item_t *item);
-
-#endif
Index: pace/app/sbi/src/run_t.h
===================================================================
--- uspace/app/sbi/src/run_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RUN_T_H_
-#define RUN_T_H_
-
-#include "intmap_t.h"
-#include "list_t.h"
-
-/** Block activation record
- *
- * One block AR is created for each block that we enter. A variable declaration
- * statement inserts the variable here. Upon exiting the block we pop from the
- * stack, thus all the variables declared in that block are forgotten.
- */
-typedef struct run_block_ar {
-	/** Variables in this block */
-	intmap_t vars; /* of rdata_var_t */
-} run_block_ar_t;
-
-/** Procedure activation record
- *
- * A procedure can be a member function, a named property or an indexed
- * property. A procedure activation record is created whenever a procedure
- * is invoked.
- */
-typedef struct run_proc_ar {
-	/** Object on which the procedure is being invoked or @c NULL. */
-	struct rdata_var *obj;
-
-	/** Procedure being invoked */
-	struct stree_proc *proc;
-
-	/** Block activation records */
-	list_t block_ar; /* of run_block_ar_t */
-
-	/** Procedure return value or @c NULL if not set. */
-	struct rdata_item *retval;
-} run_proc_ar_t;
-
-/** Bailout mode
- *
- * Determines whether control is bailing out of a statement, function, etc.
- */
-typedef enum {
-	/** Normal execution */
-	bm_none,
-
-	/** Break from statement */
-	bm_stat,
-
-	/** Return from procedure */
-	bm_proc,
-
-	/** Exception */
-	bm_exc,
-
-	/** Unrecoverable runtime error */
-	bm_error
-} run_bailout_mode_t;
-
-/** Thread activation record
- *
- * We can walk the list of function ARs to get a function call backtrace.
- */
-typedef struct run_thread_ar {
-	/** Function activation records */
-	list_t proc_ar; /* of run_proc_ar_t */
-
-	/** Bailout mode */
-	run_bailout_mode_t bo_mode;
-
-	/** Exception cspan */
-	struct cspan *exc_cspan;
-
-	/** Exception payload */
-	struct rdata_value *exc_payload;
-
-	/** @c b_true if a run-time error occured. */
-	bool_t error;
-} run_thread_ar_t;
-
-/** Runner state object */
-typedef struct run {
-	/** Code of the program being executed */
-	struct stree_program *program;
-
-	/** Thread-private state */
-	run_thread_ar_t *thread_ar;
-
-	/** Global state */
-	struct rdata_var *gdata;
-} run_t;
-
-#endif
Index: pace/app/sbi/src/run_texpr.c
===================================================================
--- uspace/app/sbi/src/run_texpr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,500 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Evaluate type expressions. */
-
-#include <assert.h>
-#include <stdlib.h>
-#include "cspan.h"
-#include "debug.h"
-#include "list.h"
-#include "mytypes.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-#include "tdata.h"
-
-#include "run_texpr.h"
-
-static void run_taccess(stree_program_t *prog, stree_csi_t *ctx,
-    stree_taccess_t *taccess, tdata_item_t **res);
-static void run_tindex(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tindex_t *tindex, tdata_item_t **res);
-static void run_tliteral(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tliteral_t *tliteral, tdata_item_t **res);
-static void run_tnameref(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tnameref_t *tnameref, tdata_item_t **res);
-static void run_tapply(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tapply_t *tapply, tdata_item_t **res);
-
-/** Evaluate type expression.
- *
- * Evaluate type expression (this produces a type item). If a type error
- * occurs, the resulting type item is of class @c tic_ignore.
- *
- * @param prog		Program
- * @param ctx		Current CSI (context)
- * @param texpr		Type expression to evaluate
- * @param res		Place to store type result
- */
-void run_texpr(stree_program_t *prog, stree_csi_t *ctx, stree_texpr_t *texpr,
-    tdata_item_t **res)
-{
-	switch (texpr->tc) {
-	case tc_taccess:
-		run_taccess(prog, ctx, texpr->u.taccess, res);
-		break;
-	case tc_tindex:
-		run_tindex(prog, ctx, texpr->u.tindex, res);
-		break;
-	case tc_tliteral:
-		run_tliteral(prog, ctx, texpr->u.tliteral, res);
-		break;
-	case tc_tnameref:
-		run_tnameref(prog, ctx, texpr->u.tnameref, res);
-		break;
-	case tc_tapply:
-		run_tapply(prog, ctx, texpr->u.tapply, res);
-		break;
-	}
-}
-
-/** Evaluate type access expression.
- *
- * Evaluate operation per the type access ('.') operator.
- *
- * @param prog		Program
- * @param ctx		Current CSI (context)
- * @param taccess	Type access expression to evaluate
- * @param res		Place to store type result
- */
-static void run_taccess(stree_program_t *prog, stree_csi_t *ctx,
-    stree_taccess_t *taccess, tdata_item_t **res)
-{
-	stree_symbol_t *sym;
-	tdata_item_t *targ_i = NULL;
-	tdata_item_t *titem = NULL;
-	tdata_object_t *tobject;
-	tdata_deleg_t *tdeleg;
-	stree_csi_t *base_csi;
-	stree_deleg_t *deleg;
-	stree_enum_t *enum_d;
-	tdata_enum_t *tenum;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Evaluating type access operation.\n");
-#endif
-	/* Evaluate base type. */
-	run_texpr(prog, ctx, taccess->arg, &targ_i);
-
-	if (targ_i->tic == tic_ignore) {
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	if (targ_i->tic != tic_tobject) {
-		cspan_print(taccess->texpr->cspan);
-		printf(" Error: Using '.' with type which is not an "
-		    "object.\n");
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	/* Get base CSI. */
-	base_csi = targ_i->u.tobject->csi;
-
-	sym = symbol_lookup_in_csi(prog, base_csi, taccess->member_name);
-	if (sym == NULL) {
-		cspan_print(taccess->member_name->cspan);
-		printf(" Error: CSI '");
-		symbol_print_fqn(csi_to_symbol(base_csi));
-		printf("' has no member named '%s'.\n",
-		    strtab_get_str(taccess->member_name->sid));
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	switch (sym->sc) {
-	case sc_csi:
-		/* Construct type item. */
-		titem = tdata_item_new(tic_tobject);
-		tobject = tdata_object_new();
-		titem->u.tobject = tobject;
-
-		tobject->static_ref = sn_nonstatic;
-		tobject->csi = sym->u.csi;
-		list_init(&tobject->targs);
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		/* Fetch stored delegate type. */
-		deleg = symbol_to_deleg(sym);
-		assert(deleg != NULL);
-		if (deleg->titem == NULL) {
-			/*
-			 * Prepare a partial delegate which will be completed
-			 * later.
-			 */
-			titem = tdata_item_new(tic_tdeleg);
-			tdeleg = tdata_deleg_new();
-			titem->u.tdeleg = tdeleg;
-			tdeleg->deleg = deleg;
-			tdeleg->tsig = NULL;
-
-			deleg->titem = titem;
-		} else {
-			titem = deleg->titem;
-		}
-		break;
-	case sc_enum:
-		/* Fetch stored enum type. */
-		enum_d = symbol_to_enum(sym);
-		assert(enum_d != NULL);
-		if (enum_d->titem == NULL) {
-			/*
-			 * Prepare a partial enum whic will be completed
-			 * later.
-			 */
-			titem = tdata_item_new(tic_tenum);
-			tenum = tdata_enum_new();
-			titem->u.tenum = tenum;
-			tenum->enum_d = enum_d;
-		} else {
-			titem = enum_d->titem;
-		}
-		break;
-	case sc_fun:
-	case sc_var:
-	case sc_prop:
-		cspan_print(taccess->member_name->cspan);
-		printf(" Error: Symbol '");
-		symbol_print_fqn(sym);
-		printf("' is not a type.\n");
-		titem = tdata_item_new(tic_ignore);
-		break;
-	}
-
-	*res = titem;
-}
-
-/** Evaluate type indexing expression.
- *
- * Evaluate operation per the type indexing ('[', ']') operator.
- * A type indexing operation may have extents specified or only rank
- * specified.
- *
- * @param prog		Program
- * @param ctx		Current CSI (context)
- * @param tindex	Type indexing expression to evaluate
- * @param res		Place to store type result
- */
-static void run_tindex(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tindex_t *tindex, tdata_item_t **res)
-{
-	tdata_item_t *base_ti = NULL;
-	tdata_item_t *titem;
-	tdata_array_t *tarray;
-	stree_expr_t *arg_expr;
-	list_node_t *arg_node;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Evaluating type index operation.\n");
-#endif
-	/* Evaluate base type. */
-	run_texpr(prog, ctx, tindex->base_type, &base_ti);
-
-	if (base_ti->tic == tic_ignore) {
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	/* Construct type item. */
-	titem = tdata_item_new(tic_tarray);
-	tarray = tdata_array_new();
-	titem->u.tarray = tarray;
-
-	tarray->base_ti = base_ti;
-	tarray->rank = tindex->n_args;
-
-	/* Copy extents. */
-	list_init(&tarray->extents);
-	arg_node = list_first(&tindex->args);
-
-	while (arg_node != NULL) {
-		arg_expr = list_node_data(arg_node, stree_expr_t *);
-		list_append(&tarray->extents, arg_expr);
-		arg_node = list_next(&tindex->args, arg_node);
-	}
-
-	*res = titem;
-}
-
-/** Evaluate type literal expression.
- *
- * @param prog		Program
- * @param ctx		Current CSI (context)
- * @param tliteral	Type literal
- * @param res		Place to store type result
- */
-static void run_tliteral(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tliteral_t *tliteral, tdata_item_t **res)
-{
-	tdata_item_t *titem;
-	tdata_primitive_t *tprimitive;
-	tprimitive_class_t tpc;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Evaluating type literal.\n");
-#endif
-	(void) prog;
-	(void) ctx;
-	(void) tliteral;
-
-	/* Make compiler happy. */
-	tpc = 0;
-
-	switch (tliteral->tlc) {
-	case tlc_bool:
-		tpc = tpc_bool;
-		break;
-	case tlc_char:
-		tpc = tpc_char;
-		break;
-	case tlc_int:
-		tpc = tpc_int;
-		break;
-	case tlc_string:
-		tpc = tpc_string;
-		break;
-	case tlc_resource:
-		tpc = tpc_resource;
-		break;
-	}
-
-	/* Construct type item. */
-	titem = tdata_item_new(tic_tprimitive);
-	tprimitive = tdata_primitive_new(tpc);
-	titem->u.tprimitive = tprimitive;
-
-	*res = titem;
-}
-
-static void run_tnameref(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tnameref_t *tnameref, tdata_item_t **res)
-{
-	stree_symbol_t *sym;
-	tdata_item_t *titem;
-	tdata_object_t *tobject;
-	stree_targ_t *targ;
-	tdata_vref_t *tvref;
-	stree_deleg_t *deleg;
-	tdata_deleg_t *tdeleg;
-	stree_enum_t *enum_d;
-	tdata_enum_t *tenum;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Evaluating type name reference.\n");
-	printf("'%s'\n", strtab_get_str(tnameref->name->sid));
-#endif
-	/* In interactive mode we are not in a class */
-	if (ctx != NULL) {
-		/* Look for type argument */
-		targ = stree_csi_find_targ(ctx, tnameref->name);
-
-		if (targ != NULL) {
-			/* Found type argument */
-#ifdef DEBUG_RUN_TRACE
-			printf("Found type argument '%s'.\n",
-			    strtab_get_str(tnameref->name->sid));
-#endif
-			titem = tdata_item_new(tic_tvref);
-			tvref = tdata_vref_new();
-			titem->u.tvref = tvref;
-			tvref->targ = targ;
-
-			*res = titem;
-			return;
-		}
-	}
-
-	/* Look for symbol */
-	sym = symbol_lookup_in_csi(prog, ctx, tnameref->name);
-	if (sym == NULL) {
-		cspan_print(tnameref->texpr->cspan);
-		printf(" Error: Symbol '%s' not found.\n",
-		    strtab_get_str(tnameref->name->sid));
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	/* Make compiler happy. */
-	titem = NULL;
-
-	switch (sym->sc) {
-	case sc_csi:
-		/* Construct type item. */
-		titem = tdata_item_new(tic_tobject);
-		tobject = tdata_object_new();
-		titem->u.tobject = tobject;
-
-		tobject->static_ref = sn_nonstatic;
-		tobject->csi = sym->u.csi;
-		list_init(&tobject->targs);
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		/* Fetch stored delegate type. */
-		deleg = symbol_to_deleg(sym);
-		assert(deleg != NULL);
-		if (deleg->titem == NULL) {
-			/*
-			 * Prepare a partial delegate which will be completed
-			 * later.
-			 */
-			titem = tdata_item_new(tic_tdeleg);
-			tdeleg = tdata_deleg_new();
-			titem->u.tdeleg = tdeleg;
-			tdeleg->deleg = deleg;
-			tdeleg->tsig = NULL;
-
-			deleg->titem = titem;
-		} else {
-			titem = deleg->titem;
-		}
-		break;
-	case sc_enum:
-		/* Fetch stored enum type. */
-		enum_d = symbol_to_enum(sym);
-		assert(enum_d != NULL);
-		if (enum_d->titem == NULL) {
-			/*
-			 * Prepare a partial enum whic will be completed
-			 * later.
-			 */
-			titem = tdata_item_new(tic_tenum);
-			tenum = tdata_enum_new();
-			titem->u.tenum = tenum;
-			tenum->enum_d = enum_d;
-		} else {
-			titem = enum_d->titem;
-		}
-		break;
-	case sc_fun:
-	case sc_var:
-	case sc_prop:
-		cspan_print(tnameref->texpr->cspan);
-		printf(" Error: Symbol '");
-		symbol_print_fqn(sym);
-		printf("' is not a type.\n");
-		titem = tdata_item_new(tic_ignore);
-		break;
-	}
-
-	*res = titem;
-}
-
-/** Evaluate type application expression.
- *
- * In a type application expression type arguments are applied to a generic
- * CSI.
- *
- * @param prog		Program
- * @param ctx		Current CSI (context)
- * @param tapply	Type application expression
- * @param res		Place to store type result
- */
-static void run_tapply(stree_program_t *prog, stree_csi_t *ctx,
-    stree_tapply_t *tapply, tdata_item_t **res)
-{
-	tdata_item_t *base_ti;
-	tdata_item_t *arg_ti;
-	tdata_item_t *titem;
-	tdata_object_t *tobject;
-
-	list_node_t *arg_n;
-	stree_texpr_t *arg;
-
-	list_node_t *farg_n;
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Evaluating type apply operation.\n");
-#endif
-	/* Construct type item. */
-	titem = tdata_item_new(tic_tobject);
-	tobject = tdata_object_new();
-	titem->u.tobject = tobject;
-
-	/* Evaluate base (generic) type. */
-	run_texpr(prog, ctx, tapply->gtype, &base_ti);
-
-	if (base_ti->tic != tic_tobject) {
-		cspan_print(tapply->gtype->cspan);
-		printf(" Error: Base type of generic application is not "
-		    "a CSI.\n");
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	tobject->static_ref = sn_nonstatic;
-	tobject->csi = base_ti->u.tobject->csi;
-	list_init(&tobject->targs);
-
-	/* Evaluate type arguments. */
-	farg_n = list_first(&tobject->csi->targ);
-	arg_n = list_first(&tapply->targs);
-	while (farg_n != NULL && arg_n != NULL) {
-		arg = list_node_data(arg_n, stree_texpr_t *);
-
-		run_texpr(prog, ctx, arg, &arg_ti);
-
-		if (arg_ti->tic == tic_ignore) {
-			*res = tdata_item_new(tic_ignore);
-			return;
-		}
-
-		list_append(&tobject->targs, arg_ti);
-
-		farg_n = list_next(&tobject->csi->targ, farg_n);
-		arg_n = list_next(&tapply->targs, arg_n);
-	}
-
-	if (farg_n != NULL || arg_n != NULL) {
-		cspan_print(tapply->texpr->cspan);
-		printf(" Error: Incorrect number of type arguments.\n");
-		*res = tdata_item_new(tic_ignore);
-		return;
-	}
-
-	*res = titem;
-}
Index: pace/app/sbi/src/run_texpr.h
===================================================================
--- uspace/app/sbi/src/run_texpr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RUN_TEXPR_H_
-#define RUN_TEXPR_H_
-
-#include "mytypes.h"
-
-void run_texpr(stree_program_t *prog, stree_csi_t *ctx, stree_texpr_t *texpr,
-    tdata_item_t **res);
-
-#endif
Index: pace/app/sbi/src/stree.c
===================================================================
--- uspace/app/sbi/src/stree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1177 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Stree (syntax tree) intermediate representation. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "list.h"
-#include "mytypes.h"
-
-#include "stree.h"
-
-/** Allocate new module.
- *
- * @return	New module
- */
-stree_module_t *stree_module_new(void)
-{
-	stree_module_t *module;
-
-	module = calloc(1, sizeof(stree_module_t));
-	if (module == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	list_init(&module->members);
-	return module;
-}
-
-/** Allocate new module member.
- *
- * @param mc	Module member class
- * @return	New module member
- */
-stree_modm_t *stree_modm_new(modm_class_t mc)
-{
-	stree_modm_t *modm;
-
-	modm = calloc(1, sizeof(stree_modm_t));
-	if (modm == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	modm->mc = mc;
-	return modm;
-}
-
-/** Allocate new CSI.
- *
- * @param cc	CSI class
- * @return	New CSI
- */
-stree_csi_t *stree_csi_new(csi_class_t cc)
-{
-	stree_csi_t *csi;
-
-	csi = calloc(1, sizeof(stree_csi_t));
-	if (csi == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	csi->cc = cc;
-	csi->ancr_state = ws_unvisited;
-	csi->name = NULL;
-	csi->base_csi = NULL;
-	list_init(&csi->inherit);
-	list_init(&csi->impl_if_ti);
-	list_init(&csi->members);
-
-	return csi;
-}
-
-/** Allocate new CSI member.
- *
- * @param cc	CSI member class
- * @return	New CSI member
- */
-stree_csimbr_t *stree_csimbr_new(csimbr_class_t cc)
-{
-	stree_csimbr_t *csimbr;
-
-	csimbr = calloc(1, sizeof(stree_csimbr_t));
-	if (csimbr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	csimbr->cc = cc;
-	return csimbr;
-}
-
-/** Allocate new constructor.
- *
- * @return	New constructor
- */
-stree_ctor_t *stree_ctor_new(void)
-{
-	stree_ctor_t *ctor;
-
-	ctor = calloc(1, sizeof(stree_ctor_t));
-	if (ctor == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return ctor;
-}
-
-/** Allocate new member delegate.
- *
- * @return	New member delegate
- */
-stree_deleg_t *stree_deleg_new(void)
-{
-	stree_deleg_t *deleg;
-
-	deleg = calloc(1, sizeof(stree_deleg_t));
-	if (deleg == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return deleg;
-}
-
-/** Allocate new enum.
- *
- * @return	New enum
- */
-stree_enum_t *stree_enum_new(void)
-{
-	stree_enum_t *enum_d;
-
-	enum_d = calloc(1, sizeof(stree_enum_t));
-	if (enum_d == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return enum_d;
-}
-
-/** Allocate new enum member.
- *
- * @return	New enum member
- */
-stree_embr_t *stree_embr_new(void)
-{
-	stree_embr_t *embr;
-
-	embr = calloc(1, sizeof(stree_embr_t));
-	if (embr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return embr;
-}
-
-/** Allocate new member function.
- *
- * @return	New member function
- */
-stree_fun_t *stree_fun_new(void)
-{
-	stree_fun_t *fun;
-
-	fun = calloc(1, sizeof(stree_fun_t));
-	if (fun == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return fun;
-}
-
-/** Allocate new member variable.
- *
- * @return	New member variable
- */
-stree_var_t *stree_var_new(void)
-{
-	stree_var_t *var;
-
-	var = calloc(1, sizeof(stree_var_t));
-	if (var == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return var;
-}
-
-/** Allocate new property.
- *
- * @return	New property
- */
-stree_prop_t *stree_prop_new(void)
-{
-	stree_prop_t *prop;
-
-	prop = calloc(1, sizeof(stree_prop_t));
-	if (prop == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return prop;
-}
-
-/** Allocate new type argument.
- *
- * @return	New type argument
- */
-stree_targ_t *stree_targ_new(void)
-{
-	stree_targ_t *targ;
-
-	targ = calloc(1, sizeof(stree_targ_t));
-	if (targ == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return targ;
-}
-
-/** Allocate new symbol attribute.
- *
- * @param sac	Symbol attribute class
- * @return	New symbol attribute
- */
-stree_symbol_attr_t *stree_symbol_attr_new(symbol_attr_class_t sac)
-{
-	stree_symbol_attr_t *symbol_attr;
-
-	symbol_attr = calloc(1, sizeof(stree_symbol_attr_t));
-	if (symbol_attr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	symbol_attr->sac = sac;
-	return symbol_attr;
-}
-
-/** Allocate new procedure.
- *
- * @return	New procedure
- */
-stree_proc_t *stree_proc_new(void)
-{
-	stree_proc_t *proc;
-
-	proc = calloc(1, sizeof(stree_proc_t));
-	if (proc == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return proc;
-}
-
-/** Allocate new procedure argument.
- *
- * @return	New procedure argument
- */
-stree_proc_arg_t *stree_proc_arg_new(void)
-{
-	stree_proc_arg_t *proc_arg;
-
-	proc_arg = calloc(1, sizeof(stree_proc_arg_t));
-	if (proc_arg == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return proc_arg;
-}
-
-/** Allocate new function signature.
- *
- * @return	New procedure argument
- */
-stree_fun_sig_t *stree_fun_sig_new(void)
-{
-	stree_fun_sig_t *fun_sig;
-
-	fun_sig = calloc(1, sizeof(stree_fun_sig_t));
-	if (fun_sig == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return fun_sig;
-}
-
-/** Allocate new procedure argument attribute.
- *
- * @param	Argument attribute class
- * @return	New procedure argument attribute
- */
-stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac)
-{
-	stree_arg_attr_t *arg_attr;
-
-	arg_attr = calloc(1, sizeof(stree_arg_attr_t));
-	if (arg_attr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	arg_attr->aac = aac;
-	return arg_attr;
-}
-
-/** Allocate new statement.
- *
- * @param sc	Statement class
- * @return	New statement
- */
-stree_stat_t *stree_stat_new(stat_class_t sc)
-{
-	stree_stat_t *stat;
-
-	stat = calloc(1, sizeof(stree_stat_t));
-	if (stat == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	stat->sc = sc;
-	return stat;
-}
-
-/** Allocate new local variable declaration.
- *
- * @return	New local variable declaration
- */
-stree_vdecl_t *stree_vdecl_new(void)
-{
-	stree_vdecl_t *vdecl_s;
-
-	vdecl_s = calloc(1, sizeof(stree_vdecl_t));
-	if (vdecl_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return vdecl_s;
-}
-
-/** Allocate new @c if statement.
- *
- * @return	New @c if statement
- */
-stree_if_t *stree_if_new(void)
-{
-	stree_if_t *if_s;
-
-	if_s = calloc(1, sizeof(stree_if_t));
-	if (if_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return if_s;
-}
-
-/** Allocate new @c switch statement.
- *
- * @return	New @c if statement
- */
-stree_switch_t *stree_switch_new(void)
-{
-	stree_switch_t *switch_s;
-
-	switch_s = calloc(1, sizeof(stree_switch_t));
-	if (switch_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return switch_s;
-}
-
-/** Allocate new @c while statement.
- *
- * @return	New @c while statement
- */
-stree_while_t *stree_while_new(void)
-{
-	stree_while_t *while_s;
-
-	while_s = calloc(1, sizeof(stree_while_t));
-	if (while_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return while_s;
-}
-
-/** Allocate new @c for statement.
- *
- * @return	New @c for statement
- */
-stree_for_t *stree_for_new(void)
-{
-	stree_for_t *for_s;
-
-	for_s = calloc(1, sizeof(stree_for_t));
-	if (for_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return for_s;
-}
-
-/** Allocate new @c raise statement.
- *
- * @return	New @c raise statement
- */
-stree_raise_t *stree_raise_new(void)
-{
-	stree_raise_t *raise_s;
-
-	raise_s = calloc(1, sizeof(stree_raise_t));
-	if (raise_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return raise_s;
-}
-
-/** Allocate new @c break statement.
- *
- * @return	New @c break statement
- */
-stree_break_t *stree_break_new(void)
-{
-	stree_break_t *break_s;
-
-	break_s = calloc(1, sizeof(stree_break_t));
-	if (break_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return break_s;
-}
-
-/** Allocate new @c return statement.
- *
- * @return	New @c return statement
- */
-stree_return_t *stree_return_new(void)
-{
-	stree_return_t *return_s;
-
-	return_s = calloc(1, sizeof(stree_return_t));
-	if (return_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return return_s;
-}
-
-/** Allocate new with-except-finally statement.
- *
- * @return	New with-except-finally statement.
- */
-stree_wef_t *stree_wef_new(void)
-{
-	stree_wef_t *wef_s;
-
-	wef_s = calloc(1, sizeof(stree_wef_t));
-	if (wef_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return wef_s;
-}
-
-/** Allocate new expression statement.
- *
- * @return	New expression statement
- */
-stree_exps_t *stree_exps_new(void)
-{
-	stree_exps_t *exp_s;
-
-	exp_s = calloc(1, sizeof(stree_exps_t));
-	if (exp_s == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return exp_s;
-}
-
-/** Allocate new @c except clause.
- *
- * @return	New @c except clause
- */
-stree_except_t *stree_except_new(void)
-{
-	stree_except_t *except_c;
-
-	except_c = calloc(1, sizeof(stree_except_t));
-	if (except_c == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return except_c;
-}
-
-/** Allocate new @c if/elif clause.
- *
- * @return	New @c if/elif clause
- */
-stree_if_clause_t *stree_if_clause_new(void)
-{
-	stree_if_clause_t *if_clause;
-
-	if_clause = calloc(1, sizeof(stree_if_clause_t));
-	if (if_clause == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return if_clause;
-}
-
-/** Allocate new @c when clause.
- *
- * @return	New @c when clause
- */
-stree_when_t *stree_when_new(void)
-{
-	stree_when_t *when_c;
-
-	when_c = calloc(1, sizeof(stree_when_t));
-	if (when_c == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return when_c;
-}
-
-/** Allocate new statement block.
- *
- * @return	New statement block
- */
-stree_block_t *stree_block_new(void)
-{
-	stree_block_t *block;
-
-	block = calloc(1, sizeof(stree_block_t));
-	if (block == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return block;
-}
-
-/** Allocate new expression.
- *
- * @param ec	Expression class
- * @return	New expression
- */
-stree_expr_t *stree_expr_new(expr_class_t ec)
-{
-	stree_expr_t *expr;
-
-	expr = calloc(1, sizeof(stree_expr_t));
-	if (expr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	expr->ec = ec;
-	return expr;
-}
-
-/** Allocate new assignment.
- *
- * @param ac	Assignment class
- * @return	New assignment
- */
-stree_assign_t *stree_assign_new(assign_class_t ac)
-{
-	stree_assign_t *assign;
-
-	assign = calloc(1, sizeof(stree_assign_t));
-	if (assign == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	assign->ac = ac;
-	return assign;
-}
-
-/** Allocate new binary operation.
- *
- * @return	New binary operation
- */
-stree_binop_t *stree_binop_new(binop_class_t bc)
-{
-	stree_binop_t *binop;
-
-	binop = calloc(1, sizeof(stree_binop_t));
-	if (binop == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	binop->bc = bc;
-	return binop;
-}
-
-/** Allocate new unary operation.
- *
- * @param uc	Unary operation class
- * @return	New unary operation
- */
-stree_unop_t *stree_unop_new(unop_class_t uc)
-{
-	stree_unop_t *unop;
-
-	unop = calloc(1, sizeof(stree_unop_t));
-	if (unop == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	unop->uc = uc;
-	return unop;
-}
-
-/** Allocate new @c new operation.
- *
- * @return	New @c new operation
- */
-stree_new_t *stree_new_new(void)
-{
-	stree_new_t *new_op;
-
-	new_op = calloc(1, sizeof(stree_new_t));
-	if (new_op == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return new_op;
-}
-
-/** Allocate new .
- *
- * @return	New
- */
-stree_access_t *stree_access_new(void)
-{
-	stree_access_t *access;
-
-	access = calloc(1, sizeof(stree_access_t));
-	if (access == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return access;
-}
-
-/** Allocate new function call operation.
- *
- * @return	New function call operation
- */
-stree_call_t *stree_call_new(void)
-{
-	stree_call_t *call;
-
-	call = calloc(1, sizeof(stree_call_t));
-	if (call == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return call;
-}
-
-/** Allocate new indexing operation.
- *
- * @return	New indexing operation
- */
-stree_index_t *stree_index_new(void)
-{
-	stree_index_t *index;
-
-	index = calloc(1, sizeof(stree_index_t));
-	if (index == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return index;
-}
-
-/** Allocate new as conversion.
- *
- * @return	New as conversion
- */
-stree_as_t *stree_as_new(void)
-{
-	stree_as_t *as_expr;
-
-	as_expr = calloc(1, sizeof(stree_as_t));
-	if (as_expr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return as_expr;
-}
-
-/** Allocate new boxing operation.
- *
- * @return	New boxing operation
- */
-stree_box_t *stree_box_new(void)
-{
-	stree_box_t *box_expr;
-
-	box_expr = calloc(1, sizeof(stree_box_t));
-	if (box_expr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return box_expr;
-}
-
-/** Allocate new name reference operation.
- *
- * @return	New name reference operation
- */
-stree_nameref_t *stree_nameref_new(void)
-{
-	stree_nameref_t *nameref;
-
-	nameref = calloc(1, sizeof(stree_nameref_t));
-	if (nameref == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return nameref;
-}
-
-/** Allocate new identifier.
- *
- * @return	New identifier
- */
-stree_ident_t *stree_ident_new(void)
-{
-	stree_ident_t *ident;
-
-	ident = calloc(1, sizeof(stree_ident_t));
-	if (ident == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return ident;
-}
-
-/** Allocate new literal.
- *
- * @param ltc	Literal class
- * @return	New literal
- */
-stree_literal_t *stree_literal_new(literal_class_t ltc)
-{
-	stree_literal_t *literal;
-
-	literal = calloc(1, sizeof(stree_literal_t));
-	if (literal == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	literal->ltc = ltc;
-	return literal;
-}
-
-/** Allocate new @c self reference.
- *
- * @return	New @c self reference
- */
-stree_self_ref_t *stree_self_ref_new(void)
-{
-	stree_self_ref_t *self_ref;
-
-	self_ref = calloc(1, sizeof(stree_self_ref_t));
-	if (self_ref == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return self_ref;
-}
-
-/** Allocate new type expression
- *
- * @return	New type expression
- */
-stree_texpr_t *stree_texpr_new(texpr_class_t tc)
-{
-	stree_texpr_t *texpr;
-
-	texpr = calloc(1, sizeof(stree_texpr_t));
-	if (texpr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	texpr->tc = tc;
-	return texpr;
-}
-
-/** Allocate new type access operation.
- *
- * @return	New type access operation
- */
-stree_taccess_t *stree_taccess_new(void)
-{
-	stree_taccess_t *taccess;
-
-	taccess = calloc(1, sizeof(stree_taccess_t));
-	if (taccess == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return taccess;
-}
-
-/** Allocate new type application operation.
- *
- * @return	New type application operation
- */
-stree_tapply_t *stree_tapply_new(void)
-{
-	stree_tapply_t *tapply;
-
-	tapply = calloc(1, sizeof(stree_tapply_t));
-	if (tapply == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tapply;
-}
-
-/** Allocate new type indexing operation.
- *
- * @return	New type indexing operation
- */
-stree_tindex_t *stree_tindex_new(void)
-{
-	stree_tindex_t *tindex;
-
-	tindex = calloc(1, sizeof(stree_tindex_t));
-	if (tindex == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tindex;
-}
-
-/** Allocate new type literal.
- *
- * @return	New type literal
- */
-stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc)
-{
-	stree_tliteral_t *tliteral;
-
-	tliteral = calloc(1, sizeof(stree_tliteral_t));
-	if (tliteral == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	tliteral->tlc = tlc;
-	return tliteral;
-}
-
-/** Allocate new type name reference.
- *
- * @return	New type name reference
- */
-stree_tnameref_t *stree_tnameref_new(void)
-{
-	stree_tnameref_t *tnameref;
-
-	tnameref = calloc(1, sizeof(stree_tnameref_t));
-	if (tnameref == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tnameref;
-}
-
-/** Allocate new symbol.
- *
- * @return	New symbol
- */
-stree_symbol_t *stree_symbol_new(symbol_class_t sc)
-{
-	stree_symbol_t *symbol;
-
-	symbol = calloc(1, sizeof(stree_symbol_t));
-	if (symbol == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	symbol->sc = sc;
-	list_init(&symbol->attr);
-
-	return symbol;
-}
-
-/** Allocate new program.
- *
- * @return	New program
- */
-stree_program_t *stree_program_new(void)
-{
-	stree_program_t *program;
-
-	program = calloc(1, sizeof(stree_program_t));
-	if (program == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return program;
-}
-
-/** Determine if @a symbol has attribute of class @a sac.
- *
- * @param symbol	Symbol
- * @param sac		Symbol attribute class
- * @return		@c b_true if yes, @c b_false if no
- */
-bool_t stree_symbol_has_attr(stree_symbol_t *symbol, symbol_attr_class_t sac)
-{
-	list_node_t *node;
-	stree_symbol_attr_t *attr;
-
-	node = list_first(&symbol->attr);
-	while (node != NULL) {
-		attr = list_node_data(node, stree_symbol_attr_t *);
-		if (attr->sac == sac)
-			return b_true;
-
-		node = list_next(&symbol->attr, node);
-	}
-
-	return b_false;
-}
-
-/** Determine if argument @a arg has attribute of class @a aac.
- *
- * @param arg		Formal procedure argument
- * @param aac		Argument attribute class
- * @return		@c b_true if yes, @c b_false if no.
- */
-bool_t stree_arg_has_attr(stree_proc_arg_t *arg, arg_attr_class_t aac)
-{
-	list_node_t *node;
-	stree_arg_attr_t *attr;
-
-	node = list_first(&arg->attr);
-	while (node != NULL) {
-		attr = list_node_data(node, stree_arg_attr_t *);
-		if (attr->aac == aac)
-			return b_true;
-
-		node = list_next(&arg->attr, node);
-	}
-
-	return b_false;
-}
-
-/** Determine wheter @a a is derived (transitively) from @a b.
- *
- * XXX This does not work right with generics.
- *
- * @param a	Derived CSI.
- * @param b	Base CSI.
- * @return	@c b_true if @a a is equal to or directly or indirectly
- *		derived from @a b.
- */
-bool_t stree_is_csi_derived_from_csi(stree_csi_t *a, stree_csi_t *b)
-{
-	stree_csi_t *csi;
-
-	csi = a;
-	while (csi != NULL) {
-		if (csi == b)
-			return b_true;
-
-		csi = csi->base_csi;
-	}
-
-	/* We went all the way to the root and did not find b. */
-	return b_false;
-}
-
-/** Determine if @a symbol is static.
- *
- * @param symbol	Symbol
- * @return		@c b_true if symbol is static, @c b_false otherwise
- */
-bool_t stree_symbol_is_static(stree_symbol_t *symbol)
-{
-	/* Module-wide symbols are static. */
-	if (symbol->outer_csi == NULL)
-		return b_true;
-
-	/* Symbols with @c static attribute are static. */
-	if (stree_symbol_has_attr(symbol, sac_static))
-		return b_true;
-
-	switch (symbol->sc) {
-	case sc_csi:
-	case sc_deleg:
-	case sc_enum:
-		return b_true;
-	case sc_ctor:
-	case sc_fun:
-	case sc_var:
-	case sc_prop:
-		break;
-	}
-
-	return b_false;
-}
-
-/** Search for CSI type argument of the given name.
- *
- * @param csi		CSI to look in
- * @param ident		Identifier of the type argument
- * @return		Type argument declaration or @c NULL if not found
- */
-stree_targ_t *stree_csi_find_targ(stree_csi_t *csi, stree_ident_t *ident)
-{
-	list_node_t *targ_n;
-	stree_targ_t *targ;
-
-	targ_n = list_first(&csi->targ);
-	while (targ_n != NULL) {
-		targ = list_node_data(targ_n, stree_targ_t *);
-		if (targ->name->sid == ident->sid)
-			return targ;
-
-		targ_n = list_next(&csi->targ, targ_n);
-	}
-
-	/* No match */
-	return NULL;
-}
-
-/** Search for enum member of the given name.
- *
- * @param enum_d	Enum to look in
- * @param ident		Identifier of the enum member
- * @return		Enum member declaration or @c NULL if not found
- */
-stree_embr_t *stree_enum_find_mbr(stree_enum_t *enum_d, stree_ident_t *ident)
-{
-	list_node_t *embr_n;
-	stree_embr_t *embr;
-
-	embr_n = list_first(&enum_d->members);
-	while (embr_n != NULL) {
-		embr = list_node_data(embr_n, stree_embr_t *);
-		if (embr->name->sid == ident->sid)
-			return embr;
-
-		embr_n = list_next(&enum_d->members, embr_n);
-	}
-
-	/* No match */
-	return NULL;
-}
-
-/** Get CSI member name.
- *
- * @param csimbr	CSI member
- * @return		Member name
- */
-stree_ident_t *stree_csimbr_get_name(stree_csimbr_t *csimbr)
-{
-	stree_ident_t *mbr_name;
-
-	/* Keep compiler happy. */
-	mbr_name = NULL;
-
-	switch (csimbr->cc) {
-	case csimbr_csi:
-		mbr_name = csimbr->u.csi->name;
-		break;
-	case csimbr_ctor:
-		mbr_name = csimbr->u.ctor->name;
-		break;
-	case csimbr_deleg:
-		mbr_name = csimbr->u.deleg->name;
-		break;
-	case csimbr_enum:
-		mbr_name = csimbr->u.enum_d->name;
-		break;
-	case csimbr_fun:
-		mbr_name = csimbr->u.fun->name;
-		break;
-	case csimbr_var:
-		mbr_name = csimbr->u.var->name;
-		break;
-	case csimbr_prop:
-		mbr_name = csimbr->u.prop->name;
-		break;
-	}
-
-	return mbr_name;
-}
Index: pace/app/sbi/src/stree.h
===================================================================
--- uspace/app/sbi/src/stree.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STREE_H_
-#define STREE_H_
-
-#include "mytypes.h"
-
-stree_module_t *stree_module_new(void);
-stree_modm_t *stree_modm_new(modm_class_t mc);
-stree_csi_t *stree_csi_new(csi_class_t cc);
-stree_csimbr_t *stree_csimbr_new(csimbr_class_t cc);
-stree_ctor_t *stree_ctor_new(void);
-stree_deleg_t *stree_deleg_new(void);
-stree_enum_t *stree_enum_new(void);
-stree_embr_t *stree_embr_new(void);
-stree_fun_t *stree_fun_new(void);
-stree_var_t *stree_var_new(void);
-stree_prop_t *stree_prop_new(void);
-stree_targ_t *stree_targ_new(void);
-
-stree_symbol_attr_t *stree_symbol_attr_new(symbol_attr_class_t sac);
-
-stree_proc_t *stree_proc_new(void);
-stree_proc_arg_t *stree_proc_arg_new(void);
-stree_fun_sig_t *stree_fun_sig_new(void);
-stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac);
-
-stree_stat_t *stree_stat_new(stat_class_t sc);
-stree_vdecl_t *stree_vdecl_new(void);
-stree_if_t *stree_if_new(void);
-stree_switch_t *stree_switch_new(void);
-stree_while_t *stree_while_new(void);
-stree_for_t *stree_for_new(void);
-stree_raise_t *stree_raise_new(void);
-stree_break_t *stree_break_new(void);
-stree_return_t *stree_return_new(void);
-stree_wef_t *stree_wef_new(void);
-stree_exps_t *stree_exps_new(void);
-
-stree_except_t *stree_except_new(void);
-stree_if_clause_t *stree_if_clause_new(void);
-stree_when_t *stree_when_new(void);
-stree_block_t *stree_block_new(void);
-
-stree_expr_t *stree_expr_new(expr_class_t ec);
-stree_assign_t *stree_assign_new(assign_class_t ac);
-stree_binop_t *stree_binop_new(binop_class_t bc);
-stree_unop_t *stree_unop_new(unop_class_t uc);
-stree_new_t *stree_new_new(void);
-stree_access_t *stree_access_new(void);
-stree_call_t *stree_call_new(void);
-stree_index_t *stree_index_new(void);
-stree_as_t *stree_as_new(void);
-stree_box_t *stree_box_new(void);
-stree_nameref_t *stree_nameref_new(void);
-
-stree_ident_t *stree_ident_new(void);
-stree_literal_t *stree_literal_new(literal_class_t ltc);
-stree_self_ref_t *stree_self_ref_new(void);
-
-stree_texpr_t *stree_texpr_new(texpr_class_t tc);
-stree_taccess_t *stree_taccess_new(void);
-stree_tapply_t *stree_tapply_new(void);
-stree_tindex_t *stree_tindex_new(void);
-stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc);
-stree_tnameref_t *stree_tnameref_new(void);
-
-stree_symbol_t *stree_symbol_new(symbol_class_t sc);
-stree_program_t *stree_program_new(void);
-
-bool_t stree_symbol_has_attr(stree_symbol_t *symbol, symbol_attr_class_t sac);
-bool_t stree_arg_has_attr(stree_proc_arg_t *arg, arg_attr_class_t aac);
-bool_t stree_is_csi_derived_from_csi(stree_csi_t *a, stree_csi_t *b);
-bool_t stree_symbol_is_static(stree_symbol_t *symbol);
-stree_targ_t *stree_csi_find_targ(stree_csi_t *csi, stree_ident_t *ident);
-stree_embr_t *stree_enum_find_mbr(stree_enum_t *enum_d, stree_ident_t *ident);
-stree_ident_t *stree_csimbr_get_name(stree_csimbr_t *csimbr);
-
-#endif
Index: pace/app/sbi/src/stree_t.h
===================================================================
--- uspace/app/sbi/src/stree_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,833 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STREE_T_H_
-#define STREE_T_H_
-
-#include "bigint_t.h"
-#include "list_t.h"
-#include "builtin_t.h"
-
-/*
- * Arithmetic expressions
- */
-
-struct stree_expr;
-
-/** Identifier */
-typedef struct {
-	int sid;
-	struct cspan *cspan;
-} stree_ident_t;
-
-/** Name reference */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	stree_ident_t *name;
-} stree_nameref_t;
-
-/** Boolean literal */
-typedef struct {
-	bool_t value;
-} stree_lit_bool_t;
-
-/** Character literal */
-typedef struct {
-	bigint_t value;
-} stree_lit_char_t;
-
-/** Integer literal */
-typedef struct {
-	bigint_t value;
-} stree_lit_int_t;
-
-/** Reference literal (there is only one: @c nil). */
-typedef struct {
-} stree_lit_ref_t;
-
-/** String literal */
-typedef struct {
-	char *value;
-} stree_lit_string_t;
-
-typedef enum {
-	ltc_bool,
-	ltc_char,
-	ltc_int,
-	ltc_ref,
-	ltc_string
-} literal_class_t;
-
-/** Literal */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	literal_class_t ltc;
-	union {
-		stree_lit_bool_t lit_bool;
-		stree_lit_char_t lit_char;
-		stree_lit_int_t lit_int;
-		stree_lit_ref_t lit_ref;
-		stree_lit_string_t lit_string;
-	} u;
-} stree_literal_t;
-
-/** Reference to currently active object. */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-} stree_self_ref_t;
-
-/** Binary operation class */
-typedef enum {
-	bo_equal,
-	bo_notequal,
-	bo_lt,
-	bo_gt,
-	bo_lt_equal,
-	bo_gt_equal,
-	bo_plus,
-	bo_minus,
-	bo_mult,
-	bo_and,
-	bo_or
-} binop_class_t;
-
-/** Unary operation class */
-typedef enum {
-	uo_plus,
-	uo_minus,
-	uo_not
-} unop_class_t;
-
-/** Binary operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Binary operation class */
-	binop_class_t bc;
-
-	/** Arguments */
-	struct stree_expr *arg1, *arg2;
-} stree_binop_t;
-
-/** Unary operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Operation class */
-	unop_class_t uc;
-
-	/** Argument */
-	struct stree_expr *arg;
-} stree_unop_t;
-
-/** New operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Type of object to construct. */
-	struct stree_texpr *texpr;
-
-	/** Constructor arguments */
-	list_t ctor_args; /* of stree_expr_t */
-} stree_new_t;
-
-/** Member access operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Argument */
-	struct stree_expr *arg;
-	/** Name of member being accessed. */
-	stree_ident_t *member_name;
-} stree_access_t;
-
-/** Function call operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Function */
-	struct stree_expr *fun;
-
-	/** Arguments */
-	list_t args; /* of stree_expr_t */
-} stree_call_t;
-
-typedef enum {
-	ac_set,
-	ac_increase
-} assign_class_t;
-
-/** Assignment */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	assign_class_t ac;
-	struct stree_expr *dest, *src;
-} stree_assign_t;
-
-/** Indexing operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Base */
-	struct stree_expr *base;
-
-	/** Arguments (indices) */
-	list_t args; /* of stree_expr_t */
-} stree_index_t;
-
-/** @c as conversion operation */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/** Expression to convert */
-	struct stree_expr *arg;
-
-	/** Destination type of conversion. */
-	struct stree_texpr *dtype;
-} stree_as_t;
-
-/** Boxing of primitive type (pseudo)
- *
- * This pseudo-node is used internally to box a value of primitive type.
- * It is implicitly inserted by stype_convert(). It does not correspond
- * to a an explicit program construct.
- */
-typedef struct {
-	/** Expression backlink */
-	struct stree_expr *expr;
-
-	/* Primitive type expression */
-	struct stree_expr *arg;
-} stree_box_t;
-
-/** Arithmetic expression class */
-typedef enum {
-	ec_nameref,
-	ec_literal,
-	ec_self_ref,
-	ec_binop,
-	ec_unop,
-	ec_new,
-	ec_access,
-	ec_call,
-	ec_assign,
-	ec_index,
-	ec_as,
-	ec_box
-} expr_class_t;
-
-/** Arithmetic expression */
-typedef struct stree_expr {
-	expr_class_t ec;
-
-	/** Type of this expression or @c NULL if not typed yet */
-	struct tdata_item *titem;
-
-	/** Coordinate span */
-	struct cspan *cspan;
-
-	union {
-		stree_nameref_t *nameref;
-		stree_literal_t *literal;
-		stree_self_ref_t *self_ref;
-		stree_binop_t *binop;
-		stree_unop_t *unop;
-		stree_new_t *new_op;
-		stree_access_t *access;
-		stree_call_t *call;
-		stree_index_t *index;
-		stree_assign_t *assign;
-		stree_as_t *as_op;
-		stree_box_t *box;
-	} u;
-} stree_expr_t;
-
-/*
- * Type expressions
- */
-
-struct stree_texpr;
-
-/** Type literal class */
-typedef enum {
-	tlc_bool,
-	tlc_char,
-	tlc_int,
-	tlc_resource,
-	tlc_string
-} tliteral_class_t;
-
-/** Type literal */
-typedef struct {
-	/** Type expression backlink */
-	struct stree_texpr *texpr;
-
-	tliteral_class_t tlc;
-} stree_tliteral_t;
-
-/** Type name reference */
-typedef struct {
-	/** Type expression backlink */
-	struct stree_texpr *texpr;
-
-	stree_ident_t *name;
-} stree_tnameref_t;
-
-/** Type member access operation */
-typedef struct {
-	/** Type expression backlink */
-	struct stree_texpr *texpr;
-
-	/** Argument */
-	struct stree_texpr *arg;
-
-	/** Name of member being accessed. */
-	stree_ident_t *member_name;
-} stree_taccess_t;
-
-/** Type application operation */
-typedef struct {
-	/** Type expression backlink */
-	struct stree_texpr *texpr;
-
-	/* Base type */
-	struct stree_texpr *gtype;
-
-	/** (Formal) type arguments */
-	list_t targs; /* of stree_texpr_t */
-} stree_tapply_t;
-
-/** Type index operation */
-typedef struct {
-	/** Type expression backlink */
-	struct stree_texpr *texpr;
-
-	/** Base type */
-	struct stree_texpr *base_type;
-
-	/**
-	 * Number of arguments (rank). Needed when only rank is specified
-	 * and @c args are not used.
-	 */
-	int n_args;
-
-	/** Arguments (extents) */
-	list_t args; /* of stree_expr_t */
-} stree_tindex_t;
-
-/** Type expression class */
-typedef enum {
-	tc_tliteral,
-	tc_tnameref,
-	tc_taccess,
-	tc_tapply,
-	tc_tindex
-} texpr_class_t;
-
-/** Type expression */
-typedef struct stree_texpr {
-	texpr_class_t tc;
-
-	/** Coordinate span */
-	struct cspan *cspan;
-
-	union {
-		stree_tliteral_t *tliteral;
-		stree_tnameref_t *tnameref;
-		stree_taccess_t *taccess;
-		stree_tapply_t *tapply;
-		stree_tindex_t *tindex;
-	} u;
-} stree_texpr_t;
-
-/*
- * Statements, class members and module members.
- */
-
-/** Statement block */
-typedef struct stree_block {
-	/** List of statements in the block */
-	list_t stats; /* of stree_stat_t */
-} stree_block_t;
-
-/** Variable declaration */
-typedef struct {
-	stree_ident_t *name;
-	stree_texpr_t *type;
-
-	/** Type of this variable or @c NULL if not typed yet */
-	struct tdata_item *titem;
-} stree_vdecl_t;
-
-/** @c except clause */
-typedef struct {
-	stree_ident_t *evar;
-	stree_texpr_t *etype;
-	stree_block_t *block;
-
-	/** Evaluated etype or @c NULL if not typed yet */
-	struct tdata_item *titem;
-} stree_except_t;
-
-/** @c if or @c elif clause */
-typedef struct {
-	stree_expr_t *cond;
-	stree_block_t *block;
-} stree_if_clause_t;
-
-/** If statement */
-typedef struct {
-	/** If and elif clauses */
-	list_t if_clauses; /* of stree_if_clause_t */
-
-	/** Else block */
-	stree_block_t *else_block;
-} stree_if_t;
-
-/** @c when clause */
-typedef struct {
-	/** List of expressions -- cases -- for this clause */
-	list_t exprs; /* of stree_expr_t */
-	stree_block_t *block;
-} stree_when_t;
-
-/** Switch statement */
-typedef struct {
-	/** Switch expression */
-	stree_expr_t *expr;
-
-	/** When clauses */
-	list_t when_clauses; /* of stree_when_t */
-
-	/** Else block */
-	stree_block_t *else_block;
-} stree_switch_t;
-
-/** While statement */
-typedef struct {
-	stree_expr_t *cond;
-	stree_block_t *body;
-} stree_while_t;
-
-/** For statement */
-typedef struct {
-	stree_block_t *body;
-} stree_for_t;
-
-/** Raise statement */
-typedef struct {
-	stree_expr_t *expr;
-} stree_raise_t;
-
-/** Break statement */
-typedef struct {
-} stree_break_t;
-
-/** Return statement */
-typedef struct {
-	stree_expr_t *expr;
-} stree_return_t;
-
-/** Expression statement */
-typedef struct {
-	stree_expr_t *expr;
-} stree_exps_t;
-
-/** With-try-except-finally (WEF) statement */
-typedef struct {
-	stree_block_t *with_block;
-	list_t except_clauses; /* of stree_except_t */
-	stree_block_t *finally_block;
-} stree_wef_t;
-
-/** Statement class */
-typedef enum {
-	st_vdecl,
-	st_if,
-	st_switch,
-	st_while,
-	st_for,
-	st_raise,
-	st_break,
-	st_return,
-	st_exps,
-	st_wef
-} stat_class_t;
-
-/** Statement */
-typedef struct {
-	stat_class_t sc;
-
-	union {
-		stree_vdecl_t *vdecl_s;
-		stree_if_t *if_s;
-		stree_switch_t *switch_s;
-		stree_while_t *while_s;
-		stree_for_t *for_s;
-		stree_raise_t *raise_s;
-		stree_break_t *break_s;
-		stree_return_t *return_s;
-		stree_exps_t *exp_s;
-		stree_wef_t *wef_s;
-	} u;
-} stree_stat_t;
-
-/** Argument attribute class */
-typedef enum {
-	/** Packed argument (for variadic functions) */
-	aac_packed
-} arg_attr_class_t;
-
-/** Argument atribute */
-typedef struct {
-	arg_attr_class_t aac;
-} stree_arg_attr_t;
-
-/** Formal function parameter */
-typedef struct {
-	/* Argument name */
-	stree_ident_t *name;
-
-	/* Argument type */
-	stree_texpr_t *type;
-
-	/* Attributes */
-	list_t attr; /* of stree_arg_attr_t */
-} stree_proc_arg_t;
-
-/** Function signature.
- *
- * Formal parameters and return type. This is common to function and delegate
- * delcarations.
- */
-typedef struct {
-	/** Formal parameters */
-	list_t args; /* of stree_proc_arg_t */
-
-	/** Variadic argument or @c NULL if none. */
-	stree_proc_arg_t *varg;
-
-	/** Return type */
-	stree_texpr_t *rtype;
-} stree_fun_sig_t;
-
-/** Procedure
- *
- * Procedure is the common term for a getter, setter or function body.
- * A procedure can be invoked. However, the arguments are specified by
- * the containing symbol.
- */
-typedef struct stree_proc {
-	/** Symbol (function or property) containing the procedure */
-	struct stree_symbol *outer_symbol;
-
-	/** Main block for regular procedures */
-	stree_block_t *body;
-
-	/** Builtin handler for builtin procedures */
-	builtin_proc_t bi_handler;
-} stree_proc_t;
-
-/** Constructor declaration */
-typedef struct stree_ctor {
-	/** Constructor 'name'. Points to the @c new keyword. */
-	stree_ident_t *name;
-
-	/** Symbol */
-	struct stree_symbol *symbol;
-
-	/** Signature (arguments, return type is always none) */
-	stree_fun_sig_t *sig;
-
-	/** Constructor implementation */
-	stree_proc_t *proc;
-
-	/** Type item describing the constructor */
-	struct tdata_item *titem;
-} stree_ctor_t;
-
-/** Delegate declaration */
-typedef struct stree_deleg {
-	/** Delegate name */
-	stree_ident_t *name;
-
-	/** Symbol */
-	struct stree_symbol *symbol;
-
-	/** Signature (arguments and return type) */
-	stree_fun_sig_t *sig;
-
-	/** Type item describing the delegate */
-	struct tdata_item *titem;
-} stree_deleg_t;
-
-/** Enum member */
-typedef struct stree_embr {
-	/** Enum containing this declaration */
-	struct stree_enum *outer_enum;
-
-	/** Enum member name */
-	stree_ident_t *name;
-} stree_embr_t;
-
-/** Enum declaration */
-typedef struct stree_enum {
-	/** Enum name */
-	stree_ident_t *name;
-
-	/** Symbol */
-	struct stree_symbol *symbol;
-
-	/** List of enum members */
-	list_t members; /* of stree_embr_t */
-
-	/** Type item describing the enum */
-	struct tdata_item *titem;
-} stree_enum_t;
-
-/** Member function declaration */
-typedef struct stree_fun {
-	/** Function name */
-	stree_ident_t *name;
-
-	/** Symbol */
-	struct stree_symbol *symbol;
-
-	/** Signature (arguments and return type) */
-	stree_fun_sig_t *sig;
-
-	/** Function implementation */
-	stree_proc_t *proc;
-
-	/** Type item describing the function */
-	struct tdata_item *titem;
-} stree_fun_t;
-
-/** Member variable declaration */
-typedef struct stree_var {
-	stree_ident_t *name;
-	struct stree_symbol *symbol;
-	stree_texpr_t *type;
-} stree_var_t;
-
-/** Member property declaration */
-typedef struct stree_prop {
-	stree_ident_t *name;
-	struct stree_symbol *symbol;
-	stree_texpr_t *type;
-
-	stree_proc_t *getter;
-
-	stree_proc_t *setter;
-	stree_proc_arg_t *setter_arg;
-
-	/** Formal parameters (for indexed properties) */
-	list_t args; /* of stree_proc_arg_t */
-
-	/** Variadic argument or @c NULL if none. */
-	stree_proc_arg_t *varg;
-
-	/** Type of the property */
-	struct tdata_item *titem;
-} stree_prop_t;
-
-/**
- * Fake identifiers used with symbols that do not really have one.
- */
-#define CTOR_IDENT "$ctor"
-#define INDEXER_IDENT "$indexer"
-
-typedef enum {
-	csimbr_csi,
-	csimbr_ctor,
-	csimbr_deleg,
-	csimbr_enum,
-	csimbr_fun,
-	csimbr_var,
-	csimbr_prop
-} csimbr_class_t;
-
-/** Class, struct or interface member */
-typedef struct {
-	csimbr_class_t cc;
-
-	union {
-		struct stree_csi *csi;
-		stree_ctor_t *ctor;
-		stree_deleg_t *deleg;
-		stree_enum_t *enum_d;
-		stree_fun_t *fun;
-		stree_var_t *var;
-		stree_prop_t *prop;
-	} u;
-} stree_csimbr_t;
-
-typedef enum {
-	csi_class,
-	csi_struct,
-	csi_interface
-} csi_class_t;
-
-/** CSI formal type argument */
-typedef struct stree_targ {
-	stree_ident_t *name;
-	struct stree_symbol *symbol;
-} stree_targ_t;
-
-/** Class, struct or interface declaration */
-typedef struct stree_csi {
-	/** Which of class, struct or interface */
-	csi_class_t cc;
-
-	/** Name of this CSI */
-	stree_ident_t *name;
-
-	/** List of type arguments */
-	list_t targ; /* of stree_targ_t */
-
-	/** Symbol for this CSI */
-	struct stree_symbol *symbol;
-
-	/** Type expressions referencing inherited CSIs. */
-	list_t inherit; /* of stree_texpr_t */
-
-	/** Base CSI. Only available when ancr_state == ws_visited. */
-	struct stree_csi *base_csi;
-
-	/** Types of implemented or accumulated interfaces. */
-	list_t impl_if_ti; /* of tdata_item_t */
-
-	/** Node state for ancr walks. */
-	walk_state_t ancr_state;
-
-	/** List of CSI members */
-	list_t members; /* of stree_csimbr_t */
-} stree_csi_t;
-
-typedef enum {
-	/* Class, struct or interface declaration */
-	mc_csi,
-	/* Enum declaration */
-	mc_enum
-} modm_class_t;
-
-/** Module member */
-typedef struct {
-	modm_class_t mc;
-	union {
-		stree_csi_t *csi;
-		stree_enum_t *enum_d;
-	} u;
-} stree_modm_t;
-
-/** Module */
-typedef struct stree_module {
-	/** List of module members */
-	list_t members; /* of stree_modm_t */
-} stree_module_t;
-
-/** Symbol attribute class */
-typedef enum {
-	/** Builtin symbol (interpreter hook) */
-	sac_builtin,
-
-	/** Static symbol */
-	sac_static
-} symbol_attr_class_t;
-
-/** Symbol atribute */
-typedef struct {
-	symbol_attr_class_t sac;
-} stree_symbol_attr_t;
-
-typedef enum {
-	/** CSI (class, struct or interface) */
-	sc_csi,
-	/** Constructor */
-	sc_ctor,
-	/** Member delegate */
-	sc_deleg,
-	/** Enum */
-	sc_enum,
-	/** Member function */
-	sc_fun,
-	/** Member variable */
-	sc_var,
-	/** Member property */
-	sc_prop
-} symbol_class_t;
-
-/** Symbol
- *
- * A symbol is a common superclass of different program elements that
- * allow us to refer to them, print their fully qualified names, etc.
- */
-typedef struct stree_symbol {
-	symbol_class_t sc;
-
-	union {
-		struct stree_csi *csi;
-		stree_ctor_t *ctor;
-		stree_deleg_t *deleg;
-		stree_enum_t *enum_d;
-		stree_fun_t *fun;
-		stree_var_t *var;
-		stree_prop_t *prop;
-	} u;
-
-	/** Containing CSI */
-	stree_csi_t *outer_csi;
-
-	/** Symbol attributes */
-	list_t attr; /* of stree_symbol_attr_t */
-} stree_symbol_t;
-
-/** Program */
-typedef struct stree_program {
-	/** The one and only module in the program */
-	stree_module_t *module;
-
-	/** Builtin symbols binding. */
-	struct builtin *builtin;
-} stree_program_t;
-
-#endif
Index: pace/app/sbi/src/strtab.c
===================================================================
--- uspace/app/sbi/src/strtab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file String table.
- *
- * Converts strings to more compact SID (string ID, integer) and back.
- * (The point is that this deduplicates the strings. Using SID might actually
- * not be such a big win.)
- *
- * The string table is a singleton as there will never be a need for
- * more than one.
- *
- * Current implementation uses a linked list and thus it is slow.
- */
-
-#include <stdlib.h>
-#include "mytypes.h"
-#include "os/os.h"
-#include "list.h"
-
-#include "strtab.h"
-
-static list_t str_list;
-
-/** Initialize string table. */
-void strtab_init(void)
-{
-	list_init(&str_list);
-}
-
-/** Get SID of a string.
- *
- * Return SID of @a str. If @a str is not in the string table yet,
- * it is added and thus a new SID is assigned.
- *
- * @param str	String
- * @return	SID of @a str.
- */
-sid_t strtab_get_sid(const char *str)
-{
-	list_node_t *node;
-	sid_t sid;
-
-	sid = 0;
-	node = list_first(&str_list);
-
-	while (node != NULL) {
-		++sid;
-		if (os_str_cmp(str, list_node_data(node, char *)) == 0)
-			return sid;
-
-		node = list_next(&str_list, node);
-	}
-
-	++sid;
-	list_append(&str_list, os_str_dup(str));
-
-	return sid;
-}
-
-/** Get string with the given SID.
- *
- * Returns string that has SID @a sid. If no such string exists, this
- * causes a fatal error in the interpreter.
- *
- * @param sid	SID of the string.
- * @return	Pointer to the string.
- */
-char *strtab_get_str(sid_t sid)
-{
-	list_node_t *node;
-	sid_t cnt;
-
-	node = list_first(&str_list);
-	cnt = 1;
-	while (node != NULL && cnt < sid) {
-		node = list_next(&str_list, node);
-		cnt += 1;
-	}
-
-	if (node == NULL) {
-		printf("Internal error: Invalid SID %d", sid);
-		abort();
-	}
-
-	return list_node_data(node, char *);
-}
Index: pace/app/sbi/src/strtab.h
===================================================================
--- uspace/app/sbi/src/strtab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STRTAB_H_
-#define STRTAB_H_
-
-#include "mytypes.h"
-
-void strtab_init(void);
-sid_t strtab_get_sid(const char *str);
-char *strtab_get_str(sid_t sid);
-
-#endif
Index: pace/app/sbi/src/strtab_t.h
===================================================================
--- uspace/app/sbi/src/strtab_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STRTAB_T_H_
-#define STRTAB_T_H_
-
-/** String ID */
-typedef int sid_t;
-
-#endif
Index: pace/app/sbi/src/stype.c
===================================================================
--- uspace/app/sbi/src/stype.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2343 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file Implements a walk on the program that computes and checks static
- * types. 'Types' the program.
- *
- * If a type error is encountered, stype_note_error() is called to set
- * the typing error flag.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "cspan.h"
-#include "debug.h"
-#include "intmap.h"
-#include "list.h"
-#include "mytypes.h"
-#include "run_texpr.h"
-#include "stree.h"
-#include "strtab.h"
-#include "stype_expr.h"
-#include "symbol.h"
-#include "tdata.h"
-
-#include "stype.h"
-
-static void stype_csi(stype_t *stype, stree_csi_t *csi);
-static void stype_ctor(stype_t *stype, stree_ctor_t *ctor);
-static void stype_ctor_body(stype_t *stype, stree_ctor_t *ctor);
-static void stype_fun(stype_t *stype, stree_fun_t *fun);
-static void stype_var(stype_t *stype, stree_var_t *var);
-static void stype_prop(stype_t *stype, stree_prop_t *prop);
-
-static void stype_fun_sig(stype_t *stype, stree_csi_t *outer_csi,
-    stree_fun_sig_t *sig, tdata_fun_sig_t **rtsig);
-static void stype_fun_body(stype_t *stype, stree_fun_t *fun);
-static void stype_block(stype_t *stype, stree_block_t *block);
-
-static void stype_class_impl_check(stype_t *stype, stree_csi_t *csi);
-static void stype_class_impl_check_if(stype_t *stype, stree_csi_t *csi,
-    tdata_item_t *iface_ti);
-static void stype_class_impl_check_mbr(stype_t *stype, stree_csi_t *csi,
-    tdata_tvv_t *if_tvv, stree_csimbr_t *ifmbr);
-static void stype_class_impl_check_fun(stype_t *stype,
-    stree_symbol_t *cfun_sym, tdata_tvv_t *if_tvv, stree_symbol_t *ifun_sym);
-static void stype_class_impl_check_prop(stype_t *stype,
-    stree_symbol_t *cprop_sym, tdata_tvv_t *if_tvv, stree_symbol_t *iprop_sym);
-
-static void stype_vdecl(stype_t *stype, stree_vdecl_t *vdecl_s);
-static void stype_if(stype_t *stype, stree_if_t *if_s);
-static void stype_switch(stype_t *stype, stree_switch_t *switch_s);
-static void stype_while(stype_t *stype, stree_while_t *while_s);
-static void stype_for(stype_t *stype, stree_for_t *for_s);
-static void stype_raise(stype_t *stype, stree_raise_t *raise_s);
-static void stype_break(stype_t *stype, stree_break_t *break_s);
-static void stype_return(stype_t *stype, stree_return_t *return_s);
-static void stype_exps(stype_t *stype, stree_exps_t *exp_s, bool_t want_value);
-static void stype_wef(stype_t *stype, stree_wef_t *wef_s);
-
-static stree_expr_t *stype_convert_tprimitive(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest);
-static stree_expr_t *stype_convert_tprim_tobj(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest);
-static stree_expr_t *stype_convert_tobject(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-static stree_expr_t *stype_convert_tarray(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-static stree_expr_t *stype_convert_tdeleg(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-static stree_expr_t *stype_convert_tenum(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-static stree_expr_t *stype_convert_tfun_tdeleg(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest);
-static stree_expr_t *stype_convert_tvref(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-
-static bool_t stype_fun_sig_equal(stype_t *stype, tdata_fun_sig_t *asig,
-    tdata_fun_sig_t *sdig);
-
-/** Type module.
- *
- * If the module contains a type error, @a stype->error will be set
- * when this function returns.
- *
- * @param stype		Static typing object
- * @param module	Module to type
- */
-void stype_module(stype_t *stype, stree_module_t *module)
-{
-	list_node_t *mbr_n;
-	stree_modm_t *mbr;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type module.\n");
-#endif
-	stype->current_csi = NULL;
-	stype->proc_vr = NULL;
-
-	mbr_n = list_first(&module->members);
-	while (mbr_n != NULL) {
-		mbr = list_node_data(mbr_n, stree_modm_t *);
-
-		switch (mbr->mc) {
-		case mc_csi:
-			stype_csi(stype, mbr->u.csi);
-			break;
-		case mc_enum:
-			stype_enum(stype, mbr->u.enum_d);
-			break;
-		}
-
-		mbr_n = list_next(&module->members, mbr_n);
-	}
-}
-
-/** Type CSI.
- *
- * @param stype		Static typing object
- * @param csi		CSI to type
- */
-static void stype_csi(stype_t *stype, stree_csi_t *csi)
-{
-	list_node_t *csimbr_n;
-	stree_csimbr_t *csimbr;
-	stree_csi_t *prev_ctx;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type CSI '");
-	symbol_print_fqn(csi_to_symbol(csi));
-	printf("'.\n");
-#endif
-	prev_ctx = stype->current_csi;
-	stype->current_csi = csi;
-
-	csimbr_n = list_first(&csi->members);
-	while (csimbr_n != NULL) {
-		csimbr = list_node_data(csimbr_n, stree_csimbr_t *);
-
-		switch (csimbr->cc) {
-		case csimbr_csi:
-			stype_csi(stype, csimbr->u.csi);
-			break;
-		case csimbr_ctor:
-			stype_ctor(stype, csimbr->u.ctor);
-			break;
-		case csimbr_deleg:
-			stype_deleg(stype, csimbr->u.deleg);
-			break;
-		case csimbr_enum:
-			stype_enum(stype, csimbr->u.enum_d);
-			break;
-		case csimbr_fun:
-			stype_fun(stype, csimbr->u.fun);
-			break;
-		case csimbr_var:
-			stype_var(stype, csimbr->u.var);
-			break;
-		case csimbr_prop:
-			stype_prop(stype, csimbr->u.prop);
-			break;
-		}
-
-		csimbr_n = list_next(&csi->members, csimbr_n);
-	}
-
-	if (csi->cc == csi_class)
-		stype_class_impl_check(stype, csi);
-
-	stype->current_csi = prev_ctx;
-}
-
-/** Type a constructor.
- *
- * @param stype		Static typing object.
- * @param ctor		Constructor to type.
- */
-static void stype_ctor(stype_t *stype, stree_ctor_t *ctor)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type constructor '");
-	symbol_print_fqn(ctor_to_symbol(ctor));
-	printf("'.\n");
-#endif
-	if (ctor->titem == NULL)
-		stype_ctor_header(stype, ctor);
-
-	stype_ctor_body(stype, ctor);
-}
-
-/** Type constructor header.
- *
- * @param stype		Static typing object.
- * @param ctor		Constructor to type.
- */
-void stype_ctor_header(stype_t *stype, stree_ctor_t *ctor)
-{
-	stree_symbol_t *ctor_sym;
-	tdata_item_t *ctor_ti;
-	tdata_fun_t *tfun;
-	tdata_fun_sig_t *tsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type constructor '");
-	symbol_print_fqn(ctor_to_symbol(ctor));
-	printf("' header.\n");
-#endif
-	if (ctor->titem != NULL)
-		return; /* Constructor header has already been typed. */
-
-	ctor_sym = ctor_to_symbol(ctor);
-
-	/* Type function signature. */
-	stype_fun_sig(stype, ctor_sym->outer_csi, ctor->sig, &tsig);
-
-	ctor_ti = tdata_item_new(tic_tfun);
-	tfun = tdata_fun_new();
-	ctor_ti->u.tfun = tfun;
-	tfun->tsig = tsig;
-
-	ctor->titem = ctor_ti;
-}
-
-/** Type constructor body.
- *
- * @param stype		Static typing object
- * @param ctor		Constructor
- */
-static void stype_ctor_body(stype_t *stype, stree_ctor_t *ctor)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type constructor '");
-	symbol_print_fqn(ctor_to_symbol(ctor));
-	printf("' body.\n");
-#endif
-	assert(stype->proc_vr == NULL);
-
-	stype->proc_vr = stype_proc_vr_new();
-	stype->proc_vr->proc = ctor->proc;
-	list_init(&stype->proc_vr->block_vr);
-
-	stype_block(stype, ctor->proc->body);
-
-	free(stype->proc_vr);
-	stype->proc_vr = NULL;
-}
-
-/** Type delegate.
- *
- * @param stype		Static typing object.
- * @param deleg		Delegate to type.
- */
-void stype_deleg(stype_t *stype, stree_deleg_t *deleg)
-{
-	stree_symbol_t *deleg_sym;
-	tdata_item_t *deleg_ti;
-	tdata_deleg_t *tdeleg;
-	tdata_fun_sig_t *tsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type delegate '");
-	symbol_print_fqn(deleg_to_symbol(deleg));
-	printf("'.\n");
-#endif
-	if (deleg->titem == NULL) {
-		deleg_ti = tdata_item_new(tic_tdeleg);
-		deleg->titem = deleg_ti;
-		tdeleg = tdata_deleg_new();
-		deleg_ti->u.tdeleg = tdeleg;
-	} else {
-		deleg_ti = deleg->titem;
-		assert(deleg_ti->u.tdeleg != NULL);
-		tdeleg = deleg_ti->u.tdeleg;
-	}
-
-	if (tdeleg->tsig != NULL)
-		return; /* Delegate has already been typed. */
-
-	deleg_sym = deleg_to_symbol(deleg);
-
-	/* Type function signature. Store result in deleg->titem. */
-	stype_fun_sig(stype, deleg_sym->outer_csi, deleg->sig, &tsig);
-
-	tdeleg->deleg = deleg;
-	tdeleg->tsig = tsig;
-}
-
-/** Type enum.
- *
- * @param stype		Static typing object
- * @param enum_d	Enum to type
- */
-void stype_enum(stype_t *stype, stree_enum_t *enum_d)
-{
-	tdata_item_t *titem;
-	tdata_enum_t *tenum;
-
-	(void) stype;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type enum '");
-	symbol_print_fqn(enum_to_symbol(enum_d));
-	printf("'.\n");
-#endif
-	if (enum_d->titem == NULL) {
-		titem = tdata_item_new(tic_tenum);
-		tenum = tdata_enum_new();
-		titem->u.tenum = tenum;
-		tenum->enum_d = enum_d;
-
-		enum_d->titem = titem;
-	}
-}
-
-/** Type function.
- *
- * We split typing of function header and body because at the point we
- * are typing the body of some function we may encounter function calls.
- * To type a function call we first need to type the header of the function
- * being called.
- *
- * @param stype		Static typing object.
- * @param fun		Function to type.
- */
-static void stype_fun(stype_t *stype, stree_fun_t *fun)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type function '");
-	symbol_print_fqn(fun_to_symbol(fun));
-	printf("'.\n");
-#endif
-	if (fun->titem == NULL)
-		stype_fun_header(stype, fun);
-
-	stype_fun_body(stype, fun);
-}
-
-/** Type function header.
- *
- * Types the header of @a fun (but not its body).
- *
- * @param stype		Static typing object
- * @param fun		Funtction
- */
-void stype_fun_header(stype_t *stype, stree_fun_t *fun)
-{
-	stree_symbol_t *fun_sym;
-	tdata_item_t *fun_ti;
-	tdata_fun_t *tfun;
-	tdata_fun_sig_t *tsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type function '");
-	symbol_print_fqn(fun_to_symbol(fun));
-	printf("' header.\n");
-#endif
-	if (fun->titem != NULL)
-		return; /* Function header has already been typed. */
-
-	fun_sym = fun_to_symbol(fun);
-
-	/* Type function signature. */
-	stype_fun_sig(stype, fun_sym->outer_csi, fun->sig, &tsig);
-
-	fun_ti = tdata_item_new(tic_tfun);
-	tfun = tdata_fun_new();
-	fun_ti->u.tfun = tfun;
-	tfun->tsig = tsig;
-
-	fun->titem = fun_ti;
-}
-
-/** Type function signature.
- *
- * Types the function signature @a sig.
- *
- * @param stype		Static typing object
- * @param outer_csi	CSI within which the signature is defined.
- * @param sig		Function signature
- */
-static void stype_fun_sig(stype_t *stype, stree_csi_t *outer_csi,
-    stree_fun_sig_t *sig, tdata_fun_sig_t **rtsig)
-{
-	list_node_t *arg_n;
-	stree_proc_arg_t *arg;
-	tdata_item_t *titem;
-	tdata_fun_sig_t *tsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type function signature.\n");
-#endif
-	tsig = tdata_fun_sig_new();
-
-	list_init(&tsig->arg_ti);
-
-	/*
-	 * Type formal arguments.
-	 */
-	arg_n = list_first(&sig->args);
-	while (arg_n != NULL) {
-		arg = list_node_data(arg_n, stree_proc_arg_t *);
-
-		/* XXX Because of overloaded builtin WriteLine. */
-		if (arg->type == NULL) {
-			list_append(&tsig->arg_ti, NULL);
-			arg_n = list_next(&sig->args, arg_n);
-			continue;
-		}
-
-		run_texpr(stype->program, outer_csi, arg->type, &titem);
-		list_append(&tsig->arg_ti, titem);
-
-		arg_n = list_next(&sig->args, arg_n);
-	}
-
-	/* Variadic argument */
-	if (sig->varg != NULL) {
-		/* Check type and verify it is an array. */
-		run_texpr(stype->program, outer_csi, sig->varg->type, &titem);
-		tsig->varg_ti = titem;
-
-		if (titem->tic != tic_tarray && titem->tic != tic_ignore) {
-			printf("Error: Packed argument is not an array.\n");
-			stype_note_error(stype);
-		}
-	}
-
-	/* Return type */
-	if (sig->rtype != NULL) {
-		run_texpr(stype->program, outer_csi, sig->rtype, &titem);
-		tsig->rtype = titem;
-	}
-
-	*rtsig = tsig;
-}
-
-/** Type function body.
- *
- * Types the body of function @a fun (if it has one).
- *
- * @param stype		Static typing object
- * @param fun		Funtction
- */
-static void stype_fun_body(stype_t *stype, stree_fun_t *fun)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type function '");
-	symbol_print_fqn(fun_to_symbol(fun));
-	printf("' body.\n");
-#endif
-	assert(stype->proc_vr == NULL);
-
-	/* Declarations and builtin functions do not have a body. */
-	if (fun->proc->body == NULL)
-		return;
-
-	stype->proc_vr = stype_proc_vr_new();
-	stype->proc_vr->proc = fun->proc;
-	list_init(&stype->proc_vr->block_vr);
-
-	stype_block(stype, fun->proc->body);
-
-	free(stype->proc_vr);
-	stype->proc_vr = NULL;
-}
-
-/** Type member variable.
- *
- * @param stype		Static typing object
- * @param var		Member variable
- */
-static void stype_var(stype_t *stype, stree_var_t *var)
-{
-	tdata_item_t *titem;
-
-	run_texpr(stype->program, stype->current_csi, var->type,
-	    &titem);
-	if (titem->tic == tic_ignore) {
-		/* An error occured. */
-		stype_note_error(stype);
-	}
-}
-
-/** Type property.
- *
- * @param stype		Static typing object
- * @param prop		Property
- */
-static void stype_prop(stype_t *stype, stree_prop_t *prop)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type property '");
-	symbol_print_fqn(prop_to_symbol(prop));
-	printf("'.\n");
-#endif
-	if (prop->titem == NULL)
-		stype_prop_header(stype, prop);
-
-	stype->proc_vr = stype_proc_vr_new();
-	list_init(&stype->proc_vr->block_vr);
-
-	/* Property declarations do not have a getter body. */
-	if (prop->getter != NULL && prop->getter->body != NULL) {
-		stype->proc_vr->proc = prop->getter;
-		stype_block(stype, prop->getter->body);
-	}
-
-	/* Property declarations do not have a setter body. */
-	if (prop->setter != NULL && prop->setter->body != NULL) {
-		stype->proc_vr->proc = prop->setter;
-		stype_block(stype, prop->setter->body);
-	}
-
-	free(stype->proc_vr);
-	stype->proc_vr = NULL;
-}
-
-/** Type property header.
- *
- * @param stype		Static typing object
- * @param prop		Property
- */
-void stype_prop_header(stype_t *stype, stree_prop_t *prop)
-{
-	tdata_item_t *titem;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type property '");
-	symbol_print_fqn(prop_to_symbol(prop));
-	printf("' header.\n");
-#endif
-	run_texpr(stype->program, stype->current_csi, prop->type,
-	    &titem);
-	if (titem->tic == tic_ignore) {
-		/* An error occured. */
-		stype_note_error(stype);
-		return;
-	}
-
-	prop->titem = titem;
-}
-
-/** Type statement block.
- *
- * @param stype		Static typing object
- * @param block		Statement block
- */
-static void stype_block(stype_t *stype, stree_block_t *block)
-{
-	stree_stat_t *stat;
-	list_node_t *stat_n;
-	stype_block_vr_t *block_vr;
-	list_node_t *bvr_n;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type block.\n");
-#endif
-
-	/* Create block visit record. */
-	block_vr = stype_block_vr_new();
-	intmap_init(&block_vr->vdecls);
-
-	/* Add block visit record to the stack. */
-	list_append(&stype->proc_vr->block_vr, block_vr);
-
-	stat_n = list_first(&block->stats);
-	while (stat_n != NULL) {
-		stat = list_node_data(stat_n, stree_stat_t *);
-		stype_stat(stype, stat, b_false);
-
-		stat_n = list_next(&block->stats, stat_n);
-	}
-
-	/* Remove block visit record from the stack, */
-	bvr_n = list_last(&stype->proc_vr->block_vr);
-	assert(list_node_data(bvr_n, stype_block_vr_t *) == block_vr);
-	list_remove(&stype->proc_vr->block_vr, bvr_n);
-}
-
-/** Verify that class fully implements all interfaces as it claims.
- *
- * @param stype		Static typing object
- * @param csi		CSI to check
- */
-static void stype_class_impl_check(stype_t *stype, stree_csi_t *csi)
-{
-	list_node_t *pred_n;
-	stree_texpr_t *pred_te;
-	tdata_item_t *pred_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Verify that class implements all interfaces.\n");
-#endif
-	assert(csi->cc == csi_class);
-
-	pred_n = list_first(&csi->inherit);
-	while (pred_n != NULL) {
-		pred_te = list_node_data(pred_n, stree_texpr_t *);
-		run_texpr(stype->program, csi, pred_te, &pred_ti);
-
-		assert(pred_ti->tic == tic_tobject);
-		switch (pred_ti->u.tobject->csi->cc) {
-		case csi_class:
-			break;
-		case csi_struct:
-			assert(b_false);
-			/* Fallthrough */
-		case csi_interface:
-			/* Store to impl_if_ti for later use. */
-			list_append(&csi->impl_if_ti, pred_ti);
-
-			/* Check implementation of this interface. */
-			stype_class_impl_check_if(stype, csi, pred_ti);
-			break;
-		}
-
-		pred_n = list_next(&csi->inherit, pred_n);
-	}
-}
-
-/** Verify that class fully implements an interface.
- *
- * @param stype		Static typing object
- * @param csi		CSI to check
- * @param iface		Interface that must be fully implemented
- */
-static void stype_class_impl_check_if(stype_t *stype, stree_csi_t *csi,
-    tdata_item_t *iface_ti)
-{
-	tdata_tvv_t *iface_tvv;
-	list_node_t *pred_n;
-	tdata_item_t *pred_ti;
-	tdata_item_t *pred_sti;
-
-	stree_csi_t *iface;
-	list_node_t *ifmbr_n;
-	stree_csimbr_t *ifmbr;
-
-	assert(csi->cc == csi_class);
-
-	assert(iface_ti->tic == tic_tobject);
-	iface = iface_ti->u.tobject->csi;
-	assert(iface->cc == csi_interface);
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Verify that class fully implements interface.\n");
-#endif
-	/* Compute TVV for this interface reference. */
-	stype_titem_to_tvv(stype, iface_ti, &iface_tvv);
-
-	/*
-	 * Recurse to accumulated interfaces.
-	 */
-	pred_n = list_first(&iface->impl_if_ti);
-	while (pred_n != NULL) {
-		pred_ti = list_node_data(pred_n, tdata_item_t *);
-		assert(pred_ti->tic == tic_tobject);
-		assert(pred_ti->u.tobject->csi->cc == csi_interface);
-
-		/* Substitute real type parameters to predecessor reference. */
-		tdata_item_subst(pred_ti, iface_tvv, &pred_sti);
-
-		/* Check accumulated interface. */
-		stype_class_impl_check_if(stype, csi, pred_sti);
-
-		pred_n = list_next(&iface->impl_if_ti, pred_n);
-	}
-
-	/*
-	 * Check all interface members.
-	 */
-	ifmbr_n = list_first(&iface->members);
-	while (ifmbr_n != NULL) {
-		ifmbr = list_node_data(ifmbr_n, stree_csimbr_t *);
-		stype_class_impl_check_mbr(stype, csi, iface_tvv, ifmbr);
-
-		ifmbr_n = list_next(&iface->members, ifmbr_n);
-	}
-}
-
-/** Verify that class fully implements an interface member.
- *
- * @param stype		Static typing object
- * @param csi		CSI to check
- * @param if_tvv	TVV for @a ifmbr
- * @param ifmbr		Interface that must be fully implemented
- */
-static void stype_class_impl_check_mbr(stype_t *stype, stree_csi_t *csi,
-    tdata_tvv_t *if_tvv, stree_csimbr_t *ifmbr)
-{
-	stree_symbol_t *cmbr_sym;
-	stree_symbol_t *ifmbr_sym;
-	stree_ident_t *ifmbr_name;
-
-	assert(csi->cc == csi_class);
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Verify that class implements interface member.\n");
-#endif
-	ifmbr_name = stree_csimbr_get_name(ifmbr);
-
-	cmbr_sym = symbol_search_csi(stype->program, csi, ifmbr_name);
-	if (cmbr_sym == NULL) {
-		printf("Error: CSI '");
-		symbol_print_fqn(csi_to_symbol(csi));
-		printf("' should implement '");
-		symbol_print_fqn(csimbr_to_symbol(ifmbr));
-		printf("' but it does not.\n");
-		stype_note_error(stype);
-		return;
-	}
-
-	ifmbr_sym = csimbr_to_symbol(ifmbr);
-	if (cmbr_sym->sc != ifmbr_sym->sc) {
-		printf("Error: CSI '");
-		symbol_print_fqn(csi_to_symbol(csi));
-		printf("' implements '");
-		symbol_print_fqn(csimbr_to_symbol(ifmbr));
-		printf("' as a different kind of symbol.\n");
-		stype_note_error(stype);
-	}
-
-	switch (cmbr_sym->sc) {
-	case sc_csi:
-	case sc_ctor:
-	case sc_deleg:
-	case sc_enum:
-		/*
-		 * Checked at parse time. Interface should not have these
-		 * member types.
-		 */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_fun:
-		stype_class_impl_check_fun(stype, cmbr_sym, if_tvv, ifmbr_sym);
-		break;
-	case sc_var:
-		/*
-		 * Checked at parse time. Interface should not have these
-		 * member types.
-		 */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_prop:
-		stype_class_impl_check_prop(stype, cmbr_sym, if_tvv, ifmbr_sym);
-		break;
-	}
-}
-
-/** Verify that class properly implements a function from an interface.
- *
- * @param stype		Static typing object
- * @param cfun_sym	Function symbol in class
- * @param if_tvv	TVV for @a ifun_sym
- * @param ifun_sym	Function declaration symbol in interface
- */
-static void stype_class_impl_check_fun(stype_t *stype,
-    stree_symbol_t *cfun_sym, tdata_tvv_t *if_tvv, stree_symbol_t *ifun_sym)
-{
-	stree_fun_t *cfun;
-	tdata_fun_t *tcfun;
-	stree_fun_t *ifun;
-	tdata_item_t *sifun_ti;
-	tdata_fun_t *tifun;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Verify that class '");
-	symbol_print_fqn(csi_to_symbol(cfun_sym->outer_csi));
-	printf("' implements function '");
-	symbol_print_fqn(ifun_sym);
-	printf("' properly.\n");
-#endif
-	assert(cfun_sym->sc == sc_fun);
-	cfun = cfun_sym->u.fun;
-
-	assert(ifun_sym->sc == sc_fun);
-	ifun = ifun_sym->u.fun;
-
-	assert(cfun->titem->tic == tic_tfun);
-	tcfun = cfun->titem->u.tfun;
-
-	tdata_item_subst(ifun->titem, if_tvv, &sifun_ti);
-	assert(sifun_ti->tic == tic_tfun);
-	tifun = sifun_ti->u.tfun;
-
-	if (!stype_fun_sig_equal(stype, tcfun->tsig, tifun->tsig)) {
-		cspan_print(cfun->name->cspan);
-		printf(" Error: Type of function '");
-		symbol_print_fqn(cfun_sym);
-		printf("' (");
-		tdata_item_print(cfun->titem);
-		printf(") does not match type of '");
-		symbol_print_fqn(ifun_sym);
-		printf("' (");
-		tdata_item_print(sifun_ti);
-		printf(") which it should implement.\n");
-		stype_note_error(stype);
-	}
-}
-
-/** Verify that class properly implements a function from an interface.
- *
- * @param stype		Static typing object
- * @param cprop_sym	Property symbol in class
- * @param if_tvv	TVV for @a ifun_sym
- * @param iprop_sym	Property declaration symbol in interface
- */
-static void stype_class_impl_check_prop(stype_t *stype,
-    stree_symbol_t *cprop_sym, tdata_tvv_t *if_tvv, stree_symbol_t *iprop_sym)
-{
-	stree_prop_t *cprop;
-	stree_prop_t *iprop;
-	tdata_item_t *siprop_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Verify that class '");
-	symbol_print_fqn(csi_to_symbol(cprop_sym->outer_csi));
-	printf("' implements property '");
-	symbol_print_fqn(iprop_sym);
-	printf("' properly.\n");
-#endif
-	assert(cprop_sym->sc == sc_prop);
-	cprop = cprop_sym->u.prop;
-
-	assert(iprop_sym->sc == sc_prop);
-	iprop = iprop_sym->u.prop;
-
-	tdata_item_subst(iprop->titem, if_tvv, &siprop_ti);
-
-	if (!tdata_item_equal(cprop->titem, siprop_ti)) {
-		cspan_print(cprop->name->cspan);
-		printf(" Error: Type of property '");
-		symbol_print_fqn(cprop_sym);
-		printf("' (");
-		tdata_item_print(cprop->titem);
-		printf(") does not match type of '");
-		symbol_print_fqn(iprop_sym);
-		printf("' (");
-		tdata_item_print(siprop_ti);
-		printf(") which it should implement.\n");
-		stype_note_error(stype);
-	}
-
-	if (iprop->getter != NULL && cprop->getter == NULL) {
-		cspan_print(cprop->name->cspan);
-		printf(" Error: Property '");
-		symbol_print_fqn(cprop_sym);
-		printf("' is missing a getter, which is required by '");
-		symbol_print_fqn(iprop_sym);
-		printf("'.\n");
-		stype_note_error(stype);
-	}
-
-	if (iprop->setter != NULL && cprop->setter == NULL) {
-		cspan_print(cprop->name->cspan);
-		printf(" Error: Property '");
-		symbol_print_fqn(cprop_sym);
-		printf("' is missing a setter, which is required by '");
-		symbol_print_fqn(iprop_sym);
-		printf("'.\n");
-		stype_note_error(stype);
-	}
-}
-
-/** Type statement
- *
- * Types a statement. If @a want_value is @c b_true, then warning about
- * ignored expression value will be supressed for this statement (but not
- * for nested statemens). This is used in interactive mode.
- *
- * @param stype		Static typing object
- * @param stat		Statement to type
- * @param want_value	@c b_true to allow ignoring expression value
- */
-void stype_stat(stype_t *stype, stree_stat_t *stat, bool_t want_value)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type statement.\n");
-#endif
-	switch (stat->sc) {
-	case st_vdecl:
-		stype_vdecl(stype, stat->u.vdecl_s);
-		break;
-	case st_if:
-		stype_if(stype, stat->u.if_s);
-		break;
-	case st_switch:
-		stype_switch(stype, stat->u.switch_s);
-		break;
-	case st_while:
-		stype_while(stype, stat->u.while_s);
-		break;
-	case st_for:
-		stype_for(stype, stat->u.for_s);
-		break;
-	case st_raise:
-		stype_raise(stype, stat->u.raise_s);
-		break;
-	case st_break:
-		stype_break(stype, stat->u.break_s);
-		break;
-	case st_return:
-		stype_return(stype, stat->u.return_s);
-		break;
-	case st_exps:
-		stype_exps(stype, stat->u.exp_s, want_value);
-		break;
-	case st_wef:
-		stype_wef(stype, stat->u.wef_s);
-		break;
-	}
-}
-
-/** Type local variable declaration statement.
- *
- * @param stype		Static typing object
- * @param vdecl_s	Variable delcaration statement
- */
-static void stype_vdecl(stype_t *stype, stree_vdecl_t *vdecl_s)
-{
-	stype_block_vr_t *block_vr;
-	stree_vdecl_t *old_vdecl;
-	tdata_item_t *titem;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type variable declaration statement.\n");
-#endif
-	block_vr = stype_get_current_block_vr(stype);
-	old_vdecl = (stree_vdecl_t *) intmap_get(&block_vr->vdecls,
-	    vdecl_s->name->sid);
-
-	if (old_vdecl != NULL) {
-		printf("Error: Duplicate variable declaration '%s'.\n",
-		    strtab_get_str(vdecl_s->name->sid));
-		stype_note_error(stype);
-	}
-
-	run_texpr(stype->program, stype->current_csi, vdecl_s->type,
-	    &titem);
-	if (titem->tic == tic_ignore) {
-		/* An error occured. */
-		stype_note_error(stype);
-		return;
-	}
-
-	/* Annotate with variable type */
-	vdecl_s->titem = titem;
-
-	intmap_set(&block_vr->vdecls, vdecl_s->name->sid, vdecl_s);
-}
-
-/** Type @c if statement.
- *
- * @param stype		Static typing object
- * @param if_s		@c if statement
- */
-static void stype_if(stype_t *stype, stree_if_t *if_s)
-{
-	stree_expr_t *ccond;
-	list_node_t *ifc_node;
-	stree_if_clause_t *ifc;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'if' statement.\n");
-#endif
-	ifc_node = list_first(&if_s->if_clauses);
-
-	/* Walk through all if/elif clauses. */
-
-	while (ifc_node != NULL) {
-		/* Get if/elif clause */
-		ifc = list_node_data(ifc_node, stree_if_clause_t *);
-
-		/* Convert condition to boolean type. */
-		stype_expr(stype, ifc->cond);
-		ccond = stype_convert(stype, ifc->cond,
-		    stype_boolean_titem(stype));
-
-		/* Patch code with augmented expression. */
-		ifc->cond = ccond;
-
-		/* Type the @c if/elif block */
-		stype_block(stype, ifc->block);
-
-		ifc_node = list_next(&if_s->if_clauses, ifc_node);
-	}
-
-	/* Type the @c else block */
-	if (if_s->else_block != NULL)
-		stype_block(stype, if_s->else_block);
-}
-
-/** Type @c switch statement.
- *
- * @param stype		Static typing object
- * @param switch_s	@c switch statement
- */
-static void stype_switch(stype_t *stype, stree_switch_t *switch_s)
-{
-	stree_expr_t *expr, *cexpr;
-	list_node_t *whenc_node;
-	stree_when_t *whenc;
-	list_node_t *expr_node;
-	tdata_item_t *titem1, *titem2;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'switch' statement.\n");
-#endif
-	stype_expr(stype, switch_s->expr);
-
-	titem1 = switch_s->expr->titem;
-	if (titem1 == NULL) {
-		cspan_print(switch_s->expr->cspan);
-		printf(" Error: Switch expression has no value.\n");
-		stype_note_error(stype);
-		return;
-	}
-
-	/* Walk through all when clauses. */
-	whenc_node = list_first(&switch_s->when_clauses);
-
-	while (whenc_node != NULL) {
-		/* Get when clause */
-		whenc = list_node_data(whenc_node, stree_when_t *);
-
-		/* Walk through all expressions of the when clause */
-		expr_node = list_first(&whenc->exprs);
-		while (expr_node != NULL) {
-			expr = list_node_data(expr_node, stree_expr_t *);
-
-			stype_expr(stype, expr);
-			titem2 = expr->titem;
-			if (titem2 == NULL) {
-				cspan_print(expr->cspan);
-				printf(" Error: When expression has no value.\n");
-				stype_note_error(stype);
-				return;
-			}
-
-			/* Convert expression to same type as switch expr. */
-			cexpr = stype_convert(stype, expr, titem1);
-
-			/* Patch code with augmented expression. */
-			list_node_setdata(expr_node, cexpr);
-
-			expr_node = list_next(&whenc->exprs, expr_node);
-		}
-
-		/* Type the @c when block */
-		stype_block(stype, whenc->block);
-
-		whenc_node = list_next(&switch_s->when_clauses, whenc_node);
-	}
-
-	/* Type the @c else block */
-	if (switch_s->else_block != NULL)
-		stype_block(stype, switch_s->else_block);
-}
-
-/** Type @c while statement
- *
- * @param stype		Static typing object
- * @param while_s	@c while statement
- */
-static void stype_while(stype_t *stype, stree_while_t *while_s)
-{
-	stree_expr_t *ccond;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'while' statement.\n");
-#endif
-	/* Convert condition to boolean type. */
-	stype_expr(stype, while_s->cond);
-	ccond = stype_convert(stype, while_s->cond,
-	    stype_boolean_titem(stype));
-
-	/* Patch code with augmented expression. */
-	while_s->cond = ccond;
-
-	/* While is a breakable statement. Increment counter. */
-	stype->proc_vr->bstat_cnt += 1;
-
-	/* Type the body of the loop */
-	stype_block(stype, while_s->body);
-
-	stype->proc_vr->bstat_cnt -= 1;
-}
-
-/** Type @c for statement.
- *
- * @param stype		Static typing object
- * @param for_s		@c for statement
- */
-static void stype_for(stype_t *stype, stree_for_t *for_s)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'for' statement.\n");
-#endif
-	/* For is a breakable statement. Increment counter. */
-	stype->proc_vr->bstat_cnt += 1;
-
-	stype_block(stype, for_s->body);
-
-	stype->proc_vr->bstat_cnt -= 1;
-}
-
-/** Type @c raise statement.
- *
- * @param stype		Static typing object
- * @param raise_s	@c raise statement
- */
-static void stype_raise(stype_t *stype, stree_raise_t *raise_s)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'raise' statement.\n");
-#endif
-	stype_expr(stype, raise_s->expr);
-}
-
-/** Type @c break statement */
-static void stype_break(stype_t *stype, stree_break_t *break_s)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'break' statement.\n");
-#endif
-	(void) break_s;
-
-	/* Check whether there is an active statement to break from. */
-	if (stype->proc_vr->bstat_cnt == 0) {
-		printf("Error: Break statement outside of while or for.\n");
-		stype_note_error(stype);
-	}
-}
-
-/** Type @c return statement */
-static void stype_return(stype_t *stype, stree_return_t *return_s)
-{
-	stree_symbol_t *outer_sym;
-	stree_fun_t *fun;
-	stree_prop_t *prop;
-
-	stree_expr_t *cexpr;
-	tdata_item_t *dtype;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type 'return' statement.\n");
-#endif
-	if (return_s->expr != NULL)
-		stype_expr(stype, return_s->expr);
-
-	/* Determine the type we need to return. */
-
-	outer_sym = stype->proc_vr->proc->outer_symbol;
-	switch (outer_sym->sc) {
-	case sc_fun:
-		fun = symbol_to_fun(outer_sym);
-		assert(fun != NULL);
-
-		/* XXX Memoize to avoid recomputing. */
-		if (fun->sig->rtype != NULL) {
-			run_texpr(stype->program, outer_sym->outer_csi,
-			    fun->sig->rtype, &dtype);
-
-			if (return_s->expr == NULL) {
-				printf("Error: Return without a value in "
-				    "function returning value.\n");
-				stype_note_error(stype);
-			}
-		} else {
-			dtype = NULL;
-
-			if (return_s->expr != NULL) {
-				printf("Error: Return with a value in "
-				    "value-less function.\n");
-				stype_note_error(stype);
-			}
-		}
-		break;
-	case sc_prop:
-		prop = symbol_to_prop(outer_sym);
-		assert(prop != NULL);
-
-		if (stype->proc_vr->proc == prop->getter) {
-			if (return_s->expr == NULL) {
-				printf("Error: Return without a value in "
-				    "getter.\n");
-				stype_note_error(stype);
-			}
-		} else {
-			if (return_s->expr == NULL) {
-				printf("Error: Return with a value in "
-				    "setter.\n");
-				stype_note_error(stype);
-			}
-		}
-
-		/* XXX Memoize to avoid recomputing. */
-		run_texpr(stype->program, outer_sym->outer_csi, prop->type,
-		    &dtype);
-		break;
-	default:
-		assert(b_false);
-	}
-
-	if (dtype != NULL && return_s->expr != NULL) {
-		/* Convert to the return type. */
-		cexpr = stype_convert(stype, return_s->expr, dtype);
-
-		/* Patch code with the augmented expression. */
-		return_s->expr = cexpr;
-	}
-}
-
-/** Type expression statement.
- *
- * @param stype		Static typing object
- * @param exp_s		Expression statement
- */
-static void stype_exps(stype_t *stype, stree_exps_t *exp_s, bool_t want_value)
-{
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type expression statement.\n");
-#endif
-	stype_expr(stype, exp_s->expr);
-
-	if (want_value == b_false && exp_s->expr->titem != NULL) {
-		cspan_print(exp_s->expr->cspan);
-		printf(" Warning: Expression value ignored.\n");
-	}
-}
-
-/** Type with-except-finally statement.
- *
- * @param stype		Static typing object
- * @param wef_s		With-except-finally statement
- */
-static void stype_wef(stype_t *stype, stree_wef_t *wef_s)
-{
-	list_node_t *ec_n;
-	stree_except_t *ec;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type WEF statement.\n");
-#endif
-	/* Type the @c with block. */
-	if (wef_s->with_block != NULL)
-		stype_block(stype, wef_s->with_block);
-
-	/* Type the @c except clauses. */
-	ec_n = list_first(&wef_s->except_clauses);
-	while (ec_n != NULL) {
-		ec = list_node_data(ec_n, stree_except_t *);
-		run_texpr(stype->program, stype->current_csi, ec->etype,
-		    &ec->titem);
-		stype_block(stype, ec->block);
-
-		ec_n = list_next(&wef_s->except_clauses, ec_n);
-	}
-
-	/* Type the @c finally block. */
-	if (wef_s->finally_block != NULL)
-		stype_block(stype, wef_s->finally_block);
-}
-
-/** Convert expression of one type to another type.
- *
- * If the type of expression @a expr is not compatible with @a dtype
- * (i.e. there does not exist an implicit conversion from @a expr->type to
- * @a dtype), this function will produce an error (Cannot convert A to B).
- *
- * Otherwise it will either return the expression unmodified (if there is
- * no action to take at run time) or it will return a new expression
- * while clobbering the old one. Typically this would just attach the
- * expression as a subtree of the conversion.
- *
- * Note: No conversion that would require modifying @a expr is implemented
- * yet.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-stree_expr_t *stype_convert(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-
-	src = expr->titem;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert '");
-	tdata_item_print(src);
-	printf("' to '");
-	tdata_item_print(dest);
-	printf("'.\n");
-#endif
-
-	if (dest == NULL) {
-		printf("Error: Conversion destination is not valid.\n");
-		stype_note_error(stype);
-		return expr;
-	}
-
-	if (src == NULL) {
-		cspan_print(expr->cspan);
-		printf(" Error: Conversion source is not valid.\n");
-		stype_note_error(stype);
-		return expr;
-	}
-
-	if (dest->tic == tic_ignore || src->tic == tic_ignore)
-		return expr;
-
-	/*
-	 * Special case: Nil to object.
-	 */
-	if (src->tic == tic_tprimitive && src->u.tprimitive->tpc == tpc_nil) {
-		if (dest->tic == tic_tobject)
-			return expr;
-	}
-
-	if (src->tic == tic_tprimitive && dest->tic == tic_tobject) {
-		return stype_convert_tprim_tobj(stype, expr, dest);
-	}
-
-	if (src->tic == tic_tfun && dest->tic == tic_tdeleg) {
-		return stype_convert_tfun_tdeleg(stype, expr, dest);
-	}
-
-	if (src->tic == tic_tebase) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		printf("Invalid use of reference to enum type in "
-		    "expression.\n");
-		return expr;
-	}
-
-	if (src->tic != dest->tic) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	switch (src->tic) {
-	case tic_tprimitive:
-		expr = stype_convert_tprimitive(stype, expr, dest);
-		break;
-	case tic_tobject:
-		expr = stype_convert_tobject(stype, expr, dest);
-		break;
-	case tic_tarray:
-		expr = stype_convert_tarray(stype, expr, dest);
-		break;
-	case tic_tdeleg:
-		expr = stype_convert_tdeleg(stype, expr, dest);
-		break;
-	case tic_tebase:
-		/* Conversion destination should never be enum-base */
-		assert(b_false);
-		/* Fallthrough */
-	case tic_tenum:
-		expr = stype_convert_tenum(stype, expr, dest);
-		break;
-	case tic_tfun:
-		assert(b_false);
-		/* Fallthrough */
-	case tic_tvref:
-		expr = stype_convert_tvref(stype, expr, dest);
-		break;
-	case tic_ignore:
-		assert(b_false);
-	}
-
-	return expr;
-}
-
-/** Convert expression of primitive type to primitive type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tprimitive(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest)
-{
-	tdata_item_t *src;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert primitive type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tprimitive);
-	assert(dest->tic == tic_tprimitive);
-
-	/* Check if both have the same tprimitive class. */
-	if (src->u.tprimitive->tpc != dest->u.tprimitive->tpc)
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-
-	return expr;
-}
-
-/** Convert expression of primitive type to object type.
- *
- * This function implements autoboxing. It modifies the code by inserting
- * the boxing operation.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tprim_tobj(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest)
-{
-	tdata_item_t *src;
-	builtin_t *bi;
-	stree_symbol_t *csi_sym;
-	stree_symbol_t *bp_sym;
-	stree_box_t *box;
-	stree_expr_t *bexpr;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert primitive type to object.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tprimitive);
-	assert(dest->tic == tic_tobject);
-
-	bi = stype->program->builtin;
-	csi_sym = csi_to_symbol(dest->u.tobject->csi);
-
-	/* Make compiler happy. */
-	bp_sym = NULL;
-
-	switch (src->u.tprimitive->tpc) {
-	case tpc_bool:
-		bp_sym = bi->boxed_bool;
-		break;
-	case tpc_char:
-		bp_sym = bi->boxed_char;
-		break;
-	case tpc_int:
-		bp_sym = bi->boxed_int;
-		break;
-	case tpc_nil:
-		assert(b_false);
-		/* Fallthrough */
-	case tpc_string:
-		bp_sym = bi->boxed_string;
-		break;
-	case tpc_resource:
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	/* Target type must be boxed @a src or Object */
-	if (csi_sym != bp_sym && csi_sym != bi->gf_class)
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-
-	/* Patch the code to box the primitive value */
-	box = stree_box_new();
-	box->arg = expr;
-	bexpr = stree_expr_new(ec_box);
-	bexpr->u.box = box;
-	bexpr->titem = dest;
-
-	/* No action needed to optionally convert boxed type to Object */
-
-	return bexpr;
-}
-
-/** Convert expression of object type to object type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tobject(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-	tdata_item_t *pred_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert object type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tobject);
-	assert(dest->tic == tic_tobject);
-
-	/*
-	 * Find predecessor of the right type. This determines the
-	 * type arguments that the destination type should have.
-	 */
-	pred_ti = stype_tobject_find_pred(stype, src, dest);
-	if (pred_ti == NULL) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		printf("Not a base class or implemented or accumulated "
-		    "interface.\n");
-		return expr;
-	}
-
-	/*
-	 * Verify that type arguments match with those specified for
-	 * conversion destination.
-	 */
-	if (stype_targs_check_equal(stype, pred_ti, dest) != EOK) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	return expr;
-}
-
-/** Convert expression of array type to array type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tarray(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert array type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tarray);
-	assert(dest->tic == tic_tarray);
-
-	/* Compare rank and base type. */
-	if (src->u.tarray->rank != dest->u.tarray->rank) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	/* XXX Should we convert each element? */
-	if (tdata_item_equal(src->u.tarray->base_ti,
-	    dest->u.tarray->base_ti) != b_true) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-	}
-
-	return expr;
-}
-
-/** Convert expression of delegate type to delegate type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tdeleg(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-	tdata_deleg_t *sdeleg, *ddeleg;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert delegate type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tdeleg);
-	assert(dest->tic == tic_tdeleg);
-
-	sdeleg = src->u.tdeleg;
-	ddeleg = dest->u.tdeleg;
-
-	/*
-	 * XXX We need to redesign handling of generic types to handle
-	 * delegates in generic CSIs properly.
-	 */
-
-	/* Destination should never be anonymous delegate. */
-	assert(ddeleg->deleg != NULL);
-
-	/* Both must be the same delegate. */
-	if (sdeleg->deleg != ddeleg->deleg) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	return expr;
-}
-
-/** Convert expression of enum type to enum type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tenum(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-	tdata_enum_t *senum, *denum;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert enum type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tenum);
-	assert(dest->tic == tic_tenum);
-
-	senum = src->u.tenum;
-	denum = dest->u.tenum;
-
-	/*
-	 * XXX How should enum types interact with generics?
-	 */
-
-	/* Both must be of the same enum type (with the same declaration). */
-	if (senum->enum_d != denum->enum_d) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	return expr;
-}
-
-/** Convert expression of function type to delegate type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tfun_tdeleg(stype_t *stype,
-    stree_expr_t *expr, tdata_item_t *dest)
-{
-	tdata_item_t *src;
-	tdata_fun_t *sfun;
-	tdata_deleg_t *ddeleg;
-	tdata_fun_sig_t *ssig, *dsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert delegate type.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tfun);
-	assert(dest->tic == tic_tdeleg);
-
-	sfun = src->u.tfun;
-	ddeleg = dest->u.tdeleg;
-
-	ssig = sfun->tsig;
-	assert(ssig != NULL);
-	dsig = stype_deleg_get_sig(stype, ddeleg);
-	assert(dsig != NULL);
-
-	/* Signature type must match. */
-
-	if (!stype_fun_sig_equal(stype, ssig, dsig)) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	/*
-	 * XXX We should also compare attributes. Either the
-	 * tdeleg should be extended or we should get them
-	 * from stree_deleg.
-	 */
-
-	return expr;
-}
-
-/** Convert expression of variable type to variable type.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param dest		Destination type
- */
-static stree_expr_t *stype_convert_tvref(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest)
-{
-	tdata_item_t *src;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Convert variable type.\n");
-#endif
-	src = expr->titem;
-
-	/* Currently only allow if both types are the same. */
-	if (src->u.tvref->targ != dest->u.tvref->targ) {
-		stype_convert_failure(stype, convc_implicit, expr, dest);
-		return expr;
-	}
-
-	return expr;
-}
-
-/** Display conversion error message and note error.
- *
- * @param stype		Static typing object
- * @param expr		Original expression
- * @param dest		Destination type
- */
-void stype_convert_failure(stype_t *stype, stype_conv_class_t convc,
-    stree_expr_t *expr, tdata_item_t *dest)
-{
-	cspan_print(expr->cspan);
-	printf(" Error: ");
-	switch (convc) {
-	case convc_implicit:
-		printf("Cannot implicitly convert '");
-		break;
-	case convc_as:
-		printf("Cannot use 'as' to convert '");
-		break;
-	}
-
-	tdata_item_print(expr->titem);
-	printf(" to ");
-	tdata_item_print(dest);
-	printf(".\n");
-
-	stype_note_error(stype);
-}
-
-/** Box value.
- *
- * This function implements implicit boxing. It modifies the code by inserting
- * the boxing operation.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @return		Modified expression.
- */
-stree_expr_t *stype_box_expr(stype_t *stype, stree_expr_t *expr)
-{
-	tdata_item_t *src;
-	builtin_t *bi;
-	stree_symbol_t *bp_sym;
-	stree_box_t *box;
-	stree_expr_t *bexpr;
-	tdata_object_t *tobject;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Boxing.\n");
-#endif
-	src = expr->titem;
-	assert(src->tic == tic_tprimitive);
-
-	bi = stype->program->builtin;
-
-	/* Make compiler happy. */
-	bp_sym = NULL;
-
-	switch (src->u.tprimitive->tpc) {
-	case tpc_bool:
-		bp_sym = bi->boxed_bool;
-		break;
-	case tpc_char:
-		bp_sym = bi->boxed_char;
-		break;
-	case tpc_int:
-		bp_sym = bi->boxed_int;
-		break;
-	case tpc_nil:
-		assert(b_false);
-		/* Fallthrough */
-	case tpc_string:
-		bp_sym = bi->boxed_string;
-		break;
-	case tpc_resource:
-		cspan_print(expr->cspan);
-		printf(" Error: Cannot use ");
-		tdata_item_print(expr->titem);
-		printf(" as an object.\n");
-
-		stype_note_error(stype);
-		return expr;
-	}
-
-	/* Patch the code to box the primitive value */
-	box = stree_box_new();
-	box->arg = expr;
-	bexpr = stree_expr_new(ec_box);
-	bexpr->u.box = box;
-	bexpr->titem = tdata_item_new(tic_tobject);
-	tobject = tdata_object_new();
-	bexpr->titem->u.tobject = tobject;
-
-	tobject->csi = symbol_to_csi(bp_sym);
-	assert(tobject->csi != NULL);
-
-	return bexpr;
-}
-
-/** Find predecessor CSI and return its type item.
- *
- * Looks for predecessor of CSI type @a src that matches @a dest.
- * The type maches if they use the same generic CSI definition, type
- * arguments are ignored. If found, returns the type arguments that
- * @a dest should have in order to be a true predecessor of @a src.
- *
- * @param stype		Static typing object
- * @param src		Source type
- * @param dest		Destination type
- * @return		Type matching @a dest with correct type arguments
- */
-tdata_item_t *stype_tobject_find_pred(stype_t *stype, tdata_item_t *src,
-    tdata_item_t *dest)
-{
-	stree_csi_t *src_csi;
-	tdata_tvv_t *tvv;
-	tdata_item_t *b_ti, *bs_ti;
-
-	list_node_t *pred_n;
-	stree_texpr_t *pred_te;
-
-	tdata_item_t *res_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Find CSI predecessor.\n");
-#endif
-	assert(src->tic == tic_tobject);
-	assert(dest->tic == tic_tobject);
-
-	if (src->u.tobject->csi == dest->u.tobject->csi)
-		return src;
-
-	src_csi = src->u.tobject->csi;
-	stype_titem_to_tvv(stype, src, &tvv);
-
-	res_ti = NULL;
-
-	switch (dest->u.tobject->csi->cc) {
-	case csi_class:
-		/* Destination is a class. Look at base class. */
-		pred_te = symbol_get_base_class_ref(stype->program,
-		    src_csi);
-		if (pred_te != NULL) {
-			run_texpr(stype->program, src_csi, pred_te,
-			    &b_ti);
-		} else if (src_csi->base_csi != NULL &&
-		    src->u.tobject->csi->cc == csi_class) {
-			/* No explicit reference. Use grandfather class. */
-			b_ti = tdata_item_new(tic_tobject);
-			b_ti->u.tobject = tdata_object_new();
-			b_ti->u.tobject->csi = src_csi->base_csi;
-			b_ti->u.tobject->static_ref = sn_nonstatic;
-
-			list_init(&b_ti->u.tobject->targs);
-		} else {
-			/* No match */
-			return NULL;
-		}
-
-		/* Substitute type variables to get predecessor type. */
-		tdata_item_subst(b_ti, tvv, &bs_ti);
-		assert(bs_ti->tic == tic_tobject);
-
-		/* Recurse to compute the rest of the path. */
-		res_ti = stype_tobject_find_pred(stype, bs_ti, dest);
-		if (b_ti->tic == tic_ignore) {
-			/* An error occured. */
-			return NULL;
-		}
-		break;
-	case csi_struct:
-		assert(b_false);
-		/* Fallthrough */
-	case csi_interface:
-		/*
-		 * Destination is an interface. Look at implemented
-		 * or accumulated interfaces.
-		 */
-		pred_n = list_first(&src_csi->inherit);
-		while (pred_n != NULL) {
-			pred_te = list_node_data(pred_n, stree_texpr_t *);
-			run_texpr(stype->program, src_csi, pred_te,
-			    &b_ti);
-
-			/* Substitute type variables to get predecessor type. */
-			tdata_item_subst(b_ti, tvv, &bs_ti);
-			assert(bs_ti->tic == tic_tobject);
-
-			/* Recurse to compute the rest of the path. */
-			res_ti = stype_tobject_find_pred(stype, bs_ti, dest);
-			if (res_ti != NULL)
-				break;
-
-			pred_n = list_next(&src_csi->inherit, pred_n);
-		}
-		break;
-	}
-
-	return res_ti;
-}
-
-/** Check whether type arguments of expression type and another type are equal.
- *
- * Compare type arguments of the type of @a expr and of type @a b_ti.
- * @a convc denotes the type of conversion for which we perform this check
- * (for sake of error reporting).
- *
- * If the type arguments are not equal a typing error and a conversion error
- * message is generated.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- * @param b_ti		b_tiination type
- * @return		EOK if equal, EINVAL if not.
- */
-errno_t stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
-    tdata_item_t *b_ti)
-{
-	list_node_t *arg_a_n, *arg_b_n;
-	tdata_item_t *arg_a, *arg_b;
-
-	(void) stype;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Check if type arguments match.\n");
-#endif
-	assert(a_ti->tic == tic_tobject);
-	assert(b_ti->tic == tic_tobject);
-
-	/*
-	 * Verify that type arguments match with those specified for
-	 * conversion b_tiination.
-	 */
-	arg_a_n = list_first(&a_ti->u.tobject->targs);
-	arg_b_n = list_first(&b_ti->u.tobject->targs);
-
-	while (arg_a_n != NULL && arg_b_n != NULL) {
-		arg_a = list_node_data(arg_a_n, tdata_item_t *);
-		arg_b = list_node_data(arg_b_n, tdata_item_t *);
-
-		if (tdata_item_equal(arg_a, arg_b) != b_true) {
-			/* Diferent argument type */
-			printf("Different argument type '");
-			tdata_item_print(arg_a);
-			printf("' vs. '");
-			tdata_item_print(arg_b);
-			printf("'.\n");
-			return EINVAL;
-		}
-
-		arg_a_n = list_next(&a_ti->u.tobject->targs, arg_a_n);
-		arg_b_n = list_next(&b_ti->u.tobject->targs, arg_b_n);
-	}
-
-	if (arg_a_n != NULL || arg_b_n != NULL) {
-		/* Diferent number of arguments */
-		printf("Different number of arguments.\n");
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-/** Determine if two type signatures are equal.
- *
- * XXX This does not compare the attributes, which are missing from
- * @c tdata_fun_sig_t.
- *
- * @param stype		Static typing object
- * @param asig		First function signature type
- * @param bsig		Second function signature type
- */
-static bool_t stype_fun_sig_equal(stype_t *stype, tdata_fun_sig_t *asig,
-    tdata_fun_sig_t *bsig)
-{
-	list_node_t *aarg_n, *barg_n;
-	tdata_item_t *aarg_ti, *barg_ti;
-
-	(void) stype;
-
-	/* Compare types of arguments */
-	aarg_n = list_first(&asig->arg_ti);
-	barg_n = list_first(&bsig->arg_ti);
-
-	while (aarg_n != NULL && barg_n != NULL) {
-		aarg_ti = list_node_data(aarg_n, tdata_item_t *);
-		barg_ti = list_node_data(barg_n, tdata_item_t *);
-
-		if (!tdata_item_equal(aarg_ti, barg_ti))
-			return b_false;
-
-		aarg_n = list_next(&asig->arg_ti, aarg_n);
-		barg_n = list_next(&bsig->arg_ti, barg_n);
-	}
-
-	if (aarg_n != NULL || barg_n != NULL)
-		return b_false;
-
-	/* Compare variadic argument */
-
-	if (asig->varg_ti != NULL || bsig->varg_ti != NULL) {
-		if (asig->varg_ti == NULL ||
-		    bsig->varg_ti == NULL) {
-			return b_false;
-		}
-
-		if (!tdata_item_equal(asig->varg_ti, bsig->varg_ti)) {
-			return b_false;
-		}
-	}
-
-	/* Compare return type */
-
-	if (asig->rtype != NULL || bsig->rtype != NULL) {
-		if (asig->rtype == NULL ||
-		    bsig->rtype == NULL) {
-			return b_false;
-		}
-
-		if (!tdata_item_equal(asig->rtype, bsig->rtype)) {
-			return b_false;
-		}
-	}
-
-	return b_true;
-}
-
-/** Get function signature from delegate.
- *
- * Function signature can be missing if the delegate type is incomplete.
- * This is used to break circular dependency when typing delegates.
- * If this happens, we type the delegate, which gives us the signature.
- */
-tdata_fun_sig_t *stype_deleg_get_sig(stype_t *stype, tdata_deleg_t *tdeleg)
-{
-	if (tdeleg->tsig == NULL)
-		stype_deleg(stype, tdeleg->deleg);
-
-	/* Now we should have a signature. */
-	assert(tdeleg->tsig != NULL);
-	return tdeleg->tsig;
-}
-
-/** Convert tic_tobject type item to TVV,
- *
- * We split generic type application into two steps. In the first step
- * we match argument names of @a ti->csi to argument values in @a ti
- * to produce a TVV (name to value map for type arguments). That is the
- * purpose of this function.
- *
- * In the second step we substitute variables in another type item
- * with their values using the TVV. This is performed by tdata_item_subst().
- *
- * @param stype		Static typing object.
- * @param ti		Type item of class tic_tobject.
- * @param rtvv		Place to store pointer to new TVV.
- */
-void stype_titem_to_tvv(stype_t *stype, tdata_item_t *ti, tdata_tvv_t **rtvv)
-{
-	tdata_tvv_t *tvv;
-	stree_csi_t *csi;
-
-	list_node_t *formal_n;
-	list_node_t *real_n;
-
-	stree_targ_t *formal_arg;
-	tdata_item_t *real_arg;
-
-	assert(ti->tic == tic_tobject);
-
-	tvv = tdata_tvv_new();
-	intmap_init(&tvv->tvv);
-
-	csi = ti->u.tobject->csi;
-	formal_n = list_first(&csi->targ);
-	real_n = list_first(&ti->u.tobject->targs);
-
-	while (formal_n != NULL && real_n != NULL) {
-		formal_arg = list_node_data(formal_n, stree_targ_t *);
-		real_arg = list_node_data(real_n, tdata_item_t *);
-
-		/* Store argument value into valuation. */
-		tdata_tvv_set_val(tvv, formal_arg->name->sid, real_arg);
-
-		formal_n = list_next(&csi->targ, formal_n);
-		real_n = list_next(&ti->u.tobject->targs, real_n);
-	}
-
-	if (formal_n != NULL || real_n != NULL) {
-		printf("Error: Incorrect number of type arguments.\n");
-		stype_note_error(stype);
-
-		/* Fill missing arguments with recovery type items. */
-		while (formal_n != NULL) {
-			formal_arg = list_node_data(formal_n, stree_targ_t *);
-			/* Store recovery value into valuation. */
-			tdata_tvv_set_val(tvv, formal_arg->name->sid,
-			    stype_recovery_titem(stype));
-
-			formal_n = list_next(&csi->targ, formal_n);
-		}
-	}
-
-	*rtvv = tvv;
-}
-
-/** Return a boolean type item.
- *
- * @param stype		Static typing object
- * @return		New boolean type item.
- */
-tdata_item_t *stype_boolean_titem(stype_t *stype)
-{
-	tdata_item_t *titem;
-	tdata_primitive_t *tprimitive;
-
-	(void) stype;
-
-	titem = tdata_item_new(tic_tprimitive);
-	tprimitive = tdata_primitive_new(tpc_bool);
-	titem->u.tprimitive = tprimitive;
-
-	return titem;
-}
-
-/** Find a local variable in the current function.
- *
- * @param stype		Static typing object
- * @param name		Name of variable (SID).
- * @return		Pointer to variable declaration or @c NULL if not
- *			found.
- */
-stree_vdecl_t *stype_local_vars_lookup(stype_t *stype, sid_t name)
-{
-	stype_proc_vr_t *proc_vr;
-	stype_block_vr_t *block_vr;
-	stree_vdecl_t *vdecl;
-	list_node_t *node;
-
-	proc_vr = stype->proc_vr;
-	node = list_last(&proc_vr->block_vr);
-
-	/* Walk through all block visit records. */
-	while (node != NULL) {
-		block_vr = list_node_data(node, stype_block_vr_t *);
-		vdecl = intmap_get(&block_vr->vdecls, name);
-		if (vdecl != NULL)
-			return vdecl;
-
-		node = list_prev(&proc_vr->block_vr, node);
-	}
-
-	/* No match */
-	return NULL;
-}
-
-/** Find argument of the current procedure.
- *
- * @param stype		Static typing object
- * @param name		Name of argument (SID).
- * @return		Pointer to argument declaration or @c NULL if not
- *			found.
- */
-stree_proc_arg_t *stype_proc_args_lookup(stype_t *stype, sid_t name)
-{
-	stype_proc_vr_t *proc_vr;
-
-	stree_symbol_t *outer_sym;
-	stree_ctor_t *ctor;
-	stree_fun_t *fun;
-	stree_prop_t *prop;
-
-	list_t *args;
-	list_node_t *arg_node;
-	stree_proc_arg_t *varg;
-	stree_proc_arg_t *arg;
-	stree_proc_arg_t *setter_arg;
-
-	proc_vr = stype->proc_vr;
-	outer_sym = proc_vr->proc->outer_symbol;
-
-	setter_arg = NULL;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Look for argument named '%s'.\n", strtab_get_str(name));
-#endif
-
-	/* Make compiler happy. */
-	args = NULL;
-	varg = NULL;
-
-	switch (outer_sym->sc) {
-	case sc_ctor:
-		ctor = symbol_to_ctor(outer_sym);
-		assert(ctor != NULL);
-		args = &ctor->sig->args;
-		varg = ctor->sig->varg;
-		break;
-	case sc_fun:
-		fun = symbol_to_fun(outer_sym);
-		assert(fun != NULL);
-		args = &fun->sig->args;
-		varg = fun->sig->varg;
-		break;
-	case sc_prop:
-		prop = symbol_to_prop(outer_sym);
-		assert(prop != NULL);
-		args = &prop->args;
-		varg = prop->varg;
-
-		/* If we are in a setter, look also at setter argument. */
-		if (prop->setter == proc_vr->proc)
-			setter_arg = prop->setter_arg;
-		break;
-	case sc_csi:
-	case sc_deleg:
-	case sc_enum:
-	case sc_var:
-		assert(b_false);
-	}
-
-	arg_node = list_first(args);
-	while (arg_node != NULL) {
-		arg = list_node_data(arg_node, stree_proc_arg_t *);
-		if (arg->name->sid == name) {
-			/* Match */
-#ifdef DEBUG_TYPE_TRACE
-			printf("Found argument.\n");
-#endif
-			return arg;
-		}
-
-		arg_node = list_next(args, arg_node);
-	}
-
-	/* Variadic argument */
-	if (varg != NULL && varg->name->sid == name) {
-#ifdef DEBUG_TYPE_TRACE
-		printf("Found variadic argument.\n");
-#endif
-		return varg;
-	}
-
-	/* Setter argument */
-	if (setter_arg != NULL && setter_arg->name->sid == name) {
-#ifdef DEBUG_TYPE_TRACE
-		printf("Found setter argument.\n");
-#endif
-		return setter_arg;
-
-	}
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Not found.\n");
-#endif
-	/* No match */
-	return NULL;
-}
-
-/** Note a static typing error that has been immediately recovered.
- *
- * @param stype		Static typing object
- */
-void stype_note_error(stype_t *stype)
-{
-	stype->error = b_true;
-}
-
-/** Construct a special type item for recovery.
- *
- * The recovery item is propagated towards the expression root and causes
- * any further typing errors in the expression to be supressed.
- *
- * @param stype		Static typing object
- */
-tdata_item_t *stype_recovery_titem(stype_t *stype)
-{
-	tdata_item_t *titem;
-
-	(void) stype;
-
-	titem = tdata_item_new(tic_ignore);
-	return titem;
-}
-
-/** Get current block visit record.
- *
- * @param stype		Static typing object
- */
-stype_block_vr_t *stype_get_current_block_vr(stype_t *stype)
-{
-	list_node_t *node;
-
-	node = list_last(&stype->proc_vr->block_vr);
-	return list_node_data(node, stype_block_vr_t *);
-}
-
-/** Allocate new procedure visit record.
- *
- * @return	New procedure VR
- */
-stype_proc_vr_t *stype_proc_vr_new(void)
-{
-	stype_proc_vr_t *proc_vr;
-
-	proc_vr = calloc(1, sizeof(stype_proc_vr_t));
-	if (proc_vr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return proc_vr;
-}
-
-/** Allocate new block visit record.
- *
- * @return	New block VR
- */
-stype_block_vr_t *stype_block_vr_new(void)
-{
-	stype_block_vr_t *block_vr;
-
-	block_vr = calloc(1, sizeof(stype_block_vr_t));
-	if (block_vr == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return block_vr;
-}
Index: pace/app/sbi/src/stype.h
===================================================================
--- uspace/app/sbi/src/stype.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STYPE_H_
-#define STYPE_H_
-
-#include "mytypes.h"
-
-void stype_module(stype_t *stype, stree_module_t *module);
-void stype_ctor_header(stype_t *stype, stree_ctor_t *ctor);
-void stype_deleg(stype_t *stype, stree_deleg_t *deleg);
-void stype_enum(stype_t *stype, stree_enum_t *enum_d);
-void stype_fun_header(stype_t *stype, stree_fun_t *fun);
-void stype_prop_header(stype_t *stype, stree_prop_t *prop);
-void stype_stat(stype_t *stype, stree_stat_t *stat, bool_t want_value);
-
-void stype_note_error(stype_t *stype);
-tdata_item_t *stype_recovery_titem(stype_t *stype);
-
-stree_expr_t *stype_convert(stype_t *stype, stree_expr_t *expr,
-    tdata_item_t *dest);
-void stype_convert_failure(stype_t *stype, stype_conv_class_t convc,
-    stree_expr_t *expr, tdata_item_t *dest);
-stree_expr_t *stype_box_expr(stype_t *stype, stree_expr_t *expr);
-tdata_item_t *stype_tobject_find_pred(stype_t *stype, tdata_item_t *src,
-    tdata_item_t *dest);
-errno_t stype_targs_check_equal(stype_t *stype, tdata_item_t *a_ti,
-    tdata_item_t *b_ti);
-
-tdata_fun_sig_t *stype_deleg_get_sig(stype_t *stype, tdata_deleg_t *tdeleg);
-
-void stype_titem_to_tvv(stype_t *stype, tdata_item_t *ti, tdata_tvv_t **rtvv);
-
-tdata_item_t *stype_boolean_titem(stype_t *stype);
-
-stree_vdecl_t *stype_local_vars_lookup(stype_t *stype, sid_t name);
-stree_proc_arg_t *stype_proc_args_lookup(stype_t *stype, sid_t name);
-stype_block_vr_t *stype_get_current_block_vr(stype_t *stype);
-
-stype_proc_vr_t *stype_proc_vr_new(void);
-stype_block_vr_t *stype_block_vr_new(void);
-
-#endif
Index: pace/app/sbi/src/stype_expr.c
===================================================================
--- uspace/app/sbi/src/stype_expr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1874 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Typing of expressions.
- *
- * This module types (data) expressions -- not to be confused with evaluating
- * type expressions! Thus the type of each (sub-)expression is determined
- * and stored in its @c titem field.
- *
- * It can also happen that, due to implicit conversions, the expression
- * needs to be patched to insert these conversions.
- *
- * If a type error occurs within an expression, @c stype->error is set
- * and the type of the expression will be @c tic_ignore. This type item
- * is propagated upwards and causes further typing errors to be ignored
- * (this prevents a type error avalanche). Type checking is thus resumed
- * at the next expression.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "cspan.h"
-#include "debug.h"
-#include "list.h"
-#include "mytypes.h"
-#include "run_texpr.h"
-#include "stree.h"
-#include "strtab.h"
-#include "stype.h"
-#include "symbol.h"
-#include "tdata.h"
-
-#include "stype_expr.h"
-
-static void stype_nameref(stype_t *stype, stree_nameref_t *nameref,
-    tdata_item_t **rtitem);
-static void stype_literal(stype_t *stype, stree_literal_t *literal,
-    tdata_item_t **rtitem);
-static void stype_self_ref(stype_t *stype, stree_self_ref_t *self_ref,
-    tdata_item_t **rtitem);
-
-static void stype_binop(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-
-static void stype_binop_tprimitive(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem);
-static void stype_binop_bool(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-static void stype_binop_char(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-static void stype_binop_int(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-static void stype_binop_nil(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-static void stype_binop_string(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-static void stype_binop_resource(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem);
-
-static void stype_binop_tobject(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem);
-static void stype_binop_tenum(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem);
-static void stype_binop_tvref(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem);
-
-static void stype_unop(stype_t *stype, stree_unop_t *unop,
-    tdata_item_t **rtitem);
-static void stype_unop_tprimitive(stype_t *stype, stree_unop_t *unop,
-    tdata_item_t *ta, tdata_item_t **rtitem);
-static void stype_new(stype_t *stype, stree_new_t *new,
-    tdata_item_t **rtitem);
-static void stype_new_object(stype_t *stype, stree_new_t *new_op,
-    tdata_item_t *obj_ti);
-
-static void stype_access(stype_t *stype, stree_access_t *access,
-    tdata_item_t **rtitem);
-static void stype_access_tprimitive(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem);
-static void stype_access_tobject(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem);
-static void stype_access_tarray(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem);
-static void stype_access_tebase(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem);
-
-static void stype_call(stype_t *stype, stree_call_t *call,
-    tdata_item_t **rtitem);
-static void stype_call_args(stype_t *stype, cspan_t *cspan, list_t *farg_tis,
-    tdata_item_t *fvarg_ti, list_t *args);
-
-static void stype_index(stype_t *stype, stree_index_t *index,
-    tdata_item_t **rtitem);
-static void stype_index_tprimitive(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem);
-static void stype_index_tobject(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem);
-static void stype_index_tarray(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem);
-
-static void stype_assign(stype_t *stype, stree_assign_t *assign,
-    tdata_item_t **rtitem);
-static void stype_as(stype_t *stype, stree_as_t *as_op, tdata_item_t **rtitem);
-static void stype_box(stype_t *stype, stree_box_t *box, tdata_item_t **rtitem);
-
-/** Type expression
- *
- * The type is stored in @a expr->titem. If the express contains a type error,
- * @a stype->error will be set when this function returns.
- *
- * @param stype		Static typing object
- * @param expr		Expression
- */
-void stype_expr(stype_t *stype, stree_expr_t *expr)
-{
-	tdata_item_t *et;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(expr->cspan);
-	printf(" Type expression.\n");
-#endif
-	/* Silence warning. */
-	et = NULL;
-
-	switch (expr->ec) {
-	case ec_nameref:
-		stype_nameref(stype, expr->u.nameref, &et);
-		break;
-	case ec_literal:
-		stype_literal(stype, expr->u.literal, &et);
-		break;
-	case ec_self_ref:
-		stype_self_ref(stype, expr->u.self_ref, &et);
-		break;
-	case ec_binop:
-		stype_binop(stype, expr->u.binop, &et);
-		break;
-	case ec_unop:
-		stype_unop(stype, expr->u.unop, &et);
-		break;
-	case ec_new:
-		stype_new(stype, expr->u.new_op, &et);
-		break;
-	case ec_access:
-		stype_access(stype, expr->u.access, &et);
-		break;
-	case ec_call:
-		stype_call(stype, expr->u.call, &et);
-		break;
-	case ec_index:
-		stype_index(stype, expr->u.index, &et);
-		break;
-	case ec_assign:
-		stype_assign(stype, expr->u.assign, &et);
-		break;
-	case ec_as:
-		stype_as(stype, expr->u.as_op, &et);
-		break;
-	case ec_box:
-		stype_box(stype, expr->u.box, &et);
-		break;
-	}
-
-	expr->titem = et;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(expr->cspan);
-	printf(" Expression type is '");
-	tdata_item_print(et);
-	printf("'.\n");
-#endif
-}
-
-/** Type name reference.
- *
- * @param stype		Static typing object
- * @param nameref	Name reference
- * @param rtitem	Place to store result type
- */
-static void stype_nameref(stype_t *stype, stree_nameref_t *nameref,
-    tdata_item_t **rtitem)
-{
-	stree_symbol_t *sym;
-	stree_vdecl_t *vdecl;
-	stree_proc_arg_t *proc_arg;
-	tdata_item_t *titem;
-	tdata_object_t *tobject;
-	stree_csi_t *csi;
-	stree_deleg_t *deleg;
-	stree_enum_t *enum_d;
-	tdata_ebase_t *tebase;
-	stree_fun_t *fun;
-	bool_t static_ctx;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(nameref->expr->cspan);
-	printf(" Evaluate type of name reference '%s'.\n",
-	    strtab_get_str(nameref->name->sid));
-#endif
-	/*
-	 * Look for a local variable declaration.
-	 */
-
-	vdecl = stype_local_vars_lookup(stype, nameref->name->sid);
-	if (vdecl != NULL) {
-		/* Found a local variable declaration. */
-#ifdef DEBUG_RUN_TRACE
-		printf("Found local variable declaration.\n");
-#endif
-		run_texpr(stype->program, stype->current_csi, vdecl->type,
-		    &titem);
-		*rtitem = titem;
-		return;
-	}
-
-	/*
-	 * Look for a procedure argument.
-	 */
-
-	proc_arg = stype_proc_args_lookup(stype, nameref->name->sid);
-	if (proc_arg != NULL) {
-		/* Found a procedure argument. */
-#ifdef DEBUG_RUN_TRACE
-		printf("Found procedure argument.\n");
-#endif
-		run_texpr(stype->program, stype->current_csi, proc_arg->type,
-		    &titem);
-		*rtitem = titem;
-		return;
-	}
-
-	/*
-	 * Look for a class-wide or global symbol.
-	 */
-
-	sym = symbol_lookup_in_csi(stype->program, stype->current_csi,
-	    nameref->name);
-
-	if (sym == NULL) {
-		/* Not found. */
-		if (stype->current_csi != NULL) {
-			cspan_print(nameref->expr->cspan);
-			printf(" Error: Symbol '%s' not found in '",
-			    strtab_get_str(nameref->name->sid));
-			symbol_print_fqn(csi_to_symbol(stype->current_csi));
-			printf("'.\n");
-		} else {
-			cspan_print(nameref->expr->cspan);
-			printf(" Error: Symbol '%s' not found.\n",
-			    strtab_get_str(nameref->name->sid));
-		}
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Determine if current procedure is static. */
-	static_ctx = stree_symbol_is_static(stype->proc_vr->proc->outer_symbol);
-
-	/*
-	 * If the symbol is not found in current CSI, then we access it
-	 * in a static context. (Context of current object cannot be used.)
-	 */
-	if (sym->outer_csi != stype->current_csi)
-		static_ctx = b_true;
-
-	/* Check for referencing non-static symbol in static context. */
-	if (static_ctx && !stree_symbol_is_static(sym)) {
-		cspan_print(nameref->expr->cspan);
-		printf(" Error: Referencing non-static symbol '");
-		symbol_print_fqn(sym);
-		printf("' in static context.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Referencing static member in non-static context is allowed. */
-
-	/* Make compiler happy. */
-	titem = NULL;
-
-	switch (sym->sc) {
-	case sc_var:
-		run_texpr(stype->program, stype->current_csi,
-		    sym->u.var->type, &titem);
-		break;
-	case sc_prop:
-		/* Type property header if it has not been typed yet. */
-		stype_prop_header(stype, sym->u.prop);
-		titem = sym->u.prop->titem;
-		break;
-	case sc_csi:
-		csi = symbol_to_csi(sym);
-		assert(csi != NULL);
-
-		titem = tdata_item_new(tic_tobject);
-		tobject = tdata_object_new();
-		titem->u.tobject = tobject;
-
-		tobject->static_ref = sn_static;
-		tobject->csi = csi;
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		deleg = symbol_to_deleg(sym);
-		assert(deleg != NULL);
-		/* Type delegate if it has not been typed yet. */
-		stype_deleg(stype, deleg);
-		titem = deleg->titem;
-		break;
-	case sc_enum:
-		enum_d = symbol_to_enum(sym);
-		assert(enum_d != NULL);
-
-		titem = tdata_item_new(tic_tebase);
-		tebase = tdata_ebase_new();
-		titem->u.tebase = tebase;
-
-		/* This is an enum base reference. */
-		tebase->enum_d = enum_d;
-		break;
-	case sc_fun:
-		fun = symbol_to_fun(sym);
-		assert(fun != NULL);
-		/* Type function header if it has not been typed yet. */
-		stype_fun_header(stype, fun);
-		titem = fun->titem;
-		break;
-	}
-
-	*rtitem = titem;
-}
-
-/** Type a literal.
- *
- * @param stype		Static typing object
- * @param literal	Literal
- * @param rtitem	Place to store result type
- */
-static void stype_literal(stype_t *stype, stree_literal_t *literal,
-    tdata_item_t **rtitem)
-{
-	tdata_item_t *titem;
-	tdata_primitive_t *tprimitive;
-	tprimitive_class_t tpc;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(literal->expr->cspan);
-	printf(" Evaluate type of literal.\n");
-#endif
-	(void) stype;
-
-	/* Make compiler happy. */
-	tpc = 0;
-
-	switch (literal->ltc) {
-	case ltc_bool:
-		tpc = tpc_bool;
-		break;
-	case ltc_char:
-		tpc = tpc_char;
-		break;
-	case ltc_int:
-		tpc = tpc_int;
-		break;
-	case ltc_ref:
-		tpc = tpc_nil;
-		break;
-	case ltc_string:
-		tpc = tpc_string;
-		break;
-	}
-
-	titem = tdata_item_new(tic_tprimitive);
-	tprimitive = tdata_primitive_new(tpc);
-	titem->u.tprimitive = tprimitive;
-
-	*rtitem = titem;
-}
-
-/** Type @c self reference.
- *
- * @param stype		Static typing object
- * @param self_ref	@c self reference
- * @param rtitem	Place to store result type
- */
-static void stype_self_ref(stype_t *stype, stree_self_ref_t *self_ref,
-    tdata_item_t **rtitem)
-{
-	stree_csi_t *cur_csi;
-	tdata_item_t *titem;
-	tdata_object_t *tobject;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(self_ref->expr->cspan);
-	printf(" Evaluate type of self reference.\n");
-#endif
-	(void) stype;
-	(void) self_ref;
-
-	cur_csi = stype->proc_vr->proc->outer_symbol->outer_csi;
-
-	/* No global symbols should have procedures. */
-	assert(cur_csi != NULL);
-
-	/* Construct type item. */
-	titem = tdata_item_new(tic_tobject);
-	tobject = tdata_object_new();
-	titem->u.tobject = tobject;
-
-	tobject->static_ref = sn_nonstatic;
-	tobject->csi = cur_csi;
-	list_init(&tobject->targs);
-
-	*rtitem = titem;
-}
-
-/** Type a binary operation.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	bool_t equal;
-	tdata_item_t *titem1, *titem2;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(binop->expr->cspan);
-	printf(" Evaluate type of binary operation.\n");
-#endif
-	stype_expr(stype, binop->arg1);
-	stype_expr(stype, binop->arg2);
-
-	titem1 = binop->arg1->titem;
-	titem2 = binop->arg2->titem;
-
-	if (titem1 == NULL) {
-		cspan_print(binop->arg1->cspan);
-		printf(" Error: Binary operand has no value.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	if (titem2 == NULL) {
-		cspan_print(binop->arg2->cspan);
-		printf(" Error: Binary operand has no value.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	if (titem1->tic == tic_ignore || titem2->tic == tic_ignore) {
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	equal = tdata_item_equal(titem1, titem2);
-	if (equal != b_true) {
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation arguments "
-		    "have different types ('");
-		tdata_item_print(titem1);
-		printf("' and '");
-		tdata_item_print(titem2);
-		printf("').\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	switch (titem1->tic) {
-	case tic_tprimitive:
-		stype_binop_tprimitive(stype, binop, titem1, titem2, rtitem);
-		break;
-	case tic_tobject:
-		stype_binop_tobject(stype, binop, titem1, titem2, rtitem);
-		break;
-	case tic_tenum:
-		stype_binop_tenum(stype, binop, titem1, titem2, rtitem);
-		break;
-	case tic_tvref:
-		stype_binop_tvref(stype, binop, titem1, titem2, rtitem);
-		break;
-	default:
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation on value which is not of a "
-		    "supported type (found '");
-		tdata_item_print(titem1);
-		printf("').\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	}
-
-}
-
-/** Type a binary operation with arguments of primitive type.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param ta		Type of first argument
- * @param tb		Type of second argument
- * @param rtitem	Place to store result type
- */
-static void stype_binop_tprimitive(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem)
-{
-	assert(ta->tic == tic_tprimitive);
-	assert(tb->tic == tic_tprimitive);
-
-	switch (ta->u.tprimitive->tpc) {
-	case tpc_bool:
-		stype_binop_bool(stype, binop, rtitem);
-		break;
-	case tpc_char:
-		stype_binop_char(stype, binop, rtitem);
-		break;
-	case tpc_int:
-		stype_binop_int(stype, binop, rtitem);
-		break;
-	case tpc_nil:
-		stype_binop_nil(stype, binop, rtitem);
-		break;
-	case tpc_string:
-		stype_binop_string(stype, binop, rtitem);
-		break;
-	case tpc_resource:
-		stype_binop_resource(stype, binop, rtitem);
-		break;
-	}
-}
-
-/** Type a binary operation with @c bool arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_bool(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	/* Make compiler happy. */
-	rtpc = 0;
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-	case bo_lt:
-	case bo_gt:
-	case bo_lt_equal:
-	case bo_gt_equal:
-		/* Comparison -> boolean type */
-		rtpc = tpc_bool;
-		break;
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-		/* Arithmetic -> error */
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on booleans.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	case bo_and:
-	case bo_or:
-		/* Boolean -> boolean type */
-		rtpc = tpc_bool;
-		break;
-	}
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with @c char arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_char(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	(void) stype;
-
-	/* Make compiler happy. */
-	rtpc = 0;
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-	case bo_lt:
-	case bo_gt:
-	case bo_lt_equal:
-	case bo_gt_equal:
-		/* Comparison -> boolean type */
-		rtpc = tpc_bool;
-		break;
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-	case bo_and:
-	case bo_or:
-		/* Arithmetic, boolean -> error */
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on characters.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		rtpc = tpc_char;
-		break;
-	}
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with @c int arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_int(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	(void) stype;
-
-	/* Make compiler happy. */
-	rtpc = 0;
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-	case bo_lt:
-	case bo_gt:
-	case bo_lt_equal:
-	case bo_gt_equal:
-		/* Comparison -> boolean type */
-		rtpc = tpc_bool;
-		break;
-	case bo_plus:
-	case bo_minus:
-	case bo_mult:
-		/* Arithmetic -> int type */
-		rtpc = tpc_int;
-		break;
-	case bo_and:
-	case bo_or:
-		/* Boolean -> error */
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on integers.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		rtpc = tpc_char;
-		break;
-	}
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with @c nil arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_nil(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	(void) binop;
-
-	cspan_print(binop->expr->cspan);
-	printf(" Unimplemented: Binary operation on nil.\n");
-	stype_note_error(stype);
-	*rtitem = stype_recovery_titem(stype);
-}
-
-/** Type a binary operation with @c string arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_string(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	/* Make compiler happy. */
-	rtpc = 0;
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-		/* Comparison -> boolean type */
-		rtpc = tpc_bool;
-		break;
-	case bo_plus:
-		/* Concatenation -> string type */
-		rtpc = tpc_string;
-		break;
-
-	case bo_lt:
-	case bo_gt:
-	case bo_lt_equal:
-	case bo_gt_equal:
-
-	case bo_minus:
-	case bo_mult:
-	case bo_and:
-	case bo_or:
-		/* Ordering, arithmetic, boolean -> error */
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on strings.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		rtpc = tpc_char;
-		break;
-	}
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with resource arguments.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param rtitem	Place to store result type
- */
-static void stype_binop_resource(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	(void) binop;
-
-	cspan_print(binop->expr->cspan);
-	printf(" Error: Cannot apply operator to resource type.\n");
-	stype_note_error(stype);
-	rtpc = tpc_resource;
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with arguments of an object type.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param ta		Type of first argument
- * @param tb		Type of second argument
- * @param rtitem	Place to store result type
- */
-static void stype_binop_tobject(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem)
-{
-	tdata_item_t *res_ti;
-
-	(void) stype;
-
-	assert(ta->tic == tic_tobject || (ta->tic == tic_tprimitive &&
-	    ta->u.tprimitive->tpc == tpc_nil));
-	assert(tb->tic == tic_tobject || (tb->tic == tic_tprimitive &&
-	    tb->u.tprimitive->tpc == tpc_nil));
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-		/* Comparing objects -> boolean type */
-		res_ti = stype_boolean_titem(stype);
-		break;
-	default:
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on objects.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with arguments of an enum type.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param ta		Type of first argument
- * @param tb		Type of second argument
- * @param rtitem	Place to store result type
- */
-static void stype_binop_tenum(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem)
-{
-	tdata_item_t *res_ti;
-
-	assert(ta->tic == tic_tenum);
-	assert(tb->tic == tic_tenum);
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-		/* Comparison -> boolean type */
-		res_ti = stype_boolean_titem(stype);
-		break;
-	default:
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on values of enum "
-		    "type.\n", binop->bc);
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	*rtitem = res_ti;
-}
-
-/** Type a binary operation with arguments of a variable type.
- *
- * @param stype		Static typing object
- * @param binop		Binary operation
- * @param ta		Type of first argument
- * @param tb		Type of second argument
- * @param rtitem	Place to store result type
- */
-static void stype_binop_tvref(stype_t *stype, stree_binop_t *binop,
-    tdata_item_t *ta, tdata_item_t *tb, tdata_item_t **rtitem)
-{
-	tdata_item_t *res_ti;
-
-	assert(ta->tic == tic_tvref || (ta->tic == tic_tprimitive &&
-	    ta->u.tprimitive->tpc == tpc_nil));
-	assert(tb->tic == tic_tvref || (tb->tic == tic_tprimitive &&
-	    tb->u.tprimitive->tpc == tpc_nil));
-
-	switch (binop->bc) {
-	case bo_equal:
-	case bo_notequal:
-		/* Comparison -> boolean type */
-		res_ti = stype_boolean_titem(stype);
-		break;
-	default:
-		cspan_print(binop->expr->cspan);
-		printf(" Error: Binary operation (%d) on variable types.\n",
-		    binop->bc);
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	*rtitem = res_ti;
-}
-
-/** Type a unary operation.
- *
- * @param stype		Static typing object
- * @param unop		Unary operation
- * @param rtitem	Place to store result type
- */
-static void stype_unop(stype_t *stype, stree_unop_t *unop,
-    tdata_item_t **rtitem)
-{
-	tdata_item_t *titem;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(unop->expr->cspan);
-	printf(" Evaluate type of unary operation.\n");
-#endif
-	stype_expr(stype, unop->arg);
-
-	titem = unop->arg->titem;
-	if (titem == NULL) {
-		cspan_print(unop->arg->cspan);
-		printf(" Error: Argument of unary operation has no value.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	if (titem->tic == tic_ignore) {
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	switch (titem->tic) {
-	case tic_tprimitive:
-		stype_unop_tprimitive(stype, unop, titem, rtitem);
-		break;
-	default:
-		cspan_print(unop->arg->cspan);
-		printf(" Error: Unary operation on value which is not of a "
-		    "supported type (found '");
-		tdata_item_print(titem);
-		printf("').\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	}
-}
-
-/** Type a binary operation arguments of primitive type.
- *
- * @param stype		Static typing object
- * @param unop		Binary operation
- * @param ta		Type of argument
- * @param rtitem	Place to store result type
- */
-static void stype_unop_tprimitive(stype_t *stype, stree_unop_t *unop,
-    tdata_item_t *ta, tdata_item_t **rtitem)
-{
-	tprimitive_class_t rtpc;
-	tdata_item_t *res_ti;
-
-	(void) stype;
-	(void) unop;
-
-	assert(ta->tic == tic_tprimitive);
-
-	switch (ta->u.tprimitive->tpc) {
-	case tpc_bool:
-		rtpc = tpc_bool;
-		break;
-	case tpc_int:
-		rtpc = tpc_int;
-		break;
-	default:
-		cspan_print(unop->arg->cspan);
-		printf(" Error: Unary operator applied on unsupported "
-		    "primitive type %d.\n", ta->u.tprimitive->tpc);
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	res_ti = tdata_item_new(tic_tprimitive);
-	res_ti->u.tprimitive = tdata_primitive_new(rtpc);
-
-	*rtitem = res_ti;
-}
-
-/** Type a @c new operation.
- *
- * @param stype		Static typing object
- * @param new_op	@c new operation
- * @param rtitem	Place to store result type
- */
-static void stype_new(stype_t *stype, stree_new_t *new_op,
-    tdata_item_t **rtitem)
-{
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(new_op->expr->cspan);
-	printf("Evaluate type of 'new' operation.\n");
-#endif
-	/*
-	 * Type of @c new expression is exactly the type supplied as parameter
-	 * to the @c new operator.
-	 */
-	run_texpr(stype->program, stype->current_csi, new_op->texpr, rtitem);
-
-	if ((*rtitem)->tic == tic_ignore) {
-		/* An error occured when evaluating the type expression. */
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	if ((*rtitem)->tic == tic_tobject)
-		stype_new_object(stype, new_op, *rtitem);
-}
-
-/** Type a new object operation arguments.
- *
- * @param stype		Static typing object
- * @param new_op	@c new operation
- */
-static void stype_new_object(stype_t *stype, stree_new_t *new_op,
-    tdata_item_t *obj_ti)
-{
-	stree_csi_t *csi;
-	stree_ctor_t *ctor;
-	stree_symbol_t *ctor_sym;
-	stree_ident_t *ctor_ident;
-	tdata_fun_sig_t *tsig;
-	tdata_tvv_t *obj_tvv;
-	tdata_item_t *ctor_sti;
-
-	assert(obj_ti->tic == tic_tobject);
-	csi = obj_ti->u.tobject->csi;
-
-	if (csi->cc == csi_interface) {
-		cspan_print(new_op->expr->cspan);
-		printf(" Error: Cannot instantiate an interface.\n");
-		stype_note_error(stype);
-		return;
-	}
-
-	ctor_ident = stree_ident_new();
-	ctor_ident->sid = strtab_get_sid(CTOR_IDENT);
-
-	/* Find constructor. */
-	ctor_sym = symbol_search_csi_no_base(stype->program, csi,
-	    ctor_ident);
-
-	if (ctor_sym == NULL && !list_is_empty(&new_op->ctor_args)) {
-		cspan_print(new_op->expr->cspan);
-		printf(" Error: Passing arguments to 'new' but no "
-		    "constructor found.\n");
-		stype_note_error(stype);
-		return;
-	}
-
-	if (ctor_sym == NULL)
-		return;
-
-	ctor = symbol_to_ctor(ctor_sym);
-	assert(ctor != NULL);
-
-	/* Type constructor header if it has not been typed yet. */
-	stype_ctor_header(stype, ctor);
-	if (ctor->titem->tic == tic_ignore)
-		return;
-
-	/* Substitute type arguments in constructor type. */
-	stype_titem_to_tvv(stype, obj_ti, &obj_tvv);
-	tdata_item_subst(ctor->titem, obj_tvv, &ctor_sti);
-	/* XXX Free obj_tvv */
-
-	assert(ctor_sti->tic == tic_tfun);
-	tsig = ctor_sti->u.tfun->tsig;
-
-	stype_call_args(stype, new_op->expr->cspan, &tsig->arg_ti,
-	    tsig->varg_ti, &new_op->ctor_args);
-}
-
-/** Type a member access operation.
- *
- * @param stype		Static typing object
- * @param access	Member access operation
- * @param rtitem	Place to store result type
- */
-static void stype_access(stype_t *stype, stree_access_t *access,
-    tdata_item_t **rtitem)
-{
-	tdata_item_t *arg_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(access->expr->cspan);
-	printf(" Evaluate type of access operation.\n");
-#endif
-	stype_expr(stype, access->arg);
-	arg_ti = access->arg->titem;
-
-	if (arg_ti == NULL) {
-		cspan_print(access->arg->cspan);
-		printf(" Error: Argument of access operation has no value.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	switch (arg_ti->tic) {
-	case tic_tprimitive:
-		stype_access_tprimitive(stype, access, arg_ti, rtitem);
-		break;
-	case tic_tobject:
-		stype_access_tobject(stype, access, arg_ti, rtitem);
-		break;
-	case tic_tarray:
-		stype_access_tarray(stype, access, arg_ti, rtitem);
-		break;
-	case tic_tdeleg:
-		cspan_print(access->arg->cspan);
-		printf(" Error: Using '.' operator on a delegate.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tebase:
-		stype_access_tebase(stype, access, arg_ti, rtitem);
-		break;
-	case tic_tenum:
-		cspan_print(access->arg->cspan);
-		printf(" Error: Using '.' operator on expression of enum "
-		    "type.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tfun:
-		cspan_print(access->arg->cspan);
-		printf(" Error: Using '.' operator on a function.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tvref:
-		/* Cannot allow this without some constraint. */
-		cspan_print(access->arg->cspan);
-		printf(" Error: Using '.' operator on generic data.\n");
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_ignore:
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	}
-}
-
-/** Type a primitive type access operation.
- *
- * @param stype		Static typing object
- * @param access	Member access operation
- * @param arg_ti	Base type
- * @param rtitem	Place to store result type
- */
-static void stype_access_tprimitive(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem)
-{
-	(void) arg_ti;
-
-	/* Box the value. */
-	access->arg = stype_box_expr(stype, access->arg);
-	if (access->arg->titem->tic == tic_ignore) {
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Access the boxed object. */
-	stype_access_tobject(stype, access, access->arg->titem, rtitem);
-}
-
-/** Type an object access operation.
- *
- * @param stype		Static typing object
- * @param access	Member access operation
- * @param arg_ti	Base type
- * @param rtitem	Place to store result type
- */
-static void stype_access_tobject(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem)
-{
-	stree_symbol_t *member_sym;
-	stree_var_t *var;
-	stree_enum_t *enum_d;
-	stree_fun_t *fun;
-	stree_prop_t *prop;
-	tdata_object_t *tobject;
-	tdata_item_t *mtitem;
-	tdata_tvv_t *tvv;
-	stree_csi_t *member_csi;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type a CSI access operation.\n");
-#endif
-	assert(arg_ti->tic == tic_tobject);
-	tobject = arg_ti->u.tobject;
-
-	/* Look for a member with the specified name. */
-	member_sym = symbol_search_csi(stype->program, tobject->csi,
-	    access->member_name);
-
-	if (member_sym == NULL) {
-		/* No such member found. */
-		cspan_print(access->member_name->cspan);
-		printf(" Error: CSI '");
-		symbol_print_fqn(csi_to_symbol(tobject->csi));
-		printf("' has no member named '%s'.\n",
-		    strtab_get_str(access->member_name->sid));
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found member '%s'.\n",
-	    strtab_get_str(access->member_name->sid));
-#endif
-	/* Check for accessing non-static member in static context. */
-	if (tobject->static_ref == sn_static &&
-	    !stree_symbol_is_static(member_sym)) {
-		cspan_print(access->member_name->cspan);
-		printf(" Error: Accessing non-static member '");
-		symbol_print_fqn(member_sym);
-		printf("' in static context.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Check for accessing static member in non-static context. */
-	if (tobject->static_ref != sn_static &&
-	    stree_symbol_is_static(member_sym)) {
-		cspan_print(access->member_name->cspan);
-		printf(" Error: Accessing static member '");
-		symbol_print_fqn(member_sym);
-		printf("' in non-static context.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Make compiler happy. */
-	mtitem = NULL;
-
-	switch (member_sym->sc) {
-	case sc_csi:
-		member_csi = symbol_to_csi(member_sym);
-		assert(member_csi != NULL);
-
-		mtitem = tdata_item_new(tic_tobject);
-		tobject = tdata_object_new();
-		mtitem->u.tobject = tobject;
-
-		tobject->static_ref = sn_static;
-		tobject->csi = member_csi;
-		break;
-	case sc_ctor:
-		/* It is not possible to reference a constructor explicitly. */
-		assert(b_false);
-		/* Fallthrough */
-	case sc_deleg:
-		cspan_print(access->member_name->cspan);
-		printf(" Error: Accessing object member which is a "
-		    "delegate.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	case sc_enum:
-		enum_d = symbol_to_enum(member_sym);
-		assert(enum_d != NULL);
-		/* Type enum if it has not been typed yet. */
-		stype_enum(stype, enum_d);
-		mtitem = enum_d->titem;
-		break;
-	case sc_fun:
-		fun = symbol_to_fun(member_sym);
-		assert(fun != NULL);
-		/* Type function header now */
-		stype_fun_header(stype, fun);
-		mtitem = fun->titem;
-		break;
-	case sc_var:
-		var = symbol_to_var(member_sym);
-		assert(var != NULL);
-		run_texpr(stype->program, member_sym->outer_csi,
-		    var->type, &mtitem);
-		break;
-	case sc_prop:
-		prop = symbol_to_prop(member_sym);
-		assert(prop != NULL);
-		run_texpr(stype->program, member_sym->outer_csi,
-		    prop->type, &mtitem);
-		break;
-	}
-
-	/*
-	 * Substitute type arguments in member titem.
-	 *
-	 * Since the CSI can be generic the actual type of the member
-	 * is obtained by substituting our type arguments into the
-	 * (generic) type of the member.
-	 */
-
-	stype_titem_to_tvv(stype, arg_ti, &tvv);
-	tdata_item_subst(mtitem, tvv, rtitem);
-}
-
-/** Type an array access operation.
- *
- * @param stype		Static typing object
- * @param access	Member access operation
- * @param arg_ti	Base type
- * @param rtitem	Place to store result type
- */
-static void stype_access_tarray(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem)
-{
-	(void) stype;
-	(void) access;
-	(void) rtitem;
-
-	cspan_print(access->arg->cspan);
-	printf(" Error: Unimplemented: Accessing array type '");
-	tdata_item_print(arg_ti);
-	printf("'.\n");
-	stype_note_error(stype);
-	*rtitem = stype_recovery_titem(stype);
-}
-
-/** Type an enum access operation.
- *
- * @param stype		Static typing object
- * @param access	Member access operation
- * @param arg_ti	Base type
- * @param rtitem	Place to store result type
- */
-static void stype_access_tebase(stype_t *stype, stree_access_t *access,
-    tdata_item_t *arg_ti, tdata_item_t **rtitem)
-{
-	tdata_ebase_t *tebase;
-	tdata_enum_t *tenum;
-	tdata_item_t *mtitem;
-	stree_embr_t *embr;
-
-#ifdef DEBUG_TYPE_TRACE
-	printf("Type an ebase access operation.\n");
-#endif
-	assert(arg_ti->tic == tic_tebase);
-	tebase = arg_ti->u.tebase;
-
-	/* Look for a member with the specified name. */
-	embr = stree_enum_find_mbr(tebase->enum_d, access->member_name);
-
-	if (embr == NULL) {
-		/* No such member found. */
-		cspan_print(access->member_name->cspan);
-		printf(" Error: Enum type '");
-		symbol_print_fqn(enum_to_symbol(tebase->enum_d));
-		printf("' has no member named '%s'.\n",
-		    strtab_get_str(access->member_name->sid));
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-#ifdef DEBUG_RUN_TRACE
-	printf("Found member '%s'.\n",
-	    strtab_get_str(access->member_name->sid));
-#endif
-
-	mtitem = tdata_item_new(tic_tenum);
-	tenum = tdata_enum_new();
-	mtitem->u.tenum = tenum;
-	tenum->enum_d = tebase->enum_d;
-
-	*rtitem = mtitem;
-}
-
-/** Type a call operation.
- *
- * @param stype		Static typing object
- * @param call		Call operation
- * @param rtitem	Place to store result type
- */
-static void stype_call(stype_t *stype, stree_call_t *call,
-    tdata_item_t **rtitem)
-{
-	tdata_item_t *fun_ti;
-	tdata_fun_sig_t *tsig;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(call->expr->cspan);
-	printf(" Evaluate type of call operation.\n");
-#endif
-	/* Type the function */
-	stype_expr(stype, call->fun);
-
-	/* Check type item class */
-	fun_ti = call->fun->titem;
-	switch (fun_ti->tic) {
-	case tic_tdeleg:
-		tsig = stype_deleg_get_sig(stype, fun_ti->u.tdeleg);
-		assert(tsig != NULL);
-		break;
-	case tic_tfun:
-		tsig = fun_ti->u.tfun->tsig;
-		break;
-	case tic_ignore:
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	default:
-		cspan_print(call->fun->cspan);
-		printf(" Error: Calling something which is not a function ");
-		printf("(found '");
-		tdata_item_print(fun_ti);
-		printf("').\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	/* Type call arguments. */
-	stype_call_args(stype, call->expr->cspan, &tsig->arg_ti, tsig->varg_ti,
-	    &call->args);
-
-	if (tsig->rtype != NULL) {
-		/* XXX Might be better to clone here. */
-		*rtitem = tsig->rtype;
-	} else {
-		*rtitem = NULL;
-	}
-}
-
-/** Type call arguments.
- *
- * Type arguments in call to a function or constructor.
- *
- * @param stype		Static typing object
- * @param cpsan		Cspan to print in case of error.
- * @param farg_tis	Formal argument types (list of tdata_item_t)
- * @param args		Real arguments (list of stree_expr_t)
- */
-static void stype_call_args(stype_t *stype, cspan_t *cspan, list_t *farg_tis,
-    tdata_item_t *fvarg_ti, list_t *args)
-{
-	list_node_t *fargt_n;
-	tdata_item_t *farg_ti;
-	tdata_item_t *varg_ti;
-
-	list_node_t *arg_n;
-	stree_expr_t *arg;
-	stree_expr_t *carg;
-
-	/* Type and check regular arguments. */
-	fargt_n = list_first(farg_tis);
-	arg_n = list_first(args);
-
-	while (fargt_n != NULL && arg_n != NULL) {
-		farg_ti = list_node_data(fargt_n, tdata_item_t *);
-		arg = list_node_data(arg_n, stree_expr_t *);
-		stype_expr(stype, arg);
-
-		/* XXX Because of overloaded bultin WriteLine */
-		if (farg_ti == NULL) {
-			/* Skip the check */
-			fargt_n = list_next(farg_tis, fargt_n);
-			arg_n = list_next(args, arg_n);
-			continue;
-		}
-
-		/* Convert expression to type of formal argument. */
-		carg = stype_convert(stype, arg, farg_ti);
-
-		/* Patch code with augmented expression. */
-		list_node_setdata(arg_n, carg);
-
-		fargt_n = list_next(farg_tis, fargt_n);
-		arg_n = list_next(args, arg_n);
-	}
-
-	/* Type and check variadic arguments. */
-	if (fvarg_ti != NULL) {
-		/* Obtain type of packed argument. */
-		farg_ti = fvarg_ti;
-
-		/* Get array element type */
-		assert(farg_ti->tic == tic_tarray);
-		varg_ti = farg_ti->u.tarray->base_ti;
-
-		while (arg_n != NULL) {
-			arg = list_node_data(arg_n, stree_expr_t *);
-			stype_expr(stype, arg);
-
-			/* Convert expression to type of formal argument. */
-			carg = stype_convert(stype, arg, varg_ti);
-
-			/* Patch code with augmented expression. */
-			list_node_setdata(arg_n, carg);
-
-			arg_n = list_next(args, arg_n);
-		}
-	}
-
-	if (fargt_n != NULL) {
-		cspan_print(cspan);
-		printf(" Error: Too few arguments.\n");
-		stype_note_error(stype);
-	}
-
-	if (arg_n != NULL) {
-		cspan_print(cspan);
-		printf(" Error: Too many arguments.\n");
-		stype_note_error(stype);
-	}
-}
-
-/** Type an indexing operation.
- *
- * @param stype		Static typing object
- * @param index		Indexing operation
- * @param rtitem	Place to store result type
- */
-static void stype_index(stype_t *stype, stree_index_t *index,
-    tdata_item_t **rtitem)
-{
-	tdata_item_t *base_ti;
-	list_node_t *arg_n;
-	stree_expr_t *arg;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(index->expr->cspan);
-	printf(" Evaluate type of index operation.\n");
-#endif
-	stype_expr(stype, index->base);
-	base_ti = index->base->titem;
-
-	/* Type the arguments (indices). */
-	arg_n = list_first(&index->args);
-	while (arg_n != NULL) {
-		arg = list_node_data(arg_n, stree_expr_t *);
-		stype_expr(stype, arg);
-
-		arg_n = list_next(&index->args, arg_n);
-	}
-
-	switch (base_ti->tic) {
-	case tic_tprimitive:
-		stype_index_tprimitive(stype, index, base_ti, rtitem);
-		break;
-	case tic_tobject:
-		stype_index_tobject(stype, index, base_ti, rtitem);
-		break;
-	case tic_tarray:
-		stype_index_tarray(stype, index, base_ti, rtitem);
-		break;
-	case tic_tdeleg:
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing a delegate.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tebase:
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing an enum declaration.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tenum:
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing an enum value.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tfun:
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing a function.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_tvref:
-		/* Cannot allow this without some constraint. */
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing generic data.\n");
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	case tic_ignore:
-		*rtitem = stype_recovery_titem(stype);
-		break;
-	}
-}
-
-/** Type a primitive indexing operation.
- *
- * @param stype		Static typing object
- * @param index		Indexing operation
- * @param base_ti	Base type (primitive being indexed)
- * @param rtitem	Place to store result type
- */
-static void stype_index_tprimitive(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem)
-{
-	tdata_primitive_t *tprimitive;
-	tdata_item_t *titem;
-
-	(void) stype;
-	(void) index;
-
-	assert(base_ti->tic == tic_tprimitive);
-	tprimitive = base_ti->u.tprimitive;
-
-	if (tprimitive->tpc == tpc_string) {
-		titem = tdata_item_new(tic_tprimitive);
-		titem->u.tprimitive = tdata_primitive_new(tpc_char);
-		*rtitem = titem;
-		return;
-	}
-
-	cspan_print(index->base->cspan);
-	printf(" Error: Indexing primitive type '");
-	tdata_item_print(base_ti);
-	printf("'.\n");
-	stype_note_error(stype);
-	*rtitem = stype_recovery_titem(stype);
-}
-
-/** Type an object indexing operation.
- *
- * @param stype		Static typing object
- * @param index		Indexing operation
- * @param base_ti	Base type (object being indexed)
- * @param rtitem	Place to store result type
- */
-static void stype_index_tobject(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem)
-{
-	tdata_object_t *tobject;
-	stree_symbol_t *idx_sym;
-	stree_prop_t *idx;
-	stree_ident_t *idx_ident;
-	tdata_item_t *mtitem;
-	tdata_tvv_t *tvv;
-
-	(void) index;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(index->expr->cspan);
-	printf(" Indexing object type '");
-	tdata_item_print(base_ti);
-	printf("'.\n");
-#endif
-
-	assert(base_ti->tic == tic_tobject);
-	tobject = base_ti->u.tobject;
-
-	/* Find indexer symbol. */
-	idx_ident = stree_ident_new();
-	idx_ident->sid = strtab_get_sid(INDEXER_IDENT);
-	idx_sym = symbol_search_csi(stype->program, tobject->csi, idx_ident);
-
-	if (idx_sym == NULL) {
-		cspan_print(index->base->cspan);
-		printf(" Error: Indexing object of type '");
-		tdata_item_print(base_ti);
-		printf("' which does not have an indexer.\n");
-		stype_note_error(stype);
-		*rtitem = stype_recovery_titem(stype);
-		return;
-	}
-
-	idx = symbol_to_prop(idx_sym);
-	assert(idx != NULL);
-
-	/* XXX Memoize to avoid recomputing every time. */
-	run_texpr(stype->program, idx_sym->outer_csi, idx->type, &mtitem);
-
-	/*
-	 * Substitute type arguments in member titem.
-	 *
-	 * Since the CSI can be generic the actual type of the member
-	 * is obtained by substituting our type arguments into the
-	 * (generic) type of the member.
-	 */
-
-	stype_titem_to_tvv(stype, base_ti, &tvv);
-	tdata_item_subst(mtitem, tvv, rtitem);
-}
-
-/** Type an array indexing operation.
- *
- * @param stype		Static typing object
- * @param index		Indexing operation
- * @param base_ti	Base type (array being indexed)
- * @param rtitem	Place to store result type
- */
-static void stype_index_tarray(stype_t *stype, stree_index_t *index,
-    tdata_item_t *base_ti, tdata_item_t **rtitem)
-{
-	list_node_t *arg_n;
-	stree_expr_t *arg;
-	int arg_count;
-
-	(void) stype;
-	assert(base_ti->tic == tic_tarray);
-
-	/*
-	 * Check that type of all indices is @c int and that the number of
-	 * indices matches array rank.
-	 */
-	arg_count = 0;
-	arg_n = list_first(&index->args);
-	while (arg_n != NULL) {
-		++arg_count;
-
-		arg = list_node_data(arg_n, stree_expr_t *);
-		if (arg->titem->tic != tic_tprimitive ||
-		    arg->titem->u.tprimitive->tpc != tpc_int) {
-
-			cspan_print(arg->cspan);
-			printf(" Error: Array index is not an integer.\n");
-			stype_note_error(stype);
-		}
-
-		arg_n = list_next(&index->args, arg_n);
-	}
-
-	if (arg_count != base_ti->u.tarray->rank) {
-		cspan_print(index->expr->cspan);
-		printf(" Error: Using %d indices with array of rank %d.\n",
-		    arg_count, base_ti->u.tarray->rank);
-		stype_note_error(stype);
-	}
-
-	*rtitem = base_ti->u.tarray->base_ti;
-}
-
-/** Type an assignment.
- *
- * @param stype		Static typing object
- * @param assign	Assignment operation
- * @param rtitem	Place to store result type
- */
-static void stype_assign(stype_t *stype, stree_assign_t *assign,
-    tdata_item_t **rtitem)
-{
-	stree_expr_t *csrc;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(assign->expr->cspan);
-	printf(" Evaluate type of assignment.\n");
-#endif
-	stype_expr(stype, assign->dest);
-	stype_expr(stype, assign->src);
-
-	csrc = stype_convert(stype, assign->src, assign->dest->titem);
-
-	/* Patch code with the augmented expression. */
-	assign->src = csrc;
-	*rtitem = NULL;
-}
-
-/** Type @c as conversion.
- *
- * @param stype		Static typing object
- * @param as_op		@c as conversion operation
- * @param rtitem	Place to store result type
- */
-static void stype_as(stype_t *stype, stree_as_t *as_op, tdata_item_t **rtitem)
-{
-	tdata_item_t *titem;
-	tdata_item_t *pred_ti;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(as_op->expr->cspan);
-	printf(" Evaluate type of @c as conversion.\n");
-#endif
-	stype_expr(stype, as_op->arg);
-	run_texpr(stype->program, stype->current_csi, as_op->dtype, &titem);
-
-	pred_ti = stype_tobject_find_pred(stype, titem, as_op->arg->titem);
-	if (pred_ti == NULL) {
-		/* No CSI match. */
-		stype_convert_failure(stype, convc_as, as_op->arg, titem);
-		*rtitem = titem;
-		return;
-	}
-
-	/*
-	 * Verify that type arguments match with those specified for
-	 * conversion destination.
-	 */
-	if (stype_targs_check_equal(stype, pred_ti, as_op->arg->titem) !=
-	    EOK) {
-		stype_convert_failure(stype, convc_as, as_op->arg, titem);
-		*rtitem = titem;
-		return;
-	}
-
-	*rtitem = titem;
-}
-
-/** Type boxing operation.
- *
- * While there is no boxing operation on the first typing pass, we do want
- * to allow potential re-evaluation (with same results).
- *
- * @param stype		Static typing object
- * @param box		Boxing operation
- * @param rtitem	Place to store result type
- */
-static void stype_box(stype_t *stype, stree_box_t *box, tdata_item_t **rtitem)
-{
-	tdata_item_t *ptitem, *btitem;
-	tdata_object_t *tobject;
-	stree_symbol_t *csi_sym;
-	builtin_t *bi;
-
-#ifdef DEBUG_TYPE_TRACE
-	cspan_print(box->expr->cspan);
-	printf(" Evaluate type of boxing operation.\n");
-#endif
-	bi = stype->program->builtin;
-
-	stype_expr(stype, box->arg);
-	ptitem = box->arg->titem;
-
-	/* Make compiler happy. */
-	csi_sym = NULL;
-
-	assert(ptitem->tic == tic_tprimitive);
-	switch (ptitem->u.tprimitive->tpc) {
-	case tpc_bool:
-		csi_sym = bi->boxed_bool;
-		break;
-	case tpc_char:
-		csi_sym = bi->boxed_char;
-		break;
-	case tpc_int:
-		csi_sym = bi->boxed_int;
-		break;
-	case tpc_nil:
-		assert(b_false);
-		/* Fallthrough */
-	case tpc_string:
-		csi_sym = bi->boxed_string;
-		break;
-	case tpc_resource:
-		assert(b_false);
-	}
-
-	btitem = tdata_item_new(tic_tobject);
-	tobject = tdata_object_new();
-
-	btitem->u.tobject = tobject;
-	tobject->static_ref = sn_nonstatic;
-	tobject->csi = symbol_to_csi(csi_sym);
-	assert(tobject->csi != NULL);
-	list_init(&tobject->targs);
-
-	*rtitem = btitem;
-}
Index: pace/app/sbi/src/stype_expr.h
===================================================================
--- uspace/app/sbi/src/stype_expr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STYPE_EXPR_H_
-#define STYPE_EXPR_H_
-
-#include "mytypes.h"
-
-void stype_expr(stype_t *stype, stree_expr_t *expr);
-
-#endif
Index: pace/app/sbi/src/stype_t.h
===================================================================
--- uspace/app/sbi/src/stype_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef STYPE_T_H_
-#define STYPE_T_H_
-
-/** Block visit record
- *
- * One block VR is created for each block that we enter. A variable declaration
- * statement inserts the variable declaration here. Upon leaving the block we
- * pop from the stack, thus all the variable declarations from that block
- * are forgotten.
- */
-typedef struct run_block_vr {
-	/** Variable declarations in this block */
-	intmap_t vdecls; /* of stree_vdecl_t */
-} stype_block_vr_t;
-
-/** Procedure visit record
- *
- * A procedure can be a member function or a property getter or setter. A
- * procedure visit record is created whenever @c stype (the static typing
- * pass) enters a procedure.
- */
-typedef struct run_proc_vr {
-	/** Definition of function or property being invoked */
-	struct stree_proc *proc;
-
-	/** Block activation records */
-	list_t block_vr; /* of run_block_ar_t */
-
-	/** Number of active breakable statements (for break checking). */
-	int bstat_cnt;
-} stype_proc_vr_t;
-
-/** Conversion class */
-typedef enum {
-	/** Implicit conversion */
-	convc_implicit,
-	/** 'as' conversion */
-	convc_as
-} stype_conv_class_t;
-
-/** Static typer state object */
-typedef struct stype {
-	/** Code of the program being typed */
-	struct stree_program *program;
-
-	/**
-	 * CSI context in which we are currently typing. We keep an implicit
-	 * stack of these (in instances of local variable
-	 * @c stype_csi::prev_ctx.)
-	 */
-	struct stree_csi *current_csi;
-
-	/** Procedure VR for the current procedure. */
-	stype_proc_vr_t *proc_vr;
-
-	/** @c b_true if an error occured. */
-	bool_t error;
-} stype_t;
-
-#endif
Index: pace/app/sbi/src/symbol.c
===================================================================
--- uspace/app/sbi/src/symbol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,678 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Symbols. */
-
-#include <stdlib.h>
-#include <assert.h>
-#include "list.h"
-#include "mytypes.h"
-#include "strtab.h"
-#include "stree.h"
-
-#include "symbol.h"
-
-static stree_symbol_t *symbol_search_global(stree_program_t *prog,
-    stree_ident_t *name);
-static stree_symbol_t *symbol_find_epoint_rec(stree_program_t *prog,
-    stree_ident_t *name, stree_csi_t *csi);
-static stree_ident_t *symbol_get_ident(stree_symbol_t *symbol);
-
-/** Lookup symbol in CSI using a type expression.
- *
- * XXX This should be removed in favor of full type expression evaluation
- * (run_texpr). This cannot work properly with generics.
- *
- * @param prog		Program
- * @param scope		CSI used as base for relative references
- * @param texpr		Type expression
- *
- * @return		Symbol referenced by type expression or @c NULL
- *			if not found
- */
-stree_symbol_t *symbol_xlookup_in_csi(stree_program_t *prog,
-    stree_csi_t *scope, stree_texpr_t *texpr)
-{
-	stree_symbol_t *a, *b;
-	stree_csi_t *a_csi;
-
-	switch (texpr->tc) {
-	case tc_tnameref:
-		return symbol_lookup_in_csi(prog, scope, texpr->u.tnameref->name);
-	case tc_taccess:
-		a = symbol_xlookup_in_csi(prog, scope, texpr->u.taccess->arg);
-		a_csi = symbol_to_csi(a);
-		if (a_csi == NULL) {
-			printf("Error: Symbol is not CSI.\n");
-			exit(1);
-		}
-		b = symbol_search_csi(prog, a_csi, texpr->u.taccess->member_name);
-		if (b == NULL) {
-			printf("Error: CSI '%s' not found\n", strtab_get_str(texpr->u.taccess->member_name->sid));
-			exit(1);
-		}
-		return b;
-	case tc_tapply:
-		return symbol_xlookup_in_csi(prog, scope,
-		    texpr->u.tapply->gtype);
-	default:
-		assert(b_false);
-	}
-}
-
-/** Lookup symbol reference in CSI.
- *
- * XXX These functions should take just an sid, not a full identifier.
- * Sometimes we search for a name which has no associated cspan.
- *
- * @param prog	Program to look in
- * @param scope CSI in @a prog which is the base for references
- * @param name	Identifier of the symbol
- *
- * @return	Symbol or @c NULL if symbol not found
- */
-stree_symbol_t *symbol_lookup_in_csi(stree_program_t *prog, stree_csi_t *scope,
-    stree_ident_t *name)
-{
-	stree_symbol_t *symbol;
-
-	/* This CSI node should have been processed. */
-	assert(scope == NULL || scope->ancr_state == ws_visited);
-
-	symbol = NULL;
-	while (scope != NULL && symbol == NULL) {
-		symbol = symbol_search_csi(prog, scope, name);
-		scope = csi_to_symbol(scope)->outer_csi;
-	}
-
-	if (symbol == NULL)
-		symbol = symbol_search_global(prog, name);
-
-	return symbol;
-}
-
-/** Look for symbol strictly in CSI.
- *
- * Look for symbol in definition of a CSI and its ancestors. (But not
- * in lexically enclosing CSI.)
- *
- * @param prog	Program to look in
- * @param scope CSI in which to look
- * @param name	Identifier of the symbol
- *
- * @return	Symbol or @c NULL if symbol not found.
- */
-stree_symbol_t *symbol_search_csi(stree_program_t *prog,
-    stree_csi_t *scope, stree_ident_t *name)
-{
-	stree_csi_t *base_csi;
-	stree_symbol_t *symbol;
-
-	/* Look in new members in this class. */
-	symbol = symbol_search_csi_no_base(prog, scope, name);
-	if (symbol != NULL)
-		return symbol;
-
-	/* Try inherited members. */
-	base_csi = symbol_get_base_class(prog, scope);
-	if (base_csi != NULL)
-		return symbol_search_csi(prog, base_csi, name);
-
-	/* No match */
-	return NULL;
-}
-
-/** Look for symbol strictly in CSI.
- *
- * Look for symbol in definition of a CSI and its ancestors. (But not
- * in lexically enclosing CSI or in base CSI.)
- *
- * @param prog	Program to look in
- * @param scope CSI in which to look
- * @param name	Identifier of the symbol
- *
- * @return	Symbol or @c NULL if symbol not found.
- */
-stree_symbol_t *symbol_search_csi_no_base(stree_program_t *prog,
-    stree_csi_t *scope, stree_ident_t *name)
-{
-	list_node_t *node;
-	stree_csimbr_t *csimbr;
-	stree_ident_t *mbr_name;
-
-	(void) prog;
-
-	/* Look in new members in this class. */
-
-	node = list_first(&scope->members);
-	while (node != NULL) {
-		csimbr = list_node_data(node, stree_csimbr_t *);
-		mbr_name = stree_csimbr_get_name(csimbr);
-
-		if (name->sid == mbr_name->sid) {
-			/* Match */
-			return csimbr_to_symbol(csimbr);
-		}
-
-		node = list_next(&scope->members, node);
-	}
-	/* No match */
-	return NULL;
-}
-
-/** Look for symbol in global scope.
- *
- * @param prog	Program to look in
- * @param name	Identifier of the symbol
- *
- * @return	Symbol or @c NULL if symbol not found.
- */
-static stree_symbol_t *symbol_search_global(stree_program_t *prog,
-    stree_ident_t *name)
-{
-	list_node_t *node;
-	stree_modm_t *modm;
-	stree_symbol_t *symbol;
-	stree_ident_t *mbr_name;
-
-	node = list_first(&prog->module->members);
-	while (node != NULL) {
-		modm = list_node_data(node, stree_modm_t *);
-
-		/* Make compiler happy. */
-		mbr_name = NULL;
-
-		switch (modm->mc) {
-		case mc_csi:
-			mbr_name = modm->u.csi->name;
-			break;
-		case mc_enum:
-			mbr_name = modm->u.enum_d->name;
-			break;
-		}
-
-		/* The Clang static analyzer is just too picky. */
-		assert(mbr_name != NULL);
-
-		if (name->sid == mbr_name->sid) {
-			/* Make compiler happy. */
-			symbol = NULL;
-
-			/* Match */
-			switch (modm->mc) {
-			case mc_csi:
-				symbol = csi_to_symbol(modm->u.csi);
-				break;
-			case mc_enum:
-				symbol = enum_to_symbol(modm->u.enum_d);
-				break;
-			}
-			return symbol;
-		}
-		node = list_next(&prog->module->members, node);
-	}
-
-	return NULL;
-}
-
-/** Get explicit base class for a CSI.
- *
- * Note that if there is no explicit base class (class is derived implicitly
- * from @c object, then @c NULL is returned.
- *
- * @param prog	Program to look in
- * @param csi	CSI
- *
- * @return	Base class (CSI) or @c NULL if no explicit base class.
- */
-stree_csi_t *symbol_get_base_class(stree_program_t *prog, stree_csi_t *csi)
-{
-	list_node_t *pred_n;
-	stree_texpr_t *pred;
-	stree_symbol_t *pred_sym;
-	stree_csi_t *pred_csi;
-	stree_csi_t *outer_csi;
-
-	outer_csi = csi_to_symbol(csi)->outer_csi;
-
-	pred_n = list_first(&csi->inherit);
-	if (pred_n == NULL)
-		return NULL;
-
-	pred = list_node_data(pred_n, stree_texpr_t *);
-	pred_sym = symbol_xlookup_in_csi(prog, outer_csi, pred);
-	pred_csi = symbol_to_csi(pred_sym);
-	assert(pred_csi != NULL); /* XXX! */
-
-	if (pred_csi->cc == csi_class)
-		return pred_csi;
-
-	return NULL;
-}
-
-/** Get type expression referencing base class for a CSI.
- *
- * Note that if there is no explicit base class (class is derived implicitly
- * from @c object, then @c NULL is returned.
- *
- * @param prog	Program to look in
- * @param csi	CSI
- *
- * @return	Type expression or @c NULL if no explicit base class.
- */
-stree_texpr_t *symbol_get_base_class_ref(stree_program_t *prog,
-    stree_csi_t *csi)
-{
-	list_node_t *pred_n;
-	stree_texpr_t *pred;
-	stree_symbol_t *pred_sym;
-	stree_csi_t *pred_csi;
-	stree_csi_t *outer_csi;
-
-	outer_csi = csi_to_symbol(csi)->outer_csi;
-
-	pred_n = list_first(&csi->inherit);
-	if (pred_n == NULL)
-		return NULL;
-
-	pred = list_node_data(pred_n, stree_texpr_t *);
-	pred_sym = symbol_xlookup_in_csi(prog, outer_csi, pred);
-	pred_csi = symbol_to_csi(pred_sym);
-	assert(pred_csi != NULL); /* XXX! */
-
-	if (pred_csi->cc == csi_class)
-		return pred;
-
-	return NULL;
-}
-
-/** Find entry point.
- *
- * Perform a walk of all CSIs and look for a function with the name @a name.
- *
- * @param prog	Program to look in
- * @param name	Name of entry point
- *
- * @return	Symbol or @c NULL if symbol not found.
- */
-stree_symbol_t *symbol_find_epoint(stree_program_t *prog, stree_ident_t *name)
-{
-	list_node_t *node;
-	stree_modm_t *modm;
-	stree_symbol_t *entry, *etmp;
-
-	entry = NULL;
-
-	node = list_first(&prog->module->members);
-	while (node != NULL) {
-		modm = list_node_data(node, stree_modm_t *);
-		if (modm->mc == mc_csi) {
-			etmp = symbol_find_epoint_rec(prog, name, modm->u.csi);
-			if (etmp != NULL) {
-				if (entry != NULL) {
-					printf("Error: Duplicate entry point.\n");
-					exit(1);
-				}
-				entry = etmp;
-			}
-		}
-		node = list_next(&prog->module->members, node);
-	}
-
-	return entry;
-}
-
-/** Find entry point under CSI.
- *
- * Internal part of symbol_find_epoint() that recursively walks CSIs.
- *
- * @param prog	Program to look in
- * @param name	Name of entry point
- *
- * @return	Symbol or @c NULL if symbol not found.
- */
-static stree_symbol_t *symbol_find_epoint_rec(stree_program_t *prog,
-    stree_ident_t *name, stree_csi_t *csi)
-{
-	list_node_t *node;
-	stree_csimbr_t *csimbr;
-	stree_symbol_t *entry, *etmp;
-	stree_symbol_t *fun_sym;
-
-	entry = NULL;
-
-	node = list_first(&csi->members);
-	while (node != NULL) {
-		csimbr = list_node_data(node, stree_csimbr_t *);
-
-		switch (csimbr->cc) {
-		case csimbr_csi:
-			etmp = symbol_find_epoint_rec(prog, name, csimbr->u.csi);
-			if (etmp != NULL) {
-				if (entry != NULL) {
-					printf("Error: Duplicate entry point.\n");
-					exit(1);
-				}
-				entry = etmp;
-			}
-			break;
-		case csimbr_fun:
-			fun_sym = fun_to_symbol(csimbr->u.fun);
-
-			if (csimbr->u.fun->name->sid == name->sid &&
-			    stree_symbol_has_attr(fun_sym, sac_static)) {
-				if (entry != NULL) {
-					printf("Error: Duplicate entry point.\n");
-					exit(1);
-				}
-				entry = fun_sym;
-			}
-		default:
-			break;
-		}
-
-		node = list_next(&csi->members, node);
-	}
-
-	return entry;
-}
-
-/*
- * The notion of symbol is designed as a common base class for several
- * types of declarations with global and CSI scope. Here we simulate
- * conversion from this base class (symbol) to derived classes (CSI,
- * fun, ..) and vice versa.
- */
-
-/** Convert symbol to delegate (base to derived).
- *
- * @param symbol	Symbol
- * @return		Delegate or @c NULL if symbol is not a delegate
- */
-stree_deleg_t *symbol_to_deleg(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_deleg)
-		return NULL;
-
-	return symbol->u.deleg;
-}
-
-/** Convert delegate to symbol (derived to base).
- *
- * @param deleg		Delegate
- * @return		Symbol
- */
-stree_symbol_t *deleg_to_symbol(stree_deleg_t *deleg)
-{
-	assert(deleg->symbol);
-	return deleg->symbol;
-}
-
-/** Convert symbol to enum (base to derived).
- *
- * @param symbol	Symbol
- * @return		Enum or @c NULL if symbol is not a enum
- */
-stree_enum_t *symbol_to_enum(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_enum)
-		return NULL;
-
-	return symbol->u.enum_d;
-}
-
-/** Convert enum to symbol (derived to base).
- *
- * @param deleg		Enum
- * @return		Symbol
- */
-stree_symbol_t *enum_to_symbol(stree_enum_t *enum_d)
-{
-	assert(enum_d->symbol);
-	return enum_d->symbol;
-}
-
-/** Convert symbol to CSI (base to derived).
- *
- * @param symbol	Symbol
- * @return		CSI or @c NULL if symbol is not a CSI
- */
-stree_csi_t *symbol_to_csi(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_csi)
-		return NULL;
-
-	return symbol->u.csi;
-}
-
-/** Convert CSI to symbol (derived to base).
- *
- * @param csi		CSI
- * @return		Symbol
- */
-stree_symbol_t *csi_to_symbol(stree_csi_t *csi)
-{
-	assert(csi->symbol);
-	return csi->symbol;
-}
-
-/** Convert symbol to constructor (base to derived).
- *
- * @param symbol	Symbol
- * @return		Constructor or @c NULL if symbol is not a constructor
- */
-stree_ctor_t *symbol_to_ctor(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_ctor)
-		return NULL;
-
-	return symbol->u.ctor;
-}
-
-/** Convert constructor to symbol (derived to base).
- *
- * @param ctor		Constructor
- * @return		Symbol
- */
-stree_symbol_t *ctor_to_symbol(stree_ctor_t *ctor)
-{
-	assert(ctor->symbol);
-	return ctor->symbol;
-}
-
-/** Convert symbol to function (base to derived).
- *
- * @param symbol	Symbol
- * @return		Function or @c NULL if symbol is not a function
- */
-stree_fun_t *symbol_to_fun(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_fun)
-		return NULL;
-
-	return symbol->u.fun;
-}
-
-/** Convert function to symbol (derived to base).
- *
- * @param fun		Function
- * @return		Symbol
- */
-stree_symbol_t *fun_to_symbol(stree_fun_t *fun)
-{
-	assert(fun->symbol);
-	return fun->symbol;
-}
-
-/** Convert symbol to member variable (base to derived).
- *
- * @param symbol	Symbol
- * @return		Variable or @c NULL if symbol is not a member variable
- */
-stree_var_t *symbol_to_var(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_var)
-		return NULL;
-
-	return symbol->u.var;
-}
-
-/** Convert variable to symbol (derived to base).
- *
- * @param fun		Variable
- * @return		Symbol
- */
-stree_symbol_t *var_to_symbol(stree_var_t *var)
-{
-	assert(var->symbol);
-	return var->symbol;
-}
-
-/** Convert symbol to property (base to derived).
- *
- * @param symbol	Symbol
- * @return		Property or @c NULL if symbol is not a property
- */
-stree_prop_t *symbol_to_prop(stree_symbol_t *symbol)
-{
-	if (symbol->sc != sc_prop)
-		return NULL;
-
-	return symbol->u.prop;
-}
-
-/** Get symbol from CSI member.
- *
- * A symbol corresponds to any CSI member. Return it.
- *
- * @param csimbr	CSI member
- * @return		Symbol
- */
-stree_symbol_t *csimbr_to_symbol(stree_csimbr_t *csimbr)
-{
-	stree_symbol_t *symbol;
-
-	/* Keep compiler happy. */
-	symbol = NULL;
-
-	/* Match */
-	switch (csimbr->cc) {
-	case csimbr_csi:
-		symbol = csi_to_symbol(csimbr->u.csi);
-		break;
-	case csimbr_ctor:
-		symbol = ctor_to_symbol(csimbr->u.ctor);
-		break;
-	case csimbr_deleg:
-		symbol = deleg_to_symbol(csimbr->u.deleg);
-		break;
-	case csimbr_enum:
-		symbol = enum_to_symbol(csimbr->u.enum_d);
-		break;
-	case csimbr_fun:
-		symbol = fun_to_symbol(csimbr->u.fun);
-		break;
-	case csimbr_var:
-		symbol = var_to_symbol(csimbr->u.var);
-		break;
-	case csimbr_prop:
-		symbol = prop_to_symbol(csimbr->u.prop);
-		break;
-	}
-
-	return symbol;
-}
-
-/** Convert property to symbol (derived to base).
- *
- * @param fun		Property
- * @return		Symbol
- */
-stree_symbol_t *prop_to_symbol(stree_prop_t *prop)
-{
-	assert(prop->symbol);
-	return prop->symbol;
-}
-
-/** Print fully qualified name of symbol.
- *
- * @param symbol	Symbol
- */
-void symbol_print_fqn(stree_symbol_t *symbol)
-{
-	stree_ident_t *name;
-	stree_symbol_t *outer_sym;
-
-	if (symbol->outer_csi != NULL) {
-		outer_sym = csi_to_symbol(symbol->outer_csi);
-		symbol_print_fqn(outer_sym);
-		printf(".");
-	}
-
-	name = symbol_get_ident(symbol);
-	printf("%s", strtab_get_str(name->sid));
-}
-
-/** Return symbol identifier.
- *
- * @param symbol	Symbol
- * @return 		Symbol identifier
- */
-static stree_ident_t *symbol_get_ident(stree_symbol_t *symbol)
-{
-	stree_ident_t *ident;
-
-	/* Make compiler happy. */
-	ident = NULL;
-
-	switch (symbol->sc) {
-	case sc_csi:
-		ident = symbol->u.csi->name;
-		break;
-	case sc_ctor:
-		ident = symbol->u.ctor->name;
-		break;
-	case sc_deleg:
-		ident = symbol->u.deleg->name;
-		break;
-	case sc_enum:
-		ident = symbol->u.enum_d->name;
-		break;
-	case sc_fun:
-		ident = symbol->u.fun->name;
-		break;
-	case sc_var:
-		ident = symbol->u.var->name;
-		break;
-	case sc_prop:
-		ident = symbol->u.prop->name;
-		break;
-	}
-
-	return ident;
-}
Index: pace/app/sbi/src/symbol.h
===================================================================
--- uspace/app/sbi/src/symbol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SYMBOL_H_
-#define SYMBOL_H_
-
-#include "mytypes.h"
-
-stree_symbol_t *symbol_xlookup_in_csi(stree_program_t *prog,
-    stree_csi_t *scope, stree_texpr_t *texpr);
-stree_symbol_t *symbol_lookup_in_csi(stree_program_t *prog, stree_csi_t *scope,
-    stree_ident_t *name);
-stree_symbol_t *symbol_search_csi(stree_program_t *prog, stree_csi_t *scope,
-    stree_ident_t *name);
-stree_symbol_t *symbol_search_csi_no_base(stree_program_t *prog,
-    stree_csi_t *scope, stree_ident_t *name);
-stree_csi_t *symbol_get_base_class(stree_program_t *prog, stree_csi_t *csi);
-stree_texpr_t *symbol_get_base_class_ref(stree_program_t *prog,
-    stree_csi_t *csi);
-stree_symbol_t *symbol_find_epoint(stree_program_t *prog, stree_ident_t *name);
-
-stree_deleg_t *symbol_to_deleg(stree_symbol_t *symbol);
-stree_symbol_t *deleg_to_symbol(stree_deleg_t *deleg);
-stree_csi_t *symbol_to_csi(stree_symbol_t *symbol);
-stree_symbol_t *csi_to_symbol(stree_csi_t *csi);
-stree_ctor_t *symbol_to_ctor(stree_symbol_t *symbol);
-stree_symbol_t *ctor_to_symbol(stree_ctor_t *ctor);
-stree_enum_t *symbol_to_enum(stree_symbol_t *symbol);
-stree_symbol_t *enum_to_symbol(stree_enum_t *enum_d);
-stree_fun_t *symbol_to_fun(stree_symbol_t *symbol);
-stree_symbol_t *fun_to_symbol(stree_fun_t *fun);
-stree_var_t *symbol_to_var(stree_symbol_t *symbol);
-stree_symbol_t *var_to_symbol(stree_var_t *var);
-stree_prop_t *symbol_to_prop(stree_symbol_t *symbol);
-stree_symbol_t *prop_to_symbol(stree_prop_t *prop);
-
-stree_symbol_t *csimbr_to_symbol(stree_csimbr_t *csimbr);
-
-void symbol_print_fqn(stree_symbol_t *symbol);
-
-#endif
Index: pace/app/sbi/src/tdata.c
===================================================================
--- uspace/app/sbi/src/tdata.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,856 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Run-time data representation. */
-
-#include <stdlib.h>
-#include <assert.h>
-#include "intmap.h"
-#include "list.h"
-#include "mytypes.h"
-#include "stree.h"
-#include "strtab.h"
-#include "symbol.h"
-
-#include "tdata.h"
-
-static void tdata_item_subst_tprimitive(tdata_primitive_t *torig,
-    tdata_tvv_t *tvv, tdata_item_t **res);
-static void tdata_item_subst_tobject(tdata_object_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res);
-static void tdata_item_subst_tarray(tdata_array_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res);
-static void tdata_item_subst_tdeleg(tdata_deleg_t *torig,
-    tdata_tvv_t *tvv, tdata_item_t **res);
-static void tdata_item_subst_tebase(tdata_ebase_t *tebase,
-    tdata_tvv_t *tvv, tdata_item_t **res);
-static void tdata_item_subst_tenum(tdata_enum_t *tenum,
-    tdata_tvv_t *tvv, tdata_item_t **res);
-static void tdata_item_subst_tfun(tdata_fun_t *torig,
-    tdata_tvv_t *tvv, tdata_item_t **res);
-static void tdata_item_subst_tvref(tdata_vref_t *tvref, tdata_tvv_t *tvv,
-    tdata_item_t **res);
-
-static void tdata_item_subst_fun_sig(tdata_fun_sig_t *torig, tdata_tvv_t *tvv,
-    tdata_fun_sig_t **res);
-
-static void tdata_tprimitive_print(tdata_primitive_t *tprimitive);
-static void tdata_tobject_print(tdata_object_t *tobject);
-static void tdata_tarray_print(tdata_array_t *tarray);
-static void tdata_tdeleg_print(tdata_deleg_t *tdeleg);
-static void tdata_tebase_print(tdata_ebase_t *tebase);
-static void tdata_tenum_print(tdata_enum_t *tenum);
-static void tdata_tfun_print(tdata_fun_t *tfun);
-static void tdata_tvref_print(tdata_vref_t *tvref);
-
-/** Determine if CSI @a a is derived from CSI described by type item @a tb.
- *
- * XXX This won't work with generics.
- *
- * @param a	Potential derived CSI.
- * @param tb	Type of potentail base CSI.
- */
-bool_t tdata_is_csi_derived_from_ti(stree_csi_t *a, tdata_item_t *tb)
-{
-	bool_t res;
-
-	switch (tb->tic) {
-	case tic_tobject:
-		res = stree_is_csi_derived_from_csi(a, tb->u.tobject->csi);
-		break;
-	default:
-		printf("Error: Base type is not a CSI.\n");
-		exit(1);
-	}
-
-	return res;
-}
-
-/**
- * Determine if CSI described by type item @a a is derived from CSI described
- * by type item @a tb.
- *
- * XXX This is somewhat complementary to stype_convert(). It is used for
- * the explicit @c as conversion. It should only work for objects and only
- * allow conversion from base to derived types. We might want to scrap this
- * for a version specific to @c as. The current code does not work with
- * generics.
- *
- * @param a	Potential derived CSI.
- * @param tb	Type of potentail base CSI.
- */
-bool_t tdata_is_ti_derived_from_ti(tdata_item_t *ta, tdata_item_t *tb)
-{
-	bool_t res;
-
-	switch (ta->tic) {
-	case tic_tobject:
-		res = tdata_is_csi_derived_from_ti(ta->u.tobject->csi, tb);
-		break;
-	default:
-		printf("Error: Derived type is not a CSI.\n");
-		exit(1);
-	}
-
-	return res;
-}
-
-/** Determine if two type items are equal (i.e. describe the same type).
- *
- * Needed to check compatibility of type arguments in which a parametrized
- * type is not monotonous.
- *
- * @param a	Type item
- * @param b	Type item
- * @return	@c b_true if equal, @c b_false if not.
- */
-bool_t tdata_item_equal(tdata_item_t *a, tdata_item_t *b)
-{
-	/*
-	 * Special case: Nil vs. object
-	 *
-	 * XXX Type of @c Nil should probably be @c object to avoid this
-	 * madness.
-	 */
-	if (a->tic == tic_tprimitive && a->u.tprimitive->tpc == tpc_nil) {
-		if (b->tic == tic_tobject)
-			return b_true;
-	} else if (b->tic == tic_tprimitive && b->u.tprimitive->tpc == tpc_nil) {
-		if (a->tic == tic_tobject)
-			return b_true;
-	}
-
-	if (a->tic != b->tic)
-		return b_false;
-
-	switch (a->tic) {
-	case tic_tprimitive:
-		/* Check if both have the same tprimitive class. */
-		return (a->u.tprimitive->tpc == b->u.tprimitive->tpc);
-	case tic_tobject:
-		/* Check if both use the same CSI definition. */
-		return (a->u.tobject->csi == b->u.tobject->csi);
-	case tic_tarray:
-		/* Compare rank and base type. */
-		if (a->u.tarray->rank != b->u.tarray->rank)
-			return b_false;
-
-		return tdata_item_equal(a->u.tarray->base_ti,
-		    b->u.tarray->base_ti);
-	case tic_tenum:
-		/* Check if both use the same enum definition. */
-		return (a->u.tenum->enum_d == b->u.tenum->enum_d);
-	case tic_tvref:
-		/* Check if both refer to the same type argument. */
-		return (a->u.tvref->targ == b->u.tvref->targ);
-	default:
-		printf("Warning: Unimplemented: Compare types '");
-		tdata_item_print(a);
-		printf("' and '");
-		tdata_item_print(b);
-		printf("'.\n");
-		return b_true;
-	}
-}
-
-/** Substitute type variables in a type item.
- *
- * This is the second part of generic type application. In the first part
- * obtained a TVV using stype_titem_to_tvv() and in this second part we
- * actually substitute type variables in a type item for their values.
- * @a tvv must contain all variables referenced in @a ti.
- *
- * @param ti	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-void tdata_item_subst(tdata_item_t *ti, tdata_tvv_t *tvv, tdata_item_t **res)
-{
-	switch (ti->tic) {
-	case tic_tprimitive:
-		tdata_item_subst_tprimitive(ti->u.tprimitive, tvv, res);
-		break;
-	case tic_tobject:
-		tdata_item_subst_tobject(ti->u.tobject, tvv, res);
-		break;
-	case tic_tarray:
-		tdata_item_subst_tarray(ti->u.tarray, tvv, res);
-		break;
-	case tic_tdeleg:
-		tdata_item_subst_tdeleg(ti->u.tdeleg, tvv, res);
-		break;
-	case tic_tebase:
-		tdata_item_subst_tebase(ti->u.tebase, tvv, res);
-		break;
-	case tic_tenum:
-		tdata_item_subst_tenum(ti->u.tenum, tvv, res);
-		break;
-	case tic_tfun:
-		tdata_item_subst_tfun(ti->u.tfun, tvv, res);
-		break;
-	case tic_tvref:
-		tdata_item_subst_tvref(ti->u.tvref, tvv, res);
-		break;
-	case tic_ignore:
-		*res = tdata_item_new(tic_ignore);
-	}
-}
-
-/** Substitute type variables in a primitive type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tprimitive(tdata_primitive_t *torig,
-    tdata_tvv_t *tvv, tdata_item_t **res)
-{
-	tdata_primitive_t *tnew;
-
-	(void) tvv;
-
-	/* Plain copy */
-	tnew = tdata_primitive_new(torig->tpc);
-	*res = tdata_item_new(tic_tprimitive);
-	(*res)->u.tprimitive = tnew;
-}
-
-/** Substitute type variables in an object type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tobject(tdata_object_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res)
-{
-	tdata_object_t *tnew;
-	list_node_t *targ_n;
-	tdata_item_t *targ;
-	tdata_item_t *new_targ;
-
-	/* Copy static ref flag and base CSI. */
-	tnew = tdata_object_new();
-	tnew->static_ref = torig->static_ref;
-	tnew->csi = torig->csi;
-	list_init(&tnew->targs);
-
-	/* Substitute arguments */
-	targ_n = list_first(&torig->targs);
-	while (targ_n != NULL) {
-		targ = list_node_data(targ_n, tdata_item_t *);
-		tdata_item_subst(targ, tvv, &new_targ);
-		list_append(&tnew->targs, new_targ);
-
-		targ_n = list_next(&torig->targs, targ_n);
-	}
-
-	*res = tdata_item_new(tic_tobject);
-	(*res)->u.tobject = tnew;
-}
-
-/** Substitute type variables in an array type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tarray(tdata_array_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res)
-{
-	tdata_array_t *tnew;
-	list_node_t *ext_n;
-	stree_expr_t *extent;
-
-	tnew = tdata_array_new();
-
-	/* Substitute base type */
-	tdata_item_subst(torig->base_ti, tvv, &tnew->base_ti);
-
-	/* Copy rank and extents */
-	tnew->rank = torig->rank;
-	list_init(&tnew->extents);
-
-	ext_n = list_first(&torig->extents);
-	while (ext_n != NULL) {
-		extent = list_node_data(ext_n, stree_expr_t *);
-		list_append(&tnew->extents, extent);
-
-		ext_n = list_next(&tnew->extents, ext_n);
-	}
-
-	*res = tdata_item_new(tic_tarray);
-	(*res)->u.tarray = tnew;
-}
-
-/** Substitute type variables in a delegate type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tdeleg(tdata_deleg_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res)
-{
-	tdata_deleg_t *tnew;
-
-	tnew = tdata_deleg_new();
-	tnew->deleg = torig->deleg;
-	tdata_item_subst_fun_sig(torig->tsig, tvv, &tnew->tsig);
-
-	*res = tdata_item_new(tic_tdeleg);
-	(*res)->u.tdeleg = tnew;
-}
-
-/** Substitute type variables in a enum-base type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tebase(tdata_ebase_t *tebase,
-    tdata_tvv_t *tvv, tdata_item_t **res)
-{
-	tdata_ebase_t *tnew;
-
-	(void) tvv;
-
-	/* Plain copy */
-	tnew = tdata_ebase_new();
-	tnew->enum_d = tebase->enum_d;
-
-	*res = tdata_item_new(tic_tebase);
-	(*res)->u.tebase = tnew;
-}
-
-/** Substitute type variables in a enum type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tenum(tdata_enum_t *tenum,
-    tdata_tvv_t *tvv, tdata_item_t **res)
-{
-	tdata_enum_t *tnew;
-
-	(void) tvv;
-
-	/* Plain copy */
-	tnew = tdata_enum_new();
-	tnew->enum_d = tenum->enum_d;
-
-	*res = tdata_item_new(tic_tenum);
-	(*res)->u.tenum = tnew;
-}
-
-/** Substitute type variables in a functional type item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tfun(tdata_fun_t *torig, tdata_tvv_t *tvv,
-    tdata_item_t **res)
-{
-	tdata_fun_t *tnew;
-
-	tnew = tdata_fun_new();
-	tdata_item_subst_fun_sig(torig->tsig, tvv, &tnew->tsig);
-
-	*res = tdata_item_new(tic_tfun);
-	(*res)->u.tfun = tnew;
-}
-
-/** Substitute type variables in a type-variable reference item.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_tvref(tdata_vref_t *tvref, tdata_tvv_t *tvv,
-    tdata_item_t **res)
-{
-	tdata_item_t *ti_new;
-
-	ti_new = tdata_tvv_get_val(tvv, tvref->targ->name->sid);
-	assert(ti_new != NULL);
-
-	/* XXX Might be better to clone here. */
-	*res = ti_new;
-}
-
-/** Substitute type variables in a function signature type fragment.
- *
- * @param torig	Type item to substitute into.
- * @param tvv	Type variable valuation (values of type variables).
- * @param res	Place to store pointer to new type item.
- */
-static void tdata_item_subst_fun_sig(tdata_fun_sig_t *torig, tdata_tvv_t *tvv,
-    tdata_fun_sig_t **res)
-{
-	tdata_fun_sig_t *tnew;
-	list_node_t *arg_n;
-	tdata_item_t *arg_ti;
-	tdata_item_t *narg_ti = NULL;
-
-	tnew = tdata_fun_sig_new();
-
-	/* Substitute type of each argument */
-	list_init(&tnew->arg_ti);
-	arg_n = list_first(&torig->arg_ti);
-	while (arg_n != NULL) {
-		arg_ti = list_node_data(arg_n, tdata_item_t *);
-
-		/* XXX Because of overloaded Builtin.WriteLine */
-		if (arg_ti == NULL)
-			narg_ti = NULL;
-		else
-			tdata_item_subst(arg_ti, tvv, &narg_ti);
-
-		list_append(&tnew->arg_ti, narg_ti);
-
-		arg_n = list_next(&torig->arg_ti, arg_n);
-	}
-
-	/* Substitute type of variadic argument */
-	if (torig->varg_ti != NULL)
-		tdata_item_subst(torig->varg_ti, tvv, &tnew->varg_ti);
-
-	/* Substitute return type */
-	if (torig->rtype != NULL)
-		tdata_item_subst(torig->rtype, tvv, &tnew->rtype);
-
-	*res = tnew;
-}
-
-/** Print type item.
- *
- * @param titem	Type item
- */
-void tdata_item_print(tdata_item_t *titem)
-{
-	if (titem == NULL) {
-		printf("none");
-		return;
-	}
-
-	switch (titem->tic) {
-	case tic_tprimitive:
-		tdata_tprimitive_print(titem->u.tprimitive);
-		break;
-	case tic_tobject:
-		tdata_tobject_print(titem->u.tobject);
-		break;
-	case tic_tarray:
-		tdata_tarray_print(titem->u.tarray);
-		break;
-	case tic_tdeleg:
-		tdata_tdeleg_print(titem->u.tdeleg);
-		break;
-	case tic_tebase:
-		tdata_tebase_print(titem->u.tebase);
-		break;
-	case tic_tenum:
-		tdata_tenum_print(titem->u.tenum);
-		break;
-	case tic_tfun:
-		tdata_tfun_print(titem->u.tfun);
-		break;
-	case tic_tvref:
-		tdata_tvref_print(titem->u.tvref);
-		break;
-	case tic_ignore:
-		printf("ignore");
-		break;
-	}
-}
-
-/** Print primitive type item.
- *
- * @param tprimitive	Primitive type item
- */
-static void tdata_tprimitive_print(tdata_primitive_t *tprimitive)
-{
-	switch (tprimitive->tpc) {
-	case tpc_bool:
-		printf("bool");
-		break;
-	case tpc_char:
-		printf("char");
-		break;
-	case tpc_int:
-		printf("int");
-		break;
-	case tpc_nil:
-		printf("nil");
-		break;
-	case tpc_string:
-		printf("string");
-		break;
-	case tpc_resource:
-		printf("resource");
-		break;
-	}
-}
-
-/** Print object type item.
- *
- * @param tobject	Object type item
- */
-static void tdata_tobject_print(tdata_object_t *tobject)
-{
-	stree_symbol_t *csi_sym;
-	list_node_t *arg_n;
-	tdata_item_t *arg;
-
-	csi_sym = csi_to_symbol(tobject->csi);
-	assert(csi_sym != NULL);
-	symbol_print_fqn(csi_sym);
-
-	arg_n = list_first(&tobject->targs);
-	while (arg_n != NULL) {
-		arg = list_node_data(arg_n, tdata_item_t *);
-		putchar('/');
-		tdata_item_print(arg);
-		arg_n = list_next(&tobject->targs, arg_n);
-	}
-}
-
-/** Print array type item.
- *
- * @param tarray	Array type item
- */
-static void tdata_tarray_print(tdata_array_t *tarray)
-{
-	int i;
-
-	tdata_item_print(tarray->base_ti);
-
-	printf("[");
-	for (i = 0; i < tarray->rank - 1; ++i)
-		printf(",");
-	printf("]");
-}
-
-/** Print delegate type item.
- *
- * @param tdeleg	Delegate type item
- */
-static void tdata_tdeleg_print(tdata_deleg_t *tdeleg)
-{
-	stree_symbol_t *deleg_sym;
-
-	deleg_sym = deleg_to_symbol(tdeleg->deleg);
-	symbol_print_fqn(deleg_sym);
-}
-
-/** Print enum-base type item.
- *
- * @param tebase		Enum-base type item
- */
-static void tdata_tebase_print(tdata_ebase_t *tebase)
-{
-	stree_symbol_t *enum_sym;
-
-	enum_sym = enum_to_symbol(tebase->enum_d);
-
-	printf("typeref(");
-	symbol_print_fqn(enum_sym);
-	printf(")");
-}
-
-/** Print enum type item.
- *
- * @param tenum		Enum type item
- */
-static void tdata_tenum_print(tdata_enum_t *tenum)
-{
-	stree_symbol_t *enum_sym;
-
-	enum_sym = enum_to_symbol(tenum->enum_d);
-	symbol_print_fqn(enum_sym);
-}
-
-/** Print function type item.
- *
- * @param tfun		Function type item
- */
-static void tdata_tfun_print(tdata_fun_t *tfun)
-{
-	list_node_t *arg_n;
-	tdata_item_t *arg_ti;
-	bool_t first;
-
-	printf("fun(");
-
-	arg_n = list_first(&tfun->tsig->arg_ti);
-	first = b_true;
-	while (arg_n != NULL) {
-		if (first == b_false)
-			printf("; ");
-		else
-			first = b_false;
-
-		arg_ti = list_node_data(arg_n, tdata_item_t *);
-		tdata_item_print(arg_ti);
-
-		arg_n = list_next(&tfun->tsig->arg_ti, arg_n);
-	}
-
-	printf(") : ");
-	tdata_item_print(tfun->tsig->rtype);
-}
-
-/** Print type variable reference type item.
- *
- * @param tvref		Type variable reference type item
- */
-static void tdata_tvref_print(tdata_vref_t *tvref)
-{
-	printf("%s", strtab_get_str(tvref->targ->name->sid));
-}
-
-/** Allocate new type item.
- *
- * @param tic	Type item class
- * @return	New type item
- */
-tdata_item_t *tdata_item_new(titem_class_t tic)
-{
-	tdata_item_t *titem;
-
-	titem = calloc(1, sizeof(tdata_item_t));
-	if (titem == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	titem->tic = tic;
-	return titem;
-}
-
-/** Allocate new array type item.
- *
- * @return	New array type item
- */
-tdata_array_t *tdata_array_new(void)
-{
-	tdata_array_t *tarray;
-
-	tarray = calloc(1, sizeof(tdata_array_t));
-	if (tarray == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tarray;
-}
-
-/** Allocate new object type item.
- *
- * @return	New object type item
- */
-tdata_object_t *tdata_object_new(void)
-{
-	tdata_object_t *tobject;
-
-	tobject = calloc(1, sizeof(tdata_object_t));
-	if (tobject == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tobject;
-}
-
-/** Allocate new primitive type item.
- *
- * @return	New primitive type item
- */
-tdata_primitive_t *tdata_primitive_new(tprimitive_class_t tpc)
-{
-	tdata_primitive_t *tprimitive;
-
-	tprimitive = calloc(1, sizeof(tdata_primitive_t));
-	if (tprimitive == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	tprimitive->tpc = tpc;
-	return tprimitive;
-}
-
-/** Allocate new delegate type item.
- *
- * @return	New function type item
- */
-tdata_deleg_t *tdata_deleg_new(void)
-{
-	tdata_deleg_t *tdeleg;
-
-	tdeleg = calloc(1, sizeof(tdata_deleg_t));
-	if (tdeleg == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tdeleg;
-}
-
-/** Allocate new enum-base type item.
- *
- * @return	New enum type item
- */
-tdata_ebase_t *tdata_ebase_new(void)
-{
-	tdata_ebase_t *tebase;
-
-	tebase = calloc(1, sizeof(tdata_ebase_t));
-	if (tebase == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tebase;
-}
-
-/** Allocate new enum type item.
- *
- * @return	New enum type item
- */
-tdata_enum_t *tdata_enum_new(void)
-{
-	tdata_enum_t *tenum;
-
-	tenum = calloc(1, sizeof(tdata_enum_t));
-	if (tenum == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tenum;
-}
-
-/** Allocate new functional type item.
- *
- * @return	New function type item
- */
-tdata_fun_t *tdata_fun_new(void)
-{
-	tdata_fun_t *tfun;
-
-	tfun = calloc(1, sizeof(tdata_fun_t));
-	if (tfun == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tfun;
-}
-
-/** Allocate new type variable reference type item.
- *
- * @return	New type variable reference type item
- */
-tdata_vref_t *tdata_vref_new(void)
-{
-	tdata_vref_t *tvref;
-
-	tvref = calloc(1, sizeof(tdata_vref_t));
-	if (tvref == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tvref;
-}
-
-/** Allocate new function signature type fragment.
- *
- * @return	New function signature type fragment
- */
-tdata_fun_sig_t *tdata_fun_sig_new(void)
-{
-	tdata_fun_sig_t *tfun_sig;
-
-	tfun_sig = calloc(1, sizeof(tdata_fun_sig_t));
-	if (tfun_sig == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tfun_sig;
-}
-
-/** Create a new type variable valuation.
- *
- * @retrun	New type variable valuation
- */
-tdata_tvv_t *tdata_tvv_new(void)
-{
-	tdata_tvv_t *tvv;
-
-	tvv = calloc(1, sizeof(tdata_tvv_t));
-	if (tvv == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return tvv;
-}
-
-/** Get type variable value.
- *
- * Looks up value of the variable with name SID @a name in type
- * variable valuation @a tvv.
- *
- * @param tvv		Type variable valuation
- * @param name		Name of the variable (SID)
- * @return		Value of the type variable (type item) or @c NULL
- *			if not defined in @a tvv
- */
-tdata_item_t *tdata_tvv_get_val(tdata_tvv_t *tvv, sid_t name)
-{
-	return (tdata_item_t *)intmap_get(&tvv->tvv, name);
-}
-
-/** Set type variable value.
- *
- * Sets the value of variable with name SID @a name in type variable
- * valuation @a tvv to the value @a tvalue.
- *
- * @param tvv		Type variable valuation
- * @param name		Name of the variable (SID)
- * @param tvalue	Value to set (type item) or @c NULL to unset
- */
-void tdata_tvv_set_val(tdata_tvv_t *tvv, sid_t name, tdata_item_t *tvalue)
-{
-	intmap_set(&tvv->tvv, name, tvalue);
-}
Index: pace/app/sbi/src/tdata.h
===================================================================
--- uspace/app/sbi/src/tdata.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TDATA_H_
-#define TDATA_H_
-
-#include "mytypes.h"
-
-tdata_item_t *tdata_item_new(titem_class_t tic);
-tdata_array_t *tdata_array_new(void);
-tdata_object_t *tdata_object_new(void);
-tdata_primitive_t *tdata_primitive_new(tprimitive_class_t tpc);
-tdata_deleg_t *tdata_deleg_new(void);
-tdata_ebase_t *tdata_ebase_new(void);
-tdata_enum_t *tdata_enum_new(void);
-tdata_fun_t *tdata_fun_new(void);
-tdata_vref_t *tdata_vref_new(void);
-
-tdata_fun_sig_t *tdata_fun_sig_new(void);
-
-tdata_tvv_t *tdata_tvv_new(void);
-tdata_item_t *tdata_tvv_get_val(tdata_tvv_t *tvv, sid_t name);
-void tdata_tvv_set_val(tdata_tvv_t *tvv, sid_t name, tdata_item_t *tvalue);
-
-bool_t tdata_is_csi_derived_from_ti(stree_csi_t *a, tdata_item_t *tb);
-bool_t tdata_is_ti_derived_from_ti(tdata_item_t *ta, tdata_item_t *tb);
-bool_t tdata_item_equal(tdata_item_t *a, tdata_item_t *b);
-
-void tdata_item_subst(tdata_item_t *ti, tdata_tvv_t *tvv, tdata_item_t **res);
-void tdata_item_print(tdata_item_t *titem);
-
-#endif
Index: pace/app/sbi/src/tdata_t.h
===================================================================
--- uspace/app/sbi/src/tdata_t.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Static type system representation. */
-
-#ifndef TDATA_T_H_
-#define TDATA_T_H_
-
-#include "intmap_t.h"
-
-/** Class of primitive type. */
-typedef enum {
-	/** Boolean type */
-	tpc_bool,
-	/** Character type */
-	tpc_char,
-	/** Integer type */
-	tpc_int,
-	/** Special type for nil reference */
-	tpc_nil,
-	/** String type */
-	tpc_string,
-	/** Resource type */
-	tpc_resource
-} tprimitive_class_t;
-
-/** Primitive type. */
-typedef struct {
-	/** Class of primitive type */
-	tprimitive_class_t tpc;
-} tdata_primitive_t;
-
-/** Object type. */
-typedef struct {
-	/** @c sn_static if expression is a static CSI reference */
-	statns_t static_ref;
-
-	/** CSI definition */
-	struct stree_csi *csi;
-
-	/** (Real) type arguments */
-	list_t targs; /* of tdata_item_t */
-} tdata_object_t;
-
-/** Array type. */
-typedef struct {
-	/** Base type item */
-	struct tdata_item *base_ti;
-
-	/** Rank */
-	int rank;
-
-	/** Extents */
-	list_t extents; /* of stree_expr_t */
-} tdata_array_t;
-
-/** Function signature type.
- *
- * This is a part of functional type or delegate type.
- */
-typedef struct {
-	/** Types of fixed arguments. */
-	list_t arg_ti; /* of tdata_item_t */
-
-	/** Type of variadic argument */
-	struct tdata_item *varg_ti;
-
-	/** Return type */
-	struct tdata_item *rtype;
-} tdata_fun_sig_t;
-
-/** Delegate type. */
-typedef struct {
-	/** Delegate definition or @c NULL if anonymous delegate */
-	struct stree_deleg *deleg;
-
-	/** Delegate signature type */
-	tdata_fun_sig_t *tsig;
-} tdata_deleg_t;
-
-/** Enum-base type.
- *
- * Type for expression which reference an enum declaration. In run time
- * enum type reference is represented by @c rdata_deleg_t. (Which is used
- * for any symbol references).
- */
-typedef struct {
-	/** Enum definition */
-	struct stree_enum *enum_d;
-} tdata_ebase_t;
-
-/** Enum type. */
-typedef struct {
-	/** Enum definition */
-	struct stree_enum *enum_d;
-} tdata_enum_t;
-
-/** Functional type. */
-typedef struct {
-	/** Delegate definition or @c NULL if anonymous delegate */
-	struct stree_deleg *deleg;
-
-	/** Function signature type */
-	tdata_fun_sig_t *tsig;
-} tdata_fun_t;
-
-/** Type variable reference. */
-typedef struct {
-	/** Definition of type argument this variable is referencing. */
-	struct stree_targ *targ;
-} tdata_vref_t;
-
-typedef enum {
-	/** Primitive type item */
-	tic_tprimitive,
-	/** Object type item */
-	tic_tobject,
-	/** Array type item */
-	tic_tarray,
-	/** Delegate type item */
-	tic_tdeleg,
-	/** Enum-base type item */
-	tic_tebase,
-	/** Enum type item */
-	tic_tenum,
-	/** Function type item */
-	tic_tfun,
-	/** Type variable item */
-	tic_tvref,
-	/** Special error-recovery type item */
-	tic_ignore
-} titem_class_t;
-
-/** Type item, the result of evaluating a type expression. */
-typedef struct tdata_item {
-	titem_class_t tic;
-
-	union {
-		tdata_primitive_t *tprimitive;
-		tdata_object_t *tobject;
-		tdata_array_t *tarray;
-		tdata_deleg_t *tdeleg;
-		tdata_ebase_t *tebase;
-		tdata_enum_t *tenum;
-		tdata_fun_t *tfun;
-		tdata_vref_t *tvref;
-	} u;
-} tdata_item_t;
-
-/** Type variable valuation (mapping of type argument names to values). */
-typedef struct {
-	/** Maps name SID to type item */
-	intmap_t tvv; /* of tdata_item_t */
-} tdata_tvv_t;
-
-#endif
Index: pace/app/shutdown-dlg/doc/doxygroups.h
===================================================================
--- uspace/app/shutdown-dlg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup shutdown-dlg shutdown-dlg
- * @brief Shutdown dialog
- * @ingroup apps
- */
Index: pace/app/shutdown-dlg/meson.build
===================================================================
--- uspace/app/shutdown-dlg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'system', 'ui' ]
-src = files(
-	'shutdown-dlg.c',
-)
Index: pace/app/shutdown-dlg/shutdown-dlg.c
===================================================================
--- uspace/app/shutdown-dlg/shutdown-dlg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,582 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup shutdown-dlg
- * @{
- */
-/** @file Shutdown dialog
- */
-
-#include <gfx/coord.h>
-#include <gfx/render.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <system.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/msgdialog.h>
-#include <ui/resource.h>
-#include <ui/selectdialog.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "shutdown-dlg.h"
-
-static void wnd_close(ui_window_t *, void *);
-static errno_t bg_wnd_paint(ui_window_t *, void *);
-static void shutdown_progress_destroy(shutdown_progress_t *);
-static errno_t shutdown_confirm_create(shutdown_dlg_t *);
-static errno_t shutdown_failed_msg_create(shutdown_dlg_t *);
-static errno_t shutdown_start(shutdown_dlg_t *, sd_action_t);
-
-static ui_window_cb_t bg_window_cb = {
-	.close = wnd_close,
-	.paint = bg_wnd_paint
-};
-
-static ui_window_cb_t progress_window_cb = {
-	.close = wnd_close
-};
-
-static void sd_shutdown_complete(void *);
-static void sd_shutdown_failed(void *);
-
-static system_cb_t sd_system_cb = {
-	.shutdown_complete = sd_shutdown_complete,
-	.shutdown_failed = sd_shutdown_failed
-};
-
-static void shutdown_confirm_bok(ui_select_dialog_t *, void *, void *);
-static void shutdown_confirm_bcancel(ui_select_dialog_t *, void *);
-static void shutdown_confirm_close(ui_select_dialog_t *, void *);
-
-static ui_select_dialog_cb_t shutdown_confirm_cb = {
-	.bok = shutdown_confirm_bok,
-	.bcancel = shutdown_confirm_bcancel,
-	.close = shutdown_confirm_close
-};
-
-static void shutdown_failed_msg_button(ui_msg_dialog_t *, void *, unsigned);
-static void shutdown_failed_msg_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t shutdown_failed_msg_cb = {
-	.button = shutdown_failed_msg_button,
-	.close = shutdown_failed_msg_close
-};
-
-/** System shutdown complete.
- *
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void sd_shutdown_complete(void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *)arg;
-
-	ui_lock(sddlg->ui);
-	(void)ui_label_set_text(sddlg->progress->label,
-	    "Shutdown complete. It is now safe to remove power.");
-	(void)ui_window_paint(sddlg->progress->window);
-	ui_unlock(sddlg->ui);
-}
-
-/** System shutdown failed.
- *
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void sd_shutdown_failed(void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *)arg;
-
-	ui_lock(sddlg->ui);
-	shutdown_progress_destroy(sddlg->progress);
-	sddlg->progress = NULL;
-	ui_window_destroy(sddlg->bgwindow);
-	sddlg->bgwindow = NULL;
-	(void)shutdown_failed_msg_create(sddlg);
-	ui_unlock(sddlg->ui);
-}
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	(void)window;
-	(void)arg;
-}
-
-/** Paint background window.
- *
- * @param window Window
- * @param arg Argument (shutdown_dlg_t *)
- */
-static errno_t bg_wnd_paint(ui_window_t *window, void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *)arg;
-	gfx_rect_t app_rect;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	gc = ui_window_get_gc(window);
-
-	rc = gfx_set_color(gc, sddlg->bg_color);
-	if (rc != EOK)
-		return rc;
-
-	ui_window_get_app_rect(window, &app_rect);
-
-	rc = gfx_fill_rect(gc, &app_rect);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Create shutdown confirmation dialog.
- *
- * @param sddlg Shutdown dialog
- * @return EOK on success or an error code
- */
-static errno_t shutdown_confirm_create(shutdown_dlg_t *sddlg)
-{
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Shutdown";
-	params.prompt = "Do you want to shut the system down?";
-	params.flags |= usdf_topmost | usdf_center;
-
-	rc = ui_select_dialog_create(sddlg->ui, &params, &dialog);
-	if (rc != EOK)
-		return rc;
-
-	/* Need an entry to select */
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "Power off";
-	attr.arg = (void *)sd_poweroff;
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK)
-		goto error;
-
-	attr.caption = "Restart";
-	attr.arg = (void *)sd_restart;
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK)
-		goto error;
-
-	ui_select_dialog_set_cb(dialog, &shutdown_confirm_cb, sddlg);
-
-	(void)ui_select_dialog_paint(dialog);
-
-	return EOK;
-error:
-	ui_select_dialog_destroy(dialog);
-	return rc;
-}
-
-/** Create 'shutdown failed' message dialog.
- *
- * @param sddlg Shutdown dialog
- * @return EOK on success or an error code
- */
-static errno_t shutdown_failed_msg_create(shutdown_dlg_t *sddlg)
-{
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Shutdown failed";
-	params.text = "The system failed to shut down properly.";
-
-	rc = ui_msg_dialog_create(sddlg->ui, &params, &dialog);
-	if (rc != EOK)
-		return rc;
-
-	ui_msg_dialog_set_cb(dialog, &shutdown_failed_msg_cb, sddlg);
-
-	return EOK;
-}
-
-/** Shutdown confirm dialog OK button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- * @param earg Entry argument
- */
-static void shutdown_confirm_bok(ui_select_dialog_t *dialog, void *arg,
-    void *earg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg;
-
-	ui_select_dialog_destroy(dialog);
-
-	shutdown_start(sddlg, (sd_action_t)earg);
-}
-
-/** Shutdown confirm dialog Cancel button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void shutdown_confirm_bcancel(ui_select_dialog_t *dialog, void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg;
-
-	ui_select_dialog_destroy(dialog);
-	ui_quit(sddlg->ui);
-}
-
-/** Shutdown confirm message dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void shutdown_confirm_close(ui_select_dialog_t *dialog, void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg;
-
-	ui_select_dialog_destroy(dialog);
-	ui_quit(sddlg->ui);
-}
-
-/** Shutdown faield message dialog button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- * @param bnum Button number
- */
-static void shutdown_failed_msg_button(ui_msg_dialog_t *dialog,
-    void *arg, unsigned bnum)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sddlg->ui);
-}
-
-/** Shutdown failed message dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void shutdown_failed_msg_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	shutdown_dlg_t *sddlg = (shutdown_dlg_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sddlg->ui);
-}
-
-/** Create shutdown progress window.
- *
- * @param sddlg Shutdown dialog
- * @param rprogress Place to store pointer to new progress window
- * @return EOK on success or an error code
- */
-static errno_t shutdown_progress_create(shutdown_dlg_t *sddlg,
-    shutdown_progress_t **rprogress)
-{
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-	shutdown_progress_t *progress;
-	ui_fixed_t *fixed = NULL;
-	errno_t rc;
-
-	ui_wnd_params_init(&params);
-	params.caption = "Shut down";
-	params.style &= ~ui_wds_titlebar;
-	params.flags |= ui_wndf_topmost;
-	params.placement = ui_wnd_place_center;
-	if (ui_is_textmode(sddlg->ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 64;
-		params.rect.p1.y = 5;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 450;
-		params.rect.p1.y = 60;
-	}
-
-	progress = calloc(1, sizeof(shutdown_progress_t));
-	if (progress == NULL) {
-		rc = ENOMEM;
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = ui_window_create(sddlg->ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &progress_window_cb, (void *) &sddlg);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	rc = ui_label_create(ui_res, "The system is shutting down...",
-	    &progress->label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		goto error;
-	}
-
-	ui_window_get_app_rect(window, &rect);
-	ui_label_set_rect(progress->label, &rect);
-	ui_label_set_halign(progress->label, gfx_halign_center);
-	ui_label_set_valign(progress->label, gfx_valign_center);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(progress->label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		ui_label_destroy(progress->label);
-		progress->label = NULL;
-		goto error;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	progress->window = window;
-	progress->fixed = fixed;
-	*rprogress = progress;
-	return EOK;
-error:
-	if (progress != NULL && progress->fixed != NULL)
-		ui_fixed_destroy(progress->fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (progress != NULL)
-		free(progress);
-	return rc;
-}
-
-/** Destroy shutdown progress window.
- *
- * @param sddlg Shutdown dialog
- * @param rprogress Place to store pointer to new progress window
- * @return EOK on success or an error code
- */
-static void shutdown_progress_destroy(shutdown_progress_t *progress)
-{
-	if (progress == NULL)
-		return;
-
-	ui_window_destroy(progress->window);
-	free(progress);
-}
-
-/** Start shutdown.
- *
- * @param sddlg Shutdown dialog
- * @param action Shutdown actin
- * @return EOK on success or an error code
- */
-static errno_t shutdown_start(shutdown_dlg_t *sddlg, sd_action_t action)
-{
-	errno_t rc;
-
-	rc = shutdown_progress_create(sddlg, &sddlg->progress);
-	if (rc != EOK)
-		return rc;
-
-	rc = system_open(SYSTEM_DEFAULT, &sd_system_cb, sddlg, &sddlg->system);
-	if (rc != EOK) {
-		printf("Failed opening system control service.\n");
-		goto error;
-	}
-
-	rc = EINVAL;
-
-	switch (action) {
-	case sd_poweroff:
-		rc = system_poweroff(sddlg->system);
-		break;
-	case sd_restart:
-		rc = system_restart(sddlg->system);
-		break;
-	}
-
-	if (rc != EOK) {
-		printf("Failed requesting system shutdown.\n");
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Run shutdown dialog on display. */
-static errno_t shutdown_dlg(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	shutdown_dlg_t sddlg;
-	ui_wnd_params_t params;
-	errno_t rc;
-
-	memset((void *) &sddlg, 0, sizeof(sddlg));
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	sddlg.ui = ui;
-
-	ui_wnd_params_init(&params);
-	params.caption = "Shutdown";
-	params.style &= ~ui_wds_decorated;
-	params.placement = ui_wnd_place_full_screen;
-	params.flags |= ui_wndf_topmost | ui_wndf_nofocus;
-
-	rc = ui_window_create(sddlg.ui, &params, &sddlg.bgwindow);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(sddlg.bgwindow, &bg_window_cb, (void *)&sddlg);
-
-	if (ui_is_textmode(sddlg.ui)) {
-		rc = gfx_color_new_ega(0x17, &sddlg.bg_color);
-		if (rc != EOK) {
-			printf("Error allocating color.\n");
-			goto error;
-		}
-	} else {
-		rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &sddlg.bg_color);
-		if (rc != EOK) {
-			printf("Error allocating color.\n");
-			goto error;
-		}
-	}
-
-	rc = ui_window_paint(sddlg.bgwindow);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	(void)shutdown_confirm_create(&sddlg);
-
-	ui_run(ui);
-
-	shutdown_progress_destroy(sddlg.progress);
-	if (sddlg.bgwindow != NULL)
-		ui_window_destroy(sddlg.bgwindow);
-	if (sddlg.system != NULL)
-		system_close(sddlg.system);
-	gfx_color_delete(sddlg.bg_color);
-	ui_destroy(ui);
-
-	return EOK;
-error:
-	if (sddlg.system != NULL)
-		system_close(sddlg.system);
-	if (sddlg.bg_color != NULL)
-		gfx_color_delete(sddlg.bg_color);
-	if (sddlg.bgwindow != NULL)
-		ui_window_destroy(sddlg.bgwindow);
-	if (ui != NULL)
-		ui_destroy(ui);
-	return rc;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: shutdown-dlg [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = shutdown_dlg(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/shutdown-dlg/shutdown-dlg.h
===================================================================
--- uspace/app/shutdown-dlg/shutdown-dlg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup shutdown-dlg
- * @{
- */
-/**
- * @file Shutdown dialog
- */
-
-#ifndef SHUTDOWN_DLG_H
-#define SHUTDOWN_DLG_H
-
-#include <gfx/color.h>
-#include <system.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Shutdown progress window. */
-typedef struct {
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_label_t *label;
-} shutdown_progress_t;
-
-/** Shutdown dialog. */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *bgwindow;
-	gfx_color_t *bg_color;
-	shutdown_progress_t *progress;
-	system_t *system;
-} shutdown_dlg_t;
-
-/** Shutdown action */
-typedef enum {
-	sd_poweroff = 1,
-	sd_restart
-} sd_action_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/shutdown/doc/doxygroups.h
===================================================================
--- uspace/app/shutdown/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup shutdown shutdown
- * @brief Shut the system down
- * @ingroup apps
- */
Index: pace/app/shutdown/meson.build
===================================================================
--- uspace/app/shutdown/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clui', 'system' ]
-src = files('shutdown.c')
Index: pace/app/shutdown/shutdown.c
===================================================================
--- uspace/app/shutdown/shutdown.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,256 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup lprint
- * @{
- */
-
-/**
- * @file
- * @brief Shut the system down
- *
- */
-
-#include <fibril_synch.h>
-#include <nchoice.h>
-#include <shutdown.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <str.h>
-#include <system.h>
-#include "shutdown.h"
-
-#define NAME "shutdown"
-
-static void syntax_print(void);
-
-static sd_action_t action;
-
-static void sd_shutdown_complete(void *);
-static void sd_shutdown_failed(void *);
-
-static system_cb_t sd_system_cb = {
-	.shutdown_complete = sd_shutdown_complete,
-	.shutdown_failed = sd_shutdown_failed
-};
-
-/** System shutdown complete.
- *
- * @param arg Argument (shutdown_t *)
- */
-static void sd_shutdown_complete(void *arg)
-{
-	shutdown_t *shutdown = (shutdown_t *)arg;
-
-	fibril_mutex_lock(&shutdown->lock);
-	shutdown->stopped = true;
-	shutdown->failed = false;
-	fibril_condvar_broadcast(&shutdown->cv);
-	fibril_mutex_unlock(&shutdown->lock);
-}
-
-/** System shutdown failed.
- *
- * @param arg Argument (not used)
- */
-static void sd_shutdown_failed(void *arg)
-{
-	shutdown_t *shutdown = (shutdown_t *)arg;
-
-	fibril_mutex_lock(&shutdown->lock);
-	shutdown->stopped = true;
-	shutdown->failed = true;
-	fibril_condvar_broadcast(&shutdown->cv);
-	fibril_mutex_unlock(&shutdown->lock);
-}
-
-/** Interactively choose the shutdown action to perform
- *
- * @return EOK on success or an error code
- */
-static errno_t choose_action(void)
-{
-	errno_t rc;
-	nchoice_t *nchoice = NULL;
-	void *choice;
-
-	rc = nchoice_create(&nchoice);
-	if (rc != EOK) {
-		printf(NAME ": Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_set_prompt(nchoice, "Do you want to shut the system down? "
-	    "Select action:");
-	if (rc != EOK) {
-		printf(NAME ": Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_add(nchoice, "Power off", (void *)(uintptr_t)sd_poweroff,
-	    0);
-	if (rc != EOK) {
-		printf(NAME ": Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_add(nchoice, "Restart", (void *)(uintptr_t)sd_restart,
-	    0);
-	if (rc != EOK) {
-		printf(NAME ": Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_add(nchoice, "Cancel", (void *)(uintptr_t)sd_cancel,
-	    ncf_default);
-	if (rc != EOK) {
-		printf(NAME ": Out of memory.\n");
-		goto error;
-	}
-
-	rc = nchoice_get(nchoice, &choice);
-	if (rc != EOK) {
-		if (rc != ENOENT)
-			printf(NAME ": Error getting user choice.\n");
-		goto error;
-	}
-
-	action = (sd_action_t)choice;
-	nchoice_destroy(nchoice);
-	return EOK;
-error:
-	if (nchoice != NULL)
-		nchoice_destroy(nchoice);
-	return rc;
-}
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	system_t *system = NULL;
-	shutdown_t shutdown;
-
-	--argc;
-	++argv;
-
-	while (*argv != NULL && *argv[0] == '-') {
-		if (str_cmp(*argv, "-p") == 0) {
-			--argc;
-			++argv;
-			action = sd_poweroff;
-			continue;
-		} else if (str_cmp(*argv, "-r") == 0) {
-			--argc;
-			++argv;
-			action = sd_restart;
-			continue;
-		}
-
-		printf(NAME ": Error, invalid option.\n");
-		syntax_print();
-		return 1;
-	}
-
-	if (argc >= 1) {
-		printf(NAME ": Error, unexpected argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	if (action == 0)
-		choose_action();
-
-	if (action == sd_cancel)
-		return 0;
-
-	fibril_mutex_initialize(&shutdown.lock);
-	fibril_condvar_initialize(&shutdown.cv);
-	shutdown.stopped = false;
-	shutdown.failed = false;
-
-	rc = system_open(SYSTEM_DEFAULT, &sd_system_cb, &shutdown, &system);
-	if (rc != EOK) {
-		printf(NAME ": Failed opening system control service.\n");
-		return 1;
-	}
-
-	switch (action) {
-	case sd_poweroff:
-		rc = system_poweroff(system);
-		break;
-	case sd_restart:
-		rc = system_restart(system);
-		break;
-	case sd_cancel:
-		assert(false);
-		rc = EINVAL;
-		break;
-	}
-
-	if (rc != EOK) {
-		system_close(system);
-		printf(NAME ": Failed requesting system shutdown.\n");
-		return 1;
-	}
-
-	fibril_mutex_lock(&shutdown.lock);
-	printf("The system is shutting down...\n");
-	while (!shutdown.stopped)
-		fibril_condvar_wait(&shutdown.cv, &shutdown.lock);
-
-	if (shutdown.failed) {
-		printf("Shutdown failed.\n");
-		system_close(system);
-		return 1;
-	}
-
-	printf("Shutdown complete. It is now safe to remove power.\n");
-
-	/* Sleep forever */
-	while (true)
-		fibril_condvar_wait(&shutdown.cv, &shutdown.lock);
-
-	fibril_mutex_unlock(&shutdown.lock);
-
-	system_close(system);
-	return 0;
-}
-
-/** Print syntax help. */
-static void syntax_print(void)
-{
-	printf("syntax:\n"
-	    "\tshutdown [<options>]\n"
-	    "options:\n"
-	    "\t-p Power off\n"
-	    "\t-r Restart off\n");
-}
-
-/**
- * @}
- */
Index: pace/app/shutdown/shutdown.h
===================================================================
--- uspace/app/shutdown/shutdown.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup shutdown
- * @{
- */
-/**
- * @file Shut the system down
- */
-
-#ifndef SHUTDOWN_H
-#define SHUTDOWN_H
-
-#include <fibril_synch.h>
-#include <stdbool.h>
-
-/** Shutdown action */
-typedef enum {
-	sd_poweroff = 1,
-	sd_restart,
-	sd_cancel
-} sd_action_t;
-
-/** Shutdown state */
-typedef struct {
-	fibril_mutex_t lock;
-	fibril_condvar_t cv;
-	bool stopped;
-	bool failed;
-} shutdown_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/sportdmp/meson.build
===================================================================
--- uspace/app/sportdmp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('sportdmp.c')
Index: pace/app/sportdmp/sportdmp.c
===================================================================
--- uspace/app/sportdmp/sportdmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,165 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <io/chardev.h>
-#include <io/serial.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define BUF_SIZE 1
-
-static void syntax_print(void)
-{
-	fprintf(stderr, "Usage: sportdmp [--baud=<baud>] [device_service]\n");
-}
-
-int main(int argc, char **argv)
-{
-	sysarg_t baud = 9600;
-	service_id_t svc_id;
-	chardev_t *chardev;
-	serial_t *serial;
-	size_t nread;
-
-	int arg = 1;
-	errno_t rc;
-
-	if (argc > arg && str_test_prefix(argv[arg], "--baud=")) {
-		size_t arg_offset = str_lsize(argv[arg], 7);
-		char *arg_str = argv[arg] + arg_offset;
-		if (str_length(arg_str) == 0) {
-			fprintf(stderr, "--baud requires an argument\n");
-			syntax_print();
-			return 1;
-		}
-		char *endptr;
-		baud = strtol(arg_str, &endptr, 10);
-		if (*endptr != '\0') {
-			fprintf(stderr, "Invalid value for baud\n");
-			syntax_print();
-			return 1;
-		}
-		arg++;
-	}
-
-	if (argc > arg) {
-		rc = loc_service_get_id(argv[arg], &svc_id, 0);
-		if (rc != EOK) {
-			fprintf(stderr, "Cannot find device service %s\n",
-			    argv[arg]);
-			return 1;
-		}
-		arg++;
-	} else {
-		category_id_t serial_cat_id;
-
-		rc = loc_category_get_id("serial", &serial_cat_id, 0);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed getting id of category "
-			    "'serial'\n");
-			return 1;
-		}
-
-		service_id_t *svc_ids;
-		size_t svc_count;
-
-		rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed getting list of services\n");
-			return 1;
-		}
-
-		if (svc_count == 0) {
-			fprintf(stderr, "No service in category 'serial'\n");
-			free(svc_ids);
-			return 1;
-		}
-
-		svc_id = svc_ids[0];
-		free(svc_ids);
-	}
-
-	if (argc > arg) {
-		fprintf(stderr, "Too many arguments\n");
-		syntax_print();
-		return 1;
-	}
-
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
-	    IPC_FLAG_BLOCKING);
-	if (sess == NULL) {
-		fprintf(stderr, "Failed connecting to service\n");
-		return 2;
-	}
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed opening character device\n");
-		return 2;
-	}
-
-	rc = serial_open(sess, &serial);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed opening serial port\n");
-		return 2;
-	}
-
-	rc = serial_set_comm_props(serial, baud, SERIAL_NO_PARITY, 8, 1);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed setting serial properties\n");
-		return 2;
-	}
-
-	uint8_t *buf = (uint8_t *) malloc(BUF_SIZE);
-	if (buf == NULL) {
-		fprintf(stderr, "Failed allocating buffer\n");
-		return 3;
-	}
-
-	while (true) {
-		rc = chardev_read(chardev, buf, BUF_SIZE, &nread,
-		    chardev_f_none);
-		for (size_t i = 0; i < nread; i++) {
-			printf("%02hhx ", buf[i]);
-		}
-		if (rc != EOK) {
-			fprintf(stderr, "\nFailed reading from serial device\n");
-			break;
-		}
-		fflush(stdout);
-	}
-
-	free(buf);
-	serial_close(serial);
-	chardev_close(chardev);
-	async_hangup(sess);
-	return 0;
-}
Index: pace/app/stats/doc/doxygroups.h
===================================================================
--- uspace/app/stats/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup stats stats
- * @brief Print system statistics
- * @ingroup apps
- */
Index: pace/app/stats/meson.build
===================================================================
--- uspace/app/stats/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('stats.c')
Index: pace/app/stats/stats.c
===================================================================
--- uspace/app/stats/stats.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,518 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup stats
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <task.h>
-#include <stats.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <str.h>
-#include <arg_parse.h>
-
-#define NAME  "stats"
-
-#define DAY     86400
-#define HOUR    3600
-#define MINUTE  60
-
-#define KERNEL_NAME  "kernel"
-#define INIT_PREFIX  "init:"
-
-typedef enum {
-	LIST_TASKS,
-	LIST_THREADS,
-	LIST_IPCCS,
-	LIST_CPUS,
-	PRINT_LOAD,
-	PRINT_UPTIME,
-	PRINT_ARCH
-} output_toggle_t;
-
-static void list_tasks(void)
-{
-	size_t count;
-	stats_task_t *stats_tasks = stats_get_tasks(&count);
-
-	if (stats_tasks == NULL) {
-		fprintf(stderr, "%s: Unable to get tasks\n", NAME);
-		return;
-	}
-
-	printf("[taskid] [thrds] [resident] [virtual] [ucycles]"
-	    " [kcycles] [name\n");
-
-	for (size_t i = 0; i < count; i++) {
-		uint64_t resmem;
-		uint64_t virtmem;
-		uint64_t ucycles;
-		uint64_t kcycles;
-		const char *resmem_suffix;
-		const char *virtmem_suffix;
-		char usuffix;
-		char ksuffix;
-
-		bin_order_suffix(stats_tasks[i].resmem, &resmem, &resmem_suffix, true);
-		bin_order_suffix(stats_tasks[i].virtmem, &virtmem, &virtmem_suffix, true);
-		order_suffix(stats_tasks[i].ucycles, &ucycles, &usuffix);
-		order_suffix(stats_tasks[i].kcycles, &kcycles, &ksuffix);
-
-		printf("%-8" PRIu64 " %7zu %7" PRIu64 "%s %6" PRIu64 "%s"
-		    " %8" PRIu64 "%c %8" PRIu64 "%c %s\n",
-		    stats_tasks[i].task_id, stats_tasks[i].threads,
-		    resmem, resmem_suffix, virtmem, virtmem_suffix,
-		    ucycles, usuffix, kcycles, ksuffix, stats_tasks[i].name);
-	}
-
-	free(stats_tasks);
-}
-
-static void list_threads(task_id_t task_id, bool all)
-{
-	size_t count;
-	stats_thread_t *stats_threads = stats_get_threads(&count);
-
-	if (stats_threads == NULL) {
-		fprintf(stderr, "%s: Unable to get threads\n", NAME);
-		return;
-	}
-
-	printf("[taskid] [threadid] [state ] [prio] [cpu ] [ucycles] [kcycles]\n");
-
-	for (size_t i = 0; i < count; i++) {
-		if ((all) || (stats_threads[i].task_id == task_id)) {
-			uint64_t ucycles, kcycles;
-			char usuffix, ksuffix;
-
-			order_suffix(stats_threads[i].ucycles, &ucycles, &usuffix);
-			order_suffix(stats_threads[i].kcycles, &kcycles, &ksuffix);
-
-			printf("%-8" PRIu64 " %-10" PRIu64 " %-8s %6d ",
-			    stats_threads[i].task_id, stats_threads[i].thread_id,
-			    thread_get_state(stats_threads[i].state),
-			    stats_threads[i].priority);
-
-			if (stats_threads[i].on_cpu)
-				printf("%6u ", stats_threads[i].cpu);
-			else
-				printf("(none) ");
-
-			printf("%8" PRIu64 "%c %8" PRIu64 "%c\n",
-			    ucycles, usuffix, kcycles, ksuffix);
-		}
-	}
-
-	free(stats_threads);
-}
-
-static void list_ipccs(task_id_t task_id, bool all)
-{
-	size_t count;
-	stats_ipcc_t *stats_ipccs = stats_get_ipccs(&count);
-
-	if (stats_ipccs == NULL) {
-		fprintf(stderr, "%s: Unable to get IPC connections\n", NAME);
-		return;
-	}
-
-	printf("[caller] [callee]\n");
-
-	for (size_t i = 0; i < count; i++) {
-		if ((all) || (stats_ipccs[i].caller == task_id)) {
-			printf("%-8" PRIu64 " %-8" PRIu64 "\n",
-			    stats_ipccs[i].caller, stats_ipccs[i].callee);
-		}
-	}
-
-	free(stats_ipccs);
-}
-
-static void list_cpus(void)
-{
-	size_t count;
-	stats_cpu_t *cpus = stats_get_cpus(&count);
-
-	if (cpus == NULL) {
-		fprintf(stderr, "%s: Unable to get CPU statistics\n", NAME);
-		return;
-	}
-
-	printf("[id] [MHz     ] [busy cycles] [idle cycles]\n");
-
-	for (size_t i = 0; i < count; i++) {
-		printf("%-4u ", cpus[i].id);
-		if (cpus[i].active) {
-			uint64_t bcycles, icycles;
-			char bsuffix, isuffix;
-
-			order_suffix(cpus[i].busy_cycles, &bcycles, &bsuffix);
-			order_suffix(cpus[i].idle_cycles, &icycles, &isuffix);
-
-			printf("%10" PRIu16 " %12" PRIu64 "%c %12" PRIu64 "%c\n",
-			    cpus[i].frequency_mhz, bcycles, bsuffix,
-			    icycles, isuffix);
-		} else
-			printf("inactive\n");
-	}
-
-	free(cpus);
-}
-
-static void print_load(void)
-{
-	size_t count;
-	load_t *load = stats_get_load(&count);
-
-	if (load == NULL) {
-		fprintf(stderr, "%s: Unable to get load\n", NAME);
-		return;
-	}
-
-	printf("%s: Load average: ", NAME);
-
-	for (size_t i = 0; i < count; i++) {
-		if (i > 0)
-			printf(" ");
-
-		stats_print_load_fragment(load[i], 2);
-	}
-
-	printf("\n");
-
-	free(load);
-}
-
-static void print_uptime(void)
-{
-	struct timespec uptime;
-	getuptime(&uptime);
-
-	printf("%s: Up %lld days, %lld hours, %lld minutes, %lld seconds\n",
-	    NAME, uptime.tv_sec / DAY, (uptime.tv_sec % DAY) / HOUR,
-	    (uptime.tv_sec % HOUR) / MINUTE, uptime.tv_sec % MINUTE);
-}
-
-static char *escape_dot(const char *str)
-{
-	size_t size = 0;
-	for (size_t i = 0; str[i] != 0; i++) {
-		if (str[i] == '"')
-			size++;
-
-		size++;
-	}
-
-	char *escaped_str = calloc(size + 1, sizeof(char));
-	if (escaped_str == NULL)
-		return NULL;
-
-	size_t pos = 0;
-	for (size_t i = 0; str[i] != 0; i++) {
-		if (str[i] == '"') {
-			escaped_str[pos] = '\\';
-			pos++;
-		}
-
-		escaped_str[pos] = str[i];
-		pos++;
-	}
-
-	escaped_str[pos] = 0;
-
-	return escaped_str;
-}
-
-static void print_arch(void)
-{
-	size_t count_tasks;
-	stats_task_t *stats_tasks = stats_get_tasks(&count_tasks);
-
-	if (stats_tasks == NULL) {
-		fprintf(stderr, "%s: Unable to get tasks\n", NAME);
-		return;
-	}
-
-	size_t count_ipccs;
-	stats_ipcc_t *stats_ipccs = stats_get_ipccs(&count_ipccs);
-
-	if (stats_ipccs == NULL) {
-		fprintf(stderr, "%s: Unable to get IPC connections\n", NAME);
-		return;
-	}
-
-	/* Global dot language attributes */
-	printf("digraph HelenOS {\n");
-	printf("\tlayout=sfdp\n");
-	printf("\t// layout=neato\n");
-	printf("\tsplines=true\n");
-	printf("\t// splines=ortho\n");
-	printf("\tconcentrate=true\n");
-	printf("\tcenter=true\n");
-	printf("\toverlap=false\n");
-	printf("\toutputorder=edgesfirst\n");
-	printf("\tfontsize=12\n");
-	printf("\tnode [shape=component style=filled color=red "
-	    "fillcolor=yellow]\n\t\n");
-
-	bool kernel_found = false;
-	task_id_t kernel_id = 0;
-
-	/* Tasks as vertices (components) */
-	for (size_t i = 0; i < count_tasks; i++) {
-		/* Kernel task */
-		bool kernel = (str_cmp(stats_tasks[i].name, KERNEL_NAME) == 0);
-
-		/* Init task */
-		bool init = str_test_prefix(stats_tasks[i].name, INIT_PREFIX);
-
-		char *escaped_name = NULL;
-
-		if (init)
-			escaped_name = escape_dot(str_suffix(stats_tasks[i].name,
-			    str_length(INIT_PREFIX)));
-		else
-			escaped_name = escape_dot(stats_tasks[i].name);
-
-		if (escaped_name == NULL)
-			continue;
-
-		if (kernel) {
-			if (kernel_found) {
-				fprintf(stderr, "%s: Duplicate kernel tasks\n", NAME);
-			} else {
-				kernel_found = true;
-				kernel_id = stats_tasks[i].task_id;
-			}
-
-			printf("\ttask%" PRIu64 " [label=\"%s\" shape=invtrapezium "
-			    "fillcolor=gold]\n", stats_tasks[i].task_id, escaped_name);
-		} else if (init)
-			printf("\ttask%" PRIu64 " [label=\"%s\" fillcolor=orange]\n",
-			    stats_tasks[i].task_id, escaped_name);
-		else
-			printf("\ttask%" PRIu64 " [label=\"%s\"]\n", stats_tasks[i].task_id,
-			    escaped_name);
-
-		free(escaped_name);
-	}
-
-	printf("\t\n");
-
-	if (kernel_found) {
-		/*
-		 * Add an invisible edge from all user
-		 * space tasks to the kernel to increase
-		 * the kernel ranking.
-		 */
-
-		for (size_t i = 0; i < count_tasks; i++) {
-			/* Skip the kernel itself */
-			if (stats_tasks[i].task_id == kernel_id)
-				continue;
-
-			printf("\ttask%" PRIu64 " -> task%" PRIu64 " [style=\"invis\"]\n",
-			    stats_tasks[i].task_id, kernel_id);
-		}
-	}
-
-	printf("\t\n");
-
-	/* IPC connections as edges */
-	for (size_t i = 0; i < count_ipccs; i++) {
-		printf("\ttask%" PRIu64 " -> task%" PRIu64 "\n",
-		    stats_ipccs[i].caller, stats_ipccs[i].callee);
-	}
-
-	printf("}\n");
-
-	free(stats_tasks);
-	free(stats_ipccs);
-}
-
-static void usage(const char *name)
-{
-	printf(
-	    "Usage: %s [-t task_id] [-i task_id] [-at] [-ai] [-c] [-l] [-u] [-d]\n"
-	    "\n"
-	    "Options:\n"
-	    "\t-t task_id | --task=task_id\n"
-	    "\t\tList threads of the given task\n"
-	    "\n"
-	    "\t-i task_id | --ipcc=task_id\n"
-	    "\t\tList IPC connections of the given task\n"
-	    "\n"
-	    "\t-at | --all-threads\n"
-	    "\t\tList all threads\n"
-	    "\n"
-	    "\t-ai | --all-ipccs\n"
-	    "\t\tList all IPC connections\n"
-	    "\n"
-	    "\t-c | --cpus\n"
-	    "\t\tList CPUs\n"
-	    "\n"
-	    "\t-l | --load\n"
-	    "\t\tPrint system load\n"
-	    "\n"
-	    "\t-u | --uptime\n"
-	    "\t\tPrint system uptime\n"
-	    "\n"
-	    "\t-d | --design\n"
-	    "\t\tPrint the current system architecture graph\n"
-	    "\n"
-	    "\t-h | --help\n"
-	    "\t\tPrint this usage information\n"
-	    "\n"
-	    "Without any options all tasks are listed\n",
-	    name);
-}
-
-int main(int argc, char *argv[])
-{
-	output_toggle_t output_toggle = LIST_TASKS;
-	bool toggle_all = false;
-	task_id_t task_id = 0;
-
-	for (int i = 1; i < argc; i++) {
-		int off;
-
-		/* Usage */
-		if ((off = arg_parse_short_long(argv[i], "-h", "--help")) != -1) {
-			usage(argv[0]);
-			return 0;
-		}
-
-		/* All IPC connections */
-		if ((off = arg_parse_short_long(argv[i], "-ai", "--all-ipccs")) != -1) {
-			output_toggle = LIST_IPCCS;
-			toggle_all = true;
-			continue;
-		}
-
-		/* All threads */
-		if ((off = arg_parse_short_long(argv[i], "-at", "--all-threads")) != -1) {
-			output_toggle = LIST_THREADS;
-			toggle_all = true;
-			continue;
-		}
-
-		/* IPC connections */
-		if ((off = arg_parse_short_long(argv[i], "-i", "--ipcc=")) != -1) {
-			// TODO: Support for 64b range
-			int tmp;
-			errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
-			if (ret != EOK) {
-				printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
-				return -1;
-			}
-
-			task_id = tmp;
-
-			output_toggle = LIST_IPCCS;
-			continue;
-		}
-
-		/* Tasks */
-		if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
-			// TODO: Support for 64b range
-			int tmp;
-			errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
-			if (ret != EOK) {
-				printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
-				return -1;
-			}
-
-			task_id = tmp;
-
-			output_toggle = LIST_THREADS;
-			continue;
-		}
-
-		/* CPUs */
-		if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
-			output_toggle = LIST_CPUS;
-			continue;
-		}
-
-		/* Load */
-		if ((off = arg_parse_short_long(argv[i], "-l", "--load")) != -1) {
-			output_toggle = PRINT_LOAD;
-			continue;
-		}
-
-		/* Uptime */
-		if ((off = arg_parse_short_long(argv[i], "-u", "--uptime")) != -1) {
-			output_toggle = PRINT_UPTIME;
-			continue;
-		}
-
-		/* Architecture */
-		if ((off = arg_parse_short_long(argv[i], "-d", "--design")) != -1) {
-			output_toggle = PRINT_ARCH;
-			continue;
-		}
-	}
-
-	switch (output_toggle) {
-	case LIST_TASKS:
-		list_tasks();
-		break;
-	case LIST_THREADS:
-		list_threads(task_id, toggle_all);
-		break;
-	case LIST_IPCCS:
-		list_ipccs(task_id, toggle_all);
-		break;
-	case LIST_CPUS:
-		list_cpus();
-		break;
-	case PRINT_LOAD:
-		print_load();
-		break;
-	case PRINT_UPTIME:
-		print_uptime();
-		break;
-	case PRINT_ARCH:
-		print_arch();
-		break;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/sysinfo/doc/doxygroups.h
===================================================================
--- uspace/app/sysinfo/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup sysinfo sysinfo
- * @brief Utility to read contents of sysinfo
- * @ingroup apps
- */
Index: pace/app/sysinfo/meson.build
===================================================================
--- uspace/app/sysinfo/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('sysinfo.c')
Index: pace/app/sysinfo/sysinfo.c
===================================================================
--- uspace/app/sysinfo/sysinfo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinfo
- * @{
- */
-/** @file sysinfo.c
- * @brief Print value of item from sysinfo tree.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <sysinfo.h>
-#include <stdlib.h>
-#include <str.h>
-
-static void dump_bytes_hex(char *data, size_t size)
-{
-	for (size_t i = 0; i < size; i++) {
-		if (i > 0)
-			putchar(' ');
-		printf("0x%02x", (uint8_t) data[i]);
-	}
-}
-
-static void dump_bytes_text(char *data, size_t size)
-{
-	size_t offset = 0;
-
-	while (offset < size) {
-		char32_t c = str_decode(data, &offset, size);
-		printf("%lc", (wint_t) c);
-	}
-}
-
-static errno_t print_item_val(char *ipath)
-{
-	sysarg_t value;
-	errno_t rc = sysinfo_get_value(ipath, &value);
-	if (rc != EOK) {
-		printf("Error reading item '%s'.\n", ipath);
-		return rc;
-	}
-
-	printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath,
-	    (uint64_t) value, (uint64_t) value);
-
-	return EOK;
-}
-
-static int print_item_data(char *ipath)
-{
-	size_t size;
-	void *data = sysinfo_get_data(ipath, &size);
-	if (data == NULL) {
-		printf("Error reading item '%s'.\n", ipath);
-		return -1;
-	}
-
-	printf("%s -> ", ipath);
-	dump_bytes_hex(data, size);
-	fputs(" ('", stdout);
-	dump_bytes_text(data, size);
-	fputs("')\n", stdout);
-
-	return EOK;
-}
-
-static int print_item_property(char *ipath, char *iprop)
-{
-	size_t size;
-	void *data = sysinfo_get_property(ipath, iprop, &size);
-	if (data == NULL) {
-		printf("Error reading property '%s' of item '%s'.\n", iprop,
-		    ipath);
-		return -1;
-	}
-
-	printf("%s property %s -> ", ipath, iprop);
-	dump_bytes_hex(data, size);
-	fputs(" ('", stdout);
-	dump_bytes_text(data, size);
-	fputs("')\n", stdout);
-
-	return EOK;
-}
-
-static void print_spaces(size_t spaces)
-{
-	for (size_t i = 0; i < spaces; i++)
-		printf(" ");
-}
-
-static void print_keys(const char *path, size_t spaces)
-{
-	size_t size;
-	char *keys = sysinfo_get_keys(path, &size);
-	if ((keys == NULL) || (size == 0))
-		return;
-
-	size_t pos = 0;
-	while (pos < size) {
-		/* Process each key with sanity checks */
-		size_t cur_size = str_nsize(keys + pos, size - pos);
-		if (keys[pos + cur_size] != 0)
-			break;
-
-		size_t path_size = str_size(path) + cur_size + 2;
-		char *cur_path = (char *) malloc(path_size);
-		if (cur_path == NULL)
-			break;
-
-		size_t length;
-
-		if (path[0] != 0) {
-			print_spaces(spaces);
-			printf(".%s\n", keys + pos);
-			length = str_length(keys + pos) + 1;
-
-			snprintf(cur_path, path_size, "%s.%s", path, keys + pos);
-		} else {
-			printf("%s\n", keys + pos);
-			length = str_length(keys + pos);
-
-			snprintf(cur_path, path_size, "%s", keys + pos);
-		}
-
-		print_keys(cur_path, spaces + length);
-
-		free(cur_path);
-		pos += cur_size + 1;
-	}
-
-	free(keys);
-}
-
-int main(int argc, char *argv[])
-{
-	int rc = 0;
-
-	if (argc < 2) {
-		/* Print keys */
-		print_keys("", 0);
-		return rc;
-	}
-
-	char *ipath = argv[1];
-
-	if (argc < 3) {
-		sysinfo_item_val_type_t tag = sysinfo_get_val_type(ipath);
-
-		switch (tag) {
-		case SYSINFO_VAL_UNDEFINED:
-			printf("Error: Sysinfo item '%s' not defined.\n", ipath);
-			rc = 2;
-			break;
-		case SYSINFO_VAL_VAL:
-			rc = print_item_val(ipath);
-			break;
-		case SYSINFO_VAL_DATA:
-			rc = print_item_data(ipath);
-			break;
-		default:
-			printf("Error: Sysinfo item '%s' with unknown value type.\n",
-			    ipath);
-			rc = 2;
-			break;
-		}
-
-		return rc;
-	}
-
-	char *iprop = argv[2];
-	rc = print_item_property(ipath, iprop);
-	return rc;
-}
-
-/** @}
- */
Index: pace/app/sysinst/doc/doxygroups.h
===================================================================
--- uspace/app/sysinst/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup sysinst sysinst
- * @brief System installer
- * @ingroup apps
- */
Index: pace/app/sysinst/grub.h
===================================================================
--- uspace/app/sysinst/grub.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinst
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef GRUB_H
-#define GRUB_H
-
-enum {
-	grub_boot_machine_kernel_sector = 0x5c,
-	grub_boot_machine_boot_drive = 0x64
-};
-
-enum {
-	/* 8086 segment (16*pa) where to load GRUB core image */
-	grub_boot_i386_pc_kernel_seg = 0x800
-};
-
-typedef struct {
-	uint64_t start;
-	uint16_t len;
-	uint16_t segment;
-} __attribute__((packed)) grub_boot_blocklist_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/sysinst/meson.build
===================================================================
--- uspace/app/sysinst/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2025 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fdisk', 'futil', 'sif', 'system', 'ui' ]
-src = files(
-	'rdimg.c',
-	'sysinst.c',
-	'volume.c',
-)
Index: pace/app/sysinst/rdimg.c
===================================================================
--- uspace/app/sysinst/rdimg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinst
- * @{
- */
-/** @file RAM disk image manipulation
- */
-
-#include <errno.h>
-#include <fibril.h>
-#include <io/log.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-
-#include "rdimg.h"
-
-#define FILE_BD "/srv/bd/file_bd"
-#define RD_SVC "bd/iird"
-#define RD_LABEL "HelenOS-rd"
-
-/** Find volume by volume label. */
-static errno_t rd_img_part_by_label(vol_t *vol, const char *label,
-    service_id_t *rid)
-{
-	vol_part_info_t vinfo;
-	service_id_t *part_ids = NULL;
-	size_t nparts;
-	size_t i;
-	errno_t rc;
-
-	rc = vol_get_parts(vol, &part_ids, &nparts);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error getting list of volumes.");
-		goto out;
-	}
-
-	for (i = 0; i < nparts; i++) {
-		rc = vol_part_info(vol, part_ids[i], &vinfo);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "Error getting volume information.");
-			rc = EIO;
-			goto out;
-		}
-
-		if (str_cmp(vinfo.label, label) == 0) {
-			*rid = part_ids[i];
-			rc = EOK;
-			goto out;
-		}
-	}
-
-	rc = ENOENT;
-out:
-	free(part_ids);
-	return rc;
-}
-
-/** Open RAM disk image.
- *
- * @param imgpath Image path
- * @param rpath Place to store pointer to newly allocated string, the path to
- *              the mounted RAM disk.
- * @param rimg Place to store pointer to newly allocated object.
- *
- * @return EOK on success or an error code
- */
-errno_t rd_img_open(const char *imgpath, char **rpath, rd_img_t **rimg)
-{
-	rd_img_t *img = NULL;
-	char *rdpath = NULL;
-	errno_t rc;
-	task_id_t id;
-	task_wait_t wait;
-	task_exit_t texit;
-	vfs_stat_t stat;
-	int retval;
-	int cnt;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_open: begin");
-
-	rdpath = str_dup("/vol/" RD_LABEL);
-	if (rdpath == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	img = calloc(1, sizeof(rd_img_t));
-	if (img == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_open: spawn file_bd");
-	rc = task_spawnl(&id, &wait, FILE_BD, FILE_BD, imgpath, RD_SVC, NULL);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_open: wait for file_bd");
-	rc = task_wait(&wait, &texit, &retval);
-	if (rc != EOK || texit != TASK_EXIT_NORMAL) {
-		rc = EIO;
-		goto error;
-	}
-
-	/* Wait for the RAM disk to become available */
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "rd_img_open: wait for RAM disk to be mounted");
-	cnt = 10;
-	while (cnt > 0) {
-		rc = vfs_stat_path(rdpath, &stat);
-		if (rc == EOK)
-			break;
-
-		fibril_sleep(1);
-		--cnt;
-	}
-
-	if (cnt == 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "rd_img_open: ran out of time");
-		rc = EIO;
-		goto error;
-	}
-
-	img->filebd_tid = id;
-	*rimg = img;
-	*rpath = rdpath;
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_open: success");
-	return EOK;
-error:
-	if (rdpath != NULL)
-		free(rdpath);
-	if (img != NULL)
-		free(img);
-	return rc;
-}
-
-/** Close RAM disk image.
- *
- */
-errno_t rd_img_close(rd_img_t *img)
-{
-	errno_t rc;
-	service_id_t rd_svcid;
-	vol_t *vol = NULL;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_close: begin");
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error opening volume management service.");
-		rc = EIO;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_close: Find RAM disk volume.");
-	rc = rd_img_part_by_label(vol, RD_LABEL, &rd_svcid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error getting RAM disk service ID.");
-		rc = EIO;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_close: eject RAM disk volume");
-	rc = vol_part_eject(vol, rd_svcid, vef_none);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error ejecting RAM disk volume.");
-		rc = EIO;
-		goto error;
-	}
-
-	vol_destroy(vol);
-
-	rc = task_kill(img->filebd_tid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error killing file_bd.");
-		rc = EIO;
-		goto error;
-	}
-
-	free(img);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "rd_img_close: success");
-	return EOK;
-error:
-	free(img);
-	if (vol != NULL)
-		vol_destroy(vol);
-	return rc;
-}
-
-/** @}
- */
Index: pace/app/sysinst/rdimg.h
===================================================================
--- uspace/app/sysinst/rdimg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinst
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef RDIMG_H
-#define RDIMG_H
-
-#include <errno.h>
-#include <task.h>
-
-/** Open RAM disk image */
-typedef struct {
-	/** Task ID of file_bd providing the RAM disk */
-	task_id_t filebd_tid;
-} rd_img_t;
-
-extern errno_t rd_img_open(const char *, char **, rd_img_t **);
-extern errno_t rd_img_close(rd_img_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/sysinst/sysinst.c
===================================================================
--- uspace/app/sysinst/sysinst.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1390 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinst
- * @{
- */
-/** @file System installer.
- *
- * Install the operating system onto a disk device. Note that this only works
- * on ia32/amd64 with Grub platform 'pc'.
- */
-
-#include <block.h>
-#include <byteorder.h>
-#include <capa.h>
-#include <errno.h>
-#include <fdisk.h>
-#include <futil.h>
-#include <gfx/render.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <system.h>
-#include <ui/msgdialog.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-
-#include "grub.h"
-#include "rdimg.h"
-#include "volume.h"
-#include "sysinst.h"
-
-#define NAME "sysinst"
-
-/** Device to install to
- *
- * Note that you cannot simply change this, because the installation
- * device is hardcoded in core.img. If you wanted to install to another
- * device, you must build your own core.img (e.g. using tools/grub/mkimage.sh
- * and modifying tools/grub/load.cfg, supplying the device to boot from
- * in Grub notation).
- */
-#define DEFAULT_DEV_0 "devices/\\hw\\sys\\00:01.1\\c0d0"
-#define DEFAULT_DEV_1 "devices/\\hw\\sys\\ide1\\c0d0"
-//#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0"
-/** Volume label for the new file system */
-#define INST_VOL_LABEL "HelenOS"
-/** Mount point of system partition when running installed system */
-#define INST_VOL_MP "/w"
-
-#define MOUNT_POINT "/inst"
-
-/** HelenOS live CD volume label */
-#define CD_VOL_LABEL "HelenOS-CD"
-/** XXX Should get this from the volume server */
-#define CD_MOUNT_POINT "/vol/" CD_VOL_LABEL
-
-#define BOOT_FILES_SRC CD_MOUNT_POINT
-#define BOOT_BLOCK_IDX 0 /* MBR */
-
-#define CFG_FILES_SRC "/cfg"
-#define CFG_FILES_DEST MOUNT_POINT "/cfg"
-
-static const char *default_devs[] = {
-	DEFAULT_DEV_0,
-	DEFAULT_DEV_1,
-	NULL
-};
-
-static const char *sys_dirs[] = {
-	"/cfg",
-	"/data",
-	NULL
-};
-
-static fibril_mutex_t shutdown_lock;
-static fibril_condvar_t shutdown_cv;
-static bool shutdown_stopped;
-static bool shutdown_failed;
-
-static void sysinst_shutdown_complete(void *);
-static void sysinst_shutdown_failed(void *);
-
-static system_cb_t sysinst_system_cb = {
-	.shutdown_complete = sysinst_shutdown_complete,
-	.shutdown_failed = sysinst_shutdown_failed
-};
-
-static void wnd_close(ui_window_t *, void *);
-static errno_t bg_wnd_paint(ui_window_t *, void *);
-
-static ui_window_cb_t bg_window_cb = {
-	.close = wnd_close,
-	.paint = bg_wnd_paint
-};
-
-static ui_window_cb_t progress_window_cb = {
-	.close = wnd_close
-};
-
-static void sysinst_confirm_button(ui_msg_dialog_t *, void *, unsigned);
-static void sysinst_confirm_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t sysinst_confirm_cb = {
-	.button = sysinst_confirm_button,
-	.close = sysinst_confirm_close
-};
-
-static errno_t sysinst_restart_dlg_create(sysinst_t *);
-static void sysinst_restart_dlg_button(ui_msg_dialog_t *, void *, unsigned);
-static void sysinst_restart_dlg_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t sysinst_restart_dlg_cb = {
-	.button = sysinst_restart_dlg_button,
-	.close = sysinst_restart_dlg_close
-};
-
-static int sysinst_start(sysinst_t *);
-static errno_t sysinst_restart(sysinst_t *);
-static void sysinst_progress_destroy(sysinst_progress_t *);
-static void sysinst_action(sysinst_t *, const char *);
-static void sysinst_error(sysinst_t *, const char *);
-static void sysinst_debug(sysinst_t *, const char *);
-
-static void sysinst_futil_copy_file(void *, const char *, const char *);
-static void sysinst_futil_create_dir(void *, const char *);
-
-static futil_cb_t sysinst_futil_cb = {
-	.copy_file = sysinst_futil_copy_file,
-	.create_dir = sysinst_futil_create_dir
-};
-
-static void sysinst_error_msg_button(ui_msg_dialog_t *, void *, unsigned);
-static void sysinst_error_msg_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t sysinst_error_msg_cb = {
-	.button = sysinst_error_msg_button,
-	.close = sysinst_error_msg_close
-};
-
-/** Close window.
- *
- * @param window Window
- * @param arg Argument (sysinst_t *)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	(void)window;
-	(void)arg;
-}
-
-/** Paint background window.
- *
- * @param window Window
- * @param arg Argument (sysinst_t *)
- */
-static errno_t bg_wnd_paint(ui_window_t *window, void *arg)
-{
-	sysinst_t *sysinst = (sysinst_t *)arg;
-	gfx_rect_t app_rect;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	gc = ui_window_get_gc(window);
-
-	rc = gfx_set_color(gc, sysinst->bg_color);
-	if (rc != EOK)
-		return rc;
-
-	ui_window_get_app_rect(window, &app_rect);
-
-	rc = gfx_fill_rect(gc, &app_rect);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Installation confirm dialog OK button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (sysinst_t *)
- * @param btn Button number
- * @param earg Entry argument
- */
-static void sysinst_confirm_button(ui_msg_dialog_t *dialog, void *arg,
-    unsigned btn)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-
-	switch (btn) {
-	case 0:
-		/* OK */
-		sysinst_start(sysinst);
-		break;
-	default:
-		/* Cancel */
-		ui_quit(sysinst->ui);
-		break;
-	}
-}
-
-/** Installation confirm dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (sysinst_t *)
- */
-static void sysinst_confirm_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sysinst->ui);
-}
-
-/** Restart system dialog OK button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (sysinst_t *)
- * @param btn Button number
- * @param earg Entry argument
- */
-static void sysinst_restart_dlg_button(ui_msg_dialog_t *dialog, void *arg,
-    unsigned btn)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-
-	(void)sysinst;
-
-	switch (btn) {
-	case 0:
-		/* OK */
-		(void)sysinst_restart(sysinst);
-		break;
-	default:
-		/* Cancel */
-		ui_quit(sysinst->ui);
-		break;
-	}
-}
-
-/** Restat system dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (sysinst_t *)
- */
-static void sysinst_restart_dlg_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sysinst->ui);
-}
-
-/** Installation error message dialog button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (sysinst_t *)
- * @param bnum Button number
- */
-static void sysinst_error_msg_button(ui_msg_dialog_t *dialog,
-    void *arg, unsigned bnum)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sysinst->ui);
-}
-
-/** Installation error message dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (shutdown_dlg_t *)
- */
-static void sysinst_error_msg_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	sysinst_t *sysinst = (sysinst_t *) arg;
-
-	ui_msg_dialog_destroy(dialog);
-	ui_quit(sysinst->ui);
-}
-
-/** Create error message dialog.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_error_msg_create(sysinst_t *sysinst)
-{
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Error";
-	params.text = sysinst->errmsg;
-	params.flags |= umdf_topmost | umdf_center;
-
-	rc = ui_msg_dialog_create(sysinst->ui, &params, &dialog);
-	if (rc != EOK)
-		return rc;
-
-	ui_msg_dialog_set_cb(dialog, &sysinst_error_msg_cb, (void *)sysinst);
-
-	return EOK;
-}
-
-/** Called when futil is starting to copy a file.
- *
- * @param arg Argument (sysinst_t *)
- * @param src Source path
- * @param dest Destination path
- */
-static void sysinst_futil_copy_file(void *arg, const char *src,
-    const char *dest)
-{
-	sysinst_t *sysinst = (sysinst_t *)arg;
-	char buf[128];
-
-	(void)src;
-	snprintf(buf, sizeof(buf), "Copying %s.", dest);
-	sysinst_action(sysinst, buf);
-}
-
-/** Called when futil is about to create a directory.
- *
- * @param arg Argument (sysinst_t *)
- * @param dest Destination path
- */
-static void sysinst_futil_create_dir(void *arg, const char *dest)
-{
-	sysinst_t *sysinst = (sysinst_t *)arg;
-	char buf[128];
-
-	snprintf(buf, sizeof(buf), "Creating %s.", dest);
-	sysinst_action(sysinst, buf);
-}
-
-/** System shutdown complete.
- *
- * @param arg Argument (shutdown_t *)
- */
-static void sysinst_shutdown_complete(void *arg)
-{
-	(void)arg;
-
-	fibril_mutex_lock(&shutdown_lock);
-	shutdown_stopped = true;
-	shutdown_failed = false;
-	fibril_condvar_broadcast(&shutdown_cv);
-	fibril_mutex_unlock(&shutdown_lock);
-}
-
-/** System shutdown failed.
- *
- * @param arg Argument (not used)
- */
-static void sysinst_shutdown_failed(void *arg)
-{
-	(void)arg;
-
-	fibril_mutex_lock(&shutdown_lock);
-	shutdown_stopped = true;
-	shutdown_failed = true;
-	fibril_condvar_broadcast(&shutdown_cv);
-	fibril_mutex_unlock(&shutdown_lock);
-}
-
-/** Check the if the destination device exists.
- *
- * @param dev Disk device
- *
- * @return EOK on success or an error code
- */
-static errno_t sysinst_check_dev(const char *dev)
-{
-	service_id_t sid;
-	errno_t rc;
-
-	rc = loc_service_get_id(dev, &sid, 0);
-	if (rc != EOK)
-		return rc;
-
-	(void)sid;
-	return EOK;
-}
-
-/** Label the destination device.
- *
- * @param sysinst System installer
- * @param dev Disk device to label
- * @param psvc_id Place to store service ID of the created partition
- *
- * @return EOK on success or an error code
- */
-static errno_t sysinst_label_dev(sysinst_t *sysinst, const char *dev,
-    service_id_t *psvc_id)
-{
-	fdisk_t *fdisk;
-	fdisk_dev_t *fdev;
-	fdisk_part_t *part;
-	fdisk_part_spec_t pspec;
-	fdisk_part_info_t pinfo;
-	capa_spec_t capa;
-	service_id_t sid;
-	errno_t rc;
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): get service ID");
-
-	rc = loc_service_get_id(dev, &sid, 0);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): open device");
-
-	rc = fdisk_create(&fdisk);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error initializing fdisk.");
-		return rc;
-	}
-
-	rc = fdisk_dev_open(fdisk, sid, &fdev);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error opening device.");
-		return rc;
-	}
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): create mount directory");
-
-	rc = vfs_link_path(MOUNT_POINT, KIND_DIRECTORY, NULL);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating mount directory.");
-		return rc;
-	}
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): create label");
-
-	rc = fdisk_label_create(fdev, lt_mbr);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating label.");
-		return rc;
-	}
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): create partition");
-
-	rc = fdisk_part_get_max_avail(fdev, spc_pri, &capa);
-	if (rc != EOK) {
-		sysinst_error(sysinst,
-		    "Error getting available capacity.");
-		return rc;
-	}
-
-	fdisk_pspec_init(&pspec);
-	pspec.capacity = capa;
-	pspec.pkind = lpk_primary;
-	pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */
-	pspec.mountp = MOUNT_POINT;
-	pspec.label = INST_VOL_LABEL;
-
-	rc = fdisk_part_create(fdev, &pspec, &part);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating partition.");
-		return rc;
-	}
-
-	rc = fdisk_part_get_info(part, &pinfo);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error getting partition information.");
-		return rc;
-	}
-
-	sysinst_debug(sysinst, "sysinst_label_dev(): OK");
-	*psvc_id = pinfo.svc_id;
-	return EOK;
-}
-
-/** Set up system volume structure.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_setup_sysvol(sysinst_t *sysinst)
-{
-	errno_t rc;
-	char *path = NULL;
-	const char **cp;
-	int rv;
-
-	cp = sys_dirs;
-	while (*cp != NULL) {
-		rv = asprintf(&path, "%s%s", MOUNT_POINT, *cp);
-		if (rv < 0) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = vfs_link_path(path, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
-			sysinst_error(sysinst, "Error creating directory.");
-			goto error;
-		}
-
-		free(path);
-		path = NULL;
-		++cp;
-	}
-
-	free(path);
-	path = NULL;
-
-	/* Copy initial configuration files */
-	rc = futil_rcopy_contents(sysinst->futil, CFG_FILES_SRC,
-	    CFG_FILES_DEST);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-error:
-	if (path != NULL)
-		free(path);
-	return rc;
-}
-
-/** Copy boot files.
- *
- * @return EOK on success or an error code
- */
-static errno_t sysinst_copy_boot_files(sysinst_t *sysinst)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_files(): copy bootloader files");
-	rc = futil_rcopy_contents(sysinst->futil, BOOT_FILES_SRC, MOUNT_POINT);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_debug(sysinst, "sysinst_copy_boot_files(): OK");
-	return EOK;
-}
-
-/** Set up configuration in the initial RAM disk.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_customize_initrd(sysinst_t *sysinst)
-{
-	errno_t rc;
-	rd_img_t *rd = NULL;
-	char *rdpath = NULL;
-	char *path = NULL;
-	vol_volumes_t *volumes = NULL;
-	vol_volume_t *volume = NULL;
-	int rv;
-
-	rc = rd_img_open(MOUNT_POINT "/boot/initrd.img", &rdpath, &rd);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error opening initial RAM disk image.");
-		goto error;
-	}
-
-	rv = asprintf(&path, "%s%s", rdpath, "/cfg/initvol.sif");
-	if (rv < 0) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	sysinst_debug(sysinst, "Configuring volume server.");
-
-	rc = vol_volumes_create(path, &volumes);
-	if (rc != EOK) {
-		sysinst_error(sysinst,
-		    "Error creating volume server configuration.");
-		rc = EIO;
-		goto error;
-	}
-
-	sysinst_debug(sysinst, "Configuring volume server: look up volume");
-	rc = vol_volume_lookup_ref(volumes, INST_VOL_LABEL, &volume);
-	if (rc != EOK) {
-		sysinst_error(sysinst,
-		    "Error creating volume server configuration.");
-		rc = EIO;
-		goto error;
-	}
-
-	sysinst_debug(sysinst, "Configuring volume server: set mount point");
-	rc = vol_volume_set_mountp(volume, INST_VOL_MP);
-	if (rc != EOK) {
-		sysinst_error(sysinst,
-		    "Error creating system partition configuration.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = vol_volumes_sync(volumes);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error saving volume confiuration.");
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "Configuring volume server: delete reference");
-	vol_volume_del_ref(volume);
-	volume = NULL;
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "Configuring volume server: destroy volumes object");
-	vol_volumes_destroy(volumes);
-	volumes = NULL;
-
-	rc = rd_img_close(rd);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error closing initial RAM disk image.");
-		rc = EIO;
-		goto error;
-	}
-
-	free(rdpath);
-	rdpath = NULL;
-	free(path);
-	path = NULL;
-
-	return EOK;
-error:
-	if (volume != NULL)
-		vol_volume_del_ref(volume);
-	if (volumes != NULL)
-		vol_volumes_destroy(volumes);
-	if (rd != NULL)
-		(void) rd_img_close(rd);
-	if (path != NULL)
-		free(path);
-	if (rdpath != NULL)
-		free(rdpath);
-	return rc;
-}
-
-/** Write unaligned 64-bit little-endian number.
- *
- * @param a Destination buffer
- * @param data Number
- */
-static void set_unaligned_u64le(uint8_t *a, uint64_t data)
-{
-	int i;
-
-	for (i = 0; i < 8; i++) {
-		a[i] = (data >> (i * 8)) & 0xff;
-	}
-}
-
-/** Copy boot blocks.
- *
- * Install Grub's boot blocks.
- *
- * @param sysinst System installer
- * @param devp Disk device
- * @return EOK on success or an error code
- */
-static errno_t sysinst_copy_boot_blocks(sysinst_t *sysinst, const char *devp)
-{
-	void *boot_img;
-	size_t boot_img_size;
-	void *core_img;
-	size_t core_img_size;
-	service_id_t sid;
-	size_t bsize;
-	uint8_t bbuf[512];
-	aoff64_t core_start;
-	aoff64_t core_blocks;
-	grub_boot_blocklist_t *first_bl, *bl;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: Read boot block image.");
-
-	rc = futil_get_file(sysinst->futil,
-	    BOOT_FILES_SRC "/boot/grub/i386-pc/boot.img",
-	    &boot_img, &boot_img_size);
-	if (rc != EOK || boot_img_size != 512)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: Read GRUB core image.");
-
-	rc = futil_get_file(sysinst->futil,
-	    BOOT_FILES_SRC "/boot/grub/i386-pc/core.img",
-	    &core_img, &core_img_size);
-	if (rc != EOK)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: get service ID.");
-
-	rc = loc_service_get_id(devp, &sid, 0);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: block_init.");
-
-	rc = block_init(sid);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: get block size");
-
-	rc = block_get_bsize(sid, &bsize);
-	if (rc != EOK)
-		return rc;
-
-	if (bsize != 512) {
-		sysinst_error(sysinst, "Device block size != 512.");
-		return EIO;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: read boot block");
-
-	rc = block_read_direct(sid, BOOT_BLOCK_IDX, 1, bbuf);
-	if (rc != EOK)
-		return EIO;
-
-	core_start = 16;
-	core_blocks = (core_img_size + 511) / 512;
-
-	/* Clean blocklists */
-	first_bl = core_img + 512 - sizeof(*first_bl);
-	bl = first_bl;
-	while (bl->len != 0) {
-		memset(bl, 0, sizeof(*bl));
-		--bl;
-		if ((void *)bl < core_img) {
-			sysinst_error(sysinst,
-			    "No block terminator in core image.");
-			return EIO;
-		}
-	}
-
-	first_bl->start = host2uint64_t_le(core_start + 1);
-	first_bl->len = host2uint16_t_le(core_blocks - 1);
-	first_bl->segment = grub_boot_i386_pc_kernel_seg + (512 >> 4);
-
-	/* Write boot code into boot block */
-	memcpy(bbuf, boot_img, 440); /* XXX 440 = sizeof(br_block_t.code_area) */
-	bbuf[grub_boot_machine_boot_drive] = 0xff;
-	set_unaligned_u64le(bbuf + grub_boot_machine_kernel_sector, core_start);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: write boot block");
-
-	rc = block_write_direct(sid, BOOT_BLOCK_IDX, 1, bbuf);
-	if (rc != EOK)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: write core blocks");
-
-	/* XXX Must pad last block with zeros */
-	rc = block_write_direct(sid, core_start, core_blocks, core_img);
-	if (rc != EOK)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "sysinst_copy_boot_blocks: OK.");
-
-	return EOK;
-}
-
-/** Eject installation volume.
- *
- * @param sysinst System installer
- * @param psvc_id Partition service ID
- * @return EOK on success or an error code
- */
-static errno_t sysinst_eject_dev(sysinst_t *sysinst, service_id_t part_id)
-{
-	vol_t *vol = NULL;
-	errno_t rc;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error contacting volume service.");
-		goto out;
-	}
-
-	rc = vol_part_eject(vol, part_id, vef_physical);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error ejecting volume.");
-		goto out;
-	}
-
-	rc = EOK;
-out:
-	vol_destroy(vol);
-	return rc;
-}
-
-/** Restart the system.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_restart(sysinst_t *sysinst)
-{
-	errno_t rc;
-	system_t *system;
-
-	fibril_mutex_initialize(&shutdown_lock);
-	fibril_condvar_initialize(&shutdown_cv);
-	shutdown_stopped = false;
-	shutdown_failed = false;
-
-	rc = system_open(SYSTEM_DEFAULT, &sysinst_system_cb, NULL, &system);
-	if (rc != EOK) {
-		sysinst_error(sysinst,
-		    "Failed opening system control service.");
-		return rc;
-	}
-
-	rc = system_restart(system);
-	if (rc != EOK) {
-		system_close(system);
-		sysinst_error(sysinst, "Failed requesting system restart.");
-		return rc;
-	}
-
-	fibril_mutex_lock(&shutdown_lock);
-	sysinst_debug(sysinst, "The system is shutting down...");
-
-	while (!shutdown_stopped)
-		fibril_condvar_wait(&shutdown_cv, &shutdown_lock);
-
-	if (shutdown_failed) {
-		sysinst_error(sysinst, "Shutdown failed.");
-		system_close(system);
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "Shutdown complete. It is now safe to remove power.");
-
-	/* Sleep forever */
-	while (true)
-		fibril_condvar_wait(&shutdown_cv, &shutdown_lock);
-
-	fibril_mutex_unlock(&shutdown_lock);
-
-	system_close(system);
-	return 0;
-
-}
-
-/** Install system to a device.
- *
- * @parma sysinst System installer
- * @param dev Device to install to.
- * @return EOK on success or an error code
- */
-static errno_t sysinst_install(sysinst_t *sysinst, const char *dev)
-{
-	errno_t rc;
-	service_id_t psvc_id;
-
-	sysinst_action(sysinst, "Creating device label and file system.");
-
-	rc = sysinst_label_dev(sysinst, dev, &psvc_id);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_action(sysinst, "Creating system directory structure.");
-	rc = sysinst_setup_sysvol(sysinst);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_action(sysinst, "Copying boot files.");
-	rc = sysinst_copy_boot_files(sysinst);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_action(sysinst, "Configuring the system.");
-	rc = sysinst_customize_initrd(sysinst);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_action(sysinst, "Installing boot blocks.");
-	rc = sysinst_copy_boot_blocks(sysinst, dev);
-	if (rc != EOK)
-		return rc;
-
-	sysinst_action(sysinst, "Ejecting device.");
-	rc = sysinst_eject_dev(sysinst, psvc_id);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Installation fibril.
- *
- * @param arg Argument (sysinst_t *)
- * @return EOK on success or an error code
- */
-static errno_t sysinst_install_fibril(void *arg)
-{
-	sysinst_t *sysinst = (sysinst_t *)arg;
-	unsigned i;
-	errno_t rc;
-
-	(void)sysinst;
-
-	i = 0;
-	while (default_devs[i] != NULL) {
-		rc = sysinst_check_dev(default_devs[i]);
-		if (rc == EOK)
-			break;
-		++i;
-	}
-
-	if (default_devs[i] == NULL) {
-		sysinst_error(sysinst, "Cannot determine installation device.");
-		rc = ENOENT;
-		goto error;
-	}
-
-	rc = sysinst_install(sysinst, default_devs[i]);
-	if (rc != EOK)
-		goto error;
-
-	sysinst_progress_destroy(sysinst->progress);
-	rc = sysinst_restart_dlg_create(sysinst);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	ui_lock(sysinst->ui);
-	sysinst_progress_destroy(sysinst->progress);
-	(void)sysinst_error_msg_create(sysinst);
-	ui_unlock(sysinst->ui);
-	return rc;
-}
-
-/** Create installation progress window.
- *
- * @param sysinst System installer
- * @param rprogress Place to store pointer to new progress window
- * @return EOK on success or an error code
- */
-static errno_t sysinst_progress_create(sysinst_t *sysinst,
-    sysinst_progress_t **rprogress)
-{
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	gfx_rect_t rect;
-	gfx_rect_t arect;
-	ui_resource_t *ui_res;
-	sysinst_progress_t *progress;
-	ui_fixed_t *fixed = NULL;
-	errno_t rc;
-
-	ui_wnd_params_init(&params);
-	params.caption = "System Installation";
-	params.style &= ~ui_wds_titlebar;
-	params.flags |= ui_wndf_topmost;
-	params.placement = ui_wnd_place_center;
-	if (ui_is_textmode(sysinst->ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 64;
-		params.rect.p1.y = 5;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 500;
-		params.rect.p1.y = 60;
-	}
-
-	progress = calloc(1, sizeof(sysinst_progress_t));
-	if (progress == NULL) {
-		rc = ENOMEM;
-		sysinst_error(sysinst, "Out of memory.");
-		goto error;
-	}
-
-	rc = ui_window_create(sysinst->ui, &params, &window);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating window.");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &progress_window_cb, (void *)sysinst);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating fixed layout.");
-		goto error;
-	}
-
-	rc = ui_label_create(ui_res, "Installing system. Please wait...",
-	    &progress->label);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating label.");
-		goto error;
-	}
-
-	ui_window_get_app_rect(window, &arect);
-
-	if (ui_is_textmode(sysinst->ui)) {
-		rect.p0.x = arect.p0.x;
-		rect.p0.y = arect.p0.y;
-		rect.p1.x = arect.p1.x;
-		rect.p1.y = 2;
-	} else {
-		rect.p0.x = arect.p0.x;
-		rect.p0.y = arect.p0.y;
-		rect.p1.x = arect.p1.x;
-		rect.p1.y = 30;
-	}
-	ui_label_set_rect(progress->label, &rect);
-	ui_label_set_halign(progress->label, gfx_halign_center);
-	ui_label_set_valign(progress->label, gfx_valign_center);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(progress->label));
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error adding control to layout.");
-		ui_label_destroy(progress->label);
-		progress->label = NULL;
-		goto error;
-	}
-
-	rc = ui_label_create(ui_res, "",
-	    &progress->action);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error creating label.");
-		goto error;
-	}
-
-	if (ui_is_textmode(sysinst->ui)) {
-		rect.p0.x = arect.p0.x;
-		rect.p0.y = 3;
-		rect.p1.x = arect.p1.x;
-		rect.p1.y = arect.p1.y;
-	} else {
-		rect.p0.x = arect.p0.x;
-		rect.p0.y = 30;
-		rect.p1.x = arect.p1.x;
-		rect.p1.y = arect.p1.y;
-	}
-	ui_label_set_rect(progress->action, &rect);
-	ui_label_set_halign(progress->action, gfx_halign_center);
-	ui_label_set_valign(progress->action, gfx_valign_center);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(progress->action));
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error adding control to layout.");
-		ui_label_destroy(progress->label);
-		progress->label = NULL;
-		goto error;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		sysinst_error(sysinst, "Error painting window.");
-		goto error;
-	}
-
-	progress->window = window;
-	progress->fixed = fixed;
-	*rprogress = progress;
-	return EOK;
-error:
-	if (progress != NULL && progress->fixed != NULL)
-		ui_fixed_destroy(progress->fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (progress != NULL)
-		free(progress);
-	return rc;
-}
-
-/** Destroy installation progress window.
- *
- * @param sysinst System installer
- * @param rprogress Place to store pointer to new progress window
- * @return EOK on success or an error code
- */
-static void sysinst_progress_destroy(sysinst_progress_t *progress)
-{
-	if (progress == NULL)
-		return;
-
-	ui_window_destroy(progress->window);
-	free(progress);
-}
-
-/** Set current action message.
- *
- * @param sysinst System installer
- * @param action Action text
- */
-static void sysinst_action(sysinst_t *sysinst, const char *action)
-{
-	if (sysinst->progress == NULL)
-		return;
-
-	ui_label_set_text(sysinst->progress->action, action);
-	ui_label_paint(sysinst->progress->action);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "%s", action);
-}
-
-/** Set current error message.
- *
- * @param sysinst System installer
- * @param errmsg Error message
- */
-static void sysinst_error(sysinst_t *sysinst, const char *errmsg)
-{
-	str_cpy(sysinst->errmsg, sizeof(sysinst->errmsg), errmsg);
-	log_msg(LOG_DEFAULT, LVL_ERROR, errmsg);
-}
-
-/** Log a debug message.
- *
- * @param sysinst System installer
- * @param errmsg Error message
- */
-static void sysinst_debug(sysinst_t *sysinst, const char *msg)
-{
-	log_msg(LOG_DEFAULT, LVL_ERROR, msg);
-}
-
-/** Start system installation.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static int sysinst_start(sysinst_t *sysinst)
-{
-	errno_t rc;
-	fid_t fid;
-
-	rc = sysinst_progress_create(sysinst, &sysinst->progress);
-	if (rc != EOK)
-		return rc;
-
-	fid = fibril_create(sysinst_install_fibril, (void *)sysinst);
-	if (fid == 0) {
-		sysinst_error(sysinst, "Out of memory.");
-		return ENOMEM;
-	}
-
-	fibril_add_ready(fid);
-	return EOK;
-}
-
-/** Create installation confirmation dialog.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_confirm_create(sysinst_t *sysinst)
-{
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "System installation";
-	params.text = "This will install HelenOS to your computer. Continue?";
-	params.choice = umdc_ok_cancel;
-	params.flags |= umdf_topmost | umdf_center;
-
-	rc = ui_msg_dialog_create(sysinst->ui, &params, &dialog);
-	if (rc != EOK)
-		return rc;
-
-	ui_msg_dialog_set_cb(dialog, &sysinst_confirm_cb, sysinst);
-	return EOK;
-}
-
-/** Create restart dialog.
- *
- * @param sysinst System installer
- * @return EOK on success or an error code
- */
-static errno_t sysinst_restart_dlg_create(sysinst_t *sysinst)
-{
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Restart System";
-	params.text = "Installation complete. Restart the system?";
-	params.choice = umdc_ok_cancel;
-	params.flags |= umdf_topmost | umdf_center;
-
-	rc = ui_msg_dialog_create(sysinst->ui, &params, &dialog);
-	if (rc != EOK)
-		return rc;
-
-	ui_msg_dialog_set_cb(dialog, &sysinst_restart_dlg_cb, sysinst);
-	return EOK;
-}
-
-/** Run system installer on display.
- *
- * @param display_spec Display specification
- * @return EOK on success or an error code
- */
-static errno_t sysinst_run(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	sysinst_t *sysinst;
-	ui_wnd_params_t params;
-	errno_t rc;
-
-	sysinst = calloc(1, sizeof(sysinst_t));
-	if (sysinst == NULL)
-		return ENOMEM;
-
-	rc = futil_create(&sysinst_futil_cb, (void *)sysinst, &sysinst->futil);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	sysinst->ui = ui;
-
-	ui_wnd_params_init(&params);
-	params.caption = "System Installation";
-	params.style &= ~ui_wds_decorated;
-	params.placement = ui_wnd_place_full_screen;
-	params.flags |= ui_wndf_topmost | ui_wndf_nofocus;
-
-	rc = ui_window_create(sysinst->ui, &params, &sysinst->bgwindow);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(sysinst->bgwindow, &bg_window_cb, (void *)sysinst);
-
-	if (ui_is_textmode(sysinst->ui)) {
-		rc = gfx_color_new_ega(0x17, &sysinst->bg_color);
-		if (rc != EOK) {
-			printf("Error allocating color.\n");
-			goto error;
-		}
-	} else {
-		rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &sysinst->bg_color);
-		if (rc != EOK) {
-			printf("Error allocating color.\n");
-			goto error;
-		}
-	}
-
-	rc = ui_window_paint(sysinst->bgwindow);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	(void)sysinst_confirm_create(sysinst);
-
-	ui_run(ui);
-
-	if (sysinst->bgwindow != NULL)
-		ui_window_destroy(sysinst->bgwindow);
-	if (sysinst->system != NULL)
-		system_close(sysinst->system);
-	gfx_color_delete(sysinst->bg_color);
-	ui_destroy(ui);
-	free(sysinst);
-	return EOK;
-error:
-	if (sysinst->futil != NULL)
-		futil_destroy(sysinst->futil);
-	if (sysinst->system != NULL)
-		system_close(sysinst->system);
-	if (sysinst->bg_color != NULL)
-		gfx_color_delete(sysinst->bg_color);
-	if (sysinst->bgwindow != NULL)
-		ui_window_destroy(sysinst->bgwindow);
-	if (ui != NULL)
-		ui_destroy(ui);
-	free(sysinst);
-	return rc;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: " NAME " [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = sysinst_run(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/sysinst/sysinst.h
===================================================================
--- uspace/app/sysinst/sysinst.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sysinst
- * @{
- */
-/**
- * @file System installer
- */
-
-#ifndef SYSINST_H
-#define SYSINST_H
-
-#include <futil.h>
-#include <gfx/color.h>
-#include <system.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Installation progress window. */
-typedef struct {
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_label_t *label;
-	ui_label_t *action;
-} sysinst_progress_t;
-
-/** System installer. */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *bgwindow;
-	gfx_color_t *bg_color;
-	sysinst_progress_t *progress;
-	system_t *system;
-	futil_t *futil;
-	char errmsg[128];
-} sysinst_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/sysinst/types/volume.h
===================================================================
--- uspace/app/sysinst/types/volume.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../srv/volsrv/types/volume.h
Index: pace/app/sysinst/volume.c
===================================================================
--- uspace/app/sysinst/volume.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../srv/volsrv/volume.c
Index: pace/app/sysinst/volume.h
===================================================================
--- uspace/app/sysinst/volume.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../srv/volsrv/volume.h
Index: pace/app/taskbar-cfg/doc/doxygroups.h
===================================================================
--- uspace/app/taskbar-cfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup taskbar-cfg taskbar-cfg
- * @brief Taskbar configuration utility (UI)
- * @ingroup apps
- */
Index: pace/app/taskbar-cfg/main.c
===================================================================
--- uspace/app/taskbar-cfg/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/** @file Taskbar configuration utility (UI) main
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <ui/ui.h>
-#include "taskbar-cfg.h"
-
-static void print_syntax(void)
-{
-	printf("Syntax: taskbarcfg [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	taskbar_cfg_t *tbcfg;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = taskbar_cfg_create(display_spec, &tbcfg);
-	if (rc != EOK)
-		return 1;
-
-	rc = taskbar_cfg_open(tbcfg, "/w/cfg/taskbar.sif");
-	if (rc != EOK)
-		return 1;
-
-	rc = taskbar_cfg_populate(tbcfg);
-	if (rc != EOK)
-		return 1;
-
-	ui_run(tbcfg->ui);
-	taskbar_cfg_destroy(tbcfg);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/taskbar-cfg/meson.build
===================================================================
--- uspace/app/taskbar-cfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'tbarcfg', 'ui' ]
-src = files(
-	'taskbar-cfg.c',
-	'main.c',
-	'smeedit.c',
-	'startmenu.c'
-)
-
-#test_src = files(
-#	'taskbar-cfg.c',
-#	'startmenu.c',
-#	'test/taskbar-cfg.c',
-#	'test/main.c',
-#	'test/startmenu.c'
-#)
Index: pace/app/taskbar-cfg/smeedit.c
===================================================================
--- uspace/app/taskbar-cfg/smeedit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,445 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/** @file Start menu entry edit dialog
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ui/checkbox.h>
-#include <ui/fixed.h>
-#include <ui/resource.h>
-#include <ui/window.h>
-#include "taskbar-cfg.h"
-#include "smeedit.h"
-#include "startmenu.h"
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-static void smeedit_ok_clicked(ui_pbutton_t *, void *);
-static void smeedit_cancel_clicked(ui_pbutton_t *, void *);
-
-/** OK button callbacks */
-ui_pbutton_cb_t smeedit_ok_button_cb = {
-	.clicked = smeedit_ok_clicked
-};
-
-/** Cancel button callbacks */
-ui_pbutton_cb_t smeedit_cancel_button_cb = {
-	.clicked = smeedit_cancel_clicked
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (tbcfg)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	smeedit_t *smee = (smeedit_t *)arg;
-
-	(void)window;
-	smeedit_destroy(smee);
-}
-
-/** Create start menu entry edit dialog.
- *
- * @param smenu Start menu
- * @param smentry Start menu entry to edit or @c NULL if creating
- *                a new entry
- * @param rsmee Place to store pointer to new start menu entry edit window
- * @return EOK on success or an error code
- */
-errno_t smeedit_create(startmenu_t *smenu, startmenu_entry_t *smentry,
-    smeedit_t **rsmee)
-{
-	ui_wnd_params_t params;
-	ui_t *ui;
-	ui_window_t *window = NULL;
-	smeedit_t *smee = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *res;
-	const char *cmd;
-	const char *caption;
-	bool terminal;
-	errno_t rc;
-
-	ui = smenu->tbarcfg->ui;
-
-	if (smentry != NULL) {
-		cmd = smenu_entry_get_cmd(smentry->entry);
-		caption = smenu_entry_get_caption(smentry->entry);
-		terminal = smenu_entry_get_terminal(smentry->entry);
-	} else {
-		cmd = "";
-		caption = "";
-		terminal = false;
-	}
-
-	smee = calloc(1, sizeof(smeedit_t));
-	if (smee == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	smee->startmenu = smenu;
-	smee->smentry = smentry;
-
-	ui_wnd_params_init(&params);
-	params.caption = smentry != NULL ? "Edit Start Menu Entry" :
-	    "Create Start Menu Entry";
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 50;
-		params.rect.p1.y = 13;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 370;
-		params.rect.p1.y = 230;
-	}
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *)smee);
-	smee->window = window;
-
-	res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&smee->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	/* Command to run label */
-
-	rc = ui_label_create(res, "Command to run:", &smee->lcmd);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 2;
-		rect.p1.x = 48;
-		rect.p1.y = 3;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 35;
-		rect.p1.x = 190;
-		rect.p1.y = 50;
-	}
-
-	ui_label_set_rect(smee->lcmd, &rect);
-
-	rc = ui_fixed_add(smee->fixed, ui_label_ctl(smee->lcmd));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* Command entry */
-
-	rc = ui_entry_create(window, cmd, &smee->ecmd);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 3;
-		rect.p1.x = 48;
-		rect.p1.y = 4;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 50;
-		rect.p1.x = 360;
-		rect.p1.y = 75;
-	}
-
-	ui_entry_set_rect(smee->ecmd, &rect);
-
-	rc = ui_fixed_add(smee->fixed, ui_entry_ctl(smee->ecmd));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* Caption label */
-
-	rc = ui_label_create(res, "Caption:", &smee->lcaption);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 5;
-		rect.p1.x = 20;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 95;
-		rect.p1.x = 190;
-		rect.p1.y = 110;
-	}
-
-	ui_label_set_rect(smee->lcaption, &rect);
-
-	rc = ui_fixed_add(smee->fixed, ui_label_ctl(smee->lcaption));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* Caption entry */
-
-	rc = ui_entry_create(window, caption, &smee->ecaption);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 6;
-		rect.p1.x = 48;
-		rect.p1.y = 7;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 110;
-		rect.p1.x = 360;
-		rect.p1.y = 135;
-	}
-
-	ui_entry_set_rect(smee->ecaption, &rect);
-
-	rc = ui_fixed_add(smee->fixed, ui_entry_ctl(smee->ecaption));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* Start in terminal checkbox */
-
-	rc = ui_checkbox_create(res, "Start in terminal", &smee->cbterminal);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 8;
-		rect.p1.x = 6;
-		rect.p1.y = 9;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 155;
-		rect.p1.x = 360;
-		rect.p1.y = 170;
-	}
-
-	ui_checkbox_set_rect(smee->cbterminal, &rect);
-	ui_checkbox_set_checked(smee->cbterminal, terminal);
-
-	rc = ui_fixed_add(smee->fixed, ui_checkbox_ctl(smee->cbterminal));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* OK button */
-
-	rc = ui_pbutton_create(res, "OK", &smee->bok);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 23;
-		rect.p0.y = 10;
-		rect.p1.x = 35;
-		rect.p1.y = 11;
-	} else {
-		rect.p0.x = 190;
-		rect.p0.y = 190;
-		rect.p1.x = 270;
-		rect.p1.y = 215;
-	}
-
-	ui_pbutton_set_cb(smee->bok, &smeedit_ok_button_cb, (void *)smee);
-	ui_pbutton_set_rect(smee->bok, &rect);
-	ui_pbutton_set_default(smee->bok, true);
-
-	rc = ui_fixed_add(smee->fixed, ui_pbutton_ctl(smee->bok));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* Cancel button */
-
-	rc = ui_pbutton_create(res, "Cancel", &smee->bcancel);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 36;
-		rect.p0.y = 10;
-		rect.p1.x = 48;
-		rect.p1.y = 11;
-	} else {
-		rect.p0.x = 280;
-		rect.p0.y = 190;
-		rect.p1.x = 360;
-		rect.p1.y = 215;
-	}
-
-	ui_pbutton_set_cb(smee->bcancel, &smeedit_cancel_button_cb,
-	    (void *)smee);
-	ui_pbutton_set_rect(smee->bcancel, &rect);
-
-	rc = ui_fixed_add(smee->fixed, ui_pbutton_ctl(smee->bcancel));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(smee->fixed));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK)
-		goto error;
-
-	*rsmee = smee;
-	return EOK;
-error:
-	if (smee->window != NULL)
-		ui_window_destroy(smee->window);
-	free(smee);
-	return rc;
-}
-
-/** Destroy Taskbar configuration window.
- *
- * @param smee Start menu entry edit dialog
- */
-void smeedit_destroy(smeedit_t *smee)
-{
-	ui_window_destroy(smee->window);
-}
-
-/** OK button clicked.
- *
- * @params bok OK button
- * @params arg Argument (smeedit_t *)
- */
-static void smeedit_ok_clicked(ui_pbutton_t *bok, void *arg)
-{
-	smeedit_t *smee;
-	smenu_entry_t *entry;
-	startmenu_entry_t *smentry;
-	const char *cmd;
-	const char *caption;
-	bool terminal;
-	errno_t rc;
-
-	(void)bok;
-	smee = (smeedit_t *)arg;
-
-	cmd = ui_entry_get_text(smee->ecmd);
-	caption = ui_entry_get_text(smee->ecaption);
-	terminal = ui_checkbox_get_checked(smee->cbterminal);
-
-	if (smee->smentry == NULL) {
-		/* Create new entry */
-		rc = smenu_entry_create(smee->startmenu->tbarcfg->tbarcfg,
-		    caption, cmd, terminal, &entry);
-		if (rc != EOK)
-			return;
-
-		rc = startmenu_insert(smee->startmenu, entry, &smentry);
-		if (rc != EOK)
-			return;
-
-		startmenu_repaint(smee->startmenu);
-		(void)tbarcfg_sync(smee->startmenu->tbarcfg->tbarcfg);
-		(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-	} else {
-		/* Edit existing entry */
-		rc = smenu_entry_set_cmd(smee->smentry->entry, cmd);
-		if (rc != EOK)
-			return;
-
-		smenu_entry_set_caption(smee->smentry->entry, caption);
-		if (rc != EOK)
-			return;
-
-		smenu_entry_set_terminal(smee->smentry->entry, terminal);
-		if (rc != EOK)
-			return;
-
-		(void)tbarcfg_sync(smee->startmenu->tbarcfg->tbarcfg);
-		startmenu_entry_update(smee->smentry);
-		(void)tbarcfg_sync(smee->startmenu->tbarcfg->tbarcfg);
-		(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-	}
-
-	smeedit_destroy(smee);
-}
-
-/** Cancel button clicked.
- *
- * @params bok OK button
- * @params arg Argument (smeedit_t *)
- */
-static void smeedit_cancel_clicked(ui_pbutton_t *bcancel, void *arg)
-{
-	smeedit_t *smee;
-
-	(void)bcancel;
-	smee = (smeedit_t *)arg;
-	smeedit_destroy(smee);
-}
-
-/** @}
- */
Index: pace/app/taskbar-cfg/smeedit.h
===================================================================
--- uspace/app/taskbar-cfg/smeedit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Start menu entry edit dialog
- */
-
-#ifndef SMEEDIT_H
-#define SMEEDIT_H
-
-#include "types/smeedit.h"
-#include "types/startmenu.h"
-
-extern errno_t smeedit_create(startmenu_t *, startmenu_entry_t *, smeedit_t **);
-extern void smeedit_destroy(smeedit_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar-cfg/startmenu.c
===================================================================
--- uspace/app/taskbar-cfg/startmenu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,715 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/** @file Start menu configuration tab
- */
-
-#include <gfx/coord.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <tbarcfg/tbarcfg.h>
-#include <ui/control.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/tab.h>
-#include <ui/window.h>
-#include "smeedit.h"
-#include "startmenu.h"
-#include "taskbar-cfg.h"
-
-static void startmenu_entry_selected(ui_list_entry_t *, void *);
-static void startmenu_new_entry_clicked(ui_pbutton_t *, void *);
-static void startmenu_delete_entry_clicked(ui_pbutton_t *, void *);
-static void startmenu_edit_entry_clicked(ui_pbutton_t *, void *);
-static void startmenu_sep_entry_clicked(ui_pbutton_t *, void *);
-static void startmenu_up_entry_clicked(ui_pbutton_t *, void *);
-static void startmenu_down_entry_clicked(ui_pbutton_t *, void *);
-
-/** Entry list callbacks */
-ui_list_cb_t startmenu_entry_list_cb = {
-	.selected = startmenu_entry_selected
-};
-
-/** New entry button callbacks */
-ui_pbutton_cb_t startmenu_new_entry_button_cb = {
-	.clicked = startmenu_new_entry_clicked
-};
-
-/** Delete entry button callbacks */
-ui_pbutton_cb_t startmenu_delete_entry_button_cb = {
-	.clicked = startmenu_delete_entry_clicked
-};
-
-/** Edit entry button callbacks */
-ui_pbutton_cb_t startmenu_edit_entry_button_cb = {
-	.clicked = startmenu_edit_entry_clicked
-};
-
-/** Separator entry button callbacks */
-ui_pbutton_cb_t startmenu_sep_entry_button_cb = {
-	.clicked = startmenu_sep_entry_clicked
-};
-
-/** Move entry up button callbacks */
-ui_pbutton_cb_t startmenu_up_entry_button_cb = {
-	.clicked = startmenu_up_entry_clicked
-};
-
-/** Move entry down button callbacks */
-ui_pbutton_cb_t startmenu_down_entry_button_cb = {
-	.clicked = startmenu_down_entry_clicked
-};
-
-/** Create start menu configuration tab
- *
- * @param tbcfg Taskbar configuration dialog
- * @param rsmenu Place to store pointer to new start menu configuration tab
- * @return EOK on success or an error code
- */
-errno_t startmenu_create(taskbar_cfg_t *tbcfg, startmenu_t **rsmenu)
-{
-	ui_resource_t *ui_res;
-	startmenu_t *smenu;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	ui_res = ui_window_get_res(tbcfg->window);
-
-	smenu = calloc(1, sizeof(startmenu_t));
-	if (smenu == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	smenu->tbarcfg = tbcfg;
-
-	/* 'Start Menu' tab */
-
-	rc = ui_tab_create(tbcfg->tabset, "Start Menu", &smenu->tab);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_fixed_create(&smenu->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	/* 'Start menu entries:' label */
-
-	rc = ui_label_create(ui_res, "Start menu entries:",
-	    &smenu->entries_label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 4;
-		rect.p1.x = 36;
-		rect.p1.y = 5;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 60;
-		rect.p1.x = 360;
-		rect.p1.y = 80;
-	}
-
-	ui_label_set_rect(smenu->entries_label, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_label_ctl(smenu->entries_label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	/* List of entries */
-
-	rc = ui_list_create(tbcfg->window, false, &smenu->entries_list);
-	if (rc != EOK) {
-		printf("Error creating list.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 56;
-		rect.p1.y = 20;
-	} else {
-		rect.p0.x = 20;
-		rect.p0.y = 80;
-		rect.p1.x = 360;
-		rect.p1.y = 330;
-	}
-
-	ui_list_set_rect(smenu->entries_list, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_list_ctl(smenu->entries_list));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_list_set_cb(smenu->entries_list, &startmenu_entry_list_cb,
-	    (void *)smenu);
-
-	/* New entry button */
-
-	rc = ui_pbutton_create(ui_res, "New...", &smenu->new_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 5;
-		rect.p1.x = 68;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 80;
-		rect.p1.x = 450;
-		rect.p1.y = 105;
-	}
-
-	ui_pbutton_set_rect(smenu->new_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->new_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->new_entry, &startmenu_new_entry_button_cb,
-	    (void *)smenu);
-
-	/* Delete entry button */
-
-	rc = ui_pbutton_create(ui_res, "Delete", &smenu->delete_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 7;
-		rect.p1.x = 68;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 110;
-		rect.p1.x = 450;
-		rect.p1.y = 135;
-	}
-
-	ui_pbutton_set_rect(smenu->delete_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->delete_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->delete_entry,
-	    &startmenu_delete_entry_button_cb, (void *)smenu);
-
-	/* Edit entry button */
-
-	rc = ui_pbutton_create(ui_res, "Edit...", &smenu->edit_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 9;
-		rect.p1.x = 68;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 140;
-		rect.p1.x = 450;
-		rect.p1.y = 165;
-	}
-
-	ui_pbutton_set_rect(smenu->edit_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->edit_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->edit_entry,
-	    &startmenu_edit_entry_button_cb, (void *)smenu);
-
-	/* Separator entry button */
-
-	rc = ui_pbutton_create(ui_res, "Separator", &smenu->sep_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 11;
-		rect.p1.x = 68;
-		rect.p1.y = 12;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 170;
-		rect.p1.x = 450;
-		rect.p1.y = 195;
-	}
-
-	ui_pbutton_set_rect(smenu->sep_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->sep_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->sep_entry,
-	    &startmenu_sep_entry_button_cb, (void *)smenu);
-
-	/* Move entry up button */
-
-	rc = ui_pbutton_create(ui_res, "Up", &smenu->up_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 13;
-		rect.p1.x = 68;
-		rect.p1.y = 14;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 220;
-		rect.p1.x = 450;
-		rect.p1.y = 245;
-	}
-
-	ui_pbutton_set_rect(smenu->up_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->up_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->up_entry,
-	    &startmenu_up_entry_button_cb, (void *)smenu);
-
-	/* Move entry down button */
-
-	rc = ui_pbutton_create(ui_res, "Down", &smenu->down_entry);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		goto error;
-	}
-
-	if (ui_resource_is_textmode(ui_res)) {
-		rect.p0.x = 58;
-		rect.p0.y = 15;
-		rect.p1.x = 68;
-		rect.p1.y = 16;
-	} else {
-		rect.p0.x = 370;
-		rect.p0.y = 250;
-		rect.p1.x = 450;
-		rect.p1.y = 275;
-	}
-
-	ui_pbutton_set_rect(smenu->down_entry, &rect);
-
-	rc = ui_fixed_add(smenu->fixed, ui_pbutton_ctl(smenu->down_entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		goto error;
-	}
-
-	ui_pbutton_set_cb(smenu->down_entry,
-	    &startmenu_down_entry_button_cb, (void *)smenu);
-
-	ui_tab_add(smenu->tab, ui_fixed_ctl(smenu->fixed));
-
-	*rsmenu = smenu;
-	return EOK;
-error:
-	if (smenu->down_entry != NULL)
-		ui_pbutton_destroy(smenu->down_entry);
-	if (smenu->up_entry != NULL)
-		ui_pbutton_destroy(smenu->up_entry);
-	if (smenu->delete_entry != NULL)
-		ui_pbutton_destroy(smenu->delete_entry);
-	if (smenu->new_entry != NULL)
-		ui_pbutton_destroy(smenu->new_entry);
-	if (smenu->entries_label != NULL)
-		ui_label_destroy(smenu->entries_label);
-	if (smenu->entries_list != NULL)
-		ui_list_destroy(smenu->entries_list);
-	if (smenu->fixed != NULL)
-		ui_fixed_destroy(smenu->fixed);
-	free(smenu);
-	return rc;
-}
-
-/** Populate start menu tab with start menu configuration data
- *
- * @param smenu Start menu configuration tab
- * @param tbarcfg Taskbar configuration
- * @return EOK on success or an error code
- */
-errno_t startmenu_populate(startmenu_t *smenu, tbarcfg_t *tbarcfg)
-{
-	smenu_entry_t *entry;
-	startmenu_entry_t *smentry;
-	errno_t rc;
-
-	entry = tbarcfg_smenu_first(tbarcfg);
-	while (entry != NULL) {
-		rc = startmenu_insert(smenu, entry, &smentry);
-		if (rc != EOK)
-			return rc;
-
-		entry = tbarcfg_smenu_next(entry);
-	}
-
-	return EOK;
-}
-
-/** Destroy start menu configuration tab.
- *
- * @param smenu Start menu configuration tab
- */
-void startmenu_destroy(startmenu_t *smenu)
-{
-	ui_list_entry_t *lentry;
-	startmenu_entry_t *entry;
-
-	lentry = ui_list_first(smenu->entries_list);
-	while (lentry != NULL) {
-		entry = (startmenu_entry_t *)ui_list_entry_get_arg(lentry);
-		free(entry);
-		ui_list_entry_delete(lentry);
-		lentry = ui_list_first(smenu->entries_list);
-	}
-
-	/* This will automatically destroy all controls in the tab */
-	ui_tab_destroy(smenu->tab);
-	free(smenu);
-}
-
-/** Insert new entry into entries list.
- *
- * @param smenu Start menu configuration tab
- * @param entry Backing entry
- * @param rsmentry Place to store pointer to new entry or NULL
- * @return EOK on success or an error code
- */
-errno_t startmenu_insert(startmenu_t *smenu, smenu_entry_t *entry,
-    startmenu_entry_t **rsmentry)
-{
-	startmenu_entry_t *smentry;
-	ui_list_entry_attr_t attr;
-	bool separator;
-	errno_t rc;
-
-	smentry = calloc(1, sizeof(startmenu_entry_t));
-	if (smentry == NULL)
-		return ENOMEM;
-
-	smentry->startmenu = smenu;
-	smentry->entry = entry;
-
-	ui_list_entry_attr_init(&attr);
-	separator = smenu_entry_get_separator(entry);
-	if (separator)
-		attr.caption = "-- Separator --";
-	else
-		attr.caption = smenu_entry_get_caption(entry);
-
-	attr.arg = (void *)smentry;
-
-	rc = ui_list_entry_append(smenu->entries_list, &attr, &smentry->lentry);
-	if (rc != EOK) {
-		free(smentry);
-		return rc;
-	}
-
-	if (rsmentry != NULL)
-		*rsmentry = smentry;
-	return EOK;
-}
-
-/** Get selected start menu entry.
- *
- * @param smenu Start menu
- * @return Selected entry or @c NULL if no entry is selected
- */
-startmenu_entry_t *startmenu_get_selected(startmenu_t *smenu)
-{
-	ui_list_entry_t *entry;
-
-	entry = ui_list_get_cursor(smenu->entries_list);
-	if (entry == NULL)
-		return NULL;
-
-	return (startmenu_entry_t *)ui_list_entry_get_arg(entry);
-}
-
-/** Create new menu entry.
- *
- * @param smenu Start menu
- */
-void startmenu_new_entry(startmenu_t *smenu)
-{
-	smeedit_t *smee;
-	errno_t rc;
-
-	rc = smeedit_create(smenu, NULL, &smee);
-	if (rc != EOK)
-		return;
-
-	(void)smee;
-	(void)tbarcfg_sync(smenu->tbarcfg->tbarcfg);
-	(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-}
-
-/** Create new separator menu entry.
- *
- * @param smenu Start menu
- */
-void startmenu_sep_entry(startmenu_t *smenu)
-{
-	startmenu_entry_t *smentry = NULL;
-	smenu_entry_t *entry;
-	errno_t rc;
-
-	rc = smenu_entry_sep_create(smenu->tbarcfg->tbarcfg, &entry);
-	if (rc != EOK)
-		return;
-
-	(void)startmenu_insert(smenu, entry, &smentry);
-	(void)ui_control_paint(ui_list_ctl(smenu->entries_list));
-	(void)tbarcfg_sync(smenu->tbarcfg->tbarcfg);
-	(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-}
-
-/** Edit selected menu entry.
- *
- * @param smenu Start menu
- */
-void startmenu_edit(startmenu_t *smenu)
-{
-	smeedit_t *smee;
-	startmenu_entry_t *smentry;
-	errno_t rc;
-
-	smentry = startmenu_get_selected(smenu);
-	if (smentry == NULL)
-		return;
-
-	/* Do not edit separator entries */
-	if (smenu_entry_get_separator(smentry->entry))
-		return;
-
-	rc = smeedit_create(smenu, smentry, &smee);
-	if (rc != EOK)
-		return;
-
-	(void)smee;
-}
-
-/** Update start menu entry caption.
- *
- * When editing an entry the entry's label might change. We need
- * to update the list entry caption to reflect that.
- *
- * @param entry Start menu entry
- */
-errno_t startmenu_entry_update(startmenu_entry_t *entry)
-{
-	return ui_list_entry_set_caption(entry->lentry,
-	    smenu_entry_get_caption(entry->entry));
-}
-
-/** Repaint start menu entry list.
- *
- * When editing an entry the entry's label might change. We need
- * to update the list entry caption to reflect that.
- *
- * @param smenu Start menu
- */
-void startmenu_repaint(startmenu_t *smenu)
-{
-	(void) ui_control_paint(ui_list_ctl(smenu->entries_list));
-}
-
-/** Entry in entry list is selected.
- *
- * @param lentry UI list entry
- * @param arg Argument (dcfg_seats_entry_t *)
- */
-static void startmenu_entry_selected(ui_list_entry_t *lentry, void *arg)
-{
-	(void)lentry;
-	(void)arg;
-}
-
-/** New entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_new_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-
-	(void)pbutton;
-	startmenu_new_entry(smenu);
-}
-
-/** Delete entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_delete_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-	startmenu_entry_t *smentry;
-
-	(void)pbutton;
-
-	smentry = startmenu_get_selected(smenu);
-	if (smentry == NULL)
-		return;
-
-	smenu_entry_destroy(smentry->entry);
-	ui_list_entry_delete(smentry->lentry);
-	free(smentry);
-
-	(void)ui_control_paint(ui_list_ctl(smenu->entries_list));
-	(void)tbarcfg_sync(smenu->tbarcfg->tbarcfg);
-	(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-}
-
-/** Edit entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_edit_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-
-	(void)pbutton;
-	startmenu_edit(smenu);
-}
-
-/** Separator entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_sep_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-
-	(void)pbutton;
-	startmenu_sep_entry(smenu);
-}
-
-/** Up entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_up_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-	startmenu_entry_t *smentry;
-
-	(void)pbutton;
-
-	smentry = startmenu_get_selected(smenu);
-	if (smentry == NULL)
-		return;
-
-	smenu_entry_move_up(smentry->entry);
-	ui_list_entry_move_up(smentry->lentry);
-
-	(void)ui_control_paint(ui_list_ctl(smenu->entries_list));
-	(void)tbarcfg_sync(smenu->tbarcfg->tbarcfg);
-	(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-}
-
-/** Down entry button clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (startmenu_t *)
- */
-static void startmenu_down_entry_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	startmenu_t *smenu = (startmenu_t *)arg;
-	startmenu_entry_t *smentry;
-
-	(void)pbutton;
-
-	smentry = startmenu_get_selected(smenu);
-	if (smentry == NULL)
-		return;
-
-	smenu_entry_move_down(smentry->entry);
-	ui_list_entry_move_down(smentry->lentry);
-
-	(void)ui_control_paint(ui_list_ctl(smenu->entries_list));
-	(void)tbarcfg_sync(smenu->tbarcfg->tbarcfg);
-	(void)tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-}
-
-/** @}
- */
Index: pace/app/taskbar-cfg/startmenu.h
===================================================================
--- uspace/app/taskbar-cfg/startmenu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Start menu configuration tab
- */
-
-#ifndef STARTMENU_H
-#define STARTMENU_H
-
-#include <tbarcfg/tbarcfg.h>
-#include "types/startmenu.h"
-#include "types/taskbar-cfg.h"
-
-extern errno_t startmenu_create(taskbar_cfg_t *, startmenu_t **);
-extern errno_t startmenu_populate(startmenu_t *, tbarcfg_t *);
-extern void startmenu_destroy(startmenu_t *);
-extern errno_t startmenu_insert(startmenu_t *, smenu_entry_t *,
-    startmenu_entry_t **);
-extern startmenu_entry_t *startmenu_get_selected(startmenu_t *);
-extern void startmenu_new_entry(startmenu_t *);
-extern void startmenu_sep_entry(startmenu_t *);
-extern void startmenu_edit(startmenu_t *);
-extern errno_t startmenu_entry_update(startmenu_entry_t *);
-extern void startmenu_repaint(startmenu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar-cfg/taskbar-cfg.c
===================================================================
--- uspace/app/taskbar-cfg/taskbar-cfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/** @file Taskbar configuration utility (UI)
- */
-
-#include <gfx/coord.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/resource.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "taskbar-cfg.h"
-#include "startmenu.h"
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (tbcfg)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	taskbar_cfg_t *tbcfg = (taskbar_cfg_t *) arg;
-
-	ui_quit(tbcfg->ui);
-}
-
-/** Create Taskbar configuration window.
- *
- * @param display_spec Display specification
- * @param rdcfg Place to store pointer to new taskbar configuration
- * @return EOK on success or an error code
- */
-errno_t taskbar_cfg_create(const char *display_spec, taskbar_cfg_t **rdcfg)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_cfg_t *tbcfg = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-	errno_t rc;
-
-	tbcfg = calloc(1, sizeof(taskbar_cfg_t));
-	if (tbcfg == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Taskbar Configuration";
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 70;
-		params.rect.p1.y = 23;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 470;
-		params.rect.p1.y = 350;
-	}
-
-	tbcfg->ui = ui;
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *)tbcfg);
-	tbcfg->window = window;
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&tbcfg->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_tab_set_create(ui_res, &tbcfg->tabset);
-	if (rc != EOK) {
-		printf("Error creating tab set.\n");
-		return rc;
-	}
-
-	ui_window_get_app_rect(window, &rect);
-	ui_tab_set_set_rect(tbcfg->tabset, &rect);
-
-	rc = ui_fixed_add(tbcfg->fixed, ui_tab_set_ctl(tbcfg->tabset));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = startmenu_create(tbcfg, &tbcfg->startmenu);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_add(window, ui_fixed_ctl(tbcfg->fixed));
-
-	*rdcfg = tbcfg;
-	return EOK;
-error:
-	if (tbcfg->startmenu != NULL)
-		startmenu_destroy(tbcfg->startmenu);
-	if (tbcfg->tabset != NULL)
-		ui_tab_set_destroy(tbcfg->tabset);
-	if (tbcfg->fixed != NULL)
-		ui_fixed_destroy(tbcfg->fixed);
-	if (tbcfg->ui != NULL)
-		ui_destroy(ui);
-	free(tbcfg);
-	return rc;
-}
-
-/** Open Taskbar configuration.
- *
- * @param tbcfg Taskbar configuration dialog
- * @param cfg_repo Path to configuration repository
- * @return EOK on success or an error code
- */
-errno_t taskbar_cfg_open(taskbar_cfg_t *tbcfg, const char *cfg_repo)
-{
-	errno_t rc;
-
-	rc = tbarcfg_open(cfg_repo, &tbcfg->tbarcfg);
-	if (rc != EOK) {
-		rc = tbarcfg_create(cfg_repo, &tbcfg->tbarcfg);
-		if (rc != EOK) {
-			printf("Error opening Taskbar configuration.\n");
-			goto error;
-		}
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Populate task configuration from configuration repository.
- *
- * @param tbcfg Taskbar configuration dialog
- * @return EOK on success or an error code
- */
-errno_t taskbar_cfg_populate(taskbar_cfg_t *tbcfg)
-{
-	errno_t rc;
-
-	rc = startmenu_populate(tbcfg->startmenu, tbcfg->tbarcfg);
-	if (rc != EOK)
-		return rc;
-
-	rc = ui_window_paint(tbcfg->window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Destroy Taskbar configuration window.
- *
- * @param tbcfg Taskbar configuration window
- */
-void taskbar_cfg_destroy(taskbar_cfg_t *tbcfg)
-{
-	if (tbcfg->tbarcfg != NULL)
-		tbarcfg_close(tbcfg->tbarcfg);
-	ui_window_destroy(tbcfg->window);
-	ui_destroy(tbcfg->ui);
-}
-
-/** @}
- */
Index: pace/app/taskbar-cfg/taskbar-cfg.h
===================================================================
--- uspace/app/taskbar-cfg/taskbar-cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Taskbar configuration utility (in UI)
- */
-
-#ifndef TASKBAR_CFG_H
-#define TASKBAR_CFG_H
-
-#include "types/taskbar-cfg.h"
-
-extern errno_t taskbar_cfg_create(const char *, taskbar_cfg_t **);
-extern errno_t taskbar_cfg_open(taskbar_cfg_t *, const char *);
-extern errno_t taskbar_cfg_populate(taskbar_cfg_t *);
-extern void taskbar_cfg_destroy(taskbar_cfg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar-cfg/test/main.c
===================================================================
--- uspace/app/taskbar-cfg/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(taskbar_cfg);
-PCUT_IMPORT(startmenu);
-
-PCUT_MAIN();
Index: pace/app/taskbar-cfg/test/startmenu.c
===================================================================
--- uspace/app/taskbar-cfg/test/startmenu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <dispcfg.h>
-#include <dispcfg_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include <testdc.h>
-#include "../display-cfg.h"
-#include "../seats.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(seats);
-
-static const char *test_dispcfg_server = "test-dispcfg";
-static const char *test_dispcfg_svc = "test/dispcfg";
-
-/** Test dcfg_seats_create() and dcfg_seats_destroy() */
-PCUT_TEST(create_destroy)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_seats_insert() inserts an entry into the seat list */
-PCUT_TEST(seats_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	dcfg_seats_entry_t *entry = NULL;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_insert(seats, "Alice", 42, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("Alice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->seat_id);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_seats_list_populate() populates seat list */
-PCUT_TEST(seats_list_populate)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_cfg_open(dcfg, test_dispcfg_svc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * dcfg_seat_list_populate() calls dispcfg_get_seat_list()
-	 * and dispcfg_get_seat_info()
-	 */
-	resp.rc = EOK;
-	resp.get_seat_list_rlist = calloc(1, sizeof(dispcfg_seat_list_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist);
-	resp.get_seat_list_rlist->nseats = 1;
-	resp.get_seat_list_rlist->seats = calloc(1, sizeof(sysarg_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist->seats);
-	resp.get_seat_list_rlist->seats[0] = 42;
-
-	resp.get_seat_info_rinfo = calloc(1, sizeof(dispcfg_seat_info_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo);
-	resp.get_seat_info_rinfo->name = str_dup("Alice");
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo->name);
-
-	rc = dcfg_seats_list_populate(seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dcfg_devices_insert() inserts an entry into the device list */
-PCUT_TEST(devices_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	ui_list_entry_t *lentry;
-	dcfg_devices_entry_t *entry;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_devices_insert(seats, "mydevice", 42);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lentry = ui_list_first(seats->device_list);
-	PCUT_ASSERT_NOT_NULL(lentry);
-	entry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("mydevice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->svc_id);
-
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-/** dcfg_avail_devices_insert() inserts entry into available devices list */
-PCUT_TEST(avail_devices_insert)
-{
-	display_cfg_t *dcfg;
-	dcfg_seats_t *seats;
-	ui_list_entry_t *lentry;
-	dcfg_devices_entry_t *entry;
-	ui_select_dialog_t *dialog;
-	ui_select_dialog_params_t sdparams;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_seats_create(dcfg, &seats);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&sdparams);
-	sdparams.caption = "Dialog";
-	sdparams.prompt = "Select";
-
-	rc = ui_select_dialog_create(seats->dcfg->ui, &sdparams, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dcfg_avail_devices_insert(seats, dialog, "mydevice", 42);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lentry = ui_list_first(ui_select_dialog_list(dialog));
-	PCUT_ASSERT_NOT_NULL(lentry);
-	entry = (dcfg_devices_entry_t *)ui_list_entry_get_arg(lentry);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	PCUT_ASSERT_STR_EQUALS("mydevice", entry->name);
-	PCUT_ASSERT_INT_EQUALS(42, entry->svc_id);
-
-	ui_select_dialog_destroy(dialog);
-	dcfg_seats_destroy(seats);
-	display_cfg_destroy(dcfg);
-}
-
-PCUT_TEST(asgn_dev_list_populate)
-{
-}
-
-PCUT_TEST(avail_dev_list_populate)
-{
-}
-
-PCUT_TEST(seats_get_selected)
-{
-}
-
-PCUT_TEST(devices_get_selected)
-{
-}
-
-PCUT_TEST(seats_list_selected)
-{
-}
-
-PCUT_TEST(add_seat_clicked)
-{
-}
-
-PCUT_TEST(remove_seat_clicked)
-{
-}
-
-PCUT_TEST(add_seat_dialog_bok)
-{
-}
-
-PCUT_TEST(add_seat_dialog_bcancel)
-{
-}
-
-PCUT_TEST(add_seat_dialog_close)
-{
-}
-
-PCUT_TEST(add_device_clicked)
-{
-}
-
-PCUT_TEST(remove_device_clicked)
-{
-}
-
-PCUT_TEST(add_device_dialog_bok)
-{
-}
-
-PCUT_TEST(add_device_dialog_bcancel)
-{
-}
-
-PCUT_TEST(add_device_dialog_close)
-{
-}
-
-PCUT_EXPORT(seats);
Index: pace/app/taskbar-cfg/test/taskbar-cfg.c
===================================================================
--- uspace/app/taskbar-cfg/test/taskbar-cfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <ui/ui.h>
-#include "../display-cfg.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(display_cfg);
-
-/** Test display_cfg_create() and display_cfg_destroy() */
-PCUT_TEST(create_destroy)
-{
-	display_cfg_t *dcfg;
-	errno_t rc;
-
-	rc = display_cfg_create(UI_DISPLAY_NULL, &dcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_cfg_destroy(dcfg);
-}
-
-PCUT_EXPORT(display_cfg);
Index: pace/app/taskbar-cfg/types/smeedit.h
===================================================================
--- uspace/app/taskbar-cfg/types/smeedit.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Start menu entry edit dialog
- */
-
-#ifndef TYPES_SMEEDIT_H
-#define TYPES_SMEEDIT_H
-
-#include <ui/checkbox.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/entry.h>
-#include <ui/pbutton.h>
-#include <ui/window.h>
-
-/** Start menu entry edit dialog */
-typedef struct smeedit {
-	/** Containing start menu configuration tab */
-	struct startmenu *startmenu;
-	/** Start menu entry or @c NULL if creating a new entry */
-	struct startmenu_entry *smentry;
-	/** Window */
-	ui_window_t *window;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** 'Caption' label */
-	ui_label_t *lcaption;
-	/** Caption entry */
-	ui_entry_t *ecaption;
-	/** 'Command' label */
-	ui_label_t *lcmd;
-	/** Command entry */
-	ui_entry_t *ecmd;
-	/** Start in terminal checkbox */
-	ui_checkbox_t *cbterminal;
-	/** OK button */
-	ui_pbutton_t *bok;
-	/** Cancel button */
-	ui_pbutton_t *bcancel;
-} smeedit_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar-cfg/types/startmenu.h
===================================================================
--- uspace/app/taskbar-cfg/types/startmenu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Start menu configuration tab
- */
-
-#ifndef TYPES_STARTMENU_H
-#define TYPES_STARTMENU_H
-
-#include <tbarcfg/tbarcfg.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/pbutton.h>
-#include <ui/tab.h>
-
-/** Start menu configuration tab */
-typedef struct startmenu {
-	/** Containing taskbar configuration */
-	struct taskbar_cfg *tbarcfg;
-	/** UI tab */
-	ui_tab_t *tab;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** 'Start menu entries' label */
-	ui_label_t *entries_label;
-	/** List of start menu entries */
-	ui_list_t *entries_list;
-	/** New entry button */
-	ui_pbutton_t *new_entry;
-	/** Delete entry button */
-	ui_pbutton_t *delete_entry;
-	/** Edit entry button */
-	ui_pbutton_t *edit_entry;
-	/** Separator entry button */
-	ui_pbutton_t *sep_entry;
-	/** Move entry up button */
-	ui_pbutton_t *up_entry;
-	/** Move entry down button */
-	ui_pbutton_t *down_entry;
-} startmenu_t;
-
-/** Start menu entry */
-typedef struct startmenu_entry {
-	/** Containing start menu configuration tab */
-	struct startmenu *startmenu;
-	/** Backing entry */
-	smenu_entry_t *entry;
-	/** List entry */
-	ui_list_entry_t *lentry;
-} startmenu_entry_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar-cfg/types/taskbar-cfg.h
===================================================================
--- uspace/app/taskbar-cfg/types/taskbar-cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar-cfg
- * @{
- */
-/**
- * @file Taskbar configuration utility (UI) types
- */
-
-#ifndef TYPES_TASKBAR_CFG_H
-#define TYPES_TASKBAR_CFG_H
-
-#include <tbarcfg/tbarcfg.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** Taskbar configuration utility (UI) */
-typedef struct taskbar_cfg {
-	/** Taskbar configuration */
-	tbarcfg_t *tbarcfg;
-	/** UI */
-	ui_t *ui;
-	/** Containing window */
-	ui_window_t *window;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** Tab set */
-	ui_tab_set_t *tabset;
-	/** Start menu configuration tab */
-	struct startmenu *startmenu;
-} taskbar_cfg_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/clock.c
===================================================================
--- uspace/app/taskbar/clock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,360 +1,0 @@
-/*
- * Copyright (c) 2025 Wayne Michael Thornton (WMT) <wmthornton-dev@outlook.com>
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/** @file Taskbar clock.
- *
- * Displays the current time in an inset frame.
- */
-
-#include <errno.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <task.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include "clock.h"
-
-static void taskbar_clock_ctl_destroy(void *);
-static errno_t taskbar_clock_ctl_paint(void *);
-static ui_evclaim_t taskbar_clock_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t taskbar_clock_ctl_pos_event(void *, pos_event_t *);
-static void taskbar_clock_timer(void *);
-
-/** Taskbar clock control ops */
-static ui_control_ops_t taskbar_clock_ctl_ops = {
-	.destroy = taskbar_clock_ctl_destroy,
-	.paint = taskbar_clock_ctl_paint,
-	.kbd_event = taskbar_clock_ctl_kbd_event,
-	.pos_event = taskbar_clock_ctl_pos_event
-};
-
-/** Create taskbar clock.
- *
- * @param window Containing window
- * @param rclock Place to store pointer to new clock
- * @return EOK on success or an error code
- */
-errno_t taskbar_clock_create(ui_window_t *window, taskbar_clock_t **rclock)
-{
-	taskbar_clock_t *clock;
-	errno_t rc;
-
-	clock = calloc(1, sizeof(taskbar_clock_t));
-	if (clock == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&taskbar_clock_ctl_ops, (void *)clock,
-	    &clock->control);
-	if (rc != EOK) {
-		free(clock);
-		return rc;
-	}
-
-	clock->timer = fibril_timer_create(NULL);
-	if (clock->timer == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_mutex_initialize(&clock->lock);
-	fibril_condvar_initialize(&clock->timer_done_cv);
-	fibril_timer_set(clock->timer, 1000000, taskbar_clock_timer, clock);
-
-	clock->window = window;
-	*rclock = clock;
-	return EOK;
-error:
-	ui_control_delete(clock->control);
-	free(clock);
-	return rc;
-}
-
-/** Destroy taskbar clock.
- *
- * @param clock Taskbar clock
- */
-void taskbar_clock_destroy(taskbar_clock_t *clock)
-{
-	/*
-	 * Signal to the timer that we are cleaning up. If the timer handler
-	 * misses it and sets the timer again, we will clear that active
-	 * timer and be done (and if we were even slower and the timer
-	 * fired again, it's the same situation as before.
-	 */
-	fibril_mutex_lock(&clock->lock);
-	clock->timer_cleanup = true;
-	fibril_mutex_unlock(&clock->lock);
-
-	/* If we catch the timer while it's active, there's nothing to do. */
-	if (fibril_timer_clear(clock->timer) != fts_active) {
-		/* Need to wait for timer handler to finish */
-		fibril_mutex_lock(&clock->lock);
-		while (clock->timer_done == false)
-			fibril_condvar_wait(&clock->timer_done_cv, &clock->lock);
-		fibril_mutex_unlock(&clock->lock);
-	}
-
-	fibril_timer_destroy(clock->timer);
-	ui_control_delete(clock->control);
-	free(clock);
-}
-
-static errno_t taskbar_clock_get_text(taskbar_clock_t *clock, char *buf,
-    size_t bsize)
-{
-	struct timespec ts;
-	struct tm tm;
-	errno_t rc;
-
-	getrealtime(&ts);
-	rc = time_utc2tm(ts.tv_sec, &tm);
-	if (rc != EOK)
-		return rc;
-
-	snprintf(buf, bsize, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
-	    tm.tm_sec);
-	return EOK;
-}
-
-/** Paint taskbar clock.
- *
- * @param clock Taskbar clock
- */
-errno_t taskbar_clock_paint(taskbar_clock_t *clock)
-{
-	gfx_context_t *gc = ui_window_get_gc(clock->window);
-	ui_resource_t *res = ui_window_get_res(clock->window);
-	ui_t *ui = ui_window_get_ui(clock->window);
-	char buf[10];
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	gfx_rect_t irect;
-	errno_t rc;
-
-	if (!ui_is_textmode(ui)) {
-		/* Paint frame */
-		rc = ui_paint_inset_frame(res, &clock->rect, &irect);
-		if (rc != EOK)
-			goto error;
-	} else {
-		irect = clock->rect;
-	}
-
-	rc = gfx_set_color(gc, ui_resource_get_wnd_face_color(res));
-	if (rc != EOK)
-		goto error;
-
-	/* Fill background */
-	rc = gfx_fill_rect(gc, &irect);
-	if (rc != EOK)
-		goto error;
-
-	pos.x = (irect.p0.x + irect.p1.x) / 2;
-	pos.y = (irect.p0.y + irect.p1.y) / 2;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = ui_resource_get_font(res);
-	fmt.color = ui_resource_get_wnd_text_color(res);
-	fmt.halign = gfx_halign_center;
-	fmt.valign = gfx_valign_center;
-
-	rc = taskbar_clock_get_text(clock, buf, sizeof(buf));
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_puttext(&pos, &fmt, buf);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Handle taskbar clock keyboard event.
- *
- * @param clock Taskbar clock
- * @param event Keyboard event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t taskbar_clock_kbd_event(taskbar_clock_t *clock, kbd_event_t *event)
-{
-	return ui_unclaimed;
-}
-
-/** Launch date configuration application */
-static errno_t taskbar_clock_launch_date_cfg(void)
-{
-	task_id_t id;
-	const char *args[] = { "/app/date_cfg", NULL };
-	return task_spawnv(&id, NULL, args[0], args);
-}
-
-/** Handle taskbar clock position event.
- *
- * @param clock Taskbar clock
- * @param event Position event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t taskbar_clock_pos_event(taskbar_clock_t *clock, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	if (!gfx_pix_inside_rect(&pos, &clock->rect))
-		return ui_unclaimed;
-
-	if (event->type == POS_PRESS) {
-		taskbar_clock_launch_date_cfg();
-	}
-
-	return ui_claimed;
-}
-
-/** Get base control for taskbar clock.
- *
- * @param clock Taskbar clock
- * @return Base UI control
- */
-ui_control_t *taskbar_clock_ctl(taskbar_clock_t *clock)
-{
-	return clock->control;
-}
-
-/** Set taskbar clock rectangle.
- *
- * @param clock Taskbar clock
- * @param rect Rectangle
- */
-void taskbar_clock_set_rect(taskbar_clock_t *clock, gfx_rect_t *rect)
-{
-	gfx_rect_t irect;
-
-	clock->rect = *rect;
-
-	irect.p0.x = clock->rect.p0.x + 1;
-	irect.p0.y = clock->rect.p0.y + 1;
-	irect.p1.x = clock->rect.p1.x;
-	irect.p1.y = clock->rect.p1.y - 1;
-
-	(void)irect;
-}
-
-/** Destroy clock control.
- *
- * @param arg Argument (taskbar_clock_t *)
- */
-void taskbar_clock_ctl_destroy(void *arg)
-{
-	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
-
-	taskbar_clock_destroy(clock);
-}
-
-/** Paint taskbar clock control.
- *
- * @param arg Argument (taskbar_clock_t *)
- * @return EOK on success or an error code
- */
-errno_t taskbar_clock_ctl_paint(void *arg)
-{
-	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
-
-	return taskbar_clock_paint(clock);
-}
-
-/** Handle taskbar clock control keyboard event.
- *
- * @param arg Argument (taskbar_clock_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t taskbar_clock_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
-
-	return taskbar_clock_kbd_event(clock, event);
-}
-
-/** Handle taskbar clock control position event.
- *
- * @param arg Argument (taskbar_clock_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t taskbar_clock_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
-
-	return taskbar_clock_pos_event(clock, event);
-}
-
-/** Taskbar clock timer handler.
- *
- * @param arg Argument (taskbar_clock_t *)
- */
-static void taskbar_clock_timer(void *arg)
-{
-	taskbar_clock_t *clock = (taskbar_clock_t *) arg;
-	ui_t *ui;
-
-	ui = ui_window_get_ui(clock->window);
-	ui_lock(ui);
-
-	fibril_mutex_lock(&clock->lock);
-	if (!ui_is_suspended(ui_window_get_ui(clock->window)))
-		(void) taskbar_clock_paint(clock);
-
-	if (!clock->timer_cleanup) {
-		fibril_timer_set(clock->timer, 1000000, taskbar_clock_timer,
-		    clock);
-	} else {
-		/* Acknowledge timer cleanup */
-		clock->timer_done = true;
-		fibril_condvar_signal(&clock->timer_done_cv);
-	}
-
-	fibril_mutex_unlock(&clock->lock);
-	ui_unlock(ui);
-}
-
-/** @}
- */
Index: pace/app/taskbar/clock.h
===================================================================
--- uspace/app/taskbar/clock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar clock
- */
-
-#ifndef CLOCK_H
-#define CLOCK_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <ui/control.h>
-#include <ui/window.h>
-#include <stdbool.h>
-#include "types/clock.h"
-
-extern errno_t taskbar_clock_create(ui_window_t *, taskbar_clock_t **);
-extern void taskbar_clock_destroy(taskbar_clock_t *);
-extern errno_t taskbar_clock_paint(taskbar_clock_t *);
-extern ui_evclaim_t taskbar_clock_kbd_event(taskbar_clock_t *, kbd_event_t *);
-extern ui_evclaim_t taskbar_clock_pos_event(taskbar_clock_t *, pos_event_t *);
-extern ui_control_t *taskbar_clock_ctl(taskbar_clock_t *);
-extern void taskbar_clock_set_rect(taskbar_clock_t *, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/doc/doxygroups.h
===================================================================
--- uspace/app/taskbar/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup taskbar taskbar
- * @brief Taskbar
- * @ingroup apps
- */
Index: pace/app/taskbar/main.c
===================================================================
--- uspace/app/taskbar/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/** @file Taskbar
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <ui/ui.h>
-#include "taskbar.h"
-
-static void print_syntax(void)
-{
-	printf("Syntax: taskbar [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	const char *wndmgt_svc = WNDMGT_DEFAULT;
-	taskbar_t *taskbar;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else if (str_cmp(argv[i], "-w") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			wndmgt_svc = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = taskbar_create(display_spec, wndmgt_svc, &taskbar);
-	if (rc != EOK)
-		return 1;
-
-	ui_run(taskbar->ui);
-	taskbar_destroy(taskbar);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/taskbar/meson.build
===================================================================
--- uspace/app/taskbar/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'tbarcfg', 'ui', 'wndmgt' ]
-src = files(
-	'clock.c',
-	'main.c',
-	'taskbar.c',
-	'tbsmenu.c',
-	'wndlist.c',
-)
-
-test_src = files(
-	'clock.c',
-	'taskbar.c',
-	'tbsmenu.c',
-	'wndlist.c',
-	'test/clock.c',
-	'test/main.c',
-	'test/taskbar.c',
-	'test/tbsmenu.c',
-	'test/wndlist.c',
-)
-
-installed_data += { 'name': 'taskbar.sif', 'dir': '/cfg' }
Index: pace/app/taskbar/taskbar.c
===================================================================
--- uspace/app/taskbar/taskbar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,363 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/** @file Taskbar
- */
-
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/fixed.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <wndmgt.h>
-#include "clock.h"
-#include "taskbar.h"
-#include "tbsmenu.h"
-#include "wndlist.h"
-
-#define TASKBAR_CONFIG_FILE "/w/cfg/taskbar.sif"
-
-static void taskbar_wnd_close(ui_window_t *, void *);
-static void taskbar_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-static void taskbar_wnd_pos(ui_window_t *, void *, pos_event_t *);
-static void taskbar_notif_cb(void *);
-
-static ui_window_cb_t window_cb = {
-	.close = taskbar_wnd_close,
-	.kbd = taskbar_wnd_kbd,
-	.pos = taskbar_wnd_pos
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (taskbar)
- */
-static void taskbar_wnd_close(ui_window_t *window, void *arg)
-{
-	taskbar_t *taskbar = (taskbar_t *) arg;
-
-	ui_quit(taskbar->ui);
-}
-
-/** Window received keyboard event.
- *
- * @param window Window
- * @param arg Argument (taskbar)
- * @param event Keyboard event
- */
-static void taskbar_wnd_kbd(ui_window_t *window, void *arg, kbd_event_t *event)
-{
-	taskbar_t *taskbar = (taskbar_t *) arg;
-	ui_evclaim_t claim;
-
-	/* Remember ID of device that sent the last event */
-	taskbar->wndlist->ev_idev_id = event->kbd_id;
-	taskbar->tbsmenu->ev_idev_id = event->kbd_id;
-
-	claim = ui_window_def_kbd(window, event);
-	if (claim == ui_claimed)
-		return;
-
-	if (event->type == KEY_PRESS && (event->mods & KM_CTRL) == 0 &&
-	    (event->mods & KM_ALT) == 0 && (event->mods & KM_SHIFT) == 0 &&
-	    event->key == KC_ENTER) {
-		if (!tbsmenu_is_open(taskbar->tbsmenu))
-			tbsmenu_open(taskbar->tbsmenu);
-	}
-}
-
-/** Window received position event.
- *
- * @param window Window
- * @param arg Argument (taskbar)
- * @param event Position event
- */
-static void taskbar_wnd_pos(ui_window_t *window, void *arg, pos_event_t *event)
-{
-	taskbar_t *taskbar = (taskbar_t *) arg;
-
-	/* Remember ID of device that sent the last event */
-	taskbar->wndlist->ev_idev_id = event->pos_id;
-	taskbar->tbsmenu->ev_idev_id = event->pos_id;
-
-	ui_window_def_pos(window, event);
-}
-
-/** Create taskbar.
- *
- * @param display_spec Display specification
- * @param wndmgt_svc Window management service (or WNDMGT_DEFAULT)
- * @param rtaskbar Place to store pointer to new taskbar
- * @return @c EOK on success or an error coe
- */
-errno_t taskbar_create(const char *display_spec, const char *wndmgt_svc,
-    taskbar_t **rtaskbar)
-{
-	ui_wnd_params_t params;
-	taskbar_t *taskbar = NULL;
-	gfx_rect_t scr_rect;
-	gfx_rect_t rect;
-	char *dspec = NULL;
-	char *qmark;
-	errno_t rc;
-
-	taskbar = calloc(1, sizeof(taskbar_t));
-	if (taskbar == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dspec = str_dup(display_spec);
-	if (dspec == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Remove additional arguments */
-	qmark = str_chr(dspec, '?');
-	if (qmark != NULL)
-		*qmark = '\0';
-
-	rc = ui_create(display_spec, &taskbar->ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	rc = ui_get_rect(taskbar->ui, &scr_rect);
-	if (rc != EOK) {
-		if (str_cmp(display_spec, UI_DISPLAY_NULL) != 0) {
-			printf("Error getting screen dimensions.\n");
-			goto error;
-		}
-
-		/* For the sake of unit tests */
-		scr_rect.p0.x = 0;
-		scr_rect.p0.y = 0;
-		scr_rect.p1.x = 100;
-		scr_rect.p1.y = 100;
-	}
-
-	ui_wnd_params_init(&params);
-	params.caption = "Taskbar";
-	params.placement = ui_wnd_place_bottom_left;
-
-	/* Window has no titlebar */
-	params.style &= ~ui_wds_titlebar;
-
-	/* Window is not obscured by other windows */
-	params.flags |= ui_wndf_topmost;
-
-	/* Prevent taskbar window from being listed in taskbar */
-	params.flags |= ui_wndf_system;
-
-	/* Make maximized windows avoid taskbar */
-	params.flags |= ui_wndf_avoid;
-
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = scr_rect.p1.x - scr_rect.p0.x;
-
-	if (ui_is_textmode(taskbar->ui)) {
-		params.rect.p1.y = 1;
-		params.style &= ~ui_wds_frame;
-	} else {
-		params.rect.p1.y = 32;
-	}
-
-	rc = ui_window_create(taskbar->ui, &params, &taskbar->window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	rc = ui_fixed_create(&taskbar->fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		goto error;
-	}
-
-	rc = tbsmenu_create(taskbar->window, taskbar->fixed, dspec,
-	    &taskbar->tbsmenu);
-	if (rc != EOK) {
-		printf("Error creating start menu.\n");
-		goto error;
-	}
-
-	rc = tbsmenu_load(taskbar->tbsmenu, TASKBAR_CONFIG_FILE);
-	if (rc != EOK) {
-		printf("Error loading start menu from '%s'.\n",
-		    TASKBAR_CONFIG_FILE);
-	}
-
-	rc = tbarcfg_listener_create(TBARCFG_NOTIFY_DEFAULT,
-	    taskbar_notif_cb, (void *)taskbar, &taskbar->lst);
-	if (rc != EOK) {
-		printf("Error listening for configuration changes.\n");
-	}
-
-	if (ui_is_textmode(taskbar->ui)) {
-		rect.p0.x = params.rect.p0.x + 1;
-		rect.p0.y = 0;
-		rect.p1.x = params.rect.p0.x + 9;
-		rect.p1.y = 1;
-	} else {
-		rect.p0.x = params.rect.p0.x + 5;
-		rect.p0.y = 4;
-		rect.p1.x = params.rect.p0.x + 84;
-		rect.p1.y = 32 - 4;
-	}
-
-	tbsmenu_set_rect(taskbar->tbsmenu, &rect);
-
-	rc = wndlist_create(taskbar->window, taskbar->fixed, &taskbar->wndlist);
-	if (rc != EOK) {
-		printf("Error creating window list.\n");
-		goto error;
-	}
-
-	if (ui_is_textmode(taskbar->ui)) {
-		rect.p0.x = params.rect.p0.x + 10;
-		rect.p0.y = 0;
-		rect.p1.x = params.rect.p1.x - 10;
-		rect.p1.y = 1;
-	} else {
-		rect.p0.x = params.rect.p0.x + 90;
-		rect.p0.y = 4;
-		rect.p1.x = params.rect.p1.x - 84;
-		rect.p1.y = 32 - 4;
-	}
-	wndlist_set_rect(taskbar->wndlist, &rect);
-
-	/*
-	 * We may not be able to open WM service if display server is not
-	 * running. That's okay, there simply are no windows to manage.
-	 */
-	rc = wndlist_open_wm(taskbar->wndlist, wndmgt_svc);
-	if (rc != EOK && rc != ENOENT) {
-		printf("Error attaching window management service.\n");
-		goto error;
-	}
-
-	rc = taskbar_clock_create(taskbar->window, &taskbar->clock);
-	if (rc != EOK)
-		goto error;
-
-	if (ui_is_textmode(taskbar->ui)) {
-		rect.p0.x = params.rect.p1.x - 10;
-		rect.p0.y = 0;
-		rect.p1.x = params.rect.p1.x;
-		rect.p1.y = 1;
-	} else {
-		rect.p0.x = params.rect.p1.x - 80;
-		rect.p0.y = 4;
-		rect.p1.x = params.rect.p1.x - 4;
-		rect.p1.y = 32 - 4;
-	}
-
-	taskbar_clock_set_rect(taskbar->clock, &rect);
-
-	rc = ui_fixed_add(taskbar->fixed, taskbar_clock_ctl(taskbar->clock));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		taskbar_clock_destroy(taskbar->clock);
-		goto error;
-	}
-
-	ui_window_add(taskbar->window, ui_fixed_ctl(taskbar->fixed));
-	ui_window_set_cb(taskbar->window, &window_cb, (void *)taskbar);
-
-	rc = ui_window_paint(taskbar->window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	free(dspec);
-	*rtaskbar = taskbar;
-	return EOK;
-error:
-	if (dspec != NULL)
-		free(dspec);
-	if (taskbar->lst != NULL)
-		tbarcfg_listener_destroy(taskbar->lst);
-	if (taskbar->clock != NULL)
-		taskbar_clock_destroy(taskbar->clock);
-	if (taskbar->wndlist != NULL)
-		wndlist_destroy(taskbar->wndlist);
-	if (taskbar->tbsmenu != NULL)
-		tbsmenu_destroy(taskbar->tbsmenu);
-	if (taskbar->window != NULL)
-		ui_window_destroy(taskbar->window);
-	if (taskbar->ui != NULL)
-		ui_destroy(taskbar->ui);
-	free(taskbar);
-	return rc;
-
-}
-
-/** Destroy taskbar. */
-void taskbar_destroy(taskbar_t *taskbar)
-{
-	if (taskbar->lst != NULL)
-		tbarcfg_listener_destroy(taskbar->lst);
-	ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock));
-	taskbar_clock_destroy(taskbar->clock);
-	wndlist_destroy(taskbar->wndlist);
-	tbsmenu_destroy(taskbar->tbsmenu);
-	ui_window_destroy(taskbar->window);
-	ui_destroy(taskbar->ui);
-}
-
-/** Configuration change notification callback.
- *
- * Called when configuration changed.
- *
- * @param arg Argument (taskbar_t *)
- */
-static void taskbar_notif_cb(void *arg)
-{
-	taskbar_t *taskbar = (taskbar_t *)arg;
-
-	ui_lock(taskbar->ui);
-	tbsmenu_reload(taskbar->tbsmenu);
-	ui_unlock(taskbar->ui);
-}
-
-/** @}
- */
Index: pace/app/taskbar/taskbar.h
===================================================================
--- uspace/app/taskbar/taskbar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar
- */
-
-#ifndef TASKBAR_H
-#define TASKBAR_H
-
-#include <errno.h>
-#include <wndmgt.h>
-#include "types/taskbar.h"
-
-extern errno_t taskbar_create(const char *, const char *, taskbar_t **);
-extern void taskbar_destroy(taskbar_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/taskbar.sif
===================================================================
--- uspace/app/taskbar/taskbar.sif	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-<sif>
-<entries>
-<entry caption="~N~avigator" cmd="/app/nav" terminal="y">
-</entry>
-<entry caption="Text ~E~ditor" cmd="/app/edit" terminal="y">
-</entry>
-<entry caption="Co~m~mand Line" cmd="/app/bdsh" terminal="y">
-</entry>
-<entry caption="~C~alculator" cmd="/app/calculator -d %d" terminal="n">
-</entry>
-<entry caption="~I~mage Viewer" cmd="/app/viewer -d %d" terminal="n">
-</entry>
-<entry separator="y">
-</entry>
-<entry caption="~U~I Demo" cmd="/app/uidemo -d %d" terminal="n">
-</entry>
-<entry caption="~G~FX Demo" cmd="/app/gfxdemo -d %d" terminal="n">
-</entry>
-<entry caption="~B~arber Pole" cmd="/app/barber -d %d" terminal="n">
-</entry>
-<entry caption="~T~etris" cmd="/app/tetris" terminal="y">
-</entry>
-<entry separator="y">
-</entry>
-<entry caption="~D~isplay Configuration" cmd="/app/display-cfg -d %d" terminal="n">
-</entry>
-<entry caption="Taskba~r~ Configuration" cmd="/app/taskbar-cfg -d %d" terminal="n">
-</entry>
-<entry separator="y">
-</entry>
-<entry caption="Tas~k~ Monitor (top)" cmd="/app/top" terminal="y">
-</entry>
-<entry caption="~F~disk Disk Editor" cmd="/app/fdisk" terminal="y">
-</entry>
-<entry caption="Insta~l~l HelenOS to Disk" cmd="/app/sysinst -d %d" terminal="n">
-</entry>
-<entry separator="y">
-</entry>
-<entry caption="~A~bout HelenOS" cmd="/app/aboutos -d %d" terminal="n">
-</entry>
-<entry caption="~S~hut Down..." cmd="/app/shutdown-dlg -d %d" terminal="n">
-</entry>
-</entries>
-</sif>
Index: pace/app/taskbar/tbsmenu.c
===================================================================
--- uspace/app/taskbar/tbsmenu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,701 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/** @file Taskbar start menu
- */
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <tbarcfg/tbarcfg.h>
-#include <ui/fixed.h>
-#include <ui/menu.h>
-#include <ui/menuentry.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "tbsmenu.h"
-
-static void tbsmenu_smenu_close_req(ui_menu_t *, void *);
-
-/** Start menu callbacks */
-static ui_menu_cb_t tbsmenu_smenu_cb = {
-	.close_req = tbsmenu_smenu_close_req,
-};
-
-static void tbsmenu_button_down(ui_pbutton_t *, void *);
-
-/** Start button callbacks */
-static ui_pbutton_cb_t tbsmenu_button_cb = {
-	.down = tbsmenu_button_down
-};
-
-static void tbsmenu_smenu_entry_cb(ui_menu_entry_t *, void *);
-static errno_t tbsmenu_entry_start(tbsmenu_entry_t *);
-static void tbsmenu_cmd_fini(tbsmenu_cmd_t *);
-
-/** Create taskbar start menu.
- *
- * @param window Containing window
- * @param fixed Fixed layout to which start button will be added
- * @param dspec Display specification (for passing to applications)
- * @param rtbsmenu Place to store pointer to new start menu
- * @return @c EOK on success or an error code
- */
-errno_t tbsmenu_create(ui_window_t *window, ui_fixed_t *fixed,
-    const char *dspec, tbsmenu_t **rtbsmenu)
-{
-	ui_resource_t *res = ui_window_get_res(window);
-	tbsmenu_t *tbsmenu = NULL;
-	errno_t rc;
-
-	tbsmenu = calloc(1, sizeof(tbsmenu_t));
-	if (tbsmenu == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	tbsmenu->display_spec = str_dup(dspec);
-	if (tbsmenu->display_spec == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = ui_pbutton_create(res, "Start", &tbsmenu->sbutton);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(tbsmenu->sbutton, &tbsmenu_button_cb,
-	    (void *)tbsmenu);
-
-	ui_pbutton_set_default(tbsmenu->sbutton, true);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(tbsmenu->sbutton));
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_menu_create(window, &tbsmenu->smenu);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_set_cb(tbsmenu->smenu, &tbsmenu_smenu_cb, (void *)tbsmenu);
-
-	tbsmenu->window = window;
-	tbsmenu->fixed = fixed;
-	list_initialize(&tbsmenu->entries);
-
-	*rtbsmenu = tbsmenu;
-	return EOK;
-error:
-	if (tbsmenu != NULL && tbsmenu->display_spec != NULL)
-		free(tbsmenu->display_spec);
-	if (tbsmenu != NULL)
-		ui_pbutton_destroy(tbsmenu->sbutton);
-	if (tbsmenu != NULL)
-		free(tbsmenu);
-	return rc;
-}
-
-/** Load start menu from repository.
- *
- * @param tbsmenu Start menu
- * @param Repository path
- * @return EOK on success or an error code
- */
-errno_t tbsmenu_load(tbsmenu_t *tbsmenu, const char *repopath)
-{
-	tbsmenu_entry_t *tentry;
-	tbarcfg_t *tbcfg = NULL;
-	smenu_entry_t *sme;
-	bool separator;
-	const char *caption;
-	const char *cmd;
-	bool terminal;
-	errno_t rc;
-
-	if (tbsmenu->repopath != NULL)
-		free(tbsmenu->repopath);
-
-	tbsmenu->repopath = str_dup(repopath);
-	if (tbsmenu->repopath == NULL)
-		return ENOMEM;
-
-	/* Remove existing entries */
-	tentry = tbsmenu_first(tbsmenu);
-	while (tentry != NULL) {
-		tbsmenu_remove(tbsmenu, tentry, false);
-		tentry = tbsmenu_first(tbsmenu);
-	}
-
-	rc = tbarcfg_open(repopath, &tbcfg);
-	if (rc != EOK)
-		goto error;
-
-	sme = tbarcfg_smenu_first(tbcfg);
-	while (sme != NULL) {
-		separator = smenu_entry_get_separator(sme);
-		if (separator == false) {
-			caption = smenu_entry_get_caption(sme);
-			cmd = smenu_entry_get_cmd(sme);
-			terminal = smenu_entry_get_terminal(sme);
-
-			rc = tbsmenu_add(tbsmenu, caption, cmd, terminal,
-			    &tentry);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rc = tbsmenu_add_sep(tbsmenu, &tentry);
-			if (rc != EOK)
-				goto error;
-		}
-
-		(void)tentry;
-
-		sme = tbarcfg_smenu_next(sme);
-	}
-
-	tbarcfg_close(tbcfg);
-	return EOK;
-error:
-	if (tbcfg != NULL)
-		tbarcfg_close(tbcfg);
-	return rc;
-}
-
-/** Reload start menu from repository (or schedule reload).
- *
- * @param tbsmenu Start menu
- */
-void tbsmenu_reload(tbsmenu_t *tbsmenu)
-{
-	if (!tbsmenu_is_open(tbsmenu))
-		(void) tbsmenu_load(tbsmenu, tbsmenu->repopath);
-	else
-		tbsmenu->needs_reload = true;
-}
-
-/** Set start menu rectangle.
- *
- * @param tbsmenu Start menu
- * @param rect Rectangle
- */
-void tbsmenu_set_rect(tbsmenu_t *tbsmenu, gfx_rect_t *rect)
-{
-	tbsmenu->rect = *rect;
-	ui_pbutton_set_rect(tbsmenu->sbutton, rect);
-}
-
-/** Open taskbar start menu.
- *
- * @param tbsmenu Start menu
- */
-void tbsmenu_open(tbsmenu_t *tbsmenu)
-{
-	(void) ui_menu_open(tbsmenu->smenu, &tbsmenu->rect,
-	    tbsmenu->ev_idev_id);
-}
-
-/** Close taskbar start menu.
- *
- * @param tbsmenu Start menu
- */
-void tbsmenu_close(tbsmenu_t *tbsmenu)
-{
-	ui_menu_close(tbsmenu->smenu);
-
-	if (tbsmenu->needs_reload)
-		(void) tbsmenu_load(tbsmenu, tbsmenu->repopath);
-}
-
-/** Determine if taskbar start menu is open.
- *
- * @param tbsmenu Start menu
- * @return @c true iff start menu is open
- */
-bool tbsmenu_is_open(tbsmenu_t *tbsmenu)
-{
-	return ui_menu_is_open(tbsmenu->smenu);
-}
-
-/** Destroy taskbar start menu.
- *
- * @param tbsmenu Start menu
- */
-void tbsmenu_destroy(tbsmenu_t *tbsmenu)
-{
-	tbsmenu_entry_t *entry;
-
-	/* Destroy entries */
-	entry = tbsmenu_first(tbsmenu);
-	while (entry != NULL) {
-		tbsmenu_remove(tbsmenu, entry, false);
-		entry = tbsmenu_first(tbsmenu);
-	}
-
-	ui_fixed_remove(tbsmenu->fixed, ui_pbutton_ctl(tbsmenu->sbutton));
-	ui_pbutton_destroy(tbsmenu->sbutton);
-	ui_menu_destroy(tbsmenu->smenu);
-
-	free(tbsmenu);
-}
-
-/** Add entry to start menu.
- *
- * @param tbsmenu Start menu
- * @param caption Caption
- * @param cmd Command to run
- * @param terminal Start in terminal
- * @param entry Start menu entry
- * @return @c EOK on success or an error code
- */
-errno_t tbsmenu_add(tbsmenu_t *tbsmenu, const char *caption,
-    const char *cmd, bool terminal, tbsmenu_entry_t **rentry)
-{
-	errno_t rc;
-	tbsmenu_entry_t *entry;
-
-	entry = calloc(1, sizeof(tbsmenu_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->caption = str_dup(caption);
-	if (entry->caption == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->cmd = str_dup(cmd);
-	if (entry->cmd == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->terminal = terminal;
-
-	rc = ui_menu_entry_create(tbsmenu->smenu, caption, "", &entry->mentry);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_entry_set_cb(entry->mentry, tbsmenu_smenu_entry_cb,
-	    (void *)entry);
-
-	entry->tbsmenu = tbsmenu;
-	list_append(&entry->lentries, &tbsmenu->entries);
-	*rentry = entry;
-	return EOK;
-error:
-	if (entry->caption != NULL)
-		free(entry->caption);
-	if (entry->cmd != NULL)
-		free(entry->cmd);
-	free(entry);
-	return rc;
-}
-
-/** Add separator entry to start menu.
- *
- * @param tbsmenu Start menu
- * @param entry Start menu entry
- * @return @c EOK on success or an error code
- */
-errno_t tbsmenu_add_sep(tbsmenu_t *tbsmenu, tbsmenu_entry_t **rentry)
-{
-	errno_t rc;
-	tbsmenu_entry_t *entry;
-
-	entry = calloc(1, sizeof(tbsmenu_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	rc = ui_menu_entry_sep_create(tbsmenu->smenu, &entry->mentry);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_entry_set_cb(entry->mentry, tbsmenu_smenu_entry_cb,
-	    (void *)entry);
-
-	entry->tbsmenu = tbsmenu;
-	list_append(&entry->lentries, &tbsmenu->entries);
-	*rentry = entry;
-	return EOK;
-error:
-	free(entry);
-	return rc;
-}
-
-/** Remove entry from start menu.
- *
- * @param tbsmenu Start menu
- * @param entry Start menu entry
- * @param paint @c true to repaint start menu
- */
-void tbsmenu_remove(tbsmenu_t *tbsmenu, tbsmenu_entry_t *entry,
-    bool paint)
-{
-	assert(entry->tbsmenu == tbsmenu);
-
-	list_remove(&entry->lentries);
-
-	ui_menu_entry_destroy(entry->mentry);
-	free(entry->caption);
-	free(entry->cmd);
-	free(entry);
-}
-
-/** Handle start menu close request.
- *
- * @param menu Menu
- * @param arg Argument (tbsmenu_t *)
- * @param wnd_id Window ID
- */
-static void tbsmenu_smenu_close_req(ui_menu_t *menu, void *arg)
-{
-	tbsmenu_t *tbsmenu = (tbsmenu_t *)arg;
-
-	(void)tbsmenu;
-	ui_menu_close(menu);
-}
-
-/** Start menu entry was activated.
- *
- * @param smentry Start menu entry
- * @param arg Argument (tbsmenu_entry_t *)
- */
-static void tbsmenu_smenu_entry_cb(ui_menu_entry_t *smentry, void *arg)
-{
-	tbsmenu_entry_t *entry = (tbsmenu_entry_t *)arg;
-
-	(void)tbsmenu_entry_start(entry);
-}
-
-/** Get first start menu entry.
- *
- * @param tbsmenu Start menu
- * @return First entry or @c NULL if the menu is empty
- */
-tbsmenu_entry_t *tbsmenu_first(tbsmenu_t *tbsmenu)
-{
-	link_t *link;
-
-	link = list_first(&tbsmenu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, tbsmenu_entry_t, lentries);
-}
-
-/** Get last start menu entry.
- *
- * @param tbsmenu Start menu
- * @return Last entry or @c NULL if the menu is empty
- */
-tbsmenu_entry_t *tbsmenu_last(tbsmenu_t *tbsmenu)
-{
-	link_t *link;
-
-	link = list_last(&tbsmenu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, tbsmenu_entry_t, lentries);
-}
-
-/** Get next start menu entry.
- *
- * @param cur Current entry
- * @return Next entry or @c NULL if @a cur is the last entry
- */
-tbsmenu_entry_t *tbsmenu_next(tbsmenu_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lentries, &cur->tbsmenu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, tbsmenu_entry_t, lentries);
-}
-
-/** Get number of start menu entries.
- *
- * @param tbsmenu Start menu
- * @return Number of entries
- */
-size_t tbsmenu_count(tbsmenu_t *tbsmenu)
-{
-	return list_count(&tbsmenu->entries);
-}
-
-/** Start button was depressed.
- *
- * @param pbutton Push button
- * @param arg Argument (tbsmenu_entry_t *)
- */
-static void tbsmenu_button_down(ui_pbutton_t *pbutton, void *arg)
-{
-	tbsmenu_t *tbsmenu = (tbsmenu_t *)arg;
-
-	if (!tbsmenu_is_open(tbsmenu)) {
-		tbsmenu_open(tbsmenu);
-	} else {
-		/* menu is open */
-		tbsmenu_close(tbsmenu);
-	}
-}
-
-/** Split command string into individual parts.
- *
- * Command arguments are separated by spaces. There is no way
- * to provide an argument containing spaces.
- *
- * @param str Command with arguments separated by spaces
- * @param cmd Command structure to fill in
- * @return EOK on success or an error code
- */
-static errno_t tbsmenu_cmd_split(const char *str, tbsmenu_cmd_t *cmd)
-{
-	char *buf;
-	char *arg;
-	char *next;
-	size_t cnt;
-
-	buf = str_dup(str);
-	if (buf == NULL)
-		return ENOMEM;
-
-	/* Count the entries */
-	cnt = 0;
-	arg = str_tok(buf, " ", &next);
-	while (arg != NULL) {
-		++cnt;
-		arg = str_tok(next, " ", &next);
-	}
-
-	/* Need to copy again as buf was mangled */
-	free(buf);
-	buf = str_dup(str);
-	if (buf == NULL)
-		return ENOMEM;
-
-	cmd->argv = calloc(cnt + 1, sizeof(char *));
-	if (cmd->argv == NULL) {
-		free(buf);
-		return ENOMEM;
-	}
-
-	/* Copy individual arguments */
-	cnt = 0;
-	arg = str_tok(buf, " ", &next);
-	while (arg != NULL) {
-		cmd->argv[cnt] = str_dup(arg);
-		if (cmd->argv[cnt] == NULL) {
-			tbsmenu_cmd_fini(cmd);
-			return ENOMEM;
-		}
-		++cnt;
-
-		arg = str_tok(next, " ", &next);
-	}
-
-	cmd->argv[cnt] = NULL;
-
-	return EOK;
-}
-
-/** Free command structure.
- *
- * @param cmd Command
- */
-static void tbsmenu_cmd_fini(tbsmenu_cmd_t *cmd)
-{
-	char **cp;
-
-	/* Free all pointers in NULL-terminated list */
-	cp = cmd->argv;
-	while (*cp != NULL) {
-		free(*cp);
-		++cp;
-	}
-
-	/* Free the array of pointers */
-	free(cmd->argv);
-}
-
-/** Free command structure.
- *
- * @param cmd Command
- * @param entry Start menu entry
- * @param dspec Display specification
- * @return EOK on success or an error code
- */
-static errno_t tbsmenu_cmd_subst(tbsmenu_cmd_t *cmd, tbsmenu_entry_t *entry,
-    const char *dspec)
-{
-	char **cp;
-
-	(void)entry;
-
-	/* Walk NULL-terminated list of arguments */
-	cp = cmd->argv;
-	while (*cp != NULL) {
-		if (str_cmp(*cp, "%d") == 0) {
-			/* Display specification */
-			free(*cp);
-			*cp = str_dup(dspec);
-			if (*cp == NULL)
-				return ENOMEM;
-		}
-		++cp;
-	}
-
-	return EOK;
-}
-
-/** Execute start menu entry.
- *
- * @param entry Start menu entry
- *
- * @return EOK on success or an error code
- */
-static errno_t tbsmenu_entry_start(tbsmenu_entry_t *entry)
-{
-	task_id_t id;
-	task_wait_t wait;
-	task_exit_t texit;
-	tbsmenu_cmd_t cmd;
-	int retval;
-	bool suspended;
-	int i;
-	int cnt;
-	char **cp;
-	const char **targv = NULL;
-	char *dspec = NULL;
-	sysarg_t idev_id;
-	int rv;
-	errno_t rc;
-	ui_t *ui;
-
-	ui = ui_window_get_ui(entry->tbsmenu->window);
-	suspended = false;
-
-	idev_id = ui_menu_get_idev_id(entry->tbsmenu->smenu);
-
-	rv = asprintf(&dspec, "%s?idev=%zu",
-	    entry->tbsmenu->display_spec, (size_t)idev_id);
-	if (rv < 0)
-		return ENOMEM;
-
-	/* Split command string into individual arguments */
-	rc = tbsmenu_cmd_split(entry->cmd, &cmd);
-	if (rc != EOK) {
-		free(dspec);
-		return rc;
-	}
-
-	/* Substitute metacharacters in command */
-	rc = tbsmenu_cmd_subst(&cmd, entry, dspec);
-	if (rc != EOK)
-		goto error;
-
-	/* Free up and clean console for the child task. */
-	rc = ui_suspend(ui);
-	if (rc != EOK)
-		goto error;
-
-	suspended = true;
-
-	/* Don't start in terminal if not running in a window */
-	if (entry->terminal && !ui_is_fullscreen(ui)) {
-		cnt = 0;
-		cp = cmd.argv;
-		while (*cp != NULL) {
-			++cnt;
-			++cp;
-		}
-
-		targv = calloc(cnt + 5, sizeof(char **));
-		if (targv == NULL)
-			goto error;
-
-		targv[0] = "/app/terminal";
-		targv[1] = "-d";
-		targv[2] = dspec;
-		targv[3] = "-c";
-
-		for (i = 0; i <= cnt; i++) {
-			targv[4 + i] = cmd.argv[i];
-		}
-
-		rc = task_spawnv(&id, &wait, targv[0], targv);
-		if (rc != EOK)
-			goto error;
-
-		free(targv);
-		targv = NULL;
-	} else {
-		rc = task_spawnv(&id, &wait, cmd.argv[0], (const char *const *)
-		    cmd.argv);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = task_wait(&wait, &texit, &retval);
-	if ((rc != EOK) || (texit != TASK_EXIT_NORMAL))
-		goto error;
-
-	/* Resume UI operation */
-	rc = ui_resume(ui);
-	if (rc != EOK)
-		goto error;
-
-	(void) ui_paint(ui);
-	return EOK;
-error:
-	free(dspec);
-	if (targv != NULL)
-		free(targv);
-	tbsmenu_cmd_fini(&cmd);
-	if (suspended) {
-		rc = ui_resume(ui);
-		if (rc != EOK) {
-			printf("Failed to resume UI.\n");
-			exit(1);
-		}
-	}
-	(void) ui_paint(ui);
-	return rc;
-}
-
-/** @}
- */
Index: pace/app/taskbar/tbsmenu.h
===================================================================
--- uspace/app/taskbar/tbsmenu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar start menu
- */
-
-#ifndef TBSMENU_H
-#define TBSMENU_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <ui/fixed.h>
-#include <ui/window.h>
-#include <wndmgt.h>
-#include "types/tbsmenu.h"
-
-extern errno_t tbsmenu_create(ui_window_t *, ui_fixed_t *, const char *,
-    tbsmenu_t **);
-extern errno_t tbsmenu_load(tbsmenu_t *, const char *);
-extern void tbsmenu_reload(tbsmenu_t *);
-extern void tbsmenu_set_rect(tbsmenu_t *, gfx_rect_t *);
-extern void tbsmenu_open(tbsmenu_t *);
-extern void tbsmenu_close(tbsmenu_t *);
-extern bool tbsmenu_is_open(tbsmenu_t *);
-extern void tbsmenu_destroy(tbsmenu_t *);
-extern errno_t tbsmenu_add(tbsmenu_t *, const char *, const char *, bool,
-    tbsmenu_entry_t **);
-extern errno_t tbsmenu_add_sep(tbsmenu_t *, tbsmenu_entry_t **);
-extern void tbsmenu_remove(tbsmenu_t *, tbsmenu_entry_t *, bool);
-extern tbsmenu_entry_t *tbsmenu_first(tbsmenu_t *);
-extern tbsmenu_entry_t *tbsmenu_last(tbsmenu_t *);
-extern tbsmenu_entry_t *tbsmenu_next(tbsmenu_entry_t *);
-extern size_t tbsmenu_count(tbsmenu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/test/clock.c
===================================================================
--- uspace/app/taskbar/test/clock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <pcut/pcut.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../clock.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(clock);
-
-/** Creating and destroying taskbar clock */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Painting taskbar clock */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = taskbar_clock_paint(clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Keyboard event */
-PCUT_TEST(kbd_event)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-	kbd_event_t event;
-	ui_evclaim_t claim;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	claim = taskbar_clock_kbd_event(clock, &event);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Position event */
-PCUT_TEST(pos_event)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-	pos_event_t event;
-	ui_evclaim_t claim;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = POS_PRESS;
-	event.hpos = 0;
-	event.vpos = 0;
-	claim = taskbar_clock_pos_event(clock, &event);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** taskbar_clock_ctl returns a usable UI control */
-PCUT_TEST(ctl)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-	ui_control_t *ctl;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ctl = taskbar_clock_ctl(clock);
-	PCUT_ASSERT_NOT_NULL(ctl);
-
-	rc = ui_control_paint(ctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** taskbar_clock_set_rect() sets internal field */
-PCUT_TEST(set_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	taskbar_clock_t *clock;
-	gfx_rect_t rect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = taskbar_clock_create(window, &clock);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	taskbar_clock_set_rect(clock, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, clock->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, clock->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, clock->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, clock->rect.p1.y);
-
-	taskbar_clock_destroy(clock);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(clock);
Index: pace/app/taskbar/test/main.c
===================================================================
--- uspace/app/taskbar/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(clock);
-PCUT_IMPORT(taskbar);
-PCUT_IMPORT(tbsmenu);
-PCUT_IMPORT(wndlist);
-
-PCUT_MAIN();
Index: pace/app/taskbar/test/taskbar.c
===================================================================
--- uspace/app/taskbar/test/taskbar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include "../taskbar.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(taskbar);
-
-/* Test creating and destroying taskbar */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	taskbar_t *taskbar;
-
-	rc = taskbar_create(UI_DISPLAY_NULL, NULL, &taskbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	taskbar_destroy(taskbar);
-}
-
-PCUT_EXPORT(taskbar);
Index: pace/app/taskbar/test/tbsmenu.c
===================================================================
--- uspace/app/taskbar/test/tbsmenu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <ui/fixed.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../tbsmenu.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tbsmenu);
-
-/* Test creating and destroying taskbar start menu */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	tbsmenu_t *tbsmenu = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = tbsmenu_create(window, fixed, UI_DISPLAY_DEFAULT, &tbsmenu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tbsmenu_destroy(tbsmenu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test tbsmenu_open/close/is_open() */
-PCUT_TEST(open_close_is_open)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	tbsmenu_t *tbsmenu = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = tbsmenu_create(window, fixed, UI_DISPLAY_DEFAULT, &tbsmenu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(tbsmenu_is_open(tbsmenu));
-	tbsmenu_open(tbsmenu);
-	PCUT_ASSERT_TRUE(tbsmenu_is_open(tbsmenu));
-	tbsmenu_close(tbsmenu);
-	PCUT_ASSERT_FALSE(tbsmenu_is_open(tbsmenu));
-
-	tbsmenu_destroy(tbsmenu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(tbsmenu);
Index: pace/app/taskbar/test/wndlist.c
===================================================================
--- uspace/app/taskbar/test/wndlist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,649 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include <ui/fixed.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include <wndmgt_srv.h>
-#include "../wndlist.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(taskbar);
-
-static void test_wndmgt_conn(ipc_call_t *, void *);
-
-static errno_t test_get_window_list(void *, wndmgt_window_list_t **);
-static errno_t test_get_window_info(void *, sysarg_t, wndmgt_window_info_t **);
-
-static wndmgt_ops_t test_wndmgt_srv_ops = {
-	.get_window_list = test_get_window_list,
-	.get_window_info = test_get_window_info
-};
-
-static const char *test_wndmgt_server = "test-wndlist-wm";
-static const char *test_wndmgt_svc = "test/wndlist-wm";
-
-/* Test creating and destroying window list */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/* Test setting window list rectangle */
-PCUT_TEST(set_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	gfx_rect_t rect;
-	wndlist_t *wndlist;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	wndlist_set_rect(wndlist, &rect);
-	PCUT_ASSERT_INT_EQUALS(1, wndlist->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, wndlist->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, wndlist->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, wndlist->rect.p1.y);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test opening WM service */
-PCUT_TEST(open_wm)
-{
-	errno_t rc;
-	service_id_t sid;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	loc_srv_t *srv;
-
-	/* Set up a test WM service */
-
-	async_set_fallback_port_handler(test_wndmgt_conn, NULL);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create window list and connect it to our test service */
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_open_wm(wndlist, test_wndmgt_svc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Test appending new entry */
-PCUT_TEST(append)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 123, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-	PCUT_ASSERT_INT_EQUALS(123, entry->wnd_id);
-	PCUT_ASSERT_NOT_NULL(entry->button);
-	PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test removing entry */
-PCUT_TEST(remove)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-	PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
-
-	rc = wndlist_remove(wndlist, entry, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-	PCUT_ASSERT_INT_EQUALS(2, entry->wnd_id);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test updating entry */
-PCUT_TEST(update)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-	PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
-	PCUT_ASSERT_NOT_NULL(entry->button);
-	PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
-
-	rc = wndlist_update(wndlist, entry, "Bar", false);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
-	PCUT_ASSERT_NOT_NULL(entry->button);
-	PCUT_ASSERT_FALSE(ui_pbutton_get_light(entry->button));
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test setting entry rectangle */
-PCUT_TEST(set_entry_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 123, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-
-	/* Set entry rectangle */
-	wndlist_set_entry_rect(wndlist, entry);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test finding entry by window ID */
-PCUT_TEST(entry_by_id)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_entry_by_id(wndlist, 1);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
-
-	entry = wndlist_entry_by_id(wndlist, 2);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_INT_EQUALS(2, entry->wnd_id);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test wndlist_first() / wndlist_next() */
-PCUT_TEST(first_next)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_first(wndlist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
-
-	entry = wndlist_next(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_INT_EQUALS(2, entry->wnd_id);
-
-	entry = wndlist_next(entry);
-	PCUT_ASSERT_NULL(entry);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test wndlist_last() */
-PCUT_TEST(last)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	wndlist_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = wndlist_last(wndlist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_INT_EQUALS(2, entry->wnd_id);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test wndlist_count() */
-PCUT_TEST(count)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-	size_t count;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	count = wndlist_count(wndlist);
-	PCUT_ASSERT_INT_EQUALS(0, count);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	count = wndlist_count(wndlist);
-	PCUT_ASSERT_INT_EQUALS(1, count);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	count = wndlist_count(wndlist);
-	PCUT_ASSERT_INT_EQUALS(2, count);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test repainting window list */
-PCUT_TEST(repaint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_fixed_t *fixed = NULL;
-	wndlist_t *wndlist;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_fixed_create(&fixed);
-	ui_window_add(window, ui_fixed_ctl(fixed));
-
-	rc = wndlist_create(window, fixed, &wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 1, "Foo", true, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_append(wndlist, 2, "Bar", false, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndlist_repaint(wndlist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wndlist_destroy(wndlist);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test window management service connection. */
-static void test_wndmgt_conn(ipc_call_t *icall, void *arg)
-{
-	wndmgt_srv_t srv;
-
-	/* Set up protocol structure */
-	wndmgt_srv_initialize(&srv);
-	srv.ops = &test_wndmgt_srv_ops;
-	srv.arg = arg;
-
-	/* Handle connection */
-	wndmgt_conn(icall, &srv);
-}
-
-static errno_t test_get_window_list(void *arg, wndmgt_window_list_t **rlist)
-{
-	wndmgt_window_list_t *wlist;
-
-	(void)arg;
-
-	wlist = calloc(1, sizeof(wndmgt_window_list_t));
-	if (wlist == NULL)
-		return ENOMEM;
-
-	wlist->nwindows = 1;
-	wlist->windows = calloc(1, sizeof(sysarg_t));
-	if (wlist->windows == NULL) {
-		free(wlist);
-		return ENOMEM;
-	}
-
-	wlist->windows[0] = 42;
-	*rlist = wlist;
-	return EOK;
-}
-
-static errno_t test_get_window_info(void *arg, sysarg_t wnd_id,
-    wndmgt_window_info_t **rinfo)
-{
-	wndmgt_window_info_t *winfo;
-
-	(void)arg;
-
-	winfo = calloc(1, sizeof(wndmgt_window_info_t));
-	if (winfo == NULL)
-		return ENOMEM;
-
-	winfo->caption = str_dup("Hello");
-	if (winfo->caption == NULL) {
-		free(winfo);
-		return ENOMEM;
-	}
-
-	*rinfo = winfo;
-	return EOK;
-}
-
-PCUT_EXPORT(wndlist);
Index: pace/app/taskbar/types/clock.h
===================================================================
--- uspace/app/taskbar/types/clock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar clock
- */
-
-#ifndef TYPES_CLOCK_H
-#define TYPES_CLOCK_H
-
-#include <fibril_synch.h>
-#include <gfx/coord.h>
-#include <ui/window.h>
-
-/** Taskbar clock
- *
- * This is a custom UI control.
- */
-typedef struct taskbar_clock {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	ui_window_t *window;
-
-	/** Clock rectangle */
-	gfx_rect_t rect;
-
-	/** Clock lock */
-	fibril_mutex_t lock;
-
-	/** Clock update timer */
-	fibril_timer_t *timer;
-
-	/** Signal to timer that we are cleaning up */
-	bool timer_cleanup;
-
-	/** Signal to maih thread that timer is done */
-	bool timer_done;
-
-	/** Timer done condition variable */
-	fibril_condvar_t timer_done_cv;
-} taskbar_clock_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/types/taskbar.h
===================================================================
--- uspace/app/taskbar/types/taskbar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar types
- */
-
-#ifndef TYPES_TASKBAR_H
-#define TYPES_TASKBAR_H
-
-#include <types/common.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "clock.h"
-#include "tbsmenu.h"
-#include "wndlist.h"
-
-/** Taskbar */
-typedef struct taskbar {
-	/** User interface */
-	ui_t *ui;
-	/** Taskbar window */
-	ui_window_t *window;
-	/** Fixed layout */
-	ui_fixed_t *fixed;
-	/** Start menu */
-	tbsmenu_t *tbsmenu;
-	/** Window list */
-	wndlist_t *wndlist;
-	/** Clock */
-	taskbar_clock_t *clock;
-	/** Configuration change listener */
-	tbarcfg_listener_t *lst;
-} taskbar_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/types/tbsmenu.h
===================================================================
--- uspace/app/taskbar/types/tbsmenu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar start menu
- */
-
-#ifndef TYPES_TBSMENU_H
-#define TYPES_TBSMENU_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <tbarcfg/tbarcfg.h>
-#include <ui/pbutton.h>
-#include <ui/fixed.h>
-#include <ui/menu.h>
-#include <ui/menuentry.h>
-#include <ui/window.h>
-
-/** Taskbar start menu entry */
-typedef struct {
-	/** Containing start menu */
-	struct tbsmenu *tbsmenu;
-	/** Link to tbsmenu->entries */
-	link_t lentries;
-	/** Menu entry */
-	ui_menu_entry_t *mentry;
-	/** Caption */
-	char *caption;
-	/** Command to run */
-	char *cmd;
-	/** Start in terminal */
-	bool terminal;
-} tbsmenu_entry_t;
-
-/** Taskbar start menu */
-typedef struct tbsmenu {
-	/** Containing window */
-	ui_window_t *window;
-
-	/** Layout to which we add start button */
-	ui_fixed_t *fixed;
-
-	/** Start button rectangle */
-	gfx_rect_t rect;
-
-	/** Start button */
-	ui_pbutton_t *sbutton;
-
-	/** Start menu */
-	ui_menu_t *smenu;
-
-	/** Start menu entries (of tbsmenu_entry_t) */
-	list_t entries;
-
-	/** Device ID of last input event */
-	sysarg_t ev_idev_id;
-
-	/** Repository path name */
-	char *repopath;
-
-	/** Need to reload menu when possible */
-	bool needs_reload;
-
-	/** Display specification */
-	char *display_spec;
-} tbsmenu_t;
-
-/** Command split into individual parts */
-typedef struct {
-	/** NULL-terminated array of string pointers */
-	char **argv;
-} tbsmenu_cmd_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/types/wndlist.h
===================================================================
--- uspace/app/taskbar/types/wndlist.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar window list
- */
-
-#ifndef TYPES_WNDLIST_H
-#define TYPES_WNDLIST_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <ui/pbutton.h>
-#include <ui/fixed.h>
-#include <ui/window.h>
-#include <wndmgt.h>
-
-/** Taskbar window list entry */
-typedef struct {
-	/** Containing window list */
-	struct wndlist *wndlist;
-	/** Link to wndlist->entries */
-	link_t lentries;
-	/** Window ID */
-	sysarg_t wnd_id;
-	/** Entry is visible */
-	bool visible;
-	/** Window button */
-	ui_pbutton_t *button;
-	/** Window button rectangle */
-	gfx_rect_t rect;
-} wndlist_entry_t;
-
-/** Taskbar window list */
-typedef struct wndlist {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	ui_window_t *window;
-
-	/** Layout to which we add window buttons */
-	ui_fixed_t *fixed;
-
-	/** Window list rectangle */
-	gfx_rect_t rect;
-
-	/** Window list entries (of wndlist_entry_t) */
-	list_t entries;
-
-	/** Current button pitch */
-	gfx_coord_t pitch;
-
-	/** Window management service */
-	wndmgt_t *wndmgt;
-
-	/** Device ID of last input event */
-	sysarg_t ev_idev_id;
-} wndlist_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/taskbar/wndlist.c
===================================================================
--- uspace/app/taskbar/wndlist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,729 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/** @file Taskbar window list
- */
-
-#include <gfx/coord.h>
-#include <gfx/render.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "wndlist.h"
-
-static void wndlist_wm_window_added(void *, sysarg_t);
-static void wndlist_wm_window_removed(void *, sysarg_t);
-static void wndlist_wm_window_changed(void *, sysarg_t);
-
-/** Window list WM callbacks */
-static wndmgt_cb_t wndlist_wndmgt_cb = {
-	.window_added = wndlist_wm_window_added,
-	.window_removed = wndlist_wm_window_removed,
-	.window_changed = wndlist_wm_window_changed
-};
-
-static void wndlist_button_clicked(ui_pbutton_t *, void *);
-
-/** Window list button callbacks */
-static ui_pbutton_cb_t wndlist_button_cb = {
-	.clicked = wndlist_button_clicked
-};
-
-enum {
-	/** Min. X distance between left edges of two consecutive buttons */
-	wndlist_button_pitch_min = 85,
-	/** Max. X distance between left edges of two consecutive buttons (text) */
-	wndlist_button_pitch_min_text = 10,
-	/** Min. X distance between left edges of two consecutive buttons */
-	wndlist_button_pitch_max = 165,
-	/** Max. X distance between left edges of two consecutive buttons (text) */
-	wndlist_button_pitch_max_text = 17,
-	/** Padding between buttons */
-	wndlist_button_pad = 5,
-	/** Padding between buttons (text) */
-	wndlist_button_pad_text = 1
-};
-
-/** Create taskbar window list.
- *
- * @param window Containing window
- * @param fixed Fixed layout to which buttons will be added
- * @param rwndlist Place to store pointer to new window list
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_create(ui_window_t *window, ui_fixed_t *fixed,
-    wndlist_t **rwndlist)
-{
-	ui_resource_t *res = ui_window_get_res(window);
-	wndlist_t *wndlist = NULL;
-	errno_t rc;
-
-	wndlist = calloc(1, sizeof(wndlist_t));
-	if (wndlist == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	wndlist->window = window;
-	wndlist->fixed = fixed;
-	list_initialize(&wndlist->entries);
-
-	if (ui_resource_is_textmode(res))
-		wndlist->pitch = wndlist_button_pitch_max_text;
-	else
-		wndlist->pitch = wndlist_button_pitch_max;
-
-	*rwndlist = wndlist;
-	return EOK;
-error:
-	return rc;
-}
-
-/** Set window list rectangle.
- *
- * @param wndlist Window list
- * @param rect Rectangle
- */
-void wndlist_set_rect(wndlist_t *wndlist, gfx_rect_t *rect)
-{
-	wndlist->rect = *rect;
-}
-
-/** Attach window management service to window list.
- *
- * @param wndlist Window list
- * @param wndmgt_svc Window management service name
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_open_wm(wndlist_t *wndlist, const char *wndmgt_svc)
-{
-	errno_t rc;
-	wndmgt_window_list_t *wlist = NULL;
-	wndmgt_window_info_t *winfo = NULL;
-	sysarg_t i;
-
-	rc = wndmgt_open(wndmgt_svc, &wndlist_wndmgt_cb, (void *)wndlist,
-	    &wndlist->wndmgt);
-	if (rc != EOK)
-		goto error;
-
-	rc = wndmgt_get_window_list(wndlist->wndmgt, &wlist);
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < wlist->nwindows; i++) {
-		rc = wndmgt_get_window_info(wndlist->wndmgt, wlist->windows[i],
-		    &winfo);
-		if (rc != EOK)
-			goto error;
-
-		if ((winfo->flags & (wndf_popup | wndf_system)) == 0) {
-			rc = wndlist_append(wndlist, wlist->windows[i],
-			    winfo->caption, winfo->nfocus != 0, false);
-			if (rc != EOK) {
-				wndmgt_free_window_info(winfo);
-				goto error;
-			}
-		}
-
-		wndmgt_free_window_info(winfo);
-	}
-
-	return EOK;
-error:
-	if (wlist != NULL)
-		wndmgt_free_window_list(wlist);
-	if (wndlist->wndmgt != NULL) {
-		wndmgt_close(wndlist->wndmgt);
-		wndlist->wndmgt = NULL;
-	}
-	return rc;
-}
-
-/** Destroy taskbar window list.
- *
- * @param wndlist Window list
- */
-void wndlist_destroy(wndlist_t *wndlist)
-{
-	wndlist_entry_t *entry;
-
-	/* Close window management service */
-	if (wndlist->wndmgt)
-		wndmgt_close(wndlist->wndmgt);
-
-	/* Destroy entries */
-	entry = wndlist_first(wndlist);
-	while (entry != NULL) {
-		(void)wndlist_remove(wndlist, entry, false);
-		entry = wndlist_first(wndlist);
-	}
-
-	free(wndlist);
-}
-
-/** Append new entry to window list.
- *
- * @param wndlist Window list
- * @param wnd_id Window ID
- * @param caption Entry caption
- * @param active @c true iff window is active
- * @param paint @c true to paint immediately
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_append(wndlist_t *wndlist, sysarg_t wnd_id,
-    const char *caption, bool active, bool paint)
-{
-	wndlist_entry_t *entry = NULL;
-	ui_resource_t *res;
-	wndlist_entry_t *e;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(wndlist_entry_t));
-	if (entry == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->wnd_id = wnd_id;
-	res = ui_window_get_res(wndlist->window);
-
-	rc = ui_pbutton_create(res, caption, &entry->button);
-	if (rc != EOK)
-		goto error;
-
-	entry->wndlist = wndlist;
-	list_append(&entry->lentries, &wndlist->entries);
-
-	entry->visible = false;
-
-	ui_pbutton_set_light(entry->button, active);
-
-	/* Set button callbacks */
-	ui_pbutton_set_cb(entry->button, &wndlist_button_cb, (void *)entry);
-
-	if (wndlist_update_pitch(wndlist)) {
-		/*
-		 * Update rectangles for all entries, including @a entry, adding
-		 * it to the layout, if applicable.
-		 */
-		e = wndlist_first(wndlist);
-		while (e != NULL) {
-			wndlist_set_entry_rect(wndlist, e);
-			e = wndlist_next(e);
-		}
-
-		if (paint)
-			return wndlist_repaint(wndlist);
-	} else {
-		wndlist_set_entry_rect(wndlist, entry);
-		if (paint)
-			return wndlist_paint_entry(entry);
-	}
-
-	return EOK;
-error:
-	if (entry != NULL && entry->button != NULL)
-		ui_pbutton_destroy(entry->button);
-	if (entry != NULL)
-		free(entry);
-	return rc;
-
-}
-
-/** Remove entry from window list.
- *
- * @param wndlist Window list
- * @param entry Window list entry
- * @param paint @c true to repaint window list
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_remove(wndlist_t *wndlist, wndlist_entry_t *entry,
-    bool paint)
-{
-	wndlist_entry_t *e;
-	wndlist_entry_t *next;
-	wndlist_entry_t *last;
-	errno_t rc = EOK;
-
-	assert(entry->wndlist == wndlist);
-	next = wndlist_next(entry);
-
-	/* Remember last entry */
-	last = wndlist_last(wndlist);
-
-	if (entry->visible)
-		ui_fixed_remove(wndlist->fixed, ui_pbutton_ctl(entry->button));
-
-	list_remove(&entry->lentries);
-
-	if (wndlist_update_pitch(wndlist)) {
-		/*
-		 * Update rectangles for all entries.
-		 */
-		e = wndlist_first(wndlist);
-		while (e != NULL) {
-			wndlist_set_entry_rect(wndlist, e);
-			e = wndlist_next(e);
-		}
-
-		if (paint)
-			rc = wndlist_repaint(wndlist);
-	} else {
-		/* Unpaint the last entry */
-		if (paint)
-			rc = wndlist_unpaint_entry(last);
-
-		/*
-		 * Update rectangles for entries to the right
-		 */
-
-		e = NULL;
-		while (next != NULL) {
-			e = next;
-
-			wndlist_set_entry_rect(wndlist, e);
-			if (paint) {
-				rc = wndlist_paint_entry(e);
-				if (rc != EOK)
-					return rc;
-			}
-
-			next = wndlist_next(e);
-		}
-	}
-
-	ui_pbutton_destroy(entry->button);
-	free(entry);
-	return rc;
-}
-
-/** Update button pitch.
- *
- * Recalculatebutton pitch @c wndlist->pitch based on current number
- * of buttons.
- *
- * @param wndlist Window list
- * @return @c true iff pitch changed
- */
-bool wndlist_update_pitch(wndlist_t *wndlist)
-{
-	ui_resource_t *res;
-	size_t nbuttons;
-	gfx_coord_t pitch;
-	gfx_coord_t pitch_max;
-	gfx_coord_t pitch_min;
-	gfx_coord_t pad;
-
-	res = ui_window_get_res(wndlist->window);
-
-	if (ui_resource_is_textmode(res)) {
-		pitch_max = wndlist_button_pitch_max_text;
-		pitch_min = wndlist_button_pitch_min_text;
-		pad = wndlist_button_pad_text;
-	} else {
-		pitch_max = wndlist_button_pitch_max;
-		pitch_min = wndlist_button_pitch_min;
-		pad = wndlist_button_pad;
-	}
-
-	/* Compute pitch that fits all buttons perfectly */
-	nbuttons = wndlist_count(wndlist);
-	if (nbuttons > 0)
-		pitch = (wndlist->rect.p1.x - wndlist->rect.p0.x + pad) / nbuttons;
-	else
-		pitch = pitch_min;
-
-	if (pitch < pitch_min)
-		pitch = pitch_min;
-	if (pitch > pitch_max)
-		pitch = pitch_max;
-
-	/* Did the pitch change? */
-	if (pitch == wndlist->pitch)
-		return false;
-
-	wndlist->pitch = pitch;
-	return true;
-}
-
-/** Update window list entry.
- *
- * @param wndlist Window list
- * @param entry Window list entry
- * @param active @c true iff the window is active
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_update(wndlist_t *wndlist, wndlist_entry_t *entry,
-    const char *caption, bool active)
-{
-	errno_t rc;
-	assert(entry->wndlist == wndlist);
-
-	rc = ui_pbutton_set_caption(entry->button, caption);
-	if (rc != EOK)
-		return rc;
-
-	ui_pbutton_set_light(entry->button, active);
-
-	rc = wndlist_paint_entry(entry);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Compute and set window list entry rectangle.
- *
- * Compute rectangle for window list entry and set it.
- *
- * @param wndlist Window list
- * @param entry Window list entry
- */
-void wndlist_set_entry_rect(wndlist_t *wndlist, wndlist_entry_t *entry)
-{
-	wndlist_entry_t *e;
-	gfx_rect_t rect;
-	ui_resource_t *res;
-	gfx_coord_t pitch;
-	gfx_coord_t pad;
-	size_t idx;
-
-	/* Determine entry index */
-	idx = 0;
-	e = wndlist_first(wndlist);
-	while (e != entry) {
-		assert(e != NULL);
-		e = wndlist_next(e);
-		++idx;
-	}
-
-	res = ui_window_get_res(wndlist->window);
-
-	if (ui_resource_is_textmode(res)) {
-		pad = wndlist_button_pad_text;
-	} else {
-		pad = wndlist_button_pad;
-	}
-
-	pitch = wndlist->pitch;
-
-	rect.p0.x = wndlist->rect.p0.x + pitch * idx;
-	rect.p0.y = wndlist->rect.p0.y;
-	rect.p1.x = wndlist->rect.p0.x + pitch * (idx + 1) - pad;
-	rect.p1.y = wndlist->rect.p1.y;
-
-	/* Entry does not fit? */
-	if (rect.p1.x > wndlist->rect.p1.x) {
-		/* Make entry invisible */
-		if (entry->visible) {
-			ui_fixed_remove(wndlist->fixed,
-			    ui_pbutton_ctl(entry->button));
-			entry->visible = false;
-		}
-	} else {
-		/* Make entry visible */
-		if (!entry->visible) {
-			ui_fixed_add(wndlist->fixed,
-			    ui_pbutton_ctl(entry->button));
-			entry->visible = true;
-		}
-	}
-
-	ui_pbutton_set_rect(entry->button, &rect);
-	entry->rect = rect;
-}
-
-/** Paint window list entry.
- *
- * @param entry Window list entry
- * @return EOK on success or an error code
- */
-errno_t wndlist_paint_entry(wndlist_entry_t *entry)
-{
-	ui_t *ui;
-
-	ui = ui_window_get_ui(entry->wndlist->window);
-	if (ui_is_suspended(ui))
-		return EOK;
-
-	return ui_pbutton_paint(entry->button);
-}
-
-/** Unpaint window list entry.
- *
- * @param entry Window list entry
- * @return EOK on success or an error code
- */
-errno_t wndlist_unpaint_entry(wndlist_entry_t *entry)
-{
-	errno_t rc;
-	ui_t *ui;
-	gfx_context_t *gc;
-	ui_resource_t *res;
-	gfx_color_t *color;
-
-	ui = ui_window_get_ui(entry->wndlist->window);
-	gc = ui_window_get_gc(entry->wndlist->window);
-	res = ui_window_get_res(entry->wndlist->window);
-	color = ui_resource_get_wnd_face_color(res);
-
-	if (ui_is_suspended(ui))
-		return EOK;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(gc, &entry->rect);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Handle WM window added event.
- *
- * @param arg Argument (wndlist_t *)
- * @param wnd_id Window ID
- */
-static void wndlist_wm_window_added(void *arg, sysarg_t wnd_id)
-{
-	wndlist_t *wndlist = (wndlist_t *)arg;
-	wndmgt_window_info_t *winfo = NULL;
-	ui_t *ui;
-	errno_t rc;
-
-	ui = ui_window_get_ui(wndlist->window);
-	ui_lock(ui);
-
-	rc = wndmgt_get_window_info(wndlist->wndmgt, wnd_id, &winfo);
-	if (rc != EOK)
-		goto error;
-
-	if ((winfo->flags & (wndf_popup | wndf_system)) == 0) {
-		rc = wndlist_append(wndlist, wnd_id, winfo->caption,
-		    winfo->nfocus != 0, true);
-		if (rc != EOK) {
-			wndmgt_free_window_info(winfo);
-			goto error;
-		}
-	}
-
-	wndmgt_free_window_info(winfo);
-	ui_unlock(ui);
-	return;
-error:
-	if (winfo != NULL)
-		wndmgt_free_window_info(winfo);
-	ui_unlock(ui);
-}
-
-/** Handle WM window removed event.
- *
- * @param arg Argument (wndlist_t *)
- * @param wnd_id Window ID
- */
-static void wndlist_wm_window_removed(void *arg, sysarg_t wnd_id)
-{
-	wndlist_t *wndlist = (wndlist_t *)arg;
-	wndlist_entry_t *entry;
-	ui_t *ui;
-
-	ui = ui_window_get_ui(wndlist->window);
-	ui_lock(ui);
-
-	entry = wndlist_entry_by_id(wndlist, wnd_id);
-	if (entry == NULL) {
-		ui_unlock(ui);
-		return;
-	}
-
-	(void) wndlist_remove(wndlist, entry, true);
-	ui_unlock(ui);
-}
-
-/** Handle WM window changed event.
- *
- * @param arg Argument (wndlist_t *)
- * @param wnd_id Window ID
- */
-static void wndlist_wm_window_changed(void *arg, sysarg_t wnd_id)
-{
-	wndlist_t *wndlist = (wndlist_t *)arg;
-	wndmgt_window_info_t *winfo = NULL;
-	wndlist_entry_t *entry;
-	ui_t *ui;
-	errno_t rc;
-
-	ui = ui_window_get_ui(wndlist->window);
-	ui_lock(ui);
-
-	entry = wndlist_entry_by_id(wndlist, wnd_id);
-	if (entry == NULL) {
-		ui_unlock(ui);
-		return;
-	}
-
-	rc = wndmgt_get_window_info(wndlist->wndmgt, wnd_id, &winfo);
-	if (rc != EOK) {
-		ui_unlock(ui);
-		return;
-	}
-
-	(void) wndlist_update(wndlist, entry, winfo->caption,
-	    winfo->nfocus != 0);
-	wndmgt_free_window_info(winfo);
-	ui_unlock(ui);
-}
-
-/** Find window list entry by ID.
- *
- * @param wndlist Window list
- * @param wnd_id Window ID
- * @return Window list entry on success or @c NULL if not found
- */
-wndlist_entry_t *wndlist_entry_by_id(wndlist_t *wndlist, sysarg_t wnd_id)
-{
-	wndlist_entry_t *entry;
-
-	entry = wndlist_first(wndlist);
-	while (entry != NULL) {
-		if (entry->wnd_id == wnd_id)
-			return entry;
-
-		entry = wndlist_next(entry);
-	}
-
-	return NULL;
-}
-
-/** Get first window list entry.
- *
- * @param wndlist Window list
- * @return First entry or @c NULL if the list is empty
- */
-wndlist_entry_t *wndlist_first(wndlist_t *wndlist)
-{
-	link_t *link;
-
-	link = list_first(&wndlist->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, wndlist_entry_t, lentries);
-}
-
-/** Get last window list entry.
- *
- * @param wndlist Window list
- * @return Last entry or @c NULL if the list is empty
- */
-wndlist_entry_t *wndlist_last(wndlist_t *wndlist)
-{
-	link_t *link;
-
-	link = list_last(&wndlist->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, wndlist_entry_t, lentries);
-}
-
-/** Get next window list entry.
- *
- * @param cur Current entry
- * @return Next entry or @c NULL if @a cur is the last entry
- */
-wndlist_entry_t *wndlist_next(wndlist_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lentries, &cur->wndlist->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, wndlist_entry_t, lentries);
-}
-
-/** Get number of window list entries.
- *
- * @param wndlist Window list
- * @return Number of entries
- */
-size_t wndlist_count(wndlist_t *wndlist)
-{
-	return list_count(&wndlist->entries);
-}
-
-/** Repaint window list.
- *
- * @param wndlist Window list
- * @return @c EOK on success or an error code
- */
-errno_t wndlist_repaint(wndlist_t *wndlist)
-{
-	if (ui_is_suspended(ui_window_get_ui(wndlist->window)))
-		return EOK;
-
-	return ui_window_paint(wndlist->window);
-}
-
-/** Window button was clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (wndlist_entry_t *)
- */
-static void wndlist_button_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	wndlist_entry_t *entry = (wndlist_entry_t *)arg;
-	sysarg_t dev_id;
-
-	/* ID of device that clicked the button */
-	dev_id = entry->wndlist->ev_idev_id;
-
-	(void) wndmgt_activate_window(entry->wndlist->wndmgt,
-	    dev_id, entry->wnd_id);
-}
-
-/** @}
- */
Index: pace/app/taskbar/wndlist.h
===================================================================
--- uspace/app/taskbar/wndlist.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskbar
- * @{
- */
-/**
- * @file Taskbar window list
- */
-
-#ifndef WNDLIST_H
-#define WNDLIST_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <ui/fixed.h>
-#include <ui/window.h>
-#include <wndmgt.h>
-#include "types/wndlist.h"
-
-extern errno_t wndlist_create(ui_window_t *, ui_fixed_t *, wndlist_t **);
-extern void wndlist_set_rect(wndlist_t *, gfx_rect_t *);
-extern errno_t wndlist_open_wm(wndlist_t *, const char *);
-extern void wndlist_destroy(wndlist_t *);
-extern errno_t wndlist_append(wndlist_t *, sysarg_t, const char *, bool,
-    bool);
-extern errno_t wndlist_remove(wndlist_t *, wndlist_entry_t *, bool);
-extern bool wndlist_update_pitch(wndlist_t *);
-extern errno_t wndlist_update(wndlist_t *, wndlist_entry_t *, const char *,
-    bool);
-extern void wndlist_set_entry_rect(wndlist_t *, wndlist_entry_t *);
-extern wndlist_entry_t *wndlist_entry_by_id(wndlist_t *, sysarg_t);
-extern wndlist_entry_t *wndlist_first(wndlist_t *);
-extern wndlist_entry_t *wndlist_last(wndlist_t *);
-extern wndlist_entry_t *wndlist_next(wndlist_entry_t *);
-extern size_t wndlist_count(wndlist_t *);
-extern errno_t wndlist_repaint(wndlist_t *);
-extern errno_t wndlist_paint_entry(wndlist_entry_t *);
-extern errno_t wndlist_unpaint_entry(wndlist_entry_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskdump/doc/doxygroups.h
===================================================================
--- uspace/app/taskdump/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup taskdump taskdump
- * @brief Task dumper
- * @ingroup apps
- */
Index: pace/app/taskdump/elf_core.c
===================================================================
--- uspace/app/taskdump/elf_core.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,329 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskdump
- * @{
- */
-/** @file Write ELF core files.
- *
- * Creates ELF core files. Core files do not seem to be specified by some
- * standard (the System V ABI explicitely states that it does not specify
- * them).
- *
- * Looking at core files produced by Linux, these don't have section headers,
- * only program headers, although objdump shows them as having sections.
- * Basically at the beginning there should be a note segment followed
- * by one loadable segment per memory area.
- *
- * The note segment contains a series of records with register state,
- * process info etc. We only write one record NT_PRSTATUS which contains
- * process/register state (anything which is not register state we fill
- * with zeroes).
- */
-
-#include <align.h>
-#include <elf/elf.h>
-#include <elf/elf_linux.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <errno.h>
-#include <str_error.h>
-#include <mem.h>
-#include <as.h>
-#include <udebug.h>
-#include <macros.h>
-#include <libarch/istate.h>
-#include <vfs/vfs.h>
-#include <str.h>
-
-#include "elf_core.h"
-
-static off64_t align_foff_up(off64_t, uintptr_t, size_t);
-static errno_t write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *);
-
-#define BUFFER_SIZE 0x1000
-static uint8_t buffer[BUFFER_SIZE];
-
-/** Save ELF core file.
- *
- * @param file_name Name of file to save to.
- * @param ainfo     Array of @a n memory area info structures.
- * @param n         Number of memory areas.
- * @param sess      Debugging session.
- *
- * @return EOK on sucess.
- * @return ENOENT if file cannot be created.
- * @return ENOMEM on out of memory.
- * @return EIO on write error.
- *
- */
-errno_t elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n,
-    async_sess_t *sess, istate_t *istate)
-{
-	elf_header_t elf_hdr;
-	off64_t foff;
-	size_t n_ph;
-	elf_word flags;
-	elf_segment_header_t *p_hdr;
-	elf_prstatus_t pr_status;
-	elf_note_t note;
-	size_t word_size;
-	aoff64_t pos = 0;
-
-	int fd;
-	errno_t rc;
-	size_t nwr;
-	unsigned int i;
-
-#ifdef __32_BITS__
-	word_size = 4;
-#endif
-#ifdef __64_BITS__
-	/*
-	 * This should be 8 per the 64-bit ELF spec, but the Linux kernel
-	 * screws up and uses 4 anyway (and screws up elf_note_t as well)
-	 * and we are trying to be compatible with Linux GDB target. Sigh.
-	 */
-	word_size = 4;
-#endif
-	memset(&pr_status, 0, sizeof(pr_status));
-	istate_to_elf_regs(istate, &pr_status.regs);
-
-	n_ph = n + 1;
-
-	p_hdr = malloc(sizeof(elf_segment_header_t) * n_ph);
-	if (p_hdr == NULL) {
-		printf("Failed allocating memory.\n");
-		return ENOMEM;
-	}
-
-	rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_WRITE, &fd);
-	if (rc != EOK) {
-		printf("Failed opening file '%s': %s.\n", file_name, str_error(rc));
-		free(p_hdr);
-		return ENOENT;
-	}
-
-	/*
-	 * File layout:
-	 *
-	 * 	ELF header
-	 *	program headers
-	 *	note segment
-	 * repeat:
-	 *	(pad for alignment)
-	 *	core segment
-	 * end repeat
-	 */
-
-	memset(&elf_hdr, 0, sizeof(elf_hdr));
-	elf_hdr.e_ident[EI_MAG0] = ELFMAG0;
-	elf_hdr.e_ident[EI_MAG1] = ELFMAG1;
-	elf_hdr.e_ident[EI_MAG2] = ELFMAG2;
-	elf_hdr.e_ident[EI_MAG3] = ELFMAG3;
-	elf_hdr.e_ident[EI_CLASS] = ELF_CLASS;
-	elf_hdr.e_ident[EI_DATA] = ELF_DATA_ENCODING;
-	elf_hdr.e_ident[EI_VERSION] = EV_CURRENT;
-
-	elf_hdr.e_type = ET_CORE;
-	elf_hdr.e_machine = ELF_MACHINE;
-	elf_hdr.e_version = EV_CURRENT;
-	elf_hdr.e_entry = 0;
-	elf_hdr.e_phoff = sizeof(elf_header_t);
-	elf_hdr.e_shoff = 0;
-	elf_hdr.e_flags = 0;
-	elf_hdr.e_ehsize = sizeof(elf_hdr);
-	elf_hdr.e_phentsize = sizeof(elf_segment_header_t);
-	elf_hdr.e_phnum = n_ph;
-	elf_hdr.e_shentsize = 0;
-	elf_hdr.e_shnum = 0;
-	elf_hdr.e_shstrndx = 0;
-
-	/* foff is used for allocation of file space for segment data. */
-	foff = elf_hdr.e_phoff + n_ph * sizeof(elf_segment_header_t);
-
-	memset(&p_hdr[0], 0, sizeof(p_hdr[0]));
-	p_hdr[0].p_type = PT_NOTE;
-	p_hdr[0].p_offset = foff;
-	p_hdr[0].p_vaddr = 0;
-	p_hdr[0].p_paddr = 0;
-	p_hdr[0].p_filesz = sizeof(elf_note_t) +
-	    ALIGN_UP((str_size("CORE") + 1), word_size) +
-	    ALIGN_UP(sizeof(elf_prstatus_t), word_size);
-	p_hdr[0].p_memsz = 0;
-	p_hdr[0].p_flags = 0;
-	p_hdr[0].p_align = 1;
-
-	foff += p_hdr[0].p_filesz;
-
-	for (i = 0; i < n; ++i) {
-		foff = align_foff_up(foff, ainfo[i].start_addr, PAGE_SIZE);
-
-		flags = 0;
-		if (ainfo[i].flags & AS_AREA_READ)
-			flags |= PF_R;
-		if (ainfo[i].flags & AS_AREA_WRITE)
-			flags |= PF_W;
-		if (ainfo[i].flags & AS_AREA_EXEC)
-			flags |= PF_X;
-
-		memset(&p_hdr[i + 1], 0, sizeof(p_hdr[i + 1]));
-		p_hdr[i + 1].p_type = PT_LOAD;
-		p_hdr[i + 1].p_offset = foff;
-		p_hdr[i + 1].p_vaddr = ainfo[i].start_addr;
-		p_hdr[i + 1].p_paddr = 0;
-		p_hdr[i + 1].p_filesz = ainfo[i].size;
-		p_hdr[i + 1].p_memsz = ainfo[i].size;
-		p_hdr[i + 1].p_flags = flags;
-		p_hdr[i + 1].p_align = PAGE_SIZE;
-
-		foff += ainfo[i].size;
-	}
-
-	rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr), &nwr);
-	if (rc != EOK) {
-		printf("Failed writing ELF header.\n");
-		free(p_hdr);
-		return EIO;
-	}
-
-	for (i = 0; i < n_ph; ++i) {
-		rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]), &nwr);
-		if (rc != EOK) {
-			printf("Failed writing program header.\n");
-			free(p_hdr);
-			return EIO;
-		}
-	}
-
-	pos = p_hdr[0].p_offset;
-
-	/*
-	 * Write note header
-	 */
-	note.namesz = str_size("CORE") + 1;
-	note.descsz = sizeof(elf_prstatus_t);
-	note.type = NT_PRSTATUS;
-
-	rc = vfs_write(fd, &pos, &note, sizeof(elf_note_t), &nwr);
-	if (rc != EOK) {
-		printf("Failed writing note header.\n");
-		free(p_hdr);
-		return EIO;
-	}
-
-	rc = vfs_write(fd, &pos, "CORE", note.namesz, &nwr);
-	if (rc != EOK) {
-		printf("Failed writing note header.\n");
-		free(p_hdr);
-		return EIO;
-	}
-
-	pos = ALIGN_UP(pos, word_size);
-
-	rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t), &nwr);
-	if (rc != EOK) {
-		printf("Failed writing register data.\n");
-		free(p_hdr);
-		return EIO;
-	}
-
-	for (i = 1; i < n_ph; ++i) {
-		pos = p_hdr[i].p_offset;
-		if (write_mem_area(fd, &pos, &ainfo[i - 1], sess) != EOK) {
-			printf("Failed writing memory data.\n");
-			free(p_hdr);
-			return EIO;
-		}
-	}
-
-	free(p_hdr);
-
-	return EOK;
-}
-
-/** Align file offset up to be congruent with vaddr modulo page size. */
-static off64_t align_foff_up(off64_t foff, uintptr_t vaddr, size_t page_size)
-{
-	off64_t rva = vaddr % page_size;
-	off64_t rfo = foff % page_size;
-
-	if (rva >= rfo)
-		return (foff + (rva - rfo));
-
-	return (foff + (page_size + (rva - rfo)));
-}
-
-/** Write memory area from application to core file.
- *
- * @param fd   File to write to.
- * @param pos  Pointer to the position to write to.
- * @param area Memory area info structure.
- * @param sess Debugging session.
- *
- * @return EOK on success, EIO on failure.
- *
- */
-static errno_t write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area,
-    async_sess_t *sess)
-{
-	size_t to_copy;
-	size_t total;
-	uintptr_t addr;
-	errno_t rc;
-	size_t nwr;
-
-	addr = area->start_addr;
-	total = 0;
-
-	while (total < area->size) {
-		to_copy = min(area->size - total, BUFFER_SIZE);
-		rc = udebug_mem_read(sess, buffer, addr, to_copy);
-		if (rc != EOK) {
-			printf("Failed reading task memory.\n");
-			return EIO;
-		}
-
-		rc = vfs_write(fd, pos, buffer, to_copy, &nwr);
-		if (rc != EOK) {
-			printf("Failed writing memory contents.\n");
-			return EIO;
-		}
-
-		addr += to_copy;
-		total += to_copy;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/taskdump/fibrildump.c
===================================================================
--- uspace/app/taskdump/fibrildump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskdump
- * @{
- */
-/** @file
- */
-
-#include <adt/list.h>
-#include <context.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibrildump.h>
-#include <stacktrace.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <symtab.h>
-#include <taskdump.h>
-#include <udebug.h>
-
-struct fibril {
-	link_t all_link;
-	context_t ctx;
-	uint8_t __opaque[];
-};
-
-static errno_t fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *);
-
-static stacktrace_ops_t fibrildump_st_ops = {
-	.read_uintptr = fibrildump_read_uintptr
-};
-
-static errno_t fibrildump_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
-{
-	async_sess_t *sess = (async_sess_t *)arg;
-
-	return udebug_mem_read(sess, data, addr, sizeof(uintptr_t));
-}
-
-static errno_t read_link(async_sess_t *sess, uintptr_t addr, link_t *link)
-{
-	errno_t rc;
-
-	rc = udebug_mem_read(sess, (void *)link, addr, sizeof(link_t));
-	return rc;
-}
-
-static errno_t read_fibril(async_sess_t *sess, uintptr_t addr, fibril_t *fibril)
-{
-	errno_t rc;
-
-	rc = udebug_mem_read(sess, (void *)fibril, addr, sizeof(fibril_t));
-	return rc;
-}
-
-errno_t fibrils_dump(symtab_t *symtab, async_sess_t *sess)
-{
-	uintptr_t fibril_list_addr;
-	link_t link;
-	fibril_t fibril;
-	uintptr_t addr, fibril_addr;
-	uintptr_t pc, fp;
-	errno_t rc;
-
-	/*
-	 * If we for whatever reason could not obtain symbols table from the binary,
-	 * we cannot dump fibrils.
-	 */
-	if (symtab == NULL) {
-		return EIO;
-	}
-
-	rc = symtab_name_to_addr(symtab, "fibril_list", &fibril_list_addr);
-	if (rc != EOK)
-		return EIO;
-
-	addr = fibril_list_addr;
-	while (true) {
-		rc = read_link(sess, addr, &link);
-		if (rc != EOK)
-			return EIO;
-
-		addr = (uintptr_t) link.next;
-		if (addr == fibril_list_addr)
-			break;
-
-		fibril_addr = (uintptr_t) list_get_instance((void *)addr,
-		    fibril_t, all_link);
-		printf("Fibril %p:\n", (void *) fibril_addr);
-		rc = read_fibril(sess, fibril_addr, &fibril);
-		if (rc != EOK)
-			return EIO;
-
-		pc = context_get_pc(&fibril.ctx);
-		fp = context_get_fp(&fibril.ctx);
-		if (0)
-			stacktrace_print_generic(&fibrildump_st_ops, sess,
-			    fp, pc);
-		td_stacktrace(fp, pc);
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/taskdump/include/elf_core.h
===================================================================
--- uspace/app/taskdump/include/elf_core.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup debug
- * @{
- */
-/** @file
- */
-
-#ifndef ELF_CORE_H_
-#define ELF_CORE_H_
-
-#include <async.h>
-#include <elf/elf_linux.h>
-#include <libarch/istate.h>
-
-extern errno_t elf_core_save(const char *, as_area_info_t *, unsigned int,
-    async_sess_t *, istate_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskdump/include/fibrildump.h
===================================================================
--- uspace/app/taskdump/include/fibrildump.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef FIBRILDUMP_H
-#define FIBRILDUMP_H
-
-#include <async.h>
-#include <symtab.h>
-
-extern errno_t fibrils_dump(symtab_t *, async_sess_t *sess);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskdump/include/symtab.h
===================================================================
--- uspace/app/taskdump/include/symtab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup debug
- * @{
- */
-/** @file
- */
-
-#ifndef SYMTAB_H_
-#define SYMTAB_H_
-
-#include <elf/elf.h>
-#include <stddef.h>
-
-typedef struct {
-	/** Symbol section */
-	elf_symbol_t *sym;
-	size_t sym_size;
-	/** String table */
-	char *strtab;
-	size_t strtab_size;
-} symtab_t;
-
-extern errno_t symtab_load(const char *file_name, symtab_t **symtab);
-extern void symtab_delete(symtab_t *st);
-extern errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr);
-extern errno_t symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name,
-    size_t *offs);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskdump/include/taskdump.h
===================================================================
--- uspace/app/taskdump/include/taskdump.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef TASKDUMP_H
-#define TASKDUMP_H
-
-#include <stdint.h>
-
-extern errno_t td_stacktrace(uintptr_t, uintptr_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/taskdump/meson.build
===================================================================
--- uspace/app/taskdump/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-includes += include_directories('include')
-src = files(
-	'elf_core.c',
-	'fibrildump.c',
-	'taskdump.c',
-	'symtab.c',
-)
Index: pace/app/taskdump/symtab.c
===================================================================
--- uspace/app/taskdump/symtab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,354 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup debug
- * @{
- */
-/** @file Handling of ELF symbol tables.
- *
- * This module allows one to load a symbol table from an ELF file and
- * use it to lookup symbol names/addresses in both directions.
- */
-
-#include <elf/elf.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <str.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-
-#include "include/symtab.h"
-
-static errno_t elf_hdr_check(elf_header_t *hdr);
-static errno_t section_hdr_load(int fd, const elf_header_t *ehdr, int idx,
-    elf_section_header_t *shdr);
-static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr);
-
-/** Load symbol table from an ELF file.
- *
- * @param file_name	Name of the ELF file to read from.
- * @param symtab	Place to save pointer to new symtab structure.
- *
- * @return		EOK on success, ENOENT if file could not be open,
- *			ENOTSUP if file parsing failed.
- */
-errno_t symtab_load(const char *file_name, symtab_t **symtab)
-{
-	symtab_t *stab;
-	elf_header_t elf_hdr;
-	elf_section_header_t sec_hdr;
-	off64_t shstrt_start;
-	size_t shstrt_size;
-	char *shstrt, *sec_name;
-	void *data;
-	aoff64_t pos = 0;
-
-	int fd;
-	errno_t rc;
-	size_t nread;
-	int i;
-
-	bool load_sec, sec_is_symtab;
-
-	*symtab = NULL;
-
-	stab = calloc(1, sizeof(symtab_t));
-	if (stab == NULL)
-		return ENOMEM;
-
-	rc = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
-		printf("failed opening file '%s': %s\n", file_name, str_error(rc));
-		free(stab);
-		return ENOENT;
-	}
-
-	rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t), &nread);
-	if (rc != EOK || nread != sizeof(elf_header_t)) {
-		printf("failed reading elf header\n");
-		free(stab);
-		return EIO;
-	}
-
-	rc = elf_hdr_check(&elf_hdr);
-	if (rc != EOK) {
-		printf("failed header check\n");
-		free(stab);
-		return ENOTSUP;
-	}
-
-	/*
-	 * Load section header string table.
-	 */
-
-	rc = section_hdr_load(fd, &elf_hdr, elf_hdr.e_shstrndx, &sec_hdr);
-	if (rc != EOK) {
-		printf("failed reading shstrt header\n");
-		free(stab);
-		return ENOTSUP;
-	}
-
-	shstrt_start = sec_hdr.sh_offset;
-	shstrt_size = sec_hdr.sh_size;
-
-	rc = chunk_load(fd, shstrt_start, shstrt_size, (void **) &shstrt);
-	if (rc != EOK) {
-		printf("failed loading shstrt\n");
-		free(stab);
-		return ENOTSUP;
-	}
-
-	/* Read all section headers. */
-	for (i = 0; i < elf_hdr.e_shnum; ++i) {
-		rc = section_hdr_load(fd, &elf_hdr, i, &sec_hdr);
-		if (rc != EOK) {
-			free(shstrt);
-			free(stab);
-			return ENOTSUP;
-		}
-
-		sec_name = shstrt + sec_hdr.sh_name;
-		if (str_cmp(sec_name, ".symtab") == 0 &&
-		    sec_hdr.sh_type == SHT_SYMTAB) {
-			load_sec = true;
-			sec_is_symtab = true;
-		} else if (str_cmp(sec_name, ".strtab") == 0 &&
-		    sec_hdr.sh_type == SHT_STRTAB) {
-			load_sec = true;
-			sec_is_symtab = false;
-		} else {
-			load_sec = false;
-		}
-
-		if (load_sec) {
-			rc = chunk_load(fd, sec_hdr.sh_offset, sec_hdr.sh_size,
-			    &data);
-			if (rc != EOK) {
-				free(shstrt);
-				free(stab);
-				return ENOTSUP;
-			}
-
-			if (sec_is_symtab) {
-				stab->sym = data;
-				stab->sym_size = sec_hdr.sh_size;
-			} else {
-				stab->strtab = data;
-				stab->strtab_size = sec_hdr.sh_size;
-			}
-		}
-	}
-
-	free(shstrt);
-	vfs_put(fd);
-
-	if (stab->sym == NULL || stab->strtab == NULL) {
-		/* Tables not found. */
-		printf("Symbol table or string table section not found\n");
-		free(stab);
-		return ENOTSUP;
-	}
-
-	*symtab = stab;
-
-	return EOK;
-}
-
-/** Delete a symtab structure.
- *
- * Deallocates all resources used by the symbol table.
- */
-void symtab_delete(symtab_t *st)
-{
-	free(st->sym);
-	st->sym = NULL;
-
-	free(st->strtab);
-	st->strtab = NULL;
-
-	free(st);
-}
-
-/** Convert symbol name to address.
- *
- * @param st	Symbol table.
- * @param name	Name of the symbol.
- * @param addr	Place to store address for symbol, if found.
- *
- * @return	EOK on success, ENOENT if no such symbol was found.
- */
-errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
-{
-	size_t i;
-	char *sname;
-	unsigned stype;
-
-	for (i = 0; i < st->sym_size / sizeof(elf_symbol_t); ++i) {
-		if (st->sym[i].st_name == 0)
-			continue;
-
-		stype = elf_st_type(st->sym[i].st_info);
-		if (stype != STT_OBJECT && stype != STT_FUNC)
-			continue;
-
-		sname = st->strtab + st->sym[i].st_name;
-
-		if (str_cmp(sname, name) == 0) {
-			*addr = st->sym[i].st_value;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Convert symbol address to name.
- *
- * This function finds the symbol which starts at the highest address
- * less than or equal to @a addr.
- *
- * @param st	Symbol table.
- * @param addr	Address for lookup.
- * @param name	Place to store pointer name of symbol, if found.
- *		This is valid while @a st exists.
- *
- * @return	EOK on success or ENOENT if no matching symbol was found.
- */
-errno_t symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,
-    size_t *offs)
-{
-	size_t i;
-	uintptr_t saddr, best_addr;
-	char *sname, *best_name;
-	unsigned stype;
-
-	best_name = NULL;
-	best_addr = 0;
-
-	for (i = 0; i < st->sym_size / sizeof(elf_symbol_t); ++i) {
-		if (st->sym[i].st_name == 0)
-			continue;
-
-		stype = elf_st_type(st->sym[i].st_info);
-		if (stype != STT_OBJECT && stype != STT_FUNC &&
-		    stype != STT_NOTYPE) {
-			continue;
-		}
-
-		saddr = st->sym[i].st_value;
-		sname = st->strtab + st->sym[i].st_name;
-
-		/* An ugly hack to filter out some special ARM symbols. */
-		if (sname[0] == '$')
-			continue;
-
-		if (saddr <= addr && (best_name == NULL || saddr > best_addr)) {
-			best_name = sname;
-			best_addr = saddr;
-		}
-	}
-
-	if (best_name == NULL)
-		return ENOENT;
-
-	*name = best_name;
-	*offs = addr - best_addr;
-	return EOK;
-}
-
-/** Check if ELF header is valid.
- *
- * @return	EOK on success or an error code.
- */
-static errno_t elf_hdr_check(elf_header_t *ehdr)
-{
-	/* TODO */
-	return EOK;
-}
-
-/** Load ELF section header.
- *
- * @param fd		File descriptor of ELF file.
- * @param elf_hdr	Pointer to ELF file header in memory.
- * @param idx		Index of section whose header to load (0 = first).
- * @param sec_hdr	Place to store section header data.
- *
- * @return		EOK on success or EIO if I/O failed.
- */
-static errno_t section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,
-    elf_section_header_t *sec_hdr)
-{
-	errno_t rc;
-	size_t nread;
-	aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
-
-	rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t), &nread);
-	if (rc != EOK || nread != sizeof(elf_section_header_t))
-		return EIO;
-
-	return EOK;
-}
-
-/** Load a segment of bytes from a file and return it as a new memory block.
- *
- * This function fails if it cannot read exactly @a size bytes from the file.
- *
- * @param fd		File to read from.
- * @param start		Position in file where to start reading.
- * @param size		Number of bytes to read.
- * @param ptr		Place to store pointer to newly allocated block.
- *
- * @return		EOK on success or EIO on failure.
- */
-static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr)
-{
-	errno_t rc;
-	size_t nread;
-	aoff64_t pos = start;
-
-	*ptr = malloc(size);
-	if (*ptr == NULL) {
-		printf("failed allocating memory\n");
-		return ENOMEM;
-	}
-
-	rc = vfs_read(fd, &pos, *ptr, size, &nread);
-	if (rc != EOK || nread != size) {
-		printf("failed reading chunk\n");
-		free(*ptr);
-		*ptr = NULL;
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/taskdump/taskdump.c
===================================================================
--- uspace/app/taskdump/taskdump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,489 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskdump
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <elf/elf_linux.h>
-#include <fibrildump.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <str_error.h>
-#include <errno.h>
-#include <udebug.h>
-#include <task.h>
-#include <as.h>
-#include <libarch/istate.h>
-#include <macros.h>
-#include <assert.h>
-#include <str.h>
-
-#include <symtab.h>
-#include <elf_core.h>
-#include <stacktrace.h>
-#include <taskdump.h>
-
-#define LINE_BYTES 16
-#define STACK_FRAMES_MAX 20
-
-static async_sess_t *sess;
-static task_id_t task_id;
-static bool write_core_file;
-static char *core_file_name;
-static char *app_name;
-static symtab_t *app_symtab;
-
-static errno_t connect_task(task_id_t task_id);
-static int parse_args(int argc, char *argv[]);
-static void print_syntax(void);
-static errno_t threads_dump(void);
-static errno_t thread_dump(uintptr_t thash);
-static errno_t areas_dump(void);
-static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);
-
-static void autoload_syms(void);
-static char *get_app_task_name(void);
-static char *fmt_sym_address(uintptr_t addr);
-
-static istate_t reg_state;
-
-static stacktrace_ops_t td_stacktrace_ops = {
-	.read_uintptr = td_read_uintptr
-};
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("Task Dump Utility\n");
-	write_core_file = false;
-
-	if (parse_args(argc, argv) < 0)
-		return 1;
-
-	rc = connect_task(task_id);
-	if (rc != EOK) {
-		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
-		return 1;
-	}
-
-	app_name = get_app_task_name();
-	app_symtab = NULL;
-
-	printf("Dumping task '%s' (task ID %" PRIu64 ").\n", app_name, task_id);
-	autoload_syms();
-	putchar('\n');
-
-	rc = threads_dump();
-	if (rc != EOK)
-		printf("Failed dumping threads.\n");
-
-	rc = areas_dump();
-	if (rc != EOK)
-		printf("Failed dumping address space areas.\n");
-
-	rc = fibrils_dump(app_symtab, sess);
-	if (rc != EOK)
-		printf("Failed dumping fibrils.\n");
-
-	udebug_end(sess);
-	async_hangup(sess);
-
-	return 0;
-}
-
-static errno_t connect_task(task_id_t task_id)
-{
-	errno_t rc;
-	async_sess_t *ksess = async_connect_kbox(task_id, &rc);
-
-	if (!ksess) {
-		if (rc == ENOTSUP) {
-			printf("You do not have userspace debugging support "
-			    "compiled in the kernel.\n");
-			printf("Compile kernel with 'Support for userspace debuggers' "
-			    "(CONFIG_UDEBUG) enabled.\n");
-			return rc;
-		}
-
-		printf("Error connecting\n");
-		printf("async_connect_kbox(%" PRIu64 ") -> %s", task_id, str_error_name(errno));
-		return rc;
-	}
-
-	rc = udebug_begin(ksess);
-	if (rc != EOK) {
-		printf("udebug_begin() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	sess = ksess;
-	return 0;
-}
-
-static int parse_args(int argc, char *argv[])
-{
-	char *arg;
-	char *err_p;
-
-	task_id = 0;
-
-	--argc;
-	++argv;
-
-	while (argc > 0) {
-		arg = *argv;
-		if (arg[0] == '-') {
-			if (arg[1] == 't' && arg[2] == '\0') {
-				/* Task ID */
-				--argc;
-				++argv;
-				task_id = strtol(*argv, &err_p, 10);
-				if (*err_p) {
-					printf("Task ID syntax error\n");
-					print_syntax();
-					return -1;
-				}
-			} else if (arg[1] == 'c' && arg[2] == '\0') {
-				write_core_file = true;
-
-				--argc;
-				++argv;
-				core_file_name = *argv;
-			} else {
-				printf("Uknown option '%c'\n", arg[0]);
-				print_syntax();
-				return -1;
-			}
-		} else {
-			break;
-		}
-
-		--argc;
-		++argv;
-	}
-
-	if (task_id == 0) {
-		printf("Missing task ID argument\n");
-		print_syntax();
-		return -1;
-	}
-
-	if (argc != 0) {
-		printf("Extra arguments\n");
-		print_syntax();
-		return -1;
-	}
-
-	return 0;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: taskdump [-c <core_file>] -t <task_id>\n");
-	printf("\t-c <core_file_id>\tName of core file to write.\n");
-	printf("\t-t <task_id>\tWhich task to dump.\n");
-}
-
-static errno_t threads_dump(void)
-{
-	uintptr_t *thash_buf;
-	uintptr_t dummy_buf;
-	size_t buf_size, n_threads;
-
-	size_t copied;
-	size_t needed;
-	size_t i;
-	errno_t rc;
-
-	/* TODO: See why NULL does not work. */
-	rc = udebug_thread_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	if (needed == 0) {
-		printf("No threads.\n\n");
-		return 0;
-	}
-
-	buf_size = needed;
-	thash_buf = malloc(buf_size);
-
-	rc = udebug_thread_read(sess, thash_buf, buf_size, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	assert(copied == buf_size);
-	assert(needed == buf_size);
-
-	n_threads = copied / sizeof(uintptr_t);
-
-	printf("Threads:\n");
-	for (i = 0; i < n_threads; i++) {
-		printf(" [%zu] hash: %p\n", 1 + i, (void *) thash_buf[i]);
-
-		thread_dump(thash_buf[i]);
-	}
-	putchar('\n');
-
-	free(thash_buf);
-
-	return 0;
-}
-
-static errno_t areas_dump(void)
-{
-	as_area_info_t *ainfo_buf;
-	as_area_info_t dummy_buf;
-	size_t buf_size, n_areas;
-
-	size_t copied;
-	size_t needed;
-	size_t i;
-	errno_t rc;
-
-	rc = udebug_areas_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_areas_read() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	buf_size = needed;
-	ainfo_buf = malloc(buf_size);
-
-	rc = udebug_areas_read(sess, ainfo_buf, buf_size, &copied, &needed);
-	if (rc != EOK) {
-		printf("udebug_areas_read() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	assert(copied == buf_size);
-	assert(needed == buf_size);
-
-	n_areas = copied / sizeof(as_area_info_t);
-
-	printf("Address space areas:\n");
-	for (i = 0; i < n_areas; i++) {
-		printf(" [%zu] flags: %c%c%c%c base: %p size: %zu\n", 1 + i,
-		    (ainfo_buf[i].flags & AS_AREA_READ) ? 'R' : '-',
-		    (ainfo_buf[i].flags & AS_AREA_WRITE) ? 'W' : '-',
-		    (ainfo_buf[i].flags & AS_AREA_EXEC) ? 'X' : '-',
-		    (ainfo_buf[i].flags & AS_AREA_CACHEABLE) ? 'C' : '-',
-		    (void *) ainfo_buf[i].start_addr, ainfo_buf[i].size);
-	}
-
-	putchar('\n');
-
-	if (write_core_file) {
-		printf("Writing core file '%s'\n", core_file_name);
-
-		rc = elf_core_save(core_file_name, ainfo_buf, n_areas, sess,
-		    &reg_state);
-
-		if (rc != EOK) {
-			printf("Failed writing core file.\n");
-			return EIO;
-		}
-	}
-
-	free(ainfo_buf);
-
-	return 0;
-}
-
-errno_t td_stacktrace(uintptr_t fp, uintptr_t pc)
-{
-	int cnt = 0;
-	uintptr_t nfp;
-	stacktrace_t st;
-	char *sym_pc;
-	errno_t rc;
-
-	st.op_arg = NULL;
-	st.ops = &td_stacktrace_ops;
-
-	while (cnt++ < STACK_FRAMES_MAX && stacktrace_fp_valid(&st, fp)) {
-		sym_pc = fmt_sym_address(pc);
-		printf("  %p: %s\n", (void *) fp, sym_pc);
-		free(sym_pc);
-
-		rc = stacktrace_ra_get(&st, fp, &pc);
-		if (rc != EOK)
-			return rc;
-
-		rc = stacktrace_fp_prev(&st, fp, &nfp);
-		if (rc != EOK)
-			return rc;
-
-		fp = nfp;
-	}
-
-	return EOK;
-}
-
-static errno_t thread_dump(uintptr_t thash)
-{
-	istate_t istate;
-	uintptr_t pc, fp;
-	char *sym_pc;
-	errno_t rc;
-
-	rc = udebug_regs_read(sess, thash, &istate);
-	if (rc != EOK) {
-		printf("Failed reading registers: %s.\n", str_error_name(rc));
-		return EIO;
-	}
-
-	pc = istate_get_pc(&istate);
-	fp = istate_get_fp(&istate);
-
-	/* Save register state for dumping to core file later. */
-	reg_state = istate;
-
-	sym_pc = fmt_sym_address(pc);
-	printf("Thread %p: PC = %s. FP = %p\n", (void *) thash,
-	    sym_pc, (void *) fp);
-	free(sym_pc);
-
-	(void) td_stacktrace(fp, pc);
-
-	return EOK;
-}
-
-static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)
-{
-	uintptr_t data;
-	errno_t rc;
-
-	(void) arg;
-
-	rc = udebug_mem_read(sess, &data, addr, sizeof(data));
-	if (rc != EOK) {
-		printf("Warning: udebug_mem_read() failed.\n");
-		return rc;
-	}
-
-	*value = data;
-	return EOK;
-}
-
-/** Attempt to find the right executable file and load the symbol table. */
-static void autoload_syms(void)
-{
-	assert(app_name != NULL);
-	assert(app_symtab == NULL);
-
-	if (app_name[0] != '/') {
-		printf("Task name is not path. Can't autoload symbol table.\n");
-		return;
-	}
-
-	errno_t rc = symtab_load(app_name, &app_symtab);
-	if (rc != EOK) {
-		printf("Failed autoloading symbol table: %s\n",
-		    str_error_name(rc));
-		return;
-	}
-
-	printf("Loaded symbol table from %s\n", app_name);
-}
-
-static char *get_app_task_name(void)
-{
-	char dummy_buf;
-	size_t copied, needed, name_size;
-	char *name;
-	errno_t rc;
-
-	rc = udebug_name_read(sess, &dummy_buf, 0, &copied, &needed);
-	if (rc != EOK)
-		return NULL;
-
-	name_size = needed;
-	name = malloc(name_size + 1);
-	rc = udebug_name_read(sess, name, name_size, &copied, &needed);
-	if (rc != EOK) {
-		free(name);
-		return NULL;
-	}
-
-	assert(copied == name_size);
-	assert(copied == needed);
-	name[copied] = '\0';
-
-	return name;
-}
-
-/** Format address in symbolic form.
- *
- * Formats address as <symbol_name>+<offset> (<address>), if possible,
- * otherwise as <address>.
- *
- * @param addr	Address to format.
- * @return	Newly allocated string, address in symbolic form.
- */
-static char *fmt_sym_address(uintptr_t addr)
-{
-	char *name;
-	size_t offs;
-	errno_t rc;
-	int ret;
-	char *str;
-
-	if (app_symtab != NULL) {
-		rc = symtab_addr_to_name(app_symtab, addr, &name, &offs);
-	} else {
-		rc = ENOTSUP;
-	}
-
-	if (rc == EOK) {
-		ret = asprintf(&str, "%p (%s+%zu)", (void *) addr, name, offs);
-	} else {
-		ret = asprintf(&str, "%p", (void *) addr);
-	}
-
-	if (ret < 0) {
-		printf("Memory allocation error.\n");
-		exit(1);
-	}
-
-	return str;
-}
-
-/** @}
- */
Index: pace/app/terminal/doc/doxygroups.h
===================================================================
--- uspace/app/terminal/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup terminal terminal
- * @brief Terminal application
- * @ingroup apps
- */
Index: pace/app/terminal/main.c
===================================================================
--- uspace/app/terminal/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup terminal
- * @{
- */
-/** @file
- */
-
-#include <ui/ui.h>
-#include <stdio.h>
-#include "terminal.h"
-
-#define NAME  "terminal"
-
-/** Print syntax. */
-static void print_syntax(void)
-{
-	printf("Syntax: %s [<options>]\n", NAME);
-	printf("\t-d <display-spec> Use the specified display\n");
-	printf("\t-c <command>      Run command instead of shell\n");
-	printf("\t-topleft]         Place window to the top-left corner of "
-	    "the screen\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_DISPLAY_DEFAULT;
-	const char *command = "/app/bdsh";
-	terminal_t *terminal = NULL;
-	terminal_flags_t flags = 0;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else if (str_cmp(argv[i], "-c") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			command = argv[i++];
-		} else if (str_cmp(argv[i], "-topleft") == 0) {
-			++i;
-			flags |= tf_topleft;
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = terminal_create(display_spec, 640, 480, flags, command, &terminal);
-	if (rc != EOK)
-		return 1;
-
-	ui_run(terminal->ui);
-
-	terminal_destroy(terminal);
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/terminal/meson.build
===================================================================
--- uspace/app/terminal/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'fbfont', 'display', 'ui', 'termui' ]
-src = files(
-	'main.c',
-	'terminal.c',
-)
Index: pace/app/terminal/terminal.c
===================================================================
--- uspace/app/terminal/terminal.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1172 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup terminal
- * @{
- */
-/**
- * @file Terminal application
- */
-
-#include <adt/list.h>
-#include <adt/prodcons.h>
-#include <as.h>
-#include <errno.h>
-#include <fbfont/font-8x16.h>
-#include <fibril.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <io/con_srv.h>
-#include <io/concaps.h>
-#include <io/console.h>
-#include <io/pixelmap.h>
-#include <macros.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <str.h>
-#include <task.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-
-#include "terminal.h"
-
-#define NAME       "terminal"
-#define NAMESPACE  "terminal"
-
-#define LOCFS_MOUNT_POINT  "/loc"
-
-#define APP_GETTERM  "/app/getterm"
-
-#define TERM_CAPS \
-	(CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE | CONSOLE_CAP_INDEXED | \
-	CONSOLE_CAP_RGB)
-
-#define SCROLLBACK_MAX_LINES 1000
-#define MIN_WINDOW_COLS 8
-#define MIN_WINDOW_ROWS 4
-
-static LIST_INITIALIZE(terms);
-
-#define COLOR_BRIGHT 8
-
-static const pixel_t _basic_colors[16] = {
-	[COLOR_BLACK]       = PIXEL(255, 0, 0, 0),
-	[COLOR_RED]         = PIXEL(255, 170, 0, 0),
-	[COLOR_GREEN]       = PIXEL(255, 0, 170, 0),
-	[COLOR_YELLOW]      = PIXEL(255, 170, 85, 0),
-	[COLOR_BLUE]        = PIXEL(255, 0, 0, 170),
-	[COLOR_MAGENTA]     = PIXEL(255, 170, 0, 170),
-	[COLOR_CYAN]        = PIXEL(255, 0, 170, 170),
-	[COLOR_WHITE]       = PIXEL(255, 170, 170, 170),
-
-	[COLOR_BLACK   | COLOR_BRIGHT] = PIXEL(255, 85, 85, 85),
-	[COLOR_RED     | COLOR_BRIGHT] = PIXEL(255, 255, 85, 85),
-	[COLOR_GREEN   | COLOR_BRIGHT] = PIXEL(255, 85, 255, 85),
-	[COLOR_YELLOW  | COLOR_BRIGHT] = PIXEL(255, 255, 255, 85),
-	[COLOR_BLUE    | COLOR_BRIGHT] = PIXEL(255, 85, 85, 255),
-	[COLOR_MAGENTA | COLOR_BRIGHT] = PIXEL(255, 255, 85, 255),
-	[COLOR_CYAN    | COLOR_BRIGHT] = PIXEL(255, 85, 255, 255),
-	[COLOR_WHITE   | COLOR_BRIGHT] = PIXEL(255, 255, 255, 255),
-};
-
-static errno_t term_open(con_srvs_t *, con_srv_t *);
-static errno_t term_close(con_srv_t *);
-static errno_t term_read(con_srv_t *, void *, size_t, size_t *);
-static errno_t term_write(con_srv_t *, void *, size_t, size_t *);
-static void term_sync(con_srv_t *);
-static void term_clear(con_srv_t *);
-static void term_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t term_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t term_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t term_get_color_cap(con_srv_t *, console_caps_t *);
-static void term_set_style(con_srv_t *, console_style_t);
-static void term_set_color(con_srv_t *, console_color_t, console_color_t,
-    console_color_attr_t);
-static void term_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
-static void term_set_cursor_visibility(con_srv_t *, bool);
-static errno_t term_set_caption(con_srv_t *, const char *);
-static errno_t term_get_event(con_srv_t *, cons_event_t *);
-static errno_t term_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
-static void term_unmap(con_srv_t *);
-static void term_buf_update(con_srv_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-
-static con_ops_t con_ops = {
-	.open = term_open,
-	.close = term_close,
-	.read = term_read,
-	.write = term_write,
-	.sync = term_sync,
-	.clear = term_clear,
-	.set_pos = term_set_pos,
-	.get_pos = term_get_pos,
-	.get_size = term_get_size,
-	.get_color_cap = term_get_color_cap,
-	.set_style = term_set_style,
-	.set_color = term_set_color,
-	.set_rgb_color = term_set_rgb_color,
-	.set_cursor_visibility = term_set_cursor_visibility,
-	.set_caption = term_set_caption,
-	.get_event = term_get_event,
-	.map = term_map,
-	.unmap = term_unmap,
-	.update = term_buf_update
-};
-
-static void terminal_close_event(ui_window_t *, void *);
-static void terminal_focus_event(ui_window_t *, void *, unsigned);
-static void terminal_resize_event(ui_window_t *, void *);
-static void terminal_kbd_event(ui_window_t *, void *, kbd_event_t *);
-static void terminal_pos_event(ui_window_t *, void *, pos_event_t *);
-static void terminal_unfocus_event(ui_window_t *, void *, unsigned);
-static void terminal_maximize_event(ui_window_t *, void *);
-static void terminal_unmaximize_event(ui_window_t *, void *);
-
-static ui_window_cb_t terminal_window_cb = {
-	.close = terminal_close_event,
-	.focus = terminal_focus_event,
-	.resize = terminal_resize_event,
-	.kbd = terminal_kbd_event,
-	.pos = terminal_pos_event,
-	.unfocus = terminal_unfocus_event,
-	.maximize = terminal_maximize_event,
-	.unmaximize = terminal_unmaximize_event,
-};
-
-static errno_t terminal_wait_fibril(void *);
-
-static terminal_t *srv_to_terminal(con_srv_t *srv)
-{
-	return srv->srvs->sarg;
-}
-
-static errno_t getterm(task_wait_t *wait, const char *svc, const char *app)
-{
-	return task_spawnl(NULL, wait, APP_GETTERM, APP_GETTERM, svc,
-	    LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
-}
-
-static pixel_t termui_color_to_pixel(termui_color_t c)
-{
-	uint8_t r, g, b;
-	termui_color_to_rgb(c, &r, &g, &b);
-	return PIXEL(255, r, g, b);
-}
-
-static termui_color_t termui_color_from_pixel(pixel_t pixel)
-{
-	return termui_color_from_rgb(RED(pixel), GREEN(pixel), BLUE(pixel));
-}
-
-static termui_cell_t charfield_to_termui_cell(terminal_t *term, const charfield_t *cf)
-{
-	termui_cell_t cell = { };
-
-	cell.glyph_idx = fb_font_glyph(cf->ch, NULL);
-
-	switch (cf->attrs.type) {
-	case CHAR_ATTR_STYLE:
-		switch (cf->attrs.val.style) {
-		case STYLE_NORMAL:
-			cell.bgcolor = term->default_bgcolor;
-			cell.fgcolor = term->default_fgcolor;
-			break;
-		case STYLE_EMPHASIS:
-			cell.bgcolor = term->emphasis_bgcolor;
-			cell.fgcolor = term->emphasis_fgcolor;
-			break;
-		case STYLE_INVERTED:
-			cell.bgcolor = term->default_bgcolor;
-			cell.fgcolor = term->default_fgcolor;
-			cell.inverted = 1;
-			break;
-		case STYLE_SELECTED:
-			cell.bgcolor = term->selection_bgcolor;
-			cell.fgcolor = term->selection_fgcolor;
-			break;
-		}
-		break;
-
-	case CHAR_ATTR_INDEX:
-		char_attr_index_t index = cf->attrs.val.index;
-
-		int bright = (index.attr & CATTR_BRIGHT) ? COLOR_BRIGHT : 0;
-		pixel_t bgcolor = _basic_colors[index.bgcolor];
-		pixel_t fgcolor = _basic_colors[index.fgcolor | bright];
-		cell.bgcolor = termui_color_from_pixel(bgcolor);
-		cell.fgcolor = termui_color_from_pixel(fgcolor);
-
-		if (index.attr & CATTR_BLINK)
-			cell.blink = 1;
-
-		break;
-
-	case CHAR_ATTR_RGB:
-		cell.bgcolor = termui_color_from_pixel(cf->attrs.val.rgb.bgcolor);
-		cell.fgcolor = termui_color_from_pixel(cf->attrs.val.rgb.fgcolor);
-		break;
-	}
-
-	return cell;
-}
-
-static void term_update_region(terminal_t *term, sysarg_t x, sysarg_t y,
-    sysarg_t w, sysarg_t h)
-{
-	gfx_rect_t rect;
-	gfx_rect_t nupdate;
-
-	rect.p0.x = x;
-	rect.p0.y = y;
-	rect.p1.x = x + w;
-	rect.p1.y = y + h;
-
-	gfx_rect_envelope(&term->update, &rect, &nupdate);
-	term->update = nupdate;
-}
-
-static void term_draw_cell(terminal_t *term, pixelmap_t *pixelmap, int col, int row, const termui_cell_t *cell)
-{
-	termui_color_t bg = cell->bgcolor;
-	if (bg == TERMUI_COLOR_DEFAULT)
-		bg = term->default_bgcolor;
-
-	termui_color_t fg = cell->fgcolor;
-	if (fg == TERMUI_COLOR_DEFAULT)
-		fg = term->default_fgcolor;
-
-	pixel_t bgcolor = termui_color_to_pixel(bg);
-	pixel_t fgcolor = termui_color_to_pixel(fg);
-
-	int bx = col * FONT_WIDTH;
-	int by = row * FONT_SCANLINES;
-
-	// TODO: support bold/italic/underline/strike/blink styling
-
-	if (cell->inverted ^ cell->cursor) {
-		pixel_t tmp = bgcolor;
-		bgcolor = fgcolor;
-		fgcolor = tmp;
-	}
-
-	uint32_t glyph = cell->glyph_idx;
-	assert(glyph < FONT_GLYPHS);
-
-	if (glyph == 0)
-		glyph = fb_font_glyph(U' ', NULL);
-
-	for (unsigned int y = 0; y < FONT_SCANLINES; y++) {
-		pixel_t *dst = pixelmap_pixel_at(pixelmap, bx, by + y);
-		pixel_t *dst_max = pixelmap_pixel_at(pixelmap, bx + FONT_WIDTH - 1, by + y);
-		if (!dst || !dst_max)
-			continue;
-		int count = FONT_WIDTH;
-		while (count-- != 0) {
-			*dst++ = (fb_font[glyph][y] & (1 << count)) ? fgcolor : bgcolor;
-		}
-	}
-
-	term_update_region(term, bx, by, FONT_WIDTH, FONT_SCANLINES);
-}
-
-static void term_render(terminal_t *term)
-{
-	(void) gfx_bitmap_render(term->bmp, &term->update, &term->off);
-
-	term->update.p0.x = 0;
-	term->update.p0.y = 0;
-	term->update.p1.x = 0;
-	term->update.p1.y = 0;
-}
-
-static void termui_refresh_cb(void *userdata)
-{
-	terminal_t *term = userdata;
-
-	termui_force_viewport_update(term->termui, 0, termui_get_rows(term->termui));
-}
-
-static void termui_scroll_cb(void *userdata, int delta)
-{
-	(void) delta;
-
-	// Until we have support for hardware accelerated scrolling, just redraw everything.
-	termui_refresh_cb(userdata);
-}
-
-static pixelmap_t term_get_pixelmap(terminal_t *term)
-{
-	pixelmap_t pixelmap = { };
-	gfx_bitmap_alloc_t alloc;
-
-	errno_t rc = gfx_bitmap_get_alloc(term->bmp, &alloc);
-	if (rc != EOK)
-		return pixelmap;
-
-	pixelmap.width = term->w;
-	pixelmap.height = term->h;
-	pixelmap.data = alloc.pixels;
-	return pixelmap;
-}
-
-static void term_clear_bitmap(terminal_t *term, pixel_t color)
-{
-	pixelmap_t pixelmap = term_get_pixelmap(term);
-	if (pixelmap.data == NULL)
-		return;
-
-	sysarg_t pixels = pixelmap.height * pixelmap.width;
-	for (sysarg_t i = 0; i < pixels; i++)
-		pixelmap.data[i] = color;
-
-	term_update_region(term, 0, 0, pixelmap.width, pixelmap.height);
-}
-
-static void termui_update_cb(void *userdata, int col, int row, const termui_cell_t *cell, int len)
-{
-	terminal_t *term = userdata;
-
-	pixelmap_t pixelmap = term_get_pixelmap(term);
-	if (pixelmap.data == NULL)
-		return;
-
-	for (int i = 0; i < len; i++)
-		term_draw_cell(term, &pixelmap, col + i, row, &cell[i]);
-}
-
-static errno_t term_open(con_srvs_t *srvs, con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t term_close(con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t term_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	uint8_t *bbuf = buf;
-	size_t pos = 0;
-
-	/*
-	 * Read input from keyboard and copy it to the buffer.
-	 * We need to handle situation when wchar is split by 2 following
-	 * reads.
-	 */
-	while (pos < size) {
-		/* Copy to the buffer remaining characters. */
-		while ((pos < size) && (term->char_remains_len > 0)) {
-			bbuf[pos] = term->char_remains[0];
-			pos++;
-
-			/* Unshift the array. */
-			for (size_t i = 1; i < term->char_remains_len; i++)
-				term->char_remains[i - 1] = term->char_remains[i];
-
-			term->char_remains_len--;
-		}
-
-		/* Still not enough? Then get another key from the queue. */
-		if (pos < size) {
-			link_t *link = prodcons_consume(&term->input_pc);
-			terminal_event_t *qevent = list_get_instance(link,
-			    terminal_event_t, link);
-			cons_event_t *event = &qevent->ev;
-
-			/* Accept key presses of printable chars only. */
-			if (event->type == CEV_KEY && event->ev.key.type == KEY_PRESS &&
-			    event->ev.key.c != 0) {
-				char32_t tmp[2] = {
-					event->ev.key.c,
-					0
-				};
-
-				wstr_to_str(term->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp);
-				term->char_remains_len = str_size(term->char_remains);
-			}
-
-			free(qevent);
-		}
-	}
-
-	*nread = size;
-	return EOK;
-}
-
-static void term_write_char(terminal_t *term, wchar_t ch)
-{
-	switch (ch) {
-	case L'\n':
-		termui_put_crlf(term->termui);
-		break;
-	case L'\r':
-		termui_put_cr(term->termui);
-		break;
-	case L'\t':
-		termui_put_tab(term->termui);
-		break;
-	case L'\b':
-		termui_put_backspace(term->termui);
-		break;
-	default:
-		// TODO: For some languages, we might need support for combining
-		//       characters. Currently, we assume every unicode code point is
-		//       an individual printed character, which is not always the case.
-		termui_put_glyph(term->termui, fb_font_glyph(ch, NULL), 1);
-		break;
-	}
-}
-
-static errno_t term_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-
-	size_t off = 0;
-	while (off < size)
-		term_write_char(term, str_decode(data, &off, size));
-
-	fibril_mutex_unlock(&term->mtx);
-
-	term_render(term);
-	gfx_update(term->gc);
-	*nwritten = size;
-
-	return EOK;
-}
-
-static void term_sync(con_srv_t *srv)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static void term_clear(con_srv_t *srv)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-	termui_clear_screen(term->termui);
-	fibril_mutex_unlock(&term->mtx);
-
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static void term_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-	termui_set_pos(term->termui, col, row);
-	fibril_mutex_unlock(&term->mtx);
-
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static errno_t term_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-	int irow, icol;
-	termui_get_pos(term->termui, &icol, &irow);
-	fibril_mutex_unlock(&term->mtx);
-
-	*col = icol;
-	*row = irow;
-
-	return EOK;
-}
-
-static errno_t term_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-	*cols = termui_get_cols(term->termui);
-	*rows = termui_get_rows(term->termui);
-	fibril_mutex_unlock(&term->mtx);
-
-	return EOK;
-}
-
-static errno_t term_get_color_cap(con_srv_t *srv, console_caps_t *caps)
-{
-	(void) srv;
-	*caps = TERM_CAPS;
-
-	return EOK;
-}
-
-static void term_set_style(con_srv_t *srv, console_style_t style)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	termui_cell_t cellstyle = { };
-
-	switch (style) {
-	case STYLE_NORMAL:
-		cellstyle.bgcolor = term->default_bgcolor;
-		cellstyle.fgcolor = term->default_fgcolor;
-		break;
-	case STYLE_EMPHASIS:
-		cellstyle.bgcolor = term->emphasis_bgcolor;
-		cellstyle.fgcolor = term->emphasis_fgcolor;
-		break;
-	case STYLE_INVERTED:
-		cellstyle.bgcolor = term->default_bgcolor;
-		cellstyle.fgcolor = term->default_fgcolor;
-		cellstyle.inverted = 1;
-		break;
-	case STYLE_SELECTED:
-		cellstyle.bgcolor = term->selection_bgcolor;
-		cellstyle.fgcolor = term->selection_fgcolor;
-		break;
-	}
-
-	fibril_mutex_lock(&term->mtx);
-	termui_set_style(term->termui, cellstyle);
-	fibril_mutex_unlock(&term->mtx);
-}
-
-static void term_set_color(con_srv_t *srv, console_color_t bgcolor,
-    console_color_t fgcolor, console_color_attr_t attr)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	int bright = (attr & CATTR_BRIGHT) ? COLOR_BRIGHT : 0;
-
-	termui_cell_t cellstyle = { };
-	cellstyle.bgcolor = termui_color_from_pixel(_basic_colors[bgcolor]);
-	cellstyle.fgcolor = termui_color_from_pixel(_basic_colors[fgcolor | bright]);
-
-	if (attr & CATTR_BLINK)
-		cellstyle.blink = 1;
-
-	fibril_mutex_lock(&term->mtx);
-	termui_set_style(term->termui, cellstyle);
-	fibril_mutex_unlock(&term->mtx);
-}
-
-static void term_set_rgb_color(con_srv_t *srv, pixel_t bgcolor,
-    pixel_t fgcolor)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	termui_cell_t cellstyle = {
-		.bgcolor = termui_color_from_pixel(bgcolor),
-		.fgcolor = termui_color_from_pixel(fgcolor),
-	};
-
-	fibril_mutex_lock(&term->mtx);
-	termui_set_style(term->termui, cellstyle);
-	fibril_mutex_unlock(&term->mtx);
-}
-
-static void term_set_cursor_visibility(con_srv_t *srv, bool visible)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-	termui_set_cursor_visibility(term->termui, visible);
-	fibril_mutex_unlock(&term->mtx);
-
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static errno_t term_set_caption(con_srv_t *srv, const char *caption)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	const char *cap;
-
-	fibril_mutex_lock(&term->mtx);
-
-	if (str_size(caption) > 0)
-		cap = caption;
-	else
-		cap = "Terminal";
-
-	ui_window_set_caption(term->window, cap);
-	fibril_mutex_unlock(&term->mtx);
-
-	term_render(term);
-	gfx_update(term->gc);
-	return EOK;
-}
-
-static errno_t term_get_event(con_srv_t *srv, cons_event_t *event)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	link_t *link = prodcons_consume(&term->input_pc);
-	terminal_event_t *ev = list_get_instance(link, terminal_event_t, link);
-
-	*event = ev->ev;
-	free(ev);
-	return EOK;
-}
-
-/** Create shared buffer for efficient rendering.
- *
- * @param srv Console server
- * @param cols Number of columns in buffer
- * @param rows Number of rows in buffer
- * @param rbuf Place to store pointer to new sharable buffer
- *
- * @return EOK on sucess or an error code
- */
-static errno_t term_map(con_srv_t *srv, sysarg_t cols, sysarg_t rows,
-    charfield_t **rbuf)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	void *buf;
-
-	fibril_mutex_lock(&term->mtx);
-
-	if (term->ubuf != NULL) {
-		fibril_mutex_unlock(&term->mtx);
-		return EBUSY;
-	}
-
-	buf = as_area_create(AS_AREA_ANY, cols * rows * sizeof(charfield_t),
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (buf == AS_MAP_FAILED) {
-		fibril_mutex_unlock(&term->mtx);
-		return ENOMEM;
-	}
-
-	term->ucols = cols;
-	term->urows = rows;
-	term->ubuf = buf;
-
-	/* Scroll back to active screen. */
-	termui_history_scroll(term->termui, INT_MAX);
-
-	fibril_mutex_unlock(&term->mtx);
-
-	*rbuf = buf;
-	return EOK;
-}
-
-/** Delete shared buffer.
- *
- * @param srv Console server
- */
-static void term_unmap(con_srv_t *srv)
-{
-	terminal_t *term = srv_to_terminal(srv);
-	void *buf;
-
-	fibril_mutex_lock(&term->mtx);
-
-	buf = term->ubuf;
-	term->ubuf = NULL;
-
-	termui_wipe_screen(term->termui, 0);
-
-	fibril_mutex_unlock(&term->mtx);
-
-	/* Update terminal */
-	term_render(term);
-	gfx_update(term->gc);
-
-	if (buf != NULL)
-		as_area_destroy(buf);
-}
-
-/** Update area of terminal from shared buffer.
- *
- * @param srv Console server
- * @param c0 Column coordinate of top-left corner (inclusive)
- * @param r0 Row coordinate of top-left corner (inclusive)
- * @param c1 Column coordinate of bottom-right corner (exclusive)
- * @param r1 Row coordinate of bottom-right corner (exclusive)
- */
-static void term_buf_update(con_srv_t *srv, sysarg_t c0, sysarg_t r0,
-    sysarg_t c1, sysarg_t r1)
-{
-	terminal_t *term = srv_to_terminal(srv);
-
-	fibril_mutex_lock(&term->mtx);
-
-	if (term->ubuf == NULL) {
-		fibril_mutex_unlock(&term->mtx);
-		return;
-	}
-
-	/* Make sure we have meaningful coordinates, within bounds */
-	c1 = min(c1, term->ucols);
-	c1 = min(c1, (sysarg_t) termui_get_cols(term->termui));
-	r1 = min(r1, term->urows);
-	r1 = min(r1, (sysarg_t) termui_get_rows(term->termui));
-
-	if (c0 >= c1 || r0 >= r1) {
-		fibril_mutex_unlock(&term->mtx);
-		return;
-	}
-
-	/* Update front buffer from user buffer */
-
-	for (sysarg_t row = r0; row < r1; row++) {
-		termui_cell_t *cells = termui_get_active_row(term->termui, row);
-
-		for (sysarg_t col = c0; col < c1; col++) {
-			cells[col] = charfield_to_termui_cell(term, &term->ubuf[row * term->ucols + col]);
-		}
-
-		termui_update_cb(term, c0, row, &cells[c0], c1 - c0);
-	}
-
-	fibril_mutex_unlock(&term->mtx);
-
-	/* Update terminal */
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static errno_t terminal_window_resize(terminal_t *term)
-{
-	gfx_rect_t rect;
-	ui_window_get_app_rect(term->window, &rect);
-
-	int width = rect.p1.x - rect.p0.x;
-	int height = rect.p1.y - rect.p0.y;
-
-	if (!term->gc)
-		term->gc = ui_window_get_gc(term->window);
-	else
-		assert(term->gc == ui_window_get_gc(term->window));
-
-	if (!term->ui_res)
-		term->ui_res = ui_window_get_res(term->window);
-	else
-		assert(term->ui_res == ui_window_get_res(term->window));
-
-	gfx_bitmap_t *new_bmp;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = width;
-	params.rect.p1.y = height;
-
-	errno_t rc = gfx_bitmap_create(term->gc, &params, NULL, &new_bmp);
-	if (rc != EOK) {
-		fprintf(stderr, "Error allocating new screen bitmap: %s\n", str_error(rc));
-		return rc;
-	}
-
-	if (term->bmp) {
-		rc = gfx_bitmap_destroy(term->bmp);
-		if (rc != EOK)
-			fprintf(stderr, "Error deallocating old screen bitmap: %s\n", str_error(rc));
-	}
-
-	term->bmp = new_bmp;
-	term->w = width;
-	term->h = height;
-
-	term_clear_bitmap(term, termui_color_to_pixel(term->default_bgcolor));
-
-	return EOK;
-}
-
-void terminal_destroy(terminal_t *term)
-{
-	list_remove(&term->link);
-
-	termui_destroy(term->termui);
-
-	if (term->ubuf)
-		as_area_destroy(term->ubuf);
-
-	ui_destroy(term->ui);
-	free(term);
-}
-
-static void terminal_queue_cons_event(terminal_t *term, cons_event_t *ev)
-{
-	/* Got key press/release event */
-	terminal_event_t *event =
-	    (terminal_event_t *) malloc(sizeof(terminal_event_t));
-	if (event == NULL)
-		return;
-
-	event->ev = *ev;
-	link_initialize(&event->link);
-
-	prodcons_produce(&term->input_pc, &event->link);
-}
-
-/** Handle window close event. */
-static void terminal_close_event(ui_window_t *window, void *arg)
-{
-	terminal_t *term = (terminal_t *) arg;
-
-	ui_quit(term->ui);
-}
-
-/** Handle window focus event. */
-static void terminal_focus_event(ui_window_t *window, void *arg,
-    unsigned nfocus)
-{
-	terminal_t *term = (terminal_t *) arg;
-
-	(void)nfocus;
-	term->is_focused = true;
-	term_render(term);
-	gfx_update(term->gc);
-}
-
-static void terminal_resize_handler(ui_window_t *window, void *arg)
-{
-	terminal_t *term = (terminal_t *) arg;
-
-	fibril_mutex_lock(&term->mtx);
-
-	errno_t rc = terminal_window_resize(term);
-	if (rc == EOK) {
-		(void) termui_resize(term->termui, term->w / FONT_WIDTH, term->h / FONT_SCANLINES, SCROLLBACK_MAX_LINES);
-		termui_refresh_cb(term);
-		term_render(term);
-		gfx_update(term->gc);
-
-		cons_event_t event = { .type = CEV_RESIZE };
-		terminal_queue_cons_event(term, &event);
-	}
-
-	fibril_mutex_unlock(&term->mtx);
-}
-
-static void terminal_resize_event(ui_window_t *window, void *arg)
-{
-	ui_window_def_resize(window);
-	terminal_resize_handler(window, arg);
-}
-
-static void terminal_maximize_event(ui_window_t *window, void *arg)
-{
-	ui_window_def_maximize(window);
-	terminal_resize_handler(window, arg);
-}
-
-static void terminal_unmaximize_event(ui_window_t *window, void *arg)
-{
-	ui_window_def_unmaximize(window);
-	terminal_resize_handler(window, arg);
-}
-
-/** Handle window keyboard event */
-static void terminal_kbd_event(ui_window_t *window, void *arg,
-    kbd_event_t *kbd_event)
-{
-	terminal_t *term = (terminal_t *) arg;
-	cons_event_t event;
-
-	event.type = CEV_KEY;
-	event.ev.key = *kbd_event;
-
-	const int PAGE_ROWS = (termui_get_rows(term->termui) * 2) / 3;
-
-	fibril_mutex_lock(&term->mtx);
-
-	if (!term->ubuf && kbd_event->type == KEY_PRESS &&
-	    (kbd_event->key == KC_PAGE_UP || kbd_event->key == KC_PAGE_DOWN)) {
-
-		termui_history_scroll(term->termui,
-		    (kbd_event->key == KC_PAGE_UP) ? -PAGE_ROWS : PAGE_ROWS);
-
-		term_render(term);
-		gfx_update(term->gc);
-	} else {
-		terminal_queue_cons_event(term, &event);
-	}
-
-	fibril_mutex_unlock(&term->mtx);
-}
-
-/** Handle window position event */
-static void terminal_pos_event(ui_window_t *window, void *arg, pos_event_t *event)
-{
-	cons_event_t cevent;
-	terminal_t *term = (terminal_t *) arg;
-
-	switch (event->type) {
-	case POS_UPDATE:
-		return;
-
-	case POS_PRESS:
-	case POS_RELEASE:
-	case POS_DCLICK:
-	}
-
-	/* Ignore mouse events when we're in scrollback mode. */
-	if (termui_scrollback_is_active(term->termui))
-		return;
-
-	sysarg_t sx = term->off.x;
-	sysarg_t sy = term->off.y;
-
-	if (event->hpos < sx || event->vpos < sy)
-		return;
-
-	cevent.type = CEV_POS;
-	cevent.ev.pos.type = event->type;
-	cevent.ev.pos.pos_id = event->pos_id;
-	cevent.ev.pos.btn_num = event->btn_num;
-
-	cevent.ev.pos.hpos = (event->hpos - sx) / FONT_WIDTH;
-	cevent.ev.pos.vpos = (event->vpos - sy) / FONT_SCANLINES;
-
-	/* Filter out events outside the terminal area. */
-	int cols = termui_get_cols(term->termui);
-	int rows = termui_get_rows(term->termui);
-
-	if (cevent.ev.pos.hpos < (sysarg_t) cols && cevent.ev.pos.vpos < (sysarg_t) rows)
-		terminal_queue_cons_event(term, &cevent);
-}
-
-/** Handle window unfocus event. */
-static void terminal_unfocus_event(ui_window_t *window, void *arg,
-    unsigned nfocus)
-{
-	terminal_t *term = (terminal_t *) arg;
-
-	if (nfocus == 0) {
-		term->is_focused = false;
-		term_render(term);
-		gfx_update(term->gc);
-	}
-}
-
-static void term_connection(ipc_call_t *icall, void *arg)
-{
-	terminal_t *term = NULL;
-
-	list_foreach(terms, link, terminal_t, cur) {
-		if (cur->dsid == (service_id_t) ipc_get_arg2(icall)) {
-			term = cur;
-			break;
-		}
-	}
-
-	if (term == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (!atomic_flag_test_and_set(&term->refcnt))
-		termui_set_cursor_visibility(term->termui, true);
-
-	con_conn(icall, &term->srvs);
-}
-
-static errno_t term_init_window(terminal_t *term, const char *display_spec,
-    gfx_coord_t width, gfx_coord_t height,
-    gfx_coord_t min_width, gfx_coord_t min_height,
-    terminal_flags_t flags)
-{
-	gfx_rect_t min_rect = { { 0, 0 }, { min_width, min_height } };
-	gfx_rect_t wmin_rect;
-	gfx_rect_t wrect;
-
-	errno_t rc = ui_create(display_spec, &term->ui);
-	if (rc != EOK) {
-		printf("Error creating UI on %s.\n", display_spec);
-		return rc;
-	}
-
-	ui_wnd_params_t wparams;
-	ui_wnd_params_init(&wparams);
-	wparams.caption = "Terminal";
-	wparams.style |= ui_wds_maximize_btn | ui_wds_resizable;
-
-	if ((flags & tf_topleft) != 0)
-		wparams.placement = ui_wnd_place_top_left;
-
-	if (ui_is_fullscreen(term->ui)) {
-		wparams.placement = ui_wnd_place_full_screen;
-		wparams.style &= ~ui_wds_decorated;
-	}
-
-	/* Compute wrect such that application area corresponds to rect. */
-	ui_wdecor_rect_from_app(term->ui, wparams.style, &min_rect, &wrect);
-	gfx_rect_rtranslate(&wrect.p0, &wrect, &wmin_rect);
-	wparams.min_size = wmin_rect.p1;
-
-	gfx_rect_t rect = { { 0, 0 }, { width, height } };
-	ui_wdecor_rect_from_app(term->ui, wparams.style, &rect, &rect);
-	term->off.x = -rect.p0.x;
-	term->off.y = -rect.p0.y;
-	printf("off=%d,%d\n", term->off.x, term->off.y);
-	gfx_rect_translate(&term->off, &rect, &wparams.rect);
-	printf("wparams.rect=%d,%d,%d,%d\n",
-	    wparams.rect.p0.x,
-	    wparams.rect.p1.x,
-	    wparams.rect.p0.y,
-	    wparams.rect.p1.y);
-
-	rc = ui_window_create(term->ui, &wparams, &term->window);
-	if (rc != EOK)
-		return rc;
-
-	ui_window_set_cb(term->window, &terminal_window_cb, (void *) term);
-	return terminal_window_resize(term);
-}
-
-errno_t terminal_create(const char *display_spec, sysarg_t width,
-    sysarg_t height, terminal_flags_t flags, const char *command,
-    terminal_t **rterm)
-{
-	errno_t rc;
-
-	terminal_t *term = calloc(1, sizeof(terminal_t));
-	if (term == NULL) {
-		printf("Out of memory.\n");
-		return ENOMEM;
-	}
-
-	link_initialize(&term->link);
-	fibril_mutex_initialize(&term->mtx);
-	atomic_flag_clear(&term->refcnt);
-
-	prodcons_initialize(&term->input_pc);
-	term->char_remains_len = 0;
-
-	term->default_bgcolor = termui_color_from_pixel(_basic_colors[COLOR_WHITE | COLOR_BRIGHT]);
-	term->default_fgcolor = termui_color_from_pixel(_basic_colors[COLOR_BLACK]);
-
-	term->emphasis_bgcolor = termui_color_from_pixel(_basic_colors[COLOR_WHITE | COLOR_BRIGHT]);
-	term->emphasis_fgcolor = termui_color_from_pixel(_basic_colors[COLOR_RED | COLOR_BRIGHT]);
-
-	term->selection_bgcolor = termui_color_from_pixel(_basic_colors[COLOR_RED | COLOR_BRIGHT]);
-	term->selection_fgcolor = termui_color_from_pixel(_basic_colors[COLOR_WHITE | COLOR_BRIGHT]);
-
-	rc = term_init_window(term, display_spec, width, height,
-	    MIN_WINDOW_COLS * FONT_WIDTH, MIN_WINDOW_ROWS * FONT_SCANLINES, flags);
-	if (rc != EOK) {
-		printf("Error creating window (%s).\n", str_error(rc));
-		goto error;
-	}
-
-	term->termui = termui_create(term->w / FONT_WIDTH,
-	    term->h / FONT_SCANLINES, SCROLLBACK_MAX_LINES);
-	if (!term->termui) {
-		printf("Error creating terminal UI.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	termui_set_refresh_cb(term->termui, termui_refresh_cb, term);
-	termui_set_scroll_cb(term->termui, termui_scroll_cb, term);
-	termui_set_update_cb(term->termui, termui_update_cb, term);
-
-	async_set_fallback_port_handler(term_connection, NULL);
-	con_srvs_init(&term->srvs);
-	term->srvs.ops = &con_ops;
-	term->srvs.sarg = term;
-
-	rc = loc_server_register(NAME, &term->srv);
-	if (rc != EOK) {
-		printf("Error registering server.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	char vc[LOC_NAME_MAXLEN + 1];
-	snprintf(vc, LOC_NAME_MAXLEN, "%s/%" PRIu64, NAMESPACE,
-	    task_get_id());
-
-	rc = loc_service_register(term->srv, vc, &term->dsid);
-	if (rc != EOK) {
-		printf("Error registering service.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	list_append(&term->link, &terms);
-	rc = getterm(&term->wait, vc, command);
-	if (rc != EOK)
-		goto error;
-
-	term->wfid = fibril_create(terminal_wait_fibril, term);
-	if (term->wfid == 0)
-		goto error;
-
-	fibril_add_ready(term->wfid);
-
-	term->is_focused = true;
-
-	termui_refresh_cb(term);
-
-	*rterm = term;
-	return EOK;
-error:
-	if (term->dsid != 0)
-		loc_service_unregister(term->srv, term->dsid);
-	if (term->srv != NULL)
-		loc_server_unregister(term->srv);
-	if (term->window != NULL)
-		ui_window_destroy(term->window);
-	if (term->ui != NULL)
-		ui_destroy(term->ui);
-	if (term->termui != NULL)
-		termui_destroy(term->termui);
-	free(term);
-	return rc;
-}
-
-static errno_t terminal_wait_fibril(void *arg)
-{
-	terminal_t *term = (terminal_t *)arg;
-	task_exit_t texit;
-	int retval;
-
-	/*
-	 * XXX There is no way to break the sleep if the task does not
-	 * exit.
-	 */
-	(void) task_wait(&term->wait, &texit, &retval);
-	ui_quit(term->ui);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/terminal/terminal.h
===================================================================
--- uspace/app/terminal/terminal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup terminal
- * @{
- */
-/**
- * @file
- */
-
-#ifndef TERMINAL_H
-#define TERMINAL_H
-
-#include <adt/prodcons.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/con_srv.h>
-#include <io/cons_event.h>
-#include <loc.h>
-#include <stdatomic.h>
-#include <str.h>
-#include <task.h>
-#include <termui.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-#define UTF8_CHAR_BUFFER_SIZE  (STR_BOUNDS(1) + 1)
-
-typedef enum {
-	tf_topleft = 1
-} terminal_flags_t;
-
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_resource_t *ui_res;
-	gfx_context_t *gc;
-
-	gfx_bitmap_t *bmp;
-	sysarg_t w;
-	sysarg_t h;
-	gfx_rect_t update;
-	gfx_coord2_t off;
-	bool is_focused;
-
-	fibril_mutex_t mtx;
-	link_t link;
-	atomic_flag refcnt;
-
-	prodcons_t input_pc;
-	char char_remains[UTF8_CHAR_BUFFER_SIZE];
-	size_t char_remains_len;
-
-	termui_t *termui;
-
-	termui_color_t default_bgcolor;
-	termui_color_t default_fgcolor;
-	termui_color_t emphasis_bgcolor;
-	termui_color_t emphasis_fgcolor;
-	termui_color_t selection_bgcolor;
-	termui_color_t selection_fgcolor;
-
-	sysarg_t ucols;
-	sysarg_t urows;
-	charfield_t *ubuf;
-
-	loc_srv_t *srv;
-	service_id_t dsid;
-	con_srvs_t srvs;
-
-	task_wait_t wait;
-	fid_t wfid;
-} terminal_t;
-
-/** Terminal event */
-typedef struct {
-	/** Link to list of events */
-	link_t link;
-	/** Console event */
-	cons_event_t ev;
-} terminal_event_t;
-
-extern errno_t terminal_create(const char *, sysarg_t, sysarg_t,
-    terminal_flags_t, const char *, terminal_t **);
-extern void terminal_destroy(terminal_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/tester/chardev/chardev1.c
===================================================================
--- uspace/app/tester/chardev/chardev1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <ipc/services.h>
-#include <io/chardev.h>
-#include <loc.h>
-#include "../tester.h"
-
-#define SMALL_BUFFER_SIZE 64
-#define LARGE_BUFFER_SIZE (DATA_XFER_LIMIT * 4)
-
-static char small_buffer[SMALL_BUFFER_SIZE];
-static char large_buffer[LARGE_BUFFER_SIZE];
-
-/** Test device that always performs small transfers. */
-static const char *test_chardev1_smallx(void)
-{
-	chardev_t *chardev;
-	service_id_t sid;
-	async_sess_t *sess;
-	size_t nbytes;
-	errno_t rc;
-
-	TPRINTF("Test small transfer character device operations\n");
-
-	rc = loc_service_get_id(SERVICE_NAME_CHARDEV_TEST_SMALLX, &sid, 0);
-	if (rc != EOK) {
-		return "Failed resolving test device "
-		    SERVICE_NAME_CHARDEV_TEST_SMALLX;
-	}
-
-	sess = loc_service_connect(sid, INTERFACE_DDF, 0);
-	if (sess == NULL)
-		return "Failed connecting test device";
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return "Failed opening test device";
-	}
-
-	rc = chardev_write(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes);
-	if (rc != EOK) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed sending data";
-	}
-
-	TPRINTF("Sent %zu bytes\n", nbytes);
-
-	rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes,
-	    chardev_f_none);
-	if (rc != EOK) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed receiving data";
-	}
-
-	TPRINTF("Received %zu bytes\n", nbytes);
-
-	chardev_close(chardev);
-	async_hangup(sess);
-
-	TPRINTF("Done\n");
-	return NULL;
-}
-
-/** Test device that always performs large transfers. */
-static const char *test_chardev1_largex(void)
-{
-	chardev_t *chardev;
-	service_id_t sid;
-	async_sess_t *sess;
-	size_t nbytes;
-	errno_t rc;
-
-	TPRINTF("Test large transfer character device operations\n");
-
-	rc = loc_service_get_id(SERVICE_NAME_CHARDEV_TEST_LARGEX, &sid, 0);
-	if (rc != EOK) {
-		return "Failed resolving test device "
-		    SERVICE_NAME_CHARDEV_TEST_LARGEX;
-	}
-
-	sess = loc_service_connect(sid, INTERFACE_DDF, 0);
-	if (sess == NULL)
-		return "Failed connecting test device";
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return "Failed opening test device";
-	}
-
-	rc = chardev_write(chardev, large_buffer, LARGE_BUFFER_SIZE, &nbytes);
-	if (rc != EOK) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed sending data";
-	}
-
-	TPRINTF("Sent %zu bytes\n", nbytes);
-
-	rc = chardev_read(chardev, large_buffer, LARGE_BUFFER_SIZE, &nbytes,
-	    chardev_f_none);
-	if (rc != EOK) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed receiving data";
-	}
-
-	TPRINTF("Received %zu bytes\n", nbytes);
-
-	chardev_close(chardev);
-	async_hangup(sess);
-
-	TPRINTF("Done\n");
-	return NULL;
-}
-
-/** Test device where all transfers return partial success. */
-static const char *test_chardev1_partialx(void)
-{
-	chardev_t *chardev;
-	service_id_t sid;
-	async_sess_t *sess;
-	size_t nbytes;
-	errno_t rc;
-
-	TPRINTF("Test partially-successful character device operations\n");
-
-	rc = loc_service_get_id(SERVICE_NAME_CHARDEV_TEST_PARTIALX, &sid, 0);
-	if (rc != EOK) {
-		return "Failed resolving test device "
-		    SERVICE_NAME_CHARDEV_TEST_SMALLX;
-	}
-
-	sess = loc_service_connect(sid, INTERFACE_DDF, 0);
-	if (sess == NULL)
-		return "Failed connecting test device";
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return "Failed opening test device";
-	}
-
-	rc = chardev_write(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes);
-	if (rc != EIO || nbytes != 1) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed sending data";
-	}
-
-	TPRINTF("Sent %zu bytes and got rc = %s (expected)\n", nbytes,
-	    str_error_name(rc));
-
-	rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes,
-	    chardev_f_none);
-	if (rc != EIO || nbytes != 1) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed receiving data";
-	}
-
-	TPRINTF("Received %zu bytes and got rc = %s (expected)\n", nbytes,
-	    str_error_name(rc));
-
-	chardev_close(chardev);
-	async_hangup(sess);
-
-	TPRINTF("Done\n");
-	return NULL;
-}
-
-const char *test_chardev1(void)
-{
-	const char *s;
-
-	s = test_chardev1_smallx();
-	if (s != NULL)
-		return s;
-
-	s = test_chardev1_largex();
-	if (s != NULL)
-		return s;
-
-	return test_chardev1_partialx();
-}
Index: pace/app/tester/chardev/chardev1.def
===================================================================
--- uspace/app/tester/chardev/chardev1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"chardev1",
-	"Character device basic functionality",
-	&test_chardev1,
-	false
-},
Index: pace/app/tester/console/console1.c
===================================================================
--- uspace/app/tester/console/console1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <io/console.h>
-#include <io/color.h>
-#include <io/style.h>
-#include <vfs/vfs.h>
-#include <async.h>
-#include "../tester.h"
-
-static const char *color_name[] = {
-	[COLOR_BLACK] = "black",
-	[COLOR_BLUE] = "blue",
-	[COLOR_GREEN] = "green",
-	[COLOR_CYAN] = "cyan",
-	[COLOR_RED] = "red",
-	[COLOR_MAGENTA] = "magenta",
-	[COLOR_YELLOW] = "yellow",
-	[COLOR_WHITE] = "white"
-};
-
-const char *test_console1(void)
-{
-	if (!test_quiet) {
-		console_ctrl_t *console = console_init(stdin, stdout);
-
-		printf("Style test: ");
-		console_flush(console);
-		console_set_style(console, STYLE_NORMAL);
-		printf(" normal ");
-		console_flush(console);
-		console_set_style(console, STYLE_EMPHASIS);
-		printf(" emphasized ");
-		console_flush(console);
-		console_set_style(console, STYLE_INVERTED);
-		printf(" inverted ");
-		console_flush(console);
-		console_set_style(console, STYLE_SELECTED);
-		printf(" selected ");
-		console_flush(console);
-		console_set_style(console, STYLE_NORMAL);
-		printf("\n");
-
-		unsigned int i;
-		unsigned int j;
-
-		printf("\nForeground color test:\n");
-		for (j = 0; j < 2; j++) {
-			for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
-				console_flush(console);
-				console_set_color(console, COLOR_WHITE, i,
-				    j ? CATTR_BRIGHT : 0);
-				printf(" %s ", color_name[i]);
-			}
-			console_flush(console);
-			console_set_style(console, STYLE_NORMAL);
-			putchar('\n');
-		}
-
-		printf("\nBackground color test:\n");
-		for (j = 0; j < 2; j++) {
-			for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
-				console_flush(console);
-				console_set_color(console, i, COLOR_WHITE,
-				    j ? CATTR_BRIGHT : 0);
-				printf(" %s ", color_name[i]);
-			}
-			console_flush(console);
-			console_set_style(console, STYLE_NORMAL);
-			putchar('\n');
-		}
-
-		printf("\nRGB colors test:\n");
-
-		for (i = 0; i < 255; i += 16) {
-			console_flush(console);
-			console_set_rgb_color(console, i << 16, (255 - i) << 16);
-			putchar('X');
-		}
-		console_flush(console);
-		console_set_style(console, STYLE_NORMAL);
-		putchar('\n');
-
-		for (i = 0; i < 255; i += 16) {
-			console_flush(console);
-			console_set_rgb_color(console, i << 8, (255 - i) << 8);
-			putchar('X');
-		}
-		console_flush(console);
-		console_set_style(console, STYLE_NORMAL);
-		putchar('\n');
-
-		for (i = 0; i < 255; i += 16) {
-			console_flush(console);
-			console_set_rgb_color(console, i, 255 - i);
-			putchar('X');
-		}
-		console_flush(console);
-		console_set_style(console, STYLE_NORMAL);
-		putchar('\n');
-	}
-
-	return NULL;
-}
Index: pace/app/tester/console/console1.def
===================================================================
--- uspace/app/tester/console/console1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"console1",
-	"Console color test",
-	&test_console1,
-	true
-},
Index: pace/app/tester/doc/doxygroups.h
===================================================================
--- uspace/app/tester/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup tester tester
- * @brief User space tester
- * @ingroup apps
- */
Index: pace/app/tester/fault/fault1.c
===================================================================
--- uspace/app/tester/fault/fault1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "../tester.h"
-
-#pragma GCC diagnostic ignored "-Warray-bounds"
-
-const char *test_fault1(void)
-{
-	((int *)(0))[1] = 0;
-
-	return "Survived write to NULL";
-}
Index: pace/app/tester/fault/fault1.def
===================================================================
--- uspace/app/tester/fault/fault1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"fault1",
-	"Write to NULL",
-	&test_fault1,
-	false
-},
Index: pace/app/tester/fault/fault2.c
===================================================================
--- uspace/app/tester/fault/fault2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "../tester.h"
-#include <stdio.h>
-
-typedef int __attribute__((may_alias)) aliasing_int;
-
-const char *test_fault2(void)
-{
-	volatile long long var = 0;
-	volatile int var1 = *((aliasing_int *) (((char *) (&var)) + 1));
-	printf("Read %d\n", var1);
-
-	return "Survived unaligned read";
-}
Index: pace/app/tester/fault/fault2.def
===================================================================
--- uspace/app/tester/fault/fault2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"fault2",
-	"Unaligned read",
-	&test_fault2,
-	false
-},
Index: pace/app/tester/fault/fault3.c
===================================================================
--- uspace/app/tester/fault/fault3.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "../tester.h"
-#include <stdlib.h>
-
-const char *test_fault3(void)
-{
-	abort();
-}
Index: pace/app/tester/fault/fault3.def
===================================================================
--- uspace/app/tester/fault/fault3.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"fault3",
-	"Abort",
-	&test_fault3,
-	false
-},
Index: pace/app/tester/float/float1.c
===================================================================
--- uspace/app/tester/float/float1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdatomic.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <inttypes.h>
-#include "../tester.h"
-
-#define THREADS   150
-#define ATTEMPTS  100
-
-#define E_10E8     UINT32_C(271828182)
-#define PRECISION  100000000
-
-static FIBRIL_SEMAPHORE_INITIALIZE(threads_finished, 0);
-static atomic_int threads_fault;
-
-static errno_t e(void *data)
-{
-	for (unsigned int i = 0; i < ATTEMPTS; i++) {
-		double le = -1;
-		double e = 0;
-		double f = 1;
-
-		for (double d = 1; e != le; d *= f, f += 1) {
-			le = e;
-			e = e + 1 / d;
-		}
-
-		if ((uint32_t) (e * PRECISION) != E_10E8) {
-			atomic_fetch_add(&threads_fault, 1);
-			break;
-		}
-	}
-
-	fibril_semaphore_up(&threads_finished);
-	return EOK;
-}
-
-const char *test_float1(void)
-{
-	int total = 0;
-
-	atomic_store(&threads_fault, 0);
-	fibril_test_spawn_runners(THREADS);
-
-	TPRINTF("Creating threads");
-	for (unsigned int i = 0; i < THREADS; i++) {
-		fid_t f = fibril_create(e, NULL);
-		if (!f) {
-			TPRINTF("\nCould not create thread %u\n", i);
-			break;
-		}
-		fibril_detach(f);
-		fibril_add_ready(f);
-
-		TPRINTF(".");
-		total++;
-	}
-
-	TPRINTF("\n");
-
-	for (int i = 0; i < total; i++) {
-		TPRINTF("Threads left: %d\n", total - i);
-		fibril_semaphore_down(&threads_finished);
-	}
-
-	if (atomic_load(&threads_fault) == 0)
-		return NULL;
-
-	return "Test failed";
-}
Index: pace/app/tester/float/float1.def
===================================================================
--- uspace/app/tester/float/float1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"float1",
-	"Floating point computation",
-	&test_float1,
-	true
-},
Index: pace/app/tester/float/float2.c
===================================================================
--- uspace/app/tester/float/float2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <math.h>
-#include "../tester.h"
-
-#define OPERANDS         10
-#define PRECISIONF    10000
-#define PRECISION 100000000
-
-static double arguments[OPERANDS] = {
-	3.5, -2.1, 100.0, 50.0, -1024.0, 0.0, 768.3156, 1080.499999, -600.0, 1.0
-};
-
-static double results_cos[OPERANDS] = {
-	-0.936456687291, -0.504846104600, 0.862318872288, 0.964966028492,
-	0.987353618220, 1.0, -0.194939922623, 0.978471923925, -0.999023478833,
-	0.540302305868
-};
-
-static double results_sin[OPERANDS] = {
-	-0.350783227690, -0.863209366649, -0.506365641110, -0.262374853704,
-	0.158533380044, 0.0, 0.980815184715, -0.206379975025, -0.044182448332,
-	0.841470984808
-};
-
-static double results_trunc[OPERANDS] = {
-	3.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0
-};
-
-static bool cmp_float(float a, float b)
-{
-	float r;
-
-	/* XXX Need fabsf() */
-	if (b < 1.0 / PRECISIONF && b > -1.0 / PRECISIONF)
-		r = a;
-	else
-		r = a / b - 1.0;
-
-	/* XXX Need fabsf() */
-	if (r < 0.0)
-		r = -r;
-
-	return r < 1.0 / PRECISIONF;
-}
-
-static bool cmp_double(double a, double b)
-{
-	double r;
-
-	/* XXX Need fabs() */
-	if (b < 1.0 / PRECISION && b > -1.0 / PRECISION)
-		r = a;
-	else
-		r = a / b - 1.0;
-
-	/* XXX Need fabs() */
-	if (r < 0.0)
-		r = -r;
-
-	return r < 1.0 / PRECISION;
-}
-
-const char *test_float2(void)
-{
-	bool fail = false;
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		double res = cos(arguments[i]);
-
-		if (!cmp_double(res, results_cos[i])) {
-			TPRINTF("Double precision cos failed "
-			    "(%lf != %lf, arg %u)\n", res, results_cos[i], i);
-			fail = true;
-		}
-	}
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		float res = cosf(arguments[i]);
-
-		if (!cmp_float(res, results_cos[i])) {
-			TPRINTF("Single precision cos failed "
-			    "(%f != %lf, arg %u)\n", res, results_cos[i], i);
-			fail = true;
-		}
-	}
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		double res = sin(arguments[i]);
-
-		if (!cmp_double(res, results_sin[i])) {
-			TPRINTF("Double precision sin failed "
-			    "(%lf != %lf, arg %u)\n", res, results_sin[i], i);
-			fail = true;
-		}
-	}
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		float res = sinf(arguments[i]);
-
-		if (!cmp_float(res, results_sin[i])) {
-			TPRINTF("Single precision sin failed "
-			    "(%f != %lf, arg %u)\n", res, results_sin[i], i);
-			fail = true;
-		}
-	}
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		double res = trunc(arguments[i]);
-
-		if (!cmp_double(res, results_trunc[i])) {
-			TPRINTF("Double precision trunc failed "
-			    "(%lf != %lf, arg %u)\n", res, results_trunc[i], i);
-			fail = true;
-		}
-	}
-
-	for (unsigned int i = 0; i < OPERANDS; i++) {
-		float res = truncf(arguments[i]);
-
-		if (!cmp_float(res, results_trunc[i])) {
-			TPRINTF("Single precision trunc failed "
-			    "(%f != %lf, arg %u)\n", res, results_trunc[i], i);
-			fail = true;
-		}
-	}
-
-	if (fail)
-		return "Floating point imprecision";
-
-	return NULL;
-}
Index: pace/app/tester/float/float2.def
===================================================================
--- uspace/app/tester/float/float2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"float2",
-	"Floating arithmetics",
-	&test_float2,
-	true
-},
Index: pace/app/tester/hw/serial/serial1.c
===================================================================
--- uspace/app/tester/hw/serial/serial1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,222 +1,0 @@
-/*
- * Copyright (c) 2009 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/**
- * @file
- * @brief Test the serial port driver - loopback test
- */
-
-#include <async.h>
-#include <errno.h>
-#include <io/chardev.h>
-#include <io/serial.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-#include "../../tester.h"
-
-#define DEFAULT_COUNT  1024
-#define DEFAULT_SLEEP  100000
-#define EOT            "####> End of transfer <####\n"
-
-const char *test_serial1(void)
-{
-	size_t cnt;
-	serial_t *serial;
-	chardev_t *chardev;
-	errno_t rc;
-	size_t nread;
-	size_t nwritten;
-
-	if (test_argc < 1)
-		cnt = DEFAULT_COUNT;
-	else
-		switch (str_size_t(test_argv[0], NULL, 0, true, &cnt)) {
-		case EOK:
-			break;
-		case EINVAL:
-			return "Invalid argument, unsigned integer expected";
-		case EOVERFLOW:
-			return "Argument size overflow";
-		default:
-			return "Unexpected argument error";
-		}
-
-	service_id_t svc_id;
-	errno_t res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a",
-	    &svc_id, IPC_FLAG_BLOCKING);
-	if (res != EOK)
-		return "Failed getting serial port service ID";
-
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
-	    IPC_FLAG_BLOCKING);
-	if (sess == NULL)
-		return "Failed connecting to serial device";
-
-	res = chardev_open(sess, &chardev);
-	if (res != EOK) {
-		async_hangup(sess);
-		return "Failed opening serial port";
-	}
-
-	res = serial_open(sess, &serial);
-	if (res != EOK) {
-		chardev_close(chardev);
-		async_hangup(sess);
-		return "Failed opening serial port";
-	}
-
-	char *buf = (char *) malloc(cnt + 1);
-	if (buf == NULL) {
-		chardev_close(chardev);
-		serial_close(serial);
-		async_hangup(sess);
-		return "Failed allocating input buffer";
-	}
-
-	unsigned old_baud;
-	serial_parity_t old_par;
-	unsigned old_stop;
-	unsigned old_word_size;
-
-	res = serial_get_comm_props(serial, &old_baud, &old_par,
-	    &old_word_size, &old_stop);
-	if (res != EOK) {
-		free(buf);
-		chardev_close(chardev);
-		serial_close(serial);
-		async_hangup(sess);
-		return "Failed to get old serial communication parameters";
-	}
-
-	res = serial_set_comm_props(serial, 1200, SERIAL_NO_PARITY, 8, 1);
-	if (EOK != res) {
-		free(buf);
-		chardev_close(chardev);
-		serial_close(serial);
-		async_hangup(sess);
-		return "Failed setting serial communication parameters";
-	}
-
-	TPRINTF("Trying reading %zu characters from serial device "
-	    "(svc_id=%" PRIun ")\n", cnt, svc_id);
-
-	size_t total = 0;
-	while (total < cnt) {
-
-		rc = chardev_read(chardev, buf, cnt - total, &nread,
-		    chardev_f_none);
-		if (rc != EOK) {
-			(void) serial_set_comm_props(serial, old_baud,
-			    old_par, old_word_size, old_stop);
-
-			free(buf);
-			chardev_close(chardev);
-			serial_close(serial);
-			async_hangup(sess);
-			return "Failed reading from serial device";
-		}
-
-		if (nread > cnt - total) {
-			(void) serial_set_comm_props(serial, old_baud,
-			    old_par, old_word_size, old_stop);
-
-			free(buf);
-			chardev_close(chardev);
-			serial_close(serial);
-			async_hangup(sess);
-			return "Read more data than expected";
-		}
-
-		TPRINTF("Read %zd bytes\n", nread);
-
-		buf[nread] = 0;
-
-		/*
-		 * Write data back to the device to test the opposite
-		 * direction of data transfer.
-		 */
-		rc = chardev_write(chardev, buf, nread, &nwritten);
-		if (rc != EOK) {
-			(void) serial_set_comm_props(serial, old_baud,
-			    old_par, old_word_size, old_stop);
-
-			free(buf);
-			chardev_close(chardev);
-			serial_close(serial);
-			async_hangup(sess);
-			return "Failed writing to serial device";
-		}
-
-		if (nwritten != nread) {
-			(void) serial_set_comm_props(serial, old_baud,
-			    old_par, old_word_size, old_stop);
-
-			free(buf);
-			chardev_close(chardev);
-			serial_close(serial);
-			async_hangup(sess);
-			return "Written less data than read from serial device";
-		}
-
-		TPRINTF("Written %zd bytes\n", nwritten);
-
-		total += nread;
-	}
-
-	TPRINTF("Trying to write EOT banner to the serial device\n");
-
-	size_t eot_size = str_size(EOT);
-	rc = chardev_write(chardev, (void *) EOT, eot_size, &nwritten);
-
-	(void) serial_set_comm_props(serial, old_baud, old_par, old_word_size,
-	    old_stop);
-
-	free(buf);
-	chardev_close(chardev);
-	serial_close(serial);
-	async_hangup(sess);
-
-	if (rc != EOK)
-		return "Failed to write EOT banner to serial device";
-
-	if (nwritten != eot_size)
-		return "Written less data than the size of the EOT banner "
-		    "to serial device";
-
-	return NULL;
-}
-
-/** @}
- */
Index: pace/app/tester/hw/serial/serial1.def
===================================================================
--- uspace/app/tester/hw/serial/serial1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"serial1",
-	"Serial loopback test",
-	&test_serial1,
-	false
-},
Index: pace/app/tester/ipc/readwrite.c
===================================================================
--- uspace/app/tester/ipc/readwrite.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <as.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ipc_test.h>
-#include "../tester.h"
-
-enum {
-	rw_buf_size = 1024
-};
-
-static uint8_t rw_buf[rw_buf_size];
-
-const char *test_readwrite(void)
-{
-	ipc_test_t *test = NULL;
-	size_t i;
-	errno_t rc;
-
-	rc = ipc_test_create(&test);
-	if (rc != EOK)
-		return "Error contacting IPC test service.";
-
-	rc = ipc_test_set_rw_buf_size(test, rw_buf_size);
-	if (rc != EOK)
-		return "Error getting read-only area size.";
-
-	/*
-	 * Write all zeroes to remote buffer
-	 */
-	memset(rw_buf, 0x00, rw_buf_size);
-	rc = ipc_test_write(test, rw_buf, rw_buf_size);
-	if (rc != EOK)
-		return "Error writing remote buffer.";
-
-	TPRINTF("Successfully wrote zeroes to remote buffer.\n");
-
-	/*
-	 * Read back contents of remote buffer and verify
-	 */
-
-	/*
-	 * Make sure the contents of local buffer are different from what
-	 * we expect to read.
-	 */
-	memset(rw_buf, 0xff, rw_buf_size);
-	rc = ipc_test_read(test, rw_buf, rw_buf_size);
-	if (rc != EOK)
-		return "Error reading remote buffer.";
-
-	TPRINTF("Successfully read back remote buffer.\n");
-
-	/* Now verify what we have read */
-	for (i = 0; i < rw_buf_size; i++) {
-		if (rw_buf[i] != 0x00)
-			return "Failed verification of read data.";
-	}
-
-	TPRINTF("Read data succeeded verification.\n");
-
-	/*
-	 * Write all binary ones to remote buffer
-	 */
-	memset(rw_buf, 0xff, rw_buf_size);
-	rc = ipc_test_write(test, rw_buf, rw_buf_size);
-	if (rc != EOK)
-		return "Error writing remote buffer.";
-
-	TPRINTF("Successfully wrote binary ones to remote buffer.\n");
-
-	/*
-	 * Read back contents of remote buffer and verify
-	 */
-
-	/*
-	 * Make sure the contents of local buffer are different from what
-	 * we expect to read.
-	 */
-	memset(rw_buf, 0x00, rw_buf_size);
-	rc = ipc_test_read(test, rw_buf, rw_buf_size);
-	if (rc != EOK)
-		return "Error reading remote buffer.";
-
-	TPRINTF("Successfully read back remote buffer.\n");
-
-	/* Now verify what we have read */
-	for (i = 0; i < rw_buf_size; i++) {
-		if (rw_buf[i] != 0xff)
-			return "Failed verification of read data.";
-	}
-
-	TPRINTF("Read data succeeded verification.\n");
-
-	ipc_test_destroy(test);
-	return NULL;
-}
Index: pace/app/tester/ipc/readwrite.def
===================================================================
--- uspace/app/tester/ipc/readwrite.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"readwrite",
-	"IPC read/write test",
-	&test_readwrite,
-	true
-},
Index: pace/app/tester/ipc/sharein.c
===================================================================
--- uspace/app/tester/ipc/sharein.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <as.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ipc_test.h>
-#include "../tester.h"
-
-const char *test_sharein(void)
-{
-	ipc_test_t *test = NULL;
-	const void *ro_ptr;
-	size_t ro_size;
-	void *rw_ptr;
-	size_t rw_size;
-	errno_t rc;
-
-	rc = ipc_test_create(&test);
-	if (rc != EOK)
-		return "Error contacting IPC test service.";
-
-	rc = ipc_test_get_ro_area_size(test, &ro_size);
-	if (rc != EOK)
-		return "Error getting read-only area size.";
-
-	rc = ipc_test_share_in_ro(test, ro_size, &ro_ptr);
-	if (rc != EOK)
-		return "Error sharing in area.";
-
-	TPRINTF("Successfully shared in read-only area.\n");
-	TPRINTF("Byte from shared read-only area: 0x%02x\n",
-	    *(const uint8_t *)ro_ptr);
-
-	as_area_destroy((void *)ro_ptr);
-
-	rc = ipc_test_get_rw_area_size(test, &rw_size);
-	if (rc != EOK)
-		return "Error getting read-write area size.";
-
-	rc = ipc_test_share_in_rw(test, rw_size, &rw_ptr);
-	if (rc != EOK)
-		return "Error sharing in area.";
-
-	TPRINTF("Successfully shared in read-write area.\n");
-	TPRINTF("Byte from shared read-write area: 0x%02x\n",
-	    *(uint8_t *)rw_ptr);
-
-	ipc_test_destroy(test);
-	return NULL;
-}
Index: pace/app/tester/ipc/sharein.def
===================================================================
--- uspace/app/tester/ipc/sharein.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"sharein",
-	"IPC share in test",
-	&test_sharein,
-	true
-},
Index: pace/app/tester/ipc/starve.c
===================================================================
--- uspace/app/tester/ipc/starve.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <io/console.h>
-#include <async.h>
-#include "../tester.h"
-
-#define DURATION_SECS      30
-
-const char *test_starve_ipc(void)
-{
-	const char *err = NULL;
-	console_ctrl_t *console = console_init(stdin, stdout);
-	if (console == NULL)
-		return "Failed to init connection with console.";
-
-	struct timespec start;
-	getuptime(&start);
-
-	TPRINTF("Intensive computation shall be imagined (for %ds)...\n", DURATION_SECS);
-	TPRINTF("Press a key to terminate prematurely...\n");
-	while (true) {
-		struct timespec now;
-		getuptime(&now);
-
-		if (NSEC2SEC(ts_sub_diff(&now, &start)) >= DURATION_SECS)
-			break;
-
-		cons_event_t ev;
-		usec_t timeout = 0;
-		errno_t rc = console_get_event_timeout(console, &ev, &timeout);
-		if (rc == EOK) {
-			if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
-				TPRINTF("Key %d pressed, terminating.\n", ev.ev.key.key);
-				break;
-			}
-		} else if (rc != ETIMEOUT) {
-			TPRINTF("Got rc=%d, terminating.\n", rc);
-			break;
-		}
-	}
-
-	// FIXME - unless a key was pressed, the answer leaked as no one
-	// will wait for it.
-	// We cannot use async_forget() directly, though. Something like
-	// console_forget_pending_kbd_event() shall come here.
-
-	TPRINTF("Terminating...\n");
-
-	console_done(console);
-
-	return err;
-}
Index: pace/app/tester/ipc/starve.def
===================================================================
--- uspace/app/tester/ipc/starve.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"starve",
-	"Demonstrate starving IPC",
-	&test_starve_ipc,
-	true
-},
Index: pace/app/tester/loop/loop1.c
===================================================================
--- uspace/app/tester/loop/loop1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "../tester.h"
-
-const char *test_loop1(void)
-{
-	TPRINTF("Looping...");
-	while (true)
-		;
-	TPRINTF("\n");
-
-	return "Survived endless loop";
-}
Index: pace/app/tester/loop/loop1.def
===================================================================
--- uspace/app/tester/loop/loop1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"loop1",
-	"Endless loop",
-	&test_loop1,
-	false
-},
Index: pace/app/tester/meson.build
===================================================================
--- uspace/app/tester/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-#
-# Copyright (c) 2025 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'codepage', 'drv', 'math', 'ipctest', 'console' ]
-src = files(
-	'tester.c',
-	'util.c',
-	'thread/deadlock.c',
-	'thread/thread1.c',
-	'thread/setjmp1.c',
-	'print/print1.c',
-	'print/print2.c',
-	'print/print3.c',
-	'print/print4.c',
-	'print/print5.c',
-	'print/print6.c',
-	'console/console1.c',
-	'stdio/stdio1.c',
-	'stdio/stdio2.c',
-	'stdio/logger1.c',
-	'stdio/logger2.c',
-	'fault/fault1.c',
-	'fault/fault2.c',
-	'fault/fault3.c',
-	'float/float1.c',
-	'float/float2.c',
-	'vfs/vfs1.c',
-	'ipc/readwrite.c',
-	'ipc/sharein.c',
-	'ipc/starve.c',
-	'loop/loop1.c',
-	'mm/common.c',
-	'mm/malloc1.c',
-	'mm/malloc2.c',
-	'mm/malloc3.c',
-	'mm/mapping1.c',
-	'mm/pager1.c',
-	'hw/serial/serial1.c',
-	'chardev/chardev1.c',
-)
Index: pace/app/tester/mm/common.c
===================================================================
--- uspace/app/tester/mm/common.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,409 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Tomas Bures
- * Copyright (c) 2009 Lubomir Bulej
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <as.h>
-#include <adt/list.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <malloc.h>
-#include "../tester.h"
-#include "common.h"
-
-/*
- * Global error flag. The flag is set if an error
- * is encountered (overlapping blocks, inconsistent
- * block data, etc.)
- */
-bool error_flag = false;
-
-/*
- * Memory accounting: the amount of allocated memory and the
- * number and list of allocated blocks.
- */
-size_t mem_allocated;
-size_t mem_blocks_count;
-
-static LIST_INITIALIZE(mem_blocks);
-static LIST_INITIALIZE(mem_areas);
-
-/** Initializes the memory accounting structures.
- *
- */
-void init_mem(void)
-{
-	mem_allocated = 0;
-	mem_blocks_count = 0;
-}
-
-/** Cleanup all allocated memory blocks and mapped areas.
- *
- * Set the global error_flag if an error occurs.
- *
- */
-void done_mem(void)
-{
-	link_t *link;
-
-	while ((link = list_first(&mem_blocks)) != NULL) {
-		mem_block_t *block = list_get_instance(link, mem_block_t, link);
-		free_block(block);
-	}
-
-	while ((link = list_first(&mem_areas)) != NULL) {
-		mem_area_t *area = list_get_instance(link, mem_area_t, link);
-		unmap_area(area);
-	}
-}
-
-static bool overlap_match(mem_block_t *block, void *addr, size_t size)
-{
-	/* Entry block control structure <mbeg, mend) */
-	uint8_t *mbeg = (uint8_t *) block;
-	uint8_t *mend = (uint8_t *) block + sizeof(mem_block_t);
-
-	/* Entry block memory <bbeg, bend) */
-	uint8_t *bbeg = (uint8_t *) block->addr;
-	uint8_t *bend = (uint8_t *) block->addr + block->size;
-
-	/* Data block <dbeg, dend) */
-	uint8_t *dbeg = (uint8_t *) addr;
-	uint8_t *dend = (uint8_t *) addr + size;
-
-	/* Check for overlaps */
-	if (((mbeg >= dbeg) && (mbeg < dend)) ||
-	    ((mend > dbeg) && (mend <= dend)) ||
-	    ((bbeg >= dbeg) && (bbeg < dend)) ||
-	    ((bend > dbeg) && (bend <= dend)))
-		return true;
-
-	return false;
-}
-
-/** Test overlap
- *
- * Test whether a block starting at @addr overlaps with another,
- * previously allocated memory block or its control structure.
- *
- * @param addr Initial address of the block
- * @param size Size of the block
- *
- * @return False if the block does not overlap.
- *
- */
-static int test_overlap(void *addr, size_t size)
-{
-	bool fnd = false;
-
-	list_foreach(mem_blocks, link, mem_block_t, block) {
-		if (overlap_match(block, addr, size)) {
-			fnd = true;
-			break;
-		}
-	}
-
-	return fnd;
-}
-
-static void check_consistency(const char *loc)
-{
-	/* Check heap consistency */
-	void *prob = heap_check();
-	if (prob != NULL) {
-		TPRINTF("\nError: Heap inconsistency at %p in %s.\n",
-		    prob, loc);
-		TSTACKTRACE();
-		error_flag = true;
-	}
-}
-
-/** Checked malloc
- *
- * Allocate @size bytes of memory and check whether the chunk comes
- * from the non-mapped memory region and whether the chunk overlaps
- * with other, previously allocated, chunks.
- *
- * @param size Amount of memory to allocate
- *
- * @return NULL if the allocation failed. Sets the global error_flag to
- *         true if the allocation succeeded but is illegal.
- *
- */
-static void *checked_malloc(size_t size)
-{
-	void *data;
-
-	/* Allocate the chunk of memory */
-	data = malloc(size);
-	check_consistency("checked_malloc");
-	if (data == NULL)
-		return NULL;
-
-	/* Check for overlaps with other chunks */
-	if (test_overlap(data, size)) {
-		TPRINTF("\nError: Allocated block overlaps with another "
-		    "previously allocated block.\n");
-		TSTACKTRACE();
-		error_flag = true;
-	}
-
-	return data;
-}
-
-/** Allocate block
- *
- * Allocate a block of memory of @size bytes and add record about it into
- * the mem_blocks list. Return a pointer to the block holder structure or
- * NULL if the allocation failed.
- *
- * If the allocation is illegal (e.g. the memory does not come from the
- * right region or some of the allocated blocks overlap with others),
- * set the global error_flag.
- *
- * @param size Size of the memory block
- *
- */
-mem_block_t *alloc_block(size_t size)
-{
-	/* Check for allocation limit */
-	if (mem_allocated >= MAX_ALLOC)
-		return NULL;
-
-	/* Allocate the block holder */
-	mem_block_t *block =
-	    (mem_block_t *) checked_malloc(sizeof(mem_block_t));
-	if (block == NULL)
-		return NULL;
-
-	link_initialize(&block->link);
-
-	/* Allocate the block memory */
-	block->addr = checked_malloc(size);
-	if (block->addr == NULL) {
-		free(block);
-		check_consistency("alloc_block");
-		return NULL;
-	}
-
-	block->size = size;
-
-	/* Register the allocated block */
-	list_append(&block->link, &mem_blocks);
-	mem_allocated += size + sizeof(mem_block_t);
-	mem_blocks_count++;
-
-	return block;
-}
-
-/** Free block
- *
- * Free the block of memory and the block control structure allocated by
- * alloc_block. Set the global error_flag if an error occurs.
- *
- * @param block Block control structure
- *
- */
-void free_block(mem_block_t *block)
-{
-	/* Unregister the block */
-	list_remove(&block->link);
-	mem_allocated -= block->size + sizeof(mem_block_t);
-	mem_blocks_count--;
-
-	/* Free the memory */
-	free(block->addr);
-	check_consistency("free_block (a)");
-	free(block);
-	check_consistency("free_block (b)");
-}
-
-/** Calculate expected value
- *
- * Compute the expected value of a byte located at @pos in memory
- * block described by @block.
- *
- * @param block Memory block control structure
- * @param pos   Position in the memory block data area
- *
- */
-static inline uint8_t block_expected_value(mem_block_t *block, uint8_t *pos)
-{
-	return ((uintptr_t) block ^ (uintptr_t) pos) & 0xff;
-}
-
-/** Fill block
- *
- * Fill the memory block controlled by @block with data.
- *
- * @param block Memory block control structure
- *
- */
-void fill_block(mem_block_t *block)
-{
-	for (uint8_t *pos = block->addr, *end = pos + block->size;
-	    pos < end; pos++)
-		*pos = block_expected_value(block, pos);
-
-	check_consistency("fill_block");
-}
-
-/** Check block
- *
- * Check whether the block @block contains the data it was filled with.
- * Set global error_flag if an error occurs.
- *
- * @param block Memory block control structure
- *
- */
-void check_block(mem_block_t *block)
-{
-	for (uint8_t *pos = block->addr, *end = pos + block->size;
-	    pos < end; pos++) {
-		if (*pos != block_expected_value(block, pos)) {
-			TPRINTF("\nError: Corrupted content of a data block.\n");
-			TSTACKTRACE();
-			error_flag = true;
-			return;
-		}
-	}
-}
-
-/** Get random block
- *
- * Select a random memory block from the list of allocated blocks.
- *
- * @return Block control structure or NULL if the list is empty.
- *
- */
-mem_block_t *get_random_block(void)
-{
-	if (mem_blocks_count == 0)
-		return NULL;
-
-	unsigned long idx = rand() % mem_blocks_count;
-	link_t *entry = list_nth(&mem_blocks, idx);
-
-	if (entry == NULL) {
-		TPRINTF("\nError: Corrupted list of allocated memory blocks.\n");
-		TSTACKTRACE();
-		error_flag = true;
-	}
-
-	return list_get_instance(entry, mem_block_t, link);
-}
-
-/** Map memory area
- *
- * Map a memory area of @size bytes and add record about it into
- * the mem_areas list. Return a pointer to the area holder structure or
- * NULL if the mapping failed.
- *
- * @param size Size of the memory area
- *
- */
-mem_area_t *map_area(size_t size)
-{
-	/* Allocate the area holder */
-	mem_area_t *area =
-	    (mem_area_t *) checked_malloc(sizeof(mem_area_t));
-	if (area == NULL)
-		return NULL;
-
-	link_initialize(&area->link);
-
-	area->addr = as_area_create(AS_AREA_ANY, size,
-	    AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE,
-	    AS_AREA_UNPAGED);
-	if (area->addr == AS_MAP_FAILED) {
-		free(area);
-		check_consistency("map_area (a)");
-		return NULL;
-	}
-
-	area->size = size;
-
-	/* Register the allocated area */
-	list_append(&area->link, &mem_areas);
-
-	return area;
-}
-
-/** Unmap area
- *
- * Unmap the memory area and free the block control structure.
- * Set the global error_flag if an error occurs.
- *
- * @param area Memory area control structure
- *
- */
-void unmap_area(mem_area_t *area)
-{
-	/* Unregister the area */
-	list_remove(&area->link);
-
-	/* Free the memory */
-	errno_t ret = as_area_destroy(area->addr);
-	if (ret != EOK)
-		error_flag = true;
-
-	free(area);
-	check_consistency("unmap_area");
-}
-
-/** Calculate expected value
- *
- * Compute the expected value of a byte located at @pos in memory
- * area described by @area.
- *
- * @param area Memory area control structure
- * @param pos  Position in the memory area data area
- *
- */
-static inline uint8_t area_expected_value(mem_area_t *area, uint8_t *pos)
-{
-	return ((uintptr_t) area ^ (uintptr_t) pos) & 0xaa;
-}
-
-/** Fill area
- *
- * Fill the memory area controlled by @area with data.
- *
- * @param area Memory area control structure
- *
- */
-void fill_area(mem_area_t *area)
-{
-	for (uint8_t *pos = area->addr, *end = pos + area->size;
-	    pos < end; pos++)
-		*pos = area_expected_value(area, pos);
-
-	check_consistency("fill_area");
-}
Index: pace/app/tester/mm/common.h
===================================================================
--- uspace/app/tester/mm/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/** @file
- */
-
-#ifndef MM_COMMON_H_
-#define MM_COMMON_H_
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <adt/list.h>
-
-#define MAX_ALLOC  (16 * 1024 * 1024)
-
-#define AREA_GRANULARITY  16
-#define AREA_SIZE         (4 * PAGE_SIZE)
-
-typedef struct {
-	/* Address of the start of the block */
-	void *addr;
-
-	/* Size of the memory block */
-	size_t size;
-
-	/* Link to other blocks */
-	link_t link;
-} mem_block_t;
-
-typedef struct {
-	/* Address of the start of the area */
-	void *addr;
-
-	/* Size of the memory area */
-	size_t size;
-	/* Link to other areas */
-	link_t link;
-} mem_area_t;
-
-/*
- * Subphase control structures: subphase termination conditions,
- * probabilities of individual actions, subphase control structure.
- */
-
-typedef struct {
-	unsigned int max_cycles;
-	unsigned int no_memory;
-	unsigned int no_allocated;
-} sp_term_cond_t;
-
-typedef struct {
-	unsigned int alloc;
-	unsigned int free;
-} sp_action_prob_t;
-
-typedef struct {
-	const char *name;
-	sp_term_cond_t cond;
-	sp_action_prob_t prob;
-} subphase_t;
-
-/*
- * Phase control structures: The minimum and maximum block size that
- * can be allocated during the phase execution, phase control structure.
- */
-
-typedef struct {
-	size_t min_block_size;
-	size_t max_block_size;
-} ph_alloc_size_t;
-
-typedef struct {
-	const char *name;
-	ph_alloc_size_t alloc;
-	subphase_t *subphases;
-} phase_t;
-
-extern bool error_flag;
-extern size_t mem_allocated;
-extern size_t mem_blocks_count;
-
-#define RETURN_IF_ERROR \
-	do { \
-		if (error_flag) \
-			return; \
-	} while (0)
-
-extern void init_mem(void);
-extern void done_mem(void);
-
-extern mem_block_t *alloc_block(size_t);
-extern void free_block(mem_block_t *);
-extern void fill_block(mem_block_t *);
-extern void check_block(mem_block_t *);
-extern mem_block_t *get_random_block(void);
-
-extern mem_area_t *map_area(size_t);
-extern void fill_area(mem_area_t *);
-extern void unmap_area(mem_area_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/tester/mm/malloc1.c
===================================================================
--- uspace/app/tester/mm/malloc1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,303 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Tomas Bures
- * Copyright (c) 2009 Lubomir Bulej
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "common.h"
-#include "../tester.h"
-
-/*
- * The test consists of several phases which differ in the size of blocks
- * they allocate. The size of blocks is given as a range of minimum and
- * maximum allowed size. Each of the phases is divided into 3 subphases which
- * differ in the probability of free and alloc actions. Second subphase is
- * started when malloc returns 'out of memory' or when MAX_ALLOC is reached.
- * Third subphase is started after a given number of cycles. The third subphase
- * as well as the whole phase ends when all memory blocks are released.
- */
-
-/*
- * Subphases are defined separately here. This is for two reasons:
- * 1) data are not duplicated, 2) we don't have to state beforehand
- * how many subphases a phase contains.
- */
-static subphase_t subphases_32B[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 90,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 10,
-			.free = 100
-		}
-	}
-};
-
-static subphase_t subphases_128K[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 70,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 30,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 30,
-			.free = 100
-		}
-	}
-};
-
-static subphase_t subphases_default[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 90,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 10,
-			.free = 100
-		}
-	}
-};
-
-/*
- * Phase definitions.
- */
-static phase_t phases[] = {
-	{
-		.name = "32 B memory blocks",
-		.alloc = {
-			.min_block_size = 32,
-			.max_block_size = 32
-		},
-		.subphases = subphases_32B
-	},
-	{
-		.name = "128 KB memory blocks",
-		.alloc = {
-			.min_block_size = 128 * 1024,
-			.max_block_size = 128 * 1024
-		},
-		.subphases = subphases_128K
-	},
-	{
-		.name = "2500 B memory blocks",
-		.alloc = {
-			.min_block_size = 2500,
-			.max_block_size = 2500
-		},
-		.subphases = subphases_default
-	},
-	{
-		.name = "1 B .. 250000 B memory blocks",
-		.alloc = {
-			.min_block_size = 1,
-			.max_block_size = 250000
-		},
-		.subphases = subphases_default
-	}
-};
-
-static void do_subphase(phase_t *phase, subphase_t *subphase)
-{
-	for (unsigned int cycles = 0; /* always */; cycles++) {
-
-		if ((subphase->cond.max_cycles) &&
-		    (cycles >= subphase->cond.max_cycles)) {
-			/*
-			 * We have performed the required number of
-			 * cycles. End the current subphase.
-			 */
-			break;
-		}
-
-		/*
-		 * Decide whether we alloc or free memory in this step.
-		 */
-		unsigned int rnd = rand() % 100;
-		if (rnd < subphase->prob.alloc) {
-			/*
-			 * Compute a random number lying in interval
-			 * <min_block_size, max_block_size>
-			 */
-			int alloc = phase->alloc.min_block_size +
-			    (rand() % (phase->alloc.max_block_size - phase->alloc.min_block_size + 1));
-
-			mem_block_t *blk = alloc_block(alloc);
-			RETURN_IF_ERROR;
-
-			if (blk == NULL) {
-				TPRINTF("F(A)");
-				if (subphase->cond.no_memory) {
-					/* We filled the memory. Proceed to next subphase */
-					break;
-				}
-			} else {
-				TPRINTF("A");
-				fill_block(blk);
-				RETURN_IF_ERROR;
-			}
-
-		} else if (rnd < subphase->prob.free) {
-			mem_block_t *blk = get_random_block();
-			if (blk == NULL) {
-				TPRINTF("F(R)");
-				if (subphase->cond.no_allocated) {
-					/* We free all the memory. Proceed to next subphase. */
-					break;
-				}
-			} else {
-				TPRINTF("R");
-				check_block(blk);
-				RETURN_IF_ERROR;
-
-				free_block(blk);
-				RETURN_IF_ERROR;
-			}
-		}
-	}
-
-	TPRINTF("\n..  finished.\n");
-}
-
-static void do_phase(phase_t *phase)
-{
-	for (unsigned int subno = 0; subno < 3; subno++) {
-		subphase_t *subphase = &phase->subphases[subno];
-
-		TPRINTF(".. Sub-phase %u (%s)\n", subno + 1, subphase->name);
-		do_subphase(phase, subphase);
-		RETURN_IF_ERROR;
-	}
-}
-
-const char *test_malloc1(void)
-{
-	init_mem();
-
-	for (unsigned int phaseno = 0; phaseno < sizeof_array(phases);
-	    phaseno++) {
-		phase_t *phase = &phases[phaseno];
-
-		TPRINTF("Entering phase %u (%s)\n", phaseno + 1, phase->name);
-
-		do_phase(phase);
-		if (error_flag)
-			break;
-
-		TPRINTF("Phase finished.\n");
-	}
-
-	TPRINTF("Cleaning up.\n");
-	done_mem();
-	if (error_flag)
-		return "Test failed";
-
-	return NULL;
-}
Index: pace/app/tester/mm/malloc1.def
===================================================================
--- uspace/app/tester/mm/malloc1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"malloc1",
-	"Memory allocator test",
-	&test_malloc1,
-	true
-},
Index: pace/app/tester/mm/malloc2.c
===================================================================
--- uspace/app/tester/mm/malloc2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2011 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "../tester.h"
-
-const char *test_malloc2(void)
-{
-	int cnt = 0;
-	char *p;
-
-	TPRINTF("Provoking the kernel into overcommitting memory to us...\n");
-	while ((p = malloc(1024 * 1024))) {
-		TPRINTF("%dM ", ++cnt);
-		*p = 'A';
-	}
-	TPRINTF("\nWas refused more memory as expected.\n");
-
-	return NULL;
-}
Index: pace/app/tester/mm/malloc2.def
===================================================================
--- uspace/app/tester/mm/malloc2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"malloc2",
-	"Memory reservation feature test",
-	&test_malloc2,
-	false
-},
Index: pace/app/tester/mm/malloc3.c
===================================================================
--- uspace/app/tester/mm/malloc3.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,307 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Tomas Bures
- * Copyright (c) 2009 Lubomir Bulej
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <libarch/config.h>
-#include "common.h"
-#include "../tester.h"
-
-/*
- * The test is a slight adaptation of malloc1 test. The major difference
- * is that the test forces the heap allocator to create multiple
- * heap areas by creating disturbing address space areas.
- */
-
-static subphase_t subphases_32B[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 90,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 10,
-			.free = 100
-		}
-	}
-};
-
-static subphase_t subphases_128K[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 70,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 30,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 30,
-			.free = 100
-		}
-	}
-};
-
-static subphase_t subphases_default[] = {
-	{
-		.name = "Allocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 1,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 90,
-			.free = 100
-		}
-	},
-	{
-		.name = "Alloc/Dealloc",
-		.cond = {
-			.max_cycles = 200,
-			.no_memory = 0,
-			.no_allocated = 0,
-		},
-		.prob = {
-			.alloc = 50,
-			.free = 100
-		}
-	},
-	{
-		.name = "Deallocation",
-		.cond = {
-			.max_cycles = 0,
-			.no_memory = 0,
-			.no_allocated = 1,
-		},
-		.prob = {
-			.alloc = 10,
-			.free = 100
-		}
-	}
-};
-
-/*
- * Phase definitions.
- */
-static phase_t phases[] = {
-	{
-		.name = "32 B memory blocks",
-		.alloc = {
-			.min_block_size = 32,
-			.max_block_size = 32
-		},
-		.subphases = subphases_32B
-	},
-	{
-		.name = "128 KB memory blocks",
-		.alloc = {
-			.min_block_size = 128 * 1024,
-			.max_block_size = 128 * 1024
-		},
-		.subphases = subphases_128K
-	},
-	{
-		.name = "2500 B memory blocks",
-		.alloc = {
-			.min_block_size = 2500,
-			.max_block_size = 2500
-		},
-		.subphases = subphases_default
-	},
-	{
-		.name = "1 B .. 250000 B memory blocks",
-		.alloc = {
-			.min_block_size = 1,
-			.max_block_size = 250000
-		},
-		.subphases = subphases_default
-	}
-};
-
-static void do_subphase(phase_t *phase, subphase_t *subphase)
-{
-	for (unsigned int cycles = 0; /* always */; cycles++) {
-
-		if ((subphase->cond.max_cycles) &&
-		    (cycles >= subphase->cond.max_cycles)) {
-			/*
-			 * We have performed the required number of
-			 * cycles. End the current subphase.
-			 */
-			break;
-		}
-
-		/*
-		 * Decide whether we alloc or free memory in this step.
-		 */
-		unsigned int rnd = rand() % 100;
-		if (rnd < subphase->prob.alloc) {
-			/*
-			 * Compute a random number lying in interval
-			 * <min_block_size, max_block_size>
-			 */
-			int alloc = phase->alloc.min_block_size +
-			    (rand() % (phase->alloc.max_block_size - phase->alloc.min_block_size + 1));
-
-			mem_block_t *blk = alloc_block(alloc);
-			RETURN_IF_ERROR;
-
-			if (blk == NULL) {
-				TPRINTF("F(A)");
-				if (subphase->cond.no_memory) {
-					/* We filled the memory. Proceed to next subphase */
-					break;
-				}
-			} else {
-				TPRINTF("A");
-				fill_block(blk);
-				RETURN_IF_ERROR;
-
-				if ((mem_blocks_count % AREA_GRANULARITY) == 0) {
-					mem_area_t *area = map_area(AREA_SIZE);
-					RETURN_IF_ERROR;
-
-					if (area != NULL) {
-						TPRINTF("*");
-						fill_area(area);
-						RETURN_IF_ERROR;
-					} else
-						TPRINTF("F(*)");
-				}
-			}
-
-		} else if (rnd < subphase->prob.free) {
-			mem_block_t *blk = get_random_block();
-			if (blk == NULL) {
-				TPRINTF("F(R)");
-				if (subphase->cond.no_allocated) {
-					/* We free all the memory. Proceed to next subphase. */
-					break;
-				}
-			} else {
-				TPRINTF("R");
-				check_block(blk);
-				RETURN_IF_ERROR;
-
-				free_block(blk);
-				RETURN_IF_ERROR;
-			}
-		}
-	}
-
-	TPRINTF("\n..  finished.\n");
-}
-
-static void do_phase(phase_t *phase)
-{
-	for (unsigned int subno = 0; subno < 3; subno++) {
-		subphase_t *subphase = &phase->subphases[subno];
-
-		TPRINTF(".. Sub-phase %u (%s)\n", subno + 1, subphase->name);
-		do_subphase(phase, subphase);
-		RETURN_IF_ERROR;
-	}
-}
-
-const char *test_malloc3(void)
-{
-	init_mem();
-
-	for (unsigned int phaseno = 0; phaseno < sizeof_array(phases);
-	    phaseno++) {
-		phase_t *phase = &phases[phaseno];
-
-		TPRINTF("Entering phase %u (%s)\n", phaseno + 1, phase->name);
-
-		do_phase(phase);
-		if (error_flag)
-			break;
-
-		TPRINTF("Phase finished.\n");
-	}
-
-	TPRINTF("Cleaning up.\n");
-	done_mem();
-	if (error_flag)
-		return "Test failed";
-
-	return NULL;
-}
Index: pace/app/tester/mm/malloc3.def
===================================================================
--- uspace/app/tester/mm/malloc3.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"malloc3",
-	"Multi-heap memory allocator test",
-	&test_malloc3,
-	true
-},
Index: pace/app/tester/mm/mapping1.c
===================================================================
--- uspace/app/tester/mm/mapping1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str_error.h>
-#include <as.h>
-#include <errno.h>
-#include "../tester.h"
-
-#define BUFFER1_PAGES  4
-#define BUFFER2_PAGES  2
-
-static void *create_as_area(size_t size)
-{
-	TPRINTF("Creating AS area...\n");
-
-	void *result = as_area_create(AS_AREA_ANY, size,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (result == AS_MAP_FAILED)
-		return NULL;
-
-	return result;
-}
-
-static void touch_area(void *area, size_t size)
-{
-	TPRINTF("Touching (faulting-in) AS area...\n");
-
-	char *ptr = (char *)area;
-
-	while (size > 0) {
-		*ptr = 0;
-		size--;
-		ptr++;
-	}
-}
-
-#define VERIFY_MAPPING(area, page_count, expected_rc) \
-    verify_mapping((area), (page_count), (expected_rc), #expected_rc)
-
-static bool verify_mapping(void *area, int page_count, errno_t expected_rc,
-    const char *expected_rc_str)
-{
-	TPRINTF("Verifying mapping (expected: %s).\n", expected_rc_str);
-	int i;
-	for (i = 0; i < page_count; i++) {
-		void *page_start = ((char *) area) + PAGE_SIZE * i;
-		uintptr_t phys_dummy;
-		errno_t rc = as_get_physical_mapping(page_start, &phys_dummy);
-		if (rc != expected_rc) {
-			TPRINTF("as_get_physical_mapping() = %s != %s\n",
-			    str_error_name(rc), str_error_name(expected_rc));
-			return false;
-		}
-	}
-	return true;
-}
-
-const char *test_mapping1(void)
-{
-	errno_t rc;
-
-	size_t buffer1_len = BUFFER1_PAGES * PAGE_SIZE;
-	size_t buffer2_len = BUFFER2_PAGES * PAGE_SIZE;
-	void *buffer1 = create_as_area(buffer1_len);
-	void *buffer2 = create_as_area(buffer2_len);
-	if (!buffer1 || !buffer2) {
-		return "Cannot allocate memory";
-	}
-
-	touch_area(buffer1, buffer1_len);
-	touch_area(buffer2, buffer2_len);
-
-	/* Now verify that mapping to physical frames exist. */
-	if (!VERIFY_MAPPING(buffer1, BUFFER1_PAGES, EOK)) {
-		return "Failed to find mapping (buffer1)";
-	}
-	if (!VERIFY_MAPPING(buffer2, BUFFER2_PAGES, EOK)) {
-		return "Failed to find mapping (buffer2)";
-	}
-
-	/* Let's destroy the buffer1 area and access it again. */
-	rc = as_area_destroy(buffer1);
-	if (rc != EOK) {
-		return "Failed to destroy AS area";
-	}
-	if (!VERIFY_MAPPING(buffer1, BUFFER1_PAGES, ENOENT)) {
-		return "Mapping of destroyed area still exists";
-	}
-
-	/* clean-up */
-	rc = as_area_destroy(buffer2);
-	if (rc != EOK) {
-		return "Failed to destroy AS area";
-	}
-
-	return NULL;
-}
Index: pace/app/tester/mm/mapping1.def
===================================================================
--- uspace/app/tester/mm/mapping1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"mapping1",
-	"Page mapping test",
-	&test_mapping1,
-	true
-},
Index: pace/app/tester/mm/pager1.c
===================================================================
--- uspace/app/tester/mm/pager1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <vfs/vfs.h>
-#include <stdlib.h>
-#include <as.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include "../tester.h"
-
-#define TEST_FILE	"/tmp/testfile"
-
-const char text[] = "Hello world!";
-
-int fd;
-
-static void *create_paged_area(size_t size)
-{
-	size_t nwr;
-	errno_t rc;
-
-	TPRINTF("Creating temporary file...\n");
-
-	rc = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_READ | MODE_WRITE, &fd);
-	if (rc != EOK)
-		return NULL;
-	(void) vfs_unlink_path(TEST_FILE);
-
-	rc = vfs_write(fd, (aoff64_t []) { 0 }, text, sizeof(text), &nwr);
-	if (rc != EOK) {
-		vfs_put(fd);
-		return NULL;
-	}
-
-	async_sess_t *vfs_pager_sess;
-
-	TPRINTF("Connecting to VFS pager...\n");
-
-	vfs_pager_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_PAGER,
-	    0, NULL);
-
-	if (!vfs_pager_sess) {
-		vfs_put(fd);
-		return NULL;
-	}
-
-	TPRINTF("Creating AS area...\n");
-
-	void *result = async_as_area_create(AS_AREA_ANY, size,
-	    AS_AREA_READ | AS_AREA_CACHEABLE, vfs_pager_sess, fd, 0, 0);
-	if (result == AS_MAP_FAILED) {
-		vfs_put(fd);
-		return NULL;
-	}
-
-	return result;
-}
-
-static void touch_area(void *area, size_t size)
-{
-	TPRINTF("Touching (faulting-in) AS area...\n");
-
-	volatile char *ptr = (char *) area;
-
-	char ch;
-	while ((ch = *ptr++))
-		putchar(ch);
-}
-
-const char *test_pager1(void)
-{
-	size_t buffer_len = PAGE_SIZE;
-	void *buffer = create_paged_area(buffer_len);
-	if (!buffer)
-		return "Cannot allocate memory";
-
-	touch_area(buffer, buffer_len);
-
-	as_area_destroy(buffer);
-	vfs_put(fd);
-
-	return NULL;
-}
Index: pace/app/tester/mm/pager1.def
===================================================================
--- uspace/app/tester/mm/pager1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"pager1",
-	"Pager test",
-	&test_pager1,
-	true
-},
Index: pace/app/tester/print/print1.c
===================================================================
--- uspace/app/tester/print/print1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include "../tester.h"
-
-const char *test_print1(void)
-{
-	TPRINTF("Testing printf(\"%%*.*s\", 5, 3, \"text\"):\n");
-	TPRINTF("Expected output: \"  tex\"\n");
-	TPRINTF("Real output:     \"%*.*s\"\n\n", 5, 3, "text");
-
-	TPRINTF("Testing printf(\"%%10.8s\", \"very long text\"):\n");
-	TPRINTF("Expected output: \"  very lon\"\n");
-	TPRINTF("Real output:     \"%10.8s\"\n\n", "very long text");
-
-	TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n");
-	TPRINTF("Expected output: \"    text\"\n");
-	TPRINTF("Real output:     \"%8.10s\"\n\n", "text");
-
-	TPRINTF("Testing printf(\"%%8.10s\", \"very long text\"):\n");
-	TPRINTF("Expected output: \"very long \"\n");
-	TPRINTF("Real output:     \"%8.10s\"\n\n", "very long text");
-
-	TPRINTF("Testing printf(\"%%-*.*s\", 7, 7, \"text\"):\n");
-	TPRINTF("Expected output: \"text   \"\n");
-	TPRINTF("Real output:     \"%-*.*s\"\n\n", 7, 7, "text");
-
-	return NULL;
-}
Index: pace/app/tester/print/print1.def
===================================================================
--- uspace/app/tester/print/print1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print1",
-	"String printf test",
-	&test_print1,
-	true
-},
Index: pace/app/tester/print/print2.c
===================================================================
--- uspace/app/tester/print/print2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include "../tester.h"
-
-const char *test_print2(void)
-{
-	TPRINTF("Testing printf(\"%%c\", 'a'):\n");
-	TPRINTF("Expected output: [a]\n");
-	TPRINTF("Real output:     [%c]\n\n", 'a');
-
-	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n");
-	TPRINTF("Expected output: [1] [ 02] [03 ] [004] [005]\n");
-	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", 1, 2, 3, 4, 5);
-
-	TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", -1, -2, -3, -4, -5):\n");
-	TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
-	TPRINTF("Real output:     [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5);
-
-	TPRINTF("Testing printf(\"%%lld %%3.2lld %%-3.2lld %%2.3lld %%-2.3lld\", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5):\n");
-	TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n");
-	TPRINTF("Real output:     [%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]\n\n", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5);
-
-	TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n");
-	TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n");
-	TPRINTF("Real output:     [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21);
-
-	char ch[12];
-	ptrdiff_t d, neg_d;
-
-	d = &ch[0] - &ch[12];
-	neg_d = (unsigned)(-d);
-	TPRINTF("Testing printf(\"%%td %%tu %%tx %%ti %%to\", d, neg_d, neg_d, d, neg_d):\n");
-	TPRINTF("Expected output: [-12] [12] [c] [-12] [14]\n");
-	TPRINTF("Real output:     [%td] [%tu] [%tx] [%ti] [%to]\n\n", d, neg_d, neg_d, d, neg_d);
-
-	TPRINTF("Testing printf(\"%%lf\", 768.0):\n");
-	TPRINTF("Expected output: [768.000000]\n");
-	TPRINTF("Real output:     [%lf]\n", 768.0);
-
-	return NULL;
-}
Index: pace/app/tester/print/print2.def
===================================================================
--- uspace/app/tester/print/print2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print2",
-	"Numeric printf test",
-	&test_print2,
-	true
-},
Index: pace/app/tester/print/print3.c
===================================================================
--- uspace/app/tester/print/print3.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <macros.h>
-#include "../tester.h"
-
-#define BUFFER_SIZE  32
-
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wformat-truncation"
-#endif
-
-const char *test_print3(void)
-{
-	char buffer[BUFFER_SIZE];
-	int retval;
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short text without parameters.\"):\n");
-	TPRINTF("Expected result: retval=30 buffer=\"Short text without parameters.\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Short text without parameters.");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very very very long text without parameters.\"):\n");
-	TPRINTF("Expected result: retval=44 buffer=\"Very very very long text withou\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Very very very long text without parameters.");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Short %%s.\", \"text\"):\n");
-	TPRINTF("Expected result: retval=11 buffer=\"Short text.\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Short %s.", "text");
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	TPRINTF("Testing snprintf(buffer, " STRING(BUFFER_SIZE) ", \"Very long %%s. This text's length is more than %%d. We are interested in the result.\", \"text\", " STRING(BUFFER_SIZE) "):\n");
-	TPRINTF("Expected result: retval=84 buffer=\"Very long text. This text's len\"\n");
-	retval = snprintf(buffer, BUFFER_SIZE, "Very long %s. This text's length is more than %d. We are interested in the result.", "text", BUFFER_SIZE);
-	TPRINTF("Real result:     retval=%d buffer=\"%s\"\n\n", retval, buffer);
-
-	return NULL;
-}
Index: pace/app/tester/print/print3.def
===================================================================
--- uspace/app/tester/print/print3.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print3",
-	"Buffered printf test",
-	&test_print3,
-	true
-},
Index: pace/app/tester/print/print4.c
===================================================================
--- uspace/app/tester/print/print4.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <codepage/cp437.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <uchar.h>
-#include "../tester.h"
-
-const char *test_print4(void)
-{
-	TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
-
-	uint8_t group;
-	for (group = 1; group < 4; group++) {
-		TPRINTF("%#x: ", group << 5);
-
-		uint8_t index;
-		for (index = 0; index < 32; index++)
-			TPRINTF("%c", (char) ((group << 5) + index));
-
-		TPRINTF("  ");
-		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", (wint_t) ((group << 5) + index));
-
-		TPRINTF("\n");
-	}
-
-	/*
-	 * Print entire code page 437 (in Unicode)
-	 *
-	 * The purpose of this test is to verify that the EGA display
-	 * driver can correctly map every code page 437 character back
-	 * from Unicode and display it.
-	 *
-	 * With a Unicode-capable display this will just give you a bit
-	 * of nostalgia.
-	 */
-	TPRINTF("\nCode page 437 characters (converted to Unicode):\n");
-
-	for (group = 0; group < 8; group++) {
-		TPRINTF("%#x: ", group << 5);
-
-		uint8_t index;
-		for (index = 0; index < 32; index++)
-			TPRINTF("%lc", cp437_decode((group << 5) + index));
-
-		TPRINTF("\n");
-	}
-
-	TPRINTF("\nUTF-8 strings using printf(\"%%s\"):\n");
-	TPRINTF("English:  %s\n", "Quick brown fox jumps over the lazy dog");
-	TPRINTF("Czech:    %s\n", "Příliš žluťoučký kůň úpěl ďábelské ódy");
-	TPRINTF("Greek:    %s\n", "Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-	TPRINTF("Hebrew:   %s\n", "משוואת ברנולי היא משוואה בהידרודינמיקה");
-	TPRINTF("Arabic:   %s\n", "التوزيع الجغرافي للحمل العنقودي");
-	TPRINTF("Russian:  %s\n", "Леннон познакомился с художницей-авангардисткой");
-	TPRINTF("Armenian: %s\n", "Սկսեց հրատարակվել Երուսաղեմի հայկական");
-
-	TPRINTF("\nUTF-32 strings using printf(\"%%ls\"):\n");
-	TPRINTF("English:  %ls\n", L"Quick brown fox jumps over the lazy dog");
-	TPRINTF("Czech:    %ls\n", L"Příliš žluťoučký kůň úpěl ďábelské ódy");
-	TPRINTF("Greek:    %ls\n", L"Ὦ ξεῖν’, ἀγγέλλειν Λακεδαιμονίοις ὅτι τῇδε");
-	TPRINTF("Hebrew:   %ls\n", L"משוואת ברנולי היא משוואה בהידרודינמיקה");
-	TPRINTF("Arabic:   %ls\n", L"التوزيع الجغرافي للحمل العنقودي");
-	TPRINTF("Russian:  %ls\n", L"Леннон познакомился с художницей-авангардисткой");
-	TPRINTF("Armenian: %ls\n", L"Սկսեց հրատարակվել Երուսաղեմի հայկական");
-
-	return NULL;
-}
Index: pace/app/tester/print/print4.def
===================================================================
--- uspace/app/tester/print/print4.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print4",
-	"Unicode test",
-	&test_print4,
-	true
-},
Index: pace/app/tester/print/print5.c
===================================================================
--- uspace/app/tester/print/print5.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2005 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This test tests several features of the HelenOS
- * printf() implementation which go beyond the POSIX
- * specification and GNU printf() behaviour.
- *
- * Therefore we disable printf() argument checking by
- * the GCC compiler in this source file to avoid false
- * positives.
- *
- */
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-overflow"
-
-#include <stdio.h>
-#include <stddef.h>
-#include "../tester.h"
-
-const char *test_print5(void)
-{
-	TPRINTF("Testing printf(\"%%s\", NULL):\n");
-	TPRINTF("Expected output: \"(NULL)\"\n");
-	TPRINTF("Real output:     \"%s\"\n\n", (char *) NULL);
-
-	TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
-	TPRINTF("Expected output: [a] [  b] [c  ] [ d] [e ]\n");
-	TPRINTF("Real output:     [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');
-
-	return NULL;
-}
Index: pace/app/tester/print/print5.def
===================================================================
--- uspace/app/tester/print/print5.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print5",
-	"Char printf test",
-	&test_print5,
-	true
-},
Index: pace/app/tester/print/print6.c
===================================================================
--- uspace/app/tester/print/print6.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,211 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include "../tester.h"
-
-#include <str.h>
-
-const char *test_print6(void)
-{
-	struct {
-		double val;
-		const char *fmt;
-		const char *exp_str;
-		const char *warn_str;
-	} pat[] = {
-		/*
-		 * Generic
-		 */
-		{ 2.0,         "%g",       "2", 0 },
-		{ 0,           "%g",       "0", 0 },
-		{ 0.1,         "%g",     "0.1", 0 },
-		{ 9e59,        "%g",   "9e+59", 0 },
-		{ -9e-59,      "%g",  "-9e-59", 0 },
-		{ 1e307,       "%g",  "1e+307", 0 },
-		{ 0.09999999999999999, "%g",  "9.999999999999999e-02", 0 },
-		{ 0.099999999999999999, "%g",  "0.1", 0 },
-
-		/*
-		 * gcc and msvc convert "3.4567e-317" to different binary
-		 * doubles.
-		 */
-		{ 3.4567e-317, "%g",  "3.4567e-317", "3.456998e-317" },
-		{ 3.4567e-318, "%g",  "3.4567e-318", 0 },
-		{ 123456789012345.0, "%g",  "123456789012345", 0 },
-		{ -123456789012345.0, "%g",  "-123456789012345", 0 },
-
-		/* Special */
-		{ 1e300 * 1e300, "%g",  "inf", 0 },
-		{ -1.0 / (1e300 * 1e300), "%g",  "-0", 0 },
-
-		{ 1234567.8901, "%g",  "1234567.8901", 0 },
-		{ 1234567.80012, "%g",  "1234567.80012", 0 },
-		{ 112e-32, "%g",  "1.12e-30", 0 },
-		{ 10.0e45, "%g",  "1e+46", 0 },
-
-		/* rounding w/ trailing zero removal */
-		{ 0.01, "%10.6g",      "      0.01", 0 },
-		{ 9.495, "%10.2g",     "       9.5", 0 },
-		{ 9.495e30, "%10.2g",  "   9.5e+30", 0 },
-		{ 9.495e30, "%10g",  " 9.495e+30", 0 },
-		{ 9.495e30, "%10.6g",  " 9.495e+30", 0 },
-
-		/*
-		 * Scientific
-		 */
-		{ 1e05, "%e",  "1.000000e+05", 0 },
-
-		/* full padding */
-
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "%+010.3e",  "+1.000e-01", 0 },
-		{ 1e-1, "%+10.3e",  "+1.000e-01", 0 },
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_LEFTALIGNED */
-		{ 1e-1, "%+-10.3e",  "+1.000e-01", 0 },
-
-		/* padding */
-
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "%+010.2e",  "+01.00e-01", 0 },
-		{ 1e-1, "%+10.2e",  " +1.00e-01", 0 },
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_LEFTALIGNED */
-		{ 1e-1, "%+-10.2e",  "+1.00e-01 ", 0 },
-		/* __PRINTF_FLAG_SPACESIGN | __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "% 010.2e",  " 01.00e-01", 0 },
-		/* __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "%010.2e",  "001.00e-01", 0 },
-		/* __PRINTF_FLAG_SPACESIGN */
-		{ 1e-1, "% 10.2e",  "  1.00e-01", 0 },
-		{ 1e-1, "%10.2e",  "  1.00e-01", 0 },
-
-		/* padding fractionals */
-
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_ZEROPADDED */
-		{ 1.08e29, "%+010.3e",  "+1.080e+29", 0 },
-		{ 1.08e29, "%+10.3e",  "+1.080e+29", 0 },
-		/* __PRINTF_FLAG_SHOWPLUS | __PRINTF_FLAG_ZEROPADDED */
-		{ 1.08e29, "%+011.2e",  "+001.08e+29", 0 },
-		{ 1.085e29, "%11.2e", "   1.09e+29", 0 },
-
-		/* rounding */
-
-		{ 1.345e2, "%+10.2e",  " +1.35e+02", 0 },
-		{ 9.995e2, "%+10.2e",  " +1.00e+03", 0 },
-		{ -9.99499999e2, "%10.2e",  " -9.99e+02", 0 },
-		{ -9.99499999e2, "%10.0e",  "    -1e+03", 0 },
-		/* __PRINTF_FLAG_DECIMALPT */
-		{ -9.99499999e2, "%#10.0e",  "   -1.e+03", 0 },
-		/* __PRINTF_FLAG_DECIMALPT */
-		{ -1.2345006789e+231, "%#10.10e",   "-1.2345006789e+231", 0 },
-		/* __PRINTF_FLAG_DECIMALPT */
-		{ -1.23450067995e+231, "%#10.10e",  "-1.2345006800e+231", 0 },
-
-		/* special */
-
-		{ 1e300 * 1e300, "%10.5e",  "       inf", 0 },
-		{ -1.0 / (1e300 * 1e300), "%10.2e",  " -0.00e+00", 0 },
-		/* __PRINTF_FLAG_BIGCHARS */
-		{ 1e300 * 1e300, "%10.5E",  "       INF", 0 },
-		/* __PRINTF_FLAG_BIGCHARS */
-		{ -1.0 / (1e300 * 1e300), "%10.2E",  " -0.00E+00", 0 },
-
-		/*
-		 * Fixed
-		 */
-
-		/* padding */
-
-		/* __PRINTF_FLAG_SPACESIGN | __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "% 010.3f",  " 00000.100", 0 },
-		/*
-		 * __PRINTF_FLAG_SPACESIGN | __PRINTF_FLAG_ZEROPADDED |
-		 * __PRINTF_FLAG_LEFTALIGNED
-		 */
-		{ 1e-1, "% 0-10.3f",  " 0.100    ", 0 },
-		/* __PRINTF_FLAG_SPACESIGN | __PRINTF_FLAG_ZEROPADDED */
-		{ 1e-1, "% 010.3f",  " 00000.100", 0 },
-		{ 1e-1, "%10.3f",  "     0.100", 0 },
-
-		/* rounding */
-
-		{ -0.0, "%10.0f",     "        -0", 0 },
-		{ -0.099, "%+10.3f",   "    -0.099", 0 },
-		{ -0.0995, "%+10.3f",  "    -0.100", 0 },
-		{ -0.0994, "%+10.3f",  "    -0.099", 0 },
-		{ -99.995, "%+10.0f",  "      -100", 0 },
-		{ 3.5, "%+10.30f",  "+3.500000000000000000000000000000", 0 },
-		{ 3.5, "%+10.0f",      "        +4", 0 },
-		{ 0.1, "%+10.6f",      " +0.100000", 0 },
-
-		/*
-		 * The compiler will go for closer 0.10..055 instead of
-		 * 0.09..917
-		 */
-		{ 0.1, "%+10.20f",  "+0.10000000000000000550", 0 },
-		/* Next closest to 0.1 */
-		{ 0.0999999999999999917, "%+10.20f", "+0.09999999999999999170",
-			0 },
-		{ 0.0999999999999999917, "%+10f",    " +0.100000", 0 },
-		{ 0.0999999999999998945, "%10.20f",  "0.09999999999999989450",
-			0 },
-	};
-
-	int patterns_len = (int)(sizeof(pat) / sizeof(pat[0]));
-	int failed = 0;
-	const int buf_size = 256;
-	char buf[256 + 1] = { 0 };
-
-	TPRINTF("Test printing of floating point numbers via "
-	    "printf(\"%%f\"):\n");
-
-	for (int i = 0; i < patterns_len; ++i) {
-
-		snprintf(buf, buf_size, pat[i].fmt, pat[i].val);
-
-		if (!str_cmp(buf, pat[i].exp_str)) {
-			TPRINTF("ok:  %s |%s| == |%s|\n",
-			    pat[i].fmt, buf, pat[i].exp_str);
-		} else {
-			if (pat[i].warn_str && !str_cmp(buf, pat[i].warn_str)) {
-				TPRINTF("warn: %s |%s| != |%s|\n",
-				    pat[i].fmt, buf, pat[i].exp_str);
-			} else {
-				++failed;
-				TPRINTF("ERR: %s |%s| != |%s|\n",
-				    pat[i].fmt, buf, pat[i].exp_str);
-			}
-		}
-	}
-
-	if (failed) {
-		return "Unexpectedly misprinted floating point numbers.";
-	} else {
-		return 0;
-	}
-}
Index: pace/app/tester/print/print6.def
===================================================================
--- uspace/app/tester/print/print6.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"print6",
-	"Floating point printf test",
-	&test_print6,
-	true
-},
Index: pace/app/tester/stdio/logger1.c
===================================================================
--- uspace/app/tester/stdio/logger1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <io/log.h>
-#include "../tester.h"
-
-const char *test_logger1(void)
-{
-	for (log_level_t level = 0; level < LVL_LIMIT; level++) {
-		log_msg(LOG_DEFAULT, level, "Testing logger, level %d.", (int) level);
-	}
-
-	return NULL;
-}
Index: pace/app/tester/stdio/logger1.def
===================================================================
--- uspace/app/tester/stdio/logger1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"logger1",
-	"Logger printing test",
-	&test_logger1,
-	true
-},
Index: pace/app/tester/stdio/logger2.c
===================================================================
--- uspace/app/tester/stdio/logger2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fibril.h>
-#include <io/log.h>
-#include "../tester.h"
-
-const char *test_logger2(void)
-{
-	log_t log_alpha = log_create("alpha", LOG_DEFAULT);
-	log_t log_bravo = log_create("bravo", log_alpha);
-
-	TPRINTF("Alpha is %" PRIlogctx ".\n", log_alpha);
-	TPRINTF("Bravo is %" PRIlogctx ".\n", log_bravo);
-
-	while (true) {
-		/*
-		 * Intentionally skipping FATAL to allow muting
-		 * the output completely by setting visible level to FATAL.
-		 */
-		for (log_level_t level = LVL_ERROR; level < LVL_LIMIT; level++) {
-			log_msg(LOG_DEFAULT, level, "Printing level %d (%s).",
-			    (int) level, log_level_str(level));
-			log_msg(log_alpha, level,
-			    "Printing level %d (%s) into alpha log.",
-			    (int) level, log_level_str(level));
-			log_msg(log_bravo, level,
-			    "Printing level %d (%s) into bravo sub-log.",
-			    (int) level, log_level_str(level));
-			fibril_usleep(1000 * 100);
-		}
-	}
-
-	return NULL;
-}
Index: pace/app/tester/stdio/logger2.def
===================================================================
--- uspace/app/tester/stdio/logger2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"logger2",
-	"Logger endless test",
-	&test_logger2,
-	false
-},
Index: pace/app/tester/stdio/stdio1.c
===================================================================
--- uspace/app/tester/stdio/stdio1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str_error.h>
-#include <errno.h>
-#include "../tester.h"
-
-#define BUF_SIZE  32
-
-static char buf[BUF_SIZE + 1];
-
-const char *test_stdio1(void)
-{
-	FILE *file;
-	const char *file_name = "/demo.txt";
-
-	TPRINTF("Open file \"%s\"...", file_name);
-	errno = 0;
-	file = fopen(file_name, "rt");
-	if (file == NULL) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed opening file";
-	} else
-		TPRINTF("OK\n");
-
-	TPRINTF("Read file...");
-	size_t cnt = fread(buf, 1, BUF_SIZE, file);
-	if (ferror(file)) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		fclose(file);
-		return "Failed reading file";
-	} else
-		TPRINTF("OK\n");
-
-	buf[cnt] = '\0';
-	TPRINTF("Read %zu bytes, string \"%s\"\n", cnt, buf);
-
-	TPRINTF("Seek to beginning...");
-	if (fseek(file, 0, SEEK_SET) != 0) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		fclose(file);
-		return "Failed seeking in file";
-	} else
-		TPRINTF("OK\n");
-
-	TPRINTF("Read using fgetc()...");
-	while (true) {
-		int c = fgetc(file);
-		if (c == EOF)
-			break;
-
-		TPRINTF(".");
-	}
-	TPRINTF("[EOF]\n");
-
-	TPRINTF("Close...");
-	if (fclose(file) != 0) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed closing file";
-	} else
-		TPRINTF("OK\n");
-
-	return NULL;
-}
Index: pace/app/tester/stdio/stdio1.def
===================================================================
--- uspace/app/tester/stdio/stdio1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"stdio1",
-	"ANSI C streams reading test",
-	&test_stdio1,
-	true
-},
Index: pace/app/tester/stdio/stdio2.c
===================================================================
--- uspace/app/tester/stdio/stdio2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str_error.h>
-#include <errno.h>
-#include "../tester.h"
-
-const char *test_stdio2(void)
-{
-	FILE *file;
-	const char *file_name = "/tmp/test";
-
-	TPRINTF("Open file \"%s\" for writing...", file_name);
-	errno = 0;
-	file = fopen(file_name, "wtx");
-	if (file == NULL) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed opening file";
-	} else
-		TPRINTF("OK\n");
-
-	TPRINTF("Write to file...");
-	fprintf(file, "integer: %u, string: \"%s\"", 42, "Hello!");
-	TPRINTF("OK\n");
-
-	TPRINTF("Close...");
-	if (fclose(file) != 0) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed closing file";
-	} else
-		TPRINTF("OK\n");
-
-	TPRINTF("Open file \"%s\" for reading...", file_name);
-	file = fopen(file_name, "rt");
-	if (file == NULL) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed opening file";
-	} else
-		TPRINTF("OK\n");
-
-	TPRINTF("File contains:\n");
-	while (true) {
-		int c = fgetc(file);
-		if (c == EOF)
-			break;
-		TPRINTF("%c", c);
-	}
-
-	TPRINTF("\nClose...");
-	if (fclose(file) != 0) {
-		TPRINTF("errno = %s\n", str_error_name(errno));
-		return "Failed closing file";
-	} else
-		TPRINTF("OK\n");
-
-	return NULL;
-}
Index: pace/app/tester/stdio/stdio2.def
===================================================================
--- uspace/app/tester/stdio/stdio2.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"stdio2",
-	"ANSI C streams writing test",
-	&test_stdio2,
-	true
-},
Index: pace/app/tester/tester.c
===================================================================
--- uspace/app/tester/tester.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <str.h>
-#include <io/log.h>
-#include <types/casting.h>
-#include "tester.h"
-
-bool test_quiet;
-int test_argc;
-char **test_argv;
-
-test_t tests[] = {
-#include "thread/deadlock.def"
-#include "thread/thread1.def"
-#include "thread/setjmp1.def"
-#include "print/print1.def"
-#include "print/print2.def"
-#include "print/print3.def"
-#include "print/print4.def"
-#include "print/print5.def"
-#include "print/print6.def"
-#include "console/console1.def"
-#include "stdio/stdio1.def"
-#include "stdio/stdio2.def"
-#include "stdio/logger1.def"
-#include "stdio/logger2.def"
-#include "fault/fault1.def"
-#include "fault/fault2.def"
-#include "fault/fault3.def"
-#include "float/float1.def"
-#include "float/float2.def"
-#include "vfs/vfs1.def"
-#include "ipc/readwrite.def"
-#include "ipc/sharein.def"
-#include "ipc/starve.def"
-#include "loop/loop1.def"
-#include "mm/malloc1.def"
-#include "mm/malloc2.def"
-#include "mm/malloc3.def"
-#include "mm/mapping1.def"
-#include "mm/pager1.def"
-#include "hw/serial/serial1.def"
-#include "chardev/chardev1.def"
-	{ NULL, NULL, NULL, false }
-};
-
-static bool run_test(test_t *test)
-{
-	/* Execute the test */
-	const char *ret = test->entry();
-
-	if (ret == NULL) {
-		printf("\nTest passed\n");
-		return true;
-	}
-
-	printf("\n%s\n", ret);
-	return false;
-}
-
-static int run_safe_tests(void)
-{
-	test_t *test;
-	unsigned int i = 0;
-	unsigned int n = 0;
-
-	char *failed_names = NULL;
-
-	printf("\n*** Running all safe tests ***\n\n");
-
-	for (test = tests; test->name != NULL; test++) {
-		if (!test->safe)
-			continue;
-
-		printf("%s (%s)\n", test->name, test->desc);
-		if (run_test(test)) {
-			i++;
-			continue;
-		}
-
-		if (!failed_names) {
-			failed_names = str_dup(test->name);
-		} else {
-			char *f = NULL;
-			asprintf(&f, "%s, %s", failed_names, test->name);
-			if (!f) {
-				printf("Out of memory.\n");
-				abort();
-			}
-			free(failed_names);
-			failed_names = f;
-		}
-		n++;
-	}
-
-	printf("\nCompleted, %u tests run, %u passed.\n", i + n, i);
-	if (failed_names)
-		printf("Failed tests: %s\n", failed_names);
-
-	return n;
-}
-
-static void list_tests(void)
-{
-	size_t len = 0;
-	test_t *test;
-	for (test = tests; test->name != NULL; test++) {
-		if (str_length(test->name) > len)
-			len = str_length(test->name);
-	}
-
-	assert(can_cast_size_t_to_int(len) && "test name length overflow");
-
-	for (test = tests; test->name != NULL; test++)
-		printf("%-*s %s%s\n", (int) len, test->name, test->desc,
-		    (test->safe ? "" : " (unsafe)"));
-
-	printf("%-*s Run all safe tests\n", (int) len, "*");
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc < 2) {
-		printf("Usage:\n\n");
-		printf("%s <test> [args ...]\n\n", argv[0]);
-		list_tests();
-		return 0;
-	}
-
-	log_init("tester");
-
-	test_quiet = false;
-	test_argc = argc - 2;
-	test_argv = argv + 2;
-
-	if (str_cmp(argv[1], "*") == 0) {
-		return run_safe_tests();
-	}
-
-	test_t *test;
-	for (test = tests; test->name != NULL; test++) {
-		if (str_cmp(argv[1], test->name) == 0) {
-			return (run_test(test) ? 0 : -1);
-		}
-	}
-
-	printf("Unknown test \"%s\"\n", argv[1]);
-	return -2;
-}
-
-/** @}
- */
Index: pace/app/tester/tester.h
===================================================================
--- uspace/app/tester/tester.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2007 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/** @file
- */
-
-#ifndef TESTER_H_
-#define TESTER_H_
-
-#include <stdbool.h>
-#include <stacktrace.h>
-#include <stdio.h>
-
-#define IPC_TEST_SERVICE  10240
-#define IPC_TEST_METHOD   2000
-
-extern bool test_quiet;
-extern int test_argc;
-extern char **test_argv;
-
-/**
- * sizeof_array
- * @array array to determine the size of
- *
- * Returns the size of @array in array elements.
- */
-#define sizeof_array(array) \
-	(sizeof(array) / sizeof((array)[0]))
-
-#define TPRINTF(format, ...) \
-	do { \
-		if (!test_quiet) { \
-			fprintf(stdout, (format), ##__VA_ARGS__); \
-		} \
-	} while (0)
-
-#define TSTACKTRACE() \
-	do { \
-		if (!test_quiet) { \
-			stacktrace_print(); \
-		} \
-	} while (0)
-
-typedef const char *(*test_entry_t)(void);
-
-typedef struct {
-	const char *name;
-	const char *desc;
-	test_entry_t entry;
-	bool safe;
-} test_t;
-
-extern const char *test_deadlock(void);
-extern const char *test_thread1(void);
-extern const char *test_setjmp1(void);
-extern const char *test_print1(void);
-extern const char *test_print2(void);
-extern const char *test_print3(void);
-extern const char *test_print4(void);
-extern const char *test_print5(void);
-extern const char *test_print6(void);
-extern const char *test_console1(void);
-extern const char *test_stdio1(void);
-extern const char *test_stdio2(void);
-extern const char *test_logger1(void);
-extern const char *test_logger2(void);
-extern const char *test_fault1(void);
-extern const char *test_fault2(void);
-extern const char *test_fault3(void);
-extern const char *test_float1(void);
-extern const char *test_float2(void);
-extern const char *test_vfs1(void);
-extern const char *test_ping_pong(void);
-extern const char *test_readwrite(void);
-extern const char *test_sharein(void);
-extern const char *test_starve_ipc(void);
-extern const char *test_loop1(void);
-extern const char *test_malloc1(void);
-extern const char *test_malloc2(void);
-extern const char *test_malloc3(void);
-extern const char *test_mapping1(void);
-extern const char *test_pager1(void);
-extern const char *test_serial1(void);
-extern const char *test_devman1(void);
-extern const char *test_devman2(void);
-extern const char *test_chardev1(void);
-
-extern test_t tests[];
-
-#endif
-
-/** @}
- */
Index: pace/app/tester/thread/deadlock.c
===================================================================
--- uspace/app/tester/thread/deadlock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-//#include <stdio.h>
-//#include <stddef.h>
-#include "../tester.h"
-
-static fibril_mutex_t fm1, fm2;
-
-static errno_t fibril_fn(void *data)
-{
-	TPRINTF("F2: Lock M2\n");
-	fibril_mutex_lock(&fm2);
-	fibril_sleep(1);
-	TPRINTF("F2: Lock M1\n");
-	fibril_mutex_lock(&fm1);
-	TPRINTF("F2: Unlock M1, M2\n");
-	fibril_mutex_unlock(&fm1);
-	fibril_mutex_unlock(&fm2);
-	return EOK;
-}
-
-const char *test_deadlock(void)
-{
-	fid_t fid;
-
-	fibril_mutex_initialize(&fm1);
-	fibril_mutex_initialize(&fm2);
-
-	TPRINTF("Creating fibril\n");
-	fid = fibril_create(fibril_fn, NULL);
-	if (fid == 0) {
-		TPRINTF("\nCould not create fibril.\n");
-		goto error;
-	}
-
-	fibril_add_ready(fid);
-
-	TPRINTF("F1: Lock M1\n");
-	fibril_mutex_lock(&fm1);
-	fibril_sleep(1);
-	TPRINTF("F1: Lock M2\n");
-	fibril_mutex_lock(&fm2);
-
-	TPRINTF("F1: Unlock M2, M1\n");
-	fibril_mutex_unlock(&fm2);
-	fibril_mutex_unlock(&fm1);
-
-	return NULL;
-error:
-	return "Test failed";
-}
Index: pace/app/tester/thread/deadlock.def
===================================================================
--- uspace/app/tester/thread/deadlock.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"deadlock",
-	"Fibril deadlock detection test",
-	&test_deadlock,
-	false
-},
Index: pace/app/tester/thread/setjmp1.c
===================================================================
--- uspace/app/tester/thread/setjmp1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <setjmp.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "../tester.h"
-
-static jmp_buf jmp_env;
-static int counter;
-
-static void do_the_long_jump(void)
-{
-	TPRINTF("Will do a long jump back to test_it().\n");
-	longjmp(jmp_env, 1);
-}
-
-static const char *test_it(void)
-{
-	int second_round = setjmp(jmp_env);
-	counter++;
-	TPRINTF("Just after setjmp(), counter is %d.\n", counter);
-	if (second_round) {
-		if (counter != 2) {
-			return "setjmp() have not returned twice";
-		} else {
-			return NULL;
-		}
-	}
-
-	if (counter != 1) {
-		return "Shall not reach here more than once";
-	}
-
-	do_the_long_jump();
-
-	return "Survived a long jump";
-}
-
-const char *test_setjmp1(void)
-{
-	counter = 0;
-
-	const char *err_msg = test_it();
-
-	return err_msg;
-}
Index: pace/app/tester/thread/setjmp1.def
===================================================================
--- uspace/app/tester/thread/setjmp1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"setjmp1",
-	"Long jump test",
-	&test_setjmp1,
-	true
-},
Index: pace/app/tester/thread/thread1.c
===================================================================
--- uspace/app/tester/thread/thread1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define THREADS  20
-#define DELAY    10
-
-#include <stdatomic.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <inttypes.h>
-#include "../tester.h"
-
-static atomic_bool finish;
-
-static FIBRIL_SEMAPHORE_INITIALIZE(threads_finished, 0);
-
-static errno_t threadtest(void *data)
-{
-	fibril_detach(fibril_get_id());
-
-	while (!atomic_load(&finish))
-		fibril_usleep(100000);
-
-	fibril_semaphore_up(&threads_finished);
-	return EOK;
-}
-
-const char *test_thread1(void)
-{
-	int total = 0;
-
-	atomic_store(&finish, false);
-
-	fibril_test_spawn_runners(THREADS);
-
-	TPRINTF("Creating threads");
-	for (int i = 0; i < THREADS; i++) {
-		fid_t f = fibril_create(threadtest, NULL);
-		if (!f) {
-			TPRINTF("\nCould not create thread %u\n", i);
-			break;
-		}
-		fibril_add_ready(f);
-		TPRINTF(".");
-		total++;
-	}
-
-	TPRINTF("\nRunning threads for %u seconds...", DELAY);
-	fibril_sleep(DELAY);
-	TPRINTF("\n");
-
-	atomic_store(&finish, true);
-	for (int i = 0; i < total; i++) {
-		TPRINTF("Threads left: %d\n", total - i);
-		fibril_semaphore_down(&threads_finished);
-	}
-
-	return NULL;
-}
Index: pace/app/tester/thread/thread1.def
===================================================================
--- uspace/app/tester/thread/thread1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"thread1",
-	"Thread test",
-	&test_thread1,
-	true
-},
Index: pace/app/tester/util.c
===================================================================
--- uspace/app/tester/util.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/**
- * @file
- */
-
-#include "util.h"
-#undef ASSERT_EQ_FN_DEF
-#define ASSERT_EQ_FN_DEF(type, fmt, fmtx) \
-bool assert_eq_fn_##type(type exp, type act, const char *act_desc) \
-{ \
-	if (exp != act) { \
-		fprintf(stderr, "Expected %s to be %" fmt " (0x%" fmtx "),"\
-		    " but was %" fmt " (0x%" fmtx ") \n", \
-		    act_desc, exp, exp, act, act); \
-	} \
-	return exp != act; \
-}
-
-#include "util_functions.def"
-
-/** @}
- */
Index: pace/app/tester/util.h
===================================================================
--- uspace/app/tester/util.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tester
- * @{
- */
-/** @file
- */
-
-#ifndef UTIL_H_
-#define UTIL_H_
-
-#include <stdio.h>
-#include <inttypes.h>
-#include "tester.h"
-
-#define ASSERT_EQ_FN_DEF(type, fmt, fmtx) \
-extern bool assert_eq_fn_##type(type, type, const char *);
-
-#include "util_functions.def"
-
-#define ASSERT_EQ_64(exp, act, msg) \
-{if (assert_eq_fn_uint64_t(exp, act, #act)) {return msg;}}
-
-#define ASSERT_EQ_32(exp, act, msg) \
-{if (assert_eq_fn_uint32_t(exp, act, #act)) {return msg;}}
-
-#define ASSERT_EQ_16(exp, act, msg) \
-{if (assert_eq_fn_uint16_t(exp, act, #act)) {return msg;}}
-
-#define ASSERT_EQ_8(exp, act, msg) \
-{if (assert_eq_fn_uint8_t(exp, act, #act)) {return msg;}}
-
-#endif
-
-/** @}
- */
Index: pace/app/tester/util_functions.def
===================================================================
--- uspace/app/tester/util_functions.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-ASSERT_EQ_FN_DEF(uint8_t, "hhu", "hhx")
-ASSERT_EQ_FN_DEF(uint16_t, "hu", "hx")
-ASSERT_EQ_FN_DEF(uint32_t, "u", "x")
-ASSERT_EQ_FN_DEF(uint64_t, PRIu64, PRIx64)
Index: pace/app/tester/vfs/vfs1.c
===================================================================
--- uspace/app/tester/vfs/vfs1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str_error.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <dirent.h>
-#include <loc.h>
-#include "../tester.h"
-
-#define TEST_DIRECTORY  "/tmp/testdir"
-#define TEST_FILE       TEST_DIRECTORY "/testfile"
-#define TEST_FILE2      TEST_DIRECTORY "/nextfile"
-
-#define MAX_DEVICE_NAME  32
-#define BUF_SIZE         16
-
-static char text[] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit";
-
-static const char *read_root(void)
-{
-	TPRINTF("Opening the root directory...");
-
-	DIR *dirp = opendir("/");
-	if (!dirp) {
-		TPRINTF("\n");
-		return "opendir() failed";
-	} else
-		TPRINTF("OK\n");
-
-	struct dirent *dp;
-	while ((dp = readdir(dirp)))
-		TPRINTF(" node \"%s\"\n", dp->d_name);
-	closedir(dirp);
-
-	return NULL;
-}
-
-const char *test_vfs1(void)
-{
-	aoff64_t pos = 0;
-	errno_t rc;
-
-	rc = vfs_link_path(TEST_DIRECTORY, KIND_DIRECTORY, NULL);
-	if (rc != EOK) {
-		TPRINTF("rc=%s\n", str_error_name(rc));
-		return "vfs_link_path() failed";
-	}
-	TPRINTF("Created directory %s\n", TEST_DIRECTORY);
-
-	int fd0;
-	rc = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE,
-	    MODE_READ | MODE_WRITE, &fd0);
-	if (rc != EOK)
-		return "vfs_lookup_open() failed";
-	TPRINTF("Created file %s (fd=%d)\n", TEST_FILE, fd0);
-
-	size_t size = sizeof(text);
-	size_t cnt;
-	rc  = vfs_write(fd0, &pos, text, size, &cnt);
-	if (rc != EOK)
-		return "write() failed";
-	TPRINTF("Written %zd bytes\n", cnt);
-
-	pos = 0;
-
-	char buf[BUF_SIZE];
-	TPRINTF("read..\n");
-	while ((rc = vfs_read(fd0, &pos, buf, BUF_SIZE, &cnt))) {
-		TPRINTF("read returns rc = %s, cnt = %zu\n", str_error_name(rc), cnt);
-		if (rc != EOK)
-			return "read() failed";
-
-		int icnt = (int) cnt;
-		if ((size_t) icnt != cnt) {
-			/* Count overflow, just to be sure. */
-			TPRINTF("Read %zd bytes\n", cnt);
-		} else {
-			TPRINTF("Read %zd bytes: \"%.*s\"\n", cnt, icnt, buf);
-		}
-	}
-
-	vfs_put(fd0);
-
-	const char *rv = read_root();
-	if (rv != NULL)
-		return rv;
-
-	if (vfs_rename_path(TEST_FILE, TEST_FILE2) != EOK)
-		return "vfs_rename_path() failed";
-	TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2);
-
-	if (vfs_unlink_path(TEST_FILE2) != EOK)
-		return "vfs_unlink_path() failed";
-	TPRINTF("Unlinked %s\n", TEST_FILE2);
-
-	if (vfs_unlink_path(TEST_DIRECTORY) != EOK)
-		return "vfs_unlink_path() failed";
-	TPRINTF("Removed directory %s\n", TEST_DIRECTORY);
-
-	rv = read_root();
-	if (rv != NULL)
-		return rv;
-
-	return NULL;
-}
Index: pace/app/tester/vfs/vfs1.def
===================================================================
--- uspace/app/tester/vfs/vfs1.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-{
-	"vfs1",
-	"VFS test",
-	&test_vfs1,
-	true
-},
Index: pace/app/testread/doc/doxygroups.h
===================================================================
--- uspace/app/testread/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup testread testread
- * @brief Verifies that the filesystem reads the files correctly.
- * @ingroup apps
- */
Index: pace/app/testread/meson.build
===================================================================
--- uspace/app/testread/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('testread.c')
Index: pace/app/testread/testread.c
===================================================================
--- uspace/app/testread/testread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup testread
- * @{
- */
-
-/**
- * @file	testread.c
- * This program checks if the file contains a pattern of increasing
- * 64 bit unsigned integers (that may overflow at some point)
- * stored in little endian byte order.
- * This is to verify that the filesystem reads
- * the files correctly.
- * If the file does not contain specified pattern, it stops
- * at the point where the file does not match and prints
- * the byte offset at which the error occured.
- * While checking the file, the program displays how many megabytes
- * it has already read, how long it took to read the last megabyte
- * and current and average read speed.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <mem.h>
-#include <loc.h>
-#include <byteorder.h>
-#include <inttypes.h>
-#include <errno.h>
-#include <time.h>
-#include <offset.h>
-#include <str.h>
-
-#define NAME	"testread"
-#define BUFELEMS 1024
-#define MBYTE (1024*1024)
-
-static void syntax_print(void);
-
-int main(int argc, char **argv)
-{
-
-	FILE *file;
-	char *file_name;
-	uint64_t *buf;
-	uint64_t expected;
-	aoff64_t offset;
-	aoff64_t next_mark;
-	aoff64_t last_mark;
-	unsigned int i;
-	bool check_enabled = true;
-	bool progress = true;
-
-	if (argc < 2) {
-		printf(NAME ": Error, argument missing.\n");
-		syntax_print();
-		return 1;
-	}
-
-	/* Skip program name */
-	--argc;
-	++argv;
-
-	if (argc > 0 && str_cmp(*argv, "--no-check") == 0) {
-		check_enabled = false;
-		--argc;
-		++argv;
-	}
-
-	if (argc > 0 && str_cmp(*argv, "--no-progress") == 0) {
-		progress = false;
-		--argc;
-		++argv;
-	}
-
-	if (argc != 1) {
-		printf(NAME ": Error, unexpected argument.\n");
-		syntax_print();
-		return 1;
-	}
-
-	file_name = *argv;
-
-	buf = calloc(BUFELEMS, sizeof(uint64_t));
-	if (buf == NULL) {
-		printf("Failed allocating buffer\n");
-		return 1;
-	}
-
-	file = fopen(file_name, "r");
-	if (file == NULL) {
-		printf("Failed opening file\n");
-		return 1;
-	}
-
-	expected = 0;
-	offset = 0;
-	next_mark = 0;
-	last_mark = 0;
-	struct timespec prev_time;
-	struct timespec start_time;
-	getuptime(&start_time);
-	prev_time = start_time;
-
-	while (!feof(file)) {
-		size_t elems = fread(buf, sizeof(uint64_t), BUFELEMS, file);
-		if (ferror(file)) {
-			printf("Failed reading file\n");
-			fclose(file);
-			free(buf);
-			return 1;
-		}
-
-		for (i = 0; i < elems; i++) {
-			if (check_enabled && uint64_t_le2host(buf[i]) != expected) {
-				printf("Unexpected value at offset %" PRIuOFF64 "\n", offset);
-				fclose(file);
-				free(buf);
-				return 2;
-			}
-			expected++;
-			offset += sizeof(uint64_t);
-		}
-
-		if (progress && offset >= next_mark) {
-			struct timespec cur_time;
-			getuptime(&cur_time);
-
-			uint32_t last_run = cur_time.tv_sec - prev_time.tv_sec;
-			uint32_t total_time = cur_time.tv_sec - start_time.tv_sec;
-			if (last_run > 0 && total_time > 0) {
-				printf("%" PRIuOFF64 "M - time: %u s, "
-				    "cur: %" PRIuOFF64 " B/s, avg: %" PRIuOFF64 " B/s\n",
-				    offset / MBYTE, last_run,
-				    (offset - last_mark) / last_run,
-				    offset / total_time);
-				prev_time = cur_time;
-				last_mark = offset;
-			}
-			next_mark += MBYTE;
-		}
-	}
-
-	struct timespec final_time;
-	getuptime(&final_time);
-
-	uint32_t total_run_time = final_time.tv_sec - start_time.tv_sec;
-	if (total_run_time > 0) {
-		printf("total bytes: %" PRIuOFF64
-		    ", total time: %u s, avg speed: %" PRIuOFF64 " B/s\n",
-		    offset,
-		    total_run_time,
-		    offset / total_run_time);
-	}
-
-	fclose(file);
-	free(buf);
-
-	return 0;
-}
-
-static void syntax_print(void)
-{
-	printf("syntax: testread <filename>\n");
-}
-
-/**
- * @}
- */
Index: pace/app/testrunner/main.c
===================================================================
--- uspace/app/testrunner/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,264 +1,0 @@
-/*
- * Copyright (c) 2018 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <task.h>
-#include <vfs/vfs.h>
-#include <dirent.h>
-#include <str.h>
-
-static errno_t run_test(const char *logfile, const char *logmode,
-    const char *path, const char *const args[], task_exit_t *ex, int *retval)
-{
-	FILE *f = fopen(logfile, logmode);
-	if (!f) {
-		fprintf(stderr, "Can't open file %s: %s\n",
-		    logfile, str_error(errno));
-		return errno;
-	}
-
-	int h;
-	errno_t rc = vfs_fhandle(f, &h);
-	if (rc != EOK) {
-		fprintf(stderr, "Error getting file handle: %s\n",
-		    str_error_name(rc));
-		fclose(f);
-		return rc;
-	}
-
-	task_id_t id;
-	task_wait_t wait;
-
-	rc = task_spawnvf(&id, &wait, path, args, -1, h, h);
-	if (rc != EOK) {
-		fprintf(stderr, "Task spawning failed: %s\n",
-		    str_error_name(rc));
-		fclose(f);
-		return rc;
-	}
-
-	rc = task_wait(&wait, ex, retval);
-	if (rc != EOK) {
-		fprintf(stderr, "Task wait failed: %s\n",
-		    str_error_name(rc));
-		fclose(f);
-		return rc;
-	}
-
-	// TODO: check that we are managing resources correctly
-	fclose(f);
-	return EOK;
-}
-
-static void run_tester(const char *logfile)
-{
-	const char *const tests[] = {
-		"thread1",
-		"setjmp1",
-		"print1",
-		"print2",
-		"print3",
-		"print4",
-		"print5",
-		"print6",
-		"stdio1",
-		"stdio2",
-		"logger1",
-		"fault1",
-		"fault2",
-		"fault3",
-		"float1",
-		"float2",
-		"vfs1",
-		"ping_pong",
-		"malloc1",
-		// FIXME: malloc2 doesn't work as expected
-		// "malloc2",
-		"malloc3",
-		"mapping1",
-		"pager1",
-		// "serial1",
-		// "chardev1",
-	};
-
-	int tests_count = sizeof(tests) / sizeof(const char *);
-
-	task_exit_t ex;
-	int retval;
-	int failed = 0;
-
-	const char *app = "/app/tester";
-
-	for (int i = 0; i < tests_count; i++) {
-		const char *const args[] = { app, tests[i], NULL };
-		errno_t rc = run_test(logfile, "a", app, args, &ex, &retval);
-		if (rc != EOK) {
-			/* Reason already printed in run_test(). */
-			continue;
-		}
-
-		if (ex != TASK_EXIT_NORMAL) {
-			fprintf(stderr, "tester %s CRASHED\n",
-			    tests[i]);
-			failed++;
-			continue;
-		}
-
-		if (retval == 0) {
-			printf("tester %s ok\n", tests[i]);
-		} else {
-			printf("tester %s FAILED\n", tests[i]);
-			failed++;
-		}
-	}
-
-	printf("tester: %d failed tests\n", failed);
-}
-
-static void run_tester_fault(const char *logfile)
-{
-	task_exit_t ex;
-	int retval;
-
-	const char *app = "/app/tester";
-	const char *const args[] = { app, "fault1", NULL };
-	errno_t rc = run_test(logfile, "w", app, args, &ex, &retval);
-	if (rc != EOK) {
-		/* Reason already printed in run_test(). */
-		return;
-	}
-
-	if (ex != TASK_EXIT_UNEXPECTED) {
-		fprintf(stderr, "`tester fault1` unexpectedly"
-		    " didn't terminate unexpectedly\n");
-		return;
-	}
-
-	printf("`tester fault1`: terminated as expected\n");
-}
-
-static void run_pcut_tests(void)
-{
-	printf("Running all pcut tests...\n");
-
-	DIR *d = opendir("/test");
-	if (!d)
-		return;
-
-	struct dirent *e;
-
-	while ((e = readdir(d))) {
-		if (str_lcmp(e->d_name, "test-", 5) != 0)
-			continue;
-
-		task_exit_t ex;
-		int retval;
-
-		char *bin;
-		if (asprintf(&bin, "/test/%s", e->d_name) < 0) {
-			fprintf(stderr, "out of memory\n");
-			exit(EXIT_FAILURE);
-		}
-
-		char *logfile;
-		if (asprintf(&logfile, "/data/web/result-%s.txt", e->d_name) < 0) {
-			fprintf(stderr, "out of memory\n");
-			exit(EXIT_FAILURE);
-		}
-
-		const char *const args[] = { bin, NULL };
-		errno_t rc = run_test(logfile, "w", bin, args, &ex, &retval);
-		free(bin);
-		free(logfile);
-
-		if (rc != EOK) {
-			/* Reason already printed in run_test(). */
-			return;
-		}
-
-		if (ex != TASK_EXIT_NORMAL) {
-			fprintf(stderr, "%s CRASHED\n", e->d_name);
-			return;
-		}
-
-		if (retval == 0) {
-			printf("%s ok\n", e->d_name);
-		} else {
-			printf("%s FAILED\n", e->d_name);
-		}
-	}
-
-	closedir(d);
-}
-
-static void gen_index(const char *fname)
-{
-	FILE *f = fopen(fname, "w");
-	if (!f) {
-		fprintf(stderr, "Can't open %s for writing: %s\n", fname,
-		    str_error_name(errno));
-		return;
-	}
-
-	fprintf(f, "<html><head><title>HelenOS test results"
-	    "</title></head><body>\n");
-	fprintf(f, "<h1>HelenOS test results</h1><ul>\n");
-
-	fprintf(f, "<li><a href=\"result-tester.txt\">tester</a></li>\n");
-
-	DIR *d = opendir("/test");
-	if (d) {
-		struct dirent *e;
-
-		while ((e = readdir(d))) {
-			if (str_lcmp(e->d_name, "test-", 5) != 0)
-				continue;
-
-			fprintf(f, "<li><a href=\"result-%s.txt\">%s"
-			    "</a></li>\n", e->d_name, e->d_name);
-		}
-	}
-
-	fprintf(f, "</ul></body></html>\n");
-	fclose(f);
-}
-
-int main(int argc, char **argv)
-{
-	run_tester("/data/web/result-tester.txt");
-	run_tester_fault("/tmp/tester_fault.log");
-	run_pcut_tests();
-
-	const char *fname = "/data/web/test.html";
-	printf("Generating HTML report in %s\n", fname);
-	gen_index(fname);
-	return EXIT_SUCCESS;
-}
Index: pace/app/testrunner/meson.build
===================================================================
--- uspace/app/testrunner/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2018 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c')
Index: pace/app/testwrit/doc/doxygroups.h
===================================================================
--- uspace/app/testwrit/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup testwrit testwrit
- * @ingroup apps
- */
Index: pace/app/testwrit/meson.build
===================================================================
--- uspace/app/testwrit/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Frantisek Princ
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('testwrit.c')
Index: pace/app/testwrit/testwrit.c
===================================================================
--- uspace/app/testwrit/testwrit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2011 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup testwrit
- * @{
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-
-#define BUF_SIZE  1024
-
-int main(int argc, char *argv[])
-{
-	char buffer[BUF_SIZE];
-	uint64_t iterations, i;
-	FILE *file;
-	char *file_name;
-
-	/* Prepare some example data */
-	memset(buffer, 0xcafebabe, BUF_SIZE);
-
-	if (argc != 3) {
-		printf("syntax: testwrit <iterations> <target file>\n");
-		return 1;
-	}
-
-	char *end;
-	iterations = strtoul(argv[1], &end, 10);
-	file_name = argv[2];
-
-	/* Open target file */
-	file = fopen(file_name, "a");
-	if (file == NULL) {
-		printf("Failed opening file\n");
-		return 1;
-	}
-
-	/* Writing loop */
-	for (i = 0; i < iterations; ++i) {
-		fwrite(buffer, 1, BUF_SIZE, file);
-	}
-
-	fclose(file);
-
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/app/tetris/doc/doxygroups.h
===================================================================
--- uspace/app/tetris/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup tetris tetris
- * @brief Tetris
- * @ingroup apps
- */
Index: pace/app/tetris/meson.build
===================================================================
--- uspace/app/tetris/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'console' ]
-src = files(
-	'shapes.c',
-	'scores.c',
-	'tetris.c',
-	'screen.c',
-)
Index: pace/app/tetris/scores.c
===================================================================
--- uspace/app/tetris/scores.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * scores.c 8.1 (Berkeley) 5/31/93
- * NetBSD: scores.c,v 1.2 1995/04/22 07:42:38 cgd
- * OpenBSD: scores.c,v 1.11 2006/04/20 03:25:36 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Score code for Tetris, by Darren Provine (kilroy@gboro.glassboro.edu)
- * modified 22 January 1992, to limit the number of entries any one
- * person has.
- *
- * Major whacks since then.
- */
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <vfs/vfs.h>
-#include <stdlib.h>
-#include <time.h>
-#include "screen.h"
-#include "tetris.h"
-#include "scores.h"
-
-/*
- * Within this code, we can hang onto one extra "high score", leaving
- * room for our current score (whether or not it is high).
- *
- * We also sometimes keep tabs on the "highest" score on each level.
- * As long as the scores are kept sorted, this is simply the first one at
- * that level.
- */
-
-#define NUMSPOTS  (MAXHISCORES + 1)
-#define NLEVELS   (MAXLEVEL + 1)
-
-static struct highscore scores[NUMSPOTS];
-
-/** Copy from hiscore table score with index src to dest
- *
- */
-static void copyhiscore(int dest, int src)
-{
-	str_cpy(scores[dest].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
-	    scores[src].hs_name);
-	scores[dest].hs_score = scores[src].hs_score;
-	scores[dest].hs_level = scores[src].hs_level;
-}
-
-void showscores(int firstgame)
-{
-	int i;
-
-	clear_screen();
-	moveto(10, 0);
-	printf("\tRank \tLevel \tName\t                     points\n");
-	printf("\t========================================================\n");
-
-	for (i = 0; i < NUMSPOTS - 1; i++)
-		printf("\t%6d %6d %-16s %20d\n",
-		    i + 1, scores[i].hs_level, scores[i].hs_name, scores[i].hs_score);
-
-	if (!firstgame) {
-		printf("\t========================================================\n");
-		printf("\t  Last %6d %-16s %20d\n",
-		    scores[NUMSPOTS - 1].hs_level, scores[NUMSPOTS - 1].hs_name, scores[NUMSPOTS - 1].hs_score);
-	}
-
-	printf("\n\n\n\n\tPress any key to return to main menu.");
-	getchar();
-}
-
-void insertscore(int score, int level)
-{
-	int i;
-	int j;
-	size_t off;
-	cons_event_t ev;
-	kbd_event_t *kev;
-	errno_t rc;
-
-	clear_screen();
-	moveto(10, 10);
-	fputs("Insert your name: ", stdout);
-	str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
-	    "Player");
-	i = 6;
-	off = 6;
-
-	moveto(10, 28);
-	printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME - i,
-	    "........................................");
-
-	while (true) {
-		console_flush(console);
-		rc = console_get_event(console, &ev);
-		if (rc != EOK)
-			exit(1);
-
-		if (ev.type != CEV_KEY || ev.ev.key.type == KEY_RELEASE)
-			continue;
-
-		if ((ev.ev.key.mods & (KM_CTRL | KM_ALT)) != 0)
-			continue;
-
-		kev = &ev.ev.key;
-
-		if (kev->key == KC_ENTER || kev->key == KC_NENTER)
-			break;
-
-		if (kev->key == KC_BACKSPACE) {
-			if (i > 0) {
-				char32_t uc;
-
-				--i;
-				while (off > 0) {
-					--off;
-					size_t otmp = off;
-					uc = str_decode(scores[NUMSPOTS - 1].hs_name,
-					    &otmp, STR_BOUNDS(MAXLOGNAME) + 1);
-					if (uc != U_SPECIAL)
-						break;
-				}
-
-				scores[NUMSPOTS - 1].hs_name[off] = '\0';
-			}
-		} else if (kev->c != '\0') {
-			if (i < (MAXLOGNAME - 1)) {
-				if (chr_encode(kev->c, scores[NUMSPOTS - 1].hs_name,
-				    &off, STR_BOUNDS(MAXLOGNAME) + 1) == EOK) {
-					++i;
-				}
-				scores[NUMSPOTS - 1].hs_name[off] = '\0';
-			}
-		}
-
-		moveto(10, 28);
-		printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME - i,
-		    "........................................");
-	}
-
-	scores[NUMSPOTS - 1].hs_score = score;
-	scores[NUMSPOTS - 1].hs_level = level;
-
-	i = NUMSPOTS - 1;
-	while ((i > 0) && (scores[i - 1].hs_score < score))
-		i--;
-
-	for (j = NUMSPOTS - 2; j > i; j--)
-		copyhiscore(j, j - 1);
-
-	copyhiscore(i, NUMSPOTS - 1);
-}
-
-void initscores(void)
-{
-	int i;
-	for (i = 0; i < NUMSPOTS; i++) {
-		str_cpy(scores[i].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, "HelenOS Team");
-		scores[i].hs_score = (NUMSPOTS - i) * 200;
-		scores[i].hs_level = (i + 1 > MAXLEVEL ? MAXLEVEL : i + 1);
-	}
-}
-
-errno_t loadscores(void)
-{
-	FILE *f;
-	size_t cnt;
-	int rc;
-
-	f = fopen("/w/data/tetris.sco", "rb");
-	if (f == NULL)
-		return ENOENT;
-
-	cnt = fread(scores, sizeof(struct highscore), NUMSPOTS, f);
-	rc = fclose(f);
-
-	if (cnt != NUMSPOTS || rc != 0)
-		return EIO;
-
-	return EOK;
-}
-
-void savescores(void)
-{
-	FILE *f;
-	size_t cnt;
-	int rc;
-
-	f = fopen("/w/data/tetris.sco", "wb");
-	if (f == NULL) {
-		printf("Error creating table\n");
-		return;
-	}
-
-	cnt = fwrite(scores, sizeof(struct highscore), NUMSPOTS, f);
-	rc = fclose(f);
-
-	if (cnt != NUMSPOTS || rc != 0)
-		printf("Error saving score table\n");
-}
-
-/** @}
- */
Index: pace/app/tetris/scores.h
===================================================================
--- uspace/app/tetris/scores.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * scores.h 8.1 (Berkeley) 5/31/93
- * NetBSD: scores.h,v 1.2 1995/04/22 07:42:40 cgd
- * OpenBSD: scores.h,v 1.5 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris scores.
- */
-
-#include <time.h>
-#include <str.h>
-
-#define MAXLOGNAME   16
-#define MAXHISCORES  10
-#define MAXSCORES    9  /* maximum high score entries per person */
-#define EXPIRATION   (5L * 365 * 24 * 60 * 60)
-
-struct highscore {
-	char hs_name[STR_BOUNDS(MAXLOGNAME) + 1];  /* login name */
-	int hs_score;                              /* raw score */
-	int hs_level;                              /* play level */
-	time_t hs_time;                            /* time at game end */
-};
-
-extern void showscores(int);
-extern void initscores(void);
-extern void insertscore(int score, int level);
-extern errno_t loadscores(void);
-extern void savescores(void);
-
-/** @}
- */
Index: pace/app/tetris/screen.c
===================================================================
--- uspace/app/tetris/screen.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,453 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * screen.c 8.1 (Berkeley) 5/31/93
- * NetBSD: screen.c,v 1.4 1995/04/29 01:11:36 mycroft
- * OpenBSD: screen.c,v 1.13 2006/04/20 03:25:36 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris screen control.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <async.h>
-#include <stdbool.h>
-#include <io/console.h>
-#include <io/style.h>
-#include "screen.h"
-#include "tetris.h"
-
-#define STOP  (B_COLS - 3)
-
-static cell curscreen[B_SIZE];  /* non-zero => standout (or otherwise marked) */
-static int curscore;
-static int isset;               /* true => terminal is in game mode */
-
-static bool use_rgb;          /* true => use RGB colors */
-static bool use_color;          /* true => use indexed colors */
-
-static const struct shape *lastshape;
-
-static usec_t timeleft = 0;
-
-bool size_changed;
-console_ctrl_t *console;
-
-/*
- * putstr() is for unpadded strings (either as in termcap(5) or
- * simply literal strings);
- */
-static inline void putstr(const char *s)
-{
-	while (*s)
-		putchar(*(s++));
-}
-
-static void start_standout(uint32_t color)
-{
-	uint8_t bg;
-	uint8_t attr;
-
-	console_flush(console);
-	if (use_rgb) {
-		console_set_rgb_color(console, color, 0xffffff);
-	} else if (use_color) {
-		bg = 0x00;
-		attr = 0;
-		if ((color & 0xff0000) != 0)
-			bg |= 0x4;
-		if ((color & 0x00ff00) != 0)
-			bg |= 0x2;
-		if ((color & 0x0000ff) != 0)
-			bg |= 0x1;
-		console_set_color(console, bg, 0x00, attr);
-	}
-}
-
-static void resume_normal(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_NORMAL);
-}
-
-void clear_screen(void)
-{
-	console_clear(console);
-	moveto(0, 0);
-}
-
-/*
- * Clear the screen, forgetting the current contents in the process.
- */
-void scr_clear(void)
-{
-	resume_normal();
-	console_clear(console);
-	curscore = -1;
-	memset(curscreen, 0, sizeof(curscreen));
-}
-
-/*
- * Set up screen
- */
-void scr_init(void)
-{
-	console_cursor_visibility(console, 0);
-	resume_normal();
-	scr_set();
-}
-
-void moveto(sysarg_t r, sysarg_t c)
-{
-	console_flush(console);
-	console_set_pos(console, c, r);
-}
-
-winsize_t winsize;
-
-static errno_t get_display_size(winsize_t *ws)
-{
-	return console_get_size(console, &ws->ws_col, &ws->ws_row);
-}
-
-static void get_display_color_sup(bool *rgb, bool *color)
-{
-	sysarg_t ccap;
-	errno_t rc = console_get_color_cap(console, &ccap);
-
-	if (rc != EOK) {
-		*rgb = false;
-		*color = false;
-		return;
-	}
-
-	if ((ccap & CONSOLE_CAP_CURSORCTL) == 0) {
-		stop("Your screen does not support cursor control.\n");
-		return;
-	}
-	*rgb = ((ccap & CONSOLE_CAP_RGB) == CONSOLE_CAP_RGB);
-	*color = ((ccap & CONSOLE_CAP_INDEXED) == CONSOLE_CAP_INDEXED);
-}
-
-/*
- * Set up screen mode.
- */
-void scr_set(void)
-{
-	winsize_t ws;
-
-	Rows = 0;
-	Cols = 0;
-
-	if (get_display_size(&ws) == 0) {
-		Rows = ws.ws_row;
-		Cols = ws.ws_col;
-	}
-
-	get_display_color_sup(&use_rgb, &use_color);
-
-	if ((Rows < MINROWS) || (Cols < MINCOLS)) {
-		char smallscr[55];
-
-		snprintf(smallscr, sizeof(smallscr),
-		    "the screen is too small (must be at least %dx%d)\n",
-		    MINROWS, MINCOLS);
-		stop(smallscr);
-	}
-	isset = 1;
-
-	scr_clear();
-}
-
-/*
- * End screen mode.
- */
-void scr_end(void)
-{
-	console_cursor_visibility(console, 1);
-}
-
-void stop(const char *why)
-{
-	if (isset)
-		scr_end();
-
-	fprintf(stderr, "aborting: %s", why);
-	exit(1);
-}
-
-/*
- * Update the screen.
- */
-void scr_update(void)
-{
-	cell *bp;
-	cell *sp;
-	cell so;
-	cell cur_so = 0;
-	int i;
-	int j;
-	int ccol;
-
-	/* Always leave cursor after last displayed point */
-	curscreen[D_LAST * B_COLS - 1] = -1;
-
-	if (score != curscore) {
-		moveto(0, 0);
-		printf("Score: %d", score);
-		curscore = score;
-	}
-
-	/* Draw preview of next pattern */
-	if ((showpreview) && (nextshape != lastshape)) {
-		int i;
-		static int r = 5, c = 2;
-		int tr, tc, t;
-
-		lastshape = nextshape;
-
-		/* Clean */
-		resume_normal();
-		moveto(r - 1, c - 1);
-		putstr("          ");
-		moveto(r, c - 1);
-		putstr("          ");
-		moveto(r + 1, c - 1);
-		putstr("          ");
-		moveto(r + 2, c - 1);
-		putstr("          ");
-
-		moveto(r - 3, c - 2);
-		putstr("Next shape:");
-
-		/* Draw */
-		start_standout(nextshape->color);
-		moveto(r, 2 * c);
-		putstr("  ");
-		for (i = 0; i < 3; i++) {
-			t = c + r * B_COLS;
-			t += nextshape->off[i];
-
-			tr = t / B_COLS;
-			tc = t % B_COLS;
-
-			moveto(tr, 2 * tc);
-			putstr("  ");
-		}
-		resume_normal();
-	}
-
-	bp = &board[D_FIRST * B_COLS];
-	sp = &curscreen[D_FIRST * B_COLS];
-	for (j = D_FIRST; j < D_LAST; j++) {
-		ccol = -1;
-		for (i = 0; i < B_COLS; bp++, sp++, i++) {
-			if (*sp == (so = *bp))
-				continue;
-
-			*sp = so;
-			if (i != ccol) {
-				if (cur_so) {
-					resume_normal();
-					cur_so = 0;
-				}
-				moveto(RTOD(j), CTOD(i));
-			}
-
-			if (so != cur_so) {
-				if (so)
-					start_standout(so);
-				else
-					resume_normal();
-				cur_so = so;
-			}
-			putstr("  ");
-
-			ccol = i + 1;
-			/*
-			 * Look ahead a bit, to avoid extra motion if
-			 * we will be redrawing the cell after the next.
-			 * Motion probably takes four or more characters,
-			 * so we save even if we rewrite two cells
-			 * `unnecessarily'.  Skip it all, though, if
-			 * the next cell is a different color.
-			 */
-
-			if ((i > STOP) || (sp[1] != bp[1]) || (so != bp[1]))
-				continue;
-
-			if (sp[2] != bp[2])
-				sp[1] = -1;
-			else if ((i < STOP) && (so == bp[2]) && (sp[3] != bp[3])) {
-				sp[2] = -1;
-				sp[1] = -1;
-			}
-		}
-	}
-
-	if (cur_so)
-		resume_normal();
-
-	console_flush(console);
-}
-
-/*
- * Write a message (set != 0), or clear the same message (set == 0).
- * (We need its length in case we have to overwrite with blanks.)
- */
-void scr_msg(char *s, bool set)
-{
-	int l = str_size(s);
-
-	moveto(Rows - 2, ((Cols - l) >> 1) - 1);
-
-	if (set)
-		putstr(s);
-	else
-		while (--l >= 0)
-			(void) putchar(' ');
-}
-
-/** Sleep for the current turn time
- *
- * Eat any input that might be available.
- *
- */
-void tsleep(void)
-{
-	usec_t timeout = fallrate;
-	errno_t rc;
-
-	while (timeout > 0) {
-		cons_event_t event;
-
-		rc = console_get_event_timeout(console, &event, &timeout);
-		if (rc == ETIMEOUT)
-			break;
-		if (rc != EOK)
-			exit(1);
-	}
-}
-
-/** Get char with timeout
- *
- */
-int tgetchar(void)
-{
-	errno_t rc;
-
-	/*
-	 * Reset timeleft to fallrate whenever it is not positive
-	 * and increase speed.
-	 */
-
-	if (timeleft <= 0) {
-		faster();
-		timeleft = fallrate;
-	}
-
-	/*
-	 * Wait to see if there is any input. If so, take it and
-	 * update timeleft so that the next call to tgetchar()
-	 * will not wait as long. If there is no input,
-	 * make timeleft zero and return -1.
-	 */
-
-	char32_t c = 0;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		rc = console_get_event_timeout(console, &event, &timeleft);
-		if (rc == ETIMEOUT) {
-			timeleft = 0;
-			return -1;
-		}
-		if (rc != EOK)
-			exit(1);
-
-		if (event.type == CEV_RESIZE)
-			size_changed = true;
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	return (int) c;
-}
-
-/** Get char without timeout
- *
- */
-int twait(void)
-{
-	char32_t c = 0;
-	errno_t rc;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		rc = console_get_event(console, &event);
-		if (rc == ETIMEOUT)
-			return -1;
-		if (rc != EOK)
-			exit(1);
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	return (int) c;
-}
-
-/** @}
- */
Index: pace/app/tetris/screen.h
===================================================================
--- uspace/app/tetris/screen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * screen.h 8.1 (Berkeley) 5/31/93
- * NetBSD: screen.h,v 1.2 1995/04/22 07:42:42 cgd
- * OpenBSD: screen.h,v 1.5 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * putpad() is for padded strings with count = 1.
- */
-#define putpad(s)  tputs(s, 1, put)
-
-#include <types/common.h>
-#include <io/console.h>
-#include <async.h>
-#include <stdbool.h>
-
-typedef struct {
-	sysarg_t ws_row;
-	sysarg_t ws_col;
-} winsize_t;
-
-extern console_ctrl_t *console;
-extern winsize_t winsize;
-extern bool size_changed;
-
-extern void moveto(sysarg_t r, sysarg_t c);
-extern void clear_screen(void);
-
-extern int put(int);
-extern void scr_clear(void);
-extern void scr_end(void);
-extern void scr_init(void);
-extern void scr_msg(char *, bool);
-extern void scr_set(void);
-extern void scr_update(void);
-
-extern void tsleep(void);
-extern int tgetchar(void);
-extern int twait(void);
-
-/** @}
- */
Index: pace/app/tetris/shapes.c
===================================================================
--- uspace/app/tetris/shapes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * shapes.c 8.1 (Berkeley) 5/31/93
- * NetBSD: shapes.c,v 1.2 1995/04/22 07:42:44 cgd
- * OpenBSD: shapes.c,v 1.8 2004/07/10 07:26:24 deraadt
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris shapes and related routines.
- *
- * Note that the first 7 are `well known'.
- */
-
-#include "tetris.h"
-
-#define TL  (-B_COLS - 1)  /* top left */
-#define TC  (-B_COLS)      /* top center */
-#define TR  (-B_COLS + 1)  /* top right */
-#define ML  -1             /* middle left */
-#define MR  1              /* middle right */
-#define BL  (B_COLS - 1)   /* bottom left */
-#define BC  B_COLS         /* bottom center */
-#define BR  (B_COLS + 1)   /* bottom right */
-
-const struct shape shapes[] = {
-	/*  0 */  {  7,  7, { TL, TC, MR }, 0x00aaaa },
-	/*  1 */  {  8,  8, { TC, TR, ML }, 0x00aa00 },
-	/*  2 */  {  9, 11, { ML, MR, BC }, 0xaa5500 },
-	/*  3 */  {  3,  3, { TL, TC, ML }, 0x0000aa },
-	/*  4 */  { 12, 14, { ML, BL, MR }, 0xaa00aa },
-	/*  5 */  { 15, 17, { ML, BR, MR }, 0xffa500 },
-	/*  6 */  { 18, 18, { ML, MR, 2  }, 0xaa0000 },  /* sticks out */
-	/*  7 */  {  0,  0, { TC, ML, BL }, 0x00aaaa },
-	/*  8 */  {  1,  1, { TC, MR, BR }, 0x00aa00 },
-	/*  9 */  { 10,  2, { TC, MR, BC }, 0xaa5500 },
-	/* 10 */  { 11,  9, { TC, ML, MR }, 0xaa5500 },
-	/* 11 */  {  2, 10, { TC, ML, BC }, 0xaa5500 },
-	/* 12 */  { 13,  4, { TC, BC, BR }, 0xaa00aa },
-	/* 13 */  { 14, 12, { TR, ML, MR }, 0xaa00aa },
-	/* 14 */  {  4, 13, { TL, TC, BC }, 0xaa00aa },
-	/* 15 */  { 16,  5, { TR, TC, BC }, 0xffa500 },
-	/* 16 */  { 17, 15, { TL, MR, ML }, 0xffa500 },
-	/* 17 */  {  5, 16, { TC, BC, BL }, 0xffa500 },
-	/* 18 */  {  6,  6, { TC, BC, 2 * B_COLS }, 0xaa0000 }  /* sticks out */
-};
-
-/*
- * Return true iff the given shape fits in the given position,
- * taking the current board into account.
- */
-int fits_in(const struct shape *shape, int pos)
-{
-	const int *o = shape->off;
-
-	if ((board[pos]) || (board[pos + *o++]) || (board[pos + *o++]) ||
-	    (board[pos + *o]))
-		return 0;
-
-	return 1;
-}
-
-/*
- * Write the given shape into the current board, turning it on
- * if `onoff' is 1, and off if `onoff' is 0.
- */
-void place(const struct shape *shape, int pos, int onoff)
-{
-	const int *o = shape->off;
-
-	board[pos] = onoff ? shape->color : 0x000000;
-	board[pos + *o++] = onoff ? shape->color : 0x000000;
-	board[pos + *o++] = onoff ? shape->color : 0x000000;
-	board[pos + *o] = onoff ? shape->color : 0x000000;
-}
-
-/** @}
- */
Index: pace/app/tetris/tetris.c
===================================================================
--- uspace/app/tetris/tetris.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,460 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * tetris.c 8.1 (Berkeley) 5/31/93
- * NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd
- * OpenBSD: tetris.c,v 1.21 2006/04/20 03:24:12 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-static volatile const char copyright[] =
-    "@(#) Copyright (c) 1992, 1993\n"
-    "\tThe Regents of the University of California.  All rights reserved.\n";
-
-#include <time.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <getopt.h>
-#include "scores.h"
-#include "screen.h"
-#include "tetris.h"
-
-cell board[B_SIZE];
-
-int Rows;
-int Cols;
-
-const struct shape *curshape;
-const struct shape *nextshape;
-
-long fallrate;
-int score;
-char key_msg[116];
-int showpreview;
-int classic;
-
-static void elide(void);
-static void setup_board(void);
-static const struct shape *randshape(void);
-
-static void usage(void);
-
-static int firstgame = 1;
-
-/*
- * Set up the initial board. The bottom display row is completely set,
- * along with another (hidden) row underneath that. Also, the left and
- * right edges are set.
- */
-static void setup_board(void)
-{
-	int i;
-	cell *p = board;
-
-	for (i = B_SIZE; i; i--)
-		*p++ = (i <= (2 * B_COLS) || (i % B_COLS) < 2) ? 0x0000ff : 0x000000;
-}
-
-/*
- * Elide any full active rows.
- */
-static void elide(void)
-{
-	int rows = 0;
-	int i;
-	int j;
-	int base;
-	cell *p;
-
-	for (i = A_FIRST; i < A_LAST; i++) {
-		base = i * B_COLS + 1;
-		p = &board[base];
-		j = B_COLS - 2;
-		while (*p++ != 0) {
-			if (--j <= 0) {
-				/* This row is to be elided */
-				rows++;
-				memset(&board[base], 0, sizeof(cell) * (B_COLS - 2));
-
-				scr_update();
-				tsleep();
-
-				while (--base != 0)
-					board[base + B_COLS] = board[base];
-
-				scr_update();
-				tsleep();
-
-				break;
-			}
-		}
-	}
-
-	switch (rows) {
-	case 1:
-		score += 10;
-		break;
-	case 2:
-		score += 30;
-		break;
-	case 3:
-		score += 70;
-		break;
-	case 4:
-		score += 150;
-		break;
-	default:
-		break;
-	}
-}
-
-const struct shape *randshape(void)
-{
-	const struct shape *tmp = &shapes[rand() % 7];
-	int i;
-	int j = rand() % 4;
-
-	for (i = 0; i < j; i++)
-		tmp = &shapes[classic ? tmp->rotc : tmp->rot];
-
-	return (tmp);
-}
-
-static void srandomdev(void)
-{
-	struct timespec ts;
-
-	getrealtime(&ts);
-	srand(ts.tv_sec + ts.tv_nsec / 100000000);
-}
-
-static void tetris_menu_draw(int level)
-{
-	clear_screen();
-	moveto(5, 10);
-	puts("Tetris\n");
-
-	moveto(8, 10);
-	printf("Level = %d (press keys 1 - 9 to change)", level);
-	moveto(9, 10);
-	printf("Preview is %s (press 'p' to change)", (showpreview ? "on " : "off"));
-	moveto(12, 10);
-	printf("Press 'h' to show hiscore table.");
-	moveto(13, 10);
-	printf("Press 's' to start game.");
-	moveto(14, 10);
-	printf("Press 'q' to quit game.");
-	moveto(20, 10);
-	printf("In game controls:");
-	moveto(21, 0);
-	printf("%s", key_msg);
-}
-
-static int tetris_menu(int *level)
-{
-	tetris_menu_draw(*level);
-	while (true) {
-		int i = getchar();
-		if (i < 0)
-			return 0;
-
-		switch (i) {
-		case 'p':
-			showpreview = !showpreview;
-			moveto(9, 21);
-			if (showpreview)
-				printf("on ");
-			else
-				printf("off");
-			break;
-		case 'h':
-			loadscores();
-			showscores(firstgame);
-			tetris_menu_draw(*level);
-			break;
-		case 's':
-			firstgame = 0;
-			return 1;
-		case 'q':
-			return 0;
-		case '1':
-		case '2':
-		case '3':
-		case '4':
-		case '5':
-		case '6':
-		case '7':
-		case '8':
-		case '9':
-			*level = i - '0';
-			moveto(8, 18);
-			printf("%d", *level);
-			break;
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int pos;
-	int c;
-	const char *keys;
-	int level = 2;
-	char key_write[6][10];
-	int i;
-	int j;
-	int ch;
-
-	console = console_init(stdin, stdout);
-
-	keys = "jkl pq";
-
-	classic = 0;
-	showpreview = 1;
-
-	while ((ch = getopt(argc, argv, "ck:ps")) != -1)
-		switch (ch) {
-		case 'c':
-			/*
-			 * this means:
-			 *  - rotate the other way
-			 *  - no reverse video
-			 */
-			classic = 1;
-			break;
-		case 'k':
-			if (str_size(keys = optarg) != 6)
-				usage();
-			break;
-		case 'p':
-			showpreview = 1;
-			break;
-		case 's':
-			showscores(0);
-			exit(0);
-		default:
-			usage();
-		}
-
-	argc -= optind;
-	argv += optind;
-
-	if (argc)
-		usage();
-
-	for (i = 0; i <= 5; i++) {
-		for (j = i + 1; j <= 5; j++) {
-			if (keys[i] == keys[j]) {
-				fprintf(stderr, "duplicate command keys specified.");
-				abort();
-			}
-		}
-
-		if (keys[i] == ' ')
-			str_cpy(key_write[i], sizeof(key_write[i]), "<space>");
-		else {
-			key_write[i][0] = keys[i];
-			key_write[i][1] = '\0';
-		}
-	}
-
-	snprintf(key_msg, sizeof(key_msg),
-	    "%s - left   %s - rotate   %s - right   %s - drop   %s - pause   %s - quit",
-	    key_write[0], key_write[1], key_write[2], key_write[3],
-	    key_write[4], key_write[5]);
-
-	scr_init();
-	if (loadscores() != EOK)
-		initscores();
-
-	while (tetris_menu(&level)) {
-		fallrate = 1000000 / level;
-
-		scr_clear();
-		setup_board();
-
-		srandomdev();
-		scr_set();
-
-		pos = A_FIRST * B_COLS + (B_COLS / 2) - 1;
-		nextshape = randshape();
-		curshape = randshape();
-
-		scr_msg(key_msg, 1);
-
-		while (true) {
-			if (size_changed) {
-				size_changed = false;
-				scr_set();
-				scr_msg(key_msg, 1);
-			}
-
-			place(curshape, pos, 1);
-			scr_update();
-			place(curshape, pos, 0);
-			c = tgetchar();
-			if (c < 0) {
-				/*
-				 * Timeout.  Move down if possible.
-				 */
-				if (fits_in(curshape, pos + B_COLS)) {
-					pos += B_COLS;
-					continue;
-				}
-
-				/*
-				 * Put up the current shape `permanently',
-				 * bump score, and elide any full rows.
-				 */
-				place(curshape, pos, 1);
-				score++;
-				elide();
-
-				/*
-				 * Choose a new shape.  If it does not fit,
-				 * the game is over.
-				 */
-				curshape = nextshape;
-				nextshape = randshape();
-				pos = A_FIRST * B_COLS + (B_COLS / 2) - 1;
-
-				if (!fits_in(curshape, pos))
-					break;
-
-				continue;
-			}
-
-			/*
-			 * Handle command keys.
-			 */
-			if (c == keys[5]) {
-				/* quit */
-				break;
-			}
-
-			if (c == keys[4]) {
-				static char msg[] =
-				    "paused - press RETURN to continue";
-
-				place(curshape, pos, 1);
-				do {
-					scr_update();
-					scr_msg(key_msg, 0);
-					scr_msg(msg, 1);
-					console_flush(console);
-				} while (!twait());
-
-				scr_msg(msg, 0);
-				scr_msg(key_msg, 1);
-				place(curshape, pos, 0);
-				continue;
-			}
-
-			if (c == keys[0]) {
-				/* move left */
-				if (fits_in(curshape, pos - 1))
-					pos--;
-				continue;
-			}
-
-			if (c == keys[1]) {
-				/* turn */
-				const struct shape *new =
-				    &shapes[classic ? curshape->rotc : curshape->rot];
-
-				if (fits_in(new, pos))
-					curshape = new;
-				continue;
-			}
-
-			if (c == keys[2]) {
-				/* move right */
-				if (fits_in(curshape, pos + 1))
-					pos++;
-				continue;
-			}
-
-			if (c == keys[3]) {
-				/* move to bottom */
-				while (fits_in(curshape, pos + B_COLS)) {
-					pos += B_COLS;
-					score++;
-				}
-				continue;
-			}
-
-			if (c == '\f') {
-				scr_clear();
-				scr_msg(key_msg, 1);
-			}
-		}
-
-		scr_clear();
-		loadscores();
-		insertscore(score, level);
-		savescores();
-		score = 0;
-	}
-
-	scr_clear();
-	printf("\nGame over.\n");
-	scr_end();
-
-	return 0;
-}
-
-void usage(void)
-{
-	fprintf(stderr, "%s", copyright);
-	fprintf(stderr, "usage: tetris [-ps] [-k keys]\n");
-	exit(1);
-}
-
-/** @}
- */
Index: pace/app/tetris/tetris.h
===================================================================
--- uspace/app/tetris/tetris.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * tetris.h 8.1 (Berkeley) 5/31/93
- * NetBSD: tetris.h,v 1.2 1995/04/22 07:42:48 cgd
- * OpenBSD: tetris.h,v 1.9 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-
-/*
- * Definitions for Tetris.
- */
-
-/*
- * The display (`board') is composed of 23 rows of 12 columns of characters
- * (numbered 0..22 and 0..11), stored in a single array for convenience.
- * Columns 1 to 10 of rows 1 to 20 are the actual playing area, where
- * shapes appear.  Columns 0 and 11 are always occupied, as are all
- * columns of rows 21 and 22.  Rows 0 and 22 exist as boundary areas
- * so that regions `outside' the visible area can be examined without
- * worrying about addressing problems.
- */
-
-/* The board */
-#define B_COLS  12
-#define B_ROWS  23
-#define B_SIZE  (B_ROWS * B_COLS)
-
-typedef uint32_t cell;
-
-extern cell board[B_SIZE];  /* 1 => occupied, 0 => empty */
-
-/* The displayed area (rows) */
-#define D_FIRST  1
-#define D_LAST   22
-
-/* The active area (rows) */
-#define A_FIRST  1
-#define A_LAST   21
-
-/*
- * Minimum display size.
- */
-#define MINROWS  23
-#define MINCOLS  40
-
-/* Current screen size */
-extern int Rows;
-extern int Cols;
-
-/*
- * Translations from board coordinates to display coordinates.
- * As with board coordinates, display coordiates are zero origin.
- */
-#define RTOD(x)  ((x) - 1)
-#define CTOD(x)  ((x) * 2 + (((Cols - 2 * B_COLS) >> 1) - 1))
-
-/*
- * A `shape' is the fundamental thing that makes up the game.  There
- * are 7 basic shapes, each consisting of four `blots':
- *
- *      X.X       X.X           X.X
- *        X.X   X.X     X.X.X   X.X     X.X.X   X.X.X   X.X.X.X
- *                        X             X           X
- *
- *          0     1       2       3       4       5       6
- *
- * Except for 3 and 6, the center of each shape is one of the blots.
- * This blot is designated (0, 0).  The other three blots can then be
- * described as offsets from the center.  Shape 3 is the same under
- * rotation, so its center is effectively irrelevant; it has been chosen
- * so that it `sticks out' upward and leftward.  Except for shape 6,
- * all the blots are contained in a box going from (-1, -1) to (+1, +1);
- * shape 6's center `wobbles' as it rotates, so that while it `sticks out'
- * rightward, its rotation---a vertical line---`sticks out' downward.
- * The containment box has to include the offset (2, 0), making the overall
- * containment box range from offset (-1, -1) to (+2, +1).  (This is why
- * there is only one row above, but two rows below, the display area.)
- *
- * The game works by choosing one of these shapes at random and putting
- * its center at the middle of the first display row (row 1, column 5).
- * The shape is moved steadily downward until it collides with something:
- * either  another shape, or the bottom of the board.  When the shape can
- * no longer be moved downwards, it is merged into the current board.
- * At this time, any completely filled rows are elided, and blots above
- * these rows move down to make more room.  A new random shape is again
- * introduced at the top of the board, and the whole process repeats.
- * The game ends when the new shape will not fit at (1, 5).
- *
- * While the shapes are falling, the user can rotate them counterclockwise
- * 90 degrees (in addition to moving them left or right), provided that the
- * rotation puts the blots in empty spaces.  The table of shapes is set up
- * so that each shape contains the index of the new shape obtained by
- * rotating the current shape.  Due to symmetry, each shape has exactly
- * 1, 2, or 4 rotations total; the first 7 entries in the table represent
- * the primary shapes, and the remaining 12 represent their various
- * rotated forms.
- */
-struct shape {
-	int rot;     /* index of rotated version of this shape */
-	int rotc;    /* -- " -- in classic version  */
-	int off[3];  /* offsets to other blots if center is at (0,0) */
-	uint32_t color;
-};
-
-extern const struct shape shapes[];
-
-extern const struct shape *curshape;
-extern const struct shape *nextshape;
-
-/*
- * Shapes fall at a rate faster than once per second.
- *
- * The initial rate is determined by dividing 1 million microseconds
- * by the game `level'.  (This is at most 1 million, or one second.)
- * Each time the fall-rate is used, it is decreased a little bit,
- * depending on its current value, via the `faster' macro below.
- * The value eventually reaches a limit, and things stop going faster,
- * but by then the game is utterly impossible.
- */
-extern long fallrate;  /* less than 1 million; smaller => faster */
-
-#define faster()  (fallrate -= fallrate / 3000)
-
-/*
- * Game level must be between 1 and 9.  This controls the initial fall rate
- * and affects scoring.
- */
-#define MINLEVEL  1
-#define MAXLEVEL  9
-
-/*
- * Scoring is as follows:
- *
- * When the shape comes to rest, and is integrated into the board,
- * we score one point.  If the shape is high up (at a low-numbered row),
- * and the user hits the space bar, the shape plummets all the way down,
- * and we score a point for each row it falls (plus one more as soon as
- * we find that it is at rest and integrate it---until then, it can
- * still be moved or rotated).
- *
- * If previewing has been turned on, the score is multiplied by PRE_PENALTY.
- */
-#define PRE_PENALTY  0.75
-
-extern int score;  /* The obvious thing */
-
-extern char key_msg[116];
-extern int showpreview;
-extern int classic;
-
-extern int fits_in(const struct shape *, int);
-extern void place(const struct shape *, int, int);
-extern void stop(const char *);
-
-/** @}
- */
Index: pace/app/tmon/commands.h
===================================================================
--- uspace/app/tmon/commands.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file USB diagnostic device commands.
- */
-
-#ifndef TMON_COMMANDS_H_
-#define TMON_COMMANDS_H_
-
-/* All commands are just versions of int main(int, char **). */
-
-/* List command just prints compatible devices. */
-int tmon_list(int, char **);
-
-/* Tests commands differ by endpoint types. */
-int tmon_test_intr_in(int, char **);
-int tmon_test_intr_out(int, char **);
-int tmon_test_bulk_in(int, char **);
-int tmon_test_bulk_out(int, char **);
-int tmon_test_isoch_in(int, char **);
-int tmon_test_isoch_out(int, char **);
-
-#endif /* TMON_COMMANDS_H_ */
-
-/** @}
- */
Index: pace/app/tmon/doc/doxygroups.h
===================================================================
--- uspace/app/tmon/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup tmon tmon
- * @brief Benchmark USB diagnostic device
- * @ingroup apps
- */
Index: pace/app/tmon/list.c
===================================================================
--- uspace/app/tmon/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file
- * USB transfer debugging.
- */
-
-#include <stdio.h>
-#include <devman.h>
-#include <loc.h>
-#include <usbdiag_iface.h>
-#include "commands.h"
-
-#define NAME "tmon"
-#define MAX_PATH_LENGTH 1024
-
-/** Print a single item of the device list.
- * @param[in] svc Service ID of the devman function.
- */
-static void print_list_item(service_id_t svc)
-{
-	errno_t rc;
-	devman_handle_t diag_handle = 0;
-
-	if ((rc = devman_fun_sid_to_handle(svc, &diag_handle))) {
-		printf(NAME ": Error resolving handle of device with SID %" PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	char path[MAX_PATH_LENGTH];
-	if ((rc = devman_fun_get_path(diag_handle, path, sizeof(path)))) {
-		printf(NAME ": Error resolving path of device with SID %" PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	printf("%s\n", path);
-}
-
-/** List command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_list(int argc, char *argv[])
-{
-	category_id_t diag_cat;
-	service_id_t *svcs;
-	size_t count;
-	int rc;
-
-	if ((rc = loc_category_get_id(USBDIAG_CATEGORY, &diag_cat, 0))) {
-		printf(NAME ": Error resolving category '%s'", USBDIAG_CATEGORY);
-		return 1;
-	}
-
-	if ((rc = loc_category_get_svcs(diag_cat, &svcs, &count))) {
-		printf(NAME ": Error getting list of diagnostic devices.\n");
-		return 1;
-	}
-
-	for (unsigned i = 0; i < count; ++i) {
-		print_list_item(svcs[i]);
-	}
-
-	free(svcs);
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/tmon/main.c
===================================================================
--- uspace/app/tmon/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file
- * USB transfer debugging.
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-#include <macros.h>
-#include "commands.h"
-
-#define NAME   "tmon"
-#define INDENT "      "
-
-/** Command which is executed by tmon. */
-typedef struct tmon_cmd {
-	/** Unique name, by which the command is executed. */
-	const char *name;
-	/** Description of the command, which is displayed in the usage string. */
-	const char *description;
-	/** Function, which executes the command. Same as int main(int, char**). */
-	int (*action)(int, char **);
-} tmon_cmd_t;
-
-/** Static array of commands supported by tmon. */
-static tmon_cmd_t commands[] = {
-	{
-		.name = "list",
-		.description = "Print a list of connected diagnostic devices.",
-		.action = tmon_list,
-	},
-	{
-		.name = "test-intr-in",
-		.description = "Read from interrupt endpoint as fast as possible.",
-		.action = tmon_test_intr_in,
-	},
-	{
-		.name = "test-intr-out",
-		.description = "Write to interrupt endpoint as fast as possible.",
-		.action = tmon_test_intr_out,
-	},
-	{
-		.name = "test-bulk-in",
-		.description = "Read from bulk endpoint as fast as possible.",
-		.action = tmon_test_bulk_in,
-	},
-	{
-		.name = "test-bulk-out",
-		.description = "Write to bulk endpoint as fast as possible.",
-		.action = tmon_test_bulk_out,
-	},
-	{
-		.name = "test-isoch-in",
-		.description = "Read from isochronous endpoint as fast as possible.",
-		.action = tmon_test_isoch_in,
-	},
-	{
-		.name = "test-isoch-out",
-		.description = "Write to isochronous endpoint as fast as possible.",
-		.action = tmon_test_isoch_out,
-	},
-};
-
-/** Option shown in the usage string. */
-typedef struct tmon_opt {
-	/** Long name of the option without "--" prefix. */
-	const char *long_name;
-	/** Short name of the option without "-" prefix. */
-	char short_name;
-	/** Description of the option displayed in the usage string. */
-	const char *description;
-} tmon_opt_t;
-
-/** Static array of options displayed in the tmon usage string. */
-static tmon_opt_t options[] = {
-	{
-		.long_name = "duration",
-		.short_name = 't',
-		.description = "Set the minimum test duration (in seconds)."
-	},
-	{
-		.long_name = "size",
-		.short_name = 's',
-		.description = "Set the data size (in bytes) transferred in a single cycle."
-	},
-	{
-		.long_name = "validate",
-		.short_name = 'v',
-		.description = "Validate the correctness of transferred data (impacts performance)."
-	},
-};
-
-/** Print usage string.
- * @param[in] app_name Name to print in the invocation example.
- */
-static void print_usage(char *app_name)
-{
-	puts(NAME ": benchmark USB diagnostic device\n");
-	printf("Usage: %s command [device] [options]\n\n", app_name);
-
-	for (unsigned i = 0; i < ARRAY_SIZE(commands); ++i) {
-		printf(INDENT "%s - %s\n", commands[i].name, commands[i].description);
-	}
-
-	puts("");
-	for (unsigned i = 0; i < ARRAY_SIZE(options); ++i) {
-		printf(INDENT "-%c --%s\n" INDENT INDENT "%s\n", options[i].short_name, options[i].long_name, options[i].description);
-	}
-
-	puts("\nIf no device is specified, the first device is used provided that it is the only one connected. Otherwise, the command fails.\n");
-}
-
-/** Main tmon entry point.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int main(int argc, char *argv[])
-{
-	// Find a command to execute.
-	tmon_cmd_t *cmd = NULL;
-	for (unsigned i = 0; argc > 1 && i < ARRAY_SIZE(commands); ++i) {
-		if (str_cmp(argv[1], commands[i].name) == 0) {
-			cmd = commands + i;
-			break;
-		}
-	}
-
-	if (!cmd) {
-		print_usage(argv[0]);
-		return -1;
-	}
-
-	return cmd->action(argc - 1, argv + 1);
-}
-
-/** @}
- */
Index: pace/app/tmon/meson.build
===================================================================
--- uspace/app/tmon/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2017 Petr Manek
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv', 'usb' ]
-src = files(
-	'main.c',
-	'list.c',
-	'tf.c',
-	'tests.c',
-	'resolve.c',
-)
Index: pace/app/tmon/resolve.c
===================================================================
--- uspace/app/tmon/resolve.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file
- * USB diagnostic device resolving.
- */
-
-#include <loc.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <usbdiag_iface.h>
-#include "resolve.h"
-
-#define NAME "tmon"
-
-/** Resolve a single function by its class (fail if there is more/less than 1).
- * @param[out] fun Resolved function handle (if found).
- *
- * @return EOK if the function was resolved successfully.
- */
-int tmon_resolve_default(devman_handle_t *fun)
-{
-	category_id_t diag_cat;
-	service_id_t *svcs;
-	size_t count;
-	int rc;
-
-	if ((rc = loc_category_get_id(USBDIAG_CATEGORY, &diag_cat, 0))) {
-		printf(NAME ": Error resolving category '%s'", USBDIAG_CATEGORY);
-		return rc;
-	}
-
-	if ((rc = loc_category_get_svcs(diag_cat, &svcs, &count))) {
-		printf(NAME ": Error getting list of diagnostic devices.\n");
-		return rc;
-	}
-
-	// There must be exactly one diagnostic device for this to work.
-	if (count != 1) {
-		if (count) {
-			printf(NAME ": Found %zu devices. Please specify which to use.\n", count);
-		} else {
-			printf(NAME ": No diagnostic devices found.\n");
-		}
-		return ENOENT;
-	}
-
-	if ((rc = devman_fun_sid_to_handle(svcs[0], fun))) {
-		printf(NAME ": Error resolving handle of device with "
-		    "SID %" PRIun ".\n", svcs[0]);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Resolve a function by its name or device path.
- * @param[in] dev_path Name or device path (see `devman_fun_get_handle` for possible values).
- * @param[out] fun Resolved function handle (if found).
- *
- * @return EOK if the function was resolved successfully.
- */
-int tmon_resolve_named(const char *dev_path, devman_handle_t *fun)
-{
-	int rc;
-	if ((rc = devman_fun_get_handle(dev_path, fun, 0))) {
-		printf(NAME ": Error resolving handle of device - %s.\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/tmon/resolve.h
===================================================================
--- uspace/app/tmon/resolve.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file USB diagnostic device resolving.
- */
-
-#ifndef TMON_RESOLVE_H_
-#define TMON_RESOLVE_H_
-
-#include <devman.h>
-
-errno_t tmon_resolve_default(devman_handle_t *);
-errno_t tmon_resolve_named(const char *, devman_handle_t *);
-
-#endif /* TMON_RESOLVE_H_ */
-
-/** @}
- */
Index: pace/app/tmon/tests.c
===================================================================
--- uspace/app/tmon/tests.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,341 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file
- * USB tests.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <str.h>
-#include <str_error.h>
-#include <getopt.h>
-#include <usb/usb.h>
-#include <usbdiag_iface.h>
-#include "commands.h"
-#include "tf.h"
-
-#define NAME   "tmon"
-#define INDENT "      "
-
-/** Static array of long options, from which test parameters are parsed. */
-static struct option long_options[] = {
-	{ "duration", required_argument, NULL, 't' },
-	{ "size", required_argument, NULL, 's' },
-	{ "validate", required_argument, NULL, 'v' },
-	{ 0, 0, NULL, 0 }
-};
-
-/** String of short options, from which test parameters are parsed. */
-static const char *short_options = "t:s:v";
-
-/** Common option parser for all tests.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- * @param[out] params Parsed test parameters (if successful).
- *
- * @return EOK if successful (in such case caller becomes the owner of `params`).
- */
-static errno_t read_params(int argc, char *argv[], void **params)
-{
-	errno_t rc;
-	usbdiag_test_params_t *p = (usbdiag_test_params_t *) malloc(sizeof(usbdiag_test_params_t));
-	if (!p)
-		return ENOMEM;
-
-	// Default values.
-	p->transfer_size = 0;
-	p->min_duration = 5000;
-	p->validate_data = false;
-
-	// Parse other than default values.
-	int c;
-	uint32_t duration_uint;
-	c = 0;
-	optreset = 1;
-	optind = 0;
-	while (c != -1) {
-		c = getopt_long(argc, argv, short_options, long_options, NULL);
-		switch (c) {
-		case -1:
-			break;
-		case 'v':
-			p->validate_data = true;
-			break;
-		case 't':
-			if (!optarg || str_uint32_t(optarg, NULL, 10, false, &duration_uint) != EOK) {
-				puts(NAME ": Invalid duration.");
-				rc = EINVAL;
-				goto err_malloc;
-			}
-			p->min_duration = (usbdiag_dur_t) duration_uint * 1000;
-			break;
-		case 's':
-			if (!optarg || str_size_t(optarg, NULL, 10, false, &p->transfer_size) != EOK) {
-				puts(NAME ": Invalid data size.");
-				rc = EINVAL;
-				goto err_malloc;
-			}
-			break;
-		}
-	}
-
-	*params = (void *) p;
-	return EOK;
-
-err_malloc:
-	free(p);
-	*params = NULL;
-	return rc;
-}
-
-/** Print test parameters.
- * @param[in] params Test parameters to print.
- */
-static void print_params(const usbdiag_test_params_t *params)
-{
-	printf("Endpoint type: %s\n", usb_str_transfer_type(params->transfer_type));
-	char *str_min_duration = tmon_format_duration(params->min_duration, "%.3f %s");
-	printf("Min. duration: %s\n", str_min_duration);
-	free(str_min_duration);
-
-	if (params->transfer_size) {
-		char *str_size = tmon_format_size(params->transfer_size, "%.3f %s");
-		printf("Transfer size: %s\n", str_size);
-		free(str_size);
-	} else {
-		printf("Transfer size: (max. transfer size)\n");
-	}
-
-	printf("Validate data: %s\n", params->validate_data ? "yes" : "no");
-}
-
-/** Print test results.
- * @param[in] params Test parameters.
- * @param[in] results Test results.
- */
-static void print_results(const usbdiag_test_params_t *params, const usbdiag_test_results_t *results)
-{
-	printf("Transfers performed: %u\n", results->transfer_count);
-
-	char *str_total_duration = tmon_format_duration(results->act_duration, "%.3f %s");
-	printf("Total duration: %s\n", str_total_duration);
-	free(str_total_duration);
-
-	char *str_size_per_transfer = tmon_format_size(results->transfer_size, "%.3f %s");
-	printf("Transfer size: %s\n", str_size_per_transfer);
-	free(str_size_per_transfer);
-
-	const size_t total_size = results->transfer_size * results->transfer_count;
-	char *str_total_size = tmon_format_size(total_size, "%.3f %s");
-	printf("Total size: %s\n", str_total_size);
-	free(str_total_size);
-
-	const double dur_per_transfer = (double) results->act_duration / (double) results->transfer_count;
-	char *str_dur_per_transfer = tmon_format_duration(dur_per_transfer, "%.3f %s");
-	printf("Avg. transfer duration: %s\n", str_dur_per_transfer);
-	free(str_dur_per_transfer);
-
-	const double speed = 1000.0 * (double) total_size / (double) results->act_duration;
-	char *str_speed = tmon_format_size(speed, "%.3f %s/s");
-	printf("Avg. speed: %s\n", str_speed);
-	free(str_speed);
-}
-
-/** Run test on "in" endpoint.
- * @param[in] exch Open async exchange with the diagnostic device.
- * @param[in] generic_params Test parameters. Must point to 'usbdiag_test_params_t'.
- *
- * @return Exit code
- */
-static int test_in(async_exch_t *exch, const void *generic_params)
-{
-	const usbdiag_test_params_t *params = (usbdiag_test_params_t *) generic_params;
-	print_params(params);
-	fputs("\nTesting... ", stdout);
-
-	usbdiag_test_results_t results;
-	errno_t rc = usbdiag_test_in(exch, params, &results);
-	if (rc != EOK) {
-		puts("failed");
-		printf(NAME ": %s\n", str_error(rc));
-		return 1;
-	}
-
-	puts("succeeded\n");
-	print_results(params, &results);
-	return 0;
-}
-
-/** Run test on "out" endpoint.
- * @param[in] exch Open async exchange with the diagnostic device.
- * @param[in] generic_params Test parameters. Must point to 'usbdiag_test_params_t'.
- *
- * @return Exit code
- */
-static int test_out(async_exch_t *exch, const void *generic_params)
-{
-	const usbdiag_test_params_t *params = (usbdiag_test_params_t *) generic_params;
-	print_params(params);
-	fputs("\nTesting... ", stdout);
-
-	usbdiag_test_results_t results;
-	errno_t rc = usbdiag_test_out(exch, params, &results);
-	if (rc) {
-		puts("failed");
-		printf(NAME ": %s\n", str_error(rc));
-		return 1;
-	}
-
-	puts("succeeded\n");
-	print_results(params, &results);
-	return 0;
-}
-
-#define GEN_PRE_RUN(FN, TYPE) \
-	static int pre_run_##FN(void *generic_params) \
-	{ \
-		usbdiag_test_params_t *params = (usbdiag_test_params_t *) generic_params; \
-		params->transfer_type = USB_TRANSFER_##TYPE; \
-		return EOK; \
-	}
-
-GEN_PRE_RUN(intr, INTERRUPT);
-GEN_PRE_RUN(bulk, BULK);
-GEN_PRE_RUN(isoch, ISOCHRONOUS);
-
-#undef GEN_PRE_RUN
-
-/** Interrupt in test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_intr_in(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_intr,
-		.run = test_in,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** Interrupt out test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_intr_out(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_intr,
-		.run = test_out,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** Interrupt bulk test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_bulk_in(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_bulk,
-		.run = test_in,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** Bulk out test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_bulk_out(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_bulk,
-		.run = test_out,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** Isochronous in test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_isoch_in(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_isoch,
-		.run = test_in,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** Isochronous out test command handler.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_isoch_out(int argc, char *argv[])
-{
-	static const tmon_test_ops_t ops = {
-		.pre_run = pre_run_isoch,
-		.run = test_out,
-		.read_params = read_params
-	};
-
-	return tmon_test_main(argc, argv, &ops);
-}
-
-/** @}
- */
Index: pace/app/tmon/tf.c
===================================================================
--- uspace/app/tmon/tf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file
- * Testing framework.
- */
-
-#include <stdio.h>
-#include <macros.h>
-#include <devman.h>
-#include <str_error.h>
-#include <usbdiag_iface.h>
-#include "resolve.h"
-#include "tf.h"
-
-#define NAME "tmon"
-#define MAX_PATH_LENGTH 1024
-
-/** Common command handler for all test commands.
- * @param[in] argc Number of arguments.
- * @param[in] argv Argument values. Must point to exactly `argc` strings.
- *
- * @return Exit code
- */
-int tmon_test_main(int argc, char *argv[], const tmon_test_ops_t *ops)
-{
-	// Resolve device function.
-	devman_handle_t fun = -1;
-
-	if (argc >= 2 && *argv[1] != '-') {
-		// Assume that the first argument is device path.
-		if (tmon_resolve_named(argv[1], &fun))
-			return 1;
-	} else {
-		// The first argument is either an option or not present.
-		if (tmon_resolve_default(&fun))
-			return 1;
-	}
-
-	errno_t rc;
-	int ec;
-	char path[MAX_PATH_LENGTH];
-	if ((rc = devman_fun_get_path(fun, path, sizeof(path)))) {
-		printf(NAME ": Error resolving path of device with handle "
-		    "%" PRIun ". %s\n", fun, str_error(rc));
-		return 1;
-	}
-
-	printf("Device: %s\n", path);
-
-	// Read test parameters from options.
-	void *params = NULL;
-	if ((rc = ops->read_params(argc, argv, &params))) {
-		printf(NAME ": Reading test parameters failed. %s\n", str_error(rc));
-		return 1;
-	}
-
-	if ((rc = ops->pre_run(params))) {
-		printf(NAME ": Pre-run hook failed. %s\n", str_error(rc));
-		return 1;
-	}
-
-	// Run the test body.
-	async_sess_t *sess = usbdiag_connect(fun);
-	if (!sess) {
-		printf(NAME ": Could not connect to the device.\n");
-		return 1;
-	}
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch) {
-		printf(NAME ": Could not start exchange with the device.\n");
-		ec = 1;
-		goto err_sess;
-	}
-
-	ec = ops->run(exch, params);
-	async_exchange_end(exch);
-
-err_sess:
-	usbdiag_disconnect(sess);
-	free(params);
-	return ec;
-}
-
-/** Unit of quantity used for pretty formatting. */
-typedef struct tmon_unit {
-	/** Prefix letter, which is printed before the actual unit. */
-	const char *unit;
-	/** Factor of the unit. */
-	double factor;
-} tmon_unit_t;
-
-/** Format a value for human reading.
- * @param[in] val The value to format.
- * @param[in] fmt Format string. Must include one double and char.
- *
- * @return Heap-allocated string if successful (caller becomes its owner), NULL otherwise.
- */
-static char *format_unit(double val, const char *fmt, const tmon_unit_t *units, size_t len)
-{
-	// Figure out the "tightest" unit.
-	unsigned i;
-	for (i = 0; i < len; ++i) {
-		if (units[i].factor <= val)
-			break;
-	}
-
-	if (i == len)
-		--i;
-	const char *unit = units[i].unit;
-	double factor = units[i].factor;
-
-	// Format the size.
-	const double div_size = val / factor;
-
-	char *out = NULL;
-	asprintf(&out, fmt, div_size, unit);
-
-	return out;
-}
-
-/** Static array of size units with decreasing factors. */
-static const tmon_unit_t size_units[] = {
-	{ .unit = "EB", .factor = 1ULL << 60 },
-	{ .unit = "PB", .factor = 1ULL << 50 },
-	{ .unit = "TB", .factor = 1ULL << 40 },
-	{ .unit = "GB", .factor = 1ULL << 30 },
-	{ .unit = "MB", .factor = 1ULL << 20 },
-	{ .unit = "kB", .factor = 1ULL << 10 },
-	{ .unit = "B",  .factor = 1ULL },
-};
-
-char *tmon_format_size(double val, const char *fmt)
-{
-	return format_unit(val, fmt, size_units, ARRAY_SIZE(size_units));
-}
-
-/** Static array of duration units with decreasing factors. */
-static const tmon_unit_t dur_units[] = {
-	{ .unit = "d",   .factor = 60 * 60 * 24 },
-	{ .unit = "h",   .factor = 60 * 60 },
-	{ .unit = "min", .factor = 60 },
-	{ .unit = "s",   .factor = 1 },
-	{ .unit = "ms",  .factor = 1e-3 },
-	{ .unit = "us",  .factor = 1e-6 },
-	{ .unit = "ns",  .factor = 1e-9 },
-	{ .unit = "ps",  .factor = 1e-12 },
-};
-
-char *tmon_format_duration(usbdiag_dur_t val, const char *fmt)
-{
-	return format_unit(val / 1000.0, fmt, dur_units, ARRAY_SIZE(dur_units));
-}
-
-/** @}
- */
Index: pace/app/tmon/tf.h
===================================================================
--- uspace/app/tmon/tf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmon
- * @{
- */
-/**
- * @file Testing framework definitions.
- */
-
-#ifndef TMON_TF_H_
-#define TMON_TF_H_
-
-#include <async.h>
-#include <usbdiag_iface.h>
-
-/** Operations to implement by all tests. */
-typedef struct tmon_test_ops {
-	errno_t (*pre_run)(void *);
-	errno_t (*run)(async_exch_t *, const void *);
-	errno_t (*read_params)(int, char **, void **);
-} tmon_test_ops_t;
-
-int tmon_test_main(int, char **, const tmon_test_ops_t *);
-
-char *tmon_format_size(double, const char *);
-char *tmon_format_duration(usbdiag_dur_t, const char *);
-
-#endif /* TMON_TF_H_ */
-
-/** @}
- */
Index: pace/app/top/doc/doxygroups.h
===================================================================
--- uspace/app/top/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup top top
- * @brief Top uility
- * @ingroup apps
- */
Index: pace/app/top/meson.build
===================================================================
--- uspace/app/top/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'console' ]
-src = files(
-	'top.c',
-	'screen.c',
-)
Index: pace/app/top/screen.c
===================================================================
--- uspace/app/top/screen.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,584 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @brief Top utility.
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <io/console.h>
-#include <io/style.h>
-#include <vfs/vfs.h>
-#include <stdarg.h>
-#include <stats.h>
-#include <inttypes.h>
-#include <macros.h>
-#include <str.h>
-#include "screen.h"
-#include "top.h"
-
-static usec_t timeleft = 0;
-
-console_ctrl_t *console;
-
-static sysarg_t warning_col = 0;
-static sysarg_t warning_row = 0;
-static usec_t warning_timeleft = 0;
-static char *warning_text = NULL;
-
-static void screen_style_normal(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_NORMAL);
-}
-
-static void screen_style_inverted(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_INVERTED);
-}
-
-static void screen_style_emphasis(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_EMPHASIS);
-}
-
-static void screen_moveto(sysarg_t col, sysarg_t row)
-{
-	console_flush(console);
-	console_set_pos(console, col, row);
-}
-
-static void screen_get_pos(sysarg_t *col, sysarg_t *row)
-{
-	console_flush(console);
-	console_get_pos(console, col, row);
-}
-
-static void screen_get_size(sysarg_t *col, sysarg_t *row)
-{
-	console_flush(console);
-	console_get_size(console, col, row);
-}
-
-static void screen_restart(bool clear)
-{
-	screen_style_normal();
-
-	if (clear) {
-		console_flush(console);
-		console_clear(console);
-	}
-
-	screen_moveto(0, 0);
-}
-
-static void screen_newline(void)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t c;
-	sysarg_t r;
-	screen_get_pos(&c, &r);
-
-	sysarg_t i;
-	for (i = c + 1; i < cols; i++)
-		fputs(" ", stdout);
-
-	if (r + 1 < rows)
-		puts("");
-}
-
-void screen_init(void)
-{
-	console = console_init(stdin, stdout);
-
-	console_flush(console);
-	console_cursor_visibility(console, false);
-
-	screen_restart(true);
-}
-
-void screen_done(void)
-{
-	free(warning_text);
-	warning_text = NULL;
-
-	screen_restart(true);
-
-	console_flush(console);
-	console_cursor_visibility(console, true);
-}
-
-static void print_percent(fixed_float ffloat, unsigned int precision)
-{
-	printf("%3" PRIu64 ".", ffloat.upper / ffloat.lower);
-
-	unsigned int i;
-	uint64_t rest = (ffloat.upper % ffloat.lower) * 10;
-	for (i = 0; i < precision; i++) {
-		printf("%" PRIu64, rest / ffloat.lower);
-		rest = (rest % ffloat.lower) * 10;
-	}
-
-	printf("%%");
-}
-
-static void print_string(const char *str)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t c;
-	sysarg_t r;
-	screen_get_pos(&c, &r);
-
-	if (c < cols) {
-		int pos = cols - c - 1;
-		printf("%.*s", pos, str);
-	}
-}
-
-static inline void print_global_head(data_t *data)
-{
-	printf("top - %02lld:%02lld:%02lld up "
-	    "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", "
-	    "load average:",
-	    data->hours, data->minutes, data->seconds,
-	    data->udays, data->uhours, data->uminutes, data->useconds);
-
-	size_t i;
-	for (i = 0; i < data->load_count; i++) {
-		fputs(" ", stdout);
-		stats_print_load_fragment(data->load[i], 2);
-	}
-
-	screen_newline();
-}
-
-static inline void print_task_summary(data_t *data)
-{
-	printf("tasks: %zu total", data->tasks_count);
-	screen_newline();
-}
-
-static inline void print_thread_summary(data_t *data)
-{
-	size_t total = 0;
-	size_t running = 0;
-	size_t ready = 0;
-	size_t sleeping = 0;
-	size_t lingering = 0;
-	size_t other = 0;
-	size_t invalid = 0;
-
-	size_t i;
-	for (i = 0; i < data->threads_count; i++) {
-		total++;
-
-		switch (data->threads[i].state) {
-		case Running:
-			running++;
-			break;
-		case Ready:
-			ready++;
-			break;
-		case Sleeping:
-			sleeping++;
-			break;
-		case Lingering:
-			lingering++;
-			break;
-		case Entering:
-		case Exiting:
-			other++;
-			break;
-		default:
-			invalid++;
-		}
-	}
-
-	printf("threads: %zu total, %zu running, %zu ready, "
-	    "%zu sleeping, %zu lingering, %zu other, %zu invalid",
-	    total, running, ready, sleeping, lingering, other, invalid);
-	screen_newline();
-}
-
-static inline void print_cpu_info(data_t *data)
-{
-	size_t i;
-	for (i = 0; i < data->cpus_count; i++) {
-		if (data->cpus[i].active) {
-			uint64_t busy;
-			uint64_t idle;
-			char busy_suffix;
-			char idle_suffix;
-
-			order_suffix(data->cpus[i].busy_cycles, &busy, &busy_suffix);
-			order_suffix(data->cpus[i].idle_cycles, &idle, &idle_suffix);
-
-			printf("cpu%u (%4" PRIu16 " MHz): busy cycles: "
-			    "%" PRIu64 "%c, idle cycles: %" PRIu64 "%c",
-			    data->cpus[i].id, data->cpus[i].frequency_mhz,
-			    busy, busy_suffix, idle, idle_suffix);
-			fputs(", idle: ", stdout);
-			print_percent(data->cpus_perc[i].idle, 2);
-			fputs(", busy: ", stdout);
-			print_percent(data->cpus_perc[i].busy, 2);
-		} else
-			printf("cpu%u inactive", data->cpus[i].id);
-
-		screen_newline();
-	}
-}
-
-static inline void print_physmem_info(data_t *data)
-{
-	uint64_t total;
-	uint64_t unavail;
-	uint64_t used;
-	uint64_t free;
-	const char *total_suffix;
-	const char *unavail_suffix;
-	const char *used_suffix;
-	const char *free_suffix;
-
-	bin_order_suffix(data->physmem->total, &total, &total_suffix, false);
-	bin_order_suffix(data->physmem->unavail, &unavail, &unavail_suffix, false);
-	bin_order_suffix(data->physmem->used, &used, &used_suffix, false);
-	bin_order_suffix(data->physmem->free, &free, &free_suffix, false);
-
-	printf("memory: %" PRIu64 "%s total, %" PRIu64 "%s unavail, %"
-	    PRIu64 "%s used, %" PRIu64 "%s free", total, total_suffix,
-	    unavail, unavail_suffix, used, used_suffix, free, free_suffix);
-	screen_newline();
-}
-
-static inline void print_help_head(void)
-{
-	screen_style_inverted();
-	printf("Help");
-	screen_newline();
-	screen_style_normal();
-}
-
-static inline void print_help(void)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	screen_newline();
-
-	printf("Operation modes:");
-	screen_newline();
-
-	printf(" t .. tasks statistics");
-	screen_newline();
-
-	printf(" i .. IPC statistics");
-	screen_newline();
-
-	printf(" e .. exceptions statistics");
-	screen_newline();
-
-	printf("      a .. toggle display of all/hot exceptions");
-	screen_newline();
-
-	printf(" h .. toggle this help screen");
-	screen_newline();
-
-	screen_newline();
-
-	printf("Other keys:");
-	screen_newline();
-
-	printf(" s .. choose column to sort by");
-	screen_newline();
-
-	printf(" r .. toggle reversed sorting");
-	screen_newline();
-
-	printf(" q .. quit");
-	screen_newline();
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_table_head(const table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	screen_style_inverted();
-	for (size_t i = 0; i < table->num_columns; i++) {
-		const char *name = table->columns[i].name;
-		int width = table->columns[i].width;
-		if (i != 0) {
-			fputs(" ", stdout);
-		}
-		if (width == 0) {
-			sysarg_t col;
-			sysarg_t row;
-			screen_get_pos(&col, &row);
-			width = cols - col - 1;
-		}
-		printf("[%-*.*s]", width - 2, width - 2, name);
-	}
-	screen_newline();
-	screen_style_normal();
-}
-
-static inline void print_table(const table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	size_t i;
-	for (i = 0; (i < table->num_fields) && (row < rows); i++) {
-		size_t column_index = i % table->num_columns;
-		int width = table->columns[column_index].width;
-		field_t *field = &table->fields[i];
-		uint64_t val;
-		const char *psuffix;
-		char suffix;
-
-		if (column_index != 0) {
-			fputs(" ", stdout);
-		}
-
-		if (width == 0) {
-			screen_get_pos(&col, &row);
-			width = cols - col - 1;
-		}
-
-		switch (field->type) {
-		case FIELD_EMPTY:
-			printf("%*s", width, "");
-			break;
-		case FIELD_UINT:
-			printf("%*" PRIu64, width, field->uint);
-			break;
-		case FIELD_UINT_SUFFIX_BIN:
-			val = field->uint;
-			width -= 3;
-			bin_order_suffix(val, &val, &psuffix, true);
-			printf("%*" PRIu64 "%s", width, val, psuffix);
-			break;
-		case FIELD_UINT_SUFFIX_DEC:
-			val = field->uint;
-			width -= 1;
-			order_suffix(val, &val, &suffix);
-			printf("%*" PRIu64 "%c", width, val, suffix);
-			break;
-		case FIELD_PERCENT:
-			width -= 5; /* nnn.% */
-			if (width > 2) {
-				printf("%*s", width - 2, "");
-				width = 2;
-			}
-			print_percent(field->fixed, width);
-			break;
-		case FIELD_STRING:
-			printf("%-*.*s", width, width, field->string);
-			break;
-		}
-
-		if (column_index == table->num_columns - 1) {
-			screen_newline();
-			row++;
-		}
-	}
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_sort(table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	size_t num = min(table->num_columns, rows - row);
-	for (size_t i = 0; i < num; i++) {
-		printf("%c - %s", table->columns[i].key, table->columns[i].name);
-		screen_newline();
-		row++;
-	}
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_warning(void)
-{
-	screen_get_pos(&warning_col, &warning_row);
-	if (warning_timeleft > 0) {
-		screen_style_emphasis();
-		print_string(warning_text);
-		screen_style_normal();
-	} else {
-		free(warning_text);
-		warning_text = NULL;
-	}
-	screen_newline();
-}
-
-void print_data(data_t *data)
-{
-	screen_restart(false);
-	print_global_head(data);
-	print_task_summary(data);
-	print_thread_summary(data);
-	print_cpu_info(data);
-	print_physmem_info(data);
-	print_warning();
-
-	switch (screen_mode) {
-	case SCREEN_TABLE:
-		print_table_head(&data->table);
-		print_table(&data->table);
-		break;
-	case SCREEN_SORT:
-		print_sort(&data->table);
-		break;
-	case SCREEN_HELP:
-		print_help_head();
-		print_help();
-	}
-
-	console_flush(console);
-}
-
-void show_warning(const char *fmt, ...)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	size_t warning_text_size = 1 + cols * sizeof(*warning_text);
-	free(warning_text);
-	warning_text = malloc(warning_text_size);
-	if (!warning_text)
-		return;
-
-	va_list args;
-	va_start(args, fmt);
-	vsnprintf(warning_text, warning_text_size, fmt, args);
-	va_end(args);
-
-	warning_timeleft = SEC2USEC(2);
-
-	screen_moveto(warning_col, warning_row);
-	print_warning();
-	console_flush(console);
-}
-
-/** Get char with timeout
- *
- * @param sec Timeout in seconds
- * @param rch Place to store character on success
- * @return EOK on success, ETIMEOUT on time out, EIO on other error
- */
-errno_t tgetchar(sec_t sec, int *rch)
-{
-	errno_t rc;
-
-	/*
-	 * Reset timeleft whenever it is not positive.
-	 */
-
-	if (timeleft <= 0)
-		timeleft = SEC2USEC(sec);
-
-	/*
-	 * Wait to see if there is any input. If so, take it and
-	 * update timeleft so that the next call to tgetchar()
-	 * will not wait as long. If there is no input,
-	 * make timeleft zero and return ETIMEOUT.
-	 */
-
-	char32_t c = 0;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		warning_timeleft -= timeleft;
-		rc = console_get_event_timeout(console, &event, &timeleft);
-		if (rc == ETIMEOUT) {
-			timeleft = 0;
-			return ETIMEOUT;
-		}
-
-		if (rc != EOK)
-			return EIO;
-
-		warning_timeleft += timeleft;
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	*rch = (int) c;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/top/screen.h
===================================================================
--- uspace/app/top/screen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @{
- */
-
-#ifndef TOP_SCREEN_H_
-#define TOP_SCREEN_H_
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/verify.h>
-#include "top.h"
-
-extern console_ctrl_t *console;
-
-extern void screen_init(void);
-extern void screen_done(void);
-extern void print_data(data_t *);
-extern void show_warning(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-
-extern errno_t tgetchar(sec_t, int *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/app/top/top.c
===================================================================
--- uspace/app/top/top.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,694 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @brief Top utility.
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include <time.h>
-#include <errno.h>
-#include <gsort.h>
-#include <str.h>
-#include "screen.h"
-#include "top.h"
-
-#define NAME  "top"
-
-#define UPDATE_INTERVAL  1
-
-#define DAY     86400
-#define HOUR    3600
-#define MINUTE  60
-
-typedef enum {
-	OP_TASKS,
-	OP_IPC,
-	OP_EXCS,
-} op_mode_t;
-
-static const column_t task_columns[] = {
-	{ "taskid",   't',  8 },
-	{ "thrds",    'h',  7 },
-	{ "resident", 'r', 10 },
-	{ "%resi",    'R',  7 },
-	{ "virtual",  'v',  9 },
-	{ "%virt",    'V',  7 },
-	{ "%user",    'U',  7 },
-	{ "%kern",    'K',  7 },
-	{ "name",     'd',  0 },
-};
-
-enum {
-	TASK_COL_ID = 0,
-	TASK_COL_NUM_THREADS,
-	TASK_COL_RESIDENT,
-	TASK_COL_PERCENT_RESIDENT,
-	TASK_COL_VIRTUAL,
-	TASK_COL_PERCENT_VIRTUAL,
-	TASK_COL_PERCENT_USER,
-	TASK_COL_PERCENT_KERNEL,
-	TASK_COL_NAME,
-	TASK_NUM_COLUMNS,
-};
-
-static const column_t ipc_columns[] = {
-	{ "taskid",  't', 8 },
-	{ "cls snt", 'c', 9 },
-	{ "cls rcv", 'C', 9 },
-	{ "ans snt", 'a', 9 },
-	{ "ans rcv", 'A', 9 },
-	{ "forward", 'f', 9 },
-	{ "name",    'd', 0 },
-};
-
-enum {
-	IPC_COL_TASKID = 0,
-	IPC_COL_CLS_SNT,
-	IPC_COL_CLS_RCV,
-	IPC_COL_ANS_SNT,
-	IPC_COL_ANS_RCV,
-	IPC_COL_FORWARD,
-	IPC_COL_NAME,
-	IPC_NUM_COLUMNS,
-};
-
-static const column_t exception_columns[] = {
-	{ "exc",         'e',  8 },
-	{ "count",       'n', 10 },
-	{ "%count",      'N',  8 },
-	{ "cycles",      'c', 10 },
-	{ "%cycles",     'C',  9 },
-	{ "description", 'd',  0 },
-};
-
-enum {
-	EXCEPTION_COL_ID = 0,
-	EXCEPTION_COL_COUNT,
-	EXCEPTION_COL_PERCENT_COUNT,
-	EXCEPTION_COL_CYCLES,
-	EXCEPTION_COL_PERCENT_CYCLES,
-	EXCEPTION_COL_DESCRIPTION,
-	EXCEPTION_NUM_COLUMNS,
-};
-
-screen_mode_t screen_mode = SCREEN_TABLE;
-static op_mode_t op_mode = OP_TASKS;
-static size_t sort_column = TASK_COL_PERCENT_USER;
-static int sort_reverse = -1;
-static bool excs_all = false;
-
-static const char *read_data(data_t *target)
-{
-	/* Initialize data */
-	target->load = NULL;
-	target->cpus = NULL;
-	target->cpus_perc = NULL;
-	target->tasks = NULL;
-	target->tasks_perc = NULL;
-	target->threads = NULL;
-	target->exceptions = NULL;
-	target->exceptions_perc = NULL;
-	target->physmem = NULL;
-	target->ucycles_diff = NULL;
-	target->kcycles_diff = NULL;
-	target->ecycles_diff = NULL;
-	target->ecount_diff = NULL;
-	target->table.name = NULL;
-	target->table.num_columns = 0;
-	target->table.columns = NULL;
-	target->table.num_fields = 0;
-	target->table.fields = NULL;
-
-	/* Get current time */
-	struct timespec time;
-	getrealtime(&time);
-
-	target->hours = (time.tv_sec % DAY) / HOUR;
-	target->minutes = (time.tv_sec % HOUR) / MINUTE;
-	target->seconds = time.tv_sec % MINUTE;
-
-	/* Get uptime */
-	struct timespec uptime;
-	getuptime(&uptime);
-
-	target->udays = uptime.tv_sec / DAY;
-	target->uhours = (uptime.tv_sec % DAY) / HOUR;
-	target->uminutes = (uptime.tv_sec % HOUR) / MINUTE;
-	target->useconds = uptime.tv_sec % MINUTE;
-
-	/* Get load */
-	target->load = stats_get_load(&(target->load_count));
-	if (target->load == NULL)
-		return "Cannot get system load";
-
-	/* Get CPUs */
-	target->cpus = stats_get_cpus(&(target->cpus_count));
-	if (target->cpus == NULL)
-		return "Cannot get CPUs";
-
-	target->cpus_perc =
-	    (perc_cpu_t *) calloc(target->cpus_count, sizeof(perc_cpu_t));
-	if (target->cpus_perc == NULL)
-		return "Not enough memory for CPU utilization";
-
-	/* Get tasks */
-	target->tasks = stats_get_tasks(&(target->tasks_count));
-	if (target->tasks == NULL)
-		return "Cannot get tasks";
-
-	target->tasks_perc =
-	    (perc_task_t *) calloc(target->tasks_count, sizeof(perc_task_t));
-	if (target->tasks_perc == NULL)
-		return "Not enough memory for task utilization";
-
-	/* Get threads */
-	target->threads = stats_get_threads(&(target->threads_count));
-	if (target->threads == NULL)
-		return "Cannot get threads";
-
-	/* Get Exceptions */
-	target->exceptions = stats_get_exceptions(&(target->exceptions_count));
-	if (target->exceptions == NULL)
-		return "Cannot get exceptions";
-
-	target->exceptions_perc =
-	    (perc_exc_t *) calloc(target->exceptions_count, sizeof(perc_exc_t));
-	if (target->exceptions_perc == NULL)
-		return "Not enough memory for exception utilization";
-
-	/* Get physical memory */
-	target->physmem = stats_get_physmem();
-	if (target->physmem == NULL)
-		return "Cannot get physical memory";
-
-	target->ucycles_diff = calloc(target->tasks_count,
-	    sizeof(uint64_t));
-	if (target->ucycles_diff == NULL)
-		return "Not enough memory for user utilization";
-
-	/* Allocate memory for computed values */
-	target->kcycles_diff = calloc(target->tasks_count,
-	    sizeof(uint64_t));
-	if (target->kcycles_diff == NULL)
-		return "Not enough memory for kernel utilization";
-
-	target->ecycles_diff = calloc(target->exceptions_count,
-	    sizeof(uint64_t));
-	if (target->ecycles_diff == NULL)
-		return "Not enough memory for exception cycles utilization";
-
-	target->ecount_diff = calloc(target->exceptions_count,
-	    sizeof(uint64_t));
-	if (target->ecount_diff == NULL)
-		return "Not enough memory for exception count utilization";
-
-	return NULL;
-}
-
-/** Computes percentage differencies from old_data to new_data
- *
- * @param old_data Pointer to old data strucutre.
- * @param new_data Pointer to actual data where percetages are stored.
- *
- */
-static void compute_percentages(data_t *old_data, data_t *new_data)
-{
-	/*
-	 * For each CPU: Compute total cycles and divide it between
-	 * user and kernel
-	 */
-
-	size_t i;
-	for (i = 0; i < new_data->cpus_count; i++) {
-		uint64_t idle =
-		    new_data->cpus[i].idle_cycles - old_data->cpus[i].idle_cycles;
-		uint64_t busy =
-		    new_data->cpus[i].busy_cycles - old_data->cpus[i].busy_cycles;
-		uint64_t sum = idle + busy;
-
-		FRACTION_TO_FLOAT(new_data->cpus_perc[i].idle, idle * 100, sum);
-		FRACTION_TO_FLOAT(new_data->cpus_perc[i].busy, busy * 100, sum);
-	}
-
-	/* For all tasks compute sum and differencies of all cycles */
-
-	uint64_t virtmem_total = 0;
-	uint64_t resmem_total = 0;
-	uint64_t ucycles_total = 0;
-	uint64_t kcycles_total = 0;
-
-	for (i = 0; i < new_data->tasks_count; i++) {
-		/* Match task with the previous instance */
-
-		bool found = false;
-		size_t j;
-		for (j = 0; j < old_data->tasks_count; j++) {
-			if (new_data->tasks[i].task_id == old_data->tasks[j].task_id) {
-				found = true;
-				break;
-			}
-		}
-
-		if (!found) {
-			/* This is newly borned task, ignore it */
-			new_data->ucycles_diff[i] = 0;
-			new_data->kcycles_diff[i] = 0;
-			continue;
-		}
-
-		new_data->ucycles_diff[i] =
-		    new_data->tasks[i].ucycles - old_data->tasks[j].ucycles;
-		new_data->kcycles_diff[i] =
-		    new_data->tasks[i].kcycles - old_data->tasks[j].kcycles;
-
-		virtmem_total += new_data->tasks[i].virtmem;
-		resmem_total += new_data->tasks[i].resmem;
-		ucycles_total += new_data->ucycles_diff[i];
-		kcycles_total += new_data->kcycles_diff[i];
-	}
-
-	/* For each task compute percential change */
-
-	for (i = 0; i < new_data->tasks_count; i++) {
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem,
-		    new_data->tasks[i].virtmem * 100, virtmem_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem,
-		    new_data->tasks[i].resmem * 100, resmem_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles,
-		    new_data->ucycles_diff[i] * 100, ucycles_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].kcycles,
-		    new_data->kcycles_diff[i] * 100, kcycles_total);
-	}
-
-	/* For all exceptions compute sum and differencies of cycles */
-
-	uint64_t ecycles_total = 0;
-	uint64_t ecount_total = 0;
-
-	for (i = 0; i < new_data->exceptions_count; i++) {
-		/*
-		 * March exception with the previous instance.
-		 * This is quite paranoid since exceptions do not
-		 * usually disappear, but it does not hurt.
-		 */
-
-		bool found = false;
-		size_t j;
-		for (j = 0; j < old_data->exceptions_count; j++) {
-			if (new_data->exceptions[i].id == old_data->exceptions[j].id) {
-				found = true;
-				break;
-			}
-		}
-
-		if (!found) {
-			/* This is a new exception, ignore it */
-			new_data->ecycles_diff[i] = 0;
-			new_data->ecount_diff[i] = 0;
-			continue;
-		}
-
-		new_data->ecycles_diff[i] =
-		    new_data->exceptions[i].cycles - old_data->exceptions[j].cycles;
-		new_data->ecount_diff[i] =
-		    new_data->exceptions[i].count - old_data->exceptions[i].count;
-
-		ecycles_total += new_data->ecycles_diff[i];
-		ecount_total += new_data->ecount_diff[i];
-	}
-
-	/* For each exception compute percential change */
-
-	for (i = 0; i < new_data->exceptions_count; i++) {
-		FRACTION_TO_FLOAT(new_data->exceptions_perc[i].cycles,
-		    new_data->ecycles_diff[i] * 100, ecycles_total);
-		FRACTION_TO_FLOAT(new_data->exceptions_perc[i].count,
-		    new_data->ecount_diff[i] * 100, ecount_total);
-	}
-}
-
-static int cmp_data(void *a, void *b, void *arg)
-{
-	field_t *fa = (field_t *)a + sort_column;
-	field_t *fb = (field_t *)b + sort_column;
-
-	if (fa->type > fb->type)
-		return 1 * sort_reverse;
-
-	if (fa->type < fb->type)
-		return -1 * sort_reverse;
-
-	switch (fa->type) {
-	case FIELD_EMPTY:
-		return 0;
-	case FIELD_UINT_SUFFIX_BIN: /* fallthrough */
-	case FIELD_UINT_SUFFIX_DEC: /* fallthrough */
-	case FIELD_UINT:
-		if (fa->uint > fb->uint)
-			return 1 * sort_reverse;
-		if (fa->uint < fb->uint)
-			return -1 * sort_reverse;
-		return 0;
-	case FIELD_PERCENT:
-		if (fa->fixed.upper * fb->fixed.lower >
-		    fb->fixed.upper * fa->fixed.lower)
-			return 1 * sort_reverse;
-		if (fa->fixed.upper * fb->fixed.lower <
-		    fb->fixed.upper * fa->fixed.lower)
-			return -1 * sort_reverse;
-		return 0;
-	case FIELD_STRING:
-		return str_cmp(fa->string, fb->string) * sort_reverse;
-	}
-
-	return 0;
-}
-
-static void sort_table(table_t *table)
-{
-	if (sort_column >= table->num_columns)
-		sort_column = 0;
-	/* stable sort is probably best, so we use gsort */
-	gsort((void *) table->fields, table->num_fields / table->num_columns,
-	    sizeof(field_t) * table->num_columns, cmp_data, NULL);
-}
-
-static const char *fill_task_table(data_t *data)
-{
-	data->table.name = "Tasks";
-	data->table.num_columns = TASK_NUM_COLUMNS;
-	data->table.columns = task_columns;
-	data->table.num_fields = data->tasks_count * TASK_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields,
-	    sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->tasks_count; i++) {
-		stats_task_t *task = &data->tasks[i];
-		perc_task_t *perc = &data->tasks_perc[i];
-		field[TASK_COL_ID].type = FIELD_UINT;
-		field[TASK_COL_ID].uint = task->task_id;
-		field[TASK_COL_NUM_THREADS].type = FIELD_UINT;
-		field[TASK_COL_NUM_THREADS].uint = task->threads;
-		field[TASK_COL_RESIDENT].type = FIELD_UINT_SUFFIX_BIN;
-		field[TASK_COL_RESIDENT].uint = task->resmem;
-		field[TASK_COL_PERCENT_RESIDENT].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_RESIDENT].fixed = perc->resmem;
-		field[TASK_COL_VIRTUAL].type = FIELD_UINT_SUFFIX_BIN;
-		field[TASK_COL_VIRTUAL].uint = task->virtmem;
-		field[TASK_COL_PERCENT_VIRTUAL].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_VIRTUAL].fixed = perc->virtmem;
-		field[TASK_COL_PERCENT_USER].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_USER].fixed = perc->ucycles;
-		field[TASK_COL_PERCENT_KERNEL].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_KERNEL].fixed = perc->kcycles;
-		field[TASK_COL_NAME].type = FIELD_STRING;
-		field[TASK_COL_NAME].string = task->name;
-		field += TASK_NUM_COLUMNS;
-	}
-
-	return NULL;
-}
-
-static const char *fill_ipc_table(data_t *data)
-{
-	data->table.name = "IPC";
-	data->table.num_columns = IPC_NUM_COLUMNS;
-	data->table.columns = ipc_columns;
-	data->table.num_fields = data->tasks_count * IPC_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields,
-	    sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->tasks_count; i++) {
-		field[IPC_COL_TASKID].type = FIELD_UINT;
-		field[IPC_COL_TASKID].uint = data->tasks[i].task_id;
-		field[IPC_COL_CLS_SNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_CLS_SNT].uint = data->tasks[i].ipc_info.call_sent;
-		field[IPC_COL_CLS_RCV].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_CLS_RCV].uint = data->tasks[i].ipc_info.call_received;
-		field[IPC_COL_ANS_SNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_ANS_SNT].uint = data->tasks[i].ipc_info.answer_sent;
-		field[IPC_COL_ANS_RCV].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_ANS_RCV].uint = data->tasks[i].ipc_info.answer_received;
-		field[IPC_COL_FORWARD].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_FORWARD].uint = data->tasks[i].ipc_info.forwarded;
-		field[IPC_COL_NAME].type = FIELD_STRING;
-		field[IPC_COL_NAME].string = data->tasks[i].name;
-		field += IPC_NUM_COLUMNS;
-	}
-
-	return NULL;
-}
-
-static const char *fill_exception_table(data_t *data)
-{
-	data->table.name = "Exceptions";
-	data->table.num_columns = EXCEPTION_NUM_COLUMNS;
-	data->table.columns = exception_columns;
-	data->table.num_fields = data->exceptions_count *
-	    EXCEPTION_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields, sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->exceptions_count; i++) {
-		if (!excs_all && !data->exceptions[i].hot)
-			continue;
-		field[EXCEPTION_COL_ID].type = FIELD_UINT;
-		field[EXCEPTION_COL_ID].uint = data->exceptions[i].id;
-		field[EXCEPTION_COL_COUNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[EXCEPTION_COL_COUNT].uint = data->exceptions[i].count;
-		field[EXCEPTION_COL_PERCENT_COUNT].type = FIELD_PERCENT;
-		field[EXCEPTION_COL_PERCENT_COUNT].fixed = data->exceptions_perc[i].count;
-		field[EXCEPTION_COL_CYCLES].type = FIELD_UINT_SUFFIX_DEC;
-		field[EXCEPTION_COL_CYCLES].uint = data->exceptions[i].cycles;
-		field[EXCEPTION_COL_PERCENT_CYCLES].type = FIELD_PERCENT;
-		field[EXCEPTION_COL_PERCENT_CYCLES].fixed = data->exceptions_perc[i].cycles;
-		field[EXCEPTION_COL_DESCRIPTION].type = FIELD_STRING;
-		field[EXCEPTION_COL_DESCRIPTION].string = data->exceptions[i].desc;
-		field += EXCEPTION_NUM_COLUMNS;
-	}
-
-	/* in case any cold exceptions were ignored */
-	data->table.num_fields = field - data->table.fields;
-
-	return NULL;
-}
-
-static const char *fill_table(data_t *data)
-{
-	if (data->table.fields != NULL) {
-		free(data->table.fields);
-		data->table.fields = NULL;
-	}
-
-	switch (op_mode) {
-	case OP_TASKS:
-		return fill_task_table(data);
-	case OP_IPC:
-		return fill_ipc_table(data);
-	case OP_EXCS:
-		return fill_exception_table(data);
-	}
-	return NULL;
-}
-
-static void free_data(data_t *target)
-{
-	if (target->load != NULL)
-		free(target->load);
-
-	if (target->cpus != NULL)
-		free(target->cpus);
-
-	if (target->cpus_perc != NULL)
-		free(target->cpus_perc);
-
-	if (target->tasks != NULL)
-		free(target->tasks);
-
-	if (target->tasks_perc != NULL)
-		free(target->tasks_perc);
-
-	if (target->threads != NULL)
-		free(target->threads);
-
-	if (target->exceptions != NULL)
-		free(target->exceptions);
-
-	if (target->exceptions_perc != NULL)
-		free(target->exceptions_perc);
-
-	if (target->physmem != NULL)
-		free(target->physmem);
-
-	if (target->ucycles_diff != NULL)
-		free(target->ucycles_diff);
-
-	if (target->kcycles_diff != NULL)
-		free(target->kcycles_diff);
-
-	if (target->ecycles_diff != NULL)
-		free(target->ecycles_diff);
-
-	if (target->ecount_diff != NULL)
-		free(target->ecount_diff);
-
-	if (target->table.fields != NULL)
-		free(target->table.fields);
-}
-
-int main(int argc, char *argv[])
-{
-	data_t data;
-	data_t data_prev;
-	const char *ret = NULL;
-	errno_t rc;
-	int c;
-
-	screen_init();
-	printf("Reading initial data...\n");
-
-	if ((ret = read_data(&data)) != NULL)
-		goto out;
-
-	/* Compute some rubbish to have initialised values */
-	compute_percentages(&data, &data);
-
-	/* And paint screen until death */
-	while (true) {
-		rc = tgetchar(UPDATE_INTERVAL, &c);
-
-		if (rc == ETIMEOUT) { /* timeout */
-			data_prev = data;
-			if ((ret = read_data(&data)) != NULL) {
-				free_data(&data_prev);
-				goto out;
-			}
-
-			compute_percentages(&data_prev, &data);
-			free_data(&data_prev);
-
-			c = -1;
-		} else if (rc != EOK) {
-			/* Error (e.g. communication with console lost) */
-			goto out;
-		}
-
-		if (screen_mode == SCREEN_HELP && c >= 0) {
-			if (c == 'h' || c == '?')
-				c = -1;
-			/* go back to table and handle the key */
-			screen_mode = SCREEN_TABLE;
-		}
-
-		if (screen_mode == SCREEN_SORT && c >= 0) {
-			for (size_t i = 0; i < data.table.num_columns; i++) {
-				if (data.table.columns[i].key == c) {
-					sort_column = i;
-					screen_mode = SCREEN_TABLE;
-				}
-			}
-
-			c = -1;
-		}
-
-		switch (c) {
-		case -1: /* do nothing */
-			break;
-		case 't':
-			op_mode = OP_TASKS;
-			break;
-		case 'i':
-			op_mode = OP_IPC;
-			break;
-		case 'e':
-			op_mode = OP_EXCS;
-			break;
-		case 's':
-			screen_mode = SCREEN_SORT;
-			break;
-		case 'r':
-			sort_reverse = -sort_reverse;
-			break;
-		case 'h':
-		case '?':
-			screen_mode = SCREEN_HELP;
-			break;
-		case 'q':
-			goto out;
-		case 'a':
-			if (op_mode == OP_EXCS) {
-				excs_all = !excs_all;
-				if (excs_all)
-					show_warning("Showing all exceptions");
-				else
-					show_warning("Showing only hot exceptions");
-				break;
-			}
-			/* Fallthrough */
-		default:
-			show_warning("Unknown command \"%c\", use \"h\" for help", c);
-			continue; /* don't redraw */
-		}
-
-		if ((ret = fill_table(&data)) != NULL) {
-			goto out;
-		}
-		sort_table(&data.table);
-		print_data(&data);
-	}
-
-out:
-	screen_done();
-	free_data(&data);
-
-	if (ret != NULL) {
-		fprintf(stderr, "%s: %s\n", NAME, ret);
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/top/top.h
===================================================================
--- uspace/app/top/top.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @{
- */
-
-#ifndef TOP_TOP_H_
-#define TOP_TOP_H_
-
-#include <task.h>
-#include <stats.h>
-#include <time.h>
-
-#define FRACTION_TO_FLOAT(float, a, b) \
-	do { \
-		if ((b) != 0) { \
-			(float).upper = (a); \
-			(float).lower = (b); \
-		} else { \
-			(float).upper = 0; \
-			(float).lower = 1; \
-		} \
-	} while (0)
-
-typedef enum {
-	SCREEN_TABLE,
-	SCREEN_SORT,
-	SCREEN_HELP,
-} screen_mode_t;
-
-extern screen_mode_t screen_mode;
-
-typedef struct {
-	uint64_t upper;
-	uint64_t lower;
-} fixed_float;
-
-typedef struct {
-	fixed_float idle;
-	fixed_float busy;
-} perc_cpu_t;
-
-typedef struct {
-	fixed_float virtmem;
-	fixed_float resmem;
-	fixed_float ucycles;
-	fixed_float kcycles;
-} perc_task_t;
-
-typedef struct {
-	fixed_float cycles;
-	fixed_float count;
-} perc_exc_t;
-
-typedef enum {
-	FIELD_EMPTY,
-	FIELD_UINT,
-	FIELD_UINT_SUFFIX_BIN,
-	FIELD_UINT_SUFFIX_DEC,
-	FIELD_PERCENT,
-	FIELD_STRING
-} field_type_t;
-
-typedef struct {
-	field_type_t type;
-	union {
-		fixed_float fixed;
-		uint64_t uint;
-		const char *string;
-	};
-} field_t;
-
-typedef struct {
-	const char *name;
-	char key;
-	int width;
-} column_t;
-
-typedef struct {
-	const char *name;
-	size_t num_columns;
-	const column_t *columns;
-	size_t num_fields;
-	field_t *fields;
-} table_t;
-
-typedef struct {
-	time_t hours;
-	time_t minutes;
-	time_t seconds;
-
-	sysarg_t udays;
-	sysarg_t uhours;
-	sysarg_t uminutes;
-	sysarg_t useconds;
-
-	size_t load_count;
-	load_t *load;
-
-	size_t cpus_count;
-	stats_cpu_t *cpus;
-	perc_cpu_t *cpus_perc;
-
-	size_t tasks_count;
-	stats_task_t *tasks;
-	perc_task_t *tasks_perc;
-
-	size_t threads_count;
-	stats_thread_t *threads;
-
-	size_t exceptions_count;
-	stats_exc_t *exceptions;
-	perc_exc_t *exceptions_perc;
-
-	stats_physmem_t *physmem;
-
-	uint64_t *ucycles_diff;
-	uint64_t *kcycles_diff;
-	uint64_t *ecycles_diff;
-	uint64_t *ecount_diff;
-
-	table_t table;
-} data_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/app/trace/doc/doxygroups.h
===================================================================
--- uspace/app/trace/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup trace trace
- * @brief Tracing utility
- * @ingroup apps
- */
Index: pace/app/trace/ipc_desc.c
===================================================================
--- uspace/app/trace/ipc_desc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#include <abi/ipc/methods.h>
-#include <stdlib.h>
-#include "ipc_desc.h"
-
-ipc_m_desc_t ipc_methods[] = {
-	/* System methods */
-	{ IPC_M_PHONE_HUNGUP,     "PHONE_HUNGUP" },
-	{ IPC_M_CONNECT_ME_TO,    "CONNECT_ME_TO" },
-	{ IPC_M_CONNECT_TO_ME,    "CONNECT_TO_ME" },
-	{ IPC_M_SHARE_OUT,        "SHARE_OUT" },
-	{ IPC_M_SHARE_IN,         "SHARE_IN" },
-	{ IPC_M_DATA_WRITE,       "DATA_WRITE" },
-	{ IPC_M_DATA_READ,        "DATA_READ" },
-	{ IPC_M_DEBUG,            "DEBUG" },
-};
-
-size_t ipc_methods_len = sizeof(ipc_methods) / sizeof(ipc_m_desc_t);
-
-/** @}
- */
Index: pace/app/trace/ipc_desc.h
===================================================================
--- uspace/app/trace/ipc_desc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#ifndef IPC_DESC_H_
-#define IPC_DESC_H_
-
-typedef struct {
-	int number;
-	const char *name;
-} ipc_m_desc_t;
-
-extern ipc_m_desc_t ipc_methods[];
-extern size_t ipc_methods_len;
-
-#endif
-
-/** @}
- */
Index: pace/app/trace/ipcp.c
===================================================================
--- uspace/app/trace/ipcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,359 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <adt/hash_table.h>
-#include <abi/ipc/methods.h>
-#include <macros.h>
-#include "ipc_desc.h"
-#include "proto.h"
-#include "trace.h"
-#include "ipcp.h"
-
-typedef struct {
-	cap_phone_handle_t phone_handle;
-	ipc_call_t question;
-	oper_t *oper;
-
-	cap_call_handle_t call_handle;
-
-	ht_link_t link;
-} pending_call_t;
-
-typedef struct {
-	int server;
-	proto_t *proto;
-} connection_t;
-
-#define MAX_PHONE 64
-connection_t connections[MAX_PHONE];
-int have_conn[MAX_PHONE];
-
-static hash_table_t pending_calls;
-
-/*
- * Pseudo-protocols
- */
-proto_t *proto_system;		/**< Protocol describing system IPC methods. */
-proto_t	*proto_unknown;		/**< Protocol with no known methods. */
-
-static size_t pending_call_key_hash(const void *key)
-{
-	const cap_call_handle_t *chandle = key;
-	return cap_handle_raw(*chandle);
-}
-
-static size_t pending_call_hash(const ht_link_t *item)
-{
-	pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
-	return cap_handle_raw(hs->call_handle);
-}
-
-static bool pending_call_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const cap_call_handle_t *chandle = key;
-	pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link);
-
-	return *chandle == hs->call_handle;
-}
-
-static const hash_table_ops_t pending_call_ops = {
-	.hash = pending_call_hash,
-	.key_hash = pending_call_key_hash,
-	.key_equal = pending_call_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-void ipcp_connection_set(cap_phone_handle_t phone, int server, proto_t *proto)
-{
-	// XXX: there is no longer a limit on the number of phones as phones are
-	// now handled using capabilities
-	if (cap_handle_raw(phone) < 0 || cap_handle_raw(phone) >= MAX_PHONE)
-		return;
-	connections[cap_handle_raw(phone)].server = server;
-	connections[cap_handle_raw(phone)].proto = proto;
-	have_conn[cap_handle_raw(phone)] = 1;
-}
-
-void ipcp_connection_clear(cap_phone_handle_t phone)
-{
-	have_conn[cap_handle_raw(phone)] = 0;
-	connections[cap_handle_raw(phone)].server = 0;
-	connections[cap_handle_raw(phone)].proto = NULL;
-}
-
-static void ipc_m_print(proto_t *proto, sysarg_t method)
-{
-	oper_t *oper;
-
-	/* Try system methods first */
-	oper = proto_get_oper(proto_system, method);
-
-	if (oper == NULL && proto != NULL) {
-		/* Not a system method, try the user protocol. */
-		oper = proto_get_oper(proto, method);
-	}
-
-	if (oper != NULL) {
-		printf("%s (%" PRIun ")", oper->name, method);
-		return;
-	}
-
-	printf("%" PRIun, method);
-}
-
-void ipcp_init(void)
-{
-	val_type_t arg_def[OPER_MAX_ARGS] = {
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER
-	};
-
-	/*
-	 * Create a pseudo-protocol 'unknown' that has no known methods.
-	 */
-	proto_unknown = proto_new("unknown");
-
-	/*
-	 * Create a pseudo-protocol 'system' defining names of system IPC
-	 * methods.
-	 */
-	proto_system = proto_new("system");
-
-	for (size_t i = 0; i < ipc_methods_len; i++) {
-		oper_t *oper = oper_new(ipc_methods[i].name, OPER_MAX_ARGS,
-		    arg_def, V_INTEGER, OPER_MAX_ARGS, arg_def);
-		proto_add_oper(proto_system, ipc_methods[i].number, oper);
-	}
-
-	bool ok = hash_table_create(&pending_calls, 0, 0, &pending_call_ops);
-	assert(ok);
-}
-
-void ipcp_cleanup(void)
-{
-	proto_delete(proto_system);
-	hash_table_destroy(&pending_calls);
-}
-
-void ipcp_call_out(cap_phone_handle_t phandle, ipc_call_t *call,
-    cap_call_handle_t chandle)
-{
-	pending_call_t *pcall;
-	proto_t *proto;
-	oper_t *oper;
-	sysarg_t *args;
-	int i;
-
-	if (have_conn[cap_handle_raw(phandle)])
-		proto = connections[cap_handle_raw(phandle)].proto;
-	else
-		proto = NULL;
-
-	args = call->args;
-
-	if ((display_mask & DM_IPC) != 0) {
-		printf("Call handle: %p, phone: %p, proto: %s, method: ",
-		    chandle, phandle, (proto ? proto->name : "n/a"));
-		ipc_m_print(proto, ipc_get_imethod(call));
-		printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", "
-		    "%" PRIun ", %" PRIun ")\n",
-		    args[1], args[2], args[3], args[4], args[5]);
-	}
-
-	if ((display_mask & DM_USER) != 0) {
-
-		if (proto != NULL) {
-			oper = proto_get_oper(proto, ipc_get_imethod(call));
-		} else {
-			oper = NULL;
-		}
-
-		if (oper != NULL) {
-
-			printf("%s(%p).%s", (proto ? proto->name : "n/a"),
-			    phandle, (oper ? oper->name : "unknown"));
-
-			putchar('(');
-			for (i = 1; i <= oper->argc; ++i) {
-				if (i > 1)
-					printf(", ");
-				val_print(args[i], oper->arg_type[i - 1]);
-			}
-			putchar(')');
-
-			if (oper->rv_type == V_VOID && oper->respc == 0) {
-				/*
-				 * No response data (typically the task will
-				 * not be interested in the response).
-				 * We will not display response.
-				 */
-				putchar('.');
-			}
-
-			putchar('\n');
-		}
-	} else {
-		oper = NULL;
-	}
-
-	/* Store call in hash table for response matching */
-
-	pcall = malloc(sizeof(pending_call_t));
-	pcall->phone_handle = phandle;
-	pcall->question = *call;
-	pcall->call_handle = chandle;
-	pcall->oper = oper;
-
-	hash_table_insert(&pending_calls, &pcall->link);
-}
-
-static void parse_answer(cap_call_handle_t call_handle, pending_call_t *pcall,
-    ipc_call_t *answer)
-{
-	cap_phone_handle_t phone;
-	sysarg_t method;
-	sysarg_t service;
-	errno_t retval;
-	proto_t *proto;
-	cap_phone_handle_t cphone;
-
-	sysarg_t *resp;
-	oper_t *oper;
-	int i;
-
-	phone = pcall->phone_handle;
-	method = ipc_get_imethod(&pcall->question);
-	retval = ipc_get_retval(answer);
-
-	resp = answer->args;
-
-	if ((display_mask & DM_IPC) != 0) {
-		printf("Response to %p: retval=%s, args = (%" PRIun ", "
-		    "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n",
-		    call_handle, str_error_name(retval), ipc_get_arg1(answer),
-		    ipc_get_arg2(answer), ipc_get_arg3(answer),
-		    ipc_get_arg4(answer), ipc_get_arg5(answer));
-	}
-
-	if ((display_mask & DM_USER) != 0) {
-		oper = pcall->oper;
-
-		if ((oper != NULL) &&
-		    ((oper->rv_type != V_VOID) || (oper->respc > 0))) {
-			printf("->");
-
-			if (oper->rv_type != V_VOID) {
-				putchar(' ');
-				val_print((sysarg_t) retval, oper->rv_type);
-			}
-
-			if (oper->respc > 0) {
-				putchar(' ');
-				putchar('(');
-				for (i = 1; i <= oper->respc; ++i) {
-					if (i > 1)
-						printf(", ");
-					val_print(resp[i], oper->resp_type[i - 1]);
-				}
-				putchar(')');
-			}
-
-			putchar('\n');
-		}
-	}
-
-	if ((phone == PHONE_NS) && (method == IPC_M_CONNECT_ME_TO) &&
-	    (retval == 0)) {
-		/* Connected to a service (through NS) */
-		service = ipc_get_arg2(&pcall->question);
-		proto = proto_get_by_srv(service);
-		if (proto == NULL)
-			proto = proto_unknown;
-
-		cphone = (cap_phone_handle_t) ipc_get_arg5(answer);
-		if ((display_mask & DM_SYSTEM) != 0) {
-			printf("Registering connection (phone %p, protocol: %s)\n", cphone,
-			    proto->name);
-		}
-
-		ipcp_connection_set(cphone, 0, proto);
-	}
-}
-
-void ipcp_call_in(ipc_call_t *call, cap_call_handle_t chandle)
-{
-	ht_link_t *item;
-	pending_call_t *pcall;
-
-	if ((call->flags & IPC_CALL_ANSWERED) == 0) {
-		/* Not a response */
-		if ((display_mask & DM_IPC) != 0) {
-			printf("Not a response (handle %p)\n", chandle);
-		}
-		return;
-	}
-
-	item = hash_table_find(&pending_calls, &chandle);
-	if (item == NULL)
-		return; /* No matching question found */
-
-	/*
-	 * Response matched to question.
-	 */
-
-	pcall = hash_table_get_inst(item, pending_call_t, link);
-	hash_table_remove(&pending_calls, &chandle);
-
-	parse_answer(chandle, pcall, call);
-	free(pcall);
-}
-
-void ipcp_hangup(cap_phone_handle_t phone, errno_t rc)
-{
-	if ((display_mask & DM_SYSTEM) != 0) {
-		printf("Hang up phone %p -> %s\n", phone, str_error_name(rc));
-		ipcp_connection_clear(phone);
-	}
-}
-
-/** @}
- */
Index: pace/app/trace/ipcp.h
===================================================================
--- uspace/app/trace/ipcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#ifndef IPCP_H_
-#define IPCP_H_
-
-#include "proto.h"
-
-extern void ipcp_init(void);
-extern void ipcp_cleanup(void);
-
-extern void ipcp_call_out(cap_phone_handle_t, ipc_call_t *, cap_call_handle_t);
-extern void ipcp_call_sync(cap_phone_handle_t, ipc_call_t *, ipc_call_t *);
-extern void ipcp_call_in(ipc_call_t *, cap_call_handle_t);
-extern void ipcp_hangup(cap_phone_handle_t, errno_t);
-
-extern void ipcp_connection_set(cap_phone_handle_t, int, proto_t *);
-extern void ipcp_connection_clear(cap_phone_handle_t);
-
-#endif
-
-/** @}
- */
Index: pace/app/trace/meson.build
===================================================================
--- uspace/app/trace/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'console' ]
-src = files(
-	'trace.c',
-	'syscalls.c',
-	'ipcp.c',
-	'ipc_desc.c',
-	'proto.c',
-)
Index: pace/app/trace/proto.c
===================================================================
--- uspace/app/trace/proto.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,218 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <adt/hash_table.h>
-
-#include "trace.h"
-#include "proto.h"
-
-/* Maps service number to protocol */
-static hash_table_t srv_proto;
-
-typedef struct {
-	int srv;
-	proto_t *proto;
-	ht_link_t link;
-} srv_proto_t;
-
-typedef struct {
-	int method;
-	oper_t *oper;
-	ht_link_t link;
-} method_oper_t;
-
-/* Hash table operations. */
-
-static size_t srv_proto_key_hash(const void *key)
-{
-	const int *n = key;
-	return *n;
-}
-
-static size_t srv_proto_hash(const ht_link_t *item)
-{
-	srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
-	return sp->srv;
-}
-
-static bool srv_proto_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const int *n = key;
-	srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
-	return sp->srv == *n;
-}
-
-static const hash_table_ops_t srv_proto_ops = {
-	.hash = srv_proto_hash,
-	.key_hash = srv_proto_key_hash,
-	.key_equal = srv_proto_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static size_t method_oper_key_hash(const void *key)
-{
-	const int *n = key;
-	return *n;
-}
-
-static size_t method_oper_hash(const ht_link_t *item)
-{
-	method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
-	return mo->method;
-}
-
-static bool method_oper_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const int *n = key;
-	method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
-	return mo->method == *n;
-}
-
-static const hash_table_ops_t method_oper_ops = {
-	.hash = method_oper_hash,
-	.key_hash = method_oper_key_hash,
-	.key_equal = method_oper_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-void proto_init(void)
-{
-	/* todo: check return value. */
-	bool ok = hash_table_create(&srv_proto, 0, 0, &srv_proto_ops);
-	assert(ok);
-}
-
-void proto_cleanup(void)
-{
-	hash_table_destroy(&srv_proto);
-}
-
-void proto_register(int srv, proto_t *proto)
-{
-	srv_proto_t *sp;
-
-	sp = malloc(sizeof(srv_proto_t));
-	sp->srv = srv;
-	sp->proto = proto;
-
-	hash_table_insert(&srv_proto, &sp->link);
-}
-
-proto_t *proto_get_by_srv(int srv)
-{
-	ht_link_t *item = hash_table_find(&srv_proto, &srv);
-	if (item == NULL)
-		return NULL;
-
-	srv_proto_t *sp = hash_table_get_inst(item, srv_proto_t, link);
-	return sp->proto;
-}
-
-static void proto_struct_init(proto_t *proto, const char *name)
-{
-	proto->name = name;
-	/* todo: check return value. */
-	bool ok = hash_table_create(&proto->method_oper, 0, 0, &method_oper_ops);
-	assert(ok);
-}
-
-proto_t *proto_new(const char *name)
-{
-	proto_t *p;
-
-	p = malloc(sizeof(proto_t));
-	proto_struct_init(p, name);
-
-	return p;
-}
-
-void proto_delete(proto_t *proto)
-{
-	free(proto);
-}
-
-void proto_add_oper(proto_t *proto, int method, oper_t *oper)
-{
-	method_oper_t *mo;
-
-	mo = malloc(sizeof(method_oper_t));
-	mo->method = method;
-	mo->oper = oper;
-
-	hash_table_insert(&proto->method_oper, &mo->link);
-}
-
-oper_t *proto_get_oper(proto_t *proto, int method)
-{
-	ht_link_t *item = hash_table_find(&proto->method_oper, &method);
-	if (item == NULL)
-		return NULL;
-
-	method_oper_t *mo = hash_table_get_inst(item, method_oper_t, link);
-	return mo->oper;
-}
-
-static void oper_struct_init(oper_t *oper, const char *name)
-{
-	oper->name = name;
-}
-
-oper_t *oper_new(const char *name, int argc, val_type_t *arg_types,
-    val_type_t rv_type, int respc, val_type_t *resp_types)
-{
-	oper_t *o;
-	int i;
-
-	o = malloc(sizeof(oper_t));
-	oper_struct_init(o, name);
-
-	o->argc = argc;
-	for (i = 0; i < argc; i++)
-		o->arg_type[i] = arg_types[i];
-
-	o->rv_type = rv_type;
-
-	o->respc = respc;
-	for (i = 0; i < respc; i++)
-		o->resp_type[i] = resp_types[i];
-
-	return o;
-}
-
-/** @}
- */
Index: pace/app/trace/proto.h
===================================================================
--- uspace/app/trace/proto.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#ifndef PROTO_H_
-#define PROTO_H_
-
-#include <ipc/common.h>
-#include <adt/hash_table.h>
-#include "trace.h"
-
-#define OPER_MAX_ARGS (IPC_CALL_LEN - 1)
-
-typedef struct {
-	const char *name;
-
-	int argc;
-	val_type_t arg_type[OPER_MAX_ARGS];
-
-	val_type_t rv_type;
-
-	int respc;
-	val_type_t resp_type[OPER_MAX_ARGS];
-} oper_t;
-
-typedef struct {
-	/** Protocol name */
-	const char *name;
-
-	/** Maps method number to operation */
-	hash_table_t method_oper;
-} proto_t;
-
-extern void proto_init(void);
-extern void proto_cleanup(void);
-
-extern void proto_register(int, proto_t *);
-extern proto_t *proto_get_by_srv(int);
-extern proto_t *proto_new(const char *);
-extern void proto_delete(proto_t *);
-extern void proto_add_oper(proto_t *, int, oper_t *);
-extern oper_t *proto_get_oper(proto_t *, int);
-
-extern oper_t *oper_new(const char *, int, val_type_t *, val_type_t, int,
-    val_type_t *);
-
-#endif
-
-/** @}
- */
Index: pace/app/trace/syscalls.c
===================================================================
--- uspace/app/trace/syscalls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#include <abi/syscall.h>
-#include "syscalls.h"
-#include "trace.h"
-
-const sc_desc_t syscall_desc[] = {
-	/* System management syscalls. */
-	[SYS_KIO] = { "kio", 3, V_INT_ERRNO },
-	[SYS_REBOOT] = { "reboot", 0, V_ERRNO },
-
-	/* Thread and task related syscalls. */
-	[SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO },
-	[SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO },
-	[SYS_THREAD_GET_ID] = { "thread_get_id", 1, V_ERRNO },
-	[SYS_THREAD_USLEEP] = { "thread_usleep", 1, V_ERRNO },
-	[SYS_THREAD_UDELAY] = { "thread_udelay", 1, V_ERRNO },
-
-	[SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO },
-	[SYS_TASK_SET_NAME] = { "task_set_name", 2, V_ERRNO },
-	[SYS_TASK_KILL] = { "task_kill", 1, V_ERRNO },
-	[SYS_TASK_EXIT] = { "task_exit", 1, V_ERRNO },
-	[SYS_PROGRAM_SPAWN_LOADER] = { "program_spawn_loader", 2, V_ERRNO },
-
-	/* Synchronization related syscalls. */
-	[SYS_WAITQ_CREATE] = { "waitq_create", 1, V_ERRNO },
-	[SYS_WAITQ_SLEEP] = { "waitq_sleep", 3, V_ERRNO },
-	[SYS_WAITQ_WAKEUP] = { "waitq_wakeup", 1, V_ERRNO },
-	[SYS_WAITQ_DESTROY] = { "waitq_destroy", 1, V_ERRNO },
-	[SYS_SMC_COHERENCE] = { "smc_coherence", 2, V_ERRNO },
-
-	/* Address space related syscalls. */
-	[SYS_AS_AREA_CREATE] = { "as_area_create", 5, V_ERRNO },
-	[SYS_AS_AREA_RESIZE] = { "as_area_resize", 3, V_ERRNO },
-	[SYS_AS_AREA_CHANGE_FLAGS] = { "as_area_change_flags", 2, V_ERRNO },
-	[SYS_AS_AREA_GET_INFO] = { "as_area_get_info", 2, V_ERRNO },
-	[SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO },
-
-	/* Page mapping related syscalls. */
-	[SYS_PAGE_FIND_MAPPING] = { "page_find_mapping", 2, V_ERRNO },
-
-	/* IPC related syscalls. */
-	[SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH },
-	[SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 3, V_HASH },
-	[SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO },
-	[SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO },
-	[SYS_IPC_FORWARD_FAST] = { "ipc_forward_fast", 6, V_ERRNO },
-	[SYS_IPC_FORWARD_SLOW] = { "ipc_forward_slow", 3, V_ERRNO },
-	[SYS_IPC_WAIT] = { "ipc_wait_for_call", 3, V_HASH },
-	[SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO },
-	[SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO },
-	[SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 2, V_ERRNO },
-
-	/* Event notification syscalls. */
-	[SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe", 2, V_ERRNO },
-	[SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe", 1, V_ERRNO },
-	[SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask", 1, V_ERRNO },
-
-	/* Permission related syscalls. */
-	[SYS_PERM_GRANT] = { "perm_grant", 2, V_ERRNO },
-	[SYS_PERM_REVOKE] = { "perm_revoke", 2, V_ERRNO },
-
-	/* DDI related syscalls. */
-	[SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO },
-	[SYS_PHYSMEM_UNMAP] = { "physmem_unmap", 1, V_ERRNO },
-	[SYS_DMAMEM_MAP] = { "dmamem_map", 6, V_ERRNO },
-	[SYS_DMAMEM_UNMAP] = { "dmamem_unmap", 3, V_ERRNO },
-	[SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO },
-	[SYS_IOSPACE_DISABLE] = { "iospace_disable", 1, V_ERRNO },
-
-	[SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe", 4, V_ERRNO },
-	[SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe", 2, V_ERRNO },
-
-	/* Sysinfo syscalls. */
-	[SYS_SYSINFO_GET_KEYS_SIZE] = { "sysinfo_get_keys_size", 3, V_ERRNO },
-	[SYS_SYSINFO_GET_KEYS] = { "sysinfo_get_keys", 5, V_ERRNO },
-	[SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER },
-	[SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO },
-	[SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size", 3, V_ERRNO },
-	[SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO },
-
-	/* Kernel console syscalls. */
-	[SYS_DEBUG_CONSOLE] = { "debug_console", 0, V_ERRNO },
-
-	[SYS_KLOG] = { "klog", 5, V_ERRNO },
-	[SYS_KIO_READ] = { "kio_read", 3, V_INTEGER },
-};
-
-const size_t syscall_desc_len = (sizeof(syscall_desc) / sizeof(sc_desc_t));
-
-/** @}
- */
Index: pace/app/trace/syscalls.h
===================================================================
--- uspace/app/trace/syscalls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#ifndef SYSCALLS_H_
-#define SYSCALLS_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-
-#include "trace.h"
-
-typedef struct {
-	const char *name;
-	int n_args;
-	val_type_t rv_type;
-} sc_desc_t;
-
-extern const sc_desc_t syscall_desc[];
-extern const size_t syscall_desc_len;
-
-static inline bool syscall_desc_defined(unsigned sc_id)
-{
-	return (sc_id < syscall_desc_len && syscall_desc[sc_id].name != NULL);
-}
-
-#endif
-
-/** @}
- */
Index: pace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,841 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <fibril.h>
-#include <errno.h>
-#include <udebug.h>
-#include <async.h>
-#include <task.h>
-#include <mem.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <fibril_synch.h>
-#include <vfs/vfs.h>
-
-#include <libc.h>
-
-/* Temporary: service and method names */
-#include "proto.h"
-#include <ipc/services.h>
-#include <ipc/vfs.h>
-#include <ipc/console.h>
-
-#include "syscalls.h"
-#include "ipcp.h"
-#include "trace.h"
-
-#define THBUF_SIZE 64
-uintptr_t thread_hash_buf[THBUF_SIZE];
-int n_threads;
-
-int next_thread_id;
-
-ipc_call_t thread_ipc_req[THBUF_SIZE];
-
-async_sess_t *sess;
-bool abort_trace;
-
-uintptr_t thash;
-static bool paused;
-static fibril_condvar_t state_cv;
-static fibril_mutex_t state_lock;
-
-static bool cev_valid;
-static kbd_event_t cev;
-
-void thread_trace_start(uintptr_t thread_hash);
-
-static char *cmd_path;
-static char **cmd_args;
-
-static task_id_t task_id;
-static task_wait_t task_w;
-static bool task_wait_for;
-
-/** Combination of events/data to print. */
-display_mask_t display_mask;
-
-static errno_t cev_fibril(void *arg);
-
-static void cev_fibril_start(void)
-{
-	fid_t fid;
-
-	fid = fibril_create(cev_fibril, NULL);
-	if (fid == 0) {
-		printf("Error creating fibril\n");
-		exit(1);
-	}
-
-	fibril_add_ready(fid);
-}
-
-static errno_t program_run(void)
-{
-	errno_t rc;
-
-	rc = task_spawnv_debug(&task_id, &task_w, cmd_path,
-	    (const char *const *)cmd_args, &sess);
-
-	if (rc == ENOTSUP) {
-		printf("You do not have userspace debugging support "
-		    "compiled in the kernel.\n");
-		printf("Compile kernel with 'Support for userspace debuggers' "
-		    "(CONFIG_UDEBUG) enabled.\n");
-	}
-
-	if (rc != EOK) {
-		printf("Error running program (%s)\n", str_error_name(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t connect_task(task_id_t task_id)
-{
-	errno_t rc;
-	bool debug_started = false;
-	bool wait_set_up = false;
-
-	if (sess == NULL) {
-		sess = async_connect_kbox(task_id, &rc);
-		if (sess == NULL) {
-			printf("Error connecting to task %" PRIu64 ".\n",
-			    task_id);
-			goto error;
-		}
-
-		rc = udebug_begin(sess);
-		if (rc != EOK) {
-			printf("Error starting debug session.\n");
-			goto error;
-		}
-
-		debug_started = true;
-
-		rc = task_setup_wait(task_id, &task_w);
-		if (rc != EOK) {
-			printf("Error setting up wait for task termination.\n");
-			goto error;
-		}
-
-		wait_set_up = true;
-	}
-
-	rc = udebug_set_evmask(sess, UDEBUG_EM_ALL);
-	if (rc != EOK) {
-		printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
-		return rc;
-	}
-
-	return EOK;
-error:
-	if (wait_set_up)
-		task_cancel_wait(&task_w);
-	if (debug_started)
-		udebug_end(sess);
-	if (sess != NULL)
-		async_hangup(sess);
-	return rc;
-}
-
-static errno_t get_thread_list(void)
-{
-	errno_t rc;
-	size_t tb_copied;
-	size_t tb_needed;
-	int i;
-
-	rc = udebug_thread_read(sess, thread_hash_buf,
-	    THBUF_SIZE * sizeof(unsigned), &tb_copied, &tb_needed);
-	if (rc != EOK) {
-		printf("udebug_thread_read() -> %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	n_threads = tb_copied / sizeof(uintptr_t);
-
-	printf("Threads:");
-	for (i = 0; i < n_threads; i++) {
-		printf(" [%d] (hash %p)", 1 + i, (void *) thread_hash_buf[i]);
-	}
-	printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
-
-	return EOK;
-}
-
-void val_print(sysarg_t val, val_type_t v_type)
-{
-	long sval;
-
-	sval = (long) val;
-
-	switch (v_type) {
-	case V_VOID:
-		printf("<void>");
-		break;
-
-	case V_INTEGER:
-		printf("%ld", sval);
-		break;
-
-	case V_HASH:
-	case V_PTR:
-		printf("%p", (void *) val);
-		break;
-
-	case V_ERRNO:
-		if (sval >= -15 && sval <= 0) {
-			printf("%ld %s (%s)", sval,
-			    str_error_name((errno_t) sval),
-			    str_error((errno_t) sval));
-		} else {
-			printf("%ld", sval);
-		}
-		break;
-	case V_INT_ERRNO:
-		if (sval >= -15 && sval < 0) {
-			printf("%ld %s (%s)", sval,
-			    str_error_name((errno_t) sval),
-			    str_error((errno_t) sval));
-		} else {
-			printf("%ld", sval);
-		}
-		break;
-
-	case V_CHAR:
-		if (sval >= 0x20 && sval < 0x7f) {
-			printf("'%c'", (char) sval);
-		} else {
-			switch (sval) {
-			case '\a':
-				printf("'\\a'");
-				break;
-			case '\b':
-				printf("'\\b'");
-				break;
-			case '\n':
-				printf("'\\n'");
-				break;
-			case '\r':
-				printf("'\\r'");
-				break;
-			case '\t':
-				printf("'\\t'");
-				break;
-			case '\\':
-				printf("'\\\\'");
-				break;
-			default:
-				printf("'\\x%02" PRIxn "'", val);
-				break;
-			}
-		}
-		break;
-	}
-}
-
-static void print_sc_retval(sysarg_t retval, val_type_t val_type)
-{
-	printf(" -> ");
-	val_print(retval, val_type);
-	putchar('\n');
-}
-
-static void print_sc_args(sysarg_t *sc_args, int n)
-{
-	int i;
-
-	putchar('(');
-	if (n > 0)
-		printf("%" PRIun, sc_args[0]);
-	for (i = 1; i < n; i++) {
-		printf(", %" PRIun, sc_args[i]);
-	}
-	putchar(')');
-}
-
-static void sc_ipc_call_async_fast(sysarg_t *sc_args, errno_t sc_rc)
-{
-	ipc_call_t call;
-	cap_phone_handle_t phandle;
-
-	if (sc_rc != EOK)
-		return;
-
-	phandle = (cap_phone_handle_t) sc_args[0];
-
-	ipc_set_imethod(&call, sc_args[1]);
-	ipc_set_arg1(&call, sc_args[2]);
-	ipc_set_arg2(&call, sc_args[3]);
-	ipc_set_arg3(&call, sc_args[4]);
-	ipc_set_arg4(&call, sc_args[5]);
-	ipc_set_arg5(&call, 0);
-
-	ipcp_call_out(phandle, &call, 0);
-}
-
-static void sc_ipc_call_async_slow(sysarg_t *sc_args, errno_t sc_rc)
-{
-	ipc_call_t call;
-	errno_t rc;
-
-	if (sc_rc != EOK)
-		return;
-
-	memset(&call, 0, sizeof(call));
-	rc = udebug_mem_read(sess, &call.args, sc_args[1], sizeof(call.args));
-
-	if (rc == EOK) {
-		ipcp_call_out((cap_phone_handle_t) sc_args[0], &call, 0);
-	}
-}
-
-static void sc_ipc_wait(sysarg_t *sc_args, cap_call_handle_t sc_rc)
-{
-	ipc_call_t call;
-	errno_t rc;
-
-	if (sc_rc == 0)
-		return;
-
-	memset(&call, 0, sizeof(call));
-	rc = udebug_mem_read(sess, &call, sc_args[0], sizeof(call));
-
-	if (rc == EOK)
-		ipcp_call_in(&call, sc_rc);
-}
-
-static void event_syscall_b(unsigned thread_id, uintptr_t thread_hash,
-    unsigned sc_id, sysarg_t sc_rc)
-{
-	sysarg_t sc_args[6];
-	errno_t rc;
-
-	/* Read syscall arguments */
-	rc = udebug_args_read(sess, thread_hash, sc_args);
-
-	if (rc != EOK) {
-		printf("error\n");
-		return;
-	}
-
-	if ((display_mask & DM_SYSCALL) != 0) {
-		/* Print syscall name and arguments */
-		if (syscall_desc_defined(sc_id)) {
-			printf("%s", syscall_desc[sc_id].name);
-			print_sc_args(sc_args, syscall_desc[sc_id].n_args);
-		} else {
-			printf("unknown_syscall<%d>", sc_id);
-			print_sc_args(sc_args, 6);
-		}
-	}
-}
-
-static void event_syscall_e(unsigned thread_id, uintptr_t thread_hash,
-    unsigned sc_id, sysarg_t sc_rc)
-{
-	sysarg_t sc_args[6];
-	int rv_type;
-	errno_t rc;
-
-	/* Read syscall arguments */
-	rc = udebug_args_read(sess, thread_hash, sc_args);
-
-	if (rc != EOK) {
-		printf("error\n");
-		return;
-	}
-
-	if ((display_mask & DM_SYSCALL) != 0) {
-		/* Print syscall return value */
-		if (syscall_desc_defined(sc_id))
-			rv_type = syscall_desc[sc_id].rv_type;
-		else
-			rv_type = V_PTR;
-		print_sc_retval(sc_rc, rv_type);
-	}
-
-	switch (sc_id) {
-	case SYS_IPC_CALL_ASYNC_FAST:
-		sc_ipc_call_async_fast(sc_args, (errno_t) sc_rc);
-		break;
-	case SYS_IPC_CALL_ASYNC_SLOW:
-		sc_ipc_call_async_slow(sc_args, (errno_t) sc_rc);
-		break;
-	case SYS_IPC_WAIT:
-		sc_ipc_wait(sc_args, (cap_call_handle_t) sc_rc);
-		break;
-	default:
-		break;
-	}
-}
-
-static void event_thread_b(uintptr_t hash)
-{
-	printf("New thread, hash %p\n", (void *) hash);
-	thread_trace_start(hash);
-}
-
-static errno_t trace_loop(void *thread_hash_arg)
-{
-	errno_t rc;
-	unsigned ev_type;
-	uintptr_t thread_hash;
-	unsigned thread_id;
-	sysarg_t val0, val1;
-
-	thread_hash = (uintptr_t)thread_hash_arg;
-	thread_id = next_thread_id++;
-	if (thread_id >= THBUF_SIZE) {
-		printf("Too many threads.\n");
-		return ELIMIT;
-	}
-
-	printf("Start tracing thread [%u] (hash %p).\n",
-	    thread_id, (void *) thread_hash);
-
-	while (!abort_trace) {
-
-		fibril_mutex_lock(&state_lock);
-		if (paused) {
-			printf("Thread [%u] paused. Press R to resume.\n",
-			    thread_id);
-
-			while (paused)
-				fibril_condvar_wait(&state_cv, &state_lock);
-
-			printf("Thread [%u] resumed.\n", thread_id);
-		}
-		fibril_mutex_unlock(&state_lock);
-
-		/* Run thread until an event occurs */
-		rc = udebug_go(sess, thread_hash,
-		    &ev_type, &val0, &val1);
-
-		if (ev_type == UDEBUG_EVENT_FINISHED) {
-			/* Done tracing this thread */
-			break;
-		}
-
-		if (rc == EOK) {
-			switch (ev_type) {
-			case UDEBUG_EVENT_SYSCALL_B:
-				event_syscall_b(thread_id, thread_hash, val0, (int)val1);
-				break;
-			case UDEBUG_EVENT_SYSCALL_E:
-				event_syscall_e(thread_id, thread_hash, val0, (int)val1);
-				break;
-			case UDEBUG_EVENT_STOP:
-				printf("Stop event\n");
-				fibril_mutex_lock(&state_lock);
-				paused = true;
-				fibril_mutex_unlock(&state_lock);
-				break;
-			case UDEBUG_EVENT_THREAD_B:
-				event_thread_b(val0);
-				break;
-			case UDEBUG_EVENT_THREAD_E:
-				printf("Thread %" PRIun " exited.\n", val0);
-				fibril_mutex_lock(&state_lock);
-				abort_trace = true;
-				fibril_condvar_broadcast(&state_cv);
-				fibril_mutex_unlock(&state_lock);
-				break;
-			default:
-				printf("Unknown event type %d.\n", ev_type);
-				break;
-			}
-		}
-
-	}
-
-	printf("Finished tracing thread [%d].\n", thread_id);
-	return EOK;
-}
-
-void thread_trace_start(uintptr_t thread_hash)
-{
-	fid_t fid;
-
-	thash = thread_hash;
-
-	fid = fibril_create(trace_loop, (void *)thread_hash);
-	if (fid == 0) {
-		printf("Warning: Failed creating fibril\n");
-	}
-	fibril_add_ready(fid);
-}
-
-static errno_t cev_fibril(void *arg)
-{
-	cons_event_t event;
-	errno_t rc;
-
-	(void) arg;
-
-	console_ctrl_t *console = console_init(stdin, stdout);
-
-	while (true) {
-		fibril_mutex_lock(&state_lock);
-		while (cev_valid)
-			fibril_condvar_wait(&state_cv, &state_lock);
-		fibril_mutex_unlock(&state_lock);
-
-		rc = console_get_event(console, &event);
-		if (rc != EOK)
-			return EINVAL;
-
-		if (event.type == CEV_KEY) {
-			fibril_mutex_lock(&state_lock);
-			cev = event.ev.key;
-			cev_valid = true;
-			fibril_condvar_broadcast(&state_cv);
-			fibril_mutex_unlock(&state_lock);
-		}
-	}
-}
-
-static void trace_task(task_id_t task_id)
-{
-	kbd_event_t ev;
-	bool done;
-	int i;
-	errno_t rc;
-
-	ipcp_init();
-
-	rc = get_thread_list();
-	if (rc != EOK) {
-		printf("Failed to get thread list (%s)\n", str_error(rc));
-		return;
-	}
-
-	abort_trace = false;
-
-	for (i = 0; i < n_threads; i++) {
-		thread_trace_start(thread_hash_buf[i]);
-	}
-
-	done = false;
-
-	while (!done) {
-		fibril_mutex_lock(&state_lock);
-		while (!cev_valid && !abort_trace)
-			fibril_condvar_wait(&state_cv, &state_lock);
-		fibril_mutex_unlock(&state_lock);
-
-		ev = cev;
-
-		fibril_mutex_lock(&state_lock);
-		cev_valid = false;
-		fibril_condvar_broadcast(&state_cv);
-		fibril_mutex_unlock(&state_lock);
-
-		if (abort_trace)
-			break;
-
-		if (ev.type != KEY_PRESS)
-			continue;
-
-		switch (ev.key) {
-		case KC_Q:
-			done = true;
-			break;
-		case KC_P:
-			printf("Pause...\n");
-			rc = udebug_stop(sess, thash);
-			if (rc != EOK)
-				printf("Error: stop -> %s\n", str_error_name(rc));
-			break;
-		case KC_R:
-			fibril_mutex_lock(&state_lock);
-			paused = false;
-			fibril_condvar_broadcast(&state_cv);
-			fibril_mutex_unlock(&state_lock);
-			printf("Resume...\n");
-			break;
-		default:
-			break;
-		}
-	}
-
-	printf("\nTerminate debugging session...\n");
-	abort_trace = true;
-	udebug_end(sess);
-	async_hangup(sess);
-
-	ipcp_cleanup();
-
-	printf("Done\n");
-	return;
-}
-
-static void main_init(void)
-{
-	proto_t *p;
-	oper_t *o;
-
-	val_type_t arg_def[OPER_MAX_ARGS] = {
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER
-	};
-
-	val_type_t resp_def[OPER_MAX_ARGS] = {
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER,
-		V_INTEGER
-	};
-
-	next_thread_id = 1;
-	paused = false;
-	cev_valid = false;
-
-	fibril_mutex_initialize(&state_lock);
-	fibril_condvar_initialize(&state_cv);
-
-	proto_init();
-
-	p = proto_new("vfs");
-	o = oper_new("read", 3, arg_def, V_ERRNO, 1, resp_def);
-	proto_add_oper(p, VFS_IN_READ, o);
-	o = oper_new("write", 3, arg_def, V_ERRNO, 1, resp_def);
-	proto_add_oper(p, VFS_IN_WRITE, o);
-	o = oper_new("vfs_resize", 5, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_RESIZE, o);
-	o = oper_new("vfs_stat", 1, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_STAT, o);
-	o = oper_new("vfs_put", 1, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_PUT, o);
-	o = oper_new("vfs_mount", 2, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_MOUNT, o);
-#if 0
-	o = oper_new("unmount", 0, arg_def);
-	proto_add_oper(p, VFS_IN_UNMOUNT, o);
-#endif
-	o = oper_new("vfs_sync", 1, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_SYNC, o);
-	o = oper_new("rename", 0, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_RENAME, o);
-	o = oper_new("vfs_statfs", 0, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_STATFS, o);
-	o = oper_new("vfs_walk", 2, arg_def, V_INT_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_WALK, o);
-	o = oper_new("vfs_open", 2, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_OPEN, o);
-	o = oper_new("vfs_unlink", 3, arg_def, V_ERRNO, 0, resp_def);
-	proto_add_oper(p, VFS_IN_UNLINK, o);
-
-	proto_register(SERVICE_VFS, p);
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax:\n");
-	printf("\ttrace [+<events>] <executable> [<arg1> [...]]\n");
-	printf("or\ttrace [+<events>] -t <task_id>\n");
-	printf("Events: (default is +tp)\n");
-	printf("\n");
-	printf("\tt ... Thread creation and termination\n");
-	printf("\ts ... System calls\n");
-	printf("\ti ... Low-level IPC\n");
-	printf("\tp ... Protocol level\n");
-	printf("\n");
-	printf("Examples:\n");
-	printf("\ttrace +s /app/tetris\n");
-	printf("\ttrace +tsip -t 12\n");
-}
-
-static display_mask_t parse_display_mask(const char *text)
-{
-	display_mask_t dm = 0;
-	const char *c = text;
-
-	while (*c) {
-		switch (*c) {
-		case 't':
-			dm = dm | DM_THREAD;
-			break;
-		case 's':
-			dm = dm | DM_SYSCALL;
-			break;
-		case 'i':
-			dm = dm | DM_IPC;
-			break;
-		case 'p':
-			dm = dm | DM_SYSTEM | DM_USER;
-			break;
-		default:
-			printf("Unexpected event type '%c'.\n", *c);
-			exit(1);
-		}
-
-		++c;
-	}
-
-	return dm;
-}
-
-static int parse_args(int argc, char *argv[])
-{
-	char *err_p;
-
-	task_id = 0;
-
-	--argc;
-	++argv;
-
-	while (argc > 0) {
-		char *arg = *argv;
-		if (arg[0] == '+') {
-			display_mask = parse_display_mask(&arg[1]);
-		} else if (arg[0] == '-') {
-			if (arg[1] == 't') {
-				/* Trace an already running task */
-				--argc;
-				++argv;
-				task_id = strtol(*argv, &err_p, 10);
-				task_wait_for = false;
-				if (*err_p) {
-					printf("Task ID syntax error\n");
-					print_syntax();
-					return -1;
-				}
-			} else {
-				printf("Uknown option '%c'\n", arg[0]);
-				print_syntax();
-				return -1;
-			}
-		} else {
-			break;
-		}
-
-		--argc;
-		++argv;
-	}
-
-	if (task_id != 0) {
-		if (argc == 0)
-			return 0;
-		printf("Extra arguments\n");
-		print_syntax();
-		return -1;
-	}
-
-	if (argc < 1) {
-		printf("Missing argument\n");
-		print_syntax();
-		return -1;
-	}
-
-	/* Preload the specified program file. */
-	printf("Spawning '%s' with arguments:\n", *argv);
-
-	char **cp = argv;
-	while (*cp)
-		printf("'%s'\n", *cp++);
-
-	cmd_path = *argv;
-	cmd_args = argv;
-	task_wait_for = true;
-
-	return 0;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	task_exit_t texit;
-	int retval;
-
-	printf("System Call / IPC Tracer\n");
-	printf("Controls: Q - Quit, P - Pause, R - Resume\n");
-
-	display_mask = DM_THREAD | DM_SYSTEM | DM_USER;
-
-	if (parse_args(argc, argv) < 0)
-		return 1;
-
-	main_init();
-
-	if (cmd_path != NULL)
-		program_run();
-
-	rc = connect_task(task_id);
-	if (rc != EOK) {
-		printf("Failed connecting to task %" PRIu64 ".\n", task_id);
-		return 1;
-	}
-
-	printf("Connected to task %" PRIu64 ".\n", task_id);
-
-	cev_fibril_start();
-	trace_task(task_id);
-
-	if (task_wait_for) {
-		printf("Waiting for task to exit.\n");
-
-		rc = task_wait(&task_w, &texit, &retval);
-		if (rc != EOK) {
-			printf("Failed waiting for task.\n");
-			return -1;
-		}
-
-		if (texit == TASK_EXIT_NORMAL) {
-			printf("Task exited normally, return value %d.\n",
-			    retval);
-		} else {
-			printf("Task exited unexpectedly.\n");
-		}
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/trace/trace.h
===================================================================
--- uspace/app/trace/trace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trace
- * @{
- */
-/** @file
- */
-
-#ifndef TRACE_H_
-#define TRACE_H_
-
-#include <types/common.h>
-
-/**
- * Classes of events that can be displayed. Can be or-ed together.
- */
-typedef enum {
-
-	DM_THREAD	= 1,	/**< Thread creation and termination events */
-	DM_SYSCALL	= 2,	/**< System calls */
-	DM_IPC		= 4,	/**< Low-level IPC */
-	DM_SYSTEM	= 8,	/**< Sysipc protocol */
-	DM_USER		= 16	/**< User IPC protocols */
-
-} display_mask_t;
-
-typedef enum {
-	V_VOID,
-	V_INTEGER,
-	V_PTR,
-	V_HASH,
-	V_ERRNO,
-	V_INT_ERRNO,
-	V_CHAR
-} val_type_t;
-
-/** Combination of events to print. */
-extern display_mask_t display_mask;
-
-void val_print(sysarg_t val, val_type_t v_type);
-
-#endif
-
-/** @}
- */
Index: pace/app/uidemo/doc/doxygroups.h
===================================================================
--- uspace/app/uidemo/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uidemo uidemo
- * @brief User Interface Demo
- * @ingroup apps
- */
Index: pace/app/uidemo/meson.build
===================================================================
--- uspace/app/uidemo/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui' ]
-src = files(
-	'uidemo.c',
-)
Index: pace/app/uidemo/uidemo.c
===================================================================
--- uspace/app/uidemo/uidemo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1524 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uidemo
- * @{
- */
-/** @file User interface demo
- */
-
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-#include <io/pixelmap.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/entry.h>
-#include <ui/filedialog.h>
-#include <ui/fixed.h>
-#include <ui/image.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
-#include <ui/msgdialog.h>
-#include <ui/pbutton.h>
-#include <ui/promptdialog.h>
-#include <ui/resource.h>
-#include <ui/selectdialog.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "uidemo.h"
-
-static errno_t bitmap_moire(gfx_bitmap_t *, gfx_coord_t, gfx_coord_t);
-
-static void wnd_close(ui_window_t *, void *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close
-};
-
-static void pb_clicked(ui_pbutton_t *, void *);
-
-static ui_pbutton_cb_t pbutton_cb = {
-	.clicked = pb_clicked
-};
-
-static void checkbox_switched(ui_checkbox_t *, void *, bool);
-
-static ui_checkbox_cb_t checkbox_cb = {
-	.switched = checkbox_switched
-};
-
-static void rb_selected(ui_rbutton_group_t *, void *, void *);
-
-static ui_rbutton_group_cb_t rbutton_group_cb = {
-	.selected = rb_selected
-};
-
-static void slider_moved(ui_slider_t *, void *, gfx_coord_t);
-
-static ui_slider_cb_t slider_cb = {
-	.moved = slider_moved
-};
-
-static void scrollbar_up(ui_scrollbar_t *, void *);
-static void scrollbar_down(ui_scrollbar_t *, void *);
-static void scrollbar_page_up(ui_scrollbar_t *, void *);
-static void scrollbar_page_down(ui_scrollbar_t *, void *);
-static void scrollbar_moved(ui_scrollbar_t *, void *, gfx_coord_t);
-
-static ui_scrollbar_cb_t scrollbar_cb = {
-	.up = scrollbar_up,
-	.down = scrollbar_down,
-	.page_up = scrollbar_page_up,
-	.page_down = scrollbar_page_down,
-	.moved = scrollbar_moved
-};
-
-static void uidemo_file_load(ui_menu_entry_t *, void *);
-static void uidemo_file_message(ui_menu_entry_t *, void *);
-static void uidemo_file_confirmation(ui_menu_entry_t *, void *);
-static void uidemo_file_exit(ui_menu_entry_t *, void *);
-static void uidemo_edit_modify(ui_menu_entry_t *, void *);
-static void uidemo_edit_insert_character(ui_menu_entry_t *, void *);
-
-static void file_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void file_dialog_bcancel(ui_file_dialog_t *, void *);
-static void file_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t file_dialog_cb = {
-	.bok = file_dialog_bok,
-	.bcancel = file_dialog_bcancel,
-	.close = file_dialog_close
-};
-
-static void prompt_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void prompt_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void prompt_dialog_close(ui_prompt_dialog_t *, void *);
-
-static ui_prompt_dialog_cb_t prompt_dialog_cb = {
-	.bok = prompt_dialog_bok,
-	.bcancel = prompt_dialog_bcancel,
-	.close = prompt_dialog_close
-};
-
-static void select_dialog_bok(ui_select_dialog_t *, void *, void *);
-static void select_dialog_bcancel(ui_select_dialog_t *, void *);
-static void select_dialog_close(ui_select_dialog_t *, void *);
-
-static ui_select_dialog_cb_t select_dialog_cb = {
-	.bok = select_dialog_bok,
-	.bcancel = select_dialog_bcancel,
-	.close = select_dialog_close
-};
-
-static void msg_dialog_button(ui_msg_dialog_t *, void *, unsigned);
-static void msg_dialog_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t msg_dialog_cb = {
-	.button = msg_dialog_button,
-	.close = msg_dialog_close
-};
-
-/** Horizontal alignment selected by each radio button */
-static const gfx_halign_t uidemo_halign[3] = {
-	gfx_halign_left,
-	gfx_halign_center,
-	gfx_halign_right
-};
-
-/** Window close button was clicked.
- *
- * @param window Window
- * @param arg Argument (demo)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_quit(demo->ui);
-}
-
-/** Push button was clicked.
- *
- * @param pbutton Push button
- * @param arg Argument (demo)
- */
-static void pb_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	errno_t rc;
-
-	if (pbutton == demo->pb1) {
-		rc = ui_entry_set_text(demo->entry, "OK pressed");
-		if (rc != EOK)
-			printf("Error changing entry text.\n");
-	} else {
-		rc = ui_entry_set_text(demo->entry, "Cancel pressed");
-		if (rc != EOK)
-			printf("Error changing entry text.\n");
-	}
-}
-
-/** Check box was switched.
- *
- * @param checkbox Check box
- * @param arg Argument (demo)
- */
-static void checkbox_switched(ui_checkbox_t *checkbox, void *arg, bool enable)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_entry_set_read_only(demo->entry, enable);
-}
-
-/** Radio button was selected.
- *
- * @param rbgroup Radio button group
- * @param garg Group argument (demo)
- * @param barg Button argument
- */
-static void rb_selected(ui_rbutton_group_t *rbgroup, void *garg, void *barg)
-{
-	ui_demo_t *demo = (ui_demo_t *) garg;
-	gfx_halign_t halign = *(gfx_halign_t *) barg;
-
-	ui_entry_set_halign(demo->entry, halign);
-	(void) ui_entry_paint(demo->entry);
-}
-
-/** Slider was moved.
- *
- * @param slider Slider
- * @param arg Argument (demo)
- * @param pos Position
- */
-static void slider_moved(ui_slider_t *slider, void *arg, gfx_coord_t pos)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char *str;
-	errno_t rc;
-	int rv;
-
-	rv = asprintf(&str, "Slider at %d of %d", (int) pos,
-	    ui_slider_length(slider));
-	if (rv < 0) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = ui_entry_set_text(demo->entry, str);
-	if (rc != EOK)
-		printf("Error changing entry text.\n");
-	(void) ui_entry_paint(demo->entry);
-
-	free(str);
-}
-
-/** Scrollbar up button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos - 1);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar down button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos + 1);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar page up event.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_page_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos -
-	    ui_scrollbar_trough_length(scrollbar) / 4);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar page down event.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- */
-static void scrollbar_page_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	gfx_coord_t pos;
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	ui_scrollbar_set_pos(scrollbar, pos +
-	    ui_scrollbar_trough_length(scrollbar) / 4);
-
-	pos = ui_scrollbar_get_pos(scrollbar);
-	scrollbar_moved(scrollbar, arg, pos);
-}
-
-/** Scrollbar was moved.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (demo)
- * @param pos Position
- */
-static void scrollbar_moved(ui_scrollbar_t *scrollbar, void *arg,
-    gfx_coord_t pos)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char *str;
-	errno_t rc;
-	int rv;
-
-	rv = asprintf(&str, "Scrollbar: %d of %d", (int) pos,
-	    ui_scrollbar_move_length(scrollbar));
-	if (rv < 0) {
-		printf("Out of memory.\n");
-		return;
-	}
-
-	rc = ui_entry_set_text(demo->entry, str);
-	if (rc != EOK)
-		printf("Error changing entry text.\n");
-	(void) ui_entry_paint(demo->entry);
-
-	free(str);
-}
-
-/** Display a message window with OK button.
- *
- * @param demo UI demo
- * @param caption Window caption
- * @param text Message text
- */
-static void uidemo_show_message(ui_demo_t *demo, const char *caption,
-    const char *text)
-{
-	ui_msg_dialog_params_t mdparams;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&mdparams);
-	mdparams.caption = caption;
-	mdparams.text = text;
-
-	rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-}
-
-/** File / Load menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_load(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_file_dialog_params_t fdparams;
-	ui_file_dialog_t *dialog;
-	errno_t rc;
-
-	ui_file_dialog_params_init(&fdparams);
-	fdparams.caption = "Load File";
-
-	rc = ui_file_dialog_create(demo->ui, &fdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_file_dialog_set_cb(dialog, &file_dialog_cb, demo);
-}
-
-/** File / Message menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_message(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_msg_dialog_params_t mdparams;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&mdparams);
-	mdparams.caption = "Message For You";
-	mdparams.text = "Hello, world!";
-
-	rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-}
-
-/** File / Confirmation menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_confirmation(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_msg_dialog_params_t mdparams;
-	ui_msg_dialog_t *dialog;
-	errno_t rc;
-
-	ui_msg_dialog_params_init(&mdparams);
-	mdparams.caption = "Confirmation";
-	mdparams.text = "This will not actually do anything. Proceed?";
-	mdparams.choice = umdc_ok_cancel;
-
-	rc = ui_msg_dialog_create(demo->ui, &mdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating message dialog.\n");
-		return;
-	}
-
-	ui_msg_dialog_set_cb(dialog, &msg_dialog_cb, &demo);
-}
-
-/** File / Exit menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_file_exit(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_quit(demo->ui);
-}
-
-/** Edit / Modify menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_edit_modify(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_prompt_dialog_params_t pdparams;
-	ui_prompt_dialog_t *dialog;
-	errno_t rc;
-
-	ui_prompt_dialog_params_init(&pdparams);
-	pdparams.caption = "Modify Entry Text";
-	pdparams.prompt = "Enter New Text";
-
-	rc = ui_prompt_dialog_create(demo->ui, &pdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating prompt dialog.\n");
-		return;
-	}
-
-	ui_prompt_dialog_set_cb(dialog, &prompt_dialog_cb, demo);
-}
-
-/** Edit / Insert Character menu entry selected.
- *
- * @param mentry Menu entry
- * @param arg Argument (demo)
- */
-static void uidemo_edit_insert_character(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	ui_select_dialog_params_t sdparams;
-	ui_select_dialog_t *dialog;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	ui_select_dialog_params_init(&sdparams);
-	sdparams.caption = "Insert Character";
-	sdparams.prompt = "Select character to insert";
-
-	rc = ui_select_dialog_create(demo->ui, &sdparams, &dialog);
-	if (rc != EOK) {
-		printf("Error creating select dialog.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Dollar sign ($)";
-	attr.arg = (void *)'$';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Hash sign (#)";
-	attr.arg = (void *)'#';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Question mark (?)";
-	attr.arg = (void *)'?';
-	rc = ui_select_dialog_append(dialog, &attr);
-	if (rc != EOK) {
-		printf("Error appending entry to list.\n");
-		return;
-	}
-
-	ui_select_dialog_set_cb(dialog, &select_dialog_cb, demo);
-
-	(void) ui_select_dialog_paint(dialog);
-}
-
-/** File dialog OK button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- * @param fname File name
- */
-static void file_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char buf[128];
-	char *p;
-	FILE *f;
-
-	ui_file_dialog_destroy(dialog);
-
-	f = fopen(fname, "rt");
-	if (f == NULL) {
-		uidemo_show_message(demo, "Error", "Error opening file.");
-		return;
-	}
-
-	p = fgets(buf, sizeof(buf), f);
-	if (p == NULL) {
-		uidemo_show_message(demo, "Error", "Error reading file.");
-		fclose(f);
-		return;
-	}
-
-	/* Cut string off at the first non-printable character */
-	p = buf;
-	while (*p != '\0') {
-		if (*p < ' ') {
-			*p = '\0';
-			break;
-		}
-		++p;
-	}
-
-	ui_entry_set_text(demo->entry, buf);
-	fclose(f);
-}
-
-/** File dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void file_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** File dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void file_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_file_dialog_destroy(dialog);
-}
-
-/** Prompt dialog OK button press.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void prompt_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *text)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	ui_prompt_dialog_destroy(dialog);
-	ui_entry_set_text(demo->entry, text);
-}
-
-/** Prompt dialog cancel button press.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void prompt_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Prompt dialog close request.
- *
- * @param dialog Prompt dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void prompt_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_prompt_dialog_destroy(dialog);
-}
-
-/** Select dialog OK button press.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- * @param text Submitted text
- */
-static void select_dialog_bok(ui_select_dialog_t *dialog, void *arg,
-    void *earg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-	char str[2];
-
-	ui_select_dialog_destroy(dialog);
-	str[0] = (char)(intptr_t)earg;
-	str[1] = '\0';
-	(void) ui_entry_insert_str(demo->entry, str);
-}
-
-/** Select dialog cancel button press.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void select_dialog_bcancel(ui_select_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_select_dialog_destroy(dialog);
-}
-
-/** Select dialog close request.
- *
- * @param dialog Select dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void select_dialog_close(ui_select_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_select_dialog_destroy(dialog);
-}
-
-/** Message dialog button press.
- *
- * @param dialog Message dialog
- * @param arg Argument (ui_demo_t *)
- * @param bnum Button number
- */
-static void msg_dialog_button(ui_msg_dialog_t *dialog, void *arg,
-    unsigned bnum)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_msg_dialog_destroy(dialog);
-}
-
-/** Message dialog close request.
- *
- * @param dialog Message dialog
- * @param arg Argument (ui_demo_t *)
- */
-static void msg_dialog_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	ui_demo_t *demo = (ui_demo_t *) arg;
-
-	(void) demo;
-	ui_msg_dialog_destroy(dialog);
-}
-
-/** Run UI demo on display server. */
-static errno_t ui_demo(const char *display_spec)
-{
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_demo_t demo;
-	gfx_rect_t rect;
-	gfx_context_t *gc;
-	ui_resource_t *ui_res;
-	gfx_bitmap_params_t bparams;
-	gfx_bitmap_t *bitmap;
-	gfx_coord2_t off;
-	ui_menu_entry_t *mmsg;
-	ui_menu_entry_t *mload;
-	ui_menu_entry_t *mfoo;
-	ui_menu_entry_t *mbar;
-	ui_menu_entry_t *mfoobar;
-	ui_menu_entry_t *msep;
-	ui_menu_entry_t *mexit;
-	ui_menu_entry_t *mmodify;
-	ui_menu_entry_t *minsert_char;
-	ui_menu_entry_t *mabout;
-	ui_list_entry_attr_t eattr;
-	errno_t rc;
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		return rc;
-	}
-
-	memset((void *) &demo, 0, sizeof(demo));
-	demo.ui = ui;
-
-	ui_wnd_params_init(&params);
-	params.caption = "UI Demo";
-	params.style |= ui_wds_maximize_btn | ui_wds_resizable;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 46;
-		params.rect.p1.y = 25;
-	} else {
-		params.rect.p0.x = 0;
-		params.rect.p0.y = 0;
-		params.rect.p1.x = 255;
-		params.rect.p1.y = 410;
-	}
-
-	/* Only allow making the window larger */
-	gfx_rect_dims(&params.rect, &params.min_size);
-
-	rc = ui_window_create(ui, &params, &window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		return rc;
-	}
-
-	ui_window_set_cb(window, &window_cb, (void *) &demo);
-	demo.window = window;
-
-	ui_res = ui_window_get_res(window);
-	gc = ui_window_get_gc(window);
-
-	rc = ui_fixed_create(&demo.fixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_menu_bar_create(ui, window, &demo.mbar);
-	if (rc != EOK) {
-		printf("Error creating menu bar.\n");
-		return rc;
-	}
-
-	rc = ui_menu_dd_create(demo.mbar, "~F~ile", NULL, &demo.mfile);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "~M~essage", "", &mmsg);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mmsg, uidemo_file_message, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.mfile, "~C~onfirmation", "", &mmsg);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mmsg, uidemo_file_confirmation, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.mfile, "~L~oad", "", &mload);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mload, uidemo_file_load, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.mfile, "~F~oo", "Ctrl-Alt-Del", &mfoo);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "~B~ar", "", &mbar);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "F~o~obar", "", &mfoobar);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_disabled(mfoobar, true);
-
-	rc = ui_menu_entry_sep_create(demo.mfile, &msep);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mfile, "E~x~it", "Alt-F4", &mexit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mexit, uidemo_file_exit, (void *) &demo);
-
-	rc = ui_menu_dd_create(demo.mbar, "~E~dit", NULL, &demo.medit);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.medit, "~M~odify", "", &mmodify);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(mmodify, uidemo_edit_modify, (void *) &demo);
-
-	rc = ui_menu_entry_create(demo.medit, "~I~nsert Character",
-	    "", &minsert_char);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	ui_menu_entry_set_cb(minsert_char, uidemo_edit_insert_character,
-	    (void *) &demo);
-
-	rc = ui_menu_dd_create(demo.mbar, "~P~references", NULL,
-	    &demo.mpreferences);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_dd_create(demo.mbar, "~H~elp", NULL, &demo.mhelp);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	rc = ui_menu_entry_create(demo.mhelp, "~A~bout", "Ctrl-H, F1", &mabout);
-	if (rc != EOK) {
-		printf("Error creating menu.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 1;
-		rect.p0.y = 1;
-		rect.p1.x = 43;
-		rect.p1.y = 2;
-	} else {
-		rect.p0.x = 4;
-		rect.p0.y = 30;
-		rect.p1.x = 251;
-		rect.p1.y = 52;
-	}
-
-	ui_menu_bar_set_rect(demo.mbar, &rect);
-
-	rc = ui_fixed_add(demo.fixed, ui_menu_bar_ctl(demo.mbar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_tab_set_create(ui_res, &demo.tabset);
-	if (rc != EOK) {
-		printf("Error creating tab set.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 2;
-		rect.p0.y = 2;
-		rect.p1.x = 44;
-		rect.p1.y = 24;
-	} else {
-		rect.p0.x = 8;
-		rect.p0.y = 53;
-		rect.p1.x = 250;
-		rect.p1.y = 405;
-	}
-
-	ui_tab_set_set_rect(demo.tabset, &rect);
-
-	rc = ui_tab_create(demo.tabset, "Basic", &demo.tbasic);
-	if (rc != EOK) {
-		printf("Error creating tab.\n");
-		return rc;
-	}
-
-	rc = ui_tab_create(demo.tabset, "Lists", &demo.tlists);
-	if (rc != EOK) {
-		printf("Error creating tab.\n");
-		return rc;
-	}
-
-	rc = ui_fixed_add(demo.fixed, ui_tab_set_ctl(demo.tabset));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_fixed_create(&demo.bfixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_entry_create(window, "", &demo.entry);
-	if (rc != EOK) {
-		printf("Error creating entry.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 41;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 88;
-		rect.p1.x = 205;
-		rect.p1.y = 113;
-	}
-
-	ui_entry_set_rect(demo.entry, &rect);
-	ui_entry_set_halign(demo.entry, gfx_halign_center);
-
-	rc = ui_fixed_add(demo.bfixed, ui_entry_ctl(demo.entry));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_label_create(ui_res, "Text label", &demo.label);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 7;
-		rect.p1.x = 41;
-		rect.p1.y = 8;
-	} else {
-		rect.p0.x = 60;
-		rect.p0.y = 123;
-		rect.p1.x = 160;
-		rect.p1.y = 136;
-	}
-
-	ui_label_set_rect(demo.label, &rect);
-	ui_label_set_halign(demo.label, gfx_halign_center);
-
-	rc = ui_fixed_add(demo.bfixed, ui_label_ctl(demo.label));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_pbutton_create(ui_res, "OK", &demo.pb1);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(demo.pb1, &pbutton_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 9;
-		rect.p1.x = 15;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 146;
-		rect.p1.x = 105;
-		rect.p1.y = 174;
-	}
-
-	ui_pbutton_set_rect(demo.pb1, &rect);
-
-	ui_pbutton_set_default(demo.pb1, true);
-
-	rc = ui_fixed_add(demo.bfixed, ui_pbutton_ctl(demo.pb1));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_pbutton_create(ui_res, "Cancel", &demo.pb2);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_pbutton_set_cb(demo.pb2, &pbutton_cb, (void *) &demo);
-
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 30;
-		rect.p0.y = 9;
-		rect.p1.x = 41;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 115;
-		rect.p0.y = 146;
-		rect.p1.x = 205;
-		rect.p1.y = 174;
-	}
-
-	ui_pbutton_set_rect(demo.pb2, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_pbutton_ctl(demo.pb2));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	gfx_bitmap_params_init(&bparams);
-	if (ui_is_textmode(ui)) {
-		bparams.rect.p0.x = 0;
-		bparams.rect.p0.y = 0;
-		bparams.rect.p1.x = 37;
-		bparams.rect.p1.y = 2;
-	} else {
-		bparams.rect.p0.x = 0;
-		bparams.rect.p0.y = 0;
-		bparams.rect.p1.x = 188;
-		bparams.rect.p1.y = 24;
-	}
-
-	rc = gfx_bitmap_create(gc, &bparams, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = bitmap_moire(bitmap, bparams.rect.p1.x, bparams.rect.p1.y);
-	if (rc != EOK)
-		return rc;
-
-	rc = ui_image_create(ui_res, bitmap, &params.rect, &demo.image);
-	if (rc != EOK) {
-		printf("Error creating label.\n");
-		return rc;
-	}
-
-	if (ui_is_textmode(ui)) {
-		off.x = 4;
-		off.y = 11;
-	} else {
-		off.x = 15;
-		off.y = 190;
-	}
-
-	gfx_rect_translate(&off, &bparams.rect, &rect);
-
-	/* Adjust for frame width (2 x 1 pixel) */
-	if (!ui_is_textmode(ui)) {
-		ui_image_set_flags(demo.image, ui_imgf_frame);
-		rect.p1.x += 2;
-		rect.p1.y += 2;
-	}
-
-	ui_image_set_rect(demo.image, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_image_ctl(demo.image));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_checkbox_create(ui_res, "Read only", &demo.checkbox);
-	if (rc != EOK) {
-		printf("Error creating check box.\n");
-		return rc;
-	}
-
-	ui_checkbox_set_cb(demo.checkbox, &checkbox_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 14;
-		rect.p1.x = 14;
-		rect.p1.y = 15;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 225;
-		rect.p1.x = 140;
-		rect.p1.y = 245;
-	}
-
-	ui_checkbox_set_rect(demo.checkbox, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_checkbox_ctl(demo.checkbox));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_group_create(ui_res, &demo.rbgroup);
-	if (rc != EOK) {
-		printf("Error creating radio button group.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_create(demo.rbgroup, "Left", (void *) &uidemo_halign[0],
-	    &demo.rbleft);
-	if (rc != EOK) {
-		printf("Error creating radio button.\n");
-		return rc;
-	}
-
-	ui_rbutton_group_set_cb(demo.rbgroup, &rbutton_group_cb,
-	    (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 16;
-		rect.p1.x = 14;
-		rect.p1.y = 17;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 255;
-		rect.p1.x = 140;
-		rect.p1.y = 275;
-	}
-	ui_rbutton_set_rect(demo.rbleft, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbleft));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_create(demo.rbgroup, "Center", (void *) &uidemo_halign[1],
-	    &demo.rbcenter);
-	if (rc != EOK) {
-		printf("Error creating radio button.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 17;
-		rect.p1.x = 14;
-		rect.p1.y = 18;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 285;
-		rect.p1.x = 140;
-		rect.p1.y = 305;
-	}
-	ui_rbutton_set_rect(demo.rbcenter, &rect);
-	ui_rbutton_select(demo.rbcenter);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbcenter));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_rbutton_create(demo.rbgroup, "Right", (void *) &uidemo_halign[2],
-	    &demo.rbright);
-	if (rc != EOK) {
-		printf("Error creating radio button.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 18;
-		rect.p1.x = 14;
-		rect.p1.y = 19;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 315;
-		rect.p1.x = 140;
-		rect.p1.y = 335;
-	}
-	ui_rbutton_set_rect(demo.rbright, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_rbutton_ctl(demo.rbright));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_slider_create(ui_res, &demo.slider);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_slider_set_cb(demo.slider, &slider_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 20;
-		rect.p1.x = 32;
-		rect.p1.y = 21;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 345;
-		rect.p1.x = 130;
-		rect.p1.y = 365;
-	}
-
-	ui_slider_set_rect(demo.slider, &rect);
-
-	rc = ui_fixed_add(demo.bfixed, ui_slider_ctl(demo.slider));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &demo.hscrollbar);
-	if (rc != EOK) {
-		printf("Error creating scrollbar.\n");
-		return rc;
-	}
-
-	ui_scrollbar_set_cb(demo.hscrollbar, &scrollbar_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 22;
-		rect.p1.x = 42;
-		rect.p1.y = 23;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 375;
-		rect.p1.x = 220;
-		rect.p1.y = 398;
-	}
-
-	ui_scrollbar_set_rect(demo.hscrollbar, &rect);
-
-	ui_scrollbar_set_thumb_length(demo.hscrollbar,
-	    ui_scrollbar_trough_length(demo.hscrollbar) / 4);
-
-	rc = ui_fixed_add(demo.bfixed, ui_scrollbar_ctl(demo.hscrollbar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_vert, &demo.vscrollbar);
-	if (rc != EOK) {
-		printf("Error creating button.\n");
-		return rc;
-	}
-
-	ui_scrollbar_set_cb(demo.vscrollbar, &scrollbar_cb, (void *) &demo);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 42;
-		rect.p0.y = 5;
-		rect.p1.x = 43;
-		rect.p1.y = 22;
-	} else {
-		rect.p0.x = 220;
-		rect.p0.y = 88;
-		rect.p1.x = 243;
-		rect.p1.y = 375;
-	}
-
-	ui_scrollbar_set_rect(demo.vscrollbar, &rect);
-
-	ui_scrollbar_set_thumb_length(demo.vscrollbar,
-	    ui_scrollbar_trough_length(demo.vscrollbar) / 4);
-
-	rc = ui_fixed_add(demo.bfixed, ui_scrollbar_ctl(demo.vscrollbar));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_tab_add(demo.tbasic, ui_fixed_ctl(demo.bfixed));
-
-	rc = ui_fixed_create(&demo.lfixed);
-	if (rc != EOK) {
-		printf("Error creating fixed layout.\n");
-		return rc;
-	}
-
-	rc = ui_list_create(window, false, &demo.list);
-	if (rc != EOK) {
-		printf("Error creating list.\n");
-		return rc;
-	}
-
-	ui_list_entry_attr_init(&eattr);
-
-	eattr.caption = "One";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Two";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Three";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Four";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Five";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	eattr.caption = "Six";
-	rc = ui_list_entry_append(demo.list, &eattr, NULL);
-	if (rc != EOK) {
-		printf("Error adding list entry.\n");
-		return rc;
-	}
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 4;
-		rect.p0.y = 5;
-		rect.p1.x = 41;
-		rect.p1.y = 10;
-	} else {
-		rect.p0.x = 15;
-		rect.p0.y = 88;
-		rect.p1.x = 245;
-		rect.p1.y = 173;
-	}
-
-	ui_list_set_rect(demo.list, &rect);
-
-	rc = ui_fixed_add(demo.lfixed, ui_list_ctl(demo.list));
-	if (rc != EOK) {
-		printf("Error adding control to layout.\n");
-		return rc;
-	}
-
-	ui_tab_add(demo.tlists, ui_fixed_ctl(demo.lfixed));
-
-	ui_window_add(window, ui_fixed_ctl(demo.fixed));
-
-	rc = ui_window_paint(window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		return rc;
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	return EOK;
-}
-
-/** Fill bitmap with moire pattern.
- *
- * @param bitmap Bitmap
- * @param w Bitmap width
- * @param h Bitmap height
- * @return EOK on success or an error code
- */
-static errno_t bitmap_moire(gfx_bitmap_t *bitmap, gfx_coord_t w, gfx_coord_t h)
-{
-	int i, j;
-	int k;
-	pixelmap_t pixelmap;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	/* In absence of anything else, use pixelmap */
-	pixelmap.width = w;
-	pixelmap.height = h;
-	pixelmap.data = alloc.pixels;
-
-	for (i = 0; i < w; i++) {
-		for (j = 0; j < h; j++) {
-			k = i * i + j * j;
-			pixelmap_put_pixel(&pixelmap, i, j,
-			    PIXEL(0, k, k, 255 - k));
-		}
-	}
-
-	return EOK;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: uidemo [-d <display-spec>]\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	errno_t rc;
-	int i;
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				return 1;
-			}
-
-			display_spec = argv[i++];
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			return 1;
-		}
-	}
-
-	if (i < argc) {
-		print_syntax();
-		return 1;
-	}
-
-	rc = ui_demo(display_spec);
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/uidemo/uidemo.h
===================================================================
--- uspace/app/uidemo/uidemo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uidemo
- * @{
- */
-/**
- * @file User interface demo
- */
-
-#ifndef UIDEMO_H
-#define UIDEMO_H
-
-#include <display.h>
-#include <ui/checkbox.h>
-#include <ui/entry.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/pbutton.h>
-#include <ui/rbutton.h>
-#include <ui/scrollbar.h>
-#include <ui/slider.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-
-/** User interface demo */
-typedef struct {
-	ui_t *ui;
-	ui_window_t *window;
-	ui_fixed_t *fixed;
-	ui_fixed_t *bfixed;
-	ui_fixed_t *lfixed;
-	ui_menu_bar_t *mbar;
-	ui_menu_t *mfile;
-	ui_menu_t *medit;
-	ui_menu_t *mpreferences;
-	ui_menu_t *mhelp;
-	ui_tab_set_t *tabset;
-	ui_tab_t *tbasic;
-	ui_tab_t *tlists;
-	ui_entry_t *entry;
-	ui_image_t *image;
-	ui_label_t *label;
-	ui_pbutton_t *pb1;
-	ui_pbutton_t *pb2;
-	ui_checkbox_t *checkbox;
-	ui_rbutton_group_t *rbgroup;
-	ui_rbutton_t *rbleft;
-	ui_rbutton_t *rbcenter;
-	ui_rbutton_t *rbright;
-	ui_slider_t *slider;
-	ui_scrollbar_t *hscrollbar;
-	ui_scrollbar_t *vscrollbar;
-	ui_list_t *list;
-} ui_demo_t;
-
-#endif
-
-/** @}
- */
Index: pace/app/untar/doc/doxygroups.h
===================================================================
--- uspace/app/untar/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup untar untar
- * @brief TAR extractor
- * @ingroup apps
- */
Index: pace/app/untar/main.c
===================================================================
--- uspace/app/untar/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup untar
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <untar.h>
-
-typedef struct {
-	const char *filename;
-	FILE *file;
-} tar_state_t;
-
-static int tar_open(tar_file_t *tar)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-
-	state->file = fopen(state->filename, "rb");
-	if (state->file == NULL)
-		return errno;
-
-	return EOK;
-}
-
-static void tar_close(tar_file_t *tar)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-	fclose(state->file);
-}
-
-static size_t tar_read(tar_file_t *tar, void *data, size_t size)
-{
-	tar_state_t *state = (tar_state_t *) tar->data;
-	return fread(data, 1, size, state->file);
-}
-
-static void tar_vreport(tar_file_t *tar, const char *fmt, va_list args)
-{
-	vfprintf(stderr, fmt, args);
-}
-
-tar_file_t tar = {
-	.open = tar_open,
-	.close = tar_close,
-
-	.read = tar_read,
-	.vreport = tar_vreport
-};
-
-int main(int argc, char *argv[])
-{
-	if (argc != 2) {
-		fprintf(stderr, "Usage: %s tar-file\n", argv[0]);
-		return 1;
-	}
-
-	tar_state_t state;
-	state.filename = argv[1];
-
-	tar.data = (void *) &state;
-	return untar(&tar);
-}
-
-/** @}
- */
Index: pace/app/untar/meson.build
===================================================================
--- uspace/app/untar/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2013 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'untar' ]
-src = files('main.c')
Index: pace/app/usbinfo/desctree.c
===================================================================
--- uspace/app/usbinfo/desctree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/**
- * @file
- * Descriptor tree dump.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-
-#include "usbinfo.h"
-#include <usb/dev/dp.h>
-
-static void browse_descriptor_tree_internal(usb_dp_parser_t *parser,
-    usb_dp_parser_data_t *data, const uint8_t *root, size_t depth,
-    dump_descriptor_in_tree_t callback, void *arg)
-{
-	if (root == NULL) {
-		return;
-	}
-	callback(root, depth, arg);
-	const uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root);
-	do {
-		browse_descriptor_tree_internal(parser, data, child, depth + 1,
-		    callback, arg);
-		child = usb_dp_get_sibling_descriptor(parser, data,
-		    root, child);
-	} while (child != NULL);
-}
-
-void browse_descriptor_tree(uint8_t *descriptors, size_t descriptors_size,
-    usb_dp_descriptor_nesting_t *descriptor_nesting,
-    dump_descriptor_in_tree_t callback, size_t initial_depth, void *arg)
-{
-	usb_dp_parser_data_t data = {
-		.data = descriptors,
-		.size = descriptors_size,
-		.arg = NULL
-	};
-
-	usb_dp_parser_t parser = {
-		.nesting = descriptor_nesting
-	};
-
-	browse_descriptor_tree_internal(&parser, &data, descriptors,
-	    initial_depth, callback, arg);
-}
-
-/** @}
- */
Index: pace/app/usbinfo/dump.c
===================================================================
--- uspace/app/usbinfo/dump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/**
- * @file
- * USB querying.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <errno.h>
-#include <str_error.h>
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-
-#include "usbinfo.h"
-#include <usb/dev/dp.h>
-
-#define INDENT "  "
-#define BYTES_PER_LINE 12
-
-const char *get_indent(size_t level)
-{
-	static const char *indents[] = {
-		INDENT,
-		INDENT INDENT,
-		INDENT INDENT INDENT,
-		INDENT INDENT INDENT INDENT,
-		INDENT INDENT INDENT INDENT INDENT,
-		INDENT INDENT INDENT INDENT INDENT INDENT,
-	};
-	static size_t indents_count = sizeof(indents) / sizeof(indents[0]);
-	if (level >= indents_count) {
-		return indents[indents_count - 1];
-	}
-	return indents[level];
-}
-
-void dump_buffer(const char *msg, size_t indent,
-    const uint8_t *buffer, size_t length)
-{
-	if (msg != NULL) {
-		printf("%s\n", msg);
-	}
-
-	size_t i;
-	if (length > 0) {
-		printf("%s", get_indent(indent));
-	}
-	for (i = 0; i < length; i++) {
-		printf("0x%02X", buffer[i]);
-		if (((i > 0) && (((i + 1) % BYTES_PER_LINE) == 0)) ||
-		    (i + 1 == length)) {
-			printf("\n");
-			if (i + 1 < length) {
-				printf("%s", get_indent(indent));
-			}
-		} else {
-			printf("  ");
-		}
-	}
-}
-
-void dump_usb_descriptor(uint8_t *descriptor, size_t size)
-{
-	printf("Device descriptor:\n");
-	usb_dump_standard_descriptor(stdout, get_indent(0), "\n",
-	    descriptor, size);
-}
-
-void dump_match_ids(match_id_list_t *matches, const char *line_prefix)
-{
-	list_foreach(matches->ids, link, match_id_t, match) {
-		printf("%s%3d %s\n", line_prefix, match->score, match->id);
-	}
-}
-
-static void dump_tree_descriptor(const uint8_t *descriptor, size_t depth)
-{
-	if (descriptor == NULL) {
-		return;
-	}
-	int type = descriptor[1];
-	const char *name = "unknown";
-	switch (type) {
-#define _TYPE(descriptor_type) \
-		case USB_DESCTYPE_##descriptor_type: name = #descriptor_type; break
-		_TYPE(DEVICE);
-		_TYPE(CONFIGURATION);
-		_TYPE(STRING);
-		_TYPE(INTERFACE);
-		_TYPE(ENDPOINT);
-		_TYPE(HID);
-		_TYPE(HID_REPORT);
-		_TYPE(HID_PHYSICAL);
-		_TYPE(HUB);
-#undef _TYPE
-	}
-	printf("%s%s (0x%02X):\n", get_indent(depth), name, type);
-	usb_dump_standard_descriptor(stdout, get_indent(depth), "\n",
-	    descriptor, descriptor[0]);
-}
-
-static void dump_tree_internal(
-    usb_dp_parser_t *parser, usb_dp_parser_data_t *data,
-    const uint8_t *root, size_t depth)
-{
-	if (root == NULL) {
-		return;
-	}
-	dump_tree_descriptor(root, depth);
-	const uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root);
-	do {
-		dump_tree_internal(parser, data, child, depth + 1);
-		child = usb_dp_get_sibling_descriptor(parser, data, root, child);
-	} while (child != NULL);
-}
-
-static void dump_tree(usb_dp_parser_t *parser, usb_dp_parser_data_t *data)
-{
-	const uint8_t *ptr = data->data;
-	printf("Descriptor tree:\n");
-	dump_tree_internal(parser, data, ptr, 0);
-}
-
-#define NESTING(parentname, childname) \
-	{ \
-		.child = USB_DESCTYPE_##childname, \
-		.parent = USB_DESCTYPE_##parentname, \
-	}
-#define LAST_NESTING { -1, -1 }
-
-static usb_dp_descriptor_nesting_t descriptor_nesting[] = {
-	NESTING(CONFIGURATION, INTERFACE),
-	NESTING(INTERFACE, ENDPOINT),
-	NESTING(INTERFACE, HUB),
-	NESTING(INTERFACE, HID),
-	NESTING(HID, HID_REPORT),
-	LAST_NESTING
-};
-
-static usb_dp_parser_t parser = {
-	.nesting = descriptor_nesting
-};
-
-void dump_descriptor_tree(uint8_t *descriptors, size_t length)
-{
-	usb_dp_parser_data_t data = {
-		.data = descriptors,
-		.size = length,
-		.arg = NULL
-	};
-
-	dump_tree(&parser, &data);
-}
-
-/** @}
- */
Index: pace/app/usbinfo/hid.c
===================================================================
--- uspace/app/usbinfo/hid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,249 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/**
- * @file
- * Dumping of HID-related properties.
- */
-#include <stdio.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/request.h>
-#include <usb/hid/hidparser.h>
-#include <errno.h>
-#include "usbinfo.h"
-
-#define BYTES_PER_LINE 20
-
-typedef enum {
-	HID_DUMP_RAW,
-	HID_DUMP_USAGES
-} hid_dump_type_t;
-
-typedef struct {
-	usb_device_t *usb_dev;
-	hid_dump_type_t dump_type;
-	usb_standard_interface_descriptor_t *last_iface;
-} descriptor_walk_context_t;
-
-static bool is_descriptor_kind(const uint8_t *d, usb_descriptor_type_t t)
-{
-	if (d == NULL) {
-		return false;
-	}
-	uint8_t size = d[0];
-	if (size <= 1) {
-		return false;
-	}
-	uint8_t type = d[1];
-	return type == t;
-}
-
-/** Dumps HID report in raw format.
- *
- * @param iface_no USB interface the report belongs to.
- * @param report Report descriptor.
- * @param size Size of the @p report in bytes.
- */
-static void dump_hid_report_raw(int iface_no, uint8_t *report, size_t size)
-{
-	printf("%sHID report descriptor for interface %d", get_indent(0),
-	    iface_no);
-	for (size_t i = 0; i < size; i++) {
-		size_t line_idx = i % BYTES_PER_LINE;
-		if (line_idx == 0) {
-			printf("\n%s", get_indent(1));
-		}
-		printf("%02X", (int) report[i]);
-		if (line_idx + 1 < BYTES_PER_LINE) {
-			printf(" ");
-		}
-	}
-	printf("\n");
-}
-
-/** Dumps usages in HID report.
- *
- * @param iface_no USB interface the report belongs to.
- * @param report Parsed report descriptor.
- */
-static void dump_hid_report_usages(int iface_no, usb_hid_report_t *report)
-{
-	printf("%sParsed HID report descriptor for interface %d\n",
-	    get_indent(0), iface_no);
-	list_foreach(report->reports, reports_link,
-	    usb_hid_report_description_t, description) {
-		printf("%sReport %d (type %d)\n", get_indent(1),
-		    (int) description->report_id,
-		    (int) description->type);
-		list_foreach(description->report_items, ritems_link,
-		    usb_hid_report_field_t, field) {
-			printf("%sUsage page = 0x%04x    Usage = 0x%04x\n",
-			    get_indent(2),
-			    (int) field->usage_page, (int) field->usage);
-		}
-	}
-}
-
-/** Retrieves HID report from given USB device and dumps it.
- *
- * @param dump_type In which format to dump the report.
- * @param ctrl_pipe Default control pipe to the device.
- * @param iface_no Interface number.
- * @param report_size Size of the report descriptor.
- */
-static void retrieve_and_dump_hid_report(hid_dump_type_t dump_type,
-    usb_pipe_t *ctrl_pipe, uint8_t iface_no, size_t report_size)
-{
-	assert(report_size > 0);
-
-	uint8_t *raw_report = malloc(report_size);
-	if (raw_report == NULL) {
-		usb_log_warning(
-		    "Failed to allocate %zuB, skipping interface %d.\n",
-		    report_size, (int) iface_no);
-		return;
-	}
-
-	size_t actual_report_size;
-	errno_t rc = usb_request_get_descriptor(ctrl_pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DESCTYPE_HID_REPORT, 0, iface_no,
-	    raw_report, report_size, &actual_report_size);
-	if (rc != EOK) {
-		usb_log_error("Failed to retrieve HID report descriptor: %s.",
-		    str_error(rc));
-		free(raw_report);
-		return;
-	}
-
-	usb_hid_report_t report;
-	rc = usb_hid_parse_report_descriptor(&report, raw_report, report_size);
-	if (rc != EOK) {
-		usb_log_error("Failed to part report descriptor: %s.",
-		    str_error(rc));
-	}
-
-	switch (dump_type) {
-	case HID_DUMP_RAW:
-		dump_hid_report_raw(iface_no, raw_report, report_size);
-		break;
-	case HID_DUMP_USAGES:
-		dump_hid_report_usages(iface_no, &report);
-		break;
-	default:
-		assert(false && "unreachable code apparently reached");
-	}
-
-	free(raw_report);
-	usb_hid_report_deinit(&report);
-}
-
-/** Callback for walking descriptor tree.
- * This callback remembers current interface and dumps HID report after
- * encountering HID descriptor.
- * It dumps only the first report and it expects it to be a normal
- * report, not a physical one.
- *
- * @param raw_descriptor Descriptor as a byte array.
- * @param depth Descriptor tree depth (currently ignored).
- * @param arg Custom argument, passed as descriptor_walk_context_t.
- */
-static void descriptor_walk_callback(const uint8_t *raw_descriptor,
-    size_t depth, void *arg)
-{
-	descriptor_walk_context_t *context = (descriptor_walk_context_t *) arg;
-
-	if (is_descriptor_kind(raw_descriptor, USB_DESCTYPE_INTERFACE)) {
-		context->last_iface =
-		    (usb_standard_interface_descriptor_t *) raw_descriptor;
-		return;
-	}
-
-	if (!is_descriptor_kind(raw_descriptor, USB_DESCTYPE_HID)) {
-		return;
-	}
-
-	if (context->last_iface == NULL) {
-		return;
-	}
-
-	usb_standard_hid_descriptor_t *hid_descr =
-	    (usb_standard_hid_descriptor_t *) raw_descriptor;
-
-	if (hid_descr->report_desc_info.type != USB_DESCTYPE_HID_REPORT) {
-		return;
-	}
-
-	size_t report_size = hid_descr->report_desc_info.length;
-
-	if (report_size == 0) {
-		return;
-	}
-
-	retrieve_and_dump_hid_report(context->dump_type,
-	    usb_device_get_default_pipe(context->usb_dev),
-	    context->last_iface->interface_number, report_size);
-}
-
-void dump_hidreport_raw(usb_device_t *usb_dev)
-{
-	descriptor_walk_context_t context = {
-		.usb_dev = usb_dev,
-		.dump_type = HID_DUMP_RAW,
-		.last_iface = NULL
-	};
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    descriptor_walk_callback, &context);
-}
-
-void dump_hidreport_usages(usb_device_t *usb_dev)
-{
-	descriptor_walk_context_t context = {
-		.usb_dev = usb_dev,
-		.dump_type = HID_DUMP_USAGES,
-		.last_iface = NULL
-	};
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    descriptor_walk_callback, &context);
-}
-
-/** @}
- */
Index: pace/app/usbinfo/info.c
===================================================================
--- uspace/app/usbinfo/info.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,401 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/**
- * @file
- * Dumping of generic device properties.
- */
-#include <stdio.h>
-#include <str_error.h>
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/recognise.h>
-#include <usb/dev/request.h>
-#include <usb/classes/classes.h>
-#include <usb/classes/hub.h>
-#include "usbinfo.h"
-
-void dump_short_device_identification(usb_device_t *usb_dev)
-{
-	printf("%sDevice 0x%04x by vendor 0x%04x\n", get_indent(0),
-	    usb_device_descriptors(usb_dev)->device.product_id,
-	    usb_device_descriptors(usb_dev)->device.vendor_id);
-}
-
-static void dump_match_ids_from_interface(
-    const uint8_t *descriptor, size_t depth, void *arg)
-{
-	if (depth != 1) {
-		return;
-	}
-	size_t descr_size = descriptor[0];
-	if (descr_size < sizeof(usb_standard_interface_descriptor_t)) {
-		return;
-	}
-	int descr_type = descriptor[1];
-	if (descr_type != USB_DESCTYPE_INTERFACE) {
-		return;
-	}
-
-	usb_device_t *usb_dev = arg;
-	assert(usb_dev);
-
-	usb_standard_interface_descriptor_t *iface =
-	    (usb_standard_interface_descriptor_t *) descriptor;
-
-	printf("%sInterface #%d match ids (%s, 0x%02x, 0x%02x)\n",
-	    get_indent(0),
-	    (int) iface->interface_number,
-	    usb_str_class(iface->interface_class),
-	    (int) iface->interface_subclass,
-	    (int) iface->interface_protocol);
-
-	match_id_list_t matches;
-	init_match_ids(&matches);
-	usb_device_create_match_ids_from_interface(
-	    &usb_device_descriptors(usb_dev)->device, iface, &matches);
-	dump_match_ids(&matches, get_indent(1));
-	clean_match_ids(&matches);
-}
-
-void dump_device_match_ids(usb_device_t *usb_dev)
-{
-	match_id_list_t matches;
-	init_match_ids(&matches);
-	usb_device_create_match_ids_from_device_descriptor(
-	    &usb_device_descriptors(usb_dev)->device, &matches);
-	printf("%sDevice match ids (0x%04x by 0x%04x, %s)\n", get_indent(0),
-	    usb_device_descriptors(usb_dev)->device.product_id,
-	    usb_device_descriptors(usb_dev)->device.vendor_id,
-	    usb_str_class(usb_device_descriptors(usb_dev)->device.device_class));
-	dump_match_ids(&matches, get_indent(1));
-	clean_match_ids(&matches);
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    dump_match_ids_from_interface, usb_dev);
-}
-
-static void dump_descriptor_tree_brief_device(const char *prefix,
-    usb_standard_device_descriptor_t *descriptor)
-{
-	printf("%sDevice (0x%04x by 0x%04x, %s, %zu configurations)\n", prefix,
-	    (int) descriptor->product_id,
-	    (int) descriptor->vendor_id,
-	    usb_str_class(descriptor->device_class),
-	    (size_t) descriptor->configuration_count);
-}
-
-static void dump_descriptor_tree_brief_configuration(const char *prefix,
-    usb_standard_configuration_descriptor_t *descriptor)
-{
-	printf("%sConfiguration #%d (%zu interfaces, total %zuB)\n", prefix,
-	    (int) descriptor->configuration_number,
-	    (size_t) descriptor->interface_count,
-	    (size_t) descriptor->total_length);
-}
-
-static void dump_descriptor_tree_brief_interface(const char *prefix,
-    usb_standard_interface_descriptor_t *descriptor)
-{
-	printf("%sInterface #%d (%s, 0x%02x, 0x%02x), alternate %d\n", prefix,
-	    (int) descriptor->interface_number,
-	    usb_str_class(descriptor->interface_class),
-	    (int) descriptor->interface_subclass,
-	    (int) descriptor->interface_protocol,
-	    (int) descriptor->alternate_setting);
-}
-
-static void dump_descriptor_tree_brief_endpoint(const char *prefix,
-    usb_standard_endpoint_descriptor_t *descriptor)
-{
-	usb_endpoint_t endpoint_no = descriptor->endpoint_address & 0xF;
-	usb_transfer_type_t transfer = descriptor->attributes & 0x3;
-	usb_direction_t direction = descriptor->endpoint_address & 0x80 ?
-	    USB_DIRECTION_IN : USB_DIRECTION_OUT;
-	printf("%sEndpoint #%d (%s %s, %zu)\n", prefix,
-	    endpoint_no, usb_str_transfer_type(transfer),
-	    direction == USB_DIRECTION_IN ? "in" : "out",
-	    (size_t) descriptor->max_packet_size);
-}
-
-static void dump_descriptor_tree_brief_superspeed_endpoint_companion(const char *prefix,
-    usb_superspeed_endpoint_companion_descriptor_t *descriptor)
-{
-	printf("%sSuperspeed endpoint companion\n", prefix);
-}
-
-static void dump_descriptor_tree_brief_hid(const char *prefix,
-    usb_standard_hid_descriptor_t *descriptor)
-{
-	printf("%sHID (country %d, %d descriptors)\n", prefix,
-	    (int) descriptor->country_code,
-	    (int) descriptor->class_desc_count);
-}
-
-static void dump_descriptor_tree_brief_hub(const char *prefix,
-    usb_hub_descriptor_header_t *descriptor)
-{
-	printf("%shub (%d ports)\n", prefix,
-	    (int) descriptor->port_count);
-}
-
-static void dump_descriptor_tree_callback(
-    const uint8_t *descriptor, size_t depth, void *arg)
-{
-	const char *indent = get_indent(depth + 1);
-
-	int descr_type = -1;
-	size_t descr_size = descriptor[0];
-	if (descr_size > 0) {
-		descr_type = descriptor[1];
-	}
-
-	switch (descr_type) {
-
-#define _BRANCH(type_enum, descriptor_type, callback) \
-	case type_enum: \
-		if (descr_size >= sizeof(descriptor_type)) { \
-			callback(indent, (descriptor_type *) descriptor); \
-			if (arg != NULL) { \
-				usb_dump_standard_descriptor(stdout, \
-				    get_indent(depth +2), "\n", \
-				    descriptor, descr_size); \
-			} \
-		} else { \
-			descr_type = -1; \
-		} \
-		break;
-
-		_BRANCH(USB_DESCTYPE_DEVICE,
-		    usb_standard_device_descriptor_t,
-		    dump_descriptor_tree_brief_device);
-		_BRANCH(USB_DESCTYPE_CONFIGURATION,
-		    usb_standard_configuration_descriptor_t,
-		    dump_descriptor_tree_brief_configuration);
-		_BRANCH(USB_DESCTYPE_INTERFACE,
-		    usb_standard_interface_descriptor_t,
-		    dump_descriptor_tree_brief_interface);
-		_BRANCH(USB_DESCTYPE_ENDPOINT,
-		    usb_standard_endpoint_descriptor_t,
-		    dump_descriptor_tree_brief_endpoint);
-		_BRANCH(USB_DESCTYPE_SSPEED_EP_COMPANION,
-		    usb_superspeed_endpoint_companion_descriptor_t,
-		    dump_descriptor_tree_brief_superspeed_endpoint_companion);
-		_BRANCH(USB_DESCTYPE_HID,
-		    usb_standard_hid_descriptor_t,
-		    dump_descriptor_tree_brief_hid);
-		/*
-		 * Probably useless, hub descriptor shall not be part of
-		 * configuration descriptor.
-		 */
-		_BRANCH(USB_DESCTYPE_HUB,
-		    usb_hub_descriptor_header_t,
-		    dump_descriptor_tree_brief_hub);
-
-	default:
-		break;
-	}
-
-	if (descr_type == -1) {
-		printf("%sInvalid descriptor.\n", indent);
-	}
-}
-
-void dump_descriptor_tree_brief(usb_device_t *usb_dev)
-{
-	dump_descriptor_tree_callback(
-	    (const uint8_t *) &usb_device_descriptors(usb_dev)->device,
-	    (size_t) -1, NULL);
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    dump_descriptor_tree_callback, NULL);
-}
-
-void dump_descriptor_tree_full(usb_device_t *usb_dev)
-{
-	dump_descriptor_tree_callback(
-	    (const uint8_t *) &usb_device_descriptors(usb_dev)->device,
-	    (size_t) -1, usb_dev);
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    dump_descriptor_tree_callback, usb_dev);
-}
-
-static void find_string_indexes_callback(
-    const uint8_t *descriptor, size_t depth, void *arg)
-{
-	size_t descriptor_length = descriptor[0];
-	if (descriptor_length <= 1) {
-		return;
-	}
-
-#define SET_STRING_INDEX(descr, mask, descr_type, descr_struct, descr_item) \
-	do { \
-		if ((descr)[1] == (descr_type)) { \
-			descr_struct *__type_descr = (descr_struct *) (descr); \
-			size_t __str_index = __type_descr->descr_item; \
-			if ((__str_index > 0) && (__str_index < 64)) { \
-				mask = (mask) | (1 << __str_index); \
-			} \
-		} \
-	} while (0)
-
-	uint64_t *mask = arg;
-
-#define SET_STR(descr_type, descr_struct, descr_item) \
-	SET_STRING_INDEX(descriptor, (*mask), descr_type, descr_struct, descr_item)
-
-	SET_STR(USB_DESCTYPE_DEVICE, usb_standard_device_descriptor_t,
-	    str_manufacturer);
-	SET_STR(USB_DESCTYPE_DEVICE, usb_standard_device_descriptor_t,
-	    str_product);
-	SET_STR(USB_DESCTYPE_DEVICE, usb_standard_device_descriptor_t,
-	    str_serial_number);
-	SET_STR(USB_DESCTYPE_CONFIGURATION, usb_standard_configuration_descriptor_t,
-	    str_configuration);
-	SET_STR(USB_DESCTYPE_INTERFACE, usb_standard_interface_descriptor_t,
-	    str_interface);
-}
-
-void dump_strings(usb_device_t *usb_dev)
-{
-	/* Find used indexes. Devices with more than 64 strings are very rare. */
-	uint64_t str_mask = 0;
-	find_string_indexes_callback(
-	    (const uint8_t *) &usb_device_descriptors(usb_dev)->device, 0,
-	    &str_mask);
-
-	usb_dp_walk_simple(
-	    usb_device_descriptors(usb_dev)->full_config,
-	    usb_device_descriptors(usb_dev)->full_config_size,
-	    usb_dp_standard_descriptor_nesting,
-	    find_string_indexes_callback, &str_mask);
-
-	if (str_mask == 0) {
-		printf("Device does not support string descriptors.\n");
-		return;
-	}
-
-	/* Get supported languages. */
-	l18_win_locales_t *langs;
-	size_t langs_count;
-	errno_t rc = usb_request_get_supported_languages(
-	    usb_device_get_default_pipe(usb_dev), &langs, &langs_count);
-	if (rc != EOK) {
-		fprintf(stderr,
-		    NAME ": failed to get list of supported languages: %s.\n",
-		    str_error(rc));
-		return;
-	}
-
-	printf("%sString languages (%zu):", get_indent(0), langs_count);
-	size_t i;
-	for (i = 0; i < langs_count; i++) {
-		printf(" 0x%04x", (int) langs[i]);
-	}
-	printf(".\n");
-
-	/* Get all strings and dump them. */
-	for (i = 0; i < langs_count; i++) {
-		l18_win_locales_t lang = langs[i];
-
-		printf("%sStrings in %s:\n", get_indent(0),
-		    str_l18_win_locale(lang));
-
-		size_t idx;
-		for (idx = 1; idx < 64; idx++) {
-			if ((str_mask & ((uint64_t)1 << idx)) == 0) {
-				continue;
-			}
-			char *string = NULL;
-			rc = usb_request_get_string(
-			    usb_device_get_default_pipe(usb_dev), idx, lang,
-			    &string);
-			if ((rc != EOK) && (rc != EEMPTY)) {
-				printf("%sWarn: failed to retrieve string #%zu: %s.\n",
-				    get_indent(1), idx, str_error(rc));
-				continue;
-			}
-			printf("%sString #%zu: \"%s\"\n", get_indent(1),
-			    idx, rc == EOK ? string : "");
-			if (string != NULL) {
-				free(string);
-			}
-		}
-	}
-}
-
-void dump_status(usb_device_t *usb_dev)
-{
-	errno_t rc;
-	uint16_t status = 0;
-
-	/* Device status first. */
-	rc = usb_request_get_status(usb_device_get_default_pipe(usb_dev),
-	    USB_REQUEST_RECIPIENT_DEVICE, 0, &status);
-	if (rc != EOK) {
-		printf("%sFailed to get device status: %s.\n",
-		    get_indent(0), str_error(rc));
-	} else {
-		printf("%sDevice status 0x%04x: power=%s, remote-wakeup=%s.\n",
-		    get_indent(0), status,
-		    status & USB_DEVICE_STATUS_SELF_POWERED ? "self" : "bus",
-		    status & USB_DEVICE_STATUS_REMOTE_WAKEUP ? "yes" : "no");
-	}
-
-	/* Interface is not interesting, skipping ;-). */
-
-	/* Control endpoint zero. */
-	status = 0;
-	rc = usb_request_get_status(usb_device_get_default_pipe(usb_dev),
-	    USB_REQUEST_RECIPIENT_ENDPOINT, 0, &status);
-	if (rc != EOK) {
-		printf("%sFailed to get control endpoint status: %s.\n",
-		    get_indent(0), str_error(rc));
-	} else {
-		printf("%sControl endpoint zero status %04X: halted=%s.\n",
-		    get_indent(0), status,
-		    status & USB_ENDPOINT_STATUS_HALTED ? "yes" : "no");
-	}
-}
-
-/** @}
- */
Index: pace/app/usbinfo/list.c
===================================================================
--- uspace/app/usbinfo/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2010-2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup lsusb
- * @{
- */
-/**
- * @file
- * Listing of USB host controllers.
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <getopt.h>
-#include <devman.h>
-#include <loc.h>
-#include <usb_iface.h>
-#include <str.h>
-
-#include "usbinfo.h"
-
-#define MAX_PATH_LENGTH 1024
-
-static void print_usb_device(devman_handle_t handle)
-{
-	char path[MAX_PATH_LENGTH];
-	errno_t rc = devman_fun_get_path(handle, path, MAX_PATH_LENGTH);
-	if (rc != EOK) {
-		printf(NAME "Failed to get path for device %" PRIun "\n", handle);
-		return;
-	}
-	printf("\tDevice %" PRIun ": %s\n", handle, path);
-}
-
-static void print_usb_bus(service_id_t svc)
-{
-	devman_handle_t hc_handle = 0;
-	errno_t rc = devman_fun_sid_to_handle(svc, &hc_handle);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving handle of HC with SID %"
-		    PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	char path[MAX_PATH_LENGTH];
-	rc = devman_fun_get_path(hc_handle, path, sizeof(path));
-	if (rc != EOK) {
-		printf(NAME ": Error resolving path of HC with SID %"
-		    PRIun ", skipping.\n", svc);
-		return;
-	}
-	printf("Bus %" PRIun ": %s\n", svc, path);
-
-	/*
-	 * Construct device's path.
-	 * That's "hc function path" - ( '/' + "hc function name" )
-	 */
-	// TODO replace this with something sane
-
-	/* Get function name */
-	char name[10];
-	rc = devman_fun_get_name(hc_handle, name, sizeof(name));
-	if (rc != EOK) {
-		printf(NAME ": Error resolving name of HC with SID %"
-		    PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	/* Get handle of parent device */
-	devman_handle_t fh;
-	path[str_size(path) - str_size(name) - 1] = '\0';
-	rc = devman_fun_get_handle(path, &fh, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving parent handle of HC with"
-		    " SID %" PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	/* Get child handle */
-	devman_handle_t dh;
-	rc = devman_fun_get_child(fh, &dh);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving parent handle of HC with"
-		    " SID %" PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	devman_handle_t *fhs = 0;
-	size_t count;
-	rc = devman_dev_get_functions(dh, &fhs, &count);
-	if (rc != EOK) {
-		printf(NAME ": Error siblings of HC with"
-		    " SID %" PRIun ", skipping.\n", svc);
-		return;
-	}
-
-	for (size_t i = 0; i < count; ++i) {
-		if (fhs[i] != hc_handle)
-			print_usb_device(fhs[i]);
-	}
-	free(fhs);
-}
-
-void list(void)
-{
-	category_id_t usbhc_cat;
-	service_id_t *svcs;
-	size_t count;
-	errno_t rc;
-
-	rc = loc_category_get_id(USB_HC_CATEGORY, &usbhc_cat, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving category '%s'",
-		    USB_HC_CATEGORY);
-		return;
-	}
-
-	rc = loc_category_get_svcs(usbhc_cat, &svcs, &count);
-	if (rc != EOK) {
-		printf(NAME ": Error getting list of host controllers.\n");
-		return;
-	}
-
-	for (unsigned int i = 0; i < count; ++i) {
-		print_usb_bus(svcs[i]);
-	}
-
-	free(svcs);
-}
-
-/** @}
- */
Index: pace/app/usbinfo/main.c
===================================================================
--- uspace/app/usbinfo/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-/*
- * Copyright (c) 2010-2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/**
- * @file
- * USB querying.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <getopt.h>
-#include <devman.h>
-#include <loc.h>
-#include <usb/dev.h>
-#include <usb/dev/pipes.h>
-#include "usbinfo.h"
-
-static void print_usage(char *app_name)
-{
-#define _INDENT "      "
-#define _OPTION(opt, description) \
-	printf(_INDENT opt "\n" _INDENT _INDENT description "\n")
-
-	printf(NAME ": query USB devices for descriptors\n\n");
-	printf("Usage: %s [options] device [device [device [ ... ]]]\n",
-	    app_name);
-	printf(_INDENT "The device can be specified in two ways.\n");
-	printf(_INDENT "  o Using its devman path, e.g. /hw/pci0/.../usb00_a1.\n");
-	printf(_INDENT "  o Or using BUS.ADDR numbers as printed by lsusb.\n");
-
-	_OPTION("-h --help", "Print this help and exit.");
-	_OPTION("-l --list", "Print a list of host controllers and devices.");
-	_OPTION("-i --identification", "Brief device identification.");
-	_OPTION("-m --match-ids", "Print match ids generated for the device.");
-	_OPTION("-t --descriptor-tree", "Print descriptor tree.");
-	_OPTION("-T --descriptor-tree-full", "Print detailed descriptor tree");
-	_OPTION("-s --strings", "Try to print all string descriptors.");
-	_OPTION("-S --status", "Get status of the device.");
-	_OPTION("-r --hid-report", "Dump HID report descriptor.");
-	_OPTION("-R --hid-report-usages", "Dump usages of HID report.");
-
-	printf("\n");
-	printf("If no option is specified, `-i' is considered default.\n");
-	printf("\n");
-
-#undef _OPTION
-#undef _INDENT
-}
-
-static struct option long_options[] = {
-	{ "help", no_argument, NULL, 'h' },
-	{ "identification", no_argument, NULL, 'i' },
-	{ "list", no_argument, NULL, 'l' },
-	{ "match-ids", no_argument, NULL, 'm' },
-	{ "descriptor-tree", no_argument, NULL, 't' },
-	{ "descriptor-tree-full", no_argument, NULL, 'T' },
-	{ "strings", no_argument, NULL, 's' },
-	{ "status", no_argument, NULL, 'S' },
-	{ "hid-report", no_argument, NULL, 'r' },
-	{ "hid-report-usages", no_argument, NULL, 'R' },
-	{ 0, 0, NULL, 0 }
-};
-static const char *short_options = "hilmtTsSrR";
-
-static usbinfo_action_t actions[] = {
-	{
-		.opt = 'i',
-		.action = dump_short_device_identification,
-		.active = false
-	},
-	{
-		.opt = 'm',
-		.action = dump_device_match_ids,
-		.active = false
-	},
-	{
-		.opt = 't',
-		.action = dump_descriptor_tree_brief,
-		.active = false
-	},
-	{
-		.opt = 'T',
-		.action = dump_descriptor_tree_full,
-		.active = false
-	},
-	{
-		.opt = 's',
-		.action = dump_strings,
-		.active = false
-	},
-	{
-		.opt = 'S',
-		.action = dump_status,
-		.active = false
-	},
-	{
-		.opt = 'r',
-		.action = dump_hidreport_raw,
-		.active = false
-	},
-	{
-		.opt = 'R',
-		.action = dump_hidreport_usages,
-		.active = false
-	},
-	{
-		.opt = 0
-	}
-};
-
-int main(int argc, char *argv[])
-{
-	if (argc <= 1) {
-		print_usage(argv[0]);
-		return -1;
-	}
-
-	bool something_active = false;
-	/*
-	 * Process command-line options. They determine what shall be
-	 * done with the device.
-	 */
-	int opt;
-	int idx;
-	do {
-		opt = getopt_long(argc, argv,
-		    short_options, long_options, NULL);
-		switch (opt) {
-		case -1:
-			break;
-		case 'l':
-			list();
-			break;
-		case '?':
-			print_usage(argv[0]);
-			return 1;
-		case 'h':
-			print_usage(argv[0]);
-			return 0;
-		default:
-			idx = 0;
-			while (actions[idx].opt != 0) {
-				if (actions[idx].opt == opt) {
-					actions[idx].active = true;
-					something_active = true;
-					break;
-				}
-				idx++;
-			}
-			break;
-		}
-	} while (opt > 0);
-
-	/* Set the default action. */
-	if (!something_active) {
-		actions[0].active = true;
-	}
-
-	/*
-	 * Go through all devices given on the command line and run the
-	 * specified actions.
-	 */
-	int i;
-	for (i = optind; i < argc; i++) {
-		char *devpath = argv[i];
-
-		/* The initialization is here only to make compiler happy. */
-		devman_handle_t handle = 0;
-		errno_t rc = usb_resolve_device_handle(devpath, &handle);
-		if (rc != EOK) {
-			fprintf(stderr, NAME ": device `%s' not found "
-			    "or not of USB kind, skipping.\n",
-			    devpath);
-			continue;
-		}
-
-		usb_device_t *usb_dev = usb_device_create(handle);
-
-		if (usb_dev == NULL) {
-			fprintf(stderr, NAME ": device `%s' not found "
-			    "or not of USB kind, skipping.\n",
-			    devpath);
-			continue;
-		}
-
-		/* Run actions the user specified. */
-		printf("%s\n", devpath);
-
-		int action = 0;
-		while (actions[action].opt != 0) {
-			if (actions[action].active) {
-				actions[action].action(usb_dev);
-			}
-			action++;
-		}
-
-		usb_device_destroy(usb_dev);
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/usbinfo/meson.build
===================================================================
--- uspace/app/usbinfo/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhid', 'usbdev', 'usb', 'drv' ]
-src = files(
-	'desctree.c',
-	'dump.c',
-	'hid.c',
-	'info.c',
-	'list.c',
-	'main.c',
-)
Index: pace/app/usbinfo/usbinfo.h
===================================================================
--- uspace/app/usbinfo/usbinfo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbinfo
- * @{
- */
-/** @file
- * Common header for usbinfo application.
- */
-#ifndef USBINFO_USBINFO_H_
-#define USBINFO_USBINFO_H_
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/dev/device.h>
-#include <usb/dev/dp.h>
-
-typedef struct {
-	int opt;
-	void (*action)(usb_device_t *);
-	bool active;
-} usbinfo_action_t;
-
-#define NAME "usbinfo"
-
-extern void dump_buffer(const char *, size_t, const uint8_t *, size_t);
-extern const char *get_indent(size_t);
-extern void dump_match_ids(match_id_list_t *, const char *);
-extern void dump_usb_descriptor(uint8_t *, size_t);
-extern void dump_descriptor_tree(uint8_t *, size_t);
-
-static inline void internal_error(errno_t err)
-{
-	fprintf(stderr, NAME ": internal error (%s).\n", str_error(err));
-}
-
-typedef void (*dump_descriptor_in_tree_t)(const uint8_t *, size_t, void *);
-
-extern void browse_descriptor_tree(uint8_t *, size_t,
-    usb_dp_descriptor_nesting_t *, dump_descriptor_in_tree_t, size_t, void *);
-
-extern void list(void);
-
-extern void dump_short_device_identification(usb_device_t *);
-extern void dump_device_match_ids(usb_device_t *);
-extern void dump_descriptor_tree_brief(usb_device_t *);
-extern void dump_descriptor_tree_full(usb_device_t *);
-extern void dump_strings(usb_device_t *);
-extern void dump_status(usb_device_t *);
-extern void dump_hidreport_raw(usb_device_t *);
-extern void dump_hidreport_usages(usb_device_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/app/viewer/doc/doxygroups.h
===================================================================
--- uspace/app/viewer/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup viewer viewer
- * @brief Image viewer
- * @ingroup apps
- */
Index: pace/app/viewer/meson.build
===================================================================
--- uspace/app/viewer/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2013 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ui', 'gfximage', 'compress' ]
-src = files('viewer.c')
-
-if install_nonessential_data
-	# TODO: install this file somewhere sane
-	installed_data += { 'name': 'logo.tga', 'dir': '/' }
-endif
Index: pace/app/viewer/viewer.c
===================================================================
--- uspace/app/viewer/viewer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,534 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2013 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup viewer
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <gfximage/tga.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/filedialog.h>
-#include <ui/image.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include <vfs/vfs.h>
-
-#define NAME  "viewer"
-
-typedef struct {
-	ui_t *ui;
-
-	size_t imgs_count;
-	size_t imgs_current;
-	char **imgs;
-
-	bool fullscreen;
-	ui_window_t *window;
-	gfx_bitmap_t *bitmap;
-	ui_image_t *image;
-	gfx_context_t *window_gc;
-	ui_file_dialog_t *dialog;
-
-	gfx_rect_t img_rect;
-} viewer_t;
-
-static bool viewer_img_load(viewer_t *, const char *, gfx_bitmap_t **,
-    gfx_rect_t *);
-static bool viewer_img_setup(viewer_t *, gfx_bitmap_t *, gfx_rect_t *);
-static errno_t viewer_window_create(viewer_t *);
-static void viewer_window_destroy(viewer_t *);
-
-static void wnd_close(ui_window_t *, void *);
-static void wnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
-
-static ui_window_cb_t window_cb = {
-	.close = wnd_close,
-	.kbd = wnd_kbd_event
-};
-
-static void file_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void file_dialog_bcancel(ui_file_dialog_t *, void *);
-static void file_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t file_dialog_cb = {
-	.bok = file_dialog_bok,
-	.bcancel = file_dialog_bcancel,
-	.close = file_dialog_close
-};
-
-/** Window close request
- *
- * @param window Window
- * @param arg Argument (calc_t *)
- */
-static void wnd_close(ui_window_t *window, void *arg)
-{
-	viewer_t *viewer = (viewer_t *) arg;
-
-	ui_quit(viewer->ui);
-}
-
-/** Viewer unmodified key press.
- *
- * @param viewer Viewer
- * @param event Keyboard event
- */
-static void viewer_kbd_event_unmod(viewer_t *viewer, kbd_event_t *event)
-{
-	bool update = false;
-
-	if (event->key == KC_Q || event->key == KC_ESCAPE)
-		ui_quit(viewer->ui);
-
-	if (event->key == KC_PAGE_DOWN) {
-		if (viewer->imgs_current == viewer->imgs_count - 1)
-			viewer->imgs_current = 0;
-		else
-			viewer->imgs_current++;
-
-		update = true;
-	}
-
-	if (event->key == KC_PAGE_UP) {
-		if (viewer->imgs_current == 0)
-			viewer->imgs_current = viewer->imgs_count - 1;
-		else
-			viewer->imgs_current--;
-
-		update = true;
-	}
-
-	if (update) {
-		gfx_bitmap_t *lbitmap;
-		gfx_rect_t lrect;
-
-		if (!viewer_img_load(viewer, viewer->imgs[viewer->imgs_current],
-		    &lbitmap, &lrect)) {
-			printf("Cannot load image \"%s\".\n",
-			    viewer->imgs[viewer->imgs_current]);
-			exit(4);
-		}
-		if (!viewer_img_setup(viewer, lbitmap, &lrect)) {
-			printf("Cannot setup image \"%s\".\n",
-			    viewer->imgs[viewer->imgs_current]);
-			exit(6);
-		}
-	}
-}
-
-/** Viewer ctrl-key key press.
- *
- * @param viewer Viewer
- * @param event Keyboard event
- */
-static void viewer_kbd_event_ctrl(viewer_t *viewer, kbd_event_t *event)
-{
-	if (event->key == KC_Q)
-		ui_quit(viewer->ui);
-}
-
-/** Viewer window keyboard event.
- *
- * @param window UI window
- * @param arg Argument (viewer_t *)
- * @param event Keyboard event
- */
-static void wnd_kbd_event(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	viewer_t *viewer = (viewer_t *)arg;
-
-	if (event->type != KEY_PRESS)
-		return;
-
-	if ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
-		viewer_kbd_event_unmod(viewer, event);
-
-	if ((event->mods & KM_CTRL) != 0 &&
-	    (event->mods & (KM_ALT | KM_SHIFT)) == 0)
-		viewer_kbd_event_ctrl(viewer, event);
-
-	ui_window_def_kbd(window, event);
-}
-
-/** File dialog OK button press.
- *
- * @param dialog File dialog
- * @param arg Argument (viewer_t *)
- * @param fname File name
- */
-static void file_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	viewer_t *viewer = (viewer_t *) arg;
-	errno_t rc;
-
-	viewer->imgs_count = 1;
-	viewer->imgs = calloc(viewer->imgs_count, sizeof(char *));
-	if (viewer->imgs == NULL) {
-		printf("Out of memory.\n");
-		ui_quit(viewer->ui);
-		return;
-	}
-
-	viewer->imgs[0] = str_dup(fname);
-	if (viewer->imgs[0] == NULL) {
-		printf("Out of memory.\n");
-		ui_quit(viewer->ui);
-		return;
-	}
-
-	rc = viewer_window_create(viewer);
-	if (rc != EOK)
-		ui_quit(viewer->ui);
-
-	ui_file_dialog_destroy(dialog);
-	viewer->dialog = NULL;
-}
-
-/** File dialog cancel button press.
- *
- * @param dialog File dialog
- * @param arg Argument (viewer_t *)
- */
-static void file_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	viewer_t *viewer = (viewer_t *) arg;
-
-	ui_file_dialog_destroy(dialog);
-	ui_quit(viewer->ui);
-}
-
-/** File dialog close request.
- *
- * @param dialog File dialog
- * @param arg Argument (viewer_t *)
- */
-static void file_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	viewer_t *viewer = (viewer_t *) arg;
-
-	ui_file_dialog_destroy(dialog);
-	ui_quit(viewer->ui);
-}
-
-static bool viewer_img_load(viewer_t *viewer, const char *fname,
-    gfx_bitmap_t **rbitmap, gfx_rect_t *rect)
-{
-	int fd;
-	errno_t rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK)
-		return false;
-
-	vfs_stat_t stat;
-	rc = vfs_stat(fd, &stat);
-	if (rc != EOK) {
-		vfs_put(fd);
-		return false;
-	}
-
-	void *tga = malloc(stat.size);
-	if (tga == NULL) {
-		vfs_put(fd);
-		return false;
-	}
-
-	size_t nread;
-	rc = vfs_read(fd, (aoff64_t []) { 0 }, tga, stat.size, &nread);
-	if (rc != EOK || nread != stat.size) {
-		free(tga);
-		vfs_put(fd);
-		return false;
-	}
-
-	vfs_put(fd);
-
-	rc = decode_tga(viewer->window_gc, tga, stat.size, rbitmap, rect);
-	if (rc != EOK) {
-		free(tga);
-		return false;
-	}
-
-	free(tga);
-
-	viewer->img_rect = *rect;
-	return true;
-}
-
-static bool viewer_img_setup(viewer_t *viewer, gfx_bitmap_t *bmp,
-    gfx_rect_t *rect)
-{
-	gfx_rect_t arect;
-	gfx_rect_t irect;
-	ui_resource_t *ui_res;
-	errno_t rc;
-
-	ui_res = ui_window_get_res(viewer->window);
-
-	ui_window_get_app_rect(viewer->window, &arect);
-
-	/* Center image on application area */
-	gfx_rect_ctr_on_rect(rect, &arect, &irect);
-
-	if (viewer->image != NULL) {
-		ui_image_set_bmp(viewer->image, bmp, rect);
-		(void) ui_image_paint(viewer->image);
-		ui_image_set_rect(viewer->image, &irect);
-	} else {
-		rc = ui_image_create(ui_res, bmp, rect, &viewer->image);
-		if (rc != EOK) {
-			gfx_bitmap_destroy(bmp);
-			return false;
-		}
-
-		ui_image_set_rect(viewer->image, &irect);
-		ui_window_add(viewer->window, ui_image_ctl(viewer->image));
-	}
-
-	if (viewer->bitmap != NULL)
-		gfx_bitmap_destroy(viewer->bitmap);
-
-	viewer->bitmap = bmp;
-	return true;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax: %s [<options] <image-file>...\n", NAME);
-	printf("\t-d <display-spec> Use the specified display\n");
-	printf("\t-f                Full-screen mode\n");
-}
-
-static errno_t viewer_window_create(viewer_t *viewer)
-{
-	ui_wnd_params_t params;
-	gfx_bitmap_t *lbitmap;
-	gfx_rect_t lrect;
-	gfx_rect_t wrect;
-	gfx_coord2_t off;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	/*
-	 * We don't know the image size yet, so create tiny window and resize
-	 * later.
-	 */
-	ui_wnd_params_init(&params);
-	params.caption = "Viewer";
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 1;
-	params.rect.p1.y = 1;
-
-	if (viewer->fullscreen) {
-		params.style &= ~ui_wds_decorated;
-		params.placement = ui_wnd_place_full_screen;
-	}
-
-	rc = ui_window_create(viewer->ui, &params, &viewer->window);
-	if (rc != EOK) {
-		printf("Error creating window.\n");
-		goto error;
-	}
-
-	viewer->window_gc = ui_window_get_gc(viewer->window);
-
-	ui_window_set_cb(viewer->window, &window_cb, (void *)viewer);
-
-	if (!viewer_img_load(viewer, viewer->imgs[viewer->imgs_current],
-	    &lbitmap, &lrect)) {
-		printf("Cannot load image \"%s\".\n",
-		    viewer->imgs[viewer->imgs_current]);
-		goto error;
-	}
-
-	/*
-	 * Compute window rectangle such that application area corresponds
-	 * to rect
-	 */
-	ui_wdecor_rect_from_app(viewer->ui, params.style, &lrect, &wrect);
-	off = wrect.p0;
-	gfx_rect_rtranslate(&off, &wrect, &rect);
-
-	if (!viewer->fullscreen) {
-		rc = ui_window_resize(viewer->window, &rect);
-		if (rc != EOK) {
-			printf("Error resizing window.\n");
-			goto error;
-		}
-	}
-
-	if (!viewer_img_setup(viewer, lbitmap, &lrect)) {
-		printf("Cannot setup image \"%s\".\n",
-		    viewer->imgs[viewer->imgs_current]);
-		goto error;
-	}
-
-	rc = ui_window_paint(viewer->window);
-	if (rc != EOK) {
-		printf("Error painting window.\n");
-		goto error;
-	}
-
-	return EOK;
-error:
-	viewer_window_destroy(viewer);
-	ui_quit(viewer->ui);
-	return rc;
-}
-
-static void viewer_window_destroy(viewer_t *viewer)
-{
-	if (viewer->window != NULL)
-		ui_window_destroy(viewer->window);
-	viewer->window = NULL;
-}
-
-int main(int argc, char *argv[])
-{
-	const char *display_spec = UI_ANY_DEFAULT;
-	ui_t *ui = NULL;
-	viewer_t *viewer;
-	errno_t rc;
-	int i;
-	unsigned u;
-	ui_file_dialog_params_t fdparams;
-
-	viewer = calloc(1, sizeof(viewer_t));
-	if (viewer == NULL) {
-		printf("Out of memory.\n");
-		goto error;
-	}
-
-	i = 1;
-	while (i < argc && argv[i][0] == '-') {
-		if (str_cmp(argv[i], "-d") == 0) {
-			++i;
-			if (i >= argc) {
-				printf("Argument missing.\n");
-				print_syntax();
-				goto error;
-			}
-
-			display_spec = argv[i++];
-		} else if (str_cmp(argv[i], "-f") == 0) {
-			++i;
-			viewer->fullscreen = true;
-		} else {
-			printf("Invalid option '%s'.\n", argv[i]);
-			print_syntax();
-			goto error;
-		}
-	}
-
-	/* Images specified? */
-	if (i < argc) {
-		viewer->imgs_count = argc - i;
-		viewer->imgs = calloc(viewer->imgs_count, sizeof(char *));
-		if (viewer->imgs == NULL) {
-			printf("Out of memory.\n");
-			goto error;
-		}
-
-		for (int j = 0; j < argc - i; j++) {
-			viewer->imgs[j] = str_dup(argv[i + j]);
-			if (viewer->imgs[j] == NULL) {
-				printf("Out of memory.\n");
-				goto error;
-			}
-		}
-	}
-
-	rc = ui_create(display_spec, &ui);
-	if (rc != EOK) {
-		printf("Error creating UI on display %s.\n", display_spec);
-		goto error;
-	}
-
-	if (ui_is_fullscreen(ui))
-		viewer->fullscreen = true;
-
-	viewer->ui = ui;
-
-	if (viewer->imgs != NULL) {
-		/* We have images, create viewer window. */
-		rc = viewer_window_create(viewer);
-		if (rc != EOK)
-			goto error;
-	} else {
-		/* No images specified, browse for one. */
-		ui_file_dialog_params_init(&fdparams);
-		fdparams.caption = "Open Image";
-
-		rc = ui_file_dialog_create(viewer->ui, &fdparams,
-		    &viewer->dialog);
-		if (rc != EOK) {
-			printf("Error creating file dialog.\n");
-			goto error;
-		}
-
-		ui_file_dialog_set_cb(viewer->dialog, &file_dialog_cb,
-		    (void *)viewer);
-	}
-
-	ui_run(ui);
-
-	ui_window_destroy(viewer->window);
-	ui_destroy(ui);
-	free(viewer);
-
-	return 0;
-error:
-	if (viewer != NULL && viewer->dialog != NULL)
-		ui_file_dialog_destroy(viewer->dialog);
-	if (viewer != NULL && viewer->imgs != NULL) {
-		for (u = 0; u < viewer->imgs_count; u++) {
-			if (viewer->imgs[u] != NULL)
-				free(viewer->imgs[u]);
-		}
-		free(viewer->imgs);
-	}
-	if (viewer != NULL)
-		viewer_window_destroy(viewer);
-	if (ui != NULL)
-		ui_destroy(ui);
-	if (viewer != NULL)
-		free(viewer);
-	return 1;
-}
-
-/** @}
- */
Index: pace/app/vol/doc/doxygroups.h
===================================================================
--- uspace/app/vol/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup vol vol
- * @brief Volume administration tool
- * @ingroup apps
- */
Index: pace/app/vol/meson.build
===================================================================
--- uspace/app/vol/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('vol.c')
Index: pace/app/vol/vol.c
===================================================================
--- uspace/app/vol/vol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,424 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vol
- * @{
- */
-/** @file Volume administration (interface to volsrv).
- */
-
-#include <errno.h>
-#include <io/table.h>
-#include <loc.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-
-#define NAME "vol"
-
-typedef enum {
-	vcmd_eject,
-	vcmd_insert,
-	vcmd_insert_by_path,
-	vcmd_help,
-	vcmd_list,
-	vcmd_cfglist,
-} vol_cmd_t;
-
-/** Find volume by current mount point. */
-static errno_t vol_cmd_part_by_mp(vol_t *vol, const char *mp,
-    service_id_t *rid)
-{
-	vol_part_info_t vinfo;
-	service_id_t *part_ids = NULL;
-	char *canon_mp_buf = NULL;
-	char *canon_mp;
-	size_t nparts;
-	size_t i;
-	errno_t rc;
-
-	canon_mp_buf = str_dup(mp);
-	if (canon_mp_buf == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto out;
-	}
-
-	canon_mp = vfs_absolutize(canon_mp_buf, NULL);
-	if (canon_mp == NULL) {
-		printf("Invalid volume path '%s'.\n", mp);
-		rc = EINVAL;
-		goto out;
-	}
-
-	rc = vol_get_parts(vol, &part_ids, &nparts);
-	if (rc != EOK) {
-		printf("Error getting list of volumes.\n");
-		goto out;
-	}
-
-	for (i = 0; i < nparts; i++) {
-		rc = vol_part_info(vol, part_ids[i], &vinfo);
-		if (rc != EOK) {
-			printf("Error getting volume information.\n");
-			rc = EIO;
-			goto out;
-		}
-
-		if (str_cmp(vinfo.cur_mp, canon_mp) == 0) {
-			*rid = part_ids[i];
-			rc = EOK;
-			goto out;
-		}
-	}
-
-	rc = ENOENT;
-out:
-	free(part_ids);
-	free(canon_mp_buf);
-	return rc;
-}
-
-static errno_t vol_cmd_eject(const char *volspec, bool physical)
-{
-	vol_t *vol = NULL;
-	service_id_t part_id;
-	errno_t rc;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto out;
-	}
-
-	rc = vol_cmd_part_by_mp(vol, volspec, &part_id);
-	if (rc != EOK) {
-		printf("Error looking up volume '%s'.\n", volspec);
-		goto out;
-	}
-
-	rc = vol_part_eject(vol, part_id, physical ? vef_physical :
-	    vef_none);
-	if (rc != EOK) {
-		printf("Error ejecting volume.\n");
-		goto out;
-	}
-
-	rc = EOK;
-out:
-	vol_destroy(vol);
-	return rc;
-}
-
-static errno_t vol_cmd_insert(const char *volspec)
-{
-	vol_t *vol = NULL;
-	service_id_t svc_id;
-	errno_t rc;
-
-	rc = loc_service_get_id(volspec, &svc_id, 0);
-	if (rc != EOK) {
-		printf("Error looking up service '%s'.\n", volspec);
-		goto out;
-	}
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto out;
-	}
-
-	rc = vol_part_insert(vol, svc_id);
-	if (rc != EOK) {
-		printf("Error inserting volume.\n");
-		goto out;
-	}
-
-	rc = EOK;
-out:
-	vol_destroy(vol);
-	return rc;
-}
-
-static errno_t vol_cmd_insert_by_path(const char *volspec)
-{
-	vol_t *vol = NULL;
-	errno_t rc;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto out;
-	}
-
-	rc = vol_part_insert_by_path(vol, volspec);
-	if (rc != EOK) {
-		printf("Error inserting volume.\n");
-		goto out;
-	}
-
-	rc = EOK;
-out:
-	vol_destroy(vol);
-	return rc;
-}
-
-static errno_t vol_cmd_list(void)
-{
-	vol_t *vol = NULL;
-	vol_part_info_t vinfo;
-	service_id_t *part_ids = NULL;
-	char *svc_name;
-	char *sfstype;
-	size_t nparts;
-	size_t i;
-	table_t *table = NULL;
-	errno_t rc;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto out;
-	}
-
-	rc = vol_get_parts(vol, &part_ids, &nparts);
-	if (rc != EOK) {
-		printf("Error getting list of volumes.\n");
-		goto out;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Volume Name\t" "Resource\t" "Content\t" "Auto\t"
-	    "Mounted at\n");
-
-	for (i = 0; i < nparts; i++) {
-		rc = vol_part_info(vol, part_ids[i], &vinfo);
-		if (rc != EOK) {
-			printf("Error getting volume information.\n");
-			return EIO;
-		}
-
-		rc = loc_service_get_name(part_ids[i], &svc_name);
-		if (rc != EOK) {
-			printf("Error getting service name.\n");
-			return EIO;
-		}
-
-		rc = vol_pcnt_fs_format(vinfo.pcnt, vinfo.fstype, &sfstype);
-		if (rc != EOK) {
-			printf("Out of memory.\n");
-			free(svc_name);
-			return ENOMEM;
-		}
-
-		table_printf(table, "%s\t" "%s\t" "%s\t" "%s\t" "%s\n",
-		    vinfo.label, svc_name, sfstype,
-		    vinfo.cur_mp_auto ? "Yes" : "", vinfo.cur_mp);
-
-		free(svc_name);
-		free(sfstype);
-		svc_name = NULL;
-	}
-
-	rc = table_print_out(table, stdout);
-	if (rc != EOK)
-		printf("Error printing table.\n");
-out:
-	table_destroy(table);
-	vol_destroy(vol);
-	free(part_ids);
-
-	return rc;
-}
-
-/** List volume configuration entries.
- *
- * @return EOK on success or an error code
- */
-static errno_t vol_cmd_cfglist(void)
-{
-	vol_t *vol = NULL;
-	vol_info_t vinfo;
-	volume_id_t *volume_ids = NULL;
-	size_t nvols;
-	size_t i;
-	table_t *table = NULL;
-	errno_t rc;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto out;
-	}
-
-	rc = vol_get_volumes(vol, &volume_ids, &nvols);
-	if (rc != EOK) {
-		printf("Error getting list of volumes.\n");
-		goto out;
-	}
-
-	rc = table_create(&table);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		goto out;
-	}
-
-	table_header_row(table);
-	table_printf(table, "Volume Name\t" "Path\n");
-
-	for (i = 0; i < nvols; i++) {
-		rc = vol_info(vol, volume_ids[i], &vinfo);
-		if (rc != EOK) {
-			printf("Error getting volume information.\n");
-			return EIO;
-		}
-
-		table_printf(table, "%s\t" "%s\n", vinfo.label, vinfo.path);
-	}
-
-	rc = table_print_out(table, stdout);
-	if (rc != EOK)
-		printf("Error printing table.\n");
-out:
-	table_destroy(table);
-	vol_destroy(vol);
-	free(volume_ids);
-
-	return rc;
-}
-
-static void print_syntax(void)
-{
-	printf("Syntax:\n");
-	printf("  %s                 List present volumes\n", NAME);
-	printf("  %s -c              List volume configuration entries\n", NAME);
-	printf("  %s -h              Print help\n", NAME);
-	printf("  %s eject [-s] <mp> Eject volume mounted in a directory\n", NAME);
-	printf("                     -s to eject physically\n");
-	printf("  %s insert <svc>    Insert volume based on service identifier\n", NAME);
-	printf("  %s insert -p <mp>  Insert volume based on filesystem path\n", NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	char *cmd;
-	char *volspec;
-	vol_cmd_t vcmd;
-	bool physical = false;
-	int i;
-	errno_t rc = EINVAL;
-
-	if (argc < 2) {
-		vcmd = vcmd_list;
-		i = 1;
-	} else {
-		cmd = argv[1];
-		i = 2;
-		if (str_cmp(cmd, "-h") == 0) {
-			vcmd = vcmd_help;
-		} else if (str_cmp(cmd, "-c") == 0) {
-			vcmd = vcmd_cfglist;
-		} else if (str_cmp(cmd, "eject") == 0) {
-			vcmd = vcmd_eject;
-			if (str_cmp(argv[i], "-s") == 0) {
-				physical = true;
-				++i;
-			}
-
-			if (argc <= i) {
-				printf("Parameter missing.\n");
-				goto syntax_error;
-			}
-			volspec = argv[i++];
-		} else if (str_cmp(cmd, "insert") == 0) {
-			if (str_cmp(argv[i], "-p") == 0) {
-				vcmd = vcmd_insert_by_path;
-				++i;
-			} else {
-				vcmd = vcmd_insert;
-			}
-
-			if (argc <= i) {
-				printf("Parameter missing.\n");
-				goto syntax_error;
-			}
-			volspec = argv[i++];
-		} else {
-			printf("Invalid sub-command '%s'.\n", cmd);
-			goto syntax_error;
-		}
-	}
-
-	if (argc > i) {
-		printf("Unexpected argument '%s'.\n", argv[i]);
-		goto syntax_error;
-	}
-
-	switch (vcmd) {
-	case vcmd_eject:
-		rc = vol_cmd_eject(volspec, physical);
-		break;
-	case vcmd_insert:
-		rc = vol_cmd_insert(volspec);
-		break;
-	case vcmd_insert_by_path:
-		rc = vol_cmd_insert_by_path(volspec);
-		break;
-	case vcmd_help:
-		print_syntax();
-		rc = EOK;
-		break;
-	case vcmd_list:
-		rc = vol_cmd_list();
-		break;
-	case vcmd_cfglist:
-		rc = vol_cmd_cfglist();
-		break;
-	}
-
-	if (rc != EOK)
-		return 1;
-
-	return 0;
-
-syntax_error:
-	printf("Use %s -h to get help.\n", NAME);
-	return 1;
-}
-
-/** @}
- */
Index: pace/app/vuhid/device.c
===================================================================
--- uspace/app/vuhid/device.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,358 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/**
- * @file
- * Virtual USB HID device.
- */
-#include "virthid.h"
-#include <errno.h>
-#include <stdio.h>
-#include <str.h>
-#include <assert.h>
-#include <usb/classes/classes.h>
-
-static errno_t on_data_from_device(usbvirt_device_t *dev,
-    usb_endpoint_t ep, usb_transfer_type_t tr_type,
-    void *data, size_t data_size, size_t *actual_size)
-{
-	vuhid_data_t *vuhid = dev->device_data;
-	vuhid_interface_t *iface = vuhid->in_endpoints_mapping[ep];
-	if (iface == NULL) {
-		return ESTALL;
-	}
-
-	if (iface->on_data_in == NULL) {
-		return EBADCHECKSUM;
-	}
-
-	return iface->on_data_in(iface, data, data_size, actual_size);
-}
-
-static errno_t on_data_to_device(usbvirt_device_t *dev,
-    usb_endpoint_t ep, usb_transfer_type_t tr_type,
-    const void *data, size_t data_size)
-{
-	vuhid_data_t *vuhid = dev->device_data;
-	vuhid_interface_t *iface = vuhid->out_endpoints_mapping[ep];
-	if (iface == NULL) {
-		return ESTALL;
-	}
-
-	if (iface->on_data_out == NULL) {
-		return EBADCHECKSUM;
-	}
-
-	return iface->on_data_out(iface, data, data_size);
-}
-
-static errno_t interface_life_fibril(void *arg)
-{
-	vuhid_interface_t *iface = arg;
-	vuhid_data_t *hid_data = iface->vuhid_data;
-
-	if (iface->live != NULL) {
-		iface->live(iface);
-	}
-
-	fibril_mutex_lock(&hid_data->iface_count_mutex);
-	hid_data->iface_died_count++;
-	fibril_condvar_broadcast(&hid_data->iface_count_cv);
-	fibril_mutex_unlock(&hid_data->iface_count_mutex);
-
-	return EOK;
-}
-
-static vuhid_interface_t *find_interface_by_id(vuhid_interface_t **ifaces,
-    const char *id)
-{
-	if ((ifaces == NULL) || (id == NULL)) {
-		return NULL;
-	}
-	while (*ifaces != NULL) {
-		if (str_cmp((*ifaces)->id, id) == 0) {
-			return *ifaces;
-		}
-		ifaces++;
-	}
-
-	return NULL;
-}
-
-errno_t add_interface_by_id(vuhid_interface_t **interfaces, const char *id,
-    usbvirt_device_t *dev)
-{
-	vuhid_interface_t *iface = find_interface_by_id(interfaces, id);
-	if (iface == NULL) {
-		return ENOENT;
-	}
-
-	if ((iface->in_data_size == 0) && (iface->out_data_size == 0)) {
-		return EEMPTY;
-	}
-
-	/* Already used interface. */
-	if (iface->vuhid_data != NULL) {
-		return EEXIST;
-	}
-
-	vuhid_data_t *hid_data = dev->device_data;
-
-	/* Check that we have not run out of available endpoints. */
-	if ((iface->in_data_size > 0) &&
-	    (hid_data->in_endpoint_first_free >= VUHID_ENDPOINT_MAX)) {
-		return ELIMIT;
-	}
-	if ((iface->out_data_size > 0) &&
-	    (hid_data->out_endpoint_first_free >= VUHID_ENDPOINT_MAX)) {
-		return ELIMIT;
-	}
-
-	if (dev->descriptors->configuration->descriptor->interface_count >=
-	    VUHID_INTERFACE_MAX) {
-		return ELIMIT;
-	}
-
-	/*
-	 * How may descriptors we would add?
-	 */
-	/* Start with interface descriptor. */
-	size_t new_descriptor_count = 1;
-	/* Having in/out data size positive means we would need endpoint. */
-	if (iface->in_data_size > 0) {
-		new_descriptor_count++;
-	}
-	if (iface->out_data_size > 0) {
-		new_descriptor_count++;
-	}
-	/* Having report descriptor means adding the HID descriptor. */
-	if (iface->report_descriptor != NULL) {
-		new_descriptor_count++;
-	}
-
-	/* From now on, in case of errors, we goto to error_leave */
-	errno_t rc;
-
-	/*
-	 * Prepare new descriptors.
-	 */
-	size_t descr_count = 0;
-	size_t total_descr_size = 0;
-	usb_standard_interface_descriptor_t *descr_iface = NULL;
-	hid_descriptor_t *descr_hid = NULL;
-	usb_standard_endpoint_descriptor_t *descr_ep_in = NULL;
-	usb_standard_endpoint_descriptor_t *descr_ep_out = NULL;
-
-	size_t ep_count = 0;
-	if (iface->in_data_size > 0) {
-		ep_count++;
-	}
-	if (iface->out_data_size > 0) {
-		ep_count++;
-	}
-	assert(ep_count > 0);
-
-	/* Interface would be needed always. */
-	descr_iface = malloc(sizeof(usb_standard_interface_descriptor_t));
-	if (descr_iface == NULL) {
-		rc = ENOMEM;
-		goto error_leave;
-	}
-	descr_count++;
-	total_descr_size += sizeof(usb_standard_interface_descriptor_t);
-	descr_iface->length = sizeof(usb_standard_interface_descriptor_t);
-	descr_iface->descriptor_type = USB_DESCTYPE_INTERFACE;
-	descr_iface->interface_number =
-	    dev->descriptors->configuration->descriptor->interface_count;
-	descr_iface->alternate_setting = 0;
-	descr_iface->endpoint_count = ep_count;
-	descr_iface->interface_class = USB_CLASS_HID;
-	descr_iface->interface_subclass = iface->usb_subclass;
-	descr_iface->interface_protocol = iface->usb_protocol;
-	descr_iface->str_interface = 0;
-
-	/* Create the HID descriptor. */
-	if (iface->report_descriptor != NULL) {
-		descr_hid = malloc(sizeof(hid_descriptor_t));
-		if (descr_hid == NULL) {
-			rc = ENOMEM;
-			goto error_leave;
-		}
-		descr_count++;
-		total_descr_size += sizeof(hid_descriptor_t);
-		descr_hid->length = sizeof(hid_descriptor_t);
-		descr_hid->type = USB_DESCTYPE_HID;
-		descr_hid->hid_spec_release = 0x101;
-		descr_hid->country_code = 0;
-		descr_hid->descriptor_count = 1;
-		descr_hid->descriptor1_type = USB_DESCTYPE_HID_REPORT;
-		descr_hid->descriptor1_length = iface->report_descriptor_size;
-	}
-
-	/* Prepare the endpoint descriptors. */
-	if (iface->in_data_size > 0) {
-		descr_ep_in = malloc(sizeof(usb_standard_endpoint_descriptor_t));
-		if (descr_ep_in == NULL) {
-			rc = ENOMEM;
-			goto error_leave;
-		}
-		descr_count++;
-		total_descr_size += sizeof(usb_standard_endpoint_descriptor_t);
-		descr_ep_in->length = sizeof(usb_standard_endpoint_descriptor_t);
-		descr_ep_in->descriptor_type = USB_DESCTYPE_ENDPOINT;
-		descr_ep_in->endpoint_address =
-		    0x80 | hid_data->in_endpoint_first_free;
-		descr_ep_in->attributes = 3;
-		descr_ep_in->max_packet_size = iface->in_data_size;
-		descr_ep_in->poll_interval = 10;
-	}
-	if (iface->out_data_size > 0) {
-		descr_ep_out = malloc(sizeof(usb_standard_endpoint_descriptor_t));
-		if (descr_ep_out == NULL) {
-			rc = ENOMEM;
-			goto error_leave;
-		}
-		descr_count++;
-		total_descr_size += sizeof(usb_standard_endpoint_descriptor_t);
-		descr_ep_out->length = sizeof(usb_standard_endpoint_descriptor_t);
-		descr_ep_out->descriptor_type = USB_DESCTYPE_ENDPOINT;
-		descr_ep_out->endpoint_address =
-		    0x00 | hid_data->out_endpoint_first_free;
-		descr_ep_out->attributes = 3;
-		descr_ep_out->max_packet_size = iface->out_data_size;
-		descr_ep_out->poll_interval = 10;
-	}
-
-	/* Extend existing extra descriptors with these ones. */
-	usbvirt_device_configuration_extras_t *extra_descriptors;
-	extra_descriptors = realloc(dev->descriptors->configuration->extra,
-	    sizeof(usbvirt_device_configuration_extras_t) *
-	    (dev->descriptors->configuration->extra_count + descr_count));
-	if (extra_descriptors == NULL) {
-		rc = ENOMEM;
-		goto error_leave;
-	}
-
-	/* Launch the "life" fibril. */
-	iface->vuhid_data = hid_data;
-	fid_t life_fibril = fibril_create(interface_life_fibril, iface);
-	if (life_fibril == 0) {
-		rc = ENOMEM;
-		goto error_leave;
-	}
-
-	/*
-	 * Allocation is okay, we can (actually have to now) overwrite the
-	 * original pointer.
-	 */
-	dev->descriptors->configuration->extra = extra_descriptors;
-	extra_descriptors += dev->descriptors->configuration->extra_count;
-
-	/* Initialize them. */
-#define _APPEND_DESCRIPTOR(descriptor) \
-	do { \
-		if ((descriptor) != NULL) { \
-			extra_descriptors->data = (uint8_t *) (descriptor); \
-			extra_descriptors->length = (descriptor)->length; \
-			extra_descriptors++; \
-		} \
-	} while (0)
-
-	_APPEND_DESCRIPTOR(descr_iface);
-	_APPEND_DESCRIPTOR(descr_hid);
-	_APPEND_DESCRIPTOR(descr_ep_in);
-	_APPEND_DESCRIPTOR(descr_ep_out);
-#undef _APPEND_DESCRIPTOR
-	dev->descriptors->configuration->extra_count += descr_count;
-
-	/*
-	 * Final changes.
-	 * Increase the necessary counters, make endpoint mapping.
-	 *
-	 */
-	if (iface->in_data_size > 0) {
-		hid_data->in_endpoints_mapping[hid_data->in_endpoint_first_free] =
-		    iface;
-		dev->ops->data_in[hid_data->in_endpoint_first_free] =
-		    on_data_from_device;
-		hid_data->in_endpoint_first_free++;
-	}
-	if (iface->out_data_size > 0) {
-		hid_data->out_endpoints_mapping[hid_data->out_endpoint_first_free] =
-		    iface;
-		dev->ops->data_out[hid_data->out_endpoint_first_free] =
-		    on_data_to_device;
-		hid_data->out_endpoint_first_free++;
-	}
-
-	hid_data->interface_mapping[dev->descriptors->configuration->descriptor->interface_count] =
-	    iface;
-
-	dev->descriptors->configuration->descriptor->interface_count++;
-	dev->descriptors->configuration->descriptor->total_length +=
-	    total_descr_size;
-
-	hid_data->iface_count++;
-	fibril_add_ready(life_fibril);
-
-	return EOK;
-
-error_leave:
-	if (descr_iface != NULL) {
-		free(descr_iface);
-	}
-	if (descr_hid != NULL) {
-		free(descr_hid);
-	}
-	if (descr_ep_in != NULL) {
-		free(descr_ep_in);
-	}
-	if (descr_ep_out != NULL) {
-		free(descr_ep_out);
-	}
-
-	return rc;
-}
-
-void wait_for_interfaces_death(usbvirt_device_t *dev)
-{
-	vuhid_data_t *hid_data = dev->device_data;
-
-	fibril_mutex_lock(&hid_data->iface_count_mutex);
-	while (hid_data->iface_died_count < hid_data->iface_count) {
-		fibril_condvar_wait(&hid_data->iface_count_cv,
-		    &hid_data->iface_count_mutex);
-	}
-	fibril_mutex_unlock(&hid_data->iface_count_mutex);
-}
-
-/** @}
- */
Index: pace/app/vuhid/doc/doxygroups.h
===================================================================
--- uspace/app/vuhid/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup usbvirthid vuhid
- * @brief Virtual USB HID device
- * @ingroup apps
- */
Index: pace/app/vuhid/hids/bootkbd.c
===================================================================
--- uspace/app/vuhid/hids/bootkbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/** @file
- *
- */
-#include "../virthid.h"
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/hid/hid.h>
-#include <usb/hid/usages/core.h>
-
-#include "../report.h"
-
-uint8_t report_descriptor[] = {
-	STD_USAGE_PAGE(USB_HIDUT_PAGE_GENERIC_DESKTOP),
-	USAGE1(USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD),
-	START_COLLECTION(COLLECTION_APPLICATION),
-
-	STD_USAGE_PAGE(USB_HIDUT_PAGE_KEYBOARD),
-	USAGE_MINIMUM1(224),
-	USAGE_MAXIMUM1(231),
-	LOGICAL_MINIMUM1(0),
-	LOGICAL_MAXIMUM1(1),
-	REPORT_SIZE1(1),
-	REPORT_COUNT1(8),
-	/* Modifiers */
-	INPUT(IOF_DATA | IOF_VARIABLE | IOF_ABSOLUTE),
-	REPORT_COUNT1(1),
-	REPORT_SIZE1(8),
-	/* Reserved */
-	INPUT(IOF_CONSTANT),
-	REPORT_COUNT1(5),
-	REPORT_SIZE1(1),
-	STD_USAGE_PAGE(USB_HIDUT_PAGE_LED),
-	USAGE_MINIMUM1(1),
-	USAGE_MAXIMUM1(5),
-	/* LED states */
-	OUTPUT(IOF_DATA | IOF_VARIABLE | IOF_ABSOLUTE),
-	REPORT_COUNT1(1),
-	REPORT_SIZE1(3),
-	/* LED states padding */
-	OUTPUT(IOF_CONSTANT),
-	REPORT_COUNT1(6),
-	REPORT_SIZE1(8),
-	LOGICAL_MINIMUM1(0),
-	LOGICAL_MAXIMUM1(101),
-	STD_USAGE_PAGE(USB_HIDUT_PAGE_KEYBOARD),
-	USAGE_MINIMUM1(0),
-	USAGE_MAXIMUM1(101),
-	/* Key array */
-	INPUT(IOF_DATA | IOF_ARRAY),
-
-	END_COLLECTION()
-};
-
-#define INPUT_SIZE 8
-
-static uint8_t in_data[] = {
-	0,      0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0,      0, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, // Caps Lock
-	0,      0, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, // Num Lock
-	0,      0, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, // Caps Lock
-	1 << 2, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	1 << 2, 0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
-	1 << 2, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0,      0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-static vuhid_interface_life_t boot_life = {
-	.data_in = in_data,
-	.data_in_count = sizeof(in_data) / INPUT_SIZE,
-	.data_in_pos_change_delay = 500,
-	.msg_born = "Boot keyboard comes to life...",
-	.msg_die = "Boot keyboard died."
-};
-
-static errno_t on_data_out(vuhid_interface_t *iface,
-    const void *buffer, size_t buffer_size)
-{
-	if (buffer_size == 0) {
-		return EEMPTY;
-	}
-	uint8_t leds = ((uint8_t *) buffer)[0];
-#define _GET_LED(index, signature) \
-	(((leds) & (1 << index)) ? (signature) : '-')
-	usb_log_info("%s: LEDs = %c%c%c%c%c",
-	    iface->name,
-	    _GET_LED(0, '0'), _GET_LED(1, 'A'), _GET_LED(2, 's'),
-	    _GET_LED(3, 'c'), _GET_LED(4, 'k'));
-#undef _GET_LED
-	return EOK;
-}
-
-vuhid_interface_t vuhid_interface_bootkbd = {
-	.id = "boot",
-	.name = "boot keyboard",
-	.usb_subclass = USB_HID_SUBCLASS_BOOT,
-	.usb_protocol = USB_HID_PROTOCOL_KEYBOARD,
-
-	.report_descriptor = report_descriptor,
-	.report_descriptor_size = sizeof(report_descriptor),
-
-	.in_data_size = INPUT_SIZE,
-	.on_data_in = interface_live_on_data_in,
-
-	.out_data_size = 1,
-	.on_data_out = on_data_out,
-
-	.live = interface_life_live,
-
-	.interface_data = &boot_life,
-	.vuhid_data = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/vuhid/hids/logitech_wireless.c
===================================================================
--- uspace/app/vuhid/hids/logitech_wireless.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/** @file
- * Logitech wireless mouse-keyboard combo simulation (see issue 349).
- */
-#include "../virthid.h"
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/hid/hid.h>
-#include <usb/hid/usages/core.h>
-
-static uint8_t iface1_report_descriptor[] = {
-	0x05, 0x01, 0x09, 0x02, 0xA1, 0x01, 0x85, 0x02, 0x09, 0x01,
-	0xA1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x10, 0x15, 0x00,
-	0x25, 0x01, 0x95, 0x10, 0x75, 0x01, 0x81, 0x02, 0x05, 0x01,
-	0x16, 0x01, 0xF8, 0x26, 0xFF, 0x07, 0x75, 0x0C, 0x95, 0x02,
-	0x09, 0x30, 0x09, 0x31, 0x81, 0x06, 0x15, 0x81, 0x25, 0x7F,
-	0x75, 0x08, 0x95, 0x01, 0x09, 0x38, 0x81, 0x06, 0x05, 0x0C,
-	0x0A, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xC0, 0xC0, 0x05,
-	0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x03, 0x75, 0x10, 0x95,
-	0x02, 0x15, 0x01, 0x26, 0x8C, 0x02, 0x19, 0x01, 0x2A, 0x8C,
-	0x02, 0x81, 0x00, 0xC0, 0x05, 0x01, 0x09, 0x80, 0xA1, 0x01,
-	0x85, 0x04, 0x75, 0x02, 0x95, 0x01, 0x15, 0x01, 0x25, 0x03,
-	0x09, 0x82, 0x09, 0x81, 0x09, 0x83, 0x81, 0x60, 0x75, 0x06,
-	0x81, 0x03, 0xC0, 0x06, 0xBC, 0xFF, 0x09, 0x88, 0xA1, 0x01,
-	0x85, 0x08, 0x19, 0x01, 0x29, 0xFF, 0x15, 0x01, 0x26, 0xFF,
-	0x00, 0x75, 0x08, 0x95, 0x01, 0x81, 0x00, 0xC0
-};
-#define iface1_input_size 8
-static uint8_t iface1_in_data[] = {
-	0, 0, 0, 0, 0, 0, 0, 0
-};
-
-static vuhid_interface_life_t iface1_life = {
-	.data_in = iface1_in_data,
-	.data_in_count = sizeof(iface1_in_data) / iface1_input_size,
-	.data_in_pos_change_delay = 50,
-	.msg_born = "Mouse of Logitech Unifying Receiver comes to life...",
-	.msg_die = "Mouse of Logitech Unifying Receiver disconnected."
-};
-
-vuhid_interface_t vuhid_interface_logitech_wireless_1 = {
-	.id = "lw1",
-	.name = "Logitech Unifying Receiver, interface 1 (mouse)",
-	.usb_subclass = USB_HID_SUBCLASS_BOOT,
-	.usb_protocol = USB_HID_PROTOCOL_MOUSE,
-
-	.report_descriptor = iface1_report_descriptor,
-	.report_descriptor_size = sizeof(iface1_report_descriptor),
-
-	.in_data_size = iface1_input_size,
-	.on_data_in = interface_live_on_data_in,
-
-	.out_data_size = 0,
-	.on_data_out = NULL,
-
-	.live = interface_life_live,
-
-	.interface_data = &iface1_life,
-	.vuhid_data = NULL
-};
-
-/**
- * @}
- */
Index: pace/app/vuhid/ifaces.c
===================================================================
--- uspace/app/vuhid/ifaces.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/**
- * @file
- * List of known interfaces.
- */
-#include <stdlib.h>
-#include "ifaces.h"
-
-extern vuhid_interface_t vuhid_interface_bootkbd;
-extern vuhid_interface_t vuhid_interface_logitech_wireless_1;
-
-vuhid_interface_t *available_hid_interfaces[] = {
-	&vuhid_interface_bootkbd,
-	&vuhid_interface_logitech_wireless_1,
-	NULL
-};
-
-/** @}
- */
Index: pace/app/vuhid/ifaces.h
===================================================================
--- uspace/app/vuhid/ifaces.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/** @file
- *
- */
-#ifndef VUHID_IFACES_H_
-#define VUHID_IFACES_H_
-
-#include "virthid.h"
-
-extern vuhid_interface_t *available_hid_interfaces[];
-
-#endif
-/**
- * @}
- */
Index: pace/app/vuhid/items.h
===================================================================
--- uspace/app/vuhid/items.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirtkbd
- * @{
- */
-/** @file
- * @brief HID Item related functions.
- */
-#ifndef VUK_ITEM_H_
-#define VUK_ITEM_H_
-
-#include <stdint.h>
-
-typedef uint8_t report_descriptor_data_t[];
-
-/* Item types. */
-#define ITEM_MAIN 0
-#define ITEM_GLOBAL 1
-#define ITEM_LOCAL 2
-
-/* Item tags. */
-
-/* Main item tags. */
-#define TAG_INPUT 8
-#define TAG_OUTPUT 9
-#define TAG_FEATURE 11
-#define TAG_COLLECTION 10
-#define TAG_END_COLLECTION 12
-
-/* Global item tags. */
-#define TAG_USAGE_PAGE 0
-#define TAG_LOGICAL_MINIMUM 1
-#define TAG_LOGICAL_MAXIMUM 2
-#define TAG_REPORT_SIZE 7
-#define TAG_REPORT_COUNT 9
-
-/* Local item tags. */
-#define TAG_USAGE 0
-#define TAG_USAGE_MINIMUM 1
-#define TAG_USAGE_MAXIMUM 2
-
-/* Bits for Input, Output and Feature items. */
-#define _IOF(value, shift) ((value) << (shift))
-#define IOF_DATA _IOF(0, 0)
-#define IOF_CONSTANT _IOF(1, 0)
-#define IOF_ARRAY _IOF(0, 1)
-#define IOF_VARIABLE _IOF(1, 1)
-#define IOF_ABSOLUTE _IOF(0, 2)
-#define IOF_RELATIVE _IOF(1, 2)
-/* ... */
-
-/* Collection types. */
-#define COLLECTION_PHYSICAL 0x00
-#define COLLECTION_APPLICATION 0x01
-
-/** Creates item prefix.
- * @param size Item size.
- * @param type Item type.
- * @param tag Item tag.
- */
-#define BUILD_ITEM_PREFIX(size, type, tag) \
-	((size) | ((type) << 2) | ((tag) << 4))
-
-/** Create no-data item.
- * @param type Item type.
- * @param tag Item tag.
- */
-#define ITEM_CREATE0(type, tag) \
-	BUILD_ITEM_PREFIX(0, type, tag)
-
-/** Create item with 1-byte data.
- * @param type Item type.
- * @param tag Item tag.
- * @param data Item data (single byte).
- */
-#define ITEM_CREATE1(type, tag, data) \
-	BUILD_ITEM_PREFIX(1, type, tag), data
-
-#endif
-/**
- * @}
- */
Index: pace/app/vuhid/life.c
===================================================================
--- uspace/app/vuhid/life.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/**
- * @file
- *
- */
-#include <errno.h>
-#include <usb/debug.h>
-#include "virthid.h"
-
-void interface_life_live(vuhid_interface_t *iface)
-{
-	vuhid_interface_life_t *data = iface->interface_data;
-	data->data_in_pos = 0;
-	data->data_in_last_pos = (size_t) -1;
-	fibril_usleep(1000 * 1000 * 5);
-	usb_log_debug("%s", data->msg_born);
-	while (data->data_in_pos < data->data_in_count) {
-		fibril_usleep(1000 * data->data_in_pos_change_delay);
-		// FIXME: proper locking
-		data->data_in_pos++;
-	}
-	usb_log_debug("%s", data->msg_die);
-}
-
-errno_t interface_live_on_data_in(vuhid_interface_t *iface,
-    void *buffer, size_t buffer_size, size_t *act_buffer_size)
-{
-	vuhid_interface_life_t *life = iface->interface_data;
-	size_t pos = life->data_in_pos;
-	if (pos >= life->data_in_count) {
-		return EBADCHECKSUM;
-	}
-
-	if (pos == life->data_in_last_pos) {
-		return ENAK;
-	}
-
-	if (buffer_size > iface->in_data_size) {
-		buffer_size = iface->in_data_size;
-	}
-
-	if (act_buffer_size != NULL) {
-		*act_buffer_size = buffer_size;
-	}
-
-	memcpy(buffer, life->data_in + pos * iface->in_data_size, buffer_size);
-	life->data_in_last_pos = pos;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/app/vuhid/main.c
===================================================================
--- uspace/app/vuhid/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,250 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/**
- * @file
- * Virtual USB HID device.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include <getopt.h>
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/hid/hid.h>
-#include <usbvirt/device.h>
-
-#include "virthid.h"
-#include "ifaces.h"
-#include "stdreq.h"
-
-#define DEFAULT_CONTROLLER   "/virt/usbhc/virtual"
-
-static usbvirt_control_request_handler_t endpoint_zero_handlers[] = {
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_INTERFACE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "Get_Descriptor",
-		.callback = req_get_descriptor
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_INTERFACE, USB_HIDREQ_SET_PROTOCOL),
-		.name = "Set_Protocol",
-		.callback = req_set_protocol
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_INTERFACE, USB_HIDREQ_SET_REPORT),
-		.name = "Set_Report",
-		.callback = req_set_report
-	},
-	{
-		.callback = NULL
-	}
-};
-
-/** Keyboard callbacks.
- * We abuse the fact that static variables are zero-filled.
- */
-static usbvirt_device_ops_t hid_ops = {
-	.control = endpoint_zero_handlers,
-};
-
-/** Standard configuration descriptor. */
-static usb_standard_configuration_descriptor_t std_configuration_descriptor = {
-	.length = sizeof(usb_standard_configuration_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_CONFIGURATION,
-	/* Will be patched at runtime. */
-	.total_length = sizeof(usb_standard_configuration_descriptor_t),
-	.interface_count = 0,
-	.configuration_number = 1,
-	.str_configuration = 0,
-	.attributes = 128, /* denotes bus-powered device */
-	.max_power = 50
-};
-
-/** Standard device descriptor. */
-static usb_standard_device_descriptor_t std_device_descriptor = {
-	.length = sizeof(usb_standard_device_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_DEVICE,
-	.usb_spec_version = 0x110,
-	.device_class = USB_CLASS_USE_INTERFACE,
-	.device_subclass = 0,
-	.device_protocol = 0,
-	.max_packet_size = 64,
-	.configuration_count = 1
-};
-
-/** HID configuration. */
-usbvirt_device_configuration_t configuration = {
-	.descriptor = &std_configuration_descriptor,
-	.extra = NULL,
-	.extra_count = 0
-};
-
-/** HID standard descriptors. */
-usbvirt_descriptors_t descriptors = {
-	.device = &std_device_descriptor,
-	.configuration = &configuration,
-	.configuration_count = 1,
-};
-
-static vuhid_data_t vuhid_data = {
-	.in_endpoints_mapping = { NULL },
-	.in_endpoint_first_free = 1,
-	.out_endpoints_mapping = { NULL },
-	.out_endpoint_first_free = 1,
-
-	.iface_count = 0,
-	.iface_died_count = 0
-	// mutex and CV must be initialized elsewhere
-};
-
-/** Keyboard device.
- * Rest of the items will be initialized later.
- */
-static usbvirt_device_t hid_dev = {
-	.ops = &hid_ops,
-	.descriptors = &descriptors,
-	.name = "HID",
-	.device_data = &vuhid_data
-};
-
-static struct option long_options[] = {
-	{ "help", optional_argument, NULL, 'h' },
-	{ "controller", required_argument, NULL, 'c' },
-	{ "list", no_argument, NULL, 'l' },
-	{ 0, 0, NULL, 0 }
-};
-static const char *short_options = "hc:l";
-
-static void print_help(const char *name, const char *module)
-{
-	if (module == NULL) {
-		/* Default help */
-		printf("Usage: %s [options] device.\n", name);
-		printf("\t-h, --help [device]\n");
-		printf("\t\to With no argument print this help and exit.\n");
-		printf("\t\to With argument print device specific help and exit.\n");
-		printf("\t-l, --list \n\t\tPrint list of available devices.\n");
-		printf("\t-c, --controller \n\t\t"
-		    "Use provided virtual hc instead of default (%s)\n",
-		    DEFAULT_CONTROLLER);
-		return;
-	}
-	printf("HELP for module %s\n", module);
-}
-
-static void print_list(void)
-{
-	printf("Available devices:\n");
-	for (vuhid_interface_t **i = available_hid_interfaces; *i != NULL; ++i) {
-		printf("\t`%s'\t%s\n", (*i)->id, (*i)->name);
-	}
-
-}
-
-static const char *controller = DEFAULT_CONTROLLER;
-
-int main(int argc, char *argv[])
-{
-
-	if (argc == 1) {
-		print_help(*argv, NULL);
-		return 0;
-	}
-
-	int opt = 0;
-	while ((opt = getopt_long(argc, argv, short_options, long_options, NULL)) > 0) {
-		switch (opt) {
-		case 'h':
-			print_help(*argv, optarg);
-			return 0;
-		case 'c':
-			controller = optarg;
-			break;
-		case 'l':
-			print_list();
-			return 0;
-		case -1:
-		default:
-			break;
-		}
-	}
-
-	log_init("vuhid");
-
-	fibril_mutex_initialize(&vuhid_data.iface_count_mutex);
-	fibril_condvar_initialize(&vuhid_data.iface_count_cv);
-
-	/* Determine which interfaces to initialize. */
-	for (int i = optind; i < argc; i++) {
-		errno_t rc = add_interface_by_id(available_hid_interfaces, argv[i],
-		    &hid_dev);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed to add device `%s': %s.\n",
-			    argv[i], str_error(rc));
-		} else {
-			printf("Added device `%s'.\n", argv[i]);
-		}
-	}
-
-	for (int i = 0; i < (int) hid_dev.descriptors->configuration->extra_count; i++) {
-		usb_log_debug("Found extra descriptor: %s.",
-		    usb_debug_str_buffer(
-		    hid_dev.descriptors->configuration->extra[i].data,
-		    hid_dev.descriptors->configuration->extra[i].length,
-		    0));
-	}
-
-	const errno_t rc = usbvirt_device_plug(&hid_dev, controller);
-	if (rc != EOK) {
-		printf("Unable to start communication with VHCD `%s': %s.\n",
-		    controller, str_error(rc));
-		return rc;
-	}
-
-	printf("Connected to VHCD `%s'...\n", controller);
-
-	wait_for_interfaces_death(&hid_dev);
-
-	printf("Terminating...\n");
-
-	usbvirt_device_unplug(&hid_dev);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/vuhid/meson.build
===================================================================
--- uspace/app/vuhid/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usb', 'usbdev', 'usbhid', 'usbvirt', 'drv' ]
-src = files(
-	'main.c',
-	'device.c',
-	'ifaces.c',
-	'life.c',
-	'stdreq.c',
-	'hids/bootkbd.c',
-	'hids/logitech_wireless.c',
-)
Index: pace/app/vuhid/report.h
===================================================================
--- uspace/app/vuhid/report.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirtkbd
- * @{
- */
-/** @file
- * @brief HID Report Descriptor.
- */
-#ifndef VUK_REPORT_H_
-#define VUK_REPORT_H_
-
-#include "items.h"
-
-/** Use standard Usage Page. */
-#define STD_USAGE_PAGE(page) \
-	ITEM_CREATE1(ITEM_GLOBAL, TAG_USAGE_PAGE, page)
-
-/** Usage with one byte usage ID. */
-#define USAGE1(usage_id) \
-	ITEM_CREATE1(ITEM_LOCAL, TAG_USAGE, usage_id)
-
-/** Start a collection. */
-#define START_COLLECTION(collection) \
-	ITEM_CREATE1(ITEM_MAIN, TAG_COLLECTION, collection)
-
-/** End a collection. */
-#define END_COLLECTION() \
-	ITEM_CREATE0(ITEM_MAIN, TAG_END_COLLECTION)
-
-#define USAGE_MINIMUM1(value) \
-	ITEM_CREATE1(ITEM_LOCAL, TAG_USAGE_MINIMUM, value)
-
-#define USAGE_MAXIMUM1(value) \
-	ITEM_CREATE1(ITEM_LOCAL, TAG_USAGE_MAXIMUM, value)
-
-#define LOGICAL_MINIMUM1(value) \
-	ITEM_CREATE1(ITEM_GLOBAL, TAG_LOGICAL_MINIMUM, value)
-
-#define LOGICAL_MAXIMUM1(value) \
-	ITEM_CREATE1(ITEM_GLOBAL, TAG_LOGICAL_MAXIMUM, value)
-
-#define REPORT_SIZE1(size) \
-	ITEM_CREATE1(ITEM_GLOBAL, TAG_REPORT_SIZE, size)
-
-#define REPORT_COUNT1(count) \
-	ITEM_CREATE1(ITEM_GLOBAL, TAG_REPORT_COUNT, count)
-
-#define INPUT(modifiers) \
-	ITEM_CREATE1(ITEM_MAIN, TAG_INPUT, modifiers)
-
-#define OUTPUT(modifiers) \
-	ITEM_CREATE1(ITEM_MAIN, TAG_OUTPUT, modifiers)
-
-#endif
-/**
- * @}
- */
Index: pace/app/vuhid/stdreq.c
===================================================================
--- uspace/app/vuhid/stdreq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/**
- * @file
- *
- */
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include "stdreq.h"
-#include "virthid.h"
-
-#define VUHID_DATA(vuhid, device) \
-	vuhid_data_t *vuhid = device->device_data
-
-errno_t req_get_descriptor(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	VUHID_DATA(vuhid, device);
-
-	if (setup_packet->value_high == USB_DESCTYPE_HID_REPORT) {
-		vuhid_interface_t *iface =
-		    vuhid->interface_mapping[setup_packet->index];
-		if (iface == NULL) {
-			return EFORWARD;
-		}
-		if (iface->report_descriptor != NULL) {
-			usbvirt_control_reply_helper(setup_packet,
-			    data, act_size,
-			    iface->report_descriptor,
-			    iface->report_descriptor_size);
-			return EOK;
-		} else {
-			return ENOENT;
-		}
-	}
-
-	/* Let the framework handle all the rest. */
-	return EFORWARD;
-}
-
-errno_t req_set_protocol(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	VUHID_DATA(vuhid, device);
-
-	size_t iface_index = setup_packet->index;
-	int protocol = setup_packet->value;
-
-	// FIXME - check ranges
-	vuhid_interface_t *iface = vuhid->interface_mapping[iface_index];
-	if (iface == NULL) {
-		return ENOENT;
-	}
-	iface->set_protocol = protocol;
-
-	return EOK;
-}
-
-errno_t req_set_report(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	VUHID_DATA(vuhid, device);
-
-	size_t iface_index = setup_packet->index;
-
-	// FIXME - check ranges
-	vuhid_interface_t *iface = vuhid->interface_mapping[iface_index];
-	if (iface == NULL) {
-		return ENOENT;
-	}
-
-	size_t data_length = setup_packet->length;
-	if (iface->on_data_out == NULL) {
-		return ENOTSUP;
-	}
-
-	/* SET_REPORT is translated to data out */
-	errno_t rc = iface->on_data_out(iface, data, data_length);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/app/vuhid/stdreq.h
===================================================================
--- uspace/app/vuhid/stdreq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/** @file
- * Device request handlers.
- */
-#ifndef VUHID_STDREQ_H_
-#define VUHID_STDREQ_H_
-
-#include <usbvirt/device.h>
-
-errno_t req_get_descriptor(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size);
-
-errno_t req_set_protocol(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size);
-
-errno_t req_set_report(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size);
-
-#endif
-/**
- * @}
- */
Index: pace/app/vuhid/virthid.h
===================================================================
--- uspace/app/vuhid/virthid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usbvirthid
- * @{
- */
-/** @file
- *
- */
-#ifndef VUHID_VIRTHID_H_
-#define VUHID_VIRTHID_H_
-
-#include <usb/usb.h>
-#include <usbvirt/device.h>
-#include <fibril_synch.h>
-
-#define VUHID_ENDPOINT_MAX USB_ENDPOINT_MAX
-#define VUHID_INTERFACE_MAX 8
-
-typedef struct vuhid_interface vuhid_interface_t;
-
-typedef struct {
-	vuhid_interface_t *in_endpoints_mapping[VUHID_ENDPOINT_MAX];
-	size_t in_endpoint_first_free;
-	vuhid_interface_t *out_endpoints_mapping[VUHID_ENDPOINT_MAX];
-	size_t out_endpoint_first_free;
-	vuhid_interface_t *interface_mapping[VUHID_INTERFACE_MAX];
-
-	fibril_mutex_t iface_count_mutex;
-	fibril_condvar_t iface_count_cv;
-	size_t iface_count;
-	size_t iface_died_count;
-} vuhid_data_t;
-
-struct vuhid_interface {
-	const char *name;
-	const char *id;
-	int usb_subclass;
-	int usb_protocol;
-
-	uint8_t *report_descriptor;
-	size_t report_descriptor_size;
-
-	size_t in_data_size;
-	size_t out_data_size;
-
-	errno_t (*on_data_in)(vuhid_interface_t *, void *, size_t, size_t *);
-	errno_t (*on_data_out)(vuhid_interface_t *, const void *, size_t);
-	void (*live)(vuhid_interface_t *);
-
-	int set_protocol;
-
-	void *interface_data;
-
-	vuhid_data_t *vuhid_data;
-};
-
-typedef struct {
-	/** Buffer with data from device to the host. */
-	uint8_t *data_in;
-	/** Number of items in @c data_in.
-	 * The total size of @c data_in buffer shall be
-	 * <code>data_in_count * vuhid_interface_t.in_data_size</code>.
-	 */
-	size_t data_in_count;
-
-	/** Current position in the data buffer. */
-	size_t data_in_pos;
-	/** Previous position. */
-	size_t data_in_last_pos;
-
-	/** Delay between transition to "next" input buffer (in ms). */
-	size_t data_in_pos_change_delay;
-
-	/** Message to print when interface becomes alive. */
-	const char *msg_born;
-	/** Message to print when interface dies. */
-	const char *msg_die;
-} vuhid_interface_life_t;
-
-typedef struct {
-	uint8_t length;
-	uint8_t type;
-	uint16_t hid_spec_release;
-	uint8_t country_code;
-	uint8_t descriptor_count;
-	uint8_t descriptor1_type;
-	uint16_t descriptor1_length;
-} __attribute__((packed)) hid_descriptor_t;
-
-errno_t add_interface_by_id(vuhid_interface_t **, const char *, usbvirt_device_t *);
-void wait_for_interfaces_death(usbvirt_device_t *);
-
-void interface_life_live(vuhid_interface_t *);
-errno_t interface_live_on_data_in(vuhid_interface_t *, void *, size_t, size_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/app/wavplay/doc/doxygroups.h
===================================================================
--- uspace/app/wavplay/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup wavplay wavplay
- * @brief WAV file player
- * @ingroup apps
- */
Index: pace/app/wavplay/dplay.c
===================================================================
--- uspace/app/wavplay/dplay.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,417 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup wavplay
- * @{
- */
-/**
- * @file PCM playback audio devices
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <str_error.h>
-#include <str.h>
-#include <audio_pcm_iface.h>
-#include <fibril_synch.h>
-#include <pcm/format.h>
-#include <as.h>
-#include <time.h>
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <macros.h>
-
-#include "wave.h"
-#include "dplay.h"
-
-#define DEFAULT_FRAGMENTS 2
-
-/** Playback helper structure */
-typedef struct {
-	struct {
-		void *base;
-		size_t size;
-		void *write_ptr;
-	} buffer;
-	pcm_format_t f;
-	FILE *source;
-	volatile bool playing;
-	fibril_mutex_t mutex;
-	fibril_condvar_t cv;
-	audio_pcm_sess_t *device;
-} playback_t;
-
-/**
- * Initialize playback helper structure.
- * @param pb Pointer to helper structure to initialize
- * @param sess Pointer to audio device IPC session
- * @return
- */
-static void playback_initialize(playback_t *pb, audio_pcm_sess_t *sess)
-{
-	assert(sess);
-	assert(pb);
-	pb->buffer.base = NULL;
-	pb->buffer.size = 0;
-	pb->buffer.write_ptr = NULL;
-	pb->playing = false;
-	pb->source = NULL;
-	pb->device = sess;
-	fibril_mutex_initialize(&pb->mutex);
-	fibril_condvar_initialize(&pb->cv);
-}
-
-/** Fragment playback callback function.
- *
- * @param icall Pointer to the call structure
- * @param arg   Argument, pointer to the playback helper function
- *
- */
-static void device_event_callback(ipc_call_t *icall, void *arg)
-{
-	playback_t *pb = arg;
-	const size_t fragment_size = pb->buffer.size / DEFAULT_FRAGMENTS;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		switch (ipc_get_imethod(&call)) {
-		case PCM_EVENT_PLAYBACK_STARTED:
-		case PCM_EVENT_FRAMES_PLAYED:
-			printf("%" PRIun " frames: ", ipc_get_arg1(&call));
-			async_answer_0(&call, EOK);
-			break;
-		case PCM_EVENT_PLAYBACK_TERMINATED:
-			printf("Playback terminated\n");
-			fibril_mutex_lock(&pb->mutex);
-			pb->playing = false;
-			fibril_condvar_signal(&pb->cv);
-			async_answer_0(&call, EOK);
-			fibril_mutex_unlock(&pb->mutex);
-			return;
-		default:
-			printf("Unknown event %" PRIun ".\n", ipc_get_imethod(&call));
-			async_answer_0(&call, ENOTSUP);
-			continue;
-
-		}
-		const size_t bytes = fread(pb->buffer.write_ptr,
-		    sizeof(uint8_t), fragment_size, pb->source);
-		printf("Copied from position %p size %zu/%zu\n",
-		    pb->buffer.write_ptr, bytes, fragment_size);
-		if (bytes == 0) {
-			audio_pcm_last_playback_fragment(pb->device);
-		}
-		/* any constant is silence */
-		memset(pb->buffer.write_ptr + bytes, 0, fragment_size - bytes);
-		pb->buffer.write_ptr += fragment_size;
-
-		if (pb->buffer.write_ptr >= (pb->buffer.base + pb->buffer.size))
-			pb->buffer.write_ptr -= pb->buffer.size;
-	}
-}
-
-/**
- * Start event based playback.
- * @param pb Playback helper structure.
- */
-static void play_fragment(playback_t *pb)
-{
-	assert(pb);
-	assert(pb->device);
-	const size_t fragment_size = pb->buffer.size / DEFAULT_FRAGMENTS;
-	printf("Registering event callback\n");
-	errno_t ret = audio_pcm_register_event_callback(pb->device,
-	    device_event_callback, pb);
-	if (ret != EOK) {
-		printf("Failed to register event callback: %s.\n",
-		    str_error(ret));
-		return;
-	}
-	printf("Playing: %dHz, %s, %d channel(s).\n", pb->f.sampling_rate,
-	    pcm_sample_format_str(pb->f.sample_format), pb->f.channels);
-	const size_t bytes = fread(pb->buffer.base, sizeof(uint8_t),
-	    fragment_size, pb->source);
-	if (bytes != fragment_size)
-		memset(pb->buffer.base + bytes, 0, fragment_size - bytes);
-	printf("Initial: Copied from position %p size %zu/%zu\n",
-	    pb->buffer.base, bytes, fragment_size);
-	pb->buffer.write_ptr = pb->buffer.base + fragment_size;
-	fibril_mutex_lock(&pb->mutex);
-	const unsigned frames =
-	    pcm_format_size_to_frames(fragment_size, &pb->f);
-	ret = audio_pcm_start_playback_fragment(pb->device, frames,
-	    pb->f.channels, pb->f.sampling_rate, pb->f.sample_format);
-	if (ret != EOK) {
-		fibril_mutex_unlock(&pb->mutex);
-		printf("Failed to start playback: %s.\n", str_error(ret));
-		audio_pcm_unregister_event_callback(pb->device);
-		return;
-	}
-
-	pb->playing = true;
-	while (pb->playing)
-		fibril_condvar_wait(&pb->cv, &pb->mutex);
-
-	fibril_mutex_unlock(&pb->mutex);
-	printf("\n");
-	audio_pcm_unregister_event_callback(pb->device);
-}
-
-/**
- * Count occupied space in a cyclic buffer.
- * @param pb Playback helper structure.
- * @param pos read pointer position.
- * @return Occupied space size.
- */
-static size_t buffer_occupied(const playback_t *pb, size_t pos)
-{
-	assert(pb);
-	void *read_ptr = pb->buffer.base + pos;
-	if (read_ptr > pb->buffer.write_ptr)
-		return pb->buffer.write_ptr + pb->buffer.size - read_ptr;
-	return pb->buffer.write_ptr - read_ptr;
-
-}
-
-/**
- * Count available space in a cyclic buffer.
- * @param pb Playback helper structure.
- * @param pos read pointer position.
- * @return Free space size.
- */
-static size_t buffer_avail(const playback_t *pb, size_t pos)
-{
-	assert(pb);
-	void *read_ptr = pb->buffer.base + pos;
-	if (read_ptr <= pb->buffer.write_ptr)
-		return read_ptr + pb->buffer.size - pb->buffer.write_ptr - 1;
-	return (read_ptr - pb->buffer.write_ptr) - 1;
-}
-
-/**
- * Size of the space between write pointer and the end of a cyclic buffer
- * @param pb Playback helper structure.
- */
-static size_t buffer_remain(const playback_t *pb)
-{
-	assert(pb);
-	return (pb->buffer.base + pb->buffer.size) - pb->buffer.write_ptr;
-}
-
-/**
- * Move write pointer forward. Wrap around the end.
- * @param pb Playback helper structure.
- * @param bytes NUmber of bytes to advance.
- */
-static void buffer_advance(playback_t *pb, size_t bytes)
-{
-	assert(pb);
-	pb->buffer.write_ptr += bytes;
-	while (pb->buffer.write_ptr >= (pb->buffer.base + pb->buffer.size))
-		pb->buffer.write_ptr -= pb->buffer.size;
-}
-
-#define DPRINTF(f, ...) \
-	printf("%.2lld:%.6lld   "f, time.tv_sec % 100, \
-	    NSEC2USEC(time.tv_nsec), __VA_ARGS__)
-
-/**
- * Start playback using buffer position api.
- * @param pb Playback helper function.
- */
-static void play(playback_t *pb)
-{
-	assert(pb);
-	assert(pb->device);
-	pb->buffer.write_ptr = pb->buffer.base;
-	printf("Playing: %dHz, %s, %d channel(s).\n", pb->f.sampling_rate,
-	    pcm_sample_format_str(pb->f.sample_format), pb->f.channels);
-	usec_t work_time = 50000; /* 50 ms */
-	bool started = false;
-	size_t pos = 0;
-	struct timespec time = { 0 };
-	getuptime(&time);
-	while (true) {
-		size_t available = buffer_avail(pb, pos);
-		/*
-		 * Writing might need wrap around the end,
-		 * read directly to device buffer
-		 */
-		size_t bytes = fread(pb->buffer.write_ptr, sizeof(uint8_t),
-		    min(available, buffer_remain(pb)), pb->source);
-		buffer_advance(pb, bytes);
-		DPRINTF("POS %zu: %zu bytes free in buffer, read %zu, wp %zu\n",
-		    pos, available, bytes,
-		    pb->buffer.write_ptr - pb->buffer.base);
-		available -= bytes;
-
-		/* continue if we wrapped around the end */
-		if (available) {
-			bytes = fread(pb->buffer.write_ptr,
-			    sizeof(uint8_t), min(available, buffer_remain(pb)),
-			    pb->source);
-			buffer_advance(pb, bytes);
-			DPRINTF("POS %zu: %zu bytes still free in buffer, "
-			    "read %zu, wp %zu\n", pos, available, bytes,
-			    pb->buffer.write_ptr - pb->buffer.base);
-			available -= bytes;
-		}
-
-		if (!started) {
-			errno_t ret = audio_pcm_start_playback(pb->device,
-			    pb->f.channels, pb->f.sampling_rate,
-			    pb->f.sample_format);
-			if (ret != EOK) {
-				printf("Failed to start playback: %s\n",
-				    str_error(ret));
-				return;
-			}
-			started = true;
-			ret = audio_pcm_get_buffer_pos(pb->device, &pos);
-			if (ret != EOK) {
-				printf("Failed to update position indicator "
-				    "%s\n", str_error(ret));
-			}
-		}
-		const size_t to_play = buffer_occupied(pb, pos);
-		const usec_t usecs = pcm_format_size_to_usec(to_play, &pb->f);
-
-		/* Compute delay time */
-		const usec_t real_delay = (usecs > work_time) ?
-		    usecs - work_time : 0;
-		DPRINTF("POS %zu: %lld usecs (%lld) to play %zu bytes.\n",
-		    pos, usecs, real_delay, to_play);
-		if (real_delay)
-			fibril_usleep(real_delay);
-		/* update buffer position */
-		const errno_t ret = audio_pcm_get_buffer_pos(pb->device, &pos);
-		if (ret != EOK) {
-			printf("Failed to update position indicator %s\n",
-			    str_error(ret));
-		}
-		getuptime(&time);
-
-		/*
-		 * we did not use all the space we had,
-		 * that is the end
-		 */
-		if (available)
-			break;
-
-	}
-	audio_pcm_stop_playback_immediate(pb->device);
-}
-
-/**
- * Play audio file usign direct device access.
- * @param device The device.
- * @param file The file.
- * @return 0 on success, non-zero on failure.
- */
-int dplay(const char *device, const char *file)
-{
-	errno_t ret = EOK;
-	audio_pcm_sess_t *session = NULL;
-	if (str_cmp(device, "default") == 0) {
-		session = audio_pcm_open_default();
-	} else {
-		session = audio_pcm_open(device);
-	}
-	if (!session) {
-		printf("Failed to connect to device %s.\n", device);
-		return 1;
-	}
-	printf("Playing on device: %s.\n", device);
-	sysarg_t val;
-	ret = audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK, &val);
-	if (ret != EOK || !val) {
-		printf("Device %s does not support playback\n", device);
-		ret = ENOTSUP;
-		goto close_session;
-	}
-
-	char *info = NULL;
-	ret = audio_pcm_get_info_str(session, &info);
-	if (ret != EOK) {
-		printf("Failed to get PCM info: %s.\n", str_error(ret));
-		goto close_session;
-	}
-	printf("Playing on %s.\n", info);
-	free(info);
-
-	playback_t pb;
-	playback_initialize(&pb, session);
-
-	ret = audio_pcm_get_buffer(pb.device, &pb.buffer.base, &pb.buffer.size);
-	if (ret != EOK) {
-		printf("Failed to get PCM buffer: %s.\n", str_error(ret));
-		goto close_session;
-	}
-	printf("Buffer: %p %zu.\n", pb.buffer.base, pb.buffer.size);
-
-	pb.source = fopen(file, "rb");
-	if (pb.source == NULL) {
-		ret = ENOENT;
-		printf("Failed to open file: %s.\n", file);
-		goto cleanup;
-	}
-
-	wave_header_t header;
-	fread(&header, sizeof(header), 1, pb.source);
-	const char *error;
-	ret = wav_parse_header(&header, NULL, NULL,
-	    &pb.f.channels, &pb.f.sampling_rate, &pb.f.sample_format, &error);
-	if (ret != EOK) {
-		printf("Error parsing wav header: %s.\n", error);
-		goto cleanup;
-	}
-	ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS, &val);
-	if (ret == EOK && val) {
-		play(&pb);
-	} else {
-		ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT, &val);
-		if (ret == EOK && val)
-			play_fragment(&pb);
-		else
-			printf("Neither playing method is supported");
-	}
-
-cleanup:
-	fclose(pb.source);
-	as_area_destroy(pb.buffer.base);
-	audio_pcm_release_buffer(pb.device);
-close_session:
-	audio_pcm_close(session);
-	return ret == EOK ? 0 : 1;
-}
-/**
- * @}
- */
Index: pace/app/wavplay/dplay.h
===================================================================
--- uspace/app/wavplay/dplay.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup wavplay
- * @{
- */
-/** @file
- * @brief .wav file format.
- */
-#ifndef DPLAY_H
-#define DPLAY_H
-
-int dplay(const char *device, const char *file);
-
-#endif
-/**
- * @}
- */
Index: pace/app/wavplay/drec.c
===================================================================
--- uspace/app/wavplay/drec.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup wavplay
- * @{
- */
-/**
- * @file PCM playback audio devices
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fibril.h>
-#include <str_error.h>
-#include <audio_pcm_iface.h>
-#include <pcm/format.h>
-#include <stdio.h>
-#include <as.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include "wave.h"
-#include "drec.h"
-
-#define BUFFER_PARTS   16
-
-/** Recording format */
-static const pcm_format_t format = {
-	.sampling_rate = 44100,
-	.channels = 2,
-	.sample_format = PCM_SAMPLE_SINT16_LE,
-};
-
-/** Recording helper structure */
-typedef struct {
-	struct {
-		void *base;
-		size_t size;
-		unsigned id;
-		void *position;
-	} buffer;
-	FILE *file;
-	audio_pcm_sess_t *device;
-} record_t;
-
-/**
- * Initialize recording helper structure.
- * @param rec Recording structure.
- * @param sess Session to IPC device.
- */
-static void record_initialize(record_t *rec, audio_pcm_sess_t *sess)
-{
-	assert(sess);
-	assert(rec);
-	rec->buffer.base = NULL;
-	rec->buffer.size = 0;
-	rec->buffer.position = NULL;
-	rec->file = NULL;
-	rec->device = sess;
-}
-
-/** Recording callback.
- *
- * Writes recorded data.
- *
- * @param icall Pointer to IPC call structure.
- * @param arg   Argument. Pointer to recording helper structure.
- *
- */
-static void device_event_callback(ipc_call_t *icall, void *arg)
-{
-	record_t *rec = arg;
-	const size_t buffer_part = rec->buffer.size / BUFFER_PARTS;
-	bool record = true;
-
-	while (record) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		switch (ipc_get_imethod(&call)) {
-		case PCM_EVENT_CAPTURE_TERMINATED:
-			printf("Recording terminated\n");
-			record = false;
-			break;
-		case PCM_EVENT_FRAMES_CAPTURED:
-			printf("%" PRIun " frames\n", ipc_get_arg1(&call));
-			break;
-		default:
-			printf("Unknown event %" PRIun ".\n", ipc_get_imethod(&call));
-			async_answer_0(&call, ENOTSUP);
-			continue;
-		}
-
-		if (!record) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		/* Write directly from device buffer to file */
-		const size_t bytes = fwrite(rec->buffer.position,
-		    sizeof(uint8_t), buffer_part, rec->file);
-		printf("%zu ", bytes);
-		rec->buffer.position += buffer_part;
-
-		if (rec->buffer.position >= (rec->buffer.base + rec->buffer.size))
-			rec->buffer.position = rec->buffer.base;
-		async_answer_0(&call, EOK);
-	}
-}
-
-/**
- * Start fragment based recording.
- * @param rec Recording helper structure.
- * @param f PCM format
- */
-static void record_fragment(record_t *rec, pcm_format_t f)
-{
-	assert(rec);
-	assert(rec->device);
-	errno_t ret = audio_pcm_register_event_callback(rec->device,
-	    device_event_callback, rec);
-	if (ret != EOK) {
-		printf("Failed to register for events: %s.\n", str_error(ret));
-		return;
-	}
-	rec->buffer.position = rec->buffer.base;
-	printf("Recording: %dHz, %s, %d channel(s).\n", f.sampling_rate,
-	    pcm_sample_format_str(f.sample_format), f.channels);
-	const unsigned frames =
-	    pcm_format_size_to_frames(rec->buffer.size / BUFFER_PARTS, &f);
-	ret = audio_pcm_start_capture_fragment(rec->device,
-	    frames, f.channels, f.sampling_rate, f.sample_format);
-	if (ret != EOK) {
-		printf("Failed to start recording: %s.\n", str_error(ret));
-		return;
-	}
-
-	getchar();
-	printf("\n");
-	audio_pcm_stop_capture(rec->device);
-	/* XXX Control returns even before we can be sure callbacks finished */
-	printf("Delay before playback termination\n");
-	fibril_usleep(1000000);
-	printf("Terminate playback\n");
-}
-
-/**
- * Record directly from a device to a file.
- * @param device The device.
- * @param file The file.
- * @return 0 on succes, non-zero on failure.
- */
-int drecord(const char *device, const char *file)
-{
-	errno_t ret = EOK;
-	audio_pcm_sess_t *session = NULL;
-	sysarg_t val;
-	if (str_cmp(device, "default") == 0) {
-		session = audio_pcm_open_default();
-	} else {
-		session = audio_pcm_open(device);
-	}
-	if (!session) {
-		printf("Failed to connect to device %s.\n", device);
-		return 1;
-	}
-	printf("Recording on device: %s.\n", device);
-	ret = audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE, &val);
-	if (ret != EOK || !val) {
-		printf("Device %s does not support recording\n", device);
-		ret = ENOTSUP;
-		goto close_session;
-	}
-
-	char *info = NULL;
-	ret = audio_pcm_get_info_str(session, &info);
-	if (ret != EOK) {
-		printf("Failed to get PCM info.\n");
-		goto close_session;
-	}
-	printf("Capturing on %s.\n", info);
-	free(info);
-
-	record_t rec;
-	record_initialize(&rec, session);
-
-	ret = audio_pcm_get_buffer(rec.device, &rec.buffer.base,
-	    &rec.buffer.size);
-	if (ret != EOK) {
-		printf("Failed to get PCM buffer: %s.\n", str_error(ret));
-		goto close_session;
-	}
-	printf("Buffer: %p %zu.\n", rec.buffer.base, rec.buffer.size);
-
-	rec.file = fopen(file, "w");
-	if (rec.file == NULL) {
-		ret = ENOENT;
-		printf("Failed to open file: %s.\n", file);
-		goto cleanup;
-	}
-
-	wave_header_t header;
-	fseek(rec.file, sizeof(header), SEEK_SET);
-	if (ret != EOK) {
-		printf("Error parsing wav header\n");
-		goto cleanup;
-	}
-	ret = audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT, &val);
-	if (ret == EOK && val)
-		record_fragment(&rec, format);
-	else
-		printf("Recording method is not supported");
-	//TODO consider buffer position interface
-
-	wav_init_header(&header, format, ftell(rec.file) - sizeof(header));
-	fseek(rec.file, 0, SEEK_SET);
-	fwrite(&header, sizeof(header), 1, rec.file);
-
-cleanup:
-	fclose(rec.file);
-	as_area_destroy(rec.buffer.base);
-	audio_pcm_release_buffer(rec.device);
-close_session:
-	audio_pcm_close(session);
-	return ret == EOK ? 0 : 1;
-}
-/**
- * @}
- */
Index: pace/app/wavplay/drec.h
===================================================================
--- uspace/app/wavplay/drec.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup wavplay
- * @{
- */
-/** @file
- * @brief .wav file format.
- */
-#ifndef DREC_H
-#define DREC_H
-
-int drecord(const char *device, const char *file);
-
-#endif
-/**
- * @}
- */
Index: pace/app/wavplay/main.c
===================================================================
--- uspace/app/wavplay/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,368 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup wavplay
- * @{
- */
-/**
- * @file PCM playback audio devices
- */
-
-#include <assert.h>
-#include <stdatomic.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <hound/client.h>
-#include <pcm/sample_format.h>
-#include <getopt.h>
-
-#include "dplay.h"
-#include "drec.h"
-#include "wave.h"
-
-#define READ_SIZE   (32 * 1024)
-#define STREAM_BUFFER_SIZE   (64 * 1024)
-
-/**
- * Play audio file using a new stream on provided context.
- * @param ctx Provided context.
- * @param filename File to play.
- * @return Error code.
- */
-static errno_t hplay_ctx(hound_context_t *ctx, const char *filename)
-{
-	printf("Hound context playback: %s\n", filename);
-	FILE *source = fopen(filename, "rb");
-	if (!source) {
-		printf("Failed to open file %s\n", filename);
-		return EINVAL;
-	}
-
-	/* Read and parse WAV header */
-	wave_header_t header;
-	size_t read = fread(&header, sizeof(header), 1, source);
-	if (read != 1) {
-		printf("Failed to read WAV header: %zu\n", read);
-		fclose(source);
-		return EIO;
-	}
-	pcm_format_t format;
-	const char *error;
-	errno_t ret = wav_parse_header(&header, NULL, NULL, &format.channels,
-	    &format.sampling_rate, &format.sample_format, &error);
-	if (ret != EOK) {
-		printf("Error parsing `%s' wav header: %s.\n", filename, error);
-		fclose(source);
-		return EINVAL;
-	}
-
-	printf("File `%s' format: %u channel(s), %uHz, %s.\n", filename,
-	    format.channels, format.sampling_rate,
-	    pcm_sample_format_str(format.sample_format));
-
-	/* Allocate buffer and create new context */
-	char *buffer = malloc(READ_SIZE);
-	if (!buffer) {
-		fclose(source);
-		return ENOMEM;
-	}
-	hound_stream_t *stream = hound_stream_create(ctx,
-	    HOUND_STREAM_DRAIN_ON_EXIT, format, STREAM_BUFFER_SIZE);
-
-	/* Read and play */
-	while ((read = fread(buffer, sizeof(char), READ_SIZE, source)) > 0) {
-		ret = hound_stream_write(stream, buffer, read);
-		if (ret != EOK) {
-			printf("Failed to write to hound stream: %s\n",
-			    str_error(ret));
-			break;
-		}
-	}
-
-	/* Cleanup */
-	free(buffer);
-	fclose(source);
-	return ret;
-}
-
-/**
- * Play audio file via hound server.
- * @param filename File to play.
- * @return Error code
- */
-static errno_t hplay(const char *filename, const char *target)
-{
-	printf("Hound playback: %s\n", filename);
-	FILE *source = fopen(filename, "rb");
-	if (!source) {
-		printf("Failed to open file %s\n", filename);
-		return EINVAL;
-	}
-
-	/* Read and parse WAV header */
-	wave_header_t header;
-	size_t read = fread(&header, sizeof(header), 1, source);
-	if (read != 1) {
-		printf("Failed to read WAV header: %zu\n", read);
-		fclose(source);
-		return EIO;
-	}
-	pcm_format_t format;
-	const char *error;
-	errno_t ret = wav_parse_header(&header, NULL, NULL, &format.channels,
-	    &format.sampling_rate, &format.sample_format, &error);
-	if (ret != EOK) {
-		printf("Error parsing `%s' wav header: %s.\n", filename, error);
-		fclose(source);
-		return EINVAL;
-	}
-	printf("File `%s' format: %u channel(s), %uHz, %s.\n", filename,
-	    format.channels, format.sampling_rate,
-	    pcm_sample_format_str(format.sample_format));
-
-	/* Connect new playback context */
-	hound_context_t *hound = hound_context_create_playback(filename,
-	    format, STREAM_BUFFER_SIZE);
-	if (!hound) {
-		printf("Failed to create HOUND context\n");
-		fclose(source);
-		return ENOMEM;
-	}
-
-	ret = hound_context_connect_target(hound, target);
-	if (ret != EOK) {
-		printf("Failed to connect to target '%s': %s\n", target,
-		    str_error(ret));
-
-		char **names = NULL;
-		size_t count = 0;
-		ret = hound_context_get_available_targets(hound, &names, &count);
-		if (ret == EOK) {
-			printf("Available targets:\n");
-			for (size_t i = 0; i < count; i++)
-				printf(" - %s\n", names[i]);
-		}
-
-		hound_context_destroy(hound);
-		fclose(source);
-		return ret;
-	}
-
-	/* Read and play */
-	static char buffer[READ_SIZE];
-	while ((read = fread(buffer, sizeof(char), READ_SIZE, source)) > 0) {
-		ret = hound_write_main_stream(hound, buffer, read);
-		if (ret != EOK) {
-			printf("Failed to write to main context stream: %s\n",
-			    str_error(ret));
-			break;
-		}
-	}
-
-	/* Cleanup */
-	hound_context_destroy(hound);
-	fclose(source);
-	return ret;
-}
-
-/**
- * Helper structure for playback in separate fibrils
- */
-typedef struct {
-	hound_context_t *ctx;
-	atomic_int *count;
-	const char *file;
-} fib_play_t;
-
-/**
- * Fibril playback wrapper.
- * @param arg Argument, pointer to playback helper structure.
- * @return Error code.
- */
-static errno_t play_wrapper(void *arg)
-{
-	assert(arg);
-	fib_play_t *p = arg;
-	const errno_t ret = hplay_ctx(p->ctx, p->file);
-	atomic_fetch_sub(p->count, 1);
-	free(arg);
-	return ret;
-}
-
-/**
- * Array of supported commandline options
- */
-static const struct option opts[] = {
-	{ "device", required_argument, 0, 'd' },
-	{ "parallel", no_argument, 0, 'p' },
-	{ "record", no_argument, 0, 'r' },
-	{ "target", required_argument, 0, 't' },
-	{ "help", no_argument, 0, 'h' },
-	{ 0, 0, 0, 0 }
-};
-
-/**
- * Print usage help.
- * @param name Name of the program.
- */
-static void print_help(const char *name)
-{
-	printf("Usage: %s [options] file [files...]\n", name);
-	printf("supported options:\n");
-	printf("\t -h, --help\t Print this help.\n");
-	printf("\t -r, --record\t Start recording instead of playback. "
-	    "(Not implemented)\n");
-	printf("\t -d, --device\t Direct output to specified device instead of "
-	    "the sound service. Use location path or a special device `default'\n");
-	printf("\t -t, --target\t Output to the specified audio target.\n");
-	printf("\t -p, --parallel\t Play given files in parallel instead of "
-	    "sequentially (does not work with -d).\n");
-}
-
-int main(int argc, char *argv[])
-{
-	const char *device = "default";
-	const char *target = HOUND_DEFAULT_TARGET;
-	int idx = 0;
-	bool direct = false, record = false, parallel = false;
-	optind = 0;
-	int ret = 0;
-
-	/* Parse command line options */
-	while (ret != -1) {
-		ret = getopt_long(argc, argv, "d:prt:h", opts, &idx);
-		switch (ret) {
-		case 'd':
-			direct = true;
-			device = optarg;
-			break;
-		case 'r':
-			record = true;
-			break;
-		case 'p':
-			parallel = true;
-			break;
-		case 't':
-			target = optarg;
-			break;
-		case 'h':
-			print_help(*argv);
-			return 0;
-		}
-	}
-
-	if (parallel && direct) {
-		printf("Parallel playback is available only if using sound "
-		    "server (no -d)\n");
-		print_help(*argv);
-		return 1;
-	}
-
-	if (optind == argc) {
-		printf("Not enough arguments.\n");
-		print_help(*argv);
-		return 1;
-	}
-
-	/* Init parallel playback variables */
-	hound_context_t *hound_ctx = NULL;
-	atomic_int playcount = 0;
-
-	/* Init parallel playback context if necessary */
-	if (parallel) {
-		hound_ctx = hound_context_create_playback("wavplay",
-		    AUDIO_FORMAT_DEFAULT, STREAM_BUFFER_SIZE);
-		if (!hound_ctx) {
-			printf("Failed to create global hound context\n");
-			return 1;
-		}
-		const errno_t ret = hound_context_connect_target(hound_ctx,
-		    HOUND_DEFAULT_TARGET);
-		if (ret != EOK) {
-			printf("Failed to connect hound context to default "
-			    "target.\n");
-			hound_context_destroy(hound_ctx);
-			return 1;
-		}
-	}
-
-	/* play or record all files */
-	for (int i = optind; i < argc; ++i) {
-		const char *file = argv[i];
-
-		printf("%s (%d/%d) %s\n", record ? "Recording" : "Playing",
-		    i - optind + 1, argc - optind, file);
-		if (record) {
-			if (direct) {
-				drecord(device, file);
-				continue;
-			} else {
-				printf("Indirect recording is not supported "
-				    "yet.\n");
-				break;
-			}
-		}
-
-		if (direct) {
-			dplay(device, file);
-		} else {
-			if (parallel) {
-				/* Start new fibril for parallel playback */
-				fib_play_t *data = malloc(sizeof(fib_play_t));
-				if (!data) {
-					printf("Playback of %s failed.\n",
-					    file);
-					continue;
-				}
-				data->file = file;
-				data->count = &playcount;
-				data->ctx = hound_ctx;
-				fid_t fid = fibril_create(play_wrapper, data);
-				atomic_fetch_add(&playcount, 1);
-				fibril_add_ready(fid);
-			} else {
-				hplay(file, target);
-			}
-		}
-	}
-
-	/* Wait for all fibrils to finish */
-	while (atomic_load(&playcount) > 0)
-		fibril_usleep(1000000);
-
-	/* Destroy parallel playback context, if initialized */
-	if (hound_ctx)
-		hound_context_destroy(hound_ctx);
-	return 0;
-}
-/**
- * @}
- */
Index: pace/app/wavplay/meson.build
===================================================================
--- uspace/app/wavplay/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv', 'hound', 'pcm' ]
-src = files(
-	'dplay.c',
-	'drec.c',
-	'main.c',
-	'wave.c',
-)
-
-if install_nonessential_data
-	# TODO: install this file somewhere sane
-	installed_data += { 'name': 'demo.wav', 'dir': '/' }
-endif
Index: pace/app/wavplay/wave.c
===================================================================
--- uspace/app/wavplay/wave.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup wavplay
- * @{
- */
-/**
- * @file PCM playback audio devices
- */
-
-#include <byteorder.h>
-#include <str.h>
-#include <errno.h>
-
-#include "wave.h"
-
-/**
- * Parse wav header data.
- * @param[in] hdata Header data to parse.
- * @param[out] data Pointer to audio data.
- * @param[out] data_size Size of the data after the header.
- * @param[out] channels Number of channels in stored audio format.
- * @param[out] sampling_rate Sampling rate of the store data.
- * @param[out] format Sample format.
- * @param[out] error String representatoin of error, if any.
- * @return Error code.
- *
- * Does sanity checks and endian conversion.
- */
-errno_t wav_parse_header(const void *hdata, const void **data, size_t *data_size,
-    unsigned *channels, unsigned *sampling_rate, pcm_sample_format_t *format,
-    const char **error)
-{
-	if (!hdata) {
-		if (error)
-			*error = "no header";
-		return EINVAL;
-	}
-
-	const wave_header_t *header = hdata;
-	if (str_lcmp(header->chunk_id, CHUNK_ID, 4) != 0) {
-		if (error)
-			*error = "invalid chunk id";
-		return EINVAL;
-	}
-
-	if (str_lcmp(header->format, FORMAT_STR, 4) != 0) {
-		if (error)
-			*error = "invalid format string";
-		return EINVAL;
-	}
-
-	if (str_lcmp(header->subchunk1_id, SUBCHUNK1_ID, 4) != 0) {
-		if (error)
-			*error = "invalid subchunk1 id";
-		return EINVAL;
-	}
-
-	if (uint32_t_le2host(header->subchunk1_size) != PCM_SUBCHUNK1_SIZE) {
-		//TODO subchunk 1 sizes other than 16 are allowed ( 18, 40)
-		//http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/WAVE/WAVE.html
-		if (error)
-			*error = "invalid subchunk1 size";
-		return EINVAL;
-	}
-
-	if (uint16_t_le2host(header->audio_format) != FORMAT_LINEAR_PCM) {
-		if (error)
-			*error = "unknown format";
-		return ENOTSUP;
-	}
-
-	if (str_lcmp(header->subchunk2_id, SUBCHUNK2_ID, 4) != 0) {
-		//TODO basedd on subchunk1 size, we might be reading wrong
-		//offset
-		if (error)
-			*error = "invalid subchunk2 id";
-		return EINVAL;
-	}
-
-	//TODO data and data_size are incorrect in extended wav formats
-	//pcm params are OK
-	if (data)
-		*data = header->data;
-	if (data_size)
-		*data_size = uint32_t_le2host(header->subchunk2_size);
-
-	if (sampling_rate)
-		*sampling_rate = uint32_t_le2host(header->sampling_rate);
-	if (channels)
-		*channels = uint16_t_le2host(header->channels);
-	if (format) {
-		const unsigned size = uint16_t_le2host(header->sample_size);
-		switch (size) {
-		case 8:
-			*format = PCM_SAMPLE_UINT8;
-			break;
-		case 16:
-			*format = PCM_SAMPLE_SINT16_LE;
-			break;
-		case 24:
-			*format = PCM_SAMPLE_SINT24_LE;
-			break;
-		case 32:
-			*format = PCM_SAMPLE_SINT32_LE;
-			break;
-		default:
-			*error = "Unknown format";
-			return ENOTSUP;
-		}
-	}
-	if (error)
-		*error = "no error";
-
-	return EOK;
-}
-
-/**
- * Initialize wave fromat ehader structure.
- * @param header Structure to initialize.
- * @param format Desired PCM format
- * @param size Size of the stored data.
- *
- * Initializes format specific elements and covnerts endian
- */
-void wav_init_header(wave_header_t *header, pcm_format_t format, size_t size)
-{
-	assert(header);
-#define COPY_STR(dst, src)   memcpy(dst, src, str_size(src))
-
-	COPY_STR(&header->chunk_id, CHUNK_ID);
-	COPY_STR(&header->format, FORMAT_STR);
-	COPY_STR(&header->subchunk1_id, SUBCHUNK1_ID);
-	header->subchunk1_size = host2uint16_t_le(PCM_SUBCHUNK1_SIZE);
-	header->audio_format = host2uint16_t_le(FORMAT_LINEAR_PCM);
-
-	COPY_STR(&header->subchunk2_id, SUBCHUNK2_ID);
-	header->subchunk2_size = host2uint32_t_le(size);
-	header->sampling_rate = host2uint32_t_le(format.sampling_rate);
-	header->channels = host2uint32_t_le(format.channels);
-	header->sample_size =
-	    host2uint16_t_le(pcm_sample_format_size(format.sample_format) * 8);
-}
-/**
- * @}
- */
Index: pace/app/wavplay/wave.h
===================================================================
--- uspace/app/wavplay/wave.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup wavplay
- * @{
- */
-/** @file
- * @brief .wav file format.
- */
-#ifndef WAVE_H
-#define WAVE_H
-
-#include <stdint.h>
-#include <pcm/format.h>
-#include <pcm/sample_format.h>
-
-/** Wave file header format.
- *
- * https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
- * @note: 8-bit samples are stored as unsigned bytes,
- * 16-bit samples are stored as signed integers.
- * @note: The default byte ordering assumed for WAVE data files is
- * little-endian. Files written using the big-endian byte ordering scheme have
- * the identifier RIFX instead of RIFF.
- */
-typedef struct wave_header {
-	/** Should be 'R', 'I', 'F', 'F'. */
-	char chunk_id[4];
-#define CHUNK_ID "RIFF"
-
-	/** Total size minus the first 8 bytes */
-	uint32_t chunk_size;
-	/** Should be 'W', 'A', 'V', 'E'. */
-	char format[4];
-#define FORMAT_STR "WAVE"
-
-	/** Should be 'f', 'm', 't', ' '. */
-	char subchunk1_id[4];
-#define SUBCHUNK1_ID "fmt "
-
-	/** Size of the ret of this subchunk. 16 for PCM file. */
-	uint32_t subchunk1_size;
-#define PCM_SUBCHUNK1_SIZE 16
-	/** Format. 1 for Linear PCM */
-	uint16_t audio_format;
-#define FORMAT_LINEAR_PCM 1
-	/** Number of channels. */
-	uint16_t channels;
-	/** Sampling rate. */
-	uint32_t sampling_rate;
-	/** Byte rate. */
-	uint32_t byte_rate;
-	/** Block align. Bytes in one block (samples for all channels). */
-	uint16_t block_align;
-	/** Bits per sample (one channel). */
-	uint16_t sample_size;
-
-	/** Should be 'd', 'a', 't', 'a'. */
-	char subchunk2_id[4];
-#define SUBCHUNK2_ID "data"
-	/** Audio data size. */
-	uint32_t subchunk2_size;
-	/** Audio data. */
-	uint8_t data[];
-
-} wave_header_t;
-
-errno_t wav_parse_header(const void *, const void **, size_t *, unsigned *,
-    unsigned *, pcm_sample_format_t *, const char **);
-
-void wav_init_header(wave_header_t *, pcm_format_t, size_t);
-#endif
-/**
- * @}
- */
Index: pace/app/websrv/doc/doxygroups.h
===================================================================
--- uspace/app/websrv/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup websrv websrv
- * @brief Web server
- * @ingroup apps
- */
Index: pace/app/websrv/meson.build
===================================================================
--- uspace/app/websrv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files('websrv.c')
Index: pace/app/websrv/websrv.c
===================================================================
--- uspace/app/websrv/websrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,490 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup websrv
- * @{
- */
-/**
- * @file Skeletal web server.
- */
-
-#include <errno.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <task.h>
-
-#include <vfs/vfs.h>
-
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/tcp.h>
-
-#include <arg_parse.h>
-#include <macros.h>
-#include <str.h>
-#include <str_error.h>
-
-#define NAME  "websrv"
-
-#define DEFAULT_PORT  8080
-
-#define WEB_ROOT  "/data/web"
-
-/** Buffer for receiving the request. */
-#define BUFFER_SIZE  1024
-
-static void websrv_new_conn(tcp_listener_t *, tcp_conn_t *);
-
-static tcp_listen_cb_t listen_cb = {
-	.new_conn = websrv_new_conn
-};
-
-static tcp_cb_t conn_cb = {
-	.connected = NULL
-};
-
-static uint16_t port = DEFAULT_PORT;
-
-typedef struct {
-	tcp_conn_t *conn;
-
-	char rbuf[BUFFER_SIZE];
-	size_t rbuf_out;
-	size_t rbuf_in;
-
-	char lbuf[BUFFER_SIZE + 1];
-	size_t lbuf_used;
-} recv_t;
-
-static bool verbose = false;
-
-/** Responses to send to client. */
-
-static const char *msg_ok =
-    "HTTP/1.0 200 OK\r\n"
-    "\r\n";
-
-static const char *msg_bad_request =
-    "HTTP/1.0 400 Bad Request\r\n"
-    "\r\n"
-    "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
-    "<html><head>\r\n"
-    "<title>400 Bad Request</title>\r\n"
-    "</head>\r\n"
-    "<body>\r\n"
-    "<h1>Bad Request</h1>\r\n"
-    "<p>The requested URL has bad syntax.</p>\r\n"
-    "</body>\r\n"
-    "</html>\r\n";
-
-static const char *msg_not_found =
-    "HTTP/1.0 404 Not Found\r\n"
-    "\r\n"
-    "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
-    "<html><head>\r\n"
-    "<title>404 Not Found</title>\r\n"
-    "</head>\r\n"
-    "<body>\r\n"
-    "<h1>Not Found</h1>\r\n"
-    "<p>The requested URL was not found on this server.</p>\r\n"
-    "</body>\r\n"
-    "</html>\r\n";
-
-static const char *msg_not_implemented =
-    "HTTP/1.0 501 Not Implemented\r\n"
-    "\r\n"
-    "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
-    "<html><head>\r\n"
-    "<title>501 Not Implemented</title>\r\n"
-    "</head>\r\n"
-    "<body>\r\n"
-    "<h1>Not Implemented</h1>\r\n"
-    "<p>The requested method is not implemented on this server.</p>\r\n"
-    "</body>\r\n"
-    "</html>\r\n";
-
-static errno_t recv_create(tcp_conn_t *conn, recv_t **rrecv)
-{
-	recv_t *recv;
-
-	recv = calloc(1, sizeof(recv_t));
-	if (recv == NULL)
-		return ENOMEM;
-
-	recv->conn = conn;
-	recv->rbuf_out = 0;
-	recv->rbuf_in = 0;
-	recv->lbuf_used = 0;
-
-	*rrecv = recv;
-	return EOK;
-}
-
-static void recv_destroy(recv_t *recv)
-{
-	free(recv);
-}
-
-/** Receive one character (with buffering) */
-static errno_t recv_char(recv_t *recv, char *c)
-{
-	size_t nrecv;
-	errno_t rc;
-
-	if (recv->rbuf_out == recv->rbuf_in) {
-		recv->rbuf_out = 0;
-		recv->rbuf_in = 0;
-
-		rc = tcp_conn_recv_wait(recv->conn, recv->rbuf, BUFFER_SIZE, &nrecv);
-		if (rc != EOK) {
-			fprintf(stderr, "tcp_conn_recv() failed: %s\n", str_error(rc));
-			return rc;
-		}
-
-		recv->rbuf_in = nrecv;
-	}
-
-	*c = recv->rbuf[recv->rbuf_out++];
-	return EOK;
-}
-
-/** Receive one line with length limit */
-static errno_t recv_line(recv_t *recv, char **rbuf)
-{
-	char *bp = recv->lbuf;
-	char c = '\0';
-
-	while (bp < recv->lbuf + BUFFER_SIZE) {
-		char prev = c;
-		errno_t rc = recv_char(recv, &c);
-
-		if (rc != EOK)
-			return rc;
-
-		*bp++ = c;
-		if ((prev == '\r') && (c == '\n'))
-			break;
-	}
-
-	recv->lbuf_used = bp - recv->lbuf;
-	*bp = '\0';
-
-	if (bp == recv->lbuf + BUFFER_SIZE)
-		return ELIMIT;
-
-	*rbuf = recv->lbuf;
-	return EOK;
-}
-
-static bool uri_is_valid(char *uri)
-{
-	if (uri[0] != '/')
-		return false;
-
-	if (uri[1] == '.')
-		return false;
-
-	char *cp = uri + 1;
-
-	while (*cp != '\0') {
-		char c = *cp++;
-		if (c == '/')
-			return false;
-	}
-
-	return true;
-}
-
-static errno_t send_response(tcp_conn_t *conn, const char *msg)
-{
-	size_t response_size = str_size(msg);
-
-	if (verbose)
-		fprintf(stderr, "Sending response\n");
-
-	errno_t rc = tcp_conn_send(conn, (void *) msg, response_size);
-	if (rc != EOK) {
-		fprintf(stderr, "tcp_conn_send() failed\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t uri_get(const char *uri, tcp_conn_t *conn)
-{
-	char *fbuf = NULL;
-	char *fname = NULL;
-	errno_t rc;
-	size_t nr;
-	int fd = -1;
-
-	fbuf = calloc(BUFFER_SIZE, 1);
-	if (fbuf == NULL) {
-		rc = ENOMEM;
-		goto out;
-	}
-
-	if (str_cmp(uri, "/") == 0)
-		uri = "/index.html";
-
-	if (asprintf(&fname, "%s%s", WEB_ROOT, uri) < 0) {
-		rc = ENOMEM;
-		goto out;
-	}
-
-	rc = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
-		rc = send_response(conn, msg_not_found);
-		goto out;
-	}
-
-	free(fname);
-	fname = NULL;
-
-	rc = send_response(conn, msg_ok);
-	if (rc != EOK)
-		goto out;
-
-	aoff64_t pos = 0;
-	while (true) {
-		rc = vfs_read(fd, &pos, fbuf, BUFFER_SIZE, &nr);
-		if (rc != EOK)
-			goto out;
-
-		if (nr == 0)
-			break;
-
-		rc = tcp_conn_send(conn, fbuf, nr);
-		if (rc != EOK) {
-			fprintf(stderr, "tcp_conn_send() failed\n");
-			goto out;
-		}
-	}
-
-	rc = EOK;
-out:
-	if (fd >= 0)
-		vfs_put(fd);
-	free(fname);
-	free(fbuf);
-	return rc;
-}
-
-static errno_t req_process(tcp_conn_t *conn, recv_t *recv)
-{
-	char *reqline = NULL;
-
-	errno_t rc = recv_line(recv, &reqline);
-	if (rc != EOK) {
-		fprintf(stderr, "recv_line() failed\n");
-		return rc;
-	}
-
-	if (verbose)
-		fprintf(stderr, "Request: %s", reqline);
-
-	if (str_lcmp(reqline, "GET ", 4) != 0) {
-		rc = send_response(conn, msg_not_implemented);
-		return rc;
-	}
-
-	char *uri = reqline + 4;
-	char *end_uri = str_chr(uri, ' ');
-	if (end_uri == NULL) {
-		end_uri = reqline + str_size(reqline) - 2;
-		assert(*end_uri == '\r');
-	}
-
-	*end_uri = '\0';
-	if (verbose)
-		fprintf(stderr, "Requested URI: %s\n", uri);
-
-	if (!uri_is_valid(uri)) {
-		rc = send_response(conn, msg_bad_request);
-		return rc;
-	}
-
-	return uri_get(uri, conn);
-}
-
-static void usage(void)
-{
-	printf("Simple web server\n"
-	    "\n"
-	    "Usage: " NAME " [options]\n"
-	    "\n"
-	    "Where options are:\n"
-	    "-p port_number | --port=port_number\n"
-	    "\tListening port (default " STRING(DEFAULT_PORT) ").\n"
-	    "\n"
-	    "-h | --help\n"
-	    "\tShow this application help.\n"
-	    "-v | --verbose\n"
-	    "\tVerbose mode\n");
-}
-
-static errno_t parse_option(int argc, char *argv[], int *index)
-{
-	int value;
-	errno_t rc;
-
-	switch (argv[*index][1]) {
-	case 'h':
-		usage();
-		exit(0);
-		break;
-	case 'p':
-		rc = arg_parse_int(argc, argv, index, &value, 0);
-		if (rc != EOK)
-			return rc;
-
-		port = (uint16_t) value;
-		break;
-	case 'v':
-		verbose = true;
-		break;
-	case '-':
-		/* Long options with double dash */
-		if (str_lcmp(argv[*index] + 2, "help", 5) == 0) {
-			usage();
-			exit(0);
-		} else if (str_lcmp(argv[*index] + 2, "port=", 5) == 0) {
-			rc = arg_parse_int(argc, argv, index, &value, 7);
-			if (rc != EOK)
-				return rc;
-
-			port = (uint16_t) value;
-		} else if (str_cmp(argv[*index] + 2, "verbose") == 0) {
-			verbose = true;
-		} else {
-			usage();
-			return EINVAL;
-		}
-		break;
-	default:
-		usage();
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-static void websrv_new_conn(tcp_listener_t *lst, tcp_conn_t *conn)
-{
-	errno_t rc;
-	recv_t *recv = NULL;
-
-	if (verbose)
-		fprintf(stderr, "New connection, waiting for request\n");
-
-	rc = recv_create(conn, &recv);
-	if (rc != EOK) {
-		fprintf(stderr, "Out of memory.\n");
-		goto error;
-	}
-
-	rc = req_process(conn, recv);
-	if (rc != EOK) {
-		fprintf(stderr, "Error processing request (%s)\n",
-		    str_error(rc));
-		goto error;
-	}
-
-	rc = tcp_conn_send_fin(conn);
-	if (rc != EOK) {
-		fprintf(stderr, "Error sending FIN.\n");
-		goto error;
-	}
-
-	recv_destroy(recv);
-	return;
-error:
-	rc = tcp_conn_reset(conn);
-	if (rc != EOK)
-		fprintf(stderr, "Error resetting connection.\n");
-
-	recv_destroy(recv);
-}
-
-int main(int argc, char *argv[])
-{
-	inet_ep_t ep;
-	tcp_listener_t *lst;
-	tcp_t *tcp;
-	errno_t rc;
-
-	/* Parse command line arguments */
-	for (int i = 1; i < argc; i++) {
-		if (argv[i][0] == '-') {
-			rc = parse_option(argc, argv, &i);
-			if (rc != EOK)
-				return rc;
-		} else {
-			usage();
-			return EINVAL;
-		}
-	}
-
-	printf("%s: HelenOS web server\n", NAME);
-
-	if (verbose)
-		fprintf(stderr, "Creating listener\n");
-
-	inet_ep_init(&ep);
-	ep.port = port;
-
-	rc = tcp_create(&tcp);
-	if (rc != EOK) {
-		fprintf(stderr, "Error initializing TCP.\n");
-		return 1;
-	}
-
-	rc = tcp_listener_create(tcp, &ep, &listen_cb, NULL, &conn_cb, NULL,
-	    &lst);
-	if (rc != EOK) {
-		fprintf(stderr, "Error creating listener.\n");
-		return 2;
-	}
-
-	fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n",
-	    NAME, port);
-
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/app/wifi_supplicant/meson.build
===================================================================
--- uspace/app/wifi_supplicant/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2015 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('wifi_supplicant.c')
Index: pace/app/wifi_supplicant/wifi_supplicant.c
===================================================================
--- uspace/app/wifi_supplicant/wifi_supplicant.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,327 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup nic
- * @{
- */
-/** @file WiFi device configuration utility.
- *
- */
-
-#include <ieee80211_iface.h>
-
-#include <inet/inetcfg.h>
-#include <inet/dhcp.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <loc.h>
-
-#define NAME  "wifi_supplicant"
-
-#define enum_name(name_arr, i) \
-	((i < 0) ? "NA" : name_arr[i])
-
-static const char *ieee80211_security_type_strs[] = {
-	"OPEN", "WEP", "WPA", "WPA2"
-};
-
-static const char *ieee80211_security_alg_strs[] = {
-	"WEP40", "WEP104", "CCMP", "TKIP"
-};
-
-static const char *ieee80211_security_auth_strs[] = {
-	"PSK", "8021X"
-};
-
-static void print_syntax(void)
-{
-	printf("syntax:\n");
-	printf("\t" NAME " [<cmd> [<args...>]]\n");
-	printf("\t<cmd> is:\n");
-	printf("\tlist - list wifi devices in <index>: <name> format\n");
-	printf("\tscan <index> [-n] - output scan results (force scan "
-	    "immediately)\n");
-	printf("\tconnect <index> <ssid_prefix> [<password>] - connect to "
-	    "network\n");
-	printf("\tdisconnect <index> - disconnect from network\n");
-}
-
-static void nic_addr_format(nic_address_t *addr, char *out, size_t out_size)
-{
-	snprintf(out, out_size, "%02x:%02x:%02x:%02x:%02x:%02x",
-	    addr->address[0], addr->address[1], addr->address[2],
-	    addr->address[3], addr->address[4], addr->address[5]);
-}
-
-static errno_t get_wifi_list(service_id_t **wifis, size_t *count)
-{
-	category_id_t wifi_cat;
-	errno_t rc = loc_category_get_id("ieee80211", &wifi_cat, 0);
-	if (rc != EOK) {
-		printf("Error resolving category 'ieee80211'.\n");
-		return rc;
-	}
-
-	rc = loc_category_get_svcs(wifi_cat, wifis, count);
-	if (rc != EOK) {
-		printf("Error getting list of WIFIs.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static async_sess_t *get_wifi_by_index(size_t i)
-{
-	service_id_t *wifis = NULL;
-	size_t count;
-
-	errno_t rc = get_wifi_list(&wifis, &count);
-	if (rc != EOK) {
-		printf("Error fetching wifi list.\n");
-		return NULL;
-	}
-
-	if (i >= count) {
-		printf("Invalid wifi index.\n");
-		free(wifis);
-		return NULL;
-	}
-
-	async_sess_t *sess =
-	    loc_service_connect(wifis[i], INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf("Error connecting to service.\n");
-		free(wifis);
-		return NULL;
-	}
-
-	return sess;
-}
-
-static errno_t wifi_list(void)
-{
-	service_id_t *wifis = NULL;
-	size_t count;
-
-	errno_t rc = get_wifi_list(&wifis, &count);
-	if (rc != EOK) {
-		printf("Error fetching wifi list: %s\n", str_error(rc));
-		return EINVAL;
-	}
-
-	printf("[Index]: [Service Name]\n");
-	for (size_t i = 0; i < count; i++) {
-		char *svc_name;
-		rc = loc_service_get_name(wifis[i], &svc_name);
-		if (rc != EOK) {
-			printf("Error getting service name: %s\n", str_error(rc));
-			free(wifis);
-			return rc;
-		}
-
-		printf("%zu: %s\n", i, svc_name);
-
-		free(svc_name);
-	}
-
-	return EOK;
-}
-
-static errno_t wifi_connect(uint32_t index, char *ssid_start, char *password)
-{
-	assert(ssid_start);
-
-	async_sess_t *sess = get_wifi_by_index(index);
-	if (sess == NULL) {
-		printf("Specified WIFI doesn't exist or cannot connect to "
-		    "it.\n");
-		return EINVAL;
-	}
-
-	errno_t rc = ieee80211_disconnect(sess);
-	if (rc != EOK) {
-		if (rc == EREFUSED)
-			printf("Device is not ready yet.\n");
-		else
-			printf("Error when disconnecting device: %s\n",
-			    str_error(rc));
-
-		return rc;
-	}
-
-	rc = ieee80211_connect(sess, ssid_start, password);
-	if (rc != EOK) {
-		if (rc == EREFUSED)
-			printf("Device is not ready yet.\n");
-		else if (rc == ETIMEOUT)
-			printf("Timeout when authenticating to network.\n");
-		else if (rc == ENOENT)
-			printf("Given SSID not in scan results.\n");
-		else
-			printf("Error when connecting to network: %s\n",
-			    str_error(rc));
-
-		return rc;
-	}
-
-	// TODO: Wait for DHCP address?
-
-	printf("Successfully connected to network!\n");
-
-	return EOK;
-}
-
-static errno_t wifi_disconnect(uint32_t index)
-{
-	async_sess_t *sess = get_wifi_by_index(index);
-	if (sess == NULL) {
-		printf("Specified WIFI doesn't exist or cannot connect to "
-		    "it.\n");
-		return EINVAL;
-	}
-
-	errno_t rc = ieee80211_disconnect(sess);
-	if (rc != EOK) {
-		if (rc == EREFUSED)
-			printf("Device is not ready yet.\n");
-		else if (rc == EINVAL)
-			printf("Not connected to any WiFi network.\n");
-		else
-			printf("Error when disconnecting from network: %s\n",
-			    str_error(rc));
-
-		return rc;
-	}
-
-	printf("Successfully disconnected.\n");
-
-	return EOK;
-}
-
-static errno_t wifi_scan(uint32_t index, bool now)
-{
-	async_sess_t *sess = get_wifi_by_index(index);
-	if (sess == NULL) {
-		printf("Specified WIFI doesn't exist or cannot connect to "
-		    "it.\n");
-		return EINVAL;
-	}
-
-	ieee80211_scan_results_t scan_results;
-	errno_t rc = ieee80211_get_scan_results(sess, &scan_results, now);
-	if (rc != EOK) {
-		if (rc == EREFUSED)
-			printf("Device is not ready yet.\n");
-		else
-			printf("Failed to fetch scan results: %s\n",
-			    str_error(rc));
-
-		return rc;
-	}
-
-	if (scan_results.length == 0)
-		return EOK;
-
-	printf("%16.16s %17s %4s %5s %5s %7s %7s\n",
-	    "SSID", "MAC", "CHAN", "TYPE", "AUTH", "UNI-ALG", "GRP-ALG");
-
-	for (uint8_t i = 0; i < scan_results.length; i++) {
-		ieee80211_scan_result_t result = scan_results.results[i];
-		char mac_addr_hex[18];
-		nic_addr_format(&result.bssid, mac_addr_hex, 18);
-
-		printf("%16.16s %17s %4d %5s %5s %7s %7s\n",
-		    result.ssid, mac_addr_hex,
-		    result.channel,
-		    enum_name(ieee80211_security_type_strs, result.security.type),
-		    enum_name(ieee80211_security_auth_strs, result.security.auth),
-		    enum_name(ieee80211_security_alg_strs, result.security.pair_alg),
-		    enum_name(ieee80211_security_alg_strs, result.security.group_alg));
-	}
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc = inetcfg_init();
-	if (rc != EOK) {
-		printf("%s: Failed connecting to inetcfg service: %s.\n",
-		    NAME, str_error(rc));
-		return 1;
-	}
-
-	rc = dhcp_init();
-	if (rc != EOK) {
-		printf("%s: Failed connecting to dhcp service: %s.\n",
-		    NAME, str_error(rc));
-		return 1;
-	}
-
-	if (argc == 2) {
-		if (!str_cmp(argv[1], "list"))
-			return wifi_list();
-	} else if (argc > 2) {
-		uint32_t index;
-		rc = str_uint32_t(argv[2], NULL, 10, false, &index);
-		if (rc != EOK) {
-			printf("%s: Invalid argument.\n", NAME);
-			print_syntax();
-			return EINVAL;
-		}
-
-		if (!str_cmp(argv[1], "scan")) {
-			bool now = false;
-			if (argc > 3)
-				if (!str_cmp(argv[3], "-n"))
-					now = true;
-
-			return wifi_scan(index, now);
-		} else if (!str_cmp(argv[1], "connect")) {
-			char *pass = NULL;
-			if (argc > 3) {
-				if (argc > 4)
-					pass = argv[4];
-
-				return wifi_connect(index, argv[3], pass);
-			}
-		} else if (!str_cmp(argv[1], "disconnect"))
-			return wifi_disconnect(index);
-	}
-
-	print_syntax();
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/dist/data/web/bar.html
===================================================================
--- uspace/dist/data/web/bar.html	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<html>
-    <head>
-	<title>Bar!</title>
-    </head>
-    <body>
-	<h1>Bar!</h1>
-
-	<a href="/">Back to top</a>
-    </body>
-</html>
Index: pace/dist/data/web/foo.html
===================================================================
--- uspace/dist/data/web/foo.html	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<html>
-    <head>
-	<title>Foo!</title>
-    </head>
-    <body>
-	<h1>Foo!</h1>
-
-	<a href="/">Back to top</a>
-    </body>
-</html>
Index: pace/dist/data/web/index.html
===================================================================
--- uspace/dist/data/web/index.html	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,19 +1,0 @@
-<html>
-    <head>
-        <title>
-    	    Hello from HelenOS!
-        </title>
-    </head>
-    <body>
-        <h1>Hello from HelenOS!</h1>
-        <img src="helenos.png" alt="" style="float: left; margin: 6px;">
-        <p>
-            This web page is brought to you by courtesy of HelenOS web server
-    	    and TCP/IP stack.
-        </p>
-	<p>
-    	    Now <a href="foo.html">go to page foo</a> or <a href="bar.html">go
-    	    to bar</a>.
-        </p>
-    </body>
-</html>
Index: pace/dist/src/bithenge/basic.bh
===================================================================
--- uspace/dist/src/bithenge/basic.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-transform main = struct {
-	.u8 <- uint8;
-	.u16le <- uint16le;
-	.u16be <- uint16be;
-	.u32le <- uint32le;
-	.u32be <- uint32be;
-	.u64le <- uint64le;
-	.u64be <- uint64be;
-	.empty_blob <- known_length(0);
-	.ascii <- ascii <- known_length(8);
-};
Index: pace/dist/src/bithenge/basic.dat
===================================================================
--- uspace/dist/src/bithenge/basic.dat	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-ªðð!CeeC!þÜºvT22TvºÜþ0~
-\"'	
Index: pace/dist/src/bithenge/basic.out
===================================================================
--- uspace/dist/src/bithenge/basic.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-{
-    "u8": 170,
-    "u16le": 4080,
-    "u16be": 4080,
-    "u32le": 2271560481,
-    "u32be": 2271560481,
-    "u64le": 1167088121787636990,
-    "u64be": 1167088121787636990,
-    "empty_blob": b"",
-    "ascii": "0~\u000a\\\"'\u0009\u001b"
-}
Index: pace/dist/src/bithenge/bits.bh
===================================================================
--- uspace/dist/src/bithenge/bits.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-transform main = struct {
-	.bits_le <- repeat(8) { bit } <- bits_le <- known_length(1);
-	.bits_be <- repeat(8) { bit } <- bits_be <- known_length(1);
-	<- struct {
-		.le0 <- uint_le(0);
-		.le1 <- uint_le(1);
-		.le2 <- uint_le(2);
-		.le3 <- uint_le(3);
-		.le4 <- uint_le(4);
-		.le5 <- uint_le(5);
-		.le6 <- uint_le(6);
-		.le7 <- uint_le(7);
-		.le8 <- uint_le(8);
-
-		.be8 <- uint_be(8);
-		.be7 <- uint_be(7);
-		.be6 <- uint_be(6);
-		.be5 <- uint_be(5);
-		.be4 <- uint_be(4);
-		.be3 <- uint_be(3);
-		.be2 <- uint_be(2);
-		.be1 <- uint_be(1);
-		.be0 <- uint_be(0);
-	} <- bits_be <- known_length(9);
-};
Index: pace/dist/src/bithenge/bits.dat
===================================================================
--- uspace/dist/src/bithenge/bits.dat	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-ee¤BB%
Index: pace/dist/src/bithenge/bits.out
===================================================================
--- uspace/dist/src/bithenge/bits.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-{
-    "bits_le": {
-        0: True,
-        1: False,
-        2: True,
-        3: False,
-        4: False,
-        5: True,
-        6: True,
-        7: False
-    },
-    "bits_be": {
-        0: False,
-        1: True,
-        2: True,
-        3: False,
-        4: False,
-        5: True,
-        6: False,
-        7: True
-    },
-    "le0": 0,
-    "le1": 1,
-    "le2": 2,
-    "le3": 4,
-    "le4": 8,
-    "le5": 16,
-    "le6": 32,
-    "le7": 64,
-    "le8": 128,
-    "be8": 128,
-    "be7": 64,
-    "be6": 32,
-    "be5": 16,
-    "be4": 8,
-    "be3": 4,
-    "be2": 2,
-    "be1": 1,
-    "be0": 0
-}
Index: pace/dist/src/bithenge/cond.bh
===================================================================
--- uspace/dist/src/bithenge/cond.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-transform pascal_string = struct {
-	<- struct { # An inner struct for testing purposes
-		.len <- uint8;
-	};
-	.string <- ascii <- known_length(.len);
-};
-
-transform u32(little_endian) =
-	if (little_endian) {
-		uint32le
-	} else {
-		uint32be
-	};
-
-transform item(little_endian, len) = struct {
-	.type <- (3 * in + 1) <- u32(little_endian);
-	.name <- pascal_string;
-	switch (.type) {
-		10: {
-			.val <- u32(little_endian);
-		};
-		11: {
-			.text <- ascii <- known_length(len);
-		};
-		else: {
-			.unknown <- known_length(len);
-		};
-	}
-};
-
-transform main() = struct {
-	.first_len <- (3);
-	.second_len <- (6 - 2);
-	.first_item <- item(true, .first_len);
-	.second_item <- item(false, .second_len);
-};
Index: pace/dist/src/bithenge/cond.out
===================================================================
--- uspace/dist/src/bithenge/cond.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,20 +1,0 @@
-{
-    "first_len": 3,
-    "second_len": 4,
-    "first_item": {
-        "type": 52,
-        "name": {
-            "len": 6,
-            "string": "Item 1"
-        },
-        "unknown": b"\xcf\x80\x78"
-    },
-    "second_item": {
-        "type": 10,
-        "name": {
-            "len": 6,
-            "string": "Item 2"
-        },
-        "val": 12345
-    }
-}
Index: pace/dist/src/bithenge/expression.bh
===================================================================
--- uspace/dist/src/bithenge/expression.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-transform compare_ints(a, b) = struct {
-	.l <- (a < b);
-	.g <- (a > b);
-	.ge <- (a >= b);
-	.le <- (a <= b);
-	.eq <- (a == b);
-	.ne <- (a != b);
-};
-
-transform arithmetic(a, b) = struct {
-	.sum <- (a + b);
-	.difference <- (a - b);
-	.product <- (a * b);
-	if (b > 0) {
-		.quotient <- (a // b);
-		.remainder <- (a % b);
-	}
-};
-
-transform concat_bits(a, b) = uint_le(24) <- (in.concat_bits) <- struct {
-	.bits0 <- bits_le <- (a);
-	.bits1 <- bits_be <- (b);
-	.concat_bits <- (.bits0 ++ (.bits1 ++ .bits0));
-};
-
-transform equality(bytes0, bytes1, str0, str1) = struct {
-	.neqs <- ((0 != 1) != (2 != 3));
-	.bytes0_eq_bytes1 <- (bytes0 == bytes1);
-	.bytes0_ne_bytes0 <- (bytes0 != bytes0);
-	.str0_ne_str1 <- (str0 != str1);
-	.str1_eq_str1 <- (str1 == str1);
-	.bytes1_eq_1 <- (bytes1 == 1);
-};
-
-transform subblob(bytes0) = struct {
-	.subblob <- (bytes0[0:][0,1][0:1]);
-};
-
-transform main = struct {
-	.bytes0 <- known_length(1);
-	.bytes1 <- known_length(1);
-	.str0 <- ascii <- (.bytes0);
-	.str1 <- ascii <- (.bytes1);
-	.compare_ints_0_1 <- compare_ints(0, 1);
-	.compare_ints_0_0 <- compare_ints(0, 0);
-	.compare_ints_1_0 <- compare_ints(1, 0);
-	.arithmetic_0_1 <- arithmetic(0, 1);
-	.arithmetic_17_n3 <- arithmetic(17, 0 - 3);
-	.arithmetic_n17_3 <- arithmetic(0 - 17, 3);
-	.concat_bytes <- (.bytes0 ++ (.bytes1 ++ .bytes0));
-	.concat_bits <- concat_bits(.bytes0, .bytes1);
-	.equality <- equality(.bytes0, .bytes1, .str0, .str1);
-	.subblob <- subblob(.bytes0);
-};
Index: pace/dist/src/bithenge/expression.dat
===================================================================
--- uspace/dist/src/bithenge/expression.dat	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-17
Index: pace/dist/src/bithenge/expression.out
===================================================================
--- uspace/dist/src/bithenge/expression.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-{
-    "bytes0": b"\x31",
-    "bytes1": b"\x37",
-    "str0": "1",
-    "str1": "7",
-    "compare_ints_0_1": {
-        "l": True,
-        "g": False,
-        "ge": False,
-        "le": True,
-        "eq": False,
-        "ne": True
-    },
-    "compare_ints_0_0": {
-        "l": False,
-        "g": False,
-        "ge": True,
-        "le": True,
-        "eq": True,
-        "ne": False
-    },
-    "compare_ints_1_0": {
-        "l": False,
-        "g": True,
-        "ge": True,
-        "le": False,
-        "eq": False,
-        "ne": True
-    },
-    "arithmetic_0_1": {
-        "sum": 1,
-        "difference": -1,
-        "product": 0,
-        "quotient": 0,
-        "remainder": 0
-    },
-    "arithmetic_17_n3": {
-        "sum": 14,
-        "difference": 20,
-        "product": -51
-    },
-    "arithmetic_n17_3": {
-        "sum": -14,
-        "difference": -20,
-        "product": -51,
-        "quotient": -6,
-        "remainder": 1
-    },
-    "concat_bytes": b"\x31\x37\x31",
-    "concat_bits": 3271729,
-    "equality": {
-        "neqs": False,
-        "bytes0_eq_bytes1": False,
-        "bytes0_ne_bytes0": False,
-        "str0_ne_str1": True,
-        "str1_eq_str1": True,
-        "bytes1_eq_1": False
-    },
-    "subblob": {
-        "subblob": b"\x31"
-    }
-}
Index: pace/dist/src/bithenge/fat.bh
===================================================================
--- uspace/dist/src/bithenge/fat.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# FAT filesystem script.
-# Largely based on https://en.wikipedia.org/wiki/File_Allocation_Table
-# Currently only FAT12 and FAT16 are supported.
-
-transform u8 = uint8;
-transform u16 = uint16le;
-transform u32 = uint32le;
-
-transform fat_attributes = struct {
-	.read_only <- bit;
-	.hidden <- bit;
-	.system <- bit;
-	.volume_label <- bit;
-	.subdirectory <- bit;
-	.archive <- bit;
-	.device <- bit;
-	.reserved <- bit;
-} <- bits_le <- known_length(1);
-
-transform file_data(data, bits, fat, cluster_size, start) = (in.data) <- struct {
-	.cluster <- (data[(start-2)*cluster_size, cluster_size]);
-	.last_cluster_number <- switch (bits) {
-		12: (488);       # 0x00000ff8
-		16: (65528);     # 0x0000fff8
-		32: (268435448); # 0x0ffffff8
-	};
-	.next <- (fat[start]);
-	if (.next == 0 || .next >= .last_cluster_number) {
-		.data <- (.cluster);
-	} else {
-		.rest <- file_data(data, bits, fat, cluster_size, .next) <- known_length(0);
-		.data <- (.cluster ++ .rest);
-	}
-};
-
-transform fat_dir_entry(data, bits, fat, cluster_size, self_start, parent) = struct {
-	.filename <- known_length(8);
-	.extension <- known_length(3);
-	.attrs <- fat_attributes;
-	.flags <- u8;
-	.ctime_fine <- u8;
-	.ctime <- u16;
-	.cdate <- u16;
-	.adate <- u16;
-	.permissions <- u16;
-	.mtime <- u16;
-	.mdate <- u16;
-	.start <- u16;
-	.size <- u32;
-	.size_shown <- if (.size > 32) { (32) } else { (.size) };
-
-	if (.start != 0 && .start != self_start && .start != parent && .filename[0] != 229) {
-		.data
-		    <- if (.attrs.subdirectory) {
-		        repeat { fat_dir_entry(data, bits, fat, cluster_size, .start, self_start) }
-		    } else {
-		        (in[0,.size_shown])
-		    }
-		    <- if (.size != 0) { (in[0,.size]) } else { (in) }
-		    <- file_data(data, bits, fat, cluster_size, .start);
-	}
-};
-
-transform fat_table(bits, num_clusters) = switch (bits) {
-	12: partial {repeat(num_clusters) { uint_le(12) }} <- bits_le;
-	16: partial {repeat(num_clusters) { u16 }};
-	32: partial {repeat(num_clusters) { u32 }};
-};
-
-transform fat_super(disk) = struct {
-	.jump_instruction <- known_length(3);
-	.oem_name <- ascii <- known_length(8);
-
-	# DOS 2.0 BPB
-	.bytes_per_sector <- u16; # must be power of two, at least 32
-	.sectors_per_cluster <- u8; # must be power of two
-	.num_reserved_sectors <- u16;
-	.num_fats <- u8; # at least 1
-	.num_root_entries <- u16; # 0 for FAT32
-	.num_sectors_16 <- u16;
-	.media_descriptor <- u8;
-	.sectors_per_fat <- u16; # 0 for FAT32
-
-	# DOS 3.0/3.2/3.31 BPB
-	.sectors_per_track <- u16;
-	.num_heads <- u16;
-
-	# DOS 3.31 BPB
-	.bpb331 <- struct {
-		.ignore <- nonzero_boolean <- (.num_sectors_16);
-		.num_hidden_sectors <- u32;
-		.num_sectors_32 <- u32;
-	};
-
-	.drive_number <- u8;
-	.chkdsk_flags <- u8;
-	.extended_boot_signature <- u8;
-	if (.extended_boot_signature == 41) {
-		.volume_id <- u32;
-		.volume_label <- ascii <- known_length(11);
-		.type <- ascii <- known_length(8);
-	}
-
-	.boot_signature <- (disk[510,2]); # b"\x55\xaa"; TODO: what if .bytes_per_sector < 512?
-};
-
-transform fat_filesystem_tree(disk) = struct {
-	.super <- partial{fat_super(disk)} <- (disk);
-
-	.num_sectors <- if (.super.bpb331.ignore) {
-		(.super.num_sectors_16)
-	} else {
-		(.super.bpb331.num_sectors_32)
-	};
-
-	.cluster_size <- (.super.sectors_per_cluster * .super.bytes_per_sector);
-	.first_root_sector <- (.super.num_reserved_sectors + .super.num_fats * .super.sectors_per_fat);
-	.first_data_sector <- (.first_root_sector +
-	    (.super.num_root_entries * 32 + .super.bytes_per_sector - 1) //
-	    .super.bytes_per_sector);
-	.num_clusters <- (2 + (.num_sectors - .first_data_sector) // .super.sectors_per_cluster);
-	.bits <- if (.num_clusters < 4085) { (12) }
-	    else { if (.num_clusters < 65525) { (16) } else { (32) } };
-
-	.fats <- partial(.super.num_reserved_sectors * .super.bytes_per_sector) {
-		repeat(.super.num_fats) {
-			fat_table(.bits, .num_clusters) <-
-				known_length(.super.sectors_per_fat * .super.bytes_per_sector)
-		}
-	} <- (disk);
-
-	.root <- partial(.first_root_sector * .super.bytes_per_sector) {
-		repeat(.super.num_root_entries) {
-			fat_dir_entry(disk[.first_data_sector * .super.bytes_per_sector:],
-			    .bits, .fats[0], .cluster_size, 0, 0)
-		}
-	} <- (disk);
-};
-
-transform fat_filesystem = partial {fat_filesystem_tree(in)};
-
-transform main = fat_filesystem;
Index: pace/dist/src/bithenge/fat.out
===================================================================
--- uspace/dist/src/bithenge/fat.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,908 +1,0 @@
-{
-    "super": {
-        "jump_instruction": b"\xeb\x3c\x90",
-        "oem_name": "mkdosfs",
-        "bytes_per_sector": 512,
-        "sectors_per_cluster": 1,
-        "num_reserved_sectors": 1,
-        "num_fats": 1,
-        "num_root_entries": 16,
-        "num_sectors_16": 66,
-        "media_descriptor": 248,
-        "sectors_per_fat": 1,
-        "sectors_per_track": 32,
-        "num_heads": 64,
-        "bpb331": {
-            "ignore": True,
-            "num_hidden_sectors": 0,
-            "num_sectors_32": 0
-        },
-        "drive_number": 0,
-        "chkdsk_flags": 0,
-        "extended_boot_signature": 41,
-        "volume_id": 1045880152,
-        "volume_label": "Test       ",
-        "type": "FAT12   ",
-        "boot_signature": b"\x55\xaa"
-    },
-    "num_sectors": 66,
-    "cluster_size": 512,
-    "first_root_sector": 2,
-    "first_data_sector": 3,
-    "num_clusters": 65,
-    "bits": 12,
-    "fats": {
-        0: {
-            0: 4088,
-            1: 4095,
-            2: 0,
-            3: 4095,
-            4: 0,
-            5: 0,
-            6: 0,
-            7: 0,
-            8: 0,
-            9: 0,
-            10: 0,
-            11: 0,
-            12: 0,
-            13: 0,
-            14: 0,
-            15: 0,
-            16: 0,
-            17: 0,
-            18: 0,
-            19: 0,
-            20: 0,
-            21: 0,
-            22: 0,
-            23: 0,
-            24: 0,
-            25: 0,
-            26: 0,
-            27: 0,
-            28: 0,
-            29: 0,
-            30: 0,
-            31: 0,
-            32: 0,
-            33: 0,
-            34: 0,
-            35: 0,
-            36: 0,
-            37: 38,
-            38: 4095,
-            39: 0,
-            40: 0,
-            41: 0,
-            42: 0,
-            43: 0,
-            44: 0,
-            45: 0,
-            46: 0,
-            47: 0,
-            48: 0,
-            49: 0,
-            50: 0,
-            51: 0,
-            52: 0,
-            53: 0,
-            54: 0,
-            55: 0,
-            56: 0,
-            57: 0,
-            58: 0,
-            59: 0,
-            60: 0,
-            61: 0,
-            62: 0,
-            63: 0,
-            64: 0
-        }
-    },
-    "root": {
-        0: {
-            "filename": b"\x54\x65\x73\x74\x20\x20\x20\x20",
-            "extension": b"\x20\x20\x20",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": True,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 35030,
-            "cdate": 16658,
-            "adate": 16658,
-            "permissions": 0,
-            "mtime": 35030,
-            "mdate": 16658,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        1: {
-            "filename": b"\x41\x73\x00\x75\x00\x62\x00\x64",
-            "extension": b"\x00\x69\x00",
-            "attrs": {
-                "read_only": True,
-                "hidden": True,
-                "system": True,
-                "volume_label": True,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 173,
-            "ctime": 114,
-            "cdate": 0,
-            "adate": 65535,
-            "permissions": 65535,
-            "mtime": 65535,
-            "mdate": 65535,
-            "start": 0,
-            "size": 4294967295,
-            "size_shown": 32
-        },
-        2: {
-            "filename": b"\x53\x55\x42\x44\x49\x52\x20\x20",
-            "extension": b"\x20\x20\x20",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": True,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 100,
-            "ctime": 43267,
-            "cdate": 16658,
-            "adate": 16658,
-            "permissions": 0,
-            "mtime": 43290,
-            "mdate": 16658,
-            "start": 3,
-            "size": 0,
-            "size_shown": 0,
-            "data": {
-                0: {
-                    "filename": b"\x2e\x20\x20\x20\x20\x20\x20\x20",
-                    "extension": b"\x20\x20\x20",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": True,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 100,
-                    "ctime": 43236,
-                    "cdate": 16658,
-                    "adate": 16658,
-                    "permissions": 0,
-                    "mtime": 43236,
-                    "mdate": 16658,
-                    "start": 3,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                1: {
-                    "filename": b"\x2e\x2e\x20\x20\x20\x20\x20\x20",
-                    "extension": b"\x20\x20\x20",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": True,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 100,
-                    "ctime": 43236,
-                    "cdate": 16658,
-                    "adate": 16658,
-                    "permissions": 0,
-                    "mtime": 43236,
-                    "mdate": 16658,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                2: {
-                    "filename": b"\xe5\x2e\x00\x66\x00\x69\x00\x6c",
-                    "extension": b"\x00\x65\x00",
-                    "attrs": {
-                        "read_only": True,
-                        "hidden": True,
-                        "system": True,
-                        "volume_label": True,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 103,
-                    "ctime": 46,
-                    "cdate": 116,
-                    "adate": 120,
-                    "permissions": 116,
-                    "mtime": 46,
-                    "mdate": 115,
-                    "start": 0,
-                    "size": 7340151,
-                    "size_shown": 32
-                },
-                3: {
-                    "filename": b"\xe5\x49\x4c\x45\x54\x58\x7e\x31",
-                    "extension": b"\x53\x57\x50",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": True,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 43287,
-                    "cdate": 16658,
-                    "adate": 16658,
-                    "permissions": 0,
-                    "mtime": 43287,
-                    "mdate": 16658,
-                    "start": 13,
-                    "size": 12288,
-                    "size_shown": 32
-                },
-                4: {
-                    "filename": b"\x41\x66\x00\x69\x00\x6c\x00\x65",
-                    "extension": b"\x00\x2e\x00",
-                    "attrs": {
-                        "read_only": True,
-                        "hidden": True,
-                        "system": True,
-                        "volume_label": True,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 25,
-                    "ctime": 116,
-                    "cdate": 120,
-                    "adate": 116,
-                    "permissions": 0,
-                    "mtime": 65535,
-                    "mdate": 65535,
-                    "start": 0,
-                    "size": 4294967295,
-                    "size_shown": 32
-                },
-                5: {
-                    "filename": b"\x46\x49\x4c\x45\x20\x20\x20\x20",
-                    "extension": b"\x54\x58\x54",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": True,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 43290,
-                    "cdate": 16658,
-                    "adate": 16658,
-                    "permissions": 0,
-                    "mtime": 43290,
-                    "mdate": 16658,
-                    "start": 37,
-                    "size": 951,
-                    "size_shown": 32,
-                    "data": b"\x22\x4a\x61\x62\x62\x65\x72\x77\x6f\x63\x6b\x79\x22\x0a\x0a\x27\x54\x77\x61\x73\x20\x62\x72\x69\x6c\x6c\x69\x67\x2c\x20\x61\x6e"
-                },
-                6: {
-                    "filename": b"\xe5\x2e\x00\x66\x00\x69\x00\x6c",
-                    "extension": b"\x00\x65\x00",
-                    "attrs": {
-                        "read_only": True,
-                        "hidden": True,
-                        "system": True,
-                        "volume_label": True,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 111,
-                    "ctime": 46,
-                    "cdate": 116,
-                    "adate": 120,
-                    "permissions": 116,
-                    "mtime": 46,
-                    "mdate": 115,
-                    "start": 0,
-                    "size": 7864439,
-                    "size_shown": 32
-                },
-                7: {
-                    "filename": b"\xe5\x49\x4c\x45\x54\x58\x7e\x31",
-                    "extension": b"\x53\x57\x58",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": True,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 100,
-                    "ctime": 43267,
-                    "cdate": 16658,
-                    "adate": 16658,
-                    "permissions": 0,
-                    "mtime": 43267,
-                    "mdate": 16658,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                8: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                9: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                10: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                11: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                12: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                13: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                14: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                },
-                15: {
-                    "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-                    "extension": b"\x00\x00\x00",
-                    "attrs": {
-                        "read_only": False,
-                        "hidden": False,
-                        "system": False,
-                        "volume_label": False,
-                        "subdirectory": False,
-                        "archive": False,
-                        "device": False,
-                        "reserved": False
-                    },
-                    "flags": 0,
-                    "ctime_fine": 0,
-                    "ctime": 0,
-                    "cdate": 0,
-                    "adate": 0,
-                    "permissions": 0,
-                    "mtime": 0,
-                    "mdate": 0,
-                    "start": 0,
-                    "size": 0,
-                    "size_shown": 0
-                }
-            }
-        },
-        3: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        4: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        5: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        6: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        7: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        8: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        9: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        10: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        11: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        12: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        13: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        14: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        },
-        15: {
-            "filename": b"\x00\x00\x00\x00\x00\x00\x00\x00",
-            "extension": b"\x00\x00\x00",
-            "attrs": {
-                "read_only": False,
-                "hidden": False,
-                "system": False,
-                "volume_label": False,
-                "subdirectory": False,
-                "archive": False,
-                "device": False,
-                "reserved": False
-            },
-            "flags": 0,
-            "ctime_fine": 0,
-            "ctime": 0,
-            "cdate": 0,
-            "adate": 0,
-            "permissions": 0,
-            "mtime": 0,
-            "mdate": 0,
-            "start": 0,
-            "size": 0,
-            "size_shown": 0
-        }
-    }
-}
Index: pace/dist/src/bithenge/gif/gif.bh
===================================================================
--- uspace/dist/src/bithenge/gif/gif.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-#
-# Copyright (c) 2012 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#
-# Graphics Interchange Format (image/gif)
-#
-
-
-transform chars(len) = ascii <- known_length(len);
-transform word = uint16le;
-
-
-
-transform gif_signature = chars(3);
-
-transform gif_version = chars(3);
-
-transform gif_color_map_entry = struct {
-	.red <- uint8;
-	.green <- uint8;
-	.blue <- uint8;
-};
-
-transform gif_color_map(length) = repeat(length) {
-	gif_color_map_entry
-};
-
-transform gif_color_map_from_bits_per_pixel(bits_per_pixel) = struct {
-	# We need to emulate missing << operator
-	switch (bits_per_pixel) {
-		1: { <- gif_color_map(2); };
-		2: { <- gif_color_map(4); };
-		3: { <- gif_color_map(8); };
-		4: { <- gif_color_map(16); };
-		5: { <- gif_color_map(32); };
-		6: { <- gif_color_map(64); };
-		7: { <- gif_color_map(128); };
-		8: { <- gif_color_map(256); };
-	}
-};
-
-
-# Process GIF data block:
-#  - first byte denotes block size (.length)
-#  - followed by .length bytes of the actual data (not processed here)
-#  - followed by next block or terminator (zero)
-transform generic_data_block = do {
-	struct {
-		.length <- uint8;
-		.has_next <- nonzero_boolean <- (.length);
-		if (.has_next) {
-			.data <- known_length(.length);
-		}
-	}
-} while (.has_next);
-
-
-transform gif_image_block = struct {
-	.left <- word;
-	.top <- word;
-	.width <- word;
-	.height <- word;
-
-	<- struct {
-		.use_local_color_map <- bit;
-		.interlacing <- bit;
-		.reserved_bits <- uint_be(3);
-		.bits_per_pixel <- (in + 1) <- uint_be(3);
-	} <- bits_be <- known_length(1);
-
-	if (.use_local_color_map) {
-		.local_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel);
-	}
-
-	.lzw_initial_size <- uint8;
-	.lzw_data <- generic_data_block;
-};
-
-# TODO: interpret known extensions
-transform gif_extension = struct {
-	.function <- uint8;
-	.data <- generic_data_block;
-};
-
-# Switch over known blocks (image, extensions, end)
-transform gif_block = struct {
-	.kind <- uint8;
-	switch (.kind) {
-		33: { # exclamation mark -> extension block
-			.extension <- gif_extension;
-		};
-		44: { # comma -> image
-			.image <- gif_image_block;
-		};
-		59: { # semicolon -> terminator
-			.after_terminator <- repeat { uint8 };
-		};
-		else: {
-			.unknown <- repeat { uint8 };
-		};
-	}
-};
-
-transform main = struct {
-	.signature <- gif_signature;
-	.version <- gif_version;
-	.width <- word;
-	.height <- word;
-	<- struct {
-		.global_color_map_exists <- bit;
-		.color_resolution <- uint_be(3);
-		.reserved_bit <- uint_be(1);
-		.bits_per_pixel <- (in + 1) <- uint_be(3);
-	} <- bits_be <- known_length(1);
-	.background_color_index <- uint8;
-	.reserved <- uint8;
-	if (.global_color_map_exists) {
-		.global_color_map <- gif_color_map_from_bits_per_pixel(.bits_per_pixel);
-	}
-	.blocks <- repeat {
-		gif_block
-	};
-};
Index: pace/dist/src/bithenge/gif/readme
===================================================================
--- uspace/dist/src/bithenge/gif/readme	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-
-File `loader.gif' was retrieved from
-   http://www.ajaxload.info/
-using default settings.
-
-File `blue_1x1.gif' was generated with ImageMagick using command
-   convert -size 1x1 xc:blue gif87:blue_1x1.gif
-
-File `helenos.gif' is a converted uspace/srv/hid/console/gfx/helenos.tga.
Index: pace/dist/src/bithenge/repeat.bh
===================================================================
--- uspace/dist/src/bithenge/repeat.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,27 +1,0 @@
-transform with_count = struct {
-	.none <- repeat(0) { uint8 };
-	.one <- repeat(1) { uint8 };
-	.count <- uint8;
-	if (true) { # test whether .count is still accessible
-		.many <- repeat(.count) { uint8 };
-	}
-};
-
-transform without_count = struct {
-	.until_error <- repeat { uint8 <- zero_terminated };
-	.until_end <- repeat { uint8 };
-};
-
-transform do_while = do {
-	struct {
-		.valid <- nonzero_boolean <- uint8;
-		.val <- uint8;
-	}
-} while (.valid);
-
-transform main = struct {
-	.with_count <- with_count;
-	.without_count <- without_count <- known_length(9);
-	.do_while <- do_while;
-	.do_while_item <- (.do_while[1]);
-};
Index: pace/dist/src/bithenge/repeat.out
===================================================================
--- uspace/dist/src/bithenge/repeat.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-{
-    "with_count": {
-        "none": {},
-        "one": {
-            0: 127
-        },
-        "count": 7,
-        "many": {
-            0: 2,
-            1: 3,
-            2: 5,
-            3: 7,
-            4: 11,
-            5: 13,
-            6: 17
-        }
-    },
-    "without_count": {
-        "until_error": {
-            0: 2,
-            1: 4,
-            2: 8
-        },
-        "until_end": {
-            0: 16,
-            1: 32,
-            2: 64
-        }
-    },
-    "do_while": {
-        0: {
-            "valid": True,
-            "val": 1
-        },
-        1: {
-            "valid": True,
-            "val": 4
-        },
-        2: {
-            "valid": False,
-            "val": 9
-        }
-    },
-    "do_while_item": {
-        "valid": True,
-        "val": 4
-    }
-}
Index: pace/dist/src/bithenge/test.bdsh
===================================================================
--- uspace/dist/src/bithenge/test.bdsh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-bithenge basic.bh basic.dat | to /tmp/bithenge-test.out
-cmp basic.out /tmp/bithenge-test.out
-
-bithenge bits.bh bits.dat | to /tmp/bithenge-test.out
-cmp bits.out /tmp/bithenge-test.out
-
-bithenge cond.bh cond.dat | to /tmp/bithenge-test.out
-cmp cond.out /tmp/bithenge-test.out
-
-bithenge expression.bh expression.dat | to /tmp/bithenge-test.out
-cmp expression.out /tmp/bithenge-test.out
-
-bithenge fat.bh fat.dat | to /tmp/bithenge-test.out
-cmp fat.out /tmp/bithenge-test.out
-
-bithenge repeat.bh repeat.dat | to /tmp/bithenge-test.out
-cmp repeat.out /tmp/bithenge-test.out
-
-bithenge trip.bh trip.dat | to /tmp/bithenge-test.out
-cmp trip.out /tmp/bithenge-test.out
-
-bithenge usbdesc.bh usbdesc.kbd.dat | to /tmp/bithenge-test.out
-cmp usbdesc.kbd.out /tmp/bithenge-test.out
-
-echo Success
Index: pace/dist/src/bithenge/test.sh
===================================================================
--- uspace/dist/src/bithenge/test.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#!/bin/bash
-shopt -s nullglob
-set -e
-
-BITHENGE=../../../app/bithenge/bithenge
-
-if type valgrind >/dev/null 2>&1
-then
-	BITHENGE="valgrind -q --show-reachable=yes --error-exitcode=64 ${BITHENGE}"
-else
-	echo "Valgrind not found."
-fi
-
-test_file() {
-	echo "Testing $1 on $2..."
-	${BITHENGE} $1 $2 2>&1|diff $3 -
-}
-
-for BH in *.bh
-do
-	for DAT in $(basename ${BH} .bh).dat $(basename ${BH} .bh).*.dat
-	do
-		OUT=$(basename ${DAT} .dat).out
-		[ -e ${DAT} ] || continue
-		[ -e ${OUT} ] || continue
-		test_file ${BH} ${DAT} ${OUT}
-	done
-done
-
-test_file trip.bh file:trip.dat trip.out
-test_file repeat.bh hex:7f07020305070b0D11020004000800102040010101040009 repeat.out
-
-echo "Done!"
Index: pace/dist/src/bithenge/trip.bh
===================================================================
--- uspace/dist/src/bithenge/trip.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-transform point = struct {
-	.lat <- uint32le;
-	.lon <- uint32le;
-};
-
-transform named_point = struct {
-	.name <- ascii <- zero_terminated;
-	<- point;
-};
-
-transform main = struct {
-	.from <- named_point;
-	.to <- named_point;
-	.distance <- uint32le; # in kilometers
-};
Index: pace/dist/src/bithenge/trip.out
===================================================================
--- uspace/dist/src/bithenge/trip.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-{
-    "from": {
-        "name": "Raleigh",
-        "lat": 36,
-        "lon": 79
-    },
-    "to": {
-        "name": "Denver",
-        "lat": 40,
-        "lon": 105
-    },
-    "distance": 2353
-}
Index: pace/dist/src/bithenge/usbdesc.bh
===================================================================
--- uspace/dist/src/bithenge/usbdesc.bh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-##
-##
-## USB DESCRIPTORS
-##
-##
-
-# Originally by Vojtech Horky.
-
-# Block prefixed with a byte length
-transform block = (in.data) <- struct {
-	.bLength <- uint8;
-	.data <- known_length(.bLength - 1);
-};
-
-# USB configuration descriptor
-# This is not the full configuration descriptor (i.e. with interface
-# and endpoint descriptors included) but only the header.
-transform usb_configuration_descriptor_bare = struct {
-	.wTotalLength <- uint16le;
-	.bNumInterfaces <- uint8;
-	.bConfigurationValue <- uint8;
-	.iConfiguration <- uint8;
-	.bmAttributes <- uint8;
-	.MaxPower <- uint8;
-};
-
-# USB interface descriptor
-transform usb_interface_descriptor = struct {
-	.bInterfaceNumber <- uint8;
-	.bAlternateSetting <- uint8;
-	.bNumEndpoints <- uint8;
-	.bInterfaceClass <- uint8;
-	.bInterfaceSubClass <- uint8;
-	.bInterfaceProtocol <- uint8;
-	.iInterface <- uint8;
-};
-
-# USB endpoint descriptor
-transform usb_endpoint_descriptor = struct {
-	.bEndpointAddress  <- uint8;
-	.bmAttributes <- uint8;
-	.wMaxPacketSize <- uint16le;
-	.bInterval <- uint8;
-};
-
-# USB HID descriptor
-transform usb_hid_descriptor = struct {
-	.bcdHID <- uint16le;
-	.bCountryCode <- uint8;
-	.bNumDescriptors <- uint8;
-	<- repeat(.bNumDescriptors) { struct {
-		.bDescriptorType <- uint8;
-		.wDescriptorLength <- uint16le;
-	} };
-};
-
-# USB descriptor
-transform usb_descriptor = struct {
-	.bDescriptorType <- uint8;
-	<- switch (.bDescriptorType) {
-		 2: usb_configuration_descriptor_bare;
-		 4: usb_interface_descriptor;
-		 5: usb_endpoint_descriptor;
-		33: usb_hid_descriptor;
-	};
-} <- block;
-
-transform main = repeat { usb_descriptor };
Index: pace/dist/src/bithenge/usbdesc.kbd.out
===================================================================
--- uspace/dist/src/bithenge/usbdesc.kbd.out	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-{
-    0: {
-        "bDescriptorType": 2,
-        "wTotalLength": 34,
-        "bNumInterfaces": 1,
-        "bConfigurationValue": 1,
-        "iConfiguration": 8,
-        "bmAttributes": 160,
-        "MaxPower": 50
-    },
-    1: {
-        "bDescriptorType": 4,
-        "bInterfaceNumber": 0,
-        "bAlternateSetting": 0,
-        "bNumEndpoints": 1,
-        "bInterfaceClass": 9,
-        "bInterfaceSubClass": 1,
-        "bInterfaceProtocol": 1,
-        "iInterface": 0
-    },
-    2: {
-        "bDescriptorType": 33,
-        "bcdHID": 273,
-        "bCountryCode": 0,
-        "bNumDescriptors": 1,
-        0: {
-            "bDescriptorType": 34,
-            "wDescriptorLength": 63
-        }
-    },
-    3: {
-        "bDescriptorType": 5,
-        "bEndpointAddress": 129,
-        "bmAttributes": 3,
-        "wMaxPacketSize": 8,
-        "bInterval": 10
-    }
-}
Index: pace/dist/src/c/demos/edit/build
===================================================================
--- uspace/dist/src/c/demos/edit/build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-cc -D__PCC__ -I/inc/c -E -o sheet.i sheet.c
-cc -D__PCC__ -I/inc/c -E -o edit.i edit.c
-cc -D__PCC__ -I/inc/c -E -o search.i search.c
-
-cc -S -o sheet.s sheet.i
-cc -S -o edit.s edit.i
-cc -S -o search.s search.i
-
-as -o sheet.o sheet.s
-as -o edit.o edit.s
-as -o search.o search.s
-
-ld -T /inc/_link.ld -o edit_ sheet.o edit.o search.o /lib/libc.a -lgcc
Index: pace/dist/src/c/demos/edit/clean
===================================================================
--- uspace/dist/src/c/demos/edit/clean	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,14 +1,0 @@
-rm edit_
-
-rm edit.o
-rm sheet.o
-rm search.o
-
-rm edit.s
-rm sheet.s
-rm search.s
-
-rm edit.i
-rm sheet.i
-rm search.i
-
Index: pace/dist/src/c/demos/edit/edit.c
===================================================================
--- uspace/dist/src/c/demos/edit/edit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1724 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @brief Text editor.
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <vfs/vfs.h>
-#include <io/console.h>
-#include <io/style.h>
-#include <io/keycode.h>
-#include <errno.h>
-#include <align.h>
-#include <macros.h>
-#include <clipboard.h>
-#include <types/common.h>
-
-#include "sheet.h"
-#include "search.h"
-
-enum redraw_flags {
-	REDRAW_TEXT	= (1 << 0),
-	REDRAW_ROW	= (1 << 1),
-	REDRAW_STATUS	= (1 << 2),
-	REDRAW_CARET	= (1 << 3)
-};
-
-/** Pane
- *
- * A rectangular area of the screen used to edit a document. Different
- * panes can be possibly used to edit the same document.
- */
-typedef struct {
-	/* Pane dimensions */
-	int rows, columns;
-
-	/* Position of the visible area */
-	int sh_row, sh_column;
-
-	/** Bitmask of components that need redrawing */
-	enum redraw_flags rflags;
-
-	/** Current position of the caret */
-	tag_t caret_pos;
-
-	/** Start of selection */
-	tag_t sel_start;
-
-	/** Active keyboard modifiers */
-	keymod_t keymod;
-
-	/**
-	 * Ideal column where the caret should try to get. This is used
-	 * for maintaining the same column during vertical movement.
-	 */
-	int ideal_column;
-
-	char *previous_search;
-	bool previous_search_reverse;
-} pane_t;
-
-/** Document
- *
- * Associates a sheet with a file where it can be saved to.
- */
-typedef struct {
-	char *file_name;
-	sheet_t *sh;
-} doc_t;
-
-static console_ctrl_t *con;
-static doc_t doc;
-static bool done;
-static pane_t pane;
-static bool cursor_visible;
-
-static sysarg_t scr_rows;
-static sysarg_t scr_columns;
-
-#define ROW_BUF_SIZE 4096
-#define BUF_SIZE 64
-#define TAB_WIDTH 8
-
-/** Maximum filename length that can be entered. */
-#define INFNAME_MAX_LEN 128
-
-static void cursor_show(void);
-static void cursor_hide(void);
-static void cursor_setvis(bool visible);
-
-static void key_handle_press(kbd_event_t *ev);
-static void key_handle_unmod(kbd_event_t const *ev);
-static void key_handle_ctrl(kbd_event_t const *ev);
-static void key_handle_shift(kbd_event_t const *ev);
-static void key_handle_shift_ctrl(kbd_event_t const *ev);
-static void key_handle_movement(unsigned int key, bool shift);
-
-static void pos_handle(pos_event_t *ev);
-
-static errno_t file_save(char const *fname);
-static void file_save_as(void);
-static errno_t file_insert(char *fname);
-static errno_t file_save_range(char const *fname, spt_t const *spos,
-    spt_t const *epos);
-static char *range_get_str(spt_t const *spos, spt_t const *epos);
-
-static char *prompt(char const *prompt, char const *init_value);
-
-static void pane_text_display(void);
-static void pane_row_display(void);
-static void pane_row_range_display(int r0, int r1);
-static void pane_status_display(void);
-static void pane_caret_display(void);
-
-static void insert_char(char32_t c);
-static void delete_char_before(void);
-static void delete_char_after(void);
-static void caret_update(void);
-static void caret_move_relative(int drow, int dcolumn, enum dir_spec align_dir, bool select);
-static void caret_move_absolute(int row, int column, enum dir_spec align_dir, bool select);
-static void caret_move(spt_t spt, bool select, bool update_ideal_column);
-static void caret_move_word_left(bool select);
-static void caret_move_word_right(bool select);
-static void caret_go_to_line_ask(void);
-
-static bool selection_active(void);
-static void selection_sel_all(void);
-static void selection_sel_range(spt_t pa, spt_t pb);
-static void selection_get_points(spt_t *pa, spt_t *pb);
-static void selection_delete(void);
-static void selection_copy(void);
-static void insert_clipboard_data(void);
-
-static void search(char *pattern, bool reverse);
-static void search_prompt(bool reverse);
-static void search_repeat(void);
-
-static void pt_get_sof(spt_t *pt);
-static void pt_get_eof(spt_t *pt);
-static void pt_get_sol(spt_t *cpt, spt_t *spt);
-static void pt_get_eol(spt_t *cpt, spt_t *ept);
-static bool pt_is_word_beginning(spt_t *pt);
-static bool pt_is_delimiter(spt_t *pt);
-static bool pt_is_punctuation(spt_t *pt);
-static spt_t pt_find_word_left(spt_t spt);
-static spt_t pt_find_word_left(spt_t spt);
-
-static int tag_cmp(tag_t const *a, tag_t const *b);
-static int spt_cmp(spt_t const *a, spt_t const *b);
-static int coord_cmp(coord_t const *a, coord_t const *b);
-
-static void status_display(char const *str);
-
-int main(int argc, char *argv[])
-{
-	cons_event_t ev;
-	bool new_file;
-	errno_t rc;
-
-	con = console_init(stdin, stdout);
-	console_clear(con);
-
-	console_get_size(con, &scr_columns, &scr_rows);
-
-	pane.rows = scr_rows - 1;
-	pane.columns = scr_columns;
-	pane.sh_row = 1;
-	pane.sh_column = 1;
-
-	/* Start with an empty sheet. */
-	rc = sheet_create(&doc.sh);
-	if (rc != EOK) {
-		printf("Out of memory.\n");
-		return -1;
-	}
-
-	/* Place caret at the beginning of file. */
-	spt_t sof;
-	pt_get_sof(&sof);
-	sheet_place_tag(doc.sh, &sof, &pane.caret_pos);
-	pane.ideal_column = 1;
-
-	if (argc == 2) {
-		doc.file_name = str_dup(argv[1]);
-	} else if (argc > 1) {
-		printf("Invalid arguments.\n");
-		return -2;
-	} else {
-		doc.file_name = NULL;
-	}
-
-	new_file = false;
-
-	if (doc.file_name == NULL || file_insert(doc.file_name) != EOK)
-		new_file = true;
-
-	/* Place selection start tag. */
-	sheet_place_tag(doc.sh, &sof, &pane.sel_start);
-
-	/* Move to beginning of file. */
-	pt_get_sof(&sof);
-	caret_move(sof, true, true);
-
-	/* Initial display */
-	cursor_visible = true;
-
-	cursor_hide();
-	console_clear(con);
-	pane_text_display();
-	pane_status_display();
-	if (new_file && doc.file_name != NULL)
-		status_display("File not found. Starting empty file.");
-	pane_caret_display();
-	cursor_show();
-
-	done = false;
-
-	while (!done) {
-		console_get_event(con, &ev);
-		pane.rflags = 0;
-
-		switch (ev.type) {
-		case CEV_KEY:
-			pane.keymod = ev.ev.key.mods;
-			if (ev.ev.key.type == KEY_PRESS)
-				key_handle_press(&ev.ev.key);
-			break;
-		case CEV_POS:
-			pos_handle(&ev.ev.pos);
-			break;
-		}
-
-		/* Redraw as necessary. */
-
-		cursor_hide();
-
-		if (pane.rflags & REDRAW_TEXT)
-			pane_text_display();
-		if (pane.rflags & REDRAW_ROW)
-			pane_row_display();
-		if (pane.rflags & REDRAW_STATUS)
-			pane_status_display();
-		if (pane.rflags & REDRAW_CARET)
-			pane_caret_display();
-
-		cursor_show();
-	}
-
-	console_clear(con);
-
-	return 0;
-}
-
-/* Handle key press. */
-static void key_handle_press(kbd_event_t *ev)
-{
-	if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_SHIFT) == 0) &&
-	    (ev->mods & KM_CTRL) != 0) {
-		key_handle_ctrl(ev);
-	} else if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_CTRL) == 0) &&
-	    (ev->mods & KM_SHIFT) != 0) {
-		key_handle_shift(ev);
-	} else if (((ev->mods & KM_ALT) == 0) &&
-	    ((ev->mods & KM_CTRL) != 0) &&
-	    (ev->mods & KM_SHIFT) != 0) {
-		key_handle_shift_ctrl(ev);
-	} else if ((ev->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) {
-		key_handle_unmod(ev);
-	}
-}
-
-static void cursor_show(void)
-{
-	cursor_setvis(true);
-}
-
-static void cursor_hide(void)
-{
-	cursor_setvis(false);
-}
-
-static void cursor_setvis(bool visible)
-{
-	if (cursor_visible != visible) {
-		console_cursor_visibility(con, visible);
-		cursor_visible = visible;
-	}
-}
-
-/** Handle key without modifier. */
-static void key_handle_unmod(kbd_event_t const *ev)
-{
-	switch (ev->key) {
-	case KC_ENTER:
-		selection_delete();
-		insert_char('\n');
-		caret_update();
-		break;
-	case KC_LEFT:
-	case KC_RIGHT:
-	case KC_UP:
-	case KC_DOWN:
-	case KC_HOME:
-	case KC_END:
-	case KC_PAGE_UP:
-	case KC_PAGE_DOWN:
-		key_handle_movement(ev->key, false);
-		break;
-	case KC_BACKSPACE:
-		if (selection_active())
-			selection_delete();
-		else
-			delete_char_before();
-		caret_update();
-		break;
-	case KC_DELETE:
-		if (selection_active())
-			selection_delete();
-		else
-			delete_char_after();
-		caret_update();
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t') {
-			selection_delete();
-			insert_char(ev->c);
-			caret_update();
-		}
-		break;
-	}
-}
-
-/** Handle Shift-key combination. */
-static void key_handle_shift(kbd_event_t const *ev)
-{
-	switch (ev->key) {
-	case KC_LEFT:
-	case KC_RIGHT:
-	case KC_UP:
-	case KC_DOWN:
-	case KC_HOME:
-	case KC_END:
-	case KC_PAGE_UP:
-	case KC_PAGE_DOWN:
-		key_handle_movement(ev->key, true);
-		break;
-	default:
-		if (ev->c >= 32 || ev->c == '\t') {
-			selection_delete();
-			insert_char(ev->c);
-			caret_update();
-		}
-		break;
-	}
-}
-
-/** Handle Ctrl-key combination. */
-static void key_handle_ctrl(kbd_event_t const *ev)
-{
-	spt_t pt;
-	switch (ev->key) {
-	case KC_Q:
-		done = true;
-		break;
-	case KC_S:
-		if (doc.file_name != NULL)
-			file_save(doc.file_name);
-		else
-			file_save_as();
-		break;
-	case KC_E:
-		file_save_as();
-		break;
-	case KC_C:
-		selection_copy();
-		break;
-	case KC_V:
-		selection_delete();
-		insert_clipboard_data();
-		pane.rflags |= REDRAW_TEXT;
-		caret_update();
-		break;
-	case KC_X:
-		selection_copy();
-		selection_delete();
-		pane.rflags |= REDRAW_TEXT;
-		caret_update();
-		break;
-	case KC_A:
-		selection_sel_all();
-		break;
-	case KC_RIGHT:
-		caret_move_word_right(false);
-		break;
-	case KC_LEFT:
-		caret_move_word_left(false);
-		break;
-	case KC_L:
-		caret_go_to_line_ask();
-		break;
-	case KC_F:
-		search_prompt(false);
-		break;
-	case KC_N:
-		search_repeat();
-		break;
-	case KC_HOME:
-		pt_get_sof(&pt);
-		caret_move(pt, false, true);
-		break;
-	case KC_END:
-		pt_get_eof(&pt);
-		caret_move(pt, false, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void key_handle_shift_ctrl(kbd_event_t const *ev)
-{
-	spt_t pt;
-	switch (ev->key) {
-	case KC_LEFT:
-		caret_move_word_left(true);
-		break;
-	case KC_RIGHT:
-		caret_move_word_right(true);
-		break;
-	case KC_F:
-		search_prompt(true);
-		break;
-	case KC_HOME:
-		pt_get_sof(&pt);
-		caret_move(pt, true, true);
-		break;
-	case KC_END:
-		pt_get_eof(&pt);
-		caret_move(pt, true, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void pos_handle(pos_event_t *ev)
-{
-	coord_t bc;
-	spt_t pt;
-	bool select;
-
-	if (ev->type == POS_PRESS && ev->vpos < (unsigned)pane.rows) {
-		bc.row = pane.sh_row + ev->vpos;
-		bc.column = pane.sh_column + ev->hpos;
-		sheet_get_cell_pt(doc.sh, &bc, dir_before, &pt);
-
-		select = (pane.keymod & KM_SHIFT) != 0;
-
-		caret_move(pt, select, true);
-	}
-}
-
-/** Move caret while preserving or resetting selection. */
-static void caret_move(spt_t new_caret_pt, bool select, bool update_ideal_column)
-{
-	spt_t old_caret_pt, old_sel_pt;
-	coord_t c_old, c_new;
-	bool had_sel;
-
-	/* Check if we had selection before. */
-	tag_get_pt(&pane.caret_pos, &old_caret_pt);
-	tag_get_pt(&pane.sel_start, &old_sel_pt);
-	had_sel = !spt_equal(&old_caret_pt, &old_sel_pt);
-
-	/* Place tag of the caret */
-	sheet_remove_tag(doc.sh, &pane.caret_pos);
-	sheet_place_tag(doc.sh, &new_caret_pt, &pane.caret_pos);
-
-	if (select == false) {
-		/* Move sel_start to the same point as caret. */
-		sheet_remove_tag(doc.sh, &pane.sel_start);
-		sheet_place_tag(doc.sh, &new_caret_pt, &pane.sel_start);
-	}
-
-	spt_get_coord(&new_caret_pt, &c_new);
-	if (select) {
-		spt_get_coord(&old_caret_pt, &c_old);
-
-		if (c_old.row == c_new.row)
-			pane.rflags |= REDRAW_ROW;
-		else
-			pane.rflags |= REDRAW_TEXT;
-
-	} else if (had_sel == true) {
-		/* Redraw because text was unselected. */
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (update_ideal_column)
-		pane.ideal_column = c_new.column;
-
-	caret_update();
-}
-
-static void key_handle_movement(unsigned int key, bool select)
-{
-	spt_t pt;
-	switch (key) {
-	case KC_LEFT:
-		caret_move_relative(0, -1, dir_before, select);
-		break;
-	case KC_RIGHT:
-		caret_move_relative(0, 0, dir_after, select);
-		break;
-	case KC_UP:
-		caret_move_relative(-1, 0, dir_before, select);
-		break;
-	case KC_DOWN:
-		caret_move_relative(+1, 0, dir_before, select);
-		break;
-	case KC_HOME:
-		tag_get_pt(&pane.caret_pos, &pt);
-		pt_get_sol(&pt, &pt);
-		caret_move(pt, select, true);
-		break;
-	case KC_END:
-		tag_get_pt(&pane.caret_pos, &pt);
-		pt_get_eol(&pt, &pt);
-		caret_move(pt, select, true);
-		break;
-	case KC_PAGE_UP:
-		caret_move_relative(-pane.rows, 0, dir_before, select);
-		break;
-	case KC_PAGE_DOWN:
-		caret_move_relative(+pane.rows, 0, dir_before, select);
-		break;
-	default:
-		break;
-	}
-}
-
-/** Save the document. */
-static errno_t file_save(char const *fname)
-{
-	spt_t sp, ep;
-	errno_t rc;
-
-	status_display("Saving...");
-	pt_get_sof(&sp);
-	pt_get_eof(&ep);
-
-	rc = file_save_range(fname, &sp, &ep);
-
-	switch (rc) {
-	case EINVAL:
-		status_display("Error opening file!");
-		break;
-	case EIO:
-		status_display("Error writing data!");
-		break;
-	default:
-		status_display("File saved.");
-		break;
-	}
-
-	return rc;
-}
-
-/** Change document name and save. */
-static void file_save_as(void)
-{
-	const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
-	char *fname;
-
-	fname = prompt("Save As", old_fname);
-	if (fname == NULL) {
-		status_display("Save cancelled.");
-		return;
-	}
-
-	errno_t rc = file_save(fname);
-	if (rc != EOK)
-		return;
-
-	if (doc.file_name != NULL)
-		free(doc.file_name);
-	doc.file_name = fname;
-}
-
-/** Ask for a string. */
-static char *prompt(char const *prompt, char const *init_value)
-{
-	cons_event_t ev;
-	kbd_event_t *kev;
-	char *str;
-	char32_t buffer[INFNAME_MAX_LEN + 1];
-	int max_len;
-	int nc;
-	bool done;
-
-	asprintf(&str, "%s: %s", prompt, init_value);
-	status_display(str);
-	console_set_pos(con, 1 + str_length(str), scr_rows - 1);
-	free(str);
-
-	console_set_style(con, STYLE_INVERTED);
-
-	max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_length(prompt));
-	str_to_wstr(buffer, max_len + 1, init_value);
-	nc = wstr_length(buffer);
-	done = false;
-
-	while (!done) {
-		console_get_event(con, &ev);
-
-		if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS) {
-			kev = &ev.ev.key;
-
-			/* Handle key press. */
-			if ((kev->mods & (KM_CTRL | KM_ALT)) == 0) {
-				switch (kev->key) {
-				case KC_ESCAPE:
-					return NULL;
-				case KC_BACKSPACE:
-					if (nc > 0) {
-						putchar('\b');
-						console_flush(con);
-						--nc;
-					}
-					break;
-				case KC_ENTER:
-					done = true;
-					break;
-				default:
-					if (kev->c >= 32 && nc < max_len) {
-						putuchar(kev->c);
-						console_flush(con);
-						buffer[nc++] = kev->c;
-					}
-					break;
-				}
-			}
-		}
-	}
-
-	buffer[nc] = '\0';
-	str = wstr_to_astr(buffer);
-
-	console_set_style(con, STYLE_NORMAL);
-
-	return str;
-}
-
-/** Insert file at caret position.
- *
- * Reads in the contents of a file and inserts them at the current position
- * of the caret.
- */
-static errno_t file_insert(char *fname)
-{
-	FILE *f;
-	char32_t c;
-	char buf[BUF_SIZE];
-	int bcnt;
-	int n_read;
-	size_t off;
-
-	f = fopen(fname, "rt");
-	if (f == NULL)
-		return EINVAL;
-
-	bcnt = 0;
-
-	while (true) {
-		if (bcnt < STR_BOUNDS(1)) {
-			n_read = fread(buf + bcnt, 1, BUF_SIZE - bcnt, f);
-			bcnt += n_read;
-		}
-
-		off = 0;
-		c = str_decode(buf, &off, bcnt);
-		if (c == '\0')
-			break;
-
-		bcnt -= off;
-		memcpy(buf, buf + off, bcnt);
-
-		insert_char(c);
-	}
-
-	fclose(f);
-
-	return EOK;
-}
-
-/** Save a range of text into a file. */
-static errno_t file_save_range(char const *fname, spt_t const *spos,
-    spt_t const *epos)
-{
-	FILE *f;
-	char buf[BUF_SIZE];
-	spt_t sp, bep;
-	size_t bytes, n_written;
-
-	f = fopen(fname, "wt");
-	if (f == NULL)
-		return EINVAL;
-
-	sp = *spos;
-
-	do {
-		sheet_copy_out(doc.sh, &sp, epos, buf, BUF_SIZE, &bep);
-		bytes = str_size(buf);
-
-		n_written = fwrite(buf, 1, bytes, f);
-		if (n_written != bytes) {
-			return EIO;
-		}
-
-		sp = bep;
-	} while (!spt_equal(&bep, epos));
-
-	if (fclose(f) < 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Return contents of range as a new string. */
-static char *range_get_str(spt_t const *spos, spt_t const *epos)
-{
-	char *buf;
-	spt_t sp, bep;
-	size_t bytes;
-	size_t buf_size, bpos;
-
-	buf_size = 1;
-
-	buf = malloc(buf_size);
-	if (buf == NULL)
-		return NULL;
-
-	bpos = 0;
-	sp = *spos;
-
-	while (true) {
-		sheet_copy_out(doc.sh, &sp, epos, &buf[bpos], buf_size - bpos,
-		    &bep);
-		bytes = str_size(&buf[bpos]);
-		bpos += bytes;
-		sp = bep;
-
-		if (spt_equal(&bep, epos))
-			break;
-
-		buf_size *= 2;
-		buf = realloc(buf, buf_size);
-		if (buf == NULL)
-			return NULL;
-	}
-
-	return buf;
-}
-
-static void pane_text_display(void)
-{
-	int sh_rows, rows;
-
-	sheet_get_num_rows(doc.sh, &sh_rows);
-	rows = min(sh_rows - pane.sh_row + 1, pane.rows);
-
-	/* Draw rows from the sheet. */
-
-	console_set_pos(con, 0, 0);
-	pane_row_range_display(0, rows);
-
-	/* Clear the remaining rows if file is short. */
-
-	int i;
-	sysarg_t j;
-	for (i = rows; i < pane.rows; ++i) {
-		console_set_pos(con, 0, i);
-		for (j = 0; j < scr_columns; ++j)
-			putchar(' ');
-		console_flush(con);
-	}
-
-	pane.rflags |= (REDRAW_STATUS | REDRAW_CARET);
-	pane.rflags &= ~REDRAW_ROW;
-}
-
-/** Display just the row where the caret is. */
-static void pane_row_display(void)
-{
-	spt_t caret_pt;
-	coord_t coord;
-	int ridx;
-
-	tag_get_pt(&pane.caret_pos, &caret_pt);
-	spt_get_coord(&caret_pt, &coord);
-
-	ridx = coord.row - pane.sh_row;
-	pane_row_range_display(ridx, ridx + 1);
-	pane.rflags |= (REDRAW_STATUS | REDRAW_CARET);
-}
-
-static void pane_row_range_display(int r0, int r1)
-{
-	int i, j, fill;
-	spt_t rb, re, dep, pt;
-	coord_t rbc, rec;
-	char row_buf[ROW_BUF_SIZE];
-	char32_t c;
-	size_t pos, size;
-	int s_column;
-	coord_t csel_start, csel_end, ctmp;
-
-	/* Determine selection start and end. */
-
-	tag_get_pt(&pane.sel_start, &pt);
-	spt_get_coord(&pt, &csel_start);
-
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_get_coord(&pt, &csel_end);
-
-	if (coord_cmp(&csel_start, &csel_end) > 0) {
-		ctmp = csel_start;
-		csel_start = csel_end;
-		csel_end = ctmp;
-	}
-
-	/* Draw rows from the sheet. */
-
-	console_set_pos(con, 0, 0);
-	for (i = r0; i < r1; ++i) {
-		/* Starting point for row display */
-		rbc.row = pane.sh_row + i;
-		rbc.column = pane.sh_column;
-		sheet_get_cell_pt(doc.sh, &rbc, dir_before, &rb);
-
-		/* Ending point for row display */
-		rec.row = pane.sh_row + i;
-		rec.column = pane.sh_column + pane.columns;
-		sheet_get_cell_pt(doc.sh, &rec, dir_before, &re);
-
-		/* Copy the text of the row to the buffer. */
-		sheet_copy_out(doc.sh, &rb, &re, row_buf, ROW_BUF_SIZE, &dep);
-
-		/* Display text from the buffer. */
-
-		if (coord_cmp(&csel_start, &rbc) <= 0 &&
-		    coord_cmp(&rbc, &csel_end) < 0) {
-			console_flush(con);
-			console_set_style(con, STYLE_SELECTED);
-			console_flush(con);
-		}
-
-		console_set_pos(con, 0, i);
-		size = str_size(row_buf);
-		pos = 0;
-		s_column = pane.sh_column;
-		while (pos < size) {
-			if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
-				console_flush(con);
-				console_set_style(con, STYLE_SELECTED);
-				console_flush(con);
-			}
-
-			if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
-				console_flush(con);
-				console_set_style(con, STYLE_NORMAL);
-				console_flush(con);
-			}
-
-			c = str_decode(row_buf, &pos, size);
-			if (c != '\t') {
-				printf("%lc", (wint_t) c);
-				s_column += 1;
-			} else {
-				fill = 1 + ALIGN_UP(s_column, TAB_WIDTH) -
-				    s_column;
-
-				for (j = 0; j < fill; ++j)
-					putchar(' ');
-				s_column += fill;
-			}
-		}
-
-		if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
-			console_flush(con);
-			console_set_style(con, STYLE_NORMAL);
-			console_flush(con);
-		}
-
-		/* Fill until the end of display area. */
-
-		if ((unsigned)s_column - 1 < scr_columns)
-			fill = scr_columns - (s_column - 1);
-		else
-			fill = 0;
-
-		for (j = 0; j < fill; ++j)
-			putchar(' ');
-		console_flush(con);
-		console_set_style(con, STYLE_NORMAL);
-	}
-
-	pane.rflags |= REDRAW_CARET;
-}
-
-/** Display pane status in the status line. */
-static void pane_status_display(void)
-{
-	spt_t caret_pt;
-	coord_t coord;
-	int last_row;
-	char *fname;
-	char *p;
-	char *text;
-	size_t n;
-	int pos;
-	size_t nextra;
-	size_t fnw;
-
-	tag_get_pt(&pane.caret_pos, &caret_pt);
-	spt_get_coord(&caret_pt, &coord);
-
-	sheet_get_num_rows(doc.sh, &last_row);
-
-	if (doc.file_name != NULL) {
-		/* Remove directory component */
-		p = str_rchr(doc.file_name, '/');
-		if (p != NULL)
-			fname = str_dup(p + 1);
-		else
-			fname = str_dup(doc.file_name);
-	} else {
-		fname = str_dup("<unnamed>");
-	}
-
-	if (fname == NULL)
-		return;
-
-	console_set_pos(con, 0, scr_rows - 1);
-	console_set_style(con, STYLE_INVERTED);
-
-	/*
-	 * Make sure the status fits on the screen. This loop should
-	 * be executed at most twice.
-	 */
-	while (true) {
-		int rc = asprintf(&text, " %d, %d (%d): File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
-		    "Ctrl-E Save As", coord.row, coord.column, last_row, fname);
-		if (rc < 0) {
-			n = 0;
-			goto finish;
-		}
-
-		/* If it already fits, we're done */
-		n = str_width(text);
-		if (n <= scr_columns - 2)
-			break;
-
-		/* Compute number of excess characters */
-		nextra = n - (scr_columns - 2);
-		/** With of the file name part */
-		fnw = str_width(fname);
-
-		/*
-		 * If reducing file name to two characters '..' won't help,
-		 * just give up and print a blank status.
-		 */
-		if (nextra > fnw - 2)
-			goto finish;
-
-		/* Compute position where we overwrite with '..\0' */
-		if (fnw >= nextra + 2) {
-			p = fname + str_lsize(fname, fnw - nextra - 2);
-		} else {
-			p = fname;
-		}
-
-		/* Shorten the string */
-		p[0] = p[1] = '.';
-		p[2] = '\0';
-
-		/* Need to format the string once more. */
-		free(text);
-	}
-
-	printf("%s", text);
-	free(text);
-	free(fname);
-finish:
-	/* Fill the rest of the line */
-	pos = scr_columns - 1 - n;
-	printf("%*s", pos, "");
-	console_flush(con);
-	console_set_style(con, STYLE_NORMAL);
-
-	pane.rflags |= REDRAW_CARET;
-}
-
-/** Set cursor to reflect position of the caret. */
-static void pane_caret_display(void)
-{
-	spt_t caret_pt;
-	coord_t coord;
-
-	tag_get_pt(&pane.caret_pos, &caret_pt);
-
-	spt_get_coord(&caret_pt, &coord);
-	console_set_pos(con, coord.column - pane.sh_column,
-	    coord.row - pane.sh_row);
-}
-
-/** Insert a character at caret position. */
-static void insert_char(char32_t c)
-{
-	spt_t pt;
-	char cbuf[STR_BOUNDS(1) + 1];
-	size_t offs;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-
-	offs = 0;
-	chr_encode(c, cbuf, &offs, STR_BOUNDS(1) + 1);
-	cbuf[offs] = '\0';
-
-	(void) sheet_insert(doc.sh, &pt, dir_before, cbuf);
-
-	pane.rflags |= REDRAW_ROW;
-	if (c == '\n')
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Delete the character before the caret. */
-static void delete_char_before(void)
-{
-	spt_t sp, ep;
-	coord_t coord;
-
-	tag_get_pt(&pane.caret_pos, &ep);
-	spt_get_coord(&ep, &coord);
-
-	coord.column -= 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, &sp);
-
-	(void) sheet_delete(doc.sh, &sp, &ep);
-
-	pane.rflags |= REDRAW_ROW;
-	if (coord.column < 1)
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Delete the character after the caret. */
-static void delete_char_after(void)
-{
-	spt_t sp, ep;
-	coord_t sc, ec;
-
-	tag_get_pt(&pane.caret_pos, &sp);
-	spt_get_coord(&sp, &sc);
-
-	sheet_get_cell_pt(doc.sh, &sc, dir_after, &ep);
-	spt_get_coord(&ep, &ec);
-
-	(void) sheet_delete(doc.sh, &sp, &ep);
-
-	pane.rflags |= REDRAW_ROW;
-	if (ec.row != sc.row)
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Scroll pane after caret has moved.
- *
- * After modifying the position of the caret, this is called to scroll
- * the pane to ensure that the caret is in the visible area.
- */
-static void caret_update(void)
-{
-	spt_t pt;
-	coord_t coord;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_get_coord(&pt, &coord);
-
-	/* Scroll pane vertically. */
-
-	if (coord.row < pane.sh_row) {
-		pane.sh_row = coord.row;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (coord.row > pane.sh_row + pane.rows - 1) {
-		pane.sh_row = coord.row - pane.rows + 1;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	/* Scroll pane horizontally. */
-
-	if (coord.column < pane.sh_column) {
-		pane.sh_column = coord.column;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	if (coord.column > pane.sh_column + pane.columns - 1) {
-		pane.sh_column = coord.column - pane.columns + 1;
-		pane.rflags |= REDRAW_TEXT;
-	}
-
-	pane.rflags |= (REDRAW_CARET | REDRAW_STATUS);
-}
-
-/** Relatively move caret position.
- *
- * Moves caret relatively to the current position. Looking at the first
- * character cell after the caret and moving by @a drow and @a dcolumn, we get
- * to a new character cell, and thus a new character. Then we either go to the
- * point before the the character or after it, depending on @a align_dir.
- *
- * @param select true if the selection tag should stay where it is
- */
-static void caret_move_relative(int drow, int dcolumn, enum dir_spec align_dir,
-    bool select)
-{
-	spt_t pt;
-	coord_t coord;
-	int num_rows;
-	bool pure_vertical;
-
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_get_coord(&pt, &coord);
-	coord.row += drow;
-	coord.column += dcolumn;
-
-	/* Clamp coordinates. */
-	if (drow < 0 && coord.row < 1)
-		coord.row = 1;
-	if (dcolumn < 0 && coord.column < 1) {
-		if (coord.row < 2)
-			coord.column = 1;
-		else {
-			coord.row--;
-			sheet_get_row_width(doc.sh, coord.row, &coord.column);
-		}
-	}
-	if (drow > 0) {
-		sheet_get_num_rows(doc.sh, &num_rows);
-		if (coord.row > num_rows)
-			coord.row = num_rows;
-	}
-
-	/* For purely vertical movement try attaining @c ideal_column. */
-	pure_vertical = (dcolumn == 0 && align_dir == dir_before);
-	if (pure_vertical)
-		coord.column = pane.ideal_column;
-
-	/*
-	 * Select the point before or after the character at the designated
-	 * coordinates. The character can be wider than one cell (e.g. tab).
-	 */
-	sheet_get_cell_pt(doc.sh, &coord, align_dir, &pt);
-
-	/* For non-vertical movement set the new value for @c ideal_column. */
-	caret_move(pt, select, !pure_vertical);
-}
-
-/** Absolutely move caret position.
- *
- * Moves caret to a specified position. We get to a new character cell, and
- * thus a new character. Then we either go to the point before the the character
- * or after it, depending on @a align_dir.
- *
- * @param select true if the selection tag should stay where it is
- */
-static void caret_move_absolute(int row, int column, enum dir_spec align_dir,
-    bool select)
-{
-	coord_t coord;
-	coord.row = row;
-	coord.column = column;
-
-	spt_t pt;
-	sheet_get_cell_pt(doc.sh, &coord, align_dir, &pt);
-
-	caret_move(pt, select, true);
-}
-
-/** Find beginning of a word to the left of spt */
-static spt_t pt_find_word_left(spt_t spt)
-{
-	do {
-		spt_prev_char(spt, &spt);
-	} while (!pt_is_word_beginning(&spt));
-	return spt;
-}
-
-/** Find beginning of a word to the right of spt */
-static spt_t pt_find_word_right(spt_t spt)
-{
-	do {
-		spt_next_char(spt, &spt);
-	} while (!pt_is_word_beginning(&spt));
-	return spt;
-}
-
-static void caret_move_word_left(bool select)
-{
-	spt_t pt;
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_t word_left = pt_find_word_left(pt);
-	caret_move(word_left, select, true);
-}
-
-static void caret_move_word_right(bool select)
-{
-	spt_t pt;
-	tag_get_pt(&pane.caret_pos, &pt);
-	spt_t word_right = pt_find_word_right(pt);
-	caret_move(word_right, select, true);
-}
-
-/** Ask for line and go to it. */
-static void caret_go_to_line_ask(void)
-{
-	char *sline;
-
-	sline = prompt("Go to line", "");
-	if (sline == NULL) {
-		status_display("Go to line cancelled.");
-		return;
-	}
-
-	char *endptr;
-	int line = strtol(sline, &endptr, 10);
-	if (*endptr != '\0') {
-		free(sline);
-		status_display("Invalid number entered.");
-		return;
-	}
-	free(sline);
-
-	caret_move_absolute(line, pane.ideal_column, dir_before, false);
-}
-
-/* Search operations */
-static errno_t search_spt_producer(void *data, char32_t *ret)
-{
-	assert(data != NULL);
-	assert(ret != NULL);
-	spt_t *spt = data;
-	*ret = spt_next_char(*spt, spt);
-	return EOK;
-}
-
-static errno_t search_spt_reverse_producer(void *data, char32_t *ret)
-{
-	assert(data != NULL);
-	assert(ret != NULL);
-	spt_t *spt = data;
-	*ret = spt_prev_char(*spt, spt);
-	return EOK;
-}
-
-static errno_t search_spt_mark(void *data, void **mark)
-{
-	assert(data != NULL);
-	assert(mark != NULL);
-	spt_t *spt = data;
-	spt_t *new = calloc(1, sizeof(spt_t));
-	*mark = new;
-	if (new == NULL)
-		return ENOMEM;
-	*new = *spt;
-	return EOK;
-}
-
-static void search_spt_mark_free(void *data)
-{
-	free(data);
-}
-
-static search_ops_t search_spt_ops = {
-	.equals = char_exact_equals,
-	.producer = search_spt_producer,
-	.mark = search_spt_mark,
-	.mark_free = search_spt_mark_free,
-};
-
-static search_ops_t search_spt_reverse_ops = {
-	.equals = char_exact_equals,
-	.producer = search_spt_reverse_producer,
-	.mark = search_spt_mark,
-	.mark_free = search_spt_mark_free,
-};
-
-/** Ask for line and go to it. */
-static void search_prompt(bool reverse)
-{
-	char *pattern;
-
-	const char *prompt_text = "Find next";
-	if (reverse)
-		prompt_text = "Find previous";
-
-	const char *default_value = "";
-	if (pane.previous_search)
-		default_value = pane.previous_search;
-
-	pattern = prompt(prompt_text, default_value);
-	if (pattern == NULL) {
-		status_display("Search cancelled.");
-		return;
-	}
-
-	if (pane.previous_search)
-		free(pane.previous_search);
-	pane.previous_search = pattern;
-	pane.previous_search_reverse = reverse;
-
-	search(pattern, reverse);
-}
-
-static void search_repeat(void)
-{
-	if (pane.previous_search == NULL) {
-		status_display("No previous search to repeat.");
-		return;
-	}
-
-	search(pane.previous_search, pane.previous_search_reverse);
-}
-
-static void search(char *pattern, bool reverse)
-{
-	status_display("Searching...");
-
-	spt_t sp, producer_pos;
-	tag_get_pt(&pane.caret_pos, &sp);
-
-	/* Start searching on the position before/after caret */
-	if (!reverse) {
-		spt_next_char(sp, &sp);
-	} else {
-		spt_prev_char(sp, &sp);
-	}
-	producer_pos = sp;
-
-	search_ops_t ops = search_spt_ops;
-	if (reverse)
-		ops = search_spt_reverse_ops;
-
-	search_t *search = search_init(pattern, &producer_pos, ops, reverse);
-	if (search == NULL) {
-		status_display("Failed initializing search.");
-		return;
-	}
-
-	match_t match;
-	errno_t rc = search_next_match(search, &match);
-	if (rc != EOK) {
-		status_display("Failed searching.");
-		search_fini(search);
-	}
-
-	if (match.end) {
-		status_display("Match found.");
-		assert(match.end != NULL);
-		spt_t *end = match.end;
-		caret_move(*end, false, true);
-		while (match.length > 0) {
-			match.length--;
-			if (reverse) {
-				spt_next_char(*end, end);
-			} else {
-				spt_prev_char(*end, end);
-			}
-		}
-		caret_move(*end, true, true);
-		free(end);
-	} else {
-		status_display("Not found.");
-	}
-
-	search_fini(search);
-}
-
-/** Check for non-empty selection. */
-static bool selection_active(void)
-{
-	return (tag_cmp(&pane.caret_pos, &pane.sel_start) != 0);
-}
-
-static void selection_get_points(spt_t *pa, spt_t *pb)
-{
-	spt_t pt;
-
-	tag_get_pt(&pane.sel_start, pa);
-	tag_get_pt(&pane.caret_pos, pb);
-
-	if (spt_cmp(pa, pb) > 0) {
-		pt = *pa;
-		*pa = *pb;
-		*pb = pt;
-	}
-}
-
-/** Delete selected text. */
-static void selection_delete(void)
-{
-	spt_t pa, pb;
-	coord_t ca, cb;
-	int rel;
-
-	tag_get_pt(&pane.sel_start, &pa);
-	tag_get_pt(&pane.caret_pos, &pb);
-	spt_get_coord(&pa, &ca);
-	spt_get_coord(&pb, &cb);
-	rel = coord_cmp(&ca, &cb);
-
-	if (rel == 0)
-		return;
-
-	if (rel < 0)
-		sheet_delete(doc.sh, &pa, &pb);
-	else
-		sheet_delete(doc.sh, &pb, &pa);
-
-	if (ca.row == cb.row)
-		pane.rflags |= REDRAW_ROW;
-	else
-		pane.rflags |= REDRAW_TEXT;
-}
-
-/** Select all text in the editor */
-static void selection_sel_all(void)
-{
-	spt_t spt, ept;
-
-	pt_get_sof(&spt);
-	pt_get_eof(&ept);
-
-	selection_sel_range(spt, ept);
-}
-
-/** Select select all text in a given range with the given direction */
-static void selection_sel_range(spt_t pa, spt_t pb)
-{
-	sheet_remove_tag(doc.sh, &pane.sel_start);
-	sheet_place_tag(doc.sh, &pa, &pane.sel_start);
-	sheet_remove_tag(doc.sh, &pane.caret_pos);
-	sheet_place_tag(doc.sh, &pb, &pane.caret_pos);
-
-	pane.rflags |= REDRAW_TEXT;
-	caret_update();
-}
-
-static void selection_copy(void)
-{
-	spt_t pa, pb;
-	char *str;
-
-	selection_get_points(&pa, &pb);
-	str = range_get_str(&pa, &pb);
-	if (str == NULL || clipboard_put_str(str) != EOK) {
-		status_display("Copying to clipboard failed!");
-	}
-	free(str);
-}
-
-static void insert_clipboard_data(void)
-{
-	char *str;
-	size_t off;
-	char32_t c;
-	errno_t rc;
-
-	rc = clipboard_get_str(&str);
-	if (rc != EOK || str == NULL)
-		return;
-
-	off = 0;
-
-	while (true) {
-		c = str_decode(str, &off, STR_NO_LIMIT);
-		if (c == '\0')
-			break;
-
-		insert_char(c);
-	}
-
-	free(str);
-}
-
-/** Get start-of-file s-point. */
-static void pt_get_sof(spt_t *pt)
-{
-	coord_t coord;
-
-	coord.row = coord.column = 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, pt);
-}
-
-/** Get end-of-file s-point. */
-static void pt_get_eof(spt_t *pt)
-{
-	coord_t coord;
-	int num_rows;
-
-	sheet_get_num_rows(doc.sh, &num_rows);
-	coord.row = num_rows + 1;
-	coord.column = 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, pt);
-}
-
-/** Get start-of-line s-point for given s-point cpt */
-static void pt_get_sol(spt_t *cpt, spt_t *spt)
-{
-	coord_t coord;
-
-	spt_get_coord(cpt, &coord);
-	coord.column = 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, spt);
-}
-
-/** Get end-of-line s-point for given s-point cpt */
-static void pt_get_eol(spt_t *cpt, spt_t *ept)
-{
-	coord_t coord;
-	int row_width;
-
-	spt_get_coord(cpt, &coord);
-	sheet_get_row_width(doc.sh, coord.row, &row_width);
-	coord.column = row_width - 1;
-
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, ept);
-}
-
-/** Check whether the spt is at a beginning of a word */
-static bool pt_is_word_beginning(spt_t *pt)
-{
-	spt_t lp, sfp, efp, slp, elp;
-	coord_t coord;
-
-	pt_get_sof(&sfp);
-	pt_get_eof(&efp);
-	pt_get_sol(pt, &slp);
-	pt_get_eol(pt, &elp);
-
-	/* the spt is at the beginning or end of the file or line */
-	if ((spt_cmp(&sfp, pt) == 0) || (spt_cmp(&efp, pt) == 0) ||
-	    (spt_cmp(&slp, pt) == 0) || (spt_cmp(&elp, pt) == 0))
-		return true;
-
-	/* the spt is a delimiter */
-	if (pt_is_delimiter(pt))
-		return false;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column -= 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_before, &lp);
-
-	return pt_is_delimiter(&lp) ||
-	    (pt_is_punctuation(pt) && !pt_is_punctuation(&lp)) ||
-	    (pt_is_punctuation(&lp) && !pt_is_punctuation(pt));
-}
-
-static char32_t get_first_wchar(const char *str)
-{
-	size_t offset = 0;
-	return str_decode(str, &offset, str_size(str));
-}
-
-static bool pt_is_delimiter(spt_t *pt)
-{
-	spt_t rp;
-	coord_t coord;
-	char *ch = NULL;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column += 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, &rp);
-
-	ch = range_get_str(pt, &rp);
-	if (ch == NULL)
-		return false;
-
-	char32_t first_char = get_first_wchar(ch);
-	switch (first_char) {
-	case ' ':
-	case '\t':
-	case '\n':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static bool pt_is_punctuation(spt_t *pt)
-{
-	spt_t rp;
-	coord_t coord;
-	char *ch = NULL;
-
-	spt_get_coord(pt, &coord);
-
-	coord.column += 1;
-	sheet_get_cell_pt(doc.sh, &coord, dir_after, &rp);
-
-	ch = range_get_str(pt, &rp);
-	if (ch == NULL)
-		return false;
-
-	char32_t first_char = get_first_wchar(ch);
-	switch (first_char) {
-	case ',':
-	case '.':
-	case ';':
-	case ':':
-	case '/':
-	case '?':
-	case '\\':
-	case '|':
-	case '_':
-	case '+':
-	case '-':
-	case '*':
-	case '=':
-	case '<':
-	case '>':
-		return true;
-	default:
-		return false;
-	}
-}
-
-/** Compare tags. */
-static int tag_cmp(tag_t const *a, tag_t const *b)
-{
-	spt_t pa, pb;
-
-	tag_get_pt(a, &pa);
-	tag_get_pt(b, &pb);
-
-	return spt_cmp(&pa, &pb);
-}
-
-/** Compare s-points. */
-static int spt_cmp(spt_t const *a, spt_t const *b)
-{
-	coord_t ca, cb;
-
-	spt_get_coord(a, &ca);
-	spt_get_coord(b, &cb);
-
-	return coord_cmp(&ca, &cb);
-}
-
-/** Compare coordinats. */
-static int coord_cmp(coord_t const *a, coord_t const *b)
-{
-	if (a->row - b->row != 0)
-		return a->row - b->row;
-
-	return a->column - b->column;
-}
-
-/** Display text in the status line. */
-static void status_display(char const *str)
-{
-	console_set_pos(con, 0, scr_rows - 1);
-	console_set_style(con, STYLE_INVERTED);
-
-	int pos = -(scr_columns - 3);
-	printf(" %*s ", pos, str);
-	console_flush(con);
-	console_set_style(con, STYLE_NORMAL);
-
-	pane.rflags |= REDRAW_CARET;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/search.c
===================================================================
--- uspace/dist/src/c/demos/edit/search.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- * @brief Simple searching facility.
- */
-
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-
-#include "search.h"
-#include "search_impl.h"
-
-search_t *search_init(const char *pattern, void *client_data, search_ops_t ops,
-    bool reverse)
-{
-	search_t *search = calloc(1, sizeof(search_t));
-	if (search == NULL)
-		return NULL;
-
-	char32_t *p = str_to_awstr(pattern);
-	if (p == NULL) {
-		free(search);
-		return NULL;
-	}
-
-	search->pattern_length = wstr_length(p);
-
-	if (reverse) {
-		/* Reverse the pattern */
-		size_t pos, half;
-		half = search->pattern_length / 2;
-		for (pos = 0; pos < half; pos++) {
-			char32_t tmp = p[pos];
-			p[pos] = p[search->pattern_length - pos - 1];
-			p[search->pattern_length - pos - 1] = tmp;
-		}
-	}
-
-	search->pattern = p;
-
-	search->client_data = client_data;
-	search->ops = ops;
-	search->back_table = calloc(search->pattern_length, sizeof(ssize_t));
-	if (search->back_table == NULL) {
-		free(search->pattern);
-		free(search);
-		return NULL;
-	}
-
-	search->pattern_pos = 0;
-
-	search->back_table[0] = -1;
-	search->back_table[1] = 0;
-	size_t table_idx = 2;
-	size_t pattern_idx = 0;
-	while (table_idx < search->pattern_length) {
-		if (ops.equals(search->pattern[table_idx - 1],
-		    search->pattern[pattern_idx])) {
-			pattern_idx++;
-			search->back_table[table_idx] = pattern_idx;
-			table_idx++;
-		} else if (pattern_idx > 0) {
-			pattern_idx = search->back_table[pattern_idx];
-		} else {
-			pattern_idx = 0;
-			table_idx++;
-		}
-	}
-
-	return search;
-}
-
-errno_t search_next_match(search_t *s, match_t *match)
-{
-	search_equals_fn eq = s->ops.equals;
-
-	char32_t cur_char;
-	errno_t rc = EOK;
-	while ((rc = s->ops.producer(s->client_data, &cur_char)) == EOK && cur_char > 0) {
-		/* Deal with mismatches */
-		while (s->pattern_pos > 0 && !eq(cur_char, s->pattern[s->pattern_pos])) {
-			s->pattern_pos = s->back_table[s->pattern_pos];
-		}
-		/* Check if the character matched */
-		if (eq(cur_char, s->pattern[s->pattern_pos])) {
-			s->pattern_pos++;
-			if (s->pattern_pos == s->pattern_length) {
-				s->pattern_pos = s->back_table[s->pattern_pos];
-				rc = s->ops.mark(s->client_data, &match->end);
-				if (rc != EOK)
-					return rc;
-				match->length = s->pattern_length;
-				return EOK;
-			}
-		}
-	}
-
-	match->end = NULL;
-	match->length = 0;
-
-	return rc;
-}
-
-void search_fini(search_t *search)
-{
-	free(search->pattern);
-	free(search->back_table);
-
-}
-
-bool char_exact_equals(const char32_t a, const char32_t b)
-{
-	return a == b;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/search.h
===================================================================
--- uspace/dist/src/c/demos/edit/search.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SEARCH_H__
-#define SEARCH_H__
-
-#include <str.h>
-
-struct search;
-typedef struct search search_t;
-typedef bool (*search_equals_fn)(const char32_t, const char32_t);
-typedef errno_t (*search_producer_fn)(void *, char32_t *);
-typedef errno_t (*search_mark_fn)(void *, void **);
-typedef void (*search_mark_free_fn)(void *);
-
-typedef struct match {
-	aoff64_t length;
-	void *end;
-} match_t;
-
-typedef struct search_ops {
-	search_equals_fn equals;
-	search_producer_fn producer;
-	search_mark_fn mark;
-	search_mark_free_fn mark_free;
-} search_ops_t;
-
-extern bool char_exact_equals(const char32_t, const char32_t);
-extern search_t *search_init(const char *, void *, search_ops_t, bool);
-extern errno_t search_next_match(search_t *, match_t *);
-extern void search_fini(search_t *);
-
-#endif
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/search_impl.h
===================================================================
--- uspace/dist/src/c/demos/edit/search_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SEARCH_IMPL_H__
-#define SEARCH_IMPL_H__
-
-#include "search.h"
-
-/** Search state */
-struct search {
-	/* Note: This structure is opaque for the user. */
-
-	const char32_t *pattern;
-	size_t pattern_length;
-	ssize_t *back_table;
-	size_t pattern_pos;
-	void *client_data;
-	search_ops_t ops;
-};
-
-#endif
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/sheet.c
===================================================================
--- uspace/dist/src/c/demos/edit/sheet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,358 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- * @brief Prototype implementation of Sheet data structure.
- *
- * The sheet is an abstract data structure representing a piece of text.
- * On top of this data structure we can implement a text editor. It is
- * possible to implement the sheet such that the editor can make small
- * changes to large files or files containing long lines efficiently.
- *
- * The sheet structure allows basic operations of text insertion, deletion,
- * retrieval and mapping of coordinates to position in the file and vice
- * versa. The text that is inserted or deleted can contain tabs and newlines
- * which are interpreted and properly acted upon.
- *
- * This is a trivial implementation with poor efficiency with O(N+n)
- * insertion and deletion and O(N) mapping (in both directions), where
- * N is the size of the file and n is the size of the inserted/deleted text.
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <align.h>
-#include <macros.h>
-
-#include "sheet.h"
-#include "sheet_impl.h"
-
-enum {
-	TAB_WIDTH	= 8,
-
-	/** Initial  of dat buffer in bytes */
-	INITIAL_SIZE	= 32
-};
-
-/** Initialize an empty sheet. */
-errno_t sheet_create(sheet_t **rsh)
-{
-	sheet_t *sh;
-
-	sh = calloc(1, sizeof(sheet_t));
-	if (sh == NULL)
-		return ENOMEM;
-
-	sh->dbuf_size = INITIAL_SIZE;
-	sh->text_size = 0;
-
-	sh->data = malloc(sh->dbuf_size);
-	if (sh->data == NULL)
-		return ENOMEM;
-
-	list_initialize(&sh->tags);
-
-	*rsh = sh;
-	return EOK;
-}
-
-/** Insert text into sheet.
- *
- * @param sh	Sheet to insert to.
- * @param pos	Point where to insert.
- * @param dir	Whether to insert before or after the point (affects tags).
- * @param str	The text to insert (printable characters, tabs, newlines).
- *
- * @return	EOK on success or an error code.
- *
- * @note	@a dir affects which way tags that were placed on @a pos will
- * 		move. If @a dir is @c dir_before, the tags will move forward
- *		and vice versa.
- */
-errno_t sheet_insert(sheet_t *sh, spt_t *pos, enum dir_spec dir, char *str)
-{
-	char *ipp;
-	size_t sz;
-	char *newp;
-
-	sz = str_size(str);
-	if (sh->text_size + sz > sh->dbuf_size) {
-		/* Enlarge data buffer. */
-		newp = realloc(sh->data, sh->dbuf_size * 2);
-		if (newp == NULL)
-			return ELIMIT;
-
-		sh->data = newp;
-		sh->dbuf_size = sh->dbuf_size * 2;
-	}
-
-	ipp = sh->data + pos->b_off;
-
-	/* Copy data. */
-	memmove(ipp + sz, ipp, sh->text_size - pos->b_off);
-	memcpy(ipp, str, sz);
-	sh->text_size += sz;
-
-	/* Adjust tags. */
-
-	list_foreach(sh->tags, link, tag_t, tag) {
-		if (tag->b_off > pos->b_off)
-			tag->b_off += sz;
-		else if (tag->b_off == pos->b_off && dir == dir_before)
-			tag->b_off += sz;
-	}
-
-	return EOK;
-}
-
-/** Delete text from sheet.
- *
- * Deletes the range of text between two points from the sheet.
- *
- * @param sh	Sheet to delete from.
- * @param spos	Starting point.
- * @param epos	Ending point.
- *
- * @return	EOK on success or an error code.
- */
-errno_t sheet_delete(sheet_t *sh, spt_t *spos, spt_t *epos)
-{
-	char *spp;
-	size_t sz;
-	char *newp;
-	size_t shrink_size;
-
-	spp = sh->data + spos->b_off;
-	sz = epos->b_off - spos->b_off;
-
-	memmove(spp, spp + sz, sh->text_size - (spos->b_off + sz));
-	sh->text_size -= sz;
-
-	/* Adjust tags. */
-	list_foreach(sh->tags, link, tag_t, tag) {
-		if (tag->b_off >= epos->b_off)
-			tag->b_off -= sz;
-		else if (tag->b_off >= spos->b_off)
-			tag->b_off = spos->b_off;
-	}
-
-	/* See if we should free up some memory. */
-	shrink_size = max(sh->dbuf_size / 4, INITIAL_SIZE);
-	if (sh->text_size <= shrink_size && sh->dbuf_size > INITIAL_SIZE) {
-		/* Shrink data buffer. */
-		newp = realloc(sh->data, shrink_size);
-		if (newp == NULL) {
-			/* Failed to shrink buffer... no matter. */
-			return EOK;
-		}
-
-		sh->data = newp;
-		sh->dbuf_size = shrink_size;
-	}
-
-	return EOK;
-}
-
-/** Read text from sheet. */
-void sheet_copy_out(sheet_t *sh, spt_t const *spos, spt_t const *epos,
-    char *buf, size_t bufsize, spt_t *fpos)
-{
-	char *spp;
-	size_t range_sz;
-	size_t copy_sz;
-	size_t off, prev;
-	char32_t c;
-
-	spp = sh->data + spos->b_off;
-	range_sz = epos->b_off - spos->b_off;
-	copy_sz = (range_sz < bufsize - 1) ? range_sz : bufsize - 1;
-
-	prev = off = 0;
-	do {
-		prev = off;
-		c = str_decode(spp, &off, copy_sz);
-	} while (c != '\0');
-
-	/* Crop copy_sz down to the last full character. */
-	copy_sz = prev;
-
-	memcpy(buf, spp, copy_sz);
-	buf[copy_sz] = '\0';
-
-	fpos->b_off = spos->b_off + copy_sz;
-	fpos->sh = sh;
-}
-
-/** Get point preceding or following character cell. */
-void sheet_get_cell_pt(sheet_t *sh, coord_t const *coord, enum dir_spec dir,
-    spt_t *pt)
-{
-	size_t cur_pos, prev_pos;
-	char32_t c;
-	coord_t cc;
-
-	cc.row = cc.column = 1;
-	cur_pos = prev_pos = 0;
-	while (true) {
-		if (prev_pos >= sh->text_size) {
-			/* Cannot advance any further. */
-			break;
-		}
-
-		if ((cc.row >= coord->row && cc.column > coord->column) ||
-		    cc.row > coord->row) {
-			/* We are past the requested coordinates. */
-			break;
-		}
-
-		prev_pos = cur_pos;
-
-		c = str_decode(sh->data, &cur_pos, sh->text_size);
-		if (c == '\n') {
-			++cc.row;
-			cc.column = 1;
-		} else if (c == '\t') {
-			cc.column = 1 + ALIGN_UP(cc.column, TAB_WIDTH);
-		} else {
-			++cc.column;
-		}
-	}
-
-	pt->sh = sh;
-	pt->b_off = (dir == dir_before) ? prev_pos : cur_pos;
-}
-
-/** Get the number of character cells a row occupies. */
-void sheet_get_row_width(sheet_t *sh, int row, int *length)
-{
-	coord_t coord;
-	spt_t pt;
-
-	/* Especially nasty hack */
-	coord.row = row;
-	coord.column = 65536;
-
-	sheet_get_cell_pt(sh, &coord, dir_before, &pt);
-	spt_get_coord(&pt, &coord);
-	*length = coord.column;
-}
-
-/** Get the number of rows in a sheet. */
-void sheet_get_num_rows(sheet_t *sh, int *rows)
-{
-	int cnt;
-	size_t bo;
-
-	cnt = 1;
-	for (bo = 0; bo < sh->dbuf_size; ++bo) {
-		if (sh->data[bo] == '\n')
-			cnt += 1;
-	}
-
-	*rows = cnt;
-}
-
-/** Get the coordinates of an s-point. */
-void spt_get_coord(spt_t const *pos, coord_t *coord)
-{
-	size_t off;
-	coord_t cc;
-	char32_t c;
-	sheet_t *sh;
-
-	sh = pos->sh;
-	cc.row = cc.column = 1;
-
-	off = 0;
-	while (off < pos->b_off && off < sh->text_size) {
-		c = str_decode(sh->data, &off, sh->text_size);
-		if (c == '\n') {
-			++cc.row;
-			cc.column = 1;
-		} else if (c == '\t') {
-			cc.column = 1 + ALIGN_UP(cc.column, TAB_WIDTH);
-		} else {
-			++cc.column;
-		}
-	}
-
-	*coord = cc;
-}
-
-/** Test if two s-points are equal. */
-bool spt_equal(spt_t const *a, spt_t const *b)
-{
-	return a->b_off == b->b_off;
-}
-
-/** Get a character at spt and return next spt */
-char32_t spt_next_char(spt_t spt, spt_t *next)
-{
-	char32_t ch = str_decode(spt.sh->data, &spt.b_off, spt.sh->text_size);
-	if (next)
-		*next = spt;
-	return ch;
-}
-
-char32_t spt_prev_char(spt_t spt, spt_t *prev)
-{
-	char32_t ch = str_decode_reverse(spt.sh->data, &spt.b_off, spt.sh->text_size);
-	if (prev)
-		*prev = spt;
-	return ch;
-}
-
-/** Place a tag on the specified s-point. */
-void sheet_place_tag(sheet_t *sh, spt_t const *pt, tag_t *tag)
-{
-	tag->b_off = pt->b_off;
-	tag->sh = sh;
-	list_append(&tag->link, &sh->tags);
-}
-
-/** Remove a tag from the sheet. */
-void sheet_remove_tag(sheet_t *sh, tag_t *tag)
-{
-	list_remove(&tag->link);
-}
-
-/** Get s-point on which the tag is located right now. */
-void tag_get_pt(tag_t const *tag, spt_t *pt)
-{
-	pt->b_off = tag->b_off;
-	pt->sh = tag->sh;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/sheet.h
===================================================================
--- uspace/dist/src/c/demos/edit/sheet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SHEET_H__
-#define SHEET_H__
-
-#include <adt/list.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-/** Direction (in linear space) */
-enum dir_spec {
-	/** Before specified point */
-	dir_before,
-	/** After specified point */
-	dir_after
-};
-
-/** Sheet */
-struct sheet;
-typedef struct sheet sheet_t;
-
-/** Character cell coordinates
- *
- * These specify a character cell. The first cell is (1,1).
- */
-typedef struct {
-	int row;
-	int column;
-} coord_t;
-
-/** S-point
- *
- * An s-point specifies the boundary between two successive characters
- * in the linear file space (including the beginning of file or the end
- * of file. An s-point only remains valid as long as no modifications
- * (insertions/deletions) are performed on the sheet.
- */
-typedef struct {
-	/* Note: This structure is opaque for the user. */
-	sheet_t *sh;
-	size_t b_off;
-} spt_t;
-
-/** Tag
- *
- * A tag is similar to an s-point, but remains valid over modifications
- * to the sheet. A tag tends to 'stay put'. Any tag must be properly
- * removed from the sheet before it is deallocated by the user.
- */
-typedef struct {
-	/* Note: This structure is opaque for the user. */
-
-	/** Link to list of all tags in the sheet (see sheet_t.tags) */
-	link_t link;
-	sheet_t *sh;
-	size_t b_off;
-} tag_t;
-
-extern errno_t sheet_create(sheet_t **);
-extern errno_t sheet_insert(sheet_t *, spt_t *, enum dir_spec, char *);
-extern errno_t sheet_delete(sheet_t *, spt_t *, spt_t *);
-extern void sheet_copy_out(sheet_t *, spt_t const *, spt_t const *, char *,
-    size_t, spt_t *);
-extern void sheet_get_cell_pt(sheet_t *, coord_t const *, enum dir_spec,
-    spt_t *);
-extern void sheet_get_row_width(sheet_t *, int, int *);
-extern void sheet_get_num_rows(sheet_t *, int *);
-extern void spt_get_coord(spt_t const *, coord_t *);
-extern bool spt_equal(spt_t const *, spt_t const *);
-extern char32_t spt_next_char(spt_t, spt_t *);
-extern char32_t spt_prev_char(spt_t, spt_t *);
-
-extern void sheet_place_tag(sheet_t *, spt_t const *, tag_t *);
-extern void sheet_remove_tag(sheet_t *, tag_t *);
-extern void tag_get_pt(tag_t const *, spt_t *);
-
-#endif
-
-/** @}
- */
Index: pace/dist/src/c/demos/edit/sheet_impl.h
===================================================================
--- uspace/dist/src/c/demos/edit/sheet_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup edit
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SHEET_IMPL_H__
-#define SHEET_IMPL_H__
-
-#include "sheet.h"
-
-/** Sheet */
-struct sheet {
-	/* Note: This structure is opaque for the user. */
-
-	size_t text_size;
-	size_t dbuf_size;
-	char *data;
-
-	list_t tags;
-};
-
-#endif
-
-/** @}
- */
Index: pace/dist/src/c/demos/hello/build
===================================================================
--- uspace/dist/src/c/demos/hello/build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-cc -E -o hello.i hello.c
-cc -S -o hello.s hello.i
-as -o hello.o hello.s
-ld -T /inc/_link.ld -o hello hello.o /lib/libc.a -lgcc
Index: pace/dist/src/c/demos/hello/build.gcc
===================================================================
--- uspace/dist/src/c/demos/hello/build.gcc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-gcc -nostdlib -nostdinc -I/inc/c -Wl,-T/inc/_link.ld -L/lib -lc -lgcc -o hello hello.c
-
Index: pace/dist/src/c/demos/hello/clean
===================================================================
--- uspace/dist/src/c/demos/hello/clean	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-rm hello
-rm hello.o
-rm hello.s
-rm hello.i
Index: pace/dist/src/c/demos/hello/hello.c
===================================================================
--- uspace/dist/src/c/demos/hello/hello.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,17 +1,0 @@
-typedef int errno_t;
-extern errno_t putchar(char);
-
-#define TERMINATOR '!'
-
-int main(void)
-{
-	/* Prints "hello" to the standard output. */
-	putchar('h');
-	putchar('e');
-	putchar('l');
-	putchar('l');
-	putchar('o');
-	putchar(TERMINATOR);
-	putchar('\n');
-	return 0;
-}
Index: pace/dist/src/c/demos/tetris/build
===================================================================
--- uspace/dist/src/c/demos/tetris/build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,16 +1,0 @@
-cc -D__PCC__ -I/inc/c -E -o scores.i scores.c
-cc -D__PCC__ -I/inc/c -E -o screen.i screen.c
-cc -D__PCC__ -I/inc/c -E -o shapes.i shapes.c
-cc -D__PCC__ -I/inc/c -E -o tetris.i tetris.c
-
-cc -S -o scores.s scores.i
-cc -S -o screen.s screen.i
-cc -S -o shapes.s shapes.i
-cc -S -o tetris.s tetris.i
-
-as -o scores.o scores.s
-as -o screen.o screen.s
-as -o shapes.o shapes.s
-as -o tetris.o tetris.s
-
-ld -T /inc/_link.ld -o tetris_ scores.o screen.o shapes.o tetris.o /lib/libc.a -lgcc
Index: pace/dist/src/c/demos/tetris/build.gcc
===================================================================
--- uspace/dist/src/c/demos/tetris/build.gcc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-gcc -nostdinc -I/inc/c -c -Drestrict= scores.c
-gcc -nostdinc -I/inc/c -c -Drestrict= screen.c
-gcc -nostdinc -I/inc/c -c -Drestrict= shapes.c
-gcc -nostdinc -I/inc/c -c -Drestrict= tetris.c
-gcc -nostdlib -Wl,-T/inc/_link.ld -L/lib -o tetris_ scores.o screen.o shapes.o tetris.o -lc -lgcc
-
Index: pace/dist/src/c/demos/tetris/clean
===================================================================
--- uspace/dist/src/c/demos/tetris/clean	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,16 +1,0 @@
-rm tetris_
-
-rm scores.o
-rm screen.o
-rm shapes.o
-rm tetris.o
-
-rm scores.s
-rm screen.s
-rm shapes.s
-rm tetris.s
-
-rm scores.i
-rm screen.i
-rm shapes.i
-rm tetris.i
Index: pace/dist/src/c/demos/tetris/scores.c
===================================================================
--- uspace/dist/src/c/demos/tetris/scores.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * scores.c 8.1 (Berkeley) 5/31/93
- * NetBSD: scores.c,v 1.2 1995/04/22 07:42:38 cgd
- * OpenBSD: scores.c,v 1.11 2006/04/20 03:25:36 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Score code for Tetris, by Darren Provine (kilroy@gboro.glassboro.edu)
- * modified 22 January 1992, to limit the number of entries any one
- * person has.
- *
- * Major whacks since then.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <vfs/vfs.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <err.h>
-#include <time.h>
-#include "screen.h"
-#include "tetris.h"
-#include "scores.h"
-
-/*
- * Within this code, we can hang onto one extra "high score", leaving
- * room for our current score (whether or not it is high).
- *
- * We also sometimes keep tabs on the "highest" score on each level.
- * As long as the scores are kept sorted, this is simply the first one at
- * that level.
- */
-
-#define NUMSPOTS  (MAXHISCORES + 1)
-#define NLEVELS   (MAXLEVEL + 1)
-
-static struct highscore scores[NUMSPOTS];
-
-/** Copy from hiscore table score with index src to dest
- *
- */
-static void copyhiscore(int dest, int src)
-{
-	str_cpy(scores[dest].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
-	    scores[src].hs_name);
-	scores[dest].hs_score = scores[src].hs_score;
-	scores[dest].hs_level = scores[src].hs_level;
-}
-
-void showscores(int firstgame)
-{
-	int i;
-
-	clear_screen();
-	moveto(10, 0);
-	printf("\tRank \tLevel \tName\t                     points\n");
-	printf("\t========================================================\n");
-
-	for (i = 0; i < NUMSPOTS - 1; i++)
-		printf("\t%6d %6d %-16s %20d\n",
-		    i + 1, scores[i].hs_level, scores[i].hs_name, scores[i].hs_score);
-
-	if (!firstgame) {
-		printf("\t========================================================\n");
-		printf("\t  Last %6d %-16s %20d\n",
-		    scores[NUMSPOTS - 1].hs_level, scores[NUMSPOTS - 1].hs_name, scores[NUMSPOTS - 1].hs_score);
-	}
-
-	printf("\n\n\n\n\tPress any key to return to main menu.");
-	getchar();
-}
-
-void insertscore(int score, int level)
-{
-	int i;
-	int j;
-	size_t off;
-	cons_event_t ev;
-	kbd_event_t *kev;
-
-	clear_screen();
-	moveto(10, 10);
-	fputs("Insert your name: ", stdout);
-	str_cpy(scores[NUMSPOTS - 1].hs_name, STR_BOUNDS(MAXLOGNAME) + 1,
-	    "Player");
-	i = 6;
-	off = 6;
-
-	moveto(10, 28);
-	printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME - i,
-	    "........................................");
-
-	while (true) {
-		console_flush(console);
-		if (!console_get_event(console, &ev))
-			exit(1);
-
-		if (ev.type != CEV_KEY || ev.ev.key.type == KEY_RELEASE)
-			continue;
-
-		kev = &ev.ev.key;
-
-		if (kev->key == KC_ENTER || kev->key == KC_NENTER)
-			break;
-
-		if (kev->key == KC_BACKSPACE) {
-			if (i > 0) {
-				char32_t uc;
-
-				--i;
-				while (off > 0) {
-					--off;
-					size_t otmp = off;
-					uc = str_decode(scores[NUMSPOTS - 1].hs_name,
-					    &otmp, STR_BOUNDS(MAXLOGNAME) + 1);
-					if (uc != U_SPECIAL)
-						break;
-				}
-
-				scores[NUMSPOTS - 1].hs_name[off] = '\0';
-			}
-		} else if (kev->c != '\0') {
-			if (i < (MAXLOGNAME - 1)) {
-				if (chr_encode(kev->c, scores[NUMSPOTS - 1].hs_name,
-				    &off, STR_BOUNDS(MAXLOGNAME) + 1) == EOK) {
-					++i;
-				}
-				scores[NUMSPOTS - 1].hs_name[off] = '\0';
-			}
-		}
-
-		moveto(10, 28);
-		printf("%s%.*s", scores[NUMSPOTS - 1].hs_name, MAXLOGNAME - i,
-		    "........................................");
-	}
-
-	scores[NUMSPOTS - 1].hs_score = score;
-	scores[NUMSPOTS - 1].hs_level = level;
-
-	i = NUMSPOTS - 1;
-	while ((i > 0) && (scores[i - 1].hs_score < score))
-		i--;
-
-	for (j = NUMSPOTS - 2; j > i; j--)
-		copyhiscore(j, j - 1);
-
-	copyhiscore(i, NUMSPOTS - 1);
-}
-
-void initscores(void)
-{
-	int i;
-	for (i = 0; i < NUMSPOTS; i++) {
-		str_cpy(scores[i].hs_name, STR_BOUNDS(MAXLOGNAME) + 1, "HelenOS Team");
-		scores[i].hs_score = (NUMSPOTS - i) * 200;
-		scores[i].hs_level = (i + 1 > MAXLEVEL ? MAXLEVEL : i + 1);
-	}
-}
-
-errno_t loadscores(void)
-{
-	FILE *f;
-	size_t cnt;
-	errno_t rc;
-
-	f = fopen("/data/tetris.sco", "rb");
-	if (f == NULL)
-		return ENOENT;
-
-	cnt = fread(scores, sizeof(struct highscore), NUMSPOTS, f);
-	rc = fclose(f);
-
-	if (cnt != NUMSPOTS || rc != 0)
-		return EIO;
-
-	return EOK;
-}
-
-void savescores(void)
-{
-	FILE *f;
-	size_t cnt;
-	errno_t rc;
-
-	f = fopen("/data/tetris.sco", "wb");
-	if (f == NULL) {
-		printf("Error creating table\n");
-		return;
-	}
-
-	cnt = fwrite(scores, sizeof(struct highscore), NUMSPOTS, f);
-	rc = fclose(f);
-
-	if (cnt != NUMSPOTS || rc != 0)
-		printf("Error saving score table\n");
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/scores.h
===================================================================
--- uspace/dist/src/c/demos/tetris/scores.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * scores.h 8.1 (Berkeley) 5/31/93
- * NetBSD: scores.h,v 1.2 1995/04/22 07:42:40 cgd
- * OpenBSD: scores.h,v 1.5 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris scores.
- */
-
-#include <time.h>
-#include <str.h>
-
-#define MAXLOGNAME   16
-#define MAXHISCORES  10
-#define MAXSCORES    9  /* maximum high score entries per person */
-#define EXPIRATION   (5L * 365 * 24 * 60 * 60)
-
-struct highscore {
-	char hs_name[STR_BOUNDS(MAXLOGNAME) + 1];  /* login name */
-	int hs_score;                              /* raw score */
-	int hs_level;                              /* play level */
-	time_t hs_time;                            /* time at game end */
-};
-
-extern void showscores(int);
-extern void initscores(void);
-extern void insertscore(int score, int level);
-extern errno_t loadscores(void);
-extern void savescores(void);
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/screen.c
===================================================================
--- uspace/dist/src/c/demos/tetris/screen.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * screen.c 8.1 (Berkeley) 5/31/93
- * NetBSD: screen.c,v 1.4 1995/04/29 01:11:36 mycroft
- * OpenBSD: screen.c,v 1.13 2006/04/20 03:25:36 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris screen control.
- */
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <async.h>
-#include <stdbool.h>
-#include <io/console.h>
-#include <io/style.h>
-#include "screen.h"
-#include "tetris.h"
-
-#define STOP  (B_COLS - 3)
-
-static cell curscreen[B_SIZE];  /* non-zero => standout (or otherwise marked) */
-static int curscore;
-static int isset;               /* true => terminal is in game mode */
-
-static bool use_color;          /* true => use colors */
-
-static const struct shape *lastshape;
-
-static suseconds_t timeleft = 0;
-
-console_ctrl_t *console;
-
-/*
- * putstr() is for unpadded strings (either as in termcap(5) or
- * simply literal strings);
- */
-static inline void putstr(const char *s)
-{
-	while (*s)
-		putchar(*(s++));
-}
-
-static void start_standout(uint32_t color)
-{
-	console_flush(console);
-	console_set_rgb_color(console, use_color ? color : 0x000000,
-	    0xffffff);
-}
-
-static void resume_normal(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_NORMAL);
-}
-
-void clear_screen(void)
-{
-	console_clear(console);
-	moveto(0, 0);
-}
-
-/*
- * Clear the screen, forgetting the current contents in the process.
- */
-void scr_clear(void)
-{
-	resume_normal();
-	console_clear(console);
-	curscore = -1;
-	memset(curscreen, 0, sizeof(curscreen));
-}
-
-/*
- * Set up screen
- */
-void scr_init(void)
-{
-	console_cursor_visibility(console, 0);
-	resume_normal();
-	scr_clear();
-}
-
-void moveto(sysarg_t r, sysarg_t c)
-{
-	console_flush(console);
-	console_set_pos(console, c, r);
-}
-
-winsize_t winsize;
-
-static int get_display_size(winsize_t *ws)
-{
-	return console_get_size(console, &ws->ws_col, &ws->ws_row);
-}
-
-static bool get_display_color_sup(void)
-{
-	sysarg_t ccap;
-	errno_t rc = console_get_color_cap(console, &ccap);
-
-	if (rc != EOK)
-		return false;
-
-	return ((ccap & CONSOLE_CAP_RGB) == CONSOLE_CAP_RGB);
-}
-
-/*
- * Set up screen mode.
- */
-void scr_set(void)
-{
-	winsize_t ws;
-
-	Rows = 0;
-	Cols = 0;
-
-	if (get_display_size(&ws) == 0) {
-		Rows = ws.ws_row;
-		Cols = ws.ws_col;
-	}
-
-	use_color = get_display_color_sup();
-
-	if ((Rows < MINROWS) || (Cols < MINCOLS)) {
-		char smallscr[55];
-
-		snprintf(smallscr, sizeof(smallscr),
-		    "the screen is too small (must be at least %dx%d)",
-		    MINROWS, MINCOLS);
-		stop(smallscr);
-	}
-	isset = 1;
-
-	scr_clear();
-}
-
-/*
- * End screen mode.
- */
-void scr_end(void)
-{
-	console_cursor_visibility(console, 1);
-}
-
-void stop(const char *why)
-{
-	if (isset)
-		scr_end();
-
-	errx(1, "aborting: %s", why);
-}
-
-/*
- * Update the screen.
- */
-void scr_update(void)
-{
-	cell *bp;
-	cell *sp;
-	cell so;
-	cell cur_so = 0;
-	int i;
-	int j;
-	int ccol;
-
-	/* Always leave cursor after last displayed point */
-	curscreen[D_LAST * B_COLS - 1] = -1;
-
-	if (score != curscore) {
-		moveto(0, 0);
-		printf("Score: %d", score);
-		curscore = score;
-	}
-
-	/* Draw preview of next pattern */
-	if ((showpreview) && (nextshape != lastshape)) {
-		int i;
-		static int r = 5, c = 2;
-		int tr, tc, t;
-
-		lastshape = nextshape;
-
-		/* Clean */
-		resume_normal();
-		moveto(r - 1, c - 1);
-		putstr("          ");
-		moveto(r, c - 1);
-		putstr("          ");
-		moveto(r + 1, c - 1);
-		putstr("          ");
-		moveto(r + 2, c - 1);
-		putstr("          ");
-
-		moveto(r - 3, c - 2);
-		putstr("Next shape:");
-
-		/* Draw */
-		start_standout(nextshape->color);
-		moveto(r, 2 * c);
-		putstr("  ");
-		for (i = 0; i < 3; i++) {
-			t = c + r * B_COLS;
-			t += nextshape->off[i];
-
-			tr = t / B_COLS;
-			tc = t % B_COLS;
-
-			moveto(tr, 2 * tc);
-			putstr("  ");
-		}
-		resume_normal();
-	}
-
-	bp = &board[D_FIRST * B_COLS];
-	sp = &curscreen[D_FIRST * B_COLS];
-	for (j = D_FIRST; j < D_LAST; j++) {
-		ccol = -1;
-		for (i = 0; i < B_COLS; bp++, sp++, i++) {
-			if (*sp == (so = *bp))
-				continue;
-
-			*sp = so;
-			if (i != ccol) {
-				if (cur_so) {
-					resume_normal();
-					cur_so = 0;
-				}
-				moveto(RTOD(j), CTOD(i));
-			}
-
-			if (so != cur_so) {
-				if (so)
-					start_standout(so);
-				else
-					resume_normal();
-				cur_so = so;
-			}
-			putstr("  ");
-
-			ccol = i + 1;
-			/*
-			 * Look ahead a bit, to avoid extra motion if
-			 * we will be redrawing the cell after the next.
-			 * Motion probably takes four or more characters,
-			 * so we save even if we rewrite two cells
-			 * `unnecessarily'.  Skip it all, though, if
-			 * the next cell is a different color.
-			 */
-
-			if ((i > STOP) || (sp[1] != bp[1]) || (so != bp[1]))
-				continue;
-
-			if (sp[2] != bp[2])
-				sp[1] = -1;
-			else if ((i < STOP) && (so == bp[2]) && (sp[3] != bp[3])) {
-				sp[2] = -1;
-				sp[1] = -1;
-			}
-		}
-	}
-
-	if (cur_so)
-		resume_normal();
-
-	console_flush(console);
-}
-
-/*
- * Write a message (set != 0), or clear the same message (set == 0).
- * (We need its length in case we have to overwrite with blanks.)
- */
-void scr_msg(char *s, bool set)
-{
-	int l = str_size(s);
-
-	moveto(Rows - 2, ((Cols - l) >> 1) - 1);
-
-	if (set)
-		putstr(s);
-	else
-		while (--l >= 0)
-			(void) putchar(' ');
-}
-
-/** Sleep for the current turn time
- *
- * Eat any input that might be available.
- *
- */
-void tsleep(void)
-{
-	suseconds_t timeout = fallrate;
-
-	while (timeout > 0) {
-		cons_event_t event;
-
-		if (!console_get_event_timeout(console, &event, &timeout))
-			break;
-	}
-}
-
-/** Get char with timeout
- *
- */
-errno_t tgetchar(void)
-{
-	/*
-	 * Reset timeleft to fallrate whenever it is not positive
-	 * and increase speed.
-	 */
-
-	if (timeleft <= 0) {
-		faster();
-		timeleft = fallrate;
-	}
-
-	/*
-	 * Wait to see if there is any input. If so, take it and
-	 * update timeleft so that the next call to tgetchar()
-	 * will not wait as long. If there is no input,
-	 * make timeleft zero and return -1.
-	 */
-
-	char32_t c = 0;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		if (!console_get_event_timeout(console, &event, &timeleft)) {
-			timeleft = 0;
-			return -1;
-		}
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	return (int) c;
-}
-
-/** Get char without timeout
- *
- */
-errno_t twait(void)
-{
-	char32_t c = 0;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		if (!console_get_event(console, &event))
-			return -1;
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	return (int) c;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/screen.h
===================================================================
--- uspace/dist/src/c/demos/tetris/screen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * screen.h 8.1 (Berkeley) 5/31/93
- * NetBSD: screen.h,v 1.2 1995/04/22 07:42:42 cgd
- * OpenBSD: screen.h,v 1.5 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * putpad() is for padded strings with count = 1.
- */
-#define putpad(s)  tputs(s, 1, put)
-
-#include <types/common.h>
-#include <io/console.h>
-#include <async.h>
-#include <stdbool.h>
-
-typedef struct {
-	sysarg_t ws_row;
-	sysarg_t ws_col;
-} winsize_t;
-
-extern console_ctrl_t *console;
-extern winsize_t winsize;
-
-extern void moveto(sysarg_t r, sysarg_t c);
-extern void clear_screen(void);
-
-extern errno_t put(int);
-extern void scr_clear(void);
-extern void scr_end(void);
-extern void scr_init(void);
-extern void scr_msg(char *, bool);
-extern void scr_set(void);
-extern void scr_update(void);
-
-extern void tsleep(void);
-extern errno_t tgetchar(void);
-extern errno_t twait(void);
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/shapes.c
===================================================================
--- uspace/dist/src/c/demos/tetris/shapes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * shapes.c 8.1 (Berkeley) 5/31/93
- * NetBSD: shapes.c,v 1.2 1995/04/22 07:42:44 cgd
- * OpenBSD: shapes.c,v 1.8 2004/07/10 07:26:24 deraadt
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-/*
- * Tetris shapes and related routines.
- *
- * Note that the first 7 are `well known'.
- */
-
-#include "tetris.h"
-
-#define TL  (-B_COLS - 1)  /* top left */
-#define TC  (-B_COLS)      /* top center */
-#define TR  (-B_COLS + 1)  /* top right */
-#define ML  -1             /* middle left */
-#define MR  1              /* middle right */
-#define BL  (B_COLS - 1)   /* bottom left */
-#define BC  B_COLS         /* bottom center */
-#define BR  (B_COLS + 1)   /* bottom right */
-
-const struct shape shapes[] = {
-	/*  0 */  {  7,  7, { TL, TC, MR }, 0x00aaaa },
-	/*  1 */  {  8,  8, { TC, TR, ML }, 0x00aa00 },
-	/*  2 */  {  9, 11, { ML, MR, BC }, 0xaa5500 },
-	/*  3 */  {  3,  3, { TL, TC, ML }, 0x0000aa },
-	/*  4 */  { 12, 14, { ML, BL, MR }, 0xaa00aa },
-	/*  5 */  { 15, 17, { ML, BR, MR }, 0xffa500 },
-	/*  6 */  { 18, 18, { ML, MR, 2  }, 0xaa0000 },  /* sticks out */
-	/*  7 */  {  0,  0, { TC, ML, BL }, 0x00aaaa },
-	/*  8 */  {  1,  1, { TC, MR, BR }, 0x00aa00 },
-	/*  9 */  { 10,  2, { TC, MR, BC }, 0xaa5500 },
-	/* 10 */  { 11,  9, { TC, ML, MR }, 0xaa5500 },
-	/* 11 */  {  2, 10, { TC, ML, BC }, 0xaa5500 },
-	/* 12 */  { 13,  4, { TC, BC, BR }, 0xaa00aa },
-	/* 13 */  { 14, 12, { TR, ML, MR }, 0xaa00aa },
-	/* 14 */  {  4, 13, { TL, TC, BC }, 0xaa00aa },
-	/* 15 */  { 16,  5, { TR, TC, BC }, 0xffa500 },
-	/* 16 */  { 17, 15, { TL, MR, ML }, 0xffa500 },
-	/* 17 */  {  5, 16, { TC, BC, BL }, 0xffa500 },
-	/* 18 */  {  6,  6, { TC, BC, 2 * B_COLS }, 0xaa0000 }  /* sticks out */
-};
-
-/*
- * Return true iff the given shape fits in the given position,
- * taking the current board into account.
- */
-errno_t fits_in(const struct shape *shape, int pos)
-{
-	const int *o = shape->off;
-
-	if ((board[pos]) || (board[pos + *o++]) || (board[pos + *o++]) ||
-	    (board[pos + *o]))
-		return 0;
-
-	return 1;
-}
-
-/*
- * Write the given shape into the current board, turning it on
- * if `onoff' is 1, and off if `onoff' is 0.
- */
-void place(const struct shape *shape, int pos, int onoff)
-{
-	const int *o = shape->off;
-
-	board[pos] = onoff ? shape->color : 0x000000;
-	board[pos + *o++] = onoff ? shape->color : 0x000000;
-	board[pos + *o++] = onoff ? shape->color : 0x000000;
-	board[pos + *o] = onoff ? shape->color : 0x000000;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/tetris.c
===================================================================
--- uspace/dist/src/c/demos/tetris/tetris.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,451 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * tetris.c 8.1 (Berkeley) 5/31/93
- * NetBSD: tetris.c,v 1.2 1995/04/22 07:42:47 cgd
- * OpenBSD: tetris.c,v 1.21 2006/04/20 03:24:12 ray
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris Tetris
- * @brief Tetris ported from OpenBSD
- * @{
- */
-/** @file
- */
-
-static volatile const char copyright[] =
-    "@(#) Copyright (c) 1992, 1993\n"
-    "\tThe Regents of the University of California.  All rights reserved.\n";
-
-#include <time.h>
-#include <err.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str.h>
-#include <getopt.h>
-#include "scores.h"
-#include "screen.h"
-#include "tetris.h"
-
-cell board[B_SIZE];
-
-int Rows;
-int Cols;
-
-const struct shape *curshape;
-const struct shape *nextshape;
-
-long fallrate;
-int score;
-char key_msg[100];
-int showpreview;
-int classic;
-
-static void elide(void);
-static void setup_board(void);
-static const struct shape *randshape(void);
-
-static void usage(void);
-
-static int firstgame = 1;
-
-/*
- * Set up the initial board. The bottom display row is completely set,
- * along with another (hidden) row underneath that. Also, the left and
- * right edges are set.
- */
-static void setup_board(void)
-{
-	int i;
-	cell *p = board;
-
-	for (i = B_SIZE; i; i--)
-		*p++ = (i <= (2 * B_COLS) || (i % B_COLS) < 2) ? 0x0000ff : 0x000000;
-}
-
-/*
- * Elide any full active rows.
- */
-static void elide(void)
-{
-	int rows = 0;
-	int i;
-	int j;
-	int base;
-	cell *p;
-
-	for (i = A_FIRST; i < A_LAST; i++) {
-		base = i * B_COLS + 1;
-		p = &board[base];
-		j = B_COLS - 2;
-		while (*p++ != 0) {
-			if (--j <= 0) {
-				/* This row is to be elided */
-				rows++;
-				memset(&board[base], 0, sizeof(cell) * (B_COLS - 2));
-
-				scr_update();
-				tsleep();
-
-				while (--base != 0)
-					board[base + B_COLS] = board[base];
-
-				scr_update();
-				tsleep();
-
-				break;
-			}
-		}
-	}
-
-	switch (rows) {
-	case 1:
-		score += 10;
-		break;
-	case 2:
-		score += 30;
-		break;
-	case 3:
-		score += 70;
-		break;
-	case 4:
-		score += 150;
-		break;
-	default:
-		break;
-	}
-}
-
-const struct shape *randshape(void)
-{
-	const struct shape *tmp = &shapes[rand() % 7];
-	int i;
-	int j = rand() % 4;
-
-	for (i = 0; i < j; i++)
-		tmp = &shapes[classic ? tmp->rotc : tmp->rot];
-
-	return (tmp);
-}
-
-static void srandomdev(void)
-{
-	struct timespec ts;
-
-	getuptime(&ts);
-	srand(tv.tv_sec + tv.tv_nsec / 100000000);
-}
-
-static void tetris_menu_draw(int level)
-{
-	clear_screen();
-	moveto(5, 10);
-	puts("Tetris\n");
-
-	moveto(8, 10);
-	printf("Level = %d (press keys 1 - 9 to change)", level);
-	moveto(9, 10);
-	printf("Preview is %s (press 'p' to change)", (showpreview ? "on " : "off"));
-	moveto(12, 10);
-	printf("Press 'h' to show hiscore table.");
-	moveto(13, 10);
-	printf("Press 's' to start game.");
-	moveto(14, 10);
-	printf("Press 'q' to quit game.");
-	moveto(20, 10);
-	printf("In game controls:");
-	moveto(21, 0);
-	puts(key_msg);
-}
-
-static int tetris_menu(int *level)
-{
-	tetris_menu_draw(*level);
-	while (true) {
-		int i = getchar();
-
-		switch (i) {
-		case 'p':
-			showpreview = !showpreview;
-			moveto(9, 21);
-			if (showpreview)
-				printf("on ");
-			else
-				printf("off");
-			break;
-		case 'h':
-			loadscores();
-			showscores(firstgame);
-			tetris_menu_draw(*level);
-			break;
-		case 's':
-			firstgame = 0;
-			return 1;
-		case 'q':
-			return 0;
-		case '1':
-		case '2':
-		case '3':
-		case '4':
-		case '5':
-		case '6':
-		case '7':
-		case '8':
-		case '9':
-			*level = i - '0';
-			moveto(8, 18);
-			printf("%d", *level);
-			break;
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int pos;
-	int c;
-	const char *keys;
-	int level = 2;
-	char key_write[6][10];
-	int i;
-	int j;
-	int ch;
-
-	console = console_init(stdin, stdout);
-
-	keys = "jkl pq";
-
-	classic = 0;
-	showpreview = 1;
-
-	while ((ch = getopt(argc, argv, "ck:ps")) != -1)
-		switch (ch) {
-		case 'c':
-			/*
-			 * this means:
-			 *  - rotate the other way
-			 *  - no reverse video
-			 */
-			classic = 1;
-			break;
-		case 'k':
-			if (str_size(keys = optarg) != 6)
-				usage();
-			break;
-		case 'p':
-			showpreview = 1;
-			break;
-		case 's':
-			showscores(0);
-			exit(0);
-		default:
-			usage();
-		}
-
-	argc -= optind;
-	argv += optind;
-
-	if (argc)
-		usage();
-
-	for (i = 0; i <= 5; i++) {
-		for (j = i + 1; j <= 5; j++) {
-			if (keys[i] == keys[j])
-				errx(1, "%s", "duplicate command keys specified.");
-		}
-
-		if (keys[i] == ' ')
-			str_cpy(key_write[i], sizeof(key_write[i]), "<space>");
-		else {
-			key_write[i][0] = keys[i];
-			key_write[i][1] = '\0';
-		}
-	}
-
-	snprintf(key_msg, sizeof(key_msg),
-	    "%s - left   %s - rotate   %s - right   %s - drop   %s - pause   %s - quit",
-	    key_write[0], key_write[1], key_write[2], key_write[3],
-	    key_write[4], key_write[5]);
-
-	scr_init();
-	if (loadscores() != EOK)
-		initscores();
-
-	while (tetris_menu(&level)) {
-		fallrate = 1000000 / level;
-
-		scr_clear();
-		setup_board();
-
-		srandomdev();
-		scr_set();
-
-		pos = A_FIRST * B_COLS + (B_COLS / 2) - 1;
-		nextshape = randshape();
-		curshape = randshape();
-
-		scr_msg(key_msg, 1);
-
-		while (true) {
-			place(curshape, pos, 1);
-			scr_update();
-			place(curshape, pos, 0);
-			c = tgetchar();
-			if (c < 0) {
-				/*
-				 * Timeout.  Move down if possible.
-				 */
-				if (fits_in(curshape, pos + B_COLS)) {
-					pos += B_COLS;
-					continue;
-				}
-
-				/*
-				 * Put up the current shape `permanently',
-				 * bump score, and elide any full rows.
-				 */
-				place(curshape, pos, 1);
-				score++;
-				elide();
-
-				/*
-				 * Choose a new shape.  If it does not fit,
-				 * the game is over.
-				 */
-				curshape = nextshape;
-				nextshape = randshape();
-				pos = A_FIRST * B_COLS + (B_COLS / 2) - 1;
-
-				if (!fits_in(curshape, pos))
-					break;
-
-				continue;
-			}
-
-			/*
-			 * Handle command keys.
-			 */
-			if (c == keys[5]) {
-				/* quit */
-				break;
-			}
-
-			if (c == keys[4]) {
-				static char msg[] =
-				    "paused - press RETURN to continue";
-
-				place(curshape, pos, 1);
-				do {
-					scr_update();
-					scr_msg(key_msg, 0);
-					scr_msg(msg, 1);
-					console_flush(console);
-				} while (!twait());
-
-				scr_msg(msg, 0);
-				scr_msg(key_msg, 1);
-				place(curshape, pos, 0);
-				continue;
-			}
-
-			if (c == keys[0]) {
-				/* move left */
-				if (fits_in(curshape, pos - 1))
-					pos--;
-				continue;
-			}
-
-			if (c == keys[1]) {
-				/* turn */
-				const struct shape *new =
-				    &shapes[classic ? curshape->rotc : curshape->rot];
-
-				if (fits_in(new, pos))
-					curshape = new;
-				continue;
-			}
-
-			if (c == keys[2]) {
-				/* move right */
-				if (fits_in(curshape, pos + 1))
-					pos++;
-				continue;
-			}
-
-			if (c == keys[3]) {
-				/* move to bottom */
-				while (fits_in(curshape, pos + B_COLS)) {
-					pos += B_COLS;
-					score++;
-				}
-				continue;
-			}
-
-			if (c == '\f') {
-				scr_clear();
-				scr_msg(key_msg, 1);
-			}
-		}
-
-		scr_clear();
-		loadscores();
-		insertscore(score, level);
-		savescores();
-		score = 0;
-	}
-
-	scr_clear();
-	printf("\nGame over.\n");
-	scr_end();
-
-	return 0;
-}
-
-void usage(void)
-{
-	fprintf(stderr, "usage: tetris [-ps] [-k keys]\n");
-	exit(1);
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/tetris/tetris.h
===================================================================
--- uspace/dist/src/c/demos/tetris/tetris.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,201 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** Attributations
- *
- * tetris.h 8.1 (Berkeley) 5/31/93
- * NetBSD: tetris.h,v 1.2 1995/04/22 07:42:48 cgd
- * OpenBSD: tetris.h,v 1.9 2003/06/03 03:01:41 millert
- *
- * Based upon BSD Tetris
- *
- * Copyright (c) 1992, 1993
- *      The Regents of the University of California.
- *      Distributed under BSD license.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek and Darren F. Provine.
- *
- */
-
-/** @addtogroup tetris
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-
-/*
- * Definitions for Tetris.
- */
-
-/*
- * The display (`board') is composed of 23 rows of 12 columns of characters
- * (numbered 0..22 and 0..11), stored in a single array for convenience.
- * Columns 1 to 10 of rows 1 to 20 are the actual playing area, where
- * shapes appear.  Columns 0 and 11 are always occupied, as are all
- * columns of rows 21 and 22.  Rows 0 and 22 exist as boundary areas
- * so that regions `outside' the visible area can be examined without
- * worrying about addressing problems.
- */
-
-/* The board */
-#define B_COLS  12
-#define B_ROWS  23
-#define B_SIZE  (B_ROWS * B_COLS)
-
-typedef uint32_t cell;
-
-extern cell board[B_SIZE];  /* 1 => occupied, 0 => empty */
-
-/* The displayed area (rows) */
-#define D_FIRST  1
-#define D_LAST   22
-
-/* The active area (rows) */
-#define A_FIRST  1
-#define A_LAST   21
-
-/*
- * Minimum display size.
- */
-#define MINROWS  23
-#define MINCOLS  40
-
-/* Current screen size */
-extern int Rows;
-extern int Cols;
-
-/*
- * Translations from board coordinates to display coordinates.
- * As with board coordinates, display coordiates are zero origin.
- */
-#define RTOD(x)  ((x) - 1)
-#define CTOD(x)  ((x) * 2 + (((Cols - 2 * B_COLS) >> 1) - 1))
-
-/*
- * A `shape' is the fundamental thing that makes up the game.  There
- * are 7 basic shapes, each consisting of four `blots':
- *
- *      X.X       X.X           X.X
- *        X.X   X.X     X.X.X   X.X     X.X.X   X.X.X   X.X.X.X
- *                        X             X           X
- *
- *          0     1       2       3       4       5       6
- *
- * Except for 3 and 6, the center of each shape is one of the blots.
- * This blot is designated (0, 0).  The other three blots can then be
- * described as offsets from the center.  Shape 3 is the same under
- * rotation, so its center is effectively irrelevant; it has been chosen
- * so that it `sticks out' upward and leftward.  Except for shape 6,
- * all the blots are contained in a box going from (-1, -1) to (+1, +1);
- * shape 6's center `wobbles' as it rotates, so that while it `sticks out'
- * rightward, its rotation---a vertical line---`sticks out' downward.
- * The containment box has to include the offset (2, 0), making the overall
- * containment box range from offset (-1, -1) to (+2, +1).  (This is why
- * there is only one row above, but two rows below, the display area.)
- *
- * The game works by choosing one of these shapes at random and putting
- * its center at the middle of the first display row (row 1, column 5).
- * The shape is moved steadily downward until it collides with something:
- * either  another shape, or the bottom of the board.  When the shape can
- * no longer be moved downwards, it is merged into the current board.
- * At this time, any completely filled rows are elided, and blots above
- * these rows move down to make more room.  A new random shape is again
- * introduced at the top of the board, and the whole process repeats.
- * The game ends when the new shape will not fit at (1, 5).
- *
- * While the shapes are falling, the user can rotate them counterclockwise
- * 90 degrees (in addition to moving them left or right), provided that the
- * rotation puts the blots in empty spaces.  The table of shapes is set up
- * so that each shape contains the index of the new shape obtained by
- * rotating the current shape.  Due to symmetry, each shape has exactly
- * 1, 2, or 4 rotations total; the first 7 entries in the table represent
- * the primary shapes, and the remaining 12 represent their various
- * rotated forms.
- */
-struct shape {
-	int rot;     /* index of rotated version of this shape */
-	int rotc;    /* -- " -- in classic version  */
-	int off[3];  /* offsets to other blots if center is at (0,0) */
-	uint32_t color;
-};
-
-extern const struct shape shapes[];
-
-extern const struct shape *curshape;
-extern const struct shape *nextshape;
-
-/*
- * Shapes fall at a rate faster than once per second.
- *
- * The initial rate is determined by dividing 1 million microseconds
- * by the game `level'.  (This is at most 1 million, or one second.)
- * Each time the fall-rate is used, it is decreased a little bit,
- * depending on its current value, via the `faster' macro below.
- * The value eventually reaches a limit, and things stop going faster,
- * but by then the game is utterly impossible.
- */
-extern long fallrate;  /* less than 1 million; smaller => faster */
-
-#define faster()  (fallrate -= fallrate / 3000)
-
-/*
- * Game level must be between 1 and 9.  This controls the initial fall rate
- * and affects scoring.
- */
-#define MINLEVEL  1
-#define MAXLEVEL  9
-
-/*
- * Scoring is as follows:
- *
- * When the shape comes to rest, and is integrated into the board,
- * we score one point.  If the shape is high up (at a low-numbered row),
- * and the user hits the space bar, the shape plummets all the way down,
- * and we score a point for each row it falls (plus one more as soon as
- * we find that it is at rest and integrate it---until then, it can
- * still be moved or rotated).
- *
- * If previewing has been turned on, the score is multiplied by PRE_PENALTY.
- */
-#define PRE_PENALTY  0.75
-
-extern int score;  /* The obvious thing */
-
-extern char key_msg[100];
-extern int showpreview;
-extern int classic;
-
-extern errno_t fits_in(const struct shape *, int);
-extern void place(const struct shape *, int, int);
-extern void stop(const char *);
-
-/** @}
- */
Index: pace/dist/src/c/demos/top/build
===================================================================
--- uspace/dist/src/c/demos/top/build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-cc -D__PCC__ -I/inc/c -E -o screen.i screen.c
-cc -D__PCC__ -I/inc/c -E -o top.i top.c
-
-cc -S -o screen.s screen.i
-cc -S -o top.s top.i
-
-as -o screen.o screen.s
-as -o top.o top.s
-
-ld -T /inc/_link.ld -o top_ screen.o top.o /lib/libc.a -lgcc
Index: pace/dist/src/c/demos/top/clean
===================================================================
--- uspace/dist/src/c/demos/top/clean	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-rm top_
-
-rm top.o
-rm screen.o
-
-rm top.s
-rm screen.s
-
-rm top.i
-rm screen.i
-
Index: pace/dist/src/c/demos/top/screen.c
===================================================================
--- uspace/dist/src/c/demos/top/screen.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,575 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @brief Top utility.
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <io/console.h>
-#include <io/style.h>
-#include <vfs/vfs.h>
-#include <stdarg.h>
-#include <stats.h>
-#include <inttypes.h>
-#include <macros.h>
-#include <str.h>
-#include "screen.h"
-#include "top.h"
-
-#define USEC_COUNT  1000000
-
-static suseconds_t timeleft = 0;
-
-console_ctrl_t *console;
-
-static sysarg_t warning_col = 0;
-static sysarg_t warning_row = 0;
-static suseconds_t warning_timeleft = 0;
-static char *warning_text = NULL;
-
-static void screen_style_normal(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_NORMAL);
-}
-
-static void screen_style_inverted(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_INVERTED);
-}
-
-static void screen_style_emphasis(void)
-{
-	console_flush(console);
-	console_set_style(console, STYLE_EMPHASIS);
-}
-
-static void screen_moveto(sysarg_t col, sysarg_t row)
-{
-	console_flush(console);
-	console_set_pos(console, col, row);
-}
-
-static void screen_get_pos(sysarg_t *col, sysarg_t *row)
-{
-	console_flush(console);
-	console_get_pos(console, col, row);
-}
-
-static void screen_get_size(sysarg_t *col, sysarg_t *row)
-{
-	console_flush(console);
-	console_get_size(console, col, row);
-}
-
-static void screen_restart(bool clear)
-{
-	screen_style_normal();
-
-	if (clear) {
-		console_flush(console);
-		console_clear(console);
-	}
-
-	screen_moveto(0, 0);
-}
-
-static void screen_newline(void)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t c;
-	sysarg_t r;
-	screen_get_pos(&c, &r);
-
-	sysarg_t i;
-	for (i = c + 1; i < cols; i++)
-		fputs(" ", stdout);
-
-	if (r + 1 < rows)
-		puts("");
-}
-
-void screen_init(void)
-{
-	console = console_init(stdin, stdout);
-
-	console_flush(console);
-	console_cursor_visibility(console, false);
-
-	screen_restart(true);
-}
-
-void screen_done(void)
-{
-	free(warning_text);
-	warning_text = NULL;
-
-	screen_restart(true);
-
-	console_flush(console);
-	console_cursor_visibility(console, true);
-}
-
-static void print_percent(fixed_float ffloat, unsigned int precision)
-{
-	printf("%3" PRIu64 ".", ffloat.upper / ffloat.lower);
-
-	unsigned int i;
-	uint64_t rest = (ffloat.upper % ffloat.lower) * 10;
-	for (i = 0; i < precision; i++) {
-		printf("%" PRIu64, rest / ffloat.lower);
-		rest = (rest % ffloat.lower) * 10;
-	}
-
-	printf("%%");
-}
-
-static void print_string(const char *str)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t c;
-	sysarg_t r;
-	screen_get_pos(&c, &r);
-
-	if (c < cols) {
-		int pos = cols - c - 1;
-		printf("%.*s", pos, str);
-	}
-}
-
-static inline void print_global_head(data_t *data)
-{
-	printf("top - %02lu:%02lu:%02lu up "
-	    "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", "
-	    "load average:",
-	    data->hours, data->minutes, data->seconds,
-	    data->udays, data->uhours, data->uminutes, data->useconds);
-
-	size_t i;
-	for (i = 0; i < data->load_count; i++) {
-		fputs(" ", stdout);
-		stats_print_load_fragment(data->load[i], 2);
-	}
-
-	screen_newline();
-}
-
-static inline void print_task_summary(data_t *data)
-{
-	printf("tasks: %zu total", data->tasks_count);
-	screen_newline();
-}
-
-static inline void print_thread_summary(data_t *data)
-{
-	size_t total = 0;
-	size_t running = 0;
-	size_t ready = 0;
-	size_t sleeping = 0;
-	size_t lingering = 0;
-	size_t other = 0;
-	size_t invalid = 0;
-
-	size_t i;
-	for (i = 0; i < data->threads_count; i++) {
-		total++;
-
-		switch (data->threads[i].state) {
-		case Running:
-			running++;
-			break;
-		case Ready:
-			ready++;
-			break;
-		case Sleeping:
-			sleeping++;
-			break;
-		case Lingering:
-			lingering++;
-			break;
-		case Entering:
-		case Exiting:
-			other++;
-			break;
-		default:
-			invalid++;
-		}
-	}
-
-	printf("threads: %zu total, %zu running, %zu ready, "
-	    "%zu sleeping, %zu lingering, %zu other, %zu invalid",
-	    total, running, ready, sleeping, lingering, other, invalid);
-	screen_newline();
-}
-
-static inline void print_cpu_info(data_t *data)
-{
-	size_t i;
-	for (i = 0; i < data->cpus_count; i++) {
-		if (data->cpus[i].active) {
-			uint64_t busy;
-			uint64_t idle;
-			char busy_suffix;
-			char idle_suffix;
-
-			order_suffix(data->cpus[i].busy_cycles, &busy, &busy_suffix);
-			order_suffix(data->cpus[i].idle_cycles, &idle, &idle_suffix);
-
-			printf("cpu%u (%4" PRIu16 " MHz): busy cycles: "
-			    "%" PRIu64 "%c, idle cycles: %" PRIu64 "%c",
-			    data->cpus[i].id, data->cpus[i].frequency_mhz,
-			    busy, busy_suffix, idle, idle_suffix);
-			fputs(", idle: ", stdout);
-			print_percent(data->cpus_perc[i].idle, 2);
-			fputs(", busy: ", stdout);
-			print_percent(data->cpus_perc[i].busy, 2);
-		} else
-			printf("cpu%u inactive", data->cpus[i].id);
-
-		screen_newline();
-	}
-}
-
-static inline void print_physmem_info(data_t *data)
-{
-	uint64_t total;
-	uint64_t unavail;
-	uint64_t used;
-	uint64_t free;
-	const char *total_suffix;
-	const char *unavail_suffix;
-	const char *used_suffix;
-	const char *free_suffix;
-
-	bin_order_suffix(data->physmem->total, &total, &total_suffix, false);
-	bin_order_suffix(data->physmem->unavail, &unavail, &unavail_suffix, false);
-	bin_order_suffix(data->physmem->used, &used, &used_suffix, false);
-	bin_order_suffix(data->physmem->free, &free, &free_suffix, false);
-
-	printf("memory: %" PRIu64 "%s total, %" PRIu64 "%s unavail, %"
-	    PRIu64 "%s used, %" PRIu64 "%s free", total, total_suffix,
-	    unavail, unavail_suffix, used, used_suffix, free, free_suffix);
-	screen_newline();
-}
-
-static inline void print_help_head(void)
-{
-	screen_style_inverted();
-	printf("Help");
-	screen_newline();
-	screen_style_normal();
-}
-
-static inline void print_help(void)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	screen_newline();
-
-	printf("Operation modes:");
-	screen_newline();
-
-	printf(" t .. tasks statistics");
-	screen_newline();
-
-	printf(" i .. IPC statistics");
-	screen_newline();
-
-	printf(" e .. exceptions statistics");
-	screen_newline();
-
-	printf("      a .. toggle display of all/hot exceptions");
-	screen_newline();
-
-	printf(" h .. toggle this help screen");
-	screen_newline();
-
-	screen_newline();
-
-	printf("Other keys:");
-	screen_newline();
-
-	printf(" s .. choose column to sort by");
-	screen_newline();
-
-	printf(" r .. toggle reversed sorting");
-	screen_newline();
-
-	printf(" q .. quit");
-	screen_newline();
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_table_head(const table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	screen_style_inverted();
-	for (size_t i = 0; i < table->num_columns; i++) {
-		const char *name = table->columns[i].name;
-		int width = table->columns[i].width;
-		if (i != 0) {
-			fputs(" ", stdout);
-		}
-		if (width == 0) {
-			sysarg_t col;
-			sysarg_t row;
-			screen_get_pos(&col, &row);
-			width = cols - col - 1;
-		}
-		printf("[%-*.*s]", width - 2, width - 2, name);
-	}
-	screen_newline();
-	screen_style_normal();
-}
-
-static inline void print_table(const table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	size_t i;
-	for (i = 0; (i < table->num_fields) && (row < rows); i++) {
-		size_t column_index = i % table->num_columns;
-		int width = table->columns[column_index].width;
-		field_t *field = &table->fields[i];
-		uint64_t val;
-		const char *psuffix;
-		char suffix;
-
-		if (column_index != 0) {
-			fputs(" ", stdout);
-		}
-
-		if (width == 0) {
-			screen_get_pos(&col, &row);
-			width = cols - col - 1;
-		}
-
-		switch (field->type) {
-		case FIELD_EMPTY:
-			printf("%*s", width, "");
-			break;
-		case FIELD_UINT:
-			printf("%*" PRIu64, width, field->uint);
-			break;
-		case FIELD_UINT_SUFFIX_BIN:
-			val = field->uint;
-			width -= 3;
-			bin_order_suffix(val, &val, &psuffix, true);
-			printf("%*" PRIu64 "%s", width, val, psuffix);
-			break;
-		case FIELD_UINT_SUFFIX_DEC:
-			val = field->uint;
-			width -= 1;
-			order_suffix(val, &val, &suffix);
-			printf("%*" PRIu64 "%c", width, val, suffix);
-			break;
-		case FIELD_PERCENT:
-			width -= 5; /* nnn.% */
-			if (width > 2) {
-				printf("%*s", width - 2, "");
-				width = 2;
-			}
-			print_percent(field->fixed, width);
-			break;
-		case FIELD_STRING:
-			printf("%-*.*s", width, width, field->string);
-			break;
-		}
-
-		if (column_index == table->num_columns - 1) {
-			screen_newline();
-			row++;
-		}
-	}
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_sort(table_t *table)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	sysarg_t col;
-	sysarg_t row;
-	screen_get_pos(&col, &row);
-
-	size_t num = min(table->num_columns, rows - row);
-	for (size_t i = 0; i < num; i++) {
-		printf("%c - %s", table->columns[i].key, table->columns[i].name);
-		screen_newline();
-		row++;
-	}
-
-	while (row < rows) {
-		screen_newline();
-		row++;
-	}
-}
-
-static inline void print_warning(void)
-{
-	screen_get_pos(&warning_col, &warning_row);
-	if (warning_timeleft > 0) {
-		screen_style_emphasis();
-		print_string(warning_text);
-		screen_style_normal();
-	} else {
-		free(warning_text);
-		warning_text = NULL;
-	}
-	screen_newline();
-}
-
-void print_data(data_t *data)
-{
-	screen_restart(false);
-	print_global_head(data);
-	print_task_summary(data);
-	print_thread_summary(data);
-	print_cpu_info(data);
-	print_physmem_info(data);
-	print_warning();
-
-	switch (screen_mode) {
-	case SCREEN_TABLE:
-		print_table_head(&data->table);
-		print_table(&data->table);
-		break;
-	case SCREEN_SORT:
-		print_sort(&data->table);
-		break;
-	case SCREEN_HELP:
-		print_help_head();
-		print_help();
-	}
-
-	console_flush(console);
-}
-
-void show_warning(const char *fmt, ...)
-{
-	sysarg_t cols;
-	sysarg_t rows;
-	screen_get_size(&cols, &rows);
-
-	size_t warning_text_size = 1 + cols * sizeof(*warning_text);
-	free(warning_text);
-	warning_text = malloc(warning_text_size);
-	if (!warning_text)
-		return;
-
-	va_list args;
-	va_start(args, fmt);
-	vsnprintf(warning_text, warning_text_size, fmt, args);
-	va_end(args);
-
-	warning_timeleft = 2 * USEC_COUNT;
-
-	screen_moveto(warning_col, warning_row);
-	print_warning();
-	console_flush(console);
-}
-
-/** Get char with timeout
- *
- */
-int tgetchar(unsigned int sec)
-{
-	/*
-	 * Reset timeleft whenever it is not positive.
-	 */
-
-	if (timeleft <= 0)
-		timeleft = sec * USEC_COUNT;
-
-	/*
-	 * Wait to see if there is any input. If so, take it and
-	 * update timeleft so that the next call to tgetchar()
-	 * will not wait as long. If there is no input,
-	 * make timeleft zero and return -1.
-	 */
-
-	char32_t c = 0;
-
-	while (c == 0) {
-		cons_event_t event;
-
-		warning_timeleft -= timeleft;
-		if (!console_get_event_timeout(console, &event, &timeleft)) {
-			timeleft = 0;
-			return -1;
-		}
-		warning_timeleft += timeleft;
-
-		if (event.type == CEV_KEY && event.ev.key.type == KEY_PRESS)
-			c = event.ev.key.c;
-	}
-
-	return (int) c;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/top/screen.h
===================================================================
--- uspace/dist/src/c/demos/top/screen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @{
- */
-
-#ifndef TOP_SCREEN_H_
-#define TOP_SCREEN_H_
-
-#include <io/console.h>
-#include <io/verify.h>
-#include "top.h"
-
-extern console_ctrl_t *console;
-
-extern void screen_init(void);
-extern void screen_done(void);
-extern void print_data(data_t *);
-extern void show_warning(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-
-extern int tgetchar(unsigned int);
-
-#endif
-
-/**
- * @}
- */
Index: pace/dist/src/c/demos/top/top.c
===================================================================
--- uspace/dist/src/c/demos/top/top.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,690 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @brief Top utility.
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include <thread.h>
-#include <time.h>
-#include <errno.h>
-#include <gsort.h>
-#include <str.h>
-#include "screen.h"
-#include "top.h"
-
-#define NAME  "top"
-
-#define UPDATE_INTERVAL  1
-
-#define DAY     86400
-#define HOUR    3600
-#define MINUTE  60
-
-typedef enum {
-	OP_TASKS,
-	OP_IPC,
-	OP_EXCS,
-} op_mode_t;
-
-static const column_t task_columns[] = {
-	{ "taskid",   't',  8 },
-	{ "thrds",    'h',  7 },
-	{ "resident", 'r', 10 },
-	{ "%resi",    'R',  7 },
-	{ "virtual",  'v',  9 },
-	{ "%virt",    'V',  7 },
-	{ "%user",    'U',  7 },
-	{ "%kern",    'K',  7 },
-	{ "name",     'd',  0 },
-};
-
-enum {
-	TASK_COL_ID = 0,
-	TASK_COL_NUM_THREADS,
-	TASK_COL_RESIDENT,
-	TASK_COL_PERCENT_RESIDENT,
-	TASK_COL_VIRTUAL,
-	TASK_COL_PERCENT_VIRTUAL,
-	TASK_COL_PERCENT_USER,
-	TASK_COL_PERCENT_KERNEL,
-	TASK_COL_NAME,
-	TASK_NUM_COLUMNS,
-};
-
-static const column_t ipc_columns[] = {
-	{ "taskid",  't', 8 },
-	{ "cls snt", 'c', 9 },
-	{ "cls rcv", 'C', 9 },
-	{ "ans snt", 'a', 9 },
-	{ "ans rcv", 'A', 9 },
-	{ "forward", 'f', 9 },
-	{ "name",    'd', 0 },
-};
-
-enum {
-	IPC_COL_TASKID = 0,
-	IPC_COL_CLS_SNT,
-	IPC_COL_CLS_RCV,
-	IPC_COL_ANS_SNT,
-	IPC_COL_ANS_RCV,
-	IPC_COL_FORWARD,
-	IPC_COL_NAME,
-	IPC_NUM_COLUMNS,
-};
-
-static const column_t exception_columns[] = {
-	{ "exc",         'e',  8 },
-	{ "count",       'n', 10 },
-	{ "%count",      'N',  8 },
-	{ "cycles",      'c', 10 },
-	{ "%cycles",     'C',  9 },
-	{ "description", 'd',  0 },
-};
-
-enum {
-	EXCEPTION_COL_ID = 0,
-	EXCEPTION_COL_COUNT,
-	EXCEPTION_COL_PERCENT_COUNT,
-	EXCEPTION_COL_CYCLES,
-	EXCEPTION_COL_PERCENT_CYCLES,
-	EXCEPTION_COL_DESCRIPTION,
-	EXCEPTION_NUM_COLUMNS,
-};
-
-screen_mode_t screen_mode = SCREEN_TABLE;
-static op_mode_t op_mode = OP_TASKS;
-static size_t sort_column = TASK_COL_PERCENT_USER;
-static int sort_reverse = -1;
-static bool excs_all = false;
-
-static const char *read_data(data_t *target)
-{
-	/* Initialize data */
-	target->load = NULL;
-	target->cpus = NULL;
-	target->cpus_perc = NULL;
-	target->tasks = NULL;
-	target->tasks_perc = NULL;
-	target->threads = NULL;
-	target->exceptions = NULL;
-	target->exceptions_perc = NULL;
-	target->physmem = NULL;
-	target->ucycles_diff = NULL;
-	target->kcycles_diff = NULL;
-	target->ecycles_diff = NULL;
-	target->ecount_diff = NULL;
-	target->table.name = NULL;
-	target->table.num_columns = 0;
-	target->table.columns = NULL;
-	target->table.num_fields = 0;
-	target->table.fields = NULL;
-
-	/* Get current time */
-	struct timespec time;
-	getrealtime(&time);
-
-	target->hours = (time.tv_sec % DAY) / HOUR;
-	target->minutes = (time.tv_sec % HOUR) / MINUTE;
-	target->seconds = time.tv_sec % MINUTE;
-
-	/* Get uptime */
-	struct timespec uptime;
-	getuptime(&uptime);
-
-	target->udays = uptime.tv_sec / DAY;
-	target->uhours = (uptime.tv_sec % DAY) / HOUR;
-	target->uminutes = (uptime.tv_sec % HOUR) / MINUTE;
-	target->useconds = uptime.tv_sec % MINUTE;
-
-	/* Get load */
-	target->load = stats_get_load(&(target->load_count));
-	if (target->load == NULL)
-		return "Cannot get system load";
-
-	/* Get CPUs */
-	target->cpus = stats_get_cpus(&(target->cpus_count));
-	if (target->cpus == NULL)
-		return "Cannot get CPUs";
-
-	target->cpus_perc =
-	    (perc_cpu_t *) calloc(target->cpus_count, sizeof(perc_cpu_t));
-	if (target->cpus_perc == NULL)
-		return "Not enough memory for CPU utilization";
-
-	/* Get tasks */
-	target->tasks = stats_get_tasks(&(target->tasks_count));
-	if (target->tasks == NULL)
-		return "Cannot get tasks";
-
-	target->tasks_perc =
-	    (perc_task_t *) calloc(target->tasks_count, sizeof(perc_task_t));
-	if (target->tasks_perc == NULL)
-		return "Not enough memory for task utilization";
-
-	/* Get threads */
-	target->threads = stats_get_threads(&(target->threads_count));
-	if (target->threads == NULL)
-		return "Cannot get threads";
-
-	/* Get Exceptions */
-	target->exceptions = stats_get_exceptions(&(target->exceptions_count));
-	if (target->exceptions == NULL)
-		return "Cannot get exceptions";
-
-	target->exceptions_perc =
-	    (perc_exc_t *) calloc(target->exceptions_count, sizeof(perc_exc_t));
-	if (target->exceptions_perc == NULL)
-		return "Not enough memory for exception utilization";
-
-	/* Get physical memory */
-	target->physmem = stats_get_physmem();
-	if (target->physmem == NULL)
-		return "Cannot get physical memory";
-
-	target->ucycles_diff = calloc(target->tasks_count,
-	    sizeof(uint64_t));
-	if (target->ucycles_diff == NULL)
-		return "Not enough memory for user utilization";
-
-	/* Allocate memory for computed values */
-	target->kcycles_diff = calloc(target->tasks_count,
-	    sizeof(uint64_t));
-	if (target->kcycles_diff == NULL)
-		return "Not enough memory for kernel utilization";
-
-	target->ecycles_diff = calloc(target->exceptions_count,
-	    sizeof(uint64_t));
-	if (target->ecycles_diff == NULL)
-		return "Not enough memory for exception cycles utilization";
-
-	target->ecount_diff = calloc(target->exceptions_count,
-	    sizeof(uint64_t));
-	if (target->ecount_diff == NULL)
-		return "Not enough memory for exception count utilization";
-
-	return NULL;
-}
-
-/** Computes percentage differencies from old_data to new_data
- *
- * @param old_data Pointer to old data strucutre.
- * @param new_data Pointer to actual data where percetages are stored.
- *
- */
-static void compute_percentages(data_t *old_data, data_t *new_data)
-{
-	/*
-	 * For each CPU: Compute total cycles and divide it between
-	 * user and kernel
-	 */
-
-	size_t i;
-	for (i = 0; i < new_data->cpus_count; i++) {
-		uint64_t idle =
-		    new_data->cpus[i].idle_cycles - old_data->cpus[i].idle_cycles;
-		uint64_t busy =
-		    new_data->cpus[i].busy_cycles - old_data->cpus[i].busy_cycles;
-		uint64_t sum = idle + busy;
-
-		FRACTION_TO_FLOAT(new_data->cpus_perc[i].idle, idle * 100, sum);
-		FRACTION_TO_FLOAT(new_data->cpus_perc[i].busy, busy * 100, sum);
-	}
-
-	/* For all tasks compute sum and differencies of all cycles */
-
-	uint64_t virtmem_total = 0;
-	uint64_t resmem_total = 0;
-	uint64_t ucycles_total = 0;
-	uint64_t kcycles_total = 0;
-
-	for (i = 0; i < new_data->tasks_count; i++) {
-		/* Match task with the previous instance */
-
-		bool found = false;
-		size_t j;
-		for (j = 0; j < old_data->tasks_count; j++) {
-			if (new_data->tasks[i].task_id == old_data->tasks[j].task_id) {
-				found = true;
-				break;
-			}
-		}
-
-		if (!found) {
-			/* This is newly borned task, ignore it */
-			new_data->ucycles_diff[i] = 0;
-			new_data->kcycles_diff[i] = 0;
-			continue;
-		}
-
-		new_data->ucycles_diff[i] =
-		    new_data->tasks[i].ucycles - old_data->tasks[j].ucycles;
-		new_data->kcycles_diff[i] =
-		    new_data->tasks[i].kcycles - old_data->tasks[j].kcycles;
-
-		virtmem_total += new_data->tasks[i].virtmem;
-		resmem_total += new_data->tasks[i].resmem;
-		ucycles_total += new_data->ucycles_diff[i];
-		kcycles_total += new_data->kcycles_diff[i];
-	}
-
-	/* For each task compute percential change */
-
-	for (i = 0; i < new_data->tasks_count; i++) {
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].virtmem,
-		    new_data->tasks[i].virtmem * 100, virtmem_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].resmem,
-		    new_data->tasks[i].resmem * 100, resmem_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].ucycles,
-		    new_data->ucycles_diff[i] * 100, ucycles_total);
-		FRACTION_TO_FLOAT(new_data->tasks_perc[i].kcycles,
-		    new_data->kcycles_diff[i] * 100, kcycles_total);
-	}
-
-	/* For all exceptions compute sum and differencies of cycles */
-
-	uint64_t ecycles_total = 0;
-	uint64_t ecount_total = 0;
-
-	for (i = 0; i < new_data->exceptions_count; i++) {
-		/*
-		 * March exception with the previous instance.
-		 * This is quite paranoid since exceptions do not
-		 * usually disappear, but it does not hurt.
-		 */
-
-		bool found = false;
-		size_t j;
-		for (j = 0; j < old_data->exceptions_count; j++) {
-			if (new_data->exceptions[i].id == old_data->exceptions[j].id) {
-				found = true;
-				break;
-			}
-		}
-
-		if (!found) {
-			/* This is a new exception, ignore it */
-			new_data->ecycles_diff[i] = 0;
-			new_data->ecount_diff[i] = 0;
-			continue;
-		}
-
-		new_data->ecycles_diff[i] =
-		    new_data->exceptions[i].cycles - old_data->exceptions[j].cycles;
-		new_data->ecount_diff[i] =
-		    new_data->exceptions[i].count - old_data->exceptions[i].count;
-
-		ecycles_total += new_data->ecycles_diff[i];
-		ecount_total += new_data->ecount_diff[i];
-	}
-
-	/* For each exception compute percential change */
-
-	for (i = 0; i < new_data->exceptions_count; i++) {
-		FRACTION_TO_FLOAT(new_data->exceptions_perc[i].cycles,
-		    new_data->ecycles_diff[i] * 100, ecycles_total);
-		FRACTION_TO_FLOAT(new_data->exceptions_perc[i].count,
-		    new_data->ecount_diff[i] * 100, ecount_total);
-	}
-}
-
-static int cmp_data(void *a, void *b, void *arg)
-{
-	field_t *fa = (field_t *)a + sort_column;
-	field_t *fb = (field_t *)b + sort_column;
-
-	if (fa->type > fb->type)
-		return 1 * sort_reverse;
-
-	if (fa->type < fb->type)
-		return -1 * sort_reverse;
-
-	switch (fa->type) {
-	case FIELD_EMPTY:
-		return 0;
-	case FIELD_UINT_SUFFIX_BIN: /* fallthrough */
-	case FIELD_UINT_SUFFIX_DEC: /* fallthrough */
-	case FIELD_UINT:
-		if (fa->uint > fb->uint)
-			return 1 * sort_reverse;
-		if (fa->uint < fb->uint)
-			return -1 * sort_reverse;
-		return 0;
-	case FIELD_PERCENT:
-		if (fa->fixed.upper * fb->fixed.lower >
-		    fb->fixed.upper * fa->fixed.lower)
-			return 1 * sort_reverse;
-		if (fa->fixed.upper * fb->fixed.lower <
-		    fb->fixed.upper * fa->fixed.lower)
-			return -1 * sort_reverse;
-		return 0;
-	case FIELD_STRING:
-		return str_cmp(fa->string, fb->string) * sort_reverse;
-	}
-
-	return 0;
-}
-
-static void sort_table(table_t *table)
-{
-	if (sort_column >= table->num_columns)
-		sort_column = 0;
-	/* stable sort is probably best, so we use gsort */
-	gsort((void *) table->fields, table->num_fields / table->num_columns,
-	    sizeof(field_t) * table->num_columns, cmp_data, NULL);
-}
-
-static const char *fill_task_table(data_t *data)
-{
-	data->table.name = "Tasks";
-	data->table.num_columns = TASK_NUM_COLUMNS;
-	data->table.columns = task_columns;
-	data->table.num_fields = data->tasks_count * TASK_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields,
-	    sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->tasks_count; i++) {
-		stats_task_t *task = &data->tasks[i];
-		perc_task_t *perc = &data->tasks_perc[i];
-		field[TASK_COL_ID].type = FIELD_UINT;
-		field[TASK_COL_ID].uint = task->task_id;
-		field[TASK_COL_NUM_THREADS].type = FIELD_UINT;
-		field[TASK_COL_NUM_THREADS].uint = task->threads;
-		field[TASK_COL_RESIDENT].type = FIELD_UINT_SUFFIX_BIN;
-		field[TASK_COL_RESIDENT].uint = task->resmem;
-		field[TASK_COL_PERCENT_RESIDENT].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_RESIDENT].fixed = perc->resmem;
-		field[TASK_COL_VIRTUAL].type = FIELD_UINT_SUFFIX_BIN;
-		field[TASK_COL_VIRTUAL].uint = task->virtmem;
-		field[TASK_COL_PERCENT_VIRTUAL].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_VIRTUAL].fixed = perc->virtmem;
-		field[TASK_COL_PERCENT_USER].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_USER].fixed = perc->ucycles;
-		field[TASK_COL_PERCENT_KERNEL].type = FIELD_PERCENT;
-		field[TASK_COL_PERCENT_KERNEL].fixed = perc->kcycles;
-		field[TASK_COL_NAME].type = FIELD_STRING;
-		field[TASK_COL_NAME].string = task->name;
-		field += TASK_NUM_COLUMNS;
-	}
-
-	return NULL;
-}
-
-static const char *fill_ipc_table(data_t *data)
-{
-	data->table.name = "IPC";
-	data->table.num_columns = IPC_NUM_COLUMNS;
-	data->table.columns = ipc_columns;
-	data->table.num_fields = data->tasks_count * IPC_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields,
-	    sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->tasks_count; i++) {
-		field[IPC_COL_TASKID].type = FIELD_UINT;
-		field[IPC_COL_TASKID].uint = data->tasks[i].task_id;
-		field[IPC_COL_CLS_SNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_CLS_SNT].uint = data->tasks[i].ipc_info.call_sent;
-		field[IPC_COL_CLS_RCV].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_CLS_RCV].uint = data->tasks[i].ipc_info.call_received;
-		field[IPC_COL_ANS_SNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_ANS_SNT].uint = data->tasks[i].ipc_info.answer_sent;
-		field[IPC_COL_ANS_RCV].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_ANS_RCV].uint = data->tasks[i].ipc_info.answer_received;
-		field[IPC_COL_FORWARD].type = FIELD_UINT_SUFFIX_DEC;
-		field[IPC_COL_FORWARD].uint = data->tasks[i].ipc_info.forwarded;
-		field[IPC_COL_NAME].type = FIELD_STRING;
-		field[IPC_COL_NAME].string = data->tasks[i].name;
-		field += IPC_NUM_COLUMNS;
-	}
-
-	return NULL;
-}
-
-static const char *fill_exception_table(data_t *data)
-{
-	data->table.name = "Exceptions";
-	data->table.num_columns = EXCEPTION_NUM_COLUMNS;
-	data->table.columns = exception_columns;
-	data->table.num_fields = data->exceptions_count *
-	    EXCEPTION_NUM_COLUMNS;
-	data->table.fields = calloc(data->table.num_fields, sizeof(field_t));
-	if (data->table.fields == NULL)
-		return "Not enough memory for table fields";
-
-	field_t *field = data->table.fields;
-	for (size_t i = 0; i < data->exceptions_count; i++) {
-		if (!excs_all && !data->exceptions[i].hot)
-			continue;
-		field[EXCEPTION_COL_ID].type = FIELD_UINT;
-		field[EXCEPTION_COL_ID].uint = data->exceptions[i].id;
-		field[EXCEPTION_COL_COUNT].type = FIELD_UINT_SUFFIX_DEC;
-		field[EXCEPTION_COL_COUNT].uint = data->exceptions[i].count;
-		field[EXCEPTION_COL_PERCENT_COUNT].type = FIELD_PERCENT;
-		field[EXCEPTION_COL_PERCENT_COUNT].fixed = data->exceptions_perc[i].count;
-		field[EXCEPTION_COL_CYCLES].type = FIELD_UINT_SUFFIX_DEC;
-		field[EXCEPTION_COL_CYCLES].uint = data->exceptions[i].cycles;
-		field[EXCEPTION_COL_PERCENT_CYCLES].type = FIELD_PERCENT;
-		field[EXCEPTION_COL_PERCENT_CYCLES].fixed = data->exceptions_perc[i].cycles;
-		field[EXCEPTION_COL_DESCRIPTION].type = FIELD_STRING;
-		field[EXCEPTION_COL_DESCRIPTION].string = data->exceptions[i].desc;
-		field += EXCEPTION_NUM_COLUMNS;
-	}
-
-	/* in case any cold exceptions were ignored */
-	data->table.num_fields = field - data->table.fields;
-
-	return NULL;
-}
-
-static const char *fill_table(data_t *data)
-{
-	if (data->table.fields != NULL) {
-		free(data->table.fields);
-		data->table.fields = NULL;
-	}
-
-	switch (op_mode) {
-	case OP_TASKS:
-		return fill_task_table(data);
-	case OP_IPC:
-		return fill_ipc_table(data);
-	case OP_EXCS:
-		return fill_exception_table(data);
-	}
-	return NULL;
-}
-
-static void free_data(data_t *target)
-{
-	if (target->load != NULL)
-		free(target->load);
-
-	if (target->cpus != NULL)
-		free(target->cpus);
-
-	if (target->cpus_perc != NULL)
-		free(target->cpus_perc);
-
-	if (target->tasks != NULL)
-		free(target->tasks);
-
-	if (target->tasks_perc != NULL)
-		free(target->tasks_perc);
-
-	if (target->threads != NULL)
-		free(target->threads);
-
-	if (target->exceptions != NULL)
-		free(target->exceptions);
-
-	if (target->exceptions_perc != NULL)
-		free(target->exceptions_perc);
-
-	if (target->physmem != NULL)
-		free(target->physmem);
-
-	if (target->ucycles_diff != NULL)
-		free(target->ucycles_diff);
-
-	if (target->kcycles_diff != NULL)
-		free(target->kcycles_diff);
-
-	if (target->ecycles_diff != NULL)
-		free(target->ecycles_diff);
-
-	if (target->ecount_diff != NULL)
-		free(target->ecount_diff);
-
-	if (target->table.fields != NULL)
-		free(target->table.fields);
-}
-
-int main(int argc, char *argv[])
-{
-	data_t data;
-	data_t data_prev;
-	const char *ret = NULL;
-
-	screen_init();
-	printf("Reading initial data...\n");
-
-	if ((ret = read_data(&data)) != NULL)
-		goto out;
-
-	/* Compute some rubbish to have initialised values */
-	compute_percentages(&data, &data);
-
-	/* And paint screen until death */
-	while (true) {
-		int c = tgetchar(UPDATE_INTERVAL);
-
-		if (c < 0) { /* timeout */
-			data_prev = data;
-			if ((ret = read_data(&data)) != NULL) {
-				free_data(&data_prev);
-				goto out;
-			}
-
-			compute_percentages(&data_prev, &data);
-			free_data(&data_prev);
-
-			c = -1;
-		}
-
-		if (screen_mode == SCREEN_HELP && c >= 0) {
-			if (c == 'h' || c == '?')
-				c = -1;
-			/* go back to table and handle the key */
-			screen_mode = SCREEN_TABLE;
-		}
-
-		if (screen_mode == SCREEN_SORT && c >= 0) {
-			for (size_t i = 0; i < data.table.num_columns; i++) {
-				if (data.table.columns[i].key == c) {
-					sort_column = i;
-					screen_mode = SCREEN_TABLE;
-				}
-			}
-
-			c = -1;
-		}
-
-		switch (c) {
-		case -1: /* do nothing */
-			break;
-		case 't':
-			op_mode = OP_TASKS;
-			break;
-		case 'i':
-			op_mode = OP_IPC;
-			break;
-		case 'e':
-			op_mode = OP_EXCS;
-			break;
-		case 's':
-			screen_mode = SCREEN_SORT;
-			break;
-		case 'r':
-			sort_reverse = -sort_reverse;
-			break;
-		case 'h':
-		case '?':
-			screen_mode = SCREEN_HELP;
-			break;
-		case 'q':
-			goto out;
-		case 'a':
-			if (op_mode == OP_EXCS) {
-				excs_all = !excs_all;
-				if (excs_all)
-					show_warning("Showing all exceptions");
-				else
-					show_warning("Showing only hot exceptions");
-				break;
-			}
-			/* Fallthrough */
-		default:
-			show_warning("Unknown command \"%c\", use \"h\" for help", c);
-			continue; /* don't redraw */
-		}
-
-		if ((ret = fill_table(&data)) != NULL) {
-			goto out;
-		}
-		sort_table(&data.table);
-		print_data(&data);
-	}
-
-out:
-	screen_done();
-	free_data(&data);
-
-	if (ret != NULL) {
-		fprintf(stderr, "%s: %s\n", NAME, ret);
-		return 1;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/dist/src/c/demos/top/top.h
===================================================================
--- uspace/dist/src/c/demos/top/top.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup top
- * @{
- */
-
-#ifndef TOP_TOP_H_
-#define TOP_TOP_H_
-
-#include <task.h>
-#include <stats.h>
-#include <time.h>
-
-#define FRACTION_TO_FLOAT(float, a, b) \
-	do { \
-		if ((b) != 0) { \
-			(float).upper = (a); \
-			(float).lower = (b); \
-		} else { \
-			(float).upper = 0; \
-			(float).lower = 1; \
-		} \
-	} while (0)
-
-typedef enum {
-	SCREEN_TABLE,
-	SCREEN_SORT,
-	SCREEN_HELP,
-} screen_mode_t;
-
-extern screen_mode_t screen_mode;
-
-typedef struct {
-	uint64_t upper;
-	uint64_t lower;
-} fixed_float;
-
-typedef struct {
-	fixed_float idle;
-	fixed_float busy;
-} perc_cpu_t;
-
-typedef struct {
-	fixed_float virtmem;
-	fixed_float resmem;
-	fixed_float ucycles;
-	fixed_float kcycles;
-} perc_task_t;
-
-typedef struct {
-	fixed_float cycles;
-	fixed_float count;
-} perc_exc_t;
-
-typedef enum {
-	FIELD_EMPTY,
-	FIELD_UINT,
-	FIELD_UINT_SUFFIX_BIN,
-	FIELD_UINT_SUFFIX_DEC,
-	FIELD_PERCENT,
-	FIELD_STRING
-} field_type_t;
-
-typedef struct {
-	field_type_t type;
-	union {
-		fixed_float fixed;
-		uint64_t uint;
-		const char *string;
-	};
-} field_t;
-
-typedef struct {
-	const char *name;
-	char key;
-	int width;
-} column_t;
-
-typedef struct {
-	const char *name;
-	size_t num_columns;
-	const column_t *columns;
-	size_t num_fields;
-	field_t *fields;
-} table_t;
-
-typedef struct {
-	time_t hours;
-	time_t minutes;
-	time_t seconds;
-
-	sysarg_t udays;
-	sysarg_t uhours;
-	sysarg_t uminutes;
-	sysarg_t useconds;
-
-	size_t load_count;
-	load_t *load;
-
-	size_t cpus_count;
-	stats_cpu_t *cpus;
-	perc_cpu_t *cpus_perc;
-
-	size_t tasks_count;
-	stats_task_t *tasks;
-	perc_task_t *tasks_perc;
-
-	size_t threads_count;
-	stats_thread_t *threads;
-
-	size_t exceptions_count;
-	stats_exc_t *exceptions;
-	perc_exc_t *exceptions_perc;
-
-	stats_physmem_t *physmem;
-
-	uint64_t *ucycles_diff;
-	uint64_t *kcycles_diff;
-	uint64_t *ecycles_diff;
-	uint64_t *ecount_diff;
-
-	table_t table;
-} data_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/dist/src/python/demo/hello.py
===================================================================
--- uspace/dist/src/python/demo/hello.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-#!/usr/bin/python
-
-print("Hello, World!")
-
Index: pace/dist/src/python/demo/sintab.py
===================================================================
--- uspace/dist/src/python/demo/sintab.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-#!/usr/bin/python
-
-# Probably not very Pythonic, but it runs well with both Python2 and Python3
-
-import math
-import sys
-
-sys.stdout.write("    ")
-for frac_part in range(0,10):
-	sys.stdout.write(" %5d" % frac_part)
-print("")
-
-for angle_deg in range(0,90):
-	sys.stdout.write("%3d " % angle_deg)
-	for angle_deg_frac in range(0,10):
-		angle = math.radians(angle_deg + angle_deg_frac/10.)
-		value = math.sin(angle) * 10000 + 0.5
-		if value > 10000:
-			sys.stdout.write(" %05d" % (value))
-		else:
-			sys.stdout.write("  %04d" % (value))
-	print("")
-
Index: pace/dist/src/python/modules.py
===================================================================
--- uspace/dist/src/python/modules.py	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,15 +1,0 @@
-#!/usr/bin/python
-
-import sys
-
-for m in sys.builtin_module_names:
-	print("Built-in module '%s'." % m)
-
-try:
-	import pkgutil
-	for (loader, name, ispkg) in pkgutil.iter_modules():
-		print("Loadable module '%s'." % name)
-except ImportError:
-	print("Cannot determine list of loadable modules (pkgutil not found)!")
-
-
Index: pace/dist/src/sysel/demos/arith.sy
===================================================================
--- uspace/dist/src/sysel/demos/arith.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class ArithmeticDemo is
-	fun Main(), static is
-		-- Test addition, multiplication and precedence.
-		Console.Write("2*2 + 2*2 = ");
-		Console.Write(2*2 + 2*2);
-		Console.WriteLine(" (expected: 8)");
-
-		-- Test subtraction, multiplication and precedence.
-		Console.Write("1111 - 1 - 10 - 10*10 - 10*10*10 = ");
-		Console.Write(1111 - 1 - 10 - 10*10 - 10*10*10);
-		Console.WriteLine(" (expected: 0)");
-
-		-- Test parenthesized sub-expressions.
-		Console.Write("10 * (1 - 1) = ");
-		Console.Write(10 * (1 - 1));
-		Console.WriteLine(" (expected: 0)");
-
-		-- Test unary plus and minus.
-		Console.Write("(+1) - (-1) - (+(+1)) + (+(-1)) = ");
-		Console.Write((+1) - (-1) - (+(+1)) + (+(-1)));
-		Console.WriteLine(" (expected: 0)");
-
-		-- Test signed multiplication.
-		Console.Write("+1 * +1 = ");
-		Console.Write(+1 * +1);
-		Console.WriteLine(" (expected: 1)");
-
-		Console.Write("-1 * -1 = ");
-		Console.Write(-1 * -1);
-		Console.WriteLine(" (expected: 1)");
-
-		Console.Write("+1 * -1 = ");
-		Console.Write(+1 * -1);
-		Console.WriteLine(" (expected: -1)");
-
-		Console.Write("-1 * +1 = ");
-		Console.Write(-1 * +1);
-		Console.WriteLine(" (expected: -1)");
-
-		-- Test multiplication with large result.
-		Console.Write("1000000 * 1000000 * 1000000 * 1000000 = ");
-		Console.Write(1000000 * 1000000 * 1000000 * 1000000);
-		Console.WriteLine(" (expected: 1000000000000000000000000)");
-
-		-- Test large literals.
-		Console.Write("1000000000000000000000000 = ");
-		Console.Write(1000000000000000000000000);
-		Console.WriteLine(" (expected: 1000000000000000000000000)");
-
-		-- Test large factorials.
-		var n : int;
-
-		Console.WriteLine("Factorials:");
-		n = 1;
-		while n <= 40 do
-			Console.WriteLine(Factorial(n));
-			n = n + 1;
-		end
-	end
-
-	-- Return factorial of n.
-	fun Factorial(n : int) : int, static is
-		var i : int;
-		var val : int;
-
-		i = 1;
-		val = 1;
-
-		while i <= n do
-			val = val * i;
-			i = i + 1;
-		end
-
-		return val;
-	end
-end
Index: pace/dist/src/sysel/demos/array.sy
===================================================================
--- uspace/dist/src/sysel/demos/array.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class ArrayDemo is
-	fun Main(), static is
-		var a : int[,];
-		var i : int;
-
-		a = new int[3, 2];
-
-		a[0, 0] = 1;
-		a[1, 0] = 2;
-		a[2, 0] = 3;
-
-		i = 0;
-		while i < 3 do
-			Console.WriteLine(a[i, 0]);
-			i = i + 1;
-		end
-	end
-end
Index: pace/dist/src/sysel/demos/autobox.sy
===================================================================
--- uspace/dist/src/sysel/demos/autobox.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class AutoboxingDemo is
-	fun Main(), static is
-		var b : Bool;
-		var c : Char;
-		var i : Int;
-		var s : String;
-
-		--
-		-- Automatic conversion of each primitive type to the
-		-- respective boxed type.
-		--
-		b = true;
-		Console.WriteLine(b.Value);
-		c = 'a';
-		Console.WriteLine(c.Value);
-		i = 1;
-		Console.WriteLine(i.Value);
-		s = "Hello";
-		Console.WriteLine(s.Value);
-
-		-- Anything can be converted to Object.
-		foo(b, c, i, s);
-	end
-
-	fun foo(args : Object[], packed), static is
-	end
-end
Index: pace/dist/src/sysel/demos/count.sy
===================================================================
--- uspace/dist/src/sysel/demos/count.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class CountDemo is
-	fun Count(a : int; b : int), static is
-		var i : int;
-
-		i = a;
-		while i < b do
-			Console.WriteLine(i);
-			i = i + 1;
-		end
-
-	end
-
-	fun Main(), static is
-		Count(0, 10);
-	end
-end
Index: pace/dist/src/sysel/demos/ctor.sy
===================================================================
--- uspace/dist/src/sysel/demos/ctor.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class ConstructorDemo is
-	fun Main(), static is
-		var a : A;
-
-		a = new A(1);
-		Console.Write("a.v = ");
-		Console.WriteLine(a.v);
-	end
-end
-
-class A is
-	var v : int;
-
-	new(i : int) is
-		Console.WriteLine("A.new()");
-		v = i;
-	end
-end
Index: pace/dist/src/sysel/demos/deleg.sy
===================================================================
--- uspace/dist/src/sysel/demos/deleg.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class DelegateDemo is
-	fun Main(), static is
-		var demo : DelegateClass;
-
-		demo = new DelegateClass();
-		demo.Run();
-	end
-end
-
-class DelegateClass is
-	fun Run() is
-		var op : BinaryOp;
-
-		-- The anonymous delegate to self.Add is implicitly
-		-- converted to BinaryOp. This is allowed as long as
-		-- the signature matches.
-		op = Add;
-
-		-- Pass delegate to Operate()
-		Operate(op, "Add");
-
-		-- Obviously the intermediate step through a variable
-		-- is redundant.
-		Operate(Subtract, "Subtract");
-	end
-
-	-- Function having delegate as the first parameger
-	fun Operate(op : BinaryOp; opName : string) is
-		Console.Write(opName + "(1, 2): ");
-		Console.WriteLine(op(1, 2));
-	end
-
-	-- A function matching the delegate signature
-	fun Add(a : int; b : int) : int is
-		return a + b;
-	end
-
-	-- Another function matching the delegate signature
-	fun Subtract(a : int; b : int) : int is
-		return a - b;
-	end
-
-	-- Declaration of a delegate.
-	deleg BinaryOp(a : int; b : int) : int;
-end
Index: pace/dist/src/sysel/demos/enum.sy
===================================================================
--- uspace/dist/src/sysel/demos/enum.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class EnumDemo is
-	fun Main(), static is
-		var color : ChessColor;
-
-		Console.WriteLine("Set color to ChessColor.Black.");
-		color = ChessColor.Black;
-
-		Console.Write("Test color == ChessColor.Black.. ");
-		if color == ChessColor.Black then
-			Console.WriteLine("True - OK");
-		else
-			Console.WriteLine("False - Fail!");
-			raise new Error.Base();
-		end
-
-		Console.Write("Test color != ChessColor.Black.. ");
-		if color != ChessColor.Black then
-			Console.WriteLine("True - Fail!");
-			raise new Error.Base();
-		else
-			Console.WriteLine("False - OK");
-		end
-
-		Console.Write("Test color == ChessColor.White.. ");
-		if color == ChessColor.White then
-			Console.WriteLine("True - Fail!");
-			raise new Error.Base();
-		else
-			Console.WriteLine("False - OK");
-		end
-
-		Console.Write("Test color != ChessColor.White.. ");
-		if color != ChessColor.White then
-			Console.WriteLine("True - OK");
-		else
-			Console.WriteLine("False - Fail!");
-			raise new Error.Base();
-		end
-
-		Console.WriteLine("Success");
-
-		-- Test enum declared in non-CSI scope
-
-		var ptype : ChessPiece;
-
-		ptype = ChessPiece.King;
-	end
-
-	-- Enumerated type declared inside a class
-	enum ChessColor is
-		White;
-		Black;
-	end
-end
-
--- Enumerated type declared outside any class
-enum ChessPiece is
-	King;
-	Queen;
-	Bishop;
-	Knight;
-	Rook;
-	Pawn;
-end
Index: pace/dist/src/sysel/demos/except.sy
===================================================================
--- uspace/dist/src/sysel/demos/except.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class ExceptionDemo is
-	fun foo(), static is
-	        Console.WriteLine("Entered foo().");
-		raise new BaseException();
-	end
-
-	fun Main(), static is
-		do
-			foo();
-			foo();
-		except e : DerivedException do
-			Console.WriteLine("Caught derived exception.");
-		except e : BaseException do
-			Console.WriteLine("Caught base exception.");
-		finally do
-			Console.WriteLine("Finally.");
-		end
-	end
-end
-
-class BaseException is
-end
-
-class DerivedException : BaseException is
-end
Index: pace/dist/src/sysel/demos/gen.sy
===================================================================
--- uspace/dist/src/sysel/demos/gen.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Demonstrate generic classes.
-
-class GenericsDemo is
-	fun Main(), static is
-		Console.WriteLine("Let's try some generics.");
-
-		var f : B/int/string;
-		var g : A/string/int;
-		var s : string;
-
-		f = new B/int/string();
-		g = new A/string/int();
-
-		-- This should be okay.
-		f = f;
-		g = f;
-
-		-- Method
-		g.set_a("Lorem");
-		f.set_a("ipsum");
-		s = g.get_a();
-		s = f.get_a();
-
-		-- Named property
-		g.P = "Lorem";
-		f.P = "ipsum";
-		s = g.P;
-		s = f.P;
-
-		-- Indexed property
-		g[1] = "Lorem";
-		f[1] = "ipsum";
-		s = g[1];
-		s = f[1];
-	end
-end
-
--- Generic class with two type parameters
-class A/u/v is
-	-- Variable whose type is one of the parameters
-	var a : u;
-
-	-- Member function whose argument type is one of the parameters
-	fun set_a(arg : u) is
-		a = arg;
-	end
-
-	fun get_a() : u is
-		return a;
-	end
-
-	-- Property whose type is one of the type parameters
-	prop P : u is
-		get is
-			return a;
-		end
-		set value is
-			a = value;
-		end
-	end
-
-	-- Indexed property whose type is one of the type arguments
-	prop self[i : int] : u is
-		get is
-			return a;
-		end
-		set value is
-			a = value;
-		end
-	end
-end
-
--- Generic class derived from another generic class
---
--- Note the swapping of type arguments.
---
-class B/v/u : A/u/v is
-end
Index: pace/dist/src/sysel/demos/hello.sy
===================================================================
--- uspace/dist/src/sysel/demos/hello.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class HelloWorld is
-	fun Main(), static is
-		Console.WriteLine("Hello world!");
-	end
-end
Index: pace/dist/src/sysel/demos/hexec.sy
===================================================================
--- uspace/dist/src/sysel/demos/hexec.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class HelenOSExecDemo is
-	fun Main(), static is
-		Task.Exec("/app/tester");
-		Task.Exec("/app/tester", "print1");
-	end
-end
Index: pace/dist/src/sysel/demos/htxtfile.sy
===================================================================
--- uspace/dist/src/sysel/demos/htxtfile.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class TextFileDemo is
-	fun Main(), static is
-		var name : string;
-		var line : string;
-
-		var in_file : TextFile;
-		var out_file : TextFile;
-
-		name = "/textdemo";
-
-		in_file = new TextFile();
-		in_file.OpenRead(name);
-
-		out_file = new TextFile();
-		out_file.OpenWrite("/out.txt");
-
-		while not in_file.EOF do
-			line = in_file.ReadLine();
-			Console.WriteLine(name + ": " + line);
-			out_file.WriteLine(name + ": " + line);
-		end
-
-		in_file.Close();
-		out_file.Close();
-	end
-end
Index: pace/dist/src/sysel/demos/iface.sy
===================================================================
--- uspace/dist/src/sysel/demos/iface.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class InterfaceDemo is
-	fun Main(), static is
-		-- Create new instance of Foo
-		var f : Foo;
-		f = new Foo();
-
-		-- Variable of interface type
-		var g : IA/int;
-
-		-- Implicit conversion to interface implemented by Foo
-		g = f;
-
-		-- Explicit conversion of interface type IA/int to class type
-		-- Foo. Foo is implementing the interface IA/int.
-		f = g as Foo;
-
-		Console.WriteLine(g.a());
-	end
-end
-
--- Generic interface implemented by class Foo
-interface IA/t is
-	fun a() : t;
-end
-
--- Non-generic interface implemented by class Foo
-interface IB is
-	fun b();
-	prop P : int is
-		get;
-		set value;
-	end
-end
-
--- Base class of Foo
-class A is
-end
-
--- Class unrelated to Foo
-class B is
-end
-
--- Foo is derived from A and implements IA/int and IB
-class Foo : A + IA/int + IB is
-	fun a() : int is
-		return 0;
-	end
-
-	fun b() is
-	end
-
-	prop P : int is
-		get is
-			return 1;
-		end
-		set value is
-		end
-	end
-end
Index: pace/dist/src/sysel/demos/inherit.sy
===================================================================
--- uspace/dist/src/sysel/demos/inherit.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class A is
-	fun Foo() is
-		Console.WriteLine("A.Foo()");
-	end
-end
-
-class B : A is
-	fun Foo() is
-		Console.WriteLine("B.Foo()");
-	end
-end
-
-class C : A is
-end
-
-class InheritanceDemo is
-	fun Main(), static is
-		var a : A;
-		var c : C;
-
-		-- Construct and assign object.
-		a = new A();
-		a.Foo();
-
-		-- Implicit conversion to base type.
-		a = new B();
-		a.Foo();
-
-		a = new C();
-		a.Foo();
-
-		-- Test 'as' operator for conversion to derived type.
-		c = a as C;
-
-		-- Test grandfather class.
-		var d : Object;
-		d = a;
-		d = new B();
-		d = c;
-	end
-end
Index: pace/dist/src/sysel/demos/list.sy
===================================================================
--- uspace/dist/src/sysel/demos/list.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Using the List class from the library.
-class ListDemo is
-	fun Main(), static is
-		var list : List/int;
-
-		list = new List/int();
-
-		list.Append(5);
-		list.Append(6);
-		list.Append(7);
-		list.Append(8);
-
-		var e : IEnumerator/int;
-
-		e = list.GetEnumerator();
-		while e.MoveNext() do
-			Console.WriteLine(e.Data);
-		end
-	end
-end
Index: pace/dist/src/sysel/demos/map.sy
===================================================================
--- uspace/dist/src/sysel/demos/map.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Using the Map class from the library.
-class MapDemo is
-	fun Main(), static is
-		var map : Map/string/int;
-
-		map = new Map/string/int();
-
-		map["one"] = 1;
-		map["two"] = 2;
-		map["three"] = 3;
-		map["four"] = 4;
-
-		var e : IEnumerator/string;
-
-		e = map.GetEnumerator();
-		while e.MoveNext() do
-			Console.Write(e.Data);
-			Console.Write(" -> ");
-			Console.WriteLine(map[e.Data]);
-		end
-	end
-end
Index: pace/dist/src/sysel/demos/property.sy
===================================================================
--- uspace/dist/src/sysel/demos/property.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class Foo is
-	var x : int;
-
-	-- Example of a named property
-	prop X : int is
-		get is
-			Console.Write("Getting value of X which is ");
-			Console.WriteLine(x);
-			return x;
-		end
-
-		set value is
-			Console.Write("Setting value of X to ");
-			Console.WriteLine(value);
-			x = value;
-		end
-	end
-
-	-- Test accessing property via an unqualified name
-	fun TestUnqualPropAcc() is
-		var i : int;
-
-		X = 1;
-		i = X;
-
-		Console.Write("TestUnqualPropAcc(): Got ");
-		Console.WriteLine(i);
-	end
-
-	-- Backing store for indexed properties
-	var iprops : int[];
-
-	-- Example of an indexed property set (i.e. an indexer)
-	prop self[index : int] : int is
-		get is
-			Console.Write("Getting property with index ");
-			Console.Write(index);
-			Console.Write(" which is ");
-			Console.WriteLine(iprops[index]);
-
-			return iprops[index];
-		end
-
-		set value is
-			Console.Write("Setting property with index ");
-			Console.Write(index);
-			Console.Write(" to ");
-			Console.WriteLine(value);
-
-			iprops[index] = value;
-		end
-	end
-
-	--
-	-- Class-type property. This is used for demonstrating property
-	-- field access. This case is still quite easy. It does not require
-	-- read-modify-write. Since class is a reference type, access
-	-- operator will read the value and dereference it, thereby
-	-- getting somewhere else (so the value will not be modified and
-	-- need not be written back).
-	--
-
-	var bprop : Bar;
-
-	prop B : Bar is
-		get is
-			Console.WriteLine("Getting B");
-			return bprop;
-		end
-		set value is
-			Console.WriteLine("Setting B");
-			bprop = value;
-		end
-	end
-
-end
-
-class Bar is
-	var i : int;
-end
-
-class PropertyDemo is
-	fun Main(), static is
-		var a : Foo;
-		var i : int;
-
-		a = new Foo();
-
-		-- Get value of named property.
-		a.X = 1;
-
-		-- Set value of named property.
-		i = a.X;
-
-		Console.Write("Main(): Got ");
-		Console.WriteLine(i);
-
-		a.TestUnqualPropAcc();
-
-		a.iprops = new int[5];
-
-		-- Set value of indexed property.
-		a[1] = 2;
-
-		-- Get value of indexed property.
-		i = a[1];
-
-		Console.Write("Main(): Got ");
-		Console.WriteLine(i);
-
-		-- Property field access
-		var b : Bar;
-
-		b = new Bar();
-
-		b.i = 42;
-		a.bprop = b;
-
-		Console.WriteLine(a.bprop.i);
-		a.bprop.i = 2;
-		Console.WriteLine(a.bprop.i);
-	end
-end
Index: pace/dist/src/sysel/demos/string.sy
===================================================================
--- uspace/dist/src/sysel/demos/string.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class StringDemo is
-	fun Main(), static is
-		-- Concatenate some strings.
-		Console.WriteLine("One-" + "two-" + "three!");
-
-		-- Extract characters from a string.
-		var i : int;
-		i = 0;
-		while i < 5 do
-			Console.WriteLine("ABCDE"[i]);
-			i = i + 1;
-		end
-
-		Console.WriteLine("Abracadabra".Slice(2, 4));
-	end
-end
Index: pace/dist/src/sysel/demos/svar.sy
===================================================================
--- uspace/dist/src/sysel/demos/svar.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class StaticPropertyDemo is
-	fun Main(), static is
-		-- Test static member variable
-		A.B.a = 1;
-		Console.WriteLine(A.B.a);
-		A.B.a = 2;
-		Console.WriteLine(A.B.a);
-
-		-- Test static property
-		A.B.P = 1;
-		Console.WriteLine(A.B.P);
-		A.B.P = 2;
-		Console.WriteLine(A.B.P);
-	end
-end
-
-class A is
-	class B is
-		var a : int, static;
-
-		prop P : int, static is
-			get is
-				return a;
-			end
-
-			set value is
-				a = value;
-			end
-		end
-	end
-end
Index: pace/dist/src/sysel/demos/switch.sy
===================================================================
--- uspace/dist/src/sysel/demos/switch.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
---
--- Copyright (c) 2011 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
---- Switch statement demo.
---
--- This demonstrates the switch statement. The switch statement looks like:
---
--- switch <s_expr> is
--- when <e1> [, <e2> ...] do
---	<statements1>
--- when <f1> [, <f2> ...] do
---	<statements2>
--- [...]
--- [else do
---	<statements3>]
--- end
---
--- It is mostly equivalent to the pseudocode:
---
--- var v : <type of s_expr>;
--- if v == <e1> [or v == <e2> ...] then
---	<statements1>
--- elif v == <f1> [ or v == <f2> ...] then
---	<statements2>
--- [...]
--- [else
---	<statements3>]
--- end
---
--- This means there is no artificial limitation as to what you can switch
--- on. The expressions don't have to be constant and they can be of any type
--- as long as the switch expression (<s_expr>) can be compared with each
--- of the when expressions (<e1>, <e2>, <f1>, <f2>, ...).
---
--- Note however, the 'or' here denotes short-circuit evaluation. (Currently
--- the 'or' operation does not use short-circuit evaluation, but that's
--- more of a bug than a feature.
---
-class SwitchDemo is
-	class A is
-	end
-
-	var a1 : A, static;
-	var a2 : A, static;
-	var a3 : A, static;
-	var a4 : A, static;
-
-	enum MyEnum is
-		red;
-		green;
-		blue;
-		black;
-		cyan;
-	end
-
-	-- Switch on boolean value
-	fun SwitchBool(v : bool) : string, static is
-		switch v is
-		when false do
-			return "false";
-		when true do
-			return "true";
-		end
-	end
-
-	-- Switch on char value
-	fun SwitchChar(v : char) : string, static is
-		switch v is
-		when 'a', 'b' do
-			return "a/b";
-		when 'c', 'd' do
-			return "c/d";
-		else do
-			return "<other>";
-		end
-	end
-
-	-- Switch on integer value
-	fun SwitchInt(v : int) : string, static is
-		switch v is
-		when 0, 1 do
-			return "0/1";
-		when 2, 3 do
-			return "2/3";
-		else do
-			return "<other>";
-		end
-	end
-
-	-- Switch on string value
-	fun SwitchString(v : string) : string, static is
-		switch v is
-		when "foo", "bar"  do
-			return "foo/bar";
-		when "hello", "world" do
-			return "hello/world";
-		else do
-			return "<other>";
-		end
-	end
-
-	-- Switch on object reference
-	fun SwitchObj(v : A) : string, static is
-		switch v is
-		when a1, a2 do
-			return "a1/a2";
-		when a3, a4 do
-			return "a3/a4";
-		else do
-			return "<other>";
-		end
-	end
-
-	-- Switch on object reference
-	fun SwitchEnum(v : MyEnum) : string, static is
-		switch v is
-		when MyEnum.red, MyEnum.green do
-			return "red/green";
-		when MyEnum.blue, MyEnum.black do
-			return "blue/black";
-		else do
-			return "<other>";
-		end
-	end
-
-	fun Test(res : string; test_expr : string; expected : string), static is
-		Console.WriteLine(test_expr + " = '" + res + "' (expected '" +
-		    expected + "')");
-		if res != expected then
-			Console.WriteLine("Error: Got unexpected result.");
-			raise new Error.Base();
-		end
-	end
-
-	fun Main(), static is
-		a1 = new A();
-		a2 = new A();
-		a3 = new A();
-		a4 = new A();
-
-		Test(SwitchBool(false), "SwitchBool(false)", "false");
-		Test(SwitchBool(true), "SwitchBool(true)", "true");
-
-		Test(SwitchChar('a'), "SwitchChar('a')", "a/b");
-		Test(SwitchChar('b'), "SwitchChar('b')", "a/b");
-		Test(SwitchChar('c'), "SwitchChar('c')", "c/d");
-		Test(SwitchChar('d'), "SwitchChar('d')", "c/d");
-		Test(SwitchChar('e'), "SwitchChar('e')", "<other>");
-
-		Test(SwitchInt(0), "SwitchInt(0)", "0/1");
-		Test(SwitchInt(1), "SwitchInt(1)", "0/1");
-		Test(SwitchInt(2), "SwitchInt(2)", "2/3");
-		Test(SwitchInt(3), "SwitchInt(3)", "2/3");
-		Test(SwitchInt(4), "SwitchInt(4)", "<other>");
-
-		Test(SwitchString("foo"), "SwitchString('foo')", "foo/bar");
-		Test(SwitchString("bar"), "SwitchString('bar')", "foo/bar");
-		Test(SwitchString("hello"), "SwitchString('hello')", "hello/world");
-		Test(SwitchString("world"), "SwitchString('world')", "hello/world");
-		Test(SwitchString("boom"), "SwitchString('boom')", "<other>");
-
-		Test(SwitchObj(a1), "SwitchObj(a1)", "a1/a2");
-		Test(SwitchObj(a2), "SwitchObj(a2)", "a1/a2");
-		Test(SwitchObj(a3), "SwitchObj(a3)", "a3/a4");
-		Test(SwitchObj(a4), "SwitchObj(a4)", "a3/a4");
-		Test(SwitchObj(nil), "SwitchObj(nil)", "<other>");
-
-		Test(SwitchEnum(MyEnum.red), "SwitchEnum(MyEnum.red)", "red/green");
-		Test(SwitchEnum(MyEnum.green), "SwitchEnum(MyEnum.green)", "red/green");
-		Test(SwitchEnum(MyEnum.blue), "SwitchEnum(MyEnum.blue)", "blue/black");
-		Test(SwitchEnum(MyEnum.black), "SwitchEnum(MyEnum.black)", "blue/black");
-		Test(SwitchEnum(MyEnum.cyan), "SwitchEnum(MyEnum.cyan)", "<other>");
-	end
-end
Index: pace/dist/src/sysel/demos/varargs.sy
===================================================================
--- uspace/dist/src/sysel/demos/varargs.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class VariadicArgumentsDemo is
-	--- Variadic function example.
-	--
-	-- A variadic function is declared by marking its last argument
-	-- with the attribute 'packed'.
-	--
-	fun Print(args : string[], packed), static is
-		var i : int;
-		var error : bool;
-
-		error = false;
-		i = 0;
-		while not error do
-			-- This is definitely the wrong way to determine
-			-- array bounds, but until a better one is
-			-- implemented...
-			do
-				Console.WriteLine(args[i]);
-			except e : Error.OutOfBounds do
-				error = true;
-			end
-
-			i = i + 1;
-		end
-	end
-
-	fun Main(), static is
-		Print("One", "Two", "Three", "Four", "Five");
-	end
-end
Index: pace/dist/src/sysel/lib/arith.sy
===================================================================
--- uspace/dist/src/sysel/lib/arith.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
-class Arith is
-	-- Return factorial of n.
-	fun Factorial(n : int) : int, static is
-		var i : int;
-		var val : int;
-
-		i = 1;
-		val = 1;
-
-		while i <= n do
-			val = val * i;
-			i = i + 1;
-		end
-
-		return val;
-	end
-end
Index: pace/dist/src/sysel/lib/boxed.sy
===================================================================
--- uspace/dist/src/sysel/lib/boxed.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
---
--- Declarations for boxed variants of primitive types. The interpreter
--- binds to these types internally. They must be declared.
---
-
-class Bool is
-	var Value : bool;
-end
-
-class Char is
-	var Value : char;
-
-	fun get_as_string() : string, builtin;
-
-	-- String representation.
-	prop AsString : string is
-		get is
-			return get_as_string();
-		end
-	end
-end
-
-class Int is
-	var Value : int;
-
-	fun get_as_string() : string, builtin;
-
-	-- String representation.
-	prop AsString : string is
-		get is
-			return get_as_string();
-		end
-	end
-end
-
-class String is
-	var Value : string;
-
-	fun get_length() : int, builtin;
-
-	-- Length of string.
-	prop Length : int is
-		get is
-			return get_length();
-		end
-	end
-
-	-- Slice (sub-string).
-	fun Slice(start : int; length : int) : string, builtin;
-end
Index: pace/dist/src/sysel/lib/ienum.sy
===================================================================
--- uspace/dist/src/sysel/lib/ienum.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Enumerable collection interface.
-interface IEnumerable/tdata is
-	fun GetEnumerator() : IEnumerator/tdata;
-end
-
--- Enumerator interface.
-interface IEnumerator/tdata is
-	fun MoveNext() : bool;
-
-	prop Data : tdata is
-		get;
-	end
-end
Index: pace/dist/src/sysel/lib/libflist
===================================================================
--- uspace/dist/src/sysel/lib/libflist	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-arith.sy
-boxed.sy
-ienum.sy
-list.sy
-map.sy
Index: pace/dist/src/sysel/lib/list.sy
===================================================================
--- uspace/dist/src/sysel/lib/list.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,167 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Doubly-linked list.
-class List/t : IEnumerable/t is
-	var head : ListNode/t;
-
-	-- New empty list.
-	new() is
-		head = new ListNode/t();
-		head.prev = head;
-		head.next = head;
-	end
-
-	-- Append new entry at the end of the list.
-	fun Append(data : t) is
-		var n : ListNode/t;
-		var ntl : ListNode/t;
-
-		ntl = head.prev;
-
-		n = new ListNode/t();
-		n.data = data;
-
-		n.prev = ntl;
-		n.next = head;
-		n.head = head;
-
-		ntl.next = n;
-		head.prev = n;
-	end
-
-	-- Return first node in the list or @c nil if there is none.
-	prop First : ListNode/t is
-		get is
-			return get_first();
-		end
-	end
-
-	-- Return first node in the list or @c nil if there is none.
-	fun GetEnumerator() : IEnumerator/t is
-		return new ListEnumerator/t(get_first());
-	end
-
-	-- Return first node in the list or @c nil if there is none.
-	fun get_first() : ListNode/t is
-		if head.next == head then
-			return nil;
-		else
-			return head.next;
-		end
-	end
-end
-
-class ListNode/t is
-	var data : t;
-
-	var prev : ListNode/t;
-	var next : ListNode/t;
-	var head : ListNode/t;
-
-	-- Data stored in this node.
-	prop Data : t is
-		get is
-			return data;
-		end
-	end
-
-	-- Previous node in list.
-	prop Prev : ListNode/t is
-		get is
-			return get_prev();
-		end
-	end
-
-	-- Next node in list.
-	prop Next : ListNode/t is
-		get is
-			return get_next();
-		end
-	end
-
-	-- Remove node from list.
-	fun Remove() is
-		var p : ListNode/t;
-		var n : ListNode/t;
-
-		p = prev; n = next;
-		p.next = n;
-		n.prev = p;
-
-		prev = nil;
-		next = nil;
-	end
-
-	-- Get next node.
-	fun get_next() : ListNode/t is
-		if next != head then
-			return next;
-		else
-			return nil;
-		end
-	end
-
-	-- Get previous node.
-	fun get_prev() : ListNode/t is
-		if prev != head then
-			return next;
-		else
-			return nil;
-		end
-	end
-end
-
-class ListEnumerator/t : IEnumerator/t is
-	var first : ListNode/t;
-	var current : ListNode/t;
-	var started : bool;
-
-	new(first_node : ListNode/t) is
-		first = first_node;
-		current = nil;
-		started = false;
-	end
-
-	fun MoveNext() : bool is
-		if started then
-			current = current.Next;
-		else
-			current = first;
-			started = true;
-		end
-
-		return current != nil;
-	end
-
-	prop Data : t is
-		get is
-			return current.Data;
-		end
-	end
-end
Index: pace/dist/src/sysel/lib/map.sy
===================================================================
--- uspace/dist/src/sysel/lib/map.sy	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
---
--- Copyright (c) 2010 Jiri Svoboda
--- All rights reserved.
---
--- Redistribution and use in source and binary forms, with or without
--- modification, are permitted provided that the following conditions
--- are met:
---
--- o Redistributions of source code must retain the above copyright
---   notice, this list of conditions and the following disclaimer.
--- o Redistributions in binary form must reproduce the above copyright
---   notice, this list of conditions and the following disclaimer in the
---   documentation and/or other materials provided with the distribution.
--- o The name of the author may not be used to endorse or promote products
---   derived from this software without specific prior written permission.
---
--- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
--- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
--- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
--- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
--- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
--- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---
-
--- Trivial map.
-class Map/tkey/tvalue is
-	var data : List/(MapPair/tkey/tvalue);
-
-	-- New empty map.
-	new() is
-		data = new List/(MapPair/tkey/tvalue)();
-	end
-
-	fun Set(key : tkey; value : tvalue) is
-		if KeyPresent(key) then
-			Remove(key);
-		end
-
-		var p : MapPair/tkey/tvalue;
-		p = new MapPair/tkey/tvalue();
-
-		p.Key = key;
-		p.Value = value;
-		data.Append(p);
-	end
-
-	-- Return internal list node associated with key @a key.
-	fun lookup_node(key : tkey) : ListNode/(MapPair/tkey/tvalue) is
-		var node : ListNode/(MapPair/tkey/tvalue);
-
-		node = data.First;
-		while node != nil do
-			if node.Data.Key == key then
-				return node;
-			end
-
-			node = node.Next;
-		end
-
-		return nil;
-	end
-
-	fun KeyPresent(key : tkey) : bool is
-		return lookup_node(key) != nil;
-	end
-
-	fun Get(key : tkey) : tvalue is
-		var node : ListNode/(MapPair/tkey/tvalue);
-
-		node = lookup_node(key);
-		return node.Data.Value;
-	end
-
-	fun Remove(key : tkey) is
-		var node : ListNode/(MapPair/tkey/tvalue);
-
-		node = lookup_node(key);
-		node.Remove();
-	end
-
-	prop self[key : tkey] : tvalue is
-		get is
-			return Get(key);
-		end
-		set value is
-			Set(key, value);
-		end
-	end
-
-	fun GetEnumerator() : IEnumerator/tkey is
-		return new MapEnumerator/tkey/tvalue(data.get_first());
-	end
-end
-
-class MapPair/tkey/tvalue is
-	var Key : tkey;
-	var Value : tvalue;
-end
-
-class MapEnumerator/tkey/tvalue : IEnumerator/tkey is
-	var first : ListNode/(MapPair/tkey/tvalue);
-	var current : ListNode/(MapPair/tkey/tvalue);
-	var started : bool;
-
-	new(first_node : ListNode/(MapPair/tkey/tvalue)) is
-		first = first_node;
-		current = nil;
-		started = false;
-	end
-
-	fun MoveNext() : bool is
-		if started then
-			current = current.Next;
-		else
-			current = first;
-			started = true;
-		end
-
-		return current != nil;
-	end
-
-	prop Data : tkey is
-		get is
-			return current.Data.Key;
-		end
-	end
-end
Index: pace/doc/doxygroups.h
===================================================================
--- uspace/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/* Definitions of modules and its relations for generating Doxygen documentation */
-
-/**
- * @defgroup uspace uspace
- * @brief HelenOS userspace
- */
-
-/**
- * @defgroup apps HelenOS applications
- * @ingroup uspace
- */
-
-/**
- * @defgroup drvs HelenOS drivers
- * @brief HelenOS device drivers using the DDF framework
- * @ingroup uspace
- */
-
-/**
- * @defgroup libs HelenOS libraries
- * @ingroup uspace
- */
-
-/**
- * @defgroup srvs HelenOS services
- * @ingroup uspace
- */
-
-/*
- * SPECIAL COMPOSITIONS
- */
-
-/**
- * @defgroup usb USB
- * @ingroup uspace
- * @brief USB support for HelenOS.
- */
-
-/**
- *     @defgroup libusb Base USB library
- *     @ingroup usb
- *     @brief Common definitions for any driver or application
- *     dealing with USB.
- */
-
-/**
- *     @defgroup libusbdev USB library for device drivers
- *     @ingroup usb
- *     @brief Library for writing drivers of endpoint devices (functions).
- */
-
-/**
- *     @defgroup libusbhost USB library for host controller drivers
- *     @ingroup usb
- *     @brief Library for writing host controller drivers.
- */
-
-/**
- *     @defgroup libusbhid USB library for HID devices
- *     @ingroup usb
- *     @brief Library for writing USB HID drivers.
- */
-
-/**
- *     @defgroup usbvirt USB virtualization
- *     @ingroup usb
- *     @brief Support for virtual USB devices.
- */
-
-/**
- *         @defgroup libusbvirt USB virtualization library
- *         @ingroup usbvirt
- *         @brief Library for creating virtual USB devices.
- */
-
-/**
- *         @defgroup drvusbvhc Virtual USB host controller
- *         @ingroup usbvirt
- *         @brief Driver simulating work of USB host controller.
- */
-
-/**
- *         @defgroup usbvirthub Virtual USB hub
- *         @ingroup usbvirt
- *         @brief Extra virtual USB hub for virtual host controller.
- *         @details
- *         Some of the sources are shared with virtual host controller,
- *         see @ref drvusbvhc for the rest of the files.
- */
-
-/**
- *         @defgroup usbvirtkbd Virtual USB keybaord
- *         @ingroup usbvirt
- *         @brief Virtual USB keyboard for virtual host controller.
- */
-
-/**
- *     @defgroup usbinfo USB info application
- *     @ingroup usb
- *     @brief Application for querying USB devices.
- *     @details
- *     The intended usage of this application is to query new USB devices
- *     for their descriptors etc. to simplify driver writing.
- */
-
-/**
- *     @defgroup lsusb HelenOS version of lsusb command
- *     @ingroup usb
- *     @brief Application for listing USB host controllers.
- *     @details
- *     List all found host controllers.
- */
-
-/**
- *     @defgroup drvusbmid USB multi interface device driver
- *     @ingroup usb
- *     @brief USB multi interface device driver
- *     @details
- *     This driver serves as a mini hub (or bus) driver for devices
- *     that have the class defined at interface level (those devices
- *     usually have several interfaces).
- *
- *     The term multi interface device driver (MID) was borrowed
- *     Solaris operating system.
- */
-
-/**
- *     @defgroup drvusbhub USB hub driver
- *     @ingroup usb
- *     @brief USB hub driver.
- */
-
-/**
- *     @defgroup drvusbhid USB HID driver
- *     @ingroup usb
- *     @brief USB driver for HID devices.
- */
-
-/**
- *     @defgroup drvusbmast USB mass storage driver
- *     @ingroup usb
- *     @brief USB driver for mass storage devices (bulk-only protocol).
- *     This driver is a only a stub and is currently used only for
- *     testing that bulk transfers work.
- */
-
-/**
- *     @addtogroup drvusbuhci
- *     @ingroup usb
- */
-
-/**
- *     @addtogroup drvusbohci
- *     @ingroup usb
- */
-
-/**
- *     @addtogroup drvusbehci
- *     @ingroup usb
- */
-
-/**
- *     @addtogroup drvusbxhci
- *     @ingroup usb
- */
-
-/**
- *     @defgroup drvusbfallback USB fallback driver
- *     @ingroup usb
- *     @brief Fallback driver for any USB device.
- *     @details
- *     The purpose of this driver is to simplify querying of unknown
- *     devices from within HelenOS (without a driver, no node at all
- *     may appear under /loc/devices).
- */
Index: pace/drv/audio/hdaudio/codec.c
===================================================================
--- uspace/drv/audio/hdaudio/codec.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,699 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio codec
- */
-
-#include <async.h>
-#include <bitops.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-
-#include "codec.h"
-#include "hdactl.h"
-#include "spec/codec.h"
-#include "spec/fmt.h"
-#include "stream.h"
-
-static errno_t hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,
-    uint32_t *resp)
-{
-	uint32_t verb;
-	uint32_t myresp;
-
-	if (resp == NULL)
-		resp = &myresp;
-
-	if ((vid & 0x700) != 0) {
-		verb = (codec->address << 28) |
-		    ((node & 0x1ff) << 20) |
-		    ((vid & 0xfff) << 8) |
-		    (payload & 0xff);
-	} else {
-		verb = (codec->address << 28) |
-		    ((node & 0x1ff) << 20) |
-		    ((vid & 0xf) << 16) |
-		    (payload & 0xffff);
-	}
-	errno_t rc = hda_cmd(codec->hda, verb, resp);
-
-#if 0
-	if (resp != NULL) {
-		ddf_msg(LVL_DEBUG, "verb 0x%" PRIx32 " -> 0x%" PRIx32, verb,
-		    *resp);
-	} else {
-		ddf_msg(LVL_DEBUG, "verb 0x%" PRIx32, verb);
-	}
-#endif
-	return rc;
-}
-
-static errno_t hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,
-    uint32_t *resp)
-{
-	return hda_ccmd(codec, node, hda_param_get, param, resp);
-}
-
-static errno_t hda_get_subnc(hda_codec_t *codec, int node, int *startnode,
-    int *nodecount)
-{
-	errno_t rc;
-	uint32_t resp;
-
-	rc = hda_get_parameter(codec, node, hda_sub_nc, &resp);
-	if (rc != EOK)
-		return rc;
-
-	*startnode = BIT_RANGE_EXTRACT(uint32_t, subnc_startnode_h,
-	    subnc_startnode_l, resp);
-	*nodecount = BIT_RANGE_EXTRACT(uint32_t, subnc_nodecount_h,
-	    subnc_nodecount_l, resp);
-
-	return EOK;
-}
-
-/** Get Function Group Type */
-static errno_t hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,
-    hda_fgrp_type_t *type)
-{
-	errno_t rc;
-	uint32_t resp;
-
-	rc = hda_get_parameter(codec, node, hda_fgrp_type, &resp);
-	if (rc != EOK)
-		return rc;
-
-	*unsol = (resp & BIT_V(uint32_t, fgrpt_unsol)) != 0;
-	*type = BIT_RANGE_EXTRACT(uint32_t, fgrpt_type_h, fgrpt_type_l, resp);
-
-	return EOK;
-}
-
-static errno_t hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,
-    int *items)
-{
-	errno_t rc;
-	uint32_t resp;
-
-	rc = hda_get_parameter(codec, node, hda_clist_len, &resp);
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG2, "hda_get_clist_len: resp=0x%x", resp);
-	*longform = resp & BIT_V(uint32_t, cll_longform);
-	*items = resp & BIT_RANGE_EXTRACT(uint32_t, cll_len_h, cll_len_l, resp);
-	return EOK;
-}
-
-static errno_t hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)
-{
-	return hda_ccmd(codec, node, hda_clist_entry_get, n, resp);
-}
-
-static errno_t hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)
-{
-	return hda_ccmd(codec, node, hda_eapd_btl_enable_get, 0, resp);
-}
-
-static errno_t hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)
-{
-	return hda_ccmd(codec, node, hda_eapd_btl_enable_set, payload, NULL);
-}
-
-/** Get Suppported PCM Size, Rates */
-static errno_t hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)
-{
-	return hda_get_parameter(codec, node, hda_supp_rates, rates);
-}
-
-/** Get Suppported Stream Formats */
-static errno_t hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)
-{
-	return hda_get_parameter(codec, node, hda_supp_formats, fmts);
-}
-
-static errno_t hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)
-{
-	return hda_ccmd(codec, node, hda_converter_fmt_set, fmt, NULL);
-}
-
-static errno_t hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,
-    uint8_t channel)
-{
-	uint32_t ctl;
-
-	ctl = (stream << cctl_stream_l) | (channel << cctl_channel_l);
-	return hda_ccmd(codec, node, hda_converter_ctl_set, ctl, NULL);
-}
-
-static errno_t hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)
-{
-	return hda_ccmd(codec, node, hda_pin_ctl_set, pctl, NULL);
-}
-
-static errno_t hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)
-{
-	errno_t rc;
-	uint32_t resp;
-
-	rc = hda_ccmd(codec, node, hda_pin_ctl_get, 0, &resp);
-	if (rc != EOK)
-		return rc;
-
-	*pctl = resp;
-	return EOK;
-}
-
-/** Get Audio Widget Capabilities */
-static errno_t hda_get_aw_caps(hda_codec_t *codec, int node,
-    hda_awidget_type_t *type, uint32_t *caps)
-{
-	errno_t rc;
-	uint32_t resp;
-
-	rc = hda_get_parameter(codec, node, hda_aw_caps, &resp);
-	if (rc != EOK)
-		return rc;
-
-	*type = BIT_RANGE_EXTRACT(uint32_t, awc_type_h, awc_type_l, resp);
-	*caps = resp;
-
-	return EOK;
-}
-
-/** Get Pin Capabilities */
-static errno_t hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)
-{
-	return hda_get_parameter(codec, node, hda_pin_caps, caps);
-}
-
-/** Get Power State */
-static errno_t hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)
-{
-	return hda_ccmd(codec, node, hda_power_state_get, 0, pstate);
-}
-
-/** Get Configuration Default */
-static errno_t hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)
-{
-	return hda_ccmd(codec, node, hda_cfg_def_get, 0, cfgdef);
-}
-
-static errno_t hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)
-{
-	return hda_ccmd(codec, node, hda_conn_sel_get, 0, conn);
-}
-
-/** Get Amplifier Gain / Mute  */
-static errno_t hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,
-    uint32_t *resp)
-{
-	ddf_msg(LVL_DEBUG2, "hda_get_amp_gain_mute(codec, %d, %x)",
-	    node, payload);
-	errno_t rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);
-	ddf_msg(LVL_DEBUG2, "hda_get_amp_gain_mute(codec, %d, %x, resp=%x)",
-	    node, payload, *resp);
-	return rc;
-}
-
-/** Get GP I/O Count */
-static errno_t hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)
-{
-	return hda_get_parameter(codec, node, hda_gpio_cnt, resp);
-}
-
-static errno_t hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)
-{
-	ddf_msg(LVL_DEBUG2, "hda_set_amp_gain_mute(codec, %d, %x)",
-	    node, payload);
-	return hda_ccmd(codec, node, hda_amp_gain_mute_set, payload, NULL);
-}
-
-static errno_t hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)
-{
-	uint32_t ampcaps;
-	uint32_t gmleft, gmright;
-	uint32_t offset;
-	errno_t rc;
-
-	rc = hda_get_parameter(codec, aw,
-	    hda_out_amp_caps, &ampcaps);
-	if (rc != EOK)
-		goto error;
-
-	offset = ampcaps & 0x7f;
-	ddf_msg(LVL_DEBUG, "out amp caps 0x%x (offset=0x%x)",
-	    ampcaps, offset);
-
-	rc = hda_set_amp_gain_mute(codec, aw, 0xb000 + offset);
-	if (rc != EOK)
-		goto error;
-
-	rc = hda_get_amp_gain_mute(codec, aw, 0x8000, &gmleft);
-	if (rc != EOK)
-		goto error;
-
-	rc = hda_get_amp_gain_mute(codec, aw, 0xa000, &gmright);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "gain/mute: L:0x%x R:0x%x", gmleft, gmright);
-
-	return EOK;
-error:
-	return rc;
-}
-
-static errno_t hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)
-{
-	uint32_t ampcaps;
-	uint32_t gmleft, gmright;
-	uint32_t offset;
-	int i;
-	errno_t rc;
-
-	rc = hda_get_parameter(codec, aw,
-	    hda_out_amp_caps, &ampcaps);
-	if (rc != EOK)
-		goto error;
-
-	offset = ampcaps & 0x7f;
-	ddf_msg(LVL_DEBUG, "in amp caps 0x%x (offset=0x%x)", ampcaps, offset);
-
-	for (i = 0; i < 15; i++) {
-		rc = hda_set_amp_gain_mute(codec, aw, 0x7000 + (i << 8) + offset);
-		if (rc != EOK)
-			goto error;
-
-		rc = hda_get_amp_gain_mute(codec, aw, 0x0000 + i, &gmleft);
-		if (rc != EOK)
-			goto error;
-
-		rc = hda_get_amp_gain_mute(codec, aw, 0x2000 + i, &gmright);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "in:%d gain/mute: L:0x%x R:0x%x",
-		    i, gmleft, gmright);
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-static errno_t hda_clist_dump(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
-	bool longform;
-	int len;
-	uint32_t resp;
-	uint32_t mask;
-	uint32_t cidx;
-	int shift;
-	int epresp;
-	int i, j;
-
-	ddf_msg(LVL_DEBUG, "Connections for widget %d:", aw);
-
-	rc = hda_get_clist_len(codec, aw, &longform, &len);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting connection list length.");
-		return rc;
-	}
-
-	if (len > 1) {
-		rc = hda_get_conn_sel(codec, aw, &cidx);
-		if (rc != EOK) {
-			ddf_msg(LVL_ERROR, "Failed getting connection select");
-			return rc;
-		}
-	} else {
-		cidx = 0;
-	}
-
-	ddf_msg(LVL_DEBUG2, "longform:%d len:%d", longform, len);
-
-	if (longform) {
-		epresp = 2;
-		mask = 0xffff;
-		shift = 16;
-	} else {
-		epresp = 4;
-		mask = 0xff;
-		shift = 8;
-	}
-
-	i = 0;
-	while (i < len) {
-		rc = hda_get_clist_entry(codec, aw, i, &resp);
-		if (rc != EOK) {
-			ddf_msg(LVL_ERROR, "Failed getting connection list entry.");
-			return rc;
-		}
-
-		for (j = 0; j < epresp && i < len; j++) {
-			ddf_msg(LVL_DEBUG, "<- %d%s", resp & mask,
-			    (int)cidx == i ? " *** current *** " : "");
-			resp = resp >> shift;
-			++i;
-		}
-
-	}
-
-	return rc;
-}
-
-static errno_t hda_pin_init(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
-	uint32_t cfgdef;
-	uint32_t pcaps;
-	uint32_t eapd;
-	uint8_t pctl;
-
-	rc = hda_get_cfg_def(codec, aw, &cfgdef);
-	if (rc != EOK)
-		goto error;
-	ddf_msg(LVL_DEBUG, "aw %d: PIN cdfgef=0x%x",
-	    aw, cfgdef);
-
-	rc = hda_get_pin_caps(codec, aw, &pcaps);
-	if (rc != EOK)
-		goto error;
-	ddf_msg(LVL_DEBUG, "aw %d : PIN caps=0x%x",
-	    aw, pcaps);
-
-	if ((pcaps & BIT_V(uint32_t, pwc_eapd)) != 0) {
-		rc = hda_get_eapd_btl_enable(codec, aw, &eapd);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "PIN %d had EAPD value=0x%x", aw, eapd);
-
-		rc = hda_set_eapd_btl_enable(codec, aw, eapd | 2);
-		if (rc != EOK)
-			goto error;
-
-		rc = hda_get_eapd_btl_enable(codec, aw, &eapd);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "PIN %d now has EAPD value=0x%x", aw, eapd);
-	}
-
-	pctl = 0;
-	if ((pcaps & BIT_V(uint32_t, pwc_output)) != 0) {
-		ddf_msg(LVL_DEBUG, "PIN %d will enable output", aw);
-		pctl = pctl | BIT_V(uint8_t, pctl_out_enable);
-	}
-
-	if ((pcaps & BIT_V(uint32_t, pwc_input)) != 0) {
-		ddf_msg(LVL_DEBUG, "PIN %d will enable input", aw);
-		pctl = pctl | BIT_V(uint8_t, pctl_in_enable);
-	}
-
-	if ((pcaps & BIT_V(uint32_t, pwc_hpd)) != 0) {
-		ddf_msg(LVL_DEBUG, "PIN %d will enable headphone drive", aw);
-		pctl = pctl | BIT_V(uint8_t, pctl_hpd_enable);
-	}
-
-#if 0
-	if ((pcaps & BIT_V(uint32_t, pwc_input)) != 0) {
-		ddf_msg(LVL_DEBUG, "PIN %d will enable input");
-		pctl = pctl | BIT_V(uint8_t, pctl_input_enable);
-	}
-#endif
-	ddf_msg(LVL_DEBUG, "Setting PIN %d ctl to 0x%x", aw, pctl);
-	rc = hda_set_pin_ctl(codec, aw, pctl);
-	if (rc != EOK)
-		goto error;
-
-	pctl = 0;
-	rc = hda_get_pin_ctl(codec, aw, &pctl);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "PIN %d ctl reads as 0x%x", aw, pctl);
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Init power-control in wiget capable of doing so. */
-static errno_t hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)
-{
-	errno_t rc;
-	uint32_t pwrstate;
-
-	ddf_msg(LVL_DEBUG, "aw %d is power control-capable", aw);
-
-	rc = hda_get_power_state(codec, aw, &pwrstate);
-	if (rc != EOK)
-		goto error;
-	ddf_msg(LVL_DEBUG, "aw %d: power state = 0x%x", aw, pwrstate);
-
-	return EOK;
-error:
-	return rc;
-}
-
-hda_codec_t *hda_codec_init(hda_t *hda, uint8_t address)
-{
-	hda_codec_t *codec;
-	errno_t rc;
-	int sfg, nfg;
-	int saw, naw;
-	int fg, aw;
-	bool unsol;
-	hda_fgrp_type_t grptype;
-	hda_awidget_type_t awtype;
-	uint32_t awcaps;
-	uint32_t rates;
-	uint32_t formats;
-	uint32_t gpio;
-
-	codec = calloc(1, sizeof(hda_codec_t));
-	if (codec == NULL)
-		return NULL;
-
-	codec->hda = hda;
-	codec->address = address;
-	codec->in_aw = -1;
-	codec->out_aw = -1;
-
-	rc = hda_get_subnc(codec, 0, &sfg, &nfg);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "hda_get_subnc -> %s", str_error_name(rc));
-	ddf_msg(LVL_DEBUG, "sfg=%d nfg=%d", sfg, nfg);
-
-	for (fg = sfg; fg < sfg + nfg; fg++) {
-		ddf_msg(LVL_DEBUG, "Enumerate FG %d", fg);
-
-		rc = hda_get_fgrp_type(codec, fg, &unsol, &grptype);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "hda_get_fgrp_type -> %s", str_error_name(rc));
-		ddf_msg(LVL_DEBUG, "unsol: %d, grptype: %d", unsol, grptype);
-
-		rc = hda_get_gpio_cnt(codec, fg, &gpio);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "GPIO: wake=%d unsol=%d gpis=%d gpos=%d gpios=%d",
-		    (gpio & BIT_V(uint32_t, 31)) != 0,
-		    (gpio & BIT_V(uint32_t, 30)) != 0,
-		    BIT_RANGE_EXTRACT(uint32_t, 23, 16, gpio),
-		    BIT_RANGE_EXTRACT(uint32_t, 15, 8, gpio),
-		    BIT_RANGE_EXTRACT(uint32_t, 7, 0, gpio));
-
-		rc = hda_power_ctl_init(codec, fg);
-		if (rc != EOK)
-			goto error;
-
-		rc = hda_get_subnc(codec, fg, &saw, &naw);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "hda_get_subnc -> %s", str_error_name(rc));
-		ddf_msg(LVL_DEBUG, "saw=%d baw=%d", saw, naw);
-
-		for (aw = saw; aw < saw + naw; aw++) {
-			rc = hda_get_aw_caps(codec, aw, &awtype, &awcaps);
-			if (rc != EOK)
-				goto error;
-			ddf_msg(LVL_DEBUG, "aw %d: type=0x%x caps=0x%x",
-			    aw, awtype, awcaps);
-
-			if ((awcaps & BIT_V(uint32_t, awc_power_cntrl)) != 0) {
-				rc = hda_power_ctl_init(codec, aw);
-				if (rc != EOK)
-					goto error;
-			}
-
-			switch (awtype) {
-			case awt_audio_input:
-			case awt_audio_mixer:
-			case awt_audio_selector:
-			case awt_pin_complex:
-			case awt_power_widget:
-				rc = hda_clist_dump(codec, aw);
-				if (rc != EOK)
-					goto error;
-				break;
-			default:
-				break;
-			}
-
-			if (awtype == awt_pin_complex) {
-				rc = hda_pin_init(codec, aw);
-				if (rc != EOK)
-					goto error;
-			} else if (awtype == awt_audio_output) {
-				rc = hda_get_supp_rates(codec, aw, &rates);
-				if (rc != EOK)
-					goto error;
-
-				rc = hda_get_supp_formats(codec, aw, &formats);
-				if (rc != EOK)
-					goto error;
-
-				if (rates != 0 && formats != 0 &&
-				    codec->out_aw < 0) {
-					ddf_msg(LVL_DEBUG, "Selected output "
-					    "widget %d\n", aw);
-					codec->out_aw = aw;
-				} else {
-					ddf_msg(LVL_DEBUG, "Ignoring output "
-					    "widget %d\n", aw);
-				}
-
-				ddf_msg(LVL_NOTE, "Output widget %d: rates=0x%x formats=0x%x",
-				    aw, rates, formats);
-				codec->out_aw_rates = rates;
-				codec->out_aw_formats = formats;
-			} else if (awtype == awt_audio_input) {
-				if (codec->in_aw < 0) {
-					ddf_msg(LVL_DEBUG, "Selected input "
-					    "widget %d\n", aw);
-					codec->in_aw = aw;
-				} else {
-					ddf_msg(LVL_DEBUG, "Ignoring input "
-					    "widget %d\n", aw);
-				}
-
-				rc = hda_get_supp_rates(codec, aw, &rates);
-				if (rc != EOK)
-					goto error;
-
-				rc = hda_get_supp_formats(codec, aw, &formats);
-				if (rc != EOK)
-					goto error;
-
-				ddf_msg(LVL_DEBUG, "Input widget %d: rates=0x%x formats=0x%x",
-				    aw, rates, formats);
-				codec->in_aw_rates = rates;
-				codec->in_aw_formats = formats;
-			}
-
-			if ((awcaps & BIT_V(uint32_t, awc_out_amp_present)) != 0)
-				hda_set_out_amp_max(codec, aw);
-
-			if ((awcaps & BIT_V(uint32_t, awc_in_amp_present)) != 0)
-				hda_set_in_amp_max(codec, aw);
-		}
-	}
-
-	hda_ctl_dump_info(hda->ctl);
-
-	ddf_msg(LVL_DEBUG, "Codec OK");
-	return codec;
-error:
-	free(codec);
-	return NULL;
-}
-
-void hda_codec_fini(hda_codec_t *codec)
-{
-	ddf_msg(LVL_DEBUG, "hda_codec_fini()");
-	free(codec);
-}
-
-errno_t hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
-{
-	errno_t rc;
-
-	/* Configure converter */
-	ddf_msg(LVL_DEBUG, "Configure output converter format / %d",
-	    codec->out_aw);
-	rc = hda_set_converter_fmt(codec, codec->out_aw, stream->fmt);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "Configure output converter stream, channel");
-	rc = hda_set_converter_ctl(codec, codec->out_aw, stream->sid, 0);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-errno_t hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)
-{
-	errno_t rc;
-
-	/* Configure converter */
-
-	ddf_msg(LVL_DEBUG, "Configure input converter format");
-	rc = hda_set_converter_fmt(codec, codec->in_aw, stream->fmt);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "Configure input converter stream, channel");
-	rc = hda_set_converter_ctl(codec, codec->in_aw, stream->sid, 0);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/codec.h
===================================================================
--- uspace/drv/audio/hdaudio/codec.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio controller
- */
-
-#ifndef CODEC_H
-#define CODEC_H
-
-#include "hdaudio.h"
-#include "stream.h"
-
-typedef struct hda_codec {
-	hda_t *hda;
-	uint8_t address;
-	int out_aw;
-	uint32_t out_aw_rates;
-	uint32_t out_aw_formats;
-	int out_aw_num;
-	int out_aw_sel;
-	int in_aw;
-	uint32_t in_aw_rates;
-	uint32_t in_aw_formats;
-} hda_codec_t;
-
-extern hda_codec_t *hda_codec_init(hda_t *, uint8_t);
-extern void hda_codec_fini(hda_codec_t *);
-extern errno_t hda_out_converter_setup(hda_codec_t *, hda_stream_t *);
-extern errno_t hda_in_converter_setup(hda_codec_t *, hda_stream_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/doc/doxygroups.h
===================================================================
--- uspace/drv/audio/hdaudio/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup hdaudio hdaudio
- * @brief High Definition Audio driver
- * @ingroup drvs
- */
Index: pace/drv/audio/hdaudio/hdactl.c
===================================================================
--- uspace/drv/audio/hdaudio/hdactl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,725 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio controller
- */
-
-#include <as.h>
-#include <async.h>
-#include <bitops.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <macros.h>
-#include <stdint.h>
-
-#include "codec.h"
-#include "hdactl.h"
-#include "regif.h"
-#include "spec/regs.h"
-
-enum {
-	ctrl_init_wait_max = 10,
-	codec_enum_wait_us = 512,
-	corb_wait_max = 10,
-	rirb_wait_max = 100,
-	solrb_wait_us = 100 * 1000
-};
-
-static void hda_ctl_process_rirb(hda_ctl_t *);
-
-/** Perform set-reset handshake on a 16-bit register.
- *
- * The bit(s) specified in the mask are written as 1, then we wait
- * for them to read as 1. Then we write them as 0 and we wait for them
- * to read as 0.
- */
-static errno_t hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)
-{
-	uint16_t val;
-	int wcnt;
-
-	val = hda_reg16_read(reg);
-	hda_reg16_write(reg, val | mask);
-
-	wcnt = 1000;
-	while (wcnt > 0) {
-		val = hda_reg16_read(reg);
-		if ((val & mask) == mask)
-			break;
-
-		fibril_usleep(1000);
-		--wcnt;
-	}
-
-	if ((val & mask) != mask)
-		return ETIMEOUT;
-
-	val = hda_reg16_read(reg);
-	hda_reg16_write(reg, val & ~mask);
-
-	wcnt = 1000;
-	while (wcnt > 0) {
-		val = hda_reg16_read(reg);
-		if ((val & mask) == 0)
-			break;
-
-		fibril_usleep(1000);
-		--wcnt;
-	}
-
-	if ((val & mask) != 0)
-		return ETIMEOUT;
-
-	return EOK;
-}
-
-/** Select an appropriate CORB/RIRB size.
- *
- * We always use the largest available size. In @a sizecap each of bits
- * 0, 1, 2 determine whether one of the supported size (0 == 2 entries,
- * 1 == 16 entries, 2 == 256 entries) is supported. @a *selsz is set to
- * one of 0, 1, 2 on success.
- *
- * @param sizecap	CORB/RIRB Size Capability
- * @param selsz		Place to store CORB/RIRB Size
- * @return		EOK on success, EINVAL if sizecap has no valid bits set
- *
- */
-static errno_t hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)
-{
-	int i;
-
-	for (i = 2; i >= 0; --i) {
-		if ((sizecap & BIT_V(uint8_t, i)) != 0) {
-			*selsz = i;
-			return EOK;
-		}
-	}
-
-	return EINVAL;
-}
-
-static size_t hda_rb_entries(uint8_t selsz)
-{
-	switch (selsz) {
-	case 0:
-		return 2;
-	case 1:
-		return 16;
-	case 2:
-		return 256;
-	default:
-		assert(false);
-		return 0;
-	}
-}
-
-/** Initialize the CORB */
-static errno_t hda_corb_init(hda_t *hda)
-{
-	uint8_t ctl;
-	uint8_t corbsz;
-	uint8_t sizecap;
-	uint8_t selsz;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_corb_init()");
-
-	/* Stop CORB if not stopped */
-	ctl = hda_reg8_read(&hda->regs->corbctl);
-	if ((ctl & BIT_V(uint8_t, corbctl_run)) != 0) {
-		ddf_msg(LVL_DEBUG, "CORB is enabled, disabling first.");
-		hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t,
-		    corbctl_run));
-	}
-
-	/* Determine CORB size and allocate CORB buffer */
-	corbsz = hda_reg8_read(&hda->regs->corbsize);
-	sizecap = BIT_RANGE_EXTRACT(uint8_t, corbsize_cap_h,
-	    corbsize_cap_l, corbsz);
-	rc = hda_rb_size_select(sizecap, &selsz);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid CORB Size Capability");
-		goto error;
-	}
-	corbsz = corbsz & ~BIT_RANGE(uint8_t, corbsize_size_h, corbsize_size_l);
-	corbsz = corbsz | selsz;
-
-	ddf_msg(LVL_DEBUG, "Setting CORB Size register to 0x%x", corbsz);
-	hda_reg8_write(&hda->regs->corbsize, corbsz);
-	hda->ctl->corb_entries = hda_rb_entries(selsz);
-
-	/*
-	 * CORB must be aligned to 128 bytes. If 64OK is not set,
-	 * it must be within the 32-bit address space.
-	 */
-	hda->ctl->corb_virt = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(hda->ctl->corb_entries * sizeof(uint32_t),
-	    hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &hda->ctl->corb_phys, &hda->ctl->corb_virt);
-	if (rc != EOK) {
-		hda->ctl->corb_virt = NULL;
-		ddf_msg(LVL_ERROR, "Failed allocating DMA memory for CORB");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Set CORB base registers");
-
-	/* Update CORB base registers */
-	hda_reg32_write(&hda->regs->corblbase, LOWER32(hda->ctl->corb_phys));
-	hda_reg32_write(&hda->regs->corbubase, UPPER32(hda->ctl->corb_phys));
-
-	ddf_msg(LVL_DEBUG, "Reset CORB Read/Write pointers");
-
-	/* Reset CORB Read Pointer */
-	rc = hda_ctl_reg16_set_reset(&hda->regs->corbrp,
-	    BIT_V(uint16_t, corbrp_rst));
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed resetting CORBRP");
-		goto error;
-	}
-
-	/* Reset CORB Write Pointer */
-	hda_reg16_write(&hda->regs->corbwp, 0);
-
-	/* Start CORB */
-	ctl = hda_reg8_read(&hda->regs->corbctl);
-	ddf_msg(LVL_DEBUG, "CORBctl (0x%x) = 0x%x",
-	    (unsigned)((void *)&hda->regs->corbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, corbctl_run));
-	hda_reg8_write(&hda->regs->corbctl, ctl | BIT_V(uint8_t, corbctl_run));
-
-	ddf_msg(LVL_DEBUG, "CORB initialized");
-	return EOK;
-error:
-	if (hda->ctl->corb_virt != NULL) {
-		dmamem_unmap_anonymous(hda->ctl->corb_virt);
-		hda->ctl->corb_virt = NULL;
-	}
-	return EIO;
-}
-
-/** Tear down the CORB */
-static void hda_corb_fini(hda_t *hda)
-{
-	uint8_t ctl;
-
-	/* Stop CORB */
-	ctl = hda_reg8_read(&hda->regs->corbctl);
-	hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t, corbctl_run));
-
-	if (hda->ctl->corb_virt != NULL)
-		dmamem_unmap_anonymous(hda->ctl->corb_virt);
-}
-
-/** Initialize the RIRB */
-static errno_t hda_rirb_init(hda_t *hda)
-{
-	uint8_t ctl;
-	uint8_t rirbsz;
-	uint8_t sizecap;
-	uint8_t selsz;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_rirb_init()");
-
-	/* Stop RIRB if not stopped */
-	ctl = hda_reg8_read(&hda->regs->rirbctl);
-	if ((ctl & BIT_V(uint8_t, rirbctl_run)) != 0) {
-		ddf_msg(LVL_DEBUG, "RIRB is enabled, disabling first.");
-		hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t,
-		    rirbctl_run));
-	}
-
-	/* Determine RIRB size and allocate RIRB buffer */
-	rirbsz = hda_reg8_read(&hda->regs->rirbsize);
-	sizecap = BIT_RANGE_EXTRACT(uint8_t, rirbsize_cap_h,
-	    rirbsize_cap_l, rirbsz);
-	rc = hda_rb_size_select(sizecap, &selsz);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid RIRB Size Capability");
-		goto error;
-	}
-	rirbsz = rirbsz & ~BIT_RANGE(uint8_t, rirbsize_size_h, rirbsize_size_l);
-	rirbsz = rirbsz | (selsz << rirbsize_size_l);
-
-	ddf_msg(LVL_DEBUG, "Setting RIRB Size register to 0x%x", rirbsz);
-	hda_reg8_write(&hda->regs->rirbsize, rirbsz);
-	hda->ctl->rirb_entries = hda_rb_entries(selsz);
-
-	/*
-	 * RIRB must be aligned to 128 bytes. If 64OK is not set,
-	 * it must be within the 32-bit address space.
-	 */
-	hda->ctl->rirb_virt = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(hda->ctl->rirb_entries * sizeof(uint64_t),
-	    hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &hda->ctl->rirb_phys, &hda->ctl->rirb_virt);
-	if (rc != EOK) {
-		hda->ctl->rirb_virt = NULL;
-		ddf_msg(LVL_ERROR, "Failed allocating DMA memory for RIRB");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Set RIRB base registers");
-
-	/* Update RIRB base registers */
-	hda_reg32_write(&hda->regs->rirblbase, LOWER32(hda->ctl->rirb_phys));
-	hda_reg32_write(&hda->regs->rirbubase, UPPER32(hda->ctl->rirb_phys));
-
-	ddf_msg(LVL_DEBUG, "Reset RIRB Write pointer");
-
-	/* Reset RIRB Write Pointer */
-	hda_reg16_write(&hda->regs->rirbwp, BIT_V(uint16_t, rirbwp_rst));
-
-	/* Set RINTCNT - Qemu won't read from CORB if this is zero */
-	hda_reg16_write(&hda->regs->rintcnt, hda->ctl->rirb_entries / 2);
-
-	hda->ctl->rirb_rp = 0;
-
-	/* Start RIRB and enable RIRB interrupt */
-	ctl = hda_reg8_read(&hda->regs->rirbctl);
-	ddf_msg(LVL_DEBUG, "RIRBctl (0x%x) = 0x%x",
-	    (unsigned)((void *)&hda->regs->rirbctl - (void *)hda->regs), ctl | BIT_V(uint8_t, rirbctl_run));
-	hda_reg8_write(&hda->regs->rirbctl, ctl | BIT_V(uint8_t, rirbctl_run) |
-	    BIT_V(uint8_t, rirbctl_int));
-
-	ddf_msg(LVL_DEBUG, "RIRB initialized");
-	return EOK;
-error:
-	if (hda->ctl->rirb_virt != NULL) {
-		dmamem_unmap_anonymous(hda->ctl->rirb_virt);
-		hda->ctl->rirb_virt = NULL;
-	}
-	return EIO;
-}
-
-/** Tear down the RIRB */
-static void hda_rirb_fini(hda_t *hda)
-{
-	uint8_t ctl;
-
-	/* Stop RIRB and disable RIRB interrupt */
-	ctl = hda_reg8_read(&hda->regs->rirbctl);
-	hda_reg8_write(&hda->regs->rirbctl, ctl &
-	    ~(BIT_V(uint8_t, rirbctl_run) | BIT_V(uint8_t, rirbctl_int)));
-
-	if (hda->ctl->rirb_virt != NULL)
-		dmamem_unmap_anonymous(hda->ctl->rirb_virt);
-}
-
-static size_t hda_get_corbrp(hda_t *hda)
-{
-	uint16_t corbrp;
-
-	corbrp = hda_reg16_read(&hda->regs->corbrp);
-	return BIT_RANGE_EXTRACT(uint16_t, corbrp_rp_h, corbrp_rp_l, corbrp);
-}
-
-static size_t hda_get_corbwp(hda_t *hda)
-{
-	uint16_t corbwp;
-
-	corbwp = hda_reg16_read(&hda->regs->corbwp);
-	return BIT_RANGE_EXTRACT(uint16_t, corbwp_wp_h, corbwp_wp_l, corbwp);
-}
-
-static void hda_set_corbwp(hda_t *hda, size_t wp)
-{
-	ddf_msg(LVL_DEBUG2, "Set CORBWP = %zu", wp);
-	hda_reg16_write(&hda->regs->corbwp, wp);
-}
-
-static size_t hda_get_rirbwp(hda_t *hda)
-{
-	uint16_t rirbwp;
-
-	rirbwp = hda_reg16_read(&hda->regs->rirbwp);
-	return BIT_RANGE_EXTRACT(uint16_t, rirbwp_wp_h, rirbwp_wp_l, rirbwp);
-}
-
-/** Determine number of free entries in CORB */
-static size_t hda_corb_avail(hda_t *hda)
-{
-	int rp, wp;
-	int avail;
-
-	rp = hda_get_corbrp(hda);
-	wp = hda_get_corbwp(hda);
-
-	avail = rp - wp - 1;
-	while (avail < 0)
-		avail += hda->ctl->corb_entries;
-
-	return avail;
-}
-
-/** Write to CORB */
-static errno_t hda_corb_write(hda_t *hda, uint32_t *data, size_t count)
-{
-	size_t avail;
-	size_t wp;
-	size_t idx;
-	size_t now;
-	size_t i;
-	uint32_t *corb;
-	int wcnt;
-
-	avail = hda_corb_avail(hda);
-	wp = hda_get_corbwp(hda);
-	corb = (uint32_t *)hda->ctl->corb_virt;
-
-	idx = 0;
-	while (idx < count) {
-		now = min(avail, count - idx);
-
-		for (i = 0; i < now; i++) {
-			wp = (wp + 1) % hda->ctl->corb_entries;
-			corb[wp] = data[idx++];
-		}
-
-		hda_set_corbwp(hda, wp);
-
-		if (idx < count) {
-			/* We filled up CORB but still data remaining */
-			wcnt = corb_wait_max;
-			while (hda_corb_avail(hda) < 1 && wcnt > 0) {
-				fibril_usleep(100);
-				--wcnt;
-			}
-
-			/* If CORB is still full return timeout error */
-			if (hda_corb_avail(hda) < 1)
-				return ETIMEOUT;
-		}
-	}
-
-	return EOK;
-}
-
-static errno_t hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)
-{
-	size_t wp;
-	hda_rirb_entry_t resp;
-	hda_rirb_entry_t *rirb;
-
-	rirb = (hda_rirb_entry_t *)hda->ctl->rirb_virt;
-
-	wp = hda_get_rirbwp(hda);
-	ddf_msg(LVL_DEBUG2, "hda_rirb_read: wp=%zu", wp);
-	if (hda->ctl->rirb_rp == wp)
-		return ENOENT;
-
-	hda->ctl->rirb_rp = (hda->ctl->rirb_rp + 1) % hda->ctl->rirb_entries;
-	resp = rirb[hda->ctl->rirb_rp];
-
-	ddf_msg(LVL_DEBUG2, "RESPONSE resp=0x%x respex=0x%x",
-	    resp.resp, resp.respex);
-	*data = resp;
-	return EOK;
-}
-
-static errno_t hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)
-{
-	hda_rirb_entry_t resp;
-
-	ddf_msg(LVL_DEBUG, "hda_solrb_read()");
-
-	fibril_mutex_lock(&hda->ctl->solrb_lock);
-
-	while (count > 0) {
-		while (count > 0 && hda->ctl->solrb_rp != hda->ctl->solrb_wp) {
-			hda->ctl->solrb_rp = (hda->ctl->solrb_rp + 1) % softrb_entries;
-			resp = hda->ctl->solrb[hda->ctl->solrb_rp];
-
-			ddf_msg(LVL_DEBUG2, "solrb RESPONSE resp=0x%x respex=0x%x",
-			    resp.resp, resp.respex);
-			if ((resp.respex & BIT_V(uint32_t, respex_unsol)) == 0) {
-				/* Solicited response */
-				*data++ = resp;
-				--count;
-			}
-		}
-
-		if (count > 0) {
-			if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
-				fibril_condvar_wait_timeout(
-				    &hda->ctl->solrb_cv, &hda->ctl->solrb_lock,
-				    solrb_wait_us);
-			}
-
-			if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
-				ddf_msg(LVL_DEBUG, "hda_solrb_read() - last ditch effort process RIRB");
-				fibril_mutex_unlock(&hda->ctl->solrb_lock);
-				hda_ctl_process_rirb(hda->ctl);
-				fibril_mutex_lock(&hda->ctl->solrb_lock);
-			}
-
-			if (hda->ctl->solrb_wp == hda->ctl->solrb_rp) {
-				ddf_msg(LVL_DEBUG, "hda_solrb_read() time out");
-				fibril_mutex_unlock(&hda->ctl->solrb_lock);
-				return ETIMEOUT;
-			}
-		}
-	}
-
-	fibril_mutex_unlock(&hda->ctl->solrb_lock);
-	return EOK;
-}
-
-hda_ctl_t *hda_ctl_init(hda_t *hda)
-{
-	hda_ctl_t *ctl;
-	uint32_t gctl;
-	uint32_t intctl;
-	int cnt;
-	errno_t rc;
-
-	ctl = calloc(1, sizeof(hda_ctl_t));
-	if (ctl == NULL)
-		return NULL;
-
-	fibril_mutex_initialize(&ctl->solrb_lock);
-	fibril_condvar_initialize(&ctl->solrb_cv);
-
-	hda->ctl = ctl;
-	ctl->hda = hda;
-
-	uint8_t vmaj = hda_reg8_read(&hda->regs->vmaj);
-	uint8_t vmin = hda_reg8_read(&hda->regs->vmin);
-	ddf_msg(LVL_NOTE, "HDA version %d.%d", vmaj, vmin);
-
-	if (vmaj != 1 || vmin != 0) {
-		ddf_msg(LVL_ERROR, "Unsupported HDA version (%d.%d).",
-		    vmaj, vmin);
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "reg 0x%zx STATESTS = 0x%x",
-	    (void *)&hda->regs->statests - (void *)hda->regs,
-	    hda_reg16_read(&hda->regs->statests));
-	/**
-	 * Clear STATESTS bits so they don't generate an interrupt later
-	 * when we enable interrupts.
-	 */
-	hda_reg16_write(&hda->regs->statests, 0x7f);
-
-	ddf_msg(LVL_DEBUG, "after clearing reg 0x%zx STATESTS = 0x%x",
-	    (void *)&hda->regs->statests - (void *)hda->regs,
-	    hda_reg16_read(&hda->regs->statests));
-
-	gctl = hda_reg32_read(&hda->regs->gctl);
-	if ((gctl & BIT_V(uint32_t, gctl_crst)) != 0) {
-		ddf_msg(LVL_DEBUG, "Controller not in reset. Resetting.");
-		hda_reg32_write(&hda->regs->gctl, gctl & ~BIT_V(uint32_t, gctl_crst));
-	}
-
-	ddf_msg(LVL_DEBUG, "Taking controller out of reset.");
-	hda_reg32_write(&hda->regs->gctl, gctl | BIT_V(uint32_t, gctl_crst));
-
-	/* Wait for CRST to read as 1 */
-	cnt = ctrl_init_wait_max;
-	while (cnt > 0) {
-		gctl = hda_reg32_read(&hda->regs->gctl);
-		if ((gctl & BIT_V(uint32_t, gctl_crst)) != 0) {
-			ddf_msg(LVL_DEBUG, "gctl=0x%x", gctl);
-			break;
-		}
-
-		ddf_msg(LVL_DEBUG, "Waiting for controller to initialize.");
-		fibril_usleep(100 * 1000);
-		--cnt;
-	}
-
-	if (cnt == 0) {
-		ddf_msg(LVL_ERROR, "Timed out waiting for controller to come up.");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Controller is out of reset.");
-
-	ddf_msg(LVL_DEBUG, "Read GCAP");
-	uint16_t gcap = hda_reg16_read(&hda->regs->gcap);
-	ctl->ok64bit = (gcap & BIT_V(uint16_t, gcap_64ok)) != 0;
-	ctl->oss = BIT_RANGE_EXTRACT(uint16_t, gcap_oss_h, gcap_oss_l, gcap);
-	ctl->iss = BIT_RANGE_EXTRACT(uint16_t, gcap_iss_h, gcap_iss_l, gcap);
-	ctl->bss = BIT_RANGE_EXTRACT(uint16_t, gcap_bss_h, gcap_bss_l, gcap);
-	ddf_msg(LVL_DEBUG, "GCAP: 0x%x (64OK=%d)", gcap, ctl->ok64bit);
-	ddf_msg(LVL_DEBUG, "iss: %d, oss: %d, bss: %d\n",
-	    ctl->iss, ctl->oss, ctl->bss);
-	/* Give codecs enough time to enumerate themselves */
-	fibril_usleep(codec_enum_wait_us);
-
-	ddf_msg(LVL_DEBUG, "STATESTS = 0x%x",
-	    hda_reg16_read(&hda->regs->statests));
-
-	/* Enable interrupts */
-	intctl = hda_reg32_read(&hda->regs->intctl);
-	ddf_msg(LVL_DEBUG, "intctl (0x%x) := 0x%x",
-	    (unsigned)((void *)&hda->regs->intctl - (void *)hda->regs),
-	    intctl | BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie));
-	hda_reg32_write(&hda->regs->intctl, intctl |
-	    BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie) |
-	    0x3fffffff);
-
-	rc = hda_corb_init(hda);
-	if (rc != EOK)
-		goto error;
-
-	rc = hda_rirb_init(hda);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "call hda_codec_init()");
-	hda->ctl->codec = hda_codec_init(hda, 0);
-	if (hda->ctl->codec == NULL) {
-		ddf_msg(LVL_DEBUG, "hda_codec_init() failed");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "intsts=0x%x", hda_reg32_read(&hda->regs->intsts));
-	ddf_msg(LVL_DEBUG, "sdesc[%d].sts=0x%x",
-	    hda->ctl->iss, hda_reg8_read(&hda->regs->sdesc[hda->ctl->iss].sts));
-
-	return ctl;
-error:
-	hda_rirb_fini(hda);
-	hda_corb_fini(hda);
-	free(ctl);
-	hda->ctl = NULL;
-	return NULL;
-}
-
-void hda_ctl_fini(hda_ctl_t *ctl)
-{
-	ddf_msg(LVL_DEBUG, "hda_ctl_fini()");
-	hda_rirb_fini(ctl->hda);
-	hda_corb_fini(ctl->hda);
-	free(ctl);
-}
-
-void hda_ctl_quiesce(hda_ctl_t *ctl)
-{
-	uint32_t gctl;
-
-	ddf_msg(LVL_DEBUG, "hda_ctl_quiesce(): Resetting controller.");
-	gctl = hda_reg32_read(&ctl->hda->regs->gctl);
-	hda_reg32_write(&ctl->hda->regs->gctl,
-	    gctl & ~BIT_V(uint32_t, gctl_crst));
-}
-
-errno_t hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)
-{
-	errno_t rc;
-	hda_rirb_entry_t rentry;
-
-	rc = hda_corb_write(hda, &verb, 1);
-	if (rc != EOK)
-		return rc;
-
-	if (resp != NULL) {
-		rc = hda_solrb_read(hda, &rentry, 1);
-		if (rc != EOK)
-			return rc;
-
-		/* XXX Verify that response came from the correct codec */
-		*resp = rentry.resp;
-	}
-
-	return EOK;
-}
-
-static void hda_ctl_process_rirb(hda_ctl_t *ctl)
-{
-	hda_rirb_entry_t resp;
-	errno_t rc;
-
-	while (true) {
-		rc = hda_rirb_read(ctl->hda, &resp);
-		if (rc != EOK) {
-			ddf_msg(LVL_DEBUG2, "nothing in rirb");
-			break;
-		}
-
-		ddf_msg(LVL_DEBUG2, "writing to solrb");
-		fibril_mutex_lock(&ctl->solrb_lock);
-		ctl->solrb_wp = (ctl->solrb_wp + 1) % softrb_entries;
-		ctl->solrb[ctl->solrb_wp] = resp;
-		fibril_mutex_unlock(&ctl->solrb_lock);
-		fibril_condvar_broadcast(&ctl->solrb_cv);
-	}
-}
-
-static void hda_ctl_check_fifo_error(hda_ctl_t *ctl)
-{
-	int i;
-	uint8_t sts;
-
-	/*
-	 * XXX Ideally the interrupt handler would tell us which stream
-	 * has the error.
-	 */
-
-	for (i = 0; i < 30; i++) {
-		sts = hda_reg8_read(&ctl->hda->regs->sdesc[i].sts);
-		if ((sts & BIT_V(uint8_t, sdsts_fifoe)) != 0 && (sts & 0x80) == 0) {
-			ddf_msg(LVL_WARN, "sts[%d] = 0x%hhx\n", i, sts);
-			hda_reg8_write(&ctl->hda->regs->sdesc[i].sts,
-			    BIT_V(uint8_t, sdsts_fifoe));
-		}
-	}
-}
-
-void hda_ctl_interrupt(hda_ctl_t *ctl)
-{
-	ddf_msg(LVL_DEBUG, "hda_ctl_interrupt");
-	hda_ctl_check_fifo_error(ctl);
-	hda_ctl_process_rirb(ctl);
-}
-
-void hda_ctl_dump_info(hda_ctl_t *ctl)
-{
-	ddf_msg(LVL_DEBUG, "corbwp=%d, corbrp=%d",
-	    hda_reg16_read(&ctl->hda->regs->corbwp),
-	    hda_reg16_read(&ctl->hda->regs->corbrp));
-	ddf_msg(LVL_DEBUG, "corbctl=0x%x, corbsts=0x%x",
-	    hda_reg8_read(&ctl->hda->regs->corbctl),
-	    hda_reg8_read(&ctl->hda->regs->corbsts));
-	ddf_msg(LVL_DEBUG, "rirbwp=0x%x, soft-rirbrp=0x%zx",
-	    hda_reg16_read(&ctl->hda->regs->rirbwp),
-	    ctl->rirb_rp);
-	ddf_msg(LVL_DEBUG, "solrb_wp=0x%zx, solrb_rp=0x%zx",
-	    ctl->solrb_wp, ctl->solrb_wp);
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/hdactl.h
===================================================================
--- uspace/drv/audio/hdaudio/hdactl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio controller
- */
-
-#ifndef HDACTL_H
-#define HDACTL_H
-
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include "hdaudio.h"
-#include "spec/regs.h"
-
-enum {
-	/** Software response buffer size in entries */
-	softrb_entries = 128
-};
-
-typedef struct hda_ctl {
-	bool ok64bit;
-	int iss;
-	int oss;
-	int bss;
-
-	uintptr_t corb_phys;
-	void *corb_virt;
-	size_t corb_entries;
-
-	uintptr_t rirb_phys;
-	void *rirb_virt;
-	size_t rirb_entries;
-	size_t rirb_rp;
-
-	fibril_mutex_t solrb_lock;
-	fibril_condvar_t solrb_cv;
-	hda_rirb_entry_t solrb[softrb_entries];
-	size_t solrb_rp;
-	size_t solrb_wp;
-
-	hda_rirb_entry_t unsolrb[softrb_entries];
-	size_t unsolrb_rp;
-	size_t unsolrb_wp;
-
-	struct hda_codec *codec;
-	struct hda *hda;
-} hda_ctl_t;
-
-extern hda_ctl_t *hda_ctl_init(hda_t *);
-extern void hda_ctl_fini(hda_ctl_t *);
-extern void hda_ctl_quiesce(hda_ctl_t *);
-extern void hda_ctl_interrupt(hda_ctl_t *);
-extern errno_t hda_cmd(hda_t *, uint32_t, uint32_t *);
-extern void hda_ctl_dump_info(hda_ctl_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/hdaudio.c
===================================================================
--- uspace/drv/audio/hdaudio/hdaudio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,441 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio driver
- */
-
-#include <assert.h>
-#include <bitops.h>
-#include <ddi.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-
-#include "hdactl.h"
-#include "hdaudio.h"
-#include "pcm_iface.h"
-#include "spec/regs.h"
-
-#define NAME "hdaudio"
-
-static errno_t hda_dev_add(ddf_dev_t *dev);
-static errno_t hda_dev_remove(ddf_dev_t *dev);
-static errno_t hda_dev_gone(ddf_dev_t *dev);
-static errno_t hda_dev_quiesce(ddf_dev_t *dev);
-static errno_t hda_fun_online(ddf_fun_t *fun);
-static errno_t hda_fun_offline(ddf_fun_t *fun);
-
-static void hdaudio_interrupt(ipc_call_t *, void *);
-
-static driver_ops_t driver_ops = {
-	.dev_add = hda_dev_add,
-	.dev_remove = hda_dev_remove,
-	.dev_gone = hda_dev_gone,
-	.dev_quiesce = hda_dev_quiesce,
-	.fun_online = hda_fun_online,
-	.fun_offline = hda_fun_offline
-};
-
-static driver_t hda_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-ddf_dev_ops_t hda_pcm_ops = {
-	.interfaces[AUDIO_PCM_BUFFER_IFACE] = &hda_pcm_iface
-};
-
-irq_pio_range_t hdaudio_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = 8192
-	}
-};
-
-irq_cmd_t hdaudio_irq_commands[] = {
-	/* 0 */
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL, /* rirbsts */
-		.dstarg = 2
-	},
-	/* 1 */
-	{
-		.cmd = CMD_AND,
-		.value = BIT_V(uint8_t, rirbsts_intfl),
-		.srcarg = 2,
-		.dstarg = 3
-	},
-	/* 2 */
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 2,
-		.srcarg = 3
-	},
-	/* 3 */
-	{
-		.cmd = CMD_PIO_WRITE_8,
-		.addr = NULL, /* rirbsts */
-		.value = BIT_V(uint8_t, rirbsts_intfl)
-	},
-	/* 4 */
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-irq_cmd_t hdaudio_irq_commands_sdesc[] = {
-	/* 0 */
-	{
-		.cmd = CMD_PIO_READ_32,
-		.addr = NULL, /* intsts */
-		.dstarg = 2
-	},
-	/* 1 */
-	{
-		.cmd = CMD_AND,
-		.value = 0, /* 1 << idx */
-		.srcarg = 2,
-		.dstarg = 3,
-	},
-	/* 2 */
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 2,
-		.srcarg = 3
-	},
-	/* 3 */
-	{
-		.cmd = CMD_PIO_WRITE_8,
-		.addr = NULL, /* sdesc[x].sts */
-		.value = BIT_V(uint8_t, sdsts_bcis)
-	},
-	/* 4 */
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static errno_t hda_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun_pcm = NULL;
-	bool bound = false;
-	hda_t *hda = NULL;
-	hw_res_list_parsed_t res;
-	irq_code_t irq_code;
-	irq_cmd_t *cmds = NULL;
-	size_t ncmds_base;
-	size_t ncmds_sdesc;
-	size_t ncmds;
-	int i;
-	void *regs = NULL;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_dev_add()");
-	hw_res_list_parsed_init(&res);
-
-	hda = ddf_dev_data_alloc(dev, sizeof(hda_t));
-	if (hda == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_mutex_initialize(&hda->lock);
-
-	ddf_msg(LVL_DEBUG, "create parent sess");
-	hda->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (hda->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed connecting parent driver.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "get HW res list");
-	rc = hw_res_get_list_parsed(hda->parent_sess, &res, 0);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting resource list.\n");
-		goto error;
-	}
-
-	if (res.mem_ranges.count != 1) {
-		ddf_msg(LVL_ERROR, "Expected exactly one memory range.\n");
-		rc = EINVAL;
-		goto error;
-	}
-
-	hda->rwbase = RNGABS(res.mem_ranges.ranges[0]);
-	hda->rwsize = RNGSZ(res.mem_ranges.ranges[0]);
-
-	ddf_msg(LVL_DEBUG, "hda reg base: %" PRIx64,
-	    RNGABS(res.mem_ranges.ranges[0]));
-
-	if (hda->rwsize < sizeof(hda_regs_t)) {
-		ddf_msg(LVL_ERROR, "Memory range is too small.");
-		rc = EINVAL;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "enable PIO");
-	rc = pio_enable((void *)(uintptr_t)hda->rwbase, hda->rwsize, &regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling PIO range.");
-		goto error;
-	}
-
-	hda->regs = (hda_regs_t *)regs;
-
-	ddf_msg(LVL_DEBUG, "IRQs: %zu", res.irqs.count);
-	if (res.irqs.count != 1) {
-		ddf_msg(LVL_ERROR, "Unexpected IRQ count %zu (!= 1)",
-		    res.irqs.count);
-		goto error;
-	}
-	ddf_msg(LVL_DEBUG, "interrupt no: %d", res.irqs.irqs[0]);
-
-	ncmds_base = sizeof(hdaudio_irq_commands) / sizeof(irq_cmd_t);
-	ncmds_sdesc = sizeof(hdaudio_irq_commands_sdesc) / sizeof(irq_cmd_t);
-	ncmds = ncmds_base + 30 * ncmds_sdesc;
-
-	cmds = calloc(ncmds, sizeof(irq_cmd_t));
-	if (cmds == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory");
-		goto error;
-	}
-
-	irq_code.rangecount = sizeof(hdaudio_irq_pio_ranges) /
-	    sizeof(irq_pio_range_t);
-	irq_code.ranges = hdaudio_irq_pio_ranges;
-	irq_code.cmdcount = ncmds;
-	irq_code.cmds = cmds;
-
-	hda_regs_t *rphys = (hda_regs_t *)(uintptr_t)hda->rwbase;
-	hdaudio_irq_pio_ranges[0].base = (uintptr_t)hda->rwbase;
-
-	memcpy(cmds, hdaudio_irq_commands, sizeof(hdaudio_irq_commands));
-	cmds[0].addr = (void *)&rphys->rirbsts;
-	cmds[3].addr = (void *)&rphys->rirbsts;
-
-	for (i = 0; i < 30; i++) {
-		memcpy(&cmds[ncmds_base + i * ncmds_sdesc],
-		    hdaudio_irq_commands_sdesc, sizeof(hdaudio_irq_commands_sdesc));
-		cmds[ncmds_base + i * ncmds_sdesc + 0].addr = (void *)&rphys->intsts;
-		cmds[ncmds_base + i * ncmds_sdesc + 1].value = BIT_V(uint32_t, i);
-		cmds[ncmds_base + i * ncmds_sdesc + 3].addr = (void *)&rphys->sdesc[i].sts;
-	}
-
-	ddf_msg(LVL_DEBUG, "range0.base=%zu", hdaudio_irq_pio_ranges[0].base);
-
-	rc = hw_res_enable_interrupt(hda->parent_sess, res.irqs.irqs[0]);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed enabling interrupt.: %s", str_error(rc));
-		goto error;
-	}
-
-	cap_irq_handle_t irq_cap;
-	rc = register_interrupt_handler(dev, res.irqs.irqs[0],
-	    hdaudio_interrupt, (void *)hda, &irq_code, &irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed registering interrupt handler: %s",
-		    str_error_name(rc));
-		goto error;
-	}
-
-	free(cmds);
-	cmds = NULL;
-
-	if (hda_ctl_init(hda) == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "create function");
-	fun_pcm = ddf_fun_create(dev, fun_exposed, "pcm");
-	if (fun_pcm == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'pcm'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	hda->fun_pcm = fun_pcm;
-
-	ddf_fun_set_ops(fun_pcm, &hda_pcm_ops);
-
-	rc = ddf_fun_bind(fun_pcm);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'pcm'.");
-		ddf_fun_destroy(fun_pcm);
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun_pcm, "audio-pcm");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function to audio-pcm category.");
-		goto error;
-	}
-
-	hw_res_list_parsed_clean(&res);
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun_pcm);
-	if (fun_pcm != NULL)
-		ddf_fun_destroy(fun_pcm);
-	if (hda != NULL) {
-		if (hda->ctl != NULL)
-			hda_ctl_fini(hda->ctl);
-	}
-	free(cmds);
-	// pio_disable(regs);
-	hw_res_list_parsed_clean(&res);
-
-	ddf_msg(LVL_DEBUG, "Failing hda_dev_add() -> %s", str_error_name(rc));
-	return rc;
-}
-
-static errno_t hda_dev_remove(ddf_dev_t *dev)
-{
-	hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
-
-	if (hda->fun_pcm != NULL) {
-		rc = ddf_fun_offline(hda->fun_pcm);
-		if (rc != EOK)
-			return rc;
-
-		rc = ddf_fun_unbind(hda->fun_pcm);
-		if (rc != EOK)
-			return rc;
-	}
-
-	hda_ctl_fini(hda->ctl);
-	// pio_disable(regs);
-	return EOK;
-}
-
-static errno_t hda_dev_gone(ddf_dev_t *dev)
-{
-	hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev);
-
-	if (hda->fun_pcm != NULL) {
-		rc = ddf_fun_unbind(hda->fun_pcm);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hda_dev_quiesce(ddf_dev_t *dev)
-{
-	hda_t *hda = (hda_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "hda_dev_quiesce(%p)", dev);
-
-	hda_ctl_quiesce(hda->ctl);
-	return EOK;
-}
-
-static errno_t hda_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "hda_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t hda_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "hda_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-/** HD Audio interrupt handler.
- *
- * @param icall IRQ event notification
- * @param arg Argument (hda_t *)
- */
-static void hdaudio_interrupt(ipc_call_t *icall, void *arg)
-{
-	hda_t *hda = (hda_t *)arg;
-
-	if (0)
-		ddf_msg(LVL_NOTE, "## interrupt ##");
-	hda_ctl_interrupt(hda->ctl);
-
-	if (ipc_get_arg3(icall) != 0) {
-		/* Buffer completed */
-		hda_lock(hda);
-		if (hda->playing) {
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED);
-		} else if (hda->capturing) {
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_CAPTURED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_CAPTURED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_CAPTURED);
-			hda_pcm_event(hda, PCM_EVENT_FRAMES_CAPTURED);
-		}
-
-		hda_unlock(hda);
-	}
-}
-
-void hda_lock(hda_t *hda)
-{
-	fibril_mutex_lock(&hda->lock);
-}
-
-void hda_unlock(hda_t *hda)
-{
-	fibril_mutex_unlock(&hda->lock);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": High Definition Audio driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&hda_driver);
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/hdaudio.h
===================================================================
--- uspace/drv/audio/hdaudio/hdaudio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio driver
- */
-
-#ifndef HDAUDIO_H
-#define HDAUDIO_H
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "spec/regs.h"
-
-/** High Definition Audio driver instance */
-typedef struct hda {
-	fibril_mutex_t lock;
-	async_sess_t *parent_sess;
-	async_sess_t *ev_sess;
-	ddf_fun_t *fun_pcm;
-	uint64_t rwbase;
-	size_t rwsize;
-	hda_regs_t *regs;
-	struct hda_ctl *ctl;
-	struct hda_stream *pcm_stream;
-	struct hda_stream_buffers *pcm_buffers;
-	bool playing;
-	bool capturing;
-} hda_t;
-
-extern void hda_lock(hda_t *);
-extern void hda_unlock(hda_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/hdaudio.ma
===================================================================
--- uspace/drv/audio/hdaudio/hdaudio.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-10 pci/ven=1002&dev=4383
-10 pci/ven=8086&dev=160c
-10 pci/ven=8086&dev=1e20
-10 pci/ven=8086&dev=2668
-10 pci/ven=8086&dev=284b
-10 pci/ven=8086&dev=1c20
-10 pci/ven=8086&dev=293e
-10 pci/ven=8086&dev=9ca0
Index: pace/drv/audio/hdaudio/meson.build
===================================================================
--- uspace/drv/audio/hdaudio/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'pcm' ]
-src = files(
-	'codec.c',
-	'regif.c',
-	'hdactl.c',
-	'hdaudio.c',
-	'pcm_iface.c',
-	'stream.c',
-)
Index: pace/drv/audio/hdaudio/pcm_iface.c
===================================================================
--- uspace/drv/audio/hdaudio/pcm_iface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,369 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio PCM interface
- */
-
-#include <async.h>
-#include <audio_pcm_iface.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <pcm/sample_format.h>
-#include <stdbool.h>
-
-#include "codec.h"
-#include "hdactl.h"
-#include "hdaudio.h"
-#include "pcm_iface.h"
-#include "spec/fmt.h"
-#include "stream.h"
-
-static errno_t hda_get_info_str(ddf_fun_t *, const char **);
-static unsigned hda_query_cap(ddf_fun_t *, audio_cap_t);
-static errno_t hda_test_format(ddf_fun_t *, unsigned *, unsigned *,
-    pcm_sample_format_t *);
-static errno_t hda_get_buffer(ddf_fun_t *, void **, size_t *);
-static errno_t hda_get_buffer_position(ddf_fun_t *, size_t *);
-static errno_t hda_set_event_session(ddf_fun_t *, async_sess_t *);
-static async_sess_t *hda_get_event_session(ddf_fun_t *);
-static errno_t hda_release_buffer(ddf_fun_t *);
-static errno_t hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,
-    pcm_sample_format_t);
-static errno_t hda_stop_playback(ddf_fun_t *, bool);
-static errno_t hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,
-    pcm_sample_format_t);
-static errno_t hda_stop_capture(ddf_fun_t *, bool);
-
-audio_pcm_iface_t hda_pcm_iface = {
-	.get_info_str = hda_get_info_str,
-	.test_format = hda_test_format,
-	.query_cap = hda_query_cap,
-
-	.get_buffer = hda_get_buffer,
-	.release_buffer = hda_release_buffer,
-	.set_event_session = hda_set_event_session,
-	.get_event_session = hda_get_event_session,
-	.get_buffer_pos = hda_get_buffer_position,
-
-	.start_playback = hda_start_playback,
-	.stop_playback = hda_stop_playback,
-
-	.start_capture = hda_start_capture,
-	.stop_capture = hda_stop_capture
-};
-
-enum {
-	max_buffer_size = 65536 /* XXX this is completely arbitrary */
-};
-
-static hda_t *fun_to_hda(ddf_fun_t *fun)
-{
-	return (hda_t *)ddf_dev_data_get(ddf_fun_get_dev(fun));
-}
-
-static errno_t hda_get_info_str(ddf_fun_t *fun, const char **name)
-{
-	ddf_msg(LVL_DEBUG, "hda_get_info_str()");
-	if (name)
-		*name = "High Definition Audio";
-	return EOK;
-}
-
-static unsigned hda_query_cap(ddf_fun_t *fun, audio_cap_t cap)
-{
-	hda_t *hda = fun_to_hda(fun);
-
-	ddf_msg(LVL_DEBUG, "hda_query_cap(%d)", cap);
-	switch (cap) {
-	case AUDIO_CAP_PLAYBACK:
-	case AUDIO_CAP_INTERRUPT:
-		/* XXX Only if we have an output converter */
-		return 1;
-	case AUDIO_CAP_CAPTURE:
-		/* Yes if we have an input converter */
-		return hda->ctl->codec->in_aw >= 0;
-	case AUDIO_CAP_BUFFER_POS:
-		return 0;
-	case AUDIO_CAP_MAX_BUFFER:
-		return max_buffer_size;
-	case AUDIO_CAP_INTERRUPT_MIN_FRAMES:
-		return 128;
-	case AUDIO_CAP_INTERRUPT_MAX_FRAMES:
-		return 16384;
-	default:
-		return -1;
-	}
-}
-
-static errno_t hda_test_format(ddf_fun_t *fun, unsigned *channels,
-    unsigned *rate, pcm_sample_format_t *format)
-{
-	errno_t rc = EOK;
-
-	ddf_msg(LVL_DEBUG, "hda_test_format(%u, %u, %d)\n",
-	    *channels, *rate, *format);
-
-	if (*channels != 2) {
-		*channels = 2;
-		rc = ELIMIT;
-	}
-
-	if (*format != PCM_SAMPLE_SINT16_LE) {
-		*format = PCM_SAMPLE_SINT16_LE;
-		rc = ELIMIT;
-	}
-
-	if (*rate != 44100) {
-		*rate = 44100;
-		rc = ELIMIT;
-	}
-
-	return rc;
-}
-
-static errno_t hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
-{
-	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
-
-	hda_lock(hda);
-
-	ddf_msg(LVL_DEBUG, "hda_get_buffer(): hda=%p", hda);
-	if (hda->pcm_buffers != NULL) {
-		hda_unlock(hda);
-		return EBUSY;
-	}
-
-	ddf_msg(LVL_DEBUG, "hda_get_buffer() - allocate stream buffers");
-	rc = hda_stream_buffers_alloc(hda, &hda->pcm_buffers);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		hda_unlock(hda);
-		return ENOMEM;
-	}
-
-	ddf_msg(LVL_DEBUG, "hda_get_buffer() - fill info");
-	/* XXX This is only one buffer */
-	*buffer = hda->pcm_buffers->buf[0];
-	*size = hda->pcm_buffers->bufsize * hda->pcm_buffers->nbuffers;
-
-	ddf_msg(LVL_DEBUG, "hda_get_buffer() returing EOK, buffer=%p, size=%zu",
-	    *buffer, *size);
-
-	hda_unlock(hda);
-	return EOK;
-}
-
-static errno_t hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)
-{
-	ddf_msg(LVL_DEBUG, "hda_get_buffer_position()");
-	return ENOTSUP;
-}
-
-static errno_t hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
-{
-	hda_t *hda = fun_to_hda(fun);
-
-	ddf_msg(LVL_DEBUG, "hda_set_event_session()");
-	hda_lock(hda);
-	hda->ev_sess = sess;
-	hda_unlock(hda);
-
-	return EOK;
-}
-
-static async_sess_t *hda_get_event_session(ddf_fun_t *fun)
-{
-	hda_t *hda = fun_to_hda(fun);
-	async_sess_t *sess;
-
-	ddf_msg(LVL_DEBUG, "hda_get_event_session()");
-
-	hda_lock(hda);
-	sess = hda->ev_sess;
-	hda_unlock(hda);
-
-	return sess;
-}
-
-static errno_t hda_release_buffer(ddf_fun_t *fun)
-{
-	hda_t *hda = fun_to_hda(fun);
-
-	hda_lock(hda);
-
-	ddf_msg(LVL_DEBUG, "hda_release_buffer()");
-	if (hda->pcm_buffers == NULL) {
-		hda_unlock(hda);
-		return EINVAL;
-	}
-
-	hda_stream_buffers_free(hda->pcm_buffers);
-	hda->pcm_buffers = NULL;
-
-	hda_unlock(hda);
-	return EOK;
-}
-
-static errno_t hda_start_playback(ddf_fun_t *fun, unsigned frames,
-    unsigned channels, unsigned rate, pcm_sample_format_t format)
-{
-	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_start_playback()");
-	hda_lock(hda);
-
-	if (hda->pcm_stream != NULL) {
-		hda_unlock(hda);
-		return EBUSY;
-	}
-
-	/* XXX Choose appropriate parameters */
-	uint32_t fmt;
-	/* 48 kHz, 16-bits, 1 channel */
-	fmt = (fmt_base_44khz << fmt_base) | (fmt_bits_16 << fmt_bits_l) | 1;
-
-	ddf_msg(LVL_NOTE, "hda_start_playback() - create output stream");
-	hda->pcm_stream = hda_stream_create(hda, sdir_output, hda->pcm_buffers,
-	    fmt);
-	if (hda->pcm_stream == NULL) {
-		hda_unlock(hda);
-		return EIO;
-	}
-
-	rc = hda_out_converter_setup(hda->ctl->codec, hda->pcm_stream);
-	if (rc != EOK) {
-		hda_stream_destroy(hda->pcm_stream);
-		hda->pcm_stream = NULL;
-		hda_unlock(hda);
-		return rc;
-	}
-
-	hda->playing = true;
-	hda_stream_start(hda->pcm_stream);
-	hda_unlock(hda);
-	return EOK;
-}
-
-static errno_t hda_stop_playback(ddf_fun_t *fun, bool immediate)
-{
-	hda_t *hda = fun_to_hda(fun);
-
-	ddf_msg(LVL_DEBUG, "hda_stop_playback()");
-	hda_lock(hda);
-	hda_stream_stop(hda->pcm_stream);
-	hda_stream_reset(hda->pcm_stream);
-	hda->playing = false;
-	hda_stream_destroy(hda->pcm_stream);
-	hda->pcm_stream = NULL;
-
-	hda_unlock(hda);
-
-	hda_pcm_event(hda, PCM_EVENT_PLAYBACK_TERMINATED);
-	return EOK;
-}
-
-static errno_t hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,
-    unsigned rate, pcm_sample_format_t format)
-{
-	hda_t *hda = fun_to_hda(fun);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "hda_start_capture()");
-	hda_lock(hda);
-
-	if (hda->pcm_stream != NULL) {
-		hda_unlock(hda);
-		return EBUSY;
-	}
-
-	/* XXX Choose appropriate parameters */
-	uint32_t fmt;
-	/* 48 kHz, 16-bits, 1 channel */
-	fmt = (fmt_base_44khz << fmt_base) | (fmt_bits_16 << fmt_bits_l) | 1;
-
-	ddf_msg(LVL_DEBUG, "hda_start_capture() - create input stream");
-	hda->pcm_stream = hda_stream_create(hda, sdir_input, hda->pcm_buffers,
-	    fmt);
-	if (hda->pcm_stream == NULL) {
-		hda_unlock(hda);
-		return EIO;
-	}
-
-	rc = hda_in_converter_setup(hda->ctl->codec, hda->pcm_stream);
-	if (rc != EOK) {
-		hda_stream_destroy(hda->pcm_stream);
-		hda->pcm_stream = NULL;
-		hda_unlock(hda);
-		return rc;
-	}
-
-	hda->capturing = true;
-	hda_stream_start(hda->pcm_stream);
-	hda_unlock(hda);
-	return EOK;
-}
-
-static errno_t hda_stop_capture(ddf_fun_t *fun, bool immediate)
-{
-	hda_t *hda = fun_to_hda(fun);
-
-	ddf_msg(LVL_DEBUG, "hda_stop_capture()");
-	hda_lock(hda);
-	hda_stream_stop(hda->pcm_stream);
-	hda_stream_reset(hda->pcm_stream);
-	hda->capturing = false;
-	hda_stream_destroy(hda->pcm_stream);
-	hda->pcm_stream = NULL;
-	hda_unlock(hda);
-
-	hda_pcm_event(hda, PCM_EVENT_CAPTURE_TERMINATED);
-	return EOK;
-}
-
-void hda_pcm_event(hda_t *hda, pcm_event_t event)
-{
-	async_exch_t *exchange;
-
-	if (hda->ev_sess == NULL) {
-		if (0)
-			ddf_log_warning("No one listening for event %u", event);
-		return;
-	}
-
-	exchange = async_exchange_begin(hda->ev_sess);
-	async_msg_1(exchange, event, 0);
-	async_exchange_end(exchange);
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/pcm_iface.h
===================================================================
--- uspace/drv/audio/hdaudio/pcm_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio PCM interface
- */
-
-#ifndef PCM_IFACE_H
-#define PCM_IFACE_H
-
-#include <audio_pcm_iface.h>
-
-#include "hdaudio.h"
-
-extern audio_pcm_iface_t hda_pcm_iface;
-extern void hda_pcm_event(hda_t *, pcm_event_t);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/regif.c
===================================================================
--- uspace/drv/audio/hdaudio/regif.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio register interface
- */
-
-#include <byteorder.h>
-#include <ddi.h>
-#include <stdint.h>
-
-#include "regif.h"
-
-uint8_t hda_reg8_read(uint8_t *r)
-{
-	return pio_read_8(r);
-}
-
-uint16_t hda_reg16_read(uint16_t *r)
-{
-	return uint16_t_le2host(pio_read_16(r));
-}
-
-uint32_t hda_reg32_read(uint32_t *r)
-{
-	return uint32_t_le2host(pio_read_32(r));
-}
-
-void hda_reg8_write(uint8_t *r, uint8_t val)
-{
-	pio_write_8(r, val);
-}
-
-void hda_reg16_write(uint16_t *r, uint16_t val)
-{
-	pio_write_16(r, host2uint16_t_le(val));
-}
-
-void hda_reg32_write(uint32_t *r, uint32_t val)
-{
-	pio_write_32(r, host2uint32_t_le(val));
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/regif.h
===================================================================
--- uspace/drv/audio/hdaudio/regif.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio register interface
- */
-
-#ifndef REGIF_H
-#define REGIF_H
-
-#include <stdint.h>
-
-extern uint8_t hda_reg8_read(uint8_t *);
-extern uint16_t hda_reg16_read(uint16_t *);
-extern uint32_t hda_reg32_read(uint32_t *);
-extern void hda_reg8_write(uint8_t *, uint8_t);
-extern void hda_reg16_write(uint16_t *, uint16_t);
-extern void hda_reg32_write(uint32_t *, uint32_t);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/spec/bdl.h
===================================================================
--- uspace/drv/audio/hdaudio/spec/bdl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio buffer descriptor list
- */
-
-#ifndef SPEC_BDL_H
-#define SPEC_BDL_H
-
-/** Buffer descriptor */
-typedef struct {
-	uint64_t address;
-	uint32_t length;
-	uint32_t flags;
-} hda_buffer_desc_t;
-
-/** Buffer descriptor flags bits */
-typedef enum {
-	bdf_ioc = 0
-} hda_bd_flags_bits_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/spec/codec.h
===================================================================
--- uspace/drv/audio/hdaudio/spec/codec.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio codec interface
- */
-
-#ifndef SPEC_CODEC_H
-#define SPEC_CODEC_H
-
-typedef enum {
-	/** Get Parameter */
-	hda_param_get = 0xf00,
-	/** Connection Select Control / Get */
-	hda_conn_sel_get = 0xf01,
-	/** Connection Select Control / Set */
-	hda_conn_sel_set = 0x701,
-	/** Get Connection List Entry */
-	hda_clist_entry_get = 0xf02,
-	/** Processing State / Get */
-	hda_proc_state_get = 0xf03,
-	/** Processing State / Set */
-	hda_proc_state_set = 0x703,
-	/** Coefficient Index / Get */
-	hda_coef_index_get = 0xd,
-	/** Coefficient Index / Set */
-	hda_coef_index_set = 0x5,
-	/** Processing Coefficient / Get */
-	hda_proc_coef_get = 0xc,
-	/** Processing Coefficient / Set */
-	hda_proc_coef_set = 0x4,
-	/** Amplifier Gain/Mute / Get */
-	hda_amp_gain_mute_get = 0xb,
-	/** Amplifier Gain/Mute / Set */
-	hda_amp_gain_mute_set = 0x3,
-	/** Converter Format / Get */
-	hda_converter_fmt_get = 0xa,
-	/** Converter Format / Set */
-	hda_converter_fmt_set = 0x2,
-	/** S/PDIF Converter Control / Get */
-	hda_spdif_ctl_get = 0xf0d,
-	/** S/PDIF Converter Control / Set 1 */
-	hda_spdif_ctl_set1 = 0x70d,
-	/** S/PDIF Converter Control / Set 2 */
-	hda_spdif_ctl_set2 = 0x70e,
-	/** S/PDIF Converter Control / Set 3 */
-	hda_spdif_ctl_set3 = 0x73e,
-	/** S/PDIF Converter Control / Set 4 */
-	hda_spdif_ctl_set4 = 0x73f,
-	/** Power State / Get */
-	hda_power_state_get = 0xf05,
-	/** Power State / Set */
-	hda_power_state_set = 0x705,
-	/** Converter Control / Get */
-	hda_converter_ctl_get = 0xf06,
-	/** Converter Control / Set */
-	hda_converter_ctl_set = 0x706,
-	/** SDI Select / Get */
-	hda_sdi_select_get = 0xf04,
-	/** SDI Select / Set */
-	hda_sdi_select_set = 0x704,
-	/** Pin Control / Get */
-	hda_pin_ctl_get = 0xf07,
-	/** Pin Control / Set */
-	hda_pin_ctl_set = 0x707,
-	/** Unsolicited Response Control / Get */
-	hda_unsol_resp_get = 0xf08,
-	/** Unsolicied Response Control / Set */
-	hda_unsol_resp_set = 0x708,
-	/** Pin Sense / Get */
-	hda_pin_sense_get = 0xf09,
-	/** Pin Sense / Execute */
-	hda_pin_sense_exec = 0x709,
-	/** EAPD/BTL Enable / Get */
-	hda_eapd_btl_enable_get = 0xf0c,
-	/** EAPD/BTL Enable / Set */
-	hda_eapd_btl_enable_set = 0x70c,
-	/** GPI Data / Get */
-	hda_gpi_data_get = 0xf10,
-	/** GPI Data / Set */
-	hda_gpi_data_set = 0x710,
-	/** GPI Wake Enable / Get */
-	hda_gpi_wakeen_get = 0xf11,
-	/** GPI Wake Enable / Set */
-	hda_gpi_wakeen_set = 0x711,
-	/** GPI Unsolicited Enable / Get */
-	hda_gpi_unsol_get = 0xf12,
-	/** GPI Unsolicited Enable / Set */
-	hda_gpi_unsol_set = 0x712,
-	/** GPI Sticky / Get */
-	hda_gpi_sticky_get = 0xf13,
-	/** GPI Sticky / Set */
-	hda_gpi_sticky_set = 0x713,
-	/** GPO Data / Get */
-	hda_gpo_data_get = 0xf14,
-	/** GPO Data / Set */
-	hda_gpo_data_set = 0x714,
-	/** GPIO Data / Get */
-	hda_gpio_data_get = 0xf15,
-	/** GPIO Data / Set */
-	hda_gpio_data_set = 0x715,
-	/** GPIO Enable / Get */
-	hda_gpio_enable_get = 0xf16,
-	/** GPIO Enable / Set */
-	hda_gpio_enable_set = 0x716,
-	/** GPIO Direction / Get */
-	hda_gpio_dir_get = 0xf17,
-	/** GPIO Direction / Set */
-	hda_gpio_dir_set = 0x717,
-	/** GPIO Wake Enable / Get */
-	hda_gpio_wakeen_get = 0xf18,
-	/** GPIO Wake Enable / Set */
-	hda_gpio_wakeen_set = 0x718,
-	/** GPIO Unsolicited Enable / Get */
-	hda_gpio_unsol_get = 0xf19,
-	/** GPIO Unsolicited Enable / Set */
-	hda_gpio_unsol_set = 0x719,
-	/** GPIO Sticky Mask / Get */
-	hda_gpio_sticky_get = 0xf1a,
-	/** GPIO Sticky Mask / Set */
-	hda_hpio_sticky_set = 0x71a,
-	/** Beep Generation / Get */
-	hda_beep_gen_get = 0xf0a,
-	/** Beep Generation / Set */
-	hda_beep_gen_set = 0x70a,
-	/** Volume Knob / Get */
-	hda_vol_knob_get = 0xf0f,
-	/** Volume Knob / Set */
-	hda_vol_knob_set = 0x70f,
-	/** Implementation Identification / Get */
-	hda_impl_ident_get = 0xf20,
-	/** Implementation Identification / Set 1 */
-	hda_impl_ident_set1 = 0x720,
-	/** Implementation Identification / Set 2 */
-	hda_impl_ident_set2 = 0x721,
-	/** Implementation Identification / Set 3 */
-	hda_impl_ident_set3 = 0x722,
-	/** Implementation Identification / Set 4 */
-	hda_impl_ident_set4 = 0x723,
-	/** Configuration Default / Get */
-	hda_cfg_def_get = 0xf1c,
-	/** Configuration Default / Set 1 */
-	hda_cfg_def_set1 = 0x71c,
-	/** Configuration Default / Set 2 */
-	hda_cfg_def_set2 = 0x71d,
-	/** Configuration Default / Set 3 */
-	hda_cfg_def_set3 = 0x71e,
-	/** Configuration Default / Set 4 */
-	hda_cfg_def_set4 = 0x71f,
-	/** Stripe Control / Get */
-	hda_stripe_ctl_get = 0xf24,
-	/** Stripe Control / Set */
-	hda_stripe_ctl_set = 0x724,
-	/** Function Reset / Execute */
-	hda_fun_rst_exec = 0x7ff,
-	/** ELD Data / Get */
-	hda_eld_data_get = 0xf2f,
-	/** Converter Channel Count / Get */
-	hda_cvt_chan_cnt_get = 0xf2d,
-	/** Converter Channel Count / Set */
-	hda_cvt_chan_cnt_set = 0x72d,
-	/** DIP-Size / Get */
-	hda_dip_size_get = 0xf2e,
-	/** DIP-Index / Get */
-	hda_dip_index_get = 0xf30,
-	/** DIP-Index / Set */
-	hda_dip_index_set = 0x730,
-	/** DIP-Data / Get */
-	hda_dip_data_get = 0xf31,
-	/** DIP-Data / Set */
-	hda_dip_data_set = 0x731,
-	/** DIP-XmitCtrl / Get */
-	hda_dip_xmitctrl_get = 0xf32,
-	/** DIP-XmitCtrl / Set */
-	hda_dip_xmitctrl_set = 0x732,
-	/** Protection Control / Get */
-	hda_prot_ctl_get = 0xf33,
-	/** Protection Control / Set */
-	hda_prot_ctl_set = 0x733,
-	/** ASP Channel Mapping / Get */
-	hda_asp_chanmap_get = 0xf34,
-	/** ASP Channel Mapping / Set */
-	hda_asp_chanmap_set = 0x734
-} hda_verb_t;
-
-typedef enum {
-	/** Vendor ID */
-	hda_vendor_id = 0x00,
-	/** Revision ID */
-	hda_revision_id = 0x02,
-	/** Subordinate Node Count */
-	hda_sub_nc = 0x04,
-	/** Function Group Type */
-	hda_fgrp_type = 0x05,
-	/** Audio Function Group Capabilities */
-	hda_afg_caps = 0x08,
-	/** Audio Widget Capabilities */
-	hda_aw_caps = 0x09,
-	/** Supported PCM Size, Rates */
-	hda_supp_rates = 0x0a,
-	/** Supported Stream Formats */
-	hda_supp_formats = 0x0b,
-	/** Pin Capabilities */
-	hda_pin_caps = 0x0c,
-	/** Input Amplifier Capabilities */
-	hda_in_amp_caps = 0x0d,
-	/** Output Amplifier Capabilities */
-	hda_out_amp_caps = 0x12,
-	/** Connection List Length */
-	hda_clist_len = 0x0e,
-	/** Supported Power States */
-	hda_supp_pwr_states = 0x0f,
-	/** Processing Capabilities */
-	hda_proc_caps = 0x10,
-	/** GP I/O Count */
-	hda_gpio_cnt = 0x11,
-	/** Volume Knob Capabilities */
-	hda_volk_nob_caps = 0x13
-} hda_param_id_t;
-
-/** Subordinate Node Count Response bits */
-typedef enum {
-	/** Starting Node Number (H) */
-	subnc_startnode_h = 23,
-	/** Starting Node Number (L) */
-	subnc_startnode_l = 16,
-	/** Total Node Count (H) */
-	subnc_nodecount_h = 7,
-	/** Total Node Count (L) */
-	subnc_nodecount_l = 0
-} hda_sub_nc_bits_t;
-
-/** Function Group Type Response bits */
-typedef enum {
-	/** UnSol Capable */
-	fgrpt_unsol = 8,
-	/** Group Type (H) */
-	fgrpt_type_h = 7,
-	/** Group Type (L) */
-	fgrpt_type_l = 0
-} hda_fgrp_type_bits_t;
-
-/** Function Group Type */
-typedef enum {
-	/** Audio Function Group */
-	fgrp_afg = 0x01,
-	/** Vendor Defined Modem Function Group */
-	fgrp_vdmfg = 0x02
-} hda_fgrp_type_t;
-
-/** Connection List Length Response bits */
-typedef enum {
-	/** Long Form */
-	cll_longform = 7,
-	/** Connection List Length (H) */
-	cll_len_h = 6,
-	/** Connection List Length (L) */
-	cll_len_l = 0
-} hda_clist_len_bits_t;
-
-/** Audio Widget Capabilities Bits */
-typedef enum {
-	/** Type (H) */
-	awc_type_h = 23,
-	/** Type (L) */
-	awc_type_l = 20,
-	/** Chan Count Ext (H) */
-	awc_chan_count_ext_h = 15,
-	/** Chan Count Ext (L) */
-	awc_chan_count_ext_l = 13,
-	/** CP Caps */
-	awc_cp_caps = 12,
-	/** L-R Swap */
-	awc_lr_swap = 11,
-	/** Power Control */
-	awc_power_cntrl = 10,
-	/** Digital */
-	awc_digital = 9,
-	/** Conn List */
-	awc_conn_list = 8,
-	/** Unsol Capable */
-	awc_unsol_capable = 7,
-	/** Proc Widget */
-	awc_proc_widget = 6,
-	/** Stripe */
-	awc_stripe = 5,
-	/** Format Override */
-	awc_fmt_override = 4,
-	/** Amp Param Override */
-	awc_amp_param_override = 3,
-	/** Out Amp Present */
-	awc_out_amp_present = 2,
-	/** In Amp Present */
-	awc_in_amp_present = 1,
-	/** Chan Count LSB (Stereo) */
-	awc_chan_count_lsb = 0
-} hda_awidget_caps_bits_t;
-
-/** Pin Capabilities */
-typedef enum {
-	/** High Bit Rate */
-	pwc_hbr = 27,
-	/** Display Port */
-	pwc_dp = 24,
-	/** EAPD Capable */
-	pwc_eapd = 16,
-	/** VRef Control (H) */
-	pwc_vrefctl_h = 15,
-	/** VRef Control (L) */
-	pwc_vrefctl_l = 8,
-	/** HDMI */
-	pwc_hdmi = 7,
-	/** Balanced I/O Pins */
-	pwc_bal_io = 6,
-	/** Input Capable */
-	pwc_input = 5,
-	/** Output Capable */
-	pwc_output = 4,
-	/** Headphone Drive Capable */
-	pwc_hpd = 3,
-	/** Presence Detect Capable */
-	pwc_presence = 2,
-	/** Trigger Required */
-	pwc_trigger_reqd = 1,
-	/** Impedance Sense Capable */
-	pwc_imp_sense = 0
-} hda_pin_caps_bits_t;
-
-/** Audio Widget Type */
-typedef enum {
-	/** Audio Output */
-	awt_audio_output = 0x0,
-	/** Audio Input */
-	awt_audio_input = 0x1,
-	/** Audio Mixer */
-	awt_audio_mixer = 0x2,
-	/** Audio Selector */
-	awt_audio_selector = 0x3,
-	/** Pin Complex */
-	awt_pin_complex = 0x4,
-	/** Power Widget */
-	awt_power_widget = 0x5,
-	/** Volume Knob Widget */
-	awt_volume_knob = 0x6,
-	/** Beep Generator Widget */
-	awt_beep_generator = 0x7,
-	/** Vendor-defined audio widget */
-	awt_vendor_defined = 0xf
-} hda_awidget_type_t;
-
-/** Converter Control bits */
-typedef enum {
-	/** Stream (H) */
-	cctl_stream_h = 7,
-	/** Stream (L) */
-	cctl_stream_l = 4,
-	/** Channel (H) */
-	cctl_channel_h = 3,
-	/** Channel (L) */
-	cctl_channel_l = 0
-} hda_converter_ctl_bits_t;
-
-/** Pin Widget Control bits */
-typedef enum {
-	/** Headphone Drive Enable */
-	pctl_hpd_enable = 7,
-	/** Out Enable */
-	pctl_out_enable = 6,
-	/** In Enable */
-	pctl_in_enable = 5,
-	/** Voltage Reference Enable (H) */
-	pctl_vref_enable_h = 2,
-	/** Voltage Reference Enable (L) */
-	pctl_vref_enable_l = 0,
-	/** Encoded Packet Type (H) */
-	pctl_ept_h = 1,
-	/** Encoded Packet Type (L) */
-	pctl_ept_l = 0
-} hda_pin_ctl_bits_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/spec/fmt.h
===================================================================
--- uspace/drv/audio/hdaudio/spec/fmt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio stream format
- */
-
-#ifndef SPEC_FMT_H
-#define SPEC_FMT_H
-
-typedef enum {
-	/** Stream Type */
-	fmt_type = 15,
-	/** Sample Base Rate */
-	fmt_base = 14,
-	/** Sample Base Rate Multiple (H) */
-	fmt_mult_h = 13,
-	/** Sample Base Rate Multiple (L) */
-	fmt_mult_l = 11,
-	/** Sample Base Rate Divisor (H) */
-	fmt_div_h = 10,
-	/** Sample Base Rate Divisor (L) */
-	fmt_div_l = 8,
-	/** Bits per Sample (H) */
-	fmt_bits_h = 6,
-	/** Bits per Sample (L) */
-	fmt_bits_l = 4,
-	/** Number of Channels (H) */
-	fmt_chan_h = 3,
-	/** Number of Channels (L) */
-	fmt_chan_l = 0
-} hda_stream_fmt_bits_t;
-
-/** Stream Type */
-typedef enum {
-	/** PCM */
-	fmt_type_pcm = 0,
-	/** Non-PCM */
-	fmt_type_nonpcm = 1
-} hda_fmt_type_t;
-
-/** Sample Base Rate */
-typedef enum {
-	/** 48 kHz */
-	fmt_base_48khz = 0,
-	/** 44.1 kHz */
-	fmt_base_44khz = 1
-} hda_fmt_base_t;
-
-/** Sample Base Rate Multiple */
-typedef enum {
-	/** 48 kHz/44.1 kHz or less */
-	fmt_mult_x1 = 0,
-	/** x2 (96 kHz, 88.2 kHz, 32 kHz) */
-	fmt_mult_x2 = 1,
-	/** x3 (144 kHz) */
-	fmt_mult_x3 = 2,
-	/** x4 (192 kHz, 176.4 kHz) */
-	fmt_mult_x4 = 3
-} hda_fmt_mult_t;
-
-/** Sample Base Rate Divisor */
-typedef enum {
-	/** Divide by 1 (48 kHz, 44.1 kHz) */
-	fmt_div_1 = 0,
-	/** Divide by 2 (24 kHz, 22.05 kHz) */
-	fmt_div_2 = 1,
-	/** Divide by 3 (16 kHz, 32 kHz) */
-	fmt_div_3 = 2,
-	/** Divide by 4 (11.025 kHz) */
-	fmt_div_4 = 3,
-	/** Divide by 5 (9.6 kHz) */
-	fmt_div_5 = 4,
-	/** Divide by 6 (8 kHz) */
-	fmt_div_6 = 5,
-	/** Divide by 7 */
-	fmt_div_7 = 6,
-	/** Divide by 8 (6 kHz) */
-	fmt_div_8 = 7
-} hda_fmt_div_t;
-
-/** Bits per Sample */
-typedef enum {
-	/** 8 bits */
-	fmt_bits_8 = 0,
-	/** 16 bits */
-	fmt_bits_16 = 1,
-	/** 20 bits */
-	fmt_bits_20 = 2,
-	/** 24 bits */
-	fmt_bits_24 = 3,
-	/** 32 bits */
-	fmt_bits_32 = 4
-} hda_fmt_bits_t;
-
-/** Number of Channels */
-typedef enum {
-	fmt_chan_1 = 0,
-	fmt_chan_2 = 1,
-	fmt_chan_3 = 2,
-	fmt_chan_4 = 3,
-	fmt_chan_5 = 4,
-	fmt_chan_6 = 5,
-	fmt_chan_7 = 6,
-	fmt_chan_8 = 7,
-	fmt_chan_9 = 8,
-	fmt_chan_10 = 9,
-	fmt_chan_11 = 10,
-	fmt_chan_12 = 11,
-	fmt_chan_13 = 12,
-	fmt_chan_14 = 13,
-	fmt_chan_15 = 14,
-	fmt_chan_16 = 15
-} hda_fmt_chan_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/spec/regs.h
===================================================================
--- uspace/drv/audio/hdaudio/spec/regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,321 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio register interface
- */
-
-#ifndef SPEC_REGS_H
-#define SPEC_REGS_H
-
-#include <stdint.h>
-
-/** Stream Descriptor registers */
-typedef struct {
-	/** Control 1 */
-	uint8_t ctl1;
-	/** Control 2 */
-	uint8_t ctl2;
-	/** Control 3 */
-	uint8_t ctl3;
-	/** Status */
-	uint8_t sts;
-	/** Link Position in Current Buffer */
-	uint32_t lpib;
-	/** Cyclic Buffer Length */
-	uint32_t cbl;
-	/** Last Valid Index */
-	uint16_t lvi;
-	/** Reserved */
-	uint8_t reserved1[2];
-	/** FIFO Size */
-	uint16_t fifod;
-	/** Format */
-	uint16_t fmt;
-	/** Reserved */
-	uint8_t reserved2[4];
-	/** Buffer Descriptor List Pointer - Lower */
-	uint32_t bdpl;
-	/** Buffer Descriptor List Pointer - Upper */
-	uint32_t bdpu;
-} hda_sdesc_regs_t;
-
-typedef struct {
-	/** Global Capabilities */
-	uint16_t gcap;
-	/** Minor Version */
-	uint8_t vmin;
-	/** Major Version */
-	uint8_t vmaj;
-	/** Output Payload Capability */
-	uint16_t outpay;
-	/** Input Payload Capability */
-	uint16_t inpay;
-	/** Global Control */
-	uint32_t gctl;
-	/** Wake Enable */
-	uint16_t wakeen;
-	/** State Change Status */
-	uint16_t statests;
-	/** Global Status */
-	uint16_t gsts;
-	/** Reserved */
-	uint8_t reserved1[6];
-	/** Output Stream Payload Capability */
-	uint16_t outstrmpay;
-	/** Input Stream Payload Capability */
-	uint16_t instrmpay;
-	/** Reserved */
-	uint8_t reserved2[4];
-	/** Interrupt Control */
-	uint32_t intctl;
-	/** Interrupt Status */
-	uint32_t intsts;
-	/** Reserved */
-	uint8_t reserved3[8];
-	/** Wall Clock Counter */
-	uint32_t walclk;
-	/** Reserved */
-	uint8_t reserved4[4];
-	/** Stream Synchronization */
-	uint32_t ssync;
-	/** Reserved */
-	uint8_t reserved5[4];
-	/** CORB Lower Base Address */
-	uint32_t corblbase;
-	/** CORB Upper Base Address */
-	uint32_t corbubase;
-	/** CORB Write Pointer */
-	uint16_t corbwp;
-	/** CORB Read Pointer */
-	uint16_t corbrp;
-	/** CORB Control */
-	uint8_t corbctl;
-	/** CORB Status */
-	uint8_t corbsts;
-	/** CORB Size */
-	uint8_t corbsize;
-	/** Reserved */
-	uint8_t reserved6[1];
-	/** RIRB Lower Base Address */
-	uint32_t rirblbase;
-	/** RIRB Upper Base Address */
-	uint32_t rirbubase;
-	/** RIRB Write Pointer */
-	uint16_t rirbwp;
-	/** Response Interrupt Count */
-	uint16_t rintcnt;
-	/** RIRB Control */
-	uint8_t rirbctl;
-	/** RIRB Status */
-	uint8_t rirbsts;
-	/** RIRB Size */
-	uint8_t rirbsize;
-	/** Reserved */
-	uint8_t reserved7[1];
-	/** Immediate Command Output Interface */
-	uint32_t icoi;
-	/** Immediate Command Input Interface */
-	uint32_t icii;
-	/** Immediate Command Status */
-	uint16_t icis;
-	/** Reserved */
-	uint8_t reserved8[6];
-	/** DMA Position Buffer Lower Base */
-	uint32_t dplbase;
-	/** DMA Position Buffer Upper Base */
-	uint32_t dpubase;
-	/** Reserved */
-	uint8_t reserved9[8];
-	/** Stream descriptor registers */
-	hda_sdesc_regs_t sdesc[64];
-	/** Fill up to 0x2030 */
-	uint8_t reserved10[6064];
-	/** Wall Clock Counter Alias */
-	uint32_t walclka;
-	/** Stream Descriptor Link Position in Current Buffer */
-	uint32_t sdlpiba[64];
-} hda_regs_t;
-
-/** Stream Descriptor Control bits */
-typedef enum {
-	/** Descriptor Error Interrupt Enable */
-	sdctl1_deie = 4,
-	/** FIFO Error Interrupt Enable */
-	sdctl1_feie = 3,
-	/** Interrupt on Completion Enable */
-	sdctl1_ioce = 2,
-	/** Stream Run */
-	sdctl1_run = 1,
-	/** Stream Reset */
-	sdctl1_srst = 0
-} hda_sdesc_ctl1_bits;
-
-/** Stream Descriptor Status bits */
-typedef enum {
-	/** FIFO Ready */
-	sdctl1_fifordy = 3,
-	/** Descriptor Error */
-	sdsts_dese = 2,
-	/** FIFO Error */
-	sdsts_fifoe = 1,
-	/** Buffer Completion Interrupt Status */
-	sdsts_bcis = 2
-} hda_sdesc_sts_bits;
-
-typedef enum {
-	/** Number of Output Streams Supported (H) */
-	gcap_oss_h = 15,
-	/** Number of Output Streams Supported (L) */
-	gcap_oss_l = 12,
-	/** Number of Input Streams Supported (H) */
-	gcap_iss_h = 11,
-	/** Number of Input Streams Supported (L) */
-	gcap_iss_l = 8,
-	/** Number of Bidirectional Streams Supported (H) */
-	gcap_bss_h = 7,
-	/** Number of Bidirectional Streams Supported (L) */
-	gcap_bss_l = 3,
-	/** Number of Serial Data Out Signals (H) */
-	gcap_nsdo_h = 2,
-	/** Number of Serial Data Out Signals (H) */
-	gcap_nsdo_l = 1,
-	/** 64 Bit Address Supported */
-	gcap_64ok = 0
-} hda_gcap_bits_t;
-
-typedef enum {
-	/** Accept Unsolicited Response Enable */
-	gctl_unsol = 8,
-	/** Flush Control */
-	gctl_fcntrl = 1,
-	/** Controller Reset */
-	gctl_crst = 0
-} hda_gctl_bits_t;
-
-typedef enum {
-	/** Global Interrupt Enable */
-	intctl_gie = 31,
-	/** Controller Interrupt Enable */
-	intctl_cie = 30,
-	/** Stream Interrupt Enable */
-	intctl_sie = 29
-} hda_intctl_bits_t;
-
-typedef enum {
-	/** CORB Read Pointer Reset */
-	corbrp_rst = 15,
-	/** CORB Read Pointer (H) */
-	corbrp_rp_h = 7,
-	/** CORB Read Pointer (L) */
-	corbrp_rp_l = 0
-} hda_corbrp_bits_t;
-
-typedef enum {
-	/** CORB Write Pointer (H) */
-	corbwp_wp_h = 7,
-	/** CORB Write Pointer (L) */
-	corbwp_wp_l = 0
-} hda_corbwp_bits_t;
-
-typedef enum {
-	/** Enable CORB DMA Engine */
-	corbctl_run = 1,
-	/** CORB Memory Error Interrupt Enable */
-	corbctl_meie = 0
-} hda_corbctl_bits_t;
-
-typedef enum {
-	/** CORB Size Capability (H) */
-	corbsize_cap_h = 7,
-	/** CORB Size Capability (L) */
-	corbsize_cap_l = 4,
-	/** CORB Size (H) */
-	corbsize_size_h = 1,
-	/** CORB Size (L) */
-	corbsize_size_l = 0
-} hda_corbsize_bits_t;
-
-typedef enum {
-	/** RIRB Write Pointer Reset */
-	rirbwp_rst = 15,
-	/** RIRB Write Pointer (H) */
-	rirbwp_wp_h = 7,
-	/** RIRB Write Pointer (L) */
-	rirbwp_wp_l = 0
-} hda_rirbwp_bits_t;
-
-typedef enum {
-	/** Response Overrun Interrupt Control */
-	rirbctl_oic = 2,
-	/** RIRB DMA Enable */
-	rirbctl_run = 1,
-	/** CORB Memory Error Interrupt Enable */
-	rirbctl_int = 0
-} hda_rirbctl_bits_t;
-
-typedef enum {
-	/** Response Overrun Interrupt Status */
-	rirbsts_ois = 2,
-	/** Response Interrupt */
-	rirbsts_intfl = 0
-} hda_rirbsts_bits_t;
-
-typedef enum {
-	/** RIRB Size Capability (H) */
-	rirbsize_cap_h = 7,
-	/** RIRB Size Capability (L) */
-	rirbsize_cap_l = 4,
-	/** RIRB Size (H) */
-	rirbsize_size_h = 1,
-	/** RIRB Size (L) */
-	rirbsize_size_l = 0
-} hda_rirbsize_bits_t;
-
-typedef struct {
-	/** Response - data received from codec */
-	uint32_t resp;
-	/** Response Extended - added by controller */
-	uint32_t respex;
-} hda_rirb_entry_t;
-
-typedef enum {
-	/** Unsolicited response */
-	respex_unsol = 4,
-	/** Codec Address (H) */
-	respex_addr_h = 3,
-	/** Codec Address (L) */
-	respex_addr_l = 0
-} hda_respex_bits_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/stream.c
===================================================================
--- uspace/drv/audio/hdaudio/stream.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,285 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio stream
- */
-
-#include <as.h>
-#include <bitops.h>
-#include <byteorder.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <str_error.h>
-#include <macros.h>
-#include <stdlib.h>
-
-#include "hdactl.h"
-#include "hdaudio.h"
-#include "regif.h"
-#include "spec/bdl.h"
-#include "stream.h"
-
-errno_t hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)
-{
-	void *bdl;
-	void *buffer;
-	uintptr_t buffer_phys;
-	hda_stream_buffers_t *bufs = NULL;
-	size_t i;
-	//size_t j, k;
-	errno_t rc;
-
-	bufs = calloc(1, sizeof(hda_stream_buffers_t));
-	if (bufs == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	bufs->nbuffers = 4;
-	bufs->bufsize = 16384;
-
-	/*
-	 * BDL must be aligned to 128 bytes. If 64OK is not set,
-	 * it must be within the 32-bit address space.
-	 */
-	bdl = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(bufs->nbuffers * sizeof(hda_buffer_desc_t),
-	    hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE,
-	    0, &bufs->bdl_phys, &bdl);
-	if (rc != EOK)
-		goto error;
-
-	bufs->bdl = bdl;
-
-	/* Allocate arrays of buffer pointers */
-
-	bufs->buf = calloc(bufs->nbuffers, sizeof(void *));
-	if (bufs->buf == NULL)
-		goto error;
-
-	bufs->buf_phys = calloc(bufs->nbuffers, sizeof(uintptr_t));
-	if (bufs->buf_phys == NULL)
-		goto error;
-
-	/* Allocate buffers */
-#if 0
-	for (i = 0; i < bufs->nbuffers; i++) {
-		buffer = AS_AREA_ANY;
-		rc = dmamem_map_anonymous(bufs->bufsize,
-		    bufs->hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE,
-		    0, &buffer_phys, &buffer);
-		if (rc != EOK)
-			goto error;
-
-		ddf_msg(LVL_DEBUG, "Stream buf phys=0x%llx virt=%p",
-		    (unsigned long long)buffer_phys, buffer);
-
-		bufs->buf[i] = buffer;
-		bufs->buf_phys[i] = buffer_phys;
-
-		k = 0;
-		for (j = 0; j < bufs->bufsize / 2; j++) {
-			int16_t *bp = bufs->buf[i];
-			bp[j] = (k > 128) ? -100 : 100;
-			++k;
-			if (k >= 256)
-				k = 0;
-		}
-	}
-#endif
-	/* audio_pcm_iface requires a single contiguous buffer */
-	buffer = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(bufs->bufsize * bufs->nbuffers,
-	    hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE,
-	    0, &buffer_phys, &buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_DEBUG, "dmamem_map_anon -> %s", str_error_name(rc));
-		goto error;
-	}
-
-	for (i = 0; i < bufs->nbuffers; i++) {
-		bufs->buf[i] = buffer + i * bufs->bufsize;
-		bufs->buf_phys[i] = buffer_phys + i * bufs->bufsize;
-
-		ddf_msg(LVL_DEBUG, "Stream buf phys=0x%llx virt=%p",
-		    (long long unsigned)(uintptr_t)bufs->buf[i],
-		    (void *)bufs->buf_phys[i]);
-	}
-
-	/* Fill in BDL */
-	for (i = 0; i < bufs->nbuffers; i++) {
-		bufs->bdl[i].address = host2uint64_t_le(bufs->buf_phys[i]);
-		bufs->bdl[i].length = host2uint32_t_le(bufs->bufsize);
-		bufs->bdl[i].flags = BIT_V(uint32_t, bdf_ioc);
-	}
-
-	*rbufs = bufs;
-	return EOK;
-error:
-	hda_stream_buffers_free(bufs);
-	return ENOMEM;
-}
-
-void hda_stream_buffers_free(hda_stream_buffers_t *bufs)
-{
-	if (bufs == NULL)
-		return;
-
-	/* XXX */
-	free(bufs);
-}
-
-static void hda_stream_desc_configure(hda_stream_t *stream)
-{
-	hda_sdesc_regs_t *sdregs;
-	hda_stream_buffers_t *bufs = stream->buffers;
-	uint8_t ctl1;
-	uint8_t ctl3;
-
-	/* Stream ID */
-	ctl3 = (stream->sid << 4);
-
-	/* Interrupt on buffer completion */
-	ctl1 = BIT_V(uint8_t, sdctl1_ioce);
-
-	sdregs = &stream->hda->regs->sdesc[stream->sdid];
-	hda_reg8_write(&sdregs->ctl3, ctl3);
-	hda_reg8_write(&sdregs->ctl1, ctl1);
-	hda_reg32_write(&sdregs->cbl, bufs->nbuffers * bufs->bufsize);
-	hda_reg16_write(&sdregs->lvi, bufs->nbuffers - 1);
-	hda_reg16_write(&sdregs->fmt, stream->fmt);
-	hda_reg32_write(&sdregs->bdpl, LOWER32(bufs->bdl_phys));
-	hda_reg32_write(&sdregs->bdpu, UPPER32(bufs->bdl_phys));
-}
-
-static void hda_stream_set_run(hda_stream_t *stream, bool run)
-{
-	uint32_t ctl;
-	hda_sdesc_regs_t *sdregs;
-
-	sdregs = &stream->hda->regs->sdesc[stream->sdid];
-
-	ctl = hda_reg8_read(&sdregs->ctl1);
-	if (run)
-		ctl = ctl | BIT_V(uint8_t, sdctl1_run);
-	else
-		ctl = ctl & ~BIT_V(uint8_t, sdctl1_run);
-
-	hda_reg8_write(&sdregs->ctl1, ctl);
-}
-
-static void hda_stream_reset_noinit(hda_stream_t *stream)
-{
-	uint32_t ctl;
-	hda_sdesc_regs_t *sdregs;
-
-	sdregs = &stream->hda->regs->sdesc[stream->sdid];
-
-	ctl = hda_reg8_read(&sdregs->ctl1);
-	ctl = ctl | BIT_V(uint8_t, sdctl1_srst);
-	hda_reg8_write(&sdregs->ctl1, ctl);
-
-	fibril_usleep(100 * 1000);
-
-	ctl = hda_reg8_read(&sdregs->ctl1);
-	ctl = ctl & ~BIT_V(uint8_t, sdctl1_srst);
-	hda_reg8_write(&sdregs->ctl1, ctl);
-
-	fibril_usleep(100 * 1000);
-}
-
-hda_stream_t *hda_stream_create(hda_t *hda, hda_stream_dir_t dir,
-    hda_stream_buffers_t *bufs, uint32_t fmt)
-{
-	hda_stream_t *stream;
-	uint8_t sdid;
-
-	stream = calloc(1, sizeof(hda_stream_t));
-	if (stream == NULL)
-		return NULL;
-
-	sdid = 0;
-
-	switch (dir) {
-	case sdir_input:
-		sdid = 0; /* XXX Allocate - first input SDESC */
-		break;
-	case sdir_output:
-		sdid = hda->ctl->iss; /* XXX Allocate - First output SDESC */
-		break;
-	case sdir_bidi:
-		sdid = hda->ctl->iss + hda->ctl->oss; /* XXX Allocate - First bidi SDESC */
-		break;
-	}
-
-	stream->hda = hda;
-	stream->dir = dir;
-	stream->sid = 1; /* XXX Allocate this */
-	stream->sdid = sdid;
-	stream->fmt = fmt;
-	stream->buffers = bufs;
-
-	ddf_msg(LVL_DEBUG, "snum=%d sdidx=%d", stream->sid, stream->sdid);
-
-	ddf_msg(LVL_DEBUG, "Configure stream descriptor");
-	hda_stream_desc_configure(stream);
-	return stream;
-}
-
-void hda_stream_destroy(hda_stream_t *stream)
-{
-	ddf_msg(LVL_DEBUG, "hda_stream_destroy()");
-	hda_stream_reset_noinit(stream);
-	free(stream);
-}
-
-void hda_stream_start(hda_stream_t *stream)
-{
-	ddf_msg(LVL_DEBUG, "hda_stream_start()");
-	hda_stream_set_run(stream, true);
-}
-
-void hda_stream_stop(hda_stream_t *stream)
-{
-	ddf_msg(LVL_DEBUG, "hda_stream_stop()");
-	hda_stream_set_run(stream, false);
-}
-
-void hda_stream_reset(hda_stream_t *stream)
-{
-	ddf_msg(LVL_DEBUG, "hda_stream_reset()");
-	hda_stream_reset_noinit(stream);
-	hda_stream_desc_configure(stream);
-}
-
-/** @}
- */
Index: pace/drv/audio/hdaudio/stream.h
===================================================================
--- uspace/drv/audio/hdaudio/stream.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hdaudio
- * @{
- */
-/** @file High Definition Audio stream
- */
-
-#ifndef STREAM_H
-#define STREAM_H
-
-#include "hdaudio.h"
-#include "spec/bdl.h"
-
-typedef enum {
-	/** Input Stream */
-	sdir_input,
-	/** Output Stream */
-	sdir_output,
-	/** Bidirectional Stream */
-	sdir_bidi
-} hda_stream_dir_t;
-
-typedef struct hda_stream_buffers {
-	/** Number of buffers */
-	size_t nbuffers;
-	/** Buffer size */
-	size_t bufsize;
-	/** Buffer Descriptor List */
-	hda_buffer_desc_t *bdl;
-	/** Physical address of BDL */
-	uintptr_t bdl_phys;
-	/** Buffers */
-	void **buf;
-	/** Physical addresses of buffers */
-	uintptr_t *buf_phys;
-} hda_stream_buffers_t;
-
-typedef struct hda_stream {
-	hda_t *hda;
-	/** Stream ID */
-	uint8_t sid;
-	/** Stream descriptor index */
-	uint8_t sdid;
-	/** Direction */
-	hda_stream_dir_t dir;
-	/** Buffers */
-	hda_stream_buffers_t *buffers;
-	/** Stream format */
-	uint32_t fmt;
-} hda_stream_t;
-
-extern errno_t hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);
-extern void hda_stream_buffers_free(hda_stream_buffers_t *);
-extern hda_stream_t *hda_stream_create(hda_t *, hda_stream_dir_t,
-    hda_stream_buffers_t *, uint32_t);
-extern void hda_stream_destroy(hda_stream_t *);
-extern void hda_stream_start(hda_stream_t *);
-extern void hda_stream_stop(hda_stream_t *);
-extern void hda_stream_reset(hda_stream_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/audio/sb16/ddf_log.h
===================================================================
--- uspace/drv/audio/sb16/ddf_log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief DDF log helper macros
- */
-#ifndef DRV_AUDIO_SB16_DDF_LOG_H
-#define DRV_AUDIO_SB16_DDF_LOG_H
-
-#include <ddf/log.h>
-
-#define ddf_log_fatal(msg...) ddf_msg(LVL_FATAL, msg)
-#define ddf_log_error(msg...) ddf_msg(LVL_ERROR, msg)
-#define ddf_log_warning(msg...) ddf_msg(LVL_WARN, msg)
-#define ddf_log_note(msg...) ddf_msg(LVL_NOTE, msg)
-#define ddf_log_debug(msg...) ddf_msg(LVL_DEBUG, msg)
-#define ddf_log_verbose(msg...) ddf_msg(LVL_DEBUG2, msg)
-
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/doc/doxygroups.h
===================================================================
--- uspace/drv/audio/sb16/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvaudiosb16 sb16
- * @brief Driver for Creative Labs SoundBlaster 16
- * @ingroup drvs
- */
Index: pace/drv/audio/sb16/dsp.c
===================================================================
--- uspace/drv/audio/sb16/dsp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,557 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief DSP helper functions implementation
- */
-
-#include <as.h>
-#include <stdbool.h>
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <device/hw_res.h>
-#include <libarch/ddi.h>
-#include <barrier.h>
-#include <macros.h>
-#include <str_error.h>
-#include <audio_pcm_iface.h>
-
-#include "ddf_log.h"
-#include "dsp_commands.h"
-#include "dsp.h"
-
-/* Maximum allowed transfer size for ISA DMA transfers is 64kB */
-#define MAX_BUFFER_SIZE (64 * 1024)
-
-#ifndef DSP_RETRY_COUNT
-#define DSP_RETRY_COUNT 100
-#endif
-
-#define DSP_RESET_RESPONSE 0xaa
-
-/* These are only for SB16 (DSP4.00+) */
-#define DSP_RATE_UPPER_LIMIT 44100
-#define DSP_RATE_LOWER_LIMIT 5000
-
-#define AUTO_DMA_MODE
-
-static inline const char *dsp_state_to_str(dsp_state_t state)
-{
-	static const char *state_names[] = {
-		[DSP_PLAYBACK_ACTIVE_EVENTS] = "PLAYBACK w/ EVENTS",
-		[DSP_CAPTURE_ACTIVE_EVENTS] = "CAPTURE w/ EVENTS",
-		[DSP_PLAYBACK_NOEVENTS] = "PLAYBACK w/o EVENTS",
-		[DSP_CAPTURE_NOEVENTS] = "CAPTURE w/o EVENTS",
-		[DSP_PLAYBACK_TERMINATE] = "PLAYBACK TERMINATE",
-		[DSP_CAPTURE_TERMINATE] = "CAPTURE TERMINATE",
-		[DSP_READY] = "READY",
-		[DSP_NO_BUFFER] = "NO BUFFER",
-		[DSP_QUIESCED] = "QUIESCED"
-	};
-	if ((size_t)state < ARRAY_SIZE(state_names))
-		return state_names[state];
-	return "UNKNOWN";
-}
-
-static inline void dsp_change_state(sb_dsp_t *dsp, dsp_state_t state)
-{
-	assert(dsp);
-	if (dsp->state == DSP_QUIESCED)
-		return;
-
-	ddf_log_verbose("Changing state from %s to %s",
-	    dsp_state_to_str(dsp->state), dsp_state_to_str(state));
-	dsp->state = state;
-}
-
-static inline errno_t dsp_read(sb_dsp_t *dsp, uint8_t *data)
-{
-	assert(data);
-	assert(dsp);
-	uint8_t status;
-	size_t attempts = DSP_RETRY_COUNT;
-	do {
-		status = pio_read_8(&dsp->regs->dsp_read_status);
-	} while (--attempts && ((status & DSP_READ_READY) == 0));
-
-	if ((status & DSP_READ_READY) == 0)
-		return EIO;
-
-	*data = pio_read_8(&dsp->regs->dsp_data_read);
-	return EOK;
-}
-
-static inline errno_t dsp_write(sb_dsp_t *dsp, uint8_t data)
-{
-	assert(dsp);
-	uint8_t status;
-	size_t attempts = DSP_RETRY_COUNT;
-	do {
-		status = pio_read_8(&dsp->regs->dsp_write);
-	} while (--attempts && ((status & DSP_WRITE_BUSY) != 0));
-
-	if ((status & DSP_WRITE_BUSY))
-		return EIO;
-
-	pio_write_8(&dsp->regs->dsp_write, data);
-	return EOK;
-}
-
-static inline void dsp_reset(sb_dsp_t *dsp)
-{
-	assert(dsp);
-	/* Reset DSP, see Chapter 2 of Sound Blaster HW programming guide */
-	pio_write_8(&dsp->regs->dsp_reset, 1);
-	udelay(3); /* Keep reset for 3 us */
-	pio_write_8(&dsp->regs->dsp_reset, 0);
-	/* "DSP takes about 100 microseconds to initialize itself" */
-	udelay(100);
-}
-
-static inline void dsp_start_current_active(sb_dsp_t *dsp, uint8_t command)
-{
-	dsp_write(dsp, command);
-	dsp_write(dsp, dsp->active.mode);
-	dsp_write(dsp, (dsp->active.samples - 1) & 0xff);
-	dsp_write(dsp, (dsp->active.samples - 1) >> 8);
-}
-
-static inline void dsp_set_sampling_rate(sb_dsp_t *dsp, unsigned rate)
-{
-	dsp_write(dsp, SET_SAMPLING_RATE_OUTPUT);
-	uint8_t rate_lo = rate & 0xff;
-	uint8_t rate_hi = rate >> 8;
-	dsp_write(dsp, rate_hi);
-	dsp_write(dsp, rate_lo);
-	ddf_log_verbose("Sampling rate: %hhx:%hhx.", rate_hi, rate_lo);
-}
-
-static inline void dsp_report_event(sb_dsp_t *dsp, pcm_event_t event)
-{
-	assert(dsp);
-	if (!dsp->event_exchange)
-		ddf_log_warning("No one listening for event %u", event);
-	async_msg_1(dsp->event_exchange, event, dsp->active.frame_count);
-}
-
-static inline errno_t setup_dma(sb_dsp_t *dsp, uintptr_t pa, size_t size)
-{
-	async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
-
-	return hw_res_dma_channel_setup(sess,
-	    dsp->dma16_channel, pa, size,
-	    DMA_MODE_READ | DMA_MODE_AUTO | DMA_MODE_ON_DEMAND);
-}
-
-static inline errno_t setup_buffer(sb_dsp_t *dsp, size_t size)
-{
-	assert(dsp);
-
-	if ((size > MAX_BUFFER_SIZE) || (size == 0) || ((size % 2) == 1))
-		size = MAX_BUFFER_SIZE;
-
-	uintptr_t pa = 0;
-	void *buffer = AS_AREA_ANY;
-
-	errno_t ret = dmamem_map_anonymous(size, DMAMEM_16MiB | 0x0000ffff,
-	    AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer);
-	if (ret != EOK) {
-		ddf_log_error("Failed to allocate DMA buffer.");
-		return ENOMEM;
-	}
-
-	ddf_log_verbose("Setup DMA buffer at %p (%zu) %zu.", buffer, pa, size);
-	assert(pa < (1 << 24));
-
-	/* Setup 16 bit channel */
-	ret = setup_dma(dsp, pa, size);
-	if (ret == EOK) {
-		dsp->buffer.data = buffer;
-		dsp->buffer.size = size;
-	} else {
-		ddf_log_error("Failed to setup DMA16 channel: %s.",
-		    str_error(ret));
-		dmamem_unmap_anonymous(buffer);
-	}
-
-	return ret;
-}
-
-errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
-    int dma8, int dma16)
-{
-	assert(dsp);
-	dsp->regs = regs;
-	dsp->dma8_channel = dma8;
-	dsp->dma16_channel = dma16;
-	dsp->event_session = NULL;
-	dsp->event_exchange = NULL;
-	dsp->sb_dev = dev;
-	dsp->state = DSP_NO_BUFFER;
-	dsp_reset(dsp);
-	uint8_t response;
-	const errno_t ret = dsp_read(dsp, &response);
-	if (ret != EOK) {
-		ddf_log_error("Failed to read DSP reset response value.");
-		return ret;
-	}
-	if (response != DSP_RESET_RESPONSE) {
-		ddf_log_error("Invalid DSP reset response: %x.", response);
-		return EIO;
-	}
-
-	/* Get DSP version number */
-	dsp_write(dsp, DSP_VERSION);
-	dsp_read(dsp, &dsp->version.major);
-	dsp_read(dsp, &dsp->version.minor);
-
-	return ret;
-}
-
-void sb_dsp_quiesce(sb_dsp_t *dsp)
-{
-	dsp->state = DSP_QUIESCED;
-	dsp_reset(dsp);
-}
-
-void sb_dsp_interrupt(sb_dsp_t *dsp)
-{
-	assert(dsp);
-
-	dsp->active.frame_count +=
-	    dsp->active.samples / ((dsp->active.mode & DSP_MODE_STEREO) ? 2 : 1);
-
-	switch (dsp->state) {
-	case DSP_PLAYBACK_ACTIVE_EVENTS:
-		dsp_report_event(dsp, PCM_EVENT_FRAMES_PLAYED);
-	case DSP_PLAYBACK_NOEVENTS:
-#ifndef AUTO_DMA_MODE
-		dsp_start_current_active(dsp, SINGLE_DMA_16B_DA);
-#endif
-		break;
-	case DSP_CAPTURE_ACTIVE_EVENTS:
-		dsp_report_event(dsp, PCM_EVENT_FRAMES_CAPTURED);
-	case DSP_CAPTURE_NOEVENTS:
-#ifndef AUTO_DMA_MODE
-		dsp_start_current_active(dsp, SINGLE_DMA_16B_DA);
-#endif
-		break;
-	case DSP_CAPTURE_TERMINATE:
-		dsp_change_state(dsp, DSP_READY);
-		dsp_report_event(dsp, PCM_EVENT_CAPTURE_TERMINATED);
-		async_exchange_end(dsp->event_exchange);
-		dsp->event_exchange = NULL;
-		break;
-	case DSP_PLAYBACK_TERMINATE:
-		dsp_change_state(dsp, DSP_READY);
-		dsp_report_event(dsp, PCM_EVENT_PLAYBACK_TERMINATED);
-		async_exchange_end(dsp->event_exchange);
-		dsp->event_exchange = NULL;
-		break;
-	default:
-		ddf_log_warning("Interrupt while DSP not active (%s)",
-		    dsp_state_to_str(dsp->state));
-	}
-}
-
-unsigned sb_dsp_query_cap(sb_dsp_t *dsp, audio_cap_t cap)
-{
-	ddf_log_verbose("Querying cap %s", audio_pcm_cap_str(cap));
-	switch (cap) {
-	case AUDIO_CAP_CAPTURE:
-	case AUDIO_CAP_PLAYBACK:
-	case AUDIO_CAP_INTERRUPT:
-	case AUDIO_CAP_BUFFER_POS:
-		return 1;
-	case AUDIO_CAP_MAX_BUFFER:
-		return MAX_BUFFER_SIZE;
-	case AUDIO_CAP_INTERRUPT_MIN_FRAMES:
-		return 1;
-	case AUDIO_CAP_INTERRUPT_MAX_FRAMES:
-		return 16535;
-	default:
-		return -1;
-	}
-}
-
-errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *pos)
-{
-	if (dsp->state == DSP_NO_BUFFER)
-		return ENOENT;
-
-	assert(dsp->buffer.data);
-	async_sess_t *sess = ddf_dev_parent_sess_get(dsp->sb_dev);
-
-	// TODO: Assumes DMA 16
-	size_t remain;
-	errno_t rc = hw_res_dma_channel_remain(sess, dsp->dma16_channel, &remain);
-	if (rc == EOK) {
-		*pos = dsp->buffer.size - remain;
-	}
-	return rc;
-}
-
-errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
-    pcm_sample_format_t *format)
-{
-	errno_t ret = EOK;
-	if (*channels == 0 || *channels > 2) {
-		*channels = 2;
-		ret = ELIMIT;
-	}
-	//TODO 8bit DMA supports 8bit formats
-	if (*format != PCM_SAMPLE_SINT16_LE && *format != PCM_SAMPLE_UINT16_LE) {
-		*format = pcm_sample_format_is_signed(*format) ?
-		    PCM_SAMPLE_SINT16_LE : PCM_SAMPLE_UINT16_LE;
-		ret = ELIMIT;
-	}
-	if (*rate > DSP_RATE_UPPER_LIMIT) {
-		*rate = DSP_RATE_UPPER_LIMIT;
-		ret = ELIMIT;
-	}
-	if (*rate < DSP_RATE_LOWER_LIMIT) {
-		*rate = DSP_RATE_LOWER_LIMIT;
-		ret = ELIMIT;
-	}
-	return ret;
-}
-
-errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session)
-{
-	assert(dsp);
-	if (dsp->event_session && session)
-		return EBUSY;
-	dsp->event_session = session;
-	ddf_log_debug("Set event session to %p.", session);
-	return EOK;
-}
-
-async_sess_t *sb_dsp_get_event_session(sb_dsp_t *dsp)
-{
-	assert(dsp);
-	ddf_log_debug("Get event session: %p.", dsp->event_session);
-	return dsp->event_session;
-}
-
-errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size)
-{
-	assert(dsp);
-	assert(size);
-
-	/*
-	 * buffer is already setup by for someone, refuse to work until
-	 * it's released
-	 */
-	if (dsp->state != DSP_NO_BUFFER)
-		return EBUSY;
-	assert(dsp->buffer.data == NULL);
-
-	const errno_t ret = setup_buffer(dsp, *size);
-	if (ret == EOK) {
-		ddf_log_debug("Providing buffer: %p, %zu B.",
-		    dsp->buffer.data, dsp->buffer.size);
-
-		if (buffer)
-			*buffer = dsp->buffer.data;
-		if (size)
-			*size = dsp->buffer.size;
-		dsp_change_state(dsp, DSP_READY);
-	}
-	return ret;
-}
-
-errno_t sb_dsp_release_buffer(sb_dsp_t *dsp)
-{
-	assert(dsp);
-	if (dsp->state != DSP_READY)
-		return EINVAL;
-	assert(dsp->buffer.data);
-	dmamem_unmap_anonymous(dsp->buffer.data);
-	dsp->buffer.data = NULL;
-	dsp->buffer.size = 0;
-	ddf_log_debug("DSP buffer released.");
-	dsp_change_state(dsp, DSP_NO_BUFFER);
-	return EOK;
-}
-
-errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
-    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
-{
-	assert(dsp);
-
-	if (!dsp->buffer.data || dsp->state != DSP_READY)
-		return EINVAL;
-
-	/* Check supported parameters */
-	ddf_log_debug("Requested playback: %u frames, %uHz, %s, %u channel(s).",
-	    frames, sampling_rate, pcm_sample_format_str(format), channels);
-	if (sb_dsp_test_format(dsp, &channels, &sampling_rate, &format) != EOK)
-		return ENOTSUP;
-
-	/* Client requested regular events */
-	if (frames && !dsp->event_session)
-		return EINVAL;
-
-	if (dsp->event_session) {
-		dsp->event_exchange = async_exchange_begin(dsp->event_session);
-		if (!dsp->event_exchange)
-			return ENOMEM;
-	}
-
-	dsp->active.mode = 0 |
-	    (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0) |
-	    (channels == 2 ? DSP_MODE_STEREO : 0);
-	dsp->active.samples = frames * channels;
-	dsp->active.frame_count = 0;
-
-	dsp_set_sampling_rate(dsp, sampling_rate);
-
-#ifdef AUTO_DMA_MODE
-	dsp_start_current_active(dsp, AUTO_DMA_16B_DA_FIFO);
-#else
-	dsp_start_current_active(dsp, SINGLE_DMA_16B_DA);
-#endif
-
-	ddf_log_verbose("Playback started, event every %u samples",
-	    dsp->active.samples);
-
-	dsp_change_state(dsp,
-	    frames ? DSP_PLAYBACK_ACTIVE_EVENTS : DSP_PLAYBACK_NOEVENTS);
-	if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS)
-		dsp_report_event(dsp, PCM_EVENT_PLAYBACK_STARTED);
-
-	return EOK;
-}
-
-errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate)
-{
-	assert(dsp);
-	if ((dsp->state == DSP_PLAYBACK_NOEVENTS ||
-	    dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) &&
-	    immediate) {
-		dsp_write(dsp, DMA_16B_PAUSE);
-		dsp_reset(dsp);
-		ddf_log_debug("Stopped playback");
-		dsp_change_state(dsp, DSP_READY);
-		if (dsp->event_exchange) {
-			dsp_report_event(dsp, PCM_EVENT_PLAYBACK_TERMINATED);
-			async_exchange_end(dsp->event_exchange);
-			dsp->event_exchange = NULL;
-		}
-		return EOK;
-	}
-	if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) {
-		/* Stop after current fragment */
-		assert(!immediate);
-		dsp_write(dsp, DMA_16B_EXIT);
-		ddf_log_debug("Last playback fragment");
-		dsp_change_state(dsp, DSP_PLAYBACK_TERMINATE);
-		return EOK;
-	}
-	return EINVAL;
-}
-
-errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
-    unsigned channels, unsigned sampling_rate, pcm_sample_format_t format)
-{
-	assert(dsp);
-	if (!dsp->buffer.data || dsp->state != DSP_READY)
-		return EINVAL;
-
-	/* Check supported parameters */
-	ddf_log_debug("Requested capture: %u frames, %uHz, %s, %u channel(s).",
-	    frames, sampling_rate, pcm_sample_format_str(format), channels);
-	if (sb_dsp_test_format(dsp, &channels, &sampling_rate, &format) != EOK)
-		return ENOTSUP;
-
-	/* Client requested regular events */
-	if (frames && !dsp->event_session)
-		return EINVAL;
-
-	if (dsp->event_session) {
-		dsp->event_exchange = async_exchange_begin(dsp->event_session);
-		if (!dsp->event_exchange)
-			return ENOMEM;
-	}
-
-	dsp->active.mode = 0 |
-	    (pcm_sample_format_is_signed(format) ? DSP_MODE_SIGNED : 0) |
-	    (channels == 2 ? DSP_MODE_STEREO : 0);
-	dsp->active.samples = frames * channels;
-	dsp->active.frame_count = 0;
-
-	dsp_set_sampling_rate(dsp, sampling_rate);
-
-#ifdef AUTO_DMA_MODE
-	dsp_start_current_active(dsp, AUTO_DMA_16B_AD_FIFO);
-#else
-	dsp_start_current_active(dsp, SINGLE_DMA_16B_AD);
-#endif
-
-	ddf_log_verbose("Capture started started, event every %u samples",
-	    dsp->active.samples);
-	dsp_change_state(dsp,
-	    frames ? DSP_CAPTURE_ACTIVE_EVENTS : DSP_CAPTURE_NOEVENTS);
-	if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS)
-		dsp_report_event(dsp, PCM_EVENT_CAPTURE_STARTED);
-	return EOK;
-}
-
-errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate)
-{
-	assert(dsp);
-	if ((dsp->state == DSP_CAPTURE_NOEVENTS ||
-	    dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) &&
-	    immediate) {
-		dsp_write(dsp, DMA_16B_PAUSE);
-		dsp_reset(dsp);
-		ddf_log_debug("Stopped capture fragment");
-		dsp_change_state(dsp, DSP_READY);
-		if (dsp->event_exchange) {
-			dsp_report_event(dsp, PCM_EVENT_CAPTURE_TERMINATED);
-			async_exchange_end(dsp->event_exchange);
-			dsp->event_exchange = NULL;
-		}
-		return EOK;
-	}
-	if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) {
-		/* Stop after current fragment */
-		assert(!immediate);
-		dsp_write(dsp, DMA_16B_EXIT);
-		ddf_log_debug("Last capture fragment");
-		dsp_change_state(dsp, DSP_CAPTURE_TERMINATE);
-		return EOK;
-	}
-	return EINVAL;
-}
-/**
- * @}
- */
Index: pace/drv/audio/sb16/dsp.h
===================================================================
--- uspace/drv/audio/sb16/dsp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief Sound Blaster Digital Sound Processor (DSP) helper functions.
- */
-#ifndef DRV_AUDIO_SB16_DSP_H
-#define DRV_AUDIO_SB16_DSP_H
-
-#include <ddf/driver.h>
-#include <libarch/ddi.h>
-#include <errno.h>
-#include <pcm/sample_format.h>
-#include <audio_pcm_iface.h>
-
-#include "registers.h"
-typedef enum {
-	DSP_PLAYBACK_ACTIVE_EVENTS,
-	DSP_CAPTURE_ACTIVE_EVENTS,
-	DSP_PLAYBACK_NOEVENTS,
-	DSP_CAPTURE_NOEVENTS,
-	DSP_PLAYBACK_TERMINATE,
-	DSP_CAPTURE_TERMINATE,
-	DSP_READY,
-	DSP_NO_BUFFER,
-	DSP_QUIESCED
-} dsp_state_t;
-
-typedef struct sb_dsp {
-	sb16_regs_t *regs;
-	int dma8_channel;
-	int dma16_channel;
-	struct {
-		uint8_t major;
-		uint8_t minor;
-	} version;
-	struct {
-		uint8_t *data;
-		size_t size;
-	} buffer;
-	struct {
-		uint8_t mode;
-		uint16_t samples;
-		unsigned frame_count;
-	} active;
-	dsp_state_t state;
-	async_sess_t *event_session;
-	async_exch_t *event_exchange;
-	ddf_dev_t *sb_dev;
-} sb_dsp_t;
-
-errno_t sb_dsp_init(sb_dsp_t *dsp, sb16_regs_t *regs, ddf_dev_t *dev,
-    int dma8, int dma16);
-void sb_dsp_quiesce(sb_dsp_t *dsp);
-void sb_dsp_interrupt(sb_dsp_t *dsp);
-unsigned sb_dsp_query_cap(sb_dsp_t *dsp, audio_cap_t cap);
-errno_t sb_dsp_get_buffer_position(sb_dsp_t *dsp, size_t *size);
-errno_t sb_dsp_test_format(sb_dsp_t *dsp, unsigned *channels, unsigned *rate,
-    pcm_sample_format_t *format);
-errno_t sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size);
-errno_t sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session);
-async_sess_t *sb_dsp_get_event_session(sb_dsp_t *dsp);
-errno_t sb_dsp_release_buffer(sb_dsp_t *dsp);
-errno_t sb_dsp_start_playback(sb_dsp_t *dsp, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
-errno_t sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate);
-errno_t sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format);
-errno_t sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/dsp_commands.h
===================================================================
--- uspace/drv/audio/sb16/dsp_commands.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,293 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief SB16 DSP Command constants
- */
-#ifndef DRV_AUDIO_SB16_DSP_COMMANDS_H
-#define DRV_AUDIO_SB16_DSP_COMMANDS_H
-
-/** See Sound Blaster Series HW programming Guide Chapter 6. */
-typedef enum dsp_command {
-	/*
-	 * Followed by unsigned byte of digital data,
-	 * software controls sampling rate
-	 */
-	DIRECT_8B_OUTPUT = 0x10,
-	/* Same as DIRECT_8B_OUTPUT but for input */
-	DIRECT_8B_INPUT = 0x20,
-
-	/*
-	 * Followed by time constant.
-	 * TC = 65536 - (256 000 000 /
-	 *   (channels * sampling rate))
-	 * Send only high byte
-	 */
-	TRANSFER_TIME_CONSTANT = 0x40,
-
-	/*
-	 * Followed by length.high and length.low
-	 * starts single-cycle DMA, length is -1
-	 */
-	SINGLE_DMA_8B_OUTPUT = 0x14,
-	/*
-	 * Same as SINGLE_DMA_8B_OUTPUT, but for
-	 * input
-	 */
-	SINGLE_DMA_8B_INPUT = 0x24,
-	/*
-	 * Starts single-cycle DMA using
-	 * Creative ADPSM 8->2 bit compressed
-	 * data, Followed by length.low
-	 * and length.high. Length is -1
-	 */
-	SINGLE_DMA_8B_ADPCM_2B_OUT = 0x16,
-	/*
-	 * Starts single-cycle DMA using
-	 * DPSM 8->2 bit compressed data
-	 * with reference byte.
-	 * Followed by length.low and
-	 * length.high. Length is -1
-	 */
-	SINGLE_DMA_8B_ADPCM_2B_OUT_REF = 0x17,
-	/*
-	 * Same as
-	 * SINGLE_DMA_8B_ADPCM_2B_OUT
-	 */
-	SINGLE_DMA_8B_ADPCM_4B_OUT = 0x74,
-	/*
-	 * Same as
-	 * SINGLE_DMA_8B_ADPCM_2B_OUT_REF
-	 */
-	SINGLE_DMA_8B_ADPCM_4B_OUT_REF = 0x75,
-	/*
-	 * Same as
-	 * SINGLE_DMA_8B_ADPCM_2B_OUT
-	 */
-	SINGLE_DMA_8B_ADPCM_3B_OUT = 0x76,
-	/*
-	 * Same as
-	 * SINGLE_DMA_8B_ADPCM_2B_OUT_REF
-	 */
-	SINGLE_DMA_8B_ADPCM_3B_OUT_REF = 0x77,
-	/*
-	 * Stop sending DMA request,
-	 * works for SINGLE and AUTO
-	 */
-	DMA_8B_PAUSE = 0xd0,
-	/* Resume transfers paused by DMA_8B_PAUSE */
-	DMA_8B_CONTINUE = 0xd4,
-
-	/*
-	 * Connect speaker via internal amplifier,
-	 * has no effect on 4.xx
-	 */
-	SPEAKER_ON = 0xd1,
-	/*
-	 * Disconnect output from the amplifier,
-	 * has no effect on 4.xx
-	 */
-	SPEAKER_OFF = 0xd3,
-
-	/* Read DSP for MIDI data */
-	MIDI_POLLING = 0x30,
-	/*
-	 * Start interrupt mode, interrupt will be
-	 * generated when there is in-bound data.
-	 * To exit send again
-	 */
-	MIDI_INTERRUPT = 0x31,
-	/* Followed by midi_data */
-	MIDI_OUTPUT = 0x38,
-
-	/*
-	 * Followed by duration.low, duration.high. Duration is -1
-	 * In the units of sampling period. Generates interrupt
-	 * at the end of period
-	 */
-	PAUSE = 0x80,
-	/* Read 2 bytes, major and minor number */
-	DSP_VERSION = 0xe1,
-
-	/*
-	 * Starts auto-init DMA mode using 8-bit
-	 * Interrupt after every block.
-	 * To terminate, switch to single or use
-	 * EXIT command
-	 */
-	AUTO_DMA_8B_OUTPUT = 0x1c,
-	/* Same as AUTO_DMA_8B_OUTPUT, but for input */
-	AUTO_DMA_8B_INPUT = 0x2c,
-	/*
-	 * Same as AUTO_DMA_8B_OUTPUT, but use
-	 * 8->2bit ADPCM audio format
-	 */
-	AUTO_DMA_8B_ADPCM_2B_REF = 0x1f,
-	/* Same as AUTO_DMA_8B_ADPCM_2B_REF */
-	AUTO_DMA_8B_ADPCM_4B_REF = 0x7d,
-	/* Same as AUTO_DMA_8B_ADPCM_2B_REF */
-	AUTO_DMA_8B_ADPCM_3B_REF = 0x7f,
-
-	/* Ends DMA transfer and terminates I/O process */
-	DMA_8B_EXIT = 0xda,
-
-	/*
-	 * Followed by size.low, size.high
-	 * Used with HIGH_SPEED AUTO_DMA
-	 */
-	BLOCK_TRANSFER_SIZE = 0x48,
-	/*
-	 * Start UART MIDI polling mode, read and
-	 * write from/to DSP is interpreted as
-	 * read/write from/to MIDI.
-	 * To exit use reset signal. Note that reset
-	 * will restore previous state and won't do
-	 * complete reset
-	 */
-	UART_MIDI_POLLING = 0x34,
-	/*
-	 * Same as UART_MIDI_POLLING, but use
-	 * interrupts instead of polling.
-	 */
-	UART_MIDI_INTERRUPT = 0x35,
-	/*
-	 * Add time stamp to inbound data, the
-	 * order is time.low time.mid time.high
-	 * data
-	 */
-	UART_MIDI_POLLING_TS = 0x36,
-	/*
-	 * Same as UART_MIDI_POLLING_TS, but use
-	 * interrupts instead of polling
-	 */
-	UART_MIDI_INTERRUPT_TS = 0x37,
-
-	/* 0xff means amp is on, 0x00 means it's off */
-	SPEAKER_STATUS = 0xd8,
-
-	/*
-	 * DSP will generate interrupt after
-	 * every block. No other commands are
-	 * accepted in this mode. To exit
-	 * the mode send RESET command.
-	 * Note that reset will restore
-	 * previous state.
-	 */
-	AUTO_DMA_8B_HIGH_OUTPUT = 0x90,
-	/* Same as AUTO_DMA_8B_HIGH_OUTPUT */
-	AUTO_DMA_8B_HIGH_INPUT = 0x98,
-	/*
-	 * Transfer one block and exit,
-	 * generates interrupt
-	 */
-	SINGLE_DMA_8B_HIGH_OUTPUT = 0x91,
-	/* Same as SINGLE_DMA_8B_HIGH_OUTPUT */
-	SINGLE_DMA_8B_HIGH_INPUT = 0x99,
-
-	/* Mono mode is the default, only on 3.xx */
-	SET_MONO_INPUT = 0xa0,
-	/* Switch to stereo recording, only on 3.xx */
-	SET_STEREO_INPUT = 0xa8,
-
-	/*
-	 * Followed by sapling rate
-	 * 5000 to 45000 Hz, inclusive
-	 */
-	SET_SAMPLING_RATE_OUTPUT = 0x41,
-	/* Same as SET_SAMPLING_RATE_OUTPUT */
-	SET_SAMPLING_RATE_INPUT = 0x42,
-
-	/*
-	 * Followed by mode, size.low, size.high
-	 * mode format is:
-	 *    0x00 - unsigned mono
-	 *    0x10 - signed mono
-	 *    0x20 - unsigned stereo
-	 *    0x30 - signed stereo
-	 * Size is -1. Terminate AUTO_DMA by EXIT
-	 * or switch to SINGLE_DMA
-	 */
-	SINGLE_DMA_16B_DA = 0xb0,
-	SINGLE_DMA_16B_DA_FIFO = 0xb2,
-	AUTO_DMA_16B_DA = 0xb4,
-	AUTO_DMA_16B_DA_FIFO = 0xb6,
-	SINGLE_DMA_16B_AD = 0xb8,
-	SINGLE_DMA_16B_AD_FIFO = 0xba,
-	AUTO_DMA_16B_AD = 0xbc,
-	AUTO_DMA_16B_AD_FIFO = 0xbe,
-
-	/*
-	 * Followed by mode, size.low, size.high
-	 * mode format is:
-	 *    0x00 - unsigned mono
-	 *    0x10 - signed mono
-	 *    0x20 - unsigned stereo
-	 *    0x30 - signed stereo
-	 * Size is -1. Terminate AUTO_DMA by EXIT
-	 * or switch to SINGLE_DMA
-	 */
-	SINGLE_DMA_8B_DA = 0xc0,
-	SINGLE_DMA_8B_DA_FIFO = 0xc2,
-	AUTO_DMA_8B_DA = 0xc4,
-	AUTO_DMA_8B_DA_FIFO = 0xc6,
-	SINGLE_DMA_8B_AD = 0xc8,
-	SINGLE_DMA_8B_AD_FIFO = 0xca,
-	AUTO_DMA_8B_AD = 0xcc,
-	AUTO_DMA_8B_AD_FIFO = 0xce,
-
-	/* Stop sending DMA request, both SINGLE and AUTO */
-	DMA_16B_PAUSE = 0xd5,
-	/* Resume requests paused by DMA_16B_PAUSE */
-	DMA_16B_CONTINUE = 0xd6,
-	/* Ends DMA transfer and terminates I/O process */
-	DMA_16B_EXIT = 0xd9,
-} dsp_command_t;
-
-#define DSP_MODE_SIGNED 0x10
-#define DSP_MODE_STEREO 0x20
-
-static inline const char *mode_to_str(uint8_t mode)
-{
-	if (mode & 0xcf)
-		return "unknown";
-	static const char *names[] = {
-		"unsigned mono (8bit)",
-		"signed mono (16bit)",
-		"unsigned stereo (8bit)",
-		"signed stereo (16bit)",
-	};
-	return names[mode >> 4];
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/main.c
===================================================================
--- uspace/drv/audio/sb16/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * Main routines of Creative Labs SoundBlaster 16 driver
- */
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-
-#include "ddf_log.h"
-#include "sb16.h"
-
-#define NAME "sb16"
-
-static errno_t sb_add_device(ddf_dev_t *device);
-static errno_t sb_dev_quiesce(ddf_dev_t *device);
-static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
-    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16);
-static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq);
-
-static driver_ops_t sb_driver_ops = {
-	.dev_add = sb_add_device,
-	.dev_quiesce = sb_dev_quiesce
-};
-
-static driver_t sb_driver = {
-	.name = NAME,
-	.driver_ops = &sb_driver_ops
-};
-
-/** Initialize global driver structures (NONE).
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS SB16 audio driver.\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&sb_driver);
-}
-
-/** SB16 IRQ handler.
- *
- * @param call IRQ event notification
- * @param arg Argument (sb16_t *)
- */
-static void irq_handler(ipc_call_t *call, void *arg)
-{
-	sb16_t *sb16_dev = (sb16_t *)arg;
-	sb16_interrupt(sb16_dev);
-}
-
-/** Initialize new SB16 driver instance.
- *
- * @param[in] device DDF instance of the device to initialize.
- * @return Error code.
- */
-static errno_t sb_add_device(ddf_dev_t *device)
-{
-	bool handler_regd = false;
-	const size_t irq_cmd_count = sb16_irq_code_size();
-	irq_cmd_t irq_cmds[irq_cmd_count];
-	irq_pio_range_t irq_ranges[1];
-	cap_irq_handle_t irq_cap;
-
-	sb16_t *soft_state = ddf_dev_data_alloc(device, sizeof(sb16_t));
-	errno_t rc = soft_state ? EOK : ENOMEM;
-	if (rc != EOK) {
-		ddf_log_error("Failed to allocate sb16 structure.");
-		goto error;
-	}
-
-	addr_range_t sb_regs;
-	addr_range_t *p_sb_regs = &sb_regs;
-	addr_range_t mpu_regs;
-	addr_range_t *p_mpu_regs = &mpu_regs;
-	int irq = 0, dma8 = 0, dma16 = 0;
-
-	rc = sb_get_res(device, &p_sb_regs, &p_mpu_regs, &irq, &dma8, &dma16);
-	if (rc != EOK) {
-		ddf_log_error("Failed to get resources: %s.", str_error(rc));
-		goto error;
-	}
-
-	sb16_irq_code(p_sb_regs, dma8, dma16, irq_cmds, irq_ranges);
-
-	irq_code_t irq_code = {
-		.cmdcount = irq_cmd_count,
-		.cmds = irq_cmds,
-		.rangecount = 1,
-		.ranges = irq_ranges
-	};
-
-	rc = register_interrupt_handler(device, irq, irq_handler,
-	    (void *)soft_state, &irq_code, &irq_cap);
-	if (rc != EOK) {
-		ddf_log_error("Failed to register irq handler: %s.",
-		    str_error(rc));
-		goto error;
-	}
-
-	handler_regd = true;
-
-	rc = sb_enable_interrupt(device, irq);
-	if (rc != EOK) {
-		ddf_log_error("Failed to enable interrupts: %s.",
-		    str_error(rc));
-		goto error;
-	}
-
-	rc = sb16_init_sb16(soft_state, p_sb_regs, device, dma8, dma16);
-	if (rc != EOK) {
-		ddf_log_error("Failed to init sb16 driver: %s.",
-		    str_error(rc));
-		goto error;
-	}
-
-	rc = sb16_init_mpu(soft_state, p_mpu_regs);
-	if (rc == EOK) {
-		ddf_fun_t *mpu_fun =
-		    ddf_fun_create(device, fun_exposed, "midi");
-		if (mpu_fun) {
-			rc = ddf_fun_bind(mpu_fun);
-			if (rc != EOK)
-				ddf_log_error(
-				    "Failed to bind midi function: %s.",
-				    str_error(rc));
-		} else {
-			ddf_log_error("Failed to create midi function.");
-		}
-	} else {
-		ddf_log_warning("Failed to init mpu driver: %s.",
-		    str_error(rc));
-	}
-
-	/* MPU state does not matter */
-	return EOK;
-error:
-	if (handler_regd)
-		unregister_interrupt_handler(device, irq_cap);
-	return rc;
-}
-
-/** Initialize new SB16 driver instance.
- *
- * @param[in] device DDF instance of the device to initialize.
- * @return Error code.
- */
-static errno_t sb_dev_quiesce(ddf_dev_t *device)
-{
-	sb16_t *soft_state = (sb16_t *)ddf_dev_data_get(device);
-
-	return sb16_quiesce(soft_state);
-}
-
-static errno_t sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs,
-    addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16)
-{
-	assert(device);
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_t hw_res;
-	hw_res_list_parsed_init(&hw_res);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (ret != EOK) {
-		return ret;
-	}
-
-	/* 1x IRQ, 1-2x DMA(8,16), 1-2x IO (MPU is separate). */
-	if (hw_res.irqs.count != 1 ||
-	    (hw_res.io_ranges.count != 1 && hw_res.io_ranges.count != 2) ||
-	    (hw_res.dma_channels.count != 1 && hw_res.dma_channels.count != 2)) {
-		hw_res_list_parsed_clean(&hw_res);
-		return EINVAL;
-	}
-
-	if (irq)
-		*irq = hw_res.irqs.irqs[0];
-
-	if (dma8) {
-		if (hw_res.dma_channels.channels[0] < 4) {
-			*dma8 = hw_res.dma_channels.channels[0];
-		} else {
-			if (hw_res.dma_channels.count == 2 &&
-			    hw_res.dma_channels.channels[1] < 4) {
-				*dma8 = hw_res.dma_channels.channels[1];
-			}
-		}
-	}
-
-	if (dma16) {
-		if (hw_res.dma_channels.channels[0] > 4) {
-			*dma16 = hw_res.dma_channels.channels[0];
-		} else {
-			if (hw_res.dma_channels.count == 2 &&
-			    hw_res.dma_channels.channels[1] > 4) {
-				*dma16 = hw_res.dma_channels.channels[1];
-			}
-		}
-	}
-
-	if (hw_res.io_ranges.count == 1) {
-		if (pp_sb_regs && *pp_sb_regs)
-			**pp_sb_regs = hw_res.io_ranges.ranges[0];
-		if (pp_mpu_regs)
-			*pp_mpu_regs = NULL;
-	} else {
-		const int sb =
-		    (hw_res.io_ranges.ranges[0].size >= sizeof(sb16_regs_t)) ?
-		    0 : 1;
-		const int mpu = 1 - sb;
-		if (pp_sb_regs && *pp_sb_regs)
-			**pp_sb_regs = hw_res.io_ranges.ranges[sb];
-		if (pp_mpu_regs && *pp_mpu_regs)
-			**pp_mpu_regs = hw_res.io_ranges.ranges[mpu];
-	}
-
-	return EOK;
-}
-
-static errno_t sb_enable_interrupt(ddf_dev_t *device, int irq)
-{
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(device);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	return hw_res_enable_interrupt(parent_sess, irq);
-}
-
-/**
- * @}
- */
Index: pace/drv/audio/sb16/meson.build
===================================================================
--- uspace/drv/audio/sb16/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'pcm' ]
-src = files(
-	'dsp.c',
-	'main.c',
-	'mixer.c',
-	'mixer_iface.c',
-	'pcm_iface.c',
-	'sb16.c',
-)
Index: pace/drv/audio/sb16/mixer.c
===================================================================
--- uspace/drv/audio/sb16/mixer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <libarch/ddi.h>
-#include <macros.h>
-
-#include "ddf_log.h"
-#include "mixer.h"
-
-typedef struct channel {
-	const char *name;
-	uint8_t address;
-	unsigned shift;
-	unsigned volume_levels;
-	bool preserve_bits;
-} channel_t;
-
-/* CT1335 channels */
-static const channel_t channels_table_ct1335[] = {
-	{ "Master", 0x02, 1, 8, false }, /* Master, Mono, 3bit volume level */
-	{ "Midi", 0x06, 1, 8, false }, /* Midi, Mono, 3bit volume level */
-	{ "CD", 0x08, 1, 8, false }, /* CD, Mono, 3bit volume level */
-	{ "Voice", 0x0a, 1, 4, false }, /* Voice, Mono, 2bit volume level */
-};
-
-/* CT1345 channels */
-static const channel_t channels_table_ct1345[] = {
-	{ "Master Left", 0x22, 5, 8, true }, /* Master, Left, 3bit volume level */
-	{ "Master Right", 0x22, 1, 8, true }, /* Master, Right, 3bit volume level */
-	{ "MIDI Left", 0x26, 5, 8, true }, /* Midi, Left, 3bit volume level */
-	{ "MIDI Right", 0x26, 1, 8, true }, /* Midi, Right, 3bit volume level */
-	{ "CD Left", 0x28, 5, 8, true }, /* CD, Left, 3bit volume level */
-	{ "CD Right", 0x28, 1, 8, true }, /* CD, Right, 3bit volume level */
-	{ "Line In Left", 0x2e, 5, 8, true }, /* Line, Left, 3bit volume level */
-	{ "Line In Right", 0x2e, 1, 8, true }, /* Line, Right, 3bit volume level */
-	{ "Voice Left", 0x04, 5, 8, true }, /* Voice, Left, 3bit volume level */
-	{ "Voice Right", 0x04, 1, 8, true }, /* Voice, Right, 3bit volume level */
-	{ "Mic", 0x0a, 1, 4, false }, /* Mic, Mono, 2bit volume level */
-};
-
-/* CT1745 channels */
-static const channel_t channels_table_ct1745[] = {
-	{ "Master Left", 0x30, 3, 32, false },  /* Master, Left, 5bit volume level */
-	{ "Master Right", 0x31, 3, 32, false }, /* Master, Right, 5bit volume level */
-	{ "Voice Left", 0x32, 3, 32, false },  /* Voice, Left, 5bit volume level */
-	{ "Voice Right", 0x33, 3, 32, false }, /* Voice, Right, 5bit volume level */
-	{ "MIDI Left", 0x34, 3, 32, false }, /* MIDI, Left, 5bit volume level */
-	{ "MIDI Right", 0x35, 3, 32, false }, /* MIDI, Right, 5bit volume level */
-	{ "CD Left", 0x36, 3, 32, false }, /* CD, Left, 5bit volume level */
-	{ "CD Right", 0x37, 3, 32, false }, /* CD, Right, 5bit volume level */
-	{ "Line In Left", 0x38, 3, 32, false }, /* Line, Left, 5bit volume level */
-	{ "Line In Right", 0x39, 3, 32, false }, /* Line, Right, 5bit volume level */
-	{ "Mic", 0x3a, 3, 32, false }, /* Mic, Mono, 5bit volume level */
-	{ "PC Speaker", 0x3b, 6, 4, false }, /* PC speaker, Mono, 2bit level */
-	{ "Input Gain Left", 0x3f, 6, 4, false }, /* Input Gain, Left, 2bit level */
-	{ "Input Gain Right", 0x40, 6, 4, false }, /* Input Gain, Right, 2bit level */
-	{ "Output Gain Left", 0x41, 6, 4, false }, /* Output Gain, Left, 2bit level */
-	{ "Output Gain Right", 0x42, 6, 4, false }, /* Output Gain, Right, 2bit level */
-	{ "Treble Left", 0x44, 4, 16, false }, /* Treble, Left, 4bit volume level */
-	{ "Treble Right", 0x45, 4, 16, false }, /* Treble, Right, 4bit volume level */
-	{ "Bass Left", 0x46, 4, 16, false }, /* Bass, Left, 4bit volume level */
-	{ "Bass Right", 0x47, 4, 16, false }, /* Bass, Right, 4bit volume level */
-};
-
-static const struct {
-	const channel_t *table;
-	size_t count;
-} volume_table[] = {
-	[SB_MIXER_NONE] = { NULL, 0 },
-	[SB_MIXER_UNKNOWN] = { NULL, 0 },
-	[SB_MIXER_CT1335] = {
-		channels_table_ct1335,
-		ARRAY_SIZE(channels_table_ct1335),
-	},
-	[SB_MIXER_CT1345] = {
-		channels_table_ct1345,
-		ARRAY_SIZE(channels_table_ct1345),
-	},
-	[SB_MIXER_CT1745] = {
-		channels_table_ct1745,
-		ARRAY_SIZE(channels_table_ct1745),
-	},
-};
-
-const char *sb_mixer_type_str(sb_mixer_type_t type)
-{
-	static const char *names[] = {
-		[SB_MIXER_NONE] = "No mixer",
-		[SB_MIXER_CT1335] = "CT 1335",
-		[SB_MIXER_CT1345] = "CT 1345",
-		[SB_MIXER_CT1745] = "CT 1745",
-		[SB_MIXER_UNKNOWN] = "Unknown mixer",
-	};
-	return names[type];
-}
-
-errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type)
-{
-	assert(mixer);
-	mixer->regs = regs;
-	mixer->type = type;
-	if (type == SB_MIXER_UNKNOWN)
-		return ENOTSUP;
-
-	if (type != SB_MIXER_NONE) {
-		pio_write_8(&regs->mixer_address, MIXER_RESET_ADDRESS);
-		pio_write_8(&regs->mixer_data, 1);
-	}
-	pio_write_8(&regs->mixer_address, MIXER_PNP_IRQ_ADDRESS);
-	const uint8_t irq = pio_read_8(&regs->mixer_data);
-	pio_write_8(&regs->mixer_address, MIXER_PNP_DMA_ADDRESS);
-	const uint8_t dma = pio_read_8(&regs->mixer_data);
-	ddf_log_debug("SB16 setup with IRQ 0x%hhx and DMA 0x%hhx.", irq, dma);
-	return EOK;
-}
-
-int sb_mixer_get_control_item_count(const sb_mixer_t *mixer)
-{
-	assert(mixer);
-	return volume_table[mixer->type].count;
-}
-
-errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned item,
-    const char **name, unsigned *levels)
-{
-	assert(mixer);
-	if (item > volume_table[mixer->type].count)
-		return ENOENT;
-
-	const channel_t *ch = &volume_table[mixer->type].table[item];
-	if (name)
-		*name = ch->name;
-	if (levels)
-		*levels = ch->volume_levels;
-	return EOK;
-}
-
-/**
- * Write new volume level from mixer registers.
- * @param mixer SB Mixer to use.
- * @param index Control item(channel) index.
- * @param value New volume level.
- * @return Error code.
- */
-errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned item,
-    unsigned *value)
-{
-	assert(mixer);
-	if (!value)
-		return EBADMEM;
-	if (item > volume_table[mixer->type].count)
-		return ENOENT;
-
-	const channel_t *chan = &volume_table[mixer->type].table[item];
-	pio_write_8(&mixer->regs->mixer_address, chan->address);
-	*value = (pio_read_8(&mixer->regs->mixer_data) >> chan->shift) &
-	    (chan->volume_levels - 1);
-	return EOK;
-}
-
-/**
- * Write new volume level to mixer registers.
- * @param mixer SB Mixer to use.
- * @param index Control item(channel) index.
- * @param value New volume level.
- * @return Error code.
- */
-errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned item,
-    unsigned value)
-{
-	assert(mixer);
-	if (item > volume_table[mixer->type].count)
-		return ENOENT;
-
-	const channel_t *chan = &volume_table[mixer->type].table[item];
-	if (value >= chan->volume_levels)
-		value = chan->volume_levels - 1;
-
-	pio_write_8(&mixer->regs->mixer_address, chan->address);
-
-	uint8_t regv = 0;
-	if (chan->preserve_bits) {
-		regv = pio_read_8(&mixer->regs->mixer_data);
-		regv &= ~(uint8_t)((chan->volume_levels - 1) << chan->shift);
-	}
-
-	regv |= value << chan->shift;
-	pio_write_8(&mixer->regs->mixer_data, regv);
-	ddf_log_note("Item %s new value is: %u.",
-	    volume_table[mixer->type].table[item].name, value);
-	return EOK;
-}
Index: pace/drv/audio/sb16/mixer.h
===================================================================
--- uspace/drv/audio/sb16/mixer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief SB16 main structure combining all functionality
- */
-#ifndef DRV_AUDIO_SB16_MIXER_H
-#define DRV_AUDIO_SB16_MIXER_H
-
-#include "registers.h"
-
-typedef enum mixer_type {
-	SB_MIXER_NONE,
-	SB_MIXER_CT1335,
-	SB_MIXER_CT1345,
-	SB_MIXER_CT1745,
-	SB_MIXER_UNKNOWN,
-} sb_mixer_type_t;
-
-typedef struct sb_mixer {
-	sb16_regs_t *regs;
-	sb_mixer_type_t type;
-} sb_mixer_t;
-
-const char *sb_mixer_type_str(sb_mixer_type_t type);
-errno_t sb_mixer_init(sb_mixer_t *mixer, sb16_regs_t *regs, sb_mixer_type_t type);
-int sb_mixer_get_control_item_count(const sb_mixer_t *mixer);
-errno_t sb_mixer_get_control_item_info(const sb_mixer_t *mixer, unsigned index,
-    const char **name, unsigned *levels);
-errno_t sb_mixer_get_control_item_value(const sb_mixer_t *mixer, unsigned index,
-    unsigned *value);
-errno_t sb_mixer_set_control_item_value(const sb_mixer_t *mixer, unsigned index,
-    unsigned value);
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/mixer_iface.c
===================================================================
--- uspace/drv/audio/sb16/mixer_iface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * Main routines of Creative Labs SoundBlaster 16 driver
- */
-
-#include <ddf/driver.h>
-#include <errno.h>
-#include <audio_mixer_iface.h>
-
-#include "mixer.h"
-#include "sb16.h"
-
-static sb_mixer_t *fun_to_mixer(ddf_fun_t *fun)
-{
-	sb16_t *sb = (sb16_t *)ddf_dev_data_get(ddf_fun_get_dev(fun));
-	return &sb->mixer;
-}
-
-static errno_t sb_get_info(ddf_fun_t *fun, const char **name, unsigned *items)
-{
-	sb_mixer_t *mixer = fun_to_mixer(fun);
-
-	if (name)
-		*name = sb_mixer_type_str(mixer->type);
-	if (items)
-		*items = sb_mixer_get_control_item_count(mixer);
-
-	return EOK;
-}
-
-static errno_t sb_get_item_info(ddf_fun_t *fun, unsigned item, const char **name,
-    unsigned *max_level)
-{
-	sb_mixer_t *mixer = fun_to_mixer(fun);
-	return sb_mixer_get_control_item_info(mixer, item, name, max_level);
-}
-
-static errno_t sb_set_item_level(ddf_fun_t *fun, unsigned item, unsigned value)
-{
-	sb_mixer_t *mixer = fun_to_mixer(fun);
-	return sb_mixer_set_control_item_value(mixer, item, value);
-}
-
-static errno_t sb_get_item_level(ddf_fun_t *fun, unsigned item, unsigned *value)
-{
-	sb_mixer_t *mixer = fun_to_mixer(fun);
-	return sb_mixer_get_control_item_value(mixer, item, value);
-}
-
-audio_mixer_iface_t sb_mixer_iface = {
-	.get_info = sb_get_info,
-	.get_item_info = sb_get_item_info,
-
-	.get_item_level = sb_get_item_level,
-	.set_item_level = sb_set_item_level,
-};
-/**
- * @}
- */
Index: pace/drv/audio/sb16/pcm_iface.c
===================================================================
--- uspace/drv/audio/sb16/pcm_iface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * Main routines of Creative Labs SoundBlaster 16 driver
- */
-
-#include <async.h>
-#include <errno.h>
-#include <audio_pcm_iface.h>
-#include <pcm/sample_format.h>
-
-#include "dsp.h"
-#include "sb16.h"
-
-static inline sb_dsp_t *fun_to_dsp(ddf_fun_t *fun)
-{
-	sb16_t *sb = (sb16_t *)ddf_dev_data_get(ddf_fun_get_dev(fun));
-	return &sb->dsp;
-}
-
-static errno_t sb_get_info_str(ddf_fun_t *fun, const char **name)
-{
-	if (name)
-		*name = "SB 16 DSP";
-	return EOK;
-}
-
-static unsigned sb_query_cap(ddf_fun_t *fun, audio_cap_t cap)
-{
-	return sb_dsp_query_cap(fun_to_dsp(fun), cap);
-}
-
-static errno_t sb_test_format(ddf_fun_t *fun, unsigned *channels, unsigned *rate,
-    pcm_sample_format_t *format)
-{
-	return sb_dsp_test_format(fun_to_dsp(fun), channels, rate, format);
-}
-static errno_t sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)
-{
-	return sb_dsp_get_buffer(fun_to_dsp(fun), buffer, size);
-}
-
-static errno_t sb_get_buffer_position(ddf_fun_t *fun, size_t *size)
-{
-	return sb_dsp_get_buffer_position(fun_to_dsp(fun), size);
-}
-
-static errno_t sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess)
-{
-	return sb_dsp_set_event_session(fun_to_dsp(fun), sess);
-}
-
-static async_sess_t *sb_get_event_session(ddf_fun_t *fun)
-{
-	return sb_dsp_get_event_session(fun_to_dsp(fun));
-}
-
-static errno_t sb_release_buffer(ddf_fun_t *fun)
-{
-	return sb_dsp_release_buffer(fun_to_dsp(fun));
-}
-
-static errno_t sb_start_playback(ddf_fun_t *fun, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	return sb_dsp_start_playback(
-	    fun_to_dsp(fun), frames, channels, sample_rate, format);
-}
-
-static errno_t sb_stop_playback(ddf_fun_t *fun, bool immediate)
-{
-	return sb_dsp_stop_playback(fun_to_dsp(fun), immediate);
-}
-
-static errno_t sb_start_capture(ddf_fun_t *fun, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	return sb_dsp_start_capture(
-	    fun_to_dsp(fun), frames, channels, sample_rate, format);
-}
-
-static errno_t sb_stop_capture(ddf_fun_t *fun, bool immediate)
-{
-	return sb_dsp_stop_capture(fun_to_dsp(fun), immediate);
-}
-
-audio_pcm_iface_t sb_pcm_iface = {
-	.get_info_str = sb_get_info_str,
-	.test_format = sb_test_format,
-	.query_cap = sb_query_cap,
-
-	.get_buffer = sb_get_buffer,
-	.release_buffer = sb_release_buffer,
-	.set_event_session = sb_set_event_session,
-	.get_event_session = sb_get_event_session,
-	.get_buffer_pos = sb_get_buffer_position,
-
-	.start_playback = sb_start_playback,
-	.stop_playback = sb_stop_playback,
-
-	.start_capture = sb_start_capture,
-	.stop_capture = sb_stop_capture,
-};
-/**
- * @}
- */
Index: pace/drv/audio/sb16/registers.h
===================================================================
--- uspace/drv/audio/sb16/registers.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief SB16 main structure combining all functionality
- */
-#ifndef DRV_AUDIO_SB16_REGISTERS_H
-#define DRV_AUDIO_SB16_REGISTERS_H
-
-#include <ddi.h>
-
-typedef struct sb16_regs {
-	ioport8_t fm_address_status;
-	ioport8_t fm_data;
-	ioport8_t afm_address_status;
-	ioport8_t afm_data;
-	ioport8_t mixer_address;
-#define MIXER_RESET_ADDRESS 0x00
-#define MIXER_PNP_IRQ_ADDRESS 0x80
-#define MIXER_PNP_DMA_ADDRESS 0x81
-#define MIXER_IRQ_STATUS_ADDRESS 0x82 /* The Interrupt Status register,
-                                       * addressed as register 82h on the
-                                       * Mixer register map p.27 */
-	ioport8_t mixer_data;
-	ioport8_t dsp_reset;
-	ioport8_t __reserved1; /* 0x7 */
-	ioport8_t fm_address_status2;
-	ioport8_t fm_data2;
-	ioport8_t dsp_data_read;
-	ioport8_t __reserved2; /* 0xb */
-	ioport8_t dsp_write; /* Both command and data, bit 7 is write status */
-#define DSP_WRITE_BUSY (1 << 7)
-	ioport8_t __reserved3; /* 0xd */
-	ioport8_t dsp_read_status; /* Bit 7 */
-#define DSP_READ_READY (1 << 7)
-	ioport8_t dma16_ack; /* 0xf */
-	ioport8_t cd_command_data;
-	ioport8_t cd_status;
-	ioport8_t cd_reset;
-	ioport8_t cd_enable;
-} sb16_regs_t;
-
-typedef struct mpu_regs {
-	ioport8_t data;
-#define MPU_CMD_ACK (0xfe)
-
-	ioport8_t status_command;
-#define MPU_STATUS_OUTPUT_BUSY (1 << 6)
-#define MPU_STATUS_INPUT_BUSY (1 << 7)
-
-#define MPU_CMD_RESET (0xff)
-#define MPU_CMD_ENTER_UART (0x3f)
-} mpu_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/sb16.c
===================================================================
--- uspace/drv/audio/sb16/sb16.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,219 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <macros.h>
-#include <audio_mixer_iface.h>
-#include <audio_pcm_iface.h>
-
-#include "ddf_log.h"
-#include "dsp_commands.h"
-#include "dsp.h"
-#include "sb16.h"
-
-extern audio_mixer_iface_t sb_mixer_iface;
-extern audio_pcm_iface_t sb_pcm_iface;
-
-static ddf_dev_ops_t sb_mixer_ops = {
-	.interfaces[AUDIO_MIXER_IFACE] = &sb_mixer_iface,
-};
-
-static ddf_dev_ops_t sb_pcm_ops = {
-	.interfaces[AUDIO_PCM_BUFFER_IFACE] = &sb_pcm_iface,
-};
-
-/*
- * ISA interrupts should be edge-triggered so there should be no need for
- * irq code magic, but we still need to ack those interrupts ASAP.
- */
-static const irq_cmd_t irq_cmds[] = {
-	{ .cmd = CMD_PIO_READ_8, .dstarg = 1 }, /* Address patched at runtime */
-	{ .cmd = CMD_PIO_READ_8, .dstarg = 1 }, /* Address patched at runtime */
-	{ .cmd = CMD_ACCEPT },
-};
-
-static inline sb_mixer_type_t sb_mixer_type_by_dsp_version(
-    unsigned major, unsigned minor)
-{
-	switch (major) {
-	case 1:
-		return SB_MIXER_NONE; /* SB 1.5 and early 2.0 = no mixer chip */
-	case 2:
-		return (minor == 0) ? SB_MIXER_NONE : SB_MIXER_CT1335;
-	case 3:
-		return SB_MIXER_CT1345; /* SB Pro */
-	case 4:
-		return SB_MIXER_CT1745; /* SB 16  */
-	default:
-		return SB_MIXER_UNKNOWN;
-	}
-}
-
-size_t sb16_irq_code_size(void)
-{
-	return ARRAY_SIZE(irq_cmds);
-}
-
-void sb16_irq_code(addr_range_t *regs, int dma8, int dma16, irq_cmd_t cmds[],
-    irq_pio_range_t ranges[])
-{
-	assert(regs);
-	assert(dma8 > 0 && dma8 < 4);
-
-	sb16_regs_t *registers = RNGABSPTR(*regs);
-	memcpy(cmds, irq_cmds, sizeof(irq_cmds));
-	cmds[0].addr = (void *) &registers->dsp_read_status;
-	ranges[0].base = (uintptr_t) registers;
-	ranges[0].size = sizeof(*registers);
-	if (dma16 > 4 && dma16 < 8) {
-		/* Valid dma16 */
-		cmds[1].addr = (void *) &registers->dma16_ack;
-	} else {
-		cmds[1].cmd = CMD_ACCEPT;
-	}
-}
-
-errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8,
-    int dma16)
-{
-	assert(sb);
-
-	/* Setup registers */
-	errno_t ret = pio_enable_range(regs, (void **) &sb->regs);
-	if (ret != EOK)
-		return ret;
-	ddf_log_note("PIO registers at %p accessible.", sb->regs);
-
-	/* Initialize DSP */
-	ddf_fun_t *dsp_fun = ddf_fun_create(dev, fun_exposed, "pcm");
-	if (!dsp_fun) {
-		ddf_log_error("Failed to create dsp function.");
-		return ENOMEM;
-	}
-
-	ret = sb_dsp_init(&sb->dsp, sb->regs, dev, dma8, dma16);
-	if (ret != EOK) {
-		ddf_log_error("Failed to initialize SB DSP: %s.",
-		    str_error(ret));
-		ddf_fun_destroy(dsp_fun);
-		return ret;
-	}
-
-	ddf_fun_set_ops(dsp_fun, &sb_pcm_ops);
-	ddf_log_note("Sound blaster DSP (%x.%x) initialized.",
-	    sb->dsp.version.major, sb->dsp.version.minor);
-
-	ret = ddf_fun_bind(dsp_fun);
-	if (ret != EOK) {
-		ddf_log_error(
-		    "Failed to bind PCM function: %s.", str_error(ret));
-		ddf_fun_destroy(dsp_fun);
-		return ret;
-	}
-
-	ret = ddf_fun_add_to_category(dsp_fun, "audio-pcm");
-	if (ret != EOK) {
-		ddf_log_error("Failed register PCM function in category: %s.",
-		    str_error(ret));
-		ddf_fun_unbind(dsp_fun);
-		ddf_fun_destroy(dsp_fun);
-		return ret;
-	}
-
-	/* Initialize mixer */
-	const sb_mixer_type_t mixer_type = sb_mixer_type_by_dsp_version(
-	    sb->dsp.version.major, sb->dsp.version.minor);
-
-	ddf_fun_t *mixer_fun = ddf_fun_create(dev, fun_exposed, "control");
-	if (!mixer_fun) {
-		ddf_log_error("Failed to create mixer function.");
-		ddf_fun_unbind(dsp_fun);
-		ddf_fun_destroy(dsp_fun);
-		return ENOMEM;
-	}
-	ret = sb_mixer_init(&sb->mixer, sb->regs, mixer_type);
-	if (ret != EOK) {
-		ddf_log_error("Failed to initialize SB mixer: %s.",
-		    str_error(ret));
-		ddf_fun_unbind(dsp_fun);
-		ddf_fun_destroy(dsp_fun);
-		ddf_fun_destroy(mixer_fun);
-		return ret;
-	}
-
-	ddf_log_note("Initialized mixer: %s.",
-	    sb_mixer_type_str(sb->mixer.type));
-	ddf_fun_set_ops(mixer_fun, &sb_mixer_ops);
-
-	ret = ddf_fun_bind(mixer_fun);
-	if (ret != EOK) {
-		ddf_log_error(
-		    "Failed to bind mixer function: %s.", str_error(ret));
-		ddf_fun_destroy(mixer_fun);
-		ddf_fun_unbind(dsp_fun);
-		ddf_fun_destroy(dsp_fun);
-		return ret;
-	}
-
-	return EOK;
-}
-
-errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs)
-{
-	sb->mpu_regs = NULL;
-	return ENOTSUP;
-}
-
-errno_t sb16_quiesce(sb16_t *sb)
-{
-	sb_dsp_quiesce(&sb->dsp);
-	return EOK;
-}
-
-void sb16_interrupt(sb16_t *sb)
-{
-	assert(sb);
-	/*
-	 * The acknowledgment of interrupts on DSP version 4.xx is different;
-	 * It can contain MPU-401 indicator and DMA16 transfers are acked
-	 * differently
-	 */
-	if (sb->dsp.version.major >= 4) {
-		pio_write_8(&sb->regs->mixer_address, MIXER_IRQ_STATUS_ADDRESS);
-		const uint8_t irq_mask = pio_read_8(&sb->regs->mixer_data);
-		/* Third bit is MPU-401 interrupt */
-		if (irq_mask & 0x4) {
-			return;
-		}
-	} else {
-		ddf_log_debug("SB16 interrupt.");
-	}
-	sb_dsp_interrupt(&sb->dsp);
-}
Index: pace/drv/audio/sb16/sb16.h
===================================================================
--- uspace/drv/audio/sb16/sb16.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvaudiosb16
- * @{
- */
-/** @file
- * @brief SB16 main structure combining all functionality
- */
-#ifndef DRV_AUDIO_SB16_SB16_H
-#define DRV_AUDIO_SB16_SB16_H
-
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <device/hw_res_parsed.h>
-
-#include "dsp.h"
-#include "mixer.h"
-#include "registers.h"
-
-typedef struct sb16 {
-	sb16_regs_t *regs;
-	mpu_regs_t *mpu_regs;
-	sb_dsp_t dsp;
-	sb_mixer_t mixer;
-} sb16_t;
-
-size_t sb16_irq_code_size(void);
-void sb16_irq_code(addr_range_t *regs, int dma8, int dma16, irq_cmd_t cmds[], irq_pio_range_t ranges[]);
-errno_t sb16_init_sb16(sb16_t *sb, addr_range_t *regs, ddf_dev_t *dev, int dma8, int dma16);
-errno_t sb16_init_mpu(sb16_t *sb, addr_range_t *regs);
-errno_t sb16_quiesce(sb16_t *sb);
-void sb16_interrupt(sb16_t *sb);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/audio/sb16/sb16.ma
===================================================================
--- uspace/drv/audio/sb16/sb16.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 isa/sb16
Index: pace/drv/block/ahci/ahci.c
===================================================================
--- uspace/drv/block/ahci/ahci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1319 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * AHCI SATA driver implementation.
- */
-
-#include <as.h>
-#include <errno.h>
-#include <stdio.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <pci_dev_iface.h>
-#include <ahci_iface.h>
-#include "ahci.h"
-#include "ahci_hw.h"
-#include "ahci_sata.h"
-
-#define NAME  "ahci"
-
-#define LO(ptr) \
-	((uint32_t) (((uint64_t) ((uintptr_t) (ptr))) & 0xffffffff))
-
-#define HI(ptr) \
-	((uint32_t) (((uint64_t) ((uintptr_t) (ptr))) >> 32))
-
-/** Interrupt pseudocode for a single port
- *
- * The interrupt handling works as follows:
- *
- * 1. Port interrupt status register is read
- *    (stored as arg2).
- * 2. If port interrupt is indicated, then:
- *    3. Port interrupt status register is cleared.
- *    4. Global interrupt status register is read
- *       and cleared (any potential interrupts from
- *       other ports are reasserted automatically).
- *    5. Port number is stored as arg1.
- *    6. The interrupt is accepted.
- *
- */
-#define AHCI_PORT_CMDS(port) \
-	{ \
-		/* Read port interrupt status register */ \
-		.cmd = CMD_PIO_READ_32, \
-		.addr = NULL, \
-		.dstarg = 2 \
-	}, \
-	{ \
-		/* Check if port asserted interrupt */ \
-		.cmd = CMD_PREDICATE, \
-		.value = 5, \
-		.srcarg = 2, \
-	}, \
-	{ \
-		/* Clear port interrupt status register */ \
-		.cmd = CMD_PIO_WRITE_A_32, \
-		.addr = NULL, \
-		.srcarg = 2 \
-	}, \
-	{ \
-		/* Read global interrupt status register */ \
-		.cmd = CMD_PIO_READ_32, \
-		.addr = NULL, \
-		.dstarg = 0 \
-	}, \
-	{ \
-		/* Clear global interrupt status register */ \
-		.cmd = CMD_PIO_WRITE_A_32, \
-		.addr = NULL, \
-		.srcarg = 0 \
-	}, \
-	{ \
-		/* Indicate port interrupt assertion */ \
-		.cmd = CMD_LOAD, \
-		.value = (port), \
-		.dstarg = 1 \
-	}, \
-	{ \
-		/* Accept the interrupt */ \
-		.cmd = CMD_ACCEPT \
-	}
-
-static errno_t get_sata_device_name(ddf_fun_t *, size_t, char *);
-static errno_t get_num_blocks(ddf_fun_t *, uint64_t *);
-static errno_t get_block_size(ddf_fun_t *, size_t *);
-static errno_t read_blocks(ddf_fun_t *, uint64_t, size_t, void *);
-static errno_t write_blocks(ddf_fun_t *, uint64_t, size_t, void *);
-
-static errno_t ahci_identify_device(sata_dev_t *);
-static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *);
-static errno_t ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
-static errno_t ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
-
-static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *);
-static ahci_dev_t *ahci_ahci_create(ddf_dev_t *);
-static void ahci_ahci_hw_start(ahci_dev_t *);
-
-static errno_t ahci_dev_add(ddf_dev_t *);
-
-static void ahci_get_model_name(uint16_t *, char *);
-
-static fibril_mutex_t sata_devices_count_lock;
-static int sata_devices_count = 0;
-
-/*
- * AHCI Interface
- */
-
-static ahci_iface_t ahci_interface = {
-	.get_sata_device_name = &get_sata_device_name,
-	.get_num_blocks = &get_num_blocks,
-	.get_block_size = &get_block_size,
-	.read_blocks = &read_blocks,
-	.write_blocks = &write_blocks
-};
-
-static ddf_dev_ops_t ahci_ops = {
-	.interfaces[AHCI_DEV_IFACE] = &ahci_interface
-};
-
-static driver_ops_t driver_ops = {
-	.dev_add = &ahci_dev_add
-};
-
-static driver_t ahci_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-/** Get SATA structure from DDF function. */
-static sata_dev_t *fun_sata_dev(ddf_fun_t *fun)
-{
-	return ddf_fun_data_get(fun);
-}
-
-/** Get SATA device name.
- *
- * @param fun                  Device function handling the call.
- * @param sata_dev_name_length Length of the sata_dev_name buffer.
- * @param sata_dev_name        Buffer for SATA device name.
- *
- * @return EOK.
- *
- */
-static errno_t get_sata_device_name(ddf_fun_t *fun,
-    size_t sata_dev_name_length, char *sata_dev_name)
-{
-	sata_dev_t *sata = fun_sata_dev(fun);
-	str_cpy(sata_dev_name, sata_dev_name_length, sata->model);
-	return EOK;
-}
-
-/** Get Number of blocks in SATA device.
- *
- * @param fun    Device function handling the call.
- * @param blocks Return number of blocks in SATA device.
- *
- * @return EOK.
- *
- */
-static errno_t get_num_blocks(ddf_fun_t *fun, uint64_t *num_blocks)
-{
-	sata_dev_t *sata = fun_sata_dev(fun);
-	*num_blocks = sata->blocks;
-	return EOK;
-}
-
-/** Get SATA device block size.
- *
- * @param fun        Device function handling the call.
- * @param block_size Return block size.
- *
- * @return EOK.
- *
- */
-static errno_t get_block_size(ddf_fun_t *fun, size_t *block_size)
-{
-	sata_dev_t *sata = fun_sata_dev(fun);
-	*block_size = sata->block_size;
-	return EOK;
-}
-
-/** Read data blocks into SATA device.
- *
- * @param fun      Device function handling the call.
- * @param blocknum Number of first block.
- * @param count    Number of blocks to read.
- * @param buf      Buffer for data.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t read_blocks(ddf_fun_t *fun, uint64_t blocknum,
-    size_t count, void *buf)
-{
-	sata_dev_t *sata = fun_sata_dev(fun);
-
-	uintptr_t phys;
-	void *ibuf = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot allocate read buffer.");
-		return rc;
-	}
-
-	memset(buf, 0, sata->block_size);
-
-	fibril_mutex_lock(&sata->lock);
-
-	for (size_t cur = 0; cur < count; cur++) {
-		rc = ahci_rb_fpdma(sata, phys, blocknum + cur);
-		if (rc != EOK)
-			break;
-
-		memcpy((void *) (((uint8_t *) buf) + (sata->block_size * cur)),
-		    ibuf, sata->block_size);
-	}
-
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(ibuf);
-
-	return rc;
-}
-
-/** Write data blocks into SATA device.
- *
- * @param fun      Device function handling the call.
- * @param blocknum Number of first block.
- * @param count    Number of blocks to write.
- * @param buf      Buffer with data.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t write_blocks(ddf_fun_t *fun, uint64_t blocknum,
-    size_t count, void *buf)
-{
-	sata_dev_t *sata = fun_sata_dev(fun);
-
-	uintptr_t phys;
-	void *ibuf = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot allocate write buffer.");
-		return rc;
-	}
-
-	fibril_mutex_lock(&sata->lock);
-
-	for (size_t cur = 0; cur < count; cur++) {
-		memcpy(ibuf, (void *) (((uint8_t *) buf) + (sata->block_size * cur)),
-		    sata->block_size);
-		rc = ahci_wb_fpdma(sata, phys, blocknum + cur);
-		if (rc != EOK)
-			break;
-	}
-
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(ibuf);
-
-	return rc;
-}
-
-/*
- * AHCI Commands
- */
-
-/** Wait for interrupt event.
- *
- * @param sata SATA device structure.
- *
- * @return Value of interrupt state register.
- *
- */
-static ahci_port_is_t ahci_wait_event(sata_dev_t *sata)
-{
-	fibril_mutex_lock(&sata->event_lock);
-
-	sata->event_pxis = 0;
-	while (sata->event_pxis == 0)
-		fibril_condvar_wait(&sata->event_condvar, &sata->event_lock);
-
-	ahci_port_is_t pxis = sata->event_pxis;
-
-	if (ahci_port_is_permanent_error(pxis))
-		sata->is_invalid_device = true;
-
-	fibril_mutex_unlock(&sata->event_lock);
-
-	return pxis;
-}
-
-/** Set AHCI registers for identifying SATA device.
- *
- * @param sata SATA device structure.
- * @param phys Physical address of working buffer.
- *
- */
-static void ahci_identify_device_cmd(sata_dev_t *sata, uintptr_t phys)
-{
-	volatile sata_std_command_frame_t *cmd =
-	    (sata_std_command_frame_t *) sata->cmd_table;
-
-	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
-	cmd->command = 0xec;
-	cmd->features = 0;
-	cmd->lba_lower = 0;
-	cmd->device = 0;
-	cmd->lba_upper = 0;
-	cmd->features_upper = 0;
-	cmd->count = 0;
-	cmd->reserved1 = 0;
-	cmd->control = 0;
-	cmd->reserved2 = 0;
-
-	volatile ahci_cmd_prdt_t *prdt =
-	    (ahci_cmd_prdt_t *) (&sata->cmd_table[0x20]);
-
-	prdt->data_address_low = LO(phys);
-	prdt->data_address_upper = HI(phys);
-	prdt->reserved1 = 0;
-	prdt->dbc = SATA_IDENTIFY_DEVICE_BUFFER_LENGTH - 1;
-	prdt->reserved2 = 0;
-	prdt->ioc = 0;
-
-	sata->cmd_header->prdtl = 1;
-	sata->cmd_header->flags =
-	    AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK |
-	    AHCI_CMDHDR_FLAGS_2DWCMD;
-	sata->cmd_header->bytesprocessed = 0;
-
-	/* Run command. */
-	sata->port->pxsact |= 1;
-	sata->port->pxci |= 1;
-}
-
-/** Set AHCI registers for identifying packet SATA device.
- *
- * @param sata SATA device structure.
- * @param phys Physical address of working buffer.
- *
- */
-static void ahci_identify_packet_device_cmd(sata_dev_t *sata, uintptr_t phys)
-{
-	volatile sata_std_command_frame_t *cmd =
-	    (sata_std_command_frame_t *) sata->cmd_table;
-
-	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
-	cmd->command = 0xa1;
-	cmd->features = 0;
-	cmd->lba_lower = 0;
-	cmd->device = 0;
-	cmd->lba_upper = 0;
-	cmd->features_upper = 0;
-	cmd->count = 0;
-	cmd->reserved1 = 0;
-	cmd->control = 0;
-	cmd->reserved2 = 0;
-
-	volatile ahci_cmd_prdt_t *prdt =
-	    (ahci_cmd_prdt_t *) (&sata->cmd_table[0x20]);
-
-	prdt->data_address_low = LO(phys);
-	prdt->data_address_upper = HI(phys);
-	prdt->reserved1 = 0;
-	prdt->dbc = SATA_IDENTIFY_DEVICE_BUFFER_LENGTH - 1;
-	prdt->reserved2 = 0;
-	prdt->ioc = 0;
-
-	sata->cmd_header->prdtl = 1;
-	sata->cmd_header->flags =
-	    AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK |
-	    AHCI_CMDHDR_FLAGS_2DWCMD;
-	sata->cmd_header->bytesprocessed = 0;
-
-	/* Run command. */
-	sata->port->pxsact |= 1;
-	sata->port->pxci |= 1;
-}
-
-/** Fill device identification in SATA device structure.
- *
- * @param sata SATA device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ahci_identify_device(sata_dev_t *sata)
-{
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "Identify command device on invalid device");
-		return EINTR;
-	}
-
-	uintptr_t phys;
-	sata_identify_data_t *idata = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
-	    (void *) &idata);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot allocate buffer to identify device.");
-		return rc;
-	}
-
-	memset(idata, 0, SATA_IDENTIFY_DEVICE_BUFFER_LENGTH);
-
-	fibril_mutex_lock(&sata->lock);
-
-	ahci_identify_device_cmd(sata, phys);
-	ahci_port_is_t pxis = ahci_wait_event(sata);
-
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "Unrecoverable error during ata identify device");
-		goto error;
-	}
-
-	if (ahci_port_is_tfes(pxis)) {
-		ahci_identify_packet_device_cmd(sata, phys);
-		pxis = ahci_wait_event(sata);
-
-		if ((sata->is_invalid_device) || (ahci_port_is_error(pxis))) {
-			ddf_msg(LVL_ERROR,
-			    "Unrecoverable error during ata identify packet device");
-			goto error;
-		}
-
-		sata->is_packet_device = true;
-	}
-
-	ahci_get_model_name(idata->model_name, sata->model);
-
-	/*
-	 * Due to QEMU limitation (as of 2012-06-22),
-	 * only NCQ FPDMA mode is supported.
-	 */
-	if ((idata->sata_cap & sata_np_cap_ncq) == 0) {
-		ddf_msg(LVL_ERROR, "%s: NCQ must be supported", sata->model);
-		goto error;
-	}
-
-	uint16_t logsec = idata->physical_logic_sector_size;
-	if ((logsec & 0xc000) == 0x4000) {
-		/* Length of sector may be larger than 512 B */
-		if (logsec & 0x0100) {
-			/* Size of sector is larger than 512 B */
-			ddf_msg(LVL_ERROR,
-			    "%s: Sector length other than 512 B not supported",
-			    sata->model);
-			goto error;
-		}
-
-		if ((logsec & 0x0200) && ((logsec & 0x000f) != 0)) {
-			/* Physical sectors per logical sector is greather than 1 */
-			ddf_msg(LVL_ERROR,
-			    "%s: Sector length other than 512 B not supported",
-			    sata->model);
-			goto error;
-		}
-	}
-
-	if (sata->is_packet_device) {
-		/*
-		 * Due to QEMU limitation (as of 2012-06-22),
-		 * only NCQ FPDMA mode supported - block size is
-		 * 512 B, not 2048 B!
-		 */
-		sata->block_size = SATA_DEFAULT_SECTOR_SIZE;
-		sata->blocks = 0;
-	} else {
-		sata->block_size = SATA_DEFAULT_SECTOR_SIZE;
-
-		if ((idata->caps & sata_rd_cap_lba) == 0) {
-			ddf_msg(LVL_ERROR, "%s: LBA for NCQ must be supported",
-			    sata->model);
-			goto error;
-		} else if ((idata->cmd_set1 & sata_cs1_addr48) == 0) {
-			sata->blocks = (uint32_t) idata->total_lba28_0 |
-			    ((uint32_t) idata->total_lba28_1 << 16);
-		} else {
-			/* Device supports LBA-48 addressing. */
-			sata->blocks = (uint64_t) idata->total_lba48_0 |
-			    ((uint64_t) idata->total_lba48_1 << 16) |
-			    ((uint64_t) idata->total_lba48_2 << 32) |
-			    ((uint64_t) idata->total_lba48_3 << 48);
-		}
-	}
-
-	uint8_t udma_mask = idata->udma & 0x007f;
-	sata->highest_udma_mode = (uint8_t) -1;
-	if (udma_mask == 0) {
-		ddf_msg(LVL_ERROR,
-		    "%s: UDMA mode for NCQ FPDMA mode must be supported",
-		    sata->model);
-		goto error;
-	} else {
-		for (uint8_t i = 0; i < 7; i++) {
-			if (udma_mask & (1 << i))
-				sata->highest_udma_mode = i;
-		}
-	}
-
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(idata);
-
-	return EOK;
-
-error:
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(idata);
-
-	return EINTR;
-}
-
-/** Set AHCI registers for setting SATA device transfer mode.
- *
- * @param sata SATA device structure.
- * @param phys Physical address of working buffer.
- * @param mode Required mode.
- *
- */
-static void ahci_set_mode_cmd(sata_dev_t *sata, uintptr_t phys, uint8_t mode)
-{
-	volatile sata_std_command_frame_t *cmd =
-	    (sata_std_command_frame_t *) sata->cmd_table;
-
-	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
-	cmd->command = 0xef;
-	cmd->features = 0x03;
-	cmd->lba_lower = 0;
-	cmd->device = 0;
-	cmd->lba_upper = 0;
-	cmd->features_upper = 0;
-	cmd->count = mode;
-	cmd->reserved1 = 0;
-	cmd->control = 0;
-	cmd->reserved2 = 0;
-
-	volatile ahci_cmd_prdt_t *prdt =
-	    (ahci_cmd_prdt_t *) (&sata->cmd_table[0x20]);
-
-	prdt->data_address_low = LO(phys);
-	prdt->data_address_upper = HI(phys);
-	prdt->reserved1 = 0;
-	prdt->dbc = SATA_SET_FEATURE_BUFFER_LENGTH - 1;
-	prdt->reserved2 = 0;
-	prdt->ioc = 0;
-
-	sata->cmd_header->prdtl = 1;
-	sata->cmd_header->flags =
-	    AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK |
-	    AHCI_CMDHDR_FLAGS_2DWCMD;
-	sata->cmd_header->bytesprocessed = 0;
-
-	/* Run command. */
-	sata->port->pxsact |= 1;
-	sata->port->pxci |= 1;
-}
-
-/** Set highest ultra DMA mode supported by SATA device.
- *
- * @param sata SATA device structure.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t ahci_set_highest_ultra_dma_mode(sata_dev_t *sata)
-{
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Setting highest UDMA mode on invalid device",
-		    sata->model);
-		return EINTR;
-	}
-
-	if (sata->highest_udma_mode == (uint8_t) -1) {
-		ddf_msg(LVL_ERROR,
-		    "%s: No AHCI UDMA support.", sata->model);
-		return EINTR;
-	}
-
-	if (sata->highest_udma_mode > 6) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Unknown AHCI UDMA mode.", sata->model);
-		return EINTR;
-	}
-
-	uintptr_t phys;
-	sata_identify_data_t *idata = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
-	    (void *) &idata);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot allocate buffer for device set mode.");
-		return rc;
-	}
-
-	memset(idata, 0, SATA_SET_FEATURE_BUFFER_LENGTH);
-
-	fibril_mutex_lock(&sata->lock);
-
-	uint8_t mode = 0x40 | (sata->highest_udma_mode & 0x07);
-	ahci_set_mode_cmd(sata, phys, mode);
-	ahci_port_is_t pxis = ahci_wait_event(sata);
-
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Unrecoverable error during set highest UDMA mode",
-		    sata->model);
-		goto error;
-	}
-
-	if (ahci_port_is_error(pxis)) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Error during set highest UDMA mode", sata->model);
-		goto error;
-	}
-
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(idata);
-
-	return EOK;
-
-error:
-	fibril_mutex_unlock(&sata->lock);
-	dmamem_unmap_anonymous(idata);
-
-	return EINTR;
-}
-
-/** Set AHCI registers for reading one sector from the SATA device using FPDMA.
- *
- * @param sata     SATA device structure.
- * @param phys     Physical address of buffer for sector data.
- * @param blocknum Block number to read.
- *
- */
-static void ahci_rb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
-    uint64_t blocknum)
-{
-	volatile sata_ncq_command_frame_t *cmd =
-	    (sata_ncq_command_frame_t *) sata->cmd_table;
-
-	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
-	cmd->command = 0x60;
-	cmd->tag = 0;
-	cmd->control = 0;
-
-	cmd->reserved1 = 0;
-	cmd->reserved2 = 0;
-	cmd->reserved3 = 0;
-	cmd->reserved4 = 0;
-	cmd->reserved5 = 0;
-	cmd->reserved6 = 0;
-
-	cmd->sector_count_low = 1;
-	cmd->sector_count_high = 0;
-
-	cmd->lba0 = blocknum & 0xff;
-	cmd->lba1 = (blocknum >> 8) & 0xff;
-	cmd->lba2 = (blocknum >> 16) & 0xff;
-	cmd->lba3 = (blocknum >> 24) & 0xff;
-	cmd->lba4 = (blocknum >> 32) & 0xff;
-	cmd->lba5 = (blocknum >> 40) & 0xff;
-
-	volatile ahci_cmd_prdt_t *prdt =
-	    (ahci_cmd_prdt_t *) (&sata->cmd_table[0x20]);
-
-	prdt->data_address_low = LO(phys);
-	prdt->data_address_upper = HI(phys);
-	prdt->reserved1 = 0;
-	prdt->dbc = sata->block_size - 1;
-	prdt->reserved2 = 0;
-	prdt->ioc = 0;
-
-	sata->cmd_header->prdtl = 1;
-	sata->cmd_header->flags =
-	    AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK |
-	    AHCI_CMDHDR_FLAGS_5DWCMD;
-	sata->cmd_header->bytesprocessed = 0;
-
-	sata->port->pxsact |= 1;
-	sata->port->pxci |= 1;
-}
-
-/** Read one sector from the SATA device using FPDMA.
- *
- * @param sata     SATA device structure.
- * @param phys     Physical address of buffer for sector data.
- * @param blocknum Block number to read.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
-{
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "%s: FPDMA read from invalid device", sata->model);
-		return EINTR;
-	}
-
-	ahci_rb_fpdma_cmd(sata, phys, blocknum);
-	ahci_port_is_t pxis = ahci_wait_event(sata);
-
-	if ((sata->is_invalid_device) || (ahci_port_is_error(pxis))) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Unrecoverable error during FPDMA read", sata->model);
-		return EINTR;
-	}
-
-	return EOK;
-}
-
-/** Set AHCI registers for writing one sector to the SATA device, use FPDMA.
- *
- * @param sata     SATA device structure.
- * @param phys     Physical address of buffer with sector data.
- * @param blocknum Block number to write.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static void ahci_wb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
-    uint64_t blocknum)
-{
-	volatile sata_ncq_command_frame_t *cmd =
-	    (sata_ncq_command_frame_t *) sata->cmd_table;
-
-	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
-	cmd->command = 0x61;
-	cmd->tag = 0;
-	cmd->control = 0;
-
-	cmd->reserved1 = 0;
-	cmd->reserved2 = 0;
-	cmd->reserved3 = 0;
-	cmd->reserved4 = 0;
-	cmd->reserved5 = 0;
-	cmd->reserved6 = 0;
-
-	cmd->sector_count_low = 1;
-	cmd->sector_count_high = 0;
-
-	cmd->lba0 = blocknum & 0xff;
-	cmd->lba1 = (blocknum >> 8) & 0xff;
-	cmd->lba2 = (blocknum >> 16) & 0xff;
-	cmd->lba3 = (blocknum >> 24) & 0xff;
-	cmd->lba4 = (blocknum >> 32) & 0xff;
-	cmd->lba5 = (blocknum >> 40) & 0xff;
-
-	volatile ahci_cmd_prdt_t *prdt =
-	    (ahci_cmd_prdt_t *) (&sata->cmd_table[0x20]);
-
-	prdt->data_address_low = LO(phys);
-	prdt->data_address_upper = HI(phys);
-	prdt->reserved1 = 0;
-	prdt->dbc = sata->block_size - 1;
-	prdt->reserved2 = 0;
-	prdt->ioc = 0;
-
-	sata->cmd_header->prdtl = 1;
-	sata->cmd_header->flags =
-	    AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK |
-	    AHCI_CMDHDR_FLAGS_WRITE |
-	    AHCI_CMDHDR_FLAGS_5DWCMD;
-	sata->cmd_header->bytesprocessed = 0;
-
-	sata->port->pxsact |= 1;
-	sata->port->pxci |= 1;
-}
-
-/** Write one sector into the SATA device, use FPDMA.
- *
- * @param sata     SATA device structure.
- * @param phys     Physical address of buffer with sector data.
- * @param blocknum Block number to write.
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
-{
-	if (sata->is_invalid_device) {
-		ddf_msg(LVL_ERROR,
-		    "%s: FPDMA write to invalid device", sata->model);
-		return EINTR;
-	}
-
-	ahci_wb_fpdma_cmd(sata, phys, blocknum);
-	ahci_port_is_t pxis = ahci_wait_event(sata);
-
-	if ((sata->is_invalid_device) || (ahci_port_is_error(pxis))) {
-		ddf_msg(LVL_ERROR,
-		    "%s: Unrecoverable error during FPDMA write", sata->model);
-		return EINTR;
-	}
-
-	return EOK;
-}
-
-/*
- * Interrupts handling
- */
-
-static irq_pio_range_t ahci_ranges[] = {
-	{
-		.base = 0,
-		.size = 0,
-	}
-};
-
-static irq_cmd_t ahci_cmds[] = {
-	AHCI_PORT_CMDS(0),
-	AHCI_PORT_CMDS(1),
-	AHCI_PORT_CMDS(2),
-	AHCI_PORT_CMDS(3),
-	AHCI_PORT_CMDS(4),
-	AHCI_PORT_CMDS(5),
-	AHCI_PORT_CMDS(6),
-	AHCI_PORT_CMDS(7),
-	AHCI_PORT_CMDS(8),
-	AHCI_PORT_CMDS(9),
-	AHCI_PORT_CMDS(10),
-	AHCI_PORT_CMDS(11),
-	AHCI_PORT_CMDS(12),
-	AHCI_PORT_CMDS(13),
-	AHCI_PORT_CMDS(14),
-	AHCI_PORT_CMDS(15),
-	AHCI_PORT_CMDS(16),
-	AHCI_PORT_CMDS(17),
-	AHCI_PORT_CMDS(18),
-	AHCI_PORT_CMDS(19),
-	AHCI_PORT_CMDS(20),
-	AHCI_PORT_CMDS(21),
-	AHCI_PORT_CMDS(22),
-	AHCI_PORT_CMDS(23),
-	AHCI_PORT_CMDS(24),
-	AHCI_PORT_CMDS(25),
-	AHCI_PORT_CMDS(26),
-	AHCI_PORT_CMDS(27),
-	AHCI_PORT_CMDS(28),
-	AHCI_PORT_CMDS(29),
-	AHCI_PORT_CMDS(30),
-	AHCI_PORT_CMDS(31)
-};
-
-/** AHCI interrupt handler.
- *
- * @param icall The IPC call structure.
- * @param arg   Argument (ahci_dev_t *)
- */
-static void ahci_interrupt(ipc_call_t *icall, void *arg)
-{
-	ahci_dev_t *ahci = (ahci_dev_t *)arg;
-	unsigned int port = ipc_get_arg1(icall);
-	ahci_port_is_t pxis = ipc_get_arg2(icall);
-
-	if (port >= AHCI_MAX_PORTS)
-		return;
-
-	sata_dev_t *sata = (sata_dev_t *) ahci->sata_devs[port];
-	if (sata == NULL)
-		return;
-
-	/* Evaluate port event */
-	if ((ahci_port_is_end_of_operation(pxis)) ||
-	    (ahci_port_is_error(pxis))) {
-		fibril_mutex_lock(&sata->event_lock);
-
-		sata->event_pxis = pxis;
-		fibril_condvar_signal(&sata->event_condvar);
-
-		fibril_mutex_unlock(&sata->event_lock);
-	}
-}
-
-/*
- * AHCI and SATA device creating and initializing routines
- */
-
-/** Allocate SATA device structure with buffers for hardware.
- *
- * @param port AHCI port structure
- *
- * @return SATA device structure if succeed, NULL otherwise.
- *
- */
-static sata_dev_t *ahci_sata_allocate(ahci_dev_t *ahci, volatile ahci_port_t *port)
-{
-	size_t size = 4096;
-	uintptr_t phys = 0;
-	void *virt_fb = AS_AREA_ANY;
-	void *virt_cmd = AS_AREA_ANY;
-	void *virt_table = AS_AREA_ANY;
-	ddf_fun_t *fun;
-
-	fun = ddf_fun_create(ahci->dev, fun_exposed, NULL);
-
-	sata_dev_t *sata = ddf_fun_data_alloc(fun, sizeof(sata_dev_t));
-	if (sata == NULL)
-		return NULL;
-
-	sata->fun = fun;
-	sata->port = port;
-
-	/* Allocate and init retfis structure. */
-	errno_t rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb);
-	if (rc != EOK)
-		goto error_retfis;
-
-	memset(virt_fb, 0, size);
-	sata->port->pxfbu = HI(phys);
-	sata->port->pxfb = LO(phys);
-
-	/* Allocate and init command header structure. */
-	rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_cmd);
-	if (rc != EOK)
-		goto error_cmd;
-
-	memset(virt_cmd, 0, size);
-	sata->port->pxclbu = HI(phys);
-	sata->port->pxclb = LO(phys);
-	sata->cmd_header = (ahci_cmdhdr_t *) virt_cmd;
-
-	/* Allocate and init command table structure. */
-	rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_table);
-	if (rc != EOK)
-		goto error_table;
-
-	memset(virt_table, 0, size);
-	sata->cmd_header->cmdtableu = HI(phys);
-	sata->cmd_header->cmdtable = LO(phys);
-	sata->cmd_table = (uint32_t *) virt_table;
-
-	return sata;
-
-error_table:
-	dmamem_unmap(virt_cmd, size);
-error_cmd:
-	dmamem_unmap(virt_fb, size);
-error_retfis:
-	free(sata);
-	return NULL;
-}
-
-/** Initialize and start SATA hardware device.
- *
- * @param sata SATA device structure.
- *
- */
-static void ahci_sata_hw_start(sata_dev_t *sata)
-{
-	ahci_port_cmd_t pxcmd;
-
-	pxcmd.u32 = sata->port->pxcmd;
-
-	/* Frame receiver disabled. */
-	pxcmd.fre = 0;
-
-	/* Disable process the command list. */
-	pxcmd.st = 0;
-
-	sata->port->pxcmd = pxcmd.u32;
-
-	/* Clear interrupt status. */
-	sata->port->pxis = 0xffffffff;
-
-	/* Clear error status. */
-	sata->port->pxserr = 0xffffffff;
-
-	/* Enable all interrupts. */
-	sata->port->pxie = 0xffffffff;
-
-	/* Frame receiver enabled. */
-	pxcmd.fre = 1;
-
-	/* Enable process the command list. */
-	pxcmd.st = 1;
-
-	sata->port->pxcmd = pxcmd.u32;
-}
-
-/** Create and initialize connected SATA structure device
- *
- * @param ahci     AHCI device structure.
- * @param dev      DDF device structure.
- * @param port     AHCI port structure.
- * @param port_num Number of AHCI port with existing SATA device.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ahci_sata_create(ahci_dev_t *ahci, ddf_dev_t *dev,
-    volatile ahci_port_t *port, unsigned int port_num)
-{
-	ddf_fun_t *fun = NULL;
-	errno_t rc;
-
-	sata_dev_t *sata = ahci_sata_allocate(ahci, port);
-	if (sata == NULL)
-		return EINTR;
-
-	/* Set pointers between SATA and AHCI structures. */
-	sata->ahci = ahci;
-	sata->port_num = port_num;
-	ahci->sata_devs[port_num] = sata;
-
-	/* Initialize synchronization structures */
-	fibril_mutex_initialize(&sata->lock);
-	fibril_mutex_initialize(&sata->event_lock);
-	fibril_condvar_initialize(&sata->event_condvar);
-
-	ahci_sata_hw_start(sata);
-
-	/* Identify device. */
-	if (ahci_identify_device(sata) != EOK)
-		goto error;
-
-	/* Set required UDMA mode */
-	if (ahci_set_highest_ultra_dma_mode(sata) != EOK)
-		goto error;
-
-	/* Add device to the system */
-	char sata_dev_name[16];
-	snprintf(sata_dev_name, 16, "ahci_%u", sata_devices_count);
-
-	fibril_mutex_lock(&sata_devices_count_lock);
-	sata_devices_count++;
-	fibril_mutex_unlock(&sata_devices_count_lock);
-
-	rc = ddf_fun_set_name(sata->fun, sata_dev_name);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed setting function name.");
-		goto error;
-	}
-
-	ddf_fun_set_ops(fun, &ahci_ops);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function.");
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	sata->is_invalid_device = true;
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-
-	return EINTR;
-}
-
-/** Create and initialize all SATA structure devices for connected SATA drives.
- *
- * @param ahci AHCI device structure.
- * @param dev  DDF device structure.
- *
- */
-static void ahci_sata_devices_create(ahci_dev_t *ahci, ddf_dev_t *dev)
-{
-	for (unsigned int port_num = 0; port_num < AHCI_MAX_PORTS; port_num++) {
-		/* Active ports only */
-		if (!(ahci->memregs->ghc.pi & (1 << port_num)))
-			continue;
-
-		volatile ahci_port_t *port = ahci->memregs->ports + port_num;
-
-		/* Active devices only */
-		ahci_port_ssts_t pxssts;
-		pxssts.u32 = port->pxssts;
-		if (pxssts.det != AHCI_PORT_SSTS_DET_ACTIVE)
-			continue;
-
-		ahci_sata_create(ahci, dev, port, port_num);
-	}
-}
-
-/** Create AHCI device structure, intialize it and register interrupt routine.
- *
- * @param dev DDF device structure.
- *
- * @return AHCI device structure if succeed, NULL otherwise.
- *
- */
-static ahci_dev_t *ahci_ahci_create(ddf_dev_t *dev)
-{
-	ahci_dev_t *ahci = ddf_dev_data_alloc(dev, sizeof(ahci_dev_t));
-	if (!ahci)
-		return NULL;
-
-	/* Connect to parent device */
-	ahci->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (ahci->parent_sess == NULL)
-		return NULL;
-
-	ahci->dev = dev;
-
-	hw_res_list_parsed_t hw_res_parsed;
-	hw_res_list_parsed_init(&hw_res_parsed);
-	if (hw_res_get_list_parsed(ahci->parent_sess, &hw_res_parsed, 0) != EOK)
-		goto error_get_res_parsed;
-
-	/* Map AHCI registers. */
-	ahci->memregs = AS_AREA_ANY;
-
-	physmem_map(RNGABS(hw_res_parsed.mem_ranges.ranges[0]),
-	    AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE,
-	    (void *) &ahci->memregs);
-	if (ahci->memregs == NULL)
-		goto error_map_registers;
-
-	/* Register interrupt handler */
-	ahci_ranges[0].base = RNGABS(hw_res_parsed.mem_ranges.ranges[0]);
-	ahci_ranges[0].size = sizeof(ahci_memregs_t);
-
-	for (unsigned int port = 0; port < AHCI_MAX_PORTS; port++) {
-		size_t base = port * 7;
-
-		ahci_cmds[base].addr =
-		    ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) +
-		    AHCI_PORTS_REGISTERS_OFFSET + port * AHCI_PORT_REGISTERS_SIZE +
-		    AHCI_PORT_IS_REGISTER_OFFSET;
-		ahci_cmds[base + 2].addr = ahci_cmds[base].addr;
-
-		ahci_cmds[base + 3].addr =
-		    ((uint32_t *) RNGABSPTR(hw_res_parsed.mem_ranges.ranges[0])) +
-		    AHCI_GHC_IS_REGISTER_OFFSET;
-		ahci_cmds[base + 4].addr = ahci_cmds[base + 3].addr;
-	}
-
-	irq_code_t ct;
-	ct.cmdcount = sizeof(ahci_cmds) / sizeof(irq_cmd_t);
-	ct.cmds = ahci_cmds;
-	ct.rangecount = sizeof(ahci_ranges) / sizeof(irq_pio_range_t);
-	ct.ranges = ahci_ranges;
-
-	cap_irq_handle_t irq_cap;
-	errno_t rc = register_interrupt_handler(dev,
-	    hw_res_parsed.irqs.irqs[0], ahci_interrupt, (void *)ahci, &ct,
-	    &irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed registering interrupt handler.");
-		goto error_register_interrupt_handler;
-	}
-
-	rc = hw_res_enable_interrupt(ahci->parent_sess,
-	    hw_res_parsed.irqs.irqs[0]);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed enable interupt.");
-		goto error_enable_interrupt;
-	}
-
-	hw_res_list_parsed_clean(&hw_res_parsed);
-	return ahci;
-
-error_enable_interrupt:
-	unregister_interrupt_handler(dev, irq_cap);
-
-error_register_interrupt_handler:
-	// FIXME: unmap physical memory
-
-error_map_registers:
-	hw_res_list_parsed_clean(&hw_res_parsed);
-
-error_get_res_parsed:
-	free(ahci);
-	return NULL;
-}
-
-/** Initialize and start AHCI hardware device.
- *
- * @param ahci AHCI device.
- *
- */
-static void ahci_ahci_hw_start(ahci_dev_t *ahci)
-{
-	/* Disable command completion coalescing feature */
-	ahci_ghc_ccc_ctl_t ccc;
-
-	ccc.u32 = ahci->memregs->ghc.ccc_ctl;
-	ccc.en = 0;
-	ahci->memregs->ghc.ccc_ctl = ccc.u32;
-
-	/* Set master latency timer. */
-	pci_config_space_write_8(ahci->parent_sess, AHCI_PCI_MLT, 32);
-
-	/* Enable PCI interrupt and bus mastering */
-	ahci_pcireg_cmd_t cmd;
-
-	pci_config_space_read_16(ahci->parent_sess, AHCI_PCI_CMD, &cmd.u16);
-	cmd.id = 0;
-	cmd.bme = 1;
-	pci_config_space_write_16(ahci->parent_sess, AHCI_PCI_CMD, cmd.u16);
-
-	/* Enable AHCI and interrupt. */
-	ahci->memregs->ghc.ghc = AHCI_GHC_GHC_AE | AHCI_GHC_GHC_IE;
-}
-
-/** AHCI device driver initialization
- *
- * Create and initialize all SATA structure devices for connected
- * SATA drives.
- *
- * @param dev DDF device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ahci_dev_add(ddf_dev_t *dev)
-{
-	ahci_dev_t *ahci = ahci_ahci_create(dev);
-	if (ahci == NULL)
-		goto error;
-
-	/* Start AHCI hardware. */
-	ahci_ahci_hw_start(ahci);
-
-	/* Create device structures for sata devices attached to AHCI. */
-	ahci_sata_devices_create(ahci, dev);
-
-	return EOK;
-
-error:
-	return EINTR;
-}
-
-/*
- * Helpers and utilities
- */
-
-/** Convert SATA model name
- *
- * Convert SATA model name from machine format returned by
- * identify device command to human readable form.
- *
- * @param src Source buffer with device name in machine format.
- * @param dst Buffer for human readable string, minimum size is 41 chars.
- *
- */
-static void ahci_get_model_name(uint16_t *src, char *dst)
-{
-	uint8_t model[40];
-	memset(model, 0, 40);
-
-	for (unsigned int i = 0; i < 20; i++) {
-		uint16_t w = src[i];
-		model[2 * i] = w >> 8;
-		model[2 * i + 1] = w & 0x00ff;
-	}
-
-	uint32_t len = 40;
-	while ((len > 0) && (model[len - 1] == 0x20))
-		len--;
-
-	size_t pos = 0;
-	for (unsigned int i = 0; i < len; i++) {
-		uint8_t c = model[i];
-		if (c >= 0x80)
-			c = '?';
-
-		chr_encode(c, dst, &pos, 40);
-	}
-
-	dst[pos] = '\0';
-}
-
-/*
- * AHCI Main routine
- */
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS AHCI device driver\n", NAME);
-	ddf_log_init(NAME);
-	fibril_mutex_initialize(&sata_devices_count_lock);
-	return ddf_driver_main(&ahci_driver);
-}
Index: pace/drv/block/ahci/ahci.h
===================================================================
--- uspace/drv/block/ahci/ahci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Header for AHCI driver.
- */
-
-#ifndef __AHCI_H__
-#define __AHCI_H__
-
-#include <async.h>
-#include <ddf/interrupt.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "ahci_hw.h"
-
-/** AHCI Device. */
-typedef struct {
-	/** Pointer to ddf device. */
-	ddf_dev_t *dev;
-
-	/** Pointer to AHCI memory registers. */
-	volatile ahci_memregs_t *memregs;
-
-	/** Pointers to sata devices. */
-	void *sata_devs[AHCI_MAX_PORTS];
-
-	/** Parent session */
-	async_sess_t *parent_sess;
-} ahci_dev_t;
-
-/** SATA Device. */
-typedef struct {
-	/** Pointer to AHCI device. */
-	ahci_dev_t *ahci;
-
-	/** Pointer to ddf function. */
-	ddf_fun_t *fun;
-
-	/** SATA port number (0-31). */
-	uint8_t port_num;
-
-	/** Device in invalid state (disconnected and so on). */
-	bool is_invalid_device;
-
-	/** Pointer to SATA port. */
-	volatile ahci_port_t *port;
-
-	/** Pointer to command header. */
-	volatile ahci_cmdhdr_t *cmd_header;
-
-	/** Pointer to command table. */
-	volatile uint32_t *cmd_table;
-
-	/** Mutex for single operation on device. */
-	fibril_mutex_t lock;
-
-	/** Mutex for event signaling condition variable. */
-	fibril_mutex_t event_lock;
-
-	/** Event signaling condition variable. */
-	fibril_condvar_t event_condvar;
-
-	/** Event interrupt state. */
-	ahci_port_is_t event_pxis;
-
-	/** Number of device data blocks. */
-	uint64_t blocks;
-
-	/** Size of device data blocks. */
-	size_t block_size;
-
-	/** Name of SATA device. */
-	char model[STR_BOUNDS(40) + 1];
-
-	/** Device in invalid state (disconnected and so on). */
-	bool is_packet_device;
-
-	/** Highest UDMA mode supported. */
-	uint8_t highest_udma_mode;
-} sata_dev_t;
-
-#endif
Index: pace/drv/block/ahci/ahci.ma
===================================================================
--- uspace/drv/block/ahci/ahci.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-10 pci/ven=8086&dev=2922
-10 pci/ven=8086&dev=2829
-10 pci/ven=1002&dev=4391
Index: pace/drv/block/ahci/ahci_hw.h
===================================================================
--- uspace/drv/block/ahci/ahci_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1041 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Header for AHCI driver (AHCI 1.3 specification).
- */
-
-#ifndef __AHCI_HW_H__
-#define __AHCI_HW_H__
-
-#include <stdint.h>
-
-/*
- * AHCI standard constants
- */
-
-/** AHCI standard 1.3 - maximum ports. */
-#define AHCI_MAX_PORTS  32
-
-/*
- * AHCI PCI Registers
- */
-
-/** AHCI PCI register Identifiers offset. */
-#define AHCI_PCI_ID     0x00
-/** AHCI PCI register Command offset. */
-#define AHCI_PCI_CMD    0x04
-/** AHCI PCI register Device Status offset. */
-#define AHCI_PCI_STS    0x06
-/** AHCI PCI register Revision ID offset. */
-#define AHCI_PCI_RID    0x08
-/** AHCI PCI register Class Codes offset. */
-#define AHCI_PCI_CC     0x09
-/** AHCI PCI register Cache Line Size offset. */
-#define AHCI_PCI_CLS    0x0C
-/** AHCI PCI register Master Latency Timer offset. */
-#define AHCI_PCI_MLT    0x0D
-/** AHCI PCI register Header Type offset. */
-#define AHCI_PCI_HTYPE  0x0E
-/** AHCI PCI register Built In Self Test (Optional) offset. */
-#define AHCI_PCI_BIST   0x0F
-/** AHCI PCI register Other Base Address Registres (Optional). */
-#define AHCI_PCI_BAR0   0x10
-/** AHCI PCI register Other Base Address Registres (Optional). */
-#define AHCI_PCI_BAR1   0x14
-/** AHCI PCI register Other Base Address Registres (Optional). */
-#define AHCI_PCI_BAR2   0x18
-/** AHCI PCI register Other Base Address Registres (Optional). */
-#define AHCI_PCI_BAR3   0x1C
-/** AHCI PCI register Other Base Address Registres (Optional). */
-#define AHCI_PCI_BAR4   0x20
-/** AHCI PCI register AHCI Base Address offset. */
-#define AHCI_PCI_ABAR   0x24
-/** AHCI PCI register Subsystem Identifiers offset. */
-#define AHCI_PCI_SS     0x2C
-/** AHCI PCI register Expansion ROM Base Address (Optional) offset. */
-#define AHCI_PCI_EROM   0x30
-/** AHCI PCI register Capabilities Pointer offset. */
-#define AHCI_PCI_CAP    0x34
-/** AHCI PCI register Interrupt Information offset. */
-#define AHCI_PCI_INTR   0x3C
-/** AHCI PCI register Min Grant (Optional) offset. */
-#define AHCI_PCI_MGNT   0x3E
-/** AHCI PCI register Max Latency (Optional) offset. */
-#define AHCI_PCI_MLAT   0x3F
-
-/** AHCI PCI register Identifiers. */
-typedef struct {
-	/** Indicates the company vendor assigned by the PCI SIG. */
-	uint16_t vendorid;
-	/** Indicates what device number assigned by the vendor */
-	uint16_t deviceid;
-} ahci_pcireg_id_t;
-
-/** AHCI PCI register Command. */
-typedef union {
-	struct {
-		/** I/O Space Enable. */
-		unsigned int iose : 1;
-		/** Memory Space Enable. */
-		unsigned int mse : 1;
-		/** Bus Master Enable. */
-		unsigned int bme : 1;
-		/** Special Cycle Enable. */
-		unsigned int sce : 1;
-		/** Memory Write and Invalidate Enable. */
-		unsigned int mwie : 1;
-		/** VGA Palette Snooping Enable. */
-		unsigned int vga : 1;
-		/** Parity Error Response Enable. */
-		unsigned int pee : 1;
-		/** Wait Cycle Enable. */
-		unsigned int wcc : 1;
-		/** SERR# Enable. */
-		unsigned int see : 1;
-		/** Fast Back-to-Back Enable. */
-		unsigned int fbe : 1;
-		/** Interrupt Disable - disables the HBA from generating interrupts.
-		 * This bit does not have any effect on MSI operation.
-		 */
-		unsigned int id : 1;
-		/** Reserved. */
-		unsigned int reserved : 5;
-	};
-	uint16_t u16;
-} ahci_pcireg_cmd_t;
-
-/** AHCI PCI register Command - Interrupt Disable bit. */
-#define AHCI_PCIREG_CMD_ID  0x0400
-
-/** AHCI PCI register Command - Bus Master Enable bit. */
-#define AHCI_PCIREG_CMD_BME  0x0004
-
-/** AHCI PCI register Device status. */
-typedef union {
-	struct {
-		/** Reserved. */
-		unsigned int reserved1 : 3;
-		/** Indicate the interrupt status of the device (1 = asserted). */
-		unsigned int is : 1;
-		/** Indicates presence of capatibility list. */
-		unsigned int cl : 1;
-		/** 66 Mhz capable. */
-		unsigned int c66 : 1;
-		/** Reserved. */
-		unsigned int reserved2 : 1;
-		/** Fast back to back capable. */
-		unsigned int fbc : 1;
-		/** Master data parity error detected. */
-		unsigned int dpd : 1;
-		/** Device select timing. */
-		unsigned int devt : 2;
-		/** Signaled target abort. */
-		unsigned int sta : 1;
-		/** Received target abort. */
-		unsigned int rta : 1;
-		/** Received master abort. */
-		unsigned int rma : 1;
-		/** Signaled system error. */
-		unsigned int sse : 1;
-		/** Detected parity error. */
-		unsigned int dpe : 1;
-	};
-	uint16_t u16;
-} ahci_pcireg_sts_t;
-
-/** AHCI PCI register Revision ID. */
-typedef struct {
-	/** Indicates stepping of the HBA hardware. */
-	uint8_t u8;
-} ahci_pcireg_rid_t;
-
-/** AHCI PCI register Class Codes. */
-typedef struct {
-	/** Programing interface, when set to 01h and the scc is set to 06h,
-	 * indicates that this an AHCI HBA major revision 1.
-	 */
-	uint8_t pi;
-	/** When set to 06h, indicates that is a SATA device. */
-	uint8_t scc;
-	/** Value 01 indicates that is a mass storage device. */
-	uint8_t bcc;
-} ahci_pcireg_cc_t_t;
-
-/** AHCI PCI register Cache Line Size. */
-typedef struct {
-	/** Cache line size for use with the memory write and invalidate command. */
-	uint8_t u8;
-} ahci_pcireg_cls_t;
-
-/** AHCI PCI register Master Latency Timer. */
-typedef struct {
-	/** Master latency timer,indicates the number of clocks the HBA is allowed
-	 * to acts as master on PCI.
-	 */
-	uint8_t u8;
-} ahci_pcireg_mlt_t;
-
-/** AHCI PCI register Header Type. */
-typedef union {
-	struct {
-		/** Header layout. */
-		unsigned int hl : 7;
-		/** Multi function device flag. */
-		unsigned int mfd : 1;
-	};
-	uint8_t u8;
-} ahci_pciregs_htype_t;
-
-/** AHCI PCI register Built in self test. */
-typedef union {
-	struct {
-		/** Indicates the completion status of BIST
-		 * non-zero value indicates a failure.
-		 */
-		unsigned int cc : 4;
-		/** Reserved. */
-		unsigned int reserved : 2;
-		/** Software sets this bit to 1 to invoke BIST,
-		 * the HBA clears this bit to 0 when BIST is complete.
-		 */
-		unsigned int sb : 1;
-		/** BIST capable. */
-		unsigned int bc : 1;
-	};
-	uint8_t u8;
-} ahci_pciregs_bist_t;
-
-/** AHCI PCI register AHCI Base Address <BAR 5>. */
-typedef union {
-	struct {
-		/** Indicates a request for register memory space. */
-		unsigned int rte : 1;
-		/** Indicates the this range can be mapped anywhere in 32-bit address
-		 * space.
-		 */
-		unsigned int tp : 2;
-		/** Indicate that this range is not prefetchable. */
-		unsigned int pf : 1;
-		/** Reserved. */
-		unsigned int reserved : 9;
-		/** Base address of registry memory space. */
-		unsigned int ba : 19;
-	};
-	uint32_t u32;
-} ahci_pciregs_abar_t;
-
-/** AHCI PCI register Subsystem Identifiers. */
-typedef struct {
-	/** Sub system vendor identifier. */
-	uint8_t ssvid;
-	/** Sub system identifier. */
-	uint8_t ssid;
-} ahci_pcireg_ss_t;
-
-/** AHCI PCI registers Expansion ROM Base Address. */
-typedef struct {
-	/** Indicates the base address of the HBA expansion ROM. */
-	uint32_t u32;
-} ahci_pcireg_erom_t;
-
-/** AHCI PCI register Capabilities Pointer. */
-typedef struct {
-	/** Indicates the first capability pointer offset. */
-	uint8_t u8;
-} ahci_pcireg_cap_t;
-
-/** AHCI PCI register Interrupt Information. */
-typedef struct {
-	/*
-	 * Software written value to indicate which interrupt vector
-	 * the interrupt is connected to.
-	 */
-	uint8_t iline;
-	/** This indicates the interrupt pin the HBA uses. */
-	uint8_t ipin;
-} ahci_pcireg_intr;
-
-/** AHCI PCI register Min Grant (Optional). */
-typedef struct {
-	/** Indicates the minimum grant time that the device
-	 * wishes grant asserted.
-	 */
-	uint8_t u8;
-} ahci_pcireg_mgnt_t;
-
-/** AHCI PCI register Max Latency (Optional). */
-typedef struct {
-	/** Indicates the maximum latency that the device can withstand. */
-	uint8_t u8;
-} ahci_pcireg_mlat_t;
-
-/*
- * AHCI Memory Registers
- */
-
-/** Number of pages for ahci memory registers. */
-#define AHCI_MEMREGS_PAGES_COUNT  8
-
-/** AHCI Memory register Generic Host Control - HBA Capabilities. */
-typedef union {
-	struct {
-		/** Number of Ports. */
-		unsigned int np : 5;
-		/** Supports External SATA. */
-		unsigned int sxs : 1;
-		/** Enclosure Management Supported. */
-		unsigned int ems : 1;
-		/** Command Completion Coalescing Supported. */
-		unsigned int cccs : 1;
-		/** Number of Command Slots. */
-		unsigned int ncs : 5;
-		/** Partial State Capable. */
-		unsigned int psc : 1;
-		/** Slumber State Capable. */
-		unsigned int ssc : 1;
-		/** PIO Multiple DRQ Block. */
-		unsigned int pmd : 1;
-		/** FIS-based Switching Supported. */
-		unsigned int fbss : 1;
-		/** Supports Port Multiplier. */
-		unsigned int spm : 1;
-		/** Supports AHCI mode only. */
-		unsigned int sam : 1;
-		/** Reserved. */
-		unsigned int reserved : 1;
-		/** Interface Speed Support. */
-		unsigned int iss : 4;
-		/** Supports Command List Override. */
-		unsigned int sclo : 1;
-		/** Supports Activity LED. */
-		unsigned int sal : 1;
-		/** Supports Aggressive Link Power Management. */
-		unsigned int salp : 1;
-		/** Supports Staggered Spin-up. */
-		unsigned int sss : 1;
-		/** Supports Mechanical Presence Switch. */
-		unsigned int smps : 1;
-		/** Supports SNotification Register. */
-		unsigned int ssntf : 1;
-		/** Supports Native Command Queuing. */
-		unsigned int sncq : 1;
-		/** Supports 64-bit Addressing. */
-		unsigned int s64a : 1;
-	};
-	uint32_t u32;
-} ahci_ghc_cap_t;
-
-/** AHCI Memory register Generic Host Control Global Host Control. */
-typedef union {
-	struct {
-		/** HBA Reset. */
-		unsigned int hr : 1;
-		/** Interrupt Enable. */
-		unsigned int ie : 1;
-		/** MSI Revert to Single Message. */
-		unsigned int mrsm : 1;
-		/** Reserved. */
-		unsigned int reserved : 28;
-		/** AHCI Enable. */
-		unsigned int ae : 1;
-	};
-	uint32_t u32;
-} ahci_ghc_ghc_t;
-
-/** AHCI Enable mask bit. */
-#define AHCI_GHC_GHC_AE  0x80000000
-
-/** AHCI Interrupt Enable mask bit. */
-#define AHCI_GHC_GHC_IE  0x00000002
-
-/** AHCI Memory register Interrupt pending register. */
-typedef uint32_t ahci_ghc_is_t;
-
-/** AHCI GHC register offset. */
-#define AHCI_GHC_IS_REGISTER_OFFSET  2
-
-/** AHCI ports registers offset. */
-#define AHCI_PORTS_REGISTERS_OFFSET  64
-
-/** AHCI port registers size. */
-#define AHCI_PORT_REGISTERS_SIZE  32
-
-/** AHCI port IS register offset. */
-#define AHCI_PORT_IS_REGISTER_OFFSET  4
-
-/** AHCI Memory register Ports implemented. */
-typedef struct {
-	/** If a bit is set to 1, the corresponding port
-	 * is available for software use.
-	 */
-	uint32_t u32;
-} ahci_ghc_pi_t;
-
-/** AHCI Memory register AHCI version. */
-typedef struct {
-	/** Indicates the minor version */
-	uint16_t mnr;
-	/** Indicates the major version */
-	uint16_t mjr;
-} ahci_ghc_vs_t;
-
-/** AHCI Memory register Command completion coalesce control. */
-typedef union {
-	struct {
-		/** Enable CCC features. */
-		unsigned int en : 1;
-		/** Reserved. */
-		unsigned int reserved : 2;
-		/** Interrupt number for CCC. */
-		unsigned int intr : 5;
-		/** Number of command completions that are necessary to cause
-		 * a CCC interrupt.
-		 */
-		uint8_t cc;
-		/** Timeout value in  ms. */
-		uint16_t tv;
-	};
-	uint32_t u32;
-} ahci_ghc_ccc_ctl_t;
-
-/** AHCI Memory register Command completion coalescing ports. */
-typedef struct {
-	/** If a bit is set to 1, the corresponding port is
-	 * part of the command completion coalescing feature.
-	 */
-	uint32_t u32;
-} ahci_ghc_ccc_ports_t;
-
-/** AHCI Memory register Enclosure management location. */
-typedef struct {
-	/** Size of the transmit message buffer area in dwords. */
-	uint16_t sz;
-	/*
-	 * Offset of the transmit message buffer area in dwords
-	 * from the beginning of ABAR
-	 */
-	uint16_t ofst;
-} ahci_ghc_em_loc;
-
-/** AHCI Memory register Enclosure management control. */
-typedef union {
-	struct {
-		/** Message received. */
-		unsigned int mr : 1;
-		/** Reserved. */
-		unsigned int reserved : 7;
-		/** Transmit message. */
-		unsigned int tm : 1;
-		/** Reset. */
-		unsigned int rst : 1;
-		/** Reserved. */
-		unsigned int reserved2 : 6;
-		/** LED message types. */
-		unsigned int led : 1;
-		/** Support SAFT-TE message type. */
-		unsigned int safte : 1;
-		/** Support SES-2 message type. */
-		unsigned int ses2 : 1;
-		/** Support SGPIO register. */
-		unsigned int sgpio : 1;
-		/** Reserved. */
-		unsigned int reserved3 : 4;
-		/** Single message buffer. */
-		unsigned int smb : 1;
-		/**  Support transmitting only. */
-		unsigned int xmt : 1;
-		/** Activity LED hardware driven. */
-		unsigned int alhd : 1;
-		/** Port multiplier support. */
-		unsigned int pm : 1;
-		/** Reserved. */
-		unsigned int reserved4 : 4;
-	};
-	uint32_t u32;
-} ahci_ghc_em_ctl_t;
-
-/** AHCI Memory register HBA capatibilities extended. */
-typedef union {
-	struct {
-		/** HBA support BIOS/OS handoff mechanism,
-		 * implemented BOHC register.
-		 */
-		unsigned int boh : 1;
-		/** Support for NVMHCI register. */
-		unsigned int nvmp : 1;
-		/** Automatic partial to slumber transition support. */
-		unsigned int apst : 1;
-		/** Reserved. */
-		unsigned int reserved : 29;
-	};
-	uint32_t u32;
-} ahci_ghc_cap2_t;
-
-/** AHCI Memory register BIOS/OS Handoff control and status. */
-typedef union {
-	struct {
-		/** BIOS Owned semaphore. */
-		unsigned int bos : 1;
-		/** OS Owned semaphore. */
-		unsigned int oos : 1;
-		/** SMI on OS ownership change enable. */
-		unsigned int sooe : 1;
-		/** OS ownership change. */
-		unsigned int ooc : 1;
-		/** BIOS Busy. */
-		unsigned int bb : 1;
-		/** Reserved. */
-		unsigned int reserved : 27;
-	};
-	uint32_t u32;
-} ahci_ghc_bohc_t;
-
-/** AHCI Memory register Generic Host Control. */
-typedef struct {
-	/** Host Capabilities */
-	uint32_t cap;
-	/** Global Host Control */
-	uint32_t ghc;
-	/** Interrupt Status */
-	ahci_ghc_is_t is;
-	/** Ports Implemented */
-	uint32_t pi;
-	/** Version */
-	uint32_t vs;
-	/** Command Completion Coalescing Control */
-	uint32_t ccc_ctl;
-	/** Command Completion Coalescing Ports */
-	uint32_t ccc_ports;
-	/** Enclosure Management Location */
-	uint32_t em_loc;
-	/** Enclosure Management Control */
-	uint32_t em_ctl;
-	/** Host Capabilities Extended */
-	uint32_t cap2;
-	/** BIOS/OS Handoff Control and Status */
-	uint32_t bohc;
-} ahci_ghc_t;
-
-/** AHCI Memory register Port x Command List Base Address. */
-typedef union {
-	struct {
-		/** Reserved. */
-		unsigned int reserved : 10;
-		/** Command List Base Address (CLB) - Indicates the 32-bit base physical
-		 * address for the command list for this port. This base is used when
-		 * fetching commands to execute. The structure pointed to by this
-		 * address range is 1K-bytes in length. This address must be 1K-byte
-		 * aligned as indicated by bits 09:00 being read only.
-		 */
-		unsigned int clb : 22;
-	};
-	uint32_t u32;
-} ahci_port_clb_t;
-
-/** AHCI Memory register Port x Command List Base Address Upper 32-Bits. */
-typedef struct {
-	/** Command List Base Address Upper (CLBU): Indicates the upper 32-bits
-	 * for the command list base physical address for this port. This base
-	 * is used when fetching commands to execute. This register shall
-	 * be read only for HBAs that do not support 64-bit addressing.
-	 */
-	uint32_t u32;
-} ahci_port_clbu_t;
-
-/** AHCI Memory register Port x FIS Base Address. */
-typedef union {
-	struct {
-		/** Reserved. */
-		unsigned int reserved : 8;
-		/** FIS Base Address (FB) - Indicates the 32-bit base physical address
-		 * for received FISes. The structure pointed to by this address range
-		 * is 256 bytes in length. This address must be 256-byte aligned as
-		 * indicated by bits 07:00 being read only. When FIS-based switching
-		 * is in use, this structure is 4KB in length and the address shall be
-		 * 4KB aligned.
-		 */
-		unsigned int fb : 24;
-	};
-	uint32_t u32;
-} ahci_port_fb_t;
-
-/** AHCI Memory register Port x FIS Base Address Upper 32-Bits. */
-typedef struct {
-	/** FIS Base Address Upper (FBU) - Indicates the upper 32-bits
-	 * for the received FIS base physical address for this port. This register
-	 * shall be read only for HBAs that do not support 64-bit addressing.
-	 */
-	uint32_t u32;
-} ahci_port_fbu_t;
-
-/** AHCI Memory register Port x Interrupt Status. */
-typedef uint32_t ahci_port_is_t;
-
-#define AHCI_PORT_IS_DHRS  (1 << 0)
-#define AHCI_PORT_IS_PSS   (1 << 1)
-#define AHCI_PORT_IS_DSS   (1 << 2)
-#define AHCI_PORT_IS_SDBS  (1 << 3)
-#define AHCI_PORT_IS_UFS   (1 << 4)
-#define AHCI_PORT_IS_DPS   (1 << 5)
-#define AHCI_PORT_IS_PCS   (1 << 6)
-#define AHCI_PORT_IS_DMPS  (1 << 7)
-
-#define AHCI_PORT_IS_PRCS  (1 << 22)
-#define AHCI_PORT_IS_IPMS  (1 << 23)
-#define AHCI_PORT_IS_OFS   (1 << 24)
-#define AHCI_PORT_IS_INFS  (1 << 26)
-#define AHCI_PORT_IS_IFS   (1 << 27)
-#define AHCI_PORT_IS_HDBS  (1 << 28)
-#define AHCI_PORT_IS_HBFS  (1 << 29)
-#define AHCI_PORT_IS_TFES  (1 << 30)
-#define AHCI_PORT_IS_CPDS  (1 << 31)
-
-#define AHCI_PORT_END_OF_OPERATION \
-	(AHCI_PORT_IS_DHRS | \
-	AHCI_PORT_IS_SDBS )
-
-#define AHCI_PORT_IS_ERROR \
-	(AHCI_PORT_IS_UFS | \
-	AHCI_PORT_IS_PCS | \
-	AHCI_PORT_IS_DMPS | \
-	AHCI_PORT_IS_PRCS | \
-	AHCI_PORT_IS_IPMS | \
-	AHCI_PORT_IS_OFS | \
-	AHCI_PORT_IS_INFS | \
-	AHCI_PORT_IS_IFS | \
-	AHCI_PORT_IS_HDBS | \
-	AHCI_PORT_IS_HBFS | \
-	AHCI_PORT_IS_TFES | \
-	AHCI_PORT_IS_CPDS)
-
-#define AHCI_PORT_IS_PERMANENT_ERROR \
-	(AHCI_PORT_IS_PCS | \
-	AHCI_PORT_IS_DMPS | \
-	AHCI_PORT_IS_PRCS | \
-	AHCI_PORT_IS_IPMS | \
-	AHCI_PORT_IS_CPDS )
-
-/** Evaluate end of operation status from port interrupt status.
- *
- * @param port_is Value of port interrupt status.
- *
- * @return Indicate end of operation status.
- *
- */
-static inline int ahci_port_is_end_of_operation(ahci_port_is_t port_is)
-{
-	return port_is & AHCI_PORT_END_OF_OPERATION;
-}
-
-/** Evaluate error status from port interrupt status.
- *
- * @param port_is Value of port interrupt status.
- *
- * @return Indicate error status.
- *
- */
-static inline int ahci_port_is_error(ahci_port_is_t port_is)
-{
-	return port_is & AHCI_PORT_IS_ERROR;
-}
-
-/** Evaluate permanent error status from port interrupt status.
- *
- * @param port_is Value of port interrupt status.
- *
- * @return Indicate permanent error status.
- *
- */
-static inline int ahci_port_is_permanent_error(ahci_port_is_t port_is)
-{
-	return port_is & AHCI_PORT_IS_PERMANENT_ERROR;
-}
-
-/** Evaluate task file error status from port interrupt status.
- *
- * @param port_is Value of port interrupt status.
- *
- * @return Indicate error status.
- *
- */
-static inline int ahci_port_is_tfes(ahci_port_is_t port_is)
-{
-	return port_is & AHCI_PORT_IS_TFES;
-}
-
-/** AHCI Memory register Port x Interrupt Enable. */
-typedef union {
-	struct {
-		/** Device to Host Register FIS Interrupt Enable. */
-		unsigned int dhre : 1;
-		/** PIO Setup FIS Interrupt Enable. */
-		unsigned int pse : 1;
-		/** DMA Setup FIS Interrupt Enable. */
-		unsigned int dse : 1;
-		/** Set Device Bits Interrupt Eenable. */
-		unsigned int sdbe : 1;
-		/** Unknown FIS Interrupt Enable. */
-		unsigned int ufe : 1;
-		/** Descriptor Processed Interrupt Enable. */
-		unsigned int dpe : 1;
-		/** Port Change Interrupt Enable. */
-		unsigned int pce : 1;
-		/** Device Mechanical Presence Enable. */
-		unsigned int dmpe : 1;
-		/** Reserved. */
-		unsigned int reserved1 : 14;
-		/** PhyRdy Change Interrupt Enable. */
-		unsigned int prce : 1;
-		/** Incorrect Port Multiplier Enable. */
-		unsigned int ipme : 1;
-		/** Overflow Status Enable. */
-		unsigned int ofe : 1;
-		/** Reserved. */
-		unsigned int reserved2 : 1;
-		/** Interface Non-fatal Error Enable. */
-		unsigned int infe : 1;
-		/** Interface Fatal Error Enable. */
-		unsigned int ife : 1;
-		/** Host Bus Data Error Enable. */
-		unsigned int hbde : 1;
-		/** Host Bus Fatal Error Enable. */
-		unsigned int hbfe : 1;
-		/** Task File Error Enable. */
-		unsigned int tfee : 1;
-		/** Cold Port Detect Enable. */
-		unsigned int cpde : 1;
-	};
-	uint32_t u32;
-} ahci_port_ie_t;
-
-/** AHCI Memory register Port x Command and Status. */
-typedef union {
-	struct {
-		/** Start - when set, the HBA may process the command list. */
-		unsigned int st : 1;
-		/** Spin-Up Device. */
-		unsigned int sud : 1;
-		/** Power On Device. */
-		unsigned int pod : 1;
-		/** Command List Override. */
-		unsigned int clo : 1;
-		/** FIS Receive Enable. */
-		unsigned int fre : 1;
-		/** Reserved. */
-		unsigned int reserved : 3;
-		/** Current Command Slot. */
-		unsigned int ccs : 5;
-		/** Mechanical Presence Switch State. */
-		unsigned int mpss : 1;
-		/** FIS Receive Running. */
-		unsigned int fr : 1;
-		/** Command List Running. */
-		unsigned int cr : 1;
-		/** Cold Presence State. */
-		unsigned int cps : 1;
-		/** Port Multiplier Attached. */
-		unsigned int pma : 1;
-		/** Hot Plug Capable Port. */
-		unsigned int hpcp : 1;
-		/** Mechanical Presence Switch Attached to Port. */
-		unsigned int mpsp : 1;
-		/** Cold Presence Detection. */
-		unsigned int cpd : 1;
-		/** External SATA Port. */
-		unsigned int esp : 1;
-		/** FIS-based Switching Capable Port. */
-		unsigned int fbscp : 1;
-		/** Automatic Partial to Slumber Transitions Enabled. */
-		unsigned int apste : 1;
-		/** Device is ATAPI. */
-		unsigned int atapi : 1;
-		/** Drive LED on ATAPI Enable. */
-		unsigned int dlae : 1;
-		/** Aggressive Link Power Management Enable. */
-		unsigned int alpe : 1;
-		/** Aggressive Slumber / Partial. */
-		unsigned int asp : 1;
-		/** Interface Communication Control.
-		 * Values:
-		 * 7h - fh Reserved,
-		 * 6h Slumber - This shall cause the HBA to request a transition
-		 * of the interface to the Slumber state,
-		 * 3h - 5h Reserved,
-		 * 2h Partial - This shall cause the HBA to request a transition
-		 * of the interface to the Partial state,
-		 * 1h Active,
-		 * 0h No-Op / Idle.
-		 */
-		unsigned int icc : 4;
-	};
-	uint32_t u32;
-} ahci_port_cmd_t;
-
-/** AHCI Memory register Port x Task File Data. */
-typedef union {
-	struct {
-		/** Status (STS): Contains the latest copy of the task file
-		 * status register.
-		 */
-		uint8_t sts;
-		/** Error (ERR) - Contains the latest copy of the task file
-		 * error register.
-		 */
-		uint8_t err;
-		/** Reserved. */
-		uint16_t reserved;
-	};
-	uint32_t u32;
-} ahci_port_tfd_t;
-
-/** AHCI Memory register Port x Signature. */
-typedef union {
-	struct {
-		/** Sector Count Register */
-		uint8_t sector_count;
-		/** LBA Low Register */
-		uint8_t lba_lr;
-		/** LBA Mid Register */
-		uint8_t lba_mr;
-		/** LBA High Register */
-		uint8_t lba_hr;
-	};
-	uint32_t u32;
-} ahci_port_sig_t;
-
-/** AHCI Memory register Port x Serial ATA Status (SCR0: SStatus). */
-typedef union {
-	struct {
-		/** Device Detection */
-		unsigned int det : 4;
-		/** Current Interface Speed */
-		unsigned int spd : 4;
-		/** Interface Power Management */
-		unsigned int ipm : 4;
-		/** Reserved. */
-		unsigned int reserved : 20;
-	};
-	uint32_t u32;
-} ahci_port_ssts_t;
-
-/** Device detection active status. */
-#define AHCI_PORT_SSTS_DET_ACTIVE  3
-
-/** AHCI Memory register Port x Serial ATA Control (SCR2: SControl). */
-typedef union {
-	struct {
-		/** Device Detection Initialization */
-		unsigned int det : 4;
-		/** Speed Allowed */
-		unsigned int spd : 4;
-		/** Interface Power Management Transitions Allowed */
-		unsigned int ipm : 4;
-		/** Reserved. */
-		unsigned int reserved : 20;
-	};
-	uint32_t u32;
-} ahci_port_sctl_t;
-
-/** AHCI Memory register Port x Port x Serial ATA Error (SCR1: SError). */
-typedef struct {
-	/** Error (ERR) - The ERR field contains error information for use
-	 * by host software in determining the appropriate response to the
-	 * error condition.
-	 */
-	uint16_t err;
-	/** Diagnostics (DIAG) - Contains diagnostic error information for use
-	 * by diagnostic software in validating correct operation or isolating
-	 * failure modes.
-	 */
-	uint16_t diag;
-} ahci_port_serr_t;
-
-/** AHCI Memory register Port x Serial ATA Active (SCR3: SActive). */
-typedef struct {
-	/** Device Status - Each bit corresponds to the TAG and
-	 * command slot of a native queued command, where bit 0 corresponds
-	 * to TAG 0 and command slot 0.
-	 */
-	uint32_t u32;
-} ahci_port_sact_t;
-
-/** AHCI Memory register Port x Command Issue. */
-typedef struct {
-	/** Commands Issued - Each bit corresponds to a command slot,
-	 *  where bit 0 corresponds to command slot 0.
-	 */
-	uint32_t u32;
-} ahci_port_ci_t;
-
-/** AHCI Memory register Port x Serial ATA Notification
- * (SCR4: SNotification).
- */
-typedef struct {
-	/** PM Notify (PMN): This field indicates whether a particular device with
-	 * the corresponding PM Port number issued a Set Device Bits FIS
-	 * to the host with the Notification bit set.
-	 */
-	uint16_t pmn;
-	/** Reserved. */
-	uint16_t reserved;
-} ahci_port_sntf_t;
-
-/** AHCI Memory register Port x FIS-based Switching Control.
- * This register is used to control and obtain status
- * for Port Multiplier FIS-based switching.
- */
-typedef union {
-	struct {
-		/** Enable */
-		unsigned int en : 1;
-		/** Device Error Clear */
-		unsigned int dec : 1;
-		/** Single Device Error */
-		unsigned int sde : 1;
-		/** Reserved. */
-		unsigned int reserved1 : 5;
-		/** Device To Issue */
-		unsigned int dev : 1;
-		/** Active Device Optimization */
-		unsigned int ado : 1;
-		/** Device With Error */
-		unsigned int dwe : 1;
-		/** Reserved. */
-		unsigned int reserved2 : 1;
-	};
-	uint32_t u32;
-} ahci_port_fbs_t;
-
-/** AHCI Memory register Port. */
-typedef volatile struct {
-	/** Port x Command List Base Address. */
-	uint32_t pxclb;
-	/** Port x Command List Base Address Upper 32-Bits. */
-	uint32_t pxclbu;
-	/** Port x FIS Base Address. */
-	uint32_t pxfb;
-	/** Port x FIS Base Address Upper 32-Bits. */
-	uint32_t pxfbu;
-	/** Port x Interrupt Status. */
-	ahci_port_is_t pxis;
-	/** Port x Interrupt Enable. */
-	uint32_t pxie;
-	/** Port x Command and Status. */
-	uint32_t pxcmd;
-	/** Reserved. */
-	uint32_t reserved1;
-	/** Port x Task File Data. */
-	uint32_t pxtfd;
-	/**  Port x Signature. */
-	uint32_t pxsig;
-	/** Port x Serial ATA Status (SCR0: SStatus). */
-	uint32_t pxssts;
-	/** Port x Serial ATA Control (SCR2: SControl). */
-	uint32_t pxsctl;
-	/** Port x Serial ATA Error (SCR1: SError). */
-	uint32_t pxserr;
-	/** Port x Serial ATA Active (SCR3: SActive). */
-	uint32_t pxsact;
-	/** Port x Command Issue. */
-	uint32_t pxci;
-	/** Port x Serial ATA Notification (SCR4: SNotification). */
-	uint32_t pxsntf;
-	/** Port x FIS-based Switching Control. */
-	uint32_t pxfbs;
-	/** Reserved. */
-	uint32_t reserved2[11];
-	/** Port x Vendor Specific. */
-	uint32_t pxvs[4];
-} ahci_port_t;
-
-/** AHCI Memory Registers. */
-typedef volatile struct {
-	/** Generic Host Control. */
-	ahci_ghc_t ghc;
-	/** Reserved. */
-	uint32_t reserved[13];
-	/** Reserved for NVMHCI. */
-	uint32_t reservedfornvmhci[16];
-	/** Vendor Specific registers. */
-	uint32_t vendorspecificsregs[24];
-	/** Ports. */
-	ahci_port_t ports[AHCI_MAX_PORTS];
-} ahci_memregs_t;
-
-/** AHCI Command header entry.
- *
- * This structure is not an AHCI register.
- *
- */
-typedef volatile struct {
-	/** Flags. */
-	uint16_t flags;
-	/** Physical Region Descriptor Table Length. */
-	uint16_t prdtl;
-	/** Physical Region Descriptor Byte Count. */
-	uint32_t bytesprocessed;
-	/** Command Table Descriptor Base Address. */
-	uint32_t cmdtable;
-	/** Command Table Descriptor Base Address Upper 32-bits. */
-	uint32_t cmdtableu;
-} ahci_cmdhdr_t;
-
-/** Clear Busy upon R_OK (C) flag. */
-#define AHCI_CMDHDR_FLAGS_CLEAR_BUSY_UPON_OK  0x0400
-
-/** Write operation flag. */
-#define AHCI_CMDHDR_FLAGS_WRITE  0x0040
-
-/** 2 DW length command flag. */
-#define AHCI_CMDHDR_FLAGS_2DWCMD  0x0002
-
-/** 5 DW length command flag. */
-#define AHCI_CMDHDR_FLAGS_5DWCMD  0x0005
-
-/** AHCI Command Physical Region Descriptor entry.
- *
- * This structure is not an AHCI register.
- *
- */
-typedef volatile struct {
-	/** Word aligned 32-bit data base address. */
-	uint32_t data_address_low;
-	/** Upper data base address, valid only for 64-bit HBA addressing. */
-	uint32_t data_address_upper;
-	/** Reserved. */
-	uint32_t reserved1;
-	/** Data byte count */
-	unsigned int dbc : 22;
-	/** Reserved */
-	unsigned int reserved2 : 9;
-	/** Set Interrupt on each operation completion */
-	unsigned int ioc : 1;
-} ahci_cmd_prdt_t;
-
-#endif
Index: pace/drv/block/ahci/ahci_sata.h
===================================================================
--- uspace/drv/block/ahci/ahci_sata.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,283 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Header for AHCI driver (SATA/ATA and related things).
- */
-
-#ifndef __AHCI_SATA_H__
-#define __AHCI_SATA_H__
-
-#include <stdint.h>
-
-/*
- * SATA Buffer Lengths
- */
-
-/** Default sector size in bytes. */
-#define SATA_DEFAULT_SECTOR_SIZE  512
-
-/** Size for set feature command buffer in bytes. */
-#define SATA_SET_FEATURE_BUFFER_LENGTH  512
-
-/** Size for indentify (packet) device buffer in bytes. */
-#define SATA_IDENTIFY_DEVICE_BUFFER_LENGTH  512
-
-/*
- * SATA Fis Frames
- */
-
-/** Sata FIS Type number. */
-#define SATA_CMD_FIS_TYPE  0x27
-
-/** Sata FIS Type command indicator. */
-#define SATA_CMD_FIS_COMMAND_INDICATOR  0x80
-
-/** Standard Command frame. */
-typedef struct {
-	/** FIS type - always SATA_CMD_FIS_TYPE. */
-	unsigned int fis_type : 8;
-	/** Indicate that FIS is a Command - always SATA_CMD_FIS_COMMAND_INDICATOR. */
-	unsigned int c : 8;
-	/** Command - Identity device - 0xec, Set fetures - 0xef. */
-	unsigned int command : 8;
-	/** Features - subcommand for set features - set tranfer mode - 0x03. */
-	unsigned int features : 8;
-	/** 0:23 bits of LBA. */
-	unsigned int lba_lower : 24;
-	/** Device. */
-	unsigned int device : 8;
-	/** 24:47 bits of LBA. */
-	unsigned int lba_upper : 24;
-	/** Features - subcommand for set features - set tranfer mode - 0x03. */
-	unsigned int features_upper : 8;
-	/** Sector count - transfer mode for set transfer mode operation. */
-	unsigned int count : 16;
-	/** Reserved. */
-	unsigned int reserved1 : 8;
-	/** Control. */
-	unsigned int control : 8;
-	/** Reserved. */
-	unsigned int reserved2 : 32;
-} sata_std_command_frame_t;
-
-/** Command frame for NCQ data operation. */
-typedef struct {
-	/** FIS type - always 0x27. */
-	uint8_t fis_type;
-	/** Indicate that FIS is a Command - always SATA_CMD_FIS_COMMAND_INDICATOR. */
-	uint8_t c;
-	/** Command - FPDMA Read - 0x60, FPDMA Write - 0x61. */
-	uint8_t command;
-	/** bits 7:0 of sector count. */
-	uint8_t sector_count_low;
-	/** bits 7:0 of lba. */
-	uint8_t lba0;
-	/** bits 15:8 of lba. */
-	uint8_t lba1;
-	/** bits 23:16 of lba. */
-	uint8_t lba2;
-	uint8_t fua;
-	/** bits 31:24 of lba. */
-	uint8_t lba3;
-	/** bits 39:32 of lba. */
-	uint8_t lba4;
-	/** bits 47:40 of lba. */
-	uint8_t lba5;
-	/** bits 15:8 of sector count. */
-	uint8_t sector_count_high;
-	/** Tag number of NCQ operation. */
-	uint8_t tag;
-	/** Reserved. */
-	uint8_t reserved1;
-	/** Reserved. */
-	uint8_t reserved2;
-	/** Control. */
-	uint8_t control;
-	/** Reserved. */
-	uint8_t reserved3;
-	/** Reserved. */
-	uint8_t reserved4;
-	/** Reserved. */
-	uint8_t reserved5;
-	/** Reserved. */
-	uint8_t reserved6;
-} sata_ncq_command_frame_t;
-
-/*
- * SATA Identify device
- */
-
-/** Data returned from identify device and identify packet device command. */
-typedef struct {
-	uint16_t gen_conf;
-	uint16_t cylinders;
-	uint16_t reserved2;
-	uint16_t heads;
-	uint16_t _vs4;
-	uint16_t _vs5;
-	uint16_t sectors;
-	uint16_t _vs7;
-	uint16_t _vs8;
-	uint16_t _vs9;
-
-	uint16_t serial_number[10];
-	uint16_t _vs20;
-	uint16_t _vs21;
-	uint16_t vs_bytes;
-	uint16_t firmware_rev[4];
-	uint16_t model_name[20];
-
-	uint16_t max_rw_multiple;
-	uint16_t reserved48;
-	/* Different meaning for packet device. */
-	uint16_t caps;
-	uint16_t reserved50;
-	uint16_t pio_timing;
-	uint16_t dma_timing;
-
-	uint16_t validity;
-	uint16_t cur_cyl;
-	uint16_t cur_heads;
-	uint16_t cur_sectors;
-	uint16_t cur_capacity0;
-	uint16_t cur_capacity1;
-	uint16_t mss;
-	uint16_t total_lba28_0;
-	uint16_t total_lba28_1;
-	uint16_t sw_dma;
-	uint16_t mw_dma;
-	uint16_t pio_modes;
-	uint16_t min_mw_dma_cycle;
-	uint16_t rec_mw_dma_cycle;
-	uint16_t min_raw_pio_cycle;
-	uint16_t min_iordy_pio_cycle;
-
-	uint16_t reserved69;
-	uint16_t reserved70;
-	uint16_t reserved71;
-	uint16_t reserved72;
-	uint16_t reserved73;
-	uint16_t reserved74;
-
-	uint16_t queue_depth;
-	/** SATA capatibilities - different meaning for packet device. */
-	uint16_t sata_cap;
-	/** SATA additional capatibilities - different meaning for packet device. */
-	uint16_t sata_cap2;
-	uint16_t reserved78[1 + 79 - 78];
-	uint16_t version_maj;
-	uint16_t version_min;
-	uint16_t cmd_set0;
-	uint16_t cmd_set1;
-	uint16_t csf_sup_ext;
-	uint16_t csf_enabled0;
-	uint16_t csf_enabled1;
-	uint16_t csf_default;
-	uint16_t udma;
-
-	uint16_t reserved89[1 + 99 - 89];
-
-	/* Total number of blocks in LBA-48 addressing. */
-	uint16_t total_lba48_0;
-	uint16_t total_lba48_1;
-	uint16_t total_lba48_2;
-	uint16_t total_lba48_3;
-
-	uint16_t reserved104[1 + 105 - 104];
-	uint16_t physical_logic_sector_size;
-	/* Note: more fields are defined in ATA/ATAPI-7. */
-	uint16_t reserved107[1 + 127 - 107];
-	uint16_t reserved128[1 + 159 - 128];
-	uint16_t reserved160[1 + 255 - 160];
-} sata_identify_data_t;
-
-/** Capability bits for register device. */
-enum sata_rd_caps {
-	sata_rd_cap_iordy = 0x0800,
-	sata_rd_cap_iordy_cbd = 0x0400,
-	sata_rd_cap_lba = 0x0200,
-	sata_rd_cap_dma = 0x0100
-};
-
-/** Bits of @c identify_data_t.cmd_set1. */
-enum sata_cs1 {
-	/** 48-bit address feature set. */
-	sata_cs1_addr48 = 0x0400
-};
-
-/** SATA capatibilities for not packet device - Serial ATA revision 3_1. */
-enum sata_np_caps {
-	/** Supports READ LOG DMA EXT. */
-	sata_np_cap_log_ext = 0x8000,
-	/** Supports Device Automatic Partial to Slumber transitions. */
-	sata_np_cap_dev_slm = 0x4000,
-	/** Supports Host Automatic Partial to Slumber transitions. */
-	sata_np_cap_host_slm = 0x2000,
-	/** Supports NCQ priority information. */
-	sata_np_cap_ncq_prio = 0x1000,
-	/** Supports Unload while NCQ command outstanding. */
-	sata_np_cap_unload_ncq = 0x0800,
-	/** Supports Phy event counters. */
-	sata_np_cap_phy_ctx = 0x0400,
-	/** Supports recepits of host-initiated interface power management. */
-	sata_np_cap_host_pmngmnt = 0x0200,
-
-	/** Supports NCQ. */
-	sata_np_cap_ncq = 0x0100,
-
-	/** Supports SATA 3. */
-	sata_np_cap_sata_3 = 0x0008,
-	/** Supports SATA 2. */
-	sata_np_cap_sata_2 = 0x0004,
-	/** Supports SATA 1. */
-	sata_np_cap_sata_1 = 0x0002
-};
-
-/** SATA capatibilities for packet device - Serial ATA revision 3_1. */
-enum sata_pt_caps {
-	/** Supports READ LOG DMA EXT. */
-	sata_pt_cap_log_ext = 0x8000,
-	/** Supports Device Automatic Partial to Slumber transitions. */
-	sata_pt_cap_dev_slm = 0x4000,
-	/** Supports Host Automatic Partial to Slumber transitions. */
-	sata_pt_cap_host_slm = 0x2000,
-	/** Supports Phy event counters. */
-	sata_pt_cap_phy_ctx = 0x0400,
-	/** Supports recepits of host-initiated interface power management. */
-	sata_pt_cap_host_pmngmnt = 0x0200,
-
-	/** Supports SATA 3. */
-	sata_pt_cap_sat_3 = 0x0008,
-	/** Supports SATA 2. */
-	sata_pt_cap_sat_2 = 0x0004,
-	/** Supports SATA 1. */
-	sata_pt_cap_sat_1 = 0x0002
-};
-
-#endif
Index: pace/drv/block/ahci/meson.build
===================================================================
--- uspace/drv/block/ahci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2012 Petr Jerman
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('ahci.c')
Index: pace/drv/block/ddisk/ddisk.c
===================================================================
--- uspace/drv/block/ddisk/ddisk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,615 +1,0 @@
-/*
- * Copyright (c) 2015 Jakub Jermar
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * MSIM ddisk block device driver
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <ddi.h>
-#include <bd_srv.h>
-#include <fibril_synch.h>
-#include <as.h>
-
-#define NAME	"ddisk"
-
-#define DDISK_FUN_NAME	"a"
-
-#define DDISK_BLOCK_SIZE	512
-
-#define DDISK_STAT_IRQ_PENDING	0x4
-#define DDISK_CMD_READ		0x1
-#define DDISK_CMD_WRITE		0x2
-#define DDISK_CMD_IRQ_DEASSERT	0x4
-
-static errno_t ddisk_dev_add(ddf_dev_t *);
-static errno_t ddisk_dev_remove(ddf_dev_t *);
-static errno_t ddisk_dev_gone(ddf_dev_t *);
-static errno_t ddisk_fun_online(ddf_fun_t *);
-static errno_t ddisk_fun_offline(ddf_fun_t *);
-
-static void ddisk_bd_connection(ipc_call_t *, void *);
-
-static void ddisk_irq_handler(ipc_call_t *, void *);
-
-static driver_ops_t driver_ops = {
-	.dev_add = ddisk_dev_add,
-	.dev_remove = ddisk_dev_remove,
-	.dev_gone = ddisk_dev_gone,
-	.fun_online = ddisk_fun_online,
-	.fun_offline = ddisk_fun_offline
-};
-
-static driver_t ddisk_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-typedef struct {
-	int irq;
-	uintptr_t base;
-} ddisk_res_t;
-
-typedef struct {
-	ioport32_t dma_buffer;
-	ioport32_t block;
-	union {
-		ioport32_t status;
-		ioport32_t command;
-	};
-	ioport32_t size;
-} ddisk_regs_t;
-
-typedef struct {
-	fibril_mutex_t lock;
-
-	fibril_condvar_t io_cv;
-	bool io_busy;
-
-	ssize_t size;
-	size_t blocks;
-
-	uintptr_t dma_buffer_phys;
-	void *dma_buffer;
-
-	ddf_dev_t *dev;
-	ddf_fun_t *fun;
-
-	ddisk_res_t ddisk_res;
-	ddisk_regs_t *ddisk_regs;
-
-	cap_irq_handle_t irq_cap;
-
-	bd_srvs_t bds;
-} ddisk_t;
-
-static errno_t ddisk_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t ddisk_bd_close(bd_srv_t *);
-static errno_t ddisk_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t ddisk_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
-    size_t);
-static errno_t ddisk_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t ddisk_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-bd_ops_t ddisk_bd_ops = {
-	.open = ddisk_bd_open,
-	.close = ddisk_bd_close,
-	.read_blocks = ddisk_bd_read_blocks,
-	.write_blocks = ddisk_bd_write_blocks,
-	.get_block_size = ddisk_bd_get_block_size,
-	.get_num_blocks = ddisk_bd_get_num_blocks,
-};
-
-irq_pio_range_t ddisk_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(ddisk_regs_t)
-	}
-};
-
-irq_cmd_t ddisk_irq_commands[] = {
-	{
-		.cmd = CMD_PIO_READ_32,
-		.addr = NULL,
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 1,
-		.value = DDISK_STAT_IRQ_PENDING,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 2,
-		.value = 2
-	},
-	{
-		/* Deassert the DMA interrupt. */
-		.cmd = CMD_PIO_WRITE_32,
-		.value = DDISK_CMD_IRQ_DEASSERT,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-irq_code_t ddisk_irq_code = {
-	.rangecount = 1,
-	.ranges = ddisk_irq_pio_ranges,
-	.cmdcount = sizeof(ddisk_irq_commands) / sizeof(irq_cmd_t),
-	.cmds = ddisk_irq_commands,
-};
-
-/** Ddisk IRQ handler.
- *
- * @param icall IRQ event notification
- * @param arg Argument (ddisk_t *)
- */
-void ddisk_irq_handler(ipc_call_t *icall, void *arg)
-{
-	ddf_msg(LVL_DEBUG, "ddisk_irq_handler(), status=%" PRIx32,
-	    (uint32_t) ipc_get_arg1(icall));
-
-	ddisk_t *ddisk = (ddisk_t *)arg;
-
-	fibril_mutex_lock(&ddisk->lock);
-	fibril_condvar_broadcast(&ddisk->io_cv);
-	fibril_mutex_unlock(&ddisk->lock);
-}
-
-errno_t ddisk_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-errno_t ddisk_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static errno_t ddisk_rw_block(ddisk_t *ddisk, bool read, aoff64_t ba, void *buf)
-{
-	fibril_mutex_lock(&ddisk->lock);
-
-	ddf_msg(LVL_DEBUG, "ddisk_rw_block(): read=%d, ba=%" PRId64 ", buf=%p",
-	    read, ba, buf);
-
-	if (ba >= ddisk->blocks)
-		return ELIMIT;
-
-	while (ddisk->io_busy)
-		fibril_condvar_wait(&ddisk->io_cv, &ddisk->lock);
-
-	ddisk->io_busy = true;
-
-	if (!read)
-		memcpy(ddisk->dma_buffer, buf, DDISK_BLOCK_SIZE);
-
-	pio_write_32(&ddisk->ddisk_regs->dma_buffer,
-	    ddisk->dma_buffer_phys);
-	pio_write_32(&ddisk->ddisk_regs->block, (uint32_t) ba);
-	pio_write_32(&ddisk->ddisk_regs->command,
-	    read ? DDISK_CMD_READ : DDISK_CMD_WRITE);
-
-	fibril_condvar_wait(&ddisk->io_cv, &ddisk->lock);
-
-	if (read)
-		memcpy(buf, ddisk->dma_buffer, DDISK_BLOCK_SIZE);
-
-	ddisk->io_busy = false;
-	fibril_condvar_signal(&ddisk->io_cv);
-	fibril_mutex_unlock(&ddisk->lock);
-
-	return EOK;
-}
-
-static errno_t ddisk_bd_rw_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    void *buf, size_t size, bool is_read)
-{
-	ddisk_t *ddisk = (ddisk_t *) bd->srvs->sarg;
-	aoff64_t i;
-	errno_t rc;
-
-	if (size < cnt * DDISK_BLOCK_SIZE)
-		return EINVAL;
-
-	for (i = 0; i < cnt; i++) {
-		rc = ddisk_rw_block(ddisk, is_read, ba + i,
-		    buf + i * DDISK_BLOCK_SIZE);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-errno_t ddisk_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	return ddisk_bd_rw_blocks(bd, ba, cnt, buf, size, true);
-}
-
-errno_t ddisk_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	return ddisk_bd_rw_blocks(bd, ba, cnt, (void *) buf, size, false);
-}
-
-errno_t ddisk_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	*rsize = DDISK_BLOCK_SIZE;
-	return EOK;
-}
-
-errno_t ddisk_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	ddisk_t *ddisk = (ddisk_t *) bd->srvs->sarg;
-
-	*rnb = ddisk->blocks;
-	return EOK;
-}
-
-static errno_t ddisk_get_res(ddf_dev_t *dev, ddisk_res_t *ddisk_res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if ((hw_res.mem_ranges.count != 1) || (hw_res.irqs.count != 1)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	addr_range_t *regs = &hw_res.mem_ranges.ranges[0];
-	ddisk_res->base = RNGABS(*regs);
-	ddisk_res->irq = hw_res.irqs.irqs[0];
-
-	if (RNGSZ(*regs) < sizeof(ddisk_regs_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	rc = EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t ddisk_fun_create(ddisk_t *ddisk)
-{
-	errno_t rc;
-	ddf_fun_t *fun = NULL;
-	bool bound = false;
-
-	fun = ddf_fun_create(ddisk->dev, fun_exposed, DDISK_FUN_NAME);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating DDF function.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Set up a connection handler. */
-	ddf_fun_set_conn_handler(fun, ddisk_bd_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding DDF function %s: %s",
-		    DDISK_FUN_NAME, str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "disk");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function %s to category "
-		    "'disk': %s.\n", DDISK_FUN_NAME, str_error(rc));
-		goto error;
-	}
-	ddisk->fun = fun;
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-
-	return rc;
-}
-
-static errno_t ddisk_fun_remove(ddisk_t *ddisk)
-{
-	errno_t rc;
-
-	if (ddisk->fun == NULL)
-		return EOK;
-
-	ddf_msg(LVL_DEBUG, "ddisk_fun_remove(%p, '%s')", ddisk,
-	    DDISK_FUN_NAME);
-	rc = ddf_fun_offline(ddisk->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.",
-		    DDISK_FUN_NAME);
-		goto error;
-	}
-
-	rc = ddf_fun_unbind(ddisk->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.",
-		    DDISK_FUN_NAME);
-		goto error;
-	}
-
-	ddf_fun_destroy(ddisk->fun);
-	ddisk->fun = NULL;
-	rc = EOK;
-
-error:
-	return rc;
-}
-
-static errno_t ddisk_fun_unbind(ddisk_t *ddisk)
-{
-	errno_t rc;
-
-	if (ddisk->fun == NULL)
-		return EOK;
-
-	ddf_msg(LVL_DEBUG, "ddisk_fun_unbind(%p, '%s')", ddisk,
-	    DDISK_FUN_NAME);
-	rc = ddf_fun_unbind(ddisk->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.",
-		    DDISK_FUN_NAME);
-		goto error;
-	}
-
-	ddf_fun_destroy(ddisk->fun);
-	ddisk->fun = NULL;
-	rc = EOK;
-
-error:
-	return rc;
-}
-
-/** Add new device
- *
- * @param  dev New device
- * @return     EOK on success or an error code.
- */
-static errno_t ddisk_dev_add(ddf_dev_t *dev)
-{
-	ddisk_t *ddisk;
-	ddisk_res_t res;
-	errno_t rc;
-
-	/*
-	 * Get our resources.
-	 */
-	rc = ddisk_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
-		return EINVAL;
-	}
-
-	/*
-	 * Allocate soft state.
-	 */
-	ddisk = ddf_dev_data_alloc(dev, sizeof(ddisk_t));
-	if (!ddisk) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/*
-	 * Initialize soft state.
-	 */
-	fibril_mutex_initialize(&ddisk->lock);
-	ddisk->dev = dev;
-	ddisk->ddisk_res = res;
-
-	fibril_condvar_initialize(&ddisk->io_cv);
-	ddisk->io_busy = false;
-
-	bd_srvs_init(&ddisk->bds);
-	ddisk->bds.ops = &ddisk_bd_ops;
-	ddisk->bds.sarg = ddisk;
-
-	ddisk->irq_cap = CAP_NIL;
-
-	/*
-	 * Enable access to ddisk's PIO registers.
-	 */
-	void *vaddr;
-	rc = pio_enable((void *) res.base, sizeof(ddisk_regs_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		goto error;
-	}
-	ddisk->ddisk_regs = vaddr;
-
-	ddisk->size = (int32_t) pio_read_32(&ddisk->ddisk_regs->size);
-	ddisk->blocks = ddisk->size / DDISK_BLOCK_SIZE;
-
-	if (ddisk->size <= 0) {
-		ddf_msg(LVL_WARN, "No disk detected.");
-		rc = EIO;
-		goto error;
-	}
-
-	/*
-	 * Allocate DMA buffer.
-	 */
-	ddisk->dma_buffer = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(DDISK_BLOCK_SIZE, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &ddisk->dma_buffer_phys,
-	    &ddisk->dma_buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot allocate DMA memory.");
-		goto error;
-	}
-
-	ddf_msg(LVL_NOTE, "Allocated DMA buffer at %p virtual and %p physical.",
-	    ddisk->dma_buffer, (void *) ddisk->dma_buffer_phys);
-
-	/*
-	 * Create an exposed function.
-	 */
-	rc = ddisk_fun_create(ddisk);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed initializing ddisk controller.");
-		rc = EIO;
-		goto error;
-	}
-
-	/*
-	 * Register IRQ handler.
-	 */
-	ddisk_regs_t *res_phys = (ddisk_regs_t *) res.base;
-	ddisk_irq_pio_ranges[0].base = res.base;
-	ddisk_irq_commands[0].addr = (void *) &res_phys->status;
-	ddisk_irq_commands[3].addr = (void *) &res_phys->command;
-	rc = register_interrupt_handler(dev, ddisk->ddisk_res.irq,
-	    ddisk_irq_handler, (void *)ddisk, &ddisk_irq_code, &ddisk->irq_cap);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
-		goto error;
-	}
-
-	/*
-	 * Success, report what we have found.
-	 */
-	ddf_msg(LVL_NOTE,
-	    "Device at %p with %zd blocks (%zuB) using interrupt %d",
-	    (void *) ddisk->ddisk_res.base, ddisk->blocks,
-	    ddisk->size, ddisk->ddisk_res.irq);
-
-	return EOK;
-
-error:
-	if (ddisk->ddisk_regs)
-		pio_disable(ddisk->ddisk_regs, sizeof(ddisk_regs_t));
-	if (ddisk->dma_buffer)
-		dmamem_unmap_anonymous(ddisk->dma_buffer);
-
-	return rc;
-}
-
-static errno_t ddisk_dev_remove_common(ddisk_t *ddisk, bool surprise)
-{
-	errno_t rc;
-
-	if (!surprise)
-		rc = ddisk_fun_remove(ddisk);
-	else
-		rc = ddisk_fun_unbind(ddisk);
-
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Unable to cleanup function '%s'.",
-		    DDISK_FUN_NAME);
-		return rc;
-	}
-
-	unregister_interrupt_handler(ddisk->dev, ddisk->irq_cap);
-
-	rc = pio_disable(ddisk->ddisk_regs, sizeof(ddisk_regs_t));
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Unable to disable PIO.");
-		return rc;
-	}
-
-	dmamem_unmap_anonymous(ddisk->dma_buffer);
-
-	return EOK;
-}
-
-static errno_t ddisk_dev_remove(ddf_dev_t *dev)
-{
-	ddisk_t *ddisk = (ddisk_t *) ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "ddisk_dev_remove(%p)", dev);
-	return ddisk_dev_remove_common(ddisk, false);
-}
-
-static errno_t ddisk_dev_gone(ddf_dev_t *dev)
-{
-	ddisk_t *ddisk = (ddisk_t *) ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "ddisk_dev_gone(%p)", dev);
-	return ddisk_dev_remove_common(ddisk, true);
-}
-
-static errno_t ddisk_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "ddisk_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t ddisk_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "ddisk_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-/** Block device connection handler */
-static void ddisk_bd_connection(ipc_call_t *icall, void *arg)
-{
-	ddisk_t *ddisk;
-	ddf_fun_t *fun = (ddf_fun_t *) arg;
-
-	ddisk = (ddisk_t *) ddf_dev_data_get(ddf_fun_get_dev(fun));
-	bd_conn(icall, &ddisk->bds);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS MSIM ddisk device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&ddisk_driver);
-}
Index: pace/drv/block/ddisk/ddisk.ma
===================================================================
--- uspace/drv/block/ddisk/ddisk.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 msim/ddisk
Index: pace/drv/block/ddisk/meson.build
===================================================================
--- uspace/drv/block/ddisk/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2013 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'scsi' ]
-src = files('ddisk.c')
Index: pace/drv/block/isa-ide/doc/doxygroups.h
===================================================================
--- uspace/drv/block/isa-ide/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup isa-ide isa-ide
- * @brief ISA IDE driver
- * @ingroup drvs
- */
Index: pace/drv/block/isa-ide/isa-ide.c
===================================================================
--- uspace/drv/block/isa-ide/isa-ide.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,525 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa-ide
- * @{
- */
-
-/**
- * @file
- * @brief ISA IDE driver
- */
-
-#include <ddi.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <async.h>
-#include <as.h>
-#include <fibril_synch.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-#include <inttypes.h>
-#include <errno.h>
-
-#include "isa-ide.h"
-#include "main.h"
-
-static errno_t isa_ide_init_io(isa_ide_channel_t *);
-static void isa_ide_fini_io(isa_ide_channel_t *);
-static errno_t isa_ide_init_irq(isa_ide_channel_t *);
-static void isa_ide_fini_irq(isa_ide_channel_t *);
-static void isa_ide_irq_handler(ipc_call_t *, void *);
-
-static void isa_ide_write_data_16(void *, uint16_t *, size_t);
-static void isa_ide_read_data_16(void *, uint16_t *, size_t);
-static void isa_ide_write_cmd_8(void *, uint16_t, uint8_t);
-static uint8_t isa_ide_read_cmd_8(void *, uint16_t);
-static void isa_ide_write_ctl_8(void *, uint16_t, uint8_t);
-static uint8_t isa_ide_read_ctl_8(void *, uint16_t);
-static errno_t isa_ide_irq_enable(void *);
-static errno_t isa_ide_irq_disable(void *);
-static errno_t isa_ide_add_device(void *, unsigned, void *);
-static errno_t isa_ide_remove_device(void *, unsigned);
-static void isa_ide_msg_debug(void *, char *);
-static void isa_ide_msg_note(void *, char *);
-static void isa_ide_msg_warn(void *, char *);
-static void isa_ide_msg_error(void *, char *);
-
-static const irq_pio_range_t isa_ide_irq_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(ata_cmd_t)
-	}
-};
-
-/** IDE interrupt pseudo code. */
-static const irq_cmd_t isa_ide_irq_cmds[] = {
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Initialize ISA IDE channel. */
-errno_t isa_ide_channel_init(isa_ide_ctrl_t *ctrl, isa_ide_channel_t *chan,
-    unsigned chan_id, isa_ide_hwres_t *res)
-{
-	errno_t rc;
-	bool irq_inited = false;
-	ata_params_t params;
-
-	ddf_msg(LVL_DEBUG, "isa_ide_channel_init()");
-
-	memset(&params, 0, sizeof(params));
-
-	chan->ctrl = ctrl;
-	chan->chan_id = chan_id;
-	fibril_mutex_initialize(&chan->lock);
-	if (chan_id == 0) {
-		chan->cmd_physical = res->cmd1;
-		chan->ctl_physical = res->ctl1;
-		chan->irq = res->irq1;
-	} else {
-		chan->cmd_physical = res->cmd2;
-		chan->ctl_physical = res->ctl2;
-		chan->irq = res->irq2;
-	}
-
-	ddf_msg(LVL_NOTE, "I/O address %p/%p", (void *) chan->cmd_physical,
-	    (void *) chan->ctl_physical);
-
-	ddf_msg(LVL_DEBUG, "Init I/O");
-	rc = isa_ide_init_io(chan);
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "Init IRQ");
-	rc = isa_ide_init_irq(chan);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "init IRQ failed");
-		return rc;
-	}
-
-	irq_inited = true;
-
-	ddf_msg(LVL_DEBUG, "isa_ide_channel_init(): Initialize IDE channel");
-
-	params.arg = (void *)chan;
-	params.use_dma = false;
-	params.have_irq = (chan->irq >= 0) ? true : false;
-	params.write_data_16 = isa_ide_write_data_16;
-	params.read_data_16 = isa_ide_read_data_16;
-	params.write_cmd_8 = isa_ide_write_cmd_8;
-	params.read_cmd_8 = isa_ide_read_cmd_8;
-	params.write_ctl_8 = isa_ide_write_ctl_8;
-	params.read_ctl_8 = isa_ide_read_ctl_8;
-	params.irq_enable = isa_ide_irq_enable;
-	params.irq_disable = isa_ide_irq_disable;
-	params.add_device = isa_ide_add_device;
-	params.remove_device = isa_ide_remove_device;
-	params.msg_debug = isa_ide_msg_debug;
-	params.msg_note = isa_ide_msg_note;
-	params.msg_warn = isa_ide_msg_warn;
-	params.msg_error = isa_ide_msg_error;
-
-	rc = ata_channel_create(&params, &chan->channel);
-	if (rc != EOK)
-		goto error;
-
-	rc = ata_channel_initialize(chan->channel);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "isa_ide_channel_init: DONE");
-	return EOK;
-error:
-	if (chan->channel != NULL) {
-		(void) ata_channel_destroy(chan->channel);
-		chan->channel = NULL;
-	}
-	if (irq_inited)
-		isa_ide_fini_irq(chan);
-	isa_ide_fini_io(chan);
-	return rc;
-}
-
-/** Finalize ISA IDE channel. */
-errno_t isa_ide_channel_fini(isa_ide_channel_t *chan)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, ": isa_ide_channel_fini()");
-
-	fibril_mutex_lock(&chan->lock);
-
-	rc = ata_channel_destroy(chan->channel);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return rc;
-	}
-
-	isa_ide_fini_irq(chan);
-	isa_ide_fini_io(chan);
-	fibril_mutex_unlock(&chan->lock);
-
-	return EOK;
-}
-
-/** Quiesce ISA IDE channel. */
-void isa_ide_channel_quiesce(isa_ide_channel_t *chan)
-{
-	ddf_msg(LVL_DEBUG, ": isa_ide_channel_quiesce()");
-
-	fibril_mutex_lock(&chan->lock);
-	ata_channel_quiesce(chan->channel);
-	fibril_mutex_unlock(&chan->lock);
-}
-
-/** Enable device I/O. */
-static errno_t isa_ide_init_io(isa_ide_channel_t *chan)
-{
-	errno_t rc;
-	void *vaddr;
-
-	rc = pio_enable((void *) chan->cmd_physical, sizeof(ata_cmd_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	chan->cmd = vaddr;
-
-	rc = pio_enable((void *) chan->ctl_physical, sizeof(ata_ctl_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	chan->ctl = vaddr;
-	return EOK;
-}
-
-/** Clean up device I/O. */
-static void isa_ide_fini_io(isa_ide_channel_t *chan)
-{
-	(void) chan;
-	/* XXX TODO */
-}
-
-/** Initialize IRQ. */
-static errno_t isa_ide_init_irq(isa_ide_channel_t *chan)
-{
-	irq_code_t irq_code;
-	irq_pio_range_t *ranges;
-	irq_cmd_t *cmds;
-	errno_t rc;
-
-	if (chan->irq < 0)
-		return EOK;
-
-	ranges = malloc(sizeof(isa_ide_irq_ranges));
-	if (ranges == NULL)
-		return ENOMEM;
-
-	cmds = malloc(sizeof(isa_ide_irq_cmds));
-	if (cmds == NULL) {
-		free(cmds);
-		return ENOMEM;
-	}
-
-	memcpy(ranges, &isa_ide_irq_ranges, sizeof(isa_ide_irq_ranges));
-	ranges[0].base = chan->cmd_physical;
-	memcpy(cmds, &isa_ide_irq_cmds, sizeof(isa_ide_irq_cmds));
-	cmds[0].addr = &chan->cmd->status;
-
-	irq_code.rangecount = sizeof(isa_ide_irq_ranges) / sizeof(irq_pio_range_t);
-	irq_code.ranges = ranges;
-	irq_code.cmdcount = sizeof(isa_ide_irq_cmds) / sizeof(irq_cmd_t);
-	irq_code.cmds = cmds;
-
-	ddf_msg(LVL_NOTE, "IRQ %d", chan->irq);
-	rc = register_interrupt_handler(chan->ctrl->dev, chan->irq,
-	    isa_ide_irq_handler, (void *)chan, &irq_code, &chan->ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ.");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Interrupt handler registered");
-	free(ranges);
-	free(cmds);
-	return EOK;
-error:
-	free(ranges);
-	free(cmds);
-	return rc;
-}
-
-/** Clean up IRQ. */
-static void isa_ide_fini_irq(isa_ide_channel_t *chan)
-{
-	errno_t rc;
-	async_sess_t *parent_sess;
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_disable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Error disabling IRQ.");
-
-	(void) unregister_interrupt_handler(chan->ctrl->dev, chan->ihandle);
-}
-
-/** Interrupt handler.
- *
- * @param call Call data
- * @param arg Argument (isa_ide_channel_t *)
- */
-static void isa_ide_irq_handler(ipc_call_t *call, void *arg)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	uint8_t status;
-	async_sess_t *parent_sess;
-
-	status = ipc_get_arg1(call);
-	ata_channel_irq(chan->channel, status);
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-	hw_res_clear_interrupt(parent_sess, chan->irq);
-}
-
-/** Write the data register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param data Data
- * @param nwords Number of words to write
- */
-static void isa_ide_write_data_16(void *arg, uint16_t *data, size_t nwords)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	size_t i;
-
-	for (i = 0; i < nwords; i++)
-		pio_write_16(&chan->cmd->data_port, data[i]);
-}
-
-/** Read the data register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param buf Destination buffer
- * @param nwords Number of words to read
- */
-static void isa_ide_read_data_16(void *arg, uint16_t *buf, size_t nwords)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	size_t i;
-
-	for (i = 0; i < nwords; i++)
-		buf[i] = pio_read_16(&chan->cmd->data_port);
-}
-
-/** Write command register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param off Register offset
- * @param value Value to write to command register
- */
-static void isa_ide_write_cmd_8(void *arg, uint16_t off, uint8_t value)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-
-	pio_write_8(((ioport8_t *)chan->cmd) + off, value);
-}
-
-/** Read command register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param off Register offset
- * @return value Value read from command register
- */
-static uint8_t isa_ide_read_cmd_8(void *arg, uint16_t off)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-
-	return pio_read_8(((ioport8_t *)chan->cmd) + off);
-}
-
-/** Write control register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param off Register offset
- * @param value Value to write to control register
- */
-static void isa_ide_write_ctl_8(void *arg, uint16_t off, uint8_t value)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-
-	pio_write_8(((ioport8_t *)chan->ctl) + off, value);
-}
-
-/** Read control register callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param off Register offset
- * @return value Value read from control register
- */
-static uint8_t isa_ide_read_ctl_8(void *arg, uint16_t off)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-
-	return pio_read_8(((ioport8_t *)chan->ctl) + off);
-}
-
-/** Enable IRQ callback handler
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @return EOK on success or an error code
- */
-static errno_t isa_ide_irq_enable(void *arg)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Enable IRQ %d for channel %u",
-	    chan->irq, chan->chan_id);
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_enable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling IRQ.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Disable IRQ callback handler
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @return EOK on success or an error code
- */
-static errno_t isa_ide_irq_disable(void *arg)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Disable IRQ");
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_disable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error disabling IRQ.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Add ATA device callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param idx Device index
- * $param charg Connection handler argument
- * @return EOK on success or an error code
- */
-static errno_t isa_ide_add_device(void *arg, unsigned idx, void *charg)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	return isa_ide_fun_create(chan, idx, charg);
-}
-
-/** Remove ATA device callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param idx Device index
- * @return EOK on success or an error code
- */
-static errno_t isa_ide_remove_device(void *arg, unsigned idx)
-{
-	isa_ide_channel_t *chan = (isa_ide_channel_t *)arg;
-	return isa_ide_fun_remove(chan, idx);
-}
-
-/** Debug message callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param msg Message
- */
-static void isa_ide_msg_debug(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_DEBUG, "%s", msg);
-}
-
-/** Notice message callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param msg Message
- */
-static void isa_ide_msg_note(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_NOTE, "%s", msg);
-}
-
-/** Warning message callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param msg Message
- */
-static void isa_ide_msg_warn(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_WARN, "%s", msg);
-}
-
-/** Error message callback handler.
- *
- * @param arg Argument (isa_ide_channel_t *)
- * @param msg Message
- */
-static void isa_ide_msg_error(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_ERROR, "%s", msg);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/isa-ide/isa-ide.h
===================================================================
--- uspace/drv/block/isa-ide/isa-ide.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa-ide
- * @{
- */
-/** @file ISA IDE driver definitions.
- */
-
-#ifndef ISA_IDE_H
-#define ISA_IDE_H
-
-#include <ata/ata.h>
-#include <ata/ata_hw.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#define NAME "isa-ide"
-
-/** ISA IDE hardware resources */
-typedef struct {
-	uintptr_t cmd1;	/**< Primary channel command block base address. */
-	uintptr_t ctl1;	/**< Primary channel control block base address. */
-	uintptr_t cmd2;	/**< Secondary channel command block base address. */
-	uintptr_t ctl2;	/**< Secondary channel control block base address. */
-	int irq1;	/**< Primary channel IRQ */
-	int irq2;	/**< Secondary channel IRQ */
-} isa_ide_hwres_t;
-
-/** ISA IDE channel */
-typedef struct isa_ide_channel {
-	/** Parent controller */
-	struct isa_ide_ctrl *ctrl;
-	/** I/O base address of the command registers */
-	uintptr_t cmd_physical;
-	/** I/O base address of the control registers */
-	uintptr_t ctl_physical;
-
-	/** Command registers */
-	ata_cmd_t *cmd;
-	/** Control registers */
-	ata_ctl_t *ctl;
-	/** IRQ (-1 if not used) */
-	int irq;
-	/** IRQ handle */
-	cap_irq_handle_t ihandle;
-
-	/** Synchronize controller access */
-	fibril_mutex_t lock;
-	/** Value of status register read by interrupt handler */
-	uint8_t irq_status;
-
-	/** Libata ATA channel */
-	ata_channel_t *channel;
-	struct isa_ide_fun *fun[2];
-
-	/** Channel ID */
-	unsigned chan_id;
-} isa_ide_channel_t;
-
-/** ISA IDE controller */
-typedef struct isa_ide_ctrl {
-	/** DDF device */
-	ddf_dev_t *dev;
-
-	/** Primary and secondary channel */
-	isa_ide_channel_t channel[2];
-} isa_ide_ctrl_t;
-
-/** ISA IDE function */
-typedef struct isa_ide_fun {
-	ddf_fun_t *fun;
-	void *charg;
-} isa_ide_fun_t;
-
-extern errno_t isa_ide_channel_init(isa_ide_ctrl_t *, isa_ide_channel_t *,
-    unsigned, isa_ide_hwres_t *);
-extern errno_t isa_ide_channel_fini(isa_ide_channel_t *);
-extern void isa_ide_channel_quiesce(isa_ide_channel_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/isa-ide/isa-ide.ma
===================================================================
--- uspace/drv/block/isa-ide/isa-ide.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/ide
Index: pace/drv/block/isa-ide/isa-ide_hw.h
===================================================================
--- uspace/drv/block/isa-ide/isa-ide_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-/** @file ISA IDE hardware protocol
- */
-
-#ifndef ISA_IDE_HW_H
-#define ISA_IDE_HW_H
-
-/*
- * PCI IDE needs to use ATA ports at fixed legacy ISA addresses.
- * We need to know what those addresses are so that, if we are
- * asked to attach to those *and* we know that PCI IDE is attached
- * to legacy IDE ranges, we should not attach.
- */
-enum {
-	leg_ide_ata_cmd_p = 0x01f0,
-	leg_ide_ata_ctl_p = 0x03f4,
-	leg_ide_ata_cmd_s = 0x0170,
-	leg_ide_ata_ctl_s = 0x0374
-};
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/isa-ide/main.c
===================================================================
--- uspace/drv/block/isa-ide/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,430 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa-ide
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-
-#include "isa-ide.h"
-#include "isa-ide_hw.h"
-#include "main.h"
-
-static errno_t isa_ide_dev_add(ddf_dev_t *dev);
-static errno_t isa_ide_dev_remove(ddf_dev_t *dev);
-static errno_t isa_ide_dev_gone(ddf_dev_t *dev);
-static errno_t isa_ide_dev_quiesce(ddf_dev_t *dev);
-static errno_t isa_ide_fun_online(ddf_fun_t *fun);
-static errno_t isa_ide_fun_offline(ddf_fun_t *fun);
-
-static void isa_ide_connection(ipc_call_t *, void *);
-
-static driver_ops_t driver_ops = {
-	.dev_add = isa_ide_dev_add,
-	.dev_remove = isa_ide_dev_remove,
-	.dev_gone = isa_ide_dev_gone,
-	.dev_quiesce = isa_ide_dev_quiesce,
-	.fun_online = isa_ide_fun_online,
-	.fun_offline = isa_ide_fun_offline
-};
-
-static driver_t isa_ide_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t isa_ide_get_res(ddf_dev_t *dev, isa_ide_hwres_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	hw_res_claims_t claims;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	rc = hw_res_query_legacy_io(parent_sess, &claims);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Error getting HW resource flags.");
-		return rc;
-	}
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Error getting HW resource list.");
-		return rc;
-	}
-
-	if (hw_res.io_ranges.count != 4) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* I/O ranges */
-
-	addr_range_t *cmd1_rng = &hw_res.io_ranges.ranges[0];
-	addr_range_t *ctl1_rng = &hw_res.io_ranges.ranges[1];
-	addr_range_t *cmd2_rng = &hw_res.io_ranges.ranges[2];
-	addr_range_t *ctl2_rng = &hw_res.io_ranges.ranges[3];
-	res->cmd1 = RNGABS(*cmd1_rng);
-	res->ctl1 = RNGABS(*ctl1_rng);
-	res->cmd2 = RNGABS(*cmd2_rng);
-	res->ctl2 = RNGABS(*ctl2_rng);
-
-	if (RNGSZ(*ctl1_rng) < sizeof(ata_ctl_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (RNGSZ(*cmd1_rng) < sizeof(ata_cmd_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (RNGSZ(*ctl2_rng) < sizeof(ata_ctl_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (RNGSZ(*cmd2_rng) < sizeof(ata_cmd_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* IRQ */
-	if (hw_res.irqs.count > 0) {
-		res->irq1 = hw_res.irqs.irqs[0];
-	} else {
-		res->irq1 = -1;
-	}
-
-	if (hw_res.irqs.count > 1) {
-		res->irq2 = hw_res.irqs.irqs[1];
-	} else {
-		res->irq2 = -1;
-	}
-
-	/*
-	 * Only attach to legacy ISA IDE register block if it
-	 * is not claimed by PCI IDE driver.
-	 */
-	if (res->cmd1 == leg_ide_ata_cmd_p &&
-	    res->cmd2 == leg_ide_ata_cmd_s &&
-	    (claims & hwc_isa_ide) != 0) {
-		ddf_msg(LVL_NOTE, "Will not attach to ISA legacy ports "
-		    "since they are already handled by PCI.");
-		return EBUSY;
-	}
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-/** Add new device
- *
- * @param  dev New device
- * @return     EOK on success or an error code.
- */
-static errno_t isa_ide_dev_add(ddf_dev_t *dev)
-{
-	isa_ide_ctrl_t *ctrl;
-	isa_ide_hwres_t res;
-	unsigned chans;
-	errno_t rc;
-
-	rc = isa_ide_get_res(dev, &res);
-	if (rc != EOK) {
-		if (rc == EINVAL)
-			ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
-		return EINVAL;
-	}
-
-	ctrl = ddf_dev_data_alloc(dev, sizeof(isa_ide_ctrl_t));
-	if (ctrl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ctrl->dev = dev;
-
-	chans = 0;
-
-	rc = isa_ide_channel_init(ctrl, &ctrl->channel[0], 0, &res);
-	if (rc == EOK)
-		++chans;
-	else if (rc != ENOENT)
-		goto error;
-
-	rc = isa_ide_channel_init(ctrl, &ctrl->channel[1], 1, &res);
-	if (rc == EOK)
-		++chans;
-	else if (rc != ENOENT)
-		goto error;
-
-	if (chans == 0) {
-		ddf_msg(LVL_ERROR, "No ISA IDE devices found.");
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-static char *isa_ide_fun_name(isa_ide_channel_t *chan, unsigned idx)
-{
-	char *fun_name;
-
-	if (asprintf(&fun_name, "c%ud%u", chan->chan_id, idx) < 0)
-		return NULL;
-
-	return fun_name;
-}
-
-errno_t isa_ide_fun_create(isa_ide_channel_t *chan, unsigned idx, void *charg)
-{
-	errno_t rc;
-	char *fun_name = NULL;
-	ddf_fun_t *fun = NULL;
-	isa_ide_fun_t *ifun = NULL;
-	bool bound = false;
-
-	fun_name = isa_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun = ddf_fun_create(chan->ctrl->dev, fun_exposed, fun_name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating DDF function.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Allocate soft state */
-	ifun = ddf_fun_data_alloc(fun, sizeof(isa_ide_fun_t));
-	if (ifun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating softstate.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ifun->fun = fun;
-	ifun->charg = charg;
-
-	/* Set up a connection handler. */
-	ddf_fun_set_conn_handler(fun, isa_ide_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding DDF function %s: %s",
-		    fun_name, str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "disk");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function %s to "
-		    "category 'disk': %s", fun_name, str_error(rc));
-		goto error;
-	}
-
-	free(fun_name);
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	if (fun_name != NULL)
-		free(fun_name);
-
-	return rc;
-}
-
-errno_t isa_ide_fun_remove(isa_ide_channel_t *chan, unsigned idx)
-{
-	errno_t rc;
-	char *fun_name;
-	isa_ide_fun_t *ifun = chan->fun[idx];
-
-	fun_name = isa_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "isa_ide_fun_remove(%p, '%s')", ifun, fun_name);
-	rc = ddf_fun_offline(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", fun_name);
-		goto error;
-	}
-
-	rc = ddf_fun_unbind(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
-		goto error;
-	}
-
-	ddf_fun_destroy(ifun->fun);
-	free(fun_name);
-	return EOK;
-error:
-	if (fun_name != NULL)
-		free(fun_name);
-	return rc;
-}
-
-errno_t isa_ide_fun_unbind(isa_ide_channel_t *chan, unsigned idx)
-{
-	errno_t rc;
-	char *fun_name;
-	isa_ide_fun_t *ifun = chan->fun[idx];
-
-	fun_name = isa_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "isa_ide_fun_unbind(%p, '%s')", ifun, fun_name);
-	rc = ddf_fun_unbind(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
-		goto error;
-	}
-
-	ddf_fun_destroy(ifun->fun);
-	free(fun_name);
-	return EOK;
-error:
-	if (fun_name != NULL)
-		free(fun_name);
-	return rc;
-}
-
-static errno_t isa_ide_dev_remove(ddf_dev_t *dev)
-{
-	isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "isa_ide_dev_remove(%p)", dev);
-
-	rc = isa_ide_channel_fini(&ctrl->channel[0]);
-	if (rc != EOK)
-		return rc;
-
-	rc = isa_ide_channel_fini(&ctrl->channel[1]);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t isa_ide_dev_gone(ddf_dev_t *dev)
-{
-	isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "isa_ide_dev_gone(%p)", dev);
-
-	rc = isa_ide_channel_fini(&ctrl->channel[0]);
-	if (rc != EOK)
-		return rc;
-
-	rc = isa_ide_channel_fini(&ctrl->channel[1]);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t isa_ide_dev_quiesce(ddf_dev_t *dev)
-{
-	isa_ide_ctrl_t *ctrl = (isa_ide_ctrl_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "isa_ide_dev_quiesce(%p)", dev);
-
-	isa_ide_channel_quiesce(&ctrl->channel[0]);
-	isa_ide_channel_quiesce(&ctrl->channel[1]);
-	return EOK;
-}
-
-static errno_t isa_ide_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "isa_ide_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t isa_ide_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "isa_ide_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-static void isa_ide_connection(ipc_call_t *icall, void *arg)
-{
-	isa_ide_fun_t *ifun;
-
-	ifun = (isa_ide_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
-	ata_connection(icall, ifun->charg);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS ISA IDE device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&isa_ide_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/isa-ide/main.h
===================================================================
--- uspace/drv/block/isa-ide/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa-ide
- * @{
- */
-/** @file ISA IDE driver main module
- */
-
-#ifndef MAIN_H
-#define MAIN_H
-
-#include "isa-ide.h"
-
-extern errno_t isa_ide_fun_create(isa_ide_channel_t *, unsigned, void *);
-extern errno_t isa_ide_fun_remove(isa_ide_channel_t *, unsigned);
-extern errno_t isa_ide_fun_unbind(isa_ide_channel_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/isa-ide/meson.build
===================================================================
--- uspace/drv/block/isa-ide/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ata', 'scsi' ]
-src = files('isa-ide.c', 'main.c')
Index: pace/drv/block/pc-floppy/doc/doxygroups.h
===================================================================
--- uspace/drv/block/pc-floppy/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pc-floppy pc-floppy
- * @brief PC Floppy Disk driver
- * @ingroup drvs
- */
Index: pace/drv/block/pc-floppy/main.c
===================================================================
--- uspace/drv/block/pc-floppy/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pc-floppy
- * @{
- */
-
-/** @file PC floppy disk driver main
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-
-#include "pc-floppy.h"
-
-static errno_t pc_fdc_dev_add(ddf_dev_t *dev);
-static errno_t pc_fdc_dev_remove(ddf_dev_t *dev);
-static errno_t pc_fdc_dev_gone(ddf_dev_t *dev);
-static errno_t pc_fdc_dev_quiesce(ddf_dev_t *dev);
-static errno_t pc_fdc_fun_online(ddf_fun_t *fun);
-static errno_t pc_fdc_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = pc_fdc_dev_add,
-	.dev_remove = pc_fdc_dev_remove,
-	.dev_gone = pc_fdc_dev_gone,
-	.dev_quiesce = pc_fdc_dev_quiesce,
-	.fun_online = pc_fdc_fun_online,
-	.fun_offline = pc_fdc_fun_offline
-};
-
-static driver_t pc_fdc_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-/** Parse FDC hardware resources.
- *
- * @param dev DDF device (from which we get resources)
- * @param res Place to store FDC hardware resources
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_get_res(ddf_dev_t *dev, pc_fdc_hwres_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.io_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* I/O range */
-
-	addr_range_t *regs_rng = &hw_res.io_ranges.ranges[0];
-	res->regs = RNGABS(*regs_rng);
-
-	if (RNGSZ(*regs_rng) < sizeof(pc_fdc_regs_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* IRQ */
-	if (hw_res.irqs.count > 0) {
-		res->irq = hw_res.irqs.irqs[0];
-	} else {
-		res->irq = -1;
-	}
-
-	/* DMA channel */
-	if (hw_res.dma_channels.count > 0) {
-		res->dma = hw_res.dma_channels.channels[0];
-		ddf_msg(LVL_NOTE, "DMA channel %u", res->dma);
-	} else {
-		res->dma = -1;
-	}
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-/** Add new FDC device
- *
- * @param dev New device
- * @return EOK on success or an error code.
- */
-static errno_t pc_fdc_dev_add(ddf_dev_t *dev)
-{
-	pc_fdc_t *fdc;
-	pc_fdc_hwres_t res;
-	errno_t rc;
-
-	rc = pc_fdc_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
-		return EINVAL;
-	}
-
-	rc = pc_fdc_create(dev, &res, &fdc);
-	if (rc == ENOENT)
-		goto error;
-
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed initializing floppy drive "
-		    "controller.");
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Remove FDC device.
- *
- * @param dev Device
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_dev_remove(ddf_dev_t *dev)
-{
-	pc_fdc_t *fdc = (pc_fdc_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_dev_remove(%p)", dev);
-
-	rc = pc_fdc_destroy(fdc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Suprise removal of FDC device.
- *
- * @param dev Device
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_dev_gone(ddf_dev_t *dev)
-{
-	(void)dev;
-	return ENOTSUP;
-}
-
-/** Quiesce FDC device.
- *
- * @param dev Device
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_dev_quiesce(ddf_dev_t *dev)
-{
-	pc_fdc_t *fdc = (pc_fdc_t *)ddf_dev_data_get(dev);
-	pc_fdc_quiesce(fdc);
-	return EOK;
-}
-
-/** Online FDC function.
- *
- * @param fun DDF function
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pc_fdc_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-/** Offline FDC function.
- *
- * @param fun DDF function
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pc_fdc_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS PC floppy disk driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&pc_fdc_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/pc-floppy/meson.build
===================================================================
--- uspace/drv/block/pc-floppy/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('pc-floppy.c', 'main.c')
Index: pace/drv/block/pc-floppy/pc-floppy.c
===================================================================
--- uspace/drv/block/pc-floppy/pc-floppy.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1114 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pc-floppy
- * @{
- */
-
-/**
- * @file
- * @brief PC floppy disk driver
- */
-
-#include <bd_srv.h>
-#include <ddi.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <async.h>
-#include <as.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <macros.h>
-#include <perf.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <errno.h>
-
-#include "pc-floppy.h"
-
-static errno_t pc_fdc_init_io(pc_fdc_t *);
-static void pc_fdc_fini_io(pc_fdc_t *);
-static errno_t pc_fdc_init_irq(pc_fdc_t *);
-static void pc_fdc_fini_irq(pc_fdc_t *);
-static void pc_fdc_irq_handler(ipc_call_t *, void *);
-
-static errno_t pc_fdc_drive_create(pc_fdc_t *, unsigned, pc_fdc_drive_t **);
-
-static errno_t pc_fdc_reset(pc_fdc_t *);
-static errno_t pc_fdc_read_id(pc_fdc_t *, bool, uint8_t, uint8_t);
-static errno_t pc_fdc_sense_int_sts(pc_fdc_t *);
-
-static errno_t pc_fdc_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t pc_fdc_bd_close(bd_srv_t *);
-static errno_t pc_fdc_bd_read_blocks(bd_srv_t *, uint64_t, size_t, void *, size_t);
-static errno_t pc_fdc_bd_read_toc(bd_srv_t *, uint8_t, void *, size_t);
-static errno_t pc_fdc_bd_write_blocks(bd_srv_t *, uint64_t, size_t, const void *,
-    size_t);
-static errno_t pc_fdc_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t pc_fdc_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-static errno_t pc_fdc_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-
-static bd_ops_t pc_fdc_bd_ops = {
-	.open = pc_fdc_bd_open,
-	.close = pc_fdc_bd_close,
-	.read_blocks = pc_fdc_bd_read_blocks,
-	.read_toc = pc_fdc_bd_read_toc,
-	.write_blocks = pc_fdc_bd_write_blocks,
-	.get_block_size = pc_fdc_bd_get_block_size,
-	.get_num_blocks = pc_fdc_bd_get_num_blocks,
-	.sync_cache = pc_fdc_bd_sync_cache
-};
-
-enum {
-	msr_read_cycles = 100,
-	fdc_def_dma_buf_size = 4096
-};
-
-static const irq_pio_range_t pc_fdc_irq_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(pc_fdc_regs_t)
-	}
-};
-
-/** PC floppy interrupt pseudo code.
- *
- * Floppy interrupts are complex. Since we don't want to change the handler
- * all the time, need to handle both status-ful and status-less IRQs.
- *
- * XXX Do we need to wait for MSR.RQM == 1? That's really difficult
- * in pseudocode.
- *
- * if (MSR.DIO == 0)
- *    send SENSE INT STATUS;
- *
- * st[0] = read DATA;
- * [repeat 5 times]
- *   if (MSR.DIO == 1)
- *       st[1] = read DATA;
- *
- */
-static const irq_cmd_t pc_fdc_irq_cmds[] = {
-	{
-		.cmd = CMD_ACCEPT
-	}
-
-};
-
-/** Create PC floppy controller driver instnace.
- *
- * @param dev DDF device
- * @param res HW resources
- * @param rfdc Place to store pointer to floppy controller
- */
-errno_t pc_fdc_create(ddf_dev_t *dev, pc_fdc_hwres_t *res, pc_fdc_t **rfdc)
-{
-	errno_t rc;
-	pc_fdc_t *fdc;
-	bool irq_inited = false;
-	void *buffer = NULL;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_init()");
-
-	fdc = ddf_dev_data_alloc(dev, sizeof(pc_fdc_t));
-	if (fdc == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating FDC.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fdc->dev = dev;
-
-	fibril_mutex_initialize(&fdc->lock);
-	fdc->regs_physical = res->regs;
-	fdc->irq = res->irq;
-	fdc->dma = res->dma;
-
-	ddf_msg(LVL_NOTE, "I/O address %p", (void *)fdc->regs_physical);
-
-	ddf_msg(LVL_DEBUG, "Init I/O");
-	rc = pc_fdc_init_io(fdc);
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "Init IRQ");
-	rc = pc_fdc_init_irq(fdc);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Init IRQ failed");
-		return rc;
-	}
-
-	irq_inited = true;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init(): read ID");
-
-	fdc->dma_buf_size = fdc_def_dma_buf_size;
-
-	buffer = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(fdc->dma_buf_size, DMAMEM_1MiB | 0xffff,
-	    AS_AREA_WRITE | AS_AREA_READ, 0, &fdc->dma_buf_pa, &buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed allocating PRD table.");
-		goto error;
-	}
-
-	fdc->dma_buf = buffer;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: reset controller...");
-	(void)pc_fdc_reset(fdc);
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: read_ID..");
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: MSR=0x%x",
-	    pio_read_8(&fdc->regs->msr));
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: DIR=0x%x",
-	    pio_read_8(&fdc->regs->dir));
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: SRA=0x%x",
-	    pio_read_8(&fdc->regs->sra));
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: SRB=0x%x",
-	    pio_read_8(&fdc->regs->srb));
-
-	rc = pc_fdc_sense_int_sts(fdc);
-	if (rc != EOK)
-		return rc;
-	rc = pc_fdc_sense_int_sts(fdc);
-	if (rc != EOK)
-		return rc;
-	rc = pc_fdc_sense_int_sts(fdc);
-	if (rc != EOK)
-		return rc;
-	rc = pc_fdc_sense_int_sts(fdc);
-	if (rc != EOK)
-		return rc;
-
-	/* Read ID MFM, D0, H0 */
-	rc = pc_fdc_read_id(fdc, true, 0, 0);
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: read_ID -> %d", rc);
-
-	rc = pc_fdc_drive_create(fdc, 0, &fdc->drive[0]);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "pc_fdc_ctrl_init: pc_fdc_drive_create "
-		    "failed");
-		goto error;
-	}
-
-	fdc->drive[0]->sec_size = 512;
-	fdc->drive[0]->cylinders = 80;
-	fdc->drive[0]->heads = 2;
-	fdc->drive[0]->sectors = 18;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: DONE");
-	return EOK;
-error:
-	if (buffer != NULL)
-		dmamem_unmap_anonymous(buffer);
-	if (irq_inited)
-		pc_fdc_fini_irq(fdc);
-	pc_fdc_fini_io(fdc);
-	return rc;
-}
-
-/** Destroy floppy controller instance.
- *
- * @param fdc Floppy controller
- */
-errno_t pc_fdc_destroy(pc_fdc_t *fdc)
-{
-	ddf_msg(LVL_DEBUG, ": pc_fdc_destroy()");
-
-	fibril_mutex_lock(&fdc->lock);
-
-	pc_fdc_fini_irq(fdc);
-	pc_fdc_fini_io(fdc);
-	fibril_mutex_unlock(&fdc->lock);
-
-	free(fdc);
-	return EOK;
-}
-
-/** Quiesce floppy controller.
- *
- * @param fdc Floppy controller
- */
-void pc_fdc_quiesce(pc_fdc_t *fdc)
-{
-	(void)pc_fdc_reset(fdc);
-}
-
-/** Enable device I/O.
- *
- * @param fdc Floppy controller
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_init_io(pc_fdc_t *fdc)
-{
-	errno_t rc;
-	void *vaddr;
-
-	rc = pio_enable((void *) fdc->regs_physical, sizeof(pc_fdc_regs_t),
-	    &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	fdc->regs = vaddr;
-	return EOK;
-}
-
-/** Clean up device I/O.
- *
- * @param fdc Floppy controller
- */
-static void pc_fdc_fini_io(pc_fdc_t *fdc)
-{
-	(void)fdc;
-	/* XXX TODO */
-}
-
-/** Initialize IRQ.
- *
- * @param fdc Floppy controller
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_init_irq(pc_fdc_t *fdc)
-{
-	irq_code_t irq_code;
-	irq_pio_range_t *ranges;
-	irq_cmd_t *cmds;
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	if (fdc->irq < 0)
-		return EOK;
-
-	ranges = malloc(sizeof(pc_fdc_irq_ranges));
-	if (ranges == NULL)
-		return ENOMEM;
-
-	cmds = malloc(sizeof(pc_fdc_irq_cmds));
-	if (cmds == NULL) {
-		free(cmds);
-		return ENOMEM;
-	}
-
-	memcpy(ranges, &pc_fdc_irq_ranges, sizeof(pc_fdc_irq_ranges));
-	ranges[0].base = fdc->regs_physical;
-	memcpy(cmds, &pc_fdc_irq_cmds, sizeof(pc_fdc_irq_cmds));
-
-	irq_code.rangecount = sizeof(pc_fdc_irq_ranges) / sizeof(irq_pio_range_t);
-	irq_code.ranges = ranges;
-	irq_code.cmdcount = sizeof(pc_fdc_irq_cmds) / sizeof(irq_cmd_t);
-	irq_code.cmds = cmds;
-
-	ddf_msg(LVL_NOTE, "IRQ %d", fdc->irq);
-
-	rc = register_interrupt_handler(fdc->dev, fdc->irq,
-	    pc_fdc_irq_handler, (void *)fdc, &irq_code, &fdc->ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ.");
-		goto error;
-	}
-
-	parent_sess = ddf_dev_parent_sess_get(fdc->dev);
-
-	rc = hw_res_enable_interrupt(parent_sess, fdc->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling IRQ.");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "Interrupt handler registered");
-	free(ranges);
-	free(cmds);
-	return EOK;
-error:
-	free(ranges);
-	free(cmds);
-	return rc;
-}
-
-/** Clean up IRQ.
- *
- * @param fdc Floppy disk controller
- */
-static void pc_fdc_fini_irq(pc_fdc_t *fdc)
-{
-	errno_t rc;
-	async_sess_t *parent_sess;
-
-	parent_sess = ddf_dev_parent_sess_get(fdc->dev);
-
-	rc = hw_res_disable_interrupt(parent_sess, fdc->irq);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Error disabling IRQ.");
-
-	(void) unregister_interrupt_handler(fdc->dev, fdc->ihandle);
-}
-
-/** Get DDF function name for drive.
- *
- * @param fdc Floppy disk controller
- * @param idx Drive index
- * @return Function name (newly allocated string)
- */
-static char *pc_fdc_fun_name(pc_fdc_t *fdc, unsigned idx)
-{
-	char *fun_name;
-
-	if (asprintf(&fun_name, "d%u", idx) < 0)
-		return NULL;
-
-	return fun_name;
-}
-
-/** Block device connection handler.
- *
- * @param icall Incoming call (pc_fdc_drive_t *)
- * @param arg Argument
- */
-static void pc_fdc_connection(ipc_call_t *icall, void *arg)
-{
-	pc_fdc_drive_t *drive;
-
-	drive = (pc_fdc_drive_t *)ddf_fun_data_get((ddf_fun_t *)arg);
-	bd_conn(icall, &drive->bds);
-}
-
-/** Create floppy drive object.
- *
- * @param fdc Floppy disk controller
- * @param idx Drive index
- * @param rdrive Place to store pointer to drive
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_drive_create(pc_fdc_t *fdc, unsigned idx,
-    pc_fdc_drive_t **rdrive)
-{
-	errno_t rc;
-	char *fun_name = NULL;
-	ddf_fun_t *fun = NULL;
-	pc_fdc_drive_t *drive = NULL;
-	bool bound = false;
-
-	fun_name = pc_fdc_fun_name(fdc, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun = ddf_fun_create(fdc->dev, fun_exposed, fun_name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating DDF function.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Allocate soft state */
-	drive = ddf_fun_data_alloc(fun, sizeof(pc_fdc_drive_t));
-	if (drive == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating softstate.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	drive->fdc = fdc;
-	drive->fun = fun;
-
-	bd_srvs_init(&drive->bds);
-	drive->bds.ops = &pc_fdc_bd_ops;
-	drive->bds.sarg = (void *)drive;
-
-	/* Set up a connection handler. */
-	ddf_fun_set_conn_handler(fun, pc_fdc_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding DDF function %s: %s",
-		    fun_name, str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-#if 0
-	rc = ddf_fun_add_to_category(fun, "partition");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function %s to "
-		    "category 'partition': %s", fun_name, str_error(rc));
-		goto error;
-	}
-#endif
-
-	free(fun_name);
-	*rdrive = drive;
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	if (fun_name != NULL)
-		free(fun_name);
-
-	return rc;
-}
-
-/** Send byte to FDC data register.
- *
- * @param fdc Floppy controller
- * @param byte Data byte
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_send_byte(pc_fdc_t *fdc, uint8_t byte)
-{
-	unsigned cnt;
-	uint8_t status;
-	stopwatch_t sw;
-	nsec_t nsec;
-
-	/*
-	 * We need to wait for up to 250 usec in total
-	 * per Intel 82077AA programming guidelines
-	 */
-	stopwatch_init(&sw);
-	stopwatch_start(&sw);
-
-	status = pio_read_8(&fdc->regs->msr);
-	ddf_msg(LVL_DEBUG, "pc_fdc_send_byte: status=0x%x", status);
-	do {
-		cnt = msr_read_cycles;
-		while (cnt > 0) {
-			if ((status & fmsr_rqm) != 0 &&
-			    (status & fmsr_dio) == 0) {
-				pio_write_8(&fdc->regs->data, byte);
-				return EOK;
-			}
-
-			--cnt;
-			status = pio_read_8(&fdc->regs->msr);
-		}
-
-		stopwatch_stop(&sw);
-		nsec = stopwatch_get_nanos(&sw);
-		ddf_msg(LVL_DEBUG, "nsec=%lld", nsec);
-	} while (nsec < 1000 * msr_max_wait_usec);
-
-	ddf_msg(LVL_ERROR, "pc_fdc_send_byte: FAILED (status=0x%x)", status);
-	return EIO;
-}
-
-/** Send a block of data to FDC data register.
- *
- * @param fdc Floppy controller
- * @param data Data block
- * @parma nbytes Size of data block in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_send(pc_fdc_t *fdc, const void *data, size_t nbytes)
-{
-	size_t i;
-	errno_t rc;
-	uint8_t status;
-
-	for (i = 0; i < nbytes; i++) {
-		rc = pc_fdc_send_byte(fdc, ((uint8_t *)data)[i]);
-		if (rc != EOK)
-			return rc;
-	}
-
-	status = pio_read_8(&fdc->regs->msr);
-	ddf_msg(LVL_DEBUG, "pc_fdc_send: final status=0x%x", status);
-	return EOK;
-}
-
-/** Get byte from FDC data register.
- *
- * @param fdc Floppy controller
- * @param byte Place to store data byte
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_get_byte(pc_fdc_t *fdc, uint8_t *byte)
-{
-	unsigned cnt;
-	uint8_t status;
-	stopwatch_t sw;
-	nsec_t nsec;
-
-	/*
-	 * We need to wait for up to 250 usec in total
-	 * per Intel 82077AA programming guidelines
-	 */
-	stopwatch_init(&sw);
-	stopwatch_start(&sw);
-
-	status = pio_read_8(&fdc->regs->msr);
-	ddf_msg(LVL_DEBUG, "pc_fdc_get_byte: status=0x%x", status);
-	do {
-		cnt = msr_read_cycles;
-		while (cnt > 0) {
-			if ((status & fmsr_rqm) != 0 &&
-			    (status & fmsr_dio) != 0) {
-				*byte = pio_read_8(&fdc->regs->data);
-				return EOK;
-			}
-
-			--cnt;
-			status = pio_read_8(&fdc->regs->msr);
-		}
-
-		stopwatch_stop(&sw);
-		nsec = stopwatch_get_nanos(&sw);
-	} while (nsec / 1000 < 1000 * msr_max_wait_usec);
-
-	ddf_msg(LVL_ERROR, "pc_fdc_get_byte: FAILED (status=0x%x)", status);
-	return EIO;
-}
-
-/** Receive a block of data to FDC data register.
- *
- * @param fdc Floppy controller
- * @param buf Data buffer
- * @param bsize Size of data buffer in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_get(pc_fdc_t *fdc, void *buf, size_t bsize)
-{
-	size_t i;
-	errno_t rc;
-	uint8_t status;
-
-	for (i = 0; i < bsize; i++) {
-		rc = pc_fdc_get_byte(fdc, &((uint8_t *)buf)[i]);
-		if (rc != EOK) {
-			ddf_msg(LVL_ERROR, "pc_fdc_get: abort after "
-			    "reading %zu bytes", i);
-			return rc;
-		}
-	}
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_get: successfully read %zu bytes", i);
-	status = pio_read_8(&fdc->regs->msr);
-	ddf_msg(LVL_DEBUG, "pc_fdc_get: final status=0x%x", status);
-	return EOK;
-}
-
-/** Reset floppy controller.
- *
- * @param fdc Floppy controller
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_reset(pc_fdc_t *fdc)
-{
-	uint8_t dor;
-
-	/* Use DSR reset for 82072 (or older) compatibility */
-	pio_write_8(&fdc->regs->dsr, fdsr_sw_reset | fdsr_drate_500kbps);
-
-	/* Clear DOR reset in case it was set (i.e., nreset := 1) */
-	dor = pio_read_8(&fdc->regs->dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor,
-	    dor & ~fdor_nreset);
-	pio_write_8(&fdc->regs->dor, dor & ~fdor_nreset);
-
-	dor = pio_read_8(&fdc->regs->dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_reset: read DOR: value= 0x%x", dor);
-
-	fibril_usleep(4);
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor,
-	    dor | fdor_nreset | fdor_ndmagate);
-	pio_write_8(&fdc->regs->dor, dor | fdor_nreset | fdor_ndmagate);
-
-	dor = pio_read_8(&fdc->regs->dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_reset: read DOR: value= 0x%x", dor);
-
-	return EOK;
-}
-
-/** Perform Read ID command.
- *
- * @param fdc Floppy controller
- * @param mfm Enable MFM (double density) mode
- * @param drive Drive (0-3)
- * @param head Head (0-1)
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_read_id(pc_fdc_t *fdc, bool mfm, uint8_t drive,
-    uint8_t head)
-{
-	pc_fdc_read_id_data_t cmd;
-	pc_fdc_cmd_status_t status;
-	uint8_t dor;
-	errno_t rc;
-
-	dor = pio_read_8(&fdc->regs->dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_read_id: read DOR: value= 0x%x", dor);
-
-	dor |= fdor_me0; /* turn drive 0 motor on */
-	dor = (dor & ~0x03) | 0x00; /* select drive 0 */
-	pio_write_8(&fdc->regs->dor, dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_read_id: DOR := 0x%x", dor);
-
-	dor = pio_read_8(&fdc->regs->dor);
-	ddf_msg(LVL_DEBUG, "pc_fdc_read_id: read DOR: value= 0x%x", dor);
-
-	/* 500 ms to let drive spin up */
-	fibril_usleep(500 * 1000);
-
-	cmd.flags_cc = fcf_mf | fcc_read_id;
-	cmd.hd_us = 0x00;
-
-	ddf_msg(LVL_DEBUG, "read ID: send");
-	rc = pc_fdc_send(fdc, &cmd, sizeof(cmd));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed sending READ ID command.");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "read ID: get");
-	rc = pc_fdc_get(fdc, &status, sizeof(status));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed getting status for READ ID");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "read ID: DONE");
-	ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "
-	    "number=%u", status.st0, status.st1, status.st2,
-	    status.cyl, status.head, status.rec, status.number);
-
-	/* Check for success status */
-	if ((status.st0 & fsr0_ic_mask) != 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Perform Read Data command.
- *
- * @param drive Floppy drive
- * @param cyl Cylinder
- * @param head Head
- * @param sec Sector
- * @param buf Destination buffer
- * @param buf_size Destination buffer size
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_drive_read_data(pc_fdc_drive_t *drive,
-    uint8_t cyl, uint8_t head, uint8_t sec, void *buf, size_t buf_size)
-{
-	pc_fdc_t *fdc = drive->fdc;
-	pc_fdc_cmd_data_t cmd;
-	pc_fdc_cmd_status_t status;
-	async_sess_t *sess;
-	size_t csize;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_drive_read_data");
-
-	memset(fdc->dma_buf, 0, fdc->dma_buf_size);
-
-	sess = ddf_dev_parent_sess_get(fdc->dev);
-	ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup(sess=%p, chan=%d "
-	    "pa=%" PRIuPTR " size=%zu", sess, fdc->dma, fdc->dma_buf_pa,
-	    fdc->dma_buf_size);
-	rc = hw_res_dma_channel_setup(sess, fdc->dma, fdc->dma_buf_pa,
-	    fdc->dma_buf_size, DMA_MODE_READ | DMA_MODE_AUTO |
-	    DMA_MODE_ON_DEMAND);
-	ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup->%d", rc);
-
-	cmd.flags_cc = fcf_mf | fcc_read_data;
-	cmd.hd_us = (head & 1) << 2 | 0x00 /* drive 0 */;
-	cmd.cyl = cyl;
-	cmd.head = head;
-	cmd.rec = sec;
-	cmd.number = 2; /* 512 bytes */
-	cmd.eot = sec;
-	cmd.gpl = 0x1b;
-	cmd.dtl = 0xff;
-
-	ddf_msg(LVL_DEBUG, "read data: send");
-	rc = pc_fdc_send(fdc, &cmd, sizeof(cmd));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed sending Read Data command.");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "read data: get");
-	rc = pc_fdc_get(fdc, &status, sizeof(status));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed getting status for Read Data");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "read data: DONE");
-	ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "
-	    "number=%u", status.st0, status.st1, status.st2,
-	    status.cyl, status.head, status.rec, status.number);
-
-	/* Check for success status */
-	if ((status.st0 & fsr0_ic_mask) != 0)
-		return EIO;
-
-	/* Copy data from DMA buffer to destination buffer */
-	csize = min(fdc->dma_buf_size, buf_size);
-	memcpy(buf, fdc->dma_buf, csize);
-
-	return EOK;
-}
-
-/** Perform Write Data command.
- *
- * @param drive Floppy drive
- * @param cyl Cylinder
- * @param head Head
- * @param sec Sector
- * @param buf Source buffer
- * @param buf_size Source buffer size
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_drive_write_data(pc_fdc_drive_t *drive,
-    uint8_t cyl, uint8_t head, uint8_t sec, const void *buf, size_t buf_size)
-{
-	pc_fdc_t *fdc = drive->fdc;
-	pc_fdc_cmd_data_t cmd;
-	pc_fdc_cmd_status_t status;
-	async_sess_t *sess;
-	size_t csize;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_drive_write_data");
-
-	/* Copy data from source buffer to DMA buffer */
-	csize = min(fdc->dma_buf_size, buf_size);
-	memcpy(fdc->dma_buf, buf, csize);
-
-	sess = ddf_dev_parent_sess_get(fdc->dev);
-	ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup(sess=%p, chan=%d "
-	    "pa=%" PRIuPTR " size=%zu", sess, fdc->dma, fdc->dma_buf_pa,
-	    fdc->dma_buf_size);
-	rc = hw_res_dma_channel_setup(sess, fdc->dma, fdc->dma_buf_pa,
-	    fdc->dma_buf_size, DMA_MODE_WRITE | DMA_MODE_AUTO |
-	    DMA_MODE_ON_DEMAND);
-	ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup->%d", rc);
-
-	cmd.flags_cc = fcf_mf | fcc_write_data;
-	cmd.hd_us = (head & 1) << 2 | 0x00 /* drive 0 */;
-	cmd.cyl = cyl;
-	cmd.head = head;
-	cmd.rec = sec;
-	cmd.number = 2; /* 512 bytes */
-	cmd.eot = sec;
-	cmd.gpl = 0x1b;
-	cmd.dtl = 0xff;
-
-	ddf_msg(LVL_DEBUG, "write data: send");
-	rc = pc_fdc_send(fdc, &cmd, sizeof(cmd));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed sending Write Data command.");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "write data: get");
-	rc = pc_fdc_get(fdc, &status, sizeof(status));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed getting status for Write Data");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "write data: DONE");
-	ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "
-	    "number=%u", status.st0, status.st1, status.st2,
-	    status.cyl, status.head, status.rec, status.number);
-
-	/* Check for success status */
-	if ((status.st0 & fsr0_ic_mask) != 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Perform Sense Interrupt Status command.
- *
- * @param fdc Floppy controller
- * @param mfm Enable MFM (double density) mode
- * @param drive Drive (0-3)
- * @param head Head (0-1)
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_sense_int_sts(pc_fdc_t *fdc)
-{
-	pc_fdc_sense_int_sts_data_t cmd;
-	pc_fdc_sense_int_sts_status_t status;
-	errno_t rc;
-
-	cmd.cc = fcc_sense_int_sts;
-
-	ddf_msg(LVL_DEBUG, "Sense Interrupt Status: send");
-	rc = pc_fdc_send(fdc, &cmd, sizeof(cmd));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed sending Sense Interrupt Status "
-		    "command.");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "Sense Interrupt Status: get");
-	rc = pc_fdc_get(fdc, &status, sizeof(status));
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Failed getting status for Sense Interrupt "
-		    "Status");
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "Sense Interrupt Status: DONE");
-	ddf_msg(LVL_DEBUG, "st0=0x%x pcn=0x%x", status.st0, status.pcn);
-
-	return EOK;
-}
-
-/** Interrupt handler.
- *
- * @param call Call data
- * @param arg Argument (pc_fdc_channel_t *)
- */
-static void pc_fdc_irq_handler(ipc_call_t *call, void *arg)
-{
-	pc_fdc_t *fdc = (pc_fdc_t *)arg;
-	uint8_t st0;
-	uint8_t st1;
-	uint8_t st2;
-	uint8_t c, h, n;
-	async_sess_t *parent_sess;
-
-	st0 = ipc_get_arg1(call);
-	st1 = ipc_get_arg2(call);
-	st2 = ipc_get_arg3(call);
-	c = ipc_get_arg4(call);
-	h = ipc_get_arg5(call);
-	n = ipc_get_imethod(call);
-	ddf_msg(LVL_DEBUG, "pc_fdc_irq_handler st0=%x st1=%x st2=%x c=%u h=%u n=%u",
-	    st0, st1, st2, c, h, n);
-
-	parent_sess = ddf_dev_parent_sess_get(fdc->dev);
-	hw_res_clear_interrupt(parent_sess, fdc->irq);
-}
-
-/** Get floppy drive from block device service.
- *
- * @param bd Block device
- * @return Floppy drive
- */
-static pc_fdc_drive_t *bd_srv_drive(bd_srv_t *bd)
-{
-	return (pc_fdc_drive_t *)bd->srvs->sarg;
-}
-
-/** Convert LBA to CHS.
- *
- * @param drive Floppy drive
- * @param ba Logical block address
- * @param cyl Place to store cylinder number
- * @param head Place to store head number
- * @param sec Place to store sector number
- */
-static void pc_fdc_drive_ba_to_chs(pc_fdc_drive_t *drive, uint64_t ba,
-    uint8_t *cyl, uint8_t *head, uint8_t *sec)
-{
-	unsigned ch;
-
-	*sec = 1 + (ba % drive->sectors);
-	ch = ba / drive->sectors;
-	*head = ch % drive->heads;
-	*cyl = ch / drive->heads;
-}
-
-/** Open block device.
- *
- * @param bds Block device server
- * @param bd Block device
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Close block device.
- *
- * @param bd Block device
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read multiple blocks from block device.
- *
- * @param bd Block device
- * @param ba Address of first block
- * @param cnt Number of blocks
- * @param buf Destination buffer
- * @param size Size of destination buffer in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    void *buf, size_t size)
-{
-	pc_fdc_drive_t *drive = bd_srv_drive(bd);
-	uint8_t cyl, head, sec;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_bd_read_blocks");
-
-	if (size < cnt * drive->sec_size) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	while (cnt > 0) {
-		pc_fdc_drive_ba_to_chs(drive, ba, &cyl, &head, &sec);
-
-		/* Read one block */
-		rc = pc_fdc_drive_read_data(drive, cyl, head, sec, buf,
-		    drive->sec_size);
-		if (rc != EOK)
-			goto error;
-
-		++ba;
-		--cnt;
-		buf += drive->sec_size;
-	}
-
-	return EOK;
-error:
-	ddf_msg(LVL_ERROR, "pc_fdc_bd_read_blocks: rc=%d", rc);
-	return rc;
-}
-
-/** Read TOC from block device.
- *
- * @param bd Block device
- * @param session Session number
- * @param buf Destination buffer
- * @param size Size of destination buffer in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
-{
-	return ENOTSUP;
-}
-
-/** Write multiple blocks to block device.
- *
- * @param bd Block device
- * @param ba Address of first block
- * @param cnt Number of blocks
- * @param buf Source buffer
- * @param size Size of source buffer in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t pc_fdc_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	pc_fdc_drive_t *drive = bd_srv_drive(bd);
-	uint8_t cyl, head, sec;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_fdc_bd_write_blocks");
-
-	if (size < cnt * drive->sec_size) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	while (cnt > 0) {
-		pc_fdc_drive_ba_to_chs(drive, ba, &cyl, &head, &sec);
-
-		/* Write one block */
-		rc = pc_fdc_drive_write_data(drive, cyl, head, sec, buf,
-		    drive->sec_size);
-		if (rc != EOK)
-			goto error;
-
-		++ba;
-		--cnt;
-		buf += drive->sec_size;
-	}
-
-	return EOK;
-error:
-	ddf_msg(LVL_ERROR, "pc_fdc_bd_write_blocks: rc=%d", rc);
-	return rc;
-}
-
-/** Get device block size. */
-static errno_t pc_fdc_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
-{
-	pc_fdc_drive_t *drive = bd_srv_drive(bd);
-
-	*rbsize = drive->sec_size;
-	return EOK;
-}
-
-/** Get device number of blocks. */
-static errno_t pc_fdc_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	pc_fdc_drive_t *drive = bd_srv_drive(bd);
-
-	*rnb = drive->cylinders * drive->heads * drive->sectors;
-	return EOK;
-}
-
-/** Flush cache. */
-static errno_t pc_fdc_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
-{
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/block/pc-floppy/pc-floppy.h
===================================================================
--- uspace/drv/block/pc-floppy/pc-floppy.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pc-floppy
- * @{
- */
-/** @file PC floppy disk driver
- */
-
-#ifndef PC_FLOPPY_H
-#define PC_FLOPPY_H
-
-#include <bd_srv.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "pc-floppy_hw.h"
-
-#define NAME "pc-floppy"
-
-/** PC floppy controller hardware resources */
-typedef struct {
-	/** I/O registers */
-	uintptr_t regs;
-	/** IRQ */
-	int irq;
-	/** DMA channel */
-	int dma;
-} pc_fdc_hwres_t;
-
-/** PC floppy disk controller */
-typedef struct pc_fdc {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** I/O base address of the registers */
-	uintptr_t regs_physical;
-
-	/** Command registers */
-	pc_fdc_regs_t *regs;
-	/** IRQ (-1 if not used) */
-	int irq;
-	/** DMA (-1 if not used) */
-	int dma;
-	/** IRQ handle */
-	cap_irq_handle_t ihandle;
-
-	/** DMA buffer */
-	void *dma_buf;
-	/** DMA buffer physical address */
-	uintptr_t dma_buf_pa;
-	/** DMA buffer size */
-	size_t dma_buf_size;
-
-	/** Synchronize controller access */
-	fibril_mutex_t lock;
-
-	struct pc_fdc_drive *drive[2];
-} pc_fdc_t;
-
-/** PC floppy drive */
-typedef struct pc_fdc_drive {
-	pc_fdc_t *fdc;
-	ddf_fun_t *fun;
-	void *charg;
-	size_t sec_size;
-	unsigned cylinders;
-	unsigned heads;
-	unsigned sectors;
-	bd_srvs_t bds;
-} pc_fdc_drive_t;
-
-extern errno_t pc_fdc_create(ddf_dev_t *, pc_fdc_hwres_t *, pc_fdc_t **);
-extern void pc_fdc_quiesce(pc_fdc_t *);
-extern errno_t pc_fdc_destroy(pc_fdc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/pc-floppy/pc-floppy.ma
===================================================================
--- uspace/drv/block/pc-floppy/pc-floppy.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/fdc
Index: pace/drv/block/pc-floppy/pc-floppy_hw.h
===================================================================
--- uspace/drv/block/pc-floppy/pc-floppy_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-/** @file PC Floppy Disk hardware definitions
- *
- * Based on
- *  - NEC uPD765A datasheet
- *  - Intel 82077AA Floppy Controller Datasheet
- */
-
-#ifndef PC_FLOPPY_HW_H
-#define PC_FLOPPY_HW_H
-
-/** Command Codes */
-typedef enum {
-	/** Read Data */
-	fcc_read_data = 0x06,
-	/** Read Delete Data */
-	fcc_read_ddata = 0x0c,
-	/** Write Data */
-	fcc_write_data = 0x05,
-	/** Write Deleted Data */
-	fcc_write_ddata = 0x09,
-	/** Read a Track */
-	fcc_read_track = 0x02,
-	/** Read ID */
-	fcc_read_id = 0x0a,
-	/** Format a Track */
-	fcc_format_track = 0x0d,
-	/** Scan Equal */
-	fcc_scan_equal = 0x11,
-	/** Scan Low or Equal */
-	fcc_scan_lequal = 0x19,
-	/** Scan High or Equal */
-	fcc_scan_hequal = 0x1d,
-	/** Recalibrate */
-	fcc_recalibrate = 0x07,
-	/** Sense Interrupt Status */
-	fcc_sense_int_sts = 0x08,
-	/** Specify */
-	fcc_specify = 0x03,
-	/** Sense Drive Status */
-	fcc_sense_drv_sts = 0x04,
-	/** Seek */
-	fcc_seek = 0x0f
-} pc_fdc_cmd_code_t;
-
-/** MT|MF|SK flags used in flags_cc byte */
-typedef enum {
-	/** Multi Track */
-	fcf_mt = 0x80,
-	/** FM or MFM mode */
-	fcf_mf = 0x40,
-	/** Skip deleted address mark */
-	fcf_sk = 0x20
-} pc_fcd_flags_t;
-
-/** Command parameters common for most data commands */
-typedef struct {
-	/** [MT] | MF | [SK] | command code */
-	uint8_t flags_cc;
-	/** XXXXX | HD | US1 | US0 */
-	uint8_t hd_us;
-	/** Cylinder number */
-	uint8_t cyl;
-	/** Head number */
-	uint8_t head;
-	/** Record number */
-	uint8_t rec;
-	/** Number */
-	uint8_t number;
-	/** End of Track */
-	uint8_t eot;
-	/** Gap Length */
-	uint8_t gpl;
-	/** Data Length */
-	uint8_t dtl;
-} pc_fdc_cmd_data_t;
-
-/** Status data common for most commands */
-typedef struct {
-	/** Status 0 */
-	uint8_t st0;
-	/** Status 1 */
-	uint8_t st1;
-	/** Status 2 */
-	uint8_t st2;
-	/** Cylinder number */
-	uint8_t cyl;
-	/** Head number */
-	uint8_t head;
-	/** Record number */
-	uint8_t rec;
-	/** Number */
-	uint8_t number;
-} pc_fdc_cmd_status_t;
-
-/** Command parameters for Read ID command */
-typedef struct {
-	/** 0 | MF | 0 | command code */
-	uint8_t flags_cc;
-	/** XXXXX | HD | US1 | US0 */
-	uint8_t hd_us;
-} pc_fdc_read_id_data_t;
-
-/** Command parameters for Format a Track command */
-typedef struct {
-	/** 0 | MF | 0 | command code */
-	uint8_t flags_cc;
-	/** XXXXX | HD | US1 | US0 */
-	uint8_t hd_us;
-	/** Number */
-	uint8_t number;
-	/** Sectors per Cylinder */
-	uint8_t sec_cyl;
-	/** Gap Length */
-	uint8_t gpl;
-	/** Data Pattern */
-	uint8_t dpat;
-} pc_fdc_format_track_data_t;
-
-/** Command parameters for Recalibrate command */
-typedef struct {
-	/** 0 | 0 | 0 | command code */
-	uint8_t cc;
-	/** XXXXX | 0 | US1 | US0 */
-	uint8_t us;
-} pc_fdc_recalibrate_data_t;
-
-/** Command parameters for Sense Interrupt Status command */
-typedef struct {
-	/** 0 | 0 | 0 | command code */
-	uint8_t cc;
-} pc_fdc_sense_int_sts_data_t;
-
-/** Status data common for Sense Interrupt Status command */
-typedef struct {
-	/** Status 0 */
-	uint8_t st0;
-	/** Present Cylinder Number */
-	uint8_t pcn;
-} pc_fdc_sense_int_sts_status_t;
-
-/** Command parameters for Specify command */
-typedef struct {
-	/** 0 | 0 | 0 | command code */
-	uint8_t cc;
-	/** Step Rate Time, Head Unload Time */
-	uint8_t srt_hut;
-	/** Head Load Time, Non-DMA Mode */
-	uint8_t hlt_nd;
-} pc_fdc_secify_data_t;
-
-/** Command parameters for Sense Drive Status command */
-typedef struct {
-	/** 0 | 0 | 0 | command code */
-	uint8_t cc;
-	/** XXXXX | HD | US1 | US0 */
-	uint8_t hd_us;
-} pc_fdc_sense_drive_sts_data_t;
-
-/** Command parameters for Seek command */
-typedef struct {
-	/** 0 | 0 | 0 | command code */
-	uint8_t cc;
-	/** XXXXX | HD | US1 | US0 */
-	uint8_t hd_us;
-} pc_fdc_seek_data_t;
-
-/** Bits in Status Register A (SRA) PS/2 Mode */
-enum {
-	fsra2_int_pending = 0x80,
-	fsra2_ndrv2 = 0x40,
-	fsra2_step = 0x20,
-	fsra2_ntrk0 = 0x10,
-	fsra2_hdsel = 0x08,
-	fsra2_nindx = 0x04,
-	fsra2_nwp = 0x02,
-	fsra2_dir = 0x01
-};
-
-/** Bits in Status Register A (SRA) Model 30 Mode */
-enum {
-	fsra3_int_pending = 0x80,
-	fsra3_drq = 0x40,
-	fsra3_step_ff = 0x20,
-	fsra3_trko = 0x10,
-	fsra3_nhdsel = 0x08,
-	fsra3_index = 0x04,
-	fsra3_wp = 0x02,
-	fsra3_ndir = 0x01
-};
-
-/** Bits in Status Register B (SRB) PS/2 Mode */
-enum {
-	fsrb_d0sel = 0x20,
-	fsrb_wrd_tgl = 0x10,
-	fsrb_rdd_tgl = 0x08,
-	fsrb_we = 0x04,
-	fsrb_me1 = 0x02,
-	fsrb_me0 = 0x01
-};
-
-/** Bits in Status Register B (SRB) Model 30 Mode */
-enum {
-	fsrb_ndrv2 = 0x80,
-	fsrb_nds1 = 0x40,
-	fsrb_nds0 = 0x20,
-	fsrb_wrd_ff = 0x10,
-	fsrb_rdd_ff = 0x08,
-	fsrb_we_ff = 0x04,
-	fsrb_nds3 = 0x02,
-	fsrb_nds2 = 0x01
-};
-
-/** Bits in Digital Output Register (DOR) */
-enum {
-	fdor_me3 = 0x80,
-	fdor_me2 = 0x40,
-	fdor_me1 = 0x20,
-	fdor_me0 = 0x10,
-	fdor_ndmagate = 0x08,
-	fdor_nreset = 0x04,
-	fdor_ds1 = 0x02,
-	fdor_ds0 = 0x01
-};
-
-/** Bits in Tape Drive Register (TDR) */
-enum {
-	ftdr_ts1 = 0x02,
-	ftdr_ts0 = 0x01
-};
-
-/** Bits in Datarate Select Register (DSR) */
-enum {
-	fdsr_sw_reset = 0x80,
-	fdsr_power_down = 0x40,
-	fdsr_precomp2 = 0x10,
-	fdsr_precomp1 = 0x08,
-	fdsr_precomp0 = 0x04,
-	fdsr_drate_sel1 = 0x02,
-	fdsr_drate_sel0 = 0x01
-};
-
-/** Combined values of DSR.DRATE_SEL1/0 */
-enum {
-	fdsr_drate_1mbps = 0x03,
-	fdsr_drate_500kbps = 0x00,
-	fdsr_drate_300kbps = 0x01,
-	fdsr_drate_250kbps = 0x02
-};
-
-/** Bits in Main Status Register (MSR) */
-enum {
-	/** Request for Master */
-	fmsr_rqm = 0x80,
-	/** Data Input/Output */
-	fmsr_dio = 0x40,
-	/** Execution Mode */
-	fmsr_exm = 0x20,
-	/** FDC Busy */
-	fmsr_cb = 0x10,
-	/** FDD 3 Busy */
-	fmsr_d3b = 0x08,
-	/** FDD 2 Busy */
-	fmsr_d2b = 0x04,
-	/** FDD 1 Busy */
-	fmsr_d1b = 0x02,
-	/** FDD 0 Busy */
-	fmsr_d0b = 0x01,
-};
-
-/** Bits in Digital Input Register, PC-AT Mode */
-enum {
-	fdira_dsk_chg = 0x80
-};
-
-/** Bits in Digital Input Register, PS/2 Mode */
-enum {
-	fdir2_dsk_chg = 0x80,
-	fdir2_drate_sel1 = 0x04,
-	fdir2_drate_sel0 = 0x02,
-	fdir2_nhigh_dens = 0x01
-};
-
-/** Bits in Digital Input Register, Model 30 Mode */
-enum {
-	fdir3_dsk_chg = 0x80,
-	fdir3_ndma_gate = 0x08,
-	fdir3_noprec = 0x04,
-	fdir3_drate_sel1 = 0x02,
-	fdir3_drate_sel0 = 0x01
-};
-
-/** Bits in Configuration Control Register (CCR) */
-enum {
-	fccr_noprec = 0x04,
-	fccr_drate_sel1 = 0x02,
-	fccr_drate_sel0 = 0x01
-};
-
-/** Bits in Status Register 0 (SR0) */
-enum {
-	fsr0_ic_mask = 0xc0,
-	fsr0_ic_normal = 0x00,
-	fsr0_ic_abnormal = 0x40,
-	fsr0_ic_invcmd = 0x80,
-	fsr0_ic_abnormal_poll = 0xc0,
-	fsr0_seek_end = 0x20,
-	fsr0_equip_check = 0x10,
-	fsr0_head_addr = 0x04,
-	fsr0_ds1 = 0x02,
-	fsr0_ds0 = 0x01
-};
-
-/** Bits in Status Register 1 (SR1) */
-enum {
-	fsr1_end_of_cyl = 0x80,
-	fsr1_data_error = 0x20,
-	fsr1_overr_underr = 0x10,
-	fsr1_no_data = 0x04,
-	fsr1_not_writable = 0x02,
-	fsr1_missing_am = 0x01
-};
-
-/** Bits in Status Register 2 (SR2) */
-enum {
-	fsr2_control_mark = 0x40,
-	fsr1_derr_df = 0x20,
-	fsr1_wrong_cyl = 0x10,
-	fsr1_bad_cyl = 0x02,
-	fsr1_missing_dam = 0x01
-};
-
-/** Registers */
-typedef union {
-	struct { /* read only */
-		/** Status Register A */
-		uint8_t sra;
-		/** Starus Register B */
-		uint8_t srb;
-		/** Padding */
-		uint8_t ro_pad2[2];
-		/** Main Status Register */
-		uint8_t msr;
-		/** Padding */
-		uint8_t ro_pad5[2];
-		/** Digital Inut Register */
-		uint8_t dir;
-	};
-	struct { /* write only */
-		/** Padding */
-		uint8_t wo_pad0[4];
-		/** Datarate Select Register */
-		uint8_t dsr;
-		/** Padding */
-		uint8_t wo_pad5[2];
-		/** Configuration Control Register */
-		uint8_t ccr;
-	};
-	struct { /* read/write */
-		/** Padding */
-		uint8_t rw_pad0[2];
-		/** Digital Output Register */
-		uint8_t dor;
-		/** Tape Drive Register */
-		uint8_t tdr;
-		/** Padding */
-		uint8_t rw_pad4;
-		/** Data (FIFO) */
-		uint8_t data;
-	};
-} pc_fdc_regs_t;
-
-enum {
-	/** Max. time we need to wait for MSR status */
-	msr_max_wait_usec = 250
-};
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/pci-ide/doc/doxygroups.h
===================================================================
--- uspace/drv/block/pci-ide/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pci-ide pci-ide
- * @brief PCI IDE driver
- * @ingroup drvs
- */
Index: pace/drv/block/pci-ide/main.c
===================================================================
--- uspace/drv/block/pci-ide/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,419 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-
-#include "pci-ide.h"
-#include "pci-ide_hw.h"
-#include "main.h"
-
-static errno_t pci_ide_dev_add(ddf_dev_t *dev);
-static errno_t pci_ide_dev_remove(ddf_dev_t *dev);
-static errno_t pci_ide_dev_gone(ddf_dev_t *dev);
-static errno_t pci_ide_dev_quiesce(ddf_dev_t *dev);
-static errno_t pci_ide_fun_online(ddf_fun_t *fun);
-static errno_t pci_ide_fun_offline(ddf_fun_t *fun);
-
-static void pci_ide_connection(ipc_call_t *, void *);
-
-static driver_ops_t driver_ops = {
-	.dev_add = pci_ide_dev_add,
-	.dev_remove = pci_ide_dev_remove,
-	.dev_gone = pci_ide_dev_gone,
-	.dev_quiesce = pci_ide_dev_quiesce,
-	.fun_online = pci_ide_fun_online,
-	.fun_offline = pci_ide_fun_offline
-};
-
-static driver_t pci_ide_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t pci_ide_get_res(ddf_dev_t *dev, pci_ide_hwres_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.io_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Legacty ISA I/O ranges are fixed */
-
-	res->cmd1 = pci_ide_ata_cmd_p;
-	res->ctl1 = pci_ide_ata_ctl_p;
-	res->cmd2 = pci_ide_ata_cmd_s;
-	res->ctl2 = pci_ide_ata_ctl_s;
-
-	/* PCI I/O range */
-	addr_range_t *bmregs_rng = &hw_res.io_ranges.ranges[0];
-	res->bmregs = RNGABS(*bmregs_rng);
-
-	ddf_msg(LVL_NOTE, "sizes: %zu", RNGSZ(*bmregs_rng));
-
-	if (RNGSZ(*bmregs_rng) < sizeof(pci_ide_regs_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* IRQ */
-	if (hw_res.irqs.count > 0) {
-		res->irq1 = hw_res.irqs.irqs[0];
-	} else {
-		res->irq1 = -1;
-	}
-
-	if (hw_res.irqs.count > 1) {
-		res->irq2 = hw_res.irqs.irqs[1];
-	} else {
-		res->irq2 = -1;
-	}
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-/** Add new device
- *
- * @param  dev New device
- * @return     EOK on success or an error code.
- */
-static errno_t pci_ide_dev_add(ddf_dev_t *dev)
-{
-	pci_ide_ctrl_t *ctrl;
-	pci_ide_hwres_t res;
-	async_sess_t *parent_sess;
-	unsigned chans;
-	errno_t rc;
-
-	rc = pci_ide_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
-		return EINVAL;
-	}
-
-	ctrl = ddf_dev_data_alloc(dev, sizeof(pci_ide_ctrl_t));
-	if (ctrl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ctrl->dev = dev;
-
-	rc = pci_ide_ctrl_init(ctrl, &res);
-	if (rc != EOK)
-		goto error;
-
-	chans = 0;
-
-	rc = pci_ide_channel_init(ctrl, &ctrl->channel[0], 0, &res);
-	if (rc == EOK)
-		++chans;
-	else if (rc != ENOENT)
-		goto error;
-
-	rc = pci_ide_channel_init(ctrl, &ctrl->channel[1], 1, &res);
-	if (rc == EOK)
-		++chans;
-	else if (rc != ENOENT)
-		goto error;
-
-	if (chans == 0) {
-		ddf_msg(LVL_ERROR, "No PCI IDE devices found.");
-		rc = EIO;
-		goto error;
-	}
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Claim legacy I/O range to prevent ISA IDE from attaching there. */
-	rc = hw_res_claim_legacy_io(parent_sess, hwc_isa_ide);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed claiming legacy I/O range.");
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-static char *pci_ide_fun_name(pci_ide_channel_t *chan, unsigned idx)
-{
-	char *fun_name;
-
-	if (asprintf(&fun_name, "c%ud%u", chan->chan_id, idx) < 0)
-		return NULL;
-
-	return fun_name;
-}
-
-errno_t pci_ide_fun_create(pci_ide_channel_t *chan, unsigned idx, void *charg)
-{
-	errno_t rc;
-	char *fun_name = NULL;
-	ddf_fun_t *fun = NULL;
-	pci_ide_fun_t *ifun = NULL;
-	bool bound = false;
-
-	fun_name = pci_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun = ddf_fun_create(chan->ctrl->dev, fun_exposed, fun_name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating DDF function.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Allocate soft state */
-	ifun = ddf_fun_data_alloc(fun, sizeof(pci_ide_fun_t));
-	if (ifun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating softstate.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ifun->fun = fun;
-	ifun->charg = charg;
-
-	/* Set up a connection handler. */
-	ddf_fun_set_conn_handler(fun, pci_ide_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding DDF function %s: %s",
-		    fun_name, str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "disk");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function %s to "
-		    "category 'disk': %s", fun_name, str_error(rc));
-		goto error;
-	}
-
-	free(fun_name);
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	if (fun_name != NULL)
-		free(fun_name);
-
-	return rc;
-}
-
-errno_t pci_ide_fun_remove(pci_ide_channel_t *chan, unsigned idx)
-{
-	errno_t rc;
-	char *fun_name;
-	pci_ide_fun_t *ifun = chan->fun[idx];
-
-	fun_name = pci_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "pci_ide_fun_remove(%p, '%s')", ifun, fun_name);
-	rc = ddf_fun_offline(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", fun_name);
-		goto error;
-	}
-
-	rc = ddf_fun_unbind(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
-		goto error;
-	}
-
-	ddf_fun_destroy(ifun->fun);
-	free(fun_name);
-	return EOK;
-error:
-	if (fun_name != NULL)
-		free(fun_name);
-	return rc;
-}
-
-errno_t pci_ide_fun_unbind(pci_ide_channel_t *chan, unsigned idx)
-{
-	errno_t rc;
-	char *fun_name;
-	pci_ide_fun_t *ifun = chan->fun[idx];
-
-	fun_name = pci_ide_fun_name(chan, idx);
-	if (fun_name == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "pci_ide_fun_unbind(%p, '%s')", ifun, fun_name);
-	rc = ddf_fun_unbind(ifun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", fun_name);
-		goto error;
-	}
-
-	ddf_fun_destroy(ifun->fun);
-	free(fun_name);
-	return EOK;
-error:
-	if (fun_name != NULL)
-		free(fun_name);
-	return rc;
-}
-
-static errno_t pci_ide_dev_remove(ddf_dev_t *dev)
-{
-	pci_ide_ctrl_t *ctrl = (pci_ide_ctrl_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_dev_remove(%p)", dev);
-
-	rc = pci_ide_channel_fini(&ctrl->channel[0]);
-	if (rc != EOK)
-		return rc;
-
-	rc = pci_ide_channel_fini(&ctrl->channel[1]);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t pci_ide_dev_gone(ddf_dev_t *dev)
-{
-	pci_ide_ctrl_t *ctrl = (pci_ide_ctrl_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_dev_gone(%p)", dev);
-
-	rc = pci_ide_ctrl_fini(ctrl);
-	if (rc != EOK)
-		return rc;
-
-	rc = pci_ide_channel_fini(&ctrl->channel[0]);
-	if (rc != EOK)
-		return rc;
-
-	rc = pci_ide_channel_fini(&ctrl->channel[1]);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t pci_ide_dev_quiesce(ddf_dev_t *dev)
-{
-	pci_ide_ctrl_t *ctrl = (pci_ide_ctrl_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pci_ide_dev_quiesce(%p)", dev);
-
-	pci_ide_channel_quiesce(&ctrl->channel[0]);
-	pci_ide_channel_quiesce(&ctrl->channel[1]);
-
-	return EOK;
-}
-
-static errno_t pci_ide_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pci_ide_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t pci_ide_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pci_ide_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-static void pci_ide_connection(ipc_call_t *icall, void *arg)
-{
-	pci_ide_fun_t *ifun;
-
-	ifun = (pci_ide_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
-	ata_connection(icall, ifun->charg);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS PCI IDE device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&pci_ide_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/pci-ide/main.h
===================================================================
--- uspace/drv/block/pci-ide/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-/** @file PCI IDE driver main module
- */
-
-#ifndef MAIN_H
-#define MAIN_H
-
-#include "pci-ide.h"
-
-extern errno_t pci_ide_fun_create(pci_ide_channel_t *, unsigned, void *);
-extern errno_t pci_ide_fun_remove(pci_ide_channel_t *, unsigned);
-extern errno_t pci_ide_fun_unbind(pci_ide_channel_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/pci-ide/meson.build
===================================================================
--- uspace/drv/block/pci-ide/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ata', 'scsi' ]
-src = files('pci-ide.c', 'main.c')
Index: pace/drv/block/pci-ide/pci-ide.c
===================================================================
--- uspace/drv/block/pci-ide/pci-ide.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,738 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-
-/**
- * @file
- * @brief PCI IDE driver
- */
-
-#include <assert.h>
-#include <ddi.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <async.h>
-#include <as.h>
-#include <fibril_synch.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <str.h>
-#include <inttypes.h>
-#include <errno.h>
-
-#include "pci-ide.h"
-#include "main.h"
-
-static errno_t pci_ide_init_io(pci_ide_channel_t *);
-static void pci_ide_fini_io(pci_ide_channel_t *);
-static errno_t pci_ide_init_irq(pci_ide_channel_t *);
-static void pci_ide_fini_irq(pci_ide_channel_t *);
-static void pci_ide_irq_handler(ipc_call_t *, void *);
-
-static void pci_ide_write_data_16(void *, uint16_t *, size_t);
-static void pci_ide_read_data_16(void *, uint16_t *, size_t);
-static void pci_ide_write_cmd_8(void *, uint16_t, uint8_t);
-static uint8_t pci_ide_read_cmd_8(void *, uint16_t);
-static void pci_ide_write_ctl_8(void *, uint16_t, uint8_t);
-static uint8_t pci_ide_read_ctl_8(void *, uint16_t);
-static errno_t pci_ide_irq_enable(void *);
-static errno_t pci_ide_irq_disable(void *);
-static void pci_ide_dma_chan_setup(void *, void *, size_t, ata_dma_dir_t);
-static void pci_ide_dma_chan_teardown(void *);
-static errno_t pci_ide_add_device(void *, unsigned, void *);
-static errno_t pci_ide_remove_device(void *, unsigned);
-static void pci_ide_msg_debug(void *, char *);
-static void pci_ide_msg_note(void *, char *);
-static void pci_ide_msg_warn(void *, char *);
-static void pci_ide_msg_error(void *, char *);
-
-static const irq_pio_range_t pci_ide_irq_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(ata_cmd_t)
-	},
-	{
-		.base = 0,
-		.size = sizeof(pci_ide_regs_t)
-	}
-};
-
-/** IDE interrupt pseudo code. */
-static const irq_cmd_t pci_ide_irq_cmds[] = {
-	/* [0] Read BMISX */
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.dstarg = 1
-	},
-	/* [1] Test BMISX.IDEINTS */
-	{
-		.cmd = CMD_AND,
-		.value = bmisx_ideints,
-		.srcarg = 1,
-		.dstarg = 2
-	},
-	/* [2] if (BMISX.IDEINTS != 0) { */
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 2,
-		.value = 3
-	},
-	/*
-	 * [3] Clear BMISX.IDEINTS by writing 1 to it. This clears bits 6,5,
-	 * but that should not matter.
-	 */
-	{
-		.cmd = CMD_PIO_WRITE_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.value = bmisx_ideints
-	},
-	/* [4] Read IDE status register */
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.dstarg = 1
-	},
-	/* [5] Accept */
-	{
-		.cmd = CMD_ACCEPT
-	},
-	/* [6] } else { Decline */
-	{
-		.cmd = CMD_DECLINE
-	}
-	/* } */
-};
-
-/** Initialize PCI IDE controller.
- *
- * @param ctrl PCI IDE controller
- * @param res Hardware resources
- *
- * @return EOK on success or an error code
- */
-errno_t pci_ide_ctrl_init(pci_ide_ctrl_t *ctrl, pci_ide_hwres_t *res)
-{
-	errno_t rc;
-	void *vaddr;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_ctrl_init()");
-	ctrl->bmregs_physical = res->bmregs;
-
-	ddf_msg(LVL_NOTE, "Bus master IDE regs I/O address: 0x%" PRIxPTR,
-	    ctrl->bmregs_physical);
-
-	rc = pio_enable((void *)ctrl->bmregs_physical, sizeof(pci_ide_regs_t),
-	    &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	ctrl->bmregs = vaddr;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_ctrl_init: DONE");
-	return EOK;
-}
-
-/** Finalize PCI IDE controller.
- *
- * @param ctrl PCI IDE controller
- * @return EOK on success or an error code
- */
-errno_t pci_ide_ctrl_fini(pci_ide_ctrl_t *ctrl)
-{
-	ddf_msg(LVL_DEBUG, ": pci_ide_ctrl_fini()");
-
-	// XXX TODO
-	return EOK;
-}
-
-/** Initialize PCI IDE channel. */
-errno_t pci_ide_channel_init(pci_ide_ctrl_t *ctrl, pci_ide_channel_t *chan,
-    unsigned chan_id, pci_ide_hwres_t *res)
-{
-	errno_t rc;
-	bool irq_inited = false;
-	ata_params_t params;
-	void *buffer = NULL;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_channel_init()");
-
-	memset(&params, 0, sizeof(params));
-
-	chan->ctrl = ctrl;
-	chan->chan_id = chan_id;
-	fibril_mutex_initialize(&chan->lock);
-	if (chan_id == 0) {
-		chan->cmd_physical = res->cmd1;
-		chan->ctl_physical = res->ctl1;
-		chan->irq = res->irq1;
-	} else {
-		chan->cmd_physical = res->cmd2;
-		chan->ctl_physical = res->ctl2;
-		chan->irq = res->irq2;
-	}
-
-	chan->dma_buf_size = 8192;
-
-	ddf_msg(LVL_NOTE, "I/O address %p/%p", (void *) chan->cmd_physical,
-	    (void *) chan->ctl_physical);
-
-	ddf_msg(LVL_DEBUG, "Init I/O");
-	rc = pci_ide_init_io(chan);
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "Init IRQ");
-	rc = pci_ide_init_irq(chan);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "init IRQ failed");
-		goto error;
-	}
-
-	irq_inited = true;
-
-	ddf_msg(LVL_DEBUG, "Allocate PRD table");
-
-	buffer = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(sizeof (pci_ide_prd_t), DMAMEM_4GiB | 0xffff,
-	    AS_AREA_WRITE | AS_AREA_READ, 0, &chan->prdt_pa, &buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Failed allocating PRD table.");
-		goto error;
-	}
-
-	chan->prdt = (pci_ide_prd_t *)buffer;
-
-	ddf_msg(LVL_DEBUG, "Allocate DMA buffer");
-
-	buffer = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(chan->dma_buf_size, DMAMEM_4GiB | 0xffff,
-	    AS_AREA_WRITE | AS_AREA_READ, 0, &chan->dma_buf_pa, &buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Failed allocating PRD table.");
-		goto error;
-	}
-
-	chan->dma_buf = buffer;
-
-	/* Populate PRD with information on our single DMA buffer */
-	chan->prdt->pba = host2uint32_t_le(chan->dma_buf_pa);
-	chan->prdt->bcnt = host2uint16_t_le(chan->dma_buf_size);
-	chan->prdt->eot_res = host2uint16_t_le(pci_ide_prd_eot);
-
-	/* Program PRD table pointer register */
-	if (chan_id == 0) {
-		pio_write_32(&chan->ctrl->bmregs->bmidtpp,
-		    (uint32_t)chan->prdt_pa);
-	} else {
-		pio_write_32(&chan->ctrl->bmregs->bmidtps,
-		    (uint32_t)chan->prdt_pa);
-	}
-
-	ddf_msg(LVL_DEBUG, "pci_ide_channel_init(): Initialize IDE channel");
-
-	params.arg = (void *)chan;
-	params.have_irq = (chan->irq >= 0) ? true : false;
-	params.use_dma = true;
-	params.max_dma_xfer = chan->dma_buf_size;
-	params.write_data_16 = pci_ide_write_data_16;
-	params.read_data_16 = pci_ide_read_data_16;
-	params.write_cmd_8 = pci_ide_write_cmd_8;
-	params.read_cmd_8 = pci_ide_read_cmd_8;
-	params.write_ctl_8 = pci_ide_write_ctl_8;
-	params.read_ctl_8 = pci_ide_read_ctl_8;
-	params.irq_enable = pci_ide_irq_enable;
-	params.irq_disable = pci_ide_irq_disable;
-	params.dma_chan_setup = pci_ide_dma_chan_setup;
-	params.dma_chan_teardown = pci_ide_dma_chan_teardown;
-	params.add_device = pci_ide_add_device;
-	params.remove_device = pci_ide_remove_device;
-	params.msg_debug = pci_ide_msg_debug;
-	params.msg_note = pci_ide_msg_note;
-	params.msg_warn = pci_ide_msg_warn;
-	params.msg_error = pci_ide_msg_error;
-
-	rc = ata_channel_create(&params, &chan->channel);
-	if (rc != EOK)
-		goto error;
-
-	rc = ata_channel_initialize(chan->channel);
-	if (rc != EOK)
-		goto error;
-
-	ddf_msg(LVL_DEBUG, "pci_ide_channel_init: DONE");
-	return EOK;
-error:
-	if (chan->channel != NULL) {
-		(void) ata_channel_destroy(chan->channel);
-		chan->channel = NULL;
-	}
-	if (buffer != NULL)
-		dmamem_unmap_anonymous(buffer);
-	if (irq_inited)
-		pci_ide_fini_irq(chan);
-	pci_ide_fini_io(chan);
-	return rc;
-}
-
-/** Finalize PCI IDE channel. */
-errno_t pci_ide_channel_fini(pci_ide_channel_t *chan)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, ": pci_ide_channel_fini()");
-
-	fibril_mutex_lock(&chan->lock);
-
-	rc = ata_channel_destroy(chan->channel);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return rc;
-	}
-
-	dmamem_unmap_anonymous(chan->dma_buf);
-	pci_ide_fini_irq(chan);
-	pci_ide_fini_io(chan);
-	fibril_mutex_unlock(&chan->lock);
-
-	return EOK;
-}
-
-/** Quiesce PCI IDE channel. */
-void pci_ide_channel_quiesce(pci_ide_channel_t *chan)
-{
-	ddf_msg(LVL_DEBUG, ": pci_ide_channel_quiesce()");
-
-	fibril_mutex_lock(&chan->lock);
-	ata_channel_quiesce(chan->channel);
-	fibril_mutex_unlock(&chan->lock);
-}
-
-/** Enable device I/O. */
-static errno_t pci_ide_init_io(pci_ide_channel_t *chan)
-{
-	errno_t rc;
-	void *vaddr;
-
-	rc = pio_enable((void *) chan->cmd_physical, sizeof(ata_cmd_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	chan->cmd = vaddr;
-
-	rc = pio_enable((void *) chan->ctl_physical, sizeof(ata_ctl_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	chan->ctl = vaddr;
-
-	rc = pio_enable((void *) chan->cmd_physical, sizeof(ata_cmd_t), &vaddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot initialize device I/O space.");
-		return rc;
-	}
-
-	chan->cmd = vaddr;
-
-	return EOK;
-}
-
-/** Clean up device I/O. */
-static void pci_ide_fini_io(pci_ide_channel_t *chan)
-{
-	(void) chan;
-	/* XXX TODO */
-}
-
-/** Initialize IRQ. */
-static errno_t pci_ide_init_irq(pci_ide_channel_t *chan)
-{
-	irq_code_t irq_code;
-	irq_pio_range_t *ranges;
-	irq_cmd_t *cmds;
-	uint8_t *bmisx;
-	errno_t rc;
-
-	if (chan->irq < 0)
-		return EOK;
-
-	ranges = malloc(sizeof(pci_ide_irq_ranges));
-	if (ranges == NULL)
-		return ENOMEM;
-
-	cmds = malloc(sizeof(pci_ide_irq_cmds));
-	if (cmds == NULL) {
-		free(cmds);
-		return ENOMEM;
-	}
-
-	/* Bus master IDE status register (primary or secondary) */
-	bmisx = chan->chan_id == 0 ?
-	    &chan->ctrl->bmregs->bmisp :
-	    &chan->ctrl->bmregs->bmiss;
-
-	memcpy(ranges, &pci_ide_irq_ranges, sizeof(pci_ide_irq_ranges));
-	ranges[0].base = chan->cmd_physical;
-	ranges[1].base = chan->ctrl->bmregs_physical;
-
-	memcpy(cmds, &pci_ide_irq_cmds, sizeof(pci_ide_irq_cmds));
-	cmds[0].addr = bmisx;
-	cmds[3].addr = bmisx;
-	cmds[4].addr = &chan->cmd->status;
-
-	irq_code.rangecount = sizeof(pci_ide_irq_ranges) / sizeof(irq_pio_range_t);
-	irq_code.ranges = ranges;
-	irq_code.cmdcount = sizeof(pci_ide_irq_cmds) / sizeof(irq_cmd_t);
-	irq_code.cmds = cmds;
-
-	ddf_msg(LVL_NOTE, "IRQ %d", chan->irq);
-	rc = register_interrupt_handler(chan->ctrl->dev, chan->irq,
-	    pci_ide_irq_handler, (void *)chan, &irq_code, &chan->ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ.");
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Interrupt handler registered");
-	free(ranges);
-	free(cmds);
-	return EOK;
-error:
-	free(ranges);
-	free(cmds);
-	return rc;
-}
-
-/** Clean up IRQ. */
-static void pci_ide_fini_irq(pci_ide_channel_t *chan)
-{
-	errno_t rc;
-	async_sess_t *parent_sess;
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_disable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Error disabling IRQ.");
-
-	(void) unregister_interrupt_handler(chan->ctrl->dev, chan->ihandle);
-}
-
-/** Interrupt handler.
- *
- * @param call Call data
- * @param arg Argument (pci_ide_channel_t *)
- */
-static void pci_ide_irq_handler(ipc_call_t *call, void *arg)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	uint8_t status;
-	async_sess_t *parent_sess;
-
-	status = ipc_get_arg1(call);
-	ata_channel_irq(chan->channel, status);
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-	hw_res_clear_interrupt(parent_sess, chan->irq);
-}
-
-/** Write the data register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param data Data
- * @param nwords Number of words to write
- */
-static void pci_ide_write_data_16(void *arg, uint16_t *data, size_t nwords)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	size_t i;
-
-	for (i = 0; i < nwords; i++)
-		pio_write_16(&chan->cmd->data_port, data[i]);
-}
-
-/** Read the data register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param buf Destination buffer
- * @param nwords Number of words to read
- */
-static void pci_ide_read_data_16(void *arg, uint16_t *buf, size_t nwords)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	size_t i;
-
-	for (i = 0; i < nwords; i++)
-		buf[i] = pio_read_16(&chan->cmd->data_port);
-}
-
-/** Write command register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param off Register offset
- * @param value Value to write to command register
- */
-static void pci_ide_write_cmd_8(void *arg, uint16_t off, uint8_t value)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-
-	pio_write_8(((ioport8_t *)chan->cmd) + off, value);
-}
-
-/** Read command register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param off Register offset
- * @return value Value read from command register
- */
-static uint8_t pci_ide_read_cmd_8(void *arg, uint16_t off)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-
-	return pio_read_8(((ioport8_t *)chan->cmd) + off);
-}
-
-/** Write control register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param off Register offset
- * @param value Value to write to control register
- */
-static void pci_ide_write_ctl_8(void *arg, uint16_t off, uint8_t value)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-
-	pio_write_8(((ioport8_t *)chan->ctl) + off, value);
-}
-
-/** Read control register callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param off Register offset
- * @return value Value read from control register
- */
-static uint8_t pci_ide_read_ctl_8(void *arg, uint16_t off)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-
-	return pio_read_8(((ioport8_t *)chan->ctl) + off);
-}
-
-/** Enable IRQ callback handler
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @return EOK on success or an error code
- */
-static errno_t pci_ide_irq_enable(void *arg)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Enable IRQ %d for channel %u",
-	    chan->irq, chan->chan_id);
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_enable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling IRQ.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Disable IRQ callback handler
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @return EOK on success or an error code
- */
-static errno_t pci_ide_irq_disable(void *arg)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Disable IRQ");
-
-	parent_sess = ddf_dev_parent_sess_get(chan->ctrl->dev);
-
-	rc = hw_res_disable_interrupt(parent_sess, chan->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error disabling IRQ.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Set up DMA channel callback handler
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param buf Buffer
- * @param buf_size Buffer size
- * @param dir DMA transfer direction
- */
-static void pci_ide_dma_chan_setup(void *arg, void *buf, size_t buf_size,
-    ata_dma_dir_t dir)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	uint8_t *bmicx;
-	uint8_t val;
-
-	/* Needed later in teardown */
-	chan->cur_dir = dir;
-	chan->cur_buf = buf;
-	chan->cur_buf_size = buf_size;
-
-	if (dir == ata_dma_write) {
-		assert(buf_size <= chan->dma_buf_size);
-		memcpy(chan->dma_buf, buf, buf_size);
-	}
-
-	/* Primary or secondary channel control register */
-	bmicx = (chan->chan_id == 0) ? &chan->ctrl->bmregs->bmicp :
-	    &chan->ctrl->bmregs->bmics;
-
-	/* Set read / write */
-	val = (dir == ata_dma_write) ? bmicx_rwcon : 0;
-	pio_write_8(bmicx, val);
-
-	/* Start bus master DMA engine */
-	val = val | bmicx_ssbm;
-	pio_write_8(bmicx, val);
-}
-
-/** Tear down DMA channel callback handler
- *
- * @param arg Argument (pci_ide_channel_t *)
- */
-static void pci_ide_dma_chan_teardown(void *arg)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	uint8_t *bmicx;
-	uint8_t val;
-
-	/* Primary or secondary channel control register */
-	bmicx = (chan->chan_id == 0) ? &chan->ctrl->bmregs->bmicp :
-	    &chan->ctrl->bmregs->bmics;
-
-	/* Stop bus master DMA engine clear SSBM but keep RWCON the same */
-	val = (chan->cur_dir == ata_dma_write) ? bmicx_rwcon : 0;
-	pio_write_8(bmicx, val);
-
-	if (chan->cur_dir == ata_dma_read) {
-		assert(chan->cur_buf_size <= chan->dma_buf_size);
-		memcpy(chan->cur_buf, chan->dma_buf, chan->cur_buf_size);
-	}
-}
-
-/** Add ATA device callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param idx Device index
- * $param charg Connection handler argument
- * @return EOK on success or an error code
- */
-static errno_t pci_ide_add_device(void *arg, unsigned idx, void *charg)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	return pci_ide_fun_create(chan, idx, charg);
-}
-
-/** Remove ATA device callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param idx Device index
- * @return EOK on success or an error code
- */
-static errno_t pci_ide_remove_device(void *arg, unsigned idx)
-{
-	pci_ide_channel_t *chan = (pci_ide_channel_t *)arg;
-	return pci_ide_fun_remove(chan, idx);
-}
-
-/** Debug message callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param msg Message
- */
-static void pci_ide_msg_debug(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_DEBUG, "%s", msg);
-}
-
-/** Notice message callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param msg Message
- */
-static void pci_ide_msg_note(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_NOTE, "%s", msg);
-}
-
-/** Warning message callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param msg Message
- */
-static void pci_ide_msg_warn(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_WARN, "%s", msg);
-}
-
-/** Error message callback handler.
- *
- * @param arg Argument (pci_ide_channel_t *)
- * @param msg Message
- */
-static void pci_ide_msg_error(void *arg, char *msg)
-{
-	(void)arg;
-	ddf_msg(LVL_ERROR, "%s", msg);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/pci-ide/pci-ide.h
===================================================================
--- uspace/drv/block/pci-ide/pci-ide.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-/** @file PCI IDE driver definitions.
- */
-
-#ifndef PCI_IDE_H
-#define PCI_IDE_H
-
-#include <ata/ata.h>
-#include <ata/ata_hw.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "pci-ide_hw.h"
-
-#define NAME "pci-ide"
-
-/** PCI IDE hardware resources */
-typedef struct {
-	uintptr_t bmregs; /** PCI Bus Master register block base address. */
-	uintptr_t cmd1;	/**< Primary channel command block base address. */
-	uintptr_t ctl1;	/**< Primary channel control block base address. */
-	uintptr_t cmd2;	/**< Secondary channel command block base address. */
-	uintptr_t ctl2;	/**< Secondary channel control block base address. */
-	int irq1;	/**< Primary channel IRQ */
-	int irq2;	/**< Secondary channel IRQ */
-} pci_ide_hwres_t;
-
-/** PCI IDE channel */
-typedef struct pci_ide_channel {
-	/** Parent controller */
-	struct pci_ide_ctrl *ctrl;
-	/** I/O base address of the command registers */
-	uintptr_t cmd_physical;
-	/** I/O base address of the control registers */
-	uintptr_t ctl_physical;
-
-	/** Command registers */
-	ata_cmd_t *cmd;
-	/** Control registers */
-	ata_ctl_t *ctl;
-	/** IRQ (-1 if not used) */
-	int irq;
-	/** IRQ handle */
-	cap_irq_handle_t ihandle;
-
-	/** Synchronize controller access */
-	fibril_mutex_t lock;
-	/** Value of status register read by interrupt handler */
-	uint8_t irq_status;
-
-	/** Physical region descriptor table */
-	pci_ide_prd_t *prdt;
-	/** Physical region descriptor table physical address */
-	uintptr_t prdt_pa;
-	/** DMA buffer */
-	void *dma_buf;
-	/** DMA buffer physical address */
-	uintptr_t dma_buf_pa;
-	/** DMA buffer size */
-	size_t dma_buf_size;
-	/** Current DMA transfer direction */
-	ata_dma_dir_t cur_dir;
-	/** Current data buffer */
-	void *cur_buf;
-	/** Current data buffer size */
-	size_t cur_buf_size;
-
-	/** Libata ATA channel */
-	ata_channel_t *channel;
-	struct pci_ide_fun *fun[2];
-
-	/** Channel ID */
-	unsigned chan_id;
-} pci_ide_channel_t;
-
-/** ISA IDE controller */
-typedef struct pci_ide_ctrl {
-	/** DDF device */
-	ddf_dev_t *dev;
-
-	/** I/O base address of bus master IDE registers */
-	uintptr_t bmregs_physical;
-	/** Bus master IDE registers */
-	pci_ide_regs_t *bmregs;
-	/** Primary and secondary channel */
-	pci_ide_channel_t channel[2];
-} pci_ide_ctrl_t;
-
-/** PCI IDE function */
-typedef struct pci_ide_fun {
-	ddf_fun_t *fun;
-	void *charg;
-} pci_ide_fun_t;
-
-extern errno_t pci_ide_ctrl_init(pci_ide_ctrl_t *, pci_ide_hwres_t *);
-extern errno_t pci_ide_ctrl_fini(pci_ide_ctrl_t *);
-extern errno_t pci_ide_channel_init(pci_ide_ctrl_t *, pci_ide_channel_t *,
-    unsigned, pci_ide_hwres_t *);
-extern errno_t pci_ide_channel_fini(pci_ide_channel_t *);
-extern void pci_ide_channel_quiesce(pci_ide_channel_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/pci-ide/pci-ide.ma
===================================================================
--- uspace/drv/block/pci-ide/pci-ide.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 pci/ven=8086&dev=7010
Index: pace/drv/block/pci-ide/pci-ide_hw.h
===================================================================
--- uspace/drv/block/pci-ide/pci-ide_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pci-ide
- * @{
- */
-/** @file PCI IDE hardware protocol (registers, data structures).
- *
- * Based on Intel 82371AB PCI-TO-ISA / IDE XCELERATOR (PIIX4) document.
- */
-
-#ifndef PCI_IDE_HW_H
-#define PCI_IDE_HW_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-/** PCI Bus Master IDE I/O Registers */
-typedef struct {
-	/** Bus Master IDE Command (primary) */
-	uint8_t bmicp;
-	uint8_t rsvd1;
-	/** Bus Master IDE Command (secondary) */
-	uint8_t bmisp;
-	uint8_t rsvd3;
-	/** Bus Master IDE Descriptor Table Pointer (primary) */
-	uint32_t bmidtpp;
-	/** Bus Master IDE Status (secondary) */
-	uint8_t bmics;
-	uint8_t rsvd9;
-	/** Bus Master IDE Status (secondary) */
-	uint8_t bmiss;
-	uint8_t rsvd11;
-	/** Bus Master IDE Descriptor Table Pointer (secondary) */
-	uint32_t bmidtps;
-} pci_ide_regs_t;
-
-enum pci_ide_bmicx_bits {
-	/** Bus Master Read/Write Control */
-	bmicx_rwcon = 0x08,
-	/** Start/Stop Bus Master */
-	bmicx_ssbm = 0x01
-};
-
-enum pci_ide_bmisx_bits {
-	/** Drive 1 DMA Capable */
-	bmisx_dma1cap = 0x40,
-	/** Drive 0 DMA Capable */
-	bmisx_dma0cap = 0x20,
-	/** IDE Interrupte Status */
-	bmisx_ideints = 0x04,
-	/** IDE DMA Error */
-	bmisx_idedmaerr = 0x02,
-	/** Bus Master IDR Active */
-	bmisx_bmidea = 0x01
-};
-
-#define PCI_IDE_CFG_IDETIM 0x40
-#define PCI_IDE_CFG_SIDETIM 0x44
-#define PCI_IDE_CFG_UDMACTL 0x48
-#define PCI_IDE_CFG_UDMATIM 0x4a
-
-/*
- * For PIIX we need to use ATA ports at fixed legacy ISA addresses.
- * There are no corresponding PCI I/O ranges and these adresses are
- * fixed and cannot be reconfigured.
- */
-enum {
-	pci_ide_ata_cmd_p = 0x01f0,
-	pci_ide_ata_ctl_p = 0x03f4,
-	pci_ide_ata_cmd_s = 0x0170,
-	pci_ide_ata_ctl_s = 0x0374
-};
-
-enum {
-	pci_ide_prd_eot = 0x8000
-};
-
-/** PIIX physical region descriptor */
-typedef struct {
-	/** Physical base address */
-	uint32_t pba;
-	/** Byte count */
-	uint16_t bcnt;
-	/** EOT / reserved */
-	uint16_t eot_res;
-} pci_ide_prd_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/block/usbmast/bo_trans.c
===================================================================
--- uspace/drv/block/usbmast/bo_trans.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,272 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/**
- * @file
- * USB mass storage bulk-only transport.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/dev/request.h>
-
-#include "bo_trans.h"
-#include "cmdw.h"
-#include "usbmast.h"
-
-#define MASTLOG(format, ...) \
-	usb_log_debug2("USB cl08: " format, ##__VA_ARGS__)
-
-/** Send command via bulk-only transport.
- *
- * @param mfun		Mass storage function
- * @param tag		Command block wrapper tag (automatically compared
- *			with answer)
- * @param cmd		SCSI command
- *
- * @return		Error code
- */
-errno_t usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, scsi_cmd_t *cmd)
-{
-	errno_t rc;
-
-	if (cmd->data_in && cmd->data_out)
-		return EINVAL;
-
-	usb_pipe_t *bulk_in_pipe = mfun->mdev->bulk_in_pipe;
-	usb_pipe_t *bulk_out_pipe = mfun->mdev->bulk_out_pipe;
-
-	usb_pipe_t *dpipe = bulk_out_pipe;
-	usb_direction_t ddir = USB_DIRECTION_OUT;
-	size_t dbuf_size = cmd->data_out_size;
-
-	if (cmd->data_in) {
-		ddir = USB_DIRECTION_IN;
-		dbuf_size = cmd->data_in_size;
-		dpipe = bulk_in_pipe;
-	}
-
-	/* Prepare CBW - command block wrapper */
-	usb_massstor_cbw_t cbw;
-	usb_massstor_cbw_prepare(&cbw, tag, dbuf_size, ddir, mfun->lun,
-	    cmd->cdb_size, cmd->cdb);
-
-	/* Send the CBW. */
-	MASTLOG("Sending CBW.\n");
-	rc = usb_pipe_write(bulk_out_pipe, &cbw, sizeof(cbw));
-	MASTLOG("CBW '%s' sent: %s.\n",
-	    usb_debug_str_buffer((uint8_t *) &cbw, sizeof(cbw), 0),
-	    str_error(rc));
-	if (rc != EOK) {
-		usb_log_error("Bulk out write failed: %s", str_error(rc));
-		return EIO;
-	}
-
-	MASTLOG("Transferring data.\n");
-	if (cmd->data_in) {
-		size_t act_size;
-		/* Recieve data from the device. */
-		rc = usb_pipe_read(dpipe, cmd->data_in, cmd->data_in_size,
-		    &act_size);
-		MASTLOG("Received %zu bytes (%s): %s.\n", act_size,
-		    usb_debug_str_buffer(cmd->data_in, act_size, 0),
-		    str_error(rc));
-	}
-	if (cmd->data_out) {
-		/* Send data to the device. */
-		rc = usb_pipe_write(dpipe, cmd->data_out, cmd->data_out_size);
-		MASTLOG("Sent %zu bytes (%s): %s.\n", cmd->data_out_size,
-		    usb_debug_str_buffer(cmd->data_out, cmd->data_out_size, 0),
-		    str_error(rc));
-	}
-
-	if (rc == ESTALL) {
-		/* Clear stall condition and continue below to read CSW. */
-		usb_pipe_clear_halt(
-		    usb_device_get_default_pipe(mfun->mdev->usb_dev), dpipe);
-	} else if (rc != EOK) {
-		usb_log_error("Failed to transfer data: %s", str_error(rc));
-		return EIO;
-	}
-
-	/* Read CSW. */
-	usb_massstor_csw_t csw;
-	size_t csw_size;
-	MASTLOG("Reading CSW.\n");
-	rc = usb_pipe_read(bulk_in_pipe, &csw, sizeof(csw), &csw_size);
-	MASTLOG("CSW '%s' received (%zu bytes): %s.\n",
-	    usb_debug_str_buffer((uint8_t *) &csw, csw_size, 0), csw_size,
-	    str_error(rc));
-	if (rc != EOK) {
-		usb_log_error("Failed to read CSW: %s", str_error(rc));
-		return EIO;
-	}
-
-	if (csw_size != sizeof(csw)) {
-		usb_log_error("Received CSW of incorrect size.");
-		return EIO;
-	}
-
-	if (csw.dCSWTag != tag) {
-		usb_log_error("Received CSW with incorrect tag. (expected: %"
-		    PRIX32 " received: %" PRIx32, tag, csw.dCSWTag);
-		return EIO;
-	}
-
-	/*
-	 * Determine the actual return value from the CSW.
-	 */
-	switch (csw.dCSWStatus) {
-	case cbs_passed:
-		cmd->status = CMDS_GOOD;
-		break;
-	case cbs_failed:
-		cmd->status = CMDS_FAILED;
-		usb_log_error("CBS Failed.");
-		break;
-	case cbs_phase_error:
-		usb_log_error("CBS phase error.");
-		rc = EIO;
-		break;
-	default:
-		usb_log_error("CBS other error.");
-		rc = EIO;
-		break;
-	}
-
-	const size_t residue = uint32_usb2host(csw.dCSWDataResidue);
-	if (residue > dbuf_size) {
-		usb_log_error("Residue > buffer size (%zu > %zu).",
-		    residue, dbuf_size);
-		return EIO;
-	}
-
-	/*
-	 * When the device has less data to send than requested (or cannot
-	 * receive moredata), it can either stall the pipe or send garbage
-	 * (ignore data) and indicate that via the residue field in CSW.
-	 * That means dbuf_size - residue is the authoritative size of data
-	 * received (sent).
-	 */
-
-	if (cmd->data_in)
-		cmd->rcvd_size = dbuf_size - residue;
-
-	return rc;
-}
-
-/** Perform bulk-only mass storage reset.
- *
- * @param mfun		Mass storage function
- * @return		Error code
- */
-errno_t usb_massstor_reset(usbmast_dev_t *mdev)
-{
-	return usb_control_request_set(
-	    usb_device_get_default_pipe(mdev->usb_dev),
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    0xFF, 0, usb_device_get_iface_number(mdev->usb_dev), NULL, 0);
-}
-
-/** Perform complete reset recovery of bulk-only mass storage.
- *
- * Notice that no error is reported because if this fails, the error
- * would reappear on next transaction somehow.
- *
- * @param mfun		Mass storage function
- */
-void usb_massstor_reset_recovery(usbmast_dev_t *mdev)
-{
-	/*
-	 * We would ignore errors here because if this fails
-	 * we are doomed anyway and any following transaction would fail.
-	 */
-	usb_massstor_reset(mdev);
-	usb_pipe_clear_halt(usb_device_get_default_pipe(mdev->usb_dev),
-	    mdev->bulk_in_pipe);
-	usb_pipe_clear_halt(usb_device_get_default_pipe(mdev->usb_dev),
-	    mdev->bulk_out_pipe);
-}
-
-/** Get max LUN of a mass storage device.
- *
- * @see usb_masstor_get_lun_count
- *
- * @warning Error from this command does not necessarily indicate malfunction
- * of the device. Device does not need to support this request.
- * You shall rather use usb_masstor_get_lun_count.
- *
- * @param mfun		Mass storage function
- * @return		Maximum LUN (index, not count), or -1
- */
-int usb_massstor_get_max_lun(usbmast_dev_t *mdev)
-{
-	uint8_t max_lun;
-	size_t data_recv_len;
-	errno_t rc = usb_control_request_get(
-	    usb_device_get_default_pipe(mdev->usb_dev),
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    0xFE, 0, usb_device_get_iface_number(mdev->usb_dev), &max_lun, 1,
-	    &data_recv_len);
-	if (rc != EOK) {
-		return -1;
-	}
-	if (data_recv_len != 1) {
-		return -1;
-	}
-	return max_lun;
-}
-
-/** Get number of LUNs supported by mass storage device.
- *
- * @warning This function hides any error during the request
- * (typically that shall not be a problem).
- *
- * @param mfun		Mass storage function
- * @return		Number of LUNs
- */
-size_t usb_masstor_get_lun_count(usbmast_dev_t *mdev)
-{
-	int max_lun = usb_massstor_get_max_lun(mdev);
-	if (max_lun < 0) {
-		max_lun = 1;
-	} else {
-		max_lun++;
-	}
-
-	return (size_t) max_lun;
-}
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/bo_trans.h
===================================================================
--- uspace/drv/block/usbmast/bo_trans.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/** @file
- * USB mass storage bulk-only transport.
- */
-
-#ifndef BO_TRANS_H_
-#define BO_TRANS_H_
-
-#include <scsi/spc.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <usb/usb.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/driver.h>
-#include "usbmast.h"
-
-typedef enum cmd_status {
-	CMDS_GOOD,
-	CMDS_FAILED
-} cmd_status_t;
-
-/** SCSI command.
- *
- * Contains (a subset of) the input and output arguments of SCSI
- * Execute Command procedure call (see SAM-4 chapter 5.1)
- */
-typedef struct {
-	/*
-	 * Related to IN fields
-	 */
-
-	/** Command Descriptor Block */
-	const void *cdb;
-	/** CDB size in bytes */
-	size_t cdb_size;
-
-	/** Outgoing data */
-	const void *data_out;
-	/** Size of outgoing data in bytes */
-	size_t data_out_size;
-
-	/*
-	 * Related to OUT fields
-	 */
-
-	/** Buffer for incoming data */
-	void *data_in;
-	/** Size of input buffer in bytes */
-	size_t data_in_size;
-
-	/** Number of bytes actually received */
-	size_t rcvd_size;
-
-	/** Status */
-	cmd_status_t status;
-} scsi_cmd_t;
-
-extern errno_t usb_massstor_cmd(usbmast_fun_t *, uint32_t, scsi_cmd_t *);
-extern errno_t usb_massstor_reset(usbmast_dev_t *);
-extern void usb_massstor_reset_recovery(usbmast_dev_t *);
-extern int usb_massstor_get_max_lun(usbmast_dev_t *);
-extern size_t usb_masstor_get_lun_count(usbmast_dev_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/cmdw.c
===================================================================
--- uspace/drv/block/usbmast/cmdw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/** @file
- * USB mass storage commands.
- */
-
-#include <byteorder.h>
-#include <mem.h>
-#include <stdint.h>
-#include <usb/usb.h>
-#include "cmdw.h"
-
-void usb_massstor_cbw_prepare(usb_massstor_cbw_t *cbw,
-    uint32_t tag, uint32_t transfer_length, usb_direction_t dir,
-    uint8_t lun, uint8_t cmd_len, const uint8_t *cmd)
-{
-	cbw->dCBWSignature = uint32_host2usb(0x43425355);
-	cbw->dCBWTag = tag;
-	cbw->dCBWDataTransferLength = transfer_length;
-
-	cbw->bmCBWFlags = 0;
-	if (dir == USB_DIRECTION_IN) {
-		cbw->bmCBWFlags |= (1 << 7);
-	}
-
-	/* Only lowest 4 bits. */
-	cbw->bCBWLUN = lun & 0x0F;
-
-	/* Only lowest 5 bits. */
-	cbw->bCBWBLength = cmd_len & 0x1F;
-
-	memcpy(cbw->CBWCB, cmd, cbw->bCBWBLength);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/cmdw.h
===================================================================
--- uspace/drv/block/usbmast/cmdw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/** @file
- * USB mass storage commands.
- */
-
-#ifndef CMDW_H_
-#define CMDW_H_
-
-#include <stdint.h>
-#include <usb/usb.h>
-
-typedef struct {
-	uint32_t dCBWSignature;
-	uint32_t dCBWTag;
-	uint32_t dCBWDataTransferLength;
-	uint8_t bmCBWFlags;
-	uint8_t bCBWLUN;
-	uint8_t bCBWBLength;
-	uint8_t CBWCB[16];
-} __attribute__((packed)) usb_massstor_cbw_t;
-
-typedef struct {
-	uint32_t dCSWSignature;
-	uint32_t dCSWTag;
-	uint32_t dCSWDataResidue;
-	uint8_t dCSWStatus;
-} __attribute__((packed)) usb_massstor_csw_t;
-
-enum cmd_block_status {
-	cbs_passed	= 0x00,
-	cbs_failed	= 0x01,
-	cbs_phase_error = 0x02
-};
-
-extern void usb_massstor_cbw_prepare(usb_massstor_cbw_t *, uint32_t, uint32_t,
-    usb_direction_t, uint8_t, uint8_t, const uint8_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/main.c
===================================================================
--- uspace/drv/block/usbmast/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,419 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/**
- * @file
- * Main routines of USB mass storage driver.
- */
-
-#include <as.h>
-#include <async.h>
-#include <bd_srv.h>
-#include <macros.h>
-#include <usb/dev/driver.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/classes/massstor.h>
-#include <errno.h>
-#include <io/logctl.h>
-#include <str_error.h>
-#include "cmdw.h"
-#include "bo_trans.h"
-#include "scsi_ms.h"
-#include "usbmast.h"
-
-#define NAME "usbmast"
-
-static const usb_endpoint_description_t bulk_in_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_MASS_STORAGE,
-	.interface_subclass = USB_MASSSTOR_SUBCLASS_SCSI,
-	.interface_protocol = USB_MASSSTOR_PROTOCOL_BBB,
-	.flags = 0
-};
-static const usb_endpoint_description_t bulk_out_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_MASS_STORAGE,
-	.interface_subclass = USB_MASSSTOR_SUBCLASS_SCSI,
-	.interface_protocol = USB_MASSSTOR_PROTOCOL_BBB,
-	.flags = 0
-};
-
-static const usb_endpoint_description_t *mast_endpoints[] = {
-	&bulk_in_ep,
-	&bulk_out_ep,
-	NULL
-};
-
-static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun);
-static void usbmast_bd_connection(ipc_call_t *icall, void *arg);
-
-static errno_t usbmast_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t usbmast_bd_close(bd_srv_t *);
-static errno_t usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-static errno_t usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t usbmast_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-static bd_ops_t usbmast_bd_ops = {
-	.open = usbmast_bd_open,
-	.close = usbmast_bd_close,
-	.read_blocks = usbmast_bd_read_blocks,
-	.sync_cache = usbmast_bd_sync_cache,
-	.write_blocks = usbmast_bd_write_blocks,
-	.get_block_size = usbmast_bd_get_block_size,
-	.get_num_blocks = usbmast_bd_get_num_blocks
-};
-
-static usbmast_fun_t *bd_srv_usbmast(bd_srv_t *bd)
-{
-	return (usbmast_fun_t *) bd->srvs->sarg;
-}
-
-/** Callback when a device is removed from the system.
- *
- * @param dev Representation of USB device.
- * @return Error code.
- */
-static errno_t usbmast_device_gone(usb_device_t *dev)
-{
-	usbmast_dev_t *mdev = usb_device_data_get(dev);
-	assert(mdev);
-
-	for (size_t i = 0; i < mdev->lun_count; ++i) {
-		const errno_t rc = ddf_fun_unbind(mdev->luns[i]);
-		if (rc != EOK) {
-			usb_log_error("Failed to unbind LUN function %zu: "
-			    "%s\n", i, str_error(rc));
-			return rc;
-		}
-		ddf_fun_destroy(mdev->luns[i]);
-		mdev->luns[i] = NULL;
-	}
-	free(mdev->luns);
-	return EOK;
-}
-
-/** Callback when a device is about to be removed.
- *
- * @param dev Representation of USB device.
- * @return Error code.
- */
-static errno_t usbmast_device_remove(usb_device_t *dev)
-{
-	//TODO: flush buffers, or whatever.
-	//TODO: remove device
-	return ENOTSUP;
-}
-
-/** Callback when new device is attached and recognized as a mass storage.
- *
- * @param dev Representation of USB device.
- * @return Error code.
- */
-static errno_t usbmast_device_add(usb_device_t *dev)
-{
-	errno_t rc;
-	usbmast_dev_t *mdev = NULL;
-	unsigned i;
-
-	usb_endpoint_mapping_t *epm_in =
-	    usb_device_get_mapped_ep_desc(dev, &bulk_in_ep);
-	usb_endpoint_mapping_t *epm_out =
-	    usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);
-	if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {
-		usb_log_error("Required EPs were not mapped.");
-		return ENOENT;
-	}
-
-	/* Allocate softstate */
-	mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t));
-	if (mdev == NULL) {
-		usb_log_error("Failed allocating softstate.");
-		return ENOMEM;
-	}
-
-	mdev->usb_dev = dev;
-
-	usb_log_info("Initializing mass storage `%s'.",
-	    usb_device_get_name(dev));
-	usb_log_debug("Bulk in endpoint: %d [%zuB].",
-	    epm_in->pipe.desc.endpoint_no, epm_in->pipe.desc.max_transfer_size);
-	usb_log_debug("Bulk out endpoint: %d [%zuB].",
-	    epm_out->pipe.desc.endpoint_no, epm_out->pipe.desc.max_transfer_size);
-
-	usb_log_debug("Get LUN count...");
-	mdev->lun_count = usb_masstor_get_lun_count(mdev);
-	mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t *));
-	if (mdev->luns == NULL) {
-		usb_log_error("Failed allocating luns table.");
-		return ENOMEM;
-	}
-
-	mdev->bulk_in_pipe = &epm_in->pipe;
-	mdev->bulk_out_pipe = &epm_out->pipe;
-	for (i = 0; i < mdev->lun_count; i++) {
-		rc = usbmast_fun_create(mdev, i);
-		if (rc != EOK)
-			goto error;
-	}
-
-	return EOK;
-error:
-	/* Destroy functions */
-	for (size_t i = 0; i < mdev->lun_count; ++i) {
-		if (mdev->luns[i] == NULL)
-			continue;
-		const errno_t rc = ddf_fun_unbind(mdev->luns[i]);
-		if (rc != EOK) {
-			usb_log_warning("Failed to unbind LUN function %zu: "
-			    "%s.\n", i, str_error(rc));
-		}
-		ddf_fun_destroy(mdev->luns[i]);
-	}
-	free(mdev->luns);
-	return rc;
-}
-
-/** Create mass storage function.
- *
- * Called once for each LUN.
- *
- * @param mdev		Mass storage device
- * @param lun		LUN
- * @return		EOK on success or an error code.
- */
-static errno_t usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun)
-{
-	errno_t rc;
-	char *fun_name = NULL;
-	ddf_fun_t *fun = NULL;
-	usbmast_fun_t *mfun = NULL;
-	bool bound = false;
-
-	if (asprintf(&fun_name, "l%u", lun) < 0) {
-		usb_log_error("Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);
-	if (fun == NULL) {
-		usb_log_error("Failed to create DDF function %s.", fun_name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Allocate soft state */
-	mfun = ddf_fun_data_alloc(fun, sizeof(usbmast_fun_t));
-	if (mfun == NULL) {
-		usb_log_error("Failed allocating softstate.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	mfun->ddf_fun = fun;
-	mfun->mdev = mdev;
-	mfun->lun = lun;
-
-	bd_srvs_init(&mfun->bds);
-	mfun->bds.ops = &usbmast_bd_ops;
-	mfun->bds.sarg = mfun;
-
-	/* Set up a connection handler. */
-	ddf_fun_set_conn_handler(fun, usbmast_bd_connection);
-
-	usb_log_debug("Inquire...");
-	usbmast_inquiry_data_t inquiry;
-	rc = usbmast_inquiry(mfun, &inquiry);
-	if (rc != EOK) {
-		usb_log_warning("Failed to inquire device `%s': %s.",
-		    usb_device_get_name(mdev->usb_dev), str_error(rc));
-		rc = EIO;
-		goto error;
-	}
-
-	usb_log_info("Mass storage `%s' LUN %u: "
-	    "%s by %s rev. %s is %s (%s).\n",
-	    usb_device_get_name(mdev->usb_dev),
-	    lun,
-	    inquiry.product,
-	    inquiry.vendor,
-	    inquiry.revision,
-	    usbmast_scsi_dev_type_str(inquiry.device_type),
-	    inquiry.removable ? "removable" : "non-removable");
-
-	uint32_t nblocks, block_size;
-
-	rc = usbmast_read_capacity(mfun, &nblocks, &block_size);
-	if (rc != EOK) {
-		usb_log_warning("Failed to read capacity, device `%s': %s.",
-		    usb_device_get_name(mdev->usb_dev), str_error(rc));
-		rc = EIO;
-		goto error;
-	}
-
-	usb_log_info("Read Capacity: nblocks=%" PRIu32 ", "
-	    "block_size=%" PRIu32 "\n", nblocks, block_size);
-
-	mfun->nblocks = nblocks;
-	mfun->block_size = block_size;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		usb_log_error("Failed to bind DDF function %s: %s.",
-		    fun_name, str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "disk");
-	if (rc != EOK) {
-		usb_log_error("Failed to add function %s to category 'disk': %s.",
-		    fun_name, str_error(rc));
-		goto error;
-	}
-
-	free(fun_name);
-	mdev->luns[lun] = fun;
-
-	return EOK;
-
-	/* Error cleanup */
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	if (fun_name != NULL)
-		free(fun_name);
-	return rc;
-}
-
-/** Blockdev client connection handler. */
-static void usbmast_bd_connection(ipc_call_t *icall, void *arg)
-{
-	usbmast_fun_t *mfun;
-
-	mfun = (usbmast_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
-	bd_conn(icall, &mfun->bds);
-}
-
-/** Open device. */
-static errno_t usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Close device. */
-static errno_t usbmast_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read blocks from the device. */
-static errno_t usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
-
-	if (size < cnt * mfun->block_size)
-		return EINVAL;
-
-	return usbmast_read(mfun, ba, cnt, buf);
-}
-
-/** Synchronize blocks to nonvolatile storage. */
-static errno_t usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
-{
-	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
-
-	return usbmast_sync_cache(mfun, ba, cnt);
-}
-
-/** Write blocks to the device. */
-static errno_t usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
-
-	if (size < cnt * mfun->block_size)
-		return EINVAL;
-
-	return usbmast_write(mfun, ba, cnt, buf);
-}
-
-/** Get device block size. */
-static errno_t usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
-	*rsize = mfun->block_size;
-	return EOK;
-}
-
-/** Get number of blocks on device. */
-static errno_t usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	usbmast_fun_t *mfun = bd_srv_usbmast(bd);
-	*rnb = mfun->nblocks;
-	return EOK;
-}
-
-/** USB mass storage driver ops. */
-static const usb_driver_ops_t usbmast_driver_ops = {
-	.device_add = usbmast_device_add,
-	.device_remove = usbmast_device_remove,
-	.device_gone = usbmast_device_gone,
-};
-
-/** USB mass storage driver. */
-static const usb_driver_t usbmast_driver = {
-	.name = NAME,
-	.ops = &usbmast_driver_ops,
-	.endpoints = mast_endpoints
-};
-
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return usb_driver_main(&usbmast_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/meson.build
===================================================================
--- uspace/drv/block/usbmast/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb', 'scsi' ]
-src = files(
-	'bo_trans.c',
-	'cmdw.c',
-	'main.c',
-	'scsi_ms.c',
-)
Index: pace/drv/block/usbmast/scsi_ms.c
===================================================================
--- uspace/drv/block/usbmast/scsi_ms.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,470 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/**
- * @file
- * SCSI functions for USB mass storage driver.
- */
-
-#include <bitops.h>
-#include <byteorder.h>
-#include <inttypes.h>
-#include <macros.h>
-#include <usb/dev/driver.h>
-#include <usb/debug.h>
-#include <errno.h>
-#include <str_error.h>
-#include <str.h>
-#include <scsi/sbc.h>
-#include <scsi/spc.h>
-#include "cmdw.h"
-#include "bo_trans.h"
-#include "scsi_ms.h"
-#include "usbmast.h"
-
-/** Get string representation for SCSI peripheral device type.
- *
- * @param type		SCSI peripheral device type code.
- * @return		String representation.
- */
-const char *usbmast_scsi_dev_type_str(unsigned type)
-{
-	return scsi_get_dev_type_str(type);
-}
-
-static void usbmast_dump_sense(scsi_sense_data_t *sense_buf)
-{
-	const unsigned sense_key = sense_buf->flags_key & 0x0f;
-	printf("Got sense data. Sense key: 0x%x (%s), ASC 0x%02x, "
-	    "ASCQ 0x%02x.\n", sense_key,
-	    scsi_get_sense_key_str(sense_key),
-	    sense_buf->additional_code,
-	    sense_buf->additional_cqual);
-}
-
-static errno_t usb_massstor_unit_ready(usbmast_fun_t *mfun)
-{
-	scsi_cmd_t cmd;
-	scsi_cdb_test_unit_ready_t cdb;
-	errno_t rc;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_TEST_UNIT_READY;
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-
-	rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Test Unit Ready failed on device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-	/*
-	 * Ignore command error here. If there's something wrong
-	 * with the device the following commands will fail too.
-	 */
-	if (cmd.status != CMDS_GOOD)
-		usb_log_warning("Test Unit Ready command failed on device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-
-	return EOK;
-}
-
-/** Run SCSI command.
- *
- * Run command and repeat in case of unit attention.
- * XXX This is too simplified.
- */
-static errno_t usbmast_run_cmd(usbmast_fun_t *mfun, scsi_cmd_t *cmd)
-{
-	uint8_t sense_key;
-	scsi_sense_data_t sense_buf;
-	errno_t rc;
-
-	do {
-		rc = usb_massstor_unit_ready(mfun);
-		if (rc != EOK) {
-			usb_log_error("Inquiry transport failed, device %s: %s.",
-			    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-			return rc;
-		}
-
-		rc = usb_massstor_cmd(mfun, 0xDEADBEEF, cmd);
-		if (rc != EOK) {
-			usb_log_error("Inquiry transport failed, device %s: %s.",
-			    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-			return rc;
-		}
-
-		if (cmd->status == CMDS_GOOD)
-			return EOK;
-
-		usb_log_error("SCSI command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-
-		rc = usbmast_request_sense(mfun, &sense_buf, sizeof(sense_buf));
-		if (rc != EOK) {
-			usb_log_error("Failed to read sense data.");
-			return EIO;
-		}
-
-		/* Dump sense data to log */
-		usbmast_dump_sense(&sense_buf);
-
-		/* Get sense key */
-		sense_key = sense_buf.flags_key & 0x0f;
-
-		if (sense_key == SCSI_SK_UNIT_ATTENTION) {
-			printf("Got unit attention. Re-trying command.\n");
-		}
-
-	} while (sense_key == SCSI_SK_UNIT_ATTENTION);
-
-	/* Command status is not good, nevertheless transport succeeded. */
-	return EOK;
-}
-
-/** Perform SCSI Inquiry command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param inquiry_result Where to store parsed inquiry result
- * @return		Error code
- */
-errno_t usbmast_inquiry(usbmast_fun_t *mfun, usbmast_inquiry_data_t *inq_res)
-{
-	scsi_std_inquiry_data_t inq_data;
-	scsi_cmd_t cmd;
-	scsi_cdb_inquiry_t cdb;
-	errno_t rc;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_INQUIRY;
-	cdb.alloc_len = host2uint16_t_be(sizeof(inq_data));
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-	cmd.data_in = &inq_data;
-	cmd.data_in_size = sizeof(inq_data);
-
-	rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Inquiry transport failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.status != CMDS_GOOD) {
-		usb_log_error("Inquiry command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-		return EIO;
-	}
-
-	if (cmd.rcvd_size < SCSI_STD_INQUIRY_DATA_MIN_SIZE) {
-		usb_log_error("SCSI Inquiry response too short (%zu).",
-		    cmd.rcvd_size);
-		return EIO;
-	}
-
-	/*
-	 * Parse inquiry data and fill in the result structure.
-	 */
-
-	memset(inq_res, 0, sizeof(*inq_res));
-
-	inq_res->device_type = BIT_RANGE_EXTRACT(uint8_t,
-	    inq_data.pqual_devtype, SCSI_PQDT_DEV_TYPE_h, SCSI_PQDT_DEV_TYPE_l);
-
-	inq_res->removable = BIT_RANGE_EXTRACT(uint8_t,
-	    inq_data.rmb, SCSI_RMB_RMB, SCSI_RMB_RMB);
-
-	spascii_to_str(inq_res->vendor, SCSI_INQ_VENDOR_STR_BUFSIZE,
-	    inq_data.vendor, sizeof(inq_data.vendor));
-
-	spascii_to_str(inq_res->product, SCSI_INQ_PRODUCT_STR_BUFSIZE,
-	    inq_data.product, sizeof(inq_data.product));
-
-	spascii_to_str(inq_res->revision, SCSI_INQ_REVISION_STR_BUFSIZE,
-	    inq_data.revision, sizeof(inq_data.revision));
-
-	return EOK;
-}
-
-/** Perform SCSI Request Sense command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param buf		Destination buffer
- * @param size		Size of @a buf
- *
- * @return		Error code.
- */
-errno_t usbmast_request_sense(usbmast_fun_t *mfun, void *buf, size_t size)
-{
-	scsi_cmd_t cmd;
-	scsi_cdb_request_sense_t cdb;
-	errno_t rc;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_REQUEST_SENSE;
-	cdb.alloc_len = min(size, SCSI_SENSE_DATA_MAX_SIZE);
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-	cmd.data_in = buf;
-	cmd.data_in_size = size;
-
-	rc = usb_massstor_cmd(mfun, 0xDEADBEEF, &cmd);
-
-	if (rc != EOK || cmd.status != CMDS_GOOD) {
-		usb_log_error("Request Sense failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.rcvd_size < SCSI_SENSE_DATA_MIN_SIZE) {
-		/* The missing bytes should be considered to be zeroes. */
-		memset((uint8_t *)buf + cmd.rcvd_size, 0,
-		    SCSI_SENSE_DATA_MIN_SIZE - cmd.rcvd_size);
-	}
-
-	return EOK;
-}
-
-/** Perform SCSI Read Capacity command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param nblocks	Output, number of blocks
- * @param block_size	Output, block size in bytes
- *
- * @return		Error code.
- */
-errno_t usbmast_read_capacity(usbmast_fun_t *mfun, uint32_t *nblocks,
-    uint32_t *block_size)
-{
-	scsi_cmd_t cmd;
-	scsi_cdb_read_capacity_10_t cdb;
-	scsi_read_capacity_10_data_t data;
-	errno_t rc;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_READ_CAPACITY_10;
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-	cmd.data_in = &data;
-	cmd.data_in_size = sizeof(data);
-
-	rc = usbmast_run_cmd(mfun, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Read Capacity (10) transport failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.status != CMDS_GOOD) {
-		usb_log_error("Read Capacity (10) command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-		return EIO;
-	}
-
-	if (cmd.rcvd_size < sizeof(data)) {
-		usb_log_error("SCSI Read Capacity response too short (%zu).",
-		    cmd.rcvd_size);
-		return EIO;
-	}
-
-	*nblocks = uint32_t_be2host(data.last_lba) + 1;
-	*block_size = uint32_t_be2host(data.block_size);
-
-	return EOK;
-}
-
-/** Perform SCSI Read command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param ba		Address of first block
- * @param nblocks	Number of blocks to read
- *
- * @return		Error code
- */
-errno_t usbmast_read(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks, void *buf)
-{
-	scsi_cmd_t cmd;
-	scsi_cdb_read_10_t cdb;
-	errno_t rc;
-
-	if (ba > UINT32_MAX)
-		return ELIMIT;
-
-	if (nblocks > UINT16_MAX)
-		return ELIMIT;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_READ_10;
-	cdb.lba = host2uint32_t_be(ba);
-	cdb.xfer_len = host2uint16_t_be(nblocks);
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-	cmd.data_in = buf;
-	cmd.data_in_size = nblocks * mfun->block_size;
-
-	rc = usbmast_run_cmd(mfun, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Read (10) transport failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.status != CMDS_GOOD) {
-		usb_log_error("Read (10) command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-		return EIO;
-	}
-
-	if (cmd.rcvd_size < nblocks * mfun->block_size) {
-		usb_log_error("SCSI Read response too short (%zu).",
-		    cmd.rcvd_size);
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Perform SCSI Write command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param ba		Address of first block
- * @param nblocks	Number of blocks to read
- * @param data		Data to write
- *
- * @return		Error code
- */
-errno_t usbmast_write(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks,
-    const void *data)
-{
-	scsi_cmd_t cmd;
-	scsi_cdb_write_10_t cdb;
-	errno_t rc;
-
-	if (ba > UINT32_MAX)
-		return ELIMIT;
-
-	if (nblocks > UINT16_MAX)
-		return ELIMIT;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_WRITE_10;
-	cdb.lba = host2uint32_t_be(ba);
-	cdb.xfer_len = host2uint16_t_be(nblocks);
-
-	memset(&cmd, 0, sizeof(cmd));
-	cmd.cdb = &cdb;
-	cmd.cdb_size = sizeof(cdb);
-	cmd.data_out = data;
-	cmd.data_out_size = nblocks * mfun->block_size;
-
-	rc = usbmast_run_cmd(mfun, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Write (10) transport failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.status != CMDS_GOOD) {
-		usb_log_error("Write (10) command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Perform SCSI Synchronize Cache command on USB mass storage device.
- *
- * @param mfun		Mass storage function
- * @param ba		Address of first block
- * @param nblocks	Number of blocks to read
- * @param data		Data to write
- *
- * @return		Error code
- */
-errno_t usbmast_sync_cache(usbmast_fun_t *mfun, uint64_t ba, size_t nblocks)
-{
-	if (ba > UINT32_MAX)
-		return ELIMIT;
-
-	if (nblocks > UINT16_MAX)
-		return ELIMIT;
-
-	const scsi_cdb_sync_cache_10_t cdb = {
-		.op_code = SCSI_CMD_SYNC_CACHE_10,
-		.lba = host2uint32_t_be(ba),
-		.numlb = host2uint16_t_be(nblocks),
-	};
-
-	scsi_cmd_t cmd = {
-		.cdb = &cdb,
-		.cdb_size = sizeof(cdb),
-	};
-
-	const errno_t rc = usbmast_run_cmd(mfun, &cmd);
-
-	if (rc != EOK) {
-		usb_log_error("Synchronize Cache (10) transport failed, device %s: %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev), str_error(rc));
-		return rc;
-	}
-
-	if (cmd.status != CMDS_GOOD) {
-		usb_log_error("Synchronize Cache (10) command failed, device %s.",
-		    usb_device_get_name(mfun->mdev->usb_dev));
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/scsi_ms.h
===================================================================
--- uspace/drv/block/usbmast/scsi_ms.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/** @file
- * SCSI functions for USB mass storage.
- */
-
-#ifndef USB_USBMAST_SCSI_MS_H_
-#define USB_USBMAST_SCSI_MS_H_
-
-#include <scsi/spc.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <usb/usb.h>
-#include <usb/dev/driver.h>
-
-/** Result of SCSI Inquiry command.
- * This is already parsed structure, not the original buffer returned by
- * the device.
- */
-typedef struct {
-	/** SCSI peripheral device type */
-	unsigned device_type;
-	/** Whether the device is removable */
-	bool removable;
-	/** Vendor ID string */
-	char vendor[SCSI_INQ_VENDOR_STR_BUFSIZE];
-	/** Product ID string */
-	char product[SCSI_INQ_PRODUCT_STR_BUFSIZE];
-	/** Revision string */
-	char revision[SCSI_INQ_REVISION_STR_BUFSIZE];
-} usbmast_inquiry_data_t;
-
-extern errno_t usbmast_inquiry(usbmast_fun_t *, usbmast_inquiry_data_t *);
-extern errno_t usbmast_request_sense(usbmast_fun_t *, void *, size_t);
-extern errno_t usbmast_read_capacity(usbmast_fun_t *, uint32_t *, uint32_t *);
-extern errno_t usbmast_read(usbmast_fun_t *, uint64_t, size_t, void *);
-extern errno_t usbmast_write(usbmast_fun_t *, uint64_t, size_t, const void *);
-extern errno_t usbmast_sync_cache(usbmast_fun_t *, uint64_t, size_t);
-extern const char *usbmast_scsi_dev_type_str(unsigned);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/usbmast.h
===================================================================
--- uspace/drv/block/usbmast/usbmast.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmast
- * @{
- */
-/** @file
- * USB mass storage commands.
- */
-
-#ifndef USBMAST_H_
-#define USBMAST_H_
-
-#include <bd_srv.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <usb/usb.h>
-
-/** Mass storage device. */
-typedef struct usbmast_dev {
-	/** USB device */
-	usb_device_t *usb_dev;
-	/** Number of LUNs */
-	unsigned lun_count;
-	/** LUN functions */
-	ddf_fun_t **luns;
-	/** Data read pipe */
-	usb_pipe_t *bulk_in_pipe;
-	/** Data write pipe */
-	usb_pipe_t *bulk_out_pipe;
-} usbmast_dev_t;
-
-/** Mass storage function.
- *
- * Serves as soft state for function/LUN.
- */
-typedef struct {
-	/** Mass storage device the function belongs to */
-	usbmast_dev_t *mdev;
-	/** DDF function */
-	ddf_fun_t *ddf_fun;
-	/** LUN */
-	unsigned lun;
-	/** Total number of blocks */
-	uint64_t nblocks;
-	/** Block size in bytes */
-	size_t block_size;
-	/** Block device service structure */
-	bd_srvs_t bds;
-} usbmast_fun_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/block/usbmast/usbmast.ma
===================================================================
--- uspace/drv/block/usbmast/usbmast.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-50 usb&interface&class=mass-storage&subclass=0x06&protocol=0x50
Index: pace/drv/block/virtio-blk/meson.build
===================================================================
--- uspace/drv/block/virtio-blk/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2019 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'scsi', 'virtio' ]
-src = files('virtio-blk.c')
Index: pace/drv/block/virtio-blk/virtio-blk.c
===================================================================
--- uspace/drv/block/virtio-blk/virtio-blk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,500 +1,0 @@
-/*
- * Copyright (c) 2019 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "virtio-blk.h"
-
-#include <stdio.h>
-#include <stdint.h>
-
-#include <as.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <pci_dev_iface.h>
-#include <fibril_synch.h>
-
-#include <bd_srv.h>
-
-#include <virtio-pci.h>
-
-#define NAME	"virtio-blk"
-
-#define VIRTIO_BLK_NUM_QUEUES	1
-
-#define RQ_QUEUE	0
-
-/*
- * VIRTIO_BLK requests need at least two descriptors so that device-read-only
- * buffers are separated from device-writable buffers. For convenience, we
- * always use three descriptors for the request header, buffer and footer.
- * We therefore organize the virtque so that first RQ_BUFFERS descriptors are
- * used for request headers, the following RQ_BUFFERS descriptors are used
- * for in/out buffers and the last RQ_BUFFERS descriptors are used for request
- * footers.
- */
-#define REQ_HEADER_DESC(descno)	(0 * RQ_BUFFERS + (descno))
-#define REQ_BUFFER_DESC(descno)	(1 * RQ_BUFFERS + (descno))
-#define REQ_FOOTER_DESC(descno)	(2 * RQ_BUFFERS + (descno))
-
-static errno_t virtio_blk_dev_add(ddf_dev_t *dev);
-
-static driver_ops_t virtio_blk_driver_ops = {
-	.dev_add = virtio_blk_dev_add
-};
-
-static driver_t virtio_blk_driver = {
-	.name = NAME,
-	.driver_ops = &virtio_blk_driver_ops
-};
-
-/** VirtIO block IRQ handler.
- *
- * @param icall IRQ event notification
- * @param arg Argument (virtio_blk_t *)
- */
-static void virtio_blk_irq_handler(ipc_call_t *icall, void *arg)
-{
-	virtio_blk_t *virtio_blk = (virtio_blk_t *)arg;
-	virtio_dev_t *vdev = &virtio_blk->virtio_dev;
-
-	uint16_t descno;
-	uint32_t len;
-
-	while (virtio_virtq_consume_used(vdev, RQ_QUEUE, &descno, &len)) {
-		assert(descno < RQ_BUFFERS);
-		fibril_mutex_lock(&virtio_blk->completion_lock[descno]);
-		fibril_condvar_signal(&virtio_blk->completion_cv[descno]);
-		fibril_mutex_unlock(&virtio_blk->completion_lock[descno]);
-	}
-}
-
-static errno_t virtio_blk_register_interrupt(ddf_dev_t *dev)
-{
-	virtio_blk_t *virtio_blk = (virtio_blk_t *) ddf_dev_data_get(dev);
-	virtio_dev_t *vdev = &virtio_blk->virtio_dev;
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_t res;
-	hw_res_list_parsed_init(&res);
-
-	hw_res_list_parsed_init(&res);
-	errno_t rc = hw_res_get_list_parsed(parent_sess, &res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (res.irqs.count < 1) {
-		hw_res_list_parsed_clean(&res);
-		return EINVAL;
-	}
-
-	virtio_blk->irq = res.irqs.irqs[0];
-	hw_res_list_parsed_clean(&res);
-
-	irq_pio_range_t pio_ranges[] = {
-		{
-			.base = vdev->isr_phys,
-			.size = sizeof(vdev->isr_phys),
-		}
-	};
-
-	irq_cmd_t irq_commands[] = {
-		{
-			.cmd = CMD_PIO_READ_8,
-			.addr = (void *) vdev->isr_phys,
-			.dstarg = 2
-		},
-		{
-			.cmd = CMD_PREDICATE,
-			.value = 1,
-			.srcarg = 2
-		},
-		{
-			.cmd = CMD_ACCEPT
-		}
-	};
-
-	irq_code_t irq_code = {
-		.rangecount = sizeof(pio_ranges) / sizeof(irq_pio_range_t),
-		.ranges = pio_ranges,
-		.cmdcount = sizeof(irq_commands) / sizeof(irq_cmd_t),
-		.cmds = irq_commands
-	};
-
-	return register_interrupt_handler(dev, virtio_blk->irq,
-	    virtio_blk_irq_handler, (void *)virtio_blk, &irq_code,
-	    &virtio_blk->irq_handle);
-}
-
-static errno_t virtio_blk_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static errno_t virtio_blk_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static errno_t virtio_blk_rw_block(virtio_blk_t *virtio_blk, bool read,
-    aoff64_t ba, void *buf)
-{
-	virtio_dev_t *vdev = &virtio_blk->virtio_dev;
-
-	/*
-	 * Allocate a descriptor.
-	 *
-	 * The allocated descno will determine the header descriptor
-	 * (REQ_HEADER_DESC), the buffer descriptor (REQ_BUFFER_DESC) and the
-	 * footer (REQ_FOOTER_DESC) descriptor.
-	 */
-	fibril_mutex_lock(&virtio_blk->free_lock);
-	uint16_t descno = virtio_alloc_desc(vdev, RQ_QUEUE,
-	    &virtio_blk->rq_free_head);
-	while (descno == (uint16_t) -1U) {
-		fibril_condvar_wait(&virtio_blk->free_cv,
-		    &virtio_blk->free_lock);
-		descno = virtio_alloc_desc(vdev, RQ_QUEUE,
-		    &virtio_blk->rq_free_head);
-	}
-	fibril_mutex_unlock(&virtio_blk->free_lock);
-
-	assert(descno < RQ_BUFFERS);
-
-	/* Setup the request header */
-	virtio_blk_req_header_t *req_header =
-	    (virtio_blk_req_header_t *) virtio_blk->rq_header[descno];
-	memset(req_header, 0, sizeof(virtio_blk_req_header_t));
-	pio_write_le32(&req_header->type,
-	    read ? VIRTIO_BLK_T_IN : VIRTIO_BLK_T_OUT);
-	pio_write_le64(&req_header->sector, ba);
-
-	/* Copy write data to the request. */
-	if (!read)
-		memcpy(virtio_blk->rq_buf[descno], buf, VIRTIO_BLK_BLOCK_SIZE);
-
-	fibril_mutex_lock(&virtio_blk->completion_lock[descno]);
-
-	/*
-	 * Set the descriptors, chain them in the virtqueue and notify the
-	 * device.
-	 */
-	virtio_virtq_desc_set(vdev, RQ_QUEUE, REQ_HEADER_DESC(descno),
-	    virtio_blk->rq_header_p[descno], sizeof(virtio_blk_req_header_t),
-	    VIRTQ_DESC_F_NEXT, REQ_BUFFER_DESC(descno));
-	virtio_virtq_desc_set(vdev, RQ_QUEUE, REQ_BUFFER_DESC(descno),
-	    virtio_blk->rq_buf_p[descno], VIRTIO_BLK_BLOCK_SIZE,
-	    VIRTQ_DESC_F_NEXT | (read ? VIRTQ_DESC_F_WRITE : 0),
-	    REQ_FOOTER_DESC(descno));
-	virtio_virtq_desc_set(vdev, RQ_QUEUE, REQ_FOOTER_DESC(descno),
-	    virtio_blk->rq_footer_p[descno], sizeof(virtio_blk_req_footer_t),
-	    VIRTQ_DESC_F_WRITE, 0);
-	virtio_virtq_produce_available(vdev, RQ_QUEUE, descno);
-
-	/*
-	 * Wait for the completion of the request.
-	 */
-	fibril_condvar_wait(&virtio_blk->completion_cv[descno],
-	    &virtio_blk->completion_lock[descno]);
-	fibril_mutex_unlock(&virtio_blk->completion_lock[descno]);
-
-	errno_t rc;
-	virtio_blk_req_footer_t *footer =
-	    (virtio_blk_req_footer_t *) virtio_blk->rq_footer[descno];
-	switch (footer->status) {
-	case VIRTIO_BLK_S_OK:
-		rc = EOK;
-		break;
-	case VIRTIO_BLK_S_IOERR:
-		rc = EIO;
-		break;
-	case VIRTIO_BLK_S_UNSUPP:
-		rc = ENOTSUP;
-		break;
-	default:
-		ddf_msg(LVL_DEBUG, "device returned unknown status=%d\n",
-		    (int) footer->status);
-		rc = EIO;
-		break;
-	}
-
-	/* Copy read data from the request */
-	if (rc == EOK && read)
-		memcpy(buf, virtio_blk->rq_buf[descno], VIRTIO_BLK_BLOCK_SIZE);
-
-	/* Free the descriptor and buffer */
-	fibril_mutex_lock(&virtio_blk->free_lock);
-	virtio_free_desc(vdev, RQ_QUEUE, &virtio_blk->rq_free_head, descno);
-	fibril_condvar_signal(&virtio_blk->free_cv);
-	fibril_mutex_unlock(&virtio_blk->free_lock);
-
-	return rc;
-}
-
-static errno_t virtio_blk_bd_rw_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    void *buf, size_t size, bool read)
-{
-	virtio_blk_t *virtio_blk = (virtio_blk_t *) bd->srvs->sarg;
-	aoff64_t i;
-	errno_t rc;
-
-	if (size != cnt * VIRTIO_BLK_BLOCK_SIZE)
-		return EINVAL;
-
-	for (i = 0; i < cnt; i++) {
-		rc = virtio_blk_rw_block(virtio_blk, read, ba + i,
-		    buf + i * VIRTIO_BLK_BLOCK_SIZE);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t virtio_blk_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    void *buf, size_t size)
-{
-	return virtio_blk_bd_rw_blocks(bd, ba, cnt, buf, size, true);
-}
-
-static errno_t virtio_blk_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	return virtio_blk_bd_rw_blocks(bd, ba, cnt, (void *) buf, size, false);
-}
-
-static errno_t virtio_blk_bd_get_block_size(bd_srv_t *bd, size_t *size)
-{
-	*size = VIRTIO_BLK_BLOCK_SIZE;
-	return EOK;
-}
-
-static errno_t virtio_blk_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *nb)
-{
-	virtio_blk_t *virtio_blk = (virtio_blk_t *) bd->srvs->sarg;
-	virtio_blk_cfg_t *blkcfg = virtio_blk->virtio_dev.device_cfg;
-	*nb = pio_read_le64(&blkcfg->capacity);
-	return EOK;
-}
-
-bd_ops_t virtio_blk_bd_ops = {
-	.open = virtio_blk_bd_open,
-	.close = virtio_blk_bd_close,
-	.read_blocks = virtio_blk_bd_read_blocks,
-	.write_blocks = virtio_blk_bd_write_blocks,
-	.get_block_size = virtio_blk_bd_get_block_size,
-	.get_num_blocks = virtio_blk_bd_get_num_blocks,
-};
-
-static errno_t virtio_blk_initialize(ddf_dev_t *dev)
-{
-	virtio_blk_t *virtio_blk = ddf_dev_data_alloc(dev,
-	    sizeof(virtio_blk_t));
-	if (!virtio_blk)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&virtio_blk->free_lock);
-	fibril_condvar_initialize(&virtio_blk->free_cv);
-
-	for (unsigned i = 0; i < RQ_BUFFERS; i++) {
-		fibril_mutex_initialize(&virtio_blk->completion_lock[i]);
-		fibril_condvar_initialize(&virtio_blk->completion_cv[i]);
-	}
-
-	bd_srvs_init(&virtio_blk->bds);
-	virtio_blk->bds.ops = &virtio_blk_bd_ops;
-	virtio_blk->bds.sarg = virtio_blk;
-
-	errno_t rc = virtio_pci_dev_initialize(dev, &virtio_blk->virtio_dev);
-	if (rc != EOK)
-		return rc;
-
-	virtio_dev_t *vdev = &virtio_blk->virtio_dev;
-	virtio_pci_common_cfg_t *cfg = virtio_blk->virtio_dev.common_cfg;
-
-	/*
-	 * Register IRQ
-	 */
-	rc = virtio_blk_register_interrupt(dev);
-	if (rc != EOK)
-		goto fail;
-
-	/* Reset the device and negotiate the feature bits */
-	rc = virtio_device_setup_start(vdev, 0);
-	if (rc != EOK)
-		goto fail;
-
-	/* Perform device-specific setup */
-
-	/*
-	 * Discover and configure the virtqueue
-	 */
-	uint16_t num_queues = pio_read_le16(&cfg->num_queues);
-	if (num_queues != VIRTIO_BLK_NUM_QUEUES) {
-		ddf_msg(LVL_NOTE, "Unsupported number of virtqueues: %u",
-		    num_queues);
-		rc = ELIMIT;
-		goto fail;
-	}
-
-	vdev->queues = calloc(num_queues, sizeof(virtq_t));
-	if (!vdev->queues) {
-		rc = ENOMEM;
-		goto fail;
-	}
-
-	/* For each in/out request we need 3 descriptors */
-	rc = virtio_virtq_setup(vdev, RQ_QUEUE, 3 * RQ_BUFFERS);
-	if (rc != EOK)
-		goto fail;
-
-	/*
-	 * Setup DMA buffers
-	 */
-	rc = virtio_setup_dma_bufs(RQ_BUFFERS, sizeof(virtio_blk_req_header_t),
-	    true, virtio_blk->rq_header, virtio_blk->rq_header_p);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_setup_dma_bufs(RQ_BUFFERS, VIRTIO_BLK_BLOCK_SIZE,
-	    true, virtio_blk->rq_buf, virtio_blk->rq_buf_p);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_setup_dma_bufs(RQ_BUFFERS, sizeof(virtio_blk_req_footer_t),
-	    false, virtio_blk->rq_footer, virtio_blk->rq_footer_p);
-	if (rc != EOK)
-		goto fail;
-
-	/*
-	 * Put all request descriptors on a free list. Because of the
-	 * correspondence between the request, buffer and footer descriptors,
-	 * we only need to manage allocations for one set: the request header
-	 * descriptors.
-	 */
-	virtio_create_desc_free_list(vdev, RQ_QUEUE, RQ_BUFFERS,
-	    &virtio_blk->rq_free_head);
-
-	/*
-	 * Enable IRQ
-	 */
-	rc = hw_res_enable_interrupt(ddf_dev_parent_sess_get(dev),
-	    virtio_blk->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Failed to enable interrupt");
-		goto fail;
-	}
-
-	ddf_msg(LVL_NOTE, "Registered IRQ %d", virtio_blk->irq);
-
-	/* Go live */
-	virtio_device_setup_finalize(vdev);
-
-	return EOK;
-
-fail:
-	virtio_teardown_dma_bufs(virtio_blk->rq_header);
-	virtio_teardown_dma_bufs(virtio_blk->rq_buf);
-	virtio_teardown_dma_bufs(virtio_blk->rq_footer);
-
-	virtio_device_setup_fail(vdev);
-	virtio_pci_dev_cleanup(vdev);
-	return rc;
-}
-
-static void virtio_blk_uninitialize(ddf_dev_t *dev)
-{
-	virtio_blk_t *virtio_blk = (virtio_blk_t *) ddf_dev_data_get(dev);
-
-	virtio_teardown_dma_bufs(virtio_blk->rq_header);
-	virtio_teardown_dma_bufs(virtio_blk->rq_buf);
-	virtio_teardown_dma_bufs(virtio_blk->rq_footer);
-
-	virtio_device_setup_fail(&virtio_blk->virtio_dev);
-	virtio_pci_dev_cleanup(&virtio_blk->virtio_dev);
-}
-
-static void virtio_blk_bd_connection(ipc_call_t *icall, void *arg)
-{
-	virtio_blk_t *virtio_blk;
-	ddf_fun_t *fun = (ddf_fun_t *) arg;
-
-	virtio_blk = (virtio_blk_t *) ddf_dev_data_get(ddf_fun_get_dev(fun));
-	bd_conn(icall, &virtio_blk->bds);
-}
-
-static errno_t virtio_blk_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "%s %s (handle = %zu)", __func__,
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	errno_t rc = virtio_blk_initialize(dev);
-	if (rc != EOK)
-		return rc;
-
-	ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "port0");
-	if (fun == NULL) {
-		rc = ENOMEM;
-		goto uninitialize;
-	}
-
-	ddf_fun_set_conn_handler(fun, virtio_blk_bd_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding device function");
-		goto destroy;
-	}
-
-	rc = ddf_fun_add_to_category(fun, "disk");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function to category");
-		goto unbind;
-	}
-
-	ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
-	    ddf_dev_get_name(dev));
-
-	return EOK;
-
-unbind:
-	ddf_fun_unbind(fun);
-destroy:
-	ddf_fun_destroy(fun);
-uninitialize:
-	virtio_blk_uninitialize(dev);
-	return rc;
-}
-
-int main(void)
-{
-	printf("%s: HelenOS virtio-blk driver\n", NAME);
-
-	(void) ddf_log_init(NAME);
-	return ddf_driver_main(&virtio_blk_driver);
-}
Index: pace/drv/block/virtio-blk/virtio-blk.h
===================================================================
--- uspace/drv/block/virtio-blk/virtio-blk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2019 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _VIRTIO_BLK_H_
-#define _VIRTIO_BLK_H_
-
-#include <virtio-pci.h>
-#include <bd_srv.h>
-#include <abi/cap.h>
-
-#include <fibril_synch.h>
-
-#define VIRTIO_BLK_BLOCK_SIZE	512
-
-/* Operation types. */
-#define VIRTIO_BLK_T_IN		0
-#define VIRTIO_BLK_T_OUT	1
-
-/* Status codes returned by the device. */
-#define VIRTIO_BLK_S_OK		0
-#define VIRTIO_BLK_S_IOERR	1
-#define VIRTIO_BLK_S_UNSUPP	2
-
-#define RQ_BUFFERS	32
-
-/** Device is read-only. */
-#define VIRTIO_BLK_F_RO		(1U << 5)
-
-typedef struct {
-	uint32_t type;
-	uint32_t reserved;
-	uint64_t sector;
-} virtio_blk_req_header_t;
-
-typedef struct {
-	uint8_t status;
-} virtio_blk_req_footer_t;
-
-typedef struct {
-	uint64_t capacity;
-} virtio_blk_cfg_t;
-
-typedef struct {
-	virtio_dev_t virtio_dev;
-
-	void *rq_header[RQ_BUFFERS];
-	uintptr_t rq_header_p[RQ_BUFFERS];
-
-	void *rq_buf[RQ_BUFFERS];
-	uintptr_t rq_buf_p[RQ_BUFFERS];
-
-	void *rq_footer[RQ_BUFFERS];
-	uintptr_t rq_footer_p[RQ_BUFFERS];
-
-	uint16_t rq_free_head;
-
-	int irq;
-	cap_irq_handle_t irq_handle;
-
-	bd_srvs_t bds;
-
-	fibril_mutex_t free_lock;
-	fibril_condvar_t free_cv;
-
-	fibril_mutex_t completion_lock[RQ_BUFFERS];
-	fibril_condvar_t completion_cv[RQ_BUFFERS];
-} virtio_blk_t;
-
-#endif
Index: pace/drv/block/virtio-blk/virtio-blk.ma
===================================================================
--- uspace/drv/block/virtio-blk/virtio-blk.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 pci/ven=1af4&dev=1001
-10 pci/ven=1af4&dev=1042
Index: pace/drv/bus/adb/cuda_adb/cuda_adb.c
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_adb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,511 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_cuda_adb
- * @{
- */
-/** @file VIA-CUDA Apple Desktop Bus driver
- *
- * Note: We should really do a full bus scan at the beginning and resolve
- * address conflicts. Also we should consider the handler ID in r3. Instead
- * we just assume a keyboard at address 2 or 8 and a mouse at address 9.
- */
-
-#include <assert.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <ipc/adb.h>
-#include <libarch/ddi.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "cuda_adb.h"
-#include "cuda_hw.h"
-
-#define NAME  "cuda_adb"
-
-static void cuda_dev_connection(ipc_call_t *, void *);
-static errno_t cuda_init(cuda_t *);
-static void cuda_irq_handler(ipc_call_t *, void *);
-
-static void cuda_irq_listen(cuda_t *);
-static void cuda_irq_receive(cuda_t *);
-static void cuda_irq_rcv_end(cuda_t *, void *, size_t *);
-static void cuda_irq_send_start(cuda_t *);
-static void cuda_irq_send(cuda_t *);
-
-static void cuda_packet_handle(cuda_t *, uint8_t *, size_t);
-static void cuda_send_start(cuda_t *);
-static void cuda_autopoll_set(cuda_t *, bool);
-
-static void adb_packet_handle(cuda_t *, uint8_t *, size_t, bool);
-
-static irq_pio_range_t cuda_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(cuda_regs_t)
-	}
-};
-
-static irq_cmd_t cuda_cmds[] = {
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_AND,
-		.value = SR_INT,
-		.srcarg = 1,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 1,
-		.srcarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static irq_code_t cuda_irq_code = {
-	sizeof(cuda_ranges) / sizeof(irq_pio_range_t),
-	cuda_ranges,
-	sizeof(cuda_cmds) / sizeof(irq_cmd_t),
-	cuda_cmds
-};
-
-static errno_t cuda_dev_create(cuda_t *cuda, const char *name, const char *id,
-    adb_dev_t **rdev)
-{
-	adb_dev_t *dev = NULL;
-	ddf_fun_t *fun;
-	errno_t rc;
-
-	fun = ddf_fun_create(cuda->dev, fun_inner, name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function '%s'.", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = ddf_fun_add_match_id(fun, id, 10);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev = ddf_fun_data_alloc(fun, sizeof(adb_dev_t));
-	if (dev == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating memory for '%s'.", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev->fun = fun;
-	list_append(&dev->lcuda, &cuda->devs);
-
-	ddf_fun_set_conn_handler(fun, cuda_dev_connection);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function '%s'.", name);
-		goto error;
-	}
-
-	*rdev = dev;
-	return EOK;
-error:
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	return rc;
-}
-
-errno_t cuda_add(cuda_t *cuda, cuda_res_t *res)
-{
-	adb_dev_t *kbd = NULL;
-	adb_dev_t *mouse = NULL;
-	errno_t rc;
-
-	cuda->phys_base = res->base;
-
-	rc = cuda_dev_create(cuda, "kbd", "adb/keyboard", &kbd);
-	if (rc != EOK)
-		goto error;
-
-	rc = cuda_dev_create(cuda, "mouse", "adb/mouse", &mouse);
-	if (rc != EOK)
-		goto error;
-
-	cuda->addr_dev[2] = kbd;
-	cuda->addr_dev[8] = kbd;
-
-	cuda->addr_dev[9] = mouse;
-
-	rc = cuda_init(cuda);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed initializing CUDA hardware.");
-		return rc;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-errno_t cuda_remove(cuda_t *cuda)
-{
-	return ENOTSUP;
-}
-
-errno_t cuda_gone(cuda_t *cuda)
-{
-	return ENOTSUP;
-}
-
-/** Device connection handler */
-static void cuda_dev_connection(ipc_call_t *icall, void *arg)
-{
-	adb_dev_t *dev = (adb_dev_t *) ddf_fun_data_get((ddf_fun_t *) arg);
-	ipc_call_t call;
-	sysarg_t method;
-
-	/* Answer the IPC_M_CONNECT_ME_TO call. */
-	async_accept_0(icall);
-
-	while (true) {
-		async_get_call(&call);
-		method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		async_sess_t *sess =
-		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
-		if (sess != NULL) {
-			dev->client_sess = sess;
-			async_answer_0(&call, EOK);
-		} else {
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-static errno_t cuda_init(cuda_t *cuda)
-{
-	errno_t rc;
-
-	void *vaddr;
-	rc = pio_enable((void *) cuda->phys_base, sizeof(cuda_regs_t),
-	    &vaddr);
-	if (rc != EOK)
-		return rc;
-
-	cuda->regs = vaddr;
-	cuda->xstate = cx_listen;
-	cuda->bidx = 0;
-	cuda->snd_bytes = 0;
-
-	fibril_mutex_initialize(&cuda->dev_lock);
-
-	/* Disable all interrupts from CUDA. */
-	pio_write_8(&cuda->regs->ier, IER_CLR | ALL_INT);
-
-	cuda_irq_code.ranges[0].base = (uintptr_t) cuda->phys_base;
-	cuda_irq_code.cmds[0].addr = (void *) &((cuda_regs_t *)
-	    cuda->phys_base)->ifr;
-	async_irq_subscribe(10, cuda_irq_handler, cuda, &cuda_irq_code, NULL);
-
-	/* Enable SR interrupt. */
-	pio_write_8(&cuda->regs->ier, TIP | TREQ);
-	pio_write_8(&cuda->regs->ier, IER_SET | SR_INT);
-
-	/* Enable ADB autopolling. */
-	cuda_autopoll_set(cuda, true);
-
-	return EOK;
-}
-
-static void cuda_irq_handler(ipc_call_t *call, void *arg)
-{
-	uint8_t rbuf[CUDA_RCV_BUF_SIZE];
-	cuda_t *cuda = (cuda_t *)arg;
-	size_t len;
-	bool handle;
-
-	handle = false;
-	len = 0;
-
-	fibril_mutex_lock(&cuda->dev_lock);
-
-	/* Lower IFR.SR_INT so that CUDA can generate next int by raising it. */
-	pio_write_8(&cuda->regs->ifr, SR_INT);
-
-	switch (cuda->xstate) {
-	case cx_listen:
-		cuda_irq_listen(cuda);
-		break;
-	case cx_receive:
-		cuda_irq_receive(cuda);
-		break;
-	case cx_rcv_end:
-		cuda_irq_rcv_end(cuda, rbuf, &len);
-		handle = true;
-		break;
-	case cx_send_start:
-		cuda_irq_send_start(cuda);
-		break;
-	case cx_send:
-		cuda_irq_send(cuda);
-		break;
-	}
-
-	fibril_mutex_unlock(&cuda->dev_lock);
-
-	/* Handle an incoming packet. */
-	if (handle)
-		cuda_packet_handle(cuda, rbuf, len);
-}
-
-/** Interrupt in listen state.
- *
- * Start packet reception.
- *
- * @param cuda CUDA instance
- */
-static void cuda_irq_listen(cuda_t *cuda)
-{
-	uint8_t b = pio_read_8(&cuda->regs->b);
-
-	if ((b & TREQ) != 0) {
-		ddf_msg(LVL_WARN, "cuda_irq_listen: no TREQ?!");
-		return;
-	}
-
-	pio_write_8(&cuda->regs->b, b & ~TIP);
-	cuda->xstate = cx_receive;
-}
-
-/** Interrupt in receive state.
- *
- * Receive next byte of packet.
- *
- * @param cuda CUDA instance
- */
-static void cuda_irq_receive(cuda_t *cuda)
-{
-	uint8_t data = pio_read_8(&cuda->regs->sr);
-	if (cuda->bidx < CUDA_RCV_BUF_SIZE)
-		cuda->rcv_buf[cuda->bidx++] = data;
-
-	uint8_t b = pio_read_8(&cuda->regs->b);
-
-	if ((b & TREQ) == 0) {
-		pio_write_8(&cuda->regs->b, b ^ TACK);
-	} else {
-		pio_write_8(&cuda->regs->b, b | TACK | TIP);
-		cuda->xstate = cx_rcv_end;
-	}
-}
-
-/** Interrupt in rcv_end state.
- *
- * Terminate packet reception. Either go back to listen state or start
- * receiving another packet if CUDA has one for us.
- *
- * @param cuda CUDA instance
- * @param buf Buffer for storing received packet
- * @param len Place to store length of received packet
- */
-static void cuda_irq_rcv_end(cuda_t *cuda, void *buf, size_t *len)
-{
-	uint8_t b = pio_read_8(&cuda->regs->b);
-
-	if ((b & TREQ) == 0) {
-		cuda->xstate = cx_receive;
-		pio_write_8(&cuda->regs->b, b & ~TIP);
-	} else {
-		cuda->xstate = cx_listen;
-		cuda_send_start(cuda);
-	}
-
-	memcpy(buf, cuda->rcv_buf, cuda->bidx);
-	*len = cuda->bidx;
-	cuda->bidx = 0;
-}
-
-/** Interrupt in send_start state.
- *
- * Process result of sending first byte (and send second on success).
- *
- * @param cuda CUDA instance
- */
-static void cuda_irq_send_start(cuda_t *cuda)
-{
-	uint8_t b;
-
-	b = pio_read_8(&cuda->regs->b);
-
-	if ((b & TREQ) == 0) {
-		/* Collision */
-		pio_write_8(&cuda->regs->acr, pio_read_8(&cuda->regs->acr) &
-		    ~SR_OUT);
-		pio_read_8(&cuda->regs->sr);
-		pio_write_8(&cuda->regs->b, pio_read_8(&cuda->regs->b) |
-		    TIP | TACK);
-		cuda->xstate = cx_listen;
-		return;
-	}
-
-	pio_write_8(&cuda->regs->sr, cuda->snd_buf[1]);
-	pio_write_8(&cuda->regs->b, pio_read_8(&cuda->regs->b) ^ TACK);
-	cuda->bidx = 2;
-
-	cuda->xstate = cx_send;
-}
-
-/** Interrupt in send state.
- *
- * Send next byte or terminate transmission.
- *
- * @param cuda CUDA instance
- */
-static void cuda_irq_send(cuda_t *cuda)
-{
-	if (cuda->bidx < cuda->snd_bytes) {
-		/* Send next byte. */
-		pio_write_8(&cuda->regs->sr,
-		    cuda->snd_buf[cuda->bidx++]);
-		pio_write_8(&cuda->regs->b, pio_read_8(&cuda->regs->b) ^ TACK);
-		return;
-	}
-
-	/* End transfer. */
-	cuda->snd_bytes = 0;
-	cuda->bidx = 0;
-
-	pio_write_8(&cuda->regs->acr, pio_read_8(&cuda->regs->acr) & ~SR_OUT);
-	pio_read_8(&cuda->regs->sr);
-	pio_write_8(&cuda->regs->b, pio_read_8(&cuda->regs->b) | TACK | TIP);
-
-	cuda->xstate = cx_listen;
-	/* TODO: Match reply with request. */
-}
-
-static void cuda_packet_handle(cuda_t *cuda, uint8_t *data, size_t len)
-{
-	if (data[0] != PT_ADB)
-		return;
-	if (len < 2)
-		return;
-
-	adb_packet_handle(cuda, data + 2, len - 2, (data[1] & 0x40) != 0);
-}
-
-static void adb_packet_handle(cuda_t *cuda, uint8_t *data, size_t size,
-    bool autopoll)
-{
-	uint8_t dev_addr;
-	uint8_t reg_no;
-	uint16_t reg_val;
-	adb_dev_t *dev;
-	unsigned i;
-
-	dev_addr = data[0] >> 4;
-	reg_no = data[0] & 0x03;
-
-	if (size != 3) {
-		ddf_msg(LVL_WARN, "Unrecognized packet, size=%zu", size);
-		for (i = 0; i < size; ++i) {
-			ddf_msg(LVL_WARN, "  0x%02x", data[i]);
-		}
-		return;
-	}
-
-	if (reg_no != 0) {
-		ddf_msg(LVL_WARN, "Unrecognized packet, size=%zu", size);
-		for (i = 0; i < size; ++i) {
-			ddf_msg(LVL_WARN, "  0x%02x", data[i]);
-		}
-		return;
-	}
-
-	reg_val = ((uint16_t) data[1] << 8) | (uint16_t) data[2];
-
-	ddf_msg(LVL_DEBUG, "Received ADB packet for device address %d",
-	    dev_addr);
-	dev = cuda->addr_dev[dev_addr];
-	if (dev == NULL)
-		return;
-
-	async_exch_t *exch = async_exchange_begin(dev->client_sess);
-	async_msg_1(exch, ADB_REG_NOTIF, reg_val);
-	async_exchange_end(exch);
-}
-
-static void cuda_autopoll_set(cuda_t *cuda, bool enable)
-{
-	cuda->snd_buf[0] = PT_CUDA;
-	cuda->snd_buf[1] = CPT_AUTOPOLL;
-	cuda->snd_buf[2] = enable ? 0x01 : 0x00;
-	cuda->snd_bytes = 3;
-	cuda->bidx = 0;
-
-	cuda_send_start(cuda);
-}
-
-static void cuda_send_start(cuda_t *cuda)
-{
-	assert(cuda->xstate == cx_listen);
-
-	if (cuda->snd_bytes == 0)
-		return;
-
-	/* Check for incoming data. */
-	if ((pio_read_8(&cuda->regs->b) & TREQ) == 0)
-		return;
-
-	pio_write_8(&cuda->regs->acr, pio_read_8(&cuda->regs->acr) | SR_OUT);
-	pio_write_8(&cuda->regs->sr, cuda->snd_buf[0]);
-	pio_write_8(&cuda->regs->b, pio_read_8(&cuda->regs->b) & ~TIP);
-
-	cuda->xstate = cx_send_start;
-}
-
-/** @}
- */
Index: pace/drv/bus/adb/cuda_adb/cuda_adb.h
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_adb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_cuda_adb
- * @{
- */
-/** @file
- */
-
-#ifndef CUDA_ADB_H_
-#define CUDA_ADB_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <loc.h>
-#include <stdint.h>
-#include "cuda_hw.h"
-
-enum {
-	CUDA_RCV_BUF_SIZE = 5
-};
-
-enum cuda_xfer_state {
-	cx_listen,
-	cx_receive,
-	cx_rcv_end,
-	cx_send_start,
-	cx_send
-};
-
-typedef struct {
-	uintptr_t base;
-	int irq;
-} cuda_res_t;
-
-/** ADB bus device */
-typedef struct {
-	ddf_fun_t *fun;
-	async_sess_t *client_sess;
-	link_t lcuda;
-	struct cuda *cuda;
-} adb_dev_t;
-
-/** CUDA ADB bus */
-typedef struct cude {
-	struct cuda_regs *regs;
-	uintptr_t phys_base;
-	ddf_dev_t *dev;
-
-	uint8_t rcv_buf[CUDA_RCV_BUF_SIZE];
-	uint8_t snd_buf[CUDA_RCV_BUF_SIZE];
-	size_t bidx;
-	size_t snd_bytes;
-	enum cuda_xfer_state xstate;
-	fibril_mutex_t dev_lock;
-
-	list_t devs;
-	adb_dev_t *addr_dev[ADB_MAX_ADDR];
-} cuda_t;
-
-extern errno_t cuda_add(cuda_t *, cuda_res_t *);
-extern errno_t cuda_remove(cuda_t *);
-extern errno_t cuda_gone(cuda_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/bus/adb/cuda_adb/cuda_adb.ma
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_adb.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 cuda_adb
Index: pace/drv/bus/adb/cuda_adb/cuda_hw.h
===================================================================
--- uspace/drv/bus/adb/cuda_adb/cuda_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_cuda_adb
- * @{
- */
-/** @file
- */
-
-#ifndef CUDA_HW_H_
-#define CUDA_HW_H_
-
-#include <ddi.h>
-
-#include <stdint.h>
-
-typedef struct cuda_regs {
-	ioport8_t b;
-	uint8_t pad0[0x1ff];
-
-	ioport8_t a;
-	uint8_t pad1[0x1ff];
-
-	ioport8_t dirb;
-	uint8_t pad2[0x1ff];
-
-	ioport8_t dira;
-	uint8_t pad3[0x1ff];
-
-	ioport8_t t1cl;
-	uint8_t pad4[0x1ff];
-
-	ioport8_t t1ch;
-	uint8_t pad5[0x1ff];
-
-	ioport8_t t1ll;
-	uint8_t pad6[0x1ff];
-
-	ioport8_t t1lh;
-	uint8_t pad7[0x1ff];
-
-	ioport8_t t2cl;
-	uint8_t pad8[0x1ff];
-
-	ioport8_t t2ch;
-	uint8_t pad9[0x1ff];
-
-	ioport8_t sr;
-	uint8_t pad10[0x1ff];
-
-	ioport8_t acr;
-	uint8_t pad11[0x1ff];
-
-	ioport8_t pcr;
-	uint8_t pad12[0x1ff];
-
-	ioport8_t ifr;
-	uint8_t pad13[0x1ff];
-
-	ioport8_t ier;
-	uint8_t pad14[0x1ff];
-
-	ioport8_t anh;
-	uint8_t pad15[0x1ff];
-} cuda_regs_t;
-
-/** B register fields */
-enum {
-	TREQ	= 0x08,
-	TACK	= 0x10,
-	TIP	= 0x20
-};
-
-/** IER register fields */
-enum {
-	IER_CLR	= 0x00,
-	IER_SET	= 0x80,
-
-	SR_INT	= 0x04,
-	ALL_INT	= 0x7f
-};
-
-/** ACR register fields */
-enum {
-	SR_OUT	= 0x10
-};
-
-/** Packet types */
-enum {
-	PT_ADB	= 0x00,
-	PT_CUDA	= 0x01
-};
-
-/** CUDA packet types */
-enum {
-	CPT_AUTOPOLL	= 0x01
-};
-
-enum {
-	ADB_MAX_ADDR	= 16
-};
-
-#endif
-
-/** @}
- */
Index: pace/drv/bus/adb/cuda_adb/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/adb/cuda_adb/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_cuda_adb cuda_adb
- * @brief VIA-CUDA Apple Desktop Bus driver
- * @ingroup drvs
- */
Index: pace/drv/bus/adb/cuda_adb/main.c
===================================================================
--- uspace/drv/bus/adb/cuda_adb/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_cuda_adb
- * @{
- */
-/** @file VIA-CUDA Apple Desktop Bus driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "cuda_adb.h"
-
-#define NAME  "cuda_adb"
-
-static errno_t cuda_dev_add(ddf_dev_t *dev);
-static errno_t cuda_dev_remove(ddf_dev_t *dev);
-static errno_t cuda_dev_gone(ddf_dev_t *dev);
-static errno_t cuda_fun_online(ddf_fun_t *fun);
-static errno_t cuda_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = cuda_dev_add,
-	.dev_remove = cuda_dev_remove,
-	.dev_gone = cuda_dev_gone,
-	.fun_online = cuda_fun_online,
-	.fun_offline = cuda_fun_offline
-};
-
-static driver_t cuda_adb_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t cuda_get_res(ddf_dev_t *dev, cuda_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.io_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.io_ranges.ranges[0]);
-
-	if (hw_res.irqs.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->irq = hw_res.irqs.irqs[0];
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t cuda_dev_add(ddf_dev_t *dev)
-{
-	cuda_t *cuda;
-	cuda_res_t cuda_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "cuda_dev_add(%p)", dev);
-	cuda = ddf_dev_data_alloc(dev, sizeof(cuda_t));
-	if (cuda == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	cuda->dev = dev;
-	list_initialize(&cuda->devs);
-
-	rc = cuda_get_res(dev, &cuda_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return cuda_add(cuda, &cuda_res);
-}
-
-static errno_t cuda_dev_remove(ddf_dev_t *dev)
-{
-	cuda_t *cuda = (cuda_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "cuda_dev_remove(%p)", dev);
-
-	return cuda_remove(cuda);
-}
-
-static errno_t cuda_dev_gone(ddf_dev_t *dev)
-{
-	cuda_t *cuda = (cuda_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "cuda_dev_gone(%p)", dev);
-
-	return cuda_gone(cuda);
-}
-
-static errno_t cuda_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "cuda_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t cuda_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "cuda_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": VIA-CUDA Apple Desktop Bus driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&cuda_adb_driver);
-}
-
-/** @}
- */
Index: pace/drv/bus/adb/cuda_adb/meson.build
===================================================================
--- uspace/drv/bus/adb/cuda_adb/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('cuda_adb.c', 'main.c')
Index: pace/drv/bus/isa/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/isa/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup isa isa
- * @brief ISA bus driver
- * @ingroup drvs
- */
Index: pace/drv/bus/isa/ebus.dev
===================================================================
--- uspace/drv/bus/isa/ebus.dev	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-com1:
-	match 100 isa/ns8250
-	irq 2027
-	io_range 3f8 8
-
-i8042:
-	match 100 isa/i8042
-	irq 2025
-	irq 2026
-	io_range 060 5
Index: pace/drv/bus/isa/i8237.c
===================================================================
--- uspace/drv/bus/isa/i8237.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,499 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa
- * @{
- */
-
-/** @file
- * @brief DMA controller management
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <fibril_synch.h>
-#include "i8237.h"
-
-/** DMA Slave controller I/O Address. */
-#define DMA_CONTROLLER_FIRST_BASE  ((void *) 0x00)
-
-/** DMA Master controller I/O Address. */
-#define DMA_CONTROLLER_SECOND_BASE  ((void *) 0xc0)
-
-/** Shared DMA page address register I/O address. */
-#define DMA_CONTROLLER_PAGE_BASE  ((void *) 0x81)
-
-#define DMA_STATUS_REQ(x)       (1 << (((x) % 4) + 4))
-#define DMA_STATUS_COMPLETE(x)  (1 << ((x) % 4))
-
-/** http://wiki.osdev.org/DMA: The only bit that works is COND (bit 2) */
-#define DMA_COMMAND_COND  (1 << 2)  /**< Disables DMA controller */
-
-#define DMA_SINGLE_MASK_CHAN_SEL_MASK   0x03
-#define DMA_SINGLE_MASK_CHAN_SEL_SHIFT  0
-
-#define DMA_SINGLE_MASK_CHAN_TO_REG(x) \
-	(((x) & DMA_SINGLE_MASK_CHAN_SEL_MASK) << DMA_SINGLE_MASK_CHAN_SEL_SHIFT)
-
-#define DMA_SINGLE_MASK_MASKED_FLAG  (1 << 2)
-
-#define DMA_MODE_CHAN_SELECT_MASK   0x03
-#define DMA_MODE_CHAN_SELECT_SHIFT  0
-
-#define DMA_MODE_CHAN_TO_REG(x) \
-	(((x) & DMA_MODE_CHAN_SELECT_MASK) << DMA_MODE_CHAN_SELECT_SHIFT)
-
-#define DMA_MODE_CHAN_TRA_MASK       0x03
-#define DMA_MODE_CHAN_TRA_SHIFT      2
-#define DMA_MODE_CHAN_TRA_SELF_TEST  0
-#define DMA_MODE_CHAN_TRA_WRITE      0x01
-#define DMA_MODE_CHAN_TRA_READ       0x02
-
-#define DMA_MODE_CHAN_AUTO_FLAG  (1 << 4)
-#define DMA_MODE_CHAN_DOWN_FLAG  (1 << 5)
-
-#define DMA_MODE_CHAN_MODE_MASK     0x03
-#define DMA_MODE_CHAN_MODE_SHIFT    6
-#define DMA_MODE_CHAN_MODE_DEMAND   0
-#define DMA_MODE_CHAN_MODE_SINGLE   1
-#define DMA_MODE_CHAN_MODE_BLOCK    2
-#define DMA_MODE_CHAN_MODE_CASCADE  3
-
-#define DMA_MULTI_MASK_CHAN(x)  (1 << ((x) % 4))
-
-typedef struct {
-	uint8_t channel_start0;
-	uint8_t channel_count0;
-	uint8_t channel_start1;
-	uint8_t channel_count1;
-	uint8_t channel_start2;
-	uint8_t channel_count2;
-	uint8_t channel_start3;
-	uint8_t channel_count3;
-
-	uint8_t command_status;
-
-	/** Memory to memory transfers, NOT implemented on PCs */
-	uint8_t request;
-	uint8_t single_mask;
-	uint8_t mode;
-	uint8_t flip_flop;
-
-	/*
-	 * Master reset sets Flip-Flop low, clears status,
-	 * sets all mask bits on.
-	 *
-	 * Intermediate is not implemented on PCs.
-	 *
-	 */
-	uint8_t master_reset;
-	uint8_t mask_reset;
-	uint8_t multi_mask;
-} dma_controller_regs_first_t;
-
-typedef struct {
-	uint8_t channel_start4;
-	uint8_t reserved0;
-	uint8_t channel_count4;
-	uint8_t reserved1;
-	uint8_t channel_start5;
-	uint8_t reserved2;
-	uint8_t channel_count5;
-	uint8_t reserved3;
-	uint8_t channel_start6;
-	uint8_t reserved4;
-	uint8_t channel_count6;
-	uint8_t reserved5;
-	uint8_t channel_start7;
-	uint8_t reserved6;
-	uint8_t channel_count7;
-
-	uint8_t command_status;
-	uint8_t reserved8;
-	uint8_t request;
-	uint8_t reserved9;
-	uint8_t single_mask;
-	uint8_t reserveda;
-	uint8_t mode;
-	uint8_t reservedb;
-	uint8_t flip_flop;
-	uint8_t reservedc;
-	uint8_t master_reset;
-	uint8_t reservedd;
-	uint8_t multi_mask;
-} dma_controller_regs_second_t;
-
-typedef struct {
-	uint8_t channel2;
-	uint8_t channel3;
-	uint8_t channel1;
-	uint8_t reserved0;
-	uint8_t reserved1;
-	uint8_t reserved2;
-	uint8_t channel0;
-	uint8_t reserved3;
-	uint8_t channel6;
-	uint8_t channel7;
-	uint8_t channel5;
-	uint8_t reserved4;
-	uint8_t reserved5;
-	uint8_t reserved6;
-	uint8_t channel4;
-} dma_page_regs_t;
-
-/** Addresses needed to setup a DMA channel. */
-typedef struct {
-	ioport8_t *offset_reg_address;
-	ioport8_t *size_reg_address;
-	ioport8_t *page_reg_address;
-	ioport8_t *single_mask_address;
-	ioport8_t *mode_address;
-	ioport8_t *flip_flop_address;
-} dma_channel_t;
-
-typedef struct {
-	dma_channel_t channels[8];
-	dma_page_regs_t *page_table;
-	dma_controller_regs_first_t *first;
-	dma_controller_regs_second_t *second;
-	bool initialized;
-} dma_controller_t;
-
-static FIBRIL_MUTEX_INITIALIZE(guard);
-
-/** Standard i8237 DMA controller.
- *
- * http://zet.aluzina.org/index.php/8237_DMA_controller#DMA_Channel_Registers
- *
- */
-static dma_controller_t controller_8237 = {
-	.channels = {
-		/* The first chip 8-bit */
-		{ /* Channel 0 - Unusable */
-			.offset_reg_address = (uint8_t *) 0x00,
-			.size_reg_address = (uint8_t *) 0x01,
-			.page_reg_address = (uint8_t *) 0x87,
-			.single_mask_address = (uint8_t *) 0x0a,
-			.mode_address = (uint8_t *) 0x0b,
-			.flip_flop_address = (uint8_t *) 0x0c,
-		},
-		{ /* Channel 1 */
-			.offset_reg_address = (uint8_t *) 0x02,
-			.size_reg_address = (uint8_t *) 0x03,
-			.page_reg_address = (uint8_t *) 0x83,
-			.single_mask_address = (uint8_t *) 0x0a,
-			.mode_address = (uint8_t *) 0x0b,
-			.flip_flop_address = (uint8_t *) 0x0c,
-		},
-		{ /* Channel 2 */
-			.offset_reg_address = (uint8_t *) 0x04,
-			.size_reg_address = (uint8_t *) 0x05,
-			.page_reg_address = (uint8_t *) 0x81,
-			.single_mask_address = (uint8_t *) 0x0a,
-			.mode_address = (uint8_t *) 0x0b,
-			.flip_flop_address = (uint8_t *) 0x0c,
-		},
-		{ /* Channel 3 */
-			.offset_reg_address = (uint8_t *) 0x06,
-			.size_reg_address = (uint8_t *) 0x07,
-			.page_reg_address = (uint8_t *) 0x82,
-			.single_mask_address = (uint8_t *) 0x0a,
-			.mode_address = (uint8_t *) 0x0b,
-			.flip_flop_address = (uint8_t *) 0x0c,
-		},
-
-		/* The second chip 16-bit */
-		{ /* Channel 4 - Unusable */
-			.offset_reg_address = (uint8_t *) 0xc0,
-			.size_reg_address = (uint8_t *) 0xc2,
-			.page_reg_address = (uint8_t *) 0x8f,
-			.single_mask_address = (uint8_t *) 0xd4,
-			.mode_address = (uint8_t *) 0xd6,
-			.flip_flop_address = (uint8_t *) 0xd8,
-		},
-		{ /* Channel 5 */
-			.offset_reg_address = (uint8_t *) 0xc4,
-			.size_reg_address = (uint8_t *) 0xc6,
-			.page_reg_address = (uint8_t *) 0x8b,
-			.single_mask_address = (uint8_t *) 0xd4,
-			.mode_address = (uint8_t *) 0xd6,
-			.flip_flop_address = (uint8_t *) 0xd8,
-		},
-		{ /* Channel 6 */
-			.offset_reg_address = (uint8_t *) 0xc8,
-			.size_reg_address = (uint8_t *) 0xca,
-			.page_reg_address = (uint8_t *) 0x89,
-			.single_mask_address = (uint8_t *) 0xd4,
-			.mode_address = (uint8_t *) 0xd6,
-			.flip_flop_address = (uint8_t *) 0xd8,
-		},
-		{ /* Channel 7 */
-			.offset_reg_address = (uint8_t *) 0xcc,
-			.size_reg_address = (uint8_t *) 0xce,
-			.page_reg_address = (uint8_t *) 0x8a,
-			.single_mask_address = (uint8_t *) 0xd4,
-			.mode_address = (uint8_t *) 0xd6,
-			.flip_flop_address = (uint8_t *) 0xd8,
-		},
-	},
-
-	.page_table = NULL,
-	.first = NULL,
-	.second = NULL,
-	.initialized = false,
-};
-
-/** Initialize I/O access to DMA controller I/O ports.
- *
- * @param controller DMA Controller structure to initialize.
- *
- * @return Error code.
- *
- */
-static inline errno_t dma_controller_init(dma_controller_t *controller)
-{
-	assert(controller);
-	errno_t ret = pio_enable(DMA_CONTROLLER_PAGE_BASE, sizeof(dma_page_regs_t),
-	    (void **) &controller->page_table);
-	if (ret != EOK)
-		return EIO;
-
-	ret = pio_enable(DMA_CONTROLLER_FIRST_BASE,
-	    sizeof(dma_controller_regs_first_t), (void **) &controller->first);
-	if (ret != EOK)
-		return EIO;
-
-	ret = pio_enable(DMA_CONTROLLER_SECOND_BASE,
-	    sizeof(dma_controller_regs_second_t), (void **) &controller->second);
-	if (ret != EOK)
-		return EIO;
-
-	controller->initialized = true;
-
-	/* Reset the controller */
-	pio_write_8(&controller->second->master_reset, 0xff);
-	pio_write_8(&controller->first->master_reset, 0xff);
-
-	return EOK;
-}
-
-/** Helper function. Channels 4,5,6, and 7 are 8 bit DMA.
- * @pram channel DMA channel.
- * @reutrn True, if channel is 4,5,6, or 7, false otherwise.
- */
-static inline bool is_dma16(unsigned channel)
-{
-	return (channel >= 4) && (channel < 8);
-}
-
-/** Helper function. Channels 0,1,2, and 3 are 8 bit DMA.
- * @pram channel DMA channel.
- * @reutrn True, if channel is 0,1,2, or 3, false otherwise.
- */
-static inline bool is_dma8(unsigned channel)
-{
-	return (channel < 4);
-}
-
-/** Setup DMA channel to specified place and mode.
- *
- * @param channel DMA Channel 1, 2, 3 for 8 bit transfers,
- *                    5, 6, 7 for 16 bit.
- * @param pa      Physical address of the buffer. Must be < 16 MB
- *                for 16 bit and < 1 MB for 8 bit transfers.
- * @param size    DMA buffer size, limited to 64 KB.
- * @param mode    Mode of the DMA channel:
- *                - Read or Write
- *                - Allow automatic reset
- *                - Use address decrement instead of increment
- *                - Use SINGLE/BLOCK/ON DEMAND transfer mode
- *
- * @return Error code.
- */
-errno_t dma_channel_setup(unsigned int channel, uint32_t pa, uint32_t size,
-    uint8_t mode)
-{
-	if (!is_dma8(channel) && !is_dma16(channel))
-		return ENOENT;
-
-	if ((channel == 0) || (channel == 4))
-		return ENOTSUP;
-
-	/* DMA is limited to 24bit addresses. */
-	if (pa >= (1 << 24))
-		return EINVAL;
-
-	/* 8 bit channels use only 4 bits from the page register. */
-	if (is_dma8(channel) && (pa >= (1 << 20)))
-		return EINVAL;
-
-	/* Buffers cannot cross 64K page boundaries */
-	if ((pa & 0xffff0000) != ((pa + size - 1) & 0xffff0000))
-		return EINVAL;
-
-	fibril_mutex_lock(&guard);
-
-	if (!controller_8237.initialized)
-		dma_controller_init(&controller_8237);
-
-	if (!controller_8237.initialized) {
-		fibril_mutex_unlock(&guard);
-		return EIO;
-	}
-
-	/* 16 bit transfers are a bit special */
-	ddf_msg(LVL_DEBUG, "Unspoiled address %#" PRIx32 " (size %" PRIu32 ")",
-	    pa, size);
-	if (is_dma16(channel)) {
-		/* Size must be aligned to 16 bits */
-		if ((size & 1) != 0) {
-			fibril_mutex_unlock(&guard);
-			return EINVAL;
-		}
-		/* Size is in 2byte words */
-		size >>= 1;
-		/* Address is fun: lower 16 bits need to be shifted by 1 */
-		pa = ((pa & 0xffff) >> 1) | (pa & 0xff0000);
-	}
-
-	const dma_channel_t dma_channel = controller_8237.channels[channel];
-
-	ddf_msg(LVL_DEBUG, "Setting channel %u to address %#" PRIx32 " "
-	    "(size %" PRIu32 "), mode %hhx.", channel, pa, size, mode);
-
-	/* Mask DMA request */
-	uint8_t value = DMA_SINGLE_MASK_CHAN_TO_REG(channel) |
-	    DMA_SINGLE_MASK_MASKED_FLAG;
-	pio_write_8(dma_channel.single_mask_address, value);
-
-	/* Set mode */
-	value = DMA_MODE_CHAN_TO_REG(channel) | mode;
-	ddf_msg(LVL_DEBUG2, "Writing mode byte: %p:%hhx.",
-	    dma_channel.mode_address, value);
-	pio_write_8(dma_channel.mode_address, value);
-
-	/* Set address - reset flip-flop */
-	pio_write_8(dma_channel.flip_flop_address, 0);
-
-	/* Low byte */
-	value = pa & 0xff;
-	ddf_msg(LVL_DEBUG2, "Writing address low byte: %p:%hhx.",
-	    dma_channel.offset_reg_address, value);
-	pio_write_8(dma_channel.offset_reg_address, value);
-
-	/* High byte */
-	value = (pa >> 8) & 0xff;
-	ddf_msg(LVL_DEBUG2, "Writing address high byte: %p:%hhx.",
-	    dma_channel.offset_reg_address, value);
-	pio_write_8(dma_channel.offset_reg_address, value);
-
-	/* Page address - third byte */
-	value = (pa >> 16) & 0xff;
-	ddf_msg(LVL_DEBUG2, "Writing address page byte: %p:%hhx.",
-	    dma_channel.page_reg_address, value);
-	pio_write_8(dma_channel.page_reg_address, value);
-
-	/* Set size - reset flip-flop */
-	pio_write_8(dma_channel.flip_flop_address, 0);
-
-	/* Low byte */
-	value = (size - 1) & 0xff;
-	ddf_msg(LVL_DEBUG2, "Writing size low byte: %p:%hhx.",
-	    dma_channel.size_reg_address, value);
-	pio_write_8(dma_channel.size_reg_address, value);
-
-	/* High byte */
-	value = ((size - 1) >> 8) & 0xff;
-	ddf_msg(LVL_DEBUG2, "Writing size high byte: %p:%hhx.",
-	    dma_channel.size_reg_address, value);
-	pio_write_8(dma_channel.size_reg_address, value);
-
-	/* Unmask DMA request */
-	value = DMA_SINGLE_MASK_CHAN_TO_REG(channel);
-	pio_write_8(dma_channel.single_mask_address, value);
-
-	fibril_mutex_unlock(&guard);
-
-	return EOK;
-}
-
-/** Query remaining buffer size.
- *
- * @param channel DMA Channel 1, 2, 3 for 8 bit transfers,
- *                    5, 6, 7 for 16 bit.
- * @param size    Place to store number of bytes pending in the assigned buffer.
- *
- * @return Error code.
- */
-errno_t dma_channel_remain(unsigned channel, size_t *size)
-{
-	assert(size);
-	if (!is_dma8(channel) && !is_dma16(channel))
-		return ENOENT;
-
-	if ((channel == 0) || (channel == 4))
-		return ENOTSUP;
-
-	fibril_mutex_lock(&guard);
-	if (!controller_8237.initialized) {
-		fibril_mutex_unlock(&guard);
-		return EIO;
-	}
-
-	const dma_channel_t dma_channel = controller_8237.channels[channel];
-	/* Get size - reset flip-flop */
-	pio_write_8(dma_channel.flip_flop_address, 0);
-
-	/* Low byte */
-	const uint8_t value_low = pio_read_8(dma_channel.size_reg_address);
-	ddf_msg(LVL_DEBUG2, "Read size low byte: %p:%x.",
-	    dma_channel.size_reg_address, value_low);
-
-	/* High byte */
-	const uint8_t value_high = pio_read_8(dma_channel.size_reg_address);
-	ddf_msg(LVL_DEBUG2, "Read size high byte: %p:%x.",
-	    dma_channel.size_reg_address, value_high);
-	fibril_mutex_unlock(&guard);
-
-	uint16_t remain = (value_high << 8 | value_low);
-	/*
-	 * 16 bit DMA size is in words,
-	 * the upper bits are bogus for 16bit transfers so we need to get
-	 * rid of them. Using limited type works well.
-	 */
-	if (is_dma16(channel))
-		remain <<= 1;
-	*size =  is_dma16(channel) ? remain + 2 : remain + 1;
-	return EOK;
-}
-/**
- * @}
- */
Index: pace/drv/bus/isa/i8237.h
===================================================================
--- uspace/drv/bus/isa/i8237.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup isa
- * @{
- */
-
-/** @file
- * @brief DMA memory management
- */
-
-#ifndef DRV_BUS_ISA_I8237_H
-#define DRV_BUS_ISA_I8237_H
-
-extern errno_t dma_channel_setup(unsigned, uint32_t, uint32_t, uint8_t);
-extern errno_t dma_channel_remain(unsigned, size_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/isa/isa.c
===================================================================
--- uspace/drv/bus/isa/isa.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,896 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup isa
- * @{
- */
-
-/** @file
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <ctype.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <ipc/irc.h>
-#include <ipc/services.h>
-#include <vfs/vfs.h>
-#include <irc.h>
-#include <ns.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-
-#include <device/hw_res.h>
-#include <device/pio_window.h>
-
-#include <pci_dev_iface.h>
-
-#include "i8237.h"
-
-#define NAME "isa"
-#define ISA_CHILD_FUN_CONF_PATH "/drv/isa/isa.dev"
-#define EBUS_CHILD_FUN_CONF_PATH "/drv/isa/ebus.dev"
-
-#define ISA_MAX_HW_RES 6
-
-typedef struct {
-	fibril_mutex_t mutex;
-	bool pci_isa_bridge;
-	uint16_t pci_vendor_id;
-	uint16_t pci_device_id;
-	uint8_t pci_class;
-	uint8_t pci_subclass;
-	ddf_dev_t *dev;
-	ddf_fun_t *fctl;
-	pio_window_t pio_win;
-	list_t functions;
-} isa_bus_t;
-
-typedef struct isa_fun {
-	fibril_mutex_t mutex;
-	ddf_fun_t *fnode;
-	hw_resource_t resources[ISA_MAX_HW_RES];
-	hw_resource_list_t hw_resources;
-	link_t bus_link;
-	isa_bus_t *bus;
-} isa_fun_t;
-
-/** Obtain soft-state from device node */
-static isa_bus_t *isa_bus(ddf_dev_t *dev)
-{
-	return ddf_dev_data_get(dev);
-}
-
-/** Obtain soft-state from function node */
-static isa_fun_t *isa_fun(ddf_fun_t *fun)
-{
-	return ddf_fun_data_get(fun);
-}
-
-static hw_resource_list_t *isa_fun_get_resources(ddf_fun_t *fnode)
-{
-	isa_fun_t *fun = isa_fun(fnode);
-	assert(fun);
-
-	return &fun->hw_resources;
-}
-
-static bool isa_fun_owns_interrupt(isa_fun_t *fun, int irq)
-{
-	const hw_resource_list_t *res = &fun->hw_resources;
-
-	/* Check that specified irq really belongs to the function */
-	for (size_t i = 0; i < res->count; ++i) {
-		if (res->resources[i].type == INTERRUPT &&
-		    res->resources[i].res.interrupt.irq == irq) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-static errno_t isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	isa_fun_t *fun = isa_fun(fnode);
-
-	if (!isa_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_enable_interrupt(irq);
-}
-
-static errno_t isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	isa_fun_t *fun = isa_fun(fnode);
-
-	if (!isa_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_disable_interrupt(irq);
-}
-
-static errno_t isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
-{
-	isa_fun_t *fun = isa_fun(fnode);
-
-	if (!isa_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_clear_interrupt(irq);
-}
-
-static errno_t isa_fun_setup_dma(ddf_fun_t *fnode,
-    unsigned int channel, uint32_t pa, uint32_t size, uint8_t mode)
-{
-	assert(fnode);
-	isa_fun_t *fun = isa_fun(fnode);
-	assert(fun);
-	const hw_resource_list_t *res = &fun->hw_resources;
-	assert(res);
-
-	for (size_t i = 0; i < res->count; ++i) {
-		/* Check for assigned channel */
-		if (((res->resources[i].type == DMA_CHANNEL_16) &&
-		    (res->resources[i].res.dma_channel.dma16 == channel)) ||
-		    ((res->resources[i].type == DMA_CHANNEL_8) &&
-		    (res->resources[i].res.dma_channel.dma8 == channel))) {
-			return dma_channel_setup(channel, pa, size, mode);
-		}
-	}
-
-	return EINVAL;
-}
-
-static errno_t isa_fun_remain_dma(ddf_fun_t *fnode,
-    unsigned channel, size_t *size)
-{
-	assert(size);
-	assert(fnode);
-	isa_fun_t *fun = isa_fun(fnode);
-	assert(fun);
-	const hw_resource_list_t *res = &fun->hw_resources;
-	assert(res);
-
-	for (size_t i = 0; i < res->count; ++i) {
-		/* Check for assigned channel */
-		if (((res->resources[i].type == DMA_CHANNEL_16) &&
-		    (res->resources[i].res.dma_channel.dma16 == channel)) ||
-		    ((res->resources[i].type == DMA_CHANNEL_8) &&
-		    (res->resources[i].res.dma_channel.dma8 == channel))) {
-			return dma_channel_remain(channel, size);
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Handle legacy IO availability query from function.
- *
- * @param fnode Function performing the query
- * @param rclaims Place to store the legacy IO claims bitmask
- * @return EOK on success or an error code
- */
-static errno_t isa_fun_query_legacy_io(ddf_fun_t *fnode,
-    hw_res_claims_t *rclaims)
-{
-	isa_fun_t *fun = isa_fun(fnode);
-	hw_res_claims_t claims;
-	async_sess_t *sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io()");
-
-	sess = ddf_dev_parent_sess_get(fun->bus->dev);
-	if (sess == NULL) {
-		ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
-		    "parent driver.");
-		return ENOENT;
-	}
-
-	if (!fun->bus->pci_isa_bridge) {
-		ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: classic ISA - "
-		    "legacy IDE range is available");
-		/* Classic ISA, we can be sure IDE is unclaimed by PCI */
-		claims = 0;
-	} else {
-		ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: ISA bridge - "
-		    "determine legacy IDE availability from PCI bus driver");
-		rc = hw_res_query_legacy_io(sess, &claims);
-		if (rc != EOK) {
-			ddf_msg(LVL_NOTE, "Error querying legacy IO claims.");
-			return rc;
-		}
-	}
-
-	ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io: returning 0x%x", claims);
-	*rclaims = claims;
-	return EOK;
-}
-
-static hw_res_ops_t isa_fun_hw_res_ops = {
-	.get_resource_list = isa_fun_get_resources,
-	.enable_interrupt = isa_fun_enable_interrupt,
-	.disable_interrupt = isa_fun_disable_interrupt,
-	.clear_interrupt = isa_fun_clear_interrupt,
-	.dma_channel_setup = isa_fun_setup_dma,
-	.dma_channel_remain = isa_fun_remain_dma,
-	.query_legacy_io = isa_fun_query_legacy_io
-};
-
-static pio_window_t *isa_fun_get_pio_window(ddf_fun_t *fnode)
-{
-	ddf_dev_t *dev = ddf_fun_get_dev(fnode);
-	isa_bus_t *isa = isa_bus(dev);
-	assert(isa);
-
-	return &isa->pio_win;
-}
-
-static pio_window_ops_t isa_fun_pio_window_ops = {
-	.get_pio_window = isa_fun_get_pio_window
-};
-
-static ddf_dev_ops_t isa_fun_ops = {
-	.interfaces[HW_RES_DEV_IFACE] = &isa_fun_hw_res_ops,
-	.interfaces[PIO_WINDOW_DEV_IFACE] = &isa_fun_pio_window_ops,
-};
-
-static errno_t isa_dev_add(ddf_dev_t *dev);
-static errno_t isa_dev_remove(ddf_dev_t *dev);
-static errno_t isa_fun_online(ddf_fun_t *fun);
-static errno_t isa_fun_offline(ddf_fun_t *fun);
-
-/** The isa device driver's standard operations */
-static driver_ops_t isa_ops = {
-	.dev_add = &isa_dev_add,
-	.dev_remove = &isa_dev_remove,
-	.fun_online = &isa_fun_online,
-	.fun_offline = &isa_fun_offline
-};
-
-/** The isa device driver structure. */
-static driver_t isa_driver = {
-	.name = NAME,
-	.driver_ops = &isa_ops
-};
-
-static isa_fun_t *isa_fun_create(isa_bus_t *isa, const char *name)
-{
-	ddf_fun_t *fnode = ddf_fun_create(isa->dev, fun_inner, name);
-	if (fnode == NULL)
-		return NULL;
-
-	isa_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(isa_fun_t));
-	if (fun == NULL) {
-		ddf_fun_destroy(fnode);
-		return NULL;
-	}
-
-	fibril_mutex_initialize(&fun->mutex);
-	fun->hw_resources.resources = fun->resources;
-	fun->bus = isa;
-
-	fun->fnode = fnode;
-	return fun;
-}
-
-static char *fun_conf_read(const char *conf_path)
-{
-	bool suc = false;
-	char *buf = NULL;
-	bool opened = false;
-	int fd;
-	size_t len;
-	errno_t rc;
-	size_t nread;
-	vfs_stat_t st;
-
-	rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Unable to open %s", conf_path);
-		goto cleanup;
-	}
-
-	opened = true;
-
-	if (vfs_stat(fd, &st) != EOK) {
-		ddf_msg(LVL_ERROR, "Unable to vfs_stat %d", fd);
-		goto cleanup;
-	}
-
-	len = st.size;
-	if (len == 0) {
-		ddf_msg(LVL_ERROR, "Configuration file '%s' is empty.",
-		    conf_path);
-		goto cleanup;
-	}
-
-	buf = malloc(len + 1);
-	if (buf == NULL) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
-		goto cleanup;
-	}
-
-	rc = vfs_read(fd, (aoff64_t []) { 0 }, buf, len, &nread);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Unable to read file '%s'.", conf_path);
-		goto cleanup;
-	}
-
-	buf[nread] = 0;
-
-	suc = true;
-
-cleanup:
-	if (!suc && buf != NULL) {
-		free(buf);
-		buf = NULL;
-	}
-
-	if (opened)
-		vfs_put(fd);
-
-	return buf;
-}
-
-static char *str_get_line(char *str, char **next)
-{
-	char *line = str;
-	*next = NULL;
-
-	if (str == NULL) {
-		return NULL;
-	}
-
-	while (*str != '\0' && *str != '\n') {
-		str++;
-	}
-
-	if (*str != '\0') {
-		*next = str + 1;
-	}
-
-	*str = '\0';
-	return line;
-}
-
-static bool line_empty(const char *line)
-{
-	while (line != NULL && *line != 0) {
-		if (!isspace(*line))
-			return false;
-		line++;
-	}
-
-	return true;
-}
-
-static char *get_device_name(char *line)
-{
-	/* Skip leading spaces. */
-	while (*line != '\0' && isspace(*line)) {
-		line++;
-	}
-
-	/* Get the name part of the rest of the line. */
-	str_tok(line, ":", NULL);
-	return line;
-}
-
-static inline const char *skip_spaces(const char *line)
-{
-	/* Skip leading spaces. */
-	while (*line != '\0' && isspace(*line))
-		line++;
-
-	return line;
-}
-
-static void isa_fun_add_irq(isa_fun_t *fun, int irq)
-{
-	size_t count = fun->hw_resources.count;
-	hw_resource_t *resources = fun->hw_resources.resources;
-
-	if (count < ISA_MAX_HW_RES) {
-		resources[count].type = INTERRUPT;
-		resources[count].res.interrupt.irq = irq;
-
-		fun->hw_resources.count++;
-
-		ddf_msg(LVL_NOTE, "Added irq 0x%x to function %s", irq,
-		    ddf_fun_get_name(fun->fnode));
-	}
-}
-
-static void isa_fun_add_dma(isa_fun_t *fun, int dma)
-{
-	size_t count = fun->hw_resources.count;
-	hw_resource_t *resources = fun->hw_resources.resources;
-
-	if (count < ISA_MAX_HW_RES) {
-		if ((dma > 0) && (dma < 4)) {
-			resources[count].type = DMA_CHANNEL_8;
-			resources[count].res.dma_channel.dma8 = dma;
-
-			fun->hw_resources.count++;
-			ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
-			    ddf_fun_get_name(fun->fnode));
-
-			return;
-		}
-
-		if ((dma > 4) && (dma < 8)) {
-			resources[count].type = DMA_CHANNEL_16;
-			resources[count].res.dma_channel.dma16 = dma;
-
-			fun->hw_resources.count++;
-			ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma,
-			    ddf_fun_get_name(fun->fnode));
-
-			return;
-		}
-
-		ddf_msg(LVL_WARN, "Skipped dma 0x%x for function %s", dma,
-		    ddf_fun_get_name(fun->fnode));
-	}
-}
-
-static void isa_fun_add_io_range(isa_fun_t *fun, size_t addr, size_t len)
-{
-	size_t count = fun->hw_resources.count;
-	hw_resource_t *resources = fun->hw_resources.resources;
-
-	isa_bus_t *isa = isa_bus(ddf_fun_get_dev(fun->fnode));
-
-	if (count < ISA_MAX_HW_RES) {
-		resources[count].type = IO_RANGE;
-		resources[count].res.io_range.address = addr;
-		resources[count].res.io_range.address += isa->pio_win.io.base;
-		resources[count].res.io_range.size = len;
-		resources[count].res.io_range.relative = false;
-		resources[count].res.io_range.endianness = LITTLE_ENDIAN;
-
-		fun->hw_resources.count++;
-
-		ddf_msg(LVL_NOTE, "Added io range (addr=0x%x, size=0x%x) to "
-		    "function %s", (unsigned int) addr, (unsigned int) len,
-		    ddf_fun_get_name(fun->fnode));
-	}
-}
-
-static void isa_fun_add_mem_range(isa_fun_t *fun, uintptr_t addr, size_t len)
-{
-	size_t count = fun->hw_resources.count;
-	hw_resource_t *resources = fun->hw_resources.resources;
-
-	isa_bus_t *isa = isa_bus(ddf_fun_get_dev(fun->fnode));
-
-	if (count < ISA_MAX_HW_RES) {
-		resources[count].type = MEM_RANGE;
-		resources[count].res.mem_range.address = addr;
-		resources[count].res.mem_range.address += isa->pio_win.mem.base;
-		resources[count].res.mem_range.size = len;
-		resources[count].res.mem_range.relative = false;
-		resources[count].res.mem_range.endianness = LITTLE_ENDIAN;
-
-		fun->hw_resources.count++;
-
-		ddf_msg(LVL_NOTE, "Added mem range (addr=0x%zx, size=0x%x) to "
-		    "function %s", (uintptr_t) addr, (unsigned int) len,
-		    ddf_fun_get_name(fun->fnode));
-	}
-}
-
-static void fun_parse_irq(isa_fun_t *fun, const char *val)
-{
-	int irq = 0;
-	char *end = NULL;
-
-	val = skip_spaces(val);
-	irq = (int) strtol(val, &end, 10);
-
-	if (val != end)
-		isa_fun_add_irq(fun, irq);
-}
-
-static void fun_parse_dma(isa_fun_t *fun, const char *val)
-{
-	char *end = NULL;
-
-	val = skip_spaces(val);
-	const int dma = strtol(val, &end, 10);
-
-	if (val != end)
-		isa_fun_add_dma(fun, dma);
-}
-
-static void fun_parse_io_range(isa_fun_t *fun, const char *val)
-{
-	size_t addr, len;
-	char *end = NULL;
-
-	val = skip_spaces(val);
-	addr = strtol(val, &end, 0x10);
-
-	if (val == end)
-		return;
-
-	val = skip_spaces(end);
-	len = strtol(val, &end, 0x10);
-
-	if (val == end)
-		return;
-
-	isa_fun_add_io_range(fun, addr, len);
-}
-
-static void fun_parse_mem_range(isa_fun_t *fun, const char *val)
-{
-	uintptr_t addr;
-	size_t len;
-	char *end = NULL;
-
-	val = skip_spaces(val);
-	addr = strtoul(val, &end, 0x10);
-
-	if (val == end)
-		return;
-
-	val = skip_spaces(end);
-	len = strtol(val, &end, 0x10);
-
-	if (val == end)
-		return;
-
-	isa_fun_add_mem_range(fun, addr, len);
-}
-
-static void get_match_id(char **id, const char *val)
-{
-	const char *end = val;
-
-	while (!isspace(*end))
-		end++;
-
-	size_t size = end - val + 1;
-	*id = (char *)malloc(size);
-	str_cpy(*id, size, val);
-}
-
-static void fun_parse_match_id(isa_fun_t *fun, const char *val)
-{
-	char *id = NULL;
-	char *end = NULL;
-
-	val = skip_spaces(val);
-
-	int score = (int)strtol(val, &end, 10);
-	if (val == end) {
-		ddf_msg(LVL_ERROR, "Cannot read match score for function "
-		    "%s.", ddf_fun_get_name(fun->fnode));
-		return;
-	}
-
-	val = skip_spaces(end);
-	get_match_id(&id, val);
-	if (id == NULL) {
-		ddf_msg(LVL_ERROR, "Cannot read match ID for function %s.",
-		    ddf_fun_get_name(fun->fnode));
-		return;
-	}
-
-	ddf_msg(LVL_DEBUG, "Adding match id '%s' with score %d to "
-	    "function %s", id, score, ddf_fun_get_name(fun->fnode));
-
-	errno_t rc = ddf_fun_add_match_id(fun->fnode, id, score);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s",
-		    str_error(rc));
-	}
-
-	free(id);
-}
-
-static bool prop_parse(isa_fun_t *fun, const char *line, const char *prop,
-    void (*read_fn)(isa_fun_t *, const char *))
-{
-	size_t proplen = str_size(prop);
-
-	if (str_lcmp(line, prop, proplen) == 0) {
-		line += proplen;
-		line = skip_spaces(line);
-		(*read_fn)(fun, line);
-
-		return true;
-	}
-
-	return false;
-}
-
-static void fun_prop_parse(isa_fun_t *fun, const char *line)
-{
-	/* Skip leading spaces. */
-	line = skip_spaces(line);
-
-	if (!prop_parse(fun, line, "io_range", &fun_parse_io_range) &&
-	    !prop_parse(fun, line, "mem_range", &fun_parse_mem_range) &&
-	    !prop_parse(fun, line, "irq", &fun_parse_irq) &&
-	    !prop_parse(fun, line, "dma", &fun_parse_dma) &&
-	    !prop_parse(fun, line, "match", &fun_parse_match_id)) {
-
-		ddf_msg(LVL_ERROR, "Undefined device property at line '%s'",
-		    line);
-	}
-}
-
-static char *isa_fun_read_info(char *fun_conf, isa_bus_t *isa)
-{
-	char *line;
-
-	/* Skip empty lines. */
-	do {
-		line = str_get_line(fun_conf, &fun_conf);
-
-		if (line == NULL) {
-			/* no more lines */
-			return NULL;
-		}
-
-	} while (line_empty(line));
-
-	/* Get device name. */
-	const char *fun_name = get_device_name(line);
-	if (fun_name == NULL)
-		return NULL;
-
-	isa_fun_t *fun = isa_fun_create(isa, fun_name);
-	if (fun == NULL) {
-		return NULL;
-	}
-
-	/* Get properties of the device (match ids, irq and io range). */
-	while (true) {
-		line = str_get_line(fun_conf, &fun_conf);
-
-		if (line_empty(line)) {
-			/* no more device properties */
-			break;
-		}
-
-		/*
-		 * Get the device's property from the configuration line
-		 * and store it in the device structure.
-		 */
-		fun_prop_parse(fun, line);
-	}
-
-	/* Set device operations to the device. */
-	ddf_fun_set_ops(fun->fnode, &isa_fun_ops);
-
-	ddf_msg(LVL_DEBUG, "Binding function %s.", ddf_fun_get_name(fun->fnode));
-
-	/* XXX Handle error */
-	(void) ddf_fun_bind(fun->fnode);
-
-	list_append(&fun->bus_link, &isa->functions);
-
-	return fun_conf;
-}
-
-static void isa_functions_add(isa_bus_t *isa)
-{
-#define BASE_CLASS_BRIDGE	0x06
-#define SUB_CLASS_BRIDGE_ISA	0x01
-	bool isa_bridge = ((isa->pci_class == BASE_CLASS_BRIDGE) &&
-	    (isa->pci_subclass == SUB_CLASS_BRIDGE_ISA));
-
-#define VENDOR_ID_SUN	0x108e
-#define DEVICE_ID_EBUS	0x1000
-	bool ebus = ((isa->pci_vendor_id == VENDOR_ID_SUN) &&
-	    (isa->pci_device_id == DEVICE_ID_EBUS));
-
-	const char *conf_path = NULL;
-	if (isa_bridge)
-		conf_path = ISA_CHILD_FUN_CONF_PATH;
-	else if (ebus)
-		conf_path = EBUS_CHILD_FUN_CONF_PATH;
-
-	char *conf = fun_conf_read(conf_path);
-	while (conf != NULL && *conf != '\0') {
-		conf = isa_fun_read_info(conf, isa);
-	}
-	free(conf);
-}
-
-static errno_t isa_read_pci_cfg(isa_bus_t *isa, async_sess_t *sess)
-{
-	errno_t rc;
-
-	rc = pci_config_space_read_16(sess, PCI_VENDOR_ID, &isa->pci_vendor_id);
-	if (rc != EOK)
-		return rc;
-	rc = pci_config_space_read_16(sess, PCI_DEVICE_ID, &isa->pci_device_id);
-	if (rc != EOK)
-		return rc;
-	rc = pci_config_space_read_8(sess, PCI_BASE_CLASS, &isa->pci_class);
-	if (rc != EOK)
-		return rc;
-	rc = pci_config_space_read_8(sess, PCI_SUB_CLASS, &isa->pci_subclass);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t isa_dev_add(ddf_dev_t *dev)
-{
-	async_sess_t *sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d",
-	    (int) ddf_dev_get_handle(dev));
-
-	isa_bus_t *isa = ddf_dev_data_alloc(dev, sizeof(isa_bus_t));
-	if (isa == NULL)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&isa->mutex);
-	isa->dev = dev;
-	list_initialize(&isa->functions);
-
-	sess = ddf_dev_parent_sess_get(dev);
-	if (sess == NULL) {
-		ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
-		    "parent driver.");
-		return ENOENT;
-	}
-
-	rc = isa_read_pci_cfg(isa, sess);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Cannot read PCI config. Assuming ISA classic.");
-		isa->pci_isa_bridge = false;
-		isa->pci_vendor_id = 0;
-		isa->pci_device_id = 0;
-		isa->pci_class = BASE_CLASS_BRIDGE;
-		isa->pci_subclass = SUB_CLASS_BRIDGE_ISA;
-	} else {
-		ddf_msg(LVL_NOTE, "ISA Bridge");
-		isa->pci_isa_bridge = true;
-	}
-
-	rc = pio_window_get(sess, &isa->pio_win);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "isa_dev_add failed to get PIO window "
-		    "for the device.");
-		return rc;
-	}
-
-	/* Make the bus device more visible. Does not do anything. */
-	ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
-
-	fibril_mutex_lock(&isa->mutex);
-
-	isa->fctl = ddf_fun_create(dev, fun_exposed, "ctl");
-	if (isa->fctl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating control function.");
-		return EXDEV;
-	}
-
-	if (ddf_fun_bind(isa->fctl) != EOK) {
-		ddf_fun_destroy(isa->fctl);
-		ddf_msg(LVL_ERROR, "Failed binding control function.");
-		return EXDEV;
-	}
-
-	/* Add functions as specified in the configuration file. */
-	isa_functions_add(isa);
-	ddf_msg(LVL_NOTE, "Finished enumerating legacy functions");
-
-	fibril_mutex_unlock(&isa->mutex);
-
-	return EOK;
-}
-
-static errno_t isa_dev_remove(ddf_dev_t *dev)
-{
-	isa_bus_t *isa = isa_bus(dev);
-
-	fibril_mutex_lock(&isa->mutex);
-
-	while (!list_empty(&isa->functions)) {
-		isa_fun_t *fun = list_get_instance(list_first(&isa->functions),
-		    isa_fun_t, bus_link);
-
-		errno_t rc = ddf_fun_offline(fun->fnode);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&isa->mutex);
-			ddf_msg(LVL_ERROR, "Failed offlining %s", ddf_fun_get_name(fun->fnode));
-			return rc;
-		}
-
-		rc = ddf_fun_unbind(fun->fnode);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&isa->mutex);
-			ddf_msg(LVL_ERROR, "Failed unbinding %s", ddf_fun_get_name(fun->fnode));
-			return rc;
-		}
-
-		list_remove(&fun->bus_link);
-
-		ddf_fun_destroy(fun->fnode);
-	}
-
-	if (ddf_fun_unbind(isa->fctl) != EOK) {
-		fibril_mutex_unlock(&isa->mutex);
-		ddf_msg(LVL_ERROR, "Failed unbinding control function.");
-		return EXDEV;
-	}
-
-	fibril_mutex_unlock(&isa->mutex);
-
-	return EOK;
-}
-
-static errno_t isa_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "isa_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t isa_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "isa_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS ISA bus driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&isa_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/isa/isa.dev
===================================================================
--- uspace/drv/bus/isa/isa.dev	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-i8259:
-	match 100 isa/i8259
-	mem_range 0x20 2
-	mem_range 0xa0 2
-
-apic:
-	match 100 isa/apic
-	mem_range 0xfec00000 0x14
-
-com1:
-	match 100 isa/ns8250
-	irq 4
-	io_range 3f8 8
-
-com2:
-	match 100 isa/ns8250
-	irq 3
-	io_range 2f8 8
-
-lpt1:
-	match 100 isa/lpt
-	io_range 378 8
-	irq 7
-
-lpt2:
-	match 100 isa/lpt
-	io_range 278 8
-	irq 5
-
-i8042:
-	match 100 isa/i8042
-	irq 1
-	irq 12
-	io_range 060 5
-
-ne2k:
-	match 100 isa/ne2k
-	irq 5
-	io_range 300 20
-
-sb16:
-	match 100 isa/sb16
-	io_range 220 20
-	io_range 330 2
-	irq 5
-	dma 1
-	dma 5
-
-cmos-rtc:
-	match 100 isa/cmos-rtc
-	io_range 70 2
-
-fdc:
-	match 100 isa/fdc
-	io_range 0x3f0 8
-	irq 6
-	dma 2
-
-ide1:
-	match 100 isa/ide
-	io_range 0x1f0 8
-	io_range 0x3f0 8
-	io_range 0x170 8
-	io_range 0x370 8
-	irq 14
-	irq 15
Index: pace/drv/bus/isa/isa.ma
===================================================================
--- uspace/drv/bus/isa/isa.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-# Classic ISA
-10 isa
-
-# ISA bridge
-10 pci/class=06&subclass=01
-
-# EBUS
-1 pci/ven=108e&dev=1000
Index: pace/drv/bus/isa/meson.build
===================================================================
--- uspace/drv/bus/isa/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('i8237.c', 'isa.c')
-
-installed_data += [
-	{ 'name': 'ebus.dev', 'dir': 'drv/isa' },
-	{ 'name': 'isa.dev', 'dir': 'drv/isa' },
-]
Index: pace/drv/bus/pci/pciintel/ctl.c
===================================================================
--- uspace/drv/bus/pci/pciintel/ctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup pciintel
- * @{
- */
-
-/** @file
- */
-
-#include <async.h>
-#include <ddf/log.h>
-#include <ipc/pci.h>
-#include <macros.h>
-#include <types/pci.h>
-#include "ctl.h"
-#include "pci.h"
-
-static void pci_ctl_get_devices_srv(pci_bus_t *, ipc_call_t *);
-static void pci_ctl_dev_get_info_srv(pci_bus_t *, ipc_call_t *);
-static errno_t pci_ctl_get_devices(pci_bus_t *, devman_handle_t *, size_t,
-    size_t *);
-static errno_t pci_ctl_dev_get_info(pci_fun_t *, pci_dev_info_t *);
-
-/** Handle control service connection */
-void pci_ctl_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	pci_bus_t *bus;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	bus = pci_bus(ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	while (true) {
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call))
-			break;
-
-		switch (ipc_get_imethod(&call)) {
-		case PCI_GET_DEVICES:
-			pci_ctl_get_devices_srv(bus, &call);
-			break;
-		case PCI_DEV_GET_INFO:
-			pci_ctl_dev_get_info_srv(bus, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Handle request to get list of PCI devices.
- *
- * @param bus PCI bus
- * @param call Async request
- */
-static void pci_ctl_get_devices_srv(pci_bus_t *bus, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	devman_handle_t *buf;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if ((size % sizeof(devman_handle_t)) != 0) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	buf = malloc(max(1, size));
-	if (buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = pci_ctl_get_devices(bus, buf, size, &act_size);
-	if (rc != EOK) {
-		free(buf);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, buf, size);
-
-	free(buf);
-	async_answer_1(icall, retval, act_size);
-}
-
-/** Handle request to get PCI device information.
- *
- * @param bus PCI bus
- * @param call Async request
- */
-static void pci_ctl_dev_get_info_srv(pci_bus_t *bus, ipc_call_t *icall)
-{
-	devman_handle_t dev_handle;
-	pci_fun_t *fun;
-	pci_dev_info_t info;
-	errno_t rc;
-
-	dev_handle = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "pci_dev_get_info_srv(%zu)",
-	    dev_handle);
-	fun = pci_fun_first(bus);
-	while (fun != NULL) {
-		if (ddf_fun_get_handle(fun->fnode) == dev_handle)
-			break;
-
-		fun = pci_fun_next(fun);
-	}
-
-	if (fun == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "pci_dev_get_info_srv: "
-		    "device %zu not found", dev_handle);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "pci_dev_get_info_srv: "
-	    "vol_volume_get_info");
-	rc = pci_ctl_dev_get_info(fun, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(pci_dev_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &info,
-	    min(size, sizeof(info)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** Get list of PCI devices.
- *
- * @param bus PCI bus
- * @param call Async request
- */
-static errno_t pci_ctl_get_devices(pci_bus_t *bus, devman_handle_t *id_buf,
-    size_t size, size_t *act_size)
-{
-	pci_fun_t *fun;
-	size_t cnt;
-
-	ddf_msg(LVL_NOTE, "pci_ctl_get_devices(%p, %p, %zu, %p)\n",
-	    bus, id_buf, size, act_size);
-
-	fun = pci_fun_first(bus);
-	cnt = 0;
-	while (fun != NULL) {
-		if (sizeof(devman_handle_t) * cnt < size)
-			id_buf[cnt] = ddf_fun_get_handle(fun->fnode);
-		++cnt;
-		fun = pci_fun_next(fun);
-	}
-
-	*act_size = sizeof(devman_handle_t) * cnt;
-	return EOK;
-}
-
-/** Get PCI device information.
- *
- * @param fun PCI function
- * @param info Place to store information
- *
- * @return EOK on success or an error code
- */
-static errno_t pci_ctl_dev_get_info(pci_fun_t *fun, pci_dev_info_t *info)
-{
-	info->dev_handle = ddf_fun_get_handle(fun->fnode);
-	info->bus_num = fun->bus;
-	info->dev_num = fun->dev;
-	info->fn_num = fun->fn;
-	info->vendor_id = fun->vendor_id;
-	info->device_id = fun->device_id;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/pci/pciintel/ctl.h
===================================================================
--- uspace/drv/bus/pci/pciintel/ctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pciintel
- * @{
- */
-/** @file
- */
-
-#ifndef CTL_H_
-#define CTL_H_
-
-#include <async.h>
-
-extern void pci_ctl_connection(ipc_call_t *icall, void *arg);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/pci/pciintel/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/pci/pciintel/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pciintel pciintel
- * @brief PCI bus driver
- * @ingroup drvs
- */
Index: pace/drv/bus/pci/pciintel/meson.build
===================================================================
--- uspace/drv/bus/pci/pciintel/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('ctl.c', 'pci.c')
Index: pace/drv/bus/pci/pciintel/pci.c
===================================================================
--- uspace/drv/bus/pci/pciintel/pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1072 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup pciintel
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <byteorder.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-#include <str_error.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ipc/dev_iface.h>
-#include <irc.h>
-#include <ops/hw_res.h>
-#include <device/hw_res.h>
-#include <ops/pio_window.h>
-#include <device/pio_window.h>
-#include <ddi.h>
-#include <pci_dev_iface.h>
-
-#include "ctl.h"
-#include "pci.h"
-#include "pci_regs.h"
-
-#define NAME "pciintel"
-
-#define CONF_ADDR_ENABLE	(((unsigned)1) << 31)
-#define CONF_ADDR(bus, dev, fn, reg) \
-	((bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
-
-/** Obtain PCI function soft-state from DDF function node */
-static pci_fun_t *pci_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-/** Obtain PCI bus soft-state from DDF device node */
-pci_bus_t *pci_bus(ddf_dev_t *dnode)
-{
-	return ddf_dev_data_get(dnode);
-}
-
-/** Obtain PCI bus soft-state from function soft-state */
-static pci_bus_t *pci_bus_from_fun(pci_fun_t *fun)
-{
-	return fun->busptr;
-}
-
-/** Max is 47, align to something nice. */
-#define ID_MAX_STR_LEN 50
-
-static hw_resource_list_t *pciintel_get_resources(ddf_fun_t *fnode)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-
-	if (fun == NULL)
-		return NULL;
-	return &fun->hw_resources;
-}
-
-static bool pciintel_fun_owns_interrupt(pci_fun_t *fun, int irq)
-{
-	size_t i;
-	hw_resource_list_t *res = &fun->hw_resources;
-
-	for (i = 0; i < res->count; i++) {
-		if (res->resources[i].type == INTERRUPT &&
-		    res->resources[i].res.interrupt.irq == irq) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-static errno_t pciintel_enable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-
-	if (!pciintel_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_enable_interrupt(irq);
-}
-
-static errno_t pciintel_disable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-
-	if (!pciintel_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_disable_interrupt(irq);
-}
-
-static errno_t pciintel_clear_interrupt(ddf_fun_t *fnode, int irq)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-
-	if (!pciintel_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_clear_interrupt(irq);
-}
-
-/** Handle legacy IO availability query from function.
- *
- * @param fnode Function performing the query
- * @param rclaims Place to store the legacy IO claims bitmask
- * @return EOK on success or an error code
- */
-static errno_t pciintel_query_legacy_io(ddf_fun_t *fnode,
-    hw_res_claims_t *rclaims)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-	pci_bus_t *bus = fun->busptr;
-	pci_fun_t *f;
-	hw_res_claims_t claims;
-
-	/*
-	 * We need to wait for enumeration to complete so that we give
-	 * the PCI IDE driver a chance to claim the legacy ISA IDE
-	 * ranges.
-	 */
-	ddf_msg(LVL_DEBUG, "pciintel_query_legacy_io");
-
-	fun->querying = true;
-
-	fibril_mutex_lock(&bus->enum_done_lock);
-	while (!bus->enum_done)
-		fibril_condvar_wait(&bus->enum_done_cv, &bus->enum_done_lock);
-	fibril_mutex_unlock(&bus->enum_done_lock);
-
-	ddf_msg(LVL_DEBUG, "Wait for PCI devices to stabilize");
-
-	f = pci_fun_first(bus);
-	while (f != NULL) {
-		if (!f->querying)
-			ddf_fun_wait_stable(f->fnode);
-		f = pci_fun_next(f);
-	}
-
-	/* Devices are stable. Now we can determine if ISA IDE was claimed. */
-
-	claims = 0;
-
-	ddf_msg(LVL_DEBUG, "PCI devices stabilized, leg_ide_claimed=%d\n",
-	    (int)bus->leg_ide_claimed);
-	if (bus->leg_ide_claimed != false) {
-		ddf_msg(LVL_NOTE, "Legacy IDE I/O ports claimed by PCI driver.");
-		claims |= hwc_isa_ide;
-	}
-
-	fun->querying = false;
-	*rclaims = claims;
-	return EOK;
-}
-
-/** Handle legacy IO claim from function.
- *
- * @param fnode Function claiming the legacy I/O ports
- * @param claims Bitmask of claimed I/O
- * @return EOK on success or an error code
- */
-static errno_t pciintel_claim_legacy_io(ddf_fun_t *fnode,
-    hw_res_claims_t claims)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-	pci_bus_t *bus = fun->busptr;
-
-	ddf_msg(LVL_DEBUG, "pciintel_claim_legacy_io() claims=%x", claims);
-	if ((claims & hwc_isa_ide) != 0)
-		bus->leg_ide_claimed = true;
-
-	return EOK;
-}
-
-static pio_window_t *pciintel_get_pio_window(ddf_fun_t *fnode)
-{
-	pci_fun_t *fun = pci_fun(fnode);
-
-	if (fun == NULL)
-		return NULL;
-	return &fun->pio_window;
-}
-
-static errno_t config_space_write_32(ddf_fun_t *fun, uint32_t address,
-    uint32_t data)
-{
-	if (address > 252)
-		return EINVAL;
-	pci_conf_write_32(pci_fun(fun), address, data);
-	return EOK;
-}
-
-static errno_t config_space_write_16(
-    ddf_fun_t *fun, uint32_t address, uint16_t data)
-{
-	if (address > 254)
-		return EINVAL;
-	pci_conf_write_16(pci_fun(fun), address, data);
-	return EOK;
-}
-
-static errno_t config_space_write_8(
-    ddf_fun_t *fun, uint32_t address, uint8_t data)
-{
-	if (address > 255)
-		return EINVAL;
-	pci_conf_write_8(pci_fun(fun), address, data);
-	return EOK;
-}
-
-static errno_t config_space_read_32(
-    ddf_fun_t *fun, uint32_t address, uint32_t *data)
-{
-	if (address > 252)
-		return EINVAL;
-	*data = pci_conf_read_32(pci_fun(fun), address);
-	return EOK;
-}
-
-static errno_t config_space_read_16(
-    ddf_fun_t *fun, uint32_t address, uint16_t *data)
-{
-	if (address > 254)
-		return EINVAL;
-	*data = pci_conf_read_16(pci_fun(fun), address);
-	return EOK;
-}
-
-static errno_t config_space_read_8(
-    ddf_fun_t *fun, uint32_t address, uint8_t *data)
-{
-	if (address > 255)
-		return EINVAL;
-	*data = pci_conf_read_8(pci_fun(fun), address);
-	return EOK;
-}
-
-static hw_res_ops_t pciintel_hw_res_ops = {
-	.get_resource_list = &pciintel_get_resources,
-	.enable_interrupt = &pciintel_enable_interrupt,
-	.disable_interrupt = &pciintel_disable_interrupt,
-	.clear_interrupt = &pciintel_clear_interrupt,
-	.query_legacy_io = &pciintel_query_legacy_io,
-	.claim_legacy_io = &pciintel_claim_legacy_io
-};
-
-static pio_window_ops_t pciintel_pio_window_ops = {
-	.get_pio_window = &pciintel_get_pio_window
-};
-
-static pci_dev_iface_t pci_dev_ops = {
-	.config_space_read_8 = &config_space_read_8,
-	.config_space_read_16 = &config_space_read_16,
-	.config_space_read_32 = &config_space_read_32,
-	.config_space_write_8 = &config_space_write_8,
-	.config_space_write_16 = &config_space_write_16,
-	.config_space_write_32 = &config_space_write_32
-};
-
-static ddf_dev_ops_t pci_fun_ops = {
-	.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops,
-	.interfaces[PIO_WINDOW_DEV_IFACE] = &pciintel_pio_window_ops,
-	.interfaces[PCI_DEV_IFACE] = &pci_dev_ops
-};
-
-static errno_t pci_dev_add(ddf_dev_t *);
-static errno_t pci_fun_online(ddf_fun_t *);
-static errno_t pci_fun_offline(ddf_fun_t *);
-
-/** PCI bus driver standard operations */
-static driver_ops_t pci_ops = {
-	.dev_add = &pci_dev_add,
-	.fun_online = &pci_fun_online,
-	.fun_offline = &pci_fun_offline,
-};
-
-/** PCI bus driver structure */
-static driver_t pci_driver = {
-	.name = NAME,
-	.driver_ops = &pci_ops
-};
-
-static void pci_conf_read(pci_fun_t *fun, int reg, uint8_t *buf, size_t len)
-{
-	const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg);
-	pci_bus_t *bus = pci_bus_from_fun(fun);
-	uint32_t val;
-
-	fibril_mutex_lock(&bus->conf_mutex);
-
-	if (bus->conf_addr_reg) {
-		pio_write_32(bus->conf_addr_reg,
-		    host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
-		/*
-		 * Always read full 32-bits from the PCI conf_data_port
-		 * register and get the desired portion of it afterwards. Some
-		 * architectures do not support shorter PIO reads offset from
-		 * this register.
-		 */
-		val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
-	} else {
-		val = uint32_t_le2host(pio_read_32(
-		    &bus->conf_space[conf_addr / sizeof(ioport32_t)]));
-	}
-
-	switch (len) {
-	case 1:
-		*buf = (uint8_t) (val >> ((reg & 3) * 8));
-		break;
-	case 2:
-		*((uint16_t *) buf) = (uint16_t) (val >> ((reg & 3)) * 8);
-		break;
-	case 4:
-		*((uint32_t *) buf) = (uint32_t) val;
-		break;
-	}
-
-	fibril_mutex_unlock(&bus->conf_mutex);
-}
-
-static void pci_conf_write(pci_fun_t *fun, int reg, uint8_t *buf, size_t len)
-{
-	const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg);
-	pci_bus_t *bus = pci_bus_from_fun(fun);
-	uint32_t val = 0;
-
-	fibril_mutex_lock(&bus->conf_mutex);
-
-	/*
-	 * Prepare to write full 32-bits to the PCI conf_data_port register.
-	 * Some architectures do not support shorter PIO writes offset from this
-	 * register.
-	 */
-
-	if (len < 4) {
-		/*
-		 * We have fewer than full 32-bits, so we need to read the
-		 * missing bits first.
-		 */
-		if (bus->conf_addr_reg) {
-			pio_write_32(bus->conf_addr_reg,
-			    host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
-			val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
-		} else {
-			val = uint32_t_le2host(pio_read_32(
-			    &bus->conf_space[conf_addr / sizeof(ioport32_t)]));
-		}
-	}
-
-	switch (len) {
-	case 1:
-		val &= ~(0xffU << ((reg & 3) * 8));
-		val |= *buf << ((reg & 3) * 8);
-		break;
-	case 2:
-		val &= ~(0xffffU << ((reg & 3) * 8));
-		val |= *((uint16_t *) buf) << ((reg & 3) * 8);
-		break;
-	case 4:
-		val = *((uint32_t *) buf);
-		break;
-	}
-
-	if (bus->conf_addr_reg) {
-		pio_write_32(bus->conf_addr_reg,
-		    host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
-		pio_write_32(bus->conf_data_reg, host2uint32_t_le(val));
-	} else {
-		pio_write_32(&bus->conf_space[conf_addr / sizeof(ioport32_t)],
-		    host2uint32_t_le(val));
-	}
-
-	fibril_mutex_unlock(&bus->conf_mutex);
-}
-
-uint8_t pci_conf_read_8(pci_fun_t *fun, int reg)
-{
-	uint8_t res;
-	pci_conf_read(fun, reg, &res, 1);
-	return res;
-}
-
-uint16_t pci_conf_read_16(pci_fun_t *fun, int reg)
-{
-	uint16_t res;
-	pci_conf_read(fun, reg, (uint8_t *) &res, 2);
-	return res;
-}
-
-uint32_t pci_conf_read_32(pci_fun_t *fun, int reg)
-{
-	uint32_t res;
-	pci_conf_read(fun, reg, (uint8_t *) &res, 4);
-	return res;
-}
-
-void pci_conf_write_8(pci_fun_t *fun, int reg, uint8_t val)
-{
-	pci_conf_write(fun, reg, (uint8_t *) &val, 1);
-}
-
-void pci_conf_write_16(pci_fun_t *fun, int reg, uint16_t val)
-{
-	pci_conf_write(fun, reg, (uint8_t *) &val, 2);
-}
-
-void pci_conf_write_32(pci_fun_t *fun, int reg, uint32_t val)
-{
-	pci_conf_write(fun, reg, (uint8_t *) &val, 4);
-}
-
-void pci_fun_create_match_ids(pci_fun_t *fun)
-{
-	errno_t rc;
-	int ret;
-	char match_id_str[ID_MAX_STR_LEN];
-
-	/* Vendor ID & Device ID, length(incl \0) 22 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/ven=%04"
-	    PRIx16 "&dev=%04" PRIx16, fun->vendor_id, fun->device_id);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
-	}
-
-	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 90);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s", str_error(rc));
-	}
-
-	/* Class, subclass, prog IF, revision, length(incl \0) 47 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
-	    "pci/class=%02x&subclass=%02x&progif=%02x&revision=%02x",
-	    fun->class_code, fun->subclass_code, fun->prog_if, fun->revision);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
-	}
-
-	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 70);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s", str_error(rc));
-	}
-
-	/* Class, subclass, prog IF, length(incl \0) 35 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
-	    "pci/class=%02x&subclass=%02x&progif=%02x",
-	    fun->class_code, fun->subclass_code, fun->prog_if);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
-	}
-
-	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 60);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s", str_error(rc));
-	}
-
-	/* Class, subclass, length(incl \0) 25 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN,
-	    "pci/class=%02x&subclass=%02x",
-	    fun->class_code, fun->subclass_code);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
-	}
-
-	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 50);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s", str_error(rc));
-	}
-
-	/* Class, length(incl \0) 13 */
-	ret = snprintf(match_id_str, ID_MAX_STR_LEN, "pci/class=%02x",
-	    fun->class_code);
-	if (ret < 0) {
-		ddf_msg(LVL_ERROR, "Failed creating match ID str");
-	}
-
-	rc = ddf_fun_add_match_id(fun->fnode, match_id_str, 40);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match ID: %s", str_error(rc));
-	}
-
-	/* TODO add subsys ids, but those exist only in header type 0 */
-}
-
-/** Get first PCI function.
- *
- * @param bus PCI bus
- * @return First PCI function on @a bus or @c NULL if there is none
- */
-pci_fun_t *pci_fun_first(pci_bus_t *bus)
-{
-	link_t *link;
-
-	link = list_first(&bus->funs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, pci_fun_t, lfuns);
-}
-
-/** Get next PCI function.
- *
- * @param cur Current function
- * @return Next PCI function on the same bus or @c NULL if there is none
- */
-pci_fun_t *pci_fun_next(pci_fun_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lfuns, &cur->busptr->funs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, pci_fun_t, lfuns);
-}
-
-void pci_add_range(pci_fun_t *fun, uint64_t range_addr, size_t range_size,
-    bool io)
-{
-	hw_resource_list_t *hw_res_list = &fun->hw_resources;
-	hw_resource_t *hw_resources =  hw_res_list->resources;
-	size_t count = hw_res_list->count;
-
-	assert(hw_resources != NULL);
-	assert(count < PCI_MAX_HW_RES);
-
-	if (io) {
-		hw_resources[count].type = IO_RANGE;
-		hw_resources[count].res.io_range.address = range_addr;
-		hw_resources[count].res.io_range.size = range_size;
-		hw_resources[count].res.io_range.relative = true;
-		hw_resources[count].res.io_range.endianness = LITTLE_ENDIAN;
-	} else {
-		hw_resources[count].type = MEM_RANGE;
-		hw_resources[count].res.mem_range.address = range_addr;
-		hw_resources[count].res.mem_range.size = range_size;
-		hw_resources[count].res.mem_range.relative = false;
-		hw_resources[count].res.mem_range.endianness = LITTLE_ENDIAN;
-	}
-
-	hw_res_list->count++;
-}
-
-/** Read the base address register (BAR) of the device and if it contains valid
- * address add it to the devices hw resource list.
- *
- * @param fun	PCI function
- * @param addr	The address of the BAR in the PCI configuration address space of
- *		the device
- * @return	The addr the address of the BAR which should be read next
- */
-int pci_read_bar(pci_fun_t *fun, int addr)
-{
-	/* Value of the BAR */
-	uint32_t val;
-	uint32_t bar;
-	uint32_t mask;
-
-	/* IO space address */
-	bool io;
-	/* 64-bit wide address */
-	bool addrw64;
-
-	/* Size of the io or memory range specified by the BAR */
-	size_t range_size;
-	/* Beginning of the io or memory range specified by the BAR */
-	uint64_t range_addr;
-
-	/* Get the value of the BAR. */
-	val = pci_conf_read_32(fun, addr);
-
-#define IO_MASK  (~0x3)
-#define MEM_MASK (~0xf)
-
-	io = (val & 1) != 0;
-	if (io) {
-		addrw64 = false;
-		mask = IO_MASK;
-	} else {
-		mask = MEM_MASK;
-		switch ((val >> 1) & 3) {
-		case 0:
-			addrw64 = false;
-			break;
-		case 2:
-			addrw64 = true;
-			break;
-		default:
-			/* reserved, go to the next BAR */
-			return addr + 4;
-		}
-	}
-
-	/* Get the address mask. */
-	pci_conf_write_32(fun, addr, 0xffffffff);
-	bar = pci_conf_read_32(fun, addr);
-
-	/*
-	 * Unimplemented BARs read back as all 0's.
-	 */
-	if (!bar)
-		return addr + (addrw64 ? 8 : 4);
-
-	mask &= bar;
-
-	/* Restore the original value. */
-	pci_conf_write_32(fun, addr, val);
-	val = pci_conf_read_32(fun, addr);
-
-	range_size = pci_bar_mask_to_size(mask);
-
-	if (addrw64) {
-		range_addr = ((uint64_t)pci_conf_read_32(fun, addr + 4) << 32) |
-		    (val & 0xfffffff0);
-	} else {
-		range_addr = (val & 0xfffffff0);
-	}
-
-	if (range_addr != 0) {
-		ddf_msg(LVL_DEBUG, "Function %s : address = %" PRIx64
-		    ", size = %x", ddf_fun_get_name(fun->fnode), range_addr,
-		    (unsigned int) range_size);
-	}
-
-	pci_add_range(fun, range_addr, range_size, io);
-
-	if (addrw64)
-		return addr + 8;
-
-	return addr + 4;
-}
-
-void pci_add_interrupt(pci_fun_t *fun, int irq)
-{
-	hw_resource_list_t *hw_res_list = &fun->hw_resources;
-	hw_resource_t *hw_resources = hw_res_list->resources;
-	size_t count = hw_res_list->count;
-
-	assert(NULL != hw_resources);
-	assert(count < PCI_MAX_HW_RES);
-
-	hw_resources[count].type = INTERRUPT;
-	hw_resources[count].res.interrupt.irq = irq;
-
-	hw_res_list->count++;
-
-	ddf_msg(LVL_NOTE, "Function %s uses irq %x.", ddf_fun_get_name(fun->fnode), irq);
-}
-
-void pci_read_interrupt(pci_fun_t *fun)
-{
-	uint8_t irq = pci_conf_read_8(fun, PCI_BRIDGE_INT_LINE);
-	uint8_t pin = pci_conf_read_8(fun, PCI_BRIDGE_INT_PIN);
-
-	if (pin != 0 && irq != 0xff)
-		pci_add_interrupt(fun, irq);
-}
-
-/** Enumerate (recursively) and register the devices connected to a pci bus.
- *
- * @param bus		Host-to-PCI bridge
- * @param bus_num	Bus number
- *
- * @return EOK on success, ENOENT if no PCI devices found, ENOMEM if out of
- *         memory, EIO on other I/O error
- */
-errno_t pci_bus_scan(pci_bus_t *bus, int bus_num)
-{
-	pci_fun_t *fun;
-	errno_t rc;
-
-	int child_bus = 0;
-	int dnum, fnum;
-	bool multi;
-	uint8_t header_type;
-	bool device_found;
-
-	device_found = false;
-
-	for (dnum = 0; dnum < 32; dnum++) {
-		multi = true;
-		for (fnum = 0; multi && fnum < 8; fnum++) {
-			fun = pci_fun_new(bus);
-
-			pci_fun_init(fun, bus_num, dnum, fnum);
-			if (fun->vendor_id == 0xffff) {
-				pci_fun_delete(fun);
-				/*
-				 * The device is not present, go on scanning the
-				 * bus.
-				 */
-				if (fnum == 0)
-					break;
-				else
-					continue;
-			}
-
-			device_found = true;
-
-			header_type = pci_conf_read_8(fun, PCI_HEADER_TYPE);
-			if (fnum == 0) {
-				/* Is the device multifunction? */
-				multi = header_type >> 7;
-			}
-			/* Clear the multifunction bit. */
-			header_type = header_type & 0x7F;
-
-			char *fun_name = pci_fun_create_name(fun);
-			if (fun_name == NULL) {
-				ddf_msg(LVL_ERROR, "Out of memory.");
-				pci_fun_delete(fun);
-				return ENOMEM;
-			}
-
-			rc = ddf_fun_set_name(fun->fnode, fun_name);
-			free(fun_name);
-			if (rc != EOK) {
-				ddf_msg(LVL_ERROR, "Failed setting function name.");
-				pci_fun_delete(fun);
-				return EIO;
-			}
-
-			pci_alloc_resource_list(fun);
-			pci_read_bars(fun);
-			pci_read_interrupt(fun);
-
-			/* Propagate the PIO window to the function. */
-			fun->pio_window = bus->pio_win;
-
-			ddf_fun_set_ops(fun->fnode, &pci_fun_ops);
-
-			ddf_msg(LVL_DEBUG, "Adding new function %s.",
-			    ddf_fun_get_name(fun->fnode));
-
-			pci_fun_create_match_ids(fun);
-
-			if (header_type == PCI_HEADER_TYPE_BRIDGE ||
-			    header_type == PCI_HEADER_TYPE_CARDBUS) {
-				child_bus = pci_conf_read_8(fun,
-				    PCI_BRIDGE_SEC_BUS_NUM);
-				ddf_msg(LVL_DEBUG, "Device is pci-to-pci "
-				    "bridge, secondary bus number = %d.",
-				    bus_num);
-				if (child_bus > bus_num) {
-					rc = pci_bus_scan(bus, child_bus);
-					if (rc != EOK && rc != ENOENT) {
-						pci_fun_delete(fun);
-						return rc;
-					}
-				}
-			}
-
-			if (ddf_fun_bind(fun->fnode) != EOK) {
-				pci_clean_resource_list(fun);
-				pci_fun_delete(fun);
-				continue;
-			}
-
-			list_append(&fun->lfuns, &bus->funs);
-		}
-	}
-
-	/* Fail bus scan if no devices are found. */
-	if (!device_found)
-		return ENOENT;
-
-	return EOK;
-}
-
-static errno_t pci_dev_add(ddf_dev_t *dnode)
-{
-	hw_resource_list_t hw_resources;
-	pci_bus_t *bus = NULL;
-	ddf_fun_t *ctl = NULL;
-	bool got_res = false;
-	async_sess_t *sess;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pci_dev_add");
-
-	bus = ddf_dev_data_alloc(dnode, sizeof(pci_bus_t));
-	if (bus == NULL) {
-		ddf_msg(LVL_ERROR, "pci_dev_add allocation failed.");
-		rc = ENOMEM;
-		goto fail;
-	}
-
-	list_initialize(&bus->funs);
-	fibril_mutex_initialize(&bus->conf_mutex);
-	fibril_mutex_initialize(&bus->enum_done_lock);
-	fibril_condvar_initialize(&bus->enum_done_cv);
-
-	bus->dnode = dnode;
-
-	sess = ddf_dev_parent_sess_get(dnode);
-	if (sess == NULL) {
-		ddf_msg(LVL_ERROR, "pci_dev_add failed to connect to the "
-		    "parent driver.");
-		rc = ENOENT;
-		goto fail;
-	}
-
-	rc = pio_window_get(sess, &bus->pio_win);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "pci_dev_add failed to get PIO window "
-		    "for the device.");
-		goto fail;
-	}
-
-	rc = hw_res_get_resource_list(sess, &hw_resources);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "pci_dev_add failed to get hw resources "
-		    "for the device.");
-		goto fail;
-	}
-	got_res = true;
-
-	assert(hw_resources.count >= 1);
-
-	if (hw_resources.count == 1) {
-		assert(hw_resources.resources[0].type == MEM_RANGE);
-
-		ddf_msg(LVL_DEBUG, "conf_addr_space = %" PRIx64 ".",
-		    hw_resources.resources[0].res.mem_range.address);
-
-		if (pio_enable_resource(&bus->pio_win,
-		    &hw_resources.resources[0], (void **) &bus->conf_space,
-		    NULL, NULL)) {
-			ddf_msg(LVL_ERROR,
-			    "Failed to map configuration space.");
-			rc = EADDRNOTAVAIL;
-			goto fail;
-		}
-
-	} else {
-		assert(hw_resources.resources[0].type == IO_RANGE);
-		assert(hw_resources.resources[0].res.io_range.size >= 4);
-
-		assert(hw_resources.resources[1].type == IO_RANGE);
-		assert(hw_resources.resources[1].res.io_range.size >= 4);
-
-		ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
-		    hw_resources.resources[0].res.io_range.address);
-		ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".",
-		    hw_resources.resources[1].res.io_range.address);
-
-		if (pio_enable_resource(&bus->pio_win,
-		    &hw_resources.resources[0], (void **) &bus->conf_addr_reg,
-		    NULL, NULL)) {
-			ddf_msg(LVL_ERROR,
-			    "Failed to enable configuration ports.");
-			rc = EADDRNOTAVAIL;
-			goto fail;
-		}
-		if (pio_enable_resource(&bus->pio_win,
-		    &hw_resources.resources[1], (void **) &bus->conf_data_reg,
-		    NULL, NULL)) {
-			ddf_msg(LVL_ERROR,
-			    "Failed to enable configuration ports.");
-			rc = EADDRNOTAVAIL;
-			goto fail;
-		}
-	}
-
-	/* Make the bus device more visible. It has no use yet. */
-	ddf_msg(LVL_DEBUG, "Adding a 'ctl' function");
-
-	ctl = ddf_fun_create(bus->dnode, fun_exposed, "ctl");
-	if (ctl == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating control function.");
-		rc = ENOMEM;
-		goto fail;
-	}
-
-	ddf_fun_set_conn_handler(ctl, pci_ctl_connection);
-
-	/* Enumerate functions. */
-	ddf_msg(LVL_DEBUG, "Enumerating the bus");
-	rc = pci_bus_scan(bus, 0);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Bus enumeration failed.");
-		goto fail;
-	}
-
-	rc = ddf_fun_bind(ctl);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding control function.");
-		goto fail;
-	}
-
-	rc = ddf_fun_add_to_category(ctl, "pci");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding control function to category "
-		    "'pci'.");
-		goto fail;
-	}
-
-	hw_res_clean_resource_list(&hw_resources);
-
-	ddf_msg(LVL_DEBUG, "Bus enumeration done.");
-
-	fibril_mutex_lock(&bus->enum_done_lock);
-	bus->enum_done = true;
-	fibril_mutex_unlock(&bus->enum_done_lock);
-	fibril_condvar_broadcast(&bus->enum_done_cv);
-
-	return EOK;
-fail:
-	if (got_res)
-		hw_res_clean_resource_list(&hw_resources);
-
-	if (ctl != NULL)
-		ddf_fun_destroy(ctl);
-
-	return rc;
-}
-
-static errno_t pci_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pci_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t pci_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pci_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-static void pciintel_init(void)
-{
-	ddf_log_init(NAME);
-}
-
-pci_fun_t *pci_fun_new(pci_bus_t *bus)
-{
-	pci_fun_t *fun;
-	ddf_fun_t *fnode;
-
-	fnode = ddf_fun_create(bus->dnode, fun_inner, NULL);
-	if (fnode == NULL)
-		return NULL;
-
-	fun = ddf_fun_data_alloc(fnode, sizeof(pci_fun_t));
-	if (fun == NULL)
-		return NULL;
-
-	fun->busptr = bus;
-	fun->fnode = fnode;
-	return fun;
-}
-
-void pci_fun_init(pci_fun_t *fun, int bus, int dev, int fn)
-{
-	fun->bus = bus;
-	fun->dev = dev;
-	fun->fn = fn;
-	fun->vendor_id = pci_conf_read_16(fun, PCI_VENDOR_ID);
-	fun->device_id = pci_conf_read_16(fun, PCI_DEVICE_ID);
-
-	/* Explicitly enable PCI bus mastering */
-	fun->command = pci_conf_read_16(fun, PCI_COMMAND) |
-	    PCI_COMMAND_MASTER;
-	pci_conf_write_16(fun, PCI_COMMAND, fun->command);
-
-	fun->class_code = pci_conf_read_8(fun, PCI_BASE_CLASS);
-	fun->subclass_code = pci_conf_read_8(fun, PCI_SUB_CLASS);
-	fun->prog_if = pci_conf_read_8(fun, PCI_PROG_IF);
-	fun->revision = pci_conf_read_8(fun, PCI_REVISION_ID);
-}
-
-void pci_fun_delete(pci_fun_t *fun)
-{
-	hw_res_clean_resource_list(&fun->hw_resources);
-	if (fun->fnode != NULL)
-		ddf_fun_destroy(fun->fnode);
-}
-
-char *pci_fun_create_name(pci_fun_t *fun)
-{
-	char *name = NULL;
-
-	asprintf(&name, "%02x:%02x.%01x", fun->bus, fun->dev,
-	    fun->fn);
-	return name;
-}
-
-bool pci_alloc_resource_list(pci_fun_t *fun)
-{
-	fun->hw_resources.resources = fun->resources;
-	return true;
-}
-
-void pci_clean_resource_list(pci_fun_t *fun)
-{
-	fun->hw_resources.resources = NULL;
-}
-
-/** Read the base address registers (BARs) of the function and add the addresses
- * to its HW resource list.
- *
- * @param fun	PCI function
- */
-void pci_read_bars(pci_fun_t *fun)
-{
-	/*
-	 * Position of the BAR in the PCI configuration address space of the
-	 * device.
-	 */
-	int addr = PCI_BASE_ADDR_0;
-
-	while (addr <= PCI_BASE_ADDR_5)
-		addr = pci_read_bar(fun, addr);
-}
-
-size_t pci_bar_mask_to_size(uint32_t mask)
-{
-	size_t size = mask & ~(mask - 1);
-	return size;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS PCI bus driver (Intel method 1).\n");
-	pciintel_init();
-	return ddf_driver_main(&pci_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/pci/pciintel/pci.h
===================================================================
--- uspace/drv/bus/pci/pciintel/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pciintel
- * @{
- */
-/** @file
- */
-
-#ifndef PCI_H_
-#define PCI_H_
-
-#include <adt/list.h>
-#include <ddi.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-
-#define PCI_MAX_HW_RES 10
-
-typedef struct pciintel_bus {
-	/** DDF device node */
-	ddf_dev_t *dnode;
-	ioport32_t *conf_addr_reg;
-	ioport32_t *conf_data_reg;
-	ioport32_t *conf_space;
-	pio_window_t pio_win;
-	fibril_mutex_t conf_mutex;
-	/** List of functions (of pci_fun_t) */
-	list_t funs;
-	/** Enumeration is done */
-	bool enum_done;
-	/** Synchronize enum_done */
-	fibril_mutex_t enum_done_lock;
-	/** Signal change to enum_done */
-	fibril_condvar_t enum_done_cv;
-	/** @c true iff legacy IDE range is claimed by PCI IDE driver */
-	bool leg_ide_claimed;
-} pci_bus_t;
-
-typedef struct pci_fun_data {
-	pci_bus_t *busptr;
-	ddf_fun_t *fnode;
-	/** Link to @c busptr->funs */
-	link_t lfuns;
-
-	int bus;
-	int dev;
-	int fn;
-	uint16_t vendor_id;
-	uint16_t device_id;
-	uint16_t command;
-	uint8_t class_code;
-	uint8_t subclass_code;
-	uint8_t prog_if;
-	uint8_t revision;
-	bool querying;
-	hw_resource_list_t hw_resources;
-	hw_resource_t resources[PCI_MAX_HW_RES];
-	pio_window_t pio_window;
-} pci_fun_t;
-
-extern pci_bus_t *pci_bus(ddf_dev_t *);
-
-extern void pci_fun_create_match_ids(pci_fun_t *);
-extern pci_fun_t *pci_fun_first(pci_bus_t *);
-extern pci_fun_t *pci_fun_next(pci_fun_t *);
-
-extern uint8_t pci_conf_read_8(pci_fun_t *, int);
-extern uint16_t pci_conf_read_16(pci_fun_t *, int);
-extern uint32_t pci_conf_read_32(pci_fun_t *, int);
-extern void pci_conf_write_8(pci_fun_t *, int, uint8_t);
-extern void pci_conf_write_16(pci_fun_t *, int, uint16_t);
-extern void pci_conf_write_32(pci_fun_t *, int, uint32_t);
-
-extern void pci_add_range(pci_fun_t *, uint64_t, size_t, bool);
-extern int pci_read_bar(pci_fun_t *, int);
-extern void pci_read_interrupt(pci_fun_t *);
-extern void pci_add_interrupt(pci_fun_t *, int);
-
-extern pci_fun_t *pci_fun_new(pci_bus_t *);
-extern void pci_fun_init(pci_fun_t *, int, int, int);
-extern void pci_fun_delete(pci_fun_t *);
-extern char *pci_fun_create_name(pci_fun_t *);
-
-extern errno_t pci_bus_scan(pci_bus_t *, int);
-
-extern bool pci_alloc_resource_list(pci_fun_t *);
-extern void pci_clean_resource_list(pci_fun_t *);
-
-extern void pci_read_bars(pci_fun_t *);
-extern size_t pci_bar_mask_to_size(uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/pci/pciintel/pci_regs.h
===================================================================
--- uspace/drv/bus/pci/pciintel/pci_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pciintel
- * @{
- */
-/** @file
- */
-
-#ifndef PCI_REGS_H_
-#define PCI_REGS_H_
-
-/* Header types */
-#define PCI_HEADER_TYPE_DEV	0
-#define PCI_HEADER_TYPE_BRIDGE	1
-#define PCI_HEADER_TYPE_CARDBUS	2
-
-/* Header type 0 and 1 */
-#define PCI_VENDOR_ID		0x00
-#define PCI_DEVICE_ID		0x02
-#define PCI_COMMAND		0x04
-#define PCI_STATUS		0x06
-#define PCI_REVISION_ID		0x08
-#define PCI_PROG_IF		0x09
-#define PCI_SUB_CLASS		0x0A
-#define PCI_BASE_CLASS		0x0B
-#define PCI_CACHE_LINE_SIZE	0x0C
-#define PCI_LATENCY_TIMER	0x0D
-#define PCI_HEADER_TYPE		0x0E
-#define PCI_BIST		0x0F
-
-#define PCI_BASE_ADDR_0		0x10
-#define PCI_BASE_ADDR_1		0x14
-
-/* Header type 0 */
-#define PCI_BASE_ADDR_2			0x18
-#define PCI_BASE_ADDR_3			0x1B
-#define PCI_BASE_ADDR_4			0x20
-#define PCI_BASE_ADDR_5			0x24
-
-#define PCI_CARDBUS_CIS_PTR		0x28
-#define PCI_SUBSYSTEM_VENDOR_ID		0x2C
-#define PCI_SUBSYSTEM_ID		0x2E
-#define PCI_EXP_ROM_BASE		0x30
-#define PCI_CAP_PTR			0x34
-#define PCI_INT_LINE			0x3C
-#define PCI_INT_PIN			0x3D
-#define PCI_MIN_GNT			0x3E
-#define PCI_MAX_LAT			0x3F
-
-/* Header type 1 */
-#define PCI_BRIDGE_PRIM_BUS_NUM		0x18
-#define PCI_BRIDGE_SEC_BUS_NUM		0x19
-#define PCI_BRIDGE_SUBORD_BUS_NUM	0x1A
-#define PCI_BRIDGE_SEC_LATENCY_TIMER	0x1B
-#define PCI_BRIDGE_IO_BASE		0x1C
-#define PCI_BRIDGE_IO_LIMIT		0x1D
-#define PCI_BRIDGE_SEC_STATUS		0x1E
-#define PCI_BRIDGE_MEMORY_BASE		0x20
-#define PCI_BRIDGE_MEMORY_LIMIT		0x22
-#define PCI_BRIDGE_PREF_MEMORY_BASE	0x24
-#define PCI_BRIDGE_PREF_MEMORY_LIMIT	0x26
-#define PCI_BRIDGE_PREF_MEMORY_BASE_UP	0x28
-#define PCI_BRIDGE_PREF_MEMORY_LIMIT_UP	0x2C
-#define PCI_BRIDGE_IO_BASE_UP		0x30
-#define PCI_BRIDGE_IO_LIMIT_UP		0x32
-#define PCI_BRIDGE_EXP_ROM_BASE		0x38
-#define PCI_BRIDGE_INT_LINE		0x3C
-#define PCI_BRIDGE_INT_PIN		0x3D
-#define PCI_BRIDGE_CTL			0x3E
-
-/* PCI command flags */
-#define PCI_COMMAND_IO            0x001
-#define PCI_COMMAND_MEMORY        0x002
-#define PCI_COMMAND_MASTER        0x004
-#define PCI_COMMAND_SPECIAL       0x008
-#define PCI_COMMAND_INVALIDATE    0x010
-#define PCI_COMMAND_VGA_PALETTE   0x020
-#define PCI_COMMAND_PARITY        0x040
-#define PCI_COMMAND_WAIT          0x080
-#define PCI_COMMAND_SERR          0x100
-#define PCI_COMMAND_FAST_BACK     0x200
-#define PCI_COMMAND_INTX_DISABLE  0x400
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/pci/pciintel/pciintel.ma
===================================================================
--- uspace/drv/bus/pci/pciintel/pciintel.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 intel_pci
Index: pace/drv/bus/usb/ehci/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/usb/ehci/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvusbehci ehci
- * @brief EHCI driver
- * @ingroup drvs
- */
Index: pace/drv/bus/usb/ehci/ehci.ma
===================================================================
--- uspace/drv/bus/usb/ehci/ehci.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-20 usb/host=ehci
-10 pci/class=0c&subclass=03&progif=20
Index: pace/drv/bus/usb/ehci/ehci_batch.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_batch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver USB transaction structure
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdbool.h>
-#include <str_error.h>
-
-#include <usb/usb.h>
-#include <usb/debug.h>
-
-#include "ehci_batch.h"
-#include "ehci_bus.h"
-
-/*
- * The buffer pointer list in the qTD is long enough to support a maximum
- * transfer size of 20K bytes. This case occurs when all five buffer pointers
- * are used and the first offset is zero. A qTD handles a 16Kbyte buffer
- * with any starting buffer alignment. EHCI specs p. 87 (pdf p. 97)
- */
-#define EHCI_TD_MAX_TRANSFER   (16 * 1024)
-
-static void (*const batch_setup[])(ehci_transfer_batch_t *);
-
-/** Safely destructs ehci_transfer_batch_t structure
- *
- * @param[in] ehci_batch Instance to destroy.
- */
-void ehci_transfer_batch_destroy(ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-	dma_buffer_free(&ehci_batch->ehci_dma_buffer);
-	usb_log_debug2("Batch(%p): disposed", ehci_batch);
-	free(ehci_batch);
-}
-
-/** Allocate memory and initialize internal data structure.
- *
- * @param[in] usb_batch Pointer to generic USB batch structure.
- * @return Valid pointer if all structures were successfully created,
- * NULL otherwise.
- *
- */
-ehci_transfer_batch_t *ehci_transfer_batch_create(endpoint_t *ep)
-{
-	assert(ep);
-
-	ehci_transfer_batch_t *ehci_batch = calloc(1, sizeof(ehci_transfer_batch_t));
-	if (!ehci_batch) {
-		usb_log_error("Failed to allocate EHCI batch data.");
-		return NULL;
-	}
-
-	usb_transfer_batch_init(&ehci_batch->base, ep);
-
-	return ehci_batch;
-}
-
-/** Prepares a batch to be sent.
- *
- * Determines the number of needed transfer descriptors (TDs).
- * Prepares a transport buffer (that is accessible by the hardware).
- * Initializes parameters needed for the transfer and callback.
- */
-int ehci_transfer_batch_prepare(ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-
-	const size_t setup_size = (ehci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL) ?
-	    USB_SETUP_PACKET_SIZE :
-	    0;
-
-	const size_t size = ehci_batch->base.size;
-
-	/* Add TD left over by the previous transfer */
-	ehci_batch->qh = ehci_endpoint_get(ehci_batch->base.ep)->qh;
-
-	/* Determine number of TDs needed */
-	ehci_batch->td_count = (size + EHCI_TD_MAX_TRANSFER - 1) /
-	    EHCI_TD_MAX_TRANSFER;
-
-	/* Control transfer need Setup and Status stage */
-	if (ehci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL) {
-		ehci_batch->td_count += 2;
-	}
-
-	assert(ehci_batch->td_count > 0);
-
-	const size_t tds_size = ehci_batch->td_count * sizeof(td_t);
-
-	/* Mix setup stage and TDs together, we have enough space */
-	if (dma_buffer_alloc(&ehci_batch->ehci_dma_buffer, tds_size + setup_size)) {
-		usb_log_error("Batch %p: Failed to allocate device buffer",
-		    ehci_batch);
-		return ENOMEM;
-	}
-
-	/* Clean TDs */
-	ehci_batch->tds = ehci_batch->ehci_dma_buffer.virt;
-	memset(ehci_batch->tds, 0, tds_size);
-
-	/* Copy setup data */
-	ehci_batch->setup_buffer = ehci_batch->ehci_dma_buffer.virt + tds_size;
-	memcpy(ehci_batch->setup_buffer, ehci_batch->base.setup.buffer, setup_size);
-
-	/* Generic data already prepared */
-	ehci_batch->data_buffer = ehci_batch->base.dma_buffer.virt;
-
-	if (!batch_setup[ehci_batch->base.ep->transfer_type])
-		return ENOTSUP;
-
-	batch_setup[ehci_batch->base.ep->transfer_type](ehci_batch);
-
-	usb_log_debug("Batch %p %s " USB_TRANSFER_BATCH_FMT " initialized.",
-	    ehci_batch, usb_str_direction(ehci_batch->base.dir),
-	    USB_TRANSFER_BATCH_ARGS(ehci_batch->base));
-
-	return EOK;
-}
-
-/** Check batch TDs' status.
- *
- * @param[in] ehci_batch Batch structure to use.
- * @return False, if there is an active TD, true otherwise.
- *
- * Walk all TDs (usually there is just one). Stop with false if there is an
- * active TD. Stop with true if an error is found. Return true if the walk
- * completes with the last TD.
- */
-bool ehci_transfer_batch_check_completed(ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-
-	usb_log_debug("Batch %p: checking %zu td(s) for completion.",
-	    ehci_batch, ehci_batch->td_count);
-
-	usb_log_debug2("Batch %p: QH: %08x:%08x:%08x:%08x:%08x:%08x.",
-	    ehci_batch,
-	    ehci_batch->qh->ep_char, ehci_batch->qh->ep_cap,
-	    ehci_batch->qh->status, ehci_batch->qh->current,
-	    ehci_batch->qh->next, ehci_batch->qh->alternate);
-
-	if (!qh_halted(ehci_batch->qh) && (qh_transfer_pending(ehci_batch->qh) ||
-	    qh_transfer_active(ehci_batch->qh)))
-		return false;
-
-	/*
-	 * Now we may be sure that either the ED is inactive because of errors
-	 * or all transfer descriptors completed successfully
-	 */
-
-	/* Assume all data got through */
-	ehci_batch->base.transferred_size = ehci_batch->base.size;
-
-	/* Check all TDs */
-	for (size_t i = 0; i < ehci_batch->td_count; ++i) {
-		usb_log_debug("Batch %p: TD %zu: %08x:%08x:%08x.",
-		    ehci_batch, i,
-		    ehci_batch->tds[i].status, ehci_batch->tds[i].next,
-		    ehci_batch->tds[i].alternate);
-
-		ehci_batch->base.error = td_error(&ehci_batch->tds[i]);
-		if (ehci_batch->base.error == EOK) {
-			/*
-			 * If the TD got all its data through, it will report
-			 * 0 bytes remain, the sole exception is INPUT with
-			 * data rounding flag (short), i.e. every INPUT.
-			 * Nice thing is that short packets will correctly
-			 * report remaining data, thus making this computation
-			 * correct (short packets need to be produced by the
-			 * last TD)
-			 * NOTE: This also works for CONTROL transfer as
-			 * the first TD will return 0 remain.
-			 * NOTE: Short packets don't break the assumption that
-			 * we leave the very last(unused) TD behind.
-			 */
-			ehci_batch->base.transferred_size -=
-			    td_remain_size(&ehci_batch->tds[i]);
-		} else {
-			usb_log_debug("Batch %p found error TD(%zu):%08x: %s.",
-			    ehci_batch, i,
-			    ehci_batch->tds[i].status,
-			    str_error_name(ehci_batch->base.error));
-			/* Clear possible ED HALT */
-			qh_clear_halt(ehci_batch->qh);
-			break;
-		}
-	}
-
-	assert(ehci_batch->base.transferred_size <= ehci_batch->base.size);
-
-	/* Clear TD pointers */
-	ehci_batch->qh->next = LINK_POINTER_TERM;
-	ehci_batch->qh->current = LINK_POINTER_TERM;
-	usb_log_debug("Batch %p complete: %s", ehci_batch,
-	    str_error(ehci_batch->base.error));
-
-	return true;
-}
-
-/** Starts execution of the TD list
- *
- * @param[in] ehci_batch Batch structure to use
- */
-void ehci_transfer_batch_commit(const ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-	qh_set_next_td(ehci_batch->qh,
-	    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[0]));
-}
-
-/** Prepare generic control transfer
- *
- * @param[in] ehci_batch Batch structure to use.
- *
- * Setup stage with toggle 0 and direction BOTH(SETUP_PID)
- * Data stage with alternating toggle and direction
- * Status stage with toggle 1 and direction
- */
-static void batch_control(ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-
-	usb_direction_t dir = ehci_batch->base.dir;
-	assert(dir == USB_DIRECTION_IN || dir == USB_DIRECTION_OUT);
-
-	usb_log_debug2("Batch %p: Control QH(%p): "
-	    "%08x:%08x:%08x:%08x:%08x:%08x", ehci_batch,
-	    ehci_batch->qh,
-	    ehci_batch->qh->ep_char, ehci_batch->qh->ep_cap,
-	    ehci_batch->qh->status, ehci_batch->qh->current,
-	    ehci_batch->qh->next, ehci_batch->qh->alternate);
-	static const usb_direction_t reverse_dir[] = {
-		[USB_DIRECTION_IN]  = USB_DIRECTION_OUT,
-		[USB_DIRECTION_OUT] = USB_DIRECTION_IN,
-	};
-
-	int toggle = 0;
-	const usb_direction_t data_dir = dir;
-	const usb_direction_t status_dir = reverse_dir[dir];
-
-	/* Setup stage */
-	td_init(&ehci_batch->tds[0],
-	    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[1]),
-	    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, ehci_batch->setup_buffer),
-	    USB_DIRECTION_BOTH, USB_SETUP_PACKET_SIZE, toggle, false);
-	usb_log_debug2("Batch %p: Created CONTROL SETUP TD(%" PRIxn "): "
-	    "%08x:%08x:%08x", ehci_batch,
-	    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[0]),
-	    ehci_batch->tds[0].status, ehci_batch->tds[0].next,
-	    ehci_batch->tds[0].alternate);
-
-	/* Data stage */
-	unsigned td_current = 1;
-	size_t remain_size = ehci_batch->base.size;
-	uintptr_t buffer = dma_buffer_phys(&ehci_batch->base.dma_buffer,
-	    ehci_batch->data_buffer);
-	while (remain_size > 0) {
-		const size_t transfer_size = min(remain_size, EHCI_TD_MAX_TRANSFER);
-		toggle = 1 - toggle;
-
-		td_init(&ehci_batch->tds[td_current],
-		    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current + 1]),
-		    buffer, data_dir, transfer_size, toggle, false);
-		usb_log_debug2("Batch %p: Created CONTROL DATA TD(%" PRIxn "): "
-		    "%08x:%08x:%08x", ehci_batch,
-		    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current]),
-		    ehci_batch->tds[td_current].status,
-		    ehci_batch->tds[td_current].next,
-		    ehci_batch->tds[td_current].alternate);
-
-		buffer += transfer_size;
-		remain_size -= transfer_size;
-		assert(td_current < ehci_batch->td_count - 1);
-		++td_current;
-	}
-
-	/* Status stage */
-	assert(td_current == ehci_batch->td_count - 1);
-	td_init(&ehci_batch->tds[td_current], 0, 0, status_dir, 0, 1, true);
-	usb_log_debug2("Batch %p: Created CONTROL STATUS TD %d(%" PRIxn "): "
-	    "%08x:%08x:%08x", ehci_batch, td_current,
-	    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current]),
-	    ehci_batch->tds[td_current].status,
-	    ehci_batch->tds[td_current].next,
-	    ehci_batch->tds[td_current].alternate);
-}
-
-/** Prepare generic data transfer
- *
- * @param[in] ehci_batch Batch structure to use.
- * @paramp[in] dir Communication direction.
- *
- * Direction is supplied by the associated ep and toggle is maintained by the
- * EHCI hw in ED.
- */
-static void batch_data(ehci_transfer_batch_t *ehci_batch)
-{
-	assert(ehci_batch);
-
-	usb_log_debug2("Batch %p: Data QH(%p): "
-	    "%08x:%08x:%08x:%08x:%08x:%08x", ehci_batch,
-	    ehci_batch->qh,
-	    ehci_batch->qh->ep_char, ehci_batch->qh->ep_cap,
-	    ehci_batch->qh->status, ehci_batch->qh->current,
-	    ehci_batch->qh->next, ehci_batch->qh->alternate);
-
-	size_t td_current = 0;
-	size_t remain_size = ehci_batch->base.size;
-	uintptr_t buffer = dma_buffer_phys(&ehci_batch->base.dma_buffer,
-	    ehci_batch->data_buffer);
-	while (remain_size > 0) {
-		const size_t transfer_size = remain_size > EHCI_TD_MAX_TRANSFER ?
-		    EHCI_TD_MAX_TRANSFER : remain_size;
-
-		const bool last = (remain_size == transfer_size);
-		td_init(&ehci_batch->tds[td_current],
-		    last ? 0 : dma_buffer_phys(&ehci_batch->ehci_dma_buffer,
-		    &ehci_batch->tds[td_current + 1]),
-		    buffer, ehci_batch->base.dir, transfer_size, -1, last);
-
-		usb_log_debug2("Batch %p: DATA TD(%" PRIxn ": %08x:%08x:%08x",
-		    ehci_batch,
-		    dma_buffer_phys(&ehci_batch->ehci_dma_buffer,
-		    &ehci_batch->tds[td_current]),
-		    ehci_batch->tds[td_current].status,
-		    ehci_batch->tds[td_current].next,
-		    ehci_batch->tds[td_current].alternate);
-
-		buffer += transfer_size;
-		remain_size -= transfer_size;
-		assert(td_current < ehci_batch->td_count);
-		++td_current;
-	}
-}
-
-/** Transfer setup table. */
-static void (*const batch_setup[])(ehci_transfer_batch_t *) =
-    {
-	[USB_TRANSFER_CONTROL] = batch_control,
-	[USB_TRANSFER_BULK] = batch_data,
-	[USB_TRANSFER_INTERRUPT] = batch_data,
-	[USB_TRANSFER_ISOCHRONOUS] = NULL,
-};
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/ehci_batch.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_batch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver USB transaction structure
- */
-#ifndef DRV_EHCI_BATCH_H
-#define DRV_EHCI_BATCH_H
-
-#include <adt/list.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/dma_buffer.h>
-
-#include "hw_struct/queue_head.h"
-#include "hw_struct/transfer_descriptor.h"
-
-/** EHCI specific data required for USB transfer */
-typedef struct ehci_transfer_batch {
-	usb_transfer_batch_t base;
-	/** Number of TDs used by the transfer */
-	size_t td_count;
-	/** Endpoint descriptor of the target endpoint. */
-	qh_t *qh;
-	/** Backend for TDs and setup data. */
-	dma_buffer_t ehci_dma_buffer;
-	/** List of TDs needed for the transfer - backed by dma_buffer */
-	td_t *tds;
-	/** Data buffers - backed by dma_buffer */
-	void *setup_buffer;
-	void *data_buffer;
-	/** Generic USB transfer structure */
-	usb_transfer_batch_t *usb_batch;
-} ehci_transfer_batch_t;
-
-ehci_transfer_batch_t *ehci_transfer_batch_create(endpoint_t *ep);
-int ehci_transfer_batch_prepare(ehci_transfer_batch_t *batch);
-void ehci_transfer_batch_commit(const ehci_transfer_batch_t *batch);
-bool ehci_transfer_batch_check_completed(ehci_transfer_batch_t *batch);
-void ehci_transfer_batch_destroy(ehci_transfer_batch_t *batch);
-
-static inline ehci_transfer_batch_t *ehci_transfer_batch_get(
-    usb_transfer_batch_t *usb_batch)
-{
-	assert(usb_batch);
-
-	return (ehci_transfer_batch_t *) usb_batch;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/ehci_bus.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_bus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <usb/host/bandwidth.h>
-#include <usb/debug.h>
-
-#include "ehci_bus.h"
-#include "ehci_batch.h"
-#include "hc.h"
-
-/**
- * Callback to set toggle on ED.
- *
- * @param[in] hcd_ep hcd endpoint structure
- * @param[in] toggle new value of toggle bit
- */
-void ehci_ep_toggle_reset(endpoint_t *ep)
-{
-	ehci_endpoint_t *instance = ehci_endpoint_get(ep);
-	if (qh_toggle_from_td(instance->qh))
-		usb_log_warning("EP(%p): Resetting toggle bit for transfer "
-		    "directed EP", instance);
-	qh_toggle_set(instance->qh, 0);
-}
-
-static int ehci_device_enumerate(device_t *dev)
-{
-	ehci_bus_t *bus = (ehci_bus_t *) dev->bus;
-	return usb2_bus_device_enumerate(&bus->helper, dev);
-}
-
-static void ehci_device_gone(device_t *dev)
-{
-	ehci_bus_t *bus = (ehci_bus_t *) dev->bus;
-	usb2_bus_device_gone(&bus->helper, dev);
-}
-
-/** Creates new hcd endpoint representation.
- */
-static endpoint_t *ehci_endpoint_create(device_t *dev,
-    const usb_endpoint_descriptors_t *desc)
-{
-	assert(dev);
-
-	ehci_endpoint_t *ehci_ep = malloc(sizeof(ehci_endpoint_t));
-	if (ehci_ep == NULL)
-		return NULL;
-
-	endpoint_init(&ehci_ep->base, dev, desc);
-
-	if (dma_buffer_alloc(&ehci_ep->dma_buffer, sizeof(qh_t)))
-		return NULL;
-
-	ehci_ep->qh = ehci_ep->dma_buffer.virt;
-
-	link_initialize(&ehci_ep->eplist_link);
-	link_initialize(&ehci_ep->pending_link);
-	return &ehci_ep->base;
-}
-
-/** Disposes hcd endpoint structure
- *
- * @param[in] hcd driver using this instance.
- * @param[in] ep endpoint structure.
- */
-static void ehci_endpoint_destroy(endpoint_t *ep)
-{
-	assert(ep);
-	ehci_endpoint_t *instance = ehci_endpoint_get(ep);
-
-	dma_buffer_free(&instance->dma_buffer);
-	free(instance);
-}
-
-static int ehci_register_ep(endpoint_t *ep)
-{
-	bus_t *bus_base = endpoint_get_bus(ep);
-	ehci_bus_t *bus = (ehci_bus_t *) bus_base;
-	ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
-
-	const int err = usb2_bus_endpoint_register(&bus->helper, ep);
-	if (err)
-		return err;
-
-	qh_init(ehci_ep->qh, ep);
-	hc_enqueue_endpoint(bus->hc, ep);
-	endpoint_set_online(ep, &bus->hc->guard);
-	return EOK;
-}
-
-static void ehci_unregister_ep(endpoint_t *ep)
-{
-	bus_t *bus_base = endpoint_get_bus(ep);
-	ehci_bus_t *bus = (ehci_bus_t *) bus_base;
-	hc_t *hc = bus->hc;
-	assert(bus);
-	assert(ep);
-
-	usb2_bus_endpoint_unregister(&bus->helper, ep);
-	hc_dequeue_endpoint(hc, ep);
-	/*
-	 * Now we can be sure the active transfer will not be completed,
-	 * as it's out of the schedule, and HC acknowledged it.
-	 */
-
-	ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
-
-	fibril_mutex_lock(&hc->guard);
-	endpoint_set_offline_locked(ep);
-	list_remove(&ehci_ep->pending_link);
-	usb_transfer_batch_t *const batch = ep->active_batch;
-	endpoint_deactivate_locked(ep);
-	fibril_mutex_unlock(&hc->guard);
-
-	if (batch) {
-		batch->error = EINTR;
-		batch->transferred_size = 0;
-		usb_transfer_batch_finish(batch);
-	}
-}
-
-static usb_transfer_batch_t *ehci_create_batch(endpoint_t *ep)
-{
-	ehci_transfer_batch_t *batch = ehci_transfer_batch_create(ep);
-	return &batch->base;
-}
-
-static void ehci_destroy_batch(usb_transfer_batch_t *batch)
-{
-	ehci_transfer_batch_destroy(ehci_transfer_batch_get(batch));
-}
-
-static const bus_ops_t ehci_bus_ops = {
-	.interrupt = ehci_hc_interrupt,
-	.status = ehci_hc_status,
-
-	.device_enumerate = ehci_device_enumerate,
-	.device_gone = ehci_device_gone,
-
-	.endpoint_destroy = ehci_endpoint_destroy,
-	.endpoint_create = ehci_endpoint_create,
-	.endpoint_register = ehci_register_ep,
-	.endpoint_unregister = ehci_unregister_ep,
-
-	.batch_create = ehci_create_batch,
-	.batch_destroy = ehci_destroy_batch,
-	.batch_schedule = ehci_hc_schedule,
-};
-
-int ehci_bus_init(ehci_bus_t *bus, hc_t *hc)
-{
-	assert(hc);
-	assert(bus);
-
-	bus_t *bus_base = (bus_t *) bus;
-	bus_init(bus_base, sizeof(device_t));
-	bus_base->ops = &ehci_bus_ops;
-
-	usb2_bus_helper_init(&bus->helper, &bandwidth_accounting_usb2);
-
-	bus->hc = hc;
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/ehci_bus.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_bus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HCD_BUS_H
-#define DRV_EHCI_HCD_BUS_H
-
-#include <assert.h>
-#include <adt/list.h>
-#include <usb/host/usb2_bus.h>
-#include <usb/host/endpoint.h>
-#include <usb/dma_buffer.h>
-
-#include "hw_struct/queue_head.h"
-
-/** Connector structure linking ED to to prepared TD. */
-typedef struct ehci_endpoint {
-	/* Inheritance */
-	endpoint_t base;
-
-	/** EHCI endpoint descriptor, backed by dma_buffer */
-	qh_t *qh;
-
-	dma_buffer_t dma_buffer;
-
-	/** Link in endpoint_list */
-	link_t eplist_link;
-
-	/** Link in pending_endpoints */
-	link_t pending_link;
-} ehci_endpoint_t;
-
-typedef struct hc hc_t;
-
-typedef struct {
-	bus_t base;
-	usb2_bus_helper_t helper;
-	hc_t *hc;
-} ehci_bus_t;
-
-void ehci_ep_toggle_reset(endpoint_t *);
-void ehci_bus_prepare_ops(void);
-
-errno_t ehci_bus_init(ehci_bus_t *, hc_t *);
-
-/** Get and convert assigned ehci_endpoint_t structure
- * @param[in] ep USBD endpoint structure.
- * @return Pointer to assigned ehci endpoint structure
- */
-static inline ehci_endpoint_t *ehci_endpoint_get(const endpoint_t *ep)
-{
-	assert(ep);
-	return (ehci_endpoint_t *) ep;
-}
-
-static inline ehci_endpoint_t *ehci_endpoint_list_instance(link_t *l)
-{
-	return list_get_instance(l, ehci_endpoint_t, eplist_link);
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/ehci_regs.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI host controller register structure
- */
-#ifndef DRV_EHCI_EHCI_REGS_H
-#define DRV_EHCI_EHCI_REGS_H
-
-#include <byteorder.h>
-#include <macros.h>
-#include <ddi.h>
-
-#define EHCI_WR(reg, val) pio_write_32(&(reg), host2uint32_t_le(val))
-#define EHCI_RD(reg) uint32_t_le2host(pio_read_32(&(reg)))
-#define EHCI_RD8(reg) pio_read_8(&(reg))
-#define EHCI_SET(reg, val) pio_set_32(&(reg), host2uint32_t_le(val), 10)
-#define EHCI_CLR(reg, val) pio_clear_32(&(reg), host2uint32_t_le(val), 10)
-
-/** EHCI memory mapped capability registers structure */
-typedef struct ehci_cap_regs {
-	const ioport8_t caplength;
-	PADD8(1);
-	const ioport16_t hciversion;
-	const ioport32_t hcsparams;
-#define EHCI_CAPS_HCS_DEBUG_PORT_MASK   0xf
-#define EHCI_CAPS_HCS_DEBUG_PORT_SHIFT  (1 << 20)
-#define EHCI_CAPS_HCS_INDICATORS_FLAG   (1 << 16)
-#define EHCI_CAPS_HCS_N_CC_MASK         0xf
-#define EHCI_CAPS_HCS_N_CC_SHIFT        12
-#define EHCI_CAPS_HCS_N_PCC_MASK        0xf
-#define EHCI_CAPS_HCS_N_PCC_SHIFT       8
-#define EHCI_CAPS_HCS_ROUTING_FLAG      (1 << 7)
-#define EHCI_CAPS_HCS_PPC_FLAG          (1 << 4)
-#define EHCI_CAPS_HCS_N_PORTS_MASK      0xf
-#define EHCI_CAPS_HCS_N_PORTS_SHIFT     0
-
-	const ioport32_t hccparams;
-#define EHCI_CAPS_HCC_EECP_MASK           0xff
-#define EHCI_CAPS_HCC_EECP_SHIFT          8
-#define EHCI_CAPS_HCC_ISO_THRESHOLD_MASK  0xf
-#define EHCI_CAPS_HCC_ISO_THRESHOLD_SHIFT 4
-#define EHCI_CAPS_HCC_ASYNC_PART_FLAG     (1 << 2)
-#define EHCI_CAPS_HCC_PROG_FRAME_FLAG     (1 << 1)
-#define EHCI_CAPS_HCC_64_FLAG             (1 << 0)
-	ioport8_t hcsp_portoute[8];
-
-} ehci_caps_regs_t;
-
-/** EHCI memory mapped operational registers structure */
-typedef struct ehci_regs {
-	ioport32_t usbcmd;
-#define USB_CMD_INT_THRESHOLD_MASK     0xff
-#define USB_CMD_INT_THRESHOLD_SHIFT    16
-#define USB_CMD_PARK_MODE_FLAG         (1 << 11)
-#define USB_CMD_PARK_COUNT_MASK        0x3
-#define USB_CMD_PARK_COUNT_SHIFT       8
-#define USB_CMD_LIGHT_RESET            (1 << 7)
-#define USB_CMD_IRQ_ASYNC_DOORBELL     (1 << 6)
-#define USB_CMD_ASYNC_SCHEDULE_FLAG    (1 << 5)
-#define USB_CMD_PERIODIC_SCHEDULE_FLAG (1 << 4)
-#define USB_CMD_FRAME_LIST_SIZE_MASK   0x3
-#define USB_CMD_FRAME_LIST_SIZE_SHIFT  2
-#define USB_CMD_FRAME_LIST_SIZE_1024   0x0
-#define USB_CMD_FRAME_LIST_SIZE_512    0x1
-#define USB_CMD_FRAME_LIST_SIZE_256    0x2
-#define USB_CMD_HC_RESET_FLAG          (1 << 1)
-#define USB_CMD_RUN_FLAG               (1 << 0)
-
-	ioport32_t usbsts;
-#define USB_STS_ASYNC_SCHED_FLAG         (1 << 15)
-#define USB_STS_PERIODIC_SCHED_FLAG      (1 << 14)
-#define USB_STS_RECLAMATION_FLAG         (1 << 13)
-#define USB_STS_HC_HALTED_FLAG           (1 << 12)
-#define USB_STS_IRQ_ASYNC_ADVANCE_FLAG   (1 <<  5)
-#define USB_STS_HOST_ERROR_FLAG          (1 <<  4)
-#define USB_STS_FRAME_ROLLOVER_FLAG      (1 <<  3)
-#define USB_STS_PORT_CHANGE_FLAG         (1 <<  2)
-#define USB_STS_ERR_IRQ_FLAG             (1 <<  1)
-#define USB_STS_IRQ_FLAG                 (1 <<  0)
-
-	ioport32_t usbintr;
-#define USB_INTR_ASYNC_ADVANCE_FLAG   (1 << 5)
-#define USB_INTR_HOST_ERR_FLAG        (1 << 4)
-#define USB_INTR_FRAME_ROLLOVER_FLAG  (1 << 3)
-#define USB_INTR_PORT_CHANGE_FLAG     (1 << 2)
-#define USB_INTR_ERR_IRQ_FLAG         (1 << 1)
-#define USB_INTR_IRQ_FLAG             (1 << 0)
-
-	ioport32_t frindex;
-#define USB_FRINDEX_MASK   0xfff
-
-	ioport32_t ctrldssegment;
-	ioport32_t periodiclistbase;
-#define USB_PERIODIC_LIST_BASE_MASK   0xfffff000
-
-	ioport32_t asynclistaddr;
-#define USB_ASYNCLIST_MASK   0xfffffff0
-
-	PADD32(9);
-
-	ioport32_t configflag;
-#define USB_CONFIG_FLAG_FLAG   (1 << 0)
-
-	ioport32_t portsc[];
-#define USB_PORTSC_WKOC_E_FLAG       (1 << 22)
-#define USB_PORTSC_WKDSCNNT_E_FLAG   (1 << 21)
-#define USB_PORTSC_WKCNNT_E_FLAG     (1 << 20)
-#define USB_PORTSC_PORT_TEST_MASK    (0xf << 16)
-#define USB_PORTSC_NO_TEST           (0x0 << 16)
-#define USB_PORTSC_TEST_J_STATE      (0x1 << 16)
-#define USB_PORTSC_TEST_K_STATE      (0x2 << 16)
-#define USB_PORTSC_TEST_SE0_NAK      (0x3 << 16)
-#define USB_PORTSC_TEST_PACKET       (0x4 << 16)
-#define USB_PORTSC_TEST_FORCE_ENABLE (0x5 << 16)
-#define USB_PORTSC_INDICATOR_MASK    (0x3 << 14)
-#define USB_PORTSC_INDICATOR_OFF     (0x0 << 14)
-#define USB_PORTSC_INDICATOR_AMBER   (0x1 << 14)
-#define USB_PORTSC_INDICATOR_GREEN   (0x2 << 14)
-#define USB_PORTSC_PORT_OWNER_FLAG   (1 << 13)
-#define USB_PORTSC_PORT_POWER_FLAG   (1 << 12)
-#define USB_PORTSC_LINE_STATUS_MASK  (0x3 << 10)
-#define USB_PORTSC_LINE_STATUS_SE0   (0x0 << 10)
-#define USB_PORTSC_LINE_STATUS_K     (0x1 << 10)
-#define USB_PORTSC_LINE_STATUS_J     (0x2 << 10)
-#define USB_PORTSC_PORT_RESET_FLAG   (1 << 8)
-#define USB_PORTSC_SUSPEND_FLAG      (1 << 7)
-#define USB_PORTSC_RESUME_FLAG       (1 << 6)
-#define USB_PORTSC_OC_CHANGE_FLAG    (1 << 5)
-#define USB_PORTSC_OC_ACTIVE_FLAG    (1 << 4)
-#define USB_PORTSC_EN_CHANGE_FLAG    (1 << 3)
-#define USB_PORTSC_ENABLED_FLAG      (1 << 2)
-#define USB_PORTSC_CONNECT_CH_FLAG   (1 << 1)
-#define USB_PORTSC_CONNECT_FLAG      (1 << 0)
-
-#define USB_PORTSC_WC_MASK \
-    (USB_PORTSC_CONNECT_CH_FLAG | USB_PORTSC_EN_CHANGE_FLAG | USB_PORTSC_OC_CHANGE_FLAG)
-} ehci_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/ehci_rh.c
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_rh.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,626 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <mem.h>
-#include <str_error.h>
-#include <stdint.h>
-#include <stddef.h>
-
-#include <usb/classes/hub.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-#include <usb/usb.h>
-
-#include <usb/host/endpoint.h>
-#include <usbvirt/device.h>
-
-#include "ehci_rh.h"
-
-enum {
-	HUB_STATUS_CHANGE_PIPE = 1,
-};
-
-static usbvirt_device_ops_t ops;
-
-/** Initialize internal USB HUB class descriptor.
- * @param instance EHCI root hub.
- * Use register based info to create accurate descriptor.
- */
-static void ehci_rh_hub_desc_init(ehci_rh_t *instance, unsigned hcs)
-{
-	assert(instance);
-	const unsigned dsize = sizeof(usb_hub_descriptor_header_t) +
-	    STATUS_BYTES(instance->port_count) * 2;
-	assert(dsize <= sizeof(instance->hub_descriptor));
-
-	instance->hub_descriptor.header.length = dsize;
-	instance->hub_descriptor.header.descriptor_type = USB_DESCTYPE_HUB;
-	instance->hub_descriptor.header.port_count = instance->port_count;
-	/*
-	 * Bits 0,1 indicate power switching mode
-	 * Bit 2 indicates device type (compound device)
-	 * Bits 3,4 indicate over-current protection mode
-	 */
-	instance->hub_descriptor.header.characteristics = 0 |
-	    ((hcs & EHCI_CAPS_HCS_PPC_FLAG) ? 0x09 : 0x12) |
-	    ((hcs & EHCI_CAPS_HCS_INDICATORS_FLAG) ? 0x80 : 0) |
-	    (0x3 << 5); /* Need 32 FS bit times */ // TODO Implement
-	instance->hub_descriptor.header.characteristics_reserved = 0;
-	instance->hub_descriptor.header.power_good_time = 50;
-	/* bHubContrCurrent, root hubs don't need no power. */
-	instance->hub_descriptor.header.max_current = 0;
-
-	/* Device removable and some legacy 1.0 stuff */
-	instance->hub_descriptor.rempow[0] = 0xff;
-	instance->hub_descriptor.rempow[1] = 0xff;
-	instance->hub_descriptor.rempow[2] = 0xff;
-	instance->hub_descriptor.rempow[3] = 0xff;
-
-}
-/** Initialize EHCI root hub.
- * @param instance Place to initialize.
- * @param regs EHCI device registers.
- * @param name Device name.
- * return Error code, EOK on success.
- *
- * Selects preconfigured port powering mode, sets up descriptor, and
- * initializes internal virtual hub.
- */
-errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps, ehci_regs_t *regs,
-    fibril_mutex_t *guard, const char *name)
-{
-	assert(instance);
-	instance->registers = regs;
-	instance->port_count =
-	    (EHCI_RD(caps->hcsparams) >> EHCI_CAPS_HCS_N_PORTS_SHIFT) &
-	    EHCI_CAPS_HCS_N_PORTS_MASK;
-	usb_log_debug2("RH(%p): hcsparams: %x.", instance,
-	    EHCI_RD(caps->hcsparams));
-	usb_log_info("RH(%p): Found %u ports.", instance,
-	    instance->port_count);
-
-	if (EHCI_RD(caps->hcsparams) & EHCI_CAPS_HCS_PPC_FLAG) {
-		usb_log_info("RH(%p): Per-port power switching.", instance);
-	} else {
-		usb_log_info("RH(%p): No power switching.", instance);
-	}
-	for (unsigned i = 0; i < instance->port_count; ++i)
-		usb_log_debug2("RH(%p-%u): status: %" PRIx32, instance, i,
-		    EHCI_RD(regs->portsc[i]));
-
-	for (unsigned i = 0; i < EHCI_MAX_PORTS; ++i) {
-		instance->reset_flag[i] = false;
-		instance->resume_flag[i] = false;
-	}
-
-	ehci_rh_hub_desc_init(instance, EHCI_RD(caps->hcsparams));
-	instance->guard = guard;
-	instance->status_change_endpoint = NULL;
-
-	return virthub_base_init(&instance->base, name, &ops, instance,
-	    NULL, &instance->hub_descriptor.header, HUB_STATUS_CHANGE_PIPE);
-}
-
-/** Schedule USB request.
- * @param instance OCHI root hub instance.
- * @param batch USB requst batch to schedule.
- * @return Always EOK.
- * Most requests complete even before this function returns,
- * status change requests might be postponed until there is something to report.
- */
-errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch)
-{
-	assert(instance);
-	assert(batch);
-	batch->error = virthub_base_request(&instance->base, batch->target,
-	    batch->dir, (void *) batch->setup.buffer,
-	    batch->dma_buffer.virt, batch->size,
-	    &batch->transferred_size);
-	if (batch->error == ENAK) {
-		usb_log_debug("RH(%p): BATCH(%p) adding as unfinished",
-		    instance, batch);
-
-		/* Lock the HC guard */
-		fibril_mutex_lock(instance->guard);
-		const int err = endpoint_activate_locked(batch->ep, batch);
-		if (err) {
-			fibril_mutex_unlock(batch->ep->guard);
-			return err;
-		}
-
-		/*
-		 * Asserting that the HC do not run two instances of the status
-		 * change endpoint - shall be true.
-		 */
-		assert(!instance->status_change_endpoint);
-
-		endpoint_add_ref(batch->ep);
-		instance->status_change_endpoint = batch->ep;
-		fibril_mutex_unlock(instance->guard);
-	} else {
-		usb_log_debug("RH(%p): BATCH(%p) virtual request complete: %s",
-		    instance, batch, str_error(batch->error));
-		usb_transfer_batch_finish(batch);
-	}
-	return EOK;
-}
-
-/** Handle EHCI RHSC interrupt.
- * @param instance EHCI root hub isntance.
- * @return Always EOK.
- *
- * Interrupt means there is a change of status to report. It may trigger
- * processing of a postponed request.
- */
-errno_t ehci_rh_interrupt(ehci_rh_t *instance)
-{
-	fibril_mutex_lock(instance->guard);
-	endpoint_t *ep = instance->status_change_endpoint;
-	if (!ep) {
-		fibril_mutex_unlock(instance->guard);
-		return EOK;
-	}
-
-	usb_transfer_batch_t *const batch = ep->active_batch;
-	endpoint_deactivate_locked(ep);
-	instance->status_change_endpoint = NULL;
-	fibril_mutex_unlock(instance->guard);
-
-	endpoint_del_ref(ep);
-
-	if (batch) {
-		usb_log_debug2("RH(%p): Interrupt. Processing batch: %p",
-		    instance, batch);
-		batch->error = virthub_base_request(&instance->base, batch->target,
-		    batch->dir, (void *) batch->setup.buffer,
-		    batch->dma_buffer.virt, batch->size,
-		    &batch->transferred_size);
-		usb_transfer_batch_finish(batch);
-	}
-	return EOK;
-}
-
-/* HUB ROUTINES IMPLEMENTATION */
-#define TEST_SIZE_INIT(size, port, hub) \
-do { \
-	hub = virthub_get_data(device); \
-	assert(hub);\
-	if (uint16_usb2host(setup_packet->length) != size) \
-		return ESTALL; \
-	port = uint16_usb2host(setup_packet->index) - 1; \
-	if (port > hub->port_count) \
-		return EINVAL; \
-} while (0)
-
-/** Hub status request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_get_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ehci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-	if (uint16_usb2host(setup_packet->length) != 4)
-		return ESTALL;
-	/* ECHI RH does not report global OC, and local power is always good */
-	const uint32_t val = 0;
-	memcpy(data, &val, sizeof(val));
-	*act_size = sizeof(val);
-	return EOK;
-}
-
-/** Hub set feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_clear_hub_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ehci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-
-	/*
-	 * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and
-	 * C_HUB_OVER_CURRENT are supported.
-	 * C_HUB_LOCAL_POWER is not supported because root hubs do not support
-	 * local power status feature.
-	 * EHCI RH does not report global OC condition either
-	 */
-	return ESTALL;
-}
-
-#define BIT_VAL(val, bit)   ((val & bit) ? 1 : 0)
-#define EHCI2USB(val, bit, mask)   (BIT_VAL(val, bit) ? mask : 0)
-
-/** Port status request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_get_port_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ehci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(4, port, hub);
-	if (setup_packet->value != 0)
-		return EINVAL;
-
-	const uint32_t reg = EHCI_RD(hub->registers->portsc[port]);
-	const uint32_t status = uint32_host2usb(
-	    EHCI2USB(reg, USB_PORTSC_CONNECT_FLAG, USB_HUB_PORT_STATUS_CONNECTION) |
-	    EHCI2USB(reg, USB_PORTSC_ENABLED_FLAG, USB_HUB_PORT_STATUS_ENABLE) |
-	    EHCI2USB(reg, USB_PORTSC_SUSPEND_FLAG, USB2_HUB_PORT_STATUS_SUSPEND) |
-	    EHCI2USB(reg, USB_PORTSC_OC_ACTIVE_FLAG, USB_HUB_PORT_STATUS_OC) |
-	    EHCI2USB(reg, USB_PORTSC_PORT_RESET_FLAG, USB_HUB_PORT_STATUS_RESET) |
-	    EHCI2USB(reg, USB_PORTSC_PORT_POWER_FLAG, USB2_HUB_PORT_STATUS_POWER) |
-	    (((reg & USB_PORTSC_LINE_STATUS_MASK) == USB_PORTSC_LINE_STATUS_K) ?
-	    (USB2_HUB_PORT_STATUS_LOW_SPEED) : 0) |
-	    ((reg & USB_PORTSC_PORT_OWNER_FLAG) ? 0 : USB2_HUB_PORT_STATUS_HIGH_SPEED) |
-	    EHCI2USB(reg, USB_PORTSC_PORT_TEST_MASK, USB2_HUB_PORT_STATUS_TEST) |
-	    EHCI2USB(reg, USB_PORTSC_INDICATOR_MASK, USB2_HUB_PORT_STATUS_INDICATOR) |
-	    EHCI2USB(reg, USB_PORTSC_CONNECT_CH_FLAG, USB_HUB_PORT_STATUS_C_CONNECTION) |
-	    EHCI2USB(reg, USB_PORTSC_EN_CHANGE_FLAG, USB2_HUB_PORT_STATUS_C_ENABLE) |
-	    (hub->resume_flag[port] ? USB2_HUB_PORT_STATUS_C_SUSPEND : 0) |
-	    EHCI2USB(reg, USB_PORTSC_OC_CHANGE_FLAG, USB_HUB_PORT_STATUS_C_OC) |
-	    (hub->reset_flag[port] ? USB_HUB_PORT_STATUS_C_RESET : 0));
-	/*
-	 * Note feature numbers for test and indicator feature do not
-	 * correspond to the port status bit locations
-	 */
-	usb_log_debug2("RH(%p-%u) port status: %" PRIx32 "(%" PRIx32 ")", hub, port,
-	    status, reg);
-	memcpy(data, &status, sizeof(status));
-	*act_size = sizeof(status);
-	return EOK;
-}
-
-typedef struct {
-	ehci_rh_t *hub;
-	unsigned port;
-} ehci_rh_job_t;
-
-static errno_t stop_reset(void *arg)
-{
-	ehci_rh_job_t *job = arg;
-	fibril_usleep(50000);
-	usb_log_debug("RH(%p-%u): Clearing reset", job->hub, job->port);
-	EHCI_CLR(job->hub->registers->portsc[job->port],
-	    USB_PORTSC_PORT_RESET_FLAG);
-	/* wait for reset to complete */
-	while (EHCI_RD(job->hub->registers->portsc[job->port]) &
-	    USB_PORTSC_PORT_RESET_FLAG) {
-		fibril_usleep(1);
-	}
-	usb_log_debug("RH(%p-%u): Reset complete", job->hub, job->port);
-	/*
-	 * Handle port ownership, if the port is not enabled
-	 * after reset it's a full speed device
-	 */
-	if (!(EHCI_RD(job->hub->registers->portsc[job->port]) &
-	    USB_PORTSC_ENABLED_FLAG)) {
-		usb_log_info("RH(%p-%u): Port not enabled after reset (%" PRIX32
-		    "), giving up ownership", job->hub, job->port,
-		    EHCI_RD(job->hub->registers->portsc[job->port]));
-		EHCI_SET(job->hub->registers->portsc[job->port],
-		    USB_PORTSC_PORT_OWNER_FLAG);
-	}
-	job->hub->reset_flag[job->port] = true;
-	ehci_rh_interrupt(job->hub);
-	free(job);
-	return 0;
-}
-
-static errno_t stop_resume(void *arg)
-{
-	ehci_rh_job_t *job = arg;
-	fibril_usleep(20000);
-	usb_log_debug("RH(%p-%u): Stopping resume", job->hub, job->port);
-	EHCI_CLR(job->hub->registers->portsc[job->port],
-	    USB_PORTSC_RESUME_FLAG);
-	job->hub->resume_flag[job->port] = true;
-	ehci_rh_interrupt(job->hub);
-	free(job);
-	return 0;
-}
-
-static errno_t delayed_job(errno_t (*func)(void *), ehci_rh_t *rh, unsigned port)
-{
-	ehci_rh_job_t *job = malloc(sizeof(*job));
-	if (!job)
-		return ENOMEM;
-	job->hub = rh;
-	job->port = port;
-	fid_t fib = fibril_create(func, job);
-	if (!fib) {
-		free(job);
-		return ENOMEM;
-	}
-	fibril_add_ready(fib);
-	usb_log_debug2("RH(%p-%u): Scheduled delayed stop job.", rh, port);
-	return EOK;
-}
-
-/** Port clear feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ehci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	/* Enabled features to clear: see page 269 of USB specs */
-	switch (feature) {
-	case USB_HUB_FEATURE_PORT_POWER:          /* 8 */
-		usb_log_debug2("RH(%p-%u): Clear port power.", hub, port);
-		EHCI_CLR(hub->registers->portsc[port],
-		    USB_PORTSC_PORT_POWER_FLAG);
-		return EOK;
-
-	case USB2_HUB_FEATURE_PORT_ENABLE:         /* 1 */
-		usb_log_debug2("RH(%p-%u): Clear port enable.", hub, port);
-		EHCI_CLR(hub->registers->portsc[port],
-		    USB_PORTSC_ENABLED_FLAG);
-		return EOK;
-
-	case USB2_HUB_FEATURE_PORT_SUSPEND:        /* 2 */
-		usb_log_debug2("RH(%p-%u): Clear port suspend.", hub, port);
-		/* If not in suspend it's noop */
-		if ((EHCI_RD(hub->registers->portsc[port]) &
-		    USB_PORTSC_SUSPEND_FLAG) == 0)
-			return EOK;
-		/* Host driven resume */
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_RESUME_FLAG);
-		//TODO: What if creating the delayed job fails?
-		return delayed_job(stop_resume, hub, port);
-
-	case USB_HUB_FEATURE_C_PORT_CONNECTION:   /* 16 */
-		usb_log_debug2("RH(%p-%u): Clear port connection change.",
-		    hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_CONNECT_CH_FLAG);
-		return EOK;
-	case USB2_HUB_FEATURE_C_PORT_ENABLE:       /* 17 */
-		usb_log_debug2("RH(%p-%u): Clear port enable change.",
-		    hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_CONNECT_CH_FLAG);
-		return EOK;
-	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19 */
-		usb_log_debug2("RH(%p-%u): Clear port OC change.",
-		    hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_OC_CHANGE_FLAG);
-		return EOK;
-	case USB2_HUB_FEATURE_C_PORT_SUSPEND:      /* 18 */
-		usb_log_debug2("RH(%p-%u): Clear port suspend change.",
-		    hub, port);
-		hub->resume_flag[port] = false;
-		return EOK;
-	case USB_HUB_FEATURE_C_PORT_RESET:        /* 20 */
-		usb_log_debug2("RH(%p-%u): Clear port reset change.",
-		    hub, port);
-		hub->reset_flag[port] = false;
-		return EOK;
-
-	default:
-		usb_log_warning("RH(%p-%u): Clear unknown feature: %u",
-		    hub, port, feature);
-		return ENOTSUP;
-	}
-}
-
-/** Port set feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ehci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	switch (feature) {
-	case USB2_HUB_FEATURE_PORT_ENABLE:  /* 1 */
-		usb_log_debug2("RH(%p-%u): Set port enable.", hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_ENABLED_FLAG);
-		return EOK;
-	case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */
-		usb_log_debug2("RH(%p-%u): Set port suspend.", hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_SUSPEND_FLAG);
-		return EOK;
-	case USB_HUB_FEATURE_PORT_RESET:   /* 4 */
-		usb_log_debug2("RH(%p-%u): Set port reset.", hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_PORT_RESET_FLAG);
-		//TODO: What if creating the delayed job fails?
-		return delayed_job(stop_reset, hub, port);
-	case USB_HUB_FEATURE_PORT_POWER:   /* 8 */
-		usb_log_debug2("RH(%p-%u): Set port power.", hub, port);
-		EHCI_SET(hub->registers->portsc[port],
-		    USB_PORTSC_PORT_POWER_FLAG);
-		return EOK;
-	default:
-		usb_log_warning("RH(%p-%u): Set unknown feature: %u",
-		    hub, port, feature);
-		return ENOTSUP;
-	}
-}
-
-/** Status change handler.
- * @param device Virtual hub device
- * @param endpoint Endpoint number
- * @param tr_type Transfer type
- * @param buffer Response destination
- * @param buffer_size Bytes available in buffer
- * @param actual_size Size us the used part of the dest buffer.
- *
- * Produces status mask. Bit 0 indicates hub status change the other bits
- * represent port status change. Endian does not matter as UHCI root hubs
- * only need 1 byte.
- */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
-    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
-    void *buffer, size_t buffer_size, size_t *actual_size)
-{
-	ehci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-
-	if (buffer_size < STATUS_BYTES(hub->port_count))
-		return ESTALL;
-
-	uint16_t mask = 0;
-	for (unsigned port = 0; port < hub->port_count; ++port) {
-		/* Write-clean bits are those that indicate change */
-		uint32_t status = EHCI_RD(hub->registers->portsc[port]);
-		if ((status & USB_PORTSC_WC_MASK) || hub->reset_flag[port]) {
-			/* Ignore new LS device */
-			if ((status & USB_PORTSC_CONNECT_CH_FLAG) &&
-			    (status & USB_PORTSC_LINE_STATUS_MASK) ==
-			    USB_PORTSC_LINE_STATUS_K)
-				EHCI_SET(hub->registers->portsc[port],
-				    USB_PORTSC_PORT_OWNER_FLAG);
-			else
-				mask |= (2 << port);
-		}
-	}
-
-	usb_log_debug2("RH(%p): root hub interrupt mask: %" PRIx16, hub, mask);
-
-	if (mask == 0)
-		return ENAK;
-	mask = uint16_host2usb(mask);
-	memcpy(buffer, &mask, STATUS_BYTES(hub->port_count));
-	*actual_size = STATUS_BYTES(hub->port_count);
-	return EOK;
-}
-
-/** EHCI root hub request handlers */
-static const usbvirt_control_request_handler_t control_transfer_handlers[] = {
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
-		.name = "GetHubDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearHubFeature",
-		.callback = req_clear_hub_feature,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearPortFeature",
-		.callback = req_clear_port_feature,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetHubStatus",
-		.callback = req_get_status,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetHubFeature",
-		.callback = req_nop,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetPortFeature",
-		.callback = req_set_port_feature,
-	},
-	{
-		.callback = NULL
-	}
-};
-
-/** Virtual EHCI root hub ops */
-static usbvirt_device_ops_t ops = {
-	.control = control_transfer_handlers,
-	.data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,
-};
Index: pace/drv/bus/usb/ehci/ehci_rh.h
===================================================================
--- uspace/drv/bus/usb/ehci/ehci_rh.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_EHCI_RH_H
-#define DRV_EHCI_EHCI_RH_H
-
-#include <assert.h>
-#include <stdint.h>
-
-#include <usb/usb.h>
-#include <usb/classes/hub.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usbvirt/virthub_base.h>
-
-#include "ehci_regs.h"
-
-enum {
-	EHCI_MAX_PORTS = 15,
-};
-
-typedef struct {
-	/** Virtual hub instance */
-	virthub_base_t base;
-	/** EHCI device registers */
-	ehci_regs_t *registers;
-	/** Number of downstream ports, EHCI limits this to 15 */
-	unsigned port_count;
-	/** USB hub descriptor describing the EHCI root hub */
-	struct {
-		usb_hub_descriptor_header_t header;
-		uint8_t rempow[STATUS_BYTES(EHCI_MAX_PORTS) * 2];
-	} __attribute__((packed)) hub_descriptor;
-	bool reset_flag[EHCI_MAX_PORTS];
-	bool resume_flag[EHCI_MAX_PORTS];
-
-	/* HC guard */
-	fibril_mutex_t *guard;
-
-	/*
-	 * This is sort of hacky, but better than duplicating functionality.
-	 * We cannot simply store a pointer to a transfer in-progress, in order
-	 * to allow it to be aborted. We can however store a reference to the
-	 * Status Change Endpoint. Note that this is mixing two worlds together
-	 * - otherwise, the RH is "a device" and have no clue about HC, apart
-	 * from accessing its registers.
-	 */
-	endpoint_t *status_change_endpoint;
-
-} ehci_rh_t;
-
-errno_t ehci_rh_init(ehci_rh_t *instance, ehci_caps_regs_t *caps,
-    ehci_regs_t *regs, fibril_mutex_t *guard, const char *name);
-errno_t ehci_rh_schedule(ehci_rh_t *instance, usb_transfer_batch_t *batch);
-errno_t ehci_rh_interrupt(ehci_rh_t *instance);
-
-/** Get EHCI rh address.
- *
- * @param instance UHCI rh instance.
- * @return USB address assigned to the hub.
- * Wrapper for virtual hub address
- */
-static inline usb_address_t ehci_rh_get_address(ehci_rh_t *instance)
-{
-	assert(instance);
-	return virthub_base_get_address(&instance->base);
-}
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/endpoint_list.c
===================================================================
--- uspace/drv/bus/usb/ehci/endpoint_list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver transfer list implementation
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <barrier.h>
-
-#include <usb/debug.h>
-
-#include "endpoint_list.h"
-
-/** Initialize transfer list structures.
- *
- * @param[in] instance Memory place to use.
- * @param[in] name Name of the new list.
- * @return Error code
- *
- * Allocates memory for internal ed_t structure.
- */
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
-{
-	assert(instance);
-	instance->name = name;
-	if (dma_buffer_alloc(&instance->dma_buffer, sizeof(qh_t))) {
-		usb_log_error("EPL(%p-%s): Failed to allocate list head.",
-		    instance, name);
-		return ENOMEM;
-	}
-	instance->list_head = instance->dma_buffer.virt;
-	qh_init(instance->list_head, NULL);
-
-	list_initialize(&instance->endpoint_list);
-	fibril_mutex_initialize(&instance->guard);
-
-	usb_log_debug2("EPL(%p-%s): Transfer list setup with ED: %p(%" PRIxn ").",
-	    instance, name, instance->list_head,
-	    addr_to_phys(instance->list_head));
-
-	return EOK;
-}
-
-void endpoint_list_chain(endpoint_list_t *instance, const endpoint_list_t *next)
-{
-	assert(instance);
-	assert(next);
-	assert(instance->list_head);
-	assert(next->list_head);
-
-	usb_log_debug2("EPL(%p-%s): Chained with EPL(%p-%s).",
-	    instance, instance->name, next, next->name);
-
-	qh_append_qh(instance->list_head, next->list_head);
-}
-
-/** Add endpoint to the end of the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] endpoint Endpoint to add.
- *
- * The endpoint is added to the end of the list and queue.
- */
-void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep)
-{
-	assert(instance);
-	assert(instance->list_head);
-	assert(ep);
-	assert(ep->qh);
-	usb_log_debug2("EPL(%p-%s): Append endpoint(%p).",
-	    instance, instance->name, ep);
-
-	fibril_mutex_lock(&instance->guard);
-
-	qh_t *last_qh = NULL;
-	/* Add to the hardware queue. */
-	if (list_empty(&instance->endpoint_list)) {
-		/* There are no active EDs */
-		last_qh = instance->list_head;
-	} else {
-		/* There are active EDs, get the last one */
-		ehci_endpoint_t *last = ehci_endpoint_list_instance(
-		    list_last(&instance->endpoint_list));
-		last_qh = last->qh;
-	}
-	assert(last_qh);
-	/* Keep link, this might point to the queue QH, or next chained queue */
-	ep->qh->horizontal = last_qh->horizontal;
-	/* Make sure QH update is written to the memory */
-	write_barrier();
-
-	/* Add QH to the hw queue */
-	qh_append_qh(last_qh, ep->qh);
-	/* Make sure QH is updated */
-	write_barrier();
-	/* Add to the sw list */
-	list_append(&ep->eplist_link, &instance->endpoint_list);
-
-	ehci_endpoint_t *first = ehci_endpoint_list_instance(
-	    list_first(&instance->endpoint_list));
-	usb_log_debug("EPL(%p-%s): EP(%p) added to list, first is %p(%p).",
-	    instance, instance->name, ep, first, first->qh);
-	if (last_qh == instance->list_head) {
-		usb_log_debug2("EPL(%p-%s): head EP(%p-%" PRIxn "): %x:%x.",
-		    instance, instance->name, last_qh,
-		    addr_to_phys(instance->list_head),
-		    last_qh->status, last_qh->horizontal);
-	}
-	fibril_mutex_unlock(&instance->guard);
-}
-
-/** Remove endpoint from the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] endpoint Endpoint to remove.
- */
-void endpoint_list_remove_ep(endpoint_list_t *instance, ehci_endpoint_t *ep)
-{
-	assert(instance);
-	assert(instance->list_head);
-	assert(ep);
-	assert(ep->qh);
-
-	fibril_mutex_lock(&instance->guard);
-
-	usb_log_debug2("EPL(%p-%s): removing EP(%p).",
-	    instance, instance->name, ep);
-
-	const char *qpos = NULL;
-	qh_t *prev_qh;
-	/* Remove from the hardware queue */
-	if (list_first(&instance->endpoint_list) == &ep->eplist_link) {
-		/* I'm the first one here */
-		prev_qh = instance->list_head;
-		qpos = "FIRST";
-	} else {
-		prev_qh = ehci_endpoint_list_instance(ep->eplist_link.prev)->qh;
-		qpos = "NOT FIRST";
-	}
-	assert(qh_next(prev_qh) == addr_to_phys(ep->qh));
-	prev_qh->horizontal = ep->qh->horizontal;
-	/* Make sure ED is updated */
-	write_barrier();
-
-	usb_log_debug("EPL(%p-%s): EP(%p) removed (%s), horizontal %x.",
-	    instance, instance->name,  ep, qpos, ep->qh->horizontal);
-
-	/* Remove from the endpoint list */
-	list_remove(&ep->eplist_link);
-	fibril_mutex_unlock(&instance->guard);
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/endpoint_list.h
===================================================================
--- uspace/drv/bus/usb/ehci/endpoint_list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver transfer list structure
- */
-#ifndef DRV_EHCI_ENDPOINT_LIST_H
-#define DRV_EHCI_ENDPOINT_LIST_H
-
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-
-#include "ehci_bus.h"
-#include "hw_struct/queue_head.h"
-
-/** Structure maintains both EHCI queue and software list of active endpoints. */
-typedef struct endpoint_list {
-	/** Guard against add/remove races */
-	fibril_mutex_t guard;
-	/** EHCI hw structure at the beginning of the queue */
-	qh_t *list_head;
-	dma_buffer_t dma_buffer;
-	/** Assigned name, provides nicer debug output */
-	const char *name;
-	/** Sw list of all active EDs */
-	list_t endpoint_list;
-} endpoint_list_t;
-
-/** Dispose transfer list structures.
- *
- * @param[in] instance Memory place to use.
- *
- * Frees memory of the internal ed_t structure.
- */
-static inline void endpoint_list_fini(endpoint_list_t *instance)
-{
-	assert(instance);
-	dma_buffer_free(&instance->dma_buffer);
-	instance->list_head = NULL;
-}
-
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
-void endpoint_list_chain(endpoint_list_t *instance, const endpoint_list_t *next);
-void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep);
-void endpoint_list_remove_ep(endpoint_list_t *instance, ehci_endpoint_t *ep);
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hc.c
===================================================================
--- uspace/drv/bus/usb/ehci/hc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,568 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI Host controller driver routines
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str_error.h>
-
-#include <usb/debug.h>
-#include <usb/usb.h>
-#include <usb/host/utility.h>
-
-#include "ehci_batch.h"
-
-#include "hc.h"
-
-#define EHCI_USED_INTERRUPTS \
-    (USB_INTR_IRQ_FLAG | USB_INTR_ERR_IRQ_FLAG | USB_INTR_PORT_CHANGE_FLAG | \
-    USB_INTR_ASYNC_ADVANCE_FLAG | USB_INTR_HOST_ERR_FLAG)
-
-static const irq_pio_range_t ehci_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(ehci_regs_t)
-	}
-};
-
-static const irq_cmd_t ehci_irq_commands[] = {
-	{
-		.cmd = CMD_PIO_READ_32,
-		.dstarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 1,
-		.dstarg = 2,
-		.value = 0
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 2,
-		.value = 2
-	},
-	{
-		.cmd = CMD_PIO_WRITE_A_32,
-		.srcarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static errno_t hc_init_memory(hc_t *instance);
-
-/** Generate IRQ code.
- * @param[out] ranges PIO ranges buffer.
- * @param[in] hw_res Device's resources.
- *
- * @param[out] irq
- *
- * @return Error code.
- */
-errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)
-{
-	assert(code);
-	assert(hw_res);
-	hc_t *instance = hcd_to_hc(hcd);
-
-	if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
-		return EINVAL;
-
-	addr_range_t regs = hw_res->mem_ranges.ranges[0];
-
-	if (RNGSZ(regs) < sizeof(ehci_regs_t))
-		return EOVERFLOW;
-
-	code->ranges = malloc(sizeof(ehci_pio_ranges));
-	if (code->ranges == NULL)
-		return ENOMEM;
-
-	code->cmds = malloc(sizeof(ehci_irq_commands));
-	if (code->cmds == NULL) {
-		free(code->ranges);
-		return ENOMEM;
-	}
-
-	code->rangecount = ARRAY_SIZE(ehci_pio_ranges);
-	code->cmdcount = ARRAY_SIZE(ehci_irq_commands);
-
-	memcpy(code->ranges, ehci_pio_ranges, sizeof(ehci_pio_ranges));
-	code->ranges[0].base = RNGABS(regs);
-
-	memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
-
-	ehci_regs_t *registers =
-	    (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(instance->caps->caplength));
-	code->cmds[0].addr = (void *) &registers->usbsts;
-	code->cmds[3].addr = (void *) &registers->usbsts;
-	EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS);
-
-	usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.",
-	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
-
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
-}
-
-/** Initialize EHCI hc driver structure
- *
- * @param[in] instance Memory place for the structure.
- * @param[in] regs Device's I/O registers range.
- * @param[in] interrupts True if w interrupts should be used
- * @return Error code
- */
-errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	assert(hw_res);
-	if (hw_res->mem_ranges.count != 1 ||
-	    hw_res->mem_ranges.ranges[0].size <
-	    (sizeof(ehci_caps_regs_t) + sizeof(ehci_regs_t)))
-		return EINVAL;
-
-	errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
-	    (void **)&instance->caps);
-	if (ret != EOK) {
-		usb_log_error("HC(%p): Failed to gain access to device "
-		    "registers: %s.", instance, str_error(ret));
-		return ret;
-	}
-
-	usb_log_info("HC(%p): Device registers at %" PRIx64 " (%zuB) accessible.",
-	    instance, hw_res->mem_ranges.ranges[0].address.absolute,
-	    hw_res->mem_ranges.ranges[0].size);
-	instance->registers =
-	    (void *)instance->caps + EHCI_RD8(instance->caps->caplength);
-	usb_log_info("HC(%p): Device control registers at %" PRIx64, instance,
-	    hw_res->mem_ranges.ranges[0].address.absolute +
-	    EHCI_RD8(instance->caps->caplength));
-
-	list_initialize(&instance->pending_endpoints);
-	fibril_mutex_initialize(&instance->guard);
-	fibril_condvar_initialize(&instance->async_doorbell);
-
-	ret = hc_init_memory(instance);
-	if (ret != EOK) {
-		usb_log_error("HC(%p): Failed to create EHCI memory structures:"
-		    " %s.", instance, str_error(ret));
-		return ret;
-	}
-
-	usb_log_info("HC(%p): Initializing RH(%p).", instance, &instance->rh);
-	ehci_rh_init(
-	    &instance->rh, instance->caps, instance->registers, &instance->guard,
-	    "ehci rh");
-
-	ehci_bus_init(&instance->bus, instance);
-	hc_device_setup(hcd, (bus_t *) &instance->bus);
-	return EOK;
-}
-
-/** Safely dispose host controller internal structures
- *
- * @param[in] instance Host controller structure to use.
- */
-int hc_gone(hc_device_t *hcd)
-{
-	hc_t *hc = hcd_to_hc(hcd);
-	endpoint_list_fini(&hc->async_list);
-	endpoint_list_fini(&hc->int_list);
-	dma_buffer_free(&hc->dma_buffer);
-	return EOK;
-}
-
-/** Quiesce host controller
- *
- * @param hcd Host controller device
- */
-int hc_quiesce(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-
-	/*
-	 * Turn off the HC if it's running, Reseting a running device is
-	 * undefined
-	 */
-	if (!(EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG)) {
-		/* disable all interrupts */
-		EHCI_WR(instance->registers->usbintr, 0);
-		/* ack all interrupts */
-		EHCI_WR(instance->registers->usbsts, 0x3f);
-		/* Stop HC hw */
-		EHCI_WR(instance->registers->usbcmd, 0);
-		/* Wait until hc is halted */
-		while ((EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG) == 0) {
-			fibril_usleep(1);
-		}
-		usb_log_info("HC(%p): EHCI turned off.", instance);
-	} else {
-		usb_log_info("HC(%p): EHCI was not running.", instance);
-	}
-
-	/* Hw initialization sequence, see page 53 (pdf 63) */
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_HC_RESET_FLAG);
-	usb_log_info("HC(%p): Waiting for HW reset.", instance);
-	while (EHCI_RD(instance->registers->usbcmd) & USB_CMD_HC_RESET_FLAG) {
-		fibril_usleep(1);
-	}
-	usb_log_debug("HC(%p): HW reset OK.", instance);
-
-	return EOK;
-}
-
-void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
-{
-	assert(instance);
-	assert(ep);
-	ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
-	usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)", instance,
-	    ep->device->address, ep->endpoint,
-	    usb_str_transfer_type_short(ep->transfer_type),
-	    usb_str_direction(ep->direction));
-	switch (ep->transfer_type) {
-	case USB_TRANSFER_CONTROL:
-	case USB_TRANSFER_BULK:
-		endpoint_list_append_ep(&instance->async_list, ehci_ep);
-		break;
-	case USB_TRANSFER_INTERRUPT:
-		endpoint_list_append_ep(&instance->int_list, ehci_ep);
-		break;
-	case USB_TRANSFER_ISOCHRONOUS:
-		/* NOT SUPPORTED */
-		break;
-	}
-}
-
-void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
-{
-	assert(instance);
-	assert(ep);
-	ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
-	usb_log_debug("HC(%p) dequeue EP(%d:%d:%s:%s)", instance,
-	    ep->device->address, ep->endpoint,
-	    usb_str_transfer_type_short(ep->transfer_type),
-	    usb_str_direction(ep->direction));
-	switch (ep->transfer_type) {
-	case USB_TRANSFER_INTERRUPT:
-		endpoint_list_remove_ep(&instance->int_list, ehci_ep);
-		/* Fall through */
-	case USB_TRANSFER_ISOCHRONOUS:
-		/* NOT SUPPORTED */
-		return;
-	case USB_TRANSFER_CONTROL:
-	case USB_TRANSFER_BULK:
-		endpoint_list_remove_ep(&instance->async_list, ehci_ep);
-		break;
-	}
-	fibril_mutex_lock(&instance->guard);
-	usb_log_debug("HC(%p): Waiting for doorbell", instance);
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_IRQ_ASYNC_DOORBELL);
-	fibril_condvar_wait(&instance->async_doorbell, &instance->guard);
-	usb_log_debug2("HC(%p): Got doorbell", instance);
-	fibril_mutex_unlock(&instance->guard);
-}
-
-errno_t ehci_hc_status(bus_t *bus_base, uint32_t *status)
-{
-	assert(bus_base);
-	assert(status);
-
-	ehci_bus_t *bus = (ehci_bus_t *) bus_base;
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	*status = 0;
-	if (hc->registers) {
-		*status = EHCI_RD(hc->registers->usbsts);
-		EHCI_WR(hc->registers->usbsts, *status);
-	}
-	usb_log_debug2("HC(%p): Read status: %x", hc, *status);
-	return EOK;
-}
-
-/** Add USB transfer to the schedule.
- *
- * @param[in] hcd HCD driver structure.
- * @param[in] batch Batch representing the transfer.
- * @return Error code.
- */
-errno_t ehci_hc_schedule(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-
-	ehci_bus_t *bus = (ehci_bus_t *) endpoint_get_bus(batch->ep);
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	/* Check for root hub communication */
-	if (batch->target.address == ehci_rh_get_address(&hc->rh)) {
-		usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)",
-		    hc, batch, &hc->rh);
-		return ehci_rh_schedule(&hc->rh, batch);
-	}
-
-	endpoint_t *const ep = batch->ep;
-	ehci_endpoint_t *const ehci_ep = ehci_endpoint_get(ep);
-	ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch);
-
-	int err;
-
-	if ((err = ehci_transfer_batch_prepare(ehci_batch)))
-		return err;
-
-	fibril_mutex_lock(&hc->guard);
-
-	if ((err = endpoint_activate_locked(ep, batch))) {
-		fibril_mutex_unlock(&hc->guard);
-		return err;
-	}
-
-	usb_log_debug("HC(%p): Committing BATCH(%p)", hc, batch);
-	ehci_transfer_batch_commit(ehci_batch);
-
-	/* Enqueue endpoint to the checked list */
-	usb_log_debug2("HC(%p): Appending BATCH(%p)", hc, batch);
-	list_append(&ehci_ep->pending_link, &hc->pending_endpoints);
-
-	fibril_mutex_unlock(&hc->guard);
-	return EOK;
-}
-
-/** Interrupt handling routine
- *
- * @param[in] hcd HCD driver structure.
- * @param[in] status Value of the status register at the time of interrupt.
- */
-void ehci_hc_interrupt(bus_t *bus_base, uint32_t status)
-{
-	assert(bus_base);
-
-	ehci_bus_t *bus = (ehci_bus_t *) bus_base;
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	usb_log_debug2("HC(%p): Interrupt: %" PRIx32, hc, status);
-	if (status & USB_STS_PORT_CHANGE_FLAG) {
-		ehci_rh_interrupt(&hc->rh);
-	}
-
-	if (status & USB_STS_IRQ_ASYNC_ADVANCE_FLAG) {
-		fibril_mutex_lock(&hc->guard);
-		usb_log_debug2("HC(%p): Signaling doorbell", hc);
-		fibril_condvar_broadcast(&hc->async_doorbell);
-		fibril_mutex_unlock(&hc->guard);
-	}
-
-	if (status & (USB_STS_IRQ_FLAG | USB_STS_ERR_IRQ_FLAG)) {
-		fibril_mutex_lock(&hc->guard);
-
-		usb_log_debug2("HC(%p): Scanning %zu pending endpoints", hc,
-		    list_count(&hc->pending_endpoints));
-		list_foreach_safe(hc->pending_endpoints, current, next) {
-			ehci_endpoint_t *ep =
-			    list_get_instance(current, ehci_endpoint_t, pending_link);
-
-			ehci_transfer_batch_t *batch =
-			    ehci_transfer_batch_get(ep->base.active_batch);
-			assert(batch);
-
-			if (ehci_transfer_batch_check_completed(batch)) {
-				endpoint_deactivate_locked(&ep->base);
-				list_remove(current);
-				hc_reset_toggles(&batch->base, &ehci_ep_toggle_reset);
-				usb_transfer_batch_finish(&batch->base);
-			}
-		}
-		fibril_mutex_unlock(&hc->guard);
-
-	}
-
-	if (status & USB_STS_HOST_ERROR_FLAG) {
-		usb_log_fatal("HCD(%p): HOST SYSTEM ERROR!", hc);
-		//TODO do something here
-	}
-}
-
-/** EHCI hw initialization routine.
- *
- * @param[in] instance EHCI hc driver structure.
- */
-int hc_start(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	usb_log_debug("HC(%p): Starting HW.", instance);
-
-	/*
-	 * Turn off the HC if it's running, Reseting a running device is
-	 * undefined
-	 */
-	if (!(EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG)) {
-		/* disable all interrupts */
-		EHCI_WR(instance->registers->usbintr, 0);
-		/* ack all interrupts */
-		EHCI_WR(instance->registers->usbsts, 0x3f);
-		/* Stop HC hw */
-		EHCI_WR(instance->registers->usbcmd, 0);
-		/* Wait until hc is halted */
-		while ((EHCI_RD(instance->registers->usbsts) & USB_STS_HC_HALTED_FLAG) == 0) {
-			fibril_usleep(1);
-		}
-		usb_log_info("HC(%p): EHCI turned off.", instance);
-	} else {
-		usb_log_info("HC(%p): EHCI was not running.", instance);
-	}
-
-	/* Hw initialization sequence, see page 53 (pdf 63) */
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_HC_RESET_FLAG);
-	usb_log_info("HC(%p): Waiting for HW reset.", instance);
-	while (EHCI_RD(instance->registers->usbcmd) & USB_CMD_HC_RESET_FLAG) {
-		fibril_usleep(1);
-	}
-	usb_log_debug("HC(%p): HW reset OK.", instance);
-
-	/* Use the lowest 4G segment */
-	EHCI_WR(instance->registers->ctrldssegment, 0);
-
-	/* Enable periodic list */
-	assert(instance->periodic_list);
-	uintptr_t phys_base =
-	    addr_to_phys((void *)instance->periodic_list);
-	assert((phys_base & USB_PERIODIC_LIST_BASE_MASK) == phys_base);
-	EHCI_WR(instance->registers->periodiclistbase, phys_base);
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_PERIODIC_SCHEDULE_FLAG);
-	usb_log_debug("HC(%p): Enabled periodic list.", instance);
-
-	/* Enable Async schedule */
-	phys_base = addr_to_phys((void *)instance->async_list.list_head);
-	assert((phys_base & USB_ASYNCLIST_MASK) == phys_base);
-	EHCI_WR(instance->registers->asynclistaddr, phys_base);
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_ASYNC_SCHEDULE_FLAG);
-	usb_log_debug("HC(%p): Enabled async list.", instance);
-
-	/* Start hc and get all ports */
-	EHCI_SET(instance->registers->usbcmd, USB_CMD_RUN_FLAG);
-	EHCI_SET(instance->registers->configflag, USB_CONFIG_FLAG_FLAG);
-	usb_log_debug("HC(%p): HW started.", instance);
-
-	usb_log_debug2("HC(%p): Registers: "
-	    "\tUSBCMD(%p): %x(0x00080000 = at least 1ms between interrupts)"
-	    "\tUSBSTS(%p): %x(0x00001000 = HC halted)"
-	    "\tUSBINT(%p): %x(0x0 = no interrupts)."
-	    "\tCONFIG(%p): %x(0x0 = ports controlled by companion hc).",
-	    instance,
-	    &instance->registers->usbcmd, EHCI_RD(instance->registers->usbcmd),
-	    &instance->registers->usbsts, EHCI_RD(instance->registers->usbsts),
-	    &instance->registers->usbintr, EHCI_RD(instance->registers->usbintr),
-	    &instance->registers->configflag, EHCI_RD(instance->registers->configflag));
-	/* Clear and Enable interrupts */
-	EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts));
-	EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS);
-
-	return EOK;
-}
-
-/**
- * Setup roothub as a virtual hub.
- */
-int hc_setup_roothub(hc_device_t *hcd)
-{
-	return hc_setup_virtual_root_hub(hcd, USB_SPEED_HIGH);
-}
-
-/** Initialize memory structures used by the EHCI hcd.
- *
- * @param[in] instance EHCI hc driver structure.
- * @return Error code.
- */
-errno_t hc_init_memory(hc_t *instance)
-{
-	assert(instance);
-	usb_log_debug2("HC(%p): Initializing Async list(%p).", instance,
-	    &instance->async_list);
-	errno_t ret = endpoint_list_init(&instance->async_list, "ASYNC");
-	if (ret != EOK) {
-		usb_log_error("HC(%p): Failed to setup ASYNC list: %s",
-		    instance, str_error(ret));
-		return ret;
-	}
-	/*
-	 * Specs say "Software must set queue head horizontal pointer T-bits to
-	 * a zero for queue heads in the asynchronous schedule" (4.4.0).
-	 * So we must maintain circular buffer (all horizontal pointers
-	 * have to be valid
-	 */
-	endpoint_list_chain(&instance->async_list, &instance->async_list);
-
-	usb_log_debug2("HC(%p): Initializing Interrupt list (%p).", instance,
-	    &instance->int_list);
-	ret = endpoint_list_init(&instance->int_list, "INT");
-	if (ret != EOK) {
-		usb_log_error("HC(%p): Failed to setup INT list: %s",
-		    instance, str_error(ret));
-		endpoint_list_fini(&instance->async_list);
-		return ret;
-	}
-
-	/* Take 1024 periodic list heads, we ignore low mem options */
-	if (dma_buffer_alloc(&instance->dma_buffer, PAGE_SIZE)) {
-		usb_log_error("HC(%p): Failed to get ISO schedule page.",
-		    instance);
-		endpoint_list_fini(&instance->async_list);
-		endpoint_list_fini(&instance->int_list);
-		return ENOMEM;
-	}
-	instance->periodic_list = instance->dma_buffer.virt;
-
-	usb_log_debug2("HC(%p): Initializing Periodic list.", instance);
-	for (unsigned i = 0; i < PAGE_SIZE / sizeof(link_pointer_t); ++i) {
-		/* Disable everything for now */
-		instance->periodic_list[i] =
-		    LINK_POINTER_QH(addr_to_phys(instance->int_list.list_head));
-	}
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hc.h
===================================================================
--- uspace/drv/bus/usb/ehci/hc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI host controller driver structure
- */
-#ifndef DRV_EHCI_HC_H
-#define DRV_EHCI_HC_H
-
-#include <adt/list.h>
-#include <ddi.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include <usb/host/hcd.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/usb_transfer_batch.h>
-
-#include "ehci_regs.h"
-#include "ehci_rh.h"
-#include "hw_struct/link_pointer.h"
-#include "endpoint_list.h"
-
-/** Main EHCI driver structure */
-typedef struct hc {
-	/* Common device header */
-	hc_device_t base;
-
-	/** Memory mapped CAPS register area */
-	ehci_caps_regs_t *caps;
-	/** Memory mapped I/O registers area */
-	ehci_regs_t *registers;
-
-	/** Iso transfer list, backed by dma_buffer */
-	link_pointer_t *periodic_list;
-
-	dma_buffer_t dma_buffer;
-
-	/** CONTROL and BULK schedules */
-	endpoint_list_t async_list;
-
-	/** INT schedule */
-	endpoint_list_t int_list;
-
-	/** List of active transfers */
-	list_t pending_endpoints;
-
-	/** Guards schedule and endpoint manipulation */
-	fibril_mutex_t guard;
-
-	/** Wait for hc to restart async chedule */
-	fibril_condvar_t async_doorbell;
-
-	/** USB hub emulation structure */
-	ehci_rh_t rh;
-
-	/** USB bookkeeping */
-	ehci_bus_t bus;
-} hc_t;
-
-static inline hc_t *hcd_to_hc(hc_device_t *hcd)
-{
-	assert(hcd);
-	return (hc_t *) hcd;
-}
-
-void hc_enqueue_endpoint(hc_t *, const endpoint_t *);
-void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
-
-/* Boottime operations */
-extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *);
-extern errno_t hc_start(hc_device_t *);
-extern errno_t hc_setup_roothub(hc_device_t *);
-extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *,
-    const hw_res_list_parsed_t *, int *);
-extern errno_t hc_gone(hc_device_t *);
-extern errno_t hc_quiesce(hc_device_t *);
-
-/** Runtime operations */
-extern void ehci_hc_interrupt(bus_t *, uint32_t);
-extern errno_t ehci_hc_status(bus_t *, uint32_t *);
-extern errno_t ehci_hc_schedule(usb_transfer_batch_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/fstn.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/fstn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_FSTN_H
-#define DRV_EHCI_HW_STRUCT_FSTN_H
-
-#include "link_pointer.h"
-
-typedef struct fstn {
-	link_pointer_t normal_path;
-	link_pointer_t back_path;
-} fstn_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/iso_transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/iso_transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
-#define DRV_EHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
-
-#include <stdint.h>
-#include "link_pointer.h"
-
-/** Isochronous transfer descriptor (HS only) */
-typedef struct itd {
-	link_pointer_t next;
-
-	volatile uint32_t transaction[8];
-	volatile uint32_t buffer_pointer[7];
-
-	/* 64 bit struct only */
-	volatile uint32_t extended_bp[7];
-} __attribute__((packed, aligned(32))) itd_t;
-
-/*
- * itd_t.transaction
- */
-#define ITD_TRANSACTION_STATUS_ACTIVE_FLAG  (1 << 31)
-#define ITD_TRANSACTION_STATUS_BUFFER_ERROR_FLAG  (1 << 30)
-#define ITD_TRANSACTION_STATUS_BABBLE_FLAG   (1 << 29)
-#define ITD_TRANSACTION_STATUS_TRANS_ERROR_FLAG  (1 << 28)
-#define ITD_TRANSACTION_LENGTH_MASK    0xfff
-#define ITD_TRANSACTION_LENGTH_SHIFT   16
-#define ITD_TRANSACTION_IOC_FLAG       (1 << 15)
-#define ITD_TRANSACTION_PG_MASK        0x3
-#define ITD_TRANSACTION_PG_SHIFT       12
-#define ITD_TRANSACTION_OFFSET_MASK    0xfff
-#define ITD_TRANSACTION_OFFSET_SHIFT   0
-
-/*
- * itd_t.buffer_pointer
- */
-#define ITD_BUFFER_POINTER_MASK      0xfffff000
-/* First buffer pointer */
-#define ITD_BUFFER_POINTER_EP_MASK      0xf
-#define ITD_BUFFER_POINTER_EP_SHIFT     8
-#define ITD_BUFFER_POINTER_ADDR_MASK    0x3f
-#define ITD_BUFFER_POINTER_ADDR_SHIFT   0
-/* Second buffer pointer */
-#define ITD_BUFFER_POINTER_IN_FLAG            (1 << 11)
-#define ITD_BUFFER_POINTER_MAX_PACKET_MASK    0x3ff
-#define ITD_BUFFER_POINTER_MAX_PACKET_SHIFT   0
-/* Third buffer pointer */
-#define ITD_BUFFER_POINTER_MULTI_MASK    0x3
-#define ITD_BUFFER_POINTER_MULTI_SHIFT   0
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/link_pointer.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/link_pointer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_LINK_POINTER_H
-#define DRV_EHCI_HW_STRUCT_LINK_POINTER_H
-
-#include <stdint.h>
-
-/** EHCI link pointer, used by many data structures */
-typedef volatile uint32_t link_pointer_t;
-
-#define LINK_POINTER_ADDRESS_MASK   0xfffffff0 /* upper 28 bits */
-
-#define LINK_POINTER_TERMINATE_FLAG   (1 << 0)
-
-enum {
-	LINK_POINTER_TYPE_iTD  = 0x0 << 1,
-	LINK_POINTER_TYPE_QH   = 0x1 << 1,
-	LINK_POINTER_TYPE_siTD = 0x2 << 1,
-	LINK_POINTER_TYPE_FSTN = 0x3 << 1,
-	LINK_POINTER_TYPE_MASK = 0x3 << 1,
-};
-
-#define LINK_POINTER_QH(address) \
-	((address & LINK_POINTER_ADDRESS_MASK) | LINK_POINTER_TYPE_QH)
-
-#define LINK_POINTER_TD(address) \
-	(address & LINK_POINTER_ADDRESS_MASK)
-
-#define LINK_POINTER_TERM \
-	((link_pointer_t)LINK_POINTER_TERMINATE_FLAG)
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/mem_access.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/mem_access.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_MEM_ACCESS_H
-#define DRV_EHCI_HW_MEM_ACCESS_H
-
-#include <byteorder.h>
-#include <barrier.h>
-
-#define EHCI_MEM32_WR(reg, val) reg = host2uint32_t_le(val)
-#define EHCI_MEM32_RD(reg) uint32_t_le2host(reg)
-#define EHCI_MEM32_SET(reg, val) reg |= host2uint32_t_le(val)
-#define EHCI_MEM32_CLR(reg, val) reg &= host2uint32_t_le(~val)
-
-#endif
-
-/*
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/queue_head.c
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/queue_head.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-
-#include <assert.h>
-#include <usb/usb.h>
-#include <mem.h>
-#include <macros.h>
-#include <usb/host/bus.h>
-
-#include "mem_access.h"
-#include "queue_head.h"
-
-static const uint32_t speed[] = {
-	[USB_SPEED_LOW] = QH_EP_CHAR_EPS_LS,
-	[USB_SPEED_FULL] = QH_EP_CHAR_EPS_FS,
-	[USB_SPEED_HIGH] = QH_EP_CHAR_EPS_HS,
-};
-
-void qh_init(qh_t *instance, const endpoint_t *ep)
-{
-	assert(instance);
-	memset(instance, 0, sizeof(*instance));
-
-	EHCI_MEM32_WR(instance->horizontal, LINK_POINTER_TERM);
-#if 0
-	EHCI_MEM32_WR(instance->current, LINK_POINTER_TERM);
-#endif
-	EHCI_MEM32_WR(instance->next, LINK_POINTER_TERM);
-	EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM);
-	if (ep == NULL) {
-		/*
-		 * Mark as halted and list head,
-		 * used by endpoint lists as dummy
-		 */
-		EHCI_MEM32_WR(instance->ep_char, QH_EP_CHAR_H_FLAG);
-		EHCI_MEM32_WR(instance->status, QH_STATUS_HALTED_FLAG);
-		return;
-	}
-	assert(ep->device->speed < ARRAY_SIZE(speed));
-	EHCI_MEM32_WR(instance->ep_char,
-	    QH_EP_CHAR_ADDR_SET(ep->device->address) |
-	    QH_EP_CHAR_EP_SET(ep->endpoint) |
-	    speed[ep->device->speed] |
-	    QH_EP_CHAR_MAX_LENGTH_SET(ep->max_packet_size));
-	if (ep->transfer_type == USB_TRANSFER_CONTROL) {
-		if (ep->device->speed != USB_SPEED_HIGH)
-			EHCI_MEM32_SET(instance->ep_char, QH_EP_CHAR_C_FLAG);
-		/*
-		 * Let BULK and INT use queue head managed toggle,
-		 * CONTROL needs special toggle handling anyway
-		 */
-		EHCI_MEM32_SET(instance->ep_char, QH_EP_CHAR_DTC_FLAG);
-	}
-	uint32_t ep_cap = QH_EP_CAP_C_MASK_SET(3 << 2) |
-	    QH_EP_CAP_MULTI_SET(ep->packets_per_uframe);
-	if (usb_speed_is_11(ep->device->speed)) {
-		assert(ep->device->tt.dev != NULL);
-		ep_cap |=
-		    QH_EP_CAP_TT_PORT_SET(ep->device->tt.port) |
-		    QH_EP_CAP_TT_ADDR_SET(ep->device->tt.dev->address);
-	}
-	if (ep->transfer_type == USB_TRANSFER_INTERRUPT) {
-		ep_cap |= QH_EP_CAP_S_MASK_SET(3);
-	}
-
-	// TODO Figure out how to correctly use CMASK and SMASK for LS/FS
-	// INT transfers. Current values are just guesses
-	EHCI_MEM32_WR(instance->ep_cap, ep_cap);
-
-	/*
-	 * The rest of the fields are transfer working area, it should be ok to
-	 * leave it NULL
-	 */
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/queue_head.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/queue_head.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,236 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_QH_H
-#define DRV_EHCI_HW_STRUCT_QH_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "link_pointer.h"
-#include "transfer_descriptor.h"
-#include "mem_access.h"
-
-/** This structure is defined in EHCI design guide p. 46 */
-typedef struct queue_head {
-	link_pointer_t horizontal;
-
-	volatile uint32_t ep_char;
-	volatile uint32_t ep_cap;
-
-	link_pointer_t current;
-	/* Transfer overlay starts here */
-	link_pointer_t next;
-	link_pointer_t alternate;
-	volatile uint32_t status;
-	volatile uint32_t buffer_pointer[5];
-
-	/* 64 bit struct only */
-	volatile uint32_t extended_bp[5];
-} __attribute__((packed, aligned(32))) qh_t;
-
-/*
- * qh_t.ep_char
- */
-#define QH_EP_CHAR_RL_MASK    0xf
-#define QH_EP_CHAR_RL_SHIFT   28
-#define QH_EP_CHAR_C_FLAG     (1 << 27)
-#define QH_EP_CHAR_MAX_LENGTH_MASK   0x7ff
-#define QH_EP_CHAR_MAX_LENGTH_SHIFT  16
-#define QH_EP_CHAR_MAX_LENGTH_SET(len) \
-    (((len) & QH_EP_CHAR_MAX_LENGTH_MASK) << QH_EP_CHAR_MAX_LENGTH_SHIFT)
-#define QH_EP_CHAR_MAX_LENGTH_GET(val) \
-    (((val) >> QH_EP_CHAR_MAX_LENGTH_SHIFT) & QH_EP_CHAR_MAX_LENGTH_MASK)
-#define QH_EP_CHAR_H_FLAG     (1 << 15)
-#define QH_EP_CHAR_DTC_FLAG   (1 << 14)
-#define QH_EP_CHAR_EPS_FS     (0x0 << 12)
-#define QH_EP_CHAR_EPS_LS     (0x1 << 12)
-#define QH_EP_CHAR_EPS_HS     (0x2 << 12)
-#define QH_EP_CHAR_EPS_MASK   (0x3 << 12)
-#define QH_EP_CHAR_EP_MASK    0xf
-#define QH_EP_CHAR_EP_SHIFT   8
-#define QH_EP_CHAR_EP_SET(num) \
-    (((num) & QH_EP_CHAR_EP_MASK) << QH_EP_CHAR_EP_SHIFT)
-#define QH_EP_CHAR_ADDR_GET(val) \
-    (((val) >> QH_EP_CHAR_ADDR_SHIFT) & QH_EP_CHAR_ADDR_MASK)
-#define QH_EP_CHAR_INACT_FLAG (1 << 7)
-#define QH_EP_CHAR_ADDR_MASK  0x3f
-#define QH_EP_CHAR_ADDR_SHIFT 0
-#define QH_EP_CHAR_ADDR_SET(addr) \
-    (((addr) & QH_EP_CHAR_ADDR_MASK) << QH_EP_CHAR_ADDR_SHIFT)
-#define QH_EP_CHAR_ADDR_GET(val) \
-    (((val) >> QH_EP_CHAR_ADDR_SHIFT) & QH_EP_CHAR_ADDR_MASK)
-
-/*
- * qh_t.ep_cap
- */
-#define QH_EP_CAP_MULTI_MASK   0x3
-#define QH_EP_CAP_MULTI_SHIFT  30
-#define QH_EP_CAP_MULTI_SET(count) \
-	(((count) & QH_EP_CAP_MULTI_MASK) << QH_EP_CAP_MULTI_SHIFT)
-#define QH_EP_CAP_PORT_MASK    0x7f
-#define QH_EP_CAP_PORT_SHIFT   23
-#define QH_EP_CAP_TT_PORT_SET(addr) \
-	(((addr) & QH_EP_CAP_HUB_MASK) << QH_EP_CAP_HUB_SHIFT)
-#define QH_EP_CAP_HUB_MASK     0x7f
-#define QH_EP_CAP_HUB_SHIFT    16
-#define QH_EP_CAP_TT_ADDR_SET(addr) \
-	(((addr) & QH_EP_CAP_HUB_MASK) << QH_EP_CAP_HUB_SHIFT)
-#define QH_EP_CAP_C_MASK_MASK  0xff
-#define QH_EP_CAP_C_MASK_SHIFT 8
-#define QH_EP_CAP_C_MASK_SET(val) \
-	(((val) & QH_EP_CAP_C_MASK_MASK) << QH_EP_CAP_C_MASK_SHIFT)
-#define QH_EP_CAP_S_MASK_MASK  0xff
-#define QH_EP_CAP_S_MASK_SHIFT 0
-#define QH_EP_CAP_S_MASK_SET(val) \
-	(((val) & QH_EP_CAP_S_MASK_MASK) << QH_EP_CAP_S_MASK_SHIFT)
-
-/*
- * qh_t.alternate
- */
-#define QH_ALTERNATE_NACK_CNT_MASK   0x7
-#define QH_ALTERNATE_NACK_CNT_SHIFT  1
-
-/*
- * qh_t.status
- */
-#define QH_STATUS_TOGGLE_FLAG   (1 << 31)
-#define QH_STATUS_TOTAL_MASK    0x7fff
-#define QH_STATUS_TOTAL_SHIFT   16
-#define QH_STATUS_IOC_FLAG      (1 << 15)
-#define QH_STATUS_C_PAGE_MASK   0x7
-#define QH_STATUS_C_PAGE_SHIFT  12
-#define QH_STATUS_CERR_MASK     0x3
-#define QH_STATUS_CERR_SHIFT    10
-#define QH_STATUS_PID_MASK      0x3
-#define QH_STATUS_PID_SHIFT     8
-#define QH_STATUS_ACTIVE_FLAG   (1 << 7)
-#define QH_STATUS_HALTED_FLAG   (1 << 6)
-#define QH_STATUS_BUFF_ERROR_FLAG  (1 << 5)
-#define QH_STATUS_BABBLE_FLAG   (1 << 4)
-#define QH_STATUS_TRANS_ERR_FLAG   (1 << 3)
-#define QH_STATUS_MISSED_FLAG   (1 << 2)
-#define QH_STATUS_SPLIT_FLAG    (1 << 1)
-#define QH_STATUS_PING_FLAG     (1 << 0)
-
-/*
- * qh_t.buffer_pointer
- */
-#define QH_BUFFER_POINTER_MASK   0xfffff000
-/* Only the first buffer pointer */
-#define QH_BUFFER_POINTER_OFFSET_MASK   0xfff
-#define QH_BUFFER_POINTER_OFFSET_SHIFT  0
-/* Only the second buffer pointer */
-#define QH_BUFFER_POINTER_C_MASK_MASK   0xff
-#define QH_BUFFER_POINTER_C_MASK_SHIFFT 0
-/* Only the third buffer pointer */
-#define QH_BUFFER_POINTER_S_MASK      0x7f
-#define QH_BUFFER_POINTER_S_SHIFT     5
-#define QH_BUFFER_POINTER_FTAG_MASK   0x1f
-#define QH_BUFFER_POINTER_FTAG_SHIFT  0
-
-static inline void qh_append_qh(qh_t *qh, const qh_t *next)
-{
-	assert(qh);
-	assert(next);
-	const uint32_t pa = addr_to_phys(next);
-	assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
-	EHCI_MEM32_WR(qh->horizontal, LINK_POINTER_QH(pa));
-}
-
-static inline uintptr_t qh_next(const qh_t *qh)
-{
-	assert(qh);
-	return (EHCI_MEM32_RD(qh->horizontal) & LINK_POINTER_ADDRESS_MASK);
-}
-
-static inline bool qh_toggle_from_td(const qh_t *qh)
-{
-	assert(qh);
-	return (EHCI_MEM32_RD(qh->ep_cap) & QH_EP_CHAR_DTC_FLAG);
-}
-
-static inline void qh_toggle_set(qh_t *qh, int toggle)
-{
-	assert(qh);
-	if (toggle)
-		EHCI_MEM32_SET(qh->status, QH_STATUS_TOGGLE_FLAG);
-	else
-		EHCI_MEM32_CLR(qh->status, QH_STATUS_TOGGLE_FLAG);
-}
-
-static inline int qh_toggle_get(const qh_t *qh)
-{
-	assert(qh);
-	return (EHCI_MEM32_RD(qh->status) & QH_STATUS_TOGGLE_FLAG) ? 1 : 0;
-}
-
-static inline bool qh_halted(const qh_t *qh)
-{
-	assert(qh);
-	return (EHCI_MEM32_RD(qh->status) & QH_STATUS_HALTED_FLAG);
-}
-
-static inline void qh_clear_halt(qh_t *qh)
-{
-	assert(qh);
-	EHCI_MEM32_CLR(qh->status, QH_STATUS_HALTED_FLAG);
-}
-
-static inline void qh_set_next_td(qh_t *qh, uintptr_t td)
-{
-	assert(qh);
-	assert(td);
-	EHCI_MEM32_WR(qh->next, LINK_POINTER_TD(td));
-}
-
-static inline bool qh_transfer_active(const qh_t *qh)
-{
-	assert(qh);
-	return (EHCI_MEM32_RD(qh->status) & QH_STATUS_ACTIVE_FLAG);
-}
-
-static inline bool qh_transfer_pending(const qh_t *qh)
-{
-	assert(qh);
-	return !(EHCI_MEM32_RD(qh->next) & LINK_POINTER_TERMINATE_FLAG);
-}
-
-extern void qh_init(qh_t *instance, const endpoint_t *ep);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/split_iso_transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/split_iso_transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_SPLIT_ISO_TRANSFER_DESCRIPTOR_H
-#define DRV_EHCI_HW_STRUCT_SPLIT_ISO_TRANSFER_DESCRIPTOR_H
-
-#include <stdint.h>
-#include "link_pointer.h"
-
-/** Isochronous transfer descriptor (split only) */
-typedef struct sitd {
-	link_pointer_t next;
-
-	volatile uint32_t ep;
-	volatile uint32_t uframe;
-	volatile uint32_t status;
-	volatile uint32_t buffer_pointer[2];
-	link_pointer_t back;
-
-	/* 64 bit struct only */
-	volatile uint32_t extended_bp[2];
-} __attribute__((packed, aligned(32))) sitd_t;
-
-/*
- * sitd_t.ep
- */
-#define SITD_EP_IN_FLAG         (1 << 31)
-#define SITD_EP_PORT_MASK       0x3f
-#define SITD_EP_PORT_SHIFT      24
-#define SITD_EP_HUB_ADDR_MASK   0x3f
-#define SITD_EP_HUB_ADDR_SHIFT  16
-#define SITD_EP_EP_MASK         0xf
-#define SITD_EP_EP_SHIFT        8
-#define SITD_EP_ADDR_MASK       0x3f
-#define SITD_EP_ADDR_SHIFT      0
-
-/*
- * sitd_t.uframe
- */
-#define SITD_uFRAME_CMASK_MASK    0xff
-#define SITD_uFRAME_CMASK_SHIFT   8
-#define SITD_uFRAME_SMASK_MASK    0xff
-#define SITD_uFRAME_SMASK_SHIFT   0
-
-/*
- * sitd_t.status
- */
-#define SITD_STATUS_IOC_FLAG            (1 << 31)
-#define SITD_STATUS_PAGE_FLAG           (1 << 30)
-#define SITD_STATUS_TOTAL_MASK          0x3ff
-#define SITD_STATUS_TOTAL_SHIFT         16
-#define SITD_STATUS_uFRAME_CMASK_MASK   0xff
-#define SITD_STATUS_uFRAME_CMAKS_SHIFT  8
-#define SITD_STATUS_ACTIVE_FLAG         (1 << 7)
-#define SITD_STATUS_ERR_FLAG            (1 << 6)
-#define SITD_STATUS_DATA_ERROR_FLAG     (1 << 5)
-#define SITD_STATUS_BABBLE_FLAG         (1 << 4)
-#define SITD_STATUS_TRANS_ERROR_FLAG    (1 << 3)
-#define SITD_STATUS_MISSED_uFRAME_FLAG  (1 << 2)
-#define SITD_STATUS_SPLIT_COMPLETE_FLAG (1 << 1)
-
-/*
- * sitd_t.buffer_pointer
- */
-#define SITD_BUFFER_POINTER_MASK   0xfffff000
-/* Only the first page pointer */
-#define SITD_BUFFER_POINTER_CURRENT_MASK    0xfff
-#define SITD_BUFFER_POINTER_CURRENT_SHIFT   0
-/* Only the second page pointer */
-#define SITD_BUFFER_POINTER_TP_MASK       0x3
-#define SITD_BUFFER_POINTER_TP_SHIFT      3
-#define SITD_BUFFER_POINTER_COUNT_MASK    0x7
-#define SITD_BUFFER_POINTER_COUNT_SHIFT   0
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-
-#include <usb/usb.h>
-
-#include "mem_access.h"
-#include "transfer_descriptor.h"
-
-errno_t td_error(const td_t *td)
-{
-	assert(td);
-	const uint32_t status = EHCI_MEM32_RD(td->status);
-	if (status & TD_STATUS_HALTED_FLAG) {
-		if (status & TD_STATUS_TRANS_ERR_FLAG)
-			return EIO;
-		if (status & TD_STATUS_BABBLE_FLAG)
-			return EIO;
-		if (status & TD_STATUS_BUFF_ERROR_FLAG)
-			return EOVERFLOW;
-		return ESTALL;
-	}
-	if (status & TD_STATUS_ACTIVE_FLAG)
-		return EBUSY;
-	return EOK;
-}
-
-/** USB direction to EHCI TD values translation table */
-static const uint32_t dir[] = {
-	[USB_DIRECTION_IN] = TD_STATUS_PID_IN,
-	[USB_DIRECTION_OUT] = TD_STATUS_PID_OUT,
-	[USB_DIRECTION_BOTH] = TD_STATUS_PID_SETUP,
-};
-
-#include <usb/debug.h>
-
-/**
- * Initialize EHCI TD.
- * @param instance TD structure to initialize.
- * @param next_phys Next TD in ED list.
- * @param direction Used to determine PID, BOTH means setup PID.
- * @param buffer Pointer to the first byte of transferred data.
- * @param size Size of the buffer.
- * @param toggle Toggle bit value, use 0/1 to set explicitly,
- *        any other value means that ED toggle will be used.
- */
-void td_init(td_t *instance, uintptr_t next_phys, uintptr_t buffer,
-    usb_direction_t direction, size_t size, int toggle, bool ioc)
-{
-	assert(instance);
-	memset(instance, 0, sizeof(td_t));
-	/* Set PID and Total size */
-	assert((size & TD_STATUS_TOTAL_MASK) == size);
-	EHCI_MEM32_WR(instance->status,
-	    ((dir[direction] & TD_STATUS_PID_MASK) << TD_STATUS_PID_SHIFT) |
-	    ((size & TD_STATUS_TOTAL_MASK) << TD_STATUS_TOTAL_SHIFT) |
-	    (ioc ? TD_STATUS_IOC_FLAG : 0));
-
-	if (toggle == 0 || toggle == 1) {
-		EHCI_MEM32_SET(instance->status,
-		    toggle ? TD_STATUS_TOGGLE_FLAG : 0);
-	}
-
-	if (buffer != 0) {
-		assert(size != 0);
-		for (unsigned i = 0; (i < ARRAY_SIZE(instance->buffer_pointer)) &&
-		    size; ++i) {
-			const uintptr_t offset = buffer & TD_BUFFER_POINTER_OFFSET_MASK;
-			assert(offset == 0 || i == 0);
-			const size_t this_size = min(size, 4096 - offset);
-			EHCI_MEM32_WR(instance->buffer_pointer[i], buffer);
-			size -= this_size;
-			buffer += this_size;
-		}
-	}
-
-	EHCI_MEM32_WR(instance->next, next_phys ?
-	    LINK_POINTER_TD(next_phys) : LINK_POINTER_TERM);
-
-	EHCI_MEM32_WR(instance->alternate, LINK_POINTER_TERM);
-	EHCI_MEM32_SET(instance->status, TD_STATUS_ACTIVE_FLAG);
-	write_barrier();
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ehci/hw_struct/transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-#define DRV_EHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include <macros.h>
-#include "link_pointer.h"
-#include "mem_access.h"
-
-/** Transfer descriptor (non-ISO) */
-typedef struct td {
-	link_pointer_t next;
-	link_pointer_t alternate;
-
-	volatile uint32_t status;
-
-	volatile uint32_t buffer_pointer[5];
-
-	/* 64 bit struct only */
-	volatile uint32_t extended_bp[5];
-
-} __attribute__((packed, aligned(32))) td_t;
-
-/*
- * td_t.status
- */
-#define TD_STATUS_TOGGLE_FLAG   (1 << 31)
-#define TD_STATUS_TOTAL_MASK    0x7fff
-#define TD_STATUS_TOTAL_SHIFT   16
-#define TD_STATUS_IOC_FLAG      (1 << 15)
-#define TD_STATUS_C_PAGE_MASK   0x7
-#define TD_STATUS_C_PAGE_SHIFT  12
-#define TD_STATUS_CERR_MASK     0x3
-#define TD_STATUS_CERR_SHIFT    10
-#define TD_STATUS_PID_MASK      0x3
-#define TD_STATUS_PID_SHIFT     8
-#define TD_STATUS_PID_OUT       0x0
-#define TD_STATUS_PID_IN        0x1
-#define TD_STATUS_PID_SETUP     0x2
-#define TD_STATUS_ACTIVE_FLAG   (1 << 7)
-#define TD_STATUS_HALTED_FLAG   (1 << 6)
-#define TD_STATUS_BUFF_ERROR_FLAG  (1 << 5)
-#define TD_STATUS_BABBLE_FLAG   (1 << 4)
-#define TD_STATUS_TRANS_ERR_FLAG   (1 << 3)
-#define TD_STATUS_MISSED_FLAG   (1 << 2)
-#define TD_STATUS_SPLIT_FLAG    (1 << 1)
-#define TD_STATUS_PING_FLAG     (1 << 0)
-
-/*
- * td_t.buffer_pointer
- */
-
-#define TD_BUFFER_POINTER_MASK   0xfffff000
-/* Only the first page pointer */
-#define TD_BUFFER_POINTER_OFFSET_MASK    0xfff
-
-static_assert(sizeof(td_t) % 32 == 0, "");
-
-static inline bool td_active(const td_t *td)
-{
-	assert(td);
-	return (EHCI_MEM32_RD(td->status) & TD_STATUS_HALTED_FLAG) != 0;
-}
-
-static inline size_t td_remain_size(const td_t *td)
-{
-	assert(td);
-	return (EHCI_MEM32_RD(td->status) >> TD_STATUS_TOTAL_SHIFT) &
-	    TD_STATUS_TOTAL_MASK;
-}
-
-errno_t td_error(const td_t *td);
-
-void td_init(td_t *td, uintptr_t next_phys, uintptr_t buf, usb_direction_t dir,
-    size_t buf_size, int toggle, bool ioc);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/main.c
===================================================================
--- uspace/drv/bus/usb/ehci/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * Main routines of EHCI driver.
- */
-
-#include <io/logctl.h>
-#include <usb/host/hcd.h>
-
-#include "res.h"
-#include "hc.h"
-
-#define NAME "ehci"
-
-static const hc_driver_t ehci_driver = {
-	.name = NAME,
-	.hc_device_size = sizeof(hc_t),
-
-	.hc_add = hc_add,
-	.irq_code_gen = hc_gen_irq_code,
-	.claim = disable_legacy,
-	.start = hc_start,
-	.setup_root_hub = hc_setup_roothub,
-	.hc_gone = hc_gone,
-	.hc_quiesce = hc_quiesce
-};
-
-/** Initializes global driver structures (NONE).
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return hc_driver_main(&ehci_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/meson.build
===================================================================
--- uspace/drv/bus/usb/ehci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhost', 'usbvirt', 'usb', 'usbdev' ]
-src = files(
-	'ehci_batch.c',
-	'ehci_bus.c',
-	'ehci_rh.c',
-	'endpoint_list.c',
-	'hc.c',
-	'hw_struct/queue_head.c',
-	'hw_struct/transfer_descriptor.c',
-	'main.c',
-	'res.c',
-)
Index: pace/drv/bus/usb/ehci/res.c
===================================================================
--- uspace/drv/bus/usb/ehci/res.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup drvusbehci
- * @{
- */
-/**
- * @file
- * PCI related functions needed by the EHCI driver.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <assert.h>
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <usb/debug.h>
-#include <device/hw_res_parsed.h>
-#include <pci_dev_iface.h>
-
-#include "hc.h"
-#include "res.h"
-#include "ehci_regs.h"
-
-#define USBLEGSUP_OFFSET 0
-#define USBLEGSUP_BIOS_CONTROL (1 << 16)
-#define USBLEGSUP_OS_CONTROL (1 << 24)
-#define USBLEGCTLSTS_OFFSET 4
-
-#define DEFAULT_WAIT 1000
-#define WAIT_STEP 10
-
-/** Implements BIOS hands-off routine as described in EHCI spec
- *
- * @param device EHCI device
- * @param eecp Value of EHCI Extended Capabilities pointer.
- * @return Error code.
- */
-static errno_t disable_extended_caps(async_sess_t *parent_sess, unsigned eecp)
-{
-	/* nothing to do */
-	if (eecp == 0)
-		return EOK;
-
-	/* Read the first EEC. i.e. Legacy Support register */
-	uint32_t usblegsup;
-	errno_t ret = pci_config_space_read_32(parent_sess,
-	    eecp + USBLEGSUP_OFFSET, &usblegsup);
-	if (ret != EOK) {
-		usb_log_error("Failed to read USBLEGSUP: %s.", str_error(ret));
-		return ret;
-	}
-	usb_log_debug2("USBLEGSUP: %" PRIx32 ".", usblegsup);
-
-	/*
-	 * Request control from firmware/BIOS by writing 1 to highest
-	 * byte. (OS Control semaphore)
-	 */
-	usb_log_debug("Requesting OS control.");
-	ret = pci_config_space_write_8(parent_sess,
-	    eecp + USBLEGSUP_OFFSET + 3, 1);
-	if (ret != EOK) {
-		usb_log_error("Failed to request OS EHCI control: %s.",
-		    str_error(ret));
-		return ret;
-	}
-
-	size_t wait = 0;
-	/* Wait for BIOS to release control. */
-	ret = pci_config_space_read_32(
-	    parent_sess, eecp + USBLEGSUP_OFFSET, &usblegsup);
-	while ((ret == EOK) && (wait < DEFAULT_WAIT) &&
-	    (usblegsup & USBLEGSUP_BIOS_CONTROL)) {
-		fibril_usleep(WAIT_STEP);
-		ret = pci_config_space_read_32(parent_sess,
-		    eecp + USBLEGSUP_OFFSET, &usblegsup);
-		wait += WAIT_STEP;
-	}
-
-	if ((usblegsup & USBLEGSUP_BIOS_CONTROL) == 0) {
-		usb_log_info("BIOS released control after %zu usec.", wait);
-		return EOK;
-	}
-
-	/* BIOS failed to hand over control, this should not happen. */
-	usb_log_warning("BIOS failed to release control after "
-	    "%zu usecs, force it.", wait);
-	ret = pci_config_space_write_32(parent_sess,
-	    eecp + USBLEGSUP_OFFSET, USBLEGSUP_OS_CONTROL);
-	if (ret != EOK) {
-		usb_log_error("Failed to force OS control: %s.",
-		    str_error(ret));
-		return ret;
-	}
-
-	/*
-	 * Check capability type here, value of 01h identifies the capability
-	 * as Legacy Support. This extended capability requires one additional
-	 * 32-bit register for control/status information and this register is
-	 * located at offset EECP+04h
-	 */
-	if ((usblegsup & 0xff) == 1) {
-		/* Read the second EEC Legacy Support and Control register */
-		uint32_t usblegctlsts;
-		ret = pci_config_space_read_32(parent_sess,
-		    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
-		if (ret != EOK) {
-			usb_log_error("Failed to get USBLEGCTLSTS: %s.",
-			    str_error(ret));
-			return ret;
-		}
-		usb_log_debug2("USBLEGCTLSTS: %" PRIx32 ".", usblegctlsts);
-		/*
-		 * Zero SMI enables in legacy control register.
-		 * It should prevent pre-OS code from
-		 * interfering. NOTE: Three upper bits are WC
-		 */
-		ret = pci_config_space_write_32(parent_sess,
-		    eecp + USBLEGCTLSTS_OFFSET, 0xe0000000);
-		if (ret != EOK) {
-			usb_log_error("Failed to zero USBLEGCTLSTS: %s",
-			    str_error(ret));
-			return ret;
-		}
-
-		udelay(10);
-		/* read again to amke sure it's zeroed */
-		ret = pci_config_space_read_32(parent_sess,
-		    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
-		if (ret != EOK) {
-			usb_log_error("Failed to get USBLEGCTLSTS 2: %s.",
-			    str_error(ret));
-			return ret;
-		}
-		usb_log_debug2("Zeroed USBLEGCTLSTS: %" PRIx32 ".",
-		    usblegctlsts);
-	}
-
-	/* Read again Legacy Support register */
-	ret = pci_config_space_read_32(parent_sess,
-	    eecp + USBLEGSUP_OFFSET, &usblegsup);
-	if (ret != EOK) {
-		usb_log_error("Failed to read USBLEGSUP: %s.",
-		    str_error(ret));
-		return ret;
-	}
-	usb_log_debug2("USBLEGSUP: %" PRIx32 ".", usblegsup);
-	return ret;
-}
-
-errno_t disable_legacy(hc_device_t *hcd)
-{
-	hc_t *hc = hcd_to_hc(hcd);
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(hcd->ddf_dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	usb_log_debug("Disabling EHCI legacy support.");
-
-	const uint32_t hcc_params = EHCI_RD(hc->caps->hccparams);
-	usb_log_debug2("Value of hcc params register: %x.", hcc_params);
-
-	/*
-	 * Read value of EHCI Extended Capabilities Pointer
-	 * position of EEC registers (points to PCI config space)
-	 */
-	const uint32_t eecp =
-	    (hcc_params >> EHCI_CAPS_HCC_EECP_SHIFT) & EHCI_CAPS_HCC_EECP_MASK;
-	usb_log_debug2("Value of EECP: %x.", eecp);
-
-	int ret = disable_extended_caps(parent_sess, eecp);
-	if (ret != EOK) {
-		usb_log_error("Failed to disable extended capabilities: %s.",
-		    str_error(ret));
-		goto clean;
-	}
-clean:
-	async_hangup(parent_sess);
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ehci/res.h
===================================================================
--- uspace/drv/bus/usb/ehci/res.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * PCI related functions needed by EHCI driver.
- */
-#ifndef DRV_EHCI_PCI_H
-#define DRV_EHCI_PCI_H
-
-typedef struct hc_device hc_device_t;
-
-extern errno_t disable_legacy(hc_device_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/usb/ohci/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvusbohci ohci
- * @brief OHCI driver
- * @ingroup drvs
- */
Index: pace/drv/bus/usb/ohci/endpoint_list.c
===================================================================
--- uspace/drv/bus/usb/ohci/endpoint_list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,183 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver transfer list implementation
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <barrier.h>
-
-#include <usb/debug.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "endpoint_list.h"
-
-/** Initialize transfer list structures.
- *
- * @param[in] instance Memory place to use.
- * @param[in] name Name of the new list.
- * @return Error code
- *
- * Allocates memory for internal ed_t structure.
- */
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name)
-{
-	assert(instance);
-	instance->name = name;
-	instance->list_head = malloc32(sizeof(ed_t));
-	if (!instance->list_head) {
-		usb_log_error("Failed to allocate list head.");
-		return ENOMEM;
-	}
-	instance->list_head_pa = addr_to_phys(instance->list_head);
-	usb_log_debug2("Transfer list %s setup with ED: %p(0x%0" PRIx32 ")).",
-	    name, instance->list_head, instance->list_head_pa);
-
-	ed_init(instance->list_head, NULL, NULL);
-	list_initialize(&instance->endpoint_list);
-	fibril_mutex_initialize(&instance->guard);
-	return EOK;
-}
-
-/** Set the next list in transfer list chain.
- *
- * @param[in] instance List to lead.
- * @param[in] next List to append.
- *
- * Does not check whether this replaces an existing list.
- */
-void endpoint_list_set_next(
-    const endpoint_list_t *instance, const endpoint_list_t *next)
-{
-	assert(instance);
-	assert(next);
-	ed_append_ed(instance->list_head, next->list_head);
-}
-
-/** Add endpoint to the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] endpoint Endpoint to add.
- *
- * The endpoint is added to the end of the list and queue.
- */
-void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep)
-{
-	assert(instance);
-	assert(ep);
-	usb_log_debug2("Queue %s: Adding endpoint(%p).", instance->name, ep);
-
-	fibril_mutex_lock(&instance->guard);
-
-	ed_t *last_ed = NULL;
-	/* Add to the hardware queue. */
-	if (list_empty(&instance->endpoint_list)) {
-		/* There are no active EDs */
-		last_ed = instance->list_head;
-	} else {
-		/* There are active EDs, get the last one */
-		ohci_endpoint_t *last = list_get_instance(
-		    list_last(&instance->endpoint_list), ohci_endpoint_t, eplist_link);
-		last_ed = last->ed;
-	}
-	/* Keep link */
-	ep->ed->next = last_ed->next;
-	/* Make sure ED is written to the memory */
-	write_barrier();
-
-	/* Add ed to the hw queue */
-	ed_append_ed(last_ed, ep->ed);
-	/* Make sure ED is updated */
-	write_barrier();
-
-	/* Add to the sw list */
-	list_append(&ep->eplist_link, &instance->endpoint_list);
-
-	ohci_endpoint_t *first = list_get_instance(
-	    list_first(&instance->endpoint_list), ohci_endpoint_t, eplist_link);
-	usb_log_debug("HCD EP(%p) added to list %s, first is %p(%p).",
-	    ep, instance->name, first, first->ed);
-	if (last_ed == instance->list_head) {
-		usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.",
-		    instance->name, last_ed, instance->list_head_pa,
-		    last_ed->status, last_ed->td_tail, last_ed->td_head,
-		    last_ed->next);
-	}
-	fibril_mutex_unlock(&instance->guard);
-}
-
-/** Remove endpoint from the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] endpoint Endpoint to remove.
- */
-void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep)
-{
-	assert(instance);
-	assert(instance->list_head);
-	assert(ep);
-	assert(ep->ed);
-
-	fibril_mutex_lock(&instance->guard);
-
-	usb_log_debug2("Queue %s: removing endpoint(%p).", instance->name, ep);
-
-	const char *qpos = NULL;
-	ed_t *prev_ed;
-	/* Remove from the hardware queue */
-	if (list_first(&instance->endpoint_list) == &ep->eplist_link) {
-		/* I'm the first one here */
-		prev_ed = instance->list_head;
-		qpos = "FIRST";
-	} else {
-		ohci_endpoint_t *prev =
-		    list_get_instance(ep->eplist_link.prev, ohci_endpoint_t, eplist_link);
-		prev_ed = prev->ed;
-		qpos = "NOT FIRST";
-	}
-	assert(ed_next(prev_ed) == addr_to_phys(ep->ed));
-	prev_ed->next = ep->ed->next;
-	/* Make sure ED is updated */
-	write_barrier();
-
-	usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.",
-	    ep, qpos, instance->name, ep->ed->next);
-
-	/* Remove from the endpoint list */
-	list_remove(&ep->eplist_link);
-	fibril_mutex_unlock(&instance->guard);
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/endpoint_list.h
===================================================================
--- uspace/drv/bus/usb/ohci/endpoint_list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver transfer list structure
- */
-#ifndef DRV_OHCI_ENDPOINT_LIST_H
-#define DRV_OHCI_ENDPOINT_LIST_H
-
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <stdint.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "ohci_bus.h"
-#include "hw_struct/endpoint_descriptor.h"
-
-/** Structure maintains both OHCI queue and software list of active endpoints. */
-typedef struct endpoint_list {
-	/** Guard against add/remove races */
-	fibril_mutex_t guard;
-	/** OHCI hw structure at the beginning of the queue */
-	ed_t *list_head;
-	/** Physical address of the first(dummy) ED */
-	uint32_t list_head_pa;
-	/** Assigned name, provides nicer debug output */
-	const char *name;
-	/** Sw list of all active EDs */
-	list_t endpoint_list;
-} endpoint_list_t;
-
-/** Dispose transfer list structures.
- *
- * @param[in] instance Memory place to use.
- *
- * Frees memory of the internal ed_t structure.
- */
-static inline void endpoint_list_fini(endpoint_list_t *instance)
-{
-	assert(instance);
-	free32(instance->list_head);
-	instance->list_head = NULL;
-}
-
-errno_t endpoint_list_init(endpoint_list_t *instance, const char *name);
-void endpoint_list_set_next(
-    const endpoint_list_t *instance, const endpoint_list_t *next);
-void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep);
-void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hc.c
===================================================================
--- uspace/drv/bus/usb/ohci/hc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,649 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI Host controller driver routines
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <usb/debug.h>
-#include <usb/host/utility.h>
-#include <usb/usb.h>
-
-#include "ohci_bus.h"
-#include "ohci_batch.h"
-
-#include "hc.h"
-
-#define OHCI_USED_INTERRUPTS \
-    (I_SO | I_WDH | I_UE | I_RHSC)
-
-static const irq_pio_range_t ohci_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(ohci_regs_t)
-	}
-};
-
-static const irq_cmd_t ohci_irq_commands[] = {
-	{
-		.cmd = CMD_PIO_READ_32,
-		.dstarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 1,
-		.dstarg = 2,
-		.value = 0
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 2,
-		.value = 2
-	},
-	{
-		.cmd = CMD_PIO_WRITE_A_32,
-		.srcarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static errno_t hc_init_transfer_lists(hc_t *instance);
-static errno_t hc_init_memory(hc_t *instance);
-
-/** Generate IRQ code.
- * @param[out] ranges PIO ranges buffer.
- * @param[in] ranges_size Size of the ranges buffer (bytes).
- * @param[out] cmds Commands buffer.
- * @param[in] cmds_size Size of the commands buffer (bytes).
- * @param[in] hw_res Device's resources.
- *
- * @return Error code.
- */
-errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)
-{
-	assert(code);
-	assert(hw_res);
-
-	if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
-		return EINVAL;
-
-	const addr_range_t regs = hw_res->mem_ranges.ranges[0];
-
-	if (RNGSZ(regs) < sizeof(ohci_regs_t))
-		return EOVERFLOW;
-
-	code->ranges = malloc(sizeof(ohci_pio_ranges));
-	if (code->ranges == NULL)
-		return ENOMEM;
-
-	code->cmds = malloc(sizeof(ohci_irq_commands));
-	if (code->cmds == NULL) {
-		free(code->ranges);
-		return ENOMEM;
-	}
-
-	code->rangecount = ARRAY_SIZE(ohci_pio_ranges);
-	code->cmdcount = ARRAY_SIZE(ohci_irq_commands);
-
-	memcpy(code->ranges, ohci_pio_ranges, sizeof(ohci_pio_ranges));
-	code->ranges[0].base = RNGABS(regs);
-
-	memcpy(code->cmds, ohci_irq_commands, sizeof(ohci_irq_commands));
-	ohci_regs_t *registers = (ohci_regs_t *) RNGABSPTR(regs);
-	code->cmds[0].addr = (void *) &registers->interrupt_status;
-	code->cmds[3].addr = (void *) &registers->interrupt_status;
-	OHCI_WR(code->cmds[1].value, OHCI_USED_INTERRUPTS);
-
-	usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.",
-	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
-
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
-}
-
-/** Initialize OHCI hc driver structure
- *
- * @param[in] instance Memory place for the structure.
- * @param[in] regs Device's resources
- * @param[in] interrupts True if w interrupts should be used
- * @return Error code
- */
-errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	assert(hw_res);
-	if (hw_res->mem_ranges.count != 1 ||
-	    hw_res->mem_ranges.ranges[0].size < sizeof(ohci_regs_t))
-		return EINVAL;
-
-	errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
-	    (void **) &instance->registers);
-	if (ret != EOK) {
-		usb_log_error("Failed to gain access to registers: %s.",
-		    str_error(ret));
-		return ret;
-	}
-	usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.",
-	    hw_res->mem_ranges.ranges[0].address.absolute,
-	    hw_res->mem_ranges.ranges[0].size);
-
-	list_initialize(&instance->pending_endpoints);
-	fibril_mutex_initialize(&instance->guard);
-
-	ret = hc_init_memory(instance);
-	if (ret != EOK) {
-		usb_log_error("Failed to create OHCI memory structures: %s.",
-		    str_error(ret));
-		// TODO: We should disable pio access here
-		return ret;
-	}
-
-	return EOK;
-}
-
-/** Safely dispose host controller internal structures
- *
- * @param[in] instance Host controller structure to use.
- */
-int hc_gone(hc_device_t *instance)
-{
-	assert(instance);
-	/* TODO: implement */
-	return ENOTSUP;
-}
-
-/** Quiesce host controller
- *
- * @param hcd Host controller device
- */
-int hc_quiesce(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-
-	/* OHCI guide page 42 */
-	usb_log_debug2("Started hc initialization routine.");
-
-	/* Reset hc */
-	usb_log_debug2("HC reset.");
-	size_t time = 0;
-	OHCI_WR(instance->registers->command_status, CS_HCR);
-	while (OHCI_RD(instance->registers->command_status) & CS_HCR) {
-		fibril_usleep(10);
-		time += 10;
-	}
-	usb_log_debug2("HC reset complete in %zu us.", time);
-
-	return EOK;
-}
-
-void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
-{
-	assert(instance);
-	assert(ep);
-
-	endpoint_list_t *list = &instance->lists[ep->transfer_type];
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
-	assert(list);
-	assert(ohci_ep);
-
-	/* Enqueue ep */
-	switch (ep->transfer_type) {
-	case USB_TRANSFER_CONTROL:
-		OHCI_CLR(instance->registers->control, C_CLE);
-		endpoint_list_add_ep(list, ohci_ep);
-		OHCI_WR(instance->registers->control_current, 0);
-		OHCI_SET(instance->registers->control, C_CLE);
-		break;
-	case USB_TRANSFER_BULK:
-		OHCI_CLR(instance->registers->control, C_BLE);
-		endpoint_list_add_ep(list, ohci_ep);
-		OHCI_WR(instance->registers->bulk_current, 0);
-		OHCI_SET(instance->registers->control, C_BLE);
-		break;
-	case USB_TRANSFER_ISOCHRONOUS:
-	case USB_TRANSFER_INTERRUPT:
-		OHCI_CLR(instance->registers->control, C_PLE | C_IE);
-		endpoint_list_add_ep(list, ohci_ep);
-		OHCI_SET(instance->registers->control, C_PLE | C_IE);
-		break;
-	}
-}
-
-void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
-{
-	assert(instance);
-	assert(ep);
-
-	/* Dequeue ep */
-	endpoint_list_t *list = &instance->lists[ep->transfer_type];
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
-
-	assert(list);
-	assert(ohci_ep);
-	switch (ep->transfer_type) {
-	case USB_TRANSFER_CONTROL:
-		OHCI_CLR(instance->registers->control, C_CLE);
-		endpoint_list_remove_ep(list, ohci_ep);
-		OHCI_WR(instance->registers->control_current, 0);
-		OHCI_SET(instance->registers->control, C_CLE);
-		break;
-	case USB_TRANSFER_BULK:
-		OHCI_CLR(instance->registers->control, C_BLE);
-		endpoint_list_remove_ep(list, ohci_ep);
-		OHCI_WR(instance->registers->bulk_current, 0);
-		OHCI_SET(instance->registers->control, C_BLE);
-		break;
-	case USB_TRANSFER_ISOCHRONOUS:
-	case USB_TRANSFER_INTERRUPT:
-		OHCI_CLR(instance->registers->control, C_PLE | C_IE);
-		endpoint_list_remove_ep(list, ohci_ep);
-		OHCI_SET(instance->registers->control, C_PLE | C_IE);
-		break;
-	default:
-		break;
-	}
-}
-
-errno_t ohci_hc_status(bus_t *bus_base, uint32_t *status)
-{
-	assert(bus_base);
-	assert(status);
-
-	ohci_bus_t *bus = (ohci_bus_t *) bus_base;
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	if (hc->registers) {
-		*status = OHCI_RD(hc->registers->interrupt_status);
-		OHCI_WR(hc->registers->interrupt_status, *status);
-	}
-	return EOK;
-}
-
-/** Add USB transfer to the schedule.
- *
- * @param[in] hcd HCD driver structure.
- * @param[in] batch Batch representing the transfer.
- * @return Error code.
- */
-errno_t ohci_hc_schedule(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-
-	ohci_bus_t *bus = (ohci_bus_t *) endpoint_get_bus(batch->ep);
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	/* Check for root hub communication */
-	if (batch->target.address == ohci_rh_get_address(&hc->rh)) {
-		usb_log_debug("OHCI root hub request.");
-		return ohci_rh_schedule(&hc->rh, batch);
-	}
-
-	endpoint_t *ep = batch->ep;
-	ohci_endpoint_t *const ohci_ep = ohci_endpoint_get(ep);
-	ohci_transfer_batch_t *ohci_batch = ohci_transfer_batch_get(batch);
-	int err;
-
-	if ((err = ohci_transfer_batch_prepare(ohci_batch)))
-		return err;
-
-	fibril_mutex_lock(&hc->guard);
-	if ((err = endpoint_activate_locked(ep, batch))) {
-		fibril_mutex_unlock(&hc->guard);
-		return err;
-	}
-
-	ohci_transfer_batch_commit(ohci_batch);
-	list_append(&ohci_ep->pending_link, &hc->pending_endpoints);
-	fibril_mutex_unlock(&hc->guard);
-
-	/* Control and bulk schedules need a kick to start working */
-	switch (batch->ep->transfer_type) {
-	case USB_TRANSFER_CONTROL:
-		OHCI_SET(hc->registers->command_status, CS_CLF);
-		break;
-	case USB_TRANSFER_BULK:
-		OHCI_SET(hc->registers->command_status, CS_BLF);
-		break;
-	default:
-		break;
-	}
-
-	return EOK;
-}
-
-/** Interrupt handling routine
- *
- * @param[in] hcd HCD driver structure.
- * @param[in] status Value of the status register at the time of interrupt.
- */
-void ohci_hc_interrupt(bus_t *bus_base, uint32_t status)
-{
-	assert(bus_base);
-
-	ohci_bus_t *bus = (ohci_bus_t *) bus_base;
-	hc_t *hc = bus->hc;
-	assert(hc);
-
-	status = OHCI_RD(status);
-	assert(hc);
-	if ((status & ~I_SF) == 0) /* ignore sof status */
-		return;
-	usb_log_debug2("OHCI(%p) interrupt: %x.", hc, status);
-	if (status & I_RHSC)
-		ohci_rh_interrupt(&hc->rh);
-
-	if (status & I_WDH) {
-		fibril_mutex_lock(&hc->guard);
-		usb_log_debug2("HCCA: %p-%#" PRIx32 " (%p).", hc->hcca,
-		    OHCI_RD(hc->registers->hcca),
-		    (void *) addr_to_phys(hc->hcca));
-		usb_log_debug2("Periodic current: %#" PRIx32 ".",
-		    OHCI_RD(hc->registers->periodic_current));
-
-		list_foreach_safe(hc->pending_endpoints, current, next) {
-			ohci_endpoint_t *ep =
-			    list_get_instance(current, ohci_endpoint_t, pending_link);
-
-			ohci_transfer_batch_t *batch =
-			    ohci_transfer_batch_get(ep->base.active_batch);
-			assert(batch);
-
-			if (ohci_transfer_batch_check_completed(batch)) {
-				endpoint_deactivate_locked(&ep->base);
-				list_remove(current);
-				hc_reset_toggles(&batch->base, &ohci_ep_toggle_reset);
-				usb_transfer_batch_finish(&batch->base);
-			}
-		}
-		fibril_mutex_unlock(&hc->guard);
-	}
-
-	if (status & I_UE) {
-		usb_log_fatal("Error like no other!");
-		hc_start(&hc->base);
-	}
-
-}
-
-/** Turn off any (BIOS)driver that might be in control of the device.
- *
- * This function implements routines described in chapter 5.1.1.3 of the OHCI
- * specification (page 40, pdf page 54).
- *
- * @param[in] instance OHCI hc driver structure.
- */
-int hc_gain_control(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-
-	usb_log_debug("Requesting OHCI control.");
-	if (OHCI_RD(instance->registers->revision) & R_LEGACY_FLAG) {
-		/*
-		 * Turn off legacy emulation, it should be enough to zero
-		 * the lowest bit, but it caused problems. Thus clear all
-		 * except GateA20 (causes restart on some hw).
-		 * See page 145 of the specs for details.
-		 */
-		volatile uint32_t *ohci_emulation_reg =
-		    (uint32_t *)((char *)instance->registers + LEGACY_REGS_OFFSET);
-		usb_log_debug("OHCI legacy register %p: %x.",
-		    ohci_emulation_reg, OHCI_RD(*ohci_emulation_reg));
-		/* Zero everything but A20State */
-		// TODO: should we ack interrupts before doing this?
-		OHCI_CLR(*ohci_emulation_reg, ~0x100);
-		usb_log_debug(
-		    "OHCI legacy register (should be 0 or 0x100) %p: %x.",
-		    ohci_emulation_reg, OHCI_RD(*ohci_emulation_reg));
-	}
-
-	/* Interrupt routing enabled => smm driver is active */
-	if (OHCI_RD(instance->registers->control) & C_IR) {
-		usb_log_debug("SMM driver: request ownership change.");
-		// TODO: should we ack interrupts before doing this?
-		OHCI_SET(instance->registers->command_status, CS_OCR);
-		/* Hope that SMM actually knows its stuff or we can hang here */
-		while (OHCI_RD(instance->registers->control) & C_IR) {
-			fibril_usleep(1000);
-		}
-		usb_log_info("SMM driver: Ownership taken.");
-		C_HCFS_SET(instance->registers->control, C_HCFS_RESET);
-		fibril_usleep(50000);
-		return EOK;
-	}
-
-	const unsigned hc_status = C_HCFS_GET(instance->registers->control);
-	/* Interrupt routing disabled && status != USB_RESET => BIOS active */
-	if (hc_status != C_HCFS_RESET) {
-		usb_log_debug("BIOS driver found.");
-		if (hc_status == C_HCFS_OPERATIONAL) {
-			usb_log_info("BIOS driver: HC operational.");
-			return EOK;
-		}
-		/* HC is suspended assert resume for 20ms */
-		C_HCFS_SET(instance->registers->control, C_HCFS_RESUME);
-		fibril_usleep(20000);
-		usb_log_info("BIOS driver: HC resumed.");
-		return EOK;
-	}
-
-	/*
-	 * HC is in reset (hw startup) => no other driver
-	 * maintain reset for at least the time specified in USB spec (50 ms)
-	 */
-	usb_log_debug("Host controller found in reset state.");
-	fibril_usleep(50000);
-	return EOK;
-}
-
-/** OHCI hw initialization routine.
- *
- * @param[in] instance OHCI hc driver structure.
- */
-int hc_start(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	ohci_rh_init(&instance->rh, instance->registers, &instance->guard, "ohci rh");
-
-	/* OHCI guide page 42 */
-	assert(instance);
-	usb_log_debug2("Started hc initialization routine.");
-
-	/* Save contents of fm_interval register */
-	const uint32_t fm_interval = OHCI_RD(instance->registers->fm_interval);
-	usb_log_debug2("Old value of HcFmInterval: %x.", fm_interval);
-
-	/* Reset hc */
-	usb_log_debug2("HC reset.");
-	size_t time = 0;
-	OHCI_WR(instance->registers->command_status, CS_HCR);
-	while (OHCI_RD(instance->registers->command_status) & CS_HCR) {
-		fibril_usleep(10);
-		time += 10;
-	}
-	usb_log_debug2("HC reset complete in %zu us.", time);
-
-	/* Restore fm_interval */
-	OHCI_WR(instance->registers->fm_interval, fm_interval);
-	assert((OHCI_RD(instance->registers->command_status) & CS_HCR) == 0);
-
-	/* hc is now in suspend state */
-	usb_log_debug2("HC should be in suspend state(%x).",
-	    OHCI_RD(instance->registers->control));
-
-	/* Use HCCA */
-	OHCI_WR(instance->registers->hcca, addr_to_phys(instance->hcca));
-
-	/* Use queues */
-	OHCI_WR(instance->registers->bulk_head,
-	    instance->lists[USB_TRANSFER_BULK].list_head_pa);
-	usb_log_debug2("Bulk HEAD set to: %p (%#" PRIx32 ").",
-	    instance->lists[USB_TRANSFER_BULK].list_head,
-	    instance->lists[USB_TRANSFER_BULK].list_head_pa);
-
-	OHCI_WR(instance->registers->control_head,
-	    instance->lists[USB_TRANSFER_CONTROL].list_head_pa);
-	usb_log_debug2("Control HEAD set to: %p (%#" PRIx32 ").",
-	    instance->lists[USB_TRANSFER_CONTROL].list_head,
-	    instance->lists[USB_TRANSFER_CONTROL].list_head_pa);
-
-	/* Enable queues */
-	OHCI_SET(instance->registers->control, (C_PLE | C_IE | C_CLE | C_BLE));
-	usb_log_debug("Queues enabled(%x).",
-	    OHCI_RD(instance->registers->control));
-
-	/* Enable interrupts */
-	if (cap_handle_valid(instance->base.irq_handle)) {
-		OHCI_WR(instance->registers->interrupt_enable,
-		    OHCI_USED_INTERRUPTS);
-		usb_log_debug("Enabled interrupts: %x.",
-		    OHCI_RD(instance->registers->interrupt_enable));
-		OHCI_WR(instance->registers->interrupt_enable, I_MI);
-	}
-
-	/* Set periodic start to 90% */
-	const uint32_t frame_length =
-	    (fm_interval >> FMI_FI_SHIFT) & FMI_FI_MASK;
-	OHCI_WR(instance->registers->periodic_start,
-	    ((frame_length / 10) * 9) & PS_MASK << PS_SHIFT);
-	usb_log_debug2("All periodic start set to: %x(%u - 90%% of %d).",
-	    OHCI_RD(instance->registers->periodic_start),
-	    OHCI_RD(instance->registers->periodic_start), frame_length);
-	C_HCFS_SET(instance->registers->control, C_HCFS_OPERATIONAL);
-	usb_log_debug("OHCI HC up and running (ctl_reg=0x%x).",
-	    OHCI_RD(instance->registers->control));
-
-	return EOK;
-}
-
-/**
- * Setup roothub as a virtual hub.
- */
-int hc_setup_roothub(hc_device_t *hcd)
-{
-	return hc_setup_virtual_root_hub(hcd, USB_SPEED_FULL);
-}
-
-/** Initialize schedule queues
- *
- * @param[in] instance OHCI hc driver structure
- * @return Error code
- */
-errno_t hc_init_transfer_lists(hc_t *instance)
-{
-	assert(instance);
-#define SETUP_ENDPOINT_LIST(type) \
-do { \
-	const char *name = usb_str_transfer_type(type); \
-	const errno_t ret = endpoint_list_init(&instance->lists[type], name); \
-	if (ret != EOK) { \
-		usb_log_error("Failed to setup %s endpoint list: %s.", \
-		    name, str_error(ret)); \
-		endpoint_list_fini(&instance->lists[USB_TRANSFER_ISOCHRONOUS]);\
-		endpoint_list_fini(&instance->lists[USB_TRANSFER_INTERRUPT]); \
-		endpoint_list_fini(&instance->lists[USB_TRANSFER_CONTROL]); \
-		endpoint_list_fini(&instance->lists[USB_TRANSFER_BULK]); \
-		return ret; \
-	} \
-} while (0)
-
-	SETUP_ENDPOINT_LIST(USB_TRANSFER_ISOCHRONOUS);
-	SETUP_ENDPOINT_LIST(USB_TRANSFER_INTERRUPT);
-	SETUP_ENDPOINT_LIST(USB_TRANSFER_CONTROL);
-	SETUP_ENDPOINT_LIST(USB_TRANSFER_BULK);
-#undef SETUP_ENDPOINT_LIST
-	endpoint_list_set_next(&instance->lists[USB_TRANSFER_INTERRUPT],
-	    &instance->lists[USB_TRANSFER_ISOCHRONOUS]);
-
-	return EOK;
-}
-
-/** Initialize memory structures used by the OHCI hcd.
- *
- * @param[in] instance OHCI hc driver structure.
- * @return Error code.
- */
-errno_t hc_init_memory(hc_t *instance)
-{
-	assert(instance);
-
-	memset(&instance->rh, 0, sizeof(instance->rh));
-	/* Init queues */
-	errno_t ret = hc_init_transfer_lists(instance);
-	if (ret != EOK) {
-		return ret;
-	}
-
-	/* Init HCCA */
-	instance->hcca = hcca_get();
-	if (instance->hcca == NULL)
-		return ENOMEM;
-	usb_log_debug2("OHCI HCCA initialized at %p.", instance->hcca);
-
-	for (unsigned i = 0; i < HCCA_INT_EP_COUNT; ++i) {
-		hcca_set_int_ep(instance->hcca, i,
-		    instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa);
-	}
-	usb_log_debug2("Interrupt HEADs set to: %p (%#" PRIx32 ").",
-	    instance->lists[USB_TRANSFER_INTERRUPT].list_head,
-	    instance->lists[USB_TRANSFER_INTERRUPT].list_head_pa);
-
-	if ((ret = ohci_bus_init(&instance->bus, instance))) {
-		usb_log_error("HC(%p): Failed to setup bus : %s",
-		    instance, str_error(ret));
-		return ret;
-	}
-
-	hc_device_setup(&instance->base, (bus_t *) &instance->bus);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hc.h
===================================================================
--- uspace/drv/bus/usb/ohci/hc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI host controller driver structure
- */
-
-#ifndef DRV_OHCI_HC_H
-#define DRV_OHCI_HC_H
-
-#include <adt/list.h>
-#include <ddi.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include <usb/host/hcd.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/usb_transfer_batch.h>
-
-#include "ohci_regs.h"
-#include "ohci_rh.h"
-#include "ohci_bus.h"
-#include "endpoint_list.h"
-#include "hw_struct/hcca.h"
-
-/** Main OHCI driver structure */
-typedef struct hc {
-	/** Common hcd header */
-	hc_device_t base;
-
-	/** Memory mapped I/O registers area */
-	ohci_regs_t *registers;
-
-	/** Host controller communication area structure */
-	hcca_t *hcca;
-
-	/** Transfer schedules */
-	endpoint_list_t lists[4];
-
-	/** List of active endpoints */
-	list_t pending_endpoints;
-
-	/** Guards schedule and endpoint manipulation */
-	fibril_mutex_t guard;
-
-	/** USB hub emulation structure */
-	ohci_rh_t rh;
-
-	/** USB bookkeeping */
-	ohci_bus_t bus;
-} hc_t;
-
-static inline hc_t *hcd_to_hc(hc_device_t *hcd)
-{
-	assert(hcd);
-	return (hc_t *) hcd;
-}
-
-extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *);
-extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *,
-    const hw_res_list_parsed_t *, int *);
-extern errno_t hc_gain_control(hc_device_t *);
-extern errno_t hc_start(hc_device_t *);
-extern errno_t hc_setup_roothub(hc_device_t *);
-extern errno_t hc_gone(hc_device_t *);
-extern errno_t hc_quiesce(hc_device_t *);
-
-extern void hc_enqueue_endpoint(hc_t *, const endpoint_t *);
-extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
-
-extern errno_t ohci_hc_schedule(usb_transfer_batch_t *);
-extern errno_t ohci_hc_status(bus_t *, uint32_t *);
-extern void ohci_hc_interrupt(bus_t *, uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/completion_codes.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/completion_codes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-#ifndef DRV_OHCI_HW_STRUCT_COMPLETION_CODES_H
-#define DRV_OHCI_HW_STRUCT_COMPLETION_CODES_H
-
-#include <errno.h>
-
-enum {
-	CC_NOERROR = 0x0,
-	CC_CRC = 0x1,
-	CC_BITSTUFF = 0x2,
-	CC_TOGGLE = 0x3,
-	CC_STALL = 0x4,
-	CC_NORESPONSE = 0x5,
-	CC_PIDFAIL = 0x6,
-	CC_PIDUNEXPECTED = 0x7,
-	CC_DATAOVERRRUN = 0x8,
-	CC_DATAUNDERRRUN = 0x9,
-	CC_BUFFEROVERRRUN = 0xc,
-	CC_BUFFERUNDERRUN = 0xd,
-	CC_NOACCESS1 = 0xe,
-	CC_NOACCESS2 = 0xf,
-};
-
-static inline errno_t cc_to_rc(unsigned int cc)
-{
-	switch (cc) {
-	case CC_NOERROR:
-		return EOK;
-
-	case CC_CRC:
-		return EBADCHECKSUM;
-
-	case CC_PIDUNEXPECTED:
-	case CC_PIDFAIL:
-	case CC_BITSTUFF:
-		return EIO;
-
-	case CC_TOGGLE:
-	case CC_STALL:
-		return ESTALL;
-
-	case CC_NORESPONSE:
-		return ETIMEOUT;
-
-	case CC_DATAOVERRRUN:
-	case CC_DATAUNDERRRUN:
-	case CC_BUFFEROVERRRUN:
-	case CC_BUFFERUNDERRUN:
-		return EOVERFLOW;
-
-	case CC_NOACCESS1:
-	case CC_NOACCESS2:
-	default:
-		return ENOTSUP;
-	}
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#include <assert.h>
-#include <macros.h>
-#include <mem.h>
-
-#include <usb/usb.h>
-#include <usb/host/utils/malloc32.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/bus.h>
-
-#include "mem_access.h"
-
-#include "endpoint_descriptor.h"
-
-/** USB direction to OHCI values translation table. */
-static const uint32_t dir[] = {
-	[USB_DIRECTION_IN] = ED_STATUS_D_IN,
-	[USB_DIRECTION_OUT] = ED_STATUS_D_OUT,
-	[USB_DIRECTION_BOTH] = ED_STATUS_D_TD,
-};
-
-/**
- * Initialize ED.
- *
- * @param instance ED structure to initialize.
- * @param ep Driver endpoint to use.
- * @param td TD to put in the list.
- *
- * If @param ep is NULL, dummy ED is initialized with only skip flag set.
- */
-void ed_init(ed_t *instance, const endpoint_t *ep, const td_t *td)
-{
-	assert(instance);
-	memset(instance, 0, sizeof(*instance));
-
-	if (ep == NULL) {
-		/*
-		 * Mark as dead, used for dummy EDs at the beginning of
-		 * endpoint lists.
-		 */
-		OHCI_MEM32_WR(instance->status, ED_STATUS_K_FLAG);
-		return;
-	}
-	/* Non-dummy ED must have corresponding EP and TD assigned */
-	assert(td);
-	assert(ep);
-	assert(ep->direction < ARRAY_SIZE(dir));
-
-	/* Status: address, endpoint nr, direction mask and max packet size. */
-	OHCI_MEM32_WR(instance->status,
-	    ((ep->device->address & ED_STATUS_FA_MASK) << ED_STATUS_FA_SHIFT) |
-	    ((ep->endpoint & ED_STATUS_EN_MASK) << ED_STATUS_EN_SHIFT) |
-	    ((dir[ep->direction] & ED_STATUS_D_MASK) << ED_STATUS_D_SHIFT) |
-	    ((ep->max_packet_size & ED_STATUS_MPS_MASK) << ED_STATUS_MPS_SHIFT));
-
-	/* Low speed flag */
-	if (ep->device->speed == USB_SPEED_LOW)
-		OHCI_MEM32_SET(instance->status, ED_STATUS_S_FLAG);
-
-	/* Isochronous format flag */
-	// TODO: We need iTD instead of TD for iso transfers
-	if (ep->transfer_type == USB_TRANSFER_ISOCHRONOUS)
-		OHCI_MEM32_SET(instance->status, ED_STATUS_F_FLAG);
-
-	/* Set TD to the list */
-	const uintptr_t pa = addr_to_phys(td);
-	OHCI_MEM32_WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK);
-	OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-#ifndef DRV_OHCI_HW_STRUCT_ENDPOINT_DESCRIPTOR_H
-#define DRV_OHCI_HW_STRUCT_ENDPOINT_DESCRIPTOR_H
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include <usb/host/endpoint.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "transfer_descriptor.h"
-
-#include "completion_codes.h"
-#include "mem_access.h"
-
-/**
- * OHCI Endpoint Descriptor representation.
- *
- * See OHCI spec. Chapter 4.2, page 16 (pdf page 30) for details
- */
-typedef struct ed {
-	/**
-	 * Status field.
-	 *
-	 * See table 4-1, p. 17 OHCI spec (pdf page 31).
-	 */
-	volatile uint32_t status;
-#define ED_STATUS_FA_MASK (0x7f)   /* USB device address   */
-#define ED_STATUS_FA_SHIFT (0)
-#define ED_STATUS_EN_MASK (0xf)    /* USB endpoint address */
-#define ED_STATUS_EN_SHIFT (7)
-#define ED_STATUS_D_MASK (0x3)     /* Direction */
-#define ED_STATUS_D_SHIFT (11)
-#define ED_STATUS_D_OUT (0x1)
-#define ED_STATUS_D_IN (0x2)
-#define ED_STATUS_D_TD (0x3) /* Direction is specified by TD */
-
-#define ED_STATUS_S_FLAG (1 << 13) /* Speed flag: 1 = low */
-#define ED_STATUS_K_FLAG (1 << 14) /* Skip flag (no not execute this ED) */
-#define ED_STATUS_F_FLAG (1 << 15) /* Format: 1 = isochronous */
-#define ED_STATUS_MPS_MASK (0x3ff) /* Maximum packet size */
-#define ED_STATUS_MPS_SHIFT (16)
-
-	/**
-	 * Pointer to the last TD.
-	 *
-	 * OHCI hw never changes this field and uses it only for a reference.
-	 */
-	volatile uint32_t td_tail;
-#define ED_TDTAIL_PTR_MASK (0xfffffff0)
-#define ED_TDTAIL_PTR_SHIFT (0)
-
-	/**
-	 * Pointer to the first TD.
-	 *
-	 * Driver should not change this field if the ED is active.
-	 * This field is updated by OHCI hw and points to the next TD
-	 * to be executed.
-	 */
-	volatile uint32_t td_head;
-#define ED_TDHEAD_PTR_MASK (0xfffffff0)
-#define ED_TDHEAD_PTR_SHIFT (0)
-#define ED_TDHEAD_ZERO_MASK (0x3)
-#define ED_TDHEAD_ZERO_SHIFT (2)
-#define ED_TDHEAD_TOGGLE_CARRY (0x2)
-#define ED_TDHEAD_HALTED_FLAG (0x1)
-
-	/**
-	 * Pointer to the next ED.
-	 *
-	 * Driver should not change this field on active EDs.
-	 */
-	volatile uint32_t next;
-#define ED_NEXT_PTR_MASK (0xfffffff0)
-#define ED_NEXT_PTR_SHIFT (0)
-} __attribute__((packed, aligned(32))) ed_t;
-
-void ed_init(ed_t *instance, const endpoint_t *ep, const td_t *td);
-
-/**
- * Check for SKIP or HALTED flag being set.
- * @param instance ED
- * @return true if either SKIP or HALTED flag is set, false otherwise.
- */
-static inline bool ed_inactive(const ed_t *instance)
-{
-	assert(instance);
-	return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_HALTED_FLAG) ||
-	    (OHCI_MEM32_RD(instance->status) & ED_STATUS_K_FLAG);
-}
-
-static inline void ed_clear_halt(ed_t *instance)
-{
-	assert(instance);
-	OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
-}
-
-/**
- * Check whether this ED contains TD to be executed.
- * @param instance ED
- * @return true if there are pending TDs, false otherwise.
- */
-static inline bool ed_transfer_pending(const ed_t *instance)
-{
-	assert(instance);
-	return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK) !=
-	    (OHCI_MEM32_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK);
-}
-
-/**
- * Set the last element of TD list
- * @param instance ED
- * @param instance TD to set as the last item.
- */
-static inline void ed_set_tail_td(ed_t *instance, const td_t *td)
-{
-	assert(instance);
-	const uintptr_t pa = addr_to_phys(td);
-	OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);
-}
-
-static inline uint32_t ed_tail_td(const ed_t *instance)
-{
-	assert(instance);
-	return OHCI_MEM32_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK;
-}
-
-static inline uint32_t ed_head_td(const ed_t *instance)
-{
-	assert(instance);
-	return OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK;
-}
-
-/**
- * Set the HeadP of ED. Do not call unless the ED is Halted.
- * @param instance ED
- */
-static inline void ed_set_head_td(ed_t *instance, const td_t *td)
-{
-	assert(instance);
-	const uintptr_t pa = addr_to_phys(td);
-	OHCI_MEM32_WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK);
-}
-
-/**
- * Set next ED in ED chain.
- * @param instance ED to modify
- * @param next ED to append
- */
-static inline void ed_append_ed(ed_t *instance, const ed_t *next)
-{
-	assert(instance);
-	assert(next);
-	const uint32_t pa = addr_to_phys(next);
-	assert((pa & ED_NEXT_PTR_MASK) << ED_NEXT_PTR_SHIFT == pa);
-	OHCI_MEM32_WR(instance->next, pa);
-}
-
-static inline uint32_t ed_next(const ed_t *instance)
-{
-	assert(instance);
-	return OHCI_MEM32_RD(instance->next) & ED_NEXT_PTR_MASK;
-}
-
-/**
- * Get toggle bit value stored in this ED
- * @param instance ED
- * @return Toggle bit value
- */
-static inline int ed_toggle_get(const ed_t *instance)
-{
-	assert(instance);
-	return !!(OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY);
-}
-
-/**
- * Set toggle bit value stored in this ED
- * @param instance ED
- * @param toggle Toggle bit value
- */
-static inline void ed_toggle_set(ed_t *instance, bool toggle)
-{
-	assert(instance);
-	if (toggle) {
-		OHCI_MEM32_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
-	} else {
-		/* Clear halted flag when reseting toggle TODO: Why? */
-		OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);
-		OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);
-	}
-}
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/hcca.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/hcca.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#ifndef DRV_OHCI_HW_STRUCT_HCCA_H
-#define DRV_OHCI_HW_STRUCT_HCCA_H
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <macros.h>
-#include <assert.h>
-
-#include "mem_access.h"
-
-#define HCCA_INT_EP_COUNT  32
-
-/** Host controller communication area.
- * Shared memory used for communication between the controller and the driver.
- */
-typedef struct hcca {
-	/** Interrupt endpoints */
-	uint32_t int_ep[HCCA_INT_EP_COUNT];
-	/** Frame number. */
-	uint16_t frame_number;
-	PADD16(1);
-	/** Pointer to the last completed TD. (useless) */
-	uint32_t done_head;
-	/** Padding to make the size 256B */
-	PADD32(30);
-} hcca_t;
-
-static_assert(sizeof(hcca_t) == 256, "");
-
-/** Allocate properly aligned structure.
- *
- * The returned structure is zeroed upon allocation.
- *
- * @return Usable HCCA memory structure.
- */
-static inline hcca_t *hcca_get(void)
-{
-	hcca_t *hcca = memalign(sizeof(hcca_t), sizeof(hcca_t));
-	if (hcca)
-		memset(hcca, 0, sizeof(hcca_t));
-	return hcca;
-}
-
-/** Set HCCA interrupt endpoint pointer table entry.
- * @param hcca HCCA memory structure.
- * @param index table index.
- * @param pa Physical address.
- */
-static inline void hcca_set_int_ep(hcca_t *hcca, unsigned index, uintptr_t pa)
-{
-	assert(hcca);
-	assert(index < ARRAY_SIZE(hcca->int_ep));
-	OHCI_MEM32_WR(hcca->int_ep[index], pa);
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/iso_transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/iso_transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#ifndef DRV_OHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
-#define DRV_OHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
-
-#include <stdint.h>
-
-#include "completion_codes.h"
-
-typedef struct itd {
-	volatile uint32_t status;
-#define ITD_STATUS_SF_MASK (0xffff) /* starting frame */
-#define ITD_STATUS_SF_SHIFT (0)
-#define ITD_STATUS_DI_MASK (0x7) /* delay int, wait DI frames before int */
-#define ITD_STATUS_DI_SHIFT (21)
-#define ITD_STATUS_DI_NO_INTERRUPT (0x7)
-#define ITD_STATUS_FC_MASK (0x7) /* frame count */
-#define ITD_STATUS_FC_SHIFT (24)
-#define ITD_STATUS_CC_MASK (0xf) /* condition code */
-#define ITD_STATUS_CC_SHIFT (28)
-
-	volatile uint32_t page;   /* page number of the first byte in buffer */
-#define ITD_PAGE_BP0_MASK (0xfffff000)
-#define ITD_PAGE_BP0_SHIFT (0)
-
-	volatile uint32_t next;
-#define ITD_NEXT_PTR_MASK (0xfffffff0)
-#define ITD_NEXT_PTR_SHIFT (0)
-
-	volatile uint32_t be; /* buffer end, address of the last byte */
-
-	volatile uint16_t offset[8];
-#define ITD_OFFSET_SIZE_MASK (0x3ff)
-#define ITD_OFFSET_SIZE_SHIFT (0)
-#define ITD_OFFSET_CC_MASK (0xf)
-#define ITD_OFFSET_CC_SHIFT (12)
-
-} __attribute__((packed, aligned(32))) itd_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/mem_access.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/mem_access.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#ifndef DRV_OHCI_HW_MEM_ACCESS_H
-#define DRV_OHCI_HW_MEM_ACCESS_H
-
-#include <byteorder.h>
-
-#define OHCI_MEM32_WR(reg, val) reg = host2uint32_t_le(val)
-#define OHCI_MEM32_RD(reg) uint32_t_le2host(reg)
-#define OHCI_MEM32_SET(reg, val) reg |= host2uint32_t_le(val)
-#define OHCI_MEM32_CLR(reg, val) reg &= host2uint32_t_le(~val)
-
-#endif
-
-/*
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#include <assert.h>
-#include <mem.h>
-
-#include <usb/usb.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "completion_codes.h"
-#include "mem_access.h"
-#include "transfer_descriptor.h"
-
-/** USB direction to OHCI TD values translation table */
-static const uint32_t dir[] = {
-	[USB_DIRECTION_IN] = TD_STATUS_DP_IN,
-	[USB_DIRECTION_OUT] = TD_STATUS_DP_OUT,
-	[USB_DIRECTION_BOTH] = TD_STATUS_DP_SETUP,
-};
-
-/**
- * Initialize OHCI TD.
- * @param instance TD structure to initialize.
- * @param next Next TD in ED list.
- * @param direction Used to determine PID, BOTH means setup PID.
- * @param buffer Pointer to the first byte of transferred data.
- * @param size Size of the buffer.
- * @param toggle Toggle bit value, use 0/1 to set explicitly,
- *        any other value means that ED toggle will be used.
- */
-void td_init(td_t *instance, const td_t *next,
-    usb_direction_t direction, const void *buffer, size_t size, int toggle)
-{
-	assert(instance);
-	memset(instance, 0, sizeof(td_t));
-	/* Set PID and Error code */
-	OHCI_MEM32_WR(instance->status,
-	    ((dir[direction] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT) |
-	    ((CC_NOACCESS2 & TD_STATUS_CC_MASK) << TD_STATUS_CC_SHIFT));
-
-	if (toggle == 0 || toggle == 1) {
-		/* Set explicit toggle bit */
-		OHCI_MEM32_SET(instance->status, TD_STATUS_T_USE_TD_FLAG);
-		OHCI_MEM32_SET(instance->status, toggle ? TD_STATUS_T_FLAG : 0);
-	}
-
-	/* Allow less data on input. */
-	if (direction == USB_DIRECTION_IN) {
-		OHCI_MEM32_SET(instance->status, TD_STATUS_ROUND_FLAG);
-	}
-
-	if (buffer != NULL) {
-		assert(size != 0);
-		OHCI_MEM32_WR(instance->cbp, addr_to_phys(buffer));
-		OHCI_MEM32_WR(instance->be, addr_to_phys(buffer + size - 1));
-	}
-
-	td_set_next(instance, next);
-}
-
-void td_set_next(td_t *instance, const td_t *next)
-{
-	OHCI_MEM32_WR(instance->next, addr_to_phys(next) & TD_NEXT_PTR_MASK);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#ifndef DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-#define DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "mem_access.h"
-#include "completion_codes.h"
-
-/*
- * OHCI TDs can handle up to 8KB buffers, however, it can use max 2 pages.
- * Using 4KB buffers guarantees the page count condition.
- * (OHCI assumes 4KB pages)
- */
-#define OHCI_TD_MAX_TRANSFER (4 * 1024)
-
-/**
- * Transfer Descriptor representation.
- *
- * See OHCI spec chapter 4.3.1 General Transfer Descriptor on page 19
- * (pdf page 33) for details.
- */
-typedef struct td {
-	/** Status field. Do not touch on active TDs. */
-	volatile uint32_t status;
-#define TD_STATUS_ROUND_FLAG (1 << 18)
-#define TD_STATUS_DP_MASK (0x3) /* Direction/PID */
-#define TD_STATUS_DP_SHIFT (19)
-#define TD_STATUS_DP_SETUP (0x0)
-#define TD_STATUS_DP_OUT (0x1)
-#define TD_STATUS_DP_IN (0x2)
-#define TD_STATUS_DI_MASK (0x7) /* Delay interrupt, wait n frames before irq */
-#define TD_STATUS_DI_SHIFT (21)
-#define TD_STATUS_DI_NO_INTERRUPT (0x7)
-#define TD_STATUS_T_FLAG (1 << 24) /* Explicit toggle bit value for this TD */
-#define TD_STATUS_T_USE_TD_FLAG (1 << 25) /* 1 = use bit 24 as toggle bit */
-#define TD_STATUS_EC_MASK (0x3) /* Error count */
-#define TD_STATUS_EC_SHIFT (26)
-#define TD_STATUS_CC_MASK (0xf) /* Condition code */
-#define TD_STATUS_CC_SHIFT (28)
-
-	/**
-	 * Current buffer pointer.
-	 * Phys address of the first byte to be transferred.
-	 */
-	volatile uint32_t cbp;
-
-	/** Pointer to the next TD in chain. 16-byte aligned. */
-	volatile uint32_t next;
-#define TD_NEXT_PTR_MASK (0xfffffff0)
-#define TD_NEXT_PTR_SHIFT (0)
-
-	/**
-	 * Buffer end.
-	 * Phys address of the last byte of the transfer.
-	 * @note this does not have to be on the same page as cbp.
-	 */
-	volatile uint32_t be;
-} __attribute__((packed, aligned(32))) td_t;
-
-void td_init(td_t *, const td_t *, usb_direction_t, const void *, size_t, int);
-void td_set_next(td_t *, const td_t *);
-
-/**
- * Check TD for completion.
- * @param instance TD structure.
- * @return true if the TD was accessed and processed by hw, false otherwise.
- */
-static inline bool td_is_finished(const td_t *instance)
-{
-	assert(instance);
-	const int cc = (OHCI_MEM32_RD(instance->status) >> TD_STATUS_CC_SHIFT) &
-	    TD_STATUS_CC_MASK;
-	/*
-	 * This value is changed on transfer completion,
-	 * either to CC_NOERROR or and error code.
-	 * See OHCI spec 4.3.1.3.5 p. 23 (pdf 37)
-	 */
-	if (cc != CC_NOACCESS1 && cc != CC_NOACCESS2) {
-		return true;
-	}
-	return false;
-}
-
-/**
- * Get error code that indicates transfer status.
- * @param instance TD structure.
- * @return Error code.
- */
-static inline errno_t td_error(const td_t *instance)
-{
-	assert(instance);
-	const int cc = (OHCI_MEM32_RD(instance->status) >>
-	    TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK;
-	return cc_to_rc(cc);
-}
-
-/**
- * Get remaining portion of buffer to be read/written
- * @param instance TD structure
- * @return size of remaining buffer.
- */
-static inline size_t td_remain_size(td_t *instance)
-{
-	assert(instance);
-	/* Current buffer pointer is cleared on successful transfer */
-	if (instance->cbp == 0)
-		return 0;
-	/* Buffer end points to the last byte of transfer buffer, so add 1 */
-	return OHCI_MEM32_RD(instance->be) - OHCI_MEM32_RD(instance->cbp) + 1;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/main.c
===================================================================
--- uspace/drv/bus/usb/ohci/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * Main routines of OHCI driver.
- */
-
-#include <assert.h>
-#include <ddf/driver.h>
-#include <errno.h>
-#include <io/log.h>
-#include <io/logctl.h>
-#include <str_error.h>
-
-#include <usb/debug.h>
-
-#include "hc.h"
-#include "ohci_bus.h"
-
-#define NAME "ohci"
-
-static const hc_driver_t ohci_driver = {
-	.name = NAME,
-	.hc_device_size = sizeof(hc_t),
-
-	.hc_add = hc_add,
-	.irq_code_gen = hc_gen_irq_code,
-	.claim = hc_gain_control,
-	.start = hc_start,
-	.setup_root_hub = hc_setup_roothub,
-	.hc_gone = hc_gone,
-	.hc_quiesce = hc_quiesce
-};
-
-/** Initializes global driver structures (NONE).
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return hc_driver_main(&ohci_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/meson.build
===================================================================
--- uspace/drv/bus/usb/ohci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhost', 'usbvirt', 'usb', 'usbdev' ]
-src = files(
-	'endpoint_list.c',
-	'hc.c',
-	'main.c',
-	'ohci_batch.c',
-	'ohci_bus.c',
-	'ohci_rh.c',
-	'hw_struct/endpoint_descriptor.c',
-	'hw_struct/transfer_descriptor.c',
-)
Index: pace/drv/bus/usb/ohci/ohci.ma
===================================================================
--- uspace/drv/bus/usb/ohci/ohci.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-20 usb/host=ohci
-10 pci/class=0c&subclass=03&progif=10
Index: pace/drv/bus/usb/ohci/ohci_batch.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_batch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,389 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver USB transaction structure
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdbool.h>
-
-#include <usb/usb.h>
-#include <usb/debug.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "ohci_batch.h"
-#include "ohci_bus.h"
-
-static void (*const batch_setup[])(ohci_transfer_batch_t *);
-
-/** Safely destructs ohci_transfer_batch_t structure
- *
- * @param[in] ohci_batch Instance to destroy.
- */
-void ohci_transfer_batch_destroy(ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-	dma_buffer_free(&ohci_batch->ohci_dma_buffer);
-	free(ohci_batch);
-}
-
-/** Allocate memory and initialize internal data structure.
- *
- * @param[in] ep Endpoint for which the batch will be created
- * @return Valid pointer if all structures were successfully created,
- * NULL otherwise.
- */
-ohci_transfer_batch_t *ohci_transfer_batch_create(endpoint_t *ep)
-{
-	assert(ep);
-
-	ohci_transfer_batch_t *ohci_batch =
-	    calloc(1, sizeof(ohci_transfer_batch_t));
-	if (!ohci_batch) {
-		usb_log_error("Failed to allocate OHCI batch data.");
-		return NULL;
-	}
-
-	usb_transfer_batch_init(&ohci_batch->base, ep);
-
-	return ohci_batch;
-}
-
-/** Prepares a batch to be sent.
- *
- * Determines the number of needed transfer descriptors (TDs).
- * Prepares a transport buffer (that is accessible by the hardware).
- * Initializes parameters needed for the transfer and callback.
- */
-int ohci_transfer_batch_prepare(ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-	usb_transfer_batch_t *usb_batch = &ohci_batch->base;
-
-	if (!batch_setup[usb_batch->ep->transfer_type])
-		return ENOTSUP;
-
-	ohci_batch->td_count = (usb_batch->size + OHCI_TD_MAX_TRANSFER - 1) /
-	    OHCI_TD_MAX_TRANSFER;
-	/* Control transfer need Setup and Status stage */
-	if (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
-		ohci_batch->td_count += 2;
-	}
-
-	/* Alloc one more to NULL terminate */
-	ohci_batch->tds = calloc(ohci_batch->td_count + 1, sizeof(td_t *));
-	if (!ohci_batch->tds)
-		return ENOMEM;
-
-	const size_t td_size = ohci_batch->td_count * sizeof(td_t);
-	const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) ?
-	    USB_SETUP_PACKET_SIZE :
-	    0;
-
-	if (dma_buffer_alloc(&ohci_batch->ohci_dma_buffer, td_size + setup_size)) {
-		usb_log_error("Failed to allocate OHCI DMA buffer.");
-		return ENOMEM;
-	}
-
-	td_t *tds = ohci_batch->ohci_dma_buffer.virt;
-
-	for (size_t i = 0; i < ohci_batch->td_count; i++)
-		ohci_batch->tds[i] = &tds[i];
-
-	/* Presence of this terminator makes TD initialization easier */
-	ohci_batch->tds[ohci_batch->td_count] = NULL;
-
-	ohci_batch->setup_buffer = (void *) (&tds[ohci_batch->td_count]);
-	memcpy(ohci_batch->setup_buffer, usb_batch->setup.buffer, setup_size);
-
-	ohci_batch->data_buffer = usb_batch->dma_buffer.virt;
-
-	batch_setup[usb_batch->ep->transfer_type](ohci_batch);
-
-	return EOK;
-}
-
-/** Check batch TDs' status.
- *
- * @param[in] ohci_batch Batch structure to use.
- * @return False, if there is an active TD, true otherwise.
- *
- * Walk all TDs (usually there is just one). Stop with false if there is an
- * active TD. Stop with true if an error is found. Return true if the walk
- * completes with the last TD.
- */
-bool ohci_transfer_batch_check_completed(ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-
-	usb_transfer_batch_t *usb_batch = &ohci_batch->base;
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(usb_batch->ep);
-	assert(ohci_ep);
-
-	usb_log_debug("Batch %p checking %zu td(s) for completion.",
-	    ohci_batch, ohci_batch->td_count);
-	usb_log_debug2("ED: %08x:%08x:%08x:%08x.",
-	    ohci_ep->ed->status, ohci_ep->ed->td_head,
-	    ohci_ep->ed->td_tail, ohci_ep->ed->next);
-
-	if (!ed_inactive(ohci_ep->ed) && ed_transfer_pending(ohci_ep->ed))
-		return false;
-
-	/*
-	 * Now we may be sure that either the ED is inactive because of errors
-	 * or all transfer descriptors completed successfully
-	 */
-
-	/* Assume all data got through */
-	usb_batch->transferred_size = usb_batch->size;
-
-	/* Check all TDs */
-	for (size_t i = 0; i < ohci_batch->td_count; ++i) {
-		assert(ohci_batch->tds[i] != NULL);
-		usb_log_debug("TD %zu: %08x:%08x:%08x:%08x.", i,
-		    ohci_batch->tds[i]->status, ohci_batch->tds[i]->cbp,
-		    ohci_batch->tds[i]->next, ohci_batch->tds[i]->be);
-
-		usb_batch->error = td_error(ohci_batch->tds[i]);
-		if (usb_batch->error == EOK) {
-			/*
-			 * If the TD got all its data through, it will report
-			 * 0 bytes remain, the sole exception is INPUT with
-			 * data rounding flag (short), i.e. every INPUT.
-			 * Nice thing is that short packets will correctly
-			 * report remaining data, thus making this computation
-			 * correct (short packets need to be produced by the
-			 * last TD)
-			 * NOTE: This also works for CONTROL transfer as
-			 * the first TD will return 0 remain.
-			 * NOTE: Short packets don't break the assumption that
-			 * we leave the very last(unused) TD behind.
-			 */
-			usb_batch->transferred_size -=
-			    td_remain_size(ohci_batch->tds[i]);
-		} else {
-			usb_log_debug("Batch %p found error TD(%zu):%08x.",
-			    ohci_batch, i, ohci_batch->tds[i]->status);
-
-			/* ED should be stopped because of errors */
-			assert((ohci_ep->ed->td_head & ED_TDHEAD_HALTED_FLAG) != 0);
-
-			/*
-			 * We don't care where the processing stopped, we just
-			 * need to make sure it's not using any of the TDs owned
-			 * by the transfer.
-			 *
-			 * As the chain is terminated by a TD in ownership of
-			 * the EP, set it.
-			 */
-			ed_set_head_td(ohci_ep->ed, ohci_ep->tds[0]);
-
-			/* Clear the halted condition for the next transfer */
-			ed_clear_halt(ohci_ep->ed);
-			break;
-		}
-	}
-	assert(usb_batch->transferred_size <= usb_batch->size);
-
-	/* Make sure that we are leaving the right TD behind */
-	assert(addr_to_phys(ohci_ep->tds[0]) == ed_tail_td(ohci_ep->ed));
-	assert(ed_tail_td(ohci_ep->ed) == ed_head_td(ohci_ep->ed));
-
-	return true;
-}
-
-/** Starts execution of the TD list
- *
- * @param[in] ohci_batch Batch structure to use
- */
-void ohci_transfer_batch_commit(const ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ohci_batch->base.ep);
-
-	usb_log_debug("Using ED(%p): %08x:%08x:%08x:%08x.", ohci_ep->ed,
-	    ohci_ep->ed->status, ohci_ep->ed->td_tail,
-	    ohci_ep->ed->td_head, ohci_ep->ed->next);
-
-	/*
-	 * According to spec, we need to copy the first TD to the currently
-	 * enqueued one.
-	 */
-	memcpy(ohci_ep->tds[0], ohci_batch->tds[0], sizeof(td_t));
-	ohci_batch->tds[0] = ohci_ep->tds[0];
-
-	td_t *last = ohci_batch->tds[ohci_batch->td_count - 1];
-	td_set_next(last, ohci_ep->tds[1]);
-
-	ed_set_tail_td(ohci_ep->ed, ohci_ep->tds[1]);
-
-	/* Swap the EP TDs for the next transfer */
-	td_t *tmp = ohci_ep->tds[0];
-	ohci_ep->tds[0] = ohci_ep->tds[1];
-	ohci_ep->tds[1] = tmp;
-}
-
-/** Prepare generic control transfer
- *
- * @param[in] ohci_batch Batch structure to use.
- * @param[in] dir Communication direction
- *
- * Setup stage with toggle 0 and direction BOTH(SETUP_PID)
- * Data stage with alternating toggle and direction supplied by parameter.
- * Status stage with toggle 1 and direction supplied by parameter.
- */
-static void batch_control(ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-
-	usb_direction_t dir = ohci_batch->base.dir;
-	assert(dir == USB_DIRECTION_IN || dir == USB_DIRECTION_OUT);
-
-	static const usb_direction_t reverse_dir[] = {
-		[USB_DIRECTION_IN]  = USB_DIRECTION_OUT,
-		[USB_DIRECTION_OUT] = USB_DIRECTION_IN,
-	};
-
-	int toggle = 0;
-	const usb_direction_t data_dir = dir;
-	const usb_direction_t status_dir = reverse_dir[dir];
-
-	/* Setup stage */
-	td_init(
-	    ohci_batch->tds[0], ohci_batch->tds[1], USB_DIRECTION_BOTH,
-	    ohci_batch->setup_buffer, USB_SETUP_PACKET_SIZE, toggle);
-	usb_log_debug("Created CONTROL SETUP TD: %08x:%08x:%08x:%08x.",
-	    ohci_batch->tds[0]->status, ohci_batch->tds[0]->cbp,
-	    ohci_batch->tds[0]->next, ohci_batch->tds[0]->be);
-
-	/* Data stage */
-	size_t td_current = 1;
-	const char *buffer = ohci_batch->data_buffer;
-	size_t remain_size = ohci_batch->base.size;
-	while (remain_size > 0) {
-		const size_t transfer_size =
-		    min(remain_size, OHCI_TD_MAX_TRANSFER);
-		toggle = 1 - toggle;
-
-		td_init(ohci_batch->tds[td_current],
-		    ohci_batch->tds[td_current + 1],
-		    data_dir, buffer, transfer_size, toggle);
-		usb_log_debug("Created CONTROL DATA TD: %08x:%08x:%08x:%08x.",
-		    ohci_batch->tds[td_current]->status,
-		    ohci_batch->tds[td_current]->cbp,
-		    ohci_batch->tds[td_current]->next,
-		    ohci_batch->tds[td_current]->be);
-
-		buffer += transfer_size;
-		remain_size -= transfer_size;
-		assert(td_current < ohci_batch->td_count - 1);
-		++td_current;
-	}
-
-	/* Status stage */
-	assert(td_current == ohci_batch->td_count - 1);
-	td_init(ohci_batch->tds[td_current], ohci_batch->tds[td_current + 1],
-	    status_dir, NULL, 0, 1);
-	usb_log_debug("Created CONTROL STATUS TD: %08x:%08x:%08x:%08x.",
-	    ohci_batch->tds[td_current]->status,
-	    ohci_batch->tds[td_current]->cbp,
-	    ohci_batch->tds[td_current]->next,
-	    ohci_batch->tds[td_current]->be);
-	usb_log_debug2(
-	    "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.",
-	    &ohci_batch->base,
-	    usb_str_transfer_type(ohci_batch->base.ep->transfer_type),
-	    usb_str_direction(dir),
-	    USB_TRANSFER_BATCH_ARGS(ohci_batch->base));
-}
-
-/** Prepare generic data transfer
- *
- * @param[in] ohci_batch Batch structure to use.
- * @paramp[in] dir Communication direction.
- *
- * Direction is supplied by the associated ep and toggle is maintained by the
- * OHCI hw in ED.
- */
-static void batch_data(ohci_transfer_batch_t *ohci_batch)
-{
-	assert(ohci_batch);
-
-	usb_direction_t dir = ohci_batch->base.dir;
-	assert(dir == USB_DIRECTION_IN || dir == USB_DIRECTION_OUT);
-
-	size_t td_current = 0;
-	size_t remain_size = ohci_batch->base.size;
-	char *buffer = ohci_batch->data_buffer;
-	while (remain_size > 0) {
-		const size_t transfer_size = remain_size > OHCI_TD_MAX_TRANSFER ?
-		    OHCI_TD_MAX_TRANSFER : remain_size;
-
-		td_init(
-		    ohci_batch->tds[td_current], ohci_batch->tds[td_current + 1],
-		    dir, buffer, transfer_size, -1);
-
-		usb_log_debug("Created DATA TD: %08x:%08x:%08x:%08x.",
-		    ohci_batch->tds[td_current]->status,
-		    ohci_batch->tds[td_current]->cbp,
-		    ohci_batch->tds[td_current]->next,
-		    ohci_batch->tds[td_current]->be);
-
-		buffer += transfer_size;
-		remain_size -= transfer_size;
-		assert(td_current < ohci_batch->td_count);
-		++td_current;
-	}
-	usb_log_debug2(
-	    "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.",
-	    &ohci_batch->base,
-	    usb_str_transfer_type(ohci_batch->base.ep->transfer_type),
-	    usb_str_direction(dir),
-	    USB_TRANSFER_BATCH_ARGS(ohci_batch->base));
-}
-
-/** Transfer setup table. */
-static void (*const batch_setup[])(ohci_transfer_batch_t *) =
-    {
-	[USB_TRANSFER_CONTROL] = batch_control,
-	[USB_TRANSFER_BULK] = batch_data,
-	[USB_TRANSFER_INTERRUPT] = batch_data,
-	[USB_TRANSFER_ISOCHRONOUS] = NULL,
-};
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/ohci_batch.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_batch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver USB transaction structure
- */
-#ifndef DRV_OHCI_BATCH_H
-#define DRV_OHCI_BATCH_H
-
-#include <adt/list.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <usb/dma_buffer.h>
-#include <usb/host/usb_transfer_batch.h>
-
-#include "hw_struct/transfer_descriptor.h"
-#include "hw_struct/endpoint_descriptor.h"
-
-/** OHCI specific data required for USB transfer */
-typedef struct ohci_transfer_batch {
-	usb_transfer_batch_t base;
-
-	/** Number of TDs used by the transfer */
-	size_t td_count;
-
-	/**
-	 * List of TDs needed for the transfer - together with setup data
-	 * backed by the dma buffer. Note that the TD pointers are pointing to
-	 * the DMA buffer initially, but as the scheduling must use the first TD
-	 * from EP, it is replaced.
-	 */
-	td_t **tds;
-	char *setup_buffer;
-	char *data_buffer;
-
-	dma_buffer_t ohci_dma_buffer;
-} ohci_transfer_batch_t;
-
-ohci_transfer_batch_t *ohci_transfer_batch_create(endpoint_t *batch);
-int ohci_transfer_batch_prepare(ohci_transfer_batch_t *ohci_batch);
-void ohci_transfer_batch_commit(const ohci_transfer_batch_t *batch);
-bool ohci_transfer_batch_check_completed(ohci_transfer_batch_t *batch);
-void ohci_transfer_batch_destroy(ohci_transfer_batch_t *ohci_batch);
-
-static inline ohci_transfer_batch_t *ohci_transfer_batch_get(
-    usb_transfer_batch_t *usb_batch)
-{
-	assert(usb_batch);
-
-	return (ohci_transfer_batch_t *) usb_batch;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/ohci_bus.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_bus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <usb/host/utils/malloc32.h>
-#include <usb/host/bandwidth.h>
-
-#include "ohci_bus.h"
-#include "ohci_batch.h"
-#include "hc.h"
-
-/**
- * Callback to reset toggle on ED.
- *
- * @param[in] hcd_ep hcd endpoint structure
- * @param[in] toggle new value of toggle bit
- */
-void ohci_ep_toggle_reset(endpoint_t *ep)
-{
-	ohci_endpoint_t *instance = ohci_endpoint_get(ep);
-	assert(instance);
-	assert(instance->ed);
-	ed_toggle_set(instance->ed, 0);
-}
-
-static int ohci_device_enumerate(device_t *dev)
-{
-	ohci_bus_t *bus = (ohci_bus_t *) dev->bus;
-	return usb2_bus_device_enumerate(&bus->helper, dev);
-}
-
-static void ohci_device_gone(device_t *dev)
-{
-	ohci_bus_t *bus = (ohci_bus_t *) dev->bus;
-	usb2_bus_device_gone(&bus->helper, dev);
-}
-
-/** Creates new hcd endpoint representation.
- */
-static endpoint_t *ohci_endpoint_create(device_t *dev,
-    const usb_endpoint_descriptors_t *desc)
-{
-	assert(dev);
-
-	ohci_endpoint_t *ohci_ep = calloc(1, sizeof(ohci_endpoint_t));
-	if (ohci_ep == NULL)
-		return NULL;
-
-	endpoint_init(&ohci_ep->base, dev, desc);
-
-	const errno_t err = dma_buffer_alloc(&ohci_ep->dma_buffer,
-	    sizeof(ed_t) + 2 * sizeof(td_t));
-	if (err) {
-		free(ohci_ep);
-		return NULL;
-	}
-
-	ohci_ep->ed = ohci_ep->dma_buffer.virt;
-
-	ohci_ep->tds[0] = (td_t *) ohci_ep->ed + 1;
-	ohci_ep->tds[1] = ohci_ep->tds[0] + 1;
-
-	link_initialize(&ohci_ep->eplist_link);
-	link_initialize(&ohci_ep->pending_link);
-	return &ohci_ep->base;
-}
-
-/** Disposes hcd endpoint structure
- *
- * @param[in] hcd driver using this instance.
- * @param[in] ep endpoint structure.
- */
-static void ohci_endpoint_destroy(endpoint_t *ep)
-{
-	assert(ep);
-	ohci_endpoint_t *instance = ohci_endpoint_get(ep);
-
-	dma_buffer_free(&instance->dma_buffer);
-	free(instance);
-}
-
-static int ohci_register_ep(endpoint_t *ep)
-{
-	bus_t *bus_base = endpoint_get_bus(ep);
-	ohci_bus_t *bus = (ohci_bus_t *) bus_base;
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
-
-	const int err = usb2_bus_endpoint_register(&bus->helper, ep);
-	if (err)
-		return err;
-
-	ed_init(ohci_ep->ed, ep, ohci_ep->tds[0]);
-	hc_enqueue_endpoint(bus->hc, ep);
-	endpoint_set_online(ep, &bus->hc->guard);
-
-	return EOK;
-}
-
-static void ohci_unregister_ep(endpoint_t *ep)
-{
-	ohci_bus_t *const bus = (ohci_bus_t *) endpoint_get_bus(ep);
-	hc_t *const hc = bus->hc;
-	assert(ep);
-
-	usb2_bus_endpoint_unregister(&bus->helper, ep);
-	hc_dequeue_endpoint(bus->hc, ep);
-
-	/*
-	 * Now we can be sure the active transfer will not be completed,
-	 * as it's out of the schedule, and HC acknowledged it.
-	 */
-
-	ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
-
-	fibril_mutex_lock(&hc->guard);
-	endpoint_set_offline_locked(ep);
-	list_remove(&ohci_ep->pending_link);
-	usb_transfer_batch_t *const batch = ep->active_batch;
-	endpoint_deactivate_locked(ep);
-	fibril_mutex_unlock(&hc->guard);
-
-	if (batch) {
-		batch->error = EINTR;
-		batch->transferred_size = 0;
-		usb_transfer_batch_finish(batch);
-	}
-}
-
-static usb_transfer_batch_t *ohci_create_batch(endpoint_t *ep)
-{
-	ohci_transfer_batch_t *batch = ohci_transfer_batch_create(ep);
-	return &batch->base;
-}
-
-static void ohci_destroy_batch(usb_transfer_batch_t *batch)
-{
-	ohci_transfer_batch_destroy(ohci_transfer_batch_get(batch));
-}
-
-static const bus_ops_t ohci_bus_ops = {
-	.interrupt = ohci_hc_interrupt,
-	.status = ohci_hc_status,
-
-	.device_enumerate = ohci_device_enumerate,
-	.device_gone = ohci_device_gone,
-
-	.endpoint_destroy = ohci_endpoint_destroy,
-	.endpoint_create = ohci_endpoint_create,
-	.endpoint_register = ohci_register_ep,
-	.endpoint_unregister = ohci_unregister_ep,
-
-	.batch_create = ohci_create_batch,
-	.batch_destroy = ohci_destroy_batch,
-	.batch_schedule = ohci_hc_schedule,
-};
-
-int ohci_bus_init(ohci_bus_t *bus, hc_t *hc)
-{
-	assert(hc);
-	assert(bus);
-
-	bus_t *bus_base = (bus_t *) bus;
-	bus_init(bus_base, sizeof(device_t));
-	bus_base->ops = &ohci_bus_ops;
-
-	usb2_bus_helper_init(&bus->helper, &bandwidth_accounting_usb11);
-
-	bus->hc = hc;
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/ohci_bus.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_bus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-#ifndef DRV_OHCI_HCD_BUS_H
-#define DRV_OHCI_HCD_BUS_H
-
-#include <assert.h>
-#include <adt/list.h>
-#include <usb/dma_buffer.h>
-#include <usb/host/usb2_bus.h>
-
-#include "hw_struct/endpoint_descriptor.h"
-#include "hw_struct/transfer_descriptor.h"
-
-/**
- * Connector structure linking ED to to prepared TD.
- *
- * OHCI requires new transfers to be appended at the end of a queue. But it has
- * a weird semantics of a leftover TD, which serves as a placeholder. This left
- * TD is overwritten with first TD of a new transfer, and the spare one is used
- * as the next placeholder. Then the two are swapped for the next transaction.
- */
-typedef struct ohci_endpoint {
-	endpoint_t base;
-
-	/** OHCI endpoint descriptor */
-	ed_t *ed;
-	/** TDs to be used at the beginning and end of transaction */
-	td_t *tds [2];
-
-	/** Buffer to back ED + 2 TD */
-	dma_buffer_t dma_buffer;
-
-	/** Link in endpoint_list */
-	link_t eplist_link;
-	/** Link in pending_endpoints */
-	link_t pending_link;
-} ohci_endpoint_t;
-
-typedef struct hc hc_t;
-
-typedef struct {
-	bus_t base;
-	usb2_bus_helper_t helper;
-	hc_t *hc;
-} ohci_bus_t;
-
-errno_t ohci_bus_init(ohci_bus_t *, hc_t *);
-void ohci_ep_toggle_reset(endpoint_t *);
-
-/** Get and convert assigned ohci_endpoint_t structure
- * @param[in] ep USBD endpoint structure.
- * @return Pointer to assigned hcd endpoint structure
- */
-static inline ohci_endpoint_t *ohci_endpoint_get(const endpoint_t *ep)
-{
-	assert(ep);
-	return (ohci_endpoint_t *) ep;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/ohci_regs.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,366 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI host controller register structure
- */
-
-#ifndef DRV_OHCI_OHCI_REGS_H
-#define DRV_OHCI_OHCI_REGS_H
-
-#include <ddi.h>
-#include <byteorder.h>
-
-#define OHCI_WR(reg, val) pio_write_32(&(reg), host2uint32_t_le(val))
-#define OHCI_RD(reg) uint32_t_le2host(pio_read_32(&(reg)))
-#define OHCI_SET(reg, val) pio_set_32(&(reg), host2uint32_t_le(val), 1)
-#define OHCI_CLR(reg, val) pio_clear_32(&(reg), host2uint32_t_le(val), 1)
-
-#define LEGACY_REGS_OFFSET 0x100
-
-/** OHCI memory mapped registers structure */
-typedef struct ohci_regs {
-	const ioport32_t revision;
-
-	ioport32_t control;
-
-	ioport32_t command_status;
-
-	/** Interupt enable/disable/status,
-	 * reads give the same value,
-	 * writing causes enable/disable,
-	 * status is write-clean (writing 1 clears the bit
-	 */
-	ioport32_t interrupt_status;
-	ioport32_t interrupt_enable;
-	ioport32_t interrupt_disable;
-
-	/** HCCA pointer (see hw_struct hcca.h) */
-	ioport32_t hcca;
-
-	/** Currently executed periodic endpoint */
-	const ioport32_t periodic_current;
-
-	/** The first control endpoint */
-	ioport32_t control_head;
-
-	/** Currently executed control endpoint */
-	ioport32_t control_current;
-
-	/** The first bulk endpoint */
-	ioport32_t bulk_head;
-
-	/** Currently executed bulk endpoint */
-	ioport32_t bulk_current;
-
-	/** Done TD list, this value is periodically written to HCCA */
-	const ioport32_t done_head;
-
-	/** Frame time and max packet size for all transfers */
-	ioport32_t fm_interval;
-
-	/** Bit times remaining in current frame */
-	const ioport32_t fm_remaining;
-
-	/** Frame number */
-	const ioport32_t fm_number;
-
-	/** Remaining bit time in frame to start periodic transfers */
-	ioport32_t periodic_start;
-
-	/** Threshold for starting LS transaction */
-	ioport32_t ls_threshold;
-
-	/** The first root hub control register */
-	ioport32_t rh_desc_a;
-
-	/** The other root hub control register */
-	ioport32_t rh_desc_b;
-
-	/** Root hub status register */
-	ioport32_t rh_status;
-
-	/** Root hub per port status */
-	ioport32_t rh_port_status[];
-#define RHPS_CCS_FLAG (1 << 0)                /* r: current connect status,
-                                               * w: 1-clear port enable, 0-N/S*/
-#define RHPS_CLEAR_PORT_ENABLE RHPS_CCS_FLAG
-#define RHPS_PES_FLAG (1 << 1)               /* r: port enable status
-                                              * w: 1-set port enable, 0-N/S */
-#define RHPS_SET_PORT_ENABLE RHPS_PES_FLAG
-#define RHPS_PSS_FLAG (1 << 2)                /* r: port suspend status
-                                               * w: 1-set port suspend, 0-N/S */
-#define RHPS_SET_PORT_SUSPEND RHPS_PSS_FLAG
-#define RHPS_POCI_FLAG (1 << 3)                /* r: port over-current
-                                                * (if reports are per-port
-                                                * w: 1-clear port suspend
-						*  (start resume if suspened)
-                                                *    0-nothing */
-#define RHPS_CLEAR_PORT_SUSPEND RHPS_POCI_FLAG
-#define RHPS_PRS_FLAG (1 << 4)                /* r: port reset status
-                                               * w: 1-set port reset, 0-N/S */
-#define RHPS_SET_PORT_RESET RHPS_PRS_FLAG
-#define RHPS_PPS_FLAG (1 << 8)               /* r: port power status
-                                              * w: 1-set port power, 0-N/S */
-#define RHPS_SET_PORT_POWER RHPS_PPS_FLAG
-#define RHPS_LSDA_FLAG (1 << 9)                /* r: low speed device attached
-                                                * w: 1-clear port power, 0-N/S*/
-#define RHPS_CLEAR_PORT_POWER RHPS_LSDA_FLAG
-#define RHPS_CSC_FLAG  (1 << 16) /* connect status change WC */
-#define RHPS_PESC_FLAG (1 << 17) /* port enable status change WC */
-#define RHPS_PSSC_FLAG (1 << 18) /* port suspend status change WC */
-#define RHPS_OCIC_FLAG (1 << 19) /* port over-current change WC */
-#define RHPS_PRSC_FLAG (1 << 20) /* port reset status change WC */
-#define RHPS_CHANGE_WC_MASK (0x1f0000)
-} ohci_regs_t;
-
-/*
- * ohci_regs_t.revision
- */
-
-#define R_REVISION_MASK (0x3f)
-#define R_LEGACY_FLAG   (0x80)
-
-/*
- * ohci_regs_t.control
- */
-
-/* Control-bulk service ratio */
-#define C_CBSR_1_1  (0x0)
-#define C_CBSR_1_2  (0x1)
-#define C_CBSR_1_3  (0x2)
-#define C_CBSR_1_4  (0x3)
-#define C_CBSR_MASK (0x3)
-#define C_CBSR_SHIFT 0
-
-#define C_PLE (1 << 2)   /* Periodic list enable */
-#define C_IE  (1 << 3)   /* Isochronous enable */
-#define C_CLE (1 << 4)   /* Control list enable */
-#define C_BLE (1 << 5)   /* Bulk list enable */
-
-/* Host controller functional state */
-#define C_HCFS_RESET       (0x0)
-#define C_HCFS_RESUME      (0x1)
-#define C_HCFS_OPERATIONAL (0x2)
-#define C_HCFS_SUSPEND     (0x3)
-#define C_HCFS_GET(reg) ((OHCI_RD(reg) >> 6) & 0x3)
-#define C_HCFS_SET(reg, value) \
-do { \
-	uint32_t r = OHCI_RD(reg); \
-	r &= ~(0x3 << 6); \
-	r |= (value & 0x3) << 6; \
-	OHCI_WR(reg, r); \
-} while (0)
-
-#define C_IR  (1 << 8)  /* Interrupt routing, make sure it's 0 */
-#define C_RWC (1 << 9)  /* Remote wakeup connected, host specific */
-#define C_RWE (1 << 10)  /* Remote wakeup enable */
-
-/*
- * ohci_regs_t.command_status
- */
-
-#define CS_HCR (1 << 0)   /* Host controller reset */
-#define CS_CLF (1 << 1)   /* Control list filled */
-#define CS_BLF (1 << 2)   /* Bulk list filled */
-#define CS_OCR (1 << 3)   /* Ownership change request */
-#if 0
-#define CS_SOC_MASK (0x3) /* Scheduling overrun count */
-#define CS_SOC_SHIFT (16)
-#endif
-
-/*
- * ohci_regs_t.interrupt_xxx
- */
-
-#define I_SO   (1 << 0)   /* Scheduling overrun */
-#define I_WDH  (1 << 1)   /* Done head write-back */
-#define I_SF   (1 << 2)   /* Start of frame */
-#define I_RD   (1 << 3)   /* Resume detect */
-#define I_UE   (1 << 4)   /* Unrecoverable error */
-#define I_FNO  (1 << 5)   /* Frame number overflow */
-#define I_RHSC (1 << 6)   /* Root hub status change */
-#define I_OC   (1 << 30)  /* Ownership change */
-#define I_MI   (1 << 31)  /* Master interrupt (any/all) */
-
-/*
- * ohci_regs_t.hcca
- */
-
-#define HCCA_PTR_MASK 0xffffff00 /* HCCA is 256B aligned */
-
-/*
- * ohci_regs_t.fm_interval
- */
-
-#define FMI_FI_MASK (0x3fff) /* Frame interval in bit times (should be 11999)*/
-#define FMI_FI_SHIFT (0)
-#define FMI_FSMPS_MASK (0x7fff) /* Full speed max packet size */
-#define FMI_FSMPS_SHIFT (16)
-#define FMI_TOGGLE_FLAG (1 << 31)
-
-/*
- * ohci_regs_t.fm_remaining
- */
-
-#define FMR_FR_MASK FMI_FI_MASK
-#define FMR_FR_SHIFT FMI_FI_SHIFT
-#define FMR_TOGGLE_FLAG FMI_TOGGLE_FLAG
-
-/*
- * ohci_regs_t.fm_number
- */
-
-#define FMN_NUMBER_MASK (0xffff)
-
-/*
- * ohci_regs_t.periodic_start
- */
-
-#define PS_MASK 0x3fff
-#define PS_SHIFT 0
-
-/*
- * ohci_regs_t.ls_threshold
- */
-
-#define LST_LST_MASK (0x7fff)
-
-/*
- * ohci_regs_t.rh_desc_a
- */
-
-/** Number of downstream ports, max 15 */
-#define RHDA_NDS_MASK  (0xff)
-/** Power switching mode: 0-global, 1-per port */
-#define RHDA_PSM_FLAG  (1 << 8)
-/** No power switch: 1-power on, 0-use PSM */
-#define RHDA_NPS_FLAG  (1 << 9)
-/** 1-Compound device, must be 0 */
-#define RHDA_DT_FLAG   (1 << 10)
-/** Over-current mode: 0-global, 1-per port */
-#define RHDA_OCPM_FLAG (1 << 11)
-/** OC control: 0-use OCPM, 1-OC off */
-#define RHDA_NOCP_FLAG (1 << 12)
-/** Power on to power good time */
-#define RHDA_POTPGT_SHIFT   24
-
-/*
- * ohci_regs_t.rh_desc_b
- */
-
-/** Device removable mask */
-#define RHDB_DR_SHIFT   0
-#define RHDB_DR_MASK    0xffffU
-
-/** Power control mask */
-#define RHDB_PCC_MASK	0xffffU
-#define RHDB_PCC_SHIFT	16
-
-/*
- * ohci_regs_t.rh_status
- */
-
-/*
- * read: 0,
- * write: 0-no effect,
- *        1-turn off port power for ports
- *        specified in PPCM(RHDB), or all ports,
- *        if power is set globally
- */
-#define RHS_LPS_FLAG  (1 <<  0)
-#define RHS_CLEAR_GLOBAL_POWER RHS_LPS_FLAG /* synonym for the above */
-/** Over-current indicator, if per-port: 0 */
-#define RHS_OCI_FLAG  (1 <<  1)
-/*
- * read: 0-connect status change does not wake HC
- *       1-connect status change wakes HC
- * write: 1-set DRWE, 0-no effect
- */
-#define RHS_DRWE_FLAG (1 << 15)
-#define RHS_SET_DRWE RHS_DRWE_FLAG
-/*
- * read: 0,
- * write: 0-no effect
- *        1-turn on port power for ports
- *        specified in PPCM(RHDB), or all ports,
- *        if power is set globally
- */
-#define RHS_LPSC_FLAG (1 << 16)
-#define RHS_SET_GLOBAL_POWER RHS_LPSC_FLAG /* synonym for the above */
-/** Over-current change indicator */
-#define RHS_OCIC_FLAG (1 << 17)
-#define RHS_CLEAR_DRWE (1 << 31)
-
-#endif
-
-/*
- * ohci_regs_t.rh_port_status[x]
- */
-
-/** r: current connect status, w: 1-clear port enable, 0-N/S */
-#define RHPS_CCS_FLAG (1 << 0)
-#define RHPS_CLEAR_PORT_ENABLE RHPS_CCS_FLAG
-/** r: port enable status, w: 1-set port enable, 0-N/S */
-#define RHPS_PES_FLAG (1 << 1)
-#define RHPS_SET_PORT_ENABLE RHPS_PES_FLAG
-/** r: port suspend status, w: 1-set port suspend, 0-N/S */
-#define RHPS_PSS_FLAG (1 << 2)
-#define RHPS_SET_PORT_SUSPEND RHPS_PSS_FLAG
-/** r: port over-current (if reports are per-port
- * w: 1-clear port suspend (start resume if suspened), 0-nothing
- */
-#define RHPS_POCI_FLAG (1 << 3)
-#define RHPS_CLEAR_PORT_SUSPEND RHPS_POCI_FLAG
-/** r: port reset status, w: 1-set port reset, 0-N/S */
-#define RHPS_PRS_FLAG (1 << 4)
-#define RHPS_SET_PORT_RESET RHPS_PRS_FLAG
-/** r: port power status, w: 1-set port power, 0-N/S */
-#define RHPS_PPS_FLAG (1 << 8)
-#define RHPS_SET_PORT_POWER RHPS_PPS_FLAG
-/** r: low speed device attached, w: 1-clear port power, 0-N/S */
-#define RHPS_LSDA_FLAG (1 << 9)
-#define RHPS_CLEAR_PORT_POWER RHPS_LSDA_FLAG
-/** connect status change WC */
-#define RHPS_CSC_FLAG  (1 << 16)
-/** port enable status change WC */
-#define RHPS_PESC_FLAG (1 << 17)
-/** port suspend status change WC */
-#define RHPS_PSSC_FLAG (1 << 18)
-/** port over-current change WC */
-#define RHPS_OCIC_FLAG (1 << 19)
-/** port reset status change WC */
-#define RHPS_PRSC_FLAG (1 << 20)
-#define RHPS_CHANGE_WC_MASK (0x1f0000)
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/ohci/ohci_rh.c
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_rh.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,545 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <mem.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <usb/classes/hub.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-#include <usb/usb.h>
-
-#include <usb/host/endpoint.h>
-#include <usbvirt/device.h>
-
-#include "ohci_rh.h"
-
-enum {
-	HUB_STATUS_CHANGE_PIPE = 1,
-};
-
-static usbvirt_device_ops_t ops;
-
-/** Initialize internal USB HUB class descriptor.
- * @param instance OHCI root hub.
- * Use register based info to create accurate descriptor.
- */
-static void ohci_rh_hub_desc_init(ohci_rh_t *instance)
-{
-	assert(instance);
-	const unsigned dsize = sizeof(usb_hub_descriptor_header_t) +
-	    STATUS_BYTES(instance->port_count) * 2;
-	assert(dsize <= sizeof(instance->hub_descriptor));
-	const uint32_t hub_desc = OHCI_RD(instance->registers->rh_desc_a);
-	const uint32_t port_desc = OHCI_RD(instance->registers->rh_desc_b);
-
-	instance->hub_descriptor.header.length = dsize;
-	instance->hub_descriptor.header.descriptor_type = USB_DESCTYPE_HUB;
-	instance->hub_descriptor.header.port_count = instance->port_count;
-	instance->hub_descriptor.header.characteristics = 0 |
-	    /* Bits 0,1 indicate power switching mode */
-	    ((hub_desc & RHDA_PSM_FLAG)  ? 0x01 : 0) |
-	    ((hub_desc & RHDA_NPS_FLAG)  ? 0x02 : 0) |
-	    /* Bit 2 indicates device type (compound device) */
-	    ((hub_desc & RHDA_DT_FLAG)   ? 0x04 : 0) |
-	    /* Bits 3,4 indicate over-current protection mode */
-	    ((hub_desc & RHDA_OCPM_FLAG) ? 0x08 : 0) |
-	    ((hub_desc & RHDA_NOCP_FLAG) ? 0x10 : 0);
-	instance->hub_descriptor.header.power_good_time =
-	    hub_desc >> RHDA_POTPGT_SHIFT;
-	/* bHubContrCurrent, root hubs don't need no power. */
-	instance->hub_descriptor.header.max_current = 0;
-
-	/* Device Removable and some legacy 1.0 stuff */
-	instance->hub_descriptor.rempow[0] =
-	    (port_desc >> RHDB_DR_SHIFT) & 0xff;
-	if (STATUS_BYTES(instance->port_count) == 1) {
-		instance->hub_descriptor.rempow[1] = 0xff;
-	} else {
-		instance->hub_descriptor.rempow[1] =
-		    ((port_desc >> RHDB_DR_SHIFT) >> 8) & 0xff;
-	}
-
-	instance->hub_descriptor.rempow[2] = 0xff;
-	instance->hub_descriptor.rempow[3] = 0xff;
-
-}
-/** Initialize OHCI root hub.
- * @param instance Place to initialize.
- * @param regs OHCI device registers.
- * @param name Device name.
- * return Error code, EOK on success.
- *
- * Selects preconfigured port powering mode, sets up descriptor, and
- * initializes internal virtual hub.
- */
-errno_t ohci_rh_init(ohci_rh_t *instance, ohci_regs_t *regs,
-    fibril_mutex_t *guard, const char *name)
-{
-	assert(instance);
-	instance->registers = regs;
-	instance->port_count = OHCI_RD(regs->rh_desc_a) & RHDA_NDS_MASK;
-	usb_log_debug2("rh_desc_a: %x.", OHCI_RD(regs->rh_desc_a));
-	if (instance->port_count > OHCI_MAX_PORTS) {
-		usb_log_warning("OHCI specification does not allow %d ports. "
-		    "Max %d ports will be used.", instance->port_count,
-		    OHCI_MAX_PORTS);
-		instance->port_count = OHCI_MAX_PORTS;
-	}
-	usb_log_info("%s: Found %u ports.", name, instance->port_count);
-
-#if defined OHCI_POWER_SWITCH_no
-	usb_log_info("%s: Set power mode to no power switching.", name);
-	/* Set port power mode to no power-switching. (always on) */
-	OHCI_SET(regs->rh_desc_a, RHDA_NPS_FLAG);
-
-	/* Set to no over-current reporting */
-	OHCI_SET(regs->rh_desc_a, RHDA_NOCP_FLAG);
-
-#elif defined OHCI_POWER_SWITCH_ganged
-	usb_log_info("%s: Set power mode to ganged power switching.", name);
-	/* Set port power mode to ganged power-switching. */
-	OHCI_CLR(regs->rh_desc_a, RHDA_NPS_FLAG);
-	OHCI_CLR(regs->rh_desc_a, RHDA_PSM_FLAG);
-
-	/* Turn off power (hub driver will turn this back on) */
-	OHCI_WR(regs->rh_status, RHS_CLEAR_GLOBAL_POWER);
-
-	/* Set to global over-current */
-	OHCI_CLR(regs->rh_desc_a, RHDA_NOCP_FLAG);
-	OHCI_CLR(regs->rh_desc_a, RHDA_OCPM_FLAG);
-#else
-	usb_log_info("%s: Set power mode to per-port power switching.", name);
-	/* Set port power mode to per port power-switching. */
-	OHCI_CLR(regs->rh_desc_a, RHDA_NPS_FLAG);
-	OHCI_SET(regs->rh_desc_a, RHDA_PSM_FLAG);
-
-	/* Control all ports by global switch and turn them off */
-	OHCI_CLR(regs->rh_desc_b, RHDB_PCC_MASK << RHDB_PCC_SHIFT);
-	OHCI_WR(regs->rh_status, RHS_CLEAR_GLOBAL_POWER);
-
-	/* Return control to per port state */
-	OHCI_SET(regs->rh_desc_b, RHDB_PCC_MASK << RHDB_PCC_SHIFT);
-
-	/* Set per port over-current */
-	OHCI_CLR(regs->rh_desc_a, RHDA_NOCP_FLAG);
-	OHCI_SET(regs->rh_desc_a, RHDA_OCPM_FLAG);
-#endif
-
-	ohci_rh_hub_desc_init(instance);
-	instance->status_change_endpoint = NULL;
-	instance->guard = guard;
-	return virthub_base_init(&instance->base, name, &ops, instance,
-	    NULL, &instance->hub_descriptor.header, HUB_STATUS_CHANGE_PIPE);
-}
-
-/** Schedule USB request.
- * @param instance OCHI root hub instance.
- * @param batch USB requst batch to schedule.
- * @return Always EOK.
- * Most requests complete even before this function returns,
- * status change requests might be postponed until there is something to report.
- */
-errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch)
-{
-	assert(instance);
-	assert(batch);
-	batch->error = virthub_base_request(&instance->base, batch->target,
-	    batch->dir, &batch->setup.packet,
-	    batch->dma_buffer.virt, batch->size, &batch->transferred_size);
-	if (batch->error == ENAK) {
-		/* Lock the HC guard */
-		fibril_mutex_lock(instance->guard);
-		const int err = endpoint_activate_locked(batch->ep, batch);
-		if (err) {
-			fibril_mutex_unlock(batch->ep->guard);
-			return err;
-		}
-
-		/*
-		 * Asserting that the HC do not run two instances of the status
-		 * change endpoint - shall be true.
-		 */
-		assert(!instance->status_change_endpoint);
-
-		endpoint_add_ref(batch->ep);
-		instance->status_change_endpoint = batch->ep;
-		fibril_mutex_unlock(instance->guard);
-	} else {
-		usb_transfer_batch_finish(batch);
-	}
-	return EOK;
-}
-
-/** Handle OHCI RHSC interrupt.
- * @param instance OHCI root hub isntance.
- * @return Always EOK.
- *
- * Interrupt means there is a change of status to report. It may trigger
- * processing of a postponed request.
- */
-errno_t ohci_rh_interrupt(ohci_rh_t *instance)
-{
-	fibril_mutex_lock(instance->guard);
-	endpoint_t *ep = instance->status_change_endpoint;
-	if (!ep) {
-		fibril_mutex_unlock(instance->guard);
-		return EOK;
-	}
-
-	usb_transfer_batch_t *const batch = ep->active_batch;
-	endpoint_deactivate_locked(ep);
-	instance->status_change_endpoint = NULL;
-	fibril_mutex_unlock(instance->guard);
-
-	endpoint_del_ref(ep);
-
-	if (batch) {
-		batch->error = virthub_base_request(&instance->base, batch->target,
-		    batch->dir, &batch->setup.packet,
-		    batch->dma_buffer.virt, batch->size, &batch->transferred_size);
-		usb_transfer_batch_finish(batch);
-	}
-	return EOK;
-}
-
-/* HUB ROUTINES IMPLEMENTATION */
-#define TEST_SIZE_INIT(size, port, hub) \
-do { \
-	hub = virthub_get_data(device); \
-	assert(hub);\
-	if (uint16_usb2host(setup_packet->length) != size) \
-		return ESTALL; \
-	port = uint16_usb2host(setup_packet->index) - 1; \
-	if (port > hub->port_count) \
-		return EINVAL; \
-} while (0)
-
-/** Hub status request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_get_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ohci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-	if (uint16_usb2host(setup_packet->length) != 4)
-		return ESTALL;
-	const uint32_t val = OHCI_RD(hub->registers->rh_status) &
-	    (RHS_LPS_FLAG | RHS_LPSC_FLAG | RHS_OCI_FLAG | RHS_OCIC_FLAG);
-	memcpy(data, &val, sizeof(val));
-	*act_size = sizeof(val);
-	return EOK;
-}
-
-/** Hub set feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_clear_hub_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ohci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-
-	/*
-	 * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and
-	 * C_HUB_OVER_CURRENT are supported.
-	 * C_HUB_LOCAL_POWER is not supported
-	 * because root hubs do not support local power status feature.
-	 * C_HUB_OVER_CURRENT is represented by OHCI RHS_OCIC_FLAG.
-	 * (OHCI pg. 127)
-	 */
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	if (feature == USB_HUB_FEATURE_C_HUB_OVER_CURRENT) {
-		OHCI_WR(hub->registers->rh_status, RHS_OCIC_FLAG);
-	}
-	return EOK;
-}
-
-/** Port status request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_get_port_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ohci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(4, port, hub);
-	if (setup_packet->value != 0)
-		return EINVAL;
-
-	const uint32_t status = OHCI_RD(hub->registers->rh_port_status[port]);
-	memcpy(data, &status, sizeof(status));
-	*act_size = sizeof(status);
-	return EOK;
-}
-
-/** Port clear feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ohci_rh_t *hub;
-	unsigned port;
-	uint32_t rhda;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	/* Enabled features to clear: see page 269 of USB specs */
-	switch (feature) {
-	case USB_HUB_FEATURE_PORT_POWER:          /* 8 */
-		rhda = OHCI_RD(hub->registers->rh_desc_a);
-		/* No power switching */
-		if (rhda & RHDA_NPS_FLAG)
-			return ENOTSUP;
-		/* Ganged power switching, one port powers all */
-		if (!(rhda & RHDA_PSM_FLAG)) {
-			OHCI_WR(hub->registers->rh_status,
-			    RHS_CLEAR_GLOBAL_POWER);
-			return EOK;
-		}
-		OHCI_WR(hub->registers->rh_port_status[port],
-		    RHPS_CLEAR_PORT_POWER);
-		return EOK;
-	case USB2_HUB_FEATURE_PORT_ENABLE:         /* 1 */
-		OHCI_WR(hub->registers->rh_port_status[port],
-		    RHPS_CLEAR_PORT_ENABLE);
-		return EOK;
-
-	case USB2_HUB_FEATURE_PORT_SUSPEND:        /* 2 */
-		OHCI_WR(hub->registers->rh_port_status[port],
-		    RHPS_CLEAR_PORT_SUSPEND);
-		return EOK;
-
-	case USB_HUB_FEATURE_C_PORT_CONNECTION:   /* 16 */
-	case USB2_HUB_FEATURE_C_PORT_ENABLE:       /* 17 */
-	case USB2_HUB_FEATURE_C_PORT_SUSPEND:      /* 18 */
-	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19 */
-	case USB_HUB_FEATURE_C_PORT_RESET:        /* 20 */
-		usb_log_debug2("Clearing port C_CONNECTION, C_ENABLE, "
-		    "C_SUSPEND, C_OC or C_RESET on port %u.", port);
-		/* Bit offsets correspond to the feature number */
-		OHCI_WR(hub->registers->rh_port_status[port],
-		    1 << feature);
-		return EOK;
-
-	default:
-		return ENOTSUP;
-	}
-}
-
-/** Port set feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	ohci_rh_t *hub;
-	unsigned port;
-	uint32_t rhda;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-
-	switch (feature) {
-	case USB_HUB_FEATURE_PORT_POWER:   /* 8 */
-		rhda = OHCI_RD(hub->registers->rh_desc_a);
-
-		/* No power switching */
-		if (rhda & RHDA_NPS_FLAG)
-			return EOK;
-
-		/* Ganged power switching, one port powers all */
-		if (!(rhda & RHDA_PSM_FLAG)) {
-			OHCI_WR(hub->registers->rh_status, RHS_SET_GLOBAL_POWER);
-			return EOK;
-		}
-		/* Fall through, for per port power */
-		/* Fallthrough */
-	case USB2_HUB_FEATURE_PORT_ENABLE:  /* 1 */
-	case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */
-	case USB_HUB_FEATURE_PORT_RESET:   /* 4 */
-		usb_log_debug2("Setting port POWER, ENABLE, SUSPEND or RESET "
-		    "on port %u.", port);
-		/* Bit offsets correspond to the feature number */
-		OHCI_WR(hub->registers->rh_port_status[port], 1 << feature);
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-}
-
-/** Status change handler.
- * @param device Virtual hub device
- * @param endpoint Endpoint number
- * @param tr_type Transfer type
- * @param buffer Response destination
- * @param buffer_size Bytes available in buffer
- * @param actual_size Size us the used part of the dest buffer.
- *
- * Produces status mask. Bit 0 indicates hub status change the other bits
- * represent port status change. Endian does not matter as UHCI root hubs
- * only need 1 byte.
- */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
-    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
-    void *buffer, size_t buffer_size, size_t *actual_size)
-{
-	ohci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-
-	if (buffer_size < STATUS_BYTES(hub->port_count))
-		return ESTALL;
-
-	uint16_t mask = 0;
-
-	/* Only local power source change and over-current change can happen */
-	if (OHCI_RD(hub->registers->rh_status) & (RHS_LPSC_FLAG | RHS_OCIC_FLAG)) {
-		mask |= 1;
-	}
-
-	for (unsigned port = 1; port <= hub->port_count; ++port) {
-		/* Write-clean bits are those that indicate change */
-		if (OHCI_RD(hub->registers->rh_port_status[port - 1]) &
-		    RHPS_CHANGE_WC_MASK) {
-			mask |= (1 << port);
-		}
-	}
-
-	usb_log_debug2("OHCI root hub interrupt mask: %hx.", mask);
-
-	if (mask == 0)
-		return ENAK;
-	mask = uint16_host2usb(mask);
-	memcpy(buffer, &mask, STATUS_BYTES(hub->port_count));
-	*actual_size = STATUS_BYTES(hub->port_count);
-	return EOK;
-}
-
-/** OHCI root hub request handlers */
-static const usbvirt_control_request_handler_t control_transfer_handlers[] = {
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
-		.name = "GetHubDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearHubFeature",
-		.callback = req_clear_hub_feature,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearPortFeature",
-		.callback = req_clear_port_feature,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetHubStatus",
-		.callback = req_get_status,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetHubFeature",
-		.callback = req_nop,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetPortFeature",
-		.callback = req_set_port_feature,
-	},
-	{
-		.callback = NULL
-	}
-};
-
-/** Virtual OHCI root hub ops */
-static usbvirt_device_ops_t ops = {
-	.control = control_transfer_handlers,
-	.data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,
-};
Index: pace/drv/bus/usb/ohci/ohci_rh.h
===================================================================
--- uspace/drv/bus/usb/ohci/ohci_rh.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbohci
- * @{
- */
-/** @file
- * @brief OHCI driver
- */
-#ifndef DRV_OHCI_OHCI_RH_H
-#define DRV_OHCI_OHCI_RH_H
-
-#include <assert.h>
-#include <stdint.h>
-
-#include <usb/usb.h>
-#include <usb/classes/hub.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usbvirt/virthub_base.h>
-
-#include "ohci_regs.h"
-
-enum {
-	OHCI_MAX_PORTS = 15,
-};
-
-typedef struct {
-	/** Virtual hub instance */
-	virthub_base_t base;
-	/** OHCI device registers */
-	ohci_regs_t *registers;
-	/** Number of downstream ports, OHCI limits this to 15 */
-	unsigned port_count;
-	/** USB hub descriptor describing the OHCI root hub */
-	struct {
-		usb_hub_descriptor_header_t header;
-		uint8_t rempow[STATUS_BYTES(OHCI_MAX_PORTS) * 2];
-	} __attribute__((packed)) hub_descriptor;
-	/** A hacky way to emulate interrupts over polling. See ehci_rh. */
-	endpoint_t *status_change_endpoint;
-	fibril_mutex_t *guard;
-} ohci_rh_t;
-
-errno_t ohci_rh_init(ohci_rh_t *, ohci_regs_t *, fibril_mutex_t *, const char *);
-errno_t ohci_rh_schedule(ohci_rh_t *instance, usb_transfer_batch_t *batch);
-errno_t ohci_rh_interrupt(ohci_rh_t *instance);
-
-/** Get OHCI rh address.
- *
- * @param instance UHCI rh instance.
- * @return USB address assigned to the hub.
- * Wrapper for virtual hub address
- */
-static inline usb_address_t ohci_rh_get_address(ohci_rh_t *instance)
-{
-	assert(instance);
-	return virthub_base_get_address(&instance->base);
-}
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/usb/uhci/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvusbuhci uhci
- * @brief UHCI driver
- * @ingroup drvs
- */
Index: pace/drv/bus/usb/uhci/hc.c
===================================================================
--- uspace/drv/bus/usb/uhci/hc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,691 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI Host controller driver routines
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <async.h>
-#include <ddi.h>
-#include <device/hw_res_parsed.h>
-#include <fibril.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <str_error.h>
-
-#include <usb/debug.h>
-#include <usb/usb.h>
-#include <usb/host/utils/malloc32.h>
-#include <usb/host/bandwidth.h>
-#include <usb/host/utility.h>
-
-#include "uhci_batch.h"
-#include "transfer_list.h"
-#include "hc.h"
-
-#define UHCI_INTR_ALLOW_INTERRUPTS \
-    (UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET)
-#define UHCI_STATUS_USED_INTERRUPTS \
-    (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT)
-
-static const irq_pio_range_t uhci_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(uhci_regs_t)
-	}
-};
-
-static const irq_cmd_t uhci_irq_commands[] = {
-	{
-		.cmd = CMD_PIO_READ_16,
-		.dstarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 1,
-		.dstarg = 2,
-		.value = UHCI_STATUS_USED_INTERRUPTS | UHCI_STATUS_NM_INTERRUPTS
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 2,
-		.value = 2
-	},
-	{
-		.cmd = CMD_PIO_WRITE_A_16,
-		.srcarg = 1,
-		.addr = NULL
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static void hc_init_hw(const hc_t *instance);
-static errno_t hc_init_mem_structures(hc_t *instance);
-static errno_t hc_init_transfer_lists(hc_t *instance);
-
-static errno_t hc_debug_checker(void *arg);
-
-/** Generate IRQ code.
- * @param[out] code IRQ code structure.
- * @param[in] hw_res Device's resources.
- * @param[out] irq
- *
- * @return Error code.
- */
-errno_t hc_gen_irq_code(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)
-{
-	assert(code);
-	assert(hw_res);
-
-	if (hw_res->irqs.count != 1 || hw_res->io_ranges.count != 1)
-		return EINVAL;
-	const addr_range_t regs = hw_res->io_ranges.ranges[0];
-
-	if (RNGSZ(regs) < sizeof(uhci_regs_t))
-		return EOVERFLOW;
-
-	code->ranges = malloc(sizeof(uhci_irq_pio_ranges));
-	if (code->ranges == NULL)
-		return ENOMEM;
-
-	code->cmds = malloc(sizeof(uhci_irq_commands));
-	if (code->cmds == NULL) {
-		free(code->ranges);
-		return ENOMEM;
-	}
-
-	code->rangecount = ARRAY_SIZE(uhci_irq_pio_ranges);
-	code->cmdcount = ARRAY_SIZE(uhci_irq_commands);
-
-	memcpy(code->ranges, uhci_irq_pio_ranges, sizeof(uhci_irq_pio_ranges));
-	code->ranges[0].base = RNGABS(regs);
-
-	memcpy(code->cmds, uhci_irq_commands, sizeof(uhci_irq_commands));
-	uhci_regs_t *registers = (uhci_regs_t *) RNGABSPTR(regs);
-	code->cmds[0].addr = (void *)&registers->usbsts;
-	code->cmds[3].addr = (void *)&registers->usbsts;
-
-	usb_log_debug("I/O regs at %p (size %zu), IRQ %d.",
-	    RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
-
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
-}
-
-/** Take action based on the interrupt cause.
- *
- * @param[in] hcd HCD structure to use.
- * @param[in] status Value of the status register at the time of interrupt.
- *
- * Interrupt might indicate:
- * - transaction completed, either by triggering IOC, SPD, or an error
- * - some kind of device error
- * - resume from suspend state (not implemented)
- */
-static void hc_interrupt(bus_t *bus, uint32_t status)
-{
-	hc_t *instance = bus_to_hc(bus);
-
-	/* Lower 2 bits are transaction error and transaction complete */
-	if (status & (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT)) {
-		transfer_list_check_finished(&instance->transfers_interrupt);
-		transfer_list_check_finished(&instance->transfers_control_slow);
-		transfer_list_check_finished(&instance->transfers_control_full);
-		transfer_list_check_finished(&instance->transfers_bulk_full);
-	}
-
-	/* Resume interrupts are not supported */
-	if (status & UHCI_STATUS_RESUME) {
-		usb_log_error("Resume interrupt!");
-	}
-
-	/* Bits 4 and 5 indicate hc error */
-	if (status & (UHCI_STATUS_PROCESS_ERROR | UHCI_STATUS_SYSTEM_ERROR)) {
-		usb_log_error("UHCI hardware failure!.");
-		++instance->hw_failures;
-		transfer_list_abort_all(&instance->transfers_interrupt);
-		transfer_list_abort_all(&instance->transfers_control_slow);
-		transfer_list_abort_all(&instance->transfers_control_full);
-		transfer_list_abort_all(&instance->transfers_bulk_full);
-
-		if (instance->hw_failures < UHCI_ALLOWED_HW_FAIL) {
-			/* reinitialize hw, this triggers virtual disconnect */
-			hc_init_hw(instance);
-		} else {
-			usb_log_fatal("Too many UHCI hardware failures!.");
-			hc_gone(&instance->base);
-		}
-	}
-}
-
-/** Initialize UHCI hc driver structure
- *
- * @param[in] instance Memory place to initialize.
- * @param[in] regs Range of device's I/O control registers.
- * @param[in] interrupts True if hw interrupts should be used.
- * @return Error code.
- * @note Should be called only once on any structure.
- *
- * Initializes memory structures, starts up hw, and launches debugger and
- * interrupt fibrils.
- */
-errno_t hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	assert(hw_res);
-	if (hw_res->io_ranges.count != 1 ||
-	    hw_res->io_ranges.ranges[0].size < sizeof(uhci_regs_t))
-		return EINVAL;
-
-	instance->hw_failures = 0;
-
-	/* allow access to hc control registers */
-	errno_t ret = pio_enable_range(&hw_res->io_ranges.ranges[0],
-	    (void **) &instance->registers);
-	if (ret != EOK) {
-		usb_log_error("Failed to gain access to registers: %s.",
-		    str_error(ret));
-		return ret;
-	}
-
-	usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.",
-	    hw_res->io_ranges.ranges[0].address.absolute,
-	    hw_res->io_ranges.ranges[0].size);
-
-	ret = hc_init_mem_structures(instance);
-	if (ret != EOK) {
-		usb_log_error("Failed to init UHCI memory structures: %s.",
-		    str_error(ret));
-		// TODO: we should disable pio here
-		return ret;
-	}
-
-	return EOK;
-}
-
-int hc_start(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	hc_init_hw(instance);
-	(void)hc_debug_checker;
-
-	return uhci_rh_init(&instance->rh, instance->registers->ports, "uhci");
-}
-
-int hc_setup_roothub(hc_device_t *hcd)
-{
-	return hc_setup_virtual_root_hub(hcd, USB_SPEED_FULL);
-}
-
-/** Safely dispose host controller internal structures
- *
- * @param[in] instance Host controller structure to use.
- */
-int hc_gone(hc_device_t *instance)
-{
-	assert(instance);
-	//TODO Implement
-	return ENOTSUP;
-}
-
-/** Quiesce host controller.
- *
- * @param[in] instance Host controller structure to use.
- */
-int hc_quiesce(hc_device_t *hcd)
-{
-	hc_t *instance = hcd_to_hc(hcd);
-	uhci_regs_t *registers = instance->registers;
-
-	/* Reset everything, who knows what touched it before us */
-	pio_write_16(&registers->usbcmd, UHCI_CMD_GLOBAL_RESET);
-	fibril_usleep(50000); /* 50ms according to USB spec(root hub reset) */
-	pio_write_16(&registers->usbcmd, 0);
-
-	/* Reset hc, all states and counters. Hope that hw is not broken */
-	pio_write_16(&registers->usbcmd, UHCI_CMD_HCRESET);
-	do {
-		fibril_usleep(10);
-	} while ((pio_read_16(&registers->usbcmd) & UHCI_CMD_HCRESET) != 0);
-
-	return EOK;
-}
-
-/** Initialize UHCI hc hw resources.
- *
- * @param[in] instance UHCI structure to use.
- * For magic values see UHCI Design Guide
- */
-void hc_init_hw(const hc_t *instance)
-{
-	assert(instance);
-	uhci_regs_t *registers = instance->registers;
-
-	/* Reset everything, who knows what touched it before us */
-	pio_write_16(&registers->usbcmd, UHCI_CMD_GLOBAL_RESET);
-	fibril_usleep(50000); /* 50ms according to USB spec(root hub reset) */
-	pio_write_16(&registers->usbcmd, 0);
-
-	/* Reset hc, all states and counters. Hope that hw is not broken */
-	pio_write_16(&registers->usbcmd, UHCI_CMD_HCRESET);
-	do {
-		fibril_usleep(10);
-	} while ((pio_read_16(&registers->usbcmd) & UHCI_CMD_HCRESET) != 0);
-
-	/* Set frame to exactly 1ms */
-	pio_write_8(&registers->sofmod, 64);
-
-	/* Set frame list pointer */
-	const uint32_t pa = addr_to_phys(instance->frame_list);
-	pio_write_32(&registers->flbaseadd, pa);
-
-	if (cap_handle_valid(instance->base.irq_handle)) {
-		/* Enable all interrupts, but resume interrupt */
-		pio_write_16(&instance->registers->usbintr,
-		    UHCI_INTR_ALLOW_INTERRUPTS);
-	}
-
-	const uint16_t cmd = pio_read_16(&registers->usbcmd);
-	if (cmd != 0)
-		usb_log_warning("Previous command value: %x.", cmd);
-
-	/* Start the hc with large(64B) packet FSBR */
-	pio_write_16(&registers->usbcmd,
-	    UHCI_CMD_RUN_STOP | UHCI_CMD_MAX_PACKET | UHCI_CMD_CONFIGURE);
-}
-
-static usb_transfer_batch_t *create_transfer_batch(endpoint_t *ep)
-{
-	uhci_transfer_batch_t *batch = uhci_transfer_batch_create(ep);
-	return &batch->base;
-}
-
-static void destroy_transfer_batch(usb_transfer_batch_t *batch)
-{
-	uhci_transfer_batch_destroy(uhci_transfer_batch_get(batch));
-}
-
-static endpoint_t *endpoint_create(device_t *device, const usb_endpoint_descriptors_t *desc)
-{
-	endpoint_t *ep = calloc(1, sizeof(uhci_endpoint_t));
-	if (ep)
-		endpoint_init(ep, device, desc);
-	return ep;
-}
-
-static errno_t endpoint_register(endpoint_t *ep)
-{
-	hc_t *const hc = bus_to_hc(endpoint_get_bus(ep));
-
-	const errno_t err = usb2_bus_endpoint_register(&hc->bus_helper, ep);
-	if (err)
-		return err;
-
-	transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type];
-	if (!list)
-		/*
-		 * We don't support this combination (e.g. isochronous). Do not
-		 * fail early, because that would block any device with these
-		 * endpoints from connecting. Instead, make sure these transfers
-		 * are denied soon enough with ENOTSUP not to fail on asserts.
-		 */
-		return EOK;
-
-	endpoint_set_online(ep, &list->guard);
-	return EOK;
-}
-
-static void endpoint_unregister(endpoint_t *ep)
-{
-	hc_t *const hc = bus_to_hc(endpoint_get_bus(ep));
-	usb2_bus_endpoint_unregister(&hc->bus_helper, ep);
-
-	// Check for the roothub, as it does not schedule into lists
-	if (ep->device->address == uhci_rh_get_address(&hc->rh)) {
-		// FIXME: We shall check the roothub for active transfer. But
-		// as it is polling, there is no way to make it stop doing so.
-		// Return after rewriting uhci rh.
-		return;
-	}
-
-	transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type];
-	if (!list)
-		/*
-		 * We don't support this combination (e.g. isochronous),
-		 * so no transfer can be active.
-		 */
-		return;
-
-	fibril_mutex_lock(&list->guard);
-
-	endpoint_set_offline_locked(ep);
-	/* From now on, no other transfer will be scheduled. */
-
-	if (!ep->active_batch) {
-		fibril_mutex_unlock(&list->guard);
-		return;
-	}
-
-	/* First, offer the batch a short chance to be finished. */
-	endpoint_wait_timeout_locked(ep, 10000);
-
-	if (!ep->active_batch) {
-		fibril_mutex_unlock(&list->guard);
-		return;
-	}
-
-	uhci_transfer_batch_t *const batch =
-	    uhci_transfer_batch_get(ep->active_batch);
-
-	/* Remove the batch from the schedule to stop it from being finished. */
-	endpoint_deactivate_locked(ep);
-	transfer_list_remove_batch(list, batch);
-
-	fibril_mutex_unlock(&list->guard);
-
-	/*
-	 * We removed the batch from software schedule only, it's still possible
-	 * that HC has it in its caches. Better wait a while before we release
-	 * the buffers.
-	 */
-	fibril_usleep(20000);
-	batch->base.error = EINTR;
-	batch->base.transferred_size = 0;
-	usb_transfer_batch_finish(&batch->base);
-}
-
-static int device_enumerate(device_t *dev)
-{
-	hc_t *const hc = bus_to_hc(dev->bus);
-	return usb2_bus_device_enumerate(&hc->bus_helper, dev);
-}
-
-static void device_gone(device_t *dev)
-{
-	hc_t *const hc = bus_to_hc(dev->bus);
-	usb2_bus_device_gone(&hc->bus_helper, dev);
-}
-
-static int hc_status(bus_t *, uint32_t *);
-static int hc_schedule(usb_transfer_batch_t *);
-
-static const bus_ops_t uhci_bus_ops = {
-	.interrupt = hc_interrupt,
-	.status = hc_status,
-
-	.device_enumerate = device_enumerate,
-	.device_gone = device_gone,
-
-	.endpoint_create = endpoint_create,
-	.endpoint_register = endpoint_register,
-	.endpoint_unregister = endpoint_unregister,
-
-	.batch_create = create_transfer_batch,
-	.batch_schedule = hc_schedule,
-	.batch_destroy = destroy_transfer_batch,
-};
-
-/** Initialize UHCI hc memory structures.
- *
- * @param[in] instance UHCI structure to use.
- * @return Error code
- * @note Should be called only once on any structure.
- *
- * Structures:
- *  - transfer lists (queue heads need to be accessible by the hw)
- *  - frame list page (needs to be one UHCI hw accessible 4K page)
- */
-errno_t hc_init_mem_structures(hc_t *instance)
-{
-	assert(instance);
-
-	usb2_bus_helper_init(&instance->bus_helper, &bandwidth_accounting_usb11);
-
-	bus_init(&instance->bus, sizeof(device_t));
-	instance->bus.ops = &uhci_bus_ops;
-
-	hc_device_setup(&instance->base, &instance->bus);
-
-	/* Init USB frame list page */
-	instance->frame_list = get_page();
-	if (!instance->frame_list) {
-		return ENOMEM;
-	}
-	usb_log_debug("Initialized frame list at %p.", instance->frame_list);
-
-	/* Init transfer lists */
-	errno_t ret = hc_init_transfer_lists(instance);
-	if (ret != EOK) {
-		usb_log_error("Failed to initialize transfer lists.");
-		return_page(instance->frame_list);
-		return ENOMEM;
-	}
-	list_initialize(&instance->pending_endpoints);
-	usb_log_debug("Initialized transfer lists.");
-
-	/* Set all frames to point to the first queue head */
-	const uint32_t queue = LINK_POINTER_QH(
-	    addr_to_phys(instance->transfers_interrupt.queue_head));
-
-	for (unsigned i = 0; i < UHCI_FRAME_LIST_COUNT; ++i) {
-		instance->frame_list[i] = queue;
-	}
-
-	return EOK;
-}
-
-/** Initialize UHCI hc transfer lists.
- *
- * @param[in] instance UHCI structure to use.
- * @return Error code
- * @note Should be called only once on any structure.
- *
- * Initializes transfer lists and sets them in one chain to support proper
- * USB scheduling. Sets pointer table for quick access.
- */
-errno_t hc_init_transfer_lists(hc_t *instance)
-{
-	assert(instance);
-#define SETUP_TRANSFER_LIST(type, name) \
-do { \
-	errno_t ret = transfer_list_init(&instance->transfers_##type, name); \
-	if (ret != EOK) { \
-		usb_log_error("Failed to setup %s transfer list: %s.", \
-		    name, str_error(ret)); \
-		transfer_list_fini(&instance->transfers_bulk_full); \
-		transfer_list_fini(&instance->transfers_control_full); \
-		transfer_list_fini(&instance->transfers_control_slow); \
-		transfer_list_fini(&instance->transfers_interrupt); \
-		return ret; \
-	} \
-} while (0)
-
-	SETUP_TRANSFER_LIST(bulk_full, "BULK FULL");
-	SETUP_TRANSFER_LIST(control_full, "CONTROL FULL");
-	SETUP_TRANSFER_LIST(control_slow, "CONTROL LOW");
-	SETUP_TRANSFER_LIST(interrupt, "INTERRUPT");
-#undef SETUP_TRANSFER_LIST
-	/* Connect lists into one schedule */
-	transfer_list_set_next(&instance->transfers_control_full,
-	    &instance->transfers_bulk_full);
-	transfer_list_set_next(&instance->transfers_control_slow,
-	    &instance->transfers_control_full);
-	transfer_list_set_next(&instance->transfers_interrupt,
-	    &instance->transfers_control_slow);
-
-	/*
-	 * FSBR, This feature is not needed (adds no benefit) and is supposedly
-	 * buggy on certain hw, enable at your own risk.
-	 */
-#ifdef FSBR
-	transfer_list_set_next(&instance->transfers_bulk_full,
-	    &instance->transfers_control_full);
-#endif
-
-	/* Assign pointers to be used during scheduling */
-	instance->transfers[USB_SPEED_FULL][USB_TRANSFER_INTERRUPT] =
-	    &instance->transfers_interrupt;
-	instance->transfers[USB_SPEED_LOW][USB_TRANSFER_INTERRUPT] =
-	    &instance->transfers_interrupt;
-	instance->transfers[USB_SPEED_FULL][USB_TRANSFER_CONTROL] =
-	    &instance->transfers_control_full;
-	instance->transfers[USB_SPEED_LOW][USB_TRANSFER_CONTROL] =
-	    &instance->transfers_control_slow;
-	instance->transfers[USB_SPEED_FULL][USB_TRANSFER_BULK] =
-	    &instance->transfers_bulk_full;
-
-	return EOK;
-}
-
-static errno_t hc_status(bus_t *bus, uint32_t *status)
-{
-	hc_t *instance = bus_to_hc(bus);
-	assert(status);
-
-	*status = 0;
-	if (instance->registers) {
-		uint16_t s = pio_read_16(&instance->registers->usbsts);
-		pio_write_16(&instance->registers->usbsts, s);
-		*status = s;
-	}
-	return EOK;
-}
-
-/**
- * Schedule batch for execution.
- *
- * @param[in] instance UHCI structure to use.
- * @param[in] batch Transfer batch to schedule.
- * @return Error code
- */
-static errno_t hc_schedule(usb_transfer_batch_t *batch)
-{
-	uhci_transfer_batch_t *uhci_batch = uhci_transfer_batch_get(batch);
-	endpoint_t *ep = batch->ep;
-	hc_t *hc = bus_to_hc(endpoint_get_bus(ep));
-
-	if (batch->target.address == uhci_rh_get_address(&hc->rh))
-		return uhci_rh_schedule(&hc->rh, batch);
-
-	transfer_list_t *const list =
-	    hc->transfers[ep->device->speed][ep->transfer_type];
-
-	if (!list)
-		return ENOTSUP;
-
-	errno_t err;
-	if ((err = uhci_transfer_batch_prepare(uhci_batch)))
-		return err;
-
-	return transfer_list_add_batch(list, uhci_batch);
-}
-
-/** Debug function, checks consistency of memory structures.
- *
- * @param[in] arg UHCI structure to use.
- * @return EOK (should never return)
- */
-errno_t hc_debug_checker(void *arg)
-{
-	hc_t *instance = arg;
-	assert(instance);
-
-#define QH(queue) \
-	instance->transfers_##queue.queue_head
-
-	while (true) {
-		const uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
-		const uint16_t sts = pio_read_16(&instance->registers->usbsts);
-		const uint16_t intr =
-		    pio_read_16(&instance->registers->usbintr);
-
-		if (((cmd & UHCI_CMD_RUN_STOP) != 1) || (sts != 0)) {
-			usb_log_debug2("Command: %X Status: %X Intr: %x",
-			    cmd, sts, intr);
-		}
-
-		const uintptr_t frame_list =
-		    pio_read_32(&instance->registers->flbaseadd) & ~0xfff;
-		if (frame_list != addr_to_phys(instance->frame_list)) {
-			usb_log_debug("Framelist address: %p vs. %p.",
-			    (void *) frame_list,
-			    (void *) addr_to_phys(instance->frame_list));
-		}
-
-		int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff;
-
-		uintptr_t expected_pa = instance->frame_list[frnum] &
-		    LINK_POINTER_ADDRESS_MASK;
-		uintptr_t real_pa = addr_to_phys(QH(interrupt));
-		if (expected_pa != real_pa) {
-			usb_log_debug("Interrupt QH: %p (frame %d) vs. %p.",
-			    (void *) expected_pa, frnum, (void *) real_pa);
-		}
-
-		expected_pa = QH(interrupt)->next & LINK_POINTER_ADDRESS_MASK;
-		real_pa = addr_to_phys(QH(control_slow));
-		if (expected_pa != real_pa) {
-			usb_log_debug("Control Slow QH: %p vs. %p.",
-			    (void *) expected_pa, (void *) real_pa);
-		}
-
-		expected_pa = QH(control_slow)->next & LINK_POINTER_ADDRESS_MASK;
-		real_pa = addr_to_phys(QH(control_full));
-		if (expected_pa != real_pa) {
-			usb_log_debug("Control Full QH: %p vs. %p.",
-			    (void *) expected_pa, (void *) real_pa);
-		}
-
-		expected_pa = QH(control_full)->next & LINK_POINTER_ADDRESS_MASK;
-		real_pa = addr_to_phys(QH(bulk_full));
-		if (expected_pa != real_pa) {
-			usb_log_debug("Bulk QH: %p vs. %p.",
-			    (void *) expected_pa, (void *) real_pa);
-		}
-		fibril_usleep(UHCI_DEBUGER_TIMEOUT);
-	}
-	return EOK;
-#undef QH
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/hc.h
===================================================================
--- uspace/drv/bus/usb/uhci/hc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI host controller driver structure
- */
-
-#ifndef DRV_UHCI_HC_H
-#define DRV_UHCI_HC_H
-
-#include <device/hw_res_parsed.h>
-#include <fibril.h>
-#include <macros.h>
-#include <member.h>
-#include <stdbool.h>
-#include <ddi.h>
-#include <usb/host/hcd.h>
-#include <usb/host/usb2_bus.h>
-#include <usb/host/usb_transfer_batch.h>
-
-#include "uhci_rh.h"
-#include "transfer_list.h"
-#include "hw_struct/link_pointer.h"
-
-/** UHCI I/O registers layout */
-typedef struct uhci_regs {
-	/** Command register, controls HC behaviour */
-	ioport16_t usbcmd;
-#define UHCI_CMD_MAX_PACKET (1 << 7)
-#define UHCI_CMD_CONFIGURE  (1 << 6)
-#define UHCI_CMD_DEBUG  (1 << 5)
-#define UHCI_CMD_FORCE_GLOBAL_RESUME  (1 << 4)
-#define UHCI_CMD_FORCE_GLOBAL_SUSPEND  (1 << 3)
-#define UHCI_CMD_GLOBAL_RESET  (1 << 2)
-#define UHCI_CMD_HCRESET  (1 << 1)
-#define UHCI_CMD_RUN_STOP  (1 << 0)
-
-	/** Status register, 1 means interrupt is asserted (if enabled) */
-	ioport16_t usbsts;
-#define UHCI_STATUS_HALTED (1 << 5)
-#define UHCI_STATUS_PROCESS_ERROR (1 << 4)
-#define UHCI_STATUS_SYSTEM_ERROR (1 << 3)
-#define UHCI_STATUS_RESUME (1 << 2)
-#define UHCI_STATUS_ERROR_INTERRUPT (1 << 1)
-#define UHCI_STATUS_INTERRUPT (1 << 0)
-#define UHCI_STATUS_NM_INTERRUPTS \
-    (UHCI_STATUS_PROCESS_ERROR | UHCI_STATUS_SYSTEM_ERROR)
-
-	/** Interrupt enabled registers */
-	ioport16_t usbintr;
-#define UHCI_INTR_SHORT_PACKET (1 << 3)
-#define UHCI_INTR_COMPLETE (1 << 2)
-#define UHCI_INTR_RESUME (1 << 1)
-#define UHCI_INTR_CRC (1 << 0)
-
-	/** Register stores frame number used in SOF packet */
-	ioport16_t frnum;
-
-	/** Pointer(physical) to the Frame List */
-	ioport32_t flbaseadd;
-
-	/** SOF modification to match external timers */
-	ioport8_t sofmod;
-
-	PADD8(3);
-	ioport16_t ports[];
-} uhci_regs_t;
-
-#define UHCI_FRAME_LIST_COUNT 1024
-#define UHCI_DEBUGER_TIMEOUT 5000000
-#define UHCI_ALLOWED_HW_FAIL 5
-
-/** Main UHCI driver structure */
-typedef struct hc {
-	/* Common hc_device header */
-	hc_device_t base;
-
-	uhci_rh_t rh;
-	bus_t bus;
-	usb2_bus_helper_t bus_helper;
-
-	/** Addresses of I/O registers */
-	uhci_regs_t *registers;
-
-	/** Frame List contains 1024 link pointers */
-	link_pointer_t *frame_list;
-
-	/** List and queue of interrupt transfers */
-	transfer_list_t transfers_interrupt;
-	/** List and queue of low speed control transfers */
-	transfer_list_t transfers_control_slow;
-	/** List and queue of full speed bulk transfers */
-	transfer_list_t transfers_bulk_full;
-	/** List and queue of full speed control transfers */
-	transfer_list_t transfers_control_full;
-
-	/** Pointer table to the above lists, helps during scheduling */
-	transfer_list_t *transfers[2][4];
-
-	/**
-	 * Guard for the pending list. Can be locked under EP guard, but not
-	 * vice versa.
-	 */
-	fibril_mutex_t guard;
-	/** List of endpoints with a transfer scheduled */
-	list_t pending_endpoints;
-
-	/** Number of hw failures detected. */
-	unsigned hw_failures;
-} hc_t;
-
-typedef struct uhci_endpoint {
-	endpoint_t base;
-
-	bool toggle;
-} uhci_endpoint_t;
-
-static inline hc_t *hcd_to_hc(hc_device_t *hcd)
-{
-	assert(hcd);
-	return (hc_t *) hcd;
-}
-
-static inline hc_t *bus_to_hc(bus_t *bus)
-{
-	assert(bus);
-	return member_to_inst(bus, hc_t, bus);
-}
-
-int hc_unschedule_batch(usb_transfer_batch_t *);
-
-extern errno_t hc_add(hc_device_t *, const hw_res_list_parsed_t *);
-extern errno_t hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *, int *);
-extern errno_t hc_start(hc_device_t *);
-extern errno_t hc_setup_roothub(hc_device_t *);
-extern errno_t hc_gone(hc_device_t *);
-extern errno_t hc_quiesce(hc_device_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/hw_struct/link_pointer.h
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/link_pointer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-
-#ifndef DRV_UHCI_HW_STRUCT_LINK_POINTER_H
-#define DRV_UHCI_HW_STRUCT_LINK_POINTER_H
-
-#include <stdint.h>
-
-/** UHCI link pointer, used by many data structures */
-typedef uint32_t link_pointer_t;
-
-#define LINK_POINTER_TERMINATE_FLAG (1 << 0)
-#define LINK_POINTER_QUEUE_HEAD_FLAG (1 << 1)
-#define LINK_POINTER_ZERO_BIT_FLAG (1 << 2)
-#define LINK_POINTER_VERTICAL_FLAG (1 << 2)
-#define LINK_POINTER_RESERVED_FLAG (1 << 3)
-
-#define LINK_POINTER_ADDRESS_MASK 0xfffffff0 /* upper 28 bits */
-
-#define LINK_POINTER_QH(address) \
-	((address & LINK_POINTER_ADDRESS_MASK) | LINK_POINTER_QUEUE_HEAD_FLAG)
-
-#define LINK_POINTER_TD(address) \
-	(address & LINK_POINTER_ADDRESS_MASK)
-
-#define LINK_POINTER_TERM \
-	((link_pointer_t)LINK_POINTER_TERMINATE_FLAG)
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/hw_struct/queue_head.h
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/queue_head.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-
-#ifndef DRV_UHCI_HW_STRUCT_QH_H
-#define DRV_UHCI_HW_STRUCT_QH_H
-
-#include <assert.h>
-#include <stdint.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "link_pointer.h"
-#include "transfer_descriptor.h"
-
-/** This structure is defined in UHCI design guide p. 31 */
-typedef struct queue_head {
-	/** Pointer to the next entity (another QH or TD */
-	volatile link_pointer_t next;
-	/**
-	 * Pointer to the contained entities
-	 * (execution controlled by vertical flag)
-	 */
-	volatile link_pointer_t element;
-} __attribute__((packed, aligned(16))) qh_t;
-
-/** Initialize queue head structure
- *
- * @param[in] instance qh_t structure to initialize.
- *
- * Sets both pointer to terminal NULL.
- */
-static inline void qh_init(qh_t *instance)
-{
-	assert(instance);
-
-	instance->element = LINK_POINTER_TERM;
-	instance->next = LINK_POINTER_TERM;
-}
-
-/** Set queue head next pointer
- *
- * @param[in] instance qh_t structure to use.
- * @param[in] next Address of the next queue.
- *
- * Adds proper flag. If the pointer is NULL, sets next to terminal NULL.
- */
-static inline void qh_set_next_qh(qh_t *instance, qh_t *next)
-{
-	/*
-	 * Physical address has to be below 4GB,
-	 * it is an UHCI limitation and malloc32
-	 * should guarantee this
-	 */
-	const uint32_t pa = addr_to_phys(next);
-	if (pa) {
-		instance->next = LINK_POINTER_QH(pa);
-	} else {
-		instance->next = LINK_POINTER_TERM;
-	}
-}
-
-/** Set queue head element pointer
- *
- * @param[in] instance qh_t structure to use.
- * @param[in] td Transfer descriptor to set as the first element.
- *
- * Adds proper flag. If the pointer is NULL, sets element to terminal NULL.
- */
-static inline void qh_set_element_td(qh_t *instance, td_t *td)
-{
-	/*
-	 * Physical address has to be below 4GB,
-	 * it is an UHCI limitation and malloc32
-	 * should guarantee this
-	 */
-	const uint32_t pa = addr_to_phys(td);
-	if (pa) {
-		instance->element = LINK_POINTER_TD(pa);
-	} else {
-		instance->element = LINK_POINTER_TERM;
-	}
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-
-#include <assert.h>
-#include <errno.h>
-
-#include <usb/debug.h>
-#include <usb/usb.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "link_pointer.h"
-#include "transfer_descriptor.h"
-
-/** Initialize Transfer Descriptor
- *
- * @param[in] instance Memory place to initialize.
- * @param[in] err_count Number of retries hc should attempt.
- * @param[in] size Size of data source.
- * @param[in] toggle Value of toggle bit.
- * @param[in] iso True if TD represents Isochronous transfer.
- * @param[in] low_speed Target device's speed.
- * @param[in] target Address and endpoint receiving the transfer.
- * @param[in] pid Packet identification (SETUP, IN or OUT).
- * @param[in] buffer Source of data.
- * @param[in] next Net TD in transaction.
- * @return Error code.
- *
- * Uses a mix of supplied and default values.
- * Implicit values:
- *  - all TDs have vertical flag set (makes transfers to endpoints atomic)
- *  - in the error field only active it is set
- *  - if the packet uses PID_IN and is not isochronous SPD is set
- *
- * Dumps 8 bytes of buffer if PID_SETUP is used.
- */
-void td_init(td_t *instance, int err_count, size_t size, bool toggle, bool iso,
-    bool low_speed, usb_target_t target, usb_packet_id pid, const void *buffer,
-    const td_t *next)
-{
-	assert(instance);
-	assert(size < 1024);
-	assert((pid == USB_PID_SETUP) || (pid == USB_PID_IN) ||
-	    (pid == USB_PID_OUT));
-
-	const uint32_t next_pa = addr_to_phys(next);
-	assert((next_pa & LINK_POINTER_ADDRESS_MASK) == next_pa);
-
-	instance->next = 0 |
-	    LINK_POINTER_VERTICAL_FLAG |
-	    (next_pa ? next_pa : LINK_POINTER_TERMINATE_FLAG);
-
-	instance->status = 0 |
-	    ((err_count & TD_STATUS_ERROR_COUNT_MASK) <<
-	    TD_STATUS_ERROR_COUNT_POS) |
-	    (low_speed ? TD_STATUS_LOW_SPEED_FLAG : 0) |
-	    (iso ? TD_STATUS_ISOCHRONOUS_FLAG : 0) |
-	    TD_STATUS_ERROR_ACTIVE;
-
-	if (pid == USB_PID_IN && !iso) {
-		instance->status |= TD_STATUS_SPD_FLAG;
-	}
-
-	instance->device = 0 |
-	    (((size - 1) & TD_DEVICE_MAXLEN_MASK) << TD_DEVICE_MAXLEN_POS) |
-	    (toggle ? TD_DEVICE_DATA_TOGGLE_ONE_FLAG : 0) |
-	    ((target.address & TD_DEVICE_ADDRESS_MASK) <<
-	    TD_DEVICE_ADDRESS_POS) |
-	    ((target.endpoint & TD_DEVICE_ENDPOINT_MASK) <<
-	    TD_DEVICE_ENDPOINT_POS) |
-	    ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
-
-	instance->buffer_ptr = addr_to_phys(buffer);
-
-	usb_log_debug2("Created TD(%p): %X:%X:%X:%X(%p).",
-	    instance, instance->next, instance->status, instance->device,
-	    instance->buffer_ptr, buffer);
-	td_print_status(instance);
-	if (pid == USB_PID_SETUP) {
-		usb_log_debug2("SETUP BUFFER: %s",
-		    usb_debug_str_buffer(buffer, 8, 8));
-	}
-}
-
-/** Convert TD status into standard error code
- *
- * @param[in] instance TD structure to use.
- * @return Error code.
- */
-errno_t td_status(const td_t *instance)
-{
-	assert(instance);
-
-	/* This is hc internal error it should never be reported. */
-	if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0)
-		return EIO;
-
-	/*
-	 * CRC or timeout error, like device not present or bad data,
-	 * it won't be reported unless err count reached zero
-	 */
-	if ((instance->status & TD_STATUS_ERROR_CRC) != 0)
-		return EBADCHECKSUM;
-
-	/* HC does not end transactions on these, it should never be reported */
-	if ((instance->status & TD_STATUS_ERROR_NAK) != 0)
-		return EAGAIN;
-
-	/* Buffer overrun or underrun */
-	if ((instance->status & TD_STATUS_ERROR_BUFFER) != 0)
-		return ERANGE;
-
-	/* Device babble is something serious */
-	if ((instance->status & TD_STATUS_ERROR_BABBLE) != 0)
-		return EIO;
-
-	/*
-	 * Stall might represent err count reaching zero or stall response from
-	 * the device. If err count reached zero, one of the above is reported
-	 */
-	if ((instance->status & TD_STATUS_ERROR_STALLED) != 0)
-		return ESTALL;
-
-	return EOK;
-}
-
-/** Print values in status field (dw1) in a human readable way.
- *
- * @param[in] instance TD structure to use.
- */
-void td_print_status(const td_t *instance)
-{
-	assert(instance);
-	const uint32_t s = instance->status;
-	usb_log_debug2("TD(%p) status(%#" PRIx32 "):%s %d,%s%s%s%s%s%s%s%s%s%s%s %zu.",
-	    instance, instance->status,
-	    (s & TD_STATUS_SPD_FLAG) ? " SPD," : "",
-	    (s >> TD_STATUS_ERROR_COUNT_POS) & TD_STATUS_ERROR_COUNT_MASK,
-	    (s & TD_STATUS_LOW_SPEED_FLAG) ? " LOW SPEED," : "",
-	    (s & TD_STATUS_ISOCHRONOUS_FLAG) ? " ISOCHRONOUS," : "",
-	    (s & TD_STATUS_IOC_FLAG) ? " IOC," : "",
-	    (s & TD_STATUS_ERROR_ACTIVE) ? " ACTIVE," : "",
-	    (s & TD_STATUS_ERROR_STALLED) ? " STALLED," : "",
-	    (s & TD_STATUS_ERROR_BUFFER) ? " BUFFER," : "",
-	    (s & TD_STATUS_ERROR_BABBLE) ? " BABBLE," : "",
-	    (s & TD_STATUS_ERROR_NAK) ? " NAK," : "",
-	    (s & TD_STATUS_ERROR_CRC) ? " CRC/TIMEOUT," : "",
-	    (s & TD_STATUS_ERROR_BIT_STUFF) ? " BIT_STUFF," : "",
-	    (s & TD_STATUS_ERROR_RESERVED) ? " RESERVED," : "",
-	    td_act_size(instance));
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-
-#ifndef DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-#define DRV_UHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
-
-#include <assert.h>
-#include <usb/usb.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include "link_pointer.h"
-
-/** Transfer Descriptor, defined in UHCI design guide p. 26 */
-typedef struct transfer_descriptor {
-	/** Pointer to the next entity (TD or QH) */
-	link_pointer_t next;
-
-	/** Status doubleword */
-	volatile uint32_t status;
-#define TD_STATUS_RESERVED_MASK 0xc000f800
-#define TD_STATUS_SPD_FLAG         (1 << 29)
-#define TD_STATUS_ERROR_COUNT_POS 27
-#define TD_STATUS_ERROR_COUNT_MASK 0x3
-#define TD_STATUS_LOW_SPEED_FLAG   (1 << 26)
-#define TD_STATUS_ISOCHRONOUS_FLAG (1 << 25)
-#define TD_STATUS_IOC_FLAG         (1 << 24)
-
-#define TD_STATUS_ERROR_ACTIVE    (1 << 23)
-#define TD_STATUS_ERROR_STALLED   (1 << 22)
-#define TD_STATUS_ERROR_BUFFER    (1 << 21)
-#define TD_STATUS_ERROR_BABBLE    (1 << 20)
-#define TD_STATUS_ERROR_NAK       (1 << 19)
-#define TD_STATUS_ERROR_CRC       (1 << 18)
-#define TD_STATUS_ERROR_BIT_STUFF (1 << 17)
-#define TD_STATUS_ERROR_RESERVED  (1 << 16)
-#define TD_STATUS_ERROR_POS 16
-#define TD_STATUS_ERROR_MASK 0xff
-
-#define TD_STATUS_ACTLEN_POS 0
-#define TD_STATUS_ACTLEN_MASK 0x7ff
-
-	/** Double word with USB device specific info */
-	volatile uint32_t device;
-#define TD_DEVICE_MAXLEN_POS 21
-#define TD_DEVICE_MAXLEN_MASK 0x7ff
-#define TD_DEVICE_RESERVED_FLAG        (1 << 20)
-#define TD_DEVICE_DATA_TOGGLE_ONE_FLAG (1 << 19)
-#define TD_DEVICE_ENDPOINT_POS 15
-#define TD_DEVICE_ENDPOINT_MASK 0xf
-#define TD_DEVICE_ADDRESS_POS 8
-#define TD_DEVICE_ADDRESS_MASK 0x7f
-#define TD_DEVICE_PID_POS 0
-#define TD_DEVICE_PID_MASK 0xff
-
-	/** Pointer(physical) to the beginning of the transaction's buffer */
-	volatile uint32_t buffer_ptr;
-
-	/*
-	 * According to UHCI design guide, there is 16 bytes of
-	 * data available here.
-	 * According to Linux kernel the hardware does not care,
-	 * memory just needs to be aligned. We don't use it anyway.
-	 */
-} __attribute__((packed, aligned(16))) td_t;
-
-void td_init(td_t *instance, int error_count, size_t size, bool toggle,
-    bool iso, bool low_speed, usb_target_t target, usb_packet_id pid,
-    const void *buffer, const td_t *next);
-
-errno_t td_status(const td_t *instance);
-
-void td_print_status(const td_t *instance);
-
-/** Helper function for parsing actual size out of TD.
- *
- * @param[in] instance TD structure to use.
- * @return Parsed actual size.
- */
-static inline size_t td_act_size(const td_t *instance)
-{
-	assert(instance);
-	const uint32_t s = instance->status;
-	/* Actual size is encoded as n-1 (UHCI design guide p. 23) */
-	return ((s >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK;
-}
-
-/** Check whether less than max data were received on SPD marked transfer.
- *
- * @param[in] instance TD structure to use.
- * @return True if data packet is short (less than max bytes and SPD set),
- * false otherwise.
- */
-static inline bool td_is_short(const td_t *instance)
-{
-	const size_t act_size = td_act_size(instance);
-	const size_t max_size =
-	    ((instance->device >> TD_DEVICE_MAXLEN_POS) + 1) &
-	    TD_DEVICE_MAXLEN_MASK;
-	return
-	    (instance->status | TD_STATUS_SPD_FLAG) && act_size < max_size;
-}
-
-/** Helper function for parsing value of toggle bit.
- *
- * @param[in] instance TD structure to use.
- * @return Toggle bit value.
- */
-static inline int td_toggle(const td_t *instance)
-{
-	assert(instance);
-	return (instance->device & TD_DEVICE_DATA_TOGGLE_ONE_FLAG) ? 1 : 0;
-}
-
-/** Helper function for parsing value of active bit
- *
- * @param[in] instance TD structure to use.
- * @return Active bit value.
- */
-static inline bool td_is_active(const td_t *instance)
-{
-	assert(instance);
-	return (instance->status & TD_STATUS_ERROR_ACTIVE) != 0;
-}
-
-/** Helper function for setting IOC bit.
- *
- * @param[in] instance TD structure to use.
- */
-static inline void td_set_ioc(td_t *instance)
-{
-	assert(instance);
-	instance->status |= TD_STATUS_IOC_FLAG;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/main.c
===================================================================
--- uspace/drv/bus/usb/uhci/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Vojtech Horky, Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver initialization
- */
-
-#include <assert.h>
-#include <ddf/driver.h>
-#include <errno.h>
-#include <io/log.h>
-#include <io/logctl.h>
-#include <pci_dev_iface.h>
-#include <stdio.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/host/utility.h>
-
-#include "hc.h"
-
-#define NAME "uhci"
-
-static errno_t disable_legacy(hc_device_t *);
-
-static const hc_driver_t uhci_driver = {
-	.name = NAME,
-	.hc_device_size = sizeof(hc_t),
-	.claim = disable_legacy,
-	.irq_code_gen = hc_gen_irq_code,
-	.hc_add = hc_add,
-	.start = hc_start,
-	.setup_root_hub = hc_setup_roothub,
-	.hc_gone = hc_gone,
-	.hc_quiesce = hc_quiesce
-};
-
-/** Call the PCI driver with a request to clear legacy support register
- *
- * @param[in] device Device asking to disable interrupts
- * @return Error code.
- */
-static errno_t disable_legacy(hc_device_t *hcd)
-{
-	assert(hcd);
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(hcd->ddf_dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	/*
-	 * See UHCI design guide page 45 for these values.
-	 * Write all WC bits in USB legacy register
-	 */
-	return pci_config_space_write_16(parent_sess, 0xc0, 0xaf00);
-}
-
-/** Initialize global driver structures (NONE).
- *
- * @param[in] argc Number of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS UHCI driver.\n");
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return hc_driver_main(&uhci_driver);
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/meson.build
===================================================================
--- uspace/drv/bus/usb/uhci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhost', 'usbvirt', 'usb', 'usbdev' ]
-src = files(
-	'hc.c',
-	'main.c',
-	'transfer_list.c',
-	'uhci_batch.c',
-	'uhci_rh.c',
-	'hw_struct/transfer_descriptor.c',
-)
Index: pace/drv/bus/usb/uhci/transfer_list.c
===================================================================
--- uspace/drv/bus/usb/uhci/transfer_list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver transfer list implementation
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <barrier.h>
-#include <stdint.h>
-#include <usb/debug.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/host/utils/malloc32.h>
-#include <usb/host/utility.h>
-
-#include "hw_struct/link_pointer.h"
-#include "transfer_list.h"
-#include "hc.h"
-
-/** Initialize transfer list structures.
- *
- * @param[in] instance Memory place to use.
- * @param[in] name Name of the new list.
- * @return Error code
- *
- * Allocates memory for internal qh_t structure.
- */
-errno_t transfer_list_init(transfer_list_t *instance, const char *name)
-{
-	assert(instance);
-	instance->name = name;
-	instance->queue_head = malloc32(sizeof(qh_t));
-	if (!instance->queue_head) {
-		usb_log_error("Failed to allocate queue head.");
-		return ENOMEM;
-	}
-	const uint32_t queue_head_pa = addr_to_phys(instance->queue_head);
-	usb_log_debug2("Transfer list %s setup with QH: %p (%#" PRIx32 " ).",
-	    name, instance->queue_head, queue_head_pa);
-
-	qh_init(instance->queue_head);
-	list_initialize(&instance->batch_list);
-	fibril_mutex_initialize(&instance->guard);
-	return EOK;
-}
-
-/** Dispose transfer list structures.
- *
- * @param[in] instance Memory place to use.
- *
- * Frees memory of the internal qh_t structure.
- */
-void transfer_list_fini(transfer_list_t *instance)
-{
-	assert(instance);
-	free32(instance->queue_head);
-}
-/** Set the next list in transfer list chain.
- *
- * @param[in] instance List to lead.
- * @param[in] next List to append.
- * @return Error code
- *
- * Does not check whether this replaces an existing list .
- */
-void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next)
-{
-	assert(instance);
-	assert(instance->queue_head);
-	assert(next);
-	/* Set queue_head.next to point to the follower */
-	qh_set_next_qh(instance->queue_head, next->queue_head);
-}
-
-/**
- * Add transfer batch to the list and queue.
- *
- * The batch is added to the end of the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] batch Transfer batch to submit. After return, the batch must
- *                  not be used further.
- */
-int transfer_list_add_batch(
-    transfer_list_t *instance, uhci_transfer_batch_t *uhci_batch)
-{
-	assert(instance);
-	assert(uhci_batch);
-
-	endpoint_t *ep = uhci_batch->base.ep;
-
-	fibril_mutex_lock(&instance->guard);
-
-	const int err = endpoint_activate_locked(ep, &uhci_batch->base);
-	if (err) {
-		fibril_mutex_unlock(&instance->guard);
-		return err;
-	}
-
-	usb_log_debug2("Batch %p adding to queue %s.",
-	    uhci_batch, instance->name);
-
-	/* Assume there is nothing scheduled */
-	qh_t *last_qh = instance->queue_head;
-	/* There is something scheduled */
-	if (!list_empty(&instance->batch_list)) {
-		last_qh = uhci_transfer_batch_from_link(
-		    list_last(&instance->batch_list))->qh;
-	}
-	/* Add to the hardware queue. */
-	const uint32_t pa = addr_to_phys(uhci_batch->qh);
-	assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
-
-	/* Make sure all data in the batch are written */
-	write_barrier();
-
-	/* keep link */
-	uhci_batch->qh->next = last_qh->next;
-	qh_set_next_qh(last_qh, uhci_batch->qh);
-
-	/* Make sure the pointer is updated */
-	write_barrier();
-
-	/* Add to the driver's list */
-	list_append(&uhci_batch->link, &instance->batch_list);
-
-	usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT
-	    " scheduled in queue %s.", uhci_batch,
-	    USB_TRANSFER_BATCH_ARGS(uhci_batch->base), instance->name);
-	fibril_mutex_unlock(&instance->guard);
-	return EOK;
-}
-
-/**
- * Reset toggle on endpoint callback.
- */
-static void uhci_reset_toggle(endpoint_t *ep)
-{
-	uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) ep;
-	uhci_ep->toggle = 0;
-}
-
-/** Add completed batches to the provided list.
- *
- * @param[in] instance List to use.
- * @param[in] done list to fill
- */
-void transfer_list_check_finished(transfer_list_t *instance)
-{
-	assert(instance);
-
-	fibril_mutex_lock(&instance->guard);
-	list_foreach_safe(instance->batch_list, current, next) {
-		uhci_transfer_batch_t *batch = uhci_transfer_batch_from_link(current);
-
-		if (uhci_transfer_batch_check_completed(batch)) {
-			assert(batch->base.ep->active_batch == &batch->base);
-			endpoint_deactivate_locked(batch->base.ep);
-			hc_reset_toggles(&batch->base, &uhci_reset_toggle);
-			transfer_list_remove_batch(instance, batch);
-			usb_transfer_batch_finish(&batch->base);
-		}
-	}
-	fibril_mutex_unlock(&instance->guard);
-}
-
-/** Walk the list and finish all batches with EINTR.
- *
- * @param[in] instance List to use.
- */
-void transfer_list_abort_all(transfer_list_t *instance)
-{
-	fibril_mutex_lock(&instance->guard);
-	while (!list_empty(&instance->batch_list)) {
-		link_t *const current = list_first(&instance->batch_list);
-		uhci_transfer_batch_t *batch = uhci_transfer_batch_from_link(current);
-		transfer_list_remove_batch(instance, batch);
-	}
-	fibril_mutex_unlock(&instance->guard);
-}
-
-/** Remove a transfer batch from the list and queue.
- *
- * @param[in] instance List to use.
- * @param[in] batch Transfer batch to remove.
- *
- * Does not lock the transfer list, caller is responsible for that.
- */
-void transfer_list_remove_batch(
-    transfer_list_t *instance, uhci_transfer_batch_t *uhci_batch)
-{
-	assert(instance);
-	assert(instance->queue_head);
-	assert(uhci_batch);
-	assert(uhci_batch->qh);
-	assert(fibril_mutex_is_locked(&instance->guard));
-	assert(!list_empty(&instance->batch_list));
-
-	usb_log_debug2("Batch %p removing from queue %s.",
-	    uhci_batch, instance->name);
-
-	/* Assume I'm the first */
-	const char *qpos = "FIRST";
-	qh_t *prev_qh = instance->queue_head;
-	/* Remove from the hardware queue */
-	if (list_first(&instance->batch_list) != &uhci_batch->link) {
-		/* There is a batch in front of me */
-		prev_qh =
-		    uhci_transfer_batch_from_link(uhci_batch->link.prev)->qh;
-		qpos = "NOT FIRST";
-	}
-	assert((prev_qh->next & LINK_POINTER_ADDRESS_MASK) ==
-	    addr_to_phys(uhci_batch->qh));
-	prev_qh->next = uhci_batch->qh->next;
-
-	/* Make sure the pointer is updated */
-	write_barrier();
-
-	/* Remove from the batch list */
-	list_remove(&uhci_batch->link);
-	usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " removed (%s) "
-	    "from %s, next: %x.", uhci_batch,
-	    USB_TRANSFER_BATCH_ARGS(uhci_batch->base),
-	    qpos, instance->name, uhci_batch->qh->next);
-}
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/transfer_list.h
===================================================================
--- uspace/drv/bus/usb/uhci/transfer_list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver transfer list structure
- */
-
-#ifndef DRV_UHCI_TRANSFER_LIST_H
-#define DRV_UHCI_TRANSFER_LIST_H
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-
-#include "hw_struct/queue_head.h"
-#include "uhci_batch.h"
-/** Structure maintaining both hw queue and software list
- * of currently executed transfers
- */
-typedef struct transfer_list {
-	/** Guard against multiple add/remove races */
-	fibril_mutex_t guard;
-	/** UHCI hw structure representing this queue */
-	qh_t *queue_head;
-	/** Assigned name, for nicer debug output */
-	const char *name;
-	/** List of all batches in this list */
-	list_t batch_list;
-} transfer_list_t;
-
-void transfer_list_fini(transfer_list_t *);
-errno_t transfer_list_init(transfer_list_t *, const char *);
-void transfer_list_set_next(transfer_list_t *, transfer_list_t *);
-errno_t transfer_list_add_batch(transfer_list_t *, uhci_transfer_batch_t *);
-void transfer_list_remove_batch(transfer_list_t *, uhci_transfer_batch_t *);
-void transfer_list_check_finished(transfer_list_t *);
-void transfer_list_abort_all(transfer_list_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/uhci.ma
===================================================================
--- uspace/drv/bus/usb/uhci/uhci.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 pci/class=0c&subclass=03&progif=00
Index: pace/drv/bus/usb/uhci/uhci_batch.c
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_batch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,339 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver USB transfer structure
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include <usb/usb.h>
-#include <usb/debug.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/utils/malloc32.h>
-
-#include "uhci_batch.h"
-#include "hc.h"
-#include "hw_struct/transfer_descriptor.h"
-
-#define DEFAULT_ERROR_COUNT 3
-
-/** Transfer batch setup table. */
-static void (*const batch_setup[])(uhci_transfer_batch_t *);
-
-/** Destroys uhci_transfer_batch_t structure.
- *
- * @param[in] uhci_batch Instance to destroy.
- */
-void uhci_transfer_batch_destroy(uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-	dma_buffer_free(&uhci_batch->uhci_dma_buffer);
-	free(uhci_batch);
-}
-
-/** Allocate memory and initialize internal data structure.
- *
- * @param[in] usb_batch Pointer to generic USB batch structure.
- * @return Valid pointer if all structures were successfully created,
- * NULL otherwise.
- */
-uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *ep)
-{
-	uhci_transfer_batch_t *uhci_batch =
-	    calloc(1, sizeof(uhci_transfer_batch_t));
-	if (!uhci_batch) {
-		usb_log_error("Failed to allocate UHCI batch.");
-		return NULL;
-	}
-
-	usb_transfer_batch_init(&uhci_batch->base, ep);
-
-	link_initialize(&uhci_batch->link);
-	return uhci_batch;
-}
-
-/*
- * Prepares batch for committing.
- *
- * Determines the number of needed transfer descriptors (TDs).
- * Prepares a transport buffer (that is accessible by the hardware).
- * Initializes parameters needed for the transfer and callback.
- */
-int uhci_transfer_batch_prepare(uhci_transfer_batch_t *uhci_batch)
-{
-	static_assert((sizeof(td_t) % 16) == 0, "");
-
-	usb_transfer_batch_t *usb_batch = &uhci_batch->base;
-
-	uhci_batch->td_count = (usb_batch->size + usb_batch->ep->max_packet_size - 1) /
-	    usb_batch->ep->max_packet_size;
-
-	if (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
-		uhci_batch->td_count += 2;
-	}
-
-	const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) ?
-	    USB_SETUP_PACKET_SIZE :
-	    0;
-
-	const size_t total_size = (sizeof(td_t) * uhci_batch->td_count) +
-	    sizeof(qh_t) + setup_size;
-
-	if (dma_buffer_alloc(&uhci_batch->uhci_dma_buffer, total_size)) {
-		usb_log_error("Failed to allocate UHCI buffer.");
-		return ENOMEM;
-	}
-	memset(uhci_batch->uhci_dma_buffer.virt, 0, total_size);
-
-	uhci_batch->tds = uhci_batch->uhci_dma_buffer.virt;
-	uhci_batch->qh = (qh_t *) &uhci_batch->tds[uhci_batch->td_count];
-
-	qh_init(uhci_batch->qh);
-	qh_set_element_td(uhci_batch->qh, &uhci_batch->tds[0]);
-
-	void *setup_buffer = uhci_transfer_batch_setup_buffer(uhci_batch);
-	assert(setup_buffer == (void *) (uhci_batch->qh + 1));
-	/* Copy SETUP packet data to the device buffer */
-	memcpy(setup_buffer, usb_batch->setup.buffer, setup_size);
-
-	usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT
-	    " memory structures ready.", usb_batch,
-	    USB_TRANSFER_BATCH_ARGS(*usb_batch));
-
-	assert(batch_setup[usb_batch->ep->transfer_type]);
-	batch_setup[usb_batch->ep->transfer_type](uhci_batch);
-
-	return EOK;
-}
-
-/** Check batch TDs for activity.
- *
- * @param[in] uhci_batch Batch structure to use.
- * @return False, if there is an active TD, true otherwise.
- *
- * Walk all TDs. Stop with false if there is an active one (it is to be
- * processed). Stop with true if an error is found. Return true if the last TD
- * is reached.
- */
-bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-	usb_transfer_batch_t *batch = &uhci_batch->base;
-
-	usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT
-	    " checking %zu transfer(s) for completion.",
-	    uhci_batch, USB_TRANSFER_BATCH_ARGS(*batch),
-	    uhci_batch->td_count);
-	batch->transferred_size = 0;
-
-	uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) batch->ep;
-
-	for (size_t i = 0; i < uhci_batch->td_count; ++i) {
-		if (td_is_active(&uhci_batch->tds[i])) {
-			return false;
-		}
-
-		batch->error = td_status(&uhci_batch->tds[i]);
-		if (batch->error != EOK) {
-			assert(batch->ep != NULL);
-
-			usb_log_debug("Batch %p found error TD(%zu->%p):%"
-			    PRIx32 ".", uhci_batch, i,
-			    &uhci_batch->tds[i], uhci_batch->tds[i].status);
-			td_print_status(&uhci_batch->tds[i]);
-
-			uhci_ep->toggle = td_toggle(&uhci_batch->tds[i]);
-			goto substract_ret;
-		}
-
-		batch->transferred_size +=
-		    td_act_size(&uhci_batch->tds[i]);
-		if (td_is_short(&uhci_batch->tds[i]))
-			goto substract_ret;
-	}
-substract_ret:
-	if (batch->transferred_size > 0 && batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
-		assert(batch->transferred_size >= USB_SETUP_PACKET_SIZE);
-		batch->transferred_size -= USB_SETUP_PACKET_SIZE;
-	}
-
-	assert(batch->transferred_size <= batch->size);
-
-	return true;
-}
-
-/** Direction to pid conversion table */
-static const usb_packet_id direction_pids[] = {
-	[USB_DIRECTION_IN] = USB_PID_IN,
-	[USB_DIRECTION_OUT] = USB_PID_OUT,
-};
-
-/** Prepare generic data transfer
- *
- * @param[in] uhci_batch Batch structure to use.
- * @param[in] dir Communication direction.
- *
- * Transactions with alternating toggle bit and supplied pid value.
- * The last transfer is marked with IOC flag.
- */
-static void batch_data(uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-
-	usb_direction_t dir = uhci_batch->base.dir;
-	assert(dir == USB_DIRECTION_OUT || dir == USB_DIRECTION_IN);
-
-	const usb_packet_id pid = direction_pids[dir];
-	const bool low_speed =
-	    uhci_batch->base.ep->device->speed == USB_SPEED_LOW;
-	const size_t mps = uhci_batch->base.ep->max_packet_size;
-
-	uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) uhci_batch->base.ep;
-
-	int toggle = uhci_ep->toggle;
-	assert(toggle == 0 || toggle == 1);
-
-	size_t td = 0;
-	size_t remain_size = uhci_batch->base.size;
-	char *buffer = uhci_transfer_batch_data_buffer(uhci_batch);
-
-	while (remain_size > 0) {
-		const size_t packet_size = min(remain_size, mps);
-
-		const td_t *next_td = (td + 1 < uhci_batch->td_count) ?
-		    &uhci_batch->tds[td + 1] : NULL;
-
-		assert(td < uhci_batch->td_count);
-		td_init(
-		    &uhci_batch->tds[td], DEFAULT_ERROR_COUNT, packet_size,
-		    toggle, false, low_speed, uhci_batch->base.target, pid, buffer, next_td);
-
-		++td;
-		toggle = 1 - toggle;
-		buffer += packet_size;
-		remain_size -= packet_size;
-	}
-	td_set_ioc(&uhci_batch->tds[td - 1]);
-	uhci_ep->toggle = toggle;
-	usb_log_debug2(
-	    "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.",
-	    uhci_batch,
-	    usb_str_transfer_type(uhci_batch->base.ep->transfer_type),
-	    usb_str_direction(uhci_batch->base.ep->direction),
-	    USB_TRANSFER_BATCH_ARGS(uhci_batch->base));
-}
-
-/** Prepare generic control transfer
- *
- * @param[in] uhci_batch Batch structure to use.
- * @param[in] dir Communication direction.
- *
- * Setup stage with toggle 0 and USB_PID_SETUP.
- * Data stage with alternating toggle and pid determined by the communication
- * direction.
- * Status stage with toggle 1 and pid determined by the communication direction.
- * The last transfer is marked with IOC.
- */
-static void batch_control(uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-
-	usb_direction_t dir = uhci_batch->base.dir;
-	assert(dir == USB_DIRECTION_OUT || dir == USB_DIRECTION_IN);
-	assert(uhci_batch->td_count >= 2);
-	static const usb_packet_id status_stage_pids[] = {
-		[USB_DIRECTION_IN] = USB_PID_OUT,
-		[USB_DIRECTION_OUT] = USB_PID_IN,
-	};
-
-	const usb_packet_id data_stage_pid = direction_pids[dir];
-	const usb_packet_id status_stage_pid = status_stage_pids[dir];
-	const bool low_speed =
-	    uhci_batch->base.ep->device->speed == USB_SPEED_LOW;
-	const size_t mps = uhci_batch->base.ep->max_packet_size;
-	const usb_target_t target = uhci_batch->base.target;
-
-	/* setup stage */
-	td_init(
-	    &uhci_batch->tds[0], DEFAULT_ERROR_COUNT,
-	    USB_SETUP_PACKET_SIZE, 0, false,
-	    low_speed, target, USB_PID_SETUP,
-	    uhci_transfer_batch_setup_buffer(uhci_batch), &uhci_batch->tds[1]);
-
-	/* data stage */
-	size_t td = 1;
-	unsigned toggle = 1;
-	size_t remain_size = uhci_batch->base.size;
-	char *buffer = uhci_transfer_batch_data_buffer(uhci_batch);
-
-	while (remain_size > 0) {
-		const size_t packet_size = min(remain_size, mps);
-
-		td_init(
-		    &uhci_batch->tds[td], DEFAULT_ERROR_COUNT, packet_size,
-		    toggle, false, low_speed, target, data_stage_pid,
-		    buffer, &uhci_batch->tds[td + 1]);
-
-		++td;
-		toggle = 1 - toggle;
-		buffer += packet_size;
-		remain_size -= packet_size;
-		assert(td < uhci_batch->td_count);
-	}
-
-	/* status stage */
-	assert(td == uhci_batch->td_count - 1);
-
-	td_init(
-	    &uhci_batch->tds[td], DEFAULT_ERROR_COUNT, 0, 1, false, low_speed,
-	    target, status_stage_pid, NULL, NULL);
-	td_set_ioc(&uhci_batch->tds[td]);
-
-	usb_log_debug2("Control last TD status: %x.",
-	    uhci_batch->tds[td].status);
-}
-
-static void (*const batch_setup[])(uhci_transfer_batch_t *) =
-    {
-	[USB_TRANSFER_CONTROL] = batch_control,
-	[USB_TRANSFER_BULK] = batch_data,
-	[USB_TRANSFER_INTERRUPT] = batch_data,
-	[USB_TRANSFER_ISOCHRONOUS] = NULL,
-};
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/uhci_batch.h
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_batch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver USB tranfer helper functions
- */
-
-#ifndef DRV_UHCI_BATCH_H
-#define DRV_UHCI_BATCH_H
-
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/host/endpoint.h>
-
-#include "hw_struct/queue_head.h"
-#include "hw_struct/transfer_descriptor.h"
-
-/** UHCI specific data required for USB transfer */
-typedef struct uhci_transfer_batch {
-	usb_transfer_batch_t base;
-
-	/** Queue head
-	 * This QH is used to maintain UHCI schedule structure and the element
-	 * pointer points to the first TD of this batch.
-	 */
-	qh_t *qh;
-	/** List of TDs needed for the transfer */
-	td_t *tds;
-	/** Number of TDs used by the transfer */
-	size_t td_count;
-	/* Setup data */
-	char *setup_buffer;
-	/** Backing TDs + setup_buffer */
-	dma_buffer_t uhci_dma_buffer;
-	/** List element */
-	link_t link;
-} uhci_transfer_batch_t;
-
-uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *);
-int uhci_transfer_batch_prepare(uhci_transfer_batch_t *);
-bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *);
-void uhci_transfer_batch_destroy(uhci_transfer_batch_t *);
-
-/** Get offset to setup buffer accessible to the HC hw.
- * @param uhci_batch UHCI batch structure.
- * @return Pointer to the setup buffer.
- */
-static inline void *uhci_transfer_batch_setup_buffer(
-    const uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-	return uhci_batch->uhci_dma_buffer.virt + sizeof(qh_t) +
-	    uhci_batch->td_count * sizeof(td_t);
-}
-
-/** Get offset to data buffer accessible to the HC hw.
- * @param uhci_batch UHCI batch structure.
- * @return Pointer to the data buffer.
- */
-static inline void *uhci_transfer_batch_data_buffer(
-    const uhci_transfer_batch_t *uhci_batch)
-{
-	assert(uhci_batch);
-	return uhci_batch->base.dma_buffer.virt;
-}
-
-/** Linked list conversion wrapper.
- * @param l Linked list link.
- * @return Pointer to the uhci batch structure.
- */
-static inline uhci_transfer_batch_t *uhci_transfer_batch_from_link(link_t *l)
-{
-	assert(l);
-	return list_get_instance(l, uhci_transfer_batch_t, link);
-}
-
-static inline uhci_transfer_batch_t *uhci_transfer_batch_get(
-    usb_transfer_batch_t *b)
-{
-	assert(b);
-	return (uhci_transfer_batch_t *) b;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/uhci/uhci_rh.c
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,514 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <async.h>
-#include <ddi.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <time.h>
-
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/classes/hub.h>
-#include <usb/request.h>
-#include <usb/host/endpoint.h>
-#include <usb/usb.h>
-
-#include "uhci_rh.h"
-
-enum {
-	UHCI_RH_PORT_COUNT = 2,
-	UHCI_PORT_BYTES = STATUS_BYTES(UHCI_RH_PORT_COUNT),
-};
-
-/** Hub descriptor. */
-static const struct {
-	/** Common hub descriptor header */
-	usb_hub_descriptor_header_t header;
-	/** Port removable status bits */
-	uint8_t removable[UHCI_PORT_BYTES];
-	/** Port powered status bits */
-	uint8_t powered[UHCI_PORT_BYTES];
-} __attribute__((packed)) hub_descriptor = {
-	.header = {
-		.length = sizeof(hub_descriptor),
-		.descriptor_type = USB_DESCTYPE_HUB,
-		.port_count = UHCI_RH_PORT_COUNT,
-		.characteristics =
-		    HUB_CHAR_NO_POWER_SWITCH_FLAG | HUB_CHAR_NO_OC_FLAG,
-		.power_good_time = 50,
-		.max_current = 0,
-	},
-	.removable = { 0 },
-	.powered = { 0xFF },
-};
-
-static usbvirt_device_ops_t ops;
-
-/** Initialize uhci rh structure.
- * @param instance Memory place to initialize.
- * @param ports Pointer to TWO UHCI RH port registers.
- * @param name device name, passed to virthub init
- * @return Error code, EOK on success.
- */
-errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name)
-{
-	assert(instance);
-	instance->ports[0] = ports;
-	instance->ports[1] = ports + 1;
-	instance->reset_changed[0] = false;
-	instance->reset_changed[1] = false;
-	return virthub_base_init(&instance->base, name, &ops, instance,
-	    NULL, &hub_descriptor.header, HUB_STATUS_CHANGE_PIPE);
-}
-
-/** Schedule USB batch for the root hub.
- *
- * @param instance UHCI rh instance
- * @param batch USB communication batch
- * @return EOK.
- *
- * The result of scheduling is always EOK. The result of communication does
- * not have to be.
- */
-errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch)
-{
-	assert(instance);
-	assert(batch);
-
-	do {
-		batch->error = virthub_base_request(&instance->base, batch->target,
-		    batch->dir, (void *) batch->setup.buffer,
-		    batch->dma_buffer.virt, batch->size, &batch->transferred_size);
-		if (batch->error == ENAK)
-			fibril_usleep(instance->base.endpoint_descriptor.poll_interval * 1000);
-		//TODO This is flimsy, but we can't exit early because
-		//ENAK is technically an error condition
-	} while (batch->error == ENAK);
-	usb_transfer_batch_finish(batch);
-	return EOK;
-}
-
-/** UHCI port register bits */
-enum {
-	STATUS_CONNECTED         = (1 << 0),
-	STATUS_CONNECTED_CHANGED = (1 << 1),
-	STATUS_ENABLED           = (1 << 2),
-	STATUS_ENABLED_CHANGED   = (1 << 3),
-	STATUS_LINE_D_PLUS       = (1 << 4),
-	STATUS_LINE_D_MINUS      = (1 << 5),
-	STATUS_RESUME            = (1 << 6),
-	STATUS_ALWAYS_ONE        = (1 << 7),
-
-	STATUS_LOW_SPEED = (1 <<  8),
-	STATUS_IN_RESET  = (1 <<  9),
-	STATUS_SUSPEND   = (1 << 12),
-
-	STATUS_CHANGE_BITS = STATUS_CONNECTED_CHANGED | STATUS_ENABLED_CHANGED,
-	STATUS_WC_BITS = STATUS_CHANGE_BITS,
-};
-
-/* HUB ROUTINES IMPLEMENTATION */
-
-static void uhci_port_reset_enable(ioport16_t *port)
-{
-	assert(port);
-	uint16_t port_status = pio_read_16(port);
-	/* We don't wan to remove changes, that's hub drivers work */
-	port_status &= ~STATUS_WC_BITS;
-	port_status |= STATUS_IN_RESET;
-	pio_write_16(port, port_status);
-	fibril_usleep(50000);
-	port_status = pio_read_16(port);
-	port_status &= ~STATUS_IN_RESET;
-	pio_write_16(port, port_status);
-	while ((port_status = pio_read_16(port)) & STATUS_IN_RESET)
-		;
-	/*
-	 * PIO delay, should not be longer than 3ms as the device might
-	 * enter suspend state.
-	 */
-	udelay(10);
-	/*
-	 * Drop ConnectionChange as some UHCI hw
-	 * sets this bit after reset, that is incorrect
-	 */
-	port_status &= ~STATUS_WC_BITS;
-	pio_write_16(port, port_status | STATUS_ENABLED | STATUS_CONNECTED_CHANGED);
-}
-#define TEST_SIZE_INIT(size, port, hub) \
-do { \
-	if (uint16_usb2host(setup_packet->length) != size) \
-		return ESTALL; \
-	port = uint16_usb2host(setup_packet->index) - 1; \
-	if (port != 0 && port != 1) \
-		return EINVAL; \
-	hub = virthub_get_data(device); \
-	assert(hub);\
-} while (0)
-
-#define RH_DEBUG(hub, port, msg, ...) \
-do { \
-	if ((int)port >= 0) \
-		usb_log_debug("RH(%p-%d): " msg, hub, port, ##__VA_ARGS__); \
-	else \
-		usb_log_debug("RH(%p):" msg, hub, ##__VA_ARGS__); \
-} while (0)
-
-/** USB HUB port state request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- *
- * Do not confuse with port status. Port state reports data line states,
- * it is usefull for debuging purposes only.
- */
-static errno_t req_get_port_state(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	uhci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(1, port, hub);
-	if (setup_packet->value != 0)
-		return EINVAL;
-
-	const uint16_t value = pio_read_16(hub->ports[port]);
-	data[0] = ((value & STATUS_LINE_D_MINUS) ? 1 : 0) |
-	    ((value & STATUS_LINE_D_PLUS) ? 2 : 0);
-	RH_DEBUG(hub, port, "Bus state %" PRIx8 "(source %" PRIx16 ")",
-	    data[0], value);
-	*act_size = 1;
-	return EOK;
-}
-
-#define BIT_VAL(val, bit) \
-	((val & bit) ? 1 : 0)
-#define UHCI2USB(val, bit, mask) \
-	(BIT_VAL(val, bit) ? (mask) : 0)
-
-/** Port status request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- *
- * Converts status reported via ioport to USB format.
- * @note: reset change status needs to be handled in sw.
- */
-static errno_t req_get_port_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	uhci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(4, port, hub);
-	if (setup_packet->value != 0)
-		return EINVAL;
-
-	const uint16_t val = pio_read_16(hub->ports[port]);
-	const uint32_t status = uint32_host2usb(
-	    UHCI2USB(val, STATUS_CONNECTED, USB_HUB_PORT_STATUS_CONNECTION) |
-	    UHCI2USB(val, STATUS_ENABLED, USB_HUB_PORT_STATUS_ENABLE) |
-	    UHCI2USB(val, STATUS_SUSPEND, USB2_HUB_PORT_STATUS_SUSPEND) |
-	    UHCI2USB(val, STATUS_IN_RESET, USB_HUB_PORT_STATUS_RESET) |
-	    UHCI2USB(val, STATUS_ALWAYS_ONE, USB2_HUB_PORT_STATUS_POWER) |
-	    UHCI2USB(val, STATUS_LOW_SPEED, USB2_HUB_PORT_STATUS_LOW_SPEED) |
-	    UHCI2USB(val, STATUS_CONNECTED_CHANGED, USB_HUB_PORT_STATUS_C_CONNECTION) |
-	    UHCI2USB(val, STATUS_ENABLED_CHANGED, USB2_HUB_PORT_STATUS_C_ENABLE) |
-#if 0
-	    UHCI2USB(val, STATUS_SUSPEND, USB2_HUB_PORT_STATUS_C_SUSPEND) |
-#endif
-	    (hub->reset_changed[port] ?  USB_HUB_PORT_STATUS_C_RESET : 0));
-	RH_DEBUG(hub, port, "Port status %" PRIx32 " (source %" PRIx16
-	    "%s)", uint32_usb2host(status), val,
-	    hub->reset_changed[port] ? "-reset" : "");
-	memcpy(data, &status, sizeof(status));
-	*act_size = sizeof(status);
-	return EOK;
-}
-
-/** Port clear feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_clear_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	uhci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	const uint16_t status = pio_read_16(hub->ports[port]);
-	const uint16_t val = status & (~STATUS_WC_BITS);
-	switch (feature) {
-	case USB2_HUB_FEATURE_PORT_ENABLE:
-		RH_DEBUG(hub, port, "Clear port enable (status %"
-		    PRIx16 ")", status);
-		pio_write_16(hub->ports[port], val & ~STATUS_ENABLED);
-		break;
-	case USB2_HUB_FEATURE_PORT_SUSPEND:
-		RH_DEBUG(hub, port, "Clear port suspend (status %"
-		    PRIx16 ")", status);
-		pio_write_16(hub->ports[port], val & ~STATUS_SUSPEND);
-		// TODO we should do resume magic
-		usb_log_warning("Resume is not implemented on port %u", port);
-		break;
-	case USB_HUB_FEATURE_PORT_POWER:
-		RH_DEBUG(hub, port, "Clear port power (status %" PRIx16 ")",
-		    status);
-		/* We are always powered */
-		usb_log_warning("Tried to power off port %u", port);
-		break;
-	case USB_HUB_FEATURE_C_PORT_CONNECTION:
-		RH_DEBUG(hub, port, "Clear port conn change (status %"
-		    PRIx16 ")", status);
-		pio_write_16(hub->ports[port], val | STATUS_CONNECTED_CHANGED);
-		break;
-	case USB_HUB_FEATURE_C_PORT_RESET:
-		RH_DEBUG(hub, port, "Clear port reset change (status %"
-		    PRIx16 ")", status);
-		hub->reset_changed[port] = false;
-		break;
-	case USB2_HUB_FEATURE_C_PORT_ENABLE:
-		RH_DEBUG(hub, port, "Clear port enable change (status %"
-		    PRIx16 ")", status);
-		pio_write_16(hub->ports[port], status | STATUS_ENABLED_CHANGED);
-		break;
-	case USB2_HUB_FEATURE_C_PORT_SUSPEND:
-		RH_DEBUG(hub, port, "Clear port suspend change (status %"
-		    PRIx16 ")", status);
-		//TODO
-		return ENOTSUP;
-	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-		RH_DEBUG(hub, port, "Clear port OC change (status %"
-		    PRIx16 ")", status);
-		/* UHCI Does not report over current */
-		//TODO: newer chips do, but some have broken wiring
-		break;
-	default:
-		RH_DEBUG(hub, port, "Clear unknown feature %d (status %"
-		    PRIx16 ")", feature, status);
-		usb_log_warning("Clearing feature %d is unsupported",
-		    feature);
-		return ESTALL;
-	}
-	return EOK;
-}
-
-/** Port set feature request handler.
- * @param device Virtual hub device
- * @param setup_packet USB setup stage data.
- * @param[out] data destination data buffer, size must be at least
- *             setup_packet->length bytes
- * @param[out] act_size Sized of the valid response part of the buffer.
- * @return Error code.
- */
-static errno_t req_set_port_feature(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	uhci_rh_t *hub;
-	unsigned port;
-	TEST_SIZE_INIT(0, port, hub);
-	const unsigned feature = uint16_usb2host(setup_packet->value);
-	const uint16_t status = pio_read_16(hub->ports[port]);
-	switch (feature) {
-	case USB_HUB_FEATURE_PORT_RESET:
-		RH_DEBUG(hub, port, "Set port reset before (status %" PRIx16
-		    ")", status);
-		uhci_port_reset_enable(hub->ports[port]);
-		hub->reset_changed[port] = true;
-		RH_DEBUG(hub, port, "Set port reset after (status %" PRIx16
-		    ")", pio_read_16(hub->ports[port]));
-		break;
-	case USB2_HUB_FEATURE_PORT_SUSPEND:
-		RH_DEBUG(hub, port, "Set port suspend (status %" PRIx16
-		    ")", status);
-		pio_write_16(hub->ports[port],
-		    (status & ~STATUS_WC_BITS) | STATUS_SUSPEND);
-		usb_log_warning("Suspend is not implemented on port %u", port);
-		break;
-	case USB_HUB_FEATURE_PORT_POWER:
-		RH_DEBUG(hub, port, "Set port power (status %" PRIx16
-		    ")", status);
-		/* We are always powered */
-		usb_log_warning("Tried to power port %u", port);
-		break;
-	case USB_HUB_FEATURE_C_PORT_CONNECTION:
-	case USB2_HUB_FEATURE_C_PORT_ENABLE:
-	case USB2_HUB_FEATURE_C_PORT_SUSPEND:
-	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-		RH_DEBUG(hub, port, "Set port change flag (status %" PRIx16
-		    ")", status);
-		/*
-		 * These are voluntary and don't have to be set
-		 * there is no way we could do it on UHCI anyway
-		 */
-		break;
-	default:
-		RH_DEBUG(hub, port, "Set unknown feature %d (status %" PRIx16
-		    ")", feature, status);
-		usb_log_warning("Setting feature %d is unsupported",
-		    feature);
-		return ESTALL;
-	}
-	return EOK;
-}
-
-/** Status change handler.
- * @param device Virtual hub device
- * @param endpoint Endpoint number
- * @param tr_type Transfer type
- * @param buffer Response destination
- * @param buffer_size Bytes available in buffer
- * @param actual_size Size us the used part of the dest buffer.
- *
- * Produces status mask. Bit 0 indicates hub status change the other bits
- * represent port status change. Endian does not matter as UHCI root hubs
- * only need 1 byte.
- */
-static errno_t req_status_change_handler(usbvirt_device_t *device,
-    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
-    void *buffer, size_t buffer_size, size_t *actual_size)
-{
-	uhci_rh_t *hub = virthub_get_data(device);
-	assert(hub);
-
-	if (buffer_size < 1)
-		return ESTALL;
-
-	const uint16_t status_a = pio_read_16(hub->ports[0]);
-	const uint16_t status_b = pio_read_16(hub->ports[1]);
-	const uint8_t status =
-	    ((((status_a & STATUS_CHANGE_BITS) != 0) || hub->reset_changed[0]) ?
-	    0x2 : 0) |
-	    ((((status_b & STATUS_CHANGE_BITS) != 0) || hub->reset_changed[1]) ?
-	    0x4 : 0);
-	if (status)
-		RH_DEBUG(hub, -1, "Event mask %" PRIx8
-		    " (status_a %" PRIx16 "%s),"
-		    " (status_b %" PRIx16 "%s)", status,
-		    status_a, hub->reset_changed[0] ? "-reset" : "",
-		    status_b, hub->reset_changed[1] ? "-reset" : "");
-	((uint8_t *)buffer)[0] = status;
-	*actual_size = 1;
-	return (status != 0 ? EOK : ENAK);
-}
-
-/** UHCI root hub request handlers */
-static const usbvirt_control_request_handler_t control_transfer_handlers[] = {
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
-		.name = "GetHubDescriptor",
-		.callback = virthub_base_get_hub_descriptor,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATE),
-		.name = "GetBusState",
-		.callback = req_get_port_state,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearHubFeature",
-		/*
-		 * Hub features are overcurrent and supply good,
-		 * this request may only clear changes that we never report
-		 */
-		.callback = req_nop,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearPortFeature",
-		.callback = req_clear_port_feature
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetHubStatus",
-		/*
-		 * UHCI can't report OC condition or,
-		 * lose power source
-		 */
-		.callback = virthub_base_get_null_status,
-	},
-	{
-		CLASS_REQ_IN(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetHubFeature",
-		/*
-		 * Hub features are overcurrent and supply good,
-		 * this request may only set changes that we never report
-		 */
-		.callback = req_nop,
-	},
-	{
-		CLASS_REQ_OUT(USB_REQUEST_RECIPIENT_OTHER, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetPortFeature",
-		.callback = req_set_port_feature
-	},
-	{
-		.callback = NULL
-	}
-};
-
-static usbvirt_device_ops_t ops = {
-	.control = control_transfer_handlers,
-	.data_in[HUB_STATUS_CHANGE_PIPE] = req_status_change_handler,
-};
Index: pace/drv/bus/usb/uhci/uhci_rh.h
===================================================================
--- uspace/drv/bus/usb/uhci/uhci_rh.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI host controller driver structure
- */
-#ifndef DRV_UHCI_UHCI_RH_H
-#define DRV_UHCI_UHCI_RH_H
-
-#include <usbvirt/virthub_base.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/usb.h>
-
-#include <stdbool.h>
-#include <ddi.h>
-
-/** Endpoint number for status change pipe. */
-#define HUB_STATUS_CHANGE_PIPE   1
-
-/** Virtual to UHCI hub connector */
-typedef struct {
-	/** Virtual hub software implementation */
-	virthub_base_t base;
-	/** UHCI root hub port io registers */
-	ioport16_t *ports[2];
-	/** Reset change indicator, it is not reported by regs */
-	bool reset_changed[2];
-} uhci_rh_t;
-
-errno_t uhci_rh_init(uhci_rh_t *instance, ioport16_t *ports, const char *name);
-errno_t uhci_rh_schedule(uhci_rh_t *instance, usb_transfer_batch_t *batch);
-
-/** Get UHCI rh address.
- *
- * @param instance UHCI rh instance.
- * @return USB address assigned to the hub.
- * Wrapper for virtual hub address
- */
-static inline usb_address_t uhci_rh_get_address(uhci_rh_t *instance)
-{
-	return virthub_base_get_address(&instance->base);
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/device.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/device.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbdiag
- * @{
- */
-/**
- * @file
- * Code for managing debug device structures.
- */
-#include <errno.h>
-#include <str_error.h>
-#include <macros.h>
-#include <usb/debug.h>
-#include <usbdiag_iface.h>
-
-#include "device.h"
-#include "tests.h"
-
-#define NAME "usbdiag"
-
-static usbdiag_iface_t diag_interface = {
-	.test_in = usbdiag_dev_test_in,
-	.test_out = usbdiag_dev_test_out,
-};
-
-static ddf_dev_ops_t diag_ops = {
-	.interfaces[USBDIAG_DEV_IFACE] = &diag_interface
-};
-
-static errno_t device_init(usbdiag_dev_t *dev, const usb_endpoint_description_t **endpoints)
-{
-	errno_t rc;
-	ddf_fun_t *fun = usb_device_ddf_fun_create(dev->usb_dev, fun_exposed, "tmon");
-	if (!fun) {
-		rc = ENOMEM;
-		goto err;
-	}
-
-	ddf_fun_set_ops(fun, &diag_ops);
-	dev->fun = fun;
-
-#define _MAP_EP(target, ep_no) do {\
-	usb_endpoint_mapping_t *epm = usb_device_get_mapped_ep_desc(dev->usb_dev, endpoints[USBDIAG_EP_##ep_no]);\
-	if (!epm || !epm->present) {\
-		usb_log_error("Failed to map endpoint: " #ep_no ".");\
-		rc = ENOENT;\
-		goto err_fun;\
-	}\
-	target = &epm->pipe;\
-	} while (0);
-
-	_MAP_EP(dev->burst_intr_in, BURST_INTR_IN);
-	_MAP_EP(dev->burst_intr_out, BURST_INTR_OUT);
-	_MAP_EP(dev->burst_bulk_in, BURST_BULK_IN);
-	_MAP_EP(dev->burst_bulk_out, BURST_BULK_OUT);
-	_MAP_EP(dev->burst_isoch_in, BURST_ISOCH_IN);
-	_MAP_EP(dev->burst_isoch_out, BURST_ISOCH_OUT);
-	_MAP_EP(dev->data_intr_in, DATA_INTR_IN);
-	_MAP_EP(dev->data_intr_out, DATA_INTR_OUT);
-	_MAP_EP(dev->data_bulk_in, DATA_BULK_IN);
-	_MAP_EP(dev->data_bulk_out, DATA_BULK_OUT);
-	_MAP_EP(dev->data_isoch_in, DATA_ISOCH_IN);
-	_MAP_EP(dev->data_isoch_out, DATA_ISOCH_OUT);
-
-#undef _MAP_EP
-
-	return EOK;
-
-err_fun:
-	ddf_fun_destroy(fun);
-err:
-	return rc;
-}
-
-static void device_fini(usbdiag_dev_t *dev)
-{
-	ddf_fun_destroy(dev->fun);
-}
-
-errno_t usbdiag_dev_create(usb_device_t *dev, usbdiag_dev_t **out_diag_dev, const usb_endpoint_description_t **endpoints)
-{
-	assert(dev);
-	assert(out_diag_dev);
-
-	usbdiag_dev_t *diag_dev = usb_device_data_alloc(dev, sizeof(usbdiag_dev_t));
-	if (!diag_dev)
-		return ENOMEM;
-
-	diag_dev->usb_dev = dev;
-
-	errno_t err;
-	if ((err = device_init(diag_dev, endpoints)))
-		goto err_init;
-
-	*out_diag_dev = diag_dev;
-	return EOK;
-
-err_init:
-	/* There is no usb_device_data_free. */
-	return err;
-}
-
-void usbdiag_dev_destroy(usbdiag_dev_t *dev)
-{
-	assert(dev);
-
-	device_fini(dev);
-	/* There is no usb_device_data_free. */
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/device.h
===================================================================
--- uspace/drv/bus/usb/usbdiag/device.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbdiag
- * @{
- */
-/** @file
- * USB diagnostic device structures.
- */
-
-#ifndef USBDIAG_DEVICE_H_
-#define USBDIAG_DEVICE_H_
-
-#include <usb/dev/device.h>
-#include <usb/dev/driver.h>
-
-#define USBDIAG_EP_BURST_INTR_IN    1
-#define USBDIAG_EP_BURST_INTR_OUT   2
-#define USBDIAG_EP_BURST_BULK_IN    3
-#define USBDIAG_EP_BURST_BULK_OUT   4
-#define USBDIAG_EP_BURST_ISOCH_IN   5
-#define USBDIAG_EP_BURST_ISOCH_OUT  6
-
-#define USBDIAG_EP_DATA_INTR_IN     7
-#define USBDIAG_EP_DATA_INTR_OUT    8
-#define USBDIAG_EP_DATA_BULK_IN     9
-#define USBDIAG_EP_DATA_BULK_OUT   10
-#define USBDIAG_EP_DATA_ISOCH_IN   11
-#define USBDIAG_EP_DATA_ISOCH_OUT  12
-
-/**
- * USB diagnostic device.
- */
-typedef struct usbdiag_dev {
-	usb_device_t *usb_dev;
-	ddf_fun_t *fun;
-
-	usb_pipe_t *burst_intr_in;
-	usb_pipe_t *burst_intr_out;
-	usb_pipe_t *burst_bulk_in;
-	usb_pipe_t *burst_bulk_out;
-	usb_pipe_t *burst_isoch_in;
-	usb_pipe_t *burst_isoch_out;
-
-	usb_pipe_t *data_intr_in;
-	usb_pipe_t *data_intr_out;
-	usb_pipe_t *data_bulk_in;
-	usb_pipe_t *data_bulk_out;
-	usb_pipe_t *data_isoch_in;
-	usb_pipe_t *data_isoch_out;
-
-} usbdiag_dev_t;
-
-errno_t usbdiag_dev_create(usb_device_t *, usbdiag_dev_t **,
-    const usb_endpoint_description_t **);
-void usbdiag_dev_destroy(usbdiag_dev_t *);
-
-static inline usbdiag_dev_t *usb_device_to_usbdiag_dev(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_device_data_get(usb_dev);
-}
-
-static inline usbdiag_dev_t *ddf_dev_to_usbdiag_dev(ddf_dev_t *ddf_dev)
-{
-	assert(ddf_dev);
-	return usb_device_to_usbdiag_dev(usb_device_get(ddf_dev));
-}
-
-static inline usbdiag_dev_t *ddf_fun_to_usbdiag_dev(ddf_fun_t *ddf_fun)
-{
-	assert(ddf_fun);
-	return ddf_dev_to_usbdiag_dev(ddf_fun_get_dev(ddf_fun));
-}
-
-#endif /* USBDIAG_USBDIAG_H_ */
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/usb/usbdiag/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvusbdiag usbdiag
- * @brief USB diagnostic device driver
- * @ingroup drvs
- */
Index: pace/drv/bus/usb/usbdiag/main.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,281 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbdiag
- * @{
- */
-/**
- * @file
- * Main routines of USB diagnostic device driver.
- */
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/driver.h>
-#include <usbdiag_iface.h>
-#include <str_error.h>
-
-#include "device.h"
-
-#define NAME "usbdiag"
-
-static const usb_endpoint_description_t *diag_endpoints[];
-
-static errno_t device_add(usb_device_t *dev)
-{
-	errno_t rc;
-	usb_log_info("Adding device '%s'", usb_device_get_name(dev));
-
-	usbdiag_dev_t *diag_dev;
-	if ((rc = usbdiag_dev_create(dev, &diag_dev, diag_endpoints))) {
-		usb_log_error("Failed create device: %s.", str_error(rc));
-		goto err;
-	}
-
-	if ((rc = ddf_fun_bind(diag_dev->fun))) {
-		usb_log_error("Failed to bind DDF function: %s.", str_error(rc));
-		goto err_create;
-	}
-
-	if ((rc = ddf_fun_add_to_category(diag_dev->fun, USBDIAG_CATEGORY))) {
-		usb_log_error("Failed add DDF to category '"
-		    USBDIAG_CATEGORY "': %s.\n", str_error(rc));
-		goto err_bind;
-	}
-
-	return EOK;
-
-err_bind:
-	ddf_fun_unbind(diag_dev->fun);
-err_create:
-	usbdiag_dev_destroy(diag_dev);
-err:
-	return rc;
-}
-
-static errno_t device_cleanup(usbdiag_dev_t *diag_dev)
-{
-	/* TODO: Join some fibrils? */
-
-	/* Free memory. */
-	usbdiag_dev_destroy(diag_dev);
-	return EOK;
-}
-
-static errno_t device_remove(usb_device_t *dev)
-{
-	errno_t rc;
-	usb_log_info("Removing device '%s'", usb_device_get_name(dev));
-
-	usbdiag_dev_t *diag_dev = usb_device_to_usbdiag_dev(dev);
-
-	/* TODO: Make sure nothing is going on with the device. */
-
-	if ((rc = ddf_fun_unbind(diag_dev->fun))) {
-		usb_log_error("Failed to unbind DDF function: %s", str_error(rc));
-		goto err;
-	}
-
-	usb_log_info("Device '%s' removed.", usb_device_get_name(dev));
-	return device_cleanup(diag_dev);
-
-err:
-	return rc;
-}
-
-static errno_t device_gone(usb_device_t *dev)
-{
-	errno_t rc;
-	usb_log_info("Device '%s' gone.", usb_device_get_name(dev));
-
-	usbdiag_dev_t *diag_dev = usb_device_to_usbdiag_dev(dev);
-
-	/* TODO: Make sure nothing is going on with the device. */
-
-	if ((rc = ddf_fun_unbind(diag_dev->fun))) {
-		usb_log_error("Failed to unbind DDF function: %s", str_error(rc));
-		goto err;
-	}
-
-	return device_cleanup(diag_dev);
-
-err:
-	return rc;
-}
-
-static errno_t function_online(ddf_fun_t *fun)
-{
-	return ddf_fun_online(fun);
-}
-
-static errno_t function_offline(ddf_fun_t *fun)
-{
-	return ddf_fun_offline(fun);
-}
-
-static const usb_endpoint_description_t burst_intr_in_ep = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t burst_intr_out_ep = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t burst_bulk_in_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t burst_bulk_out_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t burst_isoch_in_ep = {
-	.transfer_type = USB_TRANSFER_ISOCHRONOUS,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t burst_isoch_out_ep = {
-	.transfer_type = USB_TRANSFER_ISOCHRONOUS,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_intr_in_ep = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_intr_out_ep = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_bulk_in_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_bulk_out_ep = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_isoch_in_ep = {
-	.transfer_type = USB_TRANSFER_ISOCHRONOUS,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-static const usb_endpoint_description_t data_isoch_out_ep = {
-	.transfer_type = USB_TRANSFER_ISOCHRONOUS,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_DIAGNOSTIC,
-	.interface_subclass = 0x00,
-	.interface_protocol = 0x01,
-	.flags = 0
-};
-
-static const usb_endpoint_description_t *diag_endpoints[] = {
-	[USBDIAG_EP_BURST_INTR_IN] = &burst_intr_in_ep,
-	[USBDIAG_EP_BURST_INTR_OUT] = &burst_intr_out_ep,
-	[USBDIAG_EP_BURST_BULK_IN] = &burst_bulk_in_ep,
-	[USBDIAG_EP_BURST_BULK_OUT] = &burst_bulk_out_ep,
-	[USBDIAG_EP_BURST_ISOCH_IN] = &burst_isoch_in_ep,
-	[USBDIAG_EP_BURST_ISOCH_OUT] = &burst_isoch_out_ep,
-	[USBDIAG_EP_DATA_INTR_IN] = &data_intr_in_ep,
-	[USBDIAG_EP_DATA_INTR_OUT] = &data_intr_out_ep,
-	[USBDIAG_EP_DATA_BULK_IN] = &data_bulk_in_ep,
-	[USBDIAG_EP_DATA_BULK_OUT] = &data_bulk_out_ep,
-	[USBDIAG_EP_DATA_ISOCH_IN] = &data_isoch_in_ep,
-	[USBDIAG_EP_DATA_ISOCH_OUT] = &data_isoch_out_ep,
-	NULL
-};
-
-/** USB diagnostic driver ops. */
-static const usb_driver_ops_t diag_driver_ops = {
-	.device_add = device_add,
-	.device_remove = device_remove,
-	.device_gone = device_gone,
-	.function_online = function_online,
-	.function_offline = function_offline
-};
-
-/** USB diagnostic driver. */
-static const usb_driver_t diag_driver = {
-	.name = NAME,
-	.ops = &diag_driver_ops,
-	.endpoints = &diag_endpoints[1] /* EPs are indexed from 1. */
-};
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": USB diagnostic device driver.\n");
-
-	log_init(NAME);
-
-	return usb_driver_main(&diag_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/meson.build
===================================================================
--- uspace/drv/bus/usb/usbdiag/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2017 Petr Manek
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb' ]
-src = files(
-	'device.c',
-	'tests.c',
-	'main.c',
-)
Index: pace/drv/bus/usb/usbdiag/tests.c
===================================================================
--- uspace/drv/bus/usb/usbdiag/tests.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbdiag
- * @{
- */
-/**
- * @file
- * Code for executing diagnostic tests.
- */
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usbdiag_iface.h>
-#include <time.h>
-#include "device.h"
-#include "tests.h"
-
-#define NAME "usbdiag"
-
-static const uint32_t test_data_src = 0xDEADBEEF;
-
-static errno_t test_in(usb_pipe_t *pipe, const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	if (!pipe)
-		return EBADMEM;
-
-	bool validate = params->validate_data;
-	size_t size = params->transfer_size;
-	if (!size)
-		size = pipe->desc.max_transfer_size;
-
-	const uint32_t test_data = uint32_host2usb(test_data_src);
-	if (validate && size % sizeof(test_data))
-		return EINVAL;
-
-	size_t test_data_size = size / sizeof(test_data);
-	char *buffer = usb_pipe_alloc_buffer(pipe, size);
-	if (!buffer)
-		return ENOMEM;
-
-	// TODO: Are we sure that no other test is running on this endpoint?
-
-	usb_log_info("Performing %s IN test with duration %ld ms.", usb_str_transfer_type(pipe->desc.transfer_type), params->min_duration);
-
-	errno_t rc = EOK;
-	uint32_t transfer_count = 0;
-
-	struct timespec start_time, final_time, stop_time;
-	getuptime(&start_time);
-	getuptime(&stop_time);
-
-	ts_add_diff(&stop_time, MSEC2NSEC(params->min_duration));
-	getuptime(&final_time);
-
-	while (!ts_gt(&final_time, &stop_time)) {
-		++transfer_count;
-
-		// Read device's response.
-		size_t remaining = size;
-		size_t transferred;
-
-		while (remaining > 0) {
-			if ((rc = usb_pipe_read_dma(pipe, buffer, buffer + size - remaining, remaining, &transferred))) {
-				usb_log_error("Read of %s IN endpoint failed with error: %s", usb_str_transfer_type(pipe->desc.transfer_type), str_error(rc));
-				break;
-			}
-
-			if (transferred > remaining) {
-				usb_log_error("Read of %s IN endpoint returned more data than expected.", usb_str_transfer_type(pipe->desc.transfer_type));
-				rc = EINVAL;
-				break;
-			}
-
-			remaining -= transferred;
-		}
-
-		if (rc)
-			break;
-
-		if (validate) {
-			uint32_t *beef_buffer = (uint32_t *) buffer;
-
-			/* Check if the beef is really dead. */
-			for (size_t i = 0; i < test_data_size; ++i) {
-				if (beef_buffer[i] != test_data) {
-					usb_log_error("Read of %s IN endpoint returned "
-					    "invalid data at address %zu. [ 0x%X != 0x%X ]",
-					    usb_str_transfer_type(pipe->desc.transfer_type), i * sizeof(test_data), beef_buffer[i], test_data);
-					rc = EINVAL;
-				}
-			}
-
-			if (rc)
-				break;
-		}
-
-		getuptime(&final_time);
-	}
-
-	usbdiag_dur_t in_duration = NSEC2MSEC(final_time.tv_nsec - start_time.tv_nsec) +
-	    SEC2MSEC(final_time.tv_sec - start_time.tv_sec);
-
-	usb_log_info("Test on %s IN endpoint completed in %lu ms.", usb_str_transfer_type(pipe->desc.transfer_type), in_duration);
-
-	results->act_duration = in_duration;
-	results->transfer_count = transfer_count;
-	results->transfer_size = size;
-
-	usb_pipe_free_buffer(pipe, buffer);
-
-	return rc;
-}
-
-static errno_t test_out(usb_pipe_t *pipe, const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	if (!pipe)
-		return EBADMEM;
-
-	bool validate = params->validate_data;
-	size_t size = params->transfer_size;
-	if (!size)
-		size = pipe->desc.max_transfer_size;
-
-	const uint32_t test_data = uint32_host2usb(test_data_src);
-
-	if (validate && size % sizeof(test_data))
-		return EINVAL;
-
-	char *buffer = usb_pipe_alloc_buffer(pipe, size);
-	if (!buffer)
-		return ENOMEM;
-
-	if (validate) {
-		for (size_t i = 0; i < size; i += sizeof(test_data)) {
-			memcpy(buffer + i, &test_data, sizeof(test_data));
-		}
-	}
-
-	// TODO: Are we sure that no other test is running on this endpoint?
-
-	usb_log_info("Performing %s OUT test.", usb_str_transfer_type(pipe->desc.transfer_type));
-
-	errno_t rc = EOK;
-	uint32_t transfer_count = 0;
-
-	struct timespec start_time, final_time, stop_time;
-	getuptime(&start_time);
-	getuptime(&stop_time);
-
-	ts_add_diff(&stop_time, MSEC2NSEC(params->min_duration));
-	getuptime(&final_time);
-
-	while (!ts_gt(&final_time, &stop_time)) {
-		++transfer_count;
-
-		// Write buffer to device.
-		if ((rc = usb_pipe_write_dma(pipe, buffer, buffer, size))) {
-			usb_log_error("Write to %s OUT endpoint failed with error: %s", usb_str_transfer_type(pipe->desc.transfer_type), str_error(rc));
-			break;
-		}
-
-		getuptime(&final_time);
-	}
-
-	usbdiag_dur_t in_duration = NSEC2MSEC(final_time.tv_nsec - start_time.tv_nsec) +
-	    SEC2MSEC(final_time.tv_sec - start_time.tv_sec);
-
-	usb_log_info("Test on %s OUT endpoint completed in %ld ms.", usb_str_transfer_type(pipe->desc.transfer_type), in_duration);
-
-	results->act_duration = in_duration;
-	results->transfer_count = transfer_count;
-	results->transfer_size = size;
-
-	usb_pipe_free_buffer(pipe, buffer);
-
-	return rc;
-}
-
-errno_t usbdiag_dev_test_in(ddf_fun_t *fun, const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	usbdiag_dev_t *dev = ddf_fun_to_usbdiag_dev(fun);
-	if (!dev)
-		return EBADMEM;
-
-	usb_pipe_t *pipe;
-
-	switch (params->transfer_type) {
-	case USB_TRANSFER_INTERRUPT:
-		pipe = params->validate_data ? dev->data_intr_in : dev->burst_intr_in;
-		break;
-	case USB_TRANSFER_BULK:
-		pipe = params->validate_data ? dev->data_bulk_in : dev->burst_bulk_in;
-		break;
-	case USB_TRANSFER_ISOCHRONOUS:
-		pipe = params->validate_data ? dev->data_isoch_in : dev->burst_isoch_in;
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return test_in(pipe, params, results);
-}
-
-errno_t usbdiag_dev_test_out(ddf_fun_t *fun, const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	usbdiag_dev_t *dev = ddf_fun_to_usbdiag_dev(fun);
-	if (!dev)
-		return EBADMEM;
-
-	usb_pipe_t *pipe;
-
-	switch (params->transfer_type) {
-	case USB_TRANSFER_INTERRUPT:
-		pipe = params->validate_data ? dev->data_intr_out : dev->burst_intr_out;
-		break;
-	case USB_TRANSFER_BULK:
-		pipe = params->validate_data ? dev->data_bulk_out : dev->burst_bulk_out;
-		break;
-	case USB_TRANSFER_ISOCHRONOUS:
-		pipe = params->validate_data ? dev->data_isoch_out : dev->burst_isoch_out;
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return test_out(pipe, params, results);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/tests.h
===================================================================
--- uspace/drv/bus/usb/usbdiag/tests.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbdiag
- * @{
- */
-/** @file
- * USB diagnostic tests.
- */
-
-#ifndef USBDIAG_TESTS_H_
-#define USBDIAG_TESTS_H_
-
-#include <ddf/driver.h>
-
-errno_t usbdiag_dev_test_in(ddf_fun_t *, const usbdiag_test_params_t *,
-    usbdiag_test_results_t *);
-errno_t usbdiag_dev_test_out(ddf_fun_t *, const usbdiag_test_params_t *,
-    usbdiag_test_results_t *);
-
-#endif /* USBDIAG_TESTS_H_ */
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbdiag/usbdiag.ma
===================================================================
--- uspace/drv/bus/usb/usbdiag/usbdiag.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-100 usb&diagnostic
-100 usb&class=diagnostic
Index: pace/drv/bus/usb/usbflbk/main.c
===================================================================
--- uspace/drv/bus/usb/usbflbk/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbfallback
- * @{
- */
-/**
- * @file
- * Main routines of USB fallback driver.
- */
-#include <usb/dev/driver.h>
-#include <usb/debug.h>
-#include <errno.h>
-#include <str_error.h>
-
-#define NAME "usbflbk"
-
-/** Callback when new device is attached and recognized by DDF.
- *
- * @param dev Representation of a generic DDF device.
- * @return Error code.
- */
-static errno_t usbfallback_device_add(usb_device_t *dev)
-{
-	usb_log_info("Pretending to control %s `%s'.",
-	    usb_device_get_iface_number(dev) < 0 ? "device" : "interface",
-	    usb_device_get_name(dev));
-	return EOK;
-}
-
-/** Callback when new device is removed and recognized as gone by DDF.
- *
- * @param dev Representation of a generic DDF device.
- * @return Error code.
- */
-static errno_t usbfallback_device_gone(usb_device_t *dev)
-{
-	assert(dev);
-	usb_log_info("Device '%s' gone.", usb_device_get_name(dev));
-	return EOK;
-}
-
-static errno_t usbfallback_device_remove(usb_device_t *dev)
-{
-	assert(dev);
-	usb_log_info("Device '%s' removed.", usb_device_get_name(dev));
-	return EOK;
-}
-
-/** USB fallback driver ops. */
-static const usb_driver_ops_t usbfallback_driver_ops = {
-	.device_add = usbfallback_device_add,
-	.device_remove = usbfallback_device_remove,
-	.device_gone = usbfallback_device_gone,
-};
-
-/** USB fallback driver. */
-static const usb_driver_t usbfallback_driver = {
-	.name = NAME,
-	.ops = &usbfallback_driver_ops,
-	.endpoints = NULL
-};
-
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-
-	return usb_driver_main(&usbfallback_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbflbk/meson.build
===================================================================
--- uspace/drv/bus/usb/usbflbk/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb' ]
-src = files('main.c')
Index: pace/drv/bus/usb/usbflbk/usbflbk.ma
===================================================================
--- uspace/drv/bus/usb/usbflbk/usbflbk.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 usb&fallback
-10 usb&interface&fallback
Index: pace/drv/bus/usb/usbhub/main.c
===================================================================
--- uspace/drv/bus/usb/usbhub/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-
-#include <ddf/driver.h>
-#include <errno.h>
-#include <async.h>
-#include <stdio.h>
-#include <io/logctl.h>
-
-#include <usb/dev/driver.h>
-#include <usb/classes/classes.h>
-#include <usb/debug.h>
-
-#include "usbhub.h"
-
-/** USB hub driver operations. */
-static const usb_driver_ops_t usb_hub_driver_ops = {
-	.device_add = usb_hub_device_add,
-	.device_remove = usb_hub_device_remove,
-	.device_gone = usb_hub_device_gone,
-};
-
-/** Static usb hub driver information. */
-static const usb_driver_t usb_hub_driver = {
-	.name = NAME,
-	.ops = &usb_hub_driver_ops,
-	.endpoints = usb_hub_endpoints
-};
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS USB hub driver.\n");
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return usb_driver_main(&usb_hub_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/meson.build
===================================================================
--- uspace/drv/bus/usb/usbhub/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb' ]
-src = files(
-	'main.c',
-	'usbhub.c',
-	'port.c',
-)
Index: pace/drv/bus/usb/usbhub/port.c
===================================================================
--- uspace/drv/bus/usb/usbhub/port.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,340 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-/** @file
- * Hub ports functions.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <fibril_synch.h>
-#include <usbhc_iface.h>
-
-#include <usb/debug.h>
-
-#include "port.h"
-#include "usbhub.h"
-#include "status.h"
-
-#define port_log(lvl, port, fmt, ...) do { \
-		usb_log_##lvl("(%p-%u): " fmt, \
-		    (port->hub), (port->port_number), ##__VA_ARGS__); \
-	} while (0)
-
-/** Initialize hub port information.
- *
- * @param port Port to be initialized.
- */
-void usb_hub_port_init(usb_hub_port_t *port, usb_hub_dev_t *hub,
-    unsigned int port_number)
-{
-	assert(port);
-	memset(port, 0, sizeof(*port));
-	port->hub = hub;
-	port->port_number = port_number;
-	usb_port_init(&port->base);
-}
-
-static inline usb_hub_port_t *get_hub_port(usb_port_t *port)
-{
-	assert(port);
-	return (usb_hub_port_t *) port;
-}
-
-/**
- * Inform the HC that the device on port is gone.
- */
-static void remove_device(usb_port_t *port_base)
-{
-	usb_hub_port_t *port = get_hub_port(port_base);
-
-	async_exch_t *exch = usb_device_bus_exchange_begin(port->hub->usb_device);
-	if (!exch) {
-		port_log(error, port, "Cannot remove the device, "
-		    "failed creating exchange.");
-		return;
-	}
-
-	const errno_t err = usbhc_device_remove(exch, port->port_number);
-	if (err)
-		port_log(error, port, "Failed to remove device: %s",
-		    str_error(err));
-
-	usb_device_bus_exchange_end(exch);
-}
-
-static usb_speed_t get_port_speed(usb_hub_port_t *port, uint32_t status)
-{
-	assert(port);
-	assert(port->hub);
-
-	return usb_port_speed(port->hub->speed, status);
-}
-
-/**
- * Routine for adding a new device in USB2.
- */
-static errno_t enumerate_device_usb2(usb_hub_port_t *port, async_exch_t *exch)
-{
-	errno_t err;
-
-	port_log(debug, port, "Requesting default address.");
-	err = usb_hub_reserve_default_address(port->hub, exch, &port->base);
-	if (err != EOK) {
-		port_log(error, port, "Failed to reserve default address: %s",
-		    str_error(err));
-		return err;
-	}
-
-	/* Reservation of default address could have blocked */
-	if (port->base.state != PORT_CONNECTING)
-		goto out_address;
-
-	port_log(debug, port, "Resetting port.");
-	if ((err = usb_hub_set_port_feature(port->hub, port->port_number,
-	    USB_HUB_FEATURE_PORT_RESET))) {
-		port_log(warning, port, "Port reset request failed: %s",
-		    str_error(err));
-		goto out_address;
-	}
-
-	if ((err = usb_port_wait_for_enabled(&port->base))) {
-		port_log(error, port, "Failed to reset port: %s",
-		    str_error(err));
-		goto out_address;
-	}
-
-	port_log(debug, port, "Enumerating device.");
-	if ((err = usbhc_device_enumerate(exch, port->port_number,
-	    port->speed))) {
-		port_log(error, port, "Failed to enumerate device: %s",
-		    str_error(err));
-		/* Disable the port */
-		usb_hub_clear_port_feature(port->hub, port->port_number,
-		    USB2_HUB_FEATURE_PORT_ENABLE);
-		goto out_address;
-	}
-
-	port_log(debug, port, "Device enumerated");
-
-out_address:
-	usb_hub_release_default_address(port->hub, exch);
-	return err;
-}
-
-/**
- * Routine for adding a new device in USB 3.
- */
-static errno_t enumerate_device_usb3(usb_hub_port_t *port, async_exch_t *exch)
-{
-	errno_t err;
-
-	port_log(debug, port, "Issuing a warm reset.");
-	if ((err = usb_hub_set_port_feature(port->hub, port->port_number,
-	    USB3_HUB_FEATURE_BH_PORT_RESET))) {
-		port_log(warning, port, "Port reset request failed: %s",
-		    str_error(err));
-		return err;
-	}
-
-	if ((err = usb_port_wait_for_enabled(&port->base))) {
-		port_log(error, port, "Failed to reset port: %s",
-		    str_error(err));
-		return err;
-	}
-
-	port_log(debug, port, "Enumerating device.");
-	if ((err = usbhc_device_enumerate(exch, port->port_number,
-	    port->speed))) {
-		port_log(error, port, "Failed to enumerate device: %s",
-		    str_error(err));
-		return err;
-	}
-
-	port_log(debug, port, "Device enumerated");
-	return EOK;
-}
-
-static errno_t enumerate_device(usb_port_t *port_base)
-{
-	usb_hub_port_t *port = get_hub_port(port_base);
-
-	port_log(debug, port, "Setting up new device.");
-	async_exch_t *exch = usb_device_bus_exchange_begin(port->hub->usb_device);
-	if (!exch) {
-		port_log(error, port, "Failed to create exchange.");
-		return ENOMEM;
-	}
-
-	const errno_t err = port->hub->speed == USB_SPEED_SUPER ?
-	    enumerate_device_usb3(port, exch) :
-	    enumerate_device_usb2(port, exch);
-
-	usb_device_bus_exchange_end(exch);
-	return err;
-}
-
-static void port_changed_connection(usb_hub_port_t *port, usb_port_status_t status)
-{
-	const bool connected = !!(status & USB_HUB_PORT_STATUS_CONNECTION);
-	port_log(debug, port, "Connection change: device %s.", connected ?
-	    "attached" : "removed");
-
-	if (connected) {
-		usb_port_connected(&port->base, &enumerate_device);
-	} else {
-		usb_port_disabled(&port->base, &remove_device);
-	}
-}
-
-static void port_changed_enabled(usb_hub_port_t *port, usb_port_status_t status)
-{
-	const bool enabled = !!(status & USB_HUB_PORT_STATUS_ENABLE);
-	if (enabled) {
-		port_log(warning, port, "Port unexpectedly changed to enabled.");
-	} else {
-		usb_port_disabled(&port->base, &remove_device);
-	}
-}
-
-static void port_changed_overcurrent(usb_hub_port_t *port,
-    usb_port_status_t status)
-{
-	const bool overcurrent = !!(status & USB_HUB_PORT_STATUS_OC);
-
-	/*
-	 * According to the USB specs:
-	 * 11.13.5 Over-current Reporting and Recovery
-	 * Hub device is responsible for putting port in power off
-	 * mode. USB system software is responsible for powering port
-	 * back on when the over-current condition is gone
-	 */
-
-	usb_port_disabled(&port->base, &remove_device);
-
-	if (!overcurrent) {
-		const errno_t err = usb_hub_set_port_feature(port->hub,
-		    port->port_number, USB_HUB_FEATURE_PORT_POWER);
-		if (err)
-			port_log(error, port, "Failed to set port power "
-			    "after OC: %s.", str_error(err));
-	}
-}
-
-static void port_changed_reset(usb_hub_port_t *port, usb_port_status_t status)
-{
-	const bool enabled = !!(status & USB_HUB_PORT_STATUS_ENABLE);
-
-	if (enabled) {
-		port->speed = get_port_speed(port, status);
-		usb_port_enabled(&port->base);
-	} else
-		usb_port_disabled(&port->base, &remove_device);
-}
-
-typedef void (*change_handler_t)(usb_hub_port_t *, usb_port_status_t);
-
-static void check_port_change(usb_hub_port_t *port, usb_port_status_t *status,
-    change_handler_t handler, usb_port_status_t mask,
-    usb_hub_class_feature_t feature)
-{
-	if ((*status & mask) == 0)
-		return;
-
-	/* Clear the change so it won't come again */
-	usb_hub_clear_port_feature(port->hub, port->port_number, feature);
-
-	if (handler)
-		handler(port, *status);
-
-	/* Mark the change as resolved */
-	*status &= ~mask;
-}
-
-/**
- * Process interrupts on given port
- *
- * Accepts connection, over current and port reset change.
- * @param port port structure
- * @param hub hub representation
- */
-void usb_hub_port_process_interrupt(usb_hub_port_t *port)
-{
-	assert(port);
-	port_log(debug2, port, "Interrupt.");
-
-	usb_port_status_t status = 0;
-	const errno_t err = usb_hub_get_port_status(port->hub,
-	    port->port_number, &status);
-	if (err != EOK) {
-		port_log(error, port, "Failed to get port status: %s.",
-		    str_error(err));
-		return;
-	}
-
-	check_port_change(port, &status, &port_changed_connection,
-	    USB_HUB_PORT_STATUS_C_CONNECTION,
-	    USB_HUB_FEATURE_C_PORT_CONNECTION);
-
-	check_port_change(port, &status, &port_changed_overcurrent,
-	    USB_HUB_PORT_STATUS_C_OC, USB_HUB_FEATURE_C_PORT_OVER_CURRENT);
-
-	check_port_change(port, &status, &port_changed_reset,
-	    USB_HUB_PORT_STATUS_C_RESET, USB_HUB_FEATURE_C_PORT_RESET);
-
-	if (port->hub->speed <= USB_SPEED_HIGH) {
-		check_port_change(port, &status, &port_changed_enabled,
-		    USB2_HUB_PORT_STATUS_C_ENABLE,
-		    USB2_HUB_FEATURE_C_PORT_ENABLE);
-	} else {
-		check_port_change(port, &status, &port_changed_reset,
-		    USB3_HUB_PORT_STATUS_C_BH_RESET,
-		    USB3_HUB_FEATURE_C_BH_PORT_RESET);
-
-		check_port_change(port, &status, NULL,
-		    USB3_HUB_PORT_STATUS_C_LINK_STATE,
-		    USB3_HUB_FEATURE_C_PORT_LINK_STATE);
-	}
-
-	/* Check for changes we ignored */
-	if (status & 0xffff0000) {
-		port_log(debug, port, "Port status change igored. "
-		    "Status: %#08" PRIx32, status);
-	}
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/port.h
===================================================================
--- uspace/drv/bus/usb/usbhub/port.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-/** @file
- * Hub port handling.
- */
-
-#ifndef DRV_USBHUB_PORT_H
-#define DRV_USBHUB_PORT_H
-
-#include <usb/dev/driver.h>
-#include <usb/classes/hub.h>
-#include <usb/port.h>
-
-typedef struct usb_hub_dev usb_hub_dev_t;
-
-/** Information about single port on a hub. */
-typedef struct {
-	usb_port_t base;
-	/* Parenting hub */
-	usb_hub_dev_t *hub;
-	/** Port number as reported in descriptors. */
-	unsigned int port_number;
-	/** Speed at the time of enabling the port */
-	usb_speed_t speed;
-} usb_hub_port_t;
-
-void usb_hub_port_init(usb_hub_port_t *, usb_hub_dev_t *, unsigned int);
-
-void usb_hub_port_process_interrupt(usb_hub_port_t *port);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/status.h
===================================================================
--- uspace/drv/bus/usb/usbhub/status.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2010 Matus Dekanek
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-
-#ifndef HUB_STATUS_H
-#define	HUB_STATUS_H
-
-#include <usb/dev/request.h>
-
-/**
- * structure holding hub status and changes flags.
- *
- * For more information refer to table 11.16.2.5 in
- * "Universal Serial Bus Specification Revision 1.1"
- *
- */
-typedef uint32_t usb_hub_status_t;
-#define USB_HUB_STATUS_OVER_CURRENT \
-    (uint32_usb2host(1 << (USB_HUB_FEATURE_HUB_OVER_CURRENT)))
-#define USB_HUB_STATUS_LOCAL_POWER \
-    (uint32_usb2host(1 << (USB_HUB_FEATURE_HUB_LOCAL_POWER)))
-
-#define USB_HUB_STATUS_C_OVER_CURRENT \
-    (uint32_usb2host(1 << (16 + USB_HUB_FEATURE_C_HUB_OVER_CURRENT)))
-#define USB_HUB_STATUS_C_LOCAL_POWER \
-    (uint32_usb2host(1 << (16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER)))
-
-static inline usb_speed_t usb_port_speed(usb_speed_t hub_speed, uint32_t status)
-{
-	if (hub_speed == USB_SPEED_SUPER)
-		return USB_SPEED_SUPER;
-	if (hub_speed == USB_SPEED_HIGH &&
-	    (status & USB2_HUB_PORT_STATUS_HIGH_SPEED))
-		return USB_SPEED_HIGH;
-	if ((status & USB2_HUB_PORT_STATUS_LOW_SPEED) != 0)
-		return USB_SPEED_LOW;
-	return USB_SPEED_FULL;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/usbhub.c
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,776 +1,0 @@
-/*
- * Copyright (c) 2010 Matus Dekanek
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-/** @file
- * @brief usb hub main functionality
- */
-
-#include <ddf/driver.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <stdio.h>
-
-#include <usb/usb.h>
-#include <usb/debug.h>
-#include <usb/dev/pipes.h>
-#include <usb/classes/classes.h>
-#include <usb/descriptor.h>
-#include <usb/dev/recognise.h>
-#include <usb/dev/request.h>
-#include <usb/classes/hub.h>
-#include <usb/dev/poll.h>
-#include <usbhc_iface.h>
-
-#include "usbhub.h"
-#include "status.h"
-
-#define HUB_FNC_NAME "hub"
-
-#define HUB_STATUS_CHANGE_EP(protocol) { \
-	.transfer_type = USB_TRANSFER_INTERRUPT, \
-	.direction = USB_DIRECTION_IN, \
-	.interface_class = USB_CLASS_HUB, \
-	.interface_subclass = 0, \
-	.interface_protocol = (protocol), \
-	.flags = 0 \
-}
-
-/**
- * Hub status-change endpoint description.
- *
- * According to USB 2.0 specification, there are two possible arrangements of
- * endpoints, depending on whether the hub has a MTT or not.
- *
- * Under any circumstances, there shall be exactly one endpoint descriptor.
- * Though to be sure, let's map the protocol precisely. The possible
- * combinations are:
- *	                      | bDeviceProtocol | bInterfaceProtocol
- *	Only single TT        |       0         |         0
- *	MTT in Single-TT mode |       2         |         1
- *	MTT in MTT mode       |       2         |         2     (iface alt. 1)
- */
-static const usb_endpoint_description_t
-    status_change_single_tt_only = HUB_STATUS_CHANGE_EP(0),
-    status_change_mtt_available = HUB_STATUS_CHANGE_EP(1);
-
-const usb_endpoint_description_t *usb_hub_endpoints [] = {
-	&status_change_single_tt_only,
-	&status_change_mtt_available,
-};
-
-/** Standard get hub global status request */
-static const usb_device_request_setup_packet_t get_hub_status_request = {
-	.request_type = USB_HUB_REQ_TYPE_GET_HUB_STATUS,
-	.request = USB_HUB_REQUEST_GET_STATUS,
-	.index = 0,
-	.value = 0,
-	.length = sizeof(usb_hub_status_t),
-};
-
-static errno_t usb_set_first_configuration(usb_device_t *);
-static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *);
-static void usb_hub_over_current(const usb_hub_dev_t *, usb_hub_status_t);
-static errno_t usb_hub_polling_init(usb_hub_dev_t *, usb_endpoint_mapping_t *);
-static void usb_hub_global_interrupt(const usb_hub_dev_t *);
-
-static bool usb_hub_polling_error_callback(usb_device_t *dev,
-    errno_t err_code, void *arg)
-{
-	assert(dev);
-	assert(arg);
-
-	usb_log_error("Device %s polling error: %s",
-	    usb_device_get_name(dev), str_error(err_code));
-
-	return true;
-}
-
-/**
- * Initialize hub device driver structure.
- *
- * Creates hub representation and fibril that periodically checks hub's status.
- * Hub representation is passed to the fibril.
- * @param usb_dev generic usb device information
- * @return error code
- */
-errno_t usb_hub_device_add(usb_device_t *usb_dev)
-{
-	errno_t err;
-	assert(usb_dev);
-
-	/* Create driver soft-state structure */
-	usb_hub_dev_t *hub_dev =
-	    usb_device_data_alloc(usb_dev, sizeof(usb_hub_dev_t));
-	if (hub_dev == NULL) {
-		usb_log_error("Failed to create hub driver structure.");
-		return ENOMEM;
-	}
-	hub_dev->usb_device = usb_dev;
-	hub_dev->speed = usb_device_get_speed(usb_dev);
-
-	/* Set hub's first configuration. (There should be only one) */
-	if ((err = usb_set_first_configuration(usb_dev))) {
-		usb_log_error("Could not set hub configuration: %s", str_error(err));
-		return err;
-	}
-
-	/* Get port count and create attached_devices. */
-	if ((err = usb_hub_process_hub_specific_info(hub_dev))) {
-		usb_log_error("Could process hub specific info, %s", str_error(err));
-		return err;
-	}
-
-	const usb_endpoint_description_t *status_change = hub_dev->mtt_available ?
-	    &status_change_mtt_available :
-	    &status_change_single_tt_only;
-
-	usb_endpoint_mapping_t *status_change_mapping =
-	    usb_device_get_mapped_ep_desc(hub_dev->usb_device, status_change);
-	if (!status_change_mapping) {
-		usb_log_error("Failed to map the Status Change Endpoint of a hub.");
-		return EIO;
-	}
-
-	/* Create hub control function. */
-	usb_log_debug("Creating DDF function '" HUB_FNC_NAME "'.");
-	hub_dev->hub_fun = usb_device_ddf_fun_create(hub_dev->usb_device,
-	    fun_exposed, HUB_FNC_NAME);
-	if (hub_dev->hub_fun == NULL) {
-		usb_log_error("Failed to create hub function.");
-		return ENOMEM;
-	}
-
-	/* Bind hub control function. */
-	if ((err = ddf_fun_bind(hub_dev->hub_fun))) {
-		usb_log_error("Failed to bind hub function: %s.", str_error(err));
-		goto err_ddf_fun;
-	}
-
-	/* Start hub operation. */
-	if ((err = usb_hub_polling_init(hub_dev, status_change_mapping))) {
-		usb_log_error("Failed to start polling: %s.", str_error(err));
-		goto err_bound;
-	}
-
-	usb_log_info("Controlling %s-speed hub '%s' (%p: %zu ports).",
-	    usb_str_speed(hub_dev->speed),
-	    usb_device_get_name(hub_dev->usb_device), hub_dev,
-	    hub_dev->port_count);
-
-	return EOK;
-
-err_bound:
-	ddf_fun_unbind(hub_dev->hub_fun);
-err_ddf_fun:
-	ddf_fun_destroy(hub_dev->hub_fun);
-	return err;
-}
-
-static errno_t usb_hub_cleanup(usb_hub_dev_t *hub)
-{
-	free(hub->polling.buffer);
-	usb_polling_fini(&hub->polling);
-
-	for (size_t port = 0; port < hub->port_count; ++port) {
-		usb_port_fini(&hub->ports[port].base);
-	}
-	free(hub->ports);
-
-	const errno_t ret = ddf_fun_unbind(hub->hub_fun);
-	if (ret != EOK) {
-		usb_log_error("(%p) Failed to unbind '%s' function: %s.",
-		    hub, HUB_FNC_NAME, str_error(ret));
-		return ret;
-	}
-	ddf_fun_destroy(hub->hub_fun);
-
-	usb_log_info("(%p) USB hub driver stopped and cleaned.", hub);
-
-	/* Device data (usb_hub_dev_t) will be freed by usbdev. */
-	return EOK;
-}
-
-/**
- * Turn off power to all ports.
- *
- * @param usb_dev generic usb device information
- * @return error code
- */
-errno_t usb_hub_device_remove(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	usb_hub_dev_t *hub = usb_device_data_get(usb_dev);
-	assert(hub);
-
-	usb_log_info("(%p) USB hub removed, joining polling fibril.", hub);
-
-	/* Join polling fibril (ignoring error code). */
-	usb_polling_join(&hub->polling);
-	usb_log_info("(%p) USB hub polling stopped, freeing memory.", hub);
-
-	/* Destroy hub. */
-	return usb_hub_cleanup(hub);
-}
-
-/**
- * Remove all attached devices
- * @param usb_dev generic usb device information
- * @return error code
- */
-errno_t usb_hub_device_gone(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	usb_hub_dev_t *hub = usb_device_data_get(usb_dev);
-	assert(hub);
-
-	usb_log_info("(%p) USB hub gone, joining polling fibril.", hub);
-
-	/* Join polling fibril (ignoring error code). */
-	usb_polling_join(&hub->polling);
-	usb_log_info("(%p) USB hub polling stopped, freeing memory.", hub);
-
-	/* Destroy hub. */
-	return usb_hub_cleanup(hub);
-}
-
-/**
- * Initialize and start the polling of the Status Change Endpoint.
- *
- * @param mapping The mapping of Status Change Endpoint
- */
-static errno_t usb_hub_polling_init(usb_hub_dev_t *hub_dev,
-    usb_endpoint_mapping_t *mapping)
-{
-	errno_t err;
-	usb_polling_t *polling = &hub_dev->polling;
-
-	if ((err = usb_polling_init(polling)))
-		return err;
-
-	polling->device = hub_dev->usb_device;
-	polling->ep_mapping = mapping;
-	polling->request_size = ((hub_dev->port_count + 1 + 7) / 8);
-	polling->buffer = malloc(polling->request_size);
-	polling->on_data = hub_port_changes_callback;
-	polling->on_error = usb_hub_polling_error_callback;
-	polling->arg = hub_dev;
-
-	if ((err = usb_polling_start(polling))) {
-		/* Polling is already initialized. */
-		free(polling->buffer);
-		usb_polling_fini(polling);
-		return err;
-	}
-
-	return EOK;
-}
-
-/**
- * Callback for polling hub for changes.
- *
- * @param dev Device where the change occured.
- * @param change_bitmap Bitmap of changed ports.
- * @param change_bitmap_size Size of the bitmap in bytes.
- * @param arg Custom argument, points to @c usb_hub_dev_t.
- * @return Whether to continue polling.
- */
-bool hub_port_changes_callback(usb_device_t *dev,
-    uint8_t *change_bitmap, size_t change_bitmap_size, void *arg)
-{
-	usb_hub_dev_t *hub = arg;
-	assert(hub);
-
-	/* It is an error condition if we didn't receive enough data */
-	if (change_bitmap_size == 0) {
-		return false;
-	}
-
-	/* Lowest bit indicates global change */
-	const bool change = change_bitmap[0] & 1;
-	if (change) {
-		usb_hub_global_interrupt(hub);
-	}
-
-	/* Nth bit indicates change on port N */
-	for (size_t port = 0; port < hub->port_count; ++port) {
-		const size_t bit = port + 1;
-		const bool change = (change_bitmap[bit / 8] >> (bit % 8)) & 1;
-		if (change) {
-			usb_hub_port_process_interrupt(&hub->ports[port]);
-		}
-	}
-	return true;
-}
-
-static void usb_hub_power_ports(usb_hub_dev_t *hub_dev)
-{
-	if (!hub_dev->power_switched) {
-		usb_log_info("(%p): Power switching not supported, "
-		    "ports always powered.", hub_dev);
-		return;
-	}
-
-	usb_log_info("(%p): Hub port power switching enabled (%s).", hub_dev,
-	    hub_dev->per_port_power ? "per port" : "ganged");
-
-	for (unsigned int port = 0; port < hub_dev->port_count; ++port) {
-		usb_log_debug("(%p): Powering port %u.", hub_dev, port + 1);
-		const errno_t ret = usb_hub_set_port_feature(hub_dev, port + 1,
-		    USB_HUB_FEATURE_PORT_POWER);
-
-		if (ret != EOK) {
-			usb_log_error("(%p-%u): Cannot power on port: %s.",
-			    hub_dev, hub_dev->ports[port].port_number,
-			    str_error(ret));
-			/* Continue to try at least other ports */
-		}
-	}
-}
-
-/**
- * Load hub-specific information into hub_dev structure and process if needed
- *
- * Read port count and initialize structures holding per port information.
- * If there are any non-removable devices, start initializing them.
- * This function is hub-specific and should be run only after the hub is
- * configured using usb_set_first_configuration function.
- * @param hub_dev hub representation
- * @return error code
- */
-static errno_t usb_hub_process_hub_specific_info(usb_hub_dev_t *hub_dev)
-{
-	assert(hub_dev);
-
-	usb_log_debug("(%p): Retrieving descriptor.", hub_dev);
-	usb_pipe_t *control_pipe = usb_device_get_default_pipe(hub_dev->usb_device);
-
-	usb_descriptor_type_t desc_type = hub_dev->speed >= USB_SPEED_SUPER ?
-	    USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB;
-
-	/* Get hub descriptor. */
-	usb_hub_descriptor_header_t descriptor;
-	size_t received_size;
-	errno_t opResult = usb_request_get_descriptor(control_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE,
-	    desc_type, 0, 0, &descriptor,
-	    sizeof(usb_hub_descriptor_header_t), &received_size);
-	if (opResult != EOK) {
-		usb_log_error("(%p): Failed to receive hub descriptor: %s.",
-		    hub_dev, str_error(opResult));
-		return opResult;
-	}
-
-	usb_log_debug("(%p): Setting port count to %d.", hub_dev,
-	    descriptor.port_count);
-	hub_dev->port_count = descriptor.port_count;
-	hub_dev->control_pipe = control_pipe;
-
-	usb_log_debug("(%p): Setting hub depth to %u.", hub_dev,
-	    usb_device_get_depth(hub_dev->usb_device));
-	if ((opResult = usb_hub_set_depth(hub_dev))) {
-		usb_log_error("(%p): Failed to set hub depth: %s.",
-		    hub_dev, str_error(opResult));
-		return opResult;
-	}
-
-	hub_dev->ports = calloc(hub_dev->port_count, sizeof(usb_hub_port_t));
-	if (!hub_dev->ports) {
-		return ENOMEM;
-	}
-
-	for (size_t port = 0; port < hub_dev->port_count; ++port) {
-		usb_hub_port_init(&hub_dev->ports[port], hub_dev, port + 1);
-	}
-
-	hub_dev->power_switched =
-	    !(descriptor.characteristics & HUB_CHAR_NO_POWER_SWITCH_FLAG);
-	hub_dev->per_port_power =
-	    descriptor.characteristics & HUB_CHAR_POWER_PER_PORT_FLAG;
-
-	const uint8_t protocol = usb_device_descriptors(hub_dev->usb_device)->device.device_protocol;
-	hub_dev->mtt_available = (protocol == 2);
-
-	usb_hub_power_ports(hub_dev);
-
-	return EOK;
-}
-
-/**
- * Set configuration of and USB device
- *
- * Check whether there is at least one configuration and sets the first one.
- * This function should be run prior to running any hub-specific action.
- * @param usb_device usb device representation
- * @return error code
- */
-static errno_t usb_set_first_configuration(usb_device_t *usb_device)
-{
-	assert(usb_device);
-	/* Get number of possible configurations from device descriptor */
-	const size_t configuration_count =
-	    usb_device_descriptors(usb_device)->device.configuration_count;
-	usb_log_debug("Hub has %zu configurations.", configuration_count);
-
-	if (configuration_count < 1) {
-		usb_log_error("There are no configurations available");
-		return EINVAL;
-	}
-
-	const size_t config_size =
-	    usb_device_descriptors(usb_device)->full_config_size;
-	const usb_standard_configuration_descriptor_t *config_descriptor =
-	    usb_device_descriptors(usb_device)->full_config;
-
-	if (config_size < sizeof(usb_standard_configuration_descriptor_t)) {
-		usb_log_error("Configuration descriptor is not big enough"
-		    " to fit standard configuration descriptor.\n");
-		return EOVERFLOW;
-	}
-
-	/*
-	 * Set configuration. Use the configuration that was in
-	 * usb_device->descriptors.configuration i.e. The first one.
-	 */
-	errno_t opResult = usb_request_set_configuration(
-	    usb_device_get_default_pipe(usb_device),
-	    config_descriptor->configuration_number);
-	if (opResult != EOK) {
-		usb_log_error("Failed to set hub configuration: %s.",
-		    str_error(opResult));
-	} else {
-		usb_log_debug("\tUsed configuration %d",
-		    config_descriptor->configuration_number);
-	}
-
-	return opResult;
-}
-
-/**
- * Process hub over current change
- *
- * This means either to power off the hub or power it on.
- * @param hub_dev hub instance
- * @param status hub status bitmask
- * @return error code
- */
-static void usb_hub_over_current(const usb_hub_dev_t *hub_dev,
-    usb_hub_status_t status)
-{
-	if (status & USB_HUB_STATUS_OVER_CURRENT) {
-		/* Hub should remove power from all ports if it detects OC */
-		usb_log_warning("(%p) Detected hub over-current condition, "
-		    "all ports should be powered off.", hub_dev);
-		return;
-	}
-
-	/* Ports are always powered. */
-	if (!hub_dev->power_switched)
-		return;
-
-	/* Over-current condition is gone, it is safe to turn the ports on. */
-	for (size_t port = 0; port < hub_dev->port_count; ++port) {
-		const errno_t ret = usb_hub_set_port_feature(hub_dev, port,
-		    USB_HUB_FEATURE_PORT_POWER);
-		if (ret != EOK) {
-			usb_log_warning("(%p-%u): HUB OVER-CURRENT GONE: Cannot"
-			    " power on port: %s\n", hub_dev,
-			    hub_dev->ports[port].port_number, str_error(ret));
-		} else {
-			if (!hub_dev->per_port_power)
-				return;
-		}
-	}
-}
-
-/**
- * Set feature on the real hub port.
- *
- * @param port Port structure.
- * @param feature Feature selector.
- */
-errno_t usb_hub_set_depth(const usb_hub_dev_t *hub)
-{
-	assert(hub);
-
-	/* Slower hubs do not care about depth */
-	if (hub->speed < USB_SPEED_SUPER)
-		return EOK;
-
-	const usb_device_request_setup_packet_t set_request = {
-		.request_type = USB_HUB_REQ_TYPE_SET_HUB_DEPTH,
-		.request = USB_HUB_REQUEST_SET_HUB_DEPTH,
-		.value = uint16_host2usb(usb_device_get_depth(hub->usb_device) - 1),
-		.index = 0,
-		.length = 0,
-	};
-	return usb_pipe_control_write(hub->control_pipe, &set_request,
-	    sizeof(set_request), NULL, 0);
-}
-
-/**
- * Set feature on the real hub port.
- *
- * @param port Port structure.
- * @param feature Feature selector.
- */
-errno_t usb_hub_set_port_feature(const usb_hub_dev_t *hub, size_t port_number,
-    usb_hub_class_feature_t feature)
-{
-	assert(hub);
-	const usb_device_request_setup_packet_t clear_request = {
-		.request_type = USB_HUB_REQ_TYPE_SET_PORT_FEATURE,
-		.request = USB_DEVREQ_SET_FEATURE,
-		.index = uint16_host2usb(port_number),
-		.value = feature,
-		.length = 0,
-	};
-	return usb_pipe_control_write(hub->control_pipe, &clear_request,
-	    sizeof(clear_request), NULL, 0);
-}
-
-/**
- * Clear feature on the real hub port.
- *
- * @param port Port structure.
- * @param feature Feature selector.
- */
-errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *hub, size_t port_number,
-    usb_hub_class_feature_t feature)
-{
-	assert(hub);
-	const usb_device_request_setup_packet_t clear_request = {
-		.request_type = USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE,
-		.request = USB_DEVREQ_CLEAR_FEATURE,
-		.value = feature,
-		.index = uint16_host2usb(port_number),
-		.length = 0,
-	};
-	return usb_pipe_control_write(hub->control_pipe,
-	    &clear_request, sizeof(clear_request), NULL, 0);
-}
-
-/**
- * Retrieve port status.
- *
- * @param[in] port Port structure
- * @param[out] status Where to store the port status.
- * @return Error code.
- */
-errno_t usb_hub_get_port_status(const usb_hub_dev_t *hub, size_t port_number,
-    usb_port_status_t *status)
-{
-	assert(hub);
-	assert(status);
-
-	/*
-	 * USB hub specific GET_PORT_STATUS request. See USB Spec 11.16.2.6
-	 * Generic GET_STATUS request cannot be used because of the difference
-	 * in status data size (2B vs. 4B)
-	 */
-	const usb_device_request_setup_packet_t request = {
-		.request_type = USB_HUB_REQ_TYPE_GET_PORT_STATUS,
-		.request = USB_HUB_REQUEST_GET_STATUS,
-		.value = 0,
-		.index = uint16_host2usb(port_number),
-		.length = sizeof(usb_port_status_t),
-	};
-	size_t recv_size;
-
-	uint32_t buffer;
-	const errno_t rc = usb_pipe_control_read(hub->control_pipe,
-	    &request, sizeof(usb_device_request_setup_packet_t),
-	    &buffer, sizeof(buffer), &recv_size);
-	if (rc != EOK)
-		return rc;
-
-	if (recv_size != sizeof(*status))
-		return ELIMIT;
-
-	*status = uint32_usb2host(buffer);
-	return EOK;
-}
-
-/**
- * Process hub interrupts.
- *
- * The change can be either in the over-current condition or local-power change.
- * @param hub_dev hub instance
- */
-static void usb_hub_global_interrupt(const usb_hub_dev_t *hub_dev)
-{
-	assert(hub_dev);
-	assert(hub_dev->usb_device);
-	usb_log_debug("(%p): Global interrupt on th hub.",  hub_dev);
-	usb_pipe_t *control_pipe =
-	    usb_device_get_default_pipe(hub_dev->usb_device);
-
-	usb_hub_status_t status;
-	size_t rcvd_size;
-	/*
-	 * NOTE: We can't use standard USB GET_STATUS request, because
-	 * hubs reply is 4byte instead of 2
-	 */
-	const errno_t opResult = usb_pipe_control_read(control_pipe,
-	    &get_hub_status_request, sizeof(get_hub_status_request),
-	    &status, sizeof(usb_hub_status_t), &rcvd_size);
-	if (opResult != EOK) {
-		usb_log_error("(%p): Could not get hub status: %s.", hub_dev,
-		    str_error(opResult));
-		return;
-	}
-	if (rcvd_size != sizeof(usb_hub_status_t)) {
-		usb_log_error("(%p): Received status has incorrect size: "
-		    "%zu != %zu", hub_dev, rcvd_size, sizeof(usb_hub_status_t));
-		return;
-	}
-
-	/* Handle status changes */
-	if (status & USB_HUB_STATUS_C_OVER_CURRENT) {
-		usb_hub_over_current(hub_dev, status);
-		/* Ack change in hub OC flag */
-		const errno_t ret = usb_request_clear_feature(
-		    control_pipe, USB_REQUEST_TYPE_CLASS,
-		    USB_REQUEST_RECIPIENT_DEVICE,
-		    USB_HUB_FEATURE_C_HUB_OVER_CURRENT, 0);
-		if (ret != EOK) {
-			usb_log_error("(%p): Failed to clear hub over-current "
-			    "change flag: %s.\n", hub_dev, str_error(opResult));
-		}
-	}
-
-	if (status & USB_HUB_STATUS_C_LOCAL_POWER) {
-		/*
-		 * NOTE: Handling this is more complicated.
-		 * If the transition is from bus power to local power, all
-		 * is good and we may signal the parent hub that we don't
-		 * need the power.
-		 * If the transition is from local power to bus power
-		 * the hub should turn off all the ports and devices need
-		 * to be reinitialized taking into account the limited power
-		 * that is now available.
-		 * There is no support for power distribution in HelenOS,
-		 * (or other OSes/hub devices that I've seen) so this is not
-		 * implemented.
-		 * Just ACK the change.
-		 */
-		const errno_t ret = usb_request_clear_feature(
-		    control_pipe, USB_REQUEST_TYPE_CLASS,
-		    USB_REQUEST_RECIPIENT_DEVICE,
-		    USB_HUB_FEATURE_C_HUB_LOCAL_POWER, 0);
-		if (opResult != EOK) {
-			usb_log_error("(%p): Failed to clear hub power change "
-			    "flag: %s.\n", hub_dev, str_error(ret));
-		}
-	}
-}
-
-/**
- * Instead of just sleeping, we may as well sleep on a condition variable.
- * This has the advantage that we may instantly wait other hub from the polling
- * sleep, mitigating the delay of polling while still being synchronized with
- * other devices in need of the default address (there shall not be any).
- */
-static FIBRIL_CONDVAR_INITIALIZE(global_hub_default_address_cv);
-static FIBRIL_MUTEX_INITIALIZE(global_hub_default_address_guard);
-
-/**
- * Reserve a default address for a port across all other devices connected to
- * the bus. We aggregate requests for ports to minimize delays between
- * connecting multiple devices from one hub - which happens e.g. when the hub
- * is connected with already attached devices.
- */
-errno_t usb_hub_reserve_default_address(usb_hub_dev_t *hub, async_exch_t *exch,
-    usb_port_t *port)
-{
-	assert(hub);
-	assert(exch);
-	assert(port);
-	assert(fibril_mutex_is_locked(&port->guard));
-
-	errno_t err = usbhc_reserve_default_address(exch);
-	/*
-	 * EINVAL signalls that its our hub (hopefully different port) that has
-	 * this address reserved
-	 */
-	while (err == EAGAIN || err == EINVAL) {
-		/* Drop the port guard, we're going to wait */
-		fibril_mutex_unlock(&port->guard);
-
-		/* This sleeping might be disturbed by other hub */
-		fibril_mutex_lock(&global_hub_default_address_guard);
-		fibril_condvar_wait_timeout(&global_hub_default_address_cv,
-		    &global_hub_default_address_guard, 2000000);
-		fibril_mutex_unlock(&global_hub_default_address_guard);
-
-		fibril_mutex_lock(&port->guard);
-		err = usbhc_reserve_default_address(exch);
-	}
-
-	if (err)
-		return err;
-
-	/*
-	 * As we dropped the port guard, we need to check whether the device is
-	 * still connected. If the release fails, we still hold the default
-	 * address -- but then there is probably a bigger problem with the HC
-	 * anyway.
-	 */
-	if (port->state != PORT_CONNECTING) {
-		err = usb_hub_release_default_address(hub, exch);
-		return err ? err : EINTR;
-	}
-
-	return EOK;
-}
-
-/**
- * Release the default address from a port.
- */
-errno_t usb_hub_release_default_address(usb_hub_dev_t *hub, async_exch_t *exch)
-{
-	const errno_t ret = usbhc_release_default_address(exch);
-
-	/*
-	 * This is an optimistic optimization - it may wake
-	 * one hub from polling sleep instantly.
-	 */
-	fibril_condvar_signal(&global_hub_default_address_cv);
-
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/usbhub.h
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhub
- * @{
- */
-/** @file
- * @brief Hub driver.
- */
-
-#ifndef DRV_USBHUB_USBHUB_H
-#define DRV_USBHUB_USBHUB_H
-
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-
-#include <usb/classes/hub.h>
-
-#include <usb/dev/pipes.h>
-#include <usb/dev/driver.h>
-#include <usb/dev/poll.h>
-
-#define NAME "usbhub"
-
-#include "port.h"
-#include "status.h"
-
-/** Information about attached hub. */
-struct usb_hub_dev {
-	/** Number of ports. */
-	size_t port_count;
-	/** Port structures, one for each port */
-	usb_hub_port_t *ports;
-	/** Speed of the hub */
-	usb_speed_t speed;
-	/** Generic usb device data */
-	usb_device_t *usb_device;
-	/** Data polling handle. */
-	usb_polling_t polling;
-	/** Pointer to usbhub function. */
-	ddf_fun_t *hub_fun;
-	/** Device communication pipe. */
-	usb_pipe_t *control_pipe;
-	/** Hub supports port power switching. */
-	bool power_switched;
-	/** Each port is switched individually. */
-	bool per_port_power;
-	/** Whether MTT is available */
-	bool mtt_available;
-};
-
-extern const usb_endpoint_description_t *usb_hub_endpoints [];
-
-errno_t usb_hub_device_add(usb_device_t *);
-errno_t usb_hub_device_remove(usb_device_t *);
-errno_t usb_hub_device_gone(usb_device_t *);
-
-errno_t usb_hub_set_depth(const usb_hub_dev_t *);
-errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t,
-    usb_port_status_t *);
-errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t,
-    usb_hub_class_feature_t);
-errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t,
-    usb_hub_class_feature_t);
-
-bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *);
-
-errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *,
-    usb_port_t *);
-errno_t usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbhub/usbhub.ma
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 usb&hub
-10 usb&class=hub
Index: pace/drv/bus/usb/usbmid/dump.c
===================================================================
--- uspace/drv/bus/usb/usbmid/dump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmid
- * @{
- */
-/**
- * @file
- * Dumping and debugging functions.
- */
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/dp.h>
-#include <usb/classes/classes.h>
-#include "usbmid.h"
-
-/** Dump found descriptor.
- *
- * @param data Descriptor data.
- * @param depth Nesting depth.
- */
-static void dump_tree_descriptor(const uint8_t *data, size_t depth)
-{
-	if (data == NULL) {
-		return;
-	}
-	const int type = data[1];
-	if (type == USB_DESCTYPE_INTERFACE) {
-		usb_standard_interface_descriptor_t *descriptor =
-		    (usb_standard_interface_descriptor_t *) data;
-		usb_log_info("Found interface: %s (0x%02x/0x%02x/0x%02x).",
-		    usb_str_class(descriptor->interface_class),
-		    (int) descriptor->interface_class,
-		    (int) descriptor->interface_subclass,
-		    (int) descriptor->interface_protocol);
-	}
-}
-
-/** Dump tree of descriptors.
- *
- * @param parser Descriptor parser.
- * @param data Descriptor parser data.
- * @param root Pointer to current root.
- * @param depth Nesting depth.
- */
-static void dump_tree_internal(
-    usb_dp_parser_t *parser, usb_dp_parser_data_t *data,
-    const uint8_t *root, size_t depth)
-{
-	if (root == NULL) {
-		return;
-	}
-	dump_tree_descriptor(root, depth);
-	const uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root);
-	do {
-		dump_tree_internal(parser, data, child, depth + 1);
-		child = usb_dp_get_sibling_descriptor(parser, data, root, child);
-	} while (child != NULL);
-}
-
-/** Dump descriptor tree.
- *
- * @param parser Descriptor parser.
- * @param data Descriptor parser data.
- */
-static void dump_tree(usb_dp_parser_t *parser, usb_dp_parser_data_t *data)
-{
-	const uint8_t *ptr = data->data;
-	dump_tree_internal(parser, data, ptr, 0);
-}
-
-/** Dump given descriptors.
- *
- * @param descriptors Descriptors buffer (typically full config descriptor).
- * @param length Size of @p descriptors buffer in bytes.
- */
-void usbmid_dump_descriptors(uint8_t *descriptors, size_t length)
-{
-	usb_dp_parser_data_t data = {
-		.data = descriptors,
-		.size = length,
-		.arg = NULL
-	};
-
-	usb_dp_parser_t parser = {
-		.nesting = usb_dp_standard_descriptor_nesting
-	};
-
-	dump_tree(&parser, &data);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbmid/explore.c
===================================================================
--- uspace/drv/bus/usb/usbmid/explore.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmid
- * @{
- */
-/**
- * @file
- * Exploration of available interfaces in the USB device.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/request.h>
-#include <usb/dev/dp.h>
-#include "usbmid.h"
-
-/** Tell whether given interface is already in the list.
- *
- * @param list List of usbmid_interface_t members to be searched.
- * @param interface_no Interface number caller is looking for.
- * @return Interface @p interface_no is already present in the list.
- */
-static bool interface_in_list(const list_t *list, int interface_no)
-{
-	list_foreach(*list, link, const usbmid_interface_t, iface) {
-		if (iface->interface_no == interface_no) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** Create list of interfaces from configuration descriptor.
- *
- * @param config_descriptor Configuration descriptor.
- * @param config_descriptor_size Size of configuration descriptor in bytes.
- * @param list List where to add the interfaces.
- */
-static errno_t create_interfaces(const uint8_t *config_descriptor,
-    size_t config_descriptor_size, list_t *list, usb_device_t *usb_dev)
-{
-	assert(config_descriptor);
-	assert(usb_dev);
-
-	const usb_dp_parser_data_t data = {
-		.data = config_descriptor,
-		.size = config_descriptor_size,
-		.arg = NULL
-	};
-
-	static const usb_dp_parser_t parser = {
-		.nesting = usb_dp_standard_descriptor_nesting
-	};
-
-	const uint8_t *interface_ptr =
-	    usb_dp_get_nested_descriptor(&parser, &data, config_descriptor);
-
-	/*
-	 * Walk all descriptors nested in the current configuration decriptor;
-	 * i.e. all interface descriptors.
-	 */
-	for (; interface_ptr != NULL;
-	    interface_ptr = usb_dp_get_sibling_descriptor(
-	    &parser, &data, config_descriptor, interface_ptr)) {
-		/* The second byte is DESCTYPE byte in all desriptors. */
-		if (interface_ptr[1] != USB_DESCTYPE_INTERFACE)
-			continue;
-
-		const usb_standard_interface_descriptor_t *interface =
-		    (usb_standard_interface_descriptor_t *) interface_ptr;
-
-		/* Skip alternate interfaces. */
-		if (interface_in_list(list, interface->interface_number)) {
-			/*
-			 * TODO: add the alternatives and create match ids
-			 * for them.
-			 */
-			continue;
-		}
-
-		usb_log_info("Creating child for interface %d (%s).",
-		    interface->interface_number,
-		    usb_str_class(interface->interface_class));
-
-		usbmid_interface_t *iface = NULL;
-		const errno_t rc = usbmid_spawn_interface_child(usb_dev, &iface,
-		    &usb_device_descriptors(usb_dev)->device, interface);
-		if (rc != EOK) {
-			//TODO: Do something about that failure.
-			usb_log_error("Failed to create interface child for "
-			    "%d (%s): %s.\n", interface->interface_number,
-			    usb_str_class(interface->interface_class),
-			    str_error(rc));
-		} else {
-			list_append(&iface->link, list);
-		}
-	}
-	return EOK;
-}
-
-/** Explore MID device.
- *
- * We expect that @p dev is initialized and session on control pipe is
- * started.
- *
- * @param dev Device to be explored.
- * @return Whether to accept this device.
- */
-errno_t usbmid_explore_device(usb_device_t *dev)
-{
-	assert(dev);
-	const unsigned dev_class =
-	    usb_device_descriptors(dev)->device.device_class;
-	if (dev_class != USB_CLASS_USE_INTERFACE) {
-		usb_log_warning(
-		    "Device class: %u (%s), but expected class %u.\n",
-		    dev_class, usb_str_class(dev_class),
-		    USB_CLASS_USE_INTERFACE);
-		usb_log_error("Not a multi-interface device, refusing.");
-		return ENOTSUP;
-	}
-
-	/* Get coonfiguration descriptor. */
-	const size_t config_descriptor_size =
-	    usb_device_descriptors(dev)->full_config_size;
-	const void *config_descriptor_raw =
-	    usb_device_descriptors(dev)->full_config;
-	const usb_standard_configuration_descriptor_t *config_descriptor =
-	    config_descriptor_raw;
-
-	/* Select the first configuration */
-	errno_t rc = usb_request_set_configuration(usb_device_get_default_pipe(dev),
-	    config_descriptor->configuration_number);
-	if (rc != EOK) {
-		usb_log_error("Failed to set device configuration: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	/* Create driver soft-state. */
-	usb_mid_t *usb_mid = usb_device_data_alloc(dev, sizeof(usb_mid_t));
-	if (!usb_mid) {
-		usb_log_error("Failed to create USB MID structure.");
-		return ENOMEM;
-	}
-
-	/* Create control function. */
-	usb_mid->ctl_fun = usb_device_ddf_fun_create(dev, fun_exposed, "ctl");
-	if (usb_mid->ctl_fun == NULL) {
-		usb_log_error("Failed to create control function.");
-		return ENOMEM;
-	}
-
-	/* Bind control function. */
-	rc = ddf_fun_bind(usb_mid->ctl_fun);
-	if (rc != EOK) {
-		usb_log_error("Failed to bind control function: %s.",
-		    str_error(rc));
-		ddf_fun_destroy(usb_mid->ctl_fun);
-		return rc;
-	}
-
-	/* Create interface children. */
-	list_initialize(&usb_mid->interface_list);
-	create_interfaces(config_descriptor_raw, config_descriptor_size,
-	    &usb_mid->interface_list, dev);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbmid/main.c
===================================================================
--- uspace/drv/bus/usb/usbmid/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmid
- * @{
- */
-/**
- * @file
- * Main routines of USB multi interface device driver.
- */
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/request.h>
-#include <usb/descriptor.h>
-#include <usb/dev/pipes.h>
-
-#include "usbmid.h"
-
-/** Callback when new MID device is attached to the host.
- *
- * @param gen_dev Generic DDF device representing the new device.
- * @return Error code.
- */
-static errno_t usbmid_device_add(usb_device_t *dev)
-{
-	usb_log_info("Taking care of new MID `%s'.", usb_device_get_name(dev));
-
-	return usbmid_explore_device(dev);
-}
-
-static errno_t destroy_interfaces(usb_mid_t *usb_mid)
-{
-	errno_t ret = EOK;
-
-	while (!list_empty(&usb_mid->interface_list)) {
-		link_t *item = list_first(&usb_mid->interface_list);
-		list_remove(item);
-
-		usbmid_interface_t *iface = usbmid_interface_from_link(item);
-
-		const errno_t pret = usbmid_interface_destroy(iface);
-		if (pret != EOK) {
-			usb_log_error("Failed to remove child `%s': %s",
-			    ddf_fun_get_name(iface->fun), str_error(pret));
-			ret = pret;
-		}
-	}
-
-	return ret;
-}
-
-/** Callback when a MID device is about to be removed from the host.
- *
- * @param dev USB device representing the removed device.
- * @return Error code.
- */
-static errno_t usbmid_device_remove(usb_device_t *dev)
-{
-	assert(dev);
-	usb_mid_t *usb_mid = usb_device_data_get(dev);
-	assert(usb_mid);
-
-	/* Remove ctl function */
-	errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
-	if (ret != EOK) {
-		usb_log_error("Failed to unbind USB MID ctl function: %s.",
-		    str_error(ret));
-		return ret;
-	}
-	ddf_fun_destroy(usb_mid->ctl_fun);
-
-	/* Remove all children */
-	list_foreach(usb_mid->interface_list, link, usbmid_interface_t, iface) {
-		usb_log_info("Removing child `%s'.",
-		    ddf_fun_get_name(iface->fun));
-
-		/* Tell the child to go offline. */
-		errno_t pret = ddf_fun_offline(iface->fun);
-		if (pret != EOK) {
-			usb_log_warning("Failed to turn off child `%s': %s",
-			    ddf_fun_get_name(iface->fun), str_error(pret));
-		}
-	}
-
-	return destroy_interfaces(usb_mid);
-}
-
-/** Callback when a MID device was removed from the host.
- *
- * @param dev USB device representing the removed device.
- * @return Error code.
- */
-static errno_t usbmid_device_gone(usb_device_t *dev)
-{
-	assert(dev);
-	usb_mid_t *usb_mid = usb_device_data_get(dev);
-	assert(usb_mid);
-
-	usb_log_info("USB MID gone: `%s'.", usb_device_get_name(dev));
-
-	/* Remove ctl function */
-	errno_t ret = ddf_fun_unbind(usb_mid->ctl_fun);
-	if (ret != EOK) {
-		usb_log_error("Failed to unbind USB MID ctl function: %s.",
-		    str_error(ret));
-		return ret;
-	}
-	ddf_fun_destroy(usb_mid->ctl_fun);
-
-	/* Destroy children and tell their drivers they are gone. */
-	return destroy_interfaces(usb_mid);
-}
-
-static errno_t usbmid_function_online(ddf_fun_t *fun)
-{
-	usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	usb_mid_t *usb_mid = usb_device_data_get(usb_dev);
-	if (fun == usb_mid->ctl_fun)
-		return ENOTSUP;
-
-	return ddf_fun_online(fun);
-}
-
-static errno_t usbmid_function_offline(ddf_fun_t *fun)
-{
-	usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	usb_mid_t *usb_mid = usb_device_data_get(usb_dev);
-	if (fun == usb_mid->ctl_fun)
-		return ENOTSUP;
-
-	return ddf_fun_offline(fun);
-}
-
-/** USB MID driver ops. */
-static const usb_driver_ops_t mid_driver_ops = {
-	.device_add = usbmid_device_add,
-	.device_remove = usbmid_device_remove,
-	.device_gone = usbmid_device_gone,
-	.function_online = usbmid_function_online,
-	.function_offline = usbmid_function_offline
-};
-
-/** USB MID driver. */
-static const usb_driver_t mid_driver = {
-	.name = NAME,
-	.ops = &mid_driver_ops,
-	.endpoints = NULL
-};
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": USB multi interface device driver.\n");
-
-	log_init(NAME);
-
-	return usb_driver_main(&mid_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbmid/meson.build
===================================================================
--- uspace/drv/bus/usb/usbmid/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb' ]
-src = files(
-	'dump.c',
-	'explore.c',
-	'main.c',
-	'usbmid.c',
-)
Index: pace/drv/bus/usb/usbmid/usbmid.c
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmid
- * @{
- */
-
-/**
- * @file
- * Helper functions.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <usb_iface.h>
-#include <usb/dev/pipes.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/recognise.h>
-#include "usbmid.h"
-
-/**
- * Get USB device description by calling HC and altering the interface field.
- *
- * @param[in] fun Device function the operation is running on.
- * @param[out] desc Device descriptor.
- * @return Error code.
- */
-static errno_t usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc)
-{
-	usbmid_interface_t *iface = ddf_fun_data_get(fun);
-	assert(iface);
-	usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	assert(usb_dev);
-
-	async_exch_t *exch = usb_device_bus_exchange_begin(usb_dev);
-	if (!exch)
-		return EPARTY;
-
-	usb_device_desc_t tmp_desc;
-	const errno_t ret = usb_get_my_description(exch, &tmp_desc);
-
-	if (ret == EOK && desc) {
-		*desc = tmp_desc;
-		desc->iface = iface->interface_no;
-	}
-
-	usb_device_bus_exchange_end(exch);
-
-	return EOK;
-}
-
-/** DDF interface of the child - USB functions. */
-static usb_iface_t child_usb_iface = {
-	.get_my_description = usb_iface_description,
-};
-
-/** Operations for children - interface functions. */
-static ddf_dev_ops_t child_device_ops = {
-	.interfaces[USB_DEV_IFACE] = &child_usb_iface
-};
-
-errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface)
-{
-	assert(mid_iface);
-	assert_link_not_used(&mid_iface->link);
-	const errno_t ret = ddf_fun_unbind(mid_iface->fun);
-	if (ret != EOK) {
-		return ret;
-	}
-	ddf_fun_destroy(mid_iface->fun);
-	return EOK;
-}
-
-/** Spawn new child device from one interface.
- *
- * @param parent Parent MID device.
- * @param iface Interface information.
- * @param device_descriptor Device descriptor.
- * @param interface_descriptor Interface descriptor.
- * @return Error code.
- */
-errno_t usbmid_spawn_interface_child(usb_device_t *parent,
-    usbmid_interface_t **iface_ret,
-    const usb_standard_device_descriptor_t *device_descriptor,
-    const usb_standard_interface_descriptor_t *interface_descriptor)
-{
-	ddf_fun_t *child = NULL;
-	char *child_name = NULL;
-	errno_t rc;
-
-	/*
-	 * Name is class name followed by interface number.
-	 * The interface number shall provide uniqueness while the
-	 * class name something humanly understandable.
-	 */
-	errno_t ret = asprintf(&child_name, "%s%hhu",
-	    usb_str_class(interface_descriptor->interface_class),
-	    interface_descriptor->interface_number);
-	if (ret < 0) {
-		return ENOMEM;
-	}
-
-	/* Create the device. */
-	child = usb_device_ddf_fun_create(parent, fun_inner, child_name);
-	free(child_name);
-	if (child == NULL) {
-		return ENOMEM;
-	}
-
-	match_id_list_t match_ids;
-	init_match_ids(&match_ids);
-
-	rc = usb_device_create_match_ids_from_interface(device_descriptor,
-	    interface_descriptor, &match_ids);
-	if (rc != EOK) {
-		ddf_fun_destroy(child);
-		return rc;
-	}
-
-	list_foreach(match_ids.ids, link, match_id_t, match_id) {
-		rc = ddf_fun_add_match_id(child, match_id->id, match_id->score);
-		if (rc != EOK) {
-			clean_match_ids(&match_ids);
-			ddf_fun_destroy(child);
-			return rc;
-		}
-	}
-	clean_match_ids(&match_ids);
-	ddf_fun_set_ops(child, &child_device_ops);
-
-	usbmid_interface_t *iface = ddf_fun_data_alloc(child, sizeof(*iface));
-
-	iface->fun = child;
-	iface->interface_no = interface_descriptor->interface_number;
-	link_initialize(&iface->link);
-
-	rc = ddf_fun_bind(child);
-	if (rc != EOK) {
-		/* This takes care of match_id deallocation as well. */
-		ddf_fun_destroy(child);
-		return rc;
-	}
-	*iface_ret = iface;
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbmid/usbmid.h
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbmid
- * @{
- */
-/** @file
- * Common definitions.
- */
-
-#ifndef USBMID_H_
-#define USBMID_H_
-
-#include <adt/list.h>
-#include <ddf/driver.h>
-#include <usb/usb.h>
-#include <usb/dev/pipes.h>
-#include <usb/debug.h>
-#include <usb/dev/driver.h>
-
-#define NAME "usbmid"
-
-/** Container for single interface in a MID device. */
-typedef struct {
-	/** Function container. */
-	ddf_fun_t *fun;
-	/** Interface number. */
-	int interface_no;
-	/** List link. */
-	link_t link;
-} usbmid_interface_t;
-
-/** Container to hold all the function pointers */
-typedef struct usb_mid {
-	ddf_fun_t *ctl_fun;
-	list_t interface_list;
-} usb_mid_t;
-
-extern errno_t usbmid_explore_device(usb_device_t *);
-extern errno_t usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
-    const usb_standard_device_descriptor_t *,
-    const usb_standard_interface_descriptor_t *);
-extern void usbmid_dump_descriptors(uint8_t *, size_t);
-extern errno_t usbmid_interface_destroy(usbmid_interface_t *mid_iface);
-
-static inline usbmid_interface_t *usbmid_interface_from_link(link_t *item)
-{
-	return list_get_instance(item, usbmid_interface_t, link);
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/usbmid/usbmid.ma
===================================================================
--- uspace/drv/bus/usb/usbmid/usbmid.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-100 usb&class=use-interface
-100 usb&mid
Index: pace/drv/bus/usb/vhc/conndev.c
===================================================================
--- uspace/drv/bus/usb/vhc/conndev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * Connection handling of calls from virtual device (implementation).
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <ddf/driver.h>
-#include <usbvirt/ipc.h>
-#include <usb/debug.h>
-#include <async.h>
-
-#include "vhcd.h"
-
-static fibril_local uintptr_t plugged_device_handle = 0;
-#define PLUGGED_DEVICE_NAME_MAXLEN 256
-static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>";
-
-/** Receive device name.
- *
- * @warning Errors are silently ignored.
- *
- * @param sess Session to the virtual device.
- *
- */
-static void receive_device_name(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t opening_request = async_send_0(exch, IPC_M_USBVIRT_GET_NAME, NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return;
-	}
-
-	ipc_call_t data_request_call;
-	aid_t data_request = async_data_read(exch, plugged_device_name,
-	    PLUGGED_DEVICE_NAME_MAXLEN, &data_request_call);
-
-	async_exchange_end(exch);
-
-	if (data_request == 0) {
-		async_forget(opening_request);
-		return;
-	}
-
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
-	async_wait_for(data_request, &data_request_rc);
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if ((data_request_rc != EOK) || (opening_request_rc != EOK))
-		return;
-
-	size_t len = ipc_get_arg2(&data_request_call);
-	plugged_device_name[len] = 0;
-}
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun   Device handling the call.
- * @param icall Call data.
- *
- */
-void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	vhc_data_t *vhc = ddf_fun_data_get(fun);
-
-	async_sess_t *callback =
-	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-
-	if (callback) {
-		errno_t rc = vhc_virtdev_plug(vhc, callback, &plugged_device_handle);
-		if (rc != EOK) {
-			async_answer_0(icall, rc);
-			async_hangup(callback);
-			return;
-		}
-
-		async_answer_0(icall, EOK);
-
-		receive_device_name(callback);
-
-		usb_log_info("New virtual device `%s' (id: %" PRIxn ").",
-		    plugged_device_name, plugged_device_handle);
-	} else
-		async_answer_0(icall, EINVAL);
-}
-
-/** Callback when client disconnects.
- *
- * Used to unplug virtual USB device.
- *
- * @param fun
- */
-void on_client_close(ddf_fun_t *fun)
-{
-	vhc_data_t *vhc = ddf_fun_data_get(fun);
-
-	if (plugged_device_handle != 0) {
-		usb_log_info("Virtual device `%s' disconnected (id: %" PRIxn ").",
-		    plugged_device_name, plugged_device_handle);
-		vhc_virtdev_unplug(vhc, plugged_device_handle);
-	}
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/devconn.c
===================================================================
--- uspace/drv/bus/usb/vhc/devconn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include "vhcd.h"
-#include "hub/virthub.h"
-
-static vhc_virtdev_t *vhc_virtdev_create(void)
-{
-	vhc_virtdev_t *dev = malloc(sizeof(vhc_virtdev_t));
-	if (dev == NULL) {
-		return NULL;
-	}
-	dev->address = 0;
-	dev->dev_sess = NULL;
-	dev->dev_local = NULL;
-	dev->plugged = true;
-	link_initialize(&dev->link);
-	fibril_mutex_initialize(&dev->guard);
-	list_initialize(&dev->transfer_queue);
-
-	return dev;
-}
-
-static errno_t vhc_virtdev_plug_generic(vhc_data_t *vhc,
-    async_sess_t *sess, usbvirt_device_t *virtdev,
-    uintptr_t *handle, bool connect, usb_address_t address)
-{
-	vhc_virtdev_t *dev = vhc_virtdev_create();
-	if (dev == NULL) {
-		return ENOMEM;
-	}
-
-	dev->dev_sess = sess;
-	dev->dev_local = virtdev;
-	dev->address = address;
-
-	fibril_mutex_lock(&vhc->guard);
-	list_append(&dev->link, &vhc->devices);
-	fibril_mutex_unlock(&vhc->guard);
-
-	fid_t fibril = fibril_create(vhc_transfer_queue_processor, dev);
-	if (fibril == 0) {
-		free(dev);
-		return ENOMEM;
-	}
-	fibril_add_ready(fibril);
-
-	if (handle != NULL) {
-		*handle = (uintptr_t) dev;
-	}
-
-	if (connect) {
-		// FIXME: check status
-		(void) virthub_connect_device(&vhc->hub, dev);
-	}
-
-	return EOK;
-}
-
-errno_t vhc_virtdev_plug(vhc_data_t *vhc, async_sess_t *sess, uintptr_t *handle)
-{
-	return vhc_virtdev_plug_generic(vhc, sess, NULL, handle, true, 0);
-}
-
-errno_t vhc_virtdev_plug_local(vhc_data_t *vhc, usbvirt_device_t *dev, uintptr_t *handle)
-{
-	return vhc_virtdev_plug_generic(vhc, NULL, dev, handle, true, 0);
-}
-
-errno_t vhc_virtdev_plug_hub(vhc_data_t *vhc, usbvirt_device_t *dev,
-    uintptr_t *handle, usb_address_t address)
-{
-	return vhc_virtdev_plug_generic(vhc, NULL, dev, handle, false, address);
-}
-
-void vhc_virtdev_unplug(vhc_data_t *vhc, uintptr_t handle)
-{
-	vhc_virtdev_t *dev = (vhc_virtdev_t *) handle;
-
-	// FIXME: check status
-	(void) virthub_disconnect_device(&vhc->hub, dev);
-
-	fibril_mutex_lock(&vhc->guard);
-	fibril_mutex_lock(&dev->guard);
-	dev->plugged = false;
-	list_remove(&dev->link);
-	fibril_mutex_unlock(&dev->guard);
-	fibril_mutex_unlock(&vhc->guard);
-}
Index: pace/drv/bus/usb/vhc/hub/hub.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/hub.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,518 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief Representation of an USB hub (implementation).
- */
-#include <usb/classes/classes.h>
-#include <usbvirt/device.h>
-#include <errno.h>
-#include <str_error.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <ddf/driver.h>
-#include <usb/debug.h>
-
-#include "hub.h"
-
-/** Produce a byte from bit values.
- */
-#define MAKE_BYTE(b0, b1, b2, b3, b4, b5, b6, b7) \
-	(( \
-		((b0) << 0) \
-		| ((b1) << 1) \
-		| ((b2) << 2) \
-		| ((b3) << 3) \
-		| ((b4) << 4) \
-		| ((b5) << 5) \
-		| ((b6) << 6) \
-		| ((b7) << 7) \
-	))
-
-/* Static functions. */
-static hub_port_t *get_hub_port(hub_t *, size_t);
-static void set_port_status_change(hub_port_t *, hub_status_change_t);
-static void clear_port_status_change(hub_port_t *, uint16_t);
-static errno_t set_port_state_delayed_fibril(void *);
-static void set_port_state_delayed(hub_t *, size_t, usec_t, hub_port_state_t,
-    hub_port_state_t);
-
-/** Convert hub port state to a char. */
-char hub_port_state_to_char(hub_port_state_t state)
-{
-	switch (state) {
-	case HUB_PORT_STATE_NOT_CONFIGURED:
-		return '-';
-	case HUB_PORT_STATE_POWERED_OFF:
-		return 'O';
-	case HUB_PORT_STATE_DISCONNECTED:
-		return 'X';
-	case HUB_PORT_STATE_DISABLED:
-		return 'D';
-	case HUB_PORT_STATE_RESETTING:
-		return 'R';
-	case HUB_PORT_STATE_ENABLED:
-		return 'E';
-	case HUB_PORT_STATE_SUSPENDED:
-		return 'S';
-	case HUB_PORT_STATE_RESUMING:
-		return 'F';
-	default:
-		return '?';
-	}
-}
-
-/** Initialize single hub port.
- *
- * @param port Port to be initialized.
- * @param index Port index (one based).
- */
-static void hub_init_port(hub_port_t *port, hub_t *hub, size_t index)
-{
-	port->connected_device = NULL;
-	port->index = index;
-	port->state = HUB_PORT_STATE_NOT_CONFIGURED;
-	port->status_change = 0;
-	port->hub = hub;
-}
-
-/** Initialize the hub.
- *
- * @param hub Hub to be initialized.
- */
-void hub_init(hub_t *hub)
-{
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		hub_init_port(&hub->ports[i], hub, i + 1);
-	}
-	hub->custom_data = NULL;
-	hub->signal_changes = true;
-	fibril_mutex_initialize(&hub->guard);
-}
-
-/** Connect a device to the hub.
- *
- * @param hub Hub to connect device to.
- * @param device Device to be connected.
- * @return Index of port the device was connected to.
- * @retval -1 No free port available.
- */
-size_t hub_connect_device(hub_t *hub, void *device)
-{
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		hub_port_t *port = &hub->ports[i];
-
-		if (port->connected_device != NULL) {
-			continue;
-		}
-
-		port->connected_device = device;
-
-		/*
-		 * TODO:
-		 * If the hub was configured, we can normally
-		 * announce the plug-in.
-		 * Otherwise, we will wait until hub is configured
-		 * and announce changes in single burst.
-		 */
-		//if (port->state == HUB_PORT_STATE_DISCONNECTED) {
-		port->state = HUB_PORT_STATE_DISABLED;
-		set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
-		//}
-
-		return i;
-	}
-
-	return (size_t) -1;
-}
-
-/** Disconnects a device from a hub.
- *
- * @param hub Hub the device was connected to.
- * @param device Device to be disconnected.
- * @return Error code.
- */
-errno_t hub_disconnect_device(hub_t *hub, void *device)
-{
-	size_t index = hub_find_device(hub, device);
-	if (index == (size_t) -1) {
-		return ENOENT;
-	}
-
-	hub_port_t *port = &hub->ports[index];
-
-	port->connected_device = NULL;
-	port->state = HUB_PORT_STATE_DISCONNECTED;
-	set_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
-
-	return EOK;
-}
-
-/** Find port device is connected to.
- *
- * @param hub Hub in question.
- * @param device Device in question.
- * @return Port index (zero based).
- * @retval -1 Device is not connected.
- */
-size_t hub_find_device(hub_t *hub, void *device)
-{
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		hub_port_t *port = &hub->ports[i];
-
-		if (port->connected_device == device) {
-			return i;
-		}
-	}
-
-	return -1;
-}
-
-/** Acquire exclusive access to the hub.
- *
- * @param hub Hub in question.
- */
-void hub_acquire(hub_t *hub)
-{
-	fibril_mutex_lock(&hub->guard);
-}
-
-/** Give up exclusive access to the hub.
- *
- * @param hub Hub in question.
- */
-void hub_release(hub_t *hub)
-{
-	fibril_mutex_unlock(&hub->guard);
-}
-
-/** Change port state.
- *
- * @param hub Hub the port belongs to.
- * @param port_index Port index (zero based).
- * @param state New port state.
- */
-void hub_set_port_state(hub_t *hub, size_t port_index, hub_port_state_t state)
-{
-	hub_port_t *port = get_hub_port(hub, port_index);
-	if (port == NULL) {
-		return;
-	}
-
-	usb_log_debug("Setting port %zu to state %d.", port_index, state);
-
-	switch (state) {
-	case HUB_PORT_STATE_POWERED_OFF:
-		clear_port_status_change(port, HUB_STATUS_C_PORT_CONNECTION);
-		clear_port_status_change(port, HUB_STATUS_C_PORT_ENABLE);
-		clear_port_status_change(port, HUB_STATUS_C_PORT_RESET);
-		break;
-	case HUB_PORT_STATE_RESUMING:
-		port->state = state;
-		set_port_state_delayed(hub, port_index,
-		    10, state, HUB_PORT_STATE_ENABLED);
-		break;
-	case HUB_PORT_STATE_RESETTING:
-		port->state = state;
-		set_port_state_delayed(hub, port_index,
-		    10, state, HUB_PORT_STATE_ENABLED);
-		break;
-	case HUB_PORT_STATE_ENABLED:
-		if (port->state == HUB_PORT_STATE_RESETTING) {
-			set_port_status_change(port, HUB_STATUS_C_PORT_RESET);
-		}
-		break;
-	default:
-		break;
-	}
-
-	port->state = state;
-}
-
-/** Change state of all ports.
- *
- * @param hub Hub in question.
- * @param state New state for all ports.
- */
-void hub_set_port_state_all(hub_t *hub, hub_port_state_t state)
-{
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		hub_set_port_state(hub, i, state);
-	}
-}
-
-/** Get port state.
- *
- * @param hub Hub the port belongs to.
- * @param port_index Port index (zero based).
- * @return Port state.
- */
-hub_port_state_t hub_get_port_state(hub_t *hub, size_t port_index)
-{
-	hub_port_t *port = get_hub_port(hub, port_index);
-	if (port == NULL) {
-		return HUB_PORT_STATE_UNKNOWN;
-	}
-
-	return port->state;
-}
-
-/** Clear port status change bit.
- *
- * @param hub Hub the port belongs to.
- * @param port_index Port index (zero based).
- * @param change Change to be cleared.
- */
-void hub_clear_port_status_change(hub_t *hub, size_t port_index,
-    hub_status_change_t change)
-{
-	hub_port_t *port = get_hub_port(hub, port_index);
-	if (port == NULL) {
-		return;
-	}
-
-	clear_port_status_change(port, change);
-}
-
-/** Get port status change bits.
- *
- * @param hub Hub the port belongs to.
- * @param port_index Port index (zero based).
- * @return Port status change bitmap in standard format.
- */
-uint16_t hub_get_port_status_change(hub_t *hub, size_t port_index)
-{
-	hub_port_t *port = get_hub_port(hub, port_index);
-	if (port == NULL) {
-		return 0;
-	}
-
-	return port->status_change;
-}
-
-/** Get port status bits.
- *
- * @param hub Hub the port belongs to.
- * @param port_index Port index (zero based).
- * @return Port status bitmap in standard format.
- */
-uint32_t hub_get_port_status(hub_t *hub, size_t port_index)
-{
-	hub_port_t *port = get_hub_port(hub, port_index);
-	if (port == NULL) {
-		return 0;
-	}
-
-	uint32_t status = MAKE_BYTE(
-	    /* Current connect status. */
-	    port->connected_device == NULL ? 0 : 1,
-	    /* Port enabled/disabled. */
-	    port->state == HUB_PORT_STATE_ENABLED ? 1 : 0,
-	    /* Suspend. */
-	    (port->state == HUB_PORT_STATE_SUSPENDED) ||
-	    (port->state == HUB_PORT_STATE_RESUMING) ? 1 : 0,
-	    /* Over-current. */
-	    0,
-	    /* Reset. */
-	    port->state == HUB_PORT_STATE_RESETTING ? 1 : 0,
-	    /* Reserved. */
-	    0, 0, 0);
-
-	status |= MAKE_BYTE(
-	    /* Port power. */
-	    port->state == HUB_PORT_STATE_POWERED_OFF ? 0 : 1,
-	    /* Full-speed device. */
-	    0,
-	    /* Reserved. */
-	    0, 0, 0, 0, 0, 0) << 8;
-
-	status |= (port->status_change << 16);
-
-	return status;
-}
-
-/** Create hub status change bitmap.
- *
- * @warning This function assumes that the whole bitmap fits into 8 bits.
- *
- * @param hub Hub in question.
- * @return Hub status change bitmap.
- */
-uint8_t hub_get_status_change_bitmap(hub_t *hub)
-{
-	uint8_t change_map = 0;
-
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		hub_port_t *port = &hub->ports[i];
-
-		if (port->status_change != 0) {
-			change_map |= (1 << port->index);
-		}
-	}
-
-	return change_map;
-}
-
-/*
- *
- * STATIC (HELPER) FUNCTIONS
- *
- */
-
-/** Find a port in a hub.
- *
- * @param hub Hub in question.
- * @param port Port index (zero based).
- * @return Port structure.
- * @retval NULL Invalid port index.
- */
-static hub_port_t *get_hub_port(hub_t *hub, size_t port)
-{
-	if (port >= HUB_PORT_COUNT) {
-		return NULL;
-	}
-
-	return &hub->ports[port];
-}
-
-/** Adds a port status change to a port.
- *
- * @param port The port with status change.
- * @param change Change to be added to the status.
- */
-static void set_port_status_change(hub_port_t *port,
-    hub_status_change_t change)
-{
-	assert(port != NULL);
-	uint16_t old_value = port->status_change;
-	port->status_change |= change;
-	usb_log_debug("Changing status change on %zu: %04x => %04x",
-	    port->index,
-	    (unsigned int) old_value, (unsigned int) port->status_change);
-	port->hub->signal_changes = true;
-}
-
-/** Clears a port status change on a port.
- *
- * @param port The port with status change.
- * @param change Change to be removed from the status.
- */
-static void clear_port_status_change(hub_port_t *port,
-    uint16_t change)
-{
-	assert(port != NULL);
-	port->status_change &= (~change);
-	port->hub->signal_changes = true;
-}
-
-/** Structure for automatic (delayed) port state change. */
-struct delay_port_state_change {
-	/** Delay in microseconds. */
-	usec_t delay;
-	/** Old state of the port. */
-	hub_port_state_t old_state;
-	/** New state of the port. */
-	hub_port_state_t new_state;
-	/** Port index (zero based). */
-	size_t port;
-	/** Hub. */
-	hub_t *hub;
-};
-
-/** Fibril responsible for delayed port state change.
- *
- * @param arg Pointer to delay_port_state_change.
- * @return Always EOK.
- */
-static errno_t set_port_state_delayed_fibril(void *arg)
-{
-	struct delay_port_state_change *change =
-	    (struct delay_port_state_change *) arg;
-
-	fibril_usleep(change->delay);
-
-	hub_acquire(change->hub);
-
-	hub_port_t *port = get_hub_port(change->hub, change->port);
-	assert(port != NULL);
-
-	if (port->state == change->old_state) {
-		hub_set_port_state(change->hub, change->port,
-		    change->new_state);
-	}
-
-	hub_release(change->hub);
-
-	free(change);
-
-	return EOK;
-}
-
-/** Change port state with a delay.
- *
- * @warning If the port state changes during the waiting phase, the state
- * is not changed.
- *
- * @param hub Hub in question.
- * @param port_index Port index (zero based).
- * @param delay_time_ms Delay time in miliseconds.
- * @param old_state Old (current) state of the port.
- * @param new_state New state of the port.
- */
-static void set_port_state_delayed(hub_t *hub, size_t port_index,
-    usec_t delay_time_ms, hub_port_state_t old_state,
-    hub_port_state_t new_state)
-{
-	struct delay_port_state_change *change =
-	    malloc(sizeof(struct delay_port_state_change));
-
-	change->hub = hub;
-	change->port = port_index;
-	change->delay = MSEC2USEC(delay_time_ms);
-	change->old_state = old_state;
-	change->new_state = new_state;
-	fid_t fibril = fibril_create(set_port_state_delayed_fibril, change);
-	if (fibril == 0) {
-		usb_log_error("Failed to create fibril.");
-		free(change);
-		return;
-	}
-	fibril_add_ready(fibril);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/hub/hub.h
===================================================================
--- uspace/drv/bus/usb/vhc/hub/hub.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief Representation of an USB hub.
- */
-#ifndef VHC_HUB_HUB_H_
-#define VHC_HUB_HUB_H_
-
-#include <fibril_synch.h>
-
-#ifndef HUB_PORT_COUNT
-#define HUB_PORT_COUNT 2
-#endif
-#define BITS2BYTES(bits) (bits ? ((((bits)-1)>>3)+1) : 0)
-
-/** Hub port internal state.
- * Some states (e.g. port over current) are not covered as they are not
- * simulated at all.
- */
-typedef enum {
-	HUB_PORT_STATE_UNKNOWN,
-	HUB_PORT_STATE_NOT_CONFIGURED,
-	HUB_PORT_STATE_POWERED_OFF,
-	HUB_PORT_STATE_DISCONNECTED,
-	HUB_PORT_STATE_DISABLED,
-	HUB_PORT_STATE_RESETTING,
-	HUB_PORT_STATE_ENABLED,
-	HUB_PORT_STATE_SUSPENDED,
-	HUB_PORT_STATE_RESUMING,
-	/* HUB_PORT_STATE_, */
-} hub_port_state_t;
-
-char hub_port_state_to_char(hub_port_state_t);
-
-/** Hub status change mask bits. */
-typedef enum {
-	HUB_STATUS_C_PORT_CONNECTION = (1 << 0),
-	HUB_STATUS_C_PORT_ENABLE = (1 << 1),
-	HUB_STATUS_C_PORT_SUSPEND = (1 << 2),
-	HUB_STATUS_C_PORT_OVER_CURRENT = (1 << 3),
-	HUB_STATUS_C_PORT_RESET = (1 << 4),
-	/* HUB_STATUS_C_ = (1 << ), */
-} hub_status_change_t;
-
-typedef struct hub hub_t;
-
-/** Hub port information. */
-typedef struct {
-	/** Custom pointer to connected device. */
-	void *connected_device;
-	/** Port index (one based). */
-	size_t index;
-	/** Port state. */
-	hub_port_state_t state;
-	/** Status change bitmap. */
-	uint16_t status_change;
-	/** Containing hub. */
-	hub_t *hub;
-} hub_port_t;
-
-/** Hub device type. */
-struct hub {
-	/** Hub ports. */
-	hub_port_t ports[HUB_PORT_COUNT];
-	/** Custom hub data. */
-	void *custom_data;
-	/** Access guard to the whole hub. */
-	fibril_mutex_t guard;
-	/** Last value of status change bitmap. */
-	bool signal_changes;
-};
-
-void hub_init(hub_t *);
-size_t hub_connect_device(hub_t *, void *);
-errno_t hub_disconnect_device(hub_t *, void *);
-size_t hub_find_device(hub_t *, void *);
-void hub_acquire(hub_t *);
-void hub_release(hub_t *);
-void hub_set_port_state(hub_t *, size_t, hub_port_state_t);
-void hub_set_port_state_all(hub_t *, hub_port_state_t);
-hub_port_state_t hub_get_port_state(hub_t *, size_t);
-void hub_clear_port_status_change(hub_t *, size_t, hub_status_change_t);
-uint16_t hub_get_port_status_change(hub_t *, size_t);
-uint32_t hub_get_port_status(hub_t *, size_t);
-uint8_t hub_get_status_change_bitmap(hub_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/hub/virthub.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthub.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief
- */
-
-#include <usb/classes/classes.h>
-#include <usb/classes/hub.h>
-#include <usbvirt/device.h>
-#include <assert.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ddf/driver.h>
-
-#include "virthub.h"
-#include "hub.h"
-
-/** Standard device descriptor. */
-usb_standard_device_descriptor_t std_device_descriptor = {
-	.length = sizeof(usb_standard_device_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_DEVICE,
-	.usb_spec_version = 0x110,
-	.device_class = USB_CLASS_HUB,
-	.device_subclass = 0,
-	.device_protocol = 0,
-	.max_packet_size = 64,
-	.configuration_count = 1
-};
-
-/** Standard interface descriptor. */
-usb_standard_interface_descriptor_t std_interface_descriptor = {
-	.length = sizeof(usb_standard_interface_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_INTERFACE,
-	.interface_number = 0,
-	.alternate_setting = 0,
-	.endpoint_count = 1,
-	.interface_class = USB_CLASS_HUB,
-	.interface_subclass = 0,
-	.interface_protocol = 0,
-	.str_interface = 0
-};
-
-/** Hub descriptor. */
-hub_descriptor_t hub_descriptor = {
-	.length = sizeof(hub_descriptor_t),
-	.type = USB_DESCTYPE_HUB,
-	.port_count = HUB_PORT_COUNT,
-	.characteristics = HUB_CHAR_NO_POWER_SWITCH_FLAG | HUB_CHAR_NO_OC_FLAG,
-	.power_on_warm_up = 50, /* Huh? */
-	.max_current = 100, /* Huh again. */
-	.removable_device = { 0 },
-	.port_power = { 0xFF }
-};
-
-/** Endpoint descriptor. */
-usb_standard_endpoint_descriptor_t endpoint_descriptor = {
-	.length = sizeof(usb_standard_endpoint_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_ENDPOINT,
-	.endpoint_address = HUB_STATUS_CHANGE_PIPE | 128,
-	.attributes = USB_TRANSFER_INTERRUPT,
-	.max_packet_size = 8,
-	.poll_interval = 0xFF
-};
-
-/** Standard configuration descriptor. */
-usb_standard_configuration_descriptor_t std_configuration_descriptor = {
-	.length = sizeof(usb_standard_configuration_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_CONFIGURATION,
-	.total_length =
-	    sizeof(usb_standard_configuration_descriptor_t) +
-	    sizeof(std_interface_descriptor) +
-	    sizeof(hub_descriptor) +
-	    sizeof(endpoint_descriptor),
-	.interface_count = 1,
-	.configuration_number = HUB_CONFIGURATION_ID,
-	.str_configuration = 0,
-	.attributes = 128, /* denotes bus-powered device */
-	.max_power = 50
-};
-
-/** All hub configuration descriptors. */
-static usbvirt_device_configuration_extras_t extra_descriptors[] = {
-	{
-		.data = (uint8_t *) &std_interface_descriptor,
-		.length = sizeof(std_interface_descriptor)
-	},
-	{
-		.data = (uint8_t *) &hub_descriptor,
-		.length = sizeof(hub_descriptor)
-	},
-	{
-		.data = (uint8_t *) &endpoint_descriptor,
-		.length = sizeof(endpoint_descriptor)
-	}
-};
-
-/** Hub configuration. */
-usbvirt_device_configuration_t configuration = {
-	.descriptor = &std_configuration_descriptor,
-	.extra = extra_descriptors,
-	.extra_count = sizeof(extra_descriptors) / sizeof(extra_descriptors[0])
-};
-
-/** Hub standard descriptors. */
-usbvirt_descriptors_t descriptors = {
-	.device = &std_device_descriptor,
-	.configuration = &configuration,
-	.configuration_count = 1,
-};
-
-/** Initializes virtual hub device.
- *
- * @param dev Virtual USB device backend.
- * @return Error code.
- */
-errno_t virthub_init(usbvirt_device_t *dev, const char *name)
-{
-	if (dev == NULL) {
-		return EBADMEM;
-	}
-	dev->ops = &hub_ops;
-	dev->descriptors = &descriptors;
-	dev->address = 0;
-
-	char *n = str_dup(name);
-	if (!n)
-		return ENOMEM;
-
-	hub_t *hub = malloc(sizeof(hub_t));
-	if (hub == NULL) {
-		free(n);
-		return ENOMEM;
-	}
-
-	dev->name = n;
-	hub_init(hub);
-	dev->device_data = hub;
-
-	return EOK;
-}
-
-/** Connect a device to a virtual hub.
- *
- * @param dev Virtual device representing the hub.
- * @param conn Device to be connected.
- * @return Port device was connected to.
- */
-int virthub_connect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
-{
-	assert(dev != NULL);
-	assert(conn != NULL);
-
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-	size_t port = hub_connect_device(hub, conn);
-	hub_release(hub);
-
-	return port;
-}
-
-/** Disconnect a device from a virtual hub.
- *
- * @param dev Virtual device representing the hub.
- * @param conn Device to be disconnected.
- * @return Error code.
- */
-errno_t virthub_disconnect_device(usbvirt_device_t *dev, vhc_virtdev_t *conn)
-{
-	assert(dev != NULL);
-	assert(conn != NULL);
-
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-	hub_disconnect_device(hub, conn);
-	hub_release(hub);
-
-	return EOK;
-}
-
-/** Whether trafic is propagated to given device.
- *
- * @param dev Virtual device representing the hub.
- * @param conn Connected device.
- * @return Whether port is signalling to the device.
- */
-bool virthub_is_device_enabled(usbvirt_device_t *dev, vhc_virtdev_t *conn)
-{
-	assert(dev != NULL);
-	assert(conn != NULL);
-
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-
-	hub_port_state_t state = HUB_PORT_STATE_UNKNOWN;
-	size_t port = hub_find_device(hub, conn);
-	if (port != (size_t) -1) {
-		state = hub_get_port_state(hub, port);
-	}
-	hub_release(hub);
-
-	return state == HUB_PORT_STATE_ENABLED;
-}
-
-/** Format status of a virtual hub.
- *
- * @param dev Virtual device representing the hub.
- * @param[out] status Hub status information.
- * @param[in] len Size of the @p status buffer.
- */
-void virthub_get_status(usbvirt_device_t *dev, char *status, size_t len)
-{
-	assert(dev != NULL);
-	if (len == 0) {
-		return;
-	}
-
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	char port_status[HUB_PORT_COUNT + 1];
-
-	size_t i;
-	for (i = 0; i < HUB_PORT_COUNT; i++) {
-		port_status[i] = hub_port_state_to_char(
-		    hub_get_port_state(hub, i));
-	}
-	port_status[HUB_PORT_COUNT] = 0;
-
-	snprintf(status, len, "vhub:%s", port_status);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/hub/virthub.h
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthub.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief USB hub as a virtual USB device.
- */
-
-#ifndef VHC_HUB_VIRTHUB_H_
-#define VHC_HUB_VIRTHUB_H_
-
-#include <usbvirt/device.h>
-#include "hub.h"
-
-#ifdef STANDALONE_HUB
-#define virtdev_connection_t int
-#else
-#include "../vhcd.h"
-#endif
-
-/** Endpoint number for status change pipe. */
-#define HUB_STATUS_CHANGE_PIPE 1
-/** Configuration value for hub configuration. */
-#define HUB_CONFIGURATION_ID 1
-
-/** Hub descriptor.
- */
-typedef struct {
-	/** Size of this descriptor in bytes. */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_HUB). */
-	uint8_t type;
-	/** Number of downstream ports. */
-	uint8_t port_count;
-	/** Hub characteristics. */
-	uint16_t characteristics;
-	/** Time from power-on to stabilized current.
-	 * Expressed in 2ms unit.
-	 */
-	uint8_t power_on_warm_up;
-	/** Maximum current (in mA). */
-	uint8_t max_current;
-	/** Whether device at given port is removable. */
-	uint8_t removable_device[BITS2BYTES(HUB_PORT_COUNT + 1)];
-	/** Port power control.
-	 * This is USB1.0 compatibility field, all bits must be 1.
-	 */
-	uint8_t port_power[BITS2BYTES(HUB_PORT_COUNT + 1)];
-} __attribute__((packed)) hub_descriptor_t;
-
-extern usbvirt_device_ops_t hub_ops;
-extern hub_descriptor_t hub_descriptor;
-
-errno_t virthub_init(usbvirt_device_t *, const char *name);
-int virthub_connect_device(usbvirt_device_t *, vhc_virtdev_t *);
-errno_t virthub_disconnect_device(usbvirt_device_t *, vhc_virtdev_t *);
-bool virthub_is_device_enabled(usbvirt_device_t *, vhc_virtdev_t *);
-void virthub_get_status(usbvirt_device_t *, char *, size_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/hub/virthubops.c
===================================================================
--- uspace/drv/bus/usb/vhc/hub/virthubops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,417 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief Virtual USB hub operations.
- */
-
-#include <errno.h>
-#include <usb/classes/hub.h>
-#include <usbvirt/device.h>
-#include "virthub.h"
-#include "hub.h"
-
-/** Callback when device changes states. */
-static void on_state_change(usbvirt_device_t *dev,
-    usbvirt_device_state_t old_state, usbvirt_device_state_t new_state)
-{
-	hub_t *hub = (hub_t *)dev->device_data;
-
-	hub_acquire(hub);
-
-	switch (new_state) {
-	case USBVIRT_STATE_CONFIGURED:
-		hub_set_port_state_all(hub, HUB_PORT_STATE_POWERED_OFF);
-		break;
-	case USBVIRT_STATE_ADDRESS:
-		hub_set_port_state_all(hub, HUB_PORT_STATE_NOT_CONFIGURED);
-		break;
-	default:
-		break;
-	}
-
-	hub_release(hub);
-}
-
-/** Callback for data request. */
-static errno_t req_on_status_change_pipe(usbvirt_device_t *dev,
-    usb_endpoint_t endpoint, usb_transfer_type_t tr_type,
-    void *buffer, size_t buffer_size, size_t *actual_size)
-{
-	if (endpoint != HUB_STATUS_CHANGE_PIPE) {
-		return ESTALL;
-	}
-	if (tr_type != USB_TRANSFER_INTERRUPT) {
-		return ESTALL;
-	}
-
-	hub_t *hub = dev->device_data;
-
-	hub_acquire(hub);
-
-	if (!hub->signal_changes) {
-		hub_release(hub);
-
-		return ENAK;
-	}
-
-	uint8_t change_map = hub_get_status_change_bitmap(hub);
-
-	uint8_t *b = (uint8_t *) buffer;
-	if (buffer_size > 0) {
-		*b = change_map;
-		*actual_size = 1;
-	} else {
-		*actual_size = 0;
-	}
-
-	hub->signal_changes = false;
-
-	hub_release(hub);
-
-	return EOK;
-}
-
-/** Handle ClearHubFeature request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_clear_hub_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	return ENOTSUP;
-}
-
-/** Handle ClearPortFeature request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_clear_port_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	errno_t rc;
-	size_t port = request->index - 1;
-	usb_hub_class_feature_t feature = request->value;
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-
-	hub_port_state_t port_state = hub_get_port_state(hub, port);
-
-	switch (feature) {
-	case USB2_HUB_FEATURE_PORT_ENABLE:
-		if ((port_state != HUB_PORT_STATE_NOT_CONFIGURED) &&
-		    (port_state != HUB_PORT_STATE_POWERED_OFF)) {
-			hub_set_port_state(hub, port, HUB_PORT_STATE_DISABLED);
-		}
-		rc = EOK;
-		break;
-
-	case USB2_HUB_FEATURE_PORT_SUSPEND:
-		if (port_state != HUB_PORT_STATE_SUSPENDED) {
-			rc = EOK;
-			break;
-		}
-		hub_set_port_state(hub, port, HUB_PORT_STATE_RESUMING);
-		rc = EOK;
-		break;
-
-	case USB_HUB_FEATURE_PORT_POWER:
-		if (port_state != HUB_PORT_STATE_NOT_CONFIGURED) {
-			hub_set_port_state(hub, port, HUB_PORT_STATE_POWERED_OFF);
-		}
-		rc = EOK;
-		break;
-
-	case USB_HUB_FEATURE_C_PORT_CONNECTION:
-		hub_clear_port_status_change(hub, port, HUB_STATUS_C_PORT_CONNECTION);
-		rc = EOK;
-		break;
-
-	case USB2_HUB_FEATURE_C_PORT_ENABLE:
-		hub_clear_port_status_change(hub, port, HUB_STATUS_C_PORT_ENABLE);
-		rc = EOK;
-		break;
-
-	case USB2_HUB_FEATURE_C_PORT_SUSPEND:
-		hub_clear_port_status_change(hub, port, HUB_STATUS_C_PORT_SUSPEND);
-		rc = EOK;
-		break;
-
-	case USB_HUB_FEATURE_C_PORT_OVER_CURRENT:
-		hub_clear_port_status_change(hub, port, HUB_STATUS_C_PORT_OVER_CURRENT);
-		rc = EOK;
-		break;
-
-	case USB_HUB_FEATURE_C_PORT_RESET:
-		hub_clear_port_status_change(hub, port, HUB_STATUS_C_PORT_RESET);
-		rc = EOK;
-		break;
-
-	default:
-		rc = ENOTSUP;
-		break;
-	}
-
-	hub_release(hub);
-
-	return rc;
-}
-
-/** Handle GetBusState request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_get_bus_state(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	return ENOTSUP;
-}
-
-/** Handle GetDescriptor request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_get_descriptor(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	if (request->value_high == USB_DESCTYPE_HUB) {
-		usbvirt_control_reply_helper(request, data, act_size,
-		    &hub_descriptor, hub_descriptor.length);
-
-		return EOK;
-	}
-	/* Let the framework handle all the rest. */
-	return EFORWARD;
-}
-
-/** Handle GetHubStatus request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_get_hub_status(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	uint32_t hub_status = 0;
-
-	usbvirt_control_reply_helper(request, data, act_size,
-	    &hub_status, sizeof(hub_status));
-
-	return EOK;
-}
-
-/** Handle GetPortStatus request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_get_port_status(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-
-	uint32_t status = hub_get_port_status(hub, request->index - 1);
-
-	hub_release(hub);
-
-	usbvirt_control_reply_helper(request, data, act_size,
-	    &status, sizeof(status));
-
-	return EOK;
-}
-
-/** Handle SetHubFeature request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_set_hub_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	return ENOTSUP;
-}
-
-/** Handle SetPortFeature request.
- *
- * @param dev Virtual device representing the hub.
- * @param request The SETUP packet of the control request.
- * @param data Extra data (when DATA stage present).
- * @return Error code.
- */
-static errno_t req_set_port_feature(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	errno_t rc = ENOTSUP;
-	size_t port = request->index - 1;
-	usb_hub_class_feature_t feature = request->value;
-	hub_t *hub = (hub_t *) dev->device_data;
-
-	hub_acquire(hub);
-
-	hub_port_state_t port_state = hub_get_port_state(hub, port);
-
-	switch (feature) {
-	case USB_HUB_FEATURE_PORT_RESET:
-		if (port_state != HUB_PORT_STATE_POWERED_OFF) {
-			hub_set_port_state(hub, port, HUB_PORT_STATE_RESETTING);
-		}
-		rc = EOK;
-		break;
-
-	case USB2_HUB_FEATURE_PORT_SUSPEND:
-		if (port_state == HUB_PORT_STATE_ENABLED) {
-			hub_set_port_state(hub, port, HUB_PORT_STATE_SUSPENDED);
-		}
-		rc = EOK;
-		break;
-
-	case USB_HUB_FEATURE_PORT_POWER:
-		if (port_state == HUB_PORT_STATE_POWERED_OFF) {
-			hub_set_port_state(hub, port, HUB_PORT_STATE_DISCONNECTED);
-		}
-		rc = EOK;
-		break;
-
-	default:
-		break;
-	}
-
-	hub_release(hub);
-
-	return rc;
-}
-
-/** Recipient: other. */
-#define REC_OTHER USB_REQUEST_RECIPIENT_OTHER
-/** Recipient: device. */
-#define REC_DEVICE USB_REQUEST_RECIPIENT_DEVICE
-
-/** Hub operations on control endpoint zero. */
-static usbvirt_control_request_handler_t endpoint_zero_handlers[] = {
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetStdDescriptor",
-		.callback = req_get_descriptor
-	},
-	{
-		CLASS_REQ_IN(REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetClassDescriptor",
-		.callback = req_get_descriptor
-	},
-	{
-		CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status
-	},
-	{
-		CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearHubFeature",
-		.callback = req_clear_hub_feature
-	},
-	{
-		CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
-		.name = "ClearPortFeature",
-		.callback = req_clear_port_feature
-	},
-	{
-		CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATE),
-		.name = "GetBusState",
-		.callback = req_get_bus_state
-	},
-	{
-		CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
-		.name = "GetHubDescriptor",
-		.callback = req_get_descriptor
-	},
-	{
-		CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetHubStatus",
-		.callback = req_get_hub_status
-	},
-	{
-		CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
-		.name = "GetPortStatus",
-		.callback = req_get_port_status
-	},
-	{
-		CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetHubFeature",
-		.callback = req_set_hub_feature
-	},
-	{
-		CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),
-		.name = "SetPortFeature",
-		.callback = req_set_port_feature
-	},
-	{
-		.callback = NULL
-	}
-};
-
-/** Hub operations. */
-usbvirt_device_ops_t hub_ops = {
-	.control = endpoint_zero_handlers,
-	.data_in[HUB_STATUS_CHANGE_PIPE] = req_on_status_change_pipe,
-	.state_changed = on_state_change,
-};
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/main.c
===================================================================
--- uspace/drv/bus/usb/vhc/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * Virtual host controller.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-
-#include <usb/host/ddf_helpers.h>
-#include <usb/host/utility.h>
-
-#include <usb/debug.h>
-#include "vhcd.h"
-
-static ddf_dev_ops_t vhc_ops = {
-	.close = on_client_close,
-	.default_handler = default_connection_handler
-};
-
-static errno_t vhc_control_node(ddf_dev_t *dev, ddf_fun_t **fun)
-{
-	assert(dev);
-	assert(fun);
-
-	*fun = ddf_fun_create(dev, fun_exposed, "virtual");
-	if (!*fun)
-		return ENOMEM;
-
-	vhc_data_t *vhc = ddf_fun_data_alloc(*fun, sizeof(vhc_data_t));
-	if (!vhc) {
-		ddf_fun_destroy(*fun);
-	}
-	ddf_fun_set_ops(*fun, &vhc_ops);
-	const errno_t ret = ddf_fun_bind(*fun);
-	if (ret != EOK) {
-		ddf_fun_destroy(*fun);
-		*fun = NULL;
-		return ret;
-	}
-	return EOK;
-}
-
-static errno_t vhc_dev_add(ddf_dev_t *dev)
-{
-	/* Initialize generic structures */
-	errno_t ret = hcd_ddf_setup_hc(dev, sizeof(vhc_data_t));
-	if (ret != EOK) {
-		usb_log_error("Failed to init HCD structures: %s.",
-		    str_error(ret));
-		return ret;
-	}
-	vhc_data_t *vhc = ddf_dev_data_get(dev);
-	vhc_init(vhc);
-
-	hc_device_setup(&vhc->base, (bus_t *) &vhc->bus);
-
-	/* Initialize virtual structure */
-	ddf_fun_t *ctl_fun = NULL;
-	ret = vhc_control_node(dev, &ctl_fun);
-	if (ret != EOK) {
-		usb_log_error("Failed to setup control node.");
-		return ret;
-	}
-
-	/* Add virtual hub device */
-	ret = vhc_virtdev_plug_hub(vhc, &vhc->hub, NULL, 0);
-	if (ret != EOK) {
-		usb_log_error("Failed to plug root hub: %s.", str_error(ret));
-		ddf_fun_destroy(ctl_fun);
-		return ret;
-	}
-
-	/*
-	 * Creating root hub registers a new USB device so HC
-	 * needs to be ready at this time.
-	 */
-	ret = hc_setup_virtual_root_hub(&vhc->base, USB_SPEED_HIGH);
-	if (ret != EOK) {
-		usb_log_error("Failed to init VHC root hub: %s",
-		    str_error(ret));
-		// TODO do something here...
-	}
-
-	return ret;
-}
-
-static driver_ops_t vhc_driver_ops = {
-	.dev_add = vhc_dev_add,
-};
-
-static driver_t vhc_driver = {
-	.name = NAME,
-	.driver_ops = &vhc_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-	printf(NAME ": virtual USB host controller driver.\n");
-
-	return ddf_driver_main(&vhc_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/vhc/meson.build
===================================================================
--- uspace/drv/bus/usb/vhc/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usbhost', 'usbvirt', 'usb' ]
-src = files(
-	'hub/virthub.c',
-	'hub/hub.c',
-	'hub/virthubops.c',
-	'conndev.c',
-	'devconn.c',
-	'main.c',
-	'transfer.c',
-)
Index: pace/drv/bus/usb/vhc/transfer.c
===================================================================
--- uspace/drv/bus/usb/vhc/transfer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,305 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usbvirt/device.h>
-#include <usb/host/bandwidth.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usbvirt/ipc.h>
-#include "vhcd.h"
-#include "hub/virthub.h"
-
-static bool is_set_address_transfer(vhc_transfer_t *transfer)
-{
-	if (transfer->batch.target.endpoint != 0) {
-		return false;
-	}
-	if (transfer->batch.ep->transfer_type != USB_TRANSFER_CONTROL) {
-		return false;
-	}
-	if (transfer->batch.dir != USB_DIRECTION_OUT) {
-		return false;
-	}
-	const usb_device_request_setup_packet_t *setup =
-	    &transfer->batch.setup.packet;
-	if (setup->request_type != 0) {
-		return false;
-	}
-	if (setup->request != USB_DEVREQ_SET_ADDRESS) {
-		return false;
-	}
-
-	return true;
-}
-
-static errno_t process_transfer_local(usb_transfer_batch_t *batch,
-    usbvirt_device_t *dev, size_t *actual_data_size)
-{
-	errno_t rc;
-
-	const usb_direction_t dir = batch->dir;
-
-	if (batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
-		if (dir == USB_DIRECTION_IN) {
-			rc = usbvirt_control_read(dev,
-			    batch->setup.buffer, USB_SETUP_PACKET_SIZE,
-			    batch->dma_buffer.virt, batch->size,
-			    actual_data_size);
-		} else {
-			assert(dir == USB_DIRECTION_OUT);
-			rc = usbvirt_control_write(dev,
-			    batch->setup.buffer, USB_SETUP_PACKET_SIZE,
-			    batch->dma_buffer.virt, batch->size);
-		}
-	} else {
-		if (dir == USB_DIRECTION_IN) {
-			rc = usbvirt_data_in(dev, batch->ep->transfer_type,
-			    batch->ep->endpoint,
-			    batch->dma_buffer.virt, batch->size,
-			    actual_data_size);
-		} else {
-			assert(dir == USB_DIRECTION_OUT);
-			rc = usbvirt_data_out(dev, batch->ep->transfer_type,
-			    batch->ep->endpoint,
-			    batch->dma_buffer.virt, batch->size);
-		}
-	}
-
-	return rc;
-}
-
-static errno_t process_transfer_remote(usb_transfer_batch_t *batch,
-    async_sess_t *sess, size_t *actual_data_size)
-{
-	errno_t rc;
-
-	const usb_direction_t dir = batch->dir;
-
-	if (batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
-		if (dir == USB_DIRECTION_IN) {
-			rc = usbvirt_ipc_send_control_read(sess,
-			    batch->setup.buffer, USB_SETUP_PACKET_SIZE,
-			    batch->dma_buffer.virt, batch->size,
-			    actual_data_size);
-		} else {
-			assert(dir == USB_DIRECTION_OUT);
-			rc = usbvirt_ipc_send_control_write(sess,
-			    batch->setup.buffer, USB_SETUP_PACKET_SIZE,
-			    batch->dma_buffer.virt, batch->size);
-		}
-	} else {
-		if (dir == USB_DIRECTION_IN) {
-			rc = usbvirt_ipc_send_data_in(sess, batch->ep->endpoint,
-			    batch->ep->transfer_type,
-			    batch->dma_buffer.virt, batch->size,
-			    actual_data_size);
-		} else {
-			assert(dir == USB_DIRECTION_OUT);
-			rc = usbvirt_ipc_send_data_out(sess, batch->ep->endpoint,
-			    batch->ep->transfer_type,
-			    batch->dma_buffer.virt, batch->size);
-		}
-	}
-
-	return rc;
-}
-
-static vhc_transfer_t *dequeue_first_transfer(vhc_virtdev_t *dev)
-{
-	assert(fibril_mutex_is_locked(&dev->guard));
-	assert(!list_empty(&dev->transfer_queue));
-
-	vhc_transfer_t *transfer =
-	    list_get_instance(list_first(&dev->transfer_queue),
-	    vhc_transfer_t, link);
-	list_remove(&transfer->link);
-
-	return transfer;
-}
-
-static void execute_transfer_callback_and_free(vhc_transfer_t *transfer,
-    size_t data_transfer_size, errno_t outcome)
-{
-	assert(outcome != ENAK);
-	assert(transfer);
-	transfer->batch.error = outcome;
-	transfer->batch.transferred_size = data_transfer_size;
-	usb_transfer_batch_finish(&transfer->batch);
-}
-
-static usb_transfer_batch_t *batch_create(endpoint_t *ep)
-{
-	vhc_transfer_t *transfer = calloc(1, sizeof(vhc_transfer_t));
-	usb_transfer_batch_init(&transfer->batch, ep);
-	link_initialize(&transfer->link);
-	return &transfer->batch;
-}
-
-static int device_enumerate(device_t *device)
-{
-	vhc_data_t *vhc = bus_to_vhc(device->bus);
-	return usb2_bus_device_enumerate(&vhc->bus_helper, device);
-}
-
-static int endpoint_register(endpoint_t *endpoint)
-{
-	vhc_data_t *vhc = bus_to_vhc(endpoint->device->bus);
-	return usb2_bus_endpoint_register(&vhc->bus_helper, endpoint);
-}
-
-static void endpoint_unregister(endpoint_t *endpoint)
-{
-	vhc_data_t *vhc = bus_to_vhc(endpoint->device->bus);
-	usb2_bus_endpoint_unregister(&vhc->bus_helper, endpoint);
-
-	// TODO: abort transfer?
-}
-
-static const bus_ops_t vhc_bus_ops = {
-	.batch_create = batch_create,
-	.batch_schedule = vhc_schedule,
-
-	.device_enumerate = device_enumerate,
-	.endpoint_register = endpoint_register,
-	.endpoint_unregister = endpoint_unregister,
-};
-
-errno_t vhc_init(vhc_data_t *instance)
-{
-	assert(instance);
-	list_initialize(&instance->devices);
-	fibril_mutex_initialize(&instance->guard);
-	bus_init(&instance->bus, sizeof(device_t));
-	usb2_bus_helper_init(&instance->bus_helper, &bandwidth_accounting_usb11);
-	instance->bus.ops = &vhc_bus_ops;
-	return virthub_init(&instance->hub, "root hub");
-}
-
-errno_t vhc_schedule(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-	vhc_transfer_t *transfer = (vhc_transfer_t *) batch;
-	vhc_data_t *vhc = bus_to_vhc(endpoint_get_bus(batch->ep));
-	assert(vhc);
-
-	fibril_mutex_lock(&vhc->guard);
-
-	int targets = 0;
-
-	list_foreach(vhc->devices, link, vhc_virtdev_t, dev) {
-		fibril_mutex_lock(&dev->guard);
-		if (dev->address == transfer->batch.target.address) {
-			if (!targets) {
-				list_append(&transfer->link, &dev->transfer_queue);
-			}
-			++targets;
-		}
-		fibril_mutex_unlock(&dev->guard);
-	}
-
-	fibril_mutex_unlock(&vhc->guard);
-
-	if (targets > 1)
-		usb_log_warning("Transfer would be accepted by more devices!");
-
-	return targets ? EOK : ENOENT;
-}
-
-errno_t vhc_transfer_queue_processor(void *arg)
-{
-	vhc_virtdev_t *dev = arg;
-	fibril_mutex_lock(&dev->guard);
-	while (dev->plugged) {
-		if (list_empty(&dev->transfer_queue)) {
-			fibril_mutex_unlock(&dev->guard);
-			fibril_usleep(10 * 1000);
-			fibril_mutex_lock(&dev->guard);
-			continue;
-		}
-
-		vhc_transfer_t *transfer = dequeue_first_transfer(dev);
-		fibril_mutex_unlock(&dev->guard);
-
-		errno_t rc = EOK;
-		size_t data_transfer_size = 0;
-		if (dev->dev_sess) {
-			rc = process_transfer_remote(&transfer->batch,
-			    dev->dev_sess, &data_transfer_size);
-		} else if (dev->dev_local != NULL) {
-			rc = process_transfer_local(&transfer->batch,
-			    dev->dev_local, &data_transfer_size);
-		} else {
-			usb_log_warning("Device has no remote phone "
-			    "nor local node.");
-			rc = ESTALL;
-		}
-
-		usb_log_debug2("Transfer %p processed: %s.",
-		    transfer, str_error(rc));
-
-		fibril_mutex_lock(&dev->guard);
-		if (rc == EOK) {
-			if (is_set_address_transfer(transfer)) {
-				usb_device_request_setup_packet_t *setup =
-				    (void *) transfer->batch.setup.buffer;
-				dev->address = setup->value;
-				usb_log_debug2("Address changed to %d",
-				    dev->address);
-			}
-		}
-		if (rc == ENAK) {
-			// FIXME: this will work only because we do
-			// not NAK control transfers but this is generally
-			// a VERY bad idea indeed
-			list_append(&transfer->link, &dev->transfer_queue);
-		}
-		fibril_mutex_unlock(&dev->guard);
-
-		if (rc != ENAK) {
-			execute_transfer_callback_and_free(transfer,
-			    data_transfer_size, rc);
-		}
-
-		fibril_usleep(1000 * 100);
-		fibril_mutex_lock(&dev->guard);
-	}
-
-	/* Immediately fail all remaining transfers. */
-	while (!list_empty(&dev->transfer_queue)) {
-		vhc_transfer_t *transfer = dequeue_first_transfer(dev);
-		execute_transfer_callback_and_free(transfer, 0, EBADCHECKSUM);
-	}
-
-	fibril_mutex_unlock(&dev->guard);
-
-	return EOK;
-}
Index: pace/drv/bus/usb/vhc/vhc.ma
===================================================================
--- uspace/drv/bus/usb/vhc/vhc.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 usb&hc=vhc
Index: pace/drv/bus/usb/vhc/vhcd.h
===================================================================
--- uspace/drv/bus/usb/vhc/vhcd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbvhc
- * @{
- */
-/** @file
- * @brief Virtual USB host controller common definitions.
- */
-
-#ifndef VHCD_VHCD_H_
-#define VHCD_VHCD_H_
-
-#include <usbvirt/device.h>
-#include <async.h>
-#include <macros.h>
-#include <member.h>
-
-#include <usb/host/hcd.h>
-#include <usb/host/usb2_bus.h>
-#include <usb/host/usb_transfer_batch.h>
-
-#define NAME "vhc"
-
-typedef struct {
-	link_t link;
-	async_sess_t *dev_sess;
-	usbvirt_device_t *dev_local;
-	bool plugged;
-	usb_address_t address;
-	fibril_mutex_t guard;
-	list_t transfer_queue;
-} vhc_virtdev_t;
-
-typedef struct {
-	hc_device_t base;
-
-	bus_t bus;
-	usb2_bus_helper_t bus_helper;
-
-	ddf_fun_t *virtual_fun;
-	list_t devices;
-	fibril_mutex_t guard;
-	usbvirt_device_t hub;
-} vhc_data_t;
-
-typedef struct {
-	usb_transfer_batch_t batch;
-	link_t link;
-} vhc_transfer_t;
-
-static inline vhc_data_t *hcd_to_vhc(hc_device_t *hcd)
-{
-	assert(hcd);
-	return (vhc_data_t *) hcd;
-}
-
-static inline vhc_data_t *bus_to_vhc(bus_t *bus)
-{
-	assert(bus);
-	return member_to_inst(bus, vhc_data_t, bus);
-}
-
-void on_client_close(ddf_fun_t *fun);
-void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall);
-
-errno_t vhc_virtdev_plug(vhc_data_t *, async_sess_t *, uintptr_t *);
-errno_t vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
-errno_t vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *,
-    usb_address_t address);
-void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
-
-errno_t vhc_init(vhc_data_t *);
-errno_t vhc_schedule(usb_transfer_batch_t *);
-errno_t vhc_transfer_queue_processor(void *arg);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/bus.c
===================================================================
--- uspace/drv/bus/usb/xhci/bus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- * xHCI bus interface.
- */
-
-#include <usb/descriptor.h>
-
-#include "hc.h"
-#include "device.h"
-#include "endpoint.h"
-#include "transfers.h"
-
-#include "bus.h"
-
-static const bus_ops_t xhci_bus_ops = {
-	.interrupt = hc_interrupt,
-	.status = hc_status,
-
-	.device_enumerate = xhci_device_enumerate,
-	.device_gone = xhci_device_gone,
-	.device_online = xhci_device_online,
-	.device_offline = xhci_device_offline,
-
-	.endpoint_create = xhci_endpoint_create,
-	.endpoint_destroy = xhci_endpoint_destroy,
-	.endpoint_register = xhci_endpoint_register,
-	.endpoint_unregister = xhci_endpoint_unregister,
-
-	.batch_schedule = xhci_transfer_schedule,
-	.batch_create = xhci_transfer_create,
-	.batch_destroy = xhci_transfer_destroy,
-};
-
-/** Initialize XHCI bus.
- * @param[in] bus Allocated XHCI bus to initialize.
- * @param[in] hc Associated host controller, which manages the bus.
- *
- * @return Error code.
- */
-errno_t xhci_bus_init(xhci_bus_t *bus, xhci_hc_t *hc)
-{
-	assert(bus);
-
-	bus_init(&bus->base, sizeof(xhci_device_t));
-
-	bus->devices_by_slot = calloc(hc->max_slots, sizeof(xhci_device_t *));
-	if (!bus->devices_by_slot)
-		return ENOMEM;
-
-	bus->hc = hc;
-	bus->base.ops = &xhci_bus_ops;
-	return EOK;
-}
-
-/** Finalize XHCI bus.
- * @param[in] bus XHCI bus to finalize.
- */
-void xhci_bus_fini(xhci_bus_t *bus)
-{
-	// FIXME: Ensure there are no more devices?
-	free(bus->devices_by_slot);
-	// FIXME: Something else we forgot?
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/bus.h
===================================================================
--- uspace/drv/bus/usb/xhci/bus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * An implementation of bus keeper for xHCI. The (physical) HC itself takes
- * care about addressing devices, so this implementation is actually simpler
- * than those of [OUE]HCI.
- */
-#ifndef XHCI_BUS_H
-#define XHCI_BUS_H
-
-#include <usb/host/bus.h>
-
-typedef struct xhci_hc xhci_hc_t;
-typedef struct xhci_device xhci_device_t;
-
-/** Endpoint management structure */
-typedef struct xhci_bus {
-	bus_t base; /**< Inheritance. Keep this first. */
-	xhci_hc_t *hc; /**< Pointer to managing HC (to issue commands) */
-	xhci_device_t **devices_by_slot; /**< Devices by Slot ID */
-} xhci_bus_t;
-
-extern errno_t xhci_bus_init(xhci_bus_t *, xhci_hc_t *);
-extern void xhci_bus_fini(xhci_bus_t *);
-
-static inline xhci_bus_t *bus_to_xhci_bus(bus_t *bus_base)
-{
-	assert(bus_base);
-	return (xhci_bus_t *) bus_base;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/commands.c
===================================================================
--- uspace/drv/bus/usb/xhci/commands.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,839 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak, Ondrej Hlavaty, Petr Manek, Michal Staruch, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief Command sending functions.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include "commands.h"
-#include "debug.h"
-#include "hc.h"
-#include "hw_struct/context.h"
-#include "hw_struct/trb.h"
-
-#define TRB_SET_TSP(trb, tsp)   (trb).control |= host2xhci(32, (((tsp) & 0x1) << 9))
-#define TRB_SET_TYPE(trb, type) (trb).control |= host2xhci(32, (type) << 10)
-#define TRB_SET_DC(trb, dc)     (trb).control |= host2xhci(32, (dc) << 9)
-#define TRB_SET_EP(trb, ep)     (trb).control |= host2xhci(32, ((ep) & 0x5) << 16)
-#define TRB_SET_STREAM(trb, st) (trb).control |= host2xhci(32, ((st) & 0xFFFF) << 16)
-#define TRB_SET_SUSP(trb, susp) (trb).control |= host2xhci(32, ((susp) & 0x1) << 23)
-#define TRB_SET_SLOT(trb, slot) (trb).control |= host2xhci(32, (slot) << 24)
-#define TRB_SET_DEV_SPEED(trb, speed)	(trb).control |= host2xhci(32, (speed & 0xF) << 16)
-#define TRB_SET_DEQUEUE_PTR(trb, dptr) (trb).parameter |= host2xhci(64, (dptr))
-#define TRB_SET_ICTX(trb, phys) (trb).parameter |= host2xhci(64, (phys) & (~0xF))
-
-#define TRB_GET_CODE(trb) XHCI_DWORD_EXTRACT((trb).status, 31, 24)
-#define TRB_GET_SLOT(trb) XHCI_DWORD_EXTRACT((trb).control, 31, 24)
-#define TRB_GET_PHYS(trb) (XHCI_QWORD_EXTRACT((trb).parameter, 63, 4) << 4)
-
-/* Control functions */
-
-static xhci_cmd_ring_t *get_cmd_ring(xhci_hc_t *hc)
-{
-	assert(hc);
-	return &hc->cr;
-}
-
-/**
- * Initialize the command subsystem. Allocates the comand ring.
- *
- * Does not configure the CR pointer to the hardware, because the xHC will be
- * reset before starting.
- */
-errno_t xhci_init_commands(xhci_hc_t *hc)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	errno_t err;
-
-	if ((err = xhci_trb_ring_init(&cr->trb_ring, 0)))
-		return err;
-
-	fibril_mutex_initialize(&cr->guard);
-	fibril_condvar_initialize(&cr->state_cv);
-	fibril_condvar_initialize(&cr->stopped_cv);
-
-	list_initialize(&cr->cmd_list);
-
-	return EOK;
-}
-
-/**
- * Finish the command subsystem. Stops the hardware from running commands, then
- * deallocates the ring.
- */
-void xhci_fini_commands(xhci_hc_t *hc)
-{
-	assert(hc);
-	xhci_stop_command_ring(hc);
-
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-
-	fibril_mutex_lock(&cr->guard);
-	xhci_trb_ring_fini(&cr->trb_ring);
-	fibril_mutex_unlock(&cr->guard);
-}
-
-/**
- * Initialize a command structure for the given command.
- */
-void xhci_cmd_init(xhci_cmd_t *cmd, xhci_cmd_type_t type)
-{
-	memset(cmd, 0, sizeof(*cmd));
-
-	link_initialize(&cmd->_header.link);
-
-	fibril_mutex_initialize(&cmd->_header.completed_mtx);
-	fibril_condvar_initialize(&cmd->_header.completed_cv);
-
-	cmd->_header.cmd = type;
-}
-
-/**
- * Finish the command structure. Some command invocation includes allocating
- * a context structure. To have the convenience in calling commands, this
- * method deallocates all resources.
- */
-void xhci_cmd_fini(xhci_cmd_t *cmd)
-{
-	list_remove(&cmd->_header.link);
-
-	dma_buffer_free(&cmd->input_ctx);
-	dma_buffer_free(&cmd->bandwidth_ctx);
-
-	if (cmd->_header.async) {
-		free(cmd);
-	}
-}
-
-/**
- * Find a command issued by TRB at @c phys inside the command list.
- *
- * Call with guard locked only.
- */
-static inline xhci_cmd_t *find_command(xhci_hc_t *hc, uint64_t phys)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	assert(fibril_mutex_is_locked(&cr->guard));
-
-	link_t *cmd_link = list_first(&cr->cmd_list);
-
-	while (cmd_link != NULL) {
-		xhci_cmd_t *cmd = list_get_instance(cmd_link, xhci_cmd_t,
-		    _header.link);
-
-		if (cmd->_header.trb_phys == phys)
-			break;
-
-		cmd_link = list_next(cmd_link, &cr->cmd_list);
-	}
-
-	return cmd_link ?
-	    list_get_instance(cmd_link, xhci_cmd_t, _header.link) :
-	    NULL;
-}
-
-static void cr_set_state(xhci_cmd_ring_t *cr, xhci_cr_state_t state)
-{
-	assert(fibril_mutex_is_locked(&cr->guard));
-
-	cr->state = state;
-	if (state == XHCI_CR_STATE_OPEN || state == XHCI_CR_STATE_CLOSED)
-		fibril_condvar_broadcast(&cr->state_cv);
-}
-
-static errno_t wait_for_ring_open(xhci_cmd_ring_t *cr)
-{
-	assert(fibril_mutex_is_locked(&cr->guard));
-
-	while (true) {
-		switch (cr->state) {
-		case XHCI_CR_STATE_CHANGING:
-		case XHCI_CR_STATE_FULL:
-			fibril_condvar_wait(&cr->state_cv, &cr->guard);
-			break;
-		case XHCI_CR_STATE_OPEN:
-			return EOK;
-		case XHCI_CR_STATE_CLOSED:
-			return ENAK;
-		}
-	}
-}
-
-/**
- * Enqueue a command on the TRB ring. Ring the doorbell to initiate processing.
- * Register the command as waiting for completion inside the command list.
- */
-static inline errno_t enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	assert(cmd);
-
-	fibril_mutex_lock(&cr->guard);
-
-	if (wait_for_ring_open(cr)) {
-		fibril_mutex_unlock(&cr->guard);
-		return ENAK;
-	}
-
-	usb_log_debug("Sending command %s",
-	    xhci_trb_str_type(TRB_TYPE(cmd->_header.trb)));
-
-	list_append(&cmd->_header.link, &cr->cmd_list);
-
-	errno_t err = EOK;
-	while (err == EOK) {
-		err = xhci_trb_ring_enqueue(&cr->trb_ring,
-		    &cmd->_header.trb, &cmd->_header.trb_phys);
-		if (err != EAGAIN)
-			break;
-
-		cr_set_state(cr, XHCI_CR_STATE_FULL);
-		err = wait_for_ring_open(cr);
-	}
-
-	if (err == EOK)
-		hc_ring_doorbell(hc, 0, 0);
-
-	fibril_mutex_unlock(&cr->guard);
-
-	return err;
-}
-
-/**
- * Stop the command ring. Stop processing commands, block issuing new ones.
- * Wait until hardware acknowledges it is stopped.
- */
-void xhci_stop_command_ring(xhci_hc_t *hc)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-
-	fibril_mutex_lock(&cr->guard);
-
-	// Prevent others from starting CR again.
-	cr_set_state(cr, XHCI_CR_STATE_CLOSED);
-
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_CS, 1);
-
-	while (XHCI_REG_RD(hc->op_regs, XHCI_OP_CRR))
-		fibril_condvar_wait(&cr->stopped_cv, &cr->guard);
-
-	fibril_mutex_unlock(&cr->guard);
-}
-
-/**
- * Mark the command ring as stopped. NAK new commands, abort running, do not
- * touch the HC as it's probably broken.
- */
-void xhci_nuke_command_ring(xhci_hc_t *hc)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	fibril_mutex_lock(&cr->guard);
-	// Prevent others from starting CR again.
-	cr_set_state(cr, XHCI_CR_STATE_CLOSED);
-
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_CS, 1);
-	fibril_mutex_unlock(&cr->guard);
-}
-
-/**
- * Mark the command ring as working again.
- */
-void xhci_start_command_ring(xhci_hc_t *hc)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	fibril_mutex_lock(&cr->guard);
-	// Prevent others from starting CR again.
-	cr_set_state(cr, XHCI_CR_STATE_OPEN);
-	fibril_mutex_unlock(&cr->guard);
-}
-
-/**
- * Abort currently processed command. Note that it is only aborted when the
- * command is "blocking" - see section 4.6.1.2 of xHCI spec.
- */
-static void abort_command_ring(xhci_hc_t *hc)
-{
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_CA, 1);
-}
-
-static const char *trb_codes [] = {
-#define TRBC(t) [XHCI_TRBC_##t] = #t
-	TRBC(INVALID),
-	TRBC(SUCCESS),
-	TRBC(DATA_BUFFER_ERROR),
-	TRBC(BABBLE_DETECTED_ERROR),
-	TRBC(USB_TRANSACTION_ERROR),
-	TRBC(TRB_ERROR),
-	TRBC(STALL_ERROR),
-	TRBC(RESOURCE_ERROR),
-	TRBC(BANDWIDTH_ERROR),
-	TRBC(NO_SLOTS_ERROR),
-	TRBC(INVALID_STREAM_ERROR),
-	TRBC(SLOT_NOT_ENABLED_ERROR),
-	TRBC(EP_NOT_ENABLED_ERROR),
-	TRBC(SHORT_PACKET),
-	TRBC(RING_UNDERRUN),
-	TRBC(RING_OVERRUN),
-	TRBC(VF_EVENT_RING_FULL),
-	TRBC(PARAMETER_ERROR),
-	TRBC(BANDWIDTH_OVERRUN_ERROR),
-	TRBC(CONTEXT_STATE_ERROR),
-	TRBC(NO_PING_RESPONSE_ERROR),
-	TRBC(EVENT_RING_FULL_ERROR),
-	TRBC(INCOMPATIBLE_DEVICE_ERROR),
-	TRBC(MISSED_SERVICE_ERROR),
-	TRBC(COMMAND_RING_STOPPED),
-	TRBC(COMMAND_ABORTED),
-	TRBC(STOPPED),
-	TRBC(STOPPED_LENGTH_INVALID),
-	TRBC(STOPPED_SHORT_PACKET),
-	TRBC(MAX_EXIT_LATENCY_TOO_LARGE_ERROR),
-	[30] = "<reserved>",
-	TRBC(ISOCH_BUFFER_OVERRUN),
-	TRBC(EVENT_LOST_ERROR),
-	TRBC(UNDEFINED_ERROR),
-	TRBC(INVALID_STREAM_ID_ERROR),
-	TRBC(SECONDARY_BANDWIDTH_ERROR),
-	TRBC(SPLIT_TRANSACTION_ERROR),
-	[XHCI_TRBC_MAX] = NULL
-#undef TRBC
-};
-
-/**
- * Report an error according to command completion code.
- */
-static void report_error(int code)
-{
-	if (code < XHCI_TRBC_MAX && trb_codes[code] != NULL)
-		usb_log_error("Command resulted in error: %s.", trb_codes[code]);
-	else
-		usb_log_error("Command resulted in reserved or "
-		    "vendor specific error.");
-}
-
-/**
- * Handle a command completion. Feed the fibril waiting for result.
- *
- * @param trb The COMMAND_COMPLETION TRB found in event ring.
- */
-errno_t xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	assert(trb);
-
-	fibril_mutex_lock(&cr->guard);
-
-	int code = TRB_GET_CODE(*trb);
-
-	if (code == XHCI_TRBC_COMMAND_RING_STOPPED) {
-		/*
-		 * This can either mean that the ring is being stopped, or
-		 * a command was aborted. In either way, wake threads waiting
-		 * on stopped_cv.
-		 *
-		 * Note that we need to hold mutex, because we must be sure the
-		 * requesting thread is waiting inside the CV.
-		 */
-		usb_log_debug("Command ring stopped.");
-		fibril_condvar_broadcast(&cr->stopped_cv);
-		fibril_mutex_unlock(&cr->guard);
-		return EOK;
-	}
-
-	const uint64_t phys = TRB_GET_PHYS(*trb);
-	xhci_trb_ring_update_dequeue(&cr->trb_ring, phys);
-
-	if (cr->state == XHCI_CR_STATE_FULL)
-		cr_set_state(cr, XHCI_CR_STATE_OPEN);
-
-	xhci_cmd_t *command = find_command(hc, phys);
-	if (command == NULL) {
-		usb_log_error("No command struct for completion event found.");
-
-		if (code != XHCI_TRBC_SUCCESS)
-			report_error(code);
-
-		return EOK;
-	}
-
-	list_remove(&command->_header.link);
-
-	/* Semantics of NO_OP_CMD is that success is marked as a TRB error. */
-	if (command->_header.cmd == XHCI_CMD_NO_OP && code == XHCI_TRBC_TRB_ERROR)
-		code = XHCI_TRBC_SUCCESS;
-
-	command->status = code;
-	command->slot_id = TRB_GET_SLOT(*trb);
-
-	usb_log_debug("Completed command %s",
-	    xhci_trb_str_type(TRB_TYPE(command->_header.trb)));
-
-	if (code != XHCI_TRBC_SUCCESS) {
-		report_error(code);
-		xhci_dump_trb(&command->_header.trb);
-	}
-
-	fibril_mutex_unlock(&cr->guard);
-
-	fibril_mutex_lock(&command->_header.completed_mtx);
-	command->_header.completed = true;
-	fibril_condvar_broadcast(&command->_header.completed_cv);
-	fibril_mutex_unlock(&command->_header.completed_mtx);
-
-	if (command->_header.async) {
-		/* Free the command and other DS upon completion. */
-		xhci_cmd_fini(command);
-	}
-
-	return EOK;
-}
-
-/* Command-issuing functions */
-
-static errno_t no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_NO_OP_CMD);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_ENABLE_SLOT_CMD);
-	cmd->_header.trb.control |=
-	    host2xhci(32, XHCI_REG_RD(hc->xecp, XHCI_EC_SP_SLOT_TYPE) << 16);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_DISABLE_SLOT_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-	assert(dma_buffer_is_set(&cmd->input_ctx));
-
-	/**
-	 * TODO: Requirements for this command:
-	 *           dcbaa[slot_id] is properly sized and initialized
-	 *           ictx has valids slot context and endpoint 0, all
-	 *           other should be ignored at this point (see section 4.6.5).
-	 */
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	const uintptr_t phys = dma_buffer_phys_base(&cmd->input_ctx);
-	TRB_SET_ICTX(cmd->_header.trb, phys);
-
-	/**
-	 * Note: According to section 6.4.3.4, we can set the 9th bit
-	 *       of the control field of the trb (BSR) to 1 and then the xHC
-	 *       will not issue the SET_ADDRESS request to the USB device.
-	 *       This can be used to provide compatibility with legacy USB devices
-	 *       that require their device descriptor to be read before such request.
-	 */
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_ADDRESS_DEVICE_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	if (!cmd->deconfigure) {
-		/* If the DC flag is on, input context is not evaluated. */
-		assert(dma_buffer_is_set(&cmd->input_ctx));
-
-		const uintptr_t phys = dma_buffer_phys_base(&cmd->input_ctx);
-		TRB_SET_ICTX(cmd->_header.trb, phys);
-	}
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_CONFIGURE_ENDPOINT_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-	TRB_SET_DC(cmd->_header.trb, cmd->deconfigure);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-	assert(dma_buffer_is_set(&cmd->input_ctx));
-
-	/**
-	 * Note: All Drop Context flags of the input context shall be 0,
-	 *       all Add Context flags shall be initialize to indicate IDs
-	 *       of the contexts affected by the command.
-	 *       Refer to sections 6.2.2.3 and 6.3.3.3 for further info.
-	 */
-	xhci_trb_clean(&cmd->_header.trb);
-
-	const uintptr_t phys = dma_buffer_phys_base(&cmd->input_ctx);
-	TRB_SET_ICTX(cmd->_header.trb, phys);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_EVALUATE_CONTEXT_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_RESET_ENDPOINT_CMD);
-	TRB_SET_TSP(cmd->_header.trb, cmd->tsp);
-	TRB_SET_EP(cmd->_header.trb, cmd->endpoint_id);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_STOP_ENDPOINT_CMD);
-	TRB_SET_EP(cmd->_header.trb, cmd->endpoint_id);
-	TRB_SET_SUSP(cmd->_header.trb, cmd->susp);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_SET_TR_DEQUEUE_POINTER_CMD);
-	TRB_SET_EP(cmd->_header.trb, cmd->endpoint_id);
-	TRB_SET_STREAM(cmd->_header.trb, cmd->stream_id);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-	TRB_SET_DEQUEUE_PTR(cmd->_header.trb, cmd->dequeue_ptr);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_RESET_DEVICE_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-
-	return enqueue_command(hc, cmd);
-}
-
-static errno_t get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	xhci_trb_clean(&cmd->_header.trb);
-
-	const uintptr_t phys = dma_buffer_phys_base(&cmd->input_ctx);
-	TRB_SET_ICTX(cmd->_header.trb, phys);
-
-	TRB_SET_TYPE(cmd->_header.trb, XHCI_TRB_TYPE_GET_PORT_BANDWIDTH_CMD);
-	TRB_SET_SLOT(cmd->_header.trb, cmd->slot_id);
-	TRB_SET_DEV_SPEED(cmd->_header.trb, cmd->device_speed);
-
-	return enqueue_command(hc, cmd);
-}
-
-/* The table of command-issuing functions. */
-
-typedef errno_t (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);
-
-static cmd_handler cmd_handlers [] = {
-	[XHCI_CMD_ENABLE_SLOT] = enable_slot_cmd,
-	[XHCI_CMD_DISABLE_SLOT] = disable_slot_cmd,
-	[XHCI_CMD_ADDRESS_DEVICE] = address_device_cmd,
-	[XHCI_CMD_CONFIGURE_ENDPOINT] = configure_endpoint_cmd,
-	[XHCI_CMD_EVALUATE_CONTEXT] = evaluate_context_cmd,
-	[XHCI_CMD_RESET_ENDPOINT] = reset_endpoint_cmd,
-	[XHCI_CMD_STOP_ENDPOINT] = stop_endpoint_cmd,
-	[XHCI_CMD_SET_TR_DEQUEUE_POINTER] = set_tr_dequeue_pointer_cmd,
-	[XHCI_CMD_RESET_DEVICE] = reset_device_cmd,
-	[XHCI_CMD_FORCE_EVENT] = NULL,
-	[XHCI_CMD_NEGOTIATE_BANDWIDTH] = NULL,
-	[XHCI_CMD_SET_LATENCY_TOLERANCE_VALUE] = NULL,
-	[XHCI_CMD_GET_PORT_BANDWIDTH] = get_port_bandwidth_cmd,
-	[XHCI_CMD_FORCE_HEADER] = NULL,
-	[XHCI_CMD_NO_OP] = no_op_cmd
-};
-
-/**
- * Try to abort currently processed command. This is tricky, because
- * calling fibril is not necessarily the one which issued the blocked command.
- * Also, the trickiness intensifies by the fact that stopping a CR is denoted by
- * event, which is again handled in different fibril. but, once we go to sleep
- * on waiting for that event, another fibril may wake up and try to abort the
- * blocked command.
- *
- * So, we mark the command ring as being restarted, wait for it to stop, and
- * then start it again. If there was a blocked command, it will be satisfied by
- * COMMAND_ABORTED event.
- */
-static errno_t try_abort_current_command(xhci_hc_t *hc)
-{
-	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-
-	fibril_mutex_lock(&cr->guard);
-
-	if (cr->state == XHCI_CR_STATE_CLOSED) {
-		fibril_mutex_unlock(&cr->guard);
-		return ENAK;
-	}
-
-	if (cr->state == XHCI_CR_STATE_CHANGING) {
-		fibril_mutex_unlock(&cr->guard);
-		return EOK;
-	}
-
-	usb_log_error("Timeout while waiting for command: "
-	    "aborting current command.");
-
-	cr_set_state(cr, XHCI_CR_STATE_CHANGING);
-
-	abort_command_ring(hc);
-
-	fibril_condvar_wait_timeout(&cr->stopped_cv, &cr->guard,
-	    XHCI_CR_ABORT_TIMEOUT);
-
-	if (XHCI_REG_RD(hc->op_regs, XHCI_OP_CRR)) {
-		/*
-		 * 4.6.1.2, implementation note
-		 * Assume there are larger problems with HC and
-		 * reset it.
-		 */
-		usb_log_error("Command didn't abort.");
-
-		cr_set_state(cr, XHCI_CR_STATE_CLOSED);
-
-		// TODO: Reset HC completely.
-		// Don't forget to somehow complete all commands with error.
-
-		fibril_mutex_unlock(&cr->guard);
-		return ENAK;
-	}
-
-	cr_set_state(cr, XHCI_CR_STATE_OPEN);
-
-	fibril_mutex_unlock(&cr->guard);
-
-	usb_log_error("Command ring stopped. Starting again.");
-	hc_ring_doorbell(hc, 0, 0);
-
-	return EOK;
-}
-
-/**
- * Wait, until the command is completed. The completion is triggered by
- * COMMAND_COMPLETION event. As we do not want to rely on HW completing the
- * command in timely manner, we timeout. Note that we can't just return an
- * error after the timeout pass - it may be other command blocking the ring,
- * and ours can be completed afterwards. Therefore, it is not guaranteed that
- * this function will return in XHCI_COMMAND_TIMEOUT. It will continue waiting
- * until COMMAND_COMPLETION event arrives.
- */
-static errno_t wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	errno_t rv = EOK;
-
-	if (fibril_get_id() == hc->event_handler) {
-		usb_log_error("Deadlock detected in waiting for command.");
-		abort();
-	}
-
-	fibril_mutex_lock(&cmd->_header.completed_mtx);
-	while (!cmd->_header.completed) {
-
-		rv = fibril_condvar_wait_timeout(&cmd->_header.completed_cv,
-		    &cmd->_header.completed_mtx, XHCI_COMMAND_TIMEOUT);
-
-		/*
-		 * The waiting timed out. Current command (not necessarily
-		 * ours) is probably blocked.
-		 */
-		if (!cmd->_header.completed && rv == ETIMEOUT) {
-			fibril_mutex_unlock(&cmd->_header.completed_mtx);
-
-			rv = try_abort_current_command(hc);
-			if (rv)
-				return rv;
-
-			fibril_mutex_lock(&cmd->_header.completed_mtx);
-		}
-	}
-	fibril_mutex_unlock(&cmd->_header.completed_mtx);
-
-	return rv;
-}
-
-/**
- * Issue command and block the current fibril until it is completed or timeout
- * expires. Nothing is deallocated. Caller should always execute `xhci_cmd_fini`.
- */
-errno_t xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	errno_t err;
-
-	if (!cmd_handlers[cmd->_header.cmd]) {
-		/* Handler not implemented. */
-		return ENOTSUP;
-	}
-
-	if ((err = cmd_handlers[cmd->_header.cmd](hc, cmd))) {
-		/* Command could not be issued. */
-		return err;
-	}
-
-	if ((err = wait_for_cmd_completion(hc, cmd))) {
-		/* Command failed. */
-		return err;
-	}
-
-	switch (cmd->status) {
-	case XHCI_TRBC_SUCCESS:
-		return EOK;
-	case XHCI_TRBC_USB_TRANSACTION_ERROR:
-		return ESTALL;
-	case XHCI_TRBC_RESOURCE_ERROR:
-	case XHCI_TRBC_BANDWIDTH_ERROR:
-	case XHCI_TRBC_NO_SLOTS_ERROR:
-		return ELIMIT;
-	case XHCI_TRBC_SLOT_NOT_ENABLED_ERROR:
-		return ENOENT;
-	default:
-		return EINVAL;
-	}
-}
-
-/**
- * Does the same thing as `xhci_cmd_sync` and executes `xhci_cmd_fini`. This
- * is a useful shorthand for issuing commands without out parameters.
- */
-errno_t xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	const errno_t err = xhci_cmd_sync(hc, cmd);
-	xhci_cmd_fini(cmd);
-
-	return err;
-}
-
-/**
- * Does the same thing as `xhci_cmd_sync_fini` without blocking the current
- * fibril. The command is copied to stack memory and `fini` is called upon its completion.
- */
-errno_t xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)
-{
-	assert(hc);
-	assert(stack_cmd);
-
-	/* Save the command for later. */
-	xhci_cmd_t *heap_cmd = (xhci_cmd_t *) malloc(sizeof(xhci_cmd_t));
-	if (!heap_cmd) {
-		return ENOMEM;
-	}
-
-	/* TODO: Is this good for the mutex and the condvar? */
-	memcpy(heap_cmd, stack_cmd, sizeof(xhci_cmd_t));
-	heap_cmd->_header.async = true;
-
-	/* Issue the command. */
-	errno_t err;
-
-	if (!cmd_handlers[heap_cmd->_header.cmd]) {
-		/* Handler not implemented. */
-		err = ENOTSUP;
-		goto err_heap_cmd;
-	}
-
-	if ((err = cmd_handlers[heap_cmd->_header.cmd](hc, heap_cmd))) {
-		/* Command could not be issued. */
-		goto err_heap_cmd;
-	}
-
-	return EOK;
-
-err_heap_cmd:
-	free(heap_cmd);
-	return err;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/commands.h
===================================================================
--- uspace/drv/bus/usb/xhci/commands.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak, Petr Manek, Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Utility functions used to place TRBs onto the command ring.
- */
-
-#ifndef XHCI_COMMANDS_H
-#define XHCI_COMMANDS_H
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <usb/dma_buffer.h>
-#include "hw_struct/trb.h"
-#include "trb_ring.h"
-
-#define XHCI_COMMAND_TIMEOUT       10000000
-#define XHCI_CR_ABORT_TIMEOUT       5000000
-
-typedef struct xhci_hc xhci_hc_t;
-typedef struct xhci_input_ctx xhci_input_ctx_t;
-typedef struct xhci_port_bandwidth_ctx xhci_port_bandwidth_ctx_t;
-
-typedef enum xhci_cmd_type {
-	XHCI_CMD_ENABLE_SLOT,
-	XHCI_CMD_DISABLE_SLOT,
-	XHCI_CMD_ADDRESS_DEVICE,
-	XHCI_CMD_CONFIGURE_ENDPOINT,
-	XHCI_CMD_EVALUATE_CONTEXT,
-	XHCI_CMD_RESET_ENDPOINT,
-	XHCI_CMD_STOP_ENDPOINT,
-	XHCI_CMD_SET_TR_DEQUEUE_POINTER,
-	XHCI_CMD_RESET_DEVICE,
-	XHCI_CMD_FORCE_EVENT,
-	XHCI_CMD_NEGOTIATE_BANDWIDTH,
-	XHCI_CMD_SET_LATENCY_TOLERANCE_VALUE,
-	XHCI_CMD_GET_PORT_BANDWIDTH,
-	XHCI_CMD_FORCE_HEADER,
-	XHCI_CMD_NO_OP,
-} xhci_cmd_type_t;
-
-typedef enum {
-	XHCI_CR_STATE_CLOSED,	/**< Commands are rejected with ENAK. */
-	XHCI_CR_STATE_OPEN,	/**< Commands are enqueued normally. */
-	XHCI_CR_STATE_CHANGING,	/**< Commands wait until state changes. */
-	XHCI_CR_STATE_FULL,	/**< Commands wait until something completes. */
-} xhci_cr_state_t;
-
-typedef struct xhci_command_ring {
-	xhci_trb_ring_t trb_ring;
-
-	/** Guard access to this structure. */
-	fibril_mutex_t guard;
-	list_t cmd_list;
-
-	/** Whether commands are allowed to be added. */
-	xhci_cr_state_t state;
-	/** For waiting on CR state change. */
-	fibril_condvar_t state_cv;
-
-	/** For waiting on CR stopped event. */
-	fibril_condvar_t stopped_cv;
-} xhci_cmd_ring_t;
-
-typedef struct xhci_command {
-	/** Internal fields used for bookkeeping. Need not worry about these. */
-	struct {
-		link_t link;
-
-		xhci_cmd_type_t cmd;
-
-		xhci_trb_t trb;
-		uintptr_t trb_phys;
-
-		bool async;
-		bool completed;
-
-		/* Will broadcast after command completes. */
-		fibril_mutex_t completed_mtx;
-		fibril_condvar_t completed_cv;
-	} _header;
-
-	/** Below are arguments of all commands mixed together.
-	 *  Be sure to know which command accepts what arguments.
-	 */
-
-	uint32_t slot_id;
-	uint32_t endpoint_id;
-	uint16_t stream_id;
-
-	dma_buffer_t input_ctx, bandwidth_ctx;
-	uintptr_t dequeue_ptr;
-
-	bool tsp;
-	uint8_t susp;
-	uint8_t device_speed;
-	uint32_t status;
-	bool deconfigure;
-} xhci_cmd_t;
-
-/* Command handling control */
-extern errno_t xhci_init_commands(xhci_hc_t *);
-extern void xhci_fini_commands(xhci_hc_t *);
-
-extern void xhci_nuke_command_ring(xhci_hc_t *);
-extern void xhci_stop_command_ring(xhci_hc_t *);
-extern void xhci_abort_command_ring(xhci_hc_t *);
-extern void xhci_start_command_ring(xhci_hc_t *);
-
-extern errno_t xhci_handle_command_completion(xhci_hc_t *, xhci_trb_t *);
-
-/* Command lifecycle */
-extern void xhci_cmd_init(xhci_cmd_t *, xhci_cmd_type_t);
-extern void xhci_cmd_fini(xhci_cmd_t *);
-
-/* Issuing commands */
-extern errno_t xhci_cmd_sync(xhci_hc_t *, xhci_cmd_t *);
-extern errno_t xhci_cmd_sync_fini(xhci_hc_t *, xhci_cmd_t *);
-extern errno_t xhci_cmd_async_fini(xhci_hc_t *, xhci_cmd_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/debug.c
===================================================================
--- uspace/drv/bus/usb/xhci/debug.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,412 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Various functions to examine current state of the xHC.
- */
-
-#include <inttypes.h>
-#include <byteorder.h>
-#include <usb/debug.h>
-
-#include "hw_struct/trb.h"
-#include "debug.h"
-#include "hc.h"
-
-#define PX "\t%-21s = "
-
-#define DUMP_REG_FIELD(ptr, title, size, ...) \
-	usb_log_debug(PX "%" PRIu##size, title, XHCI_REG_RD_FIELD(ptr, size, ##__VA_ARGS__))
-
-#define DUMP_REG_RANGE(ptr, title, size, ...) \
-	usb_log_debug(PX "%" PRIu##size, title, XHCI_REG_RD_RANGE(ptr, size, ##__VA_ARGS__))
-
-#define DUMP_REG_FLAG(ptr, title, size, ...) \
-	usb_log_debug(PX "%s", title, XHCI_REG_RD_FLAG(ptr, size, ##__VA_ARGS__) ? "true" : "false")
-
-#define DUMP_REG_INNER(set, title, field, size, type, ...) \
-	DUMP_REG_##type(&(set)->field, title, size, ##__VA_ARGS__)
-
-#define DUMP_REG(set, c) DUMP_REG_INNER(set, #c, c)
-
-/**
- * Dumps all capability registers.
- */
-void xhci_dump_cap_regs(const xhci_cap_regs_t *cap)
-{
-	usb_log_debug("Capabilities:");
-
-	DUMP_REG(cap, XHCI_CAP_LENGTH);
-	DUMP_REG(cap, XHCI_CAP_VERSION);
-	DUMP_REG(cap, XHCI_CAP_MAX_SLOTS);
-	DUMP_REG(cap, XHCI_CAP_MAX_INTRS);
-	DUMP_REG(cap, XHCI_CAP_MAX_PORTS);
-	DUMP_REG(cap, XHCI_CAP_IST);
-	DUMP_REG(cap, XHCI_CAP_ERST_MAX);
-	usb_log_debug(PX "%u", "Max Scratchpad bufs", xhci_get_max_spbuf(cap));
-	DUMP_REG(cap, XHCI_CAP_SPR);
-	DUMP_REG(cap, XHCI_CAP_U1EL);
-	DUMP_REG(cap, XHCI_CAP_U2EL);
-	DUMP_REG(cap, XHCI_CAP_AC64);
-	DUMP_REG(cap, XHCI_CAP_BNC);
-	DUMP_REG(cap, XHCI_CAP_CSZ);
-	DUMP_REG(cap, XHCI_CAP_PPC);
-	DUMP_REG(cap, XHCI_CAP_PIND);
-	DUMP_REG(cap, XHCI_CAP_C);
-	DUMP_REG(cap, XHCI_CAP_LTC);
-	DUMP_REG(cap, XHCI_CAP_NSS);
-	DUMP_REG(cap, XHCI_CAP_PAE);
-	DUMP_REG(cap, XHCI_CAP_SPC);
-	DUMP_REG(cap, XHCI_CAP_SEC);
-	DUMP_REG(cap, XHCI_CAP_CFC);
-	DUMP_REG(cap, XHCI_CAP_MAX_PSA_SIZE);
-	DUMP_REG(cap, XHCI_CAP_XECP);
-	DUMP_REG(cap, XHCI_CAP_DBOFF);
-	DUMP_REG(cap, XHCI_CAP_RTSOFF);
-	DUMP_REG(cap, XHCI_CAP_U3C);
-	DUMP_REG(cap, XHCI_CAP_CMC);
-	DUMP_REG(cap, XHCI_CAP_FSC);
-	DUMP_REG(cap, XHCI_CAP_CTC);
-	DUMP_REG(cap, XHCI_CAP_LEC);
-	DUMP_REG(cap, XHCI_CAP_CIC);
-}
-
-/**
- * Dumps registers of one port.
- */
-void xhci_dump_port(const xhci_port_regs_t *port)
-{
-	DUMP_REG(port, XHCI_PORT_CCS);
-	DUMP_REG(port, XHCI_PORT_PED);
-	DUMP_REG(port, XHCI_PORT_OCA);
-	DUMP_REG(port, XHCI_PORT_PR);
-	DUMP_REG(port, XHCI_PORT_PLS);
-	DUMP_REG(port, XHCI_PORT_PP);
-	DUMP_REG(port, XHCI_PORT_PS);
-	DUMP_REG(port, XHCI_PORT_PIC);
-	DUMP_REG(port, XHCI_PORT_LWS);
-	DUMP_REG(port, XHCI_PORT_CSC);
-	DUMP_REG(port, XHCI_PORT_PEC);
-	DUMP_REG(port, XHCI_PORT_WRC);
-	DUMP_REG(port, XHCI_PORT_OCC);
-	DUMP_REG(port, XHCI_PORT_PRC);
-	DUMP_REG(port, XHCI_PORT_PLC);
-	DUMP_REG(port, XHCI_PORT_CEC);
-	DUMP_REG(port, XHCI_PORT_CAS);
-	DUMP_REG(port, XHCI_PORT_WCE);
-	DUMP_REG(port, XHCI_PORT_WDE);
-	DUMP_REG(port, XHCI_PORT_WOE);
-	DUMP_REG(port, XHCI_PORT_DR);
-	DUMP_REG(port, XHCI_PORT_WPR);
-	DUMP_REG(port, XHCI_PORT_USB3_U1TO);
-	DUMP_REG(port, XHCI_PORT_USB3_U2TO);
-	DUMP_REG(port, XHCI_PORT_USB3_FLPMA);
-	DUMP_REG(port, XHCI_PORT_USB3_LEC);
-	DUMP_REG(port, XHCI_PORT_USB3_RLC);
-	DUMP_REG(port, XHCI_PORT_USB3_TLC);
-	DUMP_REG(port, XHCI_PORT_USB2_L1S);
-	DUMP_REG(port, XHCI_PORT_USB2_RWE);
-	DUMP_REG(port, XHCI_PORT_USB2_BESL);
-	DUMP_REG(port, XHCI_PORT_USB2_L1DS);
-	DUMP_REG(port, XHCI_PORT_USB2_HLE);
-	DUMP_REG(port, XHCI_PORT_USB2_TM);
-	DUMP_REG(port, XHCI_PORT_USB2_HIRDM);
-	DUMP_REG(port, XHCI_PORT_USB2_L1TO);
-	DUMP_REG(port, XHCI_PORT_USB2_BESLD);
-}
-
-/**
- * Dumps all registers that define state of the HC.
- */
-void xhci_dump_state(const xhci_hc_t *hc)
-{
-	usb_log_debug("Operational registers:");
-
-	DUMP_REG(hc->op_regs, XHCI_OP_RS);
-	DUMP_REG(hc->op_regs, XHCI_OP_HCRST);
-	DUMP_REG(hc->op_regs, XHCI_OP_INTE);
-	DUMP_REG(hc->op_regs, XHCI_OP_HSEE);
-	DUMP_REG(hc->op_regs, XHCI_OP_LHCRST);
-	DUMP_REG(hc->op_regs, XHCI_OP_CSS);
-	DUMP_REG(hc->op_regs, XHCI_OP_CRS);
-	DUMP_REG(hc->op_regs, XHCI_OP_EWE);
-	DUMP_REG(hc->op_regs, XHCI_OP_EU3S);
-	DUMP_REG(hc->op_regs, XHCI_OP_CME);
-	DUMP_REG(hc->op_regs, XHCI_OP_HCH);
-	DUMP_REG(hc->op_regs, XHCI_OP_HSE);
-	DUMP_REG(hc->op_regs, XHCI_OP_EINT);
-	DUMP_REG(hc->op_regs, XHCI_OP_PCD);
-	DUMP_REG(hc->op_regs, XHCI_OP_SSS);
-	DUMP_REG(hc->op_regs, XHCI_OP_RSS);
-	DUMP_REG(hc->op_regs, XHCI_OP_SRE);
-	DUMP_REG(hc->op_regs, XHCI_OP_CNR);
-	DUMP_REG(hc->op_regs, XHCI_OP_HCE);
-	DUMP_REG(hc->op_regs, XHCI_OP_PAGESIZE);
-	DUMP_REG(hc->op_regs, XHCI_OP_NOTIFICATION);
-	DUMP_REG(hc->op_regs, XHCI_OP_RCS);
-	DUMP_REG(hc->op_regs, XHCI_OP_CS);
-	DUMP_REG(hc->op_regs, XHCI_OP_CA);
-	DUMP_REG(hc->op_regs, XHCI_OP_CRR);
-	DUMP_REG(hc->op_regs, XHCI_OP_CRCR);
-	DUMP_REG(hc->op_regs, XHCI_OP_DCBAAP);
-	DUMP_REG(hc->rt_regs, XHCI_RT_MFINDEX);
-
-	usb_log_debug("Interrupter 0 state:");
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IP);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IE);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMI);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMC);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTSZ);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTBA);
-	DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERDP);
-}
-
-/**
- * Dump registers of all ports.
- */
-void xhci_dump_ports(const xhci_hc_t *hc)
-{
-	const size_t num_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
-	for (size_t i = 0; i < num_ports; i++) {
-		usb_log_debug("Port %zu state:", i);
-
-		xhci_dump_port(&hc->op_regs->portrs[i]);
-	}
-}
-
-static const char *trb_types [] = {
-	[0] = "<empty>",
-#define TRB(t) [XHCI_TRB_TYPE_##t] = #t
-	TRB(NORMAL),
-	TRB(SETUP_STAGE),
-	TRB(DATA_STAGE),
-	TRB(STATUS_STAGE),
-	TRB(ISOCH),
-	TRB(LINK),
-	TRB(EVENT_DATA),
-	TRB(NO_OP),
-	TRB(ENABLE_SLOT_CMD),
-	TRB(DISABLE_SLOT_CMD),
-	TRB(ADDRESS_DEVICE_CMD),
-	TRB(CONFIGURE_ENDPOINT_CMD),
-	TRB(EVALUATE_CONTEXT_CMD),
-	TRB(RESET_ENDPOINT_CMD),
-	TRB(STOP_ENDPOINT_CMD),
-	TRB(SET_TR_DEQUEUE_POINTER_CMD),
-	TRB(RESET_DEVICE_CMD),
-	TRB(FORCE_EVENT_CMD),
-	TRB(NEGOTIATE_BANDWIDTH_CMD),
-	TRB(SET_LATENCY_TOLERANCE_VALUE_CMD),
-	TRB(GET_PORT_BANDWIDTH_CMD),
-	TRB(FORCE_HEADER_CMD),
-	TRB(NO_OP_CMD),
-	TRB(TRANSFER_EVENT),
-	TRB(COMMAND_COMPLETION_EVENT),
-	TRB(PORT_STATUS_CHANGE_EVENT),
-	TRB(BANDWIDTH_REQUEST_EVENT),
-	TRB(DOORBELL_EVENT),
-	TRB(HOST_CONTROLLER_EVENT),
-	TRB(DEVICE_NOTIFICATION_EVENT),
-	TRB(MFINDEX_WRAP_EVENT),
-#undef TRB
-	[XHCI_TRB_TYPE_MAX] = NULL,
-};
-
-/**
- * Stringify XHCI_TRB_TYPE_*.
- */
-const char *xhci_trb_str_type(unsigned type)
-{
-	static char type_buf [20];
-
-	if (type < XHCI_TRB_TYPE_MAX && trb_types[type] != NULL)
-		return trb_types[type];
-
-	snprintf(type_buf, sizeof(type_buf), "<unknown (%u)>", type);
-	return type_buf;
-}
-
-/**
- * Dump a TRB.
- */
-void xhci_dump_trb(const xhci_trb_t *trb)
-{
-	usb_log_debug("TRB(%p): type %s, cycle %u, status 0x%#08" PRIx32 ", "
-	    "parameter 0x%#016" PRIx64, trb, xhci_trb_str_type(TRB_TYPE(*trb)),
-	    TRB_CYCLE(*trb), trb->status, trb->parameter);
-}
-
-static const char *ec_ids [] = {
-	[0] = "<empty>",
-#define EC(t) [XHCI_EC_##t] = #t
-	EC(USB_LEGACY),
-	EC(SUPPORTED_PROTOCOL),
-	EC(EXTENDED_POWER_MANAGEMENT),
-	EC(IOV),
-	EC(MSI),
-	EC(LOCALMEM),
-	EC(DEBUG),
-	EC(MSIX),
-#undef EC
-	[XHCI_EC_MAX] = NULL
-};
-
-/**
- * Dump Extended Capability ID.
- */
-const char *xhci_ec_str_id(unsigned id)
-{
-	static char buf [20];
-
-	if (id < XHCI_EC_MAX && ec_ids[id] != NULL)
-		return ec_ids[id];
-
-	snprintf(buf, sizeof(buf), "<unknown (%u)>", id);
-	return buf;
-}
-
-/**
- * Dump Protocol Speed ID.
- */
-static void xhci_dump_psi(const xhci_psi_t *psi)
-{
-	static const char speed_exp [] = " KMG";
-	static const char *psi_types [] = { "", " rsvd", " RX", " TX" };
-
-	usb_log_debug("Speed %u%s: %5u %cb/s, %s",
-	    XHCI_REG_RD(psi, XHCI_PSI_PSIV),
-	    psi_types[XHCI_REG_RD(psi, XHCI_PSI_PLT)],
-	    XHCI_REG_RD(psi, XHCI_PSI_PSIM),
-	    speed_exp[XHCI_REG_RD(psi, XHCI_PSI_PSIE)],
-	    XHCI_REG_RD(psi, XHCI_PSI_PFD) ? "full-duplex" : "");
-}
-
-/**
- * Dump given Extended Capability.
- */
-void xhci_dump_extcap(const xhci_extcap_t *ec)
-{
-	xhci_sp_name_t name;
-	unsigned ports_from, ports_to;
-
-	unsigned id = XHCI_REG_RD(ec, XHCI_EC_CAP_ID);
-	usb_log_debug("Extended capability %s", xhci_ec_str_id(id));
-
-	switch (id) {
-	case XHCI_EC_SUPPORTED_PROTOCOL:
-		name.packed = host2uint32_t_le(XHCI_REG_RD(ec, XHCI_EC_SP_NAME));
-		ports_from = XHCI_REG_RD(ec, XHCI_EC_SP_CP_OFF);
-		ports_to = ports_from + XHCI_REG_RD(ec, XHCI_EC_SP_CP_COUNT) - 1;
-		unsigned psic = XHCI_REG_RD(ec, XHCI_EC_SP_PSIC);
-
-		usb_log_debug("\tProtocol %.4s%u.%u, ports %u-%u, "
-		    "%u protocol speeds", name.str,
-		    XHCI_REG_RD(ec, XHCI_EC_SP_MAJOR),
-		    XHCI_REG_RD(ec, XHCI_EC_SP_MINOR),
-		    ports_from, ports_to, psic);
-
-		for (unsigned i = 0; i < psic; i++)
-			xhci_dump_psi(xhci_extcap_psi(ec, i));
-		break;
-	}
-}
-
-void xhci_dump_slot_ctx(const struct xhci_slot_ctx *ctx)
-{
-#define SLOT_DUMP(name)	usb_log_debug("\t" #name ":\t0x%x", XHCI_SLOT_##name(*ctx))
-	SLOT_DUMP(ROUTE_STRING);
-	SLOT_DUMP(SPEED);
-	SLOT_DUMP(MTT);
-	SLOT_DUMP(HUB);
-	SLOT_DUMP(CTX_ENTRIES);
-	SLOT_DUMP(MAX_EXIT_LATENCY);
-	SLOT_DUMP(ROOT_HUB_PORT);
-	SLOT_DUMP(NUM_PORTS);
-	SLOT_DUMP(TT_HUB_SLOT_ID);
-	SLOT_DUMP(TT_PORT_NUM);
-	SLOT_DUMP(TT_THINK_TIME);
-	SLOT_DUMP(INTERRUPTER);
-	SLOT_DUMP(DEVICE_ADDRESS);
-	SLOT_DUMP(STATE);
-#undef SLOT_DUMP
-}
-
-void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *ctx)
-{
-#define EP_DUMP_DW(name)	usb_log_debug("\t" #name ":\t0x%x", XHCI_EP_##name(*ctx))
-#define EP_DUMP_QW(name)	usb_log_debug("\t" #name ":\t0x%" PRIx64, XHCI_EP_##name(*ctx))
-	EP_DUMP_DW(STATE);
-	EP_DUMP_DW(MULT);
-	EP_DUMP_DW(MAX_P_STREAMS);
-	EP_DUMP_DW(LSA);
-	EP_DUMP_DW(INTERVAL);
-	EP_DUMP_DW(ERROR_COUNT);
-	EP_DUMP_DW(TYPE);
-	EP_DUMP_DW(HID);
-	EP_DUMP_DW(MAX_BURST_SIZE);
-	EP_DUMP_DW(MAX_PACKET_SIZE);
-	EP_DUMP_QW(DCS);
-	EP_DUMP_QW(TR_DPTR);
-	EP_DUMP_DW(MAX_ESIT_PAYLOAD_LO);
-	EP_DUMP_DW(MAX_ESIT_PAYLOAD_HI);
-#undef EP_DUMP_DW
-#undef EP_DUMP_QW
-}
-
-void xhci_dump_input_ctx(const xhci_hc_t *hc, const struct xhci_input_ctx *ictx)
-{
-	xhci_device_ctx_t *device_ctx = XHCI_GET_DEVICE_CTX(ictx, hc);
-	xhci_slot_ctx_t *slot_ctx = XHCI_GET_SLOT_CTX(device_ctx, hc);
-	xhci_input_ctrl_ctx_t *ctrl_ctx = XHCI_GET_CTRL_CTX(ictx, hc);
-
-	usb_log_debug("Input control context:");
-	usb_log_debug("\tDrop:\t0x%08x", xhci2host(32, ctrl_ctx->data[0]));
-	usb_log_debug("\tAdd:\t0x%08x", xhci2host(32, ctrl_ctx->data[1]));
-
-	usb_log_debug("\tConfig:\t0x%02x", XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(*ctrl_ctx));
-	usb_log_debug("\tIface:\t0x%02x", XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(*ctrl_ctx));
-	usb_log_debug("\tAlternate:\t0x%02x", XHCI_INPUT_CTRL_CTX_ALTER_SETTING(*ctrl_ctx));
-
-	usb_log_debug("Slot context:");
-	xhci_dump_slot_ctx(slot_ctx);
-
-	for (uint8_t dci = 1; dci <= XHCI_EP_COUNT; dci++)
-		if (XHCI_INPUT_CTRL_CTX_DROP(*ctrl_ctx, dci) ||
-		    XHCI_INPUT_CTRL_CTX_ADD(*ctrl_ctx, dci)) {
-			usb_log_debug("Endpoint context DCI %u:", dci);
-			xhci_ep_ctx_t *ep_ctx = XHCI_GET_EP_CTX(device_ctx, hc, dci);
-			xhci_dump_endpoint_ctx(ep_ctx);
-		}
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/debug.h
===================================================================
--- uspace/drv/bus/usb/xhci/debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- *
- * Utility functions for debugging and logging purposes.
- */
-
-#ifndef XHCI_DEBUG_H
-#define XHCI_DEBUG_H
-
-/**
- * As the debug header is likely to be included in every file, avoid including
- * all headers of xhci to support "include what you use".
- */
-struct xhci_hc;
-struct xhci_cap_regs;
-struct xhci_port_regs;
-struct xhci_trb;
-struct xhci_extcap;
-struct xhci_slot_ctx;
-struct xhci_endpoint_ctx;
-struct xhci_input_ctx;
-
-extern void xhci_dump_cap_regs(const struct xhci_cap_regs *);
-extern void xhci_dump_port(const struct xhci_port_regs *);
-extern void xhci_dump_state(const struct xhci_hc *);
-extern void xhci_dump_ports(const struct xhci_hc *);
-
-extern const char *xhci_trb_str_type(unsigned);
-extern void xhci_dump_trb(const struct xhci_trb *trb);
-
-extern const char *xhci_ec_str_id(unsigned);
-extern void xhci_dump_extcap(const struct xhci_extcap *);
-
-extern void xhci_dump_slot_ctx(const struct xhci_slot_ctx *);
-extern void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *);
-extern void xhci_dump_input_ctx(const struct xhci_hc *,
-    const struct xhci_input_ctx *);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/device.c
===================================================================
--- uspace/drv/bus/usb/xhci/device.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,364 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- * HC Endpoint management.
- */
-
-#include <usb/host/utility.h>
-#include <usb/host/ddf_helpers.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/hcd.h>
-#include <usb/host/utility.h>
-#include <usb/classes/classes.h>
-#include <usb/classes/hub.h>
-#include <usb/descriptor.h>
-#include <usb/debug.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <str_error.h>
-#include <macros.h>
-#include <stdbool.h>
-
-#include "hc.h"
-#include "bus.h"
-#include "endpoint.h"
-#include "hw_struct/context.h"
-
-#include "device.h"
-
-/**
- * Initial descriptor used for control endpoint 0,
- * before more configuration is retrieved.
- */
-static const usb_endpoint_descriptors_t ep0_initial_desc = {
-	.endpoint.max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE,
-};
-
-/**
- * Assign address and control endpoint to a new XHCI device. Once this function
- * successfully returns, the device is online.
- *
- * @param[in] bus XHCI bus, in which the address is assigned.
- * @param[in] dev New device to address and configure./e
- * @return Error code.
- */
-static errno_t address_device(xhci_device_t *dev)
-{
-	errno_t err;
-
-	/* Enable new slot. */
-	if ((err = hc_enable_slot(dev)) != EOK)
-		return err;
-	usb_log_debug("Obtained slot ID: %u.", dev->slot_id);
-
-	/* Temporary reference */
-	endpoint_t *ep0_base;
-	if ((err = bus_endpoint_add(&dev->base, &ep0_initial_desc, &ep0_base)))
-		goto err_slot;
-
-	usb_log_debug("Looking up new device initial MPS: %s",
-	    usb_str_speed(dev->base.speed));
-	ep0_base->max_packet_size = hc_get_ep0_initial_mps(dev->base.speed);
-
-	/* Address device */
-	if ((err = hc_address_device(dev)))
-		goto err_added;
-
-	/* Temporary reference */
-	endpoint_del_ref(ep0_base);
-
-	return EOK;
-
-err_added:
-	bus_endpoint_remove(ep0_base);
-	/* Temporary reference */
-	endpoint_del_ref(ep0_base);
-err_slot:
-	hc_disable_slot(dev);
-	return err;
-}
-
-/**
- * Retrieve and set maximum packet size for endpoint zero of a XHCI device.
- *
- * @param[in] hc Host controller, which manages the device.
- * @param[in] dev Device with operational endpoint zero.
- * @return Error code.
- */
-static errno_t setup_ep0_packet_size(xhci_hc_t *hc, xhci_device_t *dev)
-{
-	errno_t err;
-
-	uint16_t max_packet_size;
-	if ((err = hc_get_ep0_max_packet_size(&max_packet_size, &dev->base)))
-		return err;
-
-	xhci_endpoint_t *ep0 = xhci_endpoint_get(dev->base.endpoints[0]);
-	assert(ep0);
-
-	if (ep0->base.max_packet_size == max_packet_size)
-		return EOK;
-
-	ep0->base.max_packet_size = max_packet_size;
-	ep0->base.max_transfer_size = max_packet_size * ep0->base.packets_per_uframe;
-
-	if ((err = hc_update_endpoint(ep0)))
-		return err;
-
-	return EOK;
-}
-
-/**
- * Check whether the device is a hub and if so, fill its characterstics.
- *
- * If this fails, it does not necessarily mean the device is unusable.
- * Just the TT will not work correctly.
- */
-static errno_t setup_hub(xhci_device_t *dev, usb_standard_device_descriptor_t *desc)
-{
-	if (desc->device_class != USB_CLASS_HUB)
-		return EOK;
-
-	usb_hub_descriptor_header_t hub_desc = { 0 };
-	const errno_t err = hc_get_hub_desc(&dev->base, &hub_desc);
-	if (err)
-		return err;
-
-	dev->is_hub = 1;
-	dev->num_ports = hub_desc.port_count;
-
-	if (dev->base.speed == USB_SPEED_HIGH) {
-		dev->tt_think_time = 8 +
-		    8  * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_8) +
-		    16 * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_16);
-	}
-
-	usb_log_debug("Device(%u): recognised USB hub with %u ports",
-	    dev->base.address, dev->num_ports);
-	return EOK;
-}
-
-/**
- * Respond to a new device on the XHCI bus. Address it, negotiate packet size
- * and retrieve USB descriptors.
- *
- * @param[in] bus XHCI bus, where the new device emerged.
- * @param[in] dev XHCI device, which has appeared on the bus.
- *
- * @return Error code.
- */
-errno_t xhci_device_enumerate(device_t *dev)
-{
-	errno_t err;
-	xhci_bus_t *bus = bus_to_xhci_bus(dev->bus);
-	xhci_device_t *xhci_dev = xhci_device_get(dev);
-
-	/* Calculate route string */
-	xhci_device_t *xhci_hub = xhci_device_get(dev->hub);
-	xhci_dev->route_str = xhci_hub->route_str;
-
-	/* Roothub port is not part of the route string */
-	if (dev->tier >= 2) {
-		const unsigned offset = 4 * (dev->tier - 2);
-		xhci_dev->route_str |= (dev->port & 0xf) << offset;
-		xhci_dev->rh_port = xhci_hub->rh_port;
-	}
-
-	int retries = 3;
-	do {
-		/* Assign an address to the device */
-		err = address_device(xhci_dev);
-	} while (err == ESTALL && --retries > 0);
-
-	if (err) {
-		usb_log_error("Failed to setup address of the new device: %s",
-		    str_error(err));
-		return err;
-	}
-
-	/* Setup EP0 might already need to issue a transfer. */
-	fibril_mutex_lock(&bus->base.guard);
-	assert(bus->devices_by_slot[xhci_dev->slot_id] == NULL);
-	bus->devices_by_slot[xhci_dev->slot_id] = xhci_dev;
-	fibril_mutex_unlock(&bus->base.guard);
-
-	if ((err = setup_ep0_packet_size(bus->hc, xhci_dev))) {
-		usb_log_error("Failed to setup control endpoint "
-		    "of the new device: %s", str_error(err));
-		goto err_address;
-	}
-
-	usb_standard_device_descriptor_t desc = { 0 };
-
-	if ((err = hc_get_device_desc(dev, &desc))) {
-		usb_log_error("Device(%d): failed to get device "
-		    "descriptor: %s", dev->address, str_error(err));
-		goto err_address;
-	}
-
-	if ((err = setup_hub(xhci_dev, &desc)))
-		usb_log_warning("Device(%d): failed to setup hub "
-		    "characteristics: %s.  Continuing anyway.",
-		    dev->address, str_error(err));
-
-	if ((err = hcd_ddf_setup_match_ids(dev, &desc))) {
-		usb_log_error("Device(%d): failed to setup match IDs: %s",
-		    dev->address, str_error(err));
-		goto err_address;
-	}
-
-	return EOK;
-
-err_address:
-	bus_endpoint_remove(xhci_dev->base.endpoints[0]);
-	bus->devices_by_slot[xhci_dev->slot_id] = NULL;
-	hc_disable_slot(xhci_dev);
-	return err;
-}
-
-/**
- * Remove device from XHCI bus. Transition it to the offline state, abort all
- * ongoing transfers and unregister all of its endpoints.
- *
- * Bus callback.
- *
- * @param[in] bus XHCI bus, from which the device is removed.
- * @param[in] dev XHCI device, which is removed from the bus.
- * @return Error code.
- */
-void xhci_device_gone(device_t *dev)
-{
-	errno_t err;
-	xhci_bus_t *bus = bus_to_xhci_bus(dev->bus);
-	xhci_device_t *xhci_dev = xhci_device_get(dev);
-
-	/* Disable the slot, dropping all endpoints. */
-	const uint32_t slot_id = xhci_dev->slot_id;
-	if ((err = hc_disable_slot(xhci_dev))) {
-		usb_log_warning("Failed to disable slot of device " XHCI_DEV_FMT
-		    ": %s", XHCI_DEV_ARGS(*xhci_dev), str_error(err));
-	}
-
-	bus->devices_by_slot[slot_id] = NULL;
-}
-
-/**
- * Reverts things device_offline did, getting the device back up.
- *
- * Bus callback.
- */
-errno_t xhci_device_online(device_t *dev_base)
-{
-	errno_t err;
-
-	xhci_bus_t *bus = bus_to_xhci_bus(dev_base->bus);
-	assert(bus);
-
-	xhci_device_t *dev = xhci_device_get(dev_base);
-	assert(dev);
-
-	/* Transition the device from the Addressed to the Configured state. */
-	if ((err = hc_configure_device(dev))) {
-		usb_log_warning("Failed to configure device " XHCI_DEV_FMT ".",
-		    XHCI_DEV_ARGS(*dev));
-		return err;
-	}
-
-	return EOK;
-}
-
-/**
- * Make given device offline. Offline the DDF function, tear down all
- * endpoints, issue Deconfigure Device command to xHC.
- *
- * Bus callback.
- */
-void xhci_device_offline(device_t *dev_base)
-{
-	errno_t err;
-
-	xhci_bus_t *bus = bus_to_xhci_bus(dev_base->bus);
-	assert(bus);
-
-	xhci_device_t *dev = xhci_device_get(dev_base);
-	assert(dev);
-
-	/* Issue one HC command to simultaneously drop all endpoints except zero. */
-	if ((err = hc_deconfigure_device(dev))) {
-		usb_log_warning("Failed to deconfigure device "
-		    XHCI_DEV_FMT ".", XHCI_DEV_ARGS(*dev));
-	}
-}
-
-/**
- * Fill a slot context that is part of an Input Context with appropriate
- * values.
- *
- * @param ctx Slot context, zeroed out.
- */
-void xhci_setup_slot_context(xhci_device_t *dev, xhci_slot_ctx_t *ctx)
-{
-	/* Initialize slot_ctx according to section 4.3.3 point 3. */
-	XHCI_SLOT_ROOT_HUB_PORT_SET(*ctx, dev->rh_port);
-	XHCI_SLOT_ROUTE_STRING_SET(*ctx, dev->route_str);
-	XHCI_SLOT_SPEED_SET(*ctx, hc_speed_to_psiv(dev->base.speed));
-
-	/*
-	 * Note: This function is used even before this flag can be set, to
-	 *       issue the address device command. It is OK, because these
-	 *       flags are not required to be valid for that command.
-	 */
-	if (dev->is_hub) {
-		XHCI_SLOT_HUB_SET(*ctx, 1);
-		XHCI_SLOT_NUM_PORTS_SET(*ctx, dev->num_ports);
-		XHCI_SLOT_TT_THINK_TIME_SET(*ctx, dev->tt_think_time);
-		XHCI_SLOT_MTT_SET(*ctx, 0); // MTT not supported yet
-	}
-
-	/* Setup Transaction Translation. TODO: Test this with HS hub. */
-	if (dev->base.tt.dev != NULL) {
-		xhci_device_t *hub = xhci_device_get(dev->base.tt.dev);
-		XHCI_SLOT_TT_HUB_SLOT_ID_SET(*ctx, hub->slot_id);
-		XHCI_SLOT_TT_HUB_PORT_SET(*ctx, dev->base.tt.port);
-	}
-
-	/*
-	 * As we always allocate space for whole input context, we can set this
-	 * to maximum. The only exception being Address Device command, which
-	 * explicitly requires this to be se to 1.
-	 */
-	XHCI_SLOT_CTX_ENTRIES_SET(*ctx, 31);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/device.h
===================================================================
--- uspace/drv/bus/usb/xhci/device.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- */
-#ifndef XHCI_DEVICE_H
-#define XHCI_DEVICE_H
-
-#include <usb/host/bus.h>
-#include <usb/dma_buffer.h>
-
-typedef struct xhci_slot_ctx xhci_slot_ctx_t;
-
-typedef struct xhci_device {
-	device_t base;		/**< Inheritance. Keep this first. */
-
-	/** Slot ID assigned to the device by xHC. */
-	uint32_t slot_id;
-
-	/** Corresponding port on RH */
-	uint8_t rh_port;
-
-	/** Route string */
-	uint32_t route_str;
-
-	/** Place to store the allocated context */
-	dma_buffer_t dev_ctx;
-
-	/** Hub specific information. Valid only if the device is_hub. */
-	bool is_hub;
-	uint8_t num_ports;
-	uint8_t tt_think_time;
-} xhci_device_t;
-
-#define XHCI_DEV_FMT  "(%s, slot %d)"
-#define XHCI_DEV_ARGS(dev)	ddf_fun_get_name((dev).base.fun), (dev).slot_id
-
-/* Bus callbacks */
-errno_t xhci_device_enumerate(device_t *);
-void xhci_device_offline(device_t *);
-errno_t xhci_device_online(device_t *);
-void xhci_device_gone(device_t *);
-
-void xhci_setup_slot_context(xhci_device_t *, xhci_slot_ctx_t *);
-
-static inline xhci_device_t *xhci_device_get(device_t *dev)
-{
-	assert(dev);
-	return (xhci_device_t *) dev;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/doc/doxygroups.h
===================================================================
--- uspace/drv/bus/usb/xhci/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drvusbxhci xhci
- * @brief XHCI driver
- * @ingroup drvs
- */
Index: pace/drv/bus/usb/xhci/endpoint.c
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,493 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty, Michal Staruch, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller endpoint management.
- */
-
-#include <usb/host/endpoint.h>
-#include <usb/descriptor.h>
-
-#include <errno.h>
-#include <macros.h>
-#include <str_error.h>
-
-#include "hc.h"
-#include "bus.h"
-#include "commands.h"
-#include "device.h"
-#include "endpoint.h"
-#include "streams.h"
-
-static errno_t alloc_transfer_ds(xhci_endpoint_t *);
-
-/**
- * Initialize new XHCI endpoint.
- * @param[in] xhci_ep Allocated XHCI endpoint to initialize.
- * @param[in] dev Device, to which the endpoint belongs.
- * @param[in] desc USB endpoint descriptor carrying configuration data.
- *
- * @return Error code.
- */
-static errno_t xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev,
-    const usb_endpoint_descriptors_t *desc)
-{
-	errno_t rc;
-	assert(xhci_ep);
-
-	endpoint_t *ep = &xhci_ep->base;
-
-	endpoint_init(ep, dev, desc);
-
-	fibril_mutex_initialize(&xhci_ep->guard);
-
-	xhci_ep->max_burst = desc->companion.max_burst + 1;
-
-	if (ep->transfer_type == USB_TRANSFER_BULK)
-		xhci_ep->max_streams = 1 << (USB_SSC_MAX_STREAMS(desc->companion));
-	else
-		xhci_ep->max_streams = 1;
-
-	if (ep->transfer_type == USB_TRANSFER_ISOCHRONOUS)
-		xhci_ep->mult = USB_SSC_MULT(desc->companion) + 1;
-	else
-		xhci_ep->mult = 1;
-
-	/*
-	 * In USB 3, the semantics of wMaxPacketSize changed. Now the number of
-	 * packets per service interval is determined from max_burst and mult.
-	 */
-	if (dev->speed >= USB_SPEED_SUPER) {
-		ep->packets_per_uframe = xhci_ep->max_burst * xhci_ep->mult;
-		if (ep->transfer_type == USB_TRANSFER_ISOCHRONOUS ||
-		    ep->transfer_type == USB_TRANSFER_INTERRUPT) {
-			ep->max_transfer_size = ep->max_packet_size * ep->packets_per_uframe;
-		}
-	}
-
-	xhci_ep->interval = desc->endpoint.poll_interval;
-
-	/*
-	 * Only Low/Full speed interrupt endpoints have interval as a linear field,
-	 * others have 2-based log of it.
-	 */
-	if (dev->speed >= USB_SPEED_HIGH ||
-	    ep->transfer_type != USB_TRANSFER_INTERRUPT) {
-
-		// XXX: According to the spec, the interval should be
-		//      from [1, 16]. However, in QEMU, we get 0 here
-		//      (a QEMU bug?).
-		if (xhci_ep->interval == 0)
-			xhci_ep->interval = 8;
-
-		xhci_ep->interval = 1 << (xhci_ep->interval - 1);
-	}
-
-	/* Full speed devices have interval in frames */
-	if (dev->speed <= USB_SPEED_FULL) {
-		xhci_ep->interval *= 8;
-	}
-
-	if (xhci_ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS)
-		isoch_init(xhci_ep, desc);
-
-	if ((rc = alloc_transfer_ds(xhci_ep)))
-		goto err;
-
-	unsigned flags = -1U;
-
-	/* Some xHCs can handle 64-bit addresses */
-	xhci_bus_t *bus = bus_to_xhci_bus(ep->device->bus);
-	if (bus->hc->ac64)
-		flags &= ~DMA_POLICY_4GiB;
-
-	/* xHCI works best if it can fit 65k transfers in one TRB */
-	ep->transfer_buffer_policy = dma_policy_create(flags, 1 << 16);
-
-	/* But actualy can do full scatter-gather. */
-	ep->required_transfer_buffer_policy = dma_policy_create(flags, PAGE_SIZE);
-
-	return EOK;
-
-err:
-	return rc;
-}
-
-/**
- * Create a new xHCI endpoint structure.
- *
- * Bus callback.
- */
-endpoint_t *xhci_endpoint_create(device_t *dev,
-    const usb_endpoint_descriptors_t *desc)
-{
-	const usb_transfer_type_t type = USB_ED_GET_TRANSFER_TYPE(desc->endpoint);
-
-	xhci_endpoint_t *ep = calloc(1, sizeof(xhci_endpoint_t) +
-	    (type == USB_TRANSFER_ISOCHRONOUS) * sizeof(*ep->isoch));
-	if (!ep)
-		return NULL;
-
-	if (xhci_endpoint_init(ep, dev, desc)) {
-		free(ep);
-		return NULL;
-	}
-
-	return &ep->base;
-}
-
-/**
- * Finalize XHCI endpoint.
- * @param[in] xhci_ep XHCI endpoint to finalize.
- */
-static void xhci_endpoint_fini(xhci_endpoint_t *xhci_ep)
-{
-	assert(xhci_ep);
-
-	xhci_endpoint_free_transfer_ds(xhci_ep);
-
-	// TODO: Something missed?
-}
-
-/**
- * Destroy given xHCI endpoint structure.
- *
- * Bus callback.
- */
-void xhci_endpoint_destroy(endpoint_t *ep)
-{
-	xhci_endpoint_t *xhci_ep = xhci_endpoint_get(ep);
-
-	xhci_endpoint_fini(xhci_ep);
-	free(xhci_ep);
-}
-
-/**
- * Register an andpoint to the xHC.
- *
- * Bus callback.
- */
-errno_t xhci_endpoint_register(endpoint_t *ep_base)
-{
-	errno_t err;
-	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
-
-	if (ep_base->endpoint != 0 && (err = hc_add_endpoint(ep)))
-		return err;
-
-	endpoint_set_online(ep_base, &ep->guard);
-	return EOK;
-}
-
-/**
- * Abort a transfer on an endpoint.
- */
-static void endpoint_abort(endpoint_t *ep)
-{
-	xhci_device_t *dev = xhci_device_get(ep->device);
-	xhci_endpoint_t *xhci_ep = xhci_endpoint_get(ep);
-
-	/* This function can only abort endpoints without streams. */
-	assert(xhci_ep->primary_stream_data_array == NULL);
-
-	fibril_mutex_lock(&xhci_ep->guard);
-
-	endpoint_set_offline_locked(ep);
-
-	if (!ep->active_batch) {
-		fibril_mutex_unlock(&xhci_ep->guard);
-		return;
-	}
-
-	/* First, offer the batch a short chance to be finished. */
-	endpoint_wait_timeout_locked(ep, 10000);
-
-	if (!ep->active_batch) {
-		fibril_mutex_unlock(&xhci_ep->guard);
-		return;
-	}
-
-	usb_transfer_batch_t *const batch = ep->active_batch;
-
-	const errno_t err = hc_stop_endpoint(xhci_ep);
-	if (err) {
-		usb_log_error("Failed to stop endpoint %u of device "
-		    XHCI_DEV_FMT ": %s", ep->endpoint, XHCI_DEV_ARGS(*dev),
-		    str_error(err));
-	}
-
-	fibril_mutex_unlock(&xhci_ep->guard);
-
-	batch->error = EINTR;
-	batch->transferred_size = 0;
-	usb_transfer_batch_finish(batch);
-	return;
-}
-
-/**
- * Unregister an endpoint. If the device is still available, inform the xHC
- * about it.
- *
- * Bus callback.
- */
-void xhci_endpoint_unregister(endpoint_t *ep_base)
-{
-	errno_t err;
-	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
-	xhci_device_t *dev = xhci_device_get(ep_base->device);
-
-	endpoint_abort(ep_base);
-
-	/* If device slot is still available, drop the endpoint. */
-	if (ep_base->endpoint != 0 && dev->slot_id) {
-
-		if ((err = hc_drop_endpoint(ep))) {
-			usb_log_error("Failed to drop endpoint " XHCI_EP_FMT ": %s",
-			    XHCI_EP_ARGS(*ep), str_error(err));
-		}
-	} else {
-		usb_log_debug("Not going to drop endpoint " XHCI_EP_FMT " because"
-		    " the slot has already been disabled.", XHCI_EP_ARGS(*ep));
-	}
-}
-
-/**
- * Determine the type of a XHCI endpoint.
- * @param[in] ep XHCI endpoint to query.
- *
- * @return EP_TYPE_[CONTROL|ISOCH|BULK|INTERRUPT]_[IN|OUT]
- */
-int xhci_endpoint_type(xhci_endpoint_t *ep)
-{
-	const bool in = ep->base.direction == USB_DIRECTION_IN;
-
-	switch (ep->base.transfer_type) {
-	case USB_TRANSFER_CONTROL:
-		return EP_TYPE_CONTROL;
-
-	case USB_TRANSFER_ISOCHRONOUS:
-		return in ? EP_TYPE_ISOCH_IN :
-		    EP_TYPE_ISOCH_OUT;
-
-	case USB_TRANSFER_BULK:
-		return in ? EP_TYPE_BULK_IN :
-		    EP_TYPE_BULK_OUT;
-
-	case USB_TRANSFER_INTERRUPT:
-		return in ? EP_TYPE_INTERRUPT_IN :
-		    EP_TYPE_INTERRUPT_OUT;
-	}
-
-	return EP_TYPE_INVALID;
-}
-
-/**
- * Allocate transfer data structures for XHCI endpoint not using streams.
- * @param[in] xhci_ep XHCI endpoint to allocate data structures for.
- *
- * @return Error code.
- */
-static errno_t alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
-{
-	/* Can't use XHCI_EP_FMT because the endpoint may not have device. */
-	usb_log_debug("Allocating main transfer ring for endpoint " XHCI_EP_FMT,
-	    XHCI_EP_ARGS(*xhci_ep));
-
-	xhci_ep->primary_stream_data_array = NULL;
-	xhci_ep->primary_stream_data_size = 0;
-
-	errno_t err;
-	if ((err = xhci_trb_ring_init(&xhci_ep->ring, 0))) {
-		return err;
-	}
-
-	if (xhci_ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) {
-		if ((err = isoch_alloc_transfers(xhci_ep))) {
-			xhci_trb_ring_fini(&xhci_ep->ring);
-			return err;
-		}
-	}
-
-	return EOK;
-}
-
-/**
- * Free transfer data structures for XHCI endpoint.
- * @param[in] xhci_ep XHCI endpoint to free data structures for.
- */
-void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep)
-{
-	if (xhci_ep->primary_stream_data_size) {
-		xhci_stream_free_ds(xhci_ep);
-	} else {
-		usb_log_debug("Freeing main transfer ring of endpoint " XHCI_EP_FMT,
-		    XHCI_EP_ARGS(*xhci_ep));
-		xhci_trb_ring_fini(&xhci_ep->ring);
-	}
-
-	if (xhci_ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS)
-		isoch_fini(xhci_ep);
-}
-
-xhci_trb_ring_t *xhci_endpoint_get_ring(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	if (ep->primary_stream_data_size == 0)
-		return stream_id == 0 ? &ep->ring : NULL;
-
-	xhci_stream_data_t *stream_data = xhci_get_stream_ctx_data(ep, stream_id);
-	if (stream_data == NULL) {
-		usb_log_warning("No transfer ring was found for stream %u.", stream_id);
-		return NULL;
-	}
-
-	return &stream_data->ring;
-}
-
-/**
- * Configure endpoint context of a control endpoint.
- * @param[in] ep XHCI control endpoint.
- * @param[in] ctx Endpoint context to configure.
- */
-static void setup_control_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
-{
-	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(ep));
-	XHCI_EP_MAX_PACKET_SIZE_SET(*ctx, ep->base.max_packet_size);
-	XHCI_EP_MAX_BURST_SIZE_SET(*ctx, ep->max_burst - 1);
-	XHCI_EP_MULT_SET(*ctx, ep->mult - 1);
-	XHCI_EP_ERROR_COUNT_SET(*ctx, 3);
-	XHCI_EP_TR_DPTR_SET(*ctx, ep->ring.dequeue);
-	XHCI_EP_DCS_SET(*ctx, 1);
-}
-
-/**
- * Configure endpoint context of a bulk endpoint.
- * @param[in] ep XHCI bulk endpoint.
- * @param[in] ctx Endpoint context to configure.
- */
-static void setup_bulk_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
-{
-	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(ep));
-	XHCI_EP_MAX_PACKET_SIZE_SET(*ctx, ep->base.max_packet_size);
-	XHCI_EP_MAX_BURST_SIZE_SET(*ctx, ep->max_burst - 1);
-	XHCI_EP_ERROR_COUNT_SET(*ctx, 3);
-
-	XHCI_EP_MAX_P_STREAMS_SET(*ctx, 0);
-	XHCI_EP_TR_DPTR_SET(*ctx, ep->ring.dequeue);
-	XHCI_EP_DCS_SET(*ctx, 1);
-}
-
-/**
- * Configure endpoint context of a isochronous endpoint.
- * @param[in] ep XHCI isochronous endpoint.
- * @param[in] ctx Endpoint context to configure.
- */
-static void setup_isoch_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
-{
-	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(ep));
-	XHCI_EP_MAX_PACKET_SIZE_SET(*ctx, ep->base.max_packet_size & 0x07FF);
-	XHCI_EP_MAX_BURST_SIZE_SET(*ctx, ep->max_burst - 1);
-	XHCI_EP_MULT_SET(*ctx, ep->mult - 1);
-	XHCI_EP_ERROR_COUNT_SET(*ctx, 0);
-	XHCI_EP_TR_DPTR_SET(*ctx, ep->ring.dequeue);
-	XHCI_EP_DCS_SET(*ctx, 1);
-	XHCI_EP_INTERVAL_SET(*ctx, fnzb32(ep->interval) % 32);
-
-	XHCI_EP_MAX_ESIT_PAYLOAD_LO_SET(*ctx, ep->isoch->max_size & 0xFFFF);
-	XHCI_EP_MAX_ESIT_PAYLOAD_HI_SET(*ctx, (ep->isoch->max_size >> 16) & 0xFF);
-}
-
-/**
- * Configure endpoint context of a interrupt endpoint.
- * @param[in] ep XHCI interrupt endpoint.
- * @param[in] ctx Endpoint context to configure.
- */
-static void setup_interrupt_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
-{
-	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(ep));
-	XHCI_EP_MAX_PACKET_SIZE_SET(*ctx, ep->base.max_packet_size & 0x07FF);
-	XHCI_EP_MAX_BURST_SIZE_SET(*ctx, ep->max_burst - 1);
-	XHCI_EP_MULT_SET(*ctx, 0);
-	XHCI_EP_ERROR_COUNT_SET(*ctx, 3);
-	XHCI_EP_TR_DPTR_SET(*ctx, ep->ring.dequeue);
-	XHCI_EP_DCS_SET(*ctx, 1);
-	XHCI_EP_INTERVAL_SET(*ctx, fnzb32(ep->interval) % 32);
-	// TODO: max ESIT payload
-}
-
-/** Type of endpoint context configuration function. */
-typedef void (*setup_ep_ctx_helper)(xhci_endpoint_t *, xhci_ep_ctx_t *);
-
-/**
- * Static array, which maps USB endpoint types to their respective endpoint
- * context configuration functions.
- */
-static const setup_ep_ctx_helper setup_ep_ctx_helpers[] = {
-	[USB_TRANSFER_CONTROL] = setup_control_ep_ctx,
-	[USB_TRANSFER_ISOCHRONOUS] = setup_isoch_ep_ctx,
-	[USB_TRANSFER_BULK] = setup_bulk_ep_ctx,
-	[USB_TRANSFER_INTERRUPT] = setup_interrupt_ep_ctx,
-};
-
-/** Configure endpoint context of XHCI endpoint.
- * @param[in] ep Associated XHCI endpoint.
- * @param[in] ep_ctx Endpoint context to configure.
- */
-void xhci_setup_endpoint_context(xhci_endpoint_t *ep, xhci_ep_ctx_t *ep_ctx)
-{
-	assert(ep);
-	assert(ep_ctx);
-
-	usb_transfer_type_t tt = ep->base.transfer_type;
-
-	memset(ep_ctx, 0, sizeof(*ep_ctx));
-	setup_ep_ctx_helpers[tt](ep, ep_ctx);
-}
-
-/**
- * Clear endpoint halt condition by resetting the endpoint and skipping the
- * offending transfer.
- */
-errno_t xhci_endpoint_clear_halt(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	errno_t err;
-
-	if ((err = hc_reset_endpoint(ep)))
-		return err;
-
-	if ((err = hc_reset_ring(ep, stream_id)))
-		return err;
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/endpoint.h
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty, Michal Staruch, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller endpoint management.
- */
-
-#ifndef XHCI_ENDPOINT_H
-#define XHCI_ENDPOINT_H
-
-#include <assert.h>
-
-#include <usb/debug.h>
-#include <usb/dma_buffer.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/hcd.h>
-#include <ddf/driver.h>
-
-#include "device.h"
-#include "isoch.h"
-#include "transfers.h"
-#include "trb_ring.h"
-
-typedef struct xhci_device xhci_device_t;
-typedef struct xhci_endpoint xhci_endpoint_t;
-typedef struct xhci_stream_data xhci_stream_data_t;
-typedef struct xhci_bus xhci_bus_t;
-
-enum {
-	EP_TYPE_INVALID = 0,
-	EP_TYPE_ISOCH_OUT = 1,
-	EP_TYPE_BULK_OUT = 2,
-	EP_TYPE_INTERRUPT_OUT = 3,
-	EP_TYPE_CONTROL = 4,
-	EP_TYPE_ISOCH_IN = 5,
-	EP_TYPE_BULK_IN = 6,
-	EP_TYPE_INTERRUPT_IN = 7
-};
-
-/** Connector structure linking endpoint context to the endpoint. */
-typedef struct xhci_endpoint {
-	endpoint_t base;	/**< Inheritance. Keep this first. */
-
-	/** Guarding scheduling of this endpoint. */
-	fibril_mutex_t guard;
-
-	/** Main transfer ring (unused if streams are enabled) */
-	xhci_trb_ring_t ring;
-
-	/**
-	 * Primary stream context data array
-	 * (or NULL if endpoint doesn't use streams).
-	 */
-	xhci_stream_data_t *primary_stream_data_array;
-
-	/** Primary stream context array - allocated for xHC hardware. */
-	xhci_stream_ctx_t *primary_stream_ctx_array;
-	dma_buffer_t primary_stream_ctx_dma;
-
-	/** Size of the allocated primary stream data and context array. */
-	uint16_t primary_stream_data_size;
-
-	/* Maximum number of primary streams (0 - 2^16). */
-	uint32_t max_streams;
-
-	/**
-	 * Maximum number of consecutive USB transactions (0-15) that
-	 * should be executed per scheduling opportunity
-	 */
-	uint8_t max_burst;
-
-	/**
-	 * Maximum number of bursts within an interval that
-	 * this endpoint supports
-	 */
-	uint8_t mult;
-
-	/**
-	 * Scheduling interval for periodic endpoints,
-	 * as a number of 125us units. (0 - 2^16)
-	 */
-	uint32_t interval;
-
-	/**
-	 * This field is a valid pointer for (and only for) isochronous
-	 * endpoints.
-	 */
-	xhci_isoch_t isoch [0];
-} xhci_endpoint_t;
-
-#define XHCI_EP_FMT  "(%d:%d %s)"
-/* FIXME: "Device -1" messes up log messages, figure out a better way. */
-#define XHCI_EP_ARGS(ep)		\
-	((ep).base.device ? (ep).base.device->address : -1),	\
-	((ep).base.endpoint),		\
-	(usb_str_transfer_type((ep).base.transfer_type))
-
-extern int xhci_endpoint_type(xhci_endpoint_t *ep);
-
-extern endpoint_t *xhci_endpoint_create(device_t *,
-    const usb_endpoint_descriptors_t *);
-extern errno_t xhci_endpoint_register(endpoint_t *);
-extern void xhci_endpoint_unregister(endpoint_t *);
-extern void xhci_endpoint_destroy(endpoint_t *);
-
-extern void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *);
-extern xhci_trb_ring_t *xhci_endpoint_get_ring(xhci_endpoint_t *, uint32_t);
-
-extern void xhci_setup_endpoint_context(xhci_endpoint_t *, xhci_ep_ctx_t *);
-extern errno_t xhci_endpoint_clear_halt(xhci_endpoint_t *, unsigned);
-
-static inline xhci_endpoint_t *xhci_endpoint_get(endpoint_t *ep)
-{
-	assert(ep);
-	return (xhci_endpoint_t *) ep;
-}
-
-static inline xhci_device_t *xhci_ep_to_dev(xhci_endpoint_t *ep)
-{
-	assert(ep);
-	return xhci_device_get(ep->base.device);
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/hc.c
===================================================================
--- uspace/drv/bus/usb/xhci/hc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1168 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek, Jaroslav Jindrak, Jan Hrach, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller data bookkeeping.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/host/endpoint.h>
-#include "debug.h"
-#include "hc.h"
-#include "rh.h"
-#include "hw_struct/trb.h"
-#include "hw_struct/context.h"
-#include "endpoint.h"
-#include "transfers.h"
-#include "trb_ring.h"
-
-/**
- * Default USB Speed ID mapping: Table 157
- */
-#define PSI_TO_BPS(psie, psim) (((uint64_t) psim) << (10 * psie))
-#define PORT_SPEED(usb, mjr, psie, psim) { \
-	.name = "USB ", \
-	.major = mjr, \
-	.minor = 0, \
-	.usb_speed = USB_SPEED_##usb, \
-	.rx_bps = PSI_TO_BPS(psie, psim), \
-	.tx_bps = PSI_TO_BPS(psie, psim) \
-}
-
-static const xhci_port_speed_t default_psiv_to_port_speed [] = {
-	[1] = PORT_SPEED(FULL, 2, 2, 12),
-	[2] = PORT_SPEED(LOW, 2, 1, 1500),
-	[3] = PORT_SPEED(HIGH, 2, 2, 480),
-	[4] = PORT_SPEED(SUPER, 3, 3, 5),
-};
-
-static const unsigned usb_speed_to_psiv [] = {
-	[USB_SPEED_FULL] = 1,
-	[USB_SPEED_LOW] = 2,
-	[USB_SPEED_HIGH] = 3,
-	[USB_SPEED_SUPER] = 4,
-};
-
-/**
- * Walk the list of extended capabilities.
- *
- * The most interesting thing hidden in extended capabilities is the mapping of
- * ports to protocol versions and speeds.
- */
-static errno_t hc_parse_ec(xhci_hc_t *hc)
-{
-	unsigned psic, major, minor;
-	xhci_sp_name_t name;
-
-	xhci_port_speed_t *speeds = hc->speeds;
-
-	for (xhci_extcap_t *ec = hc->xecp; ec; ec = xhci_extcap_next(ec)) {
-		xhci_dump_extcap(ec);
-		switch (XHCI_REG_RD(ec, XHCI_EC_CAP_ID)) {
-		case XHCI_EC_USB_LEGACY:
-			assert(hc->legsup == NULL);
-			hc->legsup = (xhci_legsup_t *) ec;
-			break;
-		case XHCI_EC_SUPPORTED_PROTOCOL:
-			psic = XHCI_REG_RD(ec, XHCI_EC_SP_PSIC);
-			major = XHCI_REG_RD(ec, XHCI_EC_SP_MAJOR);
-			minor = XHCI_REG_RD(ec, XHCI_EC_SP_MINOR);
-			name.packed = host2uint32_t_le(XHCI_REG_RD(ec, XHCI_EC_SP_NAME));
-
-			if (name.packed != xhci_name_usb.packed) {
-				/**
-				 * The detection of such protocol would work,
-				 * but the rest of the implementation is made
-				 * for the USB protocol only.
-				 */
-				usb_log_error("Unknown protocol %.4s.", name.str);
-				return ENOTSUP;
-			}
-
-			unsigned offset = XHCI_REG_RD(ec, XHCI_EC_SP_CP_OFF);
-			unsigned count = XHCI_REG_RD(ec, XHCI_EC_SP_CP_COUNT);
-			xhci_rh_set_ports_protocol(&hc->rh, offset, count, major);
-
-			// "Implied" speed
-			if (psic == 0) {
-				assert(minor == 0);
-
-				if (major == 2) {
-					speeds[1] = default_psiv_to_port_speed[1];
-					speeds[2] = default_psiv_to_port_speed[2];
-					speeds[3] = default_psiv_to_port_speed[3];
-				} else if (major == 3) {
-					speeds[4] = default_psiv_to_port_speed[4];
-				} else {
-					return EINVAL;
-				}
-
-				usb_log_debug("Implied speed of USB %u.0 set up.", major);
-			} else {
-				for (unsigned i = 0; i < psic; i++) {
-					xhci_psi_t *psi = xhci_extcap_psi(ec, i);
-					unsigned sim = XHCI_REG_RD(psi, XHCI_PSI_PSIM);
-					unsigned psiv = XHCI_REG_RD(psi, XHCI_PSI_PSIV);
-					unsigned psie = XHCI_REG_RD(psi, XHCI_PSI_PSIE);
-					unsigned psim = XHCI_REG_RD(psi, XHCI_PSI_PSIM);
-					uint64_t bps = PSI_TO_BPS(psie, psim);
-
-					/*
-					 * Speed is not implied, but using one of default PSIV. This
-					 * is not clearly stated in xHCI spec. There is a clear
-					 * intention to allow xHCI to specify its own speed
-					 * parameters, but throughout the document, they used fixed
-					 * values for e.g. High-speed (3), without stating the
-					 * controller shall have implied default speeds - and for
-					 * instance Intel controllers do not. So let's check if the
-					 * values match and if so, accept the implied USB speed too.
-					 *
-					 * The main reason we need this is the usb_speed to have
-					 * mapping also for devices connected to hubs.
-					 */
-					if (psiv < ARRAY_SIZE(default_psiv_to_port_speed) &&
-					    default_psiv_to_port_speed[psiv].major == major &&
-					    default_psiv_to_port_speed[psiv].minor == minor &&
-					    default_psiv_to_port_speed[psiv].rx_bps == bps &&
-					    default_psiv_to_port_speed[psiv].tx_bps == bps) {
-						speeds[psiv] = default_psiv_to_port_speed[psiv];
-						usb_log_debug("Assumed default %s speed of USB %u.",
-						    usb_str_speed(speeds[psiv].usb_speed), major);
-						continue;
-					}
-
-					// Custom speed
-					speeds[psiv].major = major;
-					speeds[psiv].minor = minor;
-					str_ncpy(speeds[psiv].name, 4, name.str, 4);
-					speeds[psiv].usb_speed = USB_SPEED_MAX;
-
-					if (sim == XHCI_PSI_PLT_SYMM || sim == XHCI_PSI_PLT_RX)
-						speeds[psiv].rx_bps = bps;
-					if (sim == XHCI_PSI_PLT_SYMM || sim == XHCI_PSI_PLT_TX) {
-						speeds[psiv].tx_bps = bps;
-						usb_log_debug("Speed %u set up for bps %" PRIu64
-						    " / %" PRIu64 ".", psiv, speeds[psiv].rx_bps,
-						    speeds[psiv].tx_bps);
-					}
-				}
-			}
-		}
-	}
-	return EOK;
-}
-
-/**
- * Initialize MMIO spaces of xHC.
- */
-errno_t hc_init_mmio(xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res)
-{
-	errno_t err;
-
-	if (hw_res->mem_ranges.count != 1) {
-		usb_log_error("Unexpected MMIO area, bailing out.");
-		return EINVAL;
-	}
-
-	hc->mmio_range = hw_res->mem_ranges.ranges[0];
-
-	usb_log_debug("MMIO area at %p (size %zu), IRQ %d.",
-	    RNGABSPTR(hc->mmio_range), RNGSZ(hc->mmio_range), hw_res->irqs.irqs[0]);
-
-	if (RNGSZ(hc->mmio_range) < sizeof(xhci_cap_regs_t))
-		return EOVERFLOW;
-
-	void *base;
-	if ((err = pio_enable_range(&hc->mmio_range, &base)))
-		return err;
-
-	hc->reg_base = base;
-	hc->cap_regs = (xhci_cap_regs_t *)  base;
-	hc->op_regs  = (xhci_op_regs_t *)  (base + XHCI_REG_RD(hc->cap_regs, XHCI_CAP_LENGTH));
-	hc->rt_regs  = (xhci_rt_regs_t *)  (base + XHCI_REG_RD(hc->cap_regs, XHCI_CAP_RTSOFF));
-	hc->db_arry  = (xhci_doorbell_t *) (base + XHCI_REG_RD(hc->cap_regs, XHCI_CAP_DBOFF));
-
-	uintptr_t xec_offset = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_XECP) * sizeof(xhci_dword_t);
-	if (xec_offset > 0)
-		hc->xecp = (xhci_extcap_t *) (base + xec_offset);
-
-	usb_log_debug("Initialized MMIO reg areas:");
-	usb_log_debug("\tCapability regs: %p", hc->cap_regs);
-	usb_log_debug("\tOperational regs: %p", hc->op_regs);
-	usb_log_debug("\tRuntime regs: %p", hc->rt_regs);
-	usb_log_debug("\tDoorbell array base: %p", hc->db_arry);
-
-	xhci_dump_cap_regs(hc->cap_regs);
-
-	hc->ac64 = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_AC64);
-	hc->csz = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_CSZ);
-	hc->max_slots = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_SLOTS);
-
-	struct timespec ts;
-	getuptime(&ts);
-	hc->wrap_time = SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec);
-	hc->wrap_count = 0;
-
-	unsigned ist = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_IST);
-	hc->ist = (ist & 0x10 >> 1) * (ist & 0xf);
-
-	if ((err = xhci_rh_init(&hc->rh, hc)))
-		goto err_pio;
-
-	if ((err = hc_parse_ec(hc)))
-		goto err_rh;
-
-	return EOK;
-
-err_rh:
-	xhci_rh_fini(&hc->rh);
-err_pio:
-	pio_disable(hc->reg_base, RNGSZ(hc->mmio_range));
-	return err;
-}
-
-static int event_worker(void *arg);
-
-/**
- * Initialize structures kept in allocated memory.
- */
-errno_t hc_init_memory(xhci_hc_t *hc, ddf_dev_t *device)
-{
-	errno_t err = ENOMEM;
-
-	if (dma_buffer_alloc(&hc->dcbaa_dma, (1 + hc->max_slots) * sizeof(uint64_t)))
-		return ENOMEM;
-	hc->dcbaa = hc->dcbaa_dma.virt;
-
-	hc->event_worker = joinable_fibril_create(&event_worker, hc);
-	if (!hc->event_worker)
-		goto err_dcbaa;
-
-	if ((err = xhci_event_ring_init(&hc->event_ring, 1)))
-		goto err_worker;
-
-	if ((err = xhci_scratchpad_alloc(hc)))
-		goto err_event_ring;
-
-	if ((err = xhci_init_commands(hc)))
-		goto err_scratch;
-
-	if ((err = xhci_bus_init(&hc->bus, hc)))
-		goto err_cmd;
-
-	xhci_sw_ring_init(&hc->sw_ring, PAGE_SIZE / sizeof(xhci_trb_t));
-
-	return EOK;
-
-err_cmd:
-	xhci_fini_commands(hc);
-err_scratch:
-	xhci_scratchpad_free(hc);
-err_event_ring:
-	xhci_event_ring_fini(&hc->event_ring);
-err_worker:
-	joinable_fibril_destroy(hc->event_worker);
-err_dcbaa:
-	hc->dcbaa = NULL;
-	dma_buffer_free(&hc->dcbaa_dma);
-	return err;
-}
-
-/*
- * Pseudocode:
- *	ip = read(intr[0].iman)
- *	if (ip) {
- *		status = read(usbsts)
- *		assert status
- *		assert ip
- *		accept (passing status)
- *	}
- *	decline
- */
-static const irq_cmd_t irq_commands[] = {
-	{
-		.cmd = CMD_PIO_READ_32,
-		.dstarg = 3,
-		.addr = NULL	/* intr[0].iman */
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 3,
-		.dstarg = 4,
-		.value = 0	/* host2xhci(32, 1) */
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.srcarg = 4,
-		.value = 5
-	},
-	{
-		.cmd = CMD_PIO_READ_32,
-		.dstarg = 1,
-		.addr = NULL	/* usbsts */
-	},
-	{
-		.cmd = CMD_AND,
-		.srcarg = 1,
-		.dstarg = 2,
-		.value = 0	/* host2xhci(32, XHCI_STATUS_ACK_MASK) */
-	},
-	{
-		.cmd = CMD_PIO_WRITE_A_32,
-		.srcarg = 2,
-		.addr = NULL	/* usbsts */
-	},
-	{
-		.cmd = CMD_PIO_WRITE_A_32,
-		.srcarg = 3,
-		.addr = NULL	/* intr[0].iman */
-	},
-	{
-		.cmd = CMD_ACCEPT
-	},
-	{
-		.cmd = CMD_DECLINE
-	}
-};
-
-/**
- * Generates code to accept interrupts. The xHCI is designed primarily for
- * MSI/MSI-X, but we use PCI Interrupt Pin. In this mode, all the Interrupters
- * (except 0) are disabled.
- */
-errno_t hc_irq_code_gen(irq_code_t *code, xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res, int *irq)
-{
-	assert(code);
-	assert(hw_res);
-
-	if (hw_res->irqs.count != 1) {
-		usb_log_info("Unexpected HW resources to enable interrupts.");
-		return EINVAL;
-	}
-
-	code->ranges = malloc(sizeof(irq_pio_range_t));
-	if (code->ranges == NULL)
-		return ENOMEM;
-
-	code->cmds = malloc(sizeof(irq_commands));
-	if (code->cmds == NULL) {
-		free(code->ranges);
-		return ENOMEM;
-	}
-
-	code->rangecount = 1;
-	code->ranges[0] = (irq_pio_range_t) {
-		.base = RNGABS(hc->mmio_range),
-		.size = RNGSZ(hc->mmio_range),
-	};
-
-	code->cmdcount = ARRAY_SIZE(irq_commands);
-	memcpy(code->cmds, irq_commands, sizeof(irq_commands));
-
-	void *intr0_iman = RNGABSPTR(hc->mmio_range) +
-	    XHCI_REG_RD(hc->cap_regs, XHCI_CAP_RTSOFF) +
-	    offsetof(xhci_rt_regs_t, ir[0]);
-	void *usbsts = RNGABSPTR(hc->mmio_range) +
-	    XHCI_REG_RD(hc->cap_regs, XHCI_CAP_LENGTH) +
-	    offsetof(xhci_op_regs_t, usbsts);
-
-	code->cmds[0].addr = intr0_iman;
-	code->cmds[1].value = host2xhci(32, 1);
-	code->cmds[3].addr = usbsts;
-	code->cmds[4].value = host2xhci(32, XHCI_STATUS_ACK_MASK);
-	code->cmds[5].addr = usbsts;
-	code->cmds[6].addr = intr0_iman;
-
-	*irq = hw_res->irqs.irqs[0];
-	return EOK;
-}
-
-/**
- * Claim xHC from BIOS. Implements handoff as per Section 4.22.1 of xHCI spec.
- */
-errno_t hc_claim(xhci_hc_t *hc, ddf_dev_t *dev)
-{
-	/* No legacy support capability, the controller is solely for us */
-	if (!hc->legsup)
-		return EOK;
-
-	if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_CNR), 0))
-		return ETIMEOUT;
-
-	usb_log_debug("LEGSUP: bios: %x, os: %x", hc->legsup->sem_bios, hc->legsup->sem_os);
-	XHCI_REG_SET(hc->legsup, XHCI_LEGSUP_SEM_OS, 1);
-	for (int i = 0; i <= (XHCI_LEGSUP_BIOS_TIMEOUT_US / XHCI_LEGSUP_POLLING_DELAY_1MS); i++) {
-		usb_log_debug("LEGSUP: elapsed: %i ms, bios: %x, os: %x", i,
-		    XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_BIOS),
-		    XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_OS));
-		if (XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_BIOS) == 0) {
-			return XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_OS) == 1 ? EOK : EIO;
-		}
-		fibril_usleep(XHCI_LEGSUP_POLLING_DELAY_1MS);
-	}
-	usb_log_error("BIOS did not release XHCI legacy hold!");
-
-	return ENOTSUP;
-}
-
-/**
- * Ask the xHC to reset its state. Implements sequence
- */
-static errno_t hc_reset(xhci_hc_t *hc)
-{
-	if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_CNR), 0))
-		return ETIMEOUT;
-
-	/* Stop the HC: set R/S to 0 */
-	XHCI_REG_CLR(hc->op_regs, XHCI_OP_RS, 1);
-
-	/* Wait until the HC is halted - it shall take at most 16 ms */
-	if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_HCH),
-	    XHCI_REG_MASK(XHCI_OP_HCH)))
-		return ETIMEOUT;
-
-	/* Reset */
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_HCRST, 1);
-
-	/* Wait until the reset is complete */
-	if (xhci_reg_wait(&hc->op_regs->usbcmd, XHCI_REG_MASK(XHCI_OP_HCRST), 0))
-		return ETIMEOUT;
-
-	return EOK;
-}
-
-/**
- * Initialize the HC: section 4.2
- */
-errno_t hc_start(xhci_hc_t *hc)
-{
-	errno_t err;
-
-	if ((err = hc_reset(hc)))
-		return err;
-
-	if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_CNR), 0))
-		return ETIMEOUT;
-
-	uintptr_t dcbaa_phys = dma_buffer_phys_base(&hc->dcbaa_dma);
-	XHCI_REG_WR(hc->op_regs, XHCI_OP_DCBAAP, dcbaa_phys);
-	XHCI_REG_WR(hc->op_regs, XHCI_OP_MAX_SLOTS_EN, hc->max_slots);
-
-	uintptr_t crcr;
-	xhci_trb_ring_reset_dequeue_state(&hc->cr.trb_ring, &crcr);
-	XHCI_REG_WR(hc->op_regs, XHCI_OP_CRCR, crcr);
-
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_EWE, 1);
-
-	xhci_event_ring_reset(&hc->event_ring);
-
-	xhci_interrupter_regs_t *intr0 = &hc->rt_regs->ir[0];
-	XHCI_REG_WR(intr0, XHCI_INTR_ERSTSZ, hc->event_ring.segment_count);
-	XHCI_REG_WR(intr0, XHCI_INTR_ERDP, hc->event_ring.dequeue_ptr);
-
-	const uintptr_t erstba_phys = dma_buffer_phys_base(&hc->event_ring.erst);
-	XHCI_REG_WR(intr0, XHCI_INTR_ERSTBA, erstba_phys);
-
-	if (cap_handle_valid(hc->base.irq_handle)) {
-		XHCI_REG_SET(intr0, XHCI_INTR_IE, 1);
-		XHCI_REG_SET(hc->op_regs, XHCI_OP_INTE, 1);
-	}
-
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_HSEE, 1);
-
-	xhci_sw_ring_restart(&hc->sw_ring);
-	joinable_fibril_start(hc->event_worker);
-
-	xhci_start_command_ring(hc);
-
-	XHCI_REG_SET(hc->op_regs, XHCI_OP_RS, 1);
-
-	/* RH needs to access port states on startup */
-	xhci_rh_start(&hc->rh);
-
-	return EOK;
-}
-
-static void hc_stop(xhci_hc_t *hc)
-{
-	/* Stop the HC in hardware. */
-	XHCI_REG_CLR(hc->op_regs, XHCI_OP_RS, 1);
-
-	/*
-	 * Wait until the HC is halted - it shall take at most 16 ms.
-	 * Note that we ignore the return value here.
-	 */
-	xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_HCH),
-	    XHCI_REG_MASK(XHCI_OP_HCH));
-
-	/* Make sure commands will not block other fibrils. */
-	xhci_nuke_command_ring(hc);
-
-	/* Stop the event worker fibril to restart it */
-	xhci_sw_ring_stop(&hc->sw_ring);
-	joinable_fibril_join(hc->event_worker);
-
-	/*
-	 * Then, disconnect all roothub devices, which shall trigger
-	 * disconnection of everything
-	 */
-	xhci_rh_stop(&hc->rh);
-}
-
-static void hc_reinitialize(xhci_hc_t *hc)
-{
-	/* Stop everything. */
-	hc_stop(hc);
-
-	usb_log_info("HC stopped. Starting again...");
-
-	/* The worker fibrils need to be started again */
-	joinable_fibril_recreate(hc->event_worker);
-	joinable_fibril_recreate(hc->rh.event_worker);
-
-	/* Now, the HC shall be stopped and software shall be clean. */
-	hc_start(hc);
-}
-
-static bool hc_is_broken(xhci_hc_t *hc)
-{
-	const uint32_t usbcmd = XHCI_REG_RD_FIELD(&hc->op_regs->usbcmd, 32);
-	const uint32_t usbsts = XHCI_REG_RD_FIELD(&hc->op_regs->usbsts, 32);
-
-	return !(usbcmd & XHCI_REG_MASK(XHCI_OP_RS)) ||
-	    (usbsts & XHCI_REG_MASK(XHCI_OP_HCE)) ||
-	    (usbsts & XHCI_REG_MASK(XHCI_OP_HSE));
-}
-
-/**
- * Used only when polling. Shall supplement the irq_commands.
- */
-errno_t hc_status(bus_t *bus, uint32_t *status)
-{
-	xhci_hc_t *hc = bus_to_hc(bus);
-	int ip = XHCI_REG_RD(hc->rt_regs->ir, XHCI_INTR_IP);
-	if (ip) {
-		*status = XHCI_REG_RD(hc->op_regs, XHCI_OP_STATUS);
-		XHCI_REG_WR(hc->op_regs, XHCI_OP_STATUS, *status & XHCI_STATUS_ACK_MASK);
-		XHCI_REG_WR(hc->rt_regs->ir, XHCI_INTR_IP, 1);
-
-		/*
-		 * interrupt handler expects status from irq_commands, which is
-		 * in xhci order.
-		 */
-		*status = host2xhci(32, *status);
-	}
-
-	usb_log_debug("Polled status: %x", *status);
-	return EOK;
-}
-
-static errno_t xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb)
-{
-	struct timespec ts;
-	getuptime(&ts);
-	usb_log_debug("Microframe index wrapped (@%lld.%lld, %" PRIu64 " total).",
-	    ts.tv_sec, NSEC2USEC(ts.tv_nsec), hc->wrap_count);
-	hc->wrap_time = SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec);
-	++hc->wrap_count;
-	return EOK;
-}
-
-typedef errno_t (*event_handler) (xhci_hc_t *, xhci_trb_t *trb);
-
-/**
- * These events are handled by separate event handling fibril.
- */
-static event_handler event_handlers [] = {
-	[XHCI_TRB_TYPE_TRANSFER_EVENT] = &xhci_handle_transfer_event,
-};
-
-/**
- * These events are handled directly in the interrupt handler, thus they must
- * not block waiting for another interrupt.
- */
-static event_handler event_handlers_fast [] = {
-	[XHCI_TRB_TYPE_COMMAND_COMPLETION_EVENT] = &xhci_handle_command_completion,
-	[XHCI_TRB_TYPE_MFINDEX_WRAP_EVENT] = &xhci_handle_mfindex_wrap_event,
-};
-
-static errno_t hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb)
-{
-	const unsigned type = TRB_TYPE(*trb);
-
-	if (type <= ARRAY_SIZE(event_handlers_fast) && event_handlers_fast[type])
-		return event_handlers_fast[type](hc, trb);
-
-	if (type <= ARRAY_SIZE(event_handlers) && event_handlers[type])
-		return xhci_sw_ring_enqueue(&hc->sw_ring, trb);
-
-	if (type == XHCI_TRB_TYPE_PORT_STATUS_CHANGE_EVENT)
-		return xhci_sw_ring_enqueue(&hc->rh.event_ring, trb);
-
-	return ENOTSUP;
-}
-
-static int event_worker(void *arg)
-{
-	errno_t err;
-	xhci_trb_t trb;
-	xhci_hc_t *const hc = arg;
-	assert(hc);
-
-	while (xhci_sw_ring_dequeue(&hc->sw_ring, &trb) != EINTR) {
-		const unsigned type = TRB_TYPE(trb);
-
-		if ((err = event_handlers[type](hc, &trb)))
-			usb_log_error("Failed to handle event: %s", str_error(err));
-	}
-
-	return 0;
-}
-
-/**
- * Dequeue from event ring and handle dequeued events.
- *
- * As there can be events, that blocks on waiting for subsequent events,
- * we solve this problem by deferring some types of events to separate fibrils.
- */
-static void hc_run_event_ring(xhci_hc_t *hc, xhci_event_ring_t *event_ring,
-    xhci_interrupter_regs_t *intr)
-{
-	errno_t err;
-
-	xhci_trb_t trb;
-	hc->event_handler = fibril_get_id();
-
-	while ((err = xhci_event_ring_dequeue(event_ring, &trb)) != ENOENT) {
-		if ((err = hc_handle_event(hc, &trb)) != EOK) {
-			usb_log_error("Failed to handle event in interrupt: %s", str_error(err));
-		}
-
-		XHCI_REG_WR(intr, XHCI_INTR_ERDP, hc->event_ring.dequeue_ptr);
-	}
-
-	hc->event_handler = 0;
-
-	uint64_t erdp = hc->event_ring.dequeue_ptr;
-	erdp |= XHCI_REG_MASK(XHCI_INTR_ERDP_EHB);
-	XHCI_REG_WR(intr, XHCI_INTR_ERDP, erdp);
-
-	usb_log_debug2("Event ring run finished.");
-}
-
-/**
- * Handle an interrupt request from xHC. Resolve all situations that trigger an
- * interrupt separately.
- *
- * Note that all RW1C bits in USBSTS register are cleared at the time of
- * handling the interrupt in irq_code. This method is the top-half.
- *
- * @param status contents of USBSTS register at the time of the interrupt.
- */
-void hc_interrupt(bus_t *bus, uint32_t status)
-{
-	xhci_hc_t *hc = bus_to_hc(bus);
-	status = xhci2host(32, status);
-
-	if (status & XHCI_REG_MASK(XHCI_OP_HSE)) {
-		usb_log_error("Host system error occured. Aren't we supposed to be dead already?");
-		return;
-	}
-
-	if (status & XHCI_REG_MASK(XHCI_OP_HCE)) {
-		usb_log_error("Host controller error occured. Reinitializing...");
-		hc_reinitialize(hc);
-		return;
-	}
-
-	if (status & XHCI_REG_MASK(XHCI_OP_EINT)) {
-		usb_log_debug2("Event interrupt, running the event ring.");
-		hc_run_event_ring(hc, &hc->event_ring, &hc->rt_regs->ir[0]);
-		status &= ~XHCI_REG_MASK(XHCI_OP_EINT);
-	}
-
-	if (status & XHCI_REG_MASK(XHCI_OP_SRE)) {
-		usb_log_error("Save/Restore error occured. WTF, "
-		    "S/R mechanism not implemented!");
-		status &= ~XHCI_REG_MASK(XHCI_OP_SRE);
-	}
-
-	/* According to Note on p. 302, we may safely ignore the PCD bit. */
-	status &= ~XHCI_REG_MASK(XHCI_OP_PCD);
-
-	if (status) {
-		usb_log_error("Non-zero status after interrupt handling (%08x) "
-		    " - missing something?", status);
-	}
-}
-
-/**
- * Tear down all in-memory structures.
- */
-void hc_fini(xhci_hc_t *hc)
-{
-	hc_stop(hc);
-
-	xhci_sw_ring_fini(&hc->sw_ring);
-	joinable_fibril_destroy(hc->event_worker);
-	xhci_bus_fini(&hc->bus);
-	xhci_event_ring_fini(&hc->event_ring);
-	xhci_scratchpad_free(hc);
-	dma_buffer_free(&hc->dcbaa_dma);
-	xhci_fini_commands(hc);
-	xhci_rh_fini(&hc->rh);
-	pio_disable(hc->reg_base, RNGSZ(hc->mmio_range));
-	usb_log_info("Finalized.");
-}
-
-/**
- * Quiesce host controller.
- */
-errno_t hc_quiesce(xhci_hc_t *hc)
-{
-	hc_stop(hc);
-	usb_log_info("HC quiesced.");
-	return EOK;
-}
-
-unsigned hc_speed_to_psiv(usb_speed_t speed)
-{
-	assert(speed < ARRAY_SIZE(usb_speed_to_psiv));
-	return usb_speed_to_psiv[speed];
-}
-
-/**
- * Ring a xHC Doorbell. Implements section 4.7.
- */
-void hc_ring_doorbell(xhci_hc_t *hc, unsigned doorbell, unsigned target)
-{
-	assert(hc);
-	uint32_t v = host2xhci(32, target & BIT_RRANGE(uint32_t, 7));
-	pio_write_32(&hc->db_arry[doorbell], v);
-	usb_log_debug2("Ringing doorbell %d (target: %d)", doorbell, target);
-}
-
-/**
- * Return an index to device context.
- */
-static uint8_t endpoint_dci(xhci_endpoint_t *ep)
-{
-	return (2 * ep->base.endpoint) +
-	    (ep->base.transfer_type == USB_TRANSFER_CONTROL ||
-	    ep->base.direction == USB_DIRECTION_IN);
-}
-
-void hc_ring_ep_doorbell(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	const uint8_t dci = endpoint_dci(ep);
-	const uint32_t target = (stream_id << 16) | (dci & 0x1ff);
-	hc_ring_doorbell(hc, dev->slot_id, target);
-}
-
-/**
- * Issue an Enable Slot command. Allocate memory for the slot and fill the
- * DCBAA with the newly created slot.
- */
-errno_t hc_enable_slot(xhci_device_t *dev)
-{
-	errno_t err;
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-
-	/* Prepare memory for the context */
-	if ((err = dma_buffer_alloc(&dev->dev_ctx, XHCI_DEVICE_CTX_SIZE(hc))))
-		return err;
-	memset(dev->dev_ctx.virt, 0, XHCI_DEVICE_CTX_SIZE(hc));
-
-	/* Get the slot number */
-	xhci_cmd_t cmd;
-	xhci_cmd_init(&cmd, XHCI_CMD_ENABLE_SLOT);
-
-	err = xhci_cmd_sync(hc, &cmd);
-
-	/* Link them together */
-	if (err == EOK) {
-		dev->slot_id = cmd.slot_id;
-		hc->dcbaa[dev->slot_id] =
-		    host2xhci(64, dma_buffer_phys_base(&dev->dev_ctx));
-	}
-
-	xhci_cmd_fini(&cmd);
-
-	if (err)
-		dma_buffer_free(&dev->dev_ctx);
-
-	return err;
-}
-
-/**
- * Issue a Disable Slot command for a slot occupied by device.
- * Frees the device context.
- */
-errno_t hc_disable_slot(xhci_device_t *dev)
-{
-	errno_t err;
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_cmd_t cmd;
-
-	xhci_cmd_init(&cmd, XHCI_CMD_DISABLE_SLOT);
-	cmd.slot_id = dev->slot_id;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-	if (err != EOK)
-		return err;
-
-	/* Free the device context. */
-	hc->dcbaa[dev->slot_id] = 0;
-	dma_buffer_free(&dev->dev_ctx);
-
-	/* Mark the slot as invalid. */
-	dev->slot_id = 0;
-
-	return EOK;
-}
-
-/**
- * Prepare an empty Endpoint Input Context inside a dma buffer.
- */
-static errno_t create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
-{
-	const xhci_hc_t *hc = bus_to_hc(dev->base.bus);
-	const errno_t err = dma_buffer_alloc(dma_buf, XHCI_INPUT_CTX_SIZE(hc));
-	if (err)
-		return err;
-
-	xhci_input_ctx_t *ictx = dma_buf->virt;
-	memset(ictx, 0, XHCI_INPUT_CTX_SIZE(hc));
-
-	// Quoting sec. 4.6.5 and 4.6.6: A1, D0, D1 are down (already zeroed), A0 is up.
-	XHCI_INPUT_CTRL_CTX_ADD_SET(*XHCI_GET_CTRL_CTX(ictx, hc), 0);
-	xhci_slot_ctx_t *slot_ctx = XHCI_GET_SLOT_CTX(XHCI_GET_DEVICE_CTX(ictx, hc), hc);
-	xhci_setup_slot_context(dev, slot_ctx);
-
-	return EOK;
-}
-
-/**
- * Initialize a device, assigning it an address. Implements section 4.3.4.
- *
- * @param dev Device to assing an address (unconfigured yet)
- */
-errno_t hc_address_device(xhci_device_t *dev)
-{
-	errno_t err = ENOMEM;
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_endpoint_t *ep0 = xhci_endpoint_get(dev->base.endpoints[0]);
-
-	/*
-	 * Although we have the precise PSIV value on devices of tier 1,
-	 * we have to rely on reverse mapping on others.
-	 */
-	if (!usb_speed_to_psiv[dev->base.speed]) {
-		usb_log_error("Device reported an USB speed (%s) that cannot be mapped "
-		    "to HC port speed.", usb_str_speed(dev->base.speed));
-		return EINVAL;
-	}
-
-	/* Issue configure endpoint command (sec 4.3.5).  */
-	dma_buffer_t ictx_dma_buf;
-	if ((err = create_configure_ep_input_ctx(dev, &ictx_dma_buf)))
-		return err;
-	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
-
-	/* Copy endpoint 0 context and set A1 flag. */
-	XHCI_INPUT_CTRL_CTX_ADD_SET(*XHCI_GET_CTRL_CTX(ictx, hc), 1);
-	xhci_ep_ctx_t *ep_ctx = XHCI_GET_EP_CTX(XHCI_GET_DEVICE_CTX(ictx, hc), hc, 1);
-	xhci_setup_endpoint_context(ep0, ep_ctx);
-
-	/* Address device needs Ctx entries set to 1 only */
-	xhci_slot_ctx_t *slot_ctx = XHCI_GET_SLOT_CTX(XHCI_GET_DEVICE_CTX(ictx, hc), hc);
-	XHCI_SLOT_CTX_ENTRIES_SET(*slot_ctx, 1);
-
-	/* Issue Address Device command. */
-	xhci_cmd_t cmd;
-	xhci_cmd_init(&cmd, XHCI_CMD_ADDRESS_DEVICE);
-	cmd.slot_id = dev->slot_id;
-	cmd.input_ctx = ictx_dma_buf;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-	if (err != EOK)
-		return err;
-
-	xhci_device_ctx_t *device_ctx = dev->dev_ctx.virt;
-	dev->base.address = XHCI_SLOT_DEVICE_ADDRESS(*XHCI_GET_SLOT_CTX(device_ctx, hc));
-	usb_log_debug("Obtained USB address: %d.", dev->base.address);
-
-	return EOK;
-}
-
-/**
- * Issue a Configure Device command for a device in slot.
- *
- * @param slot_id Slot ID assigned to the device.
- */
-errno_t hc_configure_device(xhci_device_t *dev)
-{
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_cmd_t cmd;
-
-	/* Issue configure endpoint command (sec 4.3.5).  */
-	dma_buffer_t ictx_dma_buf;
-	errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
-	if (err != EOK)
-		return err;
-
-	xhci_cmd_init(&cmd, XHCI_CMD_CONFIGURE_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.input_ctx = ictx_dma_buf;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Issue a Deconfigure Device command for a device in slot.
- *
- * @param dev The owner of the device
- */
-errno_t hc_deconfigure_device(xhci_device_t *dev)
-{
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_cmd_t cmd;
-	errno_t err;
-
-	if (hc_is_broken(hc))
-		return EOK;
-
-	/* Issue configure endpoint command (sec 4.3.5) with the DC flag.  */
-	xhci_cmd_init(&cmd, XHCI_CMD_CONFIGURE_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.deconfigure = true;
-
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Instruct xHC to add an endpoint with supplied endpoint context.
- *
- * @param dev The owner of the device
- * @param ep_idx Endpoint DCI in question
- * @param ep_ctx Endpoint context of the endpoint
- */
-errno_t hc_add_endpoint(xhci_endpoint_t *ep)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	const unsigned dci = endpoint_dci(ep);
-	xhci_cmd_t cmd;
-
-	/* Issue configure endpoint command (sec 4.3.5).  */
-	dma_buffer_t ictx_dma_buf;
-	errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
-	if (err != EOK)
-		return err;
-
-	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
-
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	XHCI_INPUT_CTRL_CTX_ADD_SET(*XHCI_GET_CTRL_CTX(ictx, hc), dci);
-
-	xhci_ep_ctx_t *ep_ctx = XHCI_GET_EP_CTX(XHCI_GET_DEVICE_CTX(ictx, hc), hc, dci);
-	xhci_setup_endpoint_context(ep, ep_ctx);
-
-	xhci_cmd_init(&cmd, XHCI_CMD_CONFIGURE_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.input_ctx = ictx_dma_buf;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Instruct xHC to drop an endpoint.
- *
- * @param dev The owner of the endpoint
- * @param ep_idx Endpoint DCI in question
- */
-errno_t hc_drop_endpoint(xhci_endpoint_t *ep)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	const unsigned dci = endpoint_dci(ep);
-	xhci_cmd_t cmd;
-
-	if (hc_is_broken(hc))
-		return EOK;
-
-	/* Issue configure endpoint command (sec 4.3.5).  */
-	dma_buffer_t ictx_dma_buf;
-	errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
-	if (err != EOK)
-		return err;
-
-	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
-	XHCI_INPUT_CTRL_CTX_DROP_SET(*XHCI_GET_CTRL_CTX(ictx, hc), dci);
-
-	xhci_cmd_init(&cmd, XHCI_CMD_CONFIGURE_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.input_ctx = ictx_dma_buf;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Instruct xHC to update information about an endpoint, using supplied
- * endpoint context.
- *
- * @param dev The owner of the endpoint
- * @param ep_idx Endpoint DCI in question
- * @param ep_ctx Endpoint context of the endpoint
- */
-errno_t hc_update_endpoint(xhci_endpoint_t *ep)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	const unsigned dci = endpoint_dci(ep);
-	xhci_cmd_t cmd;
-
-	dma_buffer_t ictx_dma_buf;
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-
-	errno_t err = dma_buffer_alloc(&ictx_dma_buf, XHCI_INPUT_CTX_SIZE(hc));
-	if (err != EOK)
-		return err;
-
-	xhci_input_ctx_t *ictx = ictx_dma_buf.virt;
-	memset(ictx, 0, XHCI_INPUT_CTX_SIZE(hc));
-
-	XHCI_INPUT_CTRL_CTX_ADD_SET(*XHCI_GET_CTRL_CTX(ictx, hc), dci);
-	xhci_ep_ctx_t *ep_ctx = XHCI_GET_EP_CTX(XHCI_GET_DEVICE_CTX(ictx, hc), hc, dci);
-	xhci_setup_endpoint_context(ep, ep_ctx);
-
-	xhci_cmd_init(&cmd, XHCI_CMD_EVALUATE_CONTEXT);
-	cmd.slot_id = dev->slot_id;
-	cmd.input_ctx = ictx_dma_buf;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Instruct xHC to stop running a transfer ring on an endpoint.
- *
- * @param dev The owner of the endpoint
- * @param ep_idx Endpoint DCI in question
- */
-errno_t hc_stop_endpoint(xhci_endpoint_t *ep)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	const unsigned dci = endpoint_dci(ep);
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_cmd_t cmd;
-	errno_t err;
-
-	if (hc_is_broken(hc))
-		return EOK;
-
-	xhci_cmd_init(&cmd, XHCI_CMD_STOP_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.endpoint_id = dci;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Instruct xHC to reset halted endpoint.
- *
- * @param dev The owner of the endpoint
- * @param ep_idx Endpoint DCI in question
- */
-errno_t hc_reset_endpoint(xhci_endpoint_t *ep)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	const unsigned dci = endpoint_dci(ep);
-	xhci_hc_t *const hc = bus_to_hc(dev->base.bus);
-	xhci_cmd_t cmd;
-	errno_t err;
-
-	xhci_cmd_init(&cmd, XHCI_CMD_RESET_ENDPOINT);
-	cmd.slot_id = dev->slot_id;
-	cmd.endpoint_id = dci;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * Reset a ring position in both software and hardware.
- *
- * @param dev The owner of the endpoint
- */
-errno_t hc_reset_ring(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	xhci_device_t *const dev = xhci_ep_to_dev(ep);
-	const unsigned dci = endpoint_dci(ep);
-	uintptr_t addr;
-	xhci_cmd_t cmd;
-	errno_t err;
-
-	xhci_trb_ring_t *ring = xhci_endpoint_get_ring(ep, stream_id);
-	xhci_trb_ring_reset_dequeue_state(ring, &addr);
-
-	xhci_hc_t *const hc = bus_to_hc(endpoint_get_bus(&ep->base));
-
-	xhci_cmd_init(&cmd, XHCI_CMD_SET_TR_DEQUEUE_POINTER);
-	cmd.slot_id = dev->slot_id;
-	cmd.endpoint_id = dci;
-	cmd.stream_id = stream_id;
-	cmd.dequeue_ptr = addr;
-	err = xhci_cmd_sync(hc, &cmd);
-	xhci_cmd_fini(&cmd);
-
-	return err;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/hc.h
===================================================================
--- uspace/drv/bus/usb/xhci/hc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach, Jaroslav Jindrak, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller data bookkeeping.
- */
-
-#ifndef XHCI_HC_H
-#define XHCI_HC_H
-
-#include <fibril_synch.h>
-#include <member.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/host/utility.h>
-#include "hw_struct/regs.h"
-#include "hw_struct/context.h"
-#include "scratchpad.h"
-#include "trb_ring.h"
-
-#include "rh.h"
-#include "commands.h"
-#include "bus.h"
-
-typedef struct xhci_command xhci_cmd_t;
-
-typedef struct xhci_hc {
-	/** Common HC device header */
-	hc_device_t base;
-
-	/* MMIO range */
-	addr_range_t mmio_range;
-
-	/* Mapped register sets */
-	void *reg_base;
-	xhci_cap_regs_t *cap_regs;
-	xhci_op_regs_t *op_regs;
-	xhci_rt_regs_t *rt_regs;
-	xhci_doorbell_t *db_arry;
-	xhci_extcap_t *xecp;		/**< First extended capability */
-	xhci_legsup_t *legsup;		/**< Legacy support capability */
-
-	/* Structures in allocated memory */
-	xhci_event_ring_t event_ring;
-	uint64_t *dcbaa;
-	dma_buffer_t dcbaa_dma;
-	dma_buffer_t scratchpad_array;
-
-	/* Command ring management */
-	xhci_cmd_ring_t cr;
-
-	/* Buffer for events */
-	xhci_sw_ring_t sw_ring;
-
-	/** Event handling fibril */
-	joinable_fibril_t *event_worker;
-
-	/* Root hub emulation */
-	xhci_rh_t rh;
-
-	/* Bus bookkeeping */
-	xhci_bus_t bus;
-
-	/* Fibril that is currently hanling events */
-	fid_t event_handler;
-
-	/* Cached capabilities */
-	unsigned max_slots;
-	bool ac64;
-	bool csz;
-	uint64_t wrap_time;	/**< The last time when mfindex wrap happened */
-	uint64_t wrap_count;	/**< Amount of mfindex wraps HC has done */
-	unsigned ist;		/**< IST in microframes */
-
-	/** Port speed mapping */
-	xhci_port_speed_t speeds [16];
-} xhci_hc_t;
-
-static inline xhci_hc_t *bus_to_hc(bus_t *bus)
-{
-	assert(bus);
-	return member_to_inst(bus, xhci_hc_t, bus);
-}
-
-typedef struct xhci_endpoint xhci_endpoint_t;
-typedef struct xhci_device xhci_device_t;
-
-extern errno_t hc_init_mmio(xhci_hc_t *, const hw_res_list_parsed_t *);
-extern errno_t hc_init_memory(xhci_hc_t *, ddf_dev_t *);
-extern errno_t hc_claim(xhci_hc_t *, ddf_dev_t *);
-extern errno_t hc_irq_code_gen(irq_code_t *, xhci_hc_t *, const hw_res_list_parsed_t *, int *);
-extern errno_t hc_start(xhci_hc_t *);
-extern void hc_fini(xhci_hc_t *);
-extern errno_t hc_quiesce(xhci_hc_t *);
-
-extern void hc_ring_doorbell(xhci_hc_t *, unsigned, unsigned);
-extern void hc_ring_ep_doorbell(xhci_endpoint_t *, uint32_t);
-extern unsigned hc_speed_to_psiv(usb_speed_t);
-
-extern errno_t hc_enable_slot(xhci_device_t *);
-extern errno_t hc_disable_slot(xhci_device_t *);
-extern errno_t hc_address_device(xhci_device_t *);
-extern errno_t hc_configure_device(xhci_device_t *);
-extern errno_t hc_deconfigure_device(xhci_device_t *);
-extern errno_t hc_add_endpoint(xhci_endpoint_t *);
-extern errno_t hc_drop_endpoint(xhci_endpoint_t *);
-extern errno_t hc_update_endpoint(xhci_endpoint_t *);
-extern errno_t hc_stop_endpoint(xhci_endpoint_t *);
-extern errno_t hc_reset_endpoint(xhci_endpoint_t *);
-extern errno_t hc_reset_ring(xhci_endpoint_t *, uint32_t);
-
-extern errno_t hc_status(bus_t *, uint32_t *);
-extern void hc_interrupt(bus_t *, uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/hw_struct/README
===================================================================
--- uspace/drv/bus/usb/xhci/hw_struct/README	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-This folder contains hardware communication structures and constants, as defined
-in chapter 6 of the xHCI specification. It shall not be modified, as it reflects
-the order hardware expects it.
Index: pace/drv/bus/usb/xhci/hw_struct/common.h
===================================================================
--- uspace/drv/bus/usb/xhci/hw_struct/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief Common macros for HW structures.
- *
- * There are a lot of data structures that are defined on bit-basis.
- * Therefore, we provide macros to define getters and setters.
- */
-
-#ifndef XHCI_COMMON_H
-#define XHCI_COMMON_H
-
-#include <assert.h>
-#include <bitops.h>
-#include <byteorder.h>
-#include <ddi.h>
-#include <errno.h>
-#include <fibril.h>
-
-#define host2xhci(size, val) host2uint##size##_t_le((val))
-#define xhci2host(size, val) uint##size##_t_le2host((val))
-
-/**
- * 4 bytes, little-endian.
- */
-typedef ioport32_t xhci_dword_t;
-
-/**
- * 8 bytes, little-endian.
- */
-typedef volatile uint64_t xhci_qword_t;
-
-#define XHCI_DWORD_EXTRACT(field, hi, lo) \
-	(BIT_RANGE_EXTRACT(uint32_t, hi, lo, xhci2host(32, field)))
-#define XHCI_QWORD_EXTRACT(field, hi, lo) \
-	(BIT_RANGE_EXTRACT(uint64_t, hi, lo, xhci2host(64, field)))
-
-/**
- * Common base for setters on xhci_dword_t storage.
- *
- * Not thread-safe, proper synchronization over this dword must be assured.
- */
-static inline void xhci_dword_set_bits(xhci_dword_t *storage, uint32_t value,
-    unsigned hi, unsigned lo)
-{
-	const uint32_t mask = host2xhci(32, BIT_RANGE(uint32_t, hi, lo));
-	const uint32_t set = host2xhci(32, value << lo);
-	*storage = (*storage & ~mask) | set;
-}
-
-/**
- * Setter for whole qword.
- */
-static inline void xhci_qword_set(xhci_qword_t *storage, uint64_t value)
-{
-	*storage = host2xhci(64, value);
-}
-
-static inline void xhci_qword_set_bits(xhci_qword_t *storage, uint64_t value,
-    unsigned hi, unsigned lo)
-{
-	const uint64_t mask = host2xhci(64, BIT_RANGE(uint64_t, hi, lo));
-	const uint64_t set = host2xhci(64, value << lo);
-	*storage = (*storage & ~mask) | set;
-}
-
-static inline int xhci_reg_wait(xhci_dword_t *reg, uint32_t mask,
-    uint32_t expected)
-{
-	mask = host2xhci(32, mask);
-	expected = host2xhci(32, expected);
-
-	unsigned retries = 100;
-	uint32_t value = *reg & mask;
-
-	for (; retries > 0 && value != expected; --retries) {
-		fibril_usleep(10000);
-		value = *reg & mask;
-	}
-
-	return value == expected ? EOK : ETIMEOUT;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/hw_struct/context.h
===================================================================
--- uspace/drv/bus/usb/xhci/hw_struct/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,285 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch, Jaroslav Jindrak, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Context data structures of the xHC.
- *
- * Most of them are to be initialized to zero and passed ownership to the HC,
- * so they are mostly read-only.
- *
- * Feel free to write a setter when in need.
- */
-
-#ifndef XHCI_CONTEXT_H
-#define XHCI_CONTEXT_H
-
-#include <stdint.h>
-#include "common.h"
-
-/**
- * Endpoint context: section 6.2.3
- */
-typedef struct xhci_endpoint_ctx {
-	xhci_dword_t data[2];
-	xhci_qword_t data2;
-	xhci_dword_t data3;
-	xhci_dword_t reserved[3];
-} xhci_ep_ctx_t;
-
-#define XHCI_EP_COUNT 31
-
-#define XHCI_EP_TYPE_ISOCH_OUT		1
-#define XHCI_EP_TYPE_BULK_OUT		2
-#define XHCI_EP_TYPE_INTERRUPT_OUT	3
-#define XHCI_EP_TYPE_CONTROL		4
-#define XHCI_EP_TYPE_ISOCH_IN		5
-#define XHCI_EP_TYPE_BULK_IN		6
-#define XHCI_EP_TYPE_INTERRUPT_IN	7
-
-#define XHCI_EP_TYPE_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 5, 3)
-#define XHCI_EP_MAX_PACKET_SIZE_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 31, 16)
-#define XHCI_EP_MAX_BURST_SIZE_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 15, 8)
-#define XHCI_EP_TR_DPTR_SET(ctx, val) \
-	xhci_qword_set_bits(&(ctx).data2, (val >> 4), 63, 4)
-#define XHCI_EP_DCS_SET(ctx, val) \
-	xhci_qword_set_bits(&(ctx).data2, val, 0, 0)
-#define XHCI_EP_MAX_ESIT_PAYLOAD_LO_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data3, val, 31, 16)
-#define XHCI_EP_MAX_ESIT_PAYLOAD_HI_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 31, 24)
-#define XHCI_EP_INTERVAL_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 23, 16)
-#define XHCI_EP_MAX_P_STREAMS_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 14, 10)
-#define XHCI_EP_LSA_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 15, 15)
-#define XHCI_EP_MULT_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 9, 8)
-#define XHCI_EP_ERROR_COUNT_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 2, 1)
-
-#define XHCI_EP_STATE(ctx)              XHCI_DWORD_EXTRACT((ctx).data[0],  2,  0)
-#define XHCI_EP_MULT(ctx)               XHCI_DWORD_EXTRACT((ctx).data[0],  9,  8)
-#define XHCI_EP_MAX_P_STREAMS(ctx)      XHCI_DWORD_EXTRACT((ctx).data[0], 14, 10)
-#define XHCI_EP_LSA(ctx)                XHCI_DWORD_EXTRACT((ctx).data[0], 15, 15)
-#define XHCI_EP_INTERVAL(ctx)           XHCI_DWORD_EXTRACT((ctx).data[0], 23, 16)
-
-#define XHCI_EP_ERROR_COUNT(ctx)        XHCI_DWORD_EXTRACT((ctx).data[1],  2,  1)
-#define XHCI_EP_TYPE(ctx)               XHCI_DWORD_EXTRACT((ctx).data[1],  5,  3)
-#define XHCI_EP_HID(ctx)                XHCI_DWORD_EXTRACT((ctx).data[1],  7,  7)
-#define XHCI_EP_MAX_BURST_SIZE(ctx)     XHCI_DWORD_EXTRACT((ctx).data[1], 15,  8)
-#define XHCI_EP_MAX_PACKET_SIZE(ctx)    XHCI_DWORD_EXTRACT((ctx).data[1], 31, 16)
-
-#define XHCI_EP_DCS(ctx)                XHCI_QWORD_EXTRACT((ctx).data2,  0,  0)
-#define XHCI_EP_TR_DPTR(ctx)            XHCI_QWORD_EXTRACT((ctx).data2, 63,  4)
-
-#define XHCI_EP_MAX_ESIT_PAYLOAD_LO(ctx) XHCI_DWORD_EXTRACT((ctx).data3, 31, 16)
-#define XHCI_EP_MAX_ESIT_PAYLOAD_HI(ctx) XHCI_DWORD_EXTRACT((ctx).data[0], 31, 24)
-
-enum {
-	EP_STATE_DISABLED = 0,
-	EP_STATE_RUNNING = 1,
-	EP_STATE_HALTED = 2,
-	EP_STATE_STOPPED = 3,
-	EP_STATE_ERROR = 4,
-};
-
-/**
- * Slot context: section 6.2.2
- */
-typedef struct xhci_slot_ctx {
-	xhci_dword_t data [4];
-	xhci_dword_t reserved [4];
-} xhci_slot_ctx_t;
-
-#define XHCI_SLOT_ROUTE_STRING_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], (val & 0xFFFFF), 19, 0)
-#define XHCI_SLOT_SPEED_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], (val & 0xF), 23, 20)
-#define XHCI_SLOT_MTT_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], !!val, 25, 25)
-#define XHCI_SLOT_HUB_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], !!val, 26, 26)
-#define XHCI_SLOT_CTX_ENTRIES_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[0], val, 31, 27)
-
-#define XHCI_SLOT_ROOT_HUB_PORT_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 23, 16)
-#define XHCI_SLOT_NUM_PORTS_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[1], val, 31, 24)
-
-#define XHCI_SLOT_TT_HUB_SLOT_ID_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[2], (val & 0xFF), 7, 0)
-#define XHCI_SLOT_TT_HUB_PORT_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[2], (val & 0xFF), 15, 8)
-#define XHCI_SLOT_TT_THINK_TIME_SET(ctx, val) \
-	xhci_dword_set_bits(&(ctx).data[2], (val & 0xFF), 17, 16)
-
-#define XHCI_SLOT_ROUTE_STRING(ctx)     XHCI_DWORD_EXTRACT((ctx).data[0], 19,  0)
-#define XHCI_SLOT_SPEED(ctx)            XHCI_DWORD_EXTRACT((ctx).data[0], 23, 20)
-#define XHCI_SLOT_MTT(ctx)              XHCI_DWORD_EXTRACT((ctx).data[0], 25, 25)
-#define XHCI_SLOT_HUB(ctx)              XHCI_DWORD_EXTRACT((ctx).data[0], 26, 26)
-#define XHCI_SLOT_CTX_ENTRIES(ctx)      XHCI_DWORD_EXTRACT((ctx).data[0], 31, 27)
-
-#define XHCI_SLOT_MAX_EXIT_LATENCY(ctx) XHCI_DWORD_EXTRACT((ctx).data[1], 15,  0)
-#define XHCI_SLOT_ROOT_HUB_PORT(ctx)    XHCI_DWORD_EXTRACT((ctx).data[1], 23, 16)
-#define XHCI_SLOT_NUM_PORTS(ctx)        XHCI_DWORD_EXTRACT((ctx).data[1], 31, 24)
-
-#define XHCI_SLOT_TT_HUB_SLOT_ID(ctx)   XHCI_DWORD_EXTRACT((ctx).data[2],  7,  0)
-#define XHCI_SLOT_TT_PORT_NUM(ctx)      XHCI_DWORD_EXTRACT((ctx).data[2], 15,  8)
-#define XHCI_SLOT_TT_THINK_TIME(ctx)    XHCI_DWORD_EXTRACT((ctx).data[2], 17, 16)
-#define XHCI_SLOT_INTERRUPTER(ctx)      XHCI_DWORD_EXTRACT((ctx).data[2], 31, 22)
-
-#define XHCI_SLOT_DEVICE_ADDRESS(ctx)   XHCI_DWORD_EXTRACT((ctx).data[3],  7,  0)
-#define XHCI_SLOT_STATE(ctx)            XHCI_DWORD_EXTRACT((ctx).data[3], 31, 27)
-
-enum {
-	SLOT_STATE_DISABLED = 0,
-	SLOT_STATE_DEFAULT = 1,
-	SLOT_STATE_ADDRESS = 2,
-	SLOT_STATE_CONFIGURED = 3,
-};
-
-/**
- * Handling HCs with 32 or 64-bytes context size (CSZ)
- */
-#define XHCI_CTX_SIZE_SMALL 32
-#define XHCI_ONE_CTX_SIZE(hc) (XHCI_CTX_SIZE_SMALL << hc->csz)
-#define XHCI_GET_CTX_FIELD(type, ctx, hc, ci) \
-    (xhci_##type##_ctx_to_charptr(ctx) + (ci) * XHCI_ONE_CTX_SIZE(hc))
-
-/**
- * Device context: section 6.2.1
- */
-#define XHCI_DEVICE_CTX_SIZE(hc) ((1 + XHCI_EP_COUNT) * XHCI_ONE_CTX_SIZE(hc))
-#define XHCI_GET_EP_CTX(dev_ctx, hc, dci) \
-    ((xhci_ep_ctx_t *)   XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), (dci)))
-#define XHCI_GET_SLOT_CTX(dev_ctx, hc) \
-    ((xhci_slot_ctx_t *) XHCI_GET_CTX_FIELD(device, (dev_ctx), (hc), 0))
-
-/**
- * As control, slot and endpoint contexts differ in size on different HCs,
- * we need to use macros to access them at the correct offsets. The following
- * empty structs (xhci_device_ctx_t and xhci_input_ctx_t) are used only as
- * void pointers for type-checking.
- */
-typedef struct xhci_device_ctx {
-} xhci_device_ctx_t;
-
-/**
- * Force type checking.
- */
-static inline char *xhci_device_ctx_to_charptr(const xhci_device_ctx_t *ctx)
-{
-	return (char *) ctx;
-}
-
-/**
- * Stream context: section 6.2.4 {
- */
-typedef struct xhci_stream_ctx {
-	uint64_t data [2];
-} xhci_stream_ctx_t;
-
-#define XHCI_STREAM_DCS(ctx)     XHCI_QWORD_EXTRACT((ctx).data[0],  0, 0)
-#define XHCI_STREAM_SCT(ctx)     XHCI_QWORD_EXTRACT((ctx).data[0],  3, 1)
-#define XHCI_STREAM_DEQ_PTR(ctx) (XHCI_QWORD_EXTRACT((ctx).data[0], 63, 4) << 4)
-#define XHCI_STREAM_EDTLA(ctx)   XHCI_QWORD_EXTRACT((ctx).data[1], 24, 0)
-
-#define XHCI_STREAM_SCT_SET(ctx, val) \
-	xhci_qword_set_bits(&(ctx).data[0], val, 3, 1)
-#define XHCI_STREAM_DEQ_PTR_SET(ctx, val) \
-	xhci_qword_set_bits(&(ctx).data[0], (val >> 4), 63, 4)
-
-/**
- * Input control context: section 6.2.5.1
- * Note: According to section 6.2.5.1 figure 78,
- *       the context size register value in hccparams1
- *       dictates whether input control context shall have
- *       32 or 64 bytes, but in any case only dwords 0, 1 and 7
- *       are used, the rest are reserved.
- */
-typedef struct xhci_input_ctrl_ctx {
-	uint32_t data [8];
-} __attribute__((packed)) xhci_input_ctrl_ctx_t;
-
-#define XHCI_INPUT_CTRL_CTX_DROP(ctx, idx) \
-    XHCI_DWORD_EXTRACT((ctx).data[0], (idx), (idx))
-
-#define XHCI_INPUT_CTRL_CTX_DROP_SET(ctx, idx) (ctx).data[0] |= (1 << (idx))
-#define XHCI_INPUT_CTRL_CTX_DROP_CLEAR(ctx, idx) (ctx).data[0] &= ~(1 << (idx))
-
-#define XHCI_INPUT_CTRL_CTX_ADD(ctx, idx) \
-    XHCI_DWORD_EXTRACT((ctx).data[1], (idx), (idx))
-
-#define XHCI_INPUT_CTRL_CTX_ADD_SET(ctx, idx) (ctx).data[1] |= (1 << (idx))
-#define XHCI_INPUT_CTRL_CTX_ADD_CLEAR(ctx, idx) (ctx).data[1] &= ~(1 << (idx))
-
-#define XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx) \
-    XHCI_DWORD_EXTRACT((ctx).data[7],  7,  0)
-#define XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx) \
-    XHCI_DWORD_EXTRACT((ctx).data[7], 15,  8)
-#define XHCI_INPUT_CTRL_CTX_ALTER_SETTING(ctx) \
-    XHCI_DWORD_EXTRACT((ctx).data[7], 23, 16)
-
-/**
- * Input context: section 6.2.5
- */
-#define XHCI_INPUT_CTX_SIZE(hc) (XHCI_ONE_CTX_SIZE(hc) + XHCI_DEVICE_CTX_SIZE(hc))
-#define XHCI_GET_CTRL_CTX(ictx, hc) \
-    ((xhci_input_ctrl_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 0))
-#define XHCI_GET_DEVICE_CTX(dev_ctx, hc) \
-    ((xhci_device_ctx_t *) XHCI_GET_CTX_FIELD(input, (ictx), (hc), 1))
-
-typedef struct xhci_input_ctx {
-} xhci_input_ctx_t;
-
-/**
- * Force type checking.
- */
-static inline char *xhci_input_ctx_to_charptr(const xhci_input_ctx_t *ctx)
-{
-	return (char *) ctx;
-}
-
-/**
- * Port bandwidth context: section 6.2.6
- * The number of ports depends on the amount of ports available to the hub.
- */
-typedef struct xhci_port_bandwidth_ctx {
-	uint8_t reserved;
-	uint8_t ports [];
-} xhci_port_bandwidth_ctx_t;
-
-#endif
Index: pace/drv/bus/usb/xhci/hw_struct/regs.h
===================================================================
--- uspace/drv/bus/usb/xhci/hw_struct/regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,604 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Memory-mapped register structures of the xHC.
- *
- * The main pr
- */
-
-#ifndef XHCI_REGS_H
-#define XHCI_REGS_H
-
-#include <macros.h>
-#include <ddi.h>
-#include "common.h"
-
-#define XHCI_PIO_CHANGE_UDELAY 5
-
-/*
- * These four are the main macros to be used.
- * Semantics is usual - READ reads value, WRITE changes value, SET sets
- * selected bits, CLEAR clears selected bits to 0.
- *
- * The key thing here is the order of macro expansion, expanding the reg_spec
- * argument as more arguments (comma delimited) for the inner macro.
- */
-#define XHCI_REG_RD(reg_set, reg_spec)         XHCI_REG_RD_INNER(reg_set, reg_spec)
-#define XHCI_REG_WR(reg_set, reg_spec, value)  XHCI_REG_WR_INNER(reg_set, value, reg_spec)
-#define XHCI_REG_SET(reg_set, reg_spec, value) XHCI_REG_SET_INNER(reg_set, value, reg_spec)
-#define XHCI_REG_CLR(reg_set, reg_spec, value) XHCI_REG_CLR_INNER(reg_set, value, reg_spec)
-#define XHCI_REG_MASK(reg_spec)                XHCI_REG_MASK_INNER(reg_spec)
-#define XHCI_REG_SHIFT(reg_spec)               XHCI_REG_SHIFT_INNER(reg_spec)
-
-/*
- * These take a pointer to the field, and selects the type-specific macro.
- */
-#define XHCI_REG_RD_INNER(reg_set, field, size, type, ...) \
-	XHCI_REG_RD_##type(&((reg_set)->field), size, ##__VA_ARGS__)
-
-#define XHCI_REG_WR_INNER(reg_set, value, field, size, type, ...) \
-	XHCI_REG_WR_##type(&(reg_set)->field, value, size, ##__VA_ARGS__)
-
-#define XHCI_REG_SET_INNER(reg_set, value, field, size, type, ...) \
-	XHCI_REG_SET_##type(&(reg_set)->field, value, size, ##__VA_ARGS__)
-
-#define XHCI_REG_CLR_INNER(reg_set, value, field, size, type, ...) \
-	XHCI_REG_CLR_##type(&(reg_set)->field, value, size, ##__VA_ARGS__)
-
-#define XHCI_REG_MASK_INNER(field, size, type, ...) \
-	XHCI_REG_MASK_##type(size, ##__VA_ARGS__)
-
-#define XHCI_REG_SHIFT_INNER(field, size, type, ...) \
-	XHCI_REG_SHIFT_##type(size, ##__VA_ARGS__)
-
-/*
- * Field handling is the easiest. Just do it with whole field.
- */
-#define XHCI_REG_RD_FIELD(ptr, size) \
-	xhci2host(size, pio_read_##size((ptr)))
-#define XHCI_REG_WR_FIELD(ptr, value, size) \
-	pio_write_##size((ptr), host2xhci(size, value))
-#define XHCI_REG_SET_FIELD(ptr, value, size) \
-	pio_set_##size((ptr), host2xhci(size, value), XHCI_PIO_CHANGE_UDELAY);
-#define XHCI_REG_CLR_FIELD(ptr, value, size) \
-	pio_clear_##size((ptr), host2xhci(size, value), XHCI_PIO_CHANGE_UDELAY);
-#define XHCI_REG_MASK_FIELD(size)            (~((uint##size##_t) 0))
-#define XHCI_REG_SHIFT_FIELD(size)           (0)
-
-/*
- * Flags are just trivial case of ranges.
- */
-#define XHCI_REG_RD_FLAG(ptr, size, offset) \
-	XHCI_REG_RD_RANGE((ptr), size, (offset), (offset))
-#define XHCI_REG_WR_FLAG(ptr, value, size, offset) \
-	XHCI_REG_WR_RANGE((ptr), (value), size, (offset), (offset))
-#define XHCI_REG_SET_FLAG(ptr, value, size, offset) \
-	XHCI_REG_SET_RANGE((ptr), (value), size, (offset), (offset))
-#define XHCI_REG_CLR_FLAG(ptr, value, size, offset) \
-	XHCI_REG_CLR_RANGE((ptr), (value), size, (offset), (offset))
-#define XHCI_REG_MASK_FLAG(size, offset)            BIT_V(uint##size##_t, offset)
-#define XHCI_REG_SHIFT_FLAG(size, offset)           (offset)
-
-/*
- * Ranges are the most difficult. We need to play around with bitmasks.
- */
-#define XHCI_REG_RD_RANGE(ptr, size, hi, lo) \
-	BIT_RANGE_EXTRACT(uint##size##_t, (hi), (lo), XHCI_REG_RD_FIELD((ptr), size))
-
-#define XHCI_REG_WR_RANGE(ptr, value, size, hi, lo) \
-	pio_change_##size((ptr), host2xhci(size, BIT_RANGE_INSERT(uint##size##_t, \
-			(hi), (lo), (value))), \
-		host2xhci(size, BIT_RANGE(uint##size##_t, (hi), (lo))), \
-		XHCI_PIO_CHANGE_UDELAY);
-
-#define XHCI_REG_SET_RANGE(ptr, value, size, hi, lo) \
-	pio_set_##size((ptr), host2xhci(size, BIT_RANGE_INSERT(uint##size##_t, \
-			(hi), (lo), (value))), \
-		XHCI_PIO_CHANGE_UDELAY);
-
-#define XHCI_REG_CLR_RANGE(ptr, value, size, hi, lo) \
-	pio_clear_##size((ptr), host2xhci(size, BIT_RANGE_INSERT(uint##size##_t, \
-			(hi), (lo), (value))), \
-		XHCI_PIO_CHANGE_UDELAY);
-
-#define XHCI_REG_MASK_RANGE(size, hi, lo)  BIT_RANGE(uint##size##_t, hi, lo)
-#define XHCI_REG_SHIFT_RANGE(size, hi, lo) (lo)
-
-/** HC capability registers: section 5.3 */
-typedef const struct xhci_cap_regs {
-
-	/* Size of this structure, offset for the operation registers */
-	const ioport8_t caplength;
-
-	const PADD8(1);
-
-	/* BCD of specification version */
-	const ioport16_t hciversion;
-
-	/*
-	 *  7:0  - MaxSlots
-	 * 18:8  - MaxIntrs
-	 * 31:24 - MaxPorts
-	 */
-	const ioport32_t hcsparams1;
-
-	/*
-	 *  3:0  - IST
-	 *  7:4  - ERST Max
-	 * 25:21 - Max Scratchpad Bufs Hi
-	 *    26 - SPR
-	 * 31:27 - Max Scratchpad Bufs Lo
-	 */
-	const ioport32_t hcsparams2;
-
-	/*
-	 *  7:0  - U1 Device Exit Latency
-	 * 31:16 - U2 Device Exit Latency
-	 */
-	const ioport32_t hcsparams3;
-
-	/*
-	 *          11  10   9   8   7   6 5    4   3   2   1    0
-	 * 11:0  - CFC SEC SPC PAE NSS LTC C PIND PPC CSZ BNC AC64
-	 * 15:12 - MaxPSASize
-	 * 31:16 - xECP
-	 */
-	const ioport32_t hccparams1;
-
-	/*
-	 * 31:2 - Doorbell Array Offset
-	 */
-	const ioport32_t dboff;
-
-	/*
-	 * 31:5 - Runtime Register Space Offset
-	 */
-	const ioport32_t rtsoff;
-
-	/*
-	 *                 5   4   3   2   1   0
-	 * 5:0  - Flags: CIC LEC CTC FSC CMC U3C
-	 */
-	const ioport32_t hccparams2;
-
-	// the rest to operational registers is reserved
-} xhci_cap_regs_t;
-
-/*
- * The register specifiers are to be used as the reg_spec argument.
- *
- * The values are field, bitsize, type, (type specific args)
- * When the type is RANGE: hi, lo
- */
-#define XHCI_CAP_LENGTH        caplength,  8, FIELD
-#define XHCI_CAP_VERSION      hciversion, 16, FIELD
-#define XHCI_CAP_MAX_SLOTS    hcsparams1, 32, RANGE,  7,  0
-#define XHCI_CAP_MAX_INTRS    hcsparams1, 32, RANGE, 18,  8
-#define XHCI_CAP_MAX_PORTS    hcsparams1, 32, RANGE, 31, 24
-#define XHCI_CAP_IST          hcsparams2, 32, RANGE,  3,  0
-#define XHCI_CAP_ERST_MAX     hcsparams2, 32, RANGE,  7,  4
-#define XHCI_CAP_MAX_SPBUF_HI hcsparams2, 32, RANGE, 25, 21
-#define XHCI_CAP_SPR          hcsparams2, 32,  FLAG, 26
-#define XHCI_CAP_MAX_SPBUF_LO hcsparams2, 32, RANGE, 31, 27
-#define XHCI_CAP_U1EL         hcsparams3, 32, RANGE,  7,  0
-#define XHCI_CAP_U2EL         hcsparams3, 32, RANGE, 31, 16
-#define XHCI_CAP_AC64         hccparams1, 32,  FLAG,  0
-#define XHCI_CAP_BNC          hccparams1, 32,  FLAG,  1
-#define XHCI_CAP_CSZ          hccparams1, 32,  FLAG,  2
-#define XHCI_CAP_PPC          hccparams1, 32,  FLAG,  3
-#define XHCI_CAP_PIND         hccparams1, 32,  FLAG,  4
-#define XHCI_CAP_C            hccparams1, 32,  FLAG,  5
-#define XHCI_CAP_LTC          hccparams1, 32,  FLAG,  6
-#define XHCI_CAP_NSS          hccparams1, 32,  FLAG,  7
-#define XHCI_CAP_PAE          hccparams1, 32,  FLAG,  8
-#define XHCI_CAP_SPC          hccparams1, 32,  FLAG,  9
-#define XHCI_CAP_SEC          hccparams1, 32,  FLAG, 10
-#define XHCI_CAP_CFC          hccparams1, 32,  FLAG, 11
-#define XHCI_CAP_MAX_PSA_SIZE hccparams1, 32, RANGE, 15, 12
-#define XHCI_CAP_XECP         hccparams1, 32, RANGE, 31, 16
-#define XHCI_CAP_DBOFF             dboff, 32, FIELD
-#define XHCI_CAP_RTSOFF           rtsoff, 32, FIELD
-#define XHCI_CAP_U3C          hccparams2, 32,  FLAG,  0
-#define XHCI_CAP_CMC          hccparams2, 32,  FLAG,  1
-#define XHCI_CAP_FSC          hccparams2, 32,  FLAG,  2
-#define XHCI_CAP_CTC          hccparams2, 32,  FLAG,  3
-#define XHCI_CAP_LEC          hccparams2, 32,  FLAG,  4
-#define XHCI_CAP_CIC          hccparams2, 32,  FLAG,  5
-
-static inline unsigned xhci_get_max_spbuf(xhci_cap_regs_t *cap_regs)
-{
-	return XHCI_REG_RD(cap_regs, XHCI_CAP_MAX_SPBUF_HI) << 5 |
-	    XHCI_REG_RD(cap_regs, XHCI_CAP_MAX_SPBUF_LO);
-}
-
-/**
- * XHCI Port Register Set: section 5.4, table 32
- */
-typedef struct xhci_port_regs {
-	/*
-	 *          4   3 2   1   0
-	 *  4:0  - PR OCA Z PED CCS
-	 *  8:5  - PLS
-	 *    9  - PP
-	 * 13:10 - Port Speed
-	 * 15:14 - PIC
-	 *          27  26  25  24  23  22  21  20  19  18  17  16
-	 * 27:16 - WOE WDE WCE CAS CEC PLC PRC OCC WRC PEC CSC LWS
-	 *    30 - DR
-	 *    31 - WPR
-	 */
-	ioport32_t portsc;
-
-	/*
-	 * Contents of this fields depends on the protocol supported by the port.
-	 * USB3:
-	 *      7:0  - U1 Timeout
-	 *     15:8  - U2 Timeout
-	 *        16 - Force Link PM Accept
-	 * USB2:
-	 *      2:0  - L1S
-	 *        3  - RWE
-	 *      7:4  - BESL
-	 *     15:8  - L1 Device Slot
-	 *        16 - HLE
-	 *     31:28 - Test Mode
-	 */
-	ioport32_t portpmsc;
-
-	/*
-	 * This field is valid only for USB3 ports.
-	 * 15:0  - Link Error Count
-	 * 19:16 - RLC
-	 * 23:20 - TLC
-	 */
-	ioport32_t portli;
-
-	/*
-	 * This field is valid only for USB2 ports.
-	 *  1:0  - HIRDM
-	 *  9:2  - L1 Timeout
-	 * 13:10 - BESLD
-	 */
-	ioport32_t porthlpmc;
-} xhci_port_regs_t;
-
-#define XHCI_PORT_CCS           portsc, 32,  FLAG,  0
-#define XHCI_PORT_PED           portsc, 32,  FLAG,  1
-#define XHCI_PORT_OCA           portsc, 32,  FLAG,  3
-#define XHCI_PORT_PR            portsc, 32,  FLAG,  4
-#define XHCI_PORT_PLS           portsc, 32, RANGE,  8,  5
-#define XHCI_PORT_PP            portsc, 32,  FLAG,  9
-#define XHCI_PORT_PS            portsc, 32, RANGE, 13, 10
-#define XHCI_PORT_PIC           portsc, 32, RANGE, 15, 14
-#define XHCI_PORT_LWS           portsc, 32,  FLAG, 16
-#define XHCI_PORT_CSC           portsc, 32,  FLAG, 17
-#define XHCI_PORT_PEC           portsc, 32,  FLAG, 18
-#define XHCI_PORT_WRC           portsc, 32,  FLAG, 19
-#define XHCI_PORT_OCC           portsc, 32,  FLAG, 20
-#define XHCI_PORT_PRC           portsc, 32,  FLAG, 21
-#define XHCI_PORT_PLC           portsc, 32,  FLAG, 22
-#define XHCI_PORT_CEC           portsc, 32,  FLAG, 23
-#define XHCI_PORT_CAS           portsc, 32,  FLAG, 24
-#define XHCI_PORT_WCE           portsc, 32,  FLAG, 25
-#define XHCI_PORT_WDE           portsc, 32,  FLAG, 26
-#define XHCI_PORT_WOE           portsc, 32,  FLAG, 27
-#define XHCI_PORT_DR            portsc, 32,  FLAG, 30
-#define XHCI_PORT_WPR           portsc, 32,  FLAG, 31
-
-#define XHCI_PORT_USB3_U1TO   portpmsc, 32, RANGE,  7,  0
-#define XHCI_PORT_USB3_U2TO   portpmsc, 32, RANGE, 15,  8
-#define XHCI_PORT_USB3_FLPMA  portpmsc, 32,  FLAG, 16
-#define XHCI_PORT_USB3_LEC      portli, 32, RANGE, 15,  0
-#define XHCI_PORT_USB3_RLC      portli, 32, RANGE, 19, 16
-#define XHCI_PORT_USB3_TLC      portli, 32, RANGE, 23, 20
-
-#define XHCI_PORT_USB2_L1S    portpmsc, 32, RANGE,  2,  0
-#define XHCI_PORT_USB2_RWE    portpmsc, 32,  FLAG,  3
-#define XHCI_PORT_USB2_BESL   portpmsc, 32, RANGE,  7,  4
-#define XHCI_PORT_USB2_L1DS   portpmsc, 32, RANGE, 15,  8
-#define XHCI_PORT_USB2_HLE    portpmsc, 32,  FLAG, 16
-#define XHCI_PORT_USB2_TM     portpmsc, 32, RANGE, 31, 28
-#define XHCI_PORT_USB2_HIRDM porthlpmc, 32, RANGE,  1,  0
-#define XHCI_PORT_USB2_L1TO  porthlpmc, 32, RANGE,  9,  2
-#define XHCI_PORT_USB2_BESLD porthlpmc, 32, RANGE, 13, 10
-
-/**
- * XHCI Operational Registers: section 5.4
- */
-typedef struct xhci_op_regs {
-
-	/*
-	 *            3    2     1   0
-	 *  3:0  - HSEE INTE HCRST R/S
-	 *
-	 *           11  10   9   8      7
-	 * 11:7  - EU3S EWE CRS CSS LHCRST
-	 *    13 - CME
-	 */
-	ioport32_t usbcmd;
-
-	/*
-	 *          4    3   2 1   0
-	 *  4:0 - PCD EINT HSE _ HCH
-	 *
-	 *        12  11  10   9   8
-	 * 12:8 - HCE CNR SRE RSS SSS
-	 */
-	ioport32_t usbsts;
-
-	/*
-	 * Bitmask of page sizes supported: 128M .. 4K
-	 */
-	ioport32_t pagesize;
-
-	PADD32(2);
-
-	/*
-	 * 15:0 - Notification enable
-	 */
-	ioport32_t dnctrl;
-
-	/*
-	 *          3  2  1   0
-	 *  3:0 - CRR CA CS RCS
-	 * 64:6 - Command Ring Pointer
-	 */
-	ioport64_t crcr;
-
-	PADD32(4);
-
-	ioport64_t dcbaap;
-
-	/*
-	 * 7:0 - MaxSlotsEn
-	 *   8 - U3E
-	 *   9 - CIE
-	 */
-	ioport32_t config;
-
-	/* Offset of portrs from op_regs addr is 0x400. */
-	PADD32(241);
-
-	/*
-	 * Individual ports register sets
-	 */
-	xhci_port_regs_t portrs[256];
-} xhci_op_regs_t;
-
-#define XHCI_OP_RS              usbcmd, 32,  FLAG,  0
-#define XHCI_OP_HCRST           usbcmd, 32,  FLAG,  1
-#define XHCI_OP_INTE            usbcmd, 32,  FLAG,  2
-#define XHCI_OP_HSEE            usbcmd, 32,  FLAG,  3
-#define XHCI_OP_LHCRST          usbcmd, 32,  FLAG,  7
-#define XHCI_OP_CSS             usbcmd, 32,  FLAG,  8
-#define XHCI_OP_CRS             usbcmd, 32,  FLAG,  9
-#define XHCI_OP_EWE             usbcmd, 32,  FLAG, 10
-#define XHCI_OP_EU3S            usbcmd, 32,  FLAG, 11
-#define XHCI_OP_CME             usbcmd, 32,  FLAG, 13
-#define XHCI_OP_HCH             usbsts, 32,  FLAG,  0
-#define XHCI_OP_HSE             usbsts, 32,  FLAG,  2
-#define XHCI_OP_EINT            usbsts, 32,  FLAG,  3
-#define XHCI_OP_PCD             usbsts, 32,  FLAG,  4
-#define XHCI_OP_SSS             usbsts, 32,  FLAG,  8
-#define XHCI_OP_RSS             usbsts, 32,  FLAG,  9
-#define XHCI_OP_SRE             usbsts, 32,  FLAG, 10
-#define XHCI_OP_CNR             usbsts, 32,  FLAG, 11
-#define XHCI_OP_HCE             usbsts, 32,  FLAG, 12
-#define XHCI_OP_PAGESIZE      pagesize, 32, FIELD
-#define XHCI_OP_NOTIFICATION    dnctrl, 32, RANGE, 15, 0
-#define XHCI_OP_RCS               crcr, 64,  FLAG, 0
-#define XHCI_OP_CS                crcr, 64,  FLAG, 1
-#define XHCI_OP_CA                crcr, 64,  FLAG, 2
-#define XHCI_OP_CRR               crcr, 64,  FLAG, 3
-/*
- * This shall be RANGE, 6, 0, but the value containing CR pointer and RCS flag
- * must be written at once.
- */
-#define XHCI_OP_CRCR              crcr, 64, FIELD
-#define XHCI_OP_DCBAAP          dcbaap, 64, FIELD
-#define XHCI_OP_MAX_SLOTS_EN    config, 32, RANGE, 7, 0
-#define XHCI_OP_U3E             config, 32,  FLAG, 8
-#define XHCI_OP_CIE             config, 32,  FLAG, 9
-
-/* Aggregating field to read & write whole status at once */
-#define XHCI_OP_STATUS          usbsts, 32, RANGE, 12, 0
-
-/* RW1C fields in usbsts */
-#define XHCI_STATUS_ACK_MASK     0x41C
-
-/**
- * Interrupter Register Set: section 5.5.2
- */
-typedef struct xhci_interrupter_regs {
-	/*
-	 * 0 - Interrupt Pending
-	 * 1 - Interrupt Enable
-	 */
-	ioport32_t iman;
-
-	/*
-	 * 15:0  - Interrupt Moderation Interval
-	 * 31:16 - Interrupt Moderation Counter
-	 */
-	ioport32_t imod;
-
-	ioport32_t erstsz;
-
-	PADD32(1);
-
-	ioport64_t erstba;
-
-	/*
-	 *  2:0 - Dequeue ERST Segment Index
-	 *    3 - Event Handler Busy
-	 * 63:4 - Event Ring Dequeue Pointer
-	 */
-	ioport64_t erdp;
-} xhci_interrupter_regs_t;
-
-#define XHCI_INTR_IP              iman, 32,  FLAG,  0
-#define XHCI_INTR_IE              iman, 32,  FLAG,  1
-#define XHCI_INTR_IMI             imod, 32, RANGE, 15, 0
-#define XHCI_INTR_IMC             imod, 32, RANGE, 31, 16
-#define XHCI_INTR_ERSTSZ        erstsz, 32, FIELD
-#define XHCI_INTR_ERSTBA        erstba, 64, FIELD
-#define XHCI_INTR_ERDP_ESI        erdp, 64, RANGE,  2, 0
-#define XHCI_INTR_ERDP_EHB        erdp, 64,  FLAG,  3
-#define XHCI_INTR_ERDP            erdp, 64, FIELD
-
-/**
- * XHCI Runtime registers: section 5.5
- */
-typedef struct xhci_rt_regs {
-	ioport32_t mfindex;
-
-	PADD32(7);
-
-	xhci_interrupter_regs_t ir [];
-} xhci_rt_regs_t;
-
-#define XHCI_RT_MFINDEX        mfindex, 32, RANGE, 13, 0
-#define XHCI_MFINDEX_MAX	(1 << 14)
-
-/**
- * XHCI Doorbell Registers: section 5.6
- *
- * These registers are to be written as a whole field.
- */
-typedef ioport32_t xhci_doorbell_t;
-
-enum xhci_plt {
-	XHCI_PSI_PLT_SYMM,
-	XHCI_PSI_PLT_RSVD,
-	XHCI_PSI_PLT_RX,
-	XHCI_PSI_PLT_TX
-};
-
-/**
- * Protocol speed ID: section 7.2.1
- */
-typedef struct xhci_psi {
-	xhci_dword_t psi;
-} xhci_psi_t;
-
-#define XHCI_PSI_PSIV    psi, 32, RANGE,  3,  0
-#define XHCI_PSI_PSIE    psi, 32, RANGE,  5,  4
-#define XHCI_PSI_PLT     psi, 32, RANGE,  7,  6
-#define XHCI_PSI_PFD     psi, 32,  FLAG,  8
-#define XHCI_PSI_PSIM    psi, 32, RANGE, 31, 16
-
-enum xhci_extcap_type {
-	XHCI_EC_RESERVED = 0,
-	XHCI_EC_USB_LEGACY,
-	XHCI_EC_SUPPORTED_PROTOCOL,
-	XHCI_EC_EXTENDED_POWER_MANAGEMENT,
-	XHCI_EC_IOV,
-	XHCI_EC_MSI,
-	XHCI_EC_LOCALMEM,
-	XHCI_EC_DEBUG = 10,
-	XHCI_EC_MSIX = 17,
-	XHCI_EC_MAX = 255
-};
-
-/**
- * xHCI Extended Capability: section 7
- */
-typedef struct xhci_extcap {
-	xhci_dword_t header;
-	xhci_dword_t cap_specific[];
-} xhci_extcap_t;
-
-#define XHCI_EC_CAP_ID                  header, 32, RANGE,  7,  0
-#define XHCI_EC_SIZE                    header, 32, RANGE, 15,  8
-
-/* Supported protocol */
-#define XHCI_EC_SP_MINOR                header, 32, RANGE, 23, 16
-#define XHCI_EC_SP_MAJOR                header, 32, RANGE, 31, 24
-#define XHCI_EC_SP_NAME        cap_specific[0], 32, FIELD
-#define XHCI_EC_SP_CP_OFF      cap_specific[1], 32, RANGE,  7,  0
-#define XHCI_EC_SP_CP_COUNT    cap_specific[1], 32, RANGE, 15,  8
-#define XHCI_EC_SP_PSIC        cap_specific[1], 32, RANGE, 31, 28
-#define XHCI_EC_SP_SLOT_TYPE   cap_specific[2], 32, RANGE,  4,  0
-
-typedef union {
-	char str [4];
-	uint32_t packed;
-} xhci_sp_name_t;
-
-static const xhci_sp_name_t xhci_name_usb = {
-	.str = "USB "
-};
-
-static inline xhci_extcap_t *xhci_extcap_next(const xhci_extcap_t *cur)
-{
-	unsigned dword_offset = XHCI_REG_RD(cur, XHCI_EC_SIZE);
-	if (!dword_offset)
-		return NULL;
-	return (xhci_extcap_t *) (((xhci_dword_t *) cur) + dword_offset);
-}
-
-static inline xhci_psi_t *xhci_extcap_psi(const xhci_extcap_t *ec, unsigned psid)
-{
-	assert(XHCI_REG_RD(ec, XHCI_EC_CAP_ID) == XHCI_EC_SUPPORTED_PROTOCOL);
-	assert(XHCI_REG_RD(ec, XHCI_EC_SP_PSIC) > psid);
-
-	unsigned dword_offset = 4 + psid;
-	return (xhci_psi_t *) (((xhci_dword_t *) ec) + dword_offset);
-}
-
-/**
- * USB Legacy Support: section 7.1
- *
- * Legacy support have an exception from dword-access, because it needs to be
- * byte-accessed.
- */
-typedef struct xhci_extcap_legsup {
-	ioport8_t cap_id;
-	ioport8_t size;			/**< Next Capability Pointer */
-	ioport8_t sem_bios;
-	ioport8_t sem_os;
-
-	/** USB Legacy Support Control/Status - RW for BIOS, RO for OS */
-	xhci_dword_t usblegctlsts;
-} xhci_legsup_t;
-
-#define XHCI_LEGSUP_SEM_BIOS	sem_bios, 8, FLAG, 0
-#define XHCI_LEGSUP_SEM_OS	sem_os, 8, FLAG, 0
-
-/* 4.22.1 BIOS may take up to 1 second to release the device */
-#define XHCI_LEGSUP_BIOS_TIMEOUT_US   1000000
-#define XHCI_LEGSUP_POLLING_DELAY_1MS    1000
-
-#endif
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/hw_struct/trb.h
===================================================================
--- uspace/drv/bus/usb/xhci/hw_struct/trb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,272 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch, Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * TRB-related structures of the xHC.
- *
- * This file contains all the types of TRB and the TRB ring handling.
- */
-
-#ifndef XHCI_TRB_H
-#define XHCI_TRB_H
-
-#include "common.h"
-#include <barrier.h>
-
-/**
- * TRB types: section 6.4.6, table 139
- */
-enum xhci_trb_type {
-	XHCI_TRB_TYPE_RESERVED = 0,
-
-	/*
-	 * Transfer ring:
-	 */
-	XHCI_TRB_TYPE_NORMAL,
-	XHCI_TRB_TYPE_SETUP_STAGE,
-	XHCI_TRB_TYPE_DATA_STAGE,
-	XHCI_TRB_TYPE_STATUS_STAGE,
-	XHCI_TRB_TYPE_ISOCH,
-	XHCI_TRB_TYPE_LINK,
-	XHCI_TRB_TYPE_EVENT_DATA,
-	XHCI_TRB_TYPE_NO_OP,
-
-	/*
-	 * Command ring:
-	 */
-	XHCI_TRB_TYPE_ENABLE_SLOT_CMD,
-	XHCI_TRB_TYPE_DISABLE_SLOT_CMD,
-	XHCI_TRB_TYPE_ADDRESS_DEVICE_CMD,
-	XHCI_TRB_TYPE_CONFIGURE_ENDPOINT_CMD,
-	XHCI_TRB_TYPE_EVALUATE_CONTEXT_CMD,
-	XHCI_TRB_TYPE_RESET_ENDPOINT_CMD,
-	XHCI_TRB_TYPE_STOP_ENDPOINT_CMD,
-	XHCI_TRB_TYPE_SET_TR_DEQUEUE_POINTER_CMD,
-	XHCI_TRB_TYPE_RESET_DEVICE_CMD,
-	XHCI_TRB_TYPE_FORCE_EVENT_CMD,
-	XHCI_TRB_TYPE_NEGOTIATE_BANDWIDTH_CMD,
-	XHCI_TRB_TYPE_SET_LATENCY_TOLERANCE_VALUE_CMD,
-	XHCI_TRB_TYPE_GET_PORT_BANDWIDTH_CMD,
-	XHCI_TRB_TYPE_FORCE_HEADER_CMD,
-	XHCI_TRB_TYPE_NO_OP_CMD,
-	/*
-	 * Reserved: 24-31
-	 */
-
-	/*
-	 * Event ring:
-	 */
-	XHCI_TRB_TYPE_TRANSFER_EVENT = 32,
-	XHCI_TRB_TYPE_COMMAND_COMPLETION_EVENT,
-	XHCI_TRB_TYPE_PORT_STATUS_CHANGE_EVENT,
-	XHCI_TRB_TYPE_BANDWIDTH_REQUEST_EVENT,
-	XHCI_TRB_TYPE_DOORBELL_EVENT,
-	XHCI_TRB_TYPE_HOST_CONTROLLER_EVENT,
-	XHCI_TRB_TYPE_DEVICE_NOTIFICATION_EVENT,
-	XHCI_TRB_TYPE_MFINDEX_WRAP_EVENT,
-
-	XHCI_TRB_TYPE_MAX
-};
-
-/**
- * TRB template: section 4.11.1
- */
-typedef struct xhci_trb {
-	xhci_qword_t parameter;
-	xhci_dword_t status;
-	xhci_dword_t control;
-} __attribute__((packed)) __attribute__((aligned(16))) xhci_trb_t;
-
-#define TRB_TYPE(trb)           XHCI_DWORD_EXTRACT((trb).control, 15, 10)
-#define TRB_CYCLE(trb)          XHCI_DWORD_EXTRACT((trb).control, 0, 0)
-#define TRB_LINK_TC(trb)        XHCI_DWORD_EXTRACT((trb).control, 1, 1)
-#define TRB_IOC(trb)            XHCI_DWORD_EXTRACT((trb).control, 5, 5)
-#define TRB_EVENT_DATA(trb)		XHCI_DWORD_EXTRACT((trb).control, 2, 2)
-
-#define TRB_TRANSFER_LENGTH(trb)	XHCI_DWORD_EXTRACT((trb).status, 23, 0)
-#define TRB_COMPLETION_CODE(trb)	XHCI_DWORD_EXTRACT((trb).status, 31, 24)
-
-#define TRB_LINK_SET_TC(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 1, 1)
-#define TRB_SET_CYCLE(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 0, 0)
-
-#define TRB_CTRL_SET_SETUP_WLENGTH(trb, val) \
-	xhci_qword_set_bits(&(trb).parameter, val, 63, 48)
-#define TRB_CTRL_SET_SETUP_WINDEX(trb, val) \
-	xhci_qword_set_bits(&(trb).parameter, val, 47, 32)
-#define TRB_CTRL_SET_SETUP_WVALUE(trb, val) \
-	xhci_qword_set_bits(&(trb).parameter, val, 31, 16)
-#define TRB_CTRL_SET_SETUP_BREQ(trb, val) \
-	xhci_qword_set_bits(&(trb).parameter, val, 15, 8)
-#define TRB_CTRL_SET_SETUP_BMREQTYPE(trb, val) \
-	xhci_qword_set_bits(&(trb).parameter, val, 7, 0)
-
-#define TRB_CTRL_SET_TD_SIZE(trb, val) \
-	xhci_dword_set_bits(&(trb).status, val, 21, 17)
-#define TRB_CTRL_SET_XFER_LEN(trb, val) \
-	xhci_dword_set_bits(&(trb).status, val, 16, 0)
-
-#define TRB_CTRL_SET_ENT(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 1, 1)
-#define TRB_CTRL_SET_ISP(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 2, 2)
-#define TRB_CTRL_SET_NS(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 3, 3)
-#define TRB_CTRL_SET_CHAIN(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 4, 4)
-#define TRB_CTRL_SET_IOC(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 5, 5)
-#define TRB_CTRL_SET_IDT(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 6, 6)
-
-#define TRB_CTRL_SET_TRB_TYPE(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 15, 10)
-#define TRB_CTRL_SET_DIR(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 16, 16)
-#define TRB_CTRL_SET_TRT(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 17, 16)
-
-#define TRB_ISOCH_SET_TBC(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 8, 7)
-#define TRB_ISOCH_SET_TLBPC(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 19, 16)
-#define TRB_ISOCH_SET_FRAMEID(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 30, 20)
-#define TRB_ISOCH_SET_SIA(trb, val) \
-	xhci_dword_set_bits(&(trb).control, val, 31, 31)
-
-/**
- * The Chain bit is valid only in specific TRB types.
- */
-static inline bool xhci_trb_is_chained(xhci_trb_t *trb)
-{
-	const int type = TRB_TYPE(*trb);
-	const bool chain_bit = XHCI_DWORD_EXTRACT(trb->control, 4, 4);
-
-	return chain_bit &&
-	    (type == XHCI_TRB_TYPE_NORMAL ||
-	    type == XHCI_TRB_TYPE_DATA_STAGE ||
-	    type == XHCI_TRB_TYPE_STATUS_STAGE ||
-	    type == XHCI_TRB_TYPE_ISOCH);
-}
-
-static inline void xhci_trb_link_fill(xhci_trb_t *trb, uintptr_t next_phys)
-{
-	// TRBs require 16-byte alignment
-	assert((next_phys & 0xf) == 0);
-
-	xhci_dword_set_bits(&trb->control, XHCI_TRB_TYPE_LINK, 15, 10);
-	xhci_qword_set(&trb->parameter, next_phys);
-}
-
-static inline void xhci_trb_copy_to_pio(xhci_trb_t *dst, xhci_trb_t *src)
-{
-	/*
-	 * As we do not know, whether our architecture is capable of copying 16
-	 * bytes atomically, let's copy the fields one by one.
-	 */
-	dst->parameter = src->parameter;
-	dst->status = src->status;
-
-	write_barrier();
-
-	dst->control = src->control;
-}
-
-static inline void xhci_trb_clean(xhci_trb_t *trb)
-{
-	memset(trb, 0, sizeof(*trb));
-}
-
-/**
- * Event Ring Segment Table: section 6.5
- */
-typedef struct xhci_erst_entry {
-	xhci_qword_t rs_base_ptr;       /* 64B aligned */
-	xhci_dword_t size;              /* only low 16 bits, the rest is RsvdZ */
-	xhci_dword_t _reserved;
-} xhci_erst_entry_t;
-
-static inline void xhci_fill_erst_entry(xhci_erst_entry_t *entry,
-    uintptr_t phys, int segments)
-{
-	xhci_qword_set(&entry->rs_base_ptr, phys);
-	xhci_dword_set_bits(&entry->size, segments, 16, 0);
-}
-
-typedef enum xhci_trb_completion_code {
-	XHCI_TRBC_INVALID = 0,
-	XHCI_TRBC_SUCCESS,
-	XHCI_TRBC_DATA_BUFFER_ERROR,
-	XHCI_TRBC_BABBLE_DETECTED_ERROR,
-	XHCI_TRBC_USB_TRANSACTION_ERROR,
-	XHCI_TRBC_TRB_ERROR,
-	XHCI_TRBC_STALL_ERROR,
-	XHCI_TRBC_RESOURCE_ERROR,
-	XHCI_TRBC_BANDWIDTH_ERROR,
-	XHCI_TRBC_NO_SLOTS_ERROR,
-	XHCI_TRBC_INVALID_STREAM_ERROR,
-	XHCI_TRBC_SLOT_NOT_ENABLED_ERROR,
-	XHCI_TRBC_EP_NOT_ENABLED_ERROR,
-	XHCI_TRBC_SHORT_PACKET,
-	XHCI_TRBC_RING_UNDERRUN,
-	XHCI_TRBC_RING_OVERRUN,
-	XHCI_TRBC_VF_EVENT_RING_FULL,
-	XHCI_TRBC_PARAMETER_ERROR,
-	XHCI_TRBC_BANDWIDTH_OVERRUN_ERROR,
-	XHCI_TRBC_CONTEXT_STATE_ERROR,
-	XHCI_TRBC_NO_PING_RESPONSE_ERROR,
-	XHCI_TRBC_EVENT_RING_FULL_ERROR,
-	XHCI_TRBC_INCOMPATIBLE_DEVICE_ERROR,
-	XHCI_TRBC_MISSED_SERVICE_ERROR,
-	XHCI_TRBC_COMMAND_RING_STOPPED,
-	XHCI_TRBC_COMMAND_ABORTED,
-	XHCI_TRBC_STOPPED,
-	XHCI_TRBC_STOPPED_LENGTH_INVALID,
-	XHCI_TRBC_STOPPED_SHORT_PACKET,
-	XHCI_TRBC_MAX_EXIT_LATENCY_TOO_LARGE_ERROR,
-	/* 30 reserved */
-	XHCI_TRBC_ISOCH_BUFFER_OVERRUN = 31,
-	XHCI_TRBC_EVENT_LOST_ERROR,
-	XHCI_TRBC_UNDEFINED_ERROR,
-	XHCI_TRBC_INVALID_STREAM_ID_ERROR,
-	XHCI_TRBC_SECONDARY_BANDWIDTH_ERROR,
-	XHCI_TRBC_SPLIT_TRANSACTION_ERROR,
-	XHCI_TRBC_MAX
-	/**
-	 *  37 - 191 reserved
-	 * 192 - 223 vendor defined error
-	 * 224 - 255 vendor defined info
-	 */
-} xhci_trb_completion_code_t;
-
-#endif
Index: pace/drv/bus/usb/xhci/isoch.c
===================================================================
--- uspace/drv/bus/usb/xhci/isoch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,670 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller endpoint management.
- */
-
-#include <str_error.h>
-#include <macros.h>
-
-#include "endpoint.h"
-#include "hw_struct/trb.h"
-#include "hw_struct/regs.h"
-#include "trb_ring.h"
-#include "hc.h"
-#include "bus.h"
-
-#include "isoch.h"
-
-void isoch_init(xhci_endpoint_t *ep, const usb_endpoint_descriptors_t *desc)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	fibril_mutex_initialize(&isoch->guard);
-	fibril_condvar_initialize(&isoch->avail);
-
-	const xhci_hc_t *hc = bus_to_xhci_bus(ep->base.device->bus)->hc;
-
-	/*
-	 * We shall cover at least twice the IST period, otherwise we will get
-	 * an over/underrun every time.
-	 */
-	isoch->buffer_count = (2 * hc->ist) / ep->interval;
-
-	/* 2 buffers are the very minimum. */
-	isoch->buffer_count = max(2, isoch->buffer_count);
-
-	usb_log_debug("[isoch] isoch setup with %zu buffers", isoch->buffer_count);
-}
-
-static void isoch_reset(xhci_endpoint_t *ep)
-{
-	xhci_isoch_t *const isoch = ep->isoch;
-	assert(fibril_mutex_is_locked(&isoch->guard));
-
-	isoch->dequeue = isoch->enqueue = isoch->hw_enqueue = 0;
-
-	for (size_t i = 0; i < isoch->buffer_count; ++i) {
-		isoch->transfers[i].state = ISOCH_EMPTY;
-	}
-
-	fibril_timer_clear_locked(isoch->feeding_timer);
-	isoch->last_mf = -1U;
-	usb_log_info("[isoch] Endpoint" XHCI_EP_FMT ": Data flow reset.",
-	    XHCI_EP_ARGS(*ep));
-}
-
-static void isoch_reset_no_timer(xhci_endpoint_t *ep)
-{
-	xhci_isoch_t *const isoch = ep->isoch;
-	assert(fibril_mutex_is_locked(&isoch->guard));
-	/*
-	 * As we cannot clear timer when we are triggered by it,
-	 * we have to avoid doing it in common method.
-	 */
-	fibril_timer_clear_locked(isoch->reset_timer);
-	isoch_reset(ep);
-}
-
-static void isoch_reset_timer(void *ep)
-{
-	xhci_isoch_t *const isoch = xhci_endpoint_get(ep)->isoch;
-	fibril_mutex_lock(&isoch->guard);
-	isoch_reset(ep);
-	fibril_mutex_unlock(&isoch->guard);
-}
-
-/*
- * Fast transfers could trigger the reset timer before the data is processed,
- * leading into false reset.
- */
-#define RESET_TIMER_DELAY 100000
-static void timer_schedule_reset(xhci_endpoint_t *ep)
-{
-	xhci_isoch_t *const isoch = ep->isoch;
-	const usec_t delay = isoch->buffer_count * ep->interval * 125 +
-	    RESET_TIMER_DELAY;
-
-	fibril_timer_clear_locked(isoch->reset_timer);
-	fibril_timer_set_locked(isoch->reset_timer, delay,
-	    isoch_reset_timer, ep);
-}
-
-void isoch_fini(xhci_endpoint_t *ep)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	if (isoch->feeding_timer) {
-		fibril_timer_clear(isoch->feeding_timer);
-		fibril_timer_destroy(isoch->feeding_timer);
-		fibril_timer_clear(isoch->reset_timer);
-		fibril_timer_destroy(isoch->reset_timer);
-	}
-
-	if (isoch->transfers) {
-		for (size_t i = 0; i < isoch->buffer_count; ++i)
-			dma_buffer_free(&isoch->transfers[i].data);
-		free(isoch->transfers);
-	}
-}
-
-/**
- * Allocate isochronous buffers. Create the feeding timer.
- */
-errno_t isoch_alloc_transfers(xhci_endpoint_t *ep)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	isoch->feeding_timer = fibril_timer_create(&isoch->guard);
-	isoch->reset_timer = fibril_timer_create(&isoch->guard);
-	if (!isoch->feeding_timer)
-		return ENOMEM;
-
-	isoch->transfers = calloc(isoch->buffer_count, sizeof(xhci_isoch_transfer_t));
-	if (!isoch->transfers)
-		goto err;
-
-	for (size_t i = 0; i < isoch->buffer_count; ++i) {
-		xhci_isoch_transfer_t *transfer = &isoch->transfers[i];
-		if (dma_buffer_alloc(&transfer->data, ep->base.max_transfer_size)) {
-			goto err;
-		}
-	}
-
-	fibril_mutex_lock(&isoch->guard);
-	isoch_reset_no_timer(ep);
-	fibril_mutex_unlock(&isoch->guard);
-
-	return EOK;
-err:
-	isoch_fini(ep);
-	return ENOMEM;
-}
-
-static errno_t schedule_isochronous_trb(xhci_endpoint_t *ep, xhci_isoch_transfer_t *it)
-{
-	xhci_trb_t trb;
-	xhci_trb_clean(&trb);
-
-	trb.parameter = host2xhci(64, dma_buffer_phys_base(&it->data));
-	TRB_CTRL_SET_XFER_LEN(trb, it->size);
-	TRB_CTRL_SET_TD_SIZE(trb, 0);
-	TRB_CTRL_SET_IOC(trb, 1);
-	TRB_CTRL_SET_TRB_TYPE(trb, XHCI_TRB_TYPE_ISOCH);
-
-	// see 4.14.1 and 4.11.2.3 for the explanation, how to calculate those
-	size_t tdpc = it->size / 1024 + ((it->size % 1024) ? 1 : 0);
-	size_t tbc = tdpc / ep->max_burst;
-	if (!tdpc % ep->max_burst)
-		--tbc;
-	size_t bsp = tdpc % ep->max_burst;
-	size_t tlbpc = (bsp ? bsp : ep->max_burst) - 1;
-
-	TRB_ISOCH_SET_TBC(trb, tbc);
-	TRB_ISOCH_SET_TLBPC(trb, tlbpc);
-	TRB_ISOCH_SET_FRAMEID(trb, (it->mfindex / 8) % 2048);
-
-	const errno_t err = xhci_trb_ring_enqueue(&ep->ring, &trb, &it->interrupt_trb_phys);
-	return err;
-}
-
-/** The number of bits the MFINDEX is stored in at HW */
-#define EPOCH_BITS 14
-/** The delay in usec for the epoch wrap */
-#define EPOCH_DELAY 500000
-/** The amount of microframes the epoch is checked for a delay */
-#define EPOCH_LOW_MFINDEX 8 * 100
-
-static inline uint64_t get_system_time()
-{
-	struct timespec ts;
-	getuptime(&ts);
-	return SEC2USEC(ts.tv_sec) + NSEC2USEC(ts.tv_nsec);
-}
-
-static inline uint64_t get_current_microframe(const xhci_hc_t *hc)
-{
-	const uint32_t reg_mfindex = XHCI_REG_RD(hc->rt_regs, XHCI_RT_MFINDEX);
-	/*
-	 * If the mfindex is low and the time passed since last mfindex wrap is too
-	 * high, we have entered the new epoch already (and haven't received event
-	 * yet).
-	 */
-	uint64_t epoch = hc->wrap_count;
-	if (reg_mfindex < EPOCH_LOW_MFINDEX &&
-	    get_system_time() - hc->wrap_time > EPOCH_DELAY) {
-		++epoch;
-	}
-	return (epoch << EPOCH_BITS) + reg_mfindex;
-}
-
-static inline void calc_next_mfindex(xhci_endpoint_t *ep, xhci_isoch_transfer_t *it)
-{
-	xhci_isoch_t *const isoch = ep->isoch;
-	if (isoch->last_mf == -1U) {
-		const xhci_bus_t *bus = bus_to_xhci_bus(ep->base.device->bus);
-		const xhci_hc_t *hc = bus->hc;
-
-		/*
-		 * Delay the first frame by some time to fill the buffer, but at most 10
-		 * miliseconds.
-		 */
-		const uint64_t delay = min(isoch->buffer_count * ep->interval, 10 * 8);
-		it->mfindex = get_current_microframe(hc) + 1 + delay + hc->ist;
-
-		// Align to ESIT start boundary
-		it->mfindex += ep->interval - 1;
-		it->mfindex &= ~(ep->interval - 1);
-	} else {
-		it->mfindex = isoch->last_mf + ep->interval;
-	}
-}
-
-/** 825 ms in uframes */
-#define END_FRAME_DELAY   (895000 / 125)
-
-typedef enum {
-	WINDOW_TOO_SOON,
-	WINDOW_INSIDE,
-	WINDOW_TOO_LATE,
-} window_position_t;
-
-typedef struct {
-	window_position_t position;
-	uint64_t offset;
-} window_decision_t;
-
-/**
- * Decide on the position of mfindex relatively to the window specified by
- * Start Frame ID and End Frame ID. The resulting structure contains the
- * decision, and in case of the mfindex being outside, also the number of
- * uframes it's off.
- */
-static inline void window_decide(window_decision_t *res, xhci_hc_t *hc,
-    uint64_t mfindex)
-{
-	const uint64_t current_mf = get_current_microframe(hc);
-	const uint64_t start = current_mf + hc->ist + 1;
-	const uint64_t end = current_mf + END_FRAME_DELAY;
-
-	if (mfindex < start) {
-		res->position = WINDOW_TOO_LATE;
-		res->offset = start - mfindex;
-	} else if (mfindex <= end) {
-		res->position = WINDOW_INSIDE;
-	} else {
-		res->position = WINDOW_TOO_SOON;
-		res->offset = mfindex - end;
-	}
-}
-
-static void isoch_feed_out_timer(void *);
-static void isoch_feed_in_timer(void *);
-
-/**
- * Schedule TRBs with filled buffers to HW. Takes filled isoch transfers and
- * pushes their TRBs to the ring.
- *
- * According to 4.11.2.5, we can't just push all TRBs we have. We must not do
- * it too late, but also not too soon.
- */
-static void isoch_feed_out(xhci_endpoint_t *ep)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-	assert(fibril_mutex_is_locked(&isoch->guard));
-
-	xhci_bus_t *bus = bus_to_xhci_bus(ep->base.device->bus);
-	xhci_hc_t *hc = bus->hc;
-
-	bool fed = false;
-
-	while (isoch->transfers[isoch->hw_enqueue].state == ISOCH_FILLED) {
-		xhci_isoch_transfer_t *const it = &isoch->transfers[isoch->hw_enqueue];
-		usec_t delay;
-
-		assert(it->state == ISOCH_FILLED);
-
-		window_decision_t wd;
-		window_decide(&wd, hc, it->mfindex);
-
-		switch (wd.position) {
-		case WINDOW_TOO_SOON:
-			delay = wd.offset * 125;
-			usb_log_debug("[isoch] delaying feeding buffer %zu for %lldus",
-			    it - isoch->transfers, delay);
-			fibril_timer_set_locked(isoch->feeding_timer, delay,
-			    isoch_feed_out_timer, ep);
-			goto out;
-
-		case WINDOW_INSIDE:
-			usb_log_debug("[isoch] feeding buffer %zu at 0x%" PRIx64,
-			    it - isoch->transfers, it->mfindex);
-			it->error = schedule_isochronous_trb(ep, it);
-			if (it->error) {
-				it->state = ISOCH_COMPLETE;
-			} else {
-				it->state = ISOCH_FED;
-				fed = true;
-			}
-
-			isoch->hw_enqueue = (isoch->hw_enqueue + 1) % isoch->buffer_count;
-			break;
-
-		case WINDOW_TOO_LATE:
-			/*
-			 * Missed the opportunity to schedule. Just mark this transfer as
-			 * skipped.
-			 */
-			usb_log_debug("[isoch] missed feeding buffer %zu at 0x%" PRIx64 " by "
-			    "%" PRIu64 " uframes", it - isoch->transfers, it->mfindex, wd.offset);
-			it->state = ISOCH_COMPLETE;
-			it->error = EOK;
-			it->size = 0;
-
-			isoch->hw_enqueue = (isoch->hw_enqueue + 1) % isoch->buffer_count;
-			break;
-		}
-	}
-
-out:
-	if (fed) {
-		hc_ring_ep_doorbell(ep, 0);
-		/*
-		 * The ring may be dead. If no event happens until the delay, reset the
-		 * endpoint.
-		 */
-		timer_schedule_reset(ep);
-	}
-
-}
-
-static void isoch_feed_out_timer(void *ep)
-{
-	xhci_isoch_t *const isoch = xhci_endpoint_get(ep)->isoch;
-	fibril_mutex_lock(&isoch->guard);
-	isoch_feed_out(ep);
-	fibril_mutex_unlock(&isoch->guard);
-}
-
-/**
- * Schedule TRBs with empty, withdrawn buffers to HW. Takes empty isoch
- * transfers and pushes their TRBs to the ring.
- *
- * According to 4.11.2.5, we can't just push all TRBs we have. We must not do
- * it too late, but also not too soon.
- */
-static void isoch_feed_in(xhci_endpoint_t *ep)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-	assert(fibril_mutex_is_locked(&isoch->guard));
-
-	xhci_bus_t *bus = bus_to_xhci_bus(ep->base.device->bus);
-	xhci_hc_t *hc = bus->hc;
-
-	bool fed = false;
-
-	while (isoch->transfers[isoch->enqueue].state <= ISOCH_FILLED) {
-		xhci_isoch_transfer_t *const it = &isoch->transfers[isoch->enqueue];
-		usec_t delay;
-
-		/* IN buffers are "filled" with free space */
-		if (it->state == ISOCH_EMPTY) {
-			it->size = ep->base.max_transfer_size;
-			it->state = ISOCH_FILLED;
-			calc_next_mfindex(ep, it);
-		}
-
-		window_decision_t wd;
-		window_decide(&wd, hc, it->mfindex);
-
-		switch (wd.position) {
-		case WINDOW_TOO_SOON:
-			/* Not allowed to feed yet. Defer to later. */
-			delay = wd.offset * 125;
-			usb_log_debug("[isoch] delaying feeding buffer %zu for %lldus",
-			    it - isoch->transfers, delay);
-			fibril_timer_set_locked(isoch->feeding_timer, delay,
-			    isoch_feed_in_timer, ep);
-			goto out;
-		case WINDOW_TOO_LATE:
-			usb_log_debug("[isoch] missed feeding buffer %zu at 0x%" PRIx64 " by"
-			    "%" PRIu64 " uframes", it - isoch->transfers, it->mfindex, wd.offset);
-			/* Missed the opportunity to schedule. Schedule ASAP. */
-			it->mfindex += wd.offset;
-			// Align to ESIT start boundary
-			it->mfindex += ep->interval - 1;
-			it->mfindex &= ~(ep->interval - 1);
-
-			/* fallthrough */
-		case WINDOW_INSIDE:
-			isoch->enqueue = (isoch->enqueue + 1) % isoch->buffer_count;
-			isoch->last_mf = it->mfindex;
-
-			usb_log_debug("[isoch] feeding buffer %zu at 0x%" PRIx64,
-			    it - isoch->transfers, it->mfindex);
-
-			it->error = schedule_isochronous_trb(ep, it);
-			if (it->error) {
-				it->state = ISOCH_COMPLETE;
-			} else {
-				it->state = ISOCH_FED;
-				fed = true;
-			}
-			break;
-		}
-	}
-out:
-
-	if (fed) {
-		hc_ring_ep_doorbell(ep, 0);
-		/*
-		 * The ring may be dead. If no event happens until the delay, reset the
-		 * endpoint.
-		 */
-		timer_schedule_reset(ep);
-	}
-}
-
-static void isoch_feed_in_timer(void *ep)
-{
-	xhci_isoch_t *const isoch = xhci_endpoint_get(ep)->isoch;
-	fibril_mutex_lock(&isoch->guard);
-	isoch_feed_in(ep);
-	fibril_mutex_unlock(&isoch->guard);
-}
-
-/**
- * First, withdraw all (at least one) results left by previous transfers to
- * make room in the ring. Stop on first error.
- *
- * When there is at least one buffer free, fill it with data. Then try to feed
- * it to the xHC.
- */
-errno_t isoch_schedule_out(xhci_transfer_t *transfer)
-{
-	errno_t err = EOK;
-
-	xhci_endpoint_t *ep = xhci_endpoint_get(transfer->batch.ep);
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	/* This shall be already checked by endpoint */
-	assert(transfer->batch.size <= ep->base.max_transfer_size);
-
-	fibril_mutex_lock(&isoch->guard);
-
-	/* Get the buffer to write to */
-	xhci_isoch_transfer_t *it = &isoch->transfers[isoch->enqueue];
-
-	/* Wait for the buffer to be completed */
-	while (it->state == ISOCH_FED || it->state == ISOCH_FILLED) {
-		fibril_condvar_wait(&isoch->avail, &isoch->guard);
-		/* The enqueue ptr may have changed while sleeping */
-		it = &isoch->transfers[isoch->enqueue];
-	}
-
-	isoch->enqueue = (isoch->enqueue + 1) % isoch->buffer_count;
-
-	/* Withdraw results from previous transfers. */
-	transfer->batch.transferred_size = 0;
-	xhci_isoch_transfer_t *res = &isoch->transfers[isoch->dequeue];
-	while (res->state == ISOCH_COMPLETE) {
-		isoch->dequeue = (isoch->dequeue + 1) % isoch->buffer_count;
-
-		res->state = ISOCH_EMPTY;
-		transfer->batch.transferred_size += res->size;
-		transfer->batch.error = res->error;
-		if (res->error)
-			break; // Announce one error at a time
-
-		res = &isoch->transfers[isoch->dequeue];
-	}
-
-	assert(it->state == ISOCH_EMPTY);
-
-	/* Calculate when to schedule next transfer */
-	calc_next_mfindex(ep, it);
-	isoch->last_mf = it->mfindex;
-	usb_log_debug("[isoch] buffer %zu will be on schedule at 0x%" PRIx64,
-	    it - isoch->transfers, it->mfindex);
-
-	/* Prepare the transfer. */
-	it->size = transfer->batch.size;
-	memcpy(it->data.virt, transfer->batch.dma_buffer.virt, it->size);
-	it->state = ISOCH_FILLED;
-
-	fibril_timer_clear_locked(isoch->feeding_timer);
-	isoch_feed_out(ep);
-
-	fibril_mutex_unlock(&isoch->guard);
-
-	usb_transfer_batch_finish(&transfer->batch);
-	return err;
-}
-
-/**
- * IN is in fact easier than OUT. Our responsibility is just to feed all empty
- * buffers, and fetch one filled buffer from the ring.
- */
-errno_t isoch_schedule_in(xhci_transfer_t *transfer)
-{
-	xhci_endpoint_t *ep = xhci_endpoint_get(transfer->batch.ep);
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	if (transfer->batch.size < ep->base.max_transfer_size) {
-		usb_log_error("Cannot schedule an undersized isochronous transfer.");
-		return ELIMIT;
-	}
-
-	fibril_mutex_lock(&isoch->guard);
-
-	xhci_isoch_transfer_t *it = &isoch->transfers[isoch->dequeue];
-
-	/* Wait for at least one transfer to complete. */
-	while (it->state != ISOCH_COMPLETE) {
-		/* First, make sure we will have something to read. */
-		fibril_timer_clear_locked(isoch->feeding_timer);
-		isoch_feed_in(ep);
-
-		usb_log_debug("[isoch] waiting for buffer %zu to be completed",
-		    it - isoch->transfers);
-		fibril_condvar_wait(&isoch->avail, &isoch->guard);
-
-		/* The enqueue ptr may have changed while sleeping */
-		it = &isoch->transfers[isoch->dequeue];
-	}
-
-	isoch->dequeue = (isoch->dequeue + 1) % isoch->buffer_count;
-
-	/* Withdraw results from previous transfer. */
-	if (!it->error) {
-		memcpy(transfer->batch.dma_buffer.virt, it->data.virt, it->size);
-		transfer->batch.transferred_size = it->size;
-		transfer->batch.error = it->error;
-	}
-
-	/* Prepare the empty buffer */
-	it->state = ISOCH_EMPTY;
-
-	fibril_mutex_unlock(&isoch->guard);
-	usb_transfer_batch_finish(&transfer->batch);
-
-	return EOK;
-}
-
-void isoch_handle_transfer_event(xhci_hc_t *hc, xhci_endpoint_t *ep,
-    xhci_trb_t *trb)
-{
-	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
-	xhci_isoch_t *const isoch = ep->isoch;
-
-	fibril_mutex_lock(&ep->isoch->guard);
-
-	errno_t err;
-	const xhci_trb_completion_code_t completion_code = TRB_COMPLETION_CODE(*trb);
-
-	switch (completion_code) {
-	case XHCI_TRBC_RING_OVERRUN:
-	case XHCI_TRBC_RING_UNDERRUN:
-		/*
-		 * For OUT, there was nothing to process.
-		 * For IN, the buffer has overfilled.
-		 * In either case, reset the ring.
-		 */
-		usb_log_warning("Ring over/underrun.");
-		isoch_reset_no_timer(ep);
-		fibril_condvar_broadcast(&ep->isoch->avail);
-		fibril_mutex_unlock(&ep->isoch->guard);
-		goto out;
-	case XHCI_TRBC_SHORT_PACKET:
-	case XHCI_TRBC_SUCCESS:
-		err = EOK;
-		break;
-	default:
-		usb_log_warning("Transfer not successfull: %u", completion_code);
-		err = EIO;
-		break;
-	}
-
-	/*
-	 * The order of delivering events is not necessarily the one we would
-	 * expect. It is safer to walk the list of our transfers and check
-	 * which one it is.
-	 * To minimize the amount of transfers checked, we start at dequeue pointer
-	 * and exit the loop as soon as the transfer is found.
-	 */
-	bool found_mine = false;
-	for (size_t i = 0, di = isoch->dequeue; i < isoch->buffer_count; ++i, ++di) {
-		/* Wrap it back to 0, don't use modulo every loop traversal */
-		if (di == isoch->buffer_count) {
-			di = 0;
-		}
-
-		xhci_isoch_transfer_t *const it = &isoch->transfers[di];
-
-		if (it->state == ISOCH_FED && it->interrupt_trb_phys == trb->parameter) {
-			usb_log_debug("[isoch] buffer %zu completed", it - isoch->transfers);
-			it->state = ISOCH_COMPLETE;
-			it->size -= TRB_TRANSFER_LENGTH(*trb);
-			it->error = err;
-			found_mine = true;
-			break;
-		}
-	}
-
-	if (!found_mine) {
-		usb_log_warning("[isoch] A transfer event occured for unknown transfer.");
-	}
-
-	/*
-	 * It may happen that the driver already stopped reading (writing),
-	 * and our buffers are filled (empty). As QEMU (and possibly others)
-	 * does not send RING_UNDERRUN (OVERRUN) event, we set a timer to
-	 * reset it after the buffers should have been consumed. If there
-	 * is no issue, the timer will get restarted often enough.
-	 */
-	timer_schedule_reset(ep);
-
-out:
-	fibril_condvar_broadcast(&ep->isoch->avail);
-	fibril_mutex_unlock(&ep->isoch->guard);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/isoch.h
===================================================================
--- uspace/drv/bus/usb/xhci/isoch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief Data structures and functions related to isochronous transfers.
- */
-
-#ifndef XHCI_ISOCH_H
-#define XHCI_ISOCH_H
-
-#include <usb/dma_buffer.h>
-
-#include "trb_ring.h"
-
-#include "transfers.h"
-
-typedef struct xhci_endpoint xhci_endpoint_t;
-
-typedef enum {
-	ISOCH_EMPTY,	/* Unused yet */
-	ISOCH_FILLED,	/* The data buffer is valid */
-	ISOCH_FED,	/* The data buffer is in possession of xHC */
-	ISOCH_COMPLETE,	/* The error code is valid */
-} xhci_isoch_transfer_state_t;
-
-typedef struct {
-	/** Buffer with data */
-	dma_buffer_t data;
-	/** Used buffer size */
-	size_t size;
-
-	/** Current state */
-	xhci_isoch_transfer_state_t state;
-
-	/** Microframe to which to schedule */
-	uint64_t mfindex;
-
-	/** Physical address of enqueued TRB */
-	uintptr_t interrupt_trb_phys;
-
-	/** Result of the transfer. Valid only if status == ISOCH_COMPLETE. */
-	errno_t error;
-} xhci_isoch_transfer_t;
-
-typedef struct {
-	/** Protects common buffers. */
-	fibril_mutex_t guard;
-
-	/** Signals filled buffer. */
-	fibril_condvar_t avail;
-
-	/** Defers handing buffers to the HC. */
-	fibril_timer_t *feeding_timer;
-
-	/** Resets endpoint if there is no traffic. */
-	fibril_timer_t *reset_timer;
-
-	/**
-	 * The maximum size of an isochronous transfer
-	 * and therefore the size of buffers
-	 */
-	size_t max_size;
-
-	/** The microframe at which the last TRB was scheduled. */
-	uint64_t last_mf;
-
-	/** The number of transfer buffers allocated */
-	size_t buffer_count;
-
-	/** Isochronous scheduled transfers with respective buffers */
-	xhci_isoch_transfer_t *transfers;
-
-	/**
-	 * Out: Next buffer that will be handed to HW.
-	 * In:  Invalid. Hidden inside HC.
-	 */
-	size_t hw_enqueue;
-
-	/**
-	 * Out: Next buffer that will be used for writing.
-	 * In:  Next buffer that will be enqueued to be written by the HC
-	 */
-	size_t enqueue;
-
-	/**
-	 * Out: First buffer that will be checked for completion
-	 * In:  Next buffer to be read from, when valid.
-	 */
-	size_t dequeue;
-} xhci_isoch_t;
-
-typedef struct usb_endpoint_descriptors usb_endpoint_descriptors_t;
-
-extern void isoch_init(xhci_endpoint_t *, const usb_endpoint_descriptors_t *);
-extern void isoch_fini(xhci_endpoint_t *);
-extern errno_t isoch_alloc_transfers(xhci_endpoint_t *);
-
-extern errno_t isoch_schedule_out(xhci_transfer_t *);
-extern errno_t isoch_schedule_in(xhci_transfer_t *);
-extern void isoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *,
-    xhci_trb_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/main.c
===================================================================
--- uspace/drv/bus/usb/xhci/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Main routines of XHCI driver.
- */
-
-#include <ddf/driver.h>
-#include <errno.h>
-#include <io/log.h>
-#include <io/logctl.h>
-#include <usb/debug.h>
-#include <usb/host/ddf_helpers.h>
-
-#include "hc.h"
-#include "rh.h"
-#include "endpoint.h"
-
-#define NAME "xhci"
-
-static inline xhci_hc_t *hcd_to_hc(hc_device_t *hcd)
-{
-	assert(hcd);
-	return (xhci_hc_t *) hcd;
-}
-
-static errno_t hcd_hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
-{
-	errno_t err;
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	hc_device_setup(hcd, (bus_t *) &hc->bus);
-
-	if ((err = hc_init_mmio(hc, hw_res)))
-		return err;
-
-	if ((err = hc_init_memory(hc, hcd->ddf_dev)))
-		return err;
-
-	return EOK;
-}
-
-static errno_t hcd_irq_code_gen(irq_code_t *code, hc_device_t *hcd,
-    const hw_res_list_parsed_t *hw_res, int *irq)
-{
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	return hc_irq_code_gen(code, hc, hw_res, irq);
-}
-
-static errno_t hcd_claim(hc_device_t *hcd)
-{
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	return hc_claim(hc, hcd->ddf_dev);
-}
-
-static errno_t hcd_start(hc_device_t *hcd)
-{
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	return hc_start(hc);
-}
-
-static errno_t hcd_hc_gone(hc_device_t *hcd)
-{
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	hc_fini(hc);
-	return EOK;
-}
-
-static errno_t hcd_hc_quiesce(hc_device_t *hcd)
-{
-	xhci_hc_t *hc = hcd_to_hc(hcd);
-	hc_quiesce(hc);
-	return EOK;
-}
-
-static const hc_driver_t xhci_driver = {
-	.name = NAME,
-	.hc_device_size = sizeof(xhci_hc_t),
-
-	.hc_add = hcd_hc_add,
-	.irq_code_gen = hcd_irq_code_gen,
-	.claim = hcd_claim,
-	.start = hcd_start,
-	.hc_gone = hcd_hc_gone,
-	.hc_quiesce = hcd_hc_quiesce
-};
-
-/** Initializes global driver structures (NONE).
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-errno_t main(int argc, char *argv[])
-{
-	log_init(NAME);
-	logctl_set_log_level(NAME, LVL_NOTE);
-	return hc_driver_main(&xhci_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/meson.build
===================================================================
--- uspace/drv/bus/usb/xhci/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#
-# Copyright (c) 2017 Ondrej Hlavaty
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhost', 'usbvirt', 'usb' ]
-src = files(
-	'bus.c',
-	'commands.c',
-	'debug.c',
-	'device.c',
-	'endpoint.c',
-	'hc.c',
-	'isoch.c',
-	'main.c',
-	'rh.c',
-	'scratchpad.c',
-	'streams.c',
-	'transfers.c',
-	'trb_ring.c',
-)
-
-test_src = files(
-	'test/reg-ops.c',
-)
Index: pace/drv/bus/usb/xhci/rh.c
===================================================================
--- uspace/drv/bus/usb/xhci/rh.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,345 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty, Michal Staruch, Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The roothub structures abstraction.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <usb/request.h>
-#include <usb/debug.h>
-#include <usb/host/bus.h>
-#include <usb/host/ddf_helpers.h>
-#include <usb/dma_buffer.h>
-#include <usb/host/hcd.h>
-#include <usb/port.h>
-
-#include "debug.h"
-#include "commands.h"
-#include "endpoint.h"
-#include "hc.h"
-#include "hw_struct/trb.h"
-#include "rh.h"
-#include "transfers.h"
-
-/* This mask only lists registers, which imply port change. */
-static const uint32_t port_events_mask =
-    XHCI_REG_MASK(XHCI_PORT_CSC) |
-    XHCI_REG_MASK(XHCI_PORT_PEC) |
-    XHCI_REG_MASK(XHCI_PORT_WRC) |
-    XHCI_REG_MASK(XHCI_PORT_OCC) |
-    XHCI_REG_MASK(XHCI_PORT_PRC) |
-    XHCI_REG_MASK(XHCI_PORT_PLC) |
-    XHCI_REG_MASK(XHCI_PORT_CEC);
-
-static const uint32_t port_reset_mask =
-    XHCI_REG_MASK(XHCI_PORT_WRC) |
-    XHCI_REG_MASK(XHCI_PORT_PRC);
-
-typedef struct rh_port {
-	usb_port_t base;
-	xhci_rh_t *rh;
-	uint8_t major;
-	xhci_port_regs_t *regs;
-	xhci_device_t *device;
-} rh_port_t;
-
-static int rh_worker(void *);
-
-/**
- * Initialize the roothub subsystem.
- */
-errno_t xhci_rh_init(xhci_rh_t *rh, xhci_hc_t *hc)
-{
-	assert(rh);
-	assert(hc);
-
-	rh->hc = hc;
-	rh->max_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
-	rh->ports = calloc(rh->max_ports, sizeof(rh_port_t));
-	if (!rh->ports)
-		return ENOMEM;
-
-	const errno_t err = bus_device_init(&rh->device.base, &rh->hc->bus.base);
-	if (err) {
-		free(rh->ports);
-		return err;
-	}
-
-	rh->event_worker = joinable_fibril_create(&rh_worker, rh);
-	if (!rh->event_worker) {
-		free(rh->ports);
-		return err;
-	}
-
-	for (unsigned i = 0; i < rh->max_ports; i++) {
-		usb_port_init(&rh->ports[i].base);
-		rh->ports[i].rh = rh;
-		rh->ports[i].regs = &rh->hc->op_regs->portrs[i];
-	}
-
-	/* Initialize route string */
-	rh->device.route_str = 0;
-
-	xhci_sw_ring_init(&rh->event_ring, rh->max_ports);
-
-	return EOK;
-}
-
-/**
- * Finalize the RH subsystem.
- */
-errno_t xhci_rh_fini(xhci_rh_t *rh)
-{
-	assert(rh);
-	xhci_rh_stop(rh);
-
-	joinable_fibril_destroy(rh->event_worker);
-	xhci_sw_ring_fini(&rh->event_ring);
-	return EOK;
-}
-
-static rh_port_t *get_rh_port(usb_port_t *port)
-{
-	assert(port);
-	return (rh_port_t *) port;
-}
-
-/**
- * Create and setup a device directly connected to RH. As the xHCI is not using
- * a virtual usbhub device for RH, this routine is called for devices directly.
- */
-static errno_t rh_enumerate_device(usb_port_t *usb_port)
-{
-	errno_t err;
-	rh_port_t *port = get_rh_port(usb_port);
-
-	if (port->major <= 2) {
-		/* USB ports for lower speeds needs their port reset first. */
-		XHCI_REG_SET(port->regs, XHCI_PORT_PR, 1);
-		if ((err = usb_port_wait_for_enabled(&port->base)))
-			return err;
-	} else {
-		/* Do the Warm reset to ensure the state is clear. */
-		XHCI_REG_SET(port->regs, XHCI_PORT_WPR, 1);
-		if ((err = usb_port_wait_for_enabled(&port->base)))
-			return err;
-	}
-
-	/*
-	 * We cannot know in advance, whether the speed in the status register
-	 * is valid - it depends on the protocol. So we read it later, but then
-	 * we have to check if the port is still enabled.
-	 */
-	uint32_t status = XHCI_REG_RD_FIELD(&port->regs->portsc, 32);
-
-	bool enabled = !!(status & XHCI_REG_MASK(XHCI_PORT_PED));
-	if (!enabled)
-		return ENOENT;
-
-	unsigned psiv = (status & XHCI_REG_MASK(XHCI_PORT_PS)) >>
-	    XHCI_REG_SHIFT(XHCI_PORT_PS);
-	const usb_speed_t speed = port->rh->hc->speeds[psiv].usb_speed;
-
-	device_t *dev = hcd_ddf_fun_create(&port->rh->hc->base, speed);
-	if (!dev) {
-		usb_log_error("Failed to create USB device function.");
-		return ENOMEM;
-	}
-
-	dev->hub = &port->rh->device.base;
-	dev->tier = 1;
-	dev->port = port - port->rh->ports + 1;
-
-	port->device = xhci_device_get(dev);
-	port->device->rh_port = dev->port;
-
-	usb_log_debug("Enumerating new %s-speed device on port %u.",
-	    usb_str_speed(dev->speed), dev->port);
-
-	if ((err = bus_device_enumerate(dev))) {
-		usb_log_error("Failed to enumerate USB device: %s", str_error(err));
-		return err;
-	}
-
-	if (!ddf_fun_get_name(dev->fun)) {
-		bus_device_set_default_name(dev);
-	}
-
-	if ((err = ddf_fun_bind(dev->fun))) {
-		usb_log_error("Failed to register device " XHCI_DEV_FMT " DDF function: %s.",
-		    XHCI_DEV_ARGS(*port->device), str_error(err));
-		goto err_usb_dev;
-	}
-
-	return EOK;
-
-err_usb_dev:
-	hcd_ddf_fun_destroy(dev);
-	port->device = NULL;
-	return err;
-}
-
-/**
- * Deal with a detached device.
- */
-static void rh_remove_device(usb_port_t *usb_port)
-{
-	rh_port_t *port = get_rh_port(usb_port);
-
-	assert(port->device);
-	usb_log_info("Device " XHCI_DEV_FMT " at port %zu has been disconnected.",
-	    XHCI_DEV_ARGS(*port->device), port - port->rh->ports + 1);
-
-	/* Remove device from XHCI bus. */
-	bus_device_gone(&port->device->base);
-
-	/* Mark the device as detached. */
-	port->device = NULL;
-}
-
-/**
- * Handle all changes on specified port.
- */
-static void handle_port_change(xhci_rh_t *rh, uint8_t port_id)
-{
-	rh_port_t *const port = &rh->ports[port_id - 1];
-
-	uint32_t status = XHCI_REG_RD_FIELD(&port->regs->portsc, 32);
-
-	while (status & port_events_mask) {
-		/*
-		 * The PED bit in xHCI has RW1C semantics, which means that
-		 * writing 1 to it will disable the port. Which means all
-		 * standard mechanisms of register handling fails here.
-		 */
-		XHCI_REG_WR_FIELD(&port->regs->portsc,
-		    status & ~XHCI_REG_MASK(XHCI_PORT_PED), 32);
-
-		const bool connected = !!(status & XHCI_REG_MASK(XHCI_PORT_CCS));
-		const bool enabled = !!(status & XHCI_REG_MASK(XHCI_PORT_PED));
-
-		if (status & XHCI_REG_MASK(XHCI_PORT_CSC)) {
-			usb_log_info("Connected state changed on port %u.", port_id);
-			status &= ~XHCI_REG_MASK(XHCI_PORT_CSC);
-
-			if (connected) {
-				usb_port_connected(&port->base, &rh_enumerate_device);
-			} else {
-				usb_port_disabled(&port->base, &rh_remove_device);
-			}
-		}
-
-		if (status & port_reset_mask) {
-			status &= ~port_reset_mask;
-
-			if (enabled) {
-				usb_port_enabled(&port->base);
-			} else {
-				usb_port_disabled(&port->base, &rh_remove_device);
-			}
-		}
-
-		status &= port_events_mask;
-		if (status != 0)
-			usb_log_debug("RH port %u change not handled: 0x%x", port_id, status);
-
-		/* Make sure that PSCEG is 0 before exiting the loop. */
-		status = XHCI_REG_RD_FIELD(&port->regs->portsc, 32);
-	}
-}
-
-void xhci_rh_set_ports_protocol(xhci_rh_t *rh,
-    unsigned offset, unsigned count, unsigned major)
-{
-	for (unsigned i = offset; i < offset + count; i++)
-		rh->ports[i - 1].major = major;
-}
-
-void xhci_rh_start(xhci_rh_t *rh)
-{
-	xhci_sw_ring_restart(&rh->event_ring);
-	joinable_fibril_start(rh->event_worker);
-
-	/*
-	 * The reset changed status of all ports, and SW originated reason does
-	 * not cause an interrupt.
-	 */
-	for (uint8_t i = 0; i < rh->max_ports; ++i) {
-		handle_port_change(rh, i + 1);
-
-		rh_port_t *const port = &rh->ports[i];
-
-		/*
-		 * When xHCI starts, for some reasons USB 3 ports do not have
-		 * the CSC bit, even though they are connected. Try to find
-		 * such ports.
-		 */
-		if (XHCI_REG_RD(port->regs, XHCI_PORT_CCS) &&
-		    port->base.state == PORT_DISABLED)
-			usb_port_connected(&port->base, &rh_enumerate_device);
-	}
-}
-
-/**
- * Disconnect all devices on all ports. On contrary to ordinary disconnect, this
- * function waits until the disconnection routine is over.
- */
-void xhci_rh_stop(xhci_rh_t *rh)
-{
-	xhci_sw_ring_stop(&rh->event_ring);
-	joinable_fibril_join(rh->event_worker);
-
-	for (uint8_t i = 0; i < rh->max_ports; ++i) {
-		rh_port_t *const port = &rh->ports[i];
-		usb_port_disabled(&port->base, &rh_remove_device);
-		usb_port_fini(&port->base);
-	}
-}
-
-static int rh_worker(void *arg)
-{
-	xhci_rh_t *const rh = arg;
-
-	xhci_trb_t trb;
-	while (xhci_sw_ring_dequeue(&rh->event_ring, &trb) == EOK) {
-		uint8_t port_id = XHCI_QWORD_EXTRACT(trb.parameter, 31, 24);
-		usb_log_debug("Port status change event detected for port %u.", port_id);
-		handle_port_change(rh, port_id);
-	}
-
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/rh.h
===================================================================
--- uspace/drv/bus/usb/xhci/rh.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The roothub structures abstraction.
- */
-
-#ifndef XHCI_RH_H
-#define XHCI_RH_H
-
-#include <usb/host/bus.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/host/utility.h>
-
-#include "hw_struct/regs.h"
-#include "endpoint.h"
-
-typedef struct xhci_hc xhci_hc_t;
-typedef struct ddf_dev ddf_dev_t;
-
-/**
- * xHCI lets the controller define speeds of ports it controls.
- */
-typedef struct xhci_port_speed {
-	char name [4];
-	uint8_t major, minor;
-	uint64_t rx_bps, tx_bps;
-	usb_speed_t usb_speed;
-} xhci_port_speed_t;
-
-typedef struct hcd_roothub hcd_roothub_t;
-typedef struct xhci_bus xhci_bus_t;
-typedef struct rh_port rh_port_t;
-
-/* XHCI root hub instance */
-typedef struct {
-	/** Host controller */
-	xhci_hc_t *hc;
-
-	/* Root for the device tree */
-	xhci_device_t device;
-
-	/* Number of hub ports. */
-	size_t max_ports;
-
-	/* Array of port structures. (size is `max_ports`) */
-	rh_port_t *ports;
-
-	/* Event ring for roothub */
-	xhci_sw_ring_t event_ring;
-
-	joinable_fibril_t *event_worker;
-} xhci_rh_t;
-
-extern errno_t xhci_rh_init(xhci_rh_t *, xhci_hc_t *);
-extern errno_t xhci_rh_fini(xhci_rh_t *);
-
-extern void xhci_rh_set_ports_protocol(xhci_rh_t *, unsigned, unsigned, unsigned);
-extern void xhci_rh_start(xhci_rh_t *);
-extern void xhci_rh_stop(xhci_rh_t *rh);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/scratchpad.c
===================================================================
--- uspace/drv/bus/usb/xhci/scratchpad.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Scratchpad buffer array bookkeeping.
- */
-
-#include <errno.h>
-#include <usb/debug.h>
-#include "hc.h"
-#include <align.h>
-#include "hw_struct/regs.h"
-#include "scratchpad.h"
-
-/**
- * Get the number of scratchpad buffers needed.
- */
-static inline unsigned xhci_scratchpad_count(xhci_hc_t *hc)
-{
-	unsigned lo, hi;
-
-	lo = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_SPBUF_LO);
-	hi = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_SPBUF_HI);
-
-	return (hi << 5) | lo;
-}
-
-/**
- * Allocate all scratchpad buffers, and configure the xHC.
- */
-errno_t xhci_scratchpad_alloc(xhci_hc_t *hc)
-{
-	const unsigned num_bufs = xhci_scratchpad_count(hc);
-
-	if (!num_bufs)
-		return EOK;
-
-	const unsigned array_size = ALIGN_UP(num_bufs * sizeof(uint64_t), PAGE_SIZE);
-	const size_t size = array_size + num_bufs * PAGE_SIZE;
-
-	if (dma_buffer_alloc(&hc->scratchpad_array, size))
-		return ENOMEM;
-
-	memset(hc->scratchpad_array.virt, 0, size);
-
-	const char *base = hc->scratchpad_array.virt + array_size;
-	uint64_t *array = hc->scratchpad_array.virt;
-
-	for (unsigned i = 0; i < num_bufs; ++i) {
-		array[i] = host2xhci(64, dma_buffer_phys(&hc->scratchpad_array,
-		    base + i * PAGE_SIZE));
-	}
-
-	hc->dcbaa[0] = host2xhci(64, dma_buffer_phys_base(&hc->scratchpad_array));
-
-	usb_log_debug("Allocated %d scratchpad buffers.", num_bufs);
-
-	return EOK;
-}
-
-/**
- * Deallocate the scratchpads and deconfigure xHC.
- */
-void xhci_scratchpad_free(xhci_hc_t *hc)
-{
-	const unsigned num_bufs = xhci_scratchpad_count(hc);
-
-	if (!num_bufs)
-		return;
-
-	hc->dcbaa[0] = 0;
-	dma_buffer_free(&hc->scratchpad_array);
-	return;
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/scratchpad.h
===================================================================
--- uspace/drv/bus/usb/xhci/scratchpad.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2017 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * Scratchpad buffers are PAGE_SIZE sized page boundary aligned buffers
- * that are free to use by the xHC.
- *
- * This file provides means of allocation and deallocation of these
- * buffers.
- */
-
-#ifndef XHCI_SCRATCHPAD_H
-#define XHCI_SCRATCHPAD_H
-
-#include <usb/dma_buffer.h>
-
-typedef struct xhci_hc xhci_hc_t;
-
-extern errno_t xhci_scratchpad_alloc(xhci_hc_t *);
-extern void xhci_scratchpad_free(xhci_hc_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/streams.c
===================================================================
--- uspace/drv/bus/usb/xhci/streams.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,493 +1,0 @@
-/*
- * Copyright (c) 2018 Michal Staruch, Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief Structures and functions for Superspeed bulk streams.
- */
-
-#include "endpoint.h"
-#include "hc.h"
-#include "hw_struct/regs.h"
-#include "streams.h"
-
-/**
- * Finds stream data with given stream ID if it exists.
- * Note that streams with ID 0, 65534 and 65535 are reserved.
- * Splits the ID into primary and secondary context ID and searches the structures.
- * @param[in] ep Affected endpoint.
- * @param[in] stream_id Id of the stream.
- */
-xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	if (stream_id == 0 || stream_id >= 65534) {
-		return NULL;
-	}
-
-	/* See 4.12.2.1 for the calculation of the IDs and dividing the stream_id */
-	uint32_t primary_stream_id =
-	    (uint32_t) (stream_id & (ep->primary_stream_data_size - 1));
-	uint32_t secondary_stream_id =
-	    (uint32_t) ((stream_id / ep->primary_stream_data_size) & 0xFF);
-
-	if (primary_stream_id >= ep->primary_stream_data_size) {
-		return NULL;
-	}
-
-	xhci_stream_data_t *primary_data =
-	    &ep->primary_stream_data_array[primary_stream_id];
-	if (secondary_stream_id != 0 && !primary_data->secondary_size) {
-		return NULL;
-	}
-
-	if (!primary_data->secondary_size) {
-		return primary_data;
-	}
-
-	xhci_stream_data_t *secondary_data = primary_data->secondary_data;
-	if (secondary_stream_id >= primary_data->secondary_size) {
-		return NULL;
-	}
-
-	return &secondary_data[secondary_stream_id];
-}
-
-/**
- * Initializes primary stream data structures in endpoint.
- * @param[in] xhci_ep Used XHCI bulk endpoint.
- * @param[in] count Amount of primary streams.
- */
-static errno_t initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count)
-{
-	usb_log_debug("Allocating primary stream context array of size %u "
-	    "for endpoint " XHCI_EP_FMT, count, XHCI_EP_ARGS(*xhci_ep));
-
-	if ((dma_buffer_alloc(&xhci_ep->primary_stream_ctx_dma,
-	    count * sizeof(xhci_stream_ctx_t)))) {
-		return ENOMEM;
-	}
-
-	xhci_ep->primary_stream_ctx_array = xhci_ep->primary_stream_ctx_dma.virt;
-	xhci_ep->primary_stream_data_array = calloc(count, sizeof(xhci_stream_data_t));
-	if (!xhci_ep->primary_stream_data_array) {
-		dma_buffer_free(&xhci_ep->primary_stream_ctx_dma);
-		return ENOMEM;
-	}
-
-	xhci_ep->primary_stream_data_size = count;
-
-	return EOK;
-}
-
-static void clear_primary_structures(xhci_endpoint_t *xhci_ep)
-{
-	usb_log_debug("Deallocating primary stream structures for "
-	    "endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
-
-	dma_buffer_free(&xhci_ep->primary_stream_ctx_dma);
-	free(xhci_ep->primary_stream_data_array);
-
-	xhci_ep->primary_stream_data_array = NULL;
-	xhci_ep->primary_stream_data_size = 0;
-}
-
-static void clear_secondary_streams(xhci_endpoint_t *xhci_ep, unsigned index)
-{
-	xhci_stream_data_t *data = &xhci_ep->primary_stream_data_array[index];
-	if (!data->secondary_size) {
-		xhci_trb_ring_fini(&data->ring);
-		return;
-	}
-
-	for (size_t i = 0; i < data->secondary_size; ++i) {
-		xhci_trb_ring_fini(&data->secondary_data[i].ring);
-	}
-
-	dma_buffer_free(&data->secondary_stream_ctx_dma);
-	free(data->secondary_data);
-}
-
-void xhci_stream_free_ds(xhci_endpoint_t *xhci_ep)
-{
-	usb_log_debug("Freeing stream rings and context arrays of endpoint "
-	    XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
-
-	for (size_t index = 0; index < xhci_ep->primary_stream_data_size; ++index) {
-		clear_secondary_streams(xhci_ep, index);
-	}
-	clear_primary_structures(xhci_ep);
-}
-
-/**
- * Initialize a single primary stream structure with given index.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] xhci_ep XHCI bulk endpoint to use.
- * @param[in] index index of the initialized stream structure.
- */
-static errno_t initialize_primary_stream(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
-    unsigned index)
-{
-	xhci_stream_ctx_t *ctx = &xhci_ep->primary_stream_ctx_array[index];
-	xhci_stream_data_t *data = &xhci_ep->primary_stream_data_array[index];
-	memset(data, 0, sizeof(xhci_stream_data_t));
-
-	errno_t err = EOK;
-
-	/* Init and register TRB ring for the primary stream */
-	if ((err = xhci_trb_ring_init(&data->ring, 0))) {
-		return err;
-	}
-	XHCI_STREAM_DEQ_PTR_SET(*ctx, data->ring.dequeue);
-
-	/* Set to linear stream array */
-	XHCI_STREAM_SCT_SET(*ctx, 1);
-
-	return EOK;
-}
-
-/**
- * Initialize primary streams of XHCI bulk endpoint.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] xhci_ep XHCI bulk endpoint to use.
- */
-static errno_t initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep)
-{
-	errno_t err = EOK;
-	size_t index;
-	for (index = 0; index < xhci_ep->primary_stream_data_size; ++index) {
-		err = initialize_primary_stream(hc, xhci_ep, index);
-		if (err) {
-			goto err_clean;
-		}
-	}
-
-	return EOK;
-
-err_clean:
-	for (size_t i = 0; i < index; ++i) {
-		xhci_trb_ring_fini(&xhci_ep->primary_stream_data_array[i].ring);
-	}
-	return err;
-}
-
-/**
- * Initialize secondary streams of XHCI bulk endpoint.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] xhci_epi XHCI bulk endpoint to use.
- * @param[in] idx Index to primary stream array
- * @param[in] count Number of secondary streams to initialize.
- */
-static errno_t initialize_secondary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
-    unsigned idx, unsigned count)
-{
-	if (count == 0) {
-		/*
-		 * The primary stream context can still point to a single ring, not
-		 * a secondary.
-		 */
-		return initialize_primary_stream(hc, xhci_ep, idx);
-	}
-
-	if ((count & (count - 1)) != 0 || count < 8 || count > 256) {
-		usb_log_error("The secondary stream array size must be a power of 2 "
-		    "between 8 and 256.");
-		return EINVAL;
-	}
-
-	xhci_stream_ctx_t *ctx = &xhci_ep->primary_stream_ctx_array[idx];
-	xhci_stream_data_t *data = &xhci_ep->primary_stream_data_array[idx];
-	memset(data, 0, sizeof(xhci_stream_data_t));
-
-	data->secondary_size = count;
-	data->secondary_data = calloc(count, sizeof(xhci_stream_data_t));
-	if (!data->secondary_size) {
-		return ENOMEM;
-	}
-
-	if ((dma_buffer_alloc(&data->secondary_stream_ctx_dma,
-	    count * sizeof(xhci_stream_ctx_t)))) {
-		free(data->secondary_data);
-		return ENOMEM;
-	}
-	data->secondary_stream_ctx_array = data->secondary_stream_ctx_dma.virt;
-
-	XHCI_STREAM_DEQ_PTR_SET(*ctx, dma_buffer_phys_base(&data->secondary_stream_ctx_dma));
-	XHCI_STREAM_SCT_SET(*ctx, fnzb32(count) + 1);
-
-	/* Initialize all the rings. */
-	errno_t err = EOK;
-	size_t index;
-	for (index = 0; index < count; ++index) {
-		xhci_stream_ctx_t *secondary_ctx = &data->secondary_stream_ctx_array[index];
-		xhci_stream_data_t *secondary_data = &data->secondary_data[index];
-		/* Init and register TRB ring for every secondary stream */
-		if ((err = xhci_trb_ring_init(&secondary_data->ring, 0))) {
-			goto err_init;
-		}
-
-		XHCI_STREAM_DEQ_PTR_SET(*secondary_ctx, secondary_data->ring.dequeue);
-		/* Set to secondary stream array */
-		XHCI_STREAM_SCT_SET(*secondary_ctx, 0);
-	}
-
-	return EOK;
-
-err_init:
-	for (size_t i = 0; i < index; ++i) {
-		xhci_trb_ring_fini(&data->secondary_data[i].ring);
-	}
-	return err;
-}
-
-/**
- * Configure XHCI bulk endpoint's stream context.
- * @param[in] xhci_ep Associated XHCI bulk endpoint.
- * @param[in] ctx Endpoint context to configure.
- * @param[in] pstreams The value of MaxPStreams.
- * @param[in] lsa Specifies if the stream IDs point to primary stream array.
- */
-static void setup_stream_context(xhci_endpoint_t *xhci_ep, xhci_ep_ctx_t *ctx,
-    unsigned pstreams, unsigned lsa)
-{
-	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(xhci_ep));
-	XHCI_EP_MAX_PACKET_SIZE_SET(*ctx, xhci_ep->base.max_packet_size);
-	XHCI_EP_MAX_BURST_SIZE_SET(*ctx, xhci_ep->max_burst - 1);
-	XHCI_EP_ERROR_COUNT_SET(*ctx, 3);
-
-	XHCI_EP_MAX_P_STREAMS_SET(*ctx, pstreams);
-	XHCI_EP_TR_DPTR_SET(*ctx, dma_buffer_phys_base(&xhci_ep->primary_stream_ctx_dma));
-	XHCI_EP_LSA_SET(*ctx, lsa);
-}
-
-/**
- * Verifies if all the common preconditions are satisfied.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] dev Used device.
- * @param[in] xhci_ep Associated XHCI bulk endpoint.
- * @param[in] count Amount of primary streams requested.
- */
-static errno_t verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev,
-    xhci_endpoint_t *xhci_ep, unsigned count)
-{
-	if (xhci_ep->base.transfer_type != USB_TRANSFER_BULK ||
-	    dev->base.speed != USB_SPEED_SUPER) {
-		usb_log_error("Streams are only supported by superspeed bulk endpoints.");
-		return EINVAL;
-	}
-
-	if (xhci_ep->max_streams <= 1) {
-		usb_log_error("Streams are not supported by endpoint "
-		    XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
-		return EINVAL;
-	}
-
-	if (count < 2) {
-		usb_log_error("The minumum amount of primary streams is 2.");
-		return EINVAL;
-	}
-
-	/*
-	 * The maximum amount of primary streams is 2 ^ (MaxPSA + 1)
-	 * See table 26 of XHCI specification.
-	 */
-	uint8_t max_psa_size = 1 << (XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PSA_SIZE) + 1);
-	if (count > max_psa_size) {
-		usb_log_error("Host controller only supports "
-		    "%u primary streams.", max_psa_size);
-		return EINVAL;
-	}
-
-	if (count > xhci_ep->max_streams) {
-		usb_log_error("Endpoint " XHCI_EP_FMT " supports only %" PRIu32 " streams.",
-		    XHCI_EP_ARGS(*xhci_ep), xhci_ep->max_streams);
-		return EINVAL;
-	}
-
-	if ((count & (count - 1)) != 0) {
-		usb_log_error("The amount of primary streams must be a power of 2.");
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-/**
- * Cancels streams and reconfigures endpoint back to single ring no stream endpoint.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] dev Used device.
- * @param[in] xhci_ep Associated XHCI bulk endpoint.
- */
-errno_t xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev,
-    xhci_endpoint_t *xhci_ep)
-{
-	if (!xhci_ep->primary_stream_data_size) {
-		usb_log_warning("There are no streams enabled on the endpoint, doing nothing.");
-		return EOK;
-	}
-
-	hc_stop_endpoint(xhci_ep);
-	xhci_endpoint_free_transfer_ds(xhci_ep);
-
-	/* Streams are now removed, proceed with reconfiguring endpoint. */
-	errno_t err;
-	if ((err = xhci_trb_ring_init(&xhci_ep->ring, 0))) {
-		usb_log_error("Failed to initialize a transfer ring.");
-		return err;
-	}
-
-	return hc_update_endpoint(xhci_ep);
-}
-
-/**
- * Initialize, setup and register primary streams.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] dev Used device.
- * @param[in] xhci_ep Associated XHCI bulk endpoint.
- * @param[in] count Amount of primary streams requested.
- */
-errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
-    xhci_endpoint_t *xhci_ep, unsigned count)
-{
-	errno_t err = verify_stream_conditions(hc, dev, xhci_ep, count);
-	if (err) {
-		return err;
-	}
-
-	/*
-	 * We have passed the checks.
-	 * Stop the endpoint, destroy the ring, and transition to streams.
-	 */
-	hc_stop_endpoint(xhci_ep);
-	xhci_endpoint_free_transfer_ds(xhci_ep);
-
-	err = initialize_primary_structures(xhci_ep, count);
-	if (err) {
-		return err;
-	}
-
-	memset(xhci_ep->primary_stream_ctx_array, 0, count * sizeof(xhci_stream_ctx_t));
-	err = initialize_primary_streams(hc, xhci_ep);
-	if (err) {
-		clear_primary_structures(xhci_ep);
-		return err;
-	}
-
-	xhci_ep_ctx_t ep_ctx;
-	/*
-	 * Allowed values are 1-15, where 2 ^ pstreams is the actual amount of
-	 * streams.
-	 */
-	const size_t pstreams = fnzb32(count) - 1;
-	setup_stream_context(xhci_ep, &ep_ctx, pstreams, 1);
-
-	return hc_update_endpoint(xhci_ep);
-}
-
-/**
- * Initialize, setup and register secondary streams.
- * @param[in] hc Host controller of the endpoint.
- * @param[in] dev Used device.
- * @param[in] xhci_ep Associated XHCI bulk endpoint.
- * @param[in] sizes Amount of secondary streams in each of the primary streams.
- *                  This array should have exactly count elements. If the size
- *                  is 0, then a primary ring is created with that index.
- * @param[in] count Amount of primary streams requested.
- */
-errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
-    xhci_endpoint_t *xhci_ep, unsigned *sizes, unsigned count)
-{
-	/* Check if HC supports secondary indexing */
-	if (XHCI_REG_RD(hc->cap_regs, XHCI_CAP_NSS)) {
-		usb_log_error("The host controller doesn't support secondary streams.");
-		return ENOTSUP;
-	}
-
-	errno_t err = verify_stream_conditions(hc, dev, xhci_ep, count);
-	if (err) {
-		return err;
-	}
-
-	if (count > 256) {
-		usb_log_error("The amount of primary streams cannot be higher than 256.");
-		return EINVAL;
-	}
-
-	/*
-	 * Find the largest requested secondary stream size,
-	 * that one is the maximum ID that device can receive.
-	 * We need to make sure the device can handle that ID.
-	 */
-	unsigned max = 0;
-	for (size_t index = 0; index < count; ++index) {
-		if (sizes[count] > max) {
-			max = sizes[count];
-		}
-	}
-
-	if (max * count > xhci_ep->max_streams) {
-		usb_log_error("Endpoint " XHCI_EP_FMT " supports only %" PRIu32 " streams.",
-		    XHCI_EP_ARGS(*xhci_ep), xhci_ep->max_streams);
-		return EINVAL;
-	}
-
-	/*
-	 * We have passed all checks.
-	 * Stop the endpoint, destroy the ring, and transition to streams.
-	 */
-	hc_stop_endpoint(xhci_ep);
-	xhci_endpoint_free_transfer_ds(xhci_ep);
-
-	err = initialize_primary_structures(xhci_ep, count);
-	if (err) {
-		return err;
-	}
-
-	memset(xhci_ep->primary_stream_ctx_array, 0, count * sizeof(xhci_stream_ctx_t));
-	size_t index;
-	for (index = 0; index < count; ++index) {
-		err = initialize_secondary_streams(hc, xhci_ep, index, *(sizes + index));
-		if (err) {
-			goto err_init;
-		}
-	}
-
-	xhci_ep_ctx_t ep_ctx;
-	const size_t pstreams = fnzb32(count) - 1;
-	setup_stream_context(xhci_ep, &ep_ctx, pstreams, 0);
-
-	return hc_update_endpoint(xhci_ep);
-
-err_init:
-	for (size_t i = 0; i < index; ++i) {
-		clear_secondary_streams(xhci_ep, i);
-	}
-	clear_primary_structures(xhci_ep);
-	return err;
-}
Index: pace/drv/bus/usb/xhci/streams.h
===================================================================
--- uspace/drv/bus/usb/xhci/streams.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2017 Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief Structures and functions for Superspeed bulk streams.
- */
-
-#ifndef XHCI_STREAMS_H
-#define XHCI_STREAMS_H
-
-#include "endpoint.h"
-#include "hw_struct/context.h"
-#include "trb_ring.h"
-
-typedef struct xhci_endpoint xhci_endpoint_t;
-typedef struct xhci_stream_data xhci_stream_data_t;
-
-typedef struct xhci_stream_data {
-	/** The TRB ring for the context, if valid */
-	xhci_trb_ring_t ring;
-
-	/**
-	 * Pointer to the array of secondary stream context data for primary
-	 * data.
-	 */
-	xhci_stream_data_t *secondary_data;
-
-	/** The size of secondary stream context data array */
-	uint32_t secondary_size;
-
-	/** Secondary stream context array - allocated for xHC hardware.
-	 * Required for later dealocation of secondary structure.
-	 */
-	xhci_stream_ctx_t *secondary_stream_ctx_array;
-	dma_buffer_t secondary_stream_ctx_dma;
-} xhci_stream_data_t;
-
-extern xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t *, uint32_t);
-extern void xhci_stream_free_ds(xhci_endpoint_t *);
-
-extern errno_t xhci_endpoint_remove_streams(xhci_hc_t *, xhci_device_t *,
-    xhci_endpoint_t *);
-extern errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *,
-    xhci_device_t *, xhci_endpoint_t *, unsigned);
-extern errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *,
-    xhci_device_t *, xhci_endpoint_t *, unsigned *, unsigned);
-
-#endif
Index: pace/drv/bus/usb/xhci/test/reg-ops.c
===================================================================
--- uspace/drv/bus/usb/xhci/test/reg-ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-#include <pcut/pcut.h>
-#include "../hw_struct/regs.h"
-
-PCUT_INIT;
-
-static struct {
-	uint32_t field32;
-	uint16_t field16;
-	uint8_t field8;
-} regs[1];
-
-#define REG_8_FLAG    field8,  8,  FLAG,  3
-#define REG_8_RANGE   field8,  8, RANGE,  6, 2
-#define REG_8_FIELD   field8,  8, FIELD
-#define REG_16_FLAG  field16, 16,  FLAG,  8
-#define REG_16_RANGE field16, 16, RANGE, 11, 4
-#define REG_16_FIELD field16, 16, FIELD
-#define REG_32_FLAG  field32, 32,  FLAG, 16
-#define REG_32_RANGE field32, 32, RANGE, 23, 8
-#define REG_32_FIELD field32, 32, FIELD
-
-#define RESET memset(regs, 0, sizeof(regs[0]))
-#define EQ(exp, act) PCUT_ASSERT_INT_EQUALS((exp), (act))
-
-PCUT_TEST(ops_8_field)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_8_FIELD));
-
-	XHCI_REG_WR(regs, REG_8_FIELD, 0x55);
-	EQ(0x55, XHCI_REG_RD(regs, REG_8_FIELD));
-	EQ(0x55, regs->field8);
-
-	RESET;
-	XHCI_REG_SET(regs, REG_8_FIELD, 0x55);
-	EQ(0x55, XHCI_REG_RD(regs, REG_8_FIELD));
-	EQ(0x55, regs->field8);
-
-	XHCI_REG_CLR(regs, REG_8_FIELD, 0x5);
-	EQ(0x50, XHCI_REG_RD(regs, REG_8_FIELD));
-	EQ(0x50, regs->field8);
-}
-
-PCUT_TEST(ops_8_range)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_8_RANGE));
-
-	XHCI_REG_WR(regs, REG_8_RANGE, 0x55);
-	EQ(0x15, XHCI_REG_RD(regs, REG_8_RANGE));
-	EQ(0x54, regs->field8);
-
-	XHCI_REG_SET(regs, REG_8_RANGE, 0x2);
-	EQ(0x17, XHCI_REG_RD(regs, REG_8_RANGE));
-	EQ(0x5c, regs->field8);
-
-	XHCI_REG_CLR(regs, REG_8_RANGE, 0x2);
-	EQ(0x15, XHCI_REG_RD(regs, REG_8_RANGE));
-	EQ(0x54, regs->field8);
-}
-
-PCUT_TEST(ops_8_flag)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_8_FLAG));
-
-	XHCI_REG_WR(regs, REG_8_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_8_FLAG));
-	EQ(8, regs->field8);
-
-	RESET;
-	XHCI_REG_SET(regs, REG_8_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_8_FLAG));
-	EQ(8, regs->field8);
-
-	XHCI_REG_CLR(regs, REG_8_FLAG, 1);
-	EQ(0, XHCI_REG_RD(regs, REG_8_FLAG));
-	EQ(0, regs->field8);
-}
-
-PCUT_TEST(ops_16_field)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_16_FIELD));
-
-	XHCI_REG_WR(regs, REG_16_FIELD, 0x5555);
-	EQ(0x5555, XHCI_REG_RD(regs, REG_16_FIELD));
-	EQ(0x5555, xhci2host(16, regs->field16));
-
-	XHCI_REG_SET(regs, REG_16_FIELD, 0x00aa);
-	EQ(0x55ff, XHCI_REG_RD(regs, REG_16_FIELD));
-	EQ(0x55ff, xhci2host(16, regs->field16));
-
-	XHCI_REG_CLR(regs, REG_16_FIELD, 0x055a);
-	EQ(0x50a5, XHCI_REG_RD(regs, REG_16_FIELD));
-	EQ(0x50a5, xhci2host(16, regs->field16));
-}
-
-PCUT_TEST(ops_16_range)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_16_RANGE));
-
-	XHCI_REG_WR(regs, REG_16_RANGE, 0x5a5a);
-	EQ(0x5a, XHCI_REG_RD(regs, REG_16_RANGE));
-	EQ(0x05a0, xhci2host(16, regs->field16));
-
-	XHCI_REG_SET(regs, REG_16_RANGE, 0xa5);
-	EQ(0xff, XHCI_REG_RD(regs, REG_16_RANGE));
-	EQ(0x0ff0, xhci2host(16, regs->field16));
-
-	XHCI_REG_CLR(regs, REG_16_RANGE, 0x5a);
-	EQ(0xa5, XHCI_REG_RD(regs, REG_16_RANGE));
-	EQ(0x0a50, xhci2host(16, regs->field16));
-}
-
-PCUT_TEST(ops_16_flag)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_16_FLAG));
-
-	XHCI_REG_WR(regs, REG_16_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_16_FLAG));
-	EQ(0x100, xhci2host(16, regs->field16));
-
-	RESET;
-	XHCI_REG_SET(regs, REG_16_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_16_FLAG));
-	EQ(0x100, xhci2host(16, regs->field16));
-
-	XHCI_REG_CLR(regs, REG_16_FLAG, 1);
-	EQ(0, XHCI_REG_RD(regs, REG_16_FLAG));
-	EQ(0, xhci2host(16, regs->field16));
-}
-
-PCUT_TEST(ops_32_field)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_32_FIELD));
-
-	XHCI_REG_WR(regs, REG_32_FIELD, 0xffaa5500);
-	EQ(0xffaa5500, XHCI_REG_RD(regs, REG_32_FIELD));
-	EQ(0xffaa5500, xhci2host(32, regs->field32));
-
-	XHCI_REG_SET(regs, REG_32_FIELD, 0x0055aa00);
-	EQ(0xffffff00, XHCI_REG_RD(regs, REG_32_FIELD));
-	EQ(0xffffff00, xhci2host(32, regs->field32));
-
-	XHCI_REG_CLR(regs, REG_32_FIELD, 0x00aa55ff);
-	EQ(0xff55aa00, XHCI_REG_RD(regs, REG_32_FIELD));
-	EQ(0xff55aa00, xhci2host(32, regs->field32));
-}
-
-PCUT_TEST(ops_32_range)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_32_RANGE));
-
-	XHCI_REG_WR(regs, REG_32_RANGE, 0xff5a0);
-	EQ(0xf5a0, XHCI_REG_RD(regs, REG_32_RANGE));
-	EQ(0x00f5a000, xhci2host(32, regs->field32));
-
-	XHCI_REG_SET(regs, REG_32_RANGE, 0xffa50);
-	EQ(0xfff0, XHCI_REG_RD(regs, REG_32_RANGE));
-	EQ(0x00fff000, xhci2host(32, regs->field32));
-
-	XHCI_REG_CLR(regs, REG_32_RANGE, 0xf05af);
-	EQ(0xfa50, XHCI_REG_RD(regs, REG_32_RANGE));
-	EQ(0x00fa5000, xhci2host(32, regs->field32));
-}
-
-PCUT_TEST(ops_32_flag)
-{
-	RESET;
-	EQ(0, XHCI_REG_RD(regs, REG_32_FLAG));
-
-	XHCI_REG_WR(regs, REG_32_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_32_FLAG));
-	EQ(0x10000, xhci2host(32, regs->field32));
-
-	RESET;
-	XHCI_REG_SET(regs, REG_32_FLAG, 1);
-	EQ(1, XHCI_REG_RD(regs, REG_32_FLAG));
-	EQ(0x10000, xhci2host(32, regs->field32));
-
-	XHCI_REG_CLR(regs, REG_32_FLAG, 1);
-	EQ(0, XHCI_REG_RD(regs, REG_32_FLAG));
-	EQ(0, xhci2host(32, regs->field32));
-}
-PCUT_MAIN();
Index: pace/drv/bus/usb/xhci/transfers.c
===================================================================
--- uspace/drv/bus/usb/xhci/transfers.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,511 +1,0 @@
-/*
- * Copyright (c) 2018 Michal Staruch, Ondrej Hlavaty, Petr Manek, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller transfer ring management
- */
-
-#include <usb/debug.h>
-#include <usb/request.h>
-#include "endpoint.h"
-#include "hc.h"
-#include "hw_struct/trb.h"
-#include "streams.h"
-#include "transfers.h"
-#include "trb_ring.h"
-
-typedef enum {
-	STAGE_OUT,
-	STAGE_IN,
-} stage_dir_flag_t;
-
-/** Get direction flag of data stage.
- *  See Table 7 of xHCI specification.
- */
-static inline stage_dir_flag_t get_status_direction_flag(xhci_trb_t *trb,
-    uint8_t bmRequestType, uint16_t wLength)
-{
-	/* See Table 7 of xHCI specification */
-	return SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(bmRequestType) && (wLength > 0) ?
-	    STAGE_OUT :
-	    STAGE_IN;
-}
-
-typedef enum {
-	DATA_STAGE_NO = 0,
-	DATA_STAGE_OUT = 2,
-	DATA_STAGE_IN = 3,
-} data_stage_type_t;
-
-/** Get transfer type flag.
- *  See Table 8 of xHCI specification.
- */
-static inline data_stage_type_t get_transfer_type(xhci_trb_t *trb, uint8_t
-    bmRequestType, uint16_t wLength)
-{
-	if (wLength == 0)
-		return DATA_STAGE_NO;
-
-	/* See Table 7 of xHCI specification */
-	return SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(bmRequestType) ?
-	    DATA_STAGE_IN :
-	    DATA_STAGE_NO;
-}
-
-static inline bool configure_endpoint_needed(usb_device_request_setup_packet_t *setup)
-{
-	usb_request_type_t request_type = SETUP_REQUEST_TYPE_GET_TYPE(setup->request_type);
-
-	return request_type == USB_REQUEST_TYPE_STANDARD &&
-	    (setup->request == USB_DEVREQ_SET_CONFIGURATION ||
-	    setup->request == USB_DEVREQ_SET_INTERFACE);
-}
-
-/**
- * Create a xHCI-specific transfer batch.
- *
- * Bus callback.
- */
-usb_transfer_batch_t *xhci_transfer_create(endpoint_t *ep)
-{
-	xhci_transfer_t *transfer = calloc(1, sizeof(xhci_transfer_t));
-	if (!transfer)
-		return NULL;
-
-	usb_transfer_batch_init(&transfer->batch, ep);
-	return &transfer->batch;
-}
-
-/**
- * Destroy a xHCI transfer.
- */
-void xhci_transfer_destroy(usb_transfer_batch_t *batch)
-{
-	xhci_transfer_t *transfer = xhci_transfer_from_batch(batch);
-	free(transfer);
-}
-
-static xhci_trb_ring_t *get_ring(xhci_transfer_t *transfer)
-{
-	xhci_endpoint_t *xhci_ep = xhci_endpoint_get(transfer->batch.ep);
-	return xhci_endpoint_get_ring(xhci_ep, transfer->batch.target.stream);
-}
-
-#define MAX_CHUNK_SIZE (1 << 16)
-
-typedef struct {
-	/* Input parameters */
-	dma_buffer_t buf;
-	size_t chunk_size, packet_count, mps, max_trb_count;
-
-	/* Changing at runtime */
-	size_t transferred, remaining;
-	void *pos;
-} trb_splitter_t;
-
-static void trb_splitter_init(trb_splitter_t *ts, xhci_transfer_t *transfer)
-{
-	ts->buf = transfer->batch.dma_buffer;
-
-	const size_t chunk_mask = dma_policy_chunk_mask(ts->buf.policy);
-	ts->chunk_size = (chunk_mask > MAX_CHUNK_SIZE + 1) ?
-	    MAX_CHUNK_SIZE : (chunk_mask + 1);
-
-	ts->remaining = transfer->batch.size;
-	ts->max_trb_count = (ts->remaining + ts->chunk_size - 1) / ts->chunk_size + 1;
-	ts->mps = transfer->batch.ep->max_packet_size;
-	ts->packet_count = (ts->remaining + ts->mps - 1) / ts->mps;
-
-	ts->transferred = 0;
-	ts->pos = ts->buf.virt + transfer->batch.offset;
-}
-
-static void trb_split_next(xhci_trb_t *trb, trb_splitter_t *ts)
-{
-	xhci_trb_clean(trb);
-
-	size_t size = min(ts->remaining, ts->chunk_size);
-
-	/* First TRB might be misaligned */
-	if (ts->transferred == 0) {
-		const size_t offset = (ts->pos - ts->buf.virt) % ts->chunk_size;
-		size = min(size, ts->chunk_size - offset);
-	}
-
-	ts->transferred += size;
-	ts->remaining -= size;
-
-	const size_t tx_packets = (ts->transferred + ts->mps - 1) / ts->mps;
-	const unsigned td_size = min(31, ts->packet_count - tx_packets);
-
-	/* Last TRB must have TD Size = 0 */
-	assert(ts->remaining > 0 || td_size == 0);
-
-	uintptr_t phys = dma_buffer_phys(&ts->buf, ts->pos);
-
-	trb->parameter = host2xhci(64, phys);
-	TRB_CTRL_SET_TD_SIZE(*trb, td_size);
-	TRB_CTRL_SET_XFER_LEN(*trb, size);
-	TRB_CTRL_SET_TRB_TYPE(*trb, XHCI_TRB_TYPE_NORMAL);
-
-	if (ts->remaining)
-		TRB_CTRL_SET_CHAIN(*trb, 1);
-
-	ts->pos += size;
-}
-
-static errno_t schedule_control(xhci_hc_t *hc, xhci_transfer_t *transfer)
-{
-	usb_transfer_batch_t *batch = &transfer->batch;
-	xhci_endpoint_t *xhci_ep = xhci_endpoint_get(transfer->batch.ep);
-
-	usb_device_request_setup_packet_t *setup = &batch->setup.packet;
-
-	trb_splitter_t splitter;
-	trb_splitter_init(&splitter, transfer);
-
-	xhci_trb_t trbs[splitter.max_trb_count + 2];
-	size_t trbs_used = 0;
-
-	xhci_trb_t *trb_setup = &trbs[trbs_used++];
-	xhci_trb_clean(trb_setup);
-
-	trb_setup->parameter = batch->setup.packed;
-
-	/* Size of the setup packet is always 8 */
-	TRB_CTRL_SET_XFER_LEN(*trb_setup, 8);
-
-	/* Immediate data */
-	TRB_CTRL_SET_IDT(*trb_setup, 1);
-	TRB_CTRL_SET_TRB_TYPE(*trb_setup, XHCI_TRB_TYPE_SETUP_STAGE);
-	TRB_CTRL_SET_TRT(*trb_setup,
-	    get_transfer_type(trb_setup, setup->request_type, setup->length));
-
-	stage_dir_flag_t stage_dir = (transfer->batch.dir == USB_DIRECTION_IN) ?
-	    STAGE_IN : STAGE_OUT;
-
-	/* Data stage - first TRB is special */
-	if (splitter.remaining > 0) {
-		xhci_trb_t *trb = &trbs[trbs_used++];
-		trb_split_next(trb, &splitter);
-		TRB_CTRL_SET_TRB_TYPE(*trb, XHCI_TRB_TYPE_DATA_STAGE);
-		TRB_CTRL_SET_DIR(*trb, stage_dir);
-	}
-	while (splitter.remaining > 0)
-		trb_split_next(&trbs[trbs_used++], &splitter);
-
-	/* Status stage */
-	xhci_trb_t *trb_status = &trbs[trbs_used++];
-	xhci_trb_clean(trb_status);
-
-	TRB_CTRL_SET_IOC(*trb_status, 1);
-	TRB_CTRL_SET_TRB_TYPE(*trb_status, XHCI_TRB_TYPE_STATUS_STAGE);
-	TRB_CTRL_SET_DIR(*trb_status, get_status_direction_flag(trb_setup,
-	    setup->request_type, setup->length));
-
-	// Issue a Configure Endpoint command, if needed.
-	if (configure_endpoint_needed(setup)) {
-		const errno_t err = hc_configure_device(xhci_ep_to_dev(xhci_ep));
-		if (err)
-			return err;
-	}
-
-	return xhci_trb_ring_enqueue_multiple(get_ring(transfer), trbs,
-	    trbs_used, &transfer->interrupt_trb_phys);
-}
-
-static errno_t schedule_bulk_intr(xhci_hc_t *hc, xhci_transfer_t *transfer)
-{
-	xhci_trb_ring_t *const ring = get_ring(transfer);
-	if (!ring)
-		return EINVAL;
-
-	/* The stream-enabled endpoints need to chain ED trb */
-	xhci_endpoint_t *ep = xhci_endpoint_get(transfer->batch.ep);
-	const bool use_streams = !!ep->primary_stream_data_size;
-
-	trb_splitter_t splitter;
-	trb_splitter_init(&splitter, transfer);
-
-	const size_t trb_count = splitter.max_trb_count + use_streams;
-	xhci_trb_t trbs[trb_count];
-	size_t trbs_used = 0;
-
-	while (splitter.remaining > 0)
-		trb_split_next(&trbs[trbs_used++], &splitter);
-
-	if (!use_streams) {
-		/* Set the interrupt bit for last TRB */
-		TRB_CTRL_SET_IOC(trbs[trbs_used - 1], 1);
-	} else {
-		/* Clear the chain bit on the last TRB */
-		TRB_CTRL_SET_CHAIN(trbs[trbs_used - 1], 1);
-		TRB_CTRL_SET_ENT(trbs[trbs_used - 1], 1);
-
-		xhci_trb_t *ed = &trbs[trbs_used++];
-		xhci_trb_clean(ed);
-		ed->parameter = host2xhci(64, (uintptr_t) transfer);
-		TRB_CTRL_SET_TRB_TYPE(*ed, XHCI_TRB_TYPE_EVENT_DATA);
-		TRB_CTRL_SET_IOC(*ed, 1);
-	}
-
-	return xhci_trb_ring_enqueue_multiple(ring, trbs, trbs_used,
-	    &transfer->interrupt_trb_phys);
-}
-
-static int schedule_isochronous(xhci_transfer_t *transfer)
-{
-	endpoint_t *ep = transfer->batch.ep;
-
-	return ep->direction == USB_DIRECTION_OUT ?
-	    isoch_schedule_out(transfer) :
-	    isoch_schedule_in(transfer);
-}
-
-errno_t xhci_handle_transfer_event(xhci_hc_t *hc, xhci_trb_t *trb)
-{
-	uintptr_t addr = trb->parameter;
-	const unsigned slot_id = XHCI_DWORD_EXTRACT(trb->control, 31, 24);
-	const unsigned ep_dci = XHCI_DWORD_EXTRACT(trb->control, 20, 16);
-
-	xhci_device_t *dev = hc->bus.devices_by_slot[slot_id];
-	if (!dev) {
-		usb_log_error("Transfer event on disabled slot %u", slot_id);
-		return ENOENT;
-	}
-
-	const usb_endpoint_t ep_num = ep_dci / 2;
-	const usb_endpoint_t dir = ep_dci % 2 ? USB_DIRECTION_IN : USB_DIRECTION_OUT;
-	/* Creating temporary reference */
-	endpoint_t *ep_base = bus_find_endpoint(&dev->base, ep_num, dir);
-	if (!ep_base) {
-		usb_log_error("Transfer event on dropped endpoint %u %s of device "
-		    XHCI_DEV_FMT, ep_num, usb_str_direction(dir), XHCI_DEV_ARGS(*dev));
-		return ENOENT;
-	}
-	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
-
-	usb_transfer_batch_t *batch;
-	xhci_transfer_t *transfer;
-
-	if (TRB_EVENT_DATA(*trb)) {
-		/* We schedule those only when streams are involved */
-		assert(ep->primary_stream_ctx_array != NULL);
-
-		/* We are received transfer pointer instead - work with that */
-		transfer = (xhci_transfer_t *) addr;
-		xhci_trb_ring_update_dequeue(get_ring(transfer),
-		    transfer->interrupt_trb_phys);
-		batch = &transfer->batch;
-	} else {
-		xhci_trb_ring_update_dequeue(&ep->ring, addr);
-
-		if (ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) {
-			isoch_handle_transfer_event(hc, ep, trb);
-			/* Dropping temporary reference */
-			endpoint_del_ref(&ep->base);
-			return EOK;
-		}
-
-		fibril_mutex_lock(&ep->guard);
-		batch = ep->base.active_batch;
-		endpoint_deactivate_locked(&ep->base);
-		fibril_mutex_unlock(&ep->guard);
-
-		if (!batch) {
-			/* Dropping temporary reference */
-			endpoint_del_ref(&ep->base);
-			return ENOENT;
-		}
-
-		transfer = xhci_transfer_from_batch(batch);
-	}
-
-	const xhci_trb_completion_code_t completion_code = TRB_COMPLETION_CODE(*trb);
-	switch (completion_code) {
-	case XHCI_TRBC_SHORT_PACKET:
-	case XHCI_TRBC_SUCCESS:
-		batch->error = EOK;
-		batch->transferred_size = batch->size - TRB_TRANSFER_LENGTH(*trb);
-		break;
-
-	case XHCI_TRBC_DATA_BUFFER_ERROR:
-		usb_log_warning("Transfer ended with data buffer error.");
-		batch->error = EAGAIN;
-		batch->transferred_size = 0;
-		break;
-
-	case XHCI_TRBC_BABBLE_DETECTED_ERROR:
-		usb_log_warning("Babble detected during the transfer.");
-		batch->error = EAGAIN;
-		batch->transferred_size = 0;
-		break;
-
-	case XHCI_TRBC_USB_TRANSACTION_ERROR:
-		usb_log_warning("USB Transaction error.");
-		batch->error = EAGAIN;
-		batch->transferred_size = 0;
-		break;
-
-	case XHCI_TRBC_TRB_ERROR:
-		usb_log_error("Invalid transfer parameters.");
-		batch->error = EINVAL;
-		batch->transferred_size = 0;
-		break;
-
-	case XHCI_TRBC_STALL_ERROR:
-		usb_log_warning("Stall condition detected.");
-		batch->error = ESTALL;
-		batch->transferred_size = 0;
-		break;
-
-	case XHCI_TRBC_SPLIT_TRANSACTION_ERROR:
-		usb_log_error("Split transcation error detected.");
-		batch->error = EAGAIN;
-		batch->transferred_size = 0;
-		break;
-
-	default:
-		usb_log_warning("Transfer not successfull: %u", completion_code);
-		batch->error = EIO;
-	}
-
-	assert(batch->transferred_size <= batch->size);
-
-	usb_transfer_batch_finish(batch);
-	/* Dropping temporary reference */
-	endpoint_del_ref(&ep->base);
-	return EOK;
-}
-
-typedef errno_t (*transfer_handler)(xhci_hc_t *, xhci_transfer_t *);
-
-static const transfer_handler transfer_handlers[] = {
-	[USB_TRANSFER_CONTROL] = schedule_control,
-	[USB_TRANSFER_ISOCHRONOUS] = NULL,
-	[USB_TRANSFER_BULK] = schedule_bulk_intr,
-	[USB_TRANSFER_INTERRUPT] = schedule_bulk_intr,
-};
-
-/**
- * Schedule a batch for xHC.
- *
- * Bus callback.
- */
-errno_t xhci_transfer_schedule(usb_transfer_batch_t *batch)
-{
-	endpoint_t *ep = batch->ep;
-
-	xhci_hc_t *hc = bus_to_hc(endpoint_get_bus(batch->ep));
-	xhci_transfer_t *transfer = xhci_transfer_from_batch(batch);
-	xhci_endpoint_t *xhci_ep = xhci_endpoint_get(ep);
-	xhci_device_t *xhci_dev = xhci_ep_to_dev(xhci_ep);
-
-	if (!batch->target.address) {
-		usb_log_error("Attempted to schedule transfer to address 0.");
-		return EINVAL;
-	}
-
-	// FIXME: find a better way to check if the ring is not initialized
-	if (!xhci_ep->ring.segment_count) {
-		usb_log_error("Ring not initialized for endpoint " XHCI_EP_FMT,
-		    XHCI_EP_ARGS(*xhci_ep));
-		return EINVAL;
-	}
-
-	// Isochronous transfer needs to be handled differently
-	if (batch->ep->transfer_type == USB_TRANSFER_ISOCHRONOUS) {
-		return schedule_isochronous(transfer);
-	}
-
-	const usb_transfer_type_t type = batch->ep->transfer_type;
-	assert(transfer_handlers[type]);
-
-	/*
-	 * If this is a ClearFeature(ENDPOINT_HALT) request, we have to issue
-	 * the Reset Endpoint command.
-	 */
-	if (batch->ep->transfer_type == USB_TRANSFER_CONTROL &&
-	    batch->dir == USB_DIRECTION_OUT) {
-		const usb_device_request_setup_packet_t *request = &batch->setup.packet;
-		if (request->request == USB_DEVREQ_CLEAR_FEATURE &&
-		    request->request_type == USB_REQUEST_RECIPIENT_ENDPOINT &&
-		    request->value == USB_FEATURE_ENDPOINT_HALT) {
-			const uint16_t index = uint16_usb2host(request->index);
-			const usb_endpoint_t ep_num = index & 0xf;
-			const usb_direction_t dir = (index >> 7) ?
-			    USB_DIRECTION_IN :
-			    USB_DIRECTION_OUT;
-			endpoint_t *halted_ep = bus_find_endpoint(&xhci_dev->base, ep_num, dir);
-			if (halted_ep) {
-				/*
-				 * TODO: Find out how to come up with stream_id. It might be
-				 * possible that we have to clear all of them.
-				 */
-				const errno_t err = xhci_endpoint_clear_halt(xhci_endpoint_get(halted_ep), 0);
-				endpoint_del_ref(halted_ep);
-				if (err) {
-					/*
-					 * The endpoint halt condition failed to be cleared in HC.
-					 * As it does not make sense to send the reset to the device
-					 * itself, return as unschedulable answer.
-					 *
-					 * Furthermore, if this is a request to clear EP 0 stall, it
-					 * would be gone forever, as the endpoint is halted.
-					 */
-					return err;
-				}
-			} else {
-				usb_log_warning("Device(%u): Resetting unregistered endpoint"
-				    " %u %s.", xhci_dev->base.address, ep_num,
-				    usb_str_direction(dir));
-			}
-		}
-	}
-
-	errno_t err;
-	fibril_mutex_lock(&xhci_ep->guard);
-
-	if ((err = endpoint_activate_locked(ep, batch))) {
-		fibril_mutex_unlock(&xhci_ep->guard);
-		return err;
-	}
-
-	if ((err = transfer_handlers[batch->ep->transfer_type](hc, transfer))) {
-		endpoint_deactivate_locked(ep);
-		fibril_mutex_unlock(&xhci_ep->guard);
-		return err;
-	}
-
-	hc_ring_ep_doorbell(xhci_ep, batch->target.stream);
-	fibril_mutex_unlock(&xhci_ep->guard);
-	return EOK;
-}
Index: pace/drv/bus/usb/xhci/transfers.h
===================================================================
--- uspace/drv/bus/usb/xhci/transfers.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2018 Michal Staruch, Petr Manek, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * @brief The host controller transfer ring management
- */
-
-#ifndef XHCI_TRANSFERS_H
-#define XHCI_TRANSFERS_H
-
-#include <usb/host/usb_transfer_batch.h>
-
-#include "hw_struct/context.h"
-#include "trb_ring.h"
-
-typedef struct xhci_hc xhci_hc_t;
-
-typedef struct {
-	usb_transfer_batch_t batch;
-	link_t link;
-
-	uint8_t direction;
-
-	uintptr_t interrupt_trb_phys;
-} xhci_transfer_t;
-
-extern usb_transfer_batch_t *xhci_transfer_create(endpoint_t *);
-extern errno_t xhci_transfer_schedule(usb_transfer_batch_t *);
-
-extern errno_t xhci_handle_transfer_event(xhci_hc_t *, xhci_trb_t *);
-extern void xhci_transfer_destroy(usb_transfer_batch_t *);
-
-static inline xhci_transfer_t *xhci_transfer_from_batch(
-    usb_transfer_batch_t *batch)
-{
-	assert(batch);
-	return (xhci_transfer_t *) batch;
-}
-
-/**
- * @}
- */
-#endif
Index: pace/drv/bus/usb/xhci/trb_ring.c
===================================================================
--- uspace/drv/bus/usb/xhci/trb_ring.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,515 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek, Jaroslav Jindrak, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <assert.h>
-#include <ddi.h>
-#include <as.h>
-#include <align.h>
-#include <barrier.h>
-#include <usb/debug.h>
-#include "hw_struct/trb.h"
-#include "trb_ring.h"
-
-/**
- * A structure representing a segment of a TRB ring.
- */
-
-#define SEGMENT_FOOTER_SIZE (sizeof(link_t) + sizeof(uintptr_t))
-
-#define SEGMENT_TRB_COUNT ((PAGE_SIZE - SEGMENT_FOOTER_SIZE) / sizeof(xhci_trb_t))
-#define SEGMENT_TRB_USEFUL_COUNT (SEGMENT_TRB_COUNT - 1)
-
-struct trb_segment {
-	xhci_trb_t trb_storage [SEGMENT_TRB_COUNT];
-
-	link_t segments_link;
-	uintptr_t phys;
-} __attribute__((aligned(PAGE_SIZE)));
-
-static_assert(sizeof(trb_segment_t) == PAGE_SIZE, "");
-
-/**
- * Get the first TRB of a segment.
- */
-static inline xhci_trb_t *segment_begin(trb_segment_t *segment)
-{
-	return segment->trb_storage;
-}
-
-/**
- * Get the one-past-end TRB of a segment.
- */
-static inline xhci_trb_t *segment_end(trb_segment_t *segment)
-{
-	return segment_begin(segment) + SEGMENT_TRB_COUNT;
-}
-
-/**
- * Return a first segment of a list of segments.
- */
-static inline trb_segment_t *get_first_segment(list_t *segments)
-{
-	return list_get_instance(list_first(segments), trb_segment_t, segments_link);
-
-}
-
-/**
- * Allocate and initialize new segment.
- *
- * TODO: When the HC supports 64-bit addressing, there's no need to restrict
- * to DMAMEM_4GiB.
- */
-static errno_t trb_segment_alloc(trb_segment_t **segment)
-{
-	*segment = AS_AREA_ANY;
-	uintptr_t phys;
-
-	const int err = dmamem_map_anonymous(PAGE_SIZE,
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &phys, (void **) segment);
-	if (err)
-		return err;
-
-	memset(*segment, 0, PAGE_SIZE);
-	(*segment)->phys = phys;
-	usb_log_debug("Allocated new ring segment.");
-	return EOK;
-}
-
-static void trb_segment_free(trb_segment_t *segment)
-{
-	dmamem_unmap_anonymous(segment);
-}
-
-/**
- * Initializes the ring with one segment.
- *
- * @param[in] initial_size A number of free slots on the ring, 0 leaves the
- * choice on a reasonable default (one page-sized segment).
- */
-errno_t xhci_trb_ring_init(xhci_trb_ring_t *ring, size_t initial_size)
-{
-	errno_t err;
-	if (initial_size == 0)
-		initial_size = SEGMENT_TRB_USEFUL_COUNT;
-
-	list_initialize(&ring->segments);
-	size_t segment_count = (initial_size + SEGMENT_TRB_USEFUL_COUNT - 1) /
-	    SEGMENT_TRB_USEFUL_COUNT;
-
-	for (size_t i = 0; i < segment_count; ++i) {
-		struct trb_segment *segment;
-		if ((err = trb_segment_alloc(&segment)) != EOK)
-			return err;
-
-		list_append(&segment->segments_link, &ring->segments);
-		ring->segment_count = i + 1;
-	}
-
-	trb_segment_t *const segment = get_first_segment(&ring->segments);
-	xhci_trb_t *last = segment_end(segment) - 1;
-	xhci_trb_link_fill(last, segment->phys);
-	TRB_LINK_SET_TC(*last, true);
-
-	ring->enqueue_segment = segment;
-	ring->enqueue_trb = segment_begin(segment);
-	ring->dequeue = segment->phys;
-	ring->pcs = 1;
-
-	fibril_mutex_initialize(&ring->guard);
-
-	return EOK;
-}
-
-/**
- * Free all segments inside the ring.
- */
-void xhci_trb_ring_fini(xhci_trb_ring_t *ring)
-{
-	assert(ring);
-
-	list_foreach_safe(ring->segments, cur, next) {
-		trb_segment_t *segment =
-		    list_get_instance(cur, trb_segment_t, segments_link);
-		trb_segment_free(segment);
-	}
-}
-
-/**
- * When the enqueue pointer targets a Link TRB, resolve it.
- *
- * Relies on segments being in the segment list in linked order.
- *
- * According to section 4.9.2.2, figure 16, the link TRBs cannot be chained, so
- * it shall not be called in cycle, nor have an inner cycle.
- */
-static void trb_ring_resolve_link(xhci_trb_ring_t *ring)
-{
-	link_t *next_segment =
-	    list_next(&ring->enqueue_segment->segments_link, &ring->segments);
-	if (!next_segment)
-		next_segment = list_first(&ring->segments);
-	assert(next_segment);
-
-	ring->enqueue_segment =
-	    list_get_instance(next_segment, trb_segment_t, segments_link);
-	ring->enqueue_trb = segment_begin(ring->enqueue_segment);
-}
-
-/**
- * Get the physical address of the enqueue pointer.
- */
-static uintptr_t trb_ring_enqueue_phys(xhci_trb_ring_t *ring)
-{
-	size_t trb_id = ring->enqueue_trb - segment_begin(ring->enqueue_segment);
-	return ring->enqueue_segment->phys + trb_id * sizeof(xhci_trb_t);
-}
-
-/**
- * Decides whether the TRB will trigger an interrupt after being processed.
- */
-static bool trb_generates_interrupt(xhci_trb_t *trb)
-{
-	return TRB_TYPE(*trb) >= XHCI_TRB_TYPE_ENABLE_SLOT_CMD ||
-	    TRB_IOC(*trb);
-}
-
-/**
- * Enqueue TD composed of TRBs.
- *
- * This will copy specified number of TRBs chained together into the ring. The
- * cycle flag in TRBs may be changed.
- *
- * The copied TRBs must be contiguous in memory, and must not contain Link TRBs.
- *
- * We cannot avoid the copying, because the TRB in ring should be updated
- * atomically.
- *
- * @param first_trb the first TRB
- * @param trbs number of TRBS to enqueue
- * @param phys returns address of the last TRB enqueued
- * @return EOK on success,
- *         EAGAIN when the ring is too full to fit all TRBs (temporary)
- */
-errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *ring, xhci_trb_t *first_trb,
-    size_t trbs, uintptr_t *phys)
-{
-	errno_t err;
-	assert(trbs > 0);
-
-	if (trbs > xhci_trb_ring_size(ring))
-		return ELIMIT;
-
-	fibril_mutex_lock(&ring->guard);
-
-	xhci_trb_t *const saved_enqueue_trb = ring->enqueue_trb;
-	trb_segment_t *const saved_enqueue_segment = ring->enqueue_segment;
-	if (phys)
-		*phys = (uintptr_t)NULL;
-
-	/*
-	 * First, dry run and advance the enqueue pointer to see if the ring would
-	 * be full anytime during the transaction.
-	 */
-	xhci_trb_t *trb = first_trb;
-	for (size_t i = 0; i < trbs; ++i, ++trb) {
-		if (phys && trb_generates_interrupt(trb)) {
-			if (*phys) {
-				err = ENOTSUP;
-				goto err;
-			}
-			*phys = trb_ring_enqueue_phys(ring);
-		}
-
-		ring->enqueue_trb++;
-
-		if (TRB_TYPE(*ring->enqueue_trb) == XHCI_TRB_TYPE_LINK)
-			trb_ring_resolve_link(ring);
-
-		if (trb_ring_enqueue_phys(ring) == ring->dequeue) {
-			err = EAGAIN;
-			goto err;
-		}
-	}
-
-	ring->enqueue_segment = saved_enqueue_segment;
-	ring->enqueue_trb = saved_enqueue_trb;
-
-	/*
-	 * Now, copy the TRBs without further checking.
-	 */
-	trb = first_trb;
-	for (size_t i = 0; i < trbs; ++i, ++trb) {
-		TRB_SET_CYCLE(*trb, ring->pcs);
-		xhci_trb_copy_to_pio(ring->enqueue_trb, trb);
-
-		usb_log_debug2("TRB ring(%p): Enqueued TRB %p", ring, trb);
-		ring->enqueue_trb++;
-
-		if (TRB_TYPE(*ring->enqueue_trb) == XHCI_TRB_TYPE_LINK) {
-			TRB_SET_CYCLE(*ring->enqueue_trb, ring->pcs);
-
-			if (TRB_LINK_TC(*ring->enqueue_trb)) {
-				ring->pcs = !ring->pcs;
-				usb_log_debug("TRB ring(%p): PCS toggled", ring);
-			}
-
-			trb_ring_resolve_link(ring);
-		}
-	}
-
-	fibril_mutex_unlock(&ring->guard);
-	return EOK;
-
-err:
-	ring->enqueue_segment = saved_enqueue_segment;
-	ring->enqueue_trb = saved_enqueue_trb;
-	fibril_mutex_unlock(&ring->guard);
-	return err;
-}
-
-/**
- * Enqueue TD composed of a single TRB. See: `xhci_trb_ring_enqueue_multiple`
- */
-errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td, uintptr_t *phys)
-{
-	return xhci_trb_ring_enqueue_multiple(ring, td, 1, phys);
-}
-
-void xhci_trb_ring_reset_dequeue_state(xhci_trb_ring_t *ring, uintptr_t *addr)
-{
-	assert(ring);
-
-	ring->dequeue = trb_ring_enqueue_phys(ring);
-
-	if (addr)
-		*addr = ring->dequeue | ring->pcs;
-}
-
-size_t xhci_trb_ring_size(xhci_trb_ring_t *ring)
-{
-	return ring->segment_count * SEGMENT_TRB_USEFUL_COUNT;
-}
-
-/**
- * Initializes an event ring.
- *
- * @param[in] initial_size A number of free slots on the ring, 0 leaves the
- * choice on a reasonable default (one page-sized segment).
- */
-errno_t xhci_event_ring_init(xhci_event_ring_t *ring, size_t initial_size)
-{
-	errno_t err;
-	if (initial_size == 0)
-		initial_size = SEGMENT_TRB_COUNT;
-
-	list_initialize(&ring->segments);
-
-	size_t segment_count = (initial_size + SEGMENT_TRB_COUNT - 1) / SEGMENT_TRB_COUNT;
-	size_t erst_size = segment_count * sizeof(xhci_erst_entry_t);
-
-	if (dma_buffer_alloc(&ring->erst, erst_size)) {
-		xhci_event_ring_fini(ring);
-		return ENOMEM;
-	}
-
-	xhci_erst_entry_t *erst = ring->erst.virt;
-	memset(erst, 0, erst_size);
-
-	for (size_t i = 0; i < segment_count; i++) {
-		trb_segment_t *segment;
-		if ((err = trb_segment_alloc(&segment)) != EOK) {
-			xhci_event_ring_fini(ring);
-			return err;
-		}
-
-		list_append(&segment->segments_link, &ring->segments);
-		ring->segment_count = i + 1;
-		xhci_fill_erst_entry(&erst[i], segment->phys, SEGMENT_TRB_COUNT);
-	}
-
-	fibril_mutex_initialize(&ring->guard);
-
-	usb_log_debug("Initialized event ring.");
-	return EOK;
-}
-
-void xhci_event_ring_reset(xhci_event_ring_t *ring)
-{
-	list_foreach(ring->segments, segments_link, trb_segment_t, segment)
-		memset(segment->trb_storage, 0, sizeof(segment->trb_storage));
-
-	trb_segment_t *const segment = get_first_segment(&ring->segments);
-	ring->dequeue_segment = segment;
-	ring->dequeue_trb = segment_begin(segment);
-	ring->dequeue_ptr = segment->phys;
-	ring->ccs = 1;
-}
-
-void xhci_event_ring_fini(xhci_event_ring_t *ring)
-{
-	list_foreach_safe(ring->segments, cur, next) {
-		trb_segment_t *segment = list_get_instance(cur, trb_segment_t, segments_link);
-		trb_segment_free(segment);
-	}
-
-	dma_buffer_free(&ring->erst);
-}
-
-/**
- * Get the physical address of the dequeue pointer.
- */
-static uintptr_t event_ring_dequeue_phys(xhci_event_ring_t *ring)
-{
-	uintptr_t trb_id = ring->dequeue_trb - segment_begin(ring->dequeue_segment);
-	return ring->dequeue_segment->phys + trb_id * sizeof(xhci_trb_t);
-}
-
-/**
- * Fill the event with next valid event from the ring.
- *
- * @param event pointer to event to be overwritten
- * @return EOK on success,
- *         ENOENT when the ring is empty
- */
-errno_t xhci_event_ring_dequeue(xhci_event_ring_t *ring, xhci_trb_t *event)
-{
-	fibril_mutex_lock(&ring->guard);
-
-	/**
-	 * The ERDP reported to the HC is a half-phase off the one we need to
-	 * maintain. Therefore, we keep it extra.
-	 */
-	ring->dequeue_ptr = event_ring_dequeue_phys(ring);
-
-	if (TRB_CYCLE(*ring->dequeue_trb) != ring->ccs) {
-		fibril_mutex_unlock(&ring->guard);
-		return ENOENT; /* The ring is empty. */
-	}
-
-	/* Do not reorder the Cycle bit reading with memcpy */
-	read_barrier();
-
-	memcpy(event, ring->dequeue_trb, sizeof(xhci_trb_t));
-
-	ring->dequeue_trb++;
-	const unsigned index = ring->dequeue_trb - segment_begin(ring->dequeue_segment);
-
-	/* Wrapping around segment boundary */
-	if (index >= SEGMENT_TRB_COUNT) {
-		link_t *next_segment =
-		    list_next(&ring->dequeue_segment->segments_link, &ring->segments);
-
-		/* Wrapping around table boundary */
-		if (!next_segment) {
-			next_segment = list_first(&ring->segments);
-			ring->ccs = !ring->ccs;
-		}
-
-		ring->dequeue_segment =
-		    list_get_instance(next_segment, trb_segment_t, segments_link);
-		ring->dequeue_trb = segment_begin(ring->dequeue_segment);
-	}
-
-	fibril_mutex_unlock(&ring->guard);
-	return EOK;
-}
-
-void xhci_sw_ring_init(xhci_sw_ring_t *ring, size_t size)
-{
-	ring->begin = calloc(size, sizeof(xhci_trb_t));
-	ring->end = ring->begin + size;
-
-	fibril_mutex_initialize(&ring->guard);
-	fibril_condvar_initialize(&ring->enqueued_cv);
-	fibril_condvar_initialize(&ring->dequeued_cv);
-
-	xhci_sw_ring_restart(ring);
-}
-
-errno_t xhci_sw_ring_enqueue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
-{
-	assert(ring);
-	assert(trb);
-
-	fibril_mutex_lock(&ring->guard);
-	while (ring->running && TRB_CYCLE(*ring->enqueue))
-		fibril_condvar_wait(&ring->dequeued_cv, &ring->guard);
-
-	*ring->enqueue = *trb;
-	TRB_SET_CYCLE(*ring->enqueue, 1);
-	if (++ring->enqueue == ring->end)
-		ring->enqueue = ring->begin;
-	fibril_condvar_signal(&ring->enqueued_cv);
-	fibril_mutex_unlock(&ring->guard);
-
-	return ring->running ? EOK : EINTR;
-}
-
-errno_t xhci_sw_ring_dequeue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
-{
-	assert(ring);
-	assert(trb);
-
-	fibril_mutex_lock(&ring->guard);
-	while (ring->running && !TRB_CYCLE(*ring->dequeue))
-		fibril_condvar_wait(&ring->enqueued_cv, &ring->guard);
-
-	*trb = *ring->dequeue;
-	TRB_SET_CYCLE(*ring->dequeue, 0);
-	if (++ring->dequeue == ring->end)
-		ring->dequeue = ring->begin;
-	fibril_condvar_signal(&ring->dequeued_cv);
-	fibril_mutex_unlock(&ring->guard);
-
-	return ring->running ? EOK : EINTR;
-}
-
-void xhci_sw_ring_stop(xhci_sw_ring_t *ring)
-{
-	ring->running = false;
-	fibril_condvar_broadcast(&ring->enqueued_cv);
-	fibril_condvar_broadcast(&ring->dequeued_cv);
-}
-
-void xhci_sw_ring_restart(xhci_sw_ring_t *ring)
-{
-	ring->enqueue = ring->dequeue = ring->begin;
-	memset(ring->begin, 0, sizeof(xhci_trb_t) * (ring->end - ring->begin));
-	ring->running = true;
-}
-
-void xhci_sw_ring_fini(xhci_sw_ring_t *ring)
-{
-	free(ring->begin);
-}
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/trb_ring.h
===================================================================
--- uspace/drv/bus/usb/xhci/trb_ring.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbxhci
- * @{
- */
-/** @file
- * TRB Ring is a data structure for communication between HC and software.
- *
- * Despite this description, it is not used as an hardware structure - all but
- * the Event ring is used as buffer of the TRBs itself, linked by Link TRB to
- * form a (possibly multi-segment) circular buffer.
- *
- * This data structure abstracts this behavior.
- */
-
-#ifndef XHCI_TRB_RING_H
-#define XHCI_TRB_RING_H
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-#include <libarch/config.h>
-#include <usb/dma_buffer.h>
-
-typedef struct trb_segment trb_segment_t;
-typedef struct xhci_hc xhci_hc_t;
-typedef struct xhci_trb xhci_trb_t;
-typedef struct xhci_erst_entry xhci_erst_entry_t;
-
-/**
- * A TRB ring of which the software is a producer - command / transfer.
- */
-typedef struct xhci_trb_ring {
-	list_t segments;                /**< List of assigned segments */
-	int segment_count;              /**< Number of segments assigned */
-
-	/**
-	 * As the link TRBs connect physical addresses, we need to keep track
-	 * of active segment in virtual memory. The enqueue ptr should always
-	 * belong to the enqueue segment.
-	 */
-	trb_segment_t *enqueue_segment;
-	xhci_trb_t *enqueue_trb;
-
-	uintptr_t dequeue; /**< Last reported position of the dequeue pointer */
-	bool pcs;          /**< Producer Cycle State: section 4.9.2 */
-
-	fibril_mutex_t guard;
-} xhci_trb_ring_t;
-
-extern errno_t xhci_trb_ring_init(xhci_trb_ring_t *, size_t);
-extern void xhci_trb_ring_fini(xhci_trb_ring_t *);
-extern errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *,
-    uintptr_t *);
-extern errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *, xhci_trb_t *,
-    size_t, uintptr_t *);
-extern size_t xhci_trb_ring_size(xhci_trb_ring_t *);
-
-extern void xhci_trb_ring_reset_dequeue_state(xhci_trb_ring_t *, uintptr_t *);
-
-/**
- * When an event is received by the upper layer, it needs to update the dequeue
- * pointer inside the ring. Otherwise, the ring will soon show up as full.
- */
-static inline void xhci_trb_ring_update_dequeue(xhci_trb_ring_t *ring,
-    uintptr_t phys)
-{
-	ring->dequeue = phys;
-}
-
-/**
- * A TRB ring of which the software is a consumer (event rings).
- */
-typedef struct xhci_event_ring {
-	list_t segments;                /**< List of assigned segments */
-	int segment_count;              /**< Number of segments assigned */
-
-	trb_segment_t *dequeue_segment; /**< Current segment */
-	xhci_trb_t *dequeue_trb;        /**< Next TRB to be processed */
-	uintptr_t dequeue_ptr;  /**< Physical ERDP to be reported to the HC */
-
-	dma_buffer_t erst;      /**< ERST given to the HC */
-
-	bool ccs;               /**< Consumer Cycle State: section 4.9.2 */
-
-	fibril_mutex_t guard;
-} xhci_event_ring_t;
-
-extern errno_t xhci_event_ring_init(xhci_event_ring_t *, size_t);
-extern void xhci_event_ring_fini(xhci_event_ring_t *);
-extern void xhci_event_ring_reset(xhci_event_ring_t *);
-extern errno_t xhci_event_ring_dequeue(xhci_event_ring_t *, xhci_trb_t *);
-
-/**
- * A TRB ring of which the software is both consumer and provider.
- */
-typedef struct xhci_sw_ring {
-	xhci_trb_t *begin, *end;
-	xhci_trb_t *enqueue, *dequeue;
-
-	fibril_mutex_t guard;
-	fibril_condvar_t enqueued_cv, dequeued_cv;
-
-	bool running;
-} xhci_sw_ring_t;
-
-extern void xhci_sw_ring_init(xhci_sw_ring_t *, size_t);
-
-/* Both may block if the ring is full/empty. */
-extern errno_t xhci_sw_ring_enqueue(xhci_sw_ring_t *, xhci_trb_t *);
-extern errno_t xhci_sw_ring_dequeue(xhci_sw_ring_t *, xhci_trb_t *);
-
-extern void xhci_sw_ring_restart(xhci_sw_ring_t *);
-extern void xhci_sw_ring_stop(xhci_sw_ring_t *);
-extern void xhci_sw_ring_fini(xhci_sw_ring_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/bus/usb/xhci/xhci.ma
===================================================================
--- uspace/drv/bus/usb/xhci/xhci.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-20 usb/host=xhci
-10 pci/class=0c&subclass=03&progif=30
Index: pace/drv/char/i8042/doc/doxygroups.h
===================================================================
--- uspace/drv/char/i8042/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup i8042 i8042
- * @brief i8042 PS/2 port driver
- * @ingroup drvs
- */
Index: pace/drv/char/i8042/i8042.c
===================================================================
--- uspace/drv/char/i8042/i8042.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,449 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2001-2004 Jakub Jermar
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8042
- * @{
- */
-
-/** @file
- * @brief i8042 PS/2 port driver.
- */
-
-#include <adt/circ_buf.h>
-#include <ddf/log.h>
-#include <ddf/interrupt.h>
-#include <ddi.h>
-#include <device/hw_res.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <io/chardev_srv.h>
-
-#include "i8042.h"
-
-/* Interesting bits for status register */
-#define i8042_OUTPUT_FULL  0x01
-#define i8042_INPUT_FULL   0x02
-#define i8042_AUX_DATA     0x20
-
-/* Command constants */
-#define i8042_CMD_WRITE_CMDB  0x60  /**< Write command byte */
-#define i8042_CMD_WRITE_AUX   0xd4  /**< Write aux device */
-
-/* Command byte fields */
-#define i8042_KBD_IE         0x01
-#define i8042_AUX_IE         0x02
-#define i8042_KBD_DISABLE    0x10
-#define i8042_AUX_DISABLE    0x20
-#define i8042_KBD_TRANSLATE  0x40  /* Use this to switch to XT scancodes */
-
-static void i8042_char_conn(ipc_call_t *, void *);
-static errno_t i8042_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t i8042_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t i8042_chardev_ops = {
-	.read = i8042_read,
-	.write = i8042_write
-};
-
-static const irq_pio_range_t i8042_ranges[] = {
-	{
-		.base = 0,
-		.size = sizeof(i8042_regs_t)
-	}
-};
-
-/** i8042 Interrupt pseudo-code. */
-static const irq_cmd_t i8042_cmds[] = {
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_AND,
-		.value = i8042_OUTPUT_FULL,
-		.srcarg = 1,
-		.dstarg = 3
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 2,
-		.srcarg = 3
-	},
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* will be patched in run-time */
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Wait until it is safe to write to the device. */
-static void wait_ready(i8042_t *dev)
-{
-	assert(dev);
-	while (pio_read_8(&dev->regs->status) & i8042_INPUT_FULL)
-		;
-}
-
-/** Interrupt handler routine.
- *
- * Write new data to the corresponding buffer.
- *
- * @param call Pointer to call data.
- * @param arg  Argument (i8042_t *)
- */
-static void i8042_irq_handler(ipc_call_t *call, void *arg)
-{
-	i8042_t *controller = (i8042_t *)arg;
-	errno_t rc;
-
-	const uint8_t status = ipc_get_arg1(call);
-	const uint8_t data = ipc_get_arg2(call);
-
-	i8042_port_t *port = (status & i8042_AUX_DATA) ?
-	    controller->aux : controller->kbd;
-
-	fibril_mutex_lock(&port->buf_lock);
-
-	rc = circ_buf_push(&port->cbuf, &data);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Buffer overrun");
-
-	fibril_mutex_unlock(&port->buf_lock);
-	fibril_condvar_broadcast(&port->buf_cv);
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(controller->dev);
-	hw_res_clear_interrupt(parent_sess, port->irq);
-}
-
-/** Initialize i8042 driver structure.
- *
- * @param dev       Driver structure to initialize.
- * @param regs      I/O range  of registers.
- * @param irq_kbd   IRQ for primary port.
- * @param irq_mouse IRQ for aux port.
- * @param ddf_dev   DDF device structure of the device.
- *
- * @return Error code.
- *
- */
-errno_t i8042_init(i8042_t *dev, addr_range_t *regs, int irq_kbd,
-    int irq_mouse, ddf_dev_t *ddf_dev)
-{
-	const size_t range_count = sizeof(i8042_ranges) /
-	    sizeof(irq_pio_range_t);
-	irq_pio_range_t ranges[range_count];
-	const size_t cmd_count = sizeof(i8042_cmds) / sizeof(irq_cmd_t);
-	irq_cmd_t cmds[cmd_count];
-	ddf_fun_t *kbd_fun;
-	ddf_fun_t *aux_fun;
-	i8042_regs_t *ar;
-
-	errno_t rc;
-	bool kbd_bound = false;
-	bool aux_bound = false;
-
-	dev->dev = ddf_dev;
-
-	if (regs->size < sizeof(i8042_regs_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (pio_enable_range(regs, (void **) &dev->regs) != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	kbd_fun = ddf_fun_create(ddf_dev, fun_inner, "ps2a");
-	if (kbd_fun == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev->kbd = ddf_fun_data_alloc(kbd_fun, sizeof(i8042_port_t));
-	if (dev->kbd == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev->kbd->fun = kbd_fun;
-	dev->kbd->ctl = dev;
-	chardev_srvs_init(&dev->kbd->cds);
-	dev->kbd->cds.ops = &i8042_chardev_ops;
-	dev->kbd->cds.sarg = dev->kbd;
-	dev->kbd->irq = irq_kbd;
-	fibril_mutex_initialize(&dev->kbd->buf_lock);
-	fibril_condvar_initialize(&dev->kbd->buf_cv);
-
-	rc = ddf_fun_add_match_id(dev->kbd->fun, "char/xtkbd", 90);
-	if (rc != EOK)
-		goto error;
-
-	aux_fun = ddf_fun_create(ddf_dev, fun_inner, "ps2b");
-	if (aux_fun == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev->aux = ddf_fun_data_alloc(aux_fun, sizeof(i8042_port_t));
-	if (dev->aux == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	dev->aux->fun = aux_fun;
-	dev->aux->ctl = dev;
-	chardev_srvs_init(&dev->aux->cds);
-	dev->aux->cds.ops = &i8042_chardev_ops;
-	dev->aux->cds.sarg = dev->aux;
-	dev->aux->irq = irq_mouse;
-	fibril_mutex_initialize(&dev->aux->buf_lock);
-	fibril_condvar_initialize(&dev->aux->buf_cv);
-
-	rc = ddf_fun_add_match_id(dev->aux->fun, "char/ps2mouse", 90);
-	if (rc != EOK)
-		goto error;
-
-	ddf_fun_set_conn_handler(dev->kbd->fun, i8042_char_conn);
-	ddf_fun_set_conn_handler(dev->aux->fun, i8042_char_conn);
-
-	circ_buf_init(&dev->kbd->cbuf, dev->kbd->buf_data, BUFFER_SIZE, 1);
-	circ_buf_init(&dev->aux->cbuf, dev->aux->buf_data, BUFFER_SIZE, 1);
-	fibril_mutex_initialize(&dev->write_guard);
-
-	rc = ddf_fun_bind(dev->kbd->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to bind keyboard function: %s.",
-		    ddf_fun_get_name(dev->kbd->fun));
-		goto error;
-	}
-	kbd_bound = true;
-
-	rc = ddf_fun_bind(dev->aux->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to bind aux function: %s.",
-		    ddf_fun_get_name(dev->aux->fun));
-		goto error;
-	}
-	aux_bound = true;
-
-	/* Disable kbd and aux */
-	wait_ready(dev);
-	pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB);
-	wait_ready(dev);
-	pio_write_8(&dev->regs->data, i8042_KBD_DISABLE | i8042_AUX_DISABLE);
-
-	/* Flush all current IO */
-	while (pio_read_8(&dev->regs->status) & i8042_OUTPUT_FULL)
-		(void) pio_read_8(&dev->regs->data);
-
-	memcpy(ranges, i8042_ranges, sizeof(i8042_ranges));
-	ranges[0].base = RNGABS(*regs);
-
-	ar = RNGABSPTR(*regs);
-	memcpy(cmds, i8042_cmds, sizeof(i8042_cmds));
-	cmds[0].addr = (void *) &ar->status;
-	cmds[3].addr = (void *) &ar->data;
-
-	irq_code_t irq_code = {
-		.rangecount = range_count,
-		.ranges = ranges,
-		.cmdcount = cmd_count,
-		.cmds = cmds
-	};
-
-	cap_irq_handle_t kbd_ihandle;
-	rc = register_interrupt_handler(ddf_dev, irq_kbd,
-	    i8042_irq_handler, (void *)dev, &irq_code, &kbd_ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed set handler for kbd: %s.",
-		    ddf_dev_get_name(ddf_dev));
-		goto error;
-	}
-
-	cap_irq_handle_t mouse_ihandle;
-	rc = register_interrupt_handler(ddf_dev, irq_mouse,
-	    i8042_irq_handler, (void *)dev, &irq_code, &mouse_ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed set handler for mouse: %s.",
-		    ddf_dev_get_name(ddf_dev));
-		goto error;
-	}
-
-	/* Enable interrupts */
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(ddf_dev);
-	assert(parent_sess != NULL);
-
-	rc = hw_res_enable_interrupt(parent_sess, irq_kbd);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to enable keyboard interrupt: %s.",
-		    ddf_dev_get_name(ddf_dev));
-		rc = EIO;
-		goto error;
-	}
-
-	rc = hw_res_enable_interrupt(parent_sess, irq_mouse);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to enable mouse interrupt: %s.",
-		    ddf_dev_get_name(ddf_dev));
-		rc = EIO;
-		goto error;
-	}
-
-	/* Enable port interrupts. */
-	wait_ready(dev);
-	pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB);
-	wait_ready(dev);
-	pio_write_8(&dev->regs->data, i8042_KBD_IE | i8042_KBD_TRANSLATE |
-	    i8042_AUX_IE);
-
-	return EOK;
-error:
-	if (kbd_bound)
-		ddf_fun_unbind(dev->kbd->fun);
-	if (aux_bound)
-		ddf_fun_unbind(dev->aux->fun);
-	if (dev->kbd->fun != NULL)
-		ddf_fun_destroy(dev->kbd->fun);
-	if (dev->aux->fun != NULL)
-		ddf_fun_destroy(dev->aux->fun);
-
-	return rc;
-}
-
-/** Quiesce i8042.
- *
- * @param dev i8042 instance.
- */
-void i8042_quiesce(i8042_t *dev)
-{
-	/* Disable port interrupts. */
-	wait_ready(dev);
-	pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB);
-	wait_ready(dev);
-	pio_write_8(&dev->regs->data, i8042_KBD_TRANSLATE);
-}
-
-/** Write data to i8042 port.
- *
- * @param srv	 Connection-specific data
- * @param buffer Data source
- * @param size   Data size
- * @param nwr    Place to store number of bytes successfully written
- *
- * @return EOK on success or non-zero error code
- *
- */
-static errno_t i8042_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	i8042_port_t *port = (i8042_port_t *)srv->srvs->sarg;
-	i8042_t *i8042 = port->ctl;
-	const char *dp = (const char *)data;
-
-	fibril_mutex_lock(&i8042->write_guard);
-
-	for (size_t i = 0; i < size; ++i) {
-		if (port == i8042->aux) {
-			wait_ready(i8042);
-			pio_write_8(&i8042->regs->status,
-			    i8042_CMD_WRITE_AUX);
-		}
-
-		wait_ready(i8042);
-		pio_write_8(&i8042->regs->data, dp[i]);
-	}
-
-	fibril_mutex_unlock(&i8042->write_guard);
-	*nwr = size;
-	return EOK;
-}
-
-/** Read data from i8042 port.
- *
- * @param srv	 Connection-specific data
- * @param buffer Data place
- * @param size   Data place size
- * @param nread  Place to store number of bytes successfully read
- *
- * @return EOK on success or non-zero error code
- *
- */
-static errno_t i8042_read(chardev_srv_t *srv, void *dest, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	i8042_port_t *port = (i8042_port_t *)srv->srvs->sarg;
-	size_t p;
-	uint8_t *destp = (uint8_t *)dest;
-	errno_t rc;
-
-	fibril_mutex_lock(&port->buf_lock);
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    circ_buf_nused(&port->cbuf) == 0)
-		fibril_condvar_wait(&port->buf_cv, &port->buf_lock);
-
-	p = 0;
-	while (p < size) {
-		rc = circ_buf_pop(&port->cbuf, &destp[p]);
-		if (rc != EOK)
-			break;
-		++p;
-	}
-
-	fibril_mutex_unlock(&port->buf_lock);
-
-	*nread = p;
-	return EOK;
-}
-
-/** Handle data requests.
- *
- * @param call IPC request.
- * @param arg  ddf_fun_t function.
- *
- */
-void i8042_char_conn(ipc_call_t *icall, void *arg)
-{
-	i8042_port_t *port = ddf_fun_data_get((ddf_fun_t *)arg);
-
-	chardev_conn(icall, &port->cds);
-}
-
-/**
- * @}
- */
Index: pace/drv/char/i8042/i8042.h
===================================================================
--- uspace/drv/char/i8042/i8042.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8042
- * @{
- */
-
-/** @file
- * @brief i8042 port driver.
- */
-
-#ifndef i8042_H_
-#define i8042_H_
-
-#include <adt/circ_buf.h>
-#include <io/chardev_srv.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-#include <ddf/driver.h>
-
-#define NAME  "i8042"
-
-/** Buffer needs to be large enough for rate at which keyboard or mouse
- * produces data (mouse produces data at faster rate).
- */
-#define BUFFER_SIZE  64
-
-/** i8042 HW I/O interface */
-typedef struct {
-	ioport8_t data;
-	uint8_t pad[3];
-	ioport8_t status;
-} __attribute__((packed)) i8042_regs_t;
-
-/** i8042 Port. */
-typedef struct {
-	/** Controller */
-	struct i8042 *ctl;
-	/** Device function */
-	ddf_fun_t *fun;
-	/** Character device server data */
-	chardev_srvs_t cds;
-	/** Circular buffer */
-	circ_buf_t cbuf;
-	/** Buffer data space */
-	uint8_t buf_data[BUFFER_SIZE];
-	/** Protect buffer */
-	fibril_mutex_t buf_lock;
-	/** Signal new data in buffer */
-	fibril_condvar_t buf_cv;
-	/** Interrupt number */
-	int irq;
-} i8042_port_t;
-
-/** i8042 Controller. */
-typedef struct i8042 {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** I/O registers. */
-	i8042_regs_t *regs;
-	/** Keyboard port */
-	i8042_port_t *kbd;
-	/** AUX port */
-	i8042_port_t *aux;
-	/** Prevents simultanous port writes. */
-	fibril_mutex_t write_guard;
-} i8042_t;
-
-extern errno_t i8042_init(i8042_t *, addr_range_t *, int, int, ddf_dev_t *);
-extern void i8042_quiesce(i8042_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/char/i8042/i8042.ma
===================================================================
--- uspace/drv/char/i8042/i8042.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 isa/i8042
Index: pace/drv/char/i8042/main.c
===================================================================
--- uspace/drv/char/i8042/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8042
- * @{
- */
-
-/** @file
- * @brief i8042 driver DDF bits.
- */
-
-#include <inttypes.h>
-#include <libarch/config.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/log.h>
-#include <stdio.h>
-#include "i8042.h"
-
-/** Get address of I/O registers.
- *
- * @param[in]  dev            Device asking for the addresses.
- * @param[out] p_io_reg       Pointer to register range.
- * @param[out] kbd_irq        Primary port IRQ.
- * @param[out] mouse_irq      Auxiliary port IRQ.
- *
- * @return Error code.
- *
- */
-static errno_t get_my_registers(ddf_dev_t *dev, addr_range_t *p_io_reg,
-    int *kbd_irq, int *mouse_irq)
-{
-	assert(dev);
-
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_t hw_resources;
-	hw_res_list_parsed_init(&hw_resources);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, &hw_resources, 0);
-	if (ret != EOK)
-		return ret;
-
-	if ((hw_resources.irqs.count != 2) ||
-	    (hw_resources.io_ranges.count != 1)) {
-		hw_res_list_parsed_clean(&hw_resources);
-		return EINVAL;
-	}
-
-	if (p_io_reg)
-		*p_io_reg = hw_resources.io_ranges.ranges[0];
-
-	if (kbd_irq)
-		*kbd_irq = hw_resources.irqs.irqs[0];
-
-	if (mouse_irq)
-		*mouse_irq = hw_resources.irqs.irqs[1];
-
-	hw_res_list_parsed_clean(&hw_resources);
-	return EOK;
-}
-
-/** Initialize a new ddf driver instance of i8042 driver
- *
- * @param[in] device DDF instance of the device to initialize.
- *
- * @return Error code.
- *
- */
-static errno_t i8042_dev_add(ddf_dev_t *device)
-{
-	addr_range_t io_regs;
-	int kbd = 0;
-	int mouse = 0;
-	errno_t rc;
-
-	if (!device)
-		return EINVAL;
-
-	rc = get_my_registers(device, &io_regs, &kbd, &mouse);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to get registers: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG,
-	    "I/O regs at %p (size %zuB), IRQ kbd %d, IRQ mouse %d.",
-	    RNGABSPTR(io_regs), RNGSZ(io_regs), kbd, mouse);
-
-	i8042_t *i8042 = ddf_dev_data_alloc(device, sizeof(i8042_t));
-	if (i8042 == NULL) {
-		ddf_msg(LVL_ERROR, "Out of memory.");
-		return ENOMEM;
-	}
-
-	rc = i8042_init(i8042, &io_regs, kbd, mouse, device);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to initialize i8042 driver: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
-	    ddf_dev_get_name(device), ddf_dev_get_handle(device));
-	return EOK;
-}
-
-/** Initialize a new ddf driver instance of i8042 driver
- *
- * @param[in] device DDF instance of the device to initialize.
- *
- * @return Error code.
- *
- */
-static errno_t i8042_dev_quiesce(ddf_dev_t *device)
-{
-	i8042_t *i8042;
-
-	ddf_msg(LVL_DEBUG, "i8042_dev_quiesce()");
-
-	i8042 = (i8042_t *)ddf_dev_data_get(device);
-	i8042_quiesce(i8042);
-	return EOK;
-}
-
-/** DDF driver operations. */
-static driver_ops_t i8042_driver_ops = {
-	.dev_add = i8042_dev_add,
-	.dev_quiesce = i8042_dev_quiesce
-};
-
-/** DDF driver. */
-static driver_t i8042_driver = {
-	.name = NAME,
-	.driver_ops = &i8042_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS PS/2 driver.\n", NAME);
-	ddf_log_init(NAME);
-
-	return ddf_driver_main(&i8042_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/char/i8042/meson.build
===================================================================
--- uspace/drv/char/i8042/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('i8042.c', 'main.c')
Index: pace/drv/char/msim-con/doc/doxygroups.h
===================================================================
--- uspace/drv/char/msim-con/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_msim_con msim-con
- * @brief MSIM console driver
- * @ingroup drvs
- */
Index: pace/drv/char/msim-con/main.c
===================================================================
--- uspace/drv/char/msim-con/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_msim_con
- * @{
- */
-/** @file MSIM console driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "msim-con.h"
-
-#define NAME  "msim-con"
-
-static errno_t msim_con_dev_add(ddf_dev_t *dev);
-static errno_t msim_con_dev_remove(ddf_dev_t *dev);
-static errno_t msim_con_dev_gone(ddf_dev_t *dev);
-static errno_t msim_con_fun_online(ddf_fun_t *fun);
-static errno_t msim_con_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = msim_con_dev_add,
-	.dev_remove = msim_con_dev_remove,
-	.dev_gone = msim_con_dev_gone,
-	.fun_online = msim_con_fun_online,
-	.fun_offline = msim_con_fun_offline
-};
-
-static driver_t msim_con_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t msim_con_get_res(ddf_dev_t *dev, msim_con_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.mem_ranges.ranges[0]);
-
-	if (hw_res.irqs.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->irq = hw_res.irqs.irqs[0];
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t msim_con_dev_add(ddf_dev_t *dev)
-{
-	msim_con_t *msim_con;
-	msim_con_res_t res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "msim_con_dev_add(%p)", dev);
-
-	msim_con = ddf_dev_data_alloc(dev, sizeof(msim_con_t));
-	if (msim_con == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	msim_con->dev = dev;
-
-	rc = msim_con_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return msim_con_add(msim_con, &res);
-}
-
-static errno_t msim_con_dev_remove(ddf_dev_t *dev)
-{
-	msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "msim_con_dev_remove(%p)", dev);
-
-	return msim_con_remove(msim_con);
-}
-
-static errno_t msim_con_dev_gone(ddf_dev_t *dev)
-{
-	msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "msim_con_dev_gone(%p)", dev);
-
-	return msim_con_gone(msim_con);
-}
-
-static errno_t msim_con_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "msim_con_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t msim_con_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "msim_con_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": MSIM console driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&msim_con_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/msim-con/meson.build
===================================================================
--- uspace/drv/char/msim-con/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'msim-con.c')
Index: pace/drv/char/msim-con/msim-con.c
===================================================================
--- uspace/drv/char/msim-con/msim-con.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief Msim console driver.
- */
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <io/chardev_srv.h>
-
-#include "msim-con.h"
-
-static void msim_con_connection(ipc_call_t *, void *);
-
-static errno_t msim_con_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t msim_con_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t msim_con_chardev_ops = {
-	.read = msim_con_read,
-	.write = msim_con_write
-};
-
-static irq_cmd_t msim_cmds_proto[] = {
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = (void *) 0,	/* will be patched in run-time */
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static void msim_irq_handler(ipc_call_t *call, void *arg)
-{
-	msim_con_t *con = (msim_con_t *) arg;
-	uint8_t c;
-	errno_t rc;
-
-	fibril_mutex_lock(&con->buf_lock);
-
-	c = ipc_get_arg2(call);
-	rc = circ_buf_push(&con->cbuf, &c);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Buffer overrun");
-
-	fibril_mutex_unlock(&con->buf_lock);
-	fibril_condvar_broadcast(&con->buf_cv);
-}
-
-/** Add msim console device. */
-errno_t msim_con_add(msim_con_t *con, msim_con_res_t *res)
-{
-	ddf_fun_t *fun = NULL;
-	irq_cmd_t *msim_cmds = NULL;
-	errno_t rc;
-	bool bound = false;
-
-	circ_buf_init(&con->cbuf, con->buf, msim_con_buf_size, 1);
-	fibril_mutex_initialize(&con->buf_lock);
-	fibril_condvar_initialize(&con->buf_cv);
-
-	con->irq_handle = CAP_NIL;
-
-	msim_cmds = malloc(sizeof(msim_cmds_proto));
-	if (msim_cmds == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	con->res = *res;
-
-	fun = ddf_fun_create(con->dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = pio_enable((void *)res->base, 1, (void **) &con->out_reg);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling I/O");
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun, msim_con_connection);
-
-	con->irq_range[0].base = res->base;
-	con->irq_range[0].size = 1;
-
-	memcpy(msim_cmds, msim_cmds_proto, sizeof(msim_cmds_proto));
-	msim_cmds[0].addr = (void *) res->base;
-
-	con->irq_code.rangecount = 1;
-	con->irq_code.ranges = con->irq_range;
-	con->irq_code.cmdcount = sizeof(msim_cmds_proto) / sizeof(irq_cmd_t);
-	con->irq_code.cmds = msim_cmds;
-
-	rc = async_irq_subscribe(res->irq, msim_irq_handler, con,
-	    &con->irq_code, &con->irq_handle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ code.");
-		goto error;
-	}
-
-	chardev_srvs_init(&con->cds);
-	con->cds.ops = &msim_con_chardev_ops;
-	con->cds.sarg = con;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "console");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function 'a' to category "
-		    "'console'.");
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (cap_handle_valid(con->irq_handle))
-		async_irq_unsubscribe(con->irq_handle);
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	free(msim_cmds);
-
-	return rc;
-}
-
-/** Remove msim console device */
-errno_t msim_con_remove(msim_con_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Msim console device gone */
-errno_t msim_con_gone(msim_con_t *con)
-{
-	return ENOTSUP;
-}
-
-static void msim_con_putchar(msim_con_t *con, uint8_t ch)
-{
-	pio_write_8(con->out_reg, ch);
-}
-
-/** Read from msim console device */
-static errno_t msim_con_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	msim_con_t *con = (msim_con_t *) srv->srvs->sarg;
-	size_t p;
-	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	fibril_mutex_lock(&con->buf_lock);
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    circ_buf_nused(&con->cbuf) == 0)
-		fibril_condvar_wait(&con->buf_cv, &con->buf_lock);
-
-	p = 0;
-	while (p < size) {
-		rc = circ_buf_pop(&con->cbuf, &bp[p]);
-		if (rc != EOK)
-			break;
-		++p;
-	}
-
-	fibril_mutex_unlock(&con->buf_lock);
-
-	*nread = p;
-	return EOK;
-}
-
-/** Write to msim console device */
-static errno_t msim_con_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	msim_con_t *con = (msim_con_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	for (i = 0; i < size; i++)
-		msim_con_putchar(con, dp[i]);
-
-	*nwr = size;
-	return EOK;
-}
-
-/** Character device connection handler. */
-static void msim_con_connection(ipc_call_t *icall, void *arg)
-{
-	msim_con_t *con = (msim_con_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	chardev_conn(icall, &con->cds);
-}
-
-/** @}
- */
Index: pace/drv/char/msim-con/msim-con.h
===================================================================
--- uspace/drv/char/msim-con/msim-con.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_msim_con
- * @{
- */
-/** @file
- */
-
-#ifndef MSIM_CON_H
-#define MSIM_CON_H
-
-#include <adt/circ_buf.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-#include <io/chardev_srv.h>
-#include <loc.h>
-#include <stdint.h>
-
-enum {
-	msim_con_buf_size = 64
-};
-
-/** MSIM console resources */
-typedef struct {
-	uintptr_t base;
-	int irq;
-} msim_con_res_t;
-
-/** MSIM console */
-typedef struct {
-	async_sess_t *client_sess;
-	ddf_dev_t *dev;
-	chardev_srvs_t cds;
-	msim_con_res_t res;
-	irq_pio_range_t irq_range[1];
-	irq_code_t irq_code;
-	circ_buf_t cbuf;
-	uint8_t buf[msim_con_buf_size];
-	fibril_mutex_t buf_lock;
-	fibril_condvar_t buf_cv;
-	ioport8_t *out_reg;
-	cap_irq_handle_t irq_handle;
-} msim_con_t;
-
-extern errno_t msim_con_add(msim_con_t *, msim_con_res_t *);
-extern errno_t msim_con_remove(msim_con_t *);
-extern errno_t msim_con_gone(msim_con_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/msim-con/msim-con.ma
===================================================================
--- uspace/drv/char/msim-con/msim-con.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 msim/console
Index: pace/drv/char/ns8250/cyclic_buffer.h
===================================================================
--- uspace/drv/char/ns8250/cyclic_buffer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns8250
- * @{
- */
-/** @file
- */
-
-#ifndef CYCLIC_BUFFER_H_
-#define CYCLIC_BUFFER_H_
-
-#define BUF_LEN 4096
-
-typedef struct cyclic_buffer {
-	uint8_t buf[BUF_LEN];
-	int start;
-	int cnt;
-}  cyclic_buffer_t;
-
-/*
- * @return		False if the buffer is full.
- */
-static inline bool buf_push_back(cyclic_buffer_t *buf, uint8_t item)
-{
-	if (buf->cnt >= BUF_LEN)
-		return false;
-	int pos = (buf->start + buf->cnt) % BUF_LEN;
-	buf->buf[pos] = item;
-	buf->cnt++;
-	return true;
-}
-
-static inline bool buf_is_empty(cyclic_buffer_t *buf)
-{
-	return buf->cnt == 0;
-}
-
-static inline uint8_t buf_pop_front(cyclic_buffer_t *buf)
-{
-	assert(!buf_is_empty(buf));
-
-	uint8_t res = buf->buf[buf->start];
-	buf->start = (buf->start + 1) % BUF_LEN;
-	buf->cnt--;
-	return res;
-}
-
-static inline void buf_clear(cyclic_buffer_t *buf)
-{
-	buf->cnt = 0;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/char/ns8250/doc/doxygroups.h
===================================================================
--- uspace/drv/char/ns8250/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ns8250 ns8250
- * @brief NS 8250 UART driver
- * @ingroup drvs
- */
Index: pace/drv/char/ns8250/meson.build
===================================================================
--- uspace/drv/char/ns8250/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('ns8250.c')
Index: pace/drv/char/ns8250/ns8250.c
===================================================================
--- uspace/drv/char/ns8250/ns8250.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1145 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup ns8250
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <ddi.h>
-
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <io/chardev_srv.h>
-
-#include <device/hw_res.h>
-#include <ipc/serial_ctl.h>
-
-#include "cyclic_buffer.h"
-
-#define NAME "ns8250"
-
-#define REG_COUNT 7
-#define MAX_BAUD_RATE 115200
-#define DLAB_MASK (1 << 7)
-
-/** Interrupt Enable Register definition. */
-#define	NS8250_IER_RXREADY	(1 << 0)
-#define	NS8250_IER_THRE		(1 << 1)
-#define	NS8250_IER_RXSTATUS	(1 << 2)
-#define	NS8250_IER_MODEM_STATUS	(1 << 3)
-
-/** Interrupt ID Register definition. */
-#define	NS8250_IID_ACTIVE	(1 << 0)
-#define NS8250_IID_CAUSE_MASK 0x0e
-#define NS8250_IID_CAUSE_RXSTATUS 0x06
-
-/** FIFO Control Register definition. */
-#define	NS8250_FCR_FIFOENABLE	(1 << 0)
-#define	NS8250_FCR_RXFIFORESET	(1 << 1)
-#define	NS8250_FCR_TXFIFORESET	(1 << 2)
-#define	NS8250_FCR_DMAMODE	(1 << 3)
-#define	NS8250_FCR_RXTRIGGERLOW	(1 << 6)
-#define	NS8250_FCR_RXTRIGGERHI	(1 << 7)
-
-/** Line Control Register definition. */
-#define	NS8250_LCR_STOPBITS	(1 << 2)
-#define	NS8250_LCR_PARITY	(1 << 3)
-#define	NS8250_LCR_SENDBREAK	(1 << 6)
-#define	NS8250_LCR_DLAB		(1 << 7)
-
-/** Modem Control Register definition. */
-#define	NS8250_MCR_DTR		(1 << 0)
-#define	NS8250_MCR_RTS		(1 << 1)
-#define	NS8250_MCR_OUT1		(1 << 2)
-#define	NS8250_MCR_OUT2		(1 << 3)
-#define	NS8250_MCR_LOOPBACK	(1 << 4)
-#define	NS8250_MCR_ALL		(0x1f)
-
-/** Line Status Register definition. */
-#define	NS8250_LSR_RXREADY	(1 << 0)
-#define	NS8250_LSR_OE		(1 << 1)
-#define	NS8250_LSR_PE		(1 << 2)
-#define	NS8250_LSR_FE		(1 << 3)
-#define	NS8250_LSR_BREAK	(1 << 4)
-#define	NS8250_LSR_THRE		(1 << 5)
-#define	NS8250_LSR_TSE		(1 << 6)
-
-/** Modem Status Register definition. */
-#define	NS8250_MSR_DELTACTS	(1 << 0)
-#define	NS8250_MSR_DELTADSR	(1 << 1)
-#define	NS8250_MSR_RITRAILING	(1 << 2)
-#define	NS8250_MSR_DELTADCD	(1 << 3)
-#define	NS8250_MSR_CTS		(1 << 4)
-#define	NS8250_MSR_DSR		(1 << 5)
-#define	NS8250_MSR_RI		(1 << 6)
-#define	NS8250_MSR_DCD		(1 << 7)
-#define	NS8250_MSR_SIGNALS	(NS8250_MSR_CTS | NS8250_MSR_DSR \
-    | NS8250_MSR_RI | NS8250_MSR_DCD)
-
-/** The number of bits of one data unit send by the serial port. */
-typedef enum {
-	WORD_LENGTH_5,
-	WORD_LENGTH_6,
-	WORD_LENGTH_7,
-	WORD_LENGTH_8
-} word_length_t;
-
-/** The number of stop bits used by the serial port. */
-typedef enum {
-	/** Use one stop bit. */
-	ONE_STOP_BIT,
-	/** 1.5 stop bits for word length 5, 2 stop bits otherwise. */
-	TWO_STOP_BITS
-} stop_bit_t;
-
-/** 8250 UART registers layout. */
-typedef struct {
-	ioport8_t data;		/**< Data register. */
-	ioport8_t ier;		/**< Interrupt Enable Reg. */
-	ioport8_t iid;		/**< Interrupt ID Reg. */
-	ioport8_t lcr;		/**< Line Control Reg. */
-	ioport8_t mcr;		/**< Modem Control Reg. */
-	ioport8_t lsr;		/**< Line Status Reg. */
-	ioport8_t msr;		/**< Modem Status Reg. */
-} ns8250_regs_t;
-
-/** The driver data for the serial port devices. */
-typedef struct ns8250 {
-	/** DDF device node */
-	ddf_dev_t *dev;
-	/** DDF function node */
-	ddf_fun_t *fun;
-	/** Character device service */
-	chardev_srvs_t cds;
-	/** Parent session */
-	async_sess_t *parent_sess;
-	/** I/O registers */
-	ns8250_regs_t *regs;
-	/** Are there any clients connected to the device? */
-	unsigned client_connections;
-	/** The irq assigned to this device. */
-	int irq;
-	/** IRQ capability handle */
-	cap_irq_handle_t irq_handle;
-	/** The base i/o address of the devices registers. */
-	uintptr_t io_addr;
-	/** The i/o port used to access the serial ports registers. */
-	ioport8_t *port;
-	/** The buffer for incoming data. */
-	cyclic_buffer_t input_buffer;
-	/** The fibril mutex for synchronizing the access to the device. */
-	fibril_mutex_t mutex;
-	/** Indicates that some data has become available */
-	fibril_condvar_t input_buffer_available;
-	/** True if device is removed. */
-	bool removed;
-} ns8250_t;
-
-/** Obtain soft-state structure from device node */
-static ns8250_t *dev_ns8250(ddf_dev_t *dev)
-{
-	return ddf_dev_data_get(dev);
-}
-
-/** Obtain soft-state structure from function node */
-static ns8250_t *fun_ns8250(ddf_fun_t *fun)
-{
-	return dev_ns8250(ddf_fun_get_dev(fun));
-}
-
-/** Obtain soft-state structure from chardev srv */
-static ns8250_t *srv_ns8250(chardev_srv_t *srv)
-{
-	return (ns8250_t *)srv->srvs->sarg;
-}
-
-/** Find out if there is some incoming data available on the serial port.
- *
- * @param port		The base address of the serial port device's ports.
- * @return		True if there are data waiting to be read, false
- *			otherwise.
- */
-static bool ns8250_received(ns8250_regs_t *regs)
-{
-	return (pio_read_8(&regs->lsr) & NS8250_LSR_RXREADY) != 0;
-}
-
-/** Read one byte from the serial port.
- *
- * @param port		The base address of the serial port device's ports.
- * @return		The data read.
- */
-static uint8_t ns8250_read_8(ns8250_regs_t *regs)
-{
-	return pio_read_8(&regs->data);
-}
-
-/** Find out wheter it is possible to send data.
- *
- * @param port		The base address of the serial port device's ports.
- */
-static bool is_transmit_empty(ns8250_regs_t *regs)
-{
-	return (pio_read_8(&regs->lsr) & NS8250_LSR_THRE) != 0;
-}
-
-/** Write one character on the serial port.
- *
- * @param port		The base address of the serial port device's ports.
- * @param c		The character to be written to the serial port device.
- */
-static void ns8250_write_8(ns8250_regs_t *regs, uint8_t c)
-{
-	while (!is_transmit_empty(regs))
-		;
-
-	pio_write_8(&regs->data, c);
-}
-
-/** Read data from the serial port device.
- *
- * @param srv		Server-side connection data
- * @param buf		The output buffer for read data.
- * @param count		The number of bytes to be read.
- * @param nread		Place to store number of bytes actually read
- * @param flags		@c chardev_f_nonblock not to block waiting for data
- *			even if no data is available
- *
- * @return		EOK on success or non-zero error code
- */
-static errno_t ns8250_read(chardev_srv_t *srv, void *buf, size_t count, size_t *nread,
-    chardev_flags_t flags)
-{
-	ns8250_t *ns = srv_ns8250(srv);
-	char *bp = (char *) buf;
-	size_t pos = 0;
-
-	if (count == 0) {
-		*nread = 0;
-		return EOK;
-	}
-
-	fibril_mutex_lock(&ns->mutex);
-	while ((flags & chardev_f_none) == 0 &&
-	    buf_is_empty(&ns->input_buffer))
-		fibril_condvar_wait(&ns->input_buffer_available, &ns->mutex);
-	while (!buf_is_empty(&ns->input_buffer) && pos < count) {
-		bp[pos] = (char)buf_pop_front(&ns->input_buffer);
-		pos++;
-	}
-	fibril_mutex_unlock(&ns->mutex);
-
-	*nread = pos;
-	return EOK;
-}
-
-/** Write a character to the serial port.
- *
- * @param ns		Serial port device
- * @param c		The character to be written
- */
-static inline void ns8250_putchar(ns8250_t *ns, uint8_t c)
-{
-	fibril_mutex_lock(&ns->mutex);
-	ns8250_write_8(ns->regs, c);
-	fibril_mutex_unlock(&ns->mutex);
-}
-
-/** Write data to the serial port.
- *
- * @param srv		Server-side connection data
- * @param buf		The data to be written
- * @param count		The number of bytes to be written
- * @param nwritten	Place to store number of bytes successfully written
- * @return		EOK on success or non-zero error code
- */
-static errno_t ns8250_write(chardev_srv_t *srv, const void *buf, size_t count,
-    size_t *nwritten)
-{
-	ns8250_t *ns = srv_ns8250(srv);
-	size_t idx;
-	uint8_t *bp = (uint8_t *) buf;
-
-	for (idx = 0; idx < count; idx++)
-		ns8250_putchar(ns, bp[idx]);
-
-	*nwritten = count;
-	return EOK;
-}
-
-static errno_t ns8250_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t ns8250_close(chardev_srv_t *);
-static void ns8250_default_handler(chardev_srv_t *, ipc_call_t *);
-
-/** The character interface's callbacks. */
-static chardev_ops_t ns8250_chardev_ops = {
-	.open = ns8250_open,
-	.close = ns8250_close,
-	.read = ns8250_read,
-	.write = ns8250_write,
-	.def_handler = ns8250_default_handler
-};
-
-static void ns8250_char_conn(ipc_call_t *, void *);
-
-static errno_t ns8250_dev_add(ddf_dev_t *dev);
-static errno_t ns8250_dev_quiesce(ddf_dev_t *dev);
-static errno_t ns8250_dev_remove(ddf_dev_t *dev);
-
-/** The serial port device driver's standard operations. */
-static driver_ops_t ns8250_ops = {
-	.dev_add = &ns8250_dev_add,
-	.dev_remove = &ns8250_dev_remove,
-	.dev_quiesce = &ns8250_dev_quiesce
-};
-
-/** The serial port device driver structure. */
-static driver_t ns8250_driver = {
-	.name = NAME,
-	.driver_ops = &ns8250_ops
-};
-
-/** Clean up the serial port soft-state
- *
- * @param ns		Serial port device
- */
-static void ns8250_dev_cleanup(ns8250_t *ns)
-{
-}
-
-/** Enable the i/o ports of the device.
- *
- * @param ns		Serial port device
- * @return		True on success, false otherwise
- */
-static bool ns8250_pio_enable(ns8250_t *ns)
-{
-	ddf_msg(LVL_DEBUG, "ns8250_pio_enable %s", ddf_dev_get_name(ns->dev));
-
-	/* Gain control over port's registers. */
-	if (pio_enable((void *) ns->io_addr, REG_COUNT,
-	    (void **) &ns->port)) {
-		ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIxn
-		    " for device %s.", ns->io_addr, ddf_dev_get_name(ns->dev));
-		return false;
-	}
-
-	ns->regs = (ns8250_regs_t *)ns->port;
-
-	return true;
-}
-
-/** Probe the serial port device for its presence.
- *
- * @param ns		Serial port device
- * @return		True if the device is present, false otherwise
- */
-static bool ns8250_dev_probe(ns8250_t *ns)
-{
-	ddf_msg(LVL_DEBUG, "ns8250_dev_probe %s", ddf_dev_get_name(ns->dev));
-
-	bool res = true;
-	uint8_t olddata;
-
-	olddata = pio_read_8(&ns->regs->mcr);
-
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_LOOPBACK);
-	if (pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS)
-		res = false;
-
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_ALL);
-	if ((pio_read_8(&ns->regs->msr) & NS8250_MSR_SIGNALS) !=
-	    NS8250_MSR_SIGNALS)
-		res = false;
-
-	pio_write_8(&ns->regs->mcr, olddata);
-
-	if (!res) {
-		ddf_msg(LVL_DEBUG, "Device %s is not present.",
-		    ddf_dev_get_name(ns->dev));
-	}
-
-	return res;
-}
-
-/** Initialize serial port device.
- *
- * @param ns		Serial port device
- * @return		Zero on success, error number otherwise
- */
-static errno_t ns8250_dev_initialize(ns8250_t *ns)
-{
-	errno_t ret = EOK;
-
-	ddf_msg(LVL_DEBUG, "ns8250_dev_initialize %s", ddf_dev_get_name(ns->dev));
-
-	hw_resource_list_t hw_resources;
-	memset(&hw_resources, 0, sizeof(hw_resource_list_t));
-
-	/* Get hw resources. */
-	ret = hw_res_get_resource_list(ns->parent_sess, &hw_resources);
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to get HW resources for device "
-		    "%s.", ddf_dev_get_name(ns->dev));
-		goto failed;
-	}
-
-	size_t i;
-	hw_resource_t *res;
-	bool irq = false;
-	bool ioport = false;
-
-	for (i = 0; i < hw_resources.count; i++) {
-		res = &hw_resources.resources[i];
-		switch (res->type) {
-		case INTERRUPT:
-			ns->irq = res->res.interrupt.irq;
-			irq = true;
-			ddf_msg(LVL_NOTE, "Device %s was assigned irq = 0x%x.",
-			    ddf_dev_get_name(ns->dev), ns->irq);
-			break;
-
-		case IO_RANGE:
-			ns->io_addr = res->res.io_range.address;
-			if (res->res.io_range.size < REG_COUNT) {
-				ddf_msg(LVL_ERROR, "I/O range assigned to "
-				    "device %s is too small.", ddf_dev_get_name(ns->dev));
-				ret = ELIMIT;
-				goto failed;
-			}
-			ioport = true;
-			ddf_msg(LVL_NOTE, "Device %s was assigned I/O address = "
-			    "0x%#" PRIxn ".", ddf_dev_get_name(ns->dev), ns->io_addr);
-			break;
-
-		default:
-			break;
-		}
-	}
-
-	if (!irq || !ioport) {
-		ddf_msg(LVL_ERROR, "Missing HW resource(s) for device %s.",
-		    ddf_dev_get_name(ns->dev));
-		ret = ENOENT;
-		goto failed;
-	}
-
-	hw_res_clean_resource_list(&hw_resources);
-	return ret;
-
-failed:
-	ns8250_dev_cleanup(ns);
-	hw_res_clean_resource_list(&hw_resources);
-	return ret;
-}
-
-/** Enable interrupts on the serial port device.
- *
- * Interrupt when data is received
- *
- * @param port		The base address of the serial port device's ports.
- */
-static inline void ns8250_port_interrupts_enable(ns8250_regs_t *regs)
-{
-	/* Interrupt when data received. */
-	pio_write_8(&regs->ier, NS8250_IER_RXREADY | NS8250_IER_RXSTATUS);
-	pio_write_8(&regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS |
-	    NS8250_MCR_OUT2);
-}
-
-/** Disable interrupts on the serial port device.
- *
- * @param port		The base address of the serial port device's ports
- */
-static inline void ns8250_port_interrupts_disable(ns8250_regs_t *regs)
-{
-	pio_write_8(&regs->ier, 0x0);	/* Disable all interrupts. */
-}
-
-/** Enable interrupts for the serial port device.
- *
- * @param ns		Serial port device
- * @return		Zero on success, error number otherwise
- */
-static errno_t ns8250_interrupt_enable(ns8250_t *ns)
-{
-	/* Enable interrupt using IRC service. */
-	errno_t rc = hw_res_enable_interrupt(ns->parent_sess, ns->irq);
-	if (rc != EOK)
-		return EIO;
-
-	/* Read LSR to clear possible previous LSR interrupt */
-	pio_read_8(&ns->regs->lsr);
-
-	/* Enable interrupt on the serial port. */
-	ns8250_port_interrupts_enable(ns->regs);
-
-	return EOK;
-}
-
-/** Set Divisor Latch Access Bit.
- *
- * When the Divisor Latch Access Bit is set, it is possible to set baud rate of
- * the serial port device.
- *
- * @param port		The base address of the serial port device's ports.
- */
-static inline void enable_dlab(ns8250_regs_t *regs)
-{
-	uint8_t val = pio_read_8(&regs->lcr);
-	pio_write_8(&regs->lcr, val | NS8250_LCR_DLAB);
-}
-
-/** Clear Divisor Latch Access Bit.
- *
- * @param port		The base address of the serial port device's ports.
- */
-static inline void clear_dlab(ns8250_regs_t *regs)
-{
-	uint8_t val = pio_read_8(&regs->lcr);
-	pio_write_8(&regs->lcr, val & (~NS8250_LCR_DLAB));
-}
-
-/** Set baud rate of the serial communication on the serial device.
- *
- * @param port		The base address of the serial port device's ports.
- * @param baud_rate	The baud rate to be used by the device.
- * @return		Zero on success, error number otherwise (EINVAL
- *			if the specified baud_rate is not valid).
- */
-static errno_t ns8250_port_set_baud_rate(ns8250_regs_t *regs, unsigned int baud_rate)
-{
-	uint16_t divisor;
-	uint8_t div_low, div_high;
-
-	if (baud_rate < 50 || MAX_BAUD_RATE % baud_rate != 0) {
-		ddf_msg(LVL_ERROR, "Invalid baud rate %d requested.",
-		    baud_rate);
-		return EINVAL;
-	}
-
-	divisor = MAX_BAUD_RATE / baud_rate;
-	div_low = (uint8_t)divisor;
-	div_high = (uint8_t)(divisor >> 8);
-
-	/* Enable DLAB to be able to access baud rate divisor. */
-	enable_dlab(regs);
-
-	/* Set divisor low byte. */
-	pio_write_8(&regs->data, div_low);
-	/* Set divisor high byte. */
-	pio_write_8(&regs->ier, div_high);
-
-	clear_dlab(regs);
-
-	return EOK;
-}
-
-/** Get baud rate used by the serial port device.
- *
- * @param port		The base address of the serial port device's ports.
- * @param baud_rate	The ouput parameter to which the baud rate is stored.
- */
-static unsigned int ns8250_port_get_baud_rate(ns8250_regs_t *regs)
-{
-	uint16_t divisor;
-	uint8_t div_low, div_high;
-
-	/* Enable DLAB to be able to access baud rate divisor. */
-	enable_dlab(regs);
-
-	/* Get divisor low byte. */
-	div_low = pio_read_8(&regs->data);
-	/* Get divisor high byte. */
-	div_high = pio_read_8(&regs->ier);
-
-	clear_dlab(regs);
-
-	divisor = (div_high << 8) | div_low;
-	return MAX_BAUD_RATE / divisor;
-}
-
-/** Get the parameters of the serial communication set on the serial port
- * device.
- *
- * @param parity	The parity used.
- * @param word_length	The length of one data unit in bits.
- * @param stop_bits	The number of stop bits used (one or two).
- */
-static void ns8250_port_get_com_props(ns8250_regs_t *regs, unsigned int *parity,
-    unsigned int *word_length, unsigned int *stop_bits)
-{
-	uint8_t val;
-
-	val = pio_read_8(&regs->lcr);
-	*parity = ((val >> NS8250_LCR_PARITY) & 7);
-
-	/* Silence warnings */
-	*word_length = 0;
-
-	switch (val & 3) {
-	case WORD_LENGTH_5:
-		*word_length = 5;
-		break;
-	case WORD_LENGTH_6:
-		*word_length = 6;
-		break;
-	case WORD_LENGTH_7:
-		*word_length = 7;
-		break;
-	case WORD_LENGTH_8:
-		*word_length = 8;
-		break;
-	}
-
-	if ((val >> NS8250_LCR_STOPBITS) & 1)
-		*stop_bits = 2;
-	else
-		*stop_bits = 1;
-}
-
-/** Set the parameters of the serial communication on the serial port device.
- *
- * @param parity	The parity to be used.
- * @param word_length	The length of one data unit in bits.
- * @param stop_bits	The number of stop bits used (one or two).
- * @return		Zero on success, EINVAL if some of the specified values
- *			is invalid.
- */
-static errno_t ns8250_port_set_com_props(ns8250_regs_t *regs, unsigned int parity,
-    unsigned int word_length, unsigned int stop_bits)
-{
-	uint8_t val;
-
-	switch (word_length) {
-	case 5:
-		val = WORD_LENGTH_5;
-		break;
-	case 6:
-		val = WORD_LENGTH_6;
-		break;
-	case 7:
-		val = WORD_LENGTH_7;
-		break;
-	case 8:
-		val = WORD_LENGTH_8;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	switch (stop_bits) {
-	case 1:
-		val |= ONE_STOP_BIT << NS8250_LCR_STOPBITS;
-		break;
-	case 2:
-		val |= TWO_STOP_BITS << NS8250_LCR_STOPBITS;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	switch (parity) {
-	case SERIAL_NO_PARITY:
-	case SERIAL_ODD_PARITY:
-	case SERIAL_EVEN_PARITY:
-	case SERIAL_MARK_PARITY:
-	case SERIAL_SPACE_PARITY:
-		val |= parity << NS8250_LCR_PARITY;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	pio_write_8(&regs->lcr, val);
-
-	return EOK;
-}
-
-/** Initialize the serial port device.
- *
- * Set the default parameters of the serial communication.
- *
- * @param ns		Serial port device
- */
-static void ns8250_initialize_port(ns8250_t *ns)
-{
-	/* Disable interrupts. */
-	ns8250_port_interrupts_disable(ns->regs);
-	/* Set baud rate. */
-	ns8250_port_set_baud_rate(ns->regs, 38400);
-	/* 8 bits, no parity, two stop bits. */
-	ns8250_port_set_com_props(ns->regs, SERIAL_NO_PARITY, 8, 2);
-	/*
-	 * Enable FIFO, clear them, with 4-byte threshold for greater
-	 * reliability.
-	 */
-	pio_write_8(&ns->regs->iid, NS8250_FCR_FIFOENABLE |
-	    NS8250_FCR_RXFIFORESET | NS8250_FCR_TXFIFORESET |
-	    NS8250_FCR_RXTRIGGERLOW);
-	/*
-	 * RTS/DSR set (Request to Send and Data Terminal Ready lines enabled),
-	 * Aux Output2 set - needed for interrupts.
-	 */
-	pio_write_8(&ns->regs->mcr, NS8250_MCR_DTR | NS8250_MCR_RTS |
-	    NS8250_MCR_OUT2);
-}
-
-/** Deinitialize the serial port device.
- *
- * @param ns		Serial port device
- */
-static void ns8250_port_cleanup(ns8250_t *ns)
-{
-	/* Disable FIFO */
-	pio_write_8(&ns->regs->iid, 0x00);
-	/* Disable DTR, RTS, OUT1, OUT2 (int. enable) */
-	pio_write_8(&ns->regs->mcr, 0x00);
-	/* Disable all interrupts from the port */
-	ns8250_port_interrupts_disable(ns->regs);
-}
-
-/** Read the data from the serial port device and store them to the input
- * buffer.
- *
- * @param ns		Serial port device
- */
-static void ns8250_read_from_device(ns8250_t *ns)
-{
-	ns8250_regs_t *regs = ns->regs;
-	bool cont = true;
-
-	fibril_mutex_lock(&ns->mutex);
-	while (cont) {
-		cont = ns8250_received(regs);
-		if (cont) {
-			uint8_t val = ns8250_read_8(regs);
-
-			if (ns->client_connections > 0) {
-				bool buf_was_empty = buf_is_empty(&ns->input_buffer);
-				if (!buf_push_back(&ns->input_buffer, val)) {
-					ddf_msg(LVL_WARN, "Buffer overflow on "
-					    "%s.", ddf_dev_get_name(ns->dev));
-					break;
-				} else {
-					ddf_msg(LVL_DEBUG2, "Character %c saved "
-					    "to the buffer of %s.",
-					    val, ddf_dev_get_name(ns->dev));
-					if (buf_was_empty)
-						fibril_condvar_broadcast(&ns->input_buffer_available);
-				}
-			}
-		}
-	}
-	fibril_mutex_unlock(&ns->mutex);
-	fibril_yield();
-}
-
-/** The interrupt handler.
- *
- * The serial port is initialized to interrupt when some data come or line
- * status register changes, so the interrupt is handled by reading the incoming
- * data and reading the line status register.
- *
- * @pram icall IRQ event notificatoin
- * @param arg Argument (ns8250_t *)
- */
-static inline void ns8250_interrupt_handler(ipc_call_t *icall, void *arg)
-{
-	ns8250_t *ns = (ns8250_t *)arg;
-	uint8_t iir = pio_read_8(&ns->regs->iid);
-	if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) {
-		uint8_t lsr = pio_read_8(&ns->regs->lsr);
-		if (lsr & NS8250_LSR_OE) {
-			ddf_msg(LVL_WARN, "Overrun error on %s", ddf_dev_get_name(ns->dev));
-		}
-	}
-
-	ns8250_read_from_device(ns);
-	hw_res_clear_interrupt(ns->parent_sess, ns->irq);
-}
-
-/** Register the interrupt handler for the device.
- *
- * @param ns		Serial port device
- */
-static inline errno_t ns8250_register_interrupt_handler(ns8250_t *ns,
-    cap_irq_handle_t *ihandle)
-{
-	return register_interrupt_handler(ns->dev, ns->irq,
-	    ns8250_interrupt_handler, (void *)ns, NULL, ihandle);
-}
-
-/** Unregister the interrupt handler for the device.
- *
- * @param ns		Serial port device
- */
-static inline errno_t ns8250_unregister_interrupt_handler(ns8250_t *ns)
-{
-	return unregister_interrupt_handler(ns->dev, ns->irq_handle);
-}
-
-/** The dev_add callback method of the serial port driver.
- *
- * Probe and initialize the newly added device.
- *
- * @param dev		The serial port device.
- */
-static errno_t ns8250_dev_add(ddf_dev_t *dev)
-{
-	ns8250_t *ns = NULL;
-	ddf_fun_t *fun = NULL;
-	bool need_cleanup = false;
-	bool need_unreg_intr_handler = false;
-	bool bound = false;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "ns8250_dev_add %s (handle = %d)",
-	    ddf_dev_get_name(dev), (int) ddf_dev_get_handle(dev));
-
-	/* Allocate soft-state for the device */
-	ns = ddf_dev_data_alloc(dev, sizeof(ns8250_t));
-	if (ns == NULL) {
-		rc = ENOMEM;
-		goto fail;
-	}
-
-	fibril_mutex_initialize(&ns->mutex);
-	fibril_condvar_initialize(&ns->input_buffer_available);
-	ns->dev = dev;
-
-	ns->parent_sess = ddf_dev_parent_sess_get(ns->dev);
-	if (ns->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to connect to parent driver of "
-		    "device %s.", ddf_dev_get_name(ns->dev));
-		rc = EIO;
-		goto fail;
-	}
-
-	rc = ns8250_dev_initialize(ns);
-	if (rc != EOK)
-		goto fail;
-
-	need_cleanup = true;
-
-	if (!ns8250_pio_enable(ns)) {
-		rc = EADDRNOTAVAIL;
-		goto fail;
-	}
-
-	/* Find out whether the device is present. */
-	if (!ns8250_dev_probe(ns)) {
-		rc = ENOENT;
-		goto fail;
-	}
-
-	/* Serial port initialization (baud rate etc.). */
-	ns8250_initialize_port(ns);
-
-	/* Register interrupt handler. */
-	ns->irq_handle = CAP_NIL;
-	rc = ns8250_register_interrupt_handler(ns, &ns->irq_handle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register interrupt handler.");
-		rc = EADDRNOTAVAIL;
-		goto fail;
-	}
-	need_unreg_intr_handler = true;
-
-	/* Enable interrupt. */
-	rc = ns8250_interrupt_enable(ns);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to enable the interrupt. Error code = "
-		    "%s.", str_error_name(rc));
-		goto fail;
-	}
-
-	fun = ddf_fun_create(dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function.");
-		goto fail;
-	}
-
-	ddf_fun_set_conn_handler(fun, ns8250_char_conn);
-
-	chardev_srvs_init(&ns->cds);
-	ns->cds.ops = &ns8250_chardev_ops;
-	ns->cds.sarg = ns;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function.");
-		goto fail;
-	}
-
-	bound = true;
-	ns->fun = fun;
-
-	rc = ddf_fun_add_to_category(fun, "serial");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function to category 'serial'.");
-		goto fail;
-	}
-
-	ddf_msg(LVL_NOTE, "Device %s successfully initialized.",
-	    ddf_dev_get_name(dev));
-
-	return EOK;
-fail:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	if (need_unreg_intr_handler)
-		ns8250_unregister_interrupt_handler(ns);
-	if (need_cleanup)
-		ns8250_dev_cleanup(ns);
-	return rc;
-}
-
-static errno_t ns8250_dev_remove(ddf_dev_t *dev)
-{
-	ns8250_t *ns = dev_ns8250(dev);
-	errno_t rc;
-
-	fibril_mutex_lock(&ns->mutex);
-	if (ns->client_connections > 0) {
-		fibril_mutex_unlock(&ns->mutex);
-		return EBUSY;
-	}
-	ns->removed = true;
-	fibril_mutex_unlock(&ns->mutex);
-
-	rc = ddf_fun_unbind(ns->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to unbind function.");
-		return rc;
-	}
-
-	ddf_fun_destroy(ns->fun);
-
-	ns8250_port_cleanup(ns);
-	ns8250_unregister_interrupt_handler(ns);
-	ns8250_dev_cleanup(ns);
-	return EOK;
-}
-
-static errno_t ns8250_dev_quiesce(ddf_dev_t *dev)
-{
-	ns8250_t *ns = dev_ns8250(dev);
-
-	ns8250_port_interrupts_disable(ns->regs);
-	return EOK;
-}
-
-/** Open the device.
- *
- * This is a callback function called when a client tries to connect to the
- * device.
- *
- * @param srvs		Service structure
- * @param srv		Server-side connection structure
- */
-static errno_t ns8250_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	ns8250_t *ns = srv_ns8250(srv);
-	errno_t res;
-
-	fibril_mutex_lock(&ns->mutex);
-	if (ns->removed) {
-		res = ENXIO;
-	} else {
-		res = EOK;
-		ns->client_connections++;
-	}
-	fibril_mutex_unlock(&ns->mutex);
-
-	return res;
-}
-
-/** Close the device.
- *
- * This is a callback function called when a client tries to disconnect from
- * the device.
- *
- * @param srv		Server-side connection structure
- */
-static errno_t ns8250_close(chardev_srv_t *srv)
-{
-	ns8250_t *data = srv_ns8250(srv);
-
-	fibril_mutex_lock(&data->mutex);
-
-	assert(data->client_connections > 0);
-
-	if (!(--data->client_connections))
-		buf_clear(&data->input_buffer);
-
-	fibril_mutex_unlock(&data->mutex);
-
-	return EOK;
-}
-
-/** Get parameters of the serial communication which are set to the specified
- * device.
- *
- * @param dev		The serial port device.
- * @param baud_rate	The baud rate used by the device.
- * @param parity	The type of parity used by the device.
- * @param word_length	The size of one data unit in bits.
- * @param stop_bits	The number of stop bits used.
- */
-static void ns8250_get_props(ddf_dev_t *dev, unsigned int *baud_rate,
-    unsigned int *parity, unsigned int *word_length, unsigned int *stop_bits)
-{
-	ns8250_t *data = dev_ns8250(dev);
-	ns8250_regs_t *regs = data->regs;
-
-	fibril_mutex_lock(&data->mutex);
-	ns8250_port_interrupts_disable(regs);
-	*baud_rate = ns8250_port_get_baud_rate(regs);
-	ns8250_port_get_com_props(regs, parity, word_length, stop_bits);
-	ns8250_port_interrupts_enable(regs);
-	fibril_mutex_unlock(&data->mutex);
-
-	ddf_msg(LVL_DEBUG, "ns8250_get_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d", *baud_rate, *parity, *word_length,
-	    *stop_bits);
-}
-
-/** Set parameters of the serial communication to the specified serial port
- * device.
- *
- * @param dev		The serial port device.
- * @param baud_rate	The baud rate to be used by the device.
- * @param parity	The type of parity to be used by the device.
- * @param word_length	The size of one data unit in bits.
- * @param stop_bits	The number of stop bits to be used.
- */
-static errno_t ns8250_set_props(ddf_dev_t *dev, unsigned int baud_rate,
-    unsigned int parity, unsigned int word_length, unsigned int stop_bits)
-{
-	ddf_msg(LVL_DEBUG, "ns8250_set_props: baud rate %d, parity 0x%x, word "
-	    "length %d, stop bits %d", baud_rate, parity, word_length,
-	    stop_bits);
-
-	ns8250_t *data = dev_ns8250(dev);
-	ns8250_regs_t *regs = data->regs;
-	errno_t ret;
-
-	fibril_mutex_lock(&data->mutex);
-	ns8250_port_interrupts_disable(regs);
-	ret = ns8250_port_set_baud_rate(regs, baud_rate);
-	if (ret == EOK)
-		ret = ns8250_port_set_com_props(regs, parity, word_length, stop_bits);
-	ns8250_port_interrupts_enable(regs);
-	fibril_mutex_unlock(&data->mutex);
-
-	return ret;
-}
-
-/** Default handler for client requests which are not handled by the standard
- * interfaces.
- *
- * Configure the parameters of the serial communication.
- */
-static void ns8250_default_handler(chardev_srv_t *srv, ipc_call_t *call)
-{
-	ns8250_t *ns8250 = srv_ns8250(srv);
-	sysarg_t method = ipc_get_imethod(call);
-	errno_t ret;
-	unsigned int baud_rate, parity, word_length, stop_bits;
-
-	switch (method) {
-	case SERIAL_GET_COM_PROPS:
-		ns8250_get_props(ns8250->dev, &baud_rate, &parity, &word_length,
-		    &stop_bits);
-		async_answer_4(call, EOK, baud_rate, parity, word_length,
-		    stop_bits);
-		break;
-
-	case SERIAL_SET_COM_PROPS:
-		baud_rate = ipc_get_arg1(call);
-		parity = ipc_get_arg2(call);
-		word_length = ipc_get_arg3(call);
-		stop_bits = ipc_get_arg4(call);
-		ret = ns8250_set_props(ns8250->dev, baud_rate, parity, word_length,
-		    stop_bits);
-		async_answer_0(call, ret);
-		break;
-
-	default:
-		async_answer_0(call, ENOTSUP);
-	}
-}
-
-void ns8250_char_conn(ipc_call_t *icall, void *arg)
-{
-	ns8250_t *ns8250 = fun_ns8250((ddf_fun_t *)arg);
-
-	chardev_conn(icall, &ns8250->cds);
-}
-
-/** Initialize the serial port driver.
- *
- * Initialize device operations structures with callback methods for handling
- * client requests to the serial port devices.
- */
-static void ns8250_init(void)
-{
-	ddf_log_init(NAME);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS serial port driver\n");
-	ns8250_init();
-	return ddf_driver_main(&ns8250_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/char/ns8250/ns8250.ma
===================================================================
--- uspace/drv/char/ns8250/ns8250.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/ns8250
Index: pace/drv/char/pc-lpt/doc/doxygroups.h
===================================================================
--- uspace/drv/char/pc-lpt/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_pc_lpt pc-lpt
- * @brief PC parallel port driver
- * @ingroup drvs
- */
Index: pace/drv/char/pc-lpt/main.c
===================================================================
--- uspace/drv/char/pc-lpt/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_pc_lpt
- * @{
- */
-/** @file PC parallel port driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "pc-lpt.h"
-
-#define NAME  "pc-lpt"
-
-static errno_t pc_lpt_dev_add(ddf_dev_t *dev);
-static errno_t pc_lpt_dev_remove(ddf_dev_t *dev);
-static errno_t pc_lpt_dev_gone(ddf_dev_t *dev);
-static errno_t pc_lpt_dev_quiesce(ddf_dev_t *dev);
-static errno_t pc_lpt_fun_online(ddf_fun_t *fun);
-static errno_t pc_lpt_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = pc_lpt_dev_add,
-	.dev_remove = pc_lpt_dev_remove,
-	.dev_gone = pc_lpt_dev_gone,
-	.dev_quiesce = pc_lpt_dev_quiesce,
-	.fun_online = pc_lpt_fun_online,
-	.fun_offline = pc_lpt_fun_offline
-};
-
-static driver_t pc_lpt_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t pc_lpt_get_res(ddf_dev_t *dev, pc_lpt_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.io_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.io_ranges.ranges[0]);
-
-	if (hw_res.irqs.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->irq = hw_res.irqs.irqs[0];
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t pc_lpt_dev_add(ddf_dev_t *dev)
-{
-	pc_lpt_t *pc_lpt;
-	pc_lpt_res_t res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_lpt_dev_add(%p)", dev);
-
-	pc_lpt = ddf_dev_data_alloc(dev, sizeof(pc_lpt_t));
-	if (pc_lpt == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	pc_lpt->dev = dev;
-
-	rc = pc_lpt_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.");
-		return EIO;
-	}
-
-	return pc_lpt_add(pc_lpt, &res);
-}
-
-static errno_t pc_lpt_dev_remove(ddf_dev_t *dev)
-{
-	pc_lpt_t *pc_lpt = (pc_lpt_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pc_lpt_dev_remove(%p)", dev);
-
-	return pc_lpt_remove(pc_lpt);
-}
-
-static errno_t pc_lpt_dev_gone(ddf_dev_t *dev)
-{
-	pc_lpt_t *pc_lpt = (pc_lpt_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pc_lpt_dev_gone(%p)", dev);
-
-	return pc_lpt_gone(pc_lpt);
-}
-
-static errno_t pc_lpt_dev_quiesce(ddf_dev_t *dev)
-{
-	pc_lpt_t *pc_lpt = (pc_lpt_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pc_lpt_dev_quiesce(%p)", dev);
-
-	pc_lpt_quiesce(pc_lpt);
-	return EOK;
-}
-
-static errno_t pc_lpt_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pc_lpt_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t pc_lpt_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pc_lpt_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": PC parallel port driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&pc_lpt_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/pc-lpt/meson.build
===================================================================
--- uspace/drv/char/pc-lpt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'pc-lpt.c')
Index: pace/drv/char/pc-lpt/pc-lpt.c
===================================================================
--- uspace/drv/char/pc-lpt/pc-lpt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,272 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief PC parallel port driver.
- */
-
-#include <async.h>
-#include <bitops.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/chardev_srv.h>
-
-#include "pc-lpt.h"
-#include "pc-lpt_hw.h"
-
-static void pc_lpt_connection(ipc_call_t *, void *);
-
-static errno_t pc_lpt_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t pc_lpt_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t pc_lpt_chardev_ops = {
-	.read = pc_lpt_read,
-	.write = pc_lpt_write
-};
-
-static irq_cmd_t pc_lpt_cmds_proto[] = {
-	{
-		.cmd = CMD_DECLINE
-	}
-};
-
-/** PC LPT IRQ handler.
- *
- * Note that while the standard PC parallel port supports IRQ, it seems
- * drivers tend to avoid using them (for a reason?) These IRQs tend
- * to be used by other HW as well (Sound Blaster) so caution is in order.
- * Also not sure, if/how the IRQ needs to be cleared.
- *
- * Currently we don't enable IRQ and don't handle it in any way.
- */
-static void pc_lpt_irq_handler(ipc_call_t *call, void *arg)
-{
-	pc_lpt_t *lpt = (pc_lpt_t *) arg;
-
-	(void) lpt;
-}
-
-/** Add pc-lpt device. */
-errno_t pc_lpt_add(pc_lpt_t *lpt, pc_lpt_res_t *res)
-{
-	ddf_fun_t *fun = NULL;
-	bool bound = false;
-	irq_cmd_t *pc_lpt_cmds = NULL;
-	uint8_t control;
-	uint8_t r;
-	errno_t rc;
-
-	lpt->irq_handle = CAP_NIL;
-	fibril_mutex_initialize(&lpt->hw_lock);
-
-	pc_lpt_cmds = malloc(sizeof(pc_lpt_cmds_proto));
-	if (pc_lpt_cmds == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	lpt->res = *res;
-
-	fun = ddf_fun_create(lpt->dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = pio_enable((void *)res->base, sizeof(pc_lpt_regs_t),
-	    (void **) &lpt->regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling I/O");
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun, pc_lpt_connection);
-
-	lpt->irq_range[0].base = res->base;
-	lpt->irq_range[0].size = 1;
-
-	memcpy(pc_lpt_cmds, pc_lpt_cmds_proto, sizeof(pc_lpt_cmds_proto));
-	pc_lpt_cmds[0].addr = (void *) res->base;
-
-	lpt->irq_code.rangecount = 1;
-	lpt->irq_code.ranges = lpt->irq_range;
-	lpt->irq_code.cmdcount = sizeof(pc_lpt_cmds_proto) / sizeof(irq_cmd_t);
-	lpt->irq_code.cmds = pc_lpt_cmds;
-
-	rc = async_irq_subscribe(res->irq, pc_lpt_irq_handler, lpt,
-	    &lpt->irq_code, &lpt->irq_handle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ code.");
-		goto error;
-	}
-
-	control = BIT_V(uint8_t, ctl_select) | BIT_V(uint8_t, ctl_ninit);
-	pio_write_8(&lpt->regs->control, control);
-	r = pio_read_8(&lpt->regs->control);
-	if ((r & 0xf) != control) {
-		/* Device not present */
-		rc = EIO;
-		goto error;
-	}
-
-	control |= BIT_V(uint8_t, ctl_autofd);
-	pio_write_8(&lpt->regs->control, control);
-	r = pio_read_8(&lpt->regs->control);
-	if ((r & 0xf) != control) {
-		/* Device not present */
-		rc = EIO;
-		goto error;
-	}
-
-	control &= ~BIT_V(uint8_t, ctl_autofd);
-	pio_write_8(&lpt->regs->control, control);
-
-	chardev_srvs_init(&lpt->cds);
-	lpt->cds.ops = &pc_lpt_chardev_ops;
-	lpt->cds.sarg = lpt;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "printer-port");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function 'a' to category "
-		    "'printer-port'.");
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (cap_handle_valid(lpt->irq_handle))
-		async_irq_unsubscribe(lpt->irq_handle);
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	free(pc_lpt_cmds);
-
-	return rc;
-}
-
-/** Remove pc-lpt device */
-errno_t pc_lpt_remove(pc_lpt_t *lpt)
-{
-	return ENOTSUP;
-}
-
-/** Pc-lpt device gone */
-errno_t pc_lpt_gone(pc_lpt_t *lpt)
-{
-	return ENOTSUP;
-}
-
-/** Quiesce pc-lpt device */
-void pc_lpt_quiesce(pc_lpt_t *lpt)
-{
-	uint8_t control;
-
-	control = 0; /* nINIT=0, IRQ_ENABLE=0 */
-	pio_write_8(&lpt->regs->control, control);
-}
-
-/** Write a single byte to the parallel port.
- *
- * @param lpt Parallel port (locked)
- * @param ch Byte
- */
-static void pc_lpt_putchar(pc_lpt_t *lpt, uint8_t ch)
-{
-	uint8_t status;
-	uint8_t control;
-
-	assert(fibril_mutex_is_locked(&lpt->hw_lock));
-
-	/* Write data */
-	pio_write_8(&lpt->regs->data, ch);
-
-	/* Wait for S7/nbusy to become 1 */
-	do {
-		status = pio_read_8(&lpt->regs->status);
-		// FIXME Need to time out with an error after a while
-	} while ((status & BIT_V(uint8_t, sts_nbusy)) == 0);
-
-	control = pio_read_8(&lpt->regs->control);
-	pio_write_8(&lpt->regs->control, control | BIT_V(uint8_t, ctl_strobe));
-	fibril_usleep(5);
-	pio_write_8(&lpt->regs->control, control & ~BIT_V(uint8_t, ctl_strobe));
-}
-
-/** Read from pc-lpt device */
-static errno_t pc_lpt_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	pc_lpt_t *lpt = (pc_lpt_t *) srv->srvs->sarg;
-	(void) lpt;
-	return ENOTSUP;
-}
-
-/** Write to pc-lpt device */
-static errno_t pc_lpt_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	pc_lpt_t *lpt = (pc_lpt_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	fibril_mutex_lock(&lpt->hw_lock);
-
-	for (i = 0; i < size; i++)
-		pc_lpt_putchar(lpt, dp[i]);
-
-	fibril_mutex_unlock(&lpt->hw_lock);
-
-	*nwr = size;
-	return EOK;
-}
-
-/** Character device connection handler. */
-static void pc_lpt_connection(ipc_call_t *icall, void *arg)
-{
-	pc_lpt_t *lpt = (pc_lpt_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	chardev_conn(icall, &lpt->cds);
-}
-
-/** @}
- */
Index: pace/drv/char/pc-lpt/pc-lpt.h
===================================================================
--- uspace/drv/char/pc-lpt/pc-lpt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_pc_lpt
- * @{
- */
-/** @file
- */
-
-#ifndef PC_LPT_H
-#define PC_LPT_H
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-#include <io/chardev_srv.h>
-#include <stdint.h>
-
-#include "pc-lpt_hw.h"
-
-/** PC parallel port resources */
-typedef struct {
-	uintptr_t base;
-	int irq;
-} pc_lpt_res_t;
-
-/** PC parallel port */
-typedef struct {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** Character device service structure */
-	chardev_srvs_t cds;
-	/** Hardware resources */
-	pc_lpt_res_t res;
-	/** PIO range */
-	irq_pio_range_t irq_range[1];
-	/** IRQ code */
-	irq_code_t irq_code;
-	/** Hardware access lock */
-	fibril_mutex_t hw_lock;
-	/** Hardware registers */
-	pc_lpt_regs_t *regs;
-	/** IRQ handle */
-	cap_irq_handle_t irq_handle;
-} pc_lpt_t;
-
-extern errno_t pc_lpt_add(pc_lpt_t *, pc_lpt_res_t *);
-extern errno_t pc_lpt_remove(pc_lpt_t *);
-extern errno_t pc_lpt_gone(pc_lpt_t *);
-extern void pc_lpt_quiesce(pc_lpt_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/pc-lpt/pc-lpt.ma
===================================================================
--- uspace/drv/char/pc-lpt/pc-lpt.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/lpt
Index: pace/drv/char/pc-lpt/pc-lpt_hw.h
===================================================================
--- uspace/drv/char/pc-lpt/pc-lpt_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_pc_lpt
- * @{
- */
-/** @file
- */
-
-#ifndef PC_LPT_HW_H
-#define PC_LPT_HW_H
-
-#include <ddi.h>
-
-/** PC parallel port registers */
-typedef struct {
-	/** Data out register */
-	ioport8_t data;
-	/** Status register */
-	ioport8_t status;
-	/** Control register */
-	ioport8_t control;
-} pc_lpt_regs_t;
-
-/** Printer control register bits */
-typedef enum {
-	/** Strobe */
-	ctl_strobe = 0,
-	/** Auto linefeed */
-	ctl_autofd = 1,
-	/** -Init */
-	ctl_ninit = 2,
-	/** Select */
-	ctl_select = 3,
-	/** IRQ Enable */
-	ctl_irq_enable = 4
-} pc_lpt_ctl_bits_t;
-
-/** Printer status register bits */
-typedef enum {
-	/** -Error */
-	sts_nerror = 3,
-	/** Select */
-	sts_select = 4,
-	/** Init */
-	sts_paper_end = 5,
-	/** -Ack */
-	sts_nack = 6,
-	/** -Busy */
-	sts_nbusy = 7
-} pc_lpt_sts_bits_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/pl011/main.c
===================================================================
--- uspace/drv/char/pl011/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_pl011
- * @{
- */
-/** @file ARM PrimeCell PL011 UART driver.
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "pl011.h"
-
-#define NAME  "pl011"
-
-static errno_t pl011_dev_add(ddf_dev_t *dev);
-static errno_t pl011_dev_remove(ddf_dev_t *dev);
-static errno_t pl011_dev_gone(ddf_dev_t *dev);
-static errno_t pl011_fun_online(ddf_fun_t *fun);
-static errno_t pl011_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = pl011_dev_add,
-	.dev_remove = pl011_dev_remove,
-	.dev_gone = pl011_dev_gone,
-	.fun_online = pl011_fun_online,
-	.fun_offline = pl011_fun_offline
-};
-
-static driver_t pl011_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t pl011_get_res(ddf_dev_t *dev, pl011_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.mem_ranges.ranges[0]);
-
-	if (hw_res.irqs.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->irq = hw_res.irqs.irqs[0];
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t pl011_dev_add(ddf_dev_t *dev)
-{
-	pl011_t *pl011;
-	pl011_res_t res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pl011_dev_add(%p)", dev);
-
-	pl011 = ddf_dev_data_alloc(dev, sizeof(pl011_t));
-	if (pl011 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	pl011->dev = dev;
-
-	rc = pl011_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.");
-		return EIO;
-	}
-
-	return pl011_add(pl011, &res);
-}
-
-static errno_t pl011_dev_remove(ddf_dev_t *dev)
-{
-	pl011_t *pl011 = (pl011_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pl011_dev_remove(%p)", dev);
-
-	return pl011_remove(pl011);
-}
-
-static errno_t pl011_dev_gone(ddf_dev_t *dev)
-{
-	pl011_t *pl011 = (pl011_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "pl011_dev_gone(%p)", dev);
-
-	return pl011_gone(pl011);
-}
-
-static errno_t pl011_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pl011_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t pl011_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pl011_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": PL011 serial device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&pl011_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/pl011/meson.build
===================================================================
--- uspace/drv/char/pl011/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2016 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'pl011.c')
Index: pace/drv/char/pl011/pl011.c
===================================================================
--- uspace/drv/char/pl011/pl011.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,382 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ARM PrimeCell PL011 UART driver.
- */
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <io/chardev_srv.h>
-#include <macros.h>
-
-#include "pl011.h"
-
-/** PL011 register map. */
-typedef struct {
-	/** UART data register. */
-	ioport32_t data;
-	union {
-		/** Receive status register (same values that are in upper bits
-		 * of data register).
-		 */
-		const ioport32_t status;
-		/** Error clear register (writing anything clears all errors).
-		 */
-		ioport32_t error_clear;
-	};
-	/** Reserved. */
-	PADD32(4);
-	/** Flag register. */
-	const ioport32_t flag;
-	/** Transmit FIFO full. */
-#define PL011_UART_FLAG_TXFF_FLAG  (1 << 5)
-
-	/** Reserved. */
-	PADD32(1);
-	/** IrDA low-power counter register. */
-	ioport32_t irda_low_power;
-	/** Integer baud rate register. */
-	ioport32_t int_baud_divisor;
-	/** Fractional baud rate register. */
-	ioport32_t fract_baud_divisor;
-	/** Line control register. */
-	ioport32_t line_control_high;
-	/** Control register. */
-	ioport32_t control;
-	/** Interrupt FIFO level select register. */
-	ioport32_t interrupt_fifo;
-	/** Interrupt mask set/clear register. */
-	ioport32_t interrupt_mask;
-	/** Raw interrupt status register (pending interrupts before applying
-	 * the mask).
-	 */
-	const ioport32_t raw_interrupt_status;
-	/** Masked interrupt status register (pending interrupts after applying
-	 * the mask).
-	 */
-	const ioport32_t masked_interrupt_status;
-	/** Interrupt clear register (write 1s to clear pending interrupts). */
-	ioport32_t interrupt_clear;
-
-	/** Interrupt indicating a change in the nUARTRI modem status. */
-#define PL011_UART_INTERRUPT_RIM_FLAG   (1 << 0)
-	/** Interrupt indicating a change in the nUARTCTS modem status. */
-#define PL011_UART_INTERRUPT_CTSM_FLAG  (1 << 1)
-	/** Interrupt indicating a change in the nUARTDCD modem status. */
-#define PL011_UART_INTERRUPT_DCDM_FLAG  (1 << 2)
-	/** Interrupt indicating a change in the nUARTDSR modem status. */
-#define PL011_UART_INTERRUPT_DSRM_FLAG  (1 << 3)
-	/** The receive interrupt. */
-#define PL011_UART_INTERRUPT_RX_FLAG    (1 << 4)
-	/** The transmit interrupt. */
-#define PL011_UART_INTERRUPT_TX_FLAG    (1 << 5)
-	/** The receive timeout interrupt.  */
-#define PL011_UART_INTERRUPT_RT_FLAG    (1 << 6)
-	/** Interrupt indicating an overrun error. */
-#define PL011_UART_INTERRUPT_FE_FLAG    (1 << 7)
-	/** Interrupt indicating a break in the reception. */
-#define PL011_UART_INTERRUPT_PE_FLAG    (1 << 8)
-	/** Interrupt indicating a parity error in the received character. */
-#define PL011_UART_INTERRUPT_BE_FLAG    (1 << 9)
-	/** Interrupt indicating a framing error in the received character. */
-#define PL011_UART_INTERRUPT_OE_FLAG    (1 << 10)
-	/** All interrupt mask. */
-#define PL011_UART_INTERRUPT_ALL        0x3ff
-
-	/** DMA control register. */
-	ioport32_t dma_control;
-	/** Reserved. */
-	PADD32(13);
-	/** Reserved for test purposes. */
-	PADD32(4);
-	/** Reserved. */
-	PADD32(976);
-	/** Reserved for future ID expansion. */
-	PADD32(4);
-	/** UARTPeriphID0 register. */
-	const ioport32_t periph_id0;
-	/** UARTPeriphID1 register. */
-	const ioport32_t periph_id1;
-	/** UARTPeriphID2 register. */
-	const ioport32_t periph_id2;
-	/** UARTPeriphID3 register. */
-	const ioport32_t periph_id3;
-	/** UARTPCellID0 register. */
-	const ioport32_t cell_id0;
-	/** UARTPCellID1 register. */
-	const ioport32_t cell_id1;
-	/** UARTPCellID2 register. */
-	const ioport32_t cell_id2;
-	/** UARTPCellID3 register. */
-	const ioport32_t cell_id3;
-} pl011_uart_regs_t;
-
-static void pl011_connection(ipc_call_t *, void *);
-
-static errno_t pl011_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t pl011_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t pl011_chardev_ops = {
-	.read = pl011_read,
-	.write = pl011_write
-};
-
-/** Address range accessed by the PL011 interrupt pseudo-code. */
-static const irq_pio_range_t pl011_ranges_proto[] = {
-	{
-		.base = 0,
-		.size = sizeof(pl011_uart_regs_t)
-	}
-};
-
-/** PL011 interrupt pseudo-code instructions. */
-static const irq_cmd_t pl011_cmds_proto[] = {
-	{
-		/* Read masked_interrupt_status. */
-		.cmd = CMD_PIO_READ_32,
-		.addr = NULL,
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_AND,
-		.value = PL011_UART_INTERRUPT_RX_FLAG |
-		    PL011_UART_INTERRUPT_RT_FLAG,
-		.srcarg = 1,
-		.dstarg = 3
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 1,
-		.srcarg = 3
-	},
-	{
-		/* Read data. */
-		.cmd = CMD_PIO_READ_32,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Process an interrupt from a PL011 device. */
-static void pl011_irq_handler(ipc_call_t *call, void *arg)
-{
-	pl011_t *pl011 = (pl011_t *) arg;
-	uint32_t intrs = ipc_get_arg1(call);
-	uint8_t c = ipc_get_arg2(call);
-	errno_t rc;
-
-	if ((intrs & (PL011_UART_INTERRUPT_RX_FLAG |
-	    PL011_UART_INTERRUPT_RT_FLAG)) == 0) {
-		/* TODO */
-		return;
-	}
-
-	fibril_mutex_lock(&pl011->buf_lock);
-
-	rc = circ_buf_push(&pl011->cbuf, &c);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "Buffer overrun");
-
-	fibril_mutex_unlock(&pl011->buf_lock);
-	fibril_condvar_broadcast(&pl011->buf_cv);
-}
-
-/** Add a PL011 device. */
-errno_t pl011_add(pl011_t *pl011, pl011_res_t *res)
-{
-	ddf_fun_t *fun = NULL;
-	irq_pio_range_t *pl011_ranges = NULL;
-	irq_cmd_t *pl011_cmds = NULL;
-	errno_t rc;
-
-	circ_buf_init(&pl011->cbuf, pl011->buf, pl011_buf_size, 1);
-	fibril_mutex_initialize(&pl011->buf_lock);
-	fibril_condvar_initialize(&pl011->buf_cv);
-
-	pl011->irq_handle = CAP_NIL;
-
-	pl011_ranges = malloc(sizeof(pl011_ranges_proto));
-	if (pl011_ranges == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-	pl011_cmds = malloc(sizeof(pl011_cmds_proto));
-	if (pl011_cmds == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pl011->res = *res;
-
-	fun = ddf_fun_create(pl011->dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = pio_enable(
-	    (void *) res->base, sizeof(pl011_uart_regs_t), &pl011->regs);
-	if (rc != EOK)
-		goto error;
-
-	ddf_fun_set_conn_handler(fun, pl011_connection);
-
-	memcpy(pl011_ranges, pl011_ranges_proto, sizeof(pl011_ranges_proto));
-	memcpy(pl011_cmds, pl011_cmds_proto, sizeof(pl011_cmds_proto));
-	pl011_ranges[0].base = res->base;
-	pl011_uart_regs_t *regsphys = (pl011_uart_regs_t *) res->base;
-	pl011_cmds[0].addr = (void *) &regsphys->masked_interrupt_status;
-	pl011_cmds[3].addr = (void *) &regsphys->data;
-
-	pl011->irq_code.rangecount =
-	    sizeof(pl011_ranges_proto) / sizeof(irq_pio_range_t);
-	pl011->irq_code.ranges = pl011_ranges;
-	pl011->irq_code.cmdcount = sizeof(pl011_cmds_proto) / sizeof(irq_cmd_t);
-	pl011->irq_code.cmds = pl011_cmds;
-
-	rc = async_irq_subscribe(res->irq, pl011_irq_handler, pl011,
-	    &pl011->irq_code, &pl011->irq_handle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error registering IRQ code.");
-		goto error;
-	}
-
-	chardev_srvs_init(&pl011->cds);
-	pl011->cds.ops = &pl011_chardev_ops;
-	pl011->cds.sarg = pl011;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
-		goto error;
-	}
-
-	ddf_fun_add_to_category(fun, "console");
-
-	return EOK;
-error:
-	if (cap_handle_valid(pl011->irq_handle))
-		async_irq_unsubscribe(pl011->irq_handle);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	free(pl011_ranges);
-	free(pl011_cmds);
-
-	return rc;
-}
-
-/** Remove a PL011 device. */
-errno_t pl011_remove(pl011_t *pl011)
-{
-	return ENOTSUP;
-}
-
-/** A PL011 device gone. */
-errno_t pl011_gone(pl011_t *pl011)
-{
-	return ENOTSUP;
-}
-
-/** Send a character to a PL011 device.
- *
- * @param c Character to be printed.
- */
-static void pl011_putchar(pl011_t *pl011, uint8_t ch)
-{
-	pl011_uart_regs_t *regs = (pl011_uart_regs_t *) pl011->regs;
-
-	/* Wait for space to become available in the TX FIFO. */
-	while (pio_read_32(&regs->flag) & PL011_UART_FLAG_TXFF_FLAG)
-		;
-
-	pio_write_32(&regs->data, ch);
-}
-
-/** Read from a PL011 device. */
-static errno_t pl011_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	pl011_t *pl011 = (pl011_t *) srv->srvs->sarg;
-	size_t p;
-	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	fibril_mutex_lock(&pl011->buf_lock);
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    circ_buf_nused(&pl011->cbuf) == 0)
-		fibril_condvar_wait(&pl011->buf_cv, &pl011->buf_lock);
-
-	p = 0;
-	while (p < size) {
-		rc = circ_buf_pop(&pl011->cbuf, &bp[p]);
-		if (rc != EOK)
-			break;
-		++p;
-	}
-
-	fibril_mutex_unlock(&pl011->buf_lock);
-
-	*nread = p;
-	return EOK;
-}
-
-/** Write to a PL011 device. */
-static errno_t pl011_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	pl011_t *pl011 = (pl011_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	for (i = 0; i < size; i++)
-		pl011_putchar(pl011, dp[i]);
-
-	*nwr = size;
-	return EOK;
-}
-
-/** Character device connection handler. */
-static void pl011_connection(ipc_call_t *icall, void *arg)
-{
-	pl011_t *pl011 = (pl011_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	chardev_conn(icall, &pl011->cds);
-}
-
-/** @}
- */
Index: pace/drv/char/pl011/pl011.h
===================================================================
--- uspace/drv/char/pl011/pl011.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_pl011
- * @{
- */
-/** @file
- */
-
-#ifndef PL011_CON_H
-#define PL011_CON_H
-
-#include <adt/circ_buf.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-#include <io/chardev_srv.h>
-#include <loc.h>
-#include <stdint.h>
-
-enum {
-	pl011_buf_size = 64
-};
-
-/** PL011 device resources. */
-typedef struct {
-	uintptr_t base;
-	int irq;
-} pl011_res_t;
-
-/** PL011 device. */
-typedef struct {
-	ddf_dev_t *dev;
-	chardev_srvs_t cds;
-	pl011_res_t res;
-	irq_code_t irq_code;
-	circ_buf_t cbuf;
-	uint8_t buf[pl011_buf_size];
-	fibril_mutex_t buf_lock;
-	fibril_condvar_t buf_cv;
-	void *regs;
-	cap_irq_handle_t irq_handle;
-} pl011_t;
-
-extern errno_t pl011_add(pl011_t *, pl011_res_t *);
-extern errno_t pl011_remove(pl011_t *);
-extern errno_t pl011_gone(pl011_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/pl011/pl011.ma
===================================================================
--- uspace/drv/char/pl011/pl011.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 arm/pl011
Index: pace/drv/char/pl050/doc/doxygroups.h
===================================================================
--- uspace/drv/char/pl050/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pl050 pl050
- * @brief Driver for ARM PrimeCell PS2 Keyboard/Mouse Interface
- * @ingroup drvs
- */
Index: pace/drv/char/pl050/meson.build
===================================================================
--- uspace/drv/char/pl050/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('pl050.c')
Index: pace/drv/char/pl050/pl050.c
===================================================================
--- uspace/drv/char/pl050/pl050.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,404 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pl050
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <bitops.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <io/chardev_srv.h>
-
-#include "pl050_hw.h"
-
-#define NAME "pl050"
-
-enum {
-	buffer_size = 64
-};
-
-static errno_t pl050_dev_add(ddf_dev_t *);
-static errno_t pl050_fun_online(ddf_fun_t *);
-static errno_t pl050_fun_offline(ddf_fun_t *);
-static void pl050_char_conn(ipc_call_t *, void *);
-static errno_t pl050_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t pl050_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static driver_ops_t driver_ops = {
-	.dev_add = &pl050_dev_add,
-	.fun_online = &pl050_fun_online,
-	.fun_offline = &pl050_fun_offline
-};
-
-static driver_t pl050_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static chardev_ops_t pl050_chardev_ops = {
-	.read = pl050_read,
-	.write = pl050_write
-};
-
-typedef struct {
-	async_sess_t *parent_sess;
-	ddf_dev_t *dev;
-	char *name;
-
-	ddf_fun_t *fun_a;
-	chardev_srvs_t cds;
-
-	uintptr_t iobase;
-	size_t iosize;
-	kmi_regs_t *regs;
-	uint8_t buffer[buffer_size];
-	size_t buf_rp;
-	size_t buf_wp;
-	fibril_condvar_t buf_cv;
-	fibril_mutex_t buf_lock;
-} pl050_t;
-
-static irq_pio_range_t pl050_ranges[] = {
-	{
-		.base = 0,
-		.size = 9,
-	}
-};
-
-static irq_cmd_t pl050_cmds[] = {
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_AND,
-		.value = BIT_V(uint8_t, kmi_stat_rxfull),
-		.srcarg = 1,
-		.dstarg = 3
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 2,
-		.srcarg = 3
-	},
-	{
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,  /* Will be patched in run-time */
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static irq_code_t pl050_irq_code = {
-	sizeof(pl050_ranges) / sizeof(irq_pio_range_t),
-	pl050_ranges,
-	sizeof(pl050_cmds) / sizeof(irq_cmd_t),
-	pl050_cmds
-};
-
-static pl050_t *pl050_from_fun(ddf_fun_t *fun)
-{
-	return (pl050_t *)ddf_dev_data_get(ddf_fun_get_dev(fun));
-}
-
-/** PL050 interrupt handler
- *
- * @param call IRQ event notification
- * @param arg Argument (pl050_t *)
- */
-static void pl050_interrupt(ipc_call_t *call, void *arg)
-{
-	pl050_t *pl050 = (pl050_t *)arg;
-	size_t nidx;
-
-	fibril_mutex_lock(&pl050->buf_lock);
-	nidx = (pl050->buf_wp + 1) % buffer_size;
-	if (nidx == pl050->buf_rp) {
-		/** Buffer overrunt */
-		ddf_msg(LVL_WARN, "Buffer overrun.");
-		fibril_mutex_unlock(&pl050->buf_lock);
-		return;
-	}
-
-	pl050->buffer[pl050->buf_wp] = ipc_get_arg2(call);
-	pl050->buf_wp = nidx;
-	fibril_condvar_broadcast(&pl050->buf_cv);
-	fibril_mutex_unlock(&pl050->buf_lock);
-}
-
-static errno_t pl050_init(pl050_t *pl050)
-{
-	hw_res_list_parsed_t res;
-	void *regs;
-	errno_t rc;
-
-	fibril_mutex_initialize(&pl050->buf_lock);
-	fibril_condvar_initialize(&pl050->buf_cv);
-	pl050->buf_rp = pl050->buf_wp = 0;
-
-	pl050->parent_sess = ddf_dev_parent_sess_get(pl050->dev);
-	if (pl050->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed connecitng parent driver.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	hw_res_list_parsed_init(&res);
-	rc = hw_res_get_list_parsed(pl050->parent_sess, &res, 0);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting resource list.");
-		goto error;
-	}
-
-	if (res.mem_ranges.count != 1) {
-		ddf_msg(LVL_ERROR, "Expected exactly one memory range.");
-		rc = EINVAL;
-		goto error;
-	}
-
-	pl050->iobase = RNGABS(res.mem_ranges.ranges[0]);
-	pl050->iosize = RNGSZ(res.mem_ranges.ranges[0]);
-
-	pl050_irq_code.ranges[0].base = pl050->iobase;
-	kmi_regs_t *regsphys = (kmi_regs_t *) pl050->iobase;
-	pl050_irq_code.cmds[0].addr = &regsphys->stat;
-	pl050_irq_code.cmds[3].addr = &regsphys->data;
-
-	if (res.irqs.count != 1) {
-		ddf_msg(LVL_ERROR, "Expected exactly one IRQ.");
-		rc = EINVAL;
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "iobase=%p irq=%d", (void *)pl050->iobase,
-	    res.irqs.irqs[0]);
-
-	rc = pio_enable((void *)pl050->iobase, sizeof(kmi_regs_t), &regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling PIO");
-		goto error;
-	}
-
-	pl050->regs = regs;
-
-	cap_irq_handle_t ihandle;
-	rc = register_interrupt_handler(pl050->dev,
-	    res.irqs.irqs[0], pl050_interrupt, (void *)pl050, &pl050_irq_code,
-	    &ihandle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%s)",
-		    str_error_name(rc));
-		goto error;
-	}
-
-	rc = hw_res_enable_interrupt(pl050->parent_sess, res.irqs.irqs[0]);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed enabling interrupt: %s", str_error(rc));
-		goto error;
-	}
-
-	pio_write_8(&pl050->regs->cr,
-	    BIT_V(uint8_t, kmi_cr_enable) |
-	    BIT_V(uint8_t, kmi_cr_rxintr));
-
-	return EOK;
-error:
-	return rc;
-}
-
-static errno_t pl050_read(chardev_srv_t *srv, void *buffer, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	pl050_t *pl050 = (pl050_t *)srv->srvs->sarg;
-	uint8_t *bp = buffer;
-	size_t left;
-
-	fibril_mutex_lock(&pl050->buf_lock);
-
-	left = size;
-	while (left > 0) {
-		while ((flags & chardev_f_nonblock) == 0 &&
-		    left == size && pl050->buf_rp == pl050->buf_wp)
-			fibril_condvar_wait(&pl050->buf_cv, &pl050->buf_lock);
-		if (pl050->buf_rp == pl050->buf_wp)
-			break;
-		*bp++ = pl050->buffer[pl050->buf_rp];
-		--left;
-		pl050->buf_rp = (pl050->buf_rp + 1) % buffer_size;
-	}
-
-	fibril_mutex_unlock(&pl050->buf_lock);
-
-	*nread = size - left;
-	return EOK;
-}
-
-static errno_t pl050_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwritten)
-{
-	pl050_t *pl050 = (pl050_t *)srv->srvs->sarg;
-	uint8_t *dp = (uint8_t *)data;
-	uint8_t status;
-	size_t i;
-
-	ddf_msg(LVL_NOTE, "%s/pl050_write(%zu bytes)", pl050->name, size);
-	for (i = 0; i < size; i++) {
-		while (true) {
-			status = pio_read_8(&pl050->regs->stat);
-			if ((status & BIT_V(uint8_t, kmi_stat_txempty)) != 0)
-				break;
-		}
-		pio_write_8(&pl050->regs->data, dp[i]);
-	}
-	ddf_msg(LVL_NOTE, "%s/pl050_write() success", pl050->name);
-
-	*nwritten = size;
-	return EOK;
-}
-
-void pl050_char_conn(ipc_call_t *icall, void *arg)
-{
-	pl050_t *pl050 = pl050_from_fun((ddf_fun_t *)arg);
-
-	chardev_conn(icall, &pl050->cds);
-}
-
-/** Add device. */
-static errno_t pl050_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun_a;
-	pl050_t *pl050 = NULL;
-	const char *mname;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pl050_dev_add()");
-
-	pl050 = ddf_dev_data_alloc(dev, sizeof(pl050_t));
-	if (pl050 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pl050->name = (char *)ddf_dev_get_name(dev);
-	if (pl050->name == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun_a = ddf_fun_create(dev, fun_inner, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pl050->fun_a = fun_a;
-	pl050->dev = dev;
-
-	rc = pl050_init(pl050);
-	if (rc != EOK)
-		goto error;
-
-	if (str_cmp(pl050->name, "kbd") == 0)
-		mname = "char/atkbd";
-	else
-		mname = "char/ps2mouse";
-
-	rc = ddf_fun_add_match_id(fun_a, mname, 10);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    "char/xtkbd");
-		goto error;
-	}
-
-	chardev_srvs_init(&pl050->cds);
-	pl050->cds.ops = &pl050_chardev_ops;
-	pl050->cds.sarg = pl050;
-
-	ddf_fun_set_conn_handler(fun_a, pl050_char_conn);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
-		ddf_fun_destroy(fun_a);
-		goto error;
-	}
-
-	ddf_msg(LVL_DEBUG, "Device added.");
-	return EOK;
-error:
-	if (pl050 != NULL)
-		free(pl050->name);
-	return rc;
-}
-
-static errno_t pl050_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pl050_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t pl050_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "pl050_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS pl050 serial device driver\n");
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Error connecting logging service.");
-		return 1;
-	}
-
-	return ddf_driver_main(&pl050_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/pl050/pl050.ma
===================================================================
--- uspace/drv/char/pl050/pl050.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 arm/pl050
Index: pace/drv/char/pl050/pl050_hw.h
===================================================================
--- uspace/drv/char/pl050/pl050_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2009 Vineeth Pillai
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup pl050
- * @{
- */
-/** @file ARM PrimeCell PS2 Keyboard/Mouse Interface (PL050) registers
- */
-
-#ifndef PL050_HW_H
-#define PL050_HW_H
-
-#include <stdint.h>
-
-typedef struct {
-	/** Control register */
-	uint8_t cr;
-	/** Padding */
-	uint8_t pad1[3];
-	/** Status register */
-	uint8_t stat;
-	/** Padding */
-	uint8_t pad5[3];
-	/** Received data */
-	uint8_t data;
-	/** Padding */
-	uint8_t pad9[3];
-	/** Clock divisor */
-	uint8_t clkdiv;
-	/** Padding */
-	uint8_t pad13[3];
-	/** Interrupt status register */
-	uint8_t ir;
-	/** Padding */
-	uint8_t pad17[3];
-} kmi_regs_t;
-
-typedef enum {
-	/** 0 = PS2 mode, 1 = No line control bit mode */
-	kmi_cr_type = 5,
-	/** Enable receiver interrupt */
-	kmi_cr_rxintr = 4,
-	/** Enable transmitter interrupt */
-	kmi_cr_txintr = 3,
-	/** Enable PrimeCell KMI */
-	kmi_cr_enable = 2,
-	/** Force KMI data LOW */
-	kmi_cr_forcedata = 1,
-	/** Force KMI clock LOW */
-	kmi_cr_forceclock = 0
-} kmi_cr_bits_t;
-
-typedef enum {
-	kmi_stat_txempty = 6,
-	kmi_stat_txbusy = 5,
-	kmi_stat_rxfull = 4,
-	kmi_stat_rxbusy = 3,
-	kmi_stat_rxparity = 2,
-	kmi_stat_clkin = 1,
-	kmi_stat_datain = 0
-} kmi_stat_bits_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/ski-con/doc/doxygroups.h
===================================================================
--- uspace/drv/char/ski-con/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_ski_con ski-con
- * @brief Ski console driver
- * @ingroup drvs
- */
Index: pace/drv/char/ski-con/main.c
===================================================================
--- uspace/drv/char/ski-con/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_ski_con
- * @{
- */
-/** @file Ski console driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "ski-con.h"
-
-#define NAME  "ski-con"
-
-static errno_t ski_con_dev_add(ddf_dev_t *dev);
-static errno_t ski_con_dev_remove(ddf_dev_t *dev);
-static errno_t ski_con_dev_gone(ddf_dev_t *dev);
-static errno_t ski_con_fun_online(ddf_fun_t *fun);
-static errno_t ski_con_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = ski_con_dev_add,
-	.dev_remove = ski_con_dev_remove,
-	.dev_gone = ski_con_dev_gone,
-	.fun_online = ski_con_fun_online,
-	.fun_offline = ski_con_fun_offline
-};
-
-static driver_t ski_con_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t ski_con_dev_add(ddf_dev_t *dev)
-{
-	ski_con_t *ski_con;
-
-	ddf_msg(LVL_DEBUG, "ski_con_dev_add(%p)", dev);
-	ski_con = ddf_dev_data_alloc(dev, sizeof(ski_con_t));
-	if (ski_con == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	ski_con->dev = dev;
-
-	return ski_con_add(ski_con);
-}
-
-static errno_t ski_con_dev_remove(ddf_dev_t *dev)
-{
-	ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "ski_con_dev_remove(%p)", dev);
-
-	return ski_con_remove(ski_con);
-}
-
-static errno_t ski_con_dev_gone(ddf_dev_t *dev)
-{
-	ski_con_t *ski_con = (ski_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "ski_con_dev_gone(%p)", dev);
-
-	return ski_con_gone(ski_con);
-}
-
-static errno_t ski_con_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "ski_con_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t ski_con_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "ski_con_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": Ski console driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&ski_con_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/ski-con/meson.build
===================================================================
--- uspace/drv/char/ski-con/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'ski-con.c')
Index: pace/drv/char/ski-con/ski-con.c
===================================================================
--- uspace/drv/char/ski-con/ski-con.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,318 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Ski console driver.
- */
-
-#include <as.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <fibril.h>
-#include <io/chardev.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <sysinfo.h>
-
-#include "ski-con.h"
-
-#define SKI_GETCHAR		21
-#define SKI_PUTCHAR		31
-
-#define POLL_INTERVAL		10000
-
-static errno_t ski_con_fibril(void *arg);
-static int32_t ski_con_getchar(void);
-static void ski_con_connection(ipc_call_t *, void *);
-
-static errno_t ski_con_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t ski_con_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t ski_con_chardev_ops = {
-	.read = ski_con_read,
-	.write = ski_con_write
-};
-
-static void ski_con_putchar(ski_con_t *con, char ch); /* XXX */
-
-/** Add ski console device. */
-errno_t ski_con_add(ski_con_t *con)
-{
-	fid_t fid;
-	ddf_fun_t *fun = NULL;
-	bool bound = false;
-	uintptr_t faddr;
-	void *addr = AS_AREA_ANY;
-	errno_t rc;
-
-	circ_buf_init(&con->cbuf, con->buf, ski_con_buf_size, 1);
-	fibril_mutex_initialize(&con->buf_lock);
-	fibril_condvar_initialize(&con->buf_cv);
-
-	fun = ddf_fun_create(con->dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun, ski_con_connection);
-
-	chardev_srvs_init(&con->cds);
-	con->cds.ops = &ski_con_chardev_ops;
-	con->cds.sarg = con;
-
-	rc = sysinfo_get_value("ski.paddr", &faddr);
-	if (rc != EOK)
-		faddr = 0; /* No kernel driver to arbitrate with */
-
-	if (faddr != 0) {
-		addr = AS_AREA_ANY;
-		rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE,
-		    &addr);
-		if (rc != EOK) {
-			ddf_msg(LVL_ERROR, "Cannot map kernel driver arbitration area.");
-			goto error;
-		}
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "console");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function 'a' to category "
-		    "'console'.");
-		goto error;
-	}
-
-	fid = fibril_create(ski_con_fibril, con);
-	if (fid == 0) {
-		ddf_msg(LVL_ERROR, "Error creating fibril.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_add_ready(fid);
-	return EOK;
-error:
-	if (addr != AS_AREA_ANY)
-		as_area_destroy(addr);
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-
-	return rc;
-}
-
-/** Remove ski console device */
-errno_t ski_con_remove(ski_con_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Ski console device gone */
-errno_t ski_con_gone(ski_con_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Detect if SKI console is in use by the kernel.
- *
- * This is needed since the kernel has no way of fencing off the user-space
- * driver.
- *
- * @return @c true if in use by the kernel.
- */
-static bool ski_con_disabled(void)
-{
-	sysarg_t kconsole;
-
-	/*
-	 * XXX Ideally we should get information from our kernel counterpart
-	 * driver. But there needs to be a mechanism for the kernel console
-	 * to inform the kernel driver.
-	 */
-	if (sysinfo_get_value("kconsole", &kconsole) != EOK)
-		return false;
-
-	return kconsole != false;
-}
-
-/** Poll Ski for keypresses. */
-static errno_t ski_con_fibril(void *arg)
-{
-	int32_t c;
-	ski_con_t *con = (ski_con_t *) arg;
-	errno_t rc;
-
-	while (true) {
-		while (!ski_con_disabled()) {
-			c = ski_con_getchar();
-			if (c == 0)
-				break;
-
-			fibril_mutex_lock(&con->buf_lock);
-
-			rc = circ_buf_push(&con->cbuf, &c);
-			if (rc != EOK)
-				ddf_msg(LVL_ERROR, "Buffer overrun");
-
-			fibril_mutex_unlock(&con->buf_lock);
-			fibril_condvar_broadcast(&con->buf_cv);
-		}
-
-		fibril_usleep(POLL_INTERVAL);
-	}
-
-	return 0;
-}
-
-/** Ask Ski if a key was pressed.
- *
- * Use SSC (Simulator System Call) to get character from the debug console.
- * This call is non-blocking.
- *
- * @return ASCII code of pressed key or 0 if no key pressed.
- */
-static int32_t ski_con_getchar(void)
-{
-	uint64_t ch;
-
-#ifdef UARCH_ia64
-	asm volatile (
-	    "mov r15 = %1\n"
-	    "break 0x80000;;\n"	/* modifies r8 */
-	    "mov %0 = r8;;\n"
-
-	    : "=r" (ch)
-	    : "i" (SKI_GETCHAR)
-	    : "r15", "r8"
-	);
-#else
-	ch = 0;
-#endif
-	return (int32_t) ch;
-}
-
-/** Display character on ski debug console
- *
- * Use SSC (Simulator System Call) to
- * display character on debug console.
- *
- * @param c Character to be printed.
- *
- */
-static void ski_con_putchar(ski_con_t *con, char ch)
-{
-	if (ch == '\n')
-		ski_con_putchar(con, '\r');
-
-#ifdef UARCH_ia64
-	asm volatile (
-	    "mov r15 = %0\n"
-	    "mov r32 = %1\n"   /* r32 is in0 */
-	    "break 0x80000\n"  /* modifies r8 */
-	    :
-	    : "i" (SKI_PUTCHAR), "r" (ch)
-	    : "r15", "in0", "r8"
-	);
-#else
-	(void) ch;
-#endif
-}
-
-/** Read from Ski console device */
-static errno_t ski_con_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	ski_con_t *con = (ski_con_t *) srv->srvs->sarg;
-	size_t p;
-	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	fibril_mutex_lock(&con->buf_lock);
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    circ_buf_nused(&con->cbuf) == 0)
-		fibril_condvar_wait(&con->buf_cv, &con->buf_lock);
-
-	p = 0;
-	while (p < size) {
-		rc = circ_buf_pop(&con->cbuf, &bp[p]);
-		if (rc != EOK)
-			break;
-		++p;
-	}
-
-	fibril_mutex_unlock(&con->buf_lock);
-
-	*nread = p;
-	return EOK;
-}
-
-/** Write to Ski console device */
-static errno_t ski_con_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	ski_con_t *con = (ski_con_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	if (!ski_con_disabled()) {
-		for (i = 0; i < size; i++) {
-			ski_con_putchar(con, dp[i]);
-		}
-	}
-
-	*nwr = size;
-	return EOK;
-}
-
-/** Character device connection handler. */
-static void ski_con_connection(ipc_call_t *icall, void *arg)
-{
-	ski_con_t *con = (ski_con_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	chardev_conn(icall, &con->cds);
-}
-
-/** @}
- */
Index: pace/drv/char/ski-con/ski-con.h
===================================================================
--- uspace/drv/char/ski-con/ski-con.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_ski_con
- * @{
- */
-/** @file
- */
-
-#ifndef SKI_CON_H
-#define SKI_CON_H
-
-#include <adt/circ_buf.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <io/chardev_srv.h>
-#include <loc.h>
-#include <stdint.h>
-
-enum {
-	ski_con_buf_size = 64
-};
-
-/** Ski console */
-typedef struct {
-	async_sess_t *client_sess;
-	ddf_dev_t *dev;
-	chardev_srvs_t cds;
-	circ_buf_t cbuf;
-	uint8_t buf[ski_con_buf_size];
-	fibril_mutex_t buf_lock;
-	fibril_condvar_t buf_cv;
-	/** Memory area mapped to arbitrate with the kernel driver */
-	void *mem_area;
-} ski_con_t;
-
-extern errno_t ski_con_add(ski_con_t *);
-extern errno_t ski_con_remove(ski_con_t *);
-extern errno_t ski_con_gone(ski_con_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/ski-con/ski-con.ma
===================================================================
--- uspace/drv/char/ski-con/ski-con.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 ski/console
Index: pace/drv/char/sun4v-con/doc/doxygroups.h
===================================================================
--- uspace/drv/char/sun4v-con/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_sun4v_con sun4v-con
- * @brief sun4v console driver⏎
- * @ingroup drvs
- */
Index: pace/drv/char/sun4v-con/main.c
===================================================================
--- uspace/drv/char/sun4v-con/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup uspace_drv_sun4v_con
- * @file Sun4v console driver
- * @{
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "sun4v-con.h"
-
-#define NAME  "sun4v-con"
-
-static errno_t sun4v_con_dev_add(ddf_dev_t *dev);
-static errno_t sun4v_con_dev_remove(ddf_dev_t *dev);
-static errno_t sun4v_con_dev_gone(ddf_dev_t *dev);
-static errno_t sun4v_con_fun_online(ddf_fun_t *fun);
-static errno_t sun4v_con_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = sun4v_con_dev_add,
-	.dev_remove = sun4v_con_dev_remove,
-	.dev_gone = sun4v_con_dev_gone,
-	.fun_online = sun4v_con_fun_online,
-	.fun_offline = sun4v_con_fun_offline
-};
-
-static driver_t sun4v_con_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t sun4v_con_get_res(ddf_dev_t *dev, sun4v_con_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 2) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->in_base = RNGABS(hw_res.mem_ranges.ranges[0]);
-	res->out_base = RNGABS(hw_res.mem_ranges.ranges[1]);
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t sun4v_con_dev_add(ddf_dev_t *dev)
-{
-	sun4v_con_t *sun4v_con;
-	sun4v_con_res_t res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "sun4v_con_dev_add(%p)", dev);
-	sun4v_con = ddf_dev_data_alloc(dev, sizeof(sun4v_con_t));
-	if (sun4v_con == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	sun4v_con->dev = dev;
-
-	rc = sun4v_con_get_res(dev, &res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return sun4v_con_add(sun4v_con, &res);
-}
-
-static errno_t sun4v_con_dev_remove(ddf_dev_t *dev)
-{
-	sun4v_con_t *sun4v_con = (sun4v_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "sun4v_con_dev_remove(%p)", dev);
-
-	return sun4v_con_remove(sun4v_con);
-}
-
-static errno_t sun4v_con_dev_gone(ddf_dev_t *dev)
-{
-	sun4v_con_t *sun4v_con = (sun4v_con_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "sun4v_con_dev_gone(%p)", dev);
-
-	return sun4v_con_gone(sun4v_con);
-}
-
-static errno_t sun4v_con_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "sun4v_con_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t sun4v_con_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "sun4v_con_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": Sun4v console driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&sun4v_con_driver);
-}
-
-/** @}
- */
Index: pace/drv/char/sun4v-con/meson.build
===================================================================
--- uspace/drv/char/sun4v-con/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'sun4v-con.c')
Index: pace/drv/char/sun4v-con/niagara_buf.h
===================================================================
--- uspace/drv/char/sun4v-con/niagara_buf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../kernel/arch/sparc64/include/arch/drivers/niagara_buf.h
Index: pace/drv/char/sun4v-con/sun4v-con.c
===================================================================
--- uspace/drv/char/sun4v-con/sun4v-con.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/*
- * Copyright (c) 2008 Pavel Rimsky
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file Sun4v console driver
- */
-
-#include <as.h>
-#include <async.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/chardev_srv.h>
-#include <stdbool.h>
-
-#include "sun4v-con.h"
-
-static void sun4v_con_connection(ipc_call_t *, void *);
-
-#define POLL_INTERVAL  10000
-
-static errno_t sun4v_con_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t sun4v_con_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t sun4v_con_chardev_ops = {
-	.read = sun4v_con_read,
-	.write = sun4v_con_write
-};
-
-static void sun4v_con_putchar(sun4v_con_t *con, uint8_t data)
-{
-	if (data == '\n')
-		sun4v_con_putchar(con, '\r');
-
-	while (con->output_buffer->write_ptr ==
-	    (con->output_buffer->read_ptr + OUTPUT_BUFFER_SIZE - 1) %
-	    OUTPUT_BUFFER_SIZE)
-		;
-
-	con->output_buffer->data[con->output_buffer->write_ptr] = data;
-	con->output_buffer->write_ptr =
-	    ((con->output_buffer->write_ptr) + 1) % OUTPUT_BUFFER_SIZE;
-}
-
-/** Add sun4v console device. */
-errno_t sun4v_con_add(sun4v_con_t *con, sun4v_con_res_t *res)
-{
-	ddf_fun_t *fun = NULL;
-	errno_t rc;
-	bool bound = false;
-
-	con->res = *res;
-	con->input_buffer = (niagara_input_buffer_t *) AS_AREA_ANY;
-
-	fun = ddf_fun_create(con->dev, fun_exposed, "a");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	chardev_srvs_init(&con->cds);
-	con->cds.ops = &sun4v_con_chardev_ops;
-	con->cds.sarg = con;
-
-	ddf_fun_set_conn_handler(fun, sun4v_con_connection);
-
-	rc = physmem_map(res->in_base, 1, AS_AREA_READ | AS_AREA_WRITE,
-	    (void *) &con->input_buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error mapping memory: %s", str_error_name(rc));
-		goto error;
-	}
-
-	con->output_buffer = (niagara_output_buffer_t *) AS_AREA_ANY;
-
-	rc = physmem_map(res->out_base, 1, AS_AREA_READ | AS_AREA_WRITE,
-	    (void *) &con->output_buffer);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error mapping memory: %s", str_error_name(rc));
-		return rc;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, "console");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function 'a' to category "
-		    "'console'.");
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (con->input_buffer != (niagara_input_buffer_t *) AS_AREA_ANY)
-		physmem_unmap((void *) con->input_buffer);
-
-	if (con->output_buffer != (niagara_output_buffer_t *) AS_AREA_ANY)
-		physmem_unmap((void *) con->output_buffer);
-
-	if (bound)
-		ddf_fun_unbind(fun);
-
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-
-	return rc;
-}
-
-/** Remove sun4v console device */
-errno_t sun4v_con_remove(sun4v_con_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Msim console device gone */
-errno_t sun4v_con_gone(sun4v_con_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Read from Sun4v console device */
-static errno_t sun4v_con_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	sun4v_con_t *con = (sun4v_con_t *) srv->srvs->sarg;
-	size_t p;
-	uint8_t *bp = (uint8_t *) buf;
-	char c;
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    con->input_buffer->read_ptr == con->input_buffer->write_ptr)
-		fibril_usleep(POLL_INTERVAL);
-
-	p = 0;
-	while (p < size && con->input_buffer->read_ptr != con->input_buffer->write_ptr) {
-		c = con->input_buffer->data[con->input_buffer->read_ptr];
-		con->input_buffer->read_ptr =
-		    ((con->input_buffer->read_ptr) + 1) % INPUT_BUFFER_SIZE;
-		bp[p++] = c;
-	}
-
-	*nread = p;
-	return EOK;
-}
-
-/** Write to Sun4v console device */
-static errno_t sun4v_con_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	sun4v_con_t *con = (sun4v_con_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	for (i = 0; i < size; i++)
-		sun4v_con_putchar(con, dp[i]);
-
-	*nwr = size;
-	return EOK;
-}
-
-/** Character device connection handler. */
-static void sun4v_con_connection(ipc_call_t *icall, void *arg)
-{
-	sun4v_con_t *con = (sun4v_con_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	chardev_conn(icall, &con->cds);
-}
-
-/** @}
- */
Index: pace/drv/char/sun4v-con/sun4v-con.h
===================================================================
--- uspace/drv/char/sun4v-con/sun4v-con.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_sun4v_con
- * @{
- */
-/** @file
- */
-
-#ifndef SUN4V_CON_H
-#define SUN4V_CON_H
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <io/chardev_srv.h>
-#include <loc.h>
-#include <stdint.h>
-
-#include "niagara_buf.h"
-
-/** Sun4v console resources */
-typedef struct {
-	uintptr_t in_base;
-	uintptr_t out_base;
-} sun4v_con_res_t;
-
-/** Sun4v console */
-typedef struct {
-	async_sess_t *client_sess;
-	ddf_dev_t *dev;
-	chardev_srvs_t cds;
-	sun4v_con_res_t res;
-	/** Virtual address of the shared input buffer */
-	niagara_input_buffer_t *input_buffer;
-	/** Virtual address of the shared input buffer */
-	niagara_output_buffer_t *output_buffer;
-} sun4v_con_t;
-
-extern errno_t sun4v_con_add(sun4v_con_t *, sun4v_con_res_t *);
-extern errno_t sun4v_con_remove(sun4v_con_t *);
-extern errno_t sun4v_con_gone(sun4v_con_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/char/sun4v-con/sun4v-con.ma
===================================================================
--- uspace/drv/char/sun4v-con/sun4v-con.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 sun4v/console
Index: pace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,573 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x_dispc
- * @{
- */
-/**
- * @file
- */
-
-#include <align.h>
-#include <as.h>
-#include <assert.h>
-#include <errno.h>
-#include <ddev_srv.h>
-#include <ddev/info.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <gfx/color.h>
-#include <io/pixelmap.h>
-
-#include "amdm37x_dispc.h"
-
-#ifndef CONFIG_BFB_BPP
-#define CONFIG_BFB_BPP 24
-#endif
-
-#ifndef CONFIG_BFB_WIDTH
-#define CONFIG_BFB_WIDTH 1024
-#endif
-
-#ifndef CONFIG_BFB_HEIGHT
-#define CONFIG_BFB_HEIGHT 768
-#endif
-
-static errno_t amdm37x_change_mode(amdm37x_dispc_t *, unsigned, unsigned,
-    visual_t);
-
-static errno_t amdm37x_ddev_get_gc(void *, sysarg_t *, sysarg_t *);
-static errno_t amdm37x_ddev_get_info(void *, ddev_info_t *);
-
-static errno_t amdm37x_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t amdm37x_gc_set_color(void *, gfx_color_t *);
-static errno_t amdm37x_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t amdm37x_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t amdm37x_gc_bitmap_destroy(void *);
-static errno_t amdm37x_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t amdm37x_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-ddev_ops_t amdm37x_ddev_ops = {
-	.get_gc = amdm37x_ddev_get_gc,
-	.get_info = amdm37x_ddev_get_info
-};
-
-gfx_context_ops_t amdm37x_gc_ops = {
-	.set_clip_rect = amdm37x_gc_set_clip_rect,
-	.set_color = amdm37x_gc_set_color,
-	.fill_rect = amdm37x_gc_fill_rect,
-	.bitmap_create = amdm37x_gc_bitmap_create,
-	.bitmap_destroy = amdm37x_gc_bitmap_destroy,
-	.bitmap_render = amdm37x_gc_bitmap_render,
-	.bitmap_get_alloc = amdm37x_gc_bitmap_get_alloc
-};
-
-static const struct {
-	unsigned bpp;
-	pixel2visual_t func;
-} pixel2visual_table[] = {
-	[VISUAL_INDIRECT_8] = { .bpp = 1, .func = pixel2bgr_323 },
-	[VISUAL_RGB_5_5_5_LE] = { .bpp = 2, .func = pixel2rgb_555_le },
-	[VISUAL_RGB_5_5_5_BE] = { .bpp = 2, .func = pixel2rgb_555_be },
-	[VISUAL_RGB_5_6_5_LE] = { .bpp = 2, .func = pixel2rgb_565_le },
-	[VISUAL_RGB_5_6_5_BE] = { .bpp = 2, .func = pixel2rgb_565_be },
-	[VISUAL_BGR_8_8_8] = { .bpp = 3, .func = pixel2bgr_888 },
-	[VISUAL_RGB_8_8_8] = { .bpp = 3, .func = pixel2rgb_888 },
-	[VISUAL_BGR_0_8_8_8] = { .bpp = 4, .func = pixel2rgb_0888 },
-	[VISUAL_BGR_8_8_8_0] = { .bpp = 4, .func = pixel2bgr_8880 },
-	[VISUAL_ABGR_8_8_8_8] = { .bpp = 4, .func = pixel2abgr_8888 },
-	[VISUAL_BGRA_8_8_8_8] = { .bpp = 4, .func = pixel2bgra_8888 },
-	[VISUAL_RGB_0_8_8_8] = { .bpp = 4, .func = pixel2rgb_0888 },
-	[VISUAL_RGB_8_8_8_0] = { .bpp = 4, .func = pixel2rgb_8880 },
-	[VISUAL_ARGB_8_8_8_8] = { .bpp = 4, .func = pixel2argb_8888 },
-	[VISUAL_RGBA_8_8_8_8] = { .bpp = 4, .func = pixel2rgba_8888 },
-};
-
-errno_t amdm37x_dispc_init(amdm37x_dispc_t *instance, ddf_fun_t *fun)
-{
-	instance->fun = fun;
-	instance->fb_data = NULL;
-	instance->size = 0;
-
-	/* Default is 24bpp, use config option if available */
-	visual_t visual = VISUAL_BGR_8_8_8;
-	switch (CONFIG_BFB_BPP)	{
-	case 8:
-		visual = VISUAL_INDIRECT_8;
-		break;
-	case 16:
-		visual = VISUAL_RGB_5_6_5_LE;
-		break;
-	case 24:
-		visual = VISUAL_BGR_8_8_8;
-		break;
-	case 32:
-		visual = VISUAL_RGB_8_8_8_0;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	errno_t ret = pio_enable((void *)AMDM37x_DISPC_BASE_ADDRESS,
-	    AMDM37x_DISPC_SIZE, (void **)&instance->regs);
-	if (ret != EOK) {
-		return EIO;
-	}
-
-	ret = amdm37x_change_mode(instance, CONFIG_BFB_WIDTH,
-	    CONFIG_BFB_HEIGHT, visual);
-	if (ret != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t amdm37x_dispc_fini(amdm37x_dispc_t *instance)
-{
-	return EOK;
-}
-
-static errno_t amdm37x_dispc_setup_fb(amdm37x_dispc_regs_t *regs,
-    unsigned x, unsigned y, unsigned bpp, uint32_t pa)
-{
-	assert(regs);
-	/*
-	 * Init sequence for dispc is in chapter 7.6.5.1.4 p. 1810,
-	 * no idea what parts of that work.
-	 */
-
-	/* Disable all interrupts */
-	regs->irqenable = 0;
-
-	/* Pixel format specifics */
-	uint32_t attrib_pixel_format = 0;
-	uint32_t control_data_lanes = 0;
-	switch (bpp) {
-	case 32:
-		attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGBX;
-		control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B;
-		break;
-	case 24:
-		attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB24;
-		control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B;
-		break;
-	case 16:
-		attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB16;
-		control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_16B;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	/* Prepare sizes */
-	const uint32_t size_reg =
-	    (((x - 1) & AMDM37X_DISPC_SIZE_WIDTH_MASK) <<
-	    AMDM37X_DISPC_SIZE_WIDTH_SHIFT) |
-	    (((y - 1) & AMDM37X_DISPC_SIZE_HEIGHT_MASK) <<
-	    AMDM37X_DISPC_SIZE_HEIGHT_SHIFT);
-
-	/* modes taken from u-boot, for 1024x768 */
-	// TODO replace magic values with actual correct values
-#if 0
-	regs->timing_h = 0x1a4024c9;
-	regs->timing_v = 0x02c00509;
-	regs->pol_freq = 0x00007028;
-	regs->divisor  = 0x00010001;
-#endif
-
-	/* setup output */
-	regs->size_lcd = size_reg;
-	regs->size_dig = size_reg;
-
-	/* Nice blue default color */
-	regs->default_color[0] = 0x0000ff;
-	regs->default_color[1] = 0x0000ff;
-
-	/* Setup control register */
-	uint32_t control = 0 |
-	    AMDM37X_DISPC_CONTROL_PCKFREEENABLE_FLAG |
-	    (control_data_lanes << AMDM37X_DISPC_CONTROL_TFTDATALINES_SHIFT) |
-	    AMDM37X_DISPC_CONTROL_GPOUT0_FLAG |
-	    AMDM37X_DISPC_CONTROL_GPOUT1_FLAG;
-	regs->control = control;
-
-	/* No gamma stuff only data */
-	uint32_t config = (AMDM37X_DISPC_CONFIG_LOADMODE_DATAEVERYFRAME <<
-	    AMDM37X_DISPC_CONFIG_LOADMODE_SHIFT);
-	regs->config = config;
-
-	/* Set framebuffer base address */
-	regs->gfx.ba[0] = pa;
-	regs->gfx.ba[1] = pa;
-	regs->gfx.position = 0;
-
-	/* Setup fb size */
-	regs->gfx.size = size_reg;
-
-	/* Set pixel format */
-	uint32_t attribs = 0 |
-	    (attrib_pixel_format << AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_SHIFT);
-	regs->gfx.attributes = attribs;
-
-	/* 0x03ff03c0 is the default */
-	regs->gfx.fifo_threshold = 0x03ff03c0;
-	/*
-	 * This value should be stride - width, 1 means next pixel i.e.
-	 * stride == width
-	 */
-	regs->gfx.row_inc = 1;
-	/* number of bytes to next pixel in BPP multiples */
-	regs->gfx.pixel_inc = 1;
-	/* only used if video is played over fb */
-	regs->gfx.window_skip = 0;
-	/* Gamma and palette table */
-	regs->gfx.table_ba = 0;
-
-	/* enable frame buffer graphics */
-	regs->gfx.attributes |= AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG;
-	/* Update register values */
-	regs->control |= AMDM37X_DISPC_CONTROL_GOLCD_FLAG;
-	regs->control |= AMDM37X_DISPC_CONTROL_GODIGITAL_FLAG;
-	/* Enable output */
-	regs->control |= AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG;
-	regs->control |= AMDM37X_DISPC_CONTROL_DIGITAL_ENABLE_FLAG;
-	return EOK;
-}
-
-static errno_t amdm37x_change_mode(amdm37x_dispc_t *dispc, unsigned x,
-    unsigned y, visual_t visual)
-{
-	assert((size_t)visual < sizeof(pixel2visual_table) / sizeof(pixel2visual_table[0]));
-	const unsigned bpp = pixel2visual_table[visual].bpp;
-	pixel2visual_t p2v = pixel2visual_table[visual].func;
-	ddf_log_note("Setting mode: %ux%ux%u\n", x, y, bpp * 8);
-	const size_t size = ALIGN_UP(x * y * bpp, PAGE_SIZE);
-	uintptr_t pa;
-	void *buffer = AS_AREA_ANY;
-	errno_t ret = dmamem_map_anonymous(size, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &pa, &buffer);
-	if (ret != EOK) {
-		ddf_log_error("Failed to get new FB\n");
-		return ret;
-	}
-	if (dispc->fb_data)
-		dmamem_unmap_anonymous(dispc->fb_data);
-
-	dispc->fb_data = buffer;
-	amdm37x_dispc_setup_fb(dispc->regs, x, y, bpp * 8, (uint32_t)pa);
-	dispc->active_fb.width = x;
-	dispc->active_fb.height = y;
-	dispc->active_fb.pitch = 0;
-	dispc->active_fb.bpp = bpp;
-	dispc->active_fb.pixel2visual = p2v;
-	dispc->rect.p0.x = 0;
-	dispc->rect.p0.y = 0;
-	dispc->rect.p1.x = x;
-	dispc->rect.p1.y = y;
-	dispc->clip_rect = dispc->rect;
-	dispc->size = size;
-
-	return EOK;
-}
-
-#define FB_POS(d, x, y) \
-    (((y) * ((d)->active_fb.width + (d)->active_fb.pitch) + (x)) \
-    * (d)->active_fb.bpp)
-
-static errno_t amdm37x_ddev_get_gc(void *arg, sysarg_t *arg2, sysarg_t *arg3)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-
-	*arg2 = ddf_fun_get_handle(dispc->fun);
-	*arg3 = 42;
-	return EOK;
-}
-
-static errno_t amdm37x_ddev_get_info(void *arg, ddev_info_t *info)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-
-	ddev_info_init(info);
-	info->rect.p0.x = 0;
-	info->rect.p0.y = 0;
-	info->rect.p1.x = dispc->active_fb.width;
-	info->rect.p1.y = dispc->active_fb.height;
-	return EOK;
-}
-
-/** Set clipping rectangle on AMDM37x display controller.
- *
- * @param arg AMDM37x display controller
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-
-	if (rect != NULL)
-		gfx_rect_clip(rect, &dispc->rect, &dispc->clip_rect);
-	else
-		dispc->clip_rect = dispc->rect;
-
-	return EOK;
-}
-
-/** Set color on AMDM37x display controller.
- *
- * Set drawing color on AMDM37x GC.
- *
- * @param arg AMDM37x display controller
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_set_color(void *arg, gfx_color_t *color)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-	uint16_t r, g, b;
-
-	gfx_color_get_rgb_i16(color, &r, &g, &b);
-	dispc->color = PIXEL(0, r >> 8, g >> 8, b >> 8);
-	return EOK;
-}
-
-/** Fill rectangle on AMDM37x display controller.
- *
- * @param arg AMDM37x display controller
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-	gfx_rect_t crect;
-	gfx_coord_t x, y;
-
-	/* Make sure we have a sorted, clipped rectangle */
-	gfx_rect_clip(rect, &dispc->clip_rect, &crect);
-
-	for (y = crect.p0.y; y < crect.p1.y; y++) {
-		for (x = crect.p0.x; x < crect.p1.x; x++) {
-			dispc->active_fb.pixel2visual(dispc->fb_data +
-			    FB_POS(dispc, x, y), dispc->color);
-		}
-	}
-
-	return EOK;
-}
-
-/** Create bitmap in AMDM37x GC.
- *
- * @param arg AMDM37x display controller
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t amdm37x_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	amdm37x_dispc_t *dispc = (amdm37x_dispc_t *) arg;
-	amdm37x_bitmap_t *dcbm = NULL;
-	gfx_coord2_t dim;
-	errno_t rc;
-
-	/* Check that we support all required flags */
-	if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
-		return ENOTSUP;
-
-	dcbm = calloc(1, sizeof(amdm37x_bitmap_t));
-	if (dcbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	dcbm->rect = params->rect;
-	dcbm->flags = params->flags;
-
-	if (alloc == NULL) {
-		dcbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		dcbm->alloc.off0 = 0;
-		dcbm->alloc.pixels = malloc(dcbm->alloc.pitch * dim.y);
-		dcbm->myalloc = true;
-
-		if (dcbm->alloc.pixels == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-	} else {
-		dcbm->alloc = *alloc;
-	}
-
-	dcbm->dispc = dispc;
-	*rbm = (void *)dcbm;
-	return EOK;
-error:
-	if (rbm != NULL)
-		free(dcbm);
-	return rc;
-}
-
-/** Destroy bitmap in AMDM37x GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_bitmap_destroy(void *bm)
-{
-	amdm37x_bitmap_t *dcbm = (amdm37x_bitmap_t *)bm;
-	if (dcbm->myalloc)
-		free(dcbm->alloc.pixels);
-	free(dcbm);
-	return EOK;
-}
-
-/** Render bitmap in AMDM37x GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	amdm37x_bitmap_t *dcbm = (amdm37x_bitmap_t *)bm;
-	amdm37x_dispc_t *dispc = dcbm->dispc;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_rect_t skfbrect;
-	gfx_rect_t crect;
-	gfx_coord2_t offs;
-	gfx_coord2_t bmdim;
-	gfx_coord2_t dim;
-	gfx_coord2_t sp;
-	gfx_coord2_t dp;
-	gfx_coord2_t pos;
-	pixelmap_t pbm;
-	pixel_t color;
-
-	/* Clip source rectangle to bitmap bounds */
-
-	if (srect0 != NULL)
-		gfx_rect_clip(srect0, &dcbm->rect, &srect);
-	else
-		srect = dcbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	/* Destination rectangle */
-	gfx_rect_translate(&offs, &srect, &drect);
-	gfx_coord2_subtract(&drect.p1, &drect.p0, &dim);
-	gfx_coord2_subtract(&dcbm->rect.p1, &dcbm->rect.p0, &bmdim);
-
-	pbm.width = bmdim.x;
-	pbm.height = bmdim.y;
-	pbm.data = dcbm->alloc.pixels;
-
-	/* Transform AMDM37x clipping rectangle back to bitmap coordinate system */
-	gfx_rect_rtranslate(&offs, &dispc->clip_rect, &skfbrect);
-
-	/*
-	 * Make sure we have a sorted source rectangle, clipped so that
-	 * destination lies within AMDM37x bounding rectangle
-	 */
-	gfx_rect_clip(&srect, &skfbrect, &crect);
-
-	if ((dcbm->flags & bmpf_color_key) == 0) {
-		/* Simple copy */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				dispc->active_fb.pixel2visual(dispc->fb_data +
-				    FB_POS(dispc, dp.x, dp.y), color);
-			}
-		}
-	} else if ((dcbm->flags & bmpf_colorize) == 0) {
-		/* Color key */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				if (color != dcbm->key_color) {
-					dispc->active_fb.pixel2visual(dispc->fb_data +
-					    FB_POS(dispc, dp.x, dp.y), color);
-				}
-			}
-		}
-	} else {
-		/* Color key & colorize */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				if (color != dcbm->key_color) {
-					dispc->active_fb.pixel2visual(dispc->fb_data +
-					    FB_POS(dispc, dp.x, dp.y),
-					    dcbm->dispc->color);
-				}
-			}
-		}
-	}
-
-	return EOK;
-}
-
-/** Get allocation info for bitmap in AMDM37x GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t amdm37x_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	amdm37x_bitmap_t *dcbm = (amdm37x_bitmap_t *)bm;
-	*alloc = dcbm->alloc;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/fb/amdm37x_dispc/amdm37x_dispc.h
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x_dispc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef AMDM37X_DISPC_H_
-#define AMDM37X_DISPC_H_
-
-#include <abi/fb/visuals.h>
-#include <ddev_srv.h>
-#include <ddf/driver.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/pixel.h>
-#include <pixconv.h>
-#include <ddi.h>
-
-#include "amdm37x_dispc_regs.h"
-
-typedef struct {
-	ddf_fun_t *fun;
-	amdm37x_dispc_regs_t *regs;
-
-	struct {
-		pixel2visual_t pixel2visual;
-		unsigned width;
-		unsigned height;
-		unsigned pitch;
-		unsigned bpp;
-	} active_fb;
-
-	pixel_t color;
-	gfx_rect_t rect;
-	gfx_rect_t clip_rect;
-	size_t size;
-	void *fb_data;
-} amdm37x_dispc_t;
-
-typedef struct {
-	/* Containing display controller */
-	amdm37x_dispc_t *dispc;
-	/** Allocation info */
-	gfx_bitmap_alloc_t alloc;
-	/** @c true if we allocated the bitmap, @c false if allocated by caller */
-	bool myalloc;
-	/** Rectangle covered by bitmap */
-	gfx_rect_t rect;
-	/** Bitmap flags */
-	gfx_bitmap_flags_t flags;
-	/** Key color */
-	pixel_t key_color;
-} amdm37x_bitmap_t;
-
-extern ddev_ops_t amdm37x_ddev_ops;
-extern gfx_context_ops_t amdm37x_gc_ops;
-
-extern errno_t amdm37x_dispc_init(amdm37x_dispc_t *, ddf_fun_t *);
-extern errno_t amdm37x_dispc_fini(amdm37x_dispc_t *);
-
-#endif
-/** @}
- */
Index: pace/drv/fb/amdm37x_dispc/amdm37x_dispc.ma
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 amdm37x&dispc
Index: pace/drv/fb/amdm37x_dispc/amdm37x_dispc_regs.h
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc_regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,285 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup amdm37x_dispc
- * @{
- */
-/**
- * @file
- * @brief Texas Instruments AM/DM37x SDRAM Memory Scheduler.
- */
-
-#ifndef AMDM37x_DISPC_REGS_H_
-#define AMDM37x_DISPC_REGS_H_
-
-/* AMDM37x TRM p. 1813 */
-#define AMDM37x_DISPC_BASE_ADDRESS 0x48050400
-#define AMDM37x_DISPC_SIZE 1024
-
-#include <macros.h>
-
-typedef struct {
-	const ioport32_t revision;
-#define AMDM37X_DISPC_REVISION_MASK  0xff
-
-	PADD32(3);
-	ioport32_t sysconfig;
-#define AMDM37X_DISPC_SYSCONFIG_AUTOIDLE_FLAG  (1 << 0)
-#define AMDM37X_DISPC_SYSCONFIG_SOFTRESET_FLAG  (1 << 1)
-#define AMDM37X_DISPC_SYSCONFIG_ENWAKEUP_FLAG  (1 << 2)
-#define AMDM37X_DISPC_SYSCONFIG_SIDLEMODE_MASK  0x3
-#define AMDM37X_DISPC_SYSCONFIG_SIDLEMODE_SHIFT  3
-#define AMDM37X_DISPC_SYSCONFIG_CLOCKACTIVITY_MASK  0x3
-#define AMDM37X_DISPC_SYSCONFIG_CLOCKACTIVITY_SHIFT  8
-#define AMDM37X_DISPC_SYSCONFIG_MIDLEMODE_MASK  0x3
-#define AMDM37X_DISPC_SYSCONFIG_MIDLEMODE_SHIFT  12
-
-	const ioport32_t sysstatus;
-#define AMDM37X_DISPC_SYSSTATUS_RESETDONE_FLAG  (1 << 0)
-
-	ioport32_t irqstatus;
-	ioport32_t irqenable;
-#define AMDM37X_DISPC_IRQ_FRAMEDONE_FLAG  (1 << 0)
-#define AMDM37X_DISPC_IRQ_VSYNC_FLAG  (1 << 1)
-#define AMDM37X_DISPC_IRQ_EVSYNCEVEN_FLAG  (1 << 2)
-#define AMDM37X_DISPC_IRQ_EVSYNCODD_FLAG  (1 << 3)
-#define AMDM37X_DISPC_IRQ_ACBIASCOUNTSTATUS_FLAG  (1 << 4)
-#define AMDM37X_DISPC_IRQ_PROGRAMMEDLINENUMBER_FLAG  (1 << 5)
-#define AMDM37X_DISPC_IRQ_GFXFIFOUNDERFLOW_FLAG  (1 << 6)
-#define AMDM37X_DISPC_IRQ_GFXENDWINDOW_FLAG  (1 << 7)
-#define AMDM37X_DISPC_IRQ_PALETTEGAMMALOADING_FLAG  (1 << 8)
-#define AMDM37X_DISPC_IRQ_OPCERROR_FLAG  (1 << 9)
-#define AMDM37X_DISPC_IRQ_VID1FIFOUNDERFLOW_FLAG  (1 << 10)
-#define AMDM37X_DISPC_IRQ_VID1ENDWINDOW_FLAG  (1 << 11)
-#define AMDM37X_DISPC_IRQ_VID2FIFOUNDERFLOW_FLAG  (1 << 12)
-#define AMDM37X_DISPC_IRQ_VID2ENDWINDOW_FLAG  (1 << 13)
-#define AMDM37X_DISPC_IRQ_SYNCLOST_FLAG  (1 << 14)
-#define AMDM37X_DISPC_IRQ_SYNCLOSTDIGITAL_FLAG  (1 << 15)
-#define AMDM37X_DISPC_IRQ_WAKEUP_FLAG  (1 << 16)
-
-	PADD32(8);
-	ioport32_t control;
-#define AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG  (1 << 0)
-#define AMDM37X_DISPC_CONTROL_DIGITAL_ENABLE_FLAG  (1 << 1)
-#define AMDM37X_DISPC_CONTROL_MONOCOLOR_FLAG  (1 << 2)
-#define AMDM37X_DISPC_CONTROL_STNTFT_FLAG  (1 << 3)
-#define AMDM37X_DISPC_CONTROL_M8B_FLAG  (1 << 4)
-#define AMDM37X_DISPC_CONTROL_GOLCD_FLAG  (1 << 5)
-#define AMDM37X_DISPC_CONTROL_GODIGITAL_FLAG  (1 << 6)
-#define AMDM37X_DISPC_CONTROL_STDITHERENABLE_FLAG  (1 << 7)
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_MASK  0x3
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_SHIFT  8
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_12B  0
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_16B  1
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_18B  2
-#define AMDM37X_DISPC_CONTROL_TFTDATALINES_24B  3
-#define AMDM37X_DISPC_CONTROL_STALLMODE_FLAG  (1 << 11)
-#define AMDM37X_DISPC_CONTROL_OVERLAYOPTIMIZATION_FLAG  (1 << 12)
-#define AMDM37X_DISPC_CONTROL_GPIN0_FLAG  (1 << 13)
-#define AMDM37X_DISPC_CONTROL_GPIN1_FLAG  (1 << 14)
-#define AMDM37X_DISPC_CONTROL_GPOUT0_FLAG  (1 << 15)
-#define AMDM37X_DISPC_CONTROL_GPOUT1_FLAG  (1 << 16)
-#define AMDM37X_DISPC_CONTROL_HT_MASK  0x7
-#define AMDM37X_DISPC_CONTROL_HT_SHIFT  17
-#define AMDM37X_DISPC_CONTROL_TDMENABLE_FLAG  (1 << 20)
-#define AMDM37X_DISPC_CONTROL_TDMPARALLELMODE_MASK  0x3
-#define AMDM37X_DISPC_CONTROL_TDMPARELLELMODE_SHIFT  21
-#define AMDM37X_DISPC_CONTROL_TDMCYCLEFORMAT_MASK  0x3
-#define AMDM37X_DISPC_CONTROL_TDMCYCLEFORMAT_SHIFT  23
-#define AMDM37X_DISPC_CONTROL_TDMUNUSEDBITS_MASK  0x3
-#define AMDM37X_DISPC_CONTROL_TDMUNUSEDBITS_SHIFT  25
-#define AMDM37X_DISPC_CONTROL_PCKFREEENABLE_FLAG  (1 << 27)
-#define AMDM37X_DISPC_CONTROL_LCDENABLESIGNAL_FLAG  (1 << 28)
-#define AMDM37X_DISPC_CONTROL_KCDENABLEPOL_FLAG  (1 << 29)
-#define AMDM37X_DISPC_CONTROL_SPATIALTEMPORALDITHERINGFRAMES_MASK  0x3
-#define AMDM37X_DISPC_CONTROL_SPATIALTEMPORALDITHERINGFRAMES_SHIFT  30
-
-	ioport32_t config;
-#define AMDM37X_DISPC_CONFIG_PIXELGATED_FLAG  (1 << 0)
-#define AMDM37X_DISPC_CONFIG_LOADMODE_MASK  0x3
-#define AMDM37X_DISPC_CONFIG_LOADMODE_SHIFT  1
-#define AMDM37X_DISPC_CONFIG_LOADMODE_PGDATAEVERYFRAME  0x0
-#define AMDM37X_DISPC_CONFIG_LOADMODE_PGUSER  0x1
-#define AMDM37X_DISPC_CONFIG_LOADMODE_DATAEVERYFRAME  0x2
-#define AMDM37X_DISPC_CONFIG_LOADMODE_PGDFIRSTFRAME  0x3
-#define AMDM37X_DISPC_CONFIG_PALETTEGAMMATABLE_FLAG  (1 << 3)
-#define AMDM37X_DISPC_CONFIG_PIXELDATAGATED_FLAG  (1 << 4)
-#define AMDM37X_DISPC_CONFIG_PIXELCLOCKGATED_FLAG  (1 << 5)
-#define AMDM37X_DISPC_CONFIG_HSYNCGATED_FLAG  (1 << 6)
-#define AMDM37X_DISPC_CONFIG_VSYNCGATED_FLAG  (1 << 7)
-#define AMDM37X_DISPC_CONFIG_ACBIASGATED_FLAG  (1 << 8)
-#define AMDM37X_DISPC_CONFIG_FUNCGATED_FLAG  (1 << 9)
-#define AMDM37X_DISPC_CONFIG_TCKLCDENABLE_FLAG  (1 << 10)
-#define AMDM37X_DISPC_CONFIG_TCKLCDSELECTION_FLAG  (1 << 11)
-#define AMDM37X_DISPC_CONFIG_TCKDIGENABLE_FLAG  (1 << 12)
-#define AMDM37X_DISPC_CONFIG_TCKDIGSELECTION_FLAG  (1 << 13)
-#define AMDM37X_DISPC_CONFIG_FIFOMERGE_FLAG  (1 << 14)
-#define AMDM37X_DISPC_CONFIG_CPR_FLAG  (1 << 15)
-#define AMDM37X_DISPC_CONFIG_FIFOHANDCHECK_FLAG  (1 << 16)
-#define AMDM37X_DISPC_CONFIG_FIFOFILLING_FLAG  (1 << 17)
-#define AMDM37X_DISPC_CONFIG_LCDPALPHABLENDERENABLDE_FLAG  (1 << 18)
-#define AMDM37X_DISPC_CONFIG_TVALPHABLENDERENABLE_FLAG  (1 << 19)
-
-	PADD32(1);
-	ioport32_t default_color[2];
-	ioport32_t trans_color[2];
-#define AMDM37X_DISPC_COLOR_MASK 0xffffff
-
-	const ioport32_t line_status;
-	ioport32_t line_number;
-#define AMDM37X_DISPC_LINE_NUMBER_MASK 0x3ff
-
-	ioport32_t timing_h;
-#define AMDM37X_DISPC_TIMING_H_HSW_MASK 0xff
-#define AMDM37X_DISPC_TIMING_H_HSW_SHIFT 0
-#define AMDM37X_DISPC_TIMING_H_HFP_MASK 0xfff
-#define AMDM37X_DISPC_TIMING_H_HFP_SHIFT 8
-#define AMDM37X_DISPC_TIMING_H_HBP_MASK 0xfff
-#define AMDM37X_DISPC_TIMING_H_HBP_SHIFT 20
-
-	ioport32_t timing_v;
-#define AMDM37X_DISPC_TIMING_V_VSW_MASK 0xff
-#define AMDM37X_DISPC_TIMING_V_VSW_SHIFT 0
-#define AMDM37X_DISPC_TIMING_V_VFP_MASK 0xfff
-#define AMDM37X_DISPC_TIMING_V_VFP_SHIFT 8
-#define AMDM37X_DISPC_TIMING_V_VBP_MASK 0xfff
-#define AMDM37X_DISPC_TIMING_V_VBP_SHIFT 20
-
-	ioport32_t pol_freq;
-#define AMDM37X_DISPC_POL_FREQ_ACB_MASK  0xff
-#define AMDM37X_DISPC_POL_FREQ_ACB_SHIFT 0
-#define AMDM37X_DISPC_POL_FREQ_ACBI_MASK  0xf
-#define AMDM37X_DISPC_POL_FREQ_ACBI_SHIFT 8
-#define AMDM37X_DISPC_POL_FREQ_IVS_FLAG  (1 << 12)
-#define AMDM37X_DISPC_POL_FREQ_IHS_FLAG  (1 << 13)
-#define AMDM37X_DISPC_POL_FREQ_IPC_FLAG  (1 << 14)
-#define AMDM37X_DISPC_POL_FREQ_IEO_FLAG  (1 << 15)
-#define AMDM37X_DISPC_POL_FREQ_RF_FLAG  (1 << 16)
-#define AMDM37X_DISPC_POL_FREQ_ONOFF_FLAG  (1 << 17)
-
-	ioport32_t divisor;
-#define AMDM37X_DISPC_DIVISOR_PCD_MASK  0xff
-#define AMDM37X_DISPC_DIVISOR_PCD_SHIFT  0
-#define AMDM37X_DISPC_DIVISOR_LCD_MASK  0xff
-#define AMDM37X_DISPC_DIVISOR_LCD_SHIFT  16
-
-	ioport32_t global_alpha;
-#define AMDM37X_DISPC_GLOBAL_ALPHA_GFXGLOBALALPHA_MASK  0xff
-#define AMDM37X_DISPC_GLOBAL_ALPHA_GFXGLOBALALPHA_SHIFT  0
-#define AMDM37X_DISPC_GLOBAL_ALPHA_VID2GLOBALALPHA_MASK  0xff
-#define AMDM37X_DISPC_GLOBAL_ALPHA_VID2GLOBALALPHA_SHIFT  16
-
-	ioport32_t size_dig;
-	ioport32_t size_lcd;
-
-	struct {
-		ioport32_t ba[2];
-		ioport32_t position;
-#define AMDM37X_DISPC_GFX_POSITION_GFXPOSX_MASK  0x7ff
-#define AMDM37X_DISPC_GFX_POSITION_GFXPOSX_SHIFT  0
-#define AMDM37X_DISPC_GFX_POSITION_GFXPOSY_MASK  0x7ff
-#define AMDM37X_DISPC_GFX_POSITION_GFXPOSY_SHIFT  16
-
-		ioport32_t size;
-#define AMDM37X_DISPC_SIZE_WIDTH_MASK  0x7ff
-#define AMDM37X_DISPC_SIZE_WIDTH_SHIFT  0
-#define AMDM37X_DISPC_SIZE_HEIGHT_MASK  0x7ff
-#define AMDM37X_DISPC_SIZE_HEIGHT_SHIFT  16
-
-		PADD32(4);
-		ioport32_t attributes;
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG  (1 << 0)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_MASK  0xf
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_SHIFT  1
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_ARGB16  0x5
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB16  0x6
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB24_32  0x8
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB24  0x9
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_ARGB  0xc
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGBA  0xd
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGBX  0xe
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_REPLICATIONENABLE_FLAG  (1 << 5)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXBURSTSIZE_MASK  0x3
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXBURSTSIZE_SHIFT  6
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXCHANNELOUT_FLAG  (1 << 8)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXNIBBLEMODE_FLAG  (1 << 9)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXENDIANNES_FLAG  (1 << 10)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXFIFOPRELOAD_FLAG  (1 << 11)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXROTATION_MASK  0x3
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXROTATION_SHIFT  12
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXARBITRATION_FLAG  (1 << 14)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_GFXSELFREFRESH_FLAG  (1 << 15)
-#define AMDM37X_DISPC_GFX_ATTRIBUTES_PREMULTIALPHA_FLAG  (1 << 28)
-
-		ioport32_t fifo_threshold;
-		const ioport32_t fifo_size_status;
-		ioport32_t row_inc;
-		ioport32_t pixel_inc;
-		ioport32_t window_skip;
-		ioport32_t table_ba;
-	} gfx;
-
-	struct {
-		ioport32_t ba[2];
-		ioport32_t position;
-		ioport32_t size;
-		ioport32_t attributes;
-		ioport32_t fifo_threshold;
-		const ioport32_t fifo_size_status;
-		ioport32_t row_inc;
-		ioport32_t pixel_inc;
-		ioport32_t fir;
-		ioport32_t picture_size;
-		ioport32_t accui[2];
-		struct {
-			ioport32_t hi;
-			ioport32_t hvi;
-		} fir_coef[8];
-		ioport32_t conv_coef[5];
-		PADD32(2);
-	} vid[2];
-	/* 0x1d4 */
-	ioport32_t data_cycle[3];
-	/* 0x1e0 */
-	ioport32_t vid_fir_coef_v[8];
-	/* 0x200 */
-	PADD32(8);
-	/* 0x220 */
-	ioport32_t cpr_coef_r;
-	ioport32_t cpr_coef_g;
-	ioport32_t cpr_coef_b;
-	ioport32_t gfx_preload;
-
-	/* 0x230 */
-	ioport32_t vid_preload[2];
-
-} amdm37x_dispc_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/fb/amdm37x_dispc/doc/doxygroups.h
===================================================================
--- uspace/drv/fb/amdm37x_dispc/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup amdm37x_dispc amdm37x_dispc
- * @brief TI AM/DM37x framebuffer driver
- * @ingroup drvs
- */
Index: pace/drv/fb/amdm37x_dispc/main.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x_dispc
- * @{
- */
-/**
- * @file
- */
-
-#include <ddev_srv.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <ipcgfx/server.h>
-#include <str_error.h>
-#include <stdio.h>
-
-#include "amdm37x_dispc.h"
-
-#define NAME  "amdm37x_dispc"
-
-static void amdm37x_client_conn(ipc_call_t *icall, void *arg)
-{
-	amdm37x_dispc_t *dispc;
-	ddev_srv_t srv;
-	sysarg_t gc_id;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	dispc = (amdm37x_dispc_t *) ddf_dev_data_get(
-	    ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	gc_id = ipc_get_arg3(icall);
-
-	if (gc_id == 0) {
-		/* Set up protocol structure */
-		ddev_srv_initialize(&srv);
-		srv.ops = &amdm37x_ddev_ops;
-		srv.arg = dispc;
-
-		/* Handle connection */
-		ddev_conn(icall, &srv);
-	} else {
-		assert(gc_id == 42);
-
-		rc = gfx_context_new(&amdm37x_gc_ops, dispc, &gc);
-		if (rc != EOK)
-			goto error;
-
-		/* GC connection */
-		gc_conn(icall, gc);
-	}
-
-	return;
-error:
-	async_answer_0(icall, rc);
-}
-
-static errno_t amdm37x_dispc_dev_add(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "a");
-	if (!fun) {
-		ddf_log_error("Failed to create display device function.");
-		return ENOMEM;
-	}
-
-	ddf_fun_set_conn_handler(fun, &amdm37x_client_conn);
-
-	/* Hw part */
-	amdm37x_dispc_t *dispc =
-	    ddf_dev_data_alloc(dev, sizeof(amdm37x_dispc_t));
-	if (!dispc) {
-		ddf_log_error("Failed to allocate dispc structure.");
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	errno_t rc = amdm37x_dispc_init(dispc, fun);
-	if (rc != EOK) {
-		ddf_log_error("Failed to init dispc: %s.", str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	/* Bind function */
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_log_error("Failed to bind function: %s.", str_error(rc));
-		amdm37x_dispc_fini(dispc);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun, "display-device");
-	if (rc != EOK) {
-		ddf_log_error("Failed to add function: %s to display device "
-		    "category.", str_error(rc));
-		amdm37x_dispc_fini(dispc);
-		ddf_fun_unbind(fun);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	ddf_log_note("Added device `%s'", ddf_dev_get_name(dev));
-	return EOK;
-}
-
-static driver_ops_t amdm37x_dispc_driver_ops = {
-	.dev_add = amdm37x_dispc_dev_add,
-};
-
-static driver_t amdm37x_dispc_driver = {
-	.name = NAME,
-	.driver_ops = &amdm37x_dispc_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS AM/DM37x framebuffer driver\n", NAME);
-	ddf_log_init(NAME);
-	return ddf_driver_main(&amdm37x_dispc_driver);
-}
-
-/** @}
- */
Index: pace/drv/fb/amdm37x_dispc/meson.build
===================================================================
--- uspace/drv/fb/amdm37x_dispc/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'ipcgfx', 'ddev', 'pixconv' ]
-src = files('amdm37x_dispc.c', 'main.c')
Index: pace/drv/fb/kfb/doc/doxygroups.h
===================================================================
--- uspace/drv/fb/kfb/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup kfb kfb
- * @brief Driver for the kernel-provided framebuffer
- * @ingroup drvs
- */
Index: pace/drv/fb/kfb/kfb.c
===================================================================
--- uspace/drv/fb/kfb/kfb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kfb
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include "port.h"
-#include "kfb.h"
-
-static errno_t kgraph_dev_add(ddf_dev_t *dev)
-{
-	port_init(dev);
-	printf("%s: Accepting connections\n", NAME);
-	return EOK;
-}
-
-static driver_ops_t kgraph_driver_ops = {
-	.dev_add = kgraph_dev_add,
-};
-
-static driver_t kgraph_driver = {
-	.name = NAME,
-	.driver_ops = &kgraph_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS kernel framebuffer driver\n", NAME);
-	return ddf_driver_main(&kgraph_driver);
-}
-
-/** @}
- */
Index: pace/drv/fb/kfb/kfb.h
===================================================================
--- uspace/drv/fb/kfb/kfb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kfb
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KFB_KFB_H_
-#define KFB_KFB_H_
-
-#include <ddf/driver.h>
-
-#define NAME  "kfb"
-
-#endif
-
-/** @}
- */
Index: pace/drv/fb/kfb/kfb.ma
===================================================================
--- uspace/drv/fb/kfb/kfb.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 virtual&kfb
Index: pace/drv/fb/kfb/meson.build
===================================================================
--- uspace/drv/fb/kfb/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'ipcgfx', 'ddev', 'pixconv' ]
-src = files('port.c', 'kfb.c')
Index: pace/drv/fb/kfb/port.c
===================================================================
--- uspace/drv/fb/kfb/port.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,618 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2006 Jakub Vana
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kfb
- * @{
- */
-/**
- * @file
- */
-
-#include <abi/fb/visuals.h>
-#include <adt/list.h>
-#include <align.h>
-#include <as.h>
-#include <ddev_srv.h>
-#include <ddev/info.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <io/pixelmap.h>
-#include <ipcgfx/server.h>
-#include <mem.h>
-#include <pixconv.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sysinfo.h>
-
-#include "kfb.h"
-#include "port.h"
-
-#define FB_POS(fb, x, y)  ((y) * (fb)->scanline + (x) * (fb)->pixel_bytes)
-
-typedef struct {
-	ddf_fun_t *fun;
-
-	sysarg_t paddr;
-	gfx_rect_t rect;
-	gfx_rect_t clip_rect;
-	size_t offset;
-	size_t scanline;
-	visual_t visual;
-
-	pixel2visual_t pixel2visual;
-	visual2pixel_t visual2pixel;
-	visual_mask_t visual_mask;
-	size_t pixel_bytes;
-
-	size_t size;
-	uint8_t *addr;
-
-	/** Current drawing color */
-	pixel_t color;
-} kfb_t;
-
-typedef struct {
-	kfb_t *kfb;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t rect;
-	gfx_bitmap_flags_t flags;
-	pixel_t key_color;
-	bool myalloc;
-} kfb_bitmap_t;
-
-static errno_t kfb_ddev_get_gc(void *, sysarg_t *, sysarg_t *);
-static errno_t kfb_ddev_get_info(void *, ddev_info_t *);
-
-static errno_t kfb_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t kfb_gc_set_color(void *, gfx_color_t *);
-static errno_t kfb_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t kfb_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t kfb_gc_bitmap_destroy(void *);
-static errno_t kfb_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t kfb_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static ddev_ops_t kfb_ddev_ops = {
-	.get_gc = kfb_ddev_get_gc,
-	.get_info = kfb_ddev_get_info
-};
-
-static gfx_context_ops_t kfb_gc_ops = {
-	.set_clip_rect = kfb_gc_set_clip_rect,
-	.set_color = kfb_gc_set_color,
-	.fill_rect = kfb_gc_fill_rect,
-	.bitmap_create = kfb_gc_bitmap_create,
-	.bitmap_destroy = kfb_gc_bitmap_destroy,
-	.bitmap_render = kfb_gc_bitmap_render,
-	.bitmap_get_alloc = kfb_gc_bitmap_get_alloc
-};
-
-static errno_t kfb_ddev_get_gc(void *arg, sysarg_t *arg2, sysarg_t *arg3)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-
-	*arg2 = ddf_fun_get_handle(kfb->fun);
-	*arg3 = 42;
-	return EOK;
-}
-
-static errno_t kfb_ddev_get_info(void *arg, ddev_info_t *info)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-
-	ddev_info_init(info);
-	info->rect = kfb->rect;
-	return EOK;
-}
-
-/** Set clipping rectangle on KFB.
- *
- * @param arg KFB
- * @param rect Rectangle or @c NULL
- *
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-
-	if (rect != NULL)
-		gfx_rect_clip(rect, &kfb->rect, &kfb->clip_rect);
-	else
-		kfb->clip_rect = kfb->rect;
-
-	return EOK;
-}
-
-/** Set color on KFB.
- *
- * Set drawing color on KFB GC.
- *
- * @param arg KFB
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_set_color(void *arg, gfx_color_t *color)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-	uint16_t r, g, b;
-
-	gfx_color_get_rgb_i16(color, &r, &g, &b);
-	kfb->color = PIXEL(0, r >> 8, g >> 8, b >> 8);
-	return EOK;
-}
-
-/** Fill rectangle on KFB.
- *
- * @param arg KFB
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-	gfx_rect_t crect;
-	gfx_coord_t x, y;
-
-	/* Make sure we have a sorted, clipped rectangle */
-	gfx_rect_clip(rect, &kfb->rect, &crect);
-
-	for (y = crect.p0.y; y < crect.p1.y; y++) {
-		for (x = crect.p0.x; x < crect.p1.x; x++) {
-			kfb->pixel2visual(kfb->addr + FB_POS(kfb, x, y),
-			    kfb->color);
-		}
-	}
-
-	return EOK;
-}
-
-/** Create bitmap in KFB GC.
- *
- * @param arg KFB
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t kfb_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	kfb_t *kfb = (kfb_t *) arg;
-	kfb_bitmap_t *kfbbm = NULL;
-	gfx_coord2_t dim;
-	errno_t rc;
-
-	/* Check that we support all required flags */
-	if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
-		return ENOTSUP;
-
-	kfbbm = calloc(1, sizeof(kfb_bitmap_t));
-	if (kfbbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	kfbbm->rect = params->rect;
-	kfbbm->flags = params->flags;
-	kfbbm->key_color = params->key_color;
-
-	if (alloc == NULL) {
-		kfbbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		kfbbm->alloc.off0 = 0;
-		kfbbm->alloc.pixels = malloc(kfbbm->alloc.pitch * dim.y);
-		kfbbm->myalloc = true;
-
-		if (kfbbm->alloc.pixels == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-	} else {
-		kfbbm->alloc = *alloc;
-	}
-
-	kfbbm->kfb = kfb;
-	*rbm = (void *)kfbbm;
-	return EOK;
-error:
-	if (rbm != NULL)
-		free(kfbbm);
-	return rc;
-}
-
-/** Destroy bitmap in KFB GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_bitmap_destroy(void *bm)
-{
-	kfb_bitmap_t *kfbbm = (kfb_bitmap_t *)bm;
-	if (kfbbm->myalloc)
-		free(kfbbm->alloc.pixels);
-	free(kfbbm);
-	return EOK;
-}
-
-/** Render bitmap in KFB GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	kfb_bitmap_t *kfbbm = (kfb_bitmap_t *)bm;
-	kfb_t *kfb = kfbbm->kfb;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_rect_t skfbrect;
-	gfx_rect_t crect;
-	gfx_coord2_t offs;
-	gfx_coord2_t bmdim;
-	gfx_coord2_t dim;
-	gfx_coord2_t sp;
-	gfx_coord2_t dp;
-	gfx_coord2_t pos;
-	pixelmap_t pbm;
-	pixel_t color;
-
-	/* Clip source rectangle to bitmap bounds */
-
-	if (srect0 != NULL)
-		gfx_rect_clip(srect0, &kfbbm->rect, &srect);
-	else
-		srect = kfbbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	/* Destination rectangle */
-	gfx_rect_translate(&offs, &srect, &drect);
-	gfx_coord2_subtract(&drect.p1, &drect.p0, &dim);
-	gfx_coord2_subtract(&kfbbm->rect.p1, &kfbbm->rect.p0, &bmdim);
-
-	pbm.width = bmdim.x;
-	pbm.height = bmdim.y;
-	pbm.data = kfbbm->alloc.pixels;
-
-	/* Transform KFB bounding rectangle back to bitmap coordinate system */
-	gfx_rect_rtranslate(&offs, &kfb->rect, &skfbrect);
-
-	/*
-	 * Make sure we have a sorted source rectangle, clipped so that
-	 * destination lies within KFB bounding rectangle
-	 */
-	gfx_rect_clip(&srect, &skfbrect, &crect);
-
-	if ((kfbbm->flags & bmpf_color_key) != 0) {
-		/* Simple copy */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &kfbbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				if (color != kfbbm->key_color) {
-					kfb->pixel2visual(kfb->addr +
-					    FB_POS(kfb, dp.x, dp.y), color);
-				}
-			}
-		}
-	} else if ((kfbbm->flags & bmpf_colorize) != 0) {
-		/* Color key */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &kfbbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				kfb->pixel2visual(kfb->addr +
-				    FB_POS(kfb, dp.x, dp.y), color);
-			}
-		}
-	} else {
-		/* Color key & colorize */
-		for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) {
-			for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) {
-				gfx_coord2_subtract(&pos, &kfbbm->rect.p0, &sp);
-				gfx_coord2_add(&pos, &offs, &dp);
-
-				color = pixelmap_get_pixel(&pbm, sp.x, sp.y);
-				kfb->pixel2visual(kfb->addr +
-				    FB_POS(kfb, dp.x, dp.y), color);
-			}
-		}
-	}
-
-	return EOK;
-}
-
-/** Get allocation info for bitmap in KFB GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t kfb_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	kfb_bitmap_t *kfbbm = (kfb_bitmap_t *)bm;
-	*alloc = kfbbm->alloc;
-	return EOK;
-}
-
-static void kfb_client_conn(ipc_call_t *icall, void *arg)
-{
-	kfb_t *kfb;
-	ddev_srv_t srv;
-	sysarg_t gc_id;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	kfb = (kfb_t *) ddf_fun_data_get((ddf_fun_t *) arg);
-
-	gc_id = ipc_get_arg3(icall);
-
-	if (gc_id == 0) {
-		/* Set up protocol structure */
-		ddev_srv_initialize(&srv);
-		srv.ops = &kfb_ddev_ops;
-		srv.arg = kfb;
-
-		/* Handle connection */
-		ddev_conn(icall, &srv);
-	} else {
-		assert(gc_id == 42);
-
-		if (kfb->addr != AS_AREA_ANY) {
-			/* This means there already is a GC connection */
-			async_answer_0(icall, EBUSY);
-			return;
-		}
-
-		rc = physmem_map(kfb->paddr + kfb->offset,
-		    ALIGN_UP(kfb->size, PAGE_SIZE) >> PAGE_WIDTH,
-		    AS_AREA_READ | AS_AREA_WRITE, (void *) &kfb->addr);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_context_new(&kfb_gc_ops, kfb, &gc);
-		if (rc != EOK)
-			goto error;
-
-		/* GC connection */
-		gc_conn(icall, gc);
-
-		rc = physmem_unmap(kfb->addr);
-		if (rc == EOK)
-			kfb->addr = AS_AREA_ANY;
-	}
-
-	return;
-error:
-	if (kfb->addr != AS_AREA_ANY) {
-		if (physmem_unmap(kfb->addr) == EOK)
-			kfb->addr = AS_AREA_ANY;
-	}
-
-	async_answer_0(icall, rc);
-}
-
-errno_t port_init(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun = NULL;
-	kfb_t *kfb = NULL;
-	errno_t rc;
-
-	fun = ddf_fun_create(dev, fun_exposed, "kfb");
-	if (fun == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun, &kfb_client_conn);
-
-	kfb = ddf_fun_data_alloc(fun, sizeof(kfb_t));
-	if (kfb == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	sysarg_t present;
-	rc = sysinfo_get_value("fb", &present);
-	if (rc != EOK)
-		present = false;
-
-	if (!present) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	sysarg_t kind;
-	rc = sysinfo_get_value("fb.kind", &kind);
-	if (rc != EOK)
-		kind = (sysarg_t) -1;
-
-	if (kind != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	sysarg_t paddr;
-	rc = sysinfo_get_value("fb.address.physical", &paddr);
-	if (rc != EOK)
-		goto error;
-
-	sysarg_t offset;
-	rc = sysinfo_get_value("fb.offset", &offset);
-	if (rc != EOK)
-		offset = 0;
-
-	sysarg_t width;
-	rc = sysinfo_get_value("fb.width", &width);
-	if (rc != EOK)
-		goto error;
-
-	sysarg_t height;
-	rc = sysinfo_get_value("fb.height", &height);
-	if (rc != EOK)
-		goto error;
-
-	sysarg_t scanline;
-	rc = sysinfo_get_value("fb.scanline", &scanline);
-	if (rc != EOK)
-		goto error;
-
-	sysarg_t visual;
-	rc = sysinfo_get_value("fb.visual", &visual);
-	if (rc != EOK)
-		goto error;
-
-	kfb->fun = fun;
-
-	kfb->rect.p0.x = 0;
-	kfb->rect.p0.y = 0;
-	kfb->rect.p1.x = width;
-	kfb->rect.p1.y = height;
-
-	kfb->clip_rect = kfb->rect;
-
-	kfb->paddr = paddr;
-	kfb->offset = offset;
-	kfb->scanline = scanline;
-	kfb->visual = visual;
-
-	switch (visual) {
-	case VISUAL_INDIRECT_8:
-		kfb->pixel2visual = pixel2bgr_323;
-		kfb->visual2pixel = bgr_323_2pixel;
-		kfb->visual_mask = visual_mask_323;
-		kfb->pixel_bytes = 1;
-		break;
-	case VISUAL_RGB_5_5_5_LE:
-		kfb->pixel2visual = pixel2rgb_555_le;
-		kfb->visual2pixel = rgb_555_le_2pixel;
-		kfb->visual_mask = visual_mask_555;
-		kfb->pixel_bytes = 2;
-		break;
-	case VISUAL_RGB_5_5_5_BE:
-		kfb->pixel2visual = pixel2rgb_555_be;
-		kfb->visual2pixel = rgb_555_be_2pixel;
-		kfb->visual_mask = visual_mask_555;
-		kfb->pixel_bytes = 2;
-		break;
-	case VISUAL_RGB_5_6_5_LE:
-		kfb->pixel2visual = pixel2rgb_565_le;
-		kfb->visual2pixel = rgb_565_le_2pixel;
-		kfb->visual_mask = visual_mask_565;
-		kfb->pixel_bytes = 2;
-		break;
-	case VISUAL_RGB_5_6_5_BE:
-		kfb->pixel2visual = pixel2rgb_565_be;
-		kfb->visual2pixel = rgb_565_be_2pixel;
-		kfb->visual_mask = visual_mask_565;
-		kfb->pixel_bytes = 2;
-		break;
-	case VISUAL_RGB_8_8_8:
-		kfb->pixel2visual = pixel2rgb_888;
-		kfb->visual2pixel = rgb_888_2pixel;
-		kfb->visual_mask = visual_mask_888;
-		kfb->pixel_bytes = 3;
-		break;
-	case VISUAL_BGR_8_8_8:
-		kfb->pixel2visual = pixel2bgr_888;
-		kfb->visual2pixel = bgr_888_2pixel;
-		kfb->visual_mask = visual_mask_888;
-		kfb->pixel_bytes = 3;
-		break;
-	case VISUAL_RGB_8_8_8_0:
-		kfb->pixel2visual = pixel2rgb_8880;
-		kfb->visual2pixel = rgb_8880_2pixel;
-		kfb->visual_mask = visual_mask_8880;
-		kfb->pixel_bytes = 4;
-		break;
-	case VISUAL_RGB_0_8_8_8:
-		kfb->pixel2visual = pixel2rgb_0888;
-		kfb->visual2pixel = rgb_0888_2pixel;
-		kfb->visual_mask = visual_mask_0888;
-		kfb->pixel_bytes = 4;
-		break;
-	case VISUAL_BGR_0_8_8_8:
-		kfb->pixel2visual = pixel2bgr_0888;
-		kfb->visual2pixel = bgr_0888_2pixel;
-		kfb->visual_mask = visual_mask_0888;
-		kfb->pixel_bytes = 4;
-		break;
-	case VISUAL_BGR_8_8_8_0:
-		kfb->pixel2visual = pixel2bgr_8880;
-		kfb->visual2pixel = bgr_8880_2pixel;
-		kfb->visual_mask = visual_mask_8880;
-		kfb->pixel_bytes = 4;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	kfb->size = scanline * height;
-	kfb->addr = AS_AREA_ANY;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK)
-		goto error;
-
-	rc = ddf_fun_add_to_category(fun, "display-device");
-	if (rc != EOK) {
-		ddf_fun_unbind(fun);
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (fun != NULL)
-		ddf_fun_destroy(fun);
-	return rc;
-}
-
-/** @}
- */
Index: pace/drv/fb/kfb/port.h
===================================================================
--- uspace/drv/fb/kfb/port.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kfb
- * @{
- */
-/**
- * @file
- */
-
-#ifndef KFB_PORT_H_
-#define KFB_PORT_H_
-
-#include <ddf/driver.h>
-
-extern errno_t port_init(ddf_dev_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/hid/adb-kbd/adb-kbd.c
===================================================================
--- uspace/drv/hid/adb-kbd/adb-kbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief ADB keyboard port driver.
- */
-
-#include <async.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <ipc/adb.h>
-#include <ipc/kbdev.h>
-#include <loc.h>
-#include <vfs/vfs.h>
-
-#include "adb-kbd.h"
-#include "ctl.h"
-
-static void adb_kbd_events(ipc_call_t *, void *);
-static void adb_kbd_reg0_data(adb_kbd_t *, uint16_t);
-static void adb_kbd_conn(ipc_call_t *, void *);
-
-/** Add ADB keyboard device */
-errno_t adb_kbd_add(adb_kbd_t *kbd)
-{
-	errno_t rc;
-	bool bound = false;
-
-	kbd->fun = ddf_fun_create(kbd->dev, fun_exposed, "a");
-	if (kbd->fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	kbd->parent_sess = ddf_dev_parent_sess_get(kbd->dev);
-	if (kbd->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Error connecting parent driver");
-		rc = EIO;
-		goto error;
-	}
-
-	async_exch_t *exch = async_exchange_begin(kbd->parent_sess);
-	if (exch == NULL) {
-		ddf_msg(LVL_ERROR, "Error starting exchange with parent");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0,
-	    adb_kbd_events, kbd, &port);
-
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error creating callback from device");
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(kbd->fun, adb_kbd_conn);
-
-	rc = ddf_fun_bind(kbd->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(kbd->fun, "keyboard");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function to category");
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(kbd->fun);
-
-	if (kbd->parent_sess != NULL) {
-		async_hangup(kbd->parent_sess);
-		kbd->parent_sess = NULL;
-	}
-
-	if (kbd->fun != NULL) {
-		ddf_fun_destroy(kbd->fun);
-		kbd->fun = NULL;
-	}
-
-	return rc;
-}
-
-/** Remove ADB keyboard device */
-errno_t adb_kbd_remove(adb_kbd_t *con)
-{
-	return ENOTSUP;
-}
-
-/** ADB keyboard device gone */
-errno_t adb_kbd_gone(adb_kbd_t *con)
-{
-	return ENOTSUP;
-}
-
-static void adb_kbd_events(ipc_call_t *icall, void *arg)
-{
-	adb_kbd_t *kbd = (adb_kbd_t *) arg;
-
-	/* Ignore parameters, the connection is already opened */
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		errno_t retval = EOK;
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case ADB_REG_NOTIF:
-			adb_kbd_reg0_data(kbd, ipc_get_arg1(&call));
-			break;
-		default:
-			retval = ENOENT;
-		}
-		async_answer_0(&call, retval);
-	}
-}
-
-static void adb_kbd_data(adb_kbd_t *kbd, uint8_t b)
-{
-	kbd_event_type_t etype;
-	unsigned int key;
-	errno_t rc;
-
-	rc = adb_kbd_key_translate(b, &etype, &key);
-	if (rc != EOK)
-		return;
-
-	if (kbd->client_sess == NULL)
-		return;
-
-	async_exch_t *exch = async_exchange_begin(kbd->client_sess);
-	async_msg_4(exch, KBDEV_EVENT, etype, key, 0, 0);
-	async_exchange_end(exch);
-}
-
-static void adb_kbd_reg0_data(adb_kbd_t *kbd, uint16_t data)
-{
-	uint8_t b0 = (data >> 8) & 0xff;
-	uint8_t b1 = data & 0xff;
-
-	if (b0 != 0xff)
-		adb_kbd_data(kbd, b0);
-
-	if (b1 != 0xff)
-		adb_kbd_data(kbd, b1);
-	(void)b0;
-	(void)b1;
-}
-
-/** Handle client connection */
-static void adb_kbd_conn(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	sysarg_t method;
-	adb_kbd_t *kbd;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	kbd = (adb_kbd_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
-
-	while (true) {
-		async_get_call(&call);
-		method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		async_sess_t *sess =
-		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
-		if (sess != NULL) {
-			kbd->client_sess = sess;
-			async_answer_0(&call, EOK);
-		} else {
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/adb-kbd/adb-kbd.h
===================================================================
--- uspace/drv/hid/adb-kbd/adb-kbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef ADB_KBD_H
-#define ADB_KBD_H
-
-#include <async.h>
-#include <ddf/driver.h>
-
-/** ADB keyboard */
-typedef struct {
-	ddf_dev_t *dev;
-	async_sess_t *parent_sess;
-	ddf_fun_t *fun;
-	async_sess_t *client_sess;
-} adb_kbd_t;
-
-extern errno_t adb_kbd_add(adb_kbd_t *);
-extern errno_t adb_kbd_remove(adb_kbd_t *);
-extern errno_t adb_kbd_gone(adb_kbd_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/hid/adb-kbd/adb-kbd.ma
===================================================================
--- uspace/drv/hid/adb-kbd/adb-kbd.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 adb/keyboard
Index: pace/drv/hid/adb-kbd/ctl.c
===================================================================
--- uspace/drv/hid/adb-kbd/ctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,207 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief Apple ADB keyboard controller
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/keycode.h>
-
-#include "ctl.h"
-
-#define KBD_KEY_RELEASE  0x80
-
-static unsigned int scanmap[] = {
-	[0x00] = KC_A,
-	[0x01] = KC_S,
-	[0x02] = KC_D,
-	[0x03] = KC_F,
-	[0x04] = KC_H,
-	[0x05] = KC_G,
-	[0x06] = KC_Z,
-	[0x07] = KC_X,
-	[0x08] = KC_C,
-	[0x09] = KC_V,
-	[0x0a] = KC_BACKSLASH,
-	[0x0b] = KC_B,
-	[0x0c] = KC_Q,
-	[0x0d] = KC_W,
-	[0x0e] = KC_E,
-	[0x0f] = KC_R,
-	[0x10] = KC_Y,
-	[0x11] = KC_T,
-	[0x12] = KC_1,
-	[0x13] = KC_2,
-	[0x14] = KC_3,
-	[0x15] = KC_4,
-	[0x16] = KC_6,
-	[0x17] = KC_5,
-	[0x18] = KC_EQUALS,
-	[0x19] = KC_9,
-	[0x1a] = KC_7,
-	[0x1b] = KC_MINUS,
-	[0x1c] = KC_8,
-	[0x1d] = KC_0,
-	[0x1e] = KC_RBRACKET,
-	[0x1f] = KC_O,
-	[0x20] = KC_U,
-	[0x21] = KC_LBRACKET,
-	[0x22] = KC_I,
-	[0x23] = KC_P,
-	[0x24] = KC_ENTER,
-	[0x25] = KC_L,
-	[0x26] = KC_J,
-	[0x27] = KC_QUOTE,
-	[0x28] = KC_K,
-	[0x29] = KC_SEMICOLON,
-	[0x2a] = KC_BACKSLASH,
-	[0x2b] = KC_COMMA,
-	[0x2c] = KC_SLASH,
-	[0x2d] = KC_N,
-	[0x2e] = KC_M,
-	[0x2f] = KC_PERIOD,
-	[0x30] = KC_TAB,
-	[0x31] = KC_SPACE,
-	[0x32] = KC_BACKTICK,
-	[0x33] = KC_BACKSPACE,
-	[0x34] = 0,
-	[0x35] = KC_ESCAPE,
-	[0x36] = KC_LCTRL,
-	[0x37] = 0,
-	[0x38] = KC_LSHIFT,
-	[0x39] = KC_CAPS_LOCK,
-	[0x3a] = KC_LALT,
-	[0x3b] = KC_LEFT,
-	[0x3c] = KC_RIGHT,
-	[0x3d] = KC_DOWN,
-	[0x3e] = KC_UP,
-	[0x3f] = 0,
-	[0x40] = 0,
-	[0x41] = KC_NPERIOD,
-	[0x42] = 0,
-	[0x43] = KC_NTIMES,
-	[0x44] = 0,
-	[0x45] = KC_NPLUS,
-	[0x46] = 0,
-	[0x47] = KC_NUM_LOCK,
-	[0x48] = 0,
-	[0x49] = 0,
-	[0x4a] = 0,
-	[0x4b] = KC_NSLASH,
-	[0x4c] = KC_NENTER,
-	[0x4d] = 0,
-	[0x4e] = KC_NMINUS,
-	[0x4f] = 0,
-	[0x50] = 0,
-	[0x51] = 0,
-	[0x52] = KC_N0,
-	[0x53] = KC_N1,
-	[0x54] = KC_N2,
-	[0x55] = KC_N3,
-	[0x56] = KC_N4,
-	[0x57] = KC_N5,
-	[0x58] = KC_N6,
-	[0x59] = KC_N7,
-	[0x5a] = 0,
-	[0x5b] = KC_N8,
-	[0x5c] = KC_N9,
-	[0x5d] = 0,
-	[0x5e] = 0,
-	[0x5f] = 0,
-	[0x60] = KC_F5,
-	[0x61] = KC_F6,
-	[0x62] = KC_F7,
-	[0x63] = KC_F3,
-	[0x64] = KC_F8,
-	[0x65] = KC_F9,
-	[0x66] = 0,
-	[0x67] = KC_F11,
-	[0x68] = 0,
-	[0x69] = KC_SYSREQ,
-	[0x6a] = 0,
-	[0x6b] = KC_SCROLL_LOCK,
-	[0x6c] = 0,
-	[0x6d] = KC_F10,
-	[0x6e] = 0,
-	[0x6f] = KC_F12,
-	[0x70] = 0,
-	[0x71] = KC_PAUSE,
-	[0x72] = KC_INSERT,
-	[0x73] = KC_HOME,
-	[0x74] = KC_PAGE_UP,
-	[0x75] = KC_DELETE,
-	[0x76] = KC_F4,
-	[0x77] = KC_END,
-	[0x78] = KC_F2,
-	[0x79] = KC_PAGE_DOWN,
-	[0x7a] = KC_F1,
-	[0x7b] = KC_RSHIFT,
-	[0x7c] = KC_RALT,
-	[0x7d] = KC_RCTRL,
-	[0x7e] = 0,
-	[0x7f] = 0
-};
-
-/** Translate ADB keyboard scancode into keyboard event.
- *
- * @param scancode Scancode
- * @param rtype Place to store type of keyboard event (press or release)
- * @param rkey Place to store key code
- *
- * @return EOK on success, ENOENT if no translation exists
- */
-errno_t adb_kbd_key_translate(sysarg_t scancode, kbd_event_type_t *rtype,
-    unsigned int *rkey)
-{
-	kbd_event_type_t etype;
-	unsigned int key;
-
-	if (scancode & KBD_KEY_RELEASE) {
-		scancode &= ~KBD_KEY_RELEASE;
-		etype = KEY_RELEASE;
-	} else {
-		etype = KEY_PRESS;
-	}
-
-	if (scancode >= sizeof(scanmap) / sizeof(unsigned int))
-		return ENOENT;
-
-	key = scanmap[scancode];
-	if (key == 0)
-		return ENOENT;
-
-	*rtype = etype;
-	*rkey = key;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/drv/hid/adb-kbd/ctl.h
===================================================================
--- uspace/drv/hid/adb-kbd/ctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief Apple ADB keyboard controller
- */
-
-#ifndef CTL_H
-#define CTL_H
-
-extern errno_t adb_kbd_key_translate(sysarg_t, kbd_event_type_t *, unsigned int *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/hid/adb-kbd/doc/doxygroups.h
===================================================================
--- uspace/drv/hid/adb-kbd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_adb_kbd adb-kbd
- * @brief ADB keyboard port driver
- * @ingroup drvs
- */
Index: pace/drv/hid/adb-kbd/main.c
===================================================================
--- uspace/drv/hid/adb-kbd/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_adb_kbd
- * @{
- */
-/** @file ADB keyboard driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "adb-kbd.h"
-
-#define NAME  "adb-kbd"
-
-static errno_t adb_kbd_dev_add(ddf_dev_t *dev);
-static errno_t adb_kbd_dev_remove(ddf_dev_t *dev);
-static errno_t adb_kbd_dev_gone(ddf_dev_t *dev);
-static errno_t adb_kbd_fun_online(ddf_fun_t *fun);
-static errno_t adb_kbd_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = adb_kbd_dev_add,
-	.dev_remove = adb_kbd_dev_remove,
-	.dev_gone = adb_kbd_dev_gone,
-	.fun_online = adb_kbd_fun_online,
-	.fun_offline = adb_kbd_fun_offline
-};
-
-static driver_t adb_kbd_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t adb_kbd_dev_add(ddf_dev_t *dev)
-{
-	adb_kbd_t *adb_kbd;
-
-	ddf_msg(LVL_DEBUG, "adb_kbd_dev_add(%p)", dev);
-	adb_kbd = ddf_dev_data_alloc(dev, sizeof(adb_kbd_t));
-	if (adb_kbd == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	adb_kbd->dev = dev;
-
-	return adb_kbd_add(adb_kbd);
-}
-
-static errno_t adb_kbd_dev_remove(ddf_dev_t *dev)
-{
-	adb_kbd_t *adb_kbd = (adb_kbd_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "adb_kbd_dev_remove(%p)", dev);
-
-	return adb_kbd_remove(adb_kbd);
-}
-
-static errno_t adb_kbd_dev_gone(ddf_dev_t *dev)
-{
-	adb_kbd_t *adb_kbd = (adb_kbd_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "adb_kbd_dev_gone(%p)", dev);
-
-	return adb_kbd_gone(adb_kbd);
-}
-
-static errno_t adb_kbd_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "adb_kbd_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t adb_kbd_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "adb_kbd_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": ADB keyboard driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&adb_kbd_driver);
-}
-
-/** @}
- */
Index: pace/drv/hid/adb-kbd/meson.build
===================================================================
--- uspace/drv/hid/adb-kbd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files(
-	'main.c',
-	'adb-kbd.c',
-	'ctl.c',
-)
Index: pace/drv/hid/adb-mouse/adb-mouse.c
===================================================================
--- uspace/drv/hid/adb-mouse/adb-mouse.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief ADB mouse driver
- */
-
-#include <async.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <ipc/adb.h>
-#include <ipc/mouseev.h>
-#include <loc.h>
-#include <stdio.h>
-
-#include "adb-mouse.h"
-
-static void adb_mouse_conn(ipc_call_t *, void *);
-
-static void adb_mouse_event_button(adb_mouse_t *mouse, int bnum, int bpress)
-{
-	async_exch_t *exch = async_exchange_begin(mouse->client_sess);
-	async_msg_2(exch, MOUSEEV_BUTTON_EVENT, bnum, bpress);
-	async_exchange_end(exch);
-}
-
-static void adb_mouse_event_move(adb_mouse_t *mouse, int dx, int dy, int dz)
-{
-	async_exch_t *exch = async_exchange_begin(mouse->client_sess);
-	async_msg_3(exch, MOUSEEV_MOVE_EVENT, dx, dy, dz);
-	async_exchange_end(exch);
-}
-
-/** Process mouse data */
-static void adb_mouse_data(adb_mouse_t *mouse, sysarg_t data)
-{
-	bool b1, b2;
-	uint16_t udx, udy;
-	int dx, dy;
-
-	/* Extract fields. */
-	b1 = ((data >> 15) & 1) == 0;
-	udy = (data >> 8) & 0x7f;
-	b2 = ((data >> 7) & 1) == 0;
-	udx = data & 0x7f;
-
-	/* Decode 7-bit two's complement signed values. */
-	dx = (udx & 0x40) ? (udx - 0x80) : udx;
-	dy = (udy & 0x40) ? (udy - 0x80) : udy;
-
-	if (b1 != mouse->b1_pressed) {
-		adb_mouse_event_button(mouse, 1, b1);
-		mouse->b1_pressed = b1;
-	}
-
-	if (b2 != mouse->b2_pressed) {
-		adb_mouse_event_button(mouse, 2, b2);
-		mouse->b2_pressed = b2;
-	}
-
-	if (dx != 0 || dy != 0)
-		adb_mouse_event_move(mouse, dx, dy, 0);
-}
-
-static void adb_mouse_events(ipc_call_t *icall, void *arg)
-{
-	adb_mouse_t *mouse = (adb_mouse_t *) arg;
-
-	/* Ignore parameters, the connection is already opened */
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		errno_t retval = EOK;
-
-		if (!ipc_get_imethod(&call)) {
-			/* TODO: Handle hangup */
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case ADB_REG_NOTIF:
-			adb_mouse_data(mouse, ipc_get_arg1(&call));
-			break;
-		default:
-			retval = ENOENT;
-		}
-
-		async_answer_0(&call, retval);
-	}
-}
-
-/** Add ADB mouse device */
-errno_t adb_mouse_add(adb_mouse_t *mouse)
-{
-	errno_t rc;
-	bool bound = false;
-
-	mouse->fun = ddf_fun_create(mouse->dev, fun_exposed, "a");
-	if (mouse->fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	mouse->parent_sess = ddf_dev_parent_sess_get(mouse->dev);
-	if (mouse->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Error connecting parent driver");
-		rc = EIO;
-		goto error;
-	}
-
-	async_exch_t *exch = async_exchange_begin(mouse->parent_sess);
-	if (exch == NULL) {
-		ddf_msg(LVL_ERROR, "Error starting exchange with parent");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_ADB_CB, 0, 0,
-	    adb_mouse_events, mouse, &port);
-
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error creating callback from device");
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(mouse->fun, adb_mouse_conn);
-
-	rc = ddf_fun_bind(mouse->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error binding function");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(mouse->fun, "mouse");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding function to category");
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(mouse->fun);
-
-	if (mouse->parent_sess != NULL) {
-		async_hangup(mouse->parent_sess);
-		mouse->parent_sess = NULL;
-	}
-
-	if (mouse->fun != NULL) {
-		ddf_fun_destroy(mouse->fun);
-		mouse->fun = NULL;
-	}
-
-	return rc;
-}
-
-/** Remove ADB mouse device */
-errno_t adb_mouse_remove(adb_mouse_t *con)
-{
-	return ENOTSUP;
-}
-
-/** ADB mouse device gone */
-errno_t adb_mouse_gone(adb_mouse_t *con)
-{
-	return ENOTSUP;
-}
-
-/** Handle client connection */
-static void adb_mouse_conn(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	sysarg_t method;
-	adb_mouse_t *mouse;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	mouse = (adb_mouse_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
-
-	while (true) {
-		async_get_call(&call);
-		method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		async_sess_t *sess =
-		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
-		if (sess != NULL) {
-			mouse->client_sess = sess;
-			async_answer_0(&call, EOK);
-		} else {
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/adb-mouse/adb-mouse.h
===================================================================
--- uspace/drv/hid/adb-mouse/adb-mouse.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ADB mouse driver
- */
-
-#ifndef ADB_MOUSE_H
-#define ADB_MOUSE_H
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <stdbool.h>
-
-/** ADB mouse */
-typedef struct {
-	ddf_dev_t *dev;
-	async_sess_t *parent_sess;
-	ddf_fun_t *fun;
-	async_sess_t *client_sess;
-	bool b1_pressed;
-	bool b2_pressed;
-} adb_mouse_t;
-
-extern errno_t adb_mouse_add(adb_mouse_t *);
-extern errno_t adb_mouse_remove(adb_mouse_t *);
-extern errno_t adb_mouse_gone(adb_mouse_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/hid/adb-mouse/adb-mouse.ma
===================================================================
--- uspace/drv/hid/adb-mouse/adb-mouse.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 adb/mouse
Index: pace/drv/hid/adb-mouse/doc/doxygroups.h
===================================================================
--- uspace/drv/hid/adb-mouse/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_adb_mouse adb-mouse
- * @brief ADB mouse driver
- * @ingroup drvs
- */
Index: pace/drv/hid/adb-mouse/main.c
===================================================================
--- uspace/drv/hid/adb-mouse/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_adb_mouse
- * @{
- */
-/** @file ADB mouse driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "adb-mouse.h"
-
-#define NAME  "adb-mouse"
-
-static errno_t adb_mouse_dev_add(ddf_dev_t *dev);
-static errno_t adb_mouse_dev_remove(ddf_dev_t *dev);
-static errno_t adb_mouse_dev_gone(ddf_dev_t *dev);
-static errno_t adb_mouse_fun_online(ddf_fun_t *fun);
-static errno_t adb_mouse_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = adb_mouse_dev_add,
-	.dev_remove = adb_mouse_dev_remove,
-	.dev_gone = adb_mouse_dev_gone,
-	.fun_online = adb_mouse_fun_online,
-	.fun_offline = adb_mouse_fun_offline
-};
-
-static driver_t adb_mouse_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t adb_mouse_dev_add(ddf_dev_t *dev)
-{
-	adb_mouse_t *adb_mouse;
-
-	ddf_msg(LVL_DEBUG, "adb_mouse_dev_add(%p)", dev);
-	adb_mouse = ddf_dev_data_alloc(dev, sizeof(adb_mouse_t));
-	if (adb_mouse == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	adb_mouse->dev = dev;
-
-	return adb_mouse_add(adb_mouse);
-}
-
-static errno_t adb_mouse_dev_remove(ddf_dev_t *dev)
-{
-	adb_mouse_t *adb_mouse = (adb_mouse_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "adb_mouse_dev_remove(%p)", dev);
-
-	return adb_mouse_remove(adb_mouse);
-}
-
-static errno_t adb_mouse_dev_gone(ddf_dev_t *dev)
-{
-	adb_mouse_t *adb_mouse = (adb_mouse_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "adb_mouse_dev_gone(%p)", dev);
-
-	return adb_mouse_gone(adb_mouse);
-}
-
-static errno_t adb_mouse_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "adb_mouse_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t adb_mouse_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "adb_mouse_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": ADB mouse driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&adb_mouse_driver);
-}
-
-/** @}
- */
Index: pace/drv/hid/adb-mouse/meson.build
===================================================================
--- uspace/drv/hid/adb-mouse/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files('main.c', 'adb-mouse.c')
Index: pace/drv/hid/atkbd/atkbd.c
===================================================================
--- uspace/drv/hid/atkbd/atkbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,446 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2009 Vineeth Pillai
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup atkbd
- * @{
- */
-/** @file
- * @brief AT keyboard driver
- */
-
-#include <errno.h>
-#include <ddf/log.h>
-#include <io/kbd_event.h>
-#include <io/keycode.h>
-#include <io/chardev.h>
-#include <ipc/kbdev.h>
-#include <abi/ipc/methods.h>
-#include "atkbd.h"
-
-#define AT_CAPS_SCAN_CODE 0x58
-#define AT_NUM_SCAN_CODE 0x77
-#define AT_SCROLL_SCAN_CODE 0x7E
-
-#define AT_KBD_ENABLE 0xF4
-#define AT_KBD_ACK 0xFA
-
-/* Set 2 scan codes (AT keyboard) */
-static const unsigned int scanmap_simple[] = {
-	[0x0e] = KC_BACKTICK,
-
-	[0x16] = KC_1,
-	[0x1e] = KC_2,
-	[0x26] = KC_3,
-	[0x25] = KC_4,
-	[0x2e] = KC_5,
-	[0x36] = KC_6,
-	[0x3d] = KC_7,
-	[0x3e] = KC_8,
-	[0x46] = KC_9,
-	[0x45] = KC_0,
-
-	[0x4e] = KC_MINUS,
-	[0x55] = KC_EQUALS,
-	[0x66] = KC_BACKSPACE,
-
-	[0x0d] = KC_TAB,
-
-	[0x15] = KC_Q,
-	[0x1d] = KC_W,
-	[0x24] = KC_E,
-	[0x2d] = KC_R,
-	[0x2c] = KC_T,
-	[0x35] = KC_Y,
-	[0x3c] = KC_U,
-	[0x43] = KC_I,
-	[0x44] = KC_O,
-	[0x4d] = KC_P,
-
-	[0x54] = KC_LBRACKET,
-	[0x5b] = KC_RBRACKET,
-
-	[0x58] = KC_CAPS_LOCK,
-
-	[0x1c] = KC_A,
-	[0x1b] = KC_S,
-	[0x23] = KC_D,
-	[0x2b] = KC_F,
-	[0x34] = KC_G,
-	[0x33] = KC_H,
-	[0x3b] = KC_J,
-	[0x42] = KC_K,
-	[0x4b] = KC_L,
-
-	[0x4c] = KC_SEMICOLON,
-	[0x52] = KC_QUOTE,
-	[0x5d] = KC_BACKSLASH,
-
-	[0x12] = KC_LSHIFT,
-
-	[0x1a] = KC_Z,
-	[0x22] = KC_X,
-	[0x21] = KC_C,
-	[0x2a] = KC_V,
-	[0x32] = KC_B,
-	[0x31] = KC_N,
-	[0x3a] = KC_M,
-
-	[0x41] = KC_COMMA,
-	[0x49] = KC_PERIOD,
-	[0x4a] = KC_SLASH,
-
-	[0x59] = KC_RSHIFT,
-
-	[0x14] = KC_LCTRL,
-	[0x11] = KC_LALT,
-	[0x29] = KC_SPACE,
-
-	[0x76] = KC_ESCAPE,
-
-	[0x05] = KC_F1,
-	[0x06] = KC_F2,
-	[0x04] = KC_F3,
-	[0x0c] = KC_F4,
-	[0x03] = KC_F5,
-	[0x0b] = KC_F6,
-	[0x02] = KC_F7,
-
-	[0x0a] = KC_F8,
-	[0x01] = KC_F9,
-	[0x09] = KC_F10,
-
-	[0x78] = KC_F11,
-	[0x07] = KC_F12,
-
-	[0x7e] = KC_SCROLL_LOCK,
-
-	[0x5a] = KC_ENTER,
-
-	[0x77] = KC_NUM_LOCK,
-	[0x7c] = KC_NTIMES,
-	[0x7b] = KC_NMINUS,
-	[0x79] = KC_NPLUS,
-	[0x6c] = KC_N7,
-	[0x75] = KC_N8,
-	[0x7d] = KC_N9,
-	[0x6b] = KC_N4,
-	[0x73] = KC_N5,
-	[0x74] = KC_N6,
-	[0x69] = KC_N1,
-	[0x72] = KC_N2,
-	[0x7a] = KC_N3,
-	[0x70] = KC_N0,
-	[0x71] = KC_NPERIOD,
-};
-
-#define KBD_SCANCODE_SET_EXTENDED		0xe0
-#define KBD_SCANCODE_SET_EXTENDED_SPECIAL	0xe1
-#define KBD_SCANCODE_KEY_RELEASE		0xf0
-
-static const unsigned int scanmap_e0[] = {
-	[0x65] = KC_RALT,
-	[0x59] = KC_RSHIFT,
-
-	[0x64] = KC_PRTSCR,
-
-	[0x70] = KC_INSERT,
-	[0x6c] = KC_HOME,
-	[0x7d] = KC_PAGE_UP,
-
-	[0x71] = KC_DELETE,
-	[0x69] = KC_END,
-	[0x7a] = KC_PAGE_DOWN,
-
-	[0x75] = KC_UP,
-	[0x6b] = KC_LEFT,
-	[0x72] = KC_DOWN,
-	[0x74] = KC_RIGHT,
-
-	[0x4a] = KC_NSLASH,
-	[0x5a] = KC_NENTER
-};
-
-static void push_event(async_sess_t *sess, kbd_event_type_t type,
-    unsigned int key)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_4(exch, KBDEV_EVENT, type, key, 0, 0);
-	async_exchange_end(exch);
-}
-
-/** Get data and parse scancodes.
- *
- * @param arg Pointer to at_kbd_t structure.
- *
- * @return EIO on error.
- *
- */
-static errno_t polling(void *arg)
-{
-	at_kbd_t *kbd = arg;
-	size_t nwr;
-	errno_t rc;
-
-	while (true) {
-		uint8_t code = 0;
-		rc = chardev_read(kbd->chardev, &code, 1, &nwr, chardev_f_none);
-		if (rc != EOK)
-			return EIO;
-
-		const unsigned int *map;
-		size_t map_size;
-
-		if (code == KBD_SCANCODE_SET_EXTENDED) {
-			map = scanmap_e0;
-			map_size = sizeof(scanmap_e0) / sizeof(unsigned int);
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-		} else if (code == KBD_SCANCODE_SET_EXTENDED_SPECIAL) {
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0x14)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0x77)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0xe1)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0xf0)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0x14)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code != 0xf0)
-				continue;
-
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-			if (code == 0x77)
-				push_event(kbd->client_sess, KEY_PRESS, KC_BREAK);
-
-			continue;
-		} else {
-			map = scanmap_simple;
-			map_size = sizeof(scanmap_simple) / sizeof(unsigned int);
-		}
-
-		kbd_event_type_t type;
-		if (code == KBD_SCANCODE_KEY_RELEASE) {
-			type = KEY_RELEASE;
-			rc = chardev_read(kbd->chardev, &code, 1, &nwr,
-			    chardev_f_none);
-			if (rc != EOK)
-				return EIO;
-		} else {
-			type = KEY_PRESS;
-		}
-
-		const unsigned int key = (code < map_size) ? map[code] : 0;
-
-		if (key != 0)
-			push_event(kbd->client_sess, type, key);
-		else
-			ddf_msg(LVL_WARN, "Unknown scancode: %hhx", code);
-	}
-}
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	const sysarg_t method = ipc_get_imethod(icall);
-	at_kbd_t *kbd = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	async_sess_t *sess;
-
-	switch (method) {
-	case KBDEV_SET_IND:
-		async_answer_0(icall, ENOTSUP);
-		break;
-	case IPC_M_CONNECT_TO_ME:
-		/*
-		 * This might be ugly but async_callback_receive_start makes no
-		 * difference for incorrect call and malloc failure.
-		 */
-		sess = async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-
-		/* Probably ENOMEM error, try again. */
-		if (sess == NULL) {
-			ddf_msg(LVL_WARN,
-			    "Failed creating callback session");
-			async_answer_0(icall, EAGAIN);
-			break;
-		}
-
-		if (kbd->client_sess == NULL) {
-			kbd->client_sess = sess;
-			ddf_msg(LVL_DEBUG, "Set client session");
-			async_answer_0(icall, EOK);
-		} else {
-			ddf_msg(LVL_ERROR, "Client session already set");
-			async_answer_0(icall, ELIMIT);
-		}
-
-		break;
-	default:
-		ddf_msg(LVL_ERROR, "Unknown method: %d.", (int)method);
-		async_answer_0(icall, EINVAL);
-		break;
-	}
-}
-
-/** Keyboard function ops. */
-static ddf_dev_ops_t kbd_ops = {
-	.default_handler = default_connection_handler
-};
-
-/** Initialize keyboard driver structure.
- *
- * @param kbd Keyboard driver structure to initialize.
- * @param dev DDF device structure.
- *
- * Connects to parent, creates keyboard function, starts polling fibril.
- *
- */
-errno_t at_kbd_init(at_kbd_t *kbd, ddf_dev_t *dev)
-{
-	async_sess_t *parent_sess;
-	errno_t rc;
-
-	assert(kbd);
-	assert(dev);
-
-	kbd->client_sess = NULL;
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating parent session.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = chardev_open(parent_sess, &kbd->chardev);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed opening character device.");
-		return EIO;
-	}
-
-	kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd");
-	if (!kbd->kbd_fun) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'kbd'.");
-		return ENOMEM;
-	}
-
-	ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
-
-	errno_t ret = ddf_fun_bind(kbd->kbd_fun);
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");
-		ddf_fun_destroy(kbd->kbd_fun);
-		return EEXIST;
-	}
-
-	ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard");
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category "
-		    "'keyboard'.");
-		ddf_fun_unbind(kbd->kbd_fun);
-		ddf_fun_destroy(kbd->kbd_fun);
-		return ENOMEM;
-	}
-
-	kbd->polling_fibril = fibril_create(polling, kbd);
-	if (!kbd->polling_fibril) {
-		ddf_msg(LVL_ERROR, "Failed creating polling fibril.");
-		ddf_fun_unbind(kbd->kbd_fun);
-		ddf_fun_destroy(kbd->kbd_fun);
-		return ENOMEM;
-	}
-
-	uint8_t code = AT_KBD_ENABLE;
-	size_t bytes;
-	rc = chardev_write(kbd->chardev, &code, 1, &bytes);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to enable keyboard.");
-		fibril_destroy(kbd->polling_fibril);
-		ddf_fun_unbind(kbd->kbd_fun);
-		ddf_fun_destroy(kbd->kbd_fun);
-		return EIO;
-	}
-	rc = chardev_read(kbd->chardev, &code, 1, &bytes,
-	    chardev_f_none);
-	if (rc != EOK || code != AT_KBD_ACK) {
-		ddf_msg(LVL_ERROR, "Failed to confirm keyboard enable: %hhx.",
-		    code);
-		fibril_destroy(kbd->polling_fibril);
-		ddf_fun_unbind(kbd->kbd_fun);
-		ddf_fun_destroy(kbd->kbd_fun);
-		return EIO;
-	}
-
-	fibril_add_ready(kbd->polling_fibril);
-	return EOK;
-error:
-	chardev_close(kbd->chardev);
-	kbd->chardev = NULL;
-	return rc;
-}
Index: pace/drv/hid/atkbd/atkbd.h
===================================================================
--- uspace/drv/hid/atkbd/atkbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup atkbd
- * @{
- */
-/** @file
- * @brief AT keyboard driver
- */
-
-#ifndef AT_KBD_H_
-#define AT_KBD_H_
-
-#include <ddf/driver.h>
-#include <fibril.h>
-#include <io/chardev.h>
-
-/** PC/AT keyboard driver structure. */
-typedef struct {
-	/** Keyboard function */
-	ddf_fun_t *kbd_fun;
-	/** Device providing keyboard connection */
-	chardev_t *chardev;
-	/** Callback connection to client */
-	async_sess_t *client_sess;
-	/** Fibril retrieving and parsing data */
-	fid_t polling_fibril;
-} at_kbd_t;
-
-extern errno_t at_kbd_init(at_kbd_t *, ddf_dev_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/hid/atkbd/atkbd.ma
===================================================================
--- uspace/drv/hid/atkbd/atkbd.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 char/atkbd
Index: pace/drv/hid/atkbd/doc/doxygroups.h
===================================================================
--- uspace/drv/hid/atkbd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup atkbd atkbd
- * @brief AT keyboard driver
- * @ingroup drvs
- */
Index: pace/drv/hid/atkbd/main.c
===================================================================
--- uspace/drv/hid/atkbd/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup atkbd
- * @{
- */
-/** @file
- * @brief AT keyboard driver
- */
-
-#include <inttypes.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/log.h>
-#include <stdio.h>
-
-#include "atkbd.h"
-
-#define NAME "atkbd"
-
-static errno_t at_kbd_add(ddf_dev_t *device);
-
-/** DDF driver ops. */
-static driver_ops_t kbd_driver_ops = {
-	.dev_add = at_kbd_add,
-};
-
-/** DDF driver structure. */
-static driver_t kbd_driver = {
-	.name = NAME,
-	.driver_ops = &kbd_driver_ops
-};
-
-/** Initialize global driver structures (NONE).
- *
- * Driver debug level is set here.
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- *
- * @return Error code.
- *
- */
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS AT keyboard driver.\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&kbd_driver);
-}
-
-/** Initialize a new ddf driver instance of the driver
- *
- * @param[in] device DDF instance of the device to initialize.
- *
- * @return Error code.
- *
- */
-static errno_t at_kbd_add(ddf_dev_t *device)
-{
-	errno_t rc;
-
-	if (!device)
-		return EINVAL;
-
-	at_kbd_t *kbd = ddf_dev_data_alloc(device, sizeof(at_kbd_t));
-	if (kbd == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to allocate AT_KBD driver instance.");
-		return ENOMEM;
-	}
-
-	rc = at_kbd_init(kbd, device);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to initialize AT_KBD driver: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
-	    ddf_dev_get_name(device), ddf_dev_get_handle(device));
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/atkbd/meson.build
===================================================================
--- uspace/drv/hid/atkbd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files('main.c', 'atkbd.c')
Index: pace/drv/hid/ps2mouse/doc/doxygroups.h
===================================================================
--- uspace/drv/hid/ps2mouse/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ps2mouse ps2mouse
- * @brief PS/2 mouse driver
- * @ingroup drvs
- */
Index: pace/drv/hid/ps2mouse/main.c
===================================================================
--- uspace/drv/hid/ps2mouse/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ps2mouse
- * @{
- */
-/** @file
- * @brief PS/2 mouse driver
- */
-
-#include <inttypes.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/log.h>
-#include <stdio.h>
-
-#include "ps2mouse.h"
-
-#define NAME "ps2mouse"
-
-static errno_t mouse_add(ddf_dev_t *device);
-
-/** DDF driver ops. */
-static driver_ops_t mouse_driver_ops = {
-	.dev_add = mouse_add,
-};
-
-/** DDF driver structure. */
-static driver_t mouse_driver = {
-	.name = NAME,
-	.driver_ops = &mouse_driver_ops
-};
-
-/** Initialize global driver structures (NONE).
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- * @return Error code.
- *
- * Driver debug level is set here.
- */
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS ps/2 mouse driver.\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&mouse_driver);
-}
-
-/** Initialize a new ddf driver instance
- *
- * @param[in] device DDF instance of the device to initialize.
- * @return Error code.
- */
-static errno_t mouse_add(ddf_dev_t *device)
-{
-	errno_t rc;
-
-	if (!device)
-		return EINVAL;
-
-	ps2_mouse_t *mouse = ddf_dev_data_alloc(device, sizeof(ps2_mouse_t));
-	if (mouse == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to allocate mouse driver instance.");
-		return ENOMEM;
-	}
-
-	rc = ps2_mouse_init(mouse, device);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to initialize mouse driver: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
-	    ddf_dev_get_name(device), ddf_dev_get_handle(device));
-	return EOK;
-}
-/**
- * @}
- */
Index: pace/drv/hid/ps2mouse/meson.build
===================================================================
--- uspace/drv/hid/ps2mouse/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files('main.c', 'ps2mouse.c')
Index: pace/drv/hid/ps2mouse/ps2mouse.c
===================================================================
--- uspace/drv/hid/ps2mouse/ps2mouse.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,462 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup ps2mouse
- * @{
- */
-/** @file
- * @brief PS/2 mouse driver.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/log.h>
-#include <io/keycode.h>
-#include <io/chardev.h>
-#include <ipc/mouseev.h>
-#include <abi/ipc/methods.h>
-
-#include "ps2mouse.h"
-
-#define PS2_MOUSE_GET_DEVICE_ID   0xf2
-#define PS2_MOUSE_SET_SAMPLE_RATE   0xf3
-#define PS2_MOUSE_ENABLE_DATA_REPORT   0xf4
-#define PS2_MOUSE_DISABLE_DATA_REPORT   0xf5
-#define PS2_MOUSE_ACK   0xfa
-
-#define PS2_BUFSIZE 3
-#define INTELLIMOUSE_BUFSIZE 4
-
-#define Z_SIGN (1 << 3) /* 4th byte */
-#define X_SIGN (1 << 4) /* 1st byte */
-#define Y_SIGN (1 << 5) /* 1st byte */
-#define X_OVERFLOW (1 << 6) /* 1st byte */
-#define Y_OVERFLOW (1 << 7) /* 1st byte */
-
-#define BUTTON_LEFT   0
-#define BUTTON_RIGHT   1
-#define BUTTON_MIDDLE   2
-#define PS2_BUTTON_COUNT   3
-
-#define INTELLIMOUSE_ALWAYS_ZERO (0xc0)
-#define INTELLIMOUSE_BUTTON_4 (1 << 4) /* 4th byte */
-#define INTELLIMOUSE_BUTTON_5 (1 << 5) /* 4th byte */
-#define INTELLIMOUSE_BUTTON_COUNT 5
-
-#define PS2_BUTTON_MASK(button) (1 << button)
-
-#define MOUSE_READ_BYTE_TEST(mouse, value_) \
-do { \
-	uint8_t value = (value_); \
-	uint8_t data = 0; \
-	size_t nread; \
-	const errno_t rc = chardev_read((mouse)->chardev, &data, 1, &nread, \
-	    chardev_f_none); \
-	if (rc != EOK) { \
-		ddf_msg(LVL_ERROR, "Failed reading byte: %s", str_error_name(rc));\
-		return rc; \
-	} \
-	if (data != value) { \
-		ddf_msg(LVL_DEBUG, "Failed testing byte: got %hhx vs. %hhx)", \
-		    data, value); \
-		return EIO; \
-	} \
-} while (0)
-
-#define MOUSE_WRITE_BYTE(mouse, value_) \
-do { \
-	uint8_t value = (value_); \
-	uint8_t data = (value); \
-	size_t nwr; \
-	const errno_t rc = chardev_write((mouse)->chardev, &data, 1, &nwr); \
-	if (rc != EOK) { \
-		ddf_msg(LVL_ERROR, "Failed writing byte: %s", str_error_name(rc)); \
-		return rc; \
-	} \
-} while (0)
-
-static errno_t polling_ps2(void *);
-static errno_t polling_intellimouse(void *);
-static errno_t probe_intellimouse(ps2_mouse_t *, bool);
-static void default_connection_handler(ddf_fun_t *, ipc_call_t *);
-
-/** ps/2 mouse driver ops. */
-static ddf_dev_ops_t mouse_ops = {
-	.default_handler = default_connection_handler
-};
-
-/** Initialize mouse driver structure.
- *
- * Connects to parent, creates keyboard function, starts polling fibril.
- *
- * @param kbd Mouse driver structure to initialize.
- * @param dev DDF device structure.
- *
- * @return EOK on success or non-zero error code
- */
-errno_t ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev)
-{
-	async_sess_t *parent_sess;
-	bool bound = false;
-	errno_t rc;
-
-	mouse->client_sess = NULL;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed getting parent session.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = chardev_open(parent_sess, &mouse->chardev);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed opening character device.");
-		goto error;
-	}
-
-	mouse->mouse_fun = ddf_fun_create(dev, fun_exposed, "mouse");
-	if (mouse->mouse_fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating mouse function.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_ops(mouse->mouse_fun, &mouse_ops);
-
-	rc = ddf_fun_bind(mouse->mouse_fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding mouse function.");
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(mouse->mouse_fun, "mouse");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding mouse function to category.");
-		goto error;
-	}
-
-	/* Disable mouse data reporting. */
-	uint8_t report = PS2_MOUSE_ENABLE_DATA_REPORT;
-	size_t nwr;
-	rc = chardev_write(mouse->chardev, &report, 1, &nwr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to enable data reporting.");
-		rc = EIO;
-		goto error;
-	}
-
-	/* Drain input buffer */
-	size_t nread;
-	uint8_t b;
-	do {
-		rc = chardev_read(mouse->chardev, &b, 1, &nread, chardev_f_nonblock);
-		if (rc != EOK) {
-			ddf_msg(LVL_ERROR, "Failed to drain input buffer.\n");
-			rc = EIO;
-			goto error;
-		}
-	} while (nread > 0);
-
-	/* Probe IntelliMouse extensions. */
-	errno_t (*polling_f)(void *) = polling_ps2;
-	if (probe_intellimouse(mouse, false) == EOK) {
-		ddf_msg(LVL_NOTE, "Enabled IntelliMouse extensions");
-		polling_f = polling_intellimouse;
-		if (probe_intellimouse(mouse, true) == EOK)
-			ddf_msg(LVL_NOTE, "Enabled 4th and 5th button.");
-	}
-
-	/* Enable mouse data reporting. */
-	report = PS2_MOUSE_ENABLE_DATA_REPORT;
-	rc = chardev_write(mouse->chardev, &report, 1, &nwr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to enable data reporting.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = chardev_read(mouse->chardev, &report, 1, &nread, chardev_f_none);
-	if (rc != EOK || report != PS2_MOUSE_ACK) {
-		ddf_msg(LVL_ERROR, "Failed to confirm data reporting: %hhx.",
-		    report);
-		rc = EIO;
-		goto error;
-	}
-
-	mouse->polling_fibril = fibril_create(polling_f, mouse);
-	if (mouse->polling_fibril == 0) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_add_ready(mouse->polling_fibril);
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(mouse->mouse_fun);
-	if (mouse->mouse_fun != NULL) {
-		ddf_fun_destroy(mouse->mouse_fun);
-		mouse->mouse_fun = NULL;
-	}
-
-	chardev_close(mouse->chardev);
-	mouse->chardev = NULL;
-	return rc;
-}
-
-/** Read fixed-size mouse packet.
- *
- * Continue reading until entire packet is received.
- *
- * @param mouse Mouse device
- * @param pbuf Buffer for storing packet
- * @param psize Packet size
- *
- * @return EOK on success or non-zero error code
- */
-static errno_t ps2_mouse_read_packet(ps2_mouse_t *mouse, void *pbuf, size_t psize)
-{
-	errno_t rc;
-	size_t pos;
-	size_t nread;
-
-	pos = 0;
-	while (pos < psize) {
-		rc = chardev_read(mouse->chardev, pbuf + pos, psize - pos,
-		    &nread, chardev_f_none);
-		if (rc != EOK) {
-			ddf_msg(LVL_WARN, "Error reading packet.");
-			return rc;
-		}
-
-		pos += nread;
-	}
-
-	return EOK;
-}
-
-/** Get data and parse ps2 protocol packets.
- * @param arg Pointer to ps2_mouse_t structure.
- * @return Never.
- */
-errno_t polling_ps2(void *arg)
-{
-	ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
-	errno_t rc;
-
-	bool buttons[PS2_BUTTON_COUNT] = { };
-	while (true) {
-		uint8_t packet[PS2_BUFSIZE] = { };
-		rc = ps2_mouse_read_packet(mouse, packet, PS2_BUFSIZE);
-		if (rc != EOK)
-			continue;
-
-		ddf_msg(LVL_DEBUG2, "Got packet: %hhx:%hhx:%hhx.",
-		    packet[0], packet[1], packet[2]);
-
-		async_exch_t *exch =
-		    async_exchange_begin(mouse->client_sess);
-		if (!exch) {
-			ddf_msg(LVL_ERROR,
-			    "Failed creating exchange.");
-			continue;
-		}
-
-		/* Buttons */
-		for (unsigned i = 0; i < PS2_BUTTON_COUNT; ++i) {
-			const bool status = (packet[0] & PS2_BUTTON_MASK(i));
-			if (buttons[i] != status) {
-				buttons[i] = status;
-				async_msg_2(exch, MOUSEEV_BUTTON_EVENT, i + 1,
-				    buttons[i]);
-			}
-		}
-
-		/* Movement */
-		const int16_t move_x =
-		    ((packet[0] & X_SIGN) ? 0xff00 : 0) | packet[1];
-		const int16_t move_y =
-		    (((packet[0] & Y_SIGN) ? 0xff00 : 0) | packet[2]);
-		//TODO: Consider overflow bit
-		if (move_x != 0 || move_y != 0) {
-			async_msg_2(exch, MOUSEEV_MOVE_EVENT, move_x, -move_y);
-		}
-		async_exchange_end(exch);
-	}
-
-	return 0;
-}
-
-/** Get data and parse ps2 protocol with IntelliMouse extension packets.
- * @param arg Pointer to ps2_mouse_t structure.
- * @return Never.
- */
-static errno_t polling_intellimouse(void *arg)
-{
-	ps2_mouse_t *mouse = (ps2_mouse_t *) arg;
-	errno_t rc;
-
-	bool buttons[INTELLIMOUSE_BUTTON_COUNT] = { };
-	while (true) {
-		uint8_t packet[INTELLIMOUSE_BUFSIZE] = { };
-		rc = ps2_mouse_read_packet(mouse, packet, INTELLIMOUSE_BUFSIZE);
-		if (rc != EOK)
-			continue;
-
-		ddf_msg(LVL_DEBUG2, "Got packet: %hhx:%hhx:%hhx:%hhx.",
-		    packet[0], packet[1], packet[2], packet[3]);
-
-		async_exch_t *exch =
-		    async_exchange_begin(mouse->client_sess);
-		if (!exch) {
-			ddf_msg(LVL_ERROR,
-			    "Failed creating exchange.");
-			continue;
-		}
-
-		/* Buttons */
-		/*
-		 * NOTE: Parsing 4th and 5th button works even if this extension
-		 * is not supported and whole 4th byte should be interpreted
-		 * as Z-axis movement. the upper 4 bits are just a sign
-		 * extension then. + sign is interpreted as "button up"
-		 * (i.e no change since that is the default) and - sign fails
-		 * the "imb" condition. Thus 4th and 5th buttons are never
-		 * down on wheel only extension.
-		 */
-		const bool imb = (packet[3] & INTELLIMOUSE_ALWAYS_ZERO) == 0;
-		const bool status[] = {
-			[0] = packet[0] & PS2_BUTTON_MASK(0),
-			[1] = packet[0] & PS2_BUTTON_MASK(1),
-			[2] = packet[0] & PS2_BUTTON_MASK(2),
-			[3] = (packet[3] & INTELLIMOUSE_BUTTON_4) && imb,
-			[4] = (packet[3] & INTELLIMOUSE_BUTTON_5) && imb,
-		};
-		for (unsigned i = 0; i < INTELLIMOUSE_BUTTON_COUNT; ++i) {
-			if (buttons[i] != status[i]) {
-				buttons[i] = status[i];
-				async_msg_2(exch, MOUSEEV_BUTTON_EVENT, i + 1,
-				    buttons[i]);
-			}
-		}
-
-		/* Movement */
-		const int16_t move_x =
-		    ((packet[0] & X_SIGN) ? 0xff00 : 0) | packet[1];
-		const int16_t move_y =
-		    (((packet[0] & Y_SIGN) ? 0xff00 : 0) | packet[2]);
-		const int8_t move_z =
-		    (((packet[3] & Z_SIGN) ? 0xf0 : 0) | (packet[3] & 0xf));
-		ddf_msg(LVL_DEBUG2, "Parsed moves: %d:%d:%hhd", move_x, move_y,
-		    move_z);
-		//TODO: Consider overflow bit
-		if (move_x != 0 || move_y != 0 || move_z != 0) {
-			async_msg_3(exch, MOUSEEV_MOVE_EVENT,
-			    move_x, -move_y, -move_z);
-		}
-		async_exchange_end(exch);
-	}
-
-	return 0;
-}
-
-/** Send magic sequence to initialize IntelliMouse extensions.
- * @param exch IPC exchange to the parent device.
- * @param buttons True selects magic sequence for 4th and 5th button,
- * false selects wheel support magic sequence.
- * See http://www.computer-engineering.org/ps2mouse/ for details.
- */
-static errno_t probe_intellimouse(ps2_mouse_t *mouse, bool buttons)
-{
-	MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(mouse, 200);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(mouse, buttons ? 200 : 100);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_SET_SAMPLE_RATE);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-	MOUSE_WRITE_BYTE(mouse, 80);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-
-	MOUSE_WRITE_BYTE(mouse, PS2_MOUSE_GET_DEVICE_ID);
-	MOUSE_READ_BYTE_TEST(mouse, PS2_MOUSE_ACK);
-	MOUSE_READ_BYTE_TEST(mouse, buttons ? 4 : 3);
-
-	return EOK;
-}
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	const sysarg_t method = ipc_get_imethod(icall);
-	ps2_mouse_t *mouse = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	async_sess_t *sess;
-
-	switch (method) {
-	case IPC_M_CONNECT_TO_ME:
-		/*
-		 * This might be ugly but async_callback_receive_start makes no
-		 * difference for incorrect call and malloc failure.
-		 */
-		sess = async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-		/* Probably ENOMEM error, try again. */
-		if (sess == NULL) {
-			ddf_msg(LVL_WARN,
-			    "Failed creating client callback session");
-			async_answer_0(icall, EAGAIN);
-			break;
-		}
-		if (mouse->client_sess == NULL) {
-			mouse->client_sess = sess;
-			ddf_msg(LVL_DEBUG, "Set client session");
-			async_answer_0(icall, EOK);
-		} else {
-			ddf_msg(LVL_ERROR, "Client session already set");
-			async_answer_0(icall, ELIMIT);
-		}
-		break;
-	default:
-		ddf_msg(LVL_ERROR, "Unknown method: %d.", (int)method);
-		async_answer_0(icall, EINVAL);
-		break;
-	}
-}
Index: pace/drv/hid/ps2mouse/ps2mouse.h
===================================================================
--- uspace/drv/hid/ps2mouse/ps2mouse.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup ps2mouse
- * @{
- */
-/** @file
- * @brief PS/2 mouse driver.
- */
-
-#ifndef PS2MOUSE_H_
-#define PS2MOUSE_H_
-
-#include <ddf/driver.h>
-#include <fibril.h>
-#include <io/chardev.h>
-
-/** PS/2 mouse driver structure. */
-typedef struct {
-	/** Mouse function. */
-	ddf_fun_t *mouse_fun;
-	/** Device providing mouse connection */
-	chardev_t *chardev;
-	/** Callback connection to client. */
-	async_sess_t *client_sess;
-	/** Fibril retrieving an parsing data. */
-	fid_t polling_fibril;
-} ps2_mouse_t;
-
-extern errno_t ps2_mouse_init(ps2_mouse_t *, ddf_dev_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/hid/ps2mouse/ps2mouse.ma
===================================================================
--- uspace/drv/hid/ps2mouse/ps2mouse.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 char/ps2mouse
Index: pace/drv/hid/usbhid/blink1/blink1.c
===================================================================
--- uspace/drv/hid/usbhid/blink1/blink1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB blink(1) subdriver.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <ops/led_dev.h>
-#include <usb/hid/request.h>
-#include "blink1.h"
-
-const char *HID_BLINK1_FUN_NAME = "blink1";
-const char *HID_BLINK1_CATEGORY = "led";
-
-#define BLINK1_REPORT_ID  0x0001
-
-#define BLINK1_COMMAND_SET  0x006e
-
-typedef struct {
-	uint8_t id;
-	uint8_t command;
-	uint8_t arg0;
-	uint8_t arg1;
-	uint8_t arg2;
-	uint8_t arg3;
-	uint8_t arg4;
-	uint8_t arg5;
-} blink1_report_t;
-
-static errno_t usb_blink1_color_set(ddf_fun_t *fun, pixel_t pixel)
-{
-	usb_blink1_t *blink1_dev = (usb_blink1_t *) ddf_fun_data_get(fun);
-	if (blink1_dev == NULL) {
-		usb_log_debug("Missing parameters.");
-		return EINVAL;
-	}
-
-	blink1_report_t report;
-
-	report.id = BLINK1_REPORT_ID;
-	report.command = BLINK1_COMMAND_SET;
-	report.arg0 = RED(pixel);
-	report.arg1 = GREEN(pixel);
-	report.arg2 = BLUE(pixel);
-	report.arg3 = 0;
-	report.arg4 = 0;
-	report.arg5 = 0;
-
-	return usbhid_req_set_report(
-	    usb_device_get_default_pipe(blink1_dev->hid_dev->usb_dev),
-	    usb_device_get_iface_number(blink1_dev->hid_dev->usb_dev),
-	    USB_HID_REPORT_TYPE_FEATURE, (uint8_t *) &report, sizeof(report));
-}
-
-static led_dev_ops_t usb_blink1_iface = {
-	.color_set = usb_blink1_color_set
-};
-
-static ddf_dev_ops_t blink1_ops = {
-	.interfaces[LED_DEV_IFACE] = &usb_blink1_iface
-};
-
-errno_t usb_blink1_init(usb_hid_dev_t *hid_dev, void **data)
-{
-	if (hid_dev == NULL) {
-		usb_log_error("Failed to init blink(1) structure: no structure "
-		    "given.\n");
-		return EINVAL;
-	}
-
-	/* Create the exposed function. */
-	ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
-	    fun_exposed, HID_BLINK1_FUN_NAME);
-	if (fun == NULL) {
-		usb_log_error("Could not create DDF function node `%s'.",
-		    HID_BLINK1_FUN_NAME);
-		return ENOMEM;
-	}
-
-	usb_blink1_t *blink1_dev = (usb_blink1_t *)
-	    ddf_fun_data_alloc(fun, sizeof(usb_blink1_t));
-	if (blink1_dev == NULL) {
-		usb_log_error("Error while creating USB/HID blink(1) device "
-		    "structure.\n");
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	ddf_fun_set_ops(fun, &blink1_ops);
-
-	errno_t rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		usb_log_error("Could not bind DDF function `%s': %s.",
-		    ddf_fun_get_name(fun), str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun, HID_BLINK1_CATEGORY);
-	if (rc != EOK) {
-		usb_log_error("Could not add DDF function to category %s: %s.",
-		    HID_BLINK1_CATEGORY, str_error(rc));
-
-		rc = ddf_fun_unbind(fun);
-		if (rc != EOK) {
-			usb_log_error("Could not unbind function `%s', it "
-			    "will not be destroyed.\n", ddf_fun_get_name(fun));
-			return rc;
-		}
-
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	blink1_dev->fun = fun;
-	blink1_dev->hid_dev = hid_dev;
-	*data = blink1_dev;
-
-	return EOK;
-}
-
-void usb_blink1_deinit(usb_hid_dev_t *hid_dev, void *data)
-{
-	if (data == NULL)
-		return;
-
-	usb_blink1_t *blink1_dev = (usb_blink1_t *) data;
-
-	errno_t rc = ddf_fun_unbind(blink1_dev->fun);
-	if (rc != EOK) {
-		usb_log_error("Could not unbind function `%s', it "
-		    "will not be destroyed.\n", ddf_fun_get_name(blink1_dev->fun));
-		return;
-	}
-
-	ddf_fun_destroy(blink1_dev->fun);
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/blink1/blink1.h
===================================================================
--- uspace/drv/hid/usbhid/blink1/blink1.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB blink(1) subdriver.
- */
-
-#ifndef USB_HID_BLINK1_H_
-#define USB_HID_BLINK1_H_
-
-#include <usb/dev/driver.h>
-#include "../usbhid.h"
-
-/** Container for USB blink(1) device. */
-typedef struct {
-	/** DDF blink(1) function */
-	ddf_fun_t *fun;
-
-	/** USB HID device */
-	usb_hid_dev_t *hid_dev;
-} usb_blink1_t;
-
-extern const char *HID_BLINK1_FUN_NAME;
-extern const char *HID_BLINK1_CATEGORY;
-
-extern errno_t usb_blink1_init(usb_hid_dev_t *, void **);
-extern void usb_blink1_deinit(usb_hid_dev_t *, void *);
-
-#endif // USB_HID_BLINK1_H_
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/generic/hiddev.c
===================================================================
--- uspace/drv/hid/usbhid/generic/hiddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,227 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB HID driver API.
- */
-
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-
-#include <usbhid_iface.h>
-
-#include "hiddev.h"
-#include "usbhid.h"
-
-const usb_endpoint_description_t usb_hid_generic_poll_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_HID,
-	.interface_subclass = -1,
-	.interface_protocol = -1,
-	.flags = 0
-};
-
-const char *HID_GENERIC_FUN_NAME = "hid";
-const char *HID_GENERIC_CATEGORY = "hid";
-
-static size_t usb_generic_hid_get_event_length(ddf_fun_t *fun);
-static errno_t usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
-    size_t size, size_t *act_size, int *event_nr, unsigned int flags);
-static errno_t usb_generic_hid_client_connected(ddf_fun_t *fun);
-static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun);
-static errno_t usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
-    size_t size, size_t *actual_size);
-
-static usbhid_iface_t usb_generic_iface = {
-	.get_event = usb_generic_hid_get_event,
-	.get_event_length = usb_generic_hid_get_event_length,
-	.get_report_descriptor_length = usb_generic_get_report_descriptor_length,
-	.get_report_descriptor = usb_generic_get_report_descriptor
-};
-
-static ddf_dev_ops_t usb_generic_hid_ops = {
-	.interfaces[USBHID_DEV_IFACE] = &usb_generic_iface,
-	.open = usb_generic_hid_client_connected
-};
-
-/** Return hid_dev_t * for generic HID function node.
- *
- * For the generic HID subdriver the 'hid' function has usb_hid_gen_fun_t
- * as soft state. Through that we can get to the usb_hid_dev_t.
- */
-static usb_hid_dev_t *fun_hid_dev(ddf_fun_t *fun)
-{
-	return ((usb_hid_gen_fun_t *)ddf_fun_data_get(fun))->hid_dev;
-}
-
-static size_t usb_generic_hid_get_event_length(ddf_fun_t *fun)
-{
-	usb_log_debug2("Generic HID: Get event length (fun: %p, "
-	    "fun->driver_data: %p.\n", fun, ddf_fun_data_get(fun));
-
-	const usb_hid_dev_t *hid_dev = fun_hid_dev(fun);
-
-	usb_log_debug2("hid_dev: %p, Max input report size (%zu).",
-	    hid_dev, hid_dev->max_input_report_size);
-
-	return hid_dev->max_input_report_size;
-}
-
-static errno_t usb_generic_hid_get_event(ddf_fun_t *fun, uint8_t *buffer,
-    size_t size, size_t *act_size, int *event_nr, unsigned int flags)
-{
-	usb_log_debug2("Generic HID: Get event.");
-
-	if (buffer == NULL || act_size == NULL || event_nr == NULL) {
-		usb_log_debug("No function");
-		return EINVAL;
-	}
-
-	const usb_hid_dev_t *hid_dev = fun_hid_dev(fun);
-
-	if (hid_dev->input_report_size > size) {
-		usb_log_debug("input_report_size > size (%zu, %zu)",
-		    hid_dev->input_report_size, size);
-		return EINVAL;	// TODO: other error code
-	}
-
-	/* TODO This should probably be somehow atomic. */
-	memcpy(buffer, hid_dev->input_report,
-	    hid_dev->input_report_size);
-	*act_size = hid_dev->input_report_size;
-	*event_nr = usb_hid_report_number(hid_dev);
-
-	usb_log_debug2("OK");
-
-	return EOK;
-}
-
-static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun)
-{
-	usb_log_debug("Generic HID: Get report descriptor length.");
-
-	const usb_hid_dev_t *hid_dev = fun_hid_dev(fun);
-
-	usb_log_debug2("hid_dev->report_desc_size = %zu",
-	    hid_dev->report_desc_size);
-
-	return hid_dev->report_desc_size;
-}
-
-static errno_t usb_generic_get_report_descriptor(ddf_fun_t *fun, uint8_t *desc,
-    size_t size, size_t *actual_size)
-{
-	usb_log_debug2("Generic HID: Get report descriptor.");
-
-	const usb_hid_dev_t *hid_dev = fun_hid_dev(fun);
-
-	if (hid_dev->report_desc_size > size) {
-		return EINVAL;
-	}
-
-	memcpy(desc, hid_dev->report_desc, hid_dev->report_desc_size);
-	*actual_size = hid_dev->report_desc_size;
-
-	return EOK;
-}
-
-static errno_t usb_generic_hid_client_connected(ddf_fun_t *fun)
-{
-	usb_log_debug("Generic HID: Client connected.");
-	return EOK;
-}
-
-void usb_generic_hid_deinit(usb_hid_dev_t *hid_dev, void *data)
-{
-	ddf_fun_t *fun = data;
-	if (fun == NULL)
-		return;
-
-	if (ddf_fun_unbind(fun) != EOK) {
-		usb_log_error("Failed to unbind generic hid fun.");
-		return;
-	}
-	usb_log_debug2("%s unbound.", ddf_fun_get_name(fun));
-	ddf_fun_destroy(fun);
-}
-
-errno_t usb_generic_hid_init(usb_hid_dev_t *hid_dev, void **data)
-{
-	usb_hid_gen_fun_t *hid_fun;
-
-	if (hid_dev == NULL) {
-		return EINVAL;
-	}
-
-	/* Create the exposed function. */
-	usb_log_debug("Creating DDF function %s...", HID_GENERIC_FUN_NAME);
-	ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
-	    fun_exposed, HID_GENERIC_FUN_NAME);
-	if (fun == NULL) {
-		usb_log_error("Could not create DDF function node.");
-		return ENOMEM;
-	}
-
-	/* Create softstate */
-	hid_fun = ddf_fun_data_alloc(fun, sizeof(usb_hid_gen_fun_t));
-	hid_fun->hid_dev = hid_dev;
-	ddf_fun_set_ops(fun, &usb_generic_hid_ops);
-
-	errno_t rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		usb_log_error("Could not bind DDF function: %s.",
-		    str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	usb_log_debug("HID function created. Handle: %" PRIun "",
-	    ddf_fun_get_handle(fun));
-	*data = fun;
-
-	return EOK;
-}
-
-bool usb_generic_hid_polling_callback(usb_hid_dev_t *hid_dev, void *data)
-{
-	/* Continue polling until the device is about to be removed. */
-	return true;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/generic/hiddev.h
===================================================================
--- uspace/drv/hid/usbhid/generic/hiddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID driver API.
- */
-
-#ifndef USB_HID_HIDDDEV_H_
-#define USB_HID_HIDDDEV_H_
-
-#include <usb/dev/driver.h>
-#include "../usbhid.h"
-
-extern const usb_endpoint_description_t
-    usb_hid_generic_poll_endpoint_description;
-
-extern const char *HID_GENERIC_FUN_NAME;
-extern const char *HID_GENERIC_CATEGORY;
-
-/** The USB HID generic 'hid' function softstate */
-typedef struct {
-	usb_hid_dev_t *hid_dev;
-} usb_hid_gen_fun_t;
-
-extern errno_t usb_generic_hid_init(usb_hid_dev_t *, void **);
-extern void usb_generic_hid_deinit(usb_hid_dev_t *, void *);
-extern bool usb_generic_hid_polling_callback(usb_hid_dev_t *, void *);
-
-#endif // USB_HID_HIDDDEV_H_
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/conv.c
===================================================================
--- uspace/drv/hid/usbhid/kbd/conv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,187 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB scancode parser.
- */
-
-#include <io/keycode.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <usb/debug.h>
-#include "conv.h"
-
-/**
- * Mapping between USB HID key codes (from HID Usage Tables) and corresponding
- * HelenOS key codes.
- */
-static int scanmap_simple[255] = {
-	[0x04] = KC_A,
-	[0x05] = KC_B,
-	[0x06] = KC_C,
-	[0x07] = KC_D,
-	[0x08] = KC_E,
-	[0x09] = KC_F,
-	[0x0a] = KC_G,
-	[0x0b] = KC_H,
-	[0x0c] = KC_I,
-	[0x0d] = KC_J,
-	[0x0e] = KC_K,
-	[0x0f] = KC_L,
-	[0x10] = KC_M,
-	[0x11] = KC_N,
-	[0x12] = KC_O,
-	[0x13] = KC_P,
-	[0x14] = KC_Q,
-	[0x15] = KC_R,
-	[0x16] = KC_S,
-	[0x17] = KC_T,
-	[0x18] = KC_U,
-	[0x19] = KC_V,
-	[0x1a] = KC_W,
-	[0x1b] = KC_X,
-	[0x1c] = KC_Y,
-	[0x1d] = KC_Z,
-
-	[0x1e] = KC_1,
-	[0x1f] = KC_2,
-	[0x20] = KC_3,
-	[0x21] = KC_4,
-	[0x22] = KC_5,
-	[0x23] = KC_6,
-	[0x24] = KC_7,
-	[0x25] = KC_8,
-	[0x26] = KC_9,
-	[0x27] = KC_0,
-
-	[0x28] = KC_ENTER,
-	[0x29] = KC_ESCAPE,
-	[0x2a] = KC_BACKSPACE,
-	[0x2b] = KC_TAB,
-	[0x2c] = KC_SPACE,
-
-	[0x2d] = KC_MINUS,
-	[0x2e] = KC_EQUALS,
-	[0x2f] = KC_LBRACKET,
-	[0x30] = KC_RBRACKET,
-	[0x31] = KC_BACKSLASH,
-	[0x32] = KC_HASH,
-	[0x33] = KC_SEMICOLON,
-	[0x34] = KC_QUOTE,
-	[0x35] = KC_BACKTICK,
-	[0x36] = KC_COMMA,
-	[0x37] = KC_PERIOD,
-	[0x38] = KC_SLASH,
-
-	[0x39] = KC_CAPS_LOCK,
-
-	[0x3a] = KC_F1,
-	[0x3b] = KC_F2,
-	[0x3c] = KC_F3,
-	[0x3d] = KC_F4,
-	[0x3e] = KC_F5,
-	[0x3f] = KC_F6,
-	[0x40] = KC_F7,
-	[0x41] = KC_F8,
-	[0x42] = KC_F9,
-	[0x43] = KC_F10,
-	[0x44] = KC_F11,
-	[0x45] = KC_F12,
-
-	[0x46] = KC_PRTSCR,
-	[0x47] = KC_SCROLL_LOCK,
-	[0x48] = KC_PAUSE,
-	[0x49] = KC_INSERT,
-	[0x4a] = KC_HOME,
-	[0x4b] = KC_PAGE_UP,
-	[0x4c] = KC_DELETE,
-	[0x4d] = KC_END,
-	[0x4e] = KC_PAGE_DOWN,
-	[0x4f] = KC_RIGHT,
-	[0x50] = KC_LEFT,
-	[0x51] = KC_DOWN,
-	[0x52] = KC_UP,
-
-	[0x53] = KC_NUM_LOCK,
-	[0x54] = KC_NSLASH,
-	[0x55] = KC_NTIMES,
-	[0x56] = KC_NMINUS,
-	[0x57] = KC_NPLUS,
-	[0x58] = KC_NENTER,
-	[0x59] = KC_N1,
-	[0x5a] = KC_N2,
-	[0x5b] = KC_N3,
-	[0x5c] = KC_N4,
-	[0x5d] = KC_N5,
-	[0x5e] = KC_N6,
-	[0x5f] = KC_N7,
-	[0x60] = KC_N8,
-	[0x61] = KC_N9,
-	[0x62] = KC_N0,
-	[0x63] = KC_NPERIOD,
-
-	[0x64] = KC_BACKSLASH,
-
-	[0x9a] = KC_SYSREQ,
-
-	[0xe0] = KC_LCTRL,
-	[0xe1] = KC_LSHIFT,
-	[0xe2] = KC_LALT,
-	[0xe4] = KC_RCTRL,
-	[0xe5] = KC_RSHIFT,
-	[0xe6] = KC_RALT,
-};
-
-/**
- * Translate USB HID key codes (from HID Usage Tables) to generic key codes
- * recognized by HelenOS.
- *
- * @param scancode USB HID key code (from HID Usage Tables).
- *
- * @retval HelenOS key code corresponding to the given USB HID key code.
- */
-unsigned int usbhid_parse_scancode(int scancode)
-{
-	unsigned int key;
-	int *map = scanmap_simple;
-	size_t map_length = sizeof(scanmap_simple) / sizeof(int);
-
-	if ((scancode < 0) || ((size_t) scancode >= map_length))
-		return -1;
-
-	key = map[scancode];
-
-	return key;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/conv.h
===================================================================
--- uspace/drv/hid/usbhid/kbd/conv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB scancode parser.
- */
-
-#ifndef USB_HID_CONV_H_
-#define USB_HID_CONV_H_
-
-unsigned int usbhid_parse_scancode(int scancode);
-
-#endif /* USB_HID_CONV_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/kbddev.c
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,806 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB HID keyboard device structure and API.
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-
-#include <io/keycode.h>
-#include <io/kbd_event.h>
-#include <abi/ipc/methods.h>
-#include <ipc/kbdev.h>
-#include <async.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-
-#include <ddf/log.h>
-
-#include <usb/usb.h>
-#include <usb/dev/dp.h>
-#include <usb/dev/request.h>
-#include <usb/hid/hid.h>
-#include <usb/dev/pipes.h>
-#include <usb/debug.h>
-#include <usb/hid/hidparser.h>
-#include <usb/classes/classes.h>
-#include <usb/hid/usages/core.h>
-#include <usb/hid/request.h>
-#include <usb/hid/hidreport.h>
-#include <usb/hid/usages/led.h>
-
-#include <usb/dev/driver.h>
-
-#include "kbddev.h"
-
-#include "conv.h"
-#include "kbdrepeat.h"
-
-#include "../usbhid.h"
-
-static void default_connection_handler(ddf_fun_t *, ipc_call_t *);
-static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler };
-
-static const unsigned DEFAULT_ACTIVE_MODS = KM_NUM_LOCK;
-
-static const uint8_t ERROR_ROLLOVER = 1;
-
-/** Default idle rate for keyboards. */
-static const uint8_t IDLE_RATE = 0;
-
-/** Delay before a pressed key starts auto-repeating. */
-static const unsigned int DEFAULT_DELAY_BEFORE_FIRST_REPEAT = 500 * 1000;
-
-/** Delay between two repeats of a pressed key when auto-repeating. */
-static const unsigned int DEFAULT_REPEAT_DELAY = 50 * 1000;
-
-/** Keyboard polling endpoint description for boot protocol class. */
-const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_HID,
-	.interface_subclass = USB_HID_SUBCLASS_BOOT,
-	.interface_protocol = USB_HID_PROTOCOL_KEYBOARD,
-	.flags = 0
-};
-
-const char *HID_KBD_FUN_NAME = "keyboard";
-const char *HID_KBD_CATEGORY_NAME = "keyboard";
-
-static void usb_kbd_set_led(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev);
-
-static const uint8_t USB_KBD_BOOT_REPORT_DESCRIPTOR[] = {
-	0x05, 0x01,  /* Usage Page (Generic Desktop), */
-	0x09, 0x06,  /* Usage (Keyboard), */
-	0xA1, 0x01,  /* Collection (Application), */
-	0x75, 0x01,  /*   Report Size (1), */
-	0x95, 0x08,  /*   Report Count (8), */
-	0x05, 0x07,  /*   Usage Page (Key Codes); */
-	0x19, 0xE0,  /*   Usage Minimum (224), */
-	0x29, 0xE7,  /*   Usage Maximum (231), */
-	0x15, 0x00,  /*   Logical Minimum (0), */
-	0x25, 0x01,  /*   Logical Maximum (1), */
-	0x81, 0x02,  /*   Input (Data, Variable, Absolute),  ; Modifier byte */
-	0x95, 0x01,  /*   Report Count (1), */
-	0x75, 0x08,  /*   Report Size (8), */
-	0x81, 0x01,  /*   Input (Constant),                  ; Reserved byte */
-	0x95, 0x05,  /*   Report Count (5), */
-	0x75, 0x01,  /*   Report Size (1), */
-	0x05, 0x08,  /*   Usage Page (Page# for LEDs), */
-	0x19, 0x01,  /*   Usage Minimum (1), */
-	0x29, 0x05,  /*   Usage Maxmimum (5), */
-	0x91, 0x02,  /*   Output (Data, Variable, Absolute),  ; LED report */
-	0x95, 0x01,  /*   Report Count (1), */
-	0x75, 0x03,  /*   Report Size (3), */
-	0x91, 0x01,  /*   Output (Constant),            ; LED report padding */
-	0x95, 0x06,  /*   Report Count (6), */
-	0x75, 0x08,  /*   Report Size (8), */
-	0x15, 0x00,  /*   Logical Minimum (0), */
-	0x25, 0xff,  /*   Logical Maximum (255), */
-	0x05, 0x07,  /*   Usage Page (Key Codes), */
-	0x19, 0x00,  /*   Usage Minimum (0), */
-	0x29, 0xff,  /*   Usage Maximum (255), */
-	0x81, 0x00,  /*   Input (Data, Array),   ; Key arrays (6 bytes) */
-	0xC0         /* End Collection */
-};
-
-typedef enum usb_kbd_flags {
-	USB_KBD_STATUS_UNINITIALIZED = 0,
-	USB_KBD_STATUS_INITIALIZED = 1,
-	USB_KBD_STATUS_TO_DESTROY = -1
-} usb_kbd_flags;
-
-/* IPC method handler                                                         */
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * Currently recognizes only two methods (IPC_M_CONNECT_TO_ME and KBDEV_SET_IND)
- * IPC_M_CONNECT_TO_ME assumes the caller is the console and  stores IPC
- * session to it for later use by the driver to notify about key events.
- * KBDEV_SET_IND sets LED keyboard indicators.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	const sysarg_t method = ipc_get_imethod(icall);
-	usb_kbd_t *kbd_dev = ddf_fun_data_get(fun);
-	async_sess_t *sess;
-
-	switch (method) {
-	case KBDEV_SET_IND:
-		kbd_dev->mods = ipc_get_arg1(icall);
-		usb_kbd_set_led(kbd_dev->hid_dev, kbd_dev);
-		async_answer_0(icall, EOK);
-		break;
-		/*
-		 * This might be ugly but async_callback_receive_start makes no
-		 * difference for incorrect call and malloc failure.
-		 */
-	case IPC_M_CONNECT_TO_ME:
-		sess = async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-		/* Probably ENOMEM error, try again. */
-		if (sess == NULL) {
-			usb_log_warning(
-			    "Failed to create start console session.\n");
-			async_answer_0(icall, EAGAIN);
-			break;
-		}
-		if (kbd_dev->client_sess == NULL) {
-			kbd_dev->client_sess = sess;
-			usb_log_debug("%s: OK", __FUNCTION__);
-			async_answer_0(icall, EOK);
-		} else {
-			usb_log_error("%s: console session already set",
-			    __FUNCTION__);
-			async_answer_0(icall, ELIMIT);
-		}
-		break;
-	default:
-		usb_log_error("%s: Unknown method: %d.",
-		    __FUNCTION__, (int) method);
-		async_answer_0(icall, EINVAL);
-		break;
-	}
-
-}
-
-/* Key processing functions                                                   */
-
-/**
- * Handles turning of LED lights on and off.
- *
- * As with most other keyboards, the LED indicators in USB keyboards are
- * driven by software. When state of some modifier changes, the input server
- * will call us and tell us to update the LED state and what the new state
- * should be.
- *
- * This functions sets the LED lights according to current settings of modifiers
- * kept in the keyboard device structure.
- *
- * @param kbd_dev Keyboard device structure.
- */
-static void usb_kbd_set_led(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev)
-{
-	if (kbd_dev->output_size == 0) {
-		return;
-	}
-
-	/* Reset the LED data. */
-	memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t));
-	usb_log_debug("Creating output report:");
-
-	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    &hid_dev->report, NULL, kbd_dev->led_path,
-	    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-	    USB_HID_REPORT_TYPE_OUTPUT);
-
-	while (field != NULL) {
-
-		if ((field->usage == USB_HID_LED_NUM_LOCK) &&
-		    (kbd_dev->mods & KM_NUM_LOCK)) {
-			field->value = 1;
-		}
-
-		if ((field->usage == USB_HID_LED_CAPS_LOCK) &&
-		    (kbd_dev->mods & KM_CAPS_LOCK)) {
-			field->value = 1;
-		}
-
-		if ((field->usage == USB_HID_LED_SCROLL_LOCK) &&
-		    (kbd_dev->mods & KM_SCROLL_LOCK)) {
-			field->value = 1;
-		}
-
-		field = usb_hid_report_get_sibling(
-		    &hid_dev->report, field, kbd_dev->led_path,
-		    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_OUTPUT);
-	}
-
-	// TODO: what about the Report ID?
-	errno_t rc = usb_hid_report_output_translate(&hid_dev->report, 0,
-	    kbd_dev->output_buffer, kbd_dev->output_size);
-
-	if (rc != EOK) {
-		usb_log_warning("Could not translate LED output to output"
-		    "report.\n");
-		return;
-	}
-
-	usb_log_debug("Output report buffer: %s",
-	    usb_debug_str_buffer(kbd_dev->output_buffer, kbd_dev->output_size,
-	    0));
-
-	rc = usbhid_req_set_report(
-	    usb_device_get_default_pipe(hid_dev->usb_dev),
-	    usb_device_get_iface_number(hid_dev->usb_dev),
-	    USB_HID_REPORT_TYPE_OUTPUT,
-	    kbd_dev->output_buffer, kbd_dev->output_size);
-	if (rc != EOK) {
-		usb_log_warning("Failed to set kbd indicators.");
-	}
-}
-
-/** Send key event.
- *
- * @param kbd_dev Keyboard device structure.
- * @param type Type of the event (press / release). Recognized values:
- *             KEY_PRESS, KEY_RELEASE
- * @param key Key code
- */
-void usb_kbd_push_ev(usb_kbd_t *kbd_dev, int type, unsigned key)
-{
-	usb_log_debug2("Sending kbdev event %d/%d to the console", type, key);
-	if (kbd_dev->client_sess == NULL) {
-		usb_log_warning(
-		    "Connection to console not ready, key discarded.\n");
-		return;
-	}
-
-	async_exch_t *exch = async_exchange_begin(kbd_dev->client_sess);
-	if (exch != NULL) {
-		async_msg_2(exch, KBDEV_EVENT, type, key);
-		async_exchange_end(exch);
-	} else {
-		usb_log_warning("Failed to send key to console.");
-	}
-}
-
-static inline int usb_kbd_is_lock(unsigned int key_code)
-{
-	return (key_code == KC_NUM_LOCK ||
-	    key_code == KC_SCROLL_LOCK ||
-	    key_code == KC_CAPS_LOCK);
-}
-
-static size_t find_in_array_int32(int32_t val, int32_t *arr, size_t arr_size)
-{
-	for (size_t i = 0; i < arr_size; i++) {
-		if (arr[i] == val) {
-			return i;
-		}
-	}
-
-	return (size_t) -1;
-}
-
-/**
- * Checks if some keys were pressed or released and generates key events.
- *
- * An event is created only when key is pressed or released. Besides handling
- * the events (usb_kbd_push_ev()), the auto-repeat fibril is notified about
- * key presses and releases (see usb_kbd_repeat_start() and
- * usb_kbd_repeat_stop()).
- *
- * @param kbd_dev Keyboard device structure.
- * @param key_codes Parsed keyboard report - codes of currently pressed keys
- *                  according to HID Usage Tables.
- * @param count Number of key codes in report (size of the report).
- *
- * @sa usb_kbd_push_ev(), usb_kbd_repeat_start(), usb_kbd_repeat_stop()
- */
-static void usb_kbd_check_key_changes(usb_hid_dev_t *hid_dev,
-    usb_kbd_t *kbd_dev)
-{
-
-	/*
-	 * First of all, check if the kbd have reported phantom state.
-	 *
-	 * As there is no way to distinguish keys from modifiers, we do not have
-	 * a way to check that 'all keys report Error Rollover'. We thus check
-	 * if there is at least one such error and in such case we ignore the
-	 * whole input report.
-	 */
-	size_t i = find_in_array_int32(ERROR_ROLLOVER, kbd_dev->keys,
-	    kbd_dev->key_count);
-	if (i != (size_t) -1) {
-		usb_log_error("Detected phantom state.");
-		return;
-	}
-
-	/*
-	 * Key releases
-	 */
-	for (i = 0; i < kbd_dev->key_count; i++) {
-		const int32_t old_key = kbd_dev->keys_old[i];
-		/* Find the old key among currently pressed keys. */
-		const size_t pos = find_in_array_int32(old_key, kbd_dev->keys,
-		    kbd_dev->key_count);
-		/* If the key was not found, we need to signal release. */
-		if (pos == (size_t) -1) {
-			const unsigned key = usbhid_parse_scancode(old_key);
-			if (!usb_kbd_is_lock(key)) {
-				usb_kbd_repeat_stop(kbd_dev, key);
-			}
-			usb_kbd_push_ev(kbd_dev, KEY_RELEASE, key);
-			usb_log_debug2("Key released: %u "
-			    "(USB code %" PRIu32 ")\n", key, old_key);
-		}
-	}
-
-	/*
-	 * Key presses
-	 */
-	for (i = 0; i < kbd_dev->key_count; ++i) {
-		const int32_t new_key = kbd_dev->keys[i];
-		/* Find the new key among already pressed keys. */
-		const size_t pos = find_in_array_int32(new_key,
-		    kbd_dev->keys_old, kbd_dev->key_count);
-		/* If the key was not found, we need to signal press. */
-		if (pos == (size_t) -1) {
-			unsigned key = usbhid_parse_scancode(kbd_dev->keys[i]);
-			if (!usb_kbd_is_lock(key)) {
-				usb_kbd_repeat_start(kbd_dev, key);
-			}
-			usb_kbd_push_ev(kbd_dev, KEY_PRESS, key);
-			usb_log_debug2("Key pressed: %u "
-			    "(USB code %" PRIu32 ")\n", key, new_key);
-		}
-	}
-
-	memcpy(kbd_dev->keys_old, kbd_dev->keys, kbd_dev->key_count * 4);
-
-	// TODO Get rid of this
-	char key_buffer[512];
-	ddf_dump_buffer(key_buffer, 512,
-	    kbd_dev->keys_old, 4, kbd_dev->key_count, 0);
-	usb_log_debug2("Stored keys %s.", key_buffer);
-}
-
-/* General kbd functions                                                      */
-
-/**
- * Processes data received from the device in form of report.
- *
- * This function uses the HID report parser to translate the data received from
- * the device into generic USB HID key codes and into generic modifiers bitmap.
- * The parser then calls the given callback (usb_kbd_process_keycodes()).
- *
- * @note Currently, only the boot protocol is supported.
- *
- * @param kbd_dev Keyboard device structure (must be initialized).
- * @param buffer Data from the keyboard (i.e. the report).
- * @param actual_size Size of the data from keyboard (report size) in bytes.
- *
- * @sa usb_kbd_process_keycodes(), usb_hid_boot_keyboard_input_report(),
- *     usb_hid_parse_report().
- */
-static void usb_kbd_process_data(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev)
-{
-	assert(hid_dev != NULL);
-	assert(kbd_dev != NULL);
-
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	if (path == NULL) {
-		usb_log_error("Failed to create hid/kbd report path.");
-		return;
-	}
-
-	errno_t ret =
-	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
-	if (ret != EOK) {
-		usb_log_error("Failed to append to hid/kbd report path.");
-		return;
-	}
-
-	usb_hid_report_path_set_report_id(path, hid_dev->report_id);
-
-	/* Fill in the currently pressed keys. */
-	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    &hid_dev->report, NULL, path,
-	    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-	    USB_HID_REPORT_TYPE_INPUT);
-	unsigned i = 0;
-
-	while (field != NULL) {
-		usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)",
-		    field, field->value, field->usage);
-
-		assert(i < kbd_dev->key_count);
-
-		/* Save the key usage. */
-		if (field->value != 0) {
-			kbd_dev->keys[i] = field->usage;
-		} else {
-			kbd_dev->keys[i] = 0;
-		}
-		usb_log_debug2("Saved %u. key usage %d", i, kbd_dev->keys[i]);
-
-		++i;
-		field = usb_hid_report_get_sibling(
-		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END |
-		    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_INPUT);
-	}
-
-	usb_hid_report_path_free(path);
-
-	usb_kbd_check_key_changes(hid_dev, kbd_dev);
-}
-
-/* HID/KBD structure manipulation                                             */
-
-static errno_t kbd_dev_init(usb_kbd_t *kbd_dev, usb_hid_dev_t *hid_dev)
-{
-	assert(kbd_dev);
-	assert(hid_dev);
-
-	/* Default values */
-	fibril_mutex_initialize(&kbd_dev->repeat_mtx);
-	kbd_dev->initialized = USB_KBD_STATUS_UNINITIALIZED;
-
-	/* Store link to HID device */
-	kbd_dev->hid_dev = hid_dev;
-
-	/* Modifiers and locks */
-	kbd_dev->mods = DEFAULT_ACTIVE_MODS;
-
-	/* Autorepeat */
-	kbd_dev->repeat.delay_before = DEFAULT_DELAY_BEFORE_FIRST_REPEAT;
-	kbd_dev->repeat.delay_between = DEFAULT_REPEAT_DELAY;
-
-	// TODO: make more general
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	if (path == NULL) {
-		usb_log_error("Failed to create kbd report path.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	errno_t ret =
-	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0);
-	if (ret != EOK) {
-		usb_log_error("Failed to append item to kbd report path.");
-		usb_hid_report_path_free(path);
-		usb_kbd_destroy(kbd_dev);
-		return ret;
-	}
-
-	usb_hid_report_path_set_report_id(path, 0);
-
-	kbd_dev->key_count =
-	    usb_hid_report_size(&hid_dev->report, 0, USB_HID_REPORT_TYPE_INPUT);
-
-	usb_hid_report_path_free(path);
-
-	usb_log_debug("Size of the input report: %zu", kbd_dev->key_count);
-
-	kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t));
-	if (kbd_dev->keys == NULL) {
-		usb_log_error("Failed to allocate key buffer.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	kbd_dev->keys_old = calloc(kbd_dev->key_count, sizeof(int32_t));
-	if (kbd_dev->keys_old == NULL) {
-		usb_log_error("Failed to allocate old_key buffer.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	/* Output report */
-	kbd_dev->output_size = 0;
-	kbd_dev->output_buffer = usb_hid_report_output(&hid_dev->report,
-	    &kbd_dev->output_size, 0);
-	if (kbd_dev->output_buffer == NULL) {
-		usb_log_error("Error creating output report buffer.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	usb_log_debug("Output buffer size: %zu", kbd_dev->output_size);
-
-	kbd_dev->led_path = usb_hid_report_path();
-	if (kbd_dev->led_path == NULL) {
-		usb_log_error("Failed to create kbd led report path.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	ret = usb_hid_report_path_append_item(
-	    kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0);
-	if (ret != EOK) {
-		usb_log_error("Failed to append to kbd/led report path.");
-		usb_kbd_destroy(kbd_dev);
-		return ret;
-	}
-
-	kbd_dev->led_output_size = usb_hid_report_size(
-	    &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT);
-
-	usb_log_debug("Output report size (in items): %zu",
-	    kbd_dev->led_output_size);
-
-	kbd_dev->led_data = calloc(kbd_dev->led_output_size, sizeof(int32_t));
-	if (kbd_dev->led_data == NULL) {
-		usb_log_error("Error creating buffer for LED output report.");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-
-	/*
-	 * Set LEDs according to initial setup.
-	 * Set Idle rate
-	 */
-	usb_kbd_set_led(hid_dev, kbd_dev);
-
-	usbhid_req_set_idle(usb_device_get_default_pipe(hid_dev->usb_dev),
-	    usb_device_get_iface_number(hid_dev->usb_dev), IDLE_RATE);
-
-	kbd_dev->initialized = USB_KBD_STATUS_INITIALIZED;
-	usb_log_debug("HID/KBD device structure initialized.");
-
-	return EOK;
-}
-
-/* API functions                                                              */
-
-/**
- * Initialization of the USB/HID keyboard structure.
- *
- * This functions initializes required structures from the device's descriptors.
- *
- * During initialization, the keyboard is switched into boot protocol, the idle
- * rate is set to 0 (infinity), resulting in the keyboard only reporting event
- * when a key is pressed or released. Finally, the LED lights are turned on
- * according to the default setup of lock keys.
- *
- * @note By default, the keyboards is initialized with Num Lock turned on and
- *       other locks turned off.
- *
- * @param kbd_dev Keyboard device structure to be initialized.
- * @param dev DDF device structure of the keyboard.
- *
- * @retval EOK if successful.
- * @retval EINVAL if some parameter is not given.
- * @return Other value inherited from function usbhid_dev_init().
- */
-errno_t usb_kbd_init(usb_hid_dev_t *hid_dev, void **data)
-{
-	usb_log_debug("Initializing HID/KBD structure...");
-
-	if (hid_dev == NULL) {
-		usb_log_error(
-		    "Failed to init keyboard structure: no structure given.\n");
-		return EINVAL;
-	}
-
-	/* Create the exposed function. */
-	usb_log_debug("Creating DDF function %s...", HID_KBD_FUN_NAME);
-	ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
-	    fun_exposed, HID_KBD_FUN_NAME);
-	if (fun == NULL) {
-		usb_log_error("Could not create DDF function node.");
-		return ENOMEM;
-	}
-
-	usb_kbd_t *kbd_dev = ddf_fun_data_alloc(fun, sizeof(usb_kbd_t));
-	if (kbd_dev == NULL) {
-		usb_log_error("Failed to allocate KBD device structure.");
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	errno_t ret = kbd_dev_init(kbd_dev, hid_dev);
-	if (ret != EOK) {
-		usb_log_error("Failed to initialize KBD device  structure.");
-		ddf_fun_destroy(fun);
-		return ret;
-	}
-
-	/*
-	 * Store the initialized HID device and HID ops
-	 * to the DDF function.
-	 */
-	ddf_fun_set_ops(fun, &kbdops);
-
-	ret = ddf_fun_bind(fun);
-	if (ret != EOK) {
-		usb_log_error("Could not bind DDF function: %s.",
-		    str_error(ret));
-		usb_kbd_destroy(kbd_dev);
-		ddf_fun_destroy(fun);
-		return ret;
-	}
-
-	usb_log_debug("%s function created. Handle: %" PRIun "",
-	    HID_KBD_FUN_NAME, ddf_fun_get_handle(fun));
-
-	usb_log_debug("Adding DDF function to category %s...",
-	    HID_KBD_CATEGORY_NAME);
-	ret = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY_NAME);
-	if (ret != EOK) {
-		usb_log_error(
-		    "Could not add DDF function to category %s: %s.\n",
-		    HID_KBD_CATEGORY_NAME, str_error(ret));
-		usb_kbd_destroy(kbd_dev);
-		if (ddf_fun_unbind(fun) == EOK) {
-			ddf_fun_destroy(fun);
-		} else {
-			usb_log_error(
-			    "Failed to unbind `%s', will not destroy.\n",
-			    ddf_fun_get_name(fun));
-		}
-		return ret;
-	}
-
-	/* Create new fibril for auto-repeat. */
-	fid_t fid = fibril_create(usb_kbd_repeat_fibril, kbd_dev);
-	if (fid == 0) {
-		usb_log_error("Failed to start fibril for KBD auto-repeat");
-		usb_kbd_destroy(kbd_dev);
-		return ENOMEM;
-	}
-	fibril_add_ready(fid);
-	kbd_dev->fun = fun;
-	/* Save the KBD device structure into the HID device structure. */
-	*data = kbd_dev;
-
-	return EOK;
-}
-
-bool usb_kbd_polling_callback(usb_hid_dev_t *hid_dev, void *data)
-{
-	if (hid_dev == NULL || data == NULL) {
-		/* This means something serious */
-		return false;
-	}
-
-	usb_kbd_t *kbd_dev = data;
-	// TODO: add return value from this function
-	usb_kbd_process_data(hid_dev, kbd_dev);
-
-	/* Continue polling until the device is about to be removed. */
-	return true;
-}
-
-int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev)
-{
-	return (kbd_dev->initialized == USB_KBD_STATUS_INITIALIZED);
-}
-
-int usb_kbd_is_ready_to_destroy(const usb_kbd_t *kbd_dev)
-{
-	return (kbd_dev->initialized == USB_KBD_STATUS_TO_DESTROY);
-}
-
-/**
- * Properly destroys the USB/HID keyboard structure.
- *
- * @param kbd_dev Pointer to the structure to be destroyed.
- */
-void usb_kbd_destroy(usb_kbd_t *kbd_dev)
-{
-	if (kbd_dev == NULL) {
-		return;
-	}
-
-	/* Hangup session to the console. */
-	if (kbd_dev->client_sess)
-		async_hangup(kbd_dev->client_sess);
-
-	//assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));
-	// FIXME - the fibril_mutex_is_locked may not cause
-	// fibril scheduling
-	while (fibril_mutex_is_locked(&kbd_dev->repeat_mtx)) {
-	}
-
-	/* Free all buffers. */
-	free(kbd_dev->keys);
-	free(kbd_dev->keys_old);
-	free(kbd_dev->led_data);
-
-	usb_hid_report_path_free(kbd_dev->led_path);
-	usb_hid_report_output_free(kbd_dev->output_buffer);
-
-	if (kbd_dev->fun) {
-		if (ddf_fun_unbind(kbd_dev->fun) != EOK) {
-			usb_log_warning("Failed to unbind %s.",
-			    ddf_fun_get_name(kbd_dev->fun));
-		} else {
-			usb_log_debug2("%s unbound.",
-			    ddf_fun_get_name(kbd_dev->fun));
-			ddf_fun_destroy(kbd_dev->fun);
-		}
-	}
-}
-
-void usb_kbd_deinit(usb_hid_dev_t *hid_dev, void *data)
-{
-	if (data != NULL) {
-		usb_kbd_t *kbd_dev = data;
-		if (usb_kbd_is_initialized(kbd_dev)) {
-			kbd_dev->initialized = USB_KBD_STATUS_TO_DESTROY;
-			/* Wait for autorepeat */
-			fibril_usleep(CHECK_DELAY);
-		}
-		usb_kbd_destroy(kbd_dev);
-	}
-}
-
-errno_t usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev);
-	errno_t rc = usb_hid_parse_report_descriptor(
-	    &hid_dev->report, USB_KBD_BOOT_REPORT_DESCRIPTOR,
-	    sizeof(USB_KBD_BOOT_REPORT_DESCRIPTOR));
-
-	if (rc != EOK) {
-		usb_log_error("Failed to parse boot report descriptor: %s",
-		    str_error(rc));
-		return rc;
-	}
-
-	rc = usbhid_req_set_protocol(
-	    usb_device_get_default_pipe(hid_dev->usb_dev),
-	    usb_device_get_iface_number(hid_dev->usb_dev),
-	    USB_HID_PROTOCOL_BOOT);
-
-	if (rc != EOK) {
-		usb_log_warning("Failed to set boot protocol to the device: "
-		    "%s\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/kbddev.h
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID keyboard device structure and API.
- */
-
-#ifndef USB_HID_KBDDEV_H_
-#define USB_HID_KBDDEV_H_
-
-#include <stdint.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <usb/hid/hid.h>
-#include <usb/hid/hidparser.h>
-#include <ddf/driver.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/driver.h>
-#include "../usbhid.h"
-#include "kbdrepeat.h"
-
-/**
- * USB/HID keyboard device type.
- *
- * Holds a reference to generic USB/HID device structure and keyboard-specific
- * data, such as currently pressed keys, modifiers and lock keys.
- *
- * Also holds a IPC session to the console (since there is now no other way to
- * communicate with it).
- *
- * @note Storing active lock keys in this structure results in their setting
- *       being device-specific.
- */
-typedef struct usb_kbd_t {
-	/** Link to HID device structure */
-	usb_hid_dev_t *hid_dev;
-
-	/** Previously pressed keys (not translated to key codes). */
-	int32_t *keys_old;
-	/** Currently pressed keys (not translated to key codes). */
-	int32_t *keys;
-	/** Count of stored keys (i.e. number of keys in the report). */
-	size_t key_count;
-	/** Currently pressed modifiers (bitmap). */
-	uint8_t modifiers;
-
-	/** Currently active modifiers including locks. Sent to the console. */
-	unsigned int mods;
-
-	/** Currently active lock keys. */
-	unsigned int lock_keys;
-
-	/** IPC session to client (for sending key events). */
-	async_sess_t *client_sess;
-
-	/** Information for auto-repeat of keys. */
-	usb_kbd_repeat_t repeat;
-
-	/** Mutex for accessing the information about auto-repeat. */
-	fibril_mutex_t repeat_mtx;
-
-	uint8_t *output_buffer;
-
-	size_t output_size;
-
-	size_t led_output_size;
-
-	usb_hid_report_path_t *led_path;
-
-	int32_t *led_data;
-
-	/** State of the structure (for checking before use).
-	 *
-	 * 0 - not initialized
-	 * 1 - initialized
-	 * -1 - ready for destroying
-	 */
-	int initialized;
-
-	/** DDF function */
-	ddf_fun_t *fun;
-} usb_kbd_t;
-
-extern const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description;
-
-extern const char *HID_KBD_FUN_NAME;
-extern const char *HID_KBD_CATEGORY;
-
-extern errno_t usb_kbd_init(usb_hid_dev_t *, void **);
-extern bool usb_kbd_polling_callback(usb_hid_dev_t *, void *);
-extern int usb_kbd_is_initialized(const usb_kbd_t *);
-extern int usb_kbd_is_ready_to_destroy(const usb_kbd_t *);
-extern void usb_kbd_destroy(usb_kbd_t *);
-extern void usb_kbd_push_ev(usb_kbd_t *, int, unsigned int);
-extern void usb_kbd_deinit(usb_hid_dev_t *, void *);
-extern errno_t usb_kbd_set_boot_protocol(usb_hid_dev_t *);
-
-#endif /* USB_HID_KBDDEV_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/kbdrepeat.c
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbdrepeat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB HID keyboard autorepeat facilities
- */
-
-#include <fibril_synch.h>
-#include <io/kbd_event.h>
-#include <io/keycode.h>
-#include <errno.h>
-
-#include <usb/debug.h>
-
-#include "kbdrepeat.h"
-#include "kbddev.h"
-
-/**
- * Main loop handling the auto-repeat of keys.
- *
- * This functions periodically checks if there is some key to be auto-repeated.
- *
- * If a new key is to be repeated, it uses the delay before first repeat stored
- * in the keyboard structure to wait until the key has to start repeating.
- *
- * If the same key is still pressed, it uses the delay between repeats stored
- * in the keyboard structure to wait until the key should be repeated.
- *
- * If the currently repeated key is not pressed any more (
- * usb_kbd_repeat_stop() was called), it stops repeating it and starts
- * checking again.
- *
- * @note For accessing the keyboard device auto-repeat information a fibril
- *       mutex (repeat_mtx) from the @a kbd structure is used.
- *
- * @param kbd Keyboard device structure.
- */
-static void usb_kbd_repeat_loop(usb_kbd_t *kbd)
-{
-	unsigned int delay = 0;
-
-	usb_log_debug("Starting autorepeat loop.");
-
-	while (true) {
-		/* Check if the kbd structure is usable. */
-		if (!usb_kbd_is_initialized(kbd)) {
-			usb_log_warning("kbd not ready, exiting autorepeat.");
-			return;
-		}
-
-		fibril_mutex_lock(&kbd->repeat_mtx);
-
-		if (kbd->repeat.key_new > 0) {
-			if (kbd->repeat.key_new == kbd->repeat.key_repeated) {
-				usb_log_debug2("Repeating key: %u.",
-				    kbd->repeat.key_repeated);
-				usb_kbd_push_ev(kbd, KEY_PRESS,
-				    kbd->repeat.key_repeated);
-				delay = kbd->repeat.delay_between;
-			} else {
-				usb_log_debug2("New key to repeat: %u.",
-				    kbd->repeat.key_new);
-				kbd->repeat.key_repeated = kbd->repeat.key_new;
-				delay = kbd->repeat.delay_before;
-			}
-		} else {
-			if (kbd->repeat.key_repeated > 0) {
-				usb_log_debug2("Stopping to repeat key: %u.",
-				    kbd->repeat.key_repeated);
-				kbd->repeat.key_repeated = 0;
-			}
-			delay = CHECK_DELAY;
-		}
-		fibril_mutex_unlock(&kbd->repeat_mtx);
-		fibril_usleep(delay);
-	}
-}
-
-/**
- * Main routine to be executed by a fibril for handling auto-repeat.
- *
- * Starts the loop for checking changes in auto-repeat.
- *
- * @param arg User-specified argument. Expects pointer to the keyboard device
- *            structure representing the keyboard.
- *
- * @retval EOK if the routine has finished.
- * @retval EINVAL if no argument is supplied.
- */
-errno_t usb_kbd_repeat_fibril(void *arg)
-{
-	usb_log_debug("Autorepeat fibril spawned.");
-
-	if (arg == NULL) {
-		usb_log_error("No device!");
-		return EINVAL;
-	}
-
-	usb_kbd_t *kbd = arg;
-
-	usb_kbd_repeat_loop(kbd);
-
-	return EOK;
-}
-
-/**
- * Start repeating particular key.
- *
- * @note Only one key is repeated at any time, so calling this function
- *       effectively cancels auto-repeat of the current repeated key (if any)
- *       and 'schedules' another key for auto-repeat.
- *
- * @param kbd Keyboard device structure.
- * @param key Key to start repeating.
- */
-void usb_kbd_repeat_start(usb_kbd_t *kbd, unsigned int key)
-{
-	fibril_mutex_lock(&kbd->repeat_mtx);
-	kbd->repeat.key_new = key;
-	fibril_mutex_unlock(&kbd->repeat_mtx);
-}
-
-/**
- * Stop repeating particular key.
- *
- * @note Only one key is repeated at any time, but this function may be called
- *       even with key that is not currently repeated (in that case nothing
- *       happens).
- *
- * @param kbd Keyboard device structure.
- * @param key Key to stop repeating.
- */
-void usb_kbd_repeat_stop(usb_kbd_t *kbd, unsigned int key)
-{
-	fibril_mutex_lock(&kbd->repeat_mtx);
-	if (key == kbd->repeat.key_new) {
-		kbd->repeat.key_new = 0;
-	}
-	fibril_mutex_unlock(&kbd->repeat_mtx);
-}
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/kbd/kbdrepeat.h
===================================================================
--- uspace/drv/hid/usbhid/kbd/kbdrepeat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID keyboard autorepeat facilities
- */
-
-#ifndef USB_HID_KBDREPEAT_H_
-#define USB_HID_KBDREPEAT_H_
-
-/** Delay between auto-repeat state checks when no key is being repeated. */
-#define CHECK_DELAY 10000
-
-struct usb_kbd_t;
-
-/**
- * Structure for keeping information needed for auto-repeat of keys.
- */
-typedef struct {
-	/** Last pressed key. */
-	unsigned int key_new;
-	/** Key to be repeated. */
-	unsigned int key_repeated;
-	/** Delay before first repeat in microseconds. */
-	unsigned int delay_before;
-	/** Delay between repeats in microseconds. */
-	unsigned int delay_between;
-} usb_kbd_repeat_t;
-
-errno_t usb_kbd_repeat_fibril(void *arg);
-
-void usb_kbd_repeat_start(struct usb_kbd_t *kbd, unsigned int key);
-
-void usb_kbd_repeat_stop(struct usb_kbd_t *kbd, unsigned int key);
-
-#endif /* USB_HID_KBDREPEAT_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/main.c
===================================================================
--- uspace/drv/hid/usbhid/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * Main routines of USB HID driver.
- */
-
-#include <ddf/driver.h>
-#include <usb/debug.h>
-#include <errno.h>
-#include <str_error.h>
-
-#include <usb/dev/driver.h>
-#include <usb/dev/poll.h>
-
-#include "usbhid.h"
-
-#define NAME "usbhid"
-
-/**
- * Callback for passing a new device to the driver.
- *
- * @note Currently, only boot-protocol keyboards are supported by this driver.
- *
- * @param dev Structure representing the new device.
- * @return Error code.
- */
-static errno_t usb_hid_device_add(usb_device_t *dev)
-{
-	usb_log_debug("%s", __FUNCTION__);
-
-	if (dev == NULL) {
-		usb_log_error("Wrong parameter given for add_device().");
-		return EINVAL;
-	}
-
-	if (usb_device_get_iface_number(dev) < 0) {
-		usb_log_error("Failed to add HID device: endpoints not found."
-		    "\n");
-		return ENOTSUP;
-	}
-	usb_hid_dev_t *hid_dev =
-	    usb_device_data_alloc(dev, sizeof(usb_hid_dev_t));
-	if (hid_dev == NULL) {
-		usb_log_error("Failed to create USB/HID device structure.");
-		return ENOMEM;
-	}
-
-	errno_t rc = usb_hid_init(hid_dev, dev);
-	if (rc != EOK) {
-		usb_log_error("Failed to initialize USB/HID device.");
-		usb_hid_deinit(hid_dev);
-		return rc;
-	}
-
-	usb_log_debug("USB/HID device structure initialized.");
-
-	/*
-	 * Start automated polling function.
-	 * This will create a separate fibril that will query the device
-	 * for the data continuously.
-	 */
-	rc = usb_polling_start(&hid_dev->polling);
-
-	if (rc != EOK) {
-		usb_log_error("Failed to start polling fibril for `%s'.",
-		    usb_device_get_name(dev));
-		usb_hid_deinit(hid_dev);
-		return rc;
-	}
-	hid_dev->running = true;
-
-	usb_log_info("HID device `%s' ready.", usb_device_get_name(dev));
-
-	return EOK;
-}
-
-static errno_t join_and_clean(usb_device_t *dev)
-{
-	assert(dev);
-	usb_hid_dev_t *hid_dev = usb_device_data_get(dev);
-	assert(hid_dev);
-
-	/* Join polling fibril (ignoring error code). */
-	usb_polling_join(&hid_dev->polling);
-
-	/* Clean up. */
-	usb_hid_deinit(hid_dev);
-	usb_log_info("%s destruction complete.", usb_device_get_name(dev));
-
-	return EOK;
-}
-
-/**
- * Callback for a device about to be removed from the driver.
- *
- * @param dev Structure representing the device.
- * @return Error code.
- */
-static errno_t usb_hid_device_remove(usb_device_t *dev)
-{
-	assert(dev);
-	usb_hid_dev_t *hid_dev = usb_device_data_get(dev);
-	assert(hid_dev);
-
-	usb_log_info("Device %s removed.", usb_device_get_name(dev));
-	return join_and_clean(dev);
-}
-
-/**
- * Callback for removing a device from the driver.
- *
- * @param dev Structure representing the device.
- * @return Error code.
- */
-static errno_t usb_hid_device_gone(usb_device_t *dev)
-{
-	assert(dev);
-	usb_hid_dev_t *hid_dev = usb_device_data_get(dev);
-	assert(hid_dev);
-
-	usb_log_info("Device %s gone.", usb_device_get_name(dev));
-	return join_and_clean(dev);
-}
-
-/** USB generic driver callbacks */
-static const usb_driver_ops_t usb_hid_driver_ops = {
-	.device_add = usb_hid_device_add,
-	.device_remove = usb_hid_device_remove,
-	.device_gone = usb_hid_device_gone,
-};
-
-/** The driver itself. */
-static const usb_driver_t usb_hid_driver = {
-	.name = NAME,
-	.ops = &usb_hid_driver_ops,
-	.endpoints = usb_hid_endpoints
-};
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS USB HID driver.\n");
-
-	log_init(NAME);
-
-	return usb_driver_main(&usb_hid_driver);
-}
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/meson.build
===================================================================
--- uspace/drv/hid/usbhid/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2010-2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbhid', 'usbdev', 'usb', 'input' ]
-includes += [ include_directories('.') ]
-src = files(
-	'main.c',
-	'usbhid.c',
-	'subdrivers.c',
-	'generic/hiddev.c',
-	'kbd/conv.c',
-	'kbd/kbddev.c',
-	'kbd/kbdrepeat.c',
-	'mouse/mousedev.c',
-	'multimedia/multimedia.c',
-	'multimedia/keymap.c',
-	'blink1/blink1.c',
-)
Index: pace/drv/hid/usbhid/mouse/mousedev.c
===================================================================
--- uspace/drv/hid/usbhid/mouse/mousedev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,458 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak, Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB Mouse driver API.
- */
-
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/hid/hid.h>
-#include <usb/hid/request.h>
-#include <usb/hid/usages/core.h>
-#include <errno.h>
-#include <async.h>
-#include <stdbool.h>
-#include <str_error.h>
-#include <ipc/mouseev.h>
-
-#include <ipc/kbdev.h>
-#include <io/keycode.h>
-
-#include "mousedev.h"
-#include "../usbhid.h"
-
-#define NAME "mouse"
-
-static void default_connection_handler(ddf_fun_t *, ipc_call_t *);
-
-static ddf_dev_ops_t ops = { .default_handler = default_connection_handler };
-
-const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_HID,
-	.interface_subclass = USB_HID_SUBCLASS_BOOT,
-	.interface_protocol = USB_HID_PROTOCOL_MOUSE,
-	.flags = 0
-};
-
-const char *HID_MOUSE_FUN_NAME = "mouse";
-const char *HID_MOUSE_CATEGORY = "mouse";
-
-/** Default idle rate for mouses. */
-static const uint8_t IDLE_RATE = 0;
-
-static const uint8_t USB_MOUSE_BOOT_REPORT_DESCRIPTOR[] = {
-	0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
-	0x09, 0x02,                    // USAGE (Mouse)
-	0xa1, 0x01,                    // COLLECTION (Application)
-	0x09, 0x01,                    //   USAGE (Pointer)
-	0xa1, 0x00,                    //   COLLECTION (Physical)
-	0x95, 0x03,                    //     REPORT_COUNT (3)
-	0x75, 0x01,                    //     REPORT_SIZE (1)
-	0x05, 0x09,                    //     USAGE_PAGE (Button)
-	0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
-	0x29, 0x03,                    //     USAGE_MAXIMUM (Button 3)
-	0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
-	0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
-	0x81, 0x02,                    //     INPUT (Data,Var,Abs)
-	0x95, 0x01,                    //     REPORT_COUNT (1)
-	0x75, 0x05,                    //     REPORT_SIZE (5)
-	0x81, 0x01,                    //     INPUT (Cnst)
-	0x75, 0x08,                    //     REPORT_SIZE (8)
-	0x95, 0x02,                    //     REPORT_COUNT (2)
-	0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
-	0x09, 0x30,                    //     USAGE (X)
-	0x09, 0x31,                    //     USAGE (Y)
-	0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
-	0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
-	0x81, 0x06,                    //     INPUT (Data,Var,Rel)
-	0xc0,                          //   END_COLLECTION
-	0xc0                           // END_COLLECTION
-};
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	usb_mouse_t *mouse_dev = ddf_fun_data_get(fun);
-
-	if (mouse_dev == NULL) {
-		usb_log_debug("%s: Missing parameters.", __FUNCTION__);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	usb_log_debug("%s: fun->name: %s", __FUNCTION__, ddf_fun_get_name(fun));
-	usb_log_debug("%s: mouse_sess: %p",
-	    __FUNCTION__, mouse_dev->mouse_sess);
-
-	async_sess_t *sess =
-	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-	if (sess != NULL) {
-		if (mouse_dev->mouse_sess == NULL) {
-			mouse_dev->mouse_sess = sess;
-			usb_log_debug("Console session to %s set ok (%p).",
-			    ddf_fun_get_name(fun), sess);
-			async_answer_0(icall, EOK);
-		} else {
-			usb_log_error("Console session to %s already set.",
-			    ddf_fun_get_name(fun));
-			async_answer_0(icall, ELIMIT);
-			async_hangup(sess);
-		}
-	} else {
-		usb_log_debug("%s: Invalid function.", __FUNCTION__);
-		async_answer_0(icall, EINVAL);
-	}
-}
-
-static const usb_hid_report_field_t *get_mouse_axis_move_field(uint8_t rid, usb_hid_report_t *report,
-    int32_t usage)
-{
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_GENERIC_DESKTOP,
-	    usage);
-
-	usb_hid_report_path_set_report_id(path, rid);
-
-	const usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    report, NULL, path, USB_HID_PATH_COMPARE_END,
-	    USB_HID_REPORT_TYPE_INPUT);
-
-	usb_hid_report_path_free(path);
-
-	return field;
-}
-
-static void usb_mouse_process_report(usb_hid_dev_t *hid_dev,
-    usb_mouse_t *mouse_dev)
-{
-	assert(mouse_dev != NULL);
-
-	if (mouse_dev->mouse_sess == NULL) {
-		usb_log_warning(NAME " No console session.");
-		return;
-	}
-
-	const usb_hid_report_field_t *move_x = get_mouse_axis_move_field(
-	    hid_dev->report_id, &hid_dev->report,
-	    USB_HIDUT_USAGE_GENERIC_DESKTOP_X);
-	const usb_hid_report_field_t *move_y = get_mouse_axis_move_field(
-	    hid_dev->report_id, &hid_dev->report,
-	    USB_HIDUT_USAGE_GENERIC_DESKTOP_Y);
-	const usb_hid_report_field_t *wheel = get_mouse_axis_move_field(
-	    hid_dev->report_id, &hid_dev->report,
-	    USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL);
-
-	bool absolute_x = move_x && !USB_HID_ITEM_FLAG_RELATIVE(move_x->item_flags);
-	bool absolute_y = move_y && !USB_HID_ITEM_FLAG_RELATIVE(move_y->item_flags);
-
-	/* Tablet shall always report both X and Y */
-	if (absolute_x != absolute_y) {
-		usb_log_error(NAME " cannot handle mix of absolute and relative mouse move.");
-		return;
-	}
-
-	int shift_x = move_x ? move_x->value : 0;
-	int shift_y = move_y ? move_y->value : 0;
-	int shift_z =  wheel ?  wheel->value : 0;
-
-	if (absolute_x && absolute_y) {
-		async_exch_t *exch =
-		    async_exchange_begin(mouse_dev->mouse_sess);
-		if (exch != NULL) {
-			async_msg_4(exch, MOUSEEV_ABS_MOVE_EVENT,
-			    shift_x, shift_y, move_x->logical_maximum, move_y->logical_maximum);
-			async_exchange_end(exch);
-		}
-
-		// Even if we move the mouse absolutely, we need to resolve wheel
-		shift_x = shift_y = 0;
-	}
-
-	if (shift_x || shift_y || shift_z) {
-		async_exch_t *exch =
-		    async_exchange_begin(mouse_dev->mouse_sess);
-		if (exch != NULL) {
-			async_msg_3(exch, MOUSEEV_MOVE_EVENT,
-			    shift_x, shift_y, shift_z);
-			async_exchange_end(exch);
-		}
-	}
-
-	/* Buttons */
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	if (path == NULL) {
-		usb_log_warning("Failed to create USB HID report path.");
-		return;
-	}
-	errno_t ret =
-	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
-	if (ret != EOK) {
-		usb_hid_report_path_free(path);
-		usb_log_warning("Failed to add buttons to report path.");
-		return;
-	}
-	usb_hid_report_path_set_report_id(path, hid_dev->report_id);
-
-	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END |
-	    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, USB_HID_REPORT_TYPE_INPUT);
-
-	while (field != NULL) {
-		usb_log_debug2(NAME " VALUE(%X) USAGE(%X)", field->value,
-		    field->usage);
-		assert(field->usage > field->usage_minimum);
-		const unsigned index = field->usage - field->usage_minimum;
-		assert(index < mouse_dev->buttons_count);
-
-		if (mouse_dev->buttons[index] != field->value) {
-			async_exch_t *exch =
-			    async_exchange_begin(mouse_dev->mouse_sess);
-			if (exch != NULL) {
-				async_req_2_0(exch, MOUSEEV_BUTTON_EVENT,
-				    field->usage, (field->value != 0) ? 1 : 0);
-				async_exchange_end(exch);
-				mouse_dev->buttons[index] = field->value;
-			}
-		}
-
-		field = usb_hid_report_get_sibling(
-		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END |
-		    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_INPUT);
-	}
-
-	usb_hid_report_path_free(path);
-}
-
-#define FUN_UNBIND_DESTROY(fun) \
-if (fun) { \
-	if (ddf_fun_unbind((fun)) == EOK) { \
-		ddf_fun_destroy((fun)); \
-	} else { \
-		usb_log_error("Could not unbind function `%s', it " \
-		    "will not be destroyed.\n", ddf_fun_get_name(fun)); \
-	} \
-} else (void) 0
-
-/** Get highest index of a button mentioned in given report.
- *
- * @param report HID report.
- * @param report_id Report id we are interested in.
- * @return Highest button mentioned in the report.
- * @retval 1 No button was mentioned.
- *
- */
-static size_t usb_mouse_get_highest_button(usb_hid_report_t *report, uint8_t report_id)
-{
-	size_t highest_button = 0;
-
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_BUTTON, 0);
-	usb_hid_report_path_set_report_id(path, report_id);
-
-	usb_hid_report_field_t *field = NULL;
-
-	/* Break from within. */
-	while (true) {
-		field = usb_hid_report_get_sibling(
-		    report, field, path,
-		    USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_INPUT);
-		/* No more buttons? */
-		if (field == NULL) {
-			break;
-		}
-
-		size_t current_button = field->usage - field->usage_minimum;
-		if (current_button > highest_button) {
-			highest_button = current_button;
-		}
-	}
-
-	usb_hid_report_path_free(path);
-
-	return highest_button;
-}
-
-static errno_t mouse_dev_init(usb_mouse_t *mouse_dev, usb_hid_dev_t *hid_dev)
-{
-	// FIXME: This may not be optimal since stupid hardware vendor may
-	// use buttons 1, 2, 3 and 6000 and we would allocate array of
-	// 6001*4B and use only 4 items in it.
-	// Since I doubt that hardware producers would do that, I think
-	// that the current solution is good enough.
-	/* Adding 1 because we will be accessing buttons[highest]. */
-	mouse_dev->buttons_count = 1 + usb_mouse_get_highest_button(
-	    &hid_dev->report, hid_dev->report_id);
-	mouse_dev->buttons = calloc(mouse_dev->buttons_count, sizeof(int32_t));
-
-	if (mouse_dev->buttons == NULL) {
-		usb_log_error(NAME ": out of memory, giving up on device!");
-		free(mouse_dev);
-		return ENOMEM;
-	}
-
-	// TODO: how to know if the device supports the request???
-	usbhid_req_set_idle(usb_device_get_default_pipe(hid_dev->usb_dev),
-	    usb_device_get_iface_number(hid_dev->usb_dev), IDLE_RATE);
-	return EOK;
-}
-
-errno_t usb_mouse_init(usb_hid_dev_t *hid_dev, void **data)
-{
-	usb_log_debug("Initializing HID/Mouse structure...");
-
-	if (hid_dev == NULL) {
-		usb_log_error("Failed to init mouse structure: no structure"
-		    " given.\n");
-		return EINVAL;
-	}
-
-	/* Create the exposed function. */
-	usb_log_debug("Creating DDF function %s...", HID_MOUSE_FUN_NAME);
-	ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev,
-	    fun_exposed, HID_MOUSE_FUN_NAME);
-	if (fun == NULL) {
-		usb_log_error("Could not create DDF function node `%s'.",
-		    HID_MOUSE_FUN_NAME);
-		return ENOMEM;
-	}
-
-	usb_mouse_t *mouse_dev = ddf_fun_data_alloc(fun, sizeof(usb_mouse_t));
-	if (mouse_dev == NULL) {
-		usb_log_error("Failed to alloc HID mouse device structure.");
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	errno_t ret = mouse_dev_init(mouse_dev, hid_dev);
-	if (ret != EOK) {
-		usb_log_error("Failed to init HID mouse device structure.");
-		return ret;
-	}
-
-	ddf_fun_set_ops(fun, &ops);
-
-	ret = ddf_fun_bind(fun);
-	if (ret != EOK) {
-		usb_log_error("Could not bind DDF function `%s': %s.",
-		    ddf_fun_get_name(fun), str_error(ret));
-		ddf_fun_destroy(fun);
-		return ret;
-	}
-
-	usb_log_debug("Adding DDF function `%s' to category %s...",
-	    ddf_fun_get_name(fun), HID_MOUSE_CATEGORY);
-	ret = ddf_fun_add_to_category(fun, HID_MOUSE_CATEGORY);
-	if (ret != EOK) {
-		usb_log_error(
-		    "Could not add DDF function to category %s: %s.\n",
-		    HID_MOUSE_CATEGORY, str_error(ret));
-		FUN_UNBIND_DESTROY(fun);
-		return ret;
-	}
-	mouse_dev->mouse_fun = fun;
-
-	/* Save the Mouse device structure into the HID device structure. */
-	*data = mouse_dev;
-
-	return EOK;
-}
-
-bool usb_mouse_polling_callback(usb_hid_dev_t *hid_dev, void *data)
-{
-	if (hid_dev == NULL || data == NULL) {
-		usb_log_error(
-		    "Missing argument to the mouse polling callback.\n");
-		return false;
-	}
-
-	usb_mouse_t *mouse_dev = data;
-	usb_mouse_process_report(hid_dev, mouse_dev);
-
-	/* Continue polling until the device is about to be removed. */
-	return true;
-}
-
-void usb_mouse_deinit(usb_hid_dev_t *hid_dev, void *data)
-{
-	if (data == NULL)
-		return;
-
-	usb_mouse_t *mouse_dev = data;
-
-	/* Hangup session to the console */
-	if (mouse_dev->mouse_sess != NULL)
-		async_hangup(mouse_dev->mouse_sess);
-
-	free(mouse_dev->buttons);
-	FUN_UNBIND_DESTROY(mouse_dev->mouse_fun);
-}
-
-errno_t usb_mouse_set_boot_protocol(usb_hid_dev_t *hid_dev)
-{
-	errno_t rc = usb_hid_parse_report_descriptor(
-	    &hid_dev->report, USB_MOUSE_BOOT_REPORT_DESCRIPTOR,
-	    sizeof(USB_MOUSE_BOOT_REPORT_DESCRIPTOR));
-
-	if (rc != EOK) {
-		usb_log_error("Failed to parse boot report descriptor: %s",
-		    str_error(rc));
-		return rc;
-	}
-
-	rc = usbhid_req_set_protocol(
-	    usb_device_get_default_pipe(hid_dev->usb_dev),
-	    usb_device_get_iface_number(hid_dev->usb_dev),
-	    USB_HID_PROTOCOL_BOOT);
-
-	if (rc != EOK) {
-		usb_log_warning("Failed to set boot protocol to the device: "
-		    "%s\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/mouse/mousedev.h
===================================================================
--- uspace/drv/hid/usbhid/mouse/mousedev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB Mouse driver API.
- */
-
-#ifndef USB_HID_MOUSEDEV_H_
-#define USB_HID_MOUSEDEV_H_
-
-#include <usb/dev/driver.h>
-#include <async.h>
-#include "../usbhid.h"
-
-/** Container for USB mouse device. */
-typedef struct {
-	/** IPC session to consumer. */
-	async_sess_t *mouse_sess;
-
-	/** Mouse buttons statuses. */
-	int32_t *buttons;
-	size_t buttons_count;
-
-	/** DDF mouse function */
-	ddf_fun_t *mouse_fun;
-} usb_mouse_t;
-
-extern const usb_endpoint_description_t usb_hid_mouse_poll_endpoint_description;
-
-extern const char *HID_MOUSE_FUN_NAME;
-extern const char *HID_MOUSE_CATEGORY;
-
-extern errno_t usb_mouse_init(usb_hid_dev_t *, void **);
-extern bool usb_mouse_polling_callback(usb_hid_dev_t *, void *);
-extern void usb_mouse_deinit(usb_hid_dev_t *, void *);
-extern errno_t usb_mouse_set_boot_protocol(usb_hid_dev_t *);
-
-#endif // USB_HID_MOUSEDEV_H_
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/multimedia/keymap.c
===================================================================
--- uspace/drv/hid/usbhid/multimedia/keymap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * UUSB multimedia key to keycode mapping.
- */
-
-#include <io/keycode.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <usb/debug.h>
-#include "keymap.h"
-
-/**
- * Mapping between USB HID multimedia usages (from HID Usage Tables) and
- * corresponding HelenOS key codes.
- *
- * Currently only Usages used by Logitech UltraX keyboard are present. All other
- * should result in 0.
- */
-static int usb_hid_keymap_consumer[0x29c] = {
-	[0xb5] = 0,       /* Scan Next Track */
-	[0xb6] = 0,       /* Scan Previous Track */
-	[0xb7] = 0,       /* Stop */
-	[0xb8] = 0,       /* Eject */
-	[0xcd] = 0,       /* Play/Pause */
-	[0xe2] = 0,       /* Mute */
-	[0xe9] = 0,       /* Volume Increment */
-	[0xea] = 0,       /* Volume Decrement */
-	[0x183] = 0,      /* AL Consumer Control Configuration */
-	[0x18a] = 0,      /* AL Email Reader */
-	[0x192] = 0,      /* AL Calculator */
-	[0x221] = 0,      /* AC Search */
-	[0x223] = 0,      /* AC Home */
-	[0x224] = 0,      /* AC Back */
-	[0x225] = 0,      /* AC Forward */
-	[0x226] = 0,      /* AC Stop */
-	[0x227] = 0,      /* AC Refresh */
-	[0x22a] = 0       /* AC Bookmarks */
-};
-
-/**
- * Translates USB HID Usages from the Consumer Page into HelenOS keycodes.
- *
- * @param usage USB HID Consumer Page Usage number.
- *
- * @retval HelenOS key code corresponding to the given USB Consumer Page Usage.
- */
-unsigned int usb_multimedia_map_usage(int usage)
-{
-	unsigned int key;
-	int *map = usb_hid_keymap_consumer;
-	size_t map_length = sizeof(usb_hid_keymap_consumer) / sizeof(int);
-
-	if ((usage < 0) || ((size_t)usage >= map_length))
-		return -1;
-
-	/* TODO What if the usage is not in the table? */
-	key = map[usage];
-
-	return key;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/multimedia/keymap.h
===================================================================
--- uspace/drv/hid/usbhid/multimedia/keymap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB multimedia key to keycode mapping.
- */
-
-#ifndef USB_HID_MULTIMEDIA_KEYMAP_H_
-#define USB_HID_MULTIMEDIA_KEYMAP_H_
-
-unsigned int usb_multimedia_map_usage(int usage);
-
-#endif /* USB_HID_MULTIMEDIA_KEYMAP_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/multimedia/multimedia.c
===================================================================
--- uspace/drv/hid/usbhid/multimedia/multimedia.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB Keyboard multimedia keys subdriver.
- */
-
-#include "multimedia.h"
-#include "../usbhid.h"
-#include "keymap.h"
-
-#include <usb/hid/hidparser.h>
-#include <usb/debug.h>
-#include <usb/hid/usages/core.h>
-#include <usb/hid/usages/consumer.h>
-
-#include <errno.h>
-#include <async.h>
-#include <str_error.h>
-
-#include <ipc/kbdev.h>
-#include <io/kbd_event.h>
-
-#define NAME  "multimedia-keys"
-
-/**
- * Logitech UltraX device type.
- */
-typedef struct usb_multimedia_t {
-	/** Previously pressed keys (not translated to key codes). */
-	//int32_t *keys_old;
-	/** Currently pressed keys (not translated to key codes). */
-	//int32_t *keys;
-	/** Count of stored keys (i.e. number of keys in the report). */
-	//size_t key_count;
-	/** IPC session to the console device (for sending key events). */
-	async_sess_t *console_sess;
-} usb_multimedia_t;
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * Currently recognizes only one method (IPC_M_CONNECT_TO_ME), in which case it
- * assumes the caller is the console and thus it stores IPC session to it for
- * later use by the driver to notify about key events.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	usb_log_debug(NAME " default_connection_handler()");
-
-	usb_multimedia_t *multim_dev = ddf_fun_data_get(fun);
-
-	async_sess_t *sess =
-	    async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-	if (sess != NULL) {
-		if (multim_dev->console_sess == NULL) {
-			multim_dev->console_sess = sess;
-			usb_log_debug(NAME " Saved session to console: %p",
-			    sess);
-			async_answer_0(icall, EOK);
-		} else
-			async_answer_0(icall, ELIMIT);
-	} else
-		async_answer_0(icall, EINVAL);
-}
-
-static ddf_dev_ops_t multimedia_ops = {
-	.default_handler = default_connection_handler
-};
-
-/**
- * Processes key events.
- *
- * @note This function was copied from AT keyboard driver and modified to suit
- *       USB keyboard.
- *
- * @note Lock keys are not sent to the console, as they are completely handled
- *       in the driver. It may, however, be required later that the driver
- *       sends also these keys to application (otherwise it cannot use those
- *       keys at all).
- *
- * @param hid_dev
- * @param multim_dev
- * @param type Type of the event (press / release). Recognized values:
- *             KEY_PRESS, KEY_RELEASE
- * @param key Key code of the key according to HID Usage Tables.
- */
-static void usb_multimedia_push_ev(
-    usb_multimedia_t *multim_dev, int type, unsigned int key)
-{
-	assert(multim_dev != NULL);
-
-	const kbd_event_t ev = {
-		.type = type,
-		.key = key,
-		.mods = 0,
-		.c = 0,
-	};
-
-	usb_log_debug2(NAME " Sending key %d to the console", ev.key);
-	if (multim_dev->console_sess == NULL) {
-		usb_log_warning(
-		    "Connection to console not ready, key discarded.\n");
-		return;
-	}
-
-	async_exch_t *exch = async_exchange_begin(multim_dev->console_sess);
-	if (exch != NULL) {
-		async_msg_4(exch, KBDEV_EVENT, ev.type, ev.key, ev.mods, ev.c);
-		async_exchange_end(exch);
-	} else {
-		usb_log_warning("Failed to send multimedia key.");
-	}
-}
-
-errno_t usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data)
-{
-	if (hid_dev == NULL || hid_dev->usb_dev == NULL) {
-		return EINVAL;
-	}
-
-	usb_log_debug(NAME " Initializing HID/multimedia structure...");
-
-	/* Create the exposed function. */
-	ddf_fun_t *fun = usb_device_ddf_fun_create(
-	    hid_dev->usb_dev, fun_exposed, NAME);
-	if (fun == NULL) {
-		usb_log_error("Could not create DDF function node.");
-		return ENOMEM;
-	}
-
-	ddf_fun_set_ops(fun, &multimedia_ops);
-
-	usb_multimedia_t *multim_dev =
-	    ddf_fun_data_alloc(fun, sizeof(usb_multimedia_t));
-	if (multim_dev == NULL) {
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	multim_dev->console_sess = NULL;
-
-	//todo Autorepeat?
-
-	errno_t rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		usb_log_error("Could not bind DDF function: %s.",
-		    str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	usb_log_debug(NAME " function created (handle: %" PRIun ").",
-	    ddf_fun_get_handle(fun));
-
-	rc = ddf_fun_add_to_category(fun, "keyboard");
-	if (rc != EOK) {
-		usb_log_error(
-		    "Could not add DDF function to category 'keyboard': %s.\n",
-		    str_error(rc));
-		if (ddf_fun_unbind(fun) != EOK) {
-			usb_log_error("Failed to unbind %s, won't destroy.",
-			    ddf_fun_get_name(fun));
-		} else {
-			ddf_fun_destroy(fun);
-		}
-		return rc;
-	}
-
-	/* Save the KBD device structure into the HID device structure. */
-	*data = fun;
-
-	usb_log_debug(NAME " HID/multimedia structure initialized.");
-	return EOK;
-}
-
-void usb_multimedia_deinit(struct usb_hid_dev *hid_dev, void *data)
-{
-	ddf_fun_t *fun = data;
-
-	usb_multimedia_t *multim_dev = ddf_fun_data_get(fun);
-
-	/* Hangup session to the console */
-	if (multim_dev->console_sess)
-		async_hangup(multim_dev->console_sess);
-	if (ddf_fun_unbind(fun) != EOK) {
-		usb_log_error("Failed to unbind %s, won't destroy.",
-		    ddf_fun_get_name(fun));
-	} else {
-		usb_log_debug2("%s unbound.", ddf_fun_get_name(fun));
-		/*
-		 * This frees multim_dev too as it was stored in
-		 * fun->data
-		 */
-		ddf_fun_destroy(fun);
-	}
-}
-
-bool usb_multimedia_polling_callback(struct usb_hid_dev *hid_dev, void *data)
-{
-	// TODO: checks
-	ddf_fun_t *fun = data;
-	if (hid_dev == NULL) {
-		return false;
-	}
-
-	usb_multimedia_t *multim_dev = ddf_fun_data_get(fun);
-
-	usb_hid_report_path_t *path = usb_hid_report_path();
-	if (path == NULL)
-		return true; /* This might be a temporary failure. */
-
-	errno_t ret =
-	    usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);
-	if (ret != EOK) {
-		usb_hid_report_path_free(path);
-		return true; /* This might be a temporary failure. */
-	}
-
-	usb_hid_report_path_set_report_id(path, hid_dev->report_id);
-
-	usb_hid_report_field_t *field = usb_hid_report_get_sibling(
-	    &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END |
-	    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-	    USB_HID_REPORT_TYPE_INPUT);
-
-	//FIXME Is this iterating OK if done multiple times?
-	//FIXME The parsing is not OK. (what's wrong?)
-	while (field != NULL) {
-		if (field->value != 0) {
-			usb_log_debug(NAME " KEY VALUE(%X) USAGE(%X)",
-			    field->value, field->usage);
-			const unsigned key =
-			    usb_multimedia_map_usage(field->usage);
-			const char *key_str =
-			    usbhid_multimedia_usage_to_str(field->usage);
-			usb_log_info("Pressed key: %s", key_str);
-			usb_multimedia_push_ev(multim_dev, KEY_PRESS, key);
-		}
-
-		field = usb_hid_report_get_sibling(
-		    &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END |
-		    USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY,
-		    USB_HID_REPORT_TYPE_INPUT);
-	}
-
-	usb_hid_report_path_free(path);
-
-	return true;
-}
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/multimedia/multimedia.h
===================================================================
--- uspace/drv/hid/usbhid/multimedia/multimedia.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB Keyboard multimedia keys subdriver.
- */
-
-#ifndef USB_HID_MULTIMEDIA_H_
-#define USB_HID_MULTIMEDIA_H_
-
-#include <usb/dev/driver.h>
-#include "../usbhid.h"
-
-extern errno_t usb_multimedia_init(usb_hid_dev_t *, void **);
-extern void usb_multimedia_deinit(usb_hid_dev_t *, void *);
-extern bool usb_multimedia_polling_callback(usb_hid_dev_t *, void *);
-
-#endif // USB_HID_MULTIMEDIA_H_
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/subdrivers.c
===================================================================
--- uspace/drv/hid/usbhid/subdrivers.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID subdriver mappings.
- */
-
-#include "subdrivers.h"
-#include <usb/hid/usages/core.h>
-#include <usb/hid/hidpath.h>
-#include "kbd/kbddev.h"
-#include "mouse/mousedev.h"
-#include "multimedia/multimedia.h"
-#include "blink1/blink1.h"
-#include "generic/hiddev.h"
-
-static const usb_hid_subdriver_usage_t path_kbd[] = {
-	{
-		USB_HIDUT_PAGE_GENERIC_DESKTOP,
-		USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD
-	},
-	{ 0, 0 }
-};
-
-static const usb_hid_subdriver_usage_t path_mouse[] = {
-	{
-		USB_HIDUT_PAGE_GENERIC_DESKTOP,
-		USB_HIDUT_USAGE_GENERIC_DESKTOP_MOUSE
-	},
-	{ 0, 0 }
-};
-
-static const usb_hid_subdriver_usage_t path_multim_key[] = {
-	{
-		USB_HIDUT_PAGE_CONSUMER,
-		USB_HIDUT_USAGE_CONSUMER_CONSUMER_CONTROL
-	},
-	{ 0, 0 }
-};
-
-const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = {
-	{
-		path_kbd,
-		0,
-		USB_HID_PATH_COMPARE_BEGIN,
-		-1,
-		-1,
-		{
-			.init = usb_kbd_init,
-			.deinit = usb_kbd_deinit,
-			.poll = usb_kbd_polling_callback,
-			.poll_end = NULL
-		},
-	},
-	{
-		path_multim_key,
-		1,
-		USB_HID_PATH_COMPARE_BEGIN,
-		-1,
-		-1,
-		{
-			.init = usb_multimedia_init,
-			.deinit = usb_multimedia_deinit,
-			.poll = usb_multimedia_polling_callback,
-			.poll_end = NULL
-		}
-	},
-	{
-		path_mouse,
-		0,
-		USB_HID_PATH_COMPARE_BEGIN,
-		-1,
-		-1,
-		{
-			.init = usb_mouse_init,
-			.deinit = usb_mouse_deinit,
-			.poll = usb_mouse_polling_callback,
-			.poll_end = NULL
-		}
-	},
-	{
-		NULL,
-		0,
-		USB_HID_PATH_COMPARE_BEGIN,
-		0x27b8,
-		0x01ed,
-		{
-			.init = usb_blink1_init,
-			.deinit = usb_blink1_deinit,
-			.poll = NULL,
-			.poll_end = NULL
-		}
-	}
-};
-
-const size_t USB_HID_MAX_SUBDRIVERS =
-    sizeof(usb_hid_subdrivers) / sizeof(usb_hid_subdrivers[0]);
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/subdrivers.h
===================================================================
--- uspace/drv/hid/usbhid/subdrivers.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID subdriver mappings.
- */
-
-#ifndef USB_HID_SUBDRIVERS_H_
-#define USB_HID_SUBDRIVERS_H_
-
-#include "usbhid.h"
-#include "kbd/kbddev.h"
-
-typedef struct usb_hid_subdriver_usage {
-	int usage_page;
-	int usage;
-} usb_hid_subdriver_usage_t;
-
-/** Structure representing the mapping between device requirements and the
- *  subdriver supposed to handle this device.
- *
- * By filling in this structure and adding it to the usb_hid_subdrivers array,
- * a new subdriver mapping will be created and used by the HID driver when it
- * searches for appropriate subdrivers for a device.
- *
- */
-typedef struct usb_hid_subdriver_mapping {
-	/** Usage path that the device's input reports must contain.
-	 *
-	 * It is an array of pairs <usage_page, usage>, terminated by a <0, 0>
-	 * pair. If you do not wish to specify the device in this way, set this
-	 * to NULL.
-	 */
-	const usb_hid_subdriver_usage_t *usage_path;
-
-	/** Report ID for which the path should apply. */
-	int report_id;
-
-	/** Compare type for the usage path. */
-	int compare;
-
-	/** Vendor ID (set to -1 if not specified). */
-	int vendor_id;
-
-	/** Product ID (set to -1 if not specified). */
-	int product_id;
-
-	/** Subdriver for controlling this device. */
-	const usb_hid_subdriver_t subdriver;
-} usb_hid_subdriver_mapping_t;
-
-extern const usb_hid_subdriver_mapping_t usb_hid_subdrivers[];
-extern const size_t USB_HID_MAX_SUBDRIVERS;
-
-#endif /* USB_HID_SUBDRIVERS_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/usbhid.c
===================================================================
--- uspace/drv/hid/usbhid/usbhid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,580 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2018 Petr Manek, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/**
- * @file
- * USB HID driver API.
- */
-
-#include <usb/debug.h>
-#include <usb/classes/classes.h>
-#include <usb/hid/hid.h>
-#include <usb/hid/hidparser.h>
-#include <usb/hid/hidreport.h>
-#include <usb/hid/request.h>
-
-#include <errno.h>
-#include <macros.h>
-#include <str_error.h>
-
-#include "usbhid.h"
-
-#include "kbd/kbddev.h"
-#include "generic/hiddev.h"
-#include "mouse/mousedev.h"
-#include "subdrivers.h"
-
-/* Array of endpoints expected on the device, NULL terminated. */
-const usb_endpoint_description_t *usb_hid_endpoints[] = {
-	&usb_hid_kbd_poll_endpoint_description,
-	&usb_hid_mouse_poll_endpoint_description,
-	&usb_hid_generic_poll_endpoint_description,
-	NULL
-};
-
-static errno_t usb_hid_set_boot_kbd_subdriver(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev != NULL);
-	assert(hid_dev->subdriver_count == 0);
-
-	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
-	if (hid_dev->subdrivers == NULL) {
-		return ENOMEM;
-	}
-	hid_dev->subdriver_count = 1;
-	// TODO 0 should be keyboard, but find a better way
-	hid_dev->subdrivers[0] = usb_hid_subdrivers[0].subdriver;
-
-	return EOK;
-}
-
-static errno_t usb_hid_set_boot_mouse_subdriver(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev != NULL);
-	assert(hid_dev->subdriver_count == 0);
-
-	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
-	if (hid_dev->subdrivers == NULL) {
-		return ENOMEM;
-	}
-	hid_dev->subdriver_count = 1;
-	// TODO 2 should be mouse, but find a better way
-	hid_dev->subdrivers[0] = usb_hid_subdrivers[2].subdriver;
-
-	return EOK;
-}
-
-static errno_t usb_hid_set_generic_hid_subdriver(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev != NULL);
-	assert(hid_dev->subdriver_count == 0);
-
-	hid_dev->subdrivers = malloc(sizeof(usb_hid_subdriver_t));
-	if (hid_dev->subdrivers == NULL) {
-		return ENOMEM;
-	}
-	hid_dev->subdriver_count = 1;
-
-	/* Set generic hid subdriver routines */
-	hid_dev->subdrivers[0].init = usb_generic_hid_init;
-	hid_dev->subdrivers[0].poll = usb_generic_hid_polling_callback;
-	hid_dev->subdrivers[0].poll_end = NULL;
-	hid_dev->subdrivers[0].deinit = usb_generic_hid_deinit;
-
-	return EOK;
-}
-
-static bool usb_hid_ids_match(const usb_hid_dev_t *hid_dev,
-    const usb_hid_subdriver_mapping_t *mapping)
-{
-	assert(hid_dev);
-	assert(hid_dev->usb_dev);
-	assert(mapping);
-	const usb_standard_device_descriptor_t *d =
-	    &usb_device_descriptors(hid_dev->usb_dev)->device;
-
-	return (d->vendor_id == mapping->vendor_id) &&
-	    (d->product_id == mapping->product_id);
-}
-
-static bool usb_hid_path_matches(usb_hid_dev_t *hid_dev,
-    const usb_hid_subdriver_mapping_t *mapping)
-{
-	assert(hid_dev != NULL);
-	assert(mapping != NULL);
-
-	usb_hid_report_path_t *usage_path = usb_hid_report_path();
-	if (usage_path == NULL) {
-		usb_log_debug("Failed to create usage path.");
-		return false;
-	}
-
-	for (int i = 0; mapping->usage_path[i].usage != 0 ||
-	    mapping->usage_path[i].usage_page != 0; ++i) {
-		if (usb_hid_report_path_append_item(usage_path,
-		    mapping->usage_path[i].usage_page,
-		    mapping->usage_path[i].usage) != EOK) {
-			usb_log_debug("Failed to append to usage path.");
-			usb_hid_report_path_free(usage_path);
-			return false;
-		}
-	}
-
-	usb_log_debug("Compare flags: %d", mapping->compare);
-
-	bool matches = false;
-	uint8_t report_id = mapping->report_id;
-
-	do {
-		usb_log_debug("Trying report id %u", report_id);
-		if (report_id != 0) {
-			usb_hid_report_path_set_report_id(usage_path,
-			    report_id);
-		}
-
-		const usb_hid_report_field_t *field =
-		    usb_hid_report_get_sibling(
-		    &hid_dev->report, NULL, usage_path, mapping->compare,
-		    USB_HID_REPORT_TYPE_INPUT);
-
-		usb_log_debug("Field: %p", field);
-
-		if (field != NULL) {
-			matches = true;
-			break;
-		}
-
-		report_id = usb_hid_get_next_report_id(
-		    &hid_dev->report, report_id, USB_HID_REPORT_TYPE_INPUT);
-	} while (!matches && report_id != 0);
-
-	usb_hid_report_path_free(usage_path);
-
-	return matches;
-}
-
-static errno_t usb_hid_save_subdrivers(usb_hid_dev_t *hid_dev,
-    const usb_hid_subdriver_t **subdrivers, unsigned count)
-{
-	assert(hid_dev);
-	assert(subdrivers);
-
-	if (count == 0) {
-		hid_dev->subdriver_count = 0;
-		hid_dev->subdrivers = NULL;
-		return EOK;
-	}
-
-	/* +1 for generic hid subdriver */
-	hid_dev->subdrivers = calloc((count + 1), sizeof(usb_hid_subdriver_t));
-	if (hid_dev->subdrivers == NULL) {
-		return ENOMEM;
-	}
-
-	for (unsigned i = 0; i < count; ++i) {
-		hid_dev->subdrivers[i] = *subdrivers[i];
-	}
-
-	/* Add one generic HID subdriver per device */
-	hid_dev->subdrivers[count].init = usb_generic_hid_init;
-	hid_dev->subdrivers[count].poll = usb_generic_hid_polling_callback;
-	hid_dev->subdrivers[count].deinit = usb_generic_hid_deinit;
-	hid_dev->subdrivers[count].poll_end = NULL;
-
-	hid_dev->subdriver_count = count + 1;
-
-	return EOK;
-}
-
-static errno_t usb_hid_find_subdrivers(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev != NULL);
-
-	const usb_hid_subdriver_t *subdrivers[USB_HID_MAX_SUBDRIVERS];
-	unsigned count = 0;
-
-	for (unsigned i = 0; i < USB_HID_MAX_SUBDRIVERS; ++i) {
-		const usb_hid_subdriver_mapping_t *mapping =
-		    &usb_hid_subdrivers[i];
-		/* Check the vendor & product ID. */
-		if (mapping->vendor_id >= 0 && mapping->product_id < 0) {
-			usb_log_warning("Mapping[%d]: Missing Product ID for "
-			    "Vendor ID %d\n", i, mapping->vendor_id);
-		}
-		if (mapping->product_id >= 0 && mapping->vendor_id < 0) {
-			usb_log_warning("Mapping[%d]: Missing Vendor ID for "
-			    "Product ID %d\n", i, mapping->product_id);
-		}
-
-		bool matched = false;
-
-		/* Check ID match. */
-		if (mapping->vendor_id >= 0 && mapping->product_id >= 0) {
-			usb_log_debug("Comparing device against vendor ID %u"
-			    " and product ID %u.\n", mapping->vendor_id,
-			    mapping->product_id);
-			if (usb_hid_ids_match(hid_dev, mapping)) {
-				usb_log_debug("IDs matched.");
-				matched = true;
-			}
-		}
-
-		/* Check usage match. */
-		if (mapping->usage_path != NULL) {
-			usb_log_debug("Comparing device against usage path.");
-			if (usb_hid_path_matches(hid_dev, mapping)) {
-				/* Does not matter if IDs were matched. */
-				matched = true;
-			}
-		}
-
-		if (matched) {
-			usb_log_debug("Subdriver matched.");
-			subdrivers[count++] = &mapping->subdriver;
-		}
-	}
-
-	/* We have all subdrivers determined, save them into the hid device */
-	return usb_hid_save_subdrivers(hid_dev, subdrivers, count);
-}
-
-static errno_t usb_hid_check_pipes(usb_hid_dev_t *hid_dev, usb_device_t *dev)
-{
-	assert(hid_dev);
-	assert(dev);
-
-	static const struct {
-		const usb_endpoint_description_t *desc;
-		const char *description;
-	} endpoints[] = {
-		{ &usb_hid_kbd_poll_endpoint_description, "Keyboard endpoint" },
-		{ &usb_hid_mouse_poll_endpoint_description, "Mouse endpoint" },
-		{ &usb_hid_generic_poll_endpoint_description, "Generic HID endpoint" },
-	};
-
-	for (unsigned i = 0; i < ARRAY_SIZE(endpoints); ++i) {
-		usb_endpoint_mapping_t *epm =
-		    usb_device_get_mapped_ep_desc(dev, endpoints[i].desc);
-		if (epm && epm->present) {
-			usb_log_debug("Found: %s.", endpoints[i].description);
-			hid_dev->poll_pipe_mapping = epm;
-			return EOK;
-		}
-	}
-	return ENOTSUP;
-}
-
-static errno_t usb_hid_init_report(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev != NULL);
-
-	uint8_t report_id = 0;
-	size_t max_size = 0;
-
-	do {
-		usb_log_debug("Getting size of the report.");
-		const size_t size =
-		    usb_hid_report_byte_size(&hid_dev->report, report_id,
-		    USB_HID_REPORT_TYPE_INPUT);
-		usb_log_debug("Report ID: %u, size: %zu", report_id, size);
-		max_size = (size > max_size) ? size : max_size;
-		usb_log_debug("Getting next report ID");
-		report_id = usb_hid_get_next_report_id(&hid_dev->report,
-		    report_id, USB_HID_REPORT_TYPE_INPUT);
-	} while (report_id != 0);
-
-	usb_log_debug("Max size of input report: %zu", max_size);
-
-	assert(hid_dev->input_report == NULL);
-
-	hid_dev->input_report = calloc(1, max_size);
-	if (hid_dev->input_report == NULL) {
-		return ENOMEM;
-	}
-	hid_dev->max_input_report_size = max_size;
-
-	return EOK;
-}
-
-static bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer,
-    size_t buffer_size, void *arg)
-{
-	if (dev == NULL || arg == NULL || buffer == NULL) {
-		usb_log_error("Missing arguments to polling callback.");
-		return false;
-	}
-	usb_hid_dev_t *hid_dev = arg;
-
-	assert(hid_dev->input_report != NULL);
-
-	usb_log_debug("New data [%zu/%zu]: %s", buffer_size,
-	    hid_dev->max_input_report_size,
-	    usb_debug_str_buffer(buffer, buffer_size, 0));
-
-	if (hid_dev->max_input_report_size >= buffer_size) {
-		/* TODO This should probably be atomic. */
-		memcpy(hid_dev->input_report, buffer, buffer_size);
-		hid_dev->input_report_size = buffer_size;
-		usb_hid_new_report(hid_dev);
-	}
-
-	/* Parse the input report */
-	const errno_t rc = usb_hid_parse_report(
-	    &hid_dev->report, buffer, buffer_size, &hid_dev->report_id);
-	if (rc != EOK) {
-		usb_log_warning("Failure in usb_hid_parse_report():"
-		    "%s\n", str_error(rc));
-	}
-
-	bool cont = false;
-	/* Continue if at least one of the subdrivers want to continue */
-	for (unsigned i = 0; i < hid_dev->subdriver_count; ++i) {
-		if (hid_dev->subdrivers[i].poll != NULL) {
-			cont = cont || hid_dev->subdrivers[i].poll(
-			    hid_dev, hid_dev->subdrivers[i].data);
-		}
-	}
-
-	return cont;
-}
-
-static bool usb_hid_polling_error_callback(usb_device_t *dev, errno_t err_code, void *arg)
-{
-	assert(dev);
-	assert(arg);
-	usb_hid_dev_t *hid_dev = arg;
-
-	usb_log_error("Device %s polling error: %s", usb_device_get_name(dev),
-	    str_error(err_code));
-
-	/* Continue polling until the device is about to be removed. */
-	return hid_dev->running;
-}
-
-static void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, void *arg)
-{
-	assert(dev);
-	assert(arg);
-
-	usb_hid_dev_t *hid_dev = arg;
-
-	for (unsigned i = 0; i < hid_dev->subdriver_count; ++i) {
-		if (hid_dev->subdrivers[i].poll_end != NULL) {
-			hid_dev->subdrivers[i].poll_end(
-			    hid_dev, hid_dev->subdrivers[i].data, reason);
-		}
-	}
-
-	hid_dev->running = false;
-}
-
-/*
- * This functions initializes required structures from the device's descriptors
- * and starts new fibril for polling the keyboard for events and another one for
- * handling auto-repeat of keys.
- *
- * During initialization, the keyboard is switched into boot protocol, the idle
- * rate is set to 0 (infinity), resulting in the keyboard only reporting event
- * when a key is pressed or released. Finally, the LED lights are turned on
- * according to the default setup of lock keys.
- *
- * @note By default, the keyboards is initialized with Num Lock turned on and
- *       other locks turned off.
- *
- * @param hid_dev Device to initialize, non-NULL.
- * @param dev USB device, non-NULL.
- * @return Error code.
- */
-errno_t usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev)
-{
-	assert(hid_dev);
-	assert(dev);
-
-	usb_log_debug("Initializing HID structure...");
-
-	usb_hid_report_init(&hid_dev->report);
-
-	/* The USB device should already be initialized, save it in structure */
-	hid_dev->usb_dev = dev;
-	hid_dev->poll_pipe_mapping = NULL;
-
-	errno_t rc = usb_hid_check_pipes(hid_dev, dev);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Get the report descriptor and parse it. */
-	rc = usb_hid_process_report_descriptor(
-	    hid_dev->usb_dev, &hid_dev->report, &hid_dev->report_desc,
-	    &hid_dev->report_desc_size);
-
-	/* If report parsing went well, find subdrivers. */
-	if (rc == EOK) {
-		usb_hid_find_subdrivers(hid_dev);
-	} else {
-		usb_log_error("Failed to parse report descriptor: fallback.");
-		hid_dev->subdrivers = NULL;
-		hid_dev->subdriver_count = 0;
-	}
-
-	usb_log_debug("Subdriver count(before trying boot protocol): %d",
-	    hid_dev->subdriver_count);
-
-	/* No subdrivers, fall back to the boot protocol if available. */
-	if (hid_dev->subdriver_count == 0) {
-		assert(hid_dev->subdrivers == NULL);
-		usb_log_info("No subdrivers found to handle device, trying "
-		    "boot protocol.\n");
-
-		switch (hid_dev->poll_pipe_mapping->interface->interface_protocol) {
-		case USB_HID_PROTOCOL_KEYBOARD:
-			usb_log_info("Falling back to kbd boot protocol.");
-			rc = usb_kbd_set_boot_protocol(hid_dev);
-			if (rc == EOK) {
-				usb_hid_set_boot_kbd_subdriver(hid_dev);
-			}
-			break;
-		case USB_HID_PROTOCOL_MOUSE:
-			usb_log_info("Falling back to mouse boot protocol.");
-			rc = usb_mouse_set_boot_protocol(hid_dev);
-			if (rc == EOK) {
-				usb_hid_set_boot_mouse_subdriver(hid_dev);
-			}
-			break;
-		default:
-			usb_log_info("Falling back to generic HID driver.");
-			usb_hid_set_generic_hid_subdriver(hid_dev);
-		}
-	}
-
-	usb_log_debug("Subdriver count(after trying boot protocol): %d",
-	    hid_dev->subdriver_count);
-
-	/* Still no subdrivers? */
-	if (hid_dev->subdriver_count == 0) {
-		assert(hid_dev->subdrivers == NULL);
-		usb_log_error(
-		    "No subdriver for handling this device could be found.\n");
-		return ENOTSUP;
-	}
-
-	/* Initialize subdrivers */
-	bool ok = false;
-	for (unsigned i = 0; i < hid_dev->subdriver_count; ++i) {
-		if (hid_dev->subdrivers[i].init != NULL) {
-			usb_log_debug("Initializing subdriver %d.", i);
-			const errno_t pret = hid_dev->subdrivers[i].init(hid_dev,
-			    &hid_dev->subdrivers[i].data);
-			if (pret != EOK) {
-				usb_log_warning("Failed to initialize"
-				    " HID subdriver structure: %s.\n",
-				    str_error(pret));
-				rc = pret;
-			} else {
-				/* At least one subdriver initialized. */
-				ok = true;
-			}
-		} else {
-			/* Does not need initialization. */
-			ok = true;
-		}
-	}
-
-	if (ok) {
-		/*
-		 * Save max input report size and
-		 * allocate space for the report
-		 */
-		rc = usb_hid_init_report(hid_dev);
-		if (rc != EOK) {
-			usb_log_error("Failed to initialize input report buffer: %s", str_error(rc));
-			// FIXME: What happens now?
-		}
-
-		usb_polling_t *polling = &hid_dev->polling;
-		if ((rc = usb_polling_init(polling))) {
-			usb_log_error("Failed to initialize polling: %s", str_error(rc));
-			// FIXME: What happens now?
-		}
-
-		polling->device = hid_dev->usb_dev;
-		polling->ep_mapping = hid_dev->poll_pipe_mapping;
-		polling->request_size = hid_dev->poll_pipe_mapping->pipe.desc.max_transfer_size;
-		polling->buffer = malloc(polling->request_size);
-		polling->on_data = usb_hid_polling_callback;
-		polling->on_polling_end = usb_hid_polling_ended_callback;
-		polling->on_error = usb_hid_polling_error_callback;
-		polling->arg = hid_dev;
-	}
-
-	return rc;
-}
-
-void usb_hid_new_report(usb_hid_dev_t *hid_dev)
-{
-	++hid_dev->report_nr;
-}
-
-int usb_hid_report_number(const usb_hid_dev_t *hid_dev)
-{
-	return hid_dev->report_nr;
-}
-
-void usb_hid_deinit(usb_hid_dev_t *hid_dev)
-{
-	assert(hid_dev);
-	assert(hid_dev->subdrivers != NULL || hid_dev->subdriver_count == 0);
-
-	free(hid_dev->polling.buffer);
-	usb_polling_fini(&hid_dev->polling);
-
-	usb_log_debug("Subdrivers: %p, subdriver count: %d",
-	    hid_dev->subdrivers, hid_dev->subdriver_count);
-
-	for (unsigned i = 0; i < hid_dev->subdriver_count; ++i) {
-		if (hid_dev->subdrivers[i].deinit != NULL) {
-			hid_dev->subdrivers[i].deinit(hid_dev,
-			    hid_dev->subdrivers[i].data);
-		}
-	}
-
-	/* Free allocated structures */
-	free(hid_dev->subdrivers);
-	free(hid_dev->report_desc);
-
-	/* Destroy the parser */
-	usb_hid_report_deinit(&hid_dev->report);
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/usbhid.h
===================================================================
--- uspace/drv/hid/usbhid/usbhid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * Copyright (c) 2018 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * USB HID driver API.
- */
-
-#ifndef USB_HID_USBHID_H_
-#define USB_HID_USBHID_H_
-
-#include <stdint.h>
-
-#include <usb/hid/hidparser.h>
-#include <ddf/driver.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/driver.h>
-#include <usb/dev/poll.h>
-#include <usb/hid/hid.h>
-#include <stdbool.h>
-
-typedef struct usb_hid_dev usb_hid_dev_t;
-typedef struct usb_hid_subdriver usb_hid_subdriver_t;
-
-/** Subdriver initialization callback.
- *
- * @param dev Backing USB HID device.
- * @param data Custom subdriver data (pointer where to store them).
- * @return Error code.
- */
-typedef errno_t (*usb_hid_driver_init_t)(usb_hid_dev_t *dev, void **data);
-
-/** Subdriver deinitialization callback.
- *
- * @param dev Backing USB HID device.
- * @param data Custom subdriver data.
- */
-typedef void (*usb_hid_driver_deinit_t)(usb_hid_dev_t *dev, void *data);
-
-/** Subdriver callback on data from device.
- *
- * @param dev Backing USB HID device.
- * @param data Custom subdriver data.
- * @return Whether to continue polling (typically true always).
- */
-typedef bool (*usb_hid_driver_poll_t)(usb_hid_dev_t *dev, void *data);
-
-/** Subdriver callback after communication with the device ceased.
- *
- * @param dev Backing USB HID device.
- * @param data Custom subdriver data.
- * @param ended_due_to_errors Whether communication ended due to errors in
- *	communication (true) or deliberately by driver (false).
- */
-typedef void (*usb_hid_driver_poll_ended_t)(usb_hid_dev_t *dev, void *data,
-    bool ended_due_to_errors);
-
-struct usb_hid_subdriver {
-	/** Function to be called when initializing HID device. */
-	usb_hid_driver_init_t init;
-	/** Function to be called when destroying the HID device structure. */
-	usb_hid_driver_deinit_t deinit;
-	/** Function to be called when data arrives from the device. */
-	usb_hid_driver_poll_t poll;
-	/** Function to be called when polling ends. */
-	usb_hid_driver_poll_ended_t poll_end;
-	/** Arbitrary data needed by the subdriver. */
-	void *data;
-};
-
-/**
- * Structure for holding general HID device data.
- */
-struct usb_hid_dev {
-	/** Structure holding generic USB device information. */
-	usb_device_t *usb_dev;
-
-	/** Endpont mapping of the polling pipe. */
-	usb_endpoint_mapping_t *poll_pipe_mapping;
-
-	/** Device polling structure. */
-	usb_polling_t polling;
-
-	/** Subdrivers. */
-	usb_hid_subdriver_t *subdrivers;
-
-	/** Number of subdrivers. */
-	unsigned subdriver_count;
-
-	/** Report descriptor. */
-	uint8_t *report_desc;
-
-	/** Report descriptor size. */
-	size_t report_desc_size;
-
-	/** HID Report parser. */
-	usb_hid_report_t report;
-
-	uint8_t report_id;
-
-	uint8_t *input_report;
-
-	size_t input_report_size;
-	size_t max_input_report_size;
-
-	int report_nr;
-	volatile bool running;
-};
-
-extern const usb_endpoint_description_t *usb_hid_endpoints[];
-
-errno_t usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
-
-void usb_hid_deinit(usb_hid_dev_t *hid_dev);
-
-void usb_hid_new_report(usb_hid_dev_t *hid_dev);
-
-int usb_hid_report_number(const usb_hid_dev_t *hid_dev);
-
-#endif /* USB_HID_USBHID_H_ */
-
-/**
- * @}
- */
Index: pace/drv/hid/usbhid/usbhid.ma
===================================================================
--- uspace/drv/hid/usbhid/usbhid.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-1000 usb&interface&class=HID&subclass=0x01&protocol=0x01
-1000 usb&interface&class=HID&subclass=0x01&protocol=0x02
-100 usb&interface&class=HID
Index: pace/drv/hid/xtkbd/doc/doxygroups.h
===================================================================
--- uspace/drv/hid/xtkbd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup xtkbd xtkbd
- * @brief XT keyboard driver
- * @ingroup drvs
- */
Index: pace/drv/hid/xtkbd/main.c
===================================================================
--- uspace/drv/hid/xtkbd/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup xtkbd
- * @{
- */
-/** @file
- * @brief XT keyboard driver
- */
-
-#include <inttypes.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/log.h>
-#include <stdio.h>
-
-#include "xtkbd.h"
-
-#define NAME "xtkbd"
-
-static errno_t xt_kbd_add(ddf_dev_t *device);
-
-/** DDF driver ops. */
-static driver_ops_t kbd_driver_ops = {
-	.dev_add = xt_kbd_add,
-};
-
-/** DDF driver structure. */
-static driver_t kbd_driver = {
-	.name = NAME,
-	.driver_ops = &kbd_driver_ops
-};
-
-/** Initialize global driver structures (NONE).
- *
- * Driver debug level is set here.
- *
- * @param[in] argc Nmber of arguments in argv vector (ignored).
- * @param[in] argv Cmdline argument vector (ignored).
- *
- * @return Error code.
- *
- */
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS XT keyboard driver.\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&kbd_driver);
-}
-
-/** Initialize a new ddf driver instance of the driver
- *
- * @param[in] device DDF instance of the device to initialize.
- *
- * @return Error code.
- *
- */
-static errno_t xt_kbd_add(ddf_dev_t *device)
-{
-	errno_t rc;
-
-	if (!device)
-		return EINVAL;
-
-	xt_kbd_t *kbd = ddf_dev_data_alloc(device, sizeof(xt_kbd_t));
-	if (kbd == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to allocate XT/KBD driver instance.");
-		return ENOMEM;
-	}
-
-	rc = xt_kbd_init(kbd, device);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to initialize XT_KBD driver: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	ddf_msg(LVL_NOTE, "Controlling '%s' (%" PRIun ").",
-	    ddf_dev_get_name(device), ddf_dev_get_handle(device));
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/hid/xtkbd/meson.build
===================================================================
--- uspace/drv/hid/xtkbd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files('main.c', 'xtkbd.c')
Index: pace/drv/hid/xtkbd/xtkbd.c
===================================================================
--- uspace/drv/hid/xtkbd/xtkbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,455 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup xtkbd
- * @{
- */
-/** @file
- * @brief XT keyboard driver
- */
-
-#include <errno.h>
-#include <ddf/log.h>
-#include <io/keycode.h>
-#include <io/chardev.h>
-#include <io/kbd_event.h>
-#include <ipc/kbdev.h>
-#include <abi/ipc/methods.h>
-#include "xtkbd.h"
-
-/** Scancode set 1 table. */
-static const unsigned int scanmap_simple[] = {
-	[0x29] = KC_BACKTICK,
-
-	[0x02] = KC_1,
-	[0x03] = KC_2,
-	[0x04] = KC_3,
-	[0x05] = KC_4,
-	[0x06] = KC_5,
-	[0x07] = KC_6,
-	[0x08] = KC_7,
-	[0x09] = KC_8,
-	[0x0a] = KC_9,
-	[0x0b] = KC_0,
-
-	[0x0c] = KC_MINUS,
-	[0x0d] = KC_EQUALS,
-	[0x0e] = KC_BACKSPACE,
-
-	[0x0f] = KC_TAB,
-
-	[0x10] = KC_Q,
-	[0x11] = KC_W,
-	[0x12] = KC_E,
-	[0x13] = KC_R,
-	[0x14] = KC_T,
-	[0x15] = KC_Y,
-	[0x16] = KC_U,
-	[0x17] = KC_I,
-	[0x18] = KC_O,
-	[0x19] = KC_P,
-
-	[0x1a] = KC_LBRACKET,
-	[0x1b] = KC_RBRACKET,
-
-	[0x3a] = KC_CAPS_LOCK,
-
-	[0x1e] = KC_A,
-	[0x1f] = KC_S,
-	[0x20] = KC_D,
-	[0x21] = KC_F,
-	[0x22] = KC_G,
-	[0x23] = KC_H,
-	[0x24] = KC_J,
-	[0x25] = KC_K,
-	[0x26] = KC_L,
-
-	[0x27] = KC_SEMICOLON,
-	[0x28] = KC_QUOTE,
-	[0x2b] = KC_BACKSLASH,
-
-	[0x2a] = KC_LSHIFT,
-
-	[0x2c] = KC_Z,
-	[0x2d] = KC_X,
-	[0x2e] = KC_C,
-	[0x2f] = KC_V,
-	[0x30] = KC_B,
-	[0x31] = KC_N,
-	[0x32] = KC_M,
-
-	[0x33] = KC_COMMA,
-	[0x34] = KC_PERIOD,
-	[0x35] = KC_SLASH,
-
-	[0x36] = KC_RSHIFT,
-
-	[0x1d] = KC_LCTRL,
-	[0x38] = KC_LALT,
-	[0x39] = KC_SPACE,
-
-	[0x01] = KC_ESCAPE,
-
-	[0x3b] = KC_F1,
-	[0x3c] = KC_F2,
-	[0x3d] = KC_F3,
-	[0x3e] = KC_F4,
-	[0x3f] = KC_F5,
-	[0x40] = KC_F6,
-	[0x41] = KC_F7,
-
-	[0x42] = KC_F8,
-	[0x43] = KC_F9,
-	[0x44] = KC_F10,
-
-	[0x57] = KC_F11,
-	[0x58] = KC_F12,
-
-	[0x54] = KC_SYSREQ,
-	[0x46] = KC_SCROLL_LOCK,
-
-	[0x1c] = KC_ENTER,
-
-	[0x45] = KC_NUM_LOCK,
-	[0x37] = KC_NTIMES,
-	[0x4a] = KC_NMINUS,
-	[0x4e] = KC_NPLUS,
-	[0x47] = KC_N7,
-	[0x48] = KC_N8,
-	[0x49] = KC_N9,
-	[0x4b] = KC_N4,
-	[0x4c] = KC_N5,
-	[0x4d] = KC_N6,
-	[0x4f] = KC_N1,
-	[0x50] = KC_N2,
-	[0x51] = KC_N3,
-	[0x52] = KC_N0,
-	[0x53] = KC_NPERIOD
-};
-
-#define KBD_ACK  0xfa
-#define KBD_RESEND  0xfe
-#define KBD_SCANCODE_SET_EXTENDED  0xe0
-#define KBD_SCANCODE_SET_EXTENDED_SPECIAL  0xe1
-
-/** Scancode set 1 extended codes table */
-static const unsigned int scanmap_e0[] = {
-	[0x38] = KC_RALT,
-	[0x1d] = KC_RCTRL,
-
-	[0x37] = KC_PRTSCR,
-	[0x46] = KC_PAUSE,
-
-	[0x52] = KC_INSERT,
-	[0x47] = KC_HOME,
-	[0x49] = KC_PAGE_UP,
-
-	[0x53] = KC_DELETE,
-	[0x4f] = KC_END,
-	[0x51] = KC_PAGE_DOWN,
-
-	[0x48] = KC_UP,
-	[0x4b] = KC_LEFT,
-	[0x50] = KC_DOWN,
-	[0x4d] = KC_RIGHT,
-
-	[0x35] = KC_NSLASH,
-	[0x1c] = KC_NENTER
-};
-
-#define KBD_CMD_SET_LEDS  0xed
-
-enum led_indicators {
-	LI_SCROLL = 0x01,
-	LI_NUM    = 0x02,
-	LI_CAPS   = 0x04
-};
-
-static void push_event(async_sess_t *sess, kbd_event_type_t type,
-    unsigned int key)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_msg_4(exch, KBDEV_EVENT, type, key, 0, 0);
-	async_exchange_end(exch);
-}
-
-/** Get one scancode byte from the keyboard.
- *
- * @param kbd Keyboard
- * @param code Place to store scancode byte
- * @return EOK on success or an error code
- */
-static errno_t xtkbd_get_code(xt_kbd_t *kbd, uint8_t *code)
-{
-	errno_t rc;
-	size_t nread;
-
-	*code = 0;
-	rc = chardev_read(kbd->chardev, code, 1, &nread, chardev_f_none);
-	if (rc != EOK) {
-		ddf_msg(LVL_WARN, "Error reading from keyboard device.");
-		return EIO;
-	}
-
-	ddf_msg(LVL_DEBUG, "Read scancode: 0x%02hhx", *code);
-
-	return EOK;
-}
-
-/** Get data and parse scancodes.
- *
- * @param arg Pointer to xt_kbd_t structure.
- *
- * @return EIO on error.
- *
- */
-static errno_t polling(void *arg)
-{
-	kbd_event_type_t evtype;
-	unsigned int key;
-	size_t map_size;
-	xt_kbd_t *kbd = arg;
-	uint8_t code;
-	uint8_t xcode1;
-	uint8_t xcode2;
-	errno_t rc;
-
-	while (true) {
-		rc = xtkbd_get_code(kbd, &code);
-		if (rc != EOK)
-			return EIO;
-
-		/* Ignore AT command reply */
-		if ((code == KBD_ACK) || (code == KBD_RESEND))
-			continue;
-
-		/* Extended set */
-		if (code == KBD_SCANCODE_SET_EXTENDED) {
-			rc = xtkbd_get_code(kbd, &xcode1);
-			if (rc != EOK)
-				return EIO;
-
-			if ((xcode1 & 0x7f) == 0x2a)  /* Fake shift */
-				continue;
-
-			/* Bit 7 indicates press/release */
-			evtype = (xcode1 & 0x80) ? KEY_RELEASE : KEY_PRESS;
-
-			map_size = sizeof(scanmap_e0) / sizeof(unsigned int);
-			key = (xcode1 & 0x7f) < map_size ?
-			    scanmap_e0[xcode1 & 0x7f] : 0;
-
-			if (key != 0)
-				push_event(kbd->client_sess, evtype, key);
-			else
-				ddf_msg(LVL_WARN, "Unknown scancode: e0 %hhx", xcode1);
-
-			continue;
-		}
-
-		/* Extended special set */
-		if (code == KBD_SCANCODE_SET_EXTENDED_SPECIAL) {
-			rc = xtkbd_get_code(kbd, &xcode1);
-			if (rc != EOK)
-				return EIO;
-
-			rc = xtkbd_get_code(kbd, &xcode2);
-			if (rc != EOK)
-				return EIO;
-
-			if ((xcode1 & 0x80) == (xcode2 & 0x80) &&
-			    (xcode1 & 0x7f) == 0x1d && (xcode2 & 0x7f) == 0x45) {
-				/* Pause */
-				evtype = (xcode1 & 0x80) ? KEY_RELEASE :
-				    KEY_PRESS;
-				push_event(kbd->client_sess, evtype, KC_PAUSE);
-				continue;
-			}
-
-			ddf_msg(LVL_WARN, "Unknown scancode: e1 %hhx %hhx",
-			    xcode1, xcode2);
-			continue;
-		}
-
-		/* Bit 7 indicates press/release */
-		evtype = (code & 0x80) ? KEY_RELEASE : KEY_PRESS;
-
-		map_size = sizeof(scanmap_simple) / sizeof(unsigned int);
-		key = (code & 0x7f) < map_size ?
-		    scanmap_simple[code & 0x7f] : 0;
-
-		if (key != 0)
-			push_event(kbd->client_sess, evtype, key);
-		else
-			ddf_msg(LVL_WARN, "Unknown scancode: %hhx", code);
-	}
-}
-
-/** Default handler for IPC methods not handled by DDF.
- *
- * @param fun   Device function handling the call.
- * @param icall Call data.
- *
- */
-static void default_connection_handler(ddf_fun_t *fun, ipc_call_t *icall)
-{
-	const sysarg_t method = ipc_get_imethod(icall);
-	xt_kbd_t *kbd = ddf_dev_data_get(ddf_fun_get_dev(fun));
-	unsigned mods;
-	async_sess_t *sess;
-
-	switch (method) {
-	case KBDEV_SET_IND:
-		/*
-		 * XT keyboards do not support setting mods,
-		 * assume AT keyboard with Scan Code Set 1.
-		 */
-		mods = ipc_get_arg1(icall);
-		const uint8_t status = 0 |
-		    ((mods & KM_CAPS_LOCK) ? LI_CAPS : 0) |
-		    ((mods & KM_NUM_LOCK) ? LI_NUM : 0) |
-		    ((mods & KM_SCROLL_LOCK) ? LI_SCROLL : 0);
-		uint8_t cmds[] = { KBD_CMD_SET_LEDS, status };
-
-		size_t nwr;
-		errno_t rc = chardev_write(kbd->chardev, &cmds[0], 1, &nwr);
-		if (rc != EOK) {
-			async_answer_0(icall, rc);
-			break;
-		}
-
-		rc = chardev_write(kbd->chardev, &cmds[1], 1, &nwr);
-		async_answer_0(icall, rc);
-		break;
-	case IPC_M_CONNECT_TO_ME:
-		/*
-		 * This might be ugly but async_callback_receive_start makes no
-		 * difference for incorrect call and malloc failure.
-		 */
-		sess = async_callback_receive_start(EXCHANGE_SERIALIZE, icall);
-
-		/* Probably ENOMEM error, try again. */
-		if (sess == NULL) {
-			ddf_msg(LVL_WARN,
-			    "Failed creating callback session");
-			async_answer_0(icall, EAGAIN);
-			break;
-		}
-
-		if (kbd->client_sess == NULL) {
-			kbd->client_sess = sess;
-			ddf_msg(LVL_DEBUG, "Set client session");
-			async_answer_0(icall, EOK);
-		} else {
-			ddf_msg(LVL_ERROR, "Client session already set");
-			async_answer_0(icall, ELIMIT);
-		}
-
-		break;
-	default:
-		ddf_msg(LVL_ERROR, "Unknown method: %d.", (int)method);
-		async_answer_0(icall, EINVAL);
-		break;
-	}
-}
-
-/** Keyboard function ops. */
-static ddf_dev_ops_t kbd_ops = {
-	.default_handler = default_connection_handler
-};
-
-/** Initialize keyboard driver structure.
- *
- * @param kbd Keyboard driver structure to initialize.
- * @param dev DDF device structure.
- *
- * Connects to parent, creates keyboard function, starts polling fibril.
- *
- */
-errno_t xt_kbd_init(xt_kbd_t *kbd, ddf_dev_t *dev)
-{
-	async_sess_t *parent_sess;
-	bool bound = false;
-	errno_t rc;
-
-	kbd->client_sess = NULL;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating parent session.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = chardev_open(parent_sess, &kbd->chardev);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed opening character device.");
-		goto error;
-	}
-
-	kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd");
-	if (kbd->kbd_fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'kbd'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
-
-	rc = ddf_fun_bind(kbd->kbd_fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'kbd'.");
-		goto error;
-	}
-	bound = true;
-
-	rc = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function 'kbd' to category "
-		    "'keyboard'.");
-		goto error;
-	}
-
-	kbd->polling_fibril = fibril_create(polling, kbd);
-	if (kbd->polling_fibril == 0) {
-		ddf_msg(LVL_ERROR, "Failed creating polling fibril.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_add_ready(kbd->polling_fibril);
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(kbd->kbd_fun);
-	if (kbd->kbd_fun != NULL)
-		ddf_fun_destroy(kbd->kbd_fun);
-	chardev_close(kbd->chardev);
-	return rc;
-}
Index: pace/drv/hid/xtkbd/xtkbd.h
===================================================================
--- uspace/drv/hid/xtkbd/xtkbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup xtkbd
- * @{
- */
-/** @file
- * @brief XT keyboard driver
- */
-
-#ifndef XT_KBD_H_
-#define XT_KBD_H_
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <fibril.h>
-#include <io/chardev.h>
-
-/** PC/XT keyboard driver structure */
-typedef struct {
-	/** Keyboard function */
-	ddf_fun_t *kbd_fun;
-	/** Device providing keyboard connection */
-	chardev_t *chardev;
-	/** Callback connection to client */
-	async_sess_t *client_sess;
-	/** Fibril retrieving an parsing data */
-	fid_t polling_fibril;
-} xt_kbd_t;
-
-extern errno_t xt_kbd_init(xt_kbd_t *, ddf_dev_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/hid/xtkbd/xtkbd.ma
===================================================================
--- uspace/drv/hid/xtkbd/xtkbd.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 char/xtkbd
Index: pace/drv/intctl/apic/apic.c
===================================================================
--- uspace/drv/intctl/apic/apic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,273 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_apic
- * @{
- */
-
-/**
- * @file apic.c
- * @brief APIC driver.
- */
-
-#include <ipc/irc.h>
-#include <loc.h>
-#include <sysinfo.h>
-#include <as.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <async.h>
-#include <stdio.h>
-
-#include "apic.h"
-
-#define NAME  "apic"
-
-#define APIC_MAX_IRQ	15
-
-#define IOREGSEL  (0x00U / sizeof(uint32_t))
-#define IOWIN     (0x10U / sizeof(uint32_t))
-
-#define IOREDTBL   0x10U
-
-/** I/O Register Select Register. */
-typedef union {
-	uint32_t value;
-	struct {
-		uint8_t reg_addr;	/**< APIC Register Address. */
-		unsigned int : 24;	/**< Reserved. */
-	} __attribute__((packed));
-} io_regsel_t;
-
-/** I/O Redirection Register. */
-typedef struct io_redirection_reg {
-	union {
-		uint32_t lo;
-		struct {
-			uint8_t intvec;			/**< Interrupt Vector. */
-			unsigned int delmod : 3;	/**< Delivery Mode. */
-			unsigned int destmod : 1;	/**< Destination mode. */
-			unsigned int delivs : 1;	/**< Delivery status (RO). */
-			unsigned int intpol : 1;	/**< Interrupt Input Pin Polarity. */
-			unsigned int irr : 1;		/**< Remote IRR (RO). */
-			unsigned int trigger_mode : 1;	/**< Trigger Mode. */
-			unsigned int masked : 1;	/**< Interrupt Mask. */
-			unsigned int : 15;		/**< Reserved. */
-		} __attribute__((packed));
-	};
-	union {
-		uint32_t hi;
-		struct {
-			unsigned int : 24;	/**< Reserved. */
-			uint8_t dest : 8;  	/**< Destination Field. */
-		} __attribute__((packed));
-	};
-} __attribute__((packed)) io_redirection_reg_t;
-
-#define IO_APIC_SIZE	20
-
-/** Read from IO APIC register.
- *
- * @param apic APIC
- * @param address IO APIC register address.
- *
- * @return Content of the addressed IO APIC register.
- *
- */
-static uint32_t io_apic_read(apic_t *apic, uint8_t address)
-{
-	io_regsel_t regsel;
-
-	regsel.value = pio_read_32(&apic->regs[IOREGSEL]);
-	regsel.reg_addr = address;
-	pio_write_32(&apic->regs[IOREGSEL], regsel.value);
-	return pio_read_32(&apic->regs[IOWIN]);
-}
-
-/** Write to IO APIC register.
- *
- * @param apic    APIC
- * @param address IO APIC register address.
- * @param val     Content to be written to the addressed IO APIC register.
- *
- */
-static void io_apic_write(apic_t *apic, uint8_t address, uint32_t val)
-{
-	io_regsel_t regsel;
-
-	regsel.value = pio_read_32(&apic->regs[IOREGSEL]);
-	regsel.reg_addr = address;
-	pio_write_32(&apic->regs[IOREGSEL], regsel.value);
-	pio_write_32(&apic->regs[IOWIN], val);
-}
-
-static int irq_to_pin(int irq)
-{
-	// FIXME: get the map from the kernel, even though this may work
-	//	  for simple cases
-	if (irq == 0)
-		return 2;
-	return irq;
-}
-
-static errno_t apic_enable_irq(apic_t *apic, sysarg_t irq)
-{
-	io_redirection_reg_t reg;
-
-	if (irq > APIC_MAX_IRQ)
-		return ELIMIT;
-
-	int pin = irq_to_pin(irq);
-	if (pin == -1)
-		return ENOENT;
-
-	reg.lo = io_apic_read(apic, (uint8_t) (IOREDTBL + pin * 2));
-	reg.masked = false;
-	io_apic_write(apic, (uint8_t) (IOREDTBL + pin * 2), reg.lo);
-
-	return EOK;
-}
-
-/** Handle one connection to APIC.
- *
- * @param icall Call data of the request that opened the connection.
- * @param arg   Local argument.
- *
- */
-static void apic_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	apic_t *apic;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	apic = (apic_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	while (true) {
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IRC_ENABLE_INTERRUPT:
-			async_answer_0(&call, apic_enable_irq(apic,
-			    ipc_get_arg1(&call)));
-			break;
-		case IRC_DISABLE_INTERRUPT:
-			/* XXX TODO */
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_CLEAR_INTERRUPT:
-			/* Noop */
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Add APIC device. */
-errno_t apic_add(apic_t *apic, apic_res_t *res)
-{
-	sysarg_t have_apic;
-	ddf_fun_t *fun_a = NULL;
-	void *regs;
-	errno_t rc;
-	bool bound = false;
-
-	if ((sysinfo_get_value("apic", &have_apic) != EOK) || (!have_apic)) {
-		printf("%s: No APIC found\n", NAME);
-		return ENOTSUP;
-	}
-
-	rc = pio_enable((void *) res->base, IO_APIC_SIZE, &regs);
-	if (rc != EOK) {
-		printf("%s: Failed to enable PIO for APIC: %s\n", NAME, str_error(rc));
-		return EIO;
-	}
-
-	apic->regs = (ioport32_t *)regs;
-
-	fun_a = ddf_fun_create(apic->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun_a, apic_connection);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun_a, "irc");
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun_a);
-	if (fun_a != NULL)
-		ddf_fun_destroy(fun_a);
-	return rc;
-}
-
-/** Remove APIC device */
-errno_t apic_remove(apic_t *apic)
-{
-	return ENOTSUP;
-}
-
-/** APIC device gone */
-errno_t apic_gone(apic_t *apic)
-{
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/drv/intctl/apic/apic.h
===================================================================
--- uspace/drv/intctl/apic/apic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_apic
- * @{
- */
-/** @file
- */
-
-#ifndef APIC_H_
-#define APIC_H_
-
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <loc.h>
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t base;
-} apic_res_t;
-
-/** APIC */
-typedef struct {
-	ioport32_t *regs;
-	uintptr_t phys_base;
-	ddf_dev_t *dev;
-} apic_t;
-
-extern errno_t apic_add(apic_t *, apic_res_t *);
-extern errno_t apic_remove(apic_t *);
-extern errno_t apic_gone(apic_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/apic/apic.ma
===================================================================
--- uspace/drv/intctl/apic/apic.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/apic
Index: pace/drv/intctl/apic/doc/doxygroups.h
===================================================================
--- uspace/drv/intctl/apic/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_drv_apic apic
- * @brief APIC interrupt controller driver
- * @ingroup drvs
- */
Index: pace/drv/intctl/apic/main.c
===================================================================
--- uspace/drv/intctl/apic/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_apic
- * @{
- */
-/** @file APIC driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "apic.h"
-
-#define NAME  "apic"
-
-static errno_t apic_dev_add(ddf_dev_t *dev);
-static errno_t apic_dev_remove(ddf_dev_t *dev);
-static errno_t apic_dev_gone(ddf_dev_t *dev);
-static errno_t apic_fun_online(ddf_fun_t *fun);
-static errno_t apic_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = apic_dev_add,
-	.dev_remove = apic_dev_remove,
-	.dev_gone = apic_dev_gone,
-	.fun_online = apic_fun_online,
-	.fun_offline = apic_fun_offline
-};
-
-static driver_t apic_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t apic_get_res(ddf_dev_t *dev, apic_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.mem_ranges.ranges[0]);
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t apic_dev_add(ddf_dev_t *dev)
-{
-	apic_t *apic;
-	apic_res_t apic_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "apic_dev_add(%p)", dev);
-	apic = ddf_dev_data_alloc(dev, sizeof(apic_t));
-	if (apic == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	apic->dev = dev;
-
-	rc = apic_get_res(dev, &apic_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return apic_add(apic, &apic_res);
-}
-
-static errno_t apic_dev_remove(ddf_dev_t *dev)
-{
-	apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "apic_dev_remove(%p)", dev);
-
-	return apic_remove(apic);
-}
-
-static errno_t apic_dev_gone(ddf_dev_t *dev)
-{
-	apic_t *apic = (apic_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "apic_dev_gone(%p)", dev);
-
-	return apic_gone(apic);
-}
-
-static errno_t apic_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "apic_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t apic_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "apic_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": APIC driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&apic_driver);
-}
-
-/** @}
- */
Index: pace/drv/intctl/apic/meson.build
===================================================================
--- uspace/drv/intctl/apic/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('apic.c', 'main.c')
Index: pace/drv/intctl/gicv2/gicv2.c
===================================================================
--- uspace/drv/intctl/gicv2/gicv2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,288 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_gicv2
- * @{
- */
-
-/** @file
- */
-
-#include <async.h>
-#include <bitops.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <macros.h>
-#include <str_error.h>
-#include <ipc/irc.h>
-#include <stdint.h>
-
-#include "gicv2.h"
-
-/** GICv2 distributor register map. */
-typedef struct {
-	/** Distributor control register. */
-	ioport32_t ctlr;
-#define GICV2D_CTLR_ENABLE_FLAG  0x1
-
-	/** Interrupt controller type register. */
-	const ioport32_t typer;
-#define GICV2D_TYPER_IT_LINES_NUMBER_SHIFT  0
-#define GICV2D_TYPER_IT_LINES_NUMBER_MASK \
-	(0x1f << GICV2D_TYPER_IT_LINES_NUMBER_SHIFT)
-
-	/** Distributor implementer identification register. */
-	const ioport32_t iidr;
-	/** Reserved. */
-	PADD32(5);
-	/** Implementation defined registers. */
-	ioport32_t impl[8];
-	/** Reserved. */
-	PADD32(16);
-	/** Interrupt group registers. */
-	ioport32_t igroupr[32];
-	/** Interrupt set-enable registers. */
-	ioport32_t isenabler[32];
-	/** Interrupt clear-enable registers. */
-	ioport32_t icenabler[32];
-	/** Interrupt set-pending registers. */
-	ioport32_t ispendr[32];
-	/** Interrupt clear-pending registers. */
-	ioport32_t icpendr[32];
-	/** GICv2 interrupt set-active registers. */
-	ioport32_t isactiver[32];
-	/** Interrupt clear-active registers. */
-	ioport32_t icactiver[32];
-	/** Interrupt priority registers. */
-	ioport32_t ipriorityr[255];
-	/** Reserved. */
-	PADD32(1);
-	/** Interrupt processor target registers. First 8 words are read-only.
-	 */
-	ioport32_t itargetsr[255];
-	/** Reserved. */
-	PADD32(1);
-	/** Interrupt configuration registers. */
-	ioport32_t icfgr[64];
-	/** Implementation defined registers. */
-	ioport32_t impl2[64];
-	/** Non-secure access control registers. */
-	ioport32_t nsacr[64];
-	/** Software generated interrupt register. */
-	ioport32_t sgir;
-	/** Reserved. */
-	PADD32(3);
-	/** SGI clear-pending registers. */
-	ioport32_t cpendsgir[4];
-	/** SGI set-pending registers. */
-	ioport32_t spendsgir[4];
-	/** Reserved. */
-	PADD32(40);
-	/** Implementation defined identification registers. */
-	const ioport32_t impl3[12];
-} gicv2_distr_regs_t;
-
-/* GICv2 CPU interface register map. */
-typedef struct {
-	/** CPU interface control register. */
-	ioport32_t ctlr;
-#define GICV2C_CTLR_ENABLE_FLAG  0x1
-
-	/** Interrupt priority mask register. */
-	ioport32_t pmr;
-	/** Binary point register. */
-	ioport32_t bpr;
-	/** Interrupt acknowledge register. */
-	const ioport32_t iar;
-#define GICV2C_IAR_INTERRUPT_ID_SHIFT  0
-#define GICV2C_IAR_INTERRUPT_ID_MASK \
-	(0x3ff << GICV2C_IAR_INTERRUPT_ID_SHIFT)
-#define GICV2C_IAR_CPUID_SHIFT  10
-#define GICV2C_IAR_CPUID_MASK \
-	(0x7 << GICV2C_IAR_CPUID_SHIFT)
-
-	/** End of interrupt register. */
-	ioport32_t eoir;
-	/** Running priority register. */
-	const ioport32_t rpr;
-	/** Highest priority pending interrupt register. */
-	const ioport32_t hppir;
-	/** Aliased binary point register. */
-	ioport32_t abpr;
-	/** Aliased interrupt acknowledge register. */
-	const ioport32_t aiar;
-	/** Aliased end of interrupt register. */
-	ioport32_t aeoir;
-	/** Aliased highest priority pending interrupt register. */
-	const ioport32_t ahppir;
-	/** Reserved. */
-	PADD32(5);
-	/** Implementation defined registers. */
-	ioport32_t impl[36];
-	/** Active priorities registers. */
-	ioport32_t apr[4];
-	/** Non-secure active priorities registers. */
-	ioport32_t nsapr[4];
-	/** Reserved. */
-	PADD32(3);
-	/** CPU interface identification register. */
-	const ioport32_t iidr;
-	/** Unallocated. */
-	PADD32(960);
-	/** Deactivate interrupt register. */
-	ioport32_t dir;
-} gicv2_cpui_regs_t;
-
-static errno_t gicv2_enable_irq(gicv2_t *gicv2, sysarg_t irq)
-{
-	if (irq > gicv2->max_irq)
-		return EINVAL;
-
-	ddf_msg(LVL_NOTE, "Enable interrupt '%" PRIun "'.", irq);
-
-	gicv2_distr_regs_t *distr = (gicv2_distr_regs_t *) gicv2->distr;
-	pio_write_32(&distr->isenabler[irq / 32], BIT_V(uint32_t, irq % 32));
-	return EOK;
-}
-
-/** Client connection handler.
- *
- * @param icall Call data of the request that opened the connection.
- * @param arg   Local argument.
- */
-static void gicv2_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	gicv2_t *gicv2;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_answer_0(icall, EOK);
-
-	gicv2 = (gicv2_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
-
-	while (true) {
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IRC_ENABLE_INTERRUPT:
-			async_answer_0(&call,
-			    gicv2_enable_irq(gicv2, ipc_get_arg1(&call)));
-			break;
-		case IRC_DISABLE_INTERRUPT:
-			/* XXX TODO */
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_CLEAR_INTERRUPT:
-			/* Noop */
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Add a GICv2 device. */
-errno_t gicv2_add(gicv2_t *gicv2, gicv2_res_t *res)
-{
-	ddf_fun_t *fun_a = NULL;
-	errno_t rc;
-
-	rc = pio_enable((void *) res->distr_base, sizeof(gicv2_distr_regs_t),
-	    &gicv2->distr);
-	if (rc != EOK) {
-		ddf_msg(
-		    LVL_ERROR, "Error enabling PIO for distributor registers.");
-		goto error;
-	}
-
-	rc = pio_enable(
-	    (void *) res->cpui_base, sizeof(gicv2_cpui_regs_t), &gicv2->cpui);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR,
-		    "Error enabling PIO for CPU interface registers.");
-		goto error;
-	}
-
-	fun_a = ddf_fun_create(gicv2->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun_a, gicv2_connection);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s",
-		    str_error(rc));
-		goto error;
-	}
-
-	rc = ddf_fun_add_to_category(fun_a, "irc");
-	if (rc != EOK)
-		goto error;
-
-	/* Get maximum number of interrupts. */
-	gicv2_distr_regs_t *distr = (gicv2_distr_regs_t *) gicv2->distr;
-	uint32_t typer = pio_read_32(&distr->typer);
-	gicv2->max_irq = (((typer & GICV2D_TYPER_IT_LINES_NUMBER_MASK) >>
-	    GICV2D_TYPER_IT_LINES_NUMBER_SHIFT) + 1) * 32;
-
-	return EOK;
-error:
-	if (fun_a != NULL)
-		ddf_fun_destroy(fun_a);
-	return rc;
-}
-
-/** Remove a GICv2 device. */
-errno_t gicv2_remove(gicv2_t *gicv2)
-{
-	return ENOTSUP;
-}
-
-/** A GICv2 device gone. */
-errno_t gicv2_gone(gicv2_t *gicv2)
-{
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/drv/intctl/gicv2/gicv2.h
===================================================================
--- uspace/drv/intctl/gicv2/gicv2.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_gicv2
- * @{
- */
-/** @file
- */
-
-#ifndef GICV2_H_
-#define GICV2_H_
-
-#include <ddf/driver.h>
-#include <loc.h>
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t distr_base;
-	uintptr_t cpui_base;
-} gicv2_res_t;
-
-/** GICv2 interrupt controller. */
-typedef struct {
-	ddf_dev_t *dev;
-	void *distr;
-	void *cpui;
-	unsigned max_irq;
-} gicv2_t;
-
-extern errno_t gicv2_add(gicv2_t *, gicv2_res_t *);
-extern errno_t gicv2_remove(gicv2_t *);
-extern errno_t gicv2_gone(gicv2_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/gicv2/gicv2.ma
===================================================================
--- uspace/drv/intctl/gicv2/gicv2.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 arm/gicv2
Index: pace/drv/intctl/gicv2/main.c
===================================================================
--- uspace/drv/intctl/gicv2/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2018 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_drv_gicv2
- * @{
- */
-/** @file GICv2 driver.
- * @brief ARM Generic Interrupt Controller, Architecture version 2.0.
- *
- * This IRQ controller is present on the QEMU virt platform for ARM.
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "gicv2.h"
-
-#define NAME  "gicv2"
-
-static errno_t gicv2_dev_add(ddf_dev_t *dev);
-static errno_t gicv2_dev_remove(ddf_dev_t *dev);
-static errno_t gicv2_dev_gone(ddf_dev_t *dev);
-static errno_t gicv2_fun_online(ddf_fun_t *fun);
-static errno_t gicv2_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = gicv2_dev_add,
-	.dev_remove = gicv2_dev_remove,
-	.dev_gone = gicv2_dev_gone,
-	.fun_online = gicv2_fun_online,
-	.fun_offline = gicv2_fun_offline
-};
-
-static driver_t gicv2_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t gicv2_get_res(ddf_dev_t *dev, gicv2_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 2) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->distr_base = RNGABS(hw_res.mem_ranges.ranges[0]);
-	res->cpui_base = RNGABS(hw_res.mem_ranges.ranges[1]);
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t gicv2_dev_add(ddf_dev_t *dev)
-{
-	gicv2_t *gicv2;
-	gicv2_res_t gicv2_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "gicv2_dev_add(%p)", dev);
-	gicv2 = ddf_dev_data_alloc(dev, sizeof(gicv2_t));
-	if (gicv2 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	gicv2->dev = dev;
-
-	rc = gicv2_get_res(dev, &gicv2_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return gicv2_add(gicv2, &gicv2_res);
-}
-
-static errno_t gicv2_dev_remove(ddf_dev_t *dev)
-{
-	gicv2_t *gicv2 = (gicv2_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "gicv2_dev_remove(%p)", dev);
-
-	return gicv2_remove(gicv2);
-}
-
-static errno_t gicv2_dev_gone(ddf_dev_t *dev)
-{
-	gicv2_t *gicv2 = (gicv2_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "gicv2_dev_gone(%p)", dev);
-
-	return gicv2_gone(gicv2);
-}
-
-static errno_t gicv2_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "gicv2_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t gicv2_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "gicv2_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": GICv2 interrupt controller driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&gicv2_driver);
-}
-
-/** @}
- */
Index: pace/drv/intctl/gicv2/meson.build
===================================================================
--- uspace/drv/intctl/gicv2/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2016 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('gicv2.c', 'main.c')
Index: pace/drv/intctl/i8259/doc/doxygroups.h
===================================================================
--- uspace/drv/intctl/i8259/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup i8259 i8259
- * @brief Intel i8259 interrupt controller driver
- * @ingroup drvs
- */
Index: pace/drv/intctl/i8259/i8259.c
===================================================================
--- uspace/drv/intctl/i8259/i8259.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8259
- * @{
- */
-
-/**
- * @file i8259.c
- * @brief i8259 driver.
- */
-
-#include <ipc/irc.h>
-#include <loc.h>
-#include <sysinfo.h>
-#include <as.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <align.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <async.h>
-#include <stdio.h>
-
-#include "i8259.h"
-
-#define NAME  "i8259"
-
-#define IO_RANGE0_SIZE   2
-#define IO_RANGE1_SIZE   2
-
-#define PIC_PIC0PORT1  0
-#define PIC_PIC0PORT2  1
-
-#define PIC_PIC1PORT1  0
-#define PIC_PIC1PORT2  1
-
-#define PIC_MAX_IRQ  15
-
-static errno_t pic_enable_irq(i8259_t *i8259, sysarg_t irq)
-{
-	if (irq > PIC_MAX_IRQ)
-		return ENOENT;
-
-	uint16_t irqmask = 1 << irq;
-	uint8_t val;
-
-	if (irqmask & 0xff) {
-		val = pio_read_8(i8259->regs0 + PIC_PIC0PORT2);
-		pio_write_8(i8259->regs0 + PIC_PIC0PORT2,
-		    (uint8_t) (val & (~(irqmask & 0xff))));
-	}
-
-	if (irqmask >> 8) {
-		val = pio_read_8(i8259->regs1 + PIC_PIC1PORT2);
-		pio_write_8(i8259->regs1 + PIC_PIC1PORT2,
-		    (uint8_t) (val & (~(irqmask >> 8))));
-	}
-
-	return EOK;
-}
-
-/** Handle one connection to i8259.
- *
- * @param icall Call data of the request that opened the connection.
- * @param arg   Local argument.
- *
- */
-static void i8259_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	i8259_t *i8259 = NULL /* XXX */;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	i8259 = (i8259_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	while (true) {
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IRC_ENABLE_INTERRUPT:
-			async_answer_0(&call, pic_enable_irq(i8259,
-			    ipc_get_arg1(&call)));
-			break;
-		case IRC_DISABLE_INTERRUPT:
-			/* XXX TODO */
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_CLEAR_INTERRUPT:
-			/* Noop */
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Add i8259 device. */
-errno_t i8259_add(i8259_t *i8259, i8259_res_t *res)
-{
-	sysarg_t have_i8259;
-	ioport8_t *regs0;
-	ioport8_t *regs1;
-	ddf_fun_t *fun_a = NULL;
-	errno_t rc;
-	bool bound = false;
-
-	if ((sysinfo_get_value("i8259", &have_i8259) != EOK) || (!have_i8259)) {
-		printf("%s: No i8259 found\n", NAME);
-		return ENOTSUP;
-	}
-
-	if ((pio_enable((void *) res->base0, IO_RANGE0_SIZE,
-	    (void **) &regs0) != EOK) ||
-	    (pio_enable((void *) res->base1, IO_RANGE1_SIZE,
-	    (void **) &regs1) != EOK)) {
-		printf("%s: i8259 not accessible\n", NAME);
-		return EIO;
-	}
-
-	i8259->regs0 = regs0;
-	i8259->regs1 = regs1;
-
-	fun_a = ddf_fun_create(i8259->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun_a, i8259_connection);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
-		goto error;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun_a, "irc");
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun_a);
-	if (fun_a != NULL)
-		ddf_fun_destroy(fun_a);
-	return rc;
-}
-
-/** Remove i8259 device */
-errno_t i8259_remove(i8259_t *i8259)
-{
-	return ENOTSUP;
-}
-
-/** i8259 device gone */
-errno_t i8259_gone(i8259_t *i8259)
-{
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/drv/intctl/i8259/i8259.h
===================================================================
--- uspace/drv/intctl/i8259/i8259.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8259
- * @{
- */
-/** @file
- */
-
-#ifndef I8259_H_
-#define I8259_H_
-
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t base0;
-	uintptr_t base1;
-} i8259_res_t;
-
-/** IntegratorCP Interrupt Controller */
-typedef struct {
-	ioport8_t *regs0;
-	ioport8_t *regs1;
-	ddf_dev_t *dev;
-} i8259_t;
-
-extern errno_t i8259_add(i8259_t *, i8259_res_t *);
-extern errno_t i8259_remove(i8259_t *);
-extern errno_t i8259_gone(i8259_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/i8259/i8259.ma
===================================================================
--- uspace/drv/intctl/i8259/i8259.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/i8259
Index: pace/drv/intctl/i8259/main.c
===================================================================
--- uspace/drv/intctl/i8259/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup i8259
- * @{
- */
-/** @file i8259 Interrupt Controller driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "i8259.h"
-
-#define NAME  "i8259"
-
-static errno_t i8259_dev_add(ddf_dev_t *dev);
-static errno_t i8259_dev_remove(ddf_dev_t *dev);
-static errno_t i8259_dev_gone(ddf_dev_t *dev);
-static errno_t i8259_fun_online(ddf_fun_t *fun);
-static errno_t i8259_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = i8259_dev_add,
-	.dev_remove = i8259_dev_remove,
-	.dev_gone = i8259_dev_gone,
-	.fun_online = i8259_fun_online,
-	.fun_offline = i8259_fun_offline
-};
-
-static driver_t i8259_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t i8259_get_res(ddf_dev_t *dev, i8259_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 2) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base0 = RNGABS(hw_res.mem_ranges.ranges[0]);
-	res->base1 = RNGABS(hw_res.mem_ranges.ranges[1]);
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t i8259_dev_add(ddf_dev_t *dev)
-{
-	i8259_t *i8259;
-	i8259_res_t i8259_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "i8259_dev_add(%p)", dev);
-	i8259 = ddf_dev_data_alloc(dev, sizeof(i8259_t));
-	if (i8259 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	i8259->dev = dev;
-
-	rc = i8259_get_res(dev, &i8259_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return i8259_add(i8259, &i8259_res);
-}
-
-static errno_t i8259_dev_remove(ddf_dev_t *dev)
-{
-	i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "i8259_dev_remove(%p)", dev);
-
-	return i8259_remove(i8259);
-}
-
-static errno_t i8259_dev_gone(ddf_dev_t *dev)
-{
-	i8259_t *i8259 = (i8259_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "i8259_dev_gone(%p)", dev);
-
-	return i8259_gone(i8259);
-}
-
-static errno_t i8259_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "i8259_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t i8259_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "i8259_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": i8259 Interrupt Controller driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&i8259_driver);
-}
-
-/** @}
- */
Index: pace/drv/intctl/i8259/meson.build
===================================================================
--- uspace/drv/intctl/i8259/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('i8259.c', 'main.c')
Index: pace/drv/intctl/icp-ic/doc/doxygroups.h
===================================================================
--- uspace/drv/intctl/icp-ic/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup icp-ic icp-ic
- * @brief Interrupt controller driver for Integrator/CP
- * @ingroup drvs
- */
Index: pace/drv/intctl/icp-ic/icp-ic.c
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup icp-ic
- * @{
- */
-
-/**
- * @file icp-ic.c
- * @brief IntegratorCP interrupt controller driver
- */
-
-#include <async.h>
-#include <bitops.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ipc/irc.h>
-#include <stdint.h>
-
-#include "icp-ic.h"
-#include "icp-ic_hw.h"
-
-enum {
-	icpic_max_irq = 32
-};
-
-static errno_t icpic_enable_irq(icpic_t *icpic, sysarg_t irq)
-{
-	if (irq > icpic_max_irq)
-		return EINVAL;
-
-	ddf_msg(LVL_NOTE, "Enable IRQ %zu", irq);
-
-	pio_write_32(&icpic->regs->irq_enableset, BIT_V(uint32_t, irq));
-	return EOK;
-}
-
-/** Client connection handler.
- *
- * @param icall Call data of the request that opened the connection.
- * @param arg   Local argument.
- *
- */
-static void icpic_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	icpic_t *icpic;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	icpic = (icpic_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	while (true) {
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* The other side has hung up. */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IRC_ENABLE_INTERRUPT:
-			async_answer_0(&call,
-			    icpic_enable_irq(icpic, ipc_get_arg1(&call)));
-			break;
-		case IRC_DISABLE_INTERRUPT:
-			/* XXX TODO */
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_CLEAR_INTERRUPT:
-			/* Noop */
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Add icp-ic device. */
-errno_t icpic_add(icpic_t *icpic, icpic_res_t *res)
-{
-	ddf_fun_t *fun_a = NULL;
-	void *regs;
-	errno_t rc;
-	bool bound = false;
-
-	rc = pio_enable((void *)res->base, sizeof(icpic_regs_t), &regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error enabling PIO");
-		goto error;
-	}
-
-	icpic->regs = (icpic_regs_t *)regs;
-
-	fun_a = ddf_fun_create(icpic->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun_a, icpic_connection);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
-		goto error;
-	}
-
-	rc = ddf_fun_add_to_category(fun_a, "irc");
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun_a);
-	if (fun_a != NULL)
-		ddf_fun_destroy(fun_a);
-	return rc;
-}
-
-/** Remove icp-ic device */
-errno_t icpic_remove(icpic_t *icpic)
-{
-	return ENOTSUP;
-}
-
-/** icp-ic device gone */
-errno_t icpic_gone(icpic_t *icpic)
-{
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/drv/intctl/icp-ic/icp-ic.h
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup icp-ic
- * @{
- */
-/** @file
- */
-
-#ifndef ICP_IC_H_
-#define ICP_IC_H_
-
-#include <ddf/driver.h>
-#include <loc.h>
-#include <stdint.h>
-
-#include "icp-ic_hw.h"
-
-typedef struct {
-	uintptr_t base;
-} icpic_res_t;
-
-/** IntegratorCP Interrupt Controller */
-typedef struct {
-	icpic_regs_t *regs;
-	uintptr_t phys_base;
-	ddf_dev_t *dev;
-} icpic_t;
-
-extern errno_t icpic_add(icpic_t *, icpic_res_t *);
-extern errno_t icpic_remove(icpic_t *);
-extern errno_t icpic_gone(icpic_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/icp-ic/icp-ic.ma
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 integratorcp/intctl
Index: pace/drv/intctl/icp-ic/icp-ic_hw.h
===================================================================
--- uspace/drv/intctl/icp-ic/icp-ic_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup icp-ic
- * @{
- */
-
-#ifndef ICP_IC_HW_H
-#define ICP_IC_HW_H
-
-#include <ddi.h>
-
-typedef struct {
-	ioport32_t irq_status;
-	ioport32_t irq_rawstat;
-	ioport32_t irq_enableset;
-	ioport32_t irq_enableclr;
-	ioport32_t int_softset;
-	ioport32_t int_softclr;
-	ioport32_t fiq_status;
-	ioport32_t fiq_rawstat;
-	ioport32_t fiq_enableset;
-	ioport32_t fiq_enableclr;
-} icpic_regs_t;
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/icp-ic/main.c
===================================================================
--- uspace/drv/intctl/icp-ic/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup icp-ic
- * @{
- */
-/** @file IntegratorCP Interrupt Controller driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "icp-ic.h"
-
-#define NAME  "icp-ic"
-
-static errno_t icpic_dev_add(ddf_dev_t *dev);
-static errno_t icpic_dev_remove(ddf_dev_t *dev);
-static errno_t icpic_dev_gone(ddf_dev_t *dev);
-static errno_t icpic_fun_online(ddf_fun_t *fun);
-static errno_t icpic_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = icpic_dev_add,
-	.dev_remove = icpic_dev_remove,
-	.dev_gone = icpic_dev_gone,
-	.fun_online = icpic_fun_online,
-	.fun_offline = icpic_fun_offline
-};
-
-static driver_t icpic_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t icpic_get_res(ddf_dev_t *dev, icpic_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.mem_ranges.ranges[0]);
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t icpic_dev_add(ddf_dev_t *dev)
-{
-	icpic_t *icpic;
-	icpic_res_t icpic_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "icpic_dev_add(%p)", dev);
-	icpic = ddf_dev_data_alloc(dev, sizeof(icpic_t));
-	if (icpic == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	icpic->dev = dev;
-
-	rc = icpic_get_res(dev, &icpic_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return icpic_add(icpic, &icpic_res);
-}
-
-static errno_t icpic_dev_remove(ddf_dev_t *dev)
-{
-	icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "icpic_dev_remove(%p)", dev);
-
-	return icpic_remove(icpic);
-}
-
-static errno_t icpic_dev_gone(ddf_dev_t *dev)
-{
-	icpic_t *icpic = (icpic_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "icpic_dev_gone(%p)", dev);
-
-	return icpic_gone(icpic);
-}
-
-static errno_t icpic_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "icpic_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t icpic_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "icpic_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": IntegratorCP Interrupt Controller driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&icpic_driver);
-}
-
-/** @}
- */
Index: pace/drv/intctl/icp-ic/meson.build
===================================================================
--- uspace/drv/intctl/icp-ic/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('icp-ic.c', 'main.c')
Index: pace/drv/intctl/obio/doc/doxygroups.h
===================================================================
--- uspace/drv/intctl/obio/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup obio obio
- * @brief OBIO interrupt controller driver
- * @ingroup drvs
- */
Index: pace/drv/intctl/obio/main.c
===================================================================
--- uspace/drv/intctl/obio/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup obio
- * @{
- */
-/** @file OBIO driver
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "obio.h"
-
-#define NAME  "obio"
-
-static errno_t obio_dev_add(ddf_dev_t *dev);
-static errno_t obio_dev_remove(ddf_dev_t *dev);
-static errno_t obio_dev_gone(ddf_dev_t *dev);
-static errno_t obio_fun_online(ddf_fun_t *fun);
-static errno_t obio_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = obio_dev_add,
-	.dev_remove = obio_dev_remove,
-	.dev_gone = obio_dev_gone,
-	.fun_online = obio_fun_online,
-	.fun_offline = obio_fun_offline
-};
-
-static driver_t obio_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-static errno_t obio_get_res(ddf_dev_t *dev, obio_res_t *res)
-{
-	async_sess_t *parent_sess;
-	hw_res_list_parsed_t hw_res;
-	errno_t rc;
-
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return ENOMEM;
-
-	hw_res_list_parsed_init(&hw_res);
-	rc = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
-	if (rc != EOK)
-		return rc;
-
-	if (hw_res.mem_ranges.count != 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	res->base = RNGABS(hw_res.mem_ranges.ranges[0]);
-
-	return EOK;
-error:
-	hw_res_list_parsed_clean(&hw_res);
-	return rc;
-}
-
-static errno_t obio_dev_add(ddf_dev_t *dev)
-{
-	obio_t *obio;
-	obio_res_t obio_res;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "obio_dev_add(%p)", dev);
-	obio = ddf_dev_data_alloc(dev, sizeof(obio_t));
-	if (obio == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	obio->dev = dev;
-
-	rc = obio_get_res(dev, &obio_res);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed getting hardware resource list.\n");
-		return EIO;
-	}
-
-	return obio_add(obio, &obio_res);
-}
-
-static errno_t obio_dev_remove(ddf_dev_t *dev)
-{
-	obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "obio_dev_remove(%p)", dev);
-
-	return obio_remove(obio);
-}
-
-static errno_t obio_dev_gone(ddf_dev_t *dev)
-{
-	obio_t *obio = (obio_t *)ddf_dev_data_get(dev);
-
-	ddf_msg(LVL_DEBUG, "obio_dev_gone(%p)", dev);
-
-	return obio_gone(obio);
-}
-
-static errno_t obio_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "obio_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t obio_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "obio_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": OBIO driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&obio_driver);
-}
-
-/** @}
- */
Index: pace/drv/intctl/obio/meson.build
===================================================================
--- uspace/drv/intctl/obio/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('main.c', 'obio.c')
Index: pace/drv/intctl/obio/obio.c
===================================================================
--- uspace/drv/intctl/obio/obio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup obio
- * @{
- */
-
-/**
- * @file obio.c
- * @brief OBIO driver.
- *
- * OBIO is a short for on-board I/O. On UltraSPARC IIi and systems with U2P,
- * there is a piece of the root PCI bus controller address space, which
- * contains interrupt mapping and clear registers for all on-board devices.
- * Although UltraSPARC IIi and U2P are different in general, these registers can
- * be found at the same addresses.
- */
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ddi.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inttypes.h>
-#include <ipc/irc.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "obio.h"
-
-#define NAME "obio"
-
-#define OBIO_SIZE	0x1898
-
-#define OBIO_IMR_BASE	0x200
-#define OBIO_IMR(ino)	(OBIO_IMR_BASE + ((ino) & INO_MASK))
-
-#define OBIO_CIR_BASE	0x300
-#define OBIO_CIR(ino)	(OBIO_CIR_BASE + ((ino) & INO_MASK))
-
-#define INO_MASK	0x1f
-
-/** Handle one connection to obio.
- *
- * @param icall Call data of the request that opened the connection.
- * @param arg   Local argument.
- *
- */
-static void obio_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	obio_t *obio;
-
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call.
-	 */
-	async_accept_0(icall);
-
-	obio = (obio_t *) ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *) arg));
-
-	while (true) {
-		int inr;
-
-		async_get_call(&call);
-
-		switch (ipc_get_imethod(&call)) {
-		case IRC_ENABLE_INTERRUPT:
-			inr = ipc_get_arg1(&call);
-			pio_set_64(&obio->regs[OBIO_IMR(inr & INO_MASK)],
-			    1UL << 31, 0);
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_DISABLE_INTERRUPT:
-			/* XXX TODO */
-			async_answer_0(&call, EOK);
-			break;
-		case IRC_CLEAR_INTERRUPT:
-			inr = ipc_get_arg1(&call);
-			pio_write_64(&obio->regs[OBIO_CIR(inr & INO_MASK)], 0);
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** Add OBIO device. */
-errno_t obio_add(obio_t *obio, obio_res_t *res)
-{
-	ddf_fun_t *fun_a = NULL;
-	errno_t rc;
-	bool bound = false;
-
-	rc = pio_enable((void *)res->base, OBIO_SIZE, (void **) &obio->regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error mapping OBIO registers");
-		rc = EIO;
-		goto error;
-	}
-
-	ddf_msg(LVL_NOTE, "OBIO registers with base at 0x%" PRIxn, res->base);
-
-	fun_a = ddf_fun_create(obio->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ddf_fun_set_conn_handler(fun_a, obio_connection);
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a': %s", str_error(rc));
-		goto error;
-	}
-
-	rc = ddf_fun_add_to_category(fun_a, "irc");
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (bound)
-		ddf_fun_unbind(fun_a);
-	if (fun_a != NULL)
-		ddf_fun_destroy(fun_a);
-	return rc;
-}
-
-/** Remove OBIO device */
-errno_t obio_remove(obio_t *obio)
-{
-	return ENOTSUP;
-}
-
-/** OBIO device gone */
-errno_t obio_gone(obio_t *obio)
-{
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/drv/intctl/obio/obio.h
===================================================================
--- uspace/drv/intctl/obio/obio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup obio
- * @{
- */
-/** @file
- */
-
-#ifndef OBIO_H_
-#define OBIO_H_
-
-#include <ddf/driver.h>
-#include <ddi.h>
-#include <loc.h>
-#include <stdint.h>
-
-typedef struct {
-	uintptr_t base;
-} obio_res_t;
-
-/** OBIO */
-typedef struct {
-	ioport64_t *regs;
-	uintptr_t phys_base;
-	ddf_dev_t *dev;
-} obio_t;
-
-extern errno_t obio_add(obio_t *, obio_res_t *);
-extern errno_t obio_remove(obio_t *);
-extern errno_t obio_gone(obio_t *);
-
-#endif
-
-/** @}
- */
Index: pace/drv/intctl/obio/obio.ma
===================================================================
--- uspace/drv/intctl/obio/obio.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 ebus/obio
Index: pace/drv/meson.build
===================================================================
--- uspace/drv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-drvs = [
-	'audio/hdaudio',
-	'audio/sb16',
-	'root/root',
-	'root/virt',
-	'block/ahci',
-	'block/ddisk',
-	'block/isa-ide',
-	'block/pc-floppy',
-	'block/pci-ide',
-	'block/usbmast',
-	'block/virtio-blk',
-	'bus/adb/cuda_adb',
-	'bus/isa',
-	'bus/pci/pciintel',
-	'bus/usb/ehci',
-	'bus/usb/ohci',
-	'bus/usb/uhci',
-	'bus/usb/usbdiag',
-	'bus/usb/usbflbk',
-	'bus/usb/usbhub',
-	'bus/usb/usbmid',
-	'bus/usb/vhc',
-	'bus/usb/xhci',
-	'char/i8042',
-	'char/msim-con',
-	'char/ns8250',
-	'char/pc-lpt',
-	'char/pl011',
-	'char/pl050',
-	'char/ski-con',
-	'char/sun4v-con',
-	'fb/amdm37x_dispc',
-	'fb/kfb',
-	'hid/adb-kbd',
-	'hid/adb-mouse',
-	'hid/atkbd',
-	'hid/ps2mouse',
-	'hid/usbhid',
-	'hid/xtkbd',
-	'intctl/apic',
-	'intctl/gicv2',
-	'intctl/i8259',
-	'intctl/icp-ic',
-	'intctl/obio',
-	'nic/ne2k',
-	'nic/e1k',
-	'nic/rtl8139',
-	'nic/rtl8169',
-	'nic/ar9271',
-	'nic/virtio-net',
-	'platform/amdm37x',
-	'platform/arm64virt',
-	'platform/hikey960',
-	'platform/icp',
-	'platform/mac',
-	'platform/malta',
-	'platform/msim',
-	'platform/pc',
-	'platform/ski',
-	'platform/sun4v',
-	'test/test1',
-	'test/test2',
-	'test/test3',
-	'time/cmos-rtc',
-]
-
-# sun4u driver won't compile on 32-bit targets
-if UARCH == 'sparc64'
-	drvs += 'platform/sun4u'
-endif
Index: pace/drv/nic/ar9271/ar9271.c
===================================================================
--- uspace/drv/nic/ar9271/ar9271.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,952 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ar9271.c
- *
- * Driver for AR9271 USB WiFi dongle.
- *
- */
-
-#include <async.h>
-#include <ieee80211.h>
-#include <usb/classes/classes.h>
-#include <usb/dev/request.h>
-#include <usb/dev/poll.h>
-#include <usb/debug.h>
-#include <stdio.h>
-#include <ddf/interrupt.h>
-#include <errno.h>
-#include <str_error.h>
-#include <nic.h>
-#include <macros.h>
-#include "ath_usb.h"
-#include "wmi.h"
-#include "hw.h"
-#include "ar9271.h"
-
-#define NAME  "ar9271"
-#define FIRMWARE_FILENAME  "/drv/ar9271/ar9271.fw"
-
-const usb_endpoint_description_t usb_ar9271_out_bulk_endpoint_description = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_VENDOR_SPECIFIC,
-	.interface_subclass = 0x0,
-	.interface_protocol = 0x0,
-	.flags = 0
-};
-
-const usb_endpoint_description_t usb_ar9271_in_bulk_endpoint_description = {
-	.transfer_type = USB_TRANSFER_BULK,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_VENDOR_SPECIFIC,
-	.interface_subclass = 0x0,
-	.interface_protocol = 0x0,
-	.flags = 0
-};
-
-const usb_endpoint_description_t usb_ar9271_in_int_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_IN,
-	.interface_class = USB_CLASS_VENDOR_SPECIFIC,
-	.interface_subclass = 0x0,
-	.interface_protocol = 0x0,
-	.flags = 0
-};
-
-const usb_endpoint_description_t usb_ar9271_out_int_endpoint_description = {
-	.transfer_type = USB_TRANSFER_INTERRUPT,
-	.direction = USB_DIRECTION_OUT,
-	.interface_class = USB_CLASS_VENDOR_SPECIFIC,
-	.interface_subclass = 0x0,
-	.interface_protocol = 0x0,
-	.flags = 0
-};
-
-/* Array of endpoints expected on the device, NULL terminated. */
-const usb_endpoint_description_t *endpoints[] = {
-	&usb_ar9271_out_bulk_endpoint_description,
-	&usb_ar9271_in_bulk_endpoint_description,
-	&usb_ar9271_in_int_endpoint_description,
-	&usb_ar9271_out_int_endpoint_description,
-	NULL
-};
-
-/* Callback when new device is to be controlled by this driver. */
-static errno_t ar9271_add_device(ddf_dev_t *);
-
-/* IEEE 802.11 callbacks */
-static errno_t ar9271_ieee80211_start(ieee80211_dev_t *);
-static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *, void *, size_t);
-static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *, uint16_t);
-static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *, bool);
-static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *, ieee80211_key_config_t *,
-    bool);
-
-static driver_ops_t ar9271_driver_ops = {
-	.dev_add = ar9271_add_device
-};
-
-static driver_t ar9271_driver = {
-	.name = NAME,
-	.driver_ops = &ar9271_driver_ops
-};
-
-static ieee80211_ops_t ar9271_ieee80211_ops = {
-	.start = ar9271_ieee80211_start,
-	.tx_handler = ar9271_ieee80211_tx_handler,
-	.set_freq = ar9271_ieee80211_set_freq,
-	.bssid_change = ar9271_ieee80211_bssid_change,
-	.key_config = ar9271_ieee80211_key_config
-};
-
-static ieee80211_iface_t ar9271_ieee80211_iface;
-
-static errno_t ar9271_get_device_info(ddf_fun_t *, nic_device_info_t *);
-static errno_t ar9271_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
-static errno_t ar9271_get_operation_mode(ddf_fun_t *, int *, nic_channel_mode_t *,
-    nic_role_t *);
-
-static nic_iface_t ar9271_ieee80211_nic_iface = {
-	.get_device_info = &ar9271_get_device_info,
-	.get_cable_state = &ar9271_get_cable_state,
-	.get_operation_mode = &ar9271_get_operation_mode
-};
-
-static ddf_dev_ops_t ar9271_ieee80211_dev_ops;
-
-/** Get device information.
- *
- */
-static errno_t ar9271_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
-{
-	assert(dev);
-	assert(info);
-
-	memset(info, 0, sizeof(nic_device_info_t));
-
-	info->vendor_id = 0x0cf3;
-	info->device_id = 0x9271;
-	str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH,
-	    "Atheros Communications, Inc.");
-	str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH,
-	    "AR9271");
-
-	return EOK;
-}
-
-/** Get cable state.
- *
- */
-static errno_t ar9271_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	if (!nic_data)
-		return ENOENT;
-	ar9271_t *ar9271 = nic_get_specific(nic_data);
-	if (!ar9271)
-		return ENOENT;
-
-	if (ieee80211_is_connected(ar9271->ieee80211_dev))
-		*state = NIC_CS_PLUGGED;
-	else
-		*state = NIC_CS_UNPLUGGED;
-
-	return EOK;
-}
-
-/** Get operation mode of the device.
- *
- */
-static errno_t ar9271_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	*duplex = NIC_CM_FULL_DUPLEX;
-	*speed = 10;
-	*role = NIC_ROLE_UNKNOWN;
-
-	return EOK;
-}
-
-/** Set multicast frames acceptance mode.
- *
- */
-static errno_t ar9271_on_multicast_mode_change(nic_t *nic,
-    nic_multicast_mode_t mode, const nic_address_t *addr, size_t addr_cnt)
-{
-	switch (mode) {
-	case NIC_MULTICAST_BLOCKED:
-		/* TODO */
-		break;
-	case NIC_MULTICAST_LIST:
-		/* TODO */
-		break;
-	case NIC_MULTICAST_PROMISC:
-		/* TODO */
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/** Set unicast frames acceptance mode.
- *
- */
-static errno_t ar9271_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	switch (mode) {
-	case NIC_UNICAST_BLOCKED:
-		/* TODO */
-		break;
-	case NIC_UNICAST_DEFAULT:
-		/* TODO */
-		break;
-	case NIC_UNICAST_LIST:
-		/* TODO */
-		break;
-	case NIC_UNICAST_PROMISC:
-		/* TODO */
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/** Set broadcast frames acceptance mode.
- *
- */
-static errno_t ar9271_on_broadcast_mode_change(nic_t *nic,
-    nic_broadcast_mode_t mode)
-{
-	switch (mode) {
-	case NIC_BROADCAST_BLOCKED:
-		/* TODO */
-		break;
-	case NIC_BROADCAST_ACCEPTED:
-		/* TODO */
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-static bool ar9271_rx_status_error(uint8_t status)
-{
-	return (status & AR9271_RX_ERROR_PHY) || (status & AR9271_RX_ERROR_CRC);
-}
-
-static errno_t ar9271_data_polling(void *arg)
-{
-	assert(arg);
-
-	ar9271_t *ar9271 = (ar9271_t *) arg;
-
-	size_t buffer_size = ar9271->ath_device->data_response_length;
-	void *buffer = malloc(buffer_size);
-
-	while (true) {
-		size_t transferred_size;
-		if (htc_read_data_message(ar9271->htc_device,
-		    buffer, buffer_size, &transferred_size) == EOK) {
-			size_t strip_length =
-			    sizeof(ath_usb_data_header_t) +
-			    sizeof(htc_frame_header_t) +
-			    sizeof(htc_rx_status_t);
-
-			if (transferred_size < strip_length)
-				continue;
-
-			ath_usb_data_header_t *data_header =
-			    (ath_usb_data_header_t *) buffer;
-
-			/* Invalid packet. */
-			if (data_header->tag != uint16_t_le2host(RX_TAG))
-				continue;
-
-			htc_rx_status_t *rx_status =
-			    (htc_rx_status_t *) ((void *) buffer +
-			    sizeof(ath_usb_data_header_t) +
-			    sizeof(htc_frame_header_t));
-
-			uint16_t data_length =
-			    uint16_t_be2host(rx_status->data_length);
-
-			int16_t payload_length =
-			    transferred_size - strip_length;
-
-			if (payload_length - data_length < 0)
-				continue;
-
-			if (ar9271_rx_status_error(rx_status->status))
-				continue;
-
-			void *strip_buffer = buffer + strip_length;
-
-			ieee80211_rx_handler(ar9271->ieee80211_dev,
-			    strip_buffer,
-			    payload_length);
-		}
-	}
-
-	free(buffer);
-
-	return EOK;
-}
-
-/** IEEE 802.11 handlers.
- *
- */
-static errno_t ar9271_ieee80211_set_freq(ieee80211_dev_t *ieee80211_dev,
-    uint16_t freq)
-{
-	assert(ieee80211_dev);
-
-	ar9271_t *ar9271 = (ar9271_t *) ieee80211_get_specific(ieee80211_dev);
-
-	wmi_send_command(ar9271->htc_device, WMI_DISABLE_INTR, NULL, 0, NULL);
-	wmi_send_command(ar9271->htc_device, WMI_DRAIN_TXQ_ALL, NULL, 0, NULL);
-	wmi_send_command(ar9271->htc_device, WMI_STOP_RECV, NULL, 0, NULL);
-
-	errno_t rc = hw_freq_switch(ar9271, freq);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW switch frequency.\n");
-		return rc;
-	}
-
-	wmi_send_command(ar9271->htc_device, WMI_START_RECV, NULL, 0, NULL);
-
-	rc = hw_rx_init(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to initialize RX.\n");
-		return rc;
-	}
-
-	uint16_t htc_mode = host2uint16_t_be(1);
-	wmi_send_command(ar9271->htc_device, WMI_SET_MODE,
-	    (uint8_t *) &htc_mode, sizeof(htc_mode), NULL);
-	wmi_send_command(ar9271->htc_device, WMI_ENABLE_INTR, NULL, 0, NULL);
-
-	return EOK;
-}
-
-static errno_t ar9271_ieee80211_bssid_change(ieee80211_dev_t *ieee80211_dev,
-    bool connected)
-{
-	assert(ieee80211_dev);
-
-	ar9271_t *ar9271 = (ar9271_t *) ieee80211_get_specific(ieee80211_dev);
-
-	if (connected) {
-		nic_address_t bssid;
-		ieee80211_query_bssid(ieee80211_dev, &bssid);
-
-		htc_sta_msg_t sta_msg;
-		memset(&sta_msg, 0, sizeof(htc_sta_msg_t));
-		sta_msg.is_vif_sta = 0;
-		sta_msg.max_ampdu =
-		    host2uint16_t_be(1 << IEEE80211_MAX_AMPDU_FACTOR);
-		sta_msg.sta_index = 1;
-		sta_msg.vif_index = 0;
-		memcpy(&sta_msg.addr, bssid.address, ETH_ADDR);
-
-		wmi_send_command(ar9271->htc_device, WMI_NODE_CREATE,
-		    (uint8_t *) &sta_msg, sizeof(sta_msg), NULL);
-
-		htc_rate_msg_t rate_msg;
-		memset(&rate_msg, 0, sizeof(htc_rate_msg_t));
-		rate_msg.sta_index = 1;
-		rate_msg.is_new = 1;
-		rate_msg.legacy_rates_count = ARRAY_SIZE(ieee80211bg_data_rates);
-		memcpy(&rate_msg.legacy_rates,
-		    ieee80211bg_data_rates,
-		    ARRAY_SIZE(ieee80211bg_data_rates));
-
-		wmi_send_command(ar9271->htc_device, WMI_RC_RATE_UPDATE,
-		    (uint8_t *) &rate_msg, sizeof(rate_msg), NULL);
-
-		hw_set_rx_filter(ar9271, true);
-	} else {
-		uint8_t station_id = 1;
-		wmi_send_command(ar9271->htc_device, WMI_NODE_REMOVE,
-		    &station_id, sizeof(station_id), NULL);
-
-		hw_set_rx_filter(ar9271, false);
-	}
-
-	hw_set_bssid(ar9271);
-
-	return EOK;
-}
-
-static errno_t ar9271_ieee80211_key_config(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_key_config_t *key_conf, bool insert)
-{
-	assert(ieee80211_dev);
-
-	ar9271_t *ar9271 = (ar9271_t *) ieee80211_get_specific(ieee80211_dev);
-
-	if (insert) {
-		assert(key_conf);
-
-		uint32_t key[5];
-		uint32_t key_type;
-		uint32_t reg_ptr, mic_reg_ptr;
-		void *data_start;
-
-		nic_address_t bssid;
-		ieee80211_query_bssid(ieee80211_dev, &bssid);
-
-		switch (key_conf->suite) {
-		case IEEE80211_SECURITY_SUITE_WEP40:
-			key_type = AR9271_KEY_TABLE_TYPE_WEP40;
-			break;
-		case IEEE80211_SECURITY_SUITE_WEP104:
-			key_type = AR9271_KEY_TABLE_TYPE_WEP104;
-			break;
-		case IEEE80211_SECURITY_SUITE_TKIP:
-			key_type = AR9271_KEY_TABLE_TYPE_TKIP;
-			break;
-		case IEEE80211_SECURITY_SUITE_CCMP:
-			key_type = AR9271_KEY_TABLE_TYPE_CCMP;
-			break;
-		default:
-			key_type = -1;
-		}
-
-		uint8_t key_id =
-		    (key_conf->flags & IEEE80211_KEY_FLAG_TYPE_PAIRWISE) ?
-		    AR9271_STA_KEY_INDEX : key_conf->id;
-
-		reg_ptr = AR9271_KEY_TABLE(key_id);
-		mic_reg_ptr = AR9271_KEY_TABLE(key_id + 64);
-		data_start = (void *) key_conf->data;
-
-		key[0] = uint32_t_le2host(*((uint32_t *) data_start));
-		key[1] = uint16_t_le2host(*((uint16_t *) (data_start + 4)));
-		key[2] = uint32_t_le2host(*((uint32_t *) (data_start + 6)));
-		key[3] = uint16_t_le2host(*((uint16_t *) (data_start + 10)));
-		key[4] = uint32_t_le2host(*((uint32_t *) (data_start + 12)));
-
-		if ((key_conf->suite == IEEE80211_SECURITY_SUITE_WEP40) ||
-		    (key_conf->suite == IEEE80211_SECURITY_SUITE_WEP104))
-			key[4] &= 0xFF;
-
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 0, key[0]);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 4, key[1]);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 8, key[2]);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 12, key[3]);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 16, key[4]);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 20, key_type);
-
-		uint32_t macl;
-		uint32_t mach;
-		if (key_conf->flags & IEEE80211_KEY_FLAG_TYPE_PAIRWISE) {
-			data_start = (void *) bssid.address;
-			macl = uint32_t_le2host(*((uint32_t *) data_start));
-			mach = uint16_t_le2host(*((uint16_t *) (data_start + 4)));
-		} else {
-			macl = 0;
-			mach = 0;
-		}
-
-		macl >>= 1;
-		macl |= (mach & 1) << 31;
-		mach >>= 1;
-		mach |= 0x8000;
-
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 24, macl);
-		wmi_reg_write(ar9271->htc_device, reg_ptr + 28, mach);
-
-		/* Setup MIC keys for TKIP. */
-		if (key_conf->suite == IEEE80211_SECURITY_SUITE_TKIP) {
-			uint32_t mic[5];
-			uint8_t *gen_mic = data_start + IEEE80211_TKIP_RX_MIC_OFFSET;
-			uint8_t *tx_mic;
-
-			if (key_conf->flags & IEEE80211_KEY_FLAG_TYPE_GROUP)
-				tx_mic = gen_mic;
-			else
-				tx_mic = data_start + IEEE80211_TKIP_TX_MIC_OFFSET;
-
-			mic[0] = uint32_t_le2host(*((uint32_t *) gen_mic));
-			mic[1] = uint16_t_le2host(*((uint16_t *) (tx_mic + 2))) & 0xFFFF;
-			mic[2] = uint32_t_le2host(*((uint32_t *) (gen_mic + 4)));
-			mic[3] = uint16_t_le2host(*((uint16_t *) tx_mic)) & 0xFFFF;
-			mic[4] = uint32_t_le2host(*((uint32_t *) (tx_mic + 4)));
-
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 0, mic[0]);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 4, mic[1]);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 8, mic[2]);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 12, mic[3]);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 16, mic[4]);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 20,
-			    AR9271_KEY_TABLE_TYPE_CLR);
-
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 24, 0);
-			wmi_reg_write(ar9271->htc_device, mic_reg_ptr + 28, 0);
-		}
-
-		if (key_conf->flags & IEEE80211_KEY_FLAG_TYPE_GROUP)
-			ieee80211_setup_key_confirm(ieee80211_dev, true);
-	} else {
-		/* TODO: Delete keys from device */
-		ieee80211_setup_key_confirm(ieee80211_dev, false);
-	}
-
-	return EOK;
-}
-
-static errno_t ar9271_ieee80211_tx_handler(ieee80211_dev_t *ieee80211_dev,
-    void *buffer, size_t buffer_size)
-{
-	assert(ieee80211_dev);
-
-	size_t complete_size;
-	size_t offset;
-	void *complete_buffer;
-	int endpoint;
-
-	ar9271_t *ar9271 = (ar9271_t *) ieee80211_get_specific(ieee80211_dev);
-
-	uint16_t frame_ctrl = *((uint16_t *) buffer);
-	if (ieee80211_is_data_frame(frame_ctrl)) {
-		offset = sizeof(htc_tx_data_header_t) +
-		    sizeof(htc_frame_header_t);
-		complete_size = buffer_size + offset;
-		complete_buffer = malloc(complete_size);
-		memset(complete_buffer, 0, complete_size);
-
-		/*
-		 * Because we handle just station mode yet, node ID and VIF ID
-		 * are fixed.
-		 */
-		htc_tx_data_header_t *data_header =
-		    (htc_tx_data_header_t *)
-		    (complete_buffer + sizeof(htc_frame_header_t));
-		data_header->data_type = HTC_DATA_NORMAL;
-		data_header->node_idx = 1;
-		data_header->vif_idx = 0;
-		data_header->cookie = 0;
-
-		if (ieee80211_query_using_key(ieee80211_dev)) {
-			data_header->keyix = AR9271_STA_KEY_INDEX;
-
-			int sec_suite =
-			    ieee80211_get_pairwise_security(ieee80211_dev);
-
-			switch (sec_suite) {
-			case IEEE80211_SECURITY_SUITE_WEP40:
-			case IEEE80211_SECURITY_SUITE_WEP104:
-				data_header->key_type = AR9271_KEY_TYPE_WEP;
-				break;
-			case IEEE80211_SECURITY_SUITE_TKIP:
-				data_header->key_type = AR9271_KEY_TYPE_TKIP;
-				break;
-			case IEEE80211_SECURITY_SUITE_CCMP:
-				data_header->key_type = AR9271_KEY_TYPE_AES;
-				break;
-			}
-		} else {
-			data_header->key_type = 0;
-			data_header->keyix = 0xFF;
-		}
-
-		endpoint = ar9271->htc_device->endpoints.data_be_endpoint;
-	} else {
-		offset = sizeof(htc_tx_management_header_t) +
-		    sizeof(htc_frame_header_t);
-		complete_size = buffer_size + offset;
-		complete_buffer = malloc(complete_size);
-		memset(complete_buffer, 0, complete_size);
-
-		/*
-		 * Because we handle just station mode yet, node ID and VIF ID
-		 * are fixed.
-		 */
-		htc_tx_management_header_t *mgmt_header =
-		    (htc_tx_management_header_t *)
-		    (complete_buffer + sizeof(htc_frame_header_t));
-		mgmt_header->node_idx = 0;
-		mgmt_header->vif_idx = 0;
-		mgmt_header->cookie = 0;
-		mgmt_header->keyix = 0xFF;
-
-		endpoint = ar9271->htc_device->endpoints.mgmt_endpoint;
-	}
-
-	/* Copy IEEE802.11 data to new allocated buffer with HTC headers. */
-	memcpy(complete_buffer + offset, buffer, buffer_size);
-
-	htc_send_data_message(ar9271->htc_device, complete_buffer,
-	    complete_size, endpoint);
-
-	free(complete_buffer);
-
-	return EOK;
-}
-
-static errno_t ar9271_ieee80211_start(ieee80211_dev_t *ieee80211_dev)
-{
-	assert(ieee80211_dev);
-
-	ar9271_t *ar9271 = (ar9271_t *) ieee80211_get_specific(ieee80211_dev);
-
-	wmi_send_command(ar9271->htc_device, WMI_FLUSH_RECV, NULL, 0, NULL);
-
-	errno_t rc = hw_reset(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to do HW reset.\n");
-		return rc;
-	}
-
-	uint16_t htc_mode = host2uint16_t_be(1);
-	wmi_send_command(ar9271->htc_device, WMI_SET_MODE,
-	    (uint8_t *) &htc_mode, sizeof(htc_mode), NULL);
-	wmi_send_command(ar9271->htc_device, WMI_ATH_INIT, NULL, 0, NULL);
-	wmi_send_command(ar9271->htc_device, WMI_START_RECV, NULL, 0, NULL);
-	wmi_send_command(ar9271->htc_device, WMI_ENABLE_INTR, NULL, 0, NULL);
-
-	rc = hw_rx_init(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to initialize RX.\n");
-		return rc;
-	}
-
-	/* Send capability message to target. */
-	htc_cap_msg_t cap_msg;
-	cap_msg.ampdu_limit = host2uint32_t_be(0xffff);
-	cap_msg.ampdu_subframes = 0xff;
-	cap_msg.enable_coex = 0;
-	cap_msg.tx_chainmask = 0x1;
-
-	wmi_send_command(ar9271->htc_device, WMI_TARGET_IC_UPDATE,
-	    (uint8_t *) &cap_msg, sizeof(cap_msg), NULL);
-
-	rc = htc_init_new_vif(ar9271->htc_device);
-	if (rc != EOK) {
-		usb_log_error("Failed to initialize new VIF.\n");
-		return rc;
-	}
-
-	/* Add data polling fibril. */
-	fid_t fibril = fibril_create(ar9271_data_polling, ar9271);
-	if (fibril == 0)
-		return ENOMEM;
-
-	fibril_add_ready(fibril);
-
-	ar9271->starting_up = false;
-	ieee80211_set_ready(ieee80211_dev, true);
-
-	usb_log_info("Device fully initialized.\n");
-
-	return EOK;
-}
-
-static errno_t ar9271_init(ar9271_t *ar9271, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
-{
-	ar9271->starting_up = true;
-	ar9271->usb_device = usb_device;
-
-	fibril_mutex_initialize(&ar9271->ar9271_lock);
-
-	ar9271->ath_device = calloc(1, sizeof(ath_t));
-	if (!ar9271->ath_device) {
-		usb_log_error("Failed to allocate memory for ath device "
-		    "structure.\n");
-		return ENOMEM;
-	}
-
-	errno_t rc = ath_usb_init(ar9271->ath_device, usb_device, endpoints);
-	if (rc != EOK) {
-		free(ar9271->ath_device);
-		usb_log_error("Failed to initialize ath device.\n");
-		return rc;
-	}
-
-	/* IEEE 802.11 framework structure initialization. */
-	ar9271->ieee80211_dev = ieee80211_device_create();
-	if (!ar9271->ieee80211_dev) {
-		free(ar9271->ath_device);
-		usb_log_error("Failed to allocate memory for IEEE80211 device "
-		    "structure.\n");
-		return ENOMEM;
-	}
-
-	rc = ieee80211_device_init(ar9271->ieee80211_dev, ar9271->ddf_dev);
-	if (rc != EOK) {
-		free(ar9271->ieee80211_dev);
-		free(ar9271->ath_device);
-		usb_log_error("Failed to initialize IEEE80211 device structure."
-		    "\n");
-		return rc;
-	}
-
-	ieee80211_set_specific(ar9271->ieee80211_dev, ar9271);
-
-	/* HTC device structure initialization. */
-	ar9271->htc_device = calloc(1, sizeof(htc_device_t));
-	if (!ar9271->htc_device) {
-		free(ar9271->ieee80211_dev);
-		free(ar9271->ath_device);
-		usb_log_error("Failed to allocate memory for HTC device "
-		    "structure.\n");
-		return ENOMEM;
-	}
-
-	rc = htc_device_init(ar9271->ath_device, ar9271->ieee80211_dev,
-	    ar9271->htc_device);
-	if (rc != EOK) {
-		free(ar9271->htc_device);
-		free(ar9271->ieee80211_dev);
-		free(ar9271->ath_device);
-		usb_log_error("Failed to initialize HTC device structure.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Upload firmware to WiFi device.
- *
- * @param ar9271 AR9271 device structure
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-static errno_t ar9271_upload_fw(ar9271_t *ar9271)
-{
-	usb_device_t *usb_device = ar9271->usb_device;
-
-	/* TODO: Set by maximum packet size in pipe. */
-	static const size_t MAX_TRANSFER_SIZE = 512;
-
-	/* Load FW from file. */
-	FILE *fw_file = fopen(FIRMWARE_FILENAME, "rb");
-	if (fw_file == NULL) {
-		usb_log_error("Failed opening file with firmware.\n");
-		return ENOENT;
-	}
-
-	fseek(fw_file, 0, SEEK_END);
-	uint64_t file_size = ftell(fw_file);
-	fseek(fw_file, 0, SEEK_SET);
-
-	void *fw_data = malloc(file_size);
-	if (fw_data == NULL) {
-		fclose(fw_file);
-		usb_log_error("Failed allocating memory for firmware.\n");
-		return ENOMEM;
-	}
-
-	fread(fw_data, file_size, 1, fw_file);
-	fclose(fw_file);
-
-	/* Upload FW to device. */
-	uint64_t remain_size = file_size;
-	uint32_t current_addr = AR9271_FW_ADDRESS;
-	uint8_t *current_data = fw_data;
-	uint8_t *buffer = malloc(MAX_TRANSFER_SIZE);
-
-	while (remain_size > 0) {
-		size_t chunk_size = min(remain_size, MAX_TRANSFER_SIZE);
-		memcpy(buffer, current_data, chunk_size);
-		usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
-		errno_t rc = usb_control_request_set(ctrl_pipe,
-		    USB_REQUEST_TYPE_VENDOR,
-		    USB_REQUEST_RECIPIENT_DEVICE,
-		    AR9271_FW_DOWNLOAD,
-		    uint16_host2usb(current_addr >> 8),
-		    0, buffer, chunk_size);
-		if (rc != EOK) {
-			free(fw_data);
-			free(buffer);
-			usb_log_error("Error while uploading firmware. "
-			    "Error: %s\n", str_error_name(rc));
-			return rc;
-		}
-
-		remain_size -= chunk_size;
-		current_addr += chunk_size;
-		current_data += chunk_size;
-	}
-
-	free(fw_data);
-	free(buffer);
-
-	/*
-	 * Send command that firmware is successfully uploaded.
-	 * This should initiate creating confirmation message in
-	 * device side buffer which we will check in htc_check_ready function.
-	 */
-	usb_pipe_t *ctrl_pipe = usb_device_get_default_pipe(usb_device);
-	errno_t rc = usb_control_request_set(ctrl_pipe,
-	    USB_REQUEST_TYPE_VENDOR,
-	    USB_REQUEST_RECIPIENT_DEVICE,
-	    AR9271_FW_DOWNLOAD_COMP,
-	    uint16_host2usb(AR9271_FW_OFFSET >> 8),
-	    0, NULL, 0);
-
-	if (rc != EOK) {
-		usb_log_error("IO error when sending fw upload confirmation "
-		    "message.\n");
-		return rc;
-	}
-
-	usb_log_info("Firmware uploaded successfully.\n");
-
-	/* Wait until firmware is ready - wait for 1 second to be sure. */
-	fibril_sleep(1);
-
-	return rc;
-}
-
-/** Create driver data structure.
- *
- *  @param dev The device structure
- *
- *  @return Intialized device data structure or NULL if error occured
- */
-static ar9271_t *ar9271_create_dev_data(ddf_dev_t *dev)
-{
-	/* USB framework initialization. */
-	const char *err_msg = NULL;
-	errno_t rc = usb_device_create_ddf(dev, endpoints, &err_msg);
-	if (rc != EOK) {
-		usb_log_error("Failed to create USB device: %s, "
-		    "ERR_NUM = %s\n", err_msg, str_error_name(rc));
-		return NULL;
-	}
-
-	/* AR9271 structure initialization. */
-	ar9271_t *ar9271 = calloc(1, sizeof(ar9271_t));
-	if (!ar9271) {
-		usb_log_error("Failed to allocate memory for device "
-		    "structure.\n");
-		return NULL;
-	}
-
-	ar9271->ddf_dev = dev;
-
-	rc = ar9271_init(ar9271, usb_device_get(dev), endpoints);
-	if (rc != EOK) {
-		free(ar9271);
-		usb_log_error("Failed to initialize AR9271 structure: %s\n",
-		    str_error_name(rc));
-		return NULL;
-	}
-
-	return ar9271;
-}
-
-/** Clean up the ar9271 device structure.
- *
- * @param dev  The device structure.
- */
-static void ar9271_delete_dev_data(ar9271_t *ar9271)
-{
-	assert(ar9271);
-
-	// TODO
-}
-
-/** Probe and initialize the newly added device.
- *
- * @param dev The device structure.
- *
- * @return EOK if succeed, error code otherwise
- */
-static errno_t ar9271_add_device(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	/* Allocate driver data for the device. */
-	ar9271_t *ar9271 = ar9271_create_dev_data(dev);
-	if (ar9271 == NULL) {
-		usb_log_error("Unable to allocate device softstate.\n");
-		return ENOMEM;
-	}
-
-	usb_log_info("HelenOS AR9271 device initialized.\n");
-
-	/* Upload AR9271 firmware. */
-	ar9271_upload_fw(ar9271);
-
-	/* Initialize AR9271 HTC services. */
-	errno_t rc = htc_init(ar9271->htc_device);
-	if (rc != EOK) {
-		ar9271_delete_dev_data(ar9271);
-		usb_log_error("HTC initialization failed.\n");
-		return rc;
-	}
-
-	/* Initialize AR9271 HW. */
-	rc = hw_init(ar9271);
-	if (rc != EOK) {
-		ar9271_delete_dev_data(ar9271);
-		usb_log_error("HW initialization failed.\n");
-		return rc;
-	}
-
-	/* Initialize AR9271 IEEE 802.11 framework. */
-	rc = ieee80211_init(ar9271->ieee80211_dev, &ar9271_ieee80211_ops,
-	    &ar9271_ieee80211_iface, &ar9271_ieee80211_nic_iface,
-	    &ar9271_ieee80211_dev_ops);
-	if (rc != EOK) {
-		ar9271_delete_dev_data(ar9271);
-		usb_log_error("Failed to initialize IEEE80211 framework.\n");
-		return rc;
-	}
-
-	nic_set_filtering_change_handlers(nic_get_from_ddf_dev(dev),
-	    ar9271_on_unicast_mode_change, ar9271_on_multicast_mode_change,
-	    ar9271_on_broadcast_mode_change, NULL, NULL);
-
-	usb_log_info("HelenOS AR9271 added device.\n");
-
-	return EOK;
-}
-
-int main(void)
-{
-	log_init(NAME);
-
-	if (nic_driver_init(NAME) != EOK)
-		return 1;
-
-	usb_log_info("HelenOS AR9271 driver started.\n");
-
-	return ddf_driver_main(&ar9271_driver);
-}
Index: pace/drv/nic/ar9271/ar9271.h
===================================================================
--- uspace/drv/nic/ar9271/ar9271.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,908 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ar9271.h
- *
- * Header file for AR9271 USB WiFi dongle.
- *
- */
-
-#ifndef AR9271_H_
-#define AR9271_H_
-
-#include <fibril_synch.h>
-#include <usb/dev/driver.h>
-#include "htc.h"
-
-/** Number of transmission queues */
-#define AR9271_QUEUES_COUNT  10
-
-/** Number of GPIO pin used for handling led light */
-#define AR9271_LED_PIN  15
-
-/** Nominal value for AR9271 noise floor calibration. */
-#define AR9271_CALIB_NOMINAL_VALUE_2GHZ  -118
-
-/** RX errors values. */
-#define AR9271_RX_ERROR_CRC  0x01
-#define AR9271_RX_ERROR_PHY  0x02
-
-/** Key index used for device in station mode. */
-#define AR9271_STA_KEY_INDEX  4
-
-/* HW encryption key indicator. */
-enum ath9k_key_type {
-	AR9271_KEY_TYPE_CLEAR,
-	AR9271_KEY_TYPE_WEP,
-	AR9271_KEY_TYPE_AES,
-	AR9271_KEY_TYPE_TKIP,
-};
-
-/** AR9271 Registers */
-typedef enum {
-	/* ATH command register */
-	AR9271_COMMAND = 0x0008,
-	AR9271_COMMAND_RX_ENABLE = 0x00000004,
-
-	/* ATH config register */
-	AR9271_CONFIG = 0x0014,
-	AR9271_CONFIG_ADHOC = 0x00000020,
-
-	AR9271_QUEUE_BASE_MASK = 0x1000,
-
-	/* EEPROM Addresses */
-	AR9271_EEPROM_BASE = 0x2100,
-	AR9271_EEPROM_MAC_ADDR_START = 0x2118,
-
-	/* Reset MAC interface */
-	AR9271_RC = 0x4000,
-	AR9271_RC_AHB = 0x00000001,
-
-	/* GPIO registers */
-	AR9271_GPIO_IN_OUT = 0x4048,       /**< GPIO value read/set  */
-	AR9271_GPIO_OE_OUT = 0x404C,       /**< GPIO set to output  */
-	AR9271_GPIO_OE_OUT_ALWAYS = 0x3,   /**< GPIO always drive output */
-	AR9271_GPIO_OUT_MUX1 = 0x4060,
-	AR9271_GPIO_OUT_MUX2 = 0x4064,
-	AR9271_GPIO_OUT_MUX3 = 0x4068,
-	AR9271_GPIO_OUT_MUX_AS_OUT = 0x0,  /**< GPIO set mux as output */
-
-	/* RTC related registers */
-	AR9271_RTC_RC = 0x7000,
-	AR9271_RTC_RC_MAC_WARM = 0x00000001,
-	AR9271_RTC_RC_MAC_COLD = 0x00000002,
-	AR9271_RTC_RC_MASK = 0x00000003,
-	AR9271_RTC_PLL_CONTROL = 0x7014,
-	AR9271_RTC_RESET = 0x7040,
-	AR9271_RTC_STATUS = 0x7044,
-	AR9271_RTC_STATUS_MASK = 0x0000000F,
-	AR9271_RTC_STATUS_SHUTDOWN = 0x00000001,
-	AR9271_RTC_STATUS_ON = 0x00000002,
-	AR9271_RTC_SLEEP_CLOCK = 0x7048,
-	AR9271_RTC_SLEEP_CLOCK_FORCE_DERIVED = 0x2,
-	AR9271_RTC_FORCE_WAKE = 0x704C,
-	AR9271_RTC_FORCE_WAKE_ENABLE = 0x00000001,
-	AR9271_RTC_FORCE_WAKE_ON_INT = 0x00000002,
-
-	/* MAC Registers */
-	AR9271_STATION_ID0 = 0x8000,  /**< STA Address Lower 32 Bits */
-	AR9271_STATION_ID1 = 0x8004,  /**< STA Address Upper 16 Bits */
-	AR9271_BSSID0 = 0x8008,       /**< BSSID Lower 32 Bits */
-	AR9271_BSSID1 = 0x800C,       /**< BSSID Upper 16 Bits */
-	AR9271_BSSID_MASK0 = 0x80E0,  /**< BSSID Mask Lower 32 Bits */
-	AR9271_BSSID_MASK1 = 0x80E4,  /**< BSSID Mask Upper 16 Bits */
-	AR9271_STATION_ID1_MASK = 0x0000FFFF,
-	AR9271_STATION_ID1_POWER_SAVING = 0x00040000,
-	AR9271_MULTICAST_FILTER1 = 0x8040,
-	AR9271_MULTICAST_FILTER2 = 0x8044,
-	AR9271_DIAG = 0x8048,
-
-	/* RX filtering register */
-	AR9271_RX_FILTER = 0x803C,
-	AR9271_RX_FILTER_UNI = 0x00000001,
-	AR9271_RX_FILTER_MULTI = 0x00000002,
-	AR9271_RX_FILTER_BROAD = 0x00000004,
-	AR9271_RX_FILTER_CONTROL = 0x00000008,
-	AR9271_RX_FILTER_BEACON = 0x00000010,
-	AR9271_RX_FILTER_PROMISCUOUS = 0x00000020,
-	AR9271_RX_FILTER_PROBEREQ = 0x00000080,
-	AR9271_RX_FILTER_MYBEACON = 0x00000200,
-	AR9271_RX_FILTER_MCAST_BCAST_ALL = 0x00008000,
-
-	/* Key related registers */
-	AR9271_KEY_TABLE_BASE = 0x8800,
-	AR9271_KEY_TABLE_TYPE_WEP40 = 0x0,
-	AR9271_KEY_TABLE_TYPE_WEP104 = 0x1,
-	AR9271_KEY_TABLE_TYPE_TKIP = 0x4,
-	AR9271_KEY_TABLE_TYPE_CCMP = 0x6,
-	AR9271_KEY_TABLE_TYPE_CLR = 0x7,
-
-	/* Physical layer registers */
-	AR9271_PHY_ACTIVE = 0x981C,
-	AR9271_ADC_CONTROL = 0x982C,
-	AR9271_AGC_CONTROL = 0x9860,
-	AR9271_PHY_CAL = 0x9864,
-	AR9271_PHY_SYNTH_CONTROL = 0x9874,
-	AR9271_PHY_SPECTRAL_SCAN = 0x9910,
-	AR9271_PHY_RADAR0 = 0x9954,
-	AR9271_PHY_RADAR0_FFT_ENABLED = 0x80000000,
-	AR9271_PHY_RFBUS_KILL = 0x997C,
-	AR9271_PHY_RFBUS_GRANT = 0x9C20,
-	AR9271_PHY_MODE = 0xA200,
-	AR9271_PHY_CCK_TX_CTRL = 0xA204,
-	AR9271_PHY_TPCRG1 = 0xA258,
-	AR9271_CARRIER_LEAK_CONTROL = 0xA358,
-	AR9271_ADC_CONTROL_OFF_PWDADC = 0x00008000,
-	AR9271_AGC_CONTROL_CALIB = 0x00000001,
-	AR9271_AGC_CONTROL_NF_CALIB = 0x00000002,
-	AR9271_AGC_CONTROL_NF_CALIB_EN = 0x00008000,
-	AR9271_AGC_CONTROL_TX_CALIB = 0x00010000,
-	AR9271_AGC_CONTROL_NF_NOT_UPDATE = 0x00020000,
-	AR9271_PHY_MODE_DYNAMIC = 0x04,
-	AR9271_PHY_CCK_TX_CTRL_JAPAN = 0x00000010,
-	AR9271_PHY_TPCRG1_PD_CALIB = 0x00400000,
-	AR9271_CARRIER_LEAK_CALIB = 0x00000002,
-
-	AR9271_OPMODE_STATION_AP_MASK =	0x00010000,
-	AR9271_OPMODE_ADHOC_MASK = 0x00020000,
-
-	AR9271_CLOCK_CONTROL = 0x50040,
-	AR9271_MAX_CPU_CLOCK = 0x304,
-
-	AR9271_RESET_POWER_DOWN_CONTROL = 0x50044,
-	AR9271_RADIO_RF_RESET = 0x20,
-	AR9271_GATE_MAC_CONTROL = 0x4000,
-
-	/* FW Addresses */
-	AR9271_FW_ADDRESS = 0x501000,
-	AR9271_FW_OFFSET = 0x903000,
-} ar9271_registers_t;
-
-/** Compute key table base position for key by its id. */
-#define AR9271_KEY_TABLE(id)  (AR9271_KEY_TABLE_BASE + (id) * 32)
-
-/** AR9271 Requests */
-typedef enum {
-	AR9271_FW_DOWNLOAD = 0x30,
-	AR9271_FW_DOWNLOAD_COMP = 0x31,
-} ar9271_requests_t;
-
-/** AR9271 device data */
-typedef struct {
-	/** Lock for access. */
-	fibril_mutex_t ar9271_lock;
-
-	/** Whether device is starting up. */
-	bool starting_up;
-
-	/** Backing DDF device */
-	ddf_dev_t *ddf_dev;
-
-	/** USB device data */
-	usb_device_t *usb_device;
-
-	/** IEEE 802.11 device data */
-	ieee80211_dev_t *ieee80211_dev;
-
-	/** ATH device data */
-	ath_t *ath_device;
-
-	/** HTC device data */
-	htc_device_t *htc_device;
-} ar9271_t;
-
-/** AR9271 init values for 2GHz mode operation.
- *
- * Including settings of noise floor limits.
- *
- * Taken from the Linux driver (drivers/net/wireless/ath/ath9k/)
- * Copyright (c) 2008-2011 Atheros Communications Inc.
- * Licensed under the terms of ISC
- *
- */
-static const uint32_t ar9271_2g_mode_array[][2] = {
-	{ 0x00001030, 0x00000160 },
-	{ 0x00001070, 0x0000018c },
-	{ 0x000010b0, 0x00003e38 },
-	{ 0x000010f0, 0x00000000 },
-	{ 0x00008014, 0x08400b00 },
-	{ 0x0000801c, 0x12e0002b },
-	{ 0x00008318, 0x00003440 },
-	{ 0x00009804, 0x000003c0 },  /**< Note: overridden */
-	{ 0x00009820, 0x02020200 },
-	{ 0x00009824, 0x01000e0e },
-	{ 0x00009828, 0x0a020001 },  /**< Note: overridden */
-	{ 0x00009834, 0x00000e0e },
-	{ 0x00009838, 0x00000007 },
-	{ 0x00009840, 0x206a012e },
-	{ 0x00009844, 0x03721620 },
-	{ 0x00009848, 0x00001053 },
-	{ 0x0000a848, 0x00001053 },
-	{ 0x00009850, 0x6d4000e2 },
-	{ 0x00009858, 0x7ec84d2e },
-	{ 0x0000985c, 0x3137605e },
-	{ 0x00009860, 0x00058d18 },
-	{ 0x00009864, 0x0001ce00 },
-	{ 0x00009868, 0x5ac640d0 },
-	{ 0x0000986c, 0x06903881 },
-	{ 0x00009910, 0x30002310 },
-	{ 0x00009914, 0x00000898 },
-	{ 0x00009918, 0x0000000b },
-	{ 0x00009924, 0xd00a800d },
-	{ 0x00009944, 0xffbc1020 },
-	{ 0x00009960, 0x00000000 },
-	{ 0x00009964, 0x00000000 },
-	{ 0x000099b8, 0x0000421c },
-	{ 0x000099bc, 0x00000c00 },
-	{ 0x000099c0, 0x05eea6d4 },
-	{ 0x000099c4, 0x06336f77 },
-	{ 0x000099c8, 0x6af6532f },
-	{ 0x000099cc, 0x08f186c8 },
-	{ 0x000099d0, 0x00046384 },
-	{ 0x000099d4, 0x00000000 },
-	{ 0x000099d8, 0x00000000 },
-	{ 0x00009a00, 0x00058084 },
-	{ 0x00009a04, 0x00058088 },
-	{ 0x00009a08, 0x0005808c },
-	{ 0x00009a0c, 0x00058100 },
-	{ 0x00009a10, 0x00058104 },
-	{ 0x00009a14, 0x00058108 },
-	{ 0x00009a18, 0x0005810c },
-	{ 0x00009a1c, 0x00058110 },
-	{ 0x00009a20, 0x00058114 },
-	{ 0x00009a24, 0x00058180 },
-	{ 0x00009a28, 0x00058184 },
-	{ 0x00009a2c, 0x00058188 },
-	{ 0x00009a30, 0x0005818c },
-	{ 0x00009a34, 0x00058190 },
-	{ 0x00009a38, 0x00058194 },
-	{ 0x00009a3c, 0x000581a0 },
-	{ 0x00009a40, 0x0005820c },
-	{ 0x00009a44, 0x000581a8 },
-	{ 0x00009a48, 0x00058284 },
-	{ 0x00009a4c, 0x00058288 },
-	{ 0x00009a50, 0x00058224 },
-	{ 0x00009a54, 0x00058290 },
-	{ 0x00009a58, 0x00058300 },
-	{ 0x00009a5c, 0x00058304 },
-	{ 0x00009a60, 0x00058308 },
-	{ 0x00009a64, 0x0005830c },
-	{ 0x00009a68, 0x00058380 },
-	{ 0x00009a6c, 0x00058384 },
-	{ 0x00009a70, 0x00068700 },
-	{ 0x00009a74, 0x00068704 },
-	{ 0x00009a78, 0x00068708 },
-	{ 0x00009a7c, 0x0006870c },
-	{ 0x00009a80, 0x00068780 },
-	{ 0x00009a84, 0x00068784 },
-	{ 0x00009a88, 0x00078b00 },
-	{ 0x00009a8c, 0x00078b04 },
-	{ 0x00009a90, 0x00078b08 },
-	{ 0x00009a94, 0x00078b0c },
-	{ 0x00009a98, 0x00078b80 },
-	{ 0x00009a9c, 0x00078b84 },
-	{ 0x00009aa0, 0x00078b88 },
-	{ 0x00009aa4, 0x00078b8c },
-	{ 0x00009aa8, 0x00078b90 },
-	{ 0x00009aac, 0x000caf80 },
-	{ 0x00009ab0, 0x000caf84 },
-	{ 0x00009ab4, 0x000caf88 },
-	{ 0x00009ab8, 0x000caf8c },
-	{ 0x00009abc, 0x000caf90 },
-	{ 0x00009ac0, 0x000db30c },
-	{ 0x00009ac4, 0x000db310 },
-	{ 0x00009ac8, 0x000db384 },
-	{ 0x00009acc, 0x000db388 },
-	{ 0x00009ad0, 0x000db324 },
-	{ 0x00009ad4, 0x000eb704 },
-	{ 0x00009ad8, 0x000eb6a4 },
-	{ 0x00009adc, 0x000eb6a8 },
-	{ 0x00009ae0, 0x000eb710 },
-	{ 0x00009ae4, 0x000eb714 },
-	{ 0x00009ae8, 0x000eb720 },
-	{ 0x00009aec, 0x000eb724 },
-	{ 0x00009af0, 0x000eb728 },
-	{ 0x00009af4, 0x000eb72c },
-	{ 0x00009af8, 0x000eb7a0 },
-	{ 0x00009afc, 0x000eb7a4 },
-	{ 0x00009b00, 0x000eb7a8 },
-	{ 0x00009b04, 0x000eb7b0 },
-	{ 0x00009b08, 0x000eb7b4 },
-	{ 0x00009b0c, 0x000eb7b8 },
-	{ 0x00009b10, 0x000eb7a5 },
-	{ 0x00009b14, 0x000eb7a9 },
-	{ 0x00009b18, 0x000eb7ad },
-	{ 0x00009b1c, 0x000eb7b1 },
-	{ 0x00009b20, 0x000eb7b5 },
-	{ 0x00009b24, 0x000eb7b9 },
-	{ 0x00009b28, 0x000eb7c5 },
-	{ 0x00009b2c, 0x000eb7c9 },
-	{ 0x00009b30, 0x000eb7d1 },
-	{ 0x00009b34, 0x000eb7d5 },
-	{ 0x00009b38, 0x000eb7d9 },
-	{ 0x00009b3c, 0x000eb7c6 },
-	{ 0x00009b40, 0x000eb7ca },
-	{ 0x00009b44, 0x000eb7ce },
-	{ 0x00009b48, 0x000eb7d2 },
-	{ 0x00009b4c, 0x000eb7d6 },
-	{ 0x00009b50, 0x000eb7c3 },
-	{ 0x00009b54, 0x000eb7c7 },
-	{ 0x00009b58, 0x000eb7cb },
-	{ 0x00009b5c, 0x000eb7cf },
-	{ 0x00009b60, 0x000eb7d7 },
-	{ 0x00009b64, 0x000eb7db },
-	{ 0x00009b68, 0x000eb7db },
-	{ 0x00009b6c, 0x000eb7db },
-	{ 0x00009b70, 0x000eb7db },
-	{ 0x00009b74, 0x000eb7db },
-	{ 0x00009b78, 0x000eb7db },
-	{ 0x00009b7c, 0x000eb7db },
-	{ 0x00009b80, 0x000eb7db },
-	{ 0x00009b84, 0x000eb7db },
-	{ 0x00009b88, 0x000eb7db },
-	{ 0x00009b8c, 0x000eb7db },
-	{ 0x00009b90, 0x000eb7db },
-	{ 0x00009b94, 0x000eb7db },
-	{ 0x00009b98, 0x000eb7db },
-	{ 0x00009b9c, 0x000eb7db },
-	{ 0x00009ba0, 0x000eb7db },
-	{ 0x00009ba4, 0x000eb7db },
-	{ 0x00009ba8, 0x000eb7db },
-	{ 0x00009bac, 0x000eb7db },
-	{ 0x00009bb0, 0x000eb7db },
-	{ 0x00009bb4, 0x000eb7db },
-	{ 0x00009bb8, 0x000eb7db },
-	{ 0x00009bbc, 0x000eb7db },
-	{ 0x00009bc0, 0x000eb7db },
-	{ 0x00009bc4, 0x000eb7db },
-	{ 0x00009bc8, 0x000eb7db },
-	{ 0x00009bcc, 0x000eb7db },
-	{ 0x00009bd0, 0x000eb7db },
-	{ 0x00009bd4, 0x000eb7db },
-	{ 0x00009bd8, 0x000eb7db },
-	{ 0x00009bdc, 0x000eb7db },
-	{ 0x00009be0, 0x000eb7db },
-	{ 0x00009be4, 0x000eb7db },
-	{ 0x00009be8, 0x000eb7db },
-	{ 0x00009bec, 0x000eb7db },
-	{ 0x00009bf0, 0x000eb7db },
-	{ 0x00009bf4, 0x000eb7db },
-	{ 0x00009bf8, 0x000eb7db },
-	{ 0x00009bfc, 0x000eb7db },
-	{ 0x0000aa00, 0x00058084 },
-	{ 0x0000aa04, 0x00058088 },
-	{ 0x0000aa08, 0x0005808c },
-	{ 0x0000aa0c, 0x00058100 },
-	{ 0x0000aa10, 0x00058104 },
-	{ 0x0000aa14, 0x00058108 },
-	{ 0x0000aa18, 0x0005810c },
-	{ 0x0000aa1c, 0x00058110 },
-	{ 0x0000aa20, 0x00058114 },
-	{ 0x0000aa24, 0x00058180 },
-	{ 0x0000aa28, 0x00058184 },
-	{ 0x0000aa2c, 0x00058188 },
-	{ 0x0000aa30, 0x0005818c },
-	{ 0x0000aa34, 0x00058190 },
-	{ 0x0000aa38, 0x00058194 },
-	{ 0x0000aa3c, 0x000581a0 },
-	{ 0x0000aa40, 0x0005820c },
-	{ 0x0000aa44, 0x000581a8 },
-	{ 0x0000aa48, 0x00058284 },
-	{ 0x0000aa4c, 0x00058288 },
-	{ 0x0000aa50, 0x00058224 },
-	{ 0x0000aa54, 0x00058290 },
-	{ 0x0000aa58, 0x00058300 },
-	{ 0x0000aa5c, 0x00058304 },
-	{ 0x0000aa60, 0x00058308 },
-	{ 0x0000aa64, 0x0005830c },
-	{ 0x0000aa68, 0x00058380 },
-	{ 0x0000aa6c, 0x00058384 },
-	{ 0x0000aa70, 0x00068700 },
-	{ 0x0000aa74, 0x00068704 },
-	{ 0x0000aa78, 0x00068708 },
-	{ 0x0000aa7c, 0x0006870c },
-	{ 0x0000aa80, 0x00068780 },
-	{ 0x0000aa84, 0x00068784 },
-	{ 0x0000aa88, 0x00078b00 },
-	{ 0x0000aa8c, 0x00078b04 },
-	{ 0x0000aa90, 0x00078b08 },
-	{ 0x0000aa94, 0x00078b0c },
-	{ 0x0000aa98, 0x00078b80 },
-	{ 0x0000aa9c, 0x00078b84 },
-	{ 0x0000aaa0, 0x00078b88 },
-	{ 0x0000aaa4, 0x00078b8c },
-	{ 0x0000aaa8, 0x00078b90 },
-	{ 0x0000aaac, 0x000caf80 },
-	{ 0x0000aab0, 0x000caf84 },
-	{ 0x0000aab4, 0x000caf88 },
-	{ 0x0000aab8, 0x000caf8c },
-	{ 0x0000aabc, 0x000caf90 },
-	{ 0x0000aac0, 0x000db30c },
-	{ 0x0000aac4, 0x000db310 },
-	{ 0x0000aac8, 0x000db384 },
-	{ 0x0000aacc, 0x000db388 },
-	{ 0x0000aad0, 0x000db324 },
-	{ 0x0000aad4, 0x000eb704 },
-	{ 0x0000aad8, 0x000eb6a4 },
-	{ 0x0000aadc, 0x000eb6a8 },
-	{ 0x0000aae0, 0x000eb710 },
-	{ 0x0000aae4, 0x000eb714 },
-	{ 0x0000aae8, 0x000eb720 },
-	{ 0x0000aaec, 0x000eb724 },
-	{ 0x0000aaf0, 0x000eb728 },
-	{ 0x0000aaf4, 0x000eb72c },
-	{ 0x0000aaf8, 0x000eb7a0 },
-	{ 0x0000aafc, 0x000eb7a4 },
-	{ 0x0000ab00, 0x000eb7a8 },
-	{ 0x0000ab04, 0x000eb7b0 },
-	{ 0x0000ab08, 0x000eb7b4 },
-	{ 0x0000ab0c, 0x000eb7b8 },
-	{ 0x0000ab10, 0x000eb7a5 },
-	{ 0x0000ab14, 0x000eb7a9 },
-	{ 0x0000ab18, 0x000eb7ad },
-	{ 0x0000ab1c, 0x000eb7b1 },
-	{ 0x0000ab20, 0x000eb7b5 },
-	{ 0x0000ab24, 0x000eb7b9 },
-	{ 0x0000ab28, 0x000eb7c5 },
-	{ 0x0000ab2c, 0x000eb7c9 },
-	{ 0x0000ab30, 0x000eb7d1 },
-	{ 0x0000ab34, 0x000eb7d5 },
-	{ 0x0000ab38, 0x000eb7d9 },
-	{ 0x0000ab3c, 0x000eb7c6 },
-	{ 0x0000ab40, 0x000eb7ca },
-	{ 0x0000ab44, 0x000eb7ce },
-	{ 0x0000ab48, 0x000eb7d2 },
-	{ 0x0000ab4c, 0x000eb7d6 },
-	{ 0x0000ab50, 0x000eb7c3 },
-	{ 0x0000ab54, 0x000eb7c7 },
-	{ 0x0000ab58, 0x000eb7cb },
-	{ 0x0000ab5c, 0x000eb7cf },
-	{ 0x0000ab60, 0x000eb7d7 },
-	{ 0x0000ab64, 0x000eb7db },
-	{ 0x0000ab68, 0x000eb7db },
-	{ 0x0000ab6c, 0x000eb7db },
-	{ 0x0000ab70, 0x000eb7db },
-	{ 0x0000ab74, 0x000eb7db },
-	{ 0x0000ab78, 0x000eb7db },
-	{ 0x0000ab7c, 0x000eb7db },
-	{ 0x0000ab80, 0x000eb7db },
-	{ 0x0000ab84, 0x000eb7db },
-	{ 0x0000ab88, 0x000eb7db },
-	{ 0x0000ab8c, 0x000eb7db },
-	{ 0x0000ab90, 0x000eb7db },
-	{ 0x0000ab94, 0x000eb7db },
-	{ 0x0000ab98, 0x000eb7db },
-	{ 0x0000ab9c, 0x000eb7db },
-	{ 0x0000aba0, 0x000eb7db },
-	{ 0x0000aba4, 0x000eb7db },
-	{ 0x0000aba8, 0x000eb7db },
-	{ 0x0000abac, 0x000eb7db },
-	{ 0x0000abb0, 0x000eb7db },
-	{ 0x0000abb4, 0x000eb7db },
-	{ 0x0000abb8, 0x000eb7db },
-	{ 0x0000abbc, 0x000eb7db },
-	{ 0x0000abc0, 0x000eb7db },
-	{ 0x0000abc4, 0x000eb7db },
-	{ 0x0000abc8, 0x000eb7db },
-	{ 0x0000abcc, 0x000eb7db },
-	{ 0x0000abd0, 0x000eb7db },
-	{ 0x0000abd4, 0x000eb7db },
-	{ 0x0000abd8, 0x000eb7db },
-	{ 0x0000abdc, 0x000eb7db },
-	{ 0x0000abe0, 0x000eb7db },
-	{ 0x0000abe4, 0x000eb7db },
-	{ 0x0000abe8, 0x000eb7db },
-	{ 0x0000abec, 0x000eb7db },
-	{ 0x0000abf0, 0x000eb7db },
-	{ 0x0000abf4, 0x000eb7db },
-	{ 0x0000abf8, 0x000eb7db },
-	{ 0x0000abfc, 0x000eb7db },
-	{ 0x0000a204, 0x00000004 },
-	{ 0x0000a20c, 0x0001f000 },
-	{ 0x0000b20c, 0x0001f000 },
-	{ 0x0000a21c, 0x1883800a },
-	{ 0x0000a230, 0x00000108 },
-	{ 0x0000a250, 0x0004a000 },
-	{ 0x0000a358, 0x7999aa0e }
-};
-
-/** AR9271 TX init values for 2GHz mode operation.
- *
- * Taken from the Linux driver (drivers/net/wireless/ath/ath9k/)
- * Copyright (c) 2008-2011 Atheros Communications Inc.
- * Licensed under the terms of ISC
- *
- */
-static const uint32_t ar9271_2g_tx_array[][2] = {
-	{ 0x0000a300, 0x00010000 },
-	{ 0x0000a304, 0x00016200 },
-	{ 0x0000a308, 0x00018201 },
-	{ 0x0000a30c, 0x0001b240 },
-	{ 0x0000a310, 0x0001d241 },
-	{ 0x0000a314, 0x0001f600 },
-	{ 0x0000a318, 0x00022800 },
-	{ 0x0000a31c, 0x00026802 },
-	{ 0x0000a320, 0x0002b805 },
-	{ 0x0000a324, 0x0002ea41 },
-	{ 0x0000a328, 0x00038b00 },
-	{ 0x0000a32c, 0x0003ab40 },
-	{ 0x0000a330, 0x0003cd80 },
-	{ 0x0000a334, 0x000368de },
-	{ 0x0000a338, 0x0003891e },
-	{ 0x0000a33c, 0x0003a95e },
-	{ 0x0000a340, 0x0003e9df },
-	{ 0x0000a344, 0x0003e9df },
-	{ 0x0000a348, 0x0003e9df },
-	{ 0x0000a34c, 0x0003e9df },
-	{ 0x0000a350, 0x0003e9df },
-	{ 0x0000a354, 0x0003e9df },
-	{ 0x00007838, 0x0000002b },
-	{ 0x00007824, 0x00d8a7ff },
-	{ 0x0000786c, 0x08609eba },
-	{ 0x00007820, 0x00000c00 },
-	{ 0x0000a274, 0x0a214652 },
-	{ 0x0000a278, 0x0e739ce7 },
-	{ 0x0000a27c, 0x05018063 },
-	{ 0x0000a394, 0x06318c63 },
-	{ 0x0000a398, 0x00000063 },
-	{ 0x0000a3dc, 0x06318c63 },
-	{ 0x0000a3e0, 0x00000063 }
-};
-
-/** AR9271 hardware init values.
- *
- * Taken from the Linux driver (drivers/net/wireless/ath/ath9k/)
- * Copyright (c) 2008-2011 Atheros Communications Inc.
- * Licensed under the terms of ISC
- *
- */
-static const uint32_t ar9271_init_array[][2] = {
-	{ 0x0000000c, 0x00000000 },
-	{ 0x00000030, 0x00020045 },
-	{ 0x00000034, 0x00000005 },
-	{ 0x00000040, 0x00000000 },
-	{ 0x00000044, 0x00000008 },
-	{ 0x00000048, 0x00000008 },
-	{ 0x0000004c, 0x00000010 },
-	{ 0x00000050, 0x00000000 },
-	{ 0x00000054, 0x0000001f },
-	{ 0x00000800, 0x00000000 },
-	{ 0x00000804, 0x00000000 },
-	{ 0x00000808, 0x00000000 },
-	{ 0x0000080c, 0x00000000 },
-	{ 0x00000810, 0x00000000 },
-	{ 0x00000814, 0x00000000 },
-	{ 0x00000818, 0x00000000 },
-	{ 0x0000081c, 0x00000000 },
-	{ 0x00000820, 0x00000000 },
-	{ 0x00000824, 0x00000000 },
-	{ 0x00001040, 0x002ffc0f },
-	{ 0x00001044, 0x002ffc0f },
-	{ 0x00001048, 0x002ffc0f },
-	{ 0x0000104c, 0x002ffc0f },
-	{ 0x00001050, 0x002ffc0f },
-	{ 0x00001054, 0x002ffc0f },
-	{ 0x00001058, 0x002ffc0f },
-	{ 0x0000105c, 0x002ffc0f },
-	{ 0x00001060, 0x002ffc0f },
-	{ 0x00001064, 0x002ffc0f },
-	{ 0x00001230, 0x00000000 },
-	{ 0x00001270, 0x00000000 },
-	{ 0x00001038, 0x00000000 },
-	{ 0x00001078, 0x00000000 },
-	{ 0x000010b8, 0x00000000 },
-	{ 0x000010f8, 0x00000000 },
-	{ 0x00001138, 0x00000000 },
-	{ 0x00001178, 0x00000000 },
-	{ 0x000011b8, 0x00000000 },
-	{ 0x000011f8, 0x00000000 },
-	{ 0x00001238, 0x00000000 },
-	{ 0x00001278, 0x00000000 },
-	{ 0x000012b8, 0x00000000 },
-	{ 0x000012f8, 0x00000000 },
-	{ 0x00001338, 0x00000000 },
-	{ 0x00001378, 0x00000000 },
-	{ 0x000013b8, 0x00000000 },
-	{ 0x000013f8, 0x00000000 },
-	{ 0x00001438, 0x00000000 },
-	{ 0x00001478, 0x00000000 },
-	{ 0x000014b8, 0x00000000 },
-	{ 0x000014f8, 0x00000000 },
-	{ 0x00001538, 0x00000000 },
-	{ 0x00001578, 0x00000000 },
-	{ 0x000015b8, 0x00000000 },
-	{ 0x000015f8, 0x00000000 },
-	{ 0x00001638, 0x00000000 },
-	{ 0x00001678, 0x00000000 },
-	{ 0x000016b8, 0x00000000 },
-	{ 0x000016f8, 0x00000000 },
-	{ 0x00001738, 0x00000000 },
-	{ 0x00001778, 0x00000000 },
-	{ 0x000017b8, 0x00000000 },
-	{ 0x000017f8, 0x00000000 },
-	{ 0x0000103c, 0x00000000 },
-	{ 0x0000107c, 0x00000000 },
-	{ 0x000010bc, 0x00000000 },
-	{ 0x000010fc, 0x00000000 },
-	{ 0x0000113c, 0x00000000 },
-	{ 0x0000117c, 0x00000000 },
-	{ 0x000011bc, 0x00000000 },
-	{ 0x000011fc, 0x00000000 },
-	{ 0x0000123c, 0x00000000 },
-	{ 0x0000127c, 0x00000000 },
-	{ 0x000012bc, 0x00000000 },
-	{ 0x000012fc, 0x00000000 },
-	{ 0x0000133c, 0x00000000 },
-	{ 0x0000137c, 0x00000000 },
-	{ 0x000013bc, 0x00000000 },
-	{ 0x000013fc, 0x00000000 },
-	{ 0x0000143c, 0x00000000 },
-	{ 0x0000147c, 0x00000000 },
-	{ 0x00004030, 0x00000002 },
-	{ 0x0000403c, 0x00000002 },
-	{ 0x00004024, 0x0000001f },
-	{ 0x00004060, 0x00000000 },
-	{ 0x00004064, 0x00000000 },
-	{ 0x00008018, 0x00000700 },
-	{ 0x00008020, 0x00000000 },
-	{ 0x00008038, 0x00000000 },
-	{ 0x00008048, 0x00000000 },
-	{ 0x00008054, 0x00000000 },
-	{ 0x00008058, 0x00000000 },
-	{ 0x0000805c, 0x000fc78f },
-	{ 0x00008060, 0xc7ff000f },
-	{ 0x00008064, 0x00000000 },
-	{ 0x00008070, 0x00000000 },
-	{ 0x000080b0, 0x00000000 },
-	{ 0x000080b4, 0x00000000 },
-	{ 0x000080b8, 0x00000000 },
-	{ 0x000080bc, 0x00000000 },
-	{ 0x000080c0, 0x2a80001a },
-	{ 0x000080c4, 0x05dc01e0 },
-	{ 0x000080c8, 0x1f402710 },
-	{ 0x000080cc, 0x01f40000 },
-	{ 0x000080d0, 0x00001e00 },
-	{ 0x000080d4, 0x00000000 },
-	{ 0x000080d8, 0x00400000 },
-	{ 0x000080e0, 0xffffffff },
-	{ 0x000080e4, 0x0000ffff },
-	{ 0x000080e8, 0x003f3f3f },
-	{ 0x000080ec, 0x00000000 },
-	{ 0x000080f0, 0x00000000 },
-	{ 0x000080f4, 0x00000000 },
-	{ 0x000080f8, 0x00000000 },
-	{ 0x000080fc, 0x00020000 },
-	{ 0x00008100, 0x00020000 },
-	{ 0x00008104, 0x00000001 },
-	{ 0x00008108, 0x00000052 },
-	{ 0x0000810c, 0x00000000 },
-	{ 0x00008110, 0x00000168 },
-	{ 0x00008118, 0x000100aa },
-	{ 0x0000811c, 0x00003210 },
-	{ 0x00008120, 0x08f04810 },
-	{ 0x00008124, 0x00000000 },
-	{ 0x00008128, 0x00000000 },
-	{ 0x0000812c, 0x00000000 },
-	{ 0x00008130, 0x00000000 },
-	{ 0x00008134, 0x00000000 },
-	{ 0x00008138, 0x00000000 },
-	{ 0x0000813c, 0x00000000 },
-	{ 0x00008144, 0xffffffff },
-	{ 0x00008168, 0x00000000 },
-	{ 0x0000816c, 0x00000000 },
-	{ 0x00008170, 0x32143320 },
-	{ 0x00008174, 0xfaa4fa50 },
-	{ 0x00008178, 0x00000100 },
-	{ 0x0000817c, 0x00000000 },
-	{ 0x000081c0, 0x00000000 },
-	{ 0x000081d0, 0x0000320a },
-	{ 0x000081ec, 0x00000000 },
-	{ 0x000081f0, 0x00000000 },
-	{ 0x000081f4, 0x00000000 },
-	{ 0x000081f8, 0x00000000 },
-	{ 0x000081fc, 0x00000000 },
-	{ 0x00008200, 0x00000000 },
-	{ 0x00008204, 0x00000000 },
-	{ 0x00008208, 0x00000000 },
-	{ 0x0000820c, 0x00000000 },
-	{ 0x00008210, 0x00000000 },
-	{ 0x00008214, 0x00000000 },
-	{ 0x00008218, 0x00000000 },
-	{ 0x0000821c, 0x00000000 },
-	{ 0x00008220, 0x00000000 },
-	{ 0x00008224, 0x00000000 },
-	{ 0x00008228, 0x00000000 },
-	{ 0x0000822c, 0x00000000 },
-	{ 0x00008230, 0x00000000 },
-	{ 0x00008234, 0x00000000 },
-	{ 0x00008238, 0x00000000 },
-	{ 0x0000823c, 0x00000000 },
-	{ 0x00008240, 0x00100000 },
-	{ 0x00008244, 0x0010f400 },
-	{ 0x00008248, 0x00000100 },
-	{ 0x0000824c, 0x0001e800 },
-	{ 0x00008250, 0x00000000 },
-	{ 0x00008254, 0x00000000 },
-	{ 0x00008258, 0x00000000 },
-	{ 0x0000825c, 0x400000ff },
-	{ 0x00008260, 0x00080922 },
-	{ 0x00008264, 0x88a00010 },
-	{ 0x00008270, 0x00000000 },
-	{ 0x00008274, 0x40000000 },
-	{ 0x00008278, 0x003e4180 },
-	{ 0x0000827c, 0x00000000 },
-	{ 0x00008284, 0x0000002c },
-	{ 0x00008288, 0x0000002c },
-	{ 0x0000828c, 0x00000000 },
-	{ 0x00008294, 0x00000000 },
-	{ 0x00008298, 0x00000000 },
-	{ 0x0000829c, 0x00000000 },
-	{ 0x00008300, 0x00000040 },
-	{ 0x00008314, 0x00000000 },
-	{ 0x00008328, 0x00000000 },
-	{ 0x0000832c, 0x00000001 },
-	{ 0x00008330, 0x00000302 },
-	{ 0x00008334, 0x00000e00 },
-	{ 0x00008338, 0x00ff0000 },
-	{ 0x0000833c, 0x00000000 },
-	{ 0x00008340, 0x00010380 },
-	{ 0x00008344, 0x00481083 },  /**< Note: disabled ADHOC_MCAST_KEYID feature */
-	{ 0x00007010, 0x00000030 },
-	{ 0x00007034, 0x00000002 },
-	{ 0x00007038, 0x000004c2 },
-	{ 0x00007800, 0x00140000 },
-	{ 0x00007804, 0x0e4548d8 },
-	{ 0x00007808, 0x54214514 },
-	{ 0x0000780c, 0x02025820 },
-	{ 0x00007810, 0x71c0d388 },
-	{ 0x00007814, 0x924934a8 },
-	{ 0x0000781c, 0x00000000 },
-	{ 0x00007828, 0x66964300 },
-	{ 0x0000782c, 0x8db6d961 },
-	{ 0x00007830, 0x8db6d96c },
-	{ 0x00007834, 0x6140008b },
-	{ 0x0000783c, 0x72ee0a72 },
-	{ 0x00007840, 0xbbfffffc },
-	{ 0x00007844, 0x000c0db6 },
-	{ 0x00007848, 0x6db6246f },
-	{ 0x0000784c, 0x6d9b66db },
-	{ 0x00007850, 0x6d8c6dba },
-	{ 0x00007854, 0x00040000 },
-	{ 0x00007858, 0xdb003012 },
-	{ 0x0000785c, 0x04924914 },
-	{ 0x00007860, 0x21084210 },
-	{ 0x00007864, 0xf7d7ffde },
-	{ 0x00007868, 0xc2034080 },
-	{ 0x00007870, 0x10142c00 },
-	{ 0x00009808, 0x00000000 },
-	{ 0x0000980c, 0xafe68e30 },
-	{ 0x00009810, 0xfd14e000 },
-	{ 0x00009814, 0x9c0a9f6b },
-	{ 0x0000981c, 0x00000000 },
-	{ 0x0000982c, 0x0000a000 },
-	{ 0x00009830, 0x00000000 },
-	{ 0x0000983c, 0x00200400 },
-	{ 0x0000984c, 0x0040233c },
-	{ 0x00009854, 0x00000044 },
-	{ 0x00009900, 0x00000000 },
-	{ 0x00009904, 0x00000000 },
-	{ 0x00009908, 0x00000000 },
-	{ 0x0000990c, 0x00000000 },
-	{ 0x0000991c, 0x10000fff },
-	{ 0x00009920, 0x04900000 },
-	{ 0x00009928, 0x00000001 },
-	{ 0x0000992c, 0x00000004 },
-	{ 0x00009934, 0x1e1f2022 },
-	{ 0x00009938, 0x0a0b0c0d },
-	{ 0x0000993c, 0x00000000 },
-	{ 0x00009940, 0x14750604 },
-	{ 0x00009948, 0x9280c00a },
-	{ 0x0000994c, 0x00020028 },
-	{ 0x00009954, 0x5f3ca3de },
-	{ 0x00009958, 0x0108ecff },
-	{ 0x00009968, 0x000003ce },
-	{ 0x00009970, 0x192bb514 },
-	{ 0x00009974, 0x00000000 },
-	{ 0x00009978, 0x00000001 },
-	{ 0x0000997c, 0x00000000 },
-	{ 0x00009980, 0x00000000 },
-	{ 0x00009984, 0x00000000 },
-	{ 0x00009988, 0x00000000 },
-	{ 0x0000998c, 0x00000000 },
-	{ 0x00009990, 0x00000000 },
-	{ 0x00009994, 0x00000000 },
-	{ 0x00009998, 0x00000000 },
-	{ 0x0000999c, 0x00000000 },
-	{ 0x000099a0, 0x00000000 },
-	{ 0x000099a4, 0x00000001 },
-	{ 0x000099a8, 0x201fff00 },
-	{ 0x000099ac, 0x2def0400 },
-	{ 0x000099b0, 0x03051000 },
-	{ 0x000099b4, 0x00000820 },
-	{ 0x000099dc, 0x00000000 },
-	{ 0x000099e0, 0x00000000 },
-	{ 0x000099e4, 0xaaaaaaaa },
-	{ 0x000099e8, 0x3c466478 },
-	{ 0x000099ec, 0x0cc80caa },
-	{ 0x000099f0, 0x00000000 },
-	{ 0x0000a208, 0x803e68c8 },
-	{ 0x0000a210, 0x4080a333 },
-	{ 0x0000a214, 0x00206c10 },
-	{ 0x0000a218, 0x009c4060 },
-	{ 0x0000a220, 0x01834061 },
-	{ 0x0000a224, 0x00000400 },
-	{ 0x0000a228, 0x000003b5 },
-	{ 0x0000a22c, 0x00000000 },
-	{ 0x0000a234, 0x20202020 },
-	{ 0x0000a238, 0x20202020 },
-	{ 0x0000a244, 0x00000000 },
-	{ 0x0000a248, 0xfffffffc },
-	{ 0x0000a24c, 0x00000000 },
-	{ 0x0000a254, 0x00000000 },
-	{ 0x0000a258, 0x0ccb5380 },
-	{ 0x0000a25c, 0x15151501 },
-	{ 0x0000a260, 0xdfa90f01 },
-	{ 0x0000a268, 0x00000000 },
-	{ 0x0000a26c, 0x0ebae9e6 },
-	{ 0x0000a388, 0x0c000000 },
-	{ 0x0000a38c, 0x20202020 },
-	{ 0x0000a390, 0x20202020 },
-	{ 0x0000a39c, 0x00000001 },
-	{ 0x0000a3a0, 0x00000000 },
-	{ 0x0000a3a4, 0x00000000 },
-	{ 0x0000a3a8, 0x00000000 },
-	{ 0x0000a3ac, 0x00000000 },
-	{ 0x0000a3b0, 0x00000000 },
-	{ 0x0000a3b4, 0x00000000 },
-	{ 0x0000a3b8, 0x00000000 },
-	{ 0x0000a3bc, 0x00000000 },
-	{ 0x0000a3c0, 0x00000000 },
-	{ 0x0000a3c4, 0x00000000 },
-	{ 0x0000a3cc, 0x20202020 },
-	{ 0x0000a3d0, 0x20202020 },
-	{ 0x0000a3d4, 0x20202020 },
-	{ 0x0000a3e4, 0x00000000 },
-	{ 0x0000a3e8, 0x18c43433 },
-	{ 0x0000a3ec, 0x00f70081 },
-	{ 0x0000a3f0, 0x01036a2f },
-	{ 0x0000a3f4, 0x00000000 },
-	{ 0x0000d270, 0x0d820820 },
-	{ 0x0000d35c, 0x07ffffef },
-	{ 0x0000d360, 0x0fffffe7 },
-	{ 0x0000d364, 0x17ffffe5 },
-	{ 0x0000d368, 0x1fffffe4 },
-	{ 0x0000d36c, 0x37ffffe3 },
-	{ 0x0000d370, 0x3fffffe3 },
-	{ 0x0000d374, 0x57ffffe3 },
-	{ 0x0000d378, 0x5fffffe2 },
-	{ 0x0000d37c, 0x7fffffe2 },
-	{ 0x0000d380, 0x7f3c7bba },
-	{ 0x0000d384, 0xf3307ff0 }
-};
-
-#endif
Index: pace/drv/nic/ar9271/ar9271.ma
===================================================================
--- uspace/drv/nic/ar9271/ar9271.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-90 usb&vendor=0x0cf3&product=0x9271
Index: pace/drv/nic/ar9271/ath.h
===================================================================
--- uspace/drv/nic/ar9271/ath.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ath.h
- *
- * Atheros generic wifi device functions definitions.
- *
- */
-
-#ifndef ATHEROS_ATH_H
-#define ATHEROS_ATH_H
-
-struct ath;
-
-/** Atheros wifi operations. */
-typedef struct {
-	errno_t (*send_ctrl_message)(struct ath *, void *, size_t);
-	errno_t (*read_ctrl_message)(struct ath *, void *, size_t, size_t *);
-	errno_t (*send_data_message)(struct ath *, void *, size_t);
-	errno_t (*read_data_message)(struct ath *, void *, size_t, size_t *);
-} ath_ops_t;
-
-/** Atheros wifi device structure */
-typedef struct ath {
-	/** Maximum length of data response message. */
-	size_t data_response_length;
-
-	/** Maximum length of control response message. */
-	size_t ctrl_response_length;
-
-	/** Implementation specific data. */
-	void *specific_data;
-
-	/** Generic Atheros wifi operations. */
-	const ath_ops_t *ops;
-} ath_t;
-
-#endif  /* ATHEROS_ATH_H */
Index: pace/drv/nic/ar9271/ath_usb.c
===================================================================
--- uspace/drv/nic/ar9271/ath_usb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ath_usb.c
- *
- * Implementation of Atheros USB wifi device functions.
- *
- */
-
-#include <usb/dev/pipes.h>
-#include <usb/debug.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "ath_usb.h"
-
-static errno_t ath_usb_send_ctrl_message(ath_t *, void *, size_t);
-static errno_t ath_usb_read_ctrl_message(ath_t *, void *, size_t, size_t *);
-static errno_t ath_usb_send_data_message(ath_t *, void *, size_t);
-static errno_t ath_usb_read_data_message(ath_t *, void *, size_t, size_t *);
-
-static ath_ops_t ath_usb_ops = {
-	.send_ctrl_message = ath_usb_send_ctrl_message,
-	.read_ctrl_message = ath_usb_read_ctrl_message,
-	.send_data_message = ath_usb_send_data_message,
-	.read_data_message = ath_usb_read_data_message
-};
-
-/** Initialize Atheros WiFi USB device.
- *
- * @param ath Generic Atheros WiFi device structure.
- * @param usb_device  Connected USB device.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ath_usb_init(ath_t *ath, usb_device_t *usb_device, const usb_endpoint_description_t **endpoints)
-{
-	ath_usb_t *ath_usb = malloc(sizeof(ath_usb_t));
-	if (!ath_usb) {
-		usb_log_error("Failed to allocate memory for ath usb device "
-		    "structure.\n");
-		return ENOMEM;
-	}
-
-	ath_usb->usb_device = usb_device;
-
-	int rc;
-
-#define _MAP_EP(target, ep_no) do {\
-	usb_endpoint_mapping_t *epm = usb_device_get_mapped_ep_desc(usb_device, endpoints[ep_no]);\
-	if (!epm || !epm->present) {\
-		usb_log_error("Failed to map endpoint: " #ep_no ".");\
-		rc = ENOENT;\
-		goto err_ath_usb;\
-	}\
-	target = &epm->pipe;\
-	} while (0);
-
-	_MAP_EP(ath_usb->output_data_pipe, 0);
-	_MAP_EP(ath_usb->input_data_pipe, 1);
-	_MAP_EP(ath_usb->input_ctrl_pipe, 2);
-	_MAP_EP(ath_usb->output_ctrl_pipe, 3);
-
-#undef _MAP_EP
-
-	ath->ctrl_response_length = 64;
-	ath->data_response_length = 512;
-
-	ath->specific_data = ath_usb;
-	ath->ops = &ath_usb_ops;
-
-	return EOK;
-err_ath_usb:
-	free(ath_usb);
-	return rc;
-}
-
-/** Send control message.
- *
- * @param ath         Generic Atheros WiFi device structure.
- * @param buffer      Buffer with data to send.
- * @param buffer_size Buffer size.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ath_usb_send_ctrl_message(ath_t *ath, void *buffer,
-    size_t buffer_size)
-{
-	ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data;
-	return usb_pipe_write(ath_usb->output_ctrl_pipe, buffer, buffer_size);
-}
-
-/** Read control message.
- *
- * @param ath              Generic Atheros WiFi device structure.
- * @param buffer           Buffer with data to send.
- * @param buffer_size      Buffer size.
- * @param transferred_size Real size of read data.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ath_usb_read_ctrl_message(ath_t *ath, void *buffer,
-    size_t buffer_size, size_t *transferred_size)
-{
-	ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data;
-	return usb_pipe_read(ath_usb->input_ctrl_pipe, buffer, buffer_size, transferred_size);
-}
-
-/** Send data message.
- *
- * @param ath         Generic Atheros WiFi device structure.
- * @param buffer      Buffer with data to send.
- * @param buffer_size Buffer size.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ath_usb_send_data_message(ath_t *ath, void *buffer,
-    size_t buffer_size)
-{
-	size_t complete_buffer_size = buffer_size +
-	    sizeof(ath_usb_data_header_t);
-	void *complete_buffer = malloc(complete_buffer_size);
-	memcpy(complete_buffer + sizeof(ath_usb_data_header_t),
-	    buffer, buffer_size);
-
-	ath_usb_data_header_t *data_header =
-	    (ath_usb_data_header_t *) complete_buffer;
-	data_header->length = host2uint16_t_le(buffer_size);
-	data_header->tag = host2uint16_t_le(TX_TAG);
-
-	ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data;
-	const errno_t ret_val = usb_pipe_write(ath_usb->output_data_pipe,
-	    complete_buffer, complete_buffer_size);
-
-	free(complete_buffer);
-
-	return ret_val;
-}
-
-/** Read data message.
- *
- * @param ath              Generic Atheros WiFi device structure.
- * @param buffer           Buffer with data to send.
- * @param buffer_size      Buffer size.
- * @param transferred_size Real size of read data.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ath_usb_read_data_message(ath_t *ath, void *buffer,
-    size_t buffer_size, size_t *transferred_size)
-{
-	ath_usb_t *ath_usb = (ath_usb_t *) ath->specific_data;
-	return usb_pipe_read(ath_usb->input_data_pipe, buffer, buffer_size, transferred_size);
-}
Index: pace/drv/nic/ar9271/ath_usb.h
===================================================================
--- uspace/drv/nic/ar9271/ath_usb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file ath_usb.h
- *
- * Definitions of Atheros USB wifi device functions.
- *
- */
-
-#ifndef ATHEROS_ATH_USB_H
-#define ATHEROS_ATH_USB_H
-
-#include <usb/dev/driver.h>
-#include "ath.h"
-
-#define RX_TAG  0x4e00
-#define TX_TAG  0x697e
-
-/** Atheros USB wifi device structure */
-typedef struct {
-	/** USB pipes indexes */
-	usb_pipe_t *input_ctrl_pipe;
-	usb_pipe_t *output_ctrl_pipe;
-	usb_pipe_t *input_data_pipe;
-	usb_pipe_t *output_data_pipe;
-
-	/** Pointer to connected USB device. */
-	usb_device_t *usb_device;
-} ath_usb_t;
-
-typedef struct {
-	uint16_t length;  /**< Little Endian value! */
-	uint16_t tag;     /**< Little Endian value! */
-} ath_usb_data_header_t;
-
-extern errno_t ath_usb_init(ath_t *, usb_device_t *, const usb_endpoint_description_t **endpoints);
-
-#endif  /* ATHEROS_ATH_USB_H */
Index: pace/drv/nic/ar9271/htc.c
===================================================================
--- uspace/drv/nic/ar9271/htc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,552 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file htc.c
- *
- * Implementation of Atheros HTC communication.
- *
- */
-
-#include <usb/debug.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <str_error.h>
-#include "wmi.h"
-#include "htc.h"
-#include "nic/nic.h"
-#include "ar9271.h"
-
-/** HTC download pipes mapping.
- *
- * @param service_id Identification of WMI service.
- *
- * @return Number of pipe used for this service.
- *
- */
-static inline uint8_t wmi_service_to_download_pipe(wmi_services_t service_id)
-{
-	return (service_id == WMI_CONTROL_SERVICE) ? 3 : 2;
-}
-
-/** HTC upload pipes mapping.
- *
- * @param service_id Identification of WMI service.
- *
- * @return Number of pipe used for this service.
- *
- */
-static inline uint8_t wmi_service_to_upload_pipe(wmi_services_t service_id)
-{
-	return (service_id == WMI_CONTROL_SERVICE) ? 4 : 1;
-}
-
-errno_t htc_init_new_vif(htc_device_t *htc_device)
-{
-	htc_vif_msg_t vif_msg;
-	htc_sta_msg_t sta_msg;
-
-	memset(&vif_msg, 0, sizeof(htc_vif_msg_t));
-	memset(&sta_msg, 0, sizeof(htc_sta_msg_t));
-
-	nic_address_t addr;
-	nic_t *nic =
-	    nic_get_from_ddf_dev(ieee80211_get_ddf_dev(htc_device->ieee80211_dev));
-	nic_query_address(nic, &addr);
-
-	memcpy(&vif_msg.addr, &addr.address, ETH_ADDR);
-	memcpy(&sta_msg.addr, &addr.address, ETH_ADDR);
-
-	ieee80211_operating_mode_t op_mode =
-	    ieee80211_query_current_op_mode(htc_device->ieee80211_dev);
-
-	switch (op_mode) {
-	case IEEE80211_OPMODE_ADHOC:
-		vif_msg.op_mode = HTC_OPMODE_ADHOC;
-		break;
-	case IEEE80211_OPMODE_AP:
-		vif_msg.op_mode = HTC_OPMODE_AP;
-		break;
-	case IEEE80211_OPMODE_MESH:
-		vif_msg.op_mode = HTC_OPMODE_MESH;
-		break;
-	case IEEE80211_OPMODE_STATION:
-		vif_msg.op_mode = HTC_OPMODE_STATION;
-		break;
-	}
-
-	vif_msg.index = 0;
-	vif_msg.rts_thres = host2uint16_t_be(HTC_RTS_THRESHOLD);
-
-	wmi_send_command(htc_device, WMI_VAP_CREATE, (uint8_t *) &vif_msg,
-	    sizeof(vif_msg), NULL);
-
-	sta_msg.is_vif_sta = 1;
-	sta_msg.max_ampdu = host2uint16_t_be(0xFFFF);
-	sta_msg.sta_index = 0;
-	sta_msg.vif_index = 0;
-
-	wmi_send_command(htc_device, WMI_NODE_CREATE, (uint8_t *) &sta_msg,
-	    sizeof(sta_msg), NULL);
-
-	/* Write first 4 bytes of MAC address. */
-	uint32_t id0;
-	memcpy(&id0, &addr.address, 4);
-	id0 = host2uint32_t_le(id0);
-	wmi_reg_write(htc_device, AR9271_STATION_ID0, id0);
-
-	/* Write last 2 bytes of MAC address (and preserve existing data). */
-	uint32_t id1;
-	wmi_reg_read(htc_device, AR9271_STATION_ID1, &id1);
-
-	uint16_t id1_addr;
-	memcpy(&id1_addr, &addr.address[4], 2);
-	id1 = (id1 & ~AR9271_STATION_ID1_MASK) | host2uint16_t_le(id1_addr);
-	wmi_reg_write(htc_device, AR9271_STATION_ID1, id1);
-
-	return EOK;
-}
-
-static void htc_config_frame_header(htc_frame_header_t *header,
-    size_t buffer_size, uint8_t endpoint_id)
-{
-	memset(header, 0, sizeof(htc_frame_header_t));
-
-	header->endpoint_id = endpoint_id;
-	header->payload_length =
-	    host2uint16_t_be(buffer_size - sizeof(htc_frame_header_t));
-}
-
-/** Send control HTC message to USB device.
- *
- * @param htc_device  HTC device structure.
- * @param buffer      Buffer with data to be sent to USB device
- *                    (without HTC frame header).
- * @param buffer_size Size of buffer (including HTC frame header).
- * @param endpoint_id Destination endpoint.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_send_control_message(htc_device_t *htc_device, void *buffer,
-    size_t buffer_size, uint8_t endpoint_id)
-{
-	htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
-	    endpoint_id);
-
-	ath_t *ath_device = htc_device->ath_device;
-
-	return ath_device->ops->send_ctrl_message(ath_device, buffer,
-	    buffer_size);
-}
-
-/** Send data HTC message to USB device.
- *
- * @param htc_device  HTC device structure.
- * @param buffer      Buffer with data to be sent to USB device
- *                    (without HTC frame header).
- * @param buffer_size Size of buffer (including HTC frame header).
- * @param endpoint_id Destination endpoint.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_send_data_message(htc_device_t *htc_device, void *buffer,
-    size_t buffer_size, uint8_t endpoint_id)
-{
-	htc_config_frame_header((htc_frame_header_t *) buffer, buffer_size,
-	    endpoint_id);
-
-	ath_t *ath_device = htc_device->ath_device;
-
-	return ath_device->ops->send_data_message(ath_device, buffer,
-	    buffer_size);
-}
-
-/** Read HTC data message from USB device.
- *
- * @param htc_device       HTC device structure.
- * @param buffer           Buffer where data from USB device
- *                         will be stored.
- * @param buffer_size      Size of buffer.
- * @param transferred_size Real size of read data.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_read_data_message(htc_device_t *htc_device, void *buffer,
-    size_t buffer_size, size_t *transferred_size)
-{
-	ath_t *ath_device = htc_device->ath_device;
-
-	return ath_device->ops->read_data_message(ath_device, buffer,
-	    buffer_size, transferred_size);
-}
-
-/** Read HTC control message from USB device.
- *
- * @param htc_device       HTC device structure.
- * @param buffer           Buffer where data from USB device
- *                         will be stored.
- * @param buffer_size      Size of buffer.
- * @param transferred_size Real size of read data.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_read_control_message(htc_device_t *htc_device, void *buffer,
-    size_t buffer_size, size_t *transferred_size)
-{
-	ath_t *ath_device = htc_device->ath_device;
-
-	return ath_device->ops->read_ctrl_message(ath_device, buffer,
-	    buffer_size, transferred_size);
-}
-
-/** Initialize HTC service.
- *
- * @param htc_device           HTC device structure.
- * @param service_id           Identification of WMI service.
- * @param response_endpoint_no HTC endpoint to be used for
- *                             this service.
- *
- * @return EOK if succeed, EINVAL when failed to connect service,
- *         error code otherwise.
- *
- */
-static errno_t htc_connect_service(htc_device_t *htc_device,
-    wmi_services_t service_id, int *response_endpoint_no)
-{
-	size_t buffer_size = sizeof(htc_frame_header_t) +
-	    sizeof(htc_service_msg_t);
-	void *buffer = malloc(buffer_size);
-	memset(buffer, 0, buffer_size);
-
-	/* Fill service message structure. */
-	htc_service_msg_t *service_message = (htc_service_msg_t *)
-	    ((void *) buffer + sizeof(htc_frame_header_t));
-	service_message->service_id =
-	    host2uint16_t_be(service_id);
-	service_message->message_id =
-	    host2uint16_t_be(HTC_MESSAGE_CONNECT_SERVICE);
-	service_message->download_pipe_id =
-	    wmi_service_to_download_pipe(service_id);
-	service_message->upload_pipe_id =
-	    wmi_service_to_upload_pipe(service_id);
-	service_message->connection_flags = 0;
-
-	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
-	    htc_device->endpoints.ctrl_endpoint);
-	if (rc != EOK) {
-		free(buffer);
-		usb_log_error("Failed to send HTC message. Error: %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	free(buffer);
-
-	buffer_size = htc_device->ath_device->ctrl_response_length;
-	buffer = malloc(buffer_size);
-
-	/* Read response from device. */
-	rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
-	if (rc != EOK) {
-		free(buffer);
-		usb_log_error("Failed to receive HTC service connect response. "
-		    "Error: %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	htc_service_resp_msg_t *response_message = (htc_service_resp_msg_t *)
-	    ((void *) buffer + sizeof(htc_frame_header_t));
-
-	/*
-	 * If service was successfully connected,
-	 * write down HTC endpoint number that will
-	 * be used for communication.
-	 */
-	if (response_message->status == HTC_SERVICE_SUCCESS) {
-		*response_endpoint_no = response_message->endpoint_id;
-		rc = EOK;
-	} else {
-		usb_log_error("Failed to connect HTC service. "
-		    "Message status: %d\n", response_message->status);
-		rc = EINVAL;
-	}
-
-	free(buffer);
-
-	return rc;
-}
-
-/** HTC credits initialization message.
- *
- * @param htc_device HTC device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t htc_config_credits(htc_device_t *htc_device)
-{
-	size_t buffer_size = sizeof(htc_frame_header_t) +
-	    sizeof(htc_config_msg_t);
-	void *buffer = malloc(buffer_size);
-	htc_config_msg_t *config_message = (htc_config_msg_t *)
-	    ((void *) buffer + sizeof(htc_frame_header_t));
-
-	config_message->message_id =
-	    host2uint16_t_be(HTC_MESSAGE_CONFIG);
-	/* Magic number to initialize device. */
-	config_message->credits = 33;
-	config_message->pipe_id = 1;
-
-	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
-	    htc_device->endpoints.ctrl_endpoint);
-	if (rc != EOK) {
-		free(buffer);
-		usb_log_error("Failed to send HTC config message. "
-		    "Error: %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	free(buffer);
-
-	buffer_size = htc_device->ath_device->ctrl_response_length;
-	buffer = malloc(buffer_size);
-
-	/* Check response from device. */
-	rc = htc_read_control_message(htc_device, buffer, buffer_size, NULL);
-	if (rc != EOK) {
-		usb_log_error("Failed to receive HTC config response message. "
-		    "Error: %s\n", str_error_name(rc));
-	}
-
-	free(buffer);
-
-	return rc;
-}
-
-/** HTC setup complete confirmation message.
- *
- * @param htc_device HTC device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t htc_complete_setup(htc_device_t *htc_device)
-{
-	size_t buffer_size = sizeof(htc_frame_header_t) +
-	    sizeof(htc_setup_complete_msg_t);
-	void *buffer = malloc(buffer_size);
-	htc_setup_complete_msg_t *complete_message =
-	    (htc_setup_complete_msg_t *)
-	    ((void *) buffer + sizeof(htc_frame_header_t));
-
-	complete_message->message_id =
-	    host2uint16_t_be(HTC_MESSAGE_SETUP_COMPLETE);
-
-	/* Send HTC message. */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
-	    htc_device->endpoints.ctrl_endpoint);
-	if (rc != EOK)
-		usb_log_error("Failed to send HTC setup complete message. "
-		    "Error: %s\n", str_error_name(rc));
-
-	free(buffer);
-
-	return rc;
-}
-
-/** Try to fetch ready message from device.
- *
- * Checks that firmware was successfully loaded on device side.
- *
- * @param htc_device HTC device structure.
- *
- * @return EOK if succeed, EINVAL if response error,
- *         error code otherwise.
- *
- */
-static errno_t htc_check_ready(htc_device_t *htc_device)
-{
-	size_t buffer_size = htc_device->ath_device->ctrl_response_length;
-	void *buffer = malloc(buffer_size);
-
-	/* Read response from device. */
-	errno_t rc = htc_read_control_message(htc_device, buffer, buffer_size,
-	    NULL);
-	if (rc != EOK) {
-		free(buffer);
-		usb_log_error("Failed to receive HTC check ready message. "
-		    "Error: %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	uint16_t *message_id = (uint16_t *) ((void *) buffer +
-	    sizeof(htc_frame_header_t));
-	if (uint16_t_be2host(*message_id) == HTC_MESSAGE_READY)
-		rc = EOK;
-	else
-		rc = EINVAL;
-
-	free(buffer);
-
-	return rc;
-}
-
-/** Initialize HTC device structure.
- *
- * @param ath_device Atheros WiFi device connected
- *                   with this HTC device.
- * @param htc_device HTC device structure to be initialized.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_device_init(ath_t *ath_device, ieee80211_dev_t *ieee80211_dev,
-    htc_device_t *htc_device)
-{
-	fibril_mutex_initialize(&htc_device->rx_lock);
-	fibril_mutex_initialize(&htc_device->tx_lock);
-
-	htc_device->endpoints.ctrl_endpoint = 0;
-
-	htc_device->ath_device = ath_device;
-	htc_device->ieee80211_dev = ieee80211_dev;
-
-	return EOK;
-}
-
-/** HTC communication initalization.
- *
- * @param htc_device HTC device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t htc_init(htc_device_t *htc_device)
-{
-	/* First check ready message in device. */
-	errno_t rc = htc_check_ready(htc_device);
-	if (rc != EOK) {
-		usb_log_error("Device is not in ready state after loading "
-		    "firmware.\n");
-		return rc;
-	}
-
-	/*
-	 * HTC services initialization start.
-	 */
-	rc = htc_connect_service(htc_device, WMI_CONTROL_SERVICE,
-	    &htc_device->endpoints.wmi_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing WMI service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_BEACON_SERVICE,
-	    &htc_device->endpoints.beacon_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing beacon service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_CAB_SERVICE,
-	    &htc_device->endpoints.cab_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing CAB service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_UAPSD_SERVICE,
-	    &htc_device->endpoints.uapsd_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing UAPSD service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_MGMT_SERVICE,
-	    &htc_device->endpoints.mgmt_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing MGMT service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_DATA_BE_SERVICE,
-	    &htc_device->endpoints.data_be_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing data best effort "
-		    "service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_DATA_BK_SERVICE,
-	    &htc_device->endpoints.data_bk_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing data background "
-		    "service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_DATA_VIDEO_SERVICE,
-	    &htc_device->endpoints.data_video_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing data video service.\n");
-		return rc;
-	}
-
-	rc = htc_connect_service(htc_device, WMI_DATA_VOICE_SERVICE,
-	    &htc_device->endpoints.data_voice_endpoint);
-	if (rc != EOK) {
-		usb_log_error("Error while initalizing data voice service.\n");
-		return rc;
-	}
-
-	/*
-	 * HTC services initialization end.
-	 */
-
-	/* Credits initialization message. */
-	rc = htc_config_credits(htc_device);
-	if (rc != EOK) {
-		usb_log_error("Failed to send HTC config message.\n");
-		return rc;
-	}
-
-	/* HTC setup complete confirmation message. */
-	rc = htc_complete_setup(htc_device);
-	if (rc != EOK) {
-		usb_log_error("Failed to send HTC complete setup message.\n");
-		return rc;
-	}
-
-	usb_log_info("HTC services initialization finished successfully.\n");
-
-	return EOK;
-}
Index: pace/drv/nic/ar9271/htc.h
===================================================================
--- uspace/drv/nic/ar9271/htc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,307 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file htc.h
- *
- * Definitions of the Atheros HTC (Host Target Communication) technology
- * for communication between host (PC) and target (device firmware).
- *
- */
-
-#ifndef ATHEROS_HTC_H
-#define ATHEROS_HTC_H
-
-#include <ieee80211.h>
-#include <fibril_synch.h>
-#include <usb/dev/driver.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <nic.h>
-#include "ath.h"
-
-#define HTC_RTS_THRESHOLD     2304
-#define HTC_RATES_MAX_LENGTH  30
-
-/** HTC message IDs.
- *
- */
-typedef enum {
-	HTC_MESSAGE_READY = 1,
-	HTC_MESSAGE_CONNECT_SERVICE,
-	HTC_MESSAGE_CONNECT_SERVICE_RESPONSE,
-	HTC_MESSAGE_SETUP_COMPLETE,
-	HTC_MESSAGE_CONFIG
-} htc_message_id_t;
-
-/** HTC response message status codes.
- *
- */
-typedef enum {
-	HTC_SERVICE_SUCCESS = 0,
-	HTC_SERVICE_NOT_FOUND,
-	HTC_SERVICE_FAILED,
-	HTC_SERVICE_NO_RESOURCES,
-	HTC_SERVICE_NO_MORE_EP
-} htc_response_status_code_t;
-
-/** HTC operating mode definition.
- *
- */
-typedef enum {
-	HTC_OPMODE_ADHOC = 0,
-	HTC_OPMODE_STATION = 1,
-	HTC_OPMODE_MESH = 2,
-	HTC_OPMODE_AP = 6
-} htc_operating_mode_t;
-
-/** HTC data type indicator.
- *
- */
-typedef enum {
-	HTC_DATA_AMPDU = 1,
-	HTC_DATA_NORMAL = 2,
-	HTC_DATA_BEACON = 3,
-	HTC_DATA_MGMT = 4
-} htc_data_type_t;
-
-/** HTC endpoint numbers.
- *
- */
-typedef struct {
-	int ctrl_endpoint;
-	int wmi_endpoint;
-	int beacon_endpoint;
-	int cab_endpoint;
-	int uapsd_endpoint;
-	int mgmt_endpoint;
-	int data_be_endpoint;
-	int data_bk_endpoint;
-	int data_video_endpoint;
-	int data_voice_endpoint;
-} htc_pipes_t;
-
-/** HTC device data.
- *
- */
-typedef struct {
-	/** WMI message sequence number */
-	uint16_t sequence_number;
-
-	/** HTC endpoints numbers */
-	htc_pipes_t endpoints;
-
-	/** Lock for receiver */
-	fibril_mutex_t rx_lock;
-
-	/** Lock for transmitter */
-	fibril_mutex_t tx_lock;
-
-	/** Pointer to related IEEE 802.11 device */
-	ieee80211_dev_t *ieee80211_dev;
-
-	/** Pointer to Atheros WiFi device structure */
-	ath_t *ath_device;
-} htc_device_t;
-
-/** HTC frame header structure.
- *
- */
-typedef struct {
-	uint8_t endpoint_id;
-	uint8_t flags;
-	uint16_t payload_length;   /**< Big Endian value! */
-	uint8_t control_bytes[4];
-} __attribute__((packed)) htc_frame_header_t;
-
-/** HTC management TX frame header structure.
- *
- */
-typedef struct {
-	uint8_t node_idx;
-	uint8_t vif_idx;
-	uint8_t tidno;
-	uint8_t flags;
-	uint8_t key_type;
-	uint8_t keyix;
-	uint8_t cookie;
-	uint8_t pad;
-} __attribute__((packed)) htc_tx_management_header_t;
-
-/** HTC data TX frame header structure.
- *
- */
-typedef struct {
-	uint8_t data_type;
-	uint8_t node_idx;
-	uint8_t vif_idx;
-	uint8_t tidno;
-	uint32_t flags;    /**< Big Endian value! */
-	uint8_t key_type;
-	uint8_t keyix;
-	uint8_t cookie;
-	uint8_t pad;
-} __attribute__((packed)) htc_tx_data_header_t;
-
-/** HTC ready message structure.
- *
- */
-typedef struct {
-	uint16_t message_id;   /**< Big Endian value! */
-	uint16_t credits;      /**< Big Endian value! */
-	uint16_t credit_size;  /**< Big Endian value! */
-
-	uint8_t max_endpoints;
-	uint8_t pad;
-} __attribute__((packed)) htc_ready_msg_t;
-
-/** HTC service message structure.
- *
- */
-typedef struct {
-	uint16_t message_id;        /**< Big Endian value! */
-	uint16_t service_id;        /**< Big Endian value! */
-	uint16_t connection_flags;  /**< Big Endian value! */
-
-	uint8_t download_pipe_id;
-	uint8_t upload_pipe_id;
-	uint8_t service_meta_length;
-	uint8_t pad;
-} __attribute__((packed)) htc_service_msg_t;
-
-/** HTC service response message structure.
- *
- */
-typedef struct {
-	uint16_t message_id;          /**< Big Endian value! */
-	uint16_t service_id;          /**< Big Endian value! */
-	uint8_t status;
-	uint8_t endpoint_id;
-	uint16_t max_message_length;  /**< Big Endian value! */
-	uint8_t service_meta_length;
-	uint8_t pad;
-} __attribute__((packed)) htc_service_resp_msg_t;
-
-/** HTC credits config message structure.
- *
- */
-typedef struct {
-	uint16_t message_id;  /**< Big Endian value! */
-	uint8_t pipe_id;
-	uint8_t credits;
-} __attribute__((packed)) htc_config_msg_t;
-
-/** HTC new virtual interface message.
- *
- */
-typedef struct {
-	uint8_t index;
-	uint8_t op_mode;
-	uint8_t addr[ETH_ADDR];
-	uint8_t ath_cap;
-	uint16_t rts_thres;      /**< Big Endian value! */
-	uint8_t pad;
-} __attribute__((packed)) htc_vif_msg_t;
-
-/** HTC new station message.
- *
- */
-typedef struct {
-	uint8_t addr[ETH_ADDR];
-	uint8_t bssid[ETH_ADDR];
-	uint8_t sta_index;
-	uint8_t vif_index;
-	uint8_t is_vif_sta;
-
-	uint16_t flags;      /**< Big Endian value! */
-	uint16_t ht_cap;     /**< Big Endian value! */
-	uint16_t max_ampdu;  /**< Big Endian value! */
-
-	uint8_t pad;
-} __attribute__((packed)) htc_sta_msg_t;
-
-/** HTC message to inform target about available capabilities.
- *
- */
-typedef struct {
-	uint32_t ampdu_limit;     /**< Big Endian value! */
-	uint8_t ampdu_subframes;
-	uint8_t enable_coex;
-	uint8_t tx_chainmask;
-	uint8_t pad;
-} __attribute__((packed)) htc_cap_msg_t;
-
-typedef struct {
-	uint8_t sta_index;
-	uint8_t is_new;
-	uint32_t cap_flags;  /**< Big Endian value! */
-	uint8_t legacy_rates_count;
-	uint8_t legacy_rates[HTC_RATES_MAX_LENGTH];
-	uint16_t pad;
-} htc_rate_msg_t;
-
-/** HTC RX status structure used in incoming HTC data messages.
- *
- */
-typedef struct {
-	uint64_t timestamp;    /**< Big Endian value! */
-	uint16_t data_length;  /**< Big Endian value! */
-	uint8_t status;
-	uint8_t phy_err;
-	int8_t rssi;
-	int8_t rssi_ctl[3];
-	int8_t rssi_ext[3];
-	uint8_t keyix;
-	uint8_t rate;
-	uint8_t antenna;
-	uint8_t more;
-	uint8_t is_aggr;
-	uint8_t more_aggr;
-	uint8_t num_delims;
-	uint8_t flags;
-	uint8_t dummy;
-	uint32_t evm0;         /**< Big Endian value! */
-	uint32_t evm1;         /**< Big Endian value! */
-	uint32_t evm2;         /**< Big Endian value! */
-} htc_rx_status_t;
-
-/** HTC setup complete message structure
- *
- */
-typedef struct {
-	uint16_t message_id;  /**< Big Endian value! */
-} __attribute__((packed)) htc_setup_complete_msg_t;
-
-extern errno_t htc_device_init(ath_t *, ieee80211_dev_t *, htc_device_t *);
-extern errno_t htc_init(htc_device_t *);
-extern errno_t htc_init_new_vif(htc_device_t *);
-extern errno_t htc_read_control_message(htc_device_t *, void *, size_t, size_t *);
-extern errno_t htc_read_data_message(htc_device_t *, void *, size_t, size_t *);
-extern errno_t htc_send_control_message(htc_device_t *, void *, size_t, uint8_t);
-extern errno_t htc_send_data_message(htc_device_t *, void *, size_t, uint8_t);
-
-#endif  /* ATHEROS_HTC_H */
Index: pace/drv/nic/ar9271/hw.c
===================================================================
--- uspace/drv/nic/ar9271/hw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,657 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file hw.c
- *
- * AR9271 hardware related functions implementation.
- *
- */
-
-#include <macros.h>
-#include <usb/debug.h>
-#include <errno.h>
-#include <nic.h>
-#include <ieee80211.h>
-#include "hw.h"
-#include "wmi.h"
-
-/** Try to wait for register value repeatedly until timeout is reached.
- *
- * @param ar9271 Device structure.
- * @param offset Registry offset (address) to be read.
- * @param mask   Mask to apply on read result.
- * @param value  Required value we are waiting for.
- *
- * @return EOK if succeed, ETIMEOUT on timeout,
- *         error code otherwise.
- *
- */
-static errno_t hw_read_wait(ar9271_t *ar9271, uint32_t offset, uint32_t mask,
-    uint32_t value)
-{
-	for (size_t i = 0; i < HW_WAIT_LOOPS; i++) {
-		udelay(HW_WAIT_TIME_US);
-
-		uint32_t result;
-		wmi_reg_read(ar9271->htc_device, offset, &result);
-		if ((result & mask) == value)
-			return EOK;
-	}
-
-	return ETIMEOUT;
-}
-
-static errno_t hw_reset_power_on(ar9271_t *ar9271)
-{
-	wmi_reg_t buffer[] = {
-		{
-			.offset = AR9271_RTC_FORCE_WAKE,
-			.value = AR9271_RTC_FORCE_WAKE_ENABLE |
-			    AR9271_RTC_FORCE_WAKE_ON_INT
-		},
-		{
-			.offset = AR9271_RC,
-			.value = AR9271_RC_AHB
-		},
-		{
-			.offset = AR9271_RTC_RESET,
-			.value = 0
-		}
-	};
-
-	wmi_reg_buffer_write(ar9271->htc_device, buffer,
-	    sizeof(buffer) / sizeof(wmi_reg_t));
-
-	udelay(2);
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RC, 0);
-	wmi_reg_write(ar9271->htc_device, AR9271_RTC_RESET, 1);
-
-	errno_t rc = hw_read_wait(ar9271,
-	    AR9271_RTC_STATUS,
-	    AR9271_RTC_STATUS_MASK,
-	    AR9271_RTC_STATUS_ON);
-	if (rc != EOK) {
-		usb_log_error("Failed to wait for RTC wake up register.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hw_set_reset(ar9271_t *ar9271, bool cold)
-{
-	uint32_t reset_value = AR9271_RTC_RC_MAC_WARM;
-
-	if (cold)
-		reset_value |= AR9271_RTC_RC_MAC_COLD;
-
-	wmi_reg_t buffer[] = {
-		{
-			.offset = AR9271_RTC_FORCE_WAKE,
-			.value = AR9271_RTC_FORCE_WAKE_ENABLE |
-			    AR9271_RTC_FORCE_WAKE_ON_INT
-		},
-		{
-			.offset = AR9271_RC,
-			.value = AR9271_RC_AHB
-		},
-		{
-			.offset = AR9271_RTC_RC,
-			.value = reset_value
-		}
-	};
-
-	wmi_reg_buffer_write(ar9271->htc_device, buffer,
-	    sizeof(buffer) / sizeof(wmi_reg_t));
-
-	udelay(100);
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RTC_RC, 0);
-
-	errno_t rc = hw_read_wait(ar9271, AR9271_RTC_RC, AR9271_RTC_RC_MASK, 0);
-	if (rc != EOK) {
-		usb_log_error("Failed to wait for RTC RC register.\n");
-		return rc;
-	}
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RC, 0);
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_STATION_ID1,
-	    AR9271_STATION_ID1_POWER_SAVING);
-
-	return EOK;
-}
-
-static errno_t hw_addr_init(ar9271_t *ar9271)
-{
-	uint32_t value;
-	nic_address_t ar9271_address;
-
-	for (unsigned int i = 0; i < 3; i++) {
-		wmi_reg_read(ar9271->htc_device,
-		    AR9271_EEPROM_MAC_ADDR_START + i * 4, &value);
-
-		uint16_t two_bytes = uint16_t_be2host(value);
-		ar9271_address.address[2 * i] = two_bytes >> 8;
-		ar9271_address.address[2 * i + 1] = two_bytes & 0xff;
-	}
-
-	nic_t *nic = nic_get_from_ddf_dev(ar9271->ddf_dev);
-
-	errno_t rc = nic_report_address(nic, &ar9271_address);
-	if (rc != EOK) {
-		usb_log_error("Failed to report NIC HW address.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hw_gpio_set_output(ar9271_t *ar9271, uint32_t gpio, uint32_t type)
-{
-	uint32_t address;
-
-	if (gpio > 11)
-		address = AR9271_GPIO_OUT_MUX3;
-	else if (gpio > 5)
-		address = AR9271_GPIO_OUT_MUX2;
-	else
-		address = AR9271_GPIO_OUT_MUX1;
-
-	uint32_t gpio_shift = (gpio % 6) * 5;
-
-	uint32_t temp;
-	wmi_reg_read(ar9271->htc_device, address, &temp);
-
-	temp = ((temp & 0x1f0) << 1) | (temp & ~0x1f0);
-	temp &= ~(0x1f << gpio_shift);
-	temp |= (type << gpio_shift);
-
-	wmi_reg_write(ar9271->htc_device, address, temp);
-
-	gpio_shift = 2 * gpio;
-
-	wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_OE_OUT,
-	    AR9271_GPIO_OE_OUT_ALWAYS << gpio_shift,
-	    AR9271_GPIO_OE_OUT_ALWAYS << gpio_shift);
-
-	return EOK;
-}
-
-static errno_t hw_gpio_set_value(ar9271_t *ar9271, uint32_t gpio, uint32_t value)
-{
-	wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_GPIO_IN_OUT,
-	    (~value & 1) << gpio, 1 << gpio);
-	return EOK;
-}
-
-/**Hardware init procedure of AR9271 device.
- *
- * @param ar9271 Device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t hw_init_proc(ar9271_t *ar9271)
-{
-	errno_t rc = hw_reset_power_on(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW reset power on.\n");
-		return rc;
-	}
-
-	rc = hw_set_reset(ar9271, false);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW warm reset.\n");
-		return rc;
-	}
-
-	rc = hw_addr_init(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to init HW addr.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hw_init_led(ar9271_t *ar9271)
-{
-	errno_t rc = hw_gpio_set_output(ar9271, AR9271_LED_PIN,
-	    AR9271_GPIO_OUT_MUX_AS_OUT);
-	if (rc != EOK) {
-		usb_log_error("Failed to set led GPIO to output.\n");
-		return rc;
-	}
-
-	rc = hw_gpio_set_value(ar9271, AR9271_LED_PIN, 0);
-	if (rc != EOK) {
-		usb_log_error("Failed to init bring up GPIO led.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hw_activate_phy(ar9271_t *ar9271)
-{
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 1);
-	udelay(1000);
-
-	return EOK;
-}
-
-static errno_t hw_set_operating_mode(ar9271_t *ar9271,
-    ieee80211_operating_mode_t op_mode)
-{
-	uint32_t set_bit = 0x10000000;
-
-	switch (op_mode) {
-	case IEEE80211_OPMODE_ADHOC:
-		set_bit |= AR9271_OPMODE_ADHOC_MASK;
-		wmi_reg_set_bit(ar9271->htc_device, AR9271_CONFIG,
-		    AR9271_CONFIG_ADHOC);
-		break;
-	case IEEE80211_OPMODE_MESH:
-	case IEEE80211_OPMODE_AP:
-		set_bit |= AR9271_OPMODE_STATION_AP_MASK;
-		/* Fallthrough */
-	case IEEE80211_OPMODE_STATION:
-		wmi_reg_clear_bit(ar9271->htc_device, AR9271_CONFIG,
-		    AR9271_CONFIG_ADHOC);
-	}
-
-	wmi_reg_set_clear_bit(ar9271->htc_device, AR9271_STATION_ID1,
-	    set_bit, AR9271_OPMODE_STATION_AP_MASK | AR9271_OPMODE_ADHOC_MASK);
-
-	ieee80211_report_current_op_mode(ar9271->ieee80211_dev, op_mode);
-
-	return EOK;
-}
-
-static errno_t hw_reset_operating_mode(ar9271_t *ar9271)
-{
-	errno_t rc = hw_set_operating_mode(ar9271, IEEE80211_OPMODE_STATION);
-	if (rc != EOK) {
-		usb_log_error("Failed to set opmode to station.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t hw_noise_floor_calibration(ar9271_t *ar9271)
-{
-	uint32_t value;
-	wmi_reg_read(ar9271->htc_device, AR9271_PHY_CAL, &value);
-
-	value &= 0xfffffe00;
-	value |= (((uint32_t) AR9271_CALIB_NOMINAL_VALUE_2GHZ << 1) & 0x1ff);
-
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_CAL, value);
-
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_CALIB_EN);
-
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_NOT_UPDATE);
-
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_CALIB);
-
-	errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_CALIB, 0);
-	if (rc != EOK) {
-		usb_log_error("Failed to wait for NF calibration.\n");
-		return rc;
-	}
-
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_CALIB_EN);
-
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_NOT_UPDATE);
-
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_NF_CALIB);
-
-	return EOK;
-}
-
-static errno_t hw_set_freq(ar9271_t *ar9271, uint16_t freq)
-{
-	/* Not supported channel frequency. */
-	if ((freq < IEEE80211_FIRST_FREQ) || (freq > IEEE80211_MAX_FREQ))
-		return EINVAL;
-
-	/* Not supported channel frequency. */
-	if ((freq - IEEE80211_FIRST_FREQ) % IEEE80211_CHANNEL_GAP != 0)
-		return EINVAL;
-
-	uint32_t tx_control;
-	wmi_reg_read(ar9271->htc_device, AR9271_PHY_CCK_TX_CTRL, &tx_control);
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_CCK_TX_CTRL,
-	    tx_control & ~AR9271_PHY_CCK_TX_CTRL_JAPAN);
-
-	/* Some magic here. */
-	uint32_t synth_ctl;
-	wmi_reg_read(ar9271->htc_device, AR9271_PHY_SYNTH_CONTROL, &synth_ctl);
-	synth_ctl &= 0xc0000000;
-	uint32_t channel_select = (freq * 0x10000) / 15;
-	synth_ctl = synth_ctl | (1 << 29) | (1 << 28) | channel_select;
-
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_SYNTH_CONTROL, synth_ctl);
-
-	ieee80211_report_current_freq(ar9271->ieee80211_dev, freq);
-
-	return EOK;
-}
-
-errno_t hw_freq_switch(ar9271_t *ar9271, uint16_t freq)
-{
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x1);
-
-	errno_t rc = hw_read_wait(ar9271, AR9271_PHY_RFBUS_GRANT, 0x1, 0x1);
-	if (rc != EOK) {
-		usb_log_error("Failed to kill RF bus.\n");
-		return rc;
-	}
-
-	rc = hw_set_freq(ar9271, freq);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW set frequency.\n");
-		return rc;
-	}
-
-	rc = hw_activate_phy(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to activate physical layer.\n");
-		return rc;
-	}
-
-	udelay(1000);
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_RFBUS_KILL, 0x0);
-
-	rc = hw_noise_floor_calibration(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to do NF calibration.\n");
-		return rc;
-	}
-
-	return EOK;
-}
-
-errno_t hw_set_rx_filter(ar9271_t *ar9271, bool assoc)
-{
-	uint32_t additional_bits = 0;
-
-	if (assoc)
-		additional_bits |= AR9271_RX_FILTER_MYBEACON;
-	else
-		additional_bits |= AR9271_RX_FILTER_BEACON;
-
-	uint32_t filter_bits = AR9271_RX_FILTER_UNI |
-	    AR9271_RX_FILTER_MULTI | AR9271_RX_FILTER_BROAD |
-	    additional_bits;
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RX_FILTER, filter_bits);
-
-	return EOK;
-}
-
-errno_t hw_set_bssid(ar9271_t *ar9271)
-{
-	ieee80211_dev_t *ieee80211_dev = ar9271->ieee80211_dev;
-
-	nic_address_t bssid;
-	ieee80211_query_bssid(ieee80211_dev, &bssid);
-
-	uint32_t *first_4bytes = (uint32_t *) &bssid.address;
-	uint16_t *last_2bytes = (uint16_t *) &bssid.address[4];
-
-	wmi_reg_write(ar9271->htc_device, AR9271_BSSID0,
-	    uint32_t_le2host(*first_4bytes));
-
-	wmi_reg_write(ar9271->htc_device, AR9271_BSSID1,
-	    uint16_t_le2host(*last_2bytes) |
-	    ((ieee80211_get_aid(ieee80211_dev) & 0x3fff) << 16));
-
-	return EOK;
-}
-
-errno_t hw_rx_init(ar9271_t *ar9271)
-{
-	wmi_reg_write(ar9271->htc_device, AR9271_COMMAND,
-	    AR9271_COMMAND_RX_ENABLE);
-
-	errno_t rc = hw_set_rx_filter(ar9271, false);
-	if (rc != EOK) {
-		usb_log_error("Failed to set RX filtering.\n");
-		return rc;
-	}
-
-	wmi_reg_write(ar9271->htc_device, AR9271_MULTICAST_FILTER1, ~0);
-	wmi_reg_write(ar9271->htc_device, AR9271_MULTICAST_FILTER2, ~0);
-
-	/* Disable RX blocking. */
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_DIAG, (0x20 | 0x02000000));
-
-	return EOK;
-}
-
-static errno_t hw_init_pll(ar9271_t *ar9271)
-{
-	/* Some magic here (set for 2GHz channels). But VERY important :-) */
-	uint32_t pll = (0x5 << 10) | 0x2c;
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RTC_PLL_CONTROL, pll);
-
-	wmi_reg_write(ar9271->htc_device, AR9271_RTC_SLEEP_CLOCK,
-	    AR9271_RTC_SLEEP_CLOCK_FORCE_DERIVED);
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_RTC_FORCE_WAKE,
-	    AR9271_RTC_FORCE_WAKE_ENABLE);
-
-	return EOK;
-}
-
-static void hw_set_init_values(ar9271_t *ar9271)
-{
-	uint32_t reg_offset;
-	uint32_t reg_value;
-
-	size_t size = ARRAY_SIZE(ar9271_2g_mode_array);
-
-	for (size_t i = 0; i < size; i++) {
-		reg_offset = ar9271_2g_mode_array[i][0];
-		reg_value = ar9271_2g_mode_array[i][1];
-		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
-	}
-
-	size = ARRAY_SIZE(ar9271_2g_tx_array);
-
-	for (size_t i = 0; i < size; i++) {
-		reg_offset = ar9271_2g_tx_array[i][0];
-		reg_value = ar9271_2g_tx_array[i][1];
-		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
-	}
-
-	size = ARRAY_SIZE(ar9271_init_array);
-
-	for (size_t i = 0; i < size; i++) {
-		reg_offset = ar9271_init_array[i][0];
-		reg_value = ar9271_init_array[i][1];
-		wmi_reg_write(ar9271->htc_device, reg_offset, reg_value);
-	}
-}
-
-static errno_t hw_calibration(ar9271_t *ar9271)
-{
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
-	    AR9271_CARRIER_LEAK_CALIB);
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_ADC_CONTROL,
-	    AR9271_ADC_CONTROL_OFF_PWDADC);
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_TX_CALIB);
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_PHY_TPCRG1,
-	    AR9271_PHY_TPCRG1_PD_CALIB);
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_CALIB);
-
-	errno_t rc = hw_read_wait(ar9271, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_CALIB, 0);
-	if (rc != EOK) {
-		usb_log_error("Failed to wait on calibrate completion.\n");
-		return rc;
-	}
-
-	wmi_reg_set_bit(ar9271->htc_device, AR9271_ADC_CONTROL,
-	    AR9271_ADC_CONTROL_OFF_PWDADC);
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_CARRIER_LEAK_CONTROL,
-	    AR9271_CARRIER_LEAK_CALIB);
-	wmi_reg_clear_bit(ar9271->htc_device, AR9271_AGC_CONTROL,
-	    AR9271_AGC_CONTROL_TX_CALIB);
-
-	return EOK;
-}
-
-errno_t hw_reset(ar9271_t *ar9271)
-{
-	/* Set physical layer as deactivated. */
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_ACTIVE, 0);
-
-	if (ar9271->starting_up) {
-		wmi_reg_write(ar9271->htc_device,
-		    AR9271_RESET_POWER_DOWN_CONTROL,
-		    AR9271_RADIO_RF_RESET);
-
-		udelay(50);
-	}
-
-	/* Cold reset when RX is enabled. */
-	uint32_t config_reg;
-	wmi_reg_read(ar9271->htc_device, AR9271_COMMAND, &config_reg);
-	if (config_reg & AR9271_COMMAND_RX_ENABLE)
-		hw_set_reset(ar9271, true);
-
-	errno_t rc = hw_init_pll(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to init PLL.\n");
-		return rc;
-	}
-
-	udelay(500);
-
-	wmi_reg_write(ar9271->htc_device, AR9271_CLOCK_CONTROL,
-	    AR9271_MAX_CPU_CLOCK);
-
-	udelay(100);
-
-	if (ar9271->starting_up) {
-		wmi_reg_write(ar9271->htc_device,
-		    AR9271_RESET_POWER_DOWN_CONTROL,
-		    AR9271_GATE_MAC_CONTROL);
-
-		udelay(50);
-	}
-
-	hw_set_init_values(ar9271);
-
-	/* Set physical layer mode. */
-	wmi_reg_write(ar9271->htc_device, AR9271_PHY_MODE,
-	    AR9271_PHY_MODE_DYNAMIC);
-
-	/* Reset device operating mode. */
-	rc = hw_reset_operating_mode(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to reset operating mode.\n");
-		return rc;
-	}
-
-	/* Set initial channel frequency. */
-	rc = hw_set_freq(ar9271, IEEE80211_FIRST_FREQ);
-	if (rc != EOK) {
-		usb_log_error("Failed to set channel.\n");
-		return rc;
-	}
-
-	/* Initialize transmission queues. */
-	for (unsigned int i = 0; i < AR9271_QUEUES_COUNT; i++) {
-		wmi_reg_write(ar9271->htc_device,
-		    AR9271_QUEUE_BASE_MASK + (i << 2), 1 << i);
-	}
-
-	/* Activate physical layer. */
-	rc = hw_activate_phy(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to activate physical layer.\n");
-		return rc;
-	}
-
-	/* Calibration. */
-	rc = hw_calibration(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to calibrate device.\n");
-		return rc;
-	}
-
-	rc = hw_noise_floor_calibration(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to calibrate noise floor.\n");
-		return rc;
-	}
-
-	/* Byteswap TX and RX data buffer words. */
-	wmi_reg_write(ar9271->htc_device, AR9271_CONFIG, 0xA);
-
-	return EOK;
-}
-
-/** Initialize hardware of AR9271 device.
- *
- * @param ar9271 Device structure.
- *
- * @return EOK if succeed, error code otherwise.
- */
-errno_t hw_init(ar9271_t *ar9271)
-{
-	errno_t rc = hw_init_proc(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW reset device.\n");
-		return rc;
-	}
-
-	rc = hw_init_led(ar9271);
-	if (rc != EOK) {
-		usb_log_error("Failed to HW init led.\n");
-		return rc;
-	}
-
-	usb_log_info("HW initialization finished successfully.\n");
-
-	return EOK;
-}
Index: pace/drv/nic/ar9271/hw.h
===================================================================
--- uspace/drv/nic/ar9271/hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file hw.h
- *
- * Definitions of AR9271 hardware related functions.
- *
- */
-
-#ifndef ATHEROS_HW_H
-#define ATHEROS_HW_H
-
-#include "ar9271.h"
-
-#define HW_WAIT_LOOPS    1000
-#define HW_WAIT_TIME_US  10
-
-extern errno_t hw_init(ar9271_t *);
-extern errno_t hw_freq_switch(ar9271_t *, uint16_t);
-extern errno_t hw_rx_init(ar9271_t *);
-extern errno_t hw_reset(ar9271_t *);
-extern errno_t hw_set_bssid(ar9271_t *);
-extern errno_t hw_set_rx_filter(ar9271_t *, bool);
-
-#endif  /* ATHEROS_HW_H */
Index: pace/drv/nic/ar9271/meson.build
===================================================================
--- uspace/drv/nic/ar9271/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2014 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usbdev', 'usb', 'nic', 'ieee80211', 'crypto' ]
-src = files(
-	'ath_usb.c',
-	'hw.c',
-	'wmi.c',
-	'htc.c',
-	'ar9271.c',
-)
-
-installed_data += { 'name': 'ar9271.fw', 'dir': 'drv/ar9271' }
Index: pace/drv/nic/ar9271/wmi.c
===================================================================
--- uspace/drv/nic/ar9271/wmi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,291 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file wmi.c
- *
- * Implementation of Atheros WMI communication.
- *
- */
-
-#include <usb/debug.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <byteorder.h>
-#include "wmi.h"
-
-/** WMI registry read.
- *
- * @param htc_device HTC device structure.
- * @param reg_offset Registry offset (address) to be read.
- * @param res        Stored result.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_read(htc_device_t *htc_device, uint32_t reg_offset, uint32_t *res)
-{
-	uint32_t cmd_value = host2uint32_t_be(reg_offset);
-
-	void *resp_buffer =
-	    malloc(htc_device->ath_device->ctrl_response_length);
-
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_READ,
-	    (uint8_t *) &cmd_value, sizeof(cmd_value), resp_buffer);
-
-	if (rc != EOK) {
-		usb_log_error("Failed to read registry value.\n");
-		return rc;
-	}
-
-	uint32_t *resp_value = (uint32_t *) ((void *) resp_buffer +
-	    sizeof(htc_frame_header_t) + sizeof(wmi_command_header_t));
-
-	*res = uint32_t_be2host(*resp_value);
-
-	return rc;
-}
-
-/** WMI registry write.
- *
- * @param htc_device HTC device structure.
- * @param reg_offset Registry offset (address) to be written.
- * @param val        Value to be written
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_write(htc_device_t *htc_device, uint32_t reg_offset, uint32_t val)
-{
-	uint32_t cmd_buffer[] = {
-		host2uint32_t_be(reg_offset),
-		host2uint32_t_be(val)
-	};
-
-	void *resp_buffer =
-	    malloc(htc_device->ath_device->ctrl_response_length);
-
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
-	    (uint8_t *) &cmd_buffer, sizeof(cmd_buffer), resp_buffer);
-
-	free(resp_buffer);
-
-	if (rc != EOK) {
-		usb_log_error("Failed to write registry value.\n");
-		return rc;
-	}
-
-	return rc;
-}
-
-/** WMI registry set or clear specified bits.
- *
- * @param htc_device HTC device structure.
- * @param reg_offset Registry offset (address) to be written.
- * @param set_bit    Bit to be set.
- * @param clear_bit  Bit to be cleared.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_set_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
-    uint32_t set_bit, uint32_t clear_bit)
-{
-	uint32_t value;
-
-	errno_t rc = wmi_reg_read(htc_device, reg_offset, &value);
-	if (rc != EOK) {
-		usb_log_error("Failed to read registry value in RMW "
-		    "function.\n");
-		return rc;
-	}
-
-	value &= ~clear_bit;
-	value |= set_bit;
-
-	rc = wmi_reg_write(htc_device, reg_offset, value);
-	if (rc != EOK) {
-		usb_log_error("Failed to write registry value in RMW "
-		    "function.\n");
-		return rc;
-	}
-
-	return rc;
-}
-
-/** WMI registry set specified bit.
- *
- * @param htc_device HTC device structure.
- * @param reg_offset Registry offset (address) to be written.
- * @param set_bit    Bit to be set.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_set_bit(htc_device_t *htc_device, uint32_t reg_offset,
-    uint32_t set_bit)
-{
-	return wmi_reg_set_clear_bit(htc_device, reg_offset, set_bit, 0);
-}
-
-/** WMI registry clear specified bit.
- *
- * @param htc_device HTC device structure.
- * @param reg_offset Registry offset (address) to be written.
- * @param clear_bit  Bit to be cleared.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_clear_bit(htc_device_t *htc_device, uint32_t reg_offset,
-    uint32_t clear_bit)
-{
-	return wmi_reg_set_clear_bit(htc_device, reg_offset, 0, clear_bit);
-}
-
-/** WMI multi registry write.
- *
- * @param htc_device HTC device structure.
- * @param reg_buffer Array of registry values to be written.
- * @param elements   Number of elements in array.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_reg_buffer_write(htc_device_t *htc_device, wmi_reg_t *reg_buffer,
-    size_t elements)
-{
-	size_t buffer_size = sizeof(wmi_reg_t) * elements;
-	void *buffer = malloc(buffer_size);
-	void *resp_buffer =
-	    malloc(htc_device->ath_device->ctrl_response_length);
-
-	/* Convert values to correct endianness. */
-	for (size_t i = 0; i < elements; i++) {
-		wmi_reg_t *buffer_element = &reg_buffer[i];
-		wmi_reg_t *buffer_it = (wmi_reg_t *)
-		    ((void *) buffer + i * sizeof(wmi_reg_t));
-		buffer_it->offset =
-		    host2uint32_t_be(buffer_element->offset);
-		buffer_it->value =
-		    host2uint32_t_be(buffer_element->value);
-	}
-
-	errno_t rc = wmi_send_command(htc_device, WMI_REG_WRITE,
-	    (uint8_t *) buffer, buffer_size, resp_buffer);
-
-	free(buffer);
-	free(resp_buffer);
-
-	if (rc != EOK) {
-		usb_log_error("Failed to write multi registry value.\n");
-		return rc;
-	}
-
-	return rc;
-}
-
-/** Send WMI message to HTC device.
- *
- * @param htc_device      HTC device structure.
- * @param command_id      Command identification.
- * @param command_buffer  Buffer with command data.
- * @param command_length  Length of command data.
- * @param response_buffer Buffer with response data.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t wmi_send_command(htc_device_t *htc_device, wmi_command_t command_id,
-    uint8_t *command_buffer, uint32_t command_length, void *response_buffer)
-{
-	size_t header_size = sizeof(wmi_command_header_t) +
-	    sizeof(htc_frame_header_t);
-	size_t buffer_size = header_size + command_length;
-	void *buffer = malloc(buffer_size);
-	if (buffer == NULL) {
-		usb_log_error("Failed to allocate WMI message buffer (out of memory).\n");
-		return ENOMEM;
-	}
-
-	if (command_buffer != NULL)
-		memcpy(buffer + header_size, command_buffer, command_length);
-
-	/* Set up WMI header */
-	wmi_command_header_t *wmi_header = (wmi_command_header_t *)
-	    ((void *) buffer + sizeof(htc_frame_header_t));
-	wmi_header->command_id = host2uint16_t_be(command_id);
-	wmi_header->sequence_number =
-	    host2uint16_t_be(++htc_device->sequence_number);
-
-	/* Send message (buffer will not be needed afterwards regardless of result). */
-	errno_t rc = htc_send_control_message(htc_device, buffer, buffer_size,
-	    htc_device->endpoints.wmi_endpoint);
-	free(buffer);
-	if (rc != EOK) {
-		usb_log_error("Failed to send WMI message. Error: %s\n", str_error_name(rc));
-		return rc;
-	}
-
-	bool clean_resp_buffer = false;
-	size_t response_buffer_size =
-	    htc_device->ath_device->ctrl_response_length;
-	if (response_buffer == NULL) {
-		response_buffer = malloc(response_buffer_size);
-		clean_resp_buffer = true;
-	}
-
-	/* Read response. */
-	/* TODO: Ignoring WMI management RX messages ~ TX statuses etc. */
-	uint16_t cmd_id;
-	do {
-		rc = htc_read_control_message(htc_device, response_buffer,
-		    response_buffer_size, NULL);
-		if (rc != EOK) {
-			usb_log_error("Failed to receive WMI message response. "
-			    "Error: %s\n", str_error_name(rc));
-			return rc;
-		}
-
-		if (response_buffer_size < sizeof(htc_frame_header_t) +
-		    sizeof(wmi_command_header_t)) {
-			usb_log_error("Corrupted response received.\n");
-			return EINVAL;
-		}
-
-		wmi_command_header_t *wmi_hdr = (wmi_command_header_t *)
-		    ((void *) response_buffer + sizeof(htc_frame_header_t));
-		cmd_id = uint16_t_be2host(wmi_hdr->command_id);
-	} while (cmd_id & WMI_MGMT_CMD_MASK);
-
-	if (clean_resp_buffer)
-		free(response_buffer);
-
-	return rc;
-}
Index: pace/drv/nic/ar9271/wmi.h
===================================================================
--- uspace/drv/nic/ar9271/wmi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2014 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file wmi.h
- *
- * Definitions of the Atheros WMI protocol specified in the
- * Wireless Module Interface (WMI).
- *
- */
-
-#ifndef ATHEROS_WMI_H
-#define ATHEROS_WMI_H
-
-#include "htc.h"
-
-/* Macros for creating service identificators. */
-#define WMI_SERVICE_GROUP  1
-
-#define CREATE_SERVICE_ID(group, i) \
-	(unsigned int) (((unsigned int) group << 8) | (unsigned int) (i))
-
-#define WMI_MGMT_CMD_MASK  0x1000
-
-/** WMI header structure.
- *
- */
-typedef struct {
-	uint16_t command_id;       /**< Big Endian value! */
-	uint16_t sequence_number;  /**< Big Endian value! */
-} __attribute__((packed)) wmi_command_header_t;
-
-/** WMI services IDs
- *
- */
-typedef enum {
-	WMI_CONTROL_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 0),
-	WMI_BEACON_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 1),
-	WMI_CAB_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 2),
-	WMI_UAPSD_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 3),
-	WMI_MGMT_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 4),
-	WMI_DATA_VOICE_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 5),
-	WMI_DATA_VIDEO_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 6),
-	WMI_DATA_BE_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 7),
-	WMI_DATA_BK_SERVICE = CREATE_SERVICE_ID(WMI_SERVICE_GROUP, 8)
-} wmi_services_t;
-
-/** List of WMI commands
- *
- */
-typedef enum {
-	WMI_ECHO = 0x0001,
-	WMI_ACCESS_MEMORY,
-
-	/* Commands used for HOST -> DEVICE communication */
-	WMI_GET_FW_VERSION,
-	WMI_DISABLE_INTR,
-	WMI_ENABLE_INTR,
-	WMI_ATH_INIT,
-	WMI_ABORT_TXQ,
-	WMI_STOP_TX_DMA,
-	WMI_ABORT_TX_DMA,
-	WMI_DRAIN_TXQ,
-	WMI_DRAIN_TXQ_ALL,
-	WMI_START_RECV,
-	WMI_STOP_RECV,
-	WMI_FLUSH_RECV,
-	WMI_SET_MODE,
-	WMI_NODE_CREATE,
-	WMI_NODE_REMOVE,
-	WMI_VAP_REMOVE,
-	WMI_VAP_CREATE,
-	WMI_REG_READ,
-	WMI_REG_WRITE,
-	WMI_RC_STATE_CHANGE,
-	WMI_RC_RATE_UPDATE,
-	WMI_TARGET_IC_UPDATE,
-	WMI_TX_AGGR_ENABLE,
-	WMI_TGT_DETACH,
-	WMI_NODE_UPDATE,
-	WMI_INT_STATS,
-	WMI_TX_STATS,
-	WMI_RX_STATS,
-	WMI_BITRATE_MASK
-} wmi_command_t;
-
-/**Structure used when sending registry buffer
- *
- */
-typedef struct {
-	uint32_t offset;  /**< Big Endian value! */
-	uint32_t value;   /**< Big Endian value! */
-} wmi_reg_t;
-
-extern errno_t wmi_reg_read(htc_device_t *, uint32_t, uint32_t *);
-extern errno_t wmi_reg_write(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_set_clear_bit(htc_device_t *, uint32_t, uint32_t, uint32_t);
-extern errno_t wmi_reg_set_bit(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_clear_bit(htc_device_t *, uint32_t, uint32_t);
-extern errno_t wmi_reg_buffer_write(htc_device_t *, wmi_reg_t *, size_t);
-extern errno_t wmi_send_command(htc_device_t *, wmi_command_t, uint8_t *, uint32_t,
-    void *);
-
-#endif  /* ATHEROS_WMI_H */
Index: pace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2433 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Zdenek Bouska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file e1k.c
- *
- * Driver for Intel Pro/1000 8254x Family of Gigabit Ethernet Controllers
- *
- */
-
-#include <async.h>
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <align.h>
-#include <byteorder.h>
-#include <as.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <ddf/interrupt.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <pci_dev_iface.h>
-#include <nic.h>
-#include <ops/nic.h>
-#include "e1k.h"
-
-#define NAME  "e1k"
-
-#define E1000_DEFAULT_INTERRUPT_INTERVAL_USEC  250
-
-/* Must be power of 8 */
-#define E1000_RX_FRAME_COUNT  128
-#define E1000_TX_FRAME_COUNT  128
-
-#define E1000_RECEIVE_ADDRESS  16
-
-/** Maximum sending frame size */
-#define E1000_MAX_SEND_FRAME_SIZE  2048
-/** Maximum receiving frame size */
-#define E1000_MAX_RECEIVE_FRAME_SIZE  2048
-
-/** nic_driver_data_t* -> e1000_t* cast */
-#define DRIVER_DATA_NIC(nic) \
-	((e1000_t *) nic_get_specific(nic))
-
-/** ddf_fun_t * -> nic_driver_data_t* cast */
-#define NIC_DATA_FUN(fun) \
-	((nic_t *) ddf_dev_data_get(ddf_fun_get_dev(fun)))
-
-/** ddf_dev_t * -> nic_driver_data_t* cast */
-#define NIC_DATA_DEV(dev) \
-	((nic_t *) ddf_dev_data_get(dev))
-
-/** ddf_dev_t * -> e1000_t* cast */
-#define DRIVER_DATA_DEV(dev) \
-	(DRIVER_DATA_NIC(NIC_DATA_DEV(dev)))
-
-/** ddf_fun_t * -> e1000_t* cast */
-#define DRIVER_DATA_FUN(fun) \
-	(DRIVER_DATA_NIC(NIC_DATA_FUN(fun)))
-
-/** Cast pointer to uint64_t
- *
- * @param ptr Pointer to cast
- *
- * @return The uint64_t pointer representation.
- *
- */
-#define PTR_TO_U64(ptr)  ((uint64_t) ((uintptr_t) (ptr)))
-
-/** Cast the memaddr part to the void*
- *
- * @param memaddr The memaddr value
- *
- */
-#define MEMADDR_TO_PTR(memaddr)  ((void *) ((size_t) (memaddr)))
-
-#define E1000_REG_BASE(e1000) \
-	((e1000)->reg_base_virt)
-
-#define E1000_REG_ADDR(e1000, reg) \
-	((uint32_t *) (E1000_REG_BASE(e1000) + reg))
-
-#define E1000_REG_READ(e1000, reg) \
-	(pio_read_32(E1000_REG_ADDR(e1000, reg)))
-
-#define E1000_REG_WRITE(e1000, reg, value) \
-	(pio_write_32(E1000_REG_ADDR(e1000, reg), value))
-
-/** E1000 device data */
-typedef struct {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** Parent session */
-	async_sess_t *parent_sess;
-	/** Device configuration */
-	e1000_info_t info;
-
-	/** Physical registers base address */
-	void *reg_base_phys;
-	/** Virtual registers base address */
-	void *reg_base_virt;
-
-	/** Physical tx ring address */
-	uintptr_t tx_ring_phys;
-	/** Virtual tx ring address */
-	void *tx_ring_virt;
-
-	/** Ring of TX frames, physical address */
-	uintptr_t *tx_frame_phys;
-	/** Ring of TX frames, virtual address */
-	void **tx_frame_virt;
-
-	/** Physical rx ring address */
-	uintptr_t rx_ring_phys;
-	/** Virtual rx ring address */
-	void *rx_ring_virt;
-
-	/** Ring of RX frames, physical address */
-	uintptr_t *rx_frame_phys;
-	/** Ring of RX frames, virtual address */
-	void **rx_frame_virt;
-
-	/** VLAN tag */
-	uint16_t vlan_tag;
-
-	/** Add VLAN tag to frame */
-	bool vlan_tag_add;
-
-	/** Used unicast Receive Address count */
-	unsigned int unicast_ra_count;
-
-	/** Used milticast Receive addrress count */
-	unsigned int multicast_ra_count;
-
-	/** The irq assigned */
-	int irq;
-
-	/** Lock for CTRL register */
-	fibril_mutex_t ctrl_lock;
-
-	/** Lock for receiver */
-	fibril_mutex_t rx_lock;
-
-	/** Lock for transmitter */
-	fibril_mutex_t tx_lock;
-
-	/** Lock for EEPROM access */
-	fibril_mutex_t eeprom_lock;
-} e1000_t;
-
-/** Global mutex for work with shared irq structure */
-FIBRIL_MUTEX_INITIALIZE(irq_reg_mutex);
-
-static errno_t e1000_get_address(e1000_t *, nic_address_t *);
-static void e1000_eeprom_get_address(e1000_t *, nic_address_t *);
-static errno_t e1000_set_addr(ddf_fun_t *, const nic_address_t *);
-
-static errno_t e1000_defective_get_mode(ddf_fun_t *, uint32_t *);
-static errno_t e1000_defective_set_mode(ddf_fun_t *, uint32_t);
-
-static errno_t e1000_get_cable_state(ddf_fun_t *, nic_cable_state_t *);
-static errno_t e1000_get_device_info(ddf_fun_t *, nic_device_info_t *);
-static errno_t e1000_get_operation_mode(ddf_fun_t *, int *,
-    nic_channel_mode_t *, nic_role_t *);
-static errno_t e1000_set_operation_mode(ddf_fun_t *, int,
-    nic_channel_mode_t, nic_role_t);
-static errno_t e1000_autoneg_enable(ddf_fun_t *, uint32_t);
-static errno_t e1000_autoneg_disable(ddf_fun_t *);
-static errno_t e1000_autoneg_restart(ddf_fun_t *);
-
-static errno_t e1000_vlan_set_tag(ddf_fun_t *, uint16_t, bool, bool);
-
-/** Network interface options for E1000 card driver */
-static nic_iface_t e1000_nic_iface;
-
-/** Network interface options for E1000 card driver */
-static nic_iface_t e1000_nic_iface = {
-	.set_address = &e1000_set_addr,
-	.get_device_info = &e1000_get_device_info,
-	.get_cable_state = &e1000_get_cable_state,
-	.get_operation_mode = &e1000_get_operation_mode,
-	.set_operation_mode = &e1000_set_operation_mode,
-	.autoneg_enable = &e1000_autoneg_enable,
-	.autoneg_disable = &e1000_autoneg_disable,
-	.autoneg_restart = &e1000_autoneg_restart,
-	.vlan_set_tag = &e1000_vlan_set_tag,
-	.defective_get_mode = &e1000_defective_get_mode,
-	.defective_set_mode = &e1000_defective_set_mode,
-};
-
-/** Basic device operations for E1000 driver */
-static ddf_dev_ops_t e1000_dev_ops;
-
-static errno_t e1000_dev_add(ddf_dev_t *);
-static errno_t e1000_dev_quiesce(ddf_dev_t *);
-
-/** Basic driver operations for E1000 driver */
-static driver_ops_t e1000_driver_ops = {
-	.dev_add = e1000_dev_add,
-	.dev_quiesce = e1000_dev_quiesce
-};
-
-/** Driver structure for E1000 driver */
-static driver_t e1000_driver = {
-	.name = NAME,
-	.driver_ops = &e1000_driver_ops
-};
-
-/* The default implementation callbacks */
-static errno_t e1000_on_activating(nic_t *);
-static errno_t e1000_on_stopping(nic_t *);
-static void e1000_send_frame(nic_t *, void *, size_t);
-
-/** PIO ranges used in the IRQ code. */
-irq_pio_range_t e1000_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size =	PAGE_SIZE,	/* XXX */
-	}
-};
-
-/** Commands to deal with interrupt
- *
- */
-irq_cmd_t e1000_irq_commands[] = {
-	{
-		/* Get the interrupt status */
-		.cmd = CMD_PIO_READ_32,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_AND,
-		.value = ICR_RXT0,
-		.srcarg = 2,
-		.dstarg = 1
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 2,
-		.srcarg = 1
-	},
-	{
-		/* Disable interrupts until interrupt routine is finished */
-		.cmd = CMD_PIO_WRITE_32,
-		.addr = NULL,
-		.value = 0xffffffff
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Interrupt code definition */
-irq_code_t e1000_irq_code = {
-	.rangecount = sizeof(e1000_irq_pio_ranges) /
-	    sizeof(irq_pio_range_t),
-	.ranges = e1000_irq_pio_ranges,
-	.cmdcount = sizeof(e1000_irq_commands) / sizeof(irq_cmd_t),
-	.cmds = e1000_irq_commands
-};
-
-/** Get the device information
- *
- * @param dev  NIC device
- * @param info Information to fill
- *
- * @return EOK
- *
- */
-static errno_t e1000_get_device_info(ddf_fun_t *dev, nic_device_info_t *info)
-{
-	assert(dev);
-	assert(info);
-
-	memset(info, 0, sizeof(nic_device_info_t));
-
-	info->vendor_id = 0x8086;
-	str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH,
-	    "Intel Corporation");
-	str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH,
-	    "Intel Pro");
-
-	info->ethernet_support[ETH_10M] = ETH_10BASE_T;
-	info->ethernet_support[ETH_100M] = ETH_100BASE_TX;
-	info->ethernet_support[ETH_1000M] = ETH_1000BASE_T;
-
-	return EOK;
-}
-
-/** Check the cable state
- *
- * @param[in]  dev   device
- * @param[out] state state to fill
- *
- * @return EOK
- *
- */
-static errno_t e1000_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-	if (E1000_REG_READ(e1000, E1000_STATUS) & (STATUS_LU))
-		*state = NIC_CS_PLUGGED;
-	else
-		*state = NIC_CS_UNPLUGGED;
-
-	return EOK;
-}
-
-static uint16_t e1000_calculate_itr_interval_from_usecs(usec_t useconds)
-{
-	return useconds * 4;
-}
-
-/** Get operation mode of the device
- *
- */
-static errno_t e1000_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-	uint32_t status = E1000_REG_READ(e1000, E1000_STATUS);
-
-	if (status & STATUS_FD)
-		*duplex = NIC_CM_FULL_DUPLEX;
-	else
-		*duplex = NIC_CM_HALF_DUPLEX;
-
-	uint32_t speed_bits =
-	    (status >> STATUS_SPEED_SHIFT) & STATUS_SPEED_ALL;
-
-	if (speed_bits == STATUS_SPEED_10)
-		*speed = 10;
-	else if (speed_bits == STATUS_SPEED_100)
-		*speed = 100;
-	else if ((speed_bits == STATUS_SPEED_1000A) ||
-	    (speed_bits == STATUS_SPEED_1000B))
-		*speed = 1000;
-
-	*role = NIC_ROLE_UNKNOWN;
-	return EOK;
-}
-
-static void e1000_link_restart(e1000_t *e1000)
-{
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-
-	if (ctrl & CTRL_SLU) {
-		ctrl &= ~(CTRL_SLU);
-		E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-		fibril_mutex_unlock(&e1000->ctrl_lock);
-
-		fibril_usleep(10);
-
-		fibril_mutex_lock(&e1000->ctrl_lock);
-		ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-		ctrl |= CTRL_SLU;
-		E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-	}
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-}
-
-/** Set operation mode of the device
- *
- */
-static errno_t e1000_set_operation_mode(ddf_fun_t *fun, int speed,
-    nic_channel_mode_t duplex, nic_role_t role)
-{
-	if ((speed != 10) && (speed != 100) && (speed != 1000))
-		return EINVAL;
-
-	if ((duplex != NIC_CM_HALF_DUPLEX) && (duplex != NIC_CM_FULL_DUPLEX))
-		return EINVAL;
-
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-
-	fibril_mutex_lock(&e1000->ctrl_lock);
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-
-	ctrl |= CTRL_FRCSPD;
-	ctrl |= CTRL_FRCDPLX;
-	ctrl &= ~(CTRL_ASDE);
-
-	if (duplex == NIC_CM_FULL_DUPLEX)
-		ctrl |= CTRL_FD;
-	else
-		ctrl &= ~(CTRL_FD);
-
-	ctrl &= ~(CTRL_SPEED_MASK);
-	if (speed == 1000)
-		ctrl |= CTRL_SPEED_1000 << CTRL_SPEED_SHIFT;
-	else if (speed == 100)
-		ctrl |= CTRL_SPEED_100 << CTRL_SPEED_SHIFT;
-	else
-		ctrl |= CTRL_SPEED_10 << CTRL_SPEED_SHIFT;
-
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-
-	e1000_link_restart(e1000);
-
-	return EOK;
-}
-
-/** Enable auto-negotiation
- *
- * @param dev           Device to update
- * @param advertisement Ignored on E1000
- *
- * @return EOK if advertisement mode set successfully
- *
- */
-static errno_t e1000_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-
-	ctrl &= ~(CTRL_FRCSPD);
-	ctrl &= ~(CTRL_FRCDPLX);
-	ctrl |= CTRL_ASDE;
-
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-
-	e1000_link_restart(e1000);
-
-	return EOK;
-}
-
-/** Disable auto-negotiation
- *
- * @param dev Device to update
- *
- * @return EOK
- *
- */
-static errno_t e1000_autoneg_disable(ddf_fun_t *fun)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-
-	ctrl |= CTRL_FRCSPD;
-	ctrl |= CTRL_FRCDPLX;
-	ctrl &= ~(CTRL_ASDE);
-
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-
-	e1000_link_restart(e1000);
-
-	return EOK;
-}
-
-/** Restart auto-negotiation
- *
- * @param dev Device to update
- *
- * @return EOK if advertisement mode set successfully
- *
- */
-static errno_t e1000_autoneg_restart(ddf_fun_t *dev)
-{
-	return e1000_autoneg_enable(dev, 0);
-}
-
-/** Get state of acceptance of weird frames
- *
- * @param      device Device to check
- * @param[out] mode   Current mode
- *
- */
-static errno_t e1000_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-
-	*mode = 0;
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	if (rctl & RCTL_SBP)
-		*mode = NIC_DEFECTIVE_BAD_CRC | NIC_DEFECTIVE_SHORT;
-
-	return EOK;
-}
-
-/** Set acceptance of weird frames
- *
- * @param device Device to update
- * @param mode   Mode to set
- *
- * @return ENOTSUP if the mode is not supported
- * @return EOK of mode was set
- *
- */
-static errno_t e1000_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
-{
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-	errno_t rc = EOK;
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	bool short_mode = (mode & NIC_DEFECTIVE_SHORT ? true : false);
-	bool bad_mode = (mode & NIC_DEFECTIVE_BAD_CRC ? true : false);
-
-	if (short_mode && bad_mode)
-		rctl |= RCTL_SBP;
-	else if ((!short_mode) && (!bad_mode))
-		rctl &= ~RCTL_SBP;
-	else
-		rc = ENOTSUP;
-
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return rc;
-}
-
-/** Write receive address to RA registr
- *
- * @param e1000      E1000 data structure
- * @param position   RA register position
- * @param address    Ethernet address
- * @param set_av_bit Set the Addtess Valid bit
- *
- */
-static void e1000_write_receive_address(e1000_t *e1000, unsigned int position,
-    const nic_address_t *address, bool set_av_bit)
-{
-	uint8_t *mac0 = (uint8_t *) address->address;
-	uint8_t *mac1 = (uint8_t *) address->address + 1;
-	uint8_t *mac2 = (uint8_t *) address->address + 2;
-	uint8_t *mac3 = (uint8_t *) address->address + 3;
-	uint8_t *mac4 = (uint8_t *) address->address + 4;
-	uint8_t *mac5 = (uint8_t *) address->address + 5;
-
-	uint32_t rah;
-	uint32_t ral;
-
-	ral = ((*mac3) << 24) | ((*mac2) << 16) | ((*mac1) << 8) | (*mac0);
-	rah = ((*mac5) << 8) | ((*mac4));
-
-	if (set_av_bit)
-		rah |= RAH_AV;
-	else
-		rah |= E1000_REG_READ(e1000, E1000_RAH_ARRAY(position)) & RAH_AV;
-
-	E1000_REG_WRITE(e1000, E1000_RAH_ARRAY(position), rah);
-	E1000_REG_WRITE(e1000, E1000_RAL_ARRAY(position), ral);
-}
-
-/** Disable receive address in RA registr
- *
- *  Clear Address Valid bit
- *
- * @param e1000    E1000 data structure
- * @param position RA register position
- *
- */
-static void e1000_disable_receive_address(e1000_t *e1000, unsigned int position)
-{
-	uint32_t rah = E1000_REG_READ(e1000, E1000_RAH_ARRAY(position));
-	rah = rah & ~RAH_AV;
-	E1000_REG_WRITE(e1000, E1000_RAH_ARRAY(position), rah);
-}
-
-/** Clear all unicast addresses from RA registers
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_clear_unicast_receive_addresses(e1000_t *e1000)
-{
-	for (unsigned int ra_num = 1;
-	    ra_num <= e1000->unicast_ra_count;
-	    ra_num++)
-		e1000_disable_receive_address(e1000, ra_num);
-
-	e1000->unicast_ra_count = 0;
-}
-
-/** Clear all multicast addresses from RA registers
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_clear_multicast_receive_addresses(e1000_t *e1000)
-{
-	unsigned int first_multicast_ra_num =
-	    E1000_RECEIVE_ADDRESS - e1000->multicast_ra_count;
-
-	for (unsigned int ra_num = E1000_RECEIVE_ADDRESS - 1;
-	    ra_num >= first_multicast_ra_num;
-	    ra_num--)
-		e1000_disable_receive_address(e1000, ra_num);
-
-	e1000->multicast_ra_count = 0;
-}
-
-/** Return receive address filter positions count usable for unicast
- *
- * @param e1000 E1000 data structure
- *
- * @return receive address filter positions count usable for unicast
- *
- */
-static unsigned int get_free_unicast_address_count(e1000_t *e1000)
-{
-	return E1000_RECEIVE_ADDRESS - 1 - e1000->multicast_ra_count;
-}
-
-/** Return receive address filter positions count usable for multicast
- *
- * @param e1000 E1000 data structure
- *
- * @return receive address filter positions count usable for multicast
- *
- */
-static unsigned int get_free_multicast_address_count(e1000_t *e1000)
-{
-	return E1000_RECEIVE_ADDRESS - 1 - e1000->unicast_ra_count;
-}
-
-/** Write unicast receive addresses to receive address filter registers
- *
- * @param e1000    E1000 data structure
- * @param addr     Pointer to address array
- * @param addr_cnt Address array count
- *
- */
-static void e1000_add_unicast_receive_addresses(e1000_t *e1000,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	assert(addr_cnt <= get_free_unicast_address_count(e1000));
-
-	nic_address_t *addr_iterator = (nic_address_t *) addr;
-
-	/* ra_num = 0 is primary address */
-	for (unsigned int ra_num = 1;
-	    ra_num <= addr_cnt;
-	    ra_num++) {
-		e1000_write_receive_address(e1000, ra_num, addr_iterator, true);
-		addr_iterator++;
-	}
-}
-
-/** Write multicast receive addresses to receive address filter registers
- *
- * @param e1000    E1000 data structure
- * @param addr     Pointer to address array
- * @param addr_cnt Address array count
- *
- */
-static void e1000_add_multicast_receive_addresses(e1000_t *e1000,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	assert(addr_cnt <= get_free_multicast_address_count(e1000));
-
-	nic_address_t *addr_iterator = (nic_address_t *) addr;
-
-	unsigned int first_multicast_ra_num = E1000_RECEIVE_ADDRESS - addr_cnt;
-	for (unsigned int ra_num = E1000_RECEIVE_ADDRESS - 1;
-	    ra_num >= first_multicast_ra_num;
-	    ra_num--) {
-		e1000_write_receive_address(e1000, ra_num, addr_iterator, true);
-		addr_iterator++;
-	}
-}
-
-/** Disable receiving frames for default address
- *
- * @param e1000 E1000 data structure
- *
- */
-static void disable_ra0_address_filter(e1000_t *e1000)
-{
-	uint32_t rah0 = E1000_REG_READ(e1000, E1000_RAH_ARRAY(0));
-	rah0 = rah0 & ~RAH_AV;
-	E1000_REG_WRITE(e1000, E1000_RAH_ARRAY(0), rah0);
-}
-
-/** Enable receiving frames for default address
- *
- * @param e1000 E1000 data structure
- *
- */
-static void enable_ra0_address_filter(e1000_t *e1000)
-{
-	uint32_t rah0 = E1000_REG_READ(e1000, E1000_RAH_ARRAY(0));
-	rah0 = rah0 | RAH_AV;
-	E1000_REG_WRITE(e1000, E1000_RAH_ARRAY(0), rah0);
-}
-
-/** Disable unicast promiscuous mode
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_unicast_promisc(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl & ~RCTL_UPE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Enable unicast promiscuous mode
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_unicast_promisc(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl | RCTL_UPE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Disable multicast promiscuous mode
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_multicast_promisc(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl & ~RCTL_MPE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Enable multicast promiscuous mode
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_multicast_promisc(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl | RCTL_MPE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Enable accepting of broadcast frames
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_broadcast_accept(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl | RCTL_BAM;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Disable accepting of broadcast frames
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_broadcast_accept(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl & ~RCTL_BAM;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Enable VLAN filtering according to VFTA registers
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_vlan_filter(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl | RCTL_VFE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Disable VLAN filtering
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_vlan_filter(e1000_t *e1000)
-{
-	uint32_t rctl = E1000_REG_READ(e1000, E1000_RCTL);
-	rctl = rctl & ~RCTL_VFE;
-	E1000_REG_WRITE(e1000, E1000_RCTL, rctl);
-}
-
-/** Set multicast frames acceptance mode
- *
- * @param nic      NIC device to update
- * @param mode     Mode to set
- * @param addr     Address list (used in mode = NIC_MULTICAST_LIST)
- * @param addr_cnt Length of address list (used in mode = NIC_MULTICAST_LIST)
- *
- * @return EOK
- *
- */
-static errno_t e1000_on_multicast_mode_change(nic_t *nic, nic_multicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	switch (mode) {
-	case NIC_MULTICAST_BLOCKED:
-		e1000_clear_multicast_receive_addresses(e1000);
-		e1000_disable_multicast_promisc(e1000);
-		nic_report_hw_filtering(nic, -1, 1, -1);
-		break;
-	case NIC_MULTICAST_LIST:
-		e1000_clear_multicast_receive_addresses(e1000);
-		if (addr_cnt > get_free_multicast_address_count(e1000)) {
-			/*
-			 * Future work: fill MTA table
-			 * Not strictly neccessary, it only saves some compares
-			 * in the NIC library.
-			 */
-			e1000_enable_multicast_promisc(e1000);
-			nic_report_hw_filtering(nic, -1, 0, -1);
-		} else {
-			e1000_disable_multicast_promisc(e1000);
-			e1000_add_multicast_receive_addresses(e1000, addr, addr_cnt);
-			nic_report_hw_filtering(nic, -1, 1, -1);
-		}
-		break;
-	case NIC_MULTICAST_PROMISC:
-		e1000_enable_multicast_promisc(e1000);
-		e1000_clear_multicast_receive_addresses(e1000);
-		nic_report_hw_filtering(nic, -1, 1, -1);
-		break;
-	default:
-		rc = ENOTSUP;
-		break;
-	}
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return rc;
-}
-
-/** Set unicast frames acceptance mode
- *
- * @param nic      NIC device to update
- * @param mode     Mode to set
- * @param addr     Address list (used in mode = NIC_MULTICAST_LIST)
- * @param addr_cnt Length of address list (used in mode = NIC_MULTICAST_LIST)
- *
- * @return EOK
- *
- */
-static errno_t e1000_on_unicast_mode_change(nic_t *nic, nic_unicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	switch (mode) {
-	case NIC_UNICAST_BLOCKED:
-		disable_ra0_address_filter(e1000);
-		e1000_clear_unicast_receive_addresses(e1000);
-		e1000_disable_unicast_promisc(e1000);
-		nic_report_hw_filtering(nic, 1, -1, -1);
-		break;
-	case NIC_UNICAST_DEFAULT:
-		enable_ra0_address_filter(e1000);
-		e1000_clear_unicast_receive_addresses(e1000);
-		e1000_disable_unicast_promisc(e1000);
-		nic_report_hw_filtering(nic, 1, -1, -1);
-		break;
-	case NIC_UNICAST_LIST:
-		enable_ra0_address_filter(e1000);
-		e1000_clear_unicast_receive_addresses(e1000);
-		if (addr_cnt > get_free_unicast_address_count(e1000)) {
-			e1000_enable_unicast_promisc(e1000);
-			nic_report_hw_filtering(nic, 0, -1, -1);
-		} else {
-			e1000_disable_unicast_promisc(e1000);
-			e1000_add_unicast_receive_addresses(e1000, addr, addr_cnt);
-			nic_report_hw_filtering(nic, 1, -1, -1);
-		}
-		break;
-	case NIC_UNICAST_PROMISC:
-		e1000_enable_unicast_promisc(e1000);
-		enable_ra0_address_filter(e1000);
-		e1000_clear_unicast_receive_addresses(e1000);
-		nic_report_hw_filtering(nic, 1, -1, -1);
-		break;
-	default:
-		rc = ENOTSUP;
-		break;
-	}
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return rc;
-}
-
-/** Set broadcast frames acceptance mode
- *
- * @param nic  NIC device to update
- * @param mode Mode to set
- *
- * @return EOK
- *
- */
-static errno_t e1000_on_broadcast_mode_change(nic_t *nic, nic_broadcast_mode_t mode)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc = EOK;
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	switch (mode) {
-	case NIC_BROADCAST_BLOCKED:
-		e1000_disable_broadcast_accept(e1000);
-		break;
-	case NIC_BROADCAST_ACCEPTED:
-		e1000_enable_broadcast_accept(e1000);
-		break;
-	default:
-		rc = ENOTSUP;
-		break;
-	}
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return rc;
-}
-
-/** Check if receiving is enabled
- *
- * @param e1000 E1000 data structure
- *
- * @return true if receiving is enabled
- *
- */
-static bool e1000_is_rx_enabled(e1000_t *e1000)
-{
-	if (E1000_REG_READ(e1000, E1000_RCTL) & (RCTL_EN))
-		return true;
-
-	return false;
-}
-
-/** Enable receiving
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_rx(e1000_t *e1000)
-{
-	/* Set Receive Enable Bit */
-	E1000_REG_WRITE(e1000, E1000_RCTL,
-	    E1000_REG_READ(e1000, E1000_RCTL) | (RCTL_EN));
-}
-
-/** Disable receiving
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_rx(e1000_t *e1000)
-{
-	/* Clear Receive Enable Bit */
-	E1000_REG_WRITE(e1000, E1000_RCTL,
-	    E1000_REG_READ(e1000, E1000_RCTL) & ~(RCTL_EN));
-}
-
-/** Set VLAN mask
- *
- * @param nic       NIC device to update
- * @param vlan_mask VLAN mask
- *
- */
-static void e1000_on_vlan_mask_change(nic_t *nic,
-    const nic_vlan_mask_t *vlan_mask)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	if (vlan_mask) {
-		/*
-		 * Disable receiving, so that frame matching
-		 * partially written VLAN is not received.
-		 */
-		bool rx_enabled = e1000_is_rx_enabled(e1000);
-		if (rx_enabled)
-			e1000_disable_rx(e1000);
-
-		for (unsigned int i = 0; i < NIC_VLAN_BITMAP_SIZE; i += 4) {
-			uint32_t bitmap_part =
-			    ((uint32_t) vlan_mask->bitmap[i]) |
-			    (((uint32_t) vlan_mask->bitmap[i + 1]) << 8) |
-			    (((uint32_t) vlan_mask->bitmap[i + 2]) << 16) |
-			    (((uint32_t) vlan_mask->bitmap[i + 3]) << 24);
-			E1000_REG_WRITE(e1000, E1000_VFTA_ARRAY(i / 4), bitmap_part);
-		}
-
-		e1000_enable_vlan_filter(e1000);
-		if (rx_enabled)
-			e1000_enable_rx(e1000);
-	} else
-		e1000_disable_vlan_filter(e1000);
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-}
-
-/** Set VLAN mask
- *
- * @param device E1000 device
- * @param tag    VLAN tag
- *
- * @return EOK
- * @return ENOTSUP
- *
- */
-static errno_t e1000_vlan_set_tag(ddf_fun_t *fun, uint16_t tag, bool add,
-    bool strip)
-{
-	/* VLAN CFI bit cannot be set */
-	if (tag & VLANTAG_CFI)
-		return ENOTSUP;
-
-	/*
-	 * CTRL.VME is neccessary for both strip and add
-	 * but CTRL.VME means stripping tags on receive.
-	 */
-	if (!strip && add)
-		return ENOTSUP;
-
-	e1000_t *e1000 = DRIVER_DATA_FUN(fun);
-
-	e1000->vlan_tag = tag;
-	e1000->vlan_tag_add = add;
-
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-	if (strip)
-		ctrl |= CTRL_VME;
-	else
-		ctrl &= ~CTRL_VME;
-
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-	return EOK;
-}
-
-/** Fill receive descriptor with new empty buffer
- *
- * Store frame in e1000->rx_frame_phys
- *
- * @param nic    NIC data stricture
- * @param offset Receive descriptor offset
- *
- */
-static void e1000_fill_new_rx_descriptor(nic_t *nic, size_t offset)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000->rx_ring_virt + offset * sizeof(e1000_rx_descriptor_t));
-
-	rx_descriptor->phys_addr = PTR_TO_U64(e1000->rx_frame_phys[offset]);
-	rx_descriptor->length = 0;
-	rx_descriptor->checksum = 0;
-	rx_descriptor->status = 0;
-	rx_descriptor->errors = 0;
-	rx_descriptor->special = 0;
-}
-
-/** Clear receive descriptor
- *
- * @param e1000  E1000 data
- * @param offset Receive descriptor offset
- *
- */
-static void e1000_clear_rx_descriptor(e1000_t *e1000, unsigned int offset)
-{
-	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000->rx_ring_virt + offset * sizeof(e1000_rx_descriptor_t));
-
-	rx_descriptor->length = 0;
-	rx_descriptor->checksum = 0;
-	rx_descriptor->status = 0;
-	rx_descriptor->errors = 0;
-	rx_descriptor->special = 0;
-}
-
-/** Clear receive descriptor
- *
- * @param nic    NIC data
- * @param offset Receive descriptor offset
- *
- */
-static void e1000_clear_tx_descriptor(nic_t *nic, unsigned int offset)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	e1000_tx_descriptor_t *tx_descriptor = (e1000_tx_descriptor_t *)
-	    (e1000->tx_ring_virt + offset * sizeof(e1000_tx_descriptor_t));
-
-	tx_descriptor->phys_addr = 0;
-	tx_descriptor->length = 0;
-	tx_descriptor->checksum_offset = 0;
-	tx_descriptor->command = 0;
-	tx_descriptor->status = 0;
-	tx_descriptor->checksum_start_field = 0;
-	tx_descriptor->special = 0;
-}
-
-/** Increment tail pointer for receive or transmit ring
- *
- * @param tail              Old Tail
- * @param descriptors_count Ring length
- *
- * @return New tail
- *
- */
-static uint32_t e1000_inc_tail(uint32_t tail, uint32_t descriptors_count)
-{
-	if (tail + 1 == descriptors_count)
-		return 0;
-	else
-		return tail + 1;
-}
-
-/** Receive frames
- *
- * @param nic NIC data
- *
- */
-static void e1000_receive_frames(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	uint32_t *tail_addr = E1000_REG_ADDR(e1000, E1000_RDT);
-	uint32_t next_tail = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
-
-	e1000_rx_descriptor_t *rx_descriptor = (e1000_rx_descriptor_t *)
-	    (e1000->rx_ring_virt + next_tail * sizeof(e1000_rx_descriptor_t));
-
-	while (rx_descriptor->status & 0x01) {
-		uint32_t frame_size = rx_descriptor->length - E1000_CRC_SIZE;
-
-		nic_frame_t *frame = nic_alloc_frame(nic, frame_size);
-		if (frame != NULL) {
-			memcpy(frame->data, e1000->rx_frame_virt[next_tail], frame_size);
-			nic_received_frame(nic, frame);
-		} else {
-			ddf_msg(LVL_ERROR, "Memory allocation failed. Frame dropped.");
-		}
-
-		e1000_fill_new_rx_descriptor(nic, next_tail);
-
-		*tail_addr = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
-		next_tail = e1000_inc_tail(*tail_addr, E1000_RX_FRAME_COUNT);
-
-		rx_descriptor = (e1000_rx_descriptor_t *)
-		    (e1000->rx_ring_virt + next_tail * sizeof(e1000_rx_descriptor_t));
-	}
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-}
-
-/** Enable E1000 interupts
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_enable_interrupts(e1000_t *e1000)
-{
-	E1000_REG_WRITE(e1000, E1000_IMS, ICR_RXT0);
-}
-
-/** Disable E1000 interupts
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_disable_interrupts(e1000_t *e1000)
-{
-	E1000_REG_WRITE(e1000, E1000_IMS, 0);
-}
-
-/** Interrupt handler implementation
- *
- * This function is called from e1000_interrupt_handler()
- * and e1000_poll()
- *
- * @param nic NIC data
- * @param icr ICR register value
- *
- */
-static void e1000_interrupt_handler_impl(nic_t *nic, uint32_t icr)
-{
-	if (icr & ICR_RXT0)
-		e1000_receive_frames(nic);
-}
-
-/** Handle device interrupt
- *
- * @param icall IPC call structure
- * @param arg   Argument (nic_t *)
- *
- */
-static void e1000_interrupt_handler(ipc_call_t *icall, void *arg)
-{
-	uint32_t icr = (uint32_t) ipc_get_arg2(icall);
-	nic_t *nic = (nic_t *)arg;
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	e1000_interrupt_handler_impl(nic, icr);
-	e1000_enable_interrupts(e1000);
-}
-
-/** Register interrupt handler for the card in the system
- *
- * Note: The global irq_reg_mutex is locked because of work with global
- * structure.
- *
- * @param nic Driver data
- *
- * @param[out] handle  IRQ capability handle if the handler was registered
- *
- * @return An error code otherwise
- *
- */
-static errno_t e1000_register_int_handler(nic_t *nic,
-    cap_irq_handle_t *handle)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	/* Lock the mutex in whole driver while working with global structure */
-	fibril_mutex_lock(&irq_reg_mutex);
-
-	e1000_irq_code.ranges[0].base = (uintptr_t) e1000->reg_base_phys;
-	e1000_irq_code.cmds[0].addr = e1000->reg_base_phys + E1000_ICR;
-	e1000_irq_code.cmds[3].addr = e1000->reg_base_phys + E1000_IMC;
-
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic), e1000->irq,
-	    e1000_interrupt_handler, (void *)nic, &e1000_irq_code, handle);
-
-	fibril_mutex_unlock(&irq_reg_mutex);
-	return rc;
-}
-
-/** Force receiving all frames in the receive buffer
- *
- * @param nic NIC data
- *
- */
-static void e1000_poll(nic_t *nic)
-{
-	assert(nic);
-
-	e1000_t *e1000 = nic_get_specific(nic);
-	assert(e1000);
-
-	uint32_t icr = E1000_REG_READ(e1000, E1000_ICR);
-	e1000_interrupt_handler_impl(nic, icr);
-}
-
-/** Calculates ITR register interrupt from timespec structure
- *
- * @param period Period
- *
- */
-static uint16_t e1000_calculate_itr_interval(const struct timespec *period)
-{
-	// TODO: use also tv_sec
-	return e1000_calculate_itr_interval_from_usecs(NSEC2USEC(period->tv_nsec));
-}
-
-/** Set polling mode
- *
- * @param device  Device to set
- * @param mode    Mode to set
- * @param period  Period for NIC_POLL_PERIODIC
- *
- * @return EOK if succeed
- * @return ENOTSUP if the mode is not supported
- *
- */
-static errno_t e1000_poll_mode_change(nic_t *nic, nic_poll_mode_t mode,
-    const struct timespec *period)
-{
-	assert(nic);
-
-	e1000_t *e1000 = nic_get_specific(nic);
-	assert(e1000);
-
-	switch (mode) {
-	case NIC_POLL_IMMEDIATE:
-		E1000_REG_WRITE(e1000, E1000_ITR, 0);
-		e1000_enable_interrupts(e1000);
-		break;
-	case NIC_POLL_ON_DEMAND:
-		e1000_disable_interrupts(e1000);
-		break;
-	case NIC_POLL_PERIODIC:
-		assert(period);
-		uint16_t itr_interval = e1000_calculate_itr_interval(period);
-		E1000_REG_WRITE(e1000, E1000_ITR, (uint32_t) itr_interval);
-		e1000_enable_interrupts(e1000);
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/** Initialize receive registers
- *
- * @param e1000 E1000 data structure
- *
- */
-static void e1000_initialize_rx_registers(e1000_t *e1000)
-{
-	E1000_REG_WRITE(e1000, E1000_RDLEN, E1000_RX_FRAME_COUNT * 16);
-	E1000_REG_WRITE(e1000, E1000_RDH, 0);
-
-	/* It is not posible to let HW use all descriptors */
-	E1000_REG_WRITE(e1000, E1000_RDT, E1000_RX_FRAME_COUNT - 1);
-
-	/* Set Broadcast Enable Bit */
-	E1000_REG_WRITE(e1000, E1000_RCTL, RCTL_BAM);
-}
-
-/** Initialize receive structure
- *
- * @param nic NIC data
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_initialize_rx_structure(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	e1000->rx_ring_virt = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(
-	    E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t),
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &e1000->rx_ring_phys, &e1000->rx_ring_virt);
-	if (rc != EOK)
-		return rc;
-
-	E1000_REG_WRITE(e1000, E1000_RDBAH,
-	    (uint32_t) (PTR_TO_U64(e1000->rx_ring_phys) >> 32));
-	E1000_REG_WRITE(e1000, E1000_RDBAL,
-	    (uint32_t) PTR_TO_U64(e1000->rx_ring_phys));
-
-	e1000->rx_frame_phys = (uintptr_t *)
-	    calloc(E1000_RX_FRAME_COUNT, sizeof(uintptr_t));
-	e1000->rx_frame_virt =
-	    calloc(E1000_RX_FRAME_COUNT, sizeof(void *));
-	if ((e1000->rx_frame_phys == NULL) || (e1000->rx_frame_virt == NULL)) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++) {
-		uintptr_t frame_phys;
-		void *frame_virt = AS_AREA_ANY;
-
-		rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE,
-		    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-		    &frame_phys, &frame_virt);
-		if (rc != EOK)
-			goto error;
-
-		e1000->rx_frame_phys[i] = frame_phys;
-		e1000->rx_frame_virt[i] = frame_virt;
-	}
-
-	/* Write descriptor */
-	for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++)
-		e1000_fill_new_rx_descriptor(nic, i);
-
-	e1000_initialize_rx_registers(e1000);
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return EOK;
-
-error:
-	for (size_t i = 0; i < E1000_RX_FRAME_COUNT; i++) {
-		if (e1000->rx_frame_virt[i] != NULL) {
-			dmamem_unmap_anonymous(e1000->rx_frame_virt[i]);
-			e1000->rx_frame_phys[i] = 0;
-			e1000->rx_frame_virt[i] = NULL;
-		}
-	}
-
-	if (e1000->rx_frame_phys != NULL) {
-		free(e1000->rx_frame_phys);
-		e1000->rx_frame_phys = NULL;
-	}
-
-	if (e1000->rx_frame_virt != NULL) {
-		free(e1000->rx_frame_virt);
-		e1000->rx_frame_virt = NULL;
-	}
-
-	return rc;
-}
-
-/** Uninitialize receive structure
- *
- * @param nic NIC data
- *
- */
-static void e1000_uninitialize_rx_structure(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	/* Write descriptor */
-	for (unsigned int offset = 0; offset < E1000_RX_FRAME_COUNT; offset++) {
-		dmamem_unmap_anonymous(e1000->rx_frame_virt[offset]);
-		e1000->rx_frame_phys[offset] = 0;
-		e1000->rx_frame_virt[offset] = NULL;
-	}
-
-	free(e1000->rx_frame_virt);
-
-	e1000->rx_frame_phys = NULL;
-	e1000->rx_frame_virt = NULL;
-
-	dmamem_unmap_anonymous(e1000->rx_ring_virt);
-}
-
-/** Clear receive descriptor ring
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_clear_rx_ring(e1000_t *e1000)
-{
-	/* Write descriptor */
-	for (unsigned int offset = 0;
-	    offset < E1000_RX_FRAME_COUNT;
-	    offset++)
-		e1000_clear_rx_descriptor(e1000, offset);
-}
-
-/** Initialize filters
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_initialize_filters(e1000_t *e1000)
-{
-	/* Initialize address filter */
-	e1000->unicast_ra_count = 0;
-	e1000->multicast_ra_count = 0;
-	e1000_clear_unicast_receive_addresses(e1000);
-}
-
-/** Initialize VLAN
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_initialize_vlan(e1000_t *e1000)
-{
-	e1000->vlan_tag_add = false;
-}
-
-/** Fill MAC address from EEPROM to RA[0] register
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_fill_mac_from_eeprom(e1000_t *e1000)
-{
-	/* MAC address from eeprom to RA[0] */
-	nic_address_t address;
-	e1000_eeprom_get_address(e1000, &address);
-	e1000_write_receive_address(e1000, 0, &address, true);
-}
-
-/** Initialize other registers
- *
- * @param dev E1000 data.
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static void e1000_initialize_registers(e1000_t *e1000)
-{
-	E1000_REG_WRITE(e1000, E1000_ITR,
-	    e1000_calculate_itr_interval_from_usecs(
-	    E1000_DEFAULT_INTERRUPT_INTERVAL_USEC));
-	E1000_REG_WRITE(e1000, E1000_FCAH, 0);
-	E1000_REG_WRITE(e1000, E1000_FCAL, 0);
-	E1000_REG_WRITE(e1000, E1000_FCT, 0);
-	E1000_REG_WRITE(e1000, E1000_FCTTV, 0);
-	E1000_REG_WRITE(e1000, E1000_VET, VET_VALUE);
-	E1000_REG_WRITE(e1000, E1000_CTRL, CTRL_ASDE);
-}
-
-/** Initialize transmit registers
- *
- * @param e1000 E1000 data.
- *
- */
-static void e1000_initialize_tx_registers(e1000_t *e1000)
-{
-	E1000_REG_WRITE(e1000, E1000_TDLEN, E1000_TX_FRAME_COUNT * 16);
-	E1000_REG_WRITE(e1000, E1000_TDH, 0);
-	E1000_REG_WRITE(e1000, E1000_TDT, 0);
-
-	E1000_REG_WRITE(e1000, E1000_TIPG,
-	    10 << TIPG_IPGT_SHIFT |
-	    8 << TIPG_IPGR1_SHIFT |
-	    6 << TIPG_IPGR2_SHIFT);
-
-	E1000_REG_WRITE(e1000, E1000_TCTL,
-	    0x0F << TCTL_CT_SHIFT /* Collision Threshold */ |
-	    0x40 << TCTL_COLD_SHIFT /* Collision Distance */ |
-	    TCTL_PSP /* Pad Short Packets */);
-}
-
-/** Initialize transmit structure
- *
- * @param e1000 E1000 data.
- *
- */
-static errno_t e1000_initialize_tx_structure(e1000_t *e1000)
-{
-	size_t i;
-
-	fibril_mutex_lock(&e1000->tx_lock);
-
-	e1000->tx_ring_phys = 0;
-	e1000->tx_ring_virt = AS_AREA_ANY;
-
-	e1000->tx_frame_phys = NULL;
-	e1000->tx_frame_virt = NULL;
-
-	errno_t rc = dmamem_map_anonymous(
-	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t),
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &e1000->tx_ring_phys, &e1000->tx_ring_virt);
-	if (rc != EOK)
-		goto error;
-
-	memset(e1000->tx_ring_virt, 0,
-	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t));
-
-	e1000->tx_frame_phys = (uintptr_t *)
-	    calloc(E1000_TX_FRAME_COUNT, sizeof(uintptr_t));
-	e1000->tx_frame_virt =
-	    calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
-
-	if ((e1000->tx_frame_phys == NULL) || (e1000->tx_frame_virt == NULL)) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
-		e1000->tx_frame_virt[i] = AS_AREA_ANY;
-		rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE,
-		    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE,
-		    0, &e1000->tx_frame_phys[i], &e1000->tx_frame_virt[i]);
-		if (rc != EOK)
-			goto error;
-	}
-
-	E1000_REG_WRITE(e1000, E1000_TDBAH,
-	    (uint32_t) (PTR_TO_U64(e1000->tx_ring_phys) >> 32));
-	E1000_REG_WRITE(e1000, E1000_TDBAL,
-	    (uint32_t) PTR_TO_U64(e1000->tx_ring_phys));
-
-	e1000_initialize_tx_registers(e1000);
-
-	fibril_mutex_unlock(&e1000->tx_lock);
-	return EOK;
-
-error:
-	if (e1000->tx_ring_virt != NULL) {
-		dmamem_unmap_anonymous(e1000->tx_ring_virt);
-		e1000->tx_ring_virt = NULL;
-	}
-
-	if ((e1000->tx_frame_phys != NULL) && (e1000->tx_frame_virt != NULL)) {
-		for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
-			if (e1000->tx_frame_virt[i] != NULL) {
-				dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
-				e1000->tx_frame_phys[i] = 0;
-				e1000->tx_frame_virt[i] = NULL;
-			}
-		}
-	}
-
-	if (e1000->tx_frame_phys != NULL) {
-		free(e1000->tx_frame_phys);
-		e1000->tx_frame_phys = NULL;
-	}
-
-	if (e1000->tx_frame_virt != NULL) {
-		free(e1000->tx_frame_virt);
-		e1000->tx_frame_virt = NULL;
-	}
-
-	return rc;
-}
-
-/** Uninitialize transmit structure
- *
- * @param nic NIC data
- *
- */
-static void e1000_uninitialize_tx_structure(e1000_t *e1000)
-{
-	size_t i;
-
-	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
-		dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
-		e1000->tx_frame_phys[i] = 0;
-		e1000->tx_frame_virt[i] = NULL;
-	}
-
-	if (e1000->tx_frame_phys != NULL) {
-		free(e1000->tx_frame_phys);
-		e1000->tx_frame_phys = NULL;
-	}
-
-	if (e1000->tx_frame_virt != NULL) {
-		free(e1000->tx_frame_virt);
-		e1000->tx_frame_virt = NULL;
-	}
-
-	dmamem_unmap_anonymous(e1000->tx_ring_virt);
-}
-
-/** Clear transmit descriptor ring
- *
- * @param nic NIC data
- *
- */
-static void e1000_clear_tx_ring(nic_t *nic)
-{
-	/* Write descriptor */
-	for (unsigned int offset = 0;
-	    offset < E1000_TX_FRAME_COUNT;
-	    offset++)
-		e1000_clear_tx_descriptor(nic, offset);
-}
-
-/** Enable transmit
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_enable_tx(e1000_t *e1000)
-{
-	/* Set Transmit Enable Bit */
-	E1000_REG_WRITE(e1000, E1000_TCTL,
-	    E1000_REG_READ(e1000, E1000_TCTL) | (TCTL_EN));
-}
-
-/** Disable transmit
- *
- * @param e1000 E1000 data
- *
- */
-static void e1000_disable_tx(e1000_t *e1000)
-{
-	/* Clear Transmit Enable Bit */
-	E1000_REG_WRITE(e1000, E1000_TCTL,
-	    E1000_REG_READ(e1000, E1000_TCTL) & ~(TCTL_EN));
-}
-
-/** Reset E1000 device
- *
- * @param e1000 The E1000 data
- *
- */
-static errno_t e1000_reset(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	E1000_REG_WRITE(e1000, E1000_CTRL, CTRL_RST);
-
-	/* Wait for the reset */
-	fibril_usleep(20);
-
-	/* check if RST_BIT cleared */
-	if (E1000_REG_READ(e1000, E1000_CTRL) & (CTRL_RST))
-		return EINVAL;
-
-	e1000_initialize_registers(e1000);
-	e1000_initialize_rx_registers(e1000);
-	e1000_initialize_tx_registers(e1000);
-	e1000_fill_mac_from_eeprom(e1000);
-	e1000_initialize_filters(e1000);
-	e1000_initialize_vlan(e1000);
-
-	return EOK;
-}
-
-/** Activate the device to receive and transmit frames
- *
- * @param nic NIC driver data
- *
- * @return EOK if activated successfully
- * @return Error code otherwise
- *
- */
-static errno_t e1000_on_activating(nic_t *nic)
-{
-	assert(nic);
-
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-	fibril_mutex_lock(&e1000->tx_lock);
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	e1000_enable_interrupts(e1000);
-
-	errno_t rc = hw_res_enable_interrupt(e1000->parent_sess, e1000->irq);
-	if (rc != EOK) {
-		e1000_disable_interrupts(e1000);
-		fibril_mutex_unlock(&e1000->ctrl_lock);
-		fibril_mutex_unlock(&e1000->tx_lock);
-		fibril_mutex_unlock(&e1000->rx_lock);
-		return rc;
-	}
-
-	e1000_clear_rx_ring(e1000);
-	e1000_enable_rx(e1000);
-
-	e1000_clear_tx_ring(nic);
-	e1000_enable_tx(e1000);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-	ctrl |= CTRL_SLU;
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-	fibril_mutex_unlock(&e1000->tx_lock);
-	fibril_mutex_unlock(&e1000->rx_lock);
-
-	return EOK;
-}
-
-/** Callback for NIC_STATE_DOWN change
- *
- * @param nic NIC driver data
- *
- * @return EOK if succeed
- * @return Error code otherwise
- *
- */
-static errno_t e1000_on_down_unlocked(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	uint32_t ctrl = E1000_REG_READ(e1000, E1000_CTRL);
-	ctrl &= ~CTRL_SLU;
-	E1000_REG_WRITE(e1000, E1000_CTRL, ctrl);
-
-	e1000_disable_tx(e1000);
-	e1000_disable_rx(e1000);
-
-	hw_res_disable_interrupt(e1000->parent_sess, e1000->irq);
-	e1000_disable_interrupts(e1000);
-
-	/*
-	 * Wait for the for the end of all data
-	 * transfers to descriptors.
-	 */
-	fibril_usleep(100);
-
-	return EOK;
-}
-
-/** Callback for NIC_STATE_DOWN change
- *
- * @param nic NIC driver data
- *
- * @return EOK if succeed
- * @return Error code otherwise
- *
- */
-static errno_t e1000_on_down(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-	fibril_mutex_lock(&e1000->tx_lock);
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	errno_t rc = e1000_on_down_unlocked(nic);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-	fibril_mutex_unlock(&e1000->tx_lock);
-	fibril_mutex_unlock(&e1000->rx_lock);
-
-	return rc;
-}
-
-/** Callback for NIC_STATE_STOPPED change
- *
- * @param nic NIC driver data
- *
- * @return EOK if succeed
- * @return Error code otherwise
- *
- */
-static errno_t e1000_on_stopping(nic_t *nic)
-{
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-	fibril_mutex_lock(&e1000->tx_lock);
-	fibril_mutex_lock(&e1000->ctrl_lock);
-
-	errno_t rc = e1000_on_down_unlocked(nic);
-	if (rc == EOK)
-		rc = e1000_reset(nic);
-
-	fibril_mutex_unlock(&e1000->ctrl_lock);
-	fibril_mutex_unlock(&e1000->tx_lock);
-	fibril_mutex_unlock(&e1000->rx_lock);
-
-	return rc;
-}
-
-/** Create driver data structure
- *
- * @return Intialized device data structure or NULL
- *
- */
-static e1000_t *e1000_create_dev_data(ddf_dev_t *dev)
-{
-	nic_t *nic = nic_create_and_bind(dev);
-	if (!nic)
-		return NULL;
-
-	e1000_t *e1000 = malloc(sizeof(e1000_t));
-	if (!e1000) {
-		nic_unbind_and_destroy(dev);
-		return NULL;
-	}
-
-	memset(e1000, 0, sizeof(e1000_t));
-	e1000->dev = dev;
-
-	nic_set_specific(nic, e1000);
-	nic_set_send_frame_handler(nic, e1000_send_frame);
-	nic_set_state_change_handlers(nic, e1000_on_activating,
-	    e1000_on_down, e1000_on_stopping);
-	nic_set_filtering_change_handlers(nic,
-	    e1000_on_unicast_mode_change, e1000_on_multicast_mode_change,
-	    e1000_on_broadcast_mode_change, NULL, e1000_on_vlan_mask_change);
-	nic_set_poll_handlers(nic, e1000_poll_mode_change, e1000_poll);
-
-	fibril_mutex_initialize(&e1000->ctrl_lock);
-	fibril_mutex_initialize(&e1000->rx_lock);
-	fibril_mutex_initialize(&e1000->tx_lock);
-	fibril_mutex_initialize(&e1000->eeprom_lock);
-
-	return e1000;
-}
-
-/** Delete driver data structure
- *
- * @param data E1000 device data structure
- *
- */
-static void e1000_delete_dev_data(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	if (ddf_dev_data_get(dev) != NULL)
-		nic_unbind_and_destroy(dev);
-}
-
-/** Clean up the E1000 device structure.
- *
- * @param dev Device structure.
- *
- */
-static void e1000_dev_cleanup(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	e1000_delete_dev_data(dev);
-}
-
-/** Fill the irq and io_addr part of device data structure
- *
- * The hw_resources must be obtained before calling this function
- *
- * @param dev          Device structure
- * @param hw_resources Hardware resources obtained from the parent device
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_fill_resource_info(ddf_dev_t *dev,
-    const hw_res_list_parsed_t *hw_resources)
-{
-	e1000_t *e1000 = DRIVER_DATA_DEV(dev);
-
-	if (hw_resources->irqs.count != 1)
-		return EINVAL;
-
-	e1000->irq = hw_resources->irqs.irqs[0];
-	e1000->reg_base_phys =
-	    MEMADDR_TO_PTR(RNGABS(hw_resources->mem_ranges.ranges[0]));
-
-	return EOK;
-}
-
-/** Obtain information about hardware resources of the device
- *
- * The device must be connected to the parent
- *
- * @param dev Device structure
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_get_resource_info(ddf_dev_t *dev)
-{
-	assert(dev != NULL);
-	assert(NIC_DATA_DEV(dev) != NULL);
-
-	hw_res_list_parsed_t hw_res_parsed;
-	hw_res_list_parsed_init(&hw_res_parsed);
-
-	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(NIC_DATA_DEV(dev), &hw_res_parsed);
-	if (rc != EOK)
-		return rc;
-
-	/* Fill resources information to the device */
-	rc = e1000_fill_resource_info(dev, &hw_res_parsed);
-	hw_res_list_parsed_clean(&hw_res_parsed);
-
-	return rc;
-}
-
-/** Initialize the E1000 device structure
- *
- * @param dev Device information
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_device_initialize(ddf_dev_t *dev)
-{
-	/* Allocate driver data for the device. */
-	e1000_t *e1000 = e1000_create_dev_data(dev);
-	if (e1000 == NULL) {
-		ddf_msg(LVL_ERROR, "Unable to allocate device softstate");
-		return ENOMEM;
-	}
-
-	e1000->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (e1000->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed connecting parent device.");
-		return EIO;
-	}
-
-	/* Obtain and fill hardware resources info */
-	errno_t rc = e1000_get_resource_info(dev);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot obtain hardware resources");
-		e1000_dev_cleanup(dev);
-		return rc;
-	}
-
-	uint16_t device_id;
-	rc = pci_config_space_read_16(ddf_dev_parent_sess_get(dev), PCI_DEVICE_ID,
-	    &device_id);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot access PCI configuration space");
-		e1000_dev_cleanup(dev);
-		return rc;
-	}
-
-	e1000_board_t board;
-	switch (device_id) {
-	case 0x100e:
-	case 0x1015:
-	case 0x1016:
-	case 0x1017:
-		board = E1000_82540;
-		break;
-	case 0x1013:
-	case 0x1018:
-	case 0x1078:
-		board = E1000_82541;
-		break;
-	case 0x1076:
-	case 0x1077:
-	case 0x107c:
-		board = E1000_82541REV2;
-		break;
-	case 0x100f:
-	case 0x1011:
-	case 0x1026:
-	case 0x1027:
-	case 0x1028:
-		board = E1000_82545;
-		break;
-	case 0x1010:
-	case 0x1012:
-	case 0x101d:
-	case 0x1079:
-	case 0x107a:
-	case 0x107b:
-		board = E1000_82546;
-		break;
-	case 0x1019:
-	case 0x101a:
-		board = E1000_82547;
-		break;
-	case 0x10b9:
-		board = E1000_82572;
-		break;
-	case 0x1096:
-		board = E1000_80003ES2;
-		break;
-	default:
-		ddf_msg(LVL_ERROR, "Device not supported (%#" PRIx16 ")",
-		    device_id);
-		e1000_dev_cleanup(dev);
-		return ENOTSUP;
-	}
-
-	switch (board) {
-	case E1000_82540:
-	case E1000_82541:
-	case E1000_82541REV2:
-	case E1000_82545:
-	case E1000_82546:
-		e1000->info.eerd_start = 0x01;
-		e1000->info.eerd_done = 0x10;
-		e1000->info.eerd_address_offset = 8;
-		e1000->info.eerd_data_offset = 16;
-		break;
-	case E1000_82547:
-	case E1000_82572:
-	case E1000_80003ES2:
-		e1000->info.eerd_start = 0x01;
-		e1000->info.eerd_done = 0x02;
-		e1000->info.eerd_address_offset = 2;
-		e1000->info.eerd_data_offset = 16;
-		break;
-	}
-
-	return EOK;
-}
-
-/** Enable the I/O ports of the device.
- *
- * @param dev E1000 device.
- *
- * @return EOK if successed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_pio_enable(ddf_dev_t *dev)
-{
-	e1000_t *e1000 = DRIVER_DATA_DEV(dev);
-
-	errno_t rc = pio_enable(e1000->reg_base_phys, 8 * PAGE_SIZE,
-	    &e1000->reg_base_virt);
-	if (rc != EOK)
-		return EADDRNOTAVAIL;
-
-	return EOK;
-}
-
-/** Probe and initialize the newly added device.
- *
- * @param dev E1000 device.
- *
- */
-errno_t e1000_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun;
-
-	/* Initialize device structure for E1000 */
-	errno_t rc = e1000_device_initialize(dev);
-	if (rc != EOK)
-		return rc;
-
-	/* Device initialization */
-	nic_t *nic = ddf_dev_data_get(dev);
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	/* Map registers */
-	rc = e1000_pio_enable(dev);
-	if (rc != EOK)
-		goto err_destroy;
-
-	e1000_initialize_registers(e1000);
-	rc = e1000_initialize_tx_structure(e1000);
-	if (rc != EOK)
-		goto err_pio;
-
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	e1000_fill_mac_from_eeprom(e1000);
-	e1000_initialize_filters(e1000);
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-
-	e1000_initialize_vlan(e1000);
-
-	fun = ddf_fun_create(nic_get_ddf_dev(nic), fun_exposed, "port0");
-	if (fun == NULL)
-		goto err_tx_structure;
-	nic_set_ddf_fun(nic, fun);
-	ddf_fun_set_ops(fun, &e1000_dev_ops);
-
-	cap_irq_handle_t irq_handle;
-	rc = e1000_register_int_handler(nic, &irq_handle);
-	if (rc != EOK) {
-		goto err_fun_create;
-	}
-
-	rc = e1000_initialize_rx_structure(nic);
-	if (rc != EOK)
-		goto err_irq;
-
-	nic_address_t e1000_address;
-	e1000_get_address(e1000, &e1000_address);
-	rc = nic_report_address(nic, &e1000_address);
-	if (rc != EOK)
-		goto err_rx_structure;
-
-	struct timespec period;
-	period.tv_sec = 0;
-	period.tv_nsec = USEC2NSEC(E1000_DEFAULT_INTERRUPT_INTERVAL_USEC);
-	rc = nic_report_poll_mode(nic, NIC_POLL_PERIODIC, &period);
-	if (rc != EOK)
-		goto err_rx_structure;
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK)
-		goto err_fun_bind;
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK)
-		goto err_add_to_cat;
-
-	return EOK;
-
-err_add_to_cat:
-	ddf_fun_unbind(fun);
-err_fun_bind:
-err_rx_structure:
-	e1000_uninitialize_rx_structure(nic);
-err_irq:
-	unregister_interrupt_handler(dev, irq_handle);
-err_fun_create:
-	ddf_fun_destroy(fun);
-	nic_set_ddf_fun(nic, NULL);
-err_tx_structure:
-	e1000_uninitialize_tx_structure(e1000);
-err_pio:
-	// TODO: e1000_pio_disable(dev);
-err_destroy:
-	e1000_dev_cleanup(dev);
-	return rc;
-}
-
-/** Quiesce E1000 device.
- *
- * @param dev E1000 device.
- *
- */
-errno_t e1000_dev_quiesce(ddf_dev_t *dev)
-{
-	nic_t *nic = ddf_dev_data_get(dev);
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "e1000_dev_quiesce()");
-
-	e1000_disable_interrupts(e1000);
-	rc = e1000_reset(nic);
-	if (rc != EOK)
-		ddf_msg(LVL_ERROR, "e1000_dev_quiesce failed");
-	return rc;
-}
-
-/** Read 16-bit value from EEPROM of E1000 adapter
- *
- * Read using the EERD register.
- *
- * @param device         E1000 device
- * @param eeprom_address 8-bit EEPROM address
- *
- * @return 16-bit value from EEPROM
- *
- */
-static uint16_t e1000_eeprom_read(e1000_t *e1000, uint8_t eeprom_address)
-{
-	fibril_mutex_lock(&e1000->eeprom_lock);
-
-	/* Write address and START bit to EERD register */
-	uint32_t write_data = e1000->info.eerd_start |
-	    (((uint32_t) eeprom_address) <<
-	    e1000->info.eerd_address_offset);
-	E1000_REG_WRITE(e1000, E1000_EERD, write_data);
-
-	uint32_t eerd = E1000_REG_READ(e1000, E1000_EERD);
-	while ((eerd & e1000->info.eerd_done) == 0) {
-		fibril_usleep(1);
-		eerd = E1000_REG_READ(e1000, E1000_EERD);
-	}
-
-	fibril_mutex_unlock(&e1000->eeprom_lock);
-
-	return (uint16_t) (eerd >> e1000->info.eerd_data_offset);
-}
-
-/** Get MAC address of the E1000 adapter
- *
- * @param device  E1000 device
- * @param address Place to store the address
- * @param max_len Maximal addresss length to store
- *
- * @return EOK if succeed
- * @return An error code otherwise
- *
- */
-static errno_t e1000_get_address(e1000_t *e1000, nic_address_t *address)
-{
-	fibril_mutex_lock(&e1000->rx_lock);
-
-	uint8_t *mac0_dest = (uint8_t *) address->address;
-	uint8_t *mac1_dest = (uint8_t *) address->address + 1;
-	uint8_t *mac2_dest = (uint8_t *) address->address + 2;
-	uint8_t *mac3_dest = (uint8_t *) address->address + 3;
-	uint8_t *mac4_dest = (uint8_t *) address->address + 4;
-	uint8_t *mac5_dest = (uint8_t *) address->address + 5;
-
-	uint32_t rah = E1000_REG_READ(e1000, E1000_RAH_ARRAY(0));
-	uint32_t ral = E1000_REG_READ(e1000, E1000_RAL_ARRAY(0));
-
-	*mac0_dest = (uint8_t) ral;
-	*mac1_dest = (uint8_t) (ral >> 8);
-	*mac2_dest = (uint8_t) (ral >> 16);
-	*mac3_dest = (uint8_t) (ral >> 24);
-	*mac4_dest = (uint8_t) rah;
-	*mac5_dest = (uint8_t) (rah >> 8);
-
-	fibril_mutex_unlock(&e1000->rx_lock);
-	return EOK;
-}
-
-/** Set card MAC address
- *
- * @param device  E1000 device
- * @param address Address
- *
- * @return EOK if succeed
- * @return An error code otherwise
- */
-static errno_t e1000_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
-{
-	nic_t *nic = NIC_DATA_FUN(fun);
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-
-	fibril_mutex_lock(&e1000->rx_lock);
-	fibril_mutex_lock(&e1000->tx_lock);
-
-	errno_t rc = nic_report_address(nic, addr);
-	if (rc == EOK)
-		e1000_write_receive_address(e1000, 0, addr, false);
-
-	fibril_mutex_unlock(&e1000->tx_lock);
-	fibril_mutex_unlock(&e1000->rx_lock);
-
-	return rc;
-}
-
-static void e1000_eeprom_get_address(e1000_t *e1000,
-    nic_address_t *address)
-{
-	uint16_t *mac0_dest = (uint16_t *) address->address;
-	uint16_t *mac2_dest = (uint16_t *) (address->address + 2);
-	uint16_t *mac4_dest = (uint16_t *) (address->address + 4);
-
-	*mac0_dest = e1000_eeprom_read(e1000, 0);
-	*mac2_dest = e1000_eeprom_read(e1000, 1);
-	*mac4_dest = e1000_eeprom_read(e1000, 2);
-}
-
-/** Send frame
- *
- * @param nic    NIC driver data structure
- * @param data   Frame data
- * @param size   Frame size in bytes
- *
- * @return EOK if succeed
- * @return Error code in the case of error
- *
- */
-static void e1000_send_frame(nic_t *nic, void *data, size_t size)
-{
-	assert(nic);
-
-	e1000_t *e1000 = DRIVER_DATA_NIC(nic);
-	fibril_mutex_lock(&e1000->tx_lock);
-
-	uint32_t tdt = E1000_REG_READ(e1000, E1000_TDT);
-	e1000_tx_descriptor_t *tx_descriptor_addr = (e1000_tx_descriptor_t *)
-	    (e1000->tx_ring_virt + tdt * sizeof(e1000_tx_descriptor_t));
-
-	bool descriptor_available = false;
-
-	/* Descriptor never used */
-	if (tx_descriptor_addr->length == 0)
-		descriptor_available = true;
-
-	/* Descriptor done */
-	if (tx_descriptor_addr->status & TXDESCRIPTOR_STATUS_DD)
-		descriptor_available = true;
-
-	if (!descriptor_available) {
-		/* Frame lost */
-		fibril_mutex_unlock(&e1000->tx_lock);
-		return;
-	}
-
-	memcpy(e1000->tx_frame_virt[tdt], data, size);
-
-	tx_descriptor_addr->phys_addr = PTR_TO_U64(e1000->tx_frame_phys[tdt]);
-	tx_descriptor_addr->length = size;
-
-	/*
-	 * Report status to STATUS.DD (descriptor done),
-	 * add ethernet CRC, end of packet.
-	 */
-	tx_descriptor_addr->command = TXDESCRIPTOR_COMMAND_RS |
-	    TXDESCRIPTOR_COMMAND_IFCS |
-	    TXDESCRIPTOR_COMMAND_EOP;
-
-	tx_descriptor_addr->checksum_offset = 0;
-	tx_descriptor_addr->status = 0;
-	if (e1000->vlan_tag_add) {
-		tx_descriptor_addr->special = e1000->vlan_tag;
-		tx_descriptor_addr->command |= TXDESCRIPTOR_COMMAND_VLE;
-	} else
-		tx_descriptor_addr->special = 0;
-
-	tx_descriptor_addr->checksum_start_field = 0;
-
-	tdt++;
-	if (tdt == E1000_TX_FRAME_COUNT)
-		tdt = 0;
-
-	E1000_REG_WRITE(e1000, E1000_TDT, tdt);
-
-	fibril_mutex_unlock(&e1000->tx_lock);
-}
-
-int main(void)
-{
-	printf("%s: HelenOS E1000 network adapter driver\n", NAME);
-
-	if (nic_driver_init(NAME) != EOK)
-		return 1;
-
-	nic_driver_implement(&e1000_driver_ops, &e1000_dev_ops,
-	    &e1000_nic_iface);
-
-	ddf_log_init(NAME);
-	return ddf_driver_main(&e1000_driver);
-}
Index: pace/drv/nic/e1k/e1k.h
===================================================================
--- uspace/drv/nic/e1k/e1k.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/*
- * Copyright (c) 2011 Zdenek Bouska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file e1k.h
- *
- * Registers, bit positions and masks definition of the E1000 network family
- * cards
- *
- */
-
-#ifndef E1K_H_
-#define E1K_H_
-
-#include <stdint.h>
-
-/** Ethernet CRC size after frame received in rx_descriptor */
-#define E1000_CRC_SIZE  4
-
-#define VET_VALUE  0x8100
-
-#define E1000_RAL_ARRAY(n)   (E1000_RAL + ((n) * 8))
-#define E1000_RAH_ARRAY(n)   (E1000_RAH + ((n) * 8))
-#define E1000_VFTA_ARRAY(n)  (E1000_VFTA + (0x04 * (n)))
-
-/** Receive descriptior */
-typedef struct {
-	/** Buffer Address - physical */
-	uint64_t phys_addr;
-	/** Length is per segment */
-	uint16_t length;
-	/** Checksum - not all types, on some reseved  */
-	uint16_t checksum;
-	/** Status field */
-	uint8_t status;
-	/** Errors field */
-	uint8_t errors;
-	/** Special Field - not all types, on some reseved  */
-	uint16_t special;
-} e1000_rx_descriptor_t;
-
-/** Legacy transmit descriptior */
-typedef struct {
-	/** Buffer Address - physical */
-	uint64_t phys_addr;
-	/** Length is per segment */
-	uint16_t length;
-	/** Checksum Offset */
-	uint8_t checksum_offset;
-	/** Command field */
-	uint8_t command;
-	/** Status field, upper bits are reserved */
-	uint8_t status;
-	/** Checksum Start Field */
-	uint8_t checksum_start_field;
-	/** Special Field */
-	uint16_t special;
-} e1000_tx_descriptor_t;
-
-/** E1000 boards */
-typedef enum {
-	E1000_82540,
-	E1000_82541,
-	E1000_82541REV2,
-	E1000_82545,
-	E1000_82546,
-	E1000_82547,
-	E1000_82572,
-	E1000_80003ES2
-} e1000_board_t;
-
-typedef struct {
-	uint32_t eerd_start;
-	uint32_t eerd_done;
-
-	uint32_t eerd_address_offset;
-	uint32_t eerd_data_offset;
-} e1000_info_t;
-
-/** VLAN tag bits */
-typedef enum {
-	VLANTAG_CFI = (1 << 12),  /**< Canonical Form Indicator */
-} e1000_vlantag_t;
-
-/** Transmit descriptor COMMAND field bits */
-typedef enum {
-	TXDESCRIPTOR_COMMAND_VLE = (1 << 6),   /**< VLAN frame Enable */
-	TXDESCRIPTOR_COMMAND_RS = (1 << 3),    /**< Report Status */
-	TXDESCRIPTOR_COMMAND_IFCS = (1 << 1),  /**< Insert FCS */
-	TXDESCRIPTOR_COMMAND_EOP = (1 << 0)    /**< End Of Packet */
-} e1000_txdescriptor_command_t;
-
-/** Transmit descriptor STATUS field bits */
-typedef enum {
-	TXDESCRIPTOR_STATUS_DD = (1 << 0)  /**< Descriptor Done */
-} e1000_txdescriptor_status_t;
-
-/** E1000 Registers */
-typedef enum {
-	E1000_CTRL = 0x0,      /**< Device Control Register */
-	E1000_STATUS = 0x8,    /**< Device Status Register */
-	E1000_EERD = 0x14,     /**< EEPROM Read Register */
-	E1000_TCTL = 0x400,    /**< Transmit Control Register */
-	E1000_TIPG = 0x410,    /**< Transmit IPG Register */
-	E1000_TDBAL = 0x3800,  /**< Transmit Descriptor Base Address Low */
-	E1000_TDBAH = 0x3804,  /**< Transmit Descriptor Base Address High */
-	E1000_TDLEN = 0x3808,  /**< Transmit Descriptor Length */
-	E1000_TDH = 0x3810,    /**< Transmit Descriptor Head */
-	E1000_TDT = 0x3818,    /**< Transmit Descriptor Tail */
-	E1000_RCTL = 0x100,    /**< Receive Control Register */
-	E1000_RDBAL = 0x2800,  /**< Receive Descriptor Base Address Low */
-	E1000_RDBAH = 0x2804,  /**< Receive Descriptor Base Address High */
-	E1000_RDLEN = 0x2808,  /**< Receive Descriptor Length */
-	E1000_RDH = 0x2810,    /**< Receive Descriptor Head */
-	E1000_RDT = 0x2818,    /**< Receive Descriptor Tail */
-	E1000_RAL = 0x5400,    /**< Receive Address Low */
-	E1000_RAH = 0x5404,    /**< Receive Address High */
-	E1000_VFTA = 0x5600,   /**< VLAN Filter Table Array */
-	E1000_VET = 0x38,      /**< VLAN Ether Type */
-	E1000_FCAL = 0x28,     /**< Flow Control Address Low */
-	E1000_FCAH = 0x2C,     /**< Flow Control Address High */
-	E1000_FCTTV = 0x170,   /**< Flow Control Transmit Timer Value */
-	E1000_FCT = 0x30,      /**< Flow Control Type */
-	E1000_ICR = 0xC0,      /**< Interrupt Cause Read Register */
-	E1000_ITR = 0xC4,      /**< Interrupt Throttling Register */
-	E1000_IMS = 0xD0,      /**< Interrupt Mask Set/Read Register */
-	E1000_IMC = 0xD8       /**< Interrupt Mask Clear Register */
-} e1000_registers_t;
-
-/** Device Control Register fields */
-typedef enum {
-	CTRL_FD = (1 << 0),    /**< Full-Duplex */
-	CTRL_LRST = (1 << 3),  /**< Link Reset */
-	CTRL_ASDE = (1 << 5),  /**< Auto-Speed Detection Enable */
-	CTRL_SLU = (1 << 6),   /**< Set Link Up */
-	CTRL_ILOS = (1 << 7),  /**< Invert Loss-of-Signal */
-
-	/** Speed selection shift */
-	CTRL_SPEED_SHIFT = 8,
-	/** Speed selection size */
-	CTRL_SPEED_SIZE = 2,
-	/** Speed selection all bit set value */
-	CTRL_SPEED_ALL = ((1 << CTRL_SPEED_SIZE) - 1),
-	/** Speed selection shift */
-	CTRL_SPEED_MASK = CTRL_SPEED_ALL << CTRL_SPEED_SHIFT,
-	/** Speed selection 10 Mb/s value */
-	CTRL_SPEED_10 = 0,
-	/** Speed selection 10 Mb/s value */
-	CTRL_SPEED_100 = 1,
-	/** Speed selection 10 Mb/s value */
-	CTRL_SPEED_1000 = 2,
-
-	CTRL_FRCSPD = (1 << 11),   /**< Force Speed */
-	CTRL_FRCDPLX = (1 << 12),  /**< Force Duplex */
-	CTRL_RST = (1 << 26),      /**< Device Reset */
-	CTRL_VME = (1 << 30),      /**< VLAN Mode Enable */
-	CTRL_PHY_RST = (1 << 31)   /**< PHY Reset */
-} e1000_ctrl_t;
-
-/** Device Status Register fields */
-typedef enum {
-	STATUS_FD = (1 << 0),  /**< Link Full Duplex configuration Indication */
-	STATUS_LU = (1 << 1),  /**< Link Up Indication */
-
-	/** Link speed setting shift */
-	STATUS_SPEED_SHIFT = 6,
-	/** Link speed setting size */
-	STATUS_SPEED_SIZE = 2,
-	/** Link speed setting all bits set */
-	STATUS_SPEED_ALL = ((1 << STATUS_SPEED_SIZE) - 1),
-	/** Link speed setting 10 Mb/s value */
-	STATUS_SPEED_10 = 0,
-	/** Link speed setting 100 Mb/s value */
-	STATUS_SPEED_100 = 1,
-	/** Link speed setting 1000 Mb/s value variant A */
-	STATUS_SPEED_1000A = 2,
-	/** Link speed setting 1000 Mb/s value variant B */
-	STATUS_SPEED_1000B = 3,
-} e1000_status_t;
-
-/** Transmit IPG Register fields
- *
- * IPG = Inter Packet Gap
- *
- */
-typedef enum {
-	TIPG_IPGT_SHIFT = 0,    /**< IPG Transmit Time shift */
-	TIPG_IPGR1_SHIFT = 10,  /**< IPG Receive Time 1 */
-	TIPG_IPGR2_SHIFT = 20   /**< IPG Receive Time 2 */
-} e1000_tipg_t;
-
-/** Transmit Control Register fields */
-typedef enum {
-	TCTL_EN = (1 << 1),    /**< Transmit Enable */
-	TCTL_PSP =  (1 << 3),  /**< Pad Short Packets */
-	TCTL_CT_SHIFT = 4,     /**< Collision Threshold shift */
-	TCTL_COLD_SHIFT = 12   /**< Collision Distance shift */
-} e1000_tctl_t;
-
-/** ICR register fields */
-typedef enum {
-	ICR_TXDW = (1 << 0),  /**< Transmit Descriptor Written Back */
-	ICR_RXT0 = (1 << 7)   /**< Receiver Timer Interrupt */
-} e1000_icr_t;
-
-/** RAH register fields */
-typedef enum {
-	RAH_AV = (1 << 31)   /**< Address Valid */
-} e1000_rah_t;
-
-/** RCTL register fields */
-typedef enum {
-	RCTL_EN = (1 << 1),    /**< Receiver Enable */
-	RCTL_SBP = (1 << 2),   /**< Store Bad Packets */
-	RCTL_UPE = (1 << 3),   /**< Unicast Promiscuous Enabled */
-	RCTL_MPE = (1 << 4),   /**< Multicast Promiscuous Enabled */
-	RCTL_BAM = (1 << 15),  /**< Broadcast Accept Mode */
-	RCTL_VFE = (1 << 18)   /**< VLAN Filter Enable */
-} e1000_rctl_t;
-
-#endif
Index: pace/drv/nic/e1k/e1k.ma
===================================================================
--- uspace/drv/nic/e1k/e1k.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,25 +1,0 @@
-10 pci/ven=8086&dev=100e
-10 pci/ven=8086&dev=100f
-10 pci/ven=8086&dev=1010
-10 pci/ven=8086&dev=1011
-10 pci/ven=8086&dev=1012
-10 pci/ven=8086&dev=1013
-10 pci/ven=8086&dev=1015
-10 pci/ven=8086&dev=1016
-10 pci/ven=8086&dev=1017
-10 pci/ven=8086&dev=1018
-10 pci/ven=8086&dev=1019
-10 pci/ven=8086&dev=101a
-10 pci/ven=8086&dev=101d
-10 pci/ven=8086&dev=1026
-10 pci/ven=8086&dev=1027
-10 pci/ven=8086&dev=1028
-10 pci/ven=8086&dev=1076
-10 pci/ven=8086&dev=1077
-10 pci/ven=8086&dev=1078
-10 pci/ven=8086&dev=1079
-10 pci/ven=8086&dev=107a
-10 pci/ven=8086&dev=107b
-10 pci/ven=8086&dev=107c
-10 pci/ven=8086&dev=1096
-10 pci/ven=8086&dev=10b9
Index: pace/drv/nic/e1k/meson.build
===================================================================
--- uspace/drv/nic/e1k/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nic' ]
-src = files('e1k.c')
Index: pace/drv/nic/ne2k/doc/doxygroups.h
===================================================================
--- uspace/drv/nic/ne2k/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup drv_ne2k ne2k
- * @brief Novell NE2000 NIC driver
- * @ingroup drvs
- */
Index: pace/drv/nic/ne2k/dp8390.c
===================================================================
--- uspace/drv/nic/ne2k/dp8390.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,684 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2009 Lukas Mejdrech
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This code is based upon the NE2000 driver for MINIX,
- * distributed according to a BSD-style license.
- *
- * Copyright (c) 1987, 1997, 2006 Vrije Universiteit
- * Copyright (c) 1992, 1994 Philip Homburg
- * Copyright (c) 1996 G. Falzoni
- *
- */
-
-/**
- * @addtogroup drv_ne2k
- * @{
- */
-
-/**
- * @file
- * @brief NE2000 driver core
- *
- * NE2000 (based on DP8390) network interface core implementation.
- * Only the basic NE2000 PIO (ISA) interface is supported, remote
- * DMA is completely absent from this code for simplicity.
- *
- */
-
-#include <assert.h>
-#include <async.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <stdio.h>
-#include <ddi.h>
-#include "dp8390.h"
-
-/** Page size */
-#define DP_PAGE  256
-
-/** 6 * DP_PAGE >= 1514 bytes */
-#define SQ_PAGES  6
-
-/** Type definition of the receive header
- *
- */
-typedef struct {
-	/** Copy of RSR */
-	uint8_t status;
-
-	/** Pointer to next frame */
-	uint8_t next;
-
-	/** Receive Byte Count Low */
-	uint8_t rbcl;
-
-	/** Receive Byte Count High */
-	uint8_t rbch;
-} recv_header_t;
-
-/** Read a memory block word by word.
- *
- * @param[in]  port Source address.
- * @param[out] buf  Destination buffer.
- * @param[in]  size Memory block size in bytes.
- *
- */
-static void pio_read_buf_16(void *port, void *buf, size_t size)
-{
-	size_t i;
-
-	for (i = 0; (i << 1) < size; i++)
-		*((uint16_t *) buf + i) = pio_read_16((ioport16_t *) (port));
-}
-
-/** Write a memory block word by word.
- *
- * @param[in] port Destination address.
- * @param[in] buf  Source buffer.
- * @param[in] size Memory block size in bytes.
- *
- */
-static void pio_write_buf_16(void *port, void *buf, size_t size)
-{
-	size_t i;
-
-	for (i = 0; (i << 1) < size; i++)
-		pio_write_16((ioport16_t *) port, *((uint16_t *) buf + i));
-}
-
-static void ne2k_download(ne2k_t *ne2k, void *buf, size_t addr, size_t size)
-{
-	size_t esize = size & ~1;
-
-	pio_write_8(ne2k->port + DP_RBCR0, esize & 0xff);
-	pio_write_8(ne2k->port + DP_RBCR1, (esize >> 8) & 0xff);
-	pio_write_8(ne2k->port + DP_RSAR0, addr & 0xff);
-	pio_write_8(ne2k->port + DP_RSAR1, (addr >> 8) & 0xff);
-	pio_write_8(ne2k->port + DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	if (esize != 0) {
-		pio_read_buf_16(ne2k->data_port, buf, esize);
-		size -= esize;
-		buf += esize;
-	}
-
-	if (size) {
-		assert(size == 1);
-
-		uint16_t word = pio_read_16(ne2k->data_port);
-		memcpy(buf, &word, 1);
-	}
-}
-
-static void ne2k_upload(ne2k_t *ne2k, void *buf, size_t addr, size_t size)
-{
-	size_t esize_ru = (size + 1) & ~1;
-	size_t esize = size & ~1;
-
-	pio_write_8(ne2k->port + DP_RBCR0, esize_ru & 0xff);
-	pio_write_8(ne2k->port + DP_RBCR1, (esize_ru >> 8) & 0xff);
-	pio_write_8(ne2k->port + DP_RSAR0, addr & 0xff);
-	pio_write_8(ne2k->port + DP_RSAR1, (addr >> 8) & 0xff);
-	pio_write_8(ne2k->port + DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	if (esize != 0) {
-		pio_write_buf_16(ne2k->data_port, buf, esize);
-		size -= esize;
-		buf += esize;
-	}
-
-	if (size) {
-		assert(size == 1);
-
-		uint16_t word = 0;
-
-		memcpy(&word, buf, 1);
-		pio_write_16(ne2k->data_port, word);
-	}
-}
-
-static void ne2k_init(ne2k_t *ne2k)
-{
-	unsigned int i;
-
-	/* Reset the ethernet card */
-	uint8_t val = pio_read_8(ne2k->port + NE2K_RESET);
-	fibril_usleep(2000);
-	pio_write_8(ne2k->port + NE2K_RESET, val);
-	fibril_usleep(2000);
-
-	/* Reset the DP8390 */
-	pio_write_8(ne2k->port + DP_CR, CR_STP | CR_DM_ABORT);
-	for (i = 0; i < NE2K_RETRY; i++) {
-		if (pio_read_8(ne2k->port + DP_ISR) != 0)
-			break;
-	}
-}
-
-/** Quiesce NE2000.
- *
- * @param ne2k NE2000
- */
-void ne2k_quiesce(ne2k_t *ne2k)
-{
-	ne2k_init(ne2k);
-}
-
-/** Probe and initialize the network interface.
- *
- * @param[in,out] ne2k Network interface structure.
- * @param[in]     port Device address.
- * @param[in]     irq  Device interrupt vector.
- *
- * @return EOK on success.
- * @return EXDEV if the network interface was not recognized.
- *
- */
-errno_t ne2k_probe(ne2k_t *ne2k)
-{
-	unsigned int i;
-
-	ne2k_init(ne2k);
-
-	/* Check if the DP8390 is really there */
-	uint8_t val = pio_read_8(ne2k->port + DP_CR);
-	if ((val & (CR_STP | CR_TXP | CR_DM_ABORT)) != (CR_STP | CR_DM_ABORT))
-		return EXDEV;
-
-	/* Disable the receiver and init TCR and DCR */
-	pio_write_8(ne2k->port + DP_RCR, RCR_MON);
-	pio_write_8(ne2k->port + DP_TCR, TCR_NORMAL);
-	pio_write_8(ne2k->port + DP_DCR, DCR_WORDWIDE | DCR_8BYTES | DCR_BMS);
-
-	/* Setup a transfer to get the MAC address */
-	pio_write_8(ne2k->port + DP_RBCR0, ETH_ADDR << 1);
-	pio_write_8(ne2k->port + DP_RBCR1, 0);
-	pio_write_8(ne2k->port + DP_RSAR0, 0);
-	pio_write_8(ne2k->port + DP_RSAR1, 0);
-	pio_write_8(ne2k->port + DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-	for (i = 0; i < ETH_ADDR; i++)
-		ne2k->mac.address[i] = pio_read_16(ne2k->data_port);
-
-	return EOK;
-}
-
-void ne2k_set_physical_address(ne2k_t *ne2k, const nic_address_t *address)
-{
-	memcpy(&ne2k->mac, address, sizeof(nic_address_t));
-
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_DM_ABORT | CR_STP);
-
-	pio_write_8(ne2k->port + DP_RBCR0, ETH_ADDR << 1);
-	pio_write_8(ne2k->port + DP_RBCR1, 0);
-	pio_write_8(ne2k->port + DP_RSAR0, 0);
-	pio_write_8(ne2k->port + DP_RSAR1, 0);
-	pio_write_8(ne2k->port + DP_CR, CR_DM_RW | CR_PS_P0 | CR_STA);
-
-	size_t i;
-	for (i = 0; i < ETH_ADDR; i++)
-		pio_write_16(ne2k->data_port, ne2k->mac.address[i]);
-
-	//pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_DM_ABORT | CR_STA);
-}
-
-/** Start the network interface.
- *
- * @param[in,out] ne2k Network interface structure.
- *
- * @return EOK on success.
- * @return EXDEV if the network interface is disabled.
- *
- */
-errno_t ne2k_up(ne2k_t *ne2k)
-{
-	if (!ne2k->probed)
-		return EXDEV;
-
-	ne2k_init(ne2k);
-
-	/*
-	 * Setup send queue. Use the first
-	 * SQ_PAGES of NE2000 memory for the send
-	 * buffer.
-	 */
-	ne2k->sq.dirty = false;
-	ne2k->sq.page = NE2K_START / DP_PAGE;
-	fibril_mutex_initialize(&ne2k->sq_mutex);
-	fibril_condvar_initialize(&ne2k->sq_cv);
-
-	/*
-	 * Setup receive ring buffer. Use all the rest
-	 * of the NE2000 memory (except the first SQ_PAGES
-	 * reserved for the send buffer) for the receive
-	 * ring buffer.
-	 */
-	ne2k->start_page = ne2k->sq.page + SQ_PAGES;
-	ne2k->stop_page = ne2k->sq.page + NE2K_SIZE / DP_PAGE;
-
-	/*
-	 * Initialization of the DP8390 following the mandatory procedure
-	 * in reference manual ("DP8390D/NS32490D NIC Network Interface
-	 * Controller", National Semiconductor, July 1995, Page 29).
-	 */
-
-	/* Step 1: */
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_STP | CR_DM_ABORT);
-
-	/* Step 2: */
-	pio_write_8(ne2k->port + DP_DCR, DCR_WORDWIDE | DCR_8BYTES | DCR_BMS);
-
-	/* Step 3: */
-	pio_write_8(ne2k->port + DP_RBCR0, 0);
-	pio_write_8(ne2k->port + DP_RBCR1, 0);
-
-	/* Step 4: */
-	pio_write_8(ne2k->port + DP_RCR, ne2k->receive_configuration);
-
-	/* Step 5: */
-	pio_write_8(ne2k->port + DP_TCR, TCR_INTERNAL);
-
-	/* Step 6: */
-	pio_write_8(ne2k->port + DP_BNRY, ne2k->start_page);
-	pio_write_8(ne2k->port + DP_PSTART, ne2k->start_page);
-	pio_write_8(ne2k->port + DP_PSTOP, ne2k->stop_page);
-
-	/* Step 7: */
-	pio_write_8(ne2k->port + DP_ISR, 0xff);
-
-	/* Step 8: */
-	pio_write_8(ne2k->port + DP_IMR,
-	    IMR_PRXE | IMR_PTXE | IMR_RXEE | IMR_TXEE | IMR_OVWE | IMR_CNTE);
-
-	/* Step 9: */
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P1 | CR_DM_ABORT | CR_STP);
-
-	pio_write_8(ne2k->port + DP_PAR0, ne2k->mac.address[0]);
-	pio_write_8(ne2k->port + DP_PAR1, ne2k->mac.address[1]);
-	pio_write_8(ne2k->port + DP_PAR2, ne2k->mac.address[2]);
-	pio_write_8(ne2k->port + DP_PAR3, ne2k->mac.address[3]);
-	pio_write_8(ne2k->port + DP_PAR4, ne2k->mac.address[4]);
-	pio_write_8(ne2k->port + DP_PAR5, ne2k->mac.address[5]);
-
-	pio_write_8(ne2k->port + DP_MAR0, 0);
-	pio_write_8(ne2k->port + DP_MAR1, 0);
-	pio_write_8(ne2k->port + DP_MAR2, 0);
-	pio_write_8(ne2k->port + DP_MAR3, 0);
-	pio_write_8(ne2k->port + DP_MAR4, 0);
-	pio_write_8(ne2k->port + DP_MAR5, 0);
-	pio_write_8(ne2k->port + DP_MAR6, 0);
-	pio_write_8(ne2k->port + DP_MAR7, 0);
-
-	pio_write_8(ne2k->port + DP_CURR, ne2k->start_page + 1);
-
-	/* Step 10: */
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_DM_ABORT | CR_STA);
-
-	/* Step 11: */
-	pio_write_8(ne2k->port + DP_TCR, TCR_NORMAL);
-
-	/* Reset counters by reading */
-	pio_read_8(ne2k->port + DP_CNTR0);
-	pio_read_8(ne2k->port + DP_CNTR1);
-	pio_read_8(ne2k->port + DP_CNTR2);
-
-	/* Finish the initialization */
-	ne2k->up = true;
-	return EOK;
-}
-
-/** Stop the network interface.
- *
- * @param[in,out] ne2k Network interface structure.
- *
- */
-void ne2k_down(ne2k_t *ne2k)
-{
-	if ((ne2k->probed) && (ne2k->up)) {
-		pio_write_8(ne2k->port + DP_CR, CR_STP | CR_DM_ABORT);
-		ne2k_init(ne2k);
-		ne2k->up = false;
-	}
-}
-
-static void ne2k_reset(ne2k_t *ne2k)
-{
-	unsigned int i;
-
-	fibril_mutex_lock(&ne2k->sq_mutex);
-
-	/* Stop the chip */
-	pio_write_8(ne2k->port + DP_CR, CR_STP | CR_DM_ABORT);
-	pio_write_8(ne2k->port + DP_RBCR0, 0);
-	pio_write_8(ne2k->port + DP_RBCR1, 0);
-
-	for (i = 0; i < NE2K_RETRY; i++) {
-		if ((pio_read_8(ne2k->port + DP_ISR) & ISR_RST) != 0)
-			break;
-	}
-
-	pio_write_8(ne2k->port + DP_TCR, TCR_1EXTERNAL | TCR_OFST);
-	pio_write_8(ne2k->port + DP_CR, CR_STA | CR_DM_ABORT);
-	pio_write_8(ne2k->port + DP_TCR, TCR_NORMAL);
-
-	/* Acknowledge the ISR_RDC (remote DMA) interrupt */
-	for (i = 0; i < NE2K_RETRY; i++) {
-		if ((pio_read_8(ne2k->port + DP_ISR) & ISR_RDC) != 0)
-			break;
-	}
-
-	uint8_t val = pio_read_8(ne2k->port + DP_ISR);
-	pio_write_8(ne2k->port + DP_ISR, val & ~ISR_RDC);
-
-	/*
-	 * Reset the transmit ring. If we were transmitting a frame,
-	 * we pretend that the frame is processed. Higher layers will
-	 * retransmit if the frame wasn't actually sent.
-	 */
-	ne2k->sq.dirty = false;
-
-	fibril_mutex_unlock(&ne2k->sq_mutex);
-}
-
-/** Send a frame.
- *
- * @param[in,out] ne2k   Network interface structure.
- * @param[in]     data   Pointer to frame data
- * @param[in]     size   Frame size in bytes
- *
- */
-void ne2k_send(nic_t *nic_data, void *data, size_t size)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	assert(ne2k->probed);
-	assert(ne2k->up);
-
-	fibril_mutex_lock(&ne2k->sq_mutex);
-
-	while (ne2k->sq.dirty) {
-		fibril_condvar_wait(&ne2k->sq_cv, &ne2k->sq_mutex);
-	}
-
-	if ((size < ETH_MIN_PACK_SIZE) || (size > ETH_MAX_PACK_SIZE_TAGGED)) {
-		fibril_mutex_unlock(&ne2k->sq_mutex);
-		return;
-	}
-
-	/* Upload the frame to the ethernet card */
-	ne2k_upload(ne2k, data, ne2k->sq.page * DP_PAGE, size);
-	ne2k->sq.dirty = true;
-	ne2k->sq.size = size;
-
-	/* Initialize the transfer */
-	pio_write_8(ne2k->port + DP_TPSR, ne2k->sq.page);
-	pio_write_8(ne2k->port + DP_TBCR0, size & 0xff);
-	pio_write_8(ne2k->port + DP_TBCR1, (size >> 8) & 0xff);
-	pio_write_8(ne2k->port + DP_CR, CR_TXP | CR_STA);
-	fibril_mutex_unlock(&ne2k->sq_mutex);
-}
-
-static nic_frame_t *ne2k_receive_frame(nic_t *nic_data, uint8_t page,
-    size_t length)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	nic_frame_t *frame = nic_alloc_frame(nic_data, length);
-	if (frame == NULL)
-		return NULL;
-
-	memset(frame->data, 0, length);
-	uint8_t last = page + length / DP_PAGE;
-
-	if (last >= ne2k->stop_page) {
-		size_t left = (ne2k->stop_page - page) * DP_PAGE -
-		    sizeof(recv_header_t);
-		ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
-		    left);
-		ne2k_download(ne2k, frame->data + left, ne2k->start_page * DP_PAGE,
-		    length - left);
-	} else {
-		ne2k_download(ne2k, frame->data, page * DP_PAGE + sizeof(recv_header_t),
-		    length);
-	}
-	return frame;
-}
-
-static void ne2k_receive(nic_t *nic_data)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-	/*
-	 * Allocate memory for the list of received frames.
-	 * If the allocation fails here we still receive the
-	 * frames from the network, but they will be lost.
-	 */
-	nic_frame_list_t *frames = nic_alloc_frame_list();
-	size_t frames_count = 0;
-
-	/*
-	 * We may block sending in this loop - after so many received frames there
-	 * must be some interrupt pending (for the frames not yet downloaded) and
-	 * we will continue in its handler.
-	 */
-	while (frames_count < 16) {
-		//TODO: isn't some locking necessary here?
-		uint8_t boundary = pio_read_8(ne2k->port + DP_BNRY) + 1;
-
-		if (boundary == ne2k->stop_page)
-			boundary = ne2k->start_page;
-
-		pio_write_8(ne2k->port + DP_CR, CR_PS_P1 | CR_STA);
-		uint8_t current = pio_read_8(ne2k->port + DP_CURR);
-		pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_STA);
-		if (current == boundary)
-			/* No more frames to process */
-			break;
-
-		recv_header_t header;
-		size_t size = sizeof(header);
-		size_t offset = boundary * DP_PAGE;
-
-		/* Get the frame header */
-		pio_write_8(ne2k->port + DP_RBCR0, size & 0xff);
-		pio_write_8(ne2k->port + DP_RBCR1, (size >> 8) & 0xff);
-		pio_write_8(ne2k->port + DP_RSAR0, offset & 0xff);
-		pio_write_8(ne2k->port + DP_RSAR1, (offset >> 8) & 0xff);
-		pio_write_8(ne2k->port + DP_CR, CR_DM_RR | CR_PS_P0 | CR_STA);
-
-		pio_read_buf_16(ne2k->data_port, (void *) &header, size);
-
-		size_t length =
-		    (((size_t) header.rbcl) | (((size_t) header.rbch) << 8)) - size;
-		uint8_t next = header.next;
-
-		if ((length < ETH_MIN_PACK_SIZE) ||
-		    (length > ETH_MAX_PACK_SIZE_TAGGED)) {
-			next = current;
-		} else if ((header.next < ne2k->start_page) ||
-		    (header.next > ne2k->stop_page)) {
-			next = current;
-		} else if (header.status & RSR_FO) {
-			/*
-			 * This is very serious, so we issue a warning and
-			 * reset the buffers.
-			 */
-			ne2k->overruns++;
-			next = current;
-		} else if ((header.status & RSR_PRX) && (ne2k->up)) {
-			if (frames != NULL) {
-				nic_frame_t *frame =
-				    ne2k_receive_frame(nic_data, boundary, length);
-				if (frame != NULL) {
-					nic_frame_list_append(frames, frame);
-					frames_count++;
-				} else {
-					break;
-				}
-			} else
-				break;
-		}
-
-		/*
-		 * Update the boundary pointer
-		 * to the value of the page
-		 * prior to the next frame to
-		 * be processed.
-		 */
-		if (next == ne2k->start_page)
-			next = ne2k->stop_page - 1;
-		else
-			next--;
-		pio_write_8(ne2k->port + DP_BNRY, next);
-	}
-	nic_received_frame_list(nic_data, frames);
-}
-
-void ne2k_interrupt(nic_t *nic_data, uint8_t isr, uint8_t tsr)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	if (isr & (ISR_PTX | ISR_TXE)) {
-		if (tsr & TSR_COL) {
-			nic_report_collisions(nic_data,
-			    pio_read_8(ne2k->port + DP_NCR) & 15);
-		}
-
-		if (tsr & TSR_PTX) {
-			// TODO: fix number of sent bytes (but how?)
-			nic_report_send_ok(nic_data, 1, 0);
-		} else if (tsr & TSR_ABT) {
-			nic_report_send_error(nic_data, NIC_SEC_ABORTED, 1);
-		} else if (tsr & TSR_CRS) {
-			nic_report_send_error(nic_data, NIC_SEC_CARRIER_LOST, 1);
-		} else if (tsr & TSR_FU) {
-			ne2k->underruns++;
-			// if (ne2k->underruns < NE2K_ERL) {
-			// }
-		} else if (tsr & TSR_CDH) {
-			nic_report_send_error(nic_data, NIC_SEC_HEARTBEAT, 1);
-			// if (nic_data->stats.send_heartbeat_errors < NE2K_ERL) {
-			// }
-		} else if (tsr & TSR_OWC) {
-			nic_report_send_error(nic_data, NIC_SEC_WINDOW_ERROR, 1);
-		}
-
-		fibril_mutex_lock(&ne2k->sq_mutex);
-		if (ne2k->sq.dirty) {
-			/* Prepare the buffer for next frame */
-			ne2k->sq.dirty = false;
-			ne2k->sq.size = 0;
-
-			/* Signal a next frame to be sent */
-			fibril_condvar_broadcast(&ne2k->sq_cv);
-		} else {
-			ne2k->misses++;
-			// if (ne2k->misses < NE2K_ERL) {
-			// }
-		}
-		fibril_mutex_unlock(&ne2k->sq_mutex);
-	}
-
-	if (isr & ISR_CNT) {
-		unsigned int errors;
-		for (errors = pio_read_8(ne2k->port + DP_CNTR0); errors > 0; --errors)
-			nic_report_receive_error(nic_data, NIC_REC_CRC, 1);
-		for (errors = pio_read_8(ne2k->port + DP_CNTR1); errors > 0; --errors)
-			nic_report_receive_error(nic_data, NIC_REC_FRAME_ALIGNMENT, 1);
-		for (errors = pio_read_8(ne2k->port + DP_CNTR2); errors > 0; --errors)
-			nic_report_receive_error(nic_data, NIC_REC_MISSED, 1);
-	}
-	if (isr & ISR_PRX) {
-		ne2k_receive(nic_data);
-	}
-	if (isr & ISR_RST) {
-		/*
-		 * The chip is stopped, and all arrived
-		 * frames are delivered.
-		 */
-		ne2k_reset(ne2k);
-	}
-
-	/* Unmask interrupts to be processed in the next round */
-	pio_write_8(ne2k->port + DP_IMR,
-	    IMR_PRXE | IMR_PTXE | IMR_RXEE | IMR_TXEE | IMR_OVWE | IMR_CNTE);
-}
-
-void ne2k_set_accept_bcast(ne2k_t *ne2k, int accept)
-{
-	if (accept)
-		ne2k->receive_configuration |= RCR_AB;
-	else
-		ne2k->receive_configuration &= ~RCR_AB;
-
-	pio_write_8(ne2k->port + DP_RCR, ne2k->receive_configuration);
-}
-
-void ne2k_set_accept_mcast(ne2k_t *ne2k, int accept)
-{
-	if (accept)
-		ne2k->receive_configuration |= RCR_AM;
-	else
-		ne2k->receive_configuration &= ~RCR_AM;
-
-	pio_write_8(ne2k->port + DP_RCR, ne2k->receive_configuration);
-}
-
-void ne2k_set_promisc_phys(ne2k_t *ne2k, int promisc)
-{
-	if (promisc)
-		ne2k->receive_configuration |= RCR_PRO;
-	else
-		ne2k->receive_configuration &= ~RCR_PRO;
-
-	pio_write_8(ne2k->port + DP_RCR, ne2k->receive_configuration);
-}
-
-void ne2k_set_mcast_hash(ne2k_t *ne2k, uint64_t hash)
-{
-	/* Select Page 1 and stop all transfers */
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P1 | CR_DM_ABORT | CR_STP);
-
-	pio_write_8(ne2k->port + DP_MAR0, (uint8_t) hash);
-	pio_write_8(ne2k->port + DP_MAR1, (uint8_t) (hash >> 8));
-	pio_write_8(ne2k->port + DP_MAR2, (uint8_t) (hash >> 16));
-	pio_write_8(ne2k->port + DP_MAR3, (uint8_t) (hash >> 24));
-	pio_write_8(ne2k->port + DP_MAR4, (uint8_t) (hash >> 32));
-	pio_write_8(ne2k->port + DP_MAR5, (uint8_t) (hash >> 40));
-	pio_write_8(ne2k->port + DP_MAR6, (uint8_t) (hash >> 48));
-	pio_write_8(ne2k->port + DP_MAR7, (uint8_t) (hash >> 56));
-
-	/* Select Page 0 and resume transfers */
-	pio_write_8(ne2k->port + DP_CR, CR_PS_P0 | CR_DM_ABORT | CR_STA);
-}
-
-/** @}
- */
Index: pace/drv/nic/ne2k/dp8390.h
===================================================================
--- uspace/drv/nic/ne2k/dp8390.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,284 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2009 Lukas Mejdrech
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This code is based upon the NE2000 driver for MINIX,
- * distributed according to a BSD-style license.
- *
- * Copyright (c) 1987, 1997, 2006 Vrije Universiteit
- * Copyright (c) 1992, 1994 Philip Homburg
- * Copyright (c) 1996 G. Falzoni
- *
- */
-
-/** @addtogroup drv_ne2k
- *  @{
- */
-
-/** @file
- *  DP8390 network interface definitions.
- */
-
-#ifndef __NET_NETIF_DP8390_H__
-#define __NET_NETIF_DP8390_H__
-
-#include <async.h>
-#include <ddf/driver.h>
-#include <fibril_synch.h>
-#include <nic.h>
-#include <ddf/interrupt.h>
-
-/** Input/output size */
-#define NE2K_IO_SIZE  0x0020
-
-/* NE2000 implementation. */
-
-/** NE2000 Data Register */
-#define NE2K_DATA  0x0010
-
-/** NE2000 Reset register */
-#define NE2K_RESET  0x001f
-
-/** NE2000 data start */
-#define NE2K_START  0x4000
-
-/** NE2000 data size */
-#define NE2K_SIZE  0x4000
-
-/** NE2000 retry count */
-#define NE2K_RETRY  0x1000
-
-/** NE2000 error messages rate limiting */
-#define NE2K_ERL  10
-
-/** Minimum Ethernet packet size in bytes */
-#define ETH_MIN_PACK_SIZE  60
-
-/** Maximum Ethernet packet size in bytes */
-#define ETH_MAX_PACK_SIZE_TAGGED  1518
-
-/* National Semiconductor DP8390 Network Interface Controller. */
-
-/** Page 0, for reading */
-#define DP_CR     0x00  /**< Command Register */
-#define DP_CLDA0  0x01  /**< Current Local DMA Address 0 */
-#define DP_CLDA1  0x02  /**< Current Local DMA Address 1 */
-#define DP_BNRY   0x03  /**< Boundary Pointer */
-#define DP_TSR    0x04  /**< Transmit Status Register */
-#define DP_NCR    0x05  /**< Number of Collisions Register */
-#define DP_FIFO   0x06  /**< FIFO */
-#define DP_ISR    0x07  /**< Interrupt Status Register */
-#define DP_CRDA0  0x08  /**< Current Remote DMA Address 0 */
-#define DP_CRDA1  0x09  /**< Current Remote DMA Address 1 */
-#define DP_RSR    0x0c  /**< Receive Status Register */
-#define DP_CNTR0  0x0d  /**< Tally Counter 0 */
-#define DP_CNTR1  0x0e  /**< Tally Counter 1 */
-#define DP_CNTR2  0x0f  /**< Tally Counter 2 */
-
-/** Page 0, for writing */
-#define DP_PSTART  0x01  /**< Page Start Register*/
-#define DP_PSTOP   0x02  /**< Page Stop Register */
-#define DP_TPSR    0x04  /**< Transmit Page Start Register */
-#define DP_TBCR0   0x05  /**< Transmit Byte Count Register 0 */
-#define DP_TBCR1   0x06  /**< Transmit Byte Count Register 1 */
-#define DP_RSAR0   0x08  /**< Remote Start Address Register 0 */
-#define DP_RSAR1   0x09  /**< Remote Start Address Register 1 */
-#define DP_RBCR0   0x0a  /**< Remote Byte Count Register 0 */
-#define DP_RBCR1   0x0b  /**< Remote Byte Count Register 1 */
-#define DP_RCR     0x0c  /**< Receive Configuration Register */
-#define DP_TCR     0x0d  /**< Transmit Configuration Register */
-#define DP_DCR     0x0e  /**< Data Configuration Register */
-#define DP_IMR     0x0f  /**< Interrupt Mask Register */
-
-/** Page 1, read/write */
-#define DP_PAR0  0x01  /**< Physical Address Register 0 */
-#define DP_PAR1  0x02  /**< Physical Address Register 1 */
-#define DP_PAR2  0x03  /**< Physical Address Register 2 */
-#define DP_PAR3  0x04  /**< Physical Address Register 3 */
-#define DP_PAR4  0x05  /**< Physical Address Register 4 */
-#define DP_PAR5  0x06  /**< Physical Address Register 5 */
-#define DP_CURR  0x07  /**< Current Page Register */
-#define DP_MAR0  0x08  /**< Multicast Address Register 0 */
-#define DP_MAR1  0x09  /**< Multicast Address Register 1 */
-#define DP_MAR2  0x0a  /**< Multicast Address Register 2 */
-#define DP_MAR3  0x0b  /**< Multicast Address Register 3 */
-#define DP_MAR4  0x0c  /**< Multicast Address Register 4 */
-#define DP_MAR5  0x0d  /**< Multicast Address Register 5 */
-#define DP_MAR6  0x0e  /**< Multicast Address Register 6 */
-#define DP_MAR7  0x0f  /**< Multicast Address Register 7 */
-
-/* Bits in Command Register */
-#define CR_STP       0x01  /**< Stop (software reset) */
-#define CR_STA       0x02  /**< Start (activate NIC) */
-#define CR_TXP       0x04  /**< Transmit Packet */
-#define CR_DMA       0x38  /**< Mask for DMA control */
-#define CR_DM_NOP    0x00  /**< DMA: No Operation */
-#define CR_DM_RR     0x08  /**< DMA: Remote Read */
-#define CR_DM_RW     0x10  /**< DMA: Remote Write */
-#define CR_DM_SP     0x18  /**< DMA: Send Packet */
-#define CR_DM_ABORT  0x20  /**< DMA: Abort Remote DMA Operation */
-#define CR_PS        0xc0  /**< Mask for Page Select */
-#define CR_PS_P0     0x00  /**< Register Page 0 */
-#define CR_PS_P1     0x40  /**< Register Page 1 */
-#define CR_PS_P2     0x80  /**< Register Page 2 */
-#define CR_PS_T1     0xc0  /**< Test Mode Register Map */
-
-/* Bits in Interrupt State Register */
-#define ISR_PRX  0x01  /**< Packet Received with no errors */
-#define ISR_PTX  0x02  /**< Packet Transmitted with no errors */
-#define ISR_RXE  0x04  /**< Receive Error */
-#define ISR_TXE  0x08  /**< Transmit Error */
-#define ISR_OVW  0x10  /**< Overwrite Warning */
-#define ISR_CNT  0x20  /**< Counter Overflow */
-#define ISR_RDC  0x40  /**< Remote DMA Complete */
-#define ISR_RST  0x80  /**< Reset Status */
-
-/* Bits in Interrupt Mask Register */
-#define IMR_PRXE  0x01  /**< Packet Received Interrupt Enable */
-#define IMR_PTXE  0x02  /**< Packet Transmitted Interrupt Enable */
-#define IMR_RXEE  0x04  /**< Receive Error Interrupt Enable */
-#define IMR_TXEE  0x08  /**< Transmit Error Interrupt Enable */
-#define IMR_OVWE  0x10  /**< Overwrite Warning Interrupt Enable */
-#define IMR_CNTE  0x20  /**< Counter Overflow Interrupt Enable */
-#define IMR_RDCE  0x40  /**< DMA Complete Interrupt Enable */
-
-/* Bits in Data Configuration Register */
-#define DCR_WTS        0x01  /**< Word Transfer Select */
-#define DCR_BYTEWIDE   0x00  /**< WTS: byte wide transfers */
-#define DCR_WORDWIDE   0x01  /**< WTS: word wide transfers */
-#define DCR_BOS        0x02  /**< Byte Order Select */
-#define DCR_LTLENDIAN  0x00  /**< BOS: Little Endian */
-#define DCR_BIGENDIAN  0x02  /**< BOS: Big Endian */
-#define DCR_LAS        0x04  /**< Long Address Select */
-#define DCR_BMS        0x08  /**< Burst Mode Select */
-#define DCR_AR         0x10  /**< Autoinitialize Remote */
-#define DCR_FTS        0x60  /**< Fifo Threshold Select */
-#define DCR_2BYTES     0x00  /**< 2 bytes */
-#define DCR_4BYTES     0x40  /**< 4 bytes */
-#define DCR_8BYTES     0x20  /**< 8 bytes */
-#define DCR_12BYTES    0x60  /**< 12 bytes */
-
-/* Bits in Transmit Configuration Register */
-#define TCR_CRC        0x01  /**< Inhibit CRC */
-#define TCR_ELC        0x06  /**< Encoded Loopback Control */
-#define TCR_NORMAL     0x00  /**< ELC: Normal Operation */
-#define TCR_INTERNAL   0x02  /**< ELC: Internal Loopback */
-#define TCR_0EXTERNAL  0x04  /**< ELC: External Loopback LPBK=0 */
-#define TCR_1EXTERNAL  0x06  /**< ELC: External Loopback LPBK=1 */
-#define TCR_ATD        0x08  /**< Auto Transmit Disable */
-#define TCR_OFST       0x10  /**< Collision Offset Enable (be nice) */
-
-/* Bits in Interrupt Status Register */
-#define TSR_PTX  0x01  /**< Packet Transmitted (without error) */
-#define TSR_DFR  0x02  /**< Transmit Deferred (reserved) */
-#define TSR_COL  0x04  /**< Transmit Collided */
-#define TSR_ABT  0x08  /**< Transmit Aborted */
-#define TSR_CRS  0x10  /**< Carrier Sense Lost */
-#define TSR_FU   0x20  /**< FIFO Underrun */
-#define TSR_CDH  0x40  /**< CD Heartbeat */
-#define TSR_OWC  0x80  /**< Out of Window Collision */
-
-/* Bits in Receive Configuration Register */
-#define RCR_SEP  0x01  /**< Save Errored Packets */
-#define RCR_AR   0x02  /**< Accept Runt Packets */
-#define RCR_AB   0x04  /**< Accept Broadcast */
-#define RCR_AM   0x08  /**< Accept Multicast */
-#define RCR_PRO  0x10  /**< Physical Promiscuous */
-#define RCR_MON  0x20  /**< Monitor Mode */
-
-/* Bits in Receive Status Register */
-#define RSR_PRX  0x01  /**< Packet Received Intact */
-#define RSR_CRC  0x02  /**< CRC Error */
-#define RSR_FAE  0x04  /**< Frame Alignment Error */
-#define RSR_FO   0x08  /**< FIFO Overrun */
-#define RSR_MPA  0x10  /**< Missed Packet */
-#define RSR_PHY  0x20  /**< Multicast Address Match */
-#define RSR_DIS  0x40  /**< Receiver Disabled */
-#define RSR_DFR  0x80  /**< In later manuals: Deferring */
-
-typedef struct {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** Parent session */
-	async_sess_t *parent_sess;
-	/* Device configuration */
-	void *base_port; /**< Port assigned from ISA configuration */
-	void *port;
-	void *data_port;
-	int irq;
-	nic_address_t mac;
-
-	uint8_t start_page;  /**< Ring buffer start page */
-	uint8_t stop_page;   /**< Ring buffer stop page */
-
-	/* Send queue */
-	struct {
-		bool dirty;    /**< Buffer contains a packet */
-		size_t size;   /**< Packet size */
-		uint8_t page;  /**< Starting page of the buffer */
-	} sq;
-	fibril_mutex_t sq_mutex;
-	fibril_condvar_t sq_cv;
-
-	/* Driver run-time variables */
-	bool probed;
-	bool up;
-
-	/* Irq code with assigned addresses for this device */
-	irq_code_t code;
-
-	/* Copy of the receive configuration register */
-	uint8_t receive_configuration;
-
-	/* Device statistics */
-	// TODO: shouldn't be these directly in device.h - nic_device_stats?
-	uint64_t misses;     /**< Receive frame misses */
-	uint64_t underruns;  /**< FIFO underruns */
-	uint64_t overruns;   /**< FIFO overruns */
-} ne2k_t;
-
-extern errno_t ne2k_probe(ne2k_t *);
-extern errno_t ne2k_up(ne2k_t *);
-extern void ne2k_quiesce(ne2k_t *);
-extern void ne2k_down(ne2k_t *);
-extern void ne2k_send(nic_t *, void *, size_t);
-extern void ne2k_interrupt(nic_t *, uint8_t, uint8_t);
-
-extern void ne2k_set_accept_mcast(ne2k_t *, int);
-extern void ne2k_set_accept_bcast(ne2k_t *, int);
-extern void ne2k_set_promisc_phys(ne2k_t *, int);
-extern void ne2k_set_mcast_hash(ne2k_t *, uint64_t);
-extern void ne2k_set_physical_address(ne2k_t *, const nic_address_t *address);
-
-#endif
-
-/** @}
- */
Index: pace/drv/nic/ne2k/meson.build
===================================================================
--- uspace/drv/nic/ne2k/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nic' ]
-src = files('dp8390.c', 'ne2k.c')
Index: pace/drv/nic/ne2k/ne2k.c
===================================================================
--- uspace/drv/nic/ne2k/ne2k.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,503 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup drv_ne2k
- * @{
- */
-/**
- * @file
- * @brief Bridge between NICF, DDF and business logic for the NIC
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <device/hw_res.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <async.h>
-#include "dp8390.h"
-
-#define NAME  "ne2k"
-
-/** Return the ISR from the interrupt call.
- *
- * @param[in] call The interrupt call.
- *
- */
-#define IRQ_GET_ISR(call)  ((int) ipc_get_arg2(&call))
-
-/** Return the TSR from the interrupt call.
- *
- * @param[in] call The interrupt call.
- *
- */
-#define IRQ_GET_TSR(call)  ((int) ipc_get_arg3(&call))
-
-#define DRIVER_DATA(dev) ((nic_t *) ddf_dev_data_get(dev))
-#define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device)))
-
-static irq_pio_range_t ne2k_ranges_prototype[] = {
-	{
-		.base = 0,
-		.size = NE2K_IO_SIZE,
-	}
-};
-
-/** NE2000 kernel interrupt command sequence.
- *
- */
-static irq_cmd_t ne2k_cmds_prototype[] = {
-	{
-		/* Read Interrupt Status Register */
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		/* Mask supported interrupt causes */
-		.cmd = CMD_AND,
-		.value = (ISR_PRX | ISR_PTX | ISR_RXE | ISR_TXE | ISR_OVW |
-		    ISR_CNT | ISR_RDC),
-		.srcarg = 2,
-		.dstarg = 3,
-	},
-	{
-		/* Predicate for accepting the interrupt */
-		.cmd = CMD_PREDICATE,
-		.value = 4,
-		.srcarg = 3
-	},
-	{
-		/*
-		 * Mask future interrupts via
-		 * Interrupt Mask Register
-		 */
-		.cmd = CMD_PIO_WRITE_8,
-		.addr = NULL,
-		.value = 0
-	},
-	{
-		/* Acknowledge the current interrupt */
-		.cmd = CMD_PIO_WRITE_A_8,
-		.addr = NULL,
-		.srcarg = 3
-	},
-	{
-		/* Read Transmit Status Register */
-		.cmd = CMD_PIO_READ_8,
-		.addr = NULL,
-		.dstarg = 3
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static void ne2k_interrupt_handler(ipc_call_t *, void *);
-
-static errno_t ne2k_register_interrupt(nic_t *nic_data,
-    cap_irq_handle_t *handle)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	if (ne2k->code.cmdcount == 0) {
-		irq_pio_range_t *ne2k_ranges;
-		irq_cmd_t *ne2k_cmds;
-
-		ne2k_ranges = malloc(sizeof(ne2k_ranges_prototype));
-		if (!ne2k_ranges)
-			return ENOMEM;
-		memcpy(ne2k_ranges, ne2k_ranges_prototype,
-		    sizeof(ne2k_ranges_prototype));
-		ne2k_ranges[0].base = (uintptr_t) ne2k->base_port;
-
-		ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype));
-		if (!ne2k_cmds) {
-			free(ne2k_ranges);
-			return ENOMEM;
-		}
-		memcpy(ne2k_cmds, ne2k_cmds_prototype,
-		    sizeof(ne2k_cmds_prototype));
-		ne2k_cmds[0].addr = ne2k->base_port + DP_ISR;
-		ne2k_cmds[3].addr = ne2k->base_port + DP_IMR;
-		ne2k_cmds[4].addr = ne2k_cmds[0].addr;
-		ne2k_cmds[5].addr = ne2k->base_port + DP_TSR;
-
-		ne2k->code.rangecount = sizeof(ne2k_ranges_prototype) /
-		    sizeof(irq_pio_range_t);
-		ne2k->code.ranges = ne2k_ranges;
-
-		ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) /
-		    sizeof(irq_cmd_t);
-		ne2k->code.cmds = ne2k_cmds;
-	}
-
-	return register_interrupt_handler(nic_get_ddf_dev(nic_data),
-	    ne2k->irq, ne2k_interrupt_handler, (void *)nic_data, &ne2k->code,
-	    handle);
-}
-
-static ddf_dev_ops_t ne2k_dev_ops;
-
-static void ne2k_dev_cleanup(ddf_dev_t *dev)
-{
-	if (ddf_dev_data_get(dev) != NULL) {
-		ne2k_t *ne2k = NE2K(dev);
-		if (ne2k) {
-			free(ne2k->code.ranges);
-			free(ne2k->code.cmds);
-		}
-		nic_unbind_and_destroy(dev);
-	}
-}
-
-static errno_t ne2k_dev_init(nic_t *nic_data)
-{
-	/* Get HW resources */
-	hw_res_list_parsed_t hw_res_parsed;
-	hw_res_list_parsed_init(&hw_res_parsed);
-
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
-
-	if (rc != EOK)
-		goto failed;
-
-	if (hw_res_parsed.irqs.count == 0) {
-		rc = EINVAL;
-		goto failed;
-	}
-
-	if (hw_res_parsed.io_ranges.count == 0) {
-		rc = EINVAL;
-		goto failed;
-	}
-
-	if (hw_res_parsed.io_ranges.ranges[0].size < NE2K_IO_SIZE) {
-		rc = EINVAL;
-		goto failed;
-	}
-
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-	ne2k->irq = hw_res_parsed.irqs.irqs[0];
-
-	addr_range_t regs = hw_res_parsed.io_ranges.ranges[0];
-	ne2k->base_port = RNGABSPTR(regs);
-
-	hw_res_list_parsed_clean(&hw_res_parsed);
-
-	/* Enable programmed I/O */
-	if (pio_enable_range(&regs, &ne2k->port) != EOK)
-		return EADDRNOTAVAIL;
-
-	ne2k->data_port = ne2k->port + NE2K_DATA;
-	ne2k->receive_configuration = RCR_AB | RCR_AM;
-	ne2k->probed = false;
-	ne2k->up = false;
-
-	/* Find out whether the device is present. */
-	if (ne2k_probe(ne2k) != EOK)
-		return ENOENT;
-
-	ne2k->probed = true;
-
-	if (ne2k_register_interrupt(nic_data, NULL) != EOK)
-		return EINVAL;
-
-	return EOK;
-
-failed:
-	hw_res_list_parsed_clean(&hw_res_parsed);
-	return rc;
-}
-
-/** NE2K interrupt handler
- *
- * @param call IRQ event notification
- * @param arg Argument (nic_t *)
- */
-void ne2k_interrupt_handler(ipc_call_t *call, void *arg)
-{
-	nic_t *nic_data = (nic_t *)arg;
-	ne2k_interrupt(nic_data, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call));
-}
-
-static errno_t ne2k_on_activating(nic_t *nic_data)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	if (!ne2k->up) {
-		errno_t rc = ne2k_up(ne2k);
-		if (rc != EOK)
-			return rc;
-
-		rc = hw_res_enable_interrupt(ne2k->parent_sess, ne2k->irq);
-		if (rc != EOK) {
-			ne2k_down(ne2k);
-			return rc;
-		}
-	}
-	return EOK;
-}
-
-static errno_t ne2k_on_stopping(nic_t *nic_data)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-
-	(void) hw_res_disable_interrupt(ne2k->parent_sess, ne2k->irq);
-	ne2k->receive_configuration = RCR_AB | RCR_AM;
-	ne2k_down(ne2k);
-	return EOK;
-}
-
-static errno_t ne2k_set_address(ddf_fun_t *fun, const nic_address_t *address)
-{
-	nic_t *nic_data = DRIVER_DATA(ddf_fun_get_dev(fun));
-	errno_t rc = nic_report_address(nic_data, address);
-	if (rc != EOK) {
-		return EINVAL;
-	}
-	/*
-	 * Note: some frame with previous physical address may slip to NIL here
-	 * (for a moment the filtering is not exact), but ethernet should be OK with
-	 * that. Some frames may also be lost, but this is not a problem.
-	 */
-	ne2k_set_physical_address((ne2k_t *) nic_get_specific(nic_data), address);
-	return EOK;
-}
-
-static errno_t ne2k_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	if (!nic_data)
-		return ENOENT;
-
-	str_cpy(info->vendor_name, sizeof(info->vendor_name), "Novell");
-	str_cpy(info->model_name, sizeof(info->model_name), "NE2000");
-
-	return EOK;
-}
-
-static errno_t ne2k_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
-{
-	*state = NIC_CS_PLUGGED;
-	return EOK;
-}
-
-static errno_t ne2k_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	*speed = 10;
-	*duplex = NIC_CM_HALF_DUPLEX;	// XXX
-	*role = NIC_ROLE_UNKNOWN;
-	return EOK;
-}
-
-static errno_t ne2k_on_unicast_mode_change(nic_t *nic_data,
-    nic_unicast_mode_t new_mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-	switch (new_mode) {
-	case NIC_UNICAST_BLOCKED:
-		ne2k_set_promisc_phys(ne2k, false);
-		nic_report_hw_filtering(nic_data, 0, -1, -1);
-		return EOK;
-	case NIC_UNICAST_DEFAULT:
-		ne2k_set_promisc_phys(ne2k, false);
-		nic_report_hw_filtering(nic_data, 1, -1, -1);
-		return EOK;
-	case NIC_UNICAST_LIST:
-		ne2k_set_promisc_phys(ne2k, true);
-		nic_report_hw_filtering(nic_data, 0, -1, -1);
-		return EOK;
-	case NIC_UNICAST_PROMISC:
-		ne2k_set_promisc_phys(ne2k, true);
-		nic_report_hw_filtering(nic_data, 1, -1, -1);
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-}
-
-static errno_t ne2k_on_multicast_mode_change(nic_t *nic_data,
-    nic_multicast_mode_t new_mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-	switch (new_mode) {
-	case NIC_MULTICAST_BLOCKED:
-		ne2k_set_accept_mcast(ne2k, false);
-		nic_report_hw_filtering(nic_data, -1, 1, -1);
-		return EOK;
-	case NIC_MULTICAST_LIST:
-		ne2k_set_accept_mcast(ne2k, true);
-		ne2k_set_mcast_hash(ne2k,
-		    nic_mcast_hash(address_list, address_count));
-		nic_report_hw_filtering(nic_data, -1, 0, -1);
-		return EOK;
-	case NIC_MULTICAST_PROMISC:
-		ne2k_set_accept_mcast(ne2k, true);
-		ne2k_set_mcast_hash(ne2k, 0xFFFFFFFFFFFFFFFFllu);
-		nic_report_hw_filtering(nic_data, -1, 1, -1);
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-}
-
-static errno_t ne2k_on_broadcast_mode_change(nic_t *nic_data,
-    nic_broadcast_mode_t new_mode)
-{
-	ne2k_t *ne2k = (ne2k_t *) nic_get_specific(nic_data);
-	switch (new_mode) {
-	case NIC_BROADCAST_BLOCKED:
-		ne2k_set_accept_bcast(ne2k, false);
-		return EOK;
-	case NIC_BROADCAST_ACCEPTED:
-		ne2k_set_accept_bcast(ne2k, true);
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-}
-
-static errno_t ne2k_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun;
-
-	/* Allocate driver data for the device. */
-	nic_t *nic_data = nic_create_and_bind(dev);
-	if (nic_data == NULL)
-		return ENOMEM;
-
-	nic_set_send_frame_handler(nic_data, ne2k_send);
-	nic_set_state_change_handlers(nic_data,
-	    ne2k_on_activating, NULL, ne2k_on_stopping);
-	nic_set_filtering_change_handlers(nic_data,
-	    ne2k_on_unicast_mode_change, ne2k_on_multicast_mode_change,
-	    ne2k_on_broadcast_mode_change, NULL, NULL);
-
-	ne2k_t *ne2k = malloc(sizeof(ne2k_t));
-	if (NULL != ne2k) {
-		memset(ne2k, 0, sizeof(ne2k_t));
-		nic_set_specific(nic_data, ne2k);
-	} else {
-		nic_unbind_and_destroy(dev);
-		return ENOMEM;
-	}
-
-	ne2k->dev = dev;
-	ne2k->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (ne2k->parent_sess == NULL) {
-		ne2k_dev_cleanup(dev);
-		return ENOMEM;
-	}
-
-	errno_t rc = ne2k_dev_init(nic_data);
-	if (rc != EOK) {
-		ne2k_dev_cleanup(dev);
-		return rc;
-	}
-
-	rc = nic_report_address(nic_data, &ne2k->mac);
-	if (rc != EOK) {
-		ne2k_dev_cleanup(dev);
-		return rc;
-	}
-
-	fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0");
-	if (fun == NULL) {
-		ne2k_dev_cleanup(dev);
-		return ENOMEM;
-	}
-
-	nic_set_ddf_fun(nic_data, fun);
-	ddf_fun_set_ops(fun, &ne2k_dev_ops);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_fun_destroy(fun);
-		ne2k_dev_cleanup(dev);
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK) {
-		ddf_fun_unbind(fun);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t ne2k_dev_quiesce(ddf_dev_t *dev)
-{
-	nic_t *nic;
-	ne2k_t *ne2k;
-
-	nic = nic_get_from_ddf_dev(dev);
-
-	ne2k = (ne2k_t *)nic_get_specific(nic);
-	ne2k_quiesce(ne2k);
-
-	return EOK;
-}
-
-static nic_iface_t ne2k_nic_iface = {
-	.set_address = ne2k_set_address,
-	.get_device_info = ne2k_get_device_info,
-	.get_cable_state = ne2k_get_cable_state,
-	.get_operation_mode = ne2k_get_operation_mode,
-};
-
-static driver_ops_t ne2k_driver_ops = {
-	.dev_add = ne2k_dev_add,
-	.dev_quiesce = ne2k_dev_quiesce
-};
-
-static driver_t ne2k_driver = {
-	.name = NAME,
-	.driver_ops = &ne2k_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS NE 2000 network adapter driver\n", NAME);
-
-	nic_driver_init(NAME);
-	nic_driver_implement(&ne2k_driver_ops, &ne2k_dev_ops, &ne2k_nic_iface);
-
-	return ddf_driver_main(&ne2k_driver);
-}
-
-/** @}
- */
Index: pace/drv/nic/ne2k/ne2k.ma
===================================================================
--- uspace/drv/nic/ne2k/ne2k.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/ne2k
Index: pace/drv/nic/rtl8139/defs.c
===================================================================
--- uspace/drv/nic/rtl8139/defs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "defs.h"
-
-const char *model_names[RTL8139_VER_COUNT] = {
-	"RTL8139",
-	"RTL8139A",
-	"RTL8139A_G",
-	"RTL8139B",
-	"RTL8130",
-	"RTL8139C",
-	"RTL8100",
-	"RTL8139C+",
-	"RTL8139D",
-	"RTL8101"
-};
-
-#define HWVER(b1, b2, b3, b4, b5, b6, b7) ((b1 << 6) | (b2 << 5) | (b3 << 4) \
-    | (b4 << 3) | (b5 << 2) | (b6 << 1) | (b7))
-
-const struct rtl8139_hwver_map rtl8139_versions[RTL8139_VER_COUNT + 1] = {
-	{ HWVER(1, 1, 0, 0, 0, 0, 0), RTL8139 },
-	{ HWVER(1, 1, 1, 0, 0, 0, 0), RTL8139A },
-	{ HWVER(1, 1, 1, 0, 0, 1, 0), RTL8139A_G },
-	{ HWVER(1, 1, 1, 1, 0, 0, 0), RTL8139B },
-	{ HWVER(1, 1, 1, 1, 1, 0, 0), RTL8130 },
-	{ HWVER(1, 1, 1, 0, 1, 0, 0), RTL8139C },
-	{ HWVER(1, 1, 1, 1, 0, 1, 0), RTL8100 },
-	{ HWVER(1, 1, 1, 0, 1, 0, 1), RTL8139D },
-	{ HWVER(1, 1, 1, 0, 1, 1, 0), RTL8139Cp },
-	{ HWVER(1, 1, 1, 0, 1, 1, 1), RTL8101 },
-	/* End value */
-	{ 0, RTL8139_VER_COUNT }
-};
Index: pace/drv/nic/rtl8139/defs.h
===================================================================
--- uspace/drv/nic/rtl8139/defs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,558 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file rtl8139_defs.h
- *
- * Registers, bit positions and masks definition
- * of the RTL8139 network family cards
- */
-
-#ifndef RTL8139_DEFS_H_
-#define RTL8139_DEFS_H_
-
-#include <stdint.h>
-#include <ddi.h>
-
-/** Size of RTL8139 registers address space */
-#define RTL8139_IO_SIZE  256
-
-/** Maximal transmitted frame length
- *
- * Maximal transmitted frame length in bytes
- * allowed according to the RTL8139 documentation
- * (see SIZE part of TSD documentation).
- *
- */
-#define RTL8139_FRAME_MAX_LENGTH  1792
-
-/** HW version
- *
- * As can be detected from HWVERID part of TCR
- * (Transmit Configuration Register).
- *
- */
-typedef enum {
-	RTL8139 = 0,          /**< RTL8139 */
-	RTL8139A,             /**< RTL8139A */
-	RTL8139A_G,           /**< RTL8139A-G */
-	RTL8139B,             /**< RTL8139B */
-	RTL8130,              /**< RTL8130 */
-	RTL8139C,             /**< RTL8139C */
-	RTL8100,              /**< RTL8100 */
-	RTL8139Cp,            /**< RTL8139C+ */
-	RTL8139D,             /**< RTL8139D */
-	RTL8100B = RTL8139D,  /**< RTL8100B and RTL8139D, the same HWVERID in TCR */
-	RTL8101,              /**< RTL8101 */
-	RTL8139_VER_COUNT     /**< Count of known RTL versions, the last value */
-} rtl8139_version_id_t;
-
-/** Registers of RTL8139 family card offsets from the memory address base */
-enum rtl8139_registers {
-	IDR0  = 0x00,    /**< First MAC address bit, 6 1b registres sequence */
-	MAC0  = IDR0,    /**< Alias for IDR0 */
-
-	// 0x06 - 0x07 reserved
-
-	MAR0    = 0x08,  /**< Multicast mask registers 8 1b registers sequence */
-
-	TSD0    = 0x10,  /**< Transmit status of descriptor 0 */
-	TSD1    = 0x14,  /**< Transmit status of descriptor 1 */
-	TSD2    = 0x18,  /**< Transmit status of descriptor 2 */
-	TSD3    = 0x1C,  /**< Transmit status of descriptor 3 */
-
-	TSAD0   = 0x20,  /**< Physical address of the 1st transmitter buffer, 4b */
-	TSAD1   = 0x24,  /**< Physical address of the 2nd transmitter buffer, 4b */
-	TSAD2   = 0x28,  /**< Physical address of the 3rd transmitter buffer, 4b */
-	TSAD3   = 0x3C,  /**< Physical address of the 4th transmitter buffer, 4b */
-
-	RBSTART = 0x30,  /**< Receive (Rx) buffer start address, 4b */
-	ERBCR   = 0x34,  /**< Early receive (Rx) byte count register, 2b */
-	ERSR    = 0x36,  /**< Early receive (Rx) status register, 1b */
-
-	CR      = 0x37,  /**< Command register, 1b */
-	CAPR    = 0x38,  /**< Current address of frame read, 2b */
-	CBA     = 0x3a,  /**< Current buffer address, 2b */
-
-	IMR     = 0x3c,  /**< Interrupt mask register, 2b */
-	ISR     = 0x3e,  /**< Interrupt status register, 2b */
-
-	TCR     = 0x40,  /**< Transmit (Tx) configuration register, 4b */
-	RCR     = 0x44,  /**< Receive (Rx) configuration register, 4b */
-
-	TCTR    = 0x48,  /**< Timer count register */
-	MPC     = 0x4c,  /**< Missed packet count */
-
-	CR9346  = 0x50,  /**< 93C46 command register (locking of registers) */
-
-	CONFIG0 = 0x51,  /**< Configuration register 0, 1b */
-	CONFIG1 = 0x52,  /**< Configuration register 1, 1b */
-
-	// 0x53 reserved
-
-	TIMERINT = 0x54,  /**< Timer interrupt register, 4b */
-	MSR      = 0x58,  /**< Media status register, 1b */
-
-	CONFIG3  = 0x59,  /**< Configuration register 3, 1b */
-	CONFIG4  = 0x5a,  /**< Configuration register 4, 1b */
-
-	// 0x5b reserved
-
-	MULINT   = 0x5c,  /**< Multiple interrupt select, 2b */
-	RERID    = 0x5e,  /**< PCI revision ID = 0x10, 1b */
-
-	// 0x5f reserved
-
-	TSALLD  = 0x60,   /**< Transmit status of all descriptors, 2b */
-
-	BMCR    = 0x62,   /**< Basic mode control register */
-	BMSR    = 0x64,   /**< Basic mode status register */
-
-	ANAR    = 0x66,   /**< Auto-negotiation advertisement register */
-	ANLPAR  = 0x68,   /**< Auto-negotiation link partner register */
-	ANER    = 0x6a,   /**< Auto-negotiation expansion register */
-	DIS     = 0x6c,   /**< Disconnect counter */
-	FCSC    = 0x6e,   /**< False carrier sense counter */
-	NWAYTR  = 0x70,   /**< n-way test register */
-	REC     = 0x72,   /**< RX_ER counter */
-	CSCR    = 0x74,   /**< CS configuration register */
-
-	// 0x76 - 0x77 reserved
-
-	PHY1_PARM = 0x78, /**< PHY parameter 1 */
-	TW_PARM   = 0x7c, /**< Twister parameter */
-	PHY2_PARM = 0x80, /**< PHY parameter 2 */
-
-	// 0x81 reserved
-
-	TDOKLA  = 0x82,   /**< Low Address of a Tx Descriptor with Tx DMA Ok */
-	CRC0    = 0x84,   /**< Power Management CRC register0 for wakeup frame 0 */
-	WAKEUP0 = 0x8c,   /**< Power Management wakeup frame 0 */
-	LSBCRC0 = 0xcc,   /**< Least significant masked byte of WF0 */
-	FLASH   = 0xd4,   /**< Flash memory read/write register */
-
-	CONFIG5 = 0xd8,   /**< Configuration register 5 */
-
-	TPPOL   = 0xd9,   /**< Transmit priority polling register */
-
-	// 0xda - 0xdf reserved
-
-	CPCR    = 0xe0,   /**< C+ mode command register */
-
-	// 0xe2 - 0xe3 reserved
-
-	RDSAR   = 0xe4,   /**< Receive Descriptor Start Address Register */
-	ETTHR   = 0xec,   /**< Early transmit threshold register */
-
-	// 0xed - 0xef reserved
-
-	FER   = 0xf0,    /**< Function event register */
-	FEMR  = 0xf4,    /**< Function event mask register */
-	FPSR  = 0xf8,    /**< Function present state register */
-	FFER  = 0xfc,    /**< Function force event register */
-	MIIR  = 0xfc     /**< MII register */
-};
-
-/** Mask of valid bits in MPC value */
-#define MPC_VMASK UINT32_C(0xFFFFFF);
-
-/** Command register bits */
-enum rtl8139_cr {
-	CR_BUFE = (1 << 0),  /**< Buffer empty bit - read only */
-	CR_TE   = (1 << 2),  /**< Transmitter enable bit */
-	CR_RE   = (1 << 3),  /**< Receiver enable bit */
-	CR_RST  = (1 << 4)   /**< Reset -  set to 1 to force software reset */
-};
-
-/** Config1 register bits */
-enum rtl8139_config1 {
-	CONFIG1_LEDS_SHIFT = 6,       /**< Shift of CONFIG1_LEDS bits */
-	CONFIG1_LEDS_SIZE  = 2,       /**< Size of CONFIG1_LEDS bits */
-
-	CONFIG1_DVRLOAD  = (1 << 5),  /**< Driver load */
-	CONFIG1_LWACT    = (1 << 4),  /**< LWAKE active mode */
-	CONFIG1_MEMMAP   = (1 << 3),  /**< Memory mapping  */
-	CONFIG1_IOMAP    = (1 << 2),  /**< I/O space mapping */
-	CONFIG1_VPD      = (1 << 1),  /**< Set to enable Vital Product Data */
-	CONFIG1_PMEn     = (1 << 0)   /**< Power management enabled */
-};
-
-/** Mask of 9346CR register for lock configuration registers */
-#define RTL8139_REGS_LOCKED 0
-/** Mask of 9346CR register for unlock configuration registers */
-#define RTL8139_REGS_UNLOCKED 0xC0
-
-/** Put rtl8139 to normal mode.
- *
- * Writing to Config0-4 and part of BMCR registers is not allowed
- */
-static inline void rtl8139_regs_lock(void *io_base)
-{
-	pio_write_8(io_base + CR9346, RTL8139_REGS_LOCKED);
-}
-
-/** Allow to change Config0-4 and BMCR register  */
-static inline void rtl8139_regs_unlock(void *io_base)
-{
-	pio_write_8(io_base + CR9346, RTL8139_REGS_UNLOCKED);
-}
-
-/** Force soft reset of the chip. After it:
- *	receiver and transmitter are disabled
- *	transmitter FIFO is cleared
- *	transmitter buffer is set to TSDA0
- *	receiver buffer is empty
- *
- *	The reset bit in command register must be set to 1, the value of the
- *	the register is 1 during reset operation
- *
- *	@param base_port The base address of the port mappings
- */
-#define rtl8139_hw_reset(base_port)\
-	{\
-		pio_write_8(base_port + CR, CR_RST);\
-		while((pio_read_8(base_port + CR) & CR_RST) != 0);\
-	}
-
-/** Interrupt_masks
- *
- *  The masks are the same for both IMR and ISR
- */
-enum rtl8139_interrupts {
-	INT_SERR          = (1 << 15),  /**< System error interrupt */
-	INT_TIME_OUT      = (1 << 14),  /**< Time out interrupt */
-	INT_LENGTH_CHANGE = (1 << 13),  /**< Cable length change interrupt  */
-
-	/* bits 7 - 12 reserved */
-
-	INT_FIFOOVW = (1 << 6),   /**< Receiver FIFO overflow interrupt */
-	INT_PUN     = (1 << 5),   /**< Packet Underrun/Link Change Interrupt  */
-	INT_RXOVW   = (1 << 4),   /**< Receiver buffer overflow */
-	INT_TER     = (1 << 3),   /**< Transmit error interrupt */
-	INT_TOK     = (1 << 2),   /**< Transmit OK interrupt */
-	INT_RER     = (1 << 1),   /**< Receive error interrupt */
-	INT_ROK     = (1 << 0)    /**< Receive OK interrupt */
-};
-
-/** Transmit status descriptor registers bits */
-enum rtl8139_tsd {
-	TSD_CRS          = (1 << 31),    /**< Carrier Sense Lost */
-	TSD_TABT         = (1 << 30),    /**<  Transmit Abort */
-	TSD_OWC          = (1 << 29),    /**< Out of Window Collision */
-	TSD_CDH          = (1 << 28),    /**< CD Heart Beat */
-	TSD_NCC_SHIFT    = 24,           /**< Collision Count - bit shift */
-	TSD_NCC_SIZE     = 4,            /**< Collision Count - bit size */
-	TSD_NCC_MASK     = (1 << 4) - 1, /**< Collision Count - bit size */
-	TSD_ERTXTH_SHIFT = 16,           /**< Early Tx Threshold - bit shift */
-	TSD_ERTXTH_SIZE  = 6,            /**< Early Tx  Treshold - bit size */
-	TSD_TOK          = (1 << 15),    /**< Transmit OK */
-	TSD_TUN          = (1 << 14),    /**< Transmit FIFO Underrun */
-	TSD_OWN          = (1 << 13),    /**< OWN */
-	TSD_SIZE_SHIFT   = 0,            /**< Size - bit shift */
-	TSD_SIZE_SIZE    = 13,           /**< Size - bit size */
-	TSD_SIZE_MASK    = 0x1fff        /**< Size - bit mask */
-};
-
-/** Receiver control register values */
-enum rtl8139_rcr {
-	/** Early Rx treshold part shift */
-	RCR_ERTH_SHIFT = 24,
-	/** Early Rx treshold part size */
-	RCR_ERTH_SIZE = 4,
-
-	/** Multiple early interrupt select */
-	RCR_MulERINT = 1 << 17,
-
-	/** Minimal error frame length (1 = 8B, 0 = 64B).
-	 * If AER/AR is set, RER8 is "Don't care"
-	 */
-	RCR_RER8 = 1 << 16,
-
-	/** Rx FIFO treshold part shift */
-	RCR_RXFTH_SHIFT = 13,
-	/** Rx FIFO treshold part size */
-	RCR_RXFTH_SIZE  = 3,
-
-	/** Rx buffer length part shift */
-	RCR_RBLEN_SHIFT = 11,
-	/** Rx buffer length part size */
-	RCR_RBLEN_SIZE  = 2,
-
-	/** 8K + 16 byte rx buffer */
-	RCR_RBLEN_8k  = 0x00 << RCR_RBLEN_SHIFT,
-	/** 16K + 16 byte rx buffer */
-	RCR_RBLEN_16k = 0x01 << RCR_RBLEN_SHIFT,
-	/** 32K + 16 byte rx buffer */
-	RCR_RBLEN_32k = 0x02 << RCR_RBLEN_SHIFT,
-	/** 64K + 16 byte rx buffer */
-	RCR_RBLEN_64k = 0x03 << RCR_RBLEN_SHIFT,
-
-	/** Max DMA Burst Size part shift */
-	RCR_MXDMA_SHIFT = 8,
-	/** Max DMA Burst Size part size */
-	RCR_MXDMA_SIZE  = 3,
-
-	/** Rx buffer wrapped */
-	RCR_WRAP              = 1 << 7,
-	/** Accept error frame */
-	RCR_ACCEPT_ERROR      = 1 << 5,
-	/** Accept Runt (8-64 bytes) frames */
-	RCR_ACCEPT_RUNT       = 1 << 4,
-	/** Accept broadcast */
-	RCR_ACCEPT_BROADCAST  = 1 << 3,
-	/** Accept multicast */
-	RCR_ACCEPT_MULTICAST  = 1 << 2,
-	/** Accept device MAC address match */
-	RCR_ACCEPT_PHYS_MATCH = 1 << 1,
-	/** Accept all frames with phys. destination */
-	RCR_ACCEPT_ALL_PHYS   = 1 << 0,
-	/** Mask of accept part */
-	RCR_ACCEPT_MASK = (1 << 6) - 1
-};
-
-/** CSCR register bits */
-enum rtl8139_cscr {
-	CS_Testfun       = (1 << 15),
-	/** Low TPI link disable signal */
-	CS_LD            = (1 << 9),
-	/** Heart beat enable; 10Mbit mode only */
-	CS_HEART_BEAT    = (1 << 8),
-	/** Enable jabber function */
-	CS_JABBER_ENABLE = (1 << 7),
-	CS_F_LINK100     = (1 << 6),
-	CS_F_CONNECT     = (1 << 5),
-	/** connection status: 1 = valid, 0 = disconnected */
-	CS_CON_STATUS    = (1 << 3),
-	/** LED1 pin connection status indication */
-	CS_CON_STATUS_EN = (1 << 2),
-	/** Bypass Scramble */
-	CS_PASS_SCR      = (1 << 0)
-};
-
-/** MSR register bits */
-enum rtl8139_msr {
-	MSR_TXFCE       = (1 << 7),  /**< Transmitter flow control enable */
-	MSR_RXFCE       = (1 << 6),  /**< Receiver flow control enable */
-
-	MSR_AUX_PRESENT = (1 << 4),  /**< Aux. Power present Status */
-	MSR_SPEED10     = (1 << 3),  /**< 10MBit mode sign (1 = 10Mb, 0 = 100Mb) */
-	MSR_LINKB       = (1 << 2),  /**< Link Bad (fail) */
-	MSR_TXPF        = (1 << 1),  /**< Transmitter pause flag */
-	MSR_RXPF        = (1 << 0)   /**< Receiver pause flag */
-};
-
-/** BMCR register bits (basic mode control register) */
-enum rtl8139_bmcr {
-	BMCR_Reset     = (1 << 15),  /**< Software reset */
-	BMCR_Spd_100   = (1 << 13),  /**< 100 MBit mode set, 10 MBit otherwise */
-	BMCR_AN_ENABLE = (1 << 12),  /**< Autonegotion enable */
-
-	/* 10,11 reserved */
-
-	BMCR_AN_RESTART = (1 << 9),  /**< Restart autonegotion */
-	BMCR_DUPLEX     = (1 << 8)   /**< Duplex mode: 1=full duplex */
-
-	/* 0-7 reserved */
-};
-
-/** Auto-negotiation advertisement register */
-enum rtl8139_anar {
-	/** Next page bit, 0 - primary capability, 1 - protocol specific */
-	ANAR_NEXT_PAGE    = (1 << 15),
-	/** Capability reception acknowledge */
-	ANAR_ACK          = (1 << 14),
-	/** Remote fault detection capability */
-	ANAR_REMOTE_FAULT = (1 << 13),
-	/** Symetric pause frame capability */
-	ANAR_PAUSE        = (1 << 10),
-	/** T4, not supported by the device */
-	ANAR_100T4        = (1 << 9),
-	/** 100BASE_TX full duplex */
-	ANAR_100TX_FD     = (1 << 8),
-	/** 100BASE_TX half duplex */
-	ANAR_100TX_HD     = (1 << 7),
-	/** 10BASE_T full duplex */
-	ANAR_10_FD        = (1 << 6),
-	/** 10BASE_T half duplex */
-	ANAR_10_HD        = (1 << 5),
-	/** Selector, CSMA/CD (0x1) supported only */
-	ANAR_SELECTOR     = 0x1
-};
-
-/**  Autonegotiation expansion register bits */
-enum rtl8139_aner {
-	ANER_MFL        = (1 << 4),  /**< Multiple link fault occured */
-	ANER_LP_NP_ABLE = (1 << 3),  /**< Link parent supports next page */
-	ANER_NP_ABLE    = (1 << 2),  /**< Local node is able to send next pages */
-	ANER_PAGE_RX    = (1 << 1),  /** New page received, cleared on LPAR read */
-	ANER_LP_NW_ABLE = (1 << 0)   /**< Link partner autonegotiation support */
-};
-
-enum rtl8139_config5 {
-	CONFIG5_BROADCAST_WAKEUP = (1 << 6),  /**< Broadcast wakeup frame enable */
-	CONFIG5_MULTICAST_WAKEUP = (1 << 5),  /**< Multicast wakeup frame enable */
-	CONFIG5_UNICAST_WAKEUP   = (1 << 4),  /**< Unicast wakeup frame enable */
-
-	/** Descending/ascending grow of Rx/Tx FIFO (to test FIFO SRAM only) */
-	CONFIG5_FIFO_ADDR_PTR = (1 << 3),
-	/** Powersave if cable is disconnected */
-	CONFIG5_LINK_DOWN_POWERSAVE = (1 << 2),
-
-	CONFIG5_LAN_WAKE     = (1 << 1),   /**< LANWake signal enabled */
-	CONFIG5_PME_STATUS   = (1 << 0)    /**< PMEn change: 0 = SW, 1 = SW+PCI */
-};
-
-enum rtl8139_config3 {
-	CONFIG3_GNT_SELECT = (1 << 7),  /**< Gnt select */
-	CONFIG3_PARM_EN    = (1 << 6),  /**< Parameter enabled (100MBit mode) */
-	CONFIG3_MAGIC      = (1 << 5),  /**< WoL Magic frame enable */
-	CONFIG3_LINK_UP    = (1 << 4),  /**< Wakeup if link is reestablished */
-	CONFIG3_CLKRUN_EN  = (1 << 2),  /**< CLKRUN enabled */ /* TODO: check what does it mean */
-	CONFIG3_FBTBEN     = (1 << 0)   /**< Fast back to back enabled */
-};
-
-enum rtl8139_config4 {
-	/** Automatic RxFIFO owerflow clear */
-	CONFIG4_RxFIFOAutoClr = (1 << 7),
-	/** Analog poweroff */
-	CONFIG4_AnaOff        = (1 << 6),
-	/** Long wakeup frame (2xCRC8 + 3xCRC16) */
-	CONFIG4_LongWF        = (1 << 5),
-	/** LWAKE and PMEB assertion */
-	CONFIG4_LWPME         = (1 << 4),
-	/** LWake pattern */
-	CONFIG4_LWPTN         = (1 << 2),
-	/** Preboot wakeup */
-	CONFIG4_PBWakeup      = (1 << 0)
-};
-
-/** Maximal runt frame size + 1 */
-#define RTL8139_RUNT_MAX_SIZE  64
-
-/** Bits in frame header */
-enum rtl8139_frame_header {
-	RSR_MAR  = (1 << 15),  /**< Multicast received */
-	RSR_PAM  = (1 << 14),  /**< Physical address match */
-	RSR_BAR  = (1 << 13),  /**< Broadcast match */
-
-	RSR_ISE  = (1 << 5),   /**< Invalid symbol error, 100BASE-TX only */
-	RSR_RUNT = (1 << 4),   /**< Runt frame (< RTL8139_RUNT_MAX_SIZE bytes) */
-
-	RSR_LONG = (1 << 3),   /**< Long frame (size > 4k bytes) */
-	RSR_CRC  = (1 << 2),   /**< CRC error */
-	RSR_FAE  = (1 << 1),   /**< Frame alignment error */
-	RSR_ROK  = (1 << 0)    /**< Good frame received */
-};
-
-enum rtl8139_tcr_bits {
-	/** HW version id, part A shift */
-	HWVERID_A_SHIFT = 26,
-	/** HW version id, part A bit size */
-	HWVERID_A_SIZE  = 5,
-	/** HW version id, part A mask */
-	HWVERID_A_MASK  = (1 << 5) - 1,
-
-	/** The interframe gap time setting shift */
-	IFG_SHIFT = 24,
-	/** The interframe gap time setting bit size */
-	IFG_SIZE  = 2,
-
-	/** HW version id, part B shift */
-	HWVERID_B_SHIFT = 22,
-	/** HW version id, part B bit size */
-	HWVERID_B_SIZE  = 2,
-	/** HW version id, part B mask */
-	HWVERID_B_MASK  = (1 << 2) - 1,
-
-	/** Loopback mode shift */
-	LOOPBACK_SHIFT  = 17,
-	/** Loopback mode size. 00 = normal, 11 = loopback */
-	LOOPBACK_SIZE   = 2,
-
-	/** Append CRC at the end of a frame */
-	APPEND_CRC = 1 << 16,
-
-	/** Max. DMA Burst per TxDMA shift, burst = 16^value */
-	MXTxDMA_SHIFT = 8,
-	/** Max. DMA Burst per TxDMA bit size */
-	MXTxDMA_SIZE  = 3,
-
-	/** Retries before aborting shift */
-	TX_RETRY_COUNT_SHIFT = 4,
-	/** Retries before aborting size */
-	TX_RETRY_COUNT_SIZE  = 4,
-
-	/** Retransmit aborted frame at the last transmitted descriptor */
-	CLEAR_ABORT = 1 << 0
-};
-
-#define RTL8139_HWVERID_A(tcr) (((tcr) >> HWVERID_A_SHIFT) & HWVERID_A_MASK)
-#define RTL8139_HWVERID_B(tcr) (((tcr) >> HWVERID_B_SHIFT) & HWVERID_B_MASK)
-#define RTL8139_HWVERID(tcr) ((RTL8139_HWVERID_A(tcr) << HWVERID_B_SIZE) | \
-    RTL8139_HWVERID_B(tcr))
-
-/** Mapping of HW version -> version ID */
-struct rtl8139_hwver_map {
-	uint32_t hwverid;             /**< HW version value in the register */
-	rtl8139_version_id_t ver_id;  /**< appropriate version id */
-};
-
-/** Mapping of HW version -> version ID */
-extern const struct rtl8139_hwver_map rtl8139_versions[RTL8139_VER_COUNT + 1];
-extern const char *model_names[RTL8139_VER_COUNT];
-
-/** Size in the frame header while copying from RxFIFO to Rx buffer */
-#define RTL8139_EARLY_SIZE  UINT16_C(0xfff0)
-
-/** The only supported pause frame time value */
-#define RTL8139_PAUSE_VAL  UINT16_C(0xFFFF)
-
-/** Size of the frame header in front of the received frame */
-#define RTL_FRAME_HEADER_SIZE  4
-
-/** 8k buffer */
-#define RTL8139_RXFLAGS_SIZE_8  0
-/** 16k buffer */
-#define RTL8139_RXFLAGS_SIZE_16 1
-/** 32k buffer */
-#define RTL8139_RXFLAGS_SIZE_32 2
-/** 64k buffer */
-#define RTL8139_RXFLAGS_SIZE_64 3
-
-/** Get the buffer initial size without 16B padding
- *  Size is (8 + 2^flags) kB (^ in mean power)
- *
- *  @param flags The flags for Rx buffer size, 0-3
- */
-#define RTL8139_RXSIZE(flags) (1 << (13 + (flags)))
-
-/** Padding of the receiver buffer */
-#define RTL8139_RXBUF_PAD 16
-/** Size needed for buffer allocation */
-#define RTL8139_RXBUF_LENGTH(flags) (RTL8139_RXSIZE(flags) + RTL8139_RXBUF_PAD)
-
-#endif
Index: pace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2177 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <align.h>
-#include <byteorder.h>
-#include <barrier.h>
-#include <as.h>
-#include <ddf/log.h>
-#include <ddf/interrupt.h>
-#include <device/hw_res.h>
-#include <io/log.h>
-#include <nic.h>
-#include <pci_dev_iface.h>
-#include <stdio.h>
-#include <str.h>
-
-#include "defs.h"
-#include "driver.h"
-#include "general.h"
-
-/** Global mutex for work with shared irq structure */
-FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
-
-/** Lock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_LOCK() \
-	fibril_mutex_lock(&irq_reg_lock)
-
-/** Unlock interrupt structure mutex */
-#define RTL8139_IRQ_STRUCT_UNLOCK() \
-	fibril_mutex_unlock(&irq_reg_lock)
-
-/** PCI clock frequency in kHz */
-#define RTL8139_PCI_FREQ_KHZ  33000
-
-#define RTL8139_AUTONEG_CAPS (ETH_AUTONEG_10BASE_T_HALF | \
-	ETH_AUTONEG_10BASE_T_FULL | ETH_AUTONEG_100BASE_TX_HALF | \
-	ETH_AUTONEG_100BASE_TX_FULL | ETH_AUTONEG_PAUSE_SYMETRIC)
-
-/** Lock transmitter and receiver data
- *
- * This function shall be called whenever
- * both transmitter and receiver locking
- * to force safe lock ordering (deadlock prevention)
- *
- * @param rtl8139 RTL8139 private data
- *
- */
-static void rtl8139_lock_all(rtl8139_t *rtl8139)
-{
-	assert(rtl8139);
-	fibril_mutex_lock(&rtl8139->tx_lock);
-	fibril_mutex_lock(&rtl8139->rx_lock);
-}
-
-/** Unlock transmitter and receiver data
- *
- * @param rtl8139 RTL8139 private data
- *
- */
-static void rtl8139_unlock_all(rtl8139_t *rtl8139)
-{
-	assert(rtl8139);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-	fibril_mutex_unlock(&rtl8139->tx_lock);
-}
-
-#ifndef RXBUF_SIZE_FLAGS
-/** Flags for receiver buffer - 16kB default */
-#define RXBUF_SIZE_FLAGS RTL8139_RXFLAGS_SIZE_16
-#endif
-
-#if (RXBUF_SIZE_FLAGS > RTL8139_RXFLAGS_SIZE_64) || (RXBUF_SIZE_FLAGS < 0)
-#error Bad receiver buffer flags size flags
-#endif
-
-/** Size of the receiver buffer
- *
- *  Incrementing flags by one twices the buffer size
- *  the lowest size is 8*1024 (flags = 0)
- */
-#define RxBUF_SIZE RTL8139_RXSIZE(RXBUF_SIZE_FLAGS)
-
-/** Total size of the receiver buffer to allocate */
-#define RxBUF_TOT_LENGTH RTL8139_RXBUF_LENGTH(RXBUF_SIZE_FLAGS)
-
-/** Default interrupt mask */
-#define RTL_DEFAULT_INTERRUPTS UINT16_C(0xFFFF)
-
-/** Obtain the value of the register part
- *  The bit operations will be done
- *  The _SHIFT and _MASK for the register part must exists as macros
- *  or variables
- */
-#define REG_GET_VAL(value, reg_part)\
-		(((value) >> reg_part##_SHIFT) & reg_part##_MASK)
-
-/** Set interrupts on controller
- *
- *  @param rtl8139  The card private structure
- */
-static void rtl8139_hw_int_set(rtl8139_t *rtl8139)
-{
-	pio_write_16(rtl8139->io_port + IMR, rtl8139->int_mask);
-}
-
-/** Check on the controller if the receiving buffer is empty
- *
- *  @param rtl8139  The controller data
- *
- *  @return Nonzero if empty, zero otherwise
- */
-static int rtl8139_hw_buffer_empty(rtl8139_t *rtl8139)
-{
-	return pio_read_16(rtl8139->io_port + CR) & CR_BUFE;
-}
-
-/** Update the mask of accepted frames in the RCR register according to
- * rcr_accept_mode value in rtl8139_t
- *
- * @param rtl8139  The rtl8139 private data
- */
-static void rtl8139_hw_update_rcr(rtl8139_t *rtl8139)
-{
-	uint32_t rcr = rtl8139->rcr_data.rcr_base | rtl8139->rcr_data.ucast_mask |
-	    rtl8139->rcr_data.mcast_mask | rtl8139->rcr_data.bcast_mask |
-	    rtl8139->rcr_data.defect_mask |
-	    (RXBUF_SIZE_FLAGS << RCR_RBLEN_SHIFT);
-
-	ddf_msg(LVL_DEBUG, "Rewriting rcr: %x -> %x", pio_read_32(rtl8139->io_port + RCR),
-	    rcr);
-
-	pio_write_32(rtl8139->io_port + RCR, rcr);
-}
-
-/** Fill the mask of accepted multicast frames in the card registers
- *
- *  @param rtl8139  The rtl8139 private data
- *  @param mask     The mask to set
- */
-static void rtl8139_hw_set_mcast_mask(rtl8139_t *rtl8139,
-    uint64_t mask)
-{
-	pio_write_32(rtl8139->io_port + MAR0, (uint32_t) mask);
-	pio_write_32(rtl8139->io_port + MAR0 + sizeof(uint32_t),
-	    (uint32_t)(mask >> 32));
-	return;
-}
-
-/** Set PmEn (Power management enable) bit value
- *
- *  @param rtl8139  rtl8139 card data
- *  @param bit_val  If bit_val is zero pmen is set to 0, otherwise pmen is set to 1
- */
-static void rtl8139_hw_pmen_set(rtl8139_t *rtl8139, uint8_t bit_val)
-{
-	uint8_t config1 = pio_read_8(rtl8139->io_port + CONFIG1);
-	uint8_t config1_new;
-	if (bit_val)
-		config1_new = config1 | CONFIG1_PMEn;
-	else
-		config1_new = config1 & ~(uint8_t)(CONFIG1_PMEn);
-
-	if (config1_new == config1)
-		return;
-
-	rtl8139_regs_unlock(rtl8139->io_port);
-	pio_write_8(rtl8139->io_port + CONFIG1, config1_new);
-	rtl8139_regs_lock(rtl8139->io_port);
-
-	async_sess_t *pci_sess =
-	    ddf_dev_parent_sess_get(nic_get_ddf_dev(rtl8139->nic_data));
-
-	// XXX: According to the RTL8139C(L) Rev.1.4 datasheet, the entire PCI
-	// Power Management data structure is located at a fixed address 0x50 so
-	// that PME_Status and PME_En find themselves at address 0x55. It would
-	// be more flexible though to locate the data structure by searching
-	// the PCI function's capability list.
-	if (bit_val) {
-		uint8_t pmen;
-		pci_config_space_read_8(pci_sess, 0x55, &pmen);
-		pci_config_space_write_8(pci_sess, 0x55, pmen | 1 | (1 << 7));
-	} else {
-		uint8_t pmen;
-		pci_config_space_read_8(pci_sess, 0x55, &pmen);
-		pci_config_space_write_8(pci_sess, 0x55, pmen & ~(1 | (1 << 7)));
-	}
-}
-
-/** Get MAC address of the RTL8139 adapter
- *
- *  @param rtl8139  The RTL8139 device
- *  @param address  The place to store the address
- *
- *  @return EOK if succeed, error code otherwise
- */
-static void rtl8139_hw_get_addr(rtl8139_t *rtl8139,
-    nic_address_t *addr)
-{
-	assert(rtl8139);
-	assert(addr);
-
-	uint32_t *mac0_dest = (uint32_t *)addr->address;
-	uint16_t *mac4_dest = (uint16_t *)(addr->address + 4);
-
-	/* Read MAC address from the i/o (4byte + 2byte reads) */
-	*mac0_dest = pio_read_32(rtl8139->io_port + MAC0);
-	*mac4_dest = pio_read_16(rtl8139->io_port + MAC0 + 4);
-}
-
-/** Set MAC address to the device
- *
- *  @param rtl8139  Controller private structure
- *  @param addr     The address to set
- */
-static void rtl8139_hw_set_addr(rtl8139_t *rtl8139, const nic_address_t *addr)
-{
-	assert(rtl8139);
-	assert(addr);
-
-	const uint32_t *val1 = (const uint32_t *)addr->address;
-	const uint16_t *val2 = (const uint16_t *)(addr->address + sizeof(uint32_t));
-
-	rtl8139_regs_unlock(rtl8139->io_port);
-	pio_write_32(rtl8139->io_port + MAC0, *val1);
-	pio_write_32(rtl8139->io_port + MAC0 + 4, *val2);
-	rtl8139_regs_lock(rtl8139->io_port);
-}
-
-/**  Provide OR in the 8bit register (set selected bits to 1)
- *
- *   @param rtl8139     The rtl8139 structure
- *   @param reg_offset  Register offset in the device IO space
- *   @param bits_add    The value to or
- */
-static void rtl8139_hw_reg_add_8(rtl8139_t *rtl8139, size_t reg_offset,
-    uint8_t bits_add)
-{
-	uint8_t value = pio_read_8(rtl8139->io_port + reg_offset);
-	value |= bits_add;
-	pio_write_8(rtl8139->io_port + reg_offset, value);
-}
-
-/**  Unset selected bits in 8bit register
- *
- *   @param rtl8139     The rtl8139 structure
- *   @param reg_offset  Register offset in the device IO space
- *   @param bits_add    The mask of bits to remove
- */
-static void rtl8139_hw_reg_rem_8(rtl8139_t *rtl8139, size_t reg_offset,
-    uint8_t bits_add)
-{
-	uint8_t value = pio_read_8(rtl8139->io_port + reg_offset);
-	value &= ~bits_add;
-	pio_write_8(rtl8139->io_port + reg_offset, value);
-}
-
-static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *);
-static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
-static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
-static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role);
-static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
-    nic_channel_mode_t duplex, nic_role_t);
-
-static errno_t rtl8139_pause_get(ddf_fun_t *, nic_result_t *, nic_result_t *,
-    uint16_t *);
-static errno_t rtl8139_pause_set(ddf_fun_t *, int, int, uint16_t);
-
-static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
-static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun);
-static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *our_advertisement,
-    uint32_t *their_advertisement, nic_result_t *result,
-    nic_result_t *their_result);
-static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun);
-
-static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
-static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
-
-static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
-    const nic_wol_virtue_t *virtue);
-static void rtl8139_wol_virtue_rem(nic_t *nic_data,
-    const nic_wol_virtue_t *virtue);
-
-static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
-    const struct timespec *period);
-static void rtl8139_poll(nic_t *nic_data);
-
-/** Network interface options for RTL8139 card driver */
-static nic_iface_t rtl8139_nic_iface = {
-	.set_address = &rtl8139_set_addr,
-	.get_device_info = &rtl8139_get_device_info,
-	.get_cable_state = &rtl8139_get_cable_state,
-	.get_operation_mode = &rtl8139_get_operation_mode,
-	.set_operation_mode = &rtl8139_set_operation_mode,
-
-	.get_pause = &rtl8139_pause_get,
-	.set_pause = &rtl8139_pause_set,
-
-	.autoneg_enable = &rtl8139_autoneg_enable,
-	.autoneg_disable = &rtl8139_autoneg_disable,
-	.autoneg_probe = &rtl8139_autoneg_probe,
-	.autoneg_restart = &rtl8139_autoneg_restart,
-
-	.defective_get_mode = &rtl8139_defective_get_mode,
-	.defective_set_mode = &rtl8139_defective_set_mode,
-};
-
-/** Basic device operations for RTL8139 driver */
-static ddf_dev_ops_t rtl8139_dev_ops;
-
-static errno_t rtl8139_dev_add(ddf_dev_t *dev);
-static errno_t rtl8139_dev_quiesce(ddf_dev_t *dev);
-
-/** Basic driver operations for RTL8139 driver */
-static driver_ops_t rtl8139_driver_ops = {
-	.dev_add = &rtl8139_dev_add,
-	.dev_quiesce = &rtl8139_dev_quiesce
-};
-
-/** Driver structure for RTL8139 driver */
-static driver_t rtl8139_driver = {
-	.name = NAME,
-	.driver_ops = &rtl8139_driver_ops
-};
-
-/* The default implementation callbacks */
-static errno_t rtl8139_on_activated(nic_t *nic_data);
-static errno_t rtl8139_on_stopped(nic_t *nic_data);
-static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size);
-
-/** Check if the transmit buffer is busy */
-#define rtl8139_tbuf_busy(tsd) ((pio_read_32(tsd) & TSD_OWN) == 0)
-
-/** Send frame with the hardware
- *
- * note: the main_lock is locked when framework calls this function
- *
- * @param nic_data  The nic driver data structure
- * @param data      Frame data
- * @param size      Frame size in bytes
- *
- * @return EOK if succeed, error code in the case of error
- */
-static void rtl8139_send_frame(nic_t *nic_data, void *data, size_t size)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-	ddf_msg(LVL_DEBUG, "Sending frame");
-
-	if (size > RTL8139_FRAME_MAX_LENGTH) {
-		ddf_msg(LVL_ERROR, "Send frame: frame too long, %zu bytes",
-		    size);
-		nic_report_send_error(rtl8139->nic_data, NIC_SEC_OTHER, 1);
-		goto err_size;
-	}
-
-	assert((size & TSD_SIZE_MASK) == size);
-
-	/* Lock transmitter structure for obtaining next buffer */
-	fibril_mutex_lock(&rtl8139->tx_lock);
-
-	/* Check if there is free buffer */
-	if (rtl8139->tx_next - TX_BUFF_COUNT == rtl8139->tx_used) {
-		nic_set_tx_busy(nic_data, 1);
-		fibril_mutex_unlock(&rtl8139->tx_lock);
-		nic_report_send_error(nic_data, NIC_SEC_BUFFER_FULL, 1);
-		goto err_busy_no_inc;
-	}
-
-	/* Get buffer id to use and set next buffer to use */
-	size_t tx_curr = rtl8139->tx_next++ % TX_BUFF_COUNT;
-
-	fibril_mutex_unlock(&rtl8139->tx_lock);
-
-	/* Get address of the buffer descriptor and frame data */
-	void *tsd = rtl8139->io_port + TSD0 + tx_curr * 4;
-	void *buf_addr = rtl8139->tx_buff[tx_curr];
-
-	/* Wait until the buffer is free */
-	assert(!rtl8139_tbuf_busy(tsd));
-
-	/* Write frame data to the buffer, set the size to TSD and clear OWN bit */
-	memcpy(buf_addr, data, size);
-
-	/* Set size of the data to send */
-	uint32_t tsd_value = pio_read_32(tsd);
-	tsd_value = rtl8139_tsd_set_size(tsd_value, size);
-	pio_write_32(tsd, tsd_value);
-
-	/* barrier for HW to really see the current buffer data */
-	write_barrier();
-
-	tsd_value &= ~(uint32_t)TSD_OWN;
-	pio_write_32(tsd, tsd_value);
-	return;
-
-err_busy_no_inc:
-err_size:
-	return;
-}
-
-/** Reset the controller
- *
- *  @param io_base  The address of the i/o port mapping start
- */
-static void rtl8139_hw_soft_reset(void *io_base)
-{
-	pio_write_8(io_base + CR, CR_RST);
-	memory_barrier();
-	while (pio_read_8(io_base + CR) & CR_RST) {
-		fibril_usleep(1);
-		read_barrier();
-	}
-}
-
-/** Provide soft reset of the controller
- *
- * The caller must lock tx_lock and rx_lock before calling this function
- *
- */
-static void rtl8139_soft_reset(rtl8139_t *rtl8139)
-{
-	assert(rtl8139);
-
-	rtl8139_hw_soft_reset(rtl8139->io_port);
-	nic_t *nic_data = rtl8139->nic_data;
-
-	/* Write MAC address to the card */
-	nic_address_t addr;
-	nic_query_address(nic_data, &addr);
-	rtl8139_hw_set_addr(rtl8139, &addr);
-
-	/* Recover accept modes back */
-	rtl8139_hw_set_mcast_mask(rtl8139, nic_query_mcast_hash(nic_data));
-	rtl8139_hw_update_rcr(rtl8139);
-
-	rtl8139->tx_used = 0;
-	rtl8139->tx_next = 0;
-	nic_set_tx_busy(rtl8139->nic_data, 0);
-}
-
-/** Create frame structure from the buffer data
- *
- * @param nic_data      NIC driver data
- * @param rx_buffer     The receiver buffer
- * @param rx_size       The buffer size
- * @param frame_start   The offset where packet data start
- * @param frame_size    The size of the frame data
- *
- * @return The frame list node (not connected)
- *
- */
-static nic_frame_t *rtl8139_read_frame(nic_t *nic_data,
-    void *rx_buffer, size_t rx_size, size_t frame_start, size_t frame_size)
-{
-	nic_frame_t *frame = nic_alloc_frame(nic_data, frame_size);
-	if (!frame) {
-		ddf_msg(LVL_ERROR, "Can not allocate frame for received frame.");
-		return NULL;
-	}
-
-	void *ret = rtl8139_memcpy_wrapped(frame->data, rx_buffer, frame_start,
-	    RxBUF_SIZE, frame_size);
-	if (ret == NULL) {
-		nic_release_frame(nic_data, frame);
-		return NULL;
-	}
-	return frame;
-}
-
-/*
- * Reset receiver
- *
- * Use in the case of receiver error (lost in the rx_buff)
- *
- * @param rtl8139  controller private data
- */
-static void rtl8139_rx_reset(rtl8139_t *rtl8139)
-{
-	/* Disable receiver, update offset and enable receiver again */
-	uint8_t cr = pio_read_8(rtl8139->io_port + CR);
-	rtl8139_regs_unlock(rtl8139);
-
-	pio_write_8(rtl8139->io_port + CR, cr & ~(uint8_t)CR_RE);
-
-	write_barrier();
-	pio_write_32(rtl8139->io_port + CAPR, 0);
-	pio_write_32(rtl8139->io_port + RBSTART,
-	    PTR2U32(rtl8139->rx_buff_phys));
-
-	write_barrier();
-
-	rtl8139_hw_update_rcr(rtl8139);
-	pio_write_8(rtl8139->io_port + CR, cr);
-	rtl8139_regs_lock(rtl8139);
-
-	nic_report_receive_error(rtl8139->nic_data, NIC_REC_OTHER, 1);
-}
-
-/** Receive all frames in queue
- *
- *  @param nic_data  The controller data
- *  @return The linked list of nic_frame_list_t nodes, each containing one frame
- */
-static nic_frame_list_t *rtl8139_frame_receive(nic_t *nic_data)
-{
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	if (rtl8139_hw_buffer_empty(rtl8139))
-		return NULL;
-
-	nic_frame_list_t *frames = nic_alloc_frame_list();
-	if (!frames)
-		ddf_msg(LVL_ERROR, "Can not allocate frame list for received frames.");
-
-	void *rx_buffer = rtl8139->rx_buff_virt;
-
-	/* where to start reading */
-	uint16_t rx_offset = pio_read_16(rtl8139->io_port + CAPR) + 16;
-	/* unread bytes count */
-	uint16_t bytes_received = pio_read_16(rtl8139->io_port + CBA);
-	uint16_t max_read;
-	uint16_t cur_read = 0;
-
-	/* get values to the <0, buffer size) */
-	bytes_received %= RxBUF_SIZE;
-	rx_offset %= RxBUF_SIZE;
-
-	/* count how many bytes to read maximaly */
-	if (bytes_received < rx_offset)
-		max_read = bytes_received + (RxBUF_SIZE - rx_offset);
-	else
-		max_read = bytes_received - rx_offset;
-
-	memory_barrier();
-	while (!rtl8139_hw_buffer_empty(rtl8139)) {
-		void *rx_ptr = rx_buffer + rx_offset % RxBUF_SIZE;
-		uint32_t frame_header = uint32_t_le2host(*((uint32_t *)rx_ptr));
-		uint16_t size = frame_header >> 16;
-		uint16_t frame_size = size - RTL8139_CRC_SIZE;
-		/* received frame flags in frame header */
-		uint16_t rcs = (uint16_t) frame_header;
-
-		if (size == RTL8139_EARLY_SIZE) {
-			/* The frame copying is still in progress, break receiving */
-			ddf_msg(LVL_DEBUG, "Early threshold reached, not completely coppied");
-			break;
-		}
-
-		/* Check if the header is valid, otherwise we are lost in the buffer */
-		if (size == 0 || size > RTL8139_FRAME_MAX_LENGTH) {
-			ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (size: %4" PRIu16 ", "
-			    "header 0x%4" PRIx32 ". Offset: %" PRIu16 ")", size, frame_header,
-			    rx_offset);
-			goto rx_err;
-		}
-		if (size < RTL8139_RUNT_MAX_SIZE && !(rcs & RSR_RUNT)) {
-			ddf_msg(LVL_ERROR, "Receiver error -> receiver reset (%" PRIx16 ")", size);
-			goto rx_err;
-		}
-
-		cur_read += size + RTL_FRAME_HEADER_SIZE;
-		if (cur_read > max_read)
-			break;
-
-		if (frames) {
-			nic_frame_t *frame = rtl8139_read_frame(nic_data, rx_buffer,
-			    RxBUF_SIZE, rx_offset + RTL_FRAME_HEADER_SIZE, frame_size);
-
-			if (frame)
-				nic_frame_list_append(frames, frame);
-		}
-
-		/* Update offset */
-		rx_offset = ALIGN_UP(rx_offset + size + RTL_FRAME_HEADER_SIZE, 4);
-
-		/*
-		 * Write lesser value to prevent overflow into unread frame
-		 * (the recomendation from the RealTech rtl8139 programming guide)
-		 */
-		uint16_t capr_val = rx_offset - 16;
-		pio_write_16(rtl8139->io_port + CAPR, capr_val);
-
-		/* Ensure no CR read optimalization during next empty buffer test */
-		memory_barrier();
-	}
-	return frames;
-rx_err:
-	rtl8139_rx_reset(rtl8139);
-	return frames;
-}
-
-irq_pio_range_t rtl8139_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = RTL8139_IO_SIZE
-	}
-};
-
-/** Commands to deal with interrupt
- *
- *  Read ISR, check if tere is any interrupt pending.
- *  If so, reset it and accept the interrupt.
- *  The .addr of the first and third command must
- *  be filled to the ISR port address
- */
-irq_cmd_t rtl8139_irq_commands[] = {
-	{
-		/* Get the interrupt status */
-		.cmd = CMD_PIO_READ_16,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 3,
-		.srcarg = 2
-	},
-	{
-		/* Mark interrupts as solved */
-		.cmd = CMD_PIO_WRITE_16,
-		.addr = NULL,
-		.value = 0xFFFF
-	},
-	{
-		/* Disable interrupts until interrupt routine is finished */
-		.cmd = CMD_PIO_WRITE_16,
-		.addr = NULL,
-		.value = 0x0000
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Interrupt code definition */
-irq_code_t rtl8139_irq_code = {
-	.rangecount = sizeof(rtl8139_irq_pio_ranges) / sizeof(irq_pio_range_t),
-	.ranges = rtl8139_irq_pio_ranges,
-	.cmdcount = sizeof(rtl8139_irq_commands) / sizeof(irq_cmd_t),
-	.cmds = rtl8139_irq_commands
-};
-
-/** Deal with transmitter interrupt
- *
- *  @param nic_data  Nic driver data
- */
-static void rtl8139_tx_interrupt(nic_t *nic_data)
-{
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-
-	fibril_mutex_lock(&rtl8139->tx_lock);
-
-	size_t tx_next = rtl8139->tx_next;
-	size_t tx_used = rtl8139->tx_used;
-	while (tx_used != tx_next) {
-		size_t desc_to_check = tx_used % TX_BUFF_COUNT;
-		void *tsd_to_check = rtl8139->io_port + TSD0 +
-		    desc_to_check * sizeof(uint32_t);
-		uint32_t tsd_value = pio_read_32(tsd_to_check);
-
-		/* If sending is still in the progress */
-		if ((tsd_value & TSD_OWN) == 0)
-			break;
-
-		tx_used++;
-
-		/* If the frame was sent */
-		if (tsd_value & TSD_TOK) {
-			size_t size = REG_GET_VAL(tsd_value, TSD_SIZE);
-			nic_report_send_ok(nic_data, 1, size);
-		} else if (tsd_value & TSD_CRS) {
-			nic_report_send_error(nic_data, NIC_SEC_CARRIER_LOST, 1);
-		} else if (tsd_value & TSD_OWC) {
-			nic_report_send_error(nic_data, NIC_SEC_WINDOW_ERROR, 1);
-		} else if (tsd_value & TSD_TABT) {
-			nic_report_send_error(nic_data, NIC_SEC_ABORTED, 1);
-		} else if (tsd_value & TSD_CDH) {
-			nic_report_send_error(nic_data, NIC_SEC_HEARTBEAT, 1);
-		}
-
-		unsigned collisions = REG_GET_VAL(tsd_value, TSD_NCC);
-		if (collisions > 0) {
-			nic_report_collisions(nic_data, collisions);
-		}
-
-		if (tsd_value & TSD_TUN) {
-			nic_report_send_error(nic_data, NIC_SEC_FIFO_OVERRUN, 1);
-		}
-	}
-	if (rtl8139->tx_used != tx_used) {
-		rtl8139->tx_used = tx_used;
-		nic_set_tx_busy(nic_data, 0);
-	}
-	fibril_mutex_unlock(&rtl8139->tx_lock);
-}
-
-/** Receive all frames from the buffer
- *
- *  @param rtl8139  driver private data
- */
-static void rtl8139_receive_frames(nic_t *nic_data)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	fibril_mutex_lock(&rtl8139->rx_lock);
-	nic_frame_list_t *frames = rtl8139_frame_receive(nic_data);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-
-	if (frames)
-		nic_received_frame_list(nic_data, frames);
-}
-
-/** Deal with poll interrupt
- *
- *  @param nic_data  Nic driver data
- */
-static int rtl8139_poll_interrupt(nic_t *nic_data)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	uint32_t timer_val;
-	int receive = rtl8139_timer_act_step(&rtl8139->poll_timer, &timer_val);
-
-	assert(timer_val);
-	pio_write_32(rtl8139->io_port + TIMERINT, timer_val);
-	pio_write_32(rtl8139->io_port + TCTR, 0x0);
-	ddf_msg(LVL_DEBUG, "rtl8139 timer: %" PRIu32 "\treceive: %d", timer_val, receive);
-	return receive;
-}
-
-/** Poll device according to isr status
- *
- *  The isr value must be obtained and cleared by the caller. The reason
- *  of this function separate is to allow polling from both interrupt
- *  (which clears controller ISR before the handler runs) and the polling
- *  callbacks.
- *
- *  @param nic_data  Driver data
- *  @param isr       Interrupt status register value
- */
-static void rtl8139_interrupt_impl(nic_t *nic_data, uint16_t isr)
-{
-	assert(nic_data);
-
-	nic_poll_mode_t poll_mode = nic_query_poll_mode(nic_data, 0);
-
-	/* Process only when should in the polling mode */
-	if (poll_mode == NIC_POLL_PERIODIC) {
-		int receive = 0;
-		if (isr & INT_TIME_OUT) {
-			receive = rtl8139_poll_interrupt(nic_data);
-		}
-		if (!receive)
-			return;
-	}
-
-	/*
-	 * Check transmittion interrupts first to allow transmit next frames
-	 * sooner
-	 */
-	if (isr & (INT_TOK | INT_TER)) {
-		rtl8139_tx_interrupt(nic_data);
-	}
-	if (isr & INT_ROK) {
-		rtl8139_receive_frames(nic_data);
-	}
-	if (isr & (INT_RER | INT_RXOVW | INT_FIFOOVW)) {
-		if (isr & INT_RER) {
-			//TODO: is this only the general error, or any particular?
-		}
-		if (isr & (INT_FIFOOVW)) {
-			nic_report_receive_error(nic_data, NIC_REC_FIFO_OVERRUN, 1);
-		} else if (isr & (INT_RXOVW)) {
-			rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-			assert(rtl8139);
-
-			uint32_t miss = pio_read_32(rtl8139->io_port + MPC) & MPC_VMASK;
-			pio_write_32(rtl8139->io_port + MPC, 0);
-			nic_report_receive_error(nic_data, NIC_REC_BUFFER_OVERFLOW, miss);
-		}
-	}
-}
-
-/** Handle device interrupt
- *
- * @param icall  The IPC call structure
- * @param arg    Argument (nic_t *)
- *
- */
-static void rtl8139_interrupt_handler(ipc_call_t *icall, void *arg)
-{
-	uint16_t isr = (uint16_t) ipc_get_arg2(icall);
-	nic_t *nic_data = (nic_t *)arg;
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-
-	rtl8139_interrupt_impl(nic_data, isr);
-
-	/* Turn the interrupts on again */
-	rtl8139_hw_int_set(rtl8139);
-}
-
-/** Register interrupt handler for the card in the system
- *
- *  Note: the global irq_reg_mutex is locked because of work with global
- *  structure.
- *
- *  @param nic_data  The driver data
- *
- *  @param[out] handle  IRQ capability handle if the handler was registered.
- *
- *  @return An error code otherwise.
- */
-static errno_t rtl8139_register_int_handler(nic_t *nic_data,
-    cap_irq_handle_t *handle)
-{
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-
-	/* Lock the mutex in whole driver while working with global structure */
-	RTL8139_IRQ_STRUCT_LOCK();
-
-	rtl8139_irq_code.ranges[0].base = (uintptr_t) rtl8139->io_addr;
-	rtl8139_irq_code.cmds[0].addr = rtl8139->io_addr + ISR;
-	rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR;
-	rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR;
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
-	    rtl8139->irq, rtl8139_interrupt_handler, (void *)nic_data,
-	    &rtl8139_irq_code, handle);
-
-	RTL8139_IRQ_STRUCT_UNLOCK();
-
-	return rc;
-}
-
-/** Start the controller
- *
- * The caller must lock tx_lock and rx_lock before calling this function
- *
- * @param rtl8139  The card private data
- */
-static void rtl8139_card_up(rtl8139_t *rtl8139)
-{
-	void *io_base = rtl8139->io_port;
-	size_t i;
-
-	/* Wake up the device */
-	pio_write_8(io_base + CONFIG1, 0x00);
-	/* Reset the device */
-	rtl8139_soft_reset(rtl8139);
-
-	/* Write transmittion buffer addresses */
-	for (i = 0; i < TX_BUFF_COUNT; ++i) {
-		uint32_t addr = PTR2U32(rtl8139->tx_buff_phys + i * TX_BUFF_SIZE);
-		pio_write_32(io_base + TSAD0 + 4 * i, addr);
-	}
-	rtl8139->tx_next = 0;
-	rtl8139->tx_used = 0;
-	nic_set_tx_busy(rtl8139->nic_data, 0);
-
-	pio_write_32(io_base + RBSTART, PTR2U32(rtl8139->rx_buff_phys));
-
-	/* Enable transmitter and receiver */
-	uint8_t cr_value = pio_read_8(io_base + CR);
-	pio_write_8(io_base + CR, cr_value | CR_TE | CR_RE);
-	rtl8139_hw_update_rcr(rtl8139);
-}
-
-/** Activate the device to receive and transmit frames
- *
- *  @param nic_data  The nic driver data
- *
- *  @return EOK if activated successfully, error code otherwise
- */
-static errno_t rtl8139_on_activated(nic_t *nic_data)
-{
-	assert(nic_data);
-	ddf_msg(LVL_NOTE, "Activating device");
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	rtl8139_lock_all(rtl8139);
-	rtl8139_card_up(rtl8139);
-	rtl8139_unlock_all(rtl8139);
-
-	rtl8139->int_mask = RTL_DEFAULT_INTERRUPTS;
-	rtl8139_hw_int_set(rtl8139);
-
-	errno_t rc = hw_res_enable_interrupt(rtl8139->parent_sess, rtl8139->irq);
-	if (rc != EOK) {
-		rtl8139_on_stopped(nic_data);
-		return rc;
-	}
-
-	ddf_msg(LVL_DEBUG, "Device activated, interrupt %d registered", rtl8139->irq);
-	return EOK;
-}
-
-/** Callback for NIC_STATE_STOPPED change
- *
- *  @param nic_data  The nic driver data
- *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_on_stopped(nic_t *nic_data)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	rtl8139->rcr_data.ucast_mask = RTL8139_RCR_UCAST_DEFAULT;
-	rtl8139->rcr_data.mcast_mask = RTL8139_RCR_MCAST_DEFAULT;
-	rtl8139->rcr_data.bcast_mask = RTL8139_RCR_BCAST_DEFAULT;
-	rtl8139->rcr_data.defect_mask = RTL8139_RCR_DEFECT_DEFAULT;
-
-	/* Reset the card to the initial state (interrupts, Tx and Rx disabled) */
-	rtl8139_lock_all(rtl8139);
-	rtl8139_soft_reset(rtl8139);
-	rtl8139_unlock_all(rtl8139);
-	return EOK;
-}
-
-static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
-    const nic_address_t *, size_t);
-static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_count);
-static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
-
-/** Create driver data structure
- *
- *  @return Intialized device data structure or NULL
- */
-static rtl8139_t *rtl8139_create_dev_data(ddf_dev_t *dev)
-{
-	assert(dev);
-	assert(!nic_get_from_ddf_dev(dev));
-
-	nic_t *nic_data = nic_create_and_bind(dev);
-	if (!nic_data)
-		return NULL;
-
-	rtl8139_t *rtl8139 = calloc(1, sizeof(rtl8139_t));
-	if (!rtl8139) {
-		nic_unbind_and_destroy(dev);
-		return NULL;
-	}
-
-	rtl8139->dev = dev;
-
-	rtl8139->nic_data = nic_data;
-	nic_set_specific(nic_data, rtl8139);
-	nic_set_send_frame_handler(nic_data, rtl8139_send_frame);
-	nic_set_state_change_handlers(nic_data,
-	    rtl8139_on_activated, NULL, rtl8139_on_stopped);
-	nic_set_filtering_change_handlers(nic_data,
-	    rtl8139_unicast_set, rtl8139_multicast_set, rtl8139_broadcast_set,
-	    NULL, NULL);
-	nic_set_wol_virtue_change_handlers(nic_data,
-	    rtl8139_wol_virtue_add, rtl8139_wol_virtue_rem);
-	nic_set_poll_handlers(nic_data, rtl8139_poll_mode_change, rtl8139_poll);
-
-	fibril_mutex_initialize(&rtl8139->rx_lock);
-	fibril_mutex_initialize(&rtl8139->tx_lock);
-
-	nic_set_wol_max_caps(nic_data, NIC_WV_BROADCAST, 1);
-	nic_set_wol_max_caps(nic_data, NIC_WV_LINK_CHANGE, 1);
-	nic_set_wol_max_caps(nic_data, NIC_WV_MAGIC_PACKET, 1);
-
-	return rtl8139;
-}
-
-/** Clean up the rtl8139 device structure.
- *
- * @param dev  The device structure.
- */
-static void rtl8139_dev_cleanup(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	if (ddf_dev_data_get(dev))
-		nic_unbind_and_destroy(dev);
-}
-
-/** Fill the irq and io_addr part of device data structure
- *
- *  The hw_resources must be obtained before calling this function
- *
- *  @param dev           The device structure
- *  @param hw_resources  Devices hardware resources
- *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
-    *hw_resources)
-{
-	assert(dev);
-	assert(hw_resources);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_dev(dev));
-	assert(rtl8139);
-
-	if (hw_resources->irqs.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected irq count", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-	if (hw_resources->io_ranges.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-
-	rtl8139->irq = hw_resources->irqs.irqs[0];
-	ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", ddf_dev_get_name(dev), rtl8139->irq);
-
-	rtl8139->io_addr = IOADDR_TO_PTR(RNGABS(hw_resources->io_ranges.ranges[0]));
-	if (hw_resources->io_ranges.ranges[0].size < RTL8139_IO_SIZE) {
-		ddf_msg(LVL_ERROR, "i/o range assigned to the device "
-		    "%s is too small.", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-	ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", ddf_dev_get_name(dev), rtl8139->io_addr);
-
-	return EOK;
-}
-
-/** Obtain information about hardware resources of the device
- *
- *  The device must be connected to the parent
- *
- *  @param dev  The device structure
- *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_get_resource_info(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	assert(nic_data);
-
-	hw_res_list_parsed_t hw_res_parsed;
-	hw_res_list_parsed_init(&hw_res_parsed);
-
-	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
-	if (rc != EOK)
-		return rc;
-
-	/* Fill resources information to the device */
-	errno_t ret = rtl8139_fill_resource_info(dev, &hw_res_parsed);
-	hw_res_list_parsed_clean(&hw_res_parsed);
-
-	return ret;
-}
-
-/** Allocate buffers using DMA framework
- *
- * The buffers structures in the device specific data is filled
- *
- * @param data  The device specific structure to fill
- *
- * @return EOK in the case of success, error code otherwise
- */
-static errno_t rtl8139_buffers_create(rtl8139_t *rtl8139)
-{
-	size_t i = 0;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Creating buffers");
-
-	rtl8139->tx_buff_virt = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(TX_PAGES * PAGE_SIZE, DMAMEM_4GiB,
-	    AS_AREA_WRITE, 0, &rtl8139->tx_buff_phys, &rtl8139->tx_buff_virt);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Can not allocate transmitter buffers.");
-		goto err_tx_alloc;
-	}
-
-	for (i = 0; i < TX_BUFF_COUNT; ++i)
-		rtl8139->tx_buff[i] = rtl8139->tx_buff_virt + i * TX_BUFF_SIZE;
-
-	ddf_msg(LVL_DEBUG, "The transmittion buffers allocated");
-
-	/* Use the first buffer for next transmittion */
-	rtl8139->tx_next = 0;
-	rtl8139->tx_used = 0;
-
-	/* Allocate buffer for receiver */
-	ddf_msg(LVL_DEBUG, "Allocating receiver buffer of the size %d bytes",
-	    RxBUF_TOT_LENGTH);
-
-	rtl8139->rx_buff_virt = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(RxBUF_TOT_LENGTH, DMAMEM_4GiB,
-	    AS_AREA_READ, 0, &rtl8139->rx_buff_phys, &rtl8139->rx_buff_virt);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Can not allocate receive buffer.");
-		goto err_rx_alloc;
-	}
-	ddf_msg(LVL_DEBUG, "The buffers created");
-
-	return EOK;
-
-err_rx_alloc:
-	dmamem_unmap_anonymous(rtl8139->tx_buff_virt);
-err_tx_alloc:
-	return rc;
-}
-
-/** Initialize the rtl8139 device structure
- *
- *  @param dev  The device information
- *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_device_initialize(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, "rtl8139_dev_initialize %s", ddf_dev_get_name(dev));
-
-	errno_t ret = EOK;
-
-	ddf_msg(LVL_DEBUG, "rtl8139: creating device data");
-
-	/* Allocate driver data for the device. */
-	rtl8139_t *rtl8139 = rtl8139_create_dev_data(dev);
-	if (rtl8139 == NULL) {
-		ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", ddf_dev_get_name(dev));
-		return ENOMEM;
-	}
-
-	ddf_msg(LVL_DEBUG, "rtl8139: dev_data created");
-	rtl8139->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (rtl8139->parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Error connecting parent device.");
-		return EIO;
-	}
-
-	/* Obtain and fill hardware resources info and connect to parent */
-	ret = rtl8139_get_resource_info(dev);
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Can not obatin hw resources information");
-		goto failed;
-	}
-
-	ddf_msg(LVL_DEBUG, "rtl8139: resource_info obtained");
-
-	/* Allocate DMA buffers */
-	ret = rtl8139_buffers_create(rtl8139);
-	if (ret != EOK)
-		goto failed;
-
-	/* Set default frame acceptance */
-	rtl8139->rcr_data.ucast_mask = RTL8139_RCR_UCAST_DEFAULT;
-	rtl8139->rcr_data.mcast_mask = RTL8139_RCR_MCAST_DEFAULT;
-	rtl8139->rcr_data.bcast_mask = RTL8139_RCR_BCAST_DEFAULT;
-	rtl8139->rcr_data.defect_mask = RTL8139_RCR_DEFECT_DEFAULT;
-	/* Set receiver early treshold to 8/16 of frame length */
-	rtl8139->rcr_data.rcr_base = (0x8 << RCR_ERTH_SHIFT);
-
-	ddf_msg(LVL_DEBUG, "The device is initialized");
-	return ret;
-
-failed:
-	ddf_msg(LVL_ERROR, "The device initialization failed");
-	rtl8139_dev_cleanup(dev);
-	return ret;
-}
-
-/** Enable the i/o ports of the device.
- *
- * @param dev  The RTL8139 device.
- *
- * @return EOK if successed, error code otherwise
- */
-static errno_t rtl8139_pio_enable(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, NAME ": rtl8139_pio_enable %s", ddf_dev_get_name(dev));
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_dev(dev));
-
-	/* Gain control over port's registers. */
-	if (pio_enable(rtl8139->io_addr, RTL8139_IO_SIZE, &rtl8139->io_port)) {
-		ddf_msg(LVL_ERROR, "Cannot gain the port %p for device %s.", rtl8139->io_addr,
-		    ddf_dev_get_name(dev));
-		return EADDRNOTAVAIL;
-	}
-
-	return EOK;
-}
-
-/** Initialize the driver private data according to the
- *  device registers
- *
- *  @param rtl8139 rtl8139 private data
- */
-static void rtl8139_data_init(rtl8139_t *rtl8139)
-{
-	assert(rtl8139);
-
-	/* Check the version id */
-	uint32_t tcr = pio_read_32(rtl8139->io_port + TCR);
-	uint32_t hwverid = RTL8139_HWVERID(tcr);
-	size_t i = 0;
-	rtl8139->hw_version = RTL8139_VER_COUNT;
-	for (i = 0; i < RTL8139_VER_COUNT; ++i) {
-		if (rtl8139_versions[i].hwverid == 0)
-			break;
-
-		if (rtl8139_versions[i].hwverid == hwverid) {
-			rtl8139->hw_version = rtl8139_versions[i].ver_id;
-			ddf_msg(LVL_NOTE, "HW version found: index %zu, ver_id %d (%s)", i,
-			    rtl8139_versions[i].ver_id, model_names[rtl8139->hw_version]);
-		}
-	}
-}
-
-static void rtl8139_quiesce(rtl8139_t *rtl8139)
-{
-	rtl8139_hw_soft_reset(rtl8139->io_port);
-}
-
-/** The add_device callback of RTL8139 callback
- *
- * Probe and initialize the newly added device.
- *
- * @param dev  The RTL8139 device.
- *
- * @return EOK if added successfully, error code otherwise
- */
-errno_t rtl8139_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun;
-
-	ddf_msg(LVL_NOTE, "RTL8139_dev_add %s (handle = %zu)",
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	/* Init device structure for rtl8139 */
-	errno_t rc = rtl8139_device_initialize(dev);
-	if (rc != EOK)
-		return rc;
-
-	/* Map I/O ports */
-	rc = rtl8139_pio_enable(dev);
-	if (rc != EOK)
-		goto err_destroy;
-
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-
-	nic_address_t addr;
-	rtl8139_hw_get_addr(rtl8139, &addr);
-	rc = nic_report_address(nic_data, &addr);
-	if (rc != EOK)
-		goto err_pio;
-
-	/* Initialize the driver private structure */
-	rtl8139_data_init(rtl8139);
-
-	/* Register interrupt handler */
-	cap_irq_handle_t irq_handle;
-	rc = rtl8139_register_int_handler(nic_data, &irq_handle);
-	if (rc != EOK) {
-		goto err_pio;
-	}
-
-	fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating device function");
-		goto err_srv;
-	}
-
-	nic_set_ddf_fun(nic_data, fun);
-	ddf_fun_set_ops(fun, &rtl8139_dev_ops);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding device function");
-		goto err_fun_create;
-	}
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function to category");
-		goto err_fun_bind;
-	}
-
-	ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
-	    ddf_dev_get_name(dev));
-
-	return EOK;
-
-err_fun_bind:
-	ddf_fun_unbind(fun);
-err_fun_create:
-	ddf_fun_destroy(fun);
-err_srv:
-	unregister_interrupt_handler(dev, irq_handle);
-err_pio:
-	// rtl8139_pio_disable(dev);
-	/* TODO: find out if the pio_disable is needed */
-err_destroy:
-	rtl8139_dev_cleanup(dev);
-	return rc;
-}
-
-/** Quiesce RTL8139.
- *
- * @param dev RTL8139 device.
- * @return EOK on sucess, or an error code.
- */
-errno_t rtl8139_dev_quiesce(ddf_dev_t *dev)
-{
-	nic_t *nic;
-	rtl8139_t *rtl8139;
-
-	ddf_msg(LVL_NOTE, "RTL8139_dev_quiesce %s (handle = %zu)",
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	nic = nic_get_from_ddf_dev(dev);
-	rtl8139 = nic_get_specific(nic);
-
-	rtl8139_quiesce(rtl8139);
-	return EOK;
-}
-
-/** Set card MAC address
- *
- *  @param device   The RTL8139 device
- *  @param address  The place to store the address
- *  @param max_len  Maximal addresss length to store
- *
- *  @return EOK if succeed, error code otherwise
- */
-static errno_t rtl8139_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
-{
-	assert(fun);
-	assert(addr);
-
-	nic_t *nic_data = nic_get_from_ddf_fun((fun));
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	rtl8139_lock_all(rtl8139);
-
-	errno_t rc = nic_report_address(nic_data, addr);
-	if (rc != EOK) {
-		rtl8139_unlock_all(rtl8139);
-		return rc;
-	}
-
-	rtl8139_hw_set_addr(rtl8139, addr);
-
-	rtl8139_unlock_all(rtl8139);
-	return EOK;
-}
-
-/** Get the device information
- *
- *  @param dev   The NIC device
- *  @param info  The information to fill
- *
- *  @return EOK
- */
-static errno_t rtl8139_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
-{
-	assert(fun);
-	assert(info);
-
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	assert(nic_data);
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	/* TODO: fill the information more completely */
-	info->vendor_id = 0x10ec;
-	str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH, "Realtek");
-
-	if (rtl8139->hw_version < RTL8139_VER_COUNT) {
-		str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH,
-		    model_names[rtl8139->hw_version]);
-	} else {
-		str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH, "RTL8139");
-	}
-
-	info->ethernet_support[ETH_10M] = ETH_10BASE_T;
-	info->ethernet_support[ETH_100M] = ETH_100BASE_TX;
-
-	info->autoneg_support = RTL8139_AUTONEG_CAPS;
-	return EOK;
-}
-
-/** Check the cable state
- *
- *  @param[in]  dev    The device
- *  @param[out] state  The state to fill
- *
- *  @return EOK
- */
-static errno_t rtl8139_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
-{
-	assert(fun);
-	assert(state);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if (pio_read_16(rtl8139->io_port + CSCR) & CS_CON_STATUS) {
-		*state = NIC_CS_PLUGGED;
-	} else {
-		*state = NIC_CS_UNPLUGGED;
-	}
-
-	return EOK;
-}
-
-/** Get operation mode of the device
- */
-static errno_t rtl8139_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	assert(fun);
-	assert(speed);
-	assert(duplex);
-	assert(role);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	uint16_t bmcr_val = pio_read_16(rtl8139->io_port + BMCR);
-	uint8_t msr_val = pio_read_8(rtl8139->io_port + MSR);
-
-	if (bmcr_val & BMCR_DUPLEX) {
-		*duplex = NIC_CM_FULL_DUPLEX;
-	} else {
-		*duplex = NIC_CM_HALF_DUPLEX;
-	}
-
-	if (msr_val & MSR_SPEED10) {
-		*speed = 10;
-	} else {
-		*speed = 100;
-	}
-
-	*role = NIC_ROLE_UNKNOWN;
-	return EOK;
-}
-
-/** Value validity */
-enum access_mode {
-	/** Value is invalid now */
-	VALUE_INVALID = 0,
-	/** Read-only */
-	VALUE_RO,
-	/** Read-write */
-	VALUE_RW
-};
-
-/** Check if pause frame operations are valid in current situation
- *
- *  @param rtl8139  RTL8139 private structure
- *
- *  @return VALUE_INVALID if the value has no sense in current moment
- *  @return VALUE_RO if the state is read-only in current moment
- *  @return VALUE_RW if the state can be modified
- */
-static int rtl8139_pause_is_valid(rtl8139_t *rtl8139)
-{
-	assert(rtl8139);
-
-	uint16_t bmcr = pio_read_16(rtl8139->io_port + BMCR);
-	if ((bmcr & (BMCR_AN_ENABLE | BMCR_DUPLEX)) == 0)
-		return VALUE_INVALID;
-
-	if (bmcr & BMCR_AN_ENABLE) {
-		uint16_t anar_lp = pio_read_16(rtl8139->io_port + ANLPAR);
-		if (anar_lp & ANAR_PAUSE)
-			return VALUE_RO;
-	}
-
-	return VALUE_RW;
-}
-
-/** Get current pause frame configuration
- *
- *  Values are filled with NIC_RESULT_NOT_AVAILABLE if the value has no sense in
- *  the moment (half-duplex).
- *
- *  @param[in]  fun         The DDF structure of the RTL8139
- *  @param[out] we_send     Sign if local constroller sends pause frame
- *  @param[out] we_receive  Sign if local constroller receives pause frame
- *  @param[out] time        Time filled in pause frames. 0xFFFF in rtl8139
- *
- *  @return EOK if succeed
- */
-static errno_t rtl8139_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
-    nic_result_t *we_receive, uint16_t *time)
-{
-	assert(fun);
-	assert(we_send);
-	assert(we_receive);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if (rtl8139_pause_is_valid(rtl8139) == VALUE_INVALID) {
-		*we_send = NIC_RESULT_NOT_AVAILABLE;
-		*we_receive = NIC_RESULT_NOT_AVAILABLE;
-		*time = 0;
-		return EOK;
-	}
-
-	uint8_t msr = pio_read_8(rtl8139->io_port + MSR);
-
-	*we_send = (msr & MSR_TXFCE) ? NIC_RESULT_ENABLED : NIC_RESULT_DISABLED;
-	*we_receive = (msr & MSR_RXFCE) ? NIC_RESULT_ENABLED : NIC_RESULT_DISABLED;
-	*time = RTL8139_PAUSE_VAL;
-
-	return EOK;
-}
-
-/** Set current pause frame configuration
- *
- *  @param fun            The DDF structure of the RTL8139
- *  @param allow_send     Sign if local constroller sends pause frame
- *  @param allow_receive  Sign if local constroller receives pause frames
- *  @param time           Time to use, ignored (not supported by device)
- *
- *  @return EOK if succeed, INVAL if the pause frame has no sence
- */
-static errno_t rtl8139_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
-    uint16_t time)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if (rtl8139_pause_is_valid(rtl8139) != VALUE_RW)
-		return EINVAL;
-
-	uint8_t msr = pio_read_8(rtl8139->io_port + MSR);
-	msr &= ~(uint8_t)(MSR_TXFCE | MSR_RXFCE);
-
-	if (allow_receive)
-		msr |= MSR_RXFCE;
-	if (allow_send)
-		msr |= MSR_TXFCE;
-
-	pio_write_8(rtl8139->io_port + MSR, msr);
-
-	if (allow_send && time > 0) {
-		ddf_msg(LVL_WARN, "Time setting is not supported in set_pause method.");
-	}
-	return EOK;
-}
-
-/** Set operation mode of the device
- *
- */
-static errno_t rtl8139_set_operation_mode(ddf_fun_t *fun, int speed,
-    nic_channel_mode_t duplex, nic_role_t role)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if (speed != 10 && speed != 100)
-		return EINVAL;
-	if (duplex != NIC_CM_HALF_DUPLEX && duplex != NIC_CM_FULL_DUPLEX)
-		return EINVAL;
-
-	uint16_t bmcr_val = pio_read_16(rtl8139->io_port + BMCR);
-
-	/* Set autonegotion disabled */
-	bmcr_val &= ~(uint16_t)BMCR_AN_ENABLE;
-
-	if (duplex == NIC_CM_FULL_DUPLEX) {
-		bmcr_val |= BMCR_DUPLEX;
-	} else {
-		bmcr_val &= ~((uint16_t)BMCR_DUPLEX);
-	}
-
-	if (speed == 100) {
-		bmcr_val |= BMCR_Spd_100;
-	} else {
-		bmcr_val &= ~((uint16_t)BMCR_Spd_100);
-	}
-
-	rtl8139_regs_unlock(rtl8139->io_port);
-	pio_write_16(rtl8139->io_port + BMCR, bmcr_val);
-	rtl8139_regs_lock(rtl8139->io_port);
-	return EOK;
-}
-
-/** Enable autonegoation with specific advertisement
- *
- *  @param dev            The device to update
- *  @param advertisement  The advertisement to set
- *
- *  @returns EINVAL if the advertisement mode is not supproted
- *  @returns EOK if advertisement mode set successfully
- */
-static errno_t rtl8139_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if (advertisement == 0) {
-		advertisement = RTL8139_AUTONEG_CAPS;
-	}
-
-	if ((advertisement | RTL8139_AUTONEG_CAPS) != RTL8139_AUTONEG_CAPS)
-		return EINVAL; /* some unsuported mode is requested */
-
-	assert(advertisement != 0);
-
-	/* Set the autonegotiation advertisement */
-	uint16_t anar = ANAR_SELECTOR; /* default selector */
-	if (advertisement & ETH_AUTONEG_10BASE_T_FULL)
-		anar |= ANAR_10_FD;
-	if (advertisement & ETH_AUTONEG_10BASE_T_HALF)
-		anar |= ANAR_10_HD;
-	if (advertisement & ETH_AUTONEG_100BASE_TX_FULL)
-		anar |= ANAR_100TX_FD;
-	if (advertisement & ETH_AUTONEG_100BASE_TX_HALF)
-		anar |= ANAR_100TX_HD;
-	if (advertisement & ETH_AUTONEG_PAUSE_SYMETRIC)
-		anar |= ANAR_PAUSE;
-
-	uint16_t bmcr_val = pio_read_16(rtl8139->io_port + BMCR);
-	bmcr_val |= BMCR_AN_ENABLE;
-
-	pio_write_16(rtl8139->io_port + ANAR, anar);
-
-	rtl8139_regs_unlock(rtl8139->io_port);
-	pio_write_16(rtl8139->io_port + BMCR, bmcr_val);
-	rtl8139_regs_lock(rtl8139->io_port);
-	return EOK;
-}
-
-/** Disable advertisement functionality
- *
- *  @param dev  The device to update
- *
- *  @returns EOK
- */
-static errno_t rtl8139_autoneg_disable(ddf_fun_t *fun)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	uint16_t bmcr_val = pio_read_16(rtl8139->io_port + BMCR);
-
-	bmcr_val &= ~((uint16_t)BMCR_AN_ENABLE);
-
-	rtl8139_regs_unlock(rtl8139->io_port);
-	pio_write_16(rtl8139->io_port + BMCR, bmcr_val);
-	rtl8139_regs_lock(rtl8139->io_port);
-
-	return EOK;
-}
-
-/** Obtain the advertisement NIC framework value from the ANAR/ANLPAR register
- * value
- *
- *  @param[in]  anar           The ANAR register value
- *  @param[out] advertisement  The advertisement result
- */
-static void rtl8139_get_anar_state(uint16_t anar, uint32_t *advertisement)
-{
-	*advertisement = 0;
-	if (anar & ANAR_10_HD)
-		*advertisement |= ETH_AUTONEG_10BASE_T_HALF;
-	if (anar & ANAR_10_FD)
-		*advertisement |= ETH_AUTONEG_10BASE_T_FULL;
-	if (anar & ANAR_100TX_HD)
-		*advertisement |= ETH_AUTONEG_100BASE_TX_HALF;
-	if (anar & ANAR_100TX_FD)
-		*advertisement |= ETH_AUTONEG_100BASE_TX_FULL;
-	if (anar & ANAR_100T4)
-		*advertisement |= ETH_AUTONEG_100BASE_T4_HALF;
-	if (anar & ANAR_PAUSE)
-		*advertisement |= ETH_AUTONEG_PAUSE_SYMETRIC;
-}
-
-/** Check the autonegotion state
- *
- *  @param[in]  dev            The device to check
- *  @param[out] advertisement  The device advertisement
- *  @param[out] their_adv      The partners advertisement
- *  @param[out] result         The autonegotion state
- *  @param[out] their_result   The link partner autonegotion status
- *
- *  @returns EOK
- */
-static errno_t rtl8139_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
-    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	uint16_t bmcr = pio_read_16(rtl8139->io_port + BMCR);
-	uint16_t anar = pio_read_16(rtl8139->io_port + ANAR);
-	uint16_t anar_lp = pio_read_16(rtl8139->io_port + ANLPAR);
-	uint16_t aner = pio_read_16(rtl8139->io_port + ANER);
-
-	if (bmcr & BMCR_AN_ENABLE) {
-		*result = NIC_RESULT_ENABLED;
-	} else {
-		*result = NIC_RESULT_DISABLED;
-	}
-
-	if (aner & ANER_LP_NW_ABLE) {
-		*their_result = NIC_RESULT_ENABLED;
-	} else {
-		*their_result = NIC_RESULT_DISABLED;
-	}
-
-	rtl8139_get_anar_state(anar, advertisement);
-	rtl8139_get_anar_state(anar_lp, their_adv);
-
-	return EOK;
-}
-
-/** Restart autonegotiation process
- *
- *  @param dev  The device to update
- *
- *  @returns EOK
- */
-static errno_t rtl8139_autoneg_restart(ddf_fun_t *fun)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	uint16_t bmcr = pio_read_16(rtl8139->io_port + BMCR);
-	bmcr |= BMCR_AN_RESTART;
-	bmcr |= BMCR_AN_ENABLE;
-
-	rtl8139_regs_unlock(rtl8139);
-	pio_write_16(rtl8139->io_port + BMCR, bmcr);
-	rtl8139_regs_lock(rtl8139);
-
-	return EOK;
-}
-
-/** Notify NIC framework about HW filtering state when promisc mode was disabled
- *
- *  @param nic_data     The NIC data
- *  @param mcast_mode   Current multicast mode
- *  @param was_promisc  Sign if the promiscuous mode was active before disabling
- */
-static void rtl8139_rcx_promics_rem(nic_t *nic_data,
-    nic_multicast_mode_t mcast_mode, uint8_t was_promisc)
-{
-	assert(nic_data);
-
-	if (was_promisc != 0) {
-		if (mcast_mode == NIC_MULTICAST_LIST)
-			nic_report_hw_filtering(nic_data, 1, 0, -1);
-		else
-			nic_report_hw_filtering(nic_data, 1, 1, -1);
-	} else {
-		nic_report_hw_filtering(nic_data, 1, -1, -1);
-	}
-}
-
-/** Set unicast frames acceptance mode
- *
- *  @param nic_data  The nic device to update
- *  @param mode      The mode to set
- *  @param addr      Ignored, no HW support, just use unicast promisc
- *  @param addr_cnt  Ignored, no HW support
- *
- *  @returns EOK
- */
-static errno_t rtl8139_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_cnt)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	uint8_t was_promisc = rtl8139->rcr_data.ucast_mask & RCR_ACCEPT_ALL_PHYS;
-
-	nic_multicast_mode_t mcast_mode;
-	nic_query_multicast(nic_data, &mcast_mode, 0, NULL, NULL);
-
-	switch (mode) {
-	case NIC_UNICAST_BLOCKED:
-		rtl8139->rcr_data.ucast_mask = 0;
-		rtl8139_rcx_promics_rem(nic_data, mcast_mode, was_promisc);
-		break;
-	case NIC_UNICAST_DEFAULT:
-		rtl8139->rcr_data.ucast_mask = RCR_ACCEPT_PHYS_MATCH;
-		rtl8139_rcx_promics_rem(nic_data, mcast_mode, was_promisc);
-		break;
-	case NIC_UNICAST_LIST:
-		rtl8139->rcr_data.ucast_mask = RCR_ACCEPT_PHYS_MATCH |
-		    RCR_ACCEPT_ALL_PHYS;
-
-		if (mcast_mode == NIC_MULTICAST_PROMISC)
-			nic_report_hw_filtering(nic_data, 0, 1, -1);
-		else
-			nic_report_hw_filtering(nic_data, 0, 0, -1);
-		break;
-	case NIC_UNICAST_PROMISC:
-		rtl8139->rcr_data.ucast_mask = RCR_ACCEPT_PHYS_MATCH |
-		    RCR_ACCEPT_ALL_PHYS;
-
-		if (mcast_mode == NIC_MULTICAST_PROMISC)
-			nic_report_hw_filtering(nic_data, 1, 1, -1);
-		else
-			nic_report_hw_filtering(nic_data, 1, 0, -1);
-		break;
-	default:
-		return ENOTSUP;
-	}
-	fibril_mutex_lock(&rtl8139->rx_lock);
-	rtl8139_hw_update_rcr(rtl8139);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-	return EOK;
-}
-
-/** Set multicast frames acceptance mode
- *
- *  @param nic_data  The nic device to update
- *  @param mode      The mode to set
- *  @param addr      Addresses to accept
- *  @param addr_cnt  Addresses count
- *
- *  @returns EOK
- */
-static errno_t rtl8139_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_count)
-{
-	assert(nic_data);
-	assert(addr_count == 0 || addr);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	switch (mode) {
-	case NIC_MULTICAST_BLOCKED:
-		rtl8139->rcr_data.mcast_mask = 0;
-		if ((rtl8139->rcr_data.ucast_mask & RCR_ACCEPT_ALL_PHYS) != 0)
-			nic_report_hw_filtering(nic_data, -1, 0, -1);
-		else
-			nic_report_hw_filtering(nic_data, -1, 1, -1);
-		break;
-	case NIC_MULTICAST_LIST:
-		rtl8139_hw_set_mcast_mask(rtl8139, nic_mcast_hash(addr, addr_count));
-		rtl8139->rcr_data.mcast_mask = RCR_ACCEPT_MULTICAST;
-		nic_report_hw_filtering(nic_data, -1, 0, -1);
-		break;
-	case NIC_MULTICAST_PROMISC:
-		rtl8139_hw_set_mcast_mask(rtl8139, RTL8139_MCAST_MASK_PROMISC);
-		rtl8139->rcr_data.mcast_mask = RCR_ACCEPT_MULTICAST;
-		nic_report_hw_filtering(nic_data, -1, 1, -1);
-		break;
-	default:
-		return ENOTSUP;
-	}
-	fibril_mutex_lock(&rtl8139->rx_lock);
-	rtl8139_hw_update_rcr(rtl8139);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-	return EOK;
-}
-
-/** Set broadcast frames acceptance mode
- *
- *  @param nic_data  The nic device to update
- *  @param mode      The mode to set
- *
- *  @returns EOK
- */
-static errno_t rtl8139_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	switch (mode) {
-	case NIC_BROADCAST_BLOCKED:
-		rtl8139->rcr_data.bcast_mask = 0;
-		break;
-	case NIC_BROADCAST_ACCEPTED:
-		rtl8139->rcr_data.bcast_mask = RCR_ACCEPT_BROADCAST;
-		break;
-	default:
-		return ENOTSUP;
-	}
-	fibril_mutex_lock(&rtl8139->rx_lock);
-	rtl8139_hw_update_rcr(rtl8139);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-	return EOK;
-}
-
-/** Get state of acceptance of weird frames
- *
- *  @param[in]  device  The device to check
- *  @param[out] mode    The current mode
- */
-static errno_t rtl8139_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
-{
-	assert(fun);
-	assert(mode);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	*mode = 0;
-	if (rtl8139->rcr_data.defect_mask & RCR_ACCEPT_ERROR)
-		*mode |= NIC_DEFECTIVE_BAD_CRC;
-	if (rtl8139->rcr_data.defect_mask & RCR_ACCEPT_RUNT)
-		*mode |= NIC_DEFECTIVE_SHORT;
-
-	return EOK;
-}
-
-/** Set acceptance of weird frames
- *
- *  @param device  The device to update
- *  @param mode    The mode to set
- *
- *  @returns ENOTSUP if the mode is not supported
- *  @returns EOK of mode was set
- */
-static errno_t rtl8139_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
-{
-	assert(fun);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	assert(rtl8139);
-
-	if ((mode & (NIC_DEFECTIVE_SHORT | NIC_DEFECTIVE_BAD_CRC)) != mode)
-		return ENOTSUP;
-
-	rtl8139->rcr_data.defect_mask = 0;
-	if (mode & NIC_DEFECTIVE_SHORT)
-		rtl8139->rcr_data.defect_mask |= RCR_ACCEPT_RUNT;
-	if (mode & NIC_DEFECTIVE_BAD_CRC)
-		rtl8139->rcr_data.defect_mask |= RCR_ACCEPT_ERROR;
-
-	fibril_mutex_lock(&rtl8139->rx_lock);
-	rtl8139_hw_update_rcr(rtl8139);
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-	return EOK;
-}
-
-/** Turn Wakeup On Lan method on
- *
- *  @param nic_data  The NIC to update
- *  @param virtue    The method to turn on
- *
- *  @returns EINVAL if the method is not supported
- *  @returns EOK if succeed
- *  @returns ELIMIT if no more methods of this kind can be enabled
- */
-static errno_t rtl8139_wol_virtue_add(nic_t *nic_data,
-    const nic_wol_virtue_t *virtue)
-{
-	assert(nic_data);
-	assert(virtue);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	switch (virtue->type) {
-	case NIC_WV_BROADCAST:
-		rtl8139_hw_reg_add_8(rtl8139, CONFIG5, CONFIG5_BROADCAST_WAKEUP);
-		break;
-	case NIC_WV_LINK_CHANGE:
-		rtl8139_regs_unlock(rtl8139->io_port);
-		rtl8139_hw_reg_add_8(rtl8139, CONFIG3, CONFIG3_LINK_UP);
-		rtl8139_regs_lock(rtl8139->io_port);
-		break;
-	case NIC_WV_MAGIC_PACKET:
-		if (virtue->data)
-			return EINVAL;
-		rtl8139_regs_unlock(rtl8139->io_port);
-		rtl8139_hw_reg_add_8(rtl8139, CONFIG3, CONFIG3_MAGIC);
-		rtl8139_regs_lock(rtl8139->io_port);
-		break;
-	default:
-		return EINVAL;
-	}
-	if (rtl8139->pm.active++ == 0)
-		rtl8139_hw_pmen_set(rtl8139, 1);
-	return EOK;
-}
-
-/** Turn Wakeup On Lan method off
- *
- *  @param nic_data  The NIC to update
- *  @param virtue    The method to turn off
- */
-static void rtl8139_wol_virtue_rem(nic_t *nic_data,
-    const nic_wol_virtue_t *virtue)
-{
-	assert(nic_data);
-	assert(virtue);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	switch (virtue->type) {
-	case NIC_WV_BROADCAST:
-		rtl8139_hw_reg_rem_8(rtl8139, CONFIG5, CONFIG5_BROADCAST_WAKEUP);
-		break;
-	case NIC_WV_LINK_CHANGE:
-		rtl8139_regs_unlock(rtl8139->io_port);
-		rtl8139_hw_reg_rem_8(rtl8139, CONFIG3, CONFIG3_LINK_UP);
-		rtl8139_regs_lock(rtl8139->io_port);
-		break;
-	case NIC_WV_MAGIC_PACKET:
-		rtl8139_regs_unlock(rtl8139->io_port);
-		rtl8139_hw_reg_rem_8(rtl8139, CONFIG3, CONFIG3_MAGIC);
-		rtl8139_regs_lock(rtl8139->io_port);
-		break;
-	default:
-		return;
-	}
-	rtl8139->pm.active--;
-	if (rtl8139->pm.active == 0)
-		rtl8139_hw_pmen_set(rtl8139, 0);
-}
-
-/** Set polling mode
- *
- *  @param device  The device to set
- *  @param mode    The mode to set
- *  @param period  The period for NIC_POLL_PERIODIC
- *
- *  @returns EOK if succeed
- *  @returns ENOTSUP if the mode is not supported
- */
-static errno_t rtl8139_poll_mode_change(nic_t *nic_data, nic_poll_mode_t mode,
-    const struct timespec *period)
-{
-	assert(nic_data);
-	errno_t rc = EOK;
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	fibril_mutex_lock(&rtl8139->rx_lock);
-
-	switch (mode) {
-	case NIC_POLL_IMMEDIATE:
-		rtl8139->int_mask = RTL_DEFAULT_INTERRUPTS;
-		break;
-	case NIC_POLL_ON_DEMAND:
-		rtl8139->int_mask = 0;
-		break;
-	case NIC_POLL_PERIODIC:
-		assert(period);
-
-		rtl8139_timer_act_t new_timer;
-		rc = rtl8139_timer_act_init(&new_timer, RTL8139_PCI_FREQ_KHZ, period);
-		if (rc != EOK)
-			break;
-
-		/* Disable timer interrupts while working with timer-related data */
-		rtl8139->int_mask = 0;
-		rtl8139_hw_int_set(rtl8139);
-
-		rtl8139->poll_timer = new_timer;
-		rtl8139->int_mask = INT_TIME_OUT;
-
-		/*
-		 * Force timer interrupt start be writing nonzero value to timer
-		 * interrutp register (should be small to prevent big delay)
-		 * Read TCTR to reset timer counter
-		 * Change values to simulate the last interrupt from the period.
-		 */
-		pio_write_32(rtl8139->io_port + TIMERINT, 10);
-		pio_write_32(rtl8139->io_port + TCTR, 0);
-
-		ddf_msg(LVL_DEBUG, "Periodic mode. Interrupt mask %" PRIx16 ", "
-		    "poll.full_skips %zu, last timer %" PRIu32,
-		    rtl8139->int_mask, rtl8139->poll_timer.full_skips,
-		    rtl8139->poll_timer.last_val);
-		break;
-	default:
-		rc = ENOTSUP;
-		break;
-	}
-
-	rtl8139_hw_int_set(rtl8139);
-
-	fibril_mutex_unlock(&rtl8139->rx_lock);
-
-	return rc;
-}
-
-/** Force receiving all frames in the receive buffer
- *
- *  @param device  The device to receive
- */
-static void rtl8139_poll(nic_t *nic_data)
-{
-	assert(nic_data);
-
-	rtl8139_t *rtl8139 = nic_get_specific(nic_data);
-	assert(rtl8139);
-
-	uint16_t isr = pio_read_16(rtl8139->io_port + ISR);
-	pio_write_16(rtl8139->io_port + ISR, 0);
-
-	rtl8139_interrupt_impl(nic_data, isr);
-}
-
-/** Main function of RTL8139 driver
- *
- *  Just initialize the driver structures and
- *  put it into the device drivers interface
- */
-int main(void)
-{
-	printf("%s: HelenOS RTL8139 network adapter driver\n", NAME);
-
-	errno_t rc = nic_driver_init(NAME);
-	if (rc != EOK)
-		return rc;
-
-	nic_driver_implement(&rtl8139_driver_ops, &rtl8139_dev_ops,
-	    &rtl8139_nic_iface);
-
-	ddf_log_init(NAME);
-	return ddf_driver_main(&rtl8139_driver);
-}
Index: pace/drv/nic/rtl8139/driver.h
===================================================================
--- uspace/drv/nic/rtl8139/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,246 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTL8139_DRIVER_H_
-#define RTL8139_DRIVER_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include "defs.h"
-#include "general.h"
-
-/** The driver name */
-#define NAME  "rtl8139"
-
-/** Transmittion buffers count */
-#define TX_BUFF_COUNT  4
-
-/** Size of buffer for one frame (2kB) */
-#define TX_BUFF_SIZE  (2 * 1024)
-
-/** Number of pages to allocate for TxBuffers */
-#define TX_PAGES  2
-
-/** Size of the CRC after the received frame in the receiver buffer */
-#define RTL8139_CRC_SIZE  4
-
-/** The default mode of accepting unicast frames */
-#define RTL8139_RCR_UCAST_DEFAULT  RCR_ACCEPT_PHYS_MATCH
-
-/** The default mode of accepting multicast frames */
-#define RTL8139_RCR_MCAST_DEFAULT  0
-
-/** The default mode of accepting broadcast frames */
-#define RTL8139_RCR_BCAST_DEFAULT  RCR_ACCEPT_BROADCAST
-
-/** The default mode of accepting defect frames */
-#define RTL8139_RCR_DEFECT_DEFAULT  0
-
-/** Mask for accepting all multicast */
-#define RTL8139_MCAST_MASK_PROMISC  UINT64_MAX
-
-/** Data */
-struct rtl8139_rcr_data {
-	/** Configuration part of RCR */
-	uint32_t rcr_base;
-	/** Mask of unicast  */
-	uint8_t ucast_mask;
-	/** Mask of multicast */
-	uint8_t mcast_mask;
-	/** Mask of broadcast */
-	uint8_t bcast_mask;
-	/** Mask of defective */
-	uint8_t defect_mask;
-};
-
-/** Power management related data */
-typedef struct rtl8139_pm {
-	/** Count of used activities which needs PMEn bit set */
-	int active;
-} rtl8139_pm_t;
-
-/** RTL8139 device data */
-typedef struct rtl8139_data {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** Parent session */
-	async_sess_t *parent_sess;
-	/** I/O address of the device */
-	void *io_addr;
-	/** Mapped I/O port */
-	void *io_port;
-	/** The irq assigned */
-	int irq;
-
-	/** Mask of the turned interupts (IMR value) */
-	uint16_t int_mask;
-
-	/** The memory allocated for the transmittion buffers
-	 *  Each buffer takes 2kB
-	 */
-	uintptr_t tx_buff_phys;
-	void *tx_buff_virt;
-
-	/** Virtual addresses of the Tx buffers */
-	void *tx_buff[TX_BUFF_COUNT];
-
-	/** The nubmer of the next buffer to use, index = tx_next % TX_BUFF_COUNT */
-	size_t tx_next;
-	/** The number of the first used buffer in the row
-	 *
-	 *  tx_used is in the interval tx_next - TX_BUFF_COUNT and tx_next:
-	 *  	tx_next - TX_BUFF_COUNT: there is no useable Tx descriptor
-	 *  	tx_next: all Tx descriptors are can be used
-	 */
-	size_t tx_used;
-
-	/** Buffer for receiving frames */
-	uintptr_t rx_buff_phys;
-	void *rx_buff_virt;
-
-	/** Receiver control register data */
-	struct rtl8139_rcr_data rcr_data;
-
-	/** Power management information */
-	rtl8139_pm_t pm;
-
-	/** Lock for receiver */
-	fibril_mutex_t rx_lock;
-	/** Lock for transmitter */
-	fibril_mutex_t tx_lock;
-
-	/** Polling mode information */
-	rtl8139_timer_act_t poll_timer;
-
-	/** Backward pointer to nic_data */
-	nic_t *nic_data;
-
-	/** Version of RT8139 controller */
-	rtl8139_version_id_t hw_version;
-} rtl8139_t;
-
-/*
- * Pointers casting - for both amd64 and ia32
- */
-
-/** Cast pointer to uint32_t
- *
- *  @param ptr The pointer to cast
- *  @return The uint32_t pointer representation. The low 32 bit is taken
- *  in the case of the 64 bit pointers
- */
-#define PTR2U32(ptr) ((uint32_t)((size_t)(ptr)))
-
-/** Check if the pointer can be cast to uint32_t without the data lost
- *
- *  @param ptr The pointer to check
- *  @return The true value if the pointer can be cast, false if not
- */
-#define PTR_IS_32(ptr) ((size_t)PTR2U32(ptr) == (size_t)(ptr))
-
-/** Cast the ioaddr part to the void*
- *
- *  @param ioaddr The ioaddr value
- */
-#define IOADDR_TO_PTR(ioaddr) ((void*)((size_t)(ioaddr)))
-
-/* ***** Bit operation macros ***** */
-
-/** Set the bits specified by the given bit mask to the different values
- *
- * The bit from the src is used if the corresponding bit in the mask is 0,
- * the bit from the value is used if the corresponding bit in the mask is 1
- *
- * @param src The original value
- * @param value The new bit value
- * @param mask The mask to specify modified bits
- * @param type The values type
- *
- * @return New value
- */
-#define bit_set_part_g(src, value, mask, type) \
-	((type)(((src) & ~((type)(mask))) | ((value) & (type)(mask))))
-
-/** Set the bits specified by the given bit mask to the different values
- *
- * The version of the uint32_t
- *
- * @see bit_set_part_g
- */
-
-#define bit_set_part_32(src, value, mask) bit_set_part_g(src, value, mask, uint32_t)
-/** Set the bits specified by the given bit mask to the different values
- *
- * The version of the uint16_t
- *
- * @see bit_set_part_g
- */
-
-#define bit_set_part_16(src, value, mask) bit_set_part_g(src, value, mask, uint16_t)
-
-/** Set the bits specified by the given bit mask to the different values
- *
- * The version of the uint8_t
- *
- * @see bit_set_part_g
- */
-#define bit_set_part_8(src, value, mask) bit_set_part_g(src, value, mask, uint8_t)
-
-/** Clear specified bits in the value
- *
- * @param src Original value
- * @param clear_mask Bits to clear mask
- * @param type The values type
- */
-#define bit_clear_g(src, clear_mask, type) ((type)((src) & ~((type)(clear_mask))))
-
-/** Clear specified bits in the value, 32bit version
- *
- *  @see bit_clear_g
- */
-#define bit_clear_32(src, clear_mask) bit_clear_g(src, clear_mask, uint32_t)
-/** Clear specified bits in the value, 16bit version
- *
- *  @see bit_clear_g
- */
-#define bit_clear_16(src, clear_mask) bit_clear_g(src, clear_mask, uint16_t)
-/** Clear specified bits in the value, 8bit version
- *
- *  @see bit_clear_g
- */
-#define bit_clear_8(src, clear_mask) bit_clear_g(src, clear_mask, uint8_t)
-
-/** Obtain value of the TSD register with size part modified
- *
- *  @param tsd_value Old value of the TSD
- *  @param size The size to set
- */
-#define rtl8139_tsd_set_size(tsd_value, size) \
-	bit_set_part_32(tsd_value, (size) << TSD_SIZE_SHIFT, TSD_SIZE_MASK << TSD_SIZE_SHIFT)
-
-#endif
Index: pace/drv/nic/rtl8139/general.c
===================================================================
--- uspace/drv/nic/rtl8139/general.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- *  General functions and structures used in rtl8139 driver
- */
-
-#include "general.h"
-
-#include <mem.h>
-#include <errno.h>
-#include <stdint.h>
-
-/** Copy block of the memory from wrapped source buffer.
- *
- * Start on the specific offset in the source buffer and * copy data_size bytes
- * - continue from the buffer start after getting the end
- *
- * @param dest        The destination memory
- * @param src_begin   The begin of the source buffer
- * @param src_offset  The offset in the source buffer to start copy
- * @param src_size    The source buffer size
- * @param data_size   The amount of data to copy
- *
- * @return NULL if the error occures, dest if succeed
- */
-void *rtl8139_memcpy_wrapped(void *dest, const void *src, size_t src_offset,
-    size_t src_size, size_t data_size)
-{
-	src_offset %= src_size;
-	if (data_size > src_size)
-		return NULL;
-
-	size_t to_src_end = src_size - src_offset;
-	if (data_size <= to_src_end) {
-		return memcpy(dest, src + src_offset, data_size);
-	}
-
-	size_t rem_size = data_size - to_src_end;
-
-	/*
-	 * First copy the end part of the data (from the source begining),
-	 * then copy the begining
-	 */
-	memcpy(dest + to_src_end, src, rem_size);
-	return memcpy(dest, src + src_offset, to_src_end);
-}
-
-/** Initialize the timer register structures
- *
- *  The structure will be initialized to the state that the first call of
- *  rtl8139_timer_act_step function will be the period expiration
- *
- *  @param ta          The timer structure
- *  @param timer_freq  The timer frequency in kHz
- *  @param time        The requested time
- *
- *  @return EOK if succeed, error code otherwise
- */
-errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *ta, uint32_t timer_freq,
-    const struct timespec *time)
-{
-	if (!ta || timer_freq == 0 || !time)
-		return EINVAL;
-	memset(ta, 0, sizeof(rtl8139_timer_act_t));
-
-	uint32_t tics_per_ms = timer_freq;
-	uint32_t seconds_in_reg = UINT32_MAX / (tics_per_ms * 1000);
-	ta->full_val = seconds_in_reg * tics_per_ms * 1000;
-
-	struct timespec remains = *time;
-	ta->full_skips = remains.tv_sec / seconds_in_reg;
-	remains.tv_sec = remains.tv_sec % seconds_in_reg;
-
-	if (NSEC2USEC(remains.tv_nsec) > RTL8139_USEC_IN_SEC) {
-		remains.tv_sec += NSEC2USEC(remains.tv_nsec) / RTL8139_USEC_IN_SEC;
-		remains.tv_nsec = NSEC2USEC(remains.tv_nsec) % RTL8139_USEC_IN_SEC;
-
-		/* it can be increased above seconds_in_reg again */
-		ta->full_skips += remains.tv_sec / seconds_in_reg;
-		remains.tv_sec = remains.tv_sec % seconds_in_reg;
-	}
-
-	ta->last_val = SEC2MSEC(remains.tv_sec) + NSEC2MSEC(remains.tv_nsec);
-	ta->last_val *= tics_per_ms;
-
-	/* Force inital setting in the next step */
-	ta->full_skips_remains = 0;
-	ta->last_run = 1;
-	return EOK;
-}
-
-/** Make one step timer step
- *
- *  @param ta            Timer structure
- *  @param new_reg[out]  Register value to set
- *
- *  @return Nonzero if whole period expired, zero if part of period expired
- */
-int rtl8139_timer_act_step(rtl8139_timer_act_t *ta, uint32_t *new_reg)
-{
-	uint32_t next_val = 0;
-	int expired = 0;
-
-	if (ta->last_run || (ta->last_val == 0 && ta->full_skips_remains == 0)) {
-		ta->full_skips_remains = ta->full_skips;
-		ta->last_run = 0;
-		expired = 1;
-	}
-
-	if (ta->full_skips_remains > 0) {
-		next_val = ta->full_val;
-		ta->full_skips_remains--;
-	} else {
-		next_val = ta->last_val;
-		ta->last_run = 1;
-	}
-
-	if (new_reg)
-		*new_reg = next_val;
-
-	return expired;
-}
Index: pace/drv/nic/rtl8139/general.h
===================================================================
--- uspace/drv/nic/rtl8139/general.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * General functions and structures used in rtl8139 driver
- */
-
-#ifndef RTL8139_GENERAL_H_
-#define RTL8139_GENERAL_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <time.h>
-
-/** Number of microseconds in second */
-#define RTL8139_USEC_IN_SEC  1000000
-
-/** Structure for HW timer control */
-typedef struct {
-	/** Register value set in the last timer period */
-	uint32_t last_val;
-
-	/** Register value set in the common timer period */
-	uint32_t full_val;
-
-	/** Amount of full register periods in timer period */
-	size_t full_skips;
-
-	/** Remaining full register periods to the next period end */
-	size_t full_skips_remains;
-
-	/** Mark if there is a last run */
-	int last_run;
-} rtl8139_timer_act_t;
-
-extern void *rtl8139_memcpy_wrapped(void *, const void *, size_t, size_t,
-    size_t);
-extern errno_t rtl8139_timer_act_init(rtl8139_timer_act_t *, uint32_t,
-    const struct timespec *);
-extern int rtl8139_timer_act_step(rtl8139_timer_act_t *, uint32_t *);
-
-#endif
Index: pace/drv/nic/rtl8139/meson.build
===================================================================
--- uspace/drv/nic/rtl8139/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nic' ]
-src = files(
-	'driver.c',
-	'general.c',
-	'defs.c',
-)
Index: pace/drv/nic/rtl8139/rtl8139.ma
===================================================================
--- uspace/drv/nic/rtl8139/rtl8139.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 pci/ven=10ec&dev=8139
Index: pace/drv/nic/rtl8169/defs.h
===================================================================
--- uspace/drv/nic/rtl8169/defs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,338 +1,0 @@
-/*
- * Copyright (c) 2014 Agnieszka Tabaka
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file rtl8169_defs.h
- *
- * Registers, bit positions and masks definition
- * of the RTL8169 network family cards
- */
-
-#ifndef RTL8169_DEFS_H_
-#define RTL8169_DEFS_H_
-
-#include <stdint.h>
-#include <ddi.h>
-
-#define	PCI_VID_REALTEK		0x10ec
-#define	PCI_VID_DLINK		0x1186
-
-/** Size of RTL8169 registers address space */
-#define RTL8169_IO_SIZE  256
-
-#define	RTL8169_FRAME_MAX_LENGTH	1518
-
-/** Registers of RTL8169 family card offsets from the memory address base */
-enum rtl8169_registers {
-	IDR0 = 0x00, /**< First MAC address bit, 6 1b registres sequence */
-	MAC0 = IDR0, /**< Alias for IDR0 */
-	/* 0x06 - 0x07 reserved */
-	MAR0 = 0x08, /**< Multicast mask registers 8 1b registers sequence */
-	DTCCR = 0x10, /**< Dump Tally Counter Command Register */
-	TNPDS = 0x20, /**< Transmit Normal Priority Descriptors */
-	THPDS = 0x28, /**< Transmit High Priority Descriptors */
-	FLASH = 0x30, /**< Flash memory read/write register */
-	ERBCR = 0x34, /**< Early Receive Byte Count Register */
-	ERSR = 0x36, /**< Early Rx Status Register */
-	CR = 0x37, /**< Command register, 1b */
-	TPPOLL = 0x38, /**< Transmit Priority Polling Register */
-	CBA = 0x3a, /**< Current buffer address, 2b */
-	IMR = 0x3c, /**< Interrupt mask register, 2b */
-	ISR = 0x3e, /**< Interrupt status register, 2b */
-	TCR = 0x40, /**< Transmit (Tx) configuration register, 4b */
-	RCR = 0x44, /**< Receive (Rx) configuration register, 4b */
-	TCTR = 0x48, /**< Timer count register */
-	MPC = 0x4c, /**< Missed packet count */
-	CR9346 = 0x50, /**< 93C46 command register (locking of registers) */
-	CONFIG0 = 0x51,	/**< Configuration register 0, 1b */
-	CONFIG1 = 0x52,	/**< Configuration register 1, 1b */
-	CONFIG2 = 0x53, /**< Configuration register 2, 1b */
-	CONFIG3 = 0x54,	/**< Configuration register 3, 1b */
-	CONFIG4 = 0x55, /**< Configuration register 4, 1b */
-	CONFIG5 = 0x56,	/**< Configuration register 5, 1b */
-	/* 0x57 reserved */
-	TIMINT = 0x58, /**< Timer interrupt register, 4b */
-	MULINT = 0x58, /**< Multiple interrupt select, 4b */
-	/* 0x5e-0x5f reserved */
-	PHYAR = 0x60, /**< PHY Access Register, 4b */
-	TBICSR0 = 0x64,	/**< TBI Control and Status Register, 4b */
-	TBI_ANAR = 0x58, /**< TBI Auto-Negotiation Advertisement Register, 2b */
-	TBI_LPAR = 0x6a, /**< TBI Auto-Negotiation Link Partner Ability Register, 2b */
-	PHYSTATUS = 0x6c, /**< PHY Status Register */
-	/* 0x6d-0x83 reserved */
-	WAKEUP0	 = 0x84, /**< Power Management Wakeup frame0, 8b */
-	WAKEUP1	 = 0x8c, /**< Power Management Wakeup frame1, 8b */
-	WAKEUP2LD = 0x94, /**< Power Management Wakeup frame2 low dword, 8b */
-	WAKEUP2HD = 0x9c, /**< Power Management Wakeup frame2 high dword, 8b */
-	WAKEUP3LD = 0xa4, /**< Power Management Wakeup frame3 low dword, 8b */
-	WAKEUP3HD = 0xac, /**< Power Management Wakeup frame3 high dword, 8b */
-	WAKEUP4LD = 0xb4, /**< Power Management Wakeup frame4 low dword, 8b */
-	WAKEUP4HD = 0xbc, /**< Power Management Wakeup frame4 high dword, 8b */
-	CRC0 = 0xc4, /**< 16-bit CRC of wakeup frame 0, 2b */
-	CRC1 = 0xc6, /**< 16-bit CRC of wakeup frame 1, 2b */
-	CRC2 = 0xc8, /**< 16-bit CRC of wakeup frame 2, 2b */
-	CRC3 = 0xca, /**< 16-bit CRC of wakeup frame 3, 2b */
-	CRC4 = 0xcc, /**< 16-bit CRC of wakeup frame 4, 2b */
-	/* 0xce - 0xd9 reserved */
-	RMS = 0xda, /**< Rx packet Maximum Size, 2b */
-	/* 0xdc - 0xdf reserved */
-	CCR = 0xe0, /**< C+ Command Register */
-	/* 0xe2 - 0xe3 reserved */
-	RDSAR = 0xe4, /**< Receive Descriptor Start Address Register, 8b */
-	ETTHR = 0xec, /**< Early Transmit Threshold Register, 1b */
-	/* 0xed - 0xef reserved */
-	FER = 0xf0, /**< Function Event Register, 4b */
-	FEMR = 0xf4, /**< Function Event Mask Register, 4b */
-	FPSR = 0xf8, /**< Function Preset State Register, 4b */
-	FFER = 0xfc, /**< Function Force Event Register, 4b */
-};
-
-enum rtl8169_mii_registers {
-	MII_BMCR = 0x00,
-	MII_BMSR = 0x01,
-	MII_ANAR = 0x04,
-};
-
-/** Command register bits */
-enum rtl8169_cr {
-	CR_TE = (1 << 2), /**< Transmitter enable bit */
-	CR_RE = (1 << 3), /**< Receiver enable bit */
-	CR_RST = (1 << 4), /**< Reset -  set to 1 to force software reset */
-};
-
-/** Config1 register bits */
-enum rtl8169_config1 {
-	CONFIG1_LEDS_SHIFT = 6, /**< Shift of CONFIG1_LEDS bits */
-	CONFIG1_LEDS_SIZE = 2, /**< Size of CONFIG1_LEDS bits */
-	CONFIG1_DVRLOAD = (1 << 5), /**< Driver load */
-	CONFIG1_LWACT = (1 << 4), /**< LWAKE active mode */
-	CONFIG1_MEMMAP = (1 << 3), /**< Memory mapping  */
-	CONFIG1_IOMAP = (1 << 2), /**< I/O space mapping */
-	CONFIG1_VPD = (1 << 1), /**< Set to enable Vital Product Data */
-	CONFIG1_PMEn = (1 << 0) /**< Power management enabled */
-};
-
-enum rtl8169_config2 {
-	CONFIG2_AUXSTATUS = (1 << 4), /**< Auxiliary Power Present Status */
-	CONFIG2_PCIBUSWIDTH = (1 << 3), /**< PCI Bus Width */
-	CONFIG2_PCICLKF_SHIFT = 0,
-	CONFIG2_PCICLKF_SIZE = 2
-};
-
-enum rtl8169_config3 {
-	CONFIG3_GNT_SELECT = (1 << 7), /**< Gnt select */
-	CONFIG3_PARM_EN = (1 << 6), /**< Parameter enabled (100MBit mode) */
-	CONFIG3_MAGIC = (1 << 5), /**< WoL Magic frame enable */
-	CONFIG3_LINK_UP = (1 << 4), /**< Wakeup if link is reestablished */
-	CONFIG3_CLKRUN_EN = (1 << 2), /**< CLKRUN enabled */ /* TODO: check what does it mean */
-	CONFIG3_FBTBEN = (1 << 0), /**< Fast back to back enabled */
-};
-
-enum rtl8169_config4 {
-	CONFIG4_RxFIFOAutoClr = (1 << 7), /**< Automatic RxFIFO owerflow clear */
-	CONFIG4_AnaOff = (1 << 6), /**< Analog poweroff */
-	CONFIG4_LongWF = (1 << 5), /**< Long wakeup frame */
-	CONFIG4_LWPME = (1 << 4), /**< LWAKE and PMEB assertion  */
-	CONFIG4_LWPTN = (1 << 2), /**< LWake pattern */
-	CONFIG4_PBWakeup = (1 << 0), /**< Preboot wakeup */
-};
-
-enum rtl8169_config5 {
-	CONFIG5_BROADCAST_WAKEUP = (1 << 6), /**< Broadcast wakeup frame enable */
-	CONFIG5_MULTICAST_WAKEUP = (1 << 5), /**< Multicast wakeup frame enable */
-	CONFIG5_UNICAST_WAKEUP = (1 << 4), /**< Unicast wakeup frame enable */
-	/* Bits 3-2 reserved */
-	CONFIG5_LAN_WAKE = (1 << 1), /**< LANWake signal enabled */
-	CONFIG5_PME_STATUS = (1 << 0), /**< PMEn change: 0 = SW, 1 = SW+PCI */
-};
-
-/** Interrupt_masks
- *
- *  The masks are the same for both IMR and ISR
- */
-enum rtl8169_interrupts {
-	INT_SERR = (1 << 15), /**< System error interrupt */
-	INT_TIME_OUT = (1 << 14), /**< Time out interrupt */
-	/* Bits 9 - 13 reserved */
-	INT_SW = (1 << 8), /**< Software Interrupt */
-	INT_TDU = (1 << 7), /**< Tx Descriptor Unvailable */
-	INT_FIFOOVW = (1 << 6), /**< Receiver FIFO overflow interrupt */
-	INT_PUN = (1 << 5), /**< Packet Underrun/Link Change Interrupt  */
-	INT_RXOVW = (1 << 4), /**< Receiver buffer overflow */
-	INT_TER = (1 << 3), /**< Transmit error interrupt */
-	INT_TOK = (1 << 2), /**< Transmit OK interrupt */
-	INT_RER = (1 << 1), /**< Receive error interrupt */
-	INT_ROK = (1 << 0), /**< Receive OK interrupt */
-	INT_KNOWN = (INT_SERR | INT_TIME_OUT | INT_SW | INT_TDU |
-	    INT_FIFOOVW | INT_PUN | INT_RXOVW | INT_TER |
-	    INT_TOK | INT_RER | INT_ROK),
-};
-
-/** Transmit status descriptor registers bits */
-enum rtl8169_tsd {
-	TSD_CRS = (1 << 31), /**< Carrier Sense Lost */
-	TSD_TABT = (1 << 30), /**< Transmit Abort */
-	TSD_OWC = (1 << 29), /**< Out of Window Collision */
-	TSD_CDH = (1 << 28), /**< CD Heart Beat */
-	TSD_NCC_SHIFT = 24, /**< Collision Count - bit shift */
-	TSD_NCC_SIZE = 4, /**< Collision Count - bit size */
-	TSD_NCC_MASK = (1 << 4) - 1, /**< Collision Count - bit size */
-	TSD_ERTXTH_SHIFT = 16, /**< Early Tx Threshold - bit shift */
-	TSD_ERTXTH_SIZE = 6, /**< Early Tx  Treshold - bit size */
-	TSD_TOK = (1 << 15), /**< Transmit OK */
-	TSD_TUN = (1 << 14), /**< Transmit FIFO Underrun */
-	TSD_OWN = (1 << 13), /**< OWN */
-	TSD_SIZE_SHIFT = 0, /**< Size - bit shift */
-	TSD_SIZE_SIZE = 13, /**< Size - bit size */
-	TSD_SIZE_MASK = 0x1fff, /**< Size - bit mask */
-};
-
-/** Receiver control register values */
-enum rtl8169_rcr {
-	RCR_MulERINT = 1 << 24,    /**< Multiple early interrupt select */
-	/* Bits 23-17 reserved */
-	RCR_RER8 = 1 << 16,
-	RCR_RXFTH_SHIFT = 13, /**< Rx FIFO treshold part shitf */
-	RCR_RXFTH_SIZE = 3, /**< Rx FIFO treshold part size */
-	/* Bits 12-11 reserved */
-	RCR_MXDMA_SHIFT = 8, /**< Max DMA Burst Size part shift */
-	RCR_MXDMA_SIZE  = 3, /**< Max DMA Burst Size part size */
-	/* Bit 7 reserved */
-	RCR_ACCEPT_ERROR = 1 << 5, /**< Accept error frame */
-	RCR_ACCEPT_RUNT = 1 << 4, /**< Accept Runt (8-64 bytes) frames */
-	RCR_ACCEPT_BROADCAST = 1 << 3, /**< Accept broadcast */
-	RCR_ACCEPT_MULTICAST = 1 << 2, /**< Accept multicast */
-	RCR_ACCEPT_PHYS_MATCH = 1 << 1, /**< Accept device MAC address match */
-	RCR_ACCEPT_ALL_PHYS = 1 << 0, /**< Accept all frames with phys. desticnation */
-	RCR_ACCEPT_MASK = (1 << 6) - 1   /**< Mask of accept part */
-};
-
-enum rtl8169_cr9346 {
-	CR9346EEM1_SHIFT = 6, /**< RTL8169 operating mode shift */
-	CR9346EEM1_SIZE = 2, /**< RTL8169 operating mode mask */
-	/* Bits 5-4 reserved */
-	EECS = (1 << 3), /**< EECS pin of 93C46 */
-	EESK = (1 << 2), /**< EESK pin of 93C46 */
-	EEDI = (1 << 1), /**< EEDI pin of 93C46 */
-	EEDO = (1 << 0), /**< EEDO pin of 93C46 */
-};
-
-/** Auto-negotiation advertisement register */
-enum rtl8169_anar {
-	ANAR_NEXT_PAGE = (1 << 15), /**< Next page bit, 0 - primary capability */
-	ANAR_ACK = (1 << 14), /**< Capability reception acknowledge */
-	ANAR_REMOTE_FAULT = (1 << 13), /**< Remote fault detection capability */
-	ANAR_PAUSE = (1 << 10), /**< Symetric pause frame capability */
-	ANAR_100T4 = (1 << 9), /**< T4, not supported by the device */
-	ANAR_100TX_FD = (1 << 8), /**< 100BASE_TX full duplex */
-	ANAR_100TX_HD = (1 << 7), /**< 100BASE_TX half duplex */
-	ANAR_10_FD = (1 << 6), /**< 10BASE_T full duplex */
-	ANAR_10_HD = (1 << 5), /**< 10BASE_T half duplex */
-	ANAR_SELECTOR = 0x1, /**< Selector */
-};
-
-enum rtl8169_phystatus {
-	PHYSTATUS_TBIEN = (1 << 7), /**< TBI enabled */
-	PHYSTATUS_TXFLOW = (1 << 6), /**< TX flow control enabled */
-	PHYSTATUS_RXFLOW = (1 << 5), /**< RX flow control enabled */
-	PHYSTATUS_1000M = (1 << 4), /**< Link speed is 1000Mbit/s */
-	PHYSTATUS_100M = (1 << 3), /**< Link speed is 100Mbit/s */
-	PHYSTATUS_10M = (1 << 2), /**< Link speed is 10Mbit/s */
-	PHYSTATUS_LINK = (1 << 1), /**< Link up */
-	PHYSTATUS_FDX = (1 << 0), /**< Link is full duplex */
-};
-
-enum rtl8169_tppoll {
-	TPPOLL_HPQ = (1 << 7), /**< Start transmit on high priority queue */
-	TPPOLL_NPQ = (1 << 6), /**< Start transmit on normal queue */
-	/* Bits 5-1 reserved */
-	TPPOLL_FSWINT = (1 << 0), /** < Generate software interrupt */
-};
-
-enum rtl8169_phyar {
-	PHYAR_RW_SHIFT = 31, /**< Read (0) or write (1) command */
-	PHYAR_RW_READ = (0 << PHYAR_RW_SHIFT),
-	PHYAR_RW_WRITE = (1 << PHYAR_RW_SHIFT),
-	PHYAR_ADDR_SHIFT = 15,
-	PHYAR_ADDR_MASK = 0x1f,
-	PHYAR_DATA_MASK = 0xffff
-};
-
-enum rtl8169_bmcr {
-	BMCR_RESET = (1 << 15), /**< Software reset */
-	BMCR_SPD_100 = (1 << 13), /**< 100 MBit mode set */
-	BMCR_AN_ENABLE = (1 << 12), /**< Autonegotion enable */
-	BMCR_AN_RESTART = (1 << 9), /**< Restart autonegotion */
-	BMCR_DUPLEX = (1 << 8), /**< Duplex mode: 1=full duplex */
-	BMCR_SPD_1000 = (1 << 6), /**< 1000 Mbit mode set */
-};
-
-enum rtl8169_descr_control {
-	CONTROL_OWN = (1 << 31), /**< Descriptor ownership */
-	CONTROL_EOR = (1 << 30), /**< End Of Ring marker */
-	CONTROL_FS = (1 << 29), /**< First Segment marker */
-	CONTROL_LS = (1 << 28), /**< Last Segment marker */
-	CONTROL_LGSEN = (1 << 27), /**< Large send enable */
-	CONTROL_MSS_SHIFT = 16,
-	CONTROL_MSS_MASK = 10,
-	CONTROL_FRAMELEN_MASK = 0xffff
-};
-
-enum rtl8169_descr_txstatus {
-	TXSTATUS_UNDERRUN = (1 << 25),
-	TXSTATUS_TXERRSUM = (1 << 23),
-	TXSTATUS_OWINCOL = (1 << 22),
-	TXSTATUS_LINKFAIL = (1 << 21),
-	TXSTATUS_EXCESSCOL = (1 << 20)
-};
-
-enum rtl8169_descr_rxstatus {
-	RXSTATUS_MAR = (1 << 27),
-	RXSTATUS_PAM = (1 << 26),
-	RXSTATUS_BAR = (1 << 25),
-	RXSTATUS_BOVF = (1 << 24),
-	RXSTATUS_FOVF = (1 << 23),
-	RXSTATUS_RWT = (1 << 22),
-	RXSTATUS_RES = (1 << 21),
-	RXSTATUS_RUNT = (1 << 20),
-	RXSTATUS_CRC = (1 << 19),
-	RXSTATUS_PID1 = (1 << 18),
-	RXSTATUS_PID0 = (1 << 17),
-	RXSTATUS_IPF = (1 << 16),
-	RXSTATUS_UDPF = (1 << 15),
-	RXSTATUS_TCPF = (1 << 14)
-};
-
-typedef struct rtl8169_descr {
-	uint32_t	control;
-	uint32_t	vlan;
-	uint32_t	buf_low;
-	uint32_t	buf_high;
-} rtl8169_descr_t;
-
-#endif
Index: pace/drv/nic/rtl8169/driver.c
===================================================================
--- uspace/drv/nic/rtl8169/driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1243 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2014 Agnieszka Tabaka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <align.h>
-#include <byteorder.h>
-#include <barrier.h>
-#include <stdbool.h>
-
-#include <as.h>
-#include <ddf/log.h>
-#include <ddf/interrupt.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <io/log.h>
-#include <nic.h>
-#include <pci_dev_iface.h>
-
-#include <str.h>
-
-#include "defs.h"
-#include "driver.h"
-
-/** Global mutex for work with shared irq structure */
-FIBRIL_MUTEX_INITIALIZE(irq_reg_lock);
-
-static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr);
-static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info);
-static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state);
-static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role);
-static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
-    nic_channel_mode_t duplex, nic_role_t role);
-static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
-    nic_result_t *we_receive, uint16_t *time);
-static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
-    uint16_t time);
-static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement);
-static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun);
-static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
-    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result);
-static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun);
-static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode);
-static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode);
-static errno_t rtl8169_on_activated(nic_t *nic_data);
-static errno_t rtl8169_on_stopped(nic_t *nic_data);
-static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size);
-static void rtl8169_irq_handler(ipc_call_t *icall, void *);
-static inline errno_t rtl8169_register_int_handler(nic_t *nic_data,
-    cap_irq_handle_t *handle);
-static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr);
-static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr);
-
-static void rtl8169_reset(rtl8169_t *rtl8169);
-static errno_t rtl8169_get_resource_info(ddf_dev_t *dev);
-static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t *hw_resources);
-static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev);
-
-static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
-    const nic_address_t *, size_t);
-static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_count);
-static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode);
-
-static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr);
-static void rtl8169_mii_write(rtl8169_t *rtl8169, uint8_t addr, uint16_t value);
-static void rtl8169_rx_ring_refill(rtl8169_t *rtl8169, unsigned int first,
-    unsigned int last);
-
-/** Network interface options for RTL8169 card driver */
-static nic_iface_t rtl8169_nic_iface = {
-	.set_address = &rtl8169_set_addr,
-	.get_device_info = &rtl8169_get_device_info,
-	.get_cable_state = &rtl8169_get_cable_state,
-	.get_operation_mode = &rtl8169_get_operation_mode,
-	.set_operation_mode = &rtl8169_set_operation_mode,
-
-	.get_pause = &rtl8169_pause_get,
-	.set_pause = &rtl8169_pause_set,
-
-	.autoneg_enable = &rtl8169_autoneg_enable,
-	.autoneg_disable = &rtl8169_autoneg_disable,
-	.autoneg_probe = &rtl8169_autoneg_probe,
-	.autoneg_restart = &rtl8169_autoneg_restart,
-
-	.defective_get_mode = &rtl8169_defective_get_mode,
-	.defective_set_mode = &rtl8169_defective_set_mode,
-};
-
-irq_pio_range_t rtl8169_irq_pio_ranges[] = {
-	{
-		.base = 0,
-		.size = RTL8169_IO_SIZE
-	}
-};
-
-irq_cmd_t rtl8169_irq_commands[] = {
-	{
-		/* Get the interrupt status */
-		.cmd = CMD_PIO_READ_16,
-		.addr = NULL,
-		.dstarg = 2
-	},
-	{
-		.cmd = CMD_PREDICATE,
-		.value = 3,
-		.srcarg = 2
-	},
-	{
-		/* Mark interrupts as solved */
-		.cmd = CMD_PIO_WRITE_16,
-		.addr = NULL,
-		.value = 0xFFFF
-	},
-	{
-		/* Disable interrupts until interrupt routine is finished */
-		.cmd = CMD_PIO_WRITE_16,
-		.addr = NULL,
-		.value = 0x0000
-	},
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-/** Interrupt code definition */
-irq_code_t rtl8169_irq_code = {
-	.rangecount = sizeof(rtl8169_irq_pio_ranges) / sizeof(irq_pio_range_t),
-	.ranges = rtl8169_irq_pio_ranges,
-	.cmdcount = sizeof(rtl8169_irq_commands) / sizeof(irq_cmd_t),
-	.cmds = rtl8169_irq_commands
-};
-
-/** Basic device operations for RTL8169 driver */
-static ddf_dev_ops_t rtl8169_dev_ops;
-
-static errno_t rtl8169_dev_add(ddf_dev_t *dev);
-static errno_t rtl8169_dev_quiesce(ddf_dev_t *dev);
-
-/** Basic driver operations for RTL8169 driver */
-static driver_ops_t rtl8169_driver_ops = {
-	.dev_add = &rtl8169_dev_add,
-	.dev_quiesce = &rtl8169_dev_quiesce
-};
-
-/** Driver structure for RTL8169 driver */
-static driver_t rtl8169_driver = {
-	.name = NAME,
-	.driver_ops = &rtl8169_driver_ops
-};
-
-static errno_t rtl8169_get_resource_info(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	assert(nic_data);
-
-	hw_res_list_parsed_t hw_res_parsed;
-	hw_res_list_parsed_init(&hw_res_parsed);
-
-	/* Get hw resources form parent driver */
-	errno_t rc = nic_get_resources(nic_data, &hw_res_parsed);
-	if (rc != EOK)
-		return rc;
-
-	/* Fill resources information to the device */
-	errno_t ret = rtl8169_fill_resource_info(dev, &hw_res_parsed);
-	hw_res_list_parsed_clean(&hw_res_parsed);
-
-	return ret;
-}
-
-static errno_t rtl8169_fill_resource_info(ddf_dev_t *dev, const hw_res_list_parsed_t
-    *hw_resources)
-{
-	assert(dev);
-	assert(hw_resources);
-
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_dev(dev));
-	assert(rtl8169);
-
-	if (hw_resources->irqs.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected irq count", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-
-	if (hw_resources->io_ranges.count != 1) {
-		ddf_msg(LVL_ERROR, "%s device: unexpected io ranges count", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-
-	rtl8169->irq = hw_resources->irqs.irqs[0];
-	ddf_msg(LVL_DEBUG, "%s device: irq 0x%x assigned", ddf_dev_get_name(dev), rtl8169->irq);
-
-	rtl8169->regs_phys = (void *)((size_t)RNGABS(hw_resources->io_ranges.ranges[0]));
-	if (hw_resources->io_ranges.ranges[0].size < RTL8169_IO_SIZE) {
-		ddf_msg(LVL_ERROR, "I/O range assigned to the device "
-		    "%s is too small.", ddf_dev_get_name(dev));
-		return EINVAL;
-	}
-	ddf_msg(LVL_DEBUG, "%s device: i/o addr %p assigned.", ddf_dev_get_name(dev), rtl8169->regs_phys);
-
-	return EOK;
-}
-
-static errno_t rtl8169_allocate_buffers(rtl8169_t *rtl8169)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Allocating DMA buffer rings");
-
-	/* Allocate TX ring */
-	rtl8169->tx_ring = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(TX_RING_SIZE, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &rtl8169->tx_ring_phys,
-	    (void **)&rtl8169->tx_ring);
-
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "TX ring address: phys=0x%#" PRIxn ", virt=%p",
-	    rtl8169->tx_ring_phys, rtl8169->tx_ring);
-
-	memset(rtl8169->tx_ring, 0, TX_RING_SIZE);
-
-	/* Allocate RX ring */
-	rtl8169->rx_ring = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(RX_RING_SIZE, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &rtl8169->rx_ring_phys,
-	    (void **)&rtl8169->rx_ring);
-
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "RX ring address: phys=0x%#" PRIxn ", virt=%p",
-	    rtl8169->rx_ring_phys, rtl8169->rx_ring);
-
-	memset(rtl8169->rx_ring, 0, RX_RING_SIZE);
-
-	/* Allocate TX buffers */
-	rtl8169->tx_buff = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(TX_BUFFERS_SIZE, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &rtl8169->tx_buff_phys,
-	    &rtl8169->tx_buff);
-
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "TX buffers base address: phys=0x%#" PRIxn " virt=%p",
-	    rtl8169->tx_buff_phys, rtl8169->tx_buff);
-
-	/* Allocate RX buffers */
-	rtl8169->rx_buff = AS_AREA_ANY;
-	rc = dmamem_map_anonymous(RX_BUFFERS_SIZE, DMAMEM_4GiB,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &rtl8169->rx_buff_phys,
-	    &rtl8169->rx_buff);
-
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_DEBUG, "RX buffers base address: phys=0x%#" PRIxn ", virt=%p",
-	    rtl8169->rx_buff_phys, rtl8169->rx_buff);
-
-	return EOK;
-}
-
-static rtl8169_t *rtl8169_create_dev_data(ddf_dev_t *dev)
-{
-	assert(dev);
-	assert(!nic_get_from_ddf_dev(dev));
-
-	nic_t *nic_data = nic_create_and_bind(dev);
-	if (!nic_data)
-		return NULL;
-
-	rtl8169_t *rtl8169 = malloc(sizeof(rtl8169_t));
-	if (!rtl8169) {
-		nic_unbind_and_destroy(dev);
-		return NULL;
-	}
-
-	memset(rtl8169, 0, sizeof(rtl8169_t));
-
-	rtl8169->nic_data = nic_data;
-	nic_set_specific(nic_data, rtl8169);
-	nic_set_send_frame_handler(nic_data, rtl8169_send_frame);
-	nic_set_state_change_handlers(nic_data,
-	    rtl8169_on_activated, NULL, rtl8169_on_stopped);
-	nic_set_filtering_change_handlers(nic_data,
-	    rtl8169_unicast_set, rtl8169_multicast_set, rtl8169_broadcast_set,
-	    NULL, NULL);
-
-	fibril_mutex_initialize(&rtl8169->rx_lock);
-	fibril_mutex_initialize(&rtl8169->tx_lock);
-
-	nic_set_wol_max_caps(nic_data, NIC_WV_BROADCAST, 1);
-	nic_set_wol_max_caps(nic_data, NIC_WV_LINK_CHANGE, 1);
-	nic_set_wol_max_caps(nic_data, NIC_WV_MAGIC_PACKET, 1);
-
-	return rtl8169;
-}
-
-static void rtl8169_dev_cleanup(ddf_dev_t *dev)
-{
-	assert(dev);
-
-	if (ddf_dev_data_get(dev))
-		nic_unbind_and_destroy(dev);
-}
-
-static errno_t rtl8169_dev_initialize(ddf_dev_t *dev)
-{
-	errno_t ret;
-
-	rtl8169_t *rtl8169 = rtl8169_create_dev_data(dev);
-	if (rtl8169 == NULL) {
-		ddf_msg(LVL_ERROR, "Not enough memory for initializing %s.", ddf_dev_get_name(dev));
-		return ENOMEM;
-	}
-
-	ret = rtl8169_get_resource_info(dev);
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Can't obtain H/W resources information");
-		goto failed;
-	}
-
-	ddf_msg(LVL_DEBUG, "The device is initialized");
-	return ret;
-
-failed:
-	ddf_msg(LVL_ERROR, "The device initialization failed");
-	rtl8169_dev_cleanup(dev);
-	return ret;
-
-}
-
-static errno_t rtl8169_register_int_handler(nic_t *nic_data,
-    cap_irq_handle_t *handle)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	rtl8169_irq_code.ranges[0].base = (uintptr_t) rtl8169->regs;
-	rtl8169_irq_code.cmds[0].addr = rtl8169->regs + ISR;
-	rtl8169_irq_code.cmds[2].addr = rtl8169->regs + ISR;
-	rtl8169_irq_code.cmds[3].addr = rtl8169->regs + IMR;
-	errno_t rc = register_interrupt_handler(nic_get_ddf_dev(nic_data),
-	    rtl8169->irq, rtl8169_irq_handler, (void *)rtl8169,
-	    &rtl8169_irq_code, handle);
-
-	return rc;
-}
-
-static errno_t rtl8169_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun;
-	nic_address_t nic_addr;
-	errno_t rc;
-
-	assert(dev);
-	ddf_msg(LVL_NOTE, "RTL8169_dev_add %s (handle = %zu)",
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	/* Init structures */
-	rc = rtl8169_dev_initialize(dev);
-	if (rc != EOK)
-		return rc;
-
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	rtl8169->dev = dev;
-	rtl8169->parent_sess = ddf_dev_parent_sess_get(dev);
-	if (rtl8169->parent_sess == NULL)
-		return EIO;
-
-	/* Get PCI VID & PID */
-	rc = pci_config_space_read_16(rtl8169->parent_sess, PCI_VENDOR_ID,
-	    &rtl8169->pci_vid);
-	if (rc != EOK)
-		return rc;
-
-	rc = pci_config_space_read_16(rtl8169->parent_sess, PCI_DEVICE_ID,
-	    &rtl8169->pci_pid);
-	if (rc != EOK)
-		return rc;
-
-	/* Map register space */
-	rc = pio_enable(rtl8169->regs_phys, RTL8169_IO_SIZE, &rtl8169->regs);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Cannot map register space for device %s.",
-		    ddf_dev_get_name(dev));
-		goto err_destroy;
-	}
-
-	/* Read MAC address and print it */
-	rtl8169_get_hwaddr(rtl8169, &nic_addr);
-	ddf_msg(LVL_NOTE, "MAC address: %02x:%02x:%02x:%02x:%02x:%02x",
-	    nic_addr.address[0], nic_addr.address[1],
-	    nic_addr.address[2], nic_addr.address[3],
-	    nic_addr.address[4], nic_addr.address[5]);
-
-	rc = nic_report_address(nic_data, &nic_addr);
-	if (rc != EOK)
-		goto err_pio;
-
-	cap_irq_handle_t irq_handle;
-	rc = rtl8169_register_int_handler(nic_data, &irq_handle);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to register IRQ handler (%s)", str_error_name(rc));
-		goto err_irq;
-	}
-
-	ddf_msg(LVL_DEBUG, "Interrupt handler installed");
-
-	uint8_t cr_value = pio_read_8(rtl8169->regs + CR);
-	pio_write_8(rtl8169->regs + CR, cr_value | CR_TE | CR_RE);
-
-	fun = ddf_fun_create(nic_get_ddf_dev(nic_data), fun_exposed, "port0");
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating device function");
-		goto err_srv;
-	}
-
-	nic_set_ddf_fun(nic_data, fun);
-	ddf_fun_set_ops(fun, &rtl8169_dev_ops);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding device function");
-		goto err_fun_create;
-	}
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function to category");
-		goto err_fun_bind;
-	}
-
-	ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
-	    ddf_dev_get_name(dev));
-	return EOK;
-
-err_fun_bind:
-	ddf_fun_unbind(fun);
-err_fun_create:
-	ddf_fun_destroy(fun);
-err_srv:
-	/* XXX Disconnect from services */
-	unregister_interrupt_handler(dev, irq_handle);
-err_irq:
-err_pio:
-err_destroy:
-	rtl8169_dev_cleanup(dev);
-	return rc;
-
-	return EOK;
-}
-
-static errno_t rtl8169_dev_quiesce(ddf_dev_t *dev)
-{
-	nic_t *nic;
-	rtl8169_t *rtl8169;
-
-	ddf_msg(LVL_NOTE, "RTL8169_dev_quiesce %s (handle = %zu)",
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	nic = nic_get_from_ddf_dev(dev);
-	rtl8169 = nic_get_specific(nic);
-
-	/* Reset card */
-	pio_write_8(rtl8169->regs + CONFIG0, 0);
-	rtl8169_reset(rtl8169);
-
-	return EOK;
-}
-
-static errno_t rtl8169_set_addr(ddf_fun_t *fun, const nic_address_t *addr)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	errno_t rc;
-
-	fibril_mutex_lock(&rtl8169->rx_lock);
-	fibril_mutex_lock(&rtl8169->tx_lock);
-
-	rc = nic_report_address(nic_data, addr);
-	if (rc != EOK)
-		return rc;
-
-	rtl8169_set_hwaddr(rtl8169, addr);
-
-	fibril_mutex_unlock(&rtl8169->rx_lock);
-	fibril_mutex_unlock(&rtl8169->tx_lock);
-
-	return EOK;
-}
-
-static errno_t rtl8169_get_device_info(ddf_fun_t *fun, nic_device_info_t *info)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH, "Unknown");
-	str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH, "Unknown");
-
-	if (rtl8169->pci_vid == PCI_VID_REALTEK)
-		str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH, "Realtek");
-
-	if (rtl8169->pci_vid == PCI_VID_DLINK)
-		str_cpy(info->vendor_name, NIC_VENDOR_MAX_LENGTH, "D-Link");
-
-	if (rtl8169->pci_pid == 0x8168)
-		str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH, "RTL8168");
-
-	if (rtl8169->pci_pid == 0x8169)
-		str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH, "RTL8169");
-
-	if (rtl8169->pci_pid == 0x8110)
-		str_cpy(info->model_name, NIC_MODEL_MAX_LENGTH, "RTL8110");
-
-	return EOK;
-}
-
-static errno_t rtl8169_get_cable_state(ddf_fun_t *fun, nic_cable_state_t *state)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint8_t phystatus = pio_read_8(rtl8169->regs + PHYSTATUS);
-
-	if (phystatus & PHYSTATUS_LINK)
-		*state = NIC_CS_PLUGGED;
-	else
-		*state = NIC_CS_UNPLUGGED;
-
-	return EOK;
-}
-
-static errno_t rtl8169_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint8_t phystatus = pio_read_8(rtl8169->regs + PHYSTATUS);
-
-	*duplex = phystatus & PHYSTATUS_FDX ?
-	    NIC_CM_FULL_DUPLEX : NIC_CM_HALF_DUPLEX;
-
-	if (phystatus & PHYSTATUS_10M)
-		*speed = 10;
-
-	if (phystatus & PHYSTATUS_100M)
-		*speed = 100;
-
-	if (phystatus & PHYSTATUS_1000M)
-		*speed = 1000;
-
-	*role = NIC_ROLE_UNKNOWN;
-	return EOK;
-}
-
-static errno_t rtl8169_set_operation_mode(ddf_fun_t *fun, int speed,
-    nic_channel_mode_t duplex, nic_role_t role)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint16_t bmcr;
-
-	if (speed != 10 && speed != 100 && speed != 1000)
-		return EINVAL;
-
-	if (duplex != NIC_CM_HALF_DUPLEX && duplex != NIC_CM_FULL_DUPLEX)
-		return EINVAL;
-
-	bmcr = rtl8169_mii_read(rtl8169, MII_BMCR);
-	bmcr &= ~(BMCR_DUPLEX | BMCR_SPD_100 | BMCR_SPD_1000);
-
-	/* Disable autonegotiation */
-	bmcr &= ~BMCR_AN_ENABLE;
-
-	if (duplex == NIC_CM_FULL_DUPLEX)
-		bmcr |= BMCR_DUPLEX;
-
-	if (speed == 100)
-		bmcr |= BMCR_SPD_100;
-
-	if (speed == 1000)
-		bmcr |= BMCR_SPD_1000;
-
-	rtl8169_mii_write(rtl8169, MII_BMCR, bmcr);
-	return EOK;
-}
-
-static errno_t rtl8169_pause_get(ddf_fun_t *fun, nic_result_t *we_send,
-    nic_result_t *we_receive, uint16_t *time)
-{
-	return EOK;
-}
-
-static errno_t rtl8169_pause_set(ddf_fun_t *fun, int allow_send, int allow_receive,
-    uint16_t time)
-{
-	return EOK;
-}
-
-static errno_t rtl8169_autoneg_enable(ddf_fun_t *fun, uint32_t advertisement)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint16_t bmcr = rtl8169_mii_read(rtl8169, MII_BMCR);
-	uint16_t anar = ANAR_SELECTOR;
-
-	if (advertisement & ETH_AUTONEG_10BASE_T_FULL)
-		anar |= ANAR_10_FD;
-	if (advertisement & ETH_AUTONEG_10BASE_T_HALF)
-		anar |= ANAR_10_HD;
-	if (advertisement & ETH_AUTONEG_100BASE_TX_FULL)
-		anar |= ANAR_100TX_FD;
-	if (advertisement & ETH_AUTONEG_100BASE_TX_HALF)
-		anar |= ANAR_100TX_HD;
-	if (advertisement & ETH_AUTONEG_PAUSE_SYMETRIC)
-		anar |= ANAR_PAUSE;
-
-	bmcr |= BMCR_AN_ENABLE;
-	rtl8169_mii_write(rtl8169, MII_BMCR, bmcr);
-	rtl8169_mii_write(rtl8169, MII_ANAR, anar);
-
-	return EOK;
-}
-
-static errno_t rtl8169_autoneg_disable(ddf_fun_t *fun)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint16_t bmcr = rtl8169_mii_read(rtl8169, MII_BMCR);
-
-	bmcr &= ~BMCR_AN_ENABLE;
-	rtl8169_mii_write(rtl8169, MII_BMCR, bmcr);
-
-	return EOK;
-}
-
-static errno_t rtl8169_autoneg_probe(ddf_fun_t *fun, uint32_t *advertisement,
-    uint32_t *their_adv, nic_result_t *result, nic_result_t *their_result)
-{
-	return EOK;
-}
-
-static errno_t rtl8169_autoneg_restart(ddf_fun_t *fun)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_get_from_ddf_fun(fun));
-	uint16_t bmcr = rtl8169_mii_read(rtl8169, MII_BMCR);
-
-	bmcr |= BMCR_AN_ENABLE;
-	rtl8169_mii_write(rtl8169, MII_BMCR, bmcr);
-	return EOK;
-}
-
-static errno_t rtl8169_defective_get_mode(ddf_fun_t *fun, uint32_t *mode)
-{
-	return EOK;
-}
-
-static errno_t rtl8169_defective_set_mode(ddf_fun_t *fun, uint32_t mode)
-{
-	return EOK;
-}
-
-static void rtl8169_rx_ring_refill(rtl8169_t *rtl8169, unsigned int first,
-    unsigned int last)
-{
-	rtl8169_descr_t *descr;
-	uint64_t buff_phys;
-	unsigned int i = first;
-
-	while (true) {
-		descr = &rtl8169->rx_ring[i];
-		buff_phys = rtl8169->rx_buff_phys + (BUFFER_SIZE * i);
-		descr->control = BUFFER_SIZE | CONTROL_OWN;
-		descr->buf_low = buff_phys & 0xffffffff;
-		descr->buf_high = (buff_phys >> 32) & 0xffffffff;
-
-		if (i == RX_BUFFERS_COUNT - 1)
-			descr->control |= CONTROL_EOR;
-
-		if (i == last)
-			break;
-
-		i = (i + 1) % RX_BUFFERS_COUNT;
-	}
-}
-
-static errno_t rtl8169_on_activated(nic_t *nic_data)
-{
-	errno_t rc;
-	uint64_t tmp;
-
-	ddf_msg(LVL_NOTE, "Activating device");
-
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	/* Reset card */
-	pio_write_8(rtl8169->regs + CONFIG0, 0);
-	rtl8169_reset(rtl8169);
-
-	/* Allocate buffers */
-	rc = rtl8169_allocate_buffers(rtl8169);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error allocating buffers: %s", str_error_name(rc));
-		return 0;
-	}
-
-	/* Initialize RX ring */
-	rtl8169_rx_ring_refill(rtl8169, 0, RX_BUFFERS_COUNT - 1);
-
-	/* Write address of descriptor as start of TX ring */
-	tmp = rtl8169->tx_ring_phys;
-	pio_write_32(rtl8169->regs + TNPDS, tmp & 0xffffffff);
-	pio_write_32(rtl8169->regs + TNPDS + 4, (tmp >> 32) & 0xffffffff);
-	rtl8169->tx_head = 0;
-	rtl8169->tx_tail = 0;
-	rtl8169->tx_ring[15].control = CONTROL_EOR;
-
-	/* Write RX ring address */
-	tmp = rtl8169->rx_ring_phys;
-	pio_write_32(rtl8169->regs + RDSAR, tmp & 0xffffffff);
-	pio_write_32(rtl8169->regs + RDSAR + 4, (tmp >> 32) & 0xffffffff);
-	rtl8169->rx_head = 0;
-	rtl8169->rx_tail = 0;
-
-	/* Clear pending interrupts */
-	pio_write_16(rtl8169->regs + ISR, 0xffff);
-
-	/* Enable TX and RX */
-	uint8_t cr = pio_read_8(rtl8169->regs + CR);
-	cr |= CR_TE | CR_RE;
-	pio_write_8(rtl8169->regs + CR, cr);
-	pio_write_32(rtl8169->regs + MAR0, 0xffffffff);
-	pio_write_32(rtl8169->regs + MAR0 + 4, 0xffffffff);
-
-	/* Configure Receive Control Register */
-	uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
-	rtl8169->rcr_ucast = RCR_ACCEPT_PHYS_MATCH;
-	rcr |= RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ERROR | RCR_ACCEPT_RUNT;
-	pio_write_32(rtl8169->regs + RCR, rcr);
-	pio_write_16(rtl8169->regs + RMS, BUFFER_SIZE);
-
-	pio_write_16(rtl8169->regs + IMR, 0xffff);
-	/* XXX Check return value */
-	hw_res_enable_interrupt(rtl8169->parent_sess, rtl8169->irq);
-
-	return EOK;
-}
-
-static errno_t rtl8169_on_stopped(nic_t *nic_data)
-{
-	ddf_msg(LVL_NOTE, "Stopping device");
-	return EOK;
-}
-
-static void rtl8169_reset(rtl8169_t *rtl8169)
-{
-	pio_write_8(rtl8169->regs + CR, CR_RST);
-	memory_barrier();
-	while (pio_read_8(rtl8169->regs + CR) & CR_RST) {
-		fibril_usleep(1);
-		read_barrier();
-	}
-}
-
-static void rtl8169_link_change(ddf_dev_t *dev)
-{
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	uint8_t phystatus = pio_read_8(rtl8169->regs + PHYSTATUS);
-
-	if (phystatus & PHYSTATUS_LINK) {
-		ddf_msg(LVL_NOTE, "%s: Link up", ddf_dev_get_name(dev));
-
-		int speed;
-		const char *fdx = phystatus & PHYSTATUS_FDX ? "full duplex" : "half duplex";
-
-		if (phystatus & PHYSTATUS_10M)
-			speed = 10;
-
-		if (phystatus & PHYSTATUS_100M)
-			speed = 100;
-
-		if (phystatus & PHYSTATUS_1000M)
-			speed = 1000;
-
-		ddf_msg(LVL_NOTE, "%s: Speed %dMbit/s, %s", ddf_dev_get_name(dev), speed, fdx);
-	} else {
-		ddf_msg(LVL_NOTE, "%s: Link down", ddf_dev_get_name(dev));
-	}
-
-}
-
-/** Notify NIC framework about HW filtering state when promisc mode was disabled
- *
- *  @param nic_data     The NIC data
- *  @param mcast_mode   Current multicast mode
- *  @param was_promisc  Sign if the promiscuous mode was active before disabling
- */
-static void rtl8169_rcx_promics_rem(nic_t *nic_data,
-    nic_multicast_mode_t mcast_mode, uint8_t was_promisc)
-{
-	assert(nic_data);
-
-	if (was_promisc != 0) {
-		if (mcast_mode == NIC_MULTICAST_LIST)
-			nic_report_hw_filtering(nic_data, 1, 0, -1);
-		else
-			nic_report_hw_filtering(nic_data, 1, 1, -1);
-	} else {
-		nic_report_hw_filtering(nic_data, 1, -1, -1);
-	}
-}
-
-static errno_t rtl8169_unicast_set(nic_t *nic_data, nic_unicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_count)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
-	uint8_t was_promisc = rcr & RCR_ACCEPT_ALL_PHYS;
-	nic_multicast_mode_t mcast_mode;
-
-	nic_query_multicast(nic_data, &mcast_mode, 0, NULL, NULL);
-
-	ddf_msg(LVL_DEBUG, "Unicast RX filter mode: %d", mode);
-
-	switch (mode) {
-	case NIC_UNICAST_BLOCKED:
-		rtl8169->rcr_ucast = 0;
-		rtl8169_rcx_promics_rem(nic_data, mcast_mode, was_promisc);
-		break;
-	case NIC_UNICAST_DEFAULT:
-		rtl8169->rcr_ucast = RCR_ACCEPT_PHYS_MATCH;
-		rtl8169_rcx_promics_rem(nic_data, mcast_mode, was_promisc);
-		break;
-	case NIC_UNICAST_LIST:
-		rtl8169->rcr_ucast = RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ALL_PHYS;
-
-		if (mcast_mode == NIC_MULTICAST_PROMISC)
-			nic_report_hw_filtering(nic_data, 0, 1, -1);
-		else
-			nic_report_hw_filtering(nic_data, 0, 0, -1);
-		break;
-	case NIC_UNICAST_PROMISC:
-		rtl8169->rcr_ucast = RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ALL_PHYS;
-
-		if (mcast_mode == NIC_MULTICAST_PROMISC)
-			nic_report_hw_filtering(nic_data, 1, 1, -1);
-		else
-			nic_report_hw_filtering(nic_data, 1, 0, -1);
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	fibril_mutex_lock(&rtl8169->rx_lock);
-
-	rcr &= ~(RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ALL_PHYS);
-	pio_write_32(rtl8169->regs + RCR, rcr | rtl8169->rcr_ucast | rtl8169->rcr_mcast);
-	ddf_msg(LVL_DEBUG, "new RCR value: 0x%08x", rcr | rtl8169->rcr_ucast | rtl8169->rcr_mcast);
-
-	fibril_mutex_unlock(&rtl8169->rx_lock);
-	return EOK;
-}
-
-static errno_t rtl8169_multicast_set(nic_t *nic_data, nic_multicast_mode_t mode,
-    const nic_address_t *addr, size_t addr_count)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
-	uint64_t mask;
-
-	ddf_msg(LVL_DEBUG, "Multicast RX filter mode: %d", mode);
-
-	switch (mode) {
-	case NIC_MULTICAST_BLOCKED:
-		rtl8169->rcr_mcast = 0;
-		if ((rtl8169->rcr_ucast & RCR_ACCEPT_ALL_PHYS) != 0)
-			nic_report_hw_filtering(nic_data, -1, 0, -1);
-		else
-			nic_report_hw_filtering(nic_data, -1, 1, -1);
-		break;
-	case NIC_MULTICAST_LIST:
-		mask = nic_mcast_hash(addr, addr_count);
-		pio_write_32(rtl8169->regs + MAR0, (uint32_t)mask);
-		pio_write_32(rtl8169->regs + MAR0 + 4, (uint32_t)(mask >> 32));
-		rtl8169->rcr_mcast = RCR_ACCEPT_MULTICAST;
-		nic_report_hw_filtering(nic_data, -1, 0, -1);
-		break;
-	case NIC_MULTICAST_PROMISC:
-		pio_write_32(rtl8169->regs + MAR0, 0xffffffffULL);
-		pio_write_32(rtl8169->regs + MAR0 + 4, (uint32_t)(0xffffffffULL >> 32));
-		rtl8169->rcr_mcast = RCR_ACCEPT_MULTICAST;
-		nic_report_hw_filtering(nic_data, -1, 1, -1);
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	fibril_mutex_lock(&rtl8169->rx_lock);
-
-	rcr &= ~(RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_ALL_PHYS);
-	pio_write_32(rtl8169->regs + RCR, rcr | rtl8169->rcr_ucast | rtl8169->rcr_mcast);
-	ddf_msg(LVL_DEBUG, "new RCR value: 0x%08x", rcr | rtl8169->rcr_ucast | rtl8169->rcr_mcast);
-
-	fibril_mutex_unlock(&rtl8169->rx_lock);
-	return EOK;
-}
-
-static errno_t rtl8169_broadcast_set(nic_t *nic_data, nic_broadcast_mode_t mode)
-{
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	/* Configure Receive Control Register */
-	uint32_t rcr = pio_read_32(rtl8169->regs + RCR);
-
-	ddf_msg(LVL_DEBUG, "Broadcast RX filter mode: %d", mode);
-
-	switch (mode) {
-	case NIC_BROADCAST_BLOCKED:
-		rcr &= ~RCR_ACCEPT_BROADCAST;
-		break;
-	case NIC_BROADCAST_ACCEPTED:
-		rcr |= RCR_ACCEPT_BROADCAST;
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	pio_write_32(rtl8169->regs + RCR, rcr);
-	ddf_msg(LVL_DEBUG, " new RCR value: 0x%08x", rcr);
-
-	return EOK;
-}
-
-static void rtl8169_transmit_done(ddf_dev_t *dev)
-{
-	unsigned int tail, head;
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	rtl8169_descr_t *descr;
-	int sent = 0;
-
-	ddf_msg(LVL_DEBUG, "rtl8169_transmit_done()");
-
-	fibril_mutex_lock(&rtl8169->tx_lock);
-
-	head = rtl8169->tx_head;
-	tail = rtl8169->tx_tail;
-
-	while (tail != head) {
-		descr = &rtl8169->tx_ring[tail];
-		descr->control &= (~CONTROL_OWN);
-		write_barrier();
-		ddf_msg(LVL_DEBUG, "TX status for descr %d: 0x%08x", tail, descr->control);
-
-		tail = (tail + 1) % TX_BUFFERS_COUNT;
-		sent++;
-	}
-
-	if (sent != 0)
-		nic_set_tx_busy(nic_data, 0);
-
-	rtl8169->tx_tail = tail;
-
-	fibril_mutex_unlock(&rtl8169->tx_lock);
-}
-
-static void rtl8169_receive_done(ddf_dev_t *dev)
-{
-	nic_t *nic_data = nic_get_from_ddf_dev(dev);
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-	rtl8169_descr_t *descr;
-	nic_frame_list_t *frames = nic_alloc_frame_list();
-	nic_frame_t *frame;
-	void *buffer;
-	unsigned int tail, fsidx = 0;
-	int frame_size;
-
-	ddf_msg(LVL_DEBUG, "rtl8169_receive_done()");
-
-	fibril_mutex_lock(&rtl8169->rx_lock);
-
-	tail = rtl8169->rx_tail;
-
-	while (true) {
-		descr = &rtl8169->rx_ring[tail];
-
-		if (descr->control & CONTROL_OWN)
-			break;
-
-		if (descr->control & RXSTATUS_RES) {
-			ddf_msg(LVL_WARN, "error at slot %d: 0x%08x\n", tail, descr->control);
-			tail = (tail + 1) % RX_BUFFERS_COUNT;
-			continue;
-		}
-
-		if (descr->control & CONTROL_FS)
-			fsidx = tail;
-
-		if (descr->control & CONTROL_LS) {
-			ddf_msg(LVL_DEBUG, "received message at slot %d, control 0x%08x", tail, descr->control);
-
-			if (fsidx != tail)
-				ddf_msg(LVL_WARN, "single frame spanning multiple descriptors");
-
-			frame_size = descr->control & 0x1fff;
-			buffer = rtl8169->rx_buff + (BUFFER_SIZE * tail);
-			frame = nic_alloc_frame(nic_data, frame_size);
-			memcpy(frame->data, buffer, frame_size);
-			nic_frame_list_append(frames, frame);
-		}
-
-		tail = (tail + 1) % RX_BUFFERS_COUNT;
-	}
-
-	rtl8169_rx_ring_refill(rtl8169, rtl8169->rx_tail, tail);
-
-	rtl8169->rx_tail = tail;
-
-	fibril_mutex_unlock(&rtl8169->rx_lock);
-
-	nic_received_frame_list(nic_data, frames);
-
-}
-
-/** RTL8169 IRQ handler.
- *
- * @param icall IRQ event notification
- * @param arg Argument (rtl8169_t *)
- */
-static void rtl8169_irq_handler(ipc_call_t *icall, void *arg)
-{
-	uint16_t isr = (uint16_t) ipc_get_arg2(icall) & INT_KNOWN;
-	rtl8169_t *rtl8169 = (rtl8169_t *)arg;
-
-	ddf_msg(LVL_DEBUG, "rtl8169_irq_handler(): isr=0x%04x", isr);
-	pio_write_16(rtl8169->regs + IMR, 0xffff);
-
-	while (isr != 0) {
-		ddf_msg(LVL_DEBUG, "irq handler: remaining isr=0x%04x", isr);
-
-		/* Packet underrun or link change */
-		if (isr & INT_PUN) {
-			rtl8169_link_change(rtl8169->dev);
-			pio_write_16(rtl8169->regs + ISR, INT_PUN);
-		}
-
-		/* Transmit notification */
-		if (isr & (INT_TER | INT_TOK | INT_TDU)) {
-			rtl8169_transmit_done(rtl8169->dev);
-			pio_write_16(rtl8169->regs + ISR, (INT_TER | INT_TOK | INT_TDU));
-		}
-
-		/* Receive underrun */
-		if (isr & INT_RXOVW) {
-			/* just ack.. */
-			pio_write_16(rtl8169->regs + ISR, INT_RXOVW);
-		}
-
-		if (isr & INT_SERR) {
-			ddf_msg(LVL_ERROR, "System error interrupt");
-			pio_write_16(rtl8169->regs + ISR, INT_SERR);
-		}
-
-		if (isr & (INT_RER | INT_ROK)) {
-			rtl8169_receive_done(rtl8169->dev);
-			pio_write_16(rtl8169->regs + ISR, (INT_RER | INT_ROK));
-		}
-
-		isr = pio_read_16(rtl8169->regs + ISR) & INT_KNOWN;
-	}
-
-	pio_write_16(rtl8169->regs + ISR, 0xffff);
-}
-
-static void rtl8169_send_frame(nic_t *nic_data, void *data, size_t size)
-{
-	rtl8169_descr_t *descr, *prev;
-	unsigned int head, tail;
-	void *buff;
-	uint64_t buff_phys;
-	rtl8169_t *rtl8169 = nic_get_specific(nic_data);
-
-	if (size > RTL8169_FRAME_MAX_LENGTH) {
-		ddf_msg(LVL_ERROR, "Send frame: frame too long, %zu bytes",
-		    size);
-		nic_report_send_error(nic_data, NIC_SEC_OTHER, 1);
-	}
-
-	fibril_mutex_lock(&rtl8169->tx_lock);
-
-	ddf_msg(LVL_DEBUG, "send_frame: size: %zu, tx_head=%d tx_tail=%d",
-	    size, rtl8169->tx_head, rtl8169->tx_tail);
-
-	head = rtl8169->tx_head;
-	tail = rtl8169->tx_tail;
-
-	if ((head + 1) % TX_BUFFERS_COUNT == tail) {
-		/* Queue is full */
-		ddf_msg(LVL_WARN, "TX queue full!");
-		nic_set_tx_busy(nic_data, 1);
-	}
-
-	/* Calculate address of next free buffer and descriptor */
-	buff = rtl8169->tx_buff + (BUFFER_SIZE * head);
-	buff_phys = rtl8169->tx_buff_phys + (BUFFER_SIZE * head);
-
-	/* Copy frame */
-	memcpy(buff, data, size);
-
-	/* Setup descriptor */
-	descr = &rtl8169->tx_ring[head];
-	prev = &rtl8169->tx_ring[(head - 1) % TX_BUFFERS_COUNT];
-
-	ddf_msg(LVL_DEBUG, "current_descr=%p, prev_descr=%p", descr, prev);
-
-	descr->control = CONTROL_OWN | CONTROL_FS | CONTROL_LS;
-	descr->control |= size & 0xffff;
-	descr->vlan = 0;
-	descr->buf_low = buff_phys & 0xffffffff;
-	descr->buf_high = (buff_phys >> 32) & 0xffffffff;
-
-	if (head == TX_BUFFERS_COUNT - 1)
-		descr->control |= CONTROL_EOR;
-
-	rtl8169->tx_head = (head + 1) % TX_BUFFERS_COUNT;
-
-	ddf_msg(LVL_DEBUG, "control: 0x%08x", descr->control);
-
-	write_barrier();
-
-	/* Notify NIC of pending packets */
-	pio_write_8(rtl8169->regs + TPPOLL, TPPOLL_NPQ);
-	write_barrier();
-
-	fibril_mutex_unlock(&rtl8169->tx_lock);
-}
-
-static inline void rtl8169_get_hwaddr(rtl8169_t *rtl8169, nic_address_t *addr)
-{
-	int i;
-
-	assert(rtl8169);
-	assert(addr);
-
-	for (i = 0; i < 6; i++)
-		addr->address[i] = pio_read_8(rtl8169->regs + MAC0 + i);
-}
-
-static inline void rtl8169_set_hwaddr(rtl8169_t *rtl8169, const nic_address_t *addr)
-{
-	int i;
-
-	assert(rtl8169);
-	assert(addr);
-
-	for (i = 0; i < 6; i++)
-		pio_write_8(rtl8169->regs + MAC0 + i, addr->address[i]);
-}
-
-static uint16_t rtl8169_mii_read(rtl8169_t *rtl8169, uint8_t addr)
-{
-	uint32_t phyar;
-
-	phyar = PHYAR_RW_READ |
-	    ((addr & PHYAR_ADDR_MASK) << PHYAR_ADDR_SHIFT);
-
-	pio_write_32(rtl8169->regs + PHYAR, phyar);
-
-	do {
-		phyar = pio_read_32(rtl8169->regs + PHYAR);
-		fibril_usleep(20);
-	} while ((phyar & PHYAR_RW_WRITE) == 0);
-
-	return phyar & PHYAR_DATA_MASK;
-}
-
-static void rtl8169_mii_write(rtl8169_t *rtl8169, uint8_t addr, uint16_t value)
-{
-	uint32_t phyar;
-
-	phyar = PHYAR_RW_WRITE |
-	    ((addr & PHYAR_ADDR_MASK) << PHYAR_ADDR_SHIFT) |
-	    (value & PHYAR_DATA_MASK);
-
-	pio_write_32(rtl8169->regs + PHYAR, phyar);
-
-	do {
-		phyar = pio_read_32(rtl8169->regs + PHYAR);
-		fibril_usleep(20);
-	} while ((phyar & PHYAR_RW_WRITE) != 0);
-
-	fibril_usleep(20);
-}
-
-/** Main function of RTL8169 driver
- *
- *  Just initialize the driver structures and
- *  put it into the device drivers interface
- */
-int main(void)
-{
-	errno_t rc = nic_driver_init(NAME);
-	if (rc != EOK)
-		return rc;
-	nic_driver_implement(
-	    &rtl8169_driver_ops, &rtl8169_dev_ops, &rtl8169_nic_iface);
-
-	ddf_log_init(NAME);
-	ddf_msg(LVL_NOTE, "HelenOS RTL8169 driver started");
-	return ddf_driver_main(&rtl8169_driver);
-}
Index: pace/drv/nic/rtl8169/driver.h
===================================================================
--- uspace/drv/nic/rtl8169/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * Copyright (c) 2014 Agnieszka Tabaka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RTL8169_DRIVER_H_
-#define RTL8169_DRIVER_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include "defs.h"
-
-/** The driver name */
-#define NAME  "rtl8169"
-
-#define	TX_BUFFERS_COUNT	16
-#define	RX_BUFFERS_COUNT	16
-#define	BUFFER_SIZE		2048
-
-#define	TX_RING_SIZE		(sizeof(rtl8169_descr_t) * TX_BUFFERS_COUNT)
-#define	RX_RING_SIZE		(sizeof(rtl8169_descr_t) * RX_BUFFERS_COUNT)
-#define	TX_BUFFERS_SIZE		(BUFFER_SIZE * TX_BUFFERS_COUNT)
-#define	RX_BUFFERS_SIZE		(BUFFER_SIZE * RX_BUFFERS_COUNT)
-
-/** RTL8139 device data */
-typedef struct rtl8169_data {
-	/** DDF device */
-	ddf_dev_t *dev;
-	/** Parent session */
-	async_sess_t *parent_sess;
-	/** I/O address of the device */
-	void *regs_phys;
-	/** Mapped I/O port */
-	void *regs;
-	/** The irq assigned */
-	int irq;
-	/** PCI Vendor and Product ids */
-	uint16_t pci_vid;
-	uint16_t pci_pid;
-	/** Mask of the turned interupts (IMR value) */
-	uint16_t int_mask;
-	/** TX ring */
-	uintptr_t tx_ring_phys;
-	rtl8169_descr_t *tx_ring;
-	unsigned int tx_head;
-	unsigned int tx_tail;
-	/** RX ring */
-	uintptr_t rx_ring_phys;
-	rtl8169_descr_t *rx_ring;
-	unsigned int rx_head;
-	unsigned int rx_tail;
-	/** TX buffers */
-	uintptr_t tx_buff_phys;
-	void *tx_buff;
-	/** RX buffers */
-	uintptr_t rx_buff_phys;
-	void *rx_buff;
-	/** The nubmer of the next buffer to use, index = tx_next % TX_BUFF_COUNT */
-	size_t tx_next;
-	/** The number of the first used buffer in the row
-	 *
-	 *  tx_used is in the interval tx_next - TX_BUFF_COUNT and tx_next:
-	 *  	tx_next - TX_BUFF_COUNT: there is no useable Tx descriptor
-	 *  	tx_next: all Tx descriptors are can be used
-	 */
-	size_t tx_used;
-
-	/** Receive Control Register masks */
-	uint32_t rcr_ucast;
-	uint32_t rcr_mcast;
-
-	/** Lock for receiver */
-	fibril_mutex_t rx_lock;
-	/** Lock for transmitter */
-	fibril_mutex_t tx_lock;
-
-	/** Backward pointer to nic_data */
-	nic_t *nic_data;
-
-} rtl8169_t;
-
-#endif
Index: pace/drv/nic/rtl8169/meson.build
===================================================================
--- uspace/drv/nic/rtl8169/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# Copyright (c) 2014 Agnieszka Tabaka
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nic' ]
-src = files('driver.c')
Index: pace/drv/nic/rtl8169/rtl8169.ma
===================================================================
--- uspace/drv/nic/rtl8169/rtl8169.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-10 pci/ven=10ec&dev=8169
-10 pci/ven=10ec&dev=8168
-10 pci/ven=10ec&dev=8167
-10 pci/ven=10ec&dev=8110
-10 pci/ven=1186&dev=4300
Index: pace/drv/nic/virtio-net/meson.build
===================================================================
--- uspace/drv/nic/virtio-net/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2018 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nic', 'virtio' ]
-src = files('virtio-net.c')
Index: pace/drv/nic/virtio-net/virtio-net.c
===================================================================
--- uspace/drv/nic/virtio-net/virtio-net.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,498 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "virtio-net.h"
-
-#include <stdio.h>
-#include <stdint.h>
-
-#include <as.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <ddf/log.h>
-#include <ops/nic.h>
-#include <pci_dev_iface.h>
-#include <nic/nic.h>
-
-#include <nic.h>
-
-#include <virtio-pci.h>
-
-#define NAME	"virtio-net"
-
-#define VIRTIO_NET_NUM_QUEUES	3
-
-#define RX_QUEUE_1	0
-#define TX_QUEUE_1	1
-#define CT_QUEUE_1	2
-
-#define BUFFER_SIZE	2048
-#define RX_BUF_SIZE	BUFFER_SIZE
-#define TX_BUF_SIZE	BUFFER_SIZE
-#define CT_BUF_SIZE	BUFFER_SIZE
-
-static ddf_dev_ops_t virtio_net_dev_ops;
-
-static errno_t virtio_net_dev_add(ddf_dev_t *dev);
-
-static driver_ops_t virtio_net_driver_ops = {
-	.dev_add = virtio_net_dev_add
-};
-
-static driver_t virtio_net_driver = {
-	.name = NAME,
-	.driver_ops = &virtio_net_driver_ops
-};
-
-/** VirtIO net IRQ handler.
- *
- * @param icall IRQ event notification
- * @param arg Argument (nic_t *)
- */
-static void virtio_net_irq_handler(ipc_call_t *icall, void *arg)
-{
-	nic_t *nic = (nic_t *)arg;
-	virtio_net_t *virtio_net = nic_get_specific(nic);
-	virtio_dev_t *vdev = &virtio_net->virtio_dev;
-
-	uint16_t descno;
-	uint32_t len;
-	while (virtio_virtq_consume_used(vdev, RX_QUEUE_1, &descno, &len)) {
-		virtio_net_hdr_t *hdr =
-		    (virtio_net_hdr_t *) virtio_net->rx_buf[descno];
-		if (len <= sizeof(*hdr)) {
-			ddf_msg(LVL_WARN,
-			    "RX data length too short, packet dropped");
-			virtio_virtq_produce_available(vdev, RX_QUEUE_1,
-			    descno);
-			continue;
-		}
-
-		nic_frame_t *frame = nic_alloc_frame(nic, len - sizeof(*hdr));
-		if (frame) {
-			memcpy(frame->data, &hdr[1], len - sizeof(*hdr));
-			nic_received_frame(nic, frame);
-		} else {
-			ddf_msg(LVL_WARN,
-			    "Cannot allocate RX frame, packet dropped");
-		}
-
-		virtio_virtq_produce_available(vdev, RX_QUEUE_1, descno);
-	}
-
-	while (virtio_virtq_consume_used(vdev, TX_QUEUE_1, &descno, &len)) {
-		virtio_free_desc(vdev, TX_QUEUE_1, &virtio_net->tx_free_head,
-		    descno);
-	}
-	while (virtio_virtq_consume_used(vdev, CT_QUEUE_1, &descno, &len)) {
-		virtio_free_desc(vdev, CT_QUEUE_1, &virtio_net->ct_free_head,
-		    descno);
-	}
-}
-
-static errno_t virtio_net_register_interrupt(ddf_dev_t *dev)
-{
-	nic_t *nic = ddf_dev_data_get(dev);
-	virtio_net_t *virtio_net = nic_get_specific(nic);
-	virtio_dev_t *vdev = &virtio_net->virtio_dev;
-
-	hw_res_list_parsed_t res;
-	hw_res_list_parsed_init(&res);
-
-	errno_t rc = nic_get_resources(nic, &res);
-	if (rc != EOK)
-		return rc;
-
-	if (res.irqs.count < 1) {
-		hw_res_list_parsed_clean(&res);
-		rc = EINVAL;
-		return rc;
-	}
-
-	virtio_net->irq = res.irqs.irqs[0];
-	hw_res_list_parsed_clean(&res);
-
-	irq_pio_range_t pio_ranges[] = {
-		{
-			.base = vdev->isr_phys,
-			.size = sizeof(vdev->isr_phys),
-		}
-	};
-
-	irq_cmd_t irq_commands[] = {
-		{
-			.cmd = CMD_PIO_READ_8,
-			.addr = (void *) vdev->isr_phys,
-			.dstarg = 2
-		},
-		{
-			.cmd = CMD_PREDICATE,
-			.value = 1,
-			.srcarg = 2
-		},
-		{
-			.cmd = CMD_ACCEPT
-		}
-	};
-
-	irq_code_t irq_code = {
-		.rangecount = sizeof(pio_ranges) / sizeof(irq_pio_range_t),
-		.ranges = pio_ranges,
-		.cmdcount = sizeof(irq_commands) / sizeof(irq_cmd_t),
-		.cmds = irq_commands
-	};
-
-	return register_interrupt_handler(dev, virtio_net->irq,
-	    virtio_net_irq_handler, (void *)nic, &irq_code,
-	    &virtio_net->irq_handle);
-}
-
-static errno_t virtio_net_initialize(ddf_dev_t *dev)
-{
-	nic_t *nic = nic_create_and_bind(dev);
-	if (!nic)
-		return ENOMEM;
-
-	virtio_net_t *virtio_net = calloc(1, sizeof(virtio_net_t));
-	if (!virtio_net) {
-		nic_unbind_and_destroy(dev);
-		return ENOMEM;
-	}
-
-	nic_set_specific(nic, virtio_net);
-
-	errno_t rc = virtio_pci_dev_initialize(dev, &virtio_net->virtio_dev);
-	if (rc != EOK)
-		return rc;
-
-	virtio_dev_t *vdev = &virtio_net->virtio_dev;
-	virtio_pci_common_cfg_t *cfg = virtio_net->virtio_dev.common_cfg;
-	virtio_net_cfg_t *netcfg = virtio_net->virtio_dev.device_cfg;
-
-	/*
-	 * Register IRQ
-	 */
-	rc = virtio_net_register_interrupt(dev);
-	if (rc != EOK)
-		goto fail;
-
-	/* Reset the device and negotiate the feature bits */
-	rc = virtio_device_setup_start(vdev,
-	    VIRTIO_NET_F_MAC | VIRTIO_NET_F_CTRL_VQ);
-	if (rc != EOK)
-		goto fail;
-
-	/* Perform device-specific setup */
-
-	/*
-	 * Discover and configure the virtqueues
-	 */
-	uint16_t num_queues = pio_read_le16(&cfg->num_queues);
-	if (num_queues != VIRTIO_NET_NUM_QUEUES) {
-		ddf_msg(LVL_NOTE, "Unsupported number of virtqueues: %u",
-		    num_queues);
-		rc = ELIMIT;
-		goto fail;
-	}
-
-	vdev->queues = calloc(num_queues, sizeof(virtq_t));
-	if (!vdev->queues) {
-		rc = ENOMEM;
-		goto fail;
-	}
-
-	rc = virtio_virtq_setup(vdev, RX_QUEUE_1, RX_BUFFERS);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_virtq_setup(vdev, TX_QUEUE_1, TX_BUFFERS);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_virtq_setup(vdev, CT_QUEUE_1, CT_BUFFERS);
-	if (rc != EOK)
-		goto fail;
-
-	/*
-	 * Setup DMA buffers
-	 */
-	rc = virtio_setup_dma_bufs(RX_BUFFERS, RX_BUF_SIZE, false,
-	    virtio_net->rx_buf, virtio_net->rx_buf_p);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_setup_dma_bufs(TX_BUFFERS, TX_BUF_SIZE, true,
-	    virtio_net->tx_buf, virtio_net->tx_buf_p);
-	if (rc != EOK)
-		goto fail;
-	rc = virtio_setup_dma_bufs(CT_BUFFERS, CT_BUF_SIZE, true,
-	    virtio_net->ct_buf, virtio_net->ct_buf_p);
-	if (rc != EOK)
-		goto fail;
-
-	/*
-	 * Give all RX buffers to the NIC
-	 */
-	for (unsigned i = 0; i < RX_BUFFERS; i++) {
-		/*
-		 * Associtate the buffer with the descriptor, set length and
-		 * flags.
-		 */
-		virtio_virtq_desc_set(vdev, RX_QUEUE_1, i,
-		    virtio_net->rx_buf_p[i], RX_BUF_SIZE, VIRTQ_DESC_F_WRITE,
-		    0);
-		/*
-		 * Put the set descriptor into the available ring of the RX
-		 * queue.
-		 */
-		virtio_virtq_produce_available(vdev, RX_QUEUE_1, i);
-	}
-
-	/*
-	 * Put all TX and CT buffers on a free list
-	 */
-	virtio_create_desc_free_list(vdev, TX_QUEUE_1, TX_BUFFERS,
-	    &virtio_net->tx_free_head);
-	virtio_create_desc_free_list(vdev, CT_QUEUE_1, CT_BUFFERS,
-	    &virtio_net->ct_free_head);
-
-	/*
-	 * Read the MAC address
-	 */
-	nic_address_t nic_addr;
-	for (unsigned i = 0; i < ETH_ADDR; i++)
-		nic_addr.address[i] = pio_read_8(&netcfg->mac[i]);
-	rc = nic_report_address(nic, &nic_addr);
-	if (rc != EOK)
-		goto fail;
-
-	ddf_msg(LVL_NOTE, "MAC address: " PRIMAC, ARGSMAC(nic_addr.address));
-
-	/*
-	 * Enable IRQ
-	 */
-	rc = hw_res_enable_interrupt(ddf_dev_parent_sess_get(dev),
-	    virtio_net->irq);
-	if (rc != EOK) {
-		ddf_msg(LVL_NOTE, "Failed to enable interrupt");
-		goto fail;
-	}
-
-	ddf_msg(LVL_NOTE, "Registered IRQ %d", virtio_net->irq);
-
-	/* Go live */
-	virtio_device_setup_finalize(vdev);
-
-	return EOK;
-
-fail:
-	virtio_teardown_dma_bufs(virtio_net->rx_buf);
-	virtio_teardown_dma_bufs(virtio_net->tx_buf);
-	virtio_teardown_dma_bufs(virtio_net->ct_buf);
-
-	virtio_device_setup_fail(vdev);
-	virtio_pci_dev_cleanup(vdev);
-	return rc;
-}
-
-static void virtio_net_uninitialize(ddf_dev_t *dev)
-{
-	nic_t *nic = ddf_dev_data_get(dev);
-	virtio_net_t *virtio_net = (virtio_net_t *) nic_get_specific(nic);
-
-	virtio_teardown_dma_bufs(virtio_net->rx_buf);
-	virtio_teardown_dma_bufs(virtio_net->tx_buf);
-	virtio_teardown_dma_bufs(virtio_net->ct_buf);
-
-	virtio_device_setup_fail(&virtio_net->virtio_dev);
-	virtio_pci_dev_cleanup(&virtio_net->virtio_dev);
-}
-
-static void virtio_net_send(nic_t *nic, void *data, size_t size)
-{
-	virtio_net_t *virtio_net = nic_get_specific(nic);
-	virtio_dev_t *vdev = &virtio_net->virtio_dev;
-
-	if (size > sizeof(virtio_net) + TX_BUF_SIZE) {
-		ddf_msg(LVL_WARN, "TX data too big, frame dropped");
-		return;
-	}
-
-	uint16_t descno = virtio_alloc_desc(vdev, TX_QUEUE_1,
-	    &virtio_net->tx_free_head);
-	if (descno == (uint16_t) -1U) {
-		ddf_msg(LVL_WARN, "No TX buffers available, frame dropped");
-		return;
-	}
-	assert(descno < TX_BUFFERS);
-
-	/* Setup the packet header */
-	virtio_net_hdr_t *hdr = (virtio_net_hdr_t *) virtio_net->tx_buf[descno];
-	memset(hdr, 0, sizeof(virtio_net_hdr_t));
-	hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
-	hdr->num_buffers = 0;
-
-	/* Copy packet data into the buffer just past the header */
-	memcpy(&hdr[1], data, size);
-
-	/*
-	 * Set the descriptor, put it into the virtqueue and notify the device
-	 */
-	virtio_virtq_desc_set(vdev, TX_QUEUE_1, descno,
-	    virtio_net->tx_buf_p[descno], sizeof(virtio_net_hdr_t) + size, 0, 0);
-	virtio_virtq_produce_available(vdev, TX_QUEUE_1, descno);
-}
-
-static errno_t virtio_net_on_multicast_mode_change(nic_t *nic,
-    nic_multicast_mode_t new_mode, const nic_address_t *address_list,
-    size_t address_count)
-{
-	switch (new_mode) {
-	case NIC_MULTICAST_BLOCKED:
-		nic_report_hw_filtering(nic, -1, 0, -1);
-		return EOK;
-	case NIC_MULTICAST_LIST:
-		nic_report_hw_filtering(nic, -1, 0, -1);
-		return EOK;
-	case NIC_MULTICAST_PROMISC:
-		nic_report_hw_filtering(nic, -1, 0, -1);
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-	return EOK;
-}
-
-static errno_t virtio_net_on_broadcast_mode_change(nic_t *nic,
-    nic_broadcast_mode_t new_mode)
-{
-	switch (new_mode) {
-	case NIC_BROADCAST_BLOCKED:
-		return ENOTSUP;
-	case NIC_BROADCAST_ACCEPTED:
-		return EOK;
-	default:
-		return ENOTSUP;
-	}
-}
-
-static errno_t virtio_net_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "%s %s (handle = %zu)", __func__,
-	    ddf_dev_get_name(dev), ddf_dev_get_handle(dev));
-
-	errno_t rc = virtio_net_initialize(dev);
-	if (rc != EOK)
-		return rc;
-
-	ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "port0");
-	if (fun == NULL) {
-		rc = ENOMEM;
-		goto uninitialize;
-	}
-	nic_t *nic = ddf_dev_data_get(dev);
-	nic_set_ddf_fun(nic, fun);
-	ddf_fun_set_ops(fun, &virtio_net_dev_ops);
-
-	nic_set_send_frame_handler(nic, virtio_net_send);
-	nic_set_filtering_change_handlers(nic, NULL,
-	    virtio_net_on_multicast_mode_change,
-	    virtio_net_on_broadcast_mode_change, NULL, NULL);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding device function");
-		goto destroy;
-	}
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function to category");
-		goto unbind;
-	}
-
-	ddf_msg(LVL_NOTE, "The %s device has been successfully initialized.",
-	    ddf_dev_get_name(dev));
-
-	return EOK;
-
-unbind:
-	ddf_fun_unbind(fun);
-destroy:
-	ddf_fun_destroy(fun);
-uninitialize:
-	virtio_net_uninitialize(dev);
-	return rc;
-}
-
-static errno_t virtio_net_get_device_info(ddf_fun_t *fun,
-    nic_device_info_t *info)
-{
-	nic_t *nic = nic_get_from_ddf_fun(fun);
-	if (!nic)
-		return ENOENT;
-
-	str_cpy(info->vendor_name, sizeof(info->vendor_name), "Red Hat, Inc.");
-	str_cpy(info->model_name, sizeof(info->model_name),
-	    "Virtio network device");
-
-	return EOK;
-}
-
-static errno_t virtio_net_get_cable_state(ddf_fun_t *fun,
-    nic_cable_state_t *state)
-{
-	*state = NIC_CS_PLUGGED;
-	return EOK;
-}
-
-static errno_t virtio_net_get_operation_mode(ddf_fun_t *fun, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	*speed = 1000;
-	*duplex = NIC_CM_FULL_DUPLEX;
-	*role = NIC_ROLE_UNKNOWN;
-	return EOK;
-}
-
-static nic_iface_t virtio_net_nic_iface = {
-	.get_device_info = virtio_net_get_device_info,
-	.get_cable_state = virtio_net_get_cable_state,
-	.get_operation_mode = virtio_net_get_operation_mode,
-};
-
-int main(void)
-{
-	printf("%s: HelenOS virtio-net driver\n", NAME);
-
-	if (nic_driver_init(NAME) != EOK)
-		return 1;
-
-	nic_driver_implement(&virtio_net_driver_ops, &virtio_net_dev_ops,
-	    &virtio_net_nic_iface);
-
-	(void) ddf_log_init(NAME);
-	return ddf_driver_main(&virtio_net_driver);
-}
Index: pace/drv/nic/virtio-net/virtio-net.h
===================================================================
--- uspace/drv/nic/virtio-net/virtio-net.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _VIRTIO_NET_H_
-#define _VIRTIO_NET_H_
-
-#include <virtio-pci.h>
-#include <abi/cap.h>
-#include <nic/nic.h>
-
-#define RX_BUFFERS	8
-#define TX_BUFFERS	8
-#define CT_BUFFERS	4
-
-/** Device handles packets with partial checksum. */
-#define VIRTIO_NET_F_CSUM		(1U << 0)
-/** Driver handles packets with partial checksum. */
-#define VIRTIO_NET_F_GUEST_CSUM		(1U << 2)
-/** Device has given MAC address. */
-#define VIRTIO_NET_F_MAC		(1U << 5)
-/** Control channel is available */
-#define VIRTIO_NET_F_CTRL_VQ		(1U << 17)
-
-#define VIRTIO_NET_HDR_GSO_NONE 0
-typedef struct {
-	uint8_t flags;
-	uint8_t gso_type;
-	uint16_t hdr_len;
-	uint16_t gso_size;
-	uint16_t csum_start;
-	uint16_t csum_offset;
-	uint16_t num_buffers;
-} virtio_net_hdr_t;
-
-typedef struct {
-	uint8_t mac[ETH_ADDR];
-} virtio_net_cfg_t;
-
-typedef struct {
-	virtio_dev_t virtio_dev;
-	void *rx_buf[RX_BUFFERS];
-	uintptr_t rx_buf_p[RX_BUFFERS];
-	void *tx_buf[TX_BUFFERS];
-	uintptr_t tx_buf_p[TX_BUFFERS];
-	void *ct_buf[CT_BUFFERS];
-	uintptr_t ct_buf_p[CT_BUFFERS];
-
-	uint16_t tx_free_head;
-	uint16_t ct_free_head;
-
-	int irq;
-	cap_irq_handle_t irq_handle;
-} virtio_net_t;
-
-#endif
Index: pace/drv/nic/virtio-net/virtio-net.ma
===================================================================
--- uspace/drv/nic/virtio-net/virtio-net.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 pci/ven=1af4&dev=1000
-10 pci/ven=1af4&dev=1041
Index: pace/drv/platform/amdm37x/amdm37x.c
===================================================================
--- uspace/drv/platform/amdm37x/amdm37x.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,425 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup amdm37x
- * @{
- */
-
-/** @file
- */
-
-#include "amdm37x.h"
-
-#include <assert.h>
-#include <ddi.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <stdio.h>
-
-static void
-log_message(const volatile void *place, uint64_t val, volatile void *base, size_t size,
-    void *data, bool write)
-{
-	printf("PIO %s: %p(%p) %#" PRIx64 "\n", write ? "WRITE" : "READ",
-	    (place - base) + data, place, val);
-}
-
-errno_t amdm37x_init(amdm37x_t *device, bool trace)
-{
-	assert(device);
-	errno_t ret = EOK;
-
-	ret = pio_enable((void *)USBHOST_CM_BASE_ADDRESS, USBHOST_CM_SIZE,
-	    (void **)&device->cm.usbhost);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)CORE_CM_BASE_ADDRESS, CORE_CM_SIZE,
-	    (void **)&device->cm.core);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)CLOCK_CONTROL_CM_BASE_ADDRESS,
-	    CLOCK_CONTROL_CM_SIZE, (void **)&device->cm.clocks);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)MPU_CM_BASE_ADDRESS,
-	    MPU_CM_SIZE, (void **)&device->cm.mpu);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)IVA2_CM_BASE_ADDRESS,
-	    IVA2_CM_SIZE, (void **)&device->cm.iva2);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)CLOCK_CONTROL_PRM_BASE_ADDRESS,
-	    CLOCK_CONTROL_PRM_SIZE, (void **)&device->prm.clocks);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)GLOBAL_REG_PRM_BASE_ADDRESS,
-	    GLOBAL_REG_PRM_SIZE, (void **)&device->prm.global);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)AMDM37x_USBTLL_BASE_ADDRESS,
-	    AMDM37x_USBTLL_SIZE, (void **)&device->tll);
-	if (ret != EOK)
-		return ret;
-
-	ret = pio_enable((void *)AMDM37x_UHH_BASE_ADDRESS,
-	    AMDM37x_UHH_SIZE, (void **)&device->uhh);
-	if (ret != EOK)
-		return ret;
-
-	if (trace) {
-		pio_trace_enable(device->tll, AMDM37x_USBTLL_SIZE, log_message, (void *)AMDM37x_USBTLL_BASE_ADDRESS);
-		pio_trace_enable(device->cm.clocks, CLOCK_CONTROL_CM_SIZE, log_message, (void *)CLOCK_CONTROL_CM_BASE_ADDRESS);
-		pio_trace_enable(device->cm.core, CORE_CM_SIZE, log_message, (void *)CORE_CM_BASE_ADDRESS);
-		pio_trace_enable(device->cm.mpu, MPU_CM_SIZE, log_message, (void *)MPU_CM_BASE_ADDRESS);
-		pio_trace_enable(device->cm.iva2, IVA2_CM_SIZE, log_message, (void *)IVA2_CM_BASE_ADDRESS);
-		pio_trace_enable(device->cm.usbhost, USBHOST_CM_SIZE, log_message, (void *)USBHOST_CM_BASE_ADDRESS);
-		pio_trace_enable(device->uhh, AMDM37x_UHH_SIZE, log_message, (void *)AMDM37x_UHH_BASE_ADDRESS);
-		pio_trace_enable(device->prm.clocks, CLOCK_CONTROL_PRM_SIZE, log_message, (void *)CLOCK_CONTROL_PRM_BASE_ADDRESS);
-		pio_trace_enable(device->prm.global, GLOBAL_REG_PRM_SIZE, log_message, (void *)GLOBAL_REG_PRM_BASE_ADDRESS);
-	}
-	return EOK;
-}
-
-/** Set DPLLs 1,2,3,4,5 to ON (locked) and autoidle.
- * @param device Register map.
- *
- * The idea is to get all DPLLs running and make hw control their power mode,
- * based on the module requirements (module ICLKs and FCLKs).
- */
-void amdm37x_setup_dpll_on_autoidle(amdm37x_t *device)
-{
-	assert(device);
-	/*
-	 * Get SYS_CLK value, it is used as reference clock by all DPLLs,
-	 * NFI who sets this or why it is set to specific value.
-	 */
-	const unsigned osc_clk = pio_read_32(&device->prm.clocks->clksel) &
-	    CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_MASK;
-	const unsigned clk_reg = pio_read_32(&device->prm.global->clksrc_ctrl);
-	const unsigned base_freq = sys_clk_freq_kHz(osc_clk) /
-	    GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKDIV_GET(clk_reg);
-	ddf_msg(LVL_NOTE, "Base frequency: %d.%dMhz",
-	    base_freq / 1000, base_freq % 1000);
-
-	/*
-	 * DPLL1 provides MPU(CPU) clock.
-	 * It uses SYS_CLK as reference clock and core clock (DPLL3) as
-	 * high frequency bypass (MPU then runs on L3 interconnect freq).
-	 * It should be setup by fw or u-boot.
-	 */
-	mpu_cm_regs_t *mpu = device->cm.mpu;
-
-	/* Current MPU frequency. */
-	if (pio_read_32(&mpu->clkstst) & MPU_CM_CLKSTST_CLKACTIVITY_MPU_ACTIVE_FLAG) {
-		if (pio_read_32(&mpu->idlest_pll) & MPU_CM_IDLEST_PLL_ST_MPU_CLK_LOCKED_FLAG) {
-			/* DPLL active and locked */
-			const uint32_t reg = pio_read_32(&mpu->clksel1_pll);
-			const unsigned multiplier =
-			    (reg & MPU_CM_CLKSEL1_PLL_MPU_DPLL_MULT_MASK) >>
-			    MPU_CM_CLKSEL1_PLL_MPU_DPLL_MULT_SHIFT;
-			const unsigned divisor =
-			    (reg & MPU_CM_CLKSEL1_PLL_MPU_DPLL_DIV_MASK) >>
-			    MPU_CM_CLKSEL1_PLL_MPU_DPLL_DIV_SHIFT;
-			const unsigned divisor2 =
-			    (pio_read_32(&mpu->clksel2_pll) &
-			    MPU_CM_CLKSEL2_PLL_MPU_DPLL_CLKOUT_DIV_MASK);
-			if (multiplier && divisor && divisor2) {
-				/** See AMDM37x TRM p. 300 for the formula */
-				const unsigned freq =
-				    ((base_freq * multiplier) / (divisor + 1)) /
-				    divisor2;
-				ddf_msg(LVL_NOTE, "MPU running at %d.%d MHz",
-				    freq / 1000, freq % 1000);
-			} else {
-				ddf_msg(LVL_WARN, "Frequency divisor and/or "
-				    "multiplier value invalid: %d %d %d",
-				    multiplier, divisor, divisor2);
-			}
-		} else {
-			/* DPLL in LP bypass mode */
-			const unsigned divisor =
-			    MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_VAL(
-			    pio_read_32(&mpu->clksel1_pll));
-			ddf_msg(LVL_NOTE, "MPU DPLL in bypass mode, running at"
-			    " CORE CLK / %d MHz", divisor);
-		}
-	} else {
-		ddf_msg(LVL_WARN, "MPU clock domain is not active, we should not be running...");
-	}
-	// TODO: Enable this (automatic MPU downclocking):
-#if 0
-	/*
-	 * Enable low power bypass mode, this will take effect the next lock or
-	 * relock sequence.
-	 */
-	//TODO: We might need to force re-lock after enabling this
-	pio_set_32(&mpu->clken_pll, MPU_CM_CLKEN_PLL_EN_MPU_DPLL_LP_MODE_FLAG, 5);
-	/* Enable automatic relocking */
-	pio_change_32(&mpu->autoidle_pll, MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_ENABLED, MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_MASK, 5);
-#endif
-
-	/*
-	 * DPLL2 provides IVA(video acceleration) clock.
-	 * It uses SYS_CLK as reference clokc and core clock (DPLL3) as
-	 * high frequency bypass (IVA runs on L3 freq).
-	 */
-	// TODO: We can probably turn this off entirely. IVA is left unused.
-	/*
-	 * Enable low power bypass mode, this will take effect the next lock or
-	 * relock sequence.
-	 */
-	//TODO: We might need to force re-lock after enabling this
-	pio_set_32(&device->cm.iva2->clken_pll, MPU_CM_CLKEN_PLL_EN_MPU_DPLL_LP_MODE_FLAG, 5);
-	/* Enable automatic relocking */
-	pio_change_32(&device->cm.iva2->autoidle_pll, MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_ENABLED, MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_MASK, 5);
-
-	/*
-	 * DPLL3 provides tons of clocks:
-	 * CORE_CLK, COREX2_CLK, DSS_TV_CLK, 12M_CLK, 48M_CLK, 96M_CLK, L3_ICLK,
-	 * and L4_ICLK. It uses SYS_CLK as reference clock and low frequency
-	 * bypass. It should be setup by fw or u-boot as it controls critical
-	 * interconnects.
-	 */
-	if (pio_read_32(&device->cm.clocks->idlest_ckgen) & CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_CORE_CLK_FLAG) {
-		/* DPLL active and locked */
-		const uint32_t reg =
-		    pio_read_32(&device->cm.clocks->clksel1_pll);
-		const unsigned multiplier =
-		    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_GET(reg);
-		const unsigned divisor =
-		    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_GET(reg);
-		const unsigned divisor2 =
-		    CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_GET(reg);
-		if (multiplier && divisor && divisor2) {
-			/** See AMDM37x TRM p. 300 for the formula */
-			const unsigned freq =
-			    ((base_freq * multiplier) / (divisor + 1)) / divisor2;
-			ddf_msg(LVL_NOTE, "CORE CLK running at %d.%d MHz",
-			    freq / 1000, freq % 1000);
-			const unsigned l3_div =
-			    pio_read_32(&device->cm.core->clksel) &
-			    CORE_CM_CLKSEL_CLKSEL_L3_MASK;
-			if (l3_div == CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED1 ||
-			    l3_div == CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED2) {
-				ddf_msg(LVL_NOTE, "L3 interface at %d.%d MHz",
-				    (freq / l3_div) / 1000,
-				    (freq / l3_div) % 1000);
-			} else {
-				ddf_msg(LVL_WARN, "L3 interface clock divisor is"
-				    " invalid: %d", l3_div);
-			}
-		} else {
-			ddf_msg(LVL_WARN, "DPLL3 frequency divisor and/or "
-			    "multiplier value invalid: %d %d %d",
-			    multiplier, divisor, divisor2);
-		}
-	} else {
-		ddf_msg(LVL_WARN, "CORE CLK in bypass mode, fruunig at SYS_CLK"
-		    " frreq of %d.%d MHz", base_freq / 1000, base_freq % 1000);
-	}
-
-	/* Set DPLL3 to automatic to save power */
-	pio_change_32(&device->cm.clocks->autoidle_pll,
-	    CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_AUTOMATIC,
-	    CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_MASK, 5);
-
-	/*
-	 * DPLL4 provides peripheral domain clocks:
-	 * CAM_MCLK, EMU_PER_ALWON_CLK, DSS1_ALWON_FCLK, and 96M_ALWON_FCLK.
-	 * It uses SYS_CLK as reference clock and low frequency bypass.
-	 * 96M clock is used by McBSP[1,5], MMC[1,2,3], I2C[1,2,3], so
-	 * we can probably turn this off entirely (DSS is still non-functional).
-	 */
-	/* Set DPLL4 to automatic to save power */
-	pio_change_32(&device->cm.clocks->autoidle_pll,
-	    CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_PERIPH_DPLL_AUTOMATIC,
-	    CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_PERIPH_DPLL_MASK, 5);
-
-	/*
-	 * DPLL5 provide peripheral domain clocks: 120M_FCLK.
-	 * It uses SYS_CLK as reference clock and low frequency bypass.
-	 * 120M clock is used by HS USB and USB TLL.
-	 */
-	// TODO setup DPLL5
-	if ((pio_read_32(&device->cm.clocks->clken2_pll) &
-	    CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_MASK) !=
-	    CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LOCK) {
-		/*
-		 * Compute divisors and multiplier
-		 * See AMDM37x TRM p. 300 for the formula
-		 */
-		// TODO: base_freq does not have to be rounded to Mhz
-		// (that's why I used KHz as unit).
-		const unsigned mult = 120;
-		const unsigned div = (base_freq / 1000) - 1;
-		const unsigned div2 = 1;
-		if (((base_freq % 1000) != 0) || (div > 127)) {
-			ddf_msg(LVL_ERROR, "Rounding error, or divisor to big "
-			    "freq: %d, div: %d", base_freq, div);
-			return;
-		}
-		assert(div <= 127);
-
-		/* Set multiplier */
-		pio_change_32(&device->cm.clocks->clksel4_pll,
-		    CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_MULT_CREATE(mult),
-		    CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_MULT_MASK, 10);
-
-		/* Set DPLL divisor */
-		pio_change_32(&device->cm.clocks->clksel4_pll,
-		    CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_DIV_CREATE(div),
-		    CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_DIV_MASK, 10);
-
-		/* Set output clock divisor */
-		pio_change_32(&device->cm.clocks->clksel5_pll,
-		    CLOCK_CONTROL_CM_CLKSEL5_PLL_DIV120M_CREATE(div2),
-		    CLOCK_CONTROL_CM_CLKSEL5_PLL_DIV120M_MASK, 10);
-
-		/* Start DPLL5 */
-		pio_change_32(&device->cm.clocks->clken2_pll,
-		    CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LOCK,
-		    CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_MASK, 10);
-
-	}
-	/* Set DPLL5 to automatic to save power */
-	pio_change_32(&device->cm.clocks->autoidle2_pll,
-	    CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_AUTOMATIC,
-	    CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_MASK, 5);
-}
-
-/** Enable/disable function and interface clocks for USBTLL and USBHOST.
- * @param device Register map.
- * @param on True to switch clocks on.
- */
-void amdm37x_usb_clocks_set(amdm37x_t *device, bool enabled)
-{
-	if (enabled) {
-		/* Enable interface and function clock for USB TLL */
-		pio_set_32(&device->cm.core->fclken3,
-		    CORE_CM_FCLKEN3_EN_USBTLL_FLAG, 5);
-		pio_set_32(&device->cm.core->iclken3,
-		    CORE_CM_ICLKEN3_EN_USBTLL_FLAG, 5);
-
-		/* Enable interface and function clock for USB hosts */
-		pio_set_32(&device->cm.usbhost->fclken,
-		    USBHOST_CM_FCLKEN_EN_USBHOST1_FLAG |
-		    USBHOST_CM_FCLKEN_EN_USBHOST2_FLAG, 5);
-		pio_set_32(&device->cm.usbhost->iclken,
-		    USBHOST_CM_ICLKEN_EN_USBHOST, 5);
-#if 0
-		printf("DPLL5 (and everything else) should be on: %"
-		    PRIx32 " %" PRIx32 ".\n",
-		    pio_read_32(&device->cm.clocks->idlest_ckgen),
-		    pio_read_32(&device->cm.clocks->idlest2_ckgen));
-#endif
-	} else {
-		/* Disable interface and function clock for USB hosts */
-		pio_clear_32(&device->cm.usbhost->iclken,
-		    USBHOST_CM_ICLKEN_EN_USBHOST, 5);
-		pio_clear_32(&device->cm.usbhost->fclken,
-		    USBHOST_CM_FCLKEN_EN_USBHOST1_FLAG |
-		    USBHOST_CM_FCLKEN_EN_USBHOST2_FLAG, 5);
-
-		/* Disable interface and function clock for USB TLL */
-		pio_clear_32(&device->cm.core->iclken3,
-		    CORE_CM_ICLKEN3_EN_USBTLL_FLAG, 5);
-		pio_clear_32(&device->cm.core->fclken3,
-		    CORE_CM_FCLKEN3_EN_USBTLL_FLAG, 5);
-	}
-}
-
-/** Initialize USB TLL port connections.
- *
- * Different modes are on page 3312 of the Manual Figure 22-34.
- * Select mode than can operate in FS/LS.
- */
-errno_t amdm37x_usb_tll_init(amdm37x_t *device)
-{
-	/* Check access */
-	if (pio_read_32(&device->cm.core->idlest3) & CORE_CM_IDLEST3_ST_USBTLL_FLAG) {
-		ddf_msg(LVL_ERROR, "USB TLL is not accessible");
-		return EIO;
-	}
-
-	/* Reset USB TLL */
-	pio_set_32(&device->tll->sysconfig, TLL_SYSCONFIG_SOFTRESET_FLAG, 5);
-	ddf_msg(LVL_DEBUG2, "Waiting for USB TLL reset");
-	while (!(pio_read_32(&device->tll->sysstatus) & TLL_SYSSTATUS_RESET_DONE_FLAG))
-		;
-	ddf_msg(LVL_DEBUG, "USB TLL Reset done.");
-
-	/* Setup idle mode (smart idle) */
-	pio_change_32(&device->tll->sysconfig,
-	    TLL_SYSCONFIG_CLOCKACTIVITY_FLAG | TLL_SYSCONFIG_AUTOIDLE_FLAG |
-	    TLL_SYSCONFIG_SIDLE_MODE_SMART, TLL_SYSCONFIG_SIDLE_MODE_MASK, 5);
-
-	/* Smart idle for UHH */
-	pio_change_32(&device->uhh->sysconfig,
-	    UHH_SYSCONFIG_CLOCKACTIVITY_FLAG | UHH_SYSCONFIG_AUTOIDLE_FLAG |
-	    UHH_SYSCONFIG_SIDLE_MODE_SMART, UHH_SYSCONFIG_SIDLE_MODE_MASK, 5);
-
-	/*
-	 * Set all ports to go through TLL(UTMI)
-	 * Direct connection can only work in HS mode
-	 */
-	pio_set_32(&device->uhh->hostconfig,
-	    UHH_HOSTCONFIG_P1_ULPI_BYPASS_FLAG |
-	    UHH_HOSTCONFIG_P2_ULPI_BYPASS_FLAG |
-	    UHH_HOSTCONFIG_P3_ULPI_BYPASS_FLAG, 5);
-
-	/* What is this? */
-	pio_set_32(&device->tll->shared_conf, TLL_SHARED_CONF_FCLK_IS_ON_FLAG, 5);
-
-	for (unsigned i = 0; i < 3; ++i) {
-		/*
-		 * Serial mode is the only one capable of FS/LS operation.
-		 * Select FS/LS mode, no idea what the difference is
-		 * one of bidirectional modes might be good choice
-		 * 2 = 3pin bidi phy.
-		 */
-		pio_change_32(&device->tll->channel_conf[i],
-		    TLL_CHANNEL_CONF_CHANMODE_UTMI_SERIAL_MODE |
-		    TLL_CHANNEL_CONF_FSLSMODE_3PIN_BIDI_PHY,
-		    TLL_CHANNEL_CONF_CHANMODE_MASK |
-		    TLL_CHANNEL_CONF_FSLSMODE_MASK, 5);
-	}
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/amdm37x.h
===================================================================
--- uspace/drv/platform/amdm37x/amdm37x.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief AM/DM 37x device.
- */
-#ifndef AMDM37x_H
-#define AMDM37x_H
-
-#include "uhh.h"
-#include "usbtll.h"
-
-#include "cm/core.h"
-#include "cm/clock_control.h"
-#include "cm/usbhost.h"
-#include "cm/mpu.h"
-#include "cm/iva2.h"
-
-#include "prm/clock_control.h"
-#include "prm/global_reg.h"
-
-#include <stdbool.h>
-
-typedef struct {
-	uhh_regs_t *uhh;
-	tll_regs_t *tll;
-	struct {
-		mpu_cm_regs_t *mpu;
-		iva2_cm_regs_t *iva2;
-		core_cm_regs_t *core;
-		clock_control_cm_regs_t *clocks;
-		usbhost_cm_regs_t *usbhost;
-	} cm;
-	struct {
-		clock_control_prm_regs_t *clocks;
-		global_reg_prm_regs_t *global;
-	} prm;
-} amdm37x_t;
-
-errno_t amdm37x_init(amdm37x_t *device, bool trace_io);
-errno_t amdm37x_usb_tll_init(amdm37x_t *device);
-void amdm37x_setup_dpll_on_autoidle(amdm37x_t *device);
-void amdm37x_usb_clocks_set(amdm37x_t *device, bool enabled);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/amdm37x.ma
===================================================================
--- uspace/drv/platform/amdm37x/amdm37x.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/beagleboardxm
Index: pace/drv/platform/amdm37x/cm/clock_control.h
===================================================================
--- uspace/drv/platform/amdm37x/cm/clock_control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief Clock Control Clock Management IO register structure.
- */
-#ifndef AMDM37x_CLOCK_CONTROL_CM_H
-#define AMDM37x_CLOCK_CONTROL_CM_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.485 */
-#define CLOCK_CONTROL_CM_BASE_ADDRESS  0x48004d00
-#define CLOCK_CONTROL_CM_SIZE  8192
-
-/** Clock control register map
- *
- * Periph DPLL == DPLL4
- * Core DPLL == DPLL3
- */
-typedef struct {
-	ioport32_t clken_pll;
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_EMU_PERIPH_FLAG   (1 << 31)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_CAM_FLAG   (1 << 30)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_DSS1_FLAG   (1 << 29)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_TV_FLAG   (1 << 28)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_96M_FLAG   (1 << 27)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_PERIPH_DPLL_DRIFTGUARD_FLAG   (1 << 19)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_PERIPH_DPLL_MASK   (0x7 << 16)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_PERIPH_DPLL_LP_STOP   (0x1 << 16)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_PERIPH_DPLL_LOCK   (0x7 << 16)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_PWRDN_EMU_CORE_FLAG   (1 << 12)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_LPMODE_FLAG   (1 << 10)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_DRIFTGUARD_FLAG   (1 << 3)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_MASK   (0x7)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_LP_BYPASS   (0x5)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_FAST_RELOCK   (0x6)
-#define CLOCK_CONTROL_CM_CLKEN_PLL_EN_CORE_DPLL_LOCK   (0x7)
-
-	ioport32_t clken2_pll;
-#define CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LPMODE_FLAG   (1 << 10)
-#define CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_DRIFTGUARD_FLAG   (1 << 3)
-#define CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_MASK   (0x7)
-#define CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LP_STOP   (0x1)
-#define CLOCK_CONTROL_CM_CLKEN2_PLL_EN_PERIPH2_DPLL_LOCK   (0x7)
-
-	PADD32(6);
-
-	const ioport32_t idlest_ckgen;
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_EMU_PERIPH_CLK_FLAG   (1 << 13)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_CAM_CLK_FLAG   (1 << 12)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_DSS1_CLK_FLAG   (1 << 11)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_TV_CLK_FLAG   (1 << 10)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_FUNC96M_CLK_FLAG   (1 << 9)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_EMU_CORE_CLK_FLAG   (1 << 8)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_54M_CLK_FLAG   (1 << 5)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_12M_CLK_FLAG   (1 << 4)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_48M_CLK_FLAG   (1 << 3)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_96M_CLK_FLAG   (1 << 2)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_PERIPH_CLK_FLAG   (1 << 1)
-#define CLOCK_CONTROL_CM_IDLEST_CKGEN_ST_CORE_CLK_FLAG   (1 << 0)
-
-	const ioport32_t idlest2_ckgen;
-#define CLOCK_CONTROL_CM_IDLEST2_CKGEN_ST_FUNC120M_CLK_FLAG   (1 << 3)
-#define CLOCK_CONTROL_CM_IDLEST2_CKGEN_ST_120M_CLK_FLAG   (1 << 1)
-#define CLOCK_CONTROL_CM_IDLEST2_CKGEN_ST_PERIPH2_CLK_FLAG   (1 << 0)
-
-	PADD32(2);
-
-	ioport32_t autoidle_pll;
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_PERIPH_DPLL_MASK   (0x7 << 3)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_PERIPH_DPLL_DISABLED   (0x0 << 3)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_PERIPH_DPLL_AUTOMATIC   (0x1 << 3)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_MASK   (0x7)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_DISABLED   (0x0)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_AUTOMATIC   (0x1)
-#define CLOCK_CONTROL_CM_AUTOIDLE_PLL_AUTO_CORE_DPLL_AUTOMATIC_BYPASS   (0x5)
-
-	ioport32_t autoidle2_pll;
-#define CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_MASK   (0x7)
-#define CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_DISABLED   (0x0)
-#define CLOCK_CONTROL_CM_AUTOIDLE2_PLL_AUTO_PERIPH2_DPLL_AUTOMATIC   (0x1)
-
-	PADD32(2);
-
-	ioport32_t clksel1_pll;
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_MASK   (0x1f << 27)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_CREATE(x)   (((x) & 0x1f) << 27)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_CLKOUT_DIV_GET(x)   (((x) >> 27) & 0x1f)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_MASK   (0x7ff << 16)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_CREATE(x)   (((x) & 0x7ff) << 16)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_MULT_GET(x)   (((x) >> 16) & 0x7ff)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_MASK   (0x7f << 8)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_CREATE(x)   (((x) & 0x7f) << 8)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_CORE_DPLL_DIV_GET(x)   (((x) >> 8) & 0x7f)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_SOURCE_96M_FLAG   (1 << 6)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_SOURCE_54M_FLAG   (1 << 5)
-#define CLOCK_CONTROL_CM_CLKSEL1_PLL_SOURCE_48M_FLAG   (1 << 3)
-
-	ioport32_t clksel2_pll;
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_SD_DIV_MASK   (0xff << 24)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_SD_DIV_(x)   (((x) & 0xff) << 24)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_DCO_SEL_MASK   (0x7 << 21)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_DCO_SEL_500   (0x2 << 21)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_DCO_SEL_1000   (0x4 << 21)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_PERIPH_DPLL_MULT_MASK   (0xfff << 8)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_PERIPH_DPLL_MULT(x)   (((x) & 0xfff) << 8)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_PERIPH_DPLL_DIV_MASK   (0x7f)
-#define CLOCK_CONTROL_CM_CLKSEL2_PLL_PERIPH_DPLL_DIV(x)   ((x) & 0x7f)
-
-	ioport32_t clksel3_pll;
-#define CLOCK_CONTROL_CM_CLKSEL3_PLL_DIV_96M_MASK   (0xf)
-#define CLOCK_CONTROL_CM_CLKSEL3_PLL_DIV_96M(x)   ((x) & 0xf)
-
-	ioport32_t clksel4_pll;
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_MULT_MASK   (0x7ff << 8)
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_MULT_CREATE(x)   (((x) & 0x7ff) << 8)
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_MULT_GET(x)   (((x) >> 8) & 0x7ff)
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_DIV_MASK   (0x7f)
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_DIV_CREATE(x)   ((x) & 0x7f)
-#define CLOCK_CONTROL_CM_CLKSEL4_PLL_PERIPH2_DPLL_DIV_GET(x)   ((x) & 0x7f)
-
-	ioport32_t clksel5_pll;
-#define CLOCK_CONTROL_CM_CLKSEL5_PLL_DIV120M_MASK   (0x1f)
-#define CLOCK_CONTROL_CM_CLKSEL5_PLL_DIV120M_CREATE(x)   ((x) & 0x1f)
-#define CLOCK_CONTROL_CM_CLKSEL5_PLL_DIV120M_GET(x)   ((x) & 0x1f)
-} clock_control_cm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/cm/core.h
===================================================================
--- uspace/drv/platform/amdm37x/cm/core.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief CORE Clock Management IO register structure.
- */
-#ifndef AMDM37x_CORE_CM_H
-#define AMDM37x_CORE_CM_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.447 */
-#define CORE_CM_BASE_ADDRESS  0x48004a00
-#define CORE_CM_SIZE  8192
-
-typedef struct {
-	ioport32_t fclken1;
-#define CORE_CM_FCLKEN1_EN_MCBSP1_FLAG  (1 << 9)
-#define CORE_CM_FCLKEN1_EN_MCBSP5_FLAG  (1 << 10)
-#define CORE_CM_FCLKEN1_EN_GPT10_FLAG  (1 << 11)
-#define CORE_CM_FCLKEN1_EN_GPT11_FLAG  (1 << 12)
-#define CORE_CM_FCLKEN1_EN_UART1_FLAG  (1 << 13)
-#define CORE_CM_FCLKEN1_EN_UART2_FLAG  (1 << 14)
-#define CORE_CM_FCLKEN1_EN_I2C1_FLAG  (1 << 15)
-#define CORE_CM_FCLKEN1_EN_I2C2_FLAG  (1 << 16)
-#define CORE_CM_FCLKEN1_EN_I2C3_FLAG  (1 << 17)
-#define CORE_CM_FCLKEN1_EN_MCSPI1_FLAG  (1 << 18)
-#define CORE_CM_FCLKEN1_EN_MCSPI2_FLAG  (1 << 19)
-#define CORE_CM_FCLKEN1_EN_MCSPI3_FLAG  (1 << 20)
-#define CORE_CM_FCLKEN1_EN_MCSPI4_FLAG  (1 << 21)
-#define CORE_CM_FCLKEN1_EN_HDQ_FLAG  (1 << 22)
-#define CORE_CM_FCLKEN1_EN_MMC1_FLAG  (1 << 24)
-#define CORE_CM_FCLKEN1_EN_MMC2_FLAG  (1 << 25)
-#define CORE_CM_FCLKEN1_EN_MMC3_FLAG  (1 << 30)
-
-	PADD32(1);
-	ioport32_t fclken3;
-#define CORE_CM_FCLKEN3_EN_TS_FLAG  (1 << 1)
-#define CORE_CM_FCLKEN3_EN_USBTLL_FLAG  (1 << 2)
-
-	PADD32(1);
-	ioport32_t iclken1;
-#define CORE_CM_ICLKEN1_EN_SDRC_FLAG  (1 << 1)
-#define CORE_CM_ICLKEN1_EN_HSOTGUSB_FLAG  (1 << 4)
-#define CORE_CM_ICLKEN1_EN_SCMCTRL_FLAG  (1 << 6)
-#define CORE_CM_ICLKEN1_EN_MAILBOXES_FLAG  (1 << 7)
-#define CORE_CM_ICLKEN1_EN_MCBSP1_FLAG  (1 << 9)
-#define CORE_CM_ICLKEN1_EN_MCBSP5_FLAG  (1 << 10)
-#define CORE_CM_ICLKEN1_EN_GPT10_FLAG  (1 << 11)
-#define CORE_CM_ICLKEN1_EN_GPT11_FLAG  (1 << 12)
-#define CORE_CM_ICLKEN1_EN_UART1_FLAG  (1 << 13)
-#define CORE_CM_ICLKEN1_EN_UART2_FLAG  (1 << 14)
-#define CORE_CM_ICLKEN1_EN_I2C1_FLAG  (1 << 15)
-#define CORE_CM_ICLKEN1_EN_I2C2_FLAG  (1 << 16)
-#define CORE_CM_ICLKEN1_EN_I2C3_FLAG  (1 << 17)
-#define CORE_CM_ICLKEN1_EN_MCSPI1_FLAG  (1 << 18)
-#define CORE_CM_ICLKEN1_EN_MCSPI2_FLAG  (1 << 19)
-#define CORE_CM_ICLKEN1_EN_MCSPI3_FLAG  (1 << 20)
-#define CORE_CM_ICLKEN1_EN_MCSPI4_FLAG  (1 << 21)
-#define CORE_CM_ICLKEN1_EN_HDQ_FLAG  (1 << 22)
-#define CORE_CM_ICLKEN1_EN_MMC1_FLAG  (1 << 24)
-#define CORE_CM_ICLKEN1_EN_MMC2_FLAG  (1 << 25)
-#define CORE_CM_ICLKEN1_EN_ICR_FLAG  (1 << 29)
-#define CORE_CM_ICLKEN1_EN_MMC3_FLAG  (1 << 30)
-
-	ioport32_t reserved1;
-	ioport32_t iclken3;
-#define CORE_CM_ICLKEN3_EN_USBTLL_FLAG  (1 << 2)
-
-	PADD32(1);
-	const ioport32_t idlest1;
-#define CORE_CM_IDLEST1_ST_SDRC_FLAG  (1 << 1)
-#define CORE_CM_IDLEST1_ST_SDMA_FLAG  (1 << 2)
-#define CORE_CM_IDLEST1_ST_HSOTGUSB_STBY_FLAG  (1 << 4)
-#define CORE_CM_IDLEST1_ST_HSOTGUSB_IDLE_FLAG  (1 << 5)
-#define CORE_CM_IDLEST1_ST_SCMCTRL_FLAG  (1 << 6)
-#define CORE_CM_IDLEST1_ST_MAILBOXES_FLAG  (1 << 7)
-#define CORE_CM_IDLEST1_ST_MCBSP1_FLAG  (1 << 9)
-#define CORE_CM_IDLEST1_ST_MCBSP5_FLAG  (1 << 10)
-#define CORE_CM_IDLEST1_ST_GPT10_FLAG  (1 << 11)
-#define CORE_CM_IDLEST1_ST_GPT11_FLAG  (1 << 12)
-#define CORE_CM_IDLEST1_ST_UART1_FLAG  (1 << 13)
-#define CORE_CM_IDLEST1_ST_UART2_FLAG  (1 << 14)
-#define CORE_CM_IDLEST1_ST_I2C1_FLAG  (1 << 15)
-#define CORE_CM_IDLEST1_ST_I2C2_FLAG  (1 << 16)
-#define CORE_CM_IDLEST1_ST_I2C3_FLAG  (1 << 17)
-#define CORE_CM_IDLEST1_ST_MCSPI1_FLAG  (1 << 18)
-#define CORE_CM_IDLEST1_ST_MCSPI2_FLAG  (1 << 19)
-#define CORE_CM_IDLEST1_ST_MCSPI3_FLAG  (1 << 20)
-#define CORE_CM_IDLEST1_ST_MCSPI4_FLAG  (1 << 21)
-#define CORE_CM_IDLEST1_ST_HDQ_FLAG  (1 << 22)
-#define CORE_CM_IDLEST1_ST_MMC1_FLAG  (1 << 24)
-#define CORE_CM_IDLEST1_ST_MMC2_FLAG  (1 << 25)
-#define CORE_CM_IDLEST1_ST_ICR_FLAG  (1 << 29)
-#define CORE_CM_IDLEST1_ST_MMC3_FLAG  (1 << 30)
-
-	const ioport32_t reserved2;
-	const ioport32_t idlest3;
-#define CORE_CM_IDLEST3_ST_USBTLL_FLAG  (1 << 2)
-
-	PADD32(1);
-	ioport32_t autoidle1;
-#define CORE_CM_AUTOIDLE1_AUTO_HSOTGUSB_FLAG  (1 << 4)
-#define CORE_CM_AUTOIDLE1_AUTO_SCMCTRL_FLAG  (1 << 6)
-#define CORE_CM_AUTOIDLE1_AUTO_MAILBOXES_FLAG  (1 << 7)
-#define CORE_CM_AUTOIDLE1_AUTO_MCBSP1_FLAG  (1 << 9)
-#define CORE_CM_AUTOIDLE1_AUTO_MCBSP5_FLAG  (1 << 10)
-#define CORE_CM_AUTOIDLE1_AUTO_GPT10_FLAG  (1 << 11)
-#define CORE_CM_AUTOIDLE1_AUTO_GPT11_FLAG  (1 << 12)
-#define CORE_CM_AUTOIDLE1_AUTO_UART1_FLAG  (1 << 13)
-#define CORE_CM_AUTOIDLE1_AUTO_UART2_FLAG  (1 << 14)
-#define CORE_CM_AUTOIDLE1_AUTO_I2C1_FLAG  (1 << 15)
-#define CORE_CM_AUTOIDLE1_AUTO_I2C2_FLAG  (1 << 16)
-#define CORE_CM_AUTOIDLE1_AUTO_I2C3_FLAG  (1 << 17)
-#define CORE_CM_AUTOIDLE1_AUTO_MCSPI1_FLAG  (1 << 18)
-#define CORE_CM_AUTOIDLE1_AUTO_MCSPI2_FLAG  (1 << 19)
-#define CORE_CM_AUTOIDLE1_AUTO_MCSPI3_FLAG  (1 << 20)
-#define CORE_CM_AUTOIDLE1_AUTO_MCSPI4_FLAG  (1 << 21)
-#define CORE_CM_AUTOIDLE1_AUTO_HDQ_FLAG  (1 << 22)
-#define CORE_CM_AUTOIDLE1_AUTO_MMC1_FLAG  (1 << 24)
-#define CORE_CM_AUTOIDLE1_AUTO_MMC2_FLAG  (1 << 25)
-#define CORE_CM_AUTOIDLE1_AUTO_ICR_FLAG  (1 << 29)
-#define CORE_CM_AUTOIDLE1_AUTO_MMC3_FLAG  (1 << 30)
-
-	ioport32_t reserved3;
-	ioport32_t autoidle3;
-#define CORE_CM_AUTOIDLE3_AUTO_USBTLL_FLAG  (1 << 2)
-
-	PADD32(1);
-	ioport32_t clksel;
-#define CORE_CM_CLKSEL_CLKSEL_L3_MASK  (0x3 << 0)
-#define CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED1  (0x1 << 0)
-#define CORE_CM_CLKSEL_CLKSEL_L3_DIVIDED2  (0x2 << 0)
-#define CORE_CM_CLKSEL_CLKSEL_L4_MASK  (0x3 << 2)
-#define CORE_CM_CLKSEL_CLKSEL_L4_DIVIDED1  (0x1 << 2)
-#define CORE_CM_CLKSEL_CLKSEL_L4_DIVIDED2  (0x2 << 2)
-#define CORE_CM_CLKSEL_CLKSEL_96M_MASK  (0x3 << 12)
-#define CORE_CM_CLKSEL_CLKSEL_96M_DIVIDED1  (0x1 << 12)
-#define CORE_CM_CLKSEL_CLKSEL_96M_DIVIDED2  (0x2 << 12)
-#define CORE_CM_CLKSEL_CLKSEL_GPT10_FLAG (1 << 6)
-#define CORE_CM_CLKSEL_CLKSEL_GPT11_FLAG (1 << 7)
-
-	PADD32(1);
-	ioport32_t clkstctrl;
-#define CORE_CM_CLKCTRL_CLKCTRL_L3_MASK  (0x3 << 0)
-#define CORE_CM_CLKCTRL_CLKCTRL_L3_AUTO_EN  (0x0 << 0)
-#define CORE_CM_CLKCTRL_CLKCTRL_L3_AUTO_DIS  (0x3 << 0)
-#define CORE_CM_CLKCTRL_CLKCTRL_L4_MASK  (0x3 << 2)
-#define CORE_CM_CLKCTRL_CLKCTRL_L4_AUTO_EN  (0x0 << 2)
-#define CORE_CM_CLKCTRL_CLKCTRL_L4_AUTO_DIS  (0x3 << 2)
-
-	const ioport32_t clkstst;
-#define CORE_CM_CLKSTST_CLKACTIVITY_L3_FLAG  (1 << 0)
-#define CORE_CM_CLKSTST_CLKACTIVITY_L4_FLAG  (1 << 1)
-} core_cm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/cm/iva2.h
===================================================================
--- uspace/drv/platform/amdm37x/cm/iva2.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief MPU Clock Management IO register structure.
- */
-#ifndef AMDM37x_IVA2_CM_H
-#define AMDM37x_IVA2_CM_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.446 */
-#define IVA2_CM_BASE_ADDRESS  0x48004000
-#define IVA2_CM_SIZE  8192
-
-typedef struct {
-	ioport32_t fclken;
-#define IVA2_CM_FCLKEN_EN_IVA2_FLAG   (1 << 0)
-
-	ioport32_t clken_pll;
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_LP_MODE_FLAG   (1 << 10)
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_DRIFTGUARD   (1 << 3)
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_EN_IVA2_DPLL_MASK   (0x7)
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_EN_IVA2_DPLL_LP_STOP   (0x1)
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_EN_IVA2_DPLL_LP_BYPASS   (0x5)
-#define IVA2_CM_CLKEN_PLL_EN_IVA2_DPLL_EN_IVA2_DPLL_LOCKED   (0x7)
-
-	PADD32(6);
-	const ioport32_t idlest;
-#define IVA2_CM_IDLEST_ST_IVA2_STANDBY_FLAG   (1 << 0)
-
-	const ioport32_t idlest_pll;
-#define IVA2_CM_IDLEST_PLL_ST_IVA2_CLK_LOCKED_FLAG   (1 << 0)
-
-	PADD32(3);
-	ioport32_t autoidle_pll;
-#define IVA2_CM_AUTOIDLE_PLL_AUTO_IVA2_DPLL_MASK   (0x7)
-#define IVA2_CM_AUTOIDLE_PLL_AUTO_IVA2_DPLL_DISABLED   (0x0)
-#define IVA2_CM_AUTOIDLE_PLL_AUTO_IVA2_DPLL_ENABLED   (0x1)
-
-	PADD32(2);
-	ioport32_t clksel1_pll;
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_MASK   (0x7 << 19)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_SHIFT   (19)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_VAL(x)   ((x >> 19) & 0x7)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_CORE_DIV_1   (0x1 << 19)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_CORE_DIV_2   (0x2 << 19)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_CLK_SRC_CORE_DIV_4   (0x4 << 19)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_DPLL_MULT_MASK   (0x7ff << 8)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_DPLL_MULT_SHIFT   (8)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_DPLL_DIV_MASK  (0x7f << 0)
-#define IVA2_CM_CLKSEL1_PLL_IVA2_DPLL_DIV_SHIFT  (0)
-
-	ioport32_t clksel2_pll;
-#define IVA2_CM_CLKSEL2_PLL_IVA2_DPLL_CLKOUT_DIV_MASK   (0x1f)
-
-	ioport32_t clkstctrl;
-#define IVA2_CM_CLKSCTRL_CLKTRCTRL_IVA2_MASK   (0x3)
-#define IVA2_CM_CLKSCTRL_CLKTRCTRL_IVA2_DISABLED   (0x0)
-#define IVA2_CM_CLKSCTRL_CLKTRCTRL_IVA2_START_SLEEP   (0x2)
-#define IVA2_CM_CLKSCTRL_CLKTRCTRL_IVA2_START_WAKEUP   (0x2)
-#define IVA2_CM_CLKSCTRL_CLKTRCTRL_IVA2_AUTOMATIC   (0x3)
-
-	const ioport32_t clkstst;
-#define IVA2_CM_CLKSTST_CLKACTIVITY_IVA2_ACTIVE_FLAG   (1 << 0)
-
-} iva2_cm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/cm/mpu.h
===================================================================
--- uspace/drv/platform/amdm37x/cm/mpu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief MPU Clock Management IO register structure.
- */
-#ifndef AMDM37x_MPU_CM_H
-#define AMDM37x_MPU_CM_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.455 */
-#define MPU_CM_BASE_ADDRESS  0x48004900
-#define MPU_CM_SIZE  8192
-
-typedef struct {
-	PADD32(1);
-	ioport32_t clken_pll;
-#define MPU_CM_CLKEN_PLL_EN_MPU_DPLL_LP_MODE_FLAG   (1 << 10)
-#define MPU_CM_CLKEN_PLL_EN_MPU_DPLL_DRIFTGUARD   (1 << 3)
-#define MPU_CM_CLKEN_PLL_EN_MPU_DPLL_EN_MPU_DPLL_MASK   (0x7)
-#define MPU_CM_CLKEN_PLL_EN_MPU_DPLL_EN_MPU_DPLL_LP_BYPASS   (0x5)
-#define MPU_CM_CLKEN_PLL_EN_MPU_DPLL_EN_MPU_DPLL_LOCKED   (0x7)
-
-	PADD32(6);
-	const ioport32_t idlest;
-#define MPU_CM_IDLEST_ST_MPU_STANDBY_FLAG   (1 << 0)
-
-	const ioport32_t idlest_pll;
-#define MPU_CM_IDLEST_PLL_ST_MPU_CLK_LOCKED_FLAG   (1 << 0)
-
-	PADD32(3);
-	ioport32_t autoidle_pll;
-#define MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_MASK   (0x7)
-#define MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_DISABLED   (0x0)
-#define MPU_CM_AUTOIDLE_PLL_AUTO_MPU_DPLL_ENABLED   (0x1)
-
-	PADD32(2);
-	ioport32_t clksel1_pll;
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_MASK   (0x7 << 19)
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_SHIFT   (19)
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_VAL(x)   ((x >> 19) & 0x7)
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_CORE_DIV_1   (0x1 << 19)
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_CORE_DIV_2   (0x2 << 19)
-#define MPU_CM_CLKSEL1_PLL_MPU_CLK_SRC_CORE_DIV_4   (0x4 << 19)
-#define MPU_CM_CLKSEL1_PLL_MPU_DPLL_MULT_MASK   (0x7ff << 8)
-#define MPU_CM_CLKSEL1_PLL_MPU_DPLL_MULT_SHIFT   (8)
-#define MPU_CM_CLKSEL1_PLL_MPU_DPLL_DIV_MASK  (0x7f << 0)
-#define MPU_CM_CLKSEL1_PLL_MPU_DPLL_DIV_SHIFT  (0)
-
-	ioport32_t clksel2_pll;
-#define MPU_CM_CLKSEL2_PLL_MPU_DPLL_CLKOUT_DIV_MASK   (0x1f)
-
-	ioport32_t clkstctrl;
-#define MPU_CM_CLKSCTRL_CLKTRCTRL_MPU_MASK   (0x3)
-#define MPU_CM_CLKSCTRL_CLKTRCTRL_MPU_DISABLED   (0x0)
-#define MPU_CM_CLKSCTRL_CLKTRCTRL_MPU_START_WAKEUP   (0x2)
-#define MPU_CM_CLKSCTRL_CLKTRCTRL_MPU_AUTOMATIC   (0x3)
-
-	const ioport32_t clkstst;
-#define MPU_CM_CLKSTST_CLKACTIVITY_MPU_ACTIVE_FLAG   (1 << 0)
-
-} mpu_cm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/cm/usbhost.h
===================================================================
--- uspace/drv/platform/amdm37x/cm/usbhost.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief USBHOST Clock Management IO register structure.
- */
-#ifndef AMDM37x_USBHOST_CM_H
-#define AMDM37x_USBHOST_CM_H
-
-#include <macros.h>
-#include <ddi.h>
-
-/* AM/DM37x TRM p.447 */
-#define USBHOST_CM_BASE_ADDRESS  0x48005400
-#define USBHOST_CM_SIZE  8192
-
-typedef struct {
-	ioport32_t fclken;
-#define USBHOST_CM_FCLKEN_EN_USBHOST1_FLAG  (1 << 0)
-#define USBHOST_CM_FCLKEN_EN_USBHOST2_FLAG  (1 << 1)
-
-	PADD32(3);
-	ioport32_t iclken;
-#define USBHOST_CM_ICLKEN_EN_USBHOST  (1 << 0)
-
-	PADD32(3);
-	const ioport32_t idlest;
-#define USBHOST_CM_IDLEST_ST_USBHOST_STDBY_FLAG  (1 << 0)
-#define USBHOST_CM_IDLEST_ST_USBHOST_IDLE_FLAG  (1 << 1)
-
-	PADD32(3);
-	ioport32_t autoidle;
-#define USBHOST_CM_AUTOIDLE_AUTO_USBHOST_FLAG  (1 << 0)
-
-	PADD32(4);
-	ioport32_t sleepdep;
-#define USBHOST_CM_SLEEPDEP_EN_MPU_FLAG  (1 << 1)
-#define USBHOST_CM_SLEEPDEP_EN_IVA2_FLAG  (1 << 2)
-
-	ioport32_t clkstctrl;
-#define USBHOST_CM_CLKSTCTRL_CLKSTCTRL_USBHOST_MASK  (0x3 << 0)
-#define USBHOST_CM_CLKSTCTRL_CLKSTCTRL_USBHOST_AUTO_DIS  (0x0 << 0)
-#define USBHOST_CM_CLKSTCTRL_CLKSTCTRL_USBHOST_SUPERVISED_SLEEP  (0x1 << 0)
-#define USBHOST_CM_CLKSTCTRL_CLKSTCTRL_USBHOST_SUPERVISED_WAKEUP  (0x2 << 0)
-#define USBHOST_CM_CLKSTCTRL_CLKSTCTRL_USBHOST_AUTO_EN  (0x3 << 0)
-
-	ioport32_t clkstst;
-#define USBHOST_CM_CLKSTCTRL_CLKSTST_CLKACTIVITY_USBHOST  (1 << 0)
-} usbhost_cm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/amdm37x/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup amdm37x amdm37x
- * @brief TI AM/DM37x platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/amdm37x/main.c
===================================================================
--- uspace/drv/platform/amdm37x/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,282 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup amdm37x
- * @{
- */
-
-/** @file
- */
-
-#define DEBUG_CM 0
-
-#include <ddf/log.h>
-#include <errno.h>
-#include <ops/hw_res.h>
-#include <stdio.h>
-
-#include "amdm37x.h"
-
-#define NAME  "amdm37x"
-
-typedef struct {
-	const char *name;
-	const char *id;
-	int score;
-	hw_resource_list_t hw_resources;
-} amdm37x_fun_t;
-
-/* See amdm37x TRM page 3316 for these values */
-#define OHCI_BASE_ADDRESS   0x48064400
-#define OHCI_SIZE   1024
-#define EHCI_BASE_ADDRESS   0x48064800
-#define EHCI_SIZE   1024
-
-/* See amdm37x TRM page 1813 for these values */
-#define DSS_BASE_ADDRESS   0x48050000
-#define DSS_SIZE   512
-#define DISPC_BASE_ADDRESS   0x48050400
-#define DISPC_SIZE   1024
-#define VIDEO_ENC_BASE_ADDRESS   0x48050C00
-#define VIDEO_ENC_SIZE   256
-
-static hw_resource_t ohci_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.io_range = {
-			.address = OHCI_BASE_ADDRESS,
-			.size = OHCI_SIZE,
-			.endianness = LITTLE_ENDIAN
-		},
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = { .irq = 76 },
-	},
-};
-
-static hw_resource_t ehci_res[] = {
-	{
-		.type = MEM_RANGE,
-		/* See amdm37x TRM page. 3316 for these values */
-		.res.io_range = {
-			.address = EHCI_BASE_ADDRESS,
-			.size = EHCI_SIZE,
-			.endianness = LITTLE_ENDIAN
-		},
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = { .irq = 77 },
-	},
-};
-
-static hw_resource_t disp_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.io_range = {
-			.address = DSS_BASE_ADDRESS,
-			.size = DSS_SIZE,
-			.endianness = LITTLE_ENDIAN
-		},
-	},
-	{
-		.type = MEM_RANGE,
-		.res.io_range = {
-			.address = DISPC_BASE_ADDRESS,
-			.size = DISPC_SIZE,
-			.endianness = LITTLE_ENDIAN
-		},
-	},
-	{
-		.type = MEM_RANGE,
-		.res.io_range = {
-			.address = VIDEO_ENC_BASE_ADDRESS,
-			.size = VIDEO_ENC_SIZE,
-			.endianness = LITTLE_ENDIAN
-		},
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = { .irq = 25 },
-	},
-};
-
-static const amdm37x_fun_t amdm37x_funcs[] = {
-	{
-		.name = "ohci",
-		.id = "usb/host=ohci",
-		.score = 90,
-		.hw_resources = { .resources = ohci_res, .count = ARRAY_SIZE(ohci_res) }
-	},
-	{
-		.name = "ehci",
-		.id = "usb/host=ehci",
-		.score = 90,
-		.hw_resources = { .resources = ehci_res, .count = ARRAY_SIZE(ehci_res) }
-	},
-	{
-		.name = "fb",
-		.id = "amdm37x&dispc",
-		.score = 90,
-		.hw_resources = { .resources = disp_res, .count = ARRAY_SIZE(disp_res) }
-	},
-};
-
-static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode);
-static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int);
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &amdm37x_get_resources,
-	.enable_interrupt = &amdm37x_enable_interrupt,
-};
-
-static ddf_dev_ops_t amdm37x_fun_ops = {
-	.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops
-};
-
-static errno_t amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun)
-{
-	assert(dev);
-	assert(fun);
-
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", fun->name);
-
-	/* Create new device function. */
-	ddf_fun_t *fnode = ddf_fun_create(dev, fun_inner, fun->name);
-	if (fnode == NULL)
-		return ENOMEM;
-
-	/* Add match id */
-	errno_t ret = ddf_fun_add_match_id(fnode, fun->id, fun->score);
-	if (ret != EOK) {
-		ddf_fun_destroy(fnode);
-		return ret;
-	}
-
-	/* Alloc needed data */
-	amdm37x_fun_t *rf =
-	    ddf_fun_data_alloc(fnode, sizeof(amdm37x_fun_t));
-	if (!rf) {
-		ddf_fun_destroy(fnode);
-		return ENOMEM;
-	}
-	*rf = *fun;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &amdm37x_fun_ops);
-
-	/* Register function. */
-	ret = ddf_fun_bind(fnode);
-	if (ret != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", fun->name);
-		ddf_fun_destroy(fnode);
-		return ret;
-	}
-
-	return EOK;
-}
-
-/** Add the root device.
- *
- * @param dev Device which is root of the whole device tree
- *            (both of HW and pseudo devices).
- *
- * @return Zero on success, error number otherwise.
- *
- */
-static errno_t amdm37x_dev_add(ddf_dev_t *dev)
-{
-	assert(dev);
-	amdm37x_t *device = ddf_dev_data_alloc(dev, sizeof(amdm37x_t));
-	if (!device)
-		return ENOMEM;
-	errno_t ret = amdm37x_init(device, DEBUG_CM);
-	if (ret != EOK) {
-		ddf_msg(LVL_FATAL, "Failed to setup hw access!.\n");
-		return ret;
-	}
-
-	/* Set dplls to ON and automatic */
-	amdm37x_setup_dpll_on_autoidle(device);
-
-	/* Enable function and interface clocks */
-	amdm37x_usb_clocks_set(device, true);
-
-	/* Init TLL */
-	ret = amdm37x_usb_tll_init(device);
-	if (ret != EOK) {
-		ddf_msg(LVL_FATAL, "Failed to init USB TLL!.\n");
-		amdm37x_usb_clocks_set(device, false);
-		return ret;
-	}
-
-	/* Register functions */
-	for (unsigned i = 0; i < ARRAY_SIZE(amdm37x_funcs); ++i) {
-		if (amdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)
-			ddf_msg(LVL_ERROR, "Failed to add %s function for "
-			    "BeagleBoard-xM platform.", amdm37x_funcs[i].name);
-	}
-	return EOK;
-}
-
-/** The root device driver's standard operations. */
-static driver_ops_t amdm37x_ops = {
-	.dev_add = &amdm37x_dev_add
-};
-
-/** The root device driver structure. */
-static driver_t amdm37x_driver = {
-	.name = NAME,
-	.driver_ops = &amdm37x_ops
-};
-
-static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode)
-{
-	amdm37x_fun_t *fun = ddf_fun_data_get(fnode);
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t amdm37x_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	//TODO: Implement
-	return false;
-}
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS AM/DM37x(OMAP37x) platform driver\n", NAME);
-	ddf_log_init(NAME);
-	return ddf_driver_main(&amdm37x_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/meson.build
===================================================================
--- uspace/drv/platform/amdm37x/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('amdm37x.c', 'main.c')
Index: pace/drv/platform/amdm37x/prm/clock_control.h
===================================================================
--- uspace/drv/platform/amdm37x/prm/clock_control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief Clock Control Clock Management IO register structure.
- */
-#ifndef AMDM37X_PRM_CLOCK_CONTROL_H
-#define AMDM37X_PRM_CLOCK_CONTROL_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.536 and p.589 */
-#define CLOCK_CONTROL_PRM_BASE_ADDRESS  0x48306d00
-#define CLOCK_CONTROL_PRM_SIZE  8192
-
-/** Clock control PRM register map
- */
-typedef struct {
-	PADD32(16);
-	ioport32_t clksel;
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_MASK   (0x7)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_12M   (0x0)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_13M   (0x1)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_19_2M   (0x2)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_26M   (0x3)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_38_4M   (0x4)
-#define CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_16_8M   (0x5)
-
-	PADD32(12);
-	ioport32_t clkout_ctrl;
-#define CLOCK_CONTROL_PRM_CLKOUT_CTRL_CLKOUOUT_EN_FLAG   (1 << 7)
-
-} clock_control_prm_regs_t;
-
-static inline unsigned sys_clk_freq_kHz(unsigned reg_val)
-{
-	switch (reg_val) {
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_12M:
-		return 12000;
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_13M:
-		return 13000;
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_19_2M:
-		return 19200;
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_26M:
-		return 26000;
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_38_4M:
-		return 38400;
-	case CLOCK_CONTROL_PRM_CLKSEL_SYS_CLKIN_16_8M:
-		return 16800;
-	}
-	return 0;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/prm/global_reg.h
===================================================================
--- uspace/drv/platform/amdm37x/prm/global_reg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief Clock Control Clock Management IO register structure.
- */
-#ifndef AMDM37X_PRM_GLOBAL_REG_H
-#define AMDM37X_PRM_GLOBAL_REG_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.536 and p.615 */
-#define GLOBAL_REG_PRM_BASE_ADDRESS  0x48307200
-#define GLOBAL_REG_PRM_SIZE  65536
-
-/** Global Reg PRM register map
- */
-typedef struct {
-	PADD32(8);
-	struct {
-		ioport32_t smps_sa;
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA0_MASK   (0x7f << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA0_CREATE(x)   (((x) & 0x7f) << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA0_GET(r)   (r & 0x7f)
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA1_MASK   (0x7f << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA1_CREATE(x)   (((x) & 0x7f) << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_SA_SA1_GET(r)   (((r) >> 16 ) & 0x7f)
-
-		ioport32_t smps_vol_ra;
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA0_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA0_CREATE(x)   (((x) & 0xff) << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA0_GET(r)   (r & 0xff)
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA1_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA1_CREATE(x)   (((x) & 0xff) << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_VOL_RA_VOLRA1_GET(r)   (((r) >> 16 ) & 0xff)
-
-		ioport32_t smps_cmd_ra;
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA0_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA0_CREATE(x)   (((x) & 0xff) << 0)
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA0_GET(r)   (r & 0xff)
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA1_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA1_CREATE(x)   (((x) & 0xff) << 16)
-#define GLOBAL_REG_PRM_VC_SMPS_CMD_RA_CMDRA1_GET(r)   (((r) >> 16 ) & 0xff)
-
-		ioport32_t cmd_val_0;
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ON_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ON_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ON_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ONLP_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ONLP_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_ONLP_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_RET_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_RET_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_RET_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_OFF_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_OFF_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_0_OFF_GET(r)   (((x) >> 24) & 0xff)
-
-		ioport32_t cmd_val_1;
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ON_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ON_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ON_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ONLP_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ONLP_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_ONLP_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_RET_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_RET_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_RET_GET(r)   (((x) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_OFF_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_OFF_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VC_CMD_VAL_1_OFF_GET(r)   (((x) >> 24) & 0xff)
-
-		ioport32_t ch_conf;
-#define GLOBAL_REG_PRM_VC_CH_CONF_CMD1_FLAG   (1 << 20)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RACEN1_FLAG   (1 << 19)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RAC1_FLAG   (1 << 18)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RAV1_FLAG   (1 << 17)
-#define GLOBAL_REG_PRM_VC_CH_CONF_SA1_FLAG   (1 << 16)
-#define GLOBAL_REG_PRM_VC_CH_CONF_CMD0_FLAG   (1 << 4)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RACEN0_FLAG   (1 << 3)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RAC0_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_VC_CH_CONF_RAV0_FLAG   (1 << 1)
-#define GLOBAL_REG_PRM_VC_CH_CONF_SA0_FLAG   (1 << 0)
-
-		ioport32_t i2c_cfg;
-#define GLOBAL_REG_PRM_VC_I2C_CFG_HSMASTER_FLAG   (1 << 5)
-#define GLOBAL_REG_PRM_VC_I2C_CFG_SREN_FLAG   (1 << 4)
-#define GLOBAL_REG_PRM_VC_I2C_CFG_HSEN_FLAG   (1 << 3)
-#define GLOBAL_REG_PRM_VC_I2C_CFG_MCODE_MASK   (0x3 << 0)
-#define GLOBAL_REG_PRM_VC_I2C_CFG_MCODE_CREATE(x)   ((x) & 0x3)
-#define GLOBAL_REG_PRM_VC_I2C_CFG_MCODE_GET(r)   ((r) & 0x3)
-
-		ioport32_t bypass_val;
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_VALID_FLAG   (1 << 24)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_DATA_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_DATA_CREATE(x)   (((x) & 0xff) << 16)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_DATA_GET(r)   (((r) >> 16) & 0xff)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_REGADDR_MASK   (0xff << 8)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_REGADDR_CREATE(x)   (((x) & 0xff) << 8)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_REGADDR_GET(r)   (((r) >> 8) & 0xff)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_SLAVEADDR_MASK   (0x7f << 0)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_SLAVEADDR_CREATE(x)   (((x) & 0x7f) << 0)
-#define GLOBAL_REG_PRM_VC_BYPASS_VAL_SLAVEADDR_GET(r)   (((r) >> 0) & 0x7f)
-	} vc;
-
-	PADD32(4);
-	ioport32_t rstctrl;
-#define GLOBAL_REG_PRM_RSTCTRL_RST_DPLL3_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_RSTCTRL_RST_GS_FLAG   (1 << 1)
-
-	ioport32_t rsttime;
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME2_MASK   (0x1f << 8)
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME2_CREATE(x)   (((x) & 0x1f) << 8)
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME2_GET(r)   (((r) >> 8) & 0x1f)
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME1_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME1_CREATE(x)   (((x) & 0xff) << 0)
-#define GLOBAL_REG_PRM_RSTTIME_RSTTIME1_GET(r)   (((r) >> 0) & 0xff)
-
-	ioport32_t rstst;
-#define GLOBAL_REG_PRM_RSTST_ICECRUSHER_RST_FLAG   (1 << 10)
-#define GLOBAL_REG_PRM_RSTST_ICEPICK_RST_FLAG   (1 << 9)
-#define GLOBAL_REG_PRM_RSTST_VDD2_VOLTAGE_MGR_RST_FLAG   (1 << 8)
-#define GLOBAL_REG_PRM_RSTST_VDD1_VOLTAGE_MGR_RST_FLAG   (1 << 7)
-#define GLOBAL_REG_PRM_RSTST_EXTERNAL_WARM_REST_FLAG   (1 << 6)
-#define GLOBAL_REG_PRM_RSTST_MPU_WD_RST_FLAG   (1 << 4)
-#define GLOBAL_REG_PRM_RSTST_GLOBAL_SW_RST_FLAG   (1 << 1)
-#define GLOBAL_REG_PRM_RSTST_GLOABL_COLD_RST_FLAG   (1 << 0)
-
-	PADD32(1);
-	ioport32_t volctrl;
-#define GLOBAL_REG_PRM_VOLCTRL_SEL_VMODE_FLAG   (1 << 4)
-#define GLOBAL_REG_PRM_VOLCTRL_SEL_OFF_FLAG   (1 << 3)
-#define GLOBAL_REG_PRM_VOLCTRL_AUTO_OFF_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_VOLCTRL_AUTO_RET_FLAG   (1 << 1)
-#define GLOBAL_REG_PRM_VOLCTRL_AUTO_SLEEP_FLAG   (1 << 0)
-
-	ioport32_t sram_pcharge;
-#define GLOBAL_REG_PRM_SRAM_PCHARGE_PCHARGE_TIME_MASK   (0xff)
-#define GLOBAL_REG_PRM_SRAM_PCHARGE_PCHARGE_TIME_CREATE(x)   ((x) & 0xff)
-#define GLOBAL_REG_PRM_SRAM_PCHARGE_PCHARGE_TIME_GET(r)   ((r) & 0xff)
-
-	PADD32(2);
-	ioport32_t clksrc_ctrl;
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_DPLL4_CLKINP_DIV_65_FLAG   (1 << 8)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKDIV_MASK   (0x3 << 6)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKDIV_1   (0x1 << 6)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKDIV_2   (0x2 << 6)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKDIV_GET(r)   (((r) >> 6) & 0x3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_MASK   (0x3 << 3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_ON   (0x0 << 3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_SLEEP   (0x1 << 3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_RET   (0x2 << 3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_OFF   (0x3 << 3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_AUTOEXTCLKMODE_GET(r)   (((r) >> 3) & 0x3)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKSEL_MASK   (0x3 << 0)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKSEL_BYPASS   (0x0 << 0)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKSEL_OSCILLATOR   (0x1 << 0)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKSEL_UNKNOWN   (0x3 << 0)
-#define GLOBAL_REG_PRM_CLKSRC_CTRL_SYSCLKSEL_GET(r)   (((r) >> 0) & 0x3)
-
-	PADD32(3);
-	const ioport32_t obs;
-#define GLOBAL_REG_PRM_OBS_OBS_BUS_MASK   (0x3ff)
-
-	PADD32(3);
-	ioport32_t voltsetup1;
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME2_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME2_CREATE(x)   (((x) & 0xff) << 16)
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME2_GET(r)   (((r) >> 16) & 0xff)
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME1_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME1_CREATE(x)   (((x) & 0xff) << 0)
-#define GLOBAL_REG_PRM_VOLTSETUP1_SETUPTIME1_GET(r)   (((r) >> 0) & 0xff)
-
-	ioport32_t voltoffset;
-#define GLOBAL_REG_PRM_VOLTOFFSET_OFFSET_TIME_MASK   (0xffff << 0)
-#define GLOBAL_REG_PRM_VOLTOFFSET_OFFSET_TIME_CREATE(x)   (((x) & 0xffff) << 0)
-#define GLOBAL_REG_PRM_VOLTOFFSET_OFFSET_TIME_GET(r)   (((r) >> 0) & 0xffff)
-
-	ioport32_t clksetup;
-#define GLOBAL_REG_PRM_CLKSETUP_SETUP_TIME_MASK   (0xffff << 0)
-#define GLOBAL_REG_PRM_CLKSETUP_SETUP_TIME_CREATE(x)   (((x) & 0xffff) << 0)
-#define GLOBAL_REG_PRM_CLKSETUP_SETUP_TIME_GET(r)   (((r) >> 0) & 0xffff)
-
-	ioport32_t polctrl;
-#define GLOBAL_REG_PRM_POLCTRL_OFFMODE_POL_FLAG   (1 << 3)
-#define GLOBAL_REG_PRM_POLCTRL_CLKOUT_POL_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_POLCTRL_CLKREG_POL_FLAG   (1 << 1)
-#define GLOBAL_REG_PRM_POLCTRL_EXTVOL_POL_FLAG   (1 << 0)
-
-	ioport32_t voltsetup2;
-#define GLOBAL_REG_PRM_VOLTSETUP2_OFFMODESETUPTIME_MASK   (0xffff << 0)
-#define GLOBAL_REG_PRM_VOLTSETUP2_OFFMODESETUPTIME_CREATE(x)   (((x) & 0xffff) << 0)
-#define GLOBAL_REG_PRM_VOLTSETUP2_OFFMODESETUPTIME_GET(r)   (((r) >> 0) & 0xffff)
-
-	PADD32(3);
-	struct {
-		ioport32_t config;
-#define GLOBAL_REG_PRM_VP_CONFIG_ERROROFFSET_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VP_CONFIG_ERROROFFSET_CREATE(x)   (((x) & 0xff) << 24)
-#define GLOBAL_REG_PRM_VP_CONFIG_ERROROFFSET_GET(r)   (((r) >> 0xff << 24)
-#define GLOBAL_REG_PRM_VP_CONFIG_ERRORGAIN_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VP_CONFIG_ERRORGAIN_CREATE(x)   (((x) & 0xff) << 16)
-#define GLOBAL_REG_PRM_VP_CONFIG_ERRORGAIN_GET(r)   (((r) >> 0xff << 16)
-#define GLOBAL_REG_PRM_VP_CONFIG_INITVOLTAGE_MASK   (0xff << 8)
-#define GLOBAL_REG_PRM_VP_CONFIG_INITVOLTAGE_CREATE(x)   (((x) & 0xff) << 8)
-#define GLOBAL_REG_PRM_VP_CONFIG_INITVOLTAGE_GET(r)   (((r) >> 0xff << 8)
-#define GLOBAL_REG_PRM_VP_CONFIG_TIMEOUTEN_FLAG    (1 << 3)
-#define GLOBAL_REG_PRM_VP_CONFIG_INITVDD_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_VP_CONFIG_FORCEUPDATE_FLAG   (1 << 1)
-#define GLOBAL_REG_PRM_VP_CONFIG_VPENABLE_FLAG   (1 << 0)
-
-		ioport32_t vstepmin;
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_SMPSWAITTIMEMIN_MASK   (0xffff << 8)
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_SMPSWAITTIMEMIN_CREATE(x)   (((x)0xffff << 8)
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_SMPSWAITTIMEMIN_GET(r)   (((r) >> 8) & 0xffff)
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_VSTEPMIN_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_VSTEPMIN_CREATE(x)   (((x)0xff << 0)
-#define GLOBAL_REG_PRM_VP_VSTEPMIN_VSTEPMIN_GET(r)   (((r) >> 0) & 0xff)
-
-		ioport32_t vstepmax;
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_SMPSWAITTIMEMIN_MASK   (0xffff << 8)
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_SMPSWAITTIMEMIN_CREATE(x)   (((x)0xffff << 8)
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_SMPSWAITTIMEMIN_GET(r)   (((r) >> 8) & 0xffff)
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_VSTEPMIN_MASK   (0xff << 0)
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_VSTEPMIN_CREATE(x)   (((x)0xff << 0)
-#define GLOBAL_REG_PRM_VP_VSTEPMAX_VSTEPMIN_GET(r)   (((r) >> 0) & 0xff)
-
-		ioport32_t vlimitto;
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMAX_MASK   (0xff << 24)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMAX_CREATE(x)   (((x)0xff << 24)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMAX_GET(r)   (((r) >> 24) & 0xff)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMIN_MASK   (0xff << 16)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMIN_CREATE(x)   (((x)0xff << 16)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_VDDMIN_GET(r)   (((r) >> 16) & 0xff)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_TIMEOUT_MASK   (0xffff << 0)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_TIMEOUT_CREATE(x)   (((x)0xffff << 0)
-#define GLOBAL_REG_PRM_VP_VLIMITTO_TIMEOUT_GET(r)   (((r) >> 0) & 0xffff)
-
-		const ioport32_t voltage;
-#define GLOBAL_REG_PRM_VP_VOLTAGE_VPVOLTAGE_MASK   (0xff)
-#define GLOBAL_REG_PRM_VP_VOLTAGE_VPVOLTAGE_GET(r)   ((r) & 0xff)
-
-		const ioport32_t status;
-#define GLOBAL_REG_PRM_VP_STATUS_VPINIDLE_FLAG   (1 << 0)
-
-		PADD32(2);
-	} vp[2];
-
-	ioport32_t ldo_abb_setup;
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_SR2_IN_TRANSITION   (1 << 6)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_SR2_STATUS_MASK   (0x3 << 3)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_SR2_STATUS_BYPASS   (0x0 << 3)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_SR2_STATUS_FBB   (0x2 << 3)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_SR2_OPP_CHANGE_FLAG  (1 << 2)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_OPP_SEL_MASK   (0x3 << 0)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_OPP_SEL_DEFAULT   (0x0 << 0)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_OPP_SEL_FAST   (0x1 << 0)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_OPP_SEL_NOMINAL   (0x2 << 0)
-#define GLOBAL_REG_PRM_LDO_ABB_SETUP_OPP_SEL_SLOW   (0x3 << 0)
-
-	ioport32_t ldo_abb_ctrl;
-#define GLOBAL_REG_PRM_LDO_ABB_CTRL_SR2_WTCNT_VALUE_MASK   (0xff << 8)
-#define GLOBAL_REG_PRM_LDO_ABB_CTRL_SR2_WTCNT_VALUE_CREATE(x)   (((x) & 0xff) << 8)
-#define GLOBAL_REG_PRM_LDO_ABB_CTRL_SR2_WTCNT_VALUE_GET(r)   (((r) >> 8) & 0xff)
-#define GLOBAL_REG_PRM_LDO_ABB_CTRL_ACTIVE_FBB_SEL_FLAG   (1 << 2)
-#define GLOBAL_REG_PRM_LDO_ABB_CTRL_SR2EN   (1 << 0)
-} global_reg_prm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/prm/usbhost.h
===================================================================
--- uspace/drv/platform/amdm37x/prm/usbhost.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief Clock Control Clock Management IO register structure.
- */
-#ifndef AMDM37X_PRM_CLOCK_CONTROL_H
-#define AMDM37X_PRM_CLOCK_CONTROL_H
-
-#include <ddi.h>
-#include <macros.h>
-
-/* AM/DM37x TRM p.536 and p.589 */
-#define CLOCK_CONTROL_CM_BASE_ADDRESS  0x48307400
-#define CLOCK_CONTROL_CM_SIZE  8192
-
-/** Clock control PRM register map
- *
- * Periph DPLL == DPLL4
- * Core DPLL == DPLL3
- */
-typedef struct {
-	PADD32(22);
-	ioport32_t rm_rstst;
-#define USBHOST_PRM_RM_RSTST_COREDOMAINWKUP_RST_FLAG   (1 << 3)
-#define USBHOST_PRM_RM_RSTST_DOMAINWKUP_RST_FLAG   (1 << 2)
-#define USBHOST_PRM_RM_RSTST_GLOBALWARM_RST_FLAG   (1 << 1)
-#define USBHOST_PRM_RM_RSTST_GLOBALCOLD_RST_FLAG   (1 << 0)
-
-	PADD32(18);
-	ioport32_t pm_wken;
-#define USBHOST_PRM_PM_WKEN_EN_USBHOST_FLAG   (1 << 0)
-
-	ioport32_t pm_mpugrpsel;
-#define USBHOST_PRM_PM_MPUGRPSEL_GRPSEL_USBHOST_FLAG   (1 << 0)
-
-	ioport32_t pm_iva2grpsel;
-#define USBHOST_PRM_PM_IVA2GRPSEL_GRPSEL_USBHOST_FLAG   (1 << 0)
-
-	PADD32(1);
-	ioport32_t pm_wkst;
-#define USBHOST_PRM_PM_WKST_ST_USBHOST_FLAG   (1 << 0)
-
-	PADD32(5);
-	ioport32_t pm_wkdep;
-#define USBHOST_PRM_PM_WKDEP_EN_WKUP_FLAG   (1 << 4)
-#define USBHOST_PRM_PM_WKDEP_EN_IVA2_FLAG   (1 << 2)
-#define USBHOST_PRM_PM_WKDEP_EN_MPU_FLAG   (1 << 1)
-#define USBHOST_PRM_PM_WKDEP_EN_CORE_FLAG   (1 << 0)
-
-	PADD32(5);
-	ioport32_t pm_pwstctrl;
-#define USBHOST_PRM_PM_PWSTCTRL_MEMONSTATE_MASK   (0x3 << 16)
-#define USBHOST_PRM_PM_PWSTCTRL_MEMONSTATE_ALWAYS_ON   (0x3 << 16)
-#define USBHOST_PRM_PM_PWSTCTRL_MEMRETSTATE_FLAG   (1 << 8)
-#define USBHOST_PRM_PM_PWSTCTRL_SAVEANDRESTORE_FLAG   (1 << 4)
-#define USBHOST_PRM_PM_PWSTCTRL_LOGICRESTATE_FLAG   (1 << 2)
-#define USBHOST_PRM_PM_PWSTCTRL_POWERSTATE_MASK   (0x3 << 0)
-#define USBHOST_PRM_PM_PWSTCTRL_POWERSTATE_OFF   (0x0 << 0)
-#define USBHOST_PRM_PM_PWSTCTRL_POWERSTATE_RETENTION   (0x1 << 0)
-#define USBHOST_PRM_PM_PWSTCTRL_POWERSTATE_ON   (0x3 << 0)
-
-	const ioport32_t pm_pwstst;
-#define USBHOST_PRM_PM_PWSTST_INTRANSITION_FLAG   (1 << 20)
-#define USBHOST_PRM_PM_PWSTST_POWERSTATEST_MASK   (0x3 << 0)
-#define USBHOST_PRM_PM_PWSTST_POWERSTATEST_OFF   (0x0 << 0)
-#define USBHOST_PRM_PM_PWSTST_POWERSTATEST_RETENTION  (0x1 << 0)
-#define USBHOST_PRM_PM_PWSTST_POWERSTATEST_INACTIVE  (0x2 << 0)
-#define USBHOST_PRM_PM_PWSTST_POWERSTATEST_ON  (0x3 << 0)
-
-	ioport32_t pm_prepwstst;
-#define USBHOST_PRM_PM_PREPWSTST_LASTPOWERSTATEENTERED_MASK   (0x3 << 0)
-#define USBHOST_PRM_PM_PREPWSTST_LASTPOWERSTATEENTERED_OFF   (0x0 << 0)
-#define USBHOST_PRM_PM_PREPWSTST_LASTPOWERSTATEENTERED_RETENTION  (0x1 << 0)
-#define USBHOST_PRM_PM_PREPWSTST_LASTPOWERSTATEENTERED_INACTIVE  (0x2 << 0)
-#define USBHOST_PRM_PM_PREPWSTST_LASTPOWERSTATEENTERED_ON  (0x3 << 0)
-
-} usbhost_prm_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/uhh.h
===================================================================
--- uspace/drv/platform/amdm37x/uhh.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief UHH IO register structure.
- */
-#ifndef AMDM37x_UHH_H
-#define AMDM37x_UHH_H
-
-#include <macros.h>
-#include <ddi.h>
-
-#define AMDM37x_UHH_BASE_ADDRESS  0x48064000
-#define AMDM37x_UHH_SIZE  1024
-
-typedef struct {
-	const ioport32_t revision;
-#define UHH_REVISION_MINOR_MASK  0x0f
-#define UHH_REVISION_MAJOR_MASK  0xf0
-
-	PADD32(3);
-	ioport32_t sysconfig;
-#define UHH_SYSCONFIG_AUTOIDLE_FLAG  (1 << 0)
-#define UHH_SYSCONFIG_SOFTRESET_FLAG  (1 << 1)
-#define UHH_SYSCONFIG_ENWAKEUP_FLAG  (1 << 2)
-#define UHH_SYSCONFIG_SIDLE_MODE_MASK  (0x3 << 3)
-#define UHH_SYSCONFIG_SIDLE_MODE_FORCE  (0x0 << 3)
-#define UHH_SYSCONFIG_SIDLE_MODE_NO  (0x1 << 3)
-#define UHH_SYSCONFIG_SIDLE_MODE_SMART  (0x2 << 3)
-#define UHH_SYSCONFIG_CLOCKACTIVITY_FLAG  (1 << 8)
-#define UHH_SYSCONFIG_MIDLE_MODE_MASK  (0x3 << 12)
-#define UHH_SYSCONFIG_MIDLE_MODE_FORCE  (0x0 << 12)
-#define UHH_SYSCONFIG_MIDLE_MODE_NO  (0x1 << 12)
-#define UHH_SYSCONFIG_MIDLE_MODE_SMART  (0x2 << 12)
-
-	const ioport32_t sysstatus;
-#define UHH_SYSSTATUS_RESETDONE_FLAG  (1 << 0)
-#define UHH_SYSSTATUS_OHCI_RESETDONE_FLAG  (1 << 1)
-#define UHH_SYSSTATUS_EHCI_RESETDONE_FLAG  (1 << 2)
-
-	PADD32(10);
-	ioport32_t hostconfig;
-#define UHH_HOSTCONFIG_P1_ULPI_BYPASS_FLAG  (1 << 0)
-#define UHH_HOSTCONFIG_AUTOPPD_ON_OVERCUR_EN_FLAG  (1 << 1)
-#define UHH_HOSTCONFIG_ENA_INCR4_FLAG  (1 << 2)
-#define UHH_HOSTCONFIG_ENA_INCR8_FLAG  (1 << 3)
-#define UHH_HOSTCONFIG_ENA_INCR16_FLA  (1 << 4)
-#define UHH_HOSTCONFIG_ENA_INCR_ALIGN_FLAG  (1 << 5)
-#define UHH_HOSTCONFIG_P1_CONNECT_STATUS_FLAG  (1 << 8)
-#define UHH_HOSTCONFIG_P2_CONNECT_STATUS_FLAG  (1 << 9)
-#define UHH_HOSTCONFIG_P3_CONNECT_STATUS_FLAG  (1 << 10)
-#define UHH_HOSTCONFIG_P2_ULPI_BYPASS_FLAG  (1 << 11)
-#define UHH_HOSTCONFIG_P3_ULPI_BYPASS_FLAG  (1 << 12)
-
-	ioport32_t debug_csr;
-#define UHH_DEBUG_CSR_EHCI_FLADJ_MASK  (0x3f << 0)
-#define UHH_DEBUG_CSR_EHCI_FLADJ(x)  ((x) & 0x3f)
-#define UHH_DEBUG_CSR_EHCI_SIMULATION_MODE_FLAG  (1 << 6)
-#define UHH_DEBUG_CSR_OHCI_CNTSEL_FLAG  (1 << 7)
-#define UHH_DEBUG_CSR_OHCI_GLOBAL_SUSPEND_FLAG  (1 << 16)
-#define UHH_DEBUG_CSR_OHCI_CCS1_FLAG  (1 << 17)
-#define UHH_DEBUG_CSR_OHCI_CCS2_FLAG  (1 << 18)
-#define UHH_DEBUG_CSR_OHCI_CCS3_FLAG  (1 << 19)
-
-} uhh_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/amdm37x/usbtll.h
===================================================================
--- uspace/drv/platform/amdm37x/usbtll.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup amdm37x
- * @{
- */
-/** @file
- * @brief USBTLL IO register structure.
- */
-#ifndef AMDM37x_USBTLL_H
-#define AMDM37x_USBTLL_H
-
-#include <macros.h>
-#include <ddi.h>
-
-#define AMDM37x_USBTLL_BASE_ADDRESS  0x48062000
-#define AMDM37x_USBTLL_SIZE  4096
-
-typedef struct {
-	const ioport32_t revision;
-#define TLL_REVISION_MINOR_MASK  0x0f
-#define TLL_REVISION_MAJOR_MASK  0xf0
-
-	PADD32(3);
-	ioport32_t sysconfig;
-#define TLL_SYSCONFIG_AUTOIDLE_FLAG  (1 << 0)
-#define TLL_SYSCONFIG_SOFTRESET_FLAG  (1 << 1)
-#define TLL_SYSCONFIG_ENWAKEUP_FLAG  (1 << 2)
-#define TLL_SYSCONFIG_SIDLE_MODE_MASK  (0x3 << 3)
-#define TLL_SYSCONFIG_SIDLE_MODE_FORCE  (0x0 << 3)
-#define TLL_SYSCONFIG_SIDLE_MODE_NO  (0x1 << 3)
-#define TLL_SYSCONFIG_SIDLE_MODE_SMART  (0x2 << 3)
-#define TLL_SYSCONFIG_CLOCKACTIVITY_FLAG  (1 << 8)
-
-	const ioport32_t sysstatus;
-#define TLL_SYSSTATUS_RESET_DONE_FLAG  (1 << 0)
-
-	const ioport32_t irqstatus;
-#define TLL_IRQSTATUS_FCLK_START_FLAG  (1 << 0)
-#define TLL_IRQSTATUS_FCLK_END_FLAG  (1 << 1)
-#define TLL_IRQSTATUS_ACCESS_ERROR_FLAG  (1 << 2)
-
-	ioport32_t irqenable;
-#define TLL_IRQSTATUS_FCLK_START_EN_FLAG  (1 << 0)
-#define TLL_IRQSTATUS_FCLK_END_EN_FLAG  (1 << 1)
-#define TLL_IRQSTATUS_ACCESS_ERROR_EN_FLAG  (1 << 2)
-
-	PADD32(4);
-	ioport32_t shared_conf;
-#define TLL_SHARED_CONF_FCLK_IS_ON_FLAG  (1 << 0)
-#define TLL_SHARED_CONF_FCLK_REQ_FLAG  (1 << 1)
-#define TLL_SHARED_CONF_USB_DIVRATIO_MASK  (0x7 << 2)
-#define TLL_SHARED_CONF_USB_DIVRATIO(x)  (((x) & 0x7) << 2)
-#define TLL_SHARED_CONF_USB_180D_SDR_EN_FLAG  (1 << 5)
-#define TLL_SHARED_CONF_USB_90D_DDR_EN_FLAG  (1 << 6)
-
-	PADD32(3);
-	ioport32_t channel_conf[3];
-#define TLL_CHANNEL_CONF_CHANEN_FLAG  (1 << 0)
-#define TLL_CHANNEL_CONF_CHANMODE_MASK  (0x3 << 1)
-#define TLL_CHANNEL_CONF_CHANMODE_UTMI_ULPI_MODE (0x0 << 1)
-#define TLL_CHANNEL_CONF_CHANMODE_UTMI_SERIAL_MODE (0x1 << 1)
-#define TLL_CHANNEL_CONF_CHANMODE_UTMI_TRANS_MODE (0x2 << 1)
-#define TLL_CHANNEL_CONF_CHANMODE_NO_MODE (0x3 << 1)
-#define TLL_CHANNEL_CONF_UTMIISADEV_FLAG  (1 << 3)
-#define TLL_CHANNEL_CONF_TLLATTACH_FLAG  (1 << 4)
-#define TLL_CHANNEL_CONF_TLLCONNECT_FLAG  (1 << 5)
-#define TLL_CHANNEL_CONF_TLLFULLSPEED_FLAG  (1 << 6)
-#define TLL_CHANNEL_CONF_ULPIOUTCLKMODE_FLAG  (1 << 7)
-#define TLL_CHANNEL_CONF_ULPIDDRMODE_FLAG  (1 << 8)
-#define TLL_CHANNEL_CONF_UTMIAUTOIDLE_FLAG  (1 << 9)
-#define TLL_CHANNEL_CONF_ULPIAUTOIDLE_FLAG  (1 << 10)
-#define TLL_CHANNEL_CONF_ULPINOBITSTUFF_FLAG  (1 << 11)
-#define TLL_CHANNEL_CONF_CHRGVBUS_FLAG  (1 << 15)
-#define TLL_CHANNEL_CONF_DRVVBUS_FLAG  (1 << 16)
-#define TLL_CHANNEL_CONF_TESTEN_FLAG  (1 << 17)
-#define TLL_CHANNEL_CONF_TESTTXEN_FLAG  (1 << 18)
-#define TLL_CHANNEL_CONF_TESTTXDAT_FLAG  (1 << 19)
-#define TLL_CHANNEL_CONF_TESTTXSE0_FLAG  (1 << 20)
-#define TLL_CHANNEL_CONF_FSLSMODE_MASK   (0xf << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_PHY_TX_DATSE0   (0x0 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_PHY_TX_DPDM   (0x1 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_3PIN_BIDI_PHY   (0x2 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_4PIN_BIDI_PHY   (0x3 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_TLL_TX_DATSE0  (0x4 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_6PIN_UNI_TLL_TX_DPDM  (0x5 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_3PIN_BIDI_TLL  (0x6 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_4PIN_BIDI_TLL  (0x7 << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_2PIN_BIDI_TLL_DATSE0  (0xa << 24)
-#define TLL_CHANNEL_CONF_FSLSMODE_2PIN_BIDI_TLL_DPDM  (0xb << 24)
-
-#define TLL_CHANNEL_CONF_FSLSLINESTATE_MASK  (0x3 << 28)
-#define TLL_CHANNEL_CONF_FSLSLINESTATE_SE0  (0x0 << 28)
-#define TLL_CHANNEL_CONF_FSLSLINESTATE_FS_J  (0x1 << 28)
-#define TLL_CHANNEL_CONF_FSLSLINESTATE_FS_K  (0x2 << 28)
-#define TLL_CHANNEL_CONF_FSLSLINESTATE_SE1  (0x3 << 28)
-
-	/* The rest are 8bit ULPI registers */
-} tll_regs_t;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/platform/arm64virt/arm64virt.c
===================================================================
--- uspace/drv/platform/arm64virt/arm64virt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2016 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup arm64virt
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-
-#define NAME  "arm64virt"
-
-enum {
-	arm64virt_ic_distr_membase = 0x08000000,
-	arm64virt_ic_distr_memsize = 0x00001000,
-	arm64virt_ic_cpui_membase = 0x08010000,
-	arm64virt_ic_cpui_memsize = 0x00001004,
-	arm64virt_uart_irq = 33,
-	arm64virt_uart_membase = 0x09000000,
-	arm64virt_uart_memsize = 0x00001000
-};
-
-typedef struct arm64virt_fun {
-	hw_resource_list_t hw_resources;
-} arm64virt_fun_t;
-
-static errno_t arm64virt_dev_add(ddf_dev_t *);
-
-static driver_ops_t arm64virt_ops = {
-	.dev_add = &arm64virt_dev_add
-};
-
-static driver_t arm64virt_driver = {
-	.name = NAME,
-	.driver_ops = &arm64virt_ops
-};
-
-static hw_resource_t arm64virt_ic_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = arm64virt_ic_distr_membase,
-			.size = arm64virt_ic_distr_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = arm64virt_ic_cpui_membase,
-			.size = arm64virt_ic_cpui_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static hw_resource_t arm64virt_uart_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = arm64virt_uart_membase,
-			.size = arm64virt_uart_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = arm64virt_uart_irq
-		}
-	}
-};
-
-static pio_window_t arm64virt_pio_window = {
-	.mem = {
-		.base = 0,
-		.size = -1
-	}
-};
-
-static arm64virt_fun_t arm64virt_ic_fun_proto = {
-	.hw_resources = {
-		sizeof(arm64virt_ic_res) / sizeof(arm64virt_ic_res[0]),
-		arm64virt_ic_res
-	},
-};
-
-static arm64virt_fun_t arm64virt_uart_fun_proto = {
-	.hw_resources = {
-		sizeof(arm64virt_uart_res) / sizeof(arm64virt_uart_res[0]),
-		arm64virt_uart_res
-	},
-};
-
-/** Obtain function soft-state from DDF function node. */
-static arm64virt_fun_t *arm64virt_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *arm64virt_get_resources(ddf_fun_t *fnode)
-{
-	arm64virt_fun_t *fun = arm64virt_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t arm64virt_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-	return false;
-}
-
-static pio_window_t *arm64virt_get_pio_window(ddf_fun_t *fnode)
-{
-	return &arm64virt_pio_window;
-}
-
-static hw_res_ops_t arm64virt_hw_res_ops = {
-	.get_resource_list = &arm64virt_get_resources,
-	.enable_interrupt = &arm64virt_enable_interrupt,
-};
-
-static pio_window_ops_t arm64virt_pio_window_ops = {
-	.get_pio_window = &arm64virt_get_pio_window
-};
-
-static ddf_dev_ops_t arm64virt_fun_ops = {
-	.interfaces = {
-		[HW_RES_DEV_IFACE] = &arm64virt_hw_res_ops,
-		[PIO_WINDOW_DEV_IFACE] = &arm64virt_pio_window_ops
-	}
-};
-
-static errno_t arm64virt_add_fun(ddf_dev_t *dev, const char *name,
-    const char *str_match_id, arm64virt_fun_t *fun_proto)
-{
-	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function '%s'.", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	arm64virt_fun_t *fun = ddf_fun_data_alloc(fnode,
-	    sizeof(arm64virt_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID. */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding match ID to function '%s'.",
-		    name);
-		goto error;
-	}
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &arm64virt_fun_ops);
-
-	/* Register function. */
-	rc = ddf_fun_bind(fnode);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function '%s'.", name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	return rc;
-}
-
-static errno_t arm64virt_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = arm64virt_add_fun(dev, "intctl", "arm/gicv2",
-	    &arm64virt_ic_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	rc = arm64virt_add_fun(dev, "uart", "arm/pl011",
-	    &arm64virt_uart_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Add device. */
-static errno_t arm64virt_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "arm64virt_dev_add(), device=%s.",
-	    ddf_dev_get_name(dev));
-
-	/* Register functions. */
-	if (arm64virt_add_functions(dev))
-		ddf_msg(LVL_ERROR, "Failed to add functions for ARM64 QEMU "
-		    "virt platform.");
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS ARM64 QEMU virt platform driver\n");
-
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed connecting logging service.");
-		return 1;
-	}
-
-	return ddf_driver_main(&arm64virt_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/arm64virt/arm64virt.ma
===================================================================
--- uspace/drv/platform/arm64virt/arm64virt.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/arm64virt
Index: pace/drv/platform/arm64virt/meson.build
===================================================================
--- uspace/drv/platform/arm64virt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2016 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('arm64virt.c')
Index: pace/drv/platform/hikey960/hikey960.c
===================================================================
--- uspace/drv/platform/hikey960/hikey960.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,270 +1,0 @@
-/*
- * Copyright (c) 2021 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup hikey960
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-
-#define NAME  "hikey960"
-
-enum {
-	hikey960_ic_distr_membase = 0xE82B1000,
-	hikey960_ic_distr_memsize = 0x00001000,
-	hikey960_ic_cpui_membase = 0xE82B2000,
-	hikey960_ic_cpui_memsize = 0x00001004,
-	hikey960_uart_irq = 111,
-	hikey960_uart_membase = 0xFFF32000,
-	hikey960_uart_memsize = 0x00001000
-};
-
-typedef struct hikey960_fun {
-	hw_resource_list_t hw_resources;
-} hikey960_fun_t;
-
-static errno_t hikey960_dev_add(ddf_dev_t *);
-
-static driver_ops_t hikey960_ops = {
-	.dev_add = &hikey960_dev_add
-};
-
-static driver_t hikey960_driver = {
-	.name = NAME,
-	.driver_ops = &hikey960_ops
-};
-
-static hw_resource_t hikey960_ic_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = hikey960_ic_distr_membase,
-			.size = hikey960_ic_distr_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = hikey960_ic_cpui_membase,
-			.size = hikey960_ic_cpui_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static hw_resource_t hikey960_uart_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = hikey960_uart_membase,
-			.size = hikey960_uart_memsize,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = hikey960_uart_irq
-		}
-	}
-};
-
-static pio_window_t hikey960_pio_window = {
-	.mem = {
-		.base = 0,
-		.size = -1
-	}
-};
-
-static hikey960_fun_t hikey960_ic_fun_proto = {
-	.hw_resources = {
-		sizeof(hikey960_ic_res) / sizeof(hikey960_ic_res[0]),
-		hikey960_ic_res
-	},
-};
-
-static hikey960_fun_t hikey960_uart_fun_proto = {
-	.hw_resources = {
-		sizeof(hikey960_uart_res) / sizeof(hikey960_uart_res[0]),
-		hikey960_uart_res
-	},
-};
-
-/** Obtain function soft-state from DDF function node. */
-static hikey960_fun_t *hikey960_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *hikey960_get_resources(ddf_fun_t *fnode)
-{
-	hikey960_fun_t *fun = hikey960_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t hikey960_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-	return false;
-}
-
-static pio_window_t *hikey960_get_pio_window(ddf_fun_t *fnode)
-{
-	return &hikey960_pio_window;
-}
-
-static hw_res_ops_t hikey960_hw_res_ops = {
-	.get_resource_list = &hikey960_get_resources,
-	.enable_interrupt = &hikey960_enable_interrupt,
-};
-
-static pio_window_ops_t hikey960_pio_window_ops = {
-	.get_pio_window = &hikey960_get_pio_window
-};
-
-static ddf_dev_ops_t hikey960_fun_ops = {
-	.interfaces = {
-		[HW_RES_DEV_IFACE] = &hikey960_hw_res_ops,
-		[PIO_WINDOW_DEV_IFACE] = &hikey960_pio_window_ops
-	}
-};
-
-static errno_t hikey960_add_fun(ddf_dev_t *dev, const char *name,
-    const char *str_match_id, hikey960_fun_t *fun_proto)
-{
-	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function '%s'.", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	hikey960_fun_t *fun = ddf_fun_data_alloc(fnode,
-	    sizeof(hikey960_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID. */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding match ID to function '%s'.",
-		    name);
-		goto error;
-	}
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &hikey960_fun_ops);
-
-	/* Register function. */
-	rc = ddf_fun_bind(fnode);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function '%s'.", name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	return rc;
-}
-
-static errno_t hikey960_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = hikey960_add_fun(dev, "intctl", "arm/gicv2",
-	    &hikey960_ic_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	rc = hikey960_add_fun(dev, "uart", "arm/pl011",
-	    &hikey960_uart_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Add device. */
-static errno_t hikey960_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "hikey960_dev_add(), device=%s.",
-	    ddf_dev_get_name(dev));
-
-	/* Register functions. */
-	if (hikey960_add_functions(dev))
-		ddf_msg(LVL_ERROR, "Failed to add functions for HiKey 960 platform.");
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("%s: HelenOS HiKey 960 platform driver\n", NAME);
-
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf("%s: Failed connecting logging service.", NAME);
-		return 1;
-	}
-
-	return ddf_driver_main(&hikey960_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/hikey960/hikey960.ma
===================================================================
--- uspace/drv/platform/hikey960/hikey960.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/hikey960
Index: pace/drv/platform/hikey960/meson.build
===================================================================
--- uspace/drv/platform/hikey960/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2021 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('hikey960.c')
Index: pace/drv/platform/icp/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/icp/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup icp icp
- * @brief ARM Inegrator/CP platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/icp/icp.c
===================================================================
--- uspace/drv/platform/icp/icp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,327 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup icp
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <irc.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-
-#define NAME "icp"
-
-enum {
-	icp_kbd_base = 0x18000000,
-	icp_kbd_irq = 3,
-	icp_mouse_base = 0x19000000,
-	icp_mouse_irq = 4,
-	icp_ic_base = 0x14000000
-};
-
-typedef struct icp_fun {
-	hw_resource_list_t hw_resources;
-} icp_fun_t;
-
-static errno_t icp_dev_add(ddf_dev_t *dev);
-
-static driver_ops_t icp_ops = {
-	.dev_add = &icp_dev_add
-};
-
-static driver_t icp_driver = {
-	.name = NAME,
-	.driver_ops = &icp_ops
-};
-
-static hw_resource_t icp_kbd_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = icp_kbd_base,
-			.size = 9,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = icp_kbd_irq
-		}
-	}
-};
-
-static hw_resource_t icp_mouse_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = icp_mouse_base,
-			.size = 9,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = icp_mouse_irq
-		}
-	}
-};
-
-static hw_resource_t icp_ic_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = icp_ic_base,
-			.size = 40,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static pio_window_t icp_pio_window = {
-	.mem = {
-		.base = 0,
-		.size = -1
-	}
-};
-
-static icp_fun_t icp_kbd_fun_proto = {
-	.hw_resources = {
-		sizeof(icp_kbd_res) / sizeof(icp_kbd_res[0]),
-		icp_kbd_res
-	},
-};
-
-static icp_fun_t icp_mouse_fun_proto = {
-	.hw_resources = {
-		sizeof(icp_mouse_res) / sizeof(icp_mouse_res[0]),
-		icp_mouse_res
-	},
-};
-
-static icp_fun_t icp_ic_fun_proto = {
-	.hw_resources = {
-		sizeof(icp_ic_res) / sizeof(icp_ic_res[0]),
-		icp_ic_res
-	},
-};
-
-/** Obtain function soft-state from DDF function node */
-static icp_fun_t *icp_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *icp_get_resources(ddf_fun_t *fnode)
-{
-	icp_fun_t *fun = icp_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static bool icp_fun_owns_interrupt(icp_fun_t *fun, int irq)
-{
-	const hw_resource_list_t *res = &fun->hw_resources;
-
-	/* Check that specified irq really belongs to the function */
-	for (size_t i = 0; i < res->count; ++i) {
-		if (res->resources[i].type == INTERRUPT &&
-		    res->resources[i].res.interrupt.irq == irq) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
-static errno_t icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	icp_fun_t *fun = icp_fun(fnode);
-
-	if (!icp_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_enable_interrupt(irq);
-}
-
-static errno_t icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)
-{
-	icp_fun_t *fun = icp_fun(fnode);
-
-	if (!icp_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_disable_interrupt(irq);
-}
-
-static errno_t icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)
-{
-	icp_fun_t *fun = icp_fun(fnode);
-
-	if (!icp_fun_owns_interrupt(fun, irq))
-		return EINVAL;
-
-	return irc_clear_interrupt(irq);
-}
-
-static pio_window_t *icp_get_pio_window(ddf_fun_t *fnode)
-{
-	return &icp_pio_window;
-}
-
-static hw_res_ops_t icp_hw_res_ops = {
-	.get_resource_list = &icp_get_resources,
-	.enable_interrupt = &icp_fun_enable_interrupt,
-	.disable_interrupt = &icp_fun_disable_interrupt,
-	.clear_interrupt = &icp_fun_clear_interrupt
-};
-
-static pio_window_ops_t icp_pio_window_ops = {
-	.get_pio_window = &icp_get_pio_window
-};
-
-static ddf_dev_ops_t icp_fun_ops = {
-	.interfaces = {
-		[HW_RES_DEV_IFACE] = &icp_hw_res_ops,
-		[PIO_WINDOW_DEV_IFACE] = &icp_pio_window_ops
-	}
-};
-
-static errno_t icp_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
-    icp_fun_t *fun_proto)
-{
-	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function '%s'", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	icp_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(icp_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding match ID");
-		goto error;
-	}
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &icp_fun_ops);
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	return rc;
-}
-
-static errno_t icp_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = icp_add_fun(dev, "intctl", "integratorcp/intctl",
-	    &icp_ic_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	rc = icp_add_fun(dev, "kbd", "arm/pl050", &icp_kbd_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	rc = icp_add_fun(dev, "mouse", "arm/pl050", &icp_mouse_fun_proto);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Add device. */
-static errno_t icp_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "icp_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	if (icp_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for ICP platform.");
-	}
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS IntegratorCP platform driver\n");
-
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed initializing logging service");
-		return 1;
-	}
-
-	return ddf_driver_main(&icp_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/icp/icp.ma
===================================================================
--- uspace/drv/platform/icp/icp.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/integratorcp
Index: pace/drv/platform/icp/meson.build
===================================================================
--- uspace/drv/platform/icp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('icp.c')
Index: pace/drv/platform/mac/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/mac/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mac mac
- * @brief Platform driver for PowerPC-based Macs
- * @ingroup drvs
- */
Index: pace/drv/platform/mac/mac.c
===================================================================
--- uspace/drv/platform/mac/mac.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,255 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup mac mac
- * @{
- */
-
-/** @file
- */
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-#include <stdio.h>
-#include <sysinfo.h>
-
-#define NAME  "mac"
-
-typedef struct {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} mac_fun_t;
-
-static hw_resource_t adb_res[] = {
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = 0,
-			.size = 0x2000,
-			.relative = true,
-			.endianness = BIG_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = 0 /* patched at run time */
-		}
-	},
-};
-
-static mac_fun_t adb_data = {
-	.hw_resources = {
-		sizeof(adb_res) / sizeof(adb_res[0]),
-		adb_res
-	},
-	.pio_window = {
-		.io = {
-			.base = 0, /* patched at run time */
-			.size = 0x2000
-		}
-	}
-};
-
-static hw_resource_t pci_conf_regs[] = {
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = 0xfec00000,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = 0xfee00000,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static mac_fun_t pci_data = {
-	.hw_resources = {
-		2,
-		pci_conf_regs
-	}
-};
-
-static ddf_dev_ops_t mac_fun_ops;
-
-/** Obtain function soft-state from DDF function node */
-static mac_fun_t *mac_fun(ddf_fun_t *ddf_fun)
-{
-	return ddf_fun_data_get(ddf_fun);
-}
-
-static pio_window_t *mac_get_pio_window(ddf_fun_t *ddf_fun)
-{
-	mac_fun_t *fun = mac_fun(ddf_fun);
-	return &fun->pio_window;
-}
-
-static bool mac_add_fun(ddf_dev_t *dev, const char *name,
-    const char *str_match_id, mac_fun_t *fun_proto)
-{
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
-	printf("mac: Adding new function '%s'.\n", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL)
-		goto failure;
-
-	mac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(mac_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK)
-		goto failure;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &mac_fun_ops);
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto failure;
-	}
-
-	printf("mac: Added new function '%s' (str=%s).\n", name, str_match_id);
-	return true;
-
-failure:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
-
-	return false;
-}
-
-/** Get the root device.
- *
- * @param dev Device which is root of the whole device tree
- *            (both of HW and pseudo devices).
- *
- * @return Zero on success, error number otherwise.
- *
- */
-static errno_t mac_dev_add(ddf_dev_t *dev)
-{
-	errno_t rc;
-	uintptr_t cuda_physical;
-	sysarg_t cuda_inr;
-#if 0
-	/* Register functions */
-	if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) {
-		ddf_msg(LVL_ERROR, "Failed to add PCI function for Mac platform.");
-		return EIO;
-	}
-#else
-	(void)pci_data;
-#endif
-	rc = sysinfo_get_value("cuda.address.physical", &cuda_physical);
-	if (rc != EOK)
-		return EIO;
-	rc = sysinfo_get_value("cuda.inr", &cuda_inr);
-	if (rc != EOK)
-		return EIO;
-
-	adb_data.pio_window.io.base = cuda_physical;
-	adb_res[1].res.interrupt.irq = cuda_inr;
-
-	if (!mac_add_fun(dev, "adb", "cuda_adb", &adb_data)) {
-		ddf_msg(LVL_ERROR, "Failed to add ADB function for Mac platform.");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** The root device driver's standard operations. */
-static driver_ops_t mac_ops = {
-	.dev_add = &mac_dev_add
-};
-
-/** The root device driver structure. */
-static driver_t mac_driver = {
-	.name = NAME,
-	.driver_ops = &mac_ops
-};
-
-static hw_resource_list_t *mac_get_resources(ddf_fun_t *fnode)
-{
-	mac_fun_t *fun = mac_fun(fnode);
-	assert(fun != NULL);
-
-	return &fun->hw_resources;
-}
-
-static errno_t mac_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-
-	return false;
-}
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &mac_get_pio_window
-};
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &mac_get_resources,
-	.enable_interrupt = &mac_enable_interrupt
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS Mac platform driver\n", NAME);
-	ddf_log_init(NAME);
-	mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	mac_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-	return ddf_driver_main(&mac_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/mac/mac.ma
===================================================================
--- uspace/drv/platform/mac/mac.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/mac
Index: pace/drv/platform/mac/meson.build
===================================================================
--- uspace/drv/platform/mac/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('mac.c')
Index: pace/drv/platform/malta/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/malta/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup malta malta
- * @brief MIPS Malta platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/malta/malta.c
===================================================================
--- uspace/drv/platform/malta/malta.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup malta
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <ddi.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ipc/dev_iface.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-#include <byteorder.h>
-
-#define NAME "malta"
-
-#define GT_BASE		UINT32_C(0x1be00000)
-#define GT_SIZE 	(2 * 1024 * 1024)
-
-#define GT_PCI_CMD	0xc00
-#define GT_PCI_CONFADDR	0xcf8
-#define GT_PCI_CONFDATA	0xcfc
-
-#define GT_PCI_CMD_MBYTESWAP	0x1
-
-#define GT_PCI_MEMBASE	UINT32_C(0x10000000)
-#define GT_PCI_MEMSIZE	UINT32_C(0x08000000)
-
-#define GT_PCI_IOBASE	UINT32_C(0x18000000)
-#define GT_PCI_IOSIZE	UINT32_C(0x00200000)
-
-typedef struct malta_fun {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} malta_fun_t;
-
-static errno_t malta_dev_add(ddf_dev_t *dev);
-static void malta_init(void);
-
-/** The root device driver's standard operations. */
-static driver_ops_t malta_ops = {
-	.dev_add = &malta_dev_add
-};
-
-/** The root device driver structure. */
-static driver_t malta_driver = {
-	.name = NAME,
-	.driver_ops = &malta_ops
-};
-
-static hw_resource_t pci_conf_regs[] = {
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = GT_BASE + GT_PCI_CONFADDR,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = GT_BASE + GT_PCI_CONFDATA,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static malta_fun_t pci_data = {
-	.hw_resources = {
-		sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]),
-		pci_conf_regs
-	},
-	.pio_window = {
-		.mem = {
-			.base = GT_PCI_MEMBASE,
-			.size = GT_PCI_MEMSIZE
-		},
-		.io = {
-			.base = GT_PCI_IOBASE,
-			.size = GT_PCI_IOSIZE
-		}
-	}
-};
-
-/** Obtain function soft-state from DDF function node */
-static malta_fun_t *malta_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *malta_get_resources(ddf_fun_t *fnode)
-{
-	malta_fun_t *fun = malta_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t malta_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-
-	return false;
-}
-
-static pio_window_t *malta_get_pio_window(ddf_fun_t *fnode)
-{
-	malta_fun_t *fun = malta_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->pio_window;
-}
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &malta_get_resources,
-	.enable_interrupt = &malta_enable_interrupt,
-};
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &malta_get_pio_window
-};
-
-/* Initialized in malta_init() function. */
-static ddf_dev_ops_t malta_fun_ops;
-
-static bool
-malta_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
-    malta_fun_t *fun_proto)
-{
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL)
-		goto failure;
-
-	malta_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(malta_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK)
-		goto failure;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &malta_fun_ops);
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto failure;
-	}
-
-	return true;
-
-failure:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
-
-	return false;
-}
-
-static bool malta_add_functions(ddf_dev_t *dev)
-{
-	return malta_add_fun(dev, "pci0", "intel_pci", &pci_data);
-}
-
-/** Get the root device.
- *
- * @param dev		The device which is root of the whole device tree (both
- *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t malta_dev_add(ddf_dev_t *dev)
-{
-	ioport32_t *gt;
-	uint32_t val;
-	errno_t ret;
-
-	ddf_msg(LVL_DEBUG, "malta_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/*
-	 * We need to disable byte swapping of the outgoing and incoming
-	 * PCI data, because the PCI driver assumes no byte swapping behind
-	 * the scenes and takes care of it itself.
-	 */
-	ret = pio_enable((void *) GT_BASE, GT_SIZE, (void **) &gt);
-	if (ret != EOK)
-		return ret;
-	val = uint32_t_le2host(pio_read_32(
-	    &gt[GT_PCI_CMD / sizeof(ioport32_t)]));
-	val |= GT_PCI_CMD_MBYTESWAP;
-	pio_write_32(
-	    &gt[GT_PCI_CMD / sizeof(ioport32_t)], host2uint32_t_le(val));
-
-	/* Register functions. */
-	if (!malta_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for the Malta platform.");
-	}
-
-	return EOK;
-}
-
-static void malta_init(void)
-{
-	ddf_log_init(NAME);
-	malta_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	malta_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS Malta platform driver\n");
-	malta_init();
-	return ddf_driver_main(&malta_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/malta/malta.ma
===================================================================
--- uspace/drv/platform/malta/malta.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/malta
Index: pace/drv/platform/malta/meson.build
===================================================================
--- uspace/drv/platform/malta/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('malta.c')
Index: pace/drv/platform/msim/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/msim/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup msim msim
- * @brief Platform driver for the MSIM simulator machine
- * @ingroup drvs
- */
Index: pace/drv/platform/msim/meson.build
===================================================================
--- uspace/drv/platform/msim/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('msim.c')
Index: pace/drv/platform/msim/msim.c
===================================================================
--- uspace/drv/platform/msim/msim.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2015 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup msim
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <ipc/dev_iface.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#define NAME "msim"
-
-#define MSIM_DDISK_BASE	UINT32_C(0x10000200)
-#define MSIM_DDISK_SIZE	UINT32_C(0x00000010)
-#define MSIM_DDISK_IRQ 6
-
-#define MSIM_KBD_ADDRESS UINT32_C(0x10000000)
-#define MSIM_KBD_SIZE 1
-#define MSIM_KBD_IRQ 2
-
-typedef struct msim_fun {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} msim_fun_t;
-
-static errno_t msim_dev_add(ddf_dev_t *dev);
-static void msim_init(void);
-
-/** Standard driver operations. */
-static driver_ops_t msim_ops = {
-	.dev_add = &msim_dev_add
-};
-
-/** Driver structure. */
-static driver_t msim_driver = {
-	.name = NAME,
-	.driver_ops = &msim_ops
-};
-
-static hw_resource_t disk_regs[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = 0,
-			.size = 16,
-			.relative = true,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = MSIM_DDISK_IRQ
-		}
-	}
-};
-
-static msim_fun_t disk_data = {
-	.hw_resources = {
-		sizeof(disk_regs) / sizeof(disk_regs[0]),
-		disk_regs
-	},
-	.pio_window = {
-		.mem = {
-			.base = MSIM_DDISK_BASE,
-			.size = MSIM_DDISK_SIZE
-		}
-	}
-};
-
-static hw_resource_t console_regs[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = 0,
-			.size = 1,
-			.relative = true,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = INTERRUPT,
-		.res.interrupt = {
-			.irq = MSIM_KBD_IRQ
-		}
-	}
-};
-
-static msim_fun_t console_data = {
-	.hw_resources = {
-		sizeof(console_regs) / sizeof(console_regs[0]),
-		console_regs
-	},
-	.pio_window = {
-		.mem = {
-			.base = MSIM_KBD_ADDRESS,
-			.size = MSIM_KBD_SIZE
-		}
-	}
-};
-
-/** Obtain function soft-state from DDF function node */
-static msim_fun_t *msim_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *msim_get_resources(ddf_fun_t *fnode)
-{
-	msim_fun_t *fun = msim_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t msim_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* Nothing to do. */
-
-	return EOK;
-}
-
-static pio_window_t *msim_get_pio_window(ddf_fun_t *fnode)
-{
-	msim_fun_t *fun = msim_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->pio_window;
-}
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &msim_get_resources,
-	.enable_interrupt = &msim_enable_interrupt,
-};
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &msim_get_pio_window
-};
-
-/* Initialized in msim_init() function. */
-static ddf_dev_ops_t msim_fun_ops;
-
-static bool
-msim_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
-    msim_fun_t *fun_proto)
-{
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL)
-		goto failure;
-
-	msim_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(msim_fun_t));
-	if (fun == NULL)
-		goto failure;
-
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK)
-		goto failure;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &msim_fun_ops);
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto failure;
-	}
-
-	return true;
-
-failure:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
-
-	return false;
-}
-
-static bool msim_add_functions(ddf_dev_t *dev)
-{
-	if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data))
-		return false;
-	if (!msim_add_fun(dev, "console", "msim/console", &console_data))
-		return false;
-	return true;
-}
-
-/** Add MSIM platform device.
- *
- * @param dev DDF device
- * @return Zero on success or non-zero error code.
- */
-static errno_t msim_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, "msim_dev_add, device handle = %d",
-	    (int) ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	if (!msim_add_functions(dev))
-		ddf_msg(LVL_ERROR, "Failed to add functions for the MSIM platform.");
-
-	return EOK;
-}
-
-static void msim_init(void)
-{
-	ddf_log_init(NAME);
-	msim_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	msim_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS MSIM platform driver\n");
-	msim_init();
-	return ddf_driver_main(&msim_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/msim/msim.ma
===================================================================
--- uspace/drv/platform/msim/msim.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/msim
Index: pace/drv/platform/pc/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/pc/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup pc pc
- * @brief PC platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/pc/meson.build
===================================================================
--- uspace/drv/platform/pc/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('pc.c')
Index: pace/drv/platform/pc/pc.c
===================================================================
--- uspace/drv/platform/pc/pc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,250 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup pc pc
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ipc/dev_iface.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-
-#define NAME "pc"
-
-typedef struct pc_fun {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} pc_fun_t;
-
-static errno_t pc_dev_add(ddf_dev_t *dev);
-static void pc_init(void);
-
-/** The root device driver's standard operations. */
-static driver_ops_t pc_ops = {
-	.dev_add = &pc_dev_add
-};
-
-/** The root device driver structure. */
-static driver_t pc_driver = {
-	.name = NAME,
-	.driver_ops = &pc_ops
-};
-
-static hw_resource_t pci_conf_regs[] = {
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = 0xCF8,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = IO_RANGE,
-		.res.io_range = {
-			.address = 0xCFC,
-			.size = 4,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static pc_fun_t sys_data = {
-	.hw_resources = {
-		sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]),
-		pci_conf_regs
-	},
-	.pio_window = {
-		.mem = {
-			.base = UINT32_C(0),
-			.size = UINT32_C(0xffffffff) /* practical maximum */
-		},
-		.io = {
-			.base = UINT32_C(0),
-			.size = UINT32_C(0x10000)
-		}
-	}
-};
-
-/** Obtain function soft-state from DDF function node */
-static pc_fun_t *pc_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *pc_get_resources(ddf_fun_t *fnode)
-{
-	pc_fun_t *fun = pc_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t pc_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-
-	return false;
-}
-
-static pio_window_t *pc_get_pio_window(ddf_fun_t *fnode)
-{
-	pc_fun_t *fun = pc_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->pio_window;
-}
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &pc_get_resources,
-	.enable_interrupt = &pc_enable_interrupt,
-};
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &pc_get_pio_window
-};
-
-/* Initialized in pc_init() function. */
-static ddf_dev_ops_t pc_fun_ops;
-
-static errno_t pc_add_sysbus(ddf_dev_t *dev)
-{
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Adding system bus.");
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, "sys");
-	if (fnode == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pc_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(pc_fun_t));
-	*fun = sys_data;
-
-	/* Add match IDs */
-	rc = ddf_fun_add_match_id(fnode, "intel_pci", 100);
-	if (rc != EOK)
-		goto error;
-
-	rc = ddf_fun_add_match_id(fnode, "isa", 10);
-	if (rc != EOK)
-		goto error;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &pc_fun_ops);
-
-	/* Register function. */
-	rc = ddf_fun_bind(fnode);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding system bus function.");
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	ddf_msg(LVL_ERROR, "Failed adding system bus.");
-	return rc;
-}
-
-static errno_t pc_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = pc_add_sysbus(dev);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Get the root device.
- *
- * @param dev		The device which is root of the whole device tree (both
- *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t pc_dev_add(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "pc_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	rc = pc_add_functions(dev);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for PC platform.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static void pc_init(void)
-{
-	ddf_log_init(NAME);
-	pc_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	pc_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS PC platform driver\n");
-	pc_init();
-	return ddf_driver_main(&pc_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/pc/pc.ma
===================================================================
--- uspace/drv/platform/pc/pc.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/pc
Index: pace/drv/platform/ski/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/ski/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ski ski
- * @brief Platform driver for the Ski IA-64 simulator machine
- * @ingroup drvs
- */
Index: pace/drv/platform/ski/meson.build
===================================================================
--- uspace/drv/platform/ski/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('ski.c')
Index: pace/drv/platform/ski/ski.c
===================================================================
--- uspace/drv/platform/ski/ski.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup ski ski
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-
-#define NAME "ski"
-
-static errno_t ski_dev_add(ddf_dev_t *dev);
-
-static driver_ops_t ski_ops = {
-	.dev_add = &ski_dev_add
-};
-
-static driver_t ski_driver = {
-	.name = NAME,
-	.driver_ops = &ski_ops
-};
-
-static errno_t ski_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id)
-{
-	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function '%s'", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding match ID");
-		goto error;
-	}
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	return rc;
-}
-
-static errno_t ski_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = ski_add_fun(dev, "console", "ski/console");
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Add device. */
-static errno_t ski_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_NOTE, "ski_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	if (ski_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for ski platform.");
-	}
-
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": Ski platform driver\n");
-
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed initializing logging service");
-		return 1;
-	}
-
-	return ddf_driver_main(&ski_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/ski/ski.ma
===================================================================
--- uspace/drv/platform/ski/ski.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/ski
Index: pace/drv/platform/sun4u/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/sun4u/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup sun4u sun4u
- * @brief Sun sun4u platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/sun4u/meson.build
===================================================================
--- uspace/drv/platform/sun4u/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('sun4u.c')
Index: pace/drv/platform/sun4u/sun4u.c
===================================================================
--- uspace/drv/platform/sun4u/sun4u.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup sun4u sun4u
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <ddi.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ipc/dev_iface.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-#include <byteorder.h>
-
-#define NAME "sun4u"
-
-#define PBM_BASE		UINT64_C(0x1fe00000000)
-#define PBM_SIZE		UINT64_C(0x00200000000)
-
-#define PBM_PCI_CONFIG_BASE	UINT64_C(0x00001000000)
-#define PBM_PCI_CONFIG_SIZE	UINT64_C(0x00001000000)
-
-#define PBM_PCI_IO_BASE		UINT64_C(0x00002000000)
-#define PBM_PCI_IO_SIZE		UINT64_C(0x00001000000)
-
-#define PBM_PCI_MEM_BASE	UINT64_C(0x00100000000)
-#define PBM_PCI_MEM_SIZE	UINT64_C(0x00100000000)
-
-#define PBM_OBIO_BASE		UINT64_C(0)
-#define PBM_OBIO_SIZE		UINT64_C(0x1898)
-
-typedef struct sun4u_fun {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} sun4u_fun_t;
-
-static errno_t sun4u_dev_add(ddf_dev_t *dev);
-static void sun4u_init(void);
-
-/** The root device driver's standard operations. */
-static driver_ops_t sun4u_ops = {
-	.dev_add = &sun4u_dev_add
-};
-
-/** The root device driver structure. */
-static driver_t sun4u_driver = {
-	.name = NAME,
-	.driver_ops = &sun4u_ops
-};
-
-static hw_resource_t obio_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = PBM_BASE + PBM_OBIO_BASE,
-			.size = PBM_OBIO_SIZE,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static sun4u_fun_t obio_data = {
-	.hw_resources = {
-		.count = sizeof(obio_res) / sizeof(obio_res[0]),
-		.resources = obio_res
-	},
-	.pio_window = {
-		.mem = {
-			.base = PBM_BASE + PBM_OBIO_BASE,
-			.size = PBM_OBIO_SIZE
-		}
-	}
-};
-
-static hw_resource_t pci_conf_regs[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = PBM_BASE + PBM_PCI_CONFIG_BASE,
-			.size = PBM_PCI_CONFIG_SIZE,
-			.relative = false,
-			.endianness = LITTLE_ENDIAN
-		}
-	}
-};
-
-static sun4u_fun_t pci_data = {
-	.hw_resources = {
-		.count = sizeof(pci_conf_regs) / sizeof(pci_conf_regs[0]),
-		.resources = pci_conf_regs
-	},
-	.pio_window = {
-		.mem = {
-			.base = PBM_BASE + PBM_PCI_MEM_BASE,
-			.size = PBM_PCI_MEM_SIZE
-		},
-		.io = {
-			.base = PBM_BASE + PBM_PCI_IO_BASE,
-			.size = PBM_PCI_IO_SIZE
-		}
-	}
-};
-
-/** Obtain function soft-state from DDF function node */
-static sun4u_fun_t *sun4u_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *sun4u_get_resources(ddf_fun_t *fnode)
-{
-	sun4u_fun_t *fun = sun4u_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t sun4u_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	/* TODO */
-
-	return false;
-}
-
-static pio_window_t *sun4u_get_pio_window(ddf_fun_t *fnode)
-{
-	sun4u_fun_t *fun = sun4u_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->pio_window;
-}
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &sun4u_get_resources,
-	.enable_interrupt = &sun4u_enable_interrupt,
-};
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &sun4u_get_pio_window
-};
-
-/* Initialized in sun4u_init() function. */
-static ddf_dev_ops_t sun4u_fun_ops;
-
-static bool
-sun4u_add_fun(ddf_dev_t *dev, const char *name, const char *str_match_id,
-    sun4u_fun_t *fun_proto)
-{
-	ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL)
-		goto failure;
-
-	sun4u_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(sun4u_fun_t));
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK)
-		goto failure;
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &sun4u_fun_ops);
-
-	/* Register function. */
-	if (ddf_fun_bind(fnode) != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto failure;
-	}
-
-	return true;
-
-failure:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	ddf_msg(LVL_ERROR, "Failed adding function '%s'.", name);
-
-	return false;
-}
-
-static bool sun4u_add_functions(ddf_dev_t *dev)
-{
-	if (!sun4u_add_fun(dev, "obio", "ebus/obio", &obio_data))
-		return false;
-
-	return sun4u_add_fun(dev, "pci0", "intel_pci", &pci_data);
-}
-
-/** Get the root device.
- *
- * @param dev		The device which is root of the whole device tree (both
- *			of HW and pseudo devices).
- * @return		Zero on success, error number otherwise.
- */
-static errno_t sun4u_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, "sun4u_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	if (!sun4u_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for the Malta platform.");
-	}
-
-	return EOK;
-}
-
-static void sun4u_init(void)
-{
-	ddf_log_init(NAME);
-	sun4u_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	sun4u_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS sun4u platform driver\n");
-	sun4u_init();
-	return ddf_driver_main(&sun4u_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/sun4u/sun4u.ma
===================================================================
--- uspace/drv/platform/sun4u/sun4u.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/sun4u
Index: pace/drv/platform/sun4v/doc/doxygroups.h
===================================================================
--- uspace/drv/platform/sun4v/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup sun4v sun4v
- * @brief Sun sun4v platform driver
- * @ingroup drvs
- */
Index: pace/drv/platform/sun4v/meson.build
===================================================================
--- uspace/drv/platform/sun4v/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('sun4v.c')
Index: pace/drv/platform/sun4v/sun4v.c
===================================================================
--- uspace/drv/platform/sun4v/sun4v.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup sun4v sun4v
- * @{
- */
-
-/** @file
- */
-
-#include <as.h>
-#include <assert.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ops/hw_res.h>
-#include <ops/pio_window.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sysinfo.h>
-
-#define NAME "sun4v"
-
-typedef struct sun4v_fun {
-	hw_resource_list_t hw_resources;
-	pio_window_t pio_window;
-} sun4v_fun_t;
-
-static errno_t sun4v_dev_add(ddf_dev_t *dev);
-
-static driver_ops_t sun4v_ops = {
-	.dev_add = &sun4v_dev_add
-};
-
-static driver_t sun4v_driver = {
-	.name = NAME,
-	.driver_ops = &sun4v_ops
-};
-
-static hw_resource_t console_res[] = {
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = 0,
-			.size = PAGE_SIZE,
-			.relative = true,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-	{
-		.type = MEM_RANGE,
-		.res.mem_range = {
-			.address = 0,
-			.size = PAGE_SIZE,
-			.relative = true,
-			.endianness = LITTLE_ENDIAN
-		}
-	},
-};
-
-static sun4v_fun_t console_data = {
-	.hw_resources = {
-		sizeof(console_res) / sizeof(console_res[0]),
-		console_res
-	},
-	.pio_window = {
-		.mem = {
-			.base = 0,
-			.size = PAGE_SIZE
-		}
-	}
-};
-
-/** Obtain function soft-state from DDF function node */
-static sun4v_fun_t *sun4v_fun(ddf_fun_t *fnode)
-{
-	return ddf_fun_data_get(fnode);
-}
-
-static hw_resource_list_t *sun4v_get_resources(ddf_fun_t *fnode)
-{
-	sun4v_fun_t *fun = sun4v_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->hw_resources;
-}
-
-static errno_t sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
-{
-	return EOK;
-}
-
-static pio_window_t *sun4v_get_pio_window(ddf_fun_t *fnode)
-{
-	sun4v_fun_t *fun = sun4v_fun(fnode);
-
-	assert(fun != NULL);
-	return &fun->pio_window;
-}
-
-static hw_res_ops_t fun_hw_res_ops = {
-	.get_resource_list = &sun4v_get_resources,
-	.enable_interrupt = &sun4v_enable_interrupt,
-};
-
-static pio_window_ops_t fun_pio_window_ops = {
-	.get_pio_window = &sun4v_get_pio_window
-};
-
-static ddf_dev_ops_t sun4v_fun_ops;
-
-static errno_t sun4v_add_fun(ddf_dev_t *dev, const char *name,
-    const char *str_match_id, sun4v_fun_t *fun_proto)
-{
-	ddf_msg(LVL_NOTE, "Adding function '%s'.", name);
-
-	ddf_fun_t *fnode = NULL;
-	errno_t rc;
-
-	/* Create new device. */
-	fnode = ddf_fun_create(dev, fun_inner, name);
-	if (fnode == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function '%s'", name);
-		rc = ENOMEM;
-		goto error;
-	}
-
-	sun4v_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(sun4v_fun_t));
-	if (fun == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	*fun = *fun_proto;
-
-	/* Add match ID */
-	rc = ddf_fun_add_match_id(fnode, str_match_id, 100);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error adding match ID");
-		goto error;
-	}
-
-	/* Set provided operations to the device. */
-	ddf_fun_set_ops(fnode, &sun4v_fun_ops);
-
-	/* Register function. */
-	rc = ddf_fun_bind(fnode);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s.", name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (fnode != NULL)
-		ddf_fun_destroy(fnode);
-
-	return rc;
-}
-
-static errno_t sun4v_add_functions(ddf_dev_t *dev)
-{
-	errno_t rc;
-
-	rc = sun4v_add_fun(dev, "console", "sun4v/console", &console_data);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Add device. */
-static errno_t sun4v_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, "sun4v_dev_add, device handle = %d",
-	    (int)ddf_dev_get_handle(dev));
-
-	/* Register functions. */
-	if (sun4v_add_functions(dev)) {
-		ddf_msg(LVL_ERROR, "Failed to add functions for sun4v platform.");
-	}
-
-	return EOK;
-}
-
-static errno_t sun4v_init(void)
-{
-	errno_t rc;
-	sysarg_t paddr;
-
-	sun4v_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;
-	sun4v_fun_ops.interfaces[PIO_WINDOW_DEV_IFACE] = &fun_pio_window_ops;
-
-	rc = ddf_log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed initializing logging service\n");
-		return rc;
-	}
-
-	rc = sysinfo_get_value("niagara.inbuf.address", &paddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "niagara.inbuf.address not set: %s", str_error(rc));
-		return rc;
-	}
-
-	console_res[0].res.mem_range.address = paddr;
-
-	rc = sysinfo_get_value("niagara.outbuf.address", &paddr);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "niagara.outbuf.address not set: %s", str_error(rc));
-		return rc;
-	}
-
-	console_res[1].res.mem_range.address = paddr;
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": Sun4v platform driver\n");
-
-	rc = sun4v_init();
-	if (rc != EOK)
-		return 1;
-
-	return ddf_driver_main(&sun4v_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/platform/sun4v/sun4v.ma
===================================================================
--- uspace/drv/platform/sun4v/sun4v.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 platform/sun4v
Index: pace/drv/root/root/doc/doxygroups.h
===================================================================
--- uspace/drv/root/root/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup root root
- * @brief Root device driver
- * @ingroup drvs
- */
Index: pace/drv/root/root/meson.build
===================================================================
--- uspace/drv/root/root/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Lenka Trochtova
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('root.c')
Index: pace/drv/root/root/root.c
===================================================================
--- uspace/drv/root/root/root.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup root
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <ctype.h>
-#include <macros.h>
-#include <inttypes.h>
-#include <sysinfo.h>
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-
-#define NAME "root"
-
-#define PLATFORM_FUN_NAME "hw"
-#define PLATFORM_FUN_MATCH_ID_FMT "platform/%s"
-#define PLATFORM_FUN_MATCH_SCORE 100
-
-#define VIRTUAL_FUN_NAME "virt"
-#define VIRTUAL_FUN_MATCH_ID "virt"
-#define VIRTUAL_FUN_MATCH_SCORE 100
-
-static errno_t root_dev_add(ddf_dev_t *dev);
-static errno_t root_fun_online(ddf_fun_t *fun);
-static errno_t root_fun_offline(ddf_fun_t *fun);
-
-/** The root device driver's standard operations. */
-static driver_ops_t root_ops = {
-	.dev_add = &root_dev_add,
-	.fun_online = &root_fun_online,
-	.fun_offline = &root_fun_offline
-};
-
-/** The root device driver structure. */
-static driver_t root_driver = {
-	.name = NAME,
-	.driver_ops = &root_ops
-};
-
-/** Create the function which represents the root of virtual device tree.
- *
- * @param dev	Device
- * @return	EOK on success or an error code
- */
-static errno_t add_virtual_root_fun(ddf_dev_t *dev)
-{
-	const char *name = VIRTUAL_FUN_NAME;
-	ddf_fun_t *fun;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Adding new function for virtual devices. "
-	    "Function node is `%s' (%d %s)", name,
-	    VIRTUAL_FUN_MATCH_SCORE, VIRTUAL_FUN_MATCH_ID);
-
-	fun = ddf_fun_create(dev, fun_inner, name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
-		return ENOMEM;
-	}
-
-	rc = ddf_fun_add_match_id(fun, VIRTUAL_FUN_MATCH_ID,
-	    VIRTUAL_FUN_MATCH_SCORE);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
-		    str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Create the function which represents the root of HW device tree.
- *
- * @param dev	Device
- * @return	EOK on success or an error code
- */
-static errno_t add_platform_fun(ddf_dev_t *dev)
-{
-	char *match_id;
-	char *platform;
-	size_t platform_size;
-
-	const char *name = PLATFORM_FUN_NAME;
-	ddf_fun_t *fun;
-	errno_t rc;
-
-	/* Get platform name from sysinfo. */
-	platform = sysinfo_get_data("platform", &platform_size);
-	if (platform == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to obtain platform name.");
-		return ENOENT;
-	}
-
-	/* Null-terminate string. */
-	char *tmp = realloc(platform, platform_size + 1);
-	if (tmp == NULL) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
-		free(platform);
-		return ENOMEM;
-	}
-	platform = tmp;
-	platform[platform_size] = '\0';
-
-	/* Construct match ID. */
-	if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) {
-		ddf_msg(LVL_ERROR, "Memory allocation failed.");
-		free(platform);
-		return ENOMEM;
-	}
-
-	free(platform);
-
-	/* Add function. */
-	ddf_msg(LVL_DEBUG, "Adding platform function. Function node is `%s' "
-	    " (%d %s)", PLATFORM_FUN_NAME, PLATFORM_FUN_MATCH_SCORE,
-	    match_id);
-
-	fun = ddf_fun_create(dev, fun_inner, name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Error creating function %s", name);
-		free(match_id);
-		return ENOMEM;
-	}
-
-	rc = ddf_fun_add_match_id(fun, match_id, PLATFORM_FUN_MATCH_SCORE);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
-		free(match_id);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	free(match_id);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
-		    str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Get the root device.
- *
- * @param dev		The device which is root of the whole device tree (both
- *			of HW and pseudo devices).
- */
-static errno_t root_dev_add(ddf_dev_t *dev)
-{
-	ddf_msg(LVL_DEBUG, "root_dev_add, device handle=%" PRIun,
-	    ddf_dev_get_handle(dev));
-
-	/*
-	 * Register virtual devices root.
-	 * We warn on error occurrence because virtual devices shall not be
-	 * vital for the system.
-	 */
-	errno_t res = add_virtual_root_fun(dev);
-	if (res != EOK)
-		ddf_msg(LVL_WARN, "Failed to add virtual child.");
-
-	/* Register root device's children. */
-	res = add_platform_fun(dev);
-	if (EOK != res)
-		ddf_msg(LVL_ERROR, "Failed adding child device for platform.");
-
-	return res;
-}
-
-static errno_t root_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "root_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t root_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "root_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS root device driver\n");
-
-	ddf_log_init(NAME);
-	return ddf_driver_main(&root_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/root/root/root.ma
===================================================================
--- uspace/drv/root/root/root.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 root
Index: pace/drv/root/virt/devices.def
===================================================================
--- uspace/drv/root/virt/devices.def	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Add list of virtual devices you want to launch driver for here.
- *
- * Unless the list is empty, the last item shall be followed by a comma.
- */
-
-/* Kernel framebuffer */
-{
-    .name = "kfb",
-    .match_id = "virtual&kfb"
-},
-
-#ifdef CONFIG_TEST_DRIVERS
-
-{
-	.name = "test1",
-	.match_id = "virtual&test1"
-},
-{
-	.name = "test2alpha",
-	.match_id = "virtual&test2"
-},
-{
-	.name = "test2bravo",
-	.match_id = "virtual&test2"
-},
-{
-	.name = "test3",
-	.match_id = "virtual&test3"
-},
-
-#endif
-
-#ifdef CONFIG_RUN_VIRTUAL_USB_HC
-
-/* Virtual USB host controller. */
-{
-	.name = "usbhc",
-	.match_id = "usb&hc=vhc"
-},
-
-#endif
Index: pace/drv/root/virt/doc/doxygroups.h
===================================================================
--- uspace/drv/root/virt/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup virt virt
- * @brief Root device driver for virtual devices
- * @ingroup drvs
- */
Index: pace/drv/root/virt/meson.build
===================================================================
--- uspace/drv/root/virt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('virt.c')
Index: pace/drv/root/virt/virt.c
===================================================================
--- uspace/drv/root/virt/virt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,246 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup virt
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-
-#define NAME "virt"
-
-/** Virtual function entry */
-typedef struct {
-	/** Function name */
-	const char *name;
-	/** Function match ID */
-	const char *match_id;
-} virtual_function_t;
-
-/** List of existing virtual functions */
-virtual_function_t virtual_functions[] = {
-#include "devices.def"
-	/* Terminating item */
-	{
-		.name = NULL,
-		.match_id = NULL
-	}
-};
-
-static errno_t virt_dev_add(ddf_dev_t *dev);
-static errno_t virt_dev_remove(ddf_dev_t *dev);
-static errno_t virt_fun_online(ddf_fun_t *fun);
-static errno_t virt_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t virt_ops = {
-	.dev_add = &virt_dev_add,
-	.dev_remove = &virt_dev_remove,
-	.fun_online = &virt_fun_online,
-	.fun_offline = &virt_fun_offline
-};
-
-static driver_t virt_driver = {
-	.name = NAME,
-	.driver_ops = &virt_ops
-};
-
-/* Device soft state */
-typedef struct {
-	ddf_dev_t *dev;
-	list_t functions;
-} virt_t;
-
-/* Function soft state */
-typedef struct {
-	ddf_fun_t *fun;
-	link_t dev_link;
-} virt_fun_t;
-
-static int instances = 0;
-
-/** Add function to the virtual device.
- *
- * @param vdev		The virtual device
- * @param vfun		Virtual function description
- * @return		EOK on success or an error code.
- */
-static errno_t virt_add_fun(virt_t *virt, virtual_function_t *vfun)
-{
-	ddf_dev_t *vdev = virt->dev;
-	ddf_fun_t *fun;
-	virt_fun_t *rvfun;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Registering function `%s' (match \"%s\")",
-	    vfun->name, vfun->match_id);
-
-	fun = ddf_fun_create(vdev, fun_inner, vfun->name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", vfun->name);
-		return ENOMEM;
-	}
-
-	rvfun = ddf_fun_data_alloc(fun, sizeof(virt_fun_t));
-	if (rvfun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state for %s.",
-		    vfun->name);
-		ddf_fun_destroy(fun);
-		return ENOMEM;
-	}
-
-	rvfun->fun = fun;
-
-	rc = ddf_fun_add_match_id(fun, vfun->match_id, 10);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    vfun->name);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s",
-		    vfun->name, str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	list_append(&rvfun->dev_link, &virt->functions);
-
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name);
-	return EOK;
-}
-
-static errno_t virt_fun_remove(virt_fun_t *rvfun)
-{
-	errno_t rc;
-	const char *name = ddf_fun_get_name(rvfun->fun);
-
-	ddf_msg(LVL_DEBUG, "virt_fun_remove('%s')", name);
-	rc = ddf_fun_offline(rvfun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", name);
-		return rc;
-	}
-
-	rc = ddf_fun_unbind(rvfun->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	list_remove(&rvfun->dev_link);
-	ddf_fun_destroy(rvfun->fun);
-	return EOK;
-}
-
-static errno_t virt_dev_add(ddf_dev_t *dev)
-{
-	virt_t *virt;
-
-	/*
-	 * Allow only single instance of root virtual device.
-	 */
-	if (++instances > 1) {
-		return ELIMIT;
-	}
-
-	ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)ddf_dev_get_handle(dev));
-
-	virt = ddf_dev_data_alloc(dev, sizeof(virt_t));
-	if (virt == NULL)
-		return ENOMEM;
-
-	virt->dev = dev;
-	list_initialize(&virt->functions);
-
-	/*
-	 * Go through all virtual functions and try to add them.
-	 * We silently ignore failures.
-	 */
-	virtual_function_t *vfun = virtual_functions;
-	while (vfun->name != NULL) {
-		(void) virt_add_fun(virt, vfun);
-		vfun++;
-	}
-
-	return EOK;
-}
-
-static errno_t virt_dev_remove(ddf_dev_t *dev)
-{
-	virt_t *virt = (virt_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	while (!list_empty(&virt->functions)) {
-		virt_fun_t *rvfun = list_get_instance(
-		    list_first(&virt->functions), virt_fun_t,
-		    dev_link);
-
-		rc = virt_fun_remove(rvfun);
-		if (rc != EOK)
-			return rc;
-	}
-
-	--instances;
-	return EOK;
-}
-
-static errno_t virt_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "virt_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t virt_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "virt_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS virtual devices root driver\n");
-
-	ddf_log_init(NAME);
-	return ddf_driver_main(&virt_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/root/virt/virt.ma
===================================================================
--- uspace/drv/root/virt/virt.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 virt
Index: pace/drv/test/test1/meson.build
===================================================================
--- uspace/drv/test/test1/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('test1.c')
Index: pace/drv/test/test1/test1.c
===================================================================
--- uspace/drv/test/test1/test1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,315 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <str.h>
-
-#include "test1.h"
-
-static errno_t test1_dev_add(ddf_dev_t *dev);
-static errno_t test1_dev_remove(ddf_dev_t *dev);
-static errno_t test1_dev_gone(ddf_dev_t *dev);
-static errno_t test1_fun_online(ddf_fun_t *fun);
-static errno_t test1_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = &test1_dev_add,
-	.dev_remove = &test1_dev_remove,
-	.dev_gone = &test1_dev_gone,
-	.fun_online = &test1_fun_online,
-	.fun_offline = &test1_fun_offline
-};
-
-static driver_t test1_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-typedef struct {
-	ddf_fun_t *fun_a;
-	ddf_fun_t *clone;
-	ddf_fun_t *child;
-} test1_t;
-
-/** Register child and inform user about it.
- *
- * @param parent Parent device.
- * @param message Message for the user.
- * @param name Device name.
- * @param match_id Device match id.
- * @param score Device match score.
- */
-static errno_t register_fun_verbose(ddf_dev_t *parent, const char *message,
-    const char *name, const char *match_id, int match_score,
-    errno_t expected_rc, ddf_fun_t **pfun)
-{
-	ddf_fun_t *fun = NULL;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
-
-	fun = ddf_fun_create(parent, fun_inner, name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
-		rc = ENOMEM;
-		goto leave;
-	}
-
-	rc = ddf_fun_add_match_id(fun, match_id, match_score);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
-		goto leave;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
-		    str_error(rc));
-		goto leave;
-	}
-
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
-	rc = EOK;
-
-leave:
-	if (rc != expected_rc) {
-		fprintf(stderr,
-		    NAME ": Unexpected error registering function `%s'.\n"
-		    NAME ":     Expected \"%s\" but got \"%s\".\n",
-		    name, str_error(expected_rc), str_error(rc));
-	}
-
-	if ((rc != EOK) && (fun != NULL)) {
-		ddf_fun_destroy(fun);
-	}
-
-	if (pfun != NULL)
-		*pfun = fun;
-
-	return rc;
-}
-
-/** Callback when new device is passed to this driver.
- * This function is the body of the test: it shall register new child
- * (named `clone') that shall be driven by the same task. When the clone
- * is added, it registers another child (named `child') that is also driven
- * by this task. The conditions ensure that we do not recurse indefinitely.
- * When successful, the device tree shall contain following fragment:
- *
- * /virtual/test1
- * /virtual/test1/clone
- * /virtual/test1/clone/child
- *
- * and the DDF shall not deadlock.
- *
- *
- * @param dev New device.
- * @return Error code reporting success of the operation.
- */
-static errno_t test1_dev_add(ddf_dev_t *dev)
-{
-	ddf_fun_t *fun_a;
-	test1_t *test1;
-	const char *dev_name;
-	errno_t rc;
-
-	dev_name = ddf_dev_get_name(dev);
-	ddf_msg(LVL_DEBUG, "dev_add(name=\"%s\", handle=%d)",
-	    dev_name, (int) ddf_dev_get_handle(dev));
-
-	test1 = ddf_dev_data_alloc(dev, sizeof(test1_t));
-	if (test1 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fun_a = ddf_fun_create(dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	test1->fun_a = fun_a;
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
-		ddf_fun_destroy(fun_a);
-		goto error;
-	}
-
-	rc = ddf_fun_add_to_category(fun_a, "virtual");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding function 'a' to category "
-		    "'virtual'.");
-		ddf_fun_unbind(fun_a);
-		ddf_fun_destroy(fun_a);
-		goto error;
-	}
-
-	if (str_cmp(dev_name, "test1") == 0) {
-		(void) register_fun_verbose(dev,
-		    "cloning myself ;-)", "clone",
-		    "virtual&test1", 10, EOK, &test1->clone);
-		(void) register_fun_verbose(dev,
-		    "cloning myself twice ;-)", "clone",
-		    "virtual&test1", 10, EEXIST, NULL);
-	} else if (str_cmp(dev_name, "clone") == 0) {
-		(void) register_fun_verbose(dev,
-		    "run by the same task", "child",
-		    "virtual&test1&child", 10, EOK, &test1->child);
-	}
-
-	ddf_msg(LVL_DEBUG, "Device `%s' accepted.", dev_name);
-	return EOK;
-error:
-	return rc;
-}
-
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
-	rc = ddf_fun_offline(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", name);
-		return rc;
-	}
-
-	rc = ddf_fun_unbind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	ddf_fun_destroy(fun);
-	return EOK;
-}
-
-static errno_t fun_unbind(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
-	rc = ddf_fun_unbind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	ddf_fun_destroy(fun);
-	return EOK;
-}
-
-static errno_t test1_dev_remove(ddf_dev_t *dev)
-{
-	test1_t *test1 = (test1_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
-
-	if (test1->fun_a != NULL) {
-		rc = fun_remove(test1->fun_a, "a");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test1->clone != NULL) {
-		rc = fun_remove(test1->clone, "clone");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test1->child != NULL) {
-		rc = fun_remove(test1->child, "child");
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t test1_dev_gone(ddf_dev_t *dev)
-{
-	test1_t *test1 = (test1_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "test1_dev_remove(%p)", dev);
-
-	if (test1->fun_a != NULL) {
-		rc = fun_unbind(test1->fun_a, "a");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test1->clone != NULL) {
-		rc = fun_unbind(test1->clone, "clone");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test1->child != NULL) {
-		rc = fun_unbind(test1->child, "child");
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t test1_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test1_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t test1_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test1_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS test1 virtual device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&test1_driver);
-}
Index: pace/drv/test/test1/test1.h
===================================================================
--- uspace/drv/test/test1/test1.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-#ifndef DRV_TEST1_TEST1_H_
-#define DRV_TEST1_TEST1_H_
-
-#include <ddf/driver.h>
-
-#define NAME "test1"
-
-#endif
Index: pace/drv/test/test1/test1.ma
===================================================================
--- uspace/drv/test/test1/test1.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 virtual&test1
-10 virtual&test1&child
Index: pace/drv/test/test2/meson.build
===================================================================
--- uspace/drv/test/test2/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('test2.c')
Index: pace/drv/test/test2/test2.c
===================================================================
--- uspace/drv/test/test2/test2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,321 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fibril.h>
-#include <str.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-
-#define NAME "test2"
-
-static errno_t test2_dev_add(ddf_dev_t *dev);
-static errno_t test2_dev_remove(ddf_dev_t *dev);
-static errno_t test2_dev_gone(ddf_dev_t *dev);
-static errno_t test2_fun_online(ddf_fun_t *fun);
-static errno_t test2_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = &test2_dev_add,
-	.dev_remove = &test2_dev_remove,
-	.dev_gone = &test2_dev_gone,
-	.fun_online = &test2_fun_online,
-	.fun_offline = &test2_fun_offline
-};
-
-static driver_t test2_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-/* Device soft state */
-typedef struct {
-	ddf_dev_t *dev;
-
-	ddf_fun_t *fun_a;
-	ddf_fun_t *fun_err;
-	ddf_fun_t *child;
-	ddf_fun_t *test1;
-} test2_t;
-
-/** Register child and inform user about it.
- *
- * @param parent Parent device.
- * @param message Message for the user.
- * @param name Device name.
- * @param match_id Device match id.
- * @param score Device match score.
- */
-static errno_t register_fun_verbose(ddf_dev_t *parent, const char *message,
-    const char *name, const char *match_id, int match_score, ddf_fun_t **pfun)
-{
-	ddf_fun_t *fun;
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "Registering function `%s': %s.", name, message);
-
-	fun = ddf_fun_create(parent, fun_inner, name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", name);
-		return ENOMEM;
-	}
-
-	rc = ddf_fun_add_match_id(fun, match_id, match_score);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s",
-		    name);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", name,
-		    str_error(rc));
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	*pfun = fun;
-
-	ddf_msg(LVL_NOTE, "Registered child device `%s'", name);
-	return EOK;
-}
-
-/** Simulate plugging and surprise unplugging.
- *
- * @param arg Parent device structure (ddf_dev_t *).
- * @return Always EOK.
- */
-static errno_t plug_unplug(void *arg)
-{
-	test2_t *test2 = (test2_t *) arg;
-	ddf_fun_t *fun_a;
-	errno_t rc;
-
-	fibril_usleep(1000);
-
-	(void) register_fun_verbose(test2->dev, "child driven by the same task",
-	    "child", "virtual&test2", 10, &test2->child);
-	(void) register_fun_verbose(test2->dev, "child driven by test1",
-	    "test1", "virtual&test1", 10, &test2->test1);
-
-	fun_a = ddf_fun_create(test2->dev, fun_exposed, "a");
-	if (fun_a == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function 'a'.");
-		return ENOMEM;
-	}
-
-	rc = ddf_fun_bind(fun_a);
-	if (rc != EOK) {
-		ddf_fun_destroy(fun_a);
-		ddf_msg(LVL_ERROR, "Failed binding function 'a'.");
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun_a, "virtual");
-	if (rc != EOK) {
-		ddf_fun_unbind(fun_a);
-		ddf_fun_destroy(fun_a);
-		ddf_msg(LVL_ERROR, "Failed adding function 'a' to category "
-		    "'virtual'.");
-		return rc;
-	}
-
-	test2->fun_a = fun_a;
-
-	fibril_usleep(10000000);
-
-	ddf_msg(LVL_NOTE, "Unbinding function test1.");
-	ddf_fun_unbind(test2->test1);
-	fibril_usleep(1000000);
-	ddf_msg(LVL_NOTE, "Unbinding function child.");
-	ddf_fun_unbind(test2->child);
-
-	return EOK;
-}
-
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
-	rc = ddf_fun_offline(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", name);
-		return rc;
-	}
-
-	rc = ddf_fun_unbind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	ddf_fun_destroy(fun);
-	return EOK;
-}
-
-static errno_t fun_unbind(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "fun_unbind(%p, '%s')", fun, name);
-	rc = ddf_fun_unbind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	ddf_fun_destroy(fun);
-	return EOK;
-}
-
-static errno_t test2_dev_add(ddf_dev_t *dev)
-{
-	test2_t *test2;
-	const char *dev_name = ddf_dev_get_name(dev);
-
-	ddf_msg(LVL_DEBUG, "test2_dev_add(name=\"%s\", handle=%d)",
-	    dev_name, (int) ddf_dev_get_handle(dev));
-
-	test2 = ddf_dev_data_alloc(dev, sizeof(test2_t));
-	if (test2 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	test2->dev = dev;
-
-	if (str_cmp(dev_name, "child") != 0) {
-		fid_t postpone = fibril_create(plug_unplug, test2);
-		if (postpone == 0) {
-			ddf_msg(LVL_ERROR, "fibril_create() failed.");
-			return ENOMEM;
-		}
-		fibril_add_ready(postpone);
-	} else {
-		(void) register_fun_verbose(dev, "child without available driver",
-		    "ERROR", "non-existent.match.id", 10, &test2->fun_err);
-	}
-
-	return EOK;
-}
-
-static errno_t test2_dev_remove(ddf_dev_t *dev)
-{
-	test2_t *test2 = (test2_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "test2_dev_remove(%p)", dev);
-
-	if (test2->fun_a != NULL) {
-		rc = fun_remove(test2->fun_a, "a");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->fun_err != NULL) {
-		rc = fun_remove(test2->fun_err, "ERROR");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->child != NULL) {
-		rc = fun_remove(test2->child, "child");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->test1 != NULL) {
-		rc = fun_remove(test2->test1, "test1");
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t test2_dev_gone(ddf_dev_t *dev)
-{
-	test2_t *test2 = (test2_t *)ddf_dev_data_get(dev);
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "test2_dev_gone(%p)", dev);
-
-	if (test2->fun_a != NULL) {
-		rc = fun_unbind(test2->fun_a, "a");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->fun_err != NULL) {
-		rc = fun_unbind(test2->fun_err, "ERROR");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->child != NULL) {
-		rc = fun_unbind(test2->child, "child");
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (test2->test1 != NULL) {
-		rc = fun_unbind(test2->test1, "test1");
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t test2_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test2_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t test2_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test2_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS test2 virtual device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&test2_driver);
-}
Index: pace/drv/test/test2/test2.ma
===================================================================
--- uspace/drv/test/test2/test2.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 virtual&test2
Index: pace/drv/test/test3/meson.build
===================================================================
--- uspace/drv/test/test3/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('test3.c')
Index: pace/drv/test/test3/test3.c
===================================================================
--- uspace/drv/test/test3/test3.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,205 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-
-#define NAME "test3"
-
-#define NUM_FUNCS 20
-
-static errno_t test3_dev_add(ddf_dev_t *dev);
-static errno_t test3_dev_remove(ddf_dev_t *dev);
-static errno_t test3_fun_online(ddf_fun_t *fun);
-static errno_t test3_fun_offline(ddf_fun_t *fun);
-
-static driver_ops_t driver_ops = {
-	.dev_add = &test3_dev_add,
-	.dev_remove = &test3_dev_remove,
-	.fun_online = &test3_fun_online,
-	.fun_offline = &test3_fun_offline,
-};
-
-static driver_t test3_driver = {
-	.name = NAME,
-	.driver_ops = &driver_ops
-};
-
-typedef struct {
-	ddf_dev_t *dev;
-	ddf_fun_t *fun[NUM_FUNCS];
-} test3_t;
-
-static errno_t register_fun_and_add_to_category(ddf_dev_t *parent,
-    const char *base_name, size_t index, const char *class_name,
-    ddf_fun_t **pfun)
-{
-	ddf_fun_t *fun = NULL;
-	errno_t rc;
-	char *fun_name = NULL;
-	bool bound = false;
-
-	if (asprintf(&fun_name, "%s%zu", base_name, index) < 0) {
-		ddf_msg(LVL_ERROR, "Failed to format string: No memory");
-		rc = ENOMEM;
-		goto leave;
-	}
-
-	fun = ddf_fun_create(parent, fun_exposed, fun_name);
-	if (fun == NULL) {
-		ddf_msg(LVL_ERROR, "Failed creating function %s", fun_name);
-		rc = ENOMEM;
-		goto leave;
-	}
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function %s: %s", fun_name,
-		    str_error(rc));
-		goto leave;
-	}
-
-	bound = true;
-
-	rc = ddf_fun_add_to_category(fun, class_name);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed addning function %s to category %s: "
-		    "%s", fun_name, class_name, str_error(rc));
-		goto leave;
-	}
-
-	ddf_msg(LVL_NOTE, "Registered exposed function `%s'.", fun_name);
-
-leave:
-	free(fun_name);
-
-	if (bound)
-		ddf_fun_unbind(fun);
-	if ((rc != EOK) && (fun != NULL)) {
-		ddf_fun_destroy(fun);
-	}
-
-	*pfun = fun;
-	return rc;
-}
-
-static errno_t fun_remove(ddf_fun_t *fun, const char *name)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "fun_remove(%p, '%s')", fun, name);
-	rc = ddf_fun_offline(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Error offlining function '%s'.", name);
-		return rc;
-	}
-
-	rc = ddf_fun_unbind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed unbinding function '%s'.", name);
-		return rc;
-	}
-
-	ddf_fun_destroy(fun);
-	return EOK;
-}
-
-static errno_t test3_dev_add(ddf_dev_t *dev)
-{
-	errno_t rc = EOK;
-	test3_t *test3;
-
-	ddf_msg(LVL_DEBUG, "dev_add(name=\"%s\", handle=%d)",
-	    ddf_dev_get_name(dev), (int) ddf_dev_get_handle(dev));
-
-	test3 = ddf_dev_data_alloc(dev, sizeof(test3_t));
-	if (test3 == NULL) {
-		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
-		return ENOMEM;
-	}
-
-	size_t i;
-	for (i = 0; i < NUM_FUNCS; i++) {
-		rc = register_fun_and_add_to_category(dev,
-		    "test3_", i, "test3", &test3->fun[i]);
-		if (rc != EOK) {
-			break;
-		}
-	}
-
-	return rc;
-}
-
-static errno_t test3_dev_remove(ddf_dev_t *dev)
-{
-	test3_t *test3 = (test3_t *)ddf_dev_data_get(dev);
-	char *fun_name;
-	errno_t rc;
-	size_t i;
-
-	for (i = 0; i < NUM_FUNCS; i++) {
-		if (asprintf(&fun_name, "test3_%zu", i) < 0) {
-			ddf_msg(LVL_ERROR, "Failed to format string: No memory");
-			return ENOMEM;
-		}
-
-		rc = fun_remove(test3->fun[i], fun_name);
-		if (rc != EOK)
-			return rc;
-
-		free(fun_name);
-	}
-
-	return EOK;
-}
-
-static errno_t test3_fun_online(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test3_fun_online()");
-	return ddf_fun_online(fun);
-}
-
-static errno_t test3_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "test3_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS test3 virtual device driver\n");
-	ddf_log_init(NAME);
-	return ddf_driver_main(&test3_driver);
-}
Index: pace/drv/test/test3/test3.ma
===================================================================
--- uspace/drv/test/test3/test3.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 virtual&test3
Index: pace/drv/time/cmos-rtc/cmos-regs.h
===================================================================
--- uspace/drv/time/cmos-rtc/cmos-regs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cmos-rtc
- * @{
- */
-
-#ifndef _CMOS_RTC_H_
-#define _CMOS_RTC_H_
-
-#define RTC_SEC           0x00
-#define RTC_MIN           0x02
-#define RTC_HOUR          0x04
-#define RTC_DAY           0x07
-#define RTC_MON           0x08
-#define RTC_YEAR          0x09
-
-#define RTC_STATUS_B      0x0B
-#define RTC_B_24H         0x02 /* 24h mode */
-#define RTC_B_BCD         0x04 /* BCD mode */
-#define RTC_B_INH         0x80 /* Inhibit updates */
-
-#define RTC_STATUS_D      0x0D
-#define RTC_D_BATTERY_OK  0x80 /* Battery status */
-
-#define RTC_STATUS_A      0x0A
-#define RTC_A_UPDATE      0x80 /* Update in progress */
-#define RTC_A_CLK_STOP    0x70 /* Stop the clock */
-
-#endif
-
-/**
- * @}
- */
Index: pace/drv/time/cmos-rtc/cmos-rtc.c
===================================================================
--- uspace/drv/time/cmos-rtc/cmos-rtc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,789 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup cmos-rtc
- * @{
- */
-
-/** @file
- */
-
-#include <errno.h>
-#include <ddi.h>
-#include <as.h>
-#include <barrier.h>
-#include <stdio.h>
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <ops/clock_dev.h>
-#include <ops/battery_dev.h>
-#include <fibril_synch.h>
-#include <device/hw_res.h>
-#include <macros.h>
-#include <time.h>
-
-#include "cmos-regs.h"
-
-#define NAME "cmos-rtc"
-
-#define REG_COUNT 2
-
-#define REG_SEL_PORT(port)  (port)
-#define REG_RW_PORT(port)   ((port) + 1)
-
-typedef struct rtc {
-	/** DDF device node */
-	ddf_dev_t *dev;
-	/** DDF function node */
-	ddf_fun_t *fun;
-	/** The fibril mutex for synchronizing the access to the device */
-	fibril_mutex_t mutex;
-	/** The base I/O address of the device registers */
-	ioport8_t *io_addr;
-	/** The I/O port used to access the CMOS registers */
-	ioport8_t *port;
-	/** true if device is removed */
-	bool removed;
-	/** number of connected clients */
-	int clients_connected;
-	/** time at which the system booted */
-	struct timespec boot_time;
-} rtc_t;
-
-static rtc_t *dev_rtc(ddf_dev_t *dev);
-static rtc_t *fun_rtc(ddf_fun_t *fun);
-static errno_t
-rtc_battery_status_get(ddf_fun_t *fun, battery_status_t *status);
-static errno_t  rtc_time_get(ddf_fun_t *fun, struct tm *t);
-static errno_t  rtc_time_set(ddf_fun_t *fun, struct tm *t);
-static errno_t  rtc_dev_add(ddf_dev_t *dev);
-static errno_t  rtc_dev_initialize(rtc_t *rtc);
-static bool rtc_pio_enable(rtc_t *rtc);
-static void rtc_dev_cleanup(rtc_t *rtc);
-static errno_t  rtc_open(ddf_fun_t *fun);
-static void rtc_close(ddf_fun_t *fun);
-static bool rtc_update_in_progress(rtc_t *rtc);
-static int  rtc_register_read(rtc_t *rtc, int reg);
-static unsigned bcd2bin(unsigned bcd);
-static unsigned bin2bcd(unsigned binary);
-static errno_t rtc_dev_remove(ddf_dev_t *dev);
-static void rtc_register_write(rtc_t *rtc, int reg, int data);
-static bool is_battery_ok(rtc_t *rtc);
-static errno_t  rtc_fun_online(ddf_fun_t *fun);
-static errno_t  rtc_fun_offline(ddf_fun_t *fun);
-
-static ddf_dev_ops_t rtc_dev_ops;
-
-/** The RTC device driver's standard operations */
-static driver_ops_t rtc_ops = {
-	.dev_add = rtc_dev_add,
-	.dev_remove = rtc_dev_remove,
-	.fun_online = rtc_fun_online,
-	.fun_offline = rtc_fun_offline,
-};
-
-/** The RTC device driver structure */
-static driver_t rtc_driver = {
-	.name = NAME,
-	.driver_ops = &rtc_ops,
-};
-
-/** Clock interface */
-static clock_dev_ops_t rtc_clock_dev_ops = {
-	.time_get = rtc_time_get,
-	.time_set = rtc_time_set,
-};
-
-/** Battery powered device interface */
-static battery_dev_ops_t rtc_battery_dev_ops = {
-	.battery_status_get = rtc_battery_status_get,
-	.battery_charge_level_get = NULL,
-};
-
-/** Obtain soft state structure from device node */
-static rtc_t *
-dev_rtc(ddf_dev_t *dev)
-{
-	return ddf_dev_data_get(dev);
-}
-
-/** Obtain soft state structure from function node */
-static rtc_t *
-fun_rtc(ddf_fun_t *fun)
-{
-	return dev_rtc(ddf_fun_get_dev(fun));
-}
-
-/** Initialize the RTC driver */
-static void
-rtc_init(void)
-{
-	ddf_log_init(NAME);
-
-	rtc_dev_ops.open = rtc_open;
-	rtc_dev_ops.close = rtc_close;
-
-	rtc_dev_ops.interfaces[CLOCK_DEV_IFACE] = &rtc_clock_dev_ops;
-	rtc_dev_ops.interfaces[BATTERY_DEV_IFACE] = &rtc_battery_dev_ops;
-	rtc_dev_ops.default_handler = NULL;
-}
-
-/** Clean up the RTC soft state
- *
- * @param rtc  The RTC device
- */
-static void
-rtc_dev_cleanup(rtc_t *rtc)
-{
-}
-
-/** Enable the I/O ports of the device
- *
- * @param rtc  The real time clock device
- *
- * @return  true in case of success, false otherwise
- */
-static bool
-rtc_pio_enable(rtc_t *rtc)
-{
-	if (pio_enable((void *) rtc->io_addr, REG_COUNT,
-	    (void **) &rtc->port)) {
-
-		ddf_msg(LVL_ERROR, "Cannot map the port %lx"
-		    " for device %s", (long unsigned int)rtc->io_addr,
-		    ddf_dev_get_name(rtc->dev));
-		return false;
-	}
-
-	return true;
-}
-
-/** Initialize the RTC device
- *
- * @param rtc  Pointer to the RTC device
- *
- * @return  EOK on success or an error code
- */
-static errno_t
-rtc_dev_initialize(rtc_t *rtc)
-{
-	errno_t rc;
-	size_t i;
-	hw_resource_t *res;
-	bool ioport = false;
-	async_sess_t *parent_sess;
-
-	ddf_msg(LVL_DEBUG, "rtc_dev_initialize %s", ddf_dev_get_name(rtc->dev));
-
-	rtc->boot_time.tv_sec = 0;
-	rtc->boot_time.tv_nsec = 0;
-	rtc->clients_connected = 0;
-
-	hw_resource_list_t hw_resources;
-	memset(&hw_resources, 0, sizeof(hw_resource_list_t));
-
-	/* Connect to the parent's driver */
-
-	parent_sess = ddf_dev_parent_sess_get(rtc->dev);
-	if (parent_sess == NULL) {
-		ddf_msg(LVL_ERROR, "Failed to connect to parent driver\
-		    of device %s.", ddf_dev_get_name(rtc->dev));
-		rc = ENOENT;
-		goto error;
-	}
-
-	/* Get the HW resources */
-	rc = hw_res_get_resource_list(parent_sess, &hw_resources);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to get HW resources\
-		    for device %s", ddf_dev_get_name(rtc->dev));
-		goto error;
-	}
-
-	for (i = 0; i < hw_resources.count; ++i) {
-		res = &hw_resources.resources[i];
-
-		if (res->res.io_range.size < REG_COUNT) {
-			ddf_msg(LVL_ERROR, "I/O range assigned to \
-			    device %s is too small",
-			    ddf_dev_get_name(rtc->dev));
-			rc = ELIMIT;
-			continue;
-		}
-
-		rtc->io_addr = (ioport8_t *) (long) res->res.io_range.address;
-		ioport = true;
-		ddf_msg(LVL_NOTE, "Device %s was assigned I/O address "
-		    "0x%lx", ddf_dev_get_name(rtc->dev),
-		    (unsigned long int) rtc->io_addr);
-		rc = EOK;
-		break;
-	}
-
-	if (rc != EOK)
-		goto error;
-
-	if (!ioport) {
-		/* No I/O address assigned to this device */
-		ddf_msg(LVL_ERROR, "Missing HW resource for device %s",
-		    ddf_dev_get_name(rtc->dev));
-		rc = ENOENT;
-		goto error;
-	}
-
-	hw_res_clean_resource_list(&hw_resources);
-
-	return EOK;
-
-error:
-	rtc_dev_cleanup(rtc);
-	hw_res_clean_resource_list(&hw_resources);
-
-	return rc;
-}
-
-/** Read a register from the CMOS memory
- *
- * @param rtc    The rtc device
- * @param reg    The index of the register to read
- *
- * @return       The value of the register
- */
-static int
-rtc_register_read(rtc_t *rtc, int reg)
-{
-	pio_write_8(REG_SEL_PORT(rtc->port), reg);
-	return pio_read_8(REG_RW_PORT(rtc->port));
-}
-
-/** Write a register to the CMOS memory
- *
- * @param rtc    The rtc device
- * @param reg    The index of the register to write
- * @param data   The data to write
- */
-static void
-rtc_register_write(rtc_t *rtc, int reg, int data)
-{
-	pio_write_8(REG_SEL_PORT(rtc->port), reg);
-	pio_write_8(REG_RW_PORT(rtc->port), data);
-}
-
-/** Check if an update is in progress
- *
- * @param rtc  The rtc device
- *
- * @return  true if an update is in progress, false otherwise
- */
-static bool
-rtc_update_in_progress(rtc_t *rtc)
-{
-	return rtc_register_read(rtc, RTC_STATUS_A) & RTC_A_UPDATE;
-}
-
-/** Read the current time from the CMOS
- *
- * @param fun  The RTC function
- * @param t    Pointer to the time variable
- *
- * @return  EOK on success or an error code
- */
-static errno_t
-rtc_time_get(ddf_fun_t *fun, struct tm *t)
-{
-	bool bcd_mode;
-	bool pm_mode = false;
-	rtc_t *rtc = fun_rtc(fun);
-
-	fibril_mutex_lock(&rtc->mutex);
-
-	if (rtc->boot_time.tv_sec) {
-		/*
-		 * There is no need to read the current time from the
-		 * device because it has already been cached.
-		 */
-
-		struct timespec curtime;
-
-		getuptime(&curtime);
-		ts_add(&curtime, &rtc->boot_time);
-		fibril_mutex_unlock(&rtc->mutex);
-
-		return time_ts2tm(&curtime, t);
-	}
-
-	/* Check if the RTC battery is OK */
-	if (!is_battery_ok(rtc)) {
-		fibril_mutex_unlock(&rtc->mutex);
-		return EIO;
-	}
-
-	/* Nanoseconds are below RTC's resolution, assume 0. */
-	t->tm_nsec = 0;
-
-	/* now read the registers */
-	do {
-		/* Suspend until the update process has finished */
-		while (rtc_update_in_progress(rtc))
-			;
-
-		t->tm_sec = rtc_register_read(rtc, RTC_SEC);
-		t->tm_min = rtc_register_read(rtc, RTC_MIN);
-		t->tm_hour = rtc_register_read(rtc, RTC_HOUR);
-		t->tm_mday = rtc_register_read(rtc, RTC_DAY);
-		t->tm_mon = rtc_register_read(rtc, RTC_MON);
-		t->tm_year = rtc_register_read(rtc, RTC_YEAR);
-
-		/* Now check if it is stable */
-	} while (t->tm_sec != rtc_register_read(rtc, RTC_SEC) ||
-	    t->tm_min != rtc_register_read(rtc, RTC_MIN) ||
-	    t->tm_mday != rtc_register_read(rtc, RTC_DAY) ||
-	    t->tm_mon != rtc_register_read(rtc, RTC_MON) ||
-	    t->tm_year != rtc_register_read(rtc, RTC_YEAR));
-
-	/* Check if the RTC is working in 12h mode */
-	bool _12h_mode = !(rtc_register_read(rtc, RTC_STATUS_B) &
-	    RTC_B_24H);
-	if (_12h_mode) {
-		/* The RTC is working in 12h mode, check if it is AM or PM */
-		if (t->tm_hour & 0x80) {
-			/* PM flag is active, it must be cleared */
-			t->tm_hour &= ~0x80;
-			pm_mode = true;
-		}
-	}
-
-	/* Check if the RTC is working in BCD mode */
-	bcd_mode = !(rtc_register_read(rtc, RTC_STATUS_B) & RTC_B_BCD);
-	if (bcd_mode) {
-		t->tm_sec = bcd2bin(t->tm_sec);
-		t->tm_min = bcd2bin(t->tm_min);
-		t->tm_hour = bcd2bin(t->tm_hour);
-		t->tm_mday = bcd2bin(t->tm_mday);
-		t->tm_mon = bcd2bin(t->tm_mon);
-		t->tm_year = bcd2bin(t->tm_year);
-	}
-
-	if (_12h_mode) {
-		/* Convert to 24h mode */
-		if (pm_mode) {
-			if (t->tm_hour < 12)
-				t->tm_hour += 12;
-		} else if (t->tm_hour == 12)
-			t->tm_hour = 0;
-	}
-
-	/* Count the months starting from 0, not from 1 */
-	t->tm_mon--;
-
-	if (t->tm_year < 100) {
-		/*
-		 * tm_year is the number of years since 1900 but the
-		 * RTC epoch is 2000.
-		 */
-		t->tm_year += 100;
-	}
-
-	/* Try to normalize the content of the tm structure */
-	time_t r = mktime(t);
-	errno_t result;
-
-	if (r < 0)
-		result = EINVAL;
-	else {
-		struct timespec uptime;
-
-		getuptime(&uptime);
-		rtc->boot_time.tv_sec = r;
-		rtc->boot_time.tv_nsec = t->tm_nsec;	/* normalized */
-		ts_sub(&rtc->boot_time, &uptime);
-		result = EOK;
-	}
-
-	fibril_mutex_unlock(&rtc->mutex);
-
-	return result;
-}
-
-/** Set the time in the RTC
- *
- * @param fun  The RTC function
- * @param t    The time value to set
- *
- * @return  EOK or an error code
- */
-static errno_t
-rtc_time_set(ddf_fun_t *fun, struct tm *t)
-{
-	bool bcd_mode;
-	time_t norm_time;
-	struct timespec uptime;
-	struct timespec ntv;
-	int  reg_b;
-	int  reg_a;
-	int  epoch;
-	rtc_t *rtc = fun_rtc(fun);
-
-	/* Try to normalize the content of the tm structure */
-	if ((norm_time = mktime(t)) < 0)
-		return EINVAL;
-
-	ntv.tv_sec = norm_time;
-	ntv.tv_nsec = t->tm_nsec;
-	getuptime(&uptime);
-
-	if (ts_gteq(&uptime, &ntv)) {
-		/* This is not acceptable */
-		return EINVAL;
-	}
-
-	fibril_mutex_lock(&rtc->mutex);
-
-	if (!is_battery_ok(rtc)) {
-		fibril_mutex_unlock(&rtc->mutex);
-		return EIO;
-	}
-
-	/* boot_time must be recomputed */
-	rtc->boot_time.tv_sec = 0;
-	rtc->boot_time.tv_nsec = 0;
-
-	/* Detect the RTC epoch */
-	if (rtc_register_read(rtc, RTC_YEAR) < 100)
-		epoch = 2000;
-	else
-		epoch = 1900;
-
-	if (epoch == 2000 && t->tm_year < 100) {
-		/* Can't set a year before the epoch */
-		fibril_mutex_unlock(&rtc->mutex);
-		return EINVAL;
-	}
-
-	t->tm_mon++; /* counts from 1, not from 0 */
-
-	reg_b = rtc_register_read(rtc, RTC_STATUS_B);
-
-	if (!(reg_b & RTC_B_24H)) {
-		/* Force 24h mode of operation */
-		reg_b |= RTC_B_24H;
-		rtc_register_write(rtc, RTC_STATUS_B, reg_b);
-	}
-
-	if (epoch == 2000) {
-		/*
-		 * The RTC epoch is year 2000  but the tm_year
-		 * field counts years since 1900.
-		 */
-		t->tm_year -= 100;
-	}
-
-	/* Check if the rtc is working in bcd mode */
-	bcd_mode = !(reg_b & RTC_B_BCD);
-	if (bcd_mode) {
-		/* Convert the tm struct fields in BCD mode */
-		t->tm_sec  = bin2bcd(t->tm_sec);
-		t->tm_min  = bin2bcd(t->tm_min);
-		t->tm_hour = bin2bcd(t->tm_hour);
-		t->tm_mday = bin2bcd(t->tm_mday);
-		t->tm_mon  = bin2bcd(t->tm_mon);
-		t->tm_year = bin2bcd(t->tm_year);
-	}
-
-	/* Inhibit updates */
-	rtc_register_write(rtc, RTC_STATUS_B, reg_b | RTC_B_INH);
-
-	/* Write current time to RTC */
-	rtc_register_write(rtc, RTC_SEC, t->tm_sec);
-	rtc_register_write(rtc, RTC_MIN, t->tm_min);
-	rtc_register_write(rtc, RTC_HOUR, t->tm_hour);
-	rtc_register_write(rtc, RTC_DAY, t->tm_mday);
-	rtc_register_write(rtc, RTC_MON, t->tm_mon);
-	rtc_register_write(rtc, RTC_YEAR, t->tm_year);
-
-	/* Stop the clock */
-	reg_a = rtc_register_read(rtc, RTC_STATUS_A);
-	rtc_register_write(rtc, RTC_STATUS_A, RTC_A_CLK_STOP | reg_a);
-
-	/* Enable updates */
-	rtc_register_write(rtc, RTC_STATUS_B, reg_b);
-	rtc_register_write(rtc, RTC_STATUS_A, reg_a);
-
-	fibril_mutex_unlock(&rtc->mutex);
-
-	return EOK;
-}
-
-/** Get the status of the real time clock battery
- *
- * @param fun    The RTC function
- * @param status The status of the battery
- *
- * @return       EOK on success or an error code
- */
-static errno_t
-rtc_battery_status_get(ddf_fun_t *fun, battery_status_t *status)
-{
-	rtc_t *rtc = fun_rtc(fun);
-
-	fibril_mutex_lock(&rtc->mutex);
-	const bool batt_ok = is_battery_ok(rtc);
-	fibril_mutex_unlock(&rtc->mutex);
-
-	*status = batt_ok ? BATTERY_OK : BATTERY_LOW;
-
-	return EOK;
-}
-
-/** Check if the battery is working properly or not.
- *  The caller already holds the rtc->mutex lock.
- *
- *  @param rtc   The RTC instance.
- *
- *  @return      true if the battery is ok, false otherwise.
- */
-static bool
-is_battery_ok(rtc_t *rtc)
-{
-	return rtc_register_read(rtc, RTC_STATUS_D) & RTC_D_BATTERY_OK;
-}
-
-/** The dev_add callback of the rtc driver
- *
- * @param dev  The RTC device
- *
- * @return  EOK on success or an error code
- */
-static errno_t
-rtc_dev_add(ddf_dev_t *dev)
-{
-	rtc_t *rtc;
-	ddf_fun_t *fun = NULL;
-	errno_t rc;
-	bool need_cleanup = false;
-	bool bound = false;
-
-	ddf_msg(LVL_DEBUG, "rtc_dev_add %s (handle = %d)",
-	    ddf_dev_get_name(dev), (int) ddf_dev_get_handle(dev));
-
-	rtc = ddf_dev_data_alloc(dev, sizeof(rtc_t));
-	if (!rtc)
-		return ENOMEM;
-
-	rtc->dev = dev;
-	fibril_mutex_initialize(&rtc->mutex);
-
-	rc = rtc_dev_initialize(rtc);
-	if (rc != EOK)
-		goto error;
-
-	need_cleanup = true;
-
-	if (!rtc_pio_enable(rtc)) {
-		rc = EADDRNOTAVAIL;
-		goto error;
-	}
-
-	fun = ddf_fun_create(dev, fun_exposed, "a");
-	if (!fun) {
-		ddf_msg(LVL_ERROR, "Failed creating function");
-		rc = ENOENT;
-		goto error;
-	}
-
-	ddf_fun_set_ops(fun, &rtc_dev_ops);
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed binding function");
-		goto error;
-	}
-
-	bound = true;
-	rtc->fun = fun;
-
-	rc = ddf_fun_add_to_category(fun, "clock");
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed adding service to clock category.");
-		goto error;
-	}
-
-	ddf_msg(LVL_NOTE, "Device %s successfully initialized",
-	    ddf_dev_get_name(dev));
-
-	return rc;
-
-error:
-	if (bound)
-		ddf_fun_unbind(fun);
-	if (fun)
-		ddf_fun_destroy(fun);
-	if (need_cleanup)
-		rtc_dev_cleanup(rtc);
-	return rc;
-}
-
-/** The dev_remove callback for the rtc driver
- *
- * @param dev   The RTC device
- *
- * @return      EOK on success or an error code
- */
-static errno_t
-rtc_dev_remove(ddf_dev_t *dev)
-{
-	rtc_t *rtc = dev_rtc(dev);
-	errno_t rc;
-
-	fibril_mutex_lock(&rtc->mutex);
-	if (rtc->clients_connected > 0) {
-		fibril_mutex_unlock(&rtc->mutex);
-		return EBUSY;
-	}
-
-	rtc->removed = true;
-	fibril_mutex_unlock(&rtc->mutex);
-
-	rc = rtc_fun_offline(rtc->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to offline function");
-		return rc;
-	}
-
-	rc = ddf_fun_unbind(rtc->fun);
-	if (rc != EOK) {
-		ddf_msg(LVL_ERROR, "Failed to unbind function");
-		return rc;
-	}
-
-	ddf_fun_destroy(rtc->fun);
-	rtc_dev_cleanup(rtc);
-
-	return rc;
-}
-
-/** Open the device
- *
- * @param fun   The function node
- *
- * @return  EOK on success or an error code
- */
-static errno_t
-rtc_open(ddf_fun_t *fun)
-{
-	errno_t rc;
-	rtc_t *rtc = fun_rtc(fun);
-
-	fibril_mutex_lock(&rtc->mutex);
-
-	if (rtc->removed)
-		rc = ENXIO;
-	else {
-		rc = EOK;
-		rtc->clients_connected++;
-	}
-
-	fibril_mutex_unlock(&rtc->mutex);
-	return rc;
-}
-
-/** Close the device
- *
- * @param fun  The function node
- */
-static void
-rtc_close(ddf_fun_t *fun)
-{
-	rtc_t *rtc = fun_rtc(fun);
-
-	fibril_mutex_lock(&rtc->mutex);
-
-	rtc->clients_connected--;
-	assert(rtc->clients_connected >= 0);
-
-	fibril_mutex_unlock(&rtc->mutex);
-}
-
-/** Convert from BCD mode to binary mode
- *
- * @param bcd   The number in BCD format to convert
- *
- * @return      The converted value
- */
-static unsigned
-bcd2bin(unsigned bcd)
-{
-	return ((bcd & 0xF0) >> 1) + ((bcd & 0xF0) >> 3) + (bcd & 0xf);
-}
-
-/** Convert from binary mode to BCD mode
- *
- * @param bcd   The number in binary mode to convert
- *
- * @return      The converted value
- */
-static unsigned
-bin2bcd(unsigned binary)
-{
-	return ((binary / 10) << 4) + (binary % 10);
-}
-
-static errno_t
-rtc_fun_online(ddf_fun_t *fun)
-{
-	errno_t rc;
-
-	ddf_msg(LVL_DEBUG, "rtc_fun_online()");
-
-	rc = ddf_fun_online(fun);
-	if (rc == EOK) {
-		// XXX This should be probably handled by the framework
-		rc = ddf_fun_add_to_category(fun, "clock");
-	}
-
-	return rc;
-}
-
-static errno_t
-rtc_fun_offline(ddf_fun_t *fun)
-{
-	ddf_msg(LVL_DEBUG, "rtc_fun_offline()");
-	return ddf_fun_offline(fun);
-}
-
-int
-main(int argc, char **argv)
-{
-	printf(NAME ": HelenOS RTC driver\n");
-	rtc_init();
-	return ddf_driver_main(&rtc_driver);
-}
-
-/**
- * @}
- */
Index: pace/drv/time/cmos-rtc/cmos-rtc.ma
===================================================================
--- uspace/drv/time/cmos-rtc/cmos-rtc.ma	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-100 isa/cmos-rtc
Index: pace/drv/time/cmos-rtc/doc/doxygroups.h
===================================================================
--- uspace/drv/time/cmos-rtc/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup cmos-rtc cmos-rtc
- * @brief CMOS RTC driver
- * @ingroup drvs
- */
Index: pace/drv/time/cmos-rtc/meson.build
===================================================================
--- uspace/drv/time/cmos-rtc/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2012 Maurizio Lombardi
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('cmos-rtc.c')
Index: pace/lib/ata/doc/doxygroups.h
===================================================================
--- uspace/lib/ata/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libata libata
- * @ingroup libs
- */
Index: pace/lib/ata/include/ata/ata.h
===================================================================
--- uspace/lib/ata/include/ata/ata.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,210 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libata
- * @{
- */
-/** @file ATA driver library definitions.
- */
-
-#ifndef LIBATA_ATA_H
-#define LIBATA_ATA_H
-
-#include <async.h>
-#include <bd_srv.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <str.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "ata_hw.h"
-
-struct ata_device;
-
-/** ATA DMA direction */
-typedef enum {
-	/** DMA read */
-	ata_dma_read,
-	/** DMA write */
-	ata_dma_write
-} ata_dma_dir_t;
-
-/** ATA channel creation parameters */
-typedef struct {
-	/** Argument to callback functions */
-	void *arg;
-	/** IRQ is available */
-	bool have_irq;
-	/** Use DMA transfers */
-	bool use_dma;
-	/** Maximum number of bytes that we can DMA in one I/O operation */
-	size_t max_dma_xfer;
-	/** Read 16 bits from the data port */
-	void (*write_data_16)(void *, uint16_t *, size_t);
-	/** Write 16 bits to the data port */
-	void (*read_data_16)(void *, uint16_t *, size_t);
-	/** Read 8 bits from an 8-bit command register */
-	void (*write_cmd_8)(void *, uint16_t, uint8_t);
-	/** Writes 8 bits to an 8-bit command register */
-	uint8_t (*read_cmd_8)(void *, uint16_t);
-	/** Read 8 bits from a control register */
-	void (*write_ctl_8)(void *, uint16_t, uint8_t);
-	/** Write 8 bits to a control register */
-	uint8_t (*read_ctl_8)(void *, uint16_t);
-	/** Enable interrupts */
-	errno_t (*irq_enable)(void *);
-	/** Disable interrupts */
-	errno_t (*irq_disable)(void *);
-	/** Set up DMA channel */
-	void (*dma_chan_setup)(void *, void *, size_t, ata_dma_dir_t);
-	/** Set up DMA channel */
-	void (*dma_chan_teardown)(void *);
-	/** Add new device */
-	errno_t (*add_device)(void *, unsigned, void *);
-	/** Remove device */
-	errno_t (*remove_device)(void *, unsigned);
-	/** Log notice message */
-	void (*msg_note)(void *, char *);
-	/** Log error message */
-	void (*msg_error)(void *, char *);
-	/** Log warning message */
-	void (*msg_warn)(void *, char *);
-	/** Log debug message */
-	void (*msg_debug)(void *, char *);
-} ata_params_t;
-
-/** Timeout definitions. Unit is 10 ms. */
-enum ata_timeout {
-	TIMEOUT_PROBE	=  100, /*  1 s */
-	TIMEOUT_BSY	=  100, /*  1 s */
-	TIMEOUT_DRDY	= 1000  /* 10 s */
-};
-
-enum ata_dev_type {
-	ata_reg_dev,	/* Register device (no packet feature set support) */
-	ata_pkt_dev	/* Packet device (supports packet feature set). */
-};
-
-/** Register device block addressing mode. */
-enum rd_addr_mode {
-	am_chs,		/**< CHS block addressing */
-	am_lba28,	/**< LBA-28 block addressing */
-	am_lba48	/**< LBA-48 block addressing */
-};
-
-/** Block coordinates */
-typedef struct {
-	enum rd_addr_mode amode;
-
-	union {
-		/** CHS coordinates */
-		struct {
-			uint8_t sector;
-			uint8_t cyl_lo;
-			uint8_t cyl_hi;
-		};
-		/** LBA coordinates */
-		struct {
-			uint8_t c0;
-			uint8_t c1;
-			uint8_t c2;
-			uint8_t c3;
-			uint8_t c4;
-			uint8_t c5;
-		};
-	};
-
-	/** Lower 4 bits for device/head register */
-	uint8_t h;
-} block_coord_t;
-
-/** ATA device state structure. */
-typedef struct ata_device {
-	bool present;
-	struct ata_channel *chan;
-
-	/** Device type */
-	enum ata_dev_type dev_type;
-
-	/** Addressing mode to use (if register device) */
-	enum rd_addr_mode amode;
-
-	/*
-	 * Geometry. Only valid if operating in CHS mode.
-	 */
-	struct {
-		unsigned heads;
-		unsigned cylinders;
-		unsigned sectors;
-	} geom;
-
-	uint64_t blocks;
-	size_t block_size;
-
-	char model[STR_BOUNDS(40) + 1];
-
-	int device_id;
-	bd_srvs_t bds;
-} ata_device_t;
-
-/** ATA channel */
-typedef struct ata_channel {
-	/** Parameters */
-	ata_params_t params;
-
-	/** Command registers */
-	ata_cmd_t *cmd;
-	/** Control registers */
-	ata_ctl_t *ctl;
-
-	/** Per-device state. */
-	ata_device_t device[MAX_DEVICES];
-
-	/** Synchronize channel access */
-	fibril_mutex_t lock;
-	/** Synchronize access to irq_fired/irq_status */
-	fibril_mutex_t irq_lock;
-	/** Signalled by IRQ handler */
-	fibril_condvar_t irq_cv;
-	/** Set to true when interrupt occurs */
-	bool irq_fired;
-	/** Value of status register read by interrupt handler */
-	uint8_t irq_status;
-} ata_channel_t;
-
-extern errno_t ata_channel_create(ata_params_t *, ata_channel_t **);
-extern errno_t ata_channel_initialize(ata_channel_t *);
-extern errno_t ata_channel_destroy(ata_channel_t *);
-extern void ata_channel_quiesce(ata_channel_t *);
-extern void ata_channel_irq(ata_channel_t *, uint8_t);
-extern void ata_connection(ipc_call_t *, ata_device_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ata/include/ata/ata_hw.h
===================================================================
--- uspace/lib/ata/include/ata/ata_hw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,273 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libata
- * @{
- */
-/** @file ATA hardware protocol (registers, data structures).
- */
-
-#ifndef LIBATA_ATA_HW_H
-#define LIBATA_ATA_HW_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-enum {
-	CTL_READ_START  = 0,
-	CTL_WRITE_START = 1,
-};
-
-enum {
-	STATUS_FAILURE = 0
-};
-
-enum {
-	MAX_DEVICES	= 2
-};
-
-/** ATA Command Register Block. */
-typedef union {
-	/* Read/Write */
-	struct {
-		uint16_t data_port;
-		uint8_t sector_count;
-		uint8_t sector_number;
-		uint8_t cylinder_low;
-		uint8_t cylinder_high;
-		uint8_t drive_head;
-		uint8_t pad_rw0;
-	};
-
-	/* Read Only */
-	struct {
-		uint8_t pad_ro0;
-		uint8_t error;
-		uint8_t pad_ro1[5];
-		uint8_t status;
-	};
-
-	/* Write Only */
-	struct {
-		uint8_t pad_wo0;
-		uint8_t features;
-		uint8_t pad_wo1[5];
-		uint8_t command;
-	};
-} ata_cmd_t;
-
-typedef union {
-	/* Read */
-	struct {
-		uint8_t pad0[6];
-		uint8_t alt_status;
-		uint8_t drive_address;
-	};
-
-	/* Write */
-	struct {
-		uint8_t pad1[6];
-		uint8_t device_control;
-		uint8_t pad2;
-	};
-} ata_ctl_t;
-
-#define REG_SECTOR_COUNT offsetof(ata_cmd_t, sector_count)
-#define REG_SECTOR_NUMBER offsetof(ata_cmd_t, sector_number)
-#define REG_CYLINDER_LOW offsetof(ata_cmd_t, cylinder_low)
-#define REG_CYLINDER_HIGH offsetof(ata_cmd_t, cylinder_high)
-#define REG_DRIVE_HEAD offsetof(ata_cmd_t, drive_head)
-#define REG_STATUS offsetof(ata_cmd_t, status)
-#define REG_COMMAND offsetof(ata_cmd_t, command)
-#define REG_FEATURES offsetof(ata_cmd_t, features)
-#define REG_DEVCTL offsetof(ata_ctl_t, device_control)
-
-enum devctl_bits {
-	DCR_SRST	= 0x04, /**< Software Reset */
-	DCR_nIEN	= 0x02  /**< Interrupt Enable (negated) */
-};
-
-enum status_bits {
-	SR_BSY		= 0x80, /**< Busy */
-	SR_DRDY		= 0x40, /**< Drive Ready */
-	SR_DWF		= 0x20, /**< Drive Write Fault */
-	SR_DSC		= 0x10, /**< Drive Seek Complete */
-	SR_DRQ		= 0x08, /**< Data Request */
-	SR_CORR		= 0x04, /**< Corrected Data */
-	SR_IDX		= 0x02, /**< Index */
-	SR_ERR		= 0x01  /**< Error */
-};
-
-enum drive_head_bits {
-	DHR_LBA		= 0x40,	/**< Use LBA addressing mode */
-	DHR_DRV		= 0x10	/**< Select device 1 */
-};
-
-enum error_bits {
-	ER_BBK		= 0x80, /**< Bad Block Detected */
-	ER_UNC		= 0x40, /**< Uncorrectable Data Error */
-	ER_MC		= 0x20, /**< Media Changed */
-	ER_IDNF		= 0x10, /**< ID Not Found */
-	ER_MCR		= 0x08, /**< Media Change Request */
-	ER_ABRT		= 0x04, /**< Aborted Command */
-	ER_TK0NF	= 0x02, /**< Track 0 Not Found */
-	ER_AMNF		= 0x01  /**< Address Mark Not Found */
-};
-
-enum ata_command {
-	CMD_READ_SECTORS	= 0x20,
-	CMD_READ_SECTORS_EXT	= 0x24,
-	CMD_READ_DMA_EXT	= 0x25,
-	CMD_WRITE_SECTORS	= 0x30,
-	CMD_WRITE_SECTORS_EXT	= 0x34,
-	CMD_WRITE_DMA_EXT	= 0x35,
-	CMD_PACKET		= 0xA0,
-	CMD_IDENTIFY_PKT_DEV	= 0xA1,
-	CMD_READ_DMA		= 0xC8,
-	CMD_WRITE_DMA		= 0xCA,
-	CMD_IDENTIFY_DRIVE	= 0xEC,
-	CMD_FLUSH_CACHE		= 0xE7
-};
-
-/** Data returned from identify device and identify packet device command. */
-typedef struct {
-	uint16_t gen_conf;
-	uint16_t cylinders;
-	uint16_t _res2;
-	uint16_t heads;
-	uint16_t _vs4;
-	uint16_t _vs5;
-	uint16_t sectors;
-	uint16_t _vs7;
-	uint16_t _vs8;
-	uint16_t _vs9;
-
-	uint16_t serial_number[10];
-	uint16_t _vs20;
-	uint16_t _vs21;
-	uint16_t vs_bytes;
-	uint16_t firmware_rev[4];
-	uint16_t model_name[20];
-
-	uint16_t max_rw_multiple;
-	uint16_t _res48;
-	uint16_t caps;		/* Different meaning for packet device */
-	uint16_t _res50;
-	uint16_t pio_timing;
-	uint16_t dma_timing;
-
-	uint16_t validity;
-	uint16_t cur_cyl;
-	uint16_t cur_heads;
-	uint16_t cur_sectors;
-	uint16_t cur_capacity0;
-	uint16_t cur_capacity1;
-	uint16_t mss;
-	uint16_t total_lba28_0;
-	uint16_t total_lba28_1;
-	uint16_t sw_dma;
-	uint16_t mw_dma;
-	uint16_t pio_modes;
-	uint16_t min_mw_dma_cycle;
-	uint16_t rec_mw_dma_cycle;
-	uint16_t min_raw_pio_cycle;
-	uint16_t min_iordy_pio_cycle;
-
-	uint16_t _res69;
-	uint16_t _res70;
-	uint16_t _res71;
-	uint16_t _res72;
-	uint16_t _res73;
-	uint16_t _res74;
-
-	uint16_t queue_depth;
-	uint16_t _res76[1 + 79 - 76];
-	uint16_t version_maj;
-	uint16_t version_min;
-	uint16_t cmd_set0;
-	uint16_t cmd_set1;
-	uint16_t csf_sup_ext;
-	uint16_t csf_enabled0;
-	uint16_t csf_enabled1;
-	uint16_t csf_default;
-	uint16_t udma;
-
-	uint16_t _res89[1 + 99 - 89];
-
-	/* Total number of blocks in LBA-48 addressing */
-	uint16_t total_lba48_0;
-	uint16_t total_lba48_1;
-	uint16_t total_lba48_2;
-	uint16_t total_lba48_3;
-
-	/* Note: more fields are defined in ATA/ATAPI-7 */
-	uint16_t _res104[1 + 127 - 104];
-	uint16_t _vs128[1 + 159 - 128];
-	uint16_t _res160[1 + 255 - 160];
-} identify_data_t;
-
-/** Capability bits for register device. */
-enum ata_regdev_caps {
-	rd_cap_iordy		= 0x0800,
-	rd_cap_iordy_cbd	= 0x0400,
-	rd_cap_lba		= 0x0200,
-	rd_cap_dma		= 0x0100
-};
-
-/** Capability bits for packet device. */
-enum ata_pktdev_caps {
-	pd_cap_ildma		= 0x8000,
-	pd_cap_cmdqueue		= 0x4000,
-	pd_cap_overlap		= 0x2000,
-	pd_cap_need_softreset	= 0x1000,	/* Obsolete (ATAPI-6) */
-	pd_cap_iordy		= 0x0800,
-	pd_cap_iordy_dis	= 0x0400,
-	pd_cap_lba		= 0x0200,	/* Must be on */
-	pd_cap_dma		= 0x0100
-};
-
-/** Bits of @c identify_data_t.cmd_set1 */
-enum ata_cs1 {
-	cs1_addr48	= 0x0400	/**< 48-bit address feature set */
-};
-
-/** Extract value of device type from scsi_std_inquiry_data_t.pqual_devtype */
-#define INQUIRY_PDEV_TYPE(val) ((val) & 0x1f)
-
-enum ata_pdev_signature {
-	/**
-	 * Signature put by a packet device in byte count register
-	 * in response to Identify command.
-	 */
-	PDEV_SIGNATURE_BC	= 0xEB14
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ata/meson.build
===================================================================
--- uspace/lib/ata/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device', 'scsi' ]
-src = files(
-	'src/ata.c'
-)
-
-test_src = files(
-	'test/ata.c',
-	'test/main.c'
-)
Index: pace/lib/ata/src/ata.c
===================================================================
--- uspace/lib/ata/src/ata.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1879 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libata
- * @{
- */
-
-/**
- * @file
- * @brief ATA disk driver library
- *
- * This driver library implements the generic part of ATA/ATAPI. It is
- * meant to be used by a driver which implements the actual transport
- * (such as ISA, PCI).
- *
- * This driver libary supports CHS, 28-bit and 48-bit LBA addressing,
- * as well as PACKET devices. It supports PIO transfers and IRQ.
- *
- * There is no support DMA, S.M.A.R.T or removable devices.
- *
- * This driver is based on the ATA-1, ATA-2, ATA-3 and ATA/ATAPI-4 through 7
- * standards, as published by the ANSI, NCITS and INCITS standards bodies,
- * which are freely available. This driver contains no vendor-specific
- * code at this moment.
- */
-
-#include <bd_srv.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <macros.h>
-#include <scsi/mmc.h>
-#include <scsi/sbc.h>
-#include <scsi/spc.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "ata/ata.h"
-#include "ata/ata_hw.h"
-
-#define MSG_BUF_SIZE 256
-
-/**
- * Size of data returned from Identify Device or Identify Packet Device
- * command.
- */
-static const size_t identify_data_size = 512;
-static void ata_msg_note(ata_channel_t *, const char *, ...);
-static void ata_msg_debug(ata_channel_t *, const char *, ...);
-static void ata_msg_warn(ata_channel_t *, const char *, ...);
-static void ata_msg_error(ata_channel_t *, const char *, ...);
-static errno_t ata_device_add(ata_device_t *);
-static errno_t ata_device_remove(ata_device_t *);
-static void ata_read_data_16(ata_channel_t *, uint16_t *, size_t);
-static void ata_write_data_16(ata_channel_t *, uint16_t *, size_t);
-static uint8_t ata_read_cmd_8(ata_channel_t *, uint16_t);
-static void ata_write_cmd_8(ata_channel_t *, uint16_t, uint8_t);
-static void ata_write_ctl_8(ata_channel_t *, uint16_t, uint8_t);
-
-static errno_t ata_bd_init_irq(ata_channel_t *);
-static void ata_bd_fini_irq(ata_channel_t *);
-
-static errno_t ata_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t ata_bd_close(bd_srv_t *);
-static errno_t ata_bd_read_blocks(bd_srv_t *, uint64_t, size_t, void *, size_t);
-static errno_t ata_bd_read_toc(bd_srv_t *, uint8_t, void *, size_t);
-static errno_t ata_bd_write_blocks(bd_srv_t *, uint64_t, size_t, const void *,
-    size_t);
-static errno_t ata_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t ata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-static errno_t ata_bd_eject(bd_srv_t *);
-static errno_t ata_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-
-static errno_t ata_rcmd_read(ata_device_t *, uint64_t, size_t, void *);
-static errno_t ata_rcmd_write(ata_device_t *, uint64_t, size_t,
-    const void *);
-static errno_t ata_rcmd_flush_cache(ata_device_t *);
-static errno_t ata_device_init(ata_channel_t *, ata_device_t *, int);
-static errno_t ata_identify_dev(ata_device_t *, void *);
-static errno_t ata_identify_pkt_dev(ata_device_t *, void *);
-static errno_t ata_cmd_packet_nondata(ata_device_t *, const void *, size_t);
-static errno_t ata_cmd_packet_din(ata_device_t *, const void *, size_t, void *,
-    size_t, size_t *);
-static errno_t ata_pcmd_inquiry(ata_device_t *, void *, size_t, size_t *);
-static errno_t ata_pcmd_read_12(ata_device_t *, uint64_t, size_t, void *, size_t);
-static errno_t ata_pcmd_read_capacity(ata_device_t *, uint64_t *, size_t *);
-static errno_t ata_pcmd_read_toc(ata_device_t *, uint8_t, void *, size_t);
-static errno_t ata_pcmd_start_stop_unit(ata_device_t *, uint8_t);
-static void disk_print_summary(ata_device_t *);
-static size_t ata_disk_maxnb(ata_device_t *);
-static errno_t coord_calc(ata_device_t *, uint64_t, block_coord_t *);
-static void coord_sc_program(ata_channel_t *, const block_coord_t *, uint16_t);
-static errno_t wait_status(ata_channel_t *, unsigned, unsigned, uint8_t *,
-    unsigned);
-static errno_t wait_irq(ata_channel_t *, uint8_t *, unsigned);
-static void ata_dma_chan_setup(ata_device_t *, void *, size_t, ata_dma_dir_t);
-static void ata_dma_chan_teardown(ata_device_t *);
-
-static bd_ops_t ata_bd_ops = {
-	.open = ata_bd_open,
-	.close = ata_bd_close,
-	.read_blocks = ata_bd_read_blocks,
-	.read_toc = ata_bd_read_toc,
-	.write_blocks = ata_bd_write_blocks,
-	.get_block_size = ata_bd_get_block_size,
-	.get_num_blocks = ata_bd_get_num_blocks,
-	.sync_cache = ata_bd_sync_cache,
-	.eject = ata_bd_eject
-};
-
-static ata_device_t *bd_srv_device(bd_srv_t *bd)
-{
-	return (ata_device_t *)bd->srvs->sarg;
-}
-
-static int disk_dev_idx(ata_device_t *device)
-{
-	return (device->device_id & 1);
-}
-
-/** Create ATA channel.
- *
- * @param params Channel creation parameters
- * @param rchan Place to store pointer to new channel
- * @return EOK on success or an error code
- */
-errno_t ata_channel_create(ata_params_t *params, ata_channel_t **rchan)
-{
-	ata_channel_t *chan;
-	int i;
-
-	chan = calloc(1, sizeof(ata_channel_t));
-	if (chan == NULL)
-		return ENOMEM;
-
-	chan->params = *params;
-	ata_msg_debug(chan, "ata_channel_create()");
-
-	fibril_mutex_initialize(&chan->lock);
-	fibril_mutex_initialize(&chan->irq_lock);
-	fibril_condvar_initialize(&chan->irq_cv);
-
-	for (i = 0; i < MAX_DEVICES; i++)
-		chan->device[i].chan = chan;
-
-	*rchan = chan;
-	return EOK;
-}
-
-/** Initialize ATA channel.
- *
- * @param params Channel creation parameters
- * @param rchan Place to store pointer to new channel
- * @return EOK on success or an error code
- */
-errno_t ata_channel_initialize(ata_channel_t *chan)
-{
-	int i;
-	errno_t rc;
-	int n_disks;
-	bool irq_inited = false;
-	bool dev_added[MAX_DEVICES];
-
-	for (i = 0; i < MAX_DEVICES; i++)
-		dev_added[i] = false;
-
-	ata_msg_debug(chan, "ata_channel_initialize()");
-
-	rc = ata_bd_init_irq(chan);
-	if (rc != EOK)
-		return rc;
-
-	irq_inited = true;
-
-	for (i = 0; i < MAX_DEVICES; i++) {
-		ata_msg_debug(chan, "Identify drive %d...", i);
-
-		rc = ata_device_init(chan, &chan->device[i], i);
-
-		if (rc == EOK) {
-			disk_print_summary(&chan->device[i]);
-		} else {
-			ata_msg_debug(chan, "Not found.");
-		}
-	}
-
-	n_disks = 0;
-
-	for (i = 0; i < MAX_DEVICES; i++) {
-		/* Skip unattached devices. */
-		if (chan->device[i].present == false)
-			continue;
-
-		rc = ata_device_add(&chan->device[i]);
-		if (rc != EOK) {
-			ata_msg_error(chan, "Unable to add device %d.", i);
-			goto error;
-		}
-		dev_added[i] = true;
-		++n_disks;
-	}
-
-	if (n_disks == 0) {
-		ata_msg_warn(chan, "No devices detected.");
-		rc = ENOENT;
-		goto error;
-	}
-
-	return EOK;
-error:
-	for (i = 0; i < MAX_DEVICES; i++) {
-		if (dev_added[i]) {
-			rc = ata_device_remove(&chan->device[i]);
-			if (rc != EOK) {
-				ata_msg_error(chan,
-				    "Unable to remove device %d.", i);
-			}
-		}
-	}
-	if (irq_inited)
-		ata_bd_fini_irq(chan);
-	return rc;
-}
-
-/** Destroy ATA channel. */
-errno_t ata_channel_destroy(ata_channel_t *chan)
-{
-	int i;
-	errno_t rc;
-
-	ata_msg_debug(chan, ": ata_channel_destroy()");
-
-	fibril_mutex_lock(&chan->lock);
-
-	for (i = 0; i < MAX_DEVICES; i++) {
-		if (chan->device[i].present == false)
-			continue;
-
-		rc = ata_device_remove(&chan->device[i]);
-		if (rc != EOK) {
-			ata_msg_error(chan, "Unable to remove device %d.", i);
-			fibril_mutex_unlock(&chan->lock);
-			return rc;
-		}
-	}
-
-	ata_bd_fini_irq(chan);
-	fibril_mutex_unlock(&chan->lock);
-	free(chan);
-
-	return rc;
-}
-
-/** Quiesce ATA channel. */
-void ata_channel_quiesce(ata_channel_t *chan)
-{
-	ata_msg_debug(chan, ": ata_channel_quiesce()");
-
-	fibril_mutex_lock(&chan->lock);
-	ata_write_ctl_8(chan, REG_DEVCTL, DCR_SRST | DCR_nIEN);
-	fibril_mutex_unlock(&chan->lock);
-}
-
-/** Add ATA device.
- *
- * @param d Device
- * @return EOK on success or an error code
- */
-static errno_t ata_device_add(ata_device_t *d)
-{
-	bd_srvs_init(&d->bds);
-	d->bds.ops = &ata_bd_ops;
-	d->bds.sarg = (void *)d;
-
-	return d->chan->params.add_device(d->chan->params.arg, d->device_id,
-	    (void *)d);
-}
-
-/** Remove ATA device.
- *
- * @param d Device
- * @return EOK on success or an error code
- */
-static errno_t ata_device_remove(ata_device_t *d)
-{
-	return d->chan->params.remove_device(d->chan->params.arg, d->device_id);
-}
-
-/** Read 16 bits from data port.
- *
- * @param chan ATA channel
- * @param buf Buffer to hold data
- * @param nwords Number of words to read
- */
-static void ata_read_data_16(ata_channel_t *chan, uint16_t *buf,
-    size_t nwords)
-{
-	chan->params.read_data_16(chan->params.arg, buf, nwords);
-}
-
-/** Write 16 bits to data port.
- *
- * @param chan ATA channel
- * @param data Data
- * @param nwords Number of words to write
- */
-static void ata_write_data_16(ata_channel_t *chan, uint16_t *data,
-    size_t nwords)
-{
-	chan->params.write_data_16(chan->params.arg, data, nwords);
-}
-
-/** Read 8 bits from 8-bit command port.
- *
- * @param chan ATA channel
- * @param port Port number
- * @return 8-bit register value
- */
-static uint8_t ata_read_cmd_8(ata_channel_t *chan, uint16_t port)
-{
-	return chan->params.read_cmd_8(chan->params.arg, port);
-}
-
-/** Write 8 bits to 8-bit command port.
- *
- * @param chan ATA channel
- * @param port Port number
- * @param value Register value
- */
-static void ata_write_cmd_8(ata_channel_t *chan, uint16_t port, uint8_t value)
-{
-	return chan->params.write_cmd_8(chan->params.arg, port, value);
-}
-
-/** Write 8 bits to 8-bit control port.
- *
- * @param chan ATA channel
- * @param port Port number
- * @param value Register value
- */
-static void ata_write_ctl_8(ata_channel_t *chan, uint16_t port, uint8_t value)
-{
-	return chan->params.write_ctl_8(chan->params.arg, port, value);
-}
-
-/** Log a notice message.
- *
- * @param chan Channel
- * @param fmt Format
- */
-static void ata_msg_note(ata_channel_t *chan, const char *fmt, ...)
-{
-	va_list ap;
-	char buf[MSG_BUF_SIZE];
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
-
-	chan->params.msg_note(chan->params.arg, buf);
-}
-
-/** Log a debug message.
- *
- * @param chan Channel
- * @param fmt Format
- */
-static void ata_msg_debug(ata_channel_t *chan, const char *fmt, ...)
-{
-	va_list ap;
-	char buf[MSG_BUF_SIZE];
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
-
-	chan->params.msg_debug(chan->params.arg, buf);
-}
-
-/** Log a warning message.
- *
- * @param chan Channel
- * @param fmt Format
- */
-static void ata_msg_warn(ata_channel_t *chan, const char *fmt, ...)
-{
-	va_list ap;
-	char buf[MSG_BUF_SIZE];
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
-
-	chan->params.msg_warn(chan->params.arg, buf);
-}
-
-/** Log an error message.
- *
- * @param chan Channel
- * @param fmt Format
- */
-static void ata_msg_error(ata_channel_t *chan, const char *fmt, ...)
-{
-	va_list ap;
-	char buf[MSG_BUF_SIZE];
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
-
-	chan->params.msg_error(chan->params.arg, buf);
-}
-
-/** Print one-line device summary. */
-static void disk_print_summary(ata_device_t *d)
-{
-	uint64_t mbytes;
-	char *atype = NULL;
-	char *cap = NULL;
-	int rc;
-
-	if (d->dev_type == ata_reg_dev) {
-		switch (d->amode) {
-		case am_chs:
-			rc = asprintf(&atype, "CHS %u cylinders, %u heads, "
-			    "%u sectors", d->geom.cylinders, d->geom.heads,
-			    d->geom.sectors);
-			if (rc < 0) {
-				/* Out of memory */
-				atype = NULL;
-			}
-			break;
-		case am_lba28:
-			atype = str_dup("LBA-28");
-			break;
-		case am_lba48:
-			atype = str_dup("LBA-48");
-			break;
-		}
-	} else {
-		atype = str_dup("PACKET");
-	}
-
-	if (atype == NULL)
-		return;
-
-	mbytes = d->blocks / (2 * 1024);
-	if (mbytes > 0) {
-		rc = asprintf(&cap, " %" PRIu64 " MB.", mbytes);
-		if (rc < 0) {
-			cap = NULL;
-			goto cleanup;
-		}
-	}
-
-	ata_msg_note(d->chan, "%s: %s %" PRIu64 " blocks%s", d->model, atype,
-	    d->blocks, cap);
-cleanup:
-	free(atype);
-	free(cap);
-}
-
-/** Initialize IRQ. */
-static errno_t ata_bd_init_irq(ata_channel_t *chan)
-{
-	if (!chan->params.have_irq)
-		return EOK;
-
-	return chan->params.irq_enable(chan->params.arg);
-}
-
-/** Clean up IRQ. */
-static void ata_bd_fini_irq(ata_channel_t *chan)
-{
-	if (!chan->params.have_irq)
-		return;
-
-	(void)chan->params.irq_disable(chan->params.arg);
-}
-
-/** Initialize a device.
- *
- * Probes for a device, determines its parameters and initializes
- * the device structure.
- */
-static errno_t ata_device_init(ata_channel_t *chan, ata_device_t *d,
-    int device_id)
-{
-	identify_data_t idata;
-	uint8_t model[40];
-	scsi_std_inquiry_data_t inq_data;
-	size_t isize;
-	uint16_t w;
-	uint8_t c;
-	uint16_t bc;
-	uint64_t nblocks;
-	size_t block_size;
-	size_t pos, len;
-	errno_t rc;
-	unsigned i;
-
-	d->device_id = device_id;
-	d->present = false;
-
-	/* Try identify command. */
-	rc = ata_identify_dev(d, &idata);
-	if (rc == EOK) {
-		/* Success. It's a register (non-packet) device. */
-		ata_msg_debug(chan, "ATA register-only device found.");
-		d->dev_type = ata_reg_dev;
-	} else if (rc == EIO) {
-		/*
-		 * There is something, but not a register device. Check to see
-		 * whether the IDENTIFY command left the packet signature in
-		 * the registers in case this is a packet device.
-		 *
-		 * According to the ATA specification, the LBA low and
-		 * interrupt reason registers should be set to 0x01. However,
-		 * there are many devices that do not follow this and only set
-		 * the byte count registers. So, only check these.
-		 */
-		bc = ((uint16_t)ata_read_cmd_8(chan, REG_CYLINDER_HIGH) << 8) |
-		    ata_read_cmd_8(chan, REG_CYLINDER_LOW);
-
-		if (bc == PDEV_SIGNATURE_BC) {
-			rc = ata_identify_pkt_dev(d, &idata);
-			if (rc == EOK) {
-				/* We have a packet device. */
-				d->dev_type = ata_pkt_dev;
-			} else {
-				return EIO;
-			}
-		} else {
-			/* Nope. Something's there, but not recognized. */
-			return EIO;
-		}
-	} else {
-		/* Operation timed out. That means there is no device there. */
-		return EIO;
-	}
-
-	if (d->dev_type == ata_pkt_dev) {
-		/* Packet device */
-		d->amode = 0;
-
-		d->geom.cylinders = 0;
-		d->geom.heads = 0;
-		d->geom.sectors = 0;
-
-		d->blocks = 0;
-	} else if ((idata.caps & rd_cap_lba) == 0) {
-		/* Device only supports CHS addressing. */
-		d->amode = am_chs;
-
-		d->geom.cylinders = idata.cylinders;
-		d->geom.heads = idata.heads;
-		d->geom.sectors = idata.sectors;
-
-		d->blocks = d->geom.cylinders * d->geom.heads * d->geom.sectors;
-	} else if ((idata.cmd_set1 & cs1_addr48) == 0) {
-		/* Device only supports LBA-28 addressing. */
-		d->amode = am_lba28;
-
-		d->geom.cylinders = 0;
-		d->geom.heads = 0;
-		d->geom.sectors = 0;
-
-		d->blocks =
-		    (uint32_t) idata.total_lba28_0 |
-		    ((uint32_t) idata.total_lba28_1 << 16);
-	} else {
-		/* Device supports LBA-48 addressing. */
-		d->amode = am_lba48;
-
-		d->geom.cylinders = 0;
-		d->geom.heads = 0;
-		d->geom.sectors = 0;
-
-		d->blocks =
-		    (uint64_t) idata.total_lba48_0 |
-		    ((uint64_t) idata.total_lba48_1 << 16) |
-		    ((uint64_t) idata.total_lba48_2 << 32) |
-		    ((uint64_t) idata.total_lba48_3 << 48);
-	}
-
-	/*
-	 * Convert model name to string representation.
-	 */
-	for (i = 0; i < 20; i++) {
-		w = idata.model_name[i];
-		model[2 * i] = w >> 8;
-		model[2 * i + 1] = w & 0x00ff;
-	}
-
-	len = 40;
-	while (len > 0 && model[len - 1] == 0x20)
-		--len;
-
-	pos = 0;
-	for (i = 0; i < len; ++i) {
-		c = model[i];
-		if (c >= 0x80)
-			c = '?';
-
-		chr_encode(c, d->model, &pos, 40);
-	}
-	d->model[pos] = '\0';
-
-	if (d->dev_type == ata_pkt_dev) {
-		/* Send inquiry. */
-		rc = ata_pcmd_inquiry(d, &inq_data, sizeof(inq_data), &isize);
-		if (rc != EOK || isize < sizeof(inq_data)) {
-			ata_msg_error(chan, "Device inquiry failed.");
-			d->present = false;
-			return EIO;
-		}
-
-		/* Check device type. */
-		if (INQUIRY_PDEV_TYPE(inq_data.pqual_devtype) != SCSI_DEV_CD_DVD)
-			ata_msg_warn(chan, "Peripheral device type is not CD-ROM.");
-
-		rc = ata_pcmd_read_capacity(d, &nblocks, &block_size);
-		if (rc != EOK) {
-			ata_msg_error(chan, "Read capacity command failed.");
-			d->present = false;
-			return EIO;
-		}
-
-		d->blocks = nblocks;
-		d->block_size = block_size;
-	} else {
-		/* Assume register Read always uses 512-byte blocks. */
-		d->block_size = 512;
-	}
-
-	d->present = true;
-	return EOK;
-}
-
-static errno_t ata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-static errno_t ata_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read multiple blocks from the device. */
-static errno_t ata_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    void *buf, size_t size)
-{
-	ata_device_t *device = bd_srv_device(bd);
-	size_t maxnb;
-	size_t nb;
-	errno_t rc;
-
-	if (size < cnt * device->block_size) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Maximum number of blocks to transfer at the same time */
-	maxnb = ata_disk_maxnb(device);
-	while (cnt > 0) {
-		nb = min(maxnb, cnt);
-		if (device->dev_type == ata_reg_dev) {
-			rc = ata_rcmd_read(device, ba, nb, buf);
-		} else {
-			rc = ata_pcmd_read_12(device, ba, nb, buf,
-			    device->block_size);
-		}
-
-		if (rc != EOK)
-			goto error;
-
-		ba += nb;
-		cnt -= nb;
-		buf += device->block_size * nb;
-	}
-
-	return EOK;
-error:
-	ata_msg_debug(device->chan, "ata_bd_read_blocks: rc=%d", rc);
-	return rc;
-}
-
-/** Read TOC from device. */
-static errno_t ata_bd_read_toc(bd_srv_t *bd, uint8_t session, void *buf, size_t size)
-{
-	ata_device_t *device = bd_srv_device(bd);
-
-	return ata_pcmd_read_toc(device, session, buf, size);
-}
-
-/** Write multiple blocks to the device. */
-static errno_t ata_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	ata_device_t *device = bd_srv_device(bd);
-	size_t maxnb;
-	size_t nb;
-	errno_t rc;
-
-	if (device->dev_type != ata_reg_dev)
-		return ENOTSUP;
-
-	if (size < cnt * device->block_size)
-		return EINVAL;
-
-	/* Maximum number of blocks to transfer at the same time */
-	maxnb = ata_disk_maxnb(device);
-	while (cnt > 0) {
-		nb = min(maxnb, cnt);
-		rc = ata_rcmd_write(device, ba, nb, buf);
-		if (rc != EOK)
-			return rc;
-
-		ba += nb;
-		cnt -= nb;
-		buf += device->block_size * nb;
-	}
-
-	return EOK;
-}
-
-/** Get device block size. */
-static errno_t ata_bd_get_block_size(bd_srv_t *bd, size_t *rbsize)
-{
-	ata_device_t *device = bd_srv_device(bd);
-
-	*rbsize = device->block_size;
-	return EOK;
-}
-
-/** Get device number of blocks. */
-static errno_t ata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	ata_device_t *device = bd_srv_device(bd);
-
-	*rnb = device->blocks;
-	return EOK;
-}
-
-/** Flush cache. */
-static errno_t ata_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
-{
-	ata_device_t *device = bd_srv_device(bd);
-
-	/* ATA cannot flush just some blocks, we just flush everything. */
-	(void)ba;
-	(void)cnt;
-
-	return ata_rcmd_flush_cache(device);
-}
-
-/** Eject medium. */
-static errno_t ata_bd_eject(bd_srv_t *bd)
-{
-	ata_device_t *device = bd_srv_device(bd);
-
-	ata_msg_debug(device->chan, "ata_bd_eject()");
-	return ata_pcmd_start_stop_unit(device, ssf_pc_no_change |
-	    ssf_loej);
-}
-
-/** PIO data-in command protocol. */
-static errno_t ata_pio_data_in(ata_device_t *device, void *obuf, size_t obuf_size,
-    size_t blk_size, size_t nblocks)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	errno_t rc;
-
-	assert(nblocks > 0);
-	assert(blk_size % 2 == 0);
-
-	while (nblocks > 0) {
-		if (chan->params.have_irq)
-			rc = wait_irq(chan, &status, TIMEOUT_BSY);
-		else
-			rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-		if (rc != EOK) {
-			ata_msg_debug(chan, "wait_irq/wait_status failed");
-			return EIO;
-		}
-
-		if ((status & SR_DRQ) == 0) {
-			ata_msg_debug(chan, "DRQ == 0");
-			break;
-		}
-
-		/* Read data from the device buffer. */
-		ata_read_data_16(chan, (uint16_t *)obuf, blk_size / 2);
-		obuf += blk_size;
-
-		--nblocks;
-	}
-
-	if ((status & SR_ERR) != 0) {
-		ata_msg_debug(chan, "status & SR_ERR != 0");
-		return EIO;
-	}
-	if (nblocks > 0) {
-		ata_msg_debug(chan, "remaining nblocks = %zu", nblocks);
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** PIO data-out command protocol. */
-static errno_t ata_pio_data_out(ata_device_t *device, const void *buf, size_t buf_size,
-    size_t blk_size, size_t nblocks)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	errno_t rc;
-
-	assert(nblocks > 0);
-	assert(blk_size % 2 == 0);
-
-	rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-	if (rc != EOK)
-		return EIO;
-
-	while (nblocks > 0) {
-		if ((status & SR_DRQ) == 0) {
-			ata_msg_debug(chan, "pio_data_out: unexpected DRQ=0");
-			break;
-		}
-
-		/* Write data to the device buffer. */
-		ata_write_data_16(chan, (uint16_t *)buf, blk_size / 2);
-		buf += blk_size;
-
-		if (chan->params.have_irq)
-			rc = wait_irq(chan, &status, TIMEOUT_BSY);
-		else
-			rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-		if (rc != EOK)
-			return EIO;
-
-		--nblocks;
-	}
-
-	if (status & SR_ERR)
-		return EIO;
-	if (nblocks > 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** PIO non-data command protocol. */
-static errno_t ata_pio_nondata(ata_device_t *device)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	errno_t rc;
-
-	if (chan->params.have_irq)
-		rc = wait_irq(chan, &status, TIMEOUT_BSY);
-	else
-		rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-	if (rc != EOK)
-		return EIO;
-
-	if (status & SR_ERR)
-		return EIO;
-
-	return EOK;
-}
-
-/** DMA command protocol.
- *
- * @param device ATA device
- * @param cmd Command code
- * @param buf Data buffer
- * @param buf_size Data buffer size in bytes
- * @param dir DMA direction
- *
- * @return EOK on success or an error code
- */
-static errno_t ata_dma_proto(ata_device_t *device, uint8_t cmd, void *buf,
-    size_t buf_size, ata_dma_dir_t dir)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	errno_t rc;
-
-	/* Set up DMA channel */
-	ata_dma_chan_setup(device, buf, buf_size, dir);
-
-	ata_write_cmd_8(chan, REG_COMMAND, cmd);
-
-	if (chan->params.have_irq)
-		rc = wait_irq(chan, &status, TIMEOUT_BSY);
-	else
-		rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-	/* Tear down DMA channel */
-	ata_dma_chan_teardown(device);
-
-	if (rc != EOK) {
-		ata_msg_debug(chan, "wait_irq/wait_status failed");
-		return EIO;
-	}
-
-	if ((status & SR_ERR) != 0) {
-		ata_msg_debug(chan, "status & SR_ERR != 0");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Issue IDENTIFY DEVICE command.
- *
- * Reads @c identify data into the provided buffer. This is used to detect
- * whether an ATA device is present and if so, to determine its parameters.
- *
- * @param device	Device
- * @param buf		Pointer to a 512-byte buffer.
- *
- * @return		ETIMEOUT on timeout (this can mean the device is
- *			not present). EIO if device responds with error.
- */
-static errno_t ata_identify_dev(ata_device_t *device, void *buf)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	uint8_t drv_head;
-
-	drv_head = ((disk_dev_idx(device) != 0) ? DHR_DRV : 0);
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
-		return ETIMEOUT;
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	/*
-	 * Do not wait for DRDY to be set in case this is a packet device.
-	 * We determine whether the device is present by waiting for DRQ to be
-	 * set after issuing the command.
-	 */
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
-		return ETIMEOUT;
-
-	ata_write_cmd_8(chan, REG_COMMAND, CMD_IDENTIFY_DRIVE);
-
-	/*
-	 * For probing purposes we need to wait for some status bit to become
-	 * active - otherwise we could be fooled just by receiving all zeroes.
-	 */
-	if (wait_status(chan, SR_DRQ, ~SR_BSY, &status, TIMEOUT_PROBE) != EOK) {
-		if ((status & SR_ERR) == 0) {
-			/* Probably no device at all */
-			return ETIMEOUT;
-		}
-	}
-
-	return ata_pio_data_in(device, buf, identify_data_size,
-	    identify_data_size, 1);
-}
-
-/** Issue Identify Packet Device command.
- *
- * Reads @c identify data into the provided buffer. This is used to detect
- * whether an ATAPI device is present and if so, to determine its parameters.
- *
- * @param device	Device
- * @param buf		Pointer to a 512-byte buffer.
- */
-static errno_t ata_identify_pkt_dev(ata_device_t *device, void *buf)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t drv_head;
-
-	drv_head = ((disk_dev_idx(device) != 0) ? DHR_DRV : 0);
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
-		return EIO;
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	/* For ATAPI commands we do not need to wait for DRDY. */
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK)
-		return EIO;
-
-	ata_write_cmd_8(chan, REG_COMMAND, CMD_IDENTIFY_PKT_DEV);
-
-	return ata_pio_data_in(device, buf, identify_data_size,
-	    identify_data_size, 1);
-}
-
-/** Read data using PIO during a PACKET command.
- *
- * @param device Device
- * @param obuf Output buffer
- * @param obuf_size Output buffer size
- * @param rcvd_size Place to store number of bytes actually transferred
- *                  or @c NULL
- */
-static errno_t ata_packet_pio_data_in(ata_device_t *device, void *obuf,
-    size_t obuf_size, size_t *rcvd_size)
-{
-	ata_channel_t *chan = device->chan;
-	size_t data_size;
-	size_t remain;
-	uint8_t status;
-	errno_t rc;
-
-	remain = obuf_size;
-	while (remain > 0) {
-		if (chan->params.have_irq)
-			rc = wait_irq(chan, &status, TIMEOUT_BSY);
-		else
-			rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-		if (rc != EOK) {
-			fibril_mutex_unlock(&chan->lock);
-			return EIO;
-		}
-
-		if ((status & SR_DRQ) == 0)
-			break;
-
-		/* Read byte count. */
-		data_size = (uint16_t) ata_read_cmd_8(chan, REG_CYLINDER_LOW) +
-		    ((uint16_t) ata_read_cmd_8(chan, REG_CYLINDER_HIGH) << 8);
-
-		/* Check whether data fits into output buffer. */
-		if (data_size > obuf_size) {
-			/* Output buffer is too small to store data. */
-			fibril_mutex_unlock(&chan->lock);
-			return EIO;
-		}
-
-		/* Read data from the device buffer. */
-		ata_read_data_16(chan, obuf, (data_size + 1) / 2);
-		obuf += data_size;
-
-		remain -= data_size;
-	}
-
-	if (chan->params.have_irq)
-		rc = wait_irq(chan, &status, TIMEOUT_BSY);
-	else
-		rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-	if (status & SR_ERR)
-		return EIO;
-
-	if (rcvd_size != NULL)
-		*rcvd_size = obuf_size - remain;
-
-	return EOK;
-}
-
-/** Transfer data using DMA during PACKET command.
- *
- * @param device Device
- * @param buf Buffer
- * @param buf_size Buffer size
- * @param dir DMA direction
- *
- * @return EOK on success or an error code
- */
-static errno_t ata_packet_dma(ata_device_t *device, void *buf, size_t buf_size,
-    ata_dma_dir_t dir)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	errno_t rc;
-
-	if (chan->params.have_irq)
-		rc = wait_irq(chan, &status, TIMEOUT_BSY);
-	else
-		rc = wait_status(chan, 0, ~SR_BSY, &status, TIMEOUT_BSY);
-
-	if (rc != EOK) {
-		ata_msg_debug(chan, "wait_irq/wait_status failed");
-		return EIO;
-	}
-
-	if ((status & SR_ERR) != 0) {
-		ata_msg_debug(chan, "status & SR_ERR != 0");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Issue packet command (i. e. write a command packet to the device)
- * with no data transfer.
- *
- * @param device	Device
- * @param cpkt		Command packet
- * @param cpkt_size	Command packet size in bytes
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_cmd_packet_nondata(ata_device_t *device, const void *cpkt,
-    size_t cpkt_size)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	uint8_t drv_head;
-	errno_t rc;
-
-	ata_msg_debug(chan, "ata_cmd_packet_nondata()");
-
-	fibril_mutex_lock(&chan->lock);
-
-	/* New value for Drive/Head register */
-	drv_head =
-	    ((disk_dev_idx(device) != 0) ? DHR_DRV : 0);
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	if (wait_status(chan, 0, ~(SR_BSY | SR_DRQ), NULL, TIMEOUT_BSY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_COMMAND, CMD_PACKET);
-
-	if (wait_status(chan, SR_DRQ, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) {
-		if (chan->params.use_dma)
-			ata_dma_chan_teardown(device);
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	/* Write command packet. */
-	ata_write_data_16(chan, ((uint16_t *) cpkt), (cpkt_size + 1) / 2);
-
-	rc = ata_pio_nondata(device);
-
-	fibril_mutex_unlock(&chan->lock);
-
-	return rc;
-}
-
-/** Issue packet command (i. e. write a command packet to the device)
- * performing data-in transfer.
- *
- * @param device	Device
- * @param cpkt		Command packet
- * @param cpkt_size	Command packet size in bytes
- * @param obuf		Buffer for storing data read from device
- * @param obuf_size	Size of obuf in bytes
- * @param rcvd_size	Place to store number of bytes read or @c NULL
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_cmd_packet_din(ata_device_t *device, const void *cpkt,
-    size_t cpkt_size, void *obuf, size_t obuf_size, size_t *rcvd_size)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t status;
-	uint8_t drv_head;
-	errno_t rc;
-
-	fibril_mutex_lock(&chan->lock);
-
-	/* New value for Drive/Head register */
-	drv_head =
-	    ((disk_dev_idx(device) != 0) ? DHR_DRV : 0);
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_PROBE) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	if (wait_status(chan, 0, ~(SR_BSY | SR_DRQ), NULL, TIMEOUT_BSY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	if (chan->params.use_dma) {
-		/* Set up DMA channel */
-		ata_dma_chan_setup(device, obuf, obuf_size, ata_dma_read);
-		ata_write_cmd_8(chan, REG_FEATURES, 0x01); // XXX
-	} else {
-		/*
-		 * Byte count <- max. number of bytes we can read in one
-		 * PIO transfer.
-		 */
-		ata_write_cmd_8(chan, REG_CYLINDER_LOW, 0xfe);
-		ata_write_cmd_8(chan, REG_CYLINDER_HIGH, 0xff);
-	}
-
-	ata_write_cmd_8(chan, REG_COMMAND, CMD_PACKET);
-
-	if (wait_status(chan, SR_DRQ, ~SR_BSY, &status, TIMEOUT_BSY) != EOK) {
-		if (chan->params.use_dma)
-			ata_dma_chan_teardown(device);
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	/* Write command packet. */
-	ata_write_data_16(chan, ((uint16_t *) cpkt), (cpkt_size + 1) / 2);
-
-	if (chan->params.use_dma) {
-		/* Read data using DMA */
-		rc = ata_packet_dma(device, obuf, obuf_size, ata_dma_read);
-		if (rc == EOK && rcvd_size != NULL)
-			*rcvd_size = obuf_size;
-		ata_dma_chan_teardown(device);
-	} else {
-		/* Read data using PIO */
-		rc = ata_packet_pio_data_in(device, obuf, obuf_size, rcvd_size);
-	}
-
-	fibril_mutex_unlock(&chan->lock);
-
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Issue ATAPI Inquiry.
- *
- * @param device	Device
- * @param obuf		Buffer for storing inquiry data read from device
- * @param obuf_size	Size of obuf in bytes
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_pcmd_inquiry(ata_device_t *device, void *obuf, size_t obuf_size,
-    size_t *rcvd_size)
-{
-	uint8_t cpb[12];
-	scsi_cdb_inquiry_t *cp = (scsi_cdb_inquiry_t *)cpb;
-	errno_t rc;
-
-	memset(cpb, 0, sizeof(cpb));
-
-	/*
-	 * For SFF 8020 compliance the inquiry must be padded to 12 bytes
-	 * and allocation length must fit in one byte.
-	 */
-	cp->op_code = SCSI_CMD_INQUIRY;
-
-	/* Allocation length */
-	cp->alloc_len = host2uint16_t_be(min(obuf_size, 0xff));
-
-	rc = ata_cmd_packet_din(device, cpb, sizeof(cpb), obuf, obuf_size,
-	    rcvd_size);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Issue ATAPI read capacity(10) command.
- *
- * @param device	Device
- * @param nblocks	Place to store number of blocks
- * @param block_size	Place to store block size
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_pcmd_read_capacity(ata_device_t *device, uint64_t *nblocks,
-    size_t *block_size)
-{
-	scsi_cdb_read_capacity_10_t cdb;
-	scsi_read_capacity_10_data_t data;
-	size_t rsize;
-	errno_t rc;
-
-	memset(&cdb, 0, sizeof(cdb));
-	cdb.op_code = SCSI_CMD_READ_CAPACITY_10;
-
-	rc = ata_cmd_packet_din(device, &cdb, sizeof(cdb), &data, sizeof(data),
-	    &rsize);
-	if (rc != EOK)
-		return rc;
-
-	if (rsize != sizeof(data))
-		return EIO;
-
-	*nblocks = uint32_t_be2host(data.last_lba) + 1;
-	*block_size = uint32_t_be2host(data.block_size);
-
-	return EOK;
-}
-
-/** Issue ATAPI read(12) command.
- *
- * Output buffer must be large enough to hold the data, otherwise the
- * function will fail.
- *
- * @param device	Device
- * @param ba		Starting block address
- * @param cnt		Number of blocks to read
- * @param obuf		Buffer for storing inquiry data read from device
- * @param obuf_size	Size of obuf in bytes
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_pcmd_read_12(ata_device_t *device, uint64_t ba, size_t cnt,
-    void *obuf, size_t obuf_size)
-{
-	scsi_cdb_read_12_t cp;
-	errno_t rc;
-
-	if (ba > UINT32_MAX)
-		return EINVAL;
-
-	memset(&cp, 0, sizeof(cp));
-
-	cp.op_code = SCSI_CMD_READ_12;
-	cp.lba = host2uint32_t_be(ba);
-	cp.xfer_len = host2uint32_t_be(cnt);
-
-	rc = ata_cmd_packet_din(device, &cp, sizeof(cp), obuf, obuf_size, NULL);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Issue ATAPI read TOC command.
- *
- * Read TOC in 'multi-session' format (first and last session number
- * with last session LBA).
- *
- * http://suif.stanford.edu/~csapuntz/specs/INF-8020.PDF page 171
- *
- * Output buffer must be large enough to hold the data, otherwise the
- * function will fail.
- *
- * @param device	Device
- * @param session	Starting session
- * @param obuf		Buffer for storing inquiry data read from device
- * @param obuf_size	Size of obuf in bytes
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_pcmd_read_toc(ata_device_t *device, uint8_t session,
-    void *obuf, size_t obuf_size)
-{
-	uint8_t cpb[12];
-	scsi_cdb_read_toc_t *cp = (scsi_cdb_read_toc_t *)cpb;
-	errno_t rc;
-
-	memset(cpb, 0, sizeof(cpb));
-
-	cp->op_code = SCSI_CMD_READ_TOC;
-	cp->msf = 0;
-	cp->format = 0x01; /* 0x01 = multi-session mode */
-	cp->track_sess_no = session;
-	cp->alloc_len = host2uint16_t_be(obuf_size);
-	cp->control = 0x40; /* 0x01 = multi-session mode (shifted to MSB) */
-
-	rc = ata_cmd_packet_din(device, cpb, sizeof(cpb), obuf, obuf_size,
-	    NULL);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Issue Start Stop Unit command.
- *
- * @param device	Device
- * @param flags		Flags field of Start Stop Unit command (ssf_*)
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_pcmd_start_stop_unit(ata_device_t *device, uint8_t flags)
-{
-	uint8_t cpb[12];
-	scsi_cdb_start_stop_unit_t *cp = (scsi_cdb_start_stop_unit_t *)cpb;
-	errno_t rc;
-
-	ata_msg_debug(device->chan, "ata_pcmd_start_stop_unit(device, 0x%x)",
-	    flags);
-
-	memset(cpb, 0, sizeof(cpb));
-
-	/*
-	 * For SFF 8020 compliance the command must be padded to 12 bytes.
-	 */
-	cp->op_code = SCSI_CMD_START_STOP_UNIT;
-	cp->immed = 0;
-	cp->flags = flags;
-	cp->control = 0;
-
-	rc = ata_cmd_packet_nondata(device, cpb, sizeof(cpb));
-	if (rc != EOK)
-		return rc;
-
-	ata_msg_debug(device->chan, "ata_pcmd_start_stop_unit(): "
-	    "ata_cmd_packet_nondata -> %d", rc);
-
-	return EOK;
-}
-
-/** Read a physical block from the device.
- *
- * @param device	Device
- * @param ba		Address the first block.
- * @param cnt		Number of blocks to transfer.
- * @param buf		Buffer for holding the data.
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_rcmd_read(ata_device_t *device, uint64_t ba, size_t blk_cnt,
-    void *buf)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t drv_head;
-	block_coord_t bc;
-	uint8_t cmd;
-	errno_t rc;
-
-	/* Silence warning. */
-	memset(&bc, 0, sizeof(bc));
-
-	/* Compute block coordinates. */
-	if (coord_calc(device, ba, &bc) != EOK) {
-		ata_msg_note(chan, "ata_rcmd_read() -> coord_calc failed");
-		return EINVAL;
-	}
-
-	/* New value for Drive/Head register */
-	drv_head =
-	    ((disk_dev_idx(device) != 0) ? DHR_DRV : 0) |
-	    ((device->amode != am_chs) ? DHR_LBA : 0) |
-	    (bc.h & 0x0f);
-
-	fibril_mutex_lock(&chan->lock);
-
-	/* Program a Read Sectors operation. */
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		ata_msg_note(chan, "ata_rcmd_read() -> wait_status failed");
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	if (wait_status(chan, SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		ata_msg_note(chan, "ata_rcmd_read() -> wait_status 2 failed");
-		return EIO;
-	}
-
-	/* Program block coordinates into the device. */
-	coord_sc_program(chan, &bc, blk_cnt);
-
-	if (chan->params.use_dma) {
-		cmd = (device->amode == am_lba48) ? CMD_READ_DMA_EXT :
-		    CMD_READ_DMA;
-
-		rc = ata_dma_proto(device, cmd, buf,
-		    blk_cnt * device->block_size, ata_dma_read);
-		if (rc != EOK) {
-			ata_msg_note(chan, "ata_rcmd_read() -> dma_proto->%d",
-			    rc);
-		}
-	} else {
-		ata_write_cmd_8(chan, REG_COMMAND, device->amode == am_lba48 ?
-		    CMD_READ_SECTORS_EXT : CMD_READ_SECTORS);
-
-		rc = ata_pio_data_in(device, buf, blk_cnt * device->block_size,
-		    device->block_size, blk_cnt);
-		if (rc != EOK) {
-			ata_msg_note(chan, "ata_rcmd_read() -> pio_data_in->%d",
-			    rc);
-		}
-	}
-
-	fibril_mutex_unlock(&chan->lock);
-
-	return rc;
-}
-
-/** Write a physical block to the device.
- *
- * @param device	Device
- * @param ba		Address of the first block.
- * @param cnt		Number of blocks to transfer.
- * @param buf		Buffer holding the data to write.
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_rcmd_write(ata_device_t *device, uint64_t ba, size_t cnt,
-    const void *buf)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t drv_head;
-	block_coord_t bc;
-	uint8_t cmd;
-	errno_t rc;
-
-	/* Silence warning. */
-	memset(&bc, 0, sizeof(bc));
-
-	/* Compute block coordinates. */
-	if (coord_calc(device, ba, &bc) != EOK)
-		return EINVAL;
-
-	/* New value for Drive/Head register */
-	drv_head =
-	    ((disk_dev_idx(device) != 0) ? DHR_DRV : 0) |
-	    ((device->amode != am_chs) ? DHR_LBA : 0) |
-	    (bc.h & 0x0f);
-
-	fibril_mutex_lock(&chan->lock);
-
-	/* Program a Write Sectors operation. */
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	if (wait_status(chan, SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	/* Program block coordinates into the device. */
-	coord_sc_program(chan, &bc, cnt);
-
-	if (chan->params.use_dma) {
-		cmd = (device->amode == am_lba48) ? CMD_WRITE_DMA_EXT :
-		    CMD_WRITE_DMA;
-
-		rc = ata_dma_proto(device, cmd, (void *)buf,
-		    cnt * device->block_size, ata_dma_write);
-		if (rc != EOK) {
-			ata_msg_note(chan, "ata_rcmd_write() -> dma_proto->%d",
-			    rc);
-		}
-	} else {
-		ata_write_cmd_8(chan, REG_COMMAND, device->amode == am_lba48 ?
-		    CMD_WRITE_SECTORS_EXT : CMD_WRITE_SECTORS);
-
-		rc = ata_pio_data_out(device, buf, cnt * device->block_size,
-		    device->block_size, cnt);
-		if (rc != EOK) {
-			ata_msg_note(chan,
-			    "ata_rcmd_read() -> pio_data_out->%d", rc);
-		}
-	}
-
-	fibril_mutex_unlock(&chan->lock);
-	return rc;
-}
-
-/** Flush cached data to nonvolatile storage.
- *
- * @param device	Device
- *
- * @return EOK on success, EIO on error.
- */
-static errno_t ata_rcmd_flush_cache(ata_device_t *device)
-{
-	ata_channel_t *chan = device->chan;
-	uint8_t drv_head;
-	errno_t rc;
-
-	/* New value for Drive/Head register */
-	drv_head =
-	    (disk_dev_idx(device) != 0) ? DHR_DRV : 0;
-
-	fibril_mutex_lock(&chan->lock);
-
-	/* Program a Flush Cache operation. */
-
-	if (wait_status(chan, 0, ~SR_BSY, NULL, TIMEOUT_BSY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_DRIVE_HEAD, drv_head);
-
-	if (wait_status(chan, SR_DRDY, ~SR_BSY, NULL, TIMEOUT_DRDY) != EOK) {
-		fibril_mutex_unlock(&chan->lock);
-		return EIO;
-	}
-
-	ata_write_cmd_8(chan, REG_COMMAND, CMD_FLUSH_CACHE);
-
-	rc = ata_pio_nondata(device);
-
-	fibril_mutex_unlock(&chan->lock);
-	return rc;
-}
-
-/** Get the maximum number of blocks to be transferred in one I/O
- *
- * @param d Device
- * @return Maximum number of blocks
- */
-static size_t ata_disk_maxnb(ata_device_t *d)
-{
-	size_t maxnb;
-	size_t dma_maxnb;
-
-	maxnb = 0;
-
-	if (d->dev_type == ata_pkt_dev) {
-		/* Could be more depending on SCSI command support */
-		maxnb = 0x100;
-	} else {
-		switch (d->amode) {
-		case am_chs:
-		case am_lba28:
-			maxnb = 0x100;
-			break;
-		case am_lba48:
-			maxnb = 0x10000;
-			break;
-		}
-	}
-
-	/*
-	 * If using DMA, this needs to be further restricted not to
-	 * exceed DMA buffer size.
-	 */
-	if (d->chan->params.use_dma) {
-		dma_maxnb = d->chan->params.max_dma_xfer / d->block_size;
-		if (dma_maxnb < maxnb)
-			maxnb = dma_maxnb;
-	}
-
-	return maxnb;
-}
-
-/** Calculate block coordinates.
- *
- * Calculates block coordinates in the best coordinate system supported
- * by the device. These can be later programmed into the device using
- * @c coord_sc_program().
- *
- * @return EOK on success or EINVAL if block index is past end of device.
- */
-static errno_t coord_calc(ata_device_t *d, uint64_t ba, block_coord_t *bc)
-{
-	uint64_t c;
-	uint64_t idx;
-
-	/* Check device bounds. */
-	if (ba >= d->blocks)
-		return EINVAL;
-
-	bc->amode = d->amode;
-
-	switch (d->amode) {
-	case am_chs:
-		/* Compute CHS coordinates. */
-		c = ba / (d->geom.heads * d->geom.sectors);
-		idx = ba % (d->geom.heads * d->geom.sectors);
-
-		bc->cyl_lo = c & 0xff;
-		bc->cyl_hi = (c >> 8) & 0xff;
-		bc->h      = (idx / d->geom.sectors) & 0x0f;
-		bc->sector = (1 + (idx % d->geom.sectors)) & 0xff;
-		break;
-
-	case am_lba28:
-		/* Compute LBA-28 coordinates. */
-		bc->c0 = ba & 0xff;		/* bits 0-7 */
-		bc->c1 = (ba >> 8) & 0xff;	/* bits 8-15 */
-		bc->c2 = (ba >> 16) & 0xff;	/* bits 16-23 */
-		bc->h  = (ba >> 24) & 0x0f;	/* bits 24-27 */
-		break;
-
-	case am_lba48:
-		/* Compute LBA-48 coordinates. */
-		bc->c0 = ba & 0xff;		/* bits 0-7 */
-		bc->c1 = (ba >> 8) & 0xff;	/* bits 8-15 */
-		bc->c2 = (ba >> 16) & 0xff;	/* bits 16-23 */
-		bc->c3 = (ba >> 24) & 0xff;	/* bits 24-31 */
-		bc->c4 = (ba >> 32) & 0xff;	/* bits 32-39 */
-		bc->c5 = (ba >> 40) & 0xff;	/* bits 40-47 */
-		bc->h  = 0;
-		break;
-	}
-
-	return EOK;
-}
-
-/** Program block coordinates and sector count into ATA registers.
- *
- * Note that bc->h must be programmed separately into the device/head register.
- *
- * @param chan		Channel
- * @param bc		Block coordinates
- * @param scnt		Sector count
- */
-static void coord_sc_program(ata_channel_t *chan, const block_coord_t *bc,
-    uint16_t scnt)
-{
-	if (bc->amode == am_lba48) {
-		/* Write high-order bits. */
-		ata_write_cmd_8(chan, REG_SECTOR_COUNT, scnt >> 8);
-		ata_write_cmd_8(chan, REG_SECTOR_NUMBER, bc->c3);
-		ata_write_cmd_8(chan, REG_CYLINDER_LOW, bc->c4);
-		ata_write_cmd_8(chan, REG_CYLINDER_HIGH, bc->c5);
-	}
-
-	/* Write low-order bits. */
-	ata_write_cmd_8(chan, REG_SECTOR_COUNT, scnt & 0x00ff);
-	ata_write_cmd_8(chan, REG_SECTOR_NUMBER, bc->c0);
-	ata_write_cmd_8(chan, REG_CYLINDER_LOW, bc->c1);
-	ata_write_cmd_8(chan, REG_CYLINDER_HIGH, bc->c2);
-}
-
-/** Wait until some status bits are set and some are reset.
- *
- * Example: wait_status(chan, SR_DRDY, ~SR_BSY, ...) waits for SR_DRDY to become
- * set and SR_BSY to become reset.
- *
- * @param chan		Channel
- * @param set		Combination if bits which must be all set.
- * @param n_reset	Negated combination of bits which must be all reset.
- * @param pstatus	Pointer where to store last read status or NULL.
- * @param timeout	Timeout in 10ms units.
- *
- * @return		EOK on success, EIO on timeout.
- */
-static errno_t wait_status(ata_channel_t *chan, unsigned set, unsigned n_reset,
-    uint8_t *pstatus, unsigned timeout)
-{
-	uint8_t status;
-	int cnt;
-
-	status = ata_read_cmd_8(chan, REG_STATUS);
-
-	/*
-	 * This is crude, yet simple. First try with 1us delays
-	 * (most likely the device will respond very fast). If not,
-	 * start trying every 10 ms.
-	 */
-
-	cnt = 100;
-	while ((status & ~n_reset) != 0 || (status & set) != set) {
-		--cnt;
-		if (cnt <= 0)
-			break;
-
-		status = ata_read_cmd_8(chan, REG_STATUS);
-	}
-
-	cnt = timeout;
-	while ((status & ~n_reset) != 0 || (status & set) != set) {
-		fibril_usleep(10000);
-		--cnt;
-		if (cnt <= 0)
-			break;
-
-		status = ata_read_cmd_8(chan, REG_STATUS);
-	}
-
-	if (pstatus)
-		*pstatus = status;
-
-	if (cnt == 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Wait for IRQ and return status.
- *
- * @param chan		Channel
- * @param pstatus	Pointer where to store last read status or NULL.
- * @param timeout	Timeout in 10ms units.
- *
- * @return		EOK on success, EIO on timeout.
- */
-static errno_t wait_irq(ata_channel_t *chan, uint8_t *pstatus, unsigned timeout)
-{
-	fibril_mutex_lock(&chan->irq_lock);
-	while (!chan->irq_fired)
-		fibril_condvar_wait(&chan->irq_cv, &chan->irq_lock);
-
-	chan->irq_fired = false;
-	*pstatus = chan->irq_status;
-	fibril_mutex_unlock(&chan->irq_lock);
-	return EOK;
-}
-
-/** Set up DMA channel.
- *
- * @param device ATA device
- * @param buf Data buffer
- * @param buf_size Data buffer size in bytes
- * @param dir DMA direction
- */
-static void ata_dma_chan_setup(ata_device_t *device, void *buf,
-    size_t buf_size, ata_dma_dir_t dir)
-{
-	device->chan->params.dma_chan_setup(device->chan->params.arg,
-	    buf, buf_size, dir);
-}
-
-/** Tear down DMA channel.
- *
- * @param device ATA device
- */
-static void ata_dma_chan_teardown(ata_device_t *device)
-{
-	device->chan->params.dma_chan_teardown(device->chan->params.arg);
-}
-
-/** Interrupt handler.
- *
- * @param chan ATA channel
- * @param status Status read by interrupt handler
- */
-void ata_channel_irq(ata_channel_t *chan, uint8_t status)
-{
-	fibril_mutex_lock(&chan->irq_lock);
-	chan->irq_fired = true;
-	chan->irq_status = status;
-	fibril_mutex_unlock(&chan->irq_lock);
-	fibril_condvar_broadcast(&chan->irq_cv);
-}
-
-/** Block device connection handler */
-void ata_connection(ipc_call_t *icall, ata_device_t *device)
-{
-	bd_conn(icall, &device->bds);
-}
-
-/**
- * @}
- */
Index: pace/lib/ata/test/ata.c
===================================================================
--- uspace/lib/ata/test/ata.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ata/ata.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ata);
-
-static void test_write_data_16(void *, uint16_t *, size_t);
-static void test_read_data_16(void *, uint16_t *, size_t);
-static void test_write_cmd_8(void *, uint16_t, uint8_t);
-static uint8_t test_read_cmd_8(void *, uint16_t);
-static void test_write_ctl_8(void *, uint16_t, uint8_t);
-static uint8_t test_read_ctl_8(void *, uint16_t);
-static errno_t test_irq_enable(void *);
-static errno_t test_irq_disable(void *);
-static void test_dma_chan_setup(void *, void *, size_t, ata_dma_dir_t);
-static void test_dma_chan_teardown(void *);
-static errno_t test_add_device(void *, unsigned, void *);
-static errno_t test_remove_device(void *, unsigned);
-static void test_msg_note(void *, char *);
-static void test_msg_error(void *, char *);
-static void test_msg_warn(void *, char *);
-static void test_msg_debug(void *, char *);
-
-/** ata_channel_create() / ata_channel_destroy() can be called */
-PCUT_TEST(channel_create_destroy)
-{
-	ata_params_t params;
-	ata_channel_t *chan;
-	errno_t rc;
-
-	memset(&params, 0, sizeof(params));
-	params.write_data_16 = test_write_data_16;
-	params.read_data_16 = test_read_data_16;
-	params.write_cmd_8 = test_write_cmd_8;
-	params.read_cmd_8 = test_read_cmd_8;
-	params.write_ctl_8 = test_write_ctl_8;
-	params.read_ctl_8 = test_read_ctl_8;
-	params.irq_enable = test_irq_enable;
-	params.irq_disable = test_irq_disable;
-	params.dma_chan_setup = test_dma_chan_setup;
-	params.dma_chan_teardown = test_dma_chan_teardown;
-	params.add_device = test_add_device;
-	params.remove_device = test_remove_device;
-	params.msg_note = test_msg_note;
-	params.msg_error = test_msg_error;
-	params.msg_warn = test_msg_warn;
-	params.msg_debug = test_msg_debug;
-
-	chan = NULL;
-	rc = ata_channel_create(&params, &chan);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ata_channel_destroy(chan);
-}
-
-/** ata_channel_initialize() can be called */
-PCUT_TEST(channel_initialize)
-{
-	ata_params_t params;
-	ata_channel_t *chan;
-	errno_t rc;
-
-	memset(&params, 0, sizeof(params));
-	params.write_data_16 = test_write_data_16;
-	params.read_data_16 = test_read_data_16;
-	params.write_cmd_8 = test_write_cmd_8;
-	params.read_cmd_8 = test_read_cmd_8;
-	params.write_ctl_8 = test_write_ctl_8;
-	params.read_ctl_8 = test_read_ctl_8;
-	params.irq_enable = test_irq_enable;
-	params.irq_disable = test_irq_disable;
-	params.dma_chan_setup = test_dma_chan_setup;
-	params.dma_chan_teardown = test_dma_chan_teardown;
-	params.add_device = test_add_device;
-	params.remove_device = test_remove_device;
-	params.msg_note = test_msg_note;
-	params.msg_error = test_msg_error;
-	params.msg_warn = test_msg_warn;
-	params.msg_debug = test_msg_debug;
-
-	chan = NULL;
-	rc = ata_channel_create(&params, &chan);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ata_channel_initialize(chan);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ata_channel_destroy(chan);
-}
-
-static void test_write_data_16(void *arg, uint16_t *data, size_t nwords)
-{
-	(void)arg;
-	(void)data;
-	(void)nwords;
-}
-
-static void test_read_data_16(void *arg, uint16_t *buf, size_t nwords)
-{
-	(void)arg;
-	(void)buf;
-	(void)nwords;
-}
-
-static void test_write_cmd_8(void *arg, uint16_t off, uint8_t value)
-{
-	(void)arg;
-	(void)off;
-	(void)value;
-}
-
-static uint8_t test_read_cmd_8(void *arg, uint16_t off)
-{
-	(void)arg;
-
-	if (off == REG_STATUS) {
-		/*
-		 * This allows us to pass device initialization without
-		 * timing out.
-		 */
-		return SR_DRQ;
-	}
-	return 0;
-}
-
-static void test_write_ctl_8(void *arg, uint16_t off, uint8_t value)
-{
-	(void)arg;
-	(void)off;
-	(void)value;
-}
-
-static uint8_t test_read_ctl_8(void *arg, uint16_t off)
-{
-	(void)arg;
-	(void)off;
-	return 0;
-}
-
-static errno_t test_irq_enable(void *arg)
-{
-	(void)arg;
-	return EOK;
-}
-
-static errno_t test_irq_disable(void *arg)
-{
-	(void)arg;
-	return EOK;
-}
-
-static void test_dma_chan_setup(void *arg, void *buf, size_t buf_size,
-    ata_dma_dir_t dir)
-{
-	(void)arg;
-	(void)buf;
-	(void)buf_size;
-	(void)dir;
-}
-
-static void test_dma_chan_teardown(void *arg)
-{
-	(void)arg;
-}
-
-static errno_t test_add_device(void *arg, unsigned idx, void *charg)
-{
-	(void)arg;
-	(void)idx;
-	(void)charg;
-	return EOK;
-}
-
-static errno_t test_remove_device(void *arg, unsigned idx)
-{
-	(void)arg;
-	(void)idx;
-	return EOK;
-}
-
-static void test_msg_note(void *arg, char *msg)
-{
-	(void)arg;
-	(void)msg;
-}
-
-static void test_msg_error(void *arg, char *msg)
-{
-	(void)arg;
-	(void)msg;
-}
-
-static void test_msg_warn(void *arg, char *msg)
-{
-	(void)arg;
-	(void)msg;
-}
-
-static void test_msg_debug(void *arg, char *msg)
-{
-	(void)arg;
-	(void)msg;
-}
-
-PCUT_EXPORT(ata);
Index: pace/lib/ata/test/main.c
===================================================================
--- uspace/lib/ata/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(ata);
-
-PCUT_MAIN();
Index: pace/lib/bithenge/Makefile.linux
===================================================================
--- uspace/lib/bithenge/Makefile.linux	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-CFLAGS += -fexec-charset=UTF-8 -finput-charset=UTF-8 -std=gnu99 -pipe
-CFLAGS += -Wall -Wextra -Werror -Wno-clobbered -Wno-unused-parameter -Wmissing-prototypes -Werror-implicit-function-declaration -Wwrite-strings
-CFLAGS += -ftrapv
-CFLAGS += -g
-CFLAGS += -Iinclude
-
-LIBRARY = libbithenge.a
-
-SOURCES = \
-	src/blob.c \
-	src/compound.c \
-	src/expression.c \
-	src/file.c \
-	src/print.c \
-	src/script.c \
-	src/sequence.c \
-	src/source.c \
-	src/transform.c \
-	src/tree.c
-
-ifdef COVERAGE
-	CFLAGS += -fprofile-arcs -ftest-coverage
-endif
-
-ifdef FAILURE
-	CFLAGS += -DBITHENGE_FAILURE_ENABLE=1
-	SOURCES += src/failure.c
-endif
-
-OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
-
-$(LIBRARY): $(OBJECTS)
-	$(AR) rcs $@ $^
-
-clean:
-	find . -name '*.o' -follow -exec rm \{\} \;
-	rm -f $(LIBRARY)
Index: pace/lib/bithenge/include/bithenge/blob.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/blob.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Raw binary blobs.
- */
-
-#ifndef BITHENGE_BLOB_H_
-#define BITHENGE_BLOB_H_
-
-#include <offset.h>
-#include <errno.h>
-#include "tree.h"
-
-/** A blob of raw binary data.
- * @implements bithenge_node_t
- */
-typedef struct {
-	/** @privatesection */
-	struct bithenge_node_t base;
-} bithenge_blob_t;
-
-/** Operations providing random access to binary data.
- * @todo Should these be thread-safe?
- */
-typedef struct bithenge_random_access_blob_ops_t {
-	/** @copydoc bithenge_blob_t::bithenge_blob_size */
-	errno_t (*size)(bithenge_blob_t *self, aoff64_t *size);
-	/** @copydoc bithenge_blob_t::bithenge_blob_read */
-	errno_t (*read)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
-	    aoff64_t *size);
-	/** @copydoc bithenge_blob_t::bithenge_blob_read_bits */
-	errno_t (*read_bits)(bithenge_blob_t *self, aoff64_t offset, char *buffer,
-	    aoff64_t *size, bool little_endian);
-	/** Destroy the blob.
-	 * @param blob The blob.
-	 */
-	void (*destroy)(bithenge_blob_t *self);
-} bithenge_random_access_blob_ops_t;
-
-/** A blob built from an object that supports only sequential reading.
- * @implements bithenge_blob_t
- */
-typedef struct {
-	/** @privatesection */
-	/** The base random-access blob. */
-	bithenge_blob_t base;
-	/** Operations providing sequential access. */
-	const struct bithenge_sequential_blob_ops_t *ops;
-	/** Buffer containing all data read. */
-	char *buffer;
-	/** Size of buffer. */
-	aoff64_t buffer_size;
-	/** Amount of data actually in buffer. */
-	aoff64_t data_size;
-} bithenge_sequential_blob_t;
-
-/** Operations providing sequential access to binary data.
- * @memberof bithenge_sequential_blob_t
- */
-typedef struct bithenge_sequential_blob_ops_t {
-
-	/** Get the total size of the blob. If the total size cannot be
-	 * determined easily, this field may be null or return an error,
-	 * forcing the entire blob to be read to determine its size.
-	 *
-	 * @memberof bithenge_blob_t
-	 * @param self The blob.
-	 * @param[out] size Total size of the blob.
-	 * @return EOK on success or an error code from errno.h.
-	 */
-	errno_t (*size)(bithenge_sequential_blob_t *self, aoff64_t *size);
-
-	/** Read the next part of the blob. If the requested data extends
-	 * beyond the end of the blob, the data up until the end of the blob
-	 * will be read.
-	 *
-	 * @param self The blob.
-	 * @param[out] buffer Buffer to read into. If an error occurs, the contents are
-	 * undefined.
-	 * @param[in,out] size Number of bytes to read; may be 0. If not enough
-	 * data is left in the blob, the actual number of bytes read should be
-	 * stored here. If an error occurs, the contents are undefined.
-	 * @return EOK on success or an error code from errno.h.
-	 */
-	errno_t (*read)(bithenge_sequential_blob_t *self, char *buffer,
-	    aoff64_t *size);
-
-	/** Destroy the blob.
-	 * @param self The blob.
-	 */
-	void (*destroy)(bithenge_sequential_blob_t *self);
-} bithenge_sequential_blob_ops_t;
-
-/** Get the total size of the blob.
- *
- * @memberof bithenge_blob_t
- * @param self The blob.
- * @param[out] size Total size of the blob.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_blob_size(bithenge_blob_t *self, aoff64_t *size)
-{
-	assert(self);
-	assert(self->base.blob_ops);
-	return self->base.blob_ops->size(self, size);
-}
-
-/** Read part of the blob. If the requested data extends beyond the end of the
- * blob, the data up until the end of the blob will be read. If the offset is
- * beyond the end of the blob, even if the size is zero, an error will be
- * returned.
- *
- * @memberof bithenge_blob_t
- * @param self The blob.
- * @param offset Byte offset within the blob.
- * @param[out] buffer Buffer to read into. If an error occurs, the contents are
- * undefined.
- * @param[in,out] size Number of bytes to read; may be 0. If the requested
- * range extends beyond the end of the blob, the actual number of bytes read
- * should be stored here. If an error occurs, the contents are undefined.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_blob_read(bithenge_blob_t *self, aoff64_t offset,
-    char *buffer, aoff64_t *size)
-{
-	assert(self);
-	assert(self->base.blob_ops);
-	if (!self->base.blob_ops->read)
-		return EINVAL;
-	return self->base.blob_ops->read(self, offset, buffer, size);
-}
-
-/** Read part of the bit blob. If the requested data extends beyond the end of
- * the blob, the data up until the end of the blob will be read. If the offset
- * is beyond the end of the blob, even if the size is zero, an error will be
- * returned.
- *
- * @memberof bithenge_blob_t
- * @param self The blob.
- * @param offset Byte offset within the blob.
- * @param[out] buffer Buffer to read into. If an error occurs, the contents are
- * undefined.
- * @param[in,out] size Number of bytes to read; may be 0. If the requested
- * range extends beyond the end of the blob, the actual number of bytes read
- * should be stored here. If an error occurs, the contents are undefined.
- * @param little_endian If true, bytes will be filled starting at the least
- * significant bit; otherwise, they will be filled starting at the most
- * significant bit.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_blob_read_bits(bithenge_blob_t *self,
-    aoff64_t offset, char *buffer, aoff64_t *size, bool little_endian)
-{
-	assert(self);
-	assert(self->base.blob_ops);
-	if (!self->base.blob_ops->read_bits)
-		return EINVAL;
-	return self->base.blob_ops->read_bits(self, offset, buffer, size,
-	    little_endian);
-}
-
-/** Check whether the blob is empty.
- *
- * @memberof bithenge_blob_t
- * @param self The blob.
- * @param[out] out Holds whether the blob is empty.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_blob_empty(bithenge_blob_t *self, bool *out)
-{
-	assert(self);
-	assert(self->base.blob_ops);
-	aoff64_t size;
-	errno_t rc = bithenge_blob_size(self, &size);
-	*out = size == 0;
-	return rc;
-}
-
-/** Cast a blob node to a generic node.
- * @memberof bithenge_blob_t
- * @param blob The blob to cast.
- * @return The blob node as a generic node.
- */
-static inline bithenge_node_t *bithenge_blob_as_node(bithenge_blob_t *blob)
-{
-	return &blob->base;
-}
-
-/** Cast a generic node to a blob node.
- * @memberof bithenge_blob_t
- * @param node The node to cast, which must be a blob node.
- * @return The generic node as a blob node.
- */
-static inline bithenge_blob_t *bithenge_node_as_blob(bithenge_node_t *node)
-{
-	assert(node->type == BITHENGE_NODE_BLOB);
-	return (bithenge_blob_t *)node;
-}
-
-/** Increment a blob's reference count.
- * @param blob The blob to reference.
- */
-static inline void bithenge_blob_inc_ref(bithenge_blob_t *blob)
-{
-	bithenge_node_inc_ref(bithenge_blob_as_node(blob));
-}
-
-/** Decrement a blob's reference count.
- * @param blob The blob to dereference, or NULL.
- */
-static inline void bithenge_blob_dec_ref(bithenge_blob_t *blob)
-{
-	if (blob)
-		bithenge_node_dec_ref(bithenge_blob_as_node(blob));
-}
-
-/** @memberof bithenge_blob_t */
-errno_t bithenge_init_random_access_blob(bithenge_blob_t *,
-    const bithenge_random_access_blob_ops_t *);
-/** @memberof bithenge_sequential_blob_t */
-errno_t bithenge_init_sequential_blob(bithenge_sequential_blob_t *,
-    const bithenge_sequential_blob_ops_t *);
-/** @memberof bithenge_blob_t */
-errno_t bithenge_new_blob_from_data(bithenge_node_t **, const void *, size_t);
-/** @memberof bithenge_blob_t */
-errno_t bithenge_new_blob_from_buffer(bithenge_node_t **, const void *, size_t,
-    bool);
-errno_t bithenge_new_offset_blob(bithenge_node_t **, bithenge_blob_t *, aoff64_t);
-errno_t bithenge_new_subblob(bithenge_node_t **, bithenge_blob_t *, aoff64_t,
-    aoff64_t);
-/** @memberof bithenge_blob_t */
-errno_t bithenge_blob_equal(bool *, bithenge_blob_t *, bithenge_blob_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/compound.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/compound.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Compound transforms.
- */
-
-#ifndef BITHENGE_COMPOUND_H_
-#define BITHENGE_COMPOUND_H_
-
-#include "expression.h"
-#include "transform.h"
-
-errno_t bithenge_new_composed_transform(bithenge_transform_t **,
-    bithenge_transform_t **, size_t);
-errno_t bithenge_if_transform(bithenge_transform_t **, bithenge_expression_t *,
-    bithenge_transform_t *, bithenge_transform_t *);
-errno_t bithenge_partial_transform(bithenge_transform_t **,
-    bithenge_transform_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/expression.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/expression.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Expressions.
- */
-
-#ifndef BITHENGE_EXPRESSION_H_
-#define BITHENGE_EXPRESSION_H_
-
-#include "blob.h"
-#include "transform.h"
-#include "tree.h"
-
-/** An expression that calculates a value given a scope. */
-typedef struct {
-	/** @privatesection */
-	const struct bithenge_expression_ops *ops;
-	unsigned int refs;
-} bithenge_expression_t;
-
-/** Operations provided by an expression. */
-typedef struct bithenge_expression_ops {
-	/** @copydoc bithenge_expression_t::bithenge_expression_evaluate */
-	errno_t (*evaluate)(bithenge_expression_t *self, bithenge_scope_t *scope,
-	    bithenge_node_t **out);
-	/** Destroy the expression.
-	 * @param self The expression.
-	 */
-	void (*destroy)(bithenge_expression_t *self);
-} bithenge_expression_ops_t;
-
-/** Increment an expression's reference count.
- * @param self The expression to reference.
- */
-static inline void bithenge_expression_inc_ref(bithenge_expression_t *self)
-{
-	assert(self);
-	self->refs++;
-}
-
-/** Decrement an expression's reference count and free it if appropriate.
- * @param self The expression to dereference, or NULL.
- */
-static inline void bithenge_expression_dec_ref(bithenge_expression_t *self)
-{
-	if (!self)
-		return;
-	assert(self->ops);
-	assert(self->refs > 0);
-	if (--self->refs == 0)
-		self->ops->destroy(self);
-}
-
-/** Evaluate an expression. Takes ownership of nothing.
- * @memberof bithenge_expression_t
- * @param self The expression.
- * @param scope The scope.
- * @param[out] out Where the output tree will be stored.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_expression_evaluate(bithenge_expression_t *self,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	assert(self);
-	assert(self->ops);
-	return self->ops->evaluate(self, scope, out);
-}
-
-/** The binary operators supported by @a bithenge_binary_expression(). */
-typedef enum {
-	BITHENGE_EXPRESSION_INVALID_BINARY_OP,
-
-	BITHENGE_EXPRESSION_ADD,
-	BITHENGE_EXPRESSION_SUBTRACT,
-	BITHENGE_EXPRESSION_MULTIPLY,
-	BITHENGE_EXPRESSION_INTEGER_DIVIDE,
-	BITHENGE_EXPRESSION_MODULO,
-
-	BITHENGE_EXPRESSION_LESS_THAN,
-	BITHENGE_EXPRESSION_GREATER_THAN,
-	BITHENGE_EXPRESSION_LESS_THAN_OR_EQUAL,
-	BITHENGE_EXPRESSION_GREATER_THAN_OR_EQUAL,
-	BITHENGE_EXPRESSION_EQUALS,
-	BITHENGE_EXPRESSION_NOT_EQUALS,
-
-	BITHENGE_EXPRESSION_AND,
-	BITHENGE_EXPRESSION_OR,
-
-	BITHENGE_EXPRESSION_MEMBER,
-	BITHENGE_EXPRESSION_CONCAT,
-} bithenge_binary_op_t;
-
-errno_t bithenge_init_expression(bithenge_expression_t *,
-    const bithenge_expression_ops_t *);
-errno_t bithenge_binary_expression(bithenge_expression_t **, bithenge_binary_op_t,
-    bithenge_expression_t *, bithenge_expression_t *);
-errno_t bithenge_in_node_expression(bithenge_expression_t **);
-errno_t bithenge_current_node_expression(bithenge_expression_t **);
-errno_t bithenge_param_expression(bithenge_expression_t **, int);
-errno_t bithenge_const_expression(bithenge_expression_t **, bithenge_node_t *);
-errno_t bithenge_scope_member_expression(bithenge_expression_t **,
-    bithenge_node_t *);
-errno_t bithenge_subblob_expression(bithenge_expression_t **,
-    bithenge_expression_t *, bithenge_expression_t *, bithenge_expression_t *,
-    bool);
-errno_t bithenge_param_wrapper(bithenge_transform_t **, bithenge_transform_t *,
-    bithenge_expression_t **);
-errno_t bithenge_expression_transform(bithenge_transform_t **,
-    bithenge_expression_t *);
-errno_t bithenge_inputless_transform(bithenge_transform_t **,
-    bithenge_expression_t *);
-
-errno_t bithenge_concat_blob(bithenge_node_t **, bithenge_blob_t *,
-    bithenge_blob_t *);
-errno_t bithenge_concat_blob_lazy(bithenge_node_t **, bithenge_blob_t *,
-    bithenge_expression_t *, bithenge_scope_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/file.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/file.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Access files as blobs.
- */
-
-#ifndef BITHENGE_FILE_H_
-#define BITHENGE_FILE_H_
-
-#include <stdio.h>
-#include "blob.h"
-
-errno_t bithenge_new_file_blob(bithenge_node_t **, const char *);
-errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **, int);
-errno_t bithenge_new_file_blob_from_file(bithenge_node_t **, FILE *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/os.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/os.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BITHENGE_OS_H_
-#define BITHENGE_OS_H_
-
-#ifdef __HELENOS__
-#include <stdint.h>
-typedef int64_t bithenge_int_t;
-#define BITHENGE_PRId PRId64
-
-#else
-/* Assuming GNU/Linux system. */
-
-#include <inttypes.h>
-#include <stdbool.h>
-#define BITHENGE_PRId PRIdMAX
-typedef intmax_t bithenge_int_t;
-typedef uint64_t aoff64_t;
-#define EOK 0
-
-#endif
-
-#endif
Index: pace/lib/bithenge/include/bithenge/print.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/print.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Write a tree as JSON or other text formats.
- */
-
-#ifndef BITHENGE_PRINT_H_
-#define BITHENGE_PRINT_H_
-
-#include "tree.h"
-
-/** Specifies the format to be used when printing. */
-typedef enum {
-	/** Print a Python value. Note that internal nodes will be represented
-	 * as unordered dictionaries.
-	 */
-	BITHENGE_PRINT_PYTHON,
-	/** Print JSON. Due to the limitations of JSON, type information may be
-	 * lost.
-	 */
-	BITHENGE_PRINT_JSON,
-} bithenge_print_type_t;
-
-errno_t bithenge_print_node(bithenge_print_type_t, bithenge_node_t *);
-errno_t bithenge_print_node_to_string(char **, size_t *, bithenge_print_type_t,
-    bithenge_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/script.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/script.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Script parsing.
- */
-
-#ifndef BITHENGE_SCRIPT_H_
-#define BITHENGE_SCRIPT_H_
-
-#include "transform.h"
-
-errno_t bithenge_parse_script(const char *, bithenge_transform_t **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/sequence.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/sequence.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Sequence transforms.
- */
-
-#ifndef BITHENGE_SEQUENCE_H_
-#define BITHENGE_SEQUENCE_H_
-
-#include "transform.h"
-
-errno_t bithenge_new_struct(bithenge_transform_t **,
-    bithenge_named_transform_t *);
-errno_t bithenge_repeat_transform(bithenge_transform_t **, bithenge_transform_t *,
-    bithenge_expression_t *);
-errno_t bithenge_do_while_transform(bithenge_transform_t **,
-    bithenge_transform_t *, bithenge_expression_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/source.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/source.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Provide various external sources of data.
- */
-
-#ifndef BITHENGE_SOURCE_H_
-#define BITHENGE_SOURCE_H_
-
-#include "tree.h"
-
-errno_t bithenge_node_from_source(bithenge_node_t **, const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/transform.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/transform.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Transforms.
- */
-
-#ifndef BITHENGE_TRANSFORM_H_
-#define BITHENGE_TRANSFORM_H_
-
-#include "blob.h"
-#include "tree.h"
-
-/** A transform that creates a new tree from an old tree. */
-typedef struct {
-	/** @privatesection */
-	const struct bithenge_transform_ops *ops;
-	unsigned int refs;
-	int num_params;
-} bithenge_transform_t;
-
-/** Context and parameters used when applying transforms. */
-typedef struct bithenge_scope {
-	/** @privatesection */
-	unsigned int refs;
-	struct bithenge_scope *outer;
-	char *error;
-	bool barrier;
-	int num_params;
-	bithenge_node_t **params;
-	bithenge_node_t *current_node;
-	bithenge_node_t *in_node;
-} bithenge_scope_t;
-
-/** Increment a scope's reference count.
- * @memberof bithenge_scope_t
- * @param self The scope to reference.
- */
-static inline void bithenge_scope_inc_ref(bithenge_scope_t *self)
-{
-	assert(self);
-	self->refs++;
-}
-
-/** Operations that may be provided by a transform. All transforms must provide
- * apply and/or prefix_apply. To be used in struct transforms and repeat
- * transforms, transforms must provide prefix_length and/or prefix_apply.
- */
-typedef struct bithenge_transform_ops {
-	/** @copydoc bithenge_transform_t::bithenge_transform_apply */
-	errno_t (*apply)(bithenge_transform_t *self, bithenge_scope_t *scope,
-	    bithenge_node_t *in, bithenge_node_t **out);
-	/** @copydoc bithenge_transform_t::bithenge_transform_prefix_length */
-	errno_t (*prefix_length)(bithenge_transform_t *self,
-	    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out);
-	/** @copydoc bithenge_transform_t::bithenge_transform_prefix_apply */
-	errno_t (*prefix_apply)(bithenge_transform_t *self,
-	    bithenge_scope_t *scope, bithenge_blob_t *blob,
-	    bithenge_node_t **out_node, aoff64_t *out_size);
-	/** Destroy the transform.
-	 * @param self The transform.
-	 */
-	void (*destroy)(bithenge_transform_t *self);
-} bithenge_transform_ops_t;
-
-/** Get the number of parameters required by a transform. This number is used
- * by the parser and param-wrapper. Takes ownership of nothing.
- * @param self The transform.
- * @return The number of parameters required.
- */
-static inline int bithenge_transform_num_params(bithenge_transform_t *self)
-{
-	assert(self);
-	return self->num_params;
-}
-
-/** Increment a transform's reference count.
- * @param self The transform to reference.
- */
-static inline void bithenge_transform_inc_ref(bithenge_transform_t *self)
-{
-	assert(self);
-	self->refs++;
-}
-
-/** Decrement a transform's reference count and free it if appropriate.
- * @param self The transform to dereference, or NULL.
- */
-static inline void bithenge_transform_dec_ref(bithenge_transform_t *self)
-{
-	if (!self)
-		return;
-	assert(self->ops);
-	assert(self->refs > 0);
-	if (--self->refs == 0)
-		self->ops->destroy(self);
-}
-
-/** A transform with a name. */
-typedef struct {
-	/** The transform's name. */
-	const char *name;
-	/** The transform. */
-	bithenge_transform_t *transform;
-} bithenge_named_transform_t;
-
-/** Transform that decodes an 8-bit unsigned integer */
-extern bithenge_transform_t bithenge_uint8_transform;
-/** Transform that decodes a 16-bit little-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint16le_transform;
-/** Transform that decodes a 16-bit big-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint16be_transform;
-/** Transform that decodes a 32-bit little-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint32le_transform;
-/** Transform that decodes a 32-bit big-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint32be_transform;
-/** Transform that decodes a 64-bit little-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint64le_transform;
-/** Transform that decodes a 64-bit big-endian unsigned integer */
-extern bithenge_transform_t bithenge_uint64be_transform;
-
-/** @cond */
-extern bithenge_transform_t bithenge_ascii_transform;
-extern bithenge_transform_t bithenge_bit_transform;
-extern bithenge_transform_t bithenge_bits_be_transform;
-extern bithenge_transform_t bithenge_bits_le_transform;
-extern bithenge_transform_t bithenge_invalid_transform;
-extern bithenge_transform_t bithenge_known_length_transform;
-extern bithenge_transform_t bithenge_nonzero_boolean_transform;
-extern bithenge_transform_t bithenge_uint_le_transform;
-extern bithenge_transform_t bithenge_uint_be_transform;
-extern bithenge_transform_t bithenge_zero_terminated_transform;
-extern bithenge_named_transform_t *bithenge_primitive_transforms;
-/** @endcond */
-
-/** @memberof bithenge_transform_t */
-errno_t bithenge_init_transform(bithenge_transform_t *,
-    const bithenge_transform_ops_t *, int);
-/** @memberof bithenge_transform_t */
-errno_t bithenge_transform_apply(bithenge_transform_t *, bithenge_scope_t *,
-    bithenge_node_t *, bithenge_node_t **);
-/** @memberof bithenge_transform_t */
-errno_t bithenge_transform_prefix_length(bithenge_transform_t *,
-    bithenge_scope_t *, bithenge_blob_t *, aoff64_t *);
-/** @memberof bithenge_transform_t */
-errno_t bithenge_transform_prefix_apply(bithenge_transform_t *, bithenge_scope_t *,
-    bithenge_blob_t *, bithenge_node_t **, aoff64_t *);
-errno_t bithenge_new_barrier_transform(bithenge_transform_t **, int);
-errno_t bithenge_barrier_transform_set_subtransform(bithenge_transform_t *,
-    bithenge_transform_t *);
-
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_new(bithenge_scope_t **, bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-void bithenge_scope_dec_ref(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-bithenge_scope_t *bithenge_scope_outer(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-const char *bithenge_scope_get_error(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_error(bithenge_scope_t *, const char *, ...);
-/** @memberof bithenge_scope_t */
-bithenge_node_t *bithenge_scope_get_current_node(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-void bithenge_scope_set_current_node(bithenge_scope_t *, bithenge_node_t *);
-/** @memberof bithenge_scope_t */
-bithenge_node_t *bithenge_scope_in_node(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-void bithenge_scope_set_in_node(bithenge_scope_t *, bithenge_node_t *);
-/** @memberof bithenge_scope_t */
-void bithenge_scope_set_barrier(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-bool bithenge_scope_is_barrier(bithenge_scope_t *);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_alloc_params(bithenge_scope_t *, int);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_set_param(bithenge_scope_t *, int, bithenge_node_t *);
-/** @memberof bithenge_scope_t */
-errno_t bithenge_scope_get_param(bithenge_scope_t *, int, bithenge_node_t **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/include/bithenge/tree.h
===================================================================
--- uspace/lib/bithenge/include/bithenge/tree.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Trees and nodes.
- */
-
-#ifndef BITHENGE_TREE_H_
-#define BITHENGE_TREE_H_
-
-#include <assert.h>
-#include <stdbool.h>
-#include "os.h"
-
-/** Indicates the type of a tree node. */
-typedef enum {
-	/** An internal node with labelled edges to other nodes. */
-	BITHENGE_NODE_INTERNAL = 1,
-	/** A leaf node holding a boolean value. */
-	BITHENGE_NODE_BOOLEAN,
-	/** A leaf node holding an integer. */
-	BITHENGE_NODE_INTEGER,
-	/** A leaf node holding a string. */
-	BITHENGE_NODE_STRING,
-	/** A leaf node holding a binary blob. */
-	BITHENGE_NODE_BLOB,
-} bithenge_node_type_t;
-
-/** A tree node. It can have any of the types in @a bithenge_node_type_t. */
-typedef struct bithenge_node_t {
-	/** @privatesection */
-	bithenge_node_type_t type;
-	unsigned int refs;
-	union {
-		/** @privatesection */
-		const struct bithenge_internal_node_ops_t *internal_ops;
-		bool boolean_value;
-		bithenge_int_t integer_value;
-		struct {
-			/** @privatesection */
-			const char *ptr;
-			bool needs_free;
-		} string_value;
-		const struct bithenge_random_access_blob_ops_t *blob_ops;
-	};
-} bithenge_node_t;
-
-/** A callback function used to iterate over a node's children. It takes
- * ownership of a reference to both the key and the value.
- * @memberof bithenge_node_t
- * @param key The key.
- * @param value The value.
- * @param data Data provided to @a bithenge_node_t::bithenge_node_for_each.
- * @return EOK on success or an error code from errno.h.
- */
-typedef errno_t (*bithenge_for_each_func_t)(bithenge_node_t *key, bithenge_node_t *value, void *data);
-
-/** Operations providing access to an internal node. */
-typedef struct bithenge_internal_node_ops_t {
-	/** @copydoc bithenge_node_t::bithenge_node_for_each */
-	errno_t (*for_each)(bithenge_node_t *self, bithenge_for_each_func_t func, void *data);
-	/** @copydoc bithenge_node_t::bithenge_node_get */
-	errno_t (*get)(bithenge_node_t *self, bithenge_node_t *key,
-	    bithenge_node_t **out);
-	/** Destroys the internal node.
-	 * @param self The node to destroy.
-	 */
-	void (*destroy)(bithenge_node_t *self);
-} bithenge_internal_node_ops_t;
-
-/** Find the type of a node.
- * @memberof bithenge_node_t
- * @param node The node.
- * @return The type of the node.
- */
-static inline bithenge_node_type_t bithenge_node_type(const bithenge_node_t *node)
-{
-	return node->type;
-}
-
-/** Increment a node's reference count.
- * @memberof bithenge_node_t
- * @param node The node to reference.
- */
-static inline void bithenge_node_inc_ref(bithenge_node_t *node)
-{
-	assert(node);
-	node->refs++;
-}
-
-/** @memberof bithenge_node_t */
-void bithenge_node_dec_ref(bithenge_node_t *node);
-
-/** Iterate over a node's children.
- * @memberof bithenge_node_t
- * @param self The internal node to iterate over.
- * @param func The callback function.
- * @param data Data to provide to the callback function.
- * @return EOK on success or an error code from errno.h.
- */
-static inline errno_t bithenge_node_for_each(bithenge_node_t *self,
-    bithenge_for_each_func_t func, void *data)
-{
-	assert(self->type == BITHENGE_NODE_INTERNAL);
-	return self->internal_ops->for_each(self, func, data);
-}
-
-/** @memberof bithenge_node_t */
-errno_t bithenge_node_get(bithenge_node_t *, bithenge_node_t *,
-    bithenge_node_t **);
-
-/** Get the value of a boolean node.
- * @memberof bithenge_node_t
- * @param self The boolean node.
- * @return The node's value.
- */
-static inline bool bithenge_boolean_node_value(bithenge_node_t *self)
-{
-	assert(self->type == BITHENGE_NODE_BOOLEAN);
-	return self->boolean_value;
-}
-
-/** Get the value of an integer node.
- * @memberof bithenge_node_t
- * @param self The integer node.
- * @return The node's value.
- */
-static inline bithenge_int_t bithenge_integer_node_value(bithenge_node_t *self)
-{
-	assert(self->type == BITHENGE_NODE_INTEGER);
-	return self->integer_value;
-}
-
-/** Get the value of an string node.
- * @memberof bithenge_node_t
- * @param self The string node.
- * @return The node's value.
- */
-static inline const char *bithenge_string_node_value(bithenge_node_t *self)
-{
-	assert(self->type == BITHENGE_NODE_STRING);
-	return self->string_value.ptr;
-}
-
-/** @memberof bithenge_node_t */
-errno_t bithenge_init_internal_node(bithenge_node_t *,
-    const bithenge_internal_node_ops_t *);
-/** @memberof bithenge_node_t */
-errno_t bithenge_new_empty_internal_node(bithenge_node_t **);
-/** @memberof bithenge_node_t */
-errno_t bithenge_new_simple_internal_node(bithenge_node_t **, bithenge_node_t **,
-    bithenge_int_t, bool needs_free);
-/** @memberof bithenge_node_t */
-errno_t bithenge_new_boolean_node(bithenge_node_t **, bool);
-/** @memberof bithenge_node_t */
-errno_t bithenge_new_integer_node(bithenge_node_t **, bithenge_int_t);
-/** @memberof bithenge_node_t */
-errno_t bithenge_new_string_node(bithenge_node_t **, const char *, bool);
-/** @memberof bithenge_node_t */
-errno_t bithenge_node_equal(bool *, bithenge_node_t *, bithenge_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/meson.build
===================================================================
--- uspace/lib/bithenge/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2012 Sean Bartell
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block' ]
-c_args = [ '-D__HELENOS__' ]
-src = files(
-	'src/helenos/block.c',
-	'src/blob.c',
-	'src/compound.c',
-	'src/expression.c',
-	'src/file.c',
-	'src/print.c',
-	'src/script.c',
-	'src/sequence.c',
-	'src/source.c',
-	'src/transform.c',
-	'src/tree.c',
-)
Index: pace/lib/bithenge/src/blob.c
===================================================================
--- uspace/lib/bithenge/src/blob.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,492 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Raw binary blobs.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "common.h"
-#include <bithenge/blob.h>
-#include <bithenge/tree.h>
-
-/** Initialize a random access blob.
- * @memberof bithenge_blob_t
- * @param[out] blob The blob to initialize.
- * @param[in] ops Operations providing random access support. This pointer must
- * be valid until the blob is destroyed.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_init_random_access_blob(bithenge_blob_t *blob,
-    const bithenge_random_access_blob_ops_t *ops)
-{
-	assert(blob);
-	assert(ops);
-	assert(ops->destroy);
-	assert(ops->read || ops->read_bits);
-	assert(ops->size);
-
-	if (bithenge_should_fail())
-		return ENOMEM;
-
-	blob->base.type = BITHENGE_NODE_BLOB;
-	blob->base.refs = 1;
-	blob->base.blob_ops = ops;
-	return EOK;
-}
-
-static errno_t sequential_buffer(bithenge_sequential_blob_t *blob, aoff64_t end)
-{
-	bool need_realloc = false;
-	while (end > blob->buffer_size) {
-		blob->buffer_size = max(4096, 2 * blob->buffer_size);
-		need_realloc = true;
-	}
-	if (need_realloc) {
-		char *buffer = realloc(blob->buffer, blob->buffer_size);
-		if (!buffer)
-			return ENOMEM;
-		blob->buffer = buffer;
-	}
-	aoff64_t size = end - blob->data_size;
-	errno_t rc = blob->ops->read(blob, blob->buffer + blob->data_size, &size);
-	if (rc != EOK)
-		return rc;
-	blob->data_size += size;
-	return EOK;
-}
-
-static inline bithenge_sequential_blob_t *blob_as_sequential(
-    bithenge_blob_t *base)
-{
-	return (bithenge_sequential_blob_t *)base;
-}
-
-static inline bithenge_blob_t *sequential_as_blob(
-    bithenge_sequential_blob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t sequential_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	bithenge_sequential_blob_t *blob = blob_as_sequential(base);
-	errno_t rc;
-	if (blob->ops->size) {
-		rc = blob->ops->size(blob, size);
-		if (rc == EOK)
-			return EOK;
-	}
-	rc = sequential_buffer(blob, blob->buffer_size);
-	if (rc != EOK)
-		return rc;
-	while (blob->data_size == blob->buffer_size) {
-		rc = sequential_buffer(blob, 2 * blob->buffer_size);
-		if (rc != EOK)
-			return rc;
-	}
-	*size = blob->data_size;
-	return EOK;
-}
-
-static errno_t sequential_read(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size)
-{
-	bithenge_sequential_blob_t *blob = blob_as_sequential(base);
-	aoff64_t end = offset + *size;
-	if (end > blob->data_size) {
-		errno_t rc = sequential_buffer(blob, end);
-		if (rc != EOK)
-			return rc;
-	}
-	if (offset > blob->data_size)
-		return EINVAL;
-	*size = min(*size, blob->data_size - end);
-	memcpy(buffer, blob->buffer + offset, *size);
-	return EOK;
-}
-
-static void sequential_destroy(bithenge_blob_t *base)
-{
-	bithenge_sequential_blob_t *blob = blob_as_sequential(base);
-	free(blob->buffer);
-	blob->ops->destroy(blob);
-}
-
-static const bithenge_random_access_blob_ops_t sequential_ops = {
-	.size = sequential_size,
-	.read = sequential_read,
-	.destroy = sequential_destroy,
-};
-
-/** Initialize a sequential blob.
- * @memberof bithenge_sequential_blob_t
- * @param[out] blob The blob to initialize.
- * @param[in] ops Operations providing sequential access support. This pointer
- * must be valid until the blob is destroyed.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_init_sequential_blob(bithenge_sequential_blob_t *blob,
-    const bithenge_sequential_blob_ops_t *ops)
-{
-	assert(blob);
-	assert(ops);
-	assert(ops->destroy);
-	assert(ops->read);
-	// ops->size is optional
-
-	errno_t rc = bithenge_init_random_access_blob(sequential_as_blob(blob),
-	    &sequential_ops);
-	if (rc != EOK)
-		return rc;
-	blob->ops = ops;
-	blob->buffer = NULL; // realloc(NULL, ...) works like malloc
-	blob->buffer_size = 0;
-	blob->data_size = 0;
-	return EOK;
-}
-
-typedef struct {
-	bithenge_blob_t base;
-	const char *buffer;
-	size_t size;
-	bool needs_free;
-} memory_blob_t;
-
-static inline memory_blob_t *blob_as_memory(bithenge_blob_t *base)
-{
-	return (memory_blob_t *)base;
-}
-
-static inline bithenge_blob_t *memory_as_blob(memory_blob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t memory_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	memory_blob_t *blob = blob_as_memory(base);
-	if (bithenge_should_fail())
-		return EIO;
-	*size = blob->size;
-	return EOK;
-}
-
-static errno_t memory_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
-    aoff64_t *size)
-{
-	memory_blob_t *blob = blob_as_memory(base);
-	if (offset > blob->size)
-		return ELIMIT;
-	*size = min(*size, blob->size - offset);
-	memcpy(buffer, blob->buffer + offset, *size);
-	return EOK;
-}
-
-static void memory_destroy(bithenge_blob_t *base)
-{
-	memory_blob_t *blob = blob_as_memory(base);
-	if (blob->needs_free)
-		free((void *)blob->buffer);
-	free(blob);
-}
-
-static const bithenge_random_access_blob_ops_t memory_ops = {
-	.size = memory_size,
-	.read = memory_read,
-	.destroy = memory_destroy,
-};
-
-/** Create a blob node from a buffer. The buffer must exist as long as the blob
- * does. The blob must be freed with @a bithenge_node_t::bithenge_node_destroy
- * after it is used.
- * @memberof bithenge_blob_t
- * @param[out] out Stores the created blob node.
- * @param[in] buffer The buffer, which must not be changed until the blob is
- * destroyed.
- * @param len The length of the data.
- * @param needs_free If true, the buffer will be freed with free() if this
- * function fails or the blob is destroyed.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_blob_from_buffer(bithenge_node_t **out, const void *buffer,
-    size_t len, bool needs_free)
-{
-	errno_t rc;
-	assert(buffer || !len);
-
-	memory_blob_t *blob = malloc(sizeof(*blob));
-	if (!blob) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_random_access_blob(memory_as_blob(blob),
-	    &memory_ops);
-	if (rc != EOK)
-		goto error;
-	blob->buffer = buffer;
-	blob->size = len;
-	blob->needs_free = needs_free;
-	*out = bithenge_blob_as_node(memory_as_blob(blob));
-	return EOK;
-
-error:
-	if (needs_free)
-		free((void *)buffer);
-	free(blob);
-	return rc;
-}
-
-/** Create a blob node from data. Unlike with @a
- * bithenge_blob_t::bithenge_new_blob_from_buffer, the data is copied into a
- * new buffer and the original data can be changed after this call. The blob
- * must be freed with @a bithenge_node_t::bithenge_node_destroy after it is
- * used.
- * @memberof bithenge_blob_t
- * @param[out] out Stores the created blob node.
- * @param[in] data The data.
- * @param len The length of the data.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_blob_from_data(bithenge_node_t **out, const void *data,
-    size_t len)
-{
-	char *buffer = malloc(len);
-	if (!buffer)
-		return ENOMEM;
-	memcpy(buffer, data, len);
-
-	return bithenge_new_blob_from_buffer(out, buffer, len, true);
-}
-
-typedef struct {
-	bithenge_blob_t base;
-	bithenge_blob_t *source;
-	aoff64_t offset;
-	aoff64_t size;
-	bool size_matters;
-} subblob_t;
-
-static inline subblob_t *blob_as_subblob(bithenge_blob_t *base)
-{
-	return (subblob_t *)base;
-}
-
-static inline bithenge_blob_t *subblob_as_blob(subblob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t subblob_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	subblob_t *blob = blob_as_subblob(base);
-	if (blob->size_matters) {
-		*size = blob->size;
-		return EOK;
-	} else {
-		errno_t rc = bithenge_blob_size(blob->source, size);
-		*size -= blob->offset;
-		return rc;
-	}
-}
-
-static errno_t subblob_read(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size)
-{
-	subblob_t *blob = blob_as_subblob(base);
-	if (blob->size_matters) {
-		if (offset > blob->size)
-			return EINVAL;
-		*size = min(*size, blob->size - offset);
-	}
-	offset += blob->offset;
-	return bithenge_blob_read(blob->source, offset, buffer, size);
-}
-
-static errno_t subblob_read_bits(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size, bool little_endian)
-{
-	subblob_t *blob = blob_as_subblob(base);
-	if (blob->size_matters) {
-		if (offset > blob->size)
-			return EINVAL;
-		*size = min(*size, blob->size - offset);
-	}
-	offset += blob->offset;
-	return bithenge_blob_read_bits(blob->source, offset, buffer, size,
-	    little_endian);
-}
-
-static void subblob_destroy(bithenge_blob_t *base)
-{
-	subblob_t *blob = blob_as_subblob(base);
-	bithenge_blob_dec_ref(blob->source);
-	free(blob);
-}
-
-static const bithenge_random_access_blob_ops_t subblob_ops = {
-	.size = subblob_size,
-	.read = subblob_read,
-	.read_bits = subblob_read_bits,
-	.destroy = subblob_destroy,
-};
-
-static bool is_subblob(bithenge_blob_t *blob)
-{
-	return blob->base.blob_ops == &subblob_ops;
-}
-
-static errno_t new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
-    aoff64_t offset, aoff64_t size, bool size_matters)
-{
-	assert(out);
-	assert(source);
-	errno_t rc;
-	subblob_t *blob = 0;
-
-	if (is_subblob(source)) {
-		/* We can do some optimizations this way */
-		if (!size_matters)
-			size = 0;
-		subblob_t *source_subblob = blob_as_subblob(source);
-		if (source_subblob->size_matters &&
-		    offset + size > source_subblob->size) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		if (source->base.refs == 1) {
-			source_subblob->offset += offset;
-			source_subblob->size -= offset;
-			if (size_matters) {
-				source_subblob->size_matters = true;
-				source_subblob->size = size;
-			}
-			*out = bithenge_blob_as_node(source);
-			return EOK;
-		}
-
-		if (!size_matters && source_subblob->size_matters) {
-			size_matters = true;
-			size = source_subblob->size - offset;
-		}
-		offset += source_subblob->offset;
-		source = source_subblob->source;
-		bithenge_blob_inc_ref(source);
-		bithenge_blob_dec_ref(subblob_as_blob(source_subblob));
-	}
-
-	blob = malloc(sizeof(*blob));
-	if (!blob) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_random_access_blob(subblob_as_blob(blob),
-	    &subblob_ops);
-	if (rc != EOK)
-		goto error;
-	blob->source = source;
-	blob->offset = offset;
-	blob->size = size;
-	blob->size_matters = size_matters;
-	*out = bithenge_blob_as_node(subblob_as_blob(blob));
-	return EOK;
-
-error:
-	bithenge_blob_dec_ref(source);
-	free(blob);
-	return rc;
-}
-
-/** Create a blob from data offset within another blob. This function takes
- * ownership of a reference to @a blob.
- * @param[out] out Stores the created blob node. On error, this is unchanged.
- * @param[in] source The input blob.
- * @param offset The offset within the input blob at which the new blob will start.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_offset_blob(bithenge_node_t **out, bithenge_blob_t *source,
-    aoff64_t offset)
-{
-	return new_subblob(out, source, offset, 0, false);
-}
-
-/** Create a blob from part of another blob. This function takes ownership of a
- * reference to @a blob.
- * @param[out] out Stores the created blob node. On error, this is unchanged.
- * @param[in] source The input blob.
- * @param offset The offset within the input blob at which the new blob will start.
- * @param size The size of the new blob.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_subblob(bithenge_node_t **out, bithenge_blob_t *source,
-    aoff64_t offset, aoff64_t size)
-{
-	return new_subblob(out, source, offset, size, true);
-}
-
-/** Check whether the contents of two blobs are equal.
- * @memberof bithenge_blob_t
- * @param[out] out Holds whether the blobs are equal.
- * @param a, b Blobs to compare.
- * @return EOK on success, or an error code from errno.h.
- */
-errno_t bithenge_blob_equal(bool *out, bithenge_blob_t *a, bithenge_blob_t *b)
-{
-	assert(a);
-	assert(a->base.blob_ops);
-	assert(b);
-	assert(b->base.blob_ops);
-	errno_t rc;
-	char buffer_a[4096], buffer_b[4096];
-	aoff64_t offset = 0, size_a = sizeof(buffer_a), size_b = sizeof(buffer_b);
-	do {
-		rc = bithenge_blob_read(a, offset, buffer_a, &size_a);
-		if (rc != EOK)
-			return rc;
-		rc = bithenge_blob_read(b, offset, buffer_b, &size_b);
-		if (rc != EOK)
-			return rc;
-		if (size_a != size_b || memcmp(buffer_a, buffer_b, size_a) != 0) {
-			*out = false;
-			return EOK;
-		}
-		offset += size_a;
-	} while (size_a == sizeof(buffer_a));
-	*out = true;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/common.h
===================================================================
--- uspace/lib/bithenge/src/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BITHENGE_COMMON_H_
-#define BITHENGE_COMMON_H_
-
-#ifdef __HELENOS__
-#include "helenos/common.h"
-#else
-#include "linux/common.h"
-#endif
-
-#ifdef BITHENGE_FAILURE_ENABLE
-#include "failure.h"
-#else
-static inline errno_t bithenge_should_fail(void)
-{
-	return 0;
-}
-#endif
-
-#endif
Index: pace/lib/bithenge/src/compound.c
===================================================================
--- uspace/lib/bithenge/src/compound.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,341 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Compound transforms.
- */
-
-#include <stdlib.h>
-#include <bithenge/compound.h>
-#include <bithenge/expression.h>
-#include <bithenge/transform.h>
-#include <bithenge/tree.h>
-#include "common.h"
-
-/*
- * compose_transform
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_transform_t **xforms;
-	size_t num;
-} compose_transform_t;
-
-static bithenge_transform_t *compose_as_transform(compose_transform_t *xform)
-{
-	return &xform->base;
-}
-
-static compose_transform_t *transform_as_compose(bithenge_transform_t *xform)
-{
-	return (compose_transform_t *)xform;
-}
-
-static errno_t compose_apply(bithenge_transform_t *base, bithenge_scope_t *scope,
-    bithenge_node_t *in, bithenge_node_t **out)
-{
-	errno_t rc;
-	compose_transform_t *self = transform_as_compose(base);
-	bithenge_node_inc_ref(in);
-
-	/* i ranges from (self->num - 1) to 0 inside the loop. */
-	size_t i = self->num;
-	while (i-- != 0) {
-		bithenge_node_t *tmp;
-		rc = bithenge_transform_apply(self->xforms[i], scope, in,
-		    &tmp);
-		bithenge_node_dec_ref(in);
-		if (rc != EOK)
-			return rc;
-		in = tmp;
-	}
-
-	*out = in;
-	return EOK;
-}
-
-static errno_t compose_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
-{
-	compose_transform_t *self = transform_as_compose(base);
-	return bithenge_transform_prefix_length(self->xforms[self->num - 1],
-	    scope, blob, out);
-}
-
-static void compose_destroy(bithenge_transform_t *base)
-{
-	compose_transform_t *self = transform_as_compose(base);
-	for (size_t i = 0; i < self->num; i++)
-		bithenge_transform_dec_ref(self->xforms[i]);
-	free(self->xforms);
-	free(self);
-}
-
-static const bithenge_transform_ops_t compose_transform_ops = {
-	.apply = compose_apply,
-	.prefix_length = compose_prefix_length,
-	.destroy = compose_destroy,
-};
-
-/** Create a composition of multiple transforms. When the result is applied to a
- * node, each transform is applied in turn, with the last transform applied
- * first. @a xforms may contain any number of transforms or no transforms at
- * all. This function takes ownership of @a xforms and the references therein.
- * @param[out] out Holds the result.
- * @param[in] xforms The transforms to apply.
- * @param num The number of transforms.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_composed_transform(bithenge_transform_t **out,
-    bithenge_transform_t **xforms, size_t num)
-{
-	if (num == 0) {
-		/* TODO: optimize */
-	} else if (num == 1) {
-		*out = xforms[0];
-		free(xforms);
-		return EOK;
-	}
-
-	errno_t rc;
-	compose_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_transform(compose_as_transform(self),
-	    &compose_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-	self->xforms = xforms;
-	self->num = num;
-	*out = compose_as_transform(self);
-	return EOK;
-error:
-	for (size_t i = 0; i < num; i++)
-		bithenge_transform_dec_ref(xforms[i]);
-	free(xforms);
-	free(self);
-	return rc;
-}
-
-/*
- * if_transform
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_expression_t *expr;
-	bithenge_transform_t *true_xform, *false_xform;
-} if_transform_t;
-
-static inline bithenge_transform_t *if_as_transform(if_transform_t *self)
-{
-	return &self->base;
-}
-
-static inline if_transform_t *transform_as_if(bithenge_transform_t *base)
-{
-	return (if_transform_t *)base;
-}
-
-static errno_t if_transform_choose(if_transform_t *self, bithenge_scope_t *scope,
-    bool *out)
-{
-	bithenge_node_t *cond_node;
-	errno_t rc = bithenge_expression_evaluate(self->expr, scope, &cond_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(cond_node) != BITHENGE_NODE_BOOLEAN) {
-		bithenge_node_dec_ref(cond_node);
-		return EINVAL;
-	}
-	*out = bithenge_boolean_node_value(cond_node);
-	bithenge_node_dec_ref(cond_node);
-	return EOK;
-}
-
-static errno_t if_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	if_transform_t *self = transform_as_if(base);
-	bool cond;
-	errno_t rc = if_transform_choose(self, scope, &cond);
-	if (rc != EOK)
-		return rc;
-	return bithenge_transform_apply(
-	    cond ? self->true_xform : self->false_xform, scope, in, out);
-}
-
-static errno_t if_transform_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
-{
-	if_transform_t *self = transform_as_if(base);
-	bool cond;
-	errno_t rc = if_transform_choose(self, scope, &cond);
-	if (rc != EOK)
-		return rc;
-	return bithenge_transform_prefix_length(
-	    cond ? self->true_xform : self->false_xform, scope, in, out);
-}
-
-static void if_transform_destroy(bithenge_transform_t *base)
-{
-	if_transform_t *self = transform_as_if(base);
-	bithenge_expression_dec_ref(self->expr);
-	bithenge_transform_dec_ref(self->true_xform);
-	bithenge_transform_dec_ref(self->false_xform);
-	free(self);
-}
-
-static const bithenge_transform_ops_t if_transform_ops = {
-	.apply = if_transform_apply,
-	.prefix_length = if_transform_prefix_length,
-	.destroy = if_transform_destroy,
-};
-
-/** Create a transform that applies either of two transforms depending on a
- * boolean expression. Takes references to @a expr, @a true_xform, and
- * @a false_xform.
- * @param[out] out Holds the new transform.
- * @param expr The boolean expression to evaluate.
- * @param true_xform The transform to apply if the expression is true.
- * @param false_xform The transform to apply if the expression is false.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_if_transform(bithenge_transform_t **out,
-    bithenge_expression_t *expr, bithenge_transform_t *true_xform,
-    bithenge_transform_t *false_xform)
-{
-	errno_t rc;
-	if_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(if_as_transform(self), &if_transform_ops,
-	    0);
-	if (rc != EOK)
-		goto error;
-
-	self->expr = expr;
-	self->true_xform = true_xform;
-	self->false_xform = false_xform;
-	*out = if_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_expression_dec_ref(expr);
-	bithenge_transform_dec_ref(true_xform);
-	bithenge_transform_dec_ref(false_xform);
-	return rc;
-}
-
-/*
- * partial_transform
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_transform_t *xform;
-} partial_transform_t;
-
-static inline bithenge_transform_t *partial_as_transform(
-    partial_transform_t *self)
-{
-	return &self->base;
-}
-
-static inline partial_transform_t *transform_as_partial(
-    bithenge_transform_t *base)
-{
-	return (partial_transform_t *)base;
-}
-
-static errno_t partial_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	partial_transform_t *self = transform_as_partial(base);
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	return bithenge_transform_prefix_apply(self->xform, scope,
-	    bithenge_node_as_blob(in), out, NULL);
-}
-
-static void partial_transform_destroy(bithenge_transform_t *base)
-{
-	partial_transform_t *self = transform_as_partial(base);
-	bithenge_transform_dec_ref(self->xform);
-	free(self);
-}
-
-static const bithenge_transform_ops_t partial_transform_ops = {
-	.apply = partial_transform_apply,
-	.destroy = partial_transform_destroy,
-};
-
-/** Create a transform that doesn't require its subtransform to use the whole
- * input. Takes a reference to @a xform.
- * @param[out] out Holds the new transform.
- * @param xform The subtransform to apply.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_partial_transform(bithenge_transform_t **out,
-    bithenge_transform_t *xform)
-{
-	errno_t rc;
-	partial_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(partial_as_transform(self),
-	    &partial_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->xform = xform;
-	*out = partial_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_transform_dec_ref(xform);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/expression.c
===================================================================
--- uspace/lib/bithenge/src/expression.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1217 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Expressions.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "common.h"
-#include <bithenge/blob.h>
-#include <bithenge/expression.h>
-#include <bithenge/transform.h>
-#include <bithenge/tree.h>
-
-/** Initialize a new expression.
- * @param[out] self Expression to initialize.
- * @param[in] ops Operations provided by the expression.
- * @return EOK or an error code from errno.h.
- */
-errno_t bithenge_init_expression(bithenge_expression_t *self,
-    const bithenge_expression_ops_t *ops)
-{
-	assert(ops);
-	assert(ops->evaluate);
-	assert(ops->destroy);
-	if (bithenge_should_fail())
-		return ENOMEM;
-	self->ops = ops;
-	self->refs = 1;
-	return EOK;
-}
-
-static void expression_indestructible(bithenge_expression_t *self)
-{
-	assert(false);
-}
-
-/*
- * binary_expression
- */
-
-typedef struct {
-	bithenge_expression_t base;
-	bithenge_binary_op_t op;
-	bithenge_expression_t *a, *b;
-} binary_expression_t;
-
-static inline binary_expression_t *expression_as_binary(
-    bithenge_expression_t *base)
-{
-	return (binary_expression_t *)base;
-}
-
-static inline bithenge_expression_t *binary_as_expression(
-    binary_expression_t *self)
-{
-	return &self->base;
-}
-
-static errno_t binary_expression_evaluate(bithenge_expression_t *base,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	errno_t rc;
-	binary_expression_t *self = expression_as_binary(base);
-	bithenge_node_t *a, *b;
-	rc = bithenge_expression_evaluate(self->a, scope, &a);
-	if (rc != EOK)
-		return rc;
-	if (self->op != BITHENGE_EXPRESSION_CONCAT) {
-		rc = bithenge_expression_evaluate(self->b, scope, &b);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(a);
-			return rc;
-		}
-	}
-
-	/* Check types and get values. */
-	/* Assigning 0 only to make the compiler happy. */
-	bithenge_int_t a_int = 0, b_int = 0;
-	bool a_bool = false, b_bool = false, out_bool = false;
-	switch (self->op) {
-	case BITHENGE_EXPRESSION_ADD: /* fallthrough */
-	case BITHENGE_EXPRESSION_SUBTRACT: /* fallthrough */
-	case BITHENGE_EXPRESSION_MULTIPLY: /* fallthrough */
-	case BITHENGE_EXPRESSION_INTEGER_DIVIDE: /* fallthrough */
-	case BITHENGE_EXPRESSION_MODULO: /* fallthrough */
-	case BITHENGE_EXPRESSION_LESS_THAN: /* fallthrough */
-	case BITHENGE_EXPRESSION_LESS_THAN_OR_EQUAL: /* fallthrough */
-	case BITHENGE_EXPRESSION_GREATER_THAN: /* fallthrough */
-	case BITHENGE_EXPRESSION_GREATER_THAN_OR_EQUAL:
-		rc = EINVAL;
-		if (bithenge_node_type(a) != BITHENGE_NODE_INTEGER)
-			goto error;
-		if (bithenge_node_type(b) != BITHENGE_NODE_INTEGER)
-			goto error;
-		a_int = bithenge_integer_node_value(a);
-		b_int = bithenge_integer_node_value(b);
-		break;
-	case BITHENGE_EXPRESSION_AND: /* fallthrough */
-	case BITHENGE_EXPRESSION_OR:
-		rc = EINVAL;
-		if (bithenge_node_type(a) != BITHENGE_NODE_BOOLEAN)
-			goto error;
-		if (bithenge_node_type(b) != BITHENGE_NODE_BOOLEAN)
-			goto error;
-		a_bool = bithenge_boolean_node_value(a);
-		b_bool = bithenge_boolean_node_value(b);
-		break;
-	case BITHENGE_EXPRESSION_CONCAT:
-		if (bithenge_node_type(a) != BITHENGE_NODE_BLOB)
-			goto error;
-		break;
-	default:
-		break;
-	}
-
-	switch (self->op) {
-	case BITHENGE_EXPRESSION_ADD:
-		rc = bithenge_new_integer_node(out, a_int + b_int);
-		break;
-	case BITHENGE_EXPRESSION_SUBTRACT:
-		rc = bithenge_new_integer_node(out, a_int - b_int);
-		break;
-	case BITHENGE_EXPRESSION_MULTIPLY:
-		rc = bithenge_new_integer_node(out, a_int * b_int);
-		break;
-	case BITHENGE_EXPRESSION_INTEGER_DIVIDE:
-		/*
-		 * Integer division can behave in three major ways when the
-		 * operands are signed: truncated, floored, or Euclidean. When
-		 * b > 0, we give the same result as floored and Euclidean;
-		 * otherwise, we currently raise an error. See
-		 * https://en.wikipedia.org/wiki/Modulo_operation and its
-		 * references.
-		 */
-		if (b_int <= 0) {
-			rc = EINVAL;
-			break;
-		}
-		rc = bithenge_new_integer_node(out,
-		    (a_int / b_int) + (a_int % b_int < 0 ? -1 : 0));
-		break;
-	case BITHENGE_EXPRESSION_MODULO:
-		/* This is consistent with division; see above. */
-		if (b_int <= 0) {
-			rc = EINVAL;
-			break;
-		}
-		rc = bithenge_new_integer_node(out,
-		    (a_int % b_int) + (a_int % b_int < 0 ? b_int : 0));
-		break;
-	case BITHENGE_EXPRESSION_LESS_THAN:
-		rc = bithenge_new_boolean_node(out, a_int < b_int);
-		break;
-	case BITHENGE_EXPRESSION_LESS_THAN_OR_EQUAL:
-		rc = bithenge_new_boolean_node(out, a_int <= b_int);
-		break;
-	case BITHENGE_EXPRESSION_GREATER_THAN:
-		rc = bithenge_new_boolean_node(out, a_int > b_int);
-		break;
-	case BITHENGE_EXPRESSION_GREATER_THAN_OR_EQUAL:
-		rc = bithenge_new_boolean_node(out, a_int >= b_int);
-		break;
-	case BITHENGE_EXPRESSION_EQUALS:
-		rc = bithenge_node_equal(&out_bool, a, b);
-		if (rc != EOK)
-			break;
-		rc = bithenge_new_boolean_node(out, out_bool);
-		break;
-	case BITHENGE_EXPRESSION_NOT_EQUALS:
-		rc = bithenge_node_equal(&out_bool, a, b);
-		if (rc != EOK)
-			break;
-		rc = bithenge_new_boolean_node(out, !out_bool);
-		break;
-	case BITHENGE_EXPRESSION_AND:
-		rc = bithenge_new_boolean_node(out, a_bool && b_bool);
-		break;
-	case BITHENGE_EXPRESSION_OR:
-		rc = bithenge_new_boolean_node(out, a_bool || b_bool);
-		break;
-	case BITHENGE_EXPRESSION_MEMBER:
-		rc = bithenge_node_get(a, b, out);
-		b = NULL;
-		break;
-	case BITHENGE_EXPRESSION_CONCAT:
-		bithenge_expression_inc_ref(self->b);
-		bithenge_scope_inc_ref(scope);
-		rc = bithenge_concat_blob_lazy(out, bithenge_node_as_blob(a),
-		    self->b, scope);
-		a = NULL;
-		b = NULL;
-		break;
-	case BITHENGE_EXPRESSION_INVALID_BINARY_OP:
-		assert(false);
-		break;
-	}
-
-error:
-	bithenge_node_dec_ref(a);
-	bithenge_node_dec_ref(b);
-	return rc;
-}
-
-static void binary_expression_destroy(bithenge_expression_t *base)
-{
-	binary_expression_t *self = expression_as_binary(base);
-	bithenge_expression_dec_ref(self->a);
-	bithenge_expression_dec_ref(self->b);
-	free(self);
-}
-
-static const bithenge_expression_ops_t binary_expression_ops = {
-	.evaluate = binary_expression_evaluate,
-	.destroy = binary_expression_destroy,
-};
-
-/** Create a binary expression. Takes ownership of @a a and @a b.
- * @param[out] out Holds the new expression.
- * @param op The operator to apply.
- * @param a The first operand.
- * @param b The second operand.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_binary_expression(bithenge_expression_t **out,
-    bithenge_binary_op_t op, bithenge_expression_t *a,
-    bithenge_expression_t *b)
-{
-	errno_t rc;
-	binary_expression_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_expression(binary_as_expression(self),
-	    &binary_expression_ops);
-	if (rc != EOK)
-		goto error;
-
-	self->op = op;
-	self->a = a;
-	self->b = b;
-	*out = binary_as_expression(self);
-	return EOK;
-
-error:
-	bithenge_expression_dec_ref(a);
-	bithenge_expression_dec_ref(b);
-	free(self);
-	return rc;
-}
-
-/*
- * in_node_expression
- */
-
-static errno_t in_node_evaluate(bithenge_expression_t *self,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	for (; scope; scope = bithenge_scope_outer(scope)) {
-		*out = bithenge_scope_in_node(scope);
-		if (*out)
-			return EOK;
-	}
-	return EINVAL;
-}
-
-static const bithenge_expression_ops_t in_node_ops = {
-	.evaluate = in_node_evaluate,
-	.destroy = expression_indestructible,
-};
-
-static bithenge_expression_t in_node_expression = {
-	&in_node_ops, 1
-};
-
-/** Create an expression that gets the current input node.
- * @param[out] out Holds the new expression.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_in_node_expression(bithenge_expression_t **out)
-{
-	if (bithenge_should_fail())
-		return ENOMEM;
-	bithenge_expression_inc_ref(&in_node_expression);
-	*out = &in_node_expression;
-	return EOK;
-}
-
-/*
- * current_node_expression
- */
-
-static errno_t current_node_evaluate(bithenge_expression_t *self,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	*out = bithenge_scope_get_current_node(scope);
-	if (!*out)
-		return EINVAL;
-	return EOK;
-}
-
-static const bithenge_expression_ops_t current_node_ops = {
-	.evaluate = current_node_evaluate,
-	.destroy = expression_indestructible,
-};
-
-static bithenge_expression_t current_node_expression = {
-	&current_node_ops, 1
-};
-
-/** Create an expression that gets the current node being created.
- * @param[out] out Holds the new expression.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_current_node_expression(bithenge_expression_t **out)
-{
-	bithenge_expression_inc_ref(&current_node_expression);
-	*out = &current_node_expression;
-	return EOK;
-}
-
-/*
- * param_expression
- */
-
-typedef struct {
-	bithenge_expression_t base;
-	int index;
-} param_expression_t;
-
-static inline param_expression_t *expression_as_param(
-    bithenge_expression_t *base)
-{
-	return (param_expression_t *)base;
-}
-
-static inline bithenge_expression_t *param_as_expression(
-    param_expression_t *self)
-{
-	return &self->base;
-}
-
-static errno_t param_expression_evaluate(bithenge_expression_t *base,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	param_expression_t *self = expression_as_param(base);
-	return bithenge_scope_get_param(scope, self->index, out);
-}
-
-static void param_expression_destroy(bithenge_expression_t *base)
-{
-	param_expression_t *self = expression_as_param(base);
-	free(self);
-}
-
-static const bithenge_expression_ops_t param_expression_ops = {
-	.evaluate = param_expression_evaluate,
-	.destroy = param_expression_destroy,
-};
-
-/** Create an expression that returns a parameter.
- * @param[out] out Holds the created expression.
- * @param index The index of the parameter to get.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_param_expression(bithenge_expression_t **out, int index)
-{
-	errno_t rc;
-	param_expression_t *self = malloc(sizeof(*self));
-	if (!self)
-		return ENOMEM;
-
-	rc = bithenge_init_expression(param_as_expression(self),
-	    &param_expression_ops);
-	if (rc != EOK) {
-		free(self);
-		return rc;
-	}
-
-	self->index = index;
-	*out = param_as_expression(self);
-	return EOK;
-}
-
-/*
- * const_expression
- */
-
-typedef struct {
-	bithenge_expression_t base;
-	bithenge_node_t *node;
-} const_expression_t;
-
-static inline const_expression_t *expression_as_const(
-    bithenge_expression_t *base)
-{
-	return (const_expression_t *)base;
-}
-
-static inline bithenge_expression_t *const_as_expression(
-    const_expression_t *self)
-{
-	return &self->base;
-}
-
-static errno_t const_expression_evaluate(bithenge_expression_t *base,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	const_expression_t *self = expression_as_const(base);
-	bithenge_node_inc_ref(self->node);
-	*out = self->node;
-	return EOK;
-}
-
-static void const_expression_destroy(bithenge_expression_t *base)
-{
-	const_expression_t *self = expression_as_const(base);
-	bithenge_node_dec_ref(self->node);
-	free(self);
-}
-
-static const bithenge_expression_ops_t const_expression_ops = {
-	.evaluate = const_expression_evaluate,
-	.destroy = const_expression_destroy,
-};
-
-/** Create an expression that returns a constant. Takes a reference to @a node.
- * @param[out] out Holds the created expression.
- * @param node The constant.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_const_expression(bithenge_expression_t **out,
-    bithenge_node_t *node)
-{
-	errno_t rc;
-	const_expression_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_expression(const_as_expression(self),
-	    &const_expression_ops);
-	if (rc != EOK)
-		goto error;
-
-	self->node = node;
-	*out = const_as_expression(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_node_dec_ref(node);
-	return rc;
-}
-
-/*
- * scope_member_expression
- */
-
-typedef struct {
-	bithenge_expression_t base;
-	bithenge_node_t *key;
-} scope_member_expression_t;
-
-static scope_member_expression_t *expression_as_scope_member(
-    bithenge_expression_t *base)
-{
-	return (scope_member_expression_t *)base;
-}
-
-static bithenge_expression_t *scope_member_as_expression(
-    scope_member_expression_t *expr)
-{
-	return &expr->base;
-}
-
-static errno_t scope_member_expression_evaluate(bithenge_expression_t *base,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	scope_member_expression_t *self = expression_as_scope_member(base);
-	for (; scope && !bithenge_scope_is_barrier(scope);
-	    scope = bithenge_scope_outer(scope)) {
-		bithenge_node_t *cur = bithenge_scope_get_current_node(scope);
-		if (!cur)
-			continue;
-		bithenge_node_inc_ref(self->key);
-		errno_t rc = bithenge_node_get(cur, self->key, out);
-		bithenge_node_dec_ref(cur);
-		if (rc != ENOENT) /* EOK or error */
-			return rc;
-	}
-	return bithenge_scope_error(scope, "No scope member %t", self->key);
-}
-
-static void scope_member_expression_destroy(bithenge_expression_t *base)
-{
-	scope_member_expression_t *self = expression_as_scope_member(base);
-	bithenge_node_dec_ref(self->key);
-	free(self);
-}
-
-static const bithenge_expression_ops_t scope_member_expression_ops = {
-	.evaluate = scope_member_expression_evaluate,
-	.destroy = scope_member_expression_destroy,
-};
-
-/** Create an expression that gets a member from one of the current nodes being
- * created. It searches from the current scope outwards, stopping at barrier
- * scopes.
- * @param[out] out Holds the new expression.
- * @param key The key to search for in nodes being created.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_scope_member_expression(bithenge_expression_t **out,
-    bithenge_node_t *key)
-{
-	errno_t rc;
-	scope_member_expression_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_expression(scope_member_as_expression(self),
-	    &scope_member_expression_ops);
-	if (rc != EOK)
-		goto error;
-
-	self->key = key;
-	*out = scope_member_as_expression(self);
-	return EOK;
-
-error:
-	bithenge_node_dec_ref(key);
-	free(self);
-	return rc;
-}
-
-/*
- * subblob_expression
- */
-
-typedef struct {
-	bithenge_expression_t base;
-	bithenge_expression_t *blob, *start, *limit;
-	bool absolute_limit;
-} subblob_expression_t;
-
-static subblob_expression_t *expression_as_subblob(bithenge_expression_t *base)
-{
-	return (subblob_expression_t *)base;
-}
-
-static bithenge_expression_t *subblob_as_expression(subblob_expression_t *expr)
-{
-	return &expr->base;
-}
-
-static errno_t subblob_expression_evaluate(bithenge_expression_t *base,
-    bithenge_scope_t *scope, bithenge_node_t **out)
-{
-	subblob_expression_t *self = expression_as_subblob(base);
-	bithenge_node_t *start_node;
-	errno_t rc = bithenge_expression_evaluate(self->start, scope, &start_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(start_node) != BITHENGE_NODE_INTEGER) {
-		bithenge_node_dec_ref(start_node);
-		return EINVAL;
-	}
-	bithenge_int_t start = bithenge_integer_node_value(start_node);
-	bithenge_node_dec_ref(start_node);
-
-	bithenge_int_t limit = -1;
-	if (self->limit) {
-		bithenge_node_t *limit_node;
-		rc = bithenge_expression_evaluate(self->limit, scope,
-		    &limit_node);
-		if (rc != EOK)
-			return rc;
-		if (bithenge_node_type(limit_node) != BITHENGE_NODE_INTEGER) {
-			bithenge_node_dec_ref(limit_node);
-			return EINVAL;
-		}
-		limit = bithenge_integer_node_value(limit_node);
-		bithenge_node_dec_ref(limit_node);
-		if (self->absolute_limit)
-			limit -= start;
-	}
-
-	if (start < 0 || (self->limit && limit < 0))
-		return EINVAL;
-
-	bithenge_node_t *blob;
-	rc = bithenge_expression_evaluate(self->blob, scope, &blob);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(blob) != BITHENGE_NODE_BLOB) {
-		bithenge_node_dec_ref(blob);
-		return EINVAL;
-	}
-
-	if (self->limit)
-		return bithenge_new_subblob(out, bithenge_node_as_blob(blob),
-		    start, limit);
-	else
-		return bithenge_new_offset_blob(out,
-		    bithenge_node_as_blob(blob), start);
-}
-
-static void subblob_expression_destroy(bithenge_expression_t *base)
-{
-	subblob_expression_t *self = expression_as_subblob(base);
-	bithenge_expression_dec_ref(self->blob);
-	bithenge_expression_dec_ref(self->start);
-	bithenge_expression_dec_ref(self->limit);
-	free(self);
-}
-
-static const bithenge_expression_ops_t subblob_expression_ops = {
-	.evaluate = subblob_expression_evaluate,
-	.destroy = subblob_expression_destroy,
-};
-
-/** Create an expression that gets a subblob. Takes references to @a blob,
- * @a start, and @a limit.
- * @param[out] out Holds the new expression.
- * @param blob Calculates the blob.
- * @param start Calculates the start offset within the blob.
- * @param limit Calculates the limit. Can be NULL, in which case an offset blob
- * is returned.
- * @param absolute_limit If true, the limit is an absolute offset; otherwise,
- * it is relative to the start.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_subblob_expression(bithenge_expression_t **out,
-    bithenge_expression_t *blob, bithenge_expression_t *start,
-    bithenge_expression_t *limit, bool absolute_limit)
-{
-	errno_t rc;
-	subblob_expression_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_expression(subblob_as_expression(self),
-	    &subblob_expression_ops);
-	if (rc != EOK)
-		goto error;
-
-	self->blob = blob;
-	self->start = start;
-	self->limit = limit;
-	self->absolute_limit = absolute_limit;
-	*out = subblob_as_expression(self);
-	return EOK;
-
-error:
-	bithenge_expression_dec_ref(blob);
-	bithenge_expression_dec_ref(start);
-	bithenge_expression_dec_ref(limit);
-	free(self);
-	return rc;
-}
-
-/*
- * param_wrapper
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_transform_t *transform;
-	bithenge_expression_t **params;
-} param_wrapper_t;
-
-static inline bithenge_transform_t *param_wrapper_as_transform(
-    param_wrapper_t *self)
-{
-	return &self->base;
-}
-
-static inline param_wrapper_t *transform_as_param_wrapper(
-    bithenge_transform_t *base)
-{
-	return (param_wrapper_t *)base;
-}
-
-static errno_t param_wrapper_fill_scope(param_wrapper_t *self, bithenge_scope_t
-    *inner, bithenge_scope_t *outer)
-{
-	errno_t rc;
-	int num_params = bithenge_transform_num_params(self->transform);
-	rc = bithenge_scope_alloc_params(inner, num_params);
-	if (rc != EOK)
-		return rc;
-	for (int i = 0; i < num_params; i++) {
-		bithenge_node_t *node;
-		rc = bithenge_expression_evaluate(self->params[i], outer,
-		    &node);
-		if (rc != EOK)
-			return rc;
-		rc = bithenge_scope_set_param(inner, i, node);
-		if (rc != EOK)
-			return rc;
-	}
-	return EOK;
-}
-
-static errno_t param_wrapper_apply(bithenge_transform_t *base,
-    bithenge_scope_t *outer, bithenge_node_t *in, bithenge_node_t **out)
-{
-	param_wrapper_t *self = transform_as_param_wrapper(base);
-	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
-	if (rc != EOK)
-		return rc;
-	rc = param_wrapper_fill_scope(self, inner, outer);
-	if (rc != EOK)
-		goto error;
-
-	rc = bithenge_transform_apply(self->transform, inner, in, out);
-	in = NULL;
-
-error:
-	bithenge_scope_dec_ref(inner);
-	return rc;
-}
-
-static errno_t param_wrapper_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *outer, bithenge_blob_t *in, aoff64_t *out)
-{
-	param_wrapper_t *self = transform_as_param_wrapper(base);
-	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
-	if (rc != EOK)
-		return rc;
-	rc = param_wrapper_fill_scope(self, inner, outer);
-	if (rc != EOK)
-		goto error;
-
-	rc = bithenge_transform_prefix_length(self->transform, inner, in, out);
-	in = NULL;
-
-error:
-	bithenge_scope_dec_ref(inner);
-	return rc;
-}
-
-static errno_t param_wrapper_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *outer, bithenge_blob_t *in, bithenge_node_t **out_node,
-    aoff64_t *out_length)
-{
-	param_wrapper_t *self = transform_as_param_wrapper(base);
-	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, outer);
-	if (rc != EOK)
-		return rc;
-	rc = param_wrapper_fill_scope(self, inner, outer);
-	if (rc != EOK)
-		goto error;
-
-	rc = bithenge_transform_prefix_apply(self->transform, inner, in,
-	    out_node, out_length);
-
-error:
-	bithenge_scope_dec_ref(inner);
-	return rc;
-}
-
-static void param_wrapper_destroy(bithenge_transform_t *base)
-{
-	param_wrapper_t *self = transform_as_param_wrapper(base);
-	int num_params = bithenge_transform_num_params(self->transform);
-	bithenge_transform_dec_ref(self->transform);
-	for (int i = 0; i < num_params; i++)
-		bithenge_expression_dec_ref(self->params[i]);
-	free(self->params);
-	free(self);
-}
-
-static const bithenge_transform_ops_t param_wrapper_ops = {
-	.apply = param_wrapper_apply,
-	.prefix_length = param_wrapper_prefix_length,
-	.prefix_apply = param_wrapper_prefix_apply,
-	.destroy = param_wrapper_destroy,
-};
-
-/** Create a transform that calculates parameters for another transform. Takes
- * ownership of @a transform, @a params, and each element of @a params. The
- * number of parameters must be correct.
- * @param[out] out Holds the new transform.
- * @param transform The transform for which parameters are calculated.
- * @param params The expressions used to calculate the parameters.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_param_wrapper(bithenge_transform_t **out,
-    bithenge_transform_t *transform, bithenge_expression_t **params)
-{
-	errno_t rc;
-	int num_params = bithenge_transform_num_params(transform);
-	param_wrapper_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(param_wrapper_as_transform(self),
-	    &param_wrapper_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->transform = transform;
-	self->params = params;
-	*out = param_wrapper_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	for (int i = 0; i < num_params; i++)
-		bithenge_expression_dec_ref(params[i]);
-	free(params);
-	bithenge_transform_dec_ref(transform);
-	return rc;
-}
-
-/*
- * expression_transform
- */
-
-/* Also used by inputless_transform. */
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_expression_t *expr;
-} expression_transform_t;
-
-static inline bithenge_transform_t *expression_as_transform(
-    expression_transform_t *self)
-{
-	return &self->base;
-}
-
-static inline expression_transform_t *transform_as_expression(
-    bithenge_transform_t *base)
-{
-	return (expression_transform_t *)base;
-}
-
-static errno_t expression_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	expression_transform_t *self = transform_as_expression(base);
-	bithenge_scope_t *inner;
-	errno_t rc = bithenge_scope_new(&inner, scope);
-	if (rc != EOK)
-		return rc;
-	bithenge_scope_set_in_node(inner, in);
-	rc = bithenge_expression_evaluate(self->expr, inner, out);
-	bithenge_scope_dec_ref(inner);
-	return rc;
-}
-
-/* Also used by inputless_transform. */
-static void expression_transform_destroy(bithenge_transform_t *base)
-{
-	expression_transform_t *self = transform_as_expression(base);
-	bithenge_expression_dec_ref(self->expr);
-	free(self);
-}
-
-static const bithenge_transform_ops_t expression_transform_ops = {
-	.apply = expression_transform_apply,
-	.destroy = expression_transform_destroy,
-};
-
-/** Create a transform that evaluates an expression on the input node. Takes a
- * reference to the expression.
- * @param[out] out Holds the new transform.
- * @param expr The expression to evaluate.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_expression_transform(bithenge_transform_t **out,
-    bithenge_expression_t *expr)
-{
-	errno_t rc;
-	expression_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(expression_as_transform(self),
-	    &expression_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->expr = expr;
-	*out = expression_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_expression_dec_ref(expr);
-	return rc;
-}
-
-/*
- * inputless_transform
- */
-
-static errno_t inputless_transform_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
-{
-	*out = 0;
-	return EOK;
-}
-
-static errno_t inputless_transform_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *in, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	expression_transform_t *self = transform_as_expression(base);
-	if (out_size)
-		*out_size = 0;
-	return bithenge_expression_evaluate(self->expr, scope, out_node);
-}
-
-static const bithenge_transform_ops_t inputless_transform_ops = {
-	.prefix_length = inputless_transform_prefix_length,
-	.prefix_apply = inputless_transform_prefix_apply,
-	.destroy = expression_transform_destroy,
-};
-
-/** Create a transform that takes an empty blob and produces the result of an
- * expression. Takes a reference to the expression.
- * @param[out] out Holds the new transform.
- * @param expr The expression to evaluate.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_inputless_transform(bithenge_transform_t **out,
-    bithenge_expression_t *expr)
-{
-	errno_t rc;
-	expression_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(expression_as_transform(self),
-	    &inputless_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->expr = expr;
-	*out = expression_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_expression_dec_ref(expr);
-	return rc;
-}
-
-/*
- * concat_blob
- */
-
-typedef struct {
-	bithenge_blob_t base;
-	bithenge_blob_t *a, *b;
-	aoff64_t a_size;
-	bithenge_expression_t *b_expr;
-	bithenge_scope_t *scope;
-} concat_blob_t;
-
-static inline concat_blob_t *blob_as_concat(bithenge_blob_t *base)
-{
-	return (concat_blob_t *)base;
-}
-
-static inline bithenge_blob_t *concat_as_blob(concat_blob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t concat_blob_evaluate_b(concat_blob_t *self)
-{
-	if (self->b)
-		return EOK;
-	bithenge_node_t *b_node;
-	errno_t rc = bithenge_expression_evaluate(self->b_expr, self->scope,
-	    &b_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(b_node) != BITHENGE_NODE_BLOB) {
-		bithenge_node_dec_ref(b_node);
-		return bithenge_scope_error(self->scope,
-		    "Concatenation arguments must be blobs");
-	}
-	self->b = bithenge_node_as_blob(b_node);
-	bithenge_expression_dec_ref(self->b_expr);
-	bithenge_scope_dec_ref(self->scope);
-	self->b_expr = NULL;
-	self->scope = NULL;
-	return EOK;
-}
-
-static errno_t concat_blob_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	concat_blob_t *self = blob_as_concat(base);
-	errno_t rc = concat_blob_evaluate_b(self);
-	if (rc != EOK)
-		return rc;
-	rc = bithenge_blob_size(self->b, size);
-	*size += self->a_size;
-	return rc;
-}
-
-static errno_t concat_blob_read(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size)
-{
-	errno_t rc;
-	concat_blob_t *self = blob_as_concat(base);
-
-	aoff64_t a_size = 0, b_size = 0;
-	if (offset < self->a_size) {
-		a_size = *size;
-		rc = bithenge_blob_read(self->a, offset, buffer, &a_size);
-		if (rc != EOK)
-			return rc;
-	}
-	if (offset + *size > self->a_size) {
-		rc = concat_blob_evaluate_b(self);
-		if (rc != EOK)
-			return rc;
-		b_size = *size - a_size;
-		rc = bithenge_blob_read(self->b,
-		    offset + a_size - self->a_size, buffer + a_size, &b_size);
-		if (rc != EOK)
-			return rc;
-	}
-	assert(a_size + b_size <= *size);
-	*size = a_size + b_size;
-	return EOK;
-}
-
-static errno_t concat_blob_read_bits(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size, bool little_endian)
-{
-	errno_t rc;
-	concat_blob_t *self = blob_as_concat(base);
-
-	aoff64_t a_size = 0, b_size = 0;
-	if (offset < self->a_size) {
-		a_size = *size;
-		rc = bithenge_blob_read_bits(self->a, offset, buffer, &a_size,
-		    little_endian);
-		if (rc != EOK)
-			return rc;
-	}
-	if (offset + *size > self->a_size) {
-		rc = concat_blob_evaluate_b(self);
-		if (rc != EOK)
-			return rc;
-		b_size = *size - a_size;
-		assert(a_size % 8 == 0); /* TODO: don't require this */
-		rc = bithenge_blob_read_bits(self->b,
-		    offset + a_size - self->a_size, buffer + a_size / 8,
-		    &b_size, little_endian);
-		if (rc != EOK)
-			return rc;
-	}
-	assert(a_size + b_size <= *size);
-	*size = a_size + b_size;
-	return EOK;
-}
-
-static void concat_blob_destroy(bithenge_blob_t *base)
-{
-	concat_blob_t *self = blob_as_concat(base);
-	bithenge_blob_dec_ref(self->a);
-	bithenge_blob_dec_ref(self->b);
-	bithenge_expression_dec_ref(self->b_expr);
-	bithenge_scope_dec_ref(self->scope);
-	free(self);
-}
-
-static const bithenge_random_access_blob_ops_t concat_blob_ops = {
-	.size = concat_blob_size,
-	.read = concat_blob_read,
-	.read_bits = concat_blob_read_bits,
-	.destroy = concat_blob_destroy,
-};
-
-/** Create a concatenated blob. Takes references to @a a and @a b.
- * @param[out] out Holds the new blob.
- * @param a The first blob.
- * @param b The second blob.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_concat_blob(bithenge_node_t **out, bithenge_blob_t *a,
-    bithenge_blob_t *b)
-{
-	assert(out);
-	assert(a);
-	assert(b);
-	errno_t rc;
-	concat_blob_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_blob_size(a, &self->a_size);
-	if (rc != EOK)
-		goto error;
-
-	rc = bithenge_init_random_access_blob(concat_as_blob(self),
-	    &concat_blob_ops);
-	if (rc != EOK)
-		goto error;
-	self->a = a;
-	self->b = b;
-	self->b_expr = NULL;
-	self->scope = NULL;
-	*out = bithenge_blob_as_node(concat_as_blob(self));
-	return EOK;
-
-error:
-	bithenge_blob_dec_ref(a);
-	bithenge_blob_dec_ref(b);
-	free(self);
-	return rc;
-}
-
-/** Create a lazy concatenated blob. Takes references to @a a, @a b_expr, and
- * @a scope.
- * @param[out] out Holds the new blob.
- * @param a The first blob.
- * @param b_expr An expression to calculate the second blob.
- * @param scope The scope in which @a b_expr should be evaluated.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_concat_blob_lazy(bithenge_node_t **out, bithenge_blob_t *a,
-    bithenge_expression_t *b_expr, bithenge_scope_t *scope)
-{
-	assert(out);
-	assert(a);
-	assert(b_expr);
-	assert(scope);
-	errno_t rc;
-	concat_blob_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_blob_size(a, &self->a_size);
-	if (rc != EOK)
-		goto error;
-
-	rc = bithenge_init_random_access_blob(concat_as_blob(self),
-	    &concat_blob_ops);
-	if (rc != EOK)
-		goto error;
-	self->a = a;
-	self->b = NULL;
-	self->b_expr = b_expr;
-	self->scope = scope;
-	*out = bithenge_blob_as_node(concat_as_blob(self));
-	return EOK;
-
-error:
-	bithenge_blob_dec_ref(a);
-	bithenge_expression_dec_ref(b_expr);
-	bithenge_scope_dec_ref(scope);
-	free(self);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/failure.c
===================================================================
--- uspace/lib/bithenge/src/failure.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,246 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @cond internal */
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Fake system call errors for testing.
- */
-
-#include <errno.h>
-#include <execinfo.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/wait.h>
-#define BITHENGE_FAILURE_DECLS_ONLY 1
-#include "failure.h"
-#include "common.h"
-
-/*
- * This file raises fake errors from system calls, to test that Bithenge
- * handles the errors correctly. It has two primary modes of operation,
- * depending on an environment variable:
- *
- * BITHENGE_FAILURE_INDEX not set: when a system call is made, a child process
- * returns a fake error from that call. If the child process handles the error
- * correctly (exit code is 1), the main process continues without errors. If
- * the child process has a problem, the main process raises the fake error
- * again and shows all stdout and stderr output. For speed, errors are only
- * raised when part of the backtrace has not been seen before.
- *
- * BITHENGE_FAILURE_INDEX set: the program runs normally until system call
- * number BITHENGE_FAILURE_INDEX is made; a fake error is returned from this
- * call.
- */
-
-static int g_initialized = 0;
-static int g_failure_index = -1;
-static int g_failure_index_selected = -1;
-
-typedef struct backtrace_item {
-	struct backtrace_item *next;
-	void *backtrace_item;
-} backtrace_item_t;
-
-static backtrace_item_t *g_backtrace_items = NULL;
-
-static void atexit_handler(void)
-{
-	while (g_backtrace_items) {
-		backtrace_item_t *first = g_backtrace_items;
-		g_backtrace_items = first->next;
-		free(first);
-	}
-}
-
-static inline void initialize(void)
-{
-	g_initialized = 1;
-	errno_t rc = atexit(atexit_handler);
-	if (rc)
-		exit(127);
-
-	char *sel_str = getenv("BITHENGE_FAILURE_INDEX");
-	if (sel_str)
-		g_failure_index_selected = strtol(sel_str, NULL, 10);
-}
-
-/*
- * Record a hit for a backtrace address and return whether this is the first
- * hit.
- */
-static inline errno_t backtrace_item_hit(void *addr)
-{
-	backtrace_item_t **bip;
-	for (bip = &g_backtrace_items; *bip; bip = &(*bip)->next) {
-		backtrace_item_t *bi = *bip;
-		if (bi->backtrace_item == addr) {
-			/* Keep frequently accessed items near the front. */
-			*bip = bi->next;
-			bi->next = g_backtrace_items;
-			g_backtrace_items = bi;
-			return 0;
-		}
-	}
-
-	/* No item found; create one. */
-	backtrace_item_t *i = malloc(sizeof(*i));
-	if (!i)
-		exit(127);
-	i->next = g_backtrace_items;
-	i->backtrace_item = addr;
-	g_backtrace_items = i;
-	return 1;
-}
-
-errno_t bithenge_should_fail(void)
-{
-	g_failure_index++;
-
-	if (!g_initialized)
-		initialize();
-
-	if (g_failure_index_selected != -1) {
-		if (g_failure_index == g_failure_index_selected)
-			return 1; /* breakpoint here */
-		return 0;
-	}
-
-	/*
-	 * If all backtrace items have been seen already, there's no need to
-	 * try raising an error.
-	 */
-	void *trace[256];
-	int size = backtrace(trace, 256);
-	int raise_error = 0;
-	for (int i = 0; i < size; i++) {
-		if (backtrace_item_hit(trace[i]))
-			raise_error = 1;
-	}
-	if (!raise_error)
-		return 0;
-
-	if (!fork()) {
-		/* Child silently fails. */
-		int null = open("/dev/null", O_WRONLY);
-		if (null == -1)
-			exit(127);
-		vfs_clone(null, STDOUT_FILENO, false);
-		vfs_clone(null, STDERR_FILENO, false);
-		vfs_put(null);
-		return 1;
-	}
-
-	/* Parent checks whether child failed correctly. */
-	int status;
-	wait(&status);
-	if (WIFEXITED(status) && WEXITSTATUS(status) == 1)
-		return 0;
-
-	/*
-	 * The child had an error! We couldn't easily debug it because it was
-	 * in a separate process with redirected stdout and stderr. Do it again
-	 * without redirecting or forking.
-	 */
-	fprintf(stderr, "** Fake error raised here (BITHENGE_FAILURE_INDEX=%d)\n",
-	    g_failure_index);
-	return 1;
-}
-
-void *bithenge_failure_malloc(size_t size)
-{
-	if (bithenge_should_fail())
-		return NULL;
-	return malloc(size);
-}
-
-void *bithenge_failure_realloc(void *ptr, size_t size)
-{
-	if (bithenge_should_fail())
-		return NULL;
-	return realloc(ptr, size);
-}
-
-ssize_t bithenge_failure_read(int fd, void *buf, size_t count)
-{
-	if (bithenge_should_fail()) {
-		errno = EIO;
-		return -1;
-	}
-	return read(fd, buf, count);
-}
-
-off_t bithenge_failure_lseek(int fd, off_t offset, int whither)
-{
-	if (bithenge_should_fail()) {
-		errno = EINVAL;
-		return (off_t) -1;
-	}
-	return lseek(fd, offset, whither);
-}
-
-errno_t bithenge_failure_ferror(FILE *stream)
-{
-	if (bithenge_should_fail())
-		return 1;
-	return ferror(stream);
-}
-
-char *bithenge_failure_str_ndup(const char *s, size_t max_len)
-{
-	if (bithenge_should_fail())
-		return NULL;
-	return str_ndup(s, max_len);
-}
-
-errno_t bithenge_failure_open(const char *pathname, int flags)
-{
-	if (bithenge_should_fail()) {
-		errno = EACCES;
-		return -1;
-	}
-	return open(pathname, flags);
-}
-
-errno_t bithenge_failure_fstat(int fd, vfs_stat_t *buf)
-{
-	if (bithenge_should_fail()) {
-		errno = EIO;
-		return -1;
-	}
-	return fstat(fd, buf);
-}
-
-/** @}
- */
-/** @endcond */
Index: pace/lib/bithenge/src/failure.h
===================================================================
--- uspace/lib/bithenge/src/failure.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @cond internal */
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Fake system call errors for testing.
- */
-
-#ifndef BITHENGE_FAILURE_H_
-#define BITHENGE_FAILURE_H_
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-errno_t bithenge_should_fail(void);
-void *bithenge_failure_malloc(size_t);
-void *bithenge_failure_realloc(void *, size_t);
-ssize_t bithenge_failure_read(int, void *, size_t);
-off_t bithenge_failure_lseek(int, off_t, int);
-errno_t bithenge_failure_ferror(FILE *);
-char *bithenge_failure_str_ndup(const char *, size_t);
-errno_t bithenge_failure_open(const char *, int);
-errno_t bithenge_failure_fstat(int, vfs_stat_t *);
-
-#ifndef BITHENGE_FAILURE_DECLS_ONLY
-#define malloc bithenge_failure_malloc
-#define realloc bithenge_failure_realloc
-#define read bithenge_failure_read
-#define lseek bithenge_failure_lseek
-#define ferror bithenge_failure_ferror
-#define str_ndup bithenge_failure_str_ndup
-#define open bithenge_failure_open
-#define fstat bithenge_failure_fstat
-#endif
-
-#endif
-
-/** @}
- */
-
-/** @endcond */
Index: pace/lib/bithenge/src/file.c
===================================================================
--- uspace/lib/bithenge/src/file.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Access files as blobs.
- * @todo Provide more information about the file.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-#include <stddef.h>
-#include "common.h"
-#include <bithenge/blob.h>
-#include <bithenge/file.h>
-
-typedef struct {
-	bithenge_blob_t base;
-	int fd;
-	aoff64_t size; // needed by file_read()
-	bool needs_close;
-} file_blob_t;
-
-static inline file_blob_t *blob_as_file(bithenge_blob_t *base)
-{
-	return (file_blob_t *)base;
-}
-
-static inline bithenge_blob_t *file_as_blob(file_blob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t file_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	file_blob_t *blob = blob_as_file(base);
-	*size = blob->size;
-	return EOK;
-}
-
-static errno_t file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
-    aoff64_t *size)
-{
-	file_blob_t *blob = blob_as_file(base);
-	if (offset > blob->size)
-		return ELIMIT;
-
-	size_t amount_read;
-	errno_t rc = vfs_read(blob->fd, &offset, buffer, *size, &amount_read);
-	if (rc != EOK)
-		return errno;
-	*size += amount_read;
-	return EOK;
-}
-
-static void file_destroy(bithenge_blob_t *base)
-{
-	file_blob_t *blob = blob_as_file(base);
-	vfs_put(blob->fd);
-	free(blob);
-}
-
-static const bithenge_random_access_blob_ops_t file_ops = {
-	.size = file_size,
-	.read = file_read,
-	.destroy = file_destroy,
-};
-
-static errno_t new_file_blob(bithenge_node_t **out, int fd, bool needs_close)
-{
-	assert(out);
-
-	vfs_stat_t stat;
-	errno_t rc = vfs_stat(fd, &stat);
-	if (rc != EOK) {
-		if (needs_close)
-			vfs_put(fd);
-		return rc;
-	}
-
-	// Create blob
-	file_blob_t *blob = malloc(sizeof(*blob));
-	if (!blob) {
-		if (needs_close)
-			vfs_put(fd);
-		return ENOMEM;
-	}
-	rc = bithenge_init_random_access_blob(file_as_blob(blob), &file_ops);
-	if (rc != EOK) {
-		free(blob);
-		if (needs_close)
-			vfs_put(fd);
-		return rc;
-	}
-	blob->fd = fd;
-#ifdef __HELENOS__
-	blob->size = stat.size;
-#else
-	blob->size = stat.st_size;
-#endif
-	blob->needs_close = needs_close;
-	*out = bithenge_blob_as_node(file_as_blob(blob));
-
-	return EOK;
-}
-
-/** Create a blob for a file. The blob must be freed with @a
- * bithenge_node_t::bithenge_node_destroy after it is used.
- * @param[out] out Stores the created blob.
- * @param filename The name of the file.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_file_blob(bithenge_node_t **out, const char *filename)
-{
-	assert(filename);
-
-	int fd;
-	errno_t rc = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK)
-		return rc;
-
-	return new_file_blob(out, fd, true);
-}
-
-/** Create a blob for a file descriptor. The blob must be freed with @a
- * bithenge_node_t::bithenge_node_destroy after it is used.
- * @param[out] out Stores the created blob.
- * @param fd The file descriptor.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)
-{
-	return new_file_blob(out, fd, false);
-}
-
-/** Create a blob for a file pointer. The blob must be freed with @a
- * bithenge_node_t::bithenge_node_destroy after it is used.
- * @param[out] out Stores the created blob.
- * @param file The file pointer.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)
-{
-	int fd = fileno(file);
-	if (fd < 0)
-		return errno;
-	return new_file_blob(out, fd, false);
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/helenos/block.c
===================================================================
--- uspace/lib/bithenge/src/helenos/block.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Access block devices as blobs.
- * @todo Provide more information about the block device (block size).
- */
-
-#include <assert.h>
-#include <block.h>
-#include <errno.h>
-#include <loc.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <bithenge/blob.h>
-#include "block.h"
-
-typedef struct {
-	bithenge_blob_t base;
-	service_id_t service_id;
-	aoff64_t size;
-} block_blob_t;
-
-static inline block_blob_t *blob_as_block(bithenge_blob_t *base)
-{
-	return (block_blob_t *)base;
-}
-
-static inline bithenge_blob_t *block_as_blob(block_blob_t *blob)
-{
-	return &blob->base;
-}
-
-static errno_t block_size(bithenge_blob_t *base, aoff64_t *size)
-{
-	block_blob_t *self = blob_as_block(base);
-	*size = self->size;
-	return EOK;
-}
-
-static errno_t block_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
-    aoff64_t *size)
-{
-	block_blob_t *self = blob_as_block(base);
-	if (offset > self->size)
-		return ELIMIT;
-	*size = min(*size, self->size - offset);
-	return block_read_bytes_direct(self->service_id, offset, *size, buffer);
-}
-
-static void block_destroy(bithenge_blob_t *base)
-{
-	block_blob_t *self = blob_as_block(base);
-	block_fini(self->service_id);
-	free(self);
-}
-
-static const bithenge_random_access_blob_ops_t block_ops = {
-	.size = block_size,
-	.read = block_read,
-	.destroy = block_destroy,
-};
-
-/** Create a blob for a block device. The blob must be freed with
- * @a bithenge_node_t::bithenge_node_destroy after it is used.
- * @param[out] out Stores the created blob.
- * @param service_id The service ID of the block device.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_block_blob(bithenge_node_t **out, service_id_t service_id)
-{
-	assert(out);
-
-	// Initialize libblock
-	errno_t rc;
-	rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	// Calculate total device size
-	size_t bsize;
-	aoff64_t nblocks;
-	aoff64_t size;
-	rc = block_get_bsize(service_id, &bsize);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-	rc = block_get_nblocks(service_id, &nblocks);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-	size = bsize * nblocks;
-
-	// Create blob
-	block_blob_t *blob = malloc(sizeof(*blob));
-	if (!blob) {
-		block_fini(service_id);
-		return ENOMEM;
-	}
-	rc = bithenge_init_random_access_blob(block_as_blob(blob),
-	    &block_ops);
-	if (rc != EOK) {
-		free(blob);
-		block_fini(service_id);
-		return rc;
-	}
-	blob->service_id = service_id;
-	blob->size = size;
-	*out = bithenge_blob_as_node(block_as_blob(blob));
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/helenos/block.h
===================================================================
--- uspace/lib/bithenge/src/helenos/block.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Access block devices as blobs.
- */
-
-#ifndef BITHENGE_BLOCK_H_
-#define BITHENGE_BLOCK_H_
-
-#include <loc.h>
-#include <bithenge/tree.h>
-
-errno_t bithenge_new_block_blob(bithenge_node_t **, service_id_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/bithenge/src/helenos/common.h
===================================================================
--- uspace/lib/bithenge/src/helenos/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BITHENGE_HELENOS_COMMON_H_
-#define BITHENGE_HELENOS_COMMON_H_
-
-#include <bithenge/os.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <macros.h>
-#include <mem.h>
-#include <str.h>
-#include <str_error.h>
-
-#define BITHENGE_PRId PRId64
-
-typedef struct {
-	const char *string;
-	size_t offset;
-	char32_t ch;
-} string_iterator_t;
-
-static inline string_iterator_t string_iterator(const char *string)
-{
-	string_iterator_t i;
-	i.string = string;
-	i.offset = 0;
-	i.ch = str_decode(i.string, &i.offset, STR_NO_LIMIT);
-	return i;
-}
-
-static inline bool string_iterator_done(const string_iterator_t *i)
-{
-	return i->ch == L'\0';
-}
-
-static inline errno_t string_iterator_next(string_iterator_t *i, char32_t *out)
-{
-	*out = i->ch;
-	if (*out == U_SPECIAL)
-		return EINVAL;
-	i->ch = str_decode(i->string, &i->offset, STR_NO_LIMIT);
-	return EOK;
-}
-
-static inline errno_t bithenge_parse_int(const char *start, bithenge_int_t *result)
-{
-	const char *real_start = *start == '-' ? start + 1 : start;
-	uint64_t val;
-	errno_t rc = str_uint64_t(real_start, NULL, 10, false, &val);
-	*result = val;
-	if (*start == '-')
-		*result = -*result;
-	return rc;
-}
-
-#endif
Index: pace/lib/bithenge/src/linux/common.h
===================================================================
--- uspace/lib/bithenge/src/linux/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BITHENGE_LINUX_COMMON_H_
-#define BITHENGE_LINUX_COMMON_H_
-
-#include <endian.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <memory.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <string.h>
-#include <uchar.h>
-
-#define max(aleph, bet) ((aleph) > (bet) ? (aleph) : (bet))
-#define min(aleph, bet) ((aleph) < (bet) ? (aleph) : (bet))
-
-#define EOK 0
-#define ELIMIT EINVAL
-
-typedef intmax_t bithenge_int_t;
-#define BITHENGE_PRId PRIdMAX
-typedef uint64_t aoff64_t;
-typedef const char *string_iterator_t;
-
-static inline string_iterator_t string_iterator(const char *string)
-{
-	return string;
-}
-
-static inline errno_t string_iterator_next(string_iterator_t *i, char32_t *out)
-{
-	wint_t rc = btowc(*(*i)++); // TODO
-	*out = (char32_t) rc;
-	return rc == WEOF ? EILSEQ : EOK;
-}
-
-static inline bool string_iterator_done(const string_iterator_t *i)
-{
-	return !**i;
-}
-
-static inline size_t str_length(const char *string)
-{
-	return strlen(string);
-}
-
-static inline const char *str_chr(const char *string, char32_t ch)
-{
-	return strchr(string, wctob(ch)); // TODO
-}
-
-static inline int str_cmp(const char *s1, const char *s2)
-{
-	return strcmp(s1, s2);
-}
-
-static inline errno_t str_lcmp(const char *s1, const char *s2, size_t max_len)
-{
-	return strncmp(s1, s2, max_len);
-}
-
-static inline char *str_dup(const char *s)
-{
-	return strdup(s);
-}
-
-static inline char *str_ndup(const char *s, size_t max_len)
-{
-	return strndup(s, max_len);
-}
-
-static inline const char *str_error(int e)
-{
-	return strerror(e);
-}
-
-static inline uint16_t uint16_t_le2host(uint16_t val)
-{
-	return le16toh(val);
-}
-
-static inline uint16_t uint16_t_be2host(uint16_t val)
-{
-	return be16toh(val);
-}
-
-static inline uint32_t uint32_t_le2host(uint32_t val)
-{
-	return le32toh(val);
-}
-
-static inline uint32_t uint32_t_be2host(uint32_t val)
-{
-	return be32toh(val);
-}
-
-static inline uint64_t uint64_t_le2host(uint64_t val)
-{
-	return le64toh(val);
-}
-
-static inline uint64_t uint64_t_be2host(uint64_t val)
-{
-	return be64toh(val);
-}
-
-static inline errno_t bithenge_parse_int(const char *start, bithenge_int_t *result)
-{
-	errno = 0;
-	*result = strtoll(start, NULL, 10);
-	return errno;
-}
-
-#endif
Index: pace/lib/bithenge/src/print.c
===================================================================
--- uspace/lib/bithenge/src/print.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Write a tree as JSON or other text formats.
- * @todo Allow more control over the printing style, and handle printing in
- * limited space.
- */
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <uchar.h>
-#include <bithenge/blob.h>
-#include <bithenge/print.h>
-#include <bithenge/tree.h>
-#include "common.h"
-
-typedef struct {
-	bithenge_print_type_t type;
-	bool first;
-	int depth;
-	char *buffer;
-	size_t buffer_size;
-} state_t;
-
-static void state_printf(state_t *state, const char *format, ...)
-{
-	va_list ap;
-	va_start(ap, format);
-	if (state->buffer) {
-		int rc = vsnprintf(state->buffer, state->buffer_size, format,
-		    ap);
-		if (rc > 0 && (size_t)rc >= state->buffer_size)
-			rc = state->buffer_size - 1;
-		if (rc > 0) {
-			state->buffer += rc;
-			state->buffer_size -= rc;
-		}
-	} else {
-		vprintf(format, ap);
-	}
-	va_end(ap);
-}
-
-static errno_t print_node(state_t *, bithenge_node_t *);
-
-static void newline(state_t *state)
-{
-	state_printf(state, "\n");
-	for (int i = 0; i < state->depth; i++) {
-		state_printf(state, "    ");
-	}
-}
-
-static void increase_depth(state_t *state)
-{
-	state->depth++;
-}
-
-static void decrease_depth(state_t *state)
-{
-	state->depth--;
-}
-
-static errno_t print_internal_func(bithenge_node_t *key, bithenge_node_t *value, void *data)
-{
-	state_t *state = (state_t *)data;
-	errno_t rc = EOK;
-	if (!state->first)
-		state_printf(state, ",");
-	newline(state);
-	state->first = false;
-	bool add_quotes = state->type == BITHENGE_PRINT_JSON &&
-	    bithenge_node_type(key) != BITHENGE_NODE_STRING;
-	if (add_quotes)
-		state_printf(state, "\"");
-	rc = print_node(state, key);
-	if (rc != EOK)
-		goto end;
-	if (add_quotes)
-		state_printf(state, "\"");
-	state_printf(state, ": ");
-	rc = print_node(state, value);
-	if (rc != EOK)
-		goto end;
-end:
-	bithenge_node_dec_ref(key);
-	bithenge_node_dec_ref(value);
-	return rc;
-}
-
-static errno_t print_internal(state_t *state, bithenge_node_t *node)
-{
-	errno_t rc;
-	state_printf(state, "{");
-	increase_depth(state);
-	state->first = true;
-	rc = bithenge_node_for_each(node, print_internal_func, state);
-	if (rc != EOK)
-		return rc;
-	decrease_depth(state);
-	if (!state->first)
-		newline(state);
-	state->first = false;
-	state_printf(state, "}");
-	return EOK;
-}
-
-static errno_t print_boolean(state_t *state, bithenge_node_t *node)
-{
-	bool value = bithenge_boolean_node_value(node);
-	switch (state->type) {
-	case BITHENGE_PRINT_PYTHON:
-		state_printf(state, value ? "True" : "False");
-		break;
-	case BITHENGE_PRINT_JSON:
-		state_printf(state, value ? "true" : "false");
-		break;
-	}
-	return EOK;
-}
-
-static errno_t print_integer(state_t *state, bithenge_node_t *node)
-{
-	bithenge_int_t value = bithenge_integer_node_value(node);
-	state_printf(state, "%" BITHENGE_PRId, value);
-	return EOK;
-}
-
-static errno_t print_string(state_t *state, bithenge_node_t *node)
-{
-	const char *value = bithenge_string_node_value(node);
-	state_printf(state, "\"");
-	string_iterator_t i = string_iterator(value);
-	while (!string_iterator_done(&i)) {
-		char32_t ch;
-		errno_t rc = string_iterator_next(&i, &ch);
-		if (rc != EOK)
-			return rc;
-		if (ch == '"' || ch == '\\') {
-			state_printf(state, "\\%lc", (wint_t) ch);
-		} else if (ch <= 0x1f) {
-			state_printf(state, "\\u%04x", (unsigned int) ch);
-		} else {
-			state_printf(state, "%lc", (wint_t) ch);
-		}
-	}
-	state_printf(state, "\"");
-	return EOK;
-}
-
-static errno_t print_blob(state_t *state, bithenge_node_t *node)
-{
-	bithenge_blob_t *blob = bithenge_node_as_blob(node);
-	aoff64_t pos = 0;
-	uint8_t buffer[1024];
-	aoff64_t size = sizeof(buffer);
-	errno_t rc;
-	state_printf(state,
-	    state->type == BITHENGE_PRINT_PYTHON ? "b\"" : "\"");
-	do {
-		rc = bithenge_blob_read(blob, pos, (char *)buffer, &size);
-		if (rc != EOK)
-			return rc;
-		for (aoff64_t i = 0; i < size; i++)
-			state_printf(state, "\\x%02x",
-			    (unsigned int)buffer[i]);
-		pos += size;
-	} while (size == sizeof(buffer));
-	state_printf(state, "\"");
-	return EOK;
-}
-
-static errno_t print_node(state_t *state, bithenge_node_t *tree)
-{
-	switch (bithenge_node_type(tree)) {
-	case BITHENGE_NODE_INTERNAL:
-		return print_internal(state, tree);
-	case BITHENGE_NODE_BOOLEAN:
-		return print_boolean(state, tree);
-	case BITHENGE_NODE_INTEGER:
-		return print_integer(state, tree);
-	case BITHENGE_NODE_STRING:
-		return print_string(state, tree);
-	case BITHENGE_NODE_BLOB:
-		return print_blob(state, tree);
-	}
-	return ENOTSUP;
-}
-
-/** Print a tree as text to stdout.
- * @param type The format to use.
- * @param tree The root node of the tree to print.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_print_node(bithenge_print_type_t type, bithenge_node_t *tree)
-{
-	state_t state = { type, true, 0, NULL, 0 };
-	return print_node(&state, tree);
-}
-
-/** Print a tree as text into a buffer.
- * @param[in,out] str Holds a pointer to the buffer; changed to point to the
- * null character.
- * @param[in,out] size Holds the size of the buffer; changed to hold the
- * remaining size.
- * @param type The format to use.
- * @param tree The root node of the tree to print.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_print_node_to_string(char **str, size_t *size,
-    bithenge_print_type_t type, bithenge_node_t *tree)
-{
-	state_t state = { type, true, 0, *str, *size };
-	errno_t rc = print_node(&state, tree);
-	*str = state.buffer;
-	*size = state.buffer_size;
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/script.c
===================================================================
--- uspace/lib/bithenge/src/script.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1353 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Script parsing.
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <bithenge/compound.h>
-#include <bithenge/expression.h>
-#include <bithenge/script.h>
-#include <bithenge/sequence.h>
-#include <bithenge/transform.h>
-#include <bithenge/tree.h>
-#include "common.h"
-
-/** @cond internal */
-#define BUFFER_SIZE 4096
-/** @endcond */
-
-/** Tokens with more characters than this may be read incorrectly. */
-static const int MAX_TOKEN_SIZE = 256;
-
-/** @cond internal
- * Single-character symbols are represented by the character itself. Every
- * other token uses one of these values:
- */
-typedef enum {
-	TOKEN_ERROR = -128,
-
-	TOKEN_AND,
-	TOKEN_CONCAT,
-	TOKEN_EQUALS,
-	TOKEN_EOF,
-	TOKEN_GREATER_THAN_OR_EQUAL,
-	TOKEN_IDENTIFIER,
-	TOKEN_INTEGER,
-	TOKEN_INTEGER_DIVIDE,
-	TOKEN_LEFT_ARROW,
-	TOKEN_LESS_THAN_OR_EQUAL,
-	TOKEN_NOT_EQUAL,
-	TOKEN_OR,
-
-	/* Keywords */
-	TOKEN_DO,
-	TOKEN_ELSE,
-	TOKEN_FALSE,
-	TOKEN_IF,
-	TOKEN_IN,
-	TOKEN_PARTIAL,
-	TOKEN_REPEAT,
-	TOKEN_STRUCT,
-	TOKEN_SWITCH,
-	TOKEN_TRANSFORM,
-	TOKEN_TRUE,
-	TOKEN_WHILE,
-} token_type_t;
-/** @endcond */
-
-/** Singly-linked list of named transforms. */
-typedef struct transform_list {
-	char *name;
-	bithenge_transform_t *transform;
-	struct transform_list *next;
-} transform_list_t;
-
-/** State kept by the parser. */
-typedef struct {
-	/** Rather than constantly checking return values, the parser uses this
-	 * to indicate whether an error has occurred.
-	 */
-	errno_t error;
-
-	/** The list of named transforms. */
-	transform_list_t *transform_list;
-
-	/** The name of the script file. */
-	const char *filename;
-	/** The script file being read from. */
-	FILE *file;
-	/** The buffer that holds script code. There is always a '\0' after the
-	 * current position to prevent reading too far.
-	 */
-	char buffer[BUFFER_SIZE];
-	/** The start position within the buffer of the next unread token. */
-	size_t buffer_pos;
-	/** The start position within the buffer of the current token. */
-	size_t old_buffer_pos;
-	/** The line number of the current token. */
-	int lineno;
-	/** Added to a buffer position to find the column number. */
-	int line_offset;
-
-	/** The type of the current token. */
-	token_type_t token;
-	union {
-		/** The value of a TOKEN_IDENTIFIER token. Unless changed to
-		 * NULL, it will be freed when the next token is read.
-		 */
-		char *token_string;
-		/** The value of a TOKEN_INTEGER token. */
-		bithenge_int_t token_int;
-	};
-
-	/** The names of the current transform's parameters. */
-	char **parameter_names;
-	/** The number of parameters. */
-	int num_params;
-	/** @a parse_expression sets this when TOKEN_IN is used. */
-	bool in_node_used;
-} state_t;
-
-/** Free the previous token's data. This must be called before changing
- * state->token.
- */
-static void done_with_token(state_t *state)
-{
-	if (state->token == TOKEN_IDENTIFIER)
-		free(state->token_string);
-	state->token = TOKEN_ERROR;
-}
-
-/** Note that an error has occurred if error is not EOK. */
-static void error_errno(state_t *state, errno_t error)
-{
-	// Don't overwrite a previous error.
-	if (state->error == EOK && error != EOK) {
-		done_with_token(state);
-		state->token = TOKEN_ERROR;
-		state->error = error;
-	}
-}
-
-/** Note that a syntax error has occurred and print an error message. */
-static void syntax_error(state_t *state, const char *message)
-{
-	// Printing multiple errors is confusing.
-	if (state->error == EOK) {
-		size_t start_char = state->old_buffer_pos + state->line_offset;
-		size_t end_char = state->buffer_pos + state->line_offset;
-		size_t size = end_char - start_char;
-		fprintf(stderr, "%s:%d:", state->filename, state->lineno);
-		if (size <= 1)
-			fprintf(stderr, "%zd: ", start_char);
-		else
-			fprintf(stderr, "%zd-%zd: ", start_char, end_char - 1);
-		fprintf(stderr, "%s: \"%.*s\"\n", message, (int)size,
-		    state->buffer + state->old_buffer_pos);
-		error_errno(state, EINVAL);
-	}
-}
-
-/** Ensure the buffer contains enough characters to read a token. */
-static void fill_buffer(state_t *state)
-{
-	if (state->buffer_pos + MAX_TOKEN_SIZE < BUFFER_SIZE)
-		return;
-
-	size_t empty_size = state->buffer_pos;
-	size_t used_size = BUFFER_SIZE - 1 - state->buffer_pos;
-	memmove(state->buffer, state->buffer + state->buffer_pos, used_size);
-	state->line_offset += state->buffer_pos;
-	state->buffer_pos = 0;
-
-	size_t read_size = fread(state->buffer + used_size, 1, empty_size,
-	    state->file);
-	if (ferror(state->file))
-		error_errno(state, EIO);
-	state->buffer[used_size + read_size] = '\0';
-}
-
-/** Read the next token. */
-static void next_token(state_t *state)
-{
-	fill_buffer(state);
-	done_with_token(state);
-	state->old_buffer_pos = state->buffer_pos;
-	char ch = state->buffer[state->buffer_pos];
-	if (ch == '\0') {
-		state->token = TOKEN_EOF;
-	} else if (ch == '#') {
-		while (state->buffer[state->buffer_pos] != '\n' &&
-		    state->buffer[state->buffer_pos] != '\0') {
-			state->buffer_pos++;
-			fill_buffer(state);
-		}
-		next_token(state);
-		return;
-	} else if (isspace(ch)) {
-		// Will eventually reach the '\0' at the end
-		while (isspace(state->buffer[state->buffer_pos])) {
-			if (state->buffer[state->buffer_pos] == '\n') {
-				state->lineno++;
-				state->line_offset = -state->buffer_pos;
-			}
-			state->buffer_pos++;
-		}
-		next_token(state);
-		return;
-	} else if (isalpha(ch)) {
-		while (isalnum(state->buffer[state->buffer_pos]) ||
-		    state->buffer[state->buffer_pos] == '_')
-			state->buffer_pos++;
-		char *value = str_ndup(state->buffer + state->old_buffer_pos,
-		    state->buffer_pos - state->old_buffer_pos);
-		if (!value) {
-			error_errno(state, ENOMEM);
-		} else if (!str_cmp(value, "do")) {
-			state->token = TOKEN_DO;
-			free(value);
-		} else if (!str_cmp(value, "else")) {
-			state->token = TOKEN_ELSE;
-			free(value);
-		} else if (!str_cmp(value, "false")) {
-			state->token = TOKEN_FALSE;
-			free(value);
-		} else if (!str_cmp(value, "if")) {
-			state->token = TOKEN_IF;
-			free(value);
-		} else if (!str_cmp(value, "in")) {
-			state->token = TOKEN_IN;
-			free(value);
-		} else if (!str_cmp(value, "partial")) {
-			state->token = TOKEN_PARTIAL;
-			free(value);
-		} else if (!str_cmp(value, "repeat")) {
-			state->token = TOKEN_REPEAT;
-			free(value);
-		} else if (!str_cmp(value, "struct")) {
-			state->token = TOKEN_STRUCT;
-			free(value);
-		} else if (!str_cmp(value, "switch")) {
-			state->token = TOKEN_SWITCH;
-			free(value);
-		} else if (!str_cmp(value, "transform")) {
-			state->token = TOKEN_TRANSFORM;
-			free(value);
-		} else if (!str_cmp(value, "true")) {
-			state->token = TOKEN_TRUE;
-			free(value);
-		} else if (!str_cmp(value, "while")) {
-			state->token = TOKEN_WHILE;
-			free(value);
-		} else {
-			state->token = TOKEN_IDENTIFIER;
-			state->token_string = value;
-		}
-	} else if (isdigit(ch)) {
-		while (isdigit(state->buffer[state->buffer_pos]))
-			state->buffer_pos++;
-		state->token = TOKEN_INTEGER;
-		errno_t rc = bithenge_parse_int(state->buffer +
-		    state->old_buffer_pos, &state->token_int);
-		error_errno(state, rc);
-	} else if (ch == '<') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '-') {
-			state->buffer_pos++;
-			state->token = TOKEN_LEFT_ARROW;
-		} else if (state->buffer[state->buffer_pos] == '=') {
-			state->buffer_pos++;
-			state->token = TOKEN_LESS_THAN_OR_EQUAL;
-		}
-	} else if (ch == '>') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '=') {
-			state->buffer_pos++;
-			state->token = TOKEN_GREATER_THAN_OR_EQUAL;
-		}
-	} else if (ch == '=') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '=') {
-			state->token = TOKEN_EQUALS;
-			state->buffer_pos++;
-		}
-	} else if (ch == '/') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '/') {
-			state->token = TOKEN_INTEGER_DIVIDE;
-			state->buffer_pos++;
-		}
-	} else if (ch == '!') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '=') {
-			state->token = TOKEN_NOT_EQUAL;
-			state->buffer_pos++;
-		}
-	} else if (ch == '&') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '&') {
-			state->token = TOKEN_AND;
-			state->buffer_pos++;
-		}
-	} else if (ch == '|') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '|') {
-			state->token = TOKEN_OR;
-			state->buffer_pos++;
-		}
-	} else if (ch == '+') {
-		state->token = ch;
-		state->buffer_pos++;
-		if (state->buffer[state->buffer_pos] == '+') {
-			state->token = TOKEN_CONCAT;
-			state->buffer_pos++;
-		}
-	} else {
-		state->token = ch;
-		state->buffer_pos++;
-	}
-}
-
-/** Allocate memory and handle failure by setting the error in the state. The
- * caller must check the state for errors before using the return value of this
- * function.
- */
-static void *state_malloc(state_t *state, size_t size)
-{
-	if (state->error != EOK)
-		return NULL;
-	void *result = malloc(size);
-	if (result == NULL)
-		error_errno(state, ENOMEM);
-	return result;
-}
-
-/** Reallocate memory and handle failure by setting the error in the state. If
- * an error occurs, the existing pointer will be returned.
- */
-static void *state_realloc(state_t *state, void *ptr, size_t size)
-{
-	if (state->error != EOK)
-		return ptr;
-	void *result = realloc(ptr, size);
-	if (result == NULL) {
-		error_errno(state, ENOMEM);
-		return ptr;
-	}
-	return result;
-}
-
-/** Expect and consume a certain token. If the next token is of the wrong type,
- * an error is caused.
- */
-static void expect(state_t *state, token_type_t type)
-{
-	if (state->token != type) {
-		syntax_error(state, "unexpected");
-		return;
-	}
-	next_token(state);
-}
-
-/** Expect and consume an identifier token. If the next token is not an
- * identifier, an error is caused and this function returns null.
- */
-static char *expect_identifier(state_t *state)
-{
-	if (state->token != TOKEN_IDENTIFIER) {
-		syntax_error(state, "unexpected (identifier expected)");
-		return NULL;
-	}
-	char *val = state->token_string;
-	state->token_string = NULL;
-	next_token(state);
-	return val;
-}
-
-/** Find a transform by name. A reference will be added to the transform.
- * @return The found transform, or NULL if none was found.
- */
-static bithenge_transform_t *get_named_transform(state_t *state,
-    const char *name)
-{
-	for (transform_list_t *e = state->transform_list; e; e = e->next) {
-		if (!str_cmp(e->name, name)) {
-			bithenge_transform_inc_ref(e->transform);
-			return e->transform;
-		}
-	}
-	for (int i = 0; bithenge_primitive_transforms[i].name; i++) {
-		if (!str_cmp(bithenge_primitive_transforms[i].name, name)) {
-			bithenge_transform_t *xform =
-			    bithenge_primitive_transforms[i].transform;
-			bithenge_transform_inc_ref(xform);
-			return xform;
-		}
-	}
-	return NULL;
-}
-
-/** Add a named transform. This function takes ownership of the name and a
- * reference to the transform. If an error has occurred, either may be null.
- */
-static void add_named_transform(state_t *state, bithenge_transform_t *xform, char *name)
-{
-	transform_list_t *entry = state_malloc(state, sizeof(*entry));
-	if (state->error != EOK) {
-		free(name);
-		bithenge_transform_dec_ref(xform);
-		free(entry);
-		return;
-	}
-	entry->name = name;
-	entry->transform = xform;
-	entry->next = state->transform_list;
-	state->transform_list = entry;
-}
-
-static bithenge_transform_t *parse_transform(state_t *state);
-static bithenge_transform_t *parse_struct(state_t *state);
-static bithenge_expression_t *parse_expression(state_t *state);
-
-/*
- * Expressions
- */
-
-/** @cond internal */
-typedef enum {
-	PRECEDENCE_NONE,
-	PRECEDENCE_AND,
-	PRECEDENCE_EQUALS,
-	PRECEDENCE_COMPARE,
-	PRECEDENCE_ADD,
-	PRECEDENCE_MULTIPLY,
-} precedence_t;
-/** @endcond */
-
-static bithenge_binary_op_t token_as_binary_operator(token_type_t token)
-{
-	switch ((int)token) {
-	case '+':
-		return BITHENGE_EXPRESSION_ADD;
-	case '-':
-		return BITHENGE_EXPRESSION_SUBTRACT;
-	case '*':
-		return BITHENGE_EXPRESSION_MULTIPLY;
-	case TOKEN_INTEGER_DIVIDE:
-		return BITHENGE_EXPRESSION_INTEGER_DIVIDE;
-	case '%':
-		return BITHENGE_EXPRESSION_MODULO;
-	case '<':
-		return BITHENGE_EXPRESSION_LESS_THAN;
-	case TOKEN_LESS_THAN_OR_EQUAL:
-		return BITHENGE_EXPRESSION_LESS_THAN_OR_EQUAL;
-	case '>':
-		return BITHENGE_EXPRESSION_GREATER_THAN;
-	case TOKEN_GREATER_THAN_OR_EQUAL:
-		return BITHENGE_EXPRESSION_GREATER_THAN_OR_EQUAL;
-	case TOKEN_EQUALS:
-		return BITHENGE_EXPRESSION_EQUALS;
-	case TOKEN_NOT_EQUAL:
-		return BITHENGE_EXPRESSION_NOT_EQUALS;
-	case TOKEN_AND:
-		return BITHENGE_EXPRESSION_AND;
-	case TOKEN_OR:
-		return BITHENGE_EXPRESSION_OR;
-	case TOKEN_CONCAT:
-		return BITHENGE_EXPRESSION_CONCAT;
-	default:
-		return BITHENGE_EXPRESSION_INVALID_BINARY_OP;
-	}
-}
-
-static precedence_t binary_operator_precedence(bithenge_binary_op_t op)
-{
-	switch (op) {
-	case BITHENGE_EXPRESSION_ADD: /* fallthrough */
-	case BITHENGE_EXPRESSION_SUBTRACT: /* fallthrough */
-	case BITHENGE_EXPRESSION_CONCAT:
-		return PRECEDENCE_ADD;
-	case BITHENGE_EXPRESSION_MULTIPLY: /* fallthrough */
-	case BITHENGE_EXPRESSION_INTEGER_DIVIDE: /* fallthrough */
-	case BITHENGE_EXPRESSION_MODULO:
-		return PRECEDENCE_MULTIPLY;
-	case BITHENGE_EXPRESSION_LESS_THAN: /* fallthrough */
-	case BITHENGE_EXPRESSION_LESS_THAN_OR_EQUAL: /* fallthrough */
-	case BITHENGE_EXPRESSION_GREATER_THAN: /* fallthrough */
-	case BITHENGE_EXPRESSION_GREATER_THAN_OR_EQUAL:
-		return PRECEDENCE_COMPARE;
-	case BITHENGE_EXPRESSION_EQUALS: /* fallthrough */
-	case BITHENGE_EXPRESSION_NOT_EQUALS:
-		return PRECEDENCE_EQUALS;
-	case BITHENGE_EXPRESSION_AND: /* fallthrough */
-	case BITHENGE_EXPRESSION_OR:
-		return PRECEDENCE_AND;
-	default:
-		assert(false);
-		return PRECEDENCE_NONE;
-	}
-}
-
-static bithenge_expression_t *parse_term(state_t *state)
-{
-	errno_t rc;
-	if (state->token == TOKEN_TRUE || state->token == TOKEN_FALSE) {
-		bool val = state->token == TOKEN_TRUE;
-		next_token(state);
-		bithenge_node_t *node;
-		rc = bithenge_new_boolean_node(&node, val);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-
-		bithenge_expression_t *expr;
-		rc = bithenge_const_expression(&expr, node);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-
-		return expr;
-	} else if (state->token == TOKEN_IN) {
-		next_token(state);
-		state->in_node_used = true;
-		bithenge_expression_t *expr;
-		rc = bithenge_in_node_expression(&expr);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-		return expr;
-	} else if (state->token == TOKEN_INTEGER) {
-		bithenge_int_t val = state->token_int;
-		next_token(state);
-		bithenge_node_t *node;
-		rc = bithenge_new_integer_node(&node, val);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-
-		bithenge_expression_t *expr;
-		rc = bithenge_const_expression(&expr, node);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-
-		return expr;
-	} else if (state->token == TOKEN_IDENTIFIER) {
-		int i;
-		for (i = 0; i < state->num_params; i++)
-			if (!str_cmp(state->parameter_names[i],
-			    state->token_string))
-				break;
-
-		if (i == state->num_params) {
-			syntax_error(state, "unknown identifier");
-			return NULL;
-		}
-
-		next_token(state);
-
-		bithenge_expression_t *expr;
-		rc = bithenge_param_expression(&expr, i);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-		return expr;
-	} else if (state->token == '.') {
-		next_token(state);
-
-		const char *id = expect_identifier(state);
-		bithenge_node_t *key = NULL;
-		bithenge_expression_t *expr = NULL;
-
-		if (state->error == EOK) {
-			rc = bithenge_new_string_node(&key, id, true);
-			id = NULL;
-			error_errno(state, rc);
-		}
-
-		if (state->error == EOK) {
-			rc = bithenge_scope_member_expression(&expr, key);
-			key = NULL;
-			if (rc != EOK)
-				expr = NULL;
-			error_errno(state, rc);
-		}
-
-		if (state->error != EOK) {
-			free((char *)id);
-			bithenge_node_dec_ref(key);
-			bithenge_expression_dec_ref(expr);
-			return NULL;
-		}
-
-		return expr;
-	} else if (state->token == '(') {
-		next_token(state);
-		bithenge_expression_t *expr = parse_expression(state);
-		expect(state, ')');
-		return expr;
-	} else {
-		syntax_error(state, "expression expected");
-		return NULL;
-	}
-}
-
-static bithenge_expression_t *parse_postfix_expression(state_t *state)
-{
-	errno_t rc;
-	bithenge_expression_t *expr = parse_term(state);
-	while (state->error == EOK) {
-		if (state->token == '.') {
-			next_token(state);
-
-			const char *id = expect_identifier(state);
-
-			if (state->error != EOK) {
-				free((char *)id);
-				bithenge_expression_dec_ref(expr);
-				return NULL;
-			}
-
-			bithenge_node_t *key = NULL;
-			rc = bithenge_new_string_node(&key, id, true);
-			if (rc != EOK) {
-				error_errno(state, rc);
-				bithenge_expression_dec_ref(expr);
-				return NULL;
-			}
-
-			bithenge_expression_t *key_expr;
-			rc = bithenge_const_expression(&key_expr, key);
-			if (rc != EOK) {
-				error_errno(state, rc);
-				bithenge_expression_dec_ref(expr);
-				return NULL;
-			}
-
-			rc = bithenge_binary_expression(&expr,
-			    BITHENGE_EXPRESSION_MEMBER, expr, key_expr);
-			if (rc != EOK) {
-				error_errno(state, rc);
-				return NULL;
-			}
-		} else if (state->token == '[') {
-			next_token(state);
-			bithenge_expression_t *start = parse_expression(state);
-			bool absolute_limit = false;
-			if (state->token == ',' || state->token == ':') {
-				absolute_limit = state->token == ':';
-				next_token(state);
-				bithenge_expression_t *limit = NULL;
-				if (!(state->token == ']' && absolute_limit))
-					limit = parse_expression(state);
-				expect(state, ']');
-
-				if (state->error != EOK) {
-					bithenge_expression_dec_ref(expr);
-					bithenge_expression_dec_ref(start);
-					bithenge_expression_dec_ref(limit);
-					return NULL;
-				}
-				rc = bithenge_subblob_expression(&expr, expr, start,
-				    limit, absolute_limit);
-				if (rc != EOK) {
-					error_errno(state, rc);
-					return NULL;
-				}
-			} else if (state->token == ']') {
-				next_token(state);
-
-				if (state->error != EOK) {
-					bithenge_expression_dec_ref(expr);
-					bithenge_expression_dec_ref(start);
-					return NULL;
-				}
-				rc = bithenge_binary_expression(&expr,
-				    BITHENGE_EXPRESSION_MEMBER, expr, start);
-				if (rc != EOK) {
-					error_errno(state, rc);
-					return NULL;
-				}
-			} else {
-				syntax_error(state, "expected ',', ':', or ']'");
-				bithenge_expression_dec_ref(expr);
-				bithenge_expression_dec_ref(start);
-				return NULL;
-			}
-		} else {
-			break;
-		}
-	}
-	return expr;
-}
-
-static bithenge_expression_t *parse_expression_precedence(state_t *state,
-    precedence_t prev_precedence)
-{
-	bithenge_expression_t *expr = parse_postfix_expression(state);
-	while (state->error == EOK) {
-		bithenge_binary_op_t op =
-		    token_as_binary_operator(state->token);
-		if (op == BITHENGE_EXPRESSION_INVALID_BINARY_OP)
-			break;
-		precedence_t precedence = binary_operator_precedence(op);
-		if (precedence <= prev_precedence)
-			break;
-		next_token(state);
-
-		bithenge_expression_t *expr2 =
-		    parse_expression_precedence(state, precedence);
-		if (state->error != EOK) {
-			bithenge_expression_dec_ref(expr2);
-			break;
-		}
-		errno_t rc = bithenge_binary_expression(&expr, op, expr, expr2);
-		if (rc != EOK) {
-			expr = NULL;
-			error_errno(state, rc);
-		}
-	}
-	if (state->error != EOK) {
-		bithenge_expression_dec_ref(expr);
-		expr = NULL;
-	}
-	return expr;
-}
-
-static bithenge_expression_t *parse_expression(state_t *state)
-{
-	return parse_expression_precedence(state, PRECEDENCE_NONE);
-}
-
-/* state->token must be TOKEN_IDENTIFIER when this is called. */
-static bithenge_transform_t *parse_invocation(state_t *state)
-{
-	bithenge_transform_t *result = get_named_transform(state,
-	    state->token_string);
-	if (!result)
-		syntax_error(state, "transform not found");
-	next_token(state);
-
-	bithenge_expression_t **params = NULL;
-	int num_params = 0;
-	if (state->token == '(') {
-		next_token(state);
-		while (state->error == EOK && state->token != ')') {
-			if (num_params)
-				expect(state, ',');
-			params = state_realloc(state, params,
-			    (num_params + 1) * sizeof(*params));
-			if (state->error != EOK)
-				break;
-			params[num_params] = parse_expression(state);
-			num_params++;
-		}
-		expect(state, ')');
-	}
-
-	/* TODO: show correct error position */
-	if (state->error == EOK &&
-	    bithenge_transform_num_params(result) != num_params)
-		syntax_error(state, "incorrect number of parameters before");
-
-	if (state->error != EOK) {
-		while (num_params--)
-			bithenge_expression_dec_ref(params[num_params]);
-		free(params);
-		bithenge_transform_dec_ref(result);
-		return NULL;
-	}
-
-	if (num_params) {
-		errno_t rc = bithenge_param_wrapper(&result, result, params);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			result = NULL;
-		}
-	}
-
-	return result;
-}
-
-/** Create a transform that just produces an empty node.
- * @param state The parser state.
- * @return The new transform, or NULL on error.
- */
-static bithenge_transform_t *make_empty_transform(state_t *state)
-{
-	bithenge_node_t *node;
-	errno_t rc = bithenge_new_empty_internal_node(&node);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-
-	bithenge_expression_t *expr;
-	rc = bithenge_const_expression(&expr, node);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-
-	bithenge_transform_t *xform;
-	rc = bithenge_inputless_transform(&xform, expr);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-
-	return xform;
-}
-
-static bithenge_transform_t *parse_if(state_t *state, bool in_struct)
-{
-	expect(state, TOKEN_IF);
-	expect(state, '(');
-	bithenge_expression_t *expr = parse_expression(state);
-	expect(state, ')');
-	expect(state, '{');
-	bithenge_transform_t *true_xform =
-	    in_struct ? parse_struct(state) : parse_transform(state);
-	expect(state, '}');
-
-	bithenge_transform_t *false_xform = NULL;
-	if (state->token == TOKEN_ELSE) {
-		next_token(state);
-		expect(state, '{');
-		false_xform =
-		    in_struct ? parse_struct(state) : parse_transform(state);
-		expect(state, '}');
-	} else {
-		if (in_struct)
-			false_xform = make_empty_transform(state);
-		else
-			syntax_error(state, "else expected");
-	}
-
-	if (state->error != EOK) {
-		bithenge_expression_dec_ref(expr);
-		bithenge_transform_dec_ref(true_xform);
-		bithenge_transform_dec_ref(false_xform);
-		return NULL;
-	}
-
-	bithenge_transform_t *if_xform;
-	errno_t rc = bithenge_if_transform(&if_xform, expr, true_xform,
-	    false_xform);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-	return if_xform;
-}
-
-static bithenge_transform_t *parse_switch(state_t *state, bool in_struct)
-{
-	expect(state, TOKEN_SWITCH);
-	expect(state, '(');
-	bithenge_expression_t *ref_expr = parse_expression(state);
-	expect(state, ')');
-	expect(state, '{');
-	int num = 0;
-	bithenge_expression_t **exprs = NULL;
-	bithenge_transform_t **xforms = NULL;
-	while (state->error == EOK && state->token != '}') {
-		bithenge_expression_t *expr;
-		if (state->token == TOKEN_ELSE) {
-			next_token(state);
-			bithenge_node_t *node;
-			errno_t rc = bithenge_new_boolean_node(&node, true);
-			if (rc != EOK) {
-				error_errno(state, rc);
-				break;
-			}
-			rc = bithenge_const_expression(&expr, node);
-			if (rc != EOK) {
-				error_errno(state, rc);
-				break;
-			}
-		} else {
-			expr = parse_expression(state);
-			if (state->error == EOK) {
-				bithenge_expression_inc_ref(ref_expr);
-				errno_t rc = bithenge_binary_expression(&expr,
-				    BITHENGE_EXPRESSION_EQUALS, ref_expr,
-				    expr);
-				if (rc != EOK) {
-					error_errno(state, rc);
-					break;
-				}
-			}
-		}
-
-		expect(state, ':');
-		bithenge_transform_t *xform;
-		if (in_struct) {
-			expect(state, '{');
-			xform = parse_struct(state);
-			expect(state, '}');
-		} else
-			xform = parse_transform(state);
-		expect(state, ';');
-
-		exprs = state_realloc(state, exprs,
-		    sizeof(*exprs) * (num + 1));
-		xforms = state_realloc(state, xforms,
-		    sizeof(*xforms) * (num + 1));
-		if (state->error != EOK) {
-			bithenge_expression_dec_ref(expr);
-			bithenge_transform_dec_ref(xform);
-			break;
-		}
-
-		exprs[num] = expr;
-		xforms[num] = xform;
-		num++;
-	}
-	bithenge_expression_dec_ref(ref_expr);
-
-	bithenge_transform_t *switch_xform = &bithenge_invalid_transform;
-	bithenge_transform_inc_ref(switch_xform);
-	while (state->error == EOK && num >= 1) {
-		num--;
-		errno_t rc = bithenge_if_transform(&switch_xform, exprs[num],
-		    xforms[num], switch_xform);
-		if (rc != EOK) {
-			switch_xform = NULL;
-			error_errno(state, rc);
-		}
-	}
-
-	while (num >= 1) {
-		num--;
-		bithenge_expression_dec_ref(exprs[num]);
-		bithenge_transform_dec_ref(xforms[num]);
-	}
-	free(exprs);
-	free(xforms);
-
-	expect(state, '}');
-	return switch_xform;
-}
-
-static bithenge_transform_t *parse_repeat(state_t *state)
-{
-	expect(state, TOKEN_REPEAT);
-	bithenge_expression_t *expr = NULL;
-	if (state->token == '(') {
-		next_token(state);
-		expr = parse_expression(state);
-		expect(state, ')');
-	}
-	expect(state, '{');
-	bithenge_transform_t *xform = parse_transform(state);
-	expect(state, '}');
-
-	if (state->error != EOK) {
-		bithenge_expression_dec_ref(expr);
-		bithenge_transform_dec_ref(xform);
-		return NULL;
-	}
-
-	bithenge_transform_t *repeat_xform;
-	errno_t rc = bithenge_repeat_transform(&repeat_xform, xform, expr);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-	return repeat_xform;
-}
-
-static bithenge_transform_t *parse_do_while(state_t *state)
-{
-	expect(state, TOKEN_DO);
-	expect(state, '{');
-	bithenge_transform_t *xform = parse_transform(state);
-	expect(state, '}');
-	expect(state, TOKEN_WHILE);
-	expect(state, '(');
-	bithenge_expression_t *expr = parse_expression(state);
-	expect(state, ')');
-
-	if (state->error != EOK) {
-		bithenge_expression_dec_ref(expr);
-		bithenge_transform_dec_ref(xform);
-		return NULL;
-	}
-
-	bithenge_transform_t *do_while_xform;
-	errno_t rc = bithenge_do_while_transform(&do_while_xform, xform, expr);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-	return do_while_xform;
-}
-
-static bithenge_transform_t *parse_partial(state_t *state)
-{
-	expect(state, TOKEN_PARTIAL);
-	bithenge_transform_t *offset_xform = NULL;
-	if (state->token == '(') {
-		next_token(state);
-		bithenge_expression_t *offset = parse_expression(state);
-		expect(state, ')');
-
-		bithenge_expression_t *in_expr;
-		errno_t rc = bithenge_in_node_expression(&in_expr);
-		if (rc != EOK)
-			error_errno(state, rc);
-		if (state->error != EOK) {
-			bithenge_expression_dec_ref(offset);
-			return NULL;
-		}
-
-		rc = bithenge_subblob_expression(&offset, in_expr, offset,
-		    NULL, true);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-
-		rc = bithenge_expression_transform(&offset_xform, offset);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-	}
-	expect(state, '{');
-	bithenge_transform_t *xform = parse_transform(state);
-	expect(state, '}');
-	if (state->error != EOK) {
-		bithenge_transform_dec_ref(offset_xform);
-		bithenge_transform_dec_ref(xform);
-		return NULL;
-	}
-
-	errno_t rc = bithenge_partial_transform(&xform, xform);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		bithenge_transform_dec_ref(offset_xform);
-		return NULL;
-	}
-
-	if (offset_xform) {
-		bithenge_transform_t **xforms = malloc(2 * sizeof(*xforms));
-		if (!xforms) {
-			error_errno(state, ENOMEM);
-			bithenge_transform_dec_ref(xform);
-			bithenge_transform_dec_ref(offset_xform);
-			return NULL;
-		}
-		xforms[0] = xform;
-		xforms[1] = offset_xform;
-		rc = bithenge_new_composed_transform(&xform, xforms, 2);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-	}
-
-	return xform;
-}
-
-/* The TOKEN_STRUCT and '{' must already have been skipped. */
-static bithenge_transform_t *parse_struct(state_t *state)
-{
-	size_t num = 0;
-	bithenge_named_transform_t *subxforms;
-	/* We keep an extra space for the {NULL, NULL} terminator. */
-	subxforms = state_malloc(state, sizeof(*subxforms));
-	while (state->error == EOK && state->token != '}') {
-		if (state->token == TOKEN_IF) {
-			subxforms[num].transform = parse_if(state, true);
-			subxforms[num].name = NULL;
-		} else if (state->token == TOKEN_SWITCH) {
-			subxforms[num].transform = parse_switch(state, true);
-			subxforms[num].name = NULL;
-		} else {
-			if (state->token == '.') {
-				next_token(state);
-				subxforms[num].name = expect_identifier(state);
-			} else {
-				subxforms[num].name = NULL;
-			}
-			expect(state, TOKEN_LEFT_ARROW);
-			subxforms[num].transform = parse_transform(state);
-			expect(state, ';');
-		}
-		num++;
-		subxforms = state_realloc(state, subxforms,
-		    (num + 1) * sizeof(*subxforms));
-	}
-
-	if (state->error != EOK) {
-		while (num--) {
-			free((void *)subxforms[num].name);
-			bithenge_transform_dec_ref(subxforms[num].transform);
-		}
-		free(subxforms);
-		return NULL;
-	}
-
-	subxforms[num].name = NULL;
-	subxforms[num].transform = NULL;
-	bithenge_transform_t *result;
-	errno_t rc = bithenge_new_struct(&result, subxforms);
-	if (rc != EOK) {
-		error_errno(state, rc);
-		return NULL;
-	}
-	return result;
-}
-
-/** Parse a transform without composition.
- * @return The parsed transform, or NULL if an error occurred.
- */
-static bithenge_transform_t *parse_transform_no_compose(state_t *state)
-{
-	if (state->token == '(') {
-		next_token(state);
-		state->in_node_used = false;
-		bithenge_expression_t *expr = parse_expression(state);
-		expect(state, ')');
-		if (state->error != EOK) {
-			bithenge_expression_dec_ref(expr);
-			return NULL;
-		}
-
-		bithenge_transform_t *xform;
-		errno_t rc;
-		if (state->in_node_used)
-			rc = bithenge_expression_transform(&xform, expr);
-		else
-			rc = bithenge_inputless_transform(&xform, expr);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-		return xform;
-	} else if (state->token == TOKEN_DO) {
-		return parse_do_while(state);
-	} else if (state->token == TOKEN_IDENTIFIER) {
-		return parse_invocation(state);
-	} else if (state->token == TOKEN_IF) {
-		return parse_if(state, false);
-	} else if (state->token == TOKEN_PARTIAL) {
-		return parse_partial(state);
-	} else if (state->token == TOKEN_REPEAT) {
-		return parse_repeat(state);
-	} else if (state->token == TOKEN_STRUCT) {
-		next_token(state);
-		expect(state, '{');
-		bithenge_transform_t *xform = parse_struct(state);
-		expect(state, '}');
-		return xform;
-	} else if (state->token == TOKEN_SWITCH) {
-		return parse_switch(state, false);
-	} else {
-		syntax_error(state, "unexpected (transform expected)");
-		return NULL;
-	}
-}
-
-/** Parse a transform.
- * @return The parsed transform, or NULL if an error occurred.
- */
-static bithenge_transform_t *parse_transform(state_t *state)
-{
-	bithenge_transform_t *result = parse_transform_no_compose(state);
-	bithenge_transform_t **xforms = NULL;
-	size_t num = 1;
-	while (state->token == TOKEN_LEFT_ARROW) {
-		expect(state, TOKEN_LEFT_ARROW);
-		xforms = state_realloc(state, xforms,
-		    (num + 1) * sizeof(*xforms));
-		if (state->error != EOK)
-			break;
-		xforms[num++] = parse_transform_no_compose(state);
-	}
-	if (state->error != EOK) {
-		while (xforms && num > 1)
-			bithenge_transform_dec_ref(xforms[--num]);
-		free(xforms);
-		bithenge_transform_dec_ref(result);
-		return NULL;
-	}
-	if (xforms) {
-		xforms[0] = result;
-		errno_t rc = bithenge_new_composed_transform(&result, xforms, num);
-		if (rc != EOK) {
-			error_errno(state, rc);
-			return NULL;
-		}
-	}
-	return result;
-}
-
-/** Parse a definition. */
-static void parse_definition(state_t *state)
-{
-	expect(state, TOKEN_TRANSFORM);
-	char *name = expect_identifier(state);
-
-	if (state->token == '(') {
-		next_token(state);
-		while (state->error == EOK && state->token != ')') {
-			if (state->num_params)
-				expect(state, ',');
-			state->parameter_names = state_realloc(state,
-			    state->parameter_names,
-			    (state->num_params + 1) * sizeof(*state->parameter_names));
-			if (state->error != EOK)
-				break;
-			state->parameter_names[state->num_params++] =
-			    expect_identifier(state);
-		}
-		expect(state, ')');
-	}
-
-	bithenge_transform_t *barrier = NULL;
-	if (state->error == EOK) {
-		errno_t rc = bithenge_new_barrier_transform(&barrier,
-		    state->num_params);
-		if (rc != EOK) {
-			barrier = NULL;
-			error_errno(state, rc);
-		}
-	}
-
-	add_named_transform(state, barrier, name);
-
-	expect(state, '=');
-	bithenge_transform_t *xform = parse_transform(state);
-	expect(state, ';');
-
-	if (state->error == EOK) {
-		errno_t rc = bithenge_barrier_transform_set_subtransform(barrier,
-		    xform);
-		xform = NULL;
-		if (rc != EOK)
-			error_errno(state, rc);
-	}
-
-	if (state->error != EOK)
-		bithenge_transform_dec_ref(xform);
-
-	for (int i = 0; i < state->num_params; i++)
-		free(state->parameter_names[i]);
-	free(state->parameter_names);
-	state->parameter_names = NULL;
-	state->num_params = 0;
-}
-
-/** Initialize the state. */
-static void state_init(state_t *state, const char *filename)
-{
-	state->error = EOK;
-	state->transform_list = NULL;
-	state->parameter_names = NULL;
-	state->num_params = 0;
-	state->token = TOKEN_ERROR;
-	state->old_buffer_pos = state->buffer_pos = BUFFER_SIZE - 1;
-	state->lineno = 1;
-	state->line_offset = (int)-state->buffer_pos + 1;
-	state->filename = filename;
-	state->file = fopen(filename, "r");
-	if (!state->file) {
-		error_errno(state, errno);
-	} else {
-		next_token(state);
-	}
-}
-
-/** Destroy the state. */
-static void state_destroy(state_t *state)
-{
-	done_with_token(state);
-	state->token = TOKEN_ERROR;
-	if (state->file)
-		fclose(state->file);
-	transform_list_t *entry = state->transform_list;
-	while (entry) {
-		transform_list_t *next = entry->next;
-		free(entry->name);
-		bithenge_transform_dec_ref(entry->transform);
-		free(entry);
-		entry = next;
-	}
-	for (int i = 0; i < state->num_params; i++)
-		free(state->parameter_names[i]);
-	free(state->parameter_names);
-}
-
-/** Parse a script file.
- * @param filename The name of the script file.
- * @param[out] out Stores the "main" transform.
- * @return EOK on success, EINVAL on syntax error, or an error code from
- * errno.h.
- */
-errno_t bithenge_parse_script(const char *filename, bithenge_transform_t **out)
-{
-	state_t state;
-	state_init(&state, filename);
-	while (state.error == EOK && state.token != TOKEN_EOF)
-		parse_definition(&state);
-	*out = get_named_transform(&state, "main");
-	errno_t rc = state.error;
-	state_destroy(&state);
-	if (rc == EOK && !*out) {
-		fprintf(stderr, "no \"main\" transform\n");
-		rc = EINVAL;
-	}
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/sequence.c
===================================================================
--- uspace/lib/bithenge/src/sequence.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1160 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Sequence transforms.
- */
-
-#include <stdlib.h>
-#include <bithenge/blob.h>
-#include <bithenge/expression.h>
-#include <bithenge/sequence.h>
-#include <bithenge/tree.h>
-#include "common.h"
-
-/*
- * seq_node
- */
-
-typedef struct {
-	bithenge_node_t base;
-	const struct seq_node_ops *ops;
-	bithenge_blob_t *blob;
-	bithenge_scope_t *scope;
-	aoff64_t *ends;
-	size_t num_ends;
-	bool end_on_empty;
-	bithenge_int_t num_xforms;
-} seq_node_t;
-
-typedef struct seq_node_ops {
-	errno_t (*get_transform)(seq_node_t *self, bithenge_transform_t **out,
-	    bithenge_int_t index);
-} seq_node_ops_t;
-
-static bithenge_node_t *seq_as_node(seq_node_t *node)
-{
-	return &node->base;
-}
-
-static seq_node_t *node_as_seq(bithenge_node_t *node)
-{
-	return (seq_node_t *)node;
-}
-
-static errno_t seq_node_field_offset(seq_node_t *self, aoff64_t *out, size_t index)
-{
-	if (index == 0) {
-		*out = 0;
-		return EOK;
-	}
-	index--;
-	aoff64_t prev_offset =
-	    self->num_ends ? self->ends[self->num_ends - 1] : 0;
-	for (; self->num_ends <= index; self->num_ends++) {
-		bithenge_transform_t *subxform;
-		errno_t rc = self->ops->get_transform(self, &subxform,
-		    self->num_ends);
-		if (rc != EOK)
-			return rc;
-
-		bithenge_node_t *subblob_node;
-		bithenge_blob_inc_ref(self->blob);
-		rc = bithenge_new_offset_blob(&subblob_node, self->blob,
-		    prev_offset);
-		if (rc != EOK) {
-			bithenge_transform_dec_ref(subxform);
-			return rc;
-		}
-
-		if (self->end_on_empty) {
-			bool empty;
-			rc = bithenge_blob_empty(
-			    bithenge_node_as_blob(subblob_node), &empty);
-			if (rc == EOK && empty) {
-				self->num_xforms = self->num_ends;
-				rc = ENOENT;
-			}
-			if (rc != EOK) {
-				bithenge_transform_dec_ref(subxform);
-				bithenge_node_dec_ref(subblob_node);
-				return rc;
-			}
-		}
-
-		bithenge_blob_t *subblob = bithenge_node_as_blob(subblob_node);
-		aoff64_t field_size;
-		rc = bithenge_transform_prefix_length(subxform, self->scope,
-		    subblob, &field_size);
-		bithenge_node_dec_ref(subblob_node);
-		bithenge_transform_dec_ref(subxform);
-		if (rc != EOK)
-			return rc;
-
-		if (self->num_xforms == -1) {
-			aoff64_t *new_ends = realloc(self->ends,
-			    (self->num_ends + 1) * sizeof(*new_ends));
-			if (!new_ends)
-				return ENOMEM;
-			self->ends = new_ends;
-		}
-
-		prev_offset = self->ends[self->num_ends] =
-		    prev_offset + field_size;
-	}
-	*out = self->ends[index];
-	return EOK;
-}
-
-static errno_t seq_node_subtransform(seq_node_t *self, bithenge_node_t **out,
-    size_t index)
-{
-	aoff64_t start_pos;
-	errno_t rc = seq_node_field_offset(self, &start_pos, index);
-	if (rc != EOK)
-		return rc;
-
-	bithenge_transform_t *subxform;
-	rc = self->ops->get_transform(self, &subxform, index);
-	if (rc != EOK)
-		return rc;
-
-	if (index == self->num_ends) {
-		/*
-		 * We can apply the subtransform and cache its prefix length at
-		 * the same time.
-		 */
-		bithenge_node_t *blob_node;
-		bithenge_blob_inc_ref(self->blob);
-		rc = bithenge_new_offset_blob(&blob_node, self->blob,
-		    start_pos);
-		if (rc != EOK) {
-			bithenge_transform_dec_ref(subxform);
-			return rc;
-		}
-
-		if (self->end_on_empty) {
-			bool empty;
-			rc = bithenge_blob_empty(
-			    bithenge_node_as_blob(blob_node), &empty);
-			if (rc == EOK && empty) {
-				self->num_xforms = self->num_ends;
-				rc = ENOENT;
-			}
-			if (rc != EOK) {
-				bithenge_transform_dec_ref(subxform);
-				bithenge_node_dec_ref(blob_node);
-				return rc;
-			}
-		}
-
-		aoff64_t size;
-		rc = bithenge_transform_prefix_apply(subxform, self->scope,
-		    bithenge_node_as_blob(blob_node), out, &size);
-		bithenge_node_dec_ref(blob_node);
-		bithenge_transform_dec_ref(subxform);
-		if (rc != EOK)
-			return rc;
-
-		if (self->num_xforms == -1) {
-			aoff64_t *new_ends = realloc(self->ends,
-			    (self->num_ends + 1) * sizeof(*new_ends));
-			if (!new_ends)
-				return ENOMEM;
-			self->ends = new_ends;
-		}
-		self->ends[self->num_ends++] = start_pos + size;
-	} else {
-		aoff64_t end_pos;
-		errno_t rc = seq_node_field_offset(self, &end_pos, index + 1);
-		if (rc != EOK) {
-			bithenge_transform_dec_ref(subxform);
-			return rc;
-		}
-
-		bithenge_node_t *blob_node;
-		bithenge_blob_inc_ref(self->blob);
-		rc = bithenge_new_subblob(&blob_node, self->blob, start_pos,
-		    end_pos - start_pos);
-		if (rc != EOK) {
-			bithenge_transform_dec_ref(subxform);
-			return rc;
-		}
-
-		rc = bithenge_transform_apply(subxform, self->scope, blob_node,
-		    out);
-		bithenge_node_dec_ref(blob_node);
-		bithenge_transform_dec_ref(subxform);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t seq_node_complete(seq_node_t *self, bool *out)
-{
-	aoff64_t blob_size, end_pos;
-	errno_t rc = bithenge_blob_size(self->blob, &blob_size);
-	if (rc != EOK)
-		return rc;
-	rc = seq_node_field_offset(self, &end_pos, self->num_xforms);
-	if (rc != EOK)
-		return rc;
-	*out = blob_size == end_pos;
-	return EOK;
-}
-
-static void seq_node_destroy(seq_node_t *self)
-{
-	bithenge_scope_dec_ref(self->scope);
-	bithenge_blob_dec_ref(self->blob);
-	free(self->ends);
-}
-
-static void seq_node_set_num_xforms(seq_node_t *self,
-    bithenge_int_t num_xforms)
-{
-	self->num_xforms = num_xforms;
-}
-
-static bithenge_scope_t *seq_node_scope(seq_node_t *self)
-{
-	return self->scope;
-}
-
-static errno_t seq_node_init(seq_node_t *self, const seq_node_ops_t *ops,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_int_t num_xforms,
-    bool end_on_empty)
-{
-	self->ops = ops;
-	if (num_xforms != -1) {
-		self->ends = malloc(sizeof(*self->ends) * num_xforms);
-		if (!self->ends)
-			return ENOMEM;
-	} else
-		self->ends = NULL;
-	bithenge_blob_inc_ref(blob);
-	self->blob = blob;
-	self->num_xforms = num_xforms;
-	self->num_ends = 0;
-	self->end_on_empty = end_on_empty;
-	self->scope = scope;
-	if (self->scope)
-		bithenge_scope_inc_ref(self->scope);
-	return EOK;
-}
-
-/*
- * bithenge_new_struct
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_named_transform_t *subtransforms;
-	size_t num_subtransforms;
-} struct_transform_t;
-
-static bithenge_transform_t *struct_as_transform(struct_transform_t *xform)
-{
-	return &xform->base;
-}
-
-static struct_transform_t *transform_as_struct(bithenge_transform_t *xform)
-{
-	return (struct_transform_t *)xform;
-}
-
-typedef struct {
-	seq_node_t base;
-	struct_transform_t *transform;
-	bool prefix;
-} struct_node_t;
-
-static seq_node_t *struct_as_seq(struct_node_t *node)
-{
-	return &node->base;
-}
-
-static struct_node_t *seq_as_struct(seq_node_t *base)
-{
-	return (struct_node_t *)base;
-}
-
-static bithenge_node_t *struct_as_node(struct_node_t *node)
-{
-	return seq_as_node(struct_as_seq(node));
-}
-
-static struct_node_t *node_as_struct(bithenge_node_t *node)
-{
-	return seq_as_struct(node_as_seq(node));
-}
-
-static errno_t struct_node_for_each(bithenge_node_t *base,
-    bithenge_for_each_func_t func, void *data)
-{
-	errno_t rc = EOK;
-	struct_node_t *self = node_as_struct(base);
-	bithenge_named_transform_t *subxforms =
-	    self->transform->subtransforms;
-
-	for (bithenge_int_t i = 0; subxforms[i].transform; i++) {
-		bithenge_node_t *subxform_result;
-		rc = seq_node_subtransform(struct_as_seq(self),
-		    &subxform_result, i);
-		if (rc != EOK)
-			return rc;
-
-		if (subxforms[i].name) {
-			bithenge_node_t *name_node;
-			rc = bithenge_new_string_node(&name_node,
-			    subxforms[i].name, false);
-			if (rc == EOK) {
-				rc = func(name_node, subxform_result, data);
-				subxform_result = NULL;
-			}
-		} else {
-			if (bithenge_node_type(subxform_result) !=
-			    BITHENGE_NODE_INTERNAL) {
-				rc = EINVAL;
-			} else {
-				rc = bithenge_node_for_each(subxform_result,
-				    func, data);
-			}
-		}
-		bithenge_node_dec_ref(subxform_result);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (!self->prefix) {
-		bool complete;
-		rc = seq_node_complete(struct_as_seq(self), &complete);
-		if (rc != EOK)
-			return rc;
-		if (!complete)
-			return EINVAL;
-	}
-
-	return rc;
-}
-
-static errno_t struct_node_get(bithenge_node_t *base, bithenge_node_t *key,
-    bithenge_node_t **out)
-{
-	struct_node_t *self = node_as_struct(base);
-
-	errno_t rc = ENOENT;
-	if (bithenge_node_type(key) != BITHENGE_NODE_STRING)
-		goto end;
-	const char *name = bithenge_string_node_value(key);
-
-	const bithenge_named_transform_t *subxforms =
-	    self->transform->subtransforms;
-	for (bithenge_int_t i = 0; subxforms[i].transform; i++) {
-		if (subxforms[i].name && !str_cmp(name, subxforms[i].name)) {
-			rc = seq_node_subtransform(struct_as_seq(self), out, i);
-			goto end;
-		}
-	}
-
-	for (bithenge_int_t i = 0; subxforms[i].transform; i++) {
-		if (subxforms[i].name)
-			continue;
-		bithenge_node_t *subxform_result;
-		rc = seq_node_subtransform(struct_as_seq(self),
-		    &subxform_result, i);
-		if (rc != EOK)
-			goto end;
-		if (bithenge_node_type(subxform_result) !=
-		    BITHENGE_NODE_INTERNAL) {
-			bithenge_node_dec_ref(subxform_result);
-			rc = EINVAL;
-			goto end;
-		}
-		bithenge_node_inc_ref(key);
-		rc = bithenge_node_get(subxform_result, key, out);
-		bithenge_node_dec_ref(subxform_result);
-		if (rc != ENOENT)
-			goto end;
-	}
-
-	rc = ENOENT;
-end:
-	bithenge_node_dec_ref(key);
-	return rc;
-}
-
-static void struct_node_destroy(bithenge_node_t *base)
-{
-	struct_node_t *node = node_as_struct(base);
-
-	/*
-	 * Treat the scope carefully because of the circular reference. In
-	 * struct_transform_make_node, things are set up so node owns a
-	 * reference to the scope, but scope doesn't own a reference to node,
-	 * so node's reference count is too low.
-	 */
-	bithenge_scope_t *scope = seq_node_scope(struct_as_seq(node));
-	if (scope->refs == 1) {
-		/*
-		 * Mostly normal destroy, but we didn't inc_ref(node) for the
-		 * scope in struct_transform_make_node, so make sure it doesn't
-		 * try to dec_ref.
-		 */
-		scope->current_node = NULL;
-		seq_node_destroy(struct_as_seq(node));
-	} else if (scope->refs > 1) {
-		/*
-		 * The scope is still needed, but node isn't otherwise needed.
-		 * Switch things around so scope owns a reference to node, but
-		 * not vice versa, and scope's reference count is too low.
-		 */
-		bithenge_node_inc_ref(base);
-		bithenge_scope_dec_ref(scope);
-		return;
-	} else {
-		/*
-		 * This happens after the previous case, when scope is no
-		 * longer used and is being destroyed. Since scope is already
-		 * being destroyed, set it to NULL here so we don't try to
-		 * destroy it twice.
-		 */
-		struct_as_seq(node)->scope = NULL;
-		seq_node_destroy(struct_as_seq(node));
-	}
-
-	bithenge_transform_dec_ref(struct_as_transform(node->transform));
-	free(node);
-}
-
-static const bithenge_internal_node_ops_t struct_node_ops = {
-	.for_each = struct_node_for_each,
-	.get = struct_node_get,
-	.destroy = struct_node_destroy,
-};
-
-static errno_t struct_node_get_transform(seq_node_t *base,
-    bithenge_transform_t **out, bithenge_int_t index)
-{
-	struct_node_t *self = seq_as_struct(base);
-	*out = self->transform->subtransforms[index].transform;
-	bithenge_transform_inc_ref(*out);
-	return EOK;
-}
-
-static const seq_node_ops_t struct_node_seq_ops = {
-	.get_transform = struct_node_get_transform,
-};
-
-static errno_t struct_transform_make_node(struct_transform_t *self,
-    bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob,
-    bool prefix)
-{
-	struct_node_t *node = malloc(sizeof(*node));
-	if (!node)
-		return ENOMEM;
-
-	errno_t rc = bithenge_init_internal_node(struct_as_node(node),
-	    &struct_node_ops);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-	bithenge_scope_t *inner;
-	rc = bithenge_scope_new(&inner, scope);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-
-	rc = seq_node_init(struct_as_seq(node), &struct_node_seq_ops, inner,
-	    blob, self->num_subtransforms, false);
-	if (rc != EOK) {
-		bithenge_scope_dec_ref(inner);
-		free(node);
-		return rc;
-	}
-
-	bithenge_transform_inc_ref(struct_as_transform(self));
-	node->transform = self;
-	node->prefix = prefix;
-
-	/*
-	 * We should inc_ref(node) here, but that would make a cycle. Instead,
-	 * we leave it 1 too low, so that when the only remaining use of node
-	 * is the scope, node will be destroyed. Also see the comment in
-	 * struct_node_destroy.
-	 */
-	bithenge_scope_set_current_node(inner, struct_as_node(node));
-	bithenge_scope_dec_ref(inner);
-
-	*out = struct_as_node(node);
-
-	return EOK;
-}
-
-static errno_t struct_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	struct_transform_t *self = transform_as_struct(base);
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	return struct_transform_make_node(self, out, scope,
-	    bithenge_node_as_blob(in), false);
-}
-
-static errno_t struct_transform_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
-{
-	struct_transform_t *self = transform_as_struct(base);
-	bithenge_node_t *struct_node;
-	errno_t rc = struct_transform_make_node(self, &struct_node, scope, blob,
-	    true);
-	if (rc != EOK)
-		return rc;
-
-	rc = seq_node_field_offset(node_as_seq(struct_node), out,
-	    self->num_subtransforms);
-	bithenge_node_dec_ref(struct_node);
-	return rc;
-}
-
-static errno_t struct_transform_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	struct_transform_t *self = transform_as_struct(base);
-	errno_t rc = struct_transform_make_node(self, out_node, scope, blob,
-	    true);
-	if (rc != EOK)
-		return rc;
-
-	if (out_size) {
-		rc = seq_node_field_offset(node_as_seq(*out_node), out_size,
-		    self->num_subtransforms);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(*out_node);
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-static void free_subtransforms(bithenge_named_transform_t *subtransforms)
-{
-	for (size_t i = 0; subtransforms[i].transform; i++) {
-		free((void *)subtransforms[i].name);
-		bithenge_transform_dec_ref(subtransforms[i].transform);
-	}
-	free(subtransforms);
-}
-
-static void struct_transform_destroy(bithenge_transform_t *base)
-{
-	struct_transform_t *self = transform_as_struct(base);
-	free_subtransforms(self->subtransforms);
-	free(self);
-}
-
-static bithenge_transform_ops_t struct_transform_ops = {
-	.apply = struct_transform_apply,
-	.prefix_length = struct_transform_prefix_length,
-	.prefix_apply = struct_transform_prefix_apply,
-	.destroy = struct_transform_destroy,
-};
-
-/** Create a struct transform. The transform will apply its subtransforms
- * sequentially to a blob to create an internal node. Each result is either
- * given a key from @a subtransforms or, if the name is NULL, the result's keys
- * and values are merged into the struct transform's result. This function
- * takes ownership of @a subtransforms and the names and references therein.
- * @param[out] out Stores the created transform.
- * @param subtransforms The subtransforms and field names.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_struct(bithenge_transform_t **out,
-    bithenge_named_transform_t *subtransforms)
-{
-	errno_t rc;
-	struct_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_transform(struct_as_transform(self),
-	    &struct_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-	self->subtransforms = subtransforms;
-	self->num_subtransforms = 0;
-	while (subtransforms[self->num_subtransforms].transform)
-		self->num_subtransforms++;
-	*out = struct_as_transform(self);
-	return EOK;
-error:
-	free_subtransforms(subtransforms);
-	free(self);
-	return rc;
-}
-
-/*
- * bithenge_repeat_transform
- */
-
-/* TODO: ignore errors */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_expression_t *expr;
-	bithenge_transform_t *xform;
-} repeat_transform_t;
-
-static inline bithenge_transform_t *repeat_as_transform(
-    repeat_transform_t *self)
-{
-	return &self->base;
-}
-
-static inline repeat_transform_t *transform_as_repeat(
-    bithenge_transform_t *base)
-{
-	return (repeat_transform_t *)base;
-}
-
-typedef struct {
-	seq_node_t base;
-	bool prefix;
-	bithenge_int_t count;
-	bithenge_transform_t *xform;
-} repeat_node_t;
-
-static seq_node_t *repeat_as_seq(repeat_node_t *self)
-{
-	return &self->base;
-}
-
-static repeat_node_t *seq_as_repeat(seq_node_t *base)
-{
-	return (repeat_node_t *)base;
-}
-
-static bithenge_node_t *repeat_as_node(repeat_node_t *self)
-{
-	return seq_as_node(repeat_as_seq(self));
-}
-
-static repeat_node_t *node_as_repeat(bithenge_node_t *base)
-{
-	return seq_as_repeat(node_as_seq(base));
-}
-
-static errno_t repeat_node_for_each(bithenge_node_t *base,
-    bithenge_for_each_func_t func, void *data)
-{
-	errno_t rc = EOK;
-	repeat_node_t *self = node_as_repeat(base);
-
-	for (bithenge_int_t i = 0; self->count == -1 || i < self->count; i++) {
-		bithenge_node_t *subxform_result;
-		rc = seq_node_subtransform(repeat_as_seq(self),
-		    &subxform_result, i);
-		if ((rc == EINVAL || rc == ENOENT) && self->count == -1) {
-			self->count = i;
-			seq_node_set_num_xforms(repeat_as_seq(self),
-			    self->count);
-			rc = EOK;
-			break;
-		}
-		if (rc != EOK)
-			return rc;
-
-		bithenge_node_t *key_node;
-		rc = bithenge_new_integer_node(&key_node, i);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(subxform_result);
-			return rc;
-		}
-		rc = func(key_node, subxform_result, data);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (!self->prefix) {
-		bool complete;
-		rc = seq_node_complete(repeat_as_seq(self), &complete);
-		if (rc != EOK)
-			return rc;
-		if (!complete)
-			return EINVAL;
-	}
-
-	return rc;
-}
-
-static errno_t repeat_node_get(bithenge_node_t *base, bithenge_node_t *key,
-    bithenge_node_t **out)
-{
-	repeat_node_t *self = node_as_repeat(base);
-
-	if (bithenge_node_type(key) != BITHENGE_NODE_INTEGER) {
-		bithenge_node_dec_ref(key);
-		return ENOENT;
-	}
-
-	bithenge_int_t index = bithenge_integer_node_value(key);
-	bithenge_node_dec_ref(key);
-	if (index < 0 || (self->count != -1 && index >= self->count))
-		return ENOENT;
-	return seq_node_subtransform(repeat_as_seq(self), out, index);
-}
-
-static void repeat_node_destroy(bithenge_node_t *base)
-{
-	repeat_node_t *self = node_as_repeat(base);
-	seq_node_destroy(repeat_as_seq(self));
-	bithenge_transform_dec_ref(self->xform);
-	free(self);
-}
-
-static const bithenge_internal_node_ops_t repeat_node_ops = {
-	.for_each = repeat_node_for_each,
-	.get = repeat_node_get,
-	.destroy = repeat_node_destroy,
-};
-
-static errno_t repeat_node_get_transform(seq_node_t *base,
-    bithenge_transform_t **out, bithenge_int_t index)
-{
-	repeat_node_t *self = seq_as_repeat(base);
-	*out = self->xform;
-	bithenge_transform_inc_ref(*out);
-	return EOK;
-}
-
-static const seq_node_ops_t repeat_node_seq_ops = {
-	.get_transform = repeat_node_get_transform,
-};
-
-static errno_t repeat_transform_make_node(repeat_transform_t *self,
-    bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob,
-    bool prefix)
-{
-	bithenge_int_t count = -1;
-	if (self->expr != NULL) {
-		bithenge_node_t *count_node;
-		errno_t rc = bithenge_expression_evaluate(self->expr, scope,
-		    &count_node);
-		if (rc != EOK)
-			return rc;
-		if (bithenge_node_type(count_node) != BITHENGE_NODE_INTEGER) {
-			bithenge_node_dec_ref(count_node);
-			return EINVAL;
-		}
-		count = bithenge_integer_node_value(count_node);
-		bithenge_node_dec_ref(count_node);
-		if (count < 0)
-			return EINVAL;
-	}
-
-	repeat_node_t *node = malloc(sizeof(*node));
-	if (!node)
-		return ENOMEM;
-
-	errno_t rc = bithenge_init_internal_node(repeat_as_node(node),
-	    &repeat_node_ops);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-
-	rc = seq_node_init(repeat_as_seq(node), &repeat_node_seq_ops, scope,
-	    blob, count, count == -1);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-
-	bithenge_transform_inc_ref(self->xform);
-	node->xform = self->xform;
-	node->count = count;
-	node->prefix = prefix;
-	*out = repeat_as_node(node);
-	return EOK;
-}
-
-static errno_t repeat_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	repeat_transform_t *self = transform_as_repeat(base);
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	return repeat_transform_make_node(self, out, scope,
-	    bithenge_node_as_blob(in), false);
-}
-
-static errno_t repeat_transform_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	repeat_transform_t *self = transform_as_repeat(base);
-	errno_t rc = repeat_transform_make_node(self, out_node, scope, blob, true);
-	if (rc != EOK)
-		return rc;
-
-	if (out_size) {
-		bithenge_int_t count = node_as_repeat(*out_node)->count;
-		if (count != -1) {
-			rc = seq_node_field_offset(node_as_seq(*out_node),
-			    out_size, count);
-			if (rc != EOK) {
-				bithenge_node_dec_ref(*out_node);
-				return rc;
-			}
-		} else {
-			*out_size = 0;
-			for (count = 1; ; count++) {
-				aoff64_t size;
-				rc = seq_node_field_offset(
-				    node_as_seq(*out_node), &size, count);
-				if (rc == EINVAL || rc == ENOENT)
-					break;
-				if (rc != EOK) {
-					bithenge_node_dec_ref(*out_node);
-					return rc;
-				}
-				*out_size = size;
-			}
-		}
-	}
-	return EOK;
-}
-
-static void repeat_transform_destroy(bithenge_transform_t *base)
-{
-	repeat_transform_t *self = transform_as_repeat(base);
-	bithenge_transform_dec_ref(self->xform);
-	bithenge_expression_dec_ref(self->expr);
-	free(self);
-}
-
-static const bithenge_transform_ops_t repeat_transform_ops = {
-	.apply = repeat_transform_apply,
-	.prefix_apply = repeat_transform_prefix_apply,
-	.destroy = repeat_transform_destroy,
-};
-
-/** Create a transform that applies its subtransform repeatedly. Takes a
- * reference to @a xform and @a expr.
- * @param[out] out Holds the new transform.
- * @param xform The subtransform to apply repeatedly.
- * @param expr Used to calculate the number of times @a xform will be applied.
- * May be NULL, in which case @a xform will be applied indefinitely.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_repeat_transform(bithenge_transform_t **out,
-    bithenge_transform_t *xform, bithenge_expression_t *expr)
-{
-	errno_t rc;
-	repeat_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(repeat_as_transform(self),
-	    &repeat_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->expr = expr;
-	self->xform = xform;
-	*out = repeat_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_expression_dec_ref(expr);
-	bithenge_transform_dec_ref(xform);
-	return rc;
-}
-
-/*
- * bithenge_do_while_transform
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_expression_t *expr;
-	bithenge_transform_t *xform;
-} do_while_transform_t;
-
-static inline bithenge_transform_t *do_while_as_transform(
-    do_while_transform_t *self)
-{
-	return &self->base;
-}
-
-static inline do_while_transform_t *transform_as_do_while(
-    bithenge_transform_t *base)
-{
-	return (do_while_transform_t *)base;
-}
-
-typedef struct {
-	seq_node_t base;
-	bithenge_expression_t *expr;
-	bithenge_transform_t *xform;
-	bithenge_int_t count;
-} do_while_node_t;
-
-static seq_node_t *do_while_as_seq(do_while_node_t *self)
-{
-	return &self->base;
-}
-
-static do_while_node_t *seq_as_do_while(seq_node_t *base)
-{
-	return (do_while_node_t *)base;
-}
-
-static bithenge_node_t *do_while_as_node(do_while_node_t *self)
-{
-	return seq_as_node(do_while_as_seq(self));
-}
-
-static do_while_node_t *node_as_do_while(bithenge_node_t *base)
-{
-	return seq_as_do_while(node_as_seq(base));
-}
-
-static errno_t do_while_node_for_each(bithenge_node_t *base,
-    bithenge_for_each_func_t func, void *data)
-{
-	errno_t rc = EOK;
-	do_while_node_t *self = node_as_do_while(base);
-
-	for (bithenge_int_t i = 0; ; i++) {
-		bithenge_node_t *subxform_result;
-		rc = seq_node_subtransform(do_while_as_seq(self),
-		    &subxform_result, i);
-		if (rc != EOK)
-			return rc;
-
-		bithenge_node_t *key_node;
-		rc = bithenge_new_integer_node(&key_node, i);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(subxform_result);
-			return rc;
-		}
-		bithenge_node_inc_ref(subxform_result);
-		rc = func(key_node, subxform_result, data);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(subxform_result);
-			return rc;
-		}
-
-		bithenge_scope_t *scope;
-		rc = bithenge_scope_new(&scope,
-		    seq_node_scope(do_while_as_seq(self)));
-		if (rc != EOK) {
-			bithenge_node_dec_ref(subxform_result);
-			return rc;
-		}
-		bithenge_scope_set_current_node(scope, subxform_result);
-		bithenge_node_t *expr_result;
-		rc = bithenge_expression_evaluate(self->expr, scope,
-		    &expr_result);
-		bithenge_scope_dec_ref(scope);
-		if (rc != EOK)
-			return rc;
-		if (bithenge_node_type(expr_result) != BITHENGE_NODE_BOOLEAN) {
-			bithenge_node_dec_ref(expr_result);
-			return EINVAL;
-		}
-		bool cond = bithenge_boolean_node_value(expr_result);
-		bithenge_node_dec_ref(expr_result);
-		if (!cond) {
-			self->count = i + 1;
-			seq_node_set_num_xforms(do_while_as_seq(self),
-			    self->count);
-			break;
-		}
-	}
-
-	return rc;
-}
-
-static void do_while_node_destroy(bithenge_node_t *base)
-{
-	do_while_node_t *self = node_as_do_while(base);
-	seq_node_destroy(do_while_as_seq(self));
-	bithenge_expression_dec_ref(self->expr);
-	bithenge_transform_dec_ref(self->xform);
-	free(self);
-}
-
-static const bithenge_internal_node_ops_t do_while_node_ops = {
-	.for_each = do_while_node_for_each,
-	.destroy = do_while_node_destroy,
-};
-
-static errno_t do_while_node_get_transform(seq_node_t *base,
-    bithenge_transform_t **out, bithenge_int_t index)
-{
-	do_while_node_t *self = seq_as_do_while(base);
-	*out = self->xform;
-	bithenge_transform_inc_ref(*out);
-	return EOK;
-}
-
-static const seq_node_ops_t do_while_node_seq_ops = {
-	.get_transform = do_while_node_get_transform,
-};
-
-static errno_t do_while_transform_make_node(do_while_transform_t *self,
-    bithenge_node_t **out, bithenge_scope_t *scope, bithenge_blob_t *blob)
-{
-	do_while_node_t *node = malloc(sizeof(*node));
-	if (!node)
-		return ENOMEM;
-
-	errno_t rc = bithenge_init_internal_node(do_while_as_node(node),
-	    &do_while_node_ops);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-
-	rc = seq_node_init(do_while_as_seq(node), &do_while_node_seq_ops,
-	    scope, blob, -1, false);
-	if (rc != EOK) {
-		free(node);
-		return rc;
-	}
-
-	bithenge_transform_inc_ref(self->xform);
-	node->xform = self->xform;
-	bithenge_expression_inc_ref(self->expr);
-	node->expr = self->expr;
-	node->count = -1;
-	*out = do_while_as_node(node);
-	return EOK;
-}
-
-static errno_t for_each_noop(bithenge_node_t *key, bithenge_node_t *value,
-    void *data)
-{
-	bithenge_node_dec_ref(key);
-	bithenge_node_dec_ref(value);
-	return EOK;
-}
-
-static errno_t do_while_transform_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	do_while_transform_t *self = transform_as_do_while(base);
-	errno_t rc = do_while_transform_make_node(self, out_node, scope, blob);
-	if (rc != EOK)
-		return rc;
-
-	if (out_size) {
-		rc = bithenge_node_for_each(*out_node, for_each_noop, NULL);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(*out_node);
-			return rc;
-		}
-
-		rc = seq_node_field_offset(node_as_seq(*out_node), out_size,
-		    node_as_do_while(*out_node)->count);
-		if (rc != EOK) {
-			bithenge_node_dec_ref(*out_node);
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-static void do_while_transform_destroy(bithenge_transform_t *base)
-{
-	do_while_transform_t *self = transform_as_do_while(base);
-	bithenge_transform_dec_ref(self->xform);
-	bithenge_expression_dec_ref(self->expr);
-	free(self);
-}
-
-static const bithenge_transform_ops_t do_while_transform_ops = {
-	.prefix_apply = do_while_transform_prefix_apply,
-	.destroy = do_while_transform_destroy,
-};
-
-/** Create a transform that applies its subtransform while an expression on the
- * result returns true. Takes a reference to @a xform and @a expr.
- * @param[out] out Holds the new transform.
- * @param xform The subtransform to apply repeatedly.
- * @param expr Applied in the result of each application of @a xform to
- * determine whether there will be more.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_do_while_transform(bithenge_transform_t **out,
-    bithenge_transform_t *xform, bithenge_expression_t *expr)
-{
-	errno_t rc;
-	do_while_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bithenge_init_transform(do_while_as_transform(self),
-	    &do_while_transform_ops, 0);
-	if (rc != EOK)
-		goto error;
-
-	self->expr = expr;
-	self->xform = xform;
-	*out = do_while_as_transform(self);
-	return EOK;
-
-error:
-	free(self);
-	bithenge_expression_dec_ref(expr);
-	bithenge_transform_dec_ref(xform);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/source.c
===================================================================
--- uspace/lib/bithenge/src/source.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Provide various external sources of data.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <bithenge/blob.h>
-#include <bithenge/file.h>
-#include <bithenge/source.h>
-#include "common.h"
-
-#ifdef __HELENOS__
-#include <loc.h>
-#include "helenos/block.h"
-#endif
-
-static inline int hex_digit(char digit)
-{
-	if ('0' <= digit && digit <= '9')
-		return digit - '0' + 0x0;
-	if ('a' <= digit && digit <= 'f')
-		return digit - 'a' + 0xa;
-	if ('A' <= digit && digit <= 'F')
-		return digit - 'A' + 0xA;
-	return -1;
-}
-
-static errno_t blob_from_hex(bithenge_node_t **out, const char *hex)
-{
-	size_t size = str_length(hex);
-	if (size % 2)
-		return EINVAL;
-	size /= 2;
-	char *buffer = malloc(size);
-	if (!buffer)
-		return ENOMEM;
-	for (size_t i = 0; i < size; i++) {
-		int upper = hex_digit(hex[2 * i + 0]);
-		int lower = hex_digit(hex[2 * i + 1]);
-		if (upper == -1 || lower == -1) {
-			free(buffer);
-			return EINVAL;
-		}
-		buffer[i] = upper << 4 | lower;
-	}
-	return bithenge_new_blob_from_buffer(out, buffer, size, true);
-}
-
-/** Create a node from a source described with a string. For instance,
- * "hex:55aa" will result in a blob node. If there is no colon in the string,
- * it is assumed to be a filename.
- * @param[out] out Stores the created node.
- * @param source Specifies the node to be created.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_node_from_source(bithenge_node_t **out, const char *source)
-{
-	if (str_chr(source, ':')) {
-		if (!str_lcmp(source, "file:", 5)) {
-			// Example: file:/textdemo
-			return bithenge_new_file_blob(out, source + 5);
-#ifdef __HELENOS__
-		} else if (!str_lcmp(source, "block:", 6)) {
-			// Example: block:bd/initrd
-			service_id_t service_id;
-			errno_t rc = loc_service_get_id(source + 6, &service_id, 0);
-			if (rc != EOK)
-				return rc;
-			return bithenge_new_block_blob(out, service_id);
-#endif
-		} else if (!str_lcmp(source, "hex:", 4)) {
-			// Example: hex:04000000
-			return blob_from_hex(out, source + 4);
-		} else {
-			return EINVAL;
-		}
-	}
-	return bithenge_new_file_blob(out, source);
-}
-
-/** @}
- */
Index: pace/lib/bithenge/src/transform.c
===================================================================
--- uspace/lib/bithenge/src/transform.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1107 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Transforms.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <bithenge/blob.h>
-#include <bithenge/print.h>
-#include <bithenge/transform.h>
-#include "common.h"
-
-/*
- * transform
- */
-
-/** Initialize a new transform.
- * @param[out] self Transform to initialize.
- * @param[in] ops Operations provided by the transform.
- * @param num_params The number of parameters required. If this is nonzero, the
- * transform will get its own context with parameters, probably provided by a
- * param_wrapper. If this is zero, the existing outer context will be used with
- * whatever parameters it has, so they can be passed to any param_wrappers
- * within.
- * @return EOK or an error code from errno.h.
- */
-errno_t bithenge_init_transform(bithenge_transform_t *self,
-    const bithenge_transform_ops_t *ops, int num_params)
-{
-	assert(ops);
-	assert(ops->apply || ops->prefix_apply);
-	assert(ops->destroy);
-	if (bithenge_should_fail())
-		return ENOMEM;
-	self->ops = ops;
-	self->refs = 1;
-	self->num_params = num_params;
-	return EOK;
-}
-
-static void transform_indestructible(bithenge_transform_t *self)
-{
-	assert(false);
-}
-
-/** Apply a transform. Takes ownership of nothing.
- * @memberof bithenge_transform_t
- * @param self The transform.
- * @param scope The scope.
- * @param in The input tree.
- * @param[out] out Where the output tree will be stored.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_transform_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	assert(self);
-	assert(self->ops);
-	if (self->ops->apply)
-		return self->ops->apply(self, scope, in, out);
-
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	aoff64_t self_size, whole_size;
-	errno_t rc = bithenge_transform_prefix_apply(self, scope,
-	    bithenge_node_as_blob(in), out, &self_size);
-	if (rc != EOK)
-		return rc;
-	rc = bithenge_blob_size(bithenge_node_as_blob(in), &whole_size);
-	if (rc == EOK && whole_size != self_size)
-		rc = EINVAL;
-	if (rc != EOK) {
-		bithenge_node_dec_ref(*out);
-		return rc;
-	}
-	return EOK;
-}
-
-/** Find the length of the prefix of a blob this transform can use as input. In
- * other words, figure out how many bytes this transform will use up.  This
- * method is optional and can return an error, but it must succeed for struct
- * subtransforms. Takes ownership of nothing.
- * @memberof bithenge_transform_t
- * @param self The transform.
- * @param scope The scope.
- * @param blob The blob.
- * @param[out] out Where the prefix length will be stored.
- * @return EOK on success, ENOTSUP if not supported, or another error code from
- * errno.h.
- */
-errno_t bithenge_transform_prefix_length(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
-{
-	assert(self);
-	assert(self->ops);
-	if (self->ops->prefix_length)
-		return self->ops->prefix_length(self, scope, blob, out);
-	if (!self->ops->prefix_apply)
-		return ENOTSUP;
-
-	bithenge_node_t *node;
-	errno_t rc = bithenge_transform_prefix_apply(self, scope, blob, &node,
-	    out);
-	if (rc != EOK)
-		return rc;
-	bithenge_node_dec_ref(node);
-	return EOK;
-}
-
-/** Apply this transform to a prefix of a blob. In other words, feed as much of
- * the blob into this transform as possible. Takes ownership of nothing.
- * @memberof bithenge_transform_t
- * @param self The transform.
- * @param scope The scope.
- * @param blob The blob.
- * @param[out] out_node Holds the result of applying this transform to the
- * prefix.
- * @param[out] out_size Holds the size of the prefix. Can be null, in which
- * case the size is not determined.
- * @return EOK on success, ENOTSUP if not supported, or another error code from
- * errno.h.
- */
-errno_t bithenge_transform_prefix_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	assert(self);
-	assert(self->ops);
-	if (self->ops->prefix_apply)
-		return self->ops->prefix_apply(self, scope, blob, out_node,
-		    out_size);
-	if (!self->ops->prefix_length)
-		return ENOTSUP;
-
-	aoff64_t size;
-	errno_t rc = bithenge_transform_prefix_length(self, scope, blob, &size);
-	if (rc != EOK)
-		return rc;
-	bithenge_node_t *prefix_blob;
-	bithenge_blob_inc_ref(blob);
-	rc = bithenge_new_subblob(&prefix_blob, blob, 0, size);
-	if (rc != EOK)
-		return rc;
-	rc = bithenge_transform_apply(self, scope, prefix_blob, out_node);
-	bithenge_node_dec_ref(prefix_blob);
-	if (out_size)
-		*out_size = size;
-	return rc;
-}
-
-/*
- * scope
- */
-
-/** Create a transform scope. It must be dereferenced with @a
- * bithenge_scope_dec_ref after it is used. Takes ownership of nothing.
- * @memberof bithenge_scope_t
- * @param[out] out Holds the new scope.
- * @param outer The outer scope, or NULL.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_scope_new(bithenge_scope_t **out, bithenge_scope_t *outer)
-{
-	bithenge_scope_t *self = malloc(sizeof(*self));
-	if (!self)
-		return ENOMEM;
-	self->refs = 1;
-	if (outer)
-		bithenge_scope_inc_ref(outer);
-	self->outer = outer;
-	self->error = NULL;
-	self->barrier = false;
-	self->num_params = 0;
-	self->params = NULL;
-	self->current_node = NULL;
-	self->in_node = NULL;
-	*out = self;
-	return EOK;
-}
-
-/** Dereference a transform scope.
- * @memberof bithenge_scope_t
- * @param self The scope to dereference, or NULL.
- */
-void bithenge_scope_dec_ref(bithenge_scope_t *self)
-{
-	if (!self)
-		return;
-	if (--self->refs)
-		return;
-	bithenge_node_dec_ref(self->current_node);
-	for (int i = 0; i < self->num_params; i++)
-		bithenge_node_dec_ref(self->params[i]);
-	bithenge_scope_dec_ref(self->outer);
-	free(self->params);
-	free(self->error);
-	free(self);
-}
-
-/** Get the outer scope of a scope, which may be NULL.
- * @memberof bithenge_scope_t
- * @param self The scope to examine.
- * @return The outer scope, which may be NULL.
- */
-bithenge_scope_t *bithenge_scope_outer(bithenge_scope_t *self)
-{
-	return self->outer;
-}
-
-/** Get the error message stored in the scope, which may be NULL. The error
- * message only exists as long as the scope does.
- * @memberof bithenge_scope_t
- * @param scope The scope to get the error message from.
- * @return The error message, or NULL.
- */
-const char *bithenge_scope_get_error(bithenge_scope_t *scope)
-{
-	return scope->error;
-}
-
-/** Set the error message for the scope. The error message is stored in the
- * outermost scope, but if any scope already has an error message this error
- * message is ignored.
- * @memberof bithenge_scope_t
- * @param scope The scope.
- * @param format The format string.
- * @return EINVAL normally, or another error code from errno.h.
- */
-errno_t bithenge_scope_error(bithenge_scope_t *scope, const char *format, ...)
-{
-	if (scope->error)
-		return EINVAL;
-	while (scope->outer) {
-		scope = scope->outer;
-		if (scope->error)
-			return EINVAL;
-	}
-	size_t space_left = 256;
-	scope->error = malloc(space_left);
-	if (!scope->error)
-		return ENOMEM;
-	char *out = scope->error;
-	va_list ap;
-	va_start(ap, format);
-
-	while (*format) {
-		if (format[0] == '%' && format[1] == 't') {
-			format += 2;
-			errno_t rc = bithenge_print_node_to_string(&out,
-			    &space_left, BITHENGE_PRINT_PYTHON,
-			    va_arg(ap, bithenge_node_t *));
-			if (rc != EOK) {
-				va_end(ap);
-				return rc;
-			}
-		} else {
-			const char *end = str_chr(format, '%');
-			if (!end)
-				end = format + str_length(format);
-			size_t size = min((size_t)(end - format),
-			    space_left - 1);
-			memcpy(out, format, size);
-			format = end;
-			out += size;
-			space_left -= size;
-		}
-	}
-	*out = '\0';
-
-	va_end(ap);
-	return EINVAL;
-}
-
-/** Get the current node being created, which may be NULL.
- * @memberof bithenge_scope_t
- * @param scope The scope to get the current node from.
- * @return The node being created, or NULL.
- */
-bithenge_node_t *bithenge_scope_get_current_node(bithenge_scope_t *scope)
-{
-	if (scope->current_node)
-		bithenge_node_inc_ref(scope->current_node);
-	return scope->current_node;
-}
-
-/** Set the current node being created. Takes a reference to @a node.
- * @memberof bithenge_scope_t
- * @param scope The scope to set the current node in.
- * @param node The current node being created, or NULL.
- */
-void bithenge_scope_set_current_node(bithenge_scope_t *scope,
-    bithenge_node_t *node)
-{
-	bithenge_node_dec_ref(scope->current_node);
-	scope->current_node = node;
-}
-
-/** Get the current input node, which may be NULL.
- * @memberof bithenge_scope_t
- * @param scope The scope to get the current input node from.
- * @return The input node, or NULL.
- */
-bithenge_node_t *bithenge_scope_in_node(bithenge_scope_t *scope)
-{
-	if (scope->in_node)
-		bithenge_node_inc_ref(scope->in_node);
-	return scope->in_node;
-}
-
-/** Set the current input node. Takes a reference to @a node.
- * @memberof bithenge_scope_t
- * @param scope The scope to set the input node in.
- * @param node The input node, or NULL.
- */
-void bithenge_scope_set_in_node(bithenge_scope_t *scope, bithenge_node_t *node)
-{
-	bithenge_node_dec_ref(scope->in_node);
-	scope->in_node = node;
-}
-
-/** Set a scope as a barrier.
- * @memberof bithenge_scope_t
- * @param self The scope to change.
- */
-void bithenge_scope_set_barrier(bithenge_scope_t *self)
-{
-	self->barrier = true;
-}
-
-/** Check whether a scope is a barrier, meaning that variable lookup stops at
- * it.
- * @memberof bithenge_scope_t
- * @param self The scope to check.
- * @return Whether the scope is a barrier.
- */
-bool bithenge_scope_is_barrier(bithenge_scope_t *self)
-{
-	return self->barrier;
-}
-
-/** Allocate parameters. The parameters must then be set with @a
- * bithenge_scope_set_param. This must not be called on a scope that already
- * has parameters.
- * @memberof bithenge_scope_t
- * @param scope The scope in which to allocate parameters.
- * @param num_params The number of parameters to allocate.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_scope_alloc_params(bithenge_scope_t *scope, int num_params)
-{
-	scope->params = malloc(sizeof(*scope->params) * num_params);
-	if (!scope->params)
-		return ENOMEM;
-	scope->num_params = num_params;
-	for (int i = 0; i < num_params; i++)
-		scope->params[i] = NULL;
-	return EOK;
-}
-
-/** Set a parameter. Takes a reference to @a node. Note that range checking is
- * not done in release builds.
- * @memberof bithenge_scope_t
- * @param scope The scope in which to allocate parameters.
- * @param i The index of the parameter to set.
- * @param node The value to store in the parameter.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_scope_set_param(bithenge_scope_t *scope, int i,
-    bithenge_node_t *node)
-{
-	assert(scope);
-	assert(i >= 0 && i < scope->num_params);
-	if (bithenge_should_fail()) {
-		bithenge_node_dec_ref(node);
-		return ENOMEM;
-	}
-	scope->params[i] = node;
-	return EOK;
-}
-
-/** Get a parameter. Note that range checking is not done in release builds.
- * @memberof bithenge_scope_t
- * @param scope The scope to get the parameter from.
- * @param i The index of the parameter to set.
- * @param[out] out Stores a new reference to the parameter.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_scope_get_param(bithenge_scope_t *scope, int i,
-    bithenge_node_t **out)
-{
-	assert(scope);
-	if (scope->num_params) {
-		assert(i >= 0 && i < scope->num_params);
-		*out = scope->params[i];
-		bithenge_node_inc_ref(*out);
-		return EOK;
-	} else {
-		return bithenge_scope_get_param(scope->outer, i, out);
-	}
-}
-
-/*
- * barrier_transform
- */
-
-typedef struct {
-	bithenge_transform_t base;
-	bithenge_transform_t *transform;
-} barrier_transform_t;
-
-static inline barrier_transform_t *transform_as_barrier(
-    bithenge_transform_t *base)
-{
-	return (barrier_transform_t *)base;
-}
-
-static inline bithenge_transform_t *barrier_as_transform(
-    barrier_transform_t *self)
-{
-	return &self->base;
-}
-
-static errno_t barrier_transform_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	barrier_transform_t *self = transform_as_barrier(base);
-	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
-	if (rc != EOK)
-		return rc;
-	bithenge_scope_set_barrier(inner_scope);
-	bithenge_scope_set_in_node(inner_scope, in);
-	rc = bithenge_transform_apply(self->transform, inner_scope, in, out);
-	bithenge_scope_dec_ref(inner_scope);
-	return rc;
-}
-
-static errno_t barrier_transform_prefix_length(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
-{
-	barrier_transform_t *self = transform_as_barrier(base);
-	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
-	if (rc != EOK)
-		return rc;
-	bithenge_scope_set_barrier(inner_scope);
-	bithenge_scope_set_in_node(inner_scope, bithenge_blob_as_node(in));
-	rc = bithenge_transform_prefix_length(self->transform, inner_scope, in,
-	    out);
-	bithenge_scope_dec_ref(inner_scope);
-	return rc;
-}
-
-static errno_t barrier_transform_prefix_apply(bithenge_transform_t *base,
-    bithenge_scope_t *scope, bithenge_blob_t *in, bithenge_node_t **out_node,
-    aoff64_t *out_length)
-{
-	barrier_transform_t *self = transform_as_barrier(base);
-	bithenge_scope_t *inner_scope;
-	errno_t rc = bithenge_scope_new(&inner_scope, scope);
-	if (rc != EOK)
-		return rc;
-	bithenge_scope_set_barrier(inner_scope);
-	bithenge_scope_set_in_node(inner_scope, bithenge_blob_as_node(in));
-	rc = bithenge_transform_prefix_apply(self->transform, inner_scope, in,
-	    out_node, out_length);
-	bithenge_scope_dec_ref(inner_scope);
-	return rc;
-}
-
-static void barrier_transform_destroy(bithenge_transform_t *base)
-{
-	barrier_transform_t *self = transform_as_barrier(base);
-	bithenge_transform_dec_ref(self->transform);
-	free(self);
-}
-
-static const bithenge_transform_ops_t barrier_transform_ops = {
-	.apply = barrier_transform_apply,
-	.prefix_length = barrier_transform_prefix_length,
-	.prefix_apply = barrier_transform_prefix_apply,
-	.destroy = barrier_transform_destroy,
-};
-
-/** Set the subtransform of a barrier transform. This must be done before the
- * barrier transform is used. Takes a reference to @a transform.
- * @param base The barrier transform.
- * @param transform The subtransform to use for all operations.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_barrier_transform_set_subtransform(bithenge_transform_t *base,
-    bithenge_transform_t *transform)
-{
-	assert(transform);
-	assert(bithenge_transform_num_params(transform) == 0);
-
-	if (bithenge_should_fail()) {
-		bithenge_transform_dec_ref(transform);
-		return ENOMEM;
-	}
-
-	barrier_transform_t *self = transform_as_barrier(base);
-	assert(!self->transform);
-	self->transform = transform;
-	return EOK;
-}
-
-/** Create a wrapper transform that creates a new scope. This ensures nothing
- * from the outer scope is passed in, other than parameters. The wrapper may
- * have a different value for num_params. The subtransform must be set with @a
- * bithenge_barrier_transform_set_subtransform before the result is used.
- * @param[out] out Holds the created transform.
- * @param num_params The number of parameters to require, which may be 0.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_barrier_transform(bithenge_transform_t **out, int num_params)
-{
-	errno_t rc;
-	barrier_transform_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_transform(barrier_as_transform(self),
-	    &barrier_transform_ops, num_params);
-	if (rc != EOK)
-		goto error;
-	self->transform = NULL;
-	*out = barrier_as_transform(self);
-	return EOK;
-error:
-	free(self);
-	return rc;
-}
-
-/*
- * ascii
- */
-
-static errno_t ascii_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_node_t *in, bithenge_node_t **out)
-{
-	errno_t rc;
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	bithenge_blob_t *blob = bithenge_node_as_blob(in);
-	aoff64_t size;
-	rc = bithenge_blob_size(blob, &size);
-	if (rc != EOK)
-		return rc;
-
-	char *buffer = malloc(size + 1);
-	if (!buffer)
-		return ENOMEM;
-	aoff64_t size_read = size;
-	rc = bithenge_blob_read(blob, 0, buffer, &size_read);
-	if (rc != EOK) {
-		free(buffer);
-		return rc;
-	}
-	if (size_read != size) {
-		free(buffer);
-		return EINVAL;
-	}
-	buffer[size] = '\0';
-
-	/* TODO: what if the OS encoding is incompatible with ASCII? */
-	return bithenge_new_string_node(out, buffer, true);
-}
-
-static const bithenge_transform_ops_t ascii_ops = {
-	.apply = ascii_apply,
-	.destroy = transform_indestructible,
-};
-
-/** The ASCII text transform. */
-bithenge_transform_t bithenge_ascii_transform = {
-	&ascii_ops, 1, 0
-};
-
-/*
- * bit
- */
-
-static errno_t bit_prefix_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	char buffer;
-	aoff64_t size = 1;
-	errno_t rc = bithenge_blob_read_bits(blob, 0, &buffer, &size, true);
-	if (rc != EOK)
-		return rc;
-	if (size != 1)
-		return EINVAL;
-	if (out_size)
-		*out_size = size;
-	return bithenge_new_boolean_node(out_node, (buffer & 1) != 0);
-}
-
-static const bithenge_transform_ops_t bit_ops = {
-	.prefix_apply = bit_prefix_apply,
-	.destroy = transform_indestructible,
-};
-
-/** A transform that decodes a bit as a boolean. */
-bithenge_transform_t bithenge_bit_transform = {
-	&bit_ops, 1, 0
-};
-
-/*
- * bits_be, bits_le
- */
-
-typedef struct {
-	bithenge_blob_t base;
-	bithenge_blob_t *bytes;
-	bool little_endian;
-} bits_xe_blob_t;
-
-static bits_xe_blob_t *blob_as_bits_xe(bithenge_blob_t *base)
-{
-	return (bits_xe_blob_t *)base;
-}
-
-static bithenge_blob_t *bits_xe_as_blob(bits_xe_blob_t *self)
-{
-	return &self->base;
-}
-
-static errno_t bits_xe_size(bithenge_blob_t *base, aoff64_t *out)
-{
-	bits_xe_blob_t *self = blob_as_bits_xe(base);
-	errno_t rc = bithenge_blob_size(self->bytes, out);
-	*out *= 8;
-	return rc;
-}
-
-static uint8_t reverse_byte(uint8_t val)
-{
-	val = ((val & 0x0f) << 4) ^ ((val & 0xf0) >> 4);
-	val = ((val & 0x33) << 2) ^ ((val & 0xcc) >> 2);
-	val = ((val & 0x55) << 1) ^ ((val & 0xaa) >> 1);
-	return val;
-}
-
-static errno_t bits_xe_read_bits(bithenge_blob_t *base, aoff64_t offset,
-    char *buffer, aoff64_t *size, bool little_endian)
-{
-	bits_xe_blob_t *self = blob_as_bits_xe(base);
-	aoff64_t bytes_offset = offset / 8;
-	aoff64_t bit_offset = offset % 8;
-	aoff64_t output_num_bytes = (*size + 7) / 8;
-	aoff64_t bytes_size = (*size + bit_offset + 7) / 8;
-	bool separate_buffer = bit_offset != 0;
-	uint8_t *bytes_buffer;
-	if (separate_buffer) {
-		/* Allocate an extra byte, to make sure byte1 can be read. */
-		bytes_buffer = malloc(bytes_size + 1);
-		if (!bytes_buffer)
-			return ENOMEM;
-	} else
-		bytes_buffer = (uint8_t *)buffer;
-
-	errno_t rc = bithenge_blob_read(self->bytes, bytes_offset,
-	    (char *)bytes_buffer, &bytes_size);
-	if (rc != EOK)
-		goto end;
-	*size = min(*size, bytes_size * 8 - bit_offset);
-
-	if (little_endian != self->little_endian)
-		for (aoff64_t i = 0; i < bytes_size; i++)
-			bytes_buffer[i] = reverse_byte(bytes_buffer[i]);
-
-	if (bit_offset || separate_buffer) {
-		for (aoff64_t i = 0; i < output_num_bytes; i++) {
-			uint8_t byte0 = bytes_buffer[i];
-			uint8_t	byte1 = bytes_buffer[i + 1];
-			buffer[i] = little_endian ?
-			    (byte0 >> bit_offset) ^ (byte1 << (8 - bit_offset)) :
-			    (byte0 << bit_offset) ^ (byte1 >> (8 - bit_offset));
-		}
-	}
-
-end:
-	if (separate_buffer)
-		free(bytes_buffer);
-	return rc;
-}
-
-static void bits_xe_destroy(bithenge_blob_t *base)
-{
-	bits_xe_blob_t *self = blob_as_bits_xe(base);
-	bithenge_blob_dec_ref(self->bytes);
-	free(self);
-}
-
-static const bithenge_random_access_blob_ops_t bits_xe_blob_ops = {
-	.size = bits_xe_size,
-	.read_bits = bits_xe_read_bits,
-	.destroy = bits_xe_destroy,
-};
-
-static errno_t bits_xe_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_node_t *in, bithenge_node_t **out)
-{
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	bits_xe_blob_t *blob = malloc(sizeof(*blob));
-	if (!blob)
-		return ENOMEM;
-	errno_t rc = bithenge_init_random_access_blob(bits_xe_as_blob(blob),
-	    &bits_xe_blob_ops);
-	if (rc != EOK) {
-		free(blob);
-		return rc;
-	}
-	bithenge_node_inc_ref(in);
-	blob->bytes = bithenge_node_as_blob(in);
-	blob->little_endian = (self == &bithenge_bits_le_transform);
-	*out = bithenge_blob_as_node(bits_xe_as_blob(blob));
-	return EOK;
-}
-
-static const bithenge_transform_ops_t bits_xe_ops = {
-	.apply = bits_xe_apply,
-	.destroy = transform_indestructible,
-};
-
-/** A transform that converts a byte blob to a bit blob, most-significant bit
- * first.
- */
-bithenge_transform_t bithenge_bits_be_transform = {
-	&bits_xe_ops, 1, 0
-};
-
-/** A transform that converts a byte blob to a bit blob, least-significant bit
- * first.
- */
-bithenge_transform_t bithenge_bits_le_transform = {
-	&bits_xe_ops, 1, 0
-};
-
-/*
- * invalid
- */
-
-static errno_t invalid_apply(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_node_t *in, bithenge_node_t **out)
-{
-	return EINVAL;
-}
-
-static const bithenge_transform_ops_t invalid_ops = {
-	.apply = invalid_apply,
-	.destroy = transform_indestructible,
-};
-
-/** A transform that always raises an error. */
-bithenge_transform_t bithenge_invalid_transform = {
-	&invalid_ops, 1, 0
-};
-
-/*
- * known_length
- */
-
-static errno_t known_length_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	bithenge_node_t *length_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &length_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(length_node) != BITHENGE_NODE_INTEGER) {
-		bithenge_node_dec_ref(length_node);
-		return EINVAL;
-	}
-	bithenge_int_t length = bithenge_integer_node_value(length_node);
-	bithenge_node_dec_ref(length_node);
-
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	aoff64_t size;
-	rc = bithenge_blob_size(bithenge_node_as_blob(in), &size);
-	if (rc != EOK)
-		return rc;
-	if (length != (bithenge_int_t)size)
-		return EINVAL;
-
-	bithenge_node_inc_ref(in);
-	*out = in;
-	return EOK;
-}
-
-static errno_t known_length_prefix_length(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *in, aoff64_t *out)
-{
-	bithenge_node_t *length_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &length_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(length_node) != BITHENGE_NODE_INTEGER) {
-		bithenge_node_dec_ref(length_node);
-		return EINVAL;
-	}
-	bithenge_int_t length = bithenge_integer_node_value(length_node);
-	bithenge_node_dec_ref(length_node);
-
-	*out = (aoff64_t)length;
-	return EOK;
-}
-
-static const bithenge_transform_ops_t known_length_ops = {
-	.apply = known_length_apply,
-	.prefix_length = known_length_prefix_length,
-	.destroy = transform_indestructible,
-};
-
-/** Pass through a blob, but require its length to equal the first argument. */
-bithenge_transform_t bithenge_known_length_transform = {
-	&known_length_ops, 1, 1
-};
-
-static errno_t nonzero_boolean_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	if (bithenge_node_type(in) != BITHENGE_NODE_INTEGER)
-		return EINVAL;
-	bool value = bithenge_integer_node_value(in) != 0;
-	return bithenge_new_boolean_node(out, value);
-}
-
-static const bithenge_transform_ops_t nonzero_boolean_ops = {
-	.apply = nonzero_boolean_apply,
-	.destroy = transform_indestructible,
-};
-
-/** A transform that converts integers to booleans, true if nonzero. */
-bithenge_transform_t bithenge_nonzero_boolean_transform = {
-	&nonzero_boolean_ops, 1, 0
-};
-
-static errno_t prefix_length_1(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_blob_t *blob, aoff64_t *out)
-{
-	*out = 1;
-	return EOK;
-}
-
-static errno_t prefix_length_2(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_blob_t *blob, aoff64_t *out)
-{
-	*out = 2;
-	return EOK;
-}
-
-static errno_t prefix_length_4(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_blob_t *blob, aoff64_t *out)
-{
-	*out = 4;
-	return EOK;
-}
-
-static errno_t prefix_length_8(bithenge_transform_t *self, bithenge_scope_t *scope,
-    bithenge_blob_t *blob, aoff64_t *out)
-{
-	*out = 8;
-	return EOK;
-}
-
-static uint8_t uint8_t_identity(uint8_t arg)
-{
-	return arg;
-}
-
-/** @cond internal */
-#define MAKE_UINT_TRANSFORM(NAME, TYPE, ENDIAN, PREFIX_LENGTH_FUNC)            \
-	static errno_t NAME##_apply(bithenge_transform_t *self,                    \
-	    bithenge_scope_t *scope, bithenge_node_t *in,                      \
-	    bithenge_node_t **out)                                             \
-	{                                                                      \
-		errno_t rc;                                                        \
-		if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)              \
-			return EINVAL;                                         \
-		bithenge_blob_t *blob = bithenge_node_as_blob(in);             \
-		                                                               \
-		/* Read too many bytes; success means the blob is too long. */ \
-		TYPE val[2];                                                   \
-		aoff64_t size = sizeof(val[0]) + 1;                            \
-		rc = bithenge_blob_read(blob, 0, (char *)val, &size);          \
-		if (rc != EOK)                                                 \
-			return rc;                                             \
-		if (size != sizeof(val[0]))                                    \
-			return EINVAL;                                         \
-		                                                               \
-		return bithenge_new_integer_node(out, ENDIAN(val[0]));         \
-	}                                                                      \
-	                                                                       \
-	static const bithenge_transform_ops_t NAME##_ops = {                   \
-		.apply = NAME##_apply,                                         \
-		.prefix_length = PREFIX_LENGTH_FUNC,                           \
-		.destroy = transform_indestructible,                           \
-	};                                                                     \
-	                                                                       \
-	bithenge_transform_t bithenge_##NAME##_transform = {                   \
-		&NAME##_ops, 1, 0                                              \
-	}
-
-MAKE_UINT_TRANSFORM(uint8,    uint8_t,  uint8_t_identity, prefix_length_1);
-MAKE_UINT_TRANSFORM(uint16le, uint16_t, uint16_t_le2host, prefix_length_2);
-MAKE_UINT_TRANSFORM(uint16be, uint16_t, uint16_t_be2host, prefix_length_2);
-MAKE_UINT_TRANSFORM(uint32le, uint32_t, uint32_t_le2host, prefix_length_4);
-MAKE_UINT_TRANSFORM(uint32be, uint32_t, uint32_t_be2host, prefix_length_4);
-MAKE_UINT_TRANSFORM(uint64le, uint64_t, uint64_t_le2host, prefix_length_8);
-MAKE_UINT_TRANSFORM(uint64be, uint64_t, uint64_t_be2host, prefix_length_8);
-/** @endcond */
-
-/*
- * uint_be, uint_le
- */
-
-static errno_t uint_xe_prefix_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, bithenge_node_t **out_node,
-    aoff64_t *out_size)
-{
-	bool little_endian = (self == &bithenge_uint_le_transform);
-	bithenge_node_t *num_bits_node;
-	errno_t rc = bithenge_scope_get_param(scope, 0, &num_bits_node);
-	if (rc != EOK)
-		return rc;
-	if (bithenge_node_type(num_bits_node) != BITHENGE_NODE_INTEGER) {
-		bithenge_node_dec_ref(num_bits_node);
-		return EINVAL;
-	}
-	bithenge_int_t num_bits = bithenge_integer_node_value(num_bits_node);
-	bithenge_node_dec_ref(num_bits_node);
-	if (num_bits < 0)
-		return EINVAL;
-	if ((size_t)num_bits > sizeof(bithenge_int_t) * 8 - 1)
-		return EINVAL;
-
-	aoff64_t size = num_bits;
-	uint8_t buffer[sizeof(bithenge_int_t)];
-	rc = bithenge_blob_read_bits(blob, 0, (char *)buffer, &size,
-	    little_endian);
-	if (rc != EOK)
-		return rc;
-	if (size != (aoff64_t)num_bits)
-		return EINVAL;
-	if (out_size)
-		*out_size = size;
-
-	bithenge_int_t result = 0;
-	bithenge_int_t num_easy_bytes = num_bits / 8;
-	if (little_endian) {
-		for (bithenge_int_t i = 0; i < num_easy_bytes; i++)
-			result += buffer[i] << 8 * i;
-		if (num_bits % 8)
-			result += (buffer[num_easy_bytes] &
-			    ((1 << num_bits % 8) - 1)) << 8 * num_easy_bytes;
-	} else {
-		for (bithenge_int_t i = 0; i < num_easy_bytes; i++)
-			result += buffer[i] << (num_bits - 8 * (i + 1));
-		if (num_bits % 8)
-			result += buffer[num_easy_bytes] >> (8 - num_bits % 8);
-	}
-
-	return bithenge_new_integer_node(out_node, result);
-}
-
-static const bithenge_transform_ops_t uint_xe_ops = {
-	.prefix_apply = uint_xe_prefix_apply,
-	.destroy = transform_indestructible,
-};
-
-/** A transform that reads an unsigned integer from an arbitrary number of
- * bits, most-significant bit first.
- */
-bithenge_transform_t bithenge_uint_be_transform = {
-	&uint_xe_ops, 1, 1
-};
-
-/** A transform that reads an unsigned integer from an arbitrary number of
- * bits, least-significant bit first.
- */
-bithenge_transform_t bithenge_uint_le_transform = {
-	&uint_xe_ops, 1, 1
-};
-
-/*
- * zero_terminated
- */
-
-static errno_t zero_terminated_apply(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_node_t *in, bithenge_node_t **out)
-{
-	errno_t rc;
-	if (bithenge_node_type(in) != BITHENGE_NODE_BLOB)
-		return EINVAL;
-	bithenge_blob_t *blob = bithenge_node_as_blob(in);
-	aoff64_t size;
-	rc = bithenge_blob_size(blob, &size);
-	if (rc != EOK)
-		return rc;
-	if (size < 1)
-		return EINVAL;
-	char ch;
-	aoff64_t size_read = 1;
-	rc = bithenge_blob_read(blob, size - 1, &ch, &size_read);
-	if (rc != EOK)
-		return rc;
-	if (size_read != 1 || ch != '\0')
-		return EINVAL;
-	bithenge_blob_inc_ref(blob);
-	return bithenge_new_subblob(out, blob, 0, size - 1);
-}
-
-static errno_t zero_terminated_prefix_length(bithenge_transform_t *self,
-    bithenge_scope_t *scope, bithenge_blob_t *blob, aoff64_t *out)
-{
-	errno_t rc;
-	char buffer[4096];
-	aoff64_t offset = 0, size_read = sizeof(buffer);
-	do {
-		rc = bithenge_blob_read(blob, offset, buffer, &size_read);
-		if (rc != EOK)
-			return rc;
-		char *found = memchr(buffer, '\0', size_read);
-		if (found) {
-			*out = found - buffer + offset + 1;
-			return EOK;
-		}
-		offset += size_read;
-	} while (size_read == sizeof(buffer));
-	return EINVAL;
-}
-
-static const bithenge_transform_ops_t zero_terminated_ops = {
-	.apply = zero_terminated_apply,
-	.prefix_length = zero_terminated_prefix_length,
-	.destroy = transform_indestructible,
-};
-
-/** The zero-terminated data transform. */
-bithenge_transform_t bithenge_zero_terminated_transform = {
-	&zero_terminated_ops, 1, 0
-};
-
-static bithenge_named_transform_t primitive_transforms[] = {
-	{ "ascii", &bithenge_ascii_transform },
-	{ "bit", &bithenge_bit_transform },
-	{ "bits_be", &bithenge_bits_be_transform },
-	{ "bits_le", &bithenge_bits_le_transform },
-	{ "known_length", &bithenge_known_length_transform },
-	{ "nonzero_boolean", &bithenge_nonzero_boolean_transform },
-	{ "uint8", &bithenge_uint8_transform },
-	{ "uint16be", &bithenge_uint16be_transform },
-	{ "uint16le", &bithenge_uint16le_transform },
-	{ "uint32be", &bithenge_uint32be_transform },
-	{ "uint32le", &bithenge_uint32le_transform },
-	{ "uint64be", &bithenge_uint64be_transform },
-	{ "uint64le", &bithenge_uint64le_transform },
-	{ "uint_be", &bithenge_uint_be_transform },
-	{ "uint_le", &bithenge_uint_le_transform },
-	{ "zero_terminated", &bithenge_zero_terminated_transform },
-	{ NULL, NULL }
-};
-
-/** An array of named built-in transforms. */
-bithenge_named_transform_t *bithenge_primitive_transforms = primitive_transforms;
-
-/** @}
- */
Index: pace/lib/bithenge/src/tree.c
===================================================================
--- uspace/lib/bithenge/src/tree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,396 +1,0 @@
-/*
- * Copyright (c) 2012 Sean Bartell
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup bithenge
- * @{
- */
-/**
- * @file
- * Trees and nodes.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <bithenge/blob.h>
-#include <bithenge/tree.h>
-#include "common.h"
-
-static void blob_destroy(bithenge_node_t *base)
-{
-	bithenge_blob_t *self = bithenge_node_as_blob(base);
-	assert(self->base.blob_ops);
-	self->base.blob_ops->destroy(self);
-}
-
-static void node_destroy(bithenge_node_t *self)
-{
-	switch (bithenge_node_type(self)) {
-	case BITHENGE_NODE_BLOB:
-		blob_destroy(self);
-		return;
-	case BITHENGE_NODE_STRING:
-		if (self->string_value.needs_free)
-			free((void *)self->string_value.ptr);
-		break;
-	case BITHENGE_NODE_INTERNAL:
-		self->internal_ops->destroy(self);
-		return;
-	case BITHENGE_NODE_BOOLEAN:
-		return; /* The boolean nodes are allocated statically below. */
-	case BITHENGE_NODE_INTEGER: /* pass-through */
-		break;
-	}
-	free(self);
-}
-
-/** Decrement a node's reference count and free it if appropriate.
- * @memberof bithenge_node_t
- * @param node The node to dereference, or NULL.
- */
-void bithenge_node_dec_ref(bithenge_node_t *node)
-{
-	if (!node)
-		return;
-	assert (node->refs > 0);
-	if (--node->refs == 0)
-		node_destroy(node);
-}
-
-typedef struct {
-	bithenge_node_t *key;
-	bithenge_node_t **out;
-} get_for_each_data_t;
-
-static errno_t get_for_each_func(bithenge_node_t *key, bithenge_node_t *value,
-    void *raw_data)
-{
-	get_for_each_data_t *data = (get_for_each_data_t *)raw_data;
-	bool equal;
-	errno_t rc = bithenge_node_equal(&equal, key, data->key);
-	bithenge_node_dec_ref(key);
-	if (rc != EOK)
-		return rc;
-	if (equal) {
-		*data->out = value;
-		return EEXIST;
-	}
-	bithenge_node_dec_ref(value);
-	return EOK;
-}
-
-/** Get a child of a node. Takes ownership of the key. If the node does not
- * provide this function, for_each will be used as an alternative, which may be
- * very slow. Also works for blob nodes to find the byte value at a given
- * index.
- * @memberof bithenge_node_t
- * @param self The internal/blob node to find a child of.
- * @param key The key to search for.
- * @param[out] out Holds the found node.
- * @return EOK on success, ENOENT if not found, or another error code from
- * errno.h.
- */
-errno_t bithenge_node_get(bithenge_node_t *self, bithenge_node_t *key,
-    bithenge_node_t **out)
-{
-	if (self->type == BITHENGE_NODE_BLOB) {
-		if (bithenge_node_type(key) != BITHENGE_NODE_INTEGER) {
-			bithenge_node_dec_ref(key);
-			return ENOENT;
-		}
-		bithenge_int_t offset = bithenge_integer_node_value(key);
-		bithenge_node_dec_ref(key);
-		uint8_t byte;
-		aoff64_t size = 1;
-		errno_t rc = bithenge_blob_read(bithenge_node_as_blob(self),
-		    offset, (char *)&byte, &size);
-		if (rc != EOK)
-			return rc;
-		if (size != 1)
-			return ENOENT;
-
-		return bithenge_new_integer_node(out, byte);
-	}
-
-	assert(self->type == BITHENGE_NODE_INTERNAL);
-	if (self->internal_ops->get)
-		return self->internal_ops->get(self, key, out);
-	*out = NULL;
-	get_for_each_data_t data = { key, out };
-	errno_t rc = bithenge_node_for_each(self, get_for_each_func, &data);
-	bithenge_node_dec_ref(key);
-	if (rc == EEXIST && *out)
-		return EOK;
-	if (rc == EOK)
-		rc = ENOENT;
-	bithenge_node_dec_ref(*out);
-	return rc;
-}
-
-/** Initialize an internal node.
- * @memberof bithenge_node_t
- * @param[out] self The node.
- * @param[in] ops The operations provided.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_init_internal_node(bithenge_node_t *self,
-    const bithenge_internal_node_ops_t *ops)
-{
-	self->type = BITHENGE_NODE_INTERNAL;
-	self->refs = 1;
-	self->internal_ops = ops;
-	return EOK;
-}
-
-static void internal_node_indestructible(bithenge_node_t *self)
-{
-	assert(false);
-}
-
-static errno_t empty_internal_node_for_each(bithenge_node_t *base,
-    bithenge_for_each_func_t func, void *data)
-{
-	return EOK;
-}
-
-static errno_t empty_internal_node_get(bithenge_node_t *self, bithenge_node_t *key,
-    bithenge_node_t **out)
-{
-	return ENOENT;
-}
-
-static const bithenge_internal_node_ops_t empty_internal_node_ops = {
-	.for_each = empty_internal_node_for_each,
-	.get = empty_internal_node_get,
-	.destroy = internal_node_indestructible,
-};
-
-static bithenge_node_t empty_internal_node = {
-	BITHENGE_NODE_INTERNAL,
-	1,
-	{ .internal_ops = &empty_internal_node_ops },
-};
-
-/** Create an empty internal node.
- * @param[out] out Holds the created node.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_empty_internal_node(bithenge_node_t **out)
-{
-	if (bithenge_should_fail())
-		return ENOMEM;
-	bithenge_node_inc_ref(&empty_internal_node);
-	*out = &empty_internal_node;
-	return EOK;
-}
-
-typedef struct {
-	bithenge_node_t base;
-	bithenge_node_t **nodes;
-	bithenge_int_t len;
-	bool needs_free;
-} simple_internal_node_t;
-
-static simple_internal_node_t *node_as_simple(bithenge_node_t *node)
-{
-	return (simple_internal_node_t *)node;
-}
-
-static bithenge_node_t *simple_as_node(simple_internal_node_t *node)
-{
-	return &node->base;
-}
-
-static errno_t simple_internal_node_for_each(bithenge_node_t *base,
-    bithenge_for_each_func_t func, void *data)
-{
-	errno_t rc;
-	simple_internal_node_t *self = node_as_simple(base);
-	for (bithenge_int_t i = 0; i < self->len; i++) {
-		bithenge_node_inc_ref(self->nodes[2 * i + 0]);
-		bithenge_node_inc_ref(self->nodes[2 * i + 1]);
-		rc = func(self->nodes[2 * i + 0], self->nodes[2 * i + 1], data);
-		if (rc != EOK)
-			return rc;
-	}
-	return EOK;
-}
-
-static void simple_internal_node_destroy(bithenge_node_t *base)
-{
-	simple_internal_node_t *self = node_as_simple(base);
-	for (bithenge_int_t i = 0; i < 2 * self->len; i++)
-		bithenge_node_dec_ref(self->nodes[i]);
-	if (self->needs_free)
-		free(self->nodes);
-	free(self);
-}
-
-static bithenge_internal_node_ops_t simple_internal_node_ops = {
-	.for_each = simple_internal_node_for_each,
-	.destroy = simple_internal_node_destroy,
-};
-
-/** Create an internal node from a set of keys and values. This function takes
- * ownership of a reference to the key and value nodes, and optionally the
- * array @a nodes.
- * @memberof bithenge_node_t
- * @param[out] out Stores the created internal node.
- * @param nodes The array of key-value pairs. Keys are stored at even indices
- * and values are stored at odd indices.
- * @param len The number of key-value pairs in the node array.
- * @param needs_free If true, when the internal node is destroyed it will free
- * the nodes array rather than just dereferencing each node inside it.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_simple_internal_node(bithenge_node_t **out,
-    bithenge_node_t **nodes, bithenge_int_t len, bool needs_free)
-{
-	errno_t rc;
-	assert(out);
-	simple_internal_node_t *self = malloc(sizeof(*self));
-	if (!self) {
-		rc = ENOMEM;
-		goto error;
-	}
-	rc = bithenge_init_internal_node(simple_as_node(self),
-	    &simple_internal_node_ops);
-	if (rc != EOK)
-		goto error;
-	self->nodes = nodes;
-	self->len = len;
-	self->needs_free = needs_free;
-	*out = simple_as_node(self);
-	return EOK;
-error:
-	for (bithenge_int_t i = 0; i < 2 * len; i++)
-		bithenge_node_dec_ref(nodes[i]);
-	if (needs_free)
-		free(nodes);
-	free(self);
-	return rc;
-}
-
-static bithenge_node_t false_node = { BITHENGE_NODE_BOOLEAN, 1, .boolean_value = false };
-static bithenge_node_t true_node = { BITHENGE_NODE_BOOLEAN, 1, .boolean_value = true };
-
-/** Create a boolean node.
- * @memberof bithenge_node_t
- * @param[out] out Stores the created boolean node.
- * @param value The value for the node to hold.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_boolean_node(bithenge_node_t **out, bool value)
-{
-	assert(out);
-	if (bithenge_should_fail())
-		return ENOMEM;
-	*out = value ? &true_node : &false_node;
-	(*out)->refs++;
-	return EOK;
-}
-
-/** Create an integer node.
- * @memberof bithenge_node_t
- * @param[out] out Stores the created integer node.
- * @param value The value for the node to hold.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_integer_node(bithenge_node_t **out, bithenge_int_t value)
-{
-	assert(out);
-	bithenge_node_t *self = malloc(sizeof(*self));
-	if (!self)
-		return ENOMEM;
-	self->type = BITHENGE_NODE_INTEGER;
-	self->refs = 1;
-	self->integer_value = value;
-	*out = self;
-	return EOK;
-}
-
-/** Create a string node.
- * @memberof bithenge_node_t
- * @param[out] out Stores the created string node. On error, this is unchanged.
- * @param value The value for the node to hold.
- * @param needs_free Whether the string should be freed when the node is
- * destroyed.
- * @return EOK on success or an error code from errno.h.
- */
-errno_t bithenge_new_string_node(bithenge_node_t **out, const char *value, bool needs_free)
-{
-	assert(out);
-	bithenge_node_t *self = malloc(sizeof(*self));
-	if (!self) {
-		if (needs_free)
-			free((void *)value);
-		return ENOMEM;
-	}
-	self->type = BITHENGE_NODE_STRING;
-	self->refs = 1;
-	self->string_value.ptr = value;
-	self->string_value.needs_free = needs_free;
-	*out = self;
-	return EOK;
-}
-
-/** Check whether the contents of two nodes are equal. Does not yet work for
- * internal nodes. Takes ownership of nothing.
- * @memberof bithenge_node_t
- * @param[out] out Holds whether the nodes are equal.
- * @param a, b Nodes to compare.
- * @return EOK on success or an error code from errno.h.
- * @todo Add support for internal nodes.
- */
-errno_t bithenge_node_equal(bool *out, bithenge_node_t *a, bithenge_node_t *b)
-{
-	if (a->type != b->type) {
-		*out = false;
-		return EOK;
-	}
-	switch (a->type) {
-	case BITHENGE_NODE_INTERNAL:
-		*out = false;
-		return EOK;
-	case BITHENGE_NODE_BOOLEAN:
-		*out = a->boolean_value == b->boolean_value;
-		return EOK;
-	case BITHENGE_NODE_INTEGER:
-		*out = a->integer_value == b->integer_value;
-		return EOK;
-	case BITHENGE_NODE_STRING:
-		*out = !str_cmp(a->string_value.ptr, b->string_value.ptr);
-		return EOK;
-	case BITHENGE_NODE_BLOB:
-		return bithenge_blob_equal(out, bithenge_node_as_blob(a),
-		    bithenge_node_as_blob(b));
-	}
-	return EINVAL;
-}
-
-/** @}
- */
Index: pace/lib/block/block.c
===================================================================
--- uspace/lib/block/block.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,972 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libblock
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <ipc/loc.h>
-#include <ipc/services.h>
-#include <errno.h>
-#include <async.h>
-#include <as.h>
-#include <assert.h>
-#include <bd.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stacktrace.h>
-#include <str_error.h>
-#include <offset.h>
-#include <inttypes.h>
-#include "block.h"
-
-#define MAX_WRITE_RETRIES 10
-
-/** Lock protecting the device connection list */
-static FIBRIL_MUTEX_INITIALIZE(dcl_lock);
-/** Device connection list head. */
-static LIST_INITIALIZE(dcl);
-
-typedef struct {
-	fibril_mutex_t lock;
-	size_t lblock_size;       /**< Logical block size. */
-	unsigned blocks_cluster;  /**< Physical blocks per block_t */
-	unsigned block_count;     /**< Total number of blocks. */
-	unsigned blocks_cached;   /**< Number of cached blocks. */
-	hash_table_t block_hash;
-	list_t free_list;
-	enum cache_mode mode;
-} cache_t;
-
-typedef struct {
-	link_t link;
-	service_id_t service_id;
-	async_sess_t *sess;
-	bd_t *bd;
-	void *bb_buf;
-	aoff64_t bb_addr;
-	aoff64_t pblocks;    /**< Number of physical blocks */
-	size_t pblock_size;  /**< Physical block size. */
-	cache_t *cache;
-} devcon_t;
-
-static errno_t read_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
-static errno_t write_blocks(devcon_t *, aoff64_t, size_t, void *, size_t);
-static aoff64_t ba_ltop(devcon_t *, aoff64_t);
-
-static devcon_t *devcon_search(service_id_t service_id)
-{
-	fibril_mutex_lock(&dcl_lock);
-
-	list_foreach(dcl, link, devcon_t, devcon) {
-		if (devcon->service_id == service_id) {
-			fibril_mutex_unlock(&dcl_lock);
-			return devcon;
-		}
-	}
-
-	fibril_mutex_unlock(&dcl_lock);
-	return NULL;
-}
-
-static errno_t devcon_add(service_id_t service_id, async_sess_t *sess,
-    size_t bsize, aoff64_t dev_size, bd_t *bd)
-{
-	devcon_t *devcon;
-
-	devcon = malloc(sizeof(devcon_t));
-	if (!devcon)
-		return ENOMEM;
-
-	link_initialize(&devcon->link);
-	devcon->service_id = service_id;
-	devcon->sess = sess;
-	devcon->bd = bd;
-	devcon->bb_buf = NULL;
-	devcon->bb_addr = 0;
-	devcon->pblock_size = bsize;
-	devcon->pblocks = dev_size;
-	devcon->cache = NULL;
-
-	fibril_mutex_lock(&dcl_lock);
-	list_foreach(dcl, link, devcon_t, d) {
-		if (d->service_id == service_id) {
-			fibril_mutex_unlock(&dcl_lock);
-			free(devcon);
-			return EEXIST;
-		}
-	}
-	list_append(&devcon->link, &dcl);
-	fibril_mutex_unlock(&dcl_lock);
-	return EOK;
-}
-
-static void devcon_remove(devcon_t *devcon)
-{
-	fibril_mutex_lock(&dcl_lock);
-	list_remove(&devcon->link);
-	fibril_mutex_unlock(&dcl_lock);
-}
-
-errno_t block_init(service_id_t service_id)
-{
-	bd_t *bd;
-
-	async_sess_t *sess = loc_service_connect(service_id, INTERFACE_BLOCK,
-	    IPC_FLAG_BLOCKING);
-	if (!sess) {
-		return ENOENT;
-	}
-
-	errno_t rc = bd_open(sess, &bd);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return rc;
-	}
-
-	size_t bsize;
-	rc = bd_get_block_size(bd, &bsize);
-	if (rc != EOK) {
-		bd_close(bd);
-		async_hangup(sess);
-		return rc;
-	}
-
-	aoff64_t dev_size;
-	rc = bd_get_num_blocks(bd, &dev_size);
-	if (rc != EOK) {
-		bd_close(bd);
-		async_hangup(sess);
-		return rc;
-	}
-
-	rc = devcon_add(service_id, sess, bsize, dev_size, bd);
-	if (rc != EOK) {
-		bd_close(bd);
-		async_hangup(sess);
-		return rc;
-	}
-
-	return EOK;
-}
-
-void block_fini(service_id_t service_id)
-{
-	devcon_t *devcon = devcon_search(service_id);
-	assert(devcon);
-
-	if (devcon->cache)
-		(void) block_cache_fini(service_id);
-
-	(void)bd_sync_cache(devcon->bd, 0, 0);
-
-	devcon_remove(devcon);
-
-	if (devcon->bb_buf)
-		free(devcon->bb_buf);
-
-	bd_close(devcon->bd);
-	async_hangup(devcon->sess);
-
-	free(devcon);
-}
-
-errno_t block_bb_read(service_id_t service_id, aoff64_t ba)
-{
-	void *bb_buf;
-	errno_t rc;
-
-	devcon_t *devcon = devcon_search(service_id);
-	if (!devcon)
-		return ENOENT;
-	if (devcon->bb_buf)
-		return EEXIST;
-	bb_buf = malloc(devcon->pblock_size);
-	if (!bb_buf)
-		return ENOMEM;
-
-	rc = read_blocks(devcon, 0, 1, bb_buf, devcon->pblock_size);
-	if (rc != EOK) {
-		free(bb_buf);
-		return rc;
-	}
-
-	devcon->bb_buf = bb_buf;
-	devcon->bb_addr = ba;
-
-	return EOK;
-}
-
-void *block_bb_get(service_id_t service_id)
-{
-	devcon_t *devcon = devcon_search(service_id);
-	assert(devcon);
-	return devcon->bb_buf;
-}
-
-static size_t cache_key_hash(const void *key)
-{
-	const aoff64_t *lba = key;
-	return *lba;
-}
-
-static size_t cache_hash(const ht_link_t *item)
-{
-	block_t *b = hash_table_get_inst(item, block_t, hash_link);
-	return b->lba;
-}
-
-static bool cache_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const aoff64_t *lba = key;
-	block_t *b = hash_table_get_inst(item, block_t, hash_link);
-	return b->lba == *lba;
-}
-
-static const hash_table_ops_t cache_ops = {
-	.hash = cache_hash,
-	.key_hash = cache_key_hash,
-	.key_equal = cache_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-errno_t block_cache_init(service_id_t service_id, size_t size, unsigned blocks,
-    enum cache_mode mode)
-{
-	devcon_t *devcon = devcon_search(service_id);
-	cache_t *cache;
-	if (!devcon)
-		return ENOENT;
-	if (devcon->cache)
-		return EEXIST;
-	cache = malloc(sizeof(cache_t));
-	if (!cache)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&cache->lock);
-	list_initialize(&cache->free_list);
-	cache->lblock_size = size;
-	cache->block_count = blocks;
-	cache->blocks_cached = 0;
-	cache->mode = mode;
-
-	/* Allow 1:1 or small-to-large block size translation */
-	if (cache->lblock_size % devcon->pblock_size != 0) {
-		free(cache);
-		return ENOTSUP;
-	}
-
-	cache->blocks_cluster = cache->lblock_size / devcon->pblock_size;
-
-	if (!hash_table_create(&cache->block_hash, 0, 0, &cache_ops)) {
-		free(cache);
-		return ENOMEM;
-	}
-
-	devcon->cache = cache;
-	return EOK;
-}
-
-errno_t block_cache_fini(service_id_t service_id)
-{
-	devcon_t *devcon = devcon_search(service_id);
-	cache_t *cache;
-	errno_t rc;
-
-	if (!devcon)
-		return ENOENT;
-	if (!devcon->cache)
-		return EOK;
-	cache = devcon->cache;
-
-	/*
-	 * We are expecting to find all blocks for this device handle on the
-	 * free list, i.e. the block reference count should be zero. Do not
-	 * bother with the cache and block locks because we are single-threaded.
-	 */
-	while (!list_empty(&cache->free_list)) {
-		block_t *b = list_get_instance(list_first(&cache->free_list),
-		    block_t, free_link);
-
-		list_remove(&b->free_link);
-		if (b->dirty) {
-			rc = write_blocks(devcon, b->pba, cache->blocks_cluster,
-			    b->data, b->size);
-			if (rc != EOK)
-				return rc;
-		}
-
-		hash_table_remove_item(&cache->block_hash, &b->hash_link);
-
-		free(b->data);
-		free(b);
-	}
-
-	hash_table_destroy(&cache->block_hash);
-	devcon->cache = NULL;
-	free(cache);
-
-	return EOK;
-}
-
-#define CACHE_LO_WATERMARK	10
-#define CACHE_HI_WATERMARK	20
-static bool cache_can_grow(cache_t *cache)
-{
-	if (cache->blocks_cached < CACHE_LO_WATERMARK)
-		return true;
-	if (!list_empty(&cache->free_list))
-		return false;
-	return true;
-}
-
-static void block_initialize(block_t *b)
-{
-	fibril_mutex_initialize(&b->lock);
-	b->refcnt = 1;
-	b->write_failures = 0;
-	b->dirty = false;
-	b->toxic = false;
-	fibril_rwlock_initialize(&b->contents_lock);
-	link_initialize(&b->free_link);
-}
-
-/** Instantiate a block in memory and get a reference to it.
- *
- * @param block			Pointer to where the function will store the
- * 				block pointer on success.
- * @param service_id		Service ID of the block device.
- * @param ba			Block address (logical).
- * @param flags			If BLOCK_FLAGS_NOREAD is specified, block_get()
- * 				will not read the contents of the block from the
- *				device.
- *
- * @return			EOK on success or an error code.
- */
-errno_t block_get(block_t **block, service_id_t service_id, aoff64_t ba, int flags)
-{
-	devcon_t *devcon;
-	cache_t *cache;
-	block_t *b;
-	link_t *link;
-	aoff64_t p_ba;
-	errno_t rc;
-
-	devcon = devcon_search(service_id);
-
-	assert(devcon);
-	assert(devcon->cache);
-
-	cache = devcon->cache;
-
-	/*
-	 * Check whether the logical block (or part of it) is beyond
-	 * the end of the device or not.
-	 */
-	p_ba = ba_ltop(devcon, ba);
-	p_ba += cache->blocks_cluster;
-	if (p_ba >= devcon->pblocks) {
-		/* This request cannot be satisfied */
-		return EIO;
-	}
-
-retry:
-	rc = EOK;
-	b = NULL;
-
-	fibril_mutex_lock(&cache->lock);
-	ht_link_t *hlink = hash_table_find(&cache->block_hash, &ba);
-	if (hlink) {
-	found:
-		/*
-		 * We found the block in the cache.
-		 */
-		b = hash_table_get_inst(hlink, block_t, hash_link);
-		fibril_mutex_lock(&b->lock);
-		if (b->refcnt++ == 0)
-			list_remove(&b->free_link);
-		if (b->toxic)
-			rc = EIO;
-		fibril_mutex_unlock(&b->lock);
-		fibril_mutex_unlock(&cache->lock);
-	} else {
-		/*
-		 * The block was not found in the cache.
-		 */
-		if (cache_can_grow(cache)) {
-			/*
-			 * We can grow the cache by allocating new blocks.
-			 * Should the allocation fail, we fail over and try to
-			 * recycle a block from the cache.
-			 */
-			b = malloc(sizeof(block_t));
-			if (!b)
-				goto recycle;
-			b->data = malloc(cache->lblock_size);
-			if (!b->data) {
-				free(b);
-				b = NULL;
-				goto recycle;
-			}
-			cache->blocks_cached++;
-		} else {
-			/*
-			 * Try to recycle a block from the free list.
-			 */
-		recycle:
-			if (list_empty(&cache->free_list)) {
-				fibril_mutex_unlock(&cache->lock);
-				rc = ENOMEM;
-				goto out;
-			}
-			link = list_first(&cache->free_list);
-			b = list_get_instance(link, block_t, free_link);
-
-			fibril_mutex_lock(&b->lock);
-			if (b->dirty) {
-				/*
-				 * The block needs to be written back to the
-				 * device before it changes identity. Do this
-				 * while not holding the cache lock so that
-				 * concurrency is not impeded. Also move the
-				 * block to the end of the free list so that we
-				 * do not slow down other instances of
-				 * block_get() draining the free list.
-				 */
-				list_remove(&b->free_link);
-				list_append(&b->free_link, &cache->free_list);
-				fibril_mutex_unlock(&cache->lock);
-				rc = write_blocks(devcon, b->pba,
-				    cache->blocks_cluster, b->data, b->size);
-				if (rc != EOK) {
-					/*
-					 * We did not manage to write the block
-					 * to the device. Keep it around for
-					 * another try. Hopefully, we will grab
-					 * another block next time.
-					 */
-					if (b->write_failures < MAX_WRITE_RETRIES) {
-						b->write_failures++;
-						fibril_mutex_unlock(&b->lock);
-						goto retry;
-					} else {
-						printf("Too many errors writing block %"
-						    PRIuOFF64 "from device handle %" PRIun "\n"
-						    "SEVERE DATA LOSS POSSIBLE\n",
-						    b->lba, devcon->service_id);
-					}
-				} else
-					b->write_failures = 0;
-
-				b->dirty = false;
-				if (!fibril_mutex_trylock(&cache->lock)) {
-					/*
-					 * Somebody is probably racing with us.
-					 * Unlock the block and retry.
-					 */
-					fibril_mutex_unlock(&b->lock);
-					goto retry;
-				}
-				hlink = hash_table_find(&cache->block_hash, &ba);
-				if (hlink) {
-					/*
-					 * Someone else must have already
-					 * instantiated the block while we were
-					 * not holding the cache lock.
-					 * Leave the recycled block on the
-					 * freelist and continue as if we
-					 * found the block of interest during
-					 * the first try.
-					 */
-					fibril_mutex_unlock(&b->lock);
-					goto found;
-				}
-
-			}
-			fibril_mutex_unlock(&b->lock);
-
-			/*
-			 * Unlink the block from the free list and the hash
-			 * table.
-			 */
-			list_remove(&b->free_link);
-			hash_table_remove_item(&cache->block_hash, &b->hash_link);
-		}
-
-		block_initialize(b);
-		b->service_id = service_id;
-		b->size = cache->lblock_size;
-		b->lba = ba;
-		b->pba = ba_ltop(devcon, b->lba);
-		hash_table_insert(&cache->block_hash, &b->hash_link);
-
-		/*
-		 * Lock the block before releasing the cache lock. Thus we don't
-		 * kill concurrent operations on the cache while doing I/O on
-		 * the block.
-		 */
-		fibril_mutex_lock(&b->lock);
-		fibril_mutex_unlock(&cache->lock);
-
-		if (!(flags & BLOCK_FLAGS_NOREAD)) {
-			/*
-			 * The block contains old or no data. We need to read
-			 * the new contents from the device.
-			 */
-			rc = read_blocks(devcon, b->pba, cache->blocks_cluster,
-			    b->data, cache->lblock_size);
-			if (rc != EOK)
-				b->toxic = true;
-		} else
-			rc = EOK;
-
-		fibril_mutex_unlock(&b->lock);
-	}
-out:
-	if ((rc != EOK) && b) {
-		assert(b->toxic);
-		(void) block_put(b);
-		b = NULL;
-	}
-	*block = b;
-	return rc;
-}
-
-/** Release a reference to a block.
- *
- * If the last reference is dropped, the block is put on the free list.
- *
- * @param block		Block of which a reference is to be released.
- *
- * @return		EOK on success or an error code.
- */
-errno_t block_put(block_t *block)
-{
-	devcon_t *devcon = devcon_search(block->service_id);
-	cache_t *cache;
-	unsigned blocks_cached;
-	enum cache_mode mode;
-	errno_t rc = EOK;
-
-	assert(devcon);
-	assert(devcon->cache);
-	assert(block->refcnt >= 1);
-
-	cache = devcon->cache;
-
-retry:
-	fibril_mutex_lock(&cache->lock);
-	blocks_cached = cache->blocks_cached;
-	mode = cache->mode;
-	fibril_mutex_unlock(&cache->lock);
-
-	/*
-	 * Determine whether to sync the block. Syncing the block is best done
-	 * when not holding the cache lock as it does not impede concurrency.
-	 * Since the situation may have changed when we unlocked the cache, the
-	 * blocks_cached and mode variables are mere hints. We will recheck the
-	 * conditions later when the cache lock is held again.
-	 */
-	fibril_mutex_lock(&block->lock);
-	if (block->toxic)
-		block->dirty = false;	/* will not write back toxic block */
-	if (block->dirty && (block->refcnt == 1) &&
-	    (blocks_cached > CACHE_HI_WATERMARK || mode != CACHE_MODE_WB)) {
-		rc = write_blocks(devcon, block->pba, cache->blocks_cluster,
-		    block->data, block->size);
-		if (rc == EOK)
-			block->write_failures = 0;
-		block->dirty = false;
-	}
-	fibril_mutex_unlock(&block->lock);
-
-	fibril_mutex_lock(&cache->lock);
-	fibril_mutex_lock(&block->lock);
-	if (!--block->refcnt) {
-		/*
-		 * Last reference to the block was dropped. Either free the
-		 * block or put it on the free list. In case of an I/O error,
-		 * free the block.
-		 */
-		if ((cache->blocks_cached > CACHE_HI_WATERMARK) ||
-		    (rc != EOK)) {
-			/*
-			 * Currently there are too many cached blocks or there
-			 * was an I/O error when writing the block back to the
-			 * device.
-			 */
-			if (block->dirty) {
-				/*
-				 * We cannot sync the block while holding the
-				 * cache lock. Release everything and retry.
-				 */
-				block->refcnt++;
-
-				if (block->write_failures < MAX_WRITE_RETRIES) {
-					block->write_failures++;
-					fibril_mutex_unlock(&block->lock);
-					fibril_mutex_unlock(&cache->lock);
-					goto retry;
-				} else {
-					printf("Too many errors writing block %"
-					    PRIuOFF64 "from device handle %" PRIun "\n"
-					    "SEVERE DATA LOSS POSSIBLE\n",
-					    block->lba, devcon->service_id);
-				}
-			}
-			/*
-			 * Take the block out of the cache and free it.
-			 */
-			hash_table_remove_item(&cache->block_hash, &block->hash_link);
-			fibril_mutex_unlock(&block->lock);
-			free(block->data);
-			free(block);
-			cache->blocks_cached--;
-			fibril_mutex_unlock(&cache->lock);
-			return rc;
-		}
-		/*
-		 * Put the block on the free list.
-		 */
-		if (cache->mode != CACHE_MODE_WB && block->dirty) {
-			/*
-			 * We cannot sync the block while holding the cache
-			 * lock. Release everything and retry.
-			 */
-			block->refcnt++;
-			fibril_mutex_unlock(&block->lock);
-			fibril_mutex_unlock(&cache->lock);
-			goto retry;
-		}
-		list_append(&block->free_link, &cache->free_list);
-	}
-	fibril_mutex_unlock(&block->lock);
-	fibril_mutex_unlock(&cache->lock);
-
-	return rc;
-}
-
-/** Read sequential data from a block device.
- *
- * @param service_id	Service ID of the block device.
- * @param buf		Buffer for holding one block
- * @param bufpos	Pointer to the first unread valid offset within the
- * 			communication buffer.
- * @param buflen	Pointer to the number of unread bytes that are ready in
- * 			the communication buffer.
- * @param pos		Device position to be read.
- * @param dst		Destination buffer.
- * @param size		Size of the destination buffer.
- * @param block_size	Block size to be used for the transfer.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_seqread(service_id_t service_id, void *buf, size_t *bufpos,
-    size_t *buflen, aoff64_t *pos, void *dst, size_t size)
-{
-	size_t offset = 0;
-	size_t left = size;
-	size_t block_size;
-	devcon_t *devcon;
-
-	devcon = devcon_search(service_id);
-	assert(devcon);
-	block_size = devcon->pblock_size;
-
-	while (left > 0) {
-		size_t rd;
-
-		if (*bufpos + left < *buflen)
-			rd = left;
-		else
-			rd = *buflen - *bufpos;
-
-		if (rd > 0) {
-			/*
-			 * Copy the contents of the communication buffer to the
-			 * destination buffer.
-			 */
-			memcpy(dst + offset, buf + *bufpos, rd);
-			offset += rd;
-			*bufpos += rd;
-			*pos += rd;
-			left -= rd;
-		}
-
-		if (*bufpos == *buflen) {
-			/* Refill the communication buffer with a new block. */
-			errno_t rc;
-
-			rc = read_blocks(devcon, *pos / block_size, 1, buf,
-			    devcon->pblock_size);
-			if (rc != EOK) {
-				return rc;
-			}
-
-			*bufpos = 0;
-			*buflen = block_size;
-		}
-	}
-
-	return EOK;
-}
-
-/** Read blocks directly from device (bypass cache).
- *
- * @param service_id	Service ID of the block device.
- * @param ba		Address of first block (physical).
- * @param cnt		Number of blocks.
- * @param src		Buffer for storing the data.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_read_direct(service_id_t service_id, aoff64_t ba, size_t cnt, void *buf)
-{
-	devcon_t *devcon;
-
-	devcon = devcon_search(service_id);
-	assert(devcon);
-
-	return read_blocks(devcon, ba, cnt, buf, devcon->pblock_size * cnt);
-}
-
-/** Write blocks directly to device (bypass cache).
- *
- * @param service_id	Service ID of the block device.
- * @param ba		Address of first block (physical).
- * @param cnt		Number of blocks.
- * @param src		The data to be written.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_write_direct(service_id_t service_id, aoff64_t ba, size_t cnt,
-    const void *data)
-{
-	devcon_t *devcon;
-
-	devcon = devcon_search(service_id);
-	assert(devcon);
-
-	return write_blocks(devcon, ba, cnt, (void *)data, devcon->pblock_size * cnt);
-}
-
-/** Synchronize blocks to persistent storage.
- *
- * @param service_id	Service ID of the block device.
- * @param ba		Address of first block (physical).
- * @param cnt		Number of blocks.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_sync_cache(service_id_t service_id, aoff64_t ba, size_t cnt)
-{
-	devcon_t *devcon;
-
-	devcon = devcon_search(service_id);
-	assert(devcon);
-
-	return bd_sync_cache(devcon->bd, ba, cnt);
-}
-
-/** Get device block size.
- *
- * @param service_id	Service ID of the block device.
- * @param bsize		Output block size.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_get_bsize(service_id_t service_id, size_t *bsize)
-{
-	devcon_t *devcon;
-
-	devcon = devcon_search(service_id);
-	assert(devcon);
-
-	return bd_get_block_size(devcon->bd, bsize);
-}
-
-/** Get number of blocks on device.
- *
- * @param service_id	Service ID of the block device.
- * @param nblocks	Output number of blocks.
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_get_nblocks(service_id_t service_id, aoff64_t *nblocks)
-{
-	devcon_t *devcon = devcon_search(service_id);
-	assert(devcon);
-
-	return bd_get_num_blocks(devcon->bd, nblocks);
-}
-
-/** Read bytes directly from the device (bypass cache)
- *
- * @param service_id	Service ID of the block device.
- * @param abs_offset	Absolute offset in bytes where to start reading
- * @param bytes			Number of bytes to read
- * @param data			Buffer that receives the data
- *
- * @return		EOK on success or an error code on failure.
- */
-errno_t block_read_bytes_direct(service_id_t service_id, aoff64_t abs_offset,
-    size_t bytes, void *data)
-{
-	errno_t rc;
-	size_t phys_block_size;
-	size_t buf_size;
-	void *buffer;
-	aoff64_t first_block;
-	aoff64_t last_block;
-	size_t blocks;
-	size_t offset;
-
-	rc = block_get_bsize(service_id, &phys_block_size);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* calculate data position and required space */
-	first_block = abs_offset / phys_block_size;
-	offset = abs_offset % phys_block_size;
-	last_block = (abs_offset + bytes - 1) / phys_block_size;
-	blocks = last_block - first_block + 1;
-	buf_size = blocks * phys_block_size;
-
-	/* read the data into memory */
-	buffer = malloc(buf_size);
-	if (buffer == NULL) {
-		return ENOMEM;
-	}
-
-	rc = block_read_direct(service_id, first_block, blocks, buffer);
-	if (rc != EOK) {
-		free(buffer);
-		return rc;
-	}
-
-	/* copy the data from the buffer */
-	memcpy(data, buffer + offset, bytes);
-	free(buffer);
-
-	return EOK;
-}
-
-/** Get TOC from device.
- *
- * @param service_id Service ID of the block device.
- * @param session    Starting session.
- *
- * @return Allocated TOC structure.
- * @return EOK on success or an error code.
- *
- */
-errno_t block_read_toc(service_id_t service_id, uint8_t session, void *buf,
-    size_t bufsize)
-{
-	devcon_t *devcon = devcon_search(service_id);
-
-	assert(devcon);
-	return bd_read_toc(devcon->bd, session, buf, bufsize);
-}
-
-/** Read blocks from block device.
- *
- * @param devcon	Device connection.
- * @param ba		Address of first block.
- * @param cnt		Number of blocks.
- * @param src		Buffer for storing the data.
- *
- * @return		EOK on success or an error code on failure.
- */
-static errno_t read_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	assert(devcon);
-
-	errno_t rc = bd_read_blocks(devcon->bd, ba, cnt, buf, size);
-	if (rc != EOK) {
-		printf("Error %s reading %zu blocks starting at block %" PRIuOFF64
-		    " from device handle %" PRIun "\n", str_error_name(rc), cnt, ba,
-		    devcon->service_id);
-#ifndef NDEBUG
-		stacktrace_print();
-#endif
-	}
-
-	return rc;
-}
-
-/** Write block to block device.
- *
- * @param devcon	Device connection.
- * @param ba		Address of first block.
- * @param cnt		Number of blocks.
- * @param src		Buffer containing the data to write.
- *
- * @return		EOK on success or an error code on failure.
- */
-static errno_t write_blocks(devcon_t *devcon, aoff64_t ba, size_t cnt, void *data,
-    size_t size)
-{
-	assert(devcon);
-
-	errno_t rc = bd_write_blocks(devcon->bd, ba, cnt, data, size);
-	if (rc != EOK) {
-		printf("Error %s writing %zu blocks starting at block %" PRIuOFF64
-		    " to device handle %" PRIun "\n", str_error_name(rc), cnt, ba, devcon->service_id);
-#ifndef NDEBUG
-		stacktrace_print();
-#endif
-	}
-
-	return rc;
-}
-
-/** Convert logical block address to physical block address. */
-static aoff64_t ba_ltop(devcon_t *devcon, aoff64_t lba)
-{
-	assert(devcon->cache != NULL);
-	return lba * devcon->cache->blocks_cluster;
-}
-
-/** @}
- */
Index: pace/lib/block/block.h
===================================================================
--- uspace/lib/block/block.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libblock
- * @{
- */
-/**
- * @file
- */
-
-#ifndef LIBBLOCK_LIBBLOCK_H_
-#define LIBBLOCK_LIBBLOCK_H_
-
-#include <offset.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <adt/hash_table.h>
-#include <adt/list.h>
-#include <loc.h>
-
-/*
- * Flags that can be used with block_get().
- */
-
-/**
- * This macro is a symbolic value for situations where no special flags are
- * needed.
- */
-#define BLOCK_FLAGS_NONE	0
-
-/**
- * When the client of block_get() intends to overwrite the current contents of
- * the block, this flag is used to avoid the unnecessary read.
- */
-#define BLOCK_FLAGS_NOREAD	1
-
-typedef struct block {
-	/** Mutex protecting the reference count. */
-	fibril_mutex_t lock;
-	/** Number of references to the block_t structure. */
-	unsigned refcnt;
-	/** If true, the block needs to be written back to the block device. */
-	bool dirty;
-	/** If true, the blcok does not contain valid data. */
-	bool toxic;
-	/** Readers / Writer lock protecting the contents of the block. */
-	fibril_rwlock_t contents_lock;
-	/** Service ID of service providing the block device. */
-	service_id_t service_id;
-	/** Logical block address */
-	aoff64_t lba;
-	/** Physical block address */
-	aoff64_t pba;
-	/** Size of the block. */
-	size_t size;
-	/** Number of write failures. */
-	int write_failures;
-	/** Link for placing the block into the free block list. */
-	link_t free_link;
-	/** Link for placing the block into the block hash table. */
-	ht_link_t hash_link;
-	/** Buffer with the block data. */
-	void *data;
-} block_t;
-
-/** Caching mode */
-enum cache_mode {
-	/** Write-Through */
-	CACHE_MODE_WT,
-	/** Write-Back */
-	CACHE_MODE_WB
-};
-
-extern errno_t block_init(service_id_t);
-extern void block_fini(service_id_t);
-
-extern errno_t block_bb_read(service_id_t, aoff64_t);
-extern void *block_bb_get(service_id_t);
-
-extern errno_t block_cache_init(service_id_t, size_t, unsigned, enum cache_mode);
-extern errno_t block_cache_fini(service_id_t);
-
-extern errno_t block_get(block_t **, service_id_t, aoff64_t, int);
-extern errno_t block_put(block_t *);
-
-extern errno_t block_seqread(service_id_t, void *, size_t *, size_t *, aoff64_t *,
-    void *, size_t);
-
-extern errno_t block_get_bsize(service_id_t, size_t *);
-extern errno_t block_get_nblocks(service_id_t, aoff64_t *);
-extern errno_t block_read_toc(service_id_t, uint8_t, void *, size_t);
-extern errno_t block_read_direct(service_id_t, aoff64_t, size_t, void *);
-extern errno_t block_read_bytes_direct(service_id_t, aoff64_t, size_t, void *);
-extern errno_t block_write_direct(service_id_t, aoff64_t, size_t, const void *);
-extern errno_t block_sync_cache(service_id_t, aoff64_t, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/block/doc/doxygroups.h
===================================================================
--- uspace/lib/block/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libblock libblock
- * @ingroup libs
- * @brief Library for working with block devices
- */
Index: pace/lib/block/meson.build
===================================================================
--- uspace/lib/block/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('block.c')
Index: pace/lib/c/arch/abs32le/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_CONFIG_H_
-#define _LIBC_abs32le_CONFIG_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/context_offset.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/context_offset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/abs32le/include/arch/context_offset.h
Index: pace/lib/c/arch/abs32le/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef _LIBC_abs32le_DDI_H_
-#define _LIBC_abs32le_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
Index: pace/lib/c/arch/abs32le/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_ELF_LINUX_H_
-#define _LIBC_abs32le_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-
-typedef struct {
-} elf_regs_t;
-
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	(void) istate;
-	(void) elf_regs;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_FADDR_H_
-#define _LIBC_abs32le_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2010 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_FIBRIL_H_
-#define _LIBC_abs32le_FIBRIL_H_
-
-#include <stdint.h>
-#include <libarch/fibril_context.h>
-
-#define SP_DELTA  0
-
-#define context_set(ctx, _pc, stack, size, ptls) \
-	do { \
-		(ctx)->pc = (uintptr_t) (_pc); \
-		(ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-		(ctx)->fp = 0; \
-		(ctx)->tls = ((uintptr_t) (ptls)) + sizeof(tcb_t); \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	/* On real hardware, this function returns the frame pointer. */
-	return ctx->fp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_abs32le_FIBRIL_CONTEXT_H_
-#define _LIBC_abs32le_FIBRIL_CONTEXT_H_
-
-#include <stdint.h>
-
-/*
- * On real hardware this stores the registers which
- * need to be preserved across function calls.
- */
-typedef struct __context {
-	uintptr_t sp;
-	uintptr_t fp;
-	uintptr_t pc;
-	uintptr_t tls;
-} __context_t;
-
-#endif
Index: pace/lib/c/arch/abs32le/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/abs32le/include/arch/istate.h
Index: pace/lib/c/arch/abs32le/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_abs32le_SYSCALL_H_
-#define _LIBC_abs32le_SYSCALL_H_
-
-#include <abi/syscall.h>
-#include <types/common.h>
-
-#define __syscall0  __syscall
-#define __syscall1  __syscall
-#define __syscall2  __syscall
-#define __syscall3  __syscall
-#define __syscall4  __syscall
-#define __syscall5  __syscall
-#define __syscall6  __syscall
-
-extern sysarg_t __syscall(const sysarg_t, const sysarg_t, const sysarg_t,
-    const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_THREAD_H_
-#define _LIBC_abs32le_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/abs32le/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcabs32le
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_abs32le_TLS_H_
-#define _LIBC_abs32le_TLS_H_
-
-#define CONFIG_TLS_VARIANT_2
-
-#include <libc.h>
-#include <stddef.h>
-
-/* Some architectures store the value with an offset. Some do not. */
-#define ARCH_TP_OFFSET 0
-
-typedef struct {
-	void *self;
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	/* Usually a short assembly assigning to an ABI-defined register. */
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	/* Usually a short assembly reading from an ABI-defined register. */
-	return NULL;
-}
-
-extern uintptr_t __aeabi_read_tp(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/meson.build
===================================================================
--- uspace/lib/c/arch/abs32le/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2010 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/entryjmp.c',
-	'src/thread_entry.c',
-	'src/fibril.c',
-	'src/tls.c',
-	'src/syscall.c',
-	'src/stacktrace.c',
-)
-
-arch_start_src = files('src/crt0.c')
Index: pace/lib/c/arch/abs32le/src/crt0.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/crt0.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stddef.h>
-
-extern void _start(void);
-extern void __c_start(void *);
-
-/* Normally, the entry point is defined in assembly for the architecture. */
-
-void _start(void)
-{
-	__c_start(NULL);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/src/entryjmp.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/entryjmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stdbool.h>
-#include <entry_point.h>
-
-/** Jump to program entry point. */
-void entry_point_jmp(void *entry_point, void *pcb)
-{
-	while (true)
-		;
-}
-
-/**
- * @}
- */
Index: pace/lib/c/arch/abs32le/src/fibril.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/fibril.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <setjmp.h>
-#include <stdbool.h>
-
-int __context_save(__context_t *ctx)
-{
-	return 0;
-}
-
-void __context_restore(__context_t *ctx, int val)
-{
-	while (true)
-		;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stacktrace.h>
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	return true;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return 0;
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return 0;
-}
-
-void stacktrace_prepare(void)
-{
-}
-
-uintptr_t stacktrace_fp_get(void)
-{
-	return (uintptr_t) NULL;
-}
-
-uintptr_t stacktrace_pc_get(void)
-{
-	return (uintptr_t) NULL;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/src/syscall.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <libarch/syscall.h>
-
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
-    const sysarg_t p3, const sysarg_t p4, const sysarg_t p5, const sysarg_t p6,
-    const syscall_t id)
-{
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/src/thread_entry.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/thread_entry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-#include "../../../generic/private/thread.h"
-
-void __thread_entry(void)
-{
-	while (true)
-		;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/abs32le/src/tls.c
===================================================================
--- uspace/lib/c/arch/abs32le/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <tls.h>
-#include <stddef.h>
-#include <stdint.h>
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_2(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_2(tcb, size, align);
-}
-
-uintptr_t __aeabi_read_tp(void)
-{
-	return (uintptr_t) NULL;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_CONFIG_H_
-#define _LIBC_amd64_CONFIG_H_
-
-#define PAGE_WIDTH	12
-#define PAGE_SIZE	(1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../ia32/include/libarch/ddi.h
Index: pace/lib/c/arch/amd64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_amd64_ELF_LINUX_H_
-#define _LIBC_amd64_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint64_t r15;
-	uint64_t r14;
-	uint64_t r13;
-	uint64_t r12;
-	uint64_t rbp;
-	uint64_t rbx;
-	uint64_t r11;
-	uint64_t r10;
-	uint64_t r9;
-	uint64_t r8;
-	uint64_t rax;
-	uint64_t rcx;
-	uint64_t rdx;
-	uint64_t rsi;
-	uint64_t rdi;
-	uint64_t old_rax;
-	uint64_t rip;
-	uint64_t cs;
-	uint64_t rflags;
-	uint64_t rsp;
-	uint64_t ss;
-
-	/*
-	 * The following registers need to be part of elf_regs_t.
-	 * Unfortunately, we don't have any information about them in our
-	 * istate_t.
-	 */
-	uint64_t unused_fs_base;
-	uint64_t unused_gs_base;
-	uint64_t unused_ds;
-	uint64_t unused_es;
-	uint64_t unused_fs;
-	uint64_t unused_gs;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->r15 = istate->r15;
-	elf_regs->r14 = istate->r14;
-	elf_regs->r13 = istate->r13;
-	elf_regs->r12 = istate->r12;
-	elf_regs->rbp = istate->rbp;
-	elf_regs->rbx = istate->rbx;
-	elf_regs->r11 = istate->r11;
-	elf_regs->r10 = istate->r10;
-	elf_regs->r9 = istate->r9;
-	elf_regs->r8 = istate->r8;
-	elf_regs->rax = istate->rax;
-	elf_regs->rcx = istate->rcx;
-	elf_regs->rdx = istate->rdx;
-	elf_regs->rsi = istate->rsi;
-	elf_regs->rdi = istate->rdi;
-	elf_regs->rip = istate->rip;
-	elf_regs->cs = istate->cs;
-	elf_regs->rflags = istate->rflags;
-	elf_regs->rsp = istate->rsp;
-	elf_regs->ss = istate->ss;
-
-	/*
-	 * Reset the registers for which there is not enough info in istate_t.
-	 */
-	elf_regs->unused_fs_base = 0;
-	elf_regs->unused_gs_base = 0;
-	elf_regs->unused_ds = 0;
-	elf_regs->unused_es = 0;
-	elf_regs->unused_fs = 0;
-	elf_regs->unused_gs = 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_FADDR_H_
-#define _LIBC_amd64_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)		((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_FIBRIL_H_
-#define _LIBC_amd64_FIBRIL_H_
-
-#include <libarch/fibril_context.h>
-
-/*
- * According to ABI the stack MUST be aligned on
- * 16-byte boundary. If it is not, the va_arg calling will
- * panic sooner or later
- */
-#define SP_DELTA  16
-
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (sysarg_t) (_pc); \
-		(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = (sysarg_t) (ptls); \
-		(c)->rbp = 0; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->rbp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP   0x00
-#define __CONTEXT_OFFSET_PC   0x08
-#define __CONTEXT_OFFSET_RBX  0x10
-#define __CONTEXT_OFFSET_RBP  0x18
-#define __CONTEXT_OFFSET_R12  0x20
-#define __CONTEXT_OFFSET_R13  0x28
-#define __CONTEXT_OFFSET_R14  0x30
-#define __CONTEXT_OFFSET_R15  0x38
-#define __CONTEXT_OFFSET_TLS  0x40
-#define __CONTEXT_SIZE        0x48
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct __context {
-	/*
-	 * We include only registers that must be preserved
-	 * during function call.
-	 */
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t rbx;
-	uint64_t rbp;
-	uint64_t r12;
-	uint64_t r13;
-	uint64_t r14;
-	uint64_t r15;
-	uint64_t tls;
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/amd64/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/amd64/include/arch/istate.h
Index: pace/lib/c/arch/amd64/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/amd64/include/arch/istate_struct.h
Index: pace/lib/c/arch/amd64/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_RTLD_DYNAMIC_H_
-#define _LIBC_amd64_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file amd64 dynamic relocation types
- */
-
-#ifndef _LIBC_amd64_RTLD_ELF_DYN_H_
-#define _LIBC_amd64_RTLD_ELF_DYN_H_
-
-#define R_X86_64_64		1
-#define R_X86_64_PC32		2
-#define R_X86_64_COPY		5
-#define R_X86_64_GLOB_DAT	6
-#define R_X86_64_JUMP_SLOT	7
-#define R_X86_64_RELATIVE	8
-
-#define R_X86_64_DTPMOD64	16
-#define R_X86_64_DTPOFF64	17
-#define R_X86_64_TPOFF64	18
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_RTLD_MODULE_H_
-#define _LIBC_amd64_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags */
-#define RTLD_MODULE_LDF 0
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_amd64_SYSCALL_H_
-#define _LIBC_amd64_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_THREAD_H_
-#define _LIBC_amd64_THREAD_H_
-
-#include <align.h>
-#include <stddef.h>
-#include <stdint.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	*--sp = (uintptr_t) arg;
-	*--sp = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/amd64/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_amd64_TLS_H_
-#define _LIBC_amd64_TLS_H_
-
-#define CONFIG_TLS_VARIANT_2
-
-#define ARCH_TP_OFFSET 0
-
-#include <libc.h>
-
-typedef struct {
-	void *self;
-	void *fibril_data;
-	void **dtv;
-	void *pad;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	asm volatile ("movq %0, %%fs:0" :: "r" (tls));
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("movq %%fs:0, %0" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/meson.build
===================================================================
--- uspace/lib/c/arch/amd64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/syscall.S',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/amd64/src/crt0.S
===================================================================
--- uspace/lib/c/arch/amd64/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2006 Ondrej Palkovsky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# %rdi contains the PCB pointer
-#
-SYMBOL(_start)
-	#
-	# Create the first stack frame.
-	#
-	pushq $0
-	pushq $0
-	movq %rsp, %rbp
-
-	# %rdi was deliberately chosen as the first argument is also in %rdi
-	# Pass PCB pointer to __c_start (no operation)
-	call FUNCTION_REF(__c_start)
Index: pace/lib/c/arch/amd64/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/amd64/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# %rdi	contains entry_point
-# %rsi	contains pcb
-#
-# Jump to program entry point
-SYMBOL(entry_point_jmp)
-	# use standard amd32 prologue not to confuse anybody
-	push %rbp
-	movq %rsp, %rbp
-
-	# pcb must be passed in %rdi, use %rdx as a scratch register
-	mov %rdi, %rdx
-	mov %rsi, %rdi
-
-	# jump to entry point
-	jmp *%rdx
Index: pace/lib/c/arch/amd64/src/fibril.S
===================================================================
--- uspace/lib/c/arch/amd64/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-.text
-
-## Save current CPU context
-#
-# Save CPU context to context_t variable
-# pointed by the 1st argument. Returns 0 in RAX.
-#
-FUNCTION_BEGIN(__context_save)
-	movq (%rsp), %rdx     # the caller's return %eip
-
-	# in %rdi is passed 1st argument
-	movq %rdx, __CONTEXT_OFFSET_PC(%rdi)
-	movq %rsp, __CONTEXT_OFFSET_SP(%rdi)
-
-	movq %rbx, __CONTEXT_OFFSET_RBX(%rdi)
-	movq %rbp, __CONTEXT_OFFSET_RBP(%rdi)
-	movq %r12, __CONTEXT_OFFSET_R12(%rdi)
-	movq %r13, __CONTEXT_OFFSET_R13(%rdi)
-	movq %r14, __CONTEXT_OFFSET_R14(%rdi)
-	movq %r15, __CONTEXT_OFFSET_R15(%rdi)
-
-	movq %fs:0, %rax
-	movq %rax, __CONTEXT_OFFSET_TLS(%rdi)
-
-	xorq %rax, %rax                      # __context_save returns 0
-	ret
-FUNCTION_END(__context_save)
-
-## Restore current CPU context
-#
-# Restore CPU context from context_t variable
-# pointed by the 1st argument. Returns second argument in RAX.
-#
-FUNCTION_BEGIN(__context_restore)
-	movq __CONTEXT_OFFSET_R15(%rdi), %r15
-	movq __CONTEXT_OFFSET_R14(%rdi), %r14
-	movq __CONTEXT_OFFSET_R13(%rdi), %r13
-	movq __CONTEXT_OFFSET_R12(%rdi), %r12
-	movq __CONTEXT_OFFSET_RBP(%rdi), %rbp
-	movq __CONTEXT_OFFSET_RBX(%rdi), %rbx
-
-	movq __CONTEXT_OFFSET_SP(%rdi), %rsp   # ctx->sp -> %rsp
-
-	movq __CONTEXT_OFFSET_PC(%rdi), %rdx
-
-	movq %rdx,(%rsp)
-
-	movq __CONTEXT_OFFSET_TLS(%rdi), %rdi
-	movq %rdi, %fs:0
-
-	movq %rsi, %rax                      # __context_restore returns second argument
-	ret
-FUNCTION_END(__context_restore)
-
Index: pace/lib/c/arch/amd64/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/amd64/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/amd64/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <mem.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with implicit addends.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-
-	DPRINTF("rel table address: 0x%zx, size: %zd\n", (uintptr_t)rt, rt_size);
-	/* Unused */
-	(void)m;
-	(void)rt;
-	(void)rt_size;
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with explicit addends.
- */
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	size_t r_addend;
-	elf_xword r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uintptr_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uintptr_t *r_ptr;
-	uint32_t *r_ptr32;
-	uintptr_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	rt_entries = rt_size / sizeof(elf_rela_t);
-	str_tab = m->dyn.str_tab;
-
-	DPRINTF("rel table address: 0x%zx, entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-		r_addend = rt[i].r_addend;
-
-		sym_idx = ELF64_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-
-#if 0
-		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
-		    str_tab + sym->st_name,
-		    sym->st_value,
-		    sym->st_size);
-#endif
-		rel_type = ELF64_R_TYPE(r_info);
-		r_ptr = (uintptr_t *)(r_offset + m->bias);
-		r_ptr32 = (uint32_t *)r_ptr;
-
-		if (sym->st_name != 0) {
-			DPRINTF("rel_type: %x, rel_offset: 0x%zx\n", rel_type, r_offset);
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%zx\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-				DPRINTF("symbol definition found, value=0x%zx addr=0x%zx\n", sym_def->st_value, sym_addr);
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-
-			/*
-			 * DTPMOD with null st_name should return the index
-			 * of the current module.
-			 */
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_X86_64_64:
-			DPRINTF("fixup R_X86_64_64 (S+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr + r_addend);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_PC32:
-			DPRINTF("fixup R_X86_64_PC32 (S+A-P)\n");
-			DPRINTF("(32)*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr + r_addend - (uintptr_t) r_ptr);
-			*r_ptr32 = sym_addr + r_addend - (uintptr_t) r_ptr;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_COPY:
-			/*
-			 * Copy symbol data from shared object to specified
-			 * location. Need to find the 'source', i.e. the
-			 * other instance of the object than the one in the
-			 * executable program.
-			 */
-			DPRINTF("fixup R_X86_64_COPY (s)\n");
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-				printf("Warning: Mismatched symbol sizes.\n");
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			memcpy(r_ptr, (const void *)sym_addr, sym_size);
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_GLOB_DAT:
-		case R_X86_64_JUMP_SLOT:
-			DPRINTF("fixup R_X86_64_GLOB_DAT/JUMP_SLOT (S)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr);
-			*r_ptr = sym_addr;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_RELATIVE:
-			DPRINTF("fixup R_X86_64_RELATIVE (B+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, m->bias + r_addend);
-			*r_ptr = m->bias + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_DTPMOD64:
-			DPRINTF("fixup R_X86_64_DTPMOD64\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, (size_t)dest->id);
-			*r_ptr = dest->id;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_DTPOFF64:
-			DPRINTF("fixup R_X86_64_DTPOFF64\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_def->st_value);
-			*r_ptr = sym_def->st_value;
-			DPRINTF("OK\n");
-			break;
-
-		case R_X86_64_TPOFF64:
-			DPRINTF("fixup R_X86_64_TPOFF64\n");
-			*r_ptr = sym_def->st_value + dest->tpoff;
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-
-	}
-}
-
-/** Get the adress of a function.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	return symbol_get_addr(sym, m, __tcb_get());
-}
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/amd64/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64 amd64
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include <stacktrace.h>
-
-#define FRAME_OFFSET_FP_PREV	0
-#define FRAME_OFFSET_RA		8
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	return fp != 0;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/amd64/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/amd64/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	ret
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	movq %rbp, %rax
-	ret
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	movq (%rsp), %rax
-	ret
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/amd64/src/syscall.S
===================================================================
--- uspace/lib/c/arch/amd64/src/syscall.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#
-# Copyright (c) 2006 Ondrej Palkovsky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## Make a system call.
-#
-# @param rdi		First argument.
-# @param rsi		Second argument.
-# @param rdx		Third argument.
-# @param rcx		Fourth argument.
-# @param r8		Fifth argument.
-# @param r9		Sixth argument.
-# @param 8(%rsp)	Syscall number.
-#
-# @return		The return value will be stored in RAX.
-#
-FUNCTION_BEGIN(__syscall)
-	#
-	# Move the syscall number into RAX.
-	movslq 8(%rsp), %rax
-
-	#
-	# Save RCX, the 4th argument, aside because RCX gets rewritten by the
-	# SYSCALL instruction.
-	#
-	movq %rcx, %r10
-	syscall
-	ret
-FUNCTION_END(__syscall)
-
Index: pace/lib/c/arch/amd64/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/amd64/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL_BEGIN(__thread_entry)
-	# Pop libc thread entry function and argument
-	popq %rax
-	popq %rdi
-
-	#
-	# Create the first stack frame.
-	#
-	pushq $0
-	pushq $0
-	movq %rsp, %rbp
-
-	call *%rax
-SYMBOL_END(__thread_entry)
Index: pace/lib/c/arch/amd64/src/tls.c
===================================================================
--- uspace/lib/c/arch/amd64/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64 amd64
- * @ingroup lc
- * @{
- */
-/** @file
- * @ingroup libcia32
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_2(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_2(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-void __attribute__((__regparm__(1)))
-    *__tls_get_addr(tls_index *ti);
-
-void __attribute__((__regparm__(1)))
-    *__tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset);
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Configuration constants.
- */
-
-#ifndef _LIBC_arm32_CONFIG_H_
-#define _LIBC_arm32_CONFIG_H_
-
-#define PAGE_WIDTH	12
-#define PAGE_SIZE	(1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/cp15.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/cp15.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm32/include/arch/cp15.h
Index: pace/lib/c/arch/arm32/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @ingroup libcarm32
- */
-
-#ifndef _LIBC_arm32_DDI_H_
-#define _LIBC_arm32_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
Index: pace/lib/c/arch/arm32/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_arm32_ELF_LINUX_H_
-#define _LIBC_arm32_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint32_t r0;
-	uint32_t r1;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t fp;
-	uint32_t r12;
-	uint32_t sp;
-	uint32_t lr;
-	uint32_t pc;
-	uint32_t cpsr;
-	uint32_t old_r0;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->r0 = istate->r0;
-	elf_regs->r1 = istate->r1;
-	elf_regs->r2 = istate->r2;
-	elf_regs->r3 = istate->r3;
-	elf_regs->r4 = istate->r4;
-	elf_regs->r5 = istate->r5;
-	elf_regs->r6 = istate->r6;
-	elf_regs->r7 = istate->r7;
-	elf_regs->r8 = istate->r8;
-	elf_regs->r9 = istate->r9;
-	elf_regs->r10 = istate->r10;
-
-	elf_regs->fp = istate->fp;
-	elf_regs->r12 = istate->r12;
-	elf_regs->sp = istate->sp;
-	elf_regs->lr = istate->lr;
-	elf_regs->pc = istate->pc;
-	elf_regs->cpsr = istate->spsr;
-	elf_regs->old_r0 = 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Function address conversion.
- */
-
-#ifndef _LIBC_arm32_FADDR_H_
-#define _LIBC_arm32_FADDR_H_
-
-#include <types/common.h>
-
-/** Calculate absolute address of function referenced by fptr pointer.
- *
- * @param f Function pointer.
- */
-#define FADDR(f)	 (f)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Fibrils related declarations.
- */
-
-#ifndef _LIBC_arm32_FIBRIL_H_
-#define _LIBC_arm32_FIBRIL_H_
-
-#include <types/common.h>
-#include <align.h>
-#include <libarch/fibril_context.h>
-
-/** Size of a stack item */
-#define STACK_ITEM_SIZE  4
-
-/** Stack alignment - see <a href="http://www.arm.com/support/faqdev/14269.html">ABI</a> for details */
-#define STACK_ALIGNMENT  8
-
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-/** Sets data to the context.
- *
- *  @param c     Context (#context_t).
- *  @param _pc   Program counter.
- *  @param stack Stack address.
- *  @param size  Stack size.
- *  @param ptls  Pointer to the TCB.
- */
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (sysarg_t) (_pc); \
-		(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = ((sysarg_t)(ptls)) + ARCH_TP_OFFSET; \
-		(c)->fp = 0; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->fp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#include <stdint.h>
-
-/*
- * Only registers preserved across function calls are included. r9 is
- * used to store a TLS address. -ffixed-r9 gcc forces gcc not to use this
- * register. -mtp=soft forces gcc to use #__aeabi_read_tp to obtain
- * TLS address.
- */
-
-// XXX: This struct must match the assembly code in src/fibril.S
-
-typedef struct __context {
-	uintptr_t sp;
-	uintptr_t pc;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	/* r9 */
-	uint32_t tls;
-	uint32_t r10;
-	/* r11 */
-	uint32_t fp;
-} __context_t;
-
-#endif
Index: pace/lib/c/arch/arm32/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm32/include/arch/istate.h
Index: pace/lib/c/arch/arm32/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm32/include/arch/istate_struct.h
Index: pace/lib/c/arch/arm32/include/libarch/regutils.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/regutils.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm32/include/arch/regutils.h
Index: pace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm32_RTLD_DYNAMIC_H_
-#define _LIBC_arm32_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm32_RTLD_ELF_DYN_H_
-#define _LIBC_arm32_RTLD_ELF_DYN_H_
-
-/*
- * arm32 dynamic relocation types
- */
-
-#define R_ARM_ABS32         2
-#define R_ARM_TLS_DTPMOD32 17
-#define R_ARM_TLS_DTPOFF32 18
-#define R_ARM_TLS_TPOFF32  19
-#define R_ARM_COPY         20
-#define R_ARM_GLOB_DAT     21
-#define R_ARM_JUMP_SLOT    22
-#define R_ARM_RELATIVE     23
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm32_RTLD_MODULE_H_
-#define _LIBC_arm32_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags */
-#define RTLD_MODULE_LDF 0
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/stackarg.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/stackarg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Empty.
- */
-
-#ifndef _LIBC_arm32_STACKARG_H_
-#define _LIBC_arm32_STACKARG_H_
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief
- */
-
-#ifndef _LIBC_arm32_SYSCALL_H_
-#define _LIBC_arm32_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm32_THREAD_H_
-#define _LIBC_arm32_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	*--sp = (uintptr_t) main;
-	*--sp = (uintptr_t) arg;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * Copyright (c) 2007 Michal Kebrt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm32_TLS_H_
-#define _LIBC_arm32_TLS_H_
-
-#include <stdint.h>
-
-#define CONFIG_TLS_VARIANT_1
-
-/** Offsets for accessing thread-local variables are shifted 8 bytes higher. */
-#define ARCH_TP_OFFSET  (sizeof(tcb_t) - 8)
-
-/** TCB (Thread Control Block) struct.
- *
- *  TLS starts just after this struct.
- */
-typedef struct {
-	void **dtv;
-	void *pad;
-	/** Fibril data. */
-	void *fibril_data;
-} tcb_t;
-
-static inline void *__tcb_raw_get(void)
-{
-	uint8_t *ret;
-	asm volatile ("mov %0, r9" : "=r" (ret));
-	return ret;
-}
-
-static inline void __tcb_raw_set(void *tls)
-{
-	asm volatile ("mov r9, %0" :: "r" (tls));
-}
-
-/** Returns TLS address stored.
- *
- *  Implemented in assembly.
- *
- *  @return		TLS address stored in r9 register
- */
-extern uintptr_t __aeabi_read_tp(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/meson.build
===================================================================
--- uspace/lib/c/arch/arm32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# Copyright (c) 2007 Pavel Jancik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += files(
-	'src/atomic.c',
-	'src/entryjmp.c',
-	'src/thread_entry.S',
-	'src/syscall.c',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/eabi.S',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/arm32/src/atomic.c
===================================================================
--- uspace/lib/c/arch/arm32/src/atomic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,438 +1,0 @@
-/*
- * Copyright (c) 2007 Michal Kebrt
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Older ARMs don't have atomic instructions, so we need to define a bunch
- * of symbols for GCC to use.
- */
-
-#include <stdbool.h>
-#include "ras_page.h"
-
-volatile unsigned *ras_page;
-
-unsigned long long __atomic_load_8(const volatile void *mem0, int model)
-{
-	const volatile unsigned *mem = mem0;
-
-	(void) model;
-
-	union {
-		unsigned long long a;
-		unsigned b[2];
-	} ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret0], 1b\n"
-	    "	str %[ret0], %[rp0]\n"
-	    "	adr %[ret0], 2f\n"
-	    "	str %[ret0], %[rp1]\n"
-
-	    "	ldr %[ret0], %[addr0]\n"
-	    "   ldr %[ret1], %[addr1]\n"
-	    "2:\n"
-	    : [ret0] "=&r" (ret.b[0]),
-	      [ret1] "=&r" (ret.b[1]),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1])
-	    : [addr0] "m" (mem[0]),
-	      [addr1] "m" (mem[1])
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret.a;
-}
-
-void __atomic_store_8(volatile void *mem0, unsigned long long val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	(void) model;
-
-	union {
-		unsigned long long a;
-		unsigned b[2];
-	} v;
-
-	v.a = val;
-
-	/* scratch register */
-	unsigned tmp;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[tmp], 1b\n"
-	    "	str %[tmp], %[rp0]\n"
-	    "	adr %[tmp], 2f\n"
-	    "	str %[tmp], %[rp1]\n"
-
-	    "	str %[val0], %[addr0]\n"
-	    "   str %[val1], %[addr1]\n"
-	    "2:\n"
-	    : [tmp] "=&r" (tmp),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr0] "=m" (mem[0]),
-	      [addr1] "=m" (mem[1])
-	    : [val0] "r" (v.b[0]),
-	      [val1] "r" (v.b[1])
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-}
-
-bool __atomic_compare_exchange_1(volatile void *mem0, void *expected0,
-    unsigned char desired, bool weak, int success, int failure)
-{
-	volatile unsigned char *mem = mem0;
-	unsigned char *expected = expected0;
-
-	(void) success;
-	(void) failure;
-	(void) weak;
-
-	unsigned char ov = *expected;
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Sequence. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-
-	    "	ldrb %[ret], %[addr]\n"
-	    "	cmp %[ret], %[ov]\n"
-	    "	streqb %[nv], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [ov] "r" (ov),
-	      [nv] "r" (desired)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	if (ret == ov)
-		return true;
-
-	*expected = ret;
-	return false;
-}
-
-bool __atomic_compare_exchange_4(volatile void *mem0, void *expected0,
-    unsigned desired, bool weak, int success, int failure)
-{
-	volatile unsigned *mem = mem0;
-	unsigned *expected = expected0;
-
-	(void) success;
-	(void) failure;
-	(void) weak;
-
-	unsigned ov = *expected;
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Sequence. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-
-	    "	ldr %[ret], %[addr]\n"
-	    "	cmp %[ret], %[ov]\n"
-	    "	streq %[nv], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [ov] "r" (ov),
-	      [nv] "r" (desired)
-	    : "memory"
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	if (ret == ov)
-		return true;
-
-	*expected = ret;
-	return false;
-}
-
-unsigned char __atomic_exchange_1(volatile void *mem0, unsigned char val,
-    int model)
-{
-	volatile unsigned char *mem = mem0;
-
-	(void) model;
-
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-	    "	ldrb %[ret], %[addr]\n"
-	    "	strb %[imm], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [imm] "r" (val)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret;
-}
-
-unsigned short __atomic_exchange_2(volatile void *mem0, unsigned short val,
-    int model)
-{
-	volatile unsigned short *mem = mem0;
-
-	(void) model;
-
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-	    "	ldrh %[ret], %[addr]\n"
-	    "	strh %[imm], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [imm] "r" (val)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret;
-}
-
-unsigned __atomic_exchange_4(volatile void *mem0, unsigned val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	(void) model;
-
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-	    "	ldr %[ret], %[addr]\n"
-	    "	str %[imm], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [imm] "r" (val)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret;
-}
-
-unsigned short __atomic_fetch_add_2(volatile void *mem0, unsigned short val,
-    int model)
-{
-	volatile unsigned short *mem = mem0;
-
-	(void) model;
-
-	unsigned short ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-	    "	ldrh %[ret], %[addr]\n"
-	    "	add %[ret], %[ret], %[imm]\n"
-	    "	strh %[ret], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [imm] "r" (val)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret - val;
-}
-
-unsigned __atomic_fetch_add_4(volatile void *mem0, unsigned val, int model)
-{
-	volatile unsigned *mem = mem0;
-
-	(void) model;
-
-	unsigned ret;
-
-	/*
-	 * The following instructions between labels 1 and 2 constitute a
-	 * Restartable Atomic Seqeunce. Should the sequence be non-atomic,
-	 * the kernel will restart it.
-	 */
-	asm volatile (
-	    "1:\n"
-	    "	adr %[ret], 1b\n"
-	    "	str %[ret], %[rp0]\n"
-	    "	adr %[ret], 2f\n"
-	    "	str %[ret], %[rp1]\n"
-	    "	ldr %[ret], %[addr]\n"
-	    "	add %[ret], %[ret], %[imm]\n"
-	    "	str %[ret], %[addr]\n"
-	    "2:\n"
-	    : [ret] "=&r" (ret),
-	      [rp0] "=m" (ras_page[0]),
-	      [rp1] "=m" (ras_page[1]),
-	      [addr] "+m" (*mem)
-	    : [imm] "r" (val)
-	);
-
-	ras_page[0] = 0;
-	ras_page[1] = 0xffffffff;
-
-	return ret - val;
-}
-
-unsigned __atomic_fetch_sub_4(volatile void *mem, unsigned val, int model)
-{
-	return __atomic_fetch_add_4(mem, -val, model);
-}
-
-bool __atomic_test_and_set(volatile void *ptr, int memorder)
-{
-	volatile unsigned char *b = ptr;
-
-	unsigned char orig = __atomic_exchange_n(b, (unsigned char) true, memorder);
-	return orig != 0;
-}
-
-void __sync_synchronize(void)
-{
-	// FIXME: Full memory barrier. We might need a syscall for this.
-}
-
-unsigned __sync_add_and_fetch_4(volatile void *vptr, unsigned val)
-{
-	return __atomic_fetch_add_4(vptr, val, __ATOMIC_SEQ_CST) + val;
-}
-
-unsigned __sync_sub_and_fetch_4(volatile void *vptr, unsigned val)
-{
-	return __atomic_fetch_sub_4(vptr, val, __ATOMIC_SEQ_CST) - val;
-}
-
-bool __sync_bool_compare_and_swap_4(volatile void *ptr, unsigned old_val, unsigned new_val)
-{
-	return __atomic_compare_exchange_4(ptr, &old_val, new_val, false,
-	    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-}
-
-unsigned __sync_val_compare_and_swap_4(volatile void *ptr, unsigned old_val, unsigned new_val)
-{
-	__atomic_compare_exchange_4(ptr, &old_val, new_val, false,
-	    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-	return old_val;
-}
Index: pace/lib/c/arch/arm32/src/crt0.S
===================================================================
--- uspace/lib/c/arch/arm32/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt, Pavel Jancik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# r1 contains the PCB pointer
-# r2 contains the RAS page address
-#
-SYMBOL(_start)
-	# Store the RAS page address into the ras_page variable
-	// FIXME: This only works for not-PIC executables.
-	ldr r0, =ras_page
-	str r2, [r0]
-
-	#
-	# Create the first stack frame.
-	#
-	mov fp, #0
-	mov ip, sp
-	push {fp, ip, lr, pc}
-	sub fp, ip, #4
-
-	# Pass pcb_ptr to __c_start as the first argument (in r0)
-	mov r0, r1
-	bl __c_start
-
-.data
Index: pace/lib/c/arch/arm32/src/eabi.S
===================================================================
--- uspace/lib/c/arch/arm32/src/eabi.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2012 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(__aeabi_read_tp)
-	mov r0, r9
-	mov pc, lr
-FUNCTION_END(__aeabi_read_tp)
Index: pace/lib/c/arch/arm32/src/entryjmp.c
===================================================================
--- uspace/lib/c/arch/arm32/src/entryjmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <entry_point.h>
-#include "ras_page.h"
-
-void entry_point_jmp(void *entry_point, void *pcb)
-{
-	asm volatile (
-	    "mov r1, %0 \n"
-	    "mov r2, %1 \n"
-	    "mov r15, %2 \n"
-	    :
-	    : "r" (pcb), "r" (ras_page), "r" (entry_point)
-	    : "r1", "r2"
-	);
-
-	__builtin_unreachable();
-}
Index: pace/lib/c/arch/arm32/src/fibril.S
===================================================================
--- uspace/lib/c/arch/arm32/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(__context_save)
-	stmia r0!, {sp, lr}
-	stmia r0!, {r4-r11}
-
-	# return 0
-	mov r0, #0
-	mov pc, lr
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	ldmia r0!, {sp, lr}
-	ldmia r0!, {r4-r11}
-
-	# return second argument
-	mov r0, r1
-	mov pc, lr
-FUNCTION_END(__context_restore)
-
Index: pace/lib/c/arch/arm32/src/ras_page.h
===================================================================
--- uspace/lib/c/arch/arm32/src/ras_page.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-extern volatile unsigned *ras_page;
Index: pace/lib/c/arch/arm32/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/arm32/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/arm32/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,221 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <bitops.h>
-#include <smc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	elf_word r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uint32_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uint32_t *r_ptr;
-	uint32_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	rt_entries = rt_size / sizeof(elf_rel_t);
-	str_tab = m->dyn.str_tab;
-
-	DPRINTF("address: 0x%" PRIxPTR ", entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-
-		sym_idx = ELF32_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-
-#if 0
-		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
-		    str_tab + sym->st_name, sym->st_value, sym->st_size);
-#endif
-		rel_type = ELF32_R_TYPE(r_info);
-		r_ptr = (uint32_t *)(r_offset + m->bias);
-
-		if (sym->st_name != 0) {
-#if 0
-			DPRINTF("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
-#endif
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%x\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uint32_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-#if 0
-				DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
-#endif
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_ARM_TLS_DTPMOD32:
-			DPRINTF("fixup R_ARM_TLS_DTPMOD32\n");
-			*r_ptr = dest->id;
-			break;
-
-		case R_ARM_TLS_DTPOFF32:
-			DPRINTF("fixup R_ARM_TLS_DTPOFF32\n");
-			*r_ptr = sym_def->st_value;
-			break;
-
-		case R_ARM_TLS_TPOFF32:
-			DPRINTF("fixup R_ARM_TLS_TPOFF\n");
-			if (sym_def != NULL)
-				*r_ptr = sym_def->st_value + dest->tpoff;
-			else
-				*r_ptr = m->tpoff;
-			break;
-
-		case R_ARM_COPY:
-			/*
-			 * Copy symbol data from shared object to specified
-			 * location. Need to find the 'source', i.e. the
-			 * other instance of the object than the one in the
-			 * executable program.
-			 */
-			DPRINTF("fixup R_ARM_COPY (s)\n");
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uint32_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-				printf("Warning: Mismatched symbol sizes.\n");
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			memcpy(r_ptr, (const void *)sym_addr, sym_size);
-			break;
-
-		case R_ARM_GLOB_DAT:
-		case R_ARM_JUMP_SLOT:
-		case R_ARM_ABS32:
-			DPRINTF("fixup R_ARM_GLOB_DAT/JUMP_SLOT/ABS32 (S)\n");
-			*r_ptr = sym_addr;
-			break;
-
-		case R_ARM_RELATIVE:
-			DPRINTF("fixup R_ARM_RELATIVE (B)\n");
-			*r_ptr += dest->bias;
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-	}
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with explicit addends.
- */
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	(void) m;
-	(void) rt;
-	(void) rt_size;
-}
-
-/** Get the adress of a function.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	return symbol_get_addr(sym, m, __tcb_get());
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/arm32/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32 arm32
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include <stacktrace.h>
-
-#define FRAME_OFFSET_FP_PREV	-12
-#define FRAME_OFFSET_RA		-4
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	return fp != 0;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/arm32/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	mov pc, lr
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	mov r0, fp
-	mov pc, lr
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	mov r0, lr
-	mov pc, lr
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/arm32/src/syscall.c
===================================================================
--- uspace/lib/c/arch/arm32/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2007 Pavel Jancik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32
- * @{
- */
-/** @file
- *  @brief Syscall routine.
- */
-
-#include <libc.h>
-
-/** Syscall routine.
- *
- *  Stores p1-p4, id to r0-r4 registers and calls <code>swi</code>
- *  instruction. Returned value is read from r0 register.
- *
- *  @param p1 Parameter 1.
- *  @param p2 Parameter 2.
- *  @param p3 Parameter 3.
- *  @param p4 Parameter 4.
- *  @param id Number of syscall.
- *
- *  @return Syscall return value.
- */
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
-    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
-{
-	register sysarg_t __arm_reg_r0 asm("r0") = p1;
-	register sysarg_t __arm_reg_r1 asm("r1") = p2;
-	register sysarg_t __arm_reg_r2 asm("r2") = p3;
-	register sysarg_t __arm_reg_r3 asm("r3") = p4;
-	register sysarg_t __arm_reg_r4 asm("r4") = p5;
-	register sysarg_t __arm_reg_r5 asm("r5") = p6;
-	register sysarg_t __arm_reg_r6 asm("r6") = id;
-
-	asm volatile (
-	    "swi 0"
-	    : "=r" (__arm_reg_r0)
-	    : "r" (__arm_reg_r0),
-	      "r" (__arm_reg_r1),
-	      "r" (__arm_reg_r2),
-	      "r" (__arm_reg_r3),
-	      "r" (__arm_reg_r4),
-	      "r" (__arm_reg_r5),
-	      "r" (__arm_reg_r6)
-	    :
-	      /*
-	       * Clobber memory too as some arguments might be
-	       * actually pointers.
-	       */
-	      "memory"
-	);
-
-	return __arm_reg_r0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm32/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/arm32/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL(__thread_entry)
-	# Pop libc entry function and its argument.
-	pop { r0, r4 }
-
-	#
-	# Create the first stack frame.
-	#
-	mov fp, #0
-	mov ip, sp
-	push {fp, ip, lr, pc}
-	sub fp, ip, #4
-
-	bx r4
Index: pace/lib/c/arch/arm32/src/tls.c
===================================================================
--- uspace/lib/c/arch/arm32/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2007 Pavel Jancik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm32 arm32
- * @brief arm32 architecture dependent parts of libc
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_1(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_1(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-int __tls_debug = 0;
-
-void *__tls_get_addr(tls_index *ti);
-
-void *__tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset);
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief Configuration constants.
- */
-
-#ifndef _LIBC_arm64_CONFIG_H_
-#define _LIBC_arm64_CONFIG_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief
- */
-
-#ifndef _LIBC_arm64_DDI_H_
-#define _LIBC_arm64_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_arm64_ELF_LINUX_H_
-#define _LIBC_arm64_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint64_t x0;
-	uint64_t x1;
-	uint64_t x2;
-	uint64_t x3;
-	uint64_t x4;
-	uint64_t x5;
-	uint64_t x6;
-	uint64_t x7;
-	uint64_t x8;
-	uint64_t x9;
-	uint64_t x10;
-	uint64_t x11;
-	uint64_t x12;
-	uint64_t x13;
-	uint64_t x14;
-	uint64_t x15;
-	uint64_t x16;
-	uint64_t x17;
-	uint64_t x18;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	uint64_t x29;
-	uint64_t x30;
-
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t pstate;
-
-	uint64_t orig_x0;
-	uint64_t syscallno;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->x0 = istate->x0;
-	elf_regs->x1 = istate->x1;
-	elf_regs->x2 = istate->x2;
-	elf_regs->x3 = istate->x3;
-	elf_regs->x4 = istate->x4;
-	elf_regs->x5 = istate->x5;
-	elf_regs->x6 = istate->x6;
-	elf_regs->x7 = istate->x7;
-	elf_regs->x8 = istate->x8;
-	elf_regs->x9 = istate->x9;
-	elf_regs->x10 = istate->x10;
-	elf_regs->x11 = istate->x11;
-	elf_regs->x12 = istate->x12;
-	elf_regs->x13 = istate->x13;
-	elf_regs->x14 = istate->x14;
-	elf_regs->x15 = istate->x15;
-	elf_regs->x16 = istate->x16;
-	elf_regs->x17 = istate->x17;
-	elf_regs->x18 = istate->x18;
-	elf_regs->x19 = istate->x19;
-	elf_regs->x20 = istate->x20;
-	elf_regs->x21 = istate->x21;
-	elf_regs->x22 = istate->x22;
-	elf_regs->x23 = istate->x23;
-	elf_regs->x24 = istate->x24;
-	elf_regs->x25 = istate->x25;
-	elf_regs->x26 = istate->x26;
-	elf_regs->x27 = istate->x27;
-	elf_regs->x28 = istate->x28;
-	elf_regs->x29 = istate->x29;
-	elf_regs->x30 = istate->x30;
-
-	elf_regs->sp = istate->sp;
-	elf_regs->pc = istate->pc;
-	elf_regs->pstate = istate->spsr;
-
-	elf_regs->orig_x0 = 0;
-	elf_regs->syscallno = 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief Function address conversion.
- */
-
-#ifndef _LIBC_arm64_FADDR_H_
-#define _LIBC_arm64_FADDR_H_
-
-#include <types/common.h>
-
-/** Calculate absolute address of function referenced by fptr pointer.
- *
- * @param f Function pointer.
- */
-#define FADDR(f)  ((uintptr_t) (f))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief Fibrils related declarations.
- */
-
-#ifndef _LIBC_arm64_FIBRIL_H_
-#define _LIBC_arm64_FIBRIL_H_
-
-#include <types/common.h>
-#include <align.h>
-#include <libarch/fibril_context.h>
-
-/** Size of a stack item. */
-#define STACK_ITEM_SIZE	 8
-
-/** Required stack alignment. */
-#define STACK_ALIGNMENT	 16
-
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-/** Sets data to the context.
- *
- * @param c Context (#context_t).
- * @param _pc Program counter.
- * @param stack Stack address.
- * @param size Stack size.
- * @param ptls Pointer to the TCB.
- */
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (uint64_t) (_pc); \
-		(c)->sp = ((uint64_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = ((uint64_t) (ptls)) + ARCH_TP_OFFSET; \
-		/* Set frame pointer too. */ \
-		(c)->x29 = 0; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->x29;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP     0x00
-#define __CONTEXT_OFFSET_PC     0x08
-#define __CONTEXT_OFFSET_X19    0x10
-#define __CONTEXT_OFFSET_X20    0x18
-#define __CONTEXT_OFFSET_X21    0x20
-#define __CONTEXT_OFFSET_X22    0x28
-#define __CONTEXT_OFFSET_X23    0x30
-#define __CONTEXT_OFFSET_X24    0x38
-#define __CONTEXT_OFFSET_X25    0x40
-#define __CONTEXT_OFFSET_X26    0x48
-#define __CONTEXT_OFFSET_X27    0x50
-#define __CONTEXT_OFFSET_X28    0x58
-#define __CONTEXT_OFFSET_X29    0x60
-#define __CONTEXT_OFFSET_TLS    0x68
-#define __CONTEXT_OFFSET_VREGS  0x70
-#define __CONTEXT_SIZE          0xb0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-typedef struct __context {
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	uint64_t x29;
-	uint64_t tls;
-	/* v8-v15, low 64 bits only. */
-	uint64_t vregs[8];
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/arm64/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm64/include/arch/istate.h
Index: pace/lib/c/arch/arm64/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm64/include/arch/istate_struct.h
Index: pace/lib/c/arch/arm64/include/libarch/regutils.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/regutils.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/arm64/include/arch/regutils.h
Index: pace/lib/c/arch/arm64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief
- */
-
-#ifndef _LIBC_arm64_SYSCALL_H_
-#define _LIBC_arm64_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_arm64_THREAD_H_
-#define _LIBC_arm64_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	*--sp = (uintptr_t) arg;
-	*--sp = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/arm64/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief Thread-local storage.
- */
-
-#ifndef _LIBC_arm64_TLS_H_
-#define _LIBC_arm64_TLS_H_
-
-#define CONFIG_TLS_VARIANT_1
-
-/** Offsets for accessing thread-local variables are shifted 16 bytes higher. */
-#define ARCH_TP_OFFSET  (sizeof(tcb_t) - 16)
-
-/** TCB (Thread Control Block) struct.
- *
- * TLS starts just after this struct.
- */
-typedef struct {
-	/** Fibril data. */
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	asm volatile ("msr tpidr_el0, %[tls]" : : [tls] "r" (tls));
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("mrs %[tls], tpidr_el0" : [tls] "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/meson.build
===================================================================
--- uspace/lib/c/arch/arm64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/fibril.S',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/syscall.c',
-	'src/tls.c',
-	'src/thread_entry.S',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/arm64/src/crt0.S
===================================================================
--- uspace/lib/c/arch/arm64/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# x0 contains the PCB pointer
-#
-SYMBOL(_start)
-	#
-	# Create the first stack frame.
-	#
-	mov x29, #0
-	stp x29, x30, [sp, #-16]!
-	mov x29, sp
-
-	# Pass pcb_ptr to __c_start as the first argument (in x0)
-	bl __c_start
Index: pace/lib/c/arch/arm64/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/arm64/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# x0	contains entry_point
-# x1	contains pcb
-#
-# Jump to program entry point
-SYMBOL(entry_point_jmp)
-	# Pass PCB in x0 to the entry point and jump to it.
-	mov x2, x0
-	mov x0, x1
-	br x2
Index: pace/lib/c/arch/arm64/src/fibril.S
===================================================================
--- uspace/lib/c/arch/arm64/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-.text
-
-/* Static checks for the context_t save/load. */
-#if __CONTEXT_OFFSET_SP + 8 != __CONTEXT_OFFSET_PC
-#error sp and pc are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X19 + 8 != __CONTEXT_OFFSET_X20
-#error x19 and x20 are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X21 + 8 != __CONTEXT_OFFSET_X22
-#error x21 and x22 are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X23 + 8 != __CONTEXT_OFFSET_X24
-#error x23 and x24 are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X25 + 8 != __CONTEXT_OFFSET_X26
-#error x25 and x26 are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X27 + 8 != __CONTEXT_OFFSET_X28
-#error x27 and x28 are not successive in context_t
-#endif
-#if __CONTEXT_OFFSET_X29 + 8 != __CONTEXT_OFFSET_TLS
-#error x29 and tls are not successive in context_t
-#endif
-
-FUNCTION_BEGIN(__context_save)
-	/* Save callee-saved registers into context_t pointed by x0. */
-	mov x1, sp
-	stp x1, x30, [x0, #__CONTEXT_OFFSET_SP]
-	stp x19, x20, [x0, #__CONTEXT_OFFSET_X19]
-	stp x21, x22, [x0, #__CONTEXT_OFFSET_X21]
-	stp x23, x24, [x0, #__CONTEXT_OFFSET_X23]
-	stp x25, x26, [x0, #__CONTEXT_OFFSET_X25]
-	stp x27, x28, [x0, #__CONTEXT_OFFSET_X27]
-	/* Save the last general-purpose register and TLS. */
-	mrs x1, tpidr_el0
-	stp x29, x1, [x0, #__CONTEXT_OFFSET_X29]
-	/* Save low 64 bits of v8-v15. */
-	stp d8, d9, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 0]
-	stp d10, d11, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 2]
-	stp d12, d13, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 4]
-	stp d14, d15, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 6]
-
-	/* Return 0. */
-	mov x0, #0
-	ret
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	/* Restore callee-saved registers from context_t pointed by x0. */
-	ldp x2, x30, [x0, #__CONTEXT_OFFSET_SP]
-	mov sp, x2
-	ldp x19, x20, [x0, #__CONTEXT_OFFSET_X19]
-	ldp x21, x22, [x0, #__CONTEXT_OFFSET_X21]
-	ldp x23, x24, [x0, #__CONTEXT_OFFSET_X23]
-	ldp x25, x26, [x0, #__CONTEXT_OFFSET_X25]
-	ldp x27, x28, [x0, #__CONTEXT_OFFSET_X27]
-	/* Restore the last general-purpose register and TLS. */
-	ldp x29, x2, [x0, #__CONTEXT_OFFSET_X29]
-	msr tpidr_el0, x2
-	/* Restore low 64 bits of v8-v15. */
-	ldp d8, d9, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 0]
-	ldp d10, d11, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 2]
-	ldp d12, d13, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 4]
-	ldp d14, d15, [x0, #__CONTEXT_OFFSET_VREGS + 8 * 6]
-
-	/* Return the second argument. */
-	mov x0, x1
-	ret
-FUNCTION_END(__context_restore)
Index: pace/lib/c/arch/arm64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/arm64/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief
- */
-
-#include <stacktrace.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       8
-
-bool stacktrace_fp_valid(stacktrace_t *st __attribute__((unused)),
-    uintptr_t fp)
-{
-	return fp != 0;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV,
-	    prev);
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/arm64/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	ret
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	mov x0, x29
-	ret
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	mov x0, x30
-	ret
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/arm64/src/syscall.c
===================================================================
--- uspace/lib/c/arch/arm64/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- * @{
- */
-/** @file
- * @brief Syscall routine.
- */
-
-#include <libc.h>
-
-/** Syscall routine.
- *
- * Stores p1-p6, id to r0-r6 registers and calls <code>svc</code> instruction.
- * Returned value is read from r0 register.
- *
- * @param p1 Parameter 1.
- * @param p2 Parameter 2.
- * @param p3 Parameter 3.
- * @param p4 Parameter 4.
- * @param p5 Parameter 5.
- * @param p6 Parameter 6.
- * @param id Number of syscall.
- *
- * @return Syscall return value.
- */
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
-    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6,
-    const syscall_t id)
-{
-	register sysarg_t __arm_reg_x0 asm("x0") = p1;
-	register sysarg_t __arm_reg_x1 asm("x1") = p2;
-	register sysarg_t __arm_reg_x2 asm("x2") = p3;
-	register sysarg_t __arm_reg_x3 asm("x3") = p4;
-	register sysarg_t __arm_reg_x4 asm("x4") = p5;
-	register sysarg_t __arm_reg_x5 asm("x5") = p6;
-	register sysarg_t __arm_reg_x6 asm("x6") = id;
-
-	asm volatile (
-	    "svc #0"
-	    : "=r" (__arm_reg_x0)
-	    : "r" (__arm_reg_x0),
-	      "r" (__arm_reg_x1),
-	      "r" (__arm_reg_x2),
-	      "r" (__arm_reg_x3),
-	      "r" (__arm_reg_x4),
-	      "r" (__arm_reg_x5),
-	      "r" (__arm_reg_x6)
-	    :
-	      /*
-	       * Clobber memory too as some arguments might be actually
-	       * pointers.
-	       */
-	      "memory"
-	);
-
-	return __arm_reg_x0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/arm64/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/arm64/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first thread.
-#
-#
-SYMBOL(__thread_entry)
-	# Load entry function and argument from stack.
-	ldp x1, x0, [sp], #16
-
-	# Create the first stack frame.
-	mov x29, #0
-	stp x29, x30, [sp, #-16]!
-	mov x29, sp
-
-	br x1
Index: pace/lib/c/arch/arm64/src/tls.c
===================================================================
--- uspace/lib/c/arch/arm64/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Petr Pavlu
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcarm64
- */
-/** @file
- * @brief Thread-local storage.
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_1(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_1(tcb, size, align);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_CONFIG_H_
-#define _LIBC_ia32_CONFIG_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#define USER_ADDRESS_SPACE_START_ARCH  UINT32_C(0x00000000)
-#define USER_ADDRESS_SPACE_END_ARCH    UINT32_C(0x7fffffff)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @ingroup libcia32, libcamd64
- */
-
-#ifndef _LIBC_ia32_DDI_H_
-#define _LIBC_ia32_DDI_H_
-
-#include <ddi.h>
-
-#define IO_SPACE_BOUNDARY  ((void *) (64 * 1024))
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		uint8_t val;
-
-		asm volatile (
-		    "inb %w[port], %b[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint8_t) *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		uint16_t val;
-
-		asm volatile (
-		    "inw %w[port], %w[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint16_t) *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		uint32_t val;
-
-		asm volatile (
-		    "inl %w[port], %[val]\n"
-		    : [val] "=a" (val)
-		    : [port] "d" (port)
-		);
-
-		return val;
-	} else
-		return (uint32_t) *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return (uint64_t) *port;
-}
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t val)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outb %b[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t val)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outw %w[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t val)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		asm volatile (
-		    "outl %[val], %w[port]\n"
-		    :: [val] "a" (val), [port] "d" (port)
-		);
-	} else
-		*port = val;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t val)
-{
-	*port = val;
-}
-
-#endif
Index: pace/lib/c/arch/ia32/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_ia32_ELF_LINUX_H_
-#define _LIBC_ia32_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint32_t ebx;
-	uint32_t ecx;
-	uint32_t edx;
-	uint32_t esi;
-	uint32_t edi;
-	uint32_t ebp;
-	uint32_t eax;
-	uint32_t ds;
-	uint32_t es;
-	uint32_t fs;
-	uint32_t gs;
-	uint32_t old_eax;
-	uint32_t eip;
-	uint32_t cs;
-	uint32_t eflags;
-	uint32_t esp;
-	uint32_t ss;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->ebx = istate->ebx;
-	elf_regs->ecx = istate->ecx;
-	elf_regs->edx = istate->edx;
-	elf_regs->esi = istate->esi;
-	elf_regs->edi = istate->edi;
-	elf_regs->ebp = istate->ebp;
-	elf_regs->eax = istate->eax;
-
-	elf_regs->ds = istate->ds;
-	elf_regs->es = istate->es;
-	elf_regs->fs = istate->fs;
-	elf_regs->gs = istate->gs;
-
-	elf_regs->old_eax = 0;
-	elf_regs->eip = istate->eip;
-	elf_regs->cs = istate->cs;
-	elf_regs->eflags = istate->eflags;
-	elf_regs->esp = istate->esp;
-	elf_regs->ss = istate->ss;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_FADDR_H_
-#define _LIBC_ia32_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_FIBRIL_H_
-#define _LIBC_ia32_FIBRIL_H_
-
-#include <types/common.h>
-#include <libarch/fibril_context.h>
-
-/*
- * According to ABI the stack MUST be aligned on
- * 16-byte boundary. If it is not, the va_arg calling will
- * panic sooner or later
- */
-#define SP_DELTA  8
-
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (sysarg_t) (_pc); \
-		(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = (sysarg_t) (ptls); \
-		(c)->ebp = 0; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->ebp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP   0x00
-#define __CONTEXT_OFFSET_PC   0x04
-#define __CONTEXT_OFFSET_EBX  0x08
-#define __CONTEXT_OFFSET_ESI  0x0c
-#define __CONTEXT_OFFSET_EDI  0x10
-#define __CONTEXT_OFFSET_EBP  0x14
-#define __CONTEXT_OFFSET_TLS  0x18
-#define __CONTEXT_SIZE        0x1c
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-
-/* We include only registers that must be preserved during function call. */
-typedef struct __context {
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t ebx;
-	uint32_t esi;
-	uint32_t edi;
-	uint32_t ebp;
-	uint32_t tls;
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/ia32/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ia32/include/arch/istate.h
Index: pace/lib/c/arch/ia32/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ia32/include/arch/istate_struct.h
Index: pace/lib/c/arch/ia32/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_RTLD_DYNAMIC_H_
-#define _LIBC_ia32_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_RTLD_ELF_DYN_H_
-#define _LIBC_ia32_RTLD_ELF_DYN_H_
-
-/*
- * ia32 dynamic relocation types
- */
-
-#define R_386_32	1
-#define R_386_PC32	2
-#define R_386_COPY	5
-#define R_386_GLOB_DAT	6
-#define R_386_JUMP_SLOT	7
-#define R_386_RELATIVE	8
-
-#define R_386_TLS_TPOFF    14
-#define R_386_TLS_DTPMOD32 35
-#define R_386_TLS_DTPOFF32 36
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_RTLD_MODULE_H_
-#define _LIBC_ia32_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags.
- *
- * Keep code segment read-write
- */
-#define RTLD_MODULE_LDF ELDF_RW
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_ia32_SYSCALL_H_
-#define _LIBC_ia32_SYSCALL_H_
-
-#include <abi/syscall.h>
-#include <types/common.h>
-
-#define __syscall0  __syscall_fast_func
-#define __syscall1  __syscall_fast_func
-#define __syscall2  __syscall_fast_func
-#define __syscall3  __syscall_fast_func
-#define __syscall4  __syscall_fast_func
-#define __syscall5  __syscall_slow
-#define __syscall6  __syscall_slow
-
-extern sysarg_t (*__syscall_fast_func)(const sysarg_t, const sysarg_t,
-    const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,
-    const syscall_t);
-
-extern sysarg_t __syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t,
-    const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_THREAD_H_
-#define _LIBC_ia32_THREAD_H_
-
-#include <align.h>
-#include <stddef.h>
-#include <stdint.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	*--sp = (uintptr_t) arg;
-	*--sp = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/ia32/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia32_TLS_H_
-#define _LIBC_ia32_TLS_H_
-
-#define CONFIG_TLS_VARIANT_2
-
-#define ARCH_TP_OFFSET 0
-
-#include <libc.h>
-
-typedef struct {
-	void *self;
-	void *fibril_data;
-	void **dtv;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	asm volatile ("movl %0, %%gs:0" :: "r" (tls));
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("movl %%gs:0, %0" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/meson.build
===================================================================
--- uspace/lib/c/arch/ia32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/syscall.S',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/ia32/src/crt0.S
===================================================================
--- uspace/lib/c/arch/ia32/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-INTEL_CPUID_STANDARD = 1
-INTEL_SEP = 11
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# %edi contains the PCB pointer
-#
-SYMBOL(_start)
-	mov %ss, %ax
-	mov %ax, %ds
-	mov %ax, %es
-	mov %ax, %fs
-	# Do not set %gs, it contains descriptor that can see TLS
-
-#ifndef PROCESSOR_i486
-	# Detect the mechanism used for making syscalls
-	movl $(INTEL_CPUID_STANDARD), %eax
-	cpuid
-	bt $(INTEL_SEP), %edx
-	jnc 0f
-		leal __syscall_fast_func, %eax
-		movl $__syscall_fast, (%eax)
-	0:
-#endif
-
-	#
-	# Create the first stack frame.
-	#
-	pushl $0
-	pushl $0
-	movl %esp, %ebp
-
-	# Pass the PCB pointer to __c_start as the first argument
-	pushl %edi
-	call __c_start
Index: pace/lib/c/arch/ia32/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/ia32/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# Jump to program entry point
-SYMBOL(entry_point_jmp)
-	# Use standard ia32 prologue not to confuse anybody
-	push %ebp
-	movl %esp, %ebp
-
-	# %eax := entry_point
-	movl 0x8(%ebp), %eax
-
-	# %edi := pcb
-	# pcb is passed to the entry point in %edi
-	mov 0xc(%ebp), %edi
-
-	# Save a tiny bit of stack space
-	pop %ebp
-
-	jmp *%eax
Index: pace/lib/c/arch/ia32/src/fibril.S
===================================================================
--- uspace/lib/c/arch/ia32/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#
-# Copyright (c) 2001-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-.text
-
-## Save current CPU context
-#
-# Save CPU context to the context_t variable
-# pointed by the 1st argument. Returns 0 in EAX.
-#
-FUNCTION_BEGIN(__context_save)
-	movl 0(%esp), %eax  # the caller's return %eip
-	movl 4(%esp), %edx  # address of the context variable to save context to
-
-	# save registers to the context structure
-	movl %esp, __CONTEXT_OFFSET_SP(%edx)	# %esp -> ctx->sp
-	movl %eax, __CONTEXT_OFFSET_PC(%edx)	# %eip -> ctx->pc
-	movl %ebx, __CONTEXT_OFFSET_EBX(%edx)	# %ebx -> ctx->ebx
-	movl %esi, __CONTEXT_OFFSET_ESI(%edx)	# %esi -> ctx->esi
-	movl %edi, __CONTEXT_OFFSET_EDI(%edx)	# %edi -> ctx->edi
-	movl %ebp, __CONTEXT_OFFSET_EBP(%edx)	# %ebp -> ctx->ebp
-
-	# save TLS
-	movl %gs:0, %eax
-	movl %eax, __CONTEXT_OFFSET_TLS(%edx)	# tls -> ctx->tls
-
-	xorl %eax, %eax		# __context_save returns 0
-	ret
-FUNCTION_END(__context_save)
-
-## Restore saved CPU context
-#
-# Restore CPU context from context_t variable
-# pointed by the 1st argument. Returns second argument in EAX.
-#
-FUNCTION_BEGIN(__context_restore)
-	movl 4(%esp), %eax  # address of the context variable to restore context from
-	movl 8(%esp), %ecx  # return value
-
-	# restore registers from the context structure
-	movl __CONTEXT_OFFSET_SP(%eax),%esp	# ctx->sp -> %esp
-	movl __CONTEXT_OFFSET_PC(%eax),%edx	# ctx->pc -> \pc
-	movl __CONTEXT_OFFSET_EBX(%eax),%ebx	# ctx->ebx -> %ebx
-	movl __CONTEXT_OFFSET_ESI(%eax),%esi	# ctx->esi -> %esi
-	movl __CONTEXT_OFFSET_EDI(%eax),%edi	# ctx->edi -> %edi
-	movl __CONTEXT_OFFSET_EBP(%eax),%ebp	# ctx->ebp -> %ebp
-
-	movl %edx, 0(%esp)  # ctx->pc -> saver's return %eip
-
-	# set thread local storage
-	movl __CONTEXT_OFFSET_TLS(%eax), %edx	# Set arg1 to TLS addr
-	movl %edx, %gs:0
-
-	movl %ecx, %eax
-	ret
-FUNCTION_END(__context_restore)
-
Index: pace/lib/c/arch/ia32/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/ia32/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/ia32/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	elf_word r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uint32_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uint32_t *r_ptr;
-	uint32_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	rt_entries = rt_size / sizeof(elf_rel_t);
-	str_tab = m->dyn.str_tab;
-
-	DPRINTF("address: 0x%" PRIxPTR ", entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-
-		sym_idx = ELF32_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-
-#if 0
-		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
-		    str_tab + sym->st_name, sym->st_value, sym->st_size);
-#endif
-		rel_type = ELF32_R_TYPE(r_info);
-		r_ptr = (uint32_t *)(r_offset + m->bias);
-
-		if (sym->st_name != 0) {
-#if 0
-			DPRINTF("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
-#endif
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%x\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uint32_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-#if 0
-				DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
-#endif
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-
-			/*
-			 * DTPMOD with null st_name should return the index
-			 * of the current module.
-			 */
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_386_GLOB_DAT:
-		case R_386_JUMP_SLOT:
-			DPRINTF("fixup R_386_GLOB_DAT/JUMP_SLOT (b+v)\n");
-			*r_ptr = sym_addr;
-			break;
-
-		case R_386_32:
-			DPRINTF("fixup R_386_32 (b+v+a)\n");
-			*r_ptr += sym_addr;
-			break;
-
-		case R_386_PC32:
-			DPRINTF("fixup R_386_PC32 (b+v+a-p)\n");
-			*r_ptr += sym_addr - (uint32_t) r_ptr;
-			break;
-
-		case R_386_COPY:
-			/*
-			 * Copy symbol data from shared object to specified
-			 * location. Need to find the 'source', i.e. the
-			 * other instance of the object than the one in the
-			 * executable program.
-			 */
-			DPRINTF("fixup R_386_COPY (s)\n");
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uint32_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-				printf("Warning: Mismatched symbol sizes.\n");
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			memcpy(r_ptr, (const void *)sym_addr, sym_size);
-			break;
-
-		case R_386_RELATIVE:
-			DPRINTF("fixup R_386_RELATIVE (b+a)\n");
-			*r_ptr += m->bias;
-			break;
-
-		case R_386_TLS_TPOFF:
-			DPRINTF("fixup R_386_TLS_TPOFF\n");
-			*r_ptr = sym_def->st_value + dest->tpoff;
-			break;
-
-		case R_386_TLS_DTPOFF32:
-			DPRINTF("fixup R_386_TLS_DTPOFF32\n");
-			*r_ptr = sym_def->st_value;
-			break;
-
-		case R_386_TLS_DTPMOD32:
-			DPRINTF("fixup R_386_TLS_DTPMOD32\n");
-			*r_ptr = dest->id;
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-
-	}
-
-}
-
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	/* Unused */
-	(void)m;
-	(void)rt;
-	(void)rt_size;
-}
-
-/** Get the adress of a function.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	return symbol_get_addr(sym, m, __tcb_get());
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ia32/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia32 ia32
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <libarch/config.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stacktrace.h>
-
-#define FRAME_OFFSET_FP_PREV  0
-#define FRAME_OFFSET_RA       4
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	return (fp != 0) && (fp <= USER_ADDRESS_SPACE_END_ARCH);
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia32/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/ia32/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	ret
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	movl %ebp, %eax
-	ret
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	movl (%esp), %eax
-	ret
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/ia32/src/syscall.S
===================================================================
--- uspace/lib/c/arch/ia32/src/syscall.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.data
-
-OBJECT_BEGIN(__syscall_fast_func)
-	.long __syscall_slow
-OBJECT_END(__syscall_fast_func)
-
-.text
-
-/** Syscall wrapper - INT $0x30 version.
- *
- * Mind the order of arguments. First two arguments and the syscall number go to
- * scratch registers. An optimized version of this wrapper for fewer arguments
- * could benefit from this and not save unused registers on the stack.
- */
-FUNCTION_BEGIN(__syscall_slow)
-	pushl %ebx
-	pushl %esi
-	pushl %edi
-	pushl %ebp
-	movl 20(%esp), %edx	# First argument.
-	movl 24(%esp), %ecx	# Second argument.
-	movl 28(%esp), %ebx	# Third argument.
-	movl 32(%esp), %esi	# Fourth argument.
-	movl 36(%esp), %edi	# Fifth argument.
-	movl 40(%esp), %ebp	# Sixth argument.
-	movl 44(%esp), %eax	# Syscall number.
-	int $0x30
-	popl %ebp
-	popl %edi
-	popl %esi
-	popl %ebx
-	ret
-FUNCTION_END(__syscall_slow)
-
-/** Syscall wrapper - SYSENTER version.
- *
- * This is an optimized version of syscall for four or less arguments.  Note
- * that EBP and EDI are used to remember user stack address and the return
- * address. The kernel part doesn't save DS, ES and FS so the handler restores
- * these to the selector immediately following CS (it must be the flat data
- * segment, otherwise the SYSENTER wouldn't work in the first place).
- */
-FUNCTION_BEGIN(__syscall_fast)
-	pushl %ebx
-	pushl %esi
-	pushl %edi
-	pushl %ebp
-	mov %esp, %ebp
-	movl 20(%esp), %edx	# First argument.
-	movl 24(%esp), %ecx	# Second argument.
-	movl 28(%esp), %ebx	# Third argument.
-	movl 32(%esp), %esi	# Fourth argument.
-	movl 44(%esp), %eax	# Syscall number.
-	call 1f
-	movw %cs, %cx
-	addw $8, %cx
-	movw %cx, %ds
-	movw %cx, %es
-	movw %cx, %fs
-	popl %ebp
-	popl %edi
-	popl %esi
-	popl %ebx
-	ret
-
-	/* Trampoline for entering kernel */
-1:
-	pop %edi
-	sysenter
-FUNCTION_END(__syscall_fast)
Index: pace/lib/c/arch/ia32/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/ia32/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL_BEGIN(__thread_entry)
-	mov %ss, %dx
-	mov %dx, %ds
-	mov %dx, %es
-	mov %dx, %fs
-	# Do not set %gs, it contains descriptor that can see TLS
-
-	# Pop libc thread main function.
-	popl %eax
-	# Pop argument.
-	popl %ebx
-
-	#
-	# Create the first stack frame.
-	#
-	pushl $0
-	pushl $0
-	mov %esp, %ebp
-
-	pushl %ebx
-	call *%eax
-
-	#
-	# Not reached.
-	#
-SYMBOL_END(__thread_entry)
Index: pace/lib/c/arch/ia32/src/tls.c
===================================================================
--- uspace/lib/c/arch/ia32/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64 amd64
- * @ingroup lc
- * @{
- */
-/** @file
- * @ingroup libcia32
- */
-
-#include <tls.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <align.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_2(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_2(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-void __attribute__((__regparm__(1)))
-    *___tls_get_addr(tls_index *ti);
-
-void __attribute__((__regparm__(1)))
-    *___tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset);
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_CONFIG_H_
-#define _LIBC_ia64_CONFIG_H_
-
-#define PAGE_WIDTH	14
-#define PAGE_SIZE	(1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_DDI_H_
-#define _LIBC_ia64_DDI_H_
-
-#include <ddi.h>
-
-#define IO_SPACE_BOUNDARY	((void *) (64 * 1024))
-
-uint64_t get_ia64_iospace_address(void);
-
-extern uint64_t ia64_iospace_address;
-
-#define IA64_IOSPACE_ADDRESS \
-	(ia64_iospace_address ? \
-	    ia64_iospace_address : \
-	    (ia64_iospace_address = get_ia64_iospace_address()))
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		*((ioport8_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
-	} else {
-		*port = v;
-	}
-
-	asm volatile ("mf\n" ::: "memory");
-	asm volatile ("mf.a\n" ::: "memory");
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		*((ioport16_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
-	} else {
-		*port = v;
-	}
-
-	asm volatile ("mf\n" ::: "memory");
-	asm volatile ("mf.a\n" ::: "memory");
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		*((ioport32_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
-	} else {
-		*port = v;
-	}
-
-	asm volatile ("mf\n" ::: "memory");
-	asm volatile ("mf.a\n" ::: "memory");
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-
-	asm volatile ("mf\n" ::: "memory");
-	asm volatile ("mf.a\n" ::: "memory");
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	uint8_t v;
-
-	asm volatile ("mf\n" ::: "memory");
-
-	if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		v = *((ioport8_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12))));
-	} else {
-		v = *port;
-	}
-
-	asm volatile ("mf.a\n" ::: "memory");
-
-	return v;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	uint16_t v;
-
-	asm volatile ("mf\n" ::: "memory");
-
-	if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		v = *((ioport16_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12))));
-	} else {
-		v = *port;
-	}
-
-	asm volatile ("mf.a\n" ::: "memory");
-
-	return v;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	uint32_t v;
-
-	asm volatile ("mf\n" ::: "memory");
-
-	if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
-		uintptr_t prt = (uintptr_t) port;
-
-		v = *((ioport32_t *)(IA64_IOSPACE_ADDRESS +
-		    ((prt & 0xfff) | ((prt >> 2) << 12))));
-	} else {
-		v = *port;
-	}
-
-	asm volatile ("mf.a\n" ::: "memory");
-
-	return v;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	uint64_t v;
-
-	asm volatile ("mf\n" ::: "memory");
-
-	v = *port;
-
-	asm volatile ("mf.a\n" ::: "memory");
-
-	return v;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_ELF_LINUX_H_
-#define _LIBC_ia64_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-typedef struct {
-	/* TODO */
-	uint64_t pad[16];
-} elf_regs_t;
-
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	/* TODO */
-	(void) istate;
-	(void) elf_regs;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_FADDR_H_
-#define _LIBC_ia64_FADDR_H_
-
-#include <types/common.h>
-
-typedef struct {
-	uintptr_t fnc;
-	uintptr_t gp;
-} __attribute__((may_alias)) fncptr_t;
-
-/**
- *
- * Calculate absolute address of function
- * referenced by fptr pointer.
- *
- * @param fptr Function pointer.
- *
- */
-#define FADDR(fptr)  (((fncptr_t *) (fptr))->fnc)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_FIBRIL_H_
-#define _LIBC_ia64_FIBRIL_H_
-
-#include <stdint.h>
-#include <align.h>
-#include <libarch/stack.h>
-#include <types/common.h>
-#include <libarch/fibril_context.h>
-
-/*
- * __context_save() and __context_restore() are both leaf procedures.
- * No need to allocate scratch area.
- */
-#define SP_DELTA  (0 + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-#define PFM_MASK  (~0x3fffffffff)
-
-/* Stack is divided into two equal parts (for memory stack and register stack). */
-#define FIBRIL_INITIAL_STACK_DIVISION  2
-
-#define context_set(c, _pc, stack, size, tls) \
-	do { \
-		(c)->pc = (uint64_t) _pc; \
-		(c)->bsp = ((uint64_t) stack) + \
-		    size / FIBRIL_INITIAL_STACK_DIVISION; \
-		(c)->ar_pfs &= PFM_MASK; \
-		(c)->sp = ((uint64_t) stack) + \
-		    ALIGN_UP((size / FIBRIL_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \
-		    SP_DELTA; \
-		(c)->tp = (uint64_t) tls; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return 0;	/* FIXME */
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights preserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_AR_PFS          0x000
-#define __CONTEXT_OFFSET_AR_UNAT_CALLER  0x008
-#define __CONTEXT_OFFSET_AR_UNAT_CALLEE  0x010
-#define __CONTEXT_OFFSET_AR_RSC          0x018
-#define __CONTEXT_OFFSET_BSP             0x020
-#define __CONTEXT_OFFSET_AR_RNAT         0x028
-#define __CONTEXT_OFFSET_AR_LC           0x030
-#define __CONTEXT_OFFSET_R1              0x038
-#define __CONTEXT_OFFSET_R4              0x040
-#define __CONTEXT_OFFSET_R5              0x048
-#define __CONTEXT_OFFSET_R6              0x050
-#define __CONTEXT_OFFSET_R7              0x058
-#define __CONTEXT_OFFSET_SP              0x060
-#define __CONTEXT_OFFSET_TP              0x068
-#define __CONTEXT_OFFSET_PC              0x070
-#define __CONTEXT_OFFSET_B1              0x078
-#define __CONTEXT_OFFSET_B2              0x080
-#define __CONTEXT_OFFSET_B3              0x088
-#define __CONTEXT_OFFSET_B4              0x090
-#define __CONTEXT_OFFSET_B5              0x098
-#define __CONTEXT_OFFSET_PR              0x0a0
-#define __CONTEXT_OFFSET_F2              0x0b0
-#define __CONTEXT_OFFSET_F3              0x0c0
-#define __CONTEXT_OFFSET_F4              0x0d0
-#define __CONTEXT_OFFSET_F5              0x0e0
-#define __CONTEXT_OFFSET_F16             0x0f0
-#define __CONTEXT_OFFSET_F17             0x100
-#define __CONTEXT_OFFSET_F18             0x110
-#define __CONTEXT_OFFSET_F19             0x120
-#define __CONTEXT_OFFSET_F20             0x130
-#define __CONTEXT_OFFSET_F21             0x140
-#define __CONTEXT_OFFSET_F22             0x150
-#define __CONTEXT_OFFSET_F23             0x160
-#define __CONTEXT_OFFSET_F24             0x170
-#define __CONTEXT_OFFSET_F25             0x180
-#define __CONTEXT_OFFSET_F26             0x190
-#define __CONTEXT_OFFSET_F27             0x1a0
-#define __CONTEXT_OFFSET_F28             0x1b0
-#define __CONTEXT_OFFSET_F29             0x1c0
-#define __CONTEXT_OFFSET_F30             0x1d0
-#define __CONTEXT_OFFSET_F31             0x1e0
-#define __CONTEXT_SIZE                   0x1f0
-
-#ifndef __ASSEMBLER__
-
-#include <stdint.h>
-#include <_bits/int128_t.h>
-
-// Only save registers that must be preserved across function calls.
-typedef struct __context {
-	// Application registers.
-	uint64_t ar_pfs;
-	uint64_t ar_unat_caller;
-	uint64_t ar_unat_callee;
-	uint64_t ar_rsc;
-	// ar_bsp
-	uint64_t bsp;
-	uint64_t ar_rnat;
-	uint64_t ar_lc;
-
-	// General registers.
-	uint64_t r1;
-	uint64_t r4;
-	uint64_t r5;
-	uint64_t r6;
-	uint64_t r7;
-	// r12
-	uint64_t sp;
-	// r13
-	uint64_t tp;
-
-	// Branch registers.
-	// b0
-	uint64_t pc;
-	uint64_t b1;
-	uint64_t b2;
-	uint64_t b3;
-	uint64_t b4;
-	uint64_t b5;
-
-	// Predicate registers.
-	uint64_t pr;
-	uint128_t f2;
-	uint128_t f3;
-	uint128_t f4;
-	uint128_t f5;
-	uint128_t f16;
-	uint128_t f17;
-	uint128_t f18;
-	uint128_t f19;
-	uint128_t f20;
-	uint128_t f21;
-	uint128_t f22;
-	uint128_t f23;
-	uint128_t f24;
-	uint128_t f25;
-	uint128_t f26;
-	uint128_t f27;
-	uint128_t f28;
-	uint128_t f29;
-	uint128_t f30;
-	uint128_t f31;
-} __context_t;
-
-#endif  /* __ASSEMBLER__ */
-#endif
Index: pace/lib/c/arch/ia64/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ia64/include/arch/istate.h
Index: pace/lib/c/arch/ia64/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ia64/include/arch/istate_struct.h
Index: pace/lib/c/arch/ia64/include/libarch/register.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/register.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ia64/include/arch/register.h
Index: pace/lib/c/arch/ia64/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_RTLD_DYNAMIC_H_
-#define LIBC_ia64_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file ia64 dynamic relocation types
- */
-
-#ifndef LIBC_ia64_RTLD_ELF_DYN_H_
-#define LIBC_ia64_RTLD_ELF_DYN_H_
-
-#define R_IA_64_DIR64LSB    0x27
-#define R_IA_64_FPTR64LSB   0x47
-#define R_IA_64_REL64LSB    0x6f
-#define R_IA_64_IPLTLSB     0x81
-#define R_IA_64_DTPMOD64LSB 0xa7
-#define R_IA_64_DTPREL64LSB 0xb7
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef LIBC_ia64_RTLD_MODULE_H_
-#define LIBC_ia64_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags */
-#define RTLD_MODULE_LDF 0
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/stack.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_STACK_H_
-#define _LIBC_ia64_STACK_H_
-
-#define STACK_ITEM_SIZE			8
-#define STACK_ALIGNMENT			16
-#define STACK_SCRATCH_AREA_SIZE		16
-#define REGISTER_STACK_ALIGNMENT 	8
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/stackarg.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/stackarg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STACKARG_H_
-#define _LIBC_STACKARG_H_
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_ia64_SYSCALL_H_
-#define _LIBC_ia64_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_THREAD_H_
-#define _LIBC_ia64_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) (ALIGN_DOWN((uintptr_t) stack + stack_size / 2, 16));
-
-	/* Store data under stack pointer */
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/ia64/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ia64_TLS_H_
-#define _LIBC_ia64_TLS_H_
-
-#define CONFIG_TLS_VARIANT_1
-
-#define ARCH_TP_OFFSET 0
-
-/* This structure must be exactly 16 bytes long */
-typedef struct {
-	void **dtv;
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tcb)
-{
-	asm volatile ("mov r13 = %0\n" : : "r" (tcb) : "r13");
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("mov %0 = r13\n" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/meson.build
===================================================================
--- uspace/lib/c/arch/ia64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src = [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/syscall.S',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/ddi.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/ia64/src/crt0.S
===================================================================
--- uspace/lib/c/arch/ia64/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-.align 16
-
-## User-space task entry point
-#
-# r2 contains the PCB pointer
-#
-SYMBOL(_start)
-	alloc loc0 = ar.pfs, 0, 1, 2, 0
-	movl gp = __gp
-
-	# Pass PCB pointer as the first argument to __c_start
-	mov out0 = r2 ;;
-	br.call.sptk.many b0 = __c_start
-
Index: pace/lib/c/arch/ia64/src/ddi.c
===================================================================
--- uspace/lib/c/arch/ia64/src/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <libarch/ddi.h>
-#include <sysinfo.h>
-
-uint64_t ia64_iospace_address = 0;
-
-uint64_t get_ia64_iospace_address(void)
-{
-	sysarg_t addr;
-	if (sysinfo_get_value("ia64_iospace.address.virtual", &addr) != 0)
-		addr = 0;
-
-	return addr;
-}
Index: pace/lib/c/arch/ia64/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/ia64/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-.explicit
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# in0 (r32)	contains entry_point
-# in1 (r33)	contains pcb
-#
-# Jump to program entry point
-SYMBOL(entry_point_jmp)
-	# Pass pcb to the entry point in r2
-
-	mov b6 = r32
-	mov r2 = r33 ;;
-	br b6 ;;
Index: pace/lib/c/arch/ia64/src/fibril.S
===================================================================
--- uspace/lib/c/arch/ia64/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,339 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-.text
-
-FUNCTION_BEGIN(__context_save)
-	alloc loc0 = ar.pfs, 1, 49, 0, 0
-	mov loc1 = ar.unat ;;
-	mov loc3 = ar.rsc
-
-	.auto
-
-	/*
-	 * Flush dirty registers to backing store.
-	 * After this ar.bsp and ar.bspstore are equal.
-	 */
-	flushrs
-	mov loc4 = ar.bsp
-
-	/*
-	 * Put RSE to enforced lazy mode.
-	 * So that ar.rnat can be read.
-	 */
-	and loc5 = ~3, loc3
-	mov ar.rsc = loc5
-	mov loc5 = ar.rnat
-
-	.explicit
-
-	mov loc6 = ar.lc
-
-	add loc8 = __CONTEXT_OFFSET_AR_PFS, in0
-	add loc9 = __CONTEXT_OFFSET_AR_UNAT_CALLER, in0
-	add loc10 = __CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
-	add loc11 = __CONTEXT_OFFSET_AR_RSC, in0
-	add loc12 = __CONTEXT_OFFSET_BSP, in0
-	add loc13 = __CONTEXT_OFFSET_AR_RNAT, in0
-	add loc14 = __CONTEXT_OFFSET_AR_LC, in0
-
-	add loc15 = __CONTEXT_OFFSET_R1, in0
-	add loc16 = __CONTEXT_OFFSET_R4, in0
-	add loc17 = __CONTEXT_OFFSET_R5, in0
-	add loc18 = __CONTEXT_OFFSET_R6, in0
-	add loc19 = __CONTEXT_OFFSET_R7, in0
-	add loc20 = __CONTEXT_OFFSET_SP, in0
-	add loc21 = __CONTEXT_OFFSET_TP, in0
-
-	add loc22 = __CONTEXT_OFFSET_PC, in0
-	add loc23 = __CONTEXT_OFFSET_B1, in0
-	add loc24 = __CONTEXT_OFFSET_B2, in0
-	add loc25 = __CONTEXT_OFFSET_B3, in0
-	add loc26 = __CONTEXT_OFFSET_B4, in0
-	add loc27 = __CONTEXT_OFFSET_B5, in0
-
-	add loc28 = __CONTEXT_OFFSET_PR, in0
-
-	add loc29 = __CONTEXT_OFFSET_F2, in0
-	add loc30 = __CONTEXT_OFFSET_F3, in0
-	add loc31 = __CONTEXT_OFFSET_F4, in0
-	add loc32 = __CONTEXT_OFFSET_F5, in0
-
-	add loc33 = __CONTEXT_OFFSET_F16, in0
-	add loc34 = __CONTEXT_OFFSET_F17, in0
-	add loc35 = __CONTEXT_OFFSET_F18, in0
-	add loc36 = __CONTEXT_OFFSET_F19, in0
-	add loc37 = __CONTEXT_OFFSET_F20, in0
-	add loc38 = __CONTEXT_OFFSET_F21, in0
-	add loc39 = __CONTEXT_OFFSET_F22, in0
-	add loc40 = __CONTEXT_OFFSET_F23, in0
-	add loc41 = __CONTEXT_OFFSET_F24, in0
-	add loc42 = __CONTEXT_OFFSET_F25, in0
-	add loc43 = __CONTEXT_OFFSET_F26, in0
-	add loc44 = __CONTEXT_OFFSET_F27, in0
-	add loc45 = __CONTEXT_OFFSET_F28, in0
-	add loc46 = __CONTEXT_OFFSET_F29, in0
-	add loc47 = __CONTEXT_OFFSET_F30, in0
-	add loc48 = __CONTEXT_OFFSET_F31, in0 ;;
-
-	/*
-	 * Save general registers including NaT bits
-	 */
-	st8.spill [loc15] = r1 ;;
-	st8.spill [loc16] = r4 ;;
-	st8.spill [loc17] = r5 ;;
-	st8.spill [loc18] = r6 ;;
-	st8.spill [loc19] = r7 ;;
-	st8.spill [loc20] = r12	;;	/* save sp */
-	st8.spill [loc21] = r13 ;;	/* save tp */
-
-	mov loc2 = ar.unat
-
-	/*
-	 * Save application registers
-	 */
-	st8 [loc8] = loc0	/* save ar.pfs */
-	st8 [loc9] = loc1 ;;	/* save ar.unat (caller) */
-	st8 [loc10] = loc2	/* save ar.unat (callee) */
-	st8 [loc11] = loc3	/* save ar.rsc */
-	st8 [loc12] = loc4	/* save ar.bsp */
-	st8 [loc13] = loc5	/* save ar.rnat */
-	st8 [loc14] = loc6 ;;	/* save ar.lc */
-
-	/*
-	 * Save branch registers
-	 */
-	mov loc2 = b0
-	mov loc3 = b1
-	mov loc4 = b2
-	mov loc5 = b3
-	mov loc6 = b4
-	mov loc7 = b5 ;;
-	st8 [loc22] = loc2	/* save pc */
-	st8 [loc23] = loc3
-	st8 [loc24] = loc4
-	st8 [loc25] = loc5
-	st8 [loc26] = loc6
-	st8 [loc27] = loc7 ;;
-
-	/*
-	 * Save predicate registers
-	 */
-	mov loc2 = pr ;;
-	st8 [loc28] = loc2
-
-	/*
-	 * Save floating-point registers.
-	 */
-	stf.spill [loc29] = f2
-	stf.spill [loc30] = f3
-	stf.spill [loc31] = f4
-	stf.spill [loc32] = f5
-
-	stf.spill [loc33] = f16
-	stf.spill [loc34] = f17
-	stf.spill [loc35] = f18
-	stf.spill [loc36] = f19
-	stf.spill [loc37] = f20
-	stf.spill [loc38] = f21
-	stf.spill [loc39] = f22
-	stf.spill [loc40] = f23
-	stf.spill [loc41] = f24
-	stf.spill [loc42] = f25
-	stf.spill [loc43] = f26
-	stf.spill [loc44] = f27
-	stf.spill [loc45] = f28
-	stf.spill [loc46] = f29
-	stf.spill [loc47] = f30
-	stf.spill [loc48] = f31
-
-	mov ar.unat = loc1
-
-	mov r8 = 0 	/* __context_save returns 0 */
-	br.ret.sptk.many b0
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	alloc loc0 = ar.pfs, 2, 50, 0, 0 ;;
-
-	add loc9 = __CONTEXT_OFFSET_AR_PFS, in0
-	add loc10 = __CONTEXT_OFFSET_AR_UNAT_CALLER, in0
-	add loc11 = __CONTEXT_OFFSET_AR_UNAT_CALLEE, in0
-	add loc12 = __CONTEXT_OFFSET_AR_RSC, in0
-	add loc13 = __CONTEXT_OFFSET_BSP, in0
-	add loc14 = __CONTEXT_OFFSET_AR_RNAT, in0
-	add loc15 = __CONTEXT_OFFSET_AR_LC, in0
-
-	add loc16 = __CONTEXT_OFFSET_R1, in0
-	add loc17 = __CONTEXT_OFFSET_R4, in0
-	add loc18 = __CONTEXT_OFFSET_R5, in0
-	add loc19 = __CONTEXT_OFFSET_R6, in0
-	add loc20 = __CONTEXT_OFFSET_R7, in0
-	add loc21 = __CONTEXT_OFFSET_SP, in0
-	add loc22 = __CONTEXT_OFFSET_TP, in0
-
-	add loc23 = __CONTEXT_OFFSET_PC, in0
-	add loc24 = __CONTEXT_OFFSET_B1, in0
-	add loc25 = __CONTEXT_OFFSET_B2, in0
-	add loc26 = __CONTEXT_OFFSET_B3, in0
-	add loc27 = __CONTEXT_OFFSET_B4, in0
-	add loc28 = __CONTEXT_OFFSET_B5, in0
-
-	add loc29 = __CONTEXT_OFFSET_PR, in0
-
-	add loc30 = __CONTEXT_OFFSET_F2, in0
-	add loc31 = __CONTEXT_OFFSET_F3, in0
-	add loc32 = __CONTEXT_OFFSET_F4, in0
-	add loc33 = __CONTEXT_OFFSET_F5, in0
-
-	add loc34 = __CONTEXT_OFFSET_F16, in0
-	add loc35 = __CONTEXT_OFFSET_F17, in0
-	add loc36 = __CONTEXT_OFFSET_F18, in0
-	add loc37 = __CONTEXT_OFFSET_F19, in0
-	add loc38 = __CONTEXT_OFFSET_F20, in0
-	add loc39 = __CONTEXT_OFFSET_F21, in0
-	add loc40 = __CONTEXT_OFFSET_F22, in0
-	add loc41 = __CONTEXT_OFFSET_F23, in0
-	add loc42 = __CONTEXT_OFFSET_F24, in0
-	add loc43 = __CONTEXT_OFFSET_F25, in0
-	add loc44 = __CONTEXT_OFFSET_F26, in0
-	add loc45 = __CONTEXT_OFFSET_F27, in0
-	add loc46 = __CONTEXT_OFFSET_F28, in0
-	add loc47 = __CONTEXT_OFFSET_F29, in0
-	add loc48 = __CONTEXT_OFFSET_F30, in0
-	add loc49 = __CONTEXT_OFFSET_F31, in0 ;;
-
-	ld8 loc0 = [loc9]	/* load ar.pfs */
-	ld8 loc1 = [loc10]	/* load ar.unat (caller) */
-	ld8 loc2 = [loc11]	/* load ar.unat (callee) */
-	ld8 loc3 = [loc12]	/* load ar.rsc */
-	ld8 loc4 = [loc13]	/* load ar.bsp */
-	ld8 loc5 = [loc14]	/* load ar.rnat */
-	ld8 loc6 = [loc15]	/* load ar.lc */
-
-	.auto
-
-	/*
-	 * Invalidate the ALAT
-	 */
-	invala
-
-	/*
-	 * Put RSE to enforced lazy mode.
-	 * So that ar.bspstore and ar.rnat can be written.
-	 */
-	movl loc8 = ~3
-	and loc8 = loc3, loc8
-	mov ar.rsc = loc8
-
-	/*
-	 * Flush dirty registers to backing store.
-	 * We do this because we want the following move
-	 * to ar.bspstore to assign the same value to ar.bsp.
-	 */
-	flushrs
-
-	/*
-	 * Restore application registers
-	 */
-	mov ar.bspstore = loc4	/* rse.bspload = ar.bsp = ar.bspstore = loc4 */
-	mov ar.rnat = loc5
-	mov ar.pfs = loc0
-	mov ar.rsc = loc3
-
-	.explicit
-
-	mov ar.unat = loc2 ;;
-	mov ar.lc = loc6
-
-	/*
-	 * Restore general registers including NaT bits
-	 */
-	ld8.fill r1 = [loc16] ;;
-	ld8.fill r4 = [loc17] ;;
-	ld8.fill r5 = [loc18] ;;
-	ld8.fill r6 = [loc19] ;;
-	ld8.fill r7 = [loc20] ;;
-	ld8.fill r12 = [loc21] ;;	/* restore sp */
-	ld8.fill r13 = [loc22] ;;
-
-	/*
-	 * Restore branch registers
-	 */
-	ld8 loc2 = [loc23]		/* restore pc */
-	ld8 loc3 = [loc24]
-	ld8 loc4 = [loc25]
-	ld8 loc5 = [loc26]
-	ld8 loc6 = [loc27]
-	ld8 loc7 = [loc28] ;;
-	mov b0 = loc2
-	mov b1 = loc3
-	mov b2 = loc4
-	mov b3 = loc5
-	mov b4 = loc6
-	mov b5 = loc7 ;;
-
-	/*
-	 * Restore predicate registers
-	 */
-	ld8 loc2 = [loc29] ;;
-	mov pr = loc2, ~0
-
-	/*
-	 * Restore floating-point registers.
-	 */
-	ldf.fill f2 = [loc30]
-	ldf.fill f3 = [loc31]
-	ldf.fill f4 = [loc32]
-	ldf.fill f5 = [loc33]
-
-	ldf.fill f16 = [loc34]
-	ldf.fill f17 = [loc35]
-	ldf.fill f18 = [loc36]
-	ldf.fill f19 = [loc37]
-	ldf.fill f20 = [loc38]
-	ldf.fill f21 = [loc39]
-	ldf.fill f22 = [loc40]
-	ldf.fill f23 = [loc41]
-	ldf.fill f24 = [loc42]
-	ldf.fill f25 = [loc43]
-	ldf.fill f26 = [loc44]
-	ldf.fill f27 = [loc45]
-	ldf.fill f28 = [loc46]
-	ldf.fill f29 = [loc47]
-	ldf.fill f30 = [loc48]
-	ldf.fill f31 = [loc49]
-
-	mov ar.unat = loc1
-
-	mov r8 = in1			/* __context_restore returns second argument */
-	br.ret.sptk.many b0
-FUNCTION_END(__context_restore)
Index: pace/lib/c/arch/ia64/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/ia64/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/ia64/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,277 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-static void fill_fun_desc(uintptr_t *, uintptr_t, uintptr_t);
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with implicit addends.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-
-	DPRINTF("rel table address: 0x%zx, size: %zd\n", (uintptr_t)rt, rt_size);
-	/* Unused */
-	(void)m;
-	(void)rt;
-	(void)rt_size;
-}
-
-static uintptr_t get_module_gp(module_t *m)
-{
-#if 0
-	printf("get_module_gp: m=%p m->bias=%zu m->dyn.plt_got=%zu\n",
-	    m, m->bias, (uintptr_t) m->dyn.plt_got);
-#endif
-	return (uintptr_t) m->dyn.plt_got;
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with explicit addends.
- */
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	size_t r_addend;
-	elf_xword r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uintptr_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uintptr_t *r_ptr;
-	uintptr_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	rt_entries = rt_size / sizeof(elf_rela_t);
-	str_tab = m->dyn.str_tab;
-
-	DPRINTF("rel table address: 0x%zx, entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-		r_addend = rt[i].r_addend;
-
-		sym_idx = ELF64_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-#if 0
-		DPRINTF("r sym: name '%s', value 0x%zx, size 0x%zx, binding 0x%x\n",
-		    str_tab + sym->st_name,
-		    sym->st_value,
-		    sym->st_size,
-		    elf_st_bind(sym->st_info));
-#endif
-		rel_type = ELF64_R_TYPE(r_info);
-		r_ptr = (uintptr_t *)(r_offset + m->bias);
-
-		if (elf_st_bind(sym->st_info) == STB_LOCAL) {
-			sym_def = sym;
-			dest = m;
-			sym_addr = (uintptr_t)
-			    symbol_get_addr(sym_def, dest, NULL);
-			DPRINTF("Resolved local symbol, addr=0x%zx\n", sym_addr);
-		} else if (sym->st_name != 0) {
-			DPRINTF("rel_type: %x, rel_offset: 0x%zx\n", rel_type, r_offset);
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%zx\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-				DPRINTF("symbol definition found, value=0x%zx addr=0x%zx\n", sym_def->st_value, sym_addr);
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-
-			/*
-			 * DTPMOD with null st_name should return the index
-			 * of the current module.
-			 */
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_IA_64_DIR64LSB:
-			DPRINTF("fixup R_IA_DIR64LSB (S+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr,
-			    sym_addr + r_addend);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_IA_64_FPTR64LSB:
-			// FIXME ?????
-			DPRINTF("fixup R_IA_FPTR64LSB (@fptr(S+A))\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr,
-			    sym_addr + r_addend);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-		case R_IA_64_REL64LSB:
-			DPRINTF("fixup R_IA_REL64LSB (BD+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr,
-			    dest->bias + r_addend);
-			*r_ptr = dest->bias + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_IA_64_IPLTLSB:
-			DPRINTF("fixup R_IA_64_IPLTLSB\n");
-			DPRINTF("r_offset=0x%zx r_addend=0x%zx\n",
-			    r_offset, r_addend);
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-				printf("Warning: Mismatched symbol sizes.\n");
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			DPRINTF("symbol='%s'\n", str_tab + sym->st_name);
-			DPRINTF("sym_addr = 0x%zx\n", sym_addr);
-			DPRINTF("gp = 0x%zx\n", get_module_gp(dest));
-			DPRINTF("r_offset=0x%zx\n", r_offset);
-
-			/*
-			 * Initialize function descriptor entry with the
-			 * address of the function and the value of the
-			 * global pointer.
-			 */
-			fill_fun_desc(r_ptr, sym_addr, get_module_gp(dest));
-
-			DPRINTF("OK\n");
-			break;
-
-		case R_IA_64_DTPMOD64LSB:
-			DPRINTF("fixup R_IA_64_DTPMOD64LSB\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, (size_t)dest->id);
-			*r_ptr = dest->id;
-			DPRINTF("OK\n");
-			break;
-
-		case R_IA_64_DTPREL64LSB:
-			DPRINTF("fixup R_IA_64_DTPREL64LSB\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_def->st_value);
-			*r_ptr = sym_def->st_value;
-			DPRINTF("OK\n");
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-
-	}
-}
-
-static void fill_fun_desc(uintptr_t *fdesc, uintptr_t faddr, uintptr_t gp)
-{
-	fdesc[0] = faddr;
-	fdesc[1] = gp;
-}
-
-#include <rtld/rtld_arch.h>
-
-/** Get the adress of a function.
- *
- * On IA-64 we actually return the address of the function descriptor.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	void *fa;
-	uintptr_t *fdesc;
-
-#if 0
-	printf("func_get_addr: name='%s'\n", m->dyn.str_tab + sym->st_name);
-#endif
-	fa = symbol_get_addr(sym, m, __tcb_get());
-	if (fa == NULL)
-		return NULL;
-
-	fdesc = malloc(16);
-	if (fdesc == NULL)
-		return NULL;
-
-	fill_fun_desc(fdesc, (uintptr_t)fa, get_module_gp(m));
-#if 0
-	printf("-> fun_desc=%p\n", fdesc);
-#endif
-	return fdesc;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ia64/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64 ia64
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <errno.h>
-
-#include <stacktrace.h>
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	(void) fp;
-	return false;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	(void) st;
-	(void) fp;
-	(void) prev;
-	return ENOTSUP;
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	(void) st;
-	(void) fp;
-	(void) ra;
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ia64/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/ia64/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	br.ret.sptk.many b0
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-FUNCTION_BEGIN(stacktrace_pc_get)
-	mov r8 = r0
-	br.ret.sptk.many b0
-FUNCTION_END(stacktrace_fp_get)
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/ia64/src/syscall.S
===================================================================
--- uspace/lib/c/arch/ia64/src/syscall.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-/*
- * IA-64 Software Conventions and Runtime Architecture Guide mandates that
- * the zero-extended imm21 operand of the BREAK instruction is used as follows:
- *
- * MSB | Purpose
- * ----+--------
- * 000 | Reserved for architected software interrupts
- * 001 | Available for application use as software interrupts
- * 01x | Reserved for debugger breakpoints
- * 1xx | Reserved for definition by each ABI
- */
-#define SYSCALL_IMM	0x40000
-
-FUNCTION_BEGIN(__syscall)
-	alloc r14 = ar.pfs, 7, 0, 0, 0 ;;
-	break SYSCALL_IMM
-	mov ar.pfs = r14 ;;
-	br.ret.sptk.many b0
-FUNCTION_END(__syscall)
Index: pace/lib/c/arch/ia64/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/ia64/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL_BEGIN(__thread_entry)
-	alloc loc0 = ar.pfs, 0, 1, 1, 0
-
-	add r8 = -8, sp ;;
-	# Entry function argument
-	ld8 out0 = [r8], -8 ;;
-
-	# Entry function descriptor
-	ld8 r8 = [r8] ;;
-	# Entry function address
-	ld8 r9 = [r8], 8 ;;
-	# Entry function global pointer
-	ld8 gp = [r8] ;;
-
-	mov b1 = r9 ;;
-
-	br.call.sptk.many b0 = b1 ;;
-
-	#
-	# Not reached.
-	#
-
-SYMBOL_END(__thread_entry)
Index: pace/lib/c/arch/ia64/src/tls.c
===================================================================
--- uspace/lib/c/arch/ia64/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcia64 ia64
- * @brief ia64 architecture dependent parts of libc
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <tls.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_1(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_1(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-void *__tls_get_addr(tls_index *ti);
-
-void *__tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset);
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_mips32_CONFIG_H_
-#define _LIBC_mips32_CONFIG_H_
-
-#define PAGE_WIDTH  14
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/cp0.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/cp0.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/mips32/include/arch/cp0.h
Index: pace/lib/c/arch/mips32/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @ingroup libcmips32
- */
-
-#ifndef _LIBC_mips32_DDI_H_
-#define _LIBC_mips32_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
Index: pace/lib/c/arch/mips32/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_mips32_ELF_LINUX_H_
-#define _LIBC_mips32_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint32_t pad0[6];
-
-	uint32_t r0;
-	uint32_t r1;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t r11;
-	uint32_t r12;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-
-	uint32_t cp0_status;
-	uint32_t hi;
-	uint32_t lo;
-	uint32_t cp0_badvaddr;
-	uint32_t cp0_cause;
-	uint32_t cp0_epc;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->r1 = istate->at;
-	elf_regs->r2 = istate->v0;
-	elf_regs->r3 = istate->v1;
-	elf_regs->r4 = istate->a0;
-	elf_regs->r5 = istate->a1;
-	elf_regs->r6 = istate->a2;
-	elf_regs->r7 = istate->a3;
-	elf_regs->r8 = istate->t0;
-	elf_regs->r9 = istate->t1;
-	elf_regs->r10 = istate->t2;
-	elf_regs->r11 = istate->t3;
-	elf_regs->r12 = istate->t4;
-	elf_regs->r13 = istate->t5;
-	elf_regs->r14 = istate->t6;
-	elf_regs->r15 = istate->t7;
-	elf_regs->r16 = istate->s0;
-	elf_regs->r17 = istate->s1;
-	elf_regs->r18 = istate->s2;
-	elf_regs->r19 = istate->s3;
-	elf_regs->r20 = istate->s4;
-	elf_regs->r21 = istate->s5;
-	elf_regs->r22 = istate->s6;
-	elf_regs->r23 = istate->s7;
-	elf_regs->r24 = istate->t8;
-	elf_regs->r25 = istate->t9;
-	elf_regs->r26 = istate->kt0;
-	elf_regs->r27 = istate->kt1;
-	elf_regs->r28 = istate->gp;
-	elf_regs->r29 = istate->sp;
-	elf_regs->r30 = istate->s8;
-	elf_regs->r31 = istate->ra;
-
-	elf_regs->cp0_status = istate->status;
-	elf_regs->hi = istate->hi;
-	elf_regs->lo = istate->lo;
-	elf_regs->cp0_epc = istate->epc;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_mips32_FADDR_H_
-#define _LIBC_mips32_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-#ifndef _LIBC_mips32_FIBRIL_H_
-#define _LIBC_mips32_FIBRIL_H_
-
-#include <stdint.h>
-#include <libarch/fibril_context.h>
-#include <libarch/stack.h>
-#include <align.h>
-
-#define SP_DELTA  (ABI_STACK_FRAME + ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT))
-
-/*
- * We define our own context_set, because we need to set
- * the TLS pointer to the tcb + 0x7000
- *
- * See tls_set in thread.h
- */
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (sysarg_t) (_pc); \
-		(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP   0x00
-#define __CONTEXT_OFFSET_PC   0x04
-#define __CONTEXT_OFFSET_S0   0x08
-#define __CONTEXT_OFFSET_S1   0x0c
-#define __CONTEXT_OFFSET_S2   0x10
-#define __CONTEXT_OFFSET_S3   0x14
-#define __CONTEXT_OFFSET_S4   0x18
-#define __CONTEXT_OFFSET_S5   0x1c
-#define __CONTEXT_OFFSET_S6   0x20
-#define __CONTEXT_OFFSET_S7   0x24
-#define __CONTEXT_OFFSET_S8   0x28
-#define __CONTEXT_OFFSET_GP   0x2c
-#define __CONTEXT_OFFSET_TLS  0x30
-#define __CONTEXT_OFFSET_F20  0x34
-#define __CONTEXT_OFFSET_F21  0x38
-#define __CONTEXT_OFFSET_F22  0x3c
-#define __CONTEXT_OFFSET_F23  0x40
-#define __CONTEXT_OFFSET_F24  0x44
-#define __CONTEXT_OFFSET_F25  0x48
-#define __CONTEXT_OFFSET_F26  0x4c
-#define __CONTEXT_OFFSET_F27  0x50
-#define __CONTEXT_OFFSET_F28  0x54
-#define __CONTEXT_OFFSET_F29  0x58
-#define __CONTEXT_OFFSET_F30  0x5c
-#define __CONTEXT_SIZE        0x60
-
-#ifndef __ASSEMBLER__
-
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct __context {
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t s0;
-	uint32_t s1;
-	uint32_t s2;
-	uint32_t s3;
-	uint32_t s4;
-	uint32_t s5;
-	uint32_t s6;
-	uint32_t s7;
-	uint32_t s8;
-	uint32_t gp;
-	/* Thread local storage (k1) */
-	uint32_t tls;
-	uint32_t f20;
-	uint32_t f21;
-	uint32_t f22;
-	uint32_t f23;
-	uint32_t f24;
-	uint32_t f25;
-	uint32_t f26;
-	uint32_t f27;
-	uint32_t f28;
-	uint32_t f29;
-	uint32_t f30;
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/mips32/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/mips32/include/arch/istate.h
Index: pace/lib/c/arch/mips32/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/mips32/include/arch/istate_struct.h
Index: pace/lib/c/arch/mips32/include/libarch/regname.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/mips32/include/arch/asm/regname.h
Index: pace/lib/c/arch/mips32/include/libarch/stack.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_mips32_STACK_H_
-#define _LIBC_mips32_STACK_H_
-
-#define STACK_ITEM_SIZE  4
-#define STACK_ALIGNMENT  8
-#define ABI_STACK_FRAME  32
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_mips32_SYSCALL_H_
-#define _LIBC_mips32_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-#ifndef _LIBC_mips32_THREAD_H_
-#define _LIBC_mips32_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/mips32/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-/* TLS for MIPS is described in http://www.linux-mips.org/wiki/NPTL */
-
-#ifndef _LIBC_mips32_TLS_H_
-#define _LIBC_mips32_TLS_H_
-
-/*
- * FIXME: Note that the use of variant I contradicts the observations made in
- * the note below. Nevertheless the scheme we have used for allocating and
- * deallocatin TLS corresponds to TLS variant I.
- */
-#define CONFIG_TLS_VARIANT_1
-
-#include <libc.h>
-
-/*
- * I did not find any specification (neither MIPS nor PowerPC), but
- * as I found it
- * - it uses Variant II
- * - TCB is at Address(First TLS Block)+0x7000.
- * - DTV is at Address(First TLS Block)+0x8000
- * - What would happen if the TLS data was larger then 0x7000?
- * - The linker never accesses DTV directly, has the second definition any
- *   sense?
- * We will make it this way:
- * - TCB is at TP-0x7000-sizeof(tcb)
- * - No assumption about DTV etc., but it will not have a fixed address
- */
-#define ARCH_TP_OFFSET (0x7000 + sizeof(tcb_t))
-
-typedef struct {
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	/* Move tls to K1 */
-	asm volatile ("add $27, %0, $0" :: "r" (tls));
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("add %0, $27, $0" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/meson.build
===================================================================
--- uspace/lib/c/arch/mips32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/syscall.c',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/mips32/src/crt0.S
===================================================================
--- uspace/lib/c/arch/mips32/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/stack.h>
-
-.text
-
-.set noreorder
-.option pic2
-
-## User-space task entry point
-#
-# $a0 ($4) contains the PCB pointer
-#
-FUNCTION_BEGIN(__start)
-	.ent __start
-	.frame $sp, ABI_STACK_FRAME, $ra
-	.cpload $t9
-
-	# Allocate the stack frame.
-	addiu $sp, -ABI_STACK_FRAME
-
-	# Allow PIC code
-	.cprestore 16
-
-	# Pass pcb_ptr to __c_start() as the first argument. It is already
-	# in $a0. As the first argument is passed in $a0, no operation
-	# is needed.
-
-	jal __c_start
-	nop
-
-	#
-	# Not reached.
-	#
-	addiu $sp, ABI_STACK_FRAME
-	.end __start
-FUNCTION_END(__start)
Index: pace/lib/c/arch/mips32/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/mips32/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/stack.h>
-
-.text
-.section .text
-.set noreorder
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# $a0 (=$4) contains entry_point
-# $a1 (=$5) contains pcb
-#
-# Jump to program entry point
-FUNCTION_BEGIN(entry_point_jmp)
-	# tmp := entry_point
-	move $t9, $a0
-
-	# Pass pcb to the entry point in $a0
-	move $a0, $a1
-
-	jr $t9
-	addiu $sp, -ABI_STACK_FRAME
-	addiu $sp, ABI_STACK_FRAME
-FUNCTION_END(entry_point_jmp)
Index: pace/lib/c/arch/mips32/src/fibril.S
===================================================================
--- uspace/lib/c/arch/mips32/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-#
-# Copyright (c) 2003-2004 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-.set noat
-.set noreorder
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-FUNCTION_BEGIN(__context_save)
-	sw $s0, __CONTEXT_OFFSET_S0($a0)
-	sw $s1, __CONTEXT_OFFSET_S1($a0)
-	sw $s2, __CONTEXT_OFFSET_S2($a0)
-	sw $s3, __CONTEXT_OFFSET_S3($a0)
-	sw $s4, __CONTEXT_OFFSET_S4($a0)
-	sw $s5, __CONTEXT_OFFSET_S5($a0)
-	sw $s6, __CONTEXT_OFFSET_S6($a0)
-	sw $s7, __CONTEXT_OFFSET_S7($a0)
-	sw $s8, __CONTEXT_OFFSET_S8($a0)
-	sw $gp, __CONTEXT_OFFSET_GP($a0)
-
-	sw $k1, __CONTEXT_OFFSET_TLS($a0)
-
-#ifdef CONFIG_FPU
-	mfc1 $t0, $20
-	sw $t0, __CONTEXT_OFFSET_F20($a0)
-
-	mfc1 $t0, $21
-	sw $t0, __CONTEXT_OFFSET_F21($a0)
-
-	mfc1 $t0, $22
-	sw $t0, __CONTEXT_OFFSET_F22($a0)
-
-	mfc1 $t0, $23
-	sw $t0, __CONTEXT_OFFSET_F23($a0)
-
-	mfc1 $t0, $24
-	sw $t0, __CONTEXT_OFFSET_F24($a0)
-
-	mfc1 $t0, $25
-	sw $t0, __CONTEXT_OFFSET_F25($a0)
-
-	mfc1 $t0, $26
-	sw $t0, __CONTEXT_OFFSET_F26($a0)
-
-	mfc1 $t0, $27
-	sw $t0, __CONTEXT_OFFSET_F27($a0)
-
-	mfc1 $t0, $28
-	sw $t0, __CONTEXT_OFFSET_F28($a0)
-
-	mfc1 $t0, $29
-	sw $t0, __CONTEXT_OFFSET_F29($a0)
-
-	mfc1 $t0, $30
-	sw $t0, __CONTEXT_OFFSET_F30($a0)
-#endif /* CONFIG_FPU */
-
-	sw $ra, __CONTEXT_OFFSET_PC($a0)
-	sw $sp, __CONTEXT_OFFSET_SP($a0)
-
-	# __context_save returns 0
-	j $ra
-	li $v0, 0
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	lw $s0, __CONTEXT_OFFSET_S0($a0)
-	lw $s1, __CONTEXT_OFFSET_S1($a0)
-	lw $s2, __CONTEXT_OFFSET_S2($a0)
-	lw $s3, __CONTEXT_OFFSET_S3($a0)
-	lw $s4, __CONTEXT_OFFSET_S4($a0)
-	lw $s5, __CONTEXT_OFFSET_S5($a0)
-	lw $s6, __CONTEXT_OFFSET_S6($a0)
-	lw $s7, __CONTEXT_OFFSET_S7($a0)
-	lw $s8, __CONTEXT_OFFSET_S8($a0)
-	lw $gp, __CONTEXT_OFFSET_GP($a0)
-	lw $k1, __CONTEXT_OFFSET_TLS($a0)
-
-#ifdef CONFIG_FPU
-	lw $t0, __CONTEXT_OFFSET_F20($a0)
-	mtc1 $t0, $20
-
-	lw $t0, __CONTEXT_OFFSET_F21($a0)
-	mtc1 $t0, $21
-
-	lw $t0, __CONTEXT_OFFSET_F22($a0)
-	mtc1 $t0, $22
-
-	lw $t0, __CONTEXT_OFFSET_F23($a0)
-	mtc1 $t0, $23
-
-	lw $t0, __CONTEXT_OFFSET_F24($a0)
-	mtc1 $t0, $24
-
-	lw $t0, __CONTEXT_OFFSET_F25($a0)
-	mtc1 $t0, $25
-
-	lw $t0, __CONTEXT_OFFSET_F26($a0)
-	mtc1 $t0, $26
-
-	lw $t0, __CONTEXT_OFFSET_F27($a0)
-	mtc1 $t0, $27
-
-	lw $t0, __CONTEXT_OFFSET_F28($a0)
-	mtc1 $t0, $28
-
-	lw $t0, __CONTEXT_OFFSET_F29($a0)
-	mtc1 $t0, $29
-
-	lw $t0, __CONTEXT_OFFSET_F30($a0)
-	mtc1 $t0, $30
-#endif /* CONFIG_FPU */
-
-	lw $ra, __CONTEXT_OFFSET_PC($a0)
-	lw $sp, __CONTEXT_OFFSET_SP($a0)
-
-	# Just for the jump into first function,
-	# but one instruction should not bother us
-	move $t9, $ra
-
-	# __context_restore returns second argument
-	j $ra
-	move $v0, $a1
-FUNCTION_END(__context_restore)
Index: pace/lib/c/arch/mips32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/mips32/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32 mips32
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <errno.h>
-
-#include <stacktrace.h>
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	(void) fp;
-	return false;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	(void) st;
-	(void) fp;
-	(void) prev;
-	return ENOTSUP;
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	(void) st;
-	(void) fp;
-	(void) ra;
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/mips32/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.set noat
-.set noreorder
-
-FUNCTION_BEGIN(stacktrace_prepare)
-FUNCTION_BEGIN(stacktrace_fp_get)
-FUNCTION_BEGIN(stacktrace_pc_get)
-	j $ra
-	xor $v0, $v0
-FUNCTION_END(stacktrace_prepare)
-FUNCTION_END(stacktrace_fp_get)
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/mips32/src/syscall.c
===================================================================
--- uspace/lib/c/arch/mips32/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-#include <libc.h>
-
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
-    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
-{
-	register sysarg_t __mips_reg_a0 asm("$4") = p1;
-	register sysarg_t __mips_reg_a1 asm("$5") = p2;
-	register sysarg_t __mips_reg_a2 asm("$6") = p3;
-	register sysarg_t __mips_reg_a3 asm("$7") = p4;
-	register sysarg_t __mips_reg_t0 asm("$8") = p5;
-	register sysarg_t __mips_reg_t1 asm("$9") = p6;
-	register sysarg_t __mips_reg_v0 asm("$2") = id;
-
-	asm volatile (
-	    "syscall\n"
-	    : "=r" (__mips_reg_v0)
-	    : "r" (__mips_reg_a0),
-	      "r" (__mips_reg_a1),
-	      "r" (__mips_reg_a2),
-	      "r" (__mips_reg_a3),
-	      "r" (__mips_reg_t0),
-	      "r" (__mips_reg_t1),
-	      "r" (__mips_reg_v0)
-	    :
-	      /*
-	       * We are a function call, although C
-	       * does not know it.
-	       */
-	      "%ra",
-	      /*
-	       * Clobber memory too as some arguments might be
-	       * actually pointers.
-	       */
-	      "memory"
-	);
-
-	return __mips_reg_v0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/mips32/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/mips32/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/stack.h>
-
-.text
-
-.set noat
-.set noreorder
-.option pic2
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL(__thread_entry)
-	# All registers should be zero, including $fp and $ra.
-	# Instead of setting up a stack frame here, we leave it for __thread_main.
-
-	# Function argument.
-	lw $a0, -4($sp)
-	# Function pointer.
-	lw $t0, -8($sp)
-
-	j $t0
-	nop
Index: pace/lib/c/arch/mips32/src/tls.c
===================================================================
--- uspace/lib/c/arch/mips32/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcmips32
- * @{
- */
-/** @file
- * @ingroup libcmips32
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_1(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_1(tcb, size, align);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_CONFIG_H_
-#define _LIBC_ppc32_CONFIG_H_
-
-#define PAGE_WIDTH	12
-#define PAGE_SIZE	(1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @ingroup libcppc32
- */
-
-#ifndef _LIBC_ppc32_DDI_H_
-#define _LIBC_ppc32_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
Index: pace/lib/c/arch/ppc32/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file Definitions needed to write core files in Linux-ELF format.
- */
-
-#ifndef _LIBC_ppc32_ELF_LINUX_H_
-#define _LIBC_ppc32_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-/** Linux kernel struct pt_regs structure.
- *
- * We need this to save register state to a core file in Linux format
- * (readable by GDB configured for Linux target).
- */
-typedef struct {
-	uint32_t r0;
-	uint32_t r1;
-	uint32_t r2;
-	uint32_t r3;
-	uint32_t r4;
-	uint32_t r5;
-	uint32_t r6;
-	uint32_t r7;
-	uint32_t r8;
-	uint32_t r9;
-	uint32_t r10;
-	uint32_t r11;
-	uint32_t r12;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-
-	uint32_t nip;
-	uint32_t msr;
-	uint32_t old_r3;
-	uint32_t ctr;
-	uint32_t link;
-	uint32_t xer;
-	uint32_t ccr;
-	uint32_t mq;
-	uint32_t trap;
-	uint32_t dar;
-	uint32_t dsisr;
-	uint32_t result;
-} elf_regs_t;
-
-/** Convert istate_t to elf_regs_t. */
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	elf_regs->r0 = istate->r0;
-	elf_regs->r1 = istate->sp;
-	elf_regs->r2 = istate->r2;
-	elf_regs->r3 = istate->r3;
-	elf_regs->r4 = istate->r4;
-	elf_regs->r5 = istate->r5;
-	elf_regs->r6 = istate->r6;
-	elf_regs->r7 = istate->r7;
-	elf_regs->r8 = istate->r8;
-	elf_regs->r9 = istate->r9;
-	elf_regs->r10 = istate->r10;
-	elf_regs->r11 = istate->r11;
-	elf_regs->r12 = istate->r12;
-	elf_regs->r13 = istate->r13;
-	elf_regs->r14 = istate->r14;
-	elf_regs->r15 = istate->r15;
-	elf_regs->r16 = istate->r16;
-	elf_regs->r17 = istate->r17;
-	elf_regs->r18 = istate->r18;
-	elf_regs->r19 = istate->r19;
-	elf_regs->r20 = istate->r20;
-	elf_regs->r21 = istate->r21;
-	elf_regs->r22 = istate->r22;
-	elf_regs->r23 = istate->r23;
-	elf_regs->r24 = istate->r24;
-	elf_regs->r25 = istate->r25;
-	elf_regs->r26 = istate->r26;
-	elf_regs->r27 = istate->r27;
-	elf_regs->r28 = istate->r28;
-	elf_regs->r29 = istate->r29;
-	elf_regs->r30 = istate->r30;
-	elf_regs->r31 = istate->r31;
-
-	elf_regs->ctr = istate->ctr;
-	elf_regs->link = istate->lr;
-	elf_regs->xer = istate->xer;
-	elf_regs->ccr = istate->cr;
-	elf_regs->dar = istate->dar;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_FADDR_H_
-#define _LIBC_ppc32_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)		((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_FIBRIL_H_
-#define _LIBC_ppc32_FIBRIL_H_
-
-#include <stdint.h>
-#include <libarch/fibril_context.h>
-
-#define SP_DELTA  16
-
-/*
- * We define our own context_set, because we need to set
- * the TLS pointer to the tcb + 0x7000
- *
- * See tls_set in thread.h
- */
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = (sysarg_t) (_pc); \
-		(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
-		(c)->tls = ((sysarg_t) (ptls)) + 0x7000 + sizeof(tcb_t); \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP   0x00
-#define __CONTEXT_OFFSET_PC   0x04
-#define __CONTEXT_OFFSET_TLS  0x08
-#define __CONTEXT_OFFSET_R13  0x0c
-#define __CONTEXT_OFFSET_R14  0x10
-#define __CONTEXT_OFFSET_R15  0x14
-#define __CONTEXT_OFFSET_R16  0x18
-#define __CONTEXT_OFFSET_R17  0x1c
-#define __CONTEXT_OFFSET_R18  0x20
-#define __CONTEXT_OFFSET_R19  0x24
-#define __CONTEXT_OFFSET_R20  0x28
-#define __CONTEXT_OFFSET_R21  0x2c
-#define __CONTEXT_OFFSET_R22  0x30
-#define __CONTEXT_OFFSET_R23  0x34
-#define __CONTEXT_OFFSET_R24  0x38
-#define __CONTEXT_OFFSET_R25  0x3c
-#define __CONTEXT_OFFSET_R26  0x40
-#define __CONTEXT_OFFSET_R27  0x44
-#define __CONTEXT_OFFSET_R28  0x48
-#define __CONTEXT_OFFSET_R29  0x4c
-#define __CONTEXT_OFFSET_R30  0x50
-#define __CONTEXT_OFFSET_R31  0x54
-#define __CONTEXT_OFFSET_CR   0x58
-#define __CONTEXT_SIZE        0x5c
-
-#ifndef __ASSEMBLER__
-
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct __context {
-	uint32_t sp;
-	uint32_t pc;
-	uint32_t tls;
-	uint32_t r13;
-	uint32_t r14;
-	uint32_t r15;
-	uint32_t r16;
-	uint32_t r17;
-	uint32_t r18;
-	uint32_t r19;
-	uint32_t r20;
-	uint32_t r21;
-	uint32_t r22;
-	uint32_t r23;
-	uint32_t r24;
-	uint32_t r25;
-	uint32_t r26;
-	uint32_t r27;
-	uint32_t r28;
-	uint32_t r29;
-	uint32_t r30;
-	uint32_t r31;
-	uint32_t cr;
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/ppc32/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ppc32/include/arch/istate.h
Index: pace/lib/c/arch/ppc32/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ppc32/include/arch/istate_struct.h
Index: pace/lib/c/arch/ppc32/include/libarch/msr.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/msr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/ppc32/include/arch/msr.h
Index: pace/lib/c/arch/ppc32/include/libarch/regname.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/regname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_REGNAME_H_
-#define _LIBC_ppc32_REGNAME_H_
-
-/* Condition Register Bit Fields */
-#define	cr0	0
-#define	cr1	1
-#define	cr2	2
-#define	cr3	3
-#define	cr4	4
-#define	cr5	5
-#define	cr6	6
-#define	cr7	7
-
-/* General Purpose Registers (GPRs) */
-#define	r0	0
-#define	r1	1
-#define	r2	2
-#define	r3	3
-#define	r4	4
-#define	r5	5
-#define	r6	6
-#define	r7	7
-#define	r8	8
-#define	r9	9
-#define	r10	10
-#define	r11	11
-#define	r12	12
-#define	r13	13
-#define	r14	14
-#define	r15	15
-#define	r16	16
-#define	r17	17
-#define	r18	18
-#define	r19	19
-#define	r20	20
-#define	r21	21
-#define	r22	22
-#define	r23	23
-#define	r24	24
-#define	r25	25
-#define	r26	26
-#define	r27	27
-#define	r28	28
-#define	r29	29
-#define	r30	30
-#define	r31	31
-
-/* GPR Aliases */
-#define	sp	1
-
-/* Floating Point Registers (FPRs) */
-#define	fr0		0
-#define	fr1		1
-#define	fr2		2
-#define	fr3		3
-#define	fr4		4
-#define	fr5		5
-#define	fr6		6
-#define	fr7		7
-#define	fr8		8
-#define	fr9		9
-#define	fr10	10
-#define	fr11	11
-#define	fr12	12
-#define	fr13	13
-#define	fr14	14
-#define	fr15	15
-#define	fr16	16
-#define	fr17	17
-#define	fr18	18
-#define	fr19	19
-#define	fr20	20
-#define	fr21	21
-#define	fr22	22
-#define	fr23	23
-#define	fr24	24
-#define	fr25	25
-#define	fr26	26
-#define	fr27	27
-#define	fr28	28
-#define	fr29	29
-#define	fr30	30
-#define	fr31	31
-
-#define	vr0		0
-#define	vr1		1
-#define	vr2		2
-#define	vr3		3
-#define	vr4		4
-#define	vr5		5
-#define	vr6		6
-#define	vr7		7
-#define	vr8		8
-#define	vr9		9
-#define	vr10	10
-#define	vr11	11
-#define	vr12	12
-#define	vr13	13
-#define	vr14	14
-#define	vr15	15
-#define	vr16	16
-#define	vr17	17
-#define	vr18	18
-#define	vr19	19
-#define	vr20	20
-#define	vr21	21
-#define	vr22	22
-#define	vr23	23
-#define	vr24	24
-#define	vr25	25
-#define	vr26	26
-#define	vr27	27
-#define	vr28	28
-#define	vr29	29
-#define	vr30	30
-#define	vr31	31
-
-#define	evr0	0
-#define	evr1	1
-#define	evr2	2
-#define	evr3	3
-#define	evr4	4
-#define	evr5	5
-#define	evr6	6
-#define	evr7	7
-#define	evr8	8
-#define	evr9	9
-#define	evr10	10
-#define	evr11	11
-#define	evr12	12
-#define	evr13	13
-#define	evr14	14
-#define	evr15	15
-#define	evr16	16
-#define	evr17	17
-#define	evr18	18
-#define	evr19	19
-#define	evr20	20
-#define	evr21	21
-#define	evr22	22
-#define	evr23	23
-#define	evr24	24
-#define	evr25	25
-#define	evr26	26
-#define	evr27	27
-#define	evr28	28
-#define	evr29	29
-#define	evr30	30
-#define	evr31	31
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_RTLD_DYNAMIC_H_
-#define _LIBC_ppc32_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_RTLD_ELF_DYN_H_
-#define _LIBC_ppc32_RTLD_ELF_DYN_H_
-
-/*
- * ppc32 dynamic relocation types
- */
-
-#define R_PPC_ADDR32   1
-#define R_PPC_REL24    10
-#define R_PPC_COPY     19
-#define R_PPC_JMP_SLOT 21
-#define R_PPC_RELATIVE 22
-
-#define R_PPC_DTPMOD32 68
-#define R_PPC_DTPREL32 78
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_RTLD_MODULE_H_
-#define _LIBC_ppc32_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags */
-#define RTLD_MODULE_LDF 0
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/stackarg.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/stackarg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STACKARG_H_
-#define _LIBC_STACKARG_H_
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_ppc32_SYSCALL_H_
-#define _LIBC_ppc32_SYSCALL_H_
-
-#define LIBARCH_SYSCALL_GENERIC
-
-#include <syscall.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_THREAD_H_
-#define _LIBC_ppc32_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size - sizeof(void *), 16);
-
-	sp[0] = 0;
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/ppc32/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ppc32_TLS_H_
-#define _LIBC_ppc32_TLS_H_
-
-#define CONFIG_TLS_VARIANT_1
-
-#include <libc.h>
-
-#define ARCH_TP_OFFSET (0x7000 + sizeof(tcb_t))
-
-typedef struct {
-	void **dtv;
-	void *pad;
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	asm volatile ("mr %%r2, %0\n" :: "r" (tls));
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("mr %0, %%r2\n" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/meson.build
===================================================================
--- uspace/lib/c/arch/ppc32/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/syscall.c',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/ppc32/src/crt0.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# r6 contains the PCB pointer
-#
-SYMBOL(_start)
-	#
-	# Create the first stack frame.
-	#
-	li %r3, 0
-	stw %r3, 0(%r1)
-	stwu %r1, -16(%r1)
-
-	# Pass the PCB pointer to __c_start() as the first argument.
-	# The first argument is passed in r3.
-	mr %r3, %r6
-	bl __c_start
Index: pace/lib/c/arch/ppc32/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# %r3	contains entry_point
-# %r4	contains pcb
-#
-# Jump to program entry point
-FUNCTION_BEGIN(entry_point_jmp)
-	mtctr %r3
-	mr %r6, %r4	# Pass pcb to the entry point in %r6
-	bctr
-FUNCTION_END(entry_point_jmp)
Index: pace/lib/c/arch/ppc32/src/fibril.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-#include <abi/asmtool.h>
-#include <libarch/regname.h>
-#include <libarch/fibril_context.h>
-
-FUNCTION_BEGIN(__context_save)
-	stw sp, __CONTEXT_OFFSET_SP(r3)
-	stw r2, __CONTEXT_OFFSET_TLS(r3)
-	stw r13, __CONTEXT_OFFSET_R13(r3)
-	stw r14, __CONTEXT_OFFSET_R14(r3)
-	stw r15, __CONTEXT_OFFSET_R15(r3)
-	stw r16, __CONTEXT_OFFSET_R16(r3)
-	stw r17, __CONTEXT_OFFSET_R17(r3)
-	stw r18, __CONTEXT_OFFSET_R18(r3)
-	stw r19, __CONTEXT_OFFSET_R19(r3)
-	stw r20, __CONTEXT_OFFSET_R20(r3)
-	stw r21, __CONTEXT_OFFSET_R21(r3)
-	stw r22, __CONTEXT_OFFSET_R22(r3)
-	stw r23, __CONTEXT_OFFSET_R23(r3)
-	stw r24, __CONTEXT_OFFSET_R24(r3)
-	stw r25, __CONTEXT_OFFSET_R25(r3)
-	stw r26, __CONTEXT_OFFSET_R26(r3)
-	stw r27, __CONTEXT_OFFSET_R27(r3)
-	stw r28, __CONTEXT_OFFSET_R28(r3)
-	stw r29, __CONTEXT_OFFSET_R29(r3)
-	stw r30, __CONTEXT_OFFSET_R30(r3)
-	stw r31, __CONTEXT_OFFSET_R31(r3)
-
-	mflr r4
-	stw r4, __CONTEXT_OFFSET_PC(r3)
-
-	mfcr r4
-	stw r4, __CONTEXT_OFFSET_CR(r3)
-
-	# __context_save returns 0
-	li r3, 0
-	blr
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	lwz sp, __CONTEXT_OFFSET_SP(r3)
-	lwz r2, __CONTEXT_OFFSET_TLS(r3)
-	lwz r13, __CONTEXT_OFFSET_R13(r3)
-	lwz r14, __CONTEXT_OFFSET_R14(r3)
-	lwz r15, __CONTEXT_OFFSET_R15(r3)
-	lwz r16, __CONTEXT_OFFSET_R16(r3)
-	lwz r17, __CONTEXT_OFFSET_R17(r3)
-	lwz r18, __CONTEXT_OFFSET_R18(r3)
-	lwz r19, __CONTEXT_OFFSET_R19(r3)
-	lwz r20, __CONTEXT_OFFSET_R20(r3)
-	lwz r21, __CONTEXT_OFFSET_R21(r3)
-	lwz r22, __CONTEXT_OFFSET_R22(r3)
-	lwz r23, __CONTEXT_OFFSET_R23(r3)
-	lwz r24, __CONTEXT_OFFSET_R24(r3)
-	lwz r25, __CONTEXT_OFFSET_R25(r3)
-	lwz r26, __CONTEXT_OFFSET_R26(r3)
-	lwz r27, __CONTEXT_OFFSET_R27(r3)
-	lwz r28, __CONTEXT_OFFSET_R28(r3)
-	lwz r29, __CONTEXT_OFFSET_R29(r3)
-	lwz r30, __CONTEXT_OFFSET_R30(r3)
-	lwz r31, __CONTEXT_OFFSET_R31(r3)
-
-	lwz r5, __CONTEXT_OFFSET_CR(r3)
-	mtcr r5
-
-	lwz r5, __CONTEXT_OFFSET_PC(r3)
-	mtlr r5
-
-	# __context_restore returns second argument
-	mr r3, r4
-	blr
-FUNCTION_END(__context_restore)
Index: pace/lib/c/arch/ppc32/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,432 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <bitops.h>
-#include <smc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-static void plt_farcall_init(uint32_t *plt, uint32_t *);
-static void plt_entry_init(uint32_t *, uint32_t *, uint32_t *, uintptr_t);
-static uint32_t *plt_entry_ptr(uint32_t *, size_t);
-static size_t plt_entry_index(size_t);
-static uint16_t addr_ha(uint32_t);
-static uint16_t addr_l(uint32_t);
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-	/* Unused */
-	(void)m;
-	(void)rt;
-	(void)rt_size;
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with explicit addends.
- */
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	size_t r_addend;
-	elf_xword r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uintptr_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uintptr_t *r_ptr;
-	uintptr_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-	uint32_t *plt;
-	uint32_t *plt_datawords;
-	size_t jmp_slots;
-
-	DPRINTF("Count jump slots.\n");
-
-	rt_entries = rt_size / sizeof(elf_rela_t);
-
-	jmp_slots = 0;
-	for (i = 0; i < rt_entries; ++i) {
-		r_info = rt[i].r_info;
-		rel_type = ELF32_R_TYPE(r_info);
-
-		if (rel_type == R_PPC_JMP_SLOT)
-			++jmp_slots;
-	}
-
-	DPRINTF("Init farcall section\n");
-
-	plt = (uint32_t *)m->dyn.plt_got;
-
-	/* Table with addresses starts just after last PLT entry */
-	plt_datawords = plt_entry_ptr(plt, jmp_slots);
-
-	/* Init farcall section with reference to datawords table */
-	plt_farcall_init(plt, plt_datawords);
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	str_tab = m->dyn.str_tab;
-
-	DPRINTF("rel table address: 0x%zx, entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-		r_addend = rt[i].r_addend;
-
-		sym_idx = ELF32_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-
-#if 0
-		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
-		    str_tab + sym->st_name,
-		    sym->st_value,
-		    sym->st_size);
-#endif
-		rel_type = ELF32_R_TYPE(r_info);
-		r_ptr = (uintptr_t *)(r_offset + m->bias);
-
-		if (sym->st_name != 0) {
-			DPRINTF("rel_type: %x, rel_offset: 0x%zx\n", rel_type, r_offset);
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%zx\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-				DPRINTF("symbol definition found, value=0x%zx addr=0x%zx\n", sym_def->st_value, sym_addr);
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-
-			/*
-			 * DTPMOD with null st_name should return the index
-			 * of the current module.
-			 */
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_PPC_ADDR32:
-			DPRINTF("fixup R_PPC_ADDR32 (S+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-		case R_PPC_REL24:
-			DPRINTF("fixup R_PPC_REL24 ((S+A-P) >> 2)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr,
-			    (sym_addr + r_addend - (uintptr_t)r_ptr) >> 2);
-			*r_ptr = (sym_addr + r_addend - (uintptr_t)r_ptr) >> 2;
-			DPRINTF("OK\n");
-			break;
-		case R_PPC_COPY:
-			/*
-			 * Copy symbol data from shared object to specified
-			 * location. Need to find the 'source', i.e. the
-			 * other instance of the object than the one in the
-			 * executable program.
-			 */
-			DPRINTF("fixup R_PPC_COPY (s)\n");
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-#if 0
-				printf("Warning: Mismatched symbol sizes.\n");
-#endif
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			memcpy(r_ptr, (const void *)sym_addr, sym_size);
-			DPRINTF("OK\n");
-			break;
-
-		case R_PPC_JMP_SLOT:
-			DPRINTF("fixup R_PPC_JMP_SLOT (S)\n");
-			DPRINTF("r_offset=0x%zx r_addend=0x%zx\n",
-			    r_offset, r_addend);
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			DPRINTF("sym_addr = 0x%zx\n", sym_addr);
-			DPRINTF("r_offset=0x%zx\n", r_offset);
-
-			/*
-			 * Fill PLT entry with jump to symbol address.
-			 */
-			plt_entry_init(plt, (uint32_t *)r_ptr, plt_datawords,
-			    sym_addr);
-
-			DPRINTF("OK\n");
-			break;
-
-		case R_PPC_RELATIVE:
-			DPRINTF("fixup R_PPC_RELATIVE (B+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, m->bias + r_addend);
-			*r_ptr = m->bias + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_PPC_DTPMOD32:
-			DPRINTF("fixup R_PPC_DTPMOD32\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, (size_t)dest->id);
-			*r_ptr = dest->id;
-			DPRINTF("OK\n");
-			break;
-
-		case R_PPC_DTPREL32:
-			DPRINTF("fixup R_PPC_DTPREL32\n"); /* XXXXX */
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_def->st_value);
-			*r_ptr = sym_def->st_value + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-
-	}
-}
-
-/** Init PLT farcall section. */
-static void plt_farcall_init(uint32_t *plt, uint32_t *plt_datawords)
-{
-	uint16_t hi;
-	uint16_t lo;
-	int i;
-
-	hi = addr_ha((uintptr_t)plt_datawords);
-	lo = addr_l((uintptr_t)plt_datawords);
-
-	plt[0] = 0x3d6b0000 | hi; /* addis %r11,% r11,. plt_datawords@ha */
-	plt[1] = 0x816b0000 | lo; /* lwz %r11, .plt_datawords@l(%r11) */
-	plt[2] = 0x7d6903a6;      /* mtctr %r11 */
-	plt[3] = 0x4e800420;      /* bctr */
-	plt[4] = 0x60000000;      /* nop */
-	plt[5] = 0x60000000;      /* nop */
-
-	smc_coherence(plt, 4 * 6);
-
-	for (i = 0; i < 6; i++)
-		DPRINTF("%p: farcall[%d] = %08zx\n", &plt[i], i, plt[i]);
-}
-
-/** Fill in PLT entry.
- *
- * Fill a PLT entry with PowerPC instructions to set table index and
- * jump to the farcall section. Fill table entry with target address.
- *
- * @param plt Pointer to PLT
- * @param plte Pointer to PLT entry to fill in
- * @param datawords Address table
- * @param ta Target address of the jump
- */
-static void plt_entry_init(uint32_t *plt, uint32_t *plte, uint32_t *datawords,
-    uintptr_t ta)
-{
-	size_t index;
-	size_t woffset;
-	uint16_t i4index;
-	uint32_t btgt;
-
-	DPRINTF("plt_entry_init(plt=%p, plte=%p, datawords=%p, ta=0z%zx\n",
-	    plt, plte, datawords, ta);
-
-	/* Entry offset in words */
-	woffset = plte - plt;
-
-	/* Entry index */
-	index = plt_entry_index(woffset);
-
-	/* This only works for the first 2048 entries */
-	assert(index * 4 < 0x8000);
-	i4index = 4 * index;
-
-	/* Relative branch offset */
-	btgt = ((uint8_t *)plt - (uint8_t *)&plte[1]) & 0x03ffffff;
-
-	/* Write target address to table */
-	datawords[index] = ta;
-	DPRINTF("%p: datawords[%zu] = %08x\n", &datawords[index], index, ta);
-
-	plte[0] = 0x39600000 | i4index; /* li %r11, 4 * index */
-	plte[1] = 0x48000000 | btgt;    /* b .plt_farcall */
-
-	DPRINTF("%p: plte[0] = %08zx\n", &plte[0], plte[0]);
-	DPRINTF("%p: plte[1] = %08zx\n", &plte[1], plte[1]);
-
-	smc_coherence(plte, 4 * 2);
-}
-
-/** Determine PLT entry address.
- *
- * @param plt Start of PLT
- * @param index PLT entry index
- * @return Pointer to PLT entry
- */
-static uint32_t *plt_entry_ptr(uint32_t *plt, size_t index)
-{
-	if (index < 8192)
-		return plt + 18 + 2 * index;
-	else
-		return plt + 18 + 2 * 8192 + 4 * (index - 8192);
-}
-
-/** Determine index of PLT entry from its word offset.
- *
- * @param woffset Offset of PLT entry in words
- * @return PLT entry index
- */
-static size_t plt_entry_index(size_t woffset)
-{
-	assert(woffset >= 18);
-	woffset -= 18;
-
-	if (woffset < 2 * 8192) {
-		assert((woffset & 0x1) == 0);
-		return woffset / 2;
-	} else {
-		assert((woffset & 0x3) == 0);
-		return (woffset - 2 * 8192) / 4;
-	}
-}
-
-/** Determine high bits of address.
- *
- * The lower bits are determined by @c addr_l function. The lower bits
- * are considered to be a 16-bit signed integer.
- *
- * @param addr Address
- * @return Higher bits of address
- */
-static uint16_t addr_ha(uint32_t addr)
-{
-	int32_t la;
-
-	/* The lower part of the address is a signed 16-bit integer */
-	la = (int16_t)(addr & 0xffff);
-
-	/* Compute higher bits while compensating for the sign extension */
-	return (addr - la) >> 16;
-}
-
-/** Determine lower bits of address.
- *
- * The lower bits are considered to be 16-bit signed integer/immediate
- * operand by the ISA, but we return them here as unsigned unmber so
- * it can be easily incorporated into an instruction opcode.
- *
- * @param addr Address
- * @return Lower bits of address cast as unsigned 16-bit integer
- */
-static uint16_t addr_l(uint32_t addr)
-{
-	return (uint16_t) (addr & 0x0000ffff);
-}
-
-/** Get the adress of a function.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	return symbol_get_addr(sym, m, __tcb_get());
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32 ppc32
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include <stacktrace.h>
-
-#define FRAME_OFFSET_FP_PREV	0
-#define FRAME_OFFSET_RA		4
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	return fp != 0;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, prev);
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-.text
-
-#include <abi/asmtool.h>
-#include <libarch/regname.h>
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	blr
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	mr r3, sp
-	blr
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	mflr r3
-	blr
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/ppc32/src/syscall.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32 ppc32
- * @brief ppc32 architecture dependent parts of libc
- * @ingroup lc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
-    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
-{
-	register sysarg_t __ppc32_reg_r3 asm("3") = p1;
-	register sysarg_t __ppc32_reg_r4 asm("4") = p2;
-	register sysarg_t __ppc32_reg_r5 asm("5") = p3;
-	register sysarg_t __ppc32_reg_r6 asm("6") = p4;
-	register sysarg_t __ppc32_reg_r7 asm("7") = p5;
-	register sysarg_t __ppc32_reg_r8 asm("8") = p6;
-	register sysarg_t __ppc32_reg_r9 asm("9") = id;
-
-	asm volatile (
-	    "sc\n"
-	    : "=r" (__ppc32_reg_r3)
-	    : "r" (__ppc32_reg_r3),
-	      "r" (__ppc32_reg_r4),
-	      "r" (__ppc32_reg_r5),
-	      "r" (__ppc32_reg_r6),
-	      "r" (__ppc32_reg_r7),
-	      "r" (__ppc32_reg_r8),
-	      "r" (__ppc32_reg_r9)
-	    :
-	      /*
-	       * Clobber memory too as some arguments might be
-	       * actually pointers.
-	       */
-	      "memory"
-	);
-
-	return __ppc32_reg_r3;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/ppc32/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/ppc32/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL(__thread_entry)
-	# Load function and argument.
-	lwz %r3, -4(%r1)
-	lwz %r4, -8(%r1)
-
-	# Clear LR
-	li %r0, 0
-	mtlr %r0
-
-	mtctr %r4
-	bctr
Index: pace/lib/c/arch/ppc32/src/tls.c
===================================================================
--- uspace/lib/c/arch/ppc32/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcppc32
- * @{
- */
-/** @file
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_1(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_1(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-int __tls_debug = 0;
-
-void *__tls_get_addr(tls_index *ti);
-
-void *__tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset) + 0x8000;
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset + 0x8000;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcamd64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_CONFIG_H_
-#define _LIBC_riscv64_CONFIG_H_
-
-#define PAGE_WIDTH  12
-#define PAGE_SIZE   (1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#ifndef _LIBC_riscv64_DDI_H_
-#define _LIBC_riscv64_DDI_H_
-
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	return *port;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	return *port;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	return *port;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	return *port;
-}
-
-#endif
Index: pace/lib/c/arch/riscv64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_ELF_LINUX_H_
-#define _LIBC_riscv64_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-
-typedef struct {
-} elf_regs_t;
-
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	(void) istate;
-	(void) elf_regs;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_FADDR_H_
-#define _LIBC_riscv64_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)  ((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_FIBRIL_H_
-#define _LIBC_riscv64_FIBRIL_H_
-
-#include <stdint.h>
-#include <libarch/fibril_context.h>
-
-#define SP_DELTA  0
-
-#define context_set(ctx, _pc, stack, size, ptls) \
-	do { \
-		(ctx)->pc = (uintptr_t) (_pc); \
-		(ctx)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \
-		(ctx)->x4 = ((uintptr_t) (ptls)) + sizeof(tcb_t); \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	// FIXME: No frame pointer in the standard ABI.
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP   0x00
-#define __CONTEXT_OFFSET_PC   0x08
-#define __CONTEXT_OFFSET_ZERO 0x10
-#define __CONTEXT_OFFSET_RA   0x18
-#define __CONTEXT_OFFSET_X3   0x20
-#define __CONTEXT_OFFSET_X4   0x28
-#define __CONTEXT_OFFSET_X5   0x30
-#define __CONTEXT_OFFSET_X6   0x38
-#define __CONTEXT_OFFSET_X7   0x40
-#define __CONTEXT_OFFSET_X8   0x48
-#define __CONTEXT_OFFSET_X9   0x50
-#define __CONTEXT_OFFSET_X10  0x58
-#define __CONTEXT_OFFSET_X11  0x60
-#define __CONTEXT_OFFSET_X12  0x68
-#define __CONTEXT_OFFSET_X13  0x70
-#define __CONTEXT_OFFSET_X14  0x78
-#define __CONTEXT_OFFSET_X15  0x80
-#define __CONTEXT_OFFSET_X16  0x88
-#define __CONTEXT_OFFSET_X17  0x90
-#define __CONTEXT_OFFSET_X18  0x98
-#define __CONTEXT_OFFSET_X19  0xa0
-#define __CONTEXT_OFFSET_X20  0xa8
-#define __CONTEXT_OFFSET_X21  0xb0
-#define __CONTEXT_OFFSET_X22  0xb8
-#define __CONTEXT_OFFSET_X23  0xc0
-#define __CONTEXT_OFFSET_X24  0xc8
-#define __CONTEXT_OFFSET_X25  0xd0
-#define __CONTEXT_OFFSET_X26  0xd8
-#define __CONTEXT_OFFSET_X27  0xe0
-#define __CONTEXT_OFFSET_X28  0xe8
-#define __CONTEXT_OFFSET_X29  0xf0
-#define __CONTEXT_OFFSET_X30  0xf8
-#define __CONTEXT_OFFSET_X31  0x100
-#define __CONTEXT_SIZE        0x108
-
-#ifndef __ASSEMBLER__
-
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * There is a room for optimization (we can store just those
- * registers that must be preserved during ABI function call).
- */
-
-typedef struct __context {
-	uint64_t sp;
-	uint64_t pc;
-	uint64_t zero;
-	uint64_t ra;
-	uint64_t x3;
-	uint64_t x4;
-	uint64_t x5;
-	uint64_t x6;
-	uint64_t x7;
-	uint64_t x8;
-	uint64_t x9;
-	uint64_t x10;
-	uint64_t x11;
-	uint64_t x12;
-	uint64_t x13;
-	uint64_t x14;
-	uint64_t x15;
-	uint64_t x16;
-	uint64_t x17;
-	uint64_t x18;
-	uint64_t x19;
-	uint64_t x20;
-	uint64_t x21;
-	uint64_t x22;
-	uint64_t x23;
-	uint64_t x24;
-	uint64_t x25;
-	uint64_t x26;
-	uint64_t x27;
-	uint64_t x28;
-	uint64_t x29;
-	uint64_t x30;
-	uint64_t x31;
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/riscv64/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/riscv64/include/arch/istate.h
Index: pace/lib/c/arch/riscv64/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/riscv64/include/arch/istate_struct.h
Index: pace/lib/c/arch/riscv64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_riscv64_SYSCALL_H_
-#define _LIBC_riscv64_SYSCALL_H_
-
-#include <stdint.h>
-#include <abi/syscall.h>
-#include <types/common.h>
-
-#define __syscall0  __syscall
-#define __syscall1  __syscall
-#define __syscall2  __syscall
-#define __syscall3  __syscall
-#define __syscall4  __syscall
-#define __syscall5  __syscall
-#define __syscall6  __syscall
-
-extern sysarg_t __syscall(const sysarg_t, const sysarg_t, const sysarg_t,
-    const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_THREAD_H_
-#define _LIBC_riscv64_THREAD_H_
-
-#include <align.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size, 16);
-
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return (uintptr_t) sp;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/riscv64/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcriscv64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_riscv64_TLS_H_
-#define _LIBC_riscv64_TLS_H_
-
-#define CONFIG_TLS_VARIANT_2
-
-#include <libc.h>
-
-/* Some architectures store the value with an offset. Some do not. */
-#define ARCH_TP_OFFSET 0
-
-typedef struct {
-	void *self;
-	void *fibril_data;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tls)
-{
-	// TODO
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	// TODO
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/meson.build
===================================================================
--- uspace/lib/c/arch/riscv64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.c',
-	'src/thread_entry.c',
-	'src/fibril.c',
-	'src/tls.c',
-	'src/syscall.c',
-	'src/stacktrace.c',
-)
-
-arch_start_src = files('src/crt0.c')
Index: pace/lib/c/arch/riscv64/src/crt0.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/crt0.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-extern void _start(void);
-extern void __c_start(void *);
-
-// FIXME: Implement properly.
-
-void _start(void)
-{
-	__c_start(0);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/src/entryjmp.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/entryjmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stdbool.h>
-#include <entry_point.h>
-
-/** Jump to program entry point. */
-void entry_point_jmp(void *entry_point, void *pcb)
-{
-	while (true)
-		;
-}
-
-/**
- * @}
- */
Index: pace/lib/c/arch/riscv64/src/fibril.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/fibril.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <setjmp.h>
-#include <stdbool.h>
-
-int __context_save(__context_t *ctx)
-{
-	return 0;
-}
-
-void __context_restore(__context_t *ctx, int ret)
-{
-	while (true)
-		;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <stacktrace.h>
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	return true;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	return 0;
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return 0;
-}
-
-void stacktrace_prepare(void)
-{
-}
-
-uintptr_t stacktrace_fp_get(void)
-{
-	return 0;
-}
-
-uintptr_t stacktrace_pc_get(void)
-{
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/src/syscall.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/syscall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <libarch/syscall.h>
-
-sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
-    const sysarg_t p3, const sysarg_t p4, const sysarg_t p5, const sysarg_t p6,
-    const syscall_t id)
-{
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/src/thread_entry.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/thread_entry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <types/common.h>
-#include "../../../generic/private/thread.h"
-
-void __thread_entry(void)
-{
-	// TODO
-	while (true)
-		;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/riscv64/src/tls.c
===================================================================
--- uspace/lib/c/arch/riscv64/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_2(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_2(tcb, size, align);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/config.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_CONFIG_H_
-#define _LIBC_sparc64_CONFIG_H_
-
-#if defined (SUN4U)
-#define PAGE_WIDTH	14
-#elif defined(SUN4V)
-#define PAGE_WIDTH	13
-#endif
-
-#define PAGE_SIZE	(1 << PAGE_WIDTH)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/ddi.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @ingroup libsparc64
- */
-
-#ifndef _LIBC_sparc64_DDI_H_
-#define _LIBC_sparc64_DDI_H_
-
-#include <barrier.h>
-#include <ddi.h>
-
-static inline void arch_pio_write_8(ioport8_t *port, uint8_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-static inline void arch_pio_write_16(ioport16_t *port, uint16_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-static inline void arch_pio_write_32(ioport32_t *port, uint32_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
-{
-	*port = v;
-	memory_barrier();
-}
-
-static inline uint8_t arch_pio_read_8(const ioport8_t *port)
-{
-	uint8_t rv;
-
-	rv = *port;
-	memory_barrier();
-
-	return rv;
-}
-
-static inline uint16_t arch_pio_read_16(const ioport16_t *port)
-{
-	uint16_t rv;
-
-	rv = *port;
-	memory_barrier();
-
-	return rv;
-}
-
-static inline uint32_t arch_pio_read_32(const ioport32_t *port)
-{
-	uint32_t rv;
-
-	rv = *port;
-	memory_barrier();
-
-	return rv;
-}
-
-static inline uint64_t arch_pio_read_64(const ioport64_t *port)
-{
-	uint64_t rv;
-
-	rv = *port;
-	memory_barrier();
-
-	return rv;
-}
-
-#endif
Index: pace/lib/c/arch/sparc64/include/libarch/elf_linux.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_ELF_LINUX_H_
-#define _LIBC_sparc64_ELF_LINUX_H_
-
-#include <libarch/istate.h>
-#include <stdint.h>
-
-typedef struct {
-	/* TODO */
-	uint64_t pad[16];
-} elf_regs_t;
-
-static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs)
-{
-	/* TODO */
-	(void) istate;
-	(void) elf_regs;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/faddr.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/faddr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2005 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_FADDR_H_
-#define _LIBC_sparc64_FADDR_H_
-
-#include <types/common.h>
-
-#define FADDR(fptr)		((uintptr_t) (fptr))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/fibril.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_FIBRIL_H_
-#define _LIBC_sparc64_FIBRIL_H_
-
-#include <libarch/stack.h>
-#include <libarch/fibril_context.h>
-#include <stdint.h>
-#include <align.h>
-
-#define SP_DELTA  (STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE)
-
-#define context_set(c, _pc, stack, size, ptls) \
-	do { \
-		(c)->pc = ((uintptr_t) _pc) - 8; \
-		(c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \
-		    STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \
-		(c)->fp = -STACK_BIAS; \
-		(c)->tp = (uint64_t) ptls; \
-	} while (0)
-
-static inline uintptr_t _context_get_fp(context_t *ctx)
-{
-	return ctx->sp + STACK_BIAS;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/fibril_context.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/fibril_context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2014 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_ARCH_FIBRIL_CONTEXT_H_
-#define _LIBC_ARCH_FIBRIL_CONTEXT_H_
-
-#define __CONTEXT_OFFSET_SP  0x00
-#define __CONTEXT_OFFSET_PC  0x08
-#define __CONTEXT_OFFSET_I0  0x10
-#define __CONTEXT_OFFSET_I1  0x18
-#define __CONTEXT_OFFSET_I2  0x20
-#define __CONTEXT_OFFSET_I3  0x28
-#define __CONTEXT_OFFSET_I4  0x30
-#define __CONTEXT_OFFSET_I5  0x38
-#define __CONTEXT_OFFSET_FP  0x40
-#define __CONTEXT_OFFSET_I7  0x48
-#define __CONTEXT_OFFSET_L0  0x50
-#define __CONTEXT_OFFSET_L1  0x58
-#define __CONTEXT_OFFSET_L2  0x60
-#define __CONTEXT_OFFSET_L3  0x68
-#define __CONTEXT_OFFSET_L4  0x70
-#define __CONTEXT_OFFSET_L5  0x78
-#define __CONTEXT_OFFSET_L6  0x80
-#define __CONTEXT_OFFSET_L7  0x88
-#define __CONTEXT_OFFSET_TP  0x90
-#define __CONTEXT_SIZE       0x98
-
-#ifndef __ASSEMBLER__
-
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct __context {
-	uintptr_t sp;  // %o6
-	uintptr_t pc;  // %o7
-	uint64_t i0;
-	uint64_t i1;
-	uint64_t i2;
-	uint64_t i3;
-	uint64_t i4;
-	uint64_t i5;
-	uintptr_t fp;  // %i6
-	uintptr_t i7;
-	uint64_t l0;
-	uint64_t l1;
-	uint64_t l2;
-	uint64_t l3;
-	uint64_t l4;
-	uint64_t l5;
-	uint64_t l6;
-	uint64_t l7;
-	uint64_t tp;  // %g7
-} __context_t;
-
-#endif
-#endif
Index: pace/lib/c/arch/sparc64/include/libarch/istate.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/istate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/sparc64/include/arch/istate.h
Index: pace/lib/c/arch/sparc64/include/libarch/istate_struct.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/istate_struct.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/sparc64/include/arch/istate_struct.h
Index: pace/lib/c/arch/sparc64/include/libarch/regdef.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/regdef.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../../../../kernel/arch/sparc64/include/arch/regdef.h
Index: pace/lib/c/arch/sparc64/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_RTLD_DYNAMIC_H_
-#define _LIBC_sparc64_RTLD_DYNAMIC_H_
-
-typedef struct {
-	/* Empty. */
-} dyn_info_arch_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-/** @file sparc64 dynamic relocation types
- */
-
-#ifndef _LIBC_sparc64_RTLD_ELF_DYN_H_
-#define _LIBC_sparc64_RTLD_ELF_DYN_H_
-
-#define R_SPARC_COPY		19
-#define R_SPARC_GLOB_DAT	20
-#define R_SPARC_JMP_SLOT	21
-#define R_SPARC_RELATIVE	22
-#define R_SPARC_64		32
-#define R_SPARC_TLS_DTPMOD64	75
-#define R_SPARC_TLS_DTPOFF64	77
-#define R_SPARC_TLS_TPOFF64	79
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_RTLD_MODULE_H_
-#define _LIBC_sparc64_RTLD_MODULE_H_
-
-#include <elf/elf_mod.h>
-
-/** ELF module load flags */
-#define RTLD_MODULE_LDF 0
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/stack.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_STACK_H_
-#define _LIBC_sparc64_STACK_H_
-
-#define STACK_ITEM_SIZE			8
-
-/** According to SPARC Compliance Definition, every stack frame is 16-byte aligned. */
-#define STACK_ALIGNMENT			16
-
-/**
- * 16-extended-word save area for %i[0-7] and %l[0-7] registers.
- */
-#define STACK_WINDOW_SAVE_AREA_SIZE	(16 * STACK_ITEM_SIZE)
-
-/*
- * Six extended words for first six arguments.
- */
-#define STACK_ARG_SAVE_AREA_SIZE		(6 * STACK_ITEM_SIZE)
-
-/**
- * By convention, the actual top of the stack is %sp + STACK_BIAS.
- */
-#define STACK_BIAS            2047
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/stackarg.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/stackarg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_STACKARG_H_
-#define _LIBC_sparc64_STACKARG_H_
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/syscall.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_sparc64_SYSCALL_H_
-#define _LIBC_sparc64_SYSCALL_H_
-
-#include <stdint.h>
-#include <abi/syscall.h>
-#include <types/common.h>
-
-#define __syscall0	__syscall
-#define __syscall1	__syscall
-#define __syscall2	__syscall
-#define __syscall3	__syscall
-#define __syscall4	__syscall
-#define __syscall5	__syscall
-#define __syscall6	__syscall
-
-static inline sysarg_t
-__syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3,
-    const sysarg_t p4, const sysarg_t p5, const sysarg_t p6, const syscall_t id)
-{
-	register uint64_t a1 asm("o0") = p1;
-	register uint64_t a2 asm("o1") = p2;
-	register uint64_t a3 asm("o2") = p3;
-	register uint64_t a4 asm("o3") = p4;
-	register uint64_t a5 asm("o4") = p5;
-	register uint64_t a6 asm("o5") = p6;
-
-	asm volatile (
-	    "ta %7\n"
-	    : "=r" (a1)
-	    : "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6),
-	      "i" (id)
-	    : "memory"
-	);
-
-	return a1;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/thread.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-
-#ifndef _LIBC_sparc64_THREAD_H_
-#define _LIBC_sparc64_THREAD_H_
-
-#include <assert.h>
-#include <align.h>
-#include <libarch/stack.h>
-
-static inline uintptr_t arch_thread_prepare(void *stack, size_t stack_size,
-    void (*main)(void *), void *arg)
-{
-	/* We must leave space above the stack pointer for initial register spill area. */
-	uintptr_t *sp = (uintptr_t *) ALIGN_DOWN((uintptr_t) stack + stack_size - STACK_WINDOW_SAVE_AREA_SIZE - STACK_ARG_SAVE_AREA_SIZE, 16);
-
-	sp[-1] = (uintptr_t) arg;
-	sp[-2] = (uintptr_t) main;
-
-	return ((uintptr_t) sp) - STACK_BIAS;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/sparc64/include/libarch/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @{
- */
-/**
- * @file
- * @brief	sparc64 TLS functions.
- */
-
-#ifndef _LIBC_sparc64_TLS_H_
-#define _LIBC_sparc64_TLS_H_
-
-#define CONFIG_TLS_VARIANT_2
-
-#define ARCH_TP_OFFSET 0
-
-typedef struct {
-	void *self;
-	void *fibril_data;
-	void **dtv;
-	void *pad;
-} tcb_t;
-
-static inline void __tcb_raw_set(void *tcb)
-{
-	asm volatile ("mov %0, %%g7\n" : : "r" (tcb) : "g7");
-}
-
-static inline void *__tcb_raw_get(void)
-{
-	void *retval;
-	asm volatile ("mov %%g7, %0\n" : "=r" (retval));
-	return retval;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/meson.build
===================================================================
--- uspace/lib/c/arch/sparc64/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
-
-arch_src += files(
-	'src/entryjmp.S',
-	'src/thread_entry.S',
-	'src/fibril.S',
-	'src/tls.c',
-	'src/stacktrace.c',
-	'src/stacktrace_asm.S',
-	'src/rtld/dynamic.c',
-	'src/rtld/reloc.c',
-)
-
-arch_start_src = files('src/crt0.S')
Index: pace/lib/c/arch/sparc64/src/crt0.S
===================================================================
--- uspace/lib/c/arch/sparc64/src/crt0.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-.org 0
-
-## User-space task entry point
-#
-# %o0 contains uarg
-# %o1 contains pcb_ptr
-#
-SYMBOL(_start)
-	#
-	# Create the first stack frame.
-	#
-	save %sp, -176, %sp
-	flushw
-	add %g0, -0x7ff, %fp
-
-	# Pass pcb_ptr as the first argument to __c_start()
-	call __c_start
-	mov %i1, %o0
Index: pace/lib/c/arch/sparc64/src/entryjmp.S
===================================================================
--- uspace/lib/c/arch/sparc64/src/entryjmp.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2008 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-## void entry_point_jmp(void *entry_point, void *pcb);
-#
-# %o0	contains entry_point
-# %o1	contains pcb
-#
-# Jump to program entry point
-SYMBOL(entry_point_jmp)
-	# Pass pcb pointer to entry point in %o1. As it is already
-	# there, no action is needed.
-	call %o0
-	nop
-	# fixme: use branch instead of call
Index: pace/lib/c/arch/sparc64/src/fibril.S
===================================================================
--- uspace/lib/c/arch/sparc64/src/fibril.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-# Copyright (c) 2005 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/fibril_context.h>
-
-.text
-
-FUNCTION_BEGIN(__context_save)
-	#
-	# We rely on the kernel to flush our active register windows to memory
-	# should a thread switch occur.
-	#
-	stx %sp, [%o0 + __CONTEXT_OFFSET_SP]
-	stx %o7, [%o0 + __CONTEXT_OFFSET_PC]
-	stx %i0, [%o0 + __CONTEXT_OFFSET_I0]
-	stx %i1, [%o0 + __CONTEXT_OFFSET_I1]
-	stx %i2, [%o0 + __CONTEXT_OFFSET_I2]
-	stx %i3, [%o0 + __CONTEXT_OFFSET_I3]
-	stx %i4, [%o0 + __CONTEXT_OFFSET_I4]
-	stx %i5, [%o0 + __CONTEXT_OFFSET_I5]
-	stx %fp, [%o0 + __CONTEXT_OFFSET_FP]
-	stx %i7, [%o0 + __CONTEXT_OFFSET_I7]
-	stx %l0, [%o0 + __CONTEXT_OFFSET_L0]
-	stx %l1, [%o0 + __CONTEXT_OFFSET_L1]
-	stx %l2, [%o0 + __CONTEXT_OFFSET_L2]
-	stx %l3, [%o0 + __CONTEXT_OFFSET_L3]
-	stx %l4, [%o0 + __CONTEXT_OFFSET_L4]
-	stx %l5, [%o0 + __CONTEXT_OFFSET_L5]
-	stx %l6, [%o0 + __CONTEXT_OFFSET_L6]
-	stx %l7, [%o0 + __CONTEXT_OFFSET_L7]
-	stx %g7, [%o0 + __CONTEXT_OFFSET_TP]
-	retl
-	mov 0, %o0		! __context_save returns 0
-FUNCTION_END(__context_save)
-
-FUNCTION_BEGIN(__context_restore)
-	#
-	# Flush all active windows.
-	# This is essential, because CONTEXT_RESTORE_ARCH_CORE overwrites %sp of
-	# CWP - 1 with the value written to %fp of CWP.  Flushing all active
-	# windows mitigates this problem as CWP - 1 becomes the overlap window.
-	#
-	flushw
-
-	ldx [%o0 + __CONTEXT_OFFSET_SP], %sp
-	ldx [%o0 + __CONTEXT_OFFSET_PC], %o7
-	ldx [%o0 + __CONTEXT_OFFSET_I0], %i0
-	ldx [%o0 + __CONTEXT_OFFSET_I1], %i1
-	ldx [%o0 + __CONTEXT_OFFSET_I2], %i2
-	ldx [%o0 + __CONTEXT_OFFSET_I3], %i3
-	ldx [%o0 + __CONTEXT_OFFSET_I4], %i4
-	ldx [%o0 + __CONTEXT_OFFSET_I5], %i5
-	ldx [%o0 + __CONTEXT_OFFSET_FP], %fp
-	ldx [%o0 + __CONTEXT_OFFSET_I7], %i7
-	ldx [%o0 + __CONTEXT_OFFSET_L0], %l0
-	ldx [%o0 + __CONTEXT_OFFSET_L1], %l1
-	ldx [%o0 + __CONTEXT_OFFSET_L2], %l2
-	ldx [%o0 + __CONTEXT_OFFSET_L3], %l3
-	ldx [%o0 + __CONTEXT_OFFSET_L4], %l4
-	ldx [%o0 + __CONTEXT_OFFSET_L5], %l5
-	ldx [%o0 + __CONTEXT_OFFSET_L6], %l6
-	ldx [%o0 + __CONTEXT_OFFSET_L7], %l7
-	ldx [%o0 + __CONTEXT_OFFSET_TP], %g7
-	retl
-	mov %o1, %o0	! __context_restore returns second argument
-FUNCTION_END(__context_restore)
Index: pace/lib/c/arch/sparc64/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/sparc64/src/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
-{
-	(void) dp;
-	(void) bias;
-	(void) info;
-}
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/sparc64/src/rtld/reloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <bitops.h>
-#include <mem.h>
-#include <smc.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <libarch/rtld/elf_dyn.h>
-#include <rtld/symbol.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/rtld_arch.h>
-
-static void fill_plt_entry_generic(uint32_t *, uintptr_t);
-
-void module_process_pre_arch(module_t *m)
-{
-	/* Unused */
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with implicit addends.
- */
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
-{
-
-	DPRINTF("rel table address: 0x%zx, size: %zd\n", (uintptr_t)rt, rt_size);
-	/* Unused */
-	(void)m;
-	(void)rt;
-	(void)rt_size;
-}
-
-/**
- * Process (fixup) all relocations in a relocation table with explicit addends.
- */
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
-{
-	unsigned i;
-
-	size_t rt_entries;
-	size_t r_offset;
-	size_t r_addend;
-	elf_xword r_info;
-	unsigned rel_type;
-	elf_word sym_idx;
-	uintptr_t sym_addr;
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *sym;
-	uintptr_t *r_ptr;
-	uintptr_t sym_size;
-	char *str_tab;
-
-	elf_symbol_t *sym_def;
-	module_t *dest;
-	uint32_t *plt;
-
-	DPRINTF("parse relocation table\n");
-
-	sym_table = m->dyn.sym_tab;
-	rt_entries = rt_size / sizeof(elf_rela_t);
-	str_tab = m->dyn.str_tab;
-
-	plt = (uint32_t *)m->dyn.plt_got;
-
-	DPRINTF("rel table address: 0x%zx, entries: %zd\n", (uintptr_t)rt, rt_entries);
-
-	for (i = 0; i < rt_entries; ++i) {
-#if 0
-		DPRINTF("symbol %d: ", i);
-#endif
-		r_offset = rt[i].r_offset;
-		r_info = rt[i].r_info;
-		r_addend = rt[i].r_addend;
-
-		sym_idx = ELF64_R_SYM(r_info);
-		sym = &sym_table[sym_idx];
-
-#if 0
-		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
-		    str_tab + sym->st_name,
-		    sym->st_value,
-		    sym->st_size);
-#endif
-		rel_type = ELF64_R_TYPE(r_info);
-		r_ptr = (uintptr_t *)(r_offset + m->bias);
-
-		if (sym->st_name != 0) {
-			DPRINTF("rel_type: %x, rel_offset: 0x%zx\n", rel_type, r_offset);
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_none, &dest);
-			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
-			DPRINTF("dest bias: 0x%zx\n", dest->bias);
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-				DPRINTF("symbol definition found, value=0x%zx addr=0x%zx\n", sym_def->st_value, sym_addr);
-			} else {
-				printf("Definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-		} else {
-			sym_addr = 0;
-			sym_def = NULL;
-
-			/*
-			 * DTPMOD with null st_name should return the index
-			 * of the current module.
-			 */
-			dest = m;
-		}
-
-		switch (rel_type) {
-		case R_SPARC_COPY:
-			/*
-			 * Copy symbol data from shared object to specified
-			 * location. Need to find the 'source', i.e. the
-			 * other instance of the object than the one in the
-			 * executable program.
-			 */
-			DPRINTF("fixup R_SPARC_COPY (s)\n");
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			sym_size = sym->st_size;
-			if (sym_size != sym_def->st_size) {
-				printf("Warning: Mismatched symbol sizes.\n");
-				/* Take the lower value. */
-				if (sym_size > sym_def->st_size)
-					sym_size = sym_def->st_size;
-			}
-
-			memcpy(r_ptr, (const void *)sym_addr, sym_size);
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_GLOB_DAT:
-			DPRINTF("fixup R_SPARC_GLOB_DAT (S+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_JMP_SLOT:
-			DPRINTF("fixup R_SPARC_JMP_SLOT (S)\n");
-			DPRINTF("r_offset=0x%zx r_addend=0x%zx\n",
-			    r_offset, r_addend);
-
-			sym_def = symbol_def_find(str_tab + sym->st_name,
-			    m, ssf_noexec, &dest);
-
-			if (sym_def) {
-				sym_addr = (uintptr_t)
-				    symbol_get_addr(sym_def, dest, NULL);
-			} else {
-				printf("Source definition of '%s' not found.\n",
-				    str_tab + sym->st_name);
-				continue;
-			}
-
-			DPRINTF("sym_addr = 0x%zx\n", sym_addr);
-			DPRINTF("r_offset=0x%zx\n", r_offset);
-
-			/*
-			 * Fill PLT entry with jump to symbol address.
-			 * r_ptr points to the PLT entry, sym_addr contains
-			 * address of the symbol.
-			 *
-			 * XXX This only works for the first 32768 entries.
-			 * If there are more, the layout is more complex.
-			 */
-			assert((uint32_t *)r_ptr - plt < 32768 * 8);
-			fill_plt_entry_generic((uint32_t *)r_ptr, sym_addr);
-			smc_coherence(r_ptr, 32);
-
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_RELATIVE:
-			DPRINTF("fixup R_SPARC_RELATIVE (B+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, m->bias + r_addend);
-			*r_ptr = m->bias + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_64:
-			DPRINTF("fixup R_SPARC_64 (S+A)\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_addr);
-			*r_ptr = sym_addr + r_addend;
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_TLS_DTPMOD64:
-			DPRINTF("fixup R_SPARC_TLS_DTPMOD64\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, (size_t)dest->id);
-			*r_ptr = dest->id;
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_TLS_DTPOFF64:
-			DPRINTF("fixup R_SPARC_TLS_DTPOFF64\n");
-			DPRINTF("*0x%zx = 0x%zx\n", (uintptr_t)r_ptr, sym_def->st_value);
-			*r_ptr = sym_def->st_value;
-			DPRINTF("OK\n");
-			break;
-
-		case R_SPARC_TLS_TPOFF64:
-			DPRINTF("fixup R_SPARC_TLS_TPOFF64\n");
-			*r_ptr = sym_def->st_value + dest->tpoff;
-			break;
-
-		default:
-			printf("Error: Unknown relocation type %d\n",
-			    rel_type);
-			exit(1);
-		}
-
-	}
-}
-
-/** Fill in generic PLT entry.
- *
- * Fill a PLT entry with SPARC instructions to jump to the specified
- * address.
- *
- * @param plte Pointer to PLT entry to fill in
- * @param ta Target address of the jump
- */
-static void fill_plt_entry_generic(uint32_t *plte, uintptr_t ta)
-{
-	uint32_t hh, lm, hm, lo;
-
-	hh = BIT_RANGE_EXTRACT(uintptr_t, 63, 42, ta);
-	hm = BIT_RANGE_EXTRACT(uintptr_t, 41, 32, ta);
-	lm = BIT_RANGE_EXTRACT(uintptr_t, 31, 10, ta);
-	lo = BIT_RANGE_EXTRACT(uintptr_t, 9, 0, ta);
-
-	plte[0] = 0x01000000;      /* nop */
-	plte[1] = 0x03000000 | hh; /* sethi %hh(target), %g1 */
-	plte[2] = 0x0b000000 | lm; /* sethi %lm(target), %g5 */
-	plte[3] = 0x82106000 | hm; /* or %g1, %hm(target), %g1 */
-	plte[4] = 0x83287020;      /* sllx %g1, 32, %g1 */
-	plte[5] = 0x8a104005;      /* or %g1, %g5, %g5 */
-	plte[6] = 0x81c16000 | lo; /* jmpl %g5+lo(target),%g0 */
-	plte[7] = 0x01000000;      /* nop */
-
-	DPRINTF("Fill PTL entry at %p (target=0x%zx)\n",
-	    plte, ta);
-	for (unsigned i = 0; i < 8; i++) {
-		DPRINTF(" - [%d] = 0x%08x\n", i, plte[i]);
-	}
-}
-
-/** Get the adress of a function.
- *
- * @param sym Symbol
- * @param m Module in which the symbol is located
- * @return Address of function
- */
-void *func_get_addr(elf_symbol_t *sym, module_t *m)
-{
-	return symbol_get_addr(sym, m, __tcb_get());
-}
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/src/stacktrace.c
===================================================================
--- uspace/lib/c/arch/sparc64/src/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2010 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <libarch/stack.h>
-#include <errno.h>
-
-#include <stacktrace.h>
-
-#define FRAME_OFFSET_FP_PREV	(14 * 8)
-#define FRAME_OFFSET_RA		(15 * 8)
-
-bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
-{
-	(void) st;
-	return fp != 0;
-}
-
-errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev)
-{
-	uintptr_t bprev;
-	errno_t rc;
-
-	rc = (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_FP_PREV, &bprev);
-	if (rc == EOK)
-		*prev = bprev + STACK_BIAS;
-	return rc;
-}
-
-errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra)
-{
-	return (*st->ops->read_uintptr)(st->op_arg, fp + FRAME_OFFSET_RA, ra);
-}
-
-/** @}
- */
Index: pace/lib/c/arch/sparc64/src/stacktrace_asm.S
===================================================================
--- uspace/lib/c/arch/sparc64/src/stacktrace_asm.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#
-# Copyright (c) 2009 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-#include <libarch/stack.h>
-
-.text
-
-FUNCTION_BEGIN(stacktrace_prepare)
-	save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp
-	# Flush all other windows to memory so that we can read their contents.
-	flushw
-	ret
-	restore
-FUNCTION_END(stacktrace_prepare)
-
-FUNCTION_BEGIN(stacktrace_fp_get)
-	# Add the stack bias to %sp to get the actual address.
-	retl
-	add %sp, STACK_BIAS, %o0
-FUNCTION_END(stacktrace_fp_get)
-
-FUNCTION_BEGIN(stacktrace_pc_get)
-	retl
-	mov %o7, %o0
-FUNCTION_END(stacktrace_pc_get)
Index: pace/lib/c/arch/sparc64/src/thread_entry.S
===================================================================
--- uspace/lib/c/arch/sparc64/src/thread_entry.S	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#
-# Copyright (c) 2006 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-#include <abi/asmtool.h>
-
-.text
-
-## User-space thread entry point for all but the first threads.
-#
-#
-SYMBOL(__thread_entry)
-	add %sp, 0x7ff, %g1
-
-	#
-	# Create the first stack frame.
-	#
-	save %sp, -176, %sp
-	flushw
-	add %g0, -0x7ff, %fp
-
-	#
-	# Load libc entry point address and argument from stack
-	#
-	ldn [%g1 - 8], %o0
-	ldn [%g1 - 16], %g1
-
-	jmpl %g1, %r0
-	# Wipe link register
-	xor %o7, %o7, %o7
-
-	! not reached
Index: pace/lib/c/arch/sparc64/src/tls.c
===================================================================
--- uspace/lib/c/arch/sparc64/src/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcsparc64 sparc64
- * @ingroup lc
- * @{
- */
-/** @file
- *
- */
-
-#include <tls.h>
-#include <stddef.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-tcb_t *tls_alloc_arch(size_t size, size_t align)
-{
-	return tls_alloc_variant_2(size, align);
-}
-
-void tls_free_arch(tcb_t *tcb, size_t size, size_t align)
-{
-	tls_free_variant_2(tcb, size, align);
-}
-
-/*
- * Rtld TLS support
- */
-
-typedef struct {
-	unsigned long int ti_module;
-	unsigned long int ti_offset;
-} tls_index;
-
-void *__tls_get_addr(tls_index *ti);
-
-void *__tls_get_addr(tls_index *ti)
-{
-	uint8_t *tls;
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL) {
-		return rtld_tls_get_addr(runtime_env, __tcb_get(),
-		    ti->ti_module, ti->ti_offset);
-	}
-#endif
-	/* Get address of static TLS block */
-	tls = tls_get();
-	return tls + ti->ti_offset;
-}
-
-/** @}
- */
Index: pace/lib/c/common
===================================================================
--- uspace/lib/c/common	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../common
Index: pace/lib/c/doc/doxygroups.h
===================================================================
--- uspace/lib/c/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/**
- * @addtogroup libc libc
- * @brief HelenOS C library
- * @ingroup libs
- */
-
-/**
- * @addtogroup libcabs32le abs32le
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcamd64 amd64
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcarm32 arm32
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcarm64 arm64
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcia32 ia32
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcia64 ia64
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcmips32 mips32
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcppc32 ppc32
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcriscv64 riscv64
- * @ingroup libc
- */
-
-/**
- * @addtogroup libcsparc64 sparc64
- * @ingroup libc
- */
-
-/**
- * @addtogroup rtld rtld
- * @ingroup libc
- */
Index: pace/lib/c/generic/adt/prodcons.c
===================================================================
--- uspace/lib/c/generic/adt/prodcons.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <adt/prodcons.h>
-#include <adt/list.h>
-#include <fibril_synch.h>
-
-void prodcons_initialize(prodcons_t *pc)
-{
-	list_initialize(&pc->list);
-	fibril_mutex_initialize(&pc->mtx);
-	fibril_condvar_initialize(&pc->cv);
-}
-
-void prodcons_produce(prodcons_t *pc, link_t *item)
-{
-	fibril_mutex_lock(&pc->mtx);
-
-	list_append(item, &pc->list);
-	fibril_condvar_signal(&pc->cv);
-
-	fibril_mutex_unlock(&pc->mtx);
-}
-
-link_t *prodcons_consume(prodcons_t *pc)
-{
-	fibril_mutex_lock(&pc->mtx);
-
-	while (list_empty(&pc->list))
-		fibril_condvar_wait(&pc->cv, &pc->mtx);
-
-	link_t *head = list_first(&pc->list);
-	list_remove(head);
-
-	fibril_mutex_unlock(&pc->mtx);
-
-	return head;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/arg_parse.c
===================================================================
--- uspace/lib/c/generic/arg_parse.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Command-line arguments parsing functions
- */
-
-#include <arg_parse.h>
-#include <errno.h>
-#include <str.h>
-
-int arg_parse_short_long(const char *arg, const char *ashort, const char *along)
-{
-	if (str_cmp(arg, ashort) == 0)
-		return 0;
-
-	if (str_lcmp(arg, along, str_length(along)) == 0)
-		return str_length(along);
-
-	return -1;
-}
-
-/** Parse the next argument as an integer.
- *
- * The actual argument is pointed by the index.
- * Parse the offseted argument value if the offset is set
- * or the next one if not.
- *
- * @param[in]     argc   The total number of arguments.
- * @param[in]     argv   The arguments.
- * @param[in,out] index  The actual argument index. The index is incremented
- *                       by the number of processed arguments.
- * @param[out]    value  The parsed argument value.
- * @param[in]     offset The value offset in the actual argument. If not set,
- *                       the next argument is parsed instead.
- *
- * @return EOK on success.
- * @return ENOENT if the argument is missing.
- * @return EINVAL if the argument is in wrong format.
- *
- */
-errno_t arg_parse_int(int argc, char *argv[], int *index, int *value,
-    int offset)
-{
-	char *rest;
-
-	if (offset)
-		*value = strtol(argv[*index] + offset, &rest, 10);
-	else if ((*index) + 1 < argc) {
-		(*index)++;
-		*value = strtol(argv[*index], &rest, 10);
-	} else
-		return ENOENT;
-
-	if ((rest) && (*rest))
-		return EINVAL;
-
-	return EOK;
-}
-
-/** Parse the next named argument as an integral number.
- *
- * The actual argument is pointed by the index.
- * Parse the offseted actual argument if the offset is set or the next
- * one if not. Translate the argument using the parse_value function.
- * Increment the actual index by the number of processed arguments.
- *
- * @param[in]     argc        The total number of arguments.
- * @param[in]     argv        The arguments.
- * @param[in,out] index       The actual argument index. The index is
- *                            incremented by the number of processed arguments.
- * @param[out]    value       The parsed argument value.
- * @param[in]     offset      The value offset in the actual argument. If not
- *                            set, the next argument is parsed instead.
- * @param[in]     parse_value The translation function to parse the named value.
- *
- * @return EOK on success.
- * @return ENOENT if the argument is missing.
- * @return EINVAL if the argument name has not been found.
- *
- */
-errno_t arg_parse_name_int(int argc, char *argv[], int *index, int *value,
-    int offset, arg_parser parser)
-{
-	char *arg;
-
-	errno_t ret = arg_parse_string(argc, argv, index, &arg, offset);
-	if (ret != EOK)
-		return ret;
-
-	return parser(arg, value);
-}
-
-/** Parse the next argument as a character string.
- *
- * The actual argument is pointed by the index.
- * Parse the offseted actual argument value if the offset is set or the next
- * one if not. Increment the actual index by the number of processed arguments.
- *
- * @param[in]     argc   The total number of arguments.
- * @param[in]     argv   The arguments.
- * @param[in,out] index  The actual argument index. The index is
- *                       incremented by the number of processed arguments.
- * @param[out]    value  The parsed argument value.
- * @param[in]     offset The value offset in the actual argument. If not set,
- *                       the next argument is parsed instead.
- *
- * @return EOK on success.
- * @return ENOENT if the parameter is missing.
- *
- */
-errno_t arg_parse_string(int argc, char **argv, int *index, char **value,
-    int offset)
-{
-	if (offset)
-		*value = argv[*index] + offset;
-	else if ((*index) + 1 < argc) {
-		(*index)++;
-		*value = argv[*index];
-	} else
-		return ENOENT;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/as.c
===================================================================
--- uspace/lib/c/generic/as.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <as.h>
-#include <libc.h>
-#include <errno.h>
-#include <align.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <bitops.h>
-#include "private/libc.h"
-
-/** Create address space area.
- *
- * @param base       Starting virtual address of the area.
- *                   If set to AS_AREA_ANY ((void *) -1), the kernel finds a
- *                   mappable area.
- * @param size       Size of the area.
- * @param flags      Flags describing type of the area.
- * @param pager_info Pager info structure or AS_AREA_UNPAGED (NULL) if the area
- *                   is not paged (i.e. anonymous).
- *
- * @return Starting virtual address of the created area on success.
- * @return AS_MAP_FAILED ((void *) -1) otherwise.
- *
- */
-void *as_area_create(void *base, size_t size, unsigned int flags,
-    as_area_pager_info_t *pager_info)
-{
-	return (void *) __SYSCALL5(SYS_AS_AREA_CREATE, (sysarg_t) base,
-	    (sysarg_t) size, (sysarg_t) flags, (sysarg_t) __progsymbols.end,
-	    (sysarg_t) pager_info);
-}
-
-/** Resize address space area.
- *
- * @param address Virtual address pointing into already existing address space
- *                area.
- * @param size    New requested size of the area.
- * @param flags   Currently unused.
- *
- * @return zero on success or a code from @ref errno.h on failure.
- *
- */
-errno_t as_area_resize(void *address, size_t size, unsigned int flags)
-{
-	return (errno_t) __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t) address,
-	    (sysarg_t) size, (sysarg_t) flags);
-}
-
-/** Destroy address space area.
- *
- * @param address Virtual address pointing into the address space area being
- *                destroyed.
- *
- * @return zero on success or a code from @ref errno.h on failure.
- *
- */
-errno_t as_area_destroy(void *address)
-{
-	return (errno_t) __SYSCALL1(SYS_AS_AREA_DESTROY, (sysarg_t) address);
-}
-
-/** Change address-space area flags.
- *
- * @param address Virtual address pointing into the address space area being
- *                modified.
- * @param flags   New flags describing type of the area.
- *
- * @return zero on success or a code from @ref errno.h on failure.
- *
- */
-errno_t as_area_change_flags(void *address, unsigned int flags)
-{
-	return (errno_t) __SYSCALL2(SYS_AS_AREA_CHANGE_FLAGS, (sysarg_t) address,
-	    (sysarg_t) flags);
-}
-
-/** Get address-space area information.
- *
- * @param address Virtual address pointing into the address space area being
- *                modified.
- * @param info    Pointer to information structure to fill in.
- *
- * @return zero on success or a code from @ref errno.h on failure.
- *
- */
-errno_t as_area_get_info(void *address, as_area_info_t *info)
-{
-	return (errno_t) __SYSCALL2(SYS_AS_AREA_GET_INFO, (sysarg_t) address,
-	    (sysarg_t) info);
-}
-
-/** Find mapping to physical address.
- *
- * @param      virt Virtual address to find mapping for.
- * @param[out] phys Physical address.
- *
- * @return EOK on no error.
- * @retval ENOENT if no mapping was found.
- *
- */
-errno_t as_get_physical_mapping(const void *virt, uintptr_t *phys)
-{
-	return (errno_t) __SYSCALL2(SYS_PAGE_FIND_MAPPING, (sysarg_t) virt,
-	    (sysarg_t) phys);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/assert.c
===================================================================
--- uspace/lib/c/generic/assert.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <io/kio.h>
-#include <stdlib.h>
-#include <stacktrace.h>
-#include <stdint.h>
-#include <task.h>
-
-__thread int failed_asserts = 0;
-
-void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line)
-{
-	/*
-	 * Send the message safely to kio. Nested asserts should not occur.
-	 */
-	kio_printf("Assertion failed (%s) in task %" PRIu64 ", file \"%s\", line %u.\n",
-	    cond, task_get_id(), file, line);
-
-	stacktrace_kio_print();
-
-	/* Sometimes we know in advance that regular printf() would likely fail. */
-	abort();
-}
-
-void __helenos_assert_abort(const char *cond, const char *file, unsigned int line)
-{
-	/*
-	 * Send the message safely to kio. Nested asserts should not occur.
-	 */
-	kio_printf("Assertion failed (%s) in task %" PRIu64 ", file \"%s\", line %u.\n",
-	    cond, task_get_id(), file, line);
-
-	stacktrace_kio_print();
-
-	/*
-	 * Check if this is a nested or parallel assert.
-	 */
-	failed_asserts++;
-	if (failed_asserts > 0)
-		abort();
-
-	/*
-	 * Attempt to print the message to standard output and display
-	 * the stack trace. These operations can theoretically trigger nested
-	 * assertions.
-	 */
-	kio_printf("Assertion failed (%s) in task %" PRIu64 ", file \"%s\", line %u.\n",
-	    cond, task_get_id(), file, line);
-	stacktrace_print();
-
-	abort();
-}
-
-/** @}
- */
Index: pace/lib/c/generic/async/client.c
===================================================================
--- uspace/lib/c/generic/async/client.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1439 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-/**
- * Asynchronous library
- *
- * The aim of this library is to provide a facility for writing programs which
- * utilize the asynchronous nature of HelenOS IPC, yet using a normal way of
- * programming.
- *
- * You should be able to write very simple multithreaded programs. The async
- * framework will automatically take care of most of the synchronization
- * problems.
- *
- * Example of use (pseudo C):
- *
- * 1) Multithreaded client application
- *
- *   fibril_create(fibril1, ...);
- *   fibril_create(fibril2, ...);
- *   ...
- *
- *   int fibril1(void *arg)
- *   {
- *     conn = async_connect_me_to(...);
- *
- *     exch = async_exchange_begin(conn);
- *     c1 = async_send(exch);
- *     async_exchange_end(exch);
- *
- *     exch = async_exchange_begin(conn);
- *     c2 = async_send(exch);
- *     async_exchange_end(exch);
- *
- *     async_wait_for(c1);
- *     async_wait_for(c2);
- *     ...
- *   }
- *
- *
- * 2) Multithreaded server application
- *
- *   main()
- *   {
- *     async_manager();
- *   }
- *
- *   port_handler(ichandle, *icall)
- *   {
- *     if (want_refuse) {
- *       async_answer_0(ichandle, ELIMIT);
- *       return;
- *     }
- *     async_answer_0(ichandle, EOK);
- *
- *     chandle = async_get_call(&call);
- *     somehow_handle_the_call(chandle, call);
- *     async_answer_2(chandle, 1, 2, 3);
- *
- *     chandle = async_get_call(&call);
- *     ...
- *   }
- *
- */
-
-#define _LIBC_ASYNC_C_
-#include <ipc/ipc.h>
-#include <async.h>
-#include "../private/async.h"
-#include "../private/ns.h"
-#undef _LIBC_ASYNC_C_
-
-#include <ipc/irq.h>
-#include <ipc/event.h>
-#include <fibril.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <time.h>
-#include <barrier.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <as.h>
-#include <abi/mm/as.h>
-#include "../private/libc.h"
-#include "../private/fibril.h"
-
-static fibril_rmutex_t message_mutex;
-
-/** Naming service session */
-async_sess_t session_ns;
-
-/** Message data */
-typedef struct {
-	fibril_event_t received;
-
-	/** If reply was received. */
-	bool done;
-
-	/** If the message / reply should be discarded on arrival. */
-	bool forget;
-
-	/** Pointer to where the answer data is stored. */
-	ipc_call_t *dataptr;
-
-	errno_t retval;
-} amsg_t;
-
-static amsg_t *amsg_create(void)
-{
-	return calloc(1, sizeof(amsg_t));
-}
-
-static void amsg_destroy(amsg_t *msg)
-{
-	free(msg);
-}
-
-/** Mutex protecting inactive_exch_list and avail_phone_cv.
- *
- */
-static FIBRIL_MUTEX_INITIALIZE(async_sess_mutex);
-
-/** List of all currently inactive exchanges.
- *
- */
-static LIST_INITIALIZE(inactive_exch_list);
-
-/** Condition variable to wait for a phone to become available.
- *
- */
-static FIBRIL_CONDVAR_INITIALIZE(avail_phone_cv);
-
-/** Initialize the async framework.
- *
- */
-void __async_client_init(void)
-{
-	if (fibril_rmutex_initialize(&message_mutex) != EOK)
-		abort();
-
-	session_ns.iface = 0;
-	session_ns.mgmt = EXCHANGE_ATOMIC;
-	session_ns.phone = PHONE_NS;
-	session_ns.arg1 = 0;
-	session_ns.arg2 = 0;
-	session_ns.arg3 = 0;
-
-	fibril_mutex_initialize(&session_ns.remote_state_mtx);
-	session_ns.remote_state_data = NULL;
-
-	list_initialize(&session_ns.exch_list);
-	fibril_mutex_initialize(&session_ns.mutex);
-	session_ns.exchanges = 0;
-}
-
-void __async_client_fini(void)
-{
-	fibril_rmutex_destroy(&message_mutex);
-}
-
-/** Reply received callback.
- *
- * This function is called whenever a reply for an asynchronous message sent out
- * by the asynchronous framework is received.
- *
- * Notify the fibril which is waiting for this message that it has arrived.
- *
- * @param arg    Pointer to the asynchronous message record.
- * @param retval Value returned in the answer.
- * @param data   Call data of the answer.
- *
- */
-void async_reply_received(ipc_call_t *data)
-{
-	amsg_t *msg = (amsg_t *) data->answer_label;
-	if (!msg)
-		return;
-
-	fibril_rmutex_lock(&message_mutex);
-
-	msg->retval = ipc_get_retval(data);
-
-	/* Copy data inside lock, just in case the call was detached */
-	if ((msg->dataptr) && (data))
-		*msg->dataptr = *data;
-
-	msg->done = true;
-
-	if (msg->forget) {
-		amsg_destroy(msg);
-	} else {
-		fibril_notify(&msg->received);
-	}
-
-	fibril_rmutex_unlock(&message_mutex);
-}
-
-/** Send message and return id of the sent message.
- *
- * The return value can be used as input for async_wait() to wait for
- * completion.
- *
- * @param exch    Exchange for sending the message.
- * @param imethod Service-defined interface and method.
- * @param arg1    Service-defined payload argument.
- * @param arg2    Service-defined payload argument.
- * @param arg3    Service-defined payload argument.
- * @param arg4    Service-defined payload argument.
- * @param dataptr If non-NULL, storage where the reply data will be stored.
- *
- * @return Hash of the sent message or 0 on error.
- *
- */
-static aid_t async_send_fast(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
-{
-	if (exch == NULL)
-		return 0;
-
-	amsg_t *msg = amsg_create();
-	if (msg == NULL)
-		return 0;
-
-	msg->dataptr = dataptr;
-
-	errno_t rc = ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3,
-	    arg4, msg);
-	if (rc != EOK) {
-		msg->retval = rc;
-		msg->done = true;
-	}
-
-	return (aid_t) msg;
-}
-
-/** Send message and return id of the sent message
- *
- * The return value can be used as input for async_wait() to wait for
- * completion.
- *
- * @param exch    Exchange for sending the message.
- * @param imethod Service-defined interface and method.
- * @param arg1    Service-defined payload argument.
- * @param arg2    Service-defined payload argument.
- * @param arg3    Service-defined payload argument.
- * @param arg4    Service-defined payload argument.
- * @param arg5    Service-defined payload argument.
- * @param dataptr If non-NULL, storage where the reply data will be
- *                stored.
- *
- * @return Hash of the sent message or 0 on error.
- *
- */
-static aid_t async_send_slow(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
-    ipc_call_t *dataptr)
-{
-	if (exch == NULL)
-		return 0;
-
-	amsg_t *msg = amsg_create();
-	if (msg == NULL)
-		return 0;
-
-	msg->dataptr = dataptr;
-
-	errno_t rc = ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3,
-	    arg4, arg5, msg);
-	if (rc != EOK) {
-		msg->retval = rc;
-		msg->done = true;
-	}
-
-	return (aid_t) msg;
-}
-
-aid_t async_send_0(async_exch_t *exch, sysarg_t imethod, ipc_call_t *dataptr)
-{
-	return async_send_fast(exch, imethod, 0, 0, 0, 0, dataptr);
-}
-
-aid_t async_send_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    ipc_call_t *dataptr)
-{
-	return async_send_fast(exch, imethod, arg1, 0, 0, 0, dataptr);
-}
-
-aid_t async_send_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, ipc_call_t *dataptr)
-{
-	return async_send_fast(exch, imethod, arg1, arg2, 0, 0, dataptr);
-}
-
-aid_t async_send_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, ipc_call_t *dataptr)
-{
-	return async_send_fast(exch, imethod, arg1, arg2, arg3, 0, dataptr);
-}
-
-aid_t async_send_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, ipc_call_t *dataptr)
-{
-	return async_send_fast(exch, imethod, arg1, arg2, arg3, arg4, dataptr);
-}
-
-aid_t async_send_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
-    ipc_call_t *dataptr)
-{
-	return async_send_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5,
-	    dataptr);
-}
-
-/** Wait for a message sent by the async framework.
- *
- * @param amsgid Hash of the message to wait for.
- * @param retval Pointer to storage where the retval of the answer will
- *               be stored.
- *
- */
-void async_wait_for(aid_t amsgid, errno_t *retval)
-{
-	if (amsgid == 0) {
-		if (retval)
-			*retval = ENOMEM;
-		return;
-	}
-
-	amsg_t *msg = (amsg_t *) amsgid;
-	fibril_wait_for(&msg->received);
-
-	if (retval)
-		*retval = msg->retval;
-
-	amsg_destroy(msg);
-}
-
-/** Wait for a message sent by the async framework, timeout variant.
- *
- * If the wait times out, the caller may choose to either wait again by calling
- * async_wait_for() or async_wait_timeout(), or forget the message via
- * async_forget().
- *
- * @param amsgid  Hash of the message to wait for.
- * @param retval  Pointer to storage where the retval of the answer will
- *                be stored.
- * @param timeout Timeout in microseconds.
- *
- * @return Zero on success, ETIMEOUT if the timeout has expired.
- *
- */
-errno_t async_wait_timeout(aid_t amsgid, errno_t *retval, usec_t timeout)
-{
-	if (amsgid == 0) {
-		if (retval)
-			*retval = ENOMEM;
-		return EOK;
-	}
-
-	amsg_t *msg = (amsg_t *) amsgid;
-
-	/*
-	 * Negative timeout is converted to zero timeout to avoid
-	 * using tv_add with negative augmenter.
-	 */
-	if (timeout < 0)
-		timeout = 0;
-
-	struct timespec expires;
-	getuptime(&expires);
-	ts_add_diff(&expires, USEC2NSEC(timeout));
-
-	errno_t rc = fibril_wait_timeout(&msg->received, &expires);
-	if (rc != EOK)
-		return rc;
-
-	if (retval)
-		*retval = msg->retval;
-
-	amsg_destroy(msg);
-
-	return EOK;
-}
-
-/** Discard the message / reply on arrival.
- *
- * The message will be marked to be discarded once the reply arrives in
- * reply_received(). It is not allowed to call async_wait_for() or
- * async_wait_timeout() on this message after a call to this function.
- *
- * @param amsgid  Hash of the message to forget.
- */
-void async_forget(aid_t amsgid)
-{
-	if (amsgid == 0)
-		return;
-
-	amsg_t *msg = (amsg_t *) amsgid;
-
-	assert(!msg->forget);
-
-	fibril_rmutex_lock(&message_mutex);
-
-	if (msg->done) {
-		amsg_destroy(msg);
-	} else {
-		msg->dataptr = NULL;
-		msg->forget = true;
-	}
-
-	fibril_rmutex_unlock(&message_mutex);
-}
-
-/** Pseudo-synchronous message sending - fast version.
- *
- * Send message asynchronously and return only after the reply arrives.
- *
- * This function can only transfer 4 register payload arguments. For
- * transferring more arguments, see the slower async_req_slow().
- *
- * @param exch    Exchange for sending the message.
- * @param imethod Interface and method of the call.
- * @param arg1    Service-defined payload argument.
- * @param arg2    Service-defined payload argument.
- * @param arg3    Service-defined payload argument.
- * @param arg4    Service-defined payload argument.
- * @param r1      If non-NULL, storage for the 1st reply argument.
- * @param r2      If non-NULL, storage for the 2nd reply argument.
- * @param r3      If non-NULL, storage for the 3rd reply argument.
- * @param r4      If non-NULL, storage for the 4th reply argument.
- * @param r5      If non-NULL, storage for the 5th reply argument.
- *
- * @return Return code of the reply or an error code.
- *
- */
-static errno_t async_req_fast(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
-    sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	ipc_call_t result;
-	aid_t aid = async_send_4(exch, imethod, arg1, arg2, arg3, arg4,
-	    &result);
-
-	errno_t rc;
-	async_wait_for(aid, &rc);
-
-	if (r1)
-		*r1 = ipc_get_arg1(&result);
-
-	if (r2)
-		*r2 = ipc_get_arg2(&result);
-
-	if (r3)
-		*r3 = ipc_get_arg3(&result);
-
-	if (r4)
-		*r4 = ipc_get_arg4(&result);
-
-	if (r5)
-		*r5 = ipc_get_arg5(&result);
-
-	return rc;
-}
-
-/** Pseudo-synchronous message sending - slow version.
- *
- * Send message asynchronously and return only after the reply arrives.
- *
- * @param exch    Exchange for sending the message.
- * @param imethod Interface and method of the call.
- * @param arg1    Service-defined payload argument.
- * @param arg2    Service-defined payload argument.
- * @param arg3    Service-defined payload argument.
- * @param arg4    Service-defined payload argument.
- * @param arg5    Service-defined payload argument.
- * @param r1      If non-NULL, storage for the 1st reply argument.
- * @param r2      If non-NULL, storage for the 2nd reply argument.
- * @param r3      If non-NULL, storage for the 3rd reply argument.
- * @param r4      If non-NULL, storage for the 4th reply argument.
- * @param r5      If non-NULL, storage for the 5th reply argument.
- *
- * @return Return code of the reply or an error code.
- *
- */
-static errno_t async_req_slow(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
-    sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	ipc_call_t result;
-	aid_t aid = async_send_5(exch, imethod, arg1, arg2, arg3, arg4, arg5,
-	    &result);
-
-	errno_t rc;
-	async_wait_for(aid, &rc);
-
-	if (r1)
-		*r1 = ipc_get_arg1(&result);
-
-	if (r2)
-		*r2 = ipc_get_arg2(&result);
-
-	if (r3)
-		*r3 = ipc_get_arg3(&result);
-
-	if (r4)
-		*r4 = ipc_get_arg4(&result);
-
-	if (r5)
-		*r5 = ipc_get_arg5(&result);
-
-	return rc;
-}
-
-errno_t async_req_0_0(async_exch_t *exch, sysarg_t imethod)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, NULL, NULL, NULL, NULL,
-	    NULL);
-}
-
-errno_t async_req_0_1(async_exch_t *exch, sysarg_t imethod, sysarg_t *r1)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, r1, NULL, NULL, NULL,
-	    NULL);
-}
-
-errno_t async_req_0_2(async_exch_t *exch, sysarg_t imethod, sysarg_t *r1,
-    sysarg_t *r2)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, r1, r2, NULL, NULL, NULL);
-}
-
-errno_t async_req_0_3(async_exch_t *exch, sysarg_t imethod, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, r1, r2, r3, NULL, NULL);
-}
-
-errno_t async_req_0_4(async_exch_t *exch, sysarg_t imethod, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, r1, r2, r3, r4, NULL);
-}
-
-errno_t async_req_0_5(async_exch_t *exch, sysarg_t imethod, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_fast(exch, imethod, 0, 0, 0, 0, r1, r2, r3, r4, r5);
-}
-
-errno_t async_req_1_0(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, NULL, NULL, NULL, NULL,
-	    NULL);
-}
-
-errno_t async_req_1_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t *r1)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, r1, NULL, NULL, NULL,
-	    NULL);
-}
-
-errno_t async_req_1_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t *r1, sysarg_t *r2)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, r1, r2, NULL, NULL,
-	    NULL);
-}
-
-errno_t async_req_1_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t *r1, sysarg_t *r2, sysarg_t *r3)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, r1, r2, r3, NULL,
-	    NULL);
-}
-
-errno_t async_req_1_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, r1, r2, r3, r4, NULL);
-}
-
-errno_t async_req_1_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_fast(exch, imethod, arg1, 0, 0, 0, r1, r2, r3, r4, r5);
-}
-
-errno_t async_req_2_0(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, NULL, NULL, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_2_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, r1, NULL, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_2_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1, sysarg_t *r2)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, r1, r2, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_2_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, r1, r2, r3, NULL,
-	    NULL);
-}
-
-errno_t async_req_2_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, r1, r2, r3, r4,
-	    NULL);
-}
-
-errno_t async_req_2_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, 0, 0, r1, r2, r3, r4, r5);
-}
-
-errno_t async_req_3_0(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, NULL, NULL, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_3_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t *r1)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, r1, NULL, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_3_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t *r1, sysarg_t *r2)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, r1, r2, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_3_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, r1, r2, r3, NULL,
-	    NULL);
-}
-
-errno_t async_req_3_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3,
-    sysarg_t *r4)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, r1, r2, r3, r4,
-	    NULL);
-}
-
-errno_t async_req_3_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t *r1, sysarg_t *r2, sysarg_t *r3,
-    sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, 0, r1, r2, r3, r4,
-	    r5);
-}
-
-errno_t async_req_4_0(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, NULL, NULL,
-	    NULL, NULL, NULL);
-}
-
-errno_t async_req_4_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, r1, NULL,
-	    NULL, NULL, NULL);
-}
-
-errno_t async_req_4_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, r1, r2, NULL,
-	    NULL, NULL);
-}
-
-errno_t async_req_4_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
-    sysarg_t *r3)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, r1, r2, r3,
-	    NULL, NULL);
-}
-
-errno_t async_req_4_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
-    sysarg_t *r3, sysarg_t *r4)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, r1, r2, r3,
-	    r4, NULL);
-}
-
-errno_t async_req_4_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t *r1, sysarg_t *r2,
-    sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_fast(exch, imethod, arg1, arg2, arg3, arg4, r1, r2, r3,
-	    r4, r5);
-}
-
-errno_t async_req_5_0(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, NULL,
-	    NULL, NULL, NULL, NULL);
-}
-
-errno_t async_req_5_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, r1,
-	    NULL, NULL, NULL, NULL);
-}
-
-errno_t async_req_5_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
-    sysarg_t *r2)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, r1, r2,
-	    NULL, NULL, NULL);
-}
-
-errno_t async_req_5_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, r1, r2,
-	    r3, NULL, NULL);
-}
-
-errno_t async_req_5_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, r1, r2,
-	    r3, r4, NULL);
-}
-
-errno_t async_req_5_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *r1,
-    sysarg_t *r2, sysarg_t *r3, sysarg_t *r4, sysarg_t *r5)
-{
-	return async_req_slow(exch, imethod, arg1, arg2, arg3, arg4, arg5, r1, r2,
-	    r3, r4, r5);
-}
-
-void async_msg_0(async_exch_t *exch, sysarg_t imethod)
-{
-	if (exch != NULL)
-		ipc_call_async_0(exch->phone, imethod, NULL);
-}
-
-void async_msg_1(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1)
-{
-	if (exch != NULL)
-		ipc_call_async_1(exch->phone, imethod, arg1, NULL);
-}
-
-void async_msg_2(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2)
-{
-	if (exch != NULL)
-		ipc_call_async_2(exch->phone, imethod, arg1, arg2, NULL);
-}
-
-void async_msg_3(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3)
-{
-	if (exch != NULL)
-		ipc_call_async_3(exch->phone, imethod, arg1, arg2, arg3, NULL);
-}
-
-void async_msg_4(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	if (exch != NULL)
-		ipc_call_async_4(exch->phone, imethod, arg1, arg2, arg3, arg4,
-		    NULL);
-}
-
-void async_msg_5(async_exch_t *exch, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
-{
-	if (exch != NULL)
-		ipc_call_async_5(exch->phone, imethod, arg1, arg2, arg3, arg4,
-		    arg5, NULL);
-}
-
-static errno_t async_connect_me_to_internal(cap_phone_handle_t phone,
-    iface_t iface, sysarg_t arg2, sysarg_t arg3, sysarg_t flags,
-    cap_phone_handle_t *out_phone)
-{
-	ipc_call_t result;
-
-	// XXX: Workaround for GCC's inability to infer association between
-	// rc == EOK and *out_phone being assigned.
-	*out_phone = CAP_NIL;
-
-	amsg_t *msg = amsg_create();
-	if (!msg)
-		return ENOENT;
-
-	msg->dataptr = &result;
-
-	errno_t rc = ipc_call_async_4(phone, IPC_M_CONNECT_ME_TO,
-	    (sysarg_t) iface, arg2, arg3, flags, msg);
-	if (rc != EOK) {
-		msg->retval = rc;
-		msg->done = true;
-	}
-
-	async_wait_for((aid_t) msg, &rc);
-
-	if (rc != EOK)
-		return rc;
-
-	*out_phone = (cap_phone_handle_t) ipc_get_arg5(&result);
-	return EOK;
-}
-
-/** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
- *
- * Ask through phone for a new connection to some service and block until
- * success.
- *
- * @param exch  Exchange for sending the message.
- * @param iface Connection interface.
- * @param arg2  User defined argument.
- * @param arg3  User defined argument.
- * @param rc    Placeholder for return code. Unused if NULL.
- *
- * @return New session on success or NULL on error.
- *
- */
-async_sess_t *async_connect_me_to(async_exch_t *exch, iface_t iface,
-    sysarg_t arg2, sysarg_t arg3, errno_t *rc)
-{
-	if (exch == NULL) {
-		if (rc != NULL)
-			*rc = ENOENT;
-
-		return NULL;
-	}
-
-	async_sess_t *sess = calloc(1, sizeof(async_sess_t));
-	if (sess == NULL) {
-		if (rc != NULL)
-			*rc = ENOMEM;
-
-		return NULL;
-	}
-
-	cap_phone_handle_t phone;
-	errno_t ret = async_connect_me_to_internal(exch->phone, iface, arg2,
-	    arg3, 0, &phone);
-	if (ret != EOK) {
-		if (rc != NULL)
-			*rc = ret;
-
-		free(sess);
-		return NULL;
-	}
-
-	sess->iface = iface;
-	sess->phone = phone;
-	sess->arg1 = iface;
-	sess->arg2 = arg2;
-	sess->arg3 = arg3;
-
-	fibril_mutex_initialize(&sess->remote_state_mtx);
-	list_initialize(&sess->exch_list);
-	fibril_mutex_initialize(&sess->mutex);
-
-	return sess;
-}
-
-/** Set arguments for new connections.
- *
- * FIXME This is an ugly hack to work around the problem that parallel
- * exchanges are implemented using parallel connections. When we create
- * a callback session, the framework does not know arguments for the new
- * connections.
- *
- * The proper solution seems to be to implement parallel exchanges using
- * tagging.
- *
- */
-void async_sess_args_set(async_sess_t *sess, iface_t iface, sysarg_t arg2,
-    sysarg_t arg3)
-{
-	sess->arg1 = iface;
-	sess->arg2 = arg2;
-	sess->arg3 = arg3;
-}
-
-/** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
- *
- * Ask through phone for a new connection to some service and block until
- * success.
- *
- * @param exch  Exchange for sending the message.
- * @param iface Connection interface.
- * @param arg2  User defined argument.
- * @param arg3  User defined argument.
- * @param rc    Placeholder for return code. Unused if NULL.
- *
- * @return New session on success or NULL on error.
- *
- */
-async_sess_t *async_connect_me_to_blocking(async_exch_t *exch, iface_t iface,
-    sysarg_t arg2, sysarg_t arg3, errno_t *rc)
-{
-	if (exch == NULL) {
-		if (rc != NULL)
-			*rc = ENOENT;
-
-		return NULL;
-	}
-
-	async_sess_t *sess = calloc(1, sizeof(async_sess_t));
-	if (sess == NULL) {
-		if (rc != NULL)
-			*rc = ENOMEM;
-
-		return NULL;
-	}
-
-	cap_phone_handle_t phone;
-	errno_t ret = async_connect_me_to_internal(exch->phone, iface, arg2,
-	    arg3, IPC_FLAG_BLOCKING, &phone);
-	if (ret != EOK) {
-		if (rc != NULL)
-			*rc = ret;
-
-		free(sess);
-		return NULL;
-	}
-
-	sess->iface = iface;
-	sess->phone = phone;
-	sess->arg1 = iface;
-	sess->arg2 = arg2;
-	sess->arg3 = arg3;
-
-	fibril_mutex_initialize(&sess->remote_state_mtx);
-	list_initialize(&sess->exch_list);
-	fibril_mutex_initialize(&sess->mutex);
-
-	return sess;
-}
-
-/** Connect to a task specified by id.
- *
- * @param id Task to which to connect.
- * @param rc Placeholder for return code. Unused if NULL.
- *
- * @return New session on success or NULL on error.
- *
- */
-async_sess_t *async_connect_kbox(task_id_t id, errno_t *rc)
-{
-	async_sess_t *sess = calloc(1, sizeof(async_sess_t));
-	if (sess == NULL) {
-		if (rc != NULL)
-			*rc = ENOMEM;
-
-		return NULL;
-	}
-
-	cap_phone_handle_t phone;
-	errno_t ret = ipc_connect_kbox(id, &phone);
-	if (ret != EOK) {
-		if (rc != NULL)
-			*rc = ret;
-
-		free(sess);
-		return NULL;
-	}
-
-	sess->iface = 0;
-	sess->mgmt = EXCHANGE_ATOMIC;
-	sess->phone = phone;
-
-	fibril_mutex_initialize(&sess->remote_state_mtx);
-	list_initialize(&sess->exch_list);
-	fibril_mutex_initialize(&sess->mutex);
-
-	return sess;
-}
-
-static void async_hangup_internal(cap_phone_handle_t phone)
-{
-	errno_t rc;
-
-	rc = ipc_hangup(phone);
-	assert(rc == EOK);
-	(void) rc;
-}
-
-/** Wrapper for ipc_hangup.
- *
- * @param sess Session to hung up.
- */
-void async_hangup(async_sess_t *sess)
-{
-	async_exch_t *exch;
-
-	assert(sess);
-
-	fibril_mutex_lock(&async_sess_mutex);
-	assert(sess->exchanges == 0);
-
-	async_hangup_internal(sess->phone);
-
-	while (!list_empty(&sess->exch_list)) {
-		exch = (async_exch_t *)
-		    list_get_instance(list_first(&sess->exch_list),
-		    async_exch_t, sess_link);
-
-		list_remove(&exch->sess_link);
-		list_remove(&exch->global_link);
-		if (sess->mgmt != EXCHANGE_ATOMIC &&
-		    sess->mgmt != EXCHANGE_SERIALIZE)
-			async_hangup_internal(exch->phone);
-		free(exch);
-	}
-
-	free(sess);
-
-	fibril_mutex_unlock(&async_sess_mutex);
-}
-
-/** Start new exchange in a session.
- *
- * @param session Session.
- *
- * @return New exchange or NULL on error.
- *
- */
-async_exch_t *async_exchange_begin(async_sess_t *sess)
-{
-	if (sess == NULL)
-		return NULL;
-
-	exch_mgmt_t mgmt = sess->mgmt;
-	if (sess->iface != 0)
-		mgmt = sess->iface & IFACE_EXCHANGE_MASK;
-
-	async_exch_t *exch = NULL;
-
-	fibril_mutex_lock(&async_sess_mutex);
-
-	if (!list_empty(&sess->exch_list)) {
-		/*
-		 * There are inactive exchanges in the session.
-		 */
-		exch = (async_exch_t *)
-		    list_get_instance(list_first(&sess->exch_list),
-		    async_exch_t, sess_link);
-
-		list_remove(&exch->sess_link);
-		list_remove(&exch->global_link);
-	} else {
-		/*
-		 * There are no available exchanges in the session.
-		 */
-
-		if ((mgmt == EXCHANGE_ATOMIC) ||
-		    (mgmt == EXCHANGE_SERIALIZE)) {
-			exch = (async_exch_t *) malloc(sizeof(async_exch_t));
-			if (exch != NULL) {
-				link_initialize(&exch->sess_link);
-				link_initialize(&exch->global_link);
-				exch->sess = sess;
-				exch->phone = sess->phone;
-			}
-		} else if (mgmt == EXCHANGE_PARALLEL) {
-			cap_phone_handle_t phone;
-			errno_t rc;
-
-		retry:
-			/*
-			 * Make a one-time attempt to connect a new data phone.
-			 */
-			rc = async_connect_me_to_internal(sess->phone, sess->arg1,
-			    sess->arg2, sess->arg3, 0, &phone);
-			if (rc == EOK) {
-				exch = (async_exch_t *) malloc(sizeof(async_exch_t));
-				if (exch != NULL) {
-					link_initialize(&exch->sess_link);
-					link_initialize(&exch->global_link);
-					exch->sess = sess;
-					exch->phone = phone;
-				} else
-					async_hangup_internal(phone);
-			} else if (!list_empty(&inactive_exch_list)) {
-				/*
-				 * We did not manage to connect a new phone. But we
-				 * can try to close some of the currently inactive
-				 * connections in other sessions and try again.
-				 */
-				exch = (async_exch_t *)
-				    list_get_instance(list_first(&inactive_exch_list),
-				    async_exch_t, global_link);
-
-				list_remove(&exch->sess_link);
-				list_remove(&exch->global_link);
-				async_hangup_internal(exch->phone);
-				free(exch);
-				goto retry;
-			} else {
-				/*
-				 * Wait for a phone to become available.
-				 */
-				fibril_condvar_wait(&avail_phone_cv, &async_sess_mutex);
-				goto retry;
-			}
-		}
-	}
-
-	if (exch != NULL)
-		sess->exchanges++;
-
-	fibril_mutex_unlock(&async_sess_mutex);
-
-	if (exch != NULL && mgmt == EXCHANGE_SERIALIZE)
-		fibril_mutex_lock(&sess->mutex);
-
-	return exch;
-}
-
-/** Finish an exchange.
- *
- * @param exch Exchange to finish.
- *
- */
-void async_exchange_end(async_exch_t *exch)
-{
-	if (exch == NULL)
-		return;
-
-	async_sess_t *sess = exch->sess;
-	assert(sess != NULL);
-
-	exch_mgmt_t mgmt = sess->mgmt;
-	if (sess->iface != 0)
-		mgmt = sess->iface & IFACE_EXCHANGE_MASK;
-
-	if (mgmt == EXCHANGE_SERIALIZE)
-		fibril_mutex_unlock(&sess->mutex);
-
-	fibril_mutex_lock(&async_sess_mutex);
-
-	sess->exchanges--;
-
-	list_append(&exch->sess_link, &sess->exch_list);
-	list_append(&exch->global_link, &inactive_exch_list);
-	fibril_condvar_signal(&avail_phone_cv);
-
-	fibril_mutex_unlock(&async_sess_mutex);
-}
-
-/** Wrapper for IPC_M_SHARE_IN calls using the async framework.
- *
- * @param exch  Exchange for sending the message.
- * @param size  Size of the destination address space area.
- * @param arg   User defined argument.
- * @param flags Storage for the received flags. Can be NULL.
- * @param dst   Address of the storage for the destination address space area
- *              base address. Cannot be NULL.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-static errno_t async_share_in_start(async_exch_t *exch, size_t size,
-    sysarg_t arg, unsigned int *flags, void **dst)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	sysarg_t _flags = 0;
-	sysarg_t _dst = (sysarg_t) -1;
-	errno_t res = async_req_3_5(exch, IPC_M_SHARE_IN, (sysarg_t) size,
-	    (sysarg_t) __progsymbols.end, arg, NULL, &_flags, NULL, NULL,
-	    &_dst);
-
-	if (flags)
-		*flags = (unsigned int) _flags;
-
-	*dst = (void *) _dst;
-	return res;
-}
-
-errno_t async_share_in_start_0_0(async_exch_t *exch, size_t size, void **dst)
-{
-	return async_share_in_start(exch, size, 0, NULL, dst);
-}
-
-errno_t async_share_in_start_0_1(async_exch_t *exch, size_t size,
-    unsigned int *flags, void **dst)
-{
-	return async_share_in_start(exch, size, 0, flags, dst);
-}
-
-errno_t async_share_in_start_1_0(async_exch_t *exch, size_t size, sysarg_t arg,
-    void **dst)
-{
-	return async_share_in_start(exch, size, arg, NULL, dst);
-}
-
-errno_t async_share_in_start_1_1(async_exch_t *exch, size_t size, sysarg_t arg,
-    unsigned int *flags, void **dst)
-{
-	return async_share_in_start(exch, size, arg, flags, dst);
-}
-
-/** Wrapper for IPC_M_SHARE_OUT calls using the async framework.
- *
- * @param exch  Exchange for sending the message.
- * @param src   Source address space area base address.
- * @param flags Flags to be used for sharing. Bits can be only cleared.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_share_out_start(async_exch_t *exch, void *src, unsigned int flags)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	return async_req_3_0(exch, IPC_M_SHARE_OUT, (sysarg_t) src, 0,
-	    (sysarg_t) flags);
-}
-
-/** Start IPC_M_DATA_READ using the async framework.
- *
- * @param exch    Exchange for sending the message.
- * @param dst     Address of the beginning of the destination buffer.
- * @param size    Size of the destination buffer (in bytes).
- * @param dataptr Storage of call data (arg 2 holds actual data size).
- *
- * @return Hash of the sent message or 0 on error.
- *
- */
-aid_t async_data_read(async_exch_t *exch, void *dst, size_t size,
-    ipc_call_t *dataptr)
-{
-	return async_send_2(exch, IPC_M_DATA_READ, (sysarg_t) dst,
-	    (sysarg_t) size, dataptr);
-}
-
-/** Wrapper for IPC_M_DATA_READ calls using the async framework.
- *
- * @param exch Exchange for sending the message.
- * @param dst  Address of the beginning of the destination buffer.
- * @param size Size of the destination buffer.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_data_read_start(async_exch_t *exch, void *dst, size_t size)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	return async_req_2_0(exch, IPC_M_DATA_READ, (sysarg_t) dst,
-	    (sysarg_t) size);
-}
-
-/** Wrapper for IPC_M_DATA_WRITE calls using the async framework.
- *
- * @param exch Exchange for sending the message.
- * @param src  Address of the beginning of the source buffer.
- * @param size Size of the source buffer.
- *
- * @return Zero on success or an error code from errno.h.
- *
- */
-errno_t async_data_write_start(async_exch_t *exch, const void *src, size_t size)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	return async_req_2_0(exch, IPC_M_DATA_WRITE, (sysarg_t) src,
-	    (sysarg_t) size);
-}
-
-errno_t async_state_change_start(async_exch_t *exch, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, async_exch_t *other_exch)
-{
-	return async_req_5_0(exch, IPC_M_STATE_CHANGE_AUTHORIZE,
-	    arg1, arg2, arg3, 0, cap_handle_raw(other_exch->phone));
-}
-
-/** Lock and get session remote state
- *
- * Lock and get the local replica of the remote state
- * in stateful sessions. The call should be paired
- * with async_remote_state_release*().
- *
- * @param[in] sess Stateful session.
- *
- * @return Local replica of the remote state.
- *
- */
-void *async_remote_state_acquire(async_sess_t *sess)
-{
-	fibril_mutex_lock(&sess->remote_state_mtx);
-	return sess->remote_state_data;
-}
-
-/** Update the session remote state
- *
- * Update the local replica of the remote state
- * in stateful sessions. The remote state must
- * be already locked.
- *
- * @param[in] sess  Stateful session.
- * @param[in] state New local replica of the remote state.
- *
- */
-void async_remote_state_update(async_sess_t *sess, void *state)
-{
-	assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
-	sess->remote_state_data = state;
-}
-
-/** Release the session remote state
- *
- * Unlock the local replica of the remote state
- * in stateful sessions.
- *
- * @param[in] sess Stateful session.
- *
- */
-void async_remote_state_release(async_sess_t *sess)
-{
-	assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
-
-	fibril_mutex_unlock(&sess->remote_state_mtx);
-}
-
-/** Release the session remote state and end an exchange
- *
- * Unlock the local replica of the remote state
- * in stateful sessions. This is convenience function
- * which gets the session pointer from the exchange
- * and also ends the exchange.
- *
- * @param[in] exch Stateful session's exchange.
- *
- */
-void async_remote_state_release_exchange(async_exch_t *exch)
-{
-	if (exch == NULL)
-		return;
-
-	async_sess_t *sess = exch->sess;
-	assert(fibril_mutex_is_locked(&sess->remote_state_mtx));
-
-	async_exchange_end(exch);
-	fibril_mutex_unlock(&sess->remote_state_mtx);
-}
-
-void *async_as_area_create(void *base, size_t size, unsigned int flags,
-    async_sess_t *pager, sysarg_t id1, sysarg_t id2, sysarg_t id3)
-{
-	as_area_pager_info_t pager_info = {
-		.pager = pager->phone,
-		.id1 = id1,
-		.id2 = id2,
-		.id3 = id3
-	};
-	return as_area_create(base, size, flags, &pager_info);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/async/ports.c
===================================================================
--- uspace/lib/c/generic/async/ports.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,304 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define _LIBC_ASYNC_C_
-#include <ipc/ipc.h>
-#include <async.h>
-#include "../private/async.h"
-#undef _LIBC_ASYNC_C_
-
-#include <ipc/irq.h>
-#include <ipc/event.h>
-#include <fibril.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <time.h>
-#include <barrier.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <as.h>
-#include <abi/mm/as.h>
-#include "../private/fibril.h"
-
-/** Interface data */
-typedef struct {
-	ht_link_t link;
-
-	/** Interface ID */
-	iface_t iface;
-
-	/** Interface ports */
-	hash_table_t port_hash_table;
-
-	/** Next available port ID */
-	port_id_t port_id_avail;
-} interface_t;
-
-/* Port data */
-typedef struct {
-	ht_link_t link;
-
-	/** Port ID */
-	port_id_t id;
-
-	/** Port connection handler */
-	async_port_handler_t handler;
-
-	/** Client data */
-	void *data;
-} port_t;
-
-/** Default fallback fibril function.
- *
- * This fallback fibril function gets called on incomming connections that do
- * not have a specific handler defined.
- *
- * @param call Data of the incoming call.
- * @param arg  Local argument
- *
- */
-static void default_fallback_port_handler(ipc_call_t *call, void *arg)
-{
-	async_answer_0(call, ENOENT);
-}
-
-static async_port_handler_t fallback_port_handler =
-    default_fallback_port_handler;
-static void *fallback_port_data = NULL;
-
-/** Futex guarding the interface hash table. */
-static fibril_rmutex_t interface_mutex;
-static hash_table_t interface_hash_table;
-
-static size_t interface_key_hash(const void *key)
-{
-	const iface_t *iface = key;
-	return *iface;
-}
-
-static size_t interface_hash(const ht_link_t *item)
-{
-	interface_t *interface = hash_table_get_inst(item, interface_t, link);
-	return interface_key_hash(&interface->iface);
-}
-
-static bool interface_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const iface_t *iface = key;
-	interface_t *interface = hash_table_get_inst(item, interface_t, link);
-	return *iface == interface->iface;
-}
-
-/** Operations for the port hash table. */
-static const hash_table_ops_t interface_hash_table_ops = {
-	.hash = interface_hash,
-	.key_hash = interface_key_hash,
-	.key_equal = interface_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static size_t port_key_hash(const void *key)
-{
-	const port_id_t *port_id = key;
-	return *port_id;
-}
-
-static size_t port_hash(const ht_link_t *item)
-{
-	port_t *port = hash_table_get_inst(item, port_t, link);
-	return port_key_hash(&port->id);
-}
-
-static bool port_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const port_id_t *port_id = key;
-	port_t *port = hash_table_get_inst(item, port_t, link);
-	return *port_id == port->id;
-}
-
-/** Operations for the port hash table. */
-static const hash_table_ops_t port_hash_table_ops = {
-	.hash = port_hash,
-	.key_hash = port_key_hash,
-	.key_equal = port_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static interface_t *async_new_interface(iface_t iface)
-{
-	interface_t *interface =
-	    (interface_t *) malloc(sizeof(interface_t));
-	if (!interface)
-		return NULL;
-
-	bool ret = hash_table_create(&interface->port_hash_table, 0, 0,
-	    &port_hash_table_ops);
-	if (!ret) {
-		free(interface);
-		return NULL;
-	}
-
-	interface->iface = iface;
-	interface->port_id_avail = 0;
-
-	hash_table_insert(&interface_hash_table, &interface->link);
-
-	return interface;
-}
-
-static port_t *async_new_port(interface_t *interface,
-    async_port_handler_t handler, void *data)
-{
-	// TODO: Move the malloc out of critical section.
-	port_t *port = (port_t *) malloc(sizeof(port_t));
-	if (!port)
-		return NULL;
-
-	port_id_t id = interface->port_id_avail;
-	interface->port_id_avail++;
-
-	port->id = id;
-	port->handler = handler;
-	port->data = data;
-
-	hash_table_insert(&interface->port_hash_table, &port->link);
-
-	return port;
-}
-
-errno_t async_create_port_internal(iface_t iface, async_port_handler_t handler,
-    void *data, port_id_t *port_id)
-{
-	interface_t *interface;
-
-	fibril_rmutex_lock(&interface_mutex);
-
-	ht_link_t *link = hash_table_find(&interface_hash_table, &iface);
-	if (link)
-		interface = hash_table_get_inst(link, interface_t, link);
-	else
-		interface = async_new_interface(iface);
-
-	if (!interface) {
-		fibril_rmutex_unlock(&interface_mutex);
-		return ENOMEM;
-	}
-
-	port_t *port = async_new_port(interface, handler, data);
-	if (!port) {
-		fibril_rmutex_unlock(&interface_mutex);
-		return ENOMEM;
-	}
-
-	*port_id = port->id;
-
-	fibril_rmutex_unlock(&interface_mutex);
-
-	return EOK;
-}
-
-errno_t async_create_port(iface_t iface, async_port_handler_t handler,
-    void *data, port_id_t *port_id)
-{
-	if ((iface & IFACE_MOD_MASK) == IFACE_MOD_CALLBACK)
-		return EINVAL;
-
-	return async_create_port_internal(iface, handler, data, port_id);
-}
-
-void async_set_fallback_port_handler(async_port_handler_t handler, void *data)
-{
-	assert(handler != NULL);
-
-	fallback_port_handler = handler;
-	fallback_port_data = data;
-}
-
-static port_t *async_find_port(iface_t iface, port_id_t port_id)
-{
-	port_t *port = NULL;
-
-	fibril_rmutex_lock(&interface_mutex);
-
-	ht_link_t *link = hash_table_find(&interface_hash_table, &iface);
-	if (link) {
-		interface_t *interface =
-		    hash_table_get_inst(link, interface_t, link);
-
-		link = hash_table_find(&interface->port_hash_table, &port_id);
-		if (link)
-			port = hash_table_get_inst(link, port_t, link);
-	}
-
-	fibril_rmutex_unlock(&interface_mutex);
-
-	return port;
-}
-
-async_port_handler_t async_get_port_handler(iface_t iface, port_id_t port_id,
-    void **data)
-{
-	assert(data);
-
-	async_port_handler_t handler = fallback_port_handler;
-	*data = fallback_port_data;
-
-	port_t *port = async_find_port(iface, port_id);
-	if (port) {
-		handler = port->handler;
-		*data = port->data;
-	}
-
-	return handler;
-}
-
-/** Initialize the async framework.
- *
- */
-void __async_ports_init(void)
-{
-	if (fibril_rmutex_initialize(&interface_mutex) != EOK)
-		abort();
-
-	if (!hash_table_create(&interface_hash_table, 0, 0,
-	    &interface_hash_table_ops))
-		abort();
-}
-
-void __async_ports_fini(void)
-{
-	fibril_rmutex_destroy(&interface_mutex);
-}
Index: pace/lib/c/generic/async/server.c
===================================================================
--- uspace/lib/c/generic/async/server.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1825 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-/**
- * Asynchronous library
- *
- * The aim of this library is to provide a facility for writing programs which
- * utilize the asynchronous nature of HelenOS IPC, yet using a normal way of
- * programming.
- *
- * You should be able to write very simple multithreaded programs. The async
- * framework will automatically take care of most of the synchronization
- * problems.
- *
- * Example of use (pseudo C):
- *
- * 1) Multithreaded client application
- *
- *   fibril_create(fibril1, ...);
- *   fibril_create(fibril2, ...);
- *   ...
- *
- *   int fibril1(void *arg)
- *   {
- *     conn = async_connect_me_to(...);
- *
- *     exch = async_exchange_begin(conn);
- *     c1 = async_send(exch);
- *     async_exchange_end(exch);
- *
- *     exch = async_exchange_begin(conn);
- *     c2 = async_send(exch);
- *     async_exchange_end(exch);
- *
- *     async_wait_for(c1);
- *     async_wait_for(c2);
- *     ...
- *   }
- *
- *
- * 2) Multithreaded server application
- *
- *   main()
- *   {
- *     async_manager();
- *   }
- *
- *   port_handler(ipc_call_t *icall)
- *   {
- *     if (want_refuse) {
- *       async_answer_0(icall, ELIMIT);
- *       return;
- *     }
- *
- *     async_answer_0(icall, EOK);
- *
- *     async_get_call(&call);
- *     somehow_handle_the_call(&call);
- *     async_answer_2(&call, 1, 2, 3);
- *
- *     async_get_call(&call);
- *     ...
- *   }
- *
- */
-
-#define _LIBC_ASYNC_C_
-#include <ipc/ipc.h>
-#include <async.h>
-#include "../private/async.h"
-#undef _LIBC_ASYNC_C_
-
-#include <ipc/irq.h>
-#include <ipc/event.h>
-#include <fibril.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <time.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <macros.h>
-#include <str_error.h>
-#include <as.h>
-#include <abi/mm/as.h>
-#include "../private/libc.h"
-#include "../private/fibril.h"
-
-#define DPRINTF(...)  ((void) 0)
-
-/* Client connection data */
-typedef struct {
-	ht_link_t link;
-
-	task_id_t in_task_id;
-	int refcnt;
-	void *data;
-} client_t;
-
-/* Server connection data */
-typedef struct {
-	/** Fibril handling the connection. */
-	fid_t fid;
-
-	/** Hash table link. */
-	ht_link_t link;
-
-	/** Incoming client task ID. */
-	task_id_t in_task_id;
-
-	/** Link to the client tracking structure. */
-	client_t *client;
-
-	/** Channel for messages that should be delivered to this fibril. */
-	mpsc_t *msg_channel;
-
-	/** Call data of the opening call. */
-	ipc_call_t call;
-
-	/** Fibril function that will be used to handle the connection. */
-	async_port_handler_t handler;
-
-	/** Client data */
-	void *data;
-} connection_t;
-
-/* Member of notification_t::msg_list. */
-typedef struct {
-	link_t link;
-	ipc_call_t calldata;
-} notification_msg_t;
-
-/* Notification data */
-typedef struct {
-	/** notification_hash_table link */
-	ht_link_t htlink;
-
-	/** notification_queue link */
-	link_t qlink;
-
-	/** Notification method */
-	sysarg_t imethod;
-
-	/** Notification handler */
-	async_notification_handler_t handler;
-
-	/** Notification handler argument */
-	void *arg;
-
-	/** List of arrived notifications. */
-	list_t msg_list;
-} notification_t;
-
-/** Identifier of the incoming connection handled by the current fibril. */
-static fibril_local connection_t *fibril_connection;
-
-static void *default_client_data_constructor(void)
-{
-	return NULL;
-}
-
-static void default_client_data_destructor(void *data)
-{
-}
-
-static async_client_data_ctor_t async_client_data_create =
-    default_client_data_constructor;
-static async_client_data_dtor_t async_client_data_destroy =
-    default_client_data_destructor;
-
-void async_set_client_data_constructor(async_client_data_ctor_t ctor)
-{
-	assert(async_client_data_create == default_client_data_constructor);
-	async_client_data_create = ctor;
-}
-
-void async_set_client_data_destructor(async_client_data_dtor_t dtor)
-{
-	assert(async_client_data_destroy == default_client_data_destructor);
-	async_client_data_destroy = dtor;
-}
-
-static fibril_rmutex_t client_mutex;
-static hash_table_t client_hash_table;
-
-// TODO: lockfree notification_queue?
-static fibril_rmutex_t notification_mutex;
-static hash_table_t notification_hash_table;
-static LIST_INITIALIZE(notification_queue);
-static FIBRIL_SEMAPHORE_INITIALIZE(notification_semaphore, 0);
-
-static LIST_INITIALIZE(notification_freelist);
-static long notification_freelist_total = 0;
-static long notification_freelist_used = 0;
-
-static sysarg_t notification_avail = 0;
-
-static size_t client_key_hash(const void *key)
-{
-	const task_id_t *in_task_id = key;
-	return *in_task_id;
-}
-
-static size_t client_hash(const ht_link_t *item)
-{
-	client_t *client = hash_table_get_inst(item, client_t, link);
-	return client_key_hash(&client->in_task_id);
-}
-
-static bool client_key_equal(const void *key, size_t, const ht_link_t *item)
-{
-	const task_id_t *in_task_id = key;
-	client_t *client = hash_table_get_inst(item, client_t, link);
-	return *in_task_id == client->in_task_id;
-}
-
-/** Operations for the client hash table. */
-static const hash_table_ops_t client_hash_table_ops = {
-	.hash = client_hash,
-	.key_hash = client_key_hash,
-	.key_equal = client_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static client_t *async_client_get(task_id_t client_id, bool create)
-{
-	client_t *client = NULL;
-
-	fibril_rmutex_lock(&client_mutex);
-	ht_link_t *link = hash_table_find(&client_hash_table, &client_id);
-	if (link) {
-		client = hash_table_get_inst(link, client_t, link);
-		client->refcnt++;
-	} else if (create) {
-		// TODO: move the malloc out of critical section
-		/* malloc() is rmutex safe. */
-		client = malloc(sizeof(client_t));
-		if (client) {
-			client->in_task_id = client_id;
-			client->data = async_client_data_create();
-
-			client->refcnt = 1;
-			hash_table_insert(&client_hash_table, &client->link);
-		}
-	}
-
-	fibril_rmutex_unlock(&client_mutex);
-	return client;
-}
-
-static void async_client_put(client_t *client)
-{
-	bool destroy;
-
-	fibril_rmutex_lock(&client_mutex);
-
-	if (--client->refcnt == 0) {
-		hash_table_remove(&client_hash_table, &client->in_task_id);
-		destroy = true;
-	} else
-		destroy = false;
-
-	fibril_rmutex_unlock(&client_mutex);
-
-	if (destroy) {
-		if (client->data)
-			async_client_data_destroy(client->data);
-
-		free(client);
-	}
-}
-
-/** Wrapper for client connection fibril.
- *
- * When a new connection arrives, a fibril with this implementing
- * function is created.
- *
- * @param arg Connection structure pointer.
- *
- * @return Always zero.
- *
- */
-static errno_t connection_fibril(void *arg)
-{
-	assert(arg);
-
-	/*
-	 * Setup fibril-local connection pointer.
-	 */
-	fibril_connection = (connection_t *) arg;
-
-	mpsc_t *c = fibril_connection->msg_channel;
-
-	/*
-	 * Add our reference for the current connection in the client task
-	 * tracking structure. If this is the first reference, create and
-	 * hash in a new tracking structure.
-	 */
-
-	client_t *client = async_client_get(fibril_connection->in_task_id, true);
-	if (!client) {
-		ipc_answer_0(fibril_connection->call.cap_handle, ENOMEM);
-		goto out;
-	}
-
-	fibril_connection->client = client;
-
-	/*
-	 * Call the connection handler function.
-	 */
-	fibril_connection->handler(&fibril_connection->call,
-	    fibril_connection->data);
-
-	/*
-	 * Remove the reference for this client task connection.
-	 */
-	async_client_put(client);
-
-	/*
-	 * Close the channel, if it isn't closed already.
-	 */
-	mpsc_close(c);
-
-	/*
-	 * Answer all remaining messages with EHANGUP.
-	 */
-	ipc_call_t call;
-	while (mpsc_receive(c, &call, NULL) == EOK)
-		ipc_answer_0(call.cap_handle, EHANGUP);
-
-	/*
-	 * Clean up memory.
-	 */
-out:
-	mpsc_destroy(c);
-	free(fibril_connection);
-	return EOK;
-}
-
-/** Return label usable during replies to IPC_M_CONNECT_ME_TO. */
-sysarg_t async_get_label(void)
-{
-	return (sysarg_t) fibril_connection;
-}
-
-/** Create a new fibril for a new connection.
- *
- * Create new fibril for connection, fill in connection structures and insert it
- * into the hash table, so that later we can easily do routing of messages to
- * particular fibrils.
- *
- * @param conn        Pointer to the connection structure. Will be used as the
- *                    label of the connected phone and request_label of incoming
- *                    calls routed through that phone.
- * @param in_task_id  Identification of the incoming connection.
- * @param call        Call data of the opening call. If call is NULL, the
- *                    connection was opened by accepting the
- *                    IPC_M_CONNECT_TO_ME call and this function is called
- *                    directly by the server.
- * @param handler     Connection handler.
- * @param data        Client argument to pass to the connection handler.
- *
- * @return  New fibril id or NULL on failure.
- *
- */
-static fid_t async_new_connection(connection_t *conn, task_id_t in_task_id,
-    ipc_call_t *call, async_port_handler_t handler, void *data)
-{
-	conn->in_task_id = in_task_id;
-	conn->msg_channel = mpsc_create(sizeof(ipc_call_t));
-	conn->handler = handler;
-	conn->data = data;
-
-	if (!conn->msg_channel)
-		goto error;
-
-	if (call)
-		conn->call = *call;
-	else
-		conn->call.cap_handle = CAP_NIL;
-
-	/* We will activate the fibril ASAP */
-	conn->fid = fibril_create(connection_fibril, conn);
-
-	if (conn->fid == 0)
-		goto error;
-
-	fibril_start(conn->fid);
-
-	return conn->fid;
-
-error:
-	if (conn->msg_channel)
-		mpsc_destroy(conn->msg_channel);
-	free(conn);
-
-	if (call)
-		ipc_answer_0(call->cap_handle, ENOMEM);
-
-	return (fid_t) NULL;
-}
-
-/** Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.
- *
- * Ask through phone for a new connection to some service.
- *
- * @param exch    Exchange for sending the message.
- * @param iface   Callback interface.
- * @param arg1    User defined argument.
- * @param arg2    User defined argument.
- * @param handler Callback handler.
- * @param data    Handler data.
- * @param port_id ID of the newly created port.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_create_callback_port(async_exch_t *exch, iface_t iface, sysarg_t arg1,
-    sysarg_t arg2, async_port_handler_t handler, void *data, port_id_t *port_id)
-{
-	if ((iface & IFACE_MOD_CALLBACK) != IFACE_MOD_CALLBACK)
-		return EINVAL;
-
-	if (exch == NULL)
-		return ENOENT;
-
-	connection_t *conn = calloc(1, sizeof(*conn));
-	if (!conn)
-		return ENOMEM;
-
-	ipc_call_t answer;
-	aid_t req = async_send_5(exch, IPC_M_CONNECT_TO_ME, iface, arg1, arg2,
-	    0, (sysarg_t) conn, &answer);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-	if (rc != EOK) {
-		free(conn);
-		return rc;
-	}
-
-	rc = async_create_port_internal(iface, handler, data, port_id);
-	if (rc != EOK) {
-		free(conn);
-		return rc;
-	}
-
-	fid_t fid = async_new_connection(conn, answer.task_id, NULL, handler,
-	    data);
-	if (fid == (fid_t) NULL)
-		return ENOMEM;
-
-	return EOK;
-}
-
-static size_t notification_key_hash(const void *key)
-{
-	const sysarg_t *id = key;
-	return *id;
-}
-
-static size_t notification_hash(const ht_link_t *item)
-{
-	notification_t *notification =
-	    hash_table_get_inst(item, notification_t, htlink);
-	return notification_key_hash(&notification->imethod);
-}
-
-static bool notification_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const sysarg_t *id = key;
-	notification_t *notification =
-	    hash_table_get_inst(item, notification_t, htlink);
-	return *id == notification->imethod;
-}
-
-/** Operations for the notification hash table. */
-static const hash_table_ops_t notification_hash_table_ops = {
-	.hash = notification_hash,
-	.key_hash = notification_key_hash,
-	.key_equal = notification_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-/** Try to route a call to an appropriate connection fibril.
- *
- * If the proper connection fibril is found, a message with the call is added to
- * its message queue. If the fibril was not active, it is activated and all
- * timeouts are unregistered.
- *
- * @param call Data of the incoming call.
- *
- * @return EOK if the call was successfully passed to the respective fibril.
- * @return ENOENT if the call doesn't match any connection.
- * @return Other error code if routing failed for other reasons.
- *
- */
-static errno_t route_call(ipc_call_t *call)
-{
-	assert(call);
-
-	connection_t *conn = (connection_t *) call->request_label;
-
-	if (!conn)
-		return ENOENT;
-
-	assert(conn->msg_channel);
-
-	errno_t rc = mpsc_send(conn->msg_channel, call);
-
-	if (ipc_get_imethod(call) == IPC_M_PHONE_HUNGUP) {
-		/* Close the channel, but let the connection fibril answer. */
-		mpsc_close(conn->msg_channel);
-		// FIXME: Ideally, we should be able to discard/answer the
-		//        hungup message here and just close the channel without
-		//        passing it out. Unfortunatelly, somehow that breaks
-		//        handling of CPU exceptions.
-	}
-
-	return rc;
-}
-
-/** Function implementing the notification handler fibril. Never returns. */
-static errno_t notification_fibril_func(void *arg)
-{
-	(void) arg;
-
-	while (true) {
-		fibril_semaphore_down(&notification_semaphore);
-
-		fibril_rmutex_lock(&notification_mutex);
-
-		/*
-		 * The semaphore ensures that if we get this far,
-		 * the queue must be non-empty.
-		 */
-		assert(!list_empty(&notification_queue));
-
-		notification_t *notification = list_get_instance(
-		    list_first(&notification_queue), notification_t, qlink);
-
-		async_notification_handler_t handler = notification->handler;
-		void *arg = notification->arg;
-
-		notification_msg_t *m = list_pop(&notification->msg_list,
-		    notification_msg_t, link);
-		assert(m);
-		ipc_call_t calldata = m->calldata;
-
-		notification_freelist_used--;
-
-		if (notification_freelist_total > 64 &&
-		    notification_freelist_total > 2 * notification_freelist_used) {
-			/* Going to free the structure if we have too much. */
-			notification_freelist_total--;
-		} else {
-			/* Otherwise add to freelist. */
-			list_append(&m->link, &notification_freelist);
-			m = NULL;
-		}
-
-		if (list_empty(&notification->msg_list))
-			list_remove(&notification->qlink);
-
-		fibril_rmutex_unlock(&notification_mutex);
-
-		if (handler)
-			handler(&calldata, arg);
-
-		free(m);
-	}
-
-	/* Not reached. */
-	return EOK;
-}
-
-/**
- * Creates a new dedicated fibril for handling notifications.
- * By default, there is one such fibril. This function can be used to
- * create more in order to increase the number of notification that can
- * be processed concurrently.
- *
- * Currently, there is no way to destroy those fibrils after they are created.
- */
-errno_t async_spawn_notification_handler(void)
-{
-	fid_t f = fibril_create(notification_fibril_func, NULL);
-	if (f == 0)
-		return ENOMEM;
-
-	fibril_add_ready(f);
-	return EOK;
-}
-
-/** Queue notification.
- *
- * @param call   Data of the incoming call.
- *
- */
-static void queue_notification(ipc_call_t *call)
-{
-	assert(call);
-
-	fibril_rmutex_lock(&notification_mutex);
-
-	notification_msg_t *m = list_pop(&notification_freelist,
-	    notification_msg_t, link);
-
-	if (!m) {
-		fibril_rmutex_unlock(&notification_mutex);
-		m = malloc(sizeof(notification_msg_t));
-		if (!m) {
-			DPRINTF("Out of memory.\n");
-			abort();
-		}
-
-		fibril_rmutex_lock(&notification_mutex);
-		notification_freelist_total++;
-	}
-
-	sysarg_t imethod = ipc_get_imethod(call);
-	ht_link_t *link = hash_table_find(&notification_hash_table, &imethod);
-	if (!link) {
-		/* Invalid notification. */
-		// TODO: Make sure this can't happen and turn it into assert.
-		notification_freelist_total--;
-		fibril_rmutex_unlock(&notification_mutex);
-		free(m);
-		return;
-	}
-
-	notification_t *notification =
-	    hash_table_get_inst(link, notification_t, htlink);
-
-	notification_freelist_used++;
-	m->calldata = *call;
-	list_append(&m->link, &notification->msg_list);
-
-	if (!link_in_use(&notification->qlink))
-		list_append(&notification->qlink, &notification_queue);
-
-	fibril_rmutex_unlock(&notification_mutex);
-
-	fibril_semaphore_up(&notification_semaphore);
-}
-
-/**
- * Creates a new notification structure and inserts it into the hash table.
- *
- * @param handler  Function to call when notification is received.
- * @param arg      Argument for the handler function.
- * @return         The newly created notification structure.
- */
-static notification_t *notification_create(async_notification_handler_t handler, void *arg)
-{
-	notification_t *notification = calloc(1, sizeof(notification_t));
-	if (!notification)
-		return NULL;
-
-	notification->handler = handler;
-	notification->arg = arg;
-
-	list_initialize(&notification->msg_list);
-
-	fid_t fib = 0;
-
-	fibril_rmutex_lock(&notification_mutex);
-
-	if (notification_avail == 0) {
-		/* Attempt to create the first handler fibril. */
-		fib = fibril_create(notification_fibril_func, NULL);
-		if (fib == 0) {
-			fibril_rmutex_unlock(&notification_mutex);
-			free(notification);
-			return NULL;
-		}
-	}
-
-	sysarg_t imethod = notification_avail;
-	notification_avail++;
-
-	notification->imethod = imethod;
-	hash_table_insert(&notification_hash_table, &notification->htlink);
-
-	fibril_rmutex_unlock(&notification_mutex);
-
-	if (imethod == 0) {
-		assert(fib);
-		fibril_add_ready(fib);
-	}
-
-	return notification;
-}
-
-/** Subscribe to IRQ notification.
- *
- * @param inr     IRQ number.
- * @param handler Notification handler.
- * @param data    Notification handler client data.
- * @param ucode   Top-half pseudocode handler.
- *
- * @param[out] handle  IRQ capability handle on success.
- *
- * @return An error code.
- *
- */
-errno_t async_irq_subscribe(int inr, async_notification_handler_t handler,
-    void *data, const irq_code_t *ucode, cap_irq_handle_t *handle)
-{
-	notification_t *notification = notification_create(handler, data);
-	if (!notification)
-		return ENOMEM;
-
-	cap_irq_handle_t ihandle;
-	errno_t rc = ipc_irq_subscribe(inr, notification->imethod, ucode,
-	    &ihandle);
-	if (rc == EOK && handle != NULL) {
-		*handle = ihandle;
-	}
-	return rc;
-}
-
-/** Unsubscribe from IRQ notification.
- *
- * @param handle  IRQ capability handle.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_irq_unsubscribe(cap_irq_handle_t ihandle)
-{
-	// TODO: Remove entry from hash table
-	//       to avoid memory leak
-
-	return ipc_irq_unsubscribe(ihandle);
-}
-
-/** Subscribe to event notifications.
- *
- * @param evno    Event type to subscribe.
- * @param handler Notification handler.
- * @param data    Notification handler client data.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_event_subscribe(event_type_t evno,
-    async_notification_handler_t handler, void *data)
-{
-	notification_t *notification = notification_create(handler, data);
-	if (!notification)
-		return ENOMEM;
-
-	return ipc_event_subscribe(evno, notification->imethod);
-}
-
-/** Subscribe to task event notifications.
- *
- * @param evno    Event type to subscribe.
- * @param handler Notification handler.
- * @param data    Notification handler client data.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_event_task_subscribe(event_task_type_t evno,
-    async_notification_handler_t handler, void *data)
-{
-	notification_t *notification = notification_create(handler, data);
-	if (!notification)
-		return ENOMEM;
-
-	return ipc_event_task_subscribe(evno, notification->imethod);
-}
-
-/** Unmask event notifications.
- *
- * @param evno Event type to unmask.
- *
- * @return Value returned by the kernel.
- *
- */
-errno_t async_event_unmask(event_type_t evno)
-{
-	return ipc_event_unmask(evno);
-}
-
-/** Unmask task event notifications.
- *
- * @param evno Event type to unmask.
- *
- * @return Value returned by the kernel.
- *
- */
-errno_t async_event_task_unmask(event_task_type_t evno)
-{
-	return ipc_event_task_unmask(evno);
-}
-
-/** Return new incoming message for the current (fibril-local) connection.
- *
- * @param call  Storage where the incoming call data will be stored.
- * @param usecs Timeout in microseconds. Zero denotes no timeout.
- *
- * @return If no timeout was specified, then true is returned.
- * @return If a timeout is specified, then true is returned unless
- *         the timeout expires prior to receiving a message.
- *
- */
-bool async_get_call_timeout(ipc_call_t *call, usec_t usecs)
-{
-	assert(call);
-	assert(fibril_connection);
-
-	struct timespec ts;
-	struct timespec *expires = NULL;
-	if (usecs) {
-		getuptime(&ts);
-		ts_add_diff(&ts, USEC2NSEC(usecs));
-		expires = &ts;
-	}
-
-	errno_t rc = mpsc_receive(fibril_connection->msg_channel,
-	    call, expires);
-
-	if (rc == ETIMEOUT)
-		return false;
-
-	if (rc != EOK) {
-		/*
-		 * The async_get_call_timeout() interface doesn't support
-		 * propagating errors. Return a null call instead.
-		 */
-
-		memset(call, 0, sizeof(ipc_call_t));
-		ipc_set_imethod(call, IPC_M_PHONE_HUNGUP);
-		call->cap_handle = CAP_NIL;
-	}
-
-	return true;
-}
-
-bool async_get_call(ipc_call_t *call)
-{
-	return async_get_call_timeout(call, 0);
-}
-
-void *async_get_client_data(void)
-{
-	assert(fibril_connection);
-	return fibril_connection->client->data;
-}
-
-void *async_get_client_data_by_id(task_id_t client_id)
-{
-	client_t *client = async_client_get(client_id, false);
-	if (!client)
-		return NULL;
-
-	if (!client->data) {
-		async_client_put(client);
-		return NULL;
-	}
-
-	return client->data;
-}
-
-void async_put_client_data_by_id(task_id_t client_id)
-{
-	client_t *client = async_client_get(client_id, false);
-
-	assert(client);
-	assert(client->data);
-
-	/* Drop the reference we got in async_get_client_data_by_hash(). */
-	async_client_put(client);
-
-	/* Drop our own reference we got at the beginning of this function. */
-	async_client_put(client);
-}
-
-/** Handle a call that was received.
- *
- * If the call has the IPC_M_CONNECT_ME_TO method, a new connection is created.
- * Otherwise the call is routed to its connection fibril.
- *
- * @param call Data of the incoming call.
- *
- */
-static void handle_call(ipc_call_t *call)
-{
-	assert(call);
-
-	if (call->flags & IPC_CALL_ANSWERED) {
-		/* Answer to a call made by us. */
-		async_reply_received(call);
-		return;
-	}
-
-	if (call->cap_handle == CAP_NIL) {
-		if (call->flags & IPC_CALL_NOTIF) {
-			/* Kernel notification */
-			queue_notification(call);
-		}
-		return;
-	}
-
-	/* New connection */
-	if (ipc_get_imethod(call) == IPC_M_CONNECT_ME_TO) {
-		connection_t *conn = calloc(1, sizeof(*conn));
-		if (!conn) {
-			ipc_answer_0(call->cap_handle, ENOMEM);
-			return;
-		}
-
-		iface_t iface = (iface_t) ipc_get_arg1(call);
-
-		// TODO: Currently ignores all ports but the first one.
-		void *data;
-		async_port_handler_t handler =
-		    async_get_port_handler(iface, 0, &data);
-
-		async_new_connection(conn, call->task_id, call, handler, data);
-		return;
-	}
-
-	/* Route the call according to its request label */
-	errno_t rc = route_call(call);
-	if (rc == EOK)
-		return;
-
-	// TODO: Log the error.
-
-	if (call->cap_handle != CAP_NIL)
-		/* Unknown call from unknown phone - hang it up */
-		ipc_answer_0(call->cap_handle, EHANGUP);
-}
-
-/** Endless loop dispatching incoming calls and answers.
- *
- * @return Never returns.
- *
- */
-static errno_t async_manager_worker(void)
-{
-	ipc_call_t call;
-	errno_t rc;
-
-	while (true) {
-		rc = fibril_ipc_wait(&call, NULL);
-		if (rc == EOK)
-			handle_call(&call);
-	}
-
-	return 0;
-}
-
-/** Function to start async_manager as a standalone fibril.
- *
- * When more kernel threads are used, one async manager should exist per thread.
- *
- * @param arg Unused.
- * @return Never returns.
- *
- */
-static errno_t async_manager_fibril(void *arg)
-{
-	async_manager_worker();
-	return 0;
-}
-
-/** Add one manager to manager list. */
-static fid_t async_create_manager(void)
-{
-	fid_t fid = fibril_create_generic(async_manager_fibril, NULL, PAGE_SIZE);
-	fibril_start(fid);
-	return fid;
-}
-
-/** Initialize the async framework.
- *
- */
-void __async_server_init(void)
-{
-	if (fibril_rmutex_initialize(&client_mutex) != EOK)
-		abort();
-	if (fibril_rmutex_initialize(&notification_mutex) != EOK)
-		abort();
-
-	if (!hash_table_create(&client_hash_table, 0, 0, &client_hash_table_ops))
-		abort();
-
-	if (!hash_table_create(&notification_hash_table, 0, 0,
-	    &notification_hash_table_ops))
-		abort();
-
-	async_create_manager();
-}
-
-void __async_server_fini(void)
-{
-	fibril_rmutex_destroy(&client_mutex);
-	fibril_rmutex_destroy(&notification_mutex);
-}
-
-errno_t async_accept_0(ipc_call_t *call)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_5(chandle, EOK, 0, 0, 0, 0, async_get_label());
-}
-
-errno_t async_answer_0(ipc_call_t *call, errno_t retval)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_0(chandle, retval);
-}
-
-errno_t async_answer_1(ipc_call_t *call, errno_t retval, sysarg_t arg1)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_1(chandle, retval, arg1);
-}
-
-errno_t async_answer_2(ipc_call_t *call, errno_t retval, sysarg_t arg1,
-    sysarg_t arg2)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_2(chandle, retval, arg1, arg2);
-}
-
-errno_t async_answer_3(ipc_call_t *call, errno_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_3(chandle, retval, arg1, arg2, arg3);
-}
-
-errno_t async_answer_4(ipc_call_t *call, errno_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_4(chandle, retval, arg1, arg2, arg3, arg4);
-}
-
-errno_t async_answer_5(ipc_call_t *call, errno_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
-{
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-	return ipc_answer_5(chandle, retval, arg1, arg2, arg3, arg4, arg5);
-}
-
-static errno_t async_forward_fast(ipc_call_t *call, async_exch_t *exch,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
-{
-	assert(call);
-
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-
-	if (exch == NULL)
-		return ENOENT;
-
-	return ipc_forward_fast(chandle, exch->phone, imethod, arg1, arg2,
-	    mode);
-}
-
-static errno_t async_forward_slow(ipc_call_t *call, async_exch_t *exch,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
-    sysarg_t arg4, sysarg_t arg5, unsigned int mode)
-{
-	assert(call);
-
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-
-	if (exch == NULL)
-		return ENOENT;
-
-	return ipc_forward_slow(chandle, exch->phone, imethod, arg1, arg2, arg3,
-	    arg4, arg5, mode);
-}
-
-errno_t async_forward_0(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    unsigned int mode)
-{
-	return async_forward_fast(call, exch, imethod, 0, 0, mode);
-}
-
-errno_t async_forward_1(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, unsigned int mode)
-{
-	return async_forward_fast(call, exch, imethod, arg1, 0, mode);
-}
-
-errno_t async_forward_2(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, unsigned int mode)
-{
-	return async_forward_fast(call, exch, imethod, arg1, arg2, mode);
-}
-
-errno_t async_forward_3(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, unsigned int mode)
-{
-	return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, 0, 0,
-	    mode);
-}
-
-errno_t async_forward_4(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
-    unsigned int mode)
-{
-	return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, arg4,
-	    0, mode);
-}
-
-errno_t async_forward_5(ipc_call_t *call, async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
-    unsigned int mode)
-{
-	return async_forward_slow(call, exch, imethod, arg1, arg2, arg3, arg4,
-	    arg5, mode);
-}
-
-/** Wrapper for making IPC_M_CONNECT_TO_ME calls using the async framework.
- *
- * Ask through phone for a new connection to some service.
- *
- * @param exch  Exchange for sending the message.
- * @param iface Callback interface.
- * @param arg2  User defined argument.
- * @param arg3  User defined argument.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t async_connect_to_me(async_exch_t *exch, iface_t iface, sysarg_t arg2,
-    sysarg_t arg3)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	sysarg_t label = 0;
-	errno_t rc = async_req_5_0(exch, IPC_M_CONNECT_TO_ME, iface, arg2, arg3,
-	    0, label);
-
-	return rc;
-}
-
-/** Wrapper for receiving the IPC_M_SHARE_IN calls using the async framework.
- *
- * This wrapper only makes it more comfortable to receive IPC_M_SHARE_IN
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * So far, this wrapper is to be used from within a connection fibril.
- *
- * @param call Storage for the data of the IPC_M_SHARE_IN call.
- * @param size Destination address space area size.
- *
- * @return True on success, false on failure.
- *
- */
-bool async_share_in_receive(ipc_call_t *call, size_t *size)
-{
-	assert(call);
-	assert(size);
-
-	async_get_call(call);
-
-	if (ipc_get_imethod(call) != IPC_M_SHARE_IN)
-		return false;
-
-	*size = (size_t) ipc_get_arg1(call);
-	return true;
-}
-
-/** Wrapper for answering the IPC_M_SHARE_IN calls using the async framework.
- *
- * This wrapper only makes it more comfortable to answer IPC_M_SHARE_IN
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * @param call  IPC_M_SHARE_IN call to answer.
- * @param src   Source address space base.
- * @param flags Flags to be used for sharing. Bits can be only cleared.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t async_share_in_finalize(ipc_call_t *call, void *src, unsigned int flags)
-{
-	assert(call);
-
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-
-	return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) flags);
-}
-
-/** Wrapper for receiving the IPC_M_SHARE_OUT calls using the async framework.
- *
- * This wrapper only makes it more comfortable to receive IPC_M_SHARE_OUT
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * So far, this wrapper is to be used from within a connection fibril.
- *
- * @param call  Storage for the data of the IPC_M_SHARE_OUT call.
- * @param size  Storage for the source address space area size.
- * @param flags Storage for the sharing flags.
- *
- * @return True on success, false on failure.
- *
- */
-bool async_share_out_receive(ipc_call_t *call, size_t *size,
-    unsigned int *flags)
-{
-	assert(call);
-	assert(size);
-	assert(flags);
-
-	async_get_call(call);
-
-	if (ipc_get_imethod(call) != IPC_M_SHARE_OUT)
-		return false;
-
-	*size = (size_t) ipc_get_arg2(call);
-	*flags = (unsigned int) ipc_get_arg3(call);
-	return true;
-}
-
-/** Wrapper for answering the IPC_M_SHARE_OUT calls using the async framework.
- *
- * This wrapper only makes it more comfortable to answer IPC_M_SHARE_OUT
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * @param call IPC_M_SHARE_OUT call to answer.
- * @param dst  Address of the storage for the destination address space area
- *             base address.
- *
- * @return  Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t async_share_out_finalize(ipc_call_t *call, void **dst)
-{
-	assert(call);
-
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-
-	return ipc_answer_2(chandle, EOK, (sysarg_t) __progsymbols.end,
-	    (sysarg_t) dst);
-}
-
-/** Wrapper for receiving the IPC_M_DATA_READ calls using the async framework.
- *
- * This wrapper only makes it more comfortable to receive IPC_M_DATA_READ
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * So far, this wrapper is to be used from within a connection fibril.
- *
- * @param call Storage for the data of the IPC_M_DATA_READ.
- * @param size Storage for the maximum size. Can be NULL.
- *
- * @return True on success, false on failure.
- *
- */
-bool async_data_read_receive(ipc_call_t *call, size_t *size)
-{
-	assert(call);
-
-	async_get_call(call);
-
-	if (ipc_get_imethod(call) != IPC_M_DATA_READ)
-		return false;
-
-	if (size)
-		*size = (size_t) ipc_get_arg2(call);
-
-	return true;
-}
-
-/** Wrapper for answering the IPC_M_DATA_READ calls using the async framework.
- *
- * This wrapper only makes it more comfortable to answer IPC_M_DATA_READ
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * @param call IPC_M_DATA_READ call to answer.
- * @param src  Source address for the IPC_M_DATA_READ call.
- * @param size Size for the IPC_M_DATA_READ call. Can be smaller than
- *             the maximum size announced by the sender.
- *
- * @return  Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t async_data_read_finalize(ipc_call_t *call, const void *src, size_t size)
-{
-	assert(call);
-
-	cap_call_handle_t chandle = call->cap_handle;
-	assert(chandle != CAP_NIL);
-	call->cap_handle = CAP_NIL;
-
-	return ipc_answer_2(chandle, EOK, (sysarg_t) src, (sysarg_t) size);
-}
-
-/** Wrapper for forwarding any read request
- *
- */
-static errno_t async_data_read_forward_fast(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
-    ipc_call_t *dataptr)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	ipc_call_t call;
-	if (!async_data_read_receive(&call, NULL)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	aid_t msg = async_send_4(exch, imethod, arg1, arg2, arg3, arg4,
-	    dataptr);
-	if (msg == 0) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	errno_t retval = ipc_forward_fast(call.cap_handle, exch->phone, 0, 0, 0,
-	    IPC_FF_ROUTE_FROM_ME);
-	if (retval != EOK) {
-		async_forget(msg);
-		async_answer_0(&call, retval);
-		return retval;
-	}
-
-	errno_t rc;
-	async_wait_for(msg, &rc);
-
-	return (errno_t) rc;
-}
-
-errno_t async_data_read_forward_0_0(async_exch_t *exch, sysarg_t imethod)
-{
-	return async_data_read_forward_fast(exch, imethod, 0, 0, 0, 0, NULL);
-}
-
-errno_t async_data_read_forward_1_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, 0, 0, 0, NULL);
-}
-
-errno_t async_data_read_forward_2_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, 0,
-	    0, NULL);
-}
-
-errno_t async_data_read_forward_3_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    0, NULL);
-}
-
-errno_t async_data_read_forward_4_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    arg4, NULL);
-}
-
-errno_t async_data_read_forward_0_1(async_exch_t *exch, sysarg_t imethod,
-    ipc_call_t *dataptr)
-{
-	return async_data_read_forward_fast(exch, imethod, 0, 0, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_read_forward_1_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, ipc_call_t *dataptr)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, 0, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_read_forward_2_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, ipc_call_t *dataptr)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_read_forward_3_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_call_t *dataptr)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    0, dataptr);
-}
-
-errno_t async_data_read_forward_4_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
-    ipc_call_t *dataptr)
-{
-	return async_data_read_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    arg4, dataptr);
-}
-
-/** Wrapper for receiving the IPC_M_DATA_WRITE calls using the async framework.
- *
- * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * So far, this wrapper is to be used from within a connection fibril.
- *
- * @param call Storage for the data of the IPC_M_DATA_WRITE.
- * @param size Storage for the suggested size. May be NULL.
- *
- * @return True on success, false on failure.
- *
- */
-bool async_data_write_receive(ipc_call_t *call, size_t *size)
-{
-	assert(call);
-
-	async_get_call(call);
-
-	if (ipc_get_imethod(call) != IPC_M_DATA_WRITE)
-		return false;
-
-	if (size)
-		*size = (size_t) ipc_get_arg2(call);
-
-	return true;
-}
-
-/** Wrapper for answering the IPC_M_DATA_WRITE calls using the async framework.
- *
- * This wrapper only makes it more comfortable to answer IPC_M_DATA_WRITE
- * calls so that the user doesn't have to remember the meaning of each IPC
- * argument.
- *
- * @param call IPC_M_DATA_WRITE call to answer.
- * @param dst  Final destination address for the IPC_M_DATA_WRITE call.
- * @param size Final size for the IPC_M_DATA_WRITE call.
- *
- * @return  Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t async_data_write_finalize(ipc_call_t *call, void *dst, size_t size)
-{
-	assert(call);
-
-	return async_answer_2(call, EOK, (sysarg_t) dst, (sysarg_t) size);
-}
-
-/** Wrapper for receiving binary data or strings
- *
- * This wrapper only makes it more comfortable to use async_data_write_*
- * functions to receive binary data or strings.
- *
- * @param data       Pointer to data pointer (which should be later disposed
- *                   by free()). If the operation fails, the pointer is not
- *                   touched.
- * @param nullterm   If true then the received data is always zero terminated.
- *                   This also causes to allocate one extra byte beyond the
- *                   raw transmitted data.
- * @param min_size   Minimum size (in bytes) of the data to receive.
- * @param max_size   Maximum size (in bytes) of the data to receive. 0 means
- *                   no limit.
- * @param granulariy If non-zero then the size of the received data has to
- *                   be divisible by this value.
- * @param received   If not NULL, the size of the received data is stored here.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t async_data_write_accept(void **data, const bool nullterm,
-    const size_t min_size, const size_t max_size, const size_t granularity,
-    size_t *received)
-{
-	assert(data);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	if (size < min_size) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	if ((max_size > 0) && (size > max_size)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	if ((granularity > 0) && ((size % granularity) != 0)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	void *arg_data;
-
-	if (nullterm)
-		arg_data = malloc(size + 1);
-	else
-		arg_data = malloc(size);
-
-	if (arg_data == NULL) {
-		async_answer_0(&call, ENOMEM);
-		return ENOMEM;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, arg_data, size);
-	if (rc != EOK) {
-		free(arg_data);
-		return rc;
-	}
-
-	if (nullterm)
-		((char *) arg_data)[size] = 0;
-
-	*data = arg_data;
-	if (received != NULL)
-		*received = size;
-
-	return EOK;
-}
-
-/** Wrapper for voiding any data that is about to be received
- *
- * This wrapper can be used to void any pending data
- *
- * @param retval Error value from @ref errno.h to be returned to the caller.
- *
- */
-void async_data_write_void(errno_t retval)
-{
-	ipc_call_t call;
-	async_data_write_receive(&call, NULL);
-	async_answer_0(&call, retval);
-}
-
-/** Wrapper for forwarding any data that is about to be received
- *
- */
-static errno_t async_data_write_forward_fast(async_exch_t *exch,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
-    sysarg_t arg4, ipc_call_t *dataptr)
-{
-	if (exch == NULL)
-		return ENOENT;
-
-	ipc_call_t call;
-	if (!async_data_write_receive(&call, NULL)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	aid_t msg = async_send_4(exch, imethod, arg1, arg2, arg3, arg4,
-	    dataptr);
-	if (msg == 0) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	errno_t retval = ipc_forward_fast(call.cap_handle, exch->phone, 0, 0, 0,
-	    IPC_FF_ROUTE_FROM_ME);
-	if (retval != EOK) {
-		async_forget(msg);
-		async_answer_0(&call, retval);
-		return retval;
-	}
-
-	errno_t rc;
-	async_wait_for(msg, &rc);
-
-	return (errno_t) rc;
-}
-
-errno_t async_data_write_forward_0_0(async_exch_t *exch, sysarg_t imethod)
-{
-	return async_data_write_forward_fast(exch, imethod, 0, 0, 0,
-	    0, NULL);
-}
-
-errno_t async_data_write_forward_1_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, 0, 0,
-	    0, NULL);
-}
-
-errno_t async_data_write_forward_2_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, 0,
-	    0, NULL);
-}
-
-errno_t async_data_write_forward_3_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    0, NULL);
-}
-
-errno_t async_data_write_forward_4_0(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    arg4, NULL);
-}
-
-errno_t async_data_write_forward_0_1(async_exch_t *exch, sysarg_t imethod,
-    ipc_call_t *dataptr)
-{
-	return async_data_write_forward_fast(exch, imethod, 0, 0, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_write_forward_1_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, ipc_call_t *dataptr)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, 0, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_write_forward_2_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, ipc_call_t *dataptr)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, 0,
-	    0, dataptr);
-}
-
-errno_t async_data_write_forward_3_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, ipc_call_t *dataptr)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    0, dataptr);
-}
-
-errno_t async_data_write_forward_4_1(async_exch_t *exch, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4,
-    ipc_call_t *dataptr)
-{
-	return async_data_write_forward_fast(exch, imethod, arg1, arg2, arg3,
-	    arg4, dataptr);
-}
-
-/** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
- *
- * If the current call is IPC_M_CONNECT_TO_ME then a new
- * async session is created for the accepted phone.
- *
- * @param mgmt Exchange management style.
- *
- * @return New async session.
- * @return NULL on failure.
- *
- */
-async_sess_t *async_callback_receive(exch_mgmt_t mgmt)
-{
-	/* Accept the phone */
-	ipc_call_t call;
-	async_get_call(&call);
-
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(&call);
-
-	if ((ipc_get_imethod(&call) != IPC_M_CONNECT_TO_ME) ||
-	    !cap_handle_valid((phandle))) {
-		async_answer_0(&call, EINVAL);
-		return NULL;
-	}
-
-	async_sess_t *sess = calloc(1, sizeof(async_sess_t));
-	if (sess == NULL) {
-		async_answer_0(&call, ENOMEM);
-		return NULL;
-	}
-
-	sess->iface = 0;
-	sess->mgmt = mgmt;
-	sess->phone = phandle;
-
-	fibril_mutex_initialize(&sess->remote_state_mtx);
-	list_initialize(&sess->exch_list);
-	fibril_mutex_initialize(&sess->mutex);
-
-	/* Acknowledge the connected phone */
-	async_answer_0(&call, EOK);
-
-	return sess;
-}
-
-/** Wrapper for receiving the IPC_M_CONNECT_TO_ME calls.
- *
- * If the call is IPC_M_CONNECT_TO_ME then a new
- * async session is created. However, the phone is
- * not accepted automatically.
- *
- * @param mgmt   Exchange management style.
- * @param call   Call data.
- *
- * @return New async session.
- * @return NULL on failure.
- * @return NULL if the call is not IPC_M_CONNECT_TO_ME.
- *
- */
-async_sess_t *async_callback_receive_start(exch_mgmt_t mgmt, ipc_call_t *call)
-{
-	cap_phone_handle_t phandle = (cap_handle_t) ipc_get_arg5(call);
-
-	if ((ipc_get_imethod(call) != IPC_M_CONNECT_TO_ME) ||
-	    !cap_handle_valid((phandle)))
-		return NULL;
-
-	async_sess_t *sess = calloc(1, sizeof(async_sess_t));
-	if (sess == NULL)
-		return NULL;
-
-	sess->iface = 0;
-	sess->mgmt = mgmt;
-	sess->phone = phandle;
-
-	fibril_mutex_initialize(&sess->remote_state_mtx);
-	list_initialize(&sess->exch_list);
-	fibril_mutex_initialize(&sess->mutex);
-
-	return sess;
-}
-
-bool async_state_change_receive(ipc_call_t *call)
-{
-	assert(call);
-
-	async_get_call(call);
-
-	if (ipc_get_imethod(call) != IPC_M_STATE_CHANGE_AUTHORIZE)
-		return false;
-
-	return true;
-}
-
-errno_t async_state_change_finalize(ipc_call_t *call, async_exch_t *other_exch)
-{
-	assert(call);
-
-	return async_answer_1(call, EOK, cap_handle_raw(other_exch->phone));
-}
-
-__noreturn void async_manager(void)
-{
-	fibril_event_t ever = FIBRIL_EVENT_INIT;
-	fibril_wait_for(&ever);
-	__builtin_unreachable();
-}
-
-/** @}
- */
Index: pace/lib/c/generic/capa.c
===================================================================
--- uspace/lib/c/generic/capa.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,332 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file Storage capacity specification.
- */
-
-#include <assert.h>
-#include <capa.h>
-#include <errno.h>
-#include <imath.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <str.h>
-
-/** Simplified capacity parameters */
-enum {
-	/** Simplified capacity maximum integer digits */
-	scapa_max_idig = 3,
-	/** Simplified capacity maximum significant digits */
-	scapa_max_sdig = 4
-};
-
-static const char *cu_str[] = {
-	[cu_byte] = "B",
-	[cu_kbyte] = "kB",
-	[cu_mbyte] = "MB",
-	[cu_gbyte] = "GB",
-	[cu_tbyte] = "TB",
-	[cu_pbyte] = "PB",
-	[cu_ebyte] = "EB",
-	[cu_zbyte] = "ZB",
-	[cu_ybyte] = "YB"
-};
-
-void capa_from_blocks(uint64_t nblocks, size_t block_size, capa_spec_t *capa)
-{
-	uint64_t tsize;
-
-	tsize = nblocks * block_size;
-	capa->m = tsize;
-	capa->dp = 0;
-	capa->cunit = cu_byte;
-}
-
-/** Convert capacity to blocks.
- *
- * If the value of bytes is not integer, it is properly rounded. If the number
- * of bytes is not divisible by the number of blocks, it is rounded
- * up to an integer number of blocks.
- *
- * A capacity value entails precision, i.e. it corresponds to a range
- * of values. @a cvsel selects the value to return. @c cv_nom gives
- * the nominal (middle) value, @c cv_min gives the minimum value
- * and @c cv_max gives the maximum value.
- */
-errno_t capa_to_blocks(capa_spec_t *capa, capa_vsel_t cvsel, size_t block_size,
-    uint64_t *rblocks)
-{
-	int exp;
-	uint64_t bytes;
-	uint64_t f;
-	uint64_t adj;
-	uint64_t blocks;
-	uint64_t rem;
-	errno_t rc;
-
-	exp = capa->cunit * 3 - capa->dp;
-	if (exp < 0) {
-		rc = ipow10_u64(-exp, &f);
-		if (rc != EOK)
-			return ERANGE;
-		bytes = (capa->m + (f / 2)) / f;
-		if (bytes * f - (f / 2) != capa->m)
-			return ERANGE;
-	} else {
-		rc = ipow10_u64(exp, &f);
-		if (rc != EOK)
-			return ERANGE;
-
-		adj = 0;
-		switch (cvsel) {
-		case cv_nom:
-			adj = 0;
-			break;
-		case cv_min:
-			adj = -(f / 2);
-			break;
-		case cv_max:
-			adj = f / 2 - 1;
-			break;
-		}
-
-		bytes = capa->m * f + adj;
-		if ((bytes - adj) / f != capa->m)
-			return ERANGE;
-	}
-
-	rem = bytes % block_size;
-	if ((bytes + rem) < bytes)
-		return ERANGE;
-
-	blocks = (bytes + rem) / block_size;
-
-	*rblocks = blocks;
-	return EOK;
-}
-
-/** Simplify and round capacity to a human-friendly form.
- *
- * Change unit and round the number so that we have at most three integer
- * digits and at most two fractional digits, e.g abc.xy <unit>.
- */
-void capa_simplify(capa_spec_t *capa)
-{
-	uint64_t div;
-	uint64_t maxv;
-	unsigned sdig;
-	unsigned rdig;
-	errno_t rc;
-
-	/* Change units so that we have at most @c scapa_max_idig integer digits */
-	rc = ipow10_u64(scapa_max_idig, &maxv);
-	assert(rc == EOK);
-
-	rc = ipow10_u64(capa->dp, &div);
-	assert(rc == EOK);
-
-	/* Change units until we have no more than scapa_max_idig integer digits */
-	while (capa->m / div >= maxv) {
-		++capa->cunit;
-		capa->dp += 3;
-		div = div * 1000;
-	}
-
-	/* Round the number so that we have at most @c scapa_max_sdig significant digits */
-	sdig = 1 + ilog10_u64(capa->m); /* number of significant digits */
-	if (sdig > scapa_max_sdig) {
-		/* Number of digits to remove */
-		rdig = sdig - scapa_max_sdig;
-		if (rdig > capa->dp)
-			rdig = capa->dp;
-
-		rc = ipow10_u64(rdig, &div);
-		assert(rc == EOK);
-
-		/* Division with rounding */
-		capa->m = (capa->m + (div / 2)) / div;
-		capa->dp -= rdig;
-	}
-
-	/*
-	 * If we rounded up from something like 999.95 to 1000.0,, we still
-	 * have more than scapa_max_idig integer digits and need to change
-	 * units once more.
-	 */
-	rc = ipow10_u64(capa->dp, &div);
-	assert(rc == EOK);
-
-	if (capa->m / div >= 1000) {
-		++capa->cunit;
-		capa->dp += 3;
-
-		/*
-		 * We now have one more significant digit than we want
-		 * so round to one less digits
-		 */
-		capa->m = (capa->m + 5) / 10;
-		--capa->dp;
-	}
-}
-
-errno_t capa_format(capa_spec_t *capa, char **rstr)
-{
-	errno_t rc;
-	int ret;
-	const char *sunit;
-	uint64_t ipart;
-	uint64_t fpart;
-	uint64_t div;
-
-	sunit = NULL;
-
-	assert(capa->cunit < CU_LIMIT);
-
-	rc = ipow10_u64(capa->dp, &div);
-	if (rc != EOK)
-		return rc;
-
-	ipart = capa->m / div;
-	fpart = capa->m % div;
-
-	sunit = cu_str[capa->cunit];
-	if (capa->dp > 0) {
-		ret = asprintf(rstr, "%" PRIu64 ".%0*" PRIu64 " %s", ipart,
-		    (int)capa->dp, fpart, sunit);
-	} else {
-		ret = asprintf(rstr, "%" PRIu64 " %s", ipart, sunit);
-	}
-
-	if (ret < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
-static errno_t capa_digit_val(char c, int *val)
-{
-	switch (c) {
-	case '0':
-		*val = 0;
-		break;
-	case '1':
-		*val = 1;
-		break;
-	case '2':
-		*val = 2;
-		break;
-	case '3':
-		*val = 3;
-		break;
-	case '4':
-		*val = 4;
-		break;
-	case '5':
-		*val = 5;
-		break;
-	case '6':
-		*val = 6;
-		break;
-	case '7':
-		*val = 7;
-		break;
-	case '8':
-		*val = 8;
-		break;
-	case '9':
-		*val = 9;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-errno_t capa_parse(const char *str, capa_spec_t *capa)
-{
-	const char *eptr;
-	const char *p;
-	int d;
-	int dp;
-	unsigned long m;
-	int i;
-
-	m = 0;
-
-	eptr = str;
-	while (capa_digit_val(*eptr, &d) == EOK) {
-		m = m * 10 + d;
-		++eptr;
-	}
-
-	if (*eptr == '.') {
-		++eptr;
-		dp = 0;
-		while (capa_digit_val(*eptr, &d) == EOK) {
-			m = m * 10 + d;
-			++dp;
-			++eptr;
-		}
-	} else {
-		dp = 0;
-	}
-
-	while (*eptr == ' ')
-		++eptr;
-
-	if (*eptr == '\0') {
-		capa->cunit = cu_byte;
-	} else {
-		for (i = 0; i < CU_LIMIT; i++) {
-			if (str_lcasecmp(eptr, cu_str[i],
-			    str_length(cu_str[i])) == 0) {
-				p = eptr + str_size(cu_str[i]);
-				while (*p == ' ')
-					++p;
-				if (*p == '\0')
-					goto found;
-			}
-		}
-
-		return EINVAL;
-	found:
-		capa->cunit = i;
-	}
-
-	capa->m = m;
-	capa->dp = dp;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/config.c
===================================================================
--- uspace/lib/c/generic/config.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <config.h>
-#include <sysinfo.h>
-#include <str.h>
-
-bool config_key_exists(const char *key)
-{
-	char *value;
-	bool exists;
-
-	value = config_get_value(key);
-	exists = (value != NULL);
-	free(value);
-
-	return exists;
-}
-
-char *config_get_value(const char *key)
-{
-	char *value = NULL;
-	char *boot_args;
-	size_t size;
-
-	boot_args = sysinfo_get_data("boot_args", &size);
-	if (!boot_args || !size) {
-		/*
-		 * No boot arguments, no value.
-		 */
-		return NULL;
-	}
-
-	char *args = boot_args;
-	char *arg;
-	while ((arg = str_tok(args, " ", &args)) != NULL) {
-		arg = str_tok(arg, "=", &value);
-		if (arg && !str_cmp(arg, key))
-			break;
-		else
-			value = NULL;
-	}
-
-	if (value)
-		value = str_dup(value);
-
-	free(boot_args);
-
-	return value;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/context.c
===================================================================
--- uspace/lib/c/generic/context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <context.h>
-#include <setjmp.h>
-#include <tls.h>
-#include <libarch/fibril.h>
-#include <libarch/faddr.h>
-
-/**
- * Saves current context to the variable pointed to by `self`,
- * and restores the context denoted by `other`.
- *
- * When the `self` context is later restored by another call to
- * `context_swap()`, the control flow behaves as if the earlier call to
- * `context_swap()` just returned.
- */
-void context_swap(context_t *self, context_t *other)
-{
-	if (!__context_save(self))
-		__context_restore(other, 1);
-}
-
-void context_create(context_t *context, const context_create_t *arg)
-{
-	__context_save(context);
-	context_set(context, FADDR(arg->fn), arg->stack_base,
-	    arg->stack_size, arg->tls);
-}
-
-uintptr_t context_get_pc(context_t *ctx)
-{
-	// This is a simple wrapper for now, and exists to allow
-	// potential future implementation of context_swap to omit
-	// program counter from the context structure (e.g. if it's
-	// stored on the stack).
-	return ctx->pc;
-}
-
-uintptr_t context_get_fp(context_t *ctx)
-{
-	return _context_get_fp(ctx);
-}
Index: pace/lib/c/generic/crt/crt1.c
===================================================================
--- uspace/lib/c/generic/crt/crt1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "../private/libc.h"
-
-/*
- * We shouldn't be accessing these symbols directly from libc,
- * since it would create unwanted relocations in shared library
- * code. Instead, we refer to them here, in a file that's always
- * statically linked to the main executable, and write their values
- * to a special structure that resides in libc.
- */
-
-extern init_array_entry_t __preinit_array_start[] __attribute__((weak));
-extern init_array_entry_t __preinit_array_end[] __attribute__((weak));
-extern init_array_entry_t __init_array_start[] __attribute__((weak));
-extern init_array_entry_t __init_array_end[] __attribute__((weak));
-extern fini_array_entry_t __fini_array_start[] __attribute__((weak));
-extern fini_array_entry_t __fini_array_end[] __attribute__((weak));
-extern int main(int, char *[]);
-extern unsigned char __executable_start[];
-extern unsigned char _end[];
-
-/* __c_start is only called from _start in assembly. */
-void __c_start(void *);
-
-void __c_start(void *pcb)
-{
-	__progsymbols = (progsymbols_t) {
-		.main = main,
-		.elfstart = __executable_start,
-		.end = _end,
-		.preinit_array = __preinit_array_start,
-		.preinit_array_len = __preinit_array_end - __preinit_array_start,
-		.init_array = __init_array_start,
-		.init_array_len = __init_array_end - __init_array_start,
-		.fini_array = __fini_array_start,
-		.fini_array_len = __fini_array_end - __fini_array_start,
-	};
-
-	__libc_main(pcb);
-}
Index: pace/lib/c/generic/dbgcon.c
===================================================================
--- uspace/lib/c/generic/dbgcon.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <dbgcon.h>
-#include <libc.h>
-#include <stdbool.h>
-
-bool dbgcon_enable(void)
-{
-	return __SYSCALL0(SYS_DEBUG_CONSOLE);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/ddi.c
===================================================================
--- uspace/lib/c/generic/ddi.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <abi/ddi/arg.h>
-#include <ddi.h>
-#include <libarch/ddi.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <device/pio_window.h>
-#include <libc.h>
-#include <task.h>
-#include <as.h>
-#include <align.h>
-#include <libarch/config.h>
-#include "private/libc.h"
-
-/** Map a piece of physical memory to task.
- *
- * Caller of this function must have the PERM_MEM_MANAGER permission.
- *
- * @param phys  Physical address of the starting frame.
- * @param pages Number of pages to map.
- * @param flags Flags for the new address space area.
- * @param virt  Virtual address of the starting page.
- *              If set to AS_AREA_ANY ((void *) -1), a suitable value
- *              is found by the kernel, otherwise the kernel tries to
- *              obey the desired value.
- *
- * @return EOK on success.
- * @return EPERM if the caller lacks the PERM_MEM_MANAGER permission.
- * @return ENOMEM if there was some problem in creating
- *         the address space area.
- *
- */
-errno_t physmem_map(uintptr_t phys, size_t pages, unsigned int flags, void **virt)
-{
-	return (errno_t) __SYSCALL5(SYS_PHYSMEM_MAP, (sysarg_t) phys,
-	    pages, flags, (sysarg_t) virt, (sysarg_t) __progsymbols.end);
-}
-
-/** Unmap a piece of physical memory to task.
- *
- * Caller of this function must have the PERM_MEM_MANAGER permission.
- *
- * @param virt Virtual address from the phys-mapped region.
- *
- * @return EOK on success.
- * @return EPERM if the caller lacks the PERM_MEM_MANAGER permission.
- *
- */
-errno_t physmem_unmap(void *virt)
-{
-	return (errno_t) __SYSCALL1(SYS_PHYSMEM_UNMAP, (sysarg_t) virt);
-}
-
-/** Lock a piece physical memory for DMA transfers.
- *
- * The mapping of the specified virtual memory address
- * to physical memory address is locked in order to
- * make it safe for DMA transferts.
- *
- * Caller of this function must have the PERM_MEM_MANAGER permission.
- *
- * @param virt      Virtual address of the memory to be locked.
- * @param size      Number of bytes to lock.
- * @param map_flags Desired virtual memory area flags.
- * @param flags     Flags for the physical memory address.
- * @param phys      Locked physical memory address.
- *
- * @return EOK on success.
- * @return EPERM if the caller lacks the PERM_MEM_MANAGER permission.
- * @return ENOMEM if there was some problem in creating
- *         the address space area.
- *
- */
-errno_t dmamem_map(void *virt, size_t size, unsigned int map_flags,
-    unsigned int flags, uintptr_t *phys)
-{
-	return (errno_t) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
-	    (sysarg_t) map_flags, (sysarg_t) flags & ~DMAMEM_FLAGS_ANONYMOUS,
-	    (sysarg_t) phys, (sysarg_t) virt, 0);
-}
-
-/** Map a piece of physical memory suitable for DMA transfers.
- *
- * Caller of this function must have the PERM_MEM_MANAGER permission.
- *
- * @param size       Number of bytes to map.
- * @param constraint Bit mask defining the contraint on the physical
- *                   address to be mapped.
- * @param map_flags  Desired virtual memory area flags.
- * @param flags      Flags for the physical memory address.
- * @param virt       Virtual address of the starting page.
- *                   If set to AS_AREA_ANY ((void *) -1), a suitable value
- *                   is found by the kernel, otherwise the kernel tries to
- *                   obey the desired value.
- *
- * @return EOK on success.
- * @return EPERM if the caller lacks the PERM_MEM_MANAGER permission.
- * @return ENOMEM if there was some problem in creating
- *         the address space area.
- *
- */
-errno_t dmamem_map_anonymous(size_t size, uintptr_t constraint,
-    unsigned int map_flags, unsigned int flags, uintptr_t *phys, void **virt)
-{
-	*phys = constraint;
-
-	return (errno_t) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
-	    (sysarg_t) map_flags, (sysarg_t) flags | DMAMEM_FLAGS_ANONYMOUS,
-	    (sysarg_t) phys, (sysarg_t) virt, (sysarg_t) __progsymbols.end);
-}
-
-errno_t dmamem_unmap(void *virt, size_t size)
-{
-	return (errno_t) __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, (sysarg_t) size, 0);
-}
-
-errno_t dmamem_unmap_anonymous(void *virt)
-{
-	return (errno_t) __SYSCALL3(SYS_DMAMEM_UNMAP, (sysarg_t) virt, 0,
-	    DMAMEM_FLAGS_ANONYMOUS);
-}
-
-/** Enable I/O space range to task.
- *
- * Caller of this function must have the PERM_IO_MANAGER permission.
- *
- * @param id     Task ID.
- * @param ioaddr Starting address of the I/O range.
- * @param size   Size of the range.
- *
- * @return EOK on success
- * @return EPERM if the caller lacks the PERM_IO_MANAGER permission
- * @return ENOENT if there is no task with specified ID
- * @return ENOMEM if there was some problem in allocating memory.
- *
- */
-static errno_t iospace_enable(task_id_t id, void *ioaddr, size_t size)
-{
-	const ddi_ioarg_t arg = {
-		.task_id = id,
-		.ioaddr = ioaddr,
-		.size = size
-	};
-
-	return (errno_t) __SYSCALL1(SYS_IOSPACE_ENABLE, (sysarg_t) &arg);
-}
-
-/** Disable I/O space range to task.
- *
- * Caller of this function must have the PERM_IO_MANAGER permission.
- *
- * @param id     Task ID.
- * @param ioaddr Starting address of the I/O range.
- * @param size   Size of the range.
- *
- * @return EOK on success
- * @return EPERM if the caller lacks the PERM_IO_MANAGER permission
- * @return ENOENT if there is no task with specified ID
- *
- */
-static errno_t iospace_disable(task_id_t id, void *ioaddr, size_t size)
-{
-	const ddi_ioarg_t arg = {
-		.task_id = id,
-		.ioaddr = ioaddr,
-		.size = size
-	};
-
-	return (errno_t) __SYSCALL1(SYS_IOSPACE_DISABLE, (sysarg_t) &arg);
-}
-
-/** Enable PIO for specified address range.
- *
- * @param range I/O range to be enable.
- * @param virt  Virtual address for application's PIO operations.
- */
-errno_t pio_enable_range(addr_range_t *range, void **virt)
-{
-	return pio_enable(RNGABSPTR(*range), RNGSZ(*range), virt);
-}
-
-/** Enable PIO for specified HW resource wrt. to the PIO window.
- *
- * @param win        PIO window. May be NULL if the resources are known to be
- *                   absolute.
- * @param res        Resources specifying the I/O range wrt. to the PIO window.
- * @param[out] virt  Virtual address for application's PIO operations.
- * @param[out] phys  If non-NULL, physical address of the resource
- * @param[out] size  If non-NULL, size of the enabled resource.
- *
- * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_enable_resource(pio_window_t *win, hw_resource_t *res, void **virt,
-    uintptr_t *phys, size_t *size)
-{
-	uintptr_t addr;
-	size_t sz;
-
-	switch (res->type) {
-	case IO_RANGE:
-		addr = res->res.io_range.address;
-		if (res->res.io_range.relative) {
-			if (!win)
-				return EINVAL;
-			addr += win->io.base;
-		}
-		sz = res->res.io_range.size;
-		break;
-	case MEM_RANGE:
-		addr = res->res.mem_range.address;
-		if (res->res.mem_range.relative) {
-			if (!win)
-				return EINVAL;
-			addr += win->mem.base;
-		}
-		sz = res->res.mem_range.size;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	if (phys)
-		*phys = addr;
-	if (size)
-		*size = sz;
-
-	return pio_enable((void *) addr, sz, virt);
-}
-
-/** Enable PIO for specified I/O range.
- *
- * @param pio_addr I/O start address.
- * @param size     Size of the I/O region.
- * @param virt     Virtual address for application's
- *                 PIO operations. Can be NULL for PMIO.
- *
- * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_enable(void *pio_addr, size_t size, void **virt)
-{
-#ifdef IO_SPACE_BOUNDARY
-	if (pio_addr < IO_SPACE_BOUNDARY) {
-		if (virt)
-			*virt = pio_addr;
-		return iospace_enable(task_get_id(), pio_addr, size);
-	}
-#else
-	(void) iospace_enable;
-#endif
-	if (!virt)
-		return EINVAL;
-
-	uintptr_t phys_frame =
-	    ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE);
-	size_t offset = (uintptr_t) pio_addr - phys_frame;
-	size_t pages = SIZE2PAGES(offset + size);
-
-	void *virt_page = AS_AREA_ANY;
-	errno_t rc = physmem_map(phys_frame, pages,
-	    AS_AREA_READ | AS_AREA_WRITE, &virt_page);
-	if (rc != EOK)
-		return rc;
-
-	*virt = virt_page + offset;
-	return EOK;
-}
-
-/** Disable PIO for specified I/O range.
- *
- * @param virt     I/O start address.
- * @param size     Size of the I/O region.
- *
- * @return EOK on success.
- * @return An error code on failure.
- *
- */
-errno_t pio_disable(void *virt, size_t size)
-{
-#ifdef IO_SPACE_BOUNDARY
-	if (virt < IO_SPACE_BOUNDARY)
-		return iospace_disable(task_get_id(), virt, size);
-#else
-	(void) iospace_disable;
-#endif
-	return physmem_unmap(virt);
-}
-
-void pio_write_8(ioport8_t *reg, uint8_t val)
-{
-	pio_trace_log(reg, val, true);
-	arch_pio_write_8(reg, val);
-}
-
-void pio_write_16(ioport16_t *reg, uint16_t val)
-{
-	pio_trace_log(reg, val, true);
-	arch_pio_write_16(reg, val);
-}
-
-void pio_write_32(ioport32_t *reg, uint32_t val)
-{
-	pio_trace_log(reg, val, true);
-	arch_pio_write_32(reg, val);
-}
-
-void pio_write_64(ioport64_t *reg, uint64_t val)
-{
-	pio_trace_log(reg, val, true);
-	arch_pio_write_64(reg, val);
-}
-
-uint8_t pio_read_8(const ioport8_t *reg)
-{
-	const uint8_t val = arch_pio_read_8(reg);
-	pio_trace_log(reg, val, false);
-	return val;
-}
-
-uint16_t pio_read_16(const ioport16_t *reg)
-{
-	const uint16_t val = arch_pio_read_16(reg);
-	pio_trace_log(reg, val, false);
-	return val;
-}
-
-uint32_t pio_read_32(const ioport32_t *reg)
-{
-	const uint32_t val = arch_pio_read_32(reg);
-	pio_trace_log(reg, val, false);
-	return val;
-}
-
-uint64_t pio_read_64(const ioport64_t *reg)
-{
-	const uint64_t val = arch_pio_read_64(reg);
-	pio_trace_log(reg, val, false);
-	return val;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/device/clock_dev.c
===================================================================
--- uspace/lib/c/generic/device/clock_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <ipc/dev_iface.h>
-#include <device/clock_dev.h>
-#include <errno.h>
-#include <async.h>
-#include <time.h>
-
-/** Read the current time from the device
- *
- * @param sess     Session of the device
- * @param t        The current time that will be read from the device
- *
- * @return         EOK on success or an error code
- */
-errno_t
-clock_dev_time_get(async_sess_t *sess, struct tm *t)
-{
-	aid_t req;
-	errno_t ret;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	req = async_send_1(exch, DEV_IFACE_ID(CLOCK_DEV_IFACE),
-	    CLOCK_DEV_TIME_GET, NULL);
-	ret = async_data_read_start(exch, t, sizeof(*t));
-
-	async_exchange_end(exch);
-
-	errno_t rc;
-	if (ret != EOK) {
-		async_forget(req);
-		return ret;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t)rc;
-}
-
-/** Set the current time
- *
- * @param sess   Session of the device
- * @param t      The current time that will be written to the device
- *
- * @return       EOK on success or an error code
- */
-errno_t
-clock_dev_time_set(async_sess_t *sess, struct tm *t)
-{
-	aid_t req;
-	errno_t ret;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	req = async_send_1(exch, DEV_IFACE_ID(CLOCK_DEV_IFACE),
-	    CLOCK_DEV_TIME_SET, NULL);
-	ret = async_data_write_start(exch, t, sizeof(*t));
-
-	async_exchange_end(exch);
-
-	errno_t rc;
-	if (ret != EOK) {
-		async_forget(req);
-		return ret;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t)rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/device/hw_res.c
===================================================================
--- uspace/lib/c/generic/device/hw_res.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <device/hw_res.h>
-#include <errno.h>
-#include <async.h>
-#include <stdlib.h>
-
-errno_t hw_res_get_resource_list(async_sess_t *sess,
-    hw_resource_list_t *hw_resources)
-{
-	sysarg_t count = 0;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_GET_RESOURCE_LIST, &count);
-
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	size_t size = count * sizeof(hw_resource_t);
-	hw_resource_t *resources = (hw_resource_t *) malloc(size);
-	if (resources == NULL) {
-		// FIXME: This is protocol violation
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	rc = async_data_read_start(exch, resources, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		free(resources);
-		return rc;
-	}
-
-	hw_resources->resources = resources;
-	hw_resources->count = count;
-
-	return EOK;
-}
-
-errno_t hw_res_enable_interrupt(async_sess_t *sess, int irq)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_ENABLE_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t hw_res_disable_interrupt(async_sess_t *sess, int irq)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_DISABLE_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t hw_res_clear_interrupt(async_sess_t *sess, int irq)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_CLEAR_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Setup DMA channel to specified place and mode.
- *
- * @param channel DMA channel.
- * @param pa      Physical address of the buffer.
- * @param size    DMA buffer size.
- * @param mode    Mode of the DMA channel:
- *                 - Read or Write
- *                 - Allow automatic reset
- *                 - Use address decrement instead of increment
- *                 - Use SINGLE/BLOCK/ON DEMAND transfer mode
- *
- * @return Error code.
- *
- */
-errno_t hw_res_dma_channel_setup(async_sess_t *sess,
-    unsigned channel, uint32_t pa, uint32_t size, uint8_t mode)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	const uint32_t packed = (channel & 0xffff) | (mode << 16);
-	const errno_t ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_DMA_CHANNEL_SETUP, packed, pa, size);
-
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-/** Query remaining bytes in the buffer.
- *
- * @param channel DMA channel.
- *
- * @param[out] rem Number of bytes remaining in the buffer if positive.
- *
- * @return Error code.
- *
- */
-errno_t hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel, size_t *rem)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	sysarg_t remain;
-	const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_DMA_CHANNEL_REMAIN, channel, &remain);
-
-	async_exchange_end(exch);
-
-	if (ret == EOK)
-		*rem = remain;
-
-	return ret;
-}
-
-/** Query legacy IO claims.
- *
- * @param sess HW res session
- * @param rclaims Place to store the claims
- *
- * @return Error code.
- *
- */
-errno_t hw_res_query_legacy_io(async_sess_t *sess, hw_res_claims_t *rclaims)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	sysarg_t claims;
-	const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_QUERY_LEGACY_IO, &claims);
-
-	async_exchange_end(exch);
-
-	if (ret == EOK)
-		*rclaims = claims;
-
-	return ret;
-}
-
-/** Claim legacy IO devices.
- *
- * @param sess HW res session
- * @param claims Claims
- *
- * @return Error code.
- *
- */
-errno_t hw_res_claim_legacy_io(async_sess_t *sess, hw_res_claims_t claims)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	const errno_t ret = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
-	    HW_RES_CLAIM_LEGACY_IO, claims);
-
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/device/hw_res_parsed.c
===================================================================
--- uspace/lib/c/generic/device/hw_res_parsed.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,284 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <device/hw_res_parsed.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-
-static void hw_res_parse_add_dma_channel(hw_res_list_parsed_t *out,
-    const hw_resource_t *res, int flags)
-{
-	assert(res);
-	assert((res->type == DMA_CHANNEL_8) || (res->type == DMA_CHANNEL_16));
-
-	const unsigned channel = (res->type == DMA_CHANNEL_8) ?
-	    res->res.dma_channel.dma8 : res->res.dma_channel.dma16;
-	const size_t count = out->dma_channels.count;
-	const int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
-
-	if (!keep_duplicit) {
-		for (size_t i = 0; i < count; ++i) {
-			if (out->dma_channels.channels[i] == channel)
-				return;
-		}
-	}
-
-	out->dma_channels.channels[count] = channel;
-	++out->dma_channels.count;
-}
-
-static void hw_res_parse_add_irq(hw_res_list_parsed_t *out,
-    const hw_resource_t *res, int flags)
-{
-	assert(res && (res->type == INTERRUPT));
-
-	int irq = res->res.interrupt.irq;
-	size_t count = out->irqs.count;
-	int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
-
-	if (!keep_duplicit) {
-		for (size_t i = 0; i < count; i++) {
-			if (out->irqs.irqs[i] == irq)
-				return;
-		}
-	}
-
-	out->irqs.irqs[count] = irq;
-	out->irqs.count++;
-}
-
-static uint64_t absolutize(uint64_t addr, bool relative, uint64_t base)
-{
-	if (!relative)
-		return addr;
-	else
-		return addr + base;
-}
-
-static uint64_t relativize(uint64_t addr, bool relative, uint64_t base)
-{
-	if (relative)
-		return addr;
-	else
-		return addr - base;
-}
-
-static void hw_res_parse_add_io_range(hw_res_list_parsed_t *out,
-    const pio_window_t *win, const hw_resource_t *res, int flags)
-{
-	endianness_t endianness;
-	uint64_t absolute;
-	uint64_t relative;
-	size_t size;
-
-	assert(res && (res->type == IO_RANGE));
-
-	absolute = absolutize(res->res.io_range.address,
-	    res->res.io_range.relative, win->io.base);
-	relative = relativize(res->res.io_range.address,
-	    res->res.io_range.relative, win->io.base);
-	size = res->res.io_range.size;
-	endianness = res->res.io_range.endianness;
-
-	if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
-		return;
-
-	int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
-	size_t count = out->io_ranges.count;
-
-	if (!keep_duplicit) {
-		for (size_t i = 0; i < count; i++) {
-			uint64_t s_address;
-			size_t s_size;
-
-			s_address = RNGABS(out->io_ranges.ranges[i]);
-			s_size = RNGSZ(out->io_ranges.ranges[i]);
-
-			if ((absolute == s_address) && (size == s_size))
-				return;
-		}
-	}
-
-	RNGABS(out->io_ranges.ranges[count]) = absolute;
-	RNGREL(out->io_ranges.ranges[count]) = relative;
-	RNGSZ(out->io_ranges.ranges[count]) = size;
-	out->io_ranges.ranges[count].endianness = endianness;
-	out->io_ranges.count++;
-}
-
-static void hw_res_parse_add_mem_range(hw_res_list_parsed_t *out,
-    const pio_window_t *win, const hw_resource_t *res, int flags)
-{
-	endianness_t endianness;
-	uint64_t absolute;
-	uint64_t relative;
-	size_t size;
-
-	assert(res && (res->type == MEM_RANGE));
-
-	absolute = absolutize(res->res.mem_range.address,
-	    res->res.mem_range.relative, win->mem.base);
-	relative = relativize(res->res.mem_range.address,
-	    res->res.mem_range.relative, win->mem.base);
-	size = res->res.mem_range.size;
-	endianness = res->res.mem_range.endianness;
-
-	if ((size == 0) && (!(flags & HW_RES_KEEP_ZERO_AREA)))
-		return;
-
-	int keep_duplicit = flags & HW_RES_KEEP_DUPLICIT;
-	size_t count = out->mem_ranges.count;
-
-	if (!keep_duplicit) {
-		for (size_t i = 0; i < count; ++i) {
-			uint64_t s_address;
-			size_t s_size;
-
-			s_address = RNGABS(out->mem_ranges.ranges[i]);
-			s_size = RNGSZ(out->mem_ranges.ranges[i]);
-
-			if ((absolute == s_address) && (size == s_size))
-				return;
-		}
-	}
-
-	RNGABS(out->mem_ranges.ranges[count]) = absolute;
-	RNGREL(out->mem_ranges.ranges[count]) = relative;
-	RNGSZ(out->mem_ranges.ranges[count]) = size;
-	out->mem_ranges.ranges[count].endianness = endianness;
-	out->mem_ranges.count++;
-}
-
-/** Parse list of hardware resources
- *
- * @param      win          PIO window.
- * @param      res          Original structure resource.
- * @param[out] out          Output parsed resources.
- * @param      flags        Flags of the parsing:
- *                          HW_RES_KEEP_ZERO_AREA for keeping zero-size areas,
- *                          HW_RES_KEEP_DUPLICITIES to keep duplicit areas.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t hw_res_list_parse(const pio_window_t *win,
-    const hw_resource_list_t *res, hw_res_list_parsed_t *out, int flags)
-{
-	if (!res || !out)
-		return EINVAL;
-
-	size_t res_count = res->count;
-	hw_res_list_parsed_clean(out);
-
-	out->irqs.irqs = calloc(res_count, sizeof(int));
-	out->dma_channels.channels = calloc(res_count, sizeof(int));
-	out->io_ranges.ranges = calloc(res_count, sizeof(io_range_t));
-	out->mem_ranges.ranges = calloc(res_count, sizeof(mem_range_t));
-	if (!out->irqs.irqs || !out->dma_channels.channels ||
-	    !out->io_ranges.ranges || !out->mem_ranges.ranges) {
-		hw_res_list_parsed_clean(out);
-		return ENOMEM;
-	}
-
-	for (size_t i = 0; i < res_count; ++i) {
-		const hw_resource_t *resource = &res->resources[i];
-
-		switch (resource->type) {
-		case INTERRUPT:
-			hw_res_parse_add_irq(out, resource, flags);
-			break;
-		case IO_RANGE:
-			hw_res_parse_add_io_range(out, win, resource, flags);
-			break;
-		case MEM_RANGE:
-			hw_res_parse_add_mem_range(out, win, resource, flags);
-			break;
-		case DMA_CHANNEL_8:
-		case DMA_CHANNEL_16:
-			hw_res_parse_add_dma_channel(out, resource, flags);
-			break;
-		default:
-			hw_res_list_parsed_clean(out);
-			return EINVAL;
-		}
-	}
-
-	return EOK;
-}
-
-/** Get hw_resources from the parent device.
- *
- * The output must be inited, will be cleared
- *
- * @see get_hw_resources
- * @see hw_resources_parse
- *
- * @param sess                Session to the parent device
- * @param hw_resources_parsed Output list
- * @param flags               Parsing flags
- *
- * @return EOK if succeed, error code otherwise
- *
- */
-errno_t hw_res_get_list_parsed(async_sess_t *sess,
-    hw_res_list_parsed_t *hw_res_parsed, int flags)
-{
-	pio_window_t pio_window;
-	errno_t rc;
-
-	if (!hw_res_parsed)
-		return EBADMEM;
-
-	hw_resource_list_t hw_resources;
-	hw_res_list_parsed_clean(hw_res_parsed);
-	memset(&hw_resources, 0, sizeof(hw_resource_list_t));
-
-	rc = pio_window_get(sess, &pio_window);
-	if (rc != EOK)
-		return rc;
-
-	rc = hw_res_get_resource_list(sess, &hw_resources);
-	if (rc != EOK)
-		return rc;
-
-	rc = hw_res_list_parse(&pio_window, &hw_resources, hw_res_parsed,
-	    flags);
-	hw_res_clean_resource_list(&hw_resources);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/device/pio_window.c
===================================================================
--- uspace/lib/c/generic/device/pio_window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <device/pio_window.h>
-#include <errno.h>
-#include <async.h>
-
-errno_t pio_window_get(async_sess_t *sess, pio_window_t *pio_win)
-{
-	errno_t rc;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return ENOMEM;
-
-	rc = async_req_1_0(exch, DEV_IFACE_ID(PIO_WINDOW_DEV_IFACE),
-	    PIO_WINDOW_GET);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, pio_win, sizeof(*pio_win));
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/dirent.c
===================================================================
--- uspace/lib/c/generic/dirent.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <vfs/vfs.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <stddef.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-
-struct __dirstream {
-	int fd;
-	struct dirent res;
-	aoff64_t pos;
-};
-
-/** Open directory.
- *
- * @param dirname Directory pathname
- *
- * @return Non-NULL pointer on success. On error returns @c NULL and sets errno.
- */
-DIR *opendir(const char *dirname)
-{
-	DIR *dirp = malloc(sizeof(DIR));
-	if (!dirp) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	int fd;
-	errno_t rc = vfs_lookup(dirname, WALK_DIRECTORY, &fd);
-	if (rc != EOK) {
-		free(dirp);
-		errno = rc;
-		return NULL;
-	}
-
-	rc = vfs_open(fd, MODE_READ);
-	if (rc != EOK) {
-		free(dirp);
-		vfs_put(fd);
-		errno = rc;
-		return NULL;
-	}
-
-	dirp->fd = fd;
-	dirp->pos = 0;
-	return dirp;
-}
-
-/** Read directory entry.
- *
- * @param dirp Open directory
- * @return Non-NULL pointer to directory entry on success. On error returns
- *         @c NULL and sets errno.
- */
-struct dirent *readdir(DIR *dirp)
-{
-	errno_t rc;
-	ssize_t len = 0;
-
-	rc = vfs_read_short(dirp->fd, dirp->pos, dirp->res.d_name,
-	    sizeof(dirp->res.d_name), &len);
-	if (rc != EOK) {
-		errno = rc;
-		return NULL;
-	}
-
-	assert(strnlen(dirp->res.d_name, sizeof(dirp->res.d_name)) < sizeof(dirp->res.d_name));
-
-	dirp->pos += len;
-
-	return &dirp->res;
-}
-
-/** Rewind directory position to the beginning.
- *
- * @param dirp Open directory
- */
-void rewinddir(DIR *dirp)
-{
-	dirp->pos = 0;
-}
-
-/** Close directory.
- *
- * @param dirp Open directory
- * @return 0 on success. On error returns -1 and sets errno.
- */
-int closedir(DIR *dirp)
-{
-	errno_t rc = vfs_put(dirp->fd);
-	free(dirp);
-
-	if (rc == EOK) {
-		return 0;
-	} else {
-		errno = rc;
-		return -1;
-	}
-}
-
-/** @}
- */
Index: pace/lib/c/generic/dlfcn.c
===================================================================
--- uspace/lib/c/generic/dlfcn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <dlfcn.h>
-
-#ifdef CONFIG_RTLD
-
-#include <rtld/module.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_arch.h>
-#include <rtld/symbol.h>
-
-void *dlopen(const char *path, int flag)
-{
-	module_t *m;
-
-	m = module_find(runtime_env, path);
-	if (m == NULL) {
-		m = module_load(runtime_env, path, mlf_local);
-		if (m == NULL) {
-			return NULL;
-		}
-
-		if (module_load_deps(m, mlf_local) != EOK) {
-			return NULL;
-		}
-
-		/* Now relocate. */
-		module_process_relocs(m);
-	}
-
-	return (void *) m;
-}
-
-/*
- * @note Symbols with NULL values are not accounted for.
- */
-void *dlsym(void *mod, const char *sym_name)
-{
-	elf_symbol_t *sd;
-	module_t *sm;
-
-	sd = symbol_bfs_find(sym_name, (module_t *) mod, &sm);
-	if (sd != NULL) {
-		if (elf_st_type(sd->st_info) == STT_FUNC)
-			return func_get_addr(sd, sm);
-		else
-			return symbol_get_addr(sd, sm, __tcb_get());
-	}
-
-	return NULL;
-}
-
-#else /* CONFIG_RTLD not defined */
-
-void *dlopen(const char *path, int flag)
-{
-	return NULL;
-}
-
-void *dlsym(void *mod, const char *sym_name)
-{
-	return NULL;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/double_to_str.c
===================================================================
--- uspace/lib/c/generic/double_to_str.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,785 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <double_to_str.h>
-
-#include "private/power_of_ten.h"
-#include <ieee_double.h>
-
-#include <limits.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <assert.h>
-
-/*
- * Floating point numbers are converted from their binary representation
- * into a decimal string using the algorithm described in:
- *   Printing floating-point numbers quickly and accurately with integers
- *   Loitsch, 2010
- */
-
-/** The computation assumes a significand of 64 bits. */
-static const int significand_width = 64;
-
-/* Scale exponents to interval [alpha, gamma] to simplify conversion. */
-static const int alpha = -59;
-static const int gamma = -32;
-
-/** Returns true if the most-significant bit of num.significand is set. */
-static bool is_normalized(fp_num_t num)
-{
-	assert(8 * sizeof(num.significand) == significand_width);
-
-	/* Normalized == most significant bit of the significand is set. */
-	return (num.significand & (1ULL << (significand_width - 1))) != 0;
-}
-
-/** Returns a normalized num with the MSbit set. */
-static fp_num_t normalize(fp_num_t num)
-{
-	const uint64_t top10bits = 0xffc0000000000000ULL;
-
-	/* num usually comes from ieee_double with top 10 bits zero. */
-	while (0 == (num.significand & top10bits)) {
-		num.significand <<= 10;
-		num.exponent -= 10;
-	}
-
-	while (!is_normalized(num)) {
-		num.significand <<= 1;
-		--num.exponent;
-	}
-
-	return num;
-}
-
-/** Returns x * y with an error of less than 0.5 ulp. */
-static fp_num_t multiply(fp_num_t x, fp_num_t y)
-{
-	assert(/* is_normalized(x) && */ is_normalized(y));
-
-	const uint32_t low_bits = -1;
-
-	uint64_t a, b, c, d;
-	a = x.significand >> 32;
-	b = x.significand & low_bits;
-	c = y.significand >> 32;
-	d = y.significand & low_bits;
-
-	uint64_t bd, ad, bc, ac;
-	bd = b * d;
-	ad = a * d;
-
-	bc = b * c;
-	ac = a * c;
-
-	/*
-	 * Denote 32 bit parts of x a y as: x == a b, y == c d. Then:
-	 *        a  b
-	 *  *     c  d
-	 *  ----------
-	 *       ad bd .. multiplication of 32bit parts results in 64bit parts
-	 *  + ac bc
-	 *  ----------
-	 *       [b|d] .. Depicts 64 bit intermediate results and how
-	 *     [a|d]      the 32 bit parts of these results overlap and
-	 *     [b|c]      contribute to the final result.
-	 *  +[a|c]
-	 *  ----------
-	 *   [ret]
-	 *  [tmp]
-	 */
-	uint64_t tmp = (bd >> 32) + (ad & low_bits) + (bc & low_bits);
-
-	/* Round upwards. */
-	tmp += 1U << 31;
-
-	fp_num_t ret;
-	ret.significand = ac + (bc >> 32) + (ad >> 32) + (tmp >> 32);
-	ret.exponent = x.exponent + y.exponent + significand_width;
-
-	return ret;
-}
-
-/** Returns a - b. Both must have the same exponent. */
-static fp_num_t subtract(fp_num_t a, fp_num_t b)
-{
-	assert(a.exponent == b.exponent);
-	assert(a.significand >= b.significand);
-
-	fp_num_t result;
-
-	result.significand = a.significand - b.significand;
-	result.exponent = a.exponent;
-
-	return result;
-}
-
-/** Returns the interval [low, high] of numbers that convert to binary val. */
-static void get_normalized_bounds(ieee_double_t val, fp_num_t *high,
-    fp_num_t *low, fp_num_t *val_dist)
-{
-	/*
-	 * Only works if val comes directly from extract_ieee_double without
-	 * being manipulated in any way (eg it must not be normalized).
-	 */
-	assert(!is_normalized(val.pos_val));
-
-	high->significand = (val.pos_val.significand << 1) + 1;
-	high->exponent = val.pos_val.exponent - 1;
-
-	/* val_dist = high - val */
-	val_dist->significand = 1;
-	val_dist->exponent = val.pos_val.exponent - 1;
-
-	/* Distance from both lower and upper bound is the same. */
-	if (!val.is_accuracy_step) {
-		low->significand = (val.pos_val.significand << 1) - 1;
-		low->exponent = val.pos_val.exponent - 1;
-	} else {
-		low->significand = (val.pos_val.significand << 2) - 1;
-		low->exponent = val.pos_val.exponent - 2;
-	}
-
-	*high = normalize(*high);
-
-	/*
-	 * Lower bound may not be normalized if subtracting 1 unit
-	 * reset the most-significant bit to 0.
-	 */
-	low->significand = low->significand << (low->exponent - high->exponent);
-	low->exponent = high->exponent;
-
-	val_dist->significand =
-	    val_dist->significand << (val_dist->exponent - high->exponent);
-	val_dist->exponent = high->exponent;
-}
-
-/** Determines the interval of numbers that have the binary representation
- *  of val.
- *
- * Numbers in the range [scaled_upper_bound - bounds_delta, scaled_upper_bound]
- * have the same double binary representation as val.
- *
- * Bounds are scaled by 10^scale so that alpha <= exponent <= gamma.
- * Moreover, scaled_upper_bound is normalized.
- *
- * val_dist is the scaled distance from val to the upper bound, ie
- * val_dist == (upper_bound - val) * 10^scale
- */
-static void calc_scaled_bounds(ieee_double_t val, fp_num_t *scaled_upper_bound,
-    fp_num_t *bounds_delta, fp_num_t *val_dist, int *scale)
-{
-	fp_num_t upper_bound, lower_bound;
-
-	get_normalized_bounds(val, &upper_bound, &lower_bound, val_dist);
-
-	assert(upper_bound.exponent == lower_bound.exponent);
-	assert(is_normalized(upper_bound));
-	assert(normalize(val.pos_val).exponent == upper_bound.exponent);
-
-	/*
-	 * Find such a cached normalized power of 10 that if multiplied
-	 * by upper_bound the binary exponent of upper_bound almost vanishes,
-	 * ie:
-	 *   upper_scaled := upper_bound * 10^scale
-	 *   alpha <= upper_scaled.exponent <= gamma
-	 *   alpha <= upper_bound.exponent + pow_10.exponent + 64 <= gamma
-	 */
-	fp_num_t scaling_power_of_10;
-	int lower_bin_exp = alpha - upper_bound.exponent - significand_width;
-
-	get_power_of_ten(lower_bin_exp, &scaling_power_of_10, scale);
-
-	int scale_exp = scaling_power_of_10.exponent;
-	assert(alpha <= upper_bound.exponent + scale_exp + significand_width);
-	assert(upper_bound.exponent + scale_exp + significand_width <= gamma);
-
-	fp_num_t upper_scaled = multiply(upper_bound, scaling_power_of_10);
-	fp_num_t lower_scaled = multiply(lower_bound, scaling_power_of_10);
-	*val_dist = multiply(*val_dist, scaling_power_of_10);
-
-	assert(alpha <= upper_scaled.exponent && upper_scaled.exponent <= gamma);
-
-	/*
-	 * Any value between lower and upper bound would be represented
-	 * in binary as the double val originated from. The bounds were
-	 * however scaled by an imprecise power of 10 (error less than
-	 * 1 ulp) so the scaled bounds have an error of less than 1 ulp.
-	 * Conservatively round the lower bound up and the upper bound
-	 * down by 1 ulp just to be on the safe side. It avoids pronouncing
-	 * produced decimal digits as correct if such a decimal number
-	 * is close to the bounds to within 1 ulp.
-	 */
-	upper_scaled.significand -= 1;
-	lower_scaled.significand += 1;
-
-	*bounds_delta = subtract(upper_scaled, lower_scaled);
-	*scaled_upper_bound = upper_scaled;
-}
-
-/** Rounds the last digit of buf so that it is closest to the converted number. */
-static void round_last_digit(uint64_t rest, uint64_t w_dist, uint64_t delta,
-    uint64_t digit_val_diff, char *buf, int len)
-{
-	/*
-	 *  | <------- delta -------> |
-	 *  |    | <---- w_dist ----> |
-	 *  |    |       | <- rest -> |
-	 *  |    |       |            |
-	 *  |    |       ` buffer     |
-	 *  |    ` w                  ` upper
-	 *  ` lower
-	 *
-	 * delta = upper - lower .. conservative/safe interval
-	 * w_dist = upper - w
-	 * upper = "number represented by digits in buf" + rest
-	 *
-	 * Changing buf[len - 1] changes the value represented by buf
-	 * by digit_val_diff * scaling, where scaling is shared by
-	 * all parameters.
-	 *
-	 */
-
-	/* Current number in buf is greater than the double being converted */
-	bool cur_greater_w = rest < w_dist;
-	/* Rounding down by one would keep buf in between bounds (in safe rng). */
-	bool next_in_val_rng = cur_greater_w && (rest + digit_val_diff < delta);
-	/* Rounding down by one would bring buf closer to the processed number. */
-	bool next_closer = next_in_val_rng &&
-	    (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
-
-	/*
-	 * Of the shortest strings pick the one that is closest to the actual
-	 * floating point number.
-	 */
-	while (next_closer) {
-		assert('0' < buf[len - 1]);
-		assert(0 < digit_val_diff);
-
-		--buf[len - 1];
-		rest += digit_val_diff;
-
-		cur_greater_w = rest < w_dist;
-		next_in_val_rng = cur_greater_w && (rest + digit_val_diff < delta);
-		next_closer = next_in_val_rng &&
-		    (rest + digit_val_diff < w_dist || rest - w_dist < w_dist - rest);
-	}
-}
-
-/** Generates the shortest accurate decimal string representation.
- *
- * Outputs (mostly) the shortest accurate string representation
- * for the number scaled_upper - val_dist. Numbers in the interval
- * [scaled_upper - delta, scaled_upper] have the same binary
- * floating point representation and will therefore share the
- * shortest string representation (up to the rounding of the last
- * digit to bring the shortest string also the closest to the
- * actual number).
- *
- * @param scaled_upper Scaled upper bound of numbers that have the
- *              same binary representation as the converted number.
- *              Scaled by 10^-scale so that alpha <= exponent <= gamma.
- * @param delta scaled_upper - delta is the lower bound of numbers
- *              that share the same binary representation in double.
- * @param val_dist scaled_upper - val_dist is the number whose
- *              decimal string we're generating.
- * @param scale Decimal scaling of the value to convert (ie scaled_upper).
- * @param buf   Buffer to store the string representation. Must be large
- *              enough to store all digits and a null terminator. At most
- *              MAX_DOUBLE_STR_LEN digits will be written (not counting
- *              the null terminator).
- * @param buf_size Size of buf in bytes.
- * @param dec_exponent Will be set to the decimal exponent of the number
- *              string in buf.
- *
- * @return Number of digits; negative on failure (eg buffer too small).
- */
-static int gen_dec_digits(fp_num_t scaled_upper, fp_num_t delta,
-    fp_num_t val_dist, int scale, char *buf, size_t buf_size, int *dec_exponent)
-{
-	/*
-	 * The integral part of scaled_upper is 5 to 32 bits long while
-	 * the remaining fractional part is 59 to 32 bits long because:
-	 * -59 == alpha <= scaled_upper.e <= gamma == -32
-	 *
-	 *  | <------- delta -------> |
-	 *  |    | <--- val_dist ---> |
-	 *  |    |    |<- remainder ->|
-	 *  |    |    |               |
-	 *  |    |    ` buffer        |
-	 *  |    ` val                ` upper
-	 *  ` lower
-	 *
-	 */
-	assert(scaled_upper.significand != 0);
-	assert(alpha <= scaled_upper.exponent && scaled_upper.exponent <= gamma);
-	assert(scaled_upper.exponent == delta.exponent);
-	assert(scaled_upper.exponent == val_dist.exponent);
-	assert(val_dist.significand <= delta.significand);
-
-	/* We'll produce at least one digit and a null terminator. */
-	if (buf_size < 2) {
-		return -1;
-	}
-
-	/* one is number 1 encoded with the same exponent as scaled_upper */
-	fp_num_t one;
-	one.significand = ((uint64_t) 1) << (-scaled_upper.exponent);
-	one.exponent = scaled_upper.exponent;
-
-	/*
-	 * Extract the integral part of scaled_upper.
-	 *  upper / one == upper >> -one.e
-	 */
-	uint32_t int_part = (uint32_t)(scaled_upper.significand >> (-one.exponent));
-
-	/*
-	 * Fractional part of scaled_upper.
-	 *  upper % one == upper & (one.f - 1)
-	 */
-	uint64_t frac_part = scaled_upper.significand & (one.significand - 1);
-
-	/*
-	 * The integral part of upper has at least 5 bits (64 + alpha) and
-	 * at most 32 bits (64 + gamma). The integral part has at most 10
-	 * decimal digits, so kappa <= 10.
-	 */
-	int kappa = 10;
-	uint32_t div = 1000000000;
-	size_t len = 0;
-
-	/* Produce decimal digits for the integral part of upper. */
-	while (kappa > 0) {
-		int digit = int_part / div;
-		int_part %= div;
-
-		--kappa;
-
-		/* Skip leading zeros. */
-		if (digit != 0 || len != 0) {
-			/* Current length + new digit + null terminator <= buf_size */
-			if (len + 2 <= buf_size) {
-				buf[len] = '0' + digit;
-				++len;
-			} else {
-				return -1;
-			}
-		}
-
-		/*
-		 * Difference between the so far produced decimal number and upper
-		 * is calculated as: remaining_int_part * one + frac_part
-		 */
-		uint64_t remainder = (((uint64_t)int_part) << -one.exponent) + frac_part;
-
-		/* The produced decimal number would convert back to upper. */
-		if (remainder <= delta.significand) {
-			assert(0 < len && len < buf_size);
-			*dec_exponent = kappa - scale;
-			buf[len] = '\0';
-
-			/* Of the shortest representations choose the numerically closest. */
-			round_last_digit(remainder, val_dist.significand, delta.significand,
-			    (uint64_t)div << (-one.exponent), buf, len);
-			return len;
-		}
-
-		div /= 10;
-	}
-
-	/* Generate decimal digits for the fractional part of upper. */
-	do {
-		/*
-		 * Does not overflow because at least 5 upper bits were
-		 * taken by the integral part and are now unused in frac_part.
-		 */
-		frac_part *= 10;
-		delta.significand *= 10;
-		val_dist.significand *= 10;
-
-		/* frac_part / one */
-		int digit = (int)(frac_part >> (-one.exponent));
-
-		/* frac_part %= one */
-		frac_part &= one.significand - 1;
-
-		--kappa;
-
-		/* Skip leading zeros. */
-		if (digit == 0 && len == 0) {
-			continue;
-		}
-
-		/* Current length + new digit + null terminator <= buf_size */
-		if (len + 2 <= buf_size) {
-			buf[len] = '0' + digit;
-			++len;
-		} else {
-			return -1;
-		}
-	} while (frac_part > delta.significand);
-
-	assert(0 < len && len < buf_size);
-
-	*dec_exponent = kappa - scale;
-	buf[len] = '\0';
-
-	/* Of the shortest representations choose the numerically closest one. */
-	round_last_digit(frac_part, val_dist.significand, delta.significand,
-	    one.significand, buf, len);
-
-	return len;
-}
-
-/** Produce a string for 0.0 */
-static int zero_to_str(char *buf, size_t buf_size, int *dec_exponent)
-{
-	if (2 <= buf_size) {
-		buf[0] = '0';
-		buf[1] = '\0';
-		*dec_exponent = 0;
-		return 1;
-	} else {
-		return -1;
-	}
-}
-
-/** Converts a non-special double into its shortest accurate string
- *  representation.
- *
- * Produces an accurate string representation, ie the string will
- * convert back to the same binary double (eg via strtod). In the
- * vast majority of cases (99%) the string will be the shortest such
- * string that is also the closest to the value of any shortest
- * string representations. Therefore, no trailing zeros are ever
- * produced.
- *
- * Conceptually, the value is: buf * 10^dec_exponent
- *
- * Never outputs trailing zeros.
- *
- * @param ieee_val Binary double description to convert. Must be the product
- *                 of extract_ieee_double and it must not be a special number.
- * @param buf      Buffer to store the string representation. Must be large
- *                 enough to store all digits and a null terminator. At most
- *                 MAX_DOUBLE_STR_LEN digits will be written (not counting
- *                 the null terminator).
- * @param buf_size Size of buf in bytes.
- * @param dec_exponent Will be set to the decimal exponent of the number
- *                 string in buf.
- *
- * @return The number of printed digits. A negative value indicates
- *         an error: buf too small (or ieee_val.is_special).
- */
-int double_to_short_str(ieee_double_t ieee_val, char *buf, size_t buf_size,
-    int *dec_exponent)
-{
-	/* The whole computation assumes 64bit significand. */
-	static_assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t), "");
-
-	if (ieee_val.is_special) {
-		return -1;
-	}
-
-	/* Zero cannot be normalized. Handle it here. */
-	if (0 == ieee_val.pos_val.significand) {
-		return zero_to_str(buf, buf_size, dec_exponent);
-	}
-
-	fp_num_t scaled_upper_bound;
-	fp_num_t delta;
-	fp_num_t val_dist;
-	int scale;
-
-	calc_scaled_bounds(ieee_val, &scaled_upper_bound,
-	    &delta, &val_dist, &scale);
-
-	int len = gen_dec_digits(scaled_upper_bound, delta, val_dist, scale,
-	    buf, buf_size, dec_exponent);
-
-	assert(len <= MAX_DOUBLE_STR_LEN);
-	return len;
-}
-
-/** Generates a fixed number of decimal digits of w_scaled.
- *
- * double == w_scaled * 10^-scale, where alpha <= w_scaled.e <= gamma
- *
- * @param w_scaled Scaled number by 10^-scale so that
- *              alpha <= exponent <= gamma
- * @param scale Decimal scaling of the value to convert (ie w_scaled).
- * @param signif_d_cnt Maximum number of significant digits to output.
- *              Negative if as many as possible are requested.
- * @param frac_d_cnt   Maximum number of fractional digits to output.
- *              Negative if as many as possible are requested.
- *              Eg. if 2 then 1.234 -> "1.23"; if 2 then 3e-9 -> "0".
- * @param buf   Buffer to store the string representation. Must be large
- *              enough to store all digits and a null terminator. At most
- *              MAX_DOUBLE_STR_LEN digits will be written (not counting
- *              the null terminator).
- * @param buf_size Size of buf in bytes.
- *
- * @return Number of digits; negative on failure (eg buffer too small).
- */
-static int gen_fixed_dec_digits(fp_num_t w_scaled, int scale, int signif_d_cnt,
-    int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
-{
-	/* We'll produce at least one digit and a null terminator. */
-	if (0 == signif_d_cnt || buf_size < 2) {
-		return -1;
-	}
-
-	/*
-	 * The integral part of w_scaled is 5 to 32 bits long while the
-	 * remaining fractional part is 59 to 32 bits long because:
-	 * -59 == alpha <= w_scaled.e <= gamma == -32
-	 *
-	 * Therefore:
-	 *  | 5..32 bits | 32..59 bits | == w_scaled == w * 10^scale
-	 *  |  int_part  |  frac_part  |
-	 *  |0 0  ..  0 1|0 0   ..  0 0| == one == 1.0
-	 *  |      0     |0 0   ..  0 1| == w_err == 1 * 2^w_scaled.e
-	 */
-	assert(alpha <= w_scaled.exponent && w_scaled.exponent <= gamma);
-	assert(0 != w_scaled.significand);
-
-	/*
-	 * Scaling the number being converted by 10^scale introduced
-	 * an error of less that 1 ulp. The actual value of w_scaled
-	 * could lie anywhere between w_scaled.signif +/- w_err.
-	 * Scale the error locally as we scale the fractional part
-	 * of w_scaled.
-	 */
-	uint64_t w_err = 1;
-
-	/* one is number 1.0 encoded with the same exponent as w_scaled */
-	fp_num_t one;
-	one.significand = ((uint64_t) 1) << (-w_scaled.exponent);
-	one.exponent = w_scaled.exponent;
-
-	/*
-	 * Extract the integral part of w_scaled.
-	 * w_scaled / one == w_scaled >> -one.e
-	 */
-	uint32_t int_part = (uint32_t)(w_scaled.significand >> (-one.exponent));
-
-	/*
-	 * Fractional part of w_scaled.
-	 * w_scaled % one == w_scaled & (one.f - 1)
-	 */
-	uint64_t frac_part = w_scaled.significand & (one.significand - 1);
-
-	size_t len = 0;
-	/*
-	 * The integral part of w_scaled has at least 5 bits (64 + alpha = 5)
-	 * and at most 32 bits (64 + gamma = 32). The integral part has
-	 * at most 10 decimal digits, so kappa <= 10.
-	 */
-	int kappa = 10;
-	uint32_t div = 1000000000;
-
-	int rem_signif_d_cnt = signif_d_cnt;
-	int rem_frac_d_cnt =
-	    (frac_d_cnt >= 0) ? (kappa - scale + frac_d_cnt) : INT_MAX;
-
-	/* Produce decimal digits for the integral part of w_scaled. */
-	while (kappa > 0 && rem_signif_d_cnt != 0 && rem_frac_d_cnt > 0) {
-		int digit = int_part / div;
-		int_part %= div;
-
-		div /= 10;
-		--kappa;
-		--rem_frac_d_cnt;
-
-		/* Skip leading zeros. */
-		if (digit == 0 && len == 0) {
-			continue;
-		}
-
-		/* Current length + new digit + null terminator <= buf_size */
-		if (len + 2 <= buf_size) {
-			buf[len] = '0' + digit;
-			++len;
-			--rem_signif_d_cnt;
-		} else {
-			return -1;
-		}
-	}
-
-	/* Generate decimal digits for the fractional part of w_scaled. */
-	while (w_err <= frac_part && rem_signif_d_cnt != 0 && rem_frac_d_cnt > 0) {
-		/*
-		 * Does not overflow because at least 5 upper bits were
-		 * taken by the integral part and are now unused in frac_part.
-		 */
-		frac_part *= 10;
-		w_err *= 10;
-
-		/* frac_part / one */
-		int digit = (int)(frac_part >> (-one.exponent));
-
-		/* frac_part %= one */
-		frac_part &= one.significand - 1;
-
-		--kappa;
-		--rem_frac_d_cnt;
-
-		/* Skip leading zeros. */
-		if (digit == 0 && len == 0) {
-			continue;
-		}
-
-		/* Current length + new digit + null terminator <= buf_size */
-		if (len + 2 <= buf_size) {
-			buf[len] = '0' + digit;
-			++len;
-			--rem_signif_d_cnt;
-		} else {
-			return -1;
-		}
-	}
-
-	assert(/* 0 <= len && */ len < buf_size);
-
-	if (0 < len) {
-		*dec_exponent = kappa - scale;
-		assert(frac_d_cnt < 0 || -frac_d_cnt <= *dec_exponent);
-	} else {
-		/*
-		 * The number of fractional digits was too limiting to produce
-		 * any digits.
-		 */
-		assert(rem_frac_d_cnt <= 0 || w_scaled.significand == 0);
-		*dec_exponent = 0;
-		buf[0] = '0';
-		len = 1;
-	}
-
-	if (len < buf_size) {
-		buf[len] = '\0';
-		assert(signif_d_cnt < 0 || (int)len <= signif_d_cnt);
-		return len;
-	} else {
-		return -1;
-	}
-}
-
-/** Converts a non-special double into its string representation.
- *
- * Conceptually, the truncated double value is: buf * 10^dec_exponent
- *
- * Conversion errors are tracked, so all produced digits except the
- * last one are accurate. Garbage digits are never produced.
- * If the requested number of digits cannot be produced accurately
- * due to conversion errors less digits are produced than requested
- * and the last digit has an error of +/- 1 (so if '7' is the last
- * converted digit it might have been converted to any of '6'..'8'
- * had the conversion been completely precise).
- *
- * If no error occurs at least one digit is output.
- *
- * The conversion stops once the requested number of significant or
- * fractional digits is reached or the conversion error is too large
- * to generate any more digits (whichever happens first).
- *
- * Any digits following the first (most-significant) digit (this digit
- * included) are counted as significant digits; eg:
- *   1.4,    4 signif -> "1400" * 10^-3, ie 1.400
- *   1000.3, 1 signif -> "1" * 10^3      ie 1000
- *   0.003,  2 signif -> "30" * 10^-4    ie 0.003
- *   9.5     1 signif -> "9" * 10^0,     ie 9
- *
- * Any digits following the decimal point are counted as fractional digits.
- * This includes the zeros that would appear between the decimal point
- * and the first non-zero fractional digit. If fewer fractional digits
- * are requested than would allow to place the most-significant digit
- * a "0" is output. Eg:
- *   1.4,   3 frac -> "1400" * 10^-3,   ie 1.400
- *   12.34  4 frac -> "123400" * 10^-4, ie 12.3400
- *   3e-99  4 frac -> "0" * 10^0,       ie 0
- *   0.009  2 frac -> "0" * 10^-2,      ie 0
- *
- * @param ieee_val Binary double description to convert. Must be the product
- *                 of extract_ieee_double and it must not be a special number.
- * @param signif_d_cnt Maximum number of significant digits to produce.
- *                 The output is not rounded.
- *                 Set to a negative value to generate as many digits
- *                 as accurately possible.
- * @param frac_d_cnt Maximum number of fractional digits to produce including
- *                 any zeros immediately trailing the decimal point.
- *                 The output is not rounded.
- *                 Set to a negative value to generate as many digits
- *                 as accurately possible.
- * @param buf      Buffer to store the string representation. Must be large
- *                 enough to store all digits and a null terminator. At most
- *                 MAX_DOUBLE_STR_LEN digits will be written (not counting
- *                 the null terminator).
- * @param buf_size Size of buf in bytes.
- * @param dec_exponent Set to the decimal exponent of the number string
- *                 in buf.
- *
- * @return The number of output digits. A negative value indicates
- *         an error: buf too small (or ieee_val.is_special, or
- *         signif_d_cnt == 0).
- */
-int double_to_fixed_str(ieee_double_t ieee_val, int signif_d_cnt,
-    int frac_d_cnt, char *buf, size_t buf_size, int *dec_exponent)
-{
-	/* The whole computation assumes 64bit significand. */
-	static_assert(sizeof(ieee_val.pos_val.significand) == sizeof(uint64_t), "");
-
-	if (ieee_val.is_special) {
-		return -1;
-	}
-
-	/* Zero cannot be normalized. Handle it here. */
-	if (0 == ieee_val.pos_val.significand) {
-		return zero_to_str(buf, buf_size, dec_exponent);
-	}
-
-	/* Normalize and scale. */
-	fp_num_t w = normalize(ieee_val.pos_val);
-
-	int lower_bin_exp = alpha - w.exponent - significand_width;
-
-	int scale;
-	fp_num_t scaling_power_of_10;
-
-	get_power_of_ten(lower_bin_exp, &scaling_power_of_10, &scale);
-
-	fp_num_t w_scaled = multiply(w, scaling_power_of_10);
-
-	/* Produce decimal digits from the scaled number. */
-	int len = gen_fixed_dec_digits(w_scaled, scale, signif_d_cnt, frac_d_cnt,
-	    buf, buf_size, dec_exponent);
-
-	assert(len <= MAX_DOUBLE_STR_LEN);
-	return len;
-}
Index: pace/lib/c/generic/elf/elf.c
===================================================================
--- uspace/lib/c/generic/elf/elf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <elf/elf.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * Checks that the ELF header is valid for the running system.
- */
-static bool elf_is_valid(const elf_header_t *header)
-{
-	// TODO: check more things
-	// TODO: debug output
-
-	if (header->e_ident[EI_MAG0] != ELFMAG0 ||
-	    header->e_ident[EI_MAG1] != ELFMAG1 ||
-	    header->e_ident[EI_MAG2] != ELFMAG2 ||
-	    header->e_ident[EI_MAG3] != ELFMAG3) {
-		return false;
-	}
-
-	if (header->e_ident[EI_DATA] != ELF_DATA_ENCODING ||
-	    header->e_machine != ELF_MACHINE ||
-	    header->e_ident[EI_VERSION] != EV_CURRENT ||
-	    header->e_version != EV_CURRENT ||
-	    header->e_ident[EI_CLASS] != ELF_CLASS) {
-		return false;
-	}
-
-	if (header->e_phentsize != sizeof(elf_segment_header_t)) {
-		return false;
-	}
-
-	if (header->e_type != ET_EXEC && header->e_type != ET_DYN) {
-		return false;
-	}
-
-	return true;
-}
-
-/**
- * Given the base of an ELF image in memory (i.e. pointer to the file
- * header at the beginning of the text segment), returns pointer to the
- * first segment header with the given p_type.
- */
-const elf_segment_header_t *elf_get_phdr(const void *base, unsigned p_type)
-{
-	const elf_header_t *hdr = base;
-	assert(elf_is_valid(hdr));
-
-	const elf_segment_header_t *phdr =
-	    (const elf_segment_header_t *) ((uintptr_t) base + hdr->e_phoff);
-
-	for (int i = 0; i < hdr->e_phnum; i++) {
-		if (phdr[i].p_type == p_type)
-			return &phdr[i];
-	}
-
-	return NULL;
-}
-
-uintptr_t elf_get_bias(const void *base)
-{
-	const elf_header_t *hdr = base;
-	assert(elf_is_valid(hdr));
-
-	/*
-	 * There are two legal options for a HelenOS ELF file.
-	 * Either the file is ET_DYN (shared library or PIE), and the base is
-	 * (required to be) at vaddr 0. Or the file is ET_EXEC (non-relocatable)
-	 * and the bias is trivially 0.
-	 */
-
-	if (hdr->e_type == ET_DYN)
-		return (uintptr_t) base;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/elf/elf_load.c
===================================================================
--- uspace/lib/c/generic/elf/elf_load.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief	Userspace ELF loader.
- */
-
-#include <elf/elf_load.h>
-#include <elf/elf_mod.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-#define DPRINTF(...)
-
-/** Load ELF program.
- *
- * @param file File handle
- * @param info Place to store ELF program information
- * @return EOK on success or an error code
- */
-errno_t elf_load(int file, elf_info_t *info)
-{
-#ifdef CONFIG_RTLD
-	rtld_t *env;
-#endif
-	errno_t rc = EOK;
-	elf_finfo_t *finfo = &info->finfo;
-
-	rc = elf_load_file(file, 0, finfo);
-	if (rc != EOK) {
-		DPRINTF("Failed to load executable.\n");
-		return rc;
-	}
-
-#ifdef CONFIG_RTLD
-	DPRINTF("- prog dynamic: %p\n", finfo->dynamic);
-	rc = rtld_prog_process(finfo, &env);
-	if (rc != EOK) {
-		DPRINTF("Failed to process executable.\n");
-		return rc;
-	}
-	info->env = env;
-	return EOK;
-#else
-	if (info->finfo.dynamic == NULL) {
-		info->env = NULL;
-		return EOK;
-	}
-
-	DPRINTF("Error: trying to run a dynamically-linked executable with CONFIG_RTLD disabled.\n");
-	return ENOTSUP;
-#endif
-}
-
-/** Set ELF-related PCB entries.
- *
- * Fills the program control block @a pcb with information from
- * @a info.
- *
- * @param info	Program info structure
- * @param pcb PCB
- */
-void elf_set_pcb(elf_info_t *info, pcb_t *pcb)
-{
-	pcb->entry = info->finfo.entry;
-	pcb->dynamic = info->finfo.dynamic;
-	pcb->rtld_runtime = info->env;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/elf/elf_mod.c
===================================================================
--- uspace/lib/c/generic/elf/elf_mod.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,486 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief	Userspace ELF module loader.
- *
- * This module allows loading ELF binaries (both executables and
- * shared objects) from VFS. The current implementation allocates
- * anonymous memory, fills it with segment data and then adjusts
- * the memory areas' flags to the final value. In the future,
- * the segments will be mapped directly from the file.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <vfs/vfs.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <align.h>
-#include <assert.h>
-#include <as.h>
-#include <elf/elf.h>
-#include <smc.h>
-#include <loader/pcb.h>
-#include <entry_point.h>
-#include <str_error.h>
-#include <stdlib.h>
-#include <macros.h>
-
-#include <elf/elf_load.h>
-
-#define DPRINTF(...)
-
-static errno_t elf_load_module(elf_ld_t *elf);
-static errno_t segment_header(elf_ld_t *elf, elf_segment_header_t *entry);
-static errno_t load_segment(elf_ld_t *elf, elf_segment_header_t *entry);
-
-/** Load ELF binary from a file.
- *
- * Load an ELF binary from the specified file. If the file is
- * an executable program, it is loaded unbiased. If it is a shared
- * object, it is loaded with the bias @a so_bias. Some information
- * extracted from the binary is stored in a elf_info_t structure
- * pointed to by @a info.
- *
- * @param file      ELF file.
- * @param info      Pointer to a structure for storing information
- *                  extracted from the binary.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t elf_load_file(int file, eld_flags_t flags, elf_finfo_t *info)
-{
-	elf_ld_t elf;
-
-	int ofile;
-	errno_t rc = vfs_clone(file, -1, true, &ofile);
-	if (rc == EOK) {
-		rc = vfs_open(ofile, MODE_READ);
-	}
-	if (rc != EOK) {
-		return rc;
-	}
-
-	elf.fd = ofile;
-	elf.info = info;
-	elf.flags = flags;
-
-	rc = elf_load_module(&elf);
-
-	vfs_put(ofile);
-	return rc;
-}
-
-errno_t elf_load_file_name(const char *path, eld_flags_t flags, elf_finfo_t *info)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc == EOK) {
-		rc = elf_load_file(file, flags, info);
-		vfs_put(file);
-		return rc;
-	} else {
-		return EIO;
-	}
-}
-
-/** Load an ELF binary.
- *
- * The @a elf structure contains the loader state, including
- * an open file, from which the binary will be loaded,
- * a pointer to the @c info structure etc.
- *
- * @param elf		Pointer to loader state buffer.
- * @return EOK on success or an error code.
- */
-static errno_t elf_load_module(elf_ld_t *elf)
-{
-	elf_header_t header_buf;
-	elf_header_t *header = &header_buf;
-	aoff64_t pos = 0;
-	size_t nr;
-	int i;
-	errno_t rc;
-
-	rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr);
-	if (rc != EOK || nr != sizeof(elf_header_t)) {
-		DPRINTF("Read error.\n");
-		return EIO;
-	}
-
-	/* Identify ELF */
-	if (header->e_ident[EI_MAG0] != ELFMAG0 ||
-	    header->e_ident[EI_MAG1] != ELFMAG1 ||
-	    header->e_ident[EI_MAG2] != ELFMAG2 ||
-	    header->e_ident[EI_MAG3] != ELFMAG3) {
-		DPRINTF("Invalid header.\n");
-		return EINVAL;
-	}
-
-	/* Identify ELF compatibility */
-	if (header->e_ident[EI_DATA] != ELF_DATA_ENCODING ||
-	    header->e_machine != ELF_MACHINE ||
-	    header->e_ident[EI_VERSION] != EV_CURRENT ||
-	    header->e_version != EV_CURRENT ||
-	    header->e_ident[EI_CLASS] != ELF_CLASS) {
-		DPRINTF("Incompatible data/version/class.\n");
-		return EINVAL;
-	}
-
-	if (header->e_phentsize != sizeof(elf_segment_header_t)) {
-		DPRINTF("e_phentsize: %u != %zu\n", header->e_phentsize,
-		    sizeof(elf_segment_header_t));
-		return EINVAL;
-	}
-
-	/* Check if the object type is supported. */
-	if (header->e_type != ET_EXEC && header->e_type != ET_DYN) {
-		DPRINTF("Object type %d is not supported\n", header->e_type);
-		return ENOTSUP;
-	}
-
-	if (header->e_phoff == 0) {
-		DPRINTF("Program header table is not present!\n");
-		return ENOTSUP;
-	}
-
-	/*
-	 * Read program header table.
-	 * Normally, there are very few program headers, so don't bother
-	 * with allocating memory dynamically.
-	 */
-	const int phdr_cap = 16;
-	elf_segment_header_t phdr[phdr_cap];
-	size_t phdr_len = header->e_phnum * header->e_phentsize;
-
-	elf->info->interp = NULL;
-	elf->info->dynamic = NULL;
-
-	if (phdr_len > sizeof(phdr)) {
-		DPRINTF("more than %d program headers\n", phdr_cap);
-		return ENOTSUP;
-	}
-
-	pos = header->e_phoff;
-	rc = vfs_read(elf->fd, &pos, phdr, phdr_len, &nr);
-	if (rc != EOK || nr != phdr_len) {
-		DPRINTF("Read error.\n");
-		return EIO;
-	}
-
-	uintptr_t module_base = UINTPTR_MAX;
-	uintptr_t module_top = 0;
-	uintptr_t base_offset = UINTPTR_MAX;
-
-	/* Walk through PT_LOAD headers, to find out the size of the module. */
-	for (i = 0; i < header->e_phnum; i++) {
-		if (phdr[i].p_type != PT_LOAD)
-			continue;
-
-		if (module_base > phdr[i].p_vaddr) {
-			module_base = phdr[i].p_vaddr;
-			base_offset = phdr[i].p_offset;
-		}
-		module_top = max(module_top, phdr[i].p_vaddr + phdr[i].p_memsz);
-	}
-
-	if (base_offset != 0) {
-		DPRINTF("ELF headers not present in the text segment.\n");
-		return EINVAL;
-	}
-
-	/* Shared objects can be loaded with a bias */
-	if (header->e_type != ET_DYN) {
-		elf->bias = 0;
-	} else {
-		if (module_base != 0) {
-			DPRINTF("Unexpected shared object format.\n");
-			return EINVAL;
-		}
-
-		/*
-		 * Attempt to allocate a span of memory large enough for the
-		 * shared object.
-		 */
-		// FIXME: This is not reliable when we're running
-		//        multi-threaded. Even if this part succeeds, later
-		//        allocation can fail because another thread took the
-		//        space in the meantime. This is only relevant for
-		//        dlopen() though.
-		void *area = as_area_create(AS_AREA_ANY, module_top,
-		    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE |
-		    AS_AREA_LATE_RESERVE, AS_AREA_UNPAGED);
-
-		if (area == AS_MAP_FAILED) {
-			DPRINTF("Can't find suitable memory area.\n");
-			return ENOMEM;
-		}
-
-		elf->bias = (uintptr_t) area;
-		as_area_destroy(area);
-	}
-
-	/* Load all loadable segments. */
-	for (i = 0; i < header->e_phnum; i++) {
-		if (phdr[i].p_type != PT_LOAD)
-			continue;
-
-		rc = load_segment(elf, &phdr[i]);
-		if (rc != EOK)
-			return rc;
-	}
-
-	void *base = (void *) module_base + elf->bias;
-	elf->info->base = base;
-
-	/* Ensure valid TLS info even if there is no TLS header. */
-	elf->info->tls.tdata = NULL;
-	elf->info->tls.tdata_size = 0;
-	elf->info->tls.tbss_size = 0;
-	elf->info->tls.tls_align = 1;
-
-	elf->info->interp = NULL;
-	elf->info->dynamic = NULL;
-
-	/* Walk through all segment headers and process them. */
-	for (i = 0; i < header->e_phnum; i++) {
-		if (phdr[i].p_type == PT_LOAD)
-			continue;
-
-		rc = segment_header(elf, &phdr[i]);
-		if (rc != EOK)
-			return rc;
-	}
-
-	elf->info->entry =
-	    (entry_point_t)((uint8_t *)header->e_entry + elf->bias);
-
-	DPRINTF("Done.\n");
-
-	return EOK;
-}
-
-/** Process TLS program header.
- *
- * @param elf  Pointer to loader state buffer.
- * @param hdr  TLS program header
- * @param info Place to store TLS info
- */
-static void tls_program_header(elf_ld_t *elf, elf_segment_header_t *hdr,
-    elf_tls_info_t *info)
-{
-	info->tdata = (void *)((uint8_t *)hdr->p_vaddr + elf->bias);
-	info->tdata_size = hdr->p_filesz;
-	info->tbss_size = hdr->p_memsz - hdr->p_filesz;
-	info->tls_align = hdr->p_align;
-}
-
-/** Process segment header.
- *
- * @param elf   Pointer to loader state buffer.
- * @param entry	Segment header.
- *
- * @return EOK on success, error code otherwise.
- */
-static errno_t segment_header(elf_ld_t *elf, elf_segment_header_t *entry)
-{
-	switch (entry->p_type) {
-	case PT_NULL:
-	case PT_PHDR:
-	case PT_NOTE:
-		break;
-	case PT_GNU_EH_FRAME:
-	case PT_GNU_STACK:
-	case PT_GNU_RELRO:
-		/* Ignore GNU headers, if present. */
-		break;
-	case PT_INTERP:
-		elf->info->interp =
-		    (void *)((uint8_t *)entry->p_vaddr + elf->bias);
-
-		if (entry->p_filesz == 0) {
-			DPRINTF("Zero-sized ELF interp string.\n");
-			return EINVAL;
-		}
-		if (elf->info->interp[entry->p_filesz - 1] != '\0') {
-			DPRINTF("Unterminated ELF interp string.\n");
-			return EINVAL;
-		}
-		DPRINTF("interpreter: \"%s\"\n", elf->info->interp);
-		break;
-	case PT_DYNAMIC:
-		/* Record pointer to dynamic section into info structure */
-		elf->info->dynamic =
-		    (void *)((uint8_t *)entry->p_vaddr + elf->bias);
-		DPRINTF("dynamic section found at %p\n",
-		    (void *)elf->info->dynamic);
-		break;
-	case 0x70000000:
-	case 0x70000001:
-	case 0x70000002:
-	case 0x70000003:
-		// FIXME: Architecture-specific headers.
-		/* PT_MIPS_REGINFO, PT_MIPS_ABIFLAGS, PT_ARM_UNWIND, ... */
-		break;
-	case PT_TLS:
-		/* Parse TLS program header */
-		tls_program_header(elf, entry, &elf->info->tls);
-		DPRINTF("TLS header found at %p\n",
-		    (void *)((uint8_t *)entry->p_vaddr + elf->bias));
-		break;
-	case PT_SHLIB:
-	default:
-		DPRINTF("Segment p_type %d unknown.\n", entry->p_type);
-		return ENOTSUP;
-		break;
-	}
-	return EOK;
-}
-
-/** Load segment described by program header entry.
- *
- * @param elf	Loader state.
- * @param entry Program header entry describing segment to be loaded.
- *
- * @return EOK on success, error code otherwise.
- */
-errno_t load_segment(elf_ld_t *elf, elf_segment_header_t *entry)
-{
-	void *a;
-	int flags = 0;
-	uintptr_t bias;
-	uintptr_t base;
-	void *seg_ptr;
-	uintptr_t seg_addr;
-	size_t mem_sz;
-	aoff64_t pos;
-	errno_t rc;
-	size_t nr;
-
-	bias = elf->bias;
-
-	seg_addr = entry->p_vaddr + bias;
-	seg_ptr = (void *) seg_addr;
-
-	DPRINTF("Load segment v_addr=0x%zx at addr %p, size 0x%zx, flags %c%c%c\n",
-	    entry->p_vaddr,
-	    (void *) seg_addr,
-	    entry->p_memsz,
-	    (entry->p_flags & PF_R) ? 'r' : '-',
-	    (entry->p_flags & PF_W) ? 'w' : '-',
-	    (entry->p_flags & PF_X) ? 'x' : '-');
-
-	if (entry->p_align > 1) {
-		if ((entry->p_offset % entry->p_align) !=
-		    (seg_addr % entry->p_align)) {
-			DPRINTF("Align check 1 failed offset%%align=0x%zx, "
-			    "vaddr%%align=0x%zx align=0x%zx\n",
-			    entry->p_offset % entry->p_align,
-			    seg_addr % entry->p_align, entry->p_align);
-			return EINVAL;
-		}
-	}
-
-	/* Final flags that will be set for the memory area */
-
-	if (entry->p_flags & PF_X)
-		flags |= AS_AREA_EXEC;
-	if (entry->p_flags & PF_W)
-		flags |= AS_AREA_WRITE;
-	if (entry->p_flags & PF_R)
-		flags |= AS_AREA_READ;
-	flags |= AS_AREA_CACHEABLE;
-
-	base = ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE);
-	mem_sz = entry->p_memsz + (entry->p_vaddr - base);
-
-	DPRINTF("Map to seg_addr=%p-%p.\n", (void *) seg_addr,
-	    (void *) (entry->p_vaddr + bias +
-	    ALIGN_UP(entry->p_memsz, PAGE_SIZE)));
-
-	/*
-	 * For the course of loading, the area needs to be readable
-	 * and writeable.
-	 */
-	a = as_area_create((uint8_t *) base + bias, mem_sz,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
-	    AS_AREA_UNPAGED);
-	if (a == AS_MAP_FAILED) {
-		DPRINTF("memory mapping failed (%p, %zu)\n",
-		    (void *) (base + bias), mem_sz);
-		return ENOMEM;
-	}
-
-	DPRINTF("as_area_create(%p, %#zx, %d) -> %p\n",
-	    (void *) (base + bias), mem_sz, flags, (void *) a);
-
-	/*
-	 * Load segment data
-	 */
-	pos = entry->p_offset;
-	rc = vfs_read(elf->fd, &pos, seg_ptr, entry->p_filesz, &nr);
-	if (rc != EOK || nr != entry->p_filesz) {
-		DPRINTF("read error\n");
-		return EIO;
-	}
-
-	/*
-	 * The caller wants to modify the segments first. He will then
-	 * need to set the right access mode and ensure SMC coherence.
-	 */
-	if ((elf->flags & ELDF_RW) != 0)
-		return EOK;
-
-	DPRINTF("as_area_change_flags(%p, %x)\n",
-	    (uint8_t *) base + bias, flags);
-	rc = as_area_change_flags((uint8_t *) base + bias, flags);
-	if (rc != EOK) {
-		DPRINTF("Failed to set memory area flags.\n");
-		return ENOMEM;
-	}
-
-	if (flags & AS_AREA_EXEC) {
-		/* Enforce SMC coherence for the segment */
-		if (smc_coherence(seg_ptr, entry->p_filesz))
-			return ENOMEM;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/errno.c
===================================================================
--- uspace/lib/c/generic/errno.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <fibril.h>
-
-static fibril_local errno_t fibril_errno;
-
-errno_t *__errno(void)
-{
-	return &fibril_errno;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/event.c
===================================================================
--- uspace/lib/c/generic/event.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- * @}
- */
-
-/** @addtogroup libc
- */
-/** @file
- */
-
-#include <libc.h>
-#include <ipc/event.h>
-
-/** Subscribe to event notifications.
- *
- * @param evno    Event type to subscribe.
- * @param imethod Use this interface and method for notifying me.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_subscribe(event_type_t evno, sysarg_t imethod)
-{
-	return (errno_t) __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
-	    (sysarg_t) imethod);
-}
-
-/** Subscribe to task event notifications.
- *
- * @param evno    Event type to subscribe.
- * @param imethod Use this interface and method for notifying me.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_task_subscribe(event_task_type_t evno, sysarg_t imethod)
-{
-	return (errno_t) __SYSCALL2(SYS_IPC_EVENT_SUBSCRIBE, (sysarg_t) evno,
-	    (sysarg_t) imethod);
-}
-
-/** Unsubscribe from event notifications.
- *
- * @param evno    Event type to unsubscribe.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_unsubscribe(event_type_t evno)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
-}
-
-/** Unsubscribe from task event notifications.
- *
- * @param evno    Event type to unsubscribe.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_task_unsubscribe(event_task_type_t evno)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNSUBSCRIBE, (sysarg_t) evno);
-}
-
-/** Unmask event notifications.
- *
- * @param evno Event type to unmask.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_unmask(event_type_t evno)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
-}
-
-/** Unmask task event notifications.
- *
- * @param evno Event type to unmask.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_event_task_unmask(event_task_type_t evno)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_EVENT_UNMASK, (sysarg_t) evno);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/getopt.c
===================================================================
--- uspace/lib/c/generic/getopt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,460 +1,0 @@
-/*	$NetBSD: getopt_long.c,v 1.21.4.1 2008/01/09 01:34:14 matt Exp $	*/
-
-/*
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Ported to HelenOS August 2008 by Tim Post <echo@echoreply.us> */
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <getopt.h>
-#include <str.h>
-
-/*
- * HelenOS Port : We're incorporating only the modern getopt_long with wrappers
- * to keep legacy getopt() usage from breaking. All references to REPLACE_GETOPT
- * are dropped, we just include the code
- */
-
-int	opterr = 1;		/* if error message should be printed */
-int	optind = 1;		/* index into parent argv vector */
-int	optopt = '?';		/* character checked for validity */
-int	optreset;		/* reset getopt */
-char	*optarg;		/* argument associated with option */
-
-#define IGNORE_FIRST	(*options == '-' || *options == '+')
-#define PRINT_ERROR	((opterr) && ((*options != ':') \
-				      || (IGNORE_FIRST && options[1] != ':')))
-/* HelenOS Port - POSIXLY_CORRECT is always false */
-#define IS_POSIXLY_CORRECT 0
-#define PERMUTE         (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
-/* XXX: GNU ignores PC if *options == '-' */
-#define IN_ORDER        (!IS_POSIXLY_CORRECT && *options == '-')
-
-/* return values */
-#define	BADCH	(int)'?'
-#define	BADARG		((IGNORE_FIRST && options[1] == ':') \
-			 || (*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
-
-static char EMSG[] = "";
-
-static int getopt_internal(int, char **, const char *);
-static int gcd(int, int);
-static void permute_args(int, int, int, char **);
-
-static char *place = EMSG; /* option letter processing */
-
-/* XXX: set optreset to 1 rather than these two */
-static int nonopt_start = -1; /* first non option argument (for permute) */
-static int nonopt_end = -1;   /* first option after non options (for permute) */
-
-/* Error messages */
-
-/*
- * HelenOS Port: Calls to warnx() were eliminated (as we have no stderr that
- * may be redirected) and replaced with printf. As such, error messages now
- * end in a newline
- */
-
-static const char recargchar[] = "option requires an argument -- %c\n";
-static const char recargstring[] = "option requires an argument -- %s\n";
-static const char ambig[] = "ambiguous option -- %.*s\n";
-static const char noarg[] = "option doesn't take an argument -- %.*s\n";
-static const char illoptchar[] = "unknown option -- %c\n";
-static const char illoptstring[] = "unknown option -- %s\n";
-
-/*
- * Compute the greatest common divisor of a and b.
- */
-static int gcd(int a, int b)
-{
-	int c;
-
-	c = a % b;
-	while (c != 0) {
-		a = b;
-		b = c;
-		c = a % b;
-	}
-
-	return b;
-}
-
-/*
- * Exchange the block from nonopt_start to nonopt_end with the block
- * from nonopt_end to opt_end (keeping the same order of arguments
- * in each block).
- */
-static void permute_args(int panonopt_start, int panonopt_end, int opt_end,
-    char **nargv)
-{
-	int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
-	char *swap;
-
-	assert(nargv != NULL);
-
-	/*
-	 * compute lengths of blocks and number and size of cycles
-	 */
-	nnonopts = panonopt_end - panonopt_start;
-	nopts = opt_end - panonopt_end;
-	ncycle = gcd(nnonopts, nopts);
-	cyclelen = (opt_end - panonopt_start) / ncycle;
-
-	for (i = 0; i < ncycle; i++) {
-		cstart = panonopt_end + i;
-		pos = cstart;
-		for (j = 0; j < cyclelen; j++) {
-			if (pos >= panonopt_end)
-				pos -= nnonopts;
-			else
-				pos += nopts;
-			swap = nargv[pos];
-			nargv[pos] = nargv[cstart];
-			nargv[cstart] = swap;
-		}
-	}
-}
-
-/*
- * getopt_internal --
- *	Parse argc/argv argument vector.  Called by user level routines.
- *  Returns -2 if -- is found (can be long option or end of options marker).
- */
-static int getopt_internal(int nargc, char **nargv, const char *options)
-{
-	const char *oli;				/* option letter list index */
-	int optchar;
-
-	assert(nargv != NULL);
-	assert(options != NULL);
-
-	optarg = NULL;
-
-	/*
-	 * XXX Some programs (like rsyncd) expect to be able to
-	 * XXX re-initialize optind to 0 and have getopt_long(3)
-	 * XXX properly function again.  Work around this braindamage.
-	 */
-	if (optind == 0)
-		optind = 1;
-
-	if (optreset)
-		nonopt_start = nonopt_end = -1;
-start:
-	if (optreset || !*place) {		/* update scanning pointer */
-		optreset = 0;
-		if (optind >= nargc) {          /* end of argument vector */
-			place = EMSG;
-			if (nonopt_end != -1) {
-				/* do permutation, if we have to */
-				permute_args(nonopt_start, nonopt_end,
-				    optind, nargv);
-				optind -= nonopt_end - nonopt_start;
-			} else if (nonopt_start != -1) {
-				/*
-				 * If we skipped non-options, set optind
-				 * to the first of them.
-				 */
-				optind = nonopt_start;
-			}
-			nonopt_start = nonopt_end = -1;
-			return -1;
-		}
-		if ((*(place = nargv[optind]) != '-') ||
-		    (place[1] == '\0')) {    /* found non-option */
-			place = EMSG;
-			if (IN_ORDER) {
-				/*
-				 * GNU extension:
-				 * return non-option as argument to option 1
-				 */
-				optarg = nargv[optind++];
-				return INORDER;
-			}
-			if (!PERMUTE) {
-				/*
-				 * if no permutation wanted, stop parsing
-				 * at first non-option
-				 */
-				return -1;
-			}
-			/* do permutation */
-			if (nonopt_start == -1)
-				nonopt_start = optind;
-			else if (nonopt_end != -1) {
-				permute_args(nonopt_start, nonopt_end,
-				    optind, nargv);
-				nonopt_start = optind -
-				    (nonopt_end - nonopt_start);
-				nonopt_end = -1;
-			}
-			optind++;
-			/* process next argument */
-			goto start;
-		}
-		if (nonopt_start != -1 && nonopt_end == -1)
-			nonopt_end = optind;
-		if (place[1] && *++place == '-') {	/* found "--" */
-			place++;
-			return -2;
-		}
-	}
-	if ((optchar = (int)*place++) == (int)':' ||
-	    (oli = str_chr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
-		/* option letter unknown or ':' */
-		if (!*place)
-			++optind;
-		if (PRINT_ERROR)
-			printf(illoptchar, optchar);
-		optopt = optchar;
-		return BADCH;
-	}
-	if (optchar == 'W' && oli[1] == ';') {		/* -W long-option */
-		/* XXX: what if no long options provided (called by getopt)? */
-		if (*place)
-			return -2;
-
-		if (++optind >= nargc) {	/* no arg */
-			place = EMSG;
-			if (PRINT_ERROR)
-				printf(recargchar, optchar);
-			optopt = optchar;
-			return BADARG;
-		} else				/* white space */
-			place = nargv[optind];
-		/*
-		 * Handle -W arg the same as --arg (which causes getopt to
-		 * stop parsing).
-		 */
-		return -2;
-	}
-	if (*++oli != ':') {			/* doesn't take argument */
-		if (!*place)
-			++optind;
-	} else {				/* takes (optional) argument */
-		optarg = NULL;
-		if (*place)			/* no white space */
-			optarg = place;
-		/* XXX: disable test for :: if PC? (GNU doesn't) */
-		else if (oli[1] != ':') {	/* arg not optional */
-			if (++optind >= nargc) {	/* no arg */
-				place = EMSG;
-				if (PRINT_ERROR)
-					printf(recargchar, optchar);
-				optopt = optchar;
-				return BADARG;
-			} else
-				optarg = nargv[optind];
-		}
-		place = EMSG;
-		++optind;
-	}
-	/* dump back option letter */
-	return optchar;
-}
-
-/*
- * getopt --
- *	Parse argc/argv argument vector.
- */
-int getopt(int nargc, char *const *nargv, const char *options)
-{
-	int retval;
-
-	assert(nargv != NULL);
-	assert(options != NULL);
-
-	retval = getopt_internal(nargc, (char **)nargv, options);
-	if (retval == -2) {
-		++optind;
-		/*
-		 * We found an option (--), so if we skipped non-options,
-		 * we have to permute.
-		 */
-		if (nonopt_end != -1) {
-			permute_args(nonopt_start, nonopt_end, optind,
-			    (char **)nargv);
-			optind -= nonopt_end - nonopt_start;
-		}
-		nonopt_start = nonopt_end = -1;
-		retval = -1;
-	}
-	return retval;
-}
-
-/*
- * getopt_long --
- *	Parse argc/argv argument vector.
- */
-int getopt_long(int nargc, char *const *nargv, const char *options,
-    const struct option *long_options, int *idx)
-{
-	int retval;
-
-#define IDENTICAL_INTERPRETATION(_x, _y)				\
-	(long_options[(_x)].has_arg == long_options[(_y)].has_arg &&	\
-	 long_options[(_x)].flag == long_options[(_y)].flag &&		\
-	 long_options[(_x)].val == long_options[(_y)].val)
-
-	assert(nargv != NULL);
-	assert(options != NULL);
-	assert(long_options != NULL);
-	/* idx may be NULL */
-
-	retval = getopt_internal(nargc, (char **)nargv, options);
-	if (retval == -2) {
-		char *current_argv;
-		char *has_equal;
-		size_t current_argv_len;
-		int i, ambiguous, match;
-
-		current_argv = (char *)place;
-		match = -1;
-		ambiguous = 0;
-
-		optind++;
-		place = EMSG;
-
-		if (*current_argv == '\0') {		/* found "--" */
-			/*
-			 * We found an option (--), so if we skipped
-			 * non-options, we have to permute.
-			 */
-			if (nonopt_end != -1) {
-				permute_args(nonopt_start, nonopt_end,
-				    optind, (char **)nargv);
-				optind -= nonopt_end - nonopt_start;
-			}
-			nonopt_start = nonopt_end = -1;
-			return -1;
-		}
-		if ((has_equal = str_chr(current_argv, '=')) != NULL) {
-			/* argument found (--option=arg) */
-			current_argv_len = has_equal - current_argv;
-			has_equal++;
-		} else
-			current_argv_len = str_size(current_argv);
-
-		for (i = 0; long_options[i].name; i++) {
-			/* find matching long option */
-			if (str_lcmp(current_argv, long_options[i].name,
-			    str_nlength(current_argv, current_argv_len)))
-				continue;
-
-			if (str_size(long_options[i].name) ==
-			    (unsigned)current_argv_len) {
-				/* exact match */
-				match = i;
-				ambiguous = 0;
-				break;
-			}
-			if (match == -1)		/* partial match */
-				match = i;
-			else if (!IDENTICAL_INTERPRETATION(i, match))
-				ambiguous = 1;
-		}
-		if (ambiguous) {
-			/* ambiguous abbreviation */
-			if (PRINT_ERROR)
-				printf(ambig, (int)current_argv_len,
-				    current_argv);
-			optopt = 0;
-			return BADCH;
-		}
-		if (match != -1) {			/* option found */
-			if (long_options[match].has_arg == no_argument &&
-			    has_equal) {
-				if (PRINT_ERROR)
-					printf(noarg, (int)current_argv_len,
-					    current_argv);
-				/*
-				 * XXX: GNU sets optopt to val regardless of
-				 * flag
-				 */
-				if (long_options[match].flag == NULL)
-					optopt = long_options[match].val;
-				else
-					optopt = 0;
-				return BADARG;
-			}
-			if (long_options[match].has_arg == required_argument ||
-			    long_options[match].has_arg == optional_argument) {
-				if (has_equal)
-					optarg = has_equal;
-				else if (long_options[match].has_arg ==
-				    required_argument) {
-					/*
-					 * optional argument doesn't use
-					 * next nargv
-					 */
-					optarg = nargv[optind++];
-				}
-			}
-			if ((long_options[match].has_arg == required_argument) &&
-			    (optarg == NULL)) {
-				/*
-				 * Missing argument; leading ':'
-				 * indicates no error should be generated
-				 */
-				if (PRINT_ERROR)
-					printf(recargstring, current_argv);
-				/*
-				 * XXX: GNU sets optopt to val regardless
-				 * of flag
-				 */
-				if (long_options[match].flag == NULL)
-					optopt = long_options[match].val;
-				else
-					optopt = 0;
-				--optind;
-				return BADARG;
-			}
-		} else {			/* unknown option */
-			if (PRINT_ERROR)
-				printf(illoptstring, current_argv);
-			optopt = 0;
-			return BADCH;
-		}
-		if (long_options[match].flag) {
-			*long_options[match].flag = long_options[match].val;
-			retval = 0;
-		} else
-			retval = long_options[match].val;
-		if (idx)
-			*idx = match;
-	}
-	return retval;
-#undef IDENTICAL_INTERPRETATION
-}
Index: pace/lib/c/generic/ieee_double.c
===================================================================
--- uspace/lib/c/generic/ieee_double.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ieee_double.h>
-
-#include <assert.h>
-
-/** Returns an easily processible description of the double val.
- */
-ieee_double_t extract_ieee_double(double val)
-{
-	const uint64_t significand_mask = 0xfffffffffffffULL;
-	const uint64_t exponent_mask = 0x7ff0000000000000ULL;
-	const int exponent_shift = 64 - 11 - 1;
-	const uint64_t sign_mask = 0x8000000000000000ULL;
-
-	const int special_exponent = 0x7ff;
-	const int denormal_exponent = 0;
-	const uint64_t hidden_bit = (1ULL << 52);
-	const int exponent_bias = 1075;
-
-	static_assert(sizeof(val) == sizeof(uint64_t), "");
-
-	union {
-		uint64_t num;
-		double val;
-	} bits;
-
-	bits.val = val;
-
-	/*
-	 * Extract the binary ieee representation of the double.
-	 * Relies on integers having the same endianness as doubles.
-	 */
-	uint64_t num = bits.num;
-
-	ieee_double_t ret;
-
-	/* Determine the sign. */
-	ret.is_negative = ((num & sign_mask) != 0);
-
-	/* Extract the exponent. */
-	int raw_exponent = (num & exponent_mask) >> exponent_shift;
-
-	/* The extracted raw significand may not contain the hidden bit */
-	uint64_t raw_significand = num & significand_mask;
-
-	ret.is_special = (raw_exponent == special_exponent);
-
-	/* NaN or infinity */
-	if (ret.is_special) {
-		ret.is_infinity = (raw_significand == 0);
-		ret.is_nan = (raw_significand != 0);
-
-		/* These are not valid for special numbers but init them anyway. */
-		ret.is_denormal = true;
-		ret.is_accuracy_step = false;
-		ret.pos_val.significand = 0;
-		ret.pos_val.exponent = 0;
-	} else {
-		ret.is_infinity = false;
-		ret.is_nan = false;
-
-		ret.is_denormal = (raw_exponent == denormal_exponent);
-
-		/* Denormal or zero. */
-		if (ret.is_denormal) {
-			ret.pos_val.significand = raw_significand;
-			ret.pos_val.exponent = 1 - exponent_bias;
-			ret.is_accuracy_step = false;
-		} else {
-			ret.pos_val.significand = raw_significand + hidden_bit;
-			ret.pos_val.exponent = raw_exponent - exponent_bias;
-
-			/*
-			 * The predecessor is closer to val than the successor
-			 * if val is a normal value of the form 2^k (hence
-			 * raw_significand == 0) with the only exception being
-			 * the smallest normal (raw_exponent == 1). The smallest
-			 * normal's predecessor is the largest denormal and denormals
-			 * do not get an extra bit of precision because their exponent
-			 * stays the same (ie it does not decrease from k to k-1).
-			 */
-			ret.is_accuracy_step = (raw_significand == 0) && (raw_exponent != 1);
-		}
-	}
-
-	return ret;
-}
Index: pace/lib/c/generic/imath.c
===================================================================
--- uspace/lib/c/generic/imath.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file Integer mathematical functions
- */
-
-#include <errno.h>
-#include <imath.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-/** Compute integer power of 10, unsigned 64-bit result.
- *
- * Fast algorithm using binary digits of exp to compute 10^exp in
- * time O(log exp).
- *
- * @param exp Exponent
- * @param res Place to store result
- * @return EOK on success, ERANGE if result does not fit into result type
- */
-errno_t ipow10_u64(unsigned exp, uint64_t *res)
-{
-	uint64_t a;
-	uint64_t r;
-
-	r = 1;
-	a = 10;
-	while (true) {
-		if ((exp & 1) != 0) {
-			if ((r * a) / a != r)
-				return ERANGE;
-			r = r * a;
-		}
-
-		exp = exp >> 1;
-		if (exp == 0)
-			break;
-
-		if ((a * a) / a != a)
-			return ERANGE;
-		a = a * a;
-	}
-
-	*res = r;
-	return EOK;
-}
-
-/** Compute integer base 10 logarithm, unsigned 64-bit argument.
- *
- * For integer v, compute floor(log_10 v). Fast algorithm computing
- * the binary digits of the result r in time O(log r).
- *
- * @param v Value to compute logarithm from
- * @return Logarithm value
- */
-unsigned ilog10_u64(uint64_t v)
-{
-	unsigned b;
-	unsigned e;
-	uint64_t p10p2[6];
-	uint64_t a;
-	unsigned r;
-
-	/* Determine largest b such that 10^2^b <= v */
-	b = 0;
-	e = 1;
-	a = 10;
-	p10p2[0] = a;
-
-	while (v / a >= a) {
-		++b;
-		a = a * a;
-		e = e + e;
-		p10p2[b] = a;
-	}
-
-	/* Determine the binary digits of largest e such that 10^e <= v */
-	r = 0;
-	while (true) {
-		if (v >= p10p2[b]) {
-			v = v / p10p2[b];
-			r = r ^ (1 << b);
-		}
-
-		if (b == 0)
-			break;
-		--b;
-	}
-
-	return r;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/inttypes.c
===================================================================
--- uspace/lib/c/generic/inttypes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <inttypes.h>
-
-/** Compute the absolute value of an intmax_t.
- *
- * If the result cannot be represented, the behavior is undefined.
- *
- * @param j Greatest-width integer
- * @return The absolute value of @a j
- */
-intmax_t imaxabs(intmax_t j)
-{
-	intmax_t aj;
-
-	if (j < 0) {
-		aj = -j;
-		assert(aj >= 0);
-	} else {
-		aj = j;
-	}
-
-	return aj;
-}
-
-/** Compute quotient and remainder of greatest-width integer division.
- *
- * @param numer Numerator
- * @param denom Denominator
- * @return Structure containing quotient and remainder
- */
-imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom)
-{
-	imaxdiv_t d;
-
-	d.quot = numer / denom;
-	d.rem = numer % denom;
-
-	return d;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/asprintf.c
===================================================================
--- uspace/lib/c/generic/io/asprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <printf_core.h>
-
-/** Allocate and print to string.
- *
- * @param strp Address of the pointer where to store the address of
- *             the newly allocated string.
- * @fmt        Format string.
- * @args       Variable argument list
- *
- * @return Number of characters printed or an error code.
- *
- */
-int vasprintf(char **strp, const char *fmt, va_list args)
-{
-	va_list args2;
-	va_copy(args2, args);
-	int ret = vsnprintf(NULL, 0, fmt, args2);
-	va_end(args2);
-
-	if (ret >= 0) {
-		*strp = malloc(ret + 1);
-		if (*strp == NULL)
-			return -1;
-
-		vsnprintf(*strp, ret + 1, fmt, args);
-	}
-
-	return ret;
-}
-
-/** Allocate and print to string.
- *
- * @param strp Address of the pointer where to store the address of
- *             the newly allocated string.
- * @fmt        Format string.
- *
- * @return Number of characters printed or an error code.
- *
- */
-int asprintf(char **strp, const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-	int ret = vasprintf(strp, fmt, args);
-	va_end(args);
-	return ret;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/io.c
===================================================================
--- uspace/lib/c/generic/io/io.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1104 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include <str.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <async.h>
-#include <io/kio.h>
-#include <vfs/vfs.h>
-#include <vfs/vfs_sess.h>
-#include <vfs/inbox.h>
-#include <ipc/loc.h>
-#include <adt/list.h>
-#include <wchar.h>
-#include <uchar.h>
-#include "../private/io.h"
-#include "../private/stdio.h"
-
-static void _ffillbuf(FILE *stream);
-static void _fflushbuf(FILE *stream);
-
-static size_t stdio_kio_read(void *, size_t, size_t, FILE *);
-static size_t stdio_kio_write(const void *, size_t, size_t, FILE *);
-static int stdio_kio_flush(FILE *);
-
-static size_t stdio_vfs_read(void *, size_t, size_t, FILE *);
-static size_t stdio_vfs_write(const void *, size_t, size_t, FILE *);
-
-static int stdio_vfs_flush(FILE *);
-
-/** KIO stream ops */
-static __stream_ops_t stdio_kio_ops = {
-	.read = stdio_kio_read,
-	.write = stdio_kio_write,
-	.flush = stdio_kio_flush
-};
-
-/** VFS stream ops */
-static __stream_ops_t stdio_vfs_ops = {
-	.read = stdio_vfs_read,
-	.write = stdio_vfs_write,
-	.flush = stdio_vfs_flush
-};
-
-static FILE stdin_null = {
-	.fd = -1,
-	.pos = 0,
-	.error = true,
-	.eof = true,
-	.ops = &stdio_vfs_ops,
-	.arg = NULL,
-	.sess = NULL,
-	.btype = _IONBF,
-	.buf = NULL,
-	.buf_size = 0,
-	.buf_head = NULL,
-	.buf_tail = NULL,
-	.buf_state = _bs_empty
-};
-
-static FILE stdout_kio = {
-	.fd = -1,
-	.pos = 0,
-	.error = false,
-	.eof = false,
-	.ops = &stdio_kio_ops,
-	.arg = NULL,
-	.sess = NULL,
-	.btype = _IOLBF,
-	.buf = NULL,
-	.buf_size = BUFSIZ,
-	.buf_head = NULL,
-	.buf_tail = NULL,
-	.buf_state = _bs_empty
-};
-
-static FILE stderr_kio = {
-	.fd = -1,
-	.pos = 0,
-	.error = false,
-	.eof = false,
-	.ops = &stdio_kio_ops,
-	.arg = NULL,
-	.sess = NULL,
-	.btype = _IONBF,
-	.buf = NULL,
-	.buf_size = 0,
-	.buf_head = NULL,
-	.buf_tail = NULL,
-	.buf_state = _bs_empty
-};
-
-FILE *stdin = NULL;
-FILE *stdout = NULL;
-FILE *stderr = NULL;
-
-static LIST_INITIALIZE(files);
-
-void __stdio_init(void)
-{
-	/*
-	 * The first three standard file descriptors are assigned for compatibility.
-	 * This will probably be removed later.
-	 */
-	int infd = inbox_get("stdin");
-	if (infd >= 0) {
-		int stdinfd = -1;
-		(void) vfs_clone(infd, -1, false, &stdinfd);
-		assert(stdinfd == 0);
-		vfs_open(stdinfd, MODE_READ);
-		stdin = fdopen(stdinfd, "r");
-	} else {
-		stdin = &stdin_null;
-		list_append(&stdin->link, &files);
-	}
-
-	int outfd = inbox_get("stdout");
-	if (outfd >= 0) {
-		int stdoutfd = -1;
-		(void) vfs_clone(outfd, -1, false, &stdoutfd);
-		assert(stdoutfd <= 1);
-		while (stdoutfd < 1)
-			(void) vfs_clone(outfd, -1, false, &stdoutfd);
-		vfs_open(stdoutfd, MODE_APPEND);
-		stdout = fdopen(stdoutfd, "a");
-	} else {
-		stdout = &stdout_kio;
-		list_append(&stdout->link, &files);
-	}
-
-	int errfd = inbox_get("stderr");
-	if (errfd >= 0) {
-		int stderrfd = -1;
-		(void) vfs_clone(errfd, -1, false, &stderrfd);
-		assert(stderrfd <= 2);
-		while (stderrfd < 2)
-			(void) vfs_clone(errfd, -1, false, &stderrfd);
-		vfs_open(stderrfd, MODE_APPEND);
-		stderr = fdopen(stderrfd, "a");
-	} else {
-		stderr = &stderr_kio;
-		list_append(&stderr->link, &files);
-	}
-}
-
-void __stdio_done(void)
-{
-	while (!list_empty(&files)) {
-		FILE *file = list_get_instance(list_first(&files), FILE, link);
-		fclose(file);
-	}
-}
-
-static bool parse_mode(const char *fmode, int *mode, bool *create, bool *excl,
-    bool *truncate)
-{
-	/* Parse mode except first character. */
-	const char *mp = fmode;
-
-	if (*mp++ == '\0') {
-		errno = EINVAL;
-		return false;
-	}
-
-	if ((*mp == 'b') || (*mp == 't'))
-		mp++;
-
-	bool plus;
-	if (*mp == '+') {
-		mp++;
-		plus = true;
-	} else {
-		plus = false;
-	}
-
-	bool ex;
-	if (*mp == 'x') {
-		mp++;
-		ex = true;
-	} else {
-		ex = false;
-	}
-
-	if (*mp != '\0') {
-		errno = EINVAL;
-		return false;
-	}
-
-	*create = false;
-	*truncate = false;
-	*excl = false;
-
-	/* Parse first character of fmode and determine mode for vfs_open(). */
-	switch (fmode[0]) {
-	case 'r':
-		*mode = plus ? MODE_READ | MODE_WRITE : MODE_READ;
-		if (ex) {
-			errno = EINVAL;
-			return false;
-		}
-		break;
-	case 'w':
-		*mode = plus ? MODE_READ | MODE_WRITE : MODE_WRITE;
-		*create = true;
-		*excl = ex;
-		if (!plus)
-			*truncate = true;
-		break;
-	case 'a':
-		/* TODO: a+ must read from beginning, append to the end. */
-		if (plus) {
-			errno = ENOTSUP;
-			return false;
-		}
-
-		if (ex) {
-			errno = EINVAL;
-			return false;
-		}
-
-		*mode = MODE_APPEND | (plus ? MODE_READ | MODE_WRITE : MODE_WRITE);
-		*create = true;
-		break;
-	default:
-		errno = EINVAL;
-		return false;
-	}
-
-	return true;
-}
-
-/** Set stream buffer. */
-int setvbuf(FILE *stream, void *buf, int mode, size_t size)
-{
-	if (mode != _IONBF && mode != _IOLBF && mode != _IOFBF)
-		return -1;
-
-	stream->btype = mode;
-	stream->buf = buf;
-	stream->buf_size = size;
-	stream->buf_head = stream->buf;
-	stream->buf_tail = stream->buf;
-	stream->buf_state = _bs_empty;
-
-	return 0;
-}
-
-/** Set stream buffer.
- *
- * When @p buf is NULL, the stream is set as unbuffered, otherwise
- * full buffering is enabled.
- */
-void setbuf(FILE *stream, void *buf)
-{
-	if (buf == NULL) {
-		setvbuf(stream, NULL, _IONBF, BUFSIZ);
-	} else {
-		setvbuf(stream, buf, _IOFBF, BUFSIZ);
-	}
-}
-
-static void _setvbuf(FILE *stream)
-{
-	/* FIXME: Use more complex rules for setting buffering options. */
-
-	switch (stream->fd) {
-	case 1:
-		setvbuf(stream, NULL, _IOLBF, BUFSIZ);
-		break;
-	case 0:
-	case 2:
-		setvbuf(stream, NULL, _IONBF, 0);
-		break;
-	default:
-		setvbuf(stream, NULL, _IOFBF, BUFSIZ);
-	}
-}
-
-/** Allocate stream buffer. */
-static int _fallocbuf(FILE *stream)
-{
-	assert(stream->buf == NULL);
-
-	stream->buf = malloc(stream->buf_size);
-	if (stream->buf == NULL) {
-		errno = ENOMEM;
-		return EOF;
-	}
-
-	stream->buf_head = stream->buf;
-	stream->buf_tail = stream->buf;
-	return 0;
-}
-
-/** Open a stream.
- *
- * @param path Path of the file to open.
- * @param mode Mode string, (r|w|a)[b|t][+][x].
- *
- */
-FILE *fopen(const char *path, const char *fmode)
-{
-	int mode;
-	bool create;
-	bool excl;
-	bool truncate;
-
-	if (!parse_mode(fmode, &mode, &create, &excl, &truncate))
-		return NULL;
-
-	/* Open file. */
-	FILE *stream = malloc(sizeof(FILE));
-	if (stream == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	int flags = WALK_REGULAR;
-	if (create && excl)
-		flags |= WALK_MUST_CREATE;
-	else if (create)
-		flags |= WALK_MAY_CREATE;
-	int file;
-	errno_t rc = vfs_lookup(path, flags, &file);
-	if (rc != EOK) {
-		errno = rc;
-		free(stream);
-		return NULL;
-	}
-
-	rc = vfs_open(file, mode);
-	if (rc != EOK) {
-		errno = rc;
-		vfs_put(file);
-		free(stream);
-		return NULL;
-	}
-
-	if (truncate) {
-		rc = vfs_resize(file, 0);
-		if (rc != EOK) {
-			errno = rc;
-			vfs_put(file);
-			free(stream);
-			return NULL;
-		}
-	}
-
-	stream->fd = file;
-	stream->pos = 0;
-	stream->error = false;
-	stream->eof = false;
-	stream->ops = &stdio_vfs_ops;
-	stream->arg = NULL;
-	stream->sess = NULL;
-	stream->need_sync = false;
-	_setvbuf(stream);
-	stream->ungetc_chars = 0;
-
-	list_append(&stream->link, &files);
-
-	return stream;
-}
-
-FILE *fdopen(int fd, const char *mode)
-{
-	/* Open file. */
-	FILE *stream = malloc(sizeof(FILE));
-	if (stream == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	stream->fd = fd;
-	stream->pos = 0;
-	stream->error = false;
-	stream->eof = false;
-	stream->ops = &stdio_vfs_ops;
-	stream->arg = NULL;
-	stream->sess = NULL;
-	stream->need_sync = false;
-	_setvbuf(stream);
-	stream->ungetc_chars = 0;
-
-	list_append(&stream->link, &files);
-
-	return stream;
-}
-
-static int _fclose_nofree(FILE *stream)
-{
-	errno_t rc = 0;
-
-	fflush(stream);
-
-	if (stream->sess != NULL)
-		async_hangup(stream->sess);
-
-	if (stream->fd >= 0)
-		rc = vfs_put(stream->fd);
-
-	list_remove(&stream->link);
-
-	if (rc != EOK) {
-		errno = rc;
-		return EOF;
-	}
-
-	return 0;
-}
-
-int fclose(FILE *stream)
-{
-	int rc = _fclose_nofree(stream);
-
-	if ((stream != &stdin_null) &&
-	    (stream != &stdout_kio) &&
-	    (stream != &stderr_kio))
-		free(stream);
-
-	return rc;
-}
-
-FILE *freopen(const char *path, const char *mode, FILE *stream)
-{
-	FILE *nstr;
-
-	if (path == NULL) {
-		/* Changing mode is not supported */
-		return NULL;
-	}
-
-	(void) _fclose_nofree(stream);
-	nstr = fopen(path, mode);
-	if (nstr == NULL) {
-		free(stream);
-		return NULL;
-	}
-
-	list_remove(&nstr->link);
-	*stream = *nstr;
-	list_append(&stream->link, &files);
-
-	free(nstr);
-
-	return stream;
-}
-
-/** Read from a stream (unbuffered).
- *
- * @param buf    Destination buffer.
- * @param size   Size of each record.
- * @param nmemb  Number of records to read.
- * @param stream Pointer to the stream.
- *
- * @return Number of elements successfully read. On error this is less than
- *         nmemb, stream error indicator is set and errno is set.
- */
-static size_t _fread(void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	return stream->ops->read(buf, size, nmemb, stream);
-}
-
-/** Write to a stream (unbuffered).
- *
- * @param buf    Source buffer.
- * @param size   Size of each record.
- * @param nmemb  Number of records to write.
- * @param stream Pointer to the stream.
- *
- * @return Number of elements successfully written. On error this is less than
- *         nmemb, stream error indicator is set and errno is set.
- */
-static size_t _fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	size_t nwritten;
-
-	if (size == 0 || nmemb == 0)
-		return 0;
-
-	nwritten = stream->ops->write(buf, size, nmemb, stream);
-
-	if (nwritten > 0)
-		stream->need_sync = true;
-
-	return (nwritten / size);
-}
-
-/** Read some data in stream buffer.
- *
- * On error, stream error indicator is set and errno is set.
- */
-static void _ffillbuf(FILE *stream)
-{
-	errno_t rc;
-	size_t nread;
-
-	stream->buf_head = stream->buf_tail = stream->buf;
-
-	rc = vfs_read(stream->fd, &stream->pos, stream->buf, stream->buf_size,
-	    &nread);
-	if (rc != EOK) {
-		errno = rc;
-		stream->error = true;
-		return;
-	}
-
-	if (nread == 0) {
-		stream->eof = true;
-		return;
-	}
-
-	stream->buf_head += nread;
-	stream->buf_state = _bs_read;
-}
-
-/** Write out stream buffer, do not sync stream. */
-static void _fflushbuf(FILE *stream)
-{
-	size_t bytes_used;
-
-	if ((!stream->buf) || (stream->btype == _IONBF) || (stream->error))
-		return;
-
-	bytes_used = stream->buf_head - stream->buf_tail;
-
-	/* If buffer has prefetched read data, we need to seek back. */
-	if (bytes_used > 0 && stream->buf_state == _bs_read)
-		stream->pos -= bytes_used;
-
-	/* If buffer has unwritten data, we need to write them out. */
-	if (bytes_used > 0 && stream->buf_state == _bs_write) {
-		(void) _fwrite(stream->buf_tail, 1, bytes_used, stream);
-		/* On error stream error indicator and errno are set by _fwrite */
-		if (stream->error)
-			return;
-	}
-
-	stream->buf_head = stream->buf;
-	stream->buf_tail = stream->buf;
-	stream->buf_state = _bs_empty;
-}
-
-/** Read from a stream.
- *
- * @param dest   Destination buffer.
- * @param size   Size of each record.
- * @param nmemb  Number of records to read.
- * @param stream Pointer to the stream.
- *
- */
-size_t fread(void *dest, size_t size, size_t nmemb, FILE *stream)
-{
-	uint8_t *dp;
-	size_t bytes_left;
-	size_t now;
-	size_t data_avail;
-	size_t total_read;
-	size_t i;
-
-	if (size == 0 || nmemb == 0)
-		return 0;
-
-	bytes_left = size * nmemb;
-	total_read = 0;
-	dp = (uint8_t *) dest;
-
-	/* Bytes from ungetc() buffer */
-	while (stream->ungetc_chars > 0 && bytes_left > 0) {
-		*dp++ = stream->ungetc_buf[--stream->ungetc_chars];
-		++total_read;
-		--bytes_left;
-	}
-
-	/* If not buffered stream, read in directly. */
-	if (stream->btype == _IONBF) {
-		total_read += _fread(dest, 1, bytes_left, stream);
-		return total_read / size;
-	}
-
-	/* Make sure no data is pending write. */
-	if (stream->buf_state == _bs_write)
-		_fflushbuf(stream);
-
-	/* Perform lazy allocation of stream buffer. */
-	if (stream->buf == NULL) {
-		if (_fallocbuf(stream) != 0)
-			return 0; /* Errno set by _fallocbuf(). */
-	}
-
-	while ((!stream->error) && (!stream->eof) && (bytes_left > 0)) {
-		if (stream->buf_head == stream->buf_tail)
-			_ffillbuf(stream);
-
-		if (stream->error || stream->eof) {
-			/* On error errno was set by _ffillbuf() */
-			break;
-		}
-
-		data_avail = stream->buf_head - stream->buf_tail;
-
-		if (bytes_left > data_avail)
-			now = data_avail;
-		else
-			now = bytes_left;
-
-		for (i = 0; i < now; i++) {
-			dp[i] = stream->buf_tail[i];
-		}
-
-		dp += now;
-		stream->buf_tail += now;
-		bytes_left -= now;
-		total_read += now;
-	}
-
-	return (total_read / size);
-}
-
-/** Write to a stream.
- *
- * @param buf    Source buffer.
- * @param size   Size of each record.
- * @param nmemb  Number of records to write.
- * @param stream Pointer to the stream.
- *
- */
-size_t fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	uint8_t *data;
-	size_t bytes_left;
-	size_t now;
-	size_t buf_free;
-	size_t total_written;
-	size_t i;
-	uint8_t b;
-	bool need_flush;
-
-	if (size == 0 || nmemb == 0)
-		return 0;
-
-	/* If not buffered stream, write out directly. */
-	if (stream->btype == _IONBF) {
-		now = _fwrite(buf, size, nmemb, stream);
-		fflush(stream);
-		return now;
-	}
-
-	/* Make sure buffer contains no prefetched data. */
-	if (stream->buf_state == _bs_read)
-		_fflushbuf(stream);
-
-	/* Perform lazy allocation of stream buffer. */
-	if (stream->buf == NULL) {
-		if (_fallocbuf(stream) != 0)
-			return 0; /* Errno set by _fallocbuf(). */
-	}
-
-	data = (uint8_t *) buf;
-	bytes_left = size * nmemb;
-	total_written = 0;
-	need_flush = false;
-
-	while ((!stream->error) && (bytes_left > 0)) {
-		buf_free = stream->buf_size - (stream->buf_head - stream->buf);
-		if (bytes_left > buf_free)
-			now = buf_free;
-		else
-			now = bytes_left;
-
-		for (i = 0; i < now; i++) {
-			b = data[i];
-			stream->buf_head[i] = b;
-
-			if ((b == '\n') && (stream->btype == _IOLBF))
-				need_flush = true;
-		}
-
-		data += now;
-		stream->buf_head += now;
-		buf_free -= now;
-		bytes_left -= now;
-		total_written += now;
-		stream->buf_state = _bs_write;
-
-		if (buf_free == 0) {
-			/* Only need to drain buffer. */
-			_fflushbuf(stream);
-			if (!stream->error)
-				need_flush = false;
-		}
-	}
-
-	if (need_flush)
-		fflush(stream);
-
-	return (total_written / size);
-}
-
-wint_t fputwc(wchar_t wc, FILE *stream)
-{
-	char buf[STR_BOUNDS(1)];
-	size_t sz = 0;
-
-	if (chr_encode(wc, buf, &sz, STR_BOUNDS(1)) != EOK) {
-		errno = EILSEQ;
-		return WEOF;
-	}
-
-	size_t wr = fwrite(buf, 1, sz, stream);
-	if (wr < sz)
-		return WEOF;
-
-	return wc;
-}
-
-wint_t fputuc(char32_t wc, FILE *stream)
-{
-	char buf[STR_BOUNDS(1)];
-	size_t sz = 0;
-
-	if (chr_encode(wc, buf, &sz, STR_BOUNDS(1)) != EOK) {
-		errno = EILSEQ;
-		return WEOF;
-	}
-
-	size_t wr = fwrite(buf, 1, sz, stream);
-	if (wr < sz)
-		return WEOF;
-
-	return wc;
-}
-
-wint_t putwchar(wchar_t wc)
-{
-	return fputwc(wc, stdout);
-}
-
-wint_t putuchar(char32_t wc)
-{
-	return fputuc(wc, stdout);
-}
-
-int fputc(int c, FILE *stream)
-{
-	unsigned char b;
-	size_t wr;
-
-	b = (unsigned char) c;
-	wr = fwrite(&b, sizeof(b), 1, stream);
-	if (wr < 1)
-		return EOF;
-
-	return b;
-}
-
-int putchar(int c)
-{
-	return fputc(c, stdout);
-}
-
-int fputs(const char *str, FILE *stream)
-{
-	(void) fwrite(str, str_size(str), 1, stream);
-	if (ferror(stream))
-		return EOF;
-	return 0;
-}
-
-int puts(const char *str)
-{
-	if (fputs(str, stdout) < 0)
-		return EOF;
-	return putchar('\n');
-}
-
-int fgetc(FILE *stream)
-{
-	char c;
-
-	/* This could be made faster by only flushing when needed. */
-	if (stdout)
-		fflush(stdout);
-	if (stderr)
-		fflush(stderr);
-
-	if (fread(&c, sizeof(char), 1, stream) < sizeof(char))
-		return EOF;
-
-	return (int) c;
-}
-
-char *fgets(char *str, int size, FILE *stream)
-{
-	int c;
-	int idx;
-
-	idx = 0;
-	while (idx < size - 1) {
-		c = fgetc(stream);
-		if (c == EOF)
-			break;
-
-		str[idx++] = c;
-
-		if (c == '\n')
-			break;
-	}
-
-	if (ferror(stream))
-		return NULL;
-
-	if (idx == 0)
-		return NULL;
-
-	str[idx] = '\0';
-	return str;
-}
-
-int getchar(void)
-{
-	return fgetc(stdin);
-}
-
-int ungetc(int c, FILE *stream)
-{
-	if (c == EOF)
-		return EOF;
-
-	if (stream->ungetc_chars >= UNGETC_MAX)
-		return EOF;
-
-	stream->ungetc_buf[stream->ungetc_chars++] =
-	    (uint8_t)c;
-
-	stream->eof = false;
-	return (uint8_t)c;
-}
-
-int fseek64(FILE *stream, off64_t offset, int whence)
-{
-	errno_t rc;
-
-	if (stream->error)
-		return -1;
-
-	_fflushbuf(stream);
-	if (stream->error) {
-		/* errno was set by _fflushbuf() */
-		return -1;
-	}
-
-	stream->ungetc_chars = 0;
-
-	vfs_stat_t st;
-	switch (whence) {
-	case SEEK_SET:
-		stream->pos = offset;
-		break;
-	case SEEK_CUR:
-		stream->pos += offset;
-		break;
-	case SEEK_END:
-		rc = vfs_stat(stream->fd, &st);
-		if (rc != EOK) {
-			errno = rc;
-			stream->error = true;
-			return -1;
-		}
-		stream->pos = st.size + offset;
-		break;
-	}
-
-	stream->eof = false;
-	return 0;
-}
-
-off64_t ftell64(FILE *stream)
-{
-	if (stream->error)
-		return EOF;
-
-	_fflushbuf(stream);
-	if (stream->error) {
-		/* errno was set by _fflushbuf() */
-		return EOF;
-	}
-
-	return stream->pos - stream->ungetc_chars;
-}
-
-int fseek(FILE *stream, long offset, int whence)
-{
-	return fseek64(stream, offset, whence);
-}
-
-long ftell(FILE *stream)
-{
-	off64_t off = ftell64(stream);
-
-	/* The native position is too large for the C99-ish interface. */
-	if (off > LONG_MAX) {
-		errno = EOVERFLOW;
-		return -1;
-	}
-
-	return off;
-}
-
-void rewind(FILE *stream)
-{
-	(void) fseek(stream, 0, SEEK_SET);
-}
-
-int fflush(FILE *stream)
-{
-	if (stream->error)
-		return EOF;
-
-	_fflushbuf(stream);
-	if (stream->error) {
-		/* errno was set by _fflushbuf() */
-		return EOF;
-	}
-
-	if (stream->need_sync) {
-		/**
-		 * Better than syncing always, but probably still not the
-		 * right thing to do.
-		 */
-		if (stream->ops->flush(stream) == EOF)
-			return EOF;
-
-		stream->need_sync = false;
-	}
-
-	return 0;
-}
-
-int feof(FILE *stream)
-{
-	return stream->eof;
-}
-
-int ferror(FILE *stream)
-{
-	return stream->error;
-}
-
-void clearerr(FILE *stream)
-{
-	stream->eof = false;
-	stream->error = false;
-}
-
-int fileno(FILE *stream)
-{
-	if (stream->ops != &stdio_vfs_ops) {
-		errno = EBADF;
-		return EOF;
-	}
-
-	return stream->fd;
-}
-
-async_sess_t *vfs_fsession(FILE *stream, iface_t iface)
-{
-	if (stream->fd >= 0) {
-		if (stream->sess == NULL)
-			stream->sess = vfs_fd_session(stream->fd, iface);
-
-		return stream->sess;
-	}
-
-	return NULL;
-}
-
-errno_t vfs_fhandle(FILE *stream, int *handle)
-{
-	if (stream->fd >= 0) {
-		*handle = stream->fd;
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-/** Read from KIO stream. */
-static size_t stdio_kio_read(void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	stream->eof = true;
-	return 0;
-}
-
-/** Write to KIO stream. */
-static size_t stdio_kio_write(const void *buf, size_t size, size_t nmemb,
-    FILE *stream)
-{
-	errno_t rc;
-	size_t nwritten;
-
-	rc = kio_write(buf, size * nmemb, &nwritten);
-	if (rc != EOK) {
-		stream->error = true;
-		nwritten = 0;
-	}
-
-	return nwritten / size;
-}
-
-/** Flush KIO stream. */
-static int stdio_kio_flush(FILE *stream)
-{
-	kio_update();
-	return 0;
-}
-
-/** Read from VFS stream. */
-static size_t stdio_vfs_read(void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	errno_t rc;
-	size_t nread;
-
-	if (size == 0 || nmemb == 0)
-		return 0;
-
-	rc = vfs_read(stream->fd, &stream->pos, buf, size * nmemb, &nread);
-	if (rc != EOK) {
-		errno = rc;
-		stream->error = true;
-	} else if (nread == 0) {
-		stream->eof = true;
-	}
-
-	return (nread / size);
-}
-
-/** Write to VFS stream. */
-static size_t stdio_vfs_write(const void *buf, size_t size, size_t nmemb,
-    FILE *stream)
-{
-	errno_t rc;
-	size_t nwritten;
-
-	rc = vfs_write(stream->fd, &stream->pos, buf, size * nmemb, &nwritten);
-	if (rc != EOK) {
-		errno = rc;
-		stream->error = true;
-	}
-
-	return nwritten / size;
-}
-
-/** Flush VFS stream. */
-static int stdio_vfs_flush(FILE *stream)
-{
-	errno_t rc;
-
-	rc = vfs_sync(stream->fd);
-	if (rc != EOK) {
-		errno = rc;
-		return EOF;
-	}
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/kio.c
===================================================================
--- uspace/lib/c/generic/io/kio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <abi/syscall.h>
-#include <stddef.h>
-#include <libc.h>
-#include <str.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <abi/kio.h>
-#include <io/kio.h>
-#include <printf_core.h>
-#include <macros.h>
-#include <libarch/config.h>
-
-#include "../private/futex.h"
-
-#define KIO_BUFFER_SIZE PAGE_SIZE
-
-static struct {
-	futex_t futex;
-	char data[KIO_BUFFER_SIZE];
-	size_t used;
-} kio_buffer;
-
-void __kio_init(void)
-{
-	if (futex_initialize(&kio_buffer.futex, 1) != EOK)
-		abort();
-}
-
-void __kio_fini(void)
-{
-	futex_destroy(&kio_buffer.futex);
-}
-
-errno_t kio_write(const void *buf, size_t size, size_t *nwritten)
-{
-	/* Using down/up instead of lock/unlock so we can print very early. */
-	futex_down(&kio_buffer.futex);
-
-	const char *s = buf;
-	while (true) {
-		const char *endl = memchr(s, '\n', size);
-		if (endl) {
-			size_t used = kio_buffer.used;
-
-			size_t sz = min(KIO_BUFFER_SIZE - used, (size_t) (endl - s));
-			memcpy(&kio_buffer.data[used], s, sz);
-
-			__SYSCALL3(SYS_KIO, KIO_WRITE,
-			    (sysarg_t) &kio_buffer.data[0], used + sz);
-
-			kio_buffer.used = 0;
-			size -= endl + 1 - s;
-			s = endl + 1;
-		} else {
-			size_t used = kio_buffer.used;
-			size_t sz = min(KIO_BUFFER_SIZE - used, size);
-			memcpy(&kio_buffer.data[used], s, sz);
-			kio_buffer.used += sz;
-			break;
-		}
-	}
-
-	futex_up(&kio_buffer.futex);
-	if (nwritten)
-		*nwritten = size;
-	return EOK;
-}
-
-void kio_update(void)
-{
-	(void) __SYSCALL3(SYS_KIO, KIO_UPDATE, (uintptr_t) NULL, 0);
-}
-
-void kio_command(const void *buf, size_t size)
-{
-	(void) __SYSCALL3(SYS_KIO, KIO_COMMAND, (sysarg_t) buf, (sysarg_t) size);
-}
-
-size_t kio_read(char *buf, size_t n, size_t at)
-{
-	return __SYSCALL3(SYS_KIO_READ, (sysarg_t) buf, n, at);
-}
-
-/** Print formatted text to kio.
- *
- * @param fmt Format string
- *
- * \see For more details about format string see printf_core.
- *
- */
-int kio_printf(const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-
-	int ret = kio_vprintf(fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-static errno_t kio_vprintf_str_write(const char *str, size_t size, void *data)
-{
-	size_t wr = 0;
-	return kio_write(str, size, &wr);
-}
-
-/** Print formatted text to kio.
- *
- * @param fmt Format string
- * @param ap  Format parameters
- *
- * \see For more details about format string see printf_core.
- *
- */
-int kio_vprintf(const char *fmt, va_list ap)
-{
-	printf_spec_t ps = {
-		kio_vprintf_str_write,
-		NULL
-	};
-
-	return printf_core(fmt, &ps, ap);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/klog.c
===================================================================
--- uspace/lib/c/generic/io/klog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-#include <str.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <abi/klog.h>
-#include <io/klog.h>
-#include <abi/log.h>
-
-errno_t klog_write(log_level_t lvl, const void *buf, size_t size)
-{
-	return (errno_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
-	    size, lvl);
-}
-
-errno_t klog_read(void *data, size_t size, size_t *nread)
-{
-	return (errno_t) __SYSCALL5(SYS_KLOG, KLOG_READ, (uintptr_t) data,
-	    size, 0, (sysarg_t) nread);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/log.c
===================================================================
--- uspace/lib/c/generic/io/log.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <async.h>
-#include <io/log.h>
-#include <ipc/logger.h>
-#include <str.h>
-#include <ns.h>
-
-/** Id of the first log we create at logger. */
-static sysarg_t default_log_id;
-
-/** Log messages are printed under this name. */
-static const char *log_prog_name;
-
-/** Names of individual log levels. */
-static const char *log_level_names[] = {
-	"fatal",
-	"error",
-	"warn",
-	"note",
-	"debug",
-	"debug2",
-	NULL
-};
-
-/** IPC session with the logger service. */
-static async_sess_t *logger_session;
-
-/** Maximum length of a single log message (in bytes). */
-#define MESSAGE_BUFFER_SIZE 4096
-
-/** Send formatted message to the logger service.
- *
- * @param session Initialized IPC session with the logger.
- * @param log Log to use.
- * @param level Verbosity level of the message.
- * @param message The actual message.
- * @return Error code of the conversion or EOK on success.
- */
-static errno_t logger_message(async_sess_t *session, log_t log, log_level_t level, char *message)
-{
-	async_exch_t *exchange = async_exchange_begin(session);
-	if (exchange == NULL) {
-		return ENOMEM;
-	}
-	if (log == LOG_DEFAULT)
-		log = default_log_id;
-
-	// FIXME: remove when all USB drivers use libc logging explicitly
-	str_rtrim(message, '\n');
-
-	aid_t reg_msg = async_send_2(exchange, LOGGER_WRITER_MESSAGE,
-	    log, level, NULL);
-	errno_t rc = async_data_write_start(exchange, message, str_size(message));
-	errno_t reg_msg_rc;
-	async_wait_for(reg_msg, &reg_msg_rc);
-
-	async_exchange_end(exchange);
-
-	/*
-	 * Getting ENAK means no-one wants our message. That is not an
-	 * error at all.
-	 */
-	if (rc == ENAK)
-		rc = EOK;
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return reg_msg_rc;
-}
-
-/** Get name of the log level.
- *
- * @param level The log level.
- * @return String name or "unknown".
- */
-const char *log_level_str(log_level_t level)
-{
-	if (level >= LVL_LIMIT)
-		return "unknown";
-	else
-		return log_level_names[level];
-}
-
-/** Convert log level name to the enum.
- *
- * @param[in] name Log level name or log level number.
- * @param[out] level_out Where to store the result (set to NULL to ignore).
- * @return Error code of the conversion or EOK on success.
- */
-errno_t log_level_from_str(const char *name, log_level_t *level_out)
-{
-	log_level_t level = LVL_FATAL;
-
-	while (log_level_names[level] != NULL) {
-		if (str_cmp(name, log_level_names[level]) == 0) {
-			if (level_out != NULL)
-				*level_out = level;
-			return EOK;
-		}
-		level++;
-	}
-
-	/* Maybe user specified number directly. */
-	char *end_ptr;
-	int level_int = strtol(name, &end_ptr, 0);
-	if ((end_ptr == name) || (str_length(end_ptr) != 0))
-		return EINVAL;
-	if (level_int < 0)
-		return ERANGE;
-	if (level_int >= (int) LVL_LIMIT)
-		return ERANGE;
-
-	if (level_out != NULL)
-		*level_out = (log_level_t) level_int;
-
-	return EOK;
-}
-
-/** Initialize the logging system.
- *
- * @param prog_name Program name, will be printed as part of message
- */
-errno_t log_init(const char *prog_name)
-{
-	log_prog_name = str_dup(prog_name);
-	if (log_prog_name == NULL)
-		return ENOMEM;
-
-	errno_t rc;
-	logger_session = service_connect_blocking(SERVICE_LOGGER,
-	    INTERFACE_LOGGER_WRITER, 0, &rc);
-	if (logger_session == NULL)
-		return rc;
-
-	default_log_id = log_create(prog_name, LOG_NO_PARENT);
-
-	return EOK;
-}
-
-/** Create a new (sub-) log.
- *
- * This function always returns a valid log_t. In case of errors,
- * @c parent is returned and errors are silently ignored.
- *
- * @param name Log name under which message will be reported (appended to parents name).
- * @param parent Parent log.
- * @return Opaque identifier of the newly created log.
- */
-log_t log_create(const char *name, log_t parent)
-{
-	async_exch_t *exchange = async_exchange_begin(logger_session);
-	if (exchange == NULL)
-		return parent;
-
-	if (parent == LOG_DEFAULT)
-		parent = default_log_id;
-
-	ipc_call_t answer;
-	aid_t reg_msg = async_send_1(exchange, LOGGER_WRITER_CREATE_LOG,
-	    parent, &answer);
-	errno_t rc = async_data_write_start(exchange, name, str_size(name));
-	errno_t reg_msg_rc;
-	async_wait_for(reg_msg, &reg_msg_rc);
-
-	async_exchange_end(exchange);
-
-	if ((rc != EOK) || (reg_msg_rc != EOK))
-		return parent;
-
-	return ipc_get_arg1(&answer);
-}
-
-/** Write an entry to the log.
- *
- * The message is printed only if the verbosity level is less than or
- * equal to currently set reporting level of the log.
- *
- * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means).
- * @param level Severity level of the message.
- * @param fmt Format string in printf-like format (without trailing newline).
- */
-void log_msg(log_t ctx, log_level_t level, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	log_msgv(ctx, level, fmt, args);
-	va_end(args);
-}
-
-/** Write an entry to the log (va_list variant).
- *
- * @param ctx Log to use (use LOG_DEFAULT if you have no idea what it means).
- * @param level Severity level of the message.
- * @param fmt Format string in printf-like format (without trailing newline).
- * @param args Arguments.
- */
-void log_msgv(log_t ctx, log_level_t level, const char *fmt, va_list args)
-{
-	assert(level < LVL_LIMIT);
-
-	char *message_buffer = malloc(MESSAGE_BUFFER_SIZE);
-	if (message_buffer == NULL)
-		return;
-
-	vsnprintf(message_buffer, MESSAGE_BUFFER_SIZE, fmt, args);
-	logger_message(logger_session, ctx, level, message_buffer);
-	free(message_buffer);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/logctl.c
===================================================================
--- uspace/lib/c/generic/io/logctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <io/logctl.h>
-#include <ipc/logger.h>
-#include <sysinfo.h>
-#include <ns.h>
-#include <str.h>
-#include <vfs/vfs.h>
-
-/** IPC session with the logger service. */
-static async_sess_t *logger_session = NULL;
-
-static errno_t start_logger_exchange(async_exch_t **exchange_out)
-{
-	assert(exchange_out != NULL);
-
-	if (logger_session == NULL) {
-		errno_t rc;
-		logger_session = service_connect_blocking(SERVICE_LOGGER,
-		    INTERFACE_LOGGER_CONTROL, 0, &rc);
-		if (logger_session == NULL)
-			return rc;
-	}
-
-	assert(logger_session != NULL);
-
-	async_exch_t *exchange = async_exchange_begin(logger_session);
-	if (exchange == NULL)
-		return ENOMEM;
-
-	*exchange_out = exchange;
-
-	return EOK;
-}
-
-/** Set default reported log level (global setting).
- *
- * This setting affects all logger clients whose reporting level was
- * not yet changed.
- *
- * If logging level of client A is changed with logctl_set_log_level()
- * to some level, this call will have no effect at that client's reporting
- * level. Even if the actual value of the reporting level of client A is
- * the same as current (previous) default log level.
- *
- * @param new_level New reported logging level.
- * @return Error code of the conversion or EOK on success.
- */
-errno_t logctl_set_default_level(log_level_t new_level)
-{
-	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
-	if (rc != EOK)
-		return rc;
-
-	rc = (errno_t) async_req_1_0(exchange,
-	    LOGGER_CONTROL_SET_DEFAULT_LEVEL, new_level);
-
-	async_exchange_end(exchange);
-
-	return rc;
-}
-
-/** Set reported log level of a single log.
- *
- * @see logctl_set_default_level
- *
- * @param logname Log name.
- * @param new_level New reported logging level.
- * @return Error code of the conversion or EOK on success.
- */
-errno_t logctl_set_log_level(const char *logname, log_level_t new_level)
-{
-	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
-	if (rc != EOK)
-		return rc;
-
-	aid_t reg_msg = async_send_1(exchange, LOGGER_CONTROL_SET_LOG_LEVEL,
-	    new_level, NULL);
-	rc = async_data_write_start(exchange, logname, str_size(logname));
-	errno_t reg_msg_rc;
-	async_wait_for(reg_msg, &reg_msg_rc);
-
-	async_exchange_end(exchange);
-
-	if (rc != EOK)
-		return rc;
-
-	return (errno_t) reg_msg_rc;
-}
-
-/** Set logger's VFS root.
- *
- * @return Error code or EOK on success.
- */
-errno_t logctl_set_root(void)
-{
-	async_exch_t *exchange = NULL;
-	errno_t rc = start_logger_exchange(&exchange);
-	if (rc != EOK)
-		return rc;
-
-	aid_t reg_msg = async_send_0(exchange, LOGGER_CONTROL_SET_ROOT, NULL);
-	async_exch_t *vfs_exch = vfs_exchange_begin();
-	rc = vfs_pass_handle(vfs_exch, vfs_root(), exchange);
-	vfs_exchange_end(vfs_exch);
-	errno_t reg_msg_rc;
-	async_wait_for(reg_msg, &reg_msg_rc);
-
-	async_exchange_end(exchange);
-
-	if (rc != EOK)
-		return rc;
-
-	return (errno_t) reg_msg_rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/printf.c
===================================================================
--- uspace/lib/c/generic/io/printf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <printf_core.h>
-#include <stdio.h>
-
-/** Print formatted text.
- *
- * @param stream Output stream
- * @param fmt    Format string
- *
- * \see For more details about format string see printf_core.
- *
- */
-int fprintf(FILE *stream, const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-
-	int ret = vfprintf(stream, fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-/** Print formatted text to stdout.
- *
- * @param fmt Format string
- *
- * \see For more details about format string see printf_core.
- *
- */
-int printf(const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-
-	int ret = vprintf(fmt, args);
-
-	va_end(args);
-
-	return ret;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/table.c
===================================================================
--- uspace/lib/c/generic/io/table.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,567 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Tabulate text
- */
-
-#include <errno.h>
-#include <io/table.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-static table_column_t *table_column_first(table_t *);
-static table_column_t *table_column_next(table_column_t *);
-
-/** Add a new row at the end of the table.
- *
- * @param table Table
- * @param rrow Place to store pointer to new row or @c NULL
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_add_row(table_t *table, table_row_t **rrow)
-{
-	table_row_t *row;
-
-	row = calloc(1, sizeof(table_row_t));
-	if (row == NULL)
-		return ENOMEM;
-
-	row->table = table;
-	list_initialize(&row->cells);
-	list_append(&row->ltable, &table->rows);
-
-	if (rrow != NULL)
-		*rrow = row;
-	return EOK;
-}
-
-/** Add a new cell at the end of the row.
- *
- * @param row Row
- * @param rcell Place to store pointer to new cell or @c NULL
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_row_add_cell(table_row_t *row, table_cell_t **rcell)
-{
-	table_cell_t *cell;
-
-	cell = calloc(1, sizeof(table_cell_t));
-	if (cell == NULL)
-		return ENOMEM;
-
-	cell->text = NULL;
-
-	cell->row = row;
-	list_append(&cell->lrow, &row->cells);
-
-	if (rcell != NULL)
-		*rcell = cell;
-	return EOK;
-}
-
-/** Add a new column at the right side of the table.
- *
- * @param table Table
- * @param rcolumn Place to store pointer to new column or @c NULL
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_add_column(table_t *table, table_column_t **rcolumn)
-{
-	table_column_t *column;
-
-	column = calloc(1, sizeof(table_column_t));
-	if (column == NULL)
-		return ENOMEM;
-
-	column->table = table;
-	column->width = 0;
-	list_append(&column->ltable, &table->columns);
-
-	if (rcolumn != NULL)
-		*rcolumn = column;
-	return EOK;
-}
-
-/** Start writing next table cell.
- *
- * @param table Table
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_write_next_cell(table_t *table)
-{
-	errno_t rc;
-
-	rc = table_row_add_cell(table->wrow, &table->wcell);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		return rc;
-	}
-
-	if (list_count(&table->wrow->cells) == 1) {
-		/* First column */
-		table->wcolumn = table_column_first(table);
-	} else {
-		/* Next column */
-		table->wcolumn = table_column_next(table->wcolumn);
-	}
-
-	if (table->wcolumn == NULL) {
-		rc = table_add_column(table, &table->wcolumn);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-/** Start writing next table row.
- *
- * @param table Table
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_write_next_row(table_t *table)
-{
-	errno_t rc;
-
-	rc = table_add_row(table, &table->wrow);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		return rc;
-	}
-
-	table->wcell = NULL;
-	return EOK;
-}
-
-/** Get first table row.
- *
- * @param table Table
- * @return First table row or @c NULL if none
- */
-static table_row_t *table_row_first(table_t *table)
-{
-	link_t *link;
-
-	link = list_first(&table->rows);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_row_t, ltable);
-}
-
-/** Get next table row.
- *
- * @param cur Current row
- * @return Next table row or @c NULL if none
- */
-static table_row_t *table_row_next(table_row_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->ltable, &cur->table->rows);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_row_t, ltable);
-}
-
-/** Get first cell in table row.
- *
- * @param row Table row
- * @return First cell in row or @c NULL if none
- */
-static table_cell_t *table_row_cell_first(table_row_t *row)
-{
-	link_t *link;
-
-	link = list_first(&row->cells);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_cell_t, lrow);
-}
-
-/** Get next cell in table row.
- *
- * @param cur Current cell
- * @return Next cell in table row or @c NULL if none
- */
-static table_cell_t *table_row_cell_next(table_cell_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lrow, &cur->row->cells);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_cell_t, lrow);
-}
-
-/** Get first table column.
- *
- * @param table Table
- * @return First table column or @c NULL if none
- */
-static table_column_t *table_column_first(table_t *table)
-{
-	link_t *link;
-
-	link = list_first(&table->columns);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_column_t, ltable);
-}
-
-/** Get next table column.
- *
- * @param cur Current column
- * @return Next table column or @c NULL if none
- */
-static table_column_t *table_column_next(table_column_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->ltable, &cur->table->columns);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, table_column_t, ltable);
-}
-
-/** Append to cell text.
- *
- * @param cell Cell
- * @param str Text to append
- * @param len Max number of bytes to read from str
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t table_cell_extend(table_cell_t *cell, const char *str, size_t len)
-{
-	char *cstr;
-	int rc;
-
-	if (cell->text == NULL) {
-		cell->text = str_ndup(str, len);
-		if (cell->text == NULL)
-			return ENOMEM;
-	} else {
-		rc = asprintf(&cstr, "%s%.*s", cell->text, (int)len, str);
-		if (rc < 0)
-			return ENOMEM;
-
-		free(cell->text);
-		cell->text = cstr;
-	}
-
-	return EOK;
-}
-
-/** Create table.
- *
- * @para, rtable Place to store pointer to new table.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t table_create(table_t **rtable)
-{
-	table_t *table;
-	errno_t rc;
-
-	table = calloc(1, sizeof(table_t));
-	if (table == NULL)
-		return ENOMEM;
-
-	table->error = EOK;
-	list_initialize(&table->rows);
-	list_initialize(&table->columns);
-
-	rc = table_add_row(table, &table->wrow);
-	if (rc != EOK)
-		goto error;
-
-	rc = table_row_add_cell(table->wrow, &table->wcell);
-	if (rc != EOK)
-		goto error;
-
-	rc = table_add_column(table, &table->wcolumn);
-	if (rc != EOK)
-		goto error;
-
-	*rtable = table;
-	return EOK;
-error:
-	table_destroy(table);
-	return rc;
-}
-
-/** Destroy table.
- *
- * @param table Table
- */
-void table_destroy(table_t *table)
-{
-	table_row_t *row;
-	table_cell_t *cell;
-	table_column_t *column;
-
-	if (table == NULL)
-		return;
-
-	row = table_row_first(table);
-	while (row != NULL) {
-		cell = table_row_cell_first(row);
-		while (cell != NULL) {
-			list_remove(&cell->lrow);
-			free(cell->text);
-			free(cell);
-			cell = table_row_cell_first(row);
-		}
-
-		list_remove(&row->ltable);
-		free(row);
-
-		row = table_row_first(table);
-	}
-
-	column = table_column_first(table);
-	while (column != NULL) {
-		list_remove(&column->ltable);
-		free(column);
-
-		column = table_column_first(table);
-	}
-
-	free(table);
-}
-
-/** Print out table contents to a file stream.
- *
- * @param table Table
- * @param f File where to write the output
- *
- * @return EOK on success, EIO on I/O error
- */
-errno_t table_print_out(table_t *table, FILE *f)
-{
-	table_row_t *row;
-	table_cell_t *cell;
-	table_column_t *column;
-	bool firstc;
-	bool firstr;
-	size_t spacing;
-	size_t i;
-	int rc;
-
-	if (table->error != EOK)
-		return table->error;
-
-	row = table_row_first(table);
-	firstr = true;
-	while (row != NULL) {
-		cell = table_row_cell_first(row);
-		if (cell == NULL)
-			break;
-
-		column = table_column_first(table);
-		firstc = true;
-
-		while (cell != NULL && cell->text != NULL) {
-			spacing = firstc ? table->metrics.margin_left : 1;
-			for (i = 0; i < spacing; i++) {
-				rc = fprintf(f, " ");
-				if (rc < 0)
-					return EIO;
-			}
-
-			rc = fprintf(f, "%*s", -(int)column->width, cell->text);
-			if (rc < 0)
-				return EIO;
-
-			cell = table_row_cell_next(cell);
-			column = table_column_next(column);
-			firstc = false;
-		}
-		rc = fprintf(f, "\n");
-		if (rc < 0)
-			return EIO;
-
-		if (firstr && table->header_row) {
-			/* Display header separator */
-			column = table_column_first(table);
-			firstc = true;
-			while (column != NULL) {
-				spacing = firstc ? table->metrics.margin_left : 1;
-				for (i = 0; i < spacing; i++) {
-					rc = fprintf(f, " ");
-					if (rc < 0)
-						return EIO;
-				}
-
-				for (i = 0; i < column->width; i++) {
-					rc = fprintf(f, "=");
-					if (rc < 0)
-						return EIO;
-				}
-
-				column = table_column_next(column);
-				firstc = false;
-			}
-
-			rc = fprintf(f, "\n");
-			if (rc < 0)
-				return EIO;
-		}
-
-		row = table_row_next(row);
-		firstr = false;
-	}
-	return EOK;
-}
-
-/** Start a header row.
- *
- * @param table Table
- */
-void table_header_row(table_t *table)
-{
-	assert(list_count(&table->rows) == 1);
-	assert(!table->header_row);
-	table->header_row = true;
-}
-
-/** Insert text into table cell(s).
- *
- * Appends text to the current cell. A tab character starts a new cell.
- * A newline character starts a new row.
- *
- * @param table Table
- * @param fmt Format string
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t table_printf(table_t *table, const char *fmt, ...)
-{
-	va_list args;
-	errno_t rc;
-	int ret;
-	char *str;
-	char *sp, *ep;
-	size_t width;
-
-	if (table->error != EOK)
-		return table->error;
-
-	va_start(args, fmt);
-	ret = vasprintf(&str, fmt, args);
-	va_end(args);
-
-	if (ret < 0) {
-		table->error = ENOMEM;
-		return table->error;
-	}
-
-	sp = str;
-	while (*sp != '\0' && table->error == EOK) {
-		ep = sp;
-		while (*ep != '\0' && *ep != '\t' && *ep != '\n')
-			++ep;
-
-		if (table->wcell == NULL) {
-			rc = table_write_next_cell(table);
-			if (rc != EOK) {
-				assert(rc == ENOMEM);
-				goto out;
-			}
-		}
-
-		rc = table_cell_extend(table->wcell, sp, ep - sp);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			table->error = ENOMEM;
-			goto out;
-		}
-
-		/* Update column width */
-		width = str_width(table->wcell->text);
-		if (width > table->wcolumn->width)
-			table->wcolumn->width = width;
-
-		if (*ep == '\t')
-			rc = table_write_next_cell(table);
-		else if (*ep == '\n')
-			rc = table_write_next_row(table);
-		else
-			break;
-
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			table->error = ENOMEM;
-			goto out;
-		}
-
-		sp = ep + 1;
-	}
-
-	rc = table->error;
-out:
-	free(str);
-	return rc;
-}
-
-/** Return table error code.
- *
- * @param table Table
- * @return EOK if no error indicated, non-zero error code otherwise
- */
-errno_t table_get_error(table_t *table)
-{
-	return table->error;
-}
-
-/** Set left table margin.
- *
- * @param table Table
- * @param mleft Left margin
- */
-void table_set_margin_left(table_t *table, size_t mleft)
-{
-	table->metrics.margin_left = mleft;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/io/vprintf.c
===================================================================
--- uspace/lib/c/generic/io/vprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <printf_core.h>
-#include <fibril_synch.h>
-#include <async.h>
-#include <str.h>
-
-static FIBRIL_MUTEX_INITIALIZE(printf_mutex);
-
-static errno_t vprintf_str_write(const char *str, size_t size, void *stream)
-{
-	errno_t old_errno = errno;
-
-	errno = EOK;
-	size_t written = fwrite(str, 1, size, (FILE *) stream);
-
-	if (errno == EOK && written != size)
-		errno = EIO;
-
-	if (errno != EOK)
-		return errno;
-
-	errno = old_errno;
-	return EOK;
-}
-
-/** Print formatted text.
- *
- * @param stream Output stream
- * @param fmt    Format string
- * @param ap     Format parameters
- *
- * \see For more details about format string see printf_core.
- *
- */
-int vfprintf(FILE *stream, const char *fmt, va_list ap)
-{
-	printf_spec_t ps = {
-		vprintf_str_write,
-		stream
-	};
-
-	/*
-	 * Prevent other threads to execute printf_core()
-	 */
-	fibril_mutex_lock(&printf_mutex);
-
-	int ret = printf_core(fmt, &ps, ap);
-
-	fibril_mutex_unlock(&printf_mutex);
-
-	return ret;
-}
-
-/** Print formatted text to stdout.
- *
- * @param fmt Format string
- * @param ap  Format parameters
- *
- * \see For more details about format string see printf_core.
- *
- */
-int vprintf(const char *fmt, va_list ap)
-{
-	return vfprintf(stdout, fmt, ap);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/ipc.c
===================================================================
--- uspace/lib/c/generic/ipc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,243 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- * @}
- */
-
-/** @addtogroup libcipc IPC
- * @brief HelenOS uspace IPC
- * @{
- * @ingroup libc
- */
-/** @file
- */
-
-#include <ipc/ipc.h>
-#include <libc.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <fibril.h>
-#include <macros.h>
-
-/** Fast asynchronous call.
- *
- * This function can only handle three arguments of payload. It is, however,
- * faster than the more generic ipc_call_async_slow().
- *
- * Note that this function is a void function.
- *
- * During normal operation, answering this call will trigger the callback.
- * In case of fatal error, the callback handler is called with the proper
- * error code. If the call cannot be temporarily made, it is queued.
- *
- * @param phandle   Phone handle for the call.
- * @param imethod   Requested interface and method.
- * @param arg1      Service-defined payload argument.
- * @param arg2      Service-defined payload argument.
- * @param arg3      Service-defined payload argument.
- * @param label     A value to set to the label field of the answer.
- */
-errno_t ipc_call_async_fast(cap_phone_handle_t phandle, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, void *label)
-{
-	return __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST,
-	    cap_handle_raw(phandle), imethod, arg1, arg2, arg3,
-	    (sysarg_t) label);
-}
-
-/** Asynchronous call transmitting the entire payload.
- *
- * Note that this function is a void function.
- *
- * During normal operation, answering this call will trigger the callback.
- * In case of fatal error, the callback handler is called with the proper
- * error code. If the call cannot be temporarily made, it is queued.
- *
- * @param phandle   Phone handle for the call.
- * @param imethod   Requested interface and method.
- * @param arg1      Service-defined payload argument.
- * @param arg2      Service-defined payload argument.
- * @param arg3      Service-defined payload argument.
- * @param arg4      Service-defined payload argument.
- * @param arg5      Service-defined payload argument.
- * @param label     A value to set to the label field of the answer.
- */
-errno_t ipc_call_async_slow(cap_phone_handle_t phandle, sysarg_t imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
-    void *label)
-{
-	ipc_call_t data;
-
-	ipc_set_imethod(&data, imethod);
-	ipc_set_arg1(&data, arg1);
-	ipc_set_arg2(&data, arg2);
-	ipc_set_arg3(&data, arg3);
-	ipc_set_arg4(&data, arg4);
-	ipc_set_arg5(&data, arg5);
-
-	return __SYSCALL3(SYS_IPC_CALL_ASYNC_SLOW,
-	    cap_handle_raw(phandle), (sysarg_t) &data,
-	    (sysarg_t) label);
-}
-
-/** Answer received call (fast version).
- *
- * The fast answer makes use of passing retval and first four arguments in
- * registers. If you need to return more, use the ipc_answer_slow() instead.
- *
- * @param chandle  Handle of the call being answered.
- * @param retval   Return value.
- * @param arg1     First return argument.
- * @param arg2     Second return argument.
- * @param arg3     Third return argument.
- * @param arg4     Fourth return argument.
- *
- * @return Zero on success.
- * @return Value from @ref errno.h on failure.
- *
- */
-errno_t ipc_answer_fast(cap_call_handle_t chandle, errno_t retval,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
-{
-	return (errno_t) __SYSCALL6(SYS_IPC_ANSWER_FAST,
-	    cap_handle_raw(chandle), (sysarg_t) retval, arg1, arg2, arg3, arg4);
-}
-
-/** Answer received call (entire payload).
- *
- * @param chandle  Handle of the call being answered.
- * @param retval   Return value.
- * @param arg1     First return argument.
- * @param arg2     Second return argument.
- * @param arg3     Third return argument.
- * @param arg4     Fourth return argument.
- * @param arg5     Fifth return argument.
- *
- * @return Zero on success.
- * @return Value from @ref errno.h on failure.
- *
- */
-errno_t ipc_answer_slow(cap_call_handle_t chandle, errno_t retval,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
-{
-	ipc_call_t data;
-
-	ipc_set_retval(&data, retval);
-	ipc_set_arg1(&data, arg1);
-	ipc_set_arg2(&data, arg2);
-	ipc_set_arg3(&data, arg3);
-	ipc_set_arg4(&data, arg4);
-	ipc_set_arg5(&data, arg5);
-
-	return (errno_t) __SYSCALL2(SYS_IPC_ANSWER_SLOW,
-	    cap_handle_raw(chandle), (sysarg_t) &data);
-}
-
-/** Interrupt one thread of this task from waiting for IPC.
- *
- */
-void ipc_poke(void)
-{
-	__SYSCALL0(SYS_IPC_POKE);
-}
-
-errno_t ipc_wait(ipc_call_t *call, sysarg_t usec, unsigned int flags)
-{
-	// TODO: Use expiration time instead of timeout.
-	return __SYSCALL3(SYS_IPC_WAIT, (sysarg_t) call, usec, flags);
-}
-
-/** Hang up a phone.
- *
- * @param phandle  Handle of the phone to be hung up.
- *
- * @return  Zero on success or an error code.
- *
- */
-errno_t ipc_hangup(cap_phone_handle_t phandle)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_HANGUP, cap_handle_raw(phandle));
-}
-
-/** Forward a received call to another destination.
- *
- * For non-system methods, the old method, arg1 and arg2 are rewritten by the
- * new values. For system methods, the new method, arg1 and arg2 are written to
- * the old arg1, arg2 and arg3, respectivelly. Calls with immutable methods are
- * forwarded verbatim.
- *
- * @param chandle  Handle of the call to forward.
- * @param phandle  Phone handle to use for forwarding.
- * @param imethod  New interface and method for the forwarded call.
- * @param arg1     New value of the first argument for the forwarded call.
- * @param arg2     New value of the second argument for the forwarded call.
- * @param mode     Flags specifying mode of the forward operation.
- *
- * @return  Zero on success or an error code.
- *
- */
-errno_t ipc_forward_fast(cap_call_handle_t chandle, cap_phone_handle_t phandle,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
-{
-	return (errno_t) __SYSCALL6(SYS_IPC_FORWARD_FAST,
-	    cap_handle_raw(chandle), cap_handle_raw(phandle), imethod, arg1,
-	    arg2, mode);
-}
-
-errno_t ipc_forward_slow(cap_call_handle_t chandle, cap_phone_handle_t phandle,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
-    sysarg_t arg4, sysarg_t arg5, unsigned int mode)
-{
-	ipc_call_t data;
-
-	ipc_set_imethod(&data, imethod);
-	ipc_set_arg1(&data, arg1);
-	ipc_set_arg2(&data, arg2);
-	ipc_set_arg3(&data, arg3);
-	ipc_set_arg4(&data, arg4);
-	ipc_set_arg5(&data, arg5);
-
-	return (errno_t) __SYSCALL4(SYS_IPC_FORWARD_SLOW,
-	    cap_handle_raw(chandle), cap_handle_raw(phandle), (sysarg_t) &data,
-	    mode);
-}
-
-/** Connect to a task specified by id.
- *
- */
-errno_t ipc_connect_kbox(task_id_t id, cap_phone_handle_t *phone)
-{
-	return (errno_t) __SYSCALL2(SYS_IPC_CONNECT_KBOX, (sysarg_t) &id, (sysarg_t) phone);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/irq.c
===================================================================
--- uspace/lib/c/generic/irq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <ipc/irq.h>
-#include <libc.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <macros.h>
-
-static irq_cmd_t default_cmds[] = {
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static const irq_code_t default_ucode = {
-	0,
-	NULL,
-	ARRAY_SIZE(default_cmds),
-	default_cmds
-};
-
-/** Subscribe to IRQ notification.
- *
- * @param inr    IRQ number.
- * @param method Use this method for notifying me.
- * @param ucode  Top-half pseudocode handler.
- *
- * @param[out] out_handle  IRQ capability handle returned by the kernel.
- *
- * @return Error code returned by the kernel.
- *
- */
-errno_t ipc_irq_subscribe(int inr, sysarg_t method, const irq_code_t *ucode,
-    cap_irq_handle_t *out_handle)
-{
-	if (ucode == NULL)
-		ucode = &default_ucode;
-
-	return (errno_t) __SYSCALL4(SYS_IPC_IRQ_SUBSCRIBE, inr, method,
-	    (sysarg_t) ucode, (sysarg_t) out_handle);
-}
-
-/** Unsubscribe from IRQ notification.
- *
- * @param cap   IRQ capability handle.
- *
- * @return Value returned by the kernel.
- *
- */
-errno_t ipc_irq_unsubscribe(cap_irq_handle_t cap)
-{
-	return (errno_t) __SYSCALL1(SYS_IPC_IRQ_UNSUBSCRIBE,
-	    cap_handle_raw(cap));
-}
-
-/** @}
- */
Index: pace/lib/c/generic/l18n/langs.c
===================================================================
--- uspace/lib/c/generic/l18n/langs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * Language and locale ids.
- */
-
-#include <l18n/langs.h>
-#include <stdio.h>
-#include <fibril.h>
-
-#define UNKNOWN_LOCALE_LEN 64
-
-static fibril_local char unknown_locale[UNKNOWN_LOCALE_LEN];
-
-/** Get string representation of a given locale.
- *
- * @param locale The locale.
- * @return Name of the locale.
- */
-const char *str_l18_win_locale(l18_win_locales_t locale)
-{
-	/*
-	 * Static array with names might be better but it would be
-	 * way too big.
-	 */
-	switch (locale) {
-	case L18N_WIN_LOCALE_AFRIKAANS:
-		return "Afrikaans";
-	case L18N_WIN_LOCALE_CZECH:
-		return "Czech";
-	case L18N_WIN_LOCALE_ENGLISH_UNITED_STATES:
-		return "English (US)";
-	case L18N_WIN_LOCALE_SLOVAK:
-		return "Slovak";
-	case L18N_WIN_LOCALE_SPANISH_TRADITIONAL:
-		return "Spanish (traditional)";
-	case L18N_WIN_LOCALE_ZULU:
-		return "Zulu";
-	default:
-		break;
-	}
-
-	snprintf(unknown_locale, UNKNOWN_LOCALE_LEN, "Unknown locale 0x%04d",
-	    (int) locale);
-	return unknown_locale;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/libc.c
===================================================================
--- uspace/lib/c/generic/libc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/** @file
- */
-
-#include <errno.h>
-#include <libc.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <tls.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <task.h>
-#include <loader/pcb.h>
-#include <vfs/vfs.h>
-#include <vfs/inbox.h>
-#include <io/kio.h>
-#include "private/libc.h"
-#include "private/async.h"
-#include "private/malloc.h"
-#include "private/io.h"
-#include "private/fibril.h"
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-progsymbols_t __progsymbols;
-
-static bool env_setup;
-static fibril_t main_fibril;
-
-void __libc_main(void *pcb_ptr)
-{
-	__kio_init();
-
-	assert(!__tcb_is_set());
-
-	__pcb = (pcb_t *) pcb_ptr;
-
-	if (__pcb) {
-		main_fibril.tcb = __pcb->tcb;
-	} else {
-		/*
-		 * Loaded by kernel, not the loader.
-		 * Kernel only supports loading fully static binaries,
-		 * so we can do basic initialization without worrying about
-		 * dynamic libraries.
-		 */
-
-		main_fibril.tcb = tls_make_initial(__progsymbols.elfstart);
-	}
-
-	assert(main_fibril.tcb);
-
-	__fibrils_init();
-	__fibril_synch_init();
-
-	/* Initialize the fibril. */
-	main_fibril.tcb->fibril_data = &main_fibril;
-	__tcb_set(main_fibril.tcb);
-	fibril_setup(&main_fibril);
-
-	/* Initialize user task run-time environment */
-	__malloc_init();
-
-#ifdef CONFIG_RTLD
-	if (__pcb == NULL) {
-		/*
-		 * A binary loaded by kernel, not the loader.
-		 * Noop - code loaded by kernel doesn't need RTLD.
-		 */
-	} else {
-		assert(__pcb->rtld_runtime != NULL);
-		runtime_env = (rtld_t *) __pcb->rtld_runtime;
-	}
-#endif
-
-	__async_server_init();
-	__async_client_init();
-	__async_ports_init();
-
-	/* The basic run-time environment is setup */
-	env_setup = true;
-
-	int argc;
-	char **argv;
-
-	/*
-	 * Get command line arguments and initialize
-	 * standard input and output
-	 */
-	if (__pcb == NULL) {
-		argc = 0;
-		argv = NULL;
-		__stdio_init();
-	} else {
-		argc = __pcb->argc;
-		argv = __pcb->argv;
-		__inbox_init(__pcb->inbox, __pcb->inbox_entries);
-		__stdio_init();
-		vfs_root_set(inbox_get("root"));
-		(void) vfs_cwd_set(__pcb->cwd);
-	}
-
-	/*
-	 * C++ Static constructor calls.
-	 */
-
-	if (__progsymbols.preinit_array) {
-		for (int i = __progsymbols.preinit_array_len - 1; i >= 0; --i)
-			__progsymbols.preinit_array[i]();
-	}
-
-	if (__progsymbols.init_array) {
-		for (int i = __progsymbols.init_array_len - 1; i >= 0; --i)
-			__progsymbols.init_array[i]();
-	}
-
-	/*
-	 * Run main() and set task return value
-	 * according the result
-	 */
-	int retval = __progsymbols.main(argc, argv);
-	exit(retval);
-}
-
-void __libc_fini(void)
-{
-	__async_client_fini();
-	__async_server_fini();
-	__async_ports_fini();
-
-	__fibril_synch_fini();
-	__fibrils_fini();
-
-	__malloc_fini();
-
-	__kio_fini();
-}
-
-void __libc_exit(int status)
-{
-	/*
-	 * GCC extension __attribute__((destructor)),
-	 * C++ destructors are added to __cxa_finalize call
-	 * when the respective constructor is called.
-	 */
-
-	for (int i = 0; i < __progsymbols.fini_array_len; ++i)
-		__progsymbols.fini_array[i]();
-
-	if (env_setup) {
-		__stdio_done();
-		task_retval(status);
-	}
-
-	__SYSCALL1(SYS_TASK_EXIT, false);
-	__builtin_unreachable();
-}
-
-void __libc_abort(void)
-{
-	__SYSCALL1(SYS_TASK_EXIT, true);
-	__builtin_unreachable();
-}
-
-/** @}
- */
Index: pace/lib/c/generic/loader.c
===================================================================
--- uspace/lib/c/generic/loader.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,397 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <ipc/loader.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <libc.h>
-#include <task.h>
-#include <str.h>
-#include <stdlib.h>
-#include <async.h>
-#include <errno.h>
-#include <vfs/vfs.h>
-#include <loader/loader.h>
-#include "private/loader.h"
-
-/** Spawn a new program loader.
- *
- * Spawn a new program loader task. The loader then independetly
- * connects to the naming service.
- *
- * @param name Symbolic name to set on the newly created task.
- *
- * @return Error code.
- *
- */
-errno_t loader_spawn(const char *name)
-{
-	return (errno_t) __SYSCALL2(SYS_PROGRAM_SPAWN_LOADER,
-	    (sysarg_t) name, str_size(name));
-}
-
-/** Connect to a program loader.
- *
- * @param rc Placeholder for return code. Unused if NULL.
- *
- * @return Loader structure.
- *
- */
-loader_t *loader_connect(errno_t *rc)
-{
-	loader_t *ldr = malloc(sizeof(loader_t));
-	if (ldr == NULL)
-		return NULL;
-
-	async_sess_t *sess =
-	    service_connect_blocking(SERVICE_LOADER, INTERFACE_LOADER, 0, rc);
-	if (sess == NULL) {
-		free(ldr);
-		return NULL;
-	}
-
-	ldr->sess = sess;
-	return ldr;
-}
-
-/** Get ID of the new task.
- *
- * Retrieves the ID of the new task from the loader.
- *
- * @param ldr     Loader connection structure.
- * @param task_id Points to a variable where the ID should be stored.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_get_task_id(loader_t *ldr, task_id_t *task_id)
-{
-	/* Get task ID. */
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOADER_GET_TASKID, &answer);
-	errno_t rc = async_data_read_start(exch, task_id, sizeof(task_id_t));
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return (errno_t) rc;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t) rc;
-}
-
-/** Set current working directory for the loaded task.
- *
- * Sets the current working directory for the loaded task.
- *
- * @param ldr  Loader connection structure.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_cwd(loader_t *ldr)
-{
-	char *cwd = (char *) malloc(MAX_PATH_LEN + 1);
-	if (!cwd)
-		return ENOMEM;
-
-	if (vfs_cwd_get(cwd, MAX_PATH_LEN + 1) != EOK)
-		str_cpy(cwd, MAX_PATH_LEN + 1, "/");
-
-	size_t len = str_length(cwd);
-
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOADER_SET_CWD, &answer);
-	errno_t rc = async_data_write_start(exch, cwd, len);
-
-	async_exchange_end(exch);
-	free(cwd);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return (errno_t) rc;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t) rc;
-}
-
-/** Set the program to load.
- *
- * @param ldr  Loader connection structure.
- * @param name Name to set for the spawned program.
- * @param file Program file.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_program(loader_t *ldr, const char *name, int file)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOADER_SET_PROGRAM, &answer);
-
-	errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
-	if (rc == EOK) {
-		async_exch_t *vfs_exch = vfs_exchange_begin();
-		rc = vfs_pass_handle(vfs_exch, file, exch);
-		vfs_exchange_end(vfs_exch);
-	}
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return (errno_t) rc;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t) rc;
-}
-
-/** Set the program to load by path.
- *
- * @param ldr  Loader connection structure.
- * @param path Program path.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_program_path(loader_t *ldr, const char *path)
-{
-	size_t abslen;
-	char *abspath = vfs_absolutize(path, &abslen);
-	if (!abspath)
-		return ENOMEM;
-
-	int fd;
-	errno_t rc = vfs_lookup(path, 0, &fd);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	rc = loader_set_program(ldr, abspath, fd);
-	vfs_put(fd);
-	return rc;
-}
-
-/** Set command-line arguments for the program.
- *
- * Sets the vector of command-line arguments to be passed to the loaded
- * program. By convention, the very first argument is typically the same as
- * the command used to execute the program.
- *
- * @param ldr  Loader connection structure.
- * @param argv NULL-terminated array of pointers to arguments.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_set_args(loader_t *ldr, const char *const argv[])
-{
-	/*
-	 * Serialize the arguments into a single array. First
-	 * compute size of the buffer needed.
-	 */
-	const char *const *ap = argv;
-	size_t buffer_size = 0;
-	while (*ap != NULL) {
-		buffer_size += str_size(*ap) + 1;
-		ap++;
-	}
-
-	char *arg_buf = malloc(buffer_size);
-	if (arg_buf == NULL)
-		return ENOMEM;
-
-	/* Now fill the buffer with null-terminated argument strings */
-	ap = argv;
-	char *dp = arg_buf;
-
-	while (*ap != NULL) {
-		str_cpy(dp, buffer_size - (dp - arg_buf), *ap);
-		dp += str_size(*ap) + 1;
-		ap++;
-	}
-
-	/* Send serialized arguments to the loader */
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOADER_SET_ARGS, &answer);
-	errno_t rc = async_data_write_start(exch, (void *) arg_buf,
-	    buffer_size);
-
-	async_exchange_end(exch);
-	free(arg_buf);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return (errno_t) rc;
-	}
-
-	async_wait_for(req, &rc);
-	return (errno_t) rc;
-}
-
-/** Add a file to the task's inbox.
- *
- * @param ldr        Loader connection structure.
- * @param name       Identification of the file.
- * @param file       The file's descriptor.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_add_inbox(loader_t *ldr, const char *name, int file)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	async_exch_t *vfs_exch = vfs_exchange_begin();
-
-	aid_t req = async_send_0(exch, LOADER_ADD_INBOX, NULL);
-
-	errno_t rc = async_data_write_start(exch, name, str_size(name) + 1);
-	if (rc == EOK) {
-		rc = vfs_pass_handle(vfs_exch, file, exch);
-	}
-
-	async_exchange_end(vfs_exch);
-	async_exchange_end(exch);
-
-	if (rc == EOK) {
-		async_wait_for(req, &rc);
-	} else {
-		async_forget(req);
-	}
-
-	return (errno_t) rc;
-}
-
-/** Instruct loader to load the program.
- *
- * If this function succeeds, the program has been successfully loaded
- * and is ready to be executed.
- *
- * @param ldr Loader connection structure.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_load_program(loader_t *ldr)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	errno_t rc = async_req_0_0(exch, LOADER_LOAD);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Instruct loader to execute the program.
- *
- * Note that this function blocks until the loader actually replies
- * so you cannot expect this function to return if you are debugging
- * the task and its thread is stopped.
- *
- * After using this function, no further operations can be performed
- * on the loader structure and it is deallocated.
- *
- * @param ldr Loader connection structure.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t loader_run(loader_t *ldr)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	errno_t rc = async_req_0_0(exch, LOADER_RUN);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	async_hangup(ldr->sess);
-	free(ldr);
-
-	return EOK;
-}
-
-/** Instruct loader to execute the program and do not wait for reply.
- *
- * This function does not block even if the loaded task is stopped
- * for debugging.
- *
- * After using this function, no further operations can be performed
- * on the loader structure and it is deallocated.
- *
- * @param ldr Loader connection structure.
- *
- * @return Zero on success or an error code.
- *
- */
-void loader_run_nowait(loader_t *ldr)
-{
-	async_exch_t *exch = async_exchange_begin(ldr->sess);
-	async_msg_0(exch, LOADER_RUN);
-	async_exchange_end(exch);
-
-	async_hangup(ldr->sess);
-	free(ldr);
-}
-
-/** Cancel the loader session.
- *
- * Tell the loader not to load any program and terminate.
- * After using this function, no further operations can be performed
- * on the loader structure and it is deallocated.
- *
- * @param ldr Loader connection structure.
- *
- * @return Zero on success or an error code.
- *
- */
-void loader_abort(loader_t *ldr)
-{
-	async_hangup(ldr->sess);
-	free(ldr);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/loc.c
===================================================================
--- uspace/lib/c/generic/loc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,874 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2007 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <str.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <ipc/loc.h>
-#include <loc.h>
-#include <fibril_synch.h>
-#include <async.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdbool.h>
-
-static FIBRIL_MUTEX_INITIALIZE(loc_cons_block_mutex);
-static FIBRIL_MUTEX_INITIALIZE(loc_consumer_mutex);
-
-static FIBRIL_MUTEX_INITIALIZE(loc_callback_mutex);
-static bool loc_callback_created = false;
-static loc_cat_change_cb_t cat_change_cb = NULL;
-static void *cat_change_arg = NULL;
-
-static async_sess_t *loc_cons_block_sess = NULL;
-static async_sess_t *loc_consumer_sess = NULL;
-
-static void loc_cb_conn(ipc_call_t *icall, void *arg)
-{
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOC_EVENT_CAT_CHANGE:
-			fibril_mutex_lock(&loc_callback_mutex);
-			loc_cat_change_cb_t cb_fun = cat_change_cb;
-			void *cb_arg = cat_change_arg;
-			fibril_mutex_unlock(&loc_callback_mutex);
-
-			async_answer_0(&call, EOK);
-
-			if (cb_fun != NULL)
-				(*cb_fun)(cb_arg);
-
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-static void clone_session(fibril_mutex_t *mtx, async_sess_t *src,
-    async_sess_t **dst)
-{
-	fibril_mutex_lock(mtx);
-
-	if ((*dst == NULL) && (src != NULL))
-		*dst = src;
-
-	fibril_mutex_unlock(mtx);
-}
-
-/** Create callback
- *
- * Must be called with loc_callback_mutex locked.
- *
- * @return EOK on success.
- *
- */
-static errno_t loc_callback_create(void)
-{
-	if (!loc_callback_created) {
-		async_exch_t *exch =
-		    loc_exchange_begin_blocking();
-
-		ipc_call_t answer;
-		aid_t req = async_send_0(exch, LOC_CALLBACK_CREATE, &answer);
-
-		port_id_t port;
-		errno_t rc = async_create_callback_port(exch, INTERFACE_LOC_CB, 0, 0,
-		    loc_cb_conn, NULL, &port);
-
-		loc_exchange_end(exch);
-
-		if (rc != EOK)
-			return rc;
-
-		errno_t retval;
-		async_wait_for(req, &retval);
-		if (retval != EOK)
-			return retval;
-
-		loc_callback_created = true;
-	}
-
-	return EOK;
-}
-
-/** Start an async exchange on the loc session (blocking).
- *
- * @return New exchange.
- *
- */
-async_exch_t *loc_exchange_begin_blocking(void)
-{
-	fibril_mutex_lock(&loc_cons_block_mutex);
-
-	while (loc_cons_block_sess == NULL) {
-		clone_session(&loc_consumer_mutex, loc_consumer_sess,
-		    &loc_cons_block_sess);
-
-		if (loc_cons_block_sess == NULL)
-			loc_cons_block_sess =
-			    service_connect_blocking(SERVICE_LOC,
-			    INTERFACE_LOC_CONSUMER, 0, NULL);
-	}
-
-	fibril_mutex_unlock(&loc_cons_block_mutex);
-
-	clone_session(&loc_consumer_mutex, loc_cons_block_sess,
-	    &loc_consumer_sess);
-
-	return async_exchange_begin(loc_cons_block_sess);
-}
-
-/** Start an async exchange on the loc session.
- *
- * @return New exchange.
- *
- */
-async_exch_t *loc_exchange_begin(void)
-{
-	fibril_mutex_lock(&loc_consumer_mutex);
-
-	if (loc_consumer_sess == NULL)
-		loc_consumer_sess =
-		    service_connect(SERVICE_LOC,
-		    INTERFACE_LOC_CONSUMER, 0, NULL);
-
-	fibril_mutex_unlock(&loc_consumer_mutex);
-
-	if (loc_consumer_sess == NULL)
-		return NULL;
-
-	return async_exchange_begin(loc_consumer_sess);
-}
-
-/** Finish an async exchange on the loc session.
- *
- * @param exch Exchange to be finished.
- *
- */
-void loc_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Register new server with loc.
- *
- * @param name Server name
- * @param rsrv Place to store new server object on success
- * @return EOK on succes or an error code
- */
-errno_t loc_server_register(const char *name, loc_srv_t **rsrv)
-{
-	async_exch_t *exch;
-	loc_srv_t *srv;
-
-	srv = calloc(1, sizeof(loc_srv_t));
-	if (srv == NULL)
-		return ENOMEM;
-
-	srv->sess = service_connect_blocking(SERVICE_LOC,
-	    INTERFACE_LOC_SUPPLIER, 0, NULL);
-	if (srv->sess == NULL) {
-		free(srv);
-		return ENOMEM;
-	}
-
-	exch = async_exchange_begin(srv->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, LOC_SERVER_REGISTER, 0, 0, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	if (retval != EOK) {
-		async_forget(req);
-		async_exchange_end(exch);
-		async_hangup(srv->sess);
-		free(srv);
-		return retval;
-	}
-
-	async_connect_to_me(exch, INTERFACE_ANY, 0, 0);
-
-	/*
-	 * First wait for the answer and then end the exchange. The opposite
-	 * order is generally wrong because it may lead to a deadlock under
-	 * certain circumstances.
-	 */
-	async_wait_for(req, &retval);
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_hangup(srv->sess);
-		free(srv);
-		return retval;
-	}
-
-	*rsrv = srv;
-	return retval;
-}
-
-/** Unregister server from loc.
- *
- * Unregister server and free server object.
- *
- * @param srv Server object
- */
-void loc_server_unregister(loc_srv_t *srv)
-{
-	async_hangup(srv->sess);
-	free(srv);
-}
-
-/** Register new service.
- *
- * @param srv Server object
- * @param fqsn Fully qualified service name
- * @param sid  Service ID of new service
- *
- */
-errno_t loc_service_register(loc_srv_t *srv, const char *fqsn,
-    service_id_t *sid)
-{
-	async_exch_t *exch = async_exchange_begin(srv->sess);
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOC_SERVICE_REGISTER, &answer);
-	errno_t retval = async_data_write_start(exch, fqsn, str_size(fqsn));
-
-	if (retval != EOK) {
-		async_forget(req);
-		async_exchange_end(exch);
-		return retval;
-	}
-
-	/*
-	 * First wait for the answer and then end the exchange. The opposite
-	 * order is generally wrong because it may lead to a deadlock under
-	 * certain circumstances.
-	 */
-	async_wait_for(req, &retval);
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		if (sid != NULL)
-			*sid = -1;
-
-		return retval;
-	}
-
-	if (sid != NULL)
-		*sid = (service_id_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-/** Unregister service.
- *
- * @param srv Server object
- * @param sid Service ID
- */
-errno_t loc_service_unregister(loc_srv_t *srv, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(srv->sess);
-	retval = async_req_1_0(exch, LOC_SERVICE_UNREGISTER, sid);
-	async_exchange_end(exch);
-
-	return (errno_t)retval;
-}
-
-errno_t loc_service_get_id(const char *fqdn, service_id_t *handle,
-    unsigned int flags)
-{
-	async_exch_t *exch;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		exch = loc_exchange_begin_blocking();
-	else {
-		exch = loc_exchange_begin();
-		if (exch == NULL)
-			return errno;
-	}
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, LOC_SERVICE_GET_ID, flags, 0,
-	    &answer);
-	errno_t retval = async_data_write_start(exch, fqdn, str_size(fqdn));
-
-	loc_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = (service_id_t) -1;
-
-		return retval;
-	}
-
-	if (handle != NULL)
-		*handle = (service_id_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-/** Get object name.
- *
- * Provided ID of an object, return its name.
- *
- * @param method	IPC method
- * @param id		Object ID
- * @param name		Place to store pointer to new string. Caller should
- *			free it using free().
- * @return		EOK on success or an error code
- */
-static errno_t loc_get_name_internal(sysarg_t method, sysarg_t id, char **name)
-{
-	async_exch_t *exch;
-	char name_buf[LOC_NAME_MAXLEN + 1];
-	ipc_call_t dreply;
-	size_t act_size;
-	errno_t dretval;
-
-	*name = NULL;
-	exch = loc_exchange_begin_blocking();
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, id, &answer);
-	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
-	    &dreply);
-	async_wait_for(dreq, &dretval);
-
-	loc_exchange_end(exch);
-
-	if (dretval != EOK) {
-		async_forget(req);
-		return dretval;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	act_size = ipc_get_arg2(&dreply);
-	assert(act_size <= LOC_NAME_MAXLEN);
-	name_buf[act_size] = '\0';
-
-	*name = str_dup(name_buf);
-	if (*name == NULL)
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Get category name.
- *
- * Provided ID of a service, return its name.
- *
- * @param cat_id	Category ID
- * @param name		Place to store pointer to new string. Caller should
- *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_category_get_name(category_id_t cat_id, char **name)
-{
-	return loc_get_name_internal(LOC_CATEGORY_GET_NAME, cat_id, name);
-}
-
-/** Get service name.
- *
- * Provided ID of a service, return its name.
- *
- * @param svc_id	Service ID
- * @param name		Place to store pointer to new string. Caller should
- *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_service_get_name(service_id_t svc_id, char **name)
-{
-	return loc_get_name_internal(LOC_SERVICE_GET_NAME, svc_id, name);
-}
-
-/** Get service server name.
- *
- * Provided ID of a service, return the name of its server.
- *
- * @param svc_id	Service ID
- * @param name		Place to store pointer to new string. Caller should
- *			free it using free().
- * @return		EOK on success or an error code
- */
-errno_t loc_service_get_server_name(service_id_t svc_id, char **name)
-{
-	return loc_get_name_internal(LOC_SERVICE_GET_SERVER_NAME, svc_id, name);
-}
-
-errno_t loc_namespace_get_id(const char *name, service_id_t *handle,
-    unsigned int flags)
-{
-	async_exch_t *exch;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		exch = loc_exchange_begin_blocking();
-	else {
-		exch = loc_exchange_begin();
-		if (exch == NULL)
-			return errno;
-	}
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, LOC_NAMESPACE_GET_ID, flags, 0,
-	    &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	loc_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = (service_id_t) -1;
-
-		return retval;
-	}
-
-	if (handle != NULL)
-		*handle = (service_id_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-/** Get category ID.
- *
- * Provided name of a category, return its ID.
- *
- * @param name		Category name
- * @param cat_id	Place to store ID
- * @param flags		IPC_FLAG_BLOCKING to wait for location service to start
- * @return		EOK on success or an error code
- */
-errno_t loc_category_get_id(const char *name, category_id_t *cat_id,
-    unsigned int flags)
-{
-	async_exch_t *exch;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		exch = loc_exchange_begin_blocking();
-	else {
-		exch = loc_exchange_begin();
-		if (exch == NULL)
-			return errno;
-	}
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, LOC_CATEGORY_GET_ID,
-	    &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	loc_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (cat_id != NULL)
-			*cat_id = (category_id_t) -1;
-
-		return retval;
-	}
-
-	if (cat_id != NULL)
-		*cat_id = (category_id_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-loc_object_type_t loc_id_probe(service_id_t handle)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-
-	sysarg_t type;
-	errno_t retval = async_req_1_1(exch, LOC_ID_PROBE, handle, &type);
-
-	loc_exchange_end(exch);
-
-	if (retval != EOK)
-		return LOC_OBJECT_NONE;
-
-	return (loc_object_type_t) type;
-}
-
-async_sess_t *loc_service_connect(service_id_t handle, iface_t iface,
-    unsigned int flags)
-{
-	async_sess_t *sess;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		sess = service_connect_blocking(SERVICE_LOC, iface, handle, NULL);
-	else
-		sess = service_connect(SERVICE_LOC, iface, handle, NULL);
-
-	return sess;
-}
-
-/**
- * @return ID of a new NULL device, or -1 if failed.
- */
-int loc_null_create(void)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-
-	sysarg_t null_id;
-	errno_t retval = async_req_0_1(exch, LOC_NULL_CREATE, &null_id);
-
-	loc_exchange_end(exch);
-
-	if (retval != EOK)
-		return -1;
-
-	return (int) null_id;
-}
-
-void loc_null_destroy(int null_id)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-	async_req_1_0(exch, LOC_NULL_DESTROY, (sysarg_t) null_id);
-	loc_exchange_end(exch);
-}
-
-static size_t loc_count_namespaces_internal(async_exch_t *exch)
-{
-	sysarg_t count;
-	errno_t retval = async_req_0_1(exch, LOC_GET_NAMESPACE_COUNT, &count);
-	if (retval != EOK)
-		return 0;
-
-	return count;
-}
-
-/** Add service to category.
- *
- * @param srv    Server object
- * @param svc_id Service ID
- * @param cat_id Category ID
- *
- * @return EOK on success or an error code
- */
-errno_t loc_service_add_to_cat(loc_srv_t *srv, service_id_t svc_id,
-    service_id_t cat_id)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(srv->sess);
-	retval = async_req_2_0(exch, LOC_SERVICE_ADD_TO_CAT, svc_id, cat_id);
-	async_exchange_end(exch);
-
-	return retval;
-}
-
-static size_t loc_count_services_internal(async_exch_t *exch,
-    service_id_t ns_handle)
-{
-	sysarg_t count;
-	errno_t retval = async_req_1_1(exch, LOC_GET_SERVICE_COUNT, ns_handle,
-	    &count);
-	if (retval != EOK)
-		return 0;
-
-	return count;
-}
-
-size_t loc_count_namespaces(void)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-	size_t size = loc_count_namespaces_internal(exch);
-	loc_exchange_end(exch);
-
-	return size;
-}
-
-size_t loc_count_services(service_id_t ns_handle)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-	size_t size = loc_count_services_internal(exch, ns_handle);
-	loc_exchange_end(exch);
-
-	return size;
-}
-
-size_t loc_get_namespaces(loc_sdesc_t **data)
-{
-	/* Loop until read is succesful */
-	while (true) {
-		async_exch_t *exch = loc_exchange_begin_blocking();
-		size_t count = loc_count_namespaces_internal(exch);
-		loc_exchange_end(exch);
-
-		if (count == 0)
-			return 0;
-
-		loc_sdesc_t *devs = (loc_sdesc_t *) calloc(count, sizeof(loc_sdesc_t));
-		if (devs == NULL)
-			return 0;
-
-		exch = loc_exchange_begin();
-
-		ipc_call_t answer;
-		aid_t req = async_send_0(exch, LOC_GET_NAMESPACES, &answer);
-		errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
-
-		loc_exchange_end(exch);
-
-		if (rc == EOVERFLOW) {
-			/*
-			 * Number of namespaces has changed since
-			 * the last call of LOC_GET_NAMESPACE_COUNT
-			 */
-			free(devs);
-			continue;
-		}
-
-		if (rc != EOK) {
-			async_forget(req);
-			free(devs);
-			return 0;
-		}
-
-		errno_t retval;
-		async_wait_for(req, &retval);
-
-		if (retval != EOK)
-			return 0;
-
-		*data = devs;
-		return count;
-	}
-}
-
-size_t loc_get_services(service_id_t ns_handle, loc_sdesc_t **data)
-{
-	/* Loop until read is succesful */
-	while (true) {
-		async_exch_t *exch = loc_exchange_begin_blocking();
-		size_t count = loc_count_services_internal(exch, ns_handle);
-		loc_exchange_end(exch);
-
-		if (count == 0)
-			return 0;
-
-		loc_sdesc_t *devs = (loc_sdesc_t *) calloc(count, sizeof(loc_sdesc_t));
-		if (devs == NULL)
-			return 0;
-
-		exch = loc_exchange_begin();
-
-		ipc_call_t answer;
-		aid_t req = async_send_1(exch, LOC_GET_SERVICES, ns_handle, &answer);
-		errno_t rc = async_data_read_start(exch, devs, count * sizeof(loc_sdesc_t));
-
-		loc_exchange_end(exch);
-
-		if (rc == EOVERFLOW) {
-			/*
-			 * Number of services has changed since
-			 * the last call of LOC_GET_SERVICE_COUNT
-			 */
-			free(devs);
-			continue;
-		}
-
-		if (rc != EOK) {
-			async_forget(req);
-			free(devs);
-			return 0;
-		}
-
-		errno_t retval;
-		async_wait_for(req, &retval);
-
-		if (retval != EOK)
-			return 0;
-
-		*data = devs;
-		return count;
-	}
-}
-
-static errno_t loc_category_get_ids_once(sysarg_t method, sysarg_t arg1,
-    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = loc_exchange_begin_blocking();
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	loc_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of IDs.
- *
- * Returns an allocated array of service IDs.
- *
- * @param method	IPC method
- * @param arg1		IPC argument 1
- * @param data		Place to store pointer to array of IDs
- * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-static errno_t loc_get_ids_internal(sysarg_t method, sysarg_t arg1,
-    sysarg_t **data, size_t *count)
-{
-	*data = NULL;
-	*count = 0;
-
-	size_t act_size = 0;
-	errno_t rc = loc_category_get_ids_once(method, arg1, NULL, 0,
-	    &act_size);
-	if (rc != EOK)
-		return rc;
-
-	size_t alloc_size = act_size;
-	service_id_t *ids = malloc(alloc_size);
-	if (ids == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = loc_category_get_ids_once(method, arg1, ids, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size = act_size;
-		service_id_t *tmp = realloc(ids, alloc_size);
-		if (tmp == NULL) {
-			free(ids);
-			return ENOMEM;
-		}
-		ids = tmp;
-	}
-
-	*count = act_size / sizeof(category_id_t);
-	*data = ids;
-	return EOK;
-}
-
-/** Get list of services in category.
- *
- * Returns an allocated array of service IDs.
- *
- * @param cat_id	Category ID
- * @param data		Place to store pointer to array of IDs
- * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-errno_t loc_category_get_svcs(category_id_t cat_id, service_id_t **data,
-    size_t *count)
-{
-	return loc_get_ids_internal(LOC_CATEGORY_GET_SVCS, cat_id,
-	    data, count);
-}
-
-/** Get list of categories.
- *
- * Returns an allocated array of category IDs.
- *
- * @param data		Place to store pointer to array of IDs
- * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-errno_t loc_get_categories(category_id_t **data, size_t *count)
-{
-	return loc_get_ids_internal(LOC_GET_CATEGORIES, 0,
-	    data, count);
-}
-
-errno_t loc_register_cat_change_cb(loc_cat_change_cb_t cb_fun, void *cb_arg)
-{
-	fibril_mutex_lock(&loc_callback_mutex);
-	if (cat_change_cb != NULL) {
-		fibril_mutex_unlock(&loc_callback_mutex);
-		return EEXIST;
-	}
-
-	if (loc_callback_create() != EOK) {
-		fibril_mutex_unlock(&loc_callback_mutex);
-		return EIO;
-	}
-
-	cat_change_cb = cb_fun;
-	cat_change_arg = cb_arg;
-	fibril_mutex_unlock(&loc_callback_mutex);
-
-	return EOK;
-}
Index: pace/lib/c/generic/malloc.c
===================================================================
--- uspace/lib/c/generic/malloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1063 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Petr Tuma
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdlib.h>
-#include <stdalign.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <as.h>
-#include <align.h>
-#include <macros.h>
-#include <assert.h>
-#include <errno.h>
-#include <bitops.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <adt/gcdlcm.h>
-#include <malloc.h>
-
-#include "private/malloc.h"
-#include "private/fibril.h"
-
-/** Magic used in heap headers. */
-#define HEAP_BLOCK_HEAD_MAGIC  UINT32_C(0xBEEF0101)
-
-/** Magic used in heap footers. */
-#define HEAP_BLOCK_FOOT_MAGIC  UINT32_C(0xBEEF0202)
-
-/** Magic used in heap descriptor. */
-#define HEAP_AREA_MAGIC  UINT32_C(0xBEEFCAFE)
-
-/** Allocation alignment.
- *
- * This also covers the alignment of fields
- * in the heap header and footer.
- *
- */
-#define BASE_ALIGN  16
-
-/** Heap shrink granularity
- *
- * Try not to pump and stress the heap too much
- * by shrinking and enlarging it too often.
- * A heap area won't shrink if the released
- * free block is smaller than this constant.
- *
- */
-#define SHRINK_GRANULARITY  (64 * PAGE_SIZE)
-
-/** Overhead of each heap block. */
-#define STRUCT_OVERHEAD \
-	(sizeof(heap_block_head_t) + sizeof(heap_block_foot_t))
-
-/** Calculate real size of a heap block.
- *
- * Add header and footer size.
- *
- */
-#define GROSS_SIZE(size)  ((size) + STRUCT_OVERHEAD)
-
-/** Calculate net size of a heap block.
- *
- * Subtract header and footer size.
- *
- */
-#define NET_SIZE(size)  ((size) - STRUCT_OVERHEAD)
-
-/** Overhead of each area. */
-#define AREA_OVERHEAD(size) \
-	(ALIGN_UP(GROSS_SIZE(size) + sizeof(heap_area_t), BASE_ALIGN))
-
-/** Get first block in heap area.
- *
- */
-#define AREA_FIRST_BLOCK_HEAD(area) \
-	(ALIGN_UP(((uintptr_t) (area)) + sizeof(heap_area_t), BASE_ALIGN))
-
-/** Get last block in heap area.
- *
- */
-#define AREA_LAST_BLOCK_FOOT(area) \
-	(((uintptr_t) (area)->end) - sizeof(heap_block_foot_t))
-
-#define AREA_LAST_BLOCK_HEAD(area) \
-	((uintptr_t) BLOCK_HEAD(((heap_block_foot_t *) AREA_LAST_BLOCK_FOOT(area))))
-
-/** Get header in heap block.
- *
- */
-#define BLOCK_HEAD(foot) \
-	((heap_block_head_t *) \
-	    (((uintptr_t) (foot)) + sizeof(heap_block_foot_t) - (foot)->size))
-
-/** Get footer in heap block.
- *
- */
-#define BLOCK_FOOT(head) \
-	((heap_block_foot_t *) \
-	    (((uintptr_t) (head)) + (head)->size - sizeof(heap_block_foot_t)))
-
-/** Heap area.
- *
- * The memory managed by the heap allocator is divided into
- * multiple discontinuous heaps. Each heap is represented
- * by a separate address space area which has this structure
- * at its very beginning.
- *
- */
-typedef struct heap_area {
-	/** Start of the heap area (including this structure)
-	 *
-	 * Aligned on page boundary.
-	 *
-	 */
-	void *start;
-
-	/** End of the heap area (aligned on page boundary) */
-	void *end;
-
-	/** Previous heap area */
-	struct heap_area *prev;
-
-	/** Next heap area */
-	struct heap_area *next;
-
-	/** A magic value */
-	uint32_t magic;
-} heap_area_t;
-
-/** Header of a heap block
- *
- */
-typedef struct {
-	/* Size of the block (including header and footer) */
-	size_t size;
-
-	/* Indication of a free block */
-	bool free;
-
-	/** Heap area this block belongs to */
-	heap_area_t *area;
-
-	/* A magic value to detect overwrite of heap header */
-	uint32_t magic;
-} heap_block_head_t;
-
-/** Footer of a heap block
- *
- */
-typedef struct {
-	/* Size of the block (including header and footer) */
-	size_t size;
-
-	/* A magic value to detect overwrite of heap footer */
-	uint32_t magic;
-} heap_block_foot_t;
-
-/** First heap area */
-static heap_area_t *first_heap_area = NULL;
-
-/** Last heap area */
-static heap_area_t *last_heap_area = NULL;
-
-/** Next heap block to examine (next fit algorithm) */
-static heap_block_head_t *next_fit = NULL;
-
-/** Futex for thread-safe heap manipulation */
-static fibril_rmutex_t malloc_mutex;
-
-#define malloc_assert(expr) safe_assert(expr)
-
-/*
- * Make sure the base alignment is sufficient.
- */
-static_assert(BASE_ALIGN >= alignof(heap_area_t), "");
-static_assert(BASE_ALIGN >= alignof(heap_block_head_t), "");
-static_assert(BASE_ALIGN >= alignof(heap_block_foot_t), "");
-static_assert(BASE_ALIGN >= alignof(max_align_t), "");
-
-/** Serializes access to the heap from multiple threads. */
-static inline void heap_lock(void)
-{
-	fibril_rmutex_lock(&malloc_mutex);
-}
-
-/** Serializes access to the heap from multiple threads. */
-static inline void heap_unlock(void)
-{
-	fibril_rmutex_unlock(&malloc_mutex);
-}
-
-/** Initialize a heap block
- *
- * Fill in the structures related to a heap block.
- * Should be called only inside the critical section.
- *
- * @param addr Address of the block.
- * @param size Size of the block including the header and the footer.
- * @param free Indication of a free block.
- * @param area Heap area the block belongs to.
- *
- */
-static void block_init(void *addr, size_t size, bool free, heap_area_t *area)
-{
-	/* Calculate the position of the header and the footer */
-	heap_block_head_t *head = (heap_block_head_t *) addr;
-
-	head->size = size;
-	head->free = free;
-	head->area = area;
-	head->magic = HEAP_BLOCK_HEAD_MAGIC;
-
-	heap_block_foot_t *foot = BLOCK_FOOT(head);
-
-	foot->size = size;
-	foot->magic = HEAP_BLOCK_FOOT_MAGIC;
-}
-
-/** Check a heap block
- *
- * Verifies that the structures related to a heap block still contain
- * the magic constants. This helps detect heap corruption early on.
- * Should be called only inside the critical section.
- *
- * @param addr Address of the block.
- *
- */
-static void block_check(void *addr)
-{
-	heap_block_head_t *head = (heap_block_head_t *) addr;
-
-	malloc_assert(head->magic == HEAP_BLOCK_HEAD_MAGIC);
-
-	heap_block_foot_t *foot = BLOCK_FOOT(head);
-
-	malloc_assert(foot->magic == HEAP_BLOCK_FOOT_MAGIC);
-	malloc_assert(head->size == foot->size);
-}
-
-/** Check a heap area structure
- *
- * Should be called only inside the critical section.
- *
- * @param addr Address of the heap area.
- *
- */
-static void area_check(void *addr)
-{
-	heap_area_t *area = (heap_area_t *) addr;
-
-	malloc_assert(area->magic == HEAP_AREA_MAGIC);
-	malloc_assert(addr == area->start);
-	malloc_assert(area->start < area->end);
-	malloc_assert(((uintptr_t) area->start % PAGE_SIZE) == 0);
-	malloc_assert(((uintptr_t) area->end % PAGE_SIZE) == 0);
-}
-
-/** Create new heap area
- *
- * Should be called only inside the critical section.
- *
- * @param size Size of the area.
- *
- */
-static bool area_create(size_t size)
-{
-	/* Align the heap area size on page boundary */
-	size_t asize = ALIGN_UP(size, PAGE_SIZE);
-	void *astart = as_area_create(AS_AREA_ANY, asize,
-	    AS_AREA_WRITE | AS_AREA_READ | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (astart == AS_MAP_FAILED)
-		return false;
-
-	heap_area_t *area = (heap_area_t *) astart;
-
-	area->start = astart;
-	area->end = (void *) ((uintptr_t) astart + asize);
-	area->prev = NULL;
-	area->next = NULL;
-	area->magic = HEAP_AREA_MAGIC;
-
-	void *block = (void *) AREA_FIRST_BLOCK_HEAD(area);
-	size_t bsize = (size_t) (area->end - block);
-
-	block_init(block, bsize, true, area);
-
-	if (last_heap_area == NULL) {
-		first_heap_area = area;
-		last_heap_area = area;
-	} else {
-		area->prev = last_heap_area;
-		last_heap_area->next = area;
-		last_heap_area = area;
-	}
-
-	return true;
-}
-
-/** Try to enlarge a heap area
- *
- * Should be called only inside the critical section.
- *
- * @param area Heap area to grow.
- * @param size Gross size to grow (bytes).
- *
- * @return True if successful.
- *
- */
-static bool area_grow(heap_area_t *area, size_t size)
-{
-	if (size == 0)
-		return true;
-
-	area_check(area);
-
-	/* New heap area size */
-	size_t gross_size = (size_t) (area->end - area->start) + size;
-	size_t asize = ALIGN_UP(gross_size, PAGE_SIZE);
-	void *end = (void *) ((uintptr_t) area->start + asize);
-
-	/* Check for overflow */
-	if (end < area->start)
-		return false;
-
-	/* Resize the address space area */
-	errno_t ret = as_area_resize(area->start, asize, 0);
-	if (ret != EOK)
-		return false;
-
-	heap_block_head_t *last_head =
-	    (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
-
-	if (last_head->free) {
-		/* Add the new space to the last block. */
-		size_t net_size = (size_t) (end - area->end) + last_head->size;
-		malloc_assert(net_size > 0);
-		block_init(last_head, net_size, true, area);
-	} else {
-		/* Add new free block */
-		size_t net_size = (size_t) (end - area->end);
-		if (net_size > 0)
-			block_init(area->end, net_size, true, area);
-	}
-
-	/* Update heap area parameters */
-	area->end = end;
-
-	return true;
-}
-
-/** Try to shrink heap
- *
- * Should be called only inside the critical section.
- * In all cases the next pointer is reset.
- *
- * @param area Last modified heap area.
- *
- */
-static void heap_shrink(heap_area_t *area)
-{
-	area_check(area);
-
-	heap_block_foot_t *last_foot =
-	    (heap_block_foot_t *) AREA_LAST_BLOCK_FOOT(area);
-	heap_block_head_t *last_head = BLOCK_HEAD(last_foot);
-
-	block_check((void *) last_head);
-	malloc_assert(last_head->area == area);
-
-	if (last_head->free) {
-		/*
-		 * The last block of the heap area is
-		 * unused. The area might be potentially
-		 * shrunk.
-		 */
-
-		heap_block_head_t *first_head =
-		    (heap_block_head_t *) AREA_FIRST_BLOCK_HEAD(area);
-
-		block_check((void *) first_head);
-		malloc_assert(first_head->area == area);
-
-		size_t shrink_size = ALIGN_DOWN(last_head->size, PAGE_SIZE);
-
-		if (first_head == last_head) {
-			/*
-			 * The entire heap area consists of a single
-			 * free heap block. This means we can get rid
-			 * of it entirely.
-			 */
-
-			heap_area_t *prev = area->prev;
-			heap_area_t *next = area->next;
-
-			if (prev != NULL) {
-				area_check(prev);
-				prev->next = next;
-			} else
-				first_heap_area = next;
-
-			if (next != NULL) {
-				area_check(next);
-				next->prev = prev;
-			} else
-				last_heap_area = prev;
-
-			as_area_destroy(area->start);
-		} else if (shrink_size >= SHRINK_GRANULARITY) {
-			/*
-			 * Make sure that we always shrink the area
-			 * by a multiple of page size and update
-			 * the block layout accordingly.
-			 */
-
-			size_t asize = (size_t) (area->end - area->start) - shrink_size;
-			void *end = (void *) ((uintptr_t) area->start + asize);
-
-			/* Resize the address space area */
-			errno_t ret = as_area_resize(area->start, asize, 0);
-			if (ret != EOK)
-				abort();
-
-			/* Update heap area parameters */
-			area->end = end;
-			size_t excess = ((size_t) area->end) - ((size_t) last_head);
-
-			if (excess > 0) {
-				if (excess >= STRUCT_OVERHEAD) {
-					/*
-					 * The previous block cannot be free and there
-					 * is enough free space left in the area to
-					 * create a new free block.
-					 */
-					block_init((void *) last_head, excess, true, area);
-				} else {
-					/*
-					 * The excess is small. Therefore just enlarge
-					 * the previous block.
-					 */
-					heap_block_foot_t *prev_foot = (heap_block_foot_t *)
-					    (((uintptr_t) last_head) - sizeof(heap_block_foot_t));
-					heap_block_head_t *prev_head = BLOCK_HEAD(prev_foot);
-
-					block_check((void *) prev_head);
-
-					block_init(prev_head, prev_head->size + excess,
-					    prev_head->free, area);
-				}
-			}
-		}
-	}
-
-	next_fit = NULL;
-}
-
-/** Initialize the heap allocator
- *
- * Create initial heap memory area. This routine is
- * only called from libc initialization, thus we do not
- * take any locks.
- *
- */
-void __malloc_init(void)
-{
-	if (fibril_rmutex_initialize(&malloc_mutex) != EOK)
-		abort();
-
-	if (!area_create(PAGE_SIZE))
-		abort();
-}
-
-void __malloc_fini(void)
-{
-	fibril_rmutex_destroy(&malloc_mutex);
-}
-
-/** Split heap block and mark it as used.
- *
- * Should be called only inside the critical section.
- *
- * @param cur  Heap block to split.
- * @param size Number of bytes to split and mark from the beginning
- *             of the block.
- *
- */
-static void split_mark(heap_block_head_t *cur, const size_t size)
-{
-	malloc_assert(cur->size >= size);
-
-	/* See if we should split the block. */
-	size_t split_limit = GROSS_SIZE(size);
-
-	if (cur->size > split_limit) {
-		/* Block big enough -> split. */
-		void *next = ((void *) cur) + size;
-		block_init(next, cur->size - size, true, cur->area);
-		block_init(cur, size, false, cur->area);
-	} else {
-		/* Block too small -> use as is. */
-		cur->free = false;
-	}
-}
-
-/** Allocate memory from heap area starting from given block
- *
- * Should be called only inside the critical section.
- * As a side effect this function also sets the current
- * pointer on successful allocation.
- *
- * @param area        Heap area where to allocate from.
- * @param first_block Starting heap block.
- * @param final_block Heap block where to finish the search
- *                    (may be NULL).
- * @param real_size   Gross number of bytes to allocate.
- * @param falign      Physical alignment of the block.
- *
- * @return Address of the allocated block or NULL on not enough memory.
- *
- */
-static void *malloc_area(heap_area_t *area, heap_block_head_t *first_block,
-    heap_block_head_t *final_block, size_t real_size, size_t falign)
-{
-	area_check((void *) area);
-	malloc_assert((void *) first_block >= (void *) AREA_FIRST_BLOCK_HEAD(area));
-	malloc_assert((void *) first_block < area->end);
-
-	for (heap_block_head_t *cur = first_block; (void *) cur < area->end;
-	    cur = (heap_block_head_t *) (((void *) cur) + cur->size)) {
-		block_check(cur);
-
-		/* Finish searching on the final block */
-		if ((final_block != NULL) && (cur == final_block))
-			break;
-
-		/* Try to find a block that is free and large enough. */
-		if ((cur->free) && (cur->size >= real_size)) {
-			/*
-			 * We have found a suitable block.
-			 * Check for alignment properties.
-			 */
-			void *addr = (void *)
-			    ((uintptr_t) cur + sizeof(heap_block_head_t));
-			void *aligned = (void *)
-			    ALIGN_UP((uintptr_t) addr, falign);
-
-			if (addr == aligned) {
-				/* Exact block start including alignment. */
-				split_mark(cur, real_size);
-
-				next_fit = cur;
-				return addr;
-			} else {
-				/* Block start has to be aligned */
-				size_t excess = (size_t) (aligned - addr);
-
-				if (cur->size >= real_size + excess) {
-					/*
-					 * The current block is large enough to fit
-					 * data in (including alignment).
-					 */
-					if ((void *) cur > (void *) AREA_FIRST_BLOCK_HEAD(area)) {
-						/*
-						 * There is a block before the current block.
-						 * This previous block can be enlarged to
-						 * compensate for the alignment excess.
-						 */
-						heap_block_foot_t *prev_foot = (heap_block_foot_t *)
-						    ((void *) cur - sizeof(heap_block_foot_t));
-
-						heap_block_head_t *prev_head = (heap_block_head_t *)
-						    ((void *) cur - prev_foot->size);
-
-						block_check(prev_head);
-
-						size_t reduced_size = cur->size - excess;
-						heap_block_head_t *next_head = ((void *) cur) + excess;
-
-						if ((!prev_head->free) &&
-						    (excess >= STRUCT_OVERHEAD)) {
-							/*
-							 * The previous block is not free and there
-							 * is enough free space left to fill in
-							 * a new free block between the previous
-							 * and current block.
-							 */
-							block_init(cur, excess, true, area);
-						} else {
-							/*
-							 * The previous block is free (thus there
-							 * is no need to induce additional
-							 * fragmentation to the heap) or the
-							 * excess is small. Therefore just enlarge
-							 * the previous block.
-							 */
-							block_init(prev_head, prev_head->size + excess,
-							    prev_head->free, area);
-						}
-
-						block_init(next_head, reduced_size, true, area);
-						split_mark(next_head, real_size);
-
-						next_fit = next_head;
-						return aligned;
-					} else {
-						/*
-						 * The current block is the first block
-						 * in the heap area. We have to make sure
-						 * that the alignment excess is large enough
-						 * to fit a new free block just before the
-						 * current block.
-						 */
-						while (excess < STRUCT_OVERHEAD) {
-							aligned += falign;
-							excess += falign;
-						}
-
-						/* Check for current block size again */
-						if (cur->size >= real_size + excess) {
-							size_t reduced_size = cur->size - excess;
-							cur = (heap_block_head_t *)
-							    (AREA_FIRST_BLOCK_HEAD(area) + excess);
-
-							block_init((void *) AREA_FIRST_BLOCK_HEAD(area),
-							    excess, true, area);
-							block_init(cur, reduced_size, true, area);
-							split_mark(cur, real_size);
-
-							next_fit = cur;
-							return aligned;
-						}
-					}
-				}
-			}
-		}
-	}
-
-	return NULL;
-}
-
-/** Try to enlarge any of the heap areas.
- *
- * If successful, allocate block of the given size in the area.
- * Should be called only inside the critical section.
- *
- * @param size  Gross size of item to allocate (bytes).
- * @param align Memory address alignment.
- *
- * @return Allocated block.
- * @return NULL on failure.
- *
- */
-static void *heap_grow_and_alloc(size_t size, size_t align)
-{
-	if (size == 0)
-		return NULL;
-
-	/* First try to enlarge some existing area */
-	for (heap_area_t *area = first_heap_area; area != NULL;
-	    area = area->next) {
-
-		if (area_grow(area, size + align)) {
-			heap_block_head_t *first =
-			    (heap_block_head_t *) AREA_LAST_BLOCK_HEAD(area);
-
-			void *addr =
-			    malloc_area(area, first, NULL, size, align);
-			malloc_assert(addr != NULL);
-			return addr;
-		}
-	}
-
-	/* Eventually try to create a new area */
-	if (area_create(AREA_OVERHEAD(size + align))) {
-		heap_block_head_t *first =
-		    (heap_block_head_t *) AREA_FIRST_BLOCK_HEAD(last_heap_area);
-
-		void *addr =
-		    malloc_area(last_heap_area, first, NULL, size, align);
-		malloc_assert(addr != NULL);
-		return addr;
-	}
-
-	return NULL;
-}
-
-/** Allocate a memory block
- *
- * Should be called only inside the critical section.
- *
- * @param size  The size of the block to allocate.
- * @param align Memory address alignment.
- *
- * @return Address of the allocated block or NULL on not enough memory.
- *
- */
-static void *malloc_internal(size_t size, size_t align)
-{
-	malloc_assert(first_heap_area != NULL);
-
-	if (size == 0)
-		size = 1;
-
-	if (align == 0)
-		align = BASE_ALIGN;
-
-	size_t falign = lcm(align, BASE_ALIGN);
-
-	/* Check for integer overflow. */
-	if (falign < align)
-		return NULL;
-
-	/*
-	 * The size of the allocated block needs to be naturally
-	 * aligned, because the footer structure also needs to reside
-	 * on a naturally aligned address in order to avoid unaligned
-	 * memory accesses.
-	 */
-	size_t gross_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN));
-
-	/* Try the next fit approach */
-	heap_block_head_t *split = next_fit;
-
-	if (split != NULL) {
-		void *addr = malloc_area(split->area, split, NULL, gross_size,
-		    falign);
-
-		if (addr != NULL)
-			return addr;
-	}
-
-	/* Search the entire heap */
-	for (heap_area_t *area = first_heap_area; area != NULL;
-	    area = area->next) {
-		heap_block_head_t *first = (heap_block_head_t *)
-		    AREA_FIRST_BLOCK_HEAD(area);
-
-		void *addr = malloc_area(area, first, split, gross_size,
-		    falign);
-
-		if (addr != NULL)
-			return addr;
-	}
-
-	/* Finally, try to grow heap space and allocate in the new area. */
-	return heap_grow_and_alloc(gross_size, falign);
-}
-
-/** Allocate memory
- *
- * @param size Number of bytes to allocate.
- *
- * @return Allocated memory or NULL.
- *
- */
-void *malloc(const size_t size)
-{
-	heap_lock();
-	void *block = malloc_internal(size, BASE_ALIGN);
-	heap_unlock();
-
-	return block;
-}
-
-/** Allocate memory with specified alignment
- *
- * @param align Alignment in byes.
- * @param size  Number of bytes to allocate.
- *
- * @return Allocated memory or NULL.
- *
- */
-void *memalign(const size_t align, const size_t size)
-{
-	if (align == 0)
-		return NULL;
-
-	size_t palign =
-	    1 << (fnzb(max(sizeof(void *), align) - 1) + 1);
-
-	heap_lock();
-	void *block = malloc_internal(size, palign);
-	heap_unlock();
-
-	return block;
-}
-
-/** Reallocate memory block
- *
- * @param addr Already allocated memory or NULL.
- * @param size New size of the memory block.
- *
- * @return Reallocated memory or NULL.
- *
- */
-void *realloc(void *const addr, size_t size)
-{
-	if (size == 0) {
-		fprintf(stderr, "realloc() called with size 0\n");
-		size = 1;
-	}
-
-	if (addr == NULL)
-		return malloc(size);
-
-	heap_lock();
-
-	/* Calculate the position of the header. */
-	heap_block_head_t *head =
-	    (heap_block_head_t *) (addr - sizeof(heap_block_head_t));
-
-	block_check(head);
-	malloc_assert(!head->free);
-
-	heap_area_t *area = head->area;
-
-	area_check(area);
-	malloc_assert((void *) head >= (void *) AREA_FIRST_BLOCK_HEAD(area));
-	malloc_assert((void *) head < area->end);
-
-	void *ptr = NULL;
-	bool reloc = false;
-	size_t real_size = GROSS_SIZE(ALIGN_UP(size, BASE_ALIGN));
-	size_t orig_size = head->size;
-
-	if (orig_size > real_size) {
-		/* Shrink */
-		if (orig_size - real_size >= STRUCT_OVERHEAD) {
-			/*
-			 * Split the original block to a full block
-			 * and a trailing free block.
-			 */
-			block_init((void *) head, real_size, false, area);
-			block_init((void *) head + real_size,
-			    orig_size - real_size, true, area);
-			heap_shrink(area);
-		}
-
-		ptr = ((void *) head) + sizeof(heap_block_head_t);
-	} else {
-		heap_block_head_t *next_head =
-		    (heap_block_head_t *) (((void *) head) + head->size);
-		bool have_next = ((void *) next_head < area->end);
-
-		if (((void *) head) + real_size > area->end) {
-			/*
-			 * The current area is too small to hold the resized
-			 * block. Make sure there are no used blocks standing
-			 * in our way and try to grow the area using real_size
-			 * as a safe upper bound.
-			 */
-
-			bool have_next_next;
-
-			if (have_next) {
-				have_next_next = (((void *) next_head) +
-				    next_head->size < area->end);
-			}
-			if (!have_next || (next_head->free && !have_next_next)) {
-				/*
-				 * There is no next block in this area or
-				 * it is a free block and there is no used
-				 * block following it. There can't be any
-				 * free block following it either as
-				 * two free blocks would be merged.
-				 */
-				(void) area_grow(area, real_size);
-			}
-		}
-
-		/*
-		 * Look at the next block. If it is free and the size is
-		 * sufficient then merge the two. Otherwise just allocate a new
-		 * block, copy the original data into it and free the original
-		 * block.
-		 */
-
-		if (have_next && (head->size + next_head->size >= real_size) &&
-		    next_head->free) {
-			block_check(next_head);
-			block_init(head, head->size + next_head->size, false,
-			    area);
-			split_mark(head, real_size);
-
-			ptr = ((void *) head) + sizeof(heap_block_head_t);
-			next_fit = NULL;
-		} else {
-			reloc = true;
-		}
-	}
-
-	heap_unlock();
-
-	if (reloc) {
-		ptr = malloc(size);
-		if (ptr != NULL) {
-			memcpy(ptr, addr, NET_SIZE(orig_size));
-			free(addr);
-		}
-	}
-
-	return ptr;
-}
-
-/** Reallocate memory for an array
- *
- * Same as realloc(ptr, nelem * elsize), except the multiplication is checked
- * for numerical overflow. Borrowed from POSIX 2024.
- *
- * @param ptr
- * @param nelem
- * @param elsize
- *
- * @return Reallocated memory or NULL.
- */
-void *reallocarray(void *ptr, size_t nelem, size_t elsize)
-{
-	if (nelem > SIZE_MAX / elsize)
-		return NULL;
-
-	return realloc(ptr, nelem * elsize);
-}
-
-/** Free a memory block
- *
- * @param addr The address of the block.
- *
- */
-void free(void *const addr)
-{
-	if (addr == NULL)
-		return;
-
-	heap_lock();
-
-	/* Calculate the position of the header. */
-	heap_block_head_t *head =
-	    (heap_block_head_t *) (addr - sizeof(heap_block_head_t));
-
-	block_check(head);
-	malloc_assert(!head->free);
-
-	heap_area_t *area = head->area;
-
-	area_check(area);
-	malloc_assert((void *) head >= (void *) AREA_FIRST_BLOCK_HEAD(area));
-	malloc_assert((void *) head < area->end);
-
-	/* Mark the block itself as free. */
-	head->free = true;
-
-	/* Look at the next block. If it is free, merge the two. */
-	heap_block_head_t *next_head =
-	    (heap_block_head_t *) (((void *) head) + head->size);
-
-	if ((void *) next_head < area->end) {
-		block_check(next_head);
-		if (next_head->free)
-			block_init(head, head->size + next_head->size, true, area);
-	}
-
-	/* Look at the previous block. If it is free, merge the two. */
-	if ((void *) head > (void *) AREA_FIRST_BLOCK_HEAD(area)) {
-		heap_block_foot_t *prev_foot =
-		    (heap_block_foot_t *) (((void *) head) - sizeof(heap_block_foot_t));
-
-		heap_block_head_t *prev_head =
-		    (heap_block_head_t *) (((void *) head) - prev_foot->size);
-
-		block_check(prev_head);
-
-		if (prev_head->free)
-			block_init(prev_head, prev_head->size + head->size, true,
-			    area);
-	}
-
-	heap_shrink(area);
-
-	heap_unlock();
-}
-
-void *heap_check(void)
-{
-	heap_lock();
-
-	if (first_heap_area == NULL) {
-		heap_unlock();
-		return (void *) -1;
-	}
-
-	/* Walk all heap areas */
-	for (heap_area_t *area = first_heap_area; area != NULL;
-	    area = area->next) {
-
-		/* Check heap area consistency */
-		if ((area->magic != HEAP_AREA_MAGIC) ||
-		    ((void *) area != area->start) ||
-		    (area->start >= area->end) ||
-		    (((uintptr_t) area->start % PAGE_SIZE) != 0) ||
-		    (((uintptr_t) area->end % PAGE_SIZE) != 0)) {
-			heap_unlock();
-			return (void *) area;
-		}
-
-		/* Walk all heap blocks */
-		for (heap_block_head_t *head = (heap_block_head_t *)
-		    AREA_FIRST_BLOCK_HEAD(area); (void *) head < area->end;
-		    head = (heap_block_head_t *) (((void *) head) + head->size)) {
-
-			/* Check heap block consistency */
-			if (head->magic != HEAP_BLOCK_HEAD_MAGIC) {
-				heap_unlock();
-				return (void *) head;
-			}
-
-			heap_block_foot_t *foot = BLOCK_FOOT(head);
-
-			if ((foot->magic != HEAP_BLOCK_FOOT_MAGIC) ||
-			    (head->size != foot->size)) {
-				heap_unlock();
-				return (void *) foot;
-			}
-		}
-	}
-
-	heap_unlock();
-
-	return NULL;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/ns.c
===================================================================
--- uspace/lib/c/generic/ns.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,224 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <ns.h>
-#include <ipc/ns.h>
-#include <async.h>
-#include <macros.h>
-#include <errno.h>
-#include "private/ns.h"
-
-/*
- * XXX ns does not know about session_ns, so we create an extra session for
- * actual communicaton
- */
-static async_sess_t *sess_ns = NULL;
-
-errno_t service_register(service_t service, iface_t iface,
-    async_port_handler_t handler, void *data)
-{
-	errno_t rc;
-	async_sess_t *sess = ns_session_get(&rc);
-	if (sess == NULL)
-		return rc;
-
-	port_id_t port;
-	rc = async_create_port(iface, handler, data, &port);
-	if (rc != EOK)
-		return rc;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, NS_REGISTER, service, iface, &answer);
-	rc = async_connect_to_me(exch, iface, service, 0);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	return rc;
-}
-
-errno_t service_register_broker(service_t service, async_port_handler_t handler,
-    void *data)
-{
-	async_set_fallback_port_handler(handler, data);
-
-	errno_t rc;
-	async_sess_t *sess = ns_session_get(&rc);
-	if (sess == NULL)
-		return rc;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, NS_REGISTER_BROKER, service, &answer);
-	rc = async_connect_to_me(exch, INTERFACE_ANY, service, 0);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	return rc;
-}
-
-/** Connect to a singleton service.
- *
- * @param service Singleton service ID.
- * @param iface   Interface to connect to.
- * @param arg3    Custom connection argument.
- * @param rc      Placeholder for return code. Unused if NULL.
- *
- * @return New session on success or NULL on error.
- *
- */
-async_sess_t *service_connect(service_t service, iface_t iface, sysarg_t arg3,
-    errno_t *rc)
-{
-	async_sess_t *sess = ns_session_get(rc);
-	if (sess == NULL)
-		return NULL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (exch == NULL)
-		return NULL;
-
-	async_sess_t *csess =
-	    async_connect_me_to(exch, iface, service, arg3, rc);
-	async_exchange_end(exch);
-
-	if (csess == NULL)
-		return NULL;
-
-	/*
-	 * FIXME Ugly hack to work around limitation of implementing
-	 * parallel exchanges using multiple connections. Shift out
-	 * first argument for non-initial connections.
-	 */
-	async_sess_args_set(csess, iface, arg3, 0);
-
-	return csess;
-}
-
-/** Wait and connect to a singleton service.
- *
- * @param service Singleton service ID.
- * @param iface   Interface to connect to.
- * @param arg3    Custom connection argument.
- * @param rc      Placeholder for return code. Unused if NULL.
- *
- * @return New session on success or NULL on error.
- *
- */
-async_sess_t *service_connect_blocking(service_t service, iface_t iface,
-    sysarg_t arg3, errno_t *rc)
-{
-	async_sess_t *sess = ns_session_get(rc);
-	if (sess == NULL)
-		return NULL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_sess_t *csess =
-	    async_connect_me_to_blocking(exch, iface, service, arg3, rc);
-	async_exchange_end(exch);
-
-	if (csess == NULL)
-		return NULL;
-
-	/*
-	 * FIXME Ugly hack to work around limitation of implementing
-	 * parallel exchanges using multiple connections. Shift out
-	 * first argument for non-initial connections.
-	 */
-	async_sess_args_set(csess, iface, arg3, 0);
-
-	return csess;
-}
-
-errno_t ns_ping(void)
-{
-	errno_t rc;
-	async_sess_t *sess = ns_session_get(&rc);
-	if (sess == NULL)
-		return rc;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	rc = async_req_0_0(exch, NS_PING);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t ns_intro(task_id_t id)
-{
-	errno_t rc;
-	async_sess_t *sess = ns_session_get(&rc);
-	if (sess == NULL)
-		return EIO;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	rc = async_req_2_0(exch, NS_ID_INTRO, LOWER32(id), UPPER32(id));
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-async_sess_t *ns_session_get(errno_t *rc)
-{
-	async_exch_t *exch;
-
-	if (sess_ns == NULL) {
-		exch = async_exchange_begin(&session_ns);
-		sess_ns = async_connect_me_to(exch, 0, 0, 0, rc);
-		async_exchange_end(exch);
-		if (sess_ns == NULL)
-			return NULL;
-	}
-
-	return sess_ns;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/pcb.c
===================================================================
--- uspace/lib/c/generic/pcb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <loader/pcb.h>
-
-pcb_t *__pcb;
-
-/** @}
- */
Index: pace/lib/c/generic/perm.c
===================================================================
--- uspace/lib/c/generic/perm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file  perm.c
- * @brief Functions to grant/revoke permissions to/from a task.
- */
-
-#include <perm.h>
-#include <task.h>
-#include <libc.h>
-#include <types/common.h>
-
-/** Grant permissions to a task.
- *
- * @param id    Destination task ID.
- * @param perms Permissions to grant.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t perm_grant(task_id_t id, unsigned int perms)
-{
-#ifdef __32_BITS__
-	sysarg64_t arg = (sysarg64_t) id;
-	return (errno_t) __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) &arg, (sysarg_t) perms);
-#endif
-
-#ifdef __64_BITS__
-	return (errno_t) __SYSCALL2(SYS_PERM_GRANT, (sysarg_t) id, (sysarg_t) perms);
-#endif
-}
-
-/** Revoke permissions from a task.
- *
- * @param id    Destination task ID.
- * @param perms Permissions to revoke.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
- *
- */
-errno_t perm_revoke(task_id_t id, unsigned int perms)
-{
-#ifdef __32_BITS__
-	sysarg64_t arg = (sysarg64_t) id;
-	return (errno_t) __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) &arg, (sysarg_t) perms);
-#endif
-
-#ifdef __64_BITS__
-	return (errno_t) __SYSCALL2(SYS_PERM_REVOKE, (sysarg_t) id, (sysarg_t) perms);
-#endif
-}
-
-/** @}
- */
Index: pace/lib/c/generic/pio_trace.c
===================================================================
--- uspace/lib/c/generic/pio_trace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <adt/list.h>
-#include <fibril_synch.h>
-#include <ddi.h>
-#include <str.h>
-
-typedef struct {
-	link_t link;
-	volatile void *base;
-	size_t size;
-	void *data;
-	trace_fnc log;
-} region_t;
-
-static inline region_t *region_instance(link_t *l)
-{
-	return list_get_instance(l, region_t, link);
-}
-
-static inline region_t *region_create(volatile void *base, size_t size,
-    trace_fnc log, void *data)
-{
-	region_t *new_reg = malloc(sizeof(region_t));
-	if (new_reg) {
-		link_initialize(&new_reg->link);
-		new_reg->base = base;
-		new_reg->data = data;
-		new_reg->size = size;
-		new_reg->log = log;
-	}
-	return new_reg;
-}
-
-static inline void region_destroy(region_t *r)
-{
-	free(r);
-}
-
-typedef struct {
-	list_t list;
-	fibril_rwlock_t guard;
-} pio_regions_t;
-
-static pio_regions_t *get_regions(void)
-{
-	static pio_regions_t regions = {
-		.list = LIST_INITIALIZER(regions.list),
-		.guard = FIBRIL_RWLOCK_INITIALIZER(regions.guard),
-	};
-	return &regions;
-}
-
-void pio_trace_log(const volatile void *r, uint64_t val, bool write)
-{
-	pio_regions_t *regions = get_regions();
-	fibril_rwlock_read_lock(&regions->guard);
-	list_foreach(regions->list, link, region_t, reg) {
-		if ((r >= reg->base) && (r < reg->base + reg->size)) {
-			if (reg->log)
-				reg->log(r, val, reg->base,
-				    reg->size, reg->data, write);
-			break;
-		}
-	}
-	fibril_rwlock_read_unlock(&regions->guard);
-}
-
-errno_t pio_trace_enable(void *base, size_t size, trace_fnc log, void *data)
-{
-	pio_regions_t *regions = get_regions();
-	assert(regions);
-
-	region_t *region = region_create(base, size, log, data);
-	if (!region)
-		return ENOMEM;
-
-	fibril_rwlock_write_lock(&regions->guard);
-	list_append(&region->link, &regions->list);
-	fibril_rwlock_write_unlock(&regions->guard);
-	return EOK;
-}
-
-void pio_trace_disable(void *r)
-{
-	pio_regions_t *regions = get_regions();
-	assert(regions);
-
-	fibril_rwlock_write_lock(&regions->guard);
-	list_foreach_safe(regions->list, it, next) {
-		region_t *reg = region_instance(it);
-		if (r >= reg->base && (r < reg->base + reg->size)) {
-			list_remove(&reg->link);
-			region_destroy(reg);
-		}
-	}
-	fibril_rwlock_write_unlock(&regions->guard);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/power_of_ten.c
===================================================================
--- uspace/lib/c/generic/power_of_ten.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "private/power_of_ten.h"
-
-#include <ieee_double.h>
-#include <assert.h>
-
-/** Precomputed normalized rounded-up powers of 10^k.
- *
- * The powers were computed using arbitrary precision arithmetic
- * and rounded up to the top 64 significant bits. Therefore:
- *   10^dec_exp == significand * 2^bin_exp  +/- 0.5 ulp error
- *
- * The smallest interval of binary exponents computed by hand
- * is [-1083, 987]. Add 200 (exponent change > 3 * 64 bits)
- * to both bounds just to be on the safe side; ie [-1283, 1187].
- */
-static struct {
-	uint64_t significand;
-	int16_t bin_exp;
-	int16_t dec_exp;
-} fp_powers_of_10[] = {
-	{ 0xb8e1cbc28bef0b69ULL, -1286, -368 },
-	{ 0x89bf722840327f82ULL, -1259, -360 },
-	{ 0xcd42a11346f34f7dULL, -1233, -352 },
-	{ 0x98ee4a22ecf3188cULL, -1206, -344 },
-	{ 0xe3e27a444d8d98b8ULL, -1180, -336 },
-	{ 0xa9c98d8ccb009506ULL, -1153, -328 },
-	{ 0xfd00b897478238d1ULL, -1127, -320 },
-	{ 0xbc807527ed3e12bdULL, -1100, -312 },
-	{ 0x8c71dcd9ba0b4926ULL, -1073, -304 },
-	{ 0xd1476e2c07286faaULL, -1047, -296 },
-	{ 0x9becce62836ac577ULL, -1020, -288 },
-	{ 0xe858ad248f5c22caULL, -994, -280 },
-	{ 0xad1c8eab5ee43b67ULL, -967, -272 },
-	{ 0x80fa687f881c7f8eULL, -940, -264 },
-	{ 0xc0314325637a193aULL, -914, -256 },
-	{ 0x8f31cc0937ae58d3ULL, -887, -248 },
-	{ 0xd5605fcdcf32e1d7ULL, -861, -240 },
-	{ 0x9efa548d26e5a6e2ULL, -834, -232 },
-	{ 0xece53cec4a314ebeULL, -808, -224 },
-	{ 0xb080392cc4349dedULL, -781, -216 },
-	{ 0x8380dea93da4bc60ULL, -754, -208 },
-	{ 0xc3f490aa77bd60fdULL, -728, -200 },
-	{ 0x91ff83775423cc06ULL, -701, -192 },
-	{ 0xd98ddaee19068c76ULL, -675, -184 },
-	{ 0xa21727db38cb0030ULL, -648, -176 },
-	{ 0xf18899b1bc3f8ca2ULL, -622, -168 },
-	{ 0xb3f4e093db73a093ULL, -595, -160 },
-	{ 0x8613fd0145877586ULL, -568, -152 },
-	{ 0xc7caba6e7c5382c9ULL, -542, -144 },
-	{ 0x94db483840b717f0ULL, -515, -136 },
-	{ 0xddd0467c64bce4a1ULL, -489, -128 },
-	{ 0xa54394fe1eedb8ffULL, -462, -120 },
-	{ 0xf64335bcf065d37dULL, -436, -112 },
-	{ 0xb77ada0617e3bbcbULL, -409, -104 },
-	{ 0x88b402f7fd75539bULL, -382, -96 },
-	{ 0xcbb41ef979346bcaULL, -356, -88 },
-	{ 0x97c560ba6b0919a6ULL, -329, -80 },
-	{ 0xe2280b6c20dd5232ULL, -303, -72 },
-	{ 0xa87fea27a539e9a5ULL, -276, -64 },
-	{ 0xfb158592be068d2fULL, -250, -56 },
-	{ 0xbb127c53b17ec159ULL, -223, -48 },
-	{ 0x8b61313bbabce2c6ULL, -196, -40 },
-	{ 0xcfb11ead453994baULL, -170, -32 },
-	{ 0x9abe14cd44753b53ULL, -143, -24 },
-	{ 0xe69594bec44de15bULL, -117, -16 },
-	{ 0xabcc77118461cefdULL, -90, -8 },
-	{ 0x8000000000000000ULL, -63, 0 },
-	{ 0xbebc200000000000ULL, -37, 8 },
-	{ 0x8e1bc9bf04000000ULL, -10, 16 },
-	{ 0xd3c21bcecceda100ULL, 16, 24 },
-	{ 0x9dc5ada82b70b59eULL, 43, 32 },
-	{ 0xeb194f8e1ae525fdULL, 69, 40 },
-	{ 0xaf298d050e4395d7ULL, 96, 48 },
-	{ 0x82818f1281ed44a0ULL, 123, 56 },
-	{ 0xc2781f49ffcfa6d5ULL, 149, 64 },
-	{ 0x90e40fbeea1d3a4bULL, 176, 72 },
-	{ 0xd7e77a8f87daf7fcULL, 202, 80 },
-	{ 0xa0dc75f1778e39d6ULL, 229, 88 },
-	{ 0xefb3ab16c59b14a3ULL, 255, 96 },
-	{ 0xb2977ee300c50fe7ULL, 282, 104 },
-	{ 0x850fadc09923329eULL, 309, 112 },
-	{ 0xc646d63501a1511eULL, 335, 120 },
-	{ 0x93ba47c980e98ce0ULL, 362, 128 },
-	{ 0xdc21a1171d42645dULL, 388, 136 },
-	{ 0xa402b9c5a8d3a6e7ULL, 415, 144 },
-	{ 0xf46518c2ef5b8cd1ULL, 441, 152 },
-	{ 0xb616a12b7fe617aaULL, 468, 160 },
-	{ 0x87aa9aff79042287ULL, 495, 168 },
-	{ 0xca28a291859bbf93ULL, 521, 176 },
-	{ 0x969eb7c47859e744ULL, 548, 184 },
-	{ 0xe070f78d3927556bULL, 574, 192 },
-	{ 0xa738c6bebb12d16dULL, 601, 200 },
-	{ 0xf92e0c3537826146ULL, 627, 208 },
-	{ 0xb9a74a0637ce2ee1ULL, 654, 216 },
-	{ 0x8a5296ffe33cc930ULL, 681, 224 },
-	{ 0xce1de40642e3f4b9ULL, 707, 232 },
-	{ 0x9991a6f3d6bf1766ULL, 734, 240 },
-	{ 0xe4d5e82392a40515ULL, 760, 248 },
-	{ 0xaa7eebfb9df9de8eULL, 787, 256 },
-	{ 0xfe0efb53d30dd4d8ULL, 813, 264 },
-	{ 0xbd49d14aa79dbc82ULL, 840, 272 },
-	{ 0x8d07e33455637eb3ULL, 867, 280 },
-	{ 0xd226fc195c6a2f8cULL, 893, 288 },
-	{ 0x9c935e00d4b9d8d2ULL, 920, 296 },
-	{ 0xe950df20247c83fdULL, 946, 304 },
-	{ 0xadd57a27d29339f6ULL, 973, 312 },
-	{ 0x81842f29f2cce376ULL, 1000, 320 },
-	{ 0xc0fe908895cf3b44ULL, 1026, 328 },
-	{ 0x8fcac257558ee4e6ULL, 1053, 336 },
-	{ 0xd6444e39c3db9b0aULL, 1079, 344 },
-	{ 0x9fa42700db900ad2ULL, 1106, 352 },
-	{ 0xede24ae798ec8284ULL, 1132, 360 },
-	{ 0xb13cc3832ef0c9acULL, 1159, 368 },
-	{ 0x840d57e2899d945fULL, 1186, 376 }
-};
-
-/**
- * Returns the smallest precomputed power of 10 such that
- *  binary_exp <= power_of_10.bin_exp
- * where
- *  10^decimal_exp = power_of_10.significand * 2^bin_exp
- * with an error of 0.5 ulp in the significand.
- */
-void get_power_of_ten(int binary_exp, fp_num_t *power_of_10, int *decimal_exp)
-{
-	const int powers_count = sizeof(fp_powers_of_10) / sizeof(fp_powers_of_10[0]);
-	const int min_bin_exp = fp_powers_of_10[0].bin_exp;
-	const int max_bin_exp = fp_powers_of_10[powers_count - 1].bin_exp;
-	const int max_bin_exp_diff = 27;
-
-	assert(min_bin_exp <= binary_exp && binary_exp <= max_bin_exp);
-
-	/*
-	 * Binary exponent difference between adjacent powers of 10
-	 * is lg(10^8) = 26.575. The starting search index seed_idx
-	 * undershoots the actual position by less than 1.6%, ie it
-	 * skips 26.575/27 = 98.4% of all the smaller powers. This
-	 * translates to at most three extra tests.
-	 */
-	int seed_idx = (binary_exp - min_bin_exp) / max_bin_exp_diff;
-
-	assert(fp_powers_of_10[seed_idx].bin_exp < binary_exp);
-
-	for (int i = seed_idx; i < powers_count; ++i) {
-		/* Found the smallest power of 10 with bin_exp >= binary_exp. */
-		if (binary_exp <= fp_powers_of_10[i].bin_exp) {
-			assert(fp_powers_of_10[i].bin_exp <= binary_exp + max_bin_exp_diff);
-
-			power_of_10->significand = fp_powers_of_10[i].significand;
-			power_of_10->exponent = fp_powers_of_10[i].bin_exp;
-			*decimal_exp = fp_powers_of_10[i].dec_exp;
-			return;
-		}
-	}
-
-	assert(false);
-}
Index: pace/lib/c/generic/private/async.h
===================================================================
--- uspace/lib/c/generic/private/async.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_ASYNC_H_
-#define _LIBC_PRIVATE_ASYNC_H_
-
-#include <async.h>
-#include <adt/list.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <time.h>
-#include <stdbool.h>
-
-/** Session data */
-struct async_sess {
-	/** List of inactive exchanges */
-	list_t exch_list;
-
-	/** Session interface */
-	iface_t iface;
-
-	/** Exchange management style */
-	exch_mgmt_t mgmt;
-
-	/** Session identification */
-	cap_phone_handle_t phone;
-
-	/** First clone connection argument */
-	iface_t arg1;
-
-	/** Second clone connection argument */
-	sysarg_t arg2;
-
-	/** Third clone connection argument */
-	sysarg_t arg3;
-
-	/** Exchange mutex */
-	fibril_mutex_t mutex;
-
-	/** Number of opened exchanges */
-	int exchanges;
-
-	/** Mutex for stateful connections */
-	fibril_mutex_t remote_state_mtx;
-
-	/** Data for stateful connections */
-	void *remote_state_data;
-};
-
-/** Exchange data */
-struct async_exch {
-	/** Link into list of inactive exchanges */
-	link_t sess_link;
-
-	/** Link into global list of inactive exchanges */
-	link_t global_link;
-
-	/** Session pointer */
-	async_sess_t *sess;
-
-	/** Exchange identification */
-	cap_phone_handle_t phone;
-};
-
-extern void __async_server_init(void);
-extern void __async_server_fini(void);
-extern void __async_client_init(void);
-extern void __async_client_fini(void);
-extern void __async_ports_init(void);
-extern void __async_ports_fini(void);
-
-extern errno_t async_create_port_internal(iface_t, async_port_handler_t,
-    void *, port_id_t *);
-extern async_port_handler_t async_get_port_handler(iface_t, port_id_t, void **);
-
-extern void async_reply_received(ipc_call_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/cc.h
===================================================================
--- uspace/lib/c/generic/private/cc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * Macros related to used compiler (such as GCC-specific attributes).
- */
-
-#ifndef _LIBC_CC_H_
-#define _LIBC_CC_H_
-
-#ifndef __clang__
-#define ATTRIBUTE_OPTIMIZE(opt) \
-    __attribute__ ((optimize(opt)))
-#else
-#define ATTRIBUTE_OPTIMIZE(opt)
-#endif
-
-#define ATTRIBUTE_OPTIMIZE_NO_TLDP \
-    ATTRIBUTE_OPTIMIZE("-fno-tree-loop-distribute-patterns")
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/fibril.h
===================================================================
--- uspace/lib/c/generic/private/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_PRIVATE_FIBRIL_H_
-#define _LIBC_PRIVATE_FIBRIL_H_
-
-#include <adt/list.h>
-#include <context.h>
-#include <tls.h>
-#include <fibril.h>
-#include <ipc/common.h>
-
-#include "./futex.h"
-
-typedef struct {
-	fibril_t *fibril;
-} fibril_event_t;
-
-#define FIBRIL_EVENT_INIT ((fibril_event_t) {0})
-
-struct fibril {
-	// XXX: The first two fields must not move (for taskdump).
-	link_t all_link;
-	context_t ctx;
-
-	link_t link;
-	void *stack;
-	size_t stack_size;
-	void *arg;
-	errno_t (*func)(void *);
-	tcb_t *tcb;
-
-	fibril_t *clean_after_me;
-	errno_t retval;
-
-	fibril_t *thread_ctx;
-
-	bool is_running : 1;
-	bool is_writer : 1;
-	/* In some places, we use fibril structs that can't be freed. */
-	bool is_freeable : 1;
-
-	/* Debugging stuff. */
-	int rmutex_locks;
-	fibril_owner_info_t *waits_for;
-	fibril_event_t *sleep_event;
-};
-
-extern fibril_t *fibril_alloc(void);
-extern void fibril_setup(fibril_t *);
-extern void fibril_teardown(fibril_t *f);
-extern fibril_t *fibril_self(void);
-
-extern void __fibrils_init(void);
-extern void __fibrils_fini(void);
-
-extern void fibril_wait_for(fibril_event_t *);
-extern errno_t fibril_wait_timeout(fibril_event_t *, const struct timespec *);
-extern void fibril_notify(fibril_event_t *);
-
-extern errno_t fibril_ipc_wait(ipc_call_t *, const struct timespec *);
-extern void fibril_ipc_poke(void);
-
-/**
- * "Restricted" fibril mutex.
- *
- * Similar to `fibril_mutex_t`, but has a set of restrictions placed on its
- * use. Within a rmutex critical section, you
- *         - may not use any other synchronization primitive,
- *           save for another `fibril_rmutex_t`. This includes nonblocking
- *           operations like cvar signal and mutex unlock, unless otherwise
- *           specified.
- *         - may not read IPC messages
- *         - may not start a new thread/fibril
- *           (creating fibril without starting is fine)
- *
- * Additionally, locking with a timeout is not possible on this mutex,
- * and there is no associated condition variable type.
- * This is a design constraint, not a lack of implementation effort.
- */
-typedef struct {
-	// TODO: At this point, this is just silly handwaving to hide current
-	//       futex use behind a fibril based abstraction. Later, the imple-
-	//       mentation will change, but the restrictions placed on this type
-	//       will allow it to be simpler and faster than a regular mutex.
-	//       There might also be optional debug checking of the assumptions.
-	//
-	//       Note that a consequence of the restrictions is that if we are
-	//       running on a single thread, no other fibril can ever get to run
-	//       while a fibril has a rmutex locked. That means that for
-	//       single-threaded programs, we can reduce all rmutex locks and
-	//       unlocks to simple branches on a global bool variable.
-
-	futex_t futex;
-} fibril_rmutex_t;
-
-extern errno_t fibril_rmutex_initialize(fibril_rmutex_t *);
-extern void fibril_rmutex_destroy(fibril_rmutex_t *);
-extern void fibril_rmutex_lock(fibril_rmutex_t *);
-extern bool fibril_rmutex_trylock(fibril_rmutex_t *);
-extern void fibril_rmutex_unlock(fibril_rmutex_t *);
-
-#endif
Index: pace/lib/c/generic/private/futex.h
===================================================================
--- uspace/lib/c/generic/private/futex.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_FUTEX_H_
-#define _LIBC_FUTEX_H_
-
-#include <assert.h>
-#include <stdatomic.h>
-#include <errno.h>
-#include <libc.h>
-#include <time.h>
-#include <fibril.h>
-#include <abi/cap.h>
-#include <abi/synch.h>
-
-typedef struct futex {
-	volatile atomic_int val;
-	volatile cap_waitq_handle_t whandle;
-
-#ifdef CONFIG_DEBUG_FUTEX
-	_Atomic(fibril_t *) owner;
-#endif
-} futex_t;
-
-extern errno_t futex_initialize(futex_t *futex, int value);
-
-static inline errno_t futex_destroy(futex_t *futex)
-{
-	if (futex->whandle) {
-		errno_t rc;
-		rc = __SYSCALL1(SYS_WAITQ_DESTROY, (sysarg_t) futex->whandle);
-		futex->whandle = CAP_NIL;
-		return rc;
-	}
-	return EOK;
-}
-
-#ifdef CONFIG_DEBUG_FUTEX
-
-void __futex_assert_is_locked(futex_t *, const char *);
-void __futex_assert_is_not_locked(futex_t *, const char *);
-void __futex_lock(futex_t *, const char *);
-void __futex_unlock(futex_t *, const char *);
-bool __futex_trylock(futex_t *, const char *);
-void __futex_give_to(futex_t *, void *, const char *);
-
-#define futex_lock(futex) __futex_lock((futex), #futex)
-#define futex_unlock(futex) __futex_unlock((futex), #futex)
-#define futex_trylock(futex) __futex_trylock((futex), #futex)
-
-#define futex_give_to(futex, new_owner) __futex_give_to((futex), (new_owner), #futex)
-#define futex_assert_is_locked(futex) __futex_assert_is_locked((futex), #futex)
-#define futex_assert_is_not_locked(futex) __futex_assert_is_not_locked((futex), #futex)
-
-#else
-
-#define futex_lock(fut)     (void) futex_down((fut))
-#define futex_trylock(fut)  futex_trydown((fut))
-#define futex_unlock(fut)   (void) futex_up((fut))
-
-#define futex_give_to(fut, owner) ((void)0)
-#define futex_assert_is_locked(fut) assert(atomic_load_explicit(&(fut)->val, memory_order_relaxed) <= 0)
-#define futex_assert_is_not_locked(fut) ((void)0)
-
-#endif
-
-static inline errno_t futex_allocate_waitq(futex_t *futex)
-{
-	return __SYSCALL1(SYS_WAITQ_CREATE, (sysarg_t) &futex->whandle);
-}
-
-/** Down the futex with timeout, composably.
- *
- * This means that when the operation fails due to a timeout or being
- * interrupted, the next futex_up() is ignored, which allows certain kinds of
- * composition of synchronization primitives.
- *
- * In most other circumstances, regular futex_down_timeout() is a better choice.
- *
- * @param futex Futex.
- *
- * @return ENOENT if there is no such virtual address.
- * @return ETIMEOUT if timeout expires.
- * @return EOK on success.
- * @return Error code from <errno.h> otherwise.
- *
- */
-static inline errno_t futex_down_composable(futex_t *futex,
-    const struct timespec *expires)
-{
-	// TODO: Add tests for this.
-
-	assert(futex->whandle != CAP_NIL);
-
-	if (atomic_fetch_sub_explicit(&futex->val, 1, memory_order_acquire) > 0)
-		return EOK;
-
-	/* There wasn't any token. We must defer to the underlying semaphore. */
-
-	usec_t timeout;
-
-	if (!expires) {
-		/* No timeout. */
-		timeout = 0;
-	} else {
-		if (expires->tv_sec == 0) {
-			/* We can't just return ETIMEOUT. That wouldn't be composable. */
-			timeout = 1;
-		} else {
-			struct timespec tv;
-			getuptime(&tv);
-			timeout = ts_gteq(&tv, expires) ? 1 :
-			    NSEC2USEC(ts_sub_diff(expires, &tv));
-		}
-
-		assert(timeout > 0);
-	}
-
-	return __SYSCALL3(SYS_WAITQ_SLEEP, (sysarg_t) futex->whandle,
-	    (sysarg_t) timeout, (sysarg_t) SYNCH_FLAGS_FUTEX);
-}
-
-/** Up the futex.
- *
- * @param futex Futex.
- *
- * @return ENOENT if there is no such virtual address.
- * @return EOK on success.
- * @return Error code from <errno.h> otherwise.
- *
- */
-static inline errno_t futex_up(futex_t *futex)
-{
-	if (atomic_fetch_add_explicit(&futex->val, 1, memory_order_release) < 0)
-		return __SYSCALL1(SYS_WAITQ_WAKEUP, (sysarg_t) futex->whandle);
-
-	return EOK;
-}
-
-static inline errno_t futex_down_timeout(futex_t *futex,
-    const struct timespec *expires)
-{
-	/*
-	 * This combination of a "composable" sleep followed by futex_up() on
-	 * failure is necessary to prevent breakage due to certain race
-	 * conditions.
-	 */
-	errno_t rc = futex_down_composable(futex, expires);
-	if (rc != EOK)
-		futex_up(futex);
-	return rc;
-}
-
-/** Try to down the futex.
- *
- * @param futex Futex.
- *
- * @return true if the futex was acquired.
- * @return false if the futex was not acquired.
- *
- */
-static inline bool futex_trydown(futex_t *futex)
-{
-	/*
-	 * We can't just use CAS here.
-	 * If we don't succeed with CAS, we can't return failure
-	 * because that would lead to spurious failures where
-	 * futex_down_timeout returns ETIMEOUT despite there being
-	 * available tokens. That would break some algorithms.
-	 * We also don't want to loop on CAS indefinitely, because
-	 * that would make the semaphore not wait-free, even when all
-	 * atomic operations and the underlying base semaphore are all
-	 * wait-free.
-	 * It's much less trouble (and code bloat) to just do regular
-	 * down_timeout(), with an already expired deadline.
-	 */
-	struct timespec tv = { .tv_sec = 0, .tv_nsec = 0 };
-	return futex_down_timeout(futex, &tv) == EOK;
-}
-
-/** Down the futex.
- *
- * @param futex Futex.
- *
- * @return ENOENT if there is no such virtual address.
- * @return EOK on success.
- * @return Error code from <errno.h> otherwise.
- *
- */
-static inline errno_t futex_down(futex_t *futex)
-{
-	return futex_down_timeout(futex, NULL);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/io.h
===================================================================
--- uspace/lib/c/generic/private/io.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_IO_H_
-#define _LIBC_PRIVATE_IO_H_
-
-#include <loader/pcb.h>
-
-extern void __stdio_init(void);
-extern void __stdio_done(void);
-
-extern void __inbox_init(struct pcb_inbox_entry *entries, int count);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/libc.h
===================================================================
--- uspace/lib/c/generic/private/libc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_LIBC_H_
-#define _LIBC_PRIVATE_LIBC_H_
-
-#include <types/common.h>
-
-/* Type of the main C function. */
-typedef int (*main_fn_t)(int, char **);
-
-/**
- * Used for C++ constructors/destructors
- * and the GCC constructor/destructor extension.
- */
-typedef void (*init_array_entry_t)();
-typedef void (*fini_array_entry_t)();
-
-typedef struct {
-	main_fn_t main;
-	const void *elfstart;
-	const void *end;
-	init_array_entry_t *preinit_array;
-	int preinit_array_len;
-	init_array_entry_t *init_array;
-	int init_array_len;
-	fini_array_entry_t *fini_array;
-	int fini_array_len;
-} progsymbols_t;
-
-extern progsymbols_t __progsymbols;
-extern void __libc_main(void *) __attribute__((noreturn));
-extern void __libc_exit(int) __attribute__((noreturn));
-extern void __libc_abort(void) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/loader.h
===================================================================
--- uspace/lib/c/generic/private/loader.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_LOADER_H_
-#define _LIBC_PRIVATE_LOADER_H_
-
-#include <loader/loader.h>
-
-/** Abstraction of a loader connection */
-struct loader {
-	/** Session to the loader. */
-	async_sess_t *sess;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/malloc.h
===================================================================
--- uspace/lib/c/generic/private/malloc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_MALLOC_H_
-#define _LIBC_PRIVATE_MALLOC_H_
-
-extern void __malloc_init(void);
-extern void __malloc_fini(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/ns.h
===================================================================
--- uspace/lib/c/generic/private/ns.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_NS_H_
-#define _LIBC_PRIVATE_NS_H_
-
-#include <async.h>
-
-extern async_sess_t session_ns;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/power_of_ten.h
===================================================================
--- uspace/lib/c/generic/private/power_of_ten.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef POWER_OF_TEN_H_
-#define POWER_OF_TEN_H_
-
-/* Fwd decl. */
-struct fp_num_t_tag;
-
-extern void get_power_of_ten(int, struct fp_num_t_tag *, int *);
-
-#endif
Index: pace/lib/c/generic/private/scanf.h
===================================================================
--- uspace/lib/c/generic/private/scanf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_SCANF_H_
-#define _LIBC_PRIVATE_SCANF_H_
-
-#include <stddef.h>
-#include <stdio.h>
-
-extern errno_t __fstrtold(FILE *, int *, size_t, long double *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/sstream.h
===================================================================
--- uspace/lib/c/generic/private/sstream.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_SSTREAM_H_
-#define _LIBC_PRIVATE_SSTREAM_H_
-
-#include <stdio.h>
-
-extern void __sstream_init(const char *, FILE *);
-extern const char *__sstream_getpos(FILE *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/stdio.h
===================================================================
--- uspace/lib/c/generic/private/stdio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_STDIO_H_
-#define _LIBC_PRIVATE_STDIO_H_
-
-#include <adt/list.h>
-#include <stdio.h>
-#include <async.h>
-#include <stddef.h>
-#include <offset.h>
-
-/** Maximum characters that can be pushed back by ungetc() */
-#define UNGETC_MAX 1
-
-/** Stream operations */
-typedef struct {
-	/** Read from stream */
-	size_t (*read)(void *buf, size_t size, size_t nmemb, FILE *stream);
-	/** Write to stream */
-	size_t (*write)(const void *buf, size_t size, size_t nmemb,
-	    FILE *stream);
-	/** Flush stream */
-	int (*flush)(FILE *stream);
-} __stream_ops_t;
-
-enum __buffer_state {
-	/** Buffer is empty */
-	_bs_empty,
-
-	/** Buffer contains data to be written */
-	_bs_write,
-
-	/** Buffer contains prefetched data for reading */
-	_bs_read
-};
-
-struct _IO_FILE {
-	/** Linked list pointer. */
-	link_t link;
-
-	/** Stream operations */
-	__stream_ops_t *ops;
-
-	/** Underlying file descriptor. */
-	int fd;
-
-	/** Instance argument */
-	void *arg;
-
-	/** File position. */
-	aoff64_t pos;
-
-	/** Error indicator. */
-	int error;
-
-	/** End-of-file indicator. */
-	int eof;
-
-	/** Session to the file provider */
-	async_sess_t *sess;
-
-	/**
-	 * Non-zero if the stream needs sync on fflush(). XXX change
-	 * console semantics so that sync is not needed.
-	 */
-	int need_sync;
-
-	/** Buffering type */
-	enum __buffer_type btype;
-
-	/** Buffer */
-	uint8_t *buf;
-
-	/** Buffer size */
-	size_t buf_size;
-
-	/** Buffer state */
-	enum __buffer_state buf_state;
-
-	/** Buffer I/O pointer */
-	uint8_t *buf_head;
-
-	/** Points to end of occupied space when in read mode. */
-	uint8_t *buf_tail;
-
-	/** Pushed back characters */
-	uint8_t ungetc_buf[UNGETC_MAX];
-
-	/** Number of pushed back characters */
-	int ungetc_chars;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/stdlib.h
===================================================================
--- uspace/lib/c/generic/private/stdlib.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_STDLIB_H_
-#define _LIBC_PRIVATE_STDLIB_H_
-
-#include <adt/list.h>
-
-/** Exit handler list entry */
-typedef struct {
-	/** Link to exit handler list */
-	link_t llist;
-	/** Exit handler function */
-	void (*func)(void);
-} __exit_handler_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/private/thread.h
===================================================================
--- uspace/lib/c/generic/private/thread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRIVATE_THREAD_H_
-#define _LIBC_PRIVATE_THREAD_H_
-
-#include <time.h>
-#include <libarch/thread.h>
-#include <abi/proc/thread.h>
-
-extern void __thread_entry(void);
-
-extern errno_t thread_create(errno_t (*)(void *), void *, const char *);
-extern void thread_exit(int) __attribute__((noreturn));
-extern thread_id_t thread_get_id(void);
-extern void thread_usleep(usec_t);
-extern void thread_sleep(sec_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/rndgen.c
===================================================================
--- uspace/lib/c/generic/rndgen.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Random number generator.
- *
- * Generate random (as opposed to pseudorandom) numbers. This should be
- * used sparingly (e.g. to seed a pseudorandom number generator).
- */
-
-#include <errno.h>
-#include <rndgen.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <time.h>
-
-/** Create random number generator.
- *
- * @param rrndgen Place to store new random number generator
- * @return EOK on success or error code
- */
-errno_t rndgen_create(rndgen_t **rrndgen)
-{
-	rndgen_t *rndgen;
-	struct timespec ts;
-
-	rndgen = calloc(1, sizeof(rndgen_t));
-	if (rndgen == NULL)
-		return ENOMEM;
-
-	/* XXX This is a rather poor way of generating random numbers */
-	getuptime(&ts);
-	rndgen->seed = ts.tv_sec ^ ts.tv_nsec;
-
-	*rrndgen = rndgen;
-	return EOK;
-}
-
-/** Destroy random number generator.
- *
- * @param rndgen Random number generator or @c NULL
- */
-void rndgen_destroy(rndgen_t *rndgen)
-{
-	if (rndgen == NULL)
-		return;
-
-	free(rndgen);
-}
-
-/** Generate random 8-bit integer.
- *
- * @param rndgen Random number generator
- * @param rb Place to store random 8-bit integer
- * @return EOK on success or error code
- */
-errno_t rndgen_uint8(rndgen_t *rndgen, uint8_t *rb)
-{
-	rndgen->seed = (1366 * rndgen->seed + 150889) % 714025;
-
-	*rb = rndgen->seed & 0xff;
-	return EOK;
-}
-
-/** Generate random 16-bit integer.
- *
- * @param rndgen Random number generator
- * @param rw Place to store random 16-bit integer
- * @return EOK on success or error code
- */
-errno_t rndgen_uint16(rndgen_t *rndgen, uint16_t *rw)
-{
-	int i;
-	uint8_t b;
-	uint16_t w;
-	errno_t rc;
-
-	w = 0;
-	for (i = 0; i < 2; i++) {
-		rc = rndgen_uint8(rndgen, &b);
-		if (rc != EOK)
-			return rc;
-
-		w = (w << 8) | b;
-	}
-
-	*rw = w;
-	return EOK;
-}
-
-/** Generate random 32-bit integer.
- *
- * @param rndgen Random number generator
- * @param rw Place to store random 32-bit integer
- * @return EOK on success or error code
- */
-errno_t rndgen_uint32(rndgen_t *rndgen, uint32_t *rw)
-{
-	int i;
-	uint8_t b;
-	uint32_t w;
-	errno_t rc;
-
-	w = 0;
-	for (i = 0; i < 4; i++) {
-		rc = rndgen_uint8(rndgen, &b);
-		if (rc != EOK)
-			return rc;
-
-		w = (w << 8) | b;
-	}
-
-	*rw = w;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/rtld/dynamic.c
===================================================================
--- uspace/lib/c/generic/rtld/dynamic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <inttypes.h>
-#include <str.h>
-
-#include <rtld/elf_dyn.h>
-#include <rtld/dynamic.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-
-void dynamic_parse(elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info)
-{
-	elf_dyn_t *dp = dyn_ptr;
-
-	void *d_ptr;
-	elf_word d_val;
-
-	elf_word soname_idx;
-	elf_word rpath_idx;
-
-	DPRINTF("memset\n");
-	memset(info, 0, sizeof(dyn_info_t));
-
-	soname_idx = 0;
-	rpath_idx = 0;
-
-	DPRINTF("pass 1\n");
-	while (dp->d_tag != DT_NULL) {
-		d_ptr = (void *)((uint8_t *)dp->d_un.d_ptr + bias);
-		d_val = dp->d_un.d_val;
-		DPRINTF("tag=%u ptr=0x%zx val=%zu\n", (unsigned)dp->d_tag,
-		    (uintptr_t)d_ptr, (uintptr_t)d_val);
-
-		switch (dp->d_tag) {
-
-		case DT_PLTRELSZ:
-			info->plt_rel_sz = d_val;
-			break;
-		case DT_PLTGOT:
-			info->plt_got = d_ptr;
-			break;
-		case DT_HASH:
-			info->hash = d_ptr;
-			break;
-		case DT_STRTAB:
-			info->str_tab = d_ptr;
-			break;
-		case DT_SYMTAB:
-			info->sym_tab = d_ptr;
-			break;
-		case DT_RELA:
-			info->rela = d_ptr;
-			break;
-		case DT_RELASZ:
-			info->rela_sz = d_val;
-			break;
-		case DT_RELAENT:
-			info->rela_ent = d_val;
-			break;
-		case DT_STRSZ:
-			info->str_sz = d_val;
-			break;
-		case DT_SYMENT:
-			info->sym_ent = d_val;
-			break;
-		case DT_INIT:
-			info->init = d_ptr;
-			break;
-		case DT_FINI:
-			info->fini = d_ptr;
-			break;
-		case DT_SONAME:
-			soname_idx = d_val;
-			break;
-		case DT_RPATH:
-			rpath_idx = d_val;
-			break;
-		case DT_SYMBOLIC:
-			info->symbolic = true;
-			break;
-		case DT_REL:
-			info->rel = d_ptr;
-			break;
-		case DT_RELSZ:
-			info->rel_sz = d_val;
-			break;
-		case DT_RELENT:
-			info->rel_ent = d_val;
-			break;
-		case DT_PLTREL:
-			info->plt_rel = d_val;
-			break;
-		case DT_TEXTREL:
-			info->text_rel = true;
-			break;
-		case DT_JMPREL:
-			info->jmp_rel = d_ptr;
-			break;
-		case DT_BIND_NOW:
-			info->bind_now = true;
-			break;
-
-		default:
-			if (dp->d_tag >= DT_LOPROC && dp->d_tag <= DT_HIPROC)
-				dyn_parse_arch(dp, bias, info);
-			break;
-		}
-
-		++dp;
-	}
-
-	info->soname = info->str_tab + soname_idx;
-	info->rpath = info->str_tab + rpath_idx;
-
-	/* This will be useful for parsing dependencies later */
-	info->dynamic = dyn_ptr;
-
-	DPRINTF("str_tab=0x%" PRIxPTR ", soname_idx=0x%x, soname=0x%" PRIxPTR "\n",
-	    (uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname);
-	DPRINTF("soname='%s'\n", info->soname);
-	DPRINTF("rpath='%s'\n", info->rpath);
-	DPRINTF("hash=0x%" PRIxPTR "\n", (uintptr_t)info->hash);
-	DPRINTF("dt_rela=0x%" PRIxPTR "\n", (uintptr_t)info->rela);
-	DPRINTF("dt_rela_sz=0x%" PRIxPTR "\n", (uintptr_t)info->rela_sz);
-	DPRINTF("dt_rel=0x%" PRIxPTR "\n", (uintptr_t)info->rel);
-	DPRINTF("dt_rel_sz=0x%" PRIxPTR "\n", (uintptr_t)info->rel_sz);
-
-	/*
-	 * Now that we have a pointer to the string table,
-	 * we can parse DT_NEEDED fields (which contain offsets into it).
-	 */
-
-	DPRINTF("pass 2\n");
-	dp = dyn_ptr;
-	while (dp->d_tag != DT_NULL) {
-		d_val = dp->d_un.d_val;
-
-		switch (dp->d_tag) {
-		case DT_NEEDED:
-			/* Assume just for now there's only one dependency */
-			info->needed = info->str_tab + d_val;
-			DPRINTF("needed:'%s'\n", info->needed);
-			break;
-
-		default:
-			break;
-		}
-
-		++dp;
-	}
-}
-
-/** @}
- */
Index: pace/lib/c/generic/rtld/module.c
===================================================================
--- uspace/lib/c/generic/rtld/module.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,430 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <align.h>
-#include <adt/list.h>
-#include <elf/elf_load.h>
-#include <errno.h>
-#include <loader/pcb.h>
-#include <stdalign.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/dynamic.h>
-#include <rtld/rtld_arch.h>
-#include <rtld/module.h>
-#include <libarch/rtld/module.h>
-
-#include "../private/libc.h"
-
-/** Create the "entrypoint" module, of the program executable
- *
- * @param p_info Program ELF file info
- * @param rtld Run-time dynamic linker
- * @param rmodule Place to store pointer to new module or @c NULL
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t module_create_entrypoint(elf_finfo_t *p_info, rtld_t *rtld, module_t **rmodule)
-{
-	module_t *module;
-	bool is_dynamic = p_info->dynamic != NULL;
-	DPRINTF("module_create_entrypoint\n");
-
-	module = calloc(1, sizeof(module_t));
-	if (module == NULL)
-		return ENOMEM;
-
-	uintptr_t bias = elf_get_bias(p_info->base);
-
-	/*
-	 * First we need to process dynamic sections of the executable
-	 * program and insert it into the module graph.
-	 */
-	if (is_dynamic) {
-		DPRINTF("Parse program .dynamic section at %p\n", p_info->dynamic);
-		dynamic_parse(p_info->dynamic, bias, &module->dyn);
-	} else {
-		DPRINTF("Executable is not dynamically linked\n");
-	}
-
-	module->bias = bias;
-	module->id = rtld_get_next_id(rtld);
-	module->dyn.soname = "[program]";
-
-	module->rtld = rtld;
-	module->exec = true;
-	module->local = !is_dynamic;
-
-	module->tdata = p_info->tls.tdata;
-	module->tdata_size = p_info->tls.tdata_size;
-	module->tbss_size = p_info->tls.tbss_size;
-	module->tls_align = p_info->tls.tls_align;
-
-	DPRINTF("prog tdata at %p size %zu, tbss size %zu\n",
-	    module->tdata, module->tdata_size, module->tbss_size);
-
-	list_append(&module->modules_link, &rtld->modules);
-
-	if (rmodule != NULL)
-		*rmodule = module;
-	return EOK;
-}
-
-/** (Eagerly) process all relocation tables in a module.
- *
- * Currently works as if LD_BIND_NOW was specified.
- */
-void module_process_relocs(module_t *m)
-{
-	DPRINTF("module_process_relocs('%s')\n", m->dyn.soname);
-
-	/* Do not relocate twice. */
-	if (m->relocated)
-		return;
-
-	module_process_pre_arch(m);
-
-	/* jmp_rel table */
-	if (m->dyn.jmp_rel != NULL) {
-		DPRINTF("jmp_rel table\n");
-		if (m->dyn.plt_rel == DT_REL) {
-			DPRINTF("jmp_rel table type DT_REL\n");
-			rel_table_process(m, m->dyn.jmp_rel, m->dyn.plt_rel_sz);
-		} else {
-			assert(m->dyn.plt_rel == DT_RELA);
-			DPRINTF("jmp_rel table type DT_RELA\n");
-			rela_table_process(m, m->dyn.jmp_rel, m->dyn.plt_rel_sz);
-		}
-	}
-
-	/* rel table */
-	if (m->dyn.rel != NULL) {
-		DPRINTF("rel table\n");
-		rel_table_process(m, m->dyn.rel, m->dyn.rel_sz);
-	}
-
-	/* rela table */
-	if (m->dyn.rela != NULL) {
-		DPRINTF("rela table\n");
-		rela_table_process(m, m->dyn.rela, m->dyn.rela_sz);
-	}
-
-	m->relocated = true;
-}
-
-/** Find module structure by soname/pathname.
- *
- * Used primarily to see if a module has already been loaded.
- * Modules are compared according to their soname, i.e. possible
- * path components are ignored.
- */
-module_t *module_find(rtld_t *rtld, const char *name)
-{
-	const char *p, *soname;
-
-	DPRINTF("module_find('%s')\n", name);
-
-	/*
-	 * If name contains slashes, treat it as a pathname and
-	 * construct soname by chopping off the path. Otherwise
-	 * treat it as soname.
-	 */
-	p = str_rchr(name, '/');
-	soname = p ? (p + 1) : name;
-
-	/* Traverse list of all modules. Not extremely fast, but simple */
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		DPRINTF("m = %p\n", m);
-		if (str_cmp(m->dyn.soname, soname) == 0) {
-			return m; /* Found */
-		}
-	}
-
-	return NULL; /* Not found */
-}
-
-#define NAME_BUF_SIZE 64
-
-/** Load a module.
- *
- * Currently this trivially tries to load '/<name>'.
- */
-module_t *module_load(rtld_t *rtld, const char *name, mlflags_t flags)
-{
-	elf_finfo_t info;
-	char name_buf[NAME_BUF_SIZE];
-	module_t *m;
-	errno_t rc;
-
-	m = calloc(1, sizeof(module_t));
-	if (m == NULL) {
-		DPRINTF("malloc failed\n");
-		goto error;
-	}
-
-	m->rtld = rtld;
-	m->id = rtld_get_next_id(rtld);
-
-	if ((flags & mlf_local) != 0)
-		m->local = true;
-
-	if (str_size(name) > NAME_BUF_SIZE - 2) {
-		DPRINTF("soname too long. increase NAME_BUF_SIZE\n");
-		goto error;
-	}
-
-	/* Prepend soname with '/lib/' */
-	str_cpy(name_buf, NAME_BUF_SIZE, "/lib/");
-	str_cpy(name_buf + 5, NAME_BUF_SIZE - 5, name);
-
-	DPRINTF("filename:'%s'\n", name_buf);
-
-	rc = elf_load_file_name(name_buf, RTLD_MODULE_LDF, &info);
-	if (rc != EOK) {
-		DPRINTF("Failed to load '%s'\n", name_buf);
-		goto error;
-	}
-
-	m->bias = elf_get_bias(info.base);
-
-	DPRINTF("loaded '%s' at 0x%zx\n", name_buf, m->bias);
-
-	if (info.dynamic == NULL) {
-		DPRINTF("Error: '%s' is not a dynamically-linked object.\n",
-		    name_buf);
-		goto error;
-	}
-
-	/* Pending relocation. */
-	m->relocated = false;
-
-	DPRINTF("parse dynamic section\n");
-	/* Parse ELF .dynamic section. Store info to m->dyn. */
-	dynamic_parse(info.dynamic, m->bias, &m->dyn);
-
-	/* Insert into the list of loaded modules */
-	list_append(&m->modules_link, &rtld->modules);
-
-	/* Copy TLS info */
-	m->tdata = info.tls.tdata;
-	m->tdata_size = info.tls.tdata_size;
-	m->tbss_size = info.tls.tbss_size;
-	m->tls_align = info.tls.tls_align;
-
-	DPRINTF("tdata at %p size %zu, tbss size %zu\n",
-	    m->tdata, m->tdata_size, m->tbss_size);
-
-	return m;
-
-error:
-	if (m)
-		free(m);
-
-	return NULL;
-}
-
-/** Load all modules on which m (transitively) depends.
- */
-errno_t module_load_deps(module_t *m, mlflags_t flags)
-{
-	elf_dyn_t *dp;
-	char *dep_name;
-	module_t *dm;
-	size_t n, i;
-
-	DPRINTF("module_load_deps('%s')\n", m->dyn.soname);
-
-	/* Count direct dependencies */
-
-	dp = m->dyn.dynamic;
-	n = 0;
-
-	while (dp->d_tag != DT_NULL) {
-		if (dp->d_tag == DT_NEEDED)
-			++n;
-		++dp;
-	}
-
-	/* Create an array of pointers to direct dependencies */
-
-	m->n_deps = n;
-
-	if (n == 0) {
-		/* There are no dependencies, so we are done. */
-		m->deps = NULL;
-		return EOK;
-	}
-
-	m->deps = malloc(n * sizeof(module_t *));
-	if (!m->deps) {
-		DPRINTF("malloc failed\n");
-		return ENOMEM;
-	}
-
-	i = 0; /* Current dependency index */
-	dp = m->dyn.dynamic;
-
-	while (dp->d_tag != DT_NULL) {
-		if (dp->d_tag == DT_NEEDED) {
-			dep_name = m->dyn.str_tab + dp->d_un.d_val;
-
-			DPRINTF("%s needs %s\n", m->dyn.soname, dep_name);
-			dm = module_find(m->rtld, dep_name);
-			if (!dm) {
-				dm = module_load(m->rtld, dep_name, flags);
-				if (!dm) {
-					return EINVAL;
-				}
-
-				errno_t rc = module_load_deps(dm, flags);
-				if (rc != EOK) {
-					return rc;
-				}
-			}
-
-			/* Save into deps table */
-			m->deps[i++] = dm;
-		}
-		++dp;
-	}
-
-	return EOK;
-}
-
-/** Find module structure by ID. */
-module_t *module_by_id(rtld_t *rtld, unsigned long id)
-{
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		if (m->id == id)
-			return m;
-	}
-
-	return NULL;
-}
-
-/** Process relocations in modules.
- *
- * Processes relocations in @a start and all its dependencies.
- * Modules that have already been relocated are unaffected.
- *
- * @param	start	The module where to start from.
- */
-void modules_process_relocs(rtld_t *rtld, module_t *start)
-{
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		/*
-		 * Skip rtld module, since it has already been processed.
-		 * Skip start / main program -- leave it for later
-		 */
-		if (m != &rtld->rtld && m != start) {
-			module_process_relocs(m);
-		}
-	}
-
-	/*
-	 * Now that shared libraries have been processed and their variables
-	 * are thus initialized, we can process the main program,
-	 * which may contain COPY relocations that copy value from shared
-	 * library variables to instances of those variables defined
-	 * in the main program.
-	 */
-	module_process_relocs(start);
-}
-
-void modules_process_tls(rtld_t *rtld)
-{
-#ifdef CONFIG_TLS_VARIANT_1
-	rtld->tls_size = sizeof(tcb_t);
-	rtld->tls_align = alignof(tcb_t);
-
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		list_append(&m->imodules_link, &rtld->imodules);
-		rtld->tls_align = max(rtld->tls_align, m->tls_align);
-
-		rtld->tls_size = ALIGN_UP(rtld->tls_size, m->tls_align);
-		m->tpoff = rtld->tls_size;
-		rtld->tls_size += m->tdata_size + m->tbss_size;
-	}
-
-#else
-	rtld->tls_size = 0;
-	rtld->tls_align = alignof(tcb_t);
-
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		list_append(&m->imodules_link, &rtld->imodules);
-		rtld->tls_align = max(rtld->tls_align, m->tls_align);
-
-		/*
-		 * We are allocating spans "backwards", here,
-		 * as described in U. Drepper's paper.
-		 */
-		rtld->tls_size += m->tdata_size + m->tbss_size;
-		rtld->tls_size = ALIGN_UP(rtld->tls_size, m->tls_align);
-		m->tpoff = -(ptrdiff_t) rtld->tls_size;
-	}
-
-	/*
-	 * We are in negative offsets. In order for the alignments to
-	 * be correct, "zero" offset (i.e. the total size) must be aligned
-	 * to the strictest alignment present.
-	 */
-	rtld->tls_size = ALIGN_UP(rtld->tls_size, rtld->tls_align);
-
-	/*
-	 * Space for the TCB.
-	 * Later, the TLS zero offset is equal to the pointer to tcb_t, so
-	 * adding the sizeof(tcb_t) block AFTER we calculated the alignment
-	 * of the remainder above is correct.
-	 */
-	rtld->tls_size += sizeof(tcb_t);
-#endif
-}
-
-/** Clear BFS tags of all modules.
- */
-void modules_untag(rtld_t *rtld)
-{
-	list_foreach(rtld->modules, modules_link, module_t, m) {
-		m->bfs_tag = false;
-	}
-}
-
-/** @}
- */
Index: pace/lib/c/generic/rtld/rtld.c
===================================================================
--- uspace/lib/c/generic/rtld/rtld.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <rtld/module.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <stdlib.h>
-#include <str.h>
-
-rtld_t *runtime_env;
-
-/** Initialize and process an executable.
- *
- * @param p_info Program info
- * @return EOK on success or non-zero error code
- */
-errno_t rtld_prog_process(elf_finfo_t *p_info, rtld_t **rre)
-{
-	rtld_t *env;
-	bool is_dynamic = p_info->dynamic != NULL;
-	DPRINTF("rtld_prog_process\n");
-
-	/* Allocate new RTLD environment to pass to the loaded program */
-	env = calloc(1, sizeof(rtld_t));
-	if (env == NULL)
-		return ENOMEM;
-
-	list_initialize(&env->modules);
-	list_initialize(&env->imodules);
-	env->next_id = 1;
-
-	module_t *module;
-	errno_t rc = module_create_entrypoint(p_info, env, &module);
-	if (rc != EOK) {
-		free(env);
-		return rc;
-	}
-
-	/* Pointer to program module. Used as root of the module graph. */
-	env->program = module;
-
-	/*
-	 * Now we can continue with loading all other modules.
-	 */
-
-	if (is_dynamic) {
-		DPRINTF("Load all program dependencies\n");
-		rc = module_load_deps(module, 0);
-		if (rc != EOK) {
-			free(module);
-			free(env);
-			return rc;
-		}
-	}
-
-	/* Compute static TLS size */
-	modules_process_tls(env);
-
-	/*
-	 * Now relocate/link all modules together.
-	 */
-
-	if (is_dynamic) {
-		/* Process relocations in all modules */
-		DPRINTF("Relocate all modules\n");
-		modules_process_relocs(env, module);
-	}
-
-	if (rre != NULL)
-		*rre = env;
-	return EOK;
-}
-
-/** Create TLS (Thread Local Storage) data structures.
- *
- * @return Pointer to TCB.
- */
-tcb_t *rtld_tls_make(rtld_t *rtld)
-{
-	tcb_t *tcb;
-	void **dtv;
-	size_t nmods;
-	size_t i;
-
-	tcb = tls_alloc_arch(rtld->tls_size, rtld->tls_align);
-	if (tcb == NULL)
-		return NULL;
-
-	/** Allocate dynamic thread vector */
-	nmods = list_count(&rtld->imodules);
-	dtv = malloc((nmods + 1) * sizeof(void *));
-	if (dtv == NULL) {
-		tls_free(tcb);
-		return NULL;
-	}
-
-	/*
-	 * We define generation number to be equal to vector length.
-	 * We start with a vector covering the initially loaded modules.
-	 */
-	DTV_GN(dtv) = nmods;
-
-	/*
-	 * Copy thread local data from the initialization images of initial
-	 * modules. Zero out thread-local uninitialized data.
-	 */
-
-	i = 1;
-	list_foreach(rtld->imodules, imodules_link, module_t, m) {
-		assert(i++ == m->id);
-
-		dtv[m->id] = (void *) tcb + m->tpoff;
-
-		assert(((uintptr_t) dtv[m->id]) % m->tls_align == 0);
-
-		if (m->tdata)
-			memcpy(dtv[m->id], m->tdata, m->tdata_size);
-
-		memset(dtv[m->id] + m->tdata_size, 0, m->tbss_size);
-	}
-
-	tcb->dtv = dtv;
-	return tcb;
-}
-
-unsigned long rtld_get_next_id(rtld_t *rtld)
-{
-	return rtld->next_id++;
-}
-
-/** Get address of thread-local variable.
- *
- * @param rtld RTLD instance
- * @param tcb TCB of the thread whose instance to return
- * @param mod_id Module ID
- * @param offset Offset within TLS block of the module
- *
- * @return Address of thread-local variable
- */
-void *rtld_tls_get_addr(rtld_t *rtld, tcb_t *tcb, unsigned long mod_id,
-    unsigned long offset)
-{
-	module_t *m;
-	size_t dtv_len;
-	void *tls_block;
-
-	dtv_len = DTV_GN(tcb->dtv);
-	if (dtv_len < mod_id) {
-		/* Vector is short */
-
-		tcb->dtv = realloc(tcb->dtv, (1 + mod_id) * sizeof(void *));
-		/* XXX This can fail if OOM */
-		assert(tcb->dtv != NULL);
-		/* Zero out new part of vector */
-		memset(tcb->dtv + (1 + dtv_len), 0, (mod_id - dtv_len) *
-		    sizeof(void *));
-	}
-
-	if (tcb->dtv[mod_id] == NULL) {
-		/* TLS block is not allocated */
-
-		m = module_by_id(rtld, mod_id);
-		assert(m != NULL);
-		/* Should not be initial module, those have TLS pre-allocated */
-		assert(!link_used(&m->imodules_link));
-
-		tls_block = memalign(m->tls_align, m->tdata_size + m->tbss_size);
-		/* XXX This can fail if OOM */
-		assert(tls_block != NULL);
-
-		/* Copy tdata */
-		memcpy(tls_block, m->tdata, m->tdata_size);
-		/* Zero out tbss */
-		memset(tls_block + m->tdata_size, 0, m->tbss_size);
-
-		tcb->dtv[mod_id] = tls_block;
-	}
-
-	return (uint8_t *)(tcb->dtv[mod_id]) + offset;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/rtld/symbol.c
===================================================================
--- uspace/lib/c/generic/rtld/symbol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,295 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include <elf/elf.h>
-#include <rtld/module.h>
-#include <rtld/rtld.h>
-#include <rtld/rtld_debug.h>
-#include <rtld/symbol.h>
-
-/*
- * Hash tables are 32-bit (elf_word) even for 64-bit ELF files.
- */
-static elf_word elf_hash(const unsigned char *name)
-{
-	elf_word h = 0, g;
-
-	while (*name) {
-		h = (h << 4) + *name++;
-		g = h & 0xf0000000;
-		if (g != 0)
-			h ^= g >> 24;
-		h &= ~g;
-	}
-
-	return h;
-}
-
-static elf_symbol_t *def_find_in_module(const char *name, module_t *m)
-{
-	if (m->dyn.hash == NULL) {
-		/* No hash table */
-		return NULL;
-	}
-
-	elf_symbol_t *sym_table;
-	elf_symbol_t *s, *sym;
-	elf_word nbucket;
-	/* elf_word nchain; */
-	elf_word i;
-	char *s_name;
-	elf_word bucket;
-
-	DPRINTF("def_find_in_module('%s', %s)\n", name, m->dyn.soname);
-
-	sym_table = m->dyn.sym_tab;
-	nbucket = m->dyn.hash[0];
-	/* nchain = m->dyn.hash[1]; XXX Use to check HT range */
-
-	bucket = elf_hash((unsigned char *)name) % nbucket;
-	i = m->dyn.hash[2 + bucket];
-
-	sym = NULL;
-	while (i != STN_UNDEF) {
-		s = &sym_table[i];
-		s_name = m->dyn.str_tab + s->st_name;
-
-		if (str_cmp(name, s_name) == 0) {
-			sym = s;
-			break;
-		}
-
-		i = m->dyn.hash[2 + nbucket + i];
-	}
-
-	if (!sym)
-		return NULL;	/* Not found */
-
-	if (sym->st_shndx == SHN_UNDEF) {
-		/* Not a definition */
-		return NULL;
-	}
-
-	return sym; /* Found */
-}
-
-/** Find the definition of a symbol in a module and its deps.
- *
- * Search the module dependency graph is breadth-first, beginning
- * from the module @a start. Thus, @start and all its dependencies
- * get searched.
- *
- * @param name		Name of the symbol to search for.
- * @param start		Module in which to start the search..
- * @param mod		(output) Will be filled with a pointer to the module
- *			that contains the symbol.
- */
-elf_symbol_t *symbol_bfs_find(const char *name, module_t *start,
-    module_t **mod)
-{
-	module_t *m, *dm;
-	elf_symbol_t *sym, *s;
-	list_t queue;
-	size_t i;
-
-	/*
-	 * Do a BFS using the queue_link and bfs_tag fields.
-	 * Vertices (modules) are tagged the moment they are inserted
-	 * into the queue. This prevents from visiting the same vertex
-	 * more times in case of circular dependencies.
-	 */
-
-	/* Mark all vertices (modules) as unvisited */
-	modules_untag(start->rtld);
-
-	/*
-	 * Insert root (the program) into the queue and tag it.
-	 *
-	 * We disable the dangling-pointer warning because the compiler incorrectly
-	 * assumes that we leak local address (queue) to a parent scope (to start
-	 * argument). However, we always empty the list so the pointer cannot
-	 * actually escape. Probably the compiler can never statically analyze that
-	 * correctly.
-	 */
-	list_initialize(&queue);
-	start->bfs_tag = true;
-#pragma GCC diagnostic push
-#if defined(__GNUC__) && (__GNUC__ >= 12)
-#pragma GCC diagnostic ignored "-Wdangling-pointer"
-#endif
-	list_append(&start->queue_link, &queue);
-#pragma GCC diagnostic pop
-
-	/* If the symbol is found, it will be stored in 'sym' */
-	sym = NULL;
-
-	/* While queue is not empty */
-	while (!list_empty(&queue)) {
-		/* Pop first element from the queue */
-		m = list_get_instance(list_first(&queue), module_t, queue_link);
-		list_remove(&m->queue_link);
-
-		/* If ssf_noroot is specified, do not look in start module */
-		s = def_find_in_module(name, m);
-		if (s != NULL) {
-			/* Symbol found */
-			sym = s;
-			*mod = m;
-			break;
-		}
-
-		/*
-		 * Insert m's untagged dependencies into the queue
-		 * and tag them.
-		 */
-		for (i = 0; i < m->n_deps; ++i) {
-			dm = m->deps[i];
-
-			if (dm->bfs_tag == false) {
-				dm->bfs_tag = true;
-				list_append(&dm->queue_link, &queue);
-			}
-		}
-	}
-
-	/* Empty the queue so that we leave it in a clean state */
-	while (!list_empty(&queue))
-		list_remove(list_first(&queue));
-
-	if (!sym) {
-		return NULL; /* Not found */
-	}
-
-	return sym; /* Symbol found */
-}
-
-/** Find the definition of a symbol.
- *
- * By definition in System V ABI, if module origin has the flag DT_SYMBOLIC,
- * origin is searched first. Otherwise, search global modules in the default
- * order.
- *
- * @param name		Name of the symbol to search for.
- * @param origin	Module in which the dependency originates.
- * @param flags		@c ssf_none or @c ssf_noexec to not look for the symbol
- *			in the executable program.
- * @param mod		(output) Will be filled with a pointer to the module
- *			that contains the symbol.
- */
-elf_symbol_t *symbol_def_find(const char *name, module_t *origin,
-    symbol_search_flags_t flags, module_t **mod)
-{
-	elf_symbol_t *s;
-
-	DPRINTF("symbol_def_find('%s', origin='%s'\n",
-	    name, origin->dyn.soname);
-	if (origin->dyn.symbolic && (!origin->exec || (flags & ssf_noexec) == 0)) {
-		DPRINTF("symbolic->find '%s' in module '%s'\n", name, origin->dyn.soname);
-		/*
-		 * Origin module has a DT_SYMBOLIC flag.
-		 * Try this module first
-		 */
-		s = def_find_in_module(name, origin);
-		if (s != NULL) {
-			/* Found */
-			*mod = origin;
-			return s;
-		}
-	}
-
-	/* Not DT_SYMBOLIC or no match. Now try other locations. */
-
-	list_foreach(origin->rtld->modules, modules_link, module_t, m) {
-		DPRINTF("module '%s' local?\n", m->dyn.soname);
-		if (!m->local && (!m->exec || (flags & ssf_noexec) == 0)) {
-			DPRINTF("!local->find '%s' in module '%s'\n", name, m->dyn.soname);
-			s = def_find_in_module(name, m);
-			if (s != NULL) {
-				/* Found */
-				*mod = m;
-				return s;
-			}
-		}
-	}
-
-	/* Finally, try origin. */
-
-	DPRINTF("try finding '%s' in origin '%s'\n", name,
-	    origin->dyn.soname);
-
-	if (!origin->exec || (flags & ssf_noexec) == 0) {
-		s = def_find_in_module(name, origin);
-		if (s != NULL) {
-			/* Found */
-			*mod = origin;
-			return s;
-		}
-	}
-
-	DPRINTF("'%s' not found\n", name);
-	return NULL;
-}
-
-/** Get symbol address.
- *
- * @param sym Symbol
- * @param m Module contaning the symbol
- * @param tcb TCB of the thread whose thread-local variable instance should
- *            be returned. If @a tcb is @c NULL then @c NULL is returned for
- *            thread-local variables.
- *
- * @return Symbol address
- */
-void *symbol_get_addr(elf_symbol_t *sym, module_t *m, tcb_t *tcb)
-{
-	if (elf_st_type(sym->st_info) == STT_TLS) {
-		if (tcb == NULL)
-			return NULL;
-		return rtld_tls_get_addr(m->rtld, tcb, m->id, sym->st_value);
-	} else if (sym->st_shndx == SHN_ABS) {
-		/* Do not add bias to absolute symbols */
-		return (void *) sym->st_value;
-	} else {
-		return (void *) (sym->st_value + m->bias);
-	}
-}
-
-/** @}
- */
Index: pace/lib/c/generic/setjmp.c
===================================================================
--- uspace/lib/c/generic/setjmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#include <setjmp.h>
-#include <context.h>
-
-/** Standard function implementation. */
-void longjmp(jmp_buf env, int val)
-{
-	/*
-	 * The standard requires that longjmp() ensures that val is not zero.
-	 * __context_restore doesn't do that, so we do it here.
-	 */
-	__context_restore(env, val == 0 ? 1 : val);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/shutdown.c
===================================================================
--- uspace/lib/c/generic/shutdown.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-#include <shutdown.h>
-
-/** Reboot the system. */
-void sys_reboot(void)
-{
-	(void) __SYSCALL0(SYS_REBOOT);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/smc.c
===================================================================
--- uspace/lib/c/generic/smc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-#include <stddef.h>
-#include <smc.h>
-
-errno_t smc_coherence(void *address, size_t size)
-{
-	return (errno_t) __SYSCALL2(SYS_SMC_COHERENCE, (sysarg_t) address,
-	    (sysarg_t) size);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stack.c
===================================================================
--- uspace/lib/c/generic/stack.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stack.h>
-#include <sysinfo.h>
-
-size_t stack_size_get(void)
-{
-	static sysarg_t stack_size = 0;
-
-	if (!stack_size)
-		sysinfo_get_value("default.stack_size", &stack_size);
-
-	return (size_t) stack_size;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stacktrace.c
===================================================================
--- uspace/lib/c/generic/stacktrace.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stacktrace.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <io/kio.h>
-
-#define STACK_FRAMES_MAX 20
-
-static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
-
-static stacktrace_ops_t basic_ops = {
-	.read_uintptr = stacktrace_read_uintptr,
-	.printf = printf,
-};
-
-static stacktrace_ops_t kio_ops = {
-	.read_uintptr = stacktrace_read_uintptr,
-	.printf = kio_printf,
-};
-
-void stacktrace_print_generic(stacktrace_ops_t *ops, void *arg, uintptr_t fp,
-    uintptr_t pc)
-{
-	int cnt = 0;
-	stacktrace_t st;
-	uintptr_t nfp;
-	errno_t rc;
-
-	st.op_arg = arg;
-	st.ops = ops;
-
-	while (cnt++ < STACK_FRAMES_MAX && stacktrace_fp_valid(&st, fp)) {
-		ops->printf("%p: %p()\n", (void *) fp, (void *) pc);
-		rc =  stacktrace_ra_get(&st, fp, &pc);
-		if (rc != EOK)
-			break;
-		rc = stacktrace_fp_prev(&st, fp, &nfp);
-		if (rc != EOK)
-			break;
-		fp = nfp;
-	}
-}
-
-void stacktrace_print_fp_pc(uintptr_t fp, uintptr_t pc)
-{
-	stacktrace_print_generic(&basic_ops, NULL, fp, pc);
-}
-
-void stacktrace_kio_print(void)
-{
-	stacktrace_prepare();
-	stacktrace_print_generic(&kio_ops, NULL, stacktrace_fp_get(), stacktrace_pc_get());
-
-	/*
-	 * Prevent the tail call optimization of the previous call by
-	 * making it a non-tail call.
-	 */
-
-	kio_printf("-- end of stack trace --\n");
-}
-
-void stacktrace_print(void)
-{
-	stacktrace_prepare();
-	stacktrace_print_fp_pc(stacktrace_fp_get(), stacktrace_pc_get());
-
-	/*
-	 * Prevent the tail call optimization of the previous call by
-	 * making it a non-tail call.
-	 */
-
-	printf("-- end of stack trace --\n");
-}
-
-static errno_t stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)
-{
-	(void) arg;
-	*data = *((uintptr_t *) addr);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stats.c
===================================================================
--- uspace/lib/c/generic/stats.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,323 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stats.h>
-#include <sysinfo.h>
-#include <errno.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <stdlib.h>
-
-#define SYSINFO_STATS_MAX_PATH  64
-
-/** Thread states
- *
- */
-static const char *thread_states[] = {
-	"Invalid",
-	"Running",
-	"Sleeping",
-	"Ready",
-	"Entering",
-	"Exiting",
-	"Lingering"
-};
-
-/** Get CPUs statistics
- *
- * @param count Number of records returned.
- *
- * @return Array of stats_cpu_t structures.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_cpu_t *stats_get_cpus(size_t *count)
-{
-	size_t size = 0;
-	stats_cpu_t *stats_cpus =
-	    (stats_cpu_t *) sysinfo_get_data("system.cpus", &size);
-
-	if ((size % sizeof(stats_cpu_t)) != 0) {
-		if (stats_cpus != NULL)
-			free(stats_cpus);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(stats_cpu_t);
-	return stats_cpus;
-}
-
-/** Get physical memory statistics
- *
- *
- * @return Pointer to the stats_physmem_t structure.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_physmem_t *stats_get_physmem(void)
-{
-	size_t size = 0;
-	stats_physmem_t *stats_physmem =
-	    (stats_physmem_t *) sysinfo_get_data("system.physmem", &size);
-
-	if (size != sizeof(stats_physmem_t)) {
-		if (stats_physmem != NULL)
-			free(stats_physmem);
-		return NULL;
-	}
-
-	return stats_physmem;
-}
-
-/** Get task statistics
- *
- * @param count Number of records returned.
- *
- * @return Array of stats_task_t structures.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_task_t *stats_get_tasks(size_t *count)
-{
-	size_t size = 0;
-	stats_task_t *stats_tasks =
-	    (stats_task_t *) sysinfo_get_data("system.tasks", &size);
-
-	if ((size % sizeof(stats_task_t)) != 0) {
-		if (stats_tasks != NULL)
-			free(stats_tasks);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(stats_task_t);
-	return stats_tasks;
-}
-
-/** Get single task statistics
- *
- * @param task_id Task ID we are interested in.
- *
- * @return Pointer to the stats_task_t structure.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_task_t *stats_get_task(task_id_t task_id)
-{
-	char name[SYSINFO_STATS_MAX_PATH];
-	snprintf(name, SYSINFO_STATS_MAX_PATH, "system.tasks.%" PRIu64, task_id);
-
-	size_t size = 0;
-	stats_task_t *stats_task =
-	    (stats_task_t *) sysinfo_get_data(name, &size);
-
-	if (size != sizeof(stats_task_t)) {
-		if (stats_task != NULL)
-			free(stats_task);
-		return NULL;
-	}
-
-	return stats_task;
-}
-
-/** Get thread statistics.
- *
- * @param count Number of records returned.
- *
- * @return Array of stats_thread_t structures.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_thread_t *stats_get_threads(size_t *count)
-{
-	size_t size = 0;
-	stats_thread_t *stats_threads =
-	    (stats_thread_t *) sysinfo_get_data("system.threads", &size);
-
-	if ((size % sizeof(stats_thread_t)) != 0) {
-		if (stats_threads != NULL)
-			free(stats_threads);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(stats_thread_t);
-	return stats_threads;
-}
-
-/** Get IPC connections statistics.
- *
- * @param count Number of records returned.
- *
- * @return Array of stats_ipcc_t structures.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_ipcc_t *stats_get_ipccs(size_t *count)
-{
-	size_t size = 0;
-	stats_ipcc_t *stats_ipccs =
-	    (stats_ipcc_t *) sysinfo_get_data("system.ipccs", &size);
-
-	if ((size % sizeof(stats_ipcc_t)) != 0) {
-		if (stats_ipccs != NULL)
-			free(stats_ipccs);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(stats_ipcc_t);
-	return stats_ipccs;
-}
-
-/** Get exception statistics.
- *
- * @param count Number of records returned.
- *
- * @return Array of stats_exc_t structures.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_exc_t *stats_get_exceptions(size_t *count)
-{
-	size_t size = 0;
-	stats_exc_t *stats_exceptions =
-	    (stats_exc_t *) sysinfo_get_data("system.exceptions", &size);
-
-	if ((size % sizeof(stats_exc_t)) != 0) {
-		if (stats_exceptions != NULL)
-			free(stats_exceptions);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(stats_exc_t);
-	return stats_exceptions;
-}
-
-/** Get single exception statistics
- *
- * @param excn Exception number we are interested in.
- *
- * @return Pointer to the stats_exc_t structure.
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-stats_exc_t *stats_get_exception(unsigned int excn)
-{
-	char name[SYSINFO_STATS_MAX_PATH];
-	snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptions.%u", excn);
-
-	size_t size = 0;
-	stats_exc_t *stats_exception =
-	    (stats_exc_t *) sysinfo_get_data(name, &size);
-
-	if (size != sizeof(stats_exc_t)) {
-		if (stats_exception != NULL)
-			free(stats_exception);
-		return NULL;
-	}
-
-	return stats_exception;
-}
-
-/** Get system load
- *
- * @param count Number of load records returned.
- *
- * @return Array of load records (load_t).
- *         If non-NULL then it should be eventually freed
- *         by free().
- *
- */
-load_t *stats_get_load(size_t *count)
-{
-	size_t size = 0;
-	load_t *load =
-	    (load_t *) sysinfo_get_data("system.load", &size);
-
-	if ((size % sizeof(load_t)) != 0) {
-		if (load != NULL)
-			free(load);
-		*count = 0;
-		return NULL;
-	}
-
-	*count = size / sizeof(load_t);
-	return load;
-}
-
-/** Print load fixed-point value
- *
- * Print the load record fixed-point value in decimal
- * representation on stdout.
- *
- * @param upper      Load record.
- * @param dec_length Number of decimal digits to print.
- *
- */
-void stats_print_load_fragment(load_t upper, unsigned int dec_length)
-{
-	/* Print the whole part */
-	printf("%u.", upper / LOAD_UNIT);
-
-	load_t rest = (upper % LOAD_UNIT) * 10;
-
-	unsigned int i;
-	for (i = 0; i < dec_length; i++) {
-		printf("%u", rest / LOAD_UNIT);
-		rest = (rest % LOAD_UNIT) * 10;
-	}
-}
-
-const char *thread_get_state(state_t state)
-{
-	if (state <= Lingering)
-		return thread_states[state];
-
-	return thread_states[Invalid];
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio.c
===================================================================
--- uspace/lib/c/generic/stdio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file C standard file manipulation functions
- */
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <str.h>
-#include <str_error.h>
-#include <tmpfile.h>
-#include <vfs/vfs.h>
-
-/** Static buffer for tmpnam function */
-static char tmpnam_buf[L_tmpnam];
-
-/** Get stream position.
- *
- * @param stream Stream
- * @param pos Place to store position
- *
- * @return Zero on success, non-zero on failure
- */
-int fgetpos(FILE *stream, fpos_t *pos)
-{
-	off64_t p;
-
-	p = ftell64(stream);
-	if (p < 0)
-		return -1;
-
-	pos->pos = p;
-	return 0;
-}
-
-/** Get stream position.
- *
- * @param stream Stream
- * @param pos Position
- *
- * @return Zero on sucess, non-zero on failure
- */
-int fsetpos(FILE *stream, const fpos_t *pos)
-{
-	int rc;
-
-	rc = fseek64(stream, pos->pos, SEEK_SET);
-	if (rc < 0)
-		return -1;
-
-	return 0;
-}
-
-/** Rename file or directory (C standard) */
-int rename(const char *old_path, const char *new_path)
-{
-	errno_t rc;
-
-	rc = vfs_rename_path(old_path, new_path);
-	if (rc != EOK) {
-		/*
-		 * Note that ISO C leaves the value of errno undefined,
-		 * whereas according to UN*X standards, it is set.
-		 */
-		errno = rc;
-		return -1;
-	}
-
-	return 0;
-}
-
-/** Remove file or directory (C standard) */
-int remove(const char *path)
-{
-	errno_t rc;
-
-	rc = vfs_unlink_path(path);
-	if (rc != EOK) {
-		/*
-		 * Note that ISO C leaves the value of errno undefined,
-		 * whereas according to UN*X standards, it is set.
-		 */
-		errno = rc;
-		return -1;
-	}
-
-	return 0;
-}
-
-/** Create a temporary file.
- *
- * @return Open stream descriptor or @c NULL on error. In that case
- *         errno is set (UN*X). Note that ISO C leaves the value of errno
- *         undefined.
- */
-FILE *tmpfile(void)
-{
-	int file;
-	FILE *stream;
-
-	file = __tmpfile();
-	if (file < 0) {
-		printf("file is < 0\n");
-		errno = EEXIST;
-		return NULL;
-	}
-
-	stream = fdopen(file, "w+");
-	if (stream == NULL) {
-		printf("stream = NULL\n");
-		vfs_put(file);
-		errno = EACCES;
-		return NULL;
-	}
-
-	return stream;
-}
-
-/** Create name for a temporary file.
- *
- * @param s Pointer to array of at least L_tmpnam bytes or @c NULL.
- * @return The pointer @a s or pointer to internal static buffer on success,
- *         @c NULL on error.
- */
-char *tmpnam(char *s)
-{
-	char *p;
-
-	p = (s != NULL) ? s : tmpnam_buf;
-	return __tmpnam(p);
-}
-
-/** Print error message and string representation of @c errno.
- *
- * @param s Error message
- */
-void perror(const char *s)
-{
-	if (s != NULL && *s != '\0')
-		fprintf(stderr, "%s: %s\n", s, str_error(errno));
-	else
-		fprintf(stderr, "%s\n", str_error(errno));
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio/scanf.c
===================================================================
--- uspace/lib/c/generic/stdio/scanf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1408 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Formatted input (scanf family)
- */
-
-#include <assert.h>
-#include <_bits/ssize_t.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "../private/scanf.h"
-
-typedef enum {
-	/** No length modifier */
-	lm_none,
-	/** 'hh' */
-	lm_hh,
-	/** 'h' */
-	lm_h,
-	/** 'l' */
-	lm_l,
-	/** 'll' */
-	lm_ll,
-	/** 'j' */
-	lm_j,
-	/** 'z' */
-	lm_z,
-	/** 't' */
-	lm_t,
-	/** 'L' */
-	lm_L
-} lenmod_t;
-
-typedef enum {
-	/** Unknown */
-	cs_unknown,
-	/** 'd' */
-	cs_decimal,
-	/** 'i' */
-	cs_int,
-	/** 'o' */
-	cs_octal,
-	/** 'u' */
-	cs_udecimal,
-	/** 'x', 'X' */
-	cs_hex,
-	/** 'a', 'e', 'f', 'g', 'A', 'E', 'F', 'G' */
-	cs_float,
-	/** 'c' */
-	cs_char,
-	/** 's' */
-	cs_str,
-	/* [...] */
-	cs_set,
-	/* 'p' */
-	cs_ptr,
-	/* 'n' */
-	cs_numchar,
-	/* '%' */
-	cs_percent
-} cvtspcr_t;
-
-/** Conversion specification */
-typedef struct {
-	/** Suppress assignment */
-	bool noassign;
-	/** Allocate memory for string (GNU extension) */
-	bool memalloc;
-	/** @c true if width field is valid */
-	bool have_width;
-	/** Width */
-	size_t width;
-	/** Length modifier */
-	lenmod_t lenmod;
-	/** Conversion specifier */
-	cvtspcr_t spcr;
-	/** Scan set (if spc == cs_set) */
-	const char *scanset;
-} cvtspec_t;
-
-/** Buffer for writing strings */
-typedef struct {
-	/** Buffer */
-	char *buf;
-	/** Place where to store pointer to the buffer */
-	char **pptr;
-	/** Allocating memory for caller */
-	bool memalloc;
-	/** Current size of allocated buffer */
-	size_t size;
-} strbuf_t;
-
-/** Wrapper needed to pass va_list around by reference in a portable fashion */
-typedef struct {
-	va_list ap;
-} va_encaps_t;
-
-static int digit_value(char digit)
-{
-	switch (digit) {
-	case '0':
-		return 0;
-	case '1':
-		return 1;
-	case '2':
-		return 2;
-	case '3':
-		return 3;
-	case '4':
-		return 4;
-	case '5':
-		return 5;
-	case '6':
-		return 6;
-	case '7':
-		return 7;
-	case '8':
-		return 8;
-	case '9':
-		return 9;
-	case 'a':
-	case 'A':
-		return 10;
-	case 'b':
-	case 'B':
-		return 11;
-	case 'c':
-	case 'C':
-		return 12;
-	case 'd':
-	case 'D':
-		return 13;
-	case 'e':
-	case 'E':
-		return 14;
-	case 'f':
-	case 'F':
-		return 15;
-	default:
-		assert(false);
-	}
-}
-
-static void cvtspec_parse(const char **fmt, cvtspec_t *spec)
-{
-	spec->scanset = NULL;
-	spec->width = 0;
-
-	/* Assignment suppresion */
-
-	if (**fmt == '*') {
-		spec->noassign = true;
-		++(*fmt);
-	} else {
-		spec->noassign = false;
-	}
-
-	/* Memory allocation */
-
-	if (**fmt == 'm') {
-		spec->memalloc = true;
-		++(*fmt);
-	} else {
-		spec->memalloc = false;
-	}
-
-	/* Width specifier */
-
-	if (isdigit(**fmt)) {
-		spec->have_width = true;
-		assert(**fmt != '0');
-		spec->width = 0;
-		while (isdigit(**fmt)) {
-			spec->width *= 10;
-			spec->width += digit_value(**fmt);
-			++(*fmt);
-		}
-	} else {
-		spec->have_width = false;
-	}
-
-	/* Length modifier */
-
-	switch (**fmt) {
-	case 'h':
-		++(*fmt);
-		if (**fmt == 'h') {
-			spec->lenmod = lm_hh;
-			++(*fmt);
-		} else {
-			spec->lenmod = lm_h;
-		}
-		break;
-	case 'l':
-		++(*fmt);
-		if (**fmt == 'l') {
-			spec->lenmod = lm_ll;
-			++(*fmt);
-		} else {
-			spec->lenmod = lm_l;
-		}
-		break;
-	case 'j':
-		++(*fmt);
-		spec->lenmod = lm_j;
-		break;
-	case 'z':
-		++(*fmt);
-		spec->lenmod = lm_z;
-		break;
-	case 't':
-		++(*fmt);
-		spec->lenmod = lm_t;
-		break;
-	case 'L':
-		++(*fmt);
-		spec->lenmod = lm_L;
-		break;
-	default:
-		spec->lenmod = lm_none;
-		break;
-	}
-
-	/* Conversion specifier */
-
-	switch (**fmt) {
-	case 'd':
-		++(*fmt);
-		spec->spcr = cs_decimal;
-		break;
-	case 'i':
-		++(*fmt);
-		spec->spcr = cs_int;
-		break;
-	case 'o':
-		++(*fmt);
-		spec->spcr = cs_octal;
-		break;
-	case 'u':
-		++(*fmt);
-		spec->spcr = cs_udecimal;
-		break;
-	case 'x':
-	case 'X':
-		++(*fmt);
-		spec->spcr = cs_hex;
-		break;
-	case 'a':
-	case 'e':
-	case 'f':
-	case 'g':
-	case 'A':
-	case 'E':
-	case 'F':
-	case 'G':
-		++(*fmt);
-		spec->spcr = cs_float;
-		break;
-	case 'c':
-		++(*fmt);
-		spec->spcr = cs_char;
-		break;
-	case 's':
-		++(*fmt);
-		spec->spcr = cs_str;
-		break;
-	case '[':
-		++(*fmt);
-		spec->spcr = cs_set;
-		spec->scanset = *fmt;
-		while (**fmt != ']' && **fmt != '\0')
-			++(*fmt);
-		if (**fmt == ']')
-			++(*fmt);
-		break;
-	case 'p':
-		++(*fmt);
-		spec->spcr = cs_ptr;
-		break;
-	case 'n':
-		++(*fmt);
-		spec->spcr = cs_numchar;
-		break;
-	case '%':
-		++(*fmt);
-		spec->spcr = cs_percent;
-		break;
-	default:
-		assert(false);
-		spec->spcr = cs_unknown;
-		break;
-	}
-}
-
-/** Initialize string buffer.
- *
- * String buffer is used to write characters from a string conversion.
- * The buffer can be provided by caller or dynamically allocated
- * (and grown).
- *
- * Initialize the string buffer @a strbuf. If @a spec->noassign,is true,
- * set the buffer pointer to NULL. Otherwise, if @a spec->memalloc is true,
- * allocate a buffer and read an argument of type char ** designating
- * a place where the pointer should be stored. If @a spec->memalloc is false,
- * read an argument of type char * and use it as a destination to write
- * the characters to.
- *
- * @param strbuf String buffer to initialize
- * @param cvtspec Conversion specification (noassign, memalloc)
- * @param ap Argument list to read pointer from
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t strbuf_init(strbuf_t *strbuf, cvtspec_t *spec, va_encaps_t *va)
-{
-	if (spec->noassign) {
-		strbuf->memalloc = false;
-		strbuf->buf = NULL;
-		strbuf->pptr = NULL;
-		strbuf->size = 0;
-		return EOK;
-	}
-
-	if (spec->memalloc) {
-		/* Allocate memory for caller */
-		strbuf->memalloc = true;
-		strbuf->size = 1;
-		strbuf->buf = malloc(strbuf->size);
-		if (strbuf->buf == NULL)
-			return ENOMEM;
-
-		/*
-		 * Save pointer to allocated buffer to caller-provided
-		 * location
-		 */
-		strbuf->pptr = va_arg(va->ap, char **);
-		*strbuf->pptr = strbuf->buf;
-	} else {
-		/* Caller-provided buffer */
-		strbuf->memalloc = false;
-		strbuf->size = 0;
-		strbuf->buf = va_arg(va->ap, char *);
-		strbuf->pptr = NULL;
-	}
-
-	return EOK;
-}
-
-/** Write character at the specified position in a string buffer.
- *
- * The buffer is enlarged if necessary.
- *
- * @param strbuf String buffer
- * @param idx Character position (starting from 0)
- * @param c Character to write
- *
- * @return EOK on sucess, ENOMEM if out of memory
- */
-static errno_t strbuf_write(strbuf_t *strbuf, size_t idx, char c)
-{
-	if (strbuf->memalloc && idx >= strbuf->size) {
-		/* Enlarge buffer */
-		strbuf->size = strbuf->size * 2;
-		strbuf->buf = realloc(strbuf->buf, strbuf->size);
-		*strbuf->pptr = strbuf->buf;
-		if (strbuf->buf == NULL)
-			return ENOMEM;
-	}
-
-	if (strbuf->buf != NULL)
-		strbuf->buf[idx] = c;
-
-	return EOK;
-}
-
-/** Get character from stream, keeping count of number of characters read.
- *
- * @param f Stream
- * @param numchar Pointer to counter of characters read
- * @return Character on success, EOF on error
- */
-static int __fgetc(FILE *f, int *numchar)
-{
-	int c;
-
-	c = fgetc(f);
-	if (c == EOF)
-		return EOF;
-
-	++(*numchar);
-	return c;
-}
-
-/** Unget character to stream, keeping count of number of characters read.
- *
- * @param c Character
- * @param f Stream
- * @param numchar Pointer to counter of characters read
- *
- * @return @a c on success, EOF on failure
- */
-static int __ungetc(int c, FILE *f, int *numchar)
-{
-	int rc;
-
-	rc = ungetc(c, f);
-	if (rc == EOF)
-		return EOF;
-
-	--(*numchar);
-	return rc;
-}
-
-/* Skip whitespace in input stream */
-static errno_t vfscanf_skip_ws(FILE *f, int *numchar)
-{
-	int c;
-
-	c = __fgetc(f, numchar);
-	if (c == EOF)
-		return EIO;
-
-	while (isspace(c)) {
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-	}
-
-	if (c == EOF)
-		return EIO;
-
-	__ungetc(c, f, numchar);
-	return EOK;
-}
-
-/* Match whitespace. */
-static errno_t vfscanf_match_ws(FILE *f, int *numchar, const char **fmt)
-{
-	errno_t rc;
-
-	rc = vfscanf_skip_ws(f, numchar);
-	if (rc == EOF)
-		return EIO;
-
-	++(*fmt);
-	return EOK;
-}
-
-/** Read intmax_t integer from file.
- *
- * @param f Input file
- * @param numchar Pointer to counter of characters read
- * @param base Numeric base (0 means detect using prefix)
- * @param width Maximum field with in characters
- * @param dest Place to store result
- * @return EOK on success, EIO on I/O error, EINVAL if input is not valid
- */
-static errno_t __fstrtoimax(FILE *f, int *numchar, int base, size_t width,
-    intmax_t *dest)
-{
-	errno_t rc;
-	int c;
-	intmax_t v;
-	int digit;
-	int sign;
-
-	rc = vfscanf_skip_ws(f, numchar);
-	if (rc == EIO)
-		return EIO;
-
-	c = __fgetc(f, numchar);
-	if (c == EOF)
-		return EIO;
-
-	if (c == '+' || c == '-') {
-		/* Sign */
-		sign = (c == '-') ? -1 : +1;
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-		--width;
-	} else {
-		sign = 1;
-	}
-
-	if (!isdigit(c) || width < 1) {
-		__ungetc(c, f, numchar);
-		return EINVAL;
-	}
-
-	if (base == 0) {
-		/* Base prefix */
-		if (c == '0') {
-			c = __fgetc(f, numchar);
-			if (c == EOF)
-				return EIO;
-			--width;
-
-			if (width > 0 && (c == 'x' || c == 'X')) {
-				--width;
-				c = __fgetc(f, numchar);
-				if (c == EOF)
-					return EIO;
-				if (width > 0 && isxdigit(c)) {
-					base = 16;
-				} else {
-					*dest = 0;
-					return EOK;
-				}
-			} else {
-				base = 8;
-				if (width == 0) {
-					*dest = 0;
-					return EOK;
-				}
-			}
-		} else {
-			base = 10;
-		}
-	}
-
-	/* Value */
-	v = 0;
-	do {
-		digit = digit_value(c);
-		if (digit >= base)
-			break;
-
-		v = v * base + digit;
-		c = __fgetc(f, numchar);
-		--width;
-	} while (width > 0 && isxdigit(c));
-
-	if (c != EOF)
-		__ungetc(c, f, numchar);
-
-	*dest = sign * v;
-	return EOK;
-}
-
-/** Read uintmax_t unsigned integer from file.
- *
- * @param f Input file
- * @param numchar Pointer to counter of characters read
- * @param base Numeric base (0 means detect using prefix)
- * @param width Maximum field with in characters
- * @param dest Place to store result
- * @return EOK on success, EIO on I/O error, EINVAL if input is not valid
- */
-static errno_t __fstrtoumax(FILE *f, int *numchar, int base, size_t width,
-    uintmax_t *dest)
-{
-	errno_t rc;
-	int c;
-	uintmax_t v;
-	int digit;
-
-	rc = vfscanf_skip_ws(f, numchar);
-	if (rc == EIO)
-		return EIO;
-
-	c = __fgetc(f, numchar);
-	if (c == EOF)
-		return EIO;
-
-	if (!isdigit(c) || width < 1) {
-		__ungetc(c, f, numchar);
-		return EINVAL;
-	}
-
-	if (base == 0) {
-		/* Base prefix */
-		if (c == '0') {
-			c = __fgetc(f, numchar);
-			if (c == EOF)
-				return EIO;
-			--width;
-
-			if (width > 0 && (c == 'x' || c == 'X')) {
-				--width;
-				c = __fgetc(f, numchar);
-				if (c == EOF)
-					return EIO;
-				if (width > 0 && isxdigit(c)) {
-					base = 16;
-				} else {
-					*dest = 0;
-					return EOK;
-				}
-			} else {
-				base = 8;
-				if (width == 0) {
-					*dest = 0;
-					return EOK;
-				}
-			}
-		} else {
-			base = 10;
-		}
-	}
-
-	/* Value */
-	v = 0;
-	do {
-		digit = digit_value(c);
-		if (digit >= base)
-			break;
-
-		v = v * base + digit;
-		c = __fgetc(f, numchar);
-		--width;
-	} while (width > 0 && isxdigit(c));
-
-	if (c != EOF)
-		__ungetc(c, f, numchar);
-
-	*dest = v;
-	return EOK;
-}
-
-/** Read long double from file.
- *
- * @param f Input file
- * @param numchar Pointer to counter of characters read
- * @param width Maximum field with in characters
- * @param dest Place to store result
- * @return EOK on success, EIO on I/O error, EINVAL if input is not valid
- */
-errno_t __fstrtold(FILE *f, int *numchar, size_t width,
-    long double *dest)
-{
-	errno_t rc;
-	int c;
-	long double v;
-	int digit;
-	int sign;
-	int base;
-	int efactor;
-	int eadd;
-	int eadj;
-	int exp;
-	int expsign;
-
-	rc = vfscanf_skip_ws(f, numchar);
-	if (rc == EIO)
-		return EIO;
-
-	c = __fgetc(f, numchar);
-	if (c == EOF)
-		return EIO;
-
-	if (c == '+' || c == '-') {
-		/* Sign */
-		sign = (c == '-') ? -1 : +1;
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-		--width;
-	} else {
-		sign = 1;
-	}
-
-	if (!isdigit(c) || width < 1) {
-		__ungetc(c, f, numchar);
-		return EINVAL;
-	}
-
-	/*
-	 * Default is base 10
-	 */
-
-	/* Significand is in base 10 */
-	base = 10;
-	/* e+1 multiplies number by ten */
-	efactor = 10;
-	/* Adjust exp. by one for each fractional digit */
-	eadd = 1;
-
-	/* Base prefix */
-	if (c == '0') {
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-		--width;
-
-		if (width > 0 && (c == 'x' || c == 'X')) {
-			--width;
-			c = __fgetc(f, numchar);
-
-			if (width > 0 && isxdigit(c)) {
-				/* Significand is in base 16 */
-				base = 16;
-				/* p+1 multiplies number by two */
-				efactor = 2;
-				/*
-				 * Adjust exponent by 4 for each
-				 * fractional digit
-				 */
-				eadd = 4;
-			} else {
-				*dest = 0;
-				return EOK;
-			}
-		}
-	}
-
-	/* Value */
-	v = 0;
-	do {
-		digit = digit_value(c);
-		if (digit >= base)
-			break;
-
-		v = v * base + digit;
-		c = __fgetc(f, numchar);
-		--width;
-	} while (width > 0 && isxdigit(c));
-
-	/* Decimal-point */
-	eadj = 0;
-
-	if (c == '.' && width > 1) {
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-
-		--width;
-
-		/* Fractional part */
-		while (width > 0 && isxdigit(c)) {
-			digit = digit_value(c);
-			if (digit >= base)
-				break;
-
-			v = v * base + digit;
-			c = __fgetc(f, numchar);
-			--width;
-			eadj -= eadd;
-		}
-	}
-
-	exp = 0;
-
-	/* Exponent */
-	if ((width > 1 && base == 10 && (c == 'e' || c == 'E')) ||
-	    (width > 1 && base == 16 && (c == 'p' || c == 'P'))) {
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-
-		--width;
-
-		if (width > 1 && (c == '+' || c == '-')) {
-			/* Exponent sign */
-			if (c == '+') {
-				expsign = 1;
-			} else {
-				expsign = -1;
-			}
-
-			c = __fgetc(f, numchar);
-			if (c == EOF)
-				return EIO;
-
-			--width;
-		} else {
-			expsign = 1;
-		}
-
-		while (width > 0 && isdigit(c)) {
-			digit = digit_value(c);
-			if (digit >= 10)
-				break;
-
-			exp = exp * 10 + digit;
-			c = __fgetc(f, numchar);
-			--width;
-		}
-
-		exp = exp * expsign;
-	}
-
-	exp += eadj;
-
-	/* Adjust v for value of exponent */
-
-	while (exp > 0) {
-		v = v * efactor;
-		--exp;
-	}
-
-	while (exp < 0) {
-		v = v / efactor;
-		++exp;
-	}
-
-	if (c != EOF)
-		__ungetc(c, f, numchar);
-
-	*dest = sign * v;
-	return EOK;
-}
-
-/* Read characters from stream */
-static errno_t __fgetchars(FILE *f, int *numchar, size_t width,
-    strbuf_t *strbuf, size_t *nread)
-{
-	size_t cnt;
-	int c;
-	errno_t rc;
-
-	*nread = 0;
-	for (cnt = 0; cnt < width; cnt++) {
-		c = __fgetc(f, numchar);
-		if (c == EOF) {
-			*nread = cnt;
-			return EIO;
-		}
-
-		rc = strbuf_write(strbuf, cnt, c);
-		if (rc != EOK) {
-			*nread = cnt;
-			return rc;
-		}
-	}
-
-	*nread = cnt;
-	return EOK;
-}
-
-/* Read non-whitespace string from stream */
-static errno_t __fgetstr(FILE *f, int *numchar, size_t width, strbuf_t *strbuf,
-    size_t *nread)
-{
-	size_t cnt;
-	int c;
-	errno_t rc;
-	errno_t rc2;
-
-	*nread = 0;
-
-	rc = vfscanf_skip_ws(f, numchar);
-	if (rc == EIO)
-		return EIO;
-
-	rc = EOK;
-
-	for (cnt = 0; cnt < width; cnt++) {
-		c = __fgetc(f, numchar);
-		if (c == EOF) {
-			rc = EIO;
-			break;
-		}
-
-		if (isspace(c)) {
-			__ungetc(c, f, numchar);
-			break;
-		}
-
-		rc = strbuf_write(strbuf, cnt, c);
-		if (rc != EOK) {
-			*nread = cnt;
-			return rc;
-		}
-	}
-
-	/* Null-terminate */
-	rc2 = strbuf_write(strbuf, cnt, '\0');
-	if (rc2 != EOK) {
-		*nread = cnt;
-		return rc2;
-	}
-
-	*nread = cnt;
-	return rc;
-}
-
-/** Determine if character is in scanset.
- *
- * Note that we support ranges, although that is a GNU extension.
- *
- * @param c Character
- * @param scanset Pointer to scanset
- * @return @c true iff @a c is in scanset @a scanset.
- */
-static bool is_in_scanset(char c, const char *scanset)
-{
-	const char *p = scanset;
-	bool inverted = false;
-	char startc;
-	char endc;
-
-	/* Inverted scanset */
-	if (*p == '^') {
-		inverted = true;
-		++p;
-	}
-
-	/*
-	 * Either ']' or '-' at beginning or after '^' loses special meaning.
-	 * However, '-' after ']' (or vice versa) does not.
-	 */
-	if (*p == ']') {
-		/* ']' character in scanset */
-		if (c == ']')
-			return !inverted;
-		++p;
-	} else if (*p == '-') {
-		/* '-' character in scanset */
-		if (c == '-')
-			return !inverted;
-		++p;
-	}
-
-	/* Remaining characters */
-	while (*p != '\0' && *p != ']') {
-		/* '-' is a range unless it's the last character in scanset */
-		if (*p == '-' && p[1] != ']' && p[1] != '\0') {
-			startc = p[-1];
-			endc = p[1];
-
-			if (c >= startc && c <= endc)
-				return !inverted;
-
-			p += 2;
-			continue;
-		}
-
-		if (*p == c)
-			return !inverted;
-		++p;
-	}
-
-	return inverted;
-}
-
-/* Read string of characters from scanset from stream */
-static errno_t __fgetscanstr(FILE *f, int *numchar, size_t width,
-    const char *scanset, strbuf_t *strbuf, size_t *nread)
-{
-	size_t cnt;
-	int c;
-	errno_t rc;
-	errno_t rc2;
-
-	rc = EOK;
-
-	for (cnt = 0; cnt < width; cnt++) {
-		c = __fgetc(f, numchar);
-		if (c == EOF) {
-			rc = EIO;
-			break;
-		}
-
-		if (!is_in_scanset(c, scanset)) {
-			__ungetc(c, f, numchar);
-			break;
-		}
-
-		rc = strbuf_write(strbuf, cnt, c);
-		if (rc != EOK) {
-			*nread = cnt;
-			break;
-		}
-	}
-
-	/* Null-terminate */
-	rc2 = strbuf_write(strbuf, cnt, '\0');
-	if (rc2 != EOK) {
-		*nread = cnt;
-		return rc2;
-	}
-
-	*nread = cnt;
-	return rc;
-}
-
-/** Perform a single conversion. */
-static errno_t vfscanf_cvt(FILE *f, const char **fmt, va_encaps_t *va,
-    int *numchar, unsigned *ncvt)
-{
-	errno_t rc;
-	int c;
-	intmax_t ival;
-	uintmax_t uval;
-	long double fval = 0.0;
-	int *iptr;
-	short *sptr;
-	signed char *scptr;
-	long *lptr;
-	long long *llptr;
-	ssize_t *ssptr;
-	ptrdiff_t *pdptr;
-	intmax_t *imptr;
-	unsigned *uptr;
-	unsigned short *usptr;
-	unsigned char *ucptr;
-	unsigned long *ulptr;
-	unsigned long long *ullptr;
-	float *fptr;
-	double *dptr;
-	long double *ldptr;
-	size_t *szptr;
-	ptrdiff_t *updptr;
-	uintmax_t *umptr;
-	void **pptr;
-	size_t width;
-	cvtspec_t cvtspec;
-	strbuf_t strbuf;
-	size_t nread;
-
-	++(*fmt);
-
-	cvtspec_parse(fmt, &cvtspec);
-
-	width = cvtspec.have_width ? cvtspec.width : SIZE_MAX;
-
-	switch (cvtspec.spcr) {
-	case cs_percent:
-		/* Match % character */
-		rc = vfscanf_skip_ws(f, numchar);
-		if (rc == EOF)
-			return EIO;
-
-		c = __fgetc(f, numchar);
-		if (c == EOF)
-			return EIO;
-		if (c != '%') {
-			__ungetc(c, f, numchar);
-			return EINVAL;
-		}
-		break;
-	case cs_decimal:
-		/* Decimal integer */
-		rc = __fstrtoimax(f, numchar, 10, width, &ival);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_udecimal:
-		/* Decimal unsigned integer */
-		rc = __fstrtoumax(f, numchar, 10, width, &uval);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_octal:
-		/* Octal unsigned integer */
-		rc = __fstrtoumax(f, numchar, 8, width, &uval);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_hex:
-		/* Hexadecimal unsigned integer */
-		rc = __fstrtoumax(f, numchar, 16, width, &uval);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_float:
-		/* Floating-point value */
-		rc = __fstrtold(f, numchar, width, &fval);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_int:
-		/* Signed integer with base detection */
-		rc = __fstrtoimax(f, numchar, 0, width, &ival);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_ptr:
-		/* Unsigned integer with base detection (need 0xXXXXX) */
-		rc = __fstrtoumax(f, numchar, 0, width, &uval);
-		if (rc != EOK)
-			return rc;
-		break;
-	case cs_char:
-		/* Characters */
-		rc = strbuf_init(&strbuf, &cvtspec, va);
-		if (rc != EOK)
-			return rc;
-
-		width = cvtspec.have_width ? cvtspec.width : 1;
-		rc = __fgetchars(f, numchar, width, &strbuf, &nread);
-		if (rc != EOK) {
-			if (rc == ENOMEM)
-				return EIO;
-
-			assert(rc == EIO);
-			/* If we have at least one char, we succeeded */
-			if (nread > 0)
-				++(*ncvt);
-			return EIO;
-		}
-		break;
-	case cs_str:
-		/* Non-whitespace string */
-		rc = strbuf_init(&strbuf, &cvtspec, va);
-		if (rc != EOK)
-			return rc;
-
-		width = cvtspec.have_width ? cvtspec.width : SIZE_MAX;
-		rc = __fgetstr(f, numchar, width, &strbuf, &nread);
-		if (rc != EOK) {
-			if (rc == ENOMEM)
-				return EIO;
-
-			assert(rc == EIO);
-			/* If we have at least one char, we succeeded */
-			if (nread > 0)
-				++(*ncvt);
-			return EIO;
-		}
-		break;
-	case cs_set:
-		/* String of characters from scanset */
-		rc = strbuf_init(&strbuf, &cvtspec, va);
-		if (rc != EOK)
-			return rc;
-
-		width = cvtspec.have_width ? cvtspec.width : SIZE_MAX;
-		rc = __fgetscanstr(f, numchar, width, cvtspec.scanset,
-		    &strbuf, &nread);
-		if (rc != EOK) {
-			if (rc == ENOMEM)
-				return EIO;
-
-			assert(rc == EIO);
-			/* If we have at least one char, we succeeded */
-			if (nread > 0)
-				++(*ncvt);
-			return EIO;
-		}
-		break;
-	case cs_numchar:
-		break;
-	default:
-		return EINVAL;
-	}
-
-	/* Assignment */
-
-	if (cvtspec.noassign)
-		goto skip_assign;
-
-	switch (cvtspec.spcr) {
-	case cs_percent:
-		break;
-	case cs_decimal:
-	case cs_int:
-		switch (cvtspec.lenmod) {
-		case lm_none:
-			iptr = va_arg(va->ap, int *);
-			*iptr = ival;
-			break;
-		case lm_hh:
-			scptr = va_arg(va->ap, signed char *);
-			*scptr = ival;
-			break;
-		case lm_h:
-			sptr = va_arg(va->ap, short *);
-			*sptr = ival;
-			break;
-		case lm_l:
-			lptr = va_arg(va->ap, long *);
-			*lptr = ival;
-			break;
-		case lm_ll:
-			llptr = va_arg(va->ap, long long *);
-			*llptr = ival;
-			break;
-		case lm_j:
-			imptr = va_arg(va->ap, intmax_t *);
-			*imptr = ival;
-			break;
-		case lm_z:
-			ssptr = va_arg(va->ap, ssize_t *);
-			*ssptr = ival;
-			break;
-		case lm_t:
-			pdptr = va_arg(va->ap, ptrdiff_t *);
-			*pdptr = ival;
-			break;
-		default:
-			assert(false);
-		}
-
-		++(*ncvt);
-		break;
-	case cs_udecimal:
-	case cs_octal:
-	case cs_hex:
-		switch (cvtspec.lenmod) {
-		case lm_none:
-			uptr = va_arg(va->ap, unsigned *);
-			*uptr = uval;
-			break;
-		case lm_hh:
-			ucptr = va_arg(va->ap, unsigned char *);
-			*ucptr = uval;
-			break;
-		case lm_h:
-			usptr = va_arg(va->ap, unsigned short *);
-			*usptr = uval;
-			break;
-		case lm_l:
-			ulptr = va_arg(va->ap, unsigned long *);
-			*ulptr = uval;
-			break;
-		case lm_ll:
-			ullptr = va_arg(va->ap, unsigned long long *);
-			*ullptr = uval;
-			break;
-		case lm_j:
-			umptr = va_arg(va->ap, uintmax_t *);
-			*umptr = uval;
-			break;
-		case lm_z:
-			szptr = va_arg(va->ap, size_t *);
-			*szptr = uval;
-			break;
-		case lm_t:
-			updptr = va_arg(va->ap, ptrdiff_t *);
-			*updptr = uval;
-			break;
-		default:
-			assert(false);
-		}
-
-		++(*ncvt);
-		break;
-	case cs_float:
-		switch (cvtspec.lenmod) {
-		case lm_none:
-			fptr = va_arg(va->ap, float *);
-			*fptr = fval;
-			break;
-		case lm_l:
-			dptr = va_arg(va->ap, double *);
-			*dptr = fval;
-			break;
-		case lm_L:
-			ldptr = va_arg(va->ap, long double *);
-			*ldptr = fval;
-			break;
-		default:
-			assert(false);
-		}
-
-		++(*ncvt);
-		break;
-	case cs_ptr:
-		pptr = va_arg(va->ap, void *);
-		*pptr = (void *)(uintptr_t)uval;
-		++(*ncvt);
-		break;
-	case cs_char:
-		++(*ncvt);
-		break;
-	case cs_str:
-		++(*ncvt);
-		break;
-	case cs_set:
-		++(*ncvt);
-		break;
-	case cs_numchar:
-		/* Store number of characters read so far. */
-		iptr = va_arg(va->ap, int *);
-		*iptr = *numchar;
-		/* No incrementing of ncvt */
-		break;
-	default:
-		return EINVAL;
-	}
-
-skip_assign:
-
-	return EOK;
-}
-
-int vfscanf(FILE *f, const char *fmt, va_list ap)
-{
-	const char *cp;
-	int c;
-	unsigned ncvt;
-	int numchar;
-	bool input_error = false;
-	va_encaps_t va;
-	int rc;
-
-	va_copy(va.ap, ap);
-
-	ncvt = 0;
-	numchar = 0;
-	cp = fmt;
-	while (*cp != '\0') {
-		if (isspace(*cp)) {
-			/* Whitespace */
-			rc = vfscanf_match_ws(f, &numchar, &cp);
-			if (rc == EIO) {
-				input_error = true;
-				break;
-			}
-
-			assert(rc == EOK);
-		} else if (*cp == '%') {
-			/* Conversion specification */
-			rc = vfscanf_cvt(f, &cp, &va, &numchar,
-			    &ncvt);
-			if (rc == EIO) {
-				/* Input error */
-				input_error = true;
-				break;
-			}
-
-			/* Other error */
-			if (rc != EOK)
-				break;
-		} else {
-			/* Match specific character */
-			c = __fgetc(f, &numchar);
-			if (c == EOF) {
-				input_error = true;
-				break;
-			}
-
-			if (c != *cp) {
-				__ungetc(c, f, &numchar);
-				break;
-			}
-
-			++cp;
-		}
-	}
-
-	if (input_error && ncvt == 0)
-		return EOF;
-
-	return ncvt;
-}
-
-int fscanf(FILE *f, const char *fmt, ...)
-{
-	va_list args;
-	int rc;
-
-	va_start(args, fmt);
-	rc = vfscanf(f, fmt, args);
-	va_end(args);
-
-	return rc;
-}
-
-int vscanf(const char *fmt, va_list ap)
-{
-	return vfscanf(stdin, fmt, ap);
-}
-
-int scanf(const char *fmt, ...)
-{
-	va_list args;
-	int rc;
-
-	va_start(args, fmt);
-	rc = vscanf(fmt, args);
-	va_end(args);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio/sprintf.c
===================================================================
--- uspace/lib/c/generic/stdio/sprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <limits.h>
-
-/** Print formatted to string.
- *
- * This function is unsafe, thus it is marked as deprecated. It should never
- * be used in native HelenOS code.
- *
- * @param str Buffer to write to
- * @param fmt Format string
- *
- * @return Number of characters printed on success, negative value on failure
- */
-int sprintf(char *s, const char *fmt, ...)
-{
-	int rc;
-
-	va_list args;
-	va_start(args, fmt);
-	rc = vsnprintf(s, INT_MAX, fmt, args);
-	va_end(args);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio/sscanf.c
===================================================================
--- uspace/lib/c/generic/stdio/sscanf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief sscanf, vsscanf
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include "../private/stdio.h"
-#include "../private/sstream.h"
-
-int vsscanf(const char *s, const char *fmt, va_list ap)
-{
-	FILE f;
-
-	__sstream_init(s, &f);
-	return vfscanf(&f, fmt, ap);
-}
-
-int sscanf(const char *s, const char *fmt, ...)
-{
-	va_list args;
-	int rc;
-
-	va_start(args, fmt);
-	rc = vsscanf(s, fmt, args);
-	va_end(args);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio/sstream.c
===================================================================
--- uspace/lib/c/generic/stdio/sstream.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <errno.h>
-#include <adt/list.h>
-#include <uchar.h>
-#include "../private/stdio.h"
-#include "../private/sstream.h"
-
-static size_t stdio_str_read(void *, size_t, size_t, FILE *);
-static size_t stdio_str_write(const void *, size_t, size_t, FILE *);
-static int stdio_str_flush(FILE *);
-
-static __stream_ops_t stdio_str_ops = {
-	.read = stdio_str_read,
-	.write = stdio_str_write,
-	.flush = stdio_str_flush
-};
-
-/** Read from string stream. */
-static size_t stdio_str_read(void *buf, size_t size, size_t nmemb, FILE *stream)
-{
-	size_t nread;
-	char *cp = (char *)stream->arg;
-	char *bp = (char *)buf;
-
-	nread = 0;
-	while (nread < size * nmemb) {
-		if (*cp == '\0') {
-			stream->eof = true;
-			break;
-		}
-
-		bp[nread] = *cp;
-		++nread;
-		++cp;
-		stream->arg = (void *)cp;
-	}
-
-	return (nread / size);
-}
-
-/** Write to string stream. */
-static size_t stdio_str_write(const void *buf, size_t size, size_t nmemb,
-    FILE *stream)
-{
-	return 0;
-}
-
-/** Flush string stream. */
-static int stdio_str_flush(FILE *stream)
-{
-	return EOF;
-}
-
-/** Initialize string stream.
- *
- * @param str String used as backend for reading
- * @param stream Stream to initialize
- */
-void __sstream_init(const char *str, FILE *stream)
-{
-	memset(stream, 0, sizeof(FILE));
-	stream->ops = &stdio_str_ops;
-	stream->arg = (void *)str;
-}
-
-/** Return current string stream position.
- *
- * @param stream String stream
- * @return Pointer into the backing string at the current position
- */
-const char *__sstream_getpos(FILE *stream)
-{
-	assert(stream->ops == &stdio_str_ops);
-	return (char *) stream->arg;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdio/vsprintf.c
===================================================================
--- uspace/lib/c/generic/stdio/vsprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <limits.h>
-
-/** Print formatted to string with arguments passed as va_list.
- *
- * This function is unsafe, thus it is marked as deprecated. It should never
- * be used in native HelenOS code.
- *
- * @param str Buffer to write to
- * @param fmt Format string
- * @param ap Arguments
- *
- * @return Number of characters printed on success, negative value on failure
- */
-int vsprintf(char *s, const char *fmt, va_list ap)
-{
-	return vsnprintf(s, INT_MAX, fmt, ap);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/stdlib.c
===================================================================
--- uspace/lib/c/generic/stdlib.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,339 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "private/libc.h"
-#include "private/scanf.h"
-#include "private/stdlib.h"
-#include "private/stdio.h"
-#include "private/sstream.h"
-
-static int glbl_seed = 1;
-
-static LIST_INITIALIZE(exit_handlers);
-static FIBRIL_MUTEX_INITIALIZE(exit_handlers_lock);
-
-static LIST_INITIALIZE(quick_exit_handlers);
-static FIBRIL_MUTEX_INITIALIZE(quick_exit_handlers_lock);
-
-/** Convert string to long double.
- *
- */
-long double strtold(const char *nptr, char **endptr)
-{
-	int numchar;
-	long double ld;
-	errno_t rc;
-	FILE f;
-
-	numchar = 0;
-	__sstream_init(nptr, &f);
-
-	rc = __fstrtold(&f, &numchar, SIZE_MAX, &ld);
-	if (rc != EOK) {
-		ld = 0;
-		if (endptr != NULL)
-			*endptr = (char *) nptr;
-		errno = rc;
-	} else {
-		if (endptr != NULL)
-			*endptr = (char *) __sstream_getpos(&f);
-	}
-
-	return ld;
-}
-
-int rand(void)
-{
-	return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX);
-}
-
-void srand(unsigned int seed)
-{
-	glbl_seed = seed % RAND_MAX;
-}
-
-/** Register exit handler.
- *
- * @param func Function to be called during program terimnation
- * @return Zero on success, nonzero on failure
- */
-int atexit(void (*func)(void))
-{
-	__exit_handler_t *entry;
-
-	entry = malloc(sizeof(__exit_handler_t));
-	if (entry == NULL)
-		return -1;
-
-	entry->func = func;
-
-	fibril_mutex_lock(&exit_handlers_lock);
-	list_prepend(&entry->llist, &exit_handlers);
-	fibril_mutex_unlock(&exit_handlers_lock);
-	return 0;
-}
-
-/** Terminate program with exit status.
- *
- * @param status Exit status
- */
-void exit(int status)
-{
-	link_t *link;
-	__exit_handler_t *eh;
-
-	/* Call exit handlers */
-	fibril_mutex_lock(&exit_handlers_lock);
-	while (!list_empty(&exit_handlers)) {
-		link = list_first(&exit_handlers);
-		list_remove(link);
-		fibril_mutex_unlock(&exit_handlers_lock);
-
-		eh = list_get_instance(link, __exit_handler_t, llist);
-		eh->func();
-		free(eh);
-		fibril_mutex_lock(&exit_handlers_lock);
-	}
-
-	fibril_mutex_unlock(&exit_handlers_lock);
-
-	_Exit(status);
-}
-
-/** Register quick exit handler.
- *
- * @param func Function to be called during quick program terimnation
- * @return Zero on success, nonzero on failure
- */
-int at_quick_exit(void (*func)(void))
-{
-	__exit_handler_t *entry;
-
-	entry = malloc(sizeof(__exit_handler_t));
-	if (entry == NULL)
-		return -1;
-
-	entry->func = func;
-
-	fibril_mutex_lock(&exit_handlers_lock);
-	list_prepend(&entry->llist, &exit_handlers);
-	fibril_mutex_unlock(&exit_handlers_lock);
-	return 0;
-}
-
-/** Quickly terminate program with exit status.
- *
- * @param status Exit status
- */
-void quick_exit(int status)
-{
-	link_t *link;
-	__exit_handler_t *eh;
-
-	/* Call quick exit handlers */
-	fibril_mutex_lock(&quick_exit_handlers_lock);
-	while (!list_empty(&quick_exit_handlers)) {
-		link = list_first(&quick_exit_handlers);
-		list_remove(link);
-		fibril_mutex_unlock(&quick_exit_handlers_lock);
-
-		eh = list_get_instance(link, __exit_handler_t, llist);
-		eh->func();
-		free(eh);
-		fibril_mutex_lock(&quick_exit_handlers_lock);
-	}
-
-	fibril_mutex_unlock(&quick_exit_handlers_lock);
-
-	_Exit(status);
-}
-
-void _Exit(int status)
-{
-	__libc_exit(status);
-}
-
-/** Abnormal program termination */
-void abort(void)
-{
-	__libc_abort();
-}
-
-/** Get environment list entry.
- *
- * Note that this function is not reentrant. The returned string is only
- * guaranteed to be valid until the next call to @c getenv.
- *
- * @param name Entry name
- * @return Pointer to string or @c NULL if not found
- */
-char *getenv(const char *name)
-{
-	(void) name;
-	return NULL;
-}
-
-/** Execute command.
- *
- * @param string Command to execute or @c NULL
- *
- * @return If @a string is @c NULL, return zero (no command processor
- *         available). If @a string is not @c NULL, return 1 (failure).
- */
-int system(const char *string)
-{
-	if (string == NULL)
-		return 0;
-
-	return 1;
-}
-
-/** Compute the absolute value of an integer.
- *
- * If the result cannot be represented, the behavior is undefined.
- *
- * @param j Integer
- * @return The absolute value of @a j
- */
-int abs(int j)
-{
-	int aj;
-
-	if (j < 0) {
-		aj = -j;
-		assert(aj >= 0);
-	} else {
-		aj = j;
-	}
-
-	return aj;
-}
-
-/** Compute the absolute value of a long integer.
- *
- * If the result cannot be represented, the behavior is undefined.
- *
- * @param j Long integer
- * @return The absolute value of @a j
- */
-long labs(long j)
-{
-	long aj;
-
-	if (j < 0) {
-		aj = -j;
-		assert(aj >= 0);
-	} else {
-		aj = j;
-	}
-
-	return aj;
-}
-
-/** Compute the absolute value of a long long integer.
- *
- * If the result cannot be represented, the behavior is undefined.
- *
- * @param j Long long integer
- * @return The absolute value of @a j
- */
-long long llabs(long long j)
-{
-	long long aj;
-
-	if (j < 0) {
-		aj = -j;
-		assert(aj >= 0);
-	} else {
-		aj = j;
-	}
-
-	return aj;
-}
-
-/** Compute quotient and remainder of int division.
- *
- * @param numer Numerator
- * @param denom Denominator
- * @return Structure containing quotient and remainder
- */
-div_t div(int numer, int denom)
-{
-	div_t d;
-
-	d.quot = numer / denom;
-	d.rem = numer % denom;
-
-	return d;
-}
-
-/** Compute quotient and remainder of long division.
- *
- * @param numer Numerator
- * @param denom Denominator
- * @return Structure containing quotient and remainder
- */
-ldiv_t ldiv(long numer, long denom)
-{
-	ldiv_t d;
-
-	d.quot = numer / denom;
-	d.rem = numer % denom;
-
-	return d;
-}
-
-/** Compute quotient and remainder of long long division.
- *
- * @param numer Numerator
- * @param denom Denominator
- * @return Structure containing quotient and remainder
- */
-lldiv_t lldiv(long long numer, long long denom)
-{
-	lldiv_t d;
-
-	d.quot = numer / denom;
-	d.rem = numer % denom;
-
-	return d;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/string.c
===================================================================
--- uspace/lib/c/generic/string.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,572 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <string.h>
-
-/** Copy string.
- *
- * Copy the string pointed to by @a s2 to the array pointed to by @a s1
- * including the terminating null character. The source and destination
- * must not overlap.
- *
- * @param s1 Destination array
- * @param s2 Source string
- * @return @a s1
- */
-char *strcpy(char *s1, const char *s2)
-{
-	char *dp = s1;
-
-	/* Copy characters */
-	while (*s2 != '\0')
-		*dp++ = *s2++;
-
-	/* Copy the terminating null character */
-	*dp++ = *s2++;
-
-	return s1;
-}
-
-/** Copy not more than @a n characters.
- *
- * Copy not more than @a n characters from  @a s2 to @a s1. Characters
- * following a null character are not copied. If The string @a s2 is
- * shorter than @a n characters, null characters are appended to the
- * copy in @a s1, until @a n characters in all have been written.
- *
- * (I.e. @a s1 is padded with null characters up to size @a n).
- * The source and destination must not overlap.
- *
- * @param s1 Destination array
- * @param s2 Source string
- * @param n Number of characters to copy
- * @return @a s1
- */
-char *strncpy(char *s1, const char *s2, size_t n)
-{
-	char *dp = s1;
-	size_t i;
-
-	for (i = 0; i < n; i++) {
-		*dp++ = *s2;
-		if (*s2 != '\0')
-			++s2;
-	}
-
-	return s1;
-}
-
-/** Append string.
- *
- * Append a copy of string in @a s2 to the string pointed to by @a s1
- * (including the terminating null character). @a s1 and @a s2 must not
- * overlap.
- *
- * @param s1 Destination buffer holding a string to be appended to
- * @param s2 String to be appended
- * @return @a s1
- */
-char *strcat(char *s1, const char *s2)
-{
-	char *dp = s1;
-
-	/* Find end of first string */
-	while (*dp != '\0')
-		++dp;
-
-	/* Copy second string */
-	while (*s2 != '\0')
-		*dp++ = *s2++;
-
-	/* Copy null character */
-	*dp = '\0';
-
-	return s1;
-}
-
-/** Append not more than @a n characters.
- *
- * Append a copy of max. @a n characters from string in @a s2 to the string
- * pointed to by @a s1. The resulting string is always null-terminated.
- *
- * @param s1 Destination buffer holding a string to be appended to
- * @param s2 String to be appended
- * @param n Maximum number of characters to copy
- * @return @a s1
- */
-char *strncat(char *s1, const char *s2, size_t n)
-{
-	char *dp = s1;
-
-	/* Find end of first string */
-	while (*dp != '\0')
-		++dp;
-
-	/* Copy second string */
-	while (*s2 != '\0' && n > 0) {
-		*dp++ = *s2++;
-		--n;
-	}
-
-	/* Copy null character */
-	*dp = '\0';
-
-	return s1;
-}
-
-/** Compare two strings.
- *
- * @param s1 First string
- * @param s2 Second string
- * @return Greater than, equal to, less than zero if @a s1 > @a s2,
- *         @a s1 == @a s2, @a s1 < @a s2, resp.
- */
-int strcmp(const char *s1, const char *s2)
-{
-	while (*s1 == *s2 && *s1 != '\0') {
-		++s1;
-		++s2;
-	}
-
-	return *s1 - *s2;
-}
-
-/** Compare two strings based on LC_COLLATE of current locale.
- *
- * @param s1 First string
- * @param s2 Second string
- * @return Greater than, equal to, less than zero if @a s1 > @a s2,
- *         @a s1 == @a s2, @a s1 < @a s2, resp.
- */
-int strcoll(const char *s1, const char *s2)
-{
-	/* Note: we don't support locale other than "C" */
-	return strcmp(s1, s2);
-}
-
-/** Compare not more than @a n characters.
- *
- * @param s1 First string
- * @param s2 Second string
- * @param n Maximum number of characters to compare
- * @return Greater than, equal to, less than zero if @a s1 > @a s2,
- *         @a s1 == @a s2, @a s1 < @a s2, resp. (within the first @a n chars.)
- */
-int strncmp(const char *s1, const char *s2, size_t n)
-{
-	while (*s1 == *s2 && *s1 != '\0' && n > 0) {
-		++s1;
-		++s2;
-		--n;
-	}
-
-	if (n > 0)
-		return *s1 - *s2;
-
-	return 0;
-}
-
-/** Transform string for collation.
- *
- * Transform string in @a s2 to the buffer @a s1, writing no more than
- * @a n characters (including the terminating null character). The transformed
- * string is such that using strcmp on two transformed strings should be
- * equivalent to using strcoll on the original strings.
- *
- * @param s1 Destination buffer
- * @param s2 Source string
- * @param n Max. number of characters to write (including terminating null)
- * @return Length of the transformed string not including the null terminator.
- *         If the value returned is @a n or more, the contents of the buffer
- *         pointed to by @a s1 are undefined.
- */
-size_t strxfrm(char *s1, const char *s2, size_t n)
-{
-	size_t i;
-	size_t len;
-
-	len = strlen(s2);
-
-	for (i = 0; i < n; i++) {
-		*s1++ = *s2;
-		if (*s2 == '\0')
-			break;
-		++s2;
-	}
-
-	return len;
-}
-
-/** Find the first occurrence of a character in a string.
- *
- * The character @a c is converted to char. The null character is
- * considered part of the string.
- *
- * @param s String
- * @param c Character
- * @return Pointer to the located character or @c NULL if the character
- *         does not occur in the string.
- */
-char *strchr(const char *s, int c)
-{
-	do {
-		if (*s == (char) c)
-			return (char *) s;
-	} while (*s++ != '\0');
-
-	return NULL;
-}
-
-/** Compute the size of max. initial segment consisting of a complementary
- * set of characters.
- *
- * Compute the size of the max. initial segment of @a s1 consisting only
- * of characters *not* from @a s2.
- *
- * @param s1 String to search
- * @param s2 String containing set of characters
- * @return Size of initial segment of @a s1 consisting only of characters
- *         not from @a s2.
- */
-size_t strcspn(const char *s1, const char *s2)
-{
-	char *p;
-	size_t n;
-
-	n = 0;
-	while (*s1 != '\0') {
-		/* Look for current character in s2 */
-		p = strchr(s2, *s1);
-
-		/* If found, return current character count. */
-		if (p != NULL)
-			break;
-
-		++s1;
-		++n;
-	}
-
-	return n;
-}
-
-/** Search string for occurrence of any of a set of characters.
- *
- * @param s1 String to search
- * @param s2 String containing a set of characters
- *
- * @return Pointer to first character found or @c NULL if not found
- */
-char *strpbrk(const char *s1, const char *s2)
-{
-	char *p;
-
-	while (*s1 != '\0') {
-		/* Look for current character in s2 */
-		p = strchr(s2, *s1);
-
-		/* If found, return pointer to current character. */
-		if (p != NULL)
-			return (char *) s1;
-
-		++s1;
-	}
-
-	return NULL;
-}
-
-/** Find the last occurrence of a character in a string.
- *
- * The character @a c is converted to char. The null character is
- * considered part of the string.
- *
- * @param s String
- * @param c Character
- * @return Pointer to the located character or @c NULL if the character
- *         does not occur in the string.
- */
-char *strrchr(const char *s, int c)
-{
-	size_t i = strlen(s);
-
-	while (i > 0) {
-		if (s[i] == (char) c)
-			return (char *)s + i;
-		--i;
-	}
-
-	return NULL;
-}
-
-/** Compute the size of max. initial segment consisting of a set of characters.
- *
- * Compute tha size of the max. initial segment of @a s1 consisting only
- * of characters from @a s2.
- *
- * @param s1 String to search
- * @param s2 String containing set of characters
- * @return Size of initial segment of @a s1 consisting only of characters
- *         from @a s2.
- */
-size_t strspn(const char *s1, const char *s2)
-{
-	char *p;
-	size_t n;
-
-	n = 0;
-	while (*s1 != '\0') {
-		/* Look for current character in s2 */
-		p = strchr(s2, *s1);
-
-		/* If not found, return current character count. */
-		if (p == NULL)
-			break;
-
-		++s1;
-		++n;
-	}
-
-	return n;
-}
-
-/** Find occurrence of substring in a string.
- *
- * Find the first occurrence in @a s1 of the characters in @a s2, excluding
- * the terminating null character. If s2 is an empty string, returns @a s1.
- *
- * @param s1 String to search
- * @param s2 Sequence of characters to find
- *
- * @return Pointer inside @a s1 or @c NULL if not found.
- */
-char *strstr(const char *s1, const char *s2)
-{
-	size_t len;
-
-	/*
-	 * Naive search algorithm.
-	 *
-	 * Two-Way String-Matching might be a plausible alternative
-	 * for larger haystack+needle combinations.
-	 */
-
-	len = strlen(s2);
-	while (*s1 != '\0') {
-		if (strncmp(s1, s2, len) == 0)
-			return (char *) s1;
-		++s1;
-	}
-
-	return NULL;
-}
-
-/** Tokenize a string (reentrant).
- *
- * The contents of @a s1 are modified (the separators get overwritten by null
- * characters). The separators can be different each iteration, their identity\
- * is, however, lost.
- *
- * @param s1 String buffer to get the first token, @c NULL to get the next
- *           token
- * @param s2 String containing current separators
- * @return Pointer to the next token
- */
-char *__strtok_r(char *s1, const char *s2, char **saveptr)
-{
-	char *s;
-	char *tbegin;
-	char *tend;
-
-	if (s1 != NULL) {
-		/* Starting tokenization of a new string */
-		s = s1;
-	} else {
-		/* Use saved position of next token */
-		s = *saveptr;
-
-		/* Check if we ran out of tokens */
-		if (s == NULL)
-			return NULL;
-	}
-
-	/* Find position of first character that is not a separator */
-	tbegin = s;
-	while (*tbegin != '\0' && strchr(s2, *tbegin) != NULL)
-		++tbegin;
-
-	/* If no such character is found, there are no tokens */
-	if (*tbegin == '\0')
-		return NULL;
-
-	/* Find first character that is a separator */
-	tend = strpbrk(tbegin, s2);
-	if (tend != NULL) {
-		/* Overwrite the separator, next token starts just after */
-		*tend = '\0';
-		*saveptr = tend + 1;
-	} else {
-		/* No more tokens will be returned next time */
-		*saveptr = NULL;
-	}
-
-	return tbegin;
-}
-
-/** Saved position of next token for function strtok */
-static char *strtok_saveptr = NULL;
-
-/** Tokenize a string.
- *
- * This function has internal state and thus is not reentrant.
- * ISO C says the implementation should behave as if no (standard) library
- * call calls strtok. The contents of @a s1 are modified (the separators
- * get overwritten by null characters). The separators can be different
- * each iteration, their identity is, however, lost.
- *
- * Never use this function since it's not reentrant.
- *
- * @param s1 String buffer to get the first token, @c NULL to get the next
- *           token
- * @param s2 String containing current separators
- * @return Pointer to the next token
- */
-char *strtok(char *s1, const char *s2)
-{
-	return __strtok_r(s1, s2, &strtok_saveptr);
-}
-
-/** Map error number to a string.
- *
- * The string returned by the function may be overwritten by a subsequent
- * call to strerror (ISO C). In our implementation the function is, in fact,
- * reentrant, as the string returned is static and never modified.
- *
- * @param errnum Error number
- * @return Pointer to error message
- */
-char *strerror(int errnum)
-{
-	return (char *) str_error(errnum);
-}
-
-/** Return number of characters in string.
- *
- * @param s String
- * @return Number of characters preceding the null character.
- */
-size_t strlen(const char *s)
-{
-	size_t n;
-
-	n = 0;
-	while (*s != '\0') {
-		++s;
-		++n;
-	}
-
-	return n;
-}
-
-/** Return number of characters in string with length limit.
- *
- * @param s String
- * @param maxlen Maximum number of characters to read
- * @return Number of characters preceding the null character, at most @a maxlen.
- */
-size_t strnlen(const char *s, size_t maxlen)
-{
-	size_t n;
-
-	n = 0;
-	while (n < maxlen && *s != '\0') {
-		++s;
-		++n;
-	}
-
-	return n;
-}
-
-/** Allocate a new duplicate of string.
- *
- * @param s String to duplicate
- * @return New string or @c NULL on failure (in which case @c errno is set
- *         to ENOMEM).
- */
-char *strdup(const char *s)
-{
-	size_t sz;
-	char *dup;
-
-	sz = strlen(s);
-	dup = malloc(sz + 1);
-	if (dup == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	strcpy(dup, s);
-	return dup;
-}
-
-/** Allocate a new duplicate of string with length limit.
- *
- * Creates a new duplicate of @a s. If @a s is longer than @a n characters,
- * only @a n characters are copied and a null character is appended.
- *
- * @param s String to duplicate
- * @param n Maximum number of characters to copy
- * @return New string or @c NULL on failure (in which case @c errno is set
- *         to ENOMEM).
- */
-char *strndup(const char *s, size_t n)
-{
-	size_t sz;
-	char *dup;
-
-	sz = strnlen(s, n);
-	dup = malloc(sz + 1);
-	if (dup == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-
-	strncpy(dup, s, sz);
-	return dup;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/sysinfo.c
===================================================================
--- uspace/lib/c/generic/sysinfo.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-#include <sysinfo.h>
-#include <str.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-/** Get sysinfo keys size
- *
- * @param path  Sysinfo path.
- * @param value Pointer to store the keys size.
- *
- * @return EOK if the keys were successfully read.
- *
- */
-static errno_t sysinfo_get_keys_size(const char *path, size_t *size)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_KEYS_SIZE, (sysarg_t) path,
-	    (sysarg_t) str_size(path), (sysarg_t) size);
-}
-
-/** Get sysinfo keys
- *
- * @param path  Sysinfo path.
- * @param value Pointer to store the keys size.
- *
- * @return Keys read from sysinfo or NULL if the
- *         sysinfo item has no subkeys.
- *         The returned non-NULL pointer should be
- *         freed by free().
- *
- */
-char *sysinfo_get_keys(const char *path, size_t *size)
-{
-	/*
-	 * The size of the keys might change during time.
-	 * Unfortunatelly we cannot allocate the buffer
-	 * and transfer the keys as a single atomic operation.
-	 */
-
-	/* Get the keys size */
-	errno_t ret = sysinfo_get_keys_size(path, size);
-	if ((ret != EOK) || (size == 0)) {
-		/*
-		 * Item with no subkeys.
-		 */
-		*size = 0;
-		return NULL;
-	}
-
-	char *data = malloc(*size);
-	if (data == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	/* Get the data */
-	size_t sz;
-	ret = (errno_t) __SYSCALL5(SYS_SYSINFO_GET_KEYS, (sysarg_t) path,
-	    (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
-	    (sysarg_t) &sz);
-	if (ret == EOK) {
-		*size = sz;
-		return data;
-	}
-
-	free(data);
-	*size = 0;
-	return NULL;
-}
-
-/** Get sysinfo item type
- *
- * @param path Sysinfo path.
- *
- * @return Sysinfo item type.
- *
- */
-sysinfo_item_val_type_t sysinfo_get_val_type(const char *path)
-{
-	return (sysinfo_item_val_type_t) __SYSCALL2(SYS_SYSINFO_GET_VAL_TYPE,
-	    (sysarg_t) path, (sysarg_t) str_size(path));
-}
-
-/** Get sysinfo numerical value
- *
- * @param path  Sysinfo path.
- * @param value Pointer to store the numerical value to.
- *
- * @return EOK if the value was successfully read and
- *         is of SYSINFO_VAL_VAL type.
- *
- */
-errno_t sysinfo_get_value(const char *path, sysarg_t *value)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_VALUE, (sysarg_t) path,
-	    (sysarg_t) str_size(path), (sysarg_t) value);
-}
-
-/** Get sysinfo binary data size
- *
- * @param path Sysinfo path.
- * @param size Pointer to store the binary data size.
- *
- * @return EOK if the value was successfully read and
- *         is of SYSINFO_VAL_DATA type.
- *
- */
-static errno_t sysinfo_get_data_size(const char *path, size_t *size)
-{
-	return (errno_t) __SYSCALL3(SYS_SYSINFO_GET_DATA_SIZE, (sysarg_t) path,
-	    (sysarg_t) str_size(path), (sysarg_t) size);
-}
-
-/** Get sysinfo binary data
- *
- * @param path Sysinfo path.
- * @param size Pointer to store the binary data size.
- *
- * @return Binary data read from sysinfo or NULL if the
- *         sysinfo item value type is not binary data.
- *         The returned non-NULL pointer should be
- *         freed by free().
- *
- */
-void *sysinfo_get_data(const char *path, size_t *size)
-{
-	/*
-	 * The binary data size might change during time.
-	 * Unfortunatelly we cannot allocate the buffer
-	 * and transfer the data as a single atomic operation.
-	 */
-
-	/* Get the binary data size */
-	errno_t ret = sysinfo_get_data_size(path, size);
-	if ((ret != EOK) || (size == 0)) {
-		/*
-		 * Not a binary data item
-		 * or an empty item.
-		 */
-		*size = 0;
-		return NULL;
-	}
-
-	void *data = malloc(*size);
-	if (data == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	/* Get the data */
-	size_t sz;
-	ret = (errno_t) __SYSCALL5(SYS_SYSINFO_GET_DATA, (sysarg_t) path,
-	    (sysarg_t) str_size(path), (sysarg_t) data, (sysarg_t) *size,
-	    (sysarg_t) &sz);
-	if (ret == EOK) {
-		*size = sz;
-		return data;
-	}
-
-	free(data);
-	*size = 0;
-	return NULL;
-}
-
-/** Get sysinfo property
- *
- * @param path Sysinfo path.
- * @param name Property name.
- * @param size Pointer to store the binary data size.
- *
- * @return Property value read from sysinfo or NULL if the
- *         sysinfo item value type is not binary data.
- *         The returned non-NULL pointer should be
- *         freed by free().
- *
- */
-void *sysinfo_get_property(const char *path, const char *name, size_t *size)
-{
-	size_t total_size;
-	void *data = sysinfo_get_data(path, &total_size);
-	if ((data == NULL) || (total_size == 0)) {
-		*size = 0;
-		return NULL;
-	}
-
-	size_t pos = 0;
-	while (pos < total_size) {
-		/* Process each property with sanity checks */
-		size_t cur_size = str_nsize(data + pos, total_size - pos);
-		if (((char *) data)[pos + cur_size] != 0)
-			break;
-
-		bool found = (str_cmp(data + pos, name) == 0);
-
-		pos += cur_size + 1;
-		if (pos >= total_size)
-			break;
-
-		/* Process value size */
-		size_t value_size;
-		memcpy(&value_size, data + pos, sizeof(value_size));
-
-		pos += sizeof(value_size);
-		if ((pos >= total_size) || (pos + value_size > total_size))
-			break;
-
-		if (found) {
-			void *value = malloc(value_size);
-			if (value == NULL)
-				break;
-
-			memcpy(value, data + pos, value_size);
-			free(data);
-
-			*size = value_size;
-			return value;
-		}
-
-		pos += value_size;
-	}
-
-	free(data);
-
-	*size = 0;
-	return NULL;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/task.c
===================================================================
--- uspace/lib/c/generic/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,500 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2008 Jiri Svoboda
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <task.h>
-#include <loader/loader.h>
-#include <stdarg.h>
-#include <str.h>
-#include <ipc/ns.h>
-#include <macros.h>
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <ns.h>
-#include <stdlib.h>
-#include <udebug.h>
-#include <libc.h>
-#include "private/ns.h"
-#include <vfs/vfs.h>
-
-task_id_t task_get_id(void)
-{
-#ifdef __32_BITS__
-	task_id_t task_id;
-	(void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id);
-
-	return task_id;
-#endif  /* __32_BITS__ */
-
-#ifdef __64_BITS__
-	return (task_id_t) __SYSCALL0(SYS_TASK_GET_ID);
-#endif  /* __64_BITS__ */
-}
-
-/** Set the task name.
- *
- * @param name The new name, typically the command used to execute the
- *             program.
- *
- * @return Zero on success or an error code.
- */
-errno_t task_set_name(const char *name)
-{
-	assert(name);
-
-	return (errno_t) __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name));
-}
-
-/** Kill a task.
- *
- * @param task_id ID of task to kill.
- *
- * @return Zero on success or an error code.
- */
-
-errno_t task_kill(task_id_t task_id)
-{
-	return (errno_t) __SYSCALL1(SYS_TASK_KILL, (sysarg_t) &task_id);
-}
-
-/** Create a new task by running an executable from the filesystem.
- *
- * This is really just a convenience wrapper over the more complicated
- * loader API. Arguments are passed as a null-terminated array of strings.
- * A debug session is created optionally.
- *
- * @param id   If not NULL, the ID of the task is stored here on success.
- * @param wait If not NULL, setup waiting for task's return value and store
- *             the information necessary for waiting here on success.
- * @param path Pathname of the binary to execute.
- * @param argv Command-line arguments.
- * @param rsess   Place to store pointer to debug session or @c NULL
- *                not to start a debug session
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnv_debug(task_id_t *id, task_wait_t *wait, const char *path,
-    const char *const args[], async_sess_t **rsess)
-{
-	/* Send default files */
-
-	int fd_stdin = -1;
-	int fd_stdout = -1;
-	int fd_stderr = -1;
-
-	if (stdin != NULL) {
-		(void) vfs_fhandle(stdin, &fd_stdin);
-	}
-
-	if (stdout != NULL) {
-		(void) vfs_fhandle(stdout, &fd_stdout);
-	}
-
-	if (stderr != NULL) {
-		(void) vfs_fhandle(stderr, &fd_stderr);
-	}
-
-	return task_spawnvf_debug(id, wait, path, args, fd_stdin, fd_stdout,
-	    fd_stderr, rsess);
-}
-
-/** Create a new task by running an executable from the filesystem.
- *
- * This is really just a convenience wrapper over the more complicated
- * loader API. Arguments are passed as a null-terminated array of strings.
- *
- * @param id   If not NULL, the ID of the task is stored here on success.
- * @param wait If not NULL, setup waiting for task's return value and store
- *             the information necessary for waiting here on success.
- * @param path Pathname of the binary to execute.
- * @param argv Command-line arguments.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnv(task_id_t *id, task_wait_t *wait, const char *path,
-    const char *const args[])
-{
-	return task_spawnv_debug(id, wait, path, args, NULL);
-}
-
-/** Create a new task by loading an executable from the filesystem.
- *
- * This is really just a convenience wrapper over the more complicated
- * loader API. Arguments are passed as a null-terminated array of strings.
- * Files are passed as null-terminated array of pointers to fdi_node_t.
- * A debug session is created optionally.
- *
- * @param id      If not NULL, the ID of the task is stored here on success.
- * @param wait    If not NULL, setup waiting for task's return value and store.
- * @param path    Pathname of the binary to execute.
- * @param argv    Command-line arguments
- * @param std_in  File to use as stdin
- * @param std_out File to use as stdout
- * @param std_err File to use as stderr
- * @param rsess   Place to store pointer to debug session or @c NULL
- *                not to start a debug session
- *
- * @return Zero on success or an error code
- *
- */
-errno_t task_spawnvf_debug(task_id_t *id, task_wait_t *wait,
-    const char *path, const char *const args[], int fd_stdin, int fd_stdout,
-    int fd_stderr, async_sess_t **rsess)
-{
-	async_sess_t *ksess = NULL;
-
-	/* Connect to a program loader. */
-	errno_t rc;
-	loader_t *ldr = loader_connect(&rc);
-	if (ldr == NULL)
-		return rc;
-
-	bool wait_initialized = false;
-
-	/* Get task ID. */
-	task_id_t task_id;
-	rc = loader_get_task_id(ldr, &task_id);
-	if (rc != EOK)
-		goto error;
-
-	/* Send spawner's current working directory. */
-	rc = loader_set_cwd(ldr);
-	if (rc != EOK)
-		goto error;
-
-	/* Send program binary. */
-	rc = loader_set_program_path(ldr, path);
-	if (rc != EOK)
-		goto error;
-
-	/* Send arguments. */
-	rc = loader_set_args(ldr, args);
-	if (rc != EOK)
-		goto error;
-
-	/* Send files */
-	int root = vfs_root();
-	if (root >= 0) {
-		rc = loader_add_inbox(ldr, "root", root);
-		vfs_put(root);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (fd_stdin >= 0) {
-		rc = loader_add_inbox(ldr, "stdin", fd_stdin);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (fd_stdout >= 0) {
-		rc = loader_add_inbox(ldr, "stdout", fd_stdout);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (fd_stderr >= 0) {
-		rc = loader_add_inbox(ldr, "stderr", fd_stderr);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Load the program. */
-	rc = loader_load_program(ldr);
-	if (rc != EOK)
-		goto error;
-
-	/* Setup waiting for return value if needed */
-	if (wait) {
-		rc = task_setup_wait(task_id, wait);
-		if (rc != EOK)
-			goto error;
-		wait_initialized = true;
-	}
-
-	/* Start a debug session if requested */
-	if (rsess != NULL) {
-		ksess = async_connect_kbox(task_id, &rc);
-		if (ksess == NULL) {
-			/* Most likely debugging support is not compiled in */
-			goto error;
-		}
-
-		rc = udebug_begin(ksess);
-		if (rc != EOK)
-			goto error;
-
-		/*
-		 * Run it, not waiting for response. It would never come
-		 * as the loader is stopped.
-		 */
-		loader_run_nowait(ldr);
-	} else {
-		/* Run it. */
-		rc = loader_run(ldr);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Success */
-	if (id != NULL)
-		*id = task_id;
-	if (rsess != NULL)
-		*rsess = ksess;
-	return EOK;
-
-error:
-	if (ksess != NULL)
-		async_hangup(ksess);
-	if (wait_initialized)
-		task_cancel_wait(wait);
-
-	/* Error exit */
-	loader_abort(ldr);
-	return rc;
-}
-
-/** Create a new task by running an executable from the filesystem.
- *
- * Arguments are passed as a null-terminated array of strings.
- * Files are passed as null-terminated array of pointers to fdi_node_t.
- *
- * @param id      If not NULL, the ID of the task is stored here on success.
- * @param wait    If not NULL, setup waiting for task's return value and store.
- * @param path    Pathname of the binary to execute
- * @param argv    Command-line arguments
- * @param std_in  File to use as stdin
- * @param std_out File to use as stdout
- * @param std_err File to use as stderr
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnvf(task_id_t *id, task_wait_t *wait, const char *path,
-    const char *const args[], int fd_stdin, int fd_stdout, int fd_stderr)
-{
-	return task_spawnvf_debug(id, wait, path, args, fd_stdin, fd_stdout,
-	    fd_stderr, NULL);
-}
-
-/** Create a new task by running an executable from the filesystem.
- *
- * This is really just a convenience wrapper over the more complicated
- * loader API. Arguments are passed in a va_list.
- *
- * @param id   If not NULL, the ID of the task is stored here on success.
- * @param wait If not NULL, setup waiting for task's return value and store
- *             the information necessary for waiting here on success.
- * @param path Pathname of the binary to execute.
- * @param cnt  Number of arguments.
- * @param ap   Command-line arguments.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawn(task_id_t *task_id, task_wait_t *wait, const char *path,
-    int cnt, va_list ap)
-{
-	/* Allocate argument list. */
-	const char **arglist = malloc(cnt * sizeof(const char *));
-	if (arglist == NULL)
-		return ENOMEM;
-
-	/* Fill in arguments. */
-	const char *arg;
-	cnt = 0;
-	do {
-		arg = va_arg(ap, const char *);
-		arglist[cnt++] = arg;
-	} while (arg != NULL);
-
-	/* Spawn task. */
-	errno_t rc = task_spawnv(task_id, wait, path, arglist);
-
-	/* Free argument list. */
-	free(arglist);
-	return rc;
-}
-
-/** Create a new task by running an executable from the filesystem.
- *
- * This is really just a convenience wrapper over the more complicated
- * loader API. Arguments are passed as a null-terminated list of arguments.
- *
- * @param id   If not NULL, the ID of the task is stored here on success.
- * @param wait If not NULL, setup waiting for task's return value and store
- *             the information necessary for waiting here on success.
- * @param path Pathname of the binary to execute.
- * @param ...  Command-line arguments.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t task_spawnl(task_id_t *task_id, task_wait_t *wait, const char *path, ...)
-{
-	/* Count the number of arguments. */
-
-	va_list ap;
-	const char *arg;
-	int cnt = 0;
-
-	va_start(ap, path);
-	do {
-		arg = va_arg(ap, const char *);
-		cnt++;
-	} while (arg != NULL);
-	va_end(ap);
-
-	va_start(ap, path);
-	errno_t rc = task_spawn(task_id, wait, path, cnt, ap);
-	va_end(ap);
-
-	return rc;
-}
-
-/** Setup waiting for a task.
- *
- * If the task finishes after this call succeeds, it is guaranteed that
- * task_wait(wait, &texit, &retval) will return correct return value for
- * the task.
- *
- * @param id   ID of the task to setup waiting for.
- * @param wait Information necessary for the later task_wait call is stored here.
- *
- * @return EOK on success, else error code.
- */
-errno_t task_setup_wait(task_id_t id, task_wait_t *wait)
-{
-	errno_t rc;
-	async_sess_t *sess_ns = ns_session_get(&rc);
-	if (sess_ns == NULL)
-		return rc;
-
-	async_exch_t *exch = async_exchange_begin(sess_ns);
-	wait->aid = async_send_2(exch, NS_TASK_WAIT, LOWER32(id), UPPER32(id),
-	    &wait->result);
-	async_exchange_end(exch);
-
-	return EOK;
-}
-
-/** Cancel waiting for a task.
- *
- * This can be called *instead of* task_wait if the caller is not interested
- * in waiting for the task anymore.
- *
- * This function cannot be called if the task_wait was already called.
- *
- * @param wait task_wait_t previously initialized by task_setup_wait.
- */
-void task_cancel_wait(task_wait_t *wait)
-{
-	async_forget(wait->aid);
-}
-
-/** Wait for a task to finish.
- *
- * This function returns correct values even if the task finished in
- * between task_setup_wait and this task_wait call.
- *
- * This function cannot be called more than once with the same task_wait_t
- * (it can be reused, but must be reinitialized with task_setup_wait first)
- *
- * @param wait   task_wait_t previously initialized by task_setup_wait.
- * @param texit  Store type of task exit here.
- * @param retval Store return value of the task here.
- *
- * @return EOK on success, else error code.
- */
-errno_t task_wait(task_wait_t *wait, task_exit_t *texit, int *retval)
-{
-	assert(texit);
-	assert(retval);
-
-	errno_t rc;
-	async_wait_for(wait->aid, &rc);
-
-	if (rc == EOK) {
-		*texit = ipc_get_arg1(&wait->result);
-		*retval = ipc_get_arg2(&wait->result);
-	}
-
-	return rc;
-}
-
-/** Wait for a task to finish by its id.
- *
- * Note that this will fail with ENOENT if the task id is not registered in ns
- * (e.g. if the task finished). If you are spawning a task and need to wait
- * for its completion, use wait parameter of the task_spawn* functions instead
- * to prevent a race where the task exits before you may have a chance to wait
- * wait for it.
- *
- * @param id ID of the task to wait for.
- * @param texit  Store type of task exit here.
- * @param retval Store return value of the task here.
- *
- * @return EOK on success, else error code.
- */
-errno_t task_wait_task_id(task_id_t id, task_exit_t *texit, int *retval)
-{
-	task_wait_t wait;
-	errno_t rc = task_setup_wait(id, &wait);
-	if (rc != EOK)
-		return rc;
-
-	return task_wait(&wait, texit, retval);
-}
-
-errno_t task_retval(int val)
-{
-	errno_t rc;
-	async_sess_t *sess_ns = ns_session_get(&rc);
-	if (sess_ns == NULL)
-		return rc;
-
-	async_exch_t *exch = async_exchange_begin(sess_ns);
-	rc = (errno_t) async_req_1_0(exch, NS_RETVAL, val);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/thread/fibril.c
===================================================================
--- uspace/lib/c/generic/thread/fibril.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,926 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2007 Jakub Jermar
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <adt/list.h>
-#include <fibril.h>
-#include <stack.h>
-#include <tls.h>
-#include <stdlib.h>
-#include <as.h>
-#include <context.h>
-#include <assert.h>
-
-#include <mem.h>
-#include <str.h>
-#include <ipc/ipc.h>
-#include <libarch/faddr.h>
-
-#include "../private/thread.h"
-#include "../private/futex.h"
-#include "../private/fibril.h"
-#include "../private/libc.h"
-
-#define DPRINTF(...) ((void)0)
-#undef READY_DEBUG
-
-/** Member of timeout_list. */
-typedef struct {
-	link_t link;
-	struct timespec expires;
-	fibril_event_t *event;
-} _timeout_t;
-
-typedef struct {
-	errno_t rc;
-	link_t link;
-	ipc_call_t *call;
-	fibril_event_t event;
-} _ipc_waiter_t;
-
-typedef struct {
-	errno_t rc;
-	link_t link;
-	ipc_call_t call;
-} _ipc_buffer_t;
-
-typedef enum {
-	SWITCH_FROM_DEAD,
-	SWITCH_FROM_HELPER,
-	SWITCH_FROM_YIELD,
-	SWITCH_FROM_BLOCKED,
-} _switch_type_t;
-
-static bool multithreaded = false;
-
-/* This futex serializes access to global data. */
-static futex_t fibril_futex;
-static futex_t ready_semaphore;
-static long ready_st_count;
-
-static LIST_INITIALIZE(ready_list);
-static LIST_INITIALIZE(fibril_list);
-static LIST_INITIALIZE(timeout_list);
-
-static futex_t ipc_lists_futex;
-static LIST_INITIALIZE(ipc_waiter_list);
-static LIST_INITIALIZE(ipc_buffer_list);
-static LIST_INITIALIZE(ipc_buffer_free_list);
-
-/* Only used as unique markers for triggered events. */
-static fibril_t _fibril_event_triggered;
-static fibril_t _fibril_event_timed_out;
-#define _EVENT_INITIAL   (NULL)
-#define _EVENT_TRIGGERED (&_fibril_event_triggered)
-#define _EVENT_TIMED_OUT (&_fibril_event_timed_out)
-
-static inline void _ready_debug_check(void)
-{
-#ifdef READY_DEBUG
-	assert(!multithreaded);
-	long count = (long) list_count(&ready_list) +
-	    (long) list_count(&ipc_buffer_free_list);
-	assert(ready_st_count == count);
-#endif
-}
-
-static inline void _ready_up(void)
-{
-	if (multithreaded) {
-		futex_up(&ready_semaphore);
-	} else {
-		ready_st_count++;
-		_ready_debug_check();
-	}
-}
-
-static inline errno_t _ready_down(const struct timespec *expires)
-{
-	if (multithreaded)
-		return futex_down_timeout(&ready_semaphore, expires);
-
-	_ready_debug_check();
-	ready_st_count--;
-	return EOK;
-}
-
-static atomic_int threads_in_ipc_wait;
-
-/** Function that spans the whole life-cycle of a fibril.
- *
- * Each fibril begins execution in this function. Then the function implementing
- * the fibril logic is called.  After its return, the return value is saved.
- * The fibril then switches to another fibril, which cleans up after it.
- *
- */
-static void _fibril_main(void)
-{
-	/* fibril_futex is locked when a fibril is started. */
-	futex_unlock(&fibril_futex);
-
-	fibril_t *fibril = fibril_self();
-
-	/* Call the implementing function. */
-	fibril_exit(fibril->func(fibril->arg));
-
-	/* Not reached */
-}
-
-/** Allocate a fibril structure and TCB, but don't do anything else with it. */
-fibril_t *fibril_alloc(void)
-{
-	tcb_t *tcb = tls_make(__progsymbols.elfstart);
-	if (!tcb)
-		return NULL;
-
-	fibril_t *fibril = calloc(1, sizeof(fibril_t));
-	if (!fibril) {
-		tls_free(tcb);
-		return NULL;
-	}
-
-	tcb->fibril_data = fibril;
-	fibril->tcb = tcb;
-	fibril->is_freeable = true;
-
-	fibril_setup(fibril);
-	return fibril;
-}
-
-/**
- * Put the fibril into fibril_list.
- */
-void fibril_setup(fibril_t *f)
-{
-	futex_lock(&fibril_futex);
-	list_append(&f->all_link, &fibril_list);
-	futex_unlock(&fibril_futex);
-}
-
-void fibril_teardown(fibril_t *fibril)
-{
-	futex_lock(&fibril_futex);
-	list_remove(&fibril->all_link);
-	futex_unlock(&fibril_futex);
-
-	if (fibril->is_freeable) {
-		tls_free(fibril->tcb);
-		free(fibril);
-	}
-}
-
-/**
- * Event notification with a given reason.
- *
- * @param reason  Reason of the notification.
- *                Can be either _EVENT_TRIGGERED or _EVENT_TIMED_OUT.
- */
-static fibril_t *_fibril_trigger_internal(fibril_event_t *event, fibril_t *reason)
-{
-	assert(reason != _EVENT_INITIAL);
-	assert(reason == _EVENT_TIMED_OUT || reason == _EVENT_TRIGGERED);
-
-	futex_assert_is_locked(&fibril_futex);
-
-	if (event->fibril == _EVENT_INITIAL) {
-		event->fibril = reason;
-		return NULL;
-	}
-
-	if (event->fibril == _EVENT_TIMED_OUT) {
-		assert(reason == _EVENT_TRIGGERED);
-		event->fibril = reason;
-		return NULL;
-	}
-
-	if (event->fibril == _EVENT_TRIGGERED) {
-		/* Already triggered. Nothing to do. */
-		return NULL;
-	}
-
-	fibril_t *f = event->fibril;
-	event->fibril = reason;
-
-	assert(f->sleep_event == event);
-	return f;
-}
-
-static errno_t _ipc_wait(ipc_call_t *call, const struct timespec *expires)
-{
-	if (!expires)
-		return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
-
-	if (expires->tv_sec == 0)
-		return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
-
-	struct timespec now;
-	getuptime(&now);
-
-	if (ts_gteq(&now, expires))
-		return ipc_wait(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
-
-	return ipc_wait(call, NSEC2USEC(ts_sub_diff(expires, &now)),
-	    SYNCH_FLAGS_NONE);
-}
-
-/*
- * Waits until a ready fibril is added to the list, or an IPC message arrives.
- * Returns NULL on timeout and may also return NULL if returning from IPC
- * wait after new ready fibrils are added.
- */
-static fibril_t *_ready_list_pop(const struct timespec *expires, bool locked)
-{
-	if (locked) {
-		futex_assert_is_locked(&fibril_futex);
-		assert(expires);
-		/* Must be nonblocking. */
-		assert(expires->tv_sec == 0);
-	} else {
-		futex_assert_is_not_locked(&fibril_futex);
-	}
-
-	errno_t rc = _ready_down(expires);
-	if (rc != EOK)
-		return NULL;
-
-	/*
-	 * Once we acquire a token from ready_semaphore, there are two options.
-	 * Either there is a ready fibril in the list, or it's our turn to
-	 * call `ipc_wait_cycle()`. There is one extra token on the semaphore
-	 * for each entry of the call buffer.
-	 */
-
-	if (!locked)
-		futex_lock(&fibril_futex);
-	fibril_t *f = list_pop(&ready_list, fibril_t, link);
-	if (!f)
-		atomic_fetch_add_explicit(&threads_in_ipc_wait, 1,
-		    memory_order_relaxed);
-	if (!locked)
-		futex_unlock(&fibril_futex);
-
-	if (f)
-		return f;
-
-	if (!multithreaded)
-		assert(list_empty(&ipc_buffer_list));
-
-	/* No fibril is ready, IPC wait it is. */
-	ipc_call_t call = { 0 };
-	rc = _ipc_wait(&call, expires);
-
-	atomic_fetch_sub_explicit(&threads_in_ipc_wait, 1,
-	    memory_order_relaxed);
-
-	if (rc != EOK && rc != ENOENT) {
-		/* Return token. */
-		_ready_up();
-		return NULL;
-	}
-
-	/*
-	 * We might get ENOENT due to a poke.
-	 * In that case, we propagate the null call out of fibril_ipc_wait(),
-	 * because poke must result in that call returning.
-	 */
-
-	/*
-	 * If a fibril is already waiting for IPC, we wake up the fibril,
-	 * and return the token to ready_semaphore.
-	 * If there is no fibril waiting, we pop a buffer bucket and
-	 * put our call there. The token then returns when the bucket is
-	 * returned.
-	 */
-
-	if (!locked)
-		futex_lock(&fibril_futex);
-
-	futex_lock(&ipc_lists_futex);
-
-	_ipc_waiter_t *w = list_pop(&ipc_waiter_list, _ipc_waiter_t, link);
-	if (w) {
-		*w->call = call;
-		w->rc = rc;
-		/* We switch to the woken up fibril immediately if possible. */
-		f = _fibril_trigger_internal(&w->event, _EVENT_TRIGGERED);
-
-		/* Return token. */
-		_ready_up();
-	} else {
-		_ipc_buffer_t *buf = list_pop(&ipc_buffer_free_list, _ipc_buffer_t, link);
-		assert(buf);
-		*buf = (_ipc_buffer_t) { .call = call, .rc = rc };
-		list_append(&buf->link, &ipc_buffer_list);
-	}
-
-	futex_unlock(&ipc_lists_futex);
-
-	if (!locked)
-		futex_unlock(&fibril_futex);
-
-	return f;
-}
-
-static fibril_t *_ready_list_pop_nonblocking(bool locked)
-{
-	struct timespec tv = { .tv_sec = 0, .tv_nsec = 0 };
-	return _ready_list_pop(&tv, locked);
-}
-
-static void _ready_list_push(fibril_t *f)
-{
-	if (!f)
-		return;
-
-	futex_assert_is_locked(&fibril_futex);
-
-	/* Enqueue in ready_list. */
-	list_append(&f->link, &ready_list);
-	_ready_up();
-
-	if (atomic_load_explicit(&threads_in_ipc_wait, memory_order_relaxed)) {
-		DPRINTF("Poking.\n");
-		/* Wakeup one thread sleeping in SYS_IPC_WAIT. */
-		ipc_poke();
-	}
-}
-
-/* Blocks the current fibril until an IPC call arrives. */
-static errno_t _wait_ipc(ipc_call_t *call, const struct timespec *expires)
-{
-	futex_assert_is_not_locked(&fibril_futex);
-
-	futex_lock(&ipc_lists_futex);
-	_ipc_buffer_t *buf = list_pop(&ipc_buffer_list, _ipc_buffer_t, link);
-	if (buf) {
-		*call = buf->call;
-		errno_t rc = buf->rc;
-
-		/* Return to freelist. */
-		list_append(&buf->link, &ipc_buffer_free_list);
-		/* Return IPC wait token. */
-		_ready_up();
-
-		futex_unlock(&ipc_lists_futex);
-		return rc;
-	}
-
-	_ipc_waiter_t w = { .call = call };
-	list_append(&w.link, &ipc_waiter_list);
-	futex_unlock(&ipc_lists_futex);
-
-	errno_t rc = fibril_wait_timeout(&w.event, expires);
-	if (rc == EOK)
-		return w.rc;
-
-	futex_lock(&ipc_lists_futex);
-	if (link_in_use(&w.link))
-		list_remove(&w.link);
-	else
-		rc = w.rc;
-	futex_unlock(&ipc_lists_futex);
-	return rc;
-}
-
-/** Fire all timeouts that expired. */
-static struct timespec *_handle_expired_timeouts(struct timespec *next_timeout)
-{
-	struct timespec ts;
-	getuptime(&ts);
-
-	futex_lock(&fibril_futex);
-
-	while (!list_empty(&timeout_list)) {
-		link_t *cur = list_first(&timeout_list);
-		_timeout_t *to = list_get_instance(cur, _timeout_t, link);
-
-		if (ts_gt(&to->expires, &ts)) {
-			*next_timeout = to->expires;
-			futex_unlock(&fibril_futex);
-			return next_timeout;
-		}
-
-		list_remove(&to->link);
-
-		_ready_list_push(_fibril_trigger_internal(
-		    to->event, _EVENT_TIMED_OUT));
-	}
-
-	futex_unlock(&fibril_futex);
-	return NULL;
-}
-
-/**
- * Clean up after a dead fibril from which we restored context, if any.
- * Called after a switch is made and fibril_futex is unlocked.
- */
-static void _fibril_cleanup_dead(void)
-{
-	fibril_t *srcf = fibril_self();
-	if (!srcf->clean_after_me)
-		return;
-
-	void *stack = srcf->clean_after_me->stack;
-	assert(stack);
-	as_area_destroy(stack);
-	fibril_teardown(srcf->clean_after_me);
-	srcf->clean_after_me = NULL;
-}
-
-/** Switch to a fibril. */
-static void _fibril_switch_to(_switch_type_t type, fibril_t *dstf, bool locked)
-{
-	assert(fibril_self()->rmutex_locks == 0);
-
-	if (!locked)
-		futex_lock(&fibril_futex);
-	else
-		futex_assert_is_locked(&fibril_futex);
-
-	fibril_t *srcf = fibril_self();
-	assert(srcf);
-	assert(dstf);
-
-	switch (type) {
-	case SWITCH_FROM_YIELD:
-		_ready_list_push(srcf);
-		break;
-	case SWITCH_FROM_DEAD:
-		dstf->clean_after_me = srcf;
-		break;
-	case SWITCH_FROM_HELPER:
-	case SWITCH_FROM_BLOCKED:
-		break;
-	}
-
-	dstf->thread_ctx = srcf->thread_ctx;
-	srcf->thread_ctx = NULL;
-
-	/* Just some bookkeeping to allow better debugging of futex locks. */
-	futex_give_to(&fibril_futex, dstf);
-
-	/* Swap to the next fibril. */
-	context_swap(&srcf->ctx, &dstf->ctx);
-
-	assert(srcf == fibril_self());
-	assert(srcf->thread_ctx);
-
-	if (!locked) {
-		/* Must be after context_swap()! */
-		futex_unlock(&fibril_futex);
-		_fibril_cleanup_dead();
-	}
-}
-
-/**
- * Main function for a helper fibril.
- * The helper fibril executes on threads in the lightweight fibril pool when
- * there is no fibril ready to run. Its only purpose is to block until
- * another fibril is ready, or a timeout expires, or an IPC message arrives.
- *
- * There is at most one helper fibril per thread.
- *
- */
-static errno_t _helper_fibril_fn(void *arg)
-{
-	/* Set itself as the thread's own context. */
-	fibril_self()->thread_ctx = fibril_self();
-
-	(void) arg;
-
-	struct timespec next_timeout;
-	while (true) {
-		struct timespec *to = _handle_expired_timeouts(&next_timeout);
-		fibril_t *f = _ready_list_pop(to, false);
-		if (f) {
-			_fibril_switch_to(SWITCH_FROM_HELPER, f, false);
-		}
-	}
-
-	return EOK;
-}
-
-/** Create a new fibril.
- *
- * @param func Implementing function of the new fibril.
- * @param arg Argument to pass to func.
- * @param stksz Stack size in bytes.
- *
- * @return 0 on failure or TLS of the new fibril.
- *
- */
-fid_t fibril_create_generic(errno_t (*func)(void *), void *arg, size_t stksz)
-{
-	fibril_t *fibril;
-
-	fibril = fibril_alloc();
-	if (fibril == NULL)
-		return 0;
-
-	fibril->stack_size = stksz;
-	fibril->stack = as_area_create(AS_AREA_ANY, fibril->stack_size,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
-	    AS_AREA_LATE_RESERVE, AS_AREA_UNPAGED);
-	if (fibril->stack == AS_MAP_FAILED) {
-		fibril_teardown(fibril);
-		return 0;
-	}
-
-	fibril->func = func;
-	fibril->arg = arg;
-
-	context_create_t sctx = {
-		.fn = _fibril_main,
-		.stack_base = fibril->stack,
-		.stack_size = fibril->stack_size,
-		.tls = fibril->tcb,
-	};
-
-	context_create(&fibril->ctx, &sctx);
-	return (fid_t) fibril;
-}
-
-fid_t fibril_create(errno_t (*func)(void *), void *arg)
-{
-	return fibril_create_generic(func, arg, stack_size_get());
-}
-
-/** Delete a fibril that has never run.
- *
- * Free resources of a fibril that has been created with fibril_create()
- * but never started using fibril_start().
- *
- * @param fid Pointer to the fibril structure of the fibril to be
- *            added.
- */
-void fibril_destroy(fid_t fid)
-{
-	fibril_t *fibril = (fibril_t *) fid;
-
-	assert(!fibril->is_running);
-	assert(fibril->stack);
-	as_area_destroy(fibril->stack);
-	fibril_teardown(fibril);
-}
-
-static void _insert_timeout(_timeout_t *timeout)
-{
-	futex_assert_is_locked(&fibril_futex);
-	assert(timeout);
-
-	link_t *tmp = timeout_list.head.next;
-	while (tmp != &timeout_list.head) {
-		_timeout_t *cur = list_get_instance(tmp, _timeout_t, link);
-
-		if (ts_gteq(&cur->expires, &timeout->expires))
-			break;
-
-		tmp = tmp->next;
-	}
-
-	list_insert_before(&timeout->link, tmp);
-}
-
-/**
- * Same as `fibril_wait_for()`, except with a timeout.
- *
- * It is guaranteed that timing out cannot cause another thread's
- * `fibril_notify()` to be lost. I.e. the function returns success if and
- * only if `fibril_notify()` was called after the last call to
- * wait/wait_timeout returned, and before the call timed out.
- *
- * @return ETIMEOUT if timed out. EOK otherwise.
- */
-errno_t fibril_wait_timeout(fibril_event_t *event,
-    const struct timespec *expires)
-{
-	assert(fibril_self()->rmutex_locks == 0);
-
-	DPRINTF("### Fibril %p sleeping on event %p.\n", fibril_self(), event);
-
-	if (!fibril_self()->thread_ctx) {
-		fibril_self()->thread_ctx =
-		    fibril_create_generic(_helper_fibril_fn, NULL, PAGE_SIZE);
-		if (!fibril_self()->thread_ctx)
-			return ENOMEM;
-	}
-
-	futex_lock(&fibril_futex);
-
-	if (event->fibril == _EVENT_TRIGGERED) {
-		DPRINTF("### Already triggered. Returning. \n");
-		event->fibril = _EVENT_INITIAL;
-		futex_unlock(&fibril_futex);
-		return EOK;
-	}
-
-	assert(event->fibril == _EVENT_INITIAL);
-
-	fibril_t *srcf = fibril_self();
-	fibril_t *dstf = NULL;
-
-	/*
-	 * We cannot block here waiting for another fibril becoming
-	 * ready, since that would require unlocking the fibril_futex,
-	 * and that in turn would allow another thread to restore
-	 * the source fibril before this thread finished switching.
-	 *
-	 * Instead, we switch to an internal "helper" fibril whose only
-	 * job is to wait for an event, freeing the source fibril for
-	 * wakeups. There is always one for each running thread.
-	 */
-
-	dstf = _ready_list_pop_nonblocking(true);
-	if (!dstf) {
-		// XXX: It is possible for the _ready_list_pop_nonblocking() to
-		//      check for IPC, find a pending message, and trigger the
-		//      event on which we are currently trying to sleep.
-		if (event->fibril == _EVENT_TRIGGERED) {
-			event->fibril = _EVENT_INITIAL;
-			futex_unlock(&fibril_futex);
-			return EOK;
-		}
-
-		dstf = srcf->thread_ctx;
-		assert(dstf);
-	}
-
-	_timeout_t timeout = { 0 };
-	if (expires) {
-		timeout.expires = *expires;
-		timeout.event = event;
-		_insert_timeout(&timeout);
-	}
-
-	assert(srcf);
-
-	event->fibril = srcf;
-	srcf->sleep_event = event;
-
-	assert(event->fibril != _EVENT_INITIAL);
-
-	_fibril_switch_to(SWITCH_FROM_BLOCKED, dstf, true);
-
-	assert(event->fibril != srcf);
-	assert(event->fibril != _EVENT_INITIAL);
-	assert(event->fibril == _EVENT_TIMED_OUT || event->fibril == _EVENT_TRIGGERED);
-
-	list_remove(&timeout.link);
-	errno_t rc = (event->fibril == _EVENT_TIMED_OUT) ? ETIMEOUT : EOK;
-	event->fibril = _EVENT_INITIAL;
-
-	futex_unlock(&fibril_futex);
-	_fibril_cleanup_dead();
-	return rc;
-}
-
-void fibril_wait_for(fibril_event_t *event)
-{
-	assert(fibril_self()->rmutex_locks == 0);
-
-	(void) fibril_wait_timeout(event, NULL);
-}
-
-/**
- * Wake up the fibril waiting for the given event.
- * Up to one wakeup is remembered if the fibril is not currently waiting.
- *
- * This function is safe for use under restricted mutex lock.
- */
-void fibril_notify(fibril_event_t *event)
-{
-	futex_lock(&fibril_futex);
-	_ready_list_push(_fibril_trigger_internal(event, _EVENT_TRIGGERED));
-	futex_unlock(&fibril_futex);
-}
-
-/** Start a fibril that has not been running yet. */
-void fibril_start(fibril_t *fibril)
-{
-	futex_lock(&fibril_futex);
-	assert(!fibril->is_running);
-	fibril->is_running = true;
-
-	if (!link_in_use(&fibril->all_link))
-		list_append(&fibril->all_link, &fibril_list);
-
-	_ready_list_push(fibril);
-
-	futex_unlock(&fibril_futex);
-}
-
-/** Start a fibril that has not been running yet. (obsolete) */
-void fibril_add_ready(fibril_t *fibril)
-{
-	fibril_start(fibril);
-}
-
-/** @return the currently running fibril. */
-fibril_t *fibril_self(void)
-{
-	assert(__tcb_is_set());
-	tcb_t *tcb = __tcb_get();
-	assert(tcb->fibril_data);
-	return tcb->fibril_data;
-}
-
-/**
- * Obsolete, use fibril_self().
- *
- * @return ID of the currently running fibril.
- */
-fid_t fibril_get_id(void)
-{
-	return (fid_t) fibril_self();
-}
-
-/**
- * Switch to another fibril, if one is ready to run.
- * Has no effect on a heavy fibril.
- */
-void fibril_yield(void)
-{
-	if (fibril_self()->rmutex_locks > 0)
-		return;
-
-	fibril_t *f = _ready_list_pop_nonblocking(false);
-	if (f)
-		_fibril_switch_to(SWITCH_FROM_YIELD, f, false);
-}
-
-static errno_t _runner_fn(void *arg)
-{
-	_helper_fibril_fn(arg);
-	return EOK;
-}
-
-/**
- * Spawn a given number of runners (i.e. OS threads) immediately, and
- * unconditionally. This is meant to be used for tests and debugging.
- * Regular programs should just use `fibril_enable_multithreaded()`.
- *
- * @param n  Number of runners to spawn.
- * @return   Number of runners successfully spawned.
- */
-int fibril_test_spawn_runners(int n)
-{
-	assert(fibril_self()->rmutex_locks == 0);
-
-	if (!multithreaded) {
-		_ready_debug_check();
-		if (futex_initialize(&ready_semaphore, ready_st_count) != EOK)
-			abort();
-		multithreaded = true;
-	}
-
-	errno_t rc;
-
-	for (int i = 0; i < n; i++) {
-		rc = thread_create(_runner_fn, NULL, "fibril runner");
-		if (rc != EOK)
-			return i;
-	}
-
-	return n;
-}
-
-/**
- * Opt-in to have more than one runner thread.
- *
- * Currently, a task only ever runs in one thread because multithreading
- * might break some existing code.
- *
- * Eventually, the number of runner threads for a given task should become
- * configurable in the environment and this function becomes no-op.
- */
-void fibril_enable_multithreaded(void)
-{
-	// TODO: Implement better.
-	//       For now, 4 total runners is a sensible default.
-	if (!multithreaded) {
-		fibril_test_spawn_runners(3);
-	}
-}
-
-/**
- * Detach a fibril.
- */
-void fibril_detach(fid_t f)
-{
-	// TODO: Currently all fibrils are detached by default, but they
-	//       won't always be. Code that explicitly spawns fibrils with
-	//       limited lifetime should call this function.
-}
-
-/**
- * Exit a fibril. Never returns.
- *
- * @param retval  Value to return from fibril_join() called on this fibril.
- */
-_Noreturn void fibril_exit(long retval)
-{
-	// TODO: implement fibril_join() and remember retval
-	(void) retval;
-
-	fibril_t *f = _ready_list_pop_nonblocking(false);
-	if (!f)
-		f = fibril_self()->thread_ctx;
-
-	_fibril_switch_to(SWITCH_FROM_DEAD, f, false);
-	__builtin_unreachable();
-}
-
-void __fibrils_init(void)
-{
-	if (futex_initialize(&fibril_futex, 1) != EOK)
-		abort();
-	if (futex_initialize(&ipc_lists_futex, 1) != EOK)
-		abort();
-
-	/*
-	 * We allow a fixed, small amount of parallelism for IPC reads, but
-	 * since IPC is currently serialized in kernel, there's not much
-	 * we can get from more threads reading messages.
-	 */
-
-#define IPC_BUFFER_COUNT 1024
-	static _ipc_buffer_t buffers[IPC_BUFFER_COUNT];
-
-	for (int i = 0; i < IPC_BUFFER_COUNT; i++) {
-		list_append(&buffers[i].link, &ipc_buffer_free_list);
-		_ready_up();
-	}
-}
-
-void __fibrils_fini(void)
-{
-	futex_destroy(&fibril_futex);
-	futex_destroy(&ipc_lists_futex);
-}
-
-void fibril_usleep(usec_t timeout)
-{
-	struct timespec expires;
-	getuptime(&expires);
-	ts_add_diff(&expires, USEC2NSEC(timeout));
-
-	fibril_event_t event = FIBRIL_EVENT_INIT;
-	fibril_wait_timeout(&event, &expires);
-}
-
-void fibril_sleep(sec_t sec)
-{
-	struct timespec expires;
-	getuptime(&expires);
-	expires.tv_sec += sec;
-
-	fibril_event_t event = FIBRIL_EVENT_INIT;
-	fibril_wait_timeout(&event, &expires);
-}
-
-void fibril_ipc_poke(void)
-{
-	DPRINTF("Poking.\n");
-	/* Wakeup one thread sleeping in SYS_IPC_WAIT. */
-	ipc_poke();
-}
-
-errno_t fibril_ipc_wait(ipc_call_t *call, const struct timespec *expires)
-{
-	return _wait_ipc(call, expires);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/thread/fibril_synch.c
===================================================================
--- uspace/lib/c/generic/thread/fibril_synch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,820 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <fibril_synch.h>
-#include <fibril.h>
-#include <async.h>
-#include <adt/list.h>
-#include <time.h>
-#include <errno.h>
-#include <assert.h>
-#include <stacktrace.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <io/kio.h>
-#include <mem.h>
-#include <context.h>
-
-#include "../private/async.h"
-#include "../private/fibril.h"
-#include "../private/futex.h"
-
-errno_t fibril_rmutex_initialize(fibril_rmutex_t *m)
-{
-	return futex_initialize(&m->futex, 1);
-}
-
-void fibril_rmutex_destroy(fibril_rmutex_t *m)
-{
-	futex_destroy(&m->futex);
-}
-
-/**
- * Lock restricted mutex.
- * When a restricted mutex is locked, the fibril may not sleep or create new
- * threads. Any attempt to do so will abort the program.
- */
-void fibril_rmutex_lock(fibril_rmutex_t *m)
-{
-	futex_lock(&m->futex);
-	fibril_self()->rmutex_locks++;
-}
-
-bool fibril_rmutex_trylock(fibril_rmutex_t *m)
-{
-	if (futex_trylock(&m->futex)) {
-		fibril_self()->rmutex_locks++;
-		return true;
-	} else {
-		return false;
-	}
-}
-
-void fibril_rmutex_unlock(fibril_rmutex_t *m)
-{
-	fibril_self()->rmutex_locks--;
-	futex_unlock(&m->futex);
-}
-
-static fibril_local bool deadlocked = false;
-
-static futex_t fibril_synch_futex;
-
-void __fibril_synch_init(void)
-{
-	if (futex_initialize(&fibril_synch_futex, 1) != EOK)
-		abort();
-}
-
-void __fibril_synch_fini(void)
-{
-	futex_destroy(&fibril_synch_futex);
-}
-
-typedef struct {
-	link_t link;
-	fibril_event_t event;
-	fibril_mutex_t *mutex;
-	fid_t fid;
-} awaiter_t;
-
-#define AWAITER_INIT { .fid = fibril_get_id() }
-
-/** Print deadlock message nad blocking chain.
- *
- * @param oi Owner info for the resource being acquired
- * @param f Fibril that is trying to acquire the resource
- */
-static void print_deadlock(fibril_owner_info_t *oi, fibril_t *f)
-{
-	// FIXME: Print to stderr.
-
-	if (deadlocked) {
-		kio_printf("Deadlock detected while printing deadlock. Aborting.\n");
-		abort();
-	}
-	deadlocked = true;
-
-	printf("Deadlock detected.\n");
-	stacktrace_print();
-
-	printf("Fibril %p waits for primitive %p.\n", f, oi);
-
-	while (oi && oi->owned_by) {
-		printf("Primitive %p is owned by fibril %p.\n",
-		    oi, oi->owned_by);
-		if (oi->owned_by == f)
-			break;
-		stacktrace_print_fp_pc(
-		    context_get_fp(&oi->owned_by->ctx),
-		    context_get_pc(&oi->owned_by->ctx));
-		printf("Fibril %p waits for primitive %p.\n",
-		    oi->owned_by, oi->owned_by->waits_for);
-		oi = oi->owned_by->waits_for;
-	}
-}
-
-/** Check whether fibril trying to acquire a resource will cause deadlock.
- *
- * @param wanted_oi Owner info for the primitive that the fibril wants
- * @param fib Fibril that wants to aquire the primitive
- */
-static void check_fibril_for_deadlock(fibril_owner_info_t *wanted_oi,
-    fibril_t *fib)
-{
-	fibril_owner_info_t *oi;
-
-	futex_assert_is_locked(&fibril_synch_futex);
-
-	oi = wanted_oi;
-	while (oi && oi->owned_by) {
-		if (oi->owned_by == fib) {
-			futex_unlock(&fibril_synch_futex);
-			print_deadlock(wanted_oi, fib);
-			abort();
-		}
-		oi = oi->owned_by->waits_for;
-	}
-}
-
-/** Check whether trying to acquire a resource will cause deadlock.
- *
- * @param oi Owner info for the primitive that the current fibril wants
- */
-static void check_for_deadlock(fibril_owner_info_t *oi)
-{
-	check_fibril_for_deadlock(oi, fibril_self());
-}
-
-void fibril_mutex_lock(fibril_mutex_t *fm)
-{
-	fibril_t *f = (fibril_t *) fibril_get_id();
-
-	futex_lock(&fibril_synch_futex);
-
-	if (fm->counter-- > 0) {
-		fm->oi.owned_by = f;
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	awaiter_t wdata = AWAITER_INIT;
-	list_append(&wdata.link, &fm->waiters);
-	check_for_deadlock(&fm->oi);
-	f->waits_for = &fm->oi;
-
-	futex_unlock(&fibril_synch_futex);
-
-	fibril_wait_for(&wdata.event);
-}
-
-bool fibril_mutex_trylock(fibril_mutex_t *fm)
-{
-	bool locked = false;
-
-	futex_lock(&fibril_synch_futex);
-	if (fm->counter > 0) {
-		fm->counter--;
-		fm->oi.owned_by = (fibril_t *) fibril_get_id();
-		locked = true;
-	}
-	futex_unlock(&fibril_synch_futex);
-
-	return locked;
-}
-
-static void _fibril_mutex_unlock_unsafe(fibril_mutex_t *fm)
-{
-	assert(fm->oi.owned_by == (fibril_t *) fibril_get_id());
-
-	if (fm->counter++ < 0) {
-		awaiter_t *wdp = list_pop(&fm->waiters, awaiter_t, link);
-		assert(wdp);
-
-		fibril_t *f = (fibril_t *) wdp->fid;
-		fm->oi.owned_by = f;
-		f->waits_for = NULL;
-
-		fibril_notify(&wdp->event);
-	} else {
-		fm->oi.owned_by = NULL;
-	}
-}
-
-void fibril_mutex_unlock(fibril_mutex_t *fm)
-{
-	futex_lock(&fibril_synch_futex);
-	_fibril_mutex_unlock_unsafe(fm);
-	futex_unlock(&fibril_synch_futex);
-}
-
-bool fibril_mutex_is_locked(fibril_mutex_t *fm)
-{
-	futex_lock(&fibril_synch_futex);
-	bool locked = (fm->oi.owned_by == (fibril_t *) fibril_get_id());
-	futex_unlock(&fibril_synch_futex);
-	return locked;
-}
-
-void fibril_rwlock_initialize(fibril_rwlock_t *frw)
-{
-	frw->oi.owned_by = NULL;
-	frw->writers = 0;
-	frw->readers = 0;
-	list_initialize(&frw->waiters);
-}
-
-void fibril_rwlock_read_lock(fibril_rwlock_t *frw)
-{
-	fibril_t *f = (fibril_t *) fibril_get_id();
-
-	futex_lock(&fibril_synch_futex);
-
-	if (!frw->writers && list_empty(&frw->waiters)) {
-		/* Consider the first reader the owner. */
-		if (frw->readers++ == 0)
-			frw->oi.owned_by = f;
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	f->is_writer = false;
-
-	awaiter_t wdata = AWAITER_INIT;
-	list_append(&wdata.link, &frw->waiters);
-	check_for_deadlock(&frw->oi);
-	f->waits_for = &frw->oi;
-
-	futex_unlock(&fibril_synch_futex);
-
-	fibril_wait_for(&wdata.event);
-}
-
-void fibril_rwlock_write_lock(fibril_rwlock_t *frw)
-{
-	fibril_t *f = (fibril_t *) fibril_get_id();
-
-	futex_lock(&fibril_synch_futex);
-
-	if (!frw->writers && !frw->readers) {
-		frw->oi.owned_by = f;
-		frw->writers++;
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	f->is_writer = true;
-
-	awaiter_t wdata = AWAITER_INIT;
-	list_append(&wdata.link, &frw->waiters);
-	check_for_deadlock(&frw->oi);
-	f->waits_for = &frw->oi;
-
-	futex_unlock(&fibril_synch_futex);
-
-	fibril_wait_for(&wdata.event);
-}
-
-static void _fibril_rwlock_common_unlock(fibril_rwlock_t *frw)
-{
-	if (frw->readers) {
-		if (--frw->readers) {
-			if (frw->oi.owned_by == (fibril_t *) fibril_get_id()) {
-				/*
-				 * If this reader fibril was considered the
-				 * owner of this rwlock, clear the ownership
-				 * information even if there are still more
-				 * readers.
-				 *
-				 * This is the limitation of the detection
-				 * mechanism rooted in the fact that tracking
-				 * all readers would require dynamically
-				 * allocated memory for keeping linkage info.
-				 */
-				frw->oi.owned_by = NULL;
-			}
-
-			return;
-		}
-	} else {
-		frw->writers--;
-	}
-
-	assert(!frw->readers && !frw->writers);
-
-	frw->oi.owned_by = NULL;
-
-	while (!list_empty(&frw->waiters)) {
-		link_t *tmp = list_first(&frw->waiters);
-		awaiter_t *wdp;
-		fibril_t *f;
-
-		wdp = list_get_instance(tmp, awaiter_t, link);
-		f = (fibril_t *) wdp->fid;
-
-		if (f->is_writer) {
-			if (frw->readers)
-				break;
-			frw->writers++;
-		} else {
-			frw->readers++;
-		}
-
-		f->waits_for = NULL;
-		list_remove(&wdp->link);
-		frw->oi.owned_by = f;
-		fibril_notify(&wdp->event);
-
-		if (frw->writers)
-			break;
-	}
-}
-
-void fibril_rwlock_read_unlock(fibril_rwlock_t *frw)
-{
-	futex_lock(&fibril_synch_futex);
-	assert(frw->readers > 0);
-	_fibril_rwlock_common_unlock(frw);
-	futex_unlock(&fibril_synch_futex);
-}
-
-void fibril_rwlock_write_unlock(fibril_rwlock_t *frw)
-{
-	futex_lock(&fibril_synch_futex);
-	assert(frw->writers == 1);
-	assert(frw->oi.owned_by == fibril_self());
-	_fibril_rwlock_common_unlock(frw);
-	futex_unlock(&fibril_synch_futex);
-}
-
-bool fibril_rwlock_is_read_locked(fibril_rwlock_t *frw)
-{
-	futex_lock(&fibril_synch_futex);
-	bool locked = (frw->readers > 0);
-	futex_unlock(&fibril_synch_futex);
-	return locked;
-}
-
-bool fibril_rwlock_is_write_locked(fibril_rwlock_t *frw)
-{
-	futex_lock(&fibril_synch_futex);
-	assert(frw->writers <= 1);
-	bool locked = (frw->writers > 0) && (frw->oi.owned_by == fibril_self());
-	futex_unlock(&fibril_synch_futex);
-	return locked;
-}
-
-bool fibril_rwlock_is_locked(fibril_rwlock_t *frw)
-{
-	return fibril_rwlock_is_read_locked(frw) ||
-	    fibril_rwlock_is_write_locked(frw);
-}
-
-void fibril_condvar_initialize(fibril_condvar_t *fcv)
-{
-	list_initialize(&fcv->waiters);
-}
-
-/**
- * FIXME: If `timeout` is negative, the function returns ETIMEOUT immediately,
- *        and if `timeout` is 0, the wait never times out.
- *        This is not consistent with other similar APIs.
- */
-errno_t
-fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm,
-    usec_t timeout)
-{
-	assert(fibril_mutex_is_locked(fm));
-
-	if (timeout < 0)
-		return ETIMEOUT;
-
-	awaiter_t wdata = AWAITER_INIT;
-	wdata.mutex = fm;
-
-	struct timespec ts;
-	struct timespec *expires = NULL;
-	if (timeout) {
-		getuptime(&ts);
-		ts_add_diff(&ts, USEC2NSEC(timeout));
-		expires = &ts;
-	}
-
-	futex_lock(&fibril_synch_futex);
-	_fibril_mutex_unlock_unsafe(fm);
-	list_append(&wdata.link, &fcv->waiters);
-	futex_unlock(&fibril_synch_futex);
-
-	(void) fibril_wait_timeout(&wdata.event, expires);
-
-	futex_lock(&fibril_synch_futex);
-	bool timed_out = link_in_use(&wdata.link);
-	list_remove(&wdata.link);
-	futex_unlock(&fibril_synch_futex);
-
-	fibril_mutex_lock(fm);
-
-	return timed_out ? ETIMEOUT : EOK;
-}
-
-void fibril_condvar_wait(fibril_condvar_t *fcv, fibril_mutex_t *fm)
-{
-	(void) fibril_condvar_wait_timeout(fcv, fm, 0);
-}
-
-void fibril_condvar_signal(fibril_condvar_t *fcv)
-{
-	futex_lock(&fibril_synch_futex);
-
-	awaiter_t *w = list_pop(&fcv->waiters, awaiter_t, link);
-	if (w != NULL)
-		fibril_notify(&w->event);
-
-	futex_unlock(&fibril_synch_futex);
-}
-
-void fibril_condvar_broadcast(fibril_condvar_t *fcv)
-{
-	futex_lock(&fibril_synch_futex);
-
-	awaiter_t *w;
-	while ((w = list_pop(&fcv->waiters, awaiter_t, link)))
-		fibril_notify(&w->event);
-
-	futex_unlock(&fibril_synch_futex);
-}
-
-/** Timer fibril.
- *
- * @param arg	Timer
- */
-static errno_t fibril_timer_func(void *arg)
-{
-	fibril_timer_t *timer = (fibril_timer_t *) arg;
-	errno_t rc;
-
-	fibril_mutex_lock(timer->lockp);
-
-	while (timer->state != fts_cleanup) {
-		switch (timer->state) {
-		case fts_not_set:
-		case fts_fired:
-			fibril_condvar_wait(&timer->cv, timer->lockp);
-			break;
-		case fts_active:
-			rc = fibril_condvar_wait_timeout(&timer->cv,
-			    timer->lockp, timer->delay);
-			if (rc == ETIMEOUT && timer->state == fts_active) {
-				timer->state = fts_fired;
-				timer->handler_fid = fibril_get_id();
-				fibril_mutex_unlock(timer->lockp);
-				timer->fun(timer->arg);
-				fibril_mutex_lock(timer->lockp);
-				timer->handler_fid = 0;
-			}
-			break;
-		case fts_cleanup:
-		case fts_clean:
-			assert(false);
-			break;
-		}
-	}
-
-	/* Acknowledge timer fibril has finished cleanup. */
-	timer->state = fts_clean;
-	fibril_condvar_broadcast(&timer->cv);
-	fibril_mutex_unlock(timer->lockp);
-
-	return 0;
-}
-
-/** Create new timer.
- *
- * @return		New timer on success, @c NULL if out of memory.
- */
-fibril_timer_t *fibril_timer_create(fibril_mutex_t *lock)
-{
-	fid_t fid;
-	fibril_timer_t *timer;
-
-	timer = calloc(1, sizeof(fibril_timer_t));
-	if (timer == NULL)
-		return NULL;
-
-	fid = fibril_create(fibril_timer_func, (void *) timer);
-	if (fid == 0) {
-		free(timer);
-		return NULL;
-	}
-
-	fibril_mutex_initialize(&timer->lock);
-	fibril_condvar_initialize(&timer->cv);
-
-	timer->fibril = fid;
-	timer->state = fts_not_set;
-	timer->lockp = (lock != NULL) ? lock : &timer->lock;
-
-	fibril_add_ready(fid);
-	return timer;
-}
-
-/** Destroy timer.
- *
- * @param timer		Timer, must not be active or accessed by other threads.
- */
-void fibril_timer_destroy(fibril_timer_t *timer)
-{
-	fibril_mutex_lock(timer->lockp);
-	assert(timer->state == fts_not_set || timer->state == fts_fired);
-
-	/* Request timer fibril to terminate. */
-	timer->state = fts_cleanup;
-	fibril_condvar_broadcast(&timer->cv);
-
-	/* Wait for timer fibril to terminate */
-	while (timer->state != fts_clean)
-		fibril_condvar_wait(&timer->cv, timer->lockp);
-	fibril_mutex_unlock(timer->lockp);
-
-	free(timer);
-}
-
-/** Set timer.
- *
- * Set timer to execute a callback function after the specified
- * interval.
- *
- * @param timer		Timer
- * @param delay		Delay in microseconds
- * @param fun		Callback function
- * @param arg		Argument for @a fun
- */
-void fibril_timer_set(fibril_timer_t *timer, usec_t delay,
-    fibril_timer_fun_t fun, void *arg)
-{
-	fibril_mutex_lock(timer->lockp);
-	fibril_timer_set_locked(timer, delay, fun, arg);
-	fibril_mutex_unlock(timer->lockp);
-}
-
-/** Set locked timer.
- *
- * Set timer to execute a callback function after the specified
- * interval. Must be called when the timer is locked.
- *
- * @param timer		Timer
- * @param delay		Delay in microseconds
- * @param fun		Callback function
- * @param arg		Argument for @a fun
- */
-void fibril_timer_set_locked(fibril_timer_t *timer, usec_t delay,
-    fibril_timer_fun_t fun, void *arg)
-{
-	assert(fibril_mutex_is_locked(timer->lockp));
-	assert(timer->state == fts_not_set || timer->state == fts_fired);
-	timer->state = fts_active;
-	timer->delay = delay;
-	timer->fun = fun;
-	timer->arg = arg;
-	fibril_condvar_broadcast(&timer->cv);
-}
-
-/** Clear timer.
- *
- * Clears (cancels) timer and returns last state of the timer.
- * This can be one of:
- *    - fts_not_set	If the timer has not been set or has been cleared
- *    - fts_active	Timer was set but did not fire
- *    - fts_fired	Timer fired
- *
- * @param timer		Timer
- * @return		Last timer state
- */
-fibril_timer_state_t fibril_timer_clear(fibril_timer_t *timer)
-{
-	fibril_timer_state_t old_state;
-
-	fibril_mutex_lock(timer->lockp);
-	old_state = fibril_timer_clear_locked(timer);
-	fibril_mutex_unlock(timer->lockp);
-
-	return old_state;
-}
-
-/** Clear locked timer.
- *
- * Clears (cancels) timer and returns last state of the timer.
- * This can be one of:
- *    - fts_not_set	If the timer has not been set or has been cleared
- *    - fts_active	Timer was set but did not fire
- *    - fts_fired	Timer fired
- * Must be called when the timer is locked.
- *
- * @param timer		Timer
- * @return		Last timer state
- */
-fibril_timer_state_t fibril_timer_clear_locked(fibril_timer_t *timer)
-{
-	fibril_timer_state_t old_state;
-
-	assert(fibril_mutex_is_locked(timer->lockp));
-
-	while (timer->handler_fid != 0) {
-		if (timer->handler_fid == fibril_get_id()) {
-			printf("Deadlock detected.\n");
-			stacktrace_print();
-			printf("Fibril %p is trying to clear timer %p from "
-			    "inside its handler %p.\n",
-			    fibril_get_id(), timer, timer->fun);
-			abort();
-		}
-
-		fibril_condvar_wait(&timer->cv, timer->lockp);
-	}
-
-	old_state = timer->state;
-	timer->state = fts_not_set;
-
-	timer->delay = 0;
-	timer->fun = NULL;
-	timer->arg = NULL;
-	fibril_condvar_broadcast(&timer->cv);
-
-	return old_state;
-}
-
-/**
- * Initialize a semaphore with initial count set to the provided value.
- *
- * @param sem    Semaphore to initialize.
- * @param count  Initial count. Must not be negative.
- */
-void fibril_semaphore_initialize(fibril_semaphore_t *sem, long count)
-{
-	/*
-	 * Negative count denotes the length of waitlist,
-	 * so it makes no sense as an initial value.
-	 */
-	assert(count >= 0);
-	sem->closed = false;
-	sem->count = count;
-	list_initialize(&sem->waiters);
-}
-
-/**
- * Produce one token.
- * If there are fibrils waiting for tokens, this operation satisfies
- * exactly one waiting `fibril_semaphore_down()`.
- * This operation never blocks the fibril.
- *
- * @param sem  Semaphore to use.
- */
-void fibril_semaphore_up(fibril_semaphore_t *sem)
-{
-	futex_lock(&fibril_synch_futex);
-
-	if (sem->closed) {
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	sem->count++;
-
-	if (sem->count <= 0) {
-		awaiter_t *w = list_pop(&sem->waiters, awaiter_t, link);
-		assert(w);
-		fibril_notify(&w->event);
-	}
-
-	futex_unlock(&fibril_synch_futex);
-}
-
-/**
- * Consume one token.
- * If there are no available tokens (count <= 0), this operation blocks until
- * another fibril produces a token using `fibril_semaphore_up()`.
- *
- * @param sem  Semaphore to use.
- */
-void fibril_semaphore_down(fibril_semaphore_t *sem)
-{
-	futex_lock(&fibril_synch_futex);
-
-	if (sem->closed) {
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	sem->count--;
-
-	if (sem->count >= 0) {
-		futex_unlock(&fibril_synch_futex);
-		return;
-	}
-
-	awaiter_t wdata = AWAITER_INIT;
-	list_append(&wdata.link, &sem->waiters);
-
-	futex_unlock(&fibril_synch_futex);
-
-	fibril_wait_for(&wdata.event);
-}
-
-errno_t fibril_semaphore_down_timeout(fibril_semaphore_t *sem, usec_t timeout)
-{
-	if (timeout < 0)
-		return ETIMEOUT;
-
-	futex_lock(&fibril_synch_futex);
-	if (sem->closed) {
-		futex_unlock(&fibril_synch_futex);
-		return EOK;
-	}
-
-	sem->count--;
-
-	if (sem->count >= 0) {
-		futex_unlock(&fibril_synch_futex);
-		return EOK;
-	}
-
-	awaiter_t wdata = AWAITER_INIT;
-	list_append(&wdata.link, &sem->waiters);
-
-	futex_unlock(&fibril_synch_futex);
-
-	struct timespec ts;
-	struct timespec *expires = NULL;
-	if (timeout) {
-		getuptime(&ts);
-		ts_add_diff(&ts, USEC2NSEC(timeout));
-		expires = &ts;
-	}
-
-	errno_t rc = fibril_wait_timeout(&wdata.event, expires);
-	if (rc == EOK)
-		return EOK;
-
-	futex_lock(&fibril_synch_futex);
-	if (!link_in_use(&wdata.link)) {
-		futex_unlock(&fibril_synch_futex);
-		return EOK;
-	}
-
-	list_remove(&wdata.link);
-	sem->count++;
-	futex_unlock(&fibril_synch_futex);
-
-	return rc;
-}
-
-/**
- * Close the semaphore.
- * All future down() operations return instantly.
- */
-void fibril_semaphore_close(fibril_semaphore_t *sem)
-{
-	futex_lock(&fibril_synch_futex);
-	sem->closed = true;
-	awaiter_t *w;
-
-	while ((w = list_pop(&sem->waiters, awaiter_t, link)))
-		fibril_notify(&w->event);
-
-	futex_unlock(&fibril_synch_futex);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/thread/futex.c
===================================================================
--- uspace/lib/c/generic/thread/futex.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <stdatomic.h>
-#include <fibril.h>
-#include <io/kio.h>
-
-#include "../private/fibril.h"
-#include "../private/futex.h"
-
-//#define DPRINTF(...) kio_printf(__VA_ARGS__)
-#define DPRINTF(...) dummy_printf(__VA_ARGS__)
-
-/** Initialize futex counter.
- *
- * @param futex Futex.
- * @param val   Initialization value.
- *
- * @return      Error code.
- */
-errno_t futex_initialize(futex_t *futex, int val)
-{
-	atomic_store_explicit(&futex->val, val, memory_order_relaxed);
-	futex->whandle = CAP_NIL;
-	return futex_allocate_waitq(futex);
-}
-
-#ifdef CONFIG_DEBUG_FUTEX
-
-void __futex_assert_is_locked(futex_t *futex, const char *name)
-{
-	void *owner = atomic_load_explicit(&futex->owner, memory_order_relaxed);
-	fibril_t *self = (fibril_t *) fibril_get_id();
-	if (owner != self) {
-		DPRINTF("Assertion failed: %s (%p) is not locked by fibril %p (instead locked by fibril %p).\n", name, futex, self, owner);
-	}
-	assert(owner == self);
-}
-
-void __futex_assert_is_not_locked(futex_t *futex, const char *name)
-{
-	void *owner = atomic_load_explicit(&futex->owner, memory_order_relaxed);
-	fibril_t *self = (fibril_t *) fibril_get_id();
-	if (owner == self) {
-		DPRINTF("Assertion failed: %s (%p) is already locked by fibril %p.\n", name, futex, self);
-	}
-	assert(owner != self);
-}
-
-void __futex_lock(futex_t *futex, const char *name)
-{
-	/*
-	 * We use relaxed atomics to avoid violating C11 memory model.
-	 * They should compile to regular load/stores, but simple assignments
-	 * would be UB by definition.
-	 * The proper ordering is ensured by the surrounding futex operation.
-	 */
-
-	fibril_t *self = (fibril_t *) fibril_get_id();
-	DPRINTF("Locking futex %s (%p) by fibril %p.\n", name, futex, self);
-	__futex_assert_is_not_locked(futex, name);
-	futex_down(futex);
-
-	void *prev_owner = atomic_load_explicit(&futex->owner,
-	    memory_order_relaxed);
-	assert(prev_owner == NULL);
-	atomic_store_explicit(&futex->owner, self, memory_order_relaxed);
-}
-
-void __futex_unlock(futex_t *futex, const char *name)
-{
-	fibril_t *self = (fibril_t *) fibril_get_id();
-	DPRINTF("Unlocking futex %s (%p) by fibril %p.\n", name, futex, self);
-	__futex_assert_is_locked(futex, name);
-	atomic_store_explicit(&futex->owner, NULL, memory_order_relaxed);
-	futex_up(futex);
-}
-
-bool __futex_trylock(futex_t *futex, const char *name)
-{
-	fibril_t *self = (fibril_t *) fibril_get_id();
-	bool success = futex_trydown(futex);
-	if (success) {
-		void *owner = atomic_load_explicit(&futex->owner,
-		    memory_order_relaxed);
-		assert(owner == NULL);
-
-		atomic_store_explicit(&futex->owner, self, memory_order_relaxed);
-
-		DPRINTF("Trylock on futex %s (%p) by fibril %p succeeded.\n", name, futex, self);
-	} else {
-		DPRINTF("Trylock on futex %s (%p) by fibril %p failed.\n", name, futex, self);
-	}
-
-	return success;
-}
-
-void __futex_give_to(futex_t *futex, void *new_owner, const char *name)
-{
-	fibril_t *self = fibril_self();
-	fibril_t *no = new_owner;
-	DPRINTF("Passing futex %s (%p) from fibril %p to fibril %p.\n", name, futex, self, no);
-
-	__futex_assert_is_locked(futex, name);
-	atomic_store_explicit(&futex->owner, new_owner, memory_order_relaxed);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/thread/mpsc.c
===================================================================
--- uspace/lib/c/generic/thread/mpsc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "../private/fibril.h"
-
-/*
- * A multi-producer, single-consumer concurrent FIFO channel with unlimited
- * buffering.
- *
- * The current implementation is based on the super simple two-lock queue
- * by Michael and Scott
- * (http://www.cs.rochester.edu/~scott/papers/1996_PODC_queues.pdf)
- *
- * The original algorithm uses one lock on each side. Since this queue is
- * single-consumer, we only use the tail lock.
- */
-
-typedef struct mpsc_node mpsc_node_t;
-
-struct mpsc {
-	size_t elem_size;
-	fibril_rmutex_t t_lock;
-	mpsc_node_t *head;
-	mpsc_node_t *tail;
-	mpsc_node_t *close_node;
-	fibril_event_t event;
-};
-
-struct mpsc_node {
-	mpsc_node_t *next;
-	unsigned char data[];
-};
-
-mpsc_t *mpsc_create(size_t elem_size)
-{
-	mpsc_t *q = calloc(1, sizeof(mpsc_t));
-	mpsc_node_t *n = calloc(1, sizeof(mpsc_node_t) + elem_size);
-	mpsc_node_t *c = calloc(1, sizeof(mpsc_node_t) + elem_size);
-
-	if (!q || !n || !c) {
-		free(q);
-		free(n);
-		free(c);
-		return NULL;
-	}
-
-	if (fibril_rmutex_initialize(&q->t_lock) != EOK) {
-		free(q);
-		free(n);
-		free(c);
-		return NULL;
-	}
-
-	q->elem_size = elem_size;
-	q->head = q->tail = n;
-	q->close_node = c;
-	return q;
-}
-
-void mpsc_destroy(mpsc_t *q)
-{
-	mpsc_node_t *n = q->head;
-	mpsc_node_t *next = NULL;
-	while (n != NULL) {
-		next = n->next;
-		free(n);
-		n = next;
-	}
-
-	fibril_rmutex_destroy(&q->t_lock);
-
-	free(q);
-}
-
-static errno_t _mpsc_push(mpsc_t *q, mpsc_node_t *n)
-{
-	fibril_rmutex_lock(&q->t_lock);
-
-	if (q->tail == q->close_node) {
-		fibril_rmutex_unlock(&q->t_lock);
-		return EINVAL;
-	}
-
-	__atomic_store_n(&q->tail->next, n, __ATOMIC_RELEASE);
-	q->tail = n;
-
-	fibril_rmutex_unlock(&q->t_lock);
-
-	fibril_notify(&q->event);
-	return EOK;
-}
-
-/**
- * Send data on the channel.
- * The length of data is equal to the `elem_size` value set in `mpsc_create`.
- *
- * This function is safe for use under restricted mutex lock.
- *
- * @return ENOMEM if allocation failed, EINVAL if the queue is closed.
- */
-errno_t mpsc_send(mpsc_t *q, const void *b)
-{
-	mpsc_node_t *n = malloc(sizeof(mpsc_node_t) + q->elem_size);
-	if (!n)
-		return ENOMEM;
-
-	n->next = NULL;
-	memcpy(n->data, b, q->elem_size);
-
-	return _mpsc_push(q, n);
-}
-
-/**
- * Receive data from the channel.
- *
- * @return ETIMEOUT if deadline expires, ENOENT if the queue is closed and
- * there is no message left in the queue.
- */
-errno_t mpsc_receive(mpsc_t *q, void *b, const struct timespec *expires)
-{
-	mpsc_node_t *n;
-	mpsc_node_t *new_head;
-
-	while (true) {
-		n = q->head;
-		new_head = __atomic_load_n(&n->next, __ATOMIC_ACQUIRE);
-		if (new_head)
-			break;
-
-		errno_t rc = fibril_wait_timeout(&q->event, expires);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (new_head == q->close_node)
-		return ENOENT;
-
-	memcpy(b, new_head->data, q->elem_size);
-	q->head = new_head;
-
-	free(n);
-	return EOK;
-}
-
-/**
- * Close the channel.
- *
- * This function is safe for use under restricted mutex lock.
- */
-void mpsc_close(mpsc_t *q)
-{
-	_mpsc_push(q, q->close_node);
-}
Index: pace/lib/c/generic/thread/thread.c
===================================================================
--- uspace/lib/c/generic/thread/thread.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <libc.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <libarch/faddr.h>
-#include <fibril.h>
-#include <stack.h>
-#include <str.h>
-#include <async.h>
-#include <errno.h>
-#include <as.h>
-
-#include "../private/thread.h"
-#include "../private/fibril.h"
-
-/** Main thread function.
- *
- * This function is called from __thread_entry() and is used
- * to call the thread's implementing function and perform cleanup
- * and exit when thread returns back.
- *
- * @param arg Fibril pointer.
- *
- */
-static void __thread_main(void *arg)
-{
-	fibril_t *fibril = arg;
-
-	assert(!__tcb_is_set());
-	assert(fibril);
-
-	__tcb_set(fibril->tcb);
-
-	fibril->func(fibril->arg);
-	/*
-	 * XXX: we cannot free the userspace stack while running on it
-	 *
-	 * free(uarg->uspace_stack);
-	 * free(uarg);
-	 */
-
-	fibril_teardown(fibril);
-	thread_exit(0);
-}
-
-/** Create userspace thread.
- *
- * This function creates new userspace thread and allocates userspace
- * stack and userspace argument structure for it.
- *
- * @param function Function implementing the thread.
- * @param arg Argument to be passed to thread.
- * @param name Symbolic name of the thread.
- * @param tid Thread ID of the newly created thread.
- *
- * @return Zero on success or a code from @ref errno.h on failure.
- */
-errno_t thread_create(errno_t (*func)(void *), void *arg, const char *name)
-{
-	fibril_t *fibril = fibril_alloc();
-	if (!fibril)
-		return ENOMEM;
-
-	fibril->func = func;
-	fibril->arg = arg;
-
-	size_t stack_size = stack_size_get();
-	void *stack = as_area_create(AS_AREA_ANY, stack_size,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE | AS_AREA_GUARD |
-	    AS_AREA_LATE_RESERVE, AS_AREA_UNPAGED);
-	if (stack == AS_MAP_FAILED) {
-		fibril_teardown(fibril);
-		return ENOMEM;
-	}
-
-	uintptr_t sp = arch_thread_prepare(stack, stack_size, __thread_main,
-	    fibril);
-
-	errno_t rc = (errno_t) __SYSCALL4(SYS_THREAD_CREATE,
-	    (sysarg_t) FADDR(__thread_entry), sp,
-	    (sysarg_t) name, (sysarg_t) str_size(name));
-
-	if (rc != EOK) {
-		/*
-		 * Failed to create a new thread.
-		 * Free up the allocated data.
-		 */
-		as_area_destroy(stack);
-	}
-
-	return rc;
-}
-
-/** Terminate current thread.
- *
- * @param status Exit status. Currently not used.
- *
- */
-void thread_exit(int status)
-{
-	__SYSCALL1(SYS_THREAD_EXIT, (sysarg_t) status);
-
-	/* Unreachable */
-	while (true)
-		;
-}
-
-/** Get current thread ID.
- *
- * @return Current thread ID.
- */
-thread_id_t thread_get_id(void)
-{
-	thread_id_t thread_id;
-
-	(void) __SYSCALL1(SYS_THREAD_GET_ID, (sysarg_t) &thread_id);
-
-	return thread_id;
-}
-
-/** Wait unconditionally for specified number of microseconds
- *
- */
-void thread_usleep(usec_t usec)
-{
-	(void) __SYSCALL1(SYS_THREAD_USLEEP, usec);
-}
-
-/** Wait unconditionally for specified number of seconds
- *
- */
-void thread_sleep(sec_t sec)
-{
-	/*
-	 * Sleep in 1000 second steps to support full argument range
-	 */
-	while (sec > 0) {
-		unsigned int period = (sec > 1000) ? 1000 : sec;
-
-		thread_usleep(SEC2USEC(period));
-		sec -= period;
-	}
-}
-
-/** @}
- */
Index: pace/lib/c/generic/thread/tls.c
===================================================================
--- uspace/lib/c/generic/thread/tls.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- *
- * Support for thread-local storage, as described in:
- * 	Drepper U.: ELF Handling For Thread-Local Storage, 2005
- */
-
-#include <assert.h>
-#include <stdalign.h>
-#include <stddef.h>
-#include <align.h>
-#include <tls.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-#include <elf/elf.h>
-#include <as.h>
-
-#include <libarch/config.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-#include "../private/libc.h"
-
-#if !defined(CONFIG_TLS_VARIANT_1) && !defined(CONFIG_TLS_VARIANT_2)
-#error Unknown TLS variant.
-#endif
-
-static ptrdiff_t _tcb_data_offset(const void *elf)
-{
-	const elf_segment_header_t *tls =
-	    elf_get_phdr(elf, PT_TLS);
-
-	size_t tls_align = tls ? tls->p_align : 1;
-
-#ifdef CONFIG_TLS_VARIANT_1
-	return ALIGN_UP((ptrdiff_t) sizeof(tcb_t), tls_align);
-#else
-	size_t tls_size = tls ? tls->p_memsz : 0;
-	return -ALIGN_UP((ptrdiff_t) tls_size, max(tls_align, alignof(tcb_t)));
-#endif
-}
-
-/** Get address of static TLS block - only when RTLD is not initialized  */
-void *tls_get(void)
-{
-#ifdef CONFIG_RTLD
-	assert(runtime_env == NULL);
-#endif
-	return (uint8_t *)__tcb_get() + _tcb_data_offset(__progsymbols.elfstart);
-}
-
-static tcb_t *tls_make_generic(const void *elf, void *(*alloc)(size_t, size_t))
-{
-	/*
-	 * See also rtld/module.c -> modules_process_tls(), where we have less
-	 * messy code for the dynamic-linking version of this.
-	 */
-	assert(!elf_get_phdr(elf, PT_DYNAMIC));
-#ifdef CONFIG_RTLD
-	assert(runtime_env == NULL);
-#endif
-
-	const elf_segment_header_t *tls = elf_get_phdr(elf, PT_TLS);
-	size_t tls_size = tls ? tls->p_memsz : 0;
-	size_t tls_align = tls ? tls->p_align : 1;
-
-	/*
-	 * We don't currently support alignment this big,
-	 * and neither should we need to.
-	 */
-	assert(tls_align <= PAGE_SIZE);
-
-	/*
-	 * FIXME: the calculation of alloc_size shouldn't include the alignment
-	 * of tcb_t (at least in Variant II)
-	 * See https://github.com/HelenOS/helenos/pull/240/files/4ef27ebf98a0656e09889b7d00efdec03343f1aa#r1929592924
-	 * (you will also need to fix _tcb_data_offset)
-	 */
-
-#ifdef CONFIG_TLS_VARIANT_1
-	size_t alloc_size =
-	    ALIGN_UP(sizeof(tcb_t), tls_align) + tls_size;
-#else
-	size_t alloc_size =
-	    ALIGN_UP(tls_size, max(tls_align, alignof(tcb_t))) + sizeof(tcb_t);
-#endif
-
-	void *area = alloc(max(tls_align, alignof(tcb_t)), alloc_size);
-	if (!area)
-		return NULL;
-
-#ifdef CONFIG_TLS_VARIANT_1
-	tcb_t *tcb = area;
-	uint8_t *data = (uint8_t *)tcb + _tcb_data_offset(elf);
-	memset(tcb, 0, sizeof(*tcb));
-#else
-	uint8_t *data = area;
-	tcb_t *tcb = (tcb_t *) (data - _tcb_data_offset(elf));
-	memset(tcb, 0, sizeof(tcb_t));
-	tcb->self = tcb;
-#endif
-
-	if (!tls)
-		return tcb;
-
-	uintptr_t bias = elf_get_bias(elf);
-
-	/* Copy thread local data from the initialization image. */
-	memcpy(data, (void *)(tls->p_vaddr + bias), tls->p_filesz);
-	/* Zero out the thread local uninitialized data. */
-	memset(data + tls->p_filesz, 0, tls->p_memsz - tls->p_filesz);
-
-	return tcb;
-}
-
-static void *early_alloc(size_t align, size_t alloc_size)
-{
-	assert(align <= PAGE_SIZE);
-	alloc_size = ALIGN_UP(alloc_size, PAGE_SIZE);
-
-	void *area = as_area_create(AS_AREA_ANY, alloc_size,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (area == AS_MAP_FAILED)
-		return NULL;
-	return area;
-}
-
-/** Same as tls_make(), but uses as_area_create() instead of memalign().
- *  Only used in __libc_main() if the program was created by the kernel.
- */
-tcb_t *tls_make_initial(const void *elf)
-{
-	return tls_make_generic(elf, early_alloc);
-}
-
-/** Create TLS (Thread Local Storage) data structures.
- *
- * @return Pointer to TCB.
- */
-tcb_t *tls_make(const void *elf)
-{
-	// TODO: Always use rtld.
-
-#ifdef CONFIG_RTLD
-	if (runtime_env != NULL)
-		return rtld_tls_make(runtime_env);
-#endif
-
-	return tls_make_generic(elf, memalign);
-}
-
-void tls_free(tcb_t *tcb)
-{
-#ifdef CONFIG_RTLD
-	free(tcb->dtv);
-
-	if (runtime_env != NULL) {
-		tls_free_arch(tcb, runtime_env->tls_size, runtime_env->tls_align);
-		return;
-	}
-#endif
-	const elf_segment_header_t *tls =
-	    elf_get_phdr(__progsymbols.elfstart, PT_TLS);
-
-	assert(tls != NULL);
-	tls_free_arch(tcb,
-	    ALIGN_UP(tls->p_memsz, tls->p_align) + sizeof(tcb_t),
-	    max(tls->p_align, alignof(tcb_t)));
-}
-
-#ifdef CONFIG_TLS_VARIANT_1
-/** Allocate TLS variant 1 data structures.
- *
- * @param data 		Start of TLS section. This is an output argument.
- * @param size		Size of tdata + tbss section.
- * @return 		Pointer to tcb_t structure.
- */
-tcb_t *tls_alloc_variant_1(size_t size, size_t align)
-{
-	tcb_t *tcb = memalign(align, size);
-	if (!tcb)
-		return NULL;
-	memset(tcb, 0, sizeof(tcb_t));
-	return tcb;
-}
-
-/** Free TLS variant I data structures.
- *
- * @param tcb		Pointer to TCB structure.
- * @param size		This argument is ignored.
- */
-void tls_free_variant_1(tcb_t *tcb, size_t size, size_t align)
-{
-	free(tcb);
-}
-#endif
-
-#ifdef CONFIG_TLS_VARIANT_2
-/** Allocate TLS variant II data structures.
- *
- * @param data		Pointer to pointer to thread local data. This is
- * 			actually an output argument.
- * @param size		Size of thread local data.
- * @param align		Alignment of thread local data.
- * @return		Pointer to TCB structure.
- */
-tcb_t *tls_alloc_variant_2(size_t size, size_t align)
-{
-	void *data = memalign(align, size);
-	if (data == NULL)
-		return NULL;
-
-	tcb_t *tcb = (tcb_t *) (data + size - sizeof(tcb_t));
-	memset(tcb, 0, sizeof(tcb_t));
-	tcb->self = tcb;
-	return tcb;
-}
-
-/** Free TLS variant II data structures.
- *
- * @param tcb		Pointer to TCB structure.
- * @param size		Size of thread local data.
- * @param align		Alignment of thread local data.
- */
-void tls_free_variant_2(tcb_t *tcb, size_t size, size_t align)
-{
-	if (tcb != NULL) {
-		void *start = ((void *) tcb) + sizeof(tcb_t) - size;
-		free(start);
-	}
-}
-#endif
-
-/** @}
- */
Index: pace/lib/c/generic/time.c
===================================================================
--- uspace/lib/c/generic/time.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1152 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <time.h>
-#include <stdbool.h>
-#include <barrier.h>
-#include <macros.h>
-#include <errno.h>
-#include <sysinfo.h>
-#include <as.h>
-#include <ddi.h>
-#include <libc.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <loc.h>
-#include <device/clock_dev.h>
-#include <stats.h>
-
-#define ASCTIME_BUF_LEN  27
-
-#define HOURS_PER_DAY  24
-#define MINS_PER_HOUR  60
-#define SECS_PER_MIN   60
-#define NSECS_PER_SEC  1000000000ll
-#define MINS_PER_DAY   (MINS_PER_HOUR * HOURS_PER_DAY)
-#define SECS_PER_HOUR  (SECS_PER_MIN * MINS_PER_HOUR)
-#define SECS_PER_DAY   (SECS_PER_HOUR * HOURS_PER_DAY)
-
-/** Pointer to kernel shared variables with time */
-struct {
-	volatile sysarg_t seconds1;
-	volatile sysarg_t useconds;
-	volatile sysarg_t seconds2;
-} *ktime = NULL;
-
-static async_sess_t *clock_conn = NULL;
-
-/**
- * Get CPU time used since the process invocation.
- *
- * @return Consumed microseconds by this process or -1 if not available.
- */
-clock_t clock(void)
-{
-	static_assert(CLOCKS_PER_SEC == 1000000, "");
-
-	size_t count;
-	stats_cpu_t *cpu_stats = stats_get_cpus(&count);
-	if (!cpu_stats)
-		return (clock_t) -1;
-	if (!cpu_stats->frequency_mhz) {
-		free(cpu_stats);
-		return (clock_t) -1;
-	}
-
-	clock_t total_usecs = -1;
-	if (cpu_stats) {
-		stats_task_t *task_stats = stats_get_task(task_get_id());
-		if (task_stats) {
-			total_usecs = (clock_t) (task_stats->kcycles +
-			    task_stats->ucycles) / cpu_stats->frequency_mhz;
-			free(task_stats);
-		}
-		free(cpu_stats);
-	}
-
-	return total_usecs;
-}
-
-/** Check whether the year is a leap year.
- *
- * @param year Year since 1900 (e.g. for 1970, the value is 70).
- *
- * @return true if year is a leap year, false otherwise
- *
- */
-static bool is_leap_year(time_t year)
-{
-	year += 1900;
-
-	if (year % 400 == 0)
-		return true;
-
-	if (year % 100 == 0)
-		return false;
-
-	if (year % 4 == 0)
-		return true;
-
-	return false;
-}
-
-/** How many days there are in the given month
- *
- * Return how many days there are in the given month of the given year.
- * Note that year is only taken into account if month is February.
- *
- * @param year Year since 1900 (can be negative).
- * @param mon  Month of the year. 0 for January, 11 for December.
- *
- * @return Number of days in the specified month.
- *
- */
-static int days_in_month(time_t year, time_t mon)
-{
-	assert(mon >= 0);
-	assert(mon <= 11);
-
-	static int month_days[] = {
-		31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-	};
-
-	if (mon == 1) {
-		/* February */
-		year += 1900;
-		return is_leap_year(year) ? 29 : 28;
-	}
-
-	return month_days[mon];
-}
-
-/** Which day of that year it is.
- *
- * For specified year, month and day of month, return which day of that year
- * it is.
- *
- * For example, given date 2011-01-03, the corresponding expression is:
- * day_of_year(111, 0, 3) == 2
- *
- * @param year Year (year 1900 = 0, can be negative).
- * @param mon  Month (January = 0).
- * @param mday Day of month (First day is 1).
- *
- * @return Day of year (First day is 0).
- *
- */
-static int day_of_year(time_t year, time_t mon, time_t mday)
-{
-	static int mdays[] = {
-		0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
-	};
-
-	static int leap_mdays[] = {
-		0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
-	};
-
-	return (is_leap_year(year) ? leap_mdays[mon] : mdays[mon]) + mday - 1;
-}
-
-/** Integer division that rounds to negative infinity.
- *
- * Used by some functions in this module.
- *
- * @param op1 Dividend.
- * @param op2 Divisor.
- *
- * @return Rounded quotient.
- *
- */
-static time_t floor_div(time_t op1, time_t op2)
-{
-	if ((op1 >= 0) || (op1 % op2 == 0))
-		return op1 / op2;
-
-	return op1 / op2 - 1;
-}
-
-/** Modulo that rounds to negative infinity.
- *
- * Used by some functions in this module.
- *
- * @param op1 Dividend.
- * @param op2 Divisor.
- *
- * @return Remainder.
- *
- */
-static time_t floor_mod(time_t op1, time_t op2)
-{
-	time_t div = floor_div(op1, op2);
-
-	/*
-	 * (a / b) * b + a % b == a
-	 * Thus: a % b == a - (a / b) * b
-	 */
-
-	time_t result = op1 - div * op2;
-
-	/* Some paranoid checking to ensure there is mistake here. */
-	assert(result >= 0);
-	assert(result < op2);
-	assert(div * op2 + result == op1);
-
-	return result;
-}
-
-/** Number of days since the Epoch.
- *
- * Epoch is 1970-01-01, which is also equal to day 0.
- *
- * @param year Year (year 1900 = 0, may be negative).
- * @param mon  Month (January = 0).
- * @param mday Day of month (first day = 1).
- *
- * @return Number of days since the Epoch.
- *
- */
-static time_t days_since_epoch(time_t year, time_t mon, time_t mday)
-{
-	return (year - 70) * 365 + floor_div(year - 69, 4) -
-	    floor_div(year - 1, 100) + floor_div(year + 299, 400) +
-	    day_of_year(year, mon, mday);
-}
-
-/** Seconds since the Epoch.
- *
- * See also days_since_epoch().
- *
- * @param tm Normalized broken-down time.
- *
- * @return Number of seconds since the epoch, not counting leap seconds.
- *
- */
-static time_t secs_since_epoch(const struct tm *tm)
-{
-	return days_since_epoch(tm->tm_year, tm->tm_mon, tm->tm_mday) *
-	    SECS_PER_DAY + tm->tm_hour * SECS_PER_HOUR +
-	    tm->tm_min * SECS_PER_MIN + tm->tm_sec;
-}
-
-/** Which day of week the specified date is.
- *
- * @param year Year (year 1900 = 0).
- * @param mon  Month (January = 0).
- * @param mday Day of month (first = 1).
- *
- * @return Day of week (Sunday = 0).
- *
- */
-static time_t day_of_week(time_t year, time_t mon, time_t mday)
-{
-	/* 1970-01-01 is Thursday */
-	return floor_mod(days_since_epoch(year, mon, mday) + 4, 7);
-}
-
-/** Normalize the broken-down time.
- *
- * Optionally add specified amount of seconds.
- *
- * @param tm Broken-down time to normalize.
- * @param ts Timespec to add.
- *
- * @return 0 on success, -1 on overflow
- *
- */
-static int normalize_tm_ts(struct tm *tm, const struct timespec *ts)
-{
-	// TODO: DST correction
-
-	/* Set initial values. */
-	time_t nsec = tm->tm_nsec + ts->tv_nsec;
-	time_t sec = tm->tm_sec + ts->tv_sec;
-	time_t min = tm->tm_min;
-	time_t hour = tm->tm_hour;
-	time_t day = tm->tm_mday - 1;
-	time_t mon = tm->tm_mon;
-	time_t year = tm->tm_year;
-
-	/* Adjust time. */
-	sec += floor_div(nsec, NSECS_PER_SEC);
-	nsec = floor_mod(nsec, NSECS_PER_SEC);
-	min += floor_div(sec, SECS_PER_MIN);
-	sec = floor_mod(sec, SECS_PER_MIN);
-	hour += floor_div(min, MINS_PER_HOUR);
-	min = floor_mod(min, MINS_PER_HOUR);
-	day += floor_div(hour, HOURS_PER_DAY);
-	hour = floor_mod(hour, HOURS_PER_DAY);
-
-	/* Adjust month. */
-	year += floor_div(mon, 12);
-	mon = floor_mod(mon, 12);
-
-	/* Now the difficult part - days of month. */
-
-	/* First, deal with whole cycles of 400 years = 146097 days. */
-	year += floor_div(day, 146097) * 400;
-	day = floor_mod(day, 146097);
-
-	/* Then, go in one year steps. */
-	if (mon <= 1) {
-		/* January and February. */
-		while (day > 365) {
-			day -= is_leap_year(year) ? 366 : 365;
-			year++;
-		}
-	} else {
-		/* Rest of the year. */
-		while (day > 365) {
-			day -= is_leap_year(year + 1) ? 366 : 365;
-			year++;
-		}
-	}
-
-	/* Finally, finish it off month per month. */
-	while (day >= days_in_month(year, mon)) {
-		day -= days_in_month(year, mon);
-		mon++;
-
-		if (mon >= 12) {
-			mon -= 12;
-			year++;
-		}
-	}
-
-	/* Calculate the remaining two fields. */
-	tm->tm_yday = day_of_year(year, mon, day + 1);
-	tm->tm_wday = day_of_week(year, mon, day + 1);
-
-	/* And put the values back to the struct. */
-	tm->tm_nsec = (int) nsec;
-	tm->tm_sec = (int) sec;
-	tm->tm_min = (int) min;
-	tm->tm_hour = (int) hour;
-	tm->tm_mday = (int) day + 1;
-	tm->tm_mon = (int) mon;
-
-	/* Casts to work around POSIX brain-damage. */
-	if (year > ((int) INT_MAX) || year < ((int) INT_MIN)) {
-		tm->tm_year = (year < 0) ? ((int) INT_MIN) : ((int) INT_MAX);
-		return -1;
-	}
-
-	tm->tm_year = (int) year;
-	return 0;
-}
-
-static int normalize_tm_time(struct tm *tm, time_t time)
-{
-	struct timespec ts = {
-		.tv_sec = time,
-		.tv_nsec = 0
-	};
-
-	return normalize_tm_ts(tm, &ts);
-}
-
-/** Which day the week-based year starts on.
- *
- * Relative to the first calendar day. E.g. if the year starts
- * on December 31st, the return value is -1.
- *
- * @param Year since 1900.
- *
- * @return Offset of week-based year relative to calendar year.
- *
- */
-static int wbyear_offset(int year)
-{
-	int start_wday = day_of_week(year, 0, 1);
-
-	return floor_mod(4 - start_wday, 7) - 3;
-}
-
-/** Week-based year of the specified time.
- *
- * @param tm Normalized broken-down time.
- *
- * @return Week-based year.
- *
- */
-static int wbyear(const struct tm *tm)
-{
-	int day = tm->tm_yday - wbyear_offset(tm->tm_year);
-
-	if (day < 0) {
-		/* Last week of previous year. */
-		return tm->tm_year - 1;
-	}
-
-	if (day > 364 + is_leap_year(tm->tm_year)) {
-		/* First week of next year. */
-		return tm->tm_year + 1;
-	}
-
-	/* All the other days are in the calendar year. */
-	return tm->tm_year;
-}
-
-/** Week number of the year (assuming weeks start on Sunday).
- *
- * The first Sunday of January is the first day of week 1;
- * days in the new year before this are in week 0.
- *
- * @param tm Normalized broken-down time.
- *
- * @return The week number (0 - 53).
- *
- */
-static int sun_week_number(const struct tm *tm)
-{
-	int first_day = (7 - day_of_week(tm->tm_year, 0, 1)) % 7;
-
-	return (tm->tm_yday - first_day + 7) / 7;
-}
-
-/** Week number of the year (assuming weeks start on Monday).
- *
- * If the week containing January 1st has four or more days
- * in the new year, then it is considered week 1. Otherwise,
- * it is the last week of the previous year, and the next week
- * is week 1. Both January 4th and the first Thursday
- * of January are always in week 1.
- *
- * @param tm Normalized broken-down time.
- *
- * @return The week number (1 - 53).
- *
- */
-static int iso_week_number(const struct tm *tm)
-{
-	int day = tm->tm_yday - wbyear_offset(tm->tm_year);
-
-	if (day < 0) {
-		/* Last week of previous year. */
-		return 53;
-	}
-
-	if (day > 364 + is_leap_year(tm->tm_year)) {
-		/* First week of next year. */
-		return 1;
-	}
-
-	/* All the other days give correct answer. */
-	return (day / 7 + 1);
-}
-
-/** Week number of the year (assuming weeks start on Monday).
- *
- * The first Monday of January is the first day of week 1;
- * days in the new year before this are in week 0.
- *
- * @param tm Normalized broken-down time.
- *
- * @return The week number (0 - 53).
- *
- */
-static int mon_week_number(const struct tm *tm)
-{
-	int first_day = (1 - day_of_week(tm->tm_year, 0, 1)) % 7;
-
-	return (tm->tm_yday - first_day + 7) / 7;
-}
-
-static void ts_normalize(struct timespec *ts)
-{
-	while (ts->tv_nsec >= NSECS_PER_SEC) {
-		ts->tv_sec++;
-		ts->tv_nsec -= NSECS_PER_SEC;
-	}
-	while (ts->tv_nsec < 0) {
-		ts->tv_sec--;
-		ts->tv_nsec += NSECS_PER_SEC;
-	}
-}
-
-/** Add nanoseconds to given timespec.
- *
- * @param ts     Destination timespec.
- * @param nsecs  Number of nanoseconds to add.
- *
- */
-void ts_add_diff(struct timespec *ts, nsec_t nsecs)
-{
-	ts->tv_sec += nsecs / NSECS_PER_SEC;
-	ts->tv_nsec += nsecs % NSECS_PER_SEC;
-	ts_normalize(ts);
-}
-
-/** Add two timespecs.
- *
- * @param ts1  First timespec.
- * @param ts2  Second timespec.
- */
-void ts_add(struct timespec *ts1, const struct timespec *ts2)
-{
-	ts1->tv_sec += ts2->tv_sec;
-	ts1->tv_nsec += ts2->tv_nsec;
-	ts_normalize(ts1);
-}
-
-/** Subtract two timespecs.
- *
- * @param ts1  First timespec.
- * @param ts2  Second timespec.
- *
- * @return  Difference between ts1 and ts2 (ts1 - ts2) in nanoseconds.
- *
- */
-nsec_t ts_sub_diff(const struct timespec *ts1, const struct timespec *ts2)
-{
-	return (nsec_t) (ts1->tv_nsec - ts2->tv_nsec) +
-	    SEC2NSEC((ts1->tv_sec - ts2->tv_sec));
-}
-
-/** Subtract two timespecs.
- *
- * @param ts1  First timespec.
- * @param ts2  Second timespec.
- *
- */
-void ts_sub(struct timespec *ts1, const struct timespec *ts2)
-{
-	ts1->tv_sec -= ts2->tv_sec;
-	ts1->tv_nsec -= ts2->tv_nsec;
-	ts_normalize(ts1);
-}
-
-/** Decide if one timespec is greater than the other.
- *
- * @param ts1  First timespec.
- * @param ts2  Second timespec.
- *
- * @return  True if ts1 is greater than ts2.
- * @return  False otherwise.
- *
- */
-bool ts_gt(const struct timespec *ts1, const struct timespec *ts2)
-{
-	if (ts1->tv_sec > ts2->tv_sec)
-		return true;
-
-	if ((ts1->tv_sec == ts2->tv_sec) && (ts1->tv_nsec > ts2->tv_nsec))
-		return true;
-
-	return false;
-}
-
-/** Decide if one timespec is greater than or equal to the other.
- *
- * @param ts1  First timespec.
- * @param ts2  Second timespec.
- *
- * @return  True if ts1 is greater than or equal to ts2.
- * @return  False otherwise.
- *
- */
-bool ts_gteq(const struct timespec *ts1, const struct timespec *ts2)
-{
-	if (ts1->tv_sec > ts2->tv_sec)
-		return true;
-
-	if ((ts1->tv_sec == ts2->tv_sec) && (ts1->tv_nsec >= ts2->tv_nsec))
-		return true;
-
-	return false;
-}
-
-/** Get real time from a RTC service.
- *
- * @param[out] ts  Timespec to hold time read from the RTC service (if
- *                 available). If no such service exists, the returned time
- *                 corresponds to system uptime.
- */
-void getrealtime(struct timespec *ts)
-{
-	if (clock_conn == NULL) {
-		category_id_t cat_id;
-		errno_t rc = loc_category_get_id("clock", &cat_id, IPC_FLAG_BLOCKING);
-		if (rc != EOK)
-			goto fallback;
-
-		service_id_t *svc_ids;
-		size_t svc_cnt;
-		rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
-		if (rc != EOK)
-			goto fallback;
-
-		if (svc_cnt == 0)
-			goto fallback;
-
-		char *svc_name;
-		rc = loc_service_get_name(svc_ids[0], &svc_name);
-		free(svc_ids);
-		if (rc != EOK)
-			goto fallback;
-
-		service_id_t svc_id;
-		rc = loc_service_get_id(svc_name, &svc_id, 0);
-		free(svc_name);
-		if (rc != EOK)
-			goto fallback;
-
-		clock_conn = loc_service_connect(svc_id, INTERFACE_DDF,
-		    IPC_FLAG_BLOCKING);
-		if (!clock_conn)
-			goto fallback;
-	}
-
-	struct tm time;
-	errno_t rc = clock_dev_time_get(clock_conn, &time);
-	if (rc != EOK)
-		goto fallback;
-
-	ts->tv_nsec = time.tm_nsec;
-	ts->tv_sec = mktime(&time);
-
-	return;
-
-fallback:
-	getuptime(ts);
-}
-
-/** Get system uptime.
- *
- * @param[out] ts  Timespec to hold time current uptime.
- *
- * The time variables are memory mapped (read-only) from kernel which
- * updates them periodically.
- *
- * As it is impossible to read 2 values atomically, we use a trick:
- * First we read the seconds, then we read the microseconds, then we
- * read the seconds again. If a second elapsed in the meantime, set
- * the microseconds to zero.
- *
- * This assures that the values returned by two subsequent calls
- * to getuptime() are monotonous.
- *
- */
-void getuptime(struct timespec *ts)
-{
-	if (ktime == NULL) {
-		uintptr_t faddr;
-		errno_t rc = sysinfo_get_value("clock.faddr", &faddr);
-		if (rc != EOK) {
-			errno = rc;
-			goto fallback;
-		}
-
-		void *addr = AS_AREA_ANY;
-		rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE,
-		    &addr);
-		if (rc != EOK) {
-			as_area_destroy(addr);
-			errno = rc;
-			goto fallback;
-		}
-
-		ktime = addr;
-	}
-
-	sysarg_t s2 = ktime->seconds2;
-
-	read_barrier();
-	ts->tv_nsec = USEC2NSEC(ktime->useconds);
-
-	read_barrier();
-	sysarg_t s1 = ktime->seconds1;
-
-	if (s1 != s2) {
-		ts->tv_sec = max(s1, s2);
-		ts->tv_nsec = 0;
-	} else
-		ts->tv_sec = s1;
-
-	return;
-
-fallback:
-	ts->tv_sec = 0;
-	ts->tv_nsec = 0;
-}
-
-time_t time(time_t *tloc)
-{
-	struct timespec ts;
-	getrealtime(&ts);
-
-	if (tloc)
-		*tloc = ts.tv_sec;
-
-	return ts.tv_sec;
-}
-
-void udelay(sysarg_t time)
-{
-	(void) __SYSCALL1(SYS_THREAD_UDELAY, (sysarg_t) time);
-}
-
-/** Get time from broken-down time.
- *
- * First normalize the provided broken-down time
- * (moves all values to their proper bounds) and
- * then try to calculate the appropriate time_t
- * representation.
- *
- * @param tm Broken-down time.
- *
- * @return time_t representation of the time.
- * @return Undefined value on overflow.
- *
- */
-time_t mktime(struct tm *tm)
-{
-	// TODO: take DST flag into account
-	// TODO: detect overflow
-
-	normalize_tm_time(tm, 0);
-	return secs_since_epoch(tm);
-}
-
-/*
- * FIXME: This requires POSIX-correct snprintf.
- *        Otherwise it won't work with non-ASCII chars.
- */
-#define APPEND(...) \
-	{ \
-		consumed = snprintf(ptr, remaining, __VA_ARGS__); \
-		if (consumed >= remaining) \
-			return 0; \
-		\
-		ptr += consumed; \
-		remaining -= consumed; \
-	}
-
-#define RECURSE(fmt) \
-	{ \
-		consumed = strftime(ptr, remaining, fmt, tm); \
-		if (consumed == 0) \
-			return 0; \
-		\
-		ptr += consumed; \
-		remaining -= consumed; \
-	}
-
-#define TO_12H(hour) \
-	(((hour) > 12) ? ((hour) - 12) : \
-	    (((hour) == 0) ? 12 : (hour)))
-
-/** Convert time and date to a string.
- *
- * @param s       Buffer to write string to.
- * @param maxsize Size of the buffer.
- * @param format  Format of the output.
- * @param tm      Broken-down time to format.
- *
- * @return Number of bytes written.
- *
- */
-size_t strftime(char *restrict s, size_t maxsize,
-    const char *restrict format, const struct tm *restrict tm)
-{
-	assert(s != NULL);
-	assert(format != NULL);
-	assert(tm != NULL);
-
-	// TODO: use locale
-
-	static const char *wday_abbr[] = {
-		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-	};
-
-	static const char *wday[] = {
-		"Sunday", "Monday", "Tuesday", "Wednesday",
-		"Thursday", "Friday", "Saturday"
-	};
-
-	static const char *mon_abbr[] = {
-		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-	};
-
-	static const char *mon[] = {
-		"January", "February", "March", "April", "May", "June", "July",
-		"August", "September", "October", "November", "December"
-	};
-
-	if (maxsize < 1)
-		return 0;
-
-	char *ptr = s;
-	size_t consumed;
-	size_t remaining = maxsize;
-
-	while (*format != '\0') {
-		if (*format != '%') {
-			APPEND("%c", *format);
-			format++;
-			continue;
-		}
-
-		format++;
-		if ((*format == '0') || (*format == '+')) {
-			// TODO: padding
-			format++;
-		}
-
-		while (isdigit(*format)) {
-			// TODO: padding
-			format++;
-		}
-
-		if ((*format == 'O') || (*format == 'E')) {
-			// TODO: locale's alternative format
-			format++;
-		}
-
-		switch (*format) {
-		case 'a':
-			APPEND("%s", wday_abbr[tm->tm_wday]);
-			break;
-		case 'A':
-			APPEND("%s", wday[tm->tm_wday]);
-			break;
-		case 'b':
-			APPEND("%s", mon_abbr[tm->tm_mon]);
-			break;
-		case 'B':
-			APPEND("%s", mon[tm->tm_mon]);
-			break;
-		case 'c':
-			// TODO: locale-specific datetime format
-			RECURSE("%Y-%m-%d %H:%M:%S");
-			break;
-		case 'C':
-			APPEND("%02d", (1900 + tm->tm_year) / 100);
-			break;
-		case 'd':
-			APPEND("%02d", tm->tm_mday);
-			break;
-		case 'D':
-			RECURSE("%m/%d/%y");
-			break;
-		case 'e':
-			APPEND("%2d", tm->tm_mday);
-			break;
-		case 'F':
-			RECURSE("%+4Y-%m-%d");
-			break;
-		case 'g':
-			APPEND("%02d", wbyear(tm) % 100);
-			break;
-		case 'G':
-			APPEND("%d", wbyear(tm));
-			break;
-		case 'h':
-			RECURSE("%b");
-			break;
-		case 'H':
-			APPEND("%02d", tm->tm_hour);
-			break;
-		case 'I':
-			APPEND("%02d", TO_12H(tm->tm_hour));
-			break;
-		case 'j':
-			APPEND("%03d", tm->tm_yday);
-			break;
-		case 'k':
-			APPEND("%2d", tm->tm_hour);
-			break;
-		case 'l':
-			APPEND("%2d", TO_12H(tm->tm_hour));
-			break;
-		case 'm':
-			APPEND("%02d", tm->tm_mon);
-			break;
-		case 'M':
-			APPEND("%02d", tm->tm_min);
-			break;
-		case 'n':
-			APPEND("\n");
-			break;
-		case 'p':
-			APPEND("%s", tm->tm_hour < 12 ? "AM" : "PM");
-			break;
-		case 'P':
-			APPEND("%s", tm->tm_hour < 12 ? "am" : "PM");
-			break;
-		case 'r':
-			RECURSE("%I:%M:%S %p");
-			break;
-		case 'R':
-			RECURSE("%H:%M");
-			break;
-		case 's':
-			APPEND("%lld", secs_since_epoch(tm));
-			break;
-		case 'S':
-			APPEND("%02d", tm->tm_sec);
-			break;
-		case 't':
-			APPEND("\t");
-			break;
-		case 'T':
-			RECURSE("%H:%M:%S");
-			break;
-		case 'u':
-			APPEND("%d", (tm->tm_wday == 0) ? 7 : tm->tm_wday);
-			break;
-		case 'U':
-			APPEND("%02d", sun_week_number(tm));
-			break;
-		case 'V':
-			APPEND("%02d", iso_week_number(tm));
-			break;
-		case 'w':
-			APPEND("%d", tm->tm_wday);
-			break;
-		case 'W':
-			APPEND("%02d", mon_week_number(tm));
-			break;
-		case 'x':
-			// TODO: locale-specific date format
-			RECURSE("%Y-%m-%d");
-			break;
-		case 'X':
-			// TODO: locale-specific time format
-			RECURSE("%H:%M:%S");
-			break;
-		case 'y':
-			APPEND("%02d", tm->tm_year % 100);
-			break;
-		case 'Y':
-			APPEND("%d", 1900 + tm->tm_year);
-			break;
-		case 'z':
-			// TODO: timezone
-			break;
-		case 'Z':
-			// TODO: timezone
-			break;
-		case '%':
-			APPEND("%%");
-			break;
-		default:
-			/* Invalid specifier, print verbatim. */
-			while (*format != '%')
-				format--;
-
-			APPEND("%%");
-			break;
-		}
-
-		format++;
-	}
-
-	return maxsize - remaining;
-}
-
-/** Convert a time value to a broken-down UTC time/
- *
- * @param time   Time to convert
- * @param result Structure to store the result to
- *
- * @return EOK or an error code
- *
- */
-errno_t time_utc2tm(const time_t time, struct tm *restrict result)
-{
-	assert(result != NULL);
-
-	/* Set result to epoch. */
-	result->tm_nsec = 0;
-	result->tm_sec = 0;
-	result->tm_min = 0;
-	result->tm_hour = 0;
-	result->tm_mday = 1;
-	result->tm_mon = 0;
-	result->tm_year = 70; /* 1970 */
-
-	if (normalize_tm_time(result, time) == -1)
-		return EOVERFLOW;
-
-	return EOK;
-}
-
-/** Convert a time value to a NULL-terminated string.
- *
- * The format is "Wed Jun 30 21:49:08 1993\n" expressed in UTC.
- *
- * @param time Time to convert.
- * @param buf  Buffer to store the string to, must be at least
- *             ASCTIME_BUF_LEN bytes long.
- *
- * @return EOK or an error code.
- *
- */
-errno_t time_utc2str(const time_t time, char *restrict buf)
-{
-	struct tm tm;
-	errno_t ret = time_utc2tm(time, &tm);
-	if (ret != EOK)
-		return ret;
-
-	time_tm2str(&tm, buf);
-	return EOK;
-}
-
-/** Convert broken-down time to a NULL-terminated string.
- *
- * The format is "Sun Jan 1 00:00:00 1970\n". (Obsolete)
- *
- * @param timeptr Broken-down time structure.
- * @param buf     Buffer to store string to, must be at least
- *                ASCTIME_BUF_LEN bytes long.
- *
- */
-void time_tm2str(const struct tm *restrict timeptr, char *restrict buf)
-{
-	assert(timeptr != NULL);
-	assert(buf != NULL);
-
-	static const char *wday[] = {
-		"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-	};
-
-	static const char *mon[] = {
-		"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-		"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-	};
-
-	snprintf(buf, ASCTIME_BUF_LEN, "%s %s %2d %02d:%02d:%02d %d\n",
-	    wday[timeptr->tm_wday],
-	    mon[timeptr->tm_mon],
-	    timeptr->tm_mday, timeptr->tm_hour,
-	    timeptr->tm_min, timeptr->tm_sec,
-	    1900 + timeptr->tm_year);
-}
-
-/** Converts a time value to a broken-down local time.
- *
- * Time is expressed relative to the user's specified timezone.
- *
- * @param tv     Timeval to convert.
- * @param result Structure to store the result to.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_ts2tm(const struct timespec *ts, struct tm *restrict result)
-{
-	// TODO: Deal with timezones.
-	//       Currently assumes system and all times are in UTC
-
-	/* Set result to epoch. */
-	result->tm_nsec = 0;
-	result->tm_sec = 0;
-	result->tm_min = 0;
-	result->tm_hour = 0;
-	result->tm_mday = 1;
-	result->tm_mon = 0;
-	result->tm_year = 70; /* 1970 */
-
-	if (normalize_tm_ts(result, ts) == -1)
-		return EOVERFLOW;
-
-	return EOK;
-}
-
-/** Converts a time value to a broken-down local time.
- *
- * Time is expressed relative to the user's specified timezone.
- *
- * @param timer  Time to convert.
- * @param result Structure to store the result to.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_local2tm(const time_t time, struct tm *restrict result)
-{
-	struct timespec ts = {
-		.tv_sec = time,
-		.tv_nsec = 0
-	};
-
-	return time_ts2tm(&ts, result);
-}
-
-/** Convert the calendar time to a NULL-terminated string.
- *
- * The format is "Wed Jun 30 21:49:08 1993\n" expressed relative to the
- * user's specified timezone.
- *
- * @param timer Time to convert.
- * @param buf   Buffer to store the string to. Must be at least
- *              ASCTIME_BUF_LEN bytes long.
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t time_local2str(const time_t time, char *buf)
-{
-	struct tm loctime;
-	errno_t ret = time_local2tm(time, &loctime);
-	if (ret != EOK)
-		return ret;
-
-	time_tm2str(&loctime, buf);
-	return EOK;
-}
-
-/** Calculate the difference between two times, in seconds.
- *
- * @param time1 First time.
- * @param time0 Second time.
- *
- * @return Time difference in seconds.
- *
- */
-double difftime(time_t time1, time_t time0)
-{
-	return (double) (time1 - time0);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/tmpfile.c
===================================================================
--- uspace/lib/c/generic/tmpfile.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file Temporary files
- */
-
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-#include <str.h>
-#include <tmpfile.h>
-#include <vfs/vfs.h>
-
-static size_t tmpfile_cnt = 0;
-static FIBRIL_MUTEX_INITIALIZE(tmpfile_lock);
-
-/** Create and open file suitable as temporary file based on template.
- *
- * This is designed to allow creating temporary files compatible with POSIX
- * mk(s)temp and tempnam, as well as for the use of ISO C tmpfile, tmpnam.
- *
- * @param templ
- * @param create If @c false, only construct file name
- *
- * @return If @a create is true, open file descriptor on success (and
- *         @a *templ is filled in with actual file name),
- *         if @a create is false, zero on success. -1 on failure.
- */
-int __tmpfile_templ(char *templ, bool create)
-{
-	size_t tsize;
-	char *p;
-	int file;
-	errno_t rc;
-
-	tsize = str_size(templ);
-	if (tsize < 6)
-		return -1;
-
-	p = templ + tsize - 6;
-	if (str_cmp(p, "XXXXXX") != 0)
-		return -1;
-
-	fibril_mutex_lock(&tmpfile_lock);
-
-	while (tmpfile_cnt < 1000000) {
-		snprintf(p, 6 + 1, "%06zu", tmpfile_cnt);
-		if (create) {
-			/* Try creating file */
-			rc = vfs_lookup(templ, WALK_MUST_CREATE |
-			    WALK_REGULAR, &file);
-			if (rc == EOK) {
-				rc = vfs_open(file, MODE_READ | MODE_WRITE);
-				if (rc == EOK) {
-					++tmpfile_cnt;
-					fibril_mutex_unlock(&tmpfile_lock);
-					return file;
-				}
-
-				vfs_put(file);
-			}
-		} else {
-			/* Test if file exists */
-			rc = vfs_lookup(templ, 0, &file);
-			if (rc != EOK) {
-				++tmpfile_cnt;
-				fibril_mutex_unlock(&tmpfile_lock);
-				return 0;
-			}
-
-			vfs_put(file);
-		}
-
-		++tmpfile_cnt;
-	}
-
-	fibril_mutex_unlock(&tmpfile_lock);
-	return -1;
-}
-
-/** Create and open temporary (unnamed) file.
- *
- * @return Open file descriptor on success, -1 on failure.
- */
-int __tmpfile(void)
-{
-	int file;
-	char namebuf[L_tmpnam];
-
-	str_cpy(namebuf, L_tmpnam, "/tmp/tmp.XXXXXX");
-
-	file = __tmpfile_templ(namebuf, true);
-	if (file < 0)
-		return -1;
-
-	(void) vfs_unlink_path(namebuf);
-	return file;
-}
-
-/** Construct temporary file name.
- *
- * @param namebuf Buffer that can hold at least L_tmpnam bytes
- * @return @a namebuf on success, @c NULL on failure
- */
-char *__tmpnam(char *namebuf)
-{
-	int rc;
-
-	str_cpy(namebuf, L_tmpnam, "/tmp/tmp.XXXXXX");
-
-	rc = __tmpfile_templ(namebuf, false);
-	if (rc < 0)
-		return NULL;
-
-	return namebuf;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/ubsan.c
===================================================================
--- uspace/lib/c/generic/ubsan.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,259 +1,0 @@
-// SPDX-License-Identifier: BSD-2-Clause
-/*
- * Copyright (c) 2016, Linaro Limited
- */
-
-/* Modified for HelenOS use by Jiří Zárevúcky. */
-
-#include <stdbool.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <mem.h>
-#include <io/kio.h>
-
-#define PRINTF(...) kio_printf(__VA_ARGS__)
-#define ubsan_panic() abort()
-
-struct source_location {
-	const char *file_name;
-	uint32_t line;
-	uint32_t column;
-};
-
-struct type_descriptor {
-	uint16_t type_kind;
-	uint16_t type_info;
-	char type_name[];
-};
-
-struct type_mismatch_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-	unsigned long alignment;
-	unsigned char type_check_kind;
-};
-
-struct type_mismatch_data_v1 {
-	struct source_location loc;
-	struct type_descriptor *type;
-	unsigned char log_alignment;
-	unsigned char type_check_kind;
-};
-
-struct overflow_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct shift_out_of_bounds_data {
-	struct source_location loc;
-	struct type_descriptor *lhs_type;
-	struct type_descriptor *rhs_type;
-};
-
-struct out_of_bounds_data {
-	struct source_location loc;
-	struct type_descriptor *array_type;
-	struct type_descriptor *index_type;
-};
-
-struct unreachable_data {
-	struct source_location loc;
-};
-
-struct vla_bound_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct invalid_value_data {
-	struct source_location loc;
-	struct type_descriptor *type;
-};
-
-struct nonnull_arg_data {
-	struct source_location loc;
-};
-
-struct nonnull_return_data {
-	struct source_location loc;
-	struct source_location attr_loc;
-};
-
-struct pointer_overflow_data {
-	struct source_location loc;
-};
-
-/*
- * When compiling with -fsanitize=undefined the compiler expects functions
- * with the following signatures. The functions are never called directly,
- * only when undefined behavior is detected in instrumented code.
- */
-void __ubsan_handle_type_mismatch(struct type_mismatch_data *data, unsigned long ptr);
-void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data, unsigned long ptr);
-void __ubsan_handle_add_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_sub_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_mul_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_negate_overflow(struct overflow_data *data, unsigned long old_val);
-void __ubsan_handle_divrem_overflow(struct overflow_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, unsigned long lhs, unsigned long rhs);
-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, unsigned long idx);
-void __ubsan_handle_unreachable(struct unreachable_data *data);
-void __ubsan_handle_missing_return(struct unreachable_data *data);
-void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, unsigned long bound);
-void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, unsigned long val);
-#if __GCC_VERSION < 60000
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data, size_t arg_no);
-#else
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data);
-#endif
-void __ubsan_handle_nonnull_return(struct nonnull_return_data *data);
-void __ubsan_handle_builtin_unreachable(struct unreachable_data *data);
-void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
-    unsigned long base, unsigned long result);
-
-static void print_loc(const char *func, struct source_location *loc)
-{
-	const char *f = func;
-	const char func_prefix[] = "__ubsan_handle";
-
-	if (!memcmp(f, func_prefix, sizeof(func_prefix) - 1))
-		f += sizeof(func_prefix);
-
-	PRINTF("####### Undefined behavior %s at %s:%" PRIu32 " col %" PRIu32 "\n",
-	    f, loc->file_name, loc->line, loc->column);
-}
-
-void __ubsan_handle_type_mismatch(struct type_mismatch_data *data,
-    unsigned long ptr)
-{
-	print_loc(__func__, &data->loc);
-	PRINTF("Type: %s, alignment: %lu, type_check_kind: %hhu\n",
-	    data->type->type_name, data->alignment, data->type_check_kind);
-	ubsan_panic();
-}
-
-void __ubsan_handle_type_mismatch_v1(struct type_mismatch_data_v1 *data,
-    unsigned long ptr)
-{
-	print_loc(__func__, &data->loc);
-	PRINTF("Type: %s, alignment: %hhu, type_check_kind: %hhu\n",
-	    data->type->type_name, data->log_alignment, data->type_check_kind);
-	ubsan_panic();
-}
-
-void __ubsan_handle_add_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_sub_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_mul_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_negate_overflow(struct overflow_data *data,
-    unsigned long old_val)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_divrem_overflow(struct overflow_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data,
-    unsigned long lhs,
-    unsigned long rhs)
-{
-	print_loc(__func__, &data->loc);
-	PRINTF("LHS type: %s, value: %lu, RHS type: %s, value: %lu\n",
-	    data->lhs_type->type_name, lhs, data->rhs_type->type_name, rhs);
-	ubsan_panic();
-}
-
-void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data,
-    unsigned long idx)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_unreachable(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_missing_return(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data,
-    unsigned long bound)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_load_invalid_value(struct invalid_value_data *data,
-    unsigned long val)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-#if __GCC_VERSION < 60000
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data, size_t arg_no)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-#else
-void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-#endif
-
-void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
-
-void __ubsan_handle_pointer_overflow(struct pointer_overflow_data *data,
-    unsigned long base, unsigned long result)
-{
-	print_loc(__func__, &data->loc);
-	ubsan_panic();
-}
Index: pace/lib/c/generic/udebug.c
===================================================================
--- uspace/lib/c/generic/udebug.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <udebug.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <abi/ipc/methods.h>
-#include <async.h>
-
-errno_t udebug_begin(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_1_0(exch, IPC_M_DEBUG, UDEBUG_M_BEGIN);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_end(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_1_0(exch, IPC_M_DEBUG, UDEBUG_M_END);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_set_evmask(async_sess_t *sess, udebug_evmask_t mask)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_0(exch, IPC_M_DEBUG, UDEBUG_M_SET_EVMASK, mask);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_thread_read(async_sess_t *sess, void *buffer, size_t n,
-    size_t *copied, size_t *needed)
-{
-	sysarg_t a_copied, a_needed;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_THREAD_READ,
-	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
-	async_exchange_end(exch);
-
-	*copied = (size_t) a_copied;
-	*needed = (size_t) a_needed;
-
-	return rc;
-}
-
-errno_t udebug_name_read(async_sess_t *sess, void *buffer, size_t n,
-    size_t *copied, size_t *needed)
-{
-	sysarg_t a_copied, a_needed;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_NAME_READ,
-	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
-	async_exchange_end(exch);
-
-	*copied = (size_t) a_copied;
-	*needed = (size_t) a_needed;
-
-	return rc;
-}
-
-errno_t udebug_areas_read(async_sess_t *sess, void *buffer, size_t n,
-    size_t *copied, size_t *needed)
-{
-	sysarg_t a_copied, a_needed;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_3(exch, IPC_M_DEBUG, UDEBUG_M_AREAS_READ,
-	    (sysarg_t) buffer, n, NULL, &a_copied, &a_needed);
-	async_exchange_end(exch);
-
-	*copied = (size_t) a_copied;
-	*needed = (size_t) a_needed;
-
-	return rc;
-}
-
-errno_t udebug_mem_read(async_sess_t *sess, void *buffer, uintptr_t addr, size_t n)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_4_0(exch, IPC_M_DEBUG, UDEBUG_M_MEM_READ,
-	    (sysarg_t) buffer, addr, n);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_args_read(async_sess_t *sess, thash_t tid, sysarg_t *buffer)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, IPC_M_DEBUG, UDEBUG_M_ARGS_READ,
-	    tid, (sysarg_t) buffer);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_regs_read(async_sess_t *sess, thash_t tid, void *buffer)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, IPC_M_DEBUG, UDEBUG_M_REGS_READ,
-	    tid, (sysarg_t) buffer);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t udebug_go(async_sess_t *sess, thash_t tid, udebug_event_t *ev_type,
-    sysarg_t *val0, sysarg_t *val1)
-{
-	sysarg_t a_ev_type;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_3(exch, IPC_M_DEBUG, UDEBUG_M_GO,
-	    tid, &a_ev_type, val0, val1);
-	async_exchange_end(exch);
-
-	*ev_type = a_ev_type;
-	return rc;
-}
-
-errno_t udebug_stop(async_sess_t *sess, thash_t tid)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_0(exch, IPC_M_DEBUG, UDEBUG_M_STOP, tid);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/c/generic/uuid.c
===================================================================
--- uspace/lib/c/generic/uuid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file Universaly Unique Identifier (see RFC 4122)
- */
-
-#include <errno.h>
-#include <uuid.h>
-#include <rndgen.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <stdio.h>
-
-static void encode16_be(uint8_t *, uint16_t);
-static void encode16_le(uint8_t *, uint16_t);
-static void encode32_be(uint8_t *, uint32_t);
-static void encode32_le(uint8_t *, uint32_t);
-static uint16_t decode16_be(uint8_t *);
-static uint16_t decode16_le(uint8_t *);
-static uint32_t decode32_be(uint8_t *);
-static uint32_t decode32_le(uint8_t *);
-
-/** Generate UUID.
- *
- * @param uuid Place to store generated UUID
- * @return EOK on success or an error code
- */
-errno_t uuid_generate(uuid_t *uuid)
-{
-	int i;
-	rndgen_t *rndgen;
-	errno_t rc;
-
-	rc = rndgen_create(&rndgen);
-	if (rc != EOK)
-		return EIO;
-
-	rc = rndgen_uint32(rndgen, &uuid->time_low);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = rndgen_uint16(rndgen, &uuid->time_mid);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = rndgen_uint16(rndgen, &uuid->time_hi_and_version);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = rndgen_uint8(rndgen, &uuid->clock_seq_hi_and_reserved);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = rndgen_uint8(rndgen, &uuid->clock_seq_low);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	for (i = 0; i < _UUID_NODE_LEN; i++) {
-		rc = rndgen_uint8(rndgen, &uuid->node[i]);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	/* Version 4 UUID from random or pseudo-random numbers */
-	uuid->time_hi_and_version = (uuid->time_hi_and_version & 0x0fff) | 0x4000;
-	uuid->clock_seq_hi_and_reserved = (uuid->clock_seq_hi_and_reserved & 0x3f) | 0x80;
-
-error:
-	rndgen_destroy(rndgen);
-	return rc;
-}
-
-/** Encode UUID into binary form per RFC 4122.
- *
- * @param uuid UUID
- * @param buf 16-byte destination buffer
- */
-void uuid_encode(uuid_t *uuid, uint8_t *buf)
-{
-	int i;
-
-	encode32_be(buf, uuid->time_low);
-	encode16_be(buf + 4, uuid->time_mid);
-	encode16_be(buf + 6, uuid->time_hi_and_version);
-	buf[8] = uuid->clock_seq_hi_and_reserved;
-	buf[9] = uuid->clock_seq_low;
-
-	for (i = 0; i < _UUID_NODE_LEN; i++)
-		buf[10 + i] = uuid->node[i];
-}
-
-/** Decode UUID from binary form per RFC 4122.
- *
- * @param buf 16-byte source buffer
- * @param uuid Place to store UUID
- */
-void uuid_decode(uint8_t *buf, uuid_t *uuid)
-{
-	int i;
-
-	uuid->time_low = decode32_be(buf);
-	uuid->time_mid = decode16_be(buf + 4);
-	uuid->time_hi_and_version = decode16_be(buf + 6);
-	uuid->clock_seq_hi_and_reserved = buf[8];
-	uuid->clock_seq_low = buf[9];
-
-	for (i = 0; i < _UUID_NODE_LEN; i++)
-		uuid->node[i] = buf[10 + i];
-}
-
-/** Encode UUID into little-endian (GPT) binary form.
- *
- * @param uuid UUID
- * @param buf 16-byte destination buffer
- */
-void uuid_encode_le(uuid_t *uuid, uint8_t *buf)
-{
-	int i;
-
-	encode32_le(buf, uuid->time_low);
-	encode16_le(buf + 4, uuid->time_mid);
-	encode16_le(buf + 6, uuid->time_hi_and_version);
-	buf[8] = uuid->clock_seq_hi_and_reserved;
-	buf[9] = uuid->clock_seq_low;
-
-	for (i = 0; i < _UUID_NODE_LEN; i++)
-		buf[10 + i] = uuid->node[i];
-}
-
-/** Decode UUID from little-endian (GPT) binary form.
- *
- * @param buf 16-byte source buffer
- * @param uuid Place to store UUID
- */
-void uuid_decode_le(uint8_t *buf, uuid_t *uuid)
-{
-	int i;
-
-	uuid->time_low = decode32_le(buf);
-	uuid->time_mid = decode16_le(buf + 4);
-	uuid->time_hi_and_version = decode16_le(buf + 6);
-	uuid->clock_seq_hi_and_reserved = buf[8];
-	uuid->clock_seq_low = buf[9];
-
-	for (i = 0; i < _UUID_NODE_LEN; i++)
-		uuid->node[i] = buf[10 + i];
-}
-
-/** Parse string UUID.
- *
- * If @a endptr is not NULL, it is set to point to the first character
- * following the UUID. If @a endptr is NULL, the string must not contain
- * any characters following the UUID, otherwise an error is returned.
- *
- * @param str    String beginning with UUID string representation
- * @param uuid   Place to store UUID
- * @param endptr Place to store pointer to end of UUID or @c NULL
- *
- * @return EOK on success or an error code
- */
-errno_t uuid_parse(const char *str, uuid_t *uuid, const char **endptr)
-{
-	errno_t rc;
-	const char *eptr;
-	uint32_t time_low;
-	uint16_t time_mid;
-	uint16_t time_ver;
-	uint16_t clock;
-	uint64_t node;
-	int i;
-
-	rc = str_uint32_t(str, &eptr, 16, false, &time_low);
-	if (rc != EOK || eptr != str + 8 || *eptr != '-')
-		return EINVAL;
-
-	rc = str_uint16_t(str + 9, &eptr, 16, false, &time_mid);
-	if (rc != EOK || eptr != str + 13 || *eptr != '-')
-		return EINVAL;
-
-	rc = str_uint16_t(str + 14, &eptr, 16, false, &time_ver);
-	if (rc != EOK || eptr != str + 18 || *eptr != '-')
-		return EINVAL;
-
-	rc = str_uint16_t(str + 19, &eptr, 16, false, &clock);
-	if (rc != EOK || eptr != str + 23 || *eptr != '-')
-		return EINVAL;
-
-	rc = str_uint64_t(str + 24, &eptr, 16, false, &node);
-	if (rc != EOK || eptr != str + 36)
-		return EINVAL;
-
-	uuid->time_low = time_low;
-
-	uuid->time_mid = time_mid;
-
-	uuid->time_hi_and_version = time_ver;
-
-	uuid->clock_seq_hi_and_reserved = clock >> 8;
-
-	uuid->clock_seq_low = clock & 0xff;
-
-	for (i = 0; i < _UUID_NODE_LEN; i++)
-		uuid->node[i] = (node >> 8 * (5 - i)) & 0xff;
-
-	if (endptr != NULL) {
-		*endptr = str + 36;
-	} else {
-		if (*(str + 36) != '\0')
-			return EINVAL;
-	}
-
-	return EOK;
-}
-
-/** Format UUID into string representation.
- *
- * @param uuid UUID
- * @param rstr Place to store pointer to newly allocated string
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t uuid_format(uuid_t *uuid, char **rstr, bool uppercase)
-{
-	size_t size = 37;
-	char *str = malloc(sizeof(char) * size);
-	if (str == NULL)
-		return ENOMEM;
-
-	const char *format = "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
-	if (uppercase)
-		format = "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
-
-	int ret = snprintf(str, size, format, uuid->time_low, uuid->time_mid,
-	    uuid->time_hi_and_version, uuid->clock_seq_hi_and_reserved,
-	    uuid->clock_seq_low, uuid->node[0], uuid->node[1], uuid->node[2],
-	    uuid->node[3], uuid->node[4], uuid->node[5]);
-
-	if (ret != 36) {
-		free(str);
-		return EINVAL;
-	}
-
-	*rstr = str;
-	return EOK;
-}
-
-static void encode16_be(uint8_t *buf, uint16_t value)
-{
-	buf[0] = (value >> 8) & 0xff;
-	buf[1] = value & 0xff;
-}
-
-static void encode16_le(uint8_t *buf, uint16_t value)
-{
-	buf[0] = value & 0xff;
-	buf[1] = (value >> 8) & 0xff;
-}
-
-static void encode32_be(uint8_t *buf, uint32_t value)
-{
-	buf[0] = (value >> 24) & 0xff;
-	buf[1] = (value >> 16) & 0xff;
-	buf[2] = (value >> 8) & 0xff;
-	buf[3] = value & 0xff;
-}
-
-static void encode32_le(uint8_t *buf, uint32_t value)
-{
-	buf[0] = value & 0xff;
-	buf[1] = (value >> 8) & 0xff;
-	buf[2] = (value >> 16) & 0xff;
-	buf[3] = (value >> 24) & 0xff;
-}
-
-static uint16_t decode16_be(uint8_t *buf)
-{
-	return ((buf[0] << 8) | buf[1]);
-}
-
-static uint16_t decode16_le(uint8_t *buf)
-{
-	return ((buf[1] << 8) | buf[0]);
-}
-
-static uint32_t decode32_be(uint8_t *buf)
-{
-	return ((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);
-}
-
-static uint32_t decode32_le(uint8_t *buf)
-{
-	return ((buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0]);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/vfs/canonify.c
===================================================================
--- uspace/lib/c/generic/vfs/canonify.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,349 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief
- */
-
-#include <stdlib.h>
-#include <stddef.h>
-#include <vfs/canonify.h>
-
-/** Token types used for tokenization of path. */
-typedef enum {
-	TK_INVALID,
-	TK_SLASH,
-	TK_DOT,
-	TK_DOTDOT,
-	TK_COMP,
-	TK_NUL
-} tokval_t;
-
-typedef struct {
-	tokval_t kind;
-	char *start;
-	char *stop;
-} token_t;
-
-/** Fake up the TK_SLASH token. */
-static token_t slash_token(char *start)
-{
-	token_t ret;
-	ret.kind = TK_SLASH;
-	ret.start = start;
-	ret.stop = start;
-	return ret;
-}
-
-/** Given a token, return the next token. */
-static token_t next_token(token_t *cur)
-{
-	token_t ret;
-
-	if (cur->stop[1] == '\0') {
-		ret.kind = TK_NUL;
-		ret.start = cur->stop + 1;
-		ret.stop = ret.start;
-		return ret;
-	}
-	if (cur->stop[1] == '/') {
-		ret.kind = TK_SLASH;
-		ret.start = cur->stop + 1;
-		ret.stop = ret.start;
-		return ret;
-	}
-	if (cur->stop[1] == '.' && (!cur->stop[2] || cur->stop[2] == '/')) {
-		ret.kind = TK_DOT;
-		ret.start = cur->stop + 1;
-		ret.stop = ret.start;
-		return ret;
-	}
-	if (cur->stop[1] == '.' && cur->stop[2] == '.' &&
-	    (!cur->stop[3] || cur->stop[3] == '/')) {
-		ret.kind = TK_DOTDOT;
-		ret.start = cur->stop + 1;
-		ret.stop = cur->stop + 2;
-		return ret;
-	}
-	unsigned i = 1;
-	while (cur->stop[i] && cur->stop[i] != '/')
-		i++;
-
-	ret.kind = TK_COMP;
-	ret.start = &cur->stop[1];
-	ret.stop = &cur->stop[i - 1];
-	return ret;
-}
-
-/** States used by canonify(). */
-typedef enum {
-	S_INI,
-	S_A,
-	S_B,
-	S_C,
-	S_ACCEPT,
-	S_RESTART,
-	S_REJECT
-} state_t;
-
-typedef struct {
-	state_t s;
-	void (*f)(token_t *, token_t *, token_t *);
-} change_state_t;
-
-/*
- * Actions that can be performed when transitioning from one
- * state of canonify() to another.
- */
-static void set_first_slash(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	*tfsl = *t;
-	*tlcomp = *t;
-}
-static void save_component(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	*tlcomp = *t;
-}
-static void terminate_slash(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	if (tfsl->stop[1])	/* avoid writing to a well-formatted path */
-		tfsl->stop[1] = '\0';
-}
-static void remove_trailing_slash(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	t->start[-1] = '\0';
-}
-/** Eat the extra '/'.
- *
- * @param t		The current TK_SLASH token.
- */
-static void shift_slash(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	char *p = t->start;
-	char *q = t->stop + 1;
-	while ((*p++ = *q++))
-		;
-}
-/** Eat the extra '.'.
- *
- * @param t		The current TK_DOT token.
- */
-static void shift_dot(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	char *p = t->start;
-	char *q = t->stop + 1;
-	while ((*p++ = *q++))
-		;
-}
-/** Collapse the TK_COMP TK_SLASH TK_DOTDOT pattern.
- *
- * @param t		The current TK_DOTDOT token.
- * @param tlcomp	The last TK_COMP token.
- */
-static void shift_dotdot(token_t *t, token_t *tfsl, token_t *tlcomp)
-{
-	char *p = tlcomp->start;
-	char *q = t->stop + 1;
-	while ((*p++ = *q++))
-		;
-}
-
-/** Transition function for canonify(). */
-static change_state_t trans[4][6] = {
-	[S_INI] = {
-		[TK_SLASH] = {
-			.s = S_A,
-			.f = set_first_slash,
-		},
-		[TK_DOT] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_DOTDOT] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_COMP] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_NUL] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_INVALID] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-	},
-	[S_A] = {
-		[TK_SLASH] = {
-			.s = S_A,
-			.f = set_first_slash,
-		},
-		[TK_DOT] = {
-			.s = S_A,
-			.f = NULL,
-		},
-		[TK_DOTDOT] = {
-			.s = S_A,
-			.f = NULL,
-		},
-		[TK_COMP] = {
-			.s = S_B,
-			.f = save_component,
-		},
-		[TK_NUL] = {
-			.s = S_ACCEPT,
-			.f = terminate_slash,
-		},
-		[TK_INVALID] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-	},
-	[S_B] = {
-		[TK_SLASH] = {
-			.s = S_C,
-			.f = NULL,
-		},
-		[TK_DOT] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_DOTDOT] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_COMP] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-		[TK_NUL] = {
-			.s = S_ACCEPT,
-			.f = NULL,
-		},
-		[TK_INVALID] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-	},
-	[S_C] = {
-		[TK_SLASH] = {
-			.s = S_RESTART,
-			.f = shift_slash,
-		},
-		[TK_DOT] = {
-			.s = S_RESTART,
-			.f = shift_dot,
-		},
-		[TK_DOTDOT] = {
-			.s = S_RESTART,
-			.f = shift_dotdot,
-		},
-		[TK_COMP] = {
-			.s = S_B,
-			.f = save_component,
-		},
-		[TK_NUL] = {
-			.s = S_ACCEPT,
-			.f = remove_trailing_slash,
-		},
-		[TK_INVALID] = {
-			.s = S_REJECT,
-			.f = NULL,
-		},
-	}
-};
-
-/** Canonify a file system path.
- *
- * A file system path is canonical, if the following holds:
- *
- * 1) the path is absolute
- *    (i.e. a/b/c is not canonical)
- * 2) there is no trailing slash in the path if it has components
- *    (i.e. /a/b/c/ is not canonical)
- * 3) there is no extra slash in the path
- *    (i.e. /a//b/c is not canonical)
- * 4) there is no '.' component in the path
- *    (i.e. /a/./b/c is not canonical)
- * 5) there is no '..' component in the path
- *    (i.e. /a/b/../c is not canonical)
- *
- * This function makes a potentially non-canonical file system path canonical.
- * It works in-place and requires a NULL-terminated input string.
- *
- * @param path		Path to be canonified.
- * @param lenp		Pointer where the length of the final path will be
- *			stored. Can be NULL.
- *
- * @return		Canonified path or NULL on failure.
- */
-char *canonify(char *path, size_t *lenp)
-{
-	state_t state;
-	token_t t;
-	token_t tfsl;		/* first slash */
-	token_t tlcomp;		/* last component */
-	if (*path != '/')
-		return NULL;
-	tfsl = slash_token(path);
-restart:
-	state = S_INI;
-	t = tfsl;
-	tlcomp = tfsl;
-	while (state != S_ACCEPT && state != S_RESTART && state != S_REJECT) {
-		if (trans[state][t.kind].f)
-			trans[state][t.kind].f(&t, &tfsl, &tlcomp);
-		state = trans[state][t.kind].s;
-		t = next_token(&t);
-	}
-
-	switch (state) {
-	case S_RESTART:
-		goto restart;
-	case S_REJECT:
-		return NULL;
-	case S_ACCEPT:
-		if (lenp)
-			*lenp = (size_t)((tlcomp.stop - tfsl.start) + 1);
-		return tfsl.start;
-	default:
-		abort();
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/c/generic/vfs/inbox.c
===================================================================
--- uspace/lib/c/generic/vfs/inbox.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief
- */
-
-#include <vfs/inbox.h>
-#include <vfs/vfs.h>
-
-#include <adt/list.h>
-#include <str.h>
-#include <stdlib.h>
-#include <loader/pcb.h>
-#include "../private/io.h"
-#include <errno.h>
-
-/*
- * This is an attempt at generalization of the "standard files" concept to
- * arbitrary names.  When loading a task, the parent can put arbitrary files to
- * an "inbox" through IPC calls, every file in an inbox has a name assigned
- * (e.g. "stdin", "stdout", "stderr", "data", "logfile", etc.). The client then
- * retrieves those files from inbox by name. "stdin", "stdout" and "stderr" are
- * handled automatically by libc to initialize standard <stdio.h> streams and
- * legacy file descriptors 0, 1, 2. Other names are subject to conventions and
- * application-specific rules.
- */
-
-typedef struct {
-	link_t link;
-	char *name;
-	int file;
-} inbox_entry;
-
-static LIST_INITIALIZE(inb_list);
-
-/** Inserts a named file into the inbox.
- *
- * If a file with the same name is already present, it overwrites it and returns
- * the original value. Otherwise, it returns -1.  If the argument 'file' is -1,
- * nothing is inserted and the file with specified name is removed and returned
- * if present.
- *
- * @param name Name of the inbox entry.
- * @param file File to insert or -1.
- * @return Original value of the entry or -1 if not originally present.
- */
-int inbox_set(const char *name, int file)
-{
-	inbox_entry *next = NULL;
-	int result;
-
-	list_foreach(inb_list, link, inbox_entry, e) {
-		int cmp = str_cmp(e->name, name);
-		switch (cmp) {
-		case -1:
-			continue;
-		case 0:
-			result = e->file;
-			if (file == -1) {
-				free(e->name);
-				/* Safe because we exit immediately. */
-				list_remove(&e->link);
-			} else {
-				e->file = file;
-			}
-			return result;
-		case 1:
-			next = e;
-			goto out;
-		}
-	}
-
-out:
-	if (file == -1)
-		return -1;
-
-	inbox_entry *entry = calloc(sizeof(inbox_entry), 1);
-	entry->name = str_dup(name);
-	entry->file = file;
-
-	if (next == NULL) {
-		list_append((link_t *)entry, &inb_list);
-	} else {
-		list_insert_before((link_t *)entry, (link_t *)next);
-	}
-	return -1;
-}
-
-/** Retrieve a file with this name.
- *
- * @param name Name of the entry.
- * @return Requested file or -1 if not set.
- */
-int inbox_get(const char *name)
-{
-	list_foreach(inb_list, link, inbox_entry, e) {
-		int cmp = str_cmp(e->name, name);
-		switch (cmp) {
-		case 0:
-			return e->file;
-		case 1:
-			return -1;
-		}
-	}
-
-	return -1;
-}
-
-/** Writes names of entries that are currently set into an array provided by the
- * user.
- *
- * @param names Array in which names are stored.
- * @param capacity Capacity of the array.
- * @return Number of entries written. If capacity == 0, return the total number
- *         of entries.
- */
-int inbox_list(const char **names, int capacity)
-{
-	if (capacity == 0)
-		return list_count(&inb_list);
-
-	int used = 0;
-
-	list_foreach(inb_list, link, inbox_entry, e) {
-		if (used == capacity)
-			return used;
-		names[used] = e->name;
-		used++;
-	}
-
-	return used;
-}
-
-void __inbox_init(struct pcb_inbox_entry *entries, int count)
-{
-	for (int i = 0; i < count; i++) {
-		int original = inbox_set(entries[i].name, entries[i].file);
-		if (original >= 0)
-			vfs_put(original);
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/c/generic/vfs/mtab.c
===================================================================
--- uspace/lib/c/generic/vfs/mtab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <vfs/vfs.h>
-#include <vfs/vfs_mtab.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <errno.h>
-#include <assert.h>
-#include <str.h>
-
-static void process_mp(const char *path, vfs_stat_t *stat, list_t *mtab_list)
-{
-	mtab_ent_t *ent;
-
-	ent = (mtab_ent_t *) malloc(sizeof(mtab_ent_t));
-	if (!ent)
-		return;
-
-	link_initialize(&ent->link);
-	str_cpy(ent->mp, sizeof(ent->mp), path);
-	ent->service_id = stat->service_id;
-
-	vfs_statfs_t stfs;
-	if (vfs_statfs_path(path, &stfs) == EOK)
-		str_cpy(ent->fs_name, sizeof(ent->fs_name), stfs.fs_name);
-	else
-		str_cpy(ent->fs_name, sizeof(ent->fs_name), "?");
-
-	list_append(&ent->link, mtab_list);
-}
-
-static errno_t vfs_get_mtab_visit(const char *path, list_t *mtab_list,
-    fs_handle_t fs_handle, service_id_t service_id)
-{
-	DIR *dir;
-	struct dirent *dirent;
-
-	dir = opendir(path);
-	if (!dir)
-		return ENOENT;
-
-	while ((dirent = readdir(dir)) != NULL) {
-		char *child;
-		vfs_stat_t st;
-		errno_t rc;
-		int ret;
-
-		ret = asprintf(&child, "%s/%s", path, dirent->d_name);
-		if (ret < 0) {
-			closedir(dir);
-			return ENOMEM;
-		}
-
-		char *pa = vfs_absolutize(child, NULL);
-		if (!pa) {
-			free(child);
-			closedir(dir);
-			return ENOMEM;
-		}
-
-		free(child);
-		child = pa;
-
-		rc = vfs_stat_path(child, &st);
-		if (rc != EOK) {
-			free(child);
-			closedir(dir);
-			return rc;
-		}
-
-		if (st.fs_handle != fs_handle || st.service_id != service_id) {
-			/*
-			 * We have discovered a mountpoint.
-			 */
-			process_mp(child, &st, mtab_list);
-		}
-
-		if (st.is_directory) {
-			(void) vfs_get_mtab_visit(child, mtab_list,
-			    st.fs_handle, st.service_id);
-		}
-
-		free(child);
-	}
-
-	closedir(dir);
-	return EOK;
-}
-
-errno_t vfs_get_mtab_list(list_t *mtab_list)
-{
-	vfs_stat_t st;
-
-	errno_t rc = vfs_stat_path("/", &st);
-	if (rc != EOK)
-		return rc;
-
-	process_mp("/", &st, mtab_list);
-
-	return vfs_get_mtab_visit("/", mtab_list, st.fs_handle, st.service_id);
-}
-
-/** @}
- */
Index: pace/lib/c/generic/vfs/vfs.c
===================================================================
--- uspace/lib/c/generic/vfs/vfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1374 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#include <vfs/vfs.h>
-#include <vfs/canonify.h>
-#include <vfs/vfs_mtab.h>
-#include <vfs/vfs_sess.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <errno.h>
-#include <assert.h>
-#include <str.h>
-#include <loc.h>
-#include <ipc/vfs.h>
-#include <ipc/loc.h>
-
-/*
- * This file contains the implementation of the native HelenOS file system API.
- *
- * The API supports client-side file system roots, client-side IO cursors and
- * uses file handles as a primary means to refer to files. In order to call the
- * API functions, one just includes vfs/vfs.h.
- *
- * The API functions come in two main flavors:
- *
- * - functions that operate on integer file handles, such as:
- *   vfs_walk(), vfs_open(), vfs_read(), vfs_link(), ...
- *
- * - functions that operate on paths, such as:
- *   vfs_lookup(), vfs_link_path(), vfs_unlink_path(), vfs_rename_path(), ...
- *
- * There is usually a corresponding path function for each file handle function
- * that exists mostly as a convenience wrapper, except for cases when only a
- * path version exists due to file system consistency considerations (see
- * vfs_rename_path()). Sometimes one of the versions does not make sense, in
- * which case it is also omitted.
- *
- * Besides of that, the API provides some convenience wrappers for frequently
- * performed pairs of operations, for example there is a combo API for
- * vfs_lookup() and vfs_open(): vfs_lookup_open().
- *
- * Some of the functions here return a file handle that can be passed to other
- * functions. Note that a file handle does not automatically represent a file
- * from which one can read or to which one can write. In order to do so, the
- * file handle must be opened first for reading/writing using vfs_open().
- *
- * All file handles, no matter whether opened or not, must be eventually
- * returned to the system using vfs_put(). Non-returned file handles are in use
- * and consume system resources.
- *
- * Functions that return errno_t return an error code on error and do not
- * set errno. Depending on function, success is signalled by returning either
- * EOK or a non-negative file handle.
- *
- * An example life-cycle of a file handle is as follows:
- *
- * 	#include <vfs/vfs.h>
- *
- * 	int file = vfs_lookup("/foo/bar/foobar", WALK_REGULAR);
- * 	if (file < 0)
- * 		return file;
- * 	errno_t rc = vfs_open(file, MODE_READ);
- * 	if (rc != EOK) {
- * 		(void) vfs_put(file);
- *		return rc;
- * 	}
- * 	aoff64_t pos = 42;
- * 	char buf[512];
- *	size_t nread;
- * 	rc = vfs_read(file, &pos, buf, sizeof(buf), &nread);
- * 	if (rc != EOK) {
- * 		vfs_put(file);
- * 		return rc;
- * 	}
- *
- *	// buf is now filled with nread bytes from file
- *
- *	vfs_put(file);
- */
-
-static FIBRIL_MUTEX_INITIALIZE(vfs_mutex);
-static async_sess_t *vfs_sess = NULL;
-
-static FIBRIL_MUTEX_INITIALIZE(cwd_mutex);
-
-static int cwd_fd = -1;
-static char *cwd_path = NULL;
-static size_t cwd_size = 0;
-
-static FIBRIL_MUTEX_INITIALIZE(root_mutex);
-static int root_fd = -1;
-
-static errno_t get_parent_and_child(const char *path, int *parent, char **child)
-{
-	size_t size;
-	char *apath = vfs_absolutize(path, &size);
-	if (!apath)
-		return ENOMEM;
-
-	char *slash = str_rchr(apath, L'/');
-	if (slash == apath) {
-		*parent = vfs_root();
-		if (*parent < 0) {
-			free(apath);
-			return EBADF;
-		}
-		*child = apath;
-		return EOK;
-	} else {
-		*slash = '\0';
-		errno_t rc = vfs_lookup(apath, WALK_DIRECTORY, parent);
-		if (rc != EOK) {
-			free(apath);
-			return rc;
-		}
-		*slash = '/';
-		*child = str_dup(slash);
-		free(apath);
-		if (!*child) {
-			vfs_put(*parent);
-			return ENOMEM;
-		}
-
-		return rc;
-	}
-
-}
-
-/** Make a potentially relative path absolute
- *
- * This function coverts a current-working-directory-relative path into a
- * well-formed, absolute path. The caller is responsible for deallocating the
- * returned buffer.
- *
- * @param[in] path      Path to be absolutized
- * @param[out] retlen   Length of the absolutized path
- *
- * @return              New buffer holding the absolutized path or NULL
- */
-char *vfs_absolutize(const char *path, size_t *retlen)
-{
-	char *ncwd_path;
-	char *ncwd_path_nc;
-
-	fibril_mutex_lock(&cwd_mutex);
-	size_t size = str_size(path);
-	if (*path != '/') {
-		if (cwd_path == NULL) {
-			fibril_mutex_unlock(&cwd_mutex);
-			return NULL;
-		}
-		ncwd_path_nc = malloc(cwd_size + 1 + size + 1);
-		if (ncwd_path_nc == NULL) {
-			fibril_mutex_unlock(&cwd_mutex);
-			return NULL;
-		}
-		str_cpy(ncwd_path_nc, cwd_size + 1 + size + 1, cwd_path);
-		ncwd_path_nc[cwd_size] = '/';
-		ncwd_path_nc[cwd_size + 1] = '\0';
-	} else {
-		ncwd_path_nc = malloc(size + 1);
-		if (ncwd_path_nc == NULL) {
-			fibril_mutex_unlock(&cwd_mutex);
-			return NULL;
-		}
-		ncwd_path_nc[0] = '\0';
-	}
-	str_append(ncwd_path_nc, cwd_size + 1 + size + 1, path);
-	ncwd_path = canonify(ncwd_path_nc, retlen);
-	if (ncwd_path == NULL) {
-		fibril_mutex_unlock(&cwd_mutex);
-		free(ncwd_path_nc);
-		return NULL;
-	}
-	/*
-	 * We need to clone ncwd_path because canonify() works in-place and thus
-	 * the address in ncwd_path need not be the same as ncwd_path_nc, even
-	 * though they both point into the same dynamically allocated buffer.
-	 */
-	ncwd_path = str_dup(ncwd_path);
-	free(ncwd_path_nc);
-	if (ncwd_path == NULL) {
-		fibril_mutex_unlock(&cwd_mutex);
-		return NULL;
-	}
-	fibril_mutex_unlock(&cwd_mutex);
-	return ncwd_path;
-}
-
-/** Clone a file handle
- *
- * The caller can choose whether to clone an existing file handle into another
- * already existing file handle (in which case it is first closed) or to a new
- * file handle allocated either from low or high indices.
- *
- * @param file_from     Source file handle
- * @param file_to       Destination file handle or -1
- * @param high          If file_to is -1, high controls whether the new file
- *                      handle will be allocated from high indices
- *
- * @return              New file handle on success or an error code
- */
-errno_t vfs_clone(int file_from, int file_to, bool high, int *handle)
-{
-	assert(handle != NULL);
-
-	async_exch_t *vfs_exch = vfs_exchange_begin();
-	sysarg_t ret;
-	errno_t rc = async_req_3_1(vfs_exch, VFS_IN_CLONE, (sysarg_t) file_from,
-	    (sysarg_t) file_to, (sysarg_t) high, &ret);
-	vfs_exchange_end(vfs_exch);
-
-	if (rc == EOK) {
-		*handle = ret;
-	}
-	return rc;
-}
-
-/** Get current working directory path
- *
- * @param[out] buf      Buffer
- * @param size          Size of @a buf
- *
- * @return              EOK on success or a non-error code
- */
-errno_t vfs_cwd_get(char *buf, size_t size)
-{
-	fibril_mutex_lock(&cwd_mutex);
-
-	if ((cwd_size == 0) || (size < cwd_size + 1)) {
-		fibril_mutex_unlock(&cwd_mutex);
-		return ERANGE;
-	}
-
-	str_cpy(buf, size, cwd_path);
-	fibril_mutex_unlock(&cwd_mutex);
-
-	return EOK;
-}
-
-/** Change working directory
- *
- * @param path  Path of the new working directory
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_cwd_set(const char *path)
-{
-	size_t abs_size;
-	char *abs_path = vfs_absolutize(path, &abs_size);
-	if (abs_path == NULL)
-		return ENOMEM;
-
-	int fd;
-	errno_t rc = vfs_lookup(abs_path, WALK_DIRECTORY, &fd);
-	if (rc != EOK) {
-		free(abs_path);
-		return rc;
-	}
-
-	fibril_mutex_lock(&cwd_mutex);
-
-	if (cwd_fd >= 0)
-		vfs_put(cwd_fd);
-
-	if (cwd_path)
-		free(cwd_path);
-
-	cwd_fd = fd;
-	cwd_path = abs_path;
-	cwd_size = abs_size;
-
-	fibril_mutex_unlock(&cwd_mutex);
-	return EOK;
-}
-
-/** Start an async exchange on the VFS session
- *
- * @return      New exchange
- */
-async_exch_t *vfs_exchange_begin(void)
-{
-	fibril_mutex_lock(&vfs_mutex);
-
-	while (vfs_sess == NULL) {
-		vfs_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_VFS,
-		    0, NULL);
-	}
-
-	fibril_mutex_unlock(&vfs_mutex);
-
-	return async_exchange_begin(vfs_sess);
-}
-
-/** Finish an async exchange on the VFS session
- *
- * @param exch  Exchange to be finished
- */
-void vfs_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Open session to service represented by a special file
- *
- * Given that the file referred to by @a file represents a service,
- * open a session to that service.
- *
- * @param file  File handle representing a service
- * @param iface Interface to connect to (XXX Should be automatic)
- *
- * @return      Session pointer on success.
- * @return      @c NULL or error.
- */
-async_sess_t *vfs_fd_session(int file, iface_t iface)
-{
-	vfs_stat_t stat;
-	errno_t rc = vfs_stat(file, &stat);
-	if (rc != EOK)
-		return NULL;
-
-	if (stat.service == 0)
-		return NULL;
-
-	return loc_service_connect(stat.service, iface, 0);
-}
-
-/** Determine if a device contains the specified file system type. If so,
- * return identification information.
- *
- * @param fs_name File system name
- * @param serv    Service representing the mountee
- * @param info    Place to store volume identification information
- *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_fsprobe(const char *fs_name, service_id_t serv,
-    vfs_fs_probe_info_t *info)
-{
-	errno_t rc;
-
-	ipc_call_t answer;
-	async_exch_t *exch = vfs_exchange_begin();
-	aid_t req = async_send_1(exch, VFS_IN_FSPROBE, serv, &answer);
-
-	rc = async_data_write_start(exch, (void *) fs_name,
-	    str_size(fs_name));
-
-	async_wait_for(req, &rc);
-
-	if (rc != EOK) {
-		vfs_exchange_end(exch);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, info, sizeof(*info));
-	vfs_exchange_end(exch);
-
-	return rc;
-}
-
-/** Return a list of currently available file system types
- *
- * @param fstypes Points to structure where list of filesystem types is
- *        stored. It is read as a null-terminated list of strings
- *        fstypes->fstypes[0..]. To free the list use vfs_fstypes_free().
- *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_fstypes(vfs_fstypes_t *fstypes)
-{
-	sysarg_t size;
-	char *buf;
-	char dummybuf[1];
-	size_t count, i;
-
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_0_1(exch, VFS_IN_FSTYPES, &size);
-
-	if (rc != EOK) {
-		vfs_exchange_end(exch);
-		return rc;
-	}
-
-	buf = malloc(size);
-	if (buf == NULL) {
-		buf = dummybuf;
-		size = 1;
-	}
-
-	rc = async_data_read_start(exch, buf, size);
-	vfs_exchange_end(exch);
-
-	if (buf == dummybuf)
-		return ENOMEM;
-
-	/*
-	 * Buffer should contain a number of null-terminated strings.
-	 * Count them so that we can allocate an index
-	 */
-	count = 0;
-	i = 0;
-	while (i < size) {
-		if (buf[i] == '\0')
-			++count;
-		++i;
-	}
-
-	if (count == 0) {
-		free(buf);
-		return EIO;
-	}
-
-	fstypes->fstypes = calloc(sizeof(char *), count + 1);
-	if (fstypes->fstypes == NULL) {
-		free(buf);
-		return ENOMEM;
-	}
-
-	/* Now fill the index */
-	if (buf[0] != '\0')
-		fstypes->fstypes[0] = &buf[0];
-	count = 0;
-	i = 0;
-	while (i < size) {
-		if (buf[i] == '\0')
-			fstypes->fstypes[++count] = &buf[i + 1];
-		++i;
-	}
-	fstypes->fstypes[count] = NULL;
-	fstypes->buf = buf;
-	fstypes->size = size;
-
-	return rc;
-}
-
-/** Free list of file system types.
- *
- * @param fstypes List of file system types
- */
-void vfs_fstypes_free(vfs_fstypes_t *fstypes)
-{
-	free(fstypes->buf);
-	fstypes->buf = NULL;
-	free(fstypes->fstypes);
-	fstypes->fstypes = NULL;
-	fstypes->size = 0;
-}
-
-/** Link a file or directory
- *
- * Create a new name and an empty file or an empty directory in a parent
- * directory. If child with the same name already exists, the function returns
- * a failure, the existing file remains untouched and no file system object
- * is created.
- *
- * @param parent        File handle of the parent directory node
- * @param child         New name to be linked
- * @param kind          Kind of the object to be created: KIND_FILE or
- *                      KIND_DIRECTORY
- * @param[out] linkedfd If not NULL, will receive a file handle to the linked
- *                      child
- * @return              EOK on success or an error code
- */
-errno_t vfs_link(int parent, const char *child, vfs_file_kind_t kind, int *linkedfd)
-{
-	int flags = (kind == KIND_DIRECTORY) ? WALK_DIRECTORY : WALK_REGULAR;
-	int file = -1;
-	errno_t rc = vfs_walk(parent, child, WALK_MUST_CREATE | flags, &file);
-	if (rc != EOK)
-		return rc;
-
-	if (linkedfd)
-		*linkedfd = file;
-	else
-		vfs_put(file);
-
-	return EOK;
-}
-
-/** Link a file or directory
- *
- * Create a new name and an empty file or an empty directory at given path.
- * If a link with the same name already exists, the function returns
- * a failure, the existing file remains untouched and no file system object
- * is created.
- *
- * @param path          New path to be linked
- * @param kind          Kind of the object to be created: KIND_FILE or
- *                      KIND_DIRECTORY
- * @param[out] linkedfd If not NULL, will receive a file handle to the linked
- *                      child
- * @return              EOK on success or an error code
- */
-errno_t vfs_link_path(const char *path, vfs_file_kind_t kind, int *linkedfd)
-{
-	char *child;
-	int parent;
-	errno_t rc = get_parent_and_child(path, &parent, &child);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_link(parent, child, kind, linkedfd);
-
-	free(child);
-	vfs_put(parent);
-	return rc;
-}
-
-/** Lookup a path relative to the local root
- *
- * @param path  Path to be looked up
- * @param flags Walk flags
- * @param[out] handle Pointer to variable where handle is to be written.
- *
- * @return      EOK on success or an error code.
- */
-errno_t vfs_lookup(const char *path, int flags, int *handle)
-{
-	size_t size;
-	char *p = vfs_absolutize(path, &size);
-	if (!p)
-		return ENOMEM;
-
-	int root = vfs_root();
-	if (root < 0) {
-		free(p);
-		return ENOENT;
-	}
-
-	// XXX: Workaround for GCC diagnostics.
-	*handle = -1;
-
-	errno_t rc = vfs_walk(root, p, flags, handle);
-	vfs_put(root);
-	free(p);
-	return rc;
-}
-
-/** Lookup a path relative to the local root and open the result
- *
- * This function is a convenience combo for vfs_lookup() and vfs_open().
- *
- * @param path  Path to be looked up
- * @param flags Walk flags
- * @param mode  Mode in which to open file in
- * @param[out] handle Pointer to variable where handle is to be written.
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_lookup_open(const char *path, int flags, int mode, int *handle)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, flags, &file);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_open(file, mode);
-	if (rc != EOK) {
-		vfs_put(file);
-		return rc;
-	}
-
-	*handle = file;
-	return EOK;
-}
-
-/** Mount a file system
- *
- * @param[in] mp                File handle representing the mount-point
- * @param[in] fs_name           File system name
- * @param[in] serv              Service representing the mountee
- * @param[in] opts              Mount options for the endpoint file system
- * @param[in] flags             Mount flags
- * @param[in] instance          Instance number of the file system server
- * @param[out] mountedfd        File handle of the mounted root if not NULL
- *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_mount(int mp, const char *fs_name, service_id_t serv, const char *opts,
-    unsigned int flags, unsigned int instance, int *mountedfd)
-{
-	errno_t rc, rc1;
-
-	if (!mountedfd)
-		flags |= VFS_MOUNT_NO_REF;
-	if (mp < 0)
-		flags |= VFS_MOUNT_CONNECT_ONLY;
-
-	ipc_call_t answer;
-	async_exch_t *exch = vfs_exchange_begin();
-	aid_t req = async_send_4(exch, VFS_IN_MOUNT, mp, serv, flags, instance,
-	    &answer);
-
-	rc1 = async_data_write_start(exch, (void *) opts, str_size(opts));
-	if (rc1 == EOK) {
-		rc1 = async_data_write_start(exch, (void *) fs_name,
-		    str_size(fs_name));
-	}
-
-	vfs_exchange_end(exch);
-
-	async_wait_for(req, &rc);
-
-	if (mountedfd)
-		*mountedfd = (int) ipc_get_arg1(&answer);
-
-	if (rc != EOK)
-		return rc;
-	return rc1;
-}
-
-/** Mount a file system
- *
- * @param[in] mp                Path representing the mount-point
- * @param[in] fs_name           File system name
- * @param[in] fqsn              Fully qualified service name of the mountee
- * @param[in] opts              Mount options for the endpoint file system
- * @param[in] flags             Mount flags
- * @param[in] instance          Instance number of the file system server
- *
- * @return                      EOK on success or an error code
- */
-errno_t vfs_mount_path(const char *mp, const char *fs_name, const char *fqsn,
-    const char *opts, unsigned int flags, unsigned int instance)
-{
-	int null_id = -1;
-	char null[LOC_NAME_MAXLEN];
-
-	if (str_cmp(fqsn, "") == 0) {
-		/*
-		 * No device specified, create a fresh null/%d device instead.
-		 */
-		null_id = loc_null_create();
-
-		if (null_id == -1)
-			return ENOMEM;
-
-		snprintf(null, LOC_NAME_MAXLEN, "null/%d", null_id);
-		fqsn = null;
-	}
-
-	if (flags & IPC_FLAG_BLOCKING)
-		flags = VFS_MOUNT_BLOCKING;
-	else
-		flags = 0;
-
-	service_id_t service_id;
-	errno_t res = loc_service_get_id(fqsn, &service_id, flags);
-	if (res != EOK) {
-		if (null_id != -1)
-			loc_null_destroy(null_id);
-
-		return res;
-	}
-
-	size_t mpa_size;
-	char *mpa = vfs_absolutize(mp, &mpa_size);
-	if (mpa == NULL) {
-		if (null_id != -1)
-			loc_null_destroy(null_id);
-
-		return ENOMEM;
-	}
-
-	fibril_mutex_lock(&root_mutex);
-
-	errno_t rc;
-
-	if (str_cmp(mpa, "/") == 0) {
-		/* Mounting root. */
-
-		if (root_fd >= 0) {
-			fibril_mutex_unlock(&root_mutex);
-			if (null_id != -1)
-				loc_null_destroy(null_id);
-			return EBUSY;
-		}
-
-		int root;
-		rc = vfs_mount(-1, fs_name, service_id, opts, flags, instance,
-		    &root);
-		if (rc == EOK)
-			root_fd = root;
-	} else {
-		if (root_fd < 0) {
-			fibril_mutex_unlock(&root_mutex);
-			if (null_id != -1)
-				loc_null_destroy(null_id);
-			return EINVAL;
-		}
-
-		int mpfd;
-		rc = vfs_walk(root_fd, mpa, WALK_DIRECTORY, &mpfd);
-		if (rc == EOK) {
-			rc = vfs_mount(mpfd, fs_name, service_id, opts, flags,
-			    instance, NULL);
-			vfs_put(mpfd);
-		}
-	}
-
-	fibril_mutex_unlock(&root_mutex);
-
-	if ((rc != EOK) && (null_id != -1))
-		loc_null_destroy(null_id);
-
-	return (errno_t) rc;
-}
-
-/** Open a file handle for I/O
- *
- * @param file  File handle to enable I/O on
- * @param mode  Mode in which to open file in
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_open(int file, int mode)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_2_0(exch, VFS_IN_OPEN, file, mode);
-	vfs_exchange_end(exch);
-
-	return rc;
-}
-
-/** Pass a file handle to another VFS client
- *
- * @param vfs_exch      Donor's VFS exchange
- * @param file          Donor's file handle to pass
- * @param exch          Exchange to the acceptor
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_pass_handle(async_exch_t *vfs_exch, int file, async_exch_t *exch)
-{
-	return async_state_change_start(exch, VFS_PASS_HANDLE, (sysarg_t) file,
-	    0, vfs_exch);
-}
-
-/** Stop working with a file handle
- *
- * @param file  File handle to put
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_put(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_PUT, file);
-	vfs_exchange_end(exch);
-
-	return rc;
-}
-
-/** Receive a file handle from another VFS client
- *
- * @param high   If true, the received file handle will be allocated from high
- *               indices
- * @param[out] handle  Received handle.
- *
- * @return       EOK on success or an error code
- */
-errno_t vfs_receive_handle(bool high, int *handle)
-{
-	ipc_call_t call;
-	if (!async_state_change_receive(&call)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	async_exch_t *vfs_exch = vfs_exchange_begin();
-
-	async_state_change_finalize(&call, vfs_exch);
-
-	sysarg_t ret;
-	errno_t rc = async_req_1_1(vfs_exch, VFS_IN_WAIT_HANDLE, high, &ret);
-
-	async_exchange_end(vfs_exch);
-
-	if (rc == EOK) {
-		*handle = (int) ret;
-	}
-
-	return rc;
-}
-
-/** Read data
- *
- * Read up to @a nbytes bytes from file if available. This function always reads
- * all the available bytes up to @a nbytes.
- *
- * @param file          File handle to read from
- * @param[inout] pos    Position to read from, updated by the actual bytes read
- * @param buf		Buffer, @a nbytes bytes long
- * @param nbytes	Number of bytes to read
- * @param nread		Place to store number of bytes actually read
- *
- * @return              On success, EOK and @a *nread is filled with number
- *			of bytes actually read.
- * @return              On failure, an error code
- */
-errno_t vfs_read(int file, aoff64_t *pos, void *buf, size_t nbyte, size_t *nread)
-{
-	ssize_t cnt = 0;
-	size_t nr = 0;
-	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	do {
-		bp += cnt;
-		nr += cnt;
-		*pos += cnt;
-		rc = vfs_read_short(file, *pos, bp, nbyte - nr, &cnt);
-	} while (rc == EOK && cnt > 0 && (nbyte - nr - cnt) > 0);
-
-	if (rc != EOK) {
-		*nread = nr;
-		return rc;
-	}
-
-	nr += cnt;
-	*pos += cnt;
-	*nread = nr;
-	return EOK;
-}
-
-/** Read bytes from a file
- *
- * Read up to @a nbyte bytes from file. The actual number of bytes read
- * may be lower, but greater than zero if there are any bytes available.
- * If there are no bytes available for reading, then the function will
- * return success with zero bytes read.
- *
- * @param file          File handle to read from
- * @param[in] pos       Position to read from
- * @param buf           Buffer to read from
- * @param nbyte         Maximum number of bytes to read
- * @param[out] nread	Actual number of bytes read (0 or more)
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_read_short(int file, aoff64_t pos, void *buf, size_t nbyte,
-    ssize_t *nread)
-{
-	errno_t rc;
-	ipc_call_t answer;
-	aid_t req;
-
-	if (nbyte > DATA_XFER_LIMIT)
-		nbyte = DATA_XFER_LIMIT;
-
-	async_exch_t *exch = vfs_exchange_begin();
-
-	req = async_send_3(exch, VFS_IN_READ, file, LOWER32(pos),
-	    UPPER32(pos), &answer);
-	rc = async_data_read_start(exch, (void *) buf, nbyte);
-
-	vfs_exchange_end(exch);
-
-	if (rc == EOK)
-		async_wait_for(req, &rc);
-	else
-		async_forget(req);
-
-	if (rc != EOK)
-		return rc;
-
-	*nread = (ssize_t) ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Rename a file or directory
- *
- * There is no file-handle-based variant to disallow attempts to introduce loops
- * and breakage in the directory tree when relinking eg. a node under its own
- * descendant.  The path-based variant is not susceptible because the VFS can
- * prevent this lexically by comparing the paths.
- *
- * @param old   Old path
- * @param new   New path
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_rename_path(const char *old, const char *new)
-{
-	errno_t rc;
-	errno_t rc_orig;
-	aid_t req;
-
-	size_t olda_size;
-	char *olda = vfs_absolutize(old, &olda_size);
-	if (olda == NULL)
-		return ENOMEM;
-
-	size_t newa_size;
-	char *newa = vfs_absolutize(new, &newa_size);
-	if (newa == NULL) {
-		free(olda);
-		return ENOMEM;
-	}
-
-	async_exch_t *exch = vfs_exchange_begin();
-	int root = vfs_root();
-	if (root < 0) {
-		free(olda);
-		free(newa);
-		return ENOENT;
-	}
-
-	req = async_send_1(exch, VFS_IN_RENAME, root, NULL);
-	rc = async_data_write_start(exch, olda, olda_size);
-	if (rc != EOK) {
-		vfs_exchange_end(exch);
-		free(olda);
-		free(newa);
-		vfs_put(root);
-		async_wait_for(req, &rc_orig);
-		if (rc_orig != EOK)
-			rc = rc_orig;
-		return rc;
-	}
-	rc = async_data_write_start(exch, newa, newa_size);
-	if (rc != EOK) {
-		vfs_exchange_end(exch);
-		free(olda);
-		free(newa);
-		vfs_put(root);
-		async_wait_for(req, &rc_orig);
-		if (rc_orig != EOK)
-			rc = rc_orig;
-		return rc;
-	}
-	vfs_exchange_end(exch);
-	free(olda);
-	free(newa);
-	vfs_put(root);
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-/** Resize file to a specified length
- *
- * Resize file so that its size is exactly @a length.
- *
- * @param file          File handle to resize
- * @param length        New length
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_resize(int file, aoff64_t length)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_3_0(exch, VFS_IN_RESIZE, file, LOWER32(length),
-	    UPPER32(length));
-	vfs_exchange_end(exch);
-
-	return rc;
-}
-
-/** Return a new file handle representing the local root
- *
- * @return      A clone of the local root file handle or -1
- */
-int vfs_root(void)
-{
-	fibril_mutex_lock(&root_mutex);
-	int fd;
-	if (root_fd < 0) {
-		fd = -1;
-	} else {
-		errno_t rc = vfs_clone(root_fd, -1, true, &fd);
-		if (rc != EOK) {
-			fd = -1;
-		}
-	}
-	fibril_mutex_unlock(&root_mutex);
-	return fd;
-}
-
-/** Set a new local root
- *
- * Note that it is still possible to have file handles for other roots and pass
- * them to the API functions. Functions like vfs_root() and vfs_lookup() will
- * however consider the file set by this function to be the root.
- *
- * @param nroot The new local root file handle
- *
- * @return  Error code
- */
-errno_t vfs_root_set(int nroot)
-{
-	int new_root;
-	errno_t rc = vfs_clone(nroot, -1, true, &new_root);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	fibril_mutex_lock(&root_mutex);
-	if (root_fd >= 0)
-		vfs_put(root_fd);
-	root_fd = new_root;
-	fibril_mutex_unlock(&root_mutex);
-
-	return EOK;
-}
-
-/** Get file information
- *
- * @param file          File handle to get information about
- * @param[out] stat     Place to store file information
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_stat(int file, vfs_stat_t *stat)
-{
-	errno_t rc;
-	aid_t req;
-
-	async_exch_t *exch = vfs_exchange_begin();
-
-	req = async_send_1(exch, VFS_IN_STAT, file, NULL);
-	rc = async_data_read_start(exch, (void *) stat, sizeof(vfs_stat_t));
-	if (rc != EOK) {
-		vfs_exchange_end(exch);
-
-		errno_t rc_orig;
-		async_wait_for(req, &rc_orig);
-
-		if (rc_orig != EOK)
-			rc = rc_orig;
-
-		return rc;
-	}
-
-	vfs_exchange_end(exch);
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-/** Get file information
- *
- * @param path          File path to get information about
- * @param[out] stat     Place to store file information
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_stat_path(const char *path, vfs_stat_t *stat)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_stat(file, stat);
-
-	vfs_put(file);
-
-	return rc;
-}
-
-/** Get filesystem statistics
- *
- * @param file          File located on the queried file system
- * @param[out] st       Buffer for storing information
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_statfs(int file, vfs_statfs_t *st)
-{
-	errno_t rc, ret;
-	aid_t req;
-
-	async_exch_t *exch = vfs_exchange_begin();
-
-	req = async_send_1(exch, VFS_IN_STATFS, file, NULL);
-	rc = async_data_read_start(exch, (void *) st, sizeof(*st));
-
-	vfs_exchange_end(exch);
-	async_wait_for(req, &ret);
-
-	rc = (ret != EOK ? ret : rc);
-
-	return rc;
-}
-
-/** Get filesystem statistics
- *
- * @param file          Path pointing to the queried file system
- * @param[out] st       Buffer for storing information
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_statfs_path(const char *path, vfs_statfs_t *st)
-{
-	int file;
-	errno_t rc = vfs_lookup(path, 0, &file);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_statfs(file, st);
-
-	vfs_put(file);
-
-	return rc;
-}
-
-/** Synchronize file
- *
- * @param file  File handle to synchronize
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_sync(int file)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_SYNC, file);
-	vfs_exchange_end(exch);
-
-	return rc;
-}
-
-/** Unlink a file or directory
- *
- * Unlink a name from a parent directory. The caller can supply the file handle
- * of the unlinked child in order to detect a possible race with vfs_link() and
- * avoid unlinking a wrong file. If the last link for a file or directory is
- * removed, the FS implementation will deallocate its resources.
- *
- * @param parent        File handle of the parent directory node
- * @param child         Old name to be unlinked
- * @param expect        File handle of the unlinked child
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_unlink(int parent, const char *child, int expect)
-{
-	errno_t rc;
-	aid_t req;
-
-	async_exch_t *exch = vfs_exchange_begin();
-
-	req = async_send_2(exch, VFS_IN_UNLINK, parent, expect, NULL);
-	rc = async_data_write_start(exch, child, str_size(child));
-
-	vfs_exchange_end(exch);
-
-	errno_t rc_orig;
-	async_wait_for(req, &rc_orig);
-
-	if (rc_orig != EOK)
-		return (errno_t) rc_orig;
-	return rc;
-}
-
-/** Unlink a file or directory
- *
- * Unlink a path. If the last link for a file or directory is removed, the FS
- * implementation will deallocate its resources.
- *
- * @param path          Old path to be unlinked
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_unlink_path(const char *path)
-{
-	int expect;
-	errno_t rc = vfs_lookup(path, 0, &expect);
-	if (rc != EOK)
-		return rc;
-
-	char *child;
-	int parent;
-	rc = get_parent_and_child(path, &parent, &child);
-	if (rc != EOK) {
-		vfs_put(expect);
-		return rc;
-	}
-
-	rc = vfs_unlink(parent, child, expect);
-
-	free(child);
-	vfs_put(parent);
-	vfs_put(expect);
-	return rc;
-}
-
-/** Unmount a file system
- *
- * @param mp    File handle representing the mount-point
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_unmount(int mp)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-	errno_t rc = async_req_1_0(exch, VFS_IN_UNMOUNT, mp);
-	vfs_exchange_end(exch);
-	return rc;
-}
-
-/** Unmount a file system
- *
- * @param mpp   Mount-point path
- *
- * @return      EOK on success or an error code
- */
-errno_t vfs_unmount_path(const char *mpp)
-{
-	int mp;
-	errno_t rc = vfs_lookup(mpp, WALK_MOUNT_POINT | WALK_DIRECTORY, &mp);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_unmount(mp);
-	vfs_put(mp);
-	return rc;
-}
-
-/** Walk a path starting in a parent node
- *
- * @param parent        File handle of the parent node where the walk starts
- * @param path          Parent-relative path to be walked
- * @param flags         Flags influencing the walk
- * @param[out] handle   File handle representing the result on success.
- *
- * @return              Error code.
- */
-errno_t vfs_walk(int parent, const char *path, int flags, int *handle)
-{
-	async_exch_t *exch = vfs_exchange_begin();
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, VFS_IN_WALK, parent, flags, &answer);
-	errno_t rc = async_data_write_start(exch, path, str_size(path));
-	vfs_exchange_end(exch);
-
-	errno_t rc_orig;
-	async_wait_for(req, &rc_orig);
-
-	if (rc_orig != EOK)
-		return (errno_t) rc_orig;
-
-	if (rc != EOK)
-		return (errno_t) rc;
-
-	*handle = (int) ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Write data
- *
- * This function fails if it cannot write exactly @a len bytes to the file.
- *
- * @param file          File handle to write to
- * @param[inout] pos    Position to write to, updated by the actual bytes
- *                      written
- * @param buf           Data, @a nbytes bytes long
- * @param nbytes        Number of bytes to write
- * @param nwritten	Place to store number of bytes written
- *
- * @return		On success, EOK, @a *nwr is filled with number
- *			of bytes written
- * @return              On failure, an error code
- */
-errno_t vfs_write(int file, aoff64_t *pos, const void *buf, size_t nbyte,
-    size_t *nwritten)
-{
-	ssize_t cnt = 0;
-	ssize_t nwr = 0;
-	const uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	do {
-		bp += cnt;
-		nwr += cnt;
-		*pos += cnt;
-		rc = vfs_write_short(file, *pos, bp, nbyte - nwr, &cnt);
-	} while (rc == EOK && ((ssize_t)nbyte - nwr - cnt) > 0);
-
-	if (rc != EOK) {
-		*nwritten = nwr;
-		return rc;
-	}
-
-	nwr += cnt;
-	*pos += cnt;
-	*nwritten = nwr;
-	return EOK;
-}
-
-/** Write bytes to a file
- *
- * Write up to @a nbyte bytes from file. The actual number of bytes written
- * may be lower, but greater than zero.
- *
- * @param file          File handle to write to
- * @param[in] pos       Position to write to
- * @param buf           Buffer to write to
- * @param nbyte         Maximum number of bytes to write
- * @param[out] nread    Actual number of bytes written (0 or more)
- *
- * @return              EOK on success or an error code
- */
-errno_t vfs_write_short(int file, aoff64_t pos, const void *buf, size_t nbyte,
-    ssize_t *nwritten)
-{
-	errno_t rc;
-	ipc_call_t answer;
-	aid_t req;
-
-	if (nbyte > DATA_XFER_LIMIT)
-		nbyte = DATA_XFER_LIMIT;
-
-	async_exch_t *exch = vfs_exchange_begin();
-
-	req = async_send_3(exch, VFS_IN_WRITE, file, LOWER32(pos),
-	    UPPER32(pos), &answer);
-	rc = async_data_write_start(exch, (void *) buf, nbyte);
-
-	vfs_exchange_end(exch);
-
-	if (rc == EOK)
-		async_wait_for(req, &rc);
-	else
-		async_forget(req);
-
-	if (rc != EOK)
-		return rc;
-
-	*nwritten = (ssize_t) ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/c/include/adt/prodcons.h
===================================================================
--- uspace/lib/c/include/adt/prodcons.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_PRODCONS_H_
-#define _LIBC_PRODCONS_H_
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-
-typedef struct {
-	fibril_mutex_t mtx;
-	fibril_condvar_t cv;
-	list_t list;
-} prodcons_t;
-
-extern void prodcons_initialize(prodcons_t *);
-extern void prodcons_produce(prodcons_t *, link_t *);
-extern link_t *prodcons_consume(prodcons_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/align.h
===================================================================
--- uspace/lib/c/include/align.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ALIGN_H_
-#define _LIBC_ALIGN_H_
-
-/** Align to the nearest lower address which is a power of two.
- *
- * @param s		Address or size to be aligned.
- * @param a		Size of alignment, must be power of 2.
- */
-#define ALIGN_DOWN(s, a)	((s) & ~((typeof(s))(a) - 1))
-
-/** Align to the nearest higher address which is a power of two.
- *
- * @param s		Address or size to be aligned.
- * @param a		Size of alignment, must be power of 2.
- */
-#define ALIGN_UP(s, a)		((((s) + ((a) - 1)) & ~((typeof(s))(a) - 1)))
-
-/** Round up to the nearest higher boundary.
- *
- * @param n		Number to be aligned.
- * @param b		Boundary, arbitrary unsigned number.
- */
-#define ROUND_UP(n, b)		(((n) / (b) + ((n) % (b) != 0)) * (b))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/arg_parse.h
===================================================================
--- uspace/lib/c/include/arg_parse.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ARG_PARSE_H_
-#define _LIBC_ARG_PARSE_H_
-
-#include <errno.h>
-
-typedef errno_t (*arg_parser)(const char *, int *);
-
-extern int arg_parse_short_long(const char *, const char *, const char *);
-extern errno_t arg_parse_int(int, char **, int *, int *, int);
-extern errno_t arg_parse_name_int(int, char **, int *, int *, int, arg_parser);
-extern errno_t arg_parse_string(int, char **, int *, char **, int);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/as.h
===================================================================
--- uspace/lib/c/include/as.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_AS_H_
-#define _LIBC_AS_H_
-
-#include <types/common.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <abi/mm/as.h>
-#include <libarch/config.h>
-
-static inline size_t SIZE2PAGES(size_t size)
-{
-	if (size == 0)
-		return 0;
-
-	return (size_t) ((size - 1) >> PAGE_WIDTH) + 1;
-}
-
-static inline size_t PAGES2SIZE(size_t pages)
-{
-	return (size_t) (pages << PAGE_WIDTH);
-}
-
-extern void *as_area_create(void *, size_t, unsigned int,
-    as_area_pager_info_t *);
-extern errno_t as_area_resize(void *, size_t, unsigned int);
-extern errno_t as_area_change_flags(void *, unsigned int);
-extern errno_t as_area_get_info(void *, as_area_info_t *);
-extern errno_t as_area_destroy(void *);
-extern void *set_maxheapsize(size_t);
-extern errno_t as_get_physical_mapping(const void *, uintptr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/assert.h
===================================================================
--- uspace/lib/c/include/assert.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-// XXX: The definition of `assert()` is not guarded.
-// One must not use `#pragma once` in this header.
-// This is in accordance with the C standard.
-
-#ifndef _LIBC_ASSERT_H_
-#define _LIBC_ASSERT_H_
-
-#include <_bits/decls.h>
-
-#ifndef __cplusplus
-#define static_assert _Static_assert
-#endif
-
-__C_DECLS_BEGIN;
-
-extern void __helenos_assert_abort(const char *, const char *, unsigned int)
-    __attribute__((noreturn));
-
-extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int)
-    __attribute__((noreturn));
-
-__C_DECLS_END;
-
-#endif
-
-/** Debugging assert macro
- *
- * If NDEBUG is not set, the assert() macro
- * evaluates expr and if it is false prints
- * error message and terminate program.
- *
- * @param expr Expression which is expected to be true.
- *
- */
-
-#undef assert
-
-#ifndef NDEBUG
-#define assert(expr) ((expr) ? (void) 0 : __helenos_assert_abort(#expr, __FILE__, __LINE__))
-#else
-#define assert(expr) ((void) 0)
-#endif
-
-#ifdef _HELENOS_SOURCE
-
-#undef safe_assert
-
-#ifndef NDEBUG
-#define safe_assert(expr) ((expr) ? (void) 0 : __helenos_assert_quick_abort(#expr, __FILE__, __LINE__))
-#else
-#define safe_assert(expr) ((void) 0)
-#endif
-
-#endif /* _HELENOS_SOURCE */
-
-/** @}
- */
Index: pace/lib/c/include/async.h
===================================================================
--- uspace/lib/c/include/async.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,388 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#if ((defined(_LIBC_IPC_H_)) && (!defined(_LIBC_ASYNC_C_)))
-#error Do not intermix low-level IPC interface and async framework
-#endif
-
-#ifndef _LIBC_ASYNC_H_
-#define _LIBC_ASYNC_H_
-
-#include <ipc/common.h>
-#include <time.h>
-#include <stdbool.h>
-#include <abi/proc/task.h>
-#include <abi/ddi/irq.h>
-#include <abi/ipc/event.h>
-#include <abi/ipc/interfaces.h>
-#include <abi/cap.h>
-
-#include <_bits/__noreturn.h>
-
-typedef sysarg_t aid_t;
-typedef sysarg_t port_id_t;
-
-typedef void *(*async_client_data_ctor_t)(void);
-typedef void (*async_client_data_dtor_t)(void *);
-
-/** Port connection handler
- *
- * @param call Incoming call or NULL if connection initiated from inside
- *             using async_create_callback_port()
- * @param arg  Local argument.
- *
- */
-typedef void (*async_port_handler_t)(ipc_call_t *, void *);
-
-/** Notification handler */
-typedef void (*async_notification_handler_t)(ipc_call_t *, void *);
-
-/** Exchange management style
- *
- */
-typedef enum {
-	/** No explicit exchange management
-	 *
-	 * Suitable for protocols which use a single
-	 * IPC message per exchange only.
-	 *
-	 */
-	EXCHANGE_ATOMIC = 0,
-
-	/** Exchange management via mutual exclusion
-	 *
-	 * Suitable for any kind of client/server communication,
-	 * but can limit parallelism.
-	 *
-	 */
-	EXCHANGE_SERIALIZE = 1,
-
-	/** Exchange management via phone cloning
-	 *
-	 * Suitable for servers which support client
-	 * data tracking by task hashes and do not
-	 * mind cloned phones.
-	 *
-	 */
-	EXCHANGE_PARALLEL = 2
-} exch_mgmt_t;
-
-/** Forward declarations */
-struct async_exch;
-struct async_sess;
-
-typedef struct async_sess async_sess_t;
-typedef struct async_exch async_exch_t;
-
-extern __noreturn void async_manager(void);
-
-extern bool async_get_call(ipc_call_t *);
-extern bool async_get_call_timeout(ipc_call_t *, usec_t);
-
-extern aid_t async_send_0(async_exch_t *, sysarg_t, ipc_call_t *);
-extern aid_t async_send_1(async_exch_t *, sysarg_t, sysarg_t, ipc_call_t *);
-extern aid_t async_send_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    ipc_call_t *);
-extern aid_t async_send_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, ipc_call_t *);
-extern aid_t async_send_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, ipc_call_t *);
-extern aid_t async_send_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
-
-extern void async_wait_for(aid_t, errno_t *);
-extern errno_t async_wait_timeout(aid_t, errno_t *, usec_t);
-extern void async_forget(aid_t);
-
-extern void async_set_client_data_constructor(async_client_data_ctor_t);
-extern void async_set_client_data_destructor(async_client_data_dtor_t);
-extern void *async_get_client_data(void);
-extern void *async_get_client_data_by_id(task_id_t);
-extern void async_put_client_data_by_id(task_id_t);
-
-extern errno_t async_create_port(iface_t, async_port_handler_t, void *,
-    port_id_t *);
-extern void async_set_fallback_port_handler(async_port_handler_t, void *);
-extern errno_t async_create_callback_port(async_exch_t *, iface_t, sysarg_t,
-    sysarg_t, async_port_handler_t, void *, port_id_t *);
-
-extern errno_t async_irq_subscribe(int, async_notification_handler_t, void *,
-    const irq_code_t *, cap_irq_handle_t *);
-extern errno_t async_irq_unsubscribe(cap_irq_handle_t);
-
-extern errno_t async_event_subscribe(event_type_t, async_notification_handler_t,
-    void *);
-extern errno_t async_event_task_subscribe(event_task_type_t,
-    async_notification_handler_t, void *);
-extern errno_t async_event_unsubscribe(event_type_t);
-extern errno_t async_event_task_unsubscribe(event_task_type_t);
-extern errno_t async_event_unmask(event_type_t);
-extern errno_t async_event_task_unmask(event_task_type_t);
-
-/*
- * Wrappers for simple communication.
- */
-
-extern void async_msg_0(async_exch_t *, sysarg_t);
-extern void async_msg_1(async_exch_t *, sysarg_t, sysarg_t);
-extern void async_msg_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
-extern void async_msg_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-extern void async_msg_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-extern void async_msg_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-
-/*
- * Wrappers for answer routines.
- */
-
-extern errno_t async_answer_0(ipc_call_t *, errno_t);
-extern errno_t async_answer_1(ipc_call_t *, errno_t, sysarg_t);
-extern errno_t async_answer_2(ipc_call_t *, errno_t, sysarg_t, sysarg_t);
-extern errno_t async_answer_3(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
-    sysarg_t);
-extern errno_t async_answer_4(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t async_answer_5(ipc_call_t *, errno_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-/*
- * Wrappers for forwarding routines.
- */
-
-extern errno_t async_forward_0(ipc_call_t *, async_exch_t *, sysarg_t,
-    unsigned int);
-extern errno_t async_forward_1(ipc_call_t *, async_exch_t *, sysarg_t,
-    sysarg_t, unsigned int);
-extern errno_t async_forward_2(ipc_call_t *, async_exch_t *, sysarg_t,
-    sysarg_t, sysarg_t, unsigned int);
-extern errno_t async_forward_3(ipc_call_t *, async_exch_t *, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, unsigned int);
-extern errno_t async_forward_4(ipc_call_t *, async_exch_t *, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
-extern errno_t async_forward_5(ipc_call_t *, async_exch_t *, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
-
-/*
- * User-friendly wrappers for async_req_*_*().
- * The functions are in the form async_req_m_n(), where m is the number of
- * payload arguments and n is the number of return arguments.
- */
-
-extern errno_t async_req_0_0(async_exch_t *, sysarg_t);
-extern errno_t async_req_0_1(async_exch_t *, sysarg_t, sysarg_t *);
-extern errno_t async_req_0_2(async_exch_t *, sysarg_t, sysarg_t *, sysarg_t *);
-extern errno_t async_req_0_3(async_exch_t *, sysarg_t, sysarg_t *, sysarg_t *,
-    sysarg_t *);
-extern errno_t async_req_0_4(async_exch_t *, sysarg_t, sysarg_t *, sysarg_t *,
-    sysarg_t *, sysarg_t *);
-extern errno_t async_req_0_5(async_exch_t *, sysarg_t, sysarg_t *, sysarg_t *,
-    sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_1_0(async_exch_t *, sysarg_t, sysarg_t);
-extern errno_t async_req_1_1(async_exch_t *, sysarg_t, sysarg_t, sysarg_t *);
-extern errno_t async_req_1_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t *,
-    sysarg_t *);
-extern errno_t async_req_1_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t *,
-    sysarg_t *, sysarg_t *);
-extern errno_t async_req_1_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t *,
-    sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_1_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t *,
-    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_2_0(async_exch_t *, sysarg_t, sysarg_t, sysarg_t);
-extern errno_t async_req_2_1(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t *);
-extern errno_t async_req_2_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t *, sysarg_t *);
-extern errno_t async_req_2_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_2_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_2_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_3_0(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-extern errno_t async_req_3_1(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t *);
-extern errno_t async_req_3_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t *, sysarg_t *);
-extern errno_t async_req_3_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_3_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_3_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_4_0(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t async_req_4_1(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t *);
-extern errno_t async_req_4_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *);
-extern errno_t async_req_4_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_4_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_4_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
-    sysarg_t *);
-extern errno_t async_req_5_0(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-extern errno_t async_req_5_1(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t *);
-extern errno_t async_req_5_2(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *);
-extern errno_t async_req_5_3(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *);
-extern errno_t async_req_5_4(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
-    sysarg_t *);
-extern errno_t async_req_5_5(async_exch_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *,
-    sysarg_t *, sysarg_t *);
-
-extern errno_t async_accept_0(ipc_call_t *);
-extern sysarg_t async_get_label(void);
-
-extern async_sess_t *async_connect_me_to(async_exch_t *, iface_t, sysarg_t,
-    sysarg_t, errno_t *);
-extern async_sess_t *async_connect_me_to_blocking(async_exch_t *, iface_t,
-    sysarg_t, sysarg_t, errno_t *);
-extern async_sess_t *async_connect_kbox(task_id_t, errno_t *);
-
-extern errno_t async_connect_to_me(async_exch_t *, iface_t, sysarg_t, sysarg_t);
-
-extern void async_hangup(async_sess_t *);
-
-extern async_exch_t *async_exchange_begin(async_sess_t *);
-extern void async_exchange_end(async_exch_t *);
-
-/*
- * FIXME These functions just work around problems with parallel exchange
- * management. Proper solution needs to be implemented.
- */
-extern void async_sess_args_set(async_sess_t *, iface_t, sysarg_t, sysarg_t);
-
-/*
- * User-friendly wrappers for async_share_in_start().
- */
-
-extern errno_t async_share_in_start_0_0(async_exch_t *, size_t, void **);
-extern errno_t async_share_in_start_0_1(async_exch_t *, size_t,
-    unsigned int *, void **);
-extern errno_t async_share_in_start_1_0(async_exch_t *, size_t, sysarg_t,
-    void **);
-extern errno_t async_share_in_start_1_1(async_exch_t *, size_t, sysarg_t,
-    unsigned int *, void **);
-
-extern bool async_share_in_receive(ipc_call_t *, size_t *);
-extern errno_t async_share_in_finalize(ipc_call_t *, void *, unsigned int);
-
-extern errno_t async_share_out_start(async_exch_t *, void *, unsigned int);
-extern bool async_share_out_receive(ipc_call_t *, size_t *, unsigned int *);
-extern errno_t async_share_out_finalize(ipc_call_t *, void **);
-
-extern errno_t async_data_read_forward_0_0(async_exch_t *, sysarg_t);
-extern errno_t async_data_read_forward_1_0(async_exch_t *, sysarg_t, sysarg_t);
-extern errno_t async_data_read_forward_2_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t);
-extern errno_t async_data_read_forward_3_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t async_data_read_forward_4_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-extern errno_t async_data_read_forward_0_1(async_exch_t *, sysarg_t,
-    ipc_call_t *);
-extern errno_t async_data_read_forward_1_1(async_exch_t *, sysarg_t, sysarg_t,
-    ipc_call_t *);
-extern errno_t async_data_read_forward_2_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, ipc_call_t *);
-extern errno_t async_data_read_forward_3_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, ipc_call_t *);
-extern errno_t async_data_read_forward_4_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
-
-extern aid_t async_data_read(async_exch_t *, void *, size_t, ipc_call_t *);
-extern errno_t async_data_read_start(async_exch_t *, void *, size_t);
-extern bool async_data_read_receive(ipc_call_t *, size_t *);
-extern errno_t async_data_read_finalize(ipc_call_t *, const void *, size_t);
-
-extern errno_t async_data_write_forward_0_0(async_exch_t *, sysarg_t);
-extern errno_t async_data_write_forward_1_0(async_exch_t *, sysarg_t, sysarg_t);
-extern errno_t async_data_write_forward_2_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t);
-extern errno_t async_data_write_forward_3_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t async_data_write_forward_4_0(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-extern errno_t async_data_write_forward_0_1(async_exch_t *, sysarg_t,
-    ipc_call_t *);
-extern errno_t async_data_write_forward_1_1(async_exch_t *, sysarg_t, sysarg_t,
-    ipc_call_t *);
-extern errno_t async_data_write_forward_2_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, ipc_call_t *);
-extern errno_t async_data_write_forward_3_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, ipc_call_t *);
-extern errno_t async_data_write_forward_4_1(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, ipc_call_t *);
-
-extern errno_t async_data_write_start(async_exch_t *, const void *, size_t);
-extern bool async_data_write_receive(ipc_call_t *, size_t *);
-extern errno_t async_data_write_finalize(ipc_call_t *, void *, size_t);
-
-extern errno_t async_data_write_accept(void **, const bool, const size_t,
-    const size_t, const size_t, size_t *);
-extern void async_data_write_void(errno_t);
-
-extern async_sess_t *async_callback_receive(exch_mgmt_t);
-extern async_sess_t *async_callback_receive_start(exch_mgmt_t, ipc_call_t *);
-
-extern errno_t async_state_change_start(async_exch_t *, sysarg_t, sysarg_t,
-    sysarg_t, async_exch_t *);
-extern bool async_state_change_receive(ipc_call_t *);
-extern errno_t async_state_change_finalize(ipc_call_t *, async_exch_t *);
-
-extern void *async_remote_state_acquire(async_sess_t *);
-extern void async_remote_state_update(async_sess_t *, void *);
-extern void async_remote_state_release(async_sess_t *);
-extern void async_remote_state_release_exchange(async_exch_t *);
-
-extern void *async_as_area_create(void *, size_t, unsigned int, async_sess_t *,
-    sysarg_t, sysarg_t, sysarg_t);
-
-errno_t async_spawn_notification_handler(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/barrier.h
===================================================================
--- uspace/lib/c/include/barrier.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_COMPILER_BARRIER_H_
-#define _LIBC_COMPILER_BARRIER_H_
-
-#include <stdatomic.h>
-
-static inline void compiler_barrier(void)
-{
-	atomic_signal_fence(memory_order_seq_cst);
-}
-
-static inline void memory_barrier(void)
-{
-	atomic_thread_fence(memory_order_seq_cst);
-}
-
-static inline void read_barrier(void)
-{
-	atomic_thread_fence(memory_order_acquire);
-}
-
-static inline void write_barrier(void)
-{
-	atomic_thread_fence(memory_order_release);
-}
-
-/** Forces the compiler to access (ie load/store) the variable only once. */
-#define ACCESS_ONCE(var) (*((volatile typeof(var)*)&(var)))
-
-#endif /* _LIBC_COMPILER_BARRIER_H_ */
Index: pace/lib/c/include/bitops.h
===================================================================
--- uspace/lib/c/include/bitops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_BITOPS_H_
-#define _LIBC_BITOPS_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-/** Mask with bit @a n set. */
-#define BIT_V(type, n) \
-    ((type) 1 << (n))
-
-/** Mask with rightmost @a n bits set. */
-#define BIT_RRANGE(type, n) \
-    (BIT_V(type, (n)) - 1)
-
-/** Mask with bits @a hi .. @a lo set. @a hi >= @a lo. */
-#define BIT_RANGE(type, hi, lo) \
-    (BIT_RRANGE(type, (hi) - (lo) + 1) << (lo))
-
-/** Extract range of bits @a hi .. @a lo from @a value. */
-#define BIT_RANGE_EXTRACT(type, hi, lo, value) \
-    (((value) >> (lo)) & BIT_RRANGE(type, (hi) - (lo) + 1))
-
-/** Insert @a value between bits @a hi .. @a lo. */
-#define BIT_RANGE_INSERT(type, hi, lo, value) \
-    (((value) & BIT_RRANGE(type, (hi) - (lo) + 1)) << (lo))
-
-/** Return position of first non-zero bit from left (i.e. [log_2(arg)]).
- *
- * If number is zero, it returns 0
- */
-static inline unsigned int fnzb32(uint32_t arg)
-{
-	unsigned int n = 0;
-
-	if (arg >> 16) {
-		arg >>= 16;
-		n += 16;
-	}
-
-	if (arg >> 8) {
-		arg >>= 8;
-		n += 8;
-	}
-
-	if (arg >> 4) {
-		arg >>= 4;
-		n += 4;
-	}
-
-	if (arg >> 2) {
-		arg >>= 2;
-		n += 2;
-	}
-
-	if (arg >> 1) {
-		arg >>= 1;
-		n += 1;
-	}
-
-	return n;
-}
-
-static inline unsigned int fnzb64(uint64_t arg)
-{
-	unsigned int n = 0;
-
-	if (arg >> 32) {
-		arg >>= 32;
-		n += 32;
-	}
-
-	return (n + fnzb32((uint32_t) arg));
-}
-
-static inline unsigned int fnzb(size_t arg)
-{
-	return fnzb64(arg);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/byteorder.h
===================================================================
--- uspace/lib/c/include/byteorder.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_BYTEORDER_H_
-#define _LIBC_BYTEORDER_H_
-
-#include <stdint.h>
-
-#if !(defined(__BE__) ^ defined(__LE__))
-#error The architecture must be either big-endian or little-endian.
-#endif
-
-#ifdef __BE__
-
-#define uint16_t_le2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_le2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_le2host(n)  (uint64_t_byteorder_swap(n))
-
-#define uint16_t_be2host(n)  (n)
-#define uint32_t_be2host(n)  (n)
-#define uint64_t_be2host(n)  (n)
-
-#define host2uint16_t_le(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_le(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_le(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_be(n)  (n)
-#define host2uint32_t_be(n)  (n)
-#define host2uint64_t_be(n)  (n)
-
-#else
-
-#define uint16_t_le2host(n)  (n)
-#define uint32_t_le2host(n)  (n)
-#define uint64_t_le2host(n)  (n)
-
-#define uint16_t_be2host(n)  (uint16_t_byteorder_swap(n))
-#define uint32_t_be2host(n)  (uint32_t_byteorder_swap(n))
-#define uint64_t_be2host(n)  (uint64_t_byteorder_swap(n))
-
-#define host2uint16_t_le(n)  (n)
-#define host2uint32_t_le(n)  (n)
-#define host2uint64_t_le(n)  (n)
-
-#define host2uint16_t_be(n)  (uint16_t_byteorder_swap(n))
-#define host2uint32_t_be(n)  (uint32_t_byteorder_swap(n))
-#define host2uint64_t_be(n)  (uint64_t_byteorder_swap(n))
-
-#endif
-
-#define htons(n)  host2uint16_t_be((n))
-#define htonl(n)  host2uint32_t_be((n))
-#define ntohs(n)  uint16_t_be2host((n))
-#define ntohl(n)  uint32_t_be2host((n))
-
-#define uint8_t_be2host(n)  (n)
-#define uint8_t_le2host(n)  (n)
-#define host2uint8_t_be(n)  (n)
-#define host2uint8_t_le(n)  (n)
-#define host2uint8_t_le(n)  (n)
-
-#define  int8_t_le2host(n)  uint8_t_le2host(n)
-#define int16_t_le2host(n) uint16_t_le2host(n)
-#define int32_t_le2host(n) uint32_t_le2host(n)
-#define int64_t_le2host(n) uint64_t_le2host(n)
-
-#define  int8_t_be2host(n)  uint8_t_be2host(n)
-#define int16_t_be2host(n) uint16_t_be2host(n)
-#define int32_t_be2host(n) uint32_t_be2host(n)
-#define int64_t_be2host(n) uint64_t_be2host(n)
-
-#define  host2int8_t_le(n)  host2uint8_t_le(n)
-#define host2int16_t_le(n) host2uint16_t_le(n)
-#define host2int32_t_le(n) host2uint32_t_le(n)
-#define host2int64_t_le(n) host2uint64_t_le(n)
-
-#define  host2int8_t_be(n)  host2uint8_t_be(n)
-#define host2int16_t_be(n) host2uint16_t_be(n)
-#define host2int32_t_be(n) host2uint32_t_be(n)
-#define host2int64_t_be(n) host2uint64_t_be(n)
-
-static inline uint64_t uint64_t_byteorder_swap(uint64_t n)
-{
-	return ((n & 0xff) << 56) |
-	    ((n & 0xff00) << 40) |
-	    ((n & 0xff0000) << 24) |
-	    ((n & 0xff000000LL) << 8) |
-	    ((n & 0xff00000000LL) >> 8) |
-	    ((n & 0xff0000000000LL) >> 24) |
-	    ((n & 0xff000000000000LL) >> 40) |
-	    ((n & 0xff00000000000000LL) >> 56);
-}
-
-static inline uint32_t uint32_t_byteorder_swap(uint32_t n)
-{
-	return ((n & 0xff) << 24) |
-	    ((n & 0xff00) << 8) |
-	    ((n & 0xff0000) >> 8) |
-	    ((n & 0xff000000) >> 24);
-}
-
-static inline uint16_t uint16_t_byteorder_swap(uint16_t n)
-{
-	return ((n & 0xff) << 8) |
-	    ((n & 0xff00) >> 8);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/capa.h
===================================================================
--- uspace/lib/c/include/capa.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file Storage capacity specification.
- */
-
-#ifndef _LIBC_CAPA_H_
-#define _LIBC_CAPA_H_
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Capacity unit */
-typedef enum {
-	cu_byte = 0,
-	cu_kbyte,
-	cu_mbyte,
-	cu_gbyte,
-	cu_tbyte,
-	cu_pbyte,
-	cu_ebyte,
-	cu_zbyte,
-	cu_ybyte
-} capa_unit_t;
-
-/** Which of values within the precision of the capacity */
-typedef enum {
-	/** The nominal (middling) value */
-	cv_nom,
-	/** The minimum value */
-	cv_min,
-	/** The maximum value */
-	cv_max
-} capa_vsel_t;
-
-#define CU_LIMIT (cu_ybyte + 1)
-
-/** Storage capacity.
- *
- * Storage capacity represents both value and precision.
- * It is a decimal floating point value combined with a decimal
- * capacity unit. There is an integer mantisa @c m which in combination
- * with the number of decimal positions @c dp gives a decimal floating-point
- * number. E.g. for m = 1025 and dp = 2 the number is 10.25. If the unit
- * cunit = cu_kbyte, the capacity is 10.25 kByte, i.e. 10 250 bytes.
- *
- * Note that 1.000 kByte is equivalent to 1000 Byte, but 1 kByte is less
- * precise.
- */
-typedef struct {
-	/** Mantisa */
-	uint64_t m;
-	/** Decimal positions */
-	unsigned dp;
-	/** Capacity unit */
-	capa_unit_t cunit;
-} capa_spec_t;
-
-extern errno_t capa_format(capa_spec_t *, char **);
-extern errno_t capa_parse(const char *, capa_spec_t *);
-extern void capa_simplify(capa_spec_t *);
-extern void capa_from_blocks(uint64_t, size_t, capa_spec_t *);
-extern errno_t capa_to_blocks(capa_spec_t *, capa_vsel_t, size_t, uint64_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/config.h
===================================================================
--- uspace/lib/c/include/config.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_CONFIG_H_
-#define _LIBC_CONFIG_H_
-
-#include <stdbool.h>
-
-extern bool config_key_exists(const char *);
-extern char *config_get_value(const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/context.h
===================================================================
--- uspace/lib/c/include/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_CONTEXT_H_
-#define _LIBC_CONTEXT_H_
-
-#include <_bits/size_t.h>
-#include <libarch/fibril_context.h>
-
-typedef __context_t context_t;
-
-/* Context initialization data. */
-typedef struct {
-	void (*fn)(void);
-	void *stack_base;
-	size_t stack_size;
-	void *tls;
-} context_create_t;
-
-extern void context_swap(context_t *self, context_t *other);
-extern void context_create(context_t *context, const context_create_t *arg);
-extern uintptr_t context_get_fp(context_t *ctx);
-extern uintptr_t context_get_pc(context_t *ctx);
-
-#endif
Index: pace/lib/c/include/dbgcon.h
===================================================================
--- uspace/lib/c/include/dbgcon.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DBGCON_H_
-#define _LIBC_DBGCON_H_
-
-#include <stdbool.h>
-
-extern bool dbgcon_enable(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ddi.h
===================================================================
--- uspace/lib/c/include/ddi.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DDI_H_
-#define _LIBC_DDI_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <time.h>
-#include <byteorder.h>
-#include <abi/ddi/irq.h>
-#include <device/hw_res.h>
-#include <device/hw_res_parsed.h>
-#include <device/pio_window.h>
-#include <task.h>
-
-#define DMAMEM_1MiB   ((uintptr_t) UINT64_C(0xfffffffffff00000))
-#define DMAMEM_16MiB  ((uintptr_t) UINT64_C(0xffffffffff000000))
-#define DMAMEM_4GiB   ((uintptr_t) UINT64_C(0xffffffff00000000))
-
-typedef volatile uint8_t ioport8_t;
-typedef volatile uint16_t ioport16_t;
-typedef volatile uint32_t ioport32_t;
-typedef volatile uint64_t ioport64_t;
-
-extern errno_t physmem_map(uintptr_t, size_t, unsigned int, void **);
-extern errno_t physmem_unmap(void *);
-
-extern errno_t dmamem_map(void *, size_t, unsigned int, unsigned int, uintptr_t *);
-extern errno_t dmamem_map_anonymous(size_t, uintptr_t, unsigned int, unsigned int,
-    uintptr_t *, void **);
-extern errno_t dmamem_unmap(void *, size_t);
-extern errno_t dmamem_unmap_anonymous(void *);
-
-extern errno_t pio_enable_range(addr_range_t *, void **);
-extern errno_t pio_enable_resource(pio_window_t *, hw_resource_t *, void **,
-    uintptr_t *, size_t *);
-extern errno_t pio_enable(void *, size_t, void **);
-extern errno_t pio_disable(void *, size_t);
-
-typedef void (*trace_fnc)(const volatile void *place, uint64_t val,
-    volatile void *base, size_t size, void *data, bool write);
-
-extern errno_t pio_trace_enable(void *, size_t, trace_fnc, void *);
-extern void pio_trace_log(const volatile void *, uint64_t val, bool write);
-extern void pio_trace_disable(void *);
-
-extern void pio_write_8(ioport8_t *, uint8_t);
-extern void pio_write_16(ioport16_t *, uint16_t);
-extern void pio_write_32(ioport32_t *, uint32_t);
-extern void pio_write_64(ioport64_t *, uint64_t);
-
-extern uint8_t pio_read_8(const ioport8_t *);
-extern uint16_t pio_read_16(const ioport16_t *);
-extern uint32_t pio_read_32(const ioport32_t *);
-extern uint64_t pio_read_64(const ioport64_t *);
-
-static inline void pio_write_le16(ioport16_t *reg, uint16_t val)
-{
-	pio_write_16(reg, host2uint16_t_le(val));
-}
-static inline void pio_write_be16(ioport16_t *reg, uint16_t val)
-{
-	pio_write_16(reg, host2uint16_t_be(val));
-}
-static inline void pio_write_le32(ioport32_t *reg, uint32_t val)
-{
-	pio_write_32(reg, host2uint32_t_le(val));
-}
-static inline void pio_write_be32(ioport32_t *reg, uint32_t val)
-{
-	pio_write_32(reg, host2uint32_t_be(val));
-}
-static inline void pio_write_le64(ioport64_t *reg, uint64_t val)
-{
-	pio_write_64(reg, host2uint64_t_le(val));
-}
-static inline void pio_write_be64(ioport64_t *reg, uint64_t val)
-{
-	pio_write_64(reg, host2uint64_t_be(val));
-}
-
-static inline uint16_t pio_read_le16(const ioport16_t *reg)
-{
-	return uint16_t_le2host(pio_read_16(reg));
-}
-static inline uint16_t pio_read_be16(const ioport16_t *reg)
-{
-	return uint16_t_be2host(pio_read_16(reg));
-}
-static inline uint32_t pio_read_le32(const ioport32_t *reg)
-{
-	return uint32_t_le2host(pio_read_32(reg));
-}
-static inline uint32_t pio_read_be32(const ioport32_t *reg)
-{
-	return uint32_t_be2host(pio_read_32(reg));
-}
-static inline uint64_t pio_read_le64(const ioport64_t *reg)
-{
-	return uint64_t_le2host(pio_read_64(reg));
-}
-static inline uint64_t pio_read_be64(const ioport64_t *reg)
-{
-	return uint64_t_be2host(pio_read_64(reg));
-}
-
-static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask,
-    usec_t delay)
-{
-	uint8_t v = pio_read_8(reg);
-	udelay(delay);
-	pio_write_8(reg, (v & ~mask) | val);
-	return v;
-}
-
-static inline uint16_t pio_change_16(ioport16_t *reg, uint16_t val,
-    uint16_t mask, usec_t delay)
-{
-	uint16_t v = pio_read_16(reg);
-	udelay(delay);
-	pio_write_16(reg, (v & ~mask) | val);
-	return v;
-}
-
-static inline uint32_t pio_change_32(ioport32_t *reg, uint32_t val,
-    uint32_t mask, usec_t delay)
-{
-	uint32_t v = pio_read_32(reg);
-	udelay(delay);
-	pio_write_32(reg, (v & ~mask) | val);
-	return v;
-}
-
-static inline uint64_t pio_change_64(ioport64_t *reg, uint64_t val,
-    uint64_t mask, usec_t delay)
-{
-	uint64_t v = pio_read_64(reg);
-	udelay(delay);
-	pio_write_64(reg, (v & ~mask) | val);
-	return v;
-}
-
-static inline uint8_t pio_set_8(ioport8_t *r, uint8_t v, usec_t d)
-{
-	return pio_change_8(r, v, 0, d);
-}
-static inline uint16_t pio_set_16(ioport16_t *r, uint16_t v, usec_t d)
-{
-	return pio_change_16(r, v, 0, d);
-}
-static inline uint32_t pio_set_32(ioport32_t *r, uint32_t v, usec_t d)
-{
-	return pio_change_32(r, v, 0, d);
-}
-static inline uint64_t pio_set_64(ioport64_t *r, uint64_t v, usec_t d)
-{
-	return pio_change_64(r, v, 0, d);
-}
-
-static inline uint8_t pio_clear_8(ioport8_t *r, uint8_t v, usec_t d)
-{
-	return pio_change_8(r, 0, v, d);
-}
-static inline uint16_t pio_clear_16(ioport16_t *r, uint16_t v, usec_t d)
-{
-	return pio_change_16(r, 0, v, d);
-}
-static inline uint32_t pio_clear_32(ioport32_t *r, uint32_t v, usec_t d)
-{
-	return pio_change_32(r, 0, v, d);
-}
-static inline uint64_t pio_clear_64(ioport64_t *r, uint64_t v, usec_t d)
-{
-	return pio_change_64(r, 0, v, d);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/device/clock_dev.h
===================================================================
--- uspace/lib/c/include/device/clock_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DEVICE_CLOCK_DEV_H_
-#define _LIBC_DEVICE_CLOCK_DEV_H_
-
-#include <async.h>
-#include <time.h>
-
-typedef enum {
-	CLOCK_DEV_TIME_GET = 0,
-	CLOCK_DEV_TIME_SET,
-} clock_dev_method_t;
-
-extern errno_t clock_dev_time_get(async_sess_t *, struct tm *);
-extern errno_t clock_dev_time_set(async_sess_t *, struct tm *);
-
-#endif
Index: pace/lib/c/include/device/hw_res.h
===================================================================
--- uspace/lib/c/include/device/hw_res.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DEVICE_HW_RES_H_
-#define _LIBC_DEVICE_HW_RES_H_
-
-#include <ipc/dev_iface.h>
-#include <async.h>
-#include <stdbool.h>
-
-#define DMA_MODE_ON_DEMAND  0
-#define DMA_MODE_WRITE      (1 << 2)
-#define DMA_MODE_READ       (1 << 3)
-#define DMA_MODE_AUTO       (1 << 4)
-#define DMA_MODE_DOWN       (1 << 5)
-#define DMA_MODE_SINGLE     (1 << 6)
-#define DMA_MODE_BLOCK      (1 << 7)
-
-/** HW resource provider interface */
-typedef enum {
-	HW_RES_GET_RESOURCE_LIST = 0,
-	HW_RES_ENABLE_INTERRUPT,
-	HW_RES_DISABLE_INTERRUPT,
-	HW_RES_CLEAR_INTERRUPT,
-	HW_RES_DMA_CHANNEL_SETUP,
-	HW_RES_DMA_CHANNEL_REMAIN,
-	HW_RES_QUERY_LEGACY_IO,
-	HW_RES_CLAIM_LEGACY_IO
-} hw_res_method_t;
-
-/** HW resource types */
-typedef enum {
-	INTERRUPT,
-	IO_RANGE,
-	MEM_RANGE,
-	DMA_CHANNEL_8,
-	DMA_CHANNEL_16,
-} hw_res_type_t;
-
-typedef enum {
-	LITTLE_ENDIAN = 0,
-	BIG_ENDIAN
-} endianness_t;
-
-/** HW resource (e.g. interrupt, memory register, i/o register etc.) */
-typedef struct {
-	hw_res_type_t type;
-	union {
-		struct {
-			uint64_t address;
-			size_t size;
-			bool relative;
-			endianness_t endianness;
-		} mem_range;
-
-		struct {
-			uint64_t address;
-			size_t size;
-			bool relative;
-			endianness_t endianness;
-		} io_range;
-
-		struct {
-			int irq;
-		} interrupt;
-
-		union {
-			unsigned int dma8;
-			unsigned int dma16;
-		} dma_channel;
-	} res;
-} hw_resource_t;
-
-typedef struct {
-	size_t count;
-	hw_resource_t *resources;
-} hw_resource_list_t;
-
-static inline void hw_res_clean_resource_list(hw_resource_list_t *hw_res)
-{
-	if (hw_res->resources != NULL) {
-		free(hw_res->resources);
-		hw_res->resources = NULL;
-	}
-
-	hw_res->count = 0;
-}
-
-/** Claims to legacy devices */
-typedef enum {
-	/** 'Legacy' ISA IDE I/O ranges */
-	hwc_isa_ide = 0x1
-} hw_res_claims_t;
-
-extern errno_t hw_res_get_resource_list(async_sess_t *, hw_resource_list_t *);
-extern errno_t hw_res_enable_interrupt(async_sess_t *, int);
-extern errno_t hw_res_disable_interrupt(async_sess_t *, int);
-extern errno_t hw_res_clear_interrupt(async_sess_t *, int);
-
-extern errno_t hw_res_dma_channel_setup(async_sess_t *, unsigned int, uint32_t,
-    uint32_t, uint8_t);
-extern errno_t hw_res_dma_channel_remain(async_sess_t *, unsigned, size_t *);
-extern errno_t hw_res_query_legacy_io(async_sess_t *, hw_res_claims_t *);
-extern errno_t hw_res_claim_legacy_io(async_sess_t *, hw_res_claims_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/device/hw_res_parsed.h
===================================================================
--- uspace/lib/c/include/device/hw_res_parsed.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DEVICE_HW_RES_PARSED_H_
-#define _LIBC_DEVICE_HW_RES_PARSED_H_
-
-#include <device/hw_res.h>
-#include <device/pio_window.h>
-#include <str.h>
-
-/** Keep areas of the zero size in the list */
-#define HW_RES_KEEP_ZERO_AREA  0x1
-
-/** Keep duplicit entries */
-#define HW_RES_KEEP_DUPLICIT   0x2
-
-#define RNGABS(rng)	(rng).address.absolute
-#define RNGREL(rng)	(rng).address.relative
-#define RNGSZ(rng)	(rng).size
-
-#define RNGABSPTR(rng)	((void *) ((uintptr_t) RNGABS((rng))))
-
-typedef struct address64 {
-	/** Aboslute address. */
-	uint64_t absolute;
-	/** PIO window base relative address. */
-	uint64_t relative;
-} address64_t;
-
-/** Address range structure */
-typedef struct addr_range {
-	/** Start address */
-	address64_t address;
-
-	/** Area size */
-	size_t size;
-
-	/** Endianness */
-	endianness_t endianness;
-} addr_range_t;
-
-/** IO range type */
-typedef addr_range_t io_range_t;
-
-/** Memory range type */
-typedef addr_range_t mem_range_t;
-
-/** List of IRQs */
-typedef struct irq_list {
-	/** Irq count */
-	size_t count;
-
-	/** Array of IRQs */
-	int *irqs;
-} irq_list_t;
-
-/** List of ISA DMA channels */
-typedef struct dma_list {
-	/** Channel count */
-	size_t count;
-
-	/** Array of channels */
-	unsigned int *channels;
-} dma_list_t;
-
-/** List of memory areas */
-typedef struct addr_range_list {
-	/** Areas count */
-	size_t count;
-
-	/** Array of areas */
-	addr_range_t *ranges;
-} addr_range_list_t;
-
-/** List of IO mapped areas */
-typedef addr_range_list_t io_range_list_t;
-
-/** Memory range type */
-typedef addr_range_list_t mem_range_list_t;
-
-/** HW resources parsed according to resource type */
-typedef struct hw_resource_list_parsed {
-	/** List of IRQs */
-	irq_list_t irqs;
-
-	/** List of DMA channels */
-	dma_list_t dma_channels;
-
-	/** List of memory areas */
-	mem_range_list_t mem_ranges;
-
-	/** List of IO areas */
-	io_range_list_t io_ranges;
-} hw_res_list_parsed_t;
-
-/** Clean hw_resource_list_parsed_t structure
- *
- * All allocated memory will be released, data amd pointers set to 0.
- *
- * @param list The structure to clear
- */
-static inline void hw_res_list_parsed_clean(hw_res_list_parsed_t *list)
-{
-	if (list == NULL)
-		return;
-
-	free(list->irqs.irqs);
-	free(list->io_ranges.ranges);
-	free(list->mem_ranges.ranges);
-	free(list->dma_channels.channels);
-
-	memset(list, 0, sizeof(hw_res_list_parsed_t));
-}
-
-/** Initialize the hw_resource_list_parsed_t structure
- *
- *  @param list The structure to initialize
- */
-static inline void hw_res_list_parsed_init(hw_res_list_parsed_t *list)
-{
-	memset(list, 0, sizeof(hw_res_list_parsed_t));
-}
-
-extern errno_t hw_res_list_parse(const pio_window_t *, const hw_resource_list_t *,
-    hw_res_list_parsed_t *, int);
-extern errno_t hw_res_get_list_parsed(async_sess_t *, hw_res_list_parsed_t *, int);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/device/pio_window.h
===================================================================
--- uspace/lib/c/include/device/pio_window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DEVICE_PIO_WINDOW_H_
-#define _LIBC_DEVICE_PIO_WINDOW_H_
-
-#include <ipc/dev_iface.h>
-#include <async.h>
-
-/** PIO_WINDOW provider interface */
-typedef enum {
-	PIO_WINDOW_GET = 0,
-} pio_window_method_t;
-
-typedef struct {
-	struct {
-		uintptr_t base;
-		size_t size;
-	} mem, io;
-} pio_window_t;
-
-extern errno_t pio_window_get(async_sess_t *, pio_window_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/dirent.h
===================================================================
--- uspace/lib/c/include/dirent.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_DIRENT_H_
-#define _LIBC_DIRENT_H_
-
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-struct dirent {
-	char d_name[256];
-};
-
-typedef struct __dirstream DIR;
-
-extern DIR *opendir(const char *);
-extern struct dirent *readdir(DIR *);
-extern void rewinddir(DIR *);
-extern int closedir(DIR *);
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/dlfcn.h
===================================================================
--- uspace/lib/c/include/dlfcn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rtld
- * @{
- */
-/** @file
- * @brief UNIX-like dynamic linker interface.
- */
-
-#ifndef _LIBC_DLFCN_H_
-#define _LIBC_DLFCN_H_
-
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-void *dlopen(const char *, int);
-void *dlsym(void *, const char *);
-
-__C_DECLS_END;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/c/include/double_to_str.h
===================================================================
--- uspace/lib/c/include/double_to_str.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DOUBLE_TO_STR_H_
-#define DOUBLE_TO_STR_H_
-
-#include <stddef.h>
-
-/** Maximum number of digits double_to_*_str conversion functions produce.
- *
- * Both double_to_short_str and double_to_fixed_str generate digits out
- * of a 64bit unsigned int number representation. The max number of
- * of digits is therefore 20. Add 1 to help users who forget to reserve
- * space for a null terminator.
- */
-#define MAX_DOUBLE_STR_LEN (20 + 1)
-
-/** Maximum buffer size needed to store the output of double_to_*_str
- *  functions.
- */
-#define MAX_DOUBLE_STR_BUF_SIZE  21
-
-/* Fwd decl. */
-struct ieee_double_t_tag;
-
-extern int double_to_short_str(struct ieee_double_t_tag, char *, size_t, int *);
-extern int double_to_fixed_str(struct ieee_double_t_tag, int, int, char *,
-    size_t, int *);
-
-#endif
Index: pace/lib/c/include/elf/elf.h
===================================================================
--- uspace/lib/c/include/elf/elf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ELF_H_
-#define _LIBC_ELF_H_
-
-#include <stdint.h>
-#include <types/common.h>
-#include <abi/elf.h>
-
-extern const elf_segment_header_t *elf_get_phdr(const void *, unsigned);
-extern uintptr_t elf_get_bias(const void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/elf/elf_linux.h
===================================================================
--- uspace/lib/c/include/elf/elf_linux.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ELF_LINUX_H_
-#define _LIBC_ELF_LINUX_H_
-
-#include <elf/elf.h>
-#include <libarch/elf_linux.h>
-
-/*
- * Note types
- */
-#define NT_PRSTATUS	1
-
-typedef int pid_t;
-typedef struct {
-	long tv_sec;
-	long tv_usec;
-} linux_timeval_t;
-
-typedef struct {
-	int sig_info[3];
-	short cursig;
-	unsigned long sigpend;
-	unsigned long sighold;
-	pid_t pid;
-	pid_t ppid;
-	pid_t pgrp;
-	pid_t sid;
-	linux_timeval_t pr_utime;
-	linux_timeval_t pr_stime;
-	linux_timeval_t pr_cutime;
-	linux_timeval_t pr_sid;
-	elf_regs_t regs;
-	int fpvalid;
-} elf_prstatus_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/elf/elf_load.h
===================================================================
--- uspace/lib/c/include/elf/elf_load.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * @brief
- */
-
-#ifndef ELF_LOAD_H_
-#define ELF_LOAD_H_
-
-#include <elf/elf_mod.h>
-
-/** Information on loaded ELF program */
-typedef struct {
-	elf_finfo_t finfo;
-	struct rtld *env;
-} elf_info_t;
-
-extern errno_t elf_load(int, elf_info_t *);
-extern void elf_set_pcb(elf_info_t *, pcb_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/elf/elf_mod.h
===================================================================
--- uspace/lib/c/include/elf/elf_mod.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2006 Sergey Bondari
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * @brief ELF loader structures and public functions.
- */
-
-#ifndef ELF_MOD_H_
-#define ELF_MOD_H_
-
-#include <elf/elf.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <loader/pcb.h>
-
-typedef enum {
-	/** Leave all segments in RW access mode. */
-	ELDF_RW = 1
-} eld_flags_t;
-
-/** TLS info for a module */
-typedef struct {
-	/** tdata section image */
-	void *tdata;
-	/** Size of tdata section image in bytes */
-	size_t tdata_size;
-	/** Size of tbss section */
-	size_t tbss_size;
-	/** Alignment of TLS initialization image */
-	size_t tls_align;
-} elf_tls_info_t;
-
-/**
- * Some data extracted from the headers are stored here
- */
-typedef struct {
-	/** Entry point */
-	entry_point_t entry;
-
-	/** The base address where the file has been loaded.
-	 *  Points to the ELF file header.
-	 */
-	void *base;
-
-	/** ELF interpreter name or NULL if statically-linked */
-	const char *interp;
-
-	/** Pointer to the dynamic section */
-	void *dynamic;
-
-	/** TLS info */
-	elf_tls_info_t tls;
-} elf_finfo_t;
-
-/**
- * Holds information about an ELF binary being loaded.
- */
-typedef struct {
-	/** Filedescriptor of the file from which we are loading */
-	int fd;
-
-	/** Difference between run-time addresses and link-time addresses */
-	uintptr_t bias;
-
-	/** Flags passed to the ELF loader. */
-	eld_flags_t flags;
-
-	/** Store extracted info here */
-	elf_finfo_t *info;
-} elf_ld_t;
-
-extern errno_t elf_load_file(int, eld_flags_t, elf_finfo_t *);
-extern errno_t elf_load_file_name(const char *, eld_flags_t, elf_finfo_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/entry_point.h
===================================================================
--- uspace/lib/c/include/entry_point.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ENTRY_POINT_H_
-#define _LIBC_ENTRY_POINT_H_
-
-/* Defined in arch/ARCH/src/entryjmp.[c|s] */
-void entry_point_jmp(void *, void *) __attribute__((noreturn));
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/errno.h
===================================================================
--- uspace/lib/c/include/errno.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_ERRNO_H_
-#define _LIBC_ERRNO_H_
-
-#include <_bits/errno.h>
-#include <abi/errno.h>
-#include <_bits/decls.h>
-
-__HELENOS_DECLS_BEGIN;
-
-extern errno_t *__errno(void) __attribute__((const));
-
-__HELENOS_DECLS_END;
-
-#ifdef __cplusplus
-#define errno  (*(::helenos::__errno()))
-#else
-#define errno  (*(__errno()))
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/fenv.h
===================================================================
--- uspace/lib/c/include/fenv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _FENV_H
-#define _FENV_H
-
-// TODO
-
-#define FE_TOWARDZERO  0
-#define FE_TONEAREST   1
-#define FE_UPWARD      2
-#define FE_DOWNWARD    3
-
-#define fegetround() FE_TONEAREST
-
-#endif
Index: pace/lib/c/include/fibril.h
===================================================================
--- uspace/lib/c/include/fibril.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_FIBRIL_H_
-#define _LIBC_FIBRIL_H_
-
-#include <time.h>
-#include <_bits/errno.h>
-#include <_bits/__noreturn.h>
-#include <_bits/decls.h>
-
-__HELENOS_DECLS_BEGIN;
-
-typedef struct fibril fibril_t;
-
-typedef struct {
-	fibril_t *owned_by;
-} fibril_owner_info_t;
-
-typedef fibril_t *fid_t;
-
-#ifndef __cplusplus
-/** Fibril-local variable specifier */
-#define fibril_local __thread
-#endif
-
-extern fid_t fibril_create_generic(errno_t (*)(void *), void *, size_t);
-extern fid_t fibril_create(errno_t (*)(void *), void *);
-extern void fibril_destroy(fid_t);
-extern void fibril_add_ready(fid_t);
-extern fid_t fibril_get_id(void);
-extern void fibril_yield(void);
-
-extern void fibril_usleep(usec_t);
-extern void fibril_sleep(sec_t);
-
-extern void fibril_enable_multithreaded(void);
-extern int fibril_test_spawn_runners(int);
-
-extern void fibril_detach(fid_t fid);
-
-extern void fibril_start(fid_t);
-extern __noreturn void fibril_exit(long);
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/fibril_synch.h
===================================================================
--- uspace/lib/c/include/fibril_synch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_FIBRIL_SYNCH_H_
-#define _LIBC_FIBRIL_SYNCH_H_
-
-#include <fibril.h>
-#include <adt/list.h>
-#include <time.h>
-#include <stdbool.h>
-#include <_bits/decls.h>
-
-#ifndef __cplusplus
-
-#define FIBRIL_MUTEX_INITIALIZER(name) \
-	{ \
-		.oi = { \
-			.owned_by = NULL \
-		}, \
-		.counter = 1, \
-		.waiters = LIST_INITIALIZER((name).waiters), \
-	}
-
-#define FIBRIL_MUTEX_INITIALIZE(name) \
-	fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
-
-#define FIBRIL_RWLOCK_INITIALIZER(name) \
-	{ \
-		.oi = { \
-			.owned_by = NULL \
-		}, \
-		.readers = 0, \
-		.writers = 0, \
-		.waiters = LIST_INITIALIZER((name).waiters), \
-	}
-
-#define FIBRIL_RWLOCK_INITIALIZE(name) \
-	fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
-
-#define FIBRIL_CONDVAR_INITIALIZER(name) \
-	{ \
-		.waiters = LIST_INITIALIZER((name).waiters), \
-	}
-
-#define FIBRIL_CONDVAR_INITIALIZE(name) \
-	fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
-
-#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
-	{ \
-		.count = (cnt), \
-		.waiters = LIST_INITIALIZER((name).waiters), \
-	}
-
-#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
-	fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
-
-#endif
-
-__HELENOS_DECLS_BEGIN;
-
-typedef struct {
-	fibril_owner_info_t oi;  /**< Keep this the first thing. */
-	int counter;
-	list_t waiters;
-} fibril_mutex_t;
-
-typedef struct {
-	fibril_owner_info_t oi;  /**< Keep this the first thing. */
-	unsigned int writers;
-	unsigned int readers;
-	list_t waiters;
-} fibril_rwlock_t;
-
-typedef struct {
-	list_t waiters;
-} fibril_condvar_t;
-
-typedef void (*fibril_timer_fun_t)(void *);
-
-typedef enum {
-	/** Timer has not been set or has been cleared */
-	fts_not_set,
-	/** Timer was set but did not fire yet */
-	fts_active,
-	/** Timer has fired and has not been cleared since */
-	fts_fired,
-	/** Timer fibril is requested to terminate */
-	fts_cleanup,
-	/** Timer fibril acknowledged termination */
-	fts_clean
-} fibril_timer_state_t;
-
-/** Fibril timer.
- *
- * When a timer is set it executes a callback function (in a separate
- * fibril) after a specified time interval. The timer can be cleared
- * (canceled) before that. From the return value of fibril_timer_clear()
- * one can tell whether the timer fired or not.
- */
-typedef struct {
-	fibril_mutex_t lock;
-	fibril_mutex_t *lockp;
-	fibril_condvar_t cv;
-	fid_t fibril;
-	fibril_timer_state_t state;
-	/** FID of fibril executing handler or 0 if handler is not running */
-	fid_t handler_fid;
-
-	usec_t delay;
-	fibril_timer_fun_t fun;
-	void *arg;
-} fibril_timer_t;
-
-/** A counting semaphore for fibrils. */
-typedef struct {
-	long int count;
-	list_t waiters;
-	bool closed;
-} fibril_semaphore_t;
-
-extern void __fibril_synch_init(void);
-extern void __fibril_synch_fini(void);
-
-/** Initialize fibril mutex.
- *
- * Kept as in-line to allow constexpr marker for C++ library where this
- * is used by C++ mutex type (list initialization are two assignments
- * so it is actually reasonable to have this inlined).
- */
-static inline __CONSTEXPR void fibril_mutex_initialize(fibril_mutex_t *fm)
-{
-	fm->oi.owned_by = NULL;
-	fm->counter = 1;
-	list_initialize(&fm->waiters);
-}
-
-extern void fibril_mutex_lock(fibril_mutex_t *);
-extern bool fibril_mutex_trylock(fibril_mutex_t *);
-extern void fibril_mutex_unlock(fibril_mutex_t *);
-extern bool fibril_mutex_is_locked(fibril_mutex_t *);
-
-extern void fibril_rwlock_initialize(fibril_rwlock_t *);
-extern void fibril_rwlock_read_lock(fibril_rwlock_t *);
-extern void fibril_rwlock_write_lock(fibril_rwlock_t *);
-extern void fibril_rwlock_read_unlock(fibril_rwlock_t *);
-extern void fibril_rwlock_write_unlock(fibril_rwlock_t *);
-extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *);
-extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *);
-extern bool fibril_rwlock_is_locked(fibril_rwlock_t *);
-
-extern void fibril_condvar_initialize(fibril_condvar_t *);
-extern errno_t fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *,
-    usec_t);
-extern void fibril_condvar_wait(fibril_condvar_t *, fibril_mutex_t *);
-extern void fibril_condvar_signal(fibril_condvar_t *);
-extern void fibril_condvar_broadcast(fibril_condvar_t *);
-
-extern fibril_timer_t *fibril_timer_create(fibril_mutex_t *);
-extern void fibril_timer_destroy(fibril_timer_t *);
-extern void fibril_timer_set(fibril_timer_t *, usec_t, fibril_timer_fun_t,
-    void *);
-extern void fibril_timer_set_locked(fibril_timer_t *, usec_t,
-    fibril_timer_fun_t, void *);
-extern fibril_timer_state_t fibril_timer_clear(fibril_timer_t *);
-extern fibril_timer_state_t fibril_timer_clear_locked(fibril_timer_t *);
-
-extern void fibril_semaphore_initialize(fibril_semaphore_t *, long);
-extern void fibril_semaphore_up(fibril_semaphore_t *);
-extern void fibril_semaphore_down(fibril_semaphore_t *);
-extern errno_t fibril_semaphore_down_timeout(fibril_semaphore_t *, usec_t);
-extern void fibril_semaphore_close(fibril_semaphore_t *);
-
-typedef struct mpsc mpsc_t;
-extern mpsc_t *mpsc_create(size_t);
-extern void mpsc_destroy(mpsc_t *);
-extern errno_t mpsc_send(mpsc_t *, const void *);
-extern errno_t mpsc_receive(mpsc_t *, void *, const struct timespec *);
-extern void mpsc_close(mpsc_t *);
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/fourcc.h
===================================================================
--- uspace/lib/c/include/fourcc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_FOURCC_H_
-#define _LIBC_FOURCC_H_
-
-#include <stdint.h>
-
-typedef uint32_t fourcc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/getopt.h
===================================================================
--- uspace/lib/c/include/getopt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*	$NetBSD: getopt.h,v 1.10.6.1 2008/05/18 12:30:09 yamt Exp $	*/
-
-/*
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Ported to HelenOS August 2008 by Tim Post <echo@echoreply.us> */
-
-#ifndef _GETOPT_H_
-#define _GETOPT_H_
-
-/*
- * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
- */
-#define no_argument        0
-#define required_argument  1
-#define optional_argument  2
-
-struct option {
-	/* name of long option */
-	const char *name;
-	/*
-	 * one of no_argument, required_argument, and optional_argument:
-	 * whether option takes an argument
-	 */
-	int has_arg;
-	/* if not NULL, set *flag to val when option found */
-	int *flag;
-	/* if flag not NULL, value to set *flag to; else return value */
-	int val;
-};
-
-/* HelenOS Port - These need to be exposed for legacy getopt() */
-extern char *optarg;
-extern int optind, opterr, optopt;
-extern int optreset;
-
-int getopt_long(int, char *const *, const char *,
-    const struct option *, int *);
-
-/* HelenOS Port : Expose legacy getopt() */
-int	 getopt(int, char *const [], const char *);
-
-#endif /* !_GETOPT_H_ */
Index: pace/lib/c/include/ieee_double.h
===================================================================
--- uspace/lib/c/include/ieee_double.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2012 Adam Hraska
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef IEEE_DOUBLE_H_
-#define IEEE_DOUBLE_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-/** Represents a non-negative floating point number: significand * 2^exponent */
-typedef struct fp_num_t_tag {
-	/** Significand (aka mantissa). */
-	uint64_t significand;
-	/** Binary exponent. */
-	int exponent;
-} fp_num_t;
-
-/** Double number description according to IEEE 754. */
-typedef struct ieee_double_t_tag {
-	/** The number is a NaN or infinity. */
-	bool is_special;
-	/** Not a number. */
-	bool is_nan;
-	bool is_negative;
-	/** The number denoted infinity. */
-	bool is_infinity;
-	/** The number could not be represented as a normalized double. */
-	bool is_denormal;
-	/**
-	 * The predecessor double is closer than the successor. This happens
-	 * if a normal number is of the form 2^k and it is not the smallest
-	 * normal number.
-	 */
-	bool is_accuracy_step;
-	/**
-	 * If !is_special the double's value is:
-	 *   pos_val.significand * 2^pos_val.exponent
-	 */
-	fp_num_t pos_val;
-} ieee_double_t;
-
-extern ieee_double_t extract_ieee_double(double);
-
-#endif
Index: pace/lib/c/include/imath.h
===================================================================
--- uspace/lib/c/include/imath.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * @brief Integer math functions
- */
-
-#ifndef _LIBC_IMATH_H_
-#define _LIBC_IMATH_H_
-
-#include <stdint.h>
-
-extern errno_t ipow10_u64(unsigned, uint64_t *);
-extern unsigned ilog10_u64(uint64_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/c/include/io/kio.h
===================================================================
--- uspace/lib/c/include/io/kio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IO_KIO_H_
-#define _LIBC_IO_KIO_H_
-
-#include <_bits/errno.h>
-#include <_bits/size_t.h>
-#include <io/verify.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <uchar.h>
-
-extern void __kio_init(void);
-extern void __kio_fini(void);
-extern errno_t kio_write(const void *, size_t, size_t *);
-extern void kio_update(void);
-extern void kio_command(const void *, size_t);
-extern int kio_printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int kio_vprintf(const char *, va_list);
-
-extern size_t kio_read(char *buf, size_t n, size_t at);
-
-/*
- * In some files, we have conditional DPRINTF(...) macro that is defined empty
- * in most cases. Provide a dummy printf so we get argument checking and
- * avoid unused variable errors.
- */
-
-static inline int dummy_printf(const char *fmt, ...) _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-static inline int dummy_printf(const char *fmt, ...)
-{
-	/* Empty. */
-	(void) fmt;
-	return 0;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/klog.h
===================================================================
--- uspace/lib/c/include/io/klog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IO_KLOG_H_
-#define _LIBC_IO_KLOG_H_
-
-#include <stddef.h>
-#include <stdarg.h>
-#include <io/verify.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <abi/log.h>
-
-extern errno_t klog_write(log_level_t, const void *, size_t);
-extern errno_t klog_read(void *, size_t, size_t *);
-
-#define KLOG_PRINTF(lvl, fmt, ...) ({ \
-	char *_s; \
-	errno_t _rc = ENOMEM; \
-	if (asprintf(&_s, fmt, ##__VA_ARGS__) >= 0) { \
-		_rc = klog_write((lvl), _s, str_size(_s)); \
-		free(_s); \
-	}; \
-	(_rc != EOK); \
-})
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/log.h
===================================================================
--- uspace/lib/c/include/io/log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#ifndef _LIBC_IO_LOG_H_
-#define _LIBC_IO_LOG_H_
-
-#include <stdarg.h>
-#include <inttypes.h>
-#include <io/verify.h>
-#include <types/common.h>
-
-#include <abi/log.h>
-
-/** Log itself (logging target). */
-typedef sysarg_t log_t;
-/** Formatting directive for printing log_t. */
-#define PRIlogctx PRIxn
-
-/** Default log (target). */
-#define LOG_DEFAULT ((log_t) -1)
-
-/** Use when creating new top-level log. */
-#define LOG_NO_PARENT ((log_t) 0)
-
-extern const char *log_level_str(log_level_t);
-extern errno_t log_level_from_str(const char *, log_level_t *);
-
-extern errno_t log_init(const char *);
-extern log_t log_create(const char *, log_t);
-
-extern void log_msg(log_t, log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
-extern void log_msgv(log_t, log_level_t, const char *, va_list);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/logctl.h
===================================================================
--- uspace/lib/c/include/io/logctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011-2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#ifndef _LIBC_IO_LOGCTL_H_
-#define _LIBC_IO_LOGCTL_H_
-
-#include <io/log.h>
-
-extern errno_t logctl_set_default_level(log_level_t);
-extern errno_t logctl_set_log_level(const char *, log_level_t);
-extern errno_t logctl_set_root(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/pixel.h
===================================================================
--- uspace/lib/c/include/io/pixel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_IO_PIXEL_H_
-#define _LIBC_IO_PIXEL_H_
-
-#include <stdint.h>
-
-#define NARROW(channel, bits) \
-	((channel) >> (8 - (bits)))
-
-#define INVERT(pixel) ((pixel) ^ 0x00ffffff)
-
-#define ALPHA(pixel)  ((pixel) >> 24)
-#define RED(pixel)    (((pixel) & 0x00ff0000) >> 16)
-#define GREEN(pixel)  (((pixel) & 0x0000ff00) >> 8)
-#define BLUE(pixel)   ((pixel) & 0x000000ff)
-
-#define PIXEL(a, r, g, b) \
-	((((unsigned)(a) & 0xff) << 24) | (((unsigned)(r) & 0xff) << 16) | \
-	(((unsigned)(g) & 0xff) << 8) | ((unsigned)(b) & 0xff))
-
-typedef uint32_t pixel_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/pixelmap.h
===================================================================
--- uspace/lib/c/include/io/pixelmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2014 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBC_IO_PIXELMAP_H_
-#define _LIBC_IO_PIXELMAP_H_
-
-#include <types/common.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <io/pixel.h>
-
-typedef struct {
-	sysarg_t width;
-	sysarg_t height;
-	pixel_t *data;
-} pixelmap_t;
-
-static inline pixel_t *pixelmap_pixel_at(
-    pixelmap_t *pixelmap,
-    sysarg_t x,
-    sysarg_t y)
-{
-	if (x < pixelmap->width && y < pixelmap->height) {
-		size_t offset = y * pixelmap->width + x;
-		pixel_t *pixel = pixelmap->data + offset;
-		return pixel;
-	} else {
-		return NULL;
-	}
-}
-
-static inline void pixelmap_put_pixel(
-    pixelmap_t *pixelmap,
-    sysarg_t x,
-    sysarg_t y,
-    pixel_t pixel)
-{
-	pixel_t *target = pixelmap_pixel_at(pixelmap, x, y);
-	if (target != NULL) {
-		*target = pixel;
-	}
-}
-
-static inline pixel_t pixelmap_get_pixel(
-    pixelmap_t *pixelmap,
-    sysarg_t x,
-    sysarg_t y)
-{
-	pixel_t *source = pixelmap_pixel_at(pixelmap, x, y);
-	if (source != NULL) {
-		return *source;
-	} else {
-		return 0;
-	}
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/style.h
===================================================================
--- uspace/lib/c/include/io/style.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IO_STYLE_H_
-#define _LIBC_IO_STYLE_H_
-
-typedef enum {
-	STYLE_NORMAL   = 0,
-	STYLE_EMPHASIS = 1,
-	STYLE_INVERTED = 2,
-	STYLE_SELECTED = 3
-} console_style_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/table.h
===================================================================
--- uspace/lib/c/include/io/table.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IO_TABLE_H_
-#define _LIBC_IO_TABLE_H_
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <errno.h>
-
-/** Table metrics */
-typedef struct {
-	/** Space to the left of the table */
-	size_t margin_left;
-} table_metrics_t;
-
-/** Table cell */
-typedef struct {
-	/** Containing row */
-	struct table_row *row;
-	/** Link to table_row_t.cells */
-	link_t lrow;
-	/** Cell text */
-	char *text;
-} table_cell_t;
-
-/** Table row */
-typedef struct table_row {
-	/** Containing table */
-	struct table *table;
-	/** Link to table_t.rows */
-	link_t ltable;
-	/** Cells of this row */
-	list_t cells;
-} table_row_t;
-
-/** Table column */
-typedef struct {
-	/** Containing table */
-	struct table *table;
-	/** Link to table_t.columns */
-	link_t ltable;
-	/** Column width */
-	size_t width;
-} table_column_t;
-
-/** Table */
-typedef struct table {
-	/** @c true if the first row is a header row */
-	bool header_row;
-	/** Encountered error while writing to table */
-	errno_t error;
-	/** Table rows */
-	list_t rows; /* of table_row_t */
-	/** Table columns */
-	list_t columns; /* of table_column_t */
-	/** Current row */
-	table_row_t *wrow;
-	/** Current cell */
-	table_cell_t *wcell;
-	/** Current column */
-	table_column_t *wcolumn;
-	/** Table metrics */
-	table_metrics_t metrics;
-} table_t;
-
-extern errno_t table_create(table_t **);
-extern void table_destroy(table_t *);
-extern errno_t table_print_out(table_t *, FILE *);
-extern void table_header_row(table_t *);
-extern errno_t table_printf(table_t *, const char *, ...);
-extern errno_t table_get_error(table_t *);
-extern void table_set_margin_left(table_t *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/io/verify.h
===================================================================
--- uspace/lib/c/include/io/verify.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IO_VERIFY_H_
-#define _LIBC_IO_VERIFY_H_
-
-#ifdef __clang__
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(__printf__, start, end)))
-#else
-#define _HELENOS_PRINTF_ATTRIBUTE(start, end) \
-	__attribute__((format(gnu_printf, start, end)))
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/common.h
===================================================================
--- uspace/lib/c/include/ipc/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_COMMON_H_
-#define _LIBC_IPC_COMMON_H_
-
-#include <types/common.h>
-#include <abi/ipc/ipc.h>
-
-#define IPC_FLAG_BLOCKING  0x01
-
-typedef ipc_data_t ipc_call_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/dev_iface.h
===================================================================
--- uspace/lib/c/include/ipc/dev_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_IPC_DEV_IFACE_H_
-#define _LIBC_IPC_DEV_IFACE_H_
-
-#include <stdlib.h>
-#include <types/common.h>
-
-typedef enum {
-	HW_RES_DEV_IFACE = 0,
-	PIO_WINDOW_DEV_IFACE,
-
-	/** Character device interface */
-	CHAR_DEV_IFACE,
-
-	/** Audio device mixer interface */
-	AUDIO_MIXER_IFACE,
-	/** Audio device pcm buffer interface */
-	AUDIO_PCM_BUFFER_IFACE,
-
-	/** Network interface controller interface */
-	NIC_DEV_IFACE,
-
-	/** IEEE 802.11 interface controller interface */
-	IEEE80211_DEV_IFACE,
-
-	/** Interface provided by any PCI device. */
-	PCI_DEV_IFACE,
-
-	/** Interface provided by any USB device. */
-	USB_DEV_IFACE,
-	/** Interface provided by USB diagnostic devices. */
-	USBDIAG_DEV_IFACE,
-	/** Interface provided by USB host controller to USB device. */
-	USBHC_DEV_IFACE,
-	/** Interface provided by USB HID devices. */
-	USBHID_DEV_IFACE,
-
-	/** Interface provided by Real Time Clock devices */
-	CLOCK_DEV_IFACE,
-
-	/** Interface provided by LED devices */
-	LED_DEV_IFACE,
-
-	/** Interface provided by battery powered devices */
-	BATTERY_DEV_IFACE,
-
-	/** Interface provided by AHCI devices. */
-	AHCI_DEV_IFACE,
-
-	DEV_IFACE_MAX
-} dev_inferface_idx_t;
-
-#define DEV_IFACE_ID(idx)	((idx) + IPC_FIRST_USER_METHOD)
-#define DEV_IFACE_IDX(id)	((id) - IPC_FIRST_USER_METHOD)
-
-#define DEV_IFACE_COUNT			DEV_IFACE_MAX
-#define DEV_FIRST_CUSTOM_METHOD_IDX	DEV_IFACE_MAX
-#define DEV_FIRST_CUSTOM_METHOD \
-	DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX)
-
-/*
- * The first argument is actually method (as the "real" method is used
- * for indexing into interfaces.
- */
-
-#define DEV_IPC_GET_ARG1(call) ipc_get_arg2(&(call))
-#define DEV_IPC_GET_ARG2(call) ipc_get_arg3(&(call))
-#define DEV_IPC_GET_ARG3(call) ipc_get_arg4(&(call))
-#define DEV_IPC_GET_ARG4(call) ipc_get_arg5(&(call))
-
-#endif
Index: pace/lib/c/include/ipc/event.h
===================================================================
--- uspace/lib/c/include/ipc/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_EVENT_H_
-#define _LIBC_IPC_EVENT_H_
-
-#include <abi/ipc/event.h>
-#include <types/common.h>
-
-extern errno_t ipc_event_subscribe(event_type_t, sysarg_t);
-extern errno_t ipc_event_task_subscribe(event_task_type_t, sysarg_t);
-extern errno_t ipc_event_unsubscribe(event_type_t);
-extern errno_t ipc_event_task_unsubscribe(event_task_type_t);
-extern errno_t ipc_event_unmask(event_type_t);
-extern errno_t ipc_event_task_unmask(event_task_type_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/ipc.h
===================================================================
--- uspace/lib/c/include/ipc/ipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#if ((defined(_LIBC_ASYNC_H_)) && (!defined(_LIBC_ASYNC_C_)))
-#error Do not intermix low-level IPC interface and async framework
-#endif
-
-#ifndef _LIBC_IPC_H_
-#define _LIBC_IPC_H_
-
-#include <ipc/common.h>
-#include <abi/ipc/methods.h>
-#include <abi/synch.h>
-#include <abi/proc/task.h>
-#include <abi/cap.h>
-
-extern errno_t ipc_wait(ipc_call_t *, sysarg_t, unsigned int);
-extern void ipc_poke(void);
-
-/*
- * User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow().
- * They are in the form of ipc_answer_m(), where m is the number of return
- * arguments. The macros decide between the fast and the slow version according
- * to m.
- */
-
-#define ipc_answer_0(chandle, retval) \
-	ipc_answer_fast((chandle), (retval), 0, 0, 0, 0)
-#define ipc_answer_1(chandle, retval, arg1) \
-	ipc_answer_fast((chandle), (retval), (arg1), 0, 0, 0)
-#define ipc_answer_2(chandle, retval, arg1, arg2) \
-	ipc_answer_fast((chandle), (retval), (arg1), (arg2), 0, 0)
-#define ipc_answer_3(chandle, retval, arg1, arg2, arg3) \
-	ipc_answer_fast((chandle), (retval), (arg1), (arg2), (arg3), 0)
-#define ipc_answer_4(chandle, retval, arg1, arg2, arg3, arg4) \
-	ipc_answer_fast((chandle), (retval), (arg1), (arg2), (arg3), (arg4))
-#define ipc_answer_5(chandle, retval, arg1, arg2, arg3, arg4, arg5) \
-	ipc_answer_slow((chandle), (retval), (arg1), (arg2), (arg3), (arg4), \
-	    (arg5))
-
-extern errno_t ipc_answer_fast(cap_call_handle_t, errno_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t);
-extern errno_t ipc_answer_slow(cap_call_handle_t, errno_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t);
-
-/*
- * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
- * They are in the form of ipc_call_async_m(), where m is the number of payload
- * arguments. The macros decide between the fast and the slow version according
- * to m.
- */
-
-#define ipc_call_async_0(phandle, method, label) \
-	ipc_call_async_fast((phandle), (method), 0, 0, 0, (label))
-#define ipc_call_async_1(phandle, method, arg1, label) \
-	ipc_call_async_fast((phandle), (method), (arg1), 0, 0, (label))
-#define ipc_call_async_2(phandle, method, arg1, arg2, label) \
-	ipc_call_async_fast((phandle), (method), (arg1), (arg2), 0, (label))
-#define ipc_call_async_3(phandle, method, arg1, arg2, arg3, label) \
-	ipc_call_async_fast((phandle), (method), (arg1), (arg2), (arg3), \
-	    (label))
-#define ipc_call_async_4(phandle, method, arg1, arg2, arg3, arg4, label) \
-	ipc_call_async_slow((phandle), (method), (arg1), (arg2), (arg3), \
-	    (arg4), 0, (label))
-#define ipc_call_async_5(phandle, method, arg1, arg2, arg3, arg4, arg5, \
-    label) \
-	ipc_call_async_slow((phandle), (method), (arg1), (arg2), (arg3), \
-	    (arg4), (arg5), (label))
-
-extern errno_t ipc_call_async_fast(cap_phone_handle_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, void *);
-extern errno_t ipc_call_async_slow(cap_phone_handle_t, sysarg_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t, void *);
-
-extern errno_t ipc_hangup(cap_phone_handle_t);
-
-extern errno_t ipc_forward_fast(cap_call_handle_t, cap_phone_handle_t, sysarg_t,
-    sysarg_t, sysarg_t, unsigned int);
-extern errno_t ipc_forward_slow(cap_call_handle_t, cap_phone_handle_t, sysarg_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t, sysarg_t, unsigned int);
-
-extern errno_t ipc_connect_kbox(task_id_t, cap_phone_handle_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/irq.h
===================================================================
--- uspace/lib/c/include/ipc/irq.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_IRQ_H_
-#define _LIBC_IPC_IRQ_H_
-
-#include <types/common.h>
-#include <abi/ddi/irq.h>
-#include <abi/cap.h>
-
-extern errno_t ipc_irq_subscribe(int, sysarg_t, const irq_code_t *,
-    cap_irq_handle_t *);
-extern errno_t ipc_irq_unsubscribe(cap_irq_handle_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/loader.h
===================================================================
--- uspace/lib/c/include/ipc/loader.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_LOADER_H_
-#define _LIBC_IPC_LOADER_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	LOADER_HELLO = IPC_FIRST_USER_METHOD,
-	LOADER_GET_TASKID,
-	LOADER_SET_CWD,
-	LOADER_SET_PROGRAM,
-	LOADER_SET_ARGS,
-	LOADER_ADD_INBOX,
-	LOADER_LOAD,
-	LOADER_RUN
-} loader_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/loc.h
===================================================================
--- uspace/lib/c/include/ipc/loc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2007 Josef Cejka
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#ifndef _LIBC_IPC_LOC_H_
-#define _LIBC_IPC_LOC_H_
-
-#include <ipc/common.h>
-
-#define LOC_NAME_MAXLEN  255
-
-typedef sysarg_t service_id_t;
-typedef sysarg_t category_id_t;
-
-typedef enum {
-	LOC_OBJECT_NONE,
-	LOC_OBJECT_NAMESPACE,
-	LOC_OBJECT_SERVICE
-} loc_object_type_t;
-
-typedef enum {
-	LOC_SERVER_REGISTER = IPC_FIRST_USER_METHOD,
-	LOC_SERVER_UNREGISTER,
-	LOC_SERVICE_ADD_TO_CAT,
-	LOC_SERVICE_REGISTER,
-	LOC_SERVICE_UNREGISTER,
-	LOC_SERVICE_GET_ID,
-	LOC_SERVICE_GET_NAME,
-	LOC_SERVICE_GET_SERVER_NAME,
-	LOC_NAMESPACE_GET_ID,
-	LOC_CALLBACK_CREATE,
-	LOC_CATEGORY_GET_ID,
-	LOC_CATEGORY_GET_NAME,
-	LOC_CATEGORY_GET_SVCS,
-	LOC_ID_PROBE,
-	LOC_NULL_CREATE,
-	LOC_NULL_DESTROY,
-	LOC_GET_NAMESPACE_COUNT,
-	LOC_GET_SERVICE_COUNT,
-	LOC_GET_CATEGORIES,
-	LOC_GET_NAMESPACES,
-	LOC_GET_SERVICES
-} loc_request_t;
-
-typedef enum {
-	LOC_EVENT_CAT_CHANGE = IPC_FIRST_USER_METHOD
-} loc_event_t;
-
-typedef struct {
-	service_id_t id;
-	char name[LOC_NAME_MAXLEN + 1];
-} loc_sdesc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/logger.h
===================================================================
--- uspace/lib/c/include/ipc/logger.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#ifndef _LIBC_IPC_LOGGER_H_
-#define _LIBC_IPC_LOGGER_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	/** Set (global) default displayed logging level.
-	 *
-	 * Arguments: new log level.
-	 * Returns: error code
-	 */
-	LOGGER_CONTROL_SET_DEFAULT_LEVEL = IPC_FIRST_USER_METHOD,
-	/** Set displayed level for given log.
-	 *
-	 * Arguments: new log level.
-	 * Returns: error code
-	 * Followed by: string with full log name.
-	 */
-	LOGGER_CONTROL_SET_LOG_LEVEL,
-	/** Set VFS root.
-	 *
-	 * Returns: error code
-	 * Followed by: vfs_pass_handle() request.
-	 */
-	LOGGER_CONTROL_SET_ROOT
-} logger_control_request_t;
-
-typedef enum {
-	/** Create new log.
-	 *
-	 * Arguments: parent log id (0 for top-level log).
-	 * Returns: error code, log id
-	 * Followed by: string with log name.
-	 */
-	LOGGER_WRITER_CREATE_LOG = IPC_FIRST_USER_METHOD,
-	/** Write a message to a given log.
-	 *
-	 * Arguments: log id, message severity level (log_level_t)
-	 * Returns: error code
-	 * Followed by: string with the message.
-	 */
-	LOGGER_WRITER_MESSAGE
-} logger_writer_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/ns.h
===================================================================
--- uspace/lib/c/include/ipc/ns.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_NS_H_
-#define _LIBC_IPC_NS_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	NS_PING = IPC_FIRST_USER_METHOD,
-	NS_REGISTER,
-	NS_REGISTER_BROKER,
-	NS_TASK_WAIT,
-	NS_ID_INTRO,
-	NS_RETVAL
-} ns_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/services.h
===================================================================
--- uspace/lib/c/include/ipc/services.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/**
- * @file  services.h
- * @brief List of all known services and their codes.
- */
-
-#ifndef _LIBC_SERVICES_H_
-#define _LIBC_SERVICES_H_
-
-#include <abi/fourcc.h>
-
-typedef enum {
-	SERVICE_NONE       = 0,
-	SERVICE_LOADER     = FOURCC('l', 'o', 'a', 'd'),
-	SERVICE_VFS        = FOURCC('v', 'f', 's', ' '),
-	SERVICE_LOC        = FOURCC('l', 'o', 'c', ' '),
-	SERVICE_LOGGER     = FOURCC('l', 'o', 'g', 'g'),
-	SERVICE_DEVMAN     = FOURCC('d', 'e', 'v', 'n'),
-} service_t;
-
-#define SERVICE_NAME_CHARDEV_TEST_SMALLX "chardev-test/smallx"
-#define SERVICE_NAME_CHARDEV_TEST_LARGEX "chardev-test/largex"
-#define SERVICE_NAME_CHARDEV_TEST_PARTIALX "chardev-test/partialx"
-#define SERVICE_NAME_CLIPBOARD "clipboard"
-#define SERVICE_NAME_CORECFG  "corecfg"
-#define SERVICE_NAME_DISPCFG  "hid/display"
-#define SERVICE_NAME_DISPLAY  "hid/display"
-#define SERVICE_NAME_WNDMGT   "hid/display"
-#define SERVICE_NAME_DHCP     "net/dhcp"
-#define SERVICE_NAME_DNSR     "net/dnsr"
-#define SERVICE_NAME_INET     "net/inet"
-#define SERVICE_NAME_IPC_TEST "ipc-test"
-#define SERVICE_NAME_NETCONF  "net/netconf"
-#define SERVICE_NAME_UDP      "net/udp"
-#define SERVICE_NAME_TCP      "net/tcp"
-#define SERVICE_NAME_VBD      "vbd"
-#define SERVICE_NAME_VOLSRV   "volsrv"
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ipc/vfs.h
===================================================================
--- uspace/lib/c/include/ipc/vfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_IPC_VFS_H_
-#define _LIBC_IPC_VFS_H_
-
-#include <ipc/common.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#define FS_NAME_MAXLEN  20
-#define FS_LABEL_MAXLEN 256
-#define FS_VUID_MAXLEN 128
-#define MAX_PATH_LEN    (32 * 1024)
-#define MAX_MNTOPTS_LEN 256
-#define PLB_SIZE        (2 * MAX_PATH_LEN)
-
-/* Basic types. */
-typedef int16_t fs_handle_t;
-typedef uint32_t fs_index_t;
-
-/**
- * A structure like this is passed to VFS by each individual FS upon its
- * registration. It assosiates a human-readable identifier with each
- * registered FS.
- */
-typedef struct {
-	/** Unique identifier of the fs. */
-	char name[FS_NAME_MAXLEN + 1];
-	unsigned int instance;
-	bool concurrent_read_write;
-	bool write_retains_size;
-} vfs_info_t;
-
-/** Data returned by filesystem probe regarding a specific volume. */
-typedef struct {
-	char label[FS_LABEL_MAXLEN + 1];
-	char vuid[FS_VUID_MAXLEN + 1];
-} vfs_fs_probe_info_t;
-
-typedef enum {
-	VFS_IN_CLONE = IPC_FIRST_USER_METHOD,
-	VFS_IN_FSPROBE,
-	VFS_IN_FSTYPES,
-	VFS_IN_MOUNT,
-	VFS_IN_OPEN,
-	VFS_IN_PUT,
-	VFS_IN_READ,
-	VFS_IN_REGISTER,
-	VFS_IN_RENAME,
-	VFS_IN_RESIZE,
-	VFS_IN_STAT,
-	VFS_IN_STATFS,
-	VFS_IN_SYNC,
-	VFS_IN_UNLINK,
-	VFS_IN_UNMOUNT,
-	VFS_IN_WAIT_HANDLE,
-	VFS_IN_WALK,
-	VFS_IN_WRITE,
-} vfs_in_request_t;
-
-typedef enum {
-	VFS_OUT_CLOSE = IPC_FIRST_USER_METHOD,
-	VFS_OUT_DESTROY,
-	VFS_OUT_FSPROBE,
-	VFS_OUT_IS_EMPTY,
-	VFS_OUT_LINK,
-	VFS_OUT_LOOKUP,
-	VFS_OUT_MOUNTED,
-	VFS_OUT_OPEN_NODE,
-	VFS_OUT_READ,
-	VFS_OUT_STAT,
-	VFS_OUT_STATFS,
-	VFS_OUT_SYNC,
-	VFS_OUT_TRUNCATE,
-	VFS_OUT_UNMOUNTED,
-	VFS_OUT_WRITE,
-	VFS_OUT_LAST
-} vfs_out_request_t;
-
-/*
- * Lookup flags.
- */
-
-/**
- * No lookup flags used.
- */
-#define L_NONE			0
-
-/**
- * Lookup will succeed only if the object is a regular file.  If L_CREATE is
- * specified, an empty file will be created. This flag is mutually exclusive
- * with L_DIRECTORY.
- */
-#define L_FILE			1
-
-/**
- * Lookup will succeed only if the object is a directory. If L_CREATE is
- * specified, an empty directory will be created. This flag is mutually
- * exclusive with L_FILE.
- */
-#define L_DIRECTORY		2
-
-/**
- * Lookup will not cross any mount points.
- * If the lookup would have to cross a mount point, it returns EXDEV instead.
- */
-#define L_DISABLE_MOUNTS	4
-
-/**
- * Lookup will succeed only if the object is a mount point. The flag is mutually
- * exclusive with L_FILE.
- */
-#define L_MP			8
-
-/**
- * When used with L_CREATE, L_EXCLUSIVE will cause the lookup to fail if the
- * object already exists. L_EXCLUSIVE is implied when L_DIRECTORY is used.
- */
-#define L_EXCLUSIVE 		16
-
-/**
- * L_CREATE is used for creating both regular files and directories.
- */
-#define L_CREATE		32
-
-/**
- * L_UNLINK is used to remove leaves from the file system namespace. This flag
- * cannot be passed directly by the client, but will be set by VFS during
- * VFS_UNLINK.
- */
-#define L_UNLINK		64
-
-/*
- * Walk flags.
- */
-enum {
-	WALK_MAY_CREATE = (1 << 0),
-	WALK_MUST_CREATE = (1 << 1),
-
-	WALK_REGULAR = (1 << 2),
-	WALK_DIRECTORY = (1 << 3),
-	WALK_MOUNT_POINT = (1 << 4),
-
-	WALK_ALL_FLAGS = WALK_MAY_CREATE | WALK_MUST_CREATE | WALK_REGULAR |
-	    WALK_DIRECTORY | WALK_MOUNT_POINT,
-};
-
-enum {
-	VFS_MOUNT_BLOCKING = 1,
-	VFS_MOUNT_CONNECT_ONLY = 2,
-	VFS_MOUNT_NO_REF = 4,
-};
-
-enum {
-	MODE_READ = 1,
-	MODE_WRITE = 2,
-	MODE_APPEND = 4,
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/l18n/langs.h
===================================================================
--- uspace/lib/c/include/l18n/langs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2005 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * Language and locale ids.
- */
-
-#ifndef _LIBC_L18N_LANGS_H_
-#define _LIBC_L18N_LANGS_H_
-
-/** Windows locale IDs.
- * Codes taken from
- * Developing International Software For Windows 95 and Windows NT
- * by Nadine Kano (Microsoft Press).
- * FIXME: add missing codes.
- */
-typedef enum {
-	L18N_WIN_LOCALE_AFRIKAANS = 0x0436,
-	/* ... */
-	L18N_WIN_LOCALE_CZECH = 0x0405,
-	/* ... */
-	L18N_WIN_LOCALE_ENGLISH_UNITED_STATES = 0x0409,
-	/* ... */
-	L18N_WIN_LOCALE_SLOVAK = 0x041B,
-	/* ... */
-	L18N_WIN_LOCALE_SPANISH_TRADITIONAL = 0x040A,
-	/* ... */
-	L18N_WIN_LOCALE_ZULU = 0x0435,
-	L18N_WIN_LOCALE_MAX = 0xFFFF
-} l18_win_locales_t;
-
-const char *str_l18_win_locale(l18_win_locales_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/libc.h
===================================================================
--- uspace/lib/c/include/libc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_LIBC_H_
-#define _LIBC_LIBC_H_
-
-#include <stdint.h>
-#include <abi/syscall.h>
-#include <libarch/syscall.h>
-
-#ifdef __32_BITS__
-
-/** Explicit 64-bit arguments passed to syscalls. */
-typedef uint64_t sysarg64_t;
-
-#endif /* __32_BITS__ */
-
-#define __SYSCALL0(id) \
-	__syscall0(0, 0, 0, 0, 0, 0, id)
-#define __SYSCALL1(id, p1) \
-	__syscall1(p1, 0, 0, 0, 0, 0, id)
-#define __SYSCALL2(id, p1, p2) \
-	__syscall2(p1, p2, 0, 0, 0, 0, id)
-#define __SYSCALL3(id, p1, p2, p3) \
-	__syscall3(p1, p2, p3, 0, 0, 0, id)
-#define __SYSCALL4(id, p1, p2, p3, p4) \
-	__syscall4(p1, p2, p3, p4, 0, 0, id)
-#define __SYSCALL5(id, p1, p2, p3, p4, p5) \
-	__syscall5(p1, p2, p3, p4, p5, 0, id)
-#define __SYSCALL6(id, p1, p2, p3, p4, p5, p6) \
-	__syscall6(p1, p2, p3, p4, p5, p6, id)
-
-extern void __libc_fini(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/loader/loader.h
===================================================================
--- uspace/lib/c/include/loader/loader.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * @brief Program loader interface.
- */
-
-#ifndef _LIBC_LOADER_H_
-#define _LIBC_LOADER_H_
-
-#include <abi/proc/task.h>
-
-/** Forward declararion */
-struct loader;
-typedef struct loader loader_t;
-
-extern errno_t loader_spawn(const char *);
-extern loader_t *loader_connect(errno_t *);
-extern errno_t loader_get_task_id(loader_t *, task_id_t *);
-extern errno_t loader_set_cwd(loader_t *);
-extern errno_t loader_set_program(loader_t *, const char *, int);
-extern errno_t loader_set_program_path(loader_t *, const char *);
-extern errno_t loader_set_args(loader_t *, const char *const[]);
-extern errno_t loader_add_inbox(loader_t *, const char *, int);
-extern errno_t loader_load_program(loader_t *);
-extern errno_t loader_run(loader_t *);
-extern void loader_run_nowait(loader_t *);
-extern void loader_abort(loader_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/c/include/loader/pcb.h
===================================================================
--- uspace/lib/c/include/loader/pcb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * @brief Program Control Block interface.
- */
-
-#ifndef _LIBC_PCB_H_
-#define _LIBC_PCB_H_
-
-#include <tls.h>
-
-typedef void (*entry_point_t)(void);
-
-struct pcb_inbox_entry {
-	char *name;
-	int file;
-};
-
-/** Program Control Block.
- *
- * Holds pointers to data passed from the program loader to the program
- * and/or to the dynamic linker. This includes the program entry point,
- * arguments, environment variables etc.
- *
- */
-typedef struct {
-	/** Program entry point. */
-	entry_point_t entry;
-
-	/** Current working directory. */
-	char *cwd;
-
-	/** Number of command-line arguments. */
-	int argc;
-	/** Command-line arguments. */
-	char **argv;
-
-	/** List of inbox files. */
-	struct pcb_inbox_entry *inbox;
-	int inbox_entries;
-
-	/*
-	 * ELF-specific data.
-	 */
-
-	/** Pointer to ELF dynamic section of the program. */
-	void *dynamic;
-	/** Pointer to dynamic linker state structure (rtld_t). */
-	void *rtld_runtime;
-
-	/** Thread local storage for the main thread. */
-	tcb_t *tcb;
-} pcb_t;
-
-/**
- * A pointer to the program control block. Having received the PCB pointer,
- * the C library startup code stores it here for later use.
- */
-extern pcb_t *__pcb;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/c/include/loc.h
===================================================================
--- uspace/lib/c/include/loc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_LOC_H_
-#define _LIBC_LOC_H_
-
-#include <ipc/loc.h>
-#include <async.h>
-#include <stdbool.h>
-#include <types/loc.h>
-
-typedef void (*loc_cat_change_cb_t)(void *);
-
-extern async_exch_t *loc_exchange_begin_blocking(void);
-extern async_exch_t *loc_exchange_begin(void);
-extern void loc_exchange_end(async_exch_t *);
-
-extern errno_t loc_server_register(const char *, loc_srv_t **);
-extern void loc_server_unregister(loc_srv_t *);
-extern errno_t loc_service_register(loc_srv_t *, const char *, service_id_t *);
-extern errno_t loc_service_unregister(loc_srv_t *, service_id_t);
-extern errno_t loc_service_add_to_cat(loc_srv_t *, service_id_t, category_id_t);
-
-extern errno_t loc_service_get_id(const char *, service_id_t *,
-    unsigned int);
-extern errno_t loc_service_get_name(service_id_t, char **);
-extern errno_t loc_service_get_server_name(service_id_t, char **);
-extern errno_t loc_namespace_get_id(const char *, service_id_t *,
-    unsigned int);
-extern errno_t loc_category_get_id(const char *, category_id_t *,
-    unsigned int);
-extern errno_t loc_category_get_name(category_id_t, char **);
-extern errno_t loc_category_get_svcs(category_id_t, category_id_t **, size_t *);
-extern loc_object_type_t loc_id_probe(service_id_t);
-
-extern async_sess_t *loc_service_connect(service_id_t, iface_t,
-    unsigned int);
-
-extern int loc_null_create(void);
-extern void loc_null_destroy(int);
-
-extern size_t loc_count_namespaces(void);
-extern size_t loc_count_services(service_id_t);
-
-extern size_t loc_get_namespaces(loc_sdesc_t **);
-extern size_t loc_get_services(service_id_t, loc_sdesc_t **);
-extern errno_t loc_get_categories(category_id_t **, size_t *);
-extern errno_t loc_register_cat_change_cb(loc_cat_change_cb_t, void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/macros.h
===================================================================
--- uspace/lib/c/include/macros.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_MACROS_H_
-#define _LIBC_MACROS_H_
-
-#define min(a, b)  ((a) < (b) ? (a) : (b))
-#define max(a, b)  ((a) > (b) ? (a) : (b))
-#define mabs(a)    ((a) >= 0 ? (a) : -(a))
-
-#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
-
-#define KiB2SIZE(kb)  ((kb) << 10)
-#define MiB2SIZE(mb)  ((mb) << 20)
-
-#define STRING(arg)      STRING_ARG(arg)
-#define STRING_ARG(arg)  #arg
-
-#define LOWER32(arg)  (((uint64_t) (arg)) & 0xffffffff)
-#define UPPER32(arg)  (((((uint64_t) arg)) >> 32) & 0xffffffff)
-
-#define MERGE_LOUP32(lo, up) \
-	((((uint64_t) (lo)) & 0xffffffff) \
-	    | ((((uint64_t) (up)) & 0xffffffff) << 32))
-
-#define _paddname(line)     PADD_ ## line ## __
-#define _padd(width, line, n)  uint ## width ## _t _paddname(line) [n]
-
-#define PADD32(n)  _padd(32, __LINE__, n)
-#define PADD16(n)  _padd(16, __LINE__, n)
-#define PADD8(n)   _padd(8, __LINE__, n)
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/malloc.h
===================================================================
--- uspace/lib/c/include/malloc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_MALLOC_H_
-#define _LIBC_MALLOC_H_
-
-#include <stddef.h>
-#include <_bits/decls.h>
-
-#ifdef _HELENOS_SOURCE
-__HELENOS_DECLS_BEGIN;
-
-extern void *heap_check(void);
-
-__HELENOS_DECLS_END;
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/math.h
===================================================================
--- uspace/lib/c/include/math.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,324 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MATH_H
-#define _MATH_H
-
-#include <limits.h>
-#include <stddef.h>
-#include <float.h>
-
-#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_HELENOS_SOURCE)
-
-#define M_E         2.7182818284590452354
-#define M_LOG2E     1.4426950408889634074
-#define M_LOG10E    0.43429448190325182765
-#define M_LN2       0.69314718055994530942
-#define M_LN10      2.30258509299404568402
-#define M_PI        3.14159265358979323846
-#define M_PI_2      1.57079632679489661923
-#define M_PI_4      0.78539816339744830962
-#define M_1_PI      0.31830988618379067154
-#define M_2_PI      0.63661977236758134308
-#define M_2_SQRTPI  1.12837916709551257390
-#define M_SQRT2     1.41421356237309504880
-#define M_SQRT1_2   0.70710678118654752440
-
-/* GNU extensions, but GCC emits calls to them as an optimization. */
-void sincos(double, double *, double *);
-void sincosf(float, float *, float *);
-void sincosl(long double, long double *, long double *);
-
-#endif
-
-#if FLT_EVAL_METHOD == 0
-typedef float float_t;
-typedef double double_t;
-#elif FLT_EVAL_METHOD == 1
-typedef double float_t;
-typedef double double_t;
-#elif FLT_EVAL_METHOD == 2
-typedef long double float_t;
-typedef long double double_t;
-#else
-#error Unknown FLT_EVAL_METHOD value.
-#endif
-
-#define FP_ILOGB0    INT_MIN
-#define FP_ILOGBNAN  INT_MAX
-
-#define FP_NAN        0
-#define FP_INFINITE   1
-#define FP_NORMAL     2
-#define FP_SUBNORMAL  3
-#define FP_ZERO       4
-
-int __fpclassify(size_t, ...);
-int __signbit(size_t, ...);
-int __fcompare(size_t, size_t, ...);
-
-#define __FCOMPARE_EQUAL    1
-#define __FCOMPARE_LESS     2
-#define __FCOMPARE_GREATER  4
-
-#if defined(__GNUC__) || defined(__clang__)
-
-#define HUGE_VALF  __builtin_huge_valf()
-#define HUGE_VAL   __builtin_huge_val()
-#define HUGE_VALL  __builtin_huge_vall()
-#define INFINITY   __builtin_inff()
-#define NAN        __builtin_nan("")
-
-#define fpclassify(x)  __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))
-#define isfinite(x)    __builtin_isfinite(x)
-#define isinf(x)       __builtin_isinf(x)
-#define isnan(x)       __builtin_isnan(x)
-#define isnormal(x)    __builtin_isnormal(x)
-#define signbit(x)     __builtin_signbit(x)
-
-#define isgreater(x, y)      __builtin_isgreater(x, y)
-#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y)
-#define isless(x, y)         __builtin_isless(x, y)
-#define islessequal(x, y)    __builtin_islessequal(x, y)
-#define islessgreater(x, y)  __builtin_islessgreater(x, y)
-#define isunordered(x, y)    __builtin_isunordered(x, y)
-
-#else  /* defined(__GNUC__) || defined(__clang__) */
-
-#define HUGE_VALF  (1.0f / 0.0f)
-#define HUGE_VAL   (1.0 / 0.0)
-#define HUGE_VALL  (1.0l / 0.0l)
-#define INFINITY   (1.0f / 0.0f)
-#define NAN        (0.0 / 0.0)
-
-#define fpclassify(x)  __fpclassify(sizeof(x), (x))
-#define isfinite(x)    (fpclassify(x) > FP_INFINITE)
-#define isinf(x)       (fpclassify(x) == FP_INFINITE)
-#define isnan(x)       (fpclassify(x) == FP_NAN)
-#define isnormal(x)    (fpclassify(x) == FP_NORMAL)
-#define signbit(x)     __signbit(sizeof(x), (x))
-
-#define isgreater(x, y)      (!!(__fcompare(sizeof(x), sizeof(y), (x), (y)) & __FCOMPARE_GREATER))
-#define isgreaterequal(x, y) (!!(__fcompare(sizeof(x), sizeof(y), (x), (y)) & (__FCOMPARE_GREATER | __FCOMPARE_EQUAL))))
-#define isless(x, y)         (!!(__fcompare(sizeof(x), sizeof(y), (x), (y)) & __FCOMPARE_LESS))
-#define islessequal(x, y)    (!!(__fcompare(sizeof(x), sizeof(y), (x), (y)) & (__FCOMPARE_LESS | __FCOMPARE_EQUAL)))
-#define islessgreater(x, y)  (!!(__fcompare(sizeof(x), sizeof(y), (x), (y)) & (__FCOMPARE_LESS | __FCOMPARE_GREATER)))
-#define isunordered(x, y)    (!__fcompare(sizeof(x), sizeof(y), (x), (y)))
-
-#endif  /* defined(__GNUC__) || defined(__clang__) */
-
-#define MATH_ERRNO      1
-#define MATH_ERREXCEPT  2
-
-#define math_errhandling MATH_ERRNO
-
-double acos(double);
-float acosf(float);
-long double acosl(long double);
-double asin(double);
-float asinf(float);
-long double asinl(long double);
-double atan(double);
-float atanf(float);
-long double atanl(long double);
-double atan2(double, double);
-float atan2f(float, float);
-long double atan2l(long double, long double);
-double cos(double);
-float cosf(float);
-long double cosl(long double);
-double sin(double);
-float sinf(float);
-long double sinl(long double);
-double tan(double);
-float tanf(float);
-long double tanl(long double);
-double acosh(double);
-float acoshf(float);
-long double acoshl(long double);
-double asinh(double);
-float asinhf(float);
-long double asinhl(long double);
-double atanh(double);
-float atanhf(float);
-long double atanhl(long double);
-double cosh(double);
-float coshf(float);
-long double coshl(long double);
-double sinh(double);
-float sinhf(float);
-long double sinhl(long double);
-double tanh(double);
-float tanhf(float);
-long double tanhl(long double);
-double exp(double);
-float expf(float);
-long double expl(long double);
-double exp2(double);
-float exp2f(float);
-long double exp2l(long double);
-double expm1(double);
-float expm1f(float);
-long double expm1l(long double);
-double frexp(double, int *);
-float frexpf(float, int *);
-long double frexpl(long double, int *);
-int ilogb(double);
-int ilogbf(float);
-int ilogbl(long double);
-double ldexp(double, int);
-float ldexpf(float, int);
-long double ldexpl(long double, int);
-double log(double);
-float logf(float);
-long double logl(long double);
-double log10(double);
-float log10f(float);
-long double log10l(long double);
-double log1p(double);
-float log1pf(float);
-long double log1pl(long double);
-double log2(double);
-float log2f(float);
-long double log2l(long double);
-double logb(double);
-float logbf(float);
-long double logbl(long double);
-double modf(double value, double *);
-float modff(float value, float *);
-long double modfl(long double, long double *);
-double scalbn(double, int);
-float scalbnf(float, int);
-long double scalbnl(long double, int);
-double scalbln(double, long int);
-float scalblnf(float, long int);
-long double scalblnl(long double, long int);
-double cbrt(double);
-float cbrtf(float);
-long double cbrtl(long double);
-double fabs(double);
-float fabsf(float);
-long double fabsl(long double);
-double hypot(double, double);
-float hypotf(float, float);
-long double hypotl(long double, long double);
-double pow(double, double);
-float powf(float, float);
-long double powl(long double, long double);
-double sqrt(double);
-float sqrtf(float);
-long double sqrtl(long double);
-double erf(double);
-float erff(float);
-long double erfl(long double);
-double erfc(double);
-float erfcf(float);
-long double erfcl(long double);
-double lgamma(double);
-float lgammaf(float);
-long double lgammal(long double);
-double tgamma(double);
-float tgammaf(float);
-long double tgammal(long double);
-double ceil(double);
-float ceilf(float);
-long double ceill(long double);
-double floor(double);
-float floorf(float);
-long double floorl(long double);
-double nearbyint(double);
-float nearbyintf(float);
-long double nearbyintl(long double);
-double rint(double);
-float rintf(float);
-long double rintl(long double);
-long int lrint(double);
-long int lrintf(float);
-long int lrintl(long double);
-long long int llrint(double);
-long long int llrintf(float);
-long long int llrintl(long double);
-double round(double);
-float roundf(float);
-long double roundl(long double);
-long int lround(double);
-long int lroundf(float);
-long int lroundl(long double);
-long long int llround(double);
-long long int llroundf(float);
-long long int llroundl(long double);
-double trunc(double);
-float truncf(float);
-long double truncl(long double);
-double fmod(double, double);
-float fmodf(float, float);
-long double fmodl(long double, long double);
-double remainder(double, double);
-float remainderf(float, float);
-long double remainderl(long double, long double);
-double remquo(double, double, int *);
-float remquof(float, float, int *);
-long double remquol(long double, long double, int *);
-double copysign(double, double);
-float copysignf(float, float);
-long double copysignl(long double, long double);
-double nan(const char *);
-float nanf(const char *);
-long double nanl(const char *);
-double nextafter(double, double);
-float nextafterf(float, float);
-long double nextafterl(long double, long double);
-double nexttoward(double, long double);
-float nexttowardf(float, long double);
-long double nexttowardl(long double, long double);
-double fdim(double, double);
-float fdimf(float, float);
-long double fdiml(long double, long double);
-double fmax(double, double);
-float fmaxf(float, float);
-long double fmaxl(long double, long double);
-double fmin(double, double);
-float fminf(float, float);
-long double fminl(long double, long double);
-double fma(double, double, double);
-float fmaf(float, float, float);
-long double fmal(long double, long double, long double);
-
-#if defined(__GNUC__) || defined(__clang__)
-
-#define copysign __builtin_copysign
-#define copysignf __builtin_copysignf
-#define copysignl __builtin_copysignl
-
-#define nextafter __builtin_nextafter
-#define nextafterf __builtin_nextafterf
-#define nextafterl __builtin_nextafterl
-
-#endif
-
-#endif /* _MATH_H */
Index: pace/lib/c/include/member.h
===================================================================
--- uspace/lib/c/include/member.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2021 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_MEMBER_H_
-#define _LIBC_MEMBER_H_
-
-#include <stdint.h>
-
-#define member_to_inst(ptr_member, type, member_identif) \
-	((type *) (((uintptr_t) (ptr_member)) - \
-	    offsetof(type, member_identif)))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/ns.h
===================================================================
--- uspace/lib/c/include/ns.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_NS_H_
-#define _LIBC_NS_H_
-
-#include <ipc/services.h>
-#include <task.h>
-#include <async.h>
-
-extern errno_t service_register(service_t, iface_t, async_port_handler_t,
-    void *);
-extern errno_t service_register_broker(service_t, async_port_handler_t, void *);
-extern async_sess_t *service_connect(service_t, iface_t, sysarg_t, errno_t *);
-extern async_sess_t *service_connect_blocking(service_t, iface_t, sysarg_t,
-    errno_t *);
-
-extern errno_t ns_ping(void);
-extern errno_t ns_intro(task_id_t);
-extern async_sess_t *ns_session_get(errno_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/offset.h
===================================================================
--- uspace/lib/c/include/offset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_OFFSET_H_
-#define _LIBC_OFFSET_H_
-
-#ifndef _HELENOS_SOURCE
-#error This file should only be included from HelenOS sources
-#endif
-
-#include <stdint.h>
-#include <_bits/decls.h>
-#include <_bits/off64_t.h>
-
-/* off64_t */
-#define OFF64_MIN  INT64_MIN
-#define OFF64_MAX  INT64_MAX
-
-/* aoff64_t */
-#define AOFF64_MIN  UINT64_MIN
-#define AOFF64_MAX  UINT64_MAX
-
-/* off64_t, aoff64_t */
-#define PRIdOFF64 PRId64
-#define PRIuOFF64 PRIu64
-#define PRIxOFF64 PRIx64
-#define PRIXOFF64 PRIX64
-
-__HELENOS_DECLS_BEGIN;
-
-/** Absolute offset */
-typedef uint64_t aoff64_t;
-
-__HELENOS_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/perf.h
===================================================================
--- uspace/lib/c/include/perf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- * System performance measurement utilities.
- */
-
-#ifndef _LIBC_PERF_H_
-#define _LIBC_PERF_H_
-
-#include <time.h>
-
-/** Stopwatch is THE way to measure elapsed time on HelenOS. */
-typedef struct {
-	struct timespec start;
-	struct timespec end;
-} stopwatch_t;
-
-#define STOPWATCH_INITIALIZE_STATIC { { 0, 0 }, { 0, 0 } }
-
-/** Initialize system stopwatch.
- *
- * @param stopwatch Stopwatch to initialize.
- */
-static inline void stopwatch_init(stopwatch_t *stopwatch)
-{
-	stopwatch->start.tv_sec = 0;
-	stopwatch->start.tv_nsec = 0;
-	stopwatch->end.tv_sec = 0;
-	stopwatch->end.tv_nsec = 0;
-}
-
-/** Emulate elapsed time for use in tests.
- *
- * @param stopwatch Stopwatch to use.
- * @param nanos Elapsed time in nanoseconds to set.
- */
-static inline void stopwatch_set_nanos(stopwatch_t *stopwatch, nsec_t nanos)
-{
-	stopwatch->start.tv_sec = 0;
-	stopwatch->start.tv_nsec = 0;
-	stopwatch->end.tv_sec = NSEC2SEC(nanos);
-	stopwatch->end.tv_nsec = nanos - SEC2NSEC(stopwatch->end.tv_sec);
-}
-
-/** Start the stopwatch.
- *
- * Note that repeated starts/stops do NOT aggregate the elapsed time.
- *
- * @param stopwatch Stopwatch to start.
- */
-static inline void stopwatch_start(stopwatch_t *stopwatch)
-{
-	getuptime(&stopwatch->start);
-}
-
-/** Stop the stopwatch.
- *
- * Note that repeated starts/stops do NOT aggregate the elapsed time.
- *
- * @param stopwatch Stopwatch to stop.
- */
-static inline void stopwatch_stop(stopwatch_t *stopwatch)
-{
-	getuptime(&stopwatch->end);
-}
-
-/** Get elapsed time in nanoseconds.
- *
- * @param stopwatch Stopwatch to read from.
- * @return Elapsed time in nanoseconds.
- */
-static inline nsec_t stopwatch_get_nanos(stopwatch_t *stopwatch)
-{
-	return ts_sub_diff(&stopwatch->end, &stopwatch->start);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/perm.h
===================================================================
--- uspace/lib/c/include/perm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef LIB_PERM_H_
-#define LIB_PERM_H_
-
-#include <task.h>
-
-extern errno_t perm_grant(task_id_t, unsigned int);
-extern errno_t perm_revoke(task_id_t, unsigned int);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/refcount.h
===================================================================
--- uspace/lib/c/include/refcount.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Authors:
- *	Jiří Zárevúcky (jzr) <zarevucky.jiri@gmail.com>
- */
-
-/*
- * Using atomics for reference counting efficiently is a little tricky,
- * so we define a unified API for this.
- */
-
-#ifndef _LIBC_REFCOUNT_H_
-#define _LIBC_REFCOUNT_H_
-
-#include <assert.h>
-#include <stdatomic.h>
-#include <stdbool.h>
-
-/* Wrapped in a structure to prevent direct manipulation. */
-typedef struct atomic_refcount {
-	volatile atomic_int __cnt;
-} atomic_refcount_t;
-
-static inline void refcount_init(atomic_refcount_t *rc)
-{
-	atomic_store_explicit(&rc->__cnt, 0, memory_order_relaxed);
-}
-
-/**
- * Increment a reference count.
- *
- * Calling this without already owning a reference is undefined behavior.
- * E.g. acquiring a reference through a shared mutable pointer requires that
- * the caller first locks the pointer itself (thereby acquiring the reference
- * inherent to the shared variable), and only then may call refcount_up().
- */
-static inline void refcount_up(atomic_refcount_t *rc)
-{
-	// XXX: We can use relaxed operation because acquiring a reference
-	//      implies no ordering relationships. A reference-counted object
-	//      still needs to be synchronized independently of the refcount.
-
-	int old = atomic_fetch_add_explicit(&rc->__cnt, 1,
-	    memory_order_relaxed);
-
-	/* old < 0 indicates that the function is used incorrectly. */
-	assert(old >= 0);
-}
-
-/**
- * Decrement a reference count. Caller must own the reference.
- *
- * If the function returns `false`, the caller no longer owns the reference and
- * must not access the reference counted object.
- *
- * If the function returns `true`, the caller is now the sole owner of the
- * reference counted object, and must deallocate it.
- */
-static inline bool refcount_down(atomic_refcount_t *rc)
-{
-	// XXX: The decrementers don't need to synchronize with each other,
-	//      but they do need to synchronize with the one doing deallocation.
-	int old = atomic_fetch_sub_explicit(&rc->__cnt, 1,
-	    memory_order_release);
-
-	assert(old >= 0);
-
-	if (old == 0) {
-		// XXX: We are holding the last reference, so we must now
-		//      synchronize with all the other decrementers.
-
-		int val = atomic_load_explicit(&rc->__cnt,
-		    memory_order_acquire);
-		assert(val == -1);
-
-		/*
-		 * The compiler probably wouldn't optimize the memory barrier
-		 * away, but better safe than sorry.
-		 */
-		return val < 0;
-	}
-
-	return false;
-}
-
-#endif
Index: pace/lib/c/include/rndgen.h
===================================================================
--- uspace/lib/c/include/rndgen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file Random number generator
- */
-
-#ifndef _LIBC_RNDGEN_H_
-#define _LIBC_RNDGEN_H_
-
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-
-typedef struct {
-	unsigned int seed;
-} rndgen_t;
-
-extern errno_t rndgen_create(rndgen_t **);
-extern void rndgen_destroy(rndgen_t *);
-extern errno_t rndgen_uint8(rndgen_t *, uint8_t *);
-extern errno_t rndgen_uint16(rndgen_t *, uint16_t *);
-extern errno_t rndgen_uint32(rndgen_t *, uint32_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/dynamic.h
===================================================================
--- uspace/lib/c/include/rtld/dynamic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_DYNAMIC_H_
-#define _LIBC_RTLD_DYNAMIC_H_
-
-#include <stdbool.h>
-#include <rtld/elf_dyn.h>
-#include <libarch/rtld/dynamic.h>
-
-/**
- * Holds the data extracted from an ELF Dynamic section.
- *
- * The data is already pre-processed: Pointers are adjusted
- * to their final run-time values by adding the load bias
- * and indices into the symbol table are converted to pointers.
- */
-typedef struct dyn_info {
-	/** Relocation table without explicit addends */
-	void *rel;
-	size_t rel_sz;
-	size_t rel_ent;
-
-	/** Relocation table with explicit addends */
-	void *rela;
-	size_t rela_sz;
-	size_t rela_ent;
-
-	/** PLT relocation table */
-	void *jmp_rel;
-	size_t plt_rel_sz;
-	/** Type of relocations used for the PLT, either DT_REL or DT_RELA */
-	int plt_rel;
-
-	/** Pointer to PLT/GOT (processor-specific) */
-	void *plt_got;
-
-	/** Hash table */
-	elf_word *hash;
-
-	/** String table */
-	char *str_tab;
-	size_t str_sz;
-
-	/** Symbol table */
-	void *sym_tab;
-	size_t sym_ent;
-
-	void *init;		/**< Module initialization code */
-	void *fini;		/**< Module cleanup code */
-
-	const char *soname;	/**< Library identifier */
-	char *rpath;		/**< Library search path list */
-
-	bool symbolic;
-	bool text_rel;
-	bool bind_now;
-
-	/* Assume for now that there's at most one needed library */
-	char *needed;
-
-	/** Pointer to the module's dynamic section */
-	elf_dyn_t *dynamic;
-
-	/** Architecture-specific info. */
-	dyn_info_arch_t arch;
-} dyn_info_t;
-
-void dynamic_parse(elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info);
-void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/include/rtld/elf_dyn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_ELF_DYN_H_
-#define _LIBC_RTLD_ELF_DYN_H_
-
-#include <elf/elf.h>
-#include <libarch/rtld/elf_dyn.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/module.h
===================================================================
--- uspace/lib/c/include/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_MODULE_H_
-#define _LIBC_RTLD_MODULE_H_
-
-#include <rtld/dynamic.h>
-#include <adt/list.h>
-#include <types/rtld/module.h>
-#include <types/rtld/rtld.h>
-
-extern errno_t module_create_entrypoint(elf_finfo_t *, rtld_t *, module_t **);
-extern void module_process_relocs(module_t *);
-extern module_t *module_find(rtld_t *, const char *);
-extern module_t *module_load(rtld_t *, const char *, mlflags_t);
-extern errno_t module_load_deps(module_t *, mlflags_t);
-extern module_t *module_by_id(rtld_t *, unsigned long);
-
-extern void modules_process_relocs(rtld_t *, module_t *);
-extern void modules_process_tls(rtld_t *);
-extern void modules_untag(rtld_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/rtld/rtld.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_H_
-#define _LIBC_RTLD_H_
-
-#include <adt/list.h>
-#include <elf/elf_mod.h>
-
-#include <rtld/dynamic.h>
-#include <tls.h>
-#include <types/rtld/rtld.h>
-
-extern rtld_t *runtime_env;
-
-extern errno_t rtld_prog_process(elf_finfo_t *, rtld_t **);
-extern tcb_t *rtld_tls_make(rtld_t *);
-extern unsigned long rtld_get_next_id(rtld_t *);
-extern void *rtld_tls_get_addr(rtld_t *, tcb_t *, unsigned long, unsigned long);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/rtld_arch.h
===================================================================
--- uspace/lib/c/include/rtld/rtld_arch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_RTLD_ARCH_H_
-#define _LIBC_RTLD_RTLD_ARCH_H_
-
-#include <rtld/rtld.h>
-#include <loader/pcb.h>
-
-void module_process_pre_arch(module_t *m);
-
-void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size);
-void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size);
-void *func_get_addr(elf_symbol_t *, module_t *);
-
-void program_run(void *entry, pcb_t *pcb);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/rtld_debug.h
===================================================================
--- uspace/lib/c/include/rtld/rtld_debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_RTLD_DEBUG_H_
-#define _LIBC_RTLD_RTLD_DEBUG_H_
-
-#include <stdio.h>
-
-/* Define to enable debugging mode. */
-#undef RTLD_DEBUG
-
-#ifdef RTLD_DEBUG
-#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
-#else
-#define DPRINTF(format, ...) if (0) printf(format, ##__VA_ARGS__)
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/rtld/symbol.h
===================================================================
--- uspace/lib/c/include/rtld/symbol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_RTLD_SYMBOL_H_
-#define _LIBC_RTLD_SYMBOL_H_
-
-#include <elf/elf.h>
-#include <rtld/rtld.h>
-#include <tls.h>
-
-/** Symbol search flags */
-typedef enum {
-	/** No flags */
-	ssf_none = 0,
-	/** Do not search in the executable */
-	ssf_noexec = 0x1
-} symbol_search_flags_t;
-
-extern elf_symbol_t *symbol_bfs_find(const char *, module_t *, module_t **);
-extern elf_symbol_t *symbol_def_find(const char *, module_t *,
-    symbol_search_flags_t, module_t **);
-extern void *symbol_get_addr(elf_symbol_t *, module_t *, tcb_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/setjmp.h
===================================================================
--- uspace/lib/c/include/setjmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-#ifndef _LIBC_SETJMP_H_
-#define _LIBC_SETJMP_H_
-
-#include <libarch/fibril_context.h>
-#include <_bits/__noreturn.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-typedef __context_t jmp_buf[1];
-
-extern int __context_save(__context_t *) __attribute__((returns_twice));
-extern __noreturn void __context_restore(__context_t *, int);
-
-extern __noreturn void longjmp(jmp_buf, int);
-
-__C_DECLS_END;
-
-#define setjmp __context_save
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/shutdown.h
===================================================================
--- uspace/lib/c/include/shutdown.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_SHUTDOWN_H_
-#define _LIBC_SHUTDOWN_H_
-
-extern void sys_reboot(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/smc.h
===================================================================
--- uspace/lib/c/include/smc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_SMC_H_
-#define _LIBC_SMC_H_
-
-#include <errno.h>
-#include <stddef.h>
-
-extern errno_t smc_coherence(void *address, size_t size);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/stack.h
===================================================================
--- uspace/lib/c/include/stack.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2012 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STACK_H_
-#define _LIBC_STACK_H_
-
-#include <types/common.h>
-
-extern size_t stack_size_get(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/stacktrace.h
===================================================================
--- uspace/lib/c/include/stacktrace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STACKTRACE_H_
-#define _LIBC_STACKTRACE_H_
-
-#include <errno.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-typedef struct {
-	errno_t (*read_uintptr)(void *, uintptr_t, uintptr_t *);
-	int (*printf)(const char *, ...);
-} stacktrace_ops_t;
-
-typedef struct {
-	void *op_arg;
-	stacktrace_ops_t *ops;
-} stacktrace_t;
-
-extern void stacktrace_print(void);
-extern void stacktrace_kio_print(void);
-extern void stacktrace_print_fp_pc(uintptr_t, uintptr_t);
-extern void stacktrace_print_generic(stacktrace_ops_t *, void *, uintptr_t,
-    uintptr_t);
-
-/*
- * The following interface is to be implemented by each architecture.
- */
-extern bool stacktrace_fp_valid(stacktrace_t *, uintptr_t);
-extern errno_t stacktrace_fp_prev(stacktrace_t *, uintptr_t, uintptr_t *);
-extern errno_t stacktrace_ra_get(stacktrace_t *, uintptr_t, uintptr_t *);
-
-extern void stacktrace_prepare(void);
-extern uintptr_t stacktrace_fp_get(void);
-extern uintptr_t stacktrace_pc_get(void);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/stats.h
===================================================================
--- uspace/lib/c/include/stats.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2010 Stanislav Kozina
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STATS_H_
-#define _LIBC_STATS_H_
-
-#include <task.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <abi/sysinfo.h>
-
-#define LOAD_UNIT  65536
-
-extern stats_cpu_t *stats_get_cpus(size_t *);
-extern stats_physmem_t *stats_get_physmem(void);
-extern load_t *stats_get_load(size_t *);
-
-extern stats_task_t *stats_get_tasks(size_t *);
-extern stats_task_t *stats_get_task(task_id_t);
-
-extern stats_thread_t *stats_get_threads(size_t *);
-extern stats_ipcc_t *stats_get_ipccs(size_t *);
-
-extern stats_exc_t *stats_get_exceptions(size_t *);
-extern stats_exc_t *stats_get_exception(unsigned int);
-
-extern void stats_print_load_fragment(load_t, unsigned int);
-extern const char *thread_get_state(state_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/stdio.h
===================================================================
--- uspace/lib/c/include/stdio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STDIO_H_
-#define _LIBC_STDIO_H_
-
-#include <stdarg.h>
-#include <io/verify.h>
-#include <_bits/NULL.h>
-#include <_bits/size_t.h>
-#include <_bits/wchar_t.h>
-#include <_bits/uchar.h>
-#include <_bits/wint_t.h>
-#include <_bits/decls.h>
-
-#ifndef _HELENOS_SOURCE
-#define _IONBF 0
-#define _IOLBF 1
-#define _IOFBF 2
-#endif
-
-/** Default size for stream I/O buffers */
-#define BUFSIZ  4096
-
-#define EOF  (-1)
-
-/** Max number of files that is guaranteed to be able to open at the same time */
-#define FOPEN_MAX 16
-
-/** Recommended size of fixed-size array for holding file names. */
-#define FILENAME_MAX 4096
-
-/** Length of "/tmp/tmp.XXXXXX" + 1 */
-#define L_tmpnam 16
-
-#ifndef SEEK_SET
-#define SEEK_SET  0
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR  1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END  2
-#endif
-
-/** Minimum number of unique temporary file names */
-#define TMP_MAX 1000000
-
-__C_DECLS_BEGIN;
-
-/** Forward declaration */
-struct _IO_FILE;
-typedef struct _IO_FILE FILE;
-
-/** File position */
-typedef struct {
-	long long pos;
-} fpos_t;
-
-extern FILE *stdin;
-extern FILE *stdout;
-extern FILE *stderr;
-
-/* Character and string input functions */
-extern int fgetc(FILE *);
-extern char *fgets(char *, int, FILE *);
-extern char *gets(char *, size_t) __attribute__((deprecated));
-
-static inline int getc(FILE *f)
-{
-	return fgetc(f);
-}
-
-extern int getchar(void);
-
-/* Character and string output functions */
-extern int fputc(int, FILE *);
-extern int fputs(const char *, FILE *);
-
-static inline int putc(int i, FILE *f)
-{
-	return fputc(i, f);
-}
-
-extern int putchar(int);
-extern int puts(const char *);
-
-extern int ungetc(int, FILE *);
-
-extern wint_t fputwc(wchar_t, FILE *);
-extern wint_t putwchar(wchar_t);
-
-extern wint_t fputuc(char32_t, FILE *);
-extern wint_t putuchar(char32_t);
-
-/* Formatted string output functions */
-extern int fprintf(FILE *, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vfprintf(FILE *, const char *, va_list);
-
-extern int printf(const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(1, 2);
-extern int vprintf(const char *, va_list);
-
-extern int snprintf(char *, size_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(3, 4);
-#if defined(_HELENOS_SOURCE) || defined(_GNU_SOURCE)
-extern int vasprintf(char **, const char *, va_list);
-extern int asprintf(char **, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-#endif
-extern int vsnprintf(char *, size_t, const char *, va_list);
-
-extern int sprintf(char *, const char *, ...)
-    __attribute__((deprecated)) _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vsprintf(char *, const char *, va_list) __attribute__((deprecated));
-
-/* Formatted input */
-extern int scanf(const char *, ...);
-extern int vscanf(const char *, va_list);
-extern int fscanf(FILE *, const char *, ...);
-extern int vfscanf(FILE *, const char *, va_list);
-extern int sscanf(const char *, const char *, ...);
-extern int vsscanf(const char *, const char *, va_list);
-
-/* File stream functions */
-extern FILE *fopen(const char *, const char *);
-extern FILE *freopen(const char *, const char *, FILE *);
-extern int fclose(FILE *);
-
-extern size_t fread(void *, size_t, size_t, FILE *);
-extern size_t fwrite(const void *, size_t, size_t, FILE *);
-
-extern int fgetpos(FILE *, fpos_t *);
-extern int fsetpos(FILE *, const fpos_t *);
-
-extern int fseek(FILE *, long, int);
-extern void rewind(FILE *);
-extern long ftell(FILE *);
-extern int feof(FILE *);
-
-extern int fflush(FILE *);
-extern int ferror(FILE *);
-extern void clearerr(FILE *);
-
-extern void perror(const char *);
-
-extern int setvbuf(FILE *, void *, int, size_t);
-extern void setbuf(FILE *, void *);
-
-/* Misc file functions */
-extern int remove(const char *);
-extern int rename(const char *, const char *);
-
-extern FILE *tmpfile(void);
-extern char *tmpnam(char *s);
-
-__C_DECLS_END;
-
-#ifdef _HELENOS_SOURCE
-
-#include <_bits/off64_t.h>
-
-__HELENOS_DECLS_BEGIN;
-
-/* Nonstandard extensions. */
-
-enum __buffer_type {
-	/** No buffering */
-	_IONBF,
-	/** Line buffering */
-	_IOLBF,
-	/** Full buffering */
-	_IOFBF
-};
-
-extern FILE *fdopen(int, const char *);
-extern int fileno(FILE *);
-
-extern int fseek64(FILE *, off64_t, int);
-extern off64_t ftell64(FILE *);
-
-__HELENOS_DECLS_END;
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/string.h
===================================================================
--- uspace/lib/c/include/string.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_STRING_H_
-#define _LIBC_STRING_H_
-
-#if defined(_HELENOS_SOURCE) && !defined(_REALLY_WANT_STRING_H) && \
-    !defined(_LIBC_SOURCE)
-#error Please use str.h and mem.h instead
-#endif
-
-#include <_bits/decls.h>
-#include <_bits/size_t.h>
-#include <_bits/NULL.h>
-#include <mem.h>
-
-__C_DECLS_BEGIN;
-
-extern char *strcpy(char *, const char *);
-extern char *strncpy(char *, const char *, size_t);
-extern char *strcat(char *, const char *);
-extern char *strncat(char *, const char *, size_t);
-extern int strcmp(const char *, const char *);
-extern int strcoll(const char *, const char *);
-extern int strncmp(const char *, const char *, size_t);
-extern size_t strxfrm(char *, const char *, size_t);
-extern char *strchr(const char *, int);
-extern size_t strcspn(const char *, const char *);
-extern char *strpbrk(const char *, const char *);
-extern char *strrchr(const char *, int);
-extern size_t strspn(const char *, const char *);
-extern char *strstr(const char *, const char *);
-extern char *strtok(char *, const char *);
-extern char *__strtok_r(char *, const char *, char **);
-extern char *strerror(int);
-extern size_t strlen(const char *);
-
-#if defined(_HELENOS_SOURCE) || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_LIBC_SOURCE)
-extern size_t strnlen(const char *, size_t);
-extern char *strdup(const char *);
-extern char *strndup(const char *, size_t);
-#endif
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/syscall.h
===================================================================
--- uspace/lib/c/include/syscall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Syscall function declaration for architectures that don't
- *        inline syscalls or architectures that handle syscalls
- *        according to the number of arguments.
- */
-
-#ifndef _LIBC_SYSCALL_H_
-#define _LIBC_SYSCALL_H_
-
-#ifndef LIBARCH_SYSCALL_GENERIC
-#error You cannot include this file directly
-#endif
-
-#include <abi/syscall.h>
-#include <types/common.h>
-
-#define __syscall0  __syscall
-#define __syscall1  __syscall
-#define __syscall2  __syscall
-#define __syscall3  __syscall
-#define __syscall4  __syscall
-#define __syscall5  __syscall
-#define __syscall6  __syscall
-
-extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
-    const sysarg_t p3, const sysarg_t p4, const sysarg_t p5, const sysarg_t p6,
-    const syscall_t id);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/sysinfo.h
===================================================================
--- uspace/lib/c/include/sysinfo.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_SYSINFO_H_
-#define _LIBC_SYSINFO_H_
-
-#include <types/common.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <abi/sysinfo.h>
-
-extern char *sysinfo_get_keys(const char *, size_t *);
-extern sysinfo_item_val_type_t sysinfo_get_val_type(const char *);
-extern errno_t sysinfo_get_value(const char *, sysarg_t *);
-extern void *sysinfo_get_data(const char *, size_t *);
-extern void *sysinfo_get_property(const char *, const char *, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/task.h
===================================================================
--- uspace/lib/c/include/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TASK_H_
-#define _LIBC_TASK_H_
-
-#include <async.h>
-#include <stdint.h>
-#include <stdarg.h>
-#include <abi/proc/task.h>
-#include <async.h>
-#include <types/task.h>
-
-typedef struct {
-	ipc_call_t result;
-	aid_t aid;
-} task_wait_t;
-
-struct _TASK;
-typedef struct _TASK task_t;
-
-extern task_id_t task_get_id(void);
-extern errno_t task_set_name(const char *);
-extern errno_t task_kill(task_id_t);
-
-extern errno_t task_spawnv(task_id_t *, task_wait_t *, const char *path,
-    const char *const []);
-extern errno_t task_spawnv_debug(task_id_t *, task_wait_t *, const char *path,
-    const char *const [], async_sess_t **);
-extern errno_t task_spawnvf(task_id_t *, task_wait_t *, const char *path,
-    const char *const [], int, int, int);
-extern errno_t task_spawnvf_debug(task_id_t *, task_wait_t *, const char *path,
-    const char *const [], int, int, int, async_sess_t **);
-extern errno_t task_spawn(task_id_t *, task_wait_t *, const char *path, int,
-    va_list ap);
-extern errno_t task_spawnl(task_id_t *, task_wait_t *, const char *path, ...)
-    __attribute__((sentinel));
-
-extern errno_t task_setup_wait(task_id_t, task_wait_t *);
-extern void task_cancel_wait(task_wait_t *);
-extern errno_t task_wait(task_wait_t *, task_exit_t *, int *);
-extern errno_t task_wait_task_id(task_id_t, task_exit_t *, int *);
-extern errno_t task_retval(int);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/time.h
===================================================================
--- uspace/lib/c/include/time.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TIME_H_
-#define _LIBC_TIME_H_
-
-#include <_bits/decls.h>
-
-/* ISO/IEC 9899:2011 7.27.1 (2) */
-
-#include <_bits/NULL.h>
-
-#define CLOCKS_PER_SEC	((clock_t) 1000000)
-
-#define TIME_UTC	1
-
-/* ISO/IEC 9899:2011 7.27.1 (3) */
-
-#include <_bits/size_t.h>
-
-__C_DECLS_BEGIN;
-
-/* ISO/IEC 9899:2011 7.27.1 (3), (4) */
-
-typedef long long time_t;
-typedef long long clock_t;
-
-struct timespec {
-	time_t tv_sec;
-	long tv_nsec;
-};
-
-struct tm {
-	int tm_sec;
-	int tm_nsec;  /**< Nonstandard extension, nanoseconds since last second. */
-	int tm_min;
-	int tm_hour;
-	int tm_mday;
-	int tm_mon;
-	int tm_year;
-	int tm_wday;
-	int tm_yday;
-	int tm_isdst;
-};
-
-/* ISO/IEC 9899:2011 7.27.2.1 (1) */
-extern clock_t clock(void);
-
-/* ISO/IEC 9899:2011 7.27.2.2 (1) */
-extern double difftime(time_t, time_t);
-
-/* ISO/IEC 9899:2011 7.27.2.3 (1) */
-extern time_t mktime(struct tm *);
-
-/* ISO/IEC 9899:2011 7.27.2.4 (1) */
-extern time_t time(time_t *);
-
-/* ISO/IEC 9899:2011 7.27.2.5 (1) */
-extern int timespec_get(struct timespec *, int);
-
-/* ISO/IEC 9899:2011 7.27.3.1 (1) */
-extern char *asctime(const struct tm *);
-
-/* ISO/IEC 9899:2011 7.27.3.2 (1) */
-extern char *ctime(const time_t *);
-
-/* ISO/IEC 9899:2011 7.27.3.3 (1) */
-extern struct tm *gmtime(const time_t *);
-
-/* ISO/IEC 9899:2011 7.27.3.4 (1) */
-extern struct tm *localtime(const time_t *);
-
-/* ISO/IEC 9899:2011 7.27.3.5 (1) */
-extern size_t strftime(char *__restrict__, size_t, const char *__restrict__,
-    const struct tm *__restrict__);
-
-__C_DECLS_END;
-
-#ifdef _HELENOS_SOURCE
-
-/*
- * HelenOS specific extensions
- */
-
-#include <stdbool.h>
-#include <_bits/errno.h>
-
-__HELENOS_DECLS_BEGIN;
-
-typedef long long sec_t;
-typedef long long msec_t;
-typedef long long usec_t;
-typedef long long nsec_t;	/* good for +/- 292 years */
-
-#define SEC2MSEC(s)	((s) * 1000ll)
-#define SEC2USEC(s)	((s) * 1000000ll)
-#define SEC2NSEC(s)	((s) * 1000000000ll)
-
-#define MSEC2SEC(ms)	((ms) / 1000ll)
-#define MSEC2USEC(ms)	((ms) * 1000ll)
-#define MSEC2NSEC(ms)	((ms) * 1000000ll)
-
-#define USEC2SEC(us)	((us) / 1000000ll)
-#define USEC2MSEC(us)	((us) / 1000ll)
-#define USEC2NSEC(us)	((us) * 1000ll)
-
-#define NSEC2SEC(ns)	((ns) / 1000000000ll)
-#define NSEC2MSEC(ns)	((ns) / 1000000ll)
-#define NSEC2USEC(ns)	((ns) / 1000ll)
-
-extern void getuptime(struct timespec *);
-extern void getrealtime(struct timespec *);
-
-extern void ts_add_diff(struct timespec *, nsec_t);
-extern void ts_add(struct timespec *, const struct timespec *);
-extern void ts_sub(struct timespec *, const struct timespec *);
-extern nsec_t ts_sub_diff(const struct timespec *, const struct timespec *);
-extern bool ts_gt(const struct timespec *, const struct timespec *);
-extern bool ts_gteq(const struct timespec *, const struct timespec *);
-
-extern errno_t time_utc2tm(const time_t, struct tm *);
-extern errno_t time_utc2str(const time_t, char *);
-extern void time_tm2str(const struct tm *, char *);
-extern errno_t time_ts2tm(const struct timespec *, struct tm *);
-extern errno_t time_local2tm(const time_t, struct tm *);
-extern errno_t time_local2str(const time_t, char *);
-
-extern void udelay(sysarg_t);
-
-__HELENOS_DECLS_END;
-
-#endif /* _HELENOS_SOURCE */
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/tls.h
===================================================================
--- uspace/lib/c/include/tls.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TLS_H_
-#define _LIBC_TLS_H_
-
-#include <libarch/tls.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-static inline void __tcb_reset(void)
-{
-	__tcb_raw_set(NULL);
-}
-
-static inline void __tcb_set(tcb_t *tcb)
-{
-	__tcb_raw_set((uint8_t *)tcb + ARCH_TP_OFFSET);
-}
-
-static inline tcb_t *__tcb_get(void)
-{
-	return (tcb_t *)((uint8_t *)__tcb_raw_get() - ARCH_TP_OFFSET);
-}
-
-/*
- * The TP register is supposed to be zero when the thread is first created
- * by the kernel. We use this for some debugging assertions.
- */
-static inline bool __tcb_is_set(void)
-{
-	return __tcb_raw_get() != NULL;
-}
-
-/** DTV Generation number - equals vector length */
-#define DTV_GN(dtv) (((uintptr_t *)(dtv))[0])
-
-extern tcb_t *tls_make(const void *);
-extern tcb_t *tls_make_initial(const void *);
-extern tcb_t *tls_alloc_arch(size_t, size_t);
-extern void tls_free(tcb_t *);
-extern void tls_free_arch(tcb_t *, size_t, size_t);
-extern void *tls_get(void);
-
-#ifdef CONFIG_TLS_VARIANT_1
-extern tcb_t *tls_alloc_variant_1(size_t, size_t);
-extern void tls_free_variant_1(tcb_t *, size_t, size_t);
-#endif
-
-#ifdef CONFIG_TLS_VARIANT_2
-extern tcb_t *tls_alloc_variant_2(size_t, size_t);
-extern void tls_free_variant_2(tcb_t *, size_t, size_t);
-#endif
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/tmpfile.h
===================================================================
--- uspace/lib/c/include/tmpfile.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LIBC_TMPFILE_H_
-#define _LIBC_TMPFILE_H_
-
-#include <stdbool.h>
-
-extern int __tmpfile_templ(char *, bool);
-extern int __tmpfile(void);
-extern char *__tmpnam(char *);
-
-#endif
Index: pace/lib/c/include/trace.h
===================================================================
--- uspace/lib/c/include/trace.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TRACE_H_
-#define _LIBC_TRACE_H_
-
-#define _NO_TRACE  __attribute__((no_instrument_function))
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/casting.h
===================================================================
--- uspace/lib/c/include/types/casting.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_CASTING_H_
-#define _LIBC_TYPES_CASTING_H_
-
-#include <stdbool.h>
-#include <stddef.h>
-
-/**
- * Checks that the size_t value can be casted to int without loss of data.
- *
- * @param val Value to test.
- * @return Whether it is safe to typecast value to int.
- */
-static inline bool can_cast_size_t_to_int(size_t val)
-{
-	unsigned int as_uint = (unsigned int) val;
-	return !((as_uint != val) || (((int) as_uint) < 0));
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/common.h
===================================================================
--- uspace/lib/c/include/types/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_COMMON_H_
-#define _LIBC_TYPES_COMMON_H_
-
-#if __SIZEOF_POINTER__ == 4
-#define __32_BITS__
-#elif __SIZEOF_POINTER__ == 8
-#define __64_BITS__
-#else
-#error __SIZEOF_POINTER__ is not defined.
-#endif
-
-#include <_bits/all.h>
-#include <_bits/errno.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/loc.h
===================================================================
--- uspace/lib/c/include/types/loc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_LOC_H_
-#define _LIBC_TYPES_LOC_H_
-
-#include <async.h>
-
-/** Server register with location service */
-typedef struct {
-	async_sess_t *sess;
-} loc_srv_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/rtld/module.h
===================================================================
--- uspace/lib/c/include/types/rtld/module.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_RTLD_MODULE_H_
-#define _LIBC_TYPES_RTLD_MODULE_H_
-
-#include <adt/list.h>
-#include <stddef.h>
-
-typedef enum {
-	/** Do not export symbols to global namespace */
-	mlf_local = 0x1
-} mlflags_t;
-
-/** Dynamically linked module */
-typedef struct module {
-	/** Module ID */
-	unsigned long id;
-	/** Dynamic info for this module */
-	dyn_info_t dyn;
-	/** Load bias */
-	size_t bias;
-
-	/** tdata image start */
-	void *tdata;
-	/** tdata image size */
-	size_t tdata_size;
-	/** tbss size */
-	size_t tbss_size;
-	/** TLS alignment */
-	size_t tls_align;
-
-	/** Offset of this module's TLS from the thread pointer. */
-	ptrdiff_t tpoff;
-
-	/** Containing rtld */
-	struct rtld *rtld;
-	/** Array of pointers to directly dependent modules */
-	struct module **deps;
-	/** Number of fields in deps */
-	size_t n_deps;
-
-	/** True iff relocations have already been processed in this module. */
-	bool relocated;
-
-	/** Link to list of all modules in runtime environment */
-	link_t modules_link;
-	/** Link to list of initial modules */
-	link_t imodules_link;
-
-	/** Link to BFS queue. Only used when doing a BFS of the module graph */
-	link_t queue_link;
-	/** Tag for modules already processed during a BFS */
-	bool bfs_tag;
-	/** If @c true, does not export symbols to global namespace */
-	bool local;
-	/** This is the dynamically linked executable */
-	bool exec;
-} module_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/types/rtld/rtld.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_RTLD_RTLD_H_
-#define _LIBC_TYPES_RTLD_RTLD_H_
-
-#include <adt/list.h>
-#include <elf/elf_mod.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <types/rtld/module.h>
-
-typedef struct rtld {
-	elf_dyn_t *rtld_dynamic;
-	module_t rtld;
-
-	module_t *program;
-
-	/** Next module ID */
-	unsigned long next_id;
-
-	/** Size of initial TLS tdata + tbss */
-	size_t tls_size;
-	size_t tls_align;
-
-	/** List of all loaded modules including rtld and the program */
-	list_t modules;
-
-	/** List of initial modules */
-	list_t imodules;
-} rtld_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/task.h
===================================================================
--- uspace/lib/c/include/types/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_TASK_H_
-#define _LIBC_TYPES_TASK_H_
-
-typedef enum {
-	TASK_EXIT_NORMAL,
-	TASK_EXIT_UNEXPECTED
-} task_exit_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/types/uuid.h
===================================================================
--- uspace/lib/c/include/types/uuid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_TYPES_UUID_H_
-#define _LIBC_TYPES_UUID_H_
-
-#include <stdint.h>
-
-#define _UUID_NODE_LEN 6
-
-/** Universally Unique Identifier */
-
-typedef struct {
-	uint32_t time_low;
-	uint16_t time_mid;
-	uint16_t time_hi_and_version;
-	uint8_t clock_seq_hi_and_reserved;
-	uint8_t clock_seq_low;
-	uint8_t node[_UUID_NODE_LEN];
-} uuid_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/udebug.h
===================================================================
--- uspace/lib/c/include/udebug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_UDEBUG_H_
-#define _LIBC_UDEBUG_H_
-
-#include <abi/udebug.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <async.h>
-
-typedef sysarg_t thash_t;
-
-extern errno_t udebug_begin(async_sess_t *);
-extern errno_t udebug_end(async_sess_t *);
-extern errno_t udebug_set_evmask(async_sess_t *, udebug_evmask_t);
-extern errno_t udebug_thread_read(async_sess_t *, void *, size_t, size_t *,
-    size_t *);
-extern errno_t udebug_name_read(async_sess_t *, void *, size_t, size_t *,
-    size_t *);
-extern errno_t udebug_areas_read(async_sess_t *, void *, size_t, size_t *,
-    size_t *);
-extern errno_t udebug_mem_read(async_sess_t *, void *, uintptr_t, size_t);
-extern errno_t udebug_args_read(async_sess_t *, thash_t, sysarg_t *);
-extern errno_t udebug_regs_read(async_sess_t *, thash_t, void *);
-extern errno_t udebug_go(async_sess_t *, thash_t, udebug_event_t *, sysarg_t *,
-    sysarg_t *);
-extern errno_t udebug_stop(async_sess_t *, thash_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/unaligned.h
===================================================================
--- uspace/lib/c/include/unaligned.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2017 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_UNALIGNED_H_
-#define _LIBC_UNALIGNED_H_
-
-#include <stdint.h>
-
-typedef int16_t unaligned_int16_t __attribute__((aligned(1)));
-typedef int32_t unaligned_int32_t __attribute__((aligned(1)));
-typedef int64_t unaligned_int64_t __attribute__((aligned(1)));
-
-typedef uint16_t unaligned_uint16_t __attribute__((aligned(1)));
-typedef uint32_t unaligned_uint32_t __attribute__((aligned(1)));
-typedef uint64_t unaligned_uint64_t __attribute__((aligned(1)));
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/uuid.h
===================================================================
--- uspace/lib/c/include/uuid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_UUID_H_
-#define _LIBC_UUID_H_
-
-#include <stdint.h>
-#include <types/uuid.h>
-#include <stdbool.h>
-
-extern errno_t uuid_generate(uuid_t *);
-extern void uuid_encode(uuid_t *, uint8_t *);
-extern void uuid_decode(uint8_t *, uuid_t *);
-extern void uuid_encode_le(uuid_t *, uint8_t *);
-extern void uuid_decode_le(uint8_t *, uuid_t *);
-extern errno_t uuid_parse(const char *, uuid_t *, const char **);
-extern errno_t uuid_format(uuid_t *, char **, bool);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/vfs/canonify.h
===================================================================
--- uspace/lib/c/include/vfs/canonify.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_VFS_CANONIFY_H_
-#define _LIBC_VFS_CANONIFY_H_
-
-#include <stddef.h>
-
-extern char *canonify(char *, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/vfs/inbox.h
===================================================================
--- uspace/lib/c/include/vfs/inbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-
-/**
- * @file
- * @brief
- */
-
-#ifndef _LIBC_VFS_INBOX_H_
-#define _LIBC_VFS_INBOX_H_
-
-enum {
-	INBOX_MAX_ENTRIES = 256,
-};
-
-extern int inbox_set(const char *name, int file);
-extern int inbox_get(const char *name);
-
-extern int inbox_list(const char **names, int capacity);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/c/include/vfs/vfs.h
===================================================================
--- uspace/lib/c/include/vfs/vfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_VFS_H_
-#define _LIBC_VFS_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <ipc/vfs.h>
-#include <ipc/loc.h>
-#include <adt/list.h>
-#include <stdio.h>
-#include <async.h>
-#include <offset.h>
-
-enum vfs_change_state_type {
-	VFS_PASS_HANDLE
-};
-
-typedef enum {
-	KIND_FILE,
-	KIND_DIRECTORY,
-} vfs_file_kind_t;
-
-typedef struct {
-	fs_handle_t fs_handle;
-	service_id_t service_id;
-	fs_index_t index;
-	unsigned int lnkcnt;
-	bool is_file;
-	bool is_directory;
-	aoff64_t size;
-	service_id_t service;
-} vfs_stat_t;
-
-typedef struct {
-	char fs_name[FS_NAME_MAXLEN + 1];
-	uint32_t f_bsize;    /* fundamental file system block size */
-	uint64_t f_blocks;   /* total data blocks in file system */
-	uint64_t f_bfree;    /* free blocks in fs */
-} vfs_statfs_t;
-
-/** List of file system types */
-typedef struct {
-	char **fstypes;
-	char *buf;
-	size_t size;
-} vfs_fstypes_t;
-
-extern errno_t vfs_fhandle(FILE *, int *);
-
-extern char *vfs_absolutize(const char *, size_t *);
-extern errno_t vfs_clone(int, int, bool, int *);
-extern errno_t vfs_cwd_get(char *path, size_t);
-extern errno_t vfs_cwd_set(const char *path);
-extern async_exch_t *vfs_exchange_begin(void);
-extern void vfs_exchange_end(async_exch_t *);
-extern errno_t vfs_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
-extern errno_t vfs_fstypes(vfs_fstypes_t *);
-extern void vfs_fstypes_free(vfs_fstypes_t *);
-extern errno_t vfs_link(int, const char *, vfs_file_kind_t, int *);
-extern errno_t vfs_link_path(const char *, vfs_file_kind_t, int *);
-extern errno_t vfs_lookup(const char *, int, int *);
-extern errno_t vfs_lookup_open(const char *, int, int, int *);
-extern errno_t vfs_mount_path(const char *, const char *, const char *,
-    const char *, unsigned int, unsigned int);
-extern errno_t vfs_mount(int, const char *, service_id_t, const char *, unsigned,
-    unsigned, int *);
-extern errno_t vfs_open(int, int);
-extern errno_t vfs_pass_handle(async_exch_t *, int, async_exch_t *);
-extern errno_t vfs_put(int);
-extern errno_t vfs_read(int, aoff64_t *, void *, size_t, size_t *);
-extern errno_t vfs_read_short(int, aoff64_t, void *, size_t, ssize_t *);
-extern errno_t vfs_receive_handle(bool, int *);
-extern errno_t vfs_rename_path(const char *, const char *);
-extern errno_t vfs_resize(int, aoff64_t);
-extern int vfs_root(void);
-extern errno_t vfs_root_set(int);
-extern errno_t vfs_stat(int, vfs_stat_t *);
-extern errno_t vfs_stat_path(const char *, vfs_stat_t *);
-extern errno_t vfs_statfs(int, vfs_statfs_t *);
-extern errno_t vfs_statfs_path(const char *, vfs_statfs_t *);
-extern errno_t vfs_sync(int);
-extern errno_t vfs_unlink(int, const char *, int);
-extern errno_t vfs_unlink_path(const char *);
-extern errno_t vfs_unmount(int);
-extern errno_t vfs_unmount_path(const char *);
-extern errno_t vfs_walk(int, const char *, int, int *);
-extern errno_t vfs_write(int, aoff64_t *, const void *, size_t, size_t *);
-extern errno_t vfs_write_short(int, aoff64_t, const void *, size_t, ssize_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/vfs/vfs_mtab.h
===================================================================
--- uspace/lib/c/include/vfs/vfs_mtab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_VFS_MTAB_H_
-#define _LIBC_VFS_MTAB_H_
-
-#include <ipc/vfs.h>
-#include <adt/list.h>
-
-typedef struct mtab_ent {
-	link_t link;
-	char mp[MAX_PATH_LEN];
-	char fs_name[FS_NAME_MAXLEN];
-	service_id_t service_id;
-} mtab_ent_t;
-
-extern errno_t vfs_get_mtab_list(list_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/include/vfs/vfs_sess.h
===================================================================
--- uspace/lib/c/include/vfs/vfs_sess.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBC_VFS_SESS_H_
-#define _LIBC_VFS_SESS_H_
-
-#include <async.h>
-#include <stdio.h>
-
-extern async_sess_t *vfs_fd_session(int, iface_t);
-extern async_sess_t *vfs_fsession(FILE *, iface_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/c/meson.build
===================================================================
--- uspace/lib/c/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-#
-# Copyright (c) 2025 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# libarch
-arch_src = []
-subdir('arch' / UARCH)
-
-c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
-
-root_path = '..' / '..' / '..'
-
-incdirs = [
-	'include',
-	'arch' / UARCH / 'include',
-	root_path / 'abi' / 'arch' / UARCH / 'include',
-	root_path / 'abi' / 'include',
-	root_path / 'common' / 'include',
-]
-
-includes += include_directories(incdirs, is_system: true)
-
-allow_shared = true
-
-uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/libc"'
-foreach idir : incdirs
-	_sdir = meson.current_source_dir() / idir
-	uspace_lib_devel_install_script_text += 'cp -R -L -T "@0@" "${DESTDIR}include/libc"'.format(_sdir)
-	exported_devel_files += ['include', _sdir, 'libc']
-endforeach
-
-src = [ arch_src ]
-
-src += files(
-	'common/adt/bitmap.c',
-	'common/adt/checksum.c',
-	'common/adt/circ_buf.c',
-	'common/adt/hash_table.c',
-	'common/adt/list.c',
-	'common/adt/odict.c',
-	'common/gsort.c',
-	'common/printf/printf_core.c',
-	'common/stdc/bsearch.c',
-	'common/stdc/calloc.c',
-	'common/stdc/ctype.c',
-	'common/stdc/mem.c',
-	'common/stdc/qsort.c',
-	'common/stdc/snprintf.c',
-	'common/stdc/uchar.c',
-	'common/stdc/vsnprintf.c',
-	'common/stdc/wchar.c',
-	'common/str.c',
-	'common/str_error.c',
-	'common/strtol.c',
-
-	'generic/adt/prodcons.c',
-	'generic/arg_parse.c',
-	'generic/as.c',
-	'generic/assert.c',
-	'generic/async/client.c',
-	'generic/async/ports.c',
-	'generic/async/server.c',
-	'generic/capa.c',
-	'generic/config.c',
-	'generic/context.c',
-	'generic/dbgcon.c',
-	'generic/ddi.c',
-	'generic/device/clock_dev.c',
-	'generic/device/hw_res.c',
-	'generic/device/hw_res_parsed.c',
-	'generic/device/pio_window.c',
-	'generic/dirent.c',
-	'generic/dlfcn.c',
-	'generic/double_to_str.c',
-	'generic/elf/elf.c',
-	'generic/elf/elf_load.c',
-	'generic/elf/elf_mod.c',
-	'generic/errno.c',
-	'generic/event.c',
-	'generic/getopt.c',
-	'generic/ieee_double.c',
-	'generic/imath.c',
-	'generic/inttypes.c',
-	'generic/io/asprintf.c',
-	'generic/io/io.c',
-	'generic/io/kio.c',
-	'generic/io/klog.c',
-	'generic/io/log.c',
-	'generic/io/logctl.c',
-	'generic/io/printf.c',
-	'generic/io/table.c',
-	'generic/io/vprintf.c',
-	'generic/ipc.c',
-	'generic/irq.c',
-	'generic/l18n/langs.c',
-	'generic/libc.c',
-	'generic/loader.c',
-	'generic/loc.c',
-	'generic/malloc.c',
-	'generic/ns.c',
-	'generic/pcb.c',
-	'generic/perm.c',
-	'generic/pio_trace.c',
-	'generic/power_of_ten.c',
-	'generic/rndgen.c',
-	'generic/setjmp.c',
-	'generic/shutdown.c',
-	'generic/smc.c',
-	'generic/stack.c',
-	'generic/stacktrace.c',
-	'generic/stats.c',
-	'generic/stdio.c',
-	'generic/stdio/scanf.c',
-	'generic/stdio/sprintf.c',
-	'generic/stdio/sscanf.c',
-	'generic/stdio/sstream.c',
-	'generic/stdio/vsprintf.c',
-	'generic/stdlib.c',
-	'generic/string.c',
-	'generic/sysinfo.c',
-	'generic/task.c',
-	'generic/thread/fibril.c',
-	'generic/thread/fibril_synch.c',
-	'generic/thread/futex.c',
-	'generic/thread/mpsc.c',
-	'generic/thread/thread.c',
-	'generic/thread/tls.c',
-	'generic/time.c',
-	'generic/tmpfile.c',
-	'generic/ubsan.c',
-	'generic/udebug.c',
-	'generic/uuid.c',
-	'generic/vfs/canonify.c',
-	'generic/vfs/inbox.c',
-	'generic/vfs/mtab.c',
-	'generic/vfs/vfs.c',
-)
-
-if CONFIG_RTLD
-	src += files(
-		'generic/rtld/dynamic.c',
-		'generic/rtld/module.c',
-		'generic/rtld/rtld.c',
-		'generic/rtld/symbol.c',
-	)
-endif
-
-test_src = files(
-	'test/adt/circ_buf.c',
-	'test/adt/odict.c',
-	'test/capa.c',
-	'test/casting.c',
-	'test/double_to_str.c',
-	'test/fibril/timer.c',
-	'test/getopt.c',
-	'test/gsort.c',
-	'test/ieee_double.c',
-	'test/imath.c',
-	'test/inttypes.c',
-	'test/io/table.c',
-	'test/loc.c',
-	'test/main.c',
-	'test/mem.c',
-	'test/perf.c',
-	'test/perm.c',
-	'test/qsort.c',
-	'test/sprintf.c',
-	'test/stdio.c',
-	'test/stdio/scanf.c',
-	'test/stdlib.c',
-	'test/str.c',
-	'test/string.c',
-	'test/strtol.c',
-	'test/uchar.c',
-	'test/uuid.c',
-)
-
-# Startfiles.
-# This is what other systems know as crt*.o files, i.e. a set of object files
-# that are automatically built into every program binary (but not libraries).
-# We haven't yet installed the object files where the compiler can find them,
-# so we have to add them manually.
-#
-
-start_src = [ arch_start_src, files('generic/crt/crt1.c') ]
-
-libstartfiles = static_library('startfiles', start_src,
-	include_directories: includes,
-	c_args: arch_uspace_c_args + c_args,
-	pic: false,
-)
-exported_devel_files += ['staticlib', libstartfiles, 'libstartfiles.a']
-
-if CONFIG_DEVEL_FILES
-	install_files += [[ 'lib', libstartfiles.full_path(), 'libstartfiles.a' ]]
-	install_deps += [ libstartfiles ]
-endif
Index: pace/lib/c/test/adt/circ_buf.c
===================================================================
--- uspace/lib/c/test/adt/circ_buf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <adt/circ_buf.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(circ_buf);
-
-enum {
-	buffer_size = 16
-};
-
-static int buffer[buffer_size];
-
-/** Basic insertion/deletion test.
- *
- * Test initialization, emptiness, pushing buffer until it is full,
- * then emptying it again.
- */
-PCUT_TEST(push_pop)
-{
-	circ_buf_t cbuf;
-	int i;
-	int j;
-	errno_t rc;
-
-	circ_buf_init(&cbuf, buffer, buffer_size, sizeof(int));
-
-	for (i = 0; i < buffer_size; i++) {
-		PCUT_ASSERT_INT_EQUALS(buffer_size - i, circ_buf_nfree(&cbuf));
-		PCUT_ASSERT_INT_EQUALS(i, circ_buf_nused(&cbuf));
-		rc = circ_buf_push(&cbuf, &i);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	}
-
-	rc = circ_buf_push(&cbuf, &i);
-	PCUT_ASSERT_ERRNO_VAL(EAGAIN, rc);
-
-	for (i = 0; i < buffer_size; i++) {
-		PCUT_ASSERT_INT_EQUALS(i, circ_buf_nfree(&cbuf));
-		PCUT_ASSERT_INT_EQUALS(buffer_size - i, circ_buf_nused(&cbuf));
-		rc = circ_buf_pop(&cbuf, &j);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_INT_EQUALS(i, j);
-	}
-
-	PCUT_ASSERT_INT_EQUALS(buffer_size, circ_buf_nfree(&cbuf));
-	PCUT_ASSERT_INT_EQUALS(0, circ_buf_nused(&cbuf));
-
-	rc = circ_buf_pop(&cbuf, &j);
-	PCUT_ASSERT_ERRNO_VAL(EAGAIN, rc);
-}
-
-PCUT_EXPORT(circ_buf);
Index: pace/lib/c/test/adt/odict.c
===================================================================
--- uspace/lib/c/test/adt/odict.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,278 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <adt/odict.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/** Test entry */
-typedef struct {
-	odlink_t odict;
-	int key;
-} test_entry_t;
-
-enum {
-	/** Length of test number sequences */
-	test_seq_len = 100
-};
-
-/** Test get key function.
- *
- * @param odlink Ordered dictionary link
- * @return Pointer to key
- */
-static void *test_getkey(odlink_t *odlink)
-{
-	return &odict_get_instance(odlink, test_entry_t, odict)->key;
-}
-
-/** Test compare function.
- *
- * @param a First key
- * @param b Second key
- * @return <0, 0, >0 if @a a is less than, equal or greater than @a b
- */
-static int test_cmp(void *a, void *b)
-{
-	int *ia = (int *)a;
-	int *ib = (int *)b;
-
-	return *ia - *ib;
-}
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(odict);
-
-/** Increasing sequence test.
- *
- * Test initialization, emptiness, insertion of increasing sequence and walking.
- */
-PCUT_TEST(incr_seq)
-{
-	odict_t odict;
-	test_entry_t *e;
-	odlink_t *c;
-	int i;
-
-	odict_initialize(&odict, test_getkey, test_cmp);
-
-	PCUT_ASSERT_EQUALS(true, odict_empty(&odict));
-
-	for (i = 0; i < test_seq_len; i++) {
-		e = calloc(1, sizeof(test_entry_t));
-		PCUT_ASSERT_NOT_NULL(e);
-
-		e->key = i;
-		odict_insert(&e->odict, &odict, NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-	}
-
-	i = 0;
-	c = odict_first(&odict);
-	while (c != NULL) {
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(i, e->key);
-		c = odict_next(c, &odict);
-		++i;
-	}
-	PCUT_ASSERT_INT_EQUALS(test_seq_len, i);
-
-	i = test_seq_len;
-	c = odict_last(&odict);
-	while (c != NULL) {
-		--i;
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(i, e->key);
-		c = odict_prev(c, &odict);
-	}
-
-	PCUT_ASSERT_INT_EQUALS(0, i);
-}
-
-/** Decreasing sequence test.
- *
- * Test initialization, emptiness, insertion of decreasing sequence and walking.
- */
-PCUT_TEST(decr_seq)
-{
-	odict_t odict;
-	test_entry_t *e;
-	odlink_t *c;
-	int i;
-
-	odict_initialize(&odict, test_getkey, test_cmp);
-
-	PCUT_ASSERT_EQUALS(true, odict_empty(&odict));
-
-	for (i = 0; i < test_seq_len; i++) {
-		e = calloc(1, sizeof(test_entry_t));
-		PCUT_ASSERT_NOT_NULL(e);
-
-		e->key = test_seq_len - i - 1;
-		odict_insert(&e->odict, &odict, NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-	}
-
-	i = 0;
-	c = odict_first(&odict);
-	while (c != NULL) {
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(i, e->key);
-		c = odict_next(c, &odict);
-		++i;
-	}
-	PCUT_ASSERT_INT_EQUALS(test_seq_len, i);
-
-	i = test_seq_len;
-	c = odict_last(&odict);
-	while (c != NULL) {
-		--i;
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(i, e->key);
-		c = odict_prev(c, &odict);
-	}
-
-	PCUT_ASSERT_INT_EQUALS(0, i);
-}
-
-/** Increasing sequence insertion and removal test.
- *
- * Test sequential insertion of increasing sequence and sequential removal.
- */
-PCUT_TEST(incr_seq_ins_rem)
-{
-	odict_t odict;
-	test_entry_t *e;
-	odlink_t *c;
-	int i;
-
-	odict_initialize(&odict, test_getkey, test_cmp);
-
-	PCUT_ASSERT_EQUALS(true, odict_empty(&odict));
-
-	for (i = 0; i < test_seq_len; i++) {
-		e = calloc(1, sizeof(test_entry_t));
-		PCUT_ASSERT_NOT_NULL(e);
-
-		e->key = i;
-		odict_insert(&e->odict, &odict, NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-	}
-
-	i = 0;
-	c = odict_first(&odict);
-	while (c != NULL) {
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(i, e->key);
-
-		odict_remove(c);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-
-		c = odict_first(&odict);
-		++i;
-	}
-
-	PCUT_ASSERT_INT_EQUALS(test_seq_len, i);
-}
-
-/** Generate pseudorandom sequence. */
-static int seq_next(int cur)
-{
-	return (cur * 1951) % 1000000;
-}
-
-/** Test 4.
- *
- * Test inserting a pseudorandom sequence and then extracting it again.
- */
-PCUT_TEST(prseq_ins_extract)
-{
-	odict_t odict;
-	test_entry_t *e, *ep;
-	odlink_t *c, *d;
-	int prev;
-	int i;
-	int v;
-
-	odict_initialize(&odict, test_getkey, test_cmp);
-
-	PCUT_ASSERT_EQUALS(true, odict_empty(&odict));
-
-	v = 1;
-	ep = NULL;
-	for (i = 0; i < test_seq_len; i++) {
-		e = calloc(1, sizeof(test_entry_t));
-		PCUT_ASSERT_NOT_NULL(e);
-
-		e->key = v;
-		odict_insert(&e->odict, &odict, ep ? &ep->odict : NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-		v = seq_next(v);
-		ep = e;
-	}
-
-	/* Verify that entries are in ascending order */
-	c = odict_first(&odict);
-	prev = -1;
-	i = 0;
-	while (c != NULL) {
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_EQUALS(true, e->key > prev);
-
-		prev = e->key;
-		c = odict_next(c, &odict);
-		++i;
-	}
-
-	PCUT_ASSERT_INT_EQUALS(test_seq_len, i);
-
-	/* Try extracting the sequence */
-	v = 1;
-	for (i = 0; i < test_seq_len; i++) {
-		c = odict_find_eq(&odict, (void *)&v, NULL);
-		PCUT_ASSERT_NOT_NULL(c);
-
-		e = odict_get_instance(c, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(v, e->key);
-
-		d = odict_find_eq_last(&odict, (void *)&v, NULL);
-		PCUT_ASSERT_NOT_NULL(d);
-
-		e = odict_get_instance(d, test_entry_t, odict);
-		PCUT_ASSERT_INT_EQUALS(v, e->key);
-
-		odict_remove(c);
-		PCUT_ASSERT_ERRNO_VAL(EOK, odict_validate(&odict));
-
-		v = seq_next(v);
-	}
-}
-
-PCUT_EXPORT(odict);
Index: pace/lib/c/test/capa.c
===================================================================
--- uspace/lib/c/test/capa.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <capa.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(capa);
-
-PCUT_TEST(capa_format)
-{
-	int block_size = 4;
-	size_t block[] = {
-		0,
-		1,
-		2,
-		10,
-	};
-
-	int input_size = 5;
-	size_t input[] = {
-		0,
-		10,
-		100,
-		1000,
-		1000000,
-		1000000000,
-	};
-
-	const char *out[] = {
-		"0 B",
-		"0 B",
-		"0 B",
-		"0 B",
-
-		"0 B",
-		"10 B",
-		"20 B",
-		"100 B",
-
-		"0 B",
-		"100 B",
-		"200 B",
-		"1.000 kB",
-
-		"0 B",
-		"1.000 kB",
-		"2.000 kB",
-		"10.00 kB",
-
-		"0 B",
-		"1.000 MB",
-		"2.000 MB",
-		"10.00 MB",
-
-		"0 B",
-		"1.000 GB",
-		"2.000 GB",
-		"10.00 GB",
-	};
-
-	capa_spec_t capa;
-	char *str;
-	errno_t rc;
-
-	int x, i;
-	for (i = 0; i < input_size; i++) {
-		for (x = 0; x < block_size; x++) {
-			capa_from_blocks(input[i], block[x], &capa);
-			capa_simplify(&capa);
-
-			rc = capa_format(&capa, &str);
-
-			PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-			PCUT_ASSERT_STR_EQUALS(out[x + (block_size * i)], str);
-			free(str);
-
-			capa_from_blocks(block[x], input[i], &capa);
-			capa_simplify(&capa);
-
-			rc = capa_format(&capa, &str);
-
-			PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-			PCUT_ASSERT_STR_EQUALS(out[x + (block_size * i)], str);
-			free(str);
-		}
-	}
-}
-
-PCUT_TEST(capa_format_rounding)
-{
-	int input_size = 8;
-	uint64_t input[] = {
-		555,
-		5555,
-		55555,
-		555555555,
-		5555555555,
-		555999999,
-		5999999,
-		999999
-	};
-
-	const char *out[] = {
-		"555 B",
-		"5.555 kB",
-		"55.56 kB",
-		"555.6 MB",
-		"5.556 GB",
-		"556.0 MB",
-		"6.000 MB",
-		"1.000 MB",
-	};
-
-	capa_spec_t capa;
-	char *str;
-	errno_t rc;
-
-	int i;
-	for (i = 0; i < input_size; i++) {
-		capa_from_blocks(input[i], 1, &capa);
-		capa_simplify(&capa);
-
-		rc = capa_format(&capa, &str);
-
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_STR_EQUALS(out[i], str);
-		free(str);
-
-		capa_from_blocks(1, input[i], &capa);
-		capa_simplify(&capa);
-
-		rc = capa_format(&capa, &str);
-
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_STR_EQUALS(out[i], str);
-		free(str);
-	}
-}
-
-PCUT_TEST(capa_parse)
-{
-	int input_size = 4;
-	const char *input[] = {
-		"0 B",
-		"100 B",
-		"1 kB",
-		"1.555 kB",
-	};
-
-	int out_cunit[] = {
-		cu_byte,
-		cu_byte,
-		cu_kbyte,
-		cu_kbyte,
-	};
-
-	int out_dp[] = {
-		0,
-		0,
-		0,
-		3,
-	};
-
-	int out_m[] = {
-		0,
-		100,
-		1,
-		1555,
-	};
-
-	capa_spec_t capa;
-	errno_t rc;
-	int i;
-
-	for (i = 0; i < input_size; i++) {
-		rc = capa_parse(input[i], &capa);
-
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_INT_EQUALS(out_cunit[i], capa.cunit);
-		PCUT_ASSERT_INT_EQUALS(out_dp[i], capa.dp);
-		PCUT_ASSERT_INT_EQUALS(out_m[i], capa.m);
-	}
-}
-
-PCUT_TEST(capa_to_blocks)
-{
-	int input_size = 0;
-	int input_m[] = {
-		0,
-		1,
-		1000,
-		5555,
-		7777,
-	};
-
-	int input_dp[] = {
-		0,
-		0,
-		3,
-		3,
-		2,
-	};
-
-	int block[] = {
-		1,
-		1,
-		1,
-		2,
-		3,
-	};
-
-	int out_nom[] = {
-		0,
-		1000,
-		1000,
-		2778,
-		25923,
-	};
-
-	int out_min[] = {
-		0,
-		1000,
-		1000,
-		2777,
-		25923,
-	};
-
-	int out_max[] = {
-		0,
-		1000,
-		1000,
-		2778,
-		25924,
-	};
-
-	capa_spec_t capa;
-	errno_t rc;
-	int i;
-	uint64_t ret;
-
-	for (i = 0; i < input_size; i++) {
-		capa.m = input_m[i];
-		capa.dp = input_dp[i];
-		capa.cunit = cu_kbyte;
-
-		rc = capa_to_blocks(&capa, cv_nom, block[i], &ret);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_INT_EQUALS(out_nom[i], ret);
-
-		rc = capa_to_blocks(&capa, cv_min, block[i], &ret);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_INT_EQUALS(out_min[i], ret);
-
-		rc = capa_to_blocks(&capa, cv_max, block[i], &ret);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_INT_EQUALS(out_max[i], ret);
-	}
-}
-
-PCUT_EXPORT(capa);
Index: pace/lib/c/test/casting.c
===================================================================
--- uspace/lib/c/test/casting.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <limits.h>
-#include <types/casting.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(casting);
-
-/*
- * Following tests checks functionality of can_cast_size_t_to_int.
- */
-
-PCUT_TEST(size_t_to_int_with_small)
-{
-	PCUT_ASSERT_TRUE(can_cast_size_t_to_int(0));
-	PCUT_ASSERT_TRUE(can_cast_size_t_to_int(128));
-}
-
-PCUT_TEST(size_t_to_int_with_biggest_int)
-{
-	PCUT_ASSERT_TRUE(can_cast_size_t_to_int(INT_MAX));
-}
-
-PCUT_TEST(size_t_to_int_with_biggest_size_t)
-{
-	PCUT_ASSERT_FALSE(can_cast_size_t_to_int(SIZE_MAX));
-}
-
-PCUT_EXPORT(casting);
Index: pace/lib/c/test/double_to_str.c
===================================================================
--- uspace/lib/c/test/double_to_str.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <ieee_double.h>
-#include <double_to_str.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(double_to_str);
-
-PCUT_TEST(double_to_short_str_pos_zero)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(0.0);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("0", buf);
-}
-
-PCUT_TEST(double_to_short_str_neg_zero)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(-0.0);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("0", buf);
-}
-
-PCUT_TEST(double_to_short_str_pos_one)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1.0);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("1", buf);
-}
-
-PCUT_TEST(double_to_short_str_neg_one)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(-1.0);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("1", buf);
-}
-
-PCUT_TEST(double_to_short_str_small)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1.1);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(2, ret);
-	PCUT_ASSERT_INT_EQUALS(-1, dec);
-	PCUT_ASSERT_STR_EQUALS("11", buf);
-}
-
-PCUT_TEST(double_to_short_str_large)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1234.56789);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(9, ret);
-	PCUT_ASSERT_INT_EQUALS(-5, dec);
-	PCUT_ASSERT_STR_EQUALS("123456789", buf);
-}
-
-PCUT_TEST(double_to_short_str_mill)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1000000.0);
-	int ret = double_to_short_str(d, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(6, dec);
-	PCUT_ASSERT_STR_EQUALS("1", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_zero)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(0.0);
-	int ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("0", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_pos_one)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1.0);
-	int ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(4, ret);
-	PCUT_ASSERT_INT_EQUALS(-3, dec);
-	PCUT_ASSERT_STR_EQUALS("1000", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_neg_one)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(-1.0);
-	int ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(4, ret);
-	PCUT_ASSERT_INT_EQUALS(-3, dec);
-	PCUT_ASSERT_STR_EQUALS("1000", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_small)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1.1);
-	int ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(4, ret);
-	PCUT_ASSERT_INT_EQUALS(-3, dec);
-	PCUT_ASSERT_STR_EQUALS("1100", buf);
-
-	d = extract_ieee_double(768.0);
-	ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-	PCUT_ASSERT_INT_EQUALS(4, ret);
-	PCUT_ASSERT_INT_EQUALS(-3, dec);
-	PCUT_ASSERT_STR_EQUALS("768", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_large)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1234.56789);
-	int ret = double_to_fixed_str(d, -1, 3, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(7, ret);
-	PCUT_ASSERT_INT_EQUALS(-3, dec);
-	PCUT_ASSERT_STR_EQUALS("1234567", buf);
-}
-
-PCUT_TEST(double_to_fixed_str_nodecimals)
-{
-	size_t size = 255;
-	char buf[size];
-	int dec;
-	ieee_double_t d = extract_ieee_double(1.999);
-	int ret = double_to_fixed_str(d, -1, 0, buf, size, &dec);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(0, dec);
-	PCUT_ASSERT_STR_EQUALS("1", buf);
-}
-
-PCUT_EXPORT(double_to_str);
Index: pace/lib/c/test/fibril/timer.c
===================================================================
--- uspace/lib/c/test/fibril/timer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(fibril_timer);
-
-static void test_timeout_fn(void *arg)
-{
-	int *i;
-
-	i = (int *)arg;
-	++*i;
-}
-
-PCUT_TEST(create_destroy)
-{
-	fibril_timer_t *t;
-
-	t = fibril_timer_create(NULL);
-	PCUT_ASSERT_NOT_NULL(t);
-	fibril_timer_destroy(t);
-}
-
-PCUT_TEST(create_destroy_user_lock)
-{
-	fibril_mutex_t lock;
-	fibril_timer_t *t;
-
-	fibril_mutex_initialize(&lock);
-	t = fibril_timer_create(&lock);
-	PCUT_ASSERT_NOT_NULL(t);
-	fibril_timer_destroy(t);
-}
-
-PCUT_TEST(set_clear_locked)
-{
-	fibril_mutex_t lock;
-	fibril_timer_t *t;
-	fibril_timer_state_t fts;
-	int cnt;
-
-	fibril_mutex_initialize(&lock);
-	t = fibril_timer_create(&lock);
-	PCUT_ASSERT_NOT_NULL(t);
-
-	fibril_mutex_lock(&lock);
-	cnt = 0;
-
-	fibril_timer_set_locked(t, 100 * 1000 * 1000, test_timeout_fn, &cnt);
-	fibril_usleep(1000);
-	fts = fibril_timer_clear_locked(t);
-	PCUT_ASSERT_INT_EQUALS(fts_active, fts);
-
-	PCUT_ASSERT_INT_EQUALS(0, cnt);
-	fibril_mutex_unlock(&lock);
-
-	fibril_timer_destroy(t);
-}
-
-PCUT_TEST(set_clear_not_locked)
-{
-	fibril_mutex_t lock;
-	fibril_timer_t *t;
-	fibril_timer_state_t fts;
-	int cnt;
-
-	fibril_mutex_initialize(&lock);
-	t = fibril_timer_create(&lock);
-	PCUT_ASSERT_NOT_NULL(t);
-
-	cnt = 0;
-	fibril_timer_set(t, 100 * 1000 * 1000, test_timeout_fn, &cnt);
-	fibril_usleep(1000);
-	fts = fibril_timer_clear(t);
-	PCUT_ASSERT_INT_EQUALS(fts_active, fts);
-
-	PCUT_ASSERT_INT_EQUALS(0, cnt);
-
-	fibril_timer_destroy(t);
-}
-
-PCUT_TEST(fire)
-{
-	fibril_mutex_t lock;
-	fibril_timer_t *t;
-	fibril_timer_state_t fts;
-	int cnt;
-
-	fibril_mutex_initialize(&lock);
-	t = fibril_timer_create(&lock);
-	PCUT_ASSERT_NOT_NULL(t);
-
-	fibril_mutex_lock(&lock);
-	cnt = 0;
-
-	fibril_timer_set_locked(t, 100, test_timeout_fn, &cnt);
-	fibril_mutex_unlock(&lock);
-
-	fibril_usleep(1000);
-
-	fibril_mutex_lock(&lock);
-	fts = fibril_timer_clear_locked(t);
-	PCUT_ASSERT_INT_EQUALS(fts_fired, fts);
-
-	PCUT_ASSERT_INT_EQUALS(1, cnt);
-	fibril_mutex_unlock(&lock);
-
-	fibril_timer_destroy(t);
-}
-
-PCUT_EXPORT(fibril_timer);
Index: pace/lib/c/test/getopt.c
===================================================================
--- uspace/lib/c/test/getopt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,568 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <getopt.h>
-#include <stdio.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(getopt);
-
-PCUT_TEST(getopt_param_flag)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"-p",
-		"param",
-	};
-
-	const char *options = "fp:";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(4, optind);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_concat_flags)
-{
-	int argc = 2;
-	const char *argv[] = {
-		"get_opt_test",
-		"-fda",
-	};
-
-	const char *options = "afd";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(1, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('d', ret);
-	PCUT_ASSERT_INT_EQUALS(1, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('a', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_concat_flag_param)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"-fp",
-		"param"
-	};
-
-	const char *options = "fp:";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(1, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_missing_param1)
-{
-	int argc = 2;
-	const char *argv[] = {
-		"get_opt_test",
-		"-p",
-	};
-
-	const char *options = "p:";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('?', ret);
-	PCUT_ASSERT_INT_EQUALS('p', optopt);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_missing_param2)
-{
-	int argc = 2;
-	const char *argv[] = {
-		"get_opt_test",
-		"-p",
-	};
-
-	const char *options = ":p:";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS(':', ret);
-	PCUT_ASSERT_INT_EQUALS('p', optopt);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_illegal_option)
-{
-	int argc = 2;
-	const char *argv[] = {
-		"get_opt_test",
-		"-p",
-	};
-
-	const char *options = "a";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('?', ret);
-	PCUT_ASSERT_INT_EQUALS('p', optopt);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-
-	options = ":a";
-	optreset = 1;
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-	PCUT_ASSERT_INT_EQUALS('p', optopt);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_flag_with_param)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"param",
-		"-d"
-	};
-
-	const char *options = "fd";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	/* getopt() would print a error message but thx to opterror=0 it doesnt */
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('d', ret);
-	PCUT_ASSERT_INT_EQUALS(4, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_case_sensitive)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"-F",
-		"-f"
-	};
-
-	const char *options = "fF";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('F', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_optional_param)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"-pparam"
-	};
-
-	const char *options = "f::p::";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_NULL(optarg);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_special_option)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"--",
-		"-p"
-	};
-
-	const char *options = "fp";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_gnu_plus)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"break",
-		"-p"
-	};
-
-	const char *options = "+fp";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_gnu_minus)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"-f",
-		"break",
-		"-p"
-	};
-
-	const char *options = "-fp";
-
-	int ret;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-	PCUT_ASSERT_STR_EQUALS("break", optarg);
-
-	ret = getopt(argc, (char *const *)argv, options);
-
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(4, optind);
-
-	ret = getopt(argc, (char *const *)argv, options);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_long_flag_param)
-{
-	int argc = 4;
-	const char *argv[] = {
-		"get_opt_test",
-		"--flag",
-		"--parameter",
-		"param"
-	};
-
-	const char *options = "fp:";
-
-	const struct option long_options[] = {
-		{ "flag", no_argument, NULL, 'f' },
-		{ "parameter", required_argument, NULL, 'p' },
-	};
-
-	int ret;
-	int idx;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_INT_EQUALS(0, idx);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(4, optind);
-	PCUT_ASSERT_INT_EQUALS(1, idx);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_long_alt_param)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"--flag=\"param param\"",
-		"--parameter=param",
-	};
-
-	const char *options = "f:p:";
-
-	const struct option long_options[] = {
-		{ "flag", required_argument, NULL, 'f' },
-		{ "parameter", required_argument, NULL, 'p' },
-		{ 0, 0, 0, 0 }
-	};
-
-	int ret;
-	int idx;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_INT_EQUALS(0, idx);
-	PCUT_ASSERT_STR_EQUALS("\"param param\"", optarg);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-	PCUT_ASSERT_INT_EQUALS(1, idx);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_long_optional_param)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"--flag=param",
-		"--parameter",
-	};
-
-	const char *options = "f::p::";
-
-	const struct option long_options[] = {
-		{ "flag", optional_argument, NULL, 'f' },
-		{ "parameter", optional_argument, NULL, 'p' },
-		{ 0, 0, 0, 0 }
-	};
-
-	int ret;
-	int idx;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('f', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_INT_EQUALS(0, idx);
-	PCUT_ASSERT_STR_EQUALS("param", optarg);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('p', ret);
-	PCUT_ASSERT_INT_EQUALS(3, optind);
-	PCUT_ASSERT_INT_EQUALS(1, idx);
-	PCUT_ASSERT_NULL(optarg);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_long_illegal_option)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"--param",
-		"param",
-	};
-
-	const char *options = "f::";
-
-	const struct option long_options[] = {
-		{ "cflag", required_argument, NULL, 'c' },
-		{ "flag", required_argument, NULL, 'f' },
-		{ 0, 0, 0, 0 }
-	};
-
-	int ret;
-	int idx;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('?', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_INT_EQUALS(0, idx);
-	PCUT_ASSERT_INT_EQUALS(0, optopt);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_TEST(getopt_long_ambiguous_param)
-{
-	int argc = 3;
-	const char *argv[] = {
-		"get_opt_test",
-		"--flag",
-		"param",
-	};
-
-	const char *options = "f::";
-
-	const struct option long_options[] = {
-		{ "flag1", optional_argument, NULL, 'f' },
-		{ "flag2", required_argument, NULL, 'f' },
-		{ 0, 0, 0, 0 }
-	};
-
-	int ret;
-	int idx;
-	optreset = 1;
-	opterr = 0;
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS('?', ret);
-	PCUT_ASSERT_INT_EQUALS(2, optind);
-	PCUT_ASSERT_INT_EQUALS(0, idx);
-	PCUT_ASSERT_INT_EQUALS(0, optopt);
-
-	ret = getopt_long(argc, (char *const *)argv, options, long_options, &idx);
-	PCUT_ASSERT_INT_EQUALS(-1, ret);
-}
-
-PCUT_EXPORT(getopt);
Index: pace/lib/c/test/gsort.c
===================================================================
--- uspace/lib/c/test/gsort.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <gsort.h>
-
-static int cmp_func(void *a, void *b, void *param)
-{
-	int ia = *(int *)a;
-	int ib = *(int *)b;
-
-	if (ia == ib)
-		return 0;
-
-	return ia < ib ? -1 : 1;
-}
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(gsort);
-
-/* sort ascending */
-PCUT_TEST(gsort_asc)
-{
-	int size = 10;
-	int data[size];
-
-	for (int i = 0; i < size; i++) {
-		data[i] = i;
-	}
-
-	bool ret = gsort(data, size, sizeof(int), cmp_func, NULL);
-	PCUT_ASSERT_TRUE(ret);
-
-	for (int i = 0; i < size; i++) {
-		PCUT_ASSERT_INT_EQUALS(i, data[i]);
-	}
-}
-
-/* sort ascending including double entries of the same number */
-PCUT_TEST(gsort_asc_complex)
-{
-	int size = 10;
-	int data[size];
-
-	for (int i = 0; i < size; i++) {
-		data[i] = (i * 13) % 9;
-	}
-
-	data[0] = 2;
-	data[1] = 0;
-	data[2] = 4;
-	data[3] = 1;
-
-	bool ret = gsort(data, size, sizeof(int), cmp_func, NULL);
-	PCUT_ASSERT_TRUE(ret);
-
-	int prev = data[0];
-	for (int i = 1; i < size; i++) {
-		PCUT_ASSERT_TRUE(prev <= data[i]);
-		prev = data[i];
-	}
-}
-
-/* sort descanding */
-PCUT_TEST(gsort_desc)
-{
-	int size = 10;
-	int data[size];
-
-	for (int i = 0; i < size; i++) {
-		data[i] = size - i;
-	}
-
-	bool ret = gsort(&data, size, sizeof(int), cmp_func, NULL);
-	PCUT_ASSERT_TRUE(ret);
-
-	for (int i = 0; i < size; i++) {
-		PCUT_ASSERT_INT_EQUALS(i + 1, data[i]);
-	}
-}
-
-PCUT_EXPORT(gsort);
Index: pace/lib/c/test/ieee_double.c
===================================================================
--- uspace/lib/c/test/ieee_double.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,289 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <ieee_double.h>
-
-union {
-	uint64_t integer;
-	double floating;
-} ieee_double_bits;
-
-const int EXP_BIAS = 1023;
-const int EXP_BIAS_UNDERFLOWED = 1075;
-const int SIGN_SHIFT = 52;
-const uint64_t HIDDEN_BIT = 1ULL << SIGN_SHIFT;
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ieee_double);
-
-PCUT_TEST(extract_ieee_sizeof_double)
-{
-	PCUT_ASSERT_INT_EQUALS(8, sizeof(double));
-}
-
-PCUT_TEST(extract_ieee_double_pos_infinity)
-{
-	ieee_double_bits.integer = 0x7FF0000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_TRUE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_TRUE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_neg_infinity)
-{
-	ieee_double_bits.integer = 0xFFF0000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_TRUE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_TRUE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_nan)
-{
-	ieee_double_bits.integer = 0xFFFFFFFFFFFFFFFFULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_TRUE(d.is_special);
-	PCUT_ASSERT_TRUE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_pos_zero)
-{
-	ieee_double_bits.integer = 0x0000000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.significand);
-}
-
-PCUT_TEST(extract_ieee_double_neg_zero)
-{
-	ieee_double_bits.integer = 0x8000000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0, d.pos_val.significand);
-}
-
-PCUT_TEST(extract_ieee_double_normal_pos_one)
-{
-	ieee_double_bits.integer = 0x3FF0000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_TRUE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(EXP_BIAS - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_normal_neg_one)
-{
-	ieee_double_bits.integer = 0xBFF0000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_TRUE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(EXP_BIAS - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_denormal_pos_smallest)
-{
-	ieee_double_bits.integer = 0x0000000000000001ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(1, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_denormal_neg_smallest)
-{
-	ieee_double_bits.integer = 0x8000000000000001ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(1, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_denormal_pos_largest)
-{
-	ieee_double_bits.integer = 0x000FFFFFFFFFFFFFULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0xFFFFFFFFFFFFFULL, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_denormal_neg_largest)
-{
-	ieee_double_bits.integer = 0x800FFFFFFFFFFFFFULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_TRUE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-	PCUT_ASSERT_INT_EQUALS(0xFFFFFFFFFFFFFULL, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_normal_pos_smallest)
-{
-	ieee_double_bits.integer = 0x0010000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_normal_neg_smallest)
-{
-	ieee_double_bits.integer = 0x8010000000000000ULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(1 - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_normal_pos_largest)
-{
-	ieee_double_bits.integer = 0x7FEFFFFFFFFFFFFFULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_FALSE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0xFFFFFFFFFFFFFULL + HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(0x7FEULL - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_TEST(extract_ieee_double_normal_neg_largest)
-{
-	ieee_double_bits.integer = 0xFFEFFFFFFFFFFFFFULL;
-	ieee_double_t d = extract_ieee_double(ieee_double_bits.floating);
-
-	PCUT_ASSERT_FALSE(d.is_special);
-	PCUT_ASSERT_FALSE(d.is_nan);
-	PCUT_ASSERT_FALSE(d.is_infinity);
-	PCUT_ASSERT_TRUE(d.is_negative);
-	PCUT_ASSERT_FALSE(d.is_denormal);
-	PCUT_ASSERT_FALSE(d.is_accuracy_step);
-
-	PCUT_ASSERT_INT_EQUALS(0xFFFFFFFFFFFFFULL + HIDDEN_BIT, d.pos_val.significand);
-	PCUT_ASSERT_INT_EQUALS(0x7FEULL - EXP_BIAS_UNDERFLOWED, d.pos_val.exponent);
-}
-
-PCUT_EXPORT(ieee_double);
Index: pace/lib/c/test/imath.c
===================================================================
--- uspace/lib/c/test/imath.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <imath.h>
-
-static uint64_t MAX_NUM = 10000000000000000000U;
-static unsigned MAX_EXP = 19;
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(imath);
-
-PCUT_TEST(ipow10_u64_zero)
-{
-	errno_t ret;
-	uint64_t result;
-	ret = ipow10_u64(0, &result);
-
-	PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-	PCUT_ASSERT_INT_EQUALS(1, result);
-}
-
-PCUT_TEST(ipow10_u64_one)
-{
-	errno_t ret;
-	uint64_t result;
-	ret = ipow10_u64(1, &result);
-
-	PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-	PCUT_ASSERT_INT_EQUALS(10, result);
-}
-
-PCUT_TEST(ipow10_u64_max)
-{
-	errno_t ret;
-	uint64_t result;
-	ret = ipow10_u64(MAX_EXP, &result);
-
-	PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-	PCUT_ASSERT_INT_EQUALS(MAX_NUM, result);
-}
-
-PCUT_TEST(ipow10_u64_too_large)
-{
-	errno_t ret;
-	uint64_t result;
-	ret = ipow10_u64(MAX_EXP + 1, &result);
-
-	PCUT_ASSERT_ERRNO_VAL(ERANGE, ret);
-}
-
-PCUT_TEST(ilog10_u64_zero)
-{
-	unsigned ret = ilog10_u64(0);
-	PCUT_ASSERT_INT_EQUALS(0, ret);
-}
-
-PCUT_TEST(ilog10_u64_one)
-{
-	unsigned ret = ilog10_u64(1);
-	PCUT_ASSERT_INT_EQUALS(0, ret);
-}
-
-PCUT_TEST(ilog10_u64_max)
-{
-	unsigned ret = ilog10_u64(MAX_NUM);
-	PCUT_ASSERT_INT_EQUALS(MAX_EXP, ret);
-}
-
-PCUT_EXPORT(imath);
Index: pace/lib/c/test/inttypes.c
===================================================================
--- uspace/lib/c/test/inttypes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Test greatest-width integer types
- */
-
-#include <pcut/pcut.h>
-#include <inttypes.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(inttypes);
-
-PCUT_TEST(decls)
-{
-	/* Make sure intmax_t is defined */
-	intmax_t i;
-	(void) i;
-
-	/* Make sure imaxdiv_t is defined */
-	imaxdiv_t d;
-	(void) d;
-}
-
-/** llabs function of positive number */
-PCUT_TEST(imaxabs_pos)
-{
-	intmax_t i;
-
-	i = imaxabs(1);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** llabs function of negative number */
-PCUT_TEST(imaxabs_neg)
-{
-	intmax_t i;
-
-	i = imaxabs(-1);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** Greatest-width integer division */
-PCUT_TEST(imaxdiv)
-{
-	imaxdiv_t d;
-
-	d = imaxdiv(41, 7);
-	PCUT_ASSERT_INT_EQUALS(5, d.quot);
-	PCUT_ASSERT_INT_EQUALS(6, d.rem);
-}
-
-PCUT_EXPORT(inttypes);
Index: pace/lib/c/test/io/table.c
===================================================================
--- uspace/lib/c/test/io/table.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <io/table.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(table);
-
-PCUT_TEST(smoke)
-{
-	table_t *table;
-	errno_t rc;
-
-	rc = table_create(&table);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	table_header_row(table);
-	rc = table_printf(table, "A\t" "B\t" "C\t" "D\n");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = table_printf(table, "1\t" "2\t" "3\t" "4\n");
-	rc = table_printf(table, "i\t" "ii\t" "iii\t" "iv\n");
-	table_destroy(table);
-}
-
-PCUT_EXPORT(table);
Index: pace/lib/c/test/loc.c
===================================================================
--- uspace/lib/c/test/loc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(loc);
-
-/** loc_server_register() can be called multiple times */
-PCUT_TEST(server_register)
-{
-	errno_t rc;
-	loc_srv_t *sa, *sb;
-	service_id_t svca, svcb;
-	char *na, *nb;
-	char *sna, *snb;
-
-	rc = loc_server_register("test-a", &sa);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_server_register("test-b", &sb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	// XXX Without a unique name this is not reentrant
-	rc = loc_service_register(sa, "test/libc-service-a", &svca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	// XXX Without a unique name this is not reentrant
-	rc = loc_service_register(sb, "test/libc-service-b", &svcb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_get_name(svca, &na);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("test/libc-service-a", na);
-
-	rc = loc_service_get_server_name(svca, &sna);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("test-a", sna);
-
-	rc = loc_service_get_name(svcb, &nb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("test/libc-service-b", nb);
-
-	rc = loc_service_get_server_name(svcb, &snb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("test-b", snb);
-
-	rc = loc_service_unregister(sa, svca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = loc_service_unregister(sb, svcb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	loc_server_unregister(sa);
-	loc_server_unregister(sb);
-}
-
-PCUT_EXPORT(loc);
Index: pace/lib/c/test/main.c
===================================================================
--- uspace/lib/c/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(capa);
-PCUT_IMPORT(casting);
-PCUT_IMPORT(circ_buf);
-PCUT_IMPORT(double_to_str);
-PCUT_IMPORT(fibril_timer);
-PCUT_IMPORT(getopt);
-PCUT_IMPORT(gsort);
-PCUT_IMPORT(ieee_double);
-PCUT_IMPORT(imath);
-PCUT_IMPORT(inttypes);
-PCUT_IMPORT(loc);
-PCUT_IMPORT(mem);
-PCUT_IMPORT(odict);
-PCUT_IMPORT(perf);
-PCUT_IMPORT(perm);
-PCUT_IMPORT(qsort);
-PCUT_IMPORT(scanf);
-PCUT_IMPORT(sprintf);
-PCUT_IMPORT(stdio);
-PCUT_IMPORT(stdlib);
-PCUT_IMPORT(str);
-PCUT_IMPORT(string);
-PCUT_IMPORT(strtol);
-PCUT_IMPORT(table);
-PCUT_IMPORT(uchar);
-PCUT_IMPORT(uuid);
-
-PCUT_MAIN();
Index: pace/lib/c/test/mem.c
===================================================================
--- uspace/lib/c/test/mem.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <mem.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(mem);
-
-/** memcpy function */
-PCUT_TEST(memcpy)
-{
-	char buf[5];
-	void *p;
-
-	p = memcpy(buf, "abc\0d", 5);
-	PCUT_ASSERT_TRUE(p == buf);
-
-	PCUT_ASSERT_INT_EQUALS('a', buf[0]);
-	PCUT_ASSERT_INT_EQUALS('b', buf[1]);
-	PCUT_ASSERT_INT_EQUALS('c', buf[2]);
-	PCUT_ASSERT_INT_EQUALS('\0', buf[3]);
-	PCUT_ASSERT_INT_EQUALS('d', buf[4]);
-}
-
-/** memmove function */
-PCUT_TEST(memmove)
-{
-	char buf[] = "abc\0d";
-	void *p;
-
-	p = memmove(buf, buf + 1, 4);
-	PCUT_ASSERT_TRUE(p == buf);
-
-	PCUT_ASSERT_INT_EQUALS('b', buf[0]);
-	PCUT_ASSERT_INT_EQUALS('c', buf[1]);
-	PCUT_ASSERT_INT_EQUALS('\0', buf[2]);
-	PCUT_ASSERT_INT_EQUALS('d', buf[3]);
-	PCUT_ASSERT_INT_EQUALS('d', buf[4]);
-}
-
-/** memcmp function */
-PCUT_TEST(memcmp)
-{
-	const char *s1 = "ab" "\0" "1d";
-	const char *s2 = "ab" "\0" "2d";
-	int c;
-
-	c = memcmp(s1, s2, 3);
-	PCUT_ASSERT_INT_EQUALS(0, c);
-
-	c = memcmp(s1, s2, 4);
-	PCUT_ASSERT_TRUE(c < 0);
-
-	c = memcmp(s2, s1, 4);
-	PCUT_ASSERT_TRUE(c > 0);
-}
-
-/** memchr function */
-PCUT_TEST(memchr)
-{
-	const char *s = "abc\0d";
-	void *p;
-
-	p = memchr(s, 'd', 5);
-	PCUT_ASSERT_TRUE(p == s + 4);
-
-	p = memchr(s, '\0', 5);
-	PCUT_ASSERT_TRUE(p == s + 3);
-
-	p = memchr(s, 'd', 4);
-	PCUT_ASSERT_TRUE(p == NULL);
-}
-
-/** memset function */
-PCUT_TEST(memset)
-{
-	char buf[5];
-	void *p;
-
-	buf[0] = buf[1] = buf[2] = buf[3] = buf[4] = 'a';
-	p = memset(buf, 'x', 5);
-	PCUT_ASSERT_TRUE(p == buf);
-
-	PCUT_ASSERT_INT_EQUALS('x', buf[0]);
-	PCUT_ASSERT_INT_EQUALS('x', buf[1]);
-	PCUT_ASSERT_INT_EQUALS('x', buf[2]);
-	PCUT_ASSERT_INT_EQUALS('x', buf[3]);
-	PCUT_ASSERT_INT_EQUALS('x', buf[4]);
-}
-
-PCUT_EXPORT(mem);
Index: pace/lib/c/test/perf.c
===================================================================
--- uspace/lib/c/test/perf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <fibril.h>
-#include <perf.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(perf);
-
-/* Checks that initialization zeroes out all entries. */
-PCUT_TEST(zero_diff)
-{
-	stopwatch_t sw;
-	stopwatch_init(&sw);
-	PCUT_ASSERT_INT_EQUALS(0, (int) stopwatch_get_nanos(&sw));
-}
-
-/* Checks that initialization zeroes out all entries. */
-PCUT_TEST(zero_diff_static)
-{
-	stopwatch_t sw = STOPWATCH_INITIALIZE_STATIC;
-	PCUT_ASSERT_INT_EQUALS(0, (int) stopwatch_get_nanos(&sw));
-}
-
-/* Checks that measuring 1s sleep does not give completely invalid results. */
-PCUT_TEST(stopwatch_smokes)
-{
-	stopwatch_t sw = STOPWATCH_INITIALIZE_STATIC;
-	stopwatch_start(&sw);
-	fibril_sleep(1);
-	stopwatch_stop(&sw);
-	nsec_t diff_nanos = stopwatch_get_nanos(&sw);
-	PCUT_ASSERT_TRUE(diff_nanos > MSEC2NSEC(500));
-	PCUT_ASSERT_TRUE(diff_nanos < SEC2NSEC(5));
-}
-
-/* Checks that setting time works for small values. */
-PCUT_TEST(stopwatch_emulation_works_small)
-{
-	stopwatch_t sw = STOPWATCH_INITIALIZE_STATIC;
-	stopwatch_set_nanos(&sw, 42);
-	PCUT_ASSERT_INT_EQUALS(42, (int) stopwatch_get_nanos(&sw));
-}
-
-/* Checks that setting time works for big values too. */
-PCUT_TEST(stopwatch_emulation_works_big)
-{
-	stopwatch_t sw = STOPWATCH_INITIALIZE_STATIC;
-	stopwatch_set_nanos(&sw, 4200000000021);
-	PCUT_ASSERT_EQUALS(4200000000021, (long long) stopwatch_get_nanos(&sw));
-}
-
-PCUT_EXPORT(perf);
Index: pace/lib/c/test/perm.c
===================================================================
--- uspace/lib/c/test/perm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <task.h>
-#include <pcut/pcut.h>
-#include <perm.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(perm);
-
-PCUT_TEST(revoke)
-{
-	errno_t rc = perm_revoke(task_get_id(), 0xf); // XXX Need PERM_xxx
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(perm);
Index: pace/lib/c/test/qsort.c
===================================================================
--- uspace/lib/c/test/qsort.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <qsort.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-enum {
-	/** Length of test number sequences */
-	test_seq_len = 5
-};
-
-/** Test compare function.
- *
- * @param a First key
- * @param b Second key
- * @return <0, 0, >0 if @a a is less than, equal or greater than @a b
- */
-static int test_cmp(const void *a, const void *b)
-{
-	int *ia = (int *)a;
-	int *ib = (int *)b;
-
-	return *ia - *ib;
-}
-
-static void bubble_sort(int *seq, size_t nmemb)
-{
-	size_t i;
-	size_t j;
-	int t;
-
-	for (i = 0; i < nmemb - 1; i++)
-		for (j = 0; j < nmemb - 1; j++) {
-			if (seq[j] > seq[j + 1]) {
-				t = seq[j];
-				seq[j] = seq[j + 1];
-				seq[j + 1] = t;
-			}
-		}
-}
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(qsort);
-
-/** Test sorting already sorted increasing sequence */
-PCUT_TEST(incr_seq)
-{
-	int *seq;
-	int i;
-
-	seq = calloc(test_seq_len, sizeof(int));
-	PCUT_ASSERT_NOT_NULL(seq);
-
-	for (i = 0; i < test_seq_len; i++)
-		seq[i] = i;
-
-	qsort(seq, test_seq_len, sizeof(int), test_cmp);
-
-	for (i = 0; i < test_seq_len; i++) {
-		PCUT_ASSERT_INT_EQUALS(i, seq[i]);
-	}
-
-	free(seq);
-}
-
-/** Test sorting reverse-sorted decreasing sequence. */
-PCUT_TEST(decr_seq)
-{
-	int *seq;
-	int i;
-
-	seq = calloc(test_seq_len, sizeof(int));
-	PCUT_ASSERT_NOT_NULL(seq);
-
-	for (i = 0; i < test_seq_len; i++)
-		seq[i] = test_seq_len - 1 - i;
-
-	qsort(seq, test_seq_len, sizeof(int), test_cmp);
-
-	for (i = 0; i < test_seq_len; i++) {
-		PCUT_ASSERT_INT_EQUALS(i, seq[i]);
-	}
-
-	free(seq);
-}
-
-/** Test sorting reverse-sorted decreasing sequence where each member repeats twice. */
-PCUT_TEST(decr2_seq)
-{
-	int *seq;
-	int i;
-
-	seq = calloc(test_seq_len, sizeof(int));
-	PCUT_ASSERT_NOT_NULL(seq);
-
-	for (i = 0; i < test_seq_len; i++) {
-		seq[i] = (test_seq_len - 1 - i) / 2;
-	}
-
-	qsort(seq, test_seq_len, sizeof(int), test_cmp);
-
-	for (i = 0; i < test_seq_len; i++) {
-		PCUT_ASSERT_INT_EQUALS(i / 2, seq[i]);
-	}
-
-	free(seq);
-}
-
-/** Generate pseudorandom sequence. */
-static int seq_next(int cur)
-{
-	return (cur * 1951) % 1000000;
-}
-
-/** Test sorting pseudorandom sequence. */
-PCUT_TEST(pseudorandom_seq)
-{
-	int *seq, *seq2;
-	int i;
-	int v;
-
-	seq = calloc(test_seq_len, sizeof(int));
-	PCUT_ASSERT_NOT_NULL(seq);
-
-	seq2 = calloc(test_seq_len, sizeof(int));
-	PCUT_ASSERT_NOT_NULL(seq);
-
-	v = 1;
-	for (i = 0; i < test_seq_len; i++) {
-		seq[i] = v;
-		seq2[i] = v;
-		v = seq_next(v);
-	}
-
-	qsort(seq, test_seq_len, sizeof(int), test_cmp);
-	bubble_sort(seq2, test_seq_len);
-
-	for (i = 0; i < test_seq_len; i++) {
-		PCUT_ASSERT_INT_EQUALS(seq2[i], seq[i]);
-	}
-
-	free(seq);
-	free(seq2);
-}
-
-PCUT_EXPORT(qsort);
Index: pace/lib/c/test/sprintf.c
===================================================================
--- uspace/lib/c/test/sprintf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <str.h>
-#include <pcut/pcut.h>
-
-#pragma GCC diagnostic ignored "-Wformat"
-
-#define BUFFER_SIZE 8192
-#define TEQ(expected, actual) PCUT_ASSERT_STR_EQUALS(expected, actual)
-#define TF(expected, format, ...) TEQ(expected, fmt(format, ##__VA_ARGS__))
-
-#define SPRINTF_TEST(test_name, expected_string, actual_format, ...) \
-	PCUT_TEST(printf_##test_name) { \
-		snprintf(buffer, BUFFER_SIZE, actual_format, ##__VA_ARGS__); \
-		PCUT_ASSERT_STR_EQUALS(expected_string, buffer); \
-	}
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(sprintf);
-
-static char buffer[BUFFER_SIZE];
-
-PCUT_TEST_BEFORE
-{
-	memset(buffer, 0, BUFFER_SIZE);
-}
-
-SPRINTF_TEST(no_formatting, "This is a test.", "This is a test.");
-
-SPRINTF_TEST(string_plain, "some text", "%s", "some text");
-
-SPRINTF_TEST(string_dynamic_width, "  tex", "%*.*s", 5, 3, "text");
-
-SPRINTF_TEST(string_dynamic_width_align_left, "text   ", "%-*.*s", 7, 7, "text");
-
-SPRINTF_TEST(string_pad, "    text", "%8.10s", "text");
-
-SPRINTF_TEST(string_pad_but_cut, "  very lon", "%10.8s", "very long text");
-
-SPRINTF_TEST(char_basic, "[a]", "[%c]", 'a');
-
-SPRINTF_TEST(int_various_padding, "[1] [ 02] [03 ] [004] [005]",
-    "[%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]",
-    1, 2, 3, 4, 5);
-
-SPRINTF_TEST(int_negative_various_padding, "[-1] [-02] [-03] [-004] [-005]",
-    "[%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]",
-    -1, -2, -3, -4, -5);
-
-SPRINTF_TEST(long_negative_various_padding, "[-1] [-02] [-03] [-004] [-005]",
-    "[%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]",
-    (long long) -1, (long long) -2, (long long) -3, (long long) -4,
-    (long long) -5);
-
-SPRINTF_TEST(int_as_hex, "[1a] [  02b] [03c  ] [    04d] [05e    ] [0006f] [00080]",
-    "[%x] [%5.3x] [%-5.3x] [%7.3x] [%-7.3x] [%3.5x] [%-3.5x]",
-    26, 43, 60, 77, 94, 111, 128);
-
-SPRINTF_TEST(int_as_hex_alt, "[0x1a] [0x02b] [0x03c] [  0x04d] [0x05e  ] [0x0006f] [0x00080]",
-    "[%#x] [%#5.3x] [%#-5.3x] [%#7.3x] [%#-7.3x] [%#3.5x] [%#-3.5x]",
-    26, 43, 60, 77, 94, 111, 128);
-
-SPRINTF_TEST(int_as_hex_uc, "[1A] [  02B] [03C  ] [    04D] [05E    ] [0006F] [00080]",
-    "[%X] [%5.3X] [%-5.3X] [%7.3X] [%-7.3X] [%3.5X] [%-3.5X]",
-    26, 43, 60, 77, 94, 111, 128);
-
-SPRINTF_TEST(int_as_hex_alt_uc, "[0X1A] [0X02B] [0X03C] [  0X04D] [0X05E  ] [0X0006F] [0X00080]",
-    "[%#X] [%#5.3X] [%#-5.3X] [%#7.3X] [%#-7.3X] [%#3.5X] [%#-3.5X]",
-    26, 43, 60, 77, 94, 111, 128);
-
-SPRINTF_TEST(max_negative, "-9223372036854775808", "%" PRId64, INT64_MIN);
-
-SPRINTF_TEST(sign1, "[12] [ 12] [+12] [+12] [+12] [+12]",   "[%d] [% d] [%+d] [% +d] [%+ d] [%++ ++    +  ++++d]", 12, 12, 12, 12, 12, 12);
-SPRINTF_TEST(sign2, "[-12] [-12] [-12] [-12] [-12] [-12]", "[%d] [% d] [%+d] [% +d] [%+ d] [%++ ++    +  ++++d]", -12, -12, -12, -12, -12, -12);
-
-/* When zero padding and precision and/or left justification are both specified, zero padding is ignored. */
-SPRINTF_TEST(zero_left_padding, "[    0012] [0034    ] [56      ]", "[%08.4d] [%-08.4d] [%-08d]", 12, 34, 56);
-
-/* Zero padding comes after the sign, but space padding doesn't. */
-SPRINTF_TEST(sign_padding, "[00012] [   12] [ 0012] [   12] [+0012] [  +12]", "[%05d] [%5d] [%0 5d] [% 5d] [%0+5d] [%+5d]", 12, 12, 12, 12, 12, 12);
-SPRINTF_TEST(sign_padding2, "[-0012] [  -12] [-0012] [  -12] [-0012] [  -12]", "[%05d] [%5d] [%0 5d] [% 5d] [%0+5d] [%+5d]", -12, -12, -12, -12, -12, -12);
-
-SPRINTF_TEST(all_zero, "[00000] [0] [0] [0] [0] [0] [0] [0] [0]", "[%05d] [%d] [%x] [%#x] [%o] [%#o] [%b] [%#b] [%u]", 0, 0, 0, 0, 0, 0, 0, 0, 0);
-
-PCUT_EXPORT(sprintf);
Index: pace/lib/c/test/stdio.c
===================================================================
--- uspace/lib/c/test/stdio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,227 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Test stdio module
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <str.h>
-#include <tmpfile.h>
-#include <vfs/vfs.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(stdio);
-
-/** remove function */
-PCUT_TEST(remove)
-{
-	char buf[L_tmpnam];
-	char *p;
-	FILE *f;
-	int rc;
-
-	/* Generate unique file name */
-	p = tmpnam(buf);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Removing it should fail */
-	rc = remove(buf);
-	PCUT_ASSERT_TRUE(rc != 0);
-
-	f = fopen(buf, "wx");
-	PCUT_ASSERT_NOT_NULL(f);
-	fclose(f);
-
-	/* Remove for the first time */
-	rc = remove(buf);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-
-	/* Should fail the second time */
-	rc = remove(buf);
-	PCUT_ASSERT_TRUE(rc != 0);
-}
-
-/** rename function */
-PCUT_TEST(rename)
-{
-	char buf1[L_tmpnam];
-	char buf2[L_tmpnam];
-	char *p;
-	FILE *f;
-	int rc;
-
-	/* Generate first unique file name */
-	p = tmpnam(buf1);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Generate second unique file name */
-	p = tmpnam(buf2);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	f = fopen(buf1, "wx");
-	PCUT_ASSERT_NOT_NULL(f);
-	fclose(f);
-
-	/* Rename to the second name */
-	rc = rename(buf1, buf2);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-
-	/* First name should no longer exist */
-	rc = remove(buf1);
-	PCUT_ASSERT_TRUE(rc != 0);
-
-	/* Second can be removed */
-	rc = remove(buf2);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** tmpfile function */
-PCUT_TEST(tmpfile)
-{
-	FILE *f;
-	char c;
-	size_t n;
-
-	f = tmpfile();
-	PCUT_ASSERT_NOT_NULL(f);
-
-	c = 'x';
-	n = fwrite(&c, sizeof(c), 1, f);
-	PCUT_ASSERT_INT_EQUALS(1, n);
-
-	rewind(f);
-	c = '\0';
-	n = fread(&c, sizeof(c), 1, f);
-	PCUT_ASSERT_INT_EQUALS(1, n);
-	PCUT_ASSERT_INT_EQUALS('x', c);
-
-	fclose(f);
-}
-
-/** tmpnam function with buffer argument */
-PCUT_TEST(tmpnam_buf)
-{
-	char buf[L_tmpnam];
-	char *p;
-	FILE *f;
-
-	p = tmpnam(buf);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	f = fopen(p, "w+x");
-	PCUT_ASSERT_NOT_NULL(f);
-	(void) remove(p);
-	fclose(f);
-}
-
-/** tmpnam function called twice */
-PCUT_TEST(tmpnam_twice)
-{
-	char buf1[L_tmpnam];
-	char buf2[L_tmpnam];
-	char *p;
-
-	p = tmpnam(buf1);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	p = tmpnam(buf2);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* We must get two distinct names */
-	PCUT_ASSERT_TRUE(str_cmp(buf1, buf2) != 0);
-}
-
-/** tmpnam function with NULL argument */
-PCUT_TEST(tmpnam_null)
-{
-	char *p;
-	FILE *f;
-
-	p = tmpnam(NULL);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	f = fopen(p, "w+x");
-	PCUT_ASSERT_NOT_NULL(f);
-	(void) remove(p);
-	fclose(f);
-}
-
-/** fgetpos and fsetpos functions */
-PCUT_TEST(fgetpos_setpos)
-{
-	fpos_t pos;
-	int rc;
-	FILE *f;
-
-	f = tmpfile();
-	PCUT_ASSERT_NOT_NULL(f);
-
-	rc = fputs("abc", f);
-	PCUT_ASSERT_TRUE(rc >= 0);
-
-	rc = fgetpos(f, &pos);
-	PCUT_ASSERT_TRUE(rc >= 0);
-
-	rewind(f);
-
-	rc = fsetpos(f, &pos);
-	PCUT_ASSERT_TRUE(rc >= 0);
-
-	(void) fclose(f);
-}
-
-/** perror function with NULL as argument */
-PCUT_TEST(perror_null_msg)
-{
-	errno = EINVAL;
-	perror(NULL);
-}
-
-/** perror function with empty string as argument */
-PCUT_TEST(perror_empty_msg)
-{
-	errno = EINVAL;
-	perror("");
-}
-
-/** perror function with a message argument */
-PCUT_TEST(perror_msg)
-{
-	errno = EINVAL;
-	perror("This is a test");
-}
-
-PCUT_EXPORT(stdio);
Index: pace/lib/c/test/stdio/scanf.c
===================================================================
--- uspace/lib/c/test/stdio/scanf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1314 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Test formatted input (scanf family)
- */
-
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#pragma GCC diagnostic ignored "-Wformat-zero-length"
-#pragma GCC diagnostic ignored "-Wformat"
-#pragma GCC diagnostic ignored "-Wformat-extra-args"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(scanf);
-
-enum {
-	chars_size = 10
-};
-
-/** Empty format string */
-PCUT_TEST(empty_fmt)
-{
-	int rc;
-
-	rc = sscanf("42", "");
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** Decimal integer */
-PCUT_TEST(dec_int)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("42", "%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Two integers */
-PCUT_TEST(int_int)
-{
-	int rc;
-	int i, j;
-
-	rc = sscanf("42 43", "%d%d", &i, &j);
-	PCUT_ASSERT_INT_EQUALS(2, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-	PCUT_ASSERT_TRUE(j == 43);
-}
-
-/** Decimal signed char */
-PCUT_TEST(dec_sign_char)
-{
-	int rc;
-	signed char sc;
-
-	rc = sscanf("42", "%hhd", &sc);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(sc == 42);
-}
-
-/** Decimal short */
-PCUT_TEST(dec_short)
-{
-	int rc;
-	short si;
-
-	rc = sscanf("42", "%hd", &si);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(si == 42);
-}
-
-/** Decimal long */
-PCUT_TEST(dec_long)
-{
-	int rc;
-	long li;
-
-	rc = sscanf("42", "%ld", &li);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(li == 42);
-}
-
-/** Decimal long long */
-PCUT_TEST(dec_long_long)
-{
-	int rc;
-	long long lli;
-
-	rc = sscanf("42", "%lld", &lli);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(lli == 42);
-}
-
-/** Decimal intmax_t */
-PCUT_TEST(dec_intmax)
-{
-	int rc;
-	intmax_t imax;
-
-	rc = sscanf("42", "%jd", &imax);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(imax == 42);
-}
-
-/** Decimal size_t-sized */
-PCUT_TEST(dec_size_t_size)
-{
-	int rc;
-	size_t szi;
-
-	rc = sscanf("42", "%zd", &szi);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(szi == 42);
-}
-
-/** Decimal ptrdiff_t-sized */
-PCUT_TEST(dec_ptrdiff_t_size)
-{
-	int rc;
-	ptrdiff_t pdi;
-
-	rc = sscanf("42", "%td", &pdi);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(pdi == 42);
-}
-
-/** Decimal integer followed by hexadecimal digit */
-PCUT_TEST(dec_int_hexdigit)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("42a", "%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Decimal integer - detect no prefix */
-PCUT_TEST(int_noprefix)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("42", "%i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Prefixed octal integer followed by decimal digit */
-PCUT_TEST(octal_decimal_digit)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("019", "%i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** Prefixed hexadecimal integer followed by other character */
-PCUT_TEST(hex_other_char)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("0xag", "%i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 10);
-}
-
-/** Decimal integer with '+' sign */
-PCUT_TEST(positive_dec)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("+42", "%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Decimal integer with '-' sign */
-PCUT_TEST(negative_dec)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("-42", "%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == -42);
-}
-
-/** Hexadecimal integer with prefix and '-' sign */
-PCUT_TEST(negative_hex)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("-0xa", "%i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == -10);
-}
-
-/** Decimal unsigned integer */
-PCUT_TEST(dec_unsigned)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("42", "%u", &u);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 42);
-}
-
-/** Decimal unsigned char */
-PCUT_TEST(dec_unsigned_char)
-{
-	int rc;
-	unsigned char uc;
-
-	rc = sscanf("42", "%hhu", &uc);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(uc == 42);
-}
-
-/** Decimal unsigned short */
-PCUT_TEST(dec_unsigned_short)
-{
-	int rc;
-	unsigned short su;
-
-	rc = sscanf("42", "%hu", &su);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(su == 42);
-}
-
-/** Decimal unsigned long */
-PCUT_TEST(dec_unsigned_long)
-{
-	int rc;
-	unsigned long lu;
-
-	rc = sscanf("42", "%lu", &lu);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(lu == 42);
-}
-
-/** Decimal unsigned long long */
-PCUT_TEST(dec_unsigned_long_long)
-{
-	int rc;
-	unsigned long long llu;
-
-	rc = sscanf("42", "%llu", &llu);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(llu == 42);
-}
-
-/** Decimal uintmax_t */
-PCUT_TEST(dec_unitmax)
-{
-	int rc;
-	uintmax_t umax;
-
-	rc = sscanf("42", "%ju", &umax);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(umax == 42);
-}
-
-/** Decimal size_t */
-PCUT_TEST(dec_unsigned_size)
-{
-	int rc;
-	size_t szu;
-
-	rc = sscanf("42", "%zu", &szu);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(szu == 42);
-}
-
-/** Decimal ptrdiff_t-sized unsigned int */
-PCUT_TEST(dec_unsigned_ptrdiff)
-{
-	int rc;
-	ptrdiff_t pdu;
-
-	rc = sscanf("42", "%tu", &pdu);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(pdu == 42);
-}
-
-/** Octal unsigned integer */
-PCUT_TEST(octal_unsigned)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("52", "%o", &u);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 052);
-}
-
-/** Hexadecimal unsigned integer */
-PCUT_TEST(hex_unsigned)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("2a", "%x", &u);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 0x2a);
-}
-
-/** Hexadecimal unsigned integer unsing alternate specifier */
-PCUT_TEST(hex_unsigned_cap_x)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("2a", "%X", &u);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 0x2a);
-}
-
-/** Uppercase hexadecimal unsigned integer */
-PCUT_TEST(uppercase_hex_unsigned)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("2A", "%x", &u);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 0x2a);
-}
-
-/** Make sure %x does not match 0x prefix */
-PCUT_TEST(hex_not_match_0x)
-{
-	int rc;
-	unsigned u;
-
-	rc = sscanf("0x1", "%x", &u);
-
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(u == 0);
-}
-
-/** Skipping whitespace */
-PCUT_TEST(skipws)
-{
-	int rc;
-	int i;
-
-	rc = sscanf(" \t\n42", "%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Percentile conversion */
-PCUT_TEST(percentile)
-{
-	int rc;
-	int i;
-
-	rc = sscanf(" \t\n%42", "%%%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Matching specific character */
-PCUT_TEST(match_spec_char)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("x42", "x%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Matching specific character should not skip whitespace */
-PCUT_TEST(match_char_noskipws)
-{
-	int rc;
-	int i;
-
-	rc = sscanf(" x42", "x%d", &i);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** Skipping whitespace + match specific character */
-PCUT_TEST(skipws_match_char)
-{
-	int rc;
-	int i;
-
-	rc = sscanf(" x42", "\t\nx%d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Decimal with limited, but sufficient width */
-PCUT_TEST(dec_sufficient_lim_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("42", "%2d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Decimal with limited, smaller width */
-PCUT_TEST(dec_smaller_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("42", "%1d", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 4);
-}
-
-/** Integer with hex prefix, format with limited, sufficient width */
-PCUT_TEST(int_hex_limited_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("0x1", "%3i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** Integer with hex prefix, format with limited, smaller width */
-PCUT_TEST(int_hex_small_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("0x1", "%2i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 0);
-}
-
-/** Integer with octal prefix, format with limited, sufficient width */
-PCUT_TEST(int_oct_limited_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("012", "%3i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 012);
-}
-
-/** Integer with octal prefix, format with limited, smaller width */
-PCUT_TEST(int_oct_smaller_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("012", "%2i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 01);
-}
-
-/** Integer with octal prefix, format with width allowing just for 0 */
-PCUT_TEST(int_oct_tiny_width)
-{
-	int rc;
-	int i;
-
-	rc = sscanf("012", "%1i", &i);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(i == 0);
-}
-
-/** Pointer */
-PCUT_TEST(pointer)
-{
-	int rc;
-	void *ptr;
-
-	rc = sscanf("0xABCDEF88", "%p", &ptr);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(ptr == (void *)0xABCDEF88);
-}
-
-/** Single character */
-PCUT_TEST(single_char)
-{
-	int rc;
-	char c;
-
-	rc = sscanf("x", "%c", &c);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(c == 'x');
-}
-
-/** Single whitespace character */
-PCUT_TEST(single_ws_char)
-{
-	int rc;
-	char c;
-
-	rc = sscanf("\t", "%c", &c);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(c == '\t');
-}
-
-/** Multiple characters */
-PCUT_TEST(chars)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc", "%3c", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == 'X');
-}
-
-/** Fewer characters than requested */
-PCUT_TEST(fewer_chars)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc", "%5c", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == 'X');
-}
-
-/** Reading characters but no found */
-PCUT_TEST(chars_not_found)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("", "%5c", chars);
-	PCUT_ASSERT_INT_EQUALS(EOF, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'X');
-}
-
-/** Multiple characters with suppressed assignment */
-PCUT_TEST(chars_noassign)
-{
-	int rc;
-	int n;
-
-	rc = sscanf("abc", "%*3c%n", &n);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-	PCUT_ASSERT_INT_EQUALS(3, n);
-}
-
-/** Multiple characters with memory allocation */
-PCUT_TEST(chars_malloc)
-{
-	int rc;
-	char *cp;
-
-	cp = NULL;
-	rc = sscanf("abc", "%m3c", &cp);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_NOT_NULL(cp);
-	PCUT_ASSERT_TRUE(cp[0] == 'a');
-	PCUT_ASSERT_TRUE(cp[1] == 'b');
-	PCUT_ASSERT_TRUE(cp[2] == 'c');
-	free(cp);
-}
-
-/** String of non-whitespace characters, unlimited width */
-PCUT_TEST(str)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf(" abc d", "%s", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** String of non-whitespace characters, until the end */
-PCUT_TEST(str_till_end)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf(" abc", "%s", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** String of non-whitespace characters, large enough width */
-PCUT_TEST(str_large_width)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf(" abc d", "%5s", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Want string of non-whitespace, but got only whitespace */
-PCUT_TEST(str_not_found)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf(" ", "%s", chars);
-	PCUT_ASSERT_INT_EQUALS(EOF, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'X');
-}
-
-/** String of non-whitespace characters, small width */
-PCUT_TEST(str_small_width)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf(" abc", "%2s", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == '\0');
-	PCUT_ASSERT_TRUE(chars[3] == 'X');
-}
-
-/** String of non-whitespace characters, assignment suppression */
-PCUT_TEST(str_noassign)
-{
-	int rc;
-	int n;
-
-	rc = sscanf(" abc d", "%*s%n", &n);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-	PCUT_ASSERT_INT_EQUALS(4, n);
-}
-
-/** String of non-whitespace characters, memory allocation */
-PCUT_TEST(str_malloc)
-{
-	int rc;
-	char *cp;
-
-	rc = sscanf(" abc d", "%ms", &cp);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_NOT_NULL(cp);
-	PCUT_ASSERT_TRUE(cp[0] == 'a');
-	PCUT_ASSERT_TRUE(cp[1] == 'b');
-	PCUT_ASSERT_TRUE(cp[2] == 'c');
-	PCUT_ASSERT_TRUE(cp[3] == '\0');
-	free(cp);
-}
-
-/** Set conversion without width specified terminating before the end  */
-PCUT_TEST(set_convert)
-{
-	int rc;
-	char chars[chars_size];
-	int i;
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abcd42", "%[abc]d%d", chars, &i);
-	PCUT_ASSERT_INT_EQUALS(2, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** Set conversion without width specified, until the end */
-PCUT_TEST(set_till_end)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc", "%[abc]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with larger width */
-PCUT_TEST(set_large_width)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abcd", "%5[abc]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with smaller width */
-PCUT_TEST(set_small_width)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abcd", "%3[abcd]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with negated scanset */
-PCUT_TEST(set_inverted)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abcd", "%[^d]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with ']' in scanset */
-PCUT_TEST(set_with_rbr)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("]bcd", "%[]bc]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == ']');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with ']' in inverted scanset */
-PCUT_TEST(set_inverted_with_rbr)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc]", "%[^]def]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with leading '-' in scanset */
-PCUT_TEST(set_with_leading_dash)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("a-bc[", "%[-abc]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == '-');
-	PCUT_ASSERT_TRUE(chars[2] == 'b');
-	PCUT_ASSERT_TRUE(chars[3] == 'c');
-	PCUT_ASSERT_TRUE(chars[4] == '\0');
-	PCUT_ASSERT_TRUE(chars[5] == 'X');
-}
-
-/** Set conversion with trailing '-' in scanset */
-PCUT_TEST(set_with_trailing_dash)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("a-bc]", "%[abc-]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == '-');
-	PCUT_ASSERT_TRUE(chars[2] == 'b');
-	PCUT_ASSERT_TRUE(chars[3] == 'c');
-	PCUT_ASSERT_TRUE(chars[4] == '\0');
-	PCUT_ASSERT_TRUE(chars[5] == 'X');
-}
-
-/** Set conversion with leading '-' in inverted scanset */
-PCUT_TEST(set_inverted_with_leading_dash)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("def-", "%[^-abc]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'd');
-	PCUT_ASSERT_TRUE(chars[1] == 'e');
-	PCUT_ASSERT_TRUE(chars[2] == 'f');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** ']' after '^' in scanset does not lose meaning of scanset delimiter */
-PCUT_TEST(set_inverted_with_only_dash)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc-", "%[^-]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** '^' after '-' in scanset does not have special meaning */
-PCUT_TEST(set_inverted_with_dash_caret)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("-^a", "%[-^a]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == '-');
-	PCUT_ASSERT_TRUE(chars[1] == '^');
-	PCUT_ASSERT_TRUE(chars[2] == 'a');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with range (GNU extension) */
-PCUT_TEST(set_with_range)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abc]", "%[a-c]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with range (GNU extension) in inverted scanset */
-PCUT_TEST(set_inverted_with_range)
-{
-	int rc;
-	char chars[chars_size];
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("defb", "%[^a-c]", chars);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'd');
-	PCUT_ASSERT_TRUE(chars[1] == 'e');
-	PCUT_ASSERT_TRUE(chars[2] == 'f');
-	PCUT_ASSERT_TRUE(chars[3] == '\0');
-	PCUT_ASSERT_TRUE(chars[4] == 'X');
-}
-
-/** Set conversion with assignment suppression */
-PCUT_TEST(set_noassign)
-{
-	int rc;
-	int n;
-
-	rc = sscanf("abcd42", "%*[abc]%n", &n);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-	PCUT_ASSERT_INT_EQUALS(3, n);
-}
-
-/** Set conversion with memory allocation */
-PCUT_TEST(set_malloc)
-{
-	int rc;
-	char *cp;
-
-	cp = NULL;
-	rc = sscanf("abcd42", "%m[abcd]", &cp);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_NOT_NULL(cp);
-	PCUT_ASSERT_TRUE(cp[0] == 'a');
-	PCUT_ASSERT_TRUE(cp[1] == 'b');
-	PCUT_ASSERT_TRUE(cp[2] == 'c');
-	PCUT_ASSERT_TRUE(cp[3] == 'd');
-	PCUT_ASSERT_TRUE(cp[4] == '\0');
-	free(cp);
-}
-
-/** Decimal integer with suppressed assignment */
-PCUT_TEST(dec_int_noassign)
-{
-	int rc;
-	int n;
-
-	rc = sscanf("42", "%*d%n", &n);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-	PCUT_ASSERT_INT_EQUALS(2, n);
-}
-
-/** Count of characters read */
-PCUT_TEST(count_chars)
-{
-	int rc;
-	char chars[chars_size];
-	int n;
-
-	memset(chars, 'X', chars_size);
-	rc = sscanf("abcd", "%3c%n", chars, &n);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(chars[0] == 'a');
-	PCUT_ASSERT_TRUE(chars[1] == 'b');
-	PCUT_ASSERT_TRUE(chars[2] == 'c');
-	PCUT_ASSERT_TRUE(chars[3] == 'X');
-	PCUT_ASSERT_INT_EQUALS(3, n);
-}
-
-/** Float with just integer part */
-PCUT_TEST(float_intpart_only)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 42.0);
-}
-
-/** Double with just integer part */
-PCUT_TEST(double_intpart_only)
-{
-	int rc;
-	double d;
-
-	rc = sscanf("42", "%lf", &d);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(d == 42.0);
-}
-
-/** Long double with just integer part */
-PCUT_TEST(ldouble_intpart_only)
-{
-	int rc;
-	long double ld;
-
-	rc = sscanf("42", "%Lf", &ld);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(ld == 42.0);
-}
-
-/** Float with just hexadecimal integer part */
-PCUT_TEST(float_hex_intpart_only)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("0x2a", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 0x2a.0p0);
-}
-
-/** Float with sign and integer part */
-PCUT_TEST(float_sign_intpart)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("-42", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == -42.0);
-}
-
-/** Float with integer and fractional part */
-PCUT_TEST(float_intpart_fract)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("4.2", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 4.199);
-	PCUT_ASSERT_TRUE(f < 4.201);
-}
-
-/** Float with integer part and unsigned exponent */
-PCUT_TEST(float_intpart_exp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float with integer part and positive exponent */
-PCUT_TEST(float_intpart_posexp)
-{
-	int rc;
-	float f;
-	rc = sscanf("42e+1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float with integer part and negative exponent */
-PCUT_TEST(float_intpart_negexp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e-1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 4.199);
-	PCUT_ASSERT_TRUE(f < 4.201);
-}
-
-/** Float with integer, fractional parts and unsigned exponent */
-PCUT_TEST(float_intpart_fract_exp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("4.2e1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 42.0);
-}
-
-/** Hexadecimal float with integer and fractional part */
-PCUT_TEST(hexfloat_intpart_fract)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("0x2.a", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 0x2.ap0);
-}
-
-/** Hexadecimal float with integer part and unsigned exponent */
-PCUT_TEST(hexfloat_intpart_exp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("0x2ap1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 0x2ap1);
-}
-
-/** Hexadecimal float with integer part and negative exponent */
-PCUT_TEST(hexfloat_intpart_negexp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("0x2ap-1", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 0x2ap-1);
-}
-
-/** Hexadecimal float with integer, fractional parts and unsigned exponent */
-PCUT_TEST(hexfloat_intpart_fract_exp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("0x2.ap4", "%f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 0x2.ap4);
-}
-
-/** Float with just integer part and limited width */
-PCUT_TEST(float_intpart_limwidth)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("1234", "%3f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 123.0);
-}
-
-/** Float with integer, fractional part and limited width */
-PCUT_TEST(float_intpart_fract_limwidth)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("12.34", "%4f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 12.29);
-	PCUT_ASSERT_TRUE(f < 12.31);
-}
-
-/** Float with width only enough to cover an integral part */
-PCUT_TEST(float_width_for_only_intpart)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("12.34", "%3f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 12.0);
-}
-
-/** Float with width too small to cover the exponent number */
-PCUT_TEST(float_width_small_for_expnum)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("12.34e+2", "%7f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 12.339);
-	PCUT_ASSERT_TRUE(f < 12.341);
-}
-
-/** Float with width too small to cover the exponent sign and number */
-PCUT_TEST(float_width_small_for_expsignum)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("12.34e+2", "%6f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 12.339);
-	PCUT_ASSERT_TRUE(f < 12.341);
-}
-
-/** Float with width too small to cover the exponent part */
-PCUT_TEST(float_width_small_for_exp)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("12.34e+2", "%5f", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	/* 1/10 is not exactly representable in binary floating point */
-	PCUT_ASSERT_TRUE(f > 12.339);
-	PCUT_ASSERT_TRUE(f < 12.341);
-}
-
-/** Float using alternate form 'F' */
-PCUT_TEST(float_cap_f)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%F", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'a' */
-PCUT_TEST(float_a)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%a", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'e' */
-PCUT_TEST(float_e)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%e", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'g' */
-PCUT_TEST(float_g)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%g", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'A' */
-PCUT_TEST(float_cap_a)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%A", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'E' */
-PCUT_TEST(float_cap_e)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%E", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-/** Float using alternate form 'G' */
-PCUT_TEST(float_cap_g)
-{
-	int rc;
-	float f;
-
-	rc = sscanf("42e1", "%G", &f);
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-	PCUT_ASSERT_TRUE(f == 420.0);
-}
-
-PCUT_EXPORT(scanf);
Index: pace/lib/c/test/stdlib.c
===================================================================
--- uspace/lib/c/test/stdlib.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,342 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Test General utilities (stdlib.h)
- */
-
-#include <pcut/pcut.h>
-#include <stdlib.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(stdlib);
-
-PCUT_TEST(decls)
-{
-	/* Make sure size_t is defined */
-	size_t sz = 0;
-	(void) sz;
-
-	/* Make sure char32_t is defined */
-	char32_t wc = L'\0';
-	(void) wc;
-
-	/* Make sure EXIT_FAILURE and EXIT_SUCCESS are defined */
-	if (0)
-		exit(EXIT_FAILURE);
-	if (0)
-		exit(EXIT_SUCCESS);
-
-	/* Make sure NULL is defined */
-	void *ptr = NULL;
-	(void) ptr;
-}
-
-/** strtold function */
-#include <stdio.h>
-PCUT_TEST(strtold)
-{
-	long double ld;
-	const char *str = " \t4.2e1@";
-	char *endptr;
-
-	ld = strtold(str, &endptr);
-	printf("ld=%.10lf\n", (double)ld);
-	PCUT_ASSERT_TRUE(ld == 42.0);
-}
-
-/** rand function */
-PCUT_TEST(rand)
-{
-	int i;
-	int r;
-
-	for (i = 0; i < 100; i++) {
-		r = rand();
-		PCUT_ASSERT_TRUE(r >= 0);
-		PCUT_ASSERT_TRUE(r <= RAND_MAX);
-	}
-
-	PCUT_ASSERT_TRUE(RAND_MAX >= 32767);
-}
-
-/** srand function */
-PCUT_TEST(srand)
-{
-	int r1;
-	int r2;
-
-	srand(1);
-	r1 = rand();
-	srand(1);
-	r2 = rand();
-
-	PCUT_ASSERT_INT_EQUALS(r2, r1);
-
-	srand(42);
-	r1 = rand();
-	srand(42);
-	r2 = rand();
-
-	PCUT_ASSERT_INT_EQUALS(r2, r1);
-}
-
-/** Just make sure we have memory allocation function prototypes */
-PCUT_TEST(malloc)
-{
-	void *p;
-
-#if 0
-	// TODO
-	p = aligned_alloc(4, 8);
-	PCUT_ASSERT_NOT_NULL(p);
-	free(p);
-#endif
-	p = calloc(4, 4);
-	PCUT_ASSERT_NOT_NULL(p);
-	free(p);
-
-	p = malloc(4);
-	PCUT_ASSERT_NOT_NULL(p);
-	p = realloc(p, 2);
-	PCUT_ASSERT_NOT_NULL(p);
-	free(p);
-}
-
-/** Just check abort() is defined */
-PCUT_TEST(abort)
-{
-	if (0)
-		abort();
-}
-
-static void dummy_exit_handler(void)
-{
-}
-
-/** atexit function */
-PCUT_TEST(atexit)
-{
-	int rc;
-
-	rc = atexit(dummy_exit_handler);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** exit function -- just make sure it is declared */
-PCUT_TEST(exit)
-{
-	if (0)
-		exit(0);
-}
-
-/** at_quick_exit function */
-PCUT_TEST(at_quick_exit)
-{
-	int rc;
-
-	rc = at_quick_exit(dummy_exit_handler);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** quick_exit function -- just make sure it is declared */
-PCUT_TEST(quick_exit)
-{
-	if (0)
-		quick_exit(0);
-}
-
-/** getenv function */
-PCUT_TEST(getenv)
-{
-	char *s;
-
-	s = getenv("FOO");
-	PCUT_ASSERT_NULL(s);
-}
-
-/** Test availability of command processor */
-PCUT_TEST(system_null)
-{
-	int rc;
-
-	rc = system(NULL);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-}
-
-/** Test running a command */
-PCUT_TEST(system_cmd)
-{
-	int rc;
-
-	/* This should fail as system is just a stub */
-	rc = system("/app/bdsh");
-	PCUT_ASSERT_INT_EQUALS(1, rc);
-}
-
-/** Comparison function for bsearch test */
-static int test_compar(const void *a, const void *b)
-{
-	const int *ia, *ib;
-
-	ia = (const int *)a;
-	ib = (const int *)b;
-
-	return *ia - *ib;
-}
-
-PCUT_TEST(bsearch)
-{
-	int numbers[] = { 1, 2, 6, 7, 7, 10, 100, 120 };
-	int k;
-	void *r;
-
-	k = 0;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NULL(r);
-
-	k = 1;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NOT_NULL(r);
-	PCUT_ASSERT_INT_EQUALS(1, *(int *)r);
-
-	k = 3;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NULL(r);
-
-	k = 6;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NOT_NULL(r);
-	PCUT_ASSERT_INT_EQUALS(6, *(int *)r);
-
-	k = 7;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NOT_NULL(r);
-	PCUT_ASSERT_INT_EQUALS(7, *(int *)r);
-
-	k = 200;
-	r = bsearch(&k, numbers, sizeof(numbers) / sizeof(int), sizeof(int),
-	    test_compar);
-	PCUT_ASSERT_NULL(r);
-}
-
-/** abs function of positive number */
-PCUT_TEST(abs_pos)
-{
-	int i;
-
-	i = abs(1);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** abs function of negative number */
-PCUT_TEST(abs_neg)
-{
-	int i;
-
-	i = abs(-1);
-	PCUT_ASSERT_TRUE(i == 1);
-}
-
-/** labs function of positive number */
-PCUT_TEST(labs_pos)
-{
-	long li;
-
-	li = labs(1);
-	PCUT_ASSERT_TRUE(li == 1);
-}
-
-/** labs function of negative number */
-PCUT_TEST(labs_neg)
-{
-	long li;
-
-	li = labs(-1);
-	PCUT_ASSERT_TRUE(li == 1);
-}
-
-/** llabs function of positive number */
-PCUT_TEST(llabs_pos)
-{
-	long long lli;
-
-	lli = llabs(1);
-	PCUT_ASSERT_TRUE(lli == 1);
-}
-
-/** llabs function of negative number */
-PCUT_TEST(llabs_neg)
-{
-	long long lli;
-
-	lli = llabs(-1);
-	PCUT_ASSERT_TRUE(lli == 1);
-}
-
-/** Integer division */
-PCUT_TEST(div_func)
-{
-	div_t d;
-
-	d = div(41, 7);
-	PCUT_ASSERT_INT_EQUALS(5, d.quot);
-	PCUT_ASSERT_INT_EQUALS(6, d.rem);
-}
-
-/** Long integer division */
-PCUT_TEST(ldiv_func)
-{
-	ldiv_t d;
-
-	d = ldiv(41, 7);
-	PCUT_ASSERT_INT_EQUALS(5, d.quot);
-	PCUT_ASSERT_INT_EQUALS(6, d.rem);
-}
-
-/** Long long integer division */
-PCUT_TEST(lldiv_func)
-{
-	lldiv_t d;
-
-	d = lldiv(41, 7);
-	PCUT_ASSERT_INT_EQUALS(5, d.quot);
-	PCUT_ASSERT_INT_EQUALS(6, d.rem);
-}
-
-PCUT_EXPORT(stdlib);
Index: pace/lib/c/test/str.c
===================================================================
--- uspace/lib/c/test/str.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,262 +1,0 @@
-/*
- * Copyright (c) 2015 Michal Koutny
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "pcut/asserts.h"
-#include <assert.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <str.h>
-#include <pcut/pcut.h>
-
-#define BUFFER_SIZE 256
-
-#define SET_BUFFER(str) snprintf(buffer, BUFFER_SIZE, "%s", str)
-#define EQ(expected, value) PCUT_ASSERT_STR_EQUALS(expected, value)
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(str);
-
-static char buffer[BUFFER_SIZE];
-
-PCUT_TEST_BEFORE
-{
-	memset(buffer, 0, BUFFER_SIZE);
-}
-
-/* Helper to display string contents for debugging */
-static void print_string_hex(char *out, const char *s, size_t len)
-{
-	*out++ = '"';
-	for (size_t i = 0; i < len && s[i]; i++) {
-		if (s[i] >= 32 && s[i] <= 126)
-			*out++ = s[i];
-		else
-			out += snprintf(out, 5, "\\x%02x", (uint8_t) s[i]);
-	}
-	*out++ = '"';
-	*out++ = 0;
-}
-
-PCUT_TEST(rtrim)
-{
-	SET_BUFFER("foobar");
-	str_rtrim(buffer, ' ');
-	EQ("foobar", buffer);
-
-	SET_BUFFER("  foobar  ");
-	str_rtrim(buffer, ' ');
-	EQ("  foobar", buffer);
-
-	SET_BUFFER("  ššš  ");
-	str_rtrim(buffer, ' ');
-	EQ("  ššš", buffer);
-
-	SET_BUFFER("ššAAAšš");
-	str_rtrim(buffer, L'š');
-	EQ("ššAAA", buffer);
-}
-
-PCUT_TEST(ltrim)
-{
-	SET_BUFFER("foobar");
-	str_ltrim(buffer, ' ');
-	EQ("foobar", buffer);
-
-	SET_BUFFER("  foobar  ");
-	str_ltrim(buffer, ' ');
-	EQ("foobar  ", buffer);
-
-	SET_BUFFER("  ššš  ");
-	str_ltrim(buffer, ' ');
-	EQ("ššš  ", buffer);
-
-	SET_BUFFER("ššAAAšš");
-	str_ltrim(buffer, L'š');
-	EQ("AAAšš", buffer);
-}
-
-PCUT_TEST(str_str_found)
-{
-	const char *hs = "abracadabra";
-	const char *n = "raca";
-	char *p;
-
-	p = str_str(hs, n);
-	PCUT_ASSERT_TRUE((const char *)p == hs + 2);
-}
-
-PCUT_TEST(str_str_not_found)
-{
-	const char *hs = "abracadabra";
-	const char *n = "racab";
-	char *p;
-
-	p = str_str(hs, n);
-	PCUT_ASSERT_TRUE(p == NULL);
-}
-
-PCUT_TEST(str_str_empty_n)
-{
-	const char *hs = "abracadabra";
-	const char *n = "";
-	char *p;
-
-	p = str_str(hs, n);
-	PCUT_ASSERT_TRUE((const char *)p == hs);
-}
-
-PCUT_TEST(str_non_shortest)
-{
-	/* Overlong zero. */
-	const char overlong1[] = "\xC0\x80";
-	const char overlong2[] = "\xE0\x80\x80";
-	const char overlong3[] = "\xF0\x80\x80\x80";
-
-	const char overlong4[] = "\xC1\xBF";
-	const char overlong5[] = "\xE0\x9F\xBF";
-	const char overlong6[] = "\xF0\x8F\xBF\xBF";
-
-	size_t offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong1, &offset, sizeof(overlong1)));
-	offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong2, &offset, sizeof(overlong2)));
-	offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong3, &offset, sizeof(overlong3)));
-	offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong4, &offset, sizeof(overlong4)));
-	offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong5, &offset, sizeof(overlong5)));
-	offset = 0;
-	PCUT_ASSERT_INT_EQUALS(U_SPECIAL, str_decode(overlong6, &offset, sizeof(overlong6)));
-}
-
-struct sanitize_test {
-	const char *input;
-	const char *output;
-};
-
-static const struct sanitize_test sanitize_tests[] = {
-	// Empty string
-	{ "", "" },
-	// ASCII only
-	{ "Hello, world!", "Hello, world!" },
-	// Valid multi-byte sequences
-	{ "Aπ你🐱", "Aπ你🐱" },
-	// U+D7FF is last valid before surrogates
-	{ "A\xED\x9F\xBFZ", "A\xED\x9F\xBFZ" },
-	// 0x10FFFF is the highest legal code point
-	{ "A\xF4\x8F\xBF\xBFZ", "A\xF4\x8F\xBF\xBFZ" },
-
-	// Missing continuation byte
-	{ "A\xC2Z", "A?Z" },
-	// Truncated multi-byte at buffer end
-	{ "A\xE2\x82", "A??" },
-	// Continuation byte without leading byte (0x80-0xBF are never valid first bytes)
-	{ "A\x80Y\xBFZ", "A?Y?Z" },
-
-	// 'A' (U+0041) normally encoded as 0x41
-	// Overlong 2-byte encoding: 0xC1 0x81
-	{ "\xC1\x81X", "??X" },
-
-	// ¢ (U+00A2) normally encoded as 0xC2 0xA2
-	// Overlong 3-byte encoding: 0xE0 0x82 0xA2
-	{ "\xE0\x82\xA2X", "???X" },
-
-	// ¢ (U+00A2) normally encoded as 0xC2 0xA2
-	// Overlong 4-byte encoding: 0xF0 0x80 0x82 0xA2
-	{ "\xF0\x80\x82\xA2X", "????X" },
-
-	// € (U+20AC) normally encoded as 0xE2 0x82 0xAC
-	// Overlong 4-byte encoding: 0xF0 0x82 0x82 0xAC
-	{ "\xF0\x82\x82\xACX", "????X" },
-
-	// Using 0xC0 0x80 as overlong encoding for NUL (which should be just 0x00)
-	{ "\xC0\x80X", "??X" },
-
-	// 0xED 0xA0 0x80 encodes a surrogate half (U+D800), not allowed in UTF-8
-	{ "A\xED\xA0\x80Z", "A???Z" },
-
-	// 0x110000 is not a legal code point
-	{ "A\xF4\x90\x80\x80Z", "A????Z" },
-
-	// Mix of valid and invalid sequences
-	{ "A\xC2\xA9\xE2\x28\xA1\xF0\x9F\x98\x81\x80Z", "A©?(?😁?Z" },
-};
-
-static size_t count_diff(const char *a, const char *b, size_t n)
-{
-	size_t count = 0;
-
-	for (size_t i = 0; i < n; i++) {
-		if (a[i] != b[i])
-			count++;
-	}
-
-	return count;
-}
-
-PCUT_TEST(str_sanitize)
-{
-	char replacement = '?';
-	char buffer2[255];
-
-	for (size_t i = 0; i < sizeof(sanitize_tests) / sizeof(sanitize_tests[0]); i++) {
-		const char *in = sanitize_tests[i].input;
-		const char *out = sanitize_tests[i].output;
-		size_t n = str_size(in) + 1;
-		assert(str_size(out) + 1 == n);
-
-		memcpy(buffer, in, n);
-		size_t replaced = str_sanitize(buffer, n, replacement);
-		if (memcmp(buffer, out, n) != 0) {
-			print_string_hex(buffer2, buffer, n);
-			print_string_hex(buffer, out, n);
-			PCUT_ASSERTION_FAILED("Expected %s, got %s", buffer, buffer2);
-		}
-
-		size_t expect_replaced = count_diff(buffer, in, n);
-		PCUT_ASSERT_INT_EQUALS(expect_replaced, replaced);
-	}
-
-	// Test with n smaller than string length - truncated valid encoding for €
-	const char *in = "ABC€";
-	const char *out = "ABC??\xAC";
-	size_t n = str_size(in) + 1;
-	memcpy(buffer, in, n);
-	size_t replaced = str_sanitize(buffer, 5, replacement);
-	if (memcmp(buffer, out, n) != 0) {
-		print_string_hex(buffer2, buffer, n);
-		print_string_hex(buffer, out, n);
-		PCUT_ASSERTION_FAILED("Expected %s, got %s", buffer, buffer2);
-	}
-
-	PCUT_ASSERT_INT_EQUALS(2, replaced);
-}
-
-PCUT_EXPORT(str);
Index: pace/lib/c/test/string.c
===================================================================
--- uspace/lib/c/test/string.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,840 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Prevent an error from being generated */
-#define _REALLY_WANT_STRING_H
-#include <string.h>
-#include <pcut/pcut.h>
-
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
-#pragma GCC diagnostic ignored "-Wstringop-overflow"
-#pragma GCC diagnostic ignored "-Wstringop-overread"
-#endif
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(string);
-
-/** strcpy function */
-PCUT_TEST(strcpy)
-{
-	const char *s = "hello";
-	char buf[7];
-	size_t i;
-	char *p;
-
-	for (i = 0; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strcpy(buf, s);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strncpy function with n == 0 */
-PCUT_TEST(strncpy_zero)
-{
-	const char *s = "hello";
-	char buf[1];
-	char *p;
-
-	buf[0] = 'X';
-
-	p = strncpy(buf, s, 0);
-
-	/* No characters are copied */
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'X');
-}
-
-/** strncpy function with string longer than n argument */
-PCUT_TEST(strncpy_long)
-{
-	const char *s = "hello";
-	char buf[5];
-	size_t i;
-	char *p;
-
-	for (i = 0; i < 5; i++)
-		buf[i] = 'X';
-
-	p = strncpy(buf, s, 4);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'X');
-}
-
-/** strncpy function with string containing exactly n characters */
-PCUT_TEST(strncpy_just)
-{
-	const char *s = "hello";
-	char buf[6];
-	size_t i;
-	char *p;
-
-	for (i = 0; i < 6; i++)
-		buf[i] = 'X';
-
-	p = strncpy(buf, s, 5);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == 'X');
-}
-
-/** strncpy function with string containing exactly n - 1 characters */
-PCUT_TEST(strncpy_just_over)
-{
-	const char *s = "hello";
-	char buf[7];
-	size_t i;
-	char *p;
-
-	for (i = 0; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strncpy(buf, s, 6);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strncpy function with string containing less than n - 1 characters */
-PCUT_TEST(strncpy_over)
-{
-	const char *s = "hello";
-	char buf[8];
-	size_t i;
-	char *p;
-
-	for (i = 0; i < 8; i++)
-		buf[i] = 'X';
-
-	p = strncpy(buf, s, 7);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == '\0');
-	PCUT_ASSERT_TRUE(buf[7] == 'X');
-}
-
-/** strcat function */
-PCUT_TEST(strcat)
-{
-	char buf[7];
-	const char *s = "cde";
-	size_t i;
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-
-	for (i = 3; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strcat(buf, s);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == 'c');
-	PCUT_ASSERT_TRUE(buf[3] == 'd');
-	PCUT_ASSERT_TRUE(buf[4] == 'e');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strncat function with n == 0 */
-PCUT_TEST(strncat_zero)
-{
-	const char *s = "cde";
-	char buf[4];
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-	buf[3] = 'X';
-
-	p = strncat(buf, s, 0);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == '\0');
-	PCUT_ASSERT_TRUE(buf[3] == 'X');
-}
-
-/** strncat function with string longer than n argument */
-PCUT_TEST(strncat_long)
-{
-	const char *s = "cde";
-	char buf[6];
-	size_t i;
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-
-	for (i = 3; i < 6; i++)
-		buf[i] = 'X';
-
-	p = strncat(buf, s, 2);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == 'c');
-	PCUT_ASSERT_TRUE(buf[3] == 'd');
-	PCUT_ASSERT_TRUE(buf[4] == '\0');
-	PCUT_ASSERT_TRUE(buf[5] == 'X');
-}
-
-/** strncat function with string containing exactly n characters */
-PCUT_TEST(strncat_just)
-{
-	const char *s = "cde";
-	char buf[7];
-	size_t i;
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-
-	for (i = 3; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strncat(buf, s, 3);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == 'c');
-	PCUT_ASSERT_TRUE(buf[3] == 'd');
-	PCUT_ASSERT_TRUE(buf[4] == 'e');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strncat function with string containing exactly n - 1 characters */
-PCUT_TEST(strncat_just_over)
-{
-	const char *s = "cde";
-	char buf[7];
-	size_t i;
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-
-	for (i = 3; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strncat(buf, s, 4);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == 'c');
-	PCUT_ASSERT_TRUE(buf[3] == 'd');
-	PCUT_ASSERT_TRUE(buf[4] == 'e');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strncat function with string containing less than n - 1 characters */
-PCUT_TEST(strncat_over)
-{
-	const char *s = "cde";
-	char buf[7];
-	size_t i;
-	char *p;
-
-	buf[0] = 'a';
-	buf[1] = 'b';
-	buf[2] = '\0';
-
-	for (i = 3; i < 7; i++)
-		buf[i] = 'X';
-
-	p = strncat(buf, s, 5);
-
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(buf[0] == 'a');
-	PCUT_ASSERT_TRUE(buf[1] == 'b');
-	PCUT_ASSERT_TRUE(buf[2] == 'c');
-	PCUT_ASSERT_TRUE(buf[3] == 'd');
-	PCUT_ASSERT_TRUE(buf[4] == 'e');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strcmp function with different characters after terminating null */
-PCUT_TEST(strcmp_same)
-{
-	PCUT_ASSERT_TRUE(strcmp("apples\0#", "apples\0$") == 0);
-}
-
-/** strcmp function with first string less than second */
-PCUT_TEST(strcmp_less_than)
-{
-	PCUT_ASSERT_TRUE(strcmp("apples", "oranges") < 0);
-}
-
-/** strcmp function with first string greater than second */
-PCUT_TEST(strcmp_greater_than)
-{
-	PCUT_ASSERT_TRUE(strcmp("oranges", "apples") > 0);
-}
-
-/* strcmp function with first string a prefix of second string */
-PCUT_TEST(strcmp_prefix)
-{
-	PCUT_ASSERT_TRUE(strcmp("apple", "apples") < 0);
-}
-
-/** strcoll function */
-PCUT_TEST(strcoll)
-{
-	/* Same string with different characters after terminating null */
-	PCUT_ASSERT_TRUE(strcoll("apples\0#", "apples\0$") == 0);
-
-	/* First string less than second */
-	PCUT_ASSERT_TRUE(strcoll("apples", "oranges") < 0);
-
-	/* First string greater than second */
-	PCUT_ASSERT_TRUE(strcoll("oranges", "apples") > 0);
-
-	/* First string is prefix of second */
-	PCUT_ASSERT_TRUE(strcoll("apple", "apples") < 0);
-}
-
-/** strncmp function with n == 0 */
-PCUT_TEST(strncmp_zero)
-{
-	PCUT_ASSERT_TRUE(strncmp("apple", "orange", 0) == 0);
-}
-
-/** strncmp function with strings differing after n characters */
-PCUT_TEST(strncmp_long)
-{
-	PCUT_ASSERT_TRUE(strncmp("apple", "apricot", 2) == 0);
-}
-
-/** strncmp function with strings differing in (n-1)th character */
-PCUT_TEST(strncmp_just)
-{
-	PCUT_ASSERT_TRUE(strncmp("apple", "apricot", 3) < 0);
-}
-
-/** strncmp function with strings differing before (n-1)th character */
-PCUT_TEST(strncmp_over)
-{
-	PCUT_ASSERT_TRUE(strncmp("dart", "tart", 3) < 0);
-}
-
-/** strxfrm function with null destination to determine size needed */
-PCUT_TEST(strxfrm_null)
-{
-	size_t n;
-
-	n = strxfrm(NULL, "hello", 0);
-	PCUT_ASSERT_INT_EQUALS(5, n);
-}
-
-/** strxfrm function with string longer than n argument */
-PCUT_TEST(strxfrm_long)
-{
-	const char *s = "hello";
-	char buf[5];
-	size_t i;
-	size_t n;
-
-	for (i = 0; i < 5; i++)
-		buf[i] = 'X';
-
-	n = strxfrm(buf, s, 4);
-
-	PCUT_ASSERT_INT_EQUALS(5, n);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'X');
-}
-
-/** strxfrm function with string containing exactly n characters */
-PCUT_TEST(strxfrm_just)
-{
-	const char *s = "hello";
-	char buf[6];
-	size_t i;
-	size_t n;
-
-	for (i = 0; i < 6; i++)
-		buf[i] = 'X';
-
-	n = strxfrm(buf, s, 5);
-
-	PCUT_ASSERT_INT_EQUALS(5, n);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == 'X');
-}
-
-/** strxfrm function with string containing exactly n - 1 characters */
-PCUT_TEST(strxfrm_just_over)
-{
-	const char *s = "hello";
-	char buf[7];
-	size_t i;
-	size_t n;
-
-	for (i = 0; i < 7; i++)
-		buf[i] = 'X';
-
-	n = strxfrm(buf, s, 6);
-
-	PCUT_ASSERT_INT_EQUALS(5, n);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-}
-
-/** strxfrm function with string containing less than n - 1 characters */
-PCUT_TEST(strxfrm_over)
-{
-	const char *s = "hello";
-	char buf[8];
-	size_t i;
-	size_t n;
-
-	for (i = 0; i < 8; i++)
-		buf[i] = 'X';
-
-	n = strxfrm(buf, s, 7);
-
-	PCUT_ASSERT_INT_EQUALS(5, n);
-	PCUT_ASSERT_TRUE(buf[0] == 'h');
-	PCUT_ASSERT_TRUE(buf[1] == 'e');
-	PCUT_ASSERT_TRUE(buf[2] == 'l');
-	PCUT_ASSERT_TRUE(buf[3] == 'l');
-	PCUT_ASSERT_TRUE(buf[4] == 'o');
-	PCUT_ASSERT_TRUE(buf[5] == '\0');
-	PCUT_ASSERT_TRUE(buf[6] == 'X');
-	PCUT_ASSERT_TRUE(buf[7] == 'X');
-}
-
-/** strchr function searching for null character */
-PCUT_TEST(strchr_nullchar)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strchr(s, '\0');
-	PCUT_ASSERT_TRUE((const char *)p == &s[6]);
-}
-
-/** strchr function with character occurring in string */
-PCUT_TEST(strchr_found)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strchr(s, 'b');
-	PCUT_ASSERT_TRUE((const char *)p == &s[1]);
-}
-
-/** strchr function with character not occurring in string */
-PCUT_TEST(strchr_not_found)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strchr(s, 'd');
-	PCUT_ASSERT_TRUE(p == NULL);
-}
-
-/** strcspn function with empty search string */
-PCUT_TEST(strcspn_empty_str)
-{
-	size_t n;
-
-	n = strcspn("", "abc");
-	PCUT_ASSERT_INT_EQUALS(0, n);
-}
-
-/** strcspn function with empty character set */
-PCUT_TEST(strcspn_empty_set)
-{
-	size_t n;
-
-	n = strcspn("abc", "");
-	PCUT_ASSERT_INT_EQUALS(3, n);
-}
-
-/** strcspn function with regular arguments */
-PCUT_TEST(strcspn_regular)
-{
-	size_t n;
-
-	n = strcspn("baBAba", "AB");
-	PCUT_ASSERT_INT_EQUALS(2, n);
-}
-
-/** strpbrk function with empty search string */
-PCUT_TEST(strpbrk_empty_string)
-{
-	const char *p;
-
-	p = strpbrk("", "abc");
-	PCUT_ASSERT_NULL(p);
-}
-
-/** strpbrk function with empty character set */
-PCUT_TEST(strpbrk_empty_set)
-{
-	const char *p;
-
-	p = strpbrk("abc", "");
-	PCUT_ASSERT_NULL(p);
-}
-
-/** strpbrk function with regular parameters */
-PCUT_TEST(strpbrk_regular)
-{
-	const char *s = "baBAba";
-	char *p;
-
-	p = strpbrk(s, "ab");
-	PCUT_ASSERT_TRUE((const char *)p == s);
-}
-
-/** strrchr function searching for null character */
-PCUT_TEST(strrchr_nullchar)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strrchr(s, '\0');
-	PCUT_ASSERT_TRUE((const char *)p == &s[6]);
-}
-
-/** strrchr function with character occurring in string */
-PCUT_TEST(strrchr_found)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strrchr(s, 'b');
-	PCUT_ASSERT_TRUE((const char *)p == &s[4]);
-}
-
-/** strrchr function with character not occurring in string */
-PCUT_TEST(strrchr_not_found)
-{
-	const char *s = "abcabc";
-	char *p;
-
-	p = strrchr(s, 'd');
-	PCUT_ASSERT_TRUE(p == NULL);
-}
-
-/** strspn function with empty search string */
-PCUT_TEST(strspn_empty_str)
-{
-	size_t n;
-
-	n = strspn("", "abc");
-	PCUT_ASSERT_INT_EQUALS(0, n);
-}
-
-/** strspn function with empty character set */
-PCUT_TEST(strspn_empty_set)
-{
-	size_t n;
-
-	n = strspn("abc", "");
-	PCUT_ASSERT_INT_EQUALS(0, n);
-}
-
-/** strspn function with regular arguments */
-PCUT_TEST(strspn_regular)
-{
-	size_t n;
-
-	n = strspn("baBAba", "ab");
-	PCUT_ASSERT_INT_EQUALS(2, n);
-}
-
-/** strstr function looking for empty substring */
-PCUT_TEST(strstr_empty)
-{
-	const char *str = "abcabcabcdabc";
-	char *p;
-
-	p = strstr(str, "");
-	PCUT_ASSERT_TRUE((const char *) p == str);
-}
-
-/** strstr function looking for substring with success */
-PCUT_TEST(strstr_found)
-{
-	const char *str = "abcabcabcdabc";
-	char *p;
-
-	p = strstr(str, "abcd");
-	PCUT_ASSERT_TRUE((const char *) p == &str[6]);
-}
-
-/** strstr function looking for substring with failure */
-PCUT_TEST(strstr_notfound)
-{
-	const char *str = "abcabcabcdabc";
-	char *p;
-
-	p = strstr(str, "abcde");
-	PCUT_ASSERT_NULL(p);
-}
-
-/** strtok function */
-PCUT_TEST(strtok)
-{
-	char str[] = ":a::b;;;$c";
-	char *t;
-
-	t = strtok(str, ":");
-	PCUT_ASSERT_TRUE(t == &str[1]);
-	PCUT_ASSERT_INT_EQUALS(0, strcmp(t, "a"));
-
-	t = strtok(NULL, ";");
-	PCUT_ASSERT_TRUE(t == &str[3]);
-	PCUT_ASSERT_INT_EQUALS(0, strcmp(t, ":b"));
-
-	t = strtok(NULL, "$;");
-	PCUT_ASSERT_TRUE(t == &str[9]);
-	PCUT_ASSERT_INT_EQUALS(0, strcmp(t, "c"));
-
-	t = strtok(NULL, "$");
-	PCUT_ASSERT_NULL(t);
-}
-
-/** strerror function with zero argument */
-PCUT_TEST(strerror_zero)
-{
-	char *p;
-
-	p = strerror(0);
-	PCUT_ASSERT_NOT_NULL(p);
-}
-
-/** strerror function with errno value argument */
-PCUT_TEST(strerror_errno)
-{
-	char *p;
-
-	p = strerror(EINVAL);
-	PCUT_ASSERT_NOT_NULL(p);
-}
-
-/** strerror function with negative argument */
-PCUT_TEST(strerror_negative)
-{
-	char *p;
-
-	p = strerror(-1);
-	PCUT_ASSERT_NOT_NULL(p);
-}
-
-/** strlen function with empty string */
-PCUT_TEST(strlen_empty)
-{
-	PCUT_ASSERT_INT_EQUALS(0, strlen(""));
-}
-
-/** strlen function with non-empty string */
-PCUT_TEST(strlen_nonempty)
-{
-	PCUT_ASSERT_INT_EQUALS(3, strlen("abc"));
-}
-
-/** strlen function with empty string and non-zero limit */
-PCUT_TEST(strnlen_empty_short)
-{
-	PCUT_ASSERT_INT_EQUALS(0, strnlen("", 1));
-}
-
-/** strlen function with empty string and zero limit */
-PCUT_TEST(strnlen_empty_eq)
-{
-	PCUT_ASSERT_INT_EQUALS(0, strnlen("", 0));
-}
-
-/** strlen function with non empty string below limit */
-PCUT_TEST(strnlen_nonempty_short)
-{
-	PCUT_ASSERT_INT_EQUALS(3, strnlen("abc", 5));
-}
-
-/** strlen function with non empty string just below limit */
-PCUT_TEST(strnlen_nonempty_just_short)
-{
-	PCUT_ASSERT_INT_EQUALS(3, strnlen("abc", 4));
-}
-
-/** strlen function with non empty string of length equal to limit */
-PCUT_TEST(strnlen_nonempty_eq)
-{
-	PCUT_ASSERT_INT_EQUALS(3, strnlen("abc", 3));
-}
-
-/** strlen function with non empty string of length above limit */
-PCUT_TEST(strnlen_nonempty_long)
-{
-	PCUT_ASSERT_INT_EQUALS(2, strnlen("abc", 2));
-}
-
-/** strdup function with empty string */
-PCUT_TEST(strdup_empty)
-{
-	char *d = strdup("");
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == '\0');
-	free(d);
-}
-
-/** strdup function with non-empty string */
-PCUT_TEST(strdup_nonempty)
-{
-	char *d = strdup("abc");
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == 'a');
-	PCUT_ASSERT_TRUE(d[1] == 'b');
-	PCUT_ASSERT_TRUE(d[2] == 'c');
-	PCUT_ASSERT_TRUE(d[3] == '\0');
-	free(d);
-}
-
-/** strndup function with empty string and non-zero limit */
-PCUT_TEST(strndup_empty_short)
-{
-	char *d = strndup("", 1);
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == '\0');
-	free(d);
-}
-
-/** strndup function with empty string and zero limit */
-PCUT_TEST(strndup_empty_eq)
-{
-	char *d = strndup("", 0);
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == '\0');
-	free(d);
-}
-
-/** strndup function with non-empty string of length below limit */
-PCUT_TEST(strndup_nonempty_short)
-{
-#pragma GCC diagnostic push
-	// Intentionally checking it works with _longer_ size than actual
-#if defined(__GNUC__) && (__GNUC__ >= 11)
-#pragma GCC diagnostic ignored "-Wstringop-overread"
-#endif
-	char *d = strndup("abc", 5);
-#pragma GCC diagnostic pop
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == 'a');
-	PCUT_ASSERT_TRUE(d[1] == 'b');
-	PCUT_ASSERT_TRUE(d[2] == 'c');
-	PCUT_ASSERT_TRUE(d[3] == '\0');
-	free(d);
-}
-
-/** strndup function with non-empty string of length equal to limit */
-PCUT_TEST(strndup_nonempty_eq)
-{
-	char *d = strndup("abc", 3);
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == 'a');
-	PCUT_ASSERT_TRUE(d[1] == 'b');
-	PCUT_ASSERT_TRUE(d[2] == 'c');
-	PCUT_ASSERT_TRUE(d[3] == '\0');
-	free(d);
-}
-
-/** strndup function with non-empty string of length above limit */
-PCUT_TEST(strndup_nonempty_long)
-{
-	char *d = strndup("abc", 2);
-	PCUT_ASSERT_NOT_NULL(d);
-	PCUT_ASSERT_TRUE(d[0] == 'a');
-	PCUT_ASSERT_TRUE(d[1] == 'b');
-	PCUT_ASSERT_TRUE(d[2] == '\0');
-	free(d);
-}
-
-PCUT_EXPORT(string);
Index: pace/lib/c/test/strtol.c
===================================================================
--- uspace/lib/c/test/strtol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,526 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/**
- * @file
- * @brief Test string to int conversion functions
- */
-
-#include <pcut/pcut.h>
-#include <stdlib.h>
-#include <str.h>
-#include <limits.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(strtol);
-
-/** atoi function */
-PCUT_TEST(atoi)
-{
-	int i;
-
-	i = atoi(" \t42");
-	PCUT_ASSERT_TRUE(i == 42);
-}
-
-/** atol function */
-PCUT_TEST(atol)
-{
-	long li;
-
-	li = atol(" \t42");
-	PCUT_ASSERT_TRUE(li == 42);
-}
-
-/** atoll function */
-PCUT_TEST(atoll)
-{
-	long long lli;
-
-	lli = atoll(" \t42");
-	PCUT_ASSERT_TRUE(lli == 42);
-}
-
-/** strtol function */
-PCUT_TEST(strtol)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t42x", &ep, 10);
-	PCUT_ASSERT_TRUE(li == 42);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with auto-detected base 10 */
-PCUT_TEST(strtol_dec_auto)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t42x", &ep, 0);
-	PCUT_ASSERT_TRUE(li == 42);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with octal number */
-PCUT_TEST(strtol_oct)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t052x", &ep, 8);
-	PCUT_ASSERT_TRUE(li == 052);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with octal number with prefix */
-#include <stdio.h>
-PCUT_TEST(strtol_oct_prefix)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t052x", &ep, 0);
-	printf("li=%ld (0%lo)\n", li, li);
-	PCUT_ASSERT_TRUE(li == 052);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with hex number */
-PCUT_TEST(strtol_hex)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t2ax", &ep, 16);
-	PCUT_ASSERT_TRUE(li == 0x2a);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with hex number with hex prefix */
-PCUT_TEST(strtol_hex_prefixed)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t0x2ax", &ep, 0);
-	PCUT_ASSERT_TRUE(li == 0x2a);
-	PCUT_ASSERT_TRUE(*ep == 'x');
-}
-
-/** strtol function with base 16 and number with 0x prefix */
-PCUT_TEST(strtol_base16_prefix)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \t0x1y", &ep, 16);
-	printf("li=%ld\n", li);
-	PCUT_ASSERT_TRUE(li == 1);
-	PCUT_ASSERT_TRUE(*ep == 'y');
-}
-
-/** strtol function with base 36 number */
-PCUT_TEST(strtol_base36)
-{
-	long li;
-	char *ep;
-
-	li = strtol(" \tz1.", &ep, 36);
-	PCUT_ASSERT_TRUE(li == 35 * 36 + 1);
-	PCUT_ASSERT_TRUE(*ep == '.');
-}
-
-PCUT_TEST(str_uint_hex)
-{
-	int base;
-	bool strict;
-	const char *endp;
-	uint32_t result;
-	errno_t rc;
-	const char *input;
-
-	/*
-	 * str_* conversion function do not admit a prefix when base is
-	 * specified.
-	 */
-
-	rc = str_uint32_t(input = "0x10", &endp, base = 0, strict = false, &result);
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(0x10, result);
-	PCUT_ASSERT_PTR_EQUALS(input + 4, endp);
-
-	rc = str_uint32_t(input = "0x10", &endp, base = 16, strict = false, &result);
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(0, result);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-
-	rc = str_uint32_t(input = "  \t0x10", &endp, base = 0, strict = false, &result);
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(0x10, result);
-	PCUT_ASSERT_PTR_EQUALS(input + 7, endp);
-
-	rc = str_uint32_t(input = "  \t0x10", &endp, base = 16, strict = false, &result);
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(0, result);
-	PCUT_ASSERT_PTR_EQUALS(input + 4, endp);
-}
-
-PCUT_TEST(str_uint_overflow)
-{
-	int base;
-	bool strict;
-	uint64_t result;
-	errno_t rc;
-	const char *input;
-
-	/*
-	 * Naive overflow check will not detect this overflow,
-	 * since the intermediate result is equal to the previous step.
-	 */
-
-	rc = str_uint64_t(input = "0xffffffffffffffffffffffffffffffff", NULL, base = 0, strict = false, &result);
-#if 0
-	/* Buggy result. */
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_UINT_EQUALS(0xffffffffffffffff, result);
-#else
-	/* Correct result. */
-	PCUT_ASSERT_INT_EQUALS(EOVERFLOW, rc);
-#endif
-
-	/* 3^40 */
-
-	rc = str_uint64_t(input = "1" "0000000000" "0000000000" "0000000000" "0000000000", NULL, base = 3, strict = false, &result);
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	PCUT_ASSERT_UINT_EQUALS(0xa8b8b452291fe821, result);
-
-	/*
-	 * Naive overflow check will not detect this overflow,
-	 * since the intermediate result is greater than the previous step,
-	 * despite overflowing 64 bits.
-	 *
-	 * The input is 3^41 which is greater than 2^64,
-	 * but (3^41 mod 2^64) is still greater than 3^40, so overflow is not
-	 * detected by a naive magnitude check.
-	 */
-
-	rc = str_uint64_t(input = "10" "0000000000" "0000000000" "0000000000" "0000000000", NULL, base = 3, strict = false, &result);
-#if 0
-	/* Buggy result. */
-	PCUT_ASSERT_INT_EQUALS(EOK, rc);
-	/* Correct value is    0x1fa2a1cf67b5fb863 */
-	PCUT_ASSERT_UINT_EQUALS(0xfa2a1cf67b5fb863, result);
-#else
-	/* Correct result. */
-	PCUT_ASSERT_INT_EQUALS(EOVERFLOW, rc);
-#endif
-}
-
-PCUT_TEST(strtoul_negative_wraparound)
-{
-	long output;
-	char *endp;
-	char *endp_unchanged = (char *) "endp_unchanged unique pointer";
-	int errno_unchanged = -1;
-	const char *input;
-	int base;
-
-	/*
-	 * N2176 7.22.1.4 The strtol, strtoll, strtoul, and strtoull functions
-	 *
-	 * "If the subject sequence begins with a minus sign, the value
-	 * resulting from the conversion is negated (in the return type)."
-	 */
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtoul(input = "-10", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 3, endp);
-	PCUT_ASSERT_UINT_EQUALS(-(10ul), output);
-}
-
-PCUT_TEST(strtol_fringe)
-{
-	long output;
-	char *endp;
-	char *endp_unchanged = (char *) "endp_unchanged unique pointer";
-	int errno_unchanged = -1;
-	const char *input;
-	int base;
-
-	/* Variants of plain zero with various bases. */
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = -10);
-	PCUT_ASSERT_INT_EQUALS(EINVAL, errno);
-	PCUT_ASSERT_PTR_EQUALS(endp_unchanged, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 1);
-	PCUT_ASSERT_INT_EQUALS(EINVAL, errno);
-	PCUT_ASSERT_PTR_EQUALS(endp_unchanged, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	for (base = 2; base <= 36; base++) {
-		endp = endp_unchanged;
-		errno = errno_unchanged;
-		output = strtol(input = "0", &endp, base);
-		PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-		PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-		PCUT_ASSERT_INT_EQUALS(0, output);
-
-		endp = endp_unchanged;
-		errno = errno_unchanged;
-		output = strtol(input = "1", &endp, base);
-		PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-		PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-		PCUT_ASSERT_INT_EQUALS(1, output);
-
-		endp = endp_unchanged;
-		errno = errno_unchanged;
-		output = strtol(input = "10", &endp, base);
-		PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-		PCUT_ASSERT_PTR_EQUALS(input + 2, endp);
-		PCUT_ASSERT_INT_EQUALS(base, output);
-
-		endp = endp_unchanged;
-		errno = errno_unchanged;
-		output = strtol(input = "100", &endp, base);
-		PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-		PCUT_ASSERT_PTR_EQUALS(input + 3, endp);
-		PCUT_ASSERT_INT_EQUALS(base * base, output);
-
-		endp = endp_unchanged;
-		errno = errno_unchanged;
-		output = strtol(input = "1000", &endp, base);
-		PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-		PCUT_ASSERT_PTR_EQUALS(input + 4, endp);
-		PCUT_ASSERT_INT_EQUALS(base * base * base, output);
-	}
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 8);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 16);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 36);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 1, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 37);
-	PCUT_ASSERT_INT_EQUALS(EINVAL, errno);
-	PCUT_ASSERT_PTR_EQUALS(endp_unchanged, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "0", &endp, base = 37);
-	PCUT_ASSERT_INT_EQUALS(EINVAL, errno);
-	PCUT_ASSERT_PTR_EQUALS(endp_unchanged, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	/* No valid number */
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    ", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    ", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    x", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    x0", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0x", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 5, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0xg", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 5, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0x1", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 7, endp);
-	PCUT_ASSERT_INT_EQUALS(1, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0x", &endp, base = 16);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 5, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0xg", &endp, base = 16);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 5, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    g", &endp, base = 16);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    0x1", &endp, base = 16);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input + 7, endp);
-	PCUT_ASSERT_INT_EQUALS(1, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    +", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    -", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    +", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "    -", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "+", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "-", &endp, base = 0);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "+", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-
-	endp = endp_unchanged;
-	errno = errno_unchanged;
-	output = strtol(input = "-", &endp, base = 10);
-	PCUT_ASSERT_INT_EQUALS(errno_unchanged, errno);
-	PCUT_ASSERT_PTR_EQUALS(input, endp);
-	PCUT_ASSERT_INT_EQUALS(0, output);
-}
-
-PCUT_EXPORT(strtol);
Index: pace/lib/c/test/uchar.c
===================================================================
--- uspace/lib/c/test/uchar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/*
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <uchar.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(uchar);
-
-PCUT_TEST(mbrtoc16)
-{
-	mbstate_t mbstate;
-	memset(&mbstate, 0, sizeof(mbstate));
-
-	size_t ret;
-	const char *s = u8"a𐎣";
-	char16_t out[] = u"AAAAA";
-	const char16_t expected[] = u"a𐎣";
-
-	ret = mbrtoc16(&out[0], s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(1, ret);
-	PCUT_ASSERT_INT_EQUALS(expected[0], out[0]);
-
-	s += ret;
-
-	ret = mbrtoc16(&out[1], s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(4, ret);
-	PCUT_ASSERT_INT_EQUALS(expected[1], out[1]);
-
-	s += ret;
-
-	ret = mbrtoc16(&out[2], s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(-3, ret);
-	PCUT_ASSERT_INT_EQUALS(expected[2], out[2]);
-
-	ret = mbrtoc16(&out[3], s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(0, ret);
-	PCUT_ASSERT_INT_EQUALS(expected[3], out[3]);
-}
-
-PCUT_TEST(c16rtomb)
-{
-	mbstate_t mbstate;
-	memset(&mbstate, 0, sizeof(mbstate));
-
-	const char16_t in[] = u"aβℷ𐎣";
-	char out[] = "AAAAAAAAAAAAAAAAA";
-
-	char *s = out;
-
-	for (size_t i = 0; i < sizeof(in) / sizeof(char16_t); i++) {
-		s += c16rtomb(s, in[i], &mbstate);
-	}
-
-	const char expected[] = u8"aβℷ𐎣";
-	PCUT_ASSERT_STR_EQUALS(expected, out);
-	PCUT_ASSERT_INT_EQUALS(s - out, sizeof(expected));
-}
-
-PCUT_TEST(mbrtoc32)
-{
-	mbstate_t mbstate;
-	memset(&mbstate, 0, sizeof(mbstate));
-
-	size_t ret;
-	char32_t c = 0;
-	const char *s = u8"aβℷ𐎣";
-
-	ret = mbrtoc32(&c, s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, 1);
-	PCUT_ASSERT_INT_EQUALS(c, U'a');
-
-	s += ret;
-
-	ret = mbrtoc32(&c, s, 1, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, -2);
-	PCUT_ASSERT_INT_EQUALS(c, U'a');
-
-	s += 1;
-
-	ret = mbrtoc32(&c, s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, 1);
-	PCUT_ASSERT_INT_EQUALS(c, U'β');
-
-	s += ret;
-
-	ret = mbrtoc32(&c, s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, 3);
-	PCUT_ASSERT_INT_EQUALS(c, U'ℷ');
-
-	s += ret;
-
-	ret = mbrtoc32(&c, s, 3, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, -2);
-	PCUT_ASSERT_INT_EQUALS(c, U'ℷ');
-
-	s += 3;
-
-	ret = mbrtoc32(&c, s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, 1);
-	PCUT_ASSERT_INT_EQUALS(c, U'𐎣');
-
-	s += ret;
-
-	ret = mbrtoc32(&c, s, MB_CUR_MAX, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(ret, 0);
-	PCUT_ASSERT_INT_EQUALS(c, 0);
-}
-
-PCUT_TEST(c32rtomb)
-{
-	mbstate_t mbstate;
-	memset(&mbstate, 0, sizeof(mbstate));
-
-	char out[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
-	char *s = out;
-
-	_Static_assert(sizeof(out) > 5 * MB_CUR_MAX);
-
-	s += c32rtomb(s, U'a', &mbstate);
-	PCUT_ASSERT_INT_EQUALS(s - out, 1);
-
-	s += c32rtomb(s, U'β', &mbstate);
-	PCUT_ASSERT_INT_EQUALS(s - out, 3);
-
-	s += c32rtomb(s, U'ℷ', &mbstate);
-	PCUT_ASSERT_INT_EQUALS(s - out, 6);
-
-	s += c32rtomb(s, U'𐎣', &mbstate);
-	PCUT_ASSERT_INT_EQUALS(s - out, 10);
-
-	s += c32rtomb(s, 0, &mbstate);
-	PCUT_ASSERT_INT_EQUALS(s - out, 11);
-
-	const char expected[] = u8"aβℷ𐎣";
-	PCUT_ASSERT_INT_EQUALS(memcmp(out, expected, sizeof(expected)), 0);
-}
-
-PCUT_EXPORT(uchar);
Index: pace/lib/c/test/uuid.c
===================================================================
--- uspace/lib/c/test/uuid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2019 Matthieu Riolo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <uuid.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <str.h>
-#include <ctype.h>
-
-static size_t MAX_SUB_TESTS = 10;
-static size_t uuids_len = 6;
-static const char *uuids[] = {
-	/* uppercase */
-	"F81163AE-299A-4DA2-BED1-0E096C59F3AB",
-	"4A0CE2A3-FD1C-4951-972E-AAA13A703078",
-	"69C7DB62-8309-4C58-831B-8C4E4161E8AC",
-
-	/* lower case */
-	"c511bf24-70cb-422e-933b-2a74ab699a56",
-	"7b1abd05-456f-4661-ab62-917685069343",
-	"5b00f76b-4a16-4dce-a1fc-b78c60324d89"
-};
-
-static bool uuid_valid(uuid_t uuid)
-{
-	if (!((uuid.time_hi_and_version & 0xf000) & 0x4000)) {
-		return false;
-	}
-
-	int f = (uuid.clock_seq_hi_and_reserved & 0x80) || (uuid.clock_seq_hi_and_reserved & 0x90);
-	f = f || (uuid.clock_seq_hi_and_reserved & 0xA0) || (uuid.clock_seq_hi_and_reserved & 0xB0);
-	if (!f) {
-		return false;
-	}
-
-	return true;
-}
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(uuid);
-
-PCUT_TEST(uuid_generate)
-{
-	uuid_t uuid;
-	size_t i;
-
-	for (i = 0; i < MAX_SUB_TESTS; i++) {
-		errno_t ret = uuid_generate(&uuid);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_TRUE(uuid_valid(uuid));
-	}
-}
-
-PCUT_TEST(uuid_parse)
-{
-	uuid_t uuid;
-	errno_t ret;
-
-	for (size_t i = 0; i < uuids_len; i++) {
-		ret = uuid_parse(uuids[i], &uuid, NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_TRUE(uuid_valid(uuid));
-	}
-}
-
-PCUT_TEST(uuid_parse_in_text)
-{
-	uuid_t uuid;
-	errno_t ret;
-	const char *endptr;
-	const char *uuid_in_text = "7b1abd05-456f-4661-ab62-917685069343hello world!";
-
-	ret = uuid_parse(uuid_in_text, &uuid, &endptr);
-
-	PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-	PCUT_ASSERT_TRUE(uuid_valid(uuid));
-	PCUT_ASSERT_STR_EQUALS("hello world!", endptr);
-}
-
-PCUT_TEST(uuid_format_generated)
-{
-	uuid_t uuid;
-	size_t i;
-	char *rstr;
-
-	for (i = 0; i < MAX_SUB_TESTS; i++) {
-		errno_t ret = uuid_generate(&uuid);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_TRUE(uuid_valid(uuid));
-
-		ret = uuid_format(&uuid, &rstr, true);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_INT_EQUALS('\0', rstr[37]);
-		PCUT_ASSERT_INT_EQUALS(36, str_length(rstr));
-		PCUT_ASSERT_INT_EQUALS('4', rstr[14]);
-
-		int f = rstr[19] == '8' || rstr[19] == '9';
-		f = f || toupper(rstr[19]) == 'A' || toupper(rstr[19]) == 'B';
-		PCUT_ASSERT_TRUE(f);
-
-		free(rstr);
-	}
-}
-
-PCUT_TEST(uuid_format_parsed)
-{
-	uuid_t uuid;
-	char *rstr;
-	errno_t ret;
-
-	for (size_t i = 0; i < uuids_len; i++) {
-		ret = uuid_parse(uuids[i], &uuid, NULL);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_TRUE(uuid_valid(uuid));
-
-		ret = uuid_format(&uuid, &rstr, true);
-		PCUT_ASSERT_ERRNO_VAL(EOK, ret);
-		PCUT_ASSERT_INT_EQUALS('\0', rstr[37]);
-		PCUT_ASSERT_INT_EQUALS(36, str_length(rstr));
-		PCUT_ASSERT_INT_EQUALS(0, str_casecmp(uuids[i], rstr));
-
-		free(rstr);
-	}
-}
-
-PCUT_EXPORT(uuid);
Index: pace/lib/clipboard/doc/doxygroups.h
===================================================================
--- uspace/lib/clipboard/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libclipboard libclipboard
- * @ingroup libs
- */
Index: pace/lib/clipboard/include/clipboard.h
===================================================================
--- uspace/lib/clipboard/include/clipboard.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libclipboard
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCLIPBOARD_CLIPBOARD_H_
-#define _LIBCLIPBOARD_CLIPBOARD_H_
-
-#include <errno.h>
-
-extern errno_t clipboard_put_str(const char *);
-extern errno_t clipboard_get_str(char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/clipboard/include/ipc/clipboard.h
===================================================================
--- uspace/lib/clipboard/include/ipc/clipboard.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcipc
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCLIPBOARD_IPC_CLIPBOARD_H_
-#define _LIBCLIPBOARD_IPC_CLIPBOARD_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	CLIPBOARD_PUT_DATA = IPC_FIRST_USER_METHOD,
-	CLIPBOARD_GET_DATA,
-	CLIPBOARD_CONTENT
-} clipboard_request_t;
-
-typedef enum {
-	CLIPBOARD_TAG_NONE,
-	CLIPBOARD_TAG_DATA
-} clipboard_tag_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/clipboard/meson.build
===================================================================
--- uspace/lib/clipboard/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/clipboard.c')
Index: pace/lib/clipboard/src/clipboard.c
===================================================================
--- uspace/lib/clipboard/src/clipboard.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,210 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libclipboard
- * @{
- */
-/** @file
- * @brief System clipboard API.
- *
- * The clipboard data is managed by the clipboard service and it is shared by
- * the entire system.
- *
- */
-
-#include <async.h>
-#include <clipboard.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <ipc/clipboard.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-
-static FIBRIL_MUTEX_INITIALIZE(clip_mutex);
-static async_sess_t *clip_sess = NULL;
-
-/** Start an async exchange on the clipboard session.
- *
- * @return New exchange.
- *
- */
-static async_exch_t *clip_exchange_begin(void)
-{
-	service_id_t sid;
-	errno_t rc;
-
-	fibril_mutex_lock(&clip_mutex);
-
-	while (clip_sess == NULL) {
-		rc = loc_service_get_id(SERVICE_NAME_CLIPBOARD, &sid,
-		    IPC_FLAG_BLOCKING);
-		if (rc != EOK)
-			continue;
-
-		clip_sess = loc_service_connect(sid, INTERFACE_CLIPBOARD,
-		    IPC_FLAG_BLOCKING);
-	}
-
-	fibril_mutex_unlock(&clip_mutex);
-
-	return async_exchange_begin(clip_sess);
-}
-
-/** Finish an async exchange on the clipboard session.
- *
- * @param exch Exchange to be finished.
- *
- */
-static void clip_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Copy string to clipboard.
- *
- * Sets the clipboard contents to @a str. Passing an empty string or NULL
- * makes the clipboard empty.
- *
- * @param str String to put to clipboard or NULL.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t clipboard_put_str(const char *str)
-{
-	size_t size = str_size(str);
-
-	if (size == 0) {
-		async_exch_t *exch = clip_exchange_begin();
-		errno_t rc = async_req_1_0(exch, CLIPBOARD_PUT_DATA,
-		    CLIPBOARD_TAG_NONE);
-		clip_exchange_end(exch);
-
-		return (errno_t) rc;
-	} else {
-		async_exch_t *exch = clip_exchange_begin();
-		aid_t req = async_send_1(exch, CLIPBOARD_PUT_DATA, CLIPBOARD_TAG_DATA,
-		    NULL);
-		errno_t rc = async_data_write_start(exch, (void *) str, size);
-		clip_exchange_end(exch);
-
-		if (rc != EOK) {
-			errno_t rc_orig;
-			async_wait_for(req, &rc_orig);
-			if (rc_orig == EOK)
-				return (errno_t) rc;
-			else
-				return (errno_t) rc_orig;
-		}
-
-		async_wait_for(req, &rc);
-
-		return (errno_t) rc;
-	}
-}
-
-/** Get a copy of clipboard contents.
- *
- * Returns a new string that can be deallocated with free().
- *
- * @param str Here pointer to the newly allocated string is stored.
- *
- * @return Zero on success or an error code.
- *
- */
-errno_t clipboard_get_str(char **str)
-{
-	/* Loop until clipboard read succesful */
-	while (true) {
-		async_exch_t *exch = clip_exchange_begin();
-
-		sysarg_t size;
-		sysarg_t tag;
-		errno_t rc = async_req_0_2(exch, CLIPBOARD_CONTENT, &size, &tag);
-
-		clip_exchange_end(exch);
-
-		if (rc != EOK)
-			return (errno_t) rc;
-
-		char *sbuf;
-
-		switch (tag) {
-		case CLIPBOARD_TAG_NONE:
-			sbuf = malloc(1);
-			if (sbuf == NULL)
-				return ENOMEM;
-
-			sbuf[0] = 0;
-			*str = sbuf;
-			return EOK;
-		case CLIPBOARD_TAG_DATA:
-			sbuf = malloc(size + 1);
-			if (sbuf == NULL)
-				return ENOMEM;
-
-			exch = clip_exchange_begin();
-			aid_t req = async_send_1(exch, CLIPBOARD_GET_DATA, tag, NULL);
-			rc = async_data_read_start(exch, (void *) sbuf, size);
-			clip_exchange_end(exch);
-
-			if ((errno_t) rc == EOVERFLOW) {
-				/*
-				 * The data in the clipboard has changed since
-				 * the last call of CLIPBOARD_CONTENT
-				 */
-				break;
-			}
-
-			if (rc != EOK) {
-				errno_t rc_orig;
-				async_wait_for(req, &rc_orig);
-				if (rc_orig == EOK)
-					return (errno_t) rc;
-				else
-					return (errno_t) rc_orig;
-			}
-
-			async_wait_for(req, &rc);
-
-			if (rc == EOK) {
-				sbuf[size] = 0;
-				*str = sbuf;
-			}
-
-			return rc;
-		default:
-			return EINVAL;
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/clui/doc/doxygroups.h
===================================================================
--- uspace/lib/clui/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libclui libclui
- * @ingroup libs
- */
Index: pace/lib/clui/include/nchoice.h
===================================================================
--- uspace/lib/clui/include/nchoice.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libclui
- * @{
- */
-/**
- * @file Numerical choice
- */
-
-#ifndef LIBCLUI_NCHOICE_H_
-#define LIBCLUI_NCHOICE_H_
-
-#include <adt/list.h>
-#include <tinput.h>
-
-typedef enum {
-	/** This is the default option */
-	ncf_default = 1
-} nchoice_flag_t;
-
-typedef struct {
-	/** Link to nchoice_t.opts */
-	link_t lchoice;
-	/** Option text */
-	char *text;
-	/** User argument */
-	void *arg;
-} nchoice_opt_t;
-
-typedef struct {
-	/** Prompt text */
-	char *prompt;
-	/** Options */
-	list_t opts; /* of nchoice_opt_t */
-	/** Text input */
-	tinput_t *tinput;
-	/** Default option */
-	nchoice_opt_t *def_opt;
-} nchoice_t;
-
-extern errno_t nchoice_create(nchoice_t **);
-extern void nchoice_destroy(nchoice_t *);
-extern errno_t nchoice_set_prompt(nchoice_t *, const char *);
-extern errno_t nchoice_add(nchoice_t *, const char *, void *, nchoice_flag_t);
-extern errno_t nchoice_get(nchoice_t *, void **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/clui/include/tinput.h
===================================================================
--- uspace/lib/clui/include/tinput.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,165 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libclui
- * @{
- */
-/**
- * @file
- */
-
-#ifndef LIBCLUI_TINPUT_H_
-#define LIBCLUI_TINPUT_H_
-
-#include <inttypes.h>
-#include <io/console.h>
-#include <stdio.h>
-
-#define HISTORY_LEN     10
-#define INPUT_MAX_SIZE  1024
-
-/** Begin enumeration of text completions.
- *
- * When user requests text completion, tinput will call this function to start
- * text completion operation. @a *cstart should be set to the position
- * (character index) of the first character of the 'word' that is being
- * completed. The resulting text is obtained by replacing the range of text
- * starting at @a *cstart and ending at @a pos with the completion text.
- *
- * The function can pass information to the get_next and fini functions
- * via @a state. The init function allocates the state object and stores
- * a pointer to it to @a *state. The fini function destroys the state object.
- *
- * @param text		Current contents of edit buffer (null-terminated).
- * @param pos		Current caret position.
- * @param cstart	Output, position in text where completion begins from.
- * @param state		Output, pointer to a client state object.
- *
- * @return		EOK on success, error code on failure.
- */
-typedef errno_t (*tinput_compl_init_fn)(char32_t *text, size_t pos, size_t *cstart,
-    void **state);
-
-/** Obtain one text completion alternative.
- *
- * Upon success the function sets @a *compl to point to a string, the
- * completion text. The caller (Tinput) should not modify or free the text.
- * The pointer is only valid until the next invocation of any completion
- * function.
- *
- * @param state		Pointer to state object created by the init funtion.
- * @param compl		Output, the completion text, ownership retained.
- *
- * @return		EOK on success, error code on failure.
- */
-typedef errno_t (*tinput_compl_get_next_fn)(void *state, char **compl);
-
-/** Finish enumeration of text completions.
- *
- * The function must deallocate any state information allocated by the init
- * function or temporary data allocated by the get_next function.
- *
- * @param state		Pointer to state object created by the init funtion.
- */
-typedef void (*tinput_compl_fini_fn)(void *state);
-
-/** Text completion ops. */
-typedef struct {
-	tinput_compl_init_fn init;
-	tinput_compl_get_next_fn get_next;
-	tinput_compl_fini_fn fini;
-} tinput_compl_ops_t;
-
-/** Text input field (command line).
- *
- * Applications should treat this structure as opaque.
- */
-typedef struct {
-	/** Console */
-	console_ctrl_t *console;
-
-	/** Prompt string */
-	char *prompt;
-
-	/** Completion ops. */
-	tinput_compl_ops_t *compl_ops;
-
-	/** Buffer holding text currently being edited */
-	char32_t buffer[INPUT_MAX_SIZE + 1];
-
-	/** Linear position on screen where the prompt starts */
-	unsigned prompt_coord;
-	/** Linear position on screen where the text field starts */
-	unsigned text_coord;
-
-	/** Screen dimensions */
-	sysarg_t con_cols;
-	sysarg_t con_rows;
-
-	/** Number of characters in @c buffer */
-	size_t nc;
-
-	/** Caret position within buffer */
-	size_t pos;
-
-	/** Selection mark position within buffer */
-	size_t sel_start;
-
-	/** History (dynamically allocated strings) */
-	char *history[HISTORY_LEN + 1];
-
-	/** Number of entries in @c history, not counting [0] */
-	size_t hnum;
-
-	/** Current position in history */
-	size_t hpos;
-
-	/** @c true if finished with this line (return to caller) */
-	bool done;
-
-	/** @c true if user requested to abort interactive loop */
-	bool exit_clui;
-
-	/** @c true if left shift key is currently held */
-	bool lshift_held;
-
-	/** @c true if right shift key is currently held */
-	bool rshift_held;
-} tinput_t;
-
-extern tinput_t *tinput_new(void);
-extern errno_t tinput_set_prompt(tinput_t *, const char *);
-extern void tinput_set_compl_ops(tinput_t *, tinput_compl_ops_t *);
-extern void tinput_destroy(tinput_t *);
-extern errno_t tinput_read(tinput_t *, char **);
-extern errno_t tinput_read_i(tinput_t *, const char *, char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/clui/meson.build
===================================================================
--- uspace/lib/clui/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clipboard', 'console' ]
-src = files(
-	'src/nchoice.c',
-	'src/tinput.c',
-)
Index: pace/lib/clui/src/nchoice.c
===================================================================
--- uspace/lib/clui/src/nchoice.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,200 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libclui
- * @{
- */
-/**
- * @file Numerical choice
- */
-
-#include <errno.h>
-#include <nchoice.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <tinput.h>
-
-/** Create numerical choice
- *
- */
-errno_t nchoice_create(nchoice_t **rchoice)
-{
-	nchoice_t *choice = NULL;
-	errno_t rc;
-
-	choice = calloc(1, sizeof(nchoice_t));
-	if (choice == NULL)
-		goto error;
-
-	list_initialize(&choice->opts);
-
-	choice->tinput = tinput_new();
-	if (choice->tinput == NULL)
-		goto error;
-
-	rc = tinput_set_prompt(choice->tinput, "Choice> ");
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		goto error;
-	}
-
-	*rchoice = choice;
-	return EOK;
-error:
-	nchoice_destroy(choice);
-	return ENOMEM;
-}
-
-/** Destroy numerical choice */
-void nchoice_destroy(nchoice_t *choice)
-{
-	if (choice == NULL)
-		return;
-
-	tinput_destroy(choice->tinput);
-	free(choice);
-}
-
-/** Set numerica choice prompt text */
-errno_t nchoice_set_prompt(nchoice_t *choice, const char *prompt)
-{
-	char *pstr;
-
-	pstr = str_dup(prompt);
-	if (pstr == NULL)
-		return ENOMEM;
-
-	free(choice->prompt);
-	choice->prompt = pstr;
-	return EOK;
-}
-
-/** Add option to numerical choice */
-errno_t nchoice_add(nchoice_t *choice, const char *opttext, void *arg,
-    nchoice_flag_t flags)
-{
-	nchoice_opt_t *opt;
-	char *ptext;
-
-	opt = calloc(1, sizeof(nchoice_opt_t));
-	if (opt == NULL)
-		return ENOMEM;
-
-	ptext = str_dup(opttext);
-	if (ptext == NULL) {
-		free(opt);
-		return ENOMEM;
-	}
-
-	opt->text = ptext;
-	opt->arg = arg;
-	list_append(&opt->lchoice, &choice->opts);
-
-	if ((flags & ncf_default) != 0) {
-		/* Set this option as the default */
-		assert(choice->def_opt == NULL);
-
-		choice->def_opt = opt;
-	}
-
-	return EOK;
-}
-
-/** Get numerical choice from user */
-errno_t nchoice_get(nchoice_t *choice, void **rarg)
-{
-	int i;
-	errno_t rc;
-	int ret;
-	char *str;
-	unsigned long c;
-	char *eptr;
-	char *istr;
-	int def_i;
-
-again:
-	printf("%s\n", choice->prompt);
-
-	def_i = 0;
-	i = 1;
-	list_foreach(choice->opts, lchoice, nchoice_opt_t, opt) {
-		printf("%d: %s%s\n", i, opt->text, opt == choice->def_opt ?
-		    " [default]" : "");
-		if (opt == choice->def_opt)
-			def_i = i;
-		++i;
-	}
-
-	if (def_i > 0) {
-		ret = asprintf(&istr, "%d", def_i);
-		if (ret < 0)
-			return ENOMEM;
-	} else {
-		istr = str_dup("");
-		if (istr == NULL)
-			return ENOMEM;
-	}
-
-	rc = tinput_read_i(choice->tinput, istr, &str);
-	free(istr);
-
-	if (rc != EOK) {
-		assert(rc == EIO || rc == ENOENT);
-
-		if (rc == ENOENT) {
-			return ENOENT;
-		} else {
-			/* rc == EIO */
-			return EIO;
-		}
-	}
-
-	c = strtoul(str, &eptr, 10);
-	if (*eptr != '\0' || c < 1 || c > (unsigned long)i - 1) {
-		printf("Invalid choice. Try again.\n");
-		free(str);
-		goto again;
-	}
-
-	free(str);
-
-	i = 1;
-	list_foreach(choice->opts, lchoice, nchoice_opt_t, opt) {
-		if ((unsigned long)i == c) {
-			*rarg = opt->arg;
-			return EOK;
-		}
-		++i;
-	}
-
-	assert(false);
-	return ENOENT;
-}
-
-/** @}
- */
Index: pace/lib/clui/src/tinput.c
===================================================================
--- uspace/lib/clui/src/tinput.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1150 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libclui
- * @{
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <io/style.h>
-#include <io/color.h>
-#include <vfs/vfs.h>
-#include <clipboard.h>
-#include <macros.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <tinput.h>
-
-#define LIN_TO_COL(ti, lpos) ((lpos) % ((ti)->con_cols))
-#define LIN_TO_ROW(ti, lpos) ((lpos) / ((ti)->con_cols))
-#define LIN_POS(ti, col, row) ((col) + (row) * (ti)->con_cols)
-
-/** Seek direction */
-typedef enum {
-	seek_backward = -1,
-	seek_forward = 1
-} seek_dir_t;
-
-static void tinput_update_origin(tinput_t *);
-static void tinput_init(tinput_t *);
-static void tinput_insert_string(tinput_t *, const char *);
-static void tinput_sel_get_bounds(tinput_t *, size_t *, size_t *);
-static bool tinput_sel_active(tinput_t *);
-static void tinput_sel_all(tinput_t *);
-static void tinput_sel_delete(tinput_t *);
-static void tinput_key_ctrl(tinput_t *, kbd_event_t *);
-static void tinput_key_shift(tinput_t *, kbd_event_t *);
-static void tinput_key_ctrl_shift(tinput_t *, kbd_event_t *);
-static void tinput_key_unmod(tinput_t *, kbd_event_t *);
-static void tinput_pre_seek(tinput_t *, bool);
-static void tinput_post_seek(tinput_t *, bool);
-
-static void tinput_console_set_lpos(tinput_t *ti, unsigned lpos)
-{
-	unsigned col = LIN_TO_COL(ti, lpos);
-	unsigned row = LIN_TO_ROW(ti, lpos);
-
-	assert(col < ti->con_cols);
-	assert(row < ti->con_rows);
-	console_set_pos(ti->console, col, row);
-}
-
-/** Create a new text input field. */
-tinput_t *tinput_new(void)
-{
-	tinput_t *ti;
-
-	ti = calloc(1, sizeof(tinput_t));
-	if (ti == NULL)
-		return NULL;
-
-	tinput_init(ti);
-	return ti;
-}
-
-/** Destroy text input field. */
-void tinput_destroy(tinput_t *ti)
-{
-	if (ti->prompt != NULL)
-		free(ti->prompt);
-	free(ti);
-}
-
-static void tinput_display_prompt(tinput_t *ti)
-{
-	tinput_console_set_lpos(ti, ti->prompt_coord);
-
-	console_set_style(ti->console, STYLE_EMPHASIS);
-	printf("%s", ti->prompt);
-	console_flush(ti->console);
-	console_set_style(ti->console, STYLE_NORMAL);
-}
-
-static void tinput_display_tail(tinput_t *ti, size_t start, size_t pad)
-{
-	char32_t stash;
-	size_t sa;
-	size_t sb;
-	tinput_sel_get_bounds(ti, &sa, &sb);
-	assert(sa <= sb);
-
-	tinput_console_set_lpos(ti, ti->text_coord + start);
-	console_set_style(ti->console, STYLE_NORMAL);
-
-	sa = max(start, sa);
-	sb = max(start, sb);
-
-	if (start < sa) {
-		stash = ti->buffer[sa];
-		ti->buffer[sa] = L'\0';
-		printf("%ls", &ti->buffer[start]);
-		ti->buffer[sa] = stash;
-	}
-
-	if (sa < sb) {
-		console_flush(ti->console);
-		console_set_style(ti->console, STYLE_SELECTED);
-
-		stash = ti->buffer[sb];
-		ti->buffer[sb] = L'\0';
-		printf("%ls", &ti->buffer[sa]);
-		ti->buffer[sb] = stash;
-
-		console_flush(ti->console);
-		console_set_style(ti->console, STYLE_NORMAL);
-	}
-
-	if (sb < ti->nc) {
-		ti->buffer[ti->nc] = L'\0';
-		printf("%ls", &ti->buffer[sb]);
-	}
-
-	for (; pad > 0; pad--)
-		putuchar(' ');
-
-	console_flush(ti->console);
-}
-
-static char *tinput_get_str(tinput_t *ti)
-{
-	return wstr_to_astr(ti->buffer);
-}
-
-static void tinput_position_caret(tinput_t *ti)
-{
-	tinput_update_origin(ti);
-	tinput_console_set_lpos(ti, ti->text_coord + ti->pos);
-}
-
-/** Update text_coord, prompt_coord in case the screen would scroll
- * due to @a end_coord being beyond the end of the screen
- *
- * @param ti Text input
- * @param end_coord Linear screen coordinate to which the cursor would
- *                  be moved if the screen would not have scrolled
- */
-static void tinput_update_origin_coord(tinput_t *ti, unsigned end_coord)
-{
-	unsigned end_row = LIN_TO_ROW(ti, end_coord);
-
-	unsigned scroll_rows;
-
-	/* Update coords if the screen scrolled. */
-	if (end_row >= ti->con_rows) {
-		scroll_rows = end_row - ti->con_rows + 1;
-		ti->text_coord -= ti->con_cols * scroll_rows;
-		ti->prompt_coord -= ti->con_cols * scroll_rows;
-	}
-}
-
-/** Update text_coord, prompt_coord in case the screen could have scrolled. */
-static void tinput_update_origin(tinput_t *ti)
-{
-	/* Account for scrolling until the end of the input text */
-	tinput_update_origin_coord(ti, ti->text_coord + ti->nc);
-}
-
-static void tinput_jump_after(tinput_t *ti)
-{
-	tinput_console_set_lpos(ti, ti->text_coord + ti->nc);
-	console_flush(ti->console);
-	putuchar('\n');
-}
-
-static errno_t tinput_display(tinput_t *ti)
-{
-	sysarg_t col0, row0;
-
-	if (console_get_pos(ti->console, &col0, &row0) != EOK)
-		return EIO;
-
-	ti->prompt_coord = row0 * ti->con_cols + col0;
-	ti->text_coord = ti->prompt_coord;
-	tinput_display_prompt(ti);
-
-	/* The screen might have scrolled after printing the prompt */
-	tinput_update_origin_coord(ti, ti->prompt_coord + str_width(ti->prompt));
-
-	ti->text_coord = ti->prompt_coord + str_length(ti->prompt);
-	tinput_display_tail(ti, 0, 0);
-
-	/* The screen might have scrolled after priting the text */
-	tinput_update_origin(ti);
-
-	tinput_position_caret(ti);
-
-	return EOK;
-}
-
-static void tinput_insert_char(tinput_t *ti, char32_t c)
-{
-	if (ti->nc == INPUT_MAX_SIZE)
-		return;
-
-	/* Disallow text longer than 1 page for now. */
-	unsigned prompt_len = ti->text_coord - ti->prompt_coord;
-	if (prompt_len + ti->nc + 1 >= ti->con_cols * ti->con_rows)
-		return;
-
-	size_t i;
-	for (i = ti->nc; i > ti->pos; i--)
-		ti->buffer[i] = ti->buffer[i - 1];
-
-	ti->buffer[ti->pos] = c;
-	ti->pos += 1;
-	ti->nc += 1;
-	ti->buffer[ti->nc] = '\0';
-	ti->sel_start = ti->pos;
-
-	tinput_display_tail(ti, ti->pos - 1, 0);
-	tinput_position_caret(ti);
-}
-
-static void tinput_insert_string(tinput_t *ti, const char *str)
-{
-	size_t ilen = min(str_length(str), INPUT_MAX_SIZE - ti->nc);
-	if (ilen == 0)
-		return;
-
-	unsigned new_width = LIN_TO_COL(ti, ti->text_coord) + ti->nc + ilen;
-	unsigned new_height = (new_width / ti->con_cols) + 1;
-	if (new_height >= ti->con_rows) {
-		/* Disallow text longer than 1 page for now. */
-		return;
-	}
-
-	if (ti->nc > 0) {
-		size_t i;
-		for (i = ti->nc; i > ti->pos; i--)
-			ti->buffer[i + ilen - 1] = ti->buffer[i - 1];
-	}
-
-	size_t off = 0;
-	size_t i = 0;
-	while (i < ilen) {
-		char32_t c = str_decode(str, &off, STR_NO_LIMIT);
-		if (c == '\0')
-			break;
-
-		/* Filter out non-printable chars. */
-		if (c < 32)
-			c = 32;
-
-		ti->buffer[ti->pos + i] = c;
-		i++;
-	}
-
-	ti->pos += ilen;
-	ti->nc += ilen;
-	ti->buffer[ti->nc] = '\0';
-	ti->sel_start = ti->pos;
-
-	tinput_display_tail(ti, ti->pos - ilen, 0);
-	tinput_position_caret(ti);
-}
-
-static void tinput_backspace(tinput_t *ti)
-{
-	if (tinput_sel_active(ti)) {
-		tinput_sel_delete(ti);
-		return;
-	}
-
-	if (ti->pos == 0)
-		return;
-
-	size_t i;
-	for (i = ti->pos; i < ti->nc; i++)
-		ti->buffer[i - 1] = ti->buffer[i];
-
-	ti->pos -= 1;
-	ti->nc -= 1;
-	ti->buffer[ti->nc] = '\0';
-	ti->sel_start = ti->pos;
-
-	tinput_display_tail(ti, ti->pos, 1);
-	tinput_position_caret(ti);
-}
-
-static void tinput_delete(tinput_t *ti)
-{
-	if (tinput_sel_active(ti)) {
-		tinput_sel_delete(ti);
-		return;
-	}
-
-	if (ti->pos == ti->nc)
-		return;
-
-	ti->pos += 1;
-	ti->sel_start = ti->pos;
-
-	tinput_backspace(ti);
-}
-
-static void tinput_seek_cell(tinput_t *ti, seek_dir_t dir, bool shift_held)
-{
-	tinput_pre_seek(ti, shift_held);
-
-	if (dir == seek_forward) {
-		if (ti->pos < ti->nc)
-			ti->pos += 1;
-	} else {
-		if (ti->pos > 0)
-			ti->pos -= 1;
-	}
-
-	tinput_post_seek(ti, shift_held);
-}
-
-static void tinput_seek_word(tinput_t *ti, seek_dir_t dir, bool shift_held)
-{
-	tinput_pre_seek(ti, shift_held);
-
-	if (dir == seek_forward) {
-		if (ti->pos == ti->nc)
-			return;
-
-		while (true) {
-			ti->pos += 1;
-
-			if (ti->pos == ti->nc)
-				break;
-
-			if ((ti->buffer[ti->pos - 1] == ' ') &&
-			    (ti->buffer[ti->pos] != ' '))
-				break;
-		}
-	} else {
-		if (ti->pos == 0)
-			return;
-
-		while (true) {
-			ti->pos -= 1;
-
-			if (ti->pos == 0)
-				break;
-
-			if (ti->buffer[ti->pos - 1] == ' ' &&
-			    ti->buffer[ti->pos] != ' ')
-				break;
-		}
-
-	}
-
-	tinput_post_seek(ti, shift_held);
-}
-
-static void tinput_seek_vertical(tinput_t *ti, seek_dir_t dir, bool shift_held)
-{
-	tinput_pre_seek(ti, shift_held);
-
-	if (dir == seek_forward) {
-		if (ti->pos + ti->con_cols <= ti->nc)
-			ti->pos = ti->pos + ti->con_cols;
-	} else {
-		if (ti->pos >= ti->con_cols)
-			ti->pos = ti->pos - ti->con_cols;
-	}
-
-	tinput_post_seek(ti, shift_held);
-}
-
-static void tinput_seek_scrpos(tinput_t *ti, int col, int line, bool shift_held)
-{
-	unsigned lpos;
-	tinput_pre_seek(ti, shift_held);
-
-	lpos = LIN_POS(ti, col, line);
-
-	if (lpos > ti->text_coord)
-		ti->pos = lpos -  ti->text_coord;
-	else
-		ti->pos = 0;
-	if (ti->pos > ti->nc)
-		ti->pos = ti->nc;
-
-	tinput_post_seek(ti, shift_held);
-}
-
-static void tinput_seek_max(tinput_t *ti, seek_dir_t dir, bool shift_held)
-{
-	tinput_pre_seek(ti, shift_held);
-
-	if (dir == seek_backward)
-		ti->pos = 0;
-	else
-		ti->pos = ti->nc;
-
-	tinput_post_seek(ti, shift_held);
-}
-
-static void tinput_pre_seek(tinput_t *ti, bool shift_held)
-{
-	if ((tinput_sel_active(ti)) && (!shift_held)) {
-		/* Unselect and redraw. */
-		ti->sel_start = ti->pos;
-		tinput_display_tail(ti, 0, 0);
-		tinput_position_caret(ti);
-	}
-}
-
-static void tinput_post_seek(tinput_t *ti, bool shift_held)
-{
-	if (shift_held) {
-		/* Selecting text. Need redraw. */
-		tinput_display_tail(ti, 0, 0);
-	} else {
-		/* Shift not held. Keep selection empty. */
-		ti->sel_start = ti->pos;
-	}
-
-	tinput_position_caret(ti);
-}
-
-static void tinput_history_insert(tinput_t *ti, char *str)
-{
-	if (ti->hnum < HISTORY_LEN) {
-		ti->hnum += 1;
-	} else {
-		if (ti->history[HISTORY_LEN] != NULL)
-			free(ti->history[HISTORY_LEN]);
-	}
-
-	size_t i;
-	for (i = ti->hnum; i > 1; i--)
-		ti->history[i] = ti->history[i - 1];
-
-	ti->history[1] = str_dup(str);
-
-	if (ti->history[0] != NULL) {
-		free(ti->history[0]);
-		ti->history[0] = NULL;
-	}
-}
-
-static void tinput_set_str(tinput_t *ti, const char *str)
-{
-	str_to_wstr(ti->buffer, INPUT_MAX_SIZE, str);
-	ti->nc = wstr_length(ti->buffer);
-	ti->pos = ti->nc;
-	ti->sel_start = ti->pos;
-}
-
-static void tinput_sel_get_bounds(tinput_t *ti, size_t *sa, size_t *sb)
-{
-	if (ti->sel_start < ti->pos) {
-		*sa = ti->sel_start;
-		*sb = ti->pos;
-	} else {
-		*sa = ti->pos;
-		*sb = ti->sel_start;
-	}
-}
-
-static bool tinput_sel_active(tinput_t *ti)
-{
-	return (ti->sel_start != ti->pos);
-}
-
-static void tinput_sel_all(tinput_t *ti)
-{
-	ti->sel_start = 0;
-	ti->pos = ti->nc;
-	tinput_display_tail(ti, 0, 0);
-	tinput_position_caret(ti);
-}
-
-static void tinput_sel_delete(tinput_t *ti)
-{
-	size_t sa;
-	size_t sb;
-
-	tinput_sel_get_bounds(ti, &sa, &sb);
-	if (sa == sb)
-		return;
-
-	memmove(ti->buffer + sa, ti->buffer + sb,
-	    (ti->nc - sb) * sizeof(char32_t));
-
-	ti->pos = ti->sel_start = sa;
-	ti->nc -= (sb - sa);
-	ti->buffer[ti->nc] = '\0';
-
-	tinput_display_tail(ti, sa, sb - sa);
-	tinput_position_caret(ti);
-}
-
-static void tinput_sel_copy_to_cb(tinput_t *ti)
-{
-	size_t sa;
-	size_t sb;
-
-	tinput_sel_get_bounds(ti, &sa, &sb);
-
-	char *str;
-
-	if (sb < ti->nc) {
-		char32_t tmp_c = ti->buffer[sb];
-		ti->buffer[sb] = '\0';
-		str = wstr_to_astr(ti->buffer + sa);
-		ti->buffer[sb] = tmp_c;
-	} else
-		str = wstr_to_astr(ti->buffer + sa);
-
-	if (str == NULL)
-		goto error;
-
-	if (clipboard_put_str(str) != EOK)
-		goto error;
-
-	free(str);
-	return;
-
-error:
-	/* TODO: Give the user some kind of warning. */
-	return;
-}
-
-static void tinput_paste_from_cb(tinput_t *ti)
-{
-	char *str;
-	errno_t rc = clipboard_get_str(&str);
-
-	if ((rc != EOK) || (str == NULL)) {
-		/* TODO: Give the user some kind of warning. */
-		return;
-	}
-
-	tinput_insert_string(ti, str);
-	free(str);
-}
-
-static void tinput_history_seek(tinput_t *ti, int offs)
-{
-	if (offs >= 0) {
-		if (ti->hpos + offs > ti->hnum)
-			return;
-	} else {
-		if (ti->hpos < (size_t) -offs)
-			return;
-	}
-
-	if (ti->history[ti->hpos] != NULL) {
-		free(ti->history[ti->hpos]);
-		ti->history[ti->hpos] = NULL;
-	}
-
-	ti->history[ti->hpos] = tinput_get_str(ti);
-	ti->hpos += offs;
-
-	int pad = (int) ti->nc - str_length(ti->history[ti->hpos]);
-	if (pad < 0)
-		pad = 0;
-
-	tinput_set_str(ti, ti->history[ti->hpos]);
-	tinput_display_tail(ti, 0, pad);
-	tinput_update_origin(ti);
-	tinput_position_caret(ti);
-}
-
-/** Compare two entries in array of completions. */
-static int compl_cmp(const void *va, const void *vb)
-{
-	const char *a = *(const char **) va;
-	const char *b = *(const char **) vb;
-
-	return str_cmp(a, b);
-}
-
-static size_t common_pref_len(const char *a, const char *b)
-{
-	size_t i;
-	size_t a_off, b_off;
-	char32_t ca, cb;
-
-	i = 0;
-	a_off = 0;
-	b_off = 0;
-
-	while (true) {
-		ca = str_decode(a, &a_off, STR_NO_LIMIT);
-		cb = str_decode(b, &b_off, STR_NO_LIMIT);
-
-		if (ca == '\0' || cb == '\0' || ca != cb)
-			break;
-		++i;
-	}
-
-	return i;
-}
-
-/* Print a list of completions */
-static void tinput_show_completions(tinput_t *ti, char **compl, size_t cnum)
-{
-	unsigned int i;
-	/* Determine the maximum width of the completion in chars */
-	size_t max_width = 0;
-	for (i = 0; i < cnum; i++)
-		max_width = max(max_width, str_width(compl[i]));
-
-	unsigned int cols = max(1, (ti->con_cols + 1) / (max_width + 1));
-	unsigned int padding = 0;
-	if (cols * max_width + (cols - 1) < ti->con_cols) {
-		padding = ti->con_cols - cols * max_width - (cols - 1);
-	}
-	unsigned int col_width = max_width + padding / cols;
-	unsigned int rows = cnum / cols + ((cnum % cols) != 0);
-
-	unsigned int row, col;
-
-	for (row = 0; row < rows; row++) {
-		unsigned int display_col = 0;
-		for (col = 0; col < cols; col++) {
-			size_t compl_idx = col * rows + row;
-			if (compl_idx >= cnum)
-				break;
-			if (col) {
-				printf(" ");
-				display_col++;
-			}
-			printf("%s", compl[compl_idx]);
-			size_t compl_width = str_width(compl[compl_idx]);
-			display_col += compl_width;
-			if (col < cols - 1) {
-				for (i = compl_width; i < col_width; i++) {
-					printf(" ");
-					display_col++;
-				}
-			}
-		}
-		if ((display_col % ti->con_cols) > 0)
-			printf("\n");
-	}
-	fflush(stdout);
-}
-
-static void tinput_text_complete(tinput_t *ti)
-{
-	void *state;
-	size_t cstart;
-	char *ctmp;
-	char **compl;     	/* Array of completions */
-	size_t compl_len;	/* Current length of @c compl array */
-	size_t cnum;
-	size_t i;
-	errno_t rc;
-
-	if (ti->compl_ops == NULL)
-		return;
-
-	/*
-	 * Obtain list of all possible completions (growing array).
-	 */
-
-	rc = (*ti->compl_ops->init)(ti->buffer, ti->pos, &cstart, &state);
-	if (rc != EOK)
-		return;
-
-	cnum = 0;
-
-	compl_len = 1;
-	compl = malloc(compl_len * sizeof(char *));
-	if (compl == NULL) {
-		printf("Error: Out of memory.\n");
-		return;
-	}
-
-	while (true) {
-		rc = (*ti->compl_ops->get_next)(state, &ctmp);
-		if (rc != EOK)
-			break;
-
-		if (cnum >= compl_len) {
-			/* Extend array */
-			compl_len = 2 * compl_len;
-			char **temp = realloc(compl, compl_len * sizeof(char *));
-			if (temp == NULL) {
-				free(compl);
-				printf("Error: Out of memory.\n");
-				break;
-			}
-			compl = temp;
-		}
-
-		compl[cnum] = str_dup(ctmp);
-		if (compl[cnum] == NULL) {
-			printf("Error: Out of memory.\n");
-			break;
-		}
-		cnum++;
-	}
-
-	(*ti->compl_ops->fini)(state);
-
-	if (cnum > 1) {
-		/*
-		 * More than one match. Determine maximum common prefix.
-		 */
-		size_t cplen;
-
-		cplen = str_length(compl[0]);
-		for (i = 1; i < cnum; i++)
-			cplen = min(cplen, common_pref_len(compl[0], compl[i]));
-
-		/* Compute how many bytes we should skip. */
-		size_t istart = str_lsize(compl[0], ti->pos - cstart);
-
-		if (cplen > istart) {
-			/* Insert common prefix. */
-
-			/* Copy remainder of common prefix. */
-			char *cpref = str_ndup(compl[0] + istart,
-			    str_lsize(compl[0], cplen - istart));
-
-			/* Insert it. */
-			tinput_insert_string(ti, cpref);
-			free(cpref);
-		} else {
-			/* No common prefix. Sort and display all entries. */
-
-			qsort(compl, cnum, sizeof(char *), compl_cmp);
-
-			tinput_jump_after(ti);
-			tinput_show_completions(ti, compl, cnum);
-			tinput_display(ti);
-		}
-	} else if (cnum == 1) {
-		/*
-		 * We have exactly one match. Insert it.
-		 */
-
-		/* Compute how many bytes of completion string we should skip. */
-		size_t istart = str_lsize(compl[0], ti->pos - cstart);
-
-		/* Insert remainder of completion string at current position. */
-		tinput_insert_string(ti, compl[0] + istart);
-	}
-
-	for (i = 0; i < cnum; i++)
-		free(compl[i]);
-	free(compl);
-}
-
-/** Initialize text input field.
- *
- * Must be called before using the field. It clears the history.
- */
-static void tinput_init(tinput_t *ti)
-{
-	ti->console = console_init(stdin, stdout);
-	ti->hnum = 0;
-	ti->hpos = 0;
-	ti->history[0] = NULL;
-}
-
-/** Set prompt string.
- *
- * @param ti		Text input
- * @param prompt	Prompt string
- *
- * @return		EOK on success, ENOMEM if out of memory.
- */
-errno_t tinput_set_prompt(tinput_t *ti, const char *prompt)
-{
-	if (ti->prompt != NULL)
-		free(ti->prompt);
-
-	ti->prompt = str_dup(prompt);
-	if (ti->prompt == NULL)
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Set completion ops.
- *
- * Set pointer to completion ops structure that will be used for text
- * completion.
- */
-void tinput_set_compl_ops(tinput_t *ti, tinput_compl_ops_t *compl_ops)
-{
-	ti->compl_ops = compl_ops;
-}
-
-/** Handle key press event. */
-static void tinput_key_press(tinput_t *ti, kbd_event_t *kev)
-{
-	if (kev->key == KC_LSHIFT)
-		ti->lshift_held = true;
-	if (kev->key == KC_RSHIFT)
-		ti->rshift_held = true;
-
-	if (((kev->mods & KM_CTRL) != 0) &&
-	    ((kev->mods & (KM_ALT | KM_SHIFT)) == 0))
-		tinput_key_ctrl(ti, kev);
-
-	if (((kev->mods & KM_SHIFT) != 0) &&
-	    ((kev->mods & (KM_CTRL | KM_ALT)) == 0))
-		tinput_key_shift(ti, kev);
-
-	if (((kev->mods & KM_CTRL) != 0) &&
-	    ((kev->mods & KM_SHIFT) != 0) &&
-	    ((kev->mods & KM_ALT) == 0))
-		tinput_key_ctrl_shift(ti, kev);
-
-	if ((kev->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
-		tinput_key_unmod(ti, kev);
-
-	if (((kev->mods & (KM_CTRL | KM_ALT)) == 0) && kev->c >= ' ') {
-		tinput_sel_delete(ti);
-		tinput_insert_char(ti, kev->c);
-	}
-}
-
-/** Handle key release event. */
-static void tinput_key_release(tinput_t *ti, kbd_event_t *kev)
-{
-	if (kev->key == KC_LSHIFT)
-		ti->lshift_held = false;
-	if (kev->key == KC_RSHIFT)
-		ti->rshift_held = false;
-}
-
-/** Position event */
-static void tinput_pos(tinput_t *ti, pos_event_t *ev)
-{
-	if (ev->type == POS_PRESS) {
-		tinput_seek_scrpos(ti, ev->hpos, ev->vpos,
-		    ti->lshift_held || ti->rshift_held);
-	}
-}
-
-static errno_t tinput_resize(tinput_t *ti)
-{
-	assert(ti->prompt_coord % ti->con_cols == 0);
-
-	errno_t rc = console_get_size(ti->console, &ti->con_cols, &ti->con_rows);
-	if (rc != EOK)
-		return rc;
-
-	sysarg_t col, row;
-	rc = console_get_pos(ti->console, &col, &row);
-	if (rc != EOK)
-		return rc;
-
-	assert(ti->prompt_coord <= ti->text_coord);
-	unsigned prompt_len = ti->text_coord - ti->prompt_coord;
-
-	size_t new_caret_coord = row * ti->con_cols + col;
-
-	if (prompt_len <= new_caret_coord && ti->pos <= new_caret_coord - prompt_len) {
-		ti->text_coord = new_caret_coord - ti->pos;
-		ti->prompt_coord = ti->text_coord - prompt_len;
-
-		unsigned prompt_col = ti->prompt_coord % ti->con_cols;
-		if (prompt_col != 0) {
-			/*
-			 * Prompt doesn't seem to start at column 0, which means
-			 * the console didn't reflow the line like we expected it to.
-			 * Change offsets a bit to recover.
-			 */
-			fprintf(stderr, "Unexpected prompt position after resize.\n");
-			ti->prompt_coord -= prompt_col;
-			ti->text_coord -= prompt_col;
-
-			console_cursor_visibility(ti->console, false);
-			tinput_display_prompt(ti);
-			tinput_display_tail(ti, 0, prompt_col);
-			tinput_position_caret(ti);
-			console_cursor_visibility(ti->console, true);
-		}
-
-		assert(ti->prompt_coord % ti->con_cols == 0);
-	} else {
-		/*
-		 * Overflown screen.
-		 * We will just trim the buffer and rewrite everything.
-		 */
-		console_clear(ti->console);
-
-		ti->nc = min(ti->nc, ti->con_cols * ti->con_rows - prompt_len - 1);
-		ti->pos = min(ti->pos, ti->nc);
-		ti->sel_start = min(ti->sel_start, ti->nc);
-
-		ti->prompt_coord = 0;
-		ti->text_coord = prompt_len;
-
-		console_cursor_visibility(ti->console, false);
-		tinput_display_prompt(ti);
-		tinput_display_tail(ti, 0, 0);
-		tinput_position_caret(ti);
-		console_cursor_visibility(ti->console, true);
-	}
-
-	assert(ti->nc + ti->text_coord < ti->con_cols * ti->con_rows);
-
-	return EOK;
-}
-
-/** Read in one line of input with initial text provided.
- *
- * @param ti   Text input
- * @param istr Initial string
- * @param dstr Place to save pointer to new string
- *
- * @return EOK on success
- * @return ENOENT if user requested abort
- * @return EIO if communication with console failed
- *
- */
-errno_t tinput_read_i(tinput_t *ti, const char *istr, char **dstr)
-{
-	errno_t rc;
-
-	console_flush(ti->console);
-	if (console_get_size(ti->console, &ti->con_cols, &ti->con_rows) != EOK)
-		return EIO;
-
-	tinput_set_str(ti, istr);
-
-	ti->sel_start = 0;
-	ti->done = false;
-	ti->exit_clui = false;
-
-	if (tinput_display(ti) != EOK)
-		return EIO;
-
-	while (!ti->done) {
-		console_flush(ti->console);
-
-		cons_event_t ev;
-		rc = console_get_event(ti->console, &ev);
-		if (rc != EOK)
-			return EIO;
-
-		switch (ev.type) {
-		case CEV_KEY:
-			if (ev.ev.key.type == KEY_PRESS)
-				tinput_key_press(ti, &ev.ev.key);
-			else
-				tinput_key_release(ti, &ev.ev.key);
-			break;
-		case CEV_POS:
-			tinput_pos(ti, &ev.ev.pos);
-			break;
-		case CEV_RESIZE:
-			tinput_resize(ti);
-			break;
-		}
-	}
-
-	if (ti->exit_clui)
-		return ENOENT;
-
-	ti->pos = ti->nc;
-	tinput_position_caret(ti);
-	putchar('\n');
-
-	char *str = tinput_get_str(ti);
-	if (str_cmp(str, "") != 0)
-		tinput_history_insert(ti, str);
-
-	ti->hpos = 0;
-
-	*dstr = str;
-	return EOK;
-}
-
-/** Read in one line of input.
- *
- * @param ti   Text input
- * @param dstr Place to save pointer to new string.
- *
- * @return EOK on success
- * @return ENOENT if user requested abort
- * @return EIO if communication with console failed
- *
- */
-errno_t tinput_read(tinput_t *ti, char **dstr)
-{
-	return tinput_read_i(ti, "", dstr);
-}
-
-static void tinput_key_ctrl(tinput_t *ti, kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_LEFT:
-		tinput_seek_word(ti, seek_backward, false);
-		break;
-	case KC_RIGHT:
-		tinput_seek_word(ti, seek_forward, false);
-		break;
-	case KC_UP:
-		tinput_seek_vertical(ti, seek_backward, false);
-		break;
-	case KC_DOWN:
-		tinput_seek_vertical(ti, seek_forward, false);
-		break;
-	case KC_X:
-		tinput_sel_copy_to_cb(ti);
-		tinput_sel_delete(ti);
-		break;
-	case KC_C:
-		tinput_sel_copy_to_cb(ti);
-		break;
-	case KC_V:
-		tinput_sel_delete(ti);
-		tinput_paste_from_cb(ti);
-		break;
-	case KC_A:
-		tinput_sel_all(ti);
-		break;
-	case KC_Q:
-		/* Signal libary client to quit interactive loop. */
-		ti->done = true;
-		ti->exit_clui = true;
-		break;
-	default:
-		break;
-	}
-}
-
-static void tinput_key_ctrl_shift(tinput_t *ti, kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_LEFT:
-		tinput_seek_word(ti, seek_backward, true);
-		break;
-	case KC_RIGHT:
-		tinput_seek_word(ti, seek_forward, true);
-		break;
-	case KC_UP:
-		tinput_seek_vertical(ti, seek_backward, true);
-		break;
-	case KC_DOWN:
-		tinput_seek_vertical(ti, seek_forward, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void tinput_key_shift(tinput_t *ti, kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_LEFT:
-		tinput_seek_cell(ti, seek_backward, true);
-		break;
-	case KC_RIGHT:
-		tinput_seek_cell(ti, seek_forward, true);
-		break;
-	case KC_UP:
-		tinput_seek_vertical(ti, seek_backward, true);
-		break;
-	case KC_DOWN:
-		tinput_seek_vertical(ti, seek_forward, true);
-		break;
-	case KC_HOME:
-		tinput_seek_max(ti, seek_backward, true);
-		break;
-	case KC_END:
-		tinput_seek_max(ti, seek_forward, true);
-		break;
-	default:
-		break;
-	}
-}
-
-static void tinput_key_unmod(tinput_t *ti, kbd_event_t *ev)
-{
-	switch (ev->key) {
-	case KC_ENTER:
-	case KC_NENTER:
-		ti->done = true;
-		break;
-	case KC_BACKSPACE:
-		tinput_backspace(ti);
-		break;
-	case KC_DELETE:
-		tinput_delete(ti);
-		break;
-	case KC_LEFT:
-		tinput_seek_cell(ti, seek_backward, false);
-		break;
-	case KC_RIGHT:
-		tinput_seek_cell(ti, seek_forward, false);
-		break;
-	case KC_HOME:
-		tinput_seek_max(ti, seek_backward, false);
-		break;
-	case KC_END:
-		tinput_seek_max(ti, seek_forward, false);
-		break;
-	case KC_UP:
-		tinput_history_seek(ti, 1);
-		break;
-	case KC_DOWN:
-		tinput_history_seek(ti, -1);
-		break;
-	case KC_TAB:
-		tinput_text_complete(ti);
-		break;
-	default:
-		break;
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/codepage/doc/doxygroups.h
===================================================================
--- uspace/lib/codepage/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libcodepage libcodepage
- * @ingroup libs
- */
Index: pace/lib/codepage/include/codepage/cp437.h
===================================================================
--- uspace/lib/codepage/include/codepage/cp437.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcodepage
- * @{
- */
-/**
- * @file Code page 437
- */
-
-#ifndef _CODEPAGE_CP437_H
-#define _CODEPAGE_CP437_H
-
-#include <errno.h>
-#include <stdint.h>
-#include <str.h>
-
-extern char32_t cp437_decode(uint8_t);
-extern errno_t cp437_encode(char32_t, uint8_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/codepage/meson.build
===================================================================
--- uspace/lib/codepage/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/cp437.c',
-)
-
-test_src = files(
-	'test/cp437.c',
-	'test/main.c',
-)
Index: pace/lib/codepage/src/cp437.c
===================================================================
--- uspace/lib/codepage/src/cp437.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,328 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcodepage
- * @{
- */
-/**
- * @file Code page 437
- *
- * The ROM fonts of graphics adapters decending from IBM's MDA/CGA
- * use Code Page 437 and provide popular graphic characters
- * (such as box drawing) used in text-based user interfaces.
- */
-
-#include <codepage/cp437.h>
-#include <errno.h>
-#include <stdint.h>
-#include <str.h>
-
-/** All 256 graphic characters of Code Page 437 represented in Unicode */
-static char32_t cp437[256] = {
-	/* 0x */
-	L'\x0000', L'\x263a', L'\x263b', L'\x2665',
-	L'\x2666', L'\x2663', L'\x2660', L'\x2022',
-	L'\x25d8', L'\x25cb', L'\x25d9', L'\x2642',
-	L'\x2640', L'\x266a', L'\x266b', L'\x263c',
-
-	/* 1x */
-	L'\x25ba', L'\x25c4', L'\x2195', L'\x203c',
-	L'\x00b6', L'\x00a7', L'\x25ac', L'\x21a8',
-	L'\x2191', L'\x2193', L'\x2192', L'\x2190',
-	L'\x221f', L'\x2194', L'\x25b2', L'\x25bc',
-
-	/* 2x */
-	L'\x0020', L'\x0021', L'\x0022', L'\x0023',
-	L'\x0024', L'\x0025', L'\x0026', L'\x0027',
-	L'\x0028', L'\x0029', L'\x002a', L'\x002b',
-	L'\x002c', L'\x002d', L'\x002e', L'\x002f',
-
-	/* 3x */
-	L'\x0030', L'\x0031', L'\x0032', L'\x0033',
-	L'\x0034', L'\x0035', L'\x0036', L'\x0037',
-	L'\x0038', L'\x0039', L'\x003a', L'\x003b',
-	L'\x003c', L'\x003d', L'\x003e', L'\x003f',
-
-	/* 4x */
-	L'\x0040', L'\x0041', L'\x0042', L'\x0043',
-	L'\x0044', L'\x0045', L'\x0046', L'\x0047',
-	L'\x0048', L'\x0049', L'\x004a', L'\x004b',
-	L'\x004c', L'\x004d', L'\x004e', L'\x004f',
-
-	/* 5x */
-	L'\x0050', L'\x0051', L'\x0052', L'\x0053',
-	L'\x0054', L'\x0055', L'\x0056', L'\x0057',
-	L'\x0058', L'\x0059', L'\x005a', L'\x005b',
-	L'\x005c', L'\x005d', L'\x005e', L'\x005f',
-
-	/* 6x */
-	L'\x0060', L'\x0061', L'\x0062', L'\x0063',
-	L'\x0064', L'\x0065', L'\x0066', L'\x0067',
-	L'\x0068', L'\x0069', L'\x006a', L'\x006b',
-	L'\x006c', L'\x006d', L'\x006e', L'\x006f',
-
-	/* 7x */
-	L'\x0070', L'\x0071', L'\x0072', L'\x0073',
-	L'\x0074', L'\x0075', L'\x0076', L'\x0077',
-	L'\x0078', L'\x0079', L'\x007a', L'\x007b',
-	L'\x007c', L'\x007d', L'\x007e', L'\x2302',
-
-	/* 8x */
-	L'\x00c7', L'\x00fc', L'\x00e9', L'\x00e2',
-	L'\x00e4', L'\x00e0', L'\x00e5', L'\x00e7',
-	L'\x00ea', L'\x00eb', L'\x00e8', L'\x00ef',
-	L'\x00ee', L'\x00ec', L'\x00c4', L'\x00c5',
-
-	/* 9x */
-	L'\x00c9', L'\x00e6', L'\x00c6', L'\x00f4',
-	L'\x00f6', L'\x00f2', L'\x00fb', L'\x00f9',
-	L'\x00ff', L'\x00d6', L'\x00dc', L'\x00a2',
-	L'\x00a3', L'\x00a5', L'\x20a7', L'\x0192',
-
-	/* Ax */
-	L'\x00e1', L'\x00ed', L'\x00f3', L'\x00fa',
-	L'\x00f1', L'\x00d1', L'\x00aa', L'\x00ba',
-	L'\x00bf', L'\x2310', L'\x00ac', L'\x00bd',
-	L'\x00bc', L'\x00a1', L'\x00ab', L'\x00bb',
-
-	/* Bx */
-	L'\x2591', L'\x2592', L'\x2593', L'\x2502',
-	L'\x2524', L'\x2561', L'\x2562', L'\x2556',
-	L'\x2555', L'\x2563', L'\x2551', L'\x2557',
-	L'\x255d', L'\x255c', L'\x255b', L'\x2510',
-
-	/* Cx */
-	L'\x2514', L'\x2534', L'\x252c', L'\x251c',
-	L'\x2500', L'\x253c', L'\x255e', L'\x255f',
-	L'\x255a', L'\x2554', L'\x2569', L'\x2566',
-	L'\x2560', L'\x2550', L'\x256c', L'\x2567',
-
-	/* Dx */
-	L'\x2568', L'\x2564', L'\x2565', L'\x2559',
-	L'\x2558', L'\x2552', L'\x2553', L'\x256b',
-	L'\x256a', L'\x2518', L'\x250c', L'\x2588',
-	L'\x2584', L'\x258c', L'\x2590', L'\x2580',
-
-	/* Ex */
-	L'\x03b1', L'\x00df', L'\x0393', L'\x03c0',
-	L'\x03a3', L'\x03c3', L'\x00b5', L'\x03c4',
-	L'\x03a6', L'\x0398', L'\x03a9', L'\x03b4',
-	L'\x221e', L'\x03c6', L'\x03b5', L'\x2229',
-
-	/* Fx */
-	L'\x2261', L'\x00b1', L'\x2265', L'\x2264',
-	L'\x2320', L'\x2321', L'\x00f7', L'\x2248',
-	L'\x00b0', L'\x2219', L'\x00b7', L'\x221a',
-	L'\x207f', L'\x00b2', L'\x25a0', L'\x00a0'
-};
-
-/** Map of Unicode characters 0x0000 - 0x0400 to code page 437 */
-static uint8_t u0xxx_to_cp437[0x400] = {
-	/* 0x */
-	[0x0000] = 0x00,
-
-	/* 1x */
-	[0x00b6] = 0x14, [0x00a7] = 0x15,
-
-	/* 2x */
-	[0x0020] = 0x20, [0x0021] = 0x21, [0x0022] = 0x22, [0x0023] = 0x23,
-	[0x0024] = 0x24, [0x0025] = 0x25, [0x0026] = 0x26, [0x0027] = 0x27,
-	[0x0028] = 0x28, [0x0029] = 0x29, [0x002a] = 0x2a, [0x002b] = 0x2b,
-	[0x002c] = 0x2c, [0x002d] = 0x2d, [0x002e] = 0x2e, [0x002f] = 0x2f,
-
-	/* 3x */
-	[0x0030] = 0x30, [0x0031] = 0x31, [0x0032] = 0x32, [0x0033] = 0x33,
-	[0x0034] = 0x34, [0x0035] = 0x35, [0x0036] = 0x36, [0x0037] = 0x37,
-	[0x0038] = 0x38, [0x0039] = 0x39, [0x003a] = 0x3a, [0x003b] = 0x3b,
-	[0x003c] = 0x3c, [0x003d] = 0x3d, [0x003e] = 0x3e, [0x003f] = 0x3f,
-
-	/* 4x */
-	[0x0040] = 0x40, [0x0041] = 0x41, [0x0042] = 0x42, [0x0043] = 0x43,
-	[0x0044] = 0x44, [0x0045] = 0x45, [0x0046] = 0x46, [0x0047] = 0x47,
-	[0x0048] = 0x48, [0x0049] = 0x49, [0x004a] = 0x4a, [0x004b] = 0x4b,
-	[0x004c] = 0x4c, [0x004d] = 0x4d, [0x004e] = 0x4e, [0x004f] = 0x4f,
-
-	/* 5x */
-	[0x0050] = 0x50, [0x0051] = 0x51, [0x0052] = 0x52, [0x0053] = 0x53,
-	[0x0054] = 0x54, [0x0055] = 0x55, [0x0056] = 0x56, [0x0057] = 0x57,
-	[0x0058] = 0x58, [0x0059] = 0x59, [0x005a] = 0x5a, [0x005b] = 0x5b,
-	[0x005c] = 0x5c, [0x005d] = 0x5d, [0x005e] = 0x5e, [0x005f] = 0x5f,
-
-	/* 6x */
-	[0x0060] = 0x60, [0x0061] = 0x61, [0x0062] = 0x62, [0x0063] = 0x63,
-	[0x0064] = 0x64, [0x0065] = 0x65, [0x0066] = 0x66, [0x0067] = 0x67,
-	[0x0068] = 0x68, [0x0069] = 0x69, [0x006a] = 0x6a, [0x006b] = 0x6b,
-	[0x006c] = 0x6c, [0x006d] = 0x6d, [0x006e] = 0x6e, [0x006f] = 0x6f,
-
-	/* 7x */
-	[0x0070] = 0x70, [0x0071] = 0x71, [0x0072] = 0x72, [0x0073] = 0x73,
-	[0x0074] = 0x74, [0x0075] = 0x75, [0x0076] = 0x76, [0x0077] = 0x77,
-	[0x0078] = 0x78, [0x0079] = 0x79, [0x007a] = 0x7a, [0x007b] = 0x7b,
-	[0x007c] = 0x7c, [0x007d] = 0x7d, [0x007e] = 0x7e,
-
-	/* 8x */
-	[0x00c7] = 0x80, [0x00fc] = 0x81, [0x00e9] = 0x82, [0x00e2] = 0x83,
-	[0x00e4] = 0x84, [0x00e0] = 0x85, [0x00e5] = 0x86, [0x00e7] = 0x87,
-	[0x00ea] = 0x88, [0x00eb] = 0x89, [0x00e8] = 0x8a, [0x00ef] = 0x8b,
-	[0x00ee] = 0x8c, [0x00ec] = 0x8d, [0x00c4] = 0x8e, [0x00c5] = 0x8f,
-
-	/* 9x */
-	[0x00c9] = 0x90, [0x00e6] = 0x91, [0x00c6] = 0x92, [0x00f4] = 0x93,
-	[0x00f6] = 0x94, [0x00f2] = 0x95, [0x00fb] = 0x96, [0x00f9] = 0x97,
-	[0x00ff] = 0x98, [0x00d6] = 0x99, [0x00dc] = 0x9a, [0x00a2] = 0x9b,
-	[0x00a3] = 0x9c, [0x00a5] = 0x9d,                  [0x0192] = 0x9f,
-
-	/* Ax */
-	[0x00e1] = 0xa0, [0x00ed] = 0xa1, [0x00f3] = 0xa2, [0x00fa] = 0xa3,
-	[0x00f1] = 0xa4, [0x00d1] = 0xa5, [0x00aa] = 0xa6, [0x00ba] = 0xa7,
-	[0x00bf] = 0xa8,                  [0x00ac] = 0xaa, [0x00bd] = 0xab,
-	[0x00bc] = 0xac, [0x00a1] = 0xad, [0x00ab] = 0xae, [0x00bb] = 0xaf,
-
-	/* Ex */
-	[0x03b1] = 0xe0, [0x00df] = 0xe1, [0x0393] = 0xe2, [0x03c0] = 0xe3,
-	[0x03a3] = 0xe4, [0x03c3] = 0xe5, [0x00b5] = 0xe6, [0x03c4] = 0xe7,
-	[0x03a6] = 0xe8, [0x0398] = 0xe9, [0x03a9] = 0xea, [0x03b4] = 0xeb,
-	/* skipped */    [0x03c6] = 0xed, [0x03b5] = 0xee,
-
-	/* Fx */
-	/* skipped */    [0x00b1] = 0xf1,
-	/* skipped */                     [0x00f7] = 0xf6,
-	[0x00b0] = 0xf8, [0x00b7] = 0xfa,
-	/* skipped */    [0x00b2] = 0xfd,                  [0x00a0] = 0xff,
-};
-
-/** Map of Unicode characters 0x2000 - 0x2700 to code page 437 */
-static uint8_t u2xxx_to_cp437[0x700] = {
-	/* 0x */
-	/* skipped */   [0x63a] = 0x01, [0x63b] = 0x02, [0x665] = 0x03,
-	[0x666] = 0x04, [0x663] = 0x05, [0x660] = 0x06, [0x022] = 0x07,
-	[0x5d8] = 0x08, [0x5cb] = 0x09, [0x5d9] = 0x0a, [0x642] = 0x0b,
-	[0x640] = 0x0c, [0x66a] = 0x0d, [0x66b] = 0x0e, [0x63c] = 0x0f,
-
-	/* 1x */
-	[0x5ba] = 0x10, [0x5c4] = 0x11, [0x195] = 0x12, [0x03c] = 0x13,
-	/* skipped */                   [0x5ac] = 0x16, [0x1a8] = 0x17,
-	[0x191] = 0x18, [0x193] = 0x19, [0x192] = 0x1a, [0x190] = 0x1b,
-	[0x21f] = 0x1c, [0x194] = 0x1d, [0x5b2] = 0x1e, [0x5bc] = 0x1f,
-
-	/* 7x */
-	[0x302] = 0x7f,
-
-	/* 9x */
-	[0x0a7] = 0x9e,
-
-	/* Ax */
-	[0x310] = 0xa9,
-
-	/* Bx */
-	[0x591] = 0xb0, [0x592] = 0xb1, [0x593] = 0xb2, [0x502] = 0xb3,
-	[0x524] = 0xb4, [0x561] = 0xb5, [0x562] = 0xb6, [0x556] = 0xb7,
-	[0x555] = 0xb8, [0x563] = 0xb9, [0x551] = 0xba, [0x557] = 0xbb,
-	[0x55d] = 0xbc, [0x55c] = 0xbd, [0x55b] = 0xbe, [0x510] = 0xbf,
-
-	/* Cx */
-	[0x514] = 0xc0, [0x534] = 0xc1, [0x52c] = 0xc2, [0x51c] = 0xc3,
-	[0x500] = 0xc4, [0x53c] = 0xc5, [0x55e] = 0xc6, [0x55f] = 0xc7,
-	[0x55a] = 0xc8, [0x554] = 0xc9, [0x569] = 0xca, [0x566] = 0xcb,
-	[0x560] = 0xcc, [0x550] = 0xcd, [0x56c] = 0xce, [0x567] = 0xcf,
-
-	/* Dx */
-	[0x568] = 0xd0, [0x564] = 0xd1, [0x565] = 0xd2, [0x559] = 0xd3,
-	[0x558] = 0xd4, [0x552] = 0xd5, [0x553] = 0xd6, [0x56b] = 0xd7,
-	[0x56a] = 0xd8, [0x518] = 0xd9, [0x50c] = 0xda, [0x588] = 0xdb,
-	[0x584] = 0xdc, [0x58c] = 0xdd, [0x590] = 0xde, [0x580] = 0xdf,
-
-	/* Ex */
-	[0x21e] = 0xec, [0x229] = 0xef,
-
-	/* Fx */
-	[0x261] = 0xf0,                 [0x265] = 0xf2, [0x264] = 0xf3,
-	[0x320] = 0xf4, [0x321] = 0xf5,                 [0x248] = 0xf7,
-	/* skipped */   [0x219] = 0xf9,                 [0x21a] = 0xfb,
-	[0x07f] = 0xfc,                 [0x5a0] = 0xfe
-};
-
-/** Decode character from code page 437 8-bit code.
- *
- * Note that this function considers all code page 437 members as graphic
- * characters (including those in range 0-31), not control characters.
- *
- * @param code 8-bit code
- * @return Character
- */
-char32_t cp437_decode(uint8_t code)
-{
-	return cp437[code];
-}
-
-/** Encode character to code page 437 8-bit code.
- *
- * Note that this function considers all code page 437 members as graphic
- * characters (including those in range 0-31), not control characters.
- *
- * @param c Character
- * @param code Place to store 8-bit code
- * @return EOK on success, EDOM if character cannot be encoded to CP437.
- */
-errno_t cp437_encode(char32_t c, uint8_t *code)
-{
-	uint8_t b;
-
-	/* Unicode character 0 is the only that can map to cp437 code 0 */
-	if (c == 0) {
-		*code = 0;
-		return EOK;
-	}
-
-	b = 0;
-
-	/*
-	 * The map is split into two parts, 0x0000 - 0x0400 and
-	 * 0x2000 - 0x2700. This seems like a reasonable compromise
-	 * between complexity and memory efficiency.
-	 */
-
-	if (c < 0x400)
-		b = u0xxx_to_cp437[c];
-	else if (c >= 0x2000 && c < 0x2700)
-		b = u2xxx_to_cp437[c - 0x2000];
-
-	/*
-	 * If we got zero, it was an uninitialized entry (since no Unicode
-	 * character except 0 can map to b == 0 and that was already
-	 * taken care of).
-	 */
-	if (b == 0)
-		return EDOM;
-
-	*code = b;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/codepage/test/cp437.c
===================================================================
--- uspace/lib/codepage/test/cp437.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <codepage/cp437.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(cp437);
-
-/** Encode(decode) == identity */
-PCUT_TEST(decode_encode)
-{
-	unsigned code;
-	char32_t c;
-	uint8_t cdec;
-	errno_t rc;
-
-	for (code = 0; code < 256; code++) {
-		c = cp437_decode(code);
-		rc = cp437_encode(c, &cdec);
-		PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-		PCUT_ASSERT_EQUALS(code, cdec);
-	}
-}
-
-/** Test limit encoding cases */
-PCUT_TEST(encode_cases)
-{
-	uint8_t code;
-	errno_t rc;
-
-	/* Zero maps to zero */
-	rc = cp437_encode(0, &code);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(0x00, code);
-
-	/* Last entry in the 0x0000-0x03ff table is unmapped */
-	rc = cp437_encode(0x3ff, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-
-	/* 0x0400 is out of range of first table */
-	rc = cp437_encode(0x400, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-
-	/* 0x1fff is before start of 0x2000-0x26ff table */
-	rc = cp437_encode(0x1fff, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-
-	/* First entry in 0x2000-0x26ff table is unmapped */
-	rc = cp437_encode(0x2000, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-
-	/* Last entry in 0x2000-0x26ff table is unmapped */
-	rc = cp437_encode(0x26ff, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-
-	/* 0x2700 is beyond the end of 0x2000-0x26ff table */
-	rc = cp437_encode(0x2700, &code);
-	PCUT_ASSERT_ERRNO_VAL(EDOM, rc);
-}
-
-PCUT_EXPORT(cp437);
Index: pace/lib/codepage/test/main.c
===================================================================
--- uspace/lib/codepage/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(cp437);
-
-PCUT_MAIN();
Index: pace/lib/compress/gzip.c
===================================================================
--- uspace/lib/compress/gzip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,183 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <errno.h>
-#include <mem.h>
-#include <byteorder.h>
-#include <stdlib.h>
-#include "gzip.h"
-#include "inflate.h"
-
-#define GZIP_ID1  UINT8_C(0x1f)
-#define GZIP_ID2  UINT8_C(0x8b)
-
-#define GZIP_METHOD_DEFLATE  UINT8_C(0x08)
-
-#define GZIP_FLAGS_MASK     UINT8_C(0x1f)
-#define GZIP_FLAG_FHCRC     UINT8_C(1 << 1)
-#define GZIP_FLAG_FEXTRA    UINT8_C(1 << 2)
-#define GZIP_FLAG_FNAME     UINT8_C(1 << 3)
-#define GZIP_FLAG_FCOMMENT  UINT8_C(1 << 4)
-
-typedef struct {
-	uint8_t id1;
-	uint8_t id2;
-	uint8_t method;
-	uint8_t flags;
-	uint32_t mtime;
-	uint8_t extra_flags;
-	uint8_t os;
-} __attribute__((packed)) gzip_header_t;
-
-typedef struct {
-	uint32_t crc32;
-	uint32_t size;
-} __attribute__((packed)) gzip_footer_t;
-
-/** Expand GZIP compressed data
- *
- * The routine allocates the output buffer based
- * on the size encoded in the input stream. This
- * effectively limits the size of the uncompressed
- * data to 4 GiB (expanding input streams that actually
- * encode more data will always fail).
- *
- * So far, no CRC is perfomed.
- *
- * @param[in]  src     Source data buffer.
- * @param[in]  srclen  Source buffer size (bytes).
- * @param[out] dest    Destination data buffer.
- * @param[out] destlen Destination buffer size (bytes).
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code, invalid deflate data,
- *                   invalid compression method or invalid stream.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-errno_t gzip_expand(void *src, size_t srclen, void **dest, size_t *destlen)
-{
-	gzip_header_t header;
-	gzip_footer_t footer;
-
-	if ((srclen < sizeof(header)) || (srclen < sizeof(footer)))
-		return EINVAL;
-
-	/* Decode header and footer */
-
-	memcpy(&header, src, sizeof(header));
-	memcpy(&footer, src + srclen - sizeof(footer), sizeof(footer));
-
-	if ((header.id1 != GZIP_ID1) ||
-	    (header.id2 != GZIP_ID2) ||
-	    (header.method != GZIP_METHOD_DEFLATE) ||
-	    ((header.flags & (~GZIP_FLAGS_MASK)) != 0))
-		return EINVAL;
-
-	*destlen = uint32_t_le2host(footer.size);
-
-	/* Ignore extra metadata */
-
-	void *stream = src + sizeof(header);
-	size_t stream_length = srclen - sizeof(header) - sizeof(footer);
-
-	if ((header.flags & GZIP_FLAG_FEXTRA) != 0) {
-		uint16_t extra_length;
-
-		if (stream_length < sizeof(extra_length))
-			return EINVAL;
-
-		memcpy(&extra_length, stream, sizeof(extra_length));
-		stream += sizeof(extra_length);
-		stream_length -= sizeof(extra_length);
-
-		if (stream_length < extra_length)
-			return EINVAL;
-
-		stream += extra_length;
-		stream_length -= extra_length;
-	}
-
-	if ((header.flags & GZIP_FLAG_FNAME) != 0) {
-		while (*((uint8_t *) stream) != 0) {
-			if (stream_length == 0)
-				return EINVAL;
-
-			stream++;
-			stream_length--;
-		}
-
-		if (stream_length == 0)
-			return EINVAL;
-
-		stream++;
-		stream_length--;
-	}
-
-	if ((header.flags & GZIP_FLAG_FCOMMENT) != 0) {
-		while (*((uint8_t *) stream) != 0) {
-			if (stream_length == 0)
-				return EINVAL;
-
-			stream++;
-			stream_length--;
-		}
-
-		if (stream_length == 0)
-			return EINVAL;
-
-		stream++;
-		stream_length--;
-	}
-
-	if ((header.flags & GZIP_FLAG_FHCRC) != 0) {
-		if (stream_length < 2)
-			return EINVAL;
-
-		stream += 2;
-		stream_length -= 2;
-	}
-
-	/* Allocate output buffer and inflate the data */
-
-	*dest = malloc(*destlen);
-	if (*dest == NULL)
-		return ENOMEM;
-
-	errno_t ret = inflate(stream, stream_length, *dest, *destlen);
-	if (ret != EOK) {
-		free(dest);
-		return ret;
-	}
-
-	return EOK;
-}
Index: pace/lib/compress/gzip.h
===================================================================
--- uspace/lib/compress/gzip.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCOMPRESS_GZIP_H_
-#define LIBCOMPRESS_GZIP_H_
-
-#include <stddef.h>
-
-extern errno_t gzip_expand(void *, size_t, void **, size_t *);
-
-#endif
Index: pace/lib/compress/inflate.c
===================================================================
--- uspace/lib/compress/inflate.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,674 +1,0 @@
-/*
- * Copyright (c) 2010 Mark Adler
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * @brief Implementation of inflate decompression
- *
- * A simple inflate implementation (decompression of `deflate' stream as
- * described by RFC 1951) based on puff.c by Mark Adler. This code is
- * currently not optimized for speed but for readability.
- *
- * All dynamically allocated memory memory is taken from the stack. The
- * stack usage should be typically bounded by 2 KB.
- *
- * Original copyright notice:
- *
- *  Copyright (C) 2002-2010 Mark Adler, all rights reserved
- *  version 2.1, 4 Apr 2010
- *
- *  This software is provided 'as-is', without any express or implied
- *  warranty. In no event will the author be held liable for any damages
- *  arising from the use of this software.
- *
- *  Permission is granted to anyone to use this software for any purpose,
- *  including commercial applications, and to alter it and redistribute it
- *  freely, subject to the following restrictions:
- *
- *  1. The origin of this software must not be misrepresented; you must not
- *     claim that you wrote the original software. If you use this software
- *     in a product, an acknowledgment in the product documentation would be
- *     appreciated but is not required.
- *  2. Altered source versions must be plainly marked as such, and must not
- *     be misrepresented as being the original software.
- *  3. This notice may not be removed or altered from any source
- *     distribution.
- *
- *   Mark Adler <madler@alumni.caltech.edu>
- *
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <mem.h>
-#include "inflate.h"
-
-/** Maximum bits in the Huffman code */
-#define MAX_HUFFMAN_BIT  15
-
-/** Number of length codes */
-#define MAX_LEN           29
-/** Number of distance codes */
-#define MAX_DIST          30
-/** Number of order codes */
-#define MAX_ORDER         19
-/** Number of literal/length codes */
-#define MAX_LITLEN        286
-/** Number of fixed literal/length codes */
-#define MAX_FIXED_LITLEN  288
-
-/** Number of all codes */
-#define MAX_CODE  (MAX_LITLEN + MAX_DIST)
-
-/** Check for input buffer overrun condition */
-#define CHECK_OVERRUN(state) \
-	do { \
-		if ((state).overrun) \
-			return ELIMIT; \
-	} while (false)
-
-/** Inflate algorithm state
- *
- */
-typedef struct {
-	uint8_t *dest;    /**< Output buffer */
-	size_t destlen;   /**< Output buffer size */
-	size_t destcnt;   /**< Position in the output buffer */
-
-	uint8_t *src;     /**< Input buffer */
-	size_t srclen;    /**< Input buffer size */
-	size_t srccnt;    /**< Position in the input buffer */
-
-	uint16_t bitbuf;  /**< Bit buffer */
-	size_t bitlen;    /**< Number of bits in the bit buffer */
-
-	bool overrun;     /**< Overrun condition */
-} inflate_state_t;
-
-/** Huffman code description
- *
- */
-typedef struct {
-	uint16_t *count;   /**< Array of symbol counts */
-	uint16_t *symbol;  /**< Array of symbols */
-} huffman_t;
-
-/** Length codes
- *
- */
-static const uint16_t lens[MAX_LEN] = {
-	3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
-	35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258
-};
-
-/** Extended length codes
- *
- */
-static const uint16_t lens_ext[MAX_LEN] = {
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
-	3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
-};
-
-/** Distance codes
- *
- */
-static const uint16_t dists[MAX_DIST] = {
-	1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
-	257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
-	8193, 12289, 16385, 24577
-};
-
-/** Extended distance codes
- *
- */
-static const uint16_t dists_ext[MAX_DIST] = {
-	0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
-	7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
-	12, 12, 13, 13
-};
-
-/** Order codes
- *
- */
-static const short order[MAX_ORDER] = {
-	16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
-};
-
-/** Static length symbol counts
- *
- */
-static uint16_t len_count[MAX_HUFFMAN_BIT + 1] = {
-	0, 0, 0, 0, 0, 0, 0, 24, 152, 112, 0, 0, 0, 0, 0, 0
-};
-
-/** Static length symbols
- *
- */
-static uint16_t len_symbol[MAX_FIXED_LITLEN] = {
-	256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
-	269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 0, 1, 2,
-	3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-	21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
-	37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
-	53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
-	69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
-	85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
-	101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
-	114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
-	127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
-	140, 141, 142, 143, 280, 281, 282, 283, 284, 285, 286, 287, 144,
-	145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157,
-	158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
-	171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183,
-	184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
-	197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
-	210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
-	223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235,
-	236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248,
-	249, 250, 251, 252, 253, 254, 255
-};
-
-/** Static distance symbol counts
- *
- */
-static uint16_t dist_count[MAX_HUFFMAN_BIT + 1] = {
-	0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/** Static distance symbols
- *
- */
-static uint16_t dist_symbol[MAX_DIST] = {
-	0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-	16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
-};
-
-/** Huffman code for lengths
- *
- */
-static huffman_t len_code = {
-	.count = len_count,
-	.symbol = len_symbol
-};
-
-/** Huffman code for distances
- *
- */
-static huffman_t dist_code = {
-	.count = dist_count,
-	.symbol = dist_symbol
-};
-
-/** Get bits from the bit buffer
- *
- * @param state Inflate state.
- * @param cnt   Number of bits to return (at most 16).
- *
- * @return Returned bits.
- *
- */
-static inline uint16_t get_bits(inflate_state_t *state, size_t cnt)
-{
-	/* Bit accumulator for at least 20 bits */
-	uint32_t val = state->bitbuf;
-
-	while (state->bitlen < cnt) {
-		if (state->srccnt == state->srclen) {
-			state->overrun = true;
-			return 0;
-		}
-
-		/* Load 8 more bits */
-		val |= ((uint32_t) state->src[state->srccnt]) << state->bitlen;
-		state->srccnt++;
-		state->bitlen += 8;
-	}
-
-	/* Update bits in the buffer */
-	state->bitbuf = (uint16_t) (val >> cnt);
-	state->bitlen -= cnt;
-
-	return ((uint16_t) (val & ((1 << cnt) - 1)));
-}
-
-/** Decode `stored' block
- *
- * @param state Inflate state.
- *
- * @return EOK on success.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- * @return EINVAL on invalid data.
- *
- */
-static errno_t inflate_stored(inflate_state_t *state)
-{
-	/* Discard bits in the bit buffer */
-	state->bitbuf = 0;
-	state->bitlen = 0;
-
-	if (state->srccnt + 4 > state->srclen)
-		return ELIMIT;
-
-	uint16_t len =
-	    state->src[state->srccnt] | (state->src[state->srccnt + 1] << 8);
-	uint16_t len_compl =
-	    state->src[state->srccnt + 2] | (state->src[state->srccnt + 3] << 8);
-
-	/* Check block length and its complement */
-	if (((int16_t) len) != ~((int16_t) len_compl))
-		return EINVAL;
-
-	state->srccnt += 4;
-
-	/* Check input buffer size */
-	if (state->srccnt + len > state->srclen)
-		return ELIMIT;
-
-	/* Check output buffer size */
-	if (state->destcnt + len > state->destlen)
-		return ENOMEM;
-
-	/* Copy data */
-	memcpy(state->dest + state->destcnt, state->src + state->srccnt, len);
-	state->srccnt += len;
-	state->destcnt += len;
-
-	return EOK;
-}
-
-/** Decode a symbol using the Huffman code
- *
- * @param state   Inflate state.
- * @param huffman Huffman code.
- * @param symbol  Decoded symbol.
- *
- * @param EOK on success.
- * @param EINVAL on invalid Huffman code.
- *
- */
-static errno_t huffman_decode(inflate_state_t *state, huffman_t *huffman,
-    uint16_t *symbol)
-{
-	/* Decode bits */
-	uint16_t code = 0;
-
-	/* First code of the given length */
-	size_t first = 0;
-
-	/*
-	 * Index of the first code of the given length
-	 * in the symbol table
-	 */
-	size_t index = 0;
-
-	/* Current number of bits in the code */
-	size_t len;
-
-	for (len = 1; len <= MAX_HUFFMAN_BIT; len++) {
-		/* Get next bit */
-		code |= get_bits(state, 1);
-		CHECK_OVERRUN(*state);
-
-		uint16_t count = huffman->count[len];
-		if (code < first + count) {
-			/* Return decoded symbol */
-			*symbol = huffman->symbol[index + code - first];
-			return EOK;
-		}
-
-		/* Update for next length */
-		index += count;
-		first += count;
-		first <<= 1;
-		code <<= 1;
-	}
-
-	return EINVAL;
-}
-
-/** Construct Huffman tables from canonical Huffman code
- *
- * @param huffman Constructed Huffman tables.
- * @param length  Lengths of the canonical Huffman code.
- * @param n       Number of lengths.
- *
- * @return 0 if the Huffman code set is complete.
- * @return Negative value for an over-subscribed code set.
- * @return Positive value for an incomplete code set.
- *
- */
-static int16_t huffman_construct(huffman_t *huffman, uint16_t *length, size_t n)
-{
-	/* Count number of codes for each length */
-	size_t len;
-	for (len = 0; len <= MAX_HUFFMAN_BIT; len++)
-		huffman->count[len] = 0;
-
-	/* We assume that the lengths are within bounds */
-	size_t symbol;
-	for (symbol = 0; symbol < n; symbol++)
-		huffman->count[length[symbol]]++;
-
-	if (huffman->count[0] == n) {
-		/* The code is complete, but decoding will fail */
-		return 0;
-	}
-
-	/* Check for an over-subscribed or incomplete set of lengths */
-	int16_t left = 1;
-	for (len = 1; len <= MAX_HUFFMAN_BIT; len++) {
-		left <<= 1;
-		left -= huffman->count[len];
-		if (left < 0) {
-			/* Over-subscribed */
-			return left;
-		}
-	}
-
-	/* Generate offsets into symbol table */
-	uint16_t offs[MAX_HUFFMAN_BIT + 1];
-
-	offs[1] = 0;
-	for (len = 1; len < MAX_HUFFMAN_BIT; len++)
-		offs[len + 1] = offs[len] + huffman->count[len];
-
-	for (symbol = 0; symbol < n; symbol++) {
-		if (length[symbol] != 0) {
-			huffman->symbol[offs[length[symbol]]] = symbol;
-			offs[length[symbol]]++;
-		}
-	}
-
-	return left;
-}
-
-/** Decode literal/length and distance codes
- *
- * Decode until end-of-block code.
- *
- * @param state     Inflate state.
- * @param len_code  Huffman code for literal/length.
- * @param dist_code Huffman code for distance.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static errno_t inflate_codes(inflate_state_t *state, huffman_t *len_code,
-    huffman_t *dist_code)
-{
-	uint16_t symbol;
-
-	do {
-		errno_t err = huffman_decode(state, len_code, &symbol);
-		if (err != EOK) {
-			/* Error decoding */
-			return err;
-		}
-
-		if (symbol < 256) {
-			/* Write out literal */
-			if (state->destcnt == state->destlen)
-				return ENOMEM;
-
-			state->dest[state->destcnt] = (uint8_t) symbol;
-			state->destcnt++;
-		} else if (symbol > 256) {
-			/* Compute length */
-			symbol -= 257;
-			if (symbol >= 29)
-				return EINVAL;
-
-			size_t len = lens[symbol] + get_bits(state, lens_ext[symbol]);
-			CHECK_OVERRUN(*state);
-
-			/* Get distance */
-			err = huffman_decode(state, dist_code, &symbol);
-			if (err != EOK)
-				return err;
-
-			size_t dist = dists[symbol] + get_bits(state, dists_ext[symbol]);
-			if (dist > state->destcnt)
-				return ENOENT;
-
-			if (state->destcnt + len > state->destlen)
-				return ENOMEM;
-
-			while (len > 0) {
-				/* Copy len bytes from distance bytes back */
-				state->dest[state->destcnt] =
-				    state->dest[state->destcnt - dist];
-				state->destcnt++;
-				len--;
-			}
-		}
-	} while (symbol != 256);
-
-	return EOK;
-}
-
-/** Decode `fixed codes' block
- *
- * @param state     Inflate state.
- * @param len_code  Huffman code for literal/length.
- * @param dist_code Huffman code for distance.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static errno_t inflate_fixed(inflate_state_t *state, huffman_t *len_code,
-    huffman_t *dist_code)
-{
-	return inflate_codes(state, len_code, dist_code);
-}
-
-/** Decode `dynamic codes' block
- *
- * @param state     Inflate state.
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-static errno_t inflate_dynamic(inflate_state_t *state)
-{
-	uint16_t length[MAX_CODE];
-	uint16_t dyn_len_count[MAX_HUFFMAN_BIT + 1];
-	uint16_t dyn_len_symbol[MAX_LITLEN];
-	uint16_t dyn_dist_count[MAX_HUFFMAN_BIT + 1];
-	uint16_t dyn_dist_symbol[MAX_DIST];
-	huffman_t dyn_len_code;
-	huffman_t dyn_dist_code;
-
-	dyn_len_code.count = dyn_len_count;
-	dyn_len_code.symbol = dyn_len_symbol;
-
-	dyn_dist_code.count = dyn_dist_count;
-	dyn_dist_code.symbol = dyn_dist_symbol;
-
-	/* Get number of bits in each table */
-	uint16_t nlen = get_bits(state, 5) + 257;
-	CHECK_OVERRUN(*state);
-
-	uint16_t ndist = get_bits(state, 5) + 1;
-	CHECK_OVERRUN(*state);
-
-	uint16_t ncode = get_bits(state, 4) + 4;
-	CHECK_OVERRUN(*state);
-
-	if ((nlen > MAX_LITLEN) || (ndist > MAX_DIST) ||
-	    (ncode > MAX_ORDER))
-		return EINVAL;
-
-	/* Read code length code lengths */
-	uint16_t index;
-	for (index = 0; index < ncode; index++) {
-		length[order[index]] = get_bits(state, 3);
-		CHECK_OVERRUN(*state);
-	}
-
-	/* Set missing lengths to zero */
-	for (index = ncode; index < MAX_ORDER; index++)
-		length[order[index]] = 0;
-
-	/* Build Huffman code */
-	int16_t rc = huffman_construct(&dyn_len_code, length, MAX_ORDER);
-	if (rc != 0)
-		return EINVAL;
-
-	/* Read length/literal and distance code length tables */
-	index = 0;
-	while (index < nlen + ndist) {
-		uint16_t symbol;
-		errno_t err = huffman_decode(state, &dyn_len_code, &symbol);
-		if (err != EOK)
-			return EOK;
-
-		if (symbol < 16) {
-			length[index] = symbol;
-			index++;
-		} else {
-			uint16_t len = 0;
-
-			if (symbol == 16) {
-				if (index == 0)
-					return EINVAL;
-
-				len = length[index - 1];
-				symbol = get_bits(state, 2) + 3;
-				CHECK_OVERRUN(*state);
-			} else if (symbol == 17) {
-				symbol = get_bits(state, 3) + 3;
-				CHECK_OVERRUN(*state);
-			} else {
-				symbol = get_bits(state, 7) + 11;
-				CHECK_OVERRUN(*state);
-			}
-
-			if (index + symbol > nlen + ndist)
-				return EINVAL;
-
-			while (symbol > 0) {
-				length[index] = len;
-				index++;
-				symbol--;
-			}
-		}
-	}
-
-	/* Check for end-of-block code */
-	if (length[256] == 0)
-		return EINVAL;
-
-	/* Build Huffman tables for literal/length codes */
-	rc = huffman_construct(&dyn_len_code, length, nlen);
-	if ((rc < 0) || ((rc > 0) && (dyn_len_code.count[0] + 1 != nlen)))
-		return EINVAL;
-
-	/* Build Huffman tables for distance codes */
-	rc = huffman_construct(&dyn_dist_code, length + nlen, ndist);
-	if ((rc < 0) || ((rc > 0) && (dyn_dist_code.count[0] + 1 != ndist)))
-		return EINVAL;
-
-	return inflate_codes(state, &dyn_len_code, &dyn_dist_code);
-}
-
-/** Inflate data
- *
- * @param src     Source data buffer.
- * @param srclen  Source buffer size (bytes).
- * @param dest    Destination data buffer.
- * @param destlen Destination buffer size (bytes).
- *
- * @return EOK on success.
- * @return ENOENT on distance too large.
- * @return EINVAL on invalid Huffman code or invalid deflate data.
- * @return ELIMIT on input buffer overrun.
- * @return ENOMEM on output buffer overrun.
- *
- */
-errno_t inflate(void *src, size_t srclen, void *dest, size_t destlen)
-{
-	/* Initialize the state */
-	inflate_state_t state;
-
-	state.dest = (uint8_t *) dest;
-	state.destlen = destlen;
-	state.destcnt = 0;
-
-	state.src = (uint8_t *) src;
-	state.srclen = srclen;
-	state.srccnt = 0;
-
-	state.bitbuf = 0;
-	state.bitlen = 0;
-
-	state.overrun = false;
-
-	uint16_t last;
-	errno_t ret = EOK;
-
-	do {
-		/* Last block is indicated by a non-zero bit */
-		last = get_bits(&state, 1);
-		CHECK_OVERRUN(state);
-
-		/* Block type */
-		uint16_t type = get_bits(&state, 2);
-		CHECK_OVERRUN(state);
-
-		switch (type) {
-		case 0:
-			ret = inflate_stored(&state);
-			break;
-		case 1:
-			ret = inflate_fixed(&state, &len_code, &dist_code);
-			break;
-		case 2:
-			ret = inflate_dynamic(&state);
-			break;
-		default:
-			ret = EINVAL;
-		}
-	} while ((!last) && (ret == 0));
-
-	return ret;
-}
Index: pace/lib/compress/inflate.h
===================================================================
--- uspace/lib/compress/inflate.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2010 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCOMPRESS_INFLATE_H_
-#define LIBCOMPRESS_INFLATE_H_
-
-#include <stddef.h>
-
-extern errno_t inflate(void *, size_t, void *, size_t);
-
-#endif
Index: pace/lib/compress/meson.build
===================================================================
--- uspace/lib/compress/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2014 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'inflate.c',
-	'gzip.c',
-)
Index: pace/lib/congfx/doc/doxygroups.h
===================================================================
--- uspace/lib/congfx/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libcongfx libcongfx
- * @ingroup libs
- */
Index: pace/lib/congfx/include/congfx/console.h
===================================================================
--- uspace/lib/congfx/include/congfx/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcongfx
- * @{
- */
-/**
- * @file GFX console backend
- */
-
-#ifndef _CONGFX_CONSOLE_H
-#define _CONGFX_CONSOLE_H
-
-#include <io/console.h>
-#include <stdio.h>
-#include <types/congfx/console.h>
-#include <types/gfx/context.h>
-#include <types/gfx/ops/context.h>
-
-extern gfx_context_ops_t console_gc_ops;
-
-extern errno_t console_gc_create(console_ctrl_t *, FILE *, console_gc_t **);
-extern errno_t console_gc_delete(console_gc_t *);
-extern errno_t console_gc_suspend(console_gc_t *);
-extern errno_t console_gc_resume(console_gc_t *);
-extern gfx_context_t *console_gc_get_ctx(console_gc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/congfx/include/types/congfx/console.h
===================================================================
--- uspace/lib/congfx/include/types/congfx/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcongfx
- * @{
- */
-/**
- * @file GFX console backend
- */
-
-#ifndef _CONGFX_TYPES_CONSOLE_H
-#define _CONGFX_TYPES_CONSOLE_H
-
-struct console_gc;
-typedef struct console_gc console_gc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/congfx/meson.build
===================================================================
--- uspace/lib/congfx/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'console' ]
-src = files(
-	'src/console.c',
-)
Index: pace/lib/congfx/private/console.h
===================================================================
--- uspace/lib/congfx/private/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcongfx
- * @{
- */
-/**
- * @file GFX console backend structure
- *
- */
-
-#ifndef _CONGFX_PRIVATE_CONSOLE_H
-#define _CONGFX_PRIVATE_CONSOLE_H
-
-#include <gfx/context.h>
-#include <io/charfield.h>
-#include <io/console.h>
-#include <io/pixel.h>
-#include <stdio.h>
-
-/** Actual structure of graphics context.
- *
- * This is private to libcongfx. It is not visible to clients nor backends.
- */
-struct console_gc {
-	/** Base graphic context */
-	gfx_context_t *gc;
-	/** Console control structure */
-	console_ctrl_t *con;
-	/** Console bounding rectangle */
-	gfx_rect_t rect;
-	/** Clipping rectangle */
-	gfx_rect_t clip_rect;
-	/** File for printing characters */
-	FILE *fout;
-	/** Current drawing color */
-	pixel_t clr;
-	/** Shared console buffer */
-	charfield_t *buf;
-};
-
-/** Bitmap in console GC */
-typedef struct {
-	/** Containing console GC */
-	struct console_gc *cgc;
-	/** Allocation info */
-	gfx_bitmap_alloc_t alloc;
-	/** @c true if we allocated the bitmap, @c false if allocated by caller */
-	bool myalloc;
-	/** Rectangle covered by bitmap */
-	gfx_rect_t rect;
-	/** Bitmap flags */
-	gfx_bitmap_flags_t flags;
-	/** Key color */
-	pixel_t key_color;
-} console_gc_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/congfx/src/console.c
===================================================================
--- uspace/lib/congfx/src/console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,550 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcongfx
- * @{
- */
-/**
- * @file GFX console backend
- *
- * This implements a graphics context over a classic console interface.
- * This is just for experimentation purposes. In the end we want the
- * console to actually directly suport GFX interface.
- */
-
-#include <congfx/console.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <gfx/render.h>
-#include <io/pixel.h>
-#include <io/pixelmap.h>
-#include <stdlib.h>
-#include "../private/console.h"
-#include "../private/color.h"
-
-static errno_t console_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t console_gc_set_color(void *, gfx_color_t *);
-static errno_t console_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t console_gc_update(void *);
-static errno_t console_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t console_gc_bitmap_destroy(void *);
-static errno_t console_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t console_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-static errno_t console_gc_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t console_gc_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t console_gc_cursor_set_visible(void *, bool);
-
-gfx_context_ops_t console_gc_ops = {
-	.set_clip_rect = console_gc_set_clip_rect,
-	.set_color = console_gc_set_color,
-	.fill_rect = console_gc_fill_rect,
-	.update = console_gc_update,
-	.bitmap_create = console_gc_bitmap_create,
-	.bitmap_destroy = console_gc_bitmap_destroy,
-	.bitmap_render = console_gc_bitmap_render,
-	.bitmap_get_alloc = console_gc_bitmap_get_alloc,
-	.cursor_get_pos = console_gc_cursor_get_pos,
-	.cursor_set_pos = console_gc_cursor_set_pos,
-	.cursor_set_visible = console_gc_cursor_set_visible
-};
-
-/** Convert pixel value to charfield.
- *
- * On the bottom of this function lies a big big hack. In the absence
- * of support for different color formats (FIX ME!), here's a single
- * format that can represent both 3x8bit RGB and 24-bit characters
- * with 8-bit EGA attributes (i.e. we can specify the foreground and
- * background colors individually).
- *
- * A    R   G   B
- * 0    red grn blu  24-bit color
- * attr c2  c1  c0   attribute + 24-bit character
- */
-static void console_gc_pix_to_charfield(pixel_t clr, charfield_t *ch)
-{
-	uint8_t attr;
-
-	if ((clr >> 24) == 0xff) {
-		/* RGB (no text) */
-		ch->ch = 0;
-		ch->flags = CHAR_FLAG_DIRTY;
-		ch->attrs.type = CHAR_ATTR_RGB;
-		ch->attrs.val.rgb.fgcolor = clr;
-		ch->attrs.val.rgb.bgcolor = clr;
-	} else {
-		/* EGA attributes (with text) */
-		attr = clr >> 24;
-		ch->ch = clr & 0xffffff;
-		ch->flags = CHAR_FLAG_DIRTY;
-		ch->attrs.type = CHAR_ATTR_INDEX;
-		ch->attrs.val.index.fgcolor = attr & 0x7;
-		ch->attrs.val.index.bgcolor = (attr >> 4) & 0x7;
-		ch->attrs.val.index.attr =
-		    ((attr & 0x8) ? CATTR_BRIGHT : 0) +
-		    ((attr & 0x80) ? CATTR_BLINK : 0);
-	}
-}
-
-/** Set clipping rectangle on console GC.
- *
- * @param arg Console GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-
-	if (rect != NULL)
-		gfx_rect_clip(rect, &cgc->rect, &cgc->clip_rect);
-	else
-		cgc->clip_rect = cgc->rect;
-
-	return EOK;
-}
-
-/** Set color on console GC.
- *
- * Set drawing color on console GC.
- *
- * @param arg Console GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_set_color(void *arg, gfx_color_t *color)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-
-	cgc->clr = PIXEL(color->attr, color->r >> 8, color->g >> 8, color->b >> 8);
-	return EOK;
-}
-
-/** Fill rectangle on console GC.
- *
- * @param arg Console GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-	gfx_coord_t x, y;
-	gfx_coord_t cols;
-	gfx_rect_t crect;
-	charfield_t ch;
-
-	/* Make sure rectangle is clipped and sorted */
-	gfx_rect_clip(rect, &cgc->clip_rect, &crect);
-
-	cols = cgc->rect.p1.x - cgc->rect.p0.x;
-
-	console_gc_pix_to_charfield(cgc->clr, &ch);
-
-	for (y = crect.p0.y; y < crect.p1.y; y++) {
-		for (x = crect.p0.x; x < crect.p1.x; x++) {
-			cgc->buf[y * cols + x] = ch;
-		}
-	}
-
-	console_update(cgc->con, crect.p0.x, crect.p0.y,
-	    crect.p1.x, crect.p1.y);
-
-	return EOK;
-}
-
-/** Update console GC.
- *
- * @param arg Console GC
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_update(void *arg)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-
-	/*
-	 * XXX Before actually deferring update to here (and similarly other
-	 * GC implementations) need to make sure all consumers properly
-	 * call update.
-	 */
-	(void) cgc;
-	return EOK;
-}
-
-/** Create console GC.
- *
- * Create graphics context for rendering into a console.
- *
- * @param con Console object
- * @param fout File to which characters are written (console)
- * @param rgc Place to store pointer to new GC.
- *
- * @return EOK on success or an error code
- */
-errno_t console_gc_create(console_ctrl_t *con, FILE *fout,
-    console_gc_t **rgc)
-{
-	console_gc_t *cgc = NULL;
-	gfx_context_t *gc = NULL;
-	sysarg_t rows;
-	sysarg_t cols;
-	charfield_t *buf = NULL;
-	errno_t rc;
-
-	cgc = calloc(1, sizeof(console_gc_t));
-	if (cgc == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = console_get_size(con, &cols, &rows);
-	if (rc != EOK)
-		goto error;
-
-	console_clear(con);
-
-	rc = console_map(con, cols, rows, &buf);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_context_new(&console_gc_ops, cgc, &gc);
-	if (rc != EOK)
-		goto error;
-
-	cgc->gc = gc;
-	cgc->con = con;
-	cgc->fout = fout;
-	cgc->rect.p0.x = 0;
-	cgc->rect.p0.y = 0;
-	cgc->rect.p1.x = cols;
-	cgc->rect.p1.y = rows;
-	cgc->clip_rect = cgc->rect;
-	cgc->buf = buf;
-
-	*rgc = cgc;
-	return EOK;
-error:
-	if (buf != NULL)
-		console_unmap(cgc->con, buf);
-	if (cgc != NULL)
-		free(cgc);
-	gfx_context_delete(gc);
-	return rc;
-}
-
-/** Delete console GC.
- *
- * @param cgc Console GC
- */
-errno_t console_gc_delete(console_gc_t *cgc)
-{
-	errno_t rc;
-
-	rc = gfx_context_delete(cgc->gc);
-	if (rc != EOK)
-		return rc;
-
-	console_clear(cgc->con);
-	console_unmap(cgc->con, cgc->buf);
-
-	free(cgc);
-	return EOK;
-}
-
-/** Free up console for other users, suspending GC operation.
- *
- * @param cgc Console GC
- * @return EOK on success or an error code
- */
-errno_t console_gc_suspend(console_gc_t *cgc)
-{
-	console_unmap(cgc->con, cgc->buf);
-	cgc->buf = NULL;
-
-	console_clear(cgc->con);
-	console_cursor_visibility(cgc->con, true);
-	return EOK;
-}
-
-/** Resume GC operation after suspend.
- *
- * @param cgc Console GC
- * @return EOK on success or an error code
- */
-errno_t console_gc_resume(console_gc_t *cgc)
-{
-	errno_t rc;
-
-	console_clear(cgc->con);
-
-	rc = console_map(cgc->con, cgc->rect.p1.x, cgc->rect.p1.y, &cgc->buf);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Get generic graphic context from console GC.
- *
- * @param cgc Console GC
- * @return Graphic context
- */
-gfx_context_t *console_gc_get_ctx(console_gc_t *cgc)
-{
-	return cgc->gc;
-}
-
-/** Create bitmap in console GC.
- *
- * @param arg console GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t console_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-	console_gc_bitmap_t *cbm = NULL;
-	gfx_coord2_t dim;
-	errno_t rc;
-
-	/* Check that we support all requested flags */
-	if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
-		return ENOTSUP;
-
-	cbm = calloc(1, sizeof(console_gc_bitmap_t));
-	if (cbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	cbm->rect = params->rect;
-	cbm->flags = params->flags;
-	cbm->key_color = params->key_color;
-
-	if (alloc == NULL) {
-		cbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		cbm->alloc.off0 = 0;
-		cbm->alloc.pixels = calloc(dim.x * dim.y, sizeof(uint32_t));
-		if (cbm->alloc.pixels == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		cbm->myalloc = true;
-	} else {
-		cbm->alloc = *alloc;
-	}
-
-	cbm->cgc = cgc;
-	*rbm = (void *)cbm;
-	return EOK;
-error:
-	if (cbm != NULL)
-		free(cbm);
-	return rc;
-}
-
-/** Destroy bitmap in console GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t console_gc_bitmap_destroy(void *bm)
-{
-	console_gc_bitmap_t *cbm = (console_gc_bitmap_t *)bm;
-	if (cbm->myalloc)
-		free(cbm->alloc.pixels);
-	free(cbm);
-	return EOK;
-}
-
-/** Render bitmap in console GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t console_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	console_gc_bitmap_t *cbm = (console_gc_bitmap_t *)bm;
-	gfx_coord_t x, y;
-	pixel_t clr;
-	charfield_t ch;
-	pixelmap_t pixelmap;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_rect_t crect;
-	gfx_coord2_t offs;
-	gfx_coord_t cols;
-
-	if (srect0 != NULL)
-		srect = *srect0;
-	else
-		srect = cbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	gfx_rect_translate(&offs, &srect, &drect);
-	gfx_rect_clip(&drect, &cbm->cgc->clip_rect, &crect);
-
-	pixelmap.width = cbm->rect.p1.x - cbm->rect.p0.x;
-	pixelmap.height = cbm->rect.p1.y = cbm->rect.p1.y;
-	pixelmap.data = cbm->alloc.pixels;
-
-	cols = cbm->cgc->rect.p1.x - cbm->cgc->rect.p0.x;
-
-	if ((cbm->flags & bmpf_color_key) == 0) {
-		/* Simple copy */
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-				clr = pixelmap_get_pixel(&pixelmap,
-				    x - offs.x - cbm->rect.p0.x,
-				    y - offs.y - cbm->rect.p0.y);
-
-				console_gc_pix_to_charfield(clr, &ch);
-				cbm->cgc->buf[y * cols + x] = ch;
-			}
-		}
-	} else if ((cbm->flags & bmpf_colorize) == 0) {
-		/* Color key */
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-
-				clr = pixelmap_get_pixel(&pixelmap,
-				    x - offs.x - cbm->rect.p0.x,
-				    y - offs.y - cbm->rect.p0.y);
-
-				console_gc_pix_to_charfield(clr, &ch);
-
-				if (clr != cbm->key_color)
-					cbm->cgc->buf[y * cols + x] = ch;
-			}
-		}
-	} else {
-		/* Color key & colorize */
-		console_gc_pix_to_charfield(cbm->cgc->clr, &ch);
-
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-				clr = pixelmap_get_pixel(&pixelmap,
-				    x - offs.x - cbm->rect.p0.x,
-				    y - offs.y - cbm->rect.p0.y);
-
-				if (clr != cbm->key_color)
-					cbm->cgc->buf[y * cols + x] = ch;
-			}
-		}
-	}
-
-	console_update(cbm->cgc->con, crect.p0.x, crect.p0.y, crect.p1.x,
-	    crect.p1.y);
-
-	return EOK;
-}
-
-/** Get allocation info for bitmap in console GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t console_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	console_gc_bitmap_t *cbm = (console_gc_bitmap_t *)bm;
-	*alloc = cbm->alloc;
-	return EOK;
-}
-
-/** Get cursor position on console GC.
- *
- * @param arg Console GC
- * @param pos Place to store position
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-	sysarg_t col;
-	sysarg_t row;
-	errno_t rc;
-
-	rc = console_get_pos(cgc->con, &col, &row);
-	if (rc != EOK)
-		return rc;
-
-	pos->x = col;
-	pos->y = row;
-	return EOK;
-}
-
-/** Set cursor position on console GC.
- *
- * @param arg Console GC
- * @param pos New cursor position
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-
-	console_set_pos(cgc->con, pos->x, pos->y);
-	return EOK;
-}
-
-/** Set cursor visibility on console GC.
- *
- * @param arg Console GC
- * @param visible @c true iff cursor should be made visible
- *
- * @return EOK on success or an error code
- */
-static errno_t console_gc_cursor_set_visible(void *arg, bool visible)
-{
-	console_gc_t *cgc = (console_gc_t *) arg;
-
-	console_cursor_visibility(cgc->con, visible);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/console/doc/doxygroups.h
===================================================================
--- uspace/lib/console/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libconsole libconsole
- * @ingroup libs
- */
Index: pace/lib/console/include/io/con_srv.h
===================================================================
--- uspace/lib/console/include/io/con_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCONSOLE_IO_CON_SRV_H_
-#define _LIBCONSOLE_IO_CON_SRV_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <io/charfield.h>
-#include <io/color.h>
-#include <io/concaps.h>
-#include <io/cons_event.h>
-#include <io/pixel.h>
-#include <io/style.h>
-#include <stdbool.h>
-#include <time.h>
-#include <stddef.h>
-
-typedef struct con_ops con_ops_t;
-
-#define CON_CAPTION_MAXLEN 255
-
-/** Service setup (per sevice) */
-typedef struct {
-	con_ops_t *ops;
-	void *sarg;
-	/** Period to check for abort */
-	usec_t abort_timeout;
-	bool aborted;
-} con_srvs_t;
-
-/** Server structure (per client session) */
-typedef struct {
-	con_srvs_t *srvs;
-	async_sess_t *client_sess;
-	void *carg;
-} con_srv_t;
-
-struct con_ops {
-	errno_t (*open)(con_srvs_t *, con_srv_t *);
-	errno_t (*close)(con_srv_t *);
-	errno_t (*read)(con_srv_t *, void *, size_t, size_t *);
-	errno_t (*write)(con_srv_t *, void *, size_t, size_t *);
-	void (*sync)(con_srv_t *);
-	void (*clear)(con_srv_t *);
-	void (*set_pos)(con_srv_t *, sysarg_t col, sysarg_t row);
-	errno_t (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *);
-	errno_t (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *);
-	errno_t (*get_color_cap)(con_srv_t *, console_caps_t *);
-	void (*set_style)(con_srv_t *, console_style_t);
-	void (*set_color)(con_srv_t *, console_color_t, console_color_t,
-	    console_color_attr_t);
-	void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t);
-	void (*set_cursor_visibility)(con_srv_t *, bool);
-	errno_t (*set_caption)(con_srv_t *, const char *);
-	errno_t (*get_event)(con_srv_t *, cons_event_t *);
-	errno_t (*map)(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
-	void (*unmap)(con_srv_t *);
-	void (*update)(con_srv_t *, sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-};
-
-extern void con_srvs_init(con_srvs_t *);
-
-extern errno_t con_conn(ipc_call_t *, con_srvs_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/console/include/io/cons_event.h
===================================================================
--- uspace/lib/console/include/io/cons_event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCONSOLE_IO_CONS_EVENT_H_
-#define _LIBCONSOLE_IO_CONS_EVENT_H_
-
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-
-typedef enum {
-	/** Key event */
-	CEV_KEY,
-	/** Position event */
-	CEV_POS,
-	/** Resize event */
-	CEV_RESIZE,
-} cons_event_type_t;
-
-/** Console event structure. */
-typedef struct {
-	/** Event type */
-	cons_event_type_t type;
-
-	union {
-		kbd_event_t key;
-		pos_event_t pos;
-	} ev;
-} cons_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/console/include/io/console.h
===================================================================
--- uspace/lib/console/include/io/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCONSOLE_IO_CONSOLE_H_
-#define _LIBCONSOLE_IO_CONSOLE_H_
-
-#include <time.h>
-#include <io/charfield.h>
-#include <io/concaps.h>
-#include <io/kbd_event.h>
-#include <io/cons_event.h>
-#include <io/keycode.h>
-#include <async.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-/** Console control structure. */
-typedef struct {
-	/** Console input file */
-	FILE *input;
-
-	/** Console output file */
-	FILE *output;
-
-	/** Console input session */
-	async_sess_t *input_sess;
-
-	/** Console output session */
-	async_sess_t *output_sess;
-
-	/** Input request call with timeout */
-	ipc_call_t input_call;
-
-	/** Input response with timeout */
-	aid_t input_aid;
-} console_ctrl_t;
-
-extern console_ctrl_t *console_init(FILE *, FILE *);
-extern void console_done(console_ctrl_t *);
-extern bool console_kcon(void);
-
-extern void console_flush(console_ctrl_t *);
-extern void console_clear(console_ctrl_t *);
-
-extern errno_t console_get_size(console_ctrl_t *, sysarg_t *, sysarg_t *);
-extern errno_t console_get_pos(console_ctrl_t *, sysarg_t *, sysarg_t *);
-extern void console_set_pos(console_ctrl_t *, sysarg_t, sysarg_t);
-
-extern void console_set_style(console_ctrl_t *, uint8_t);
-extern void console_set_color(console_ctrl_t *, uint8_t, uint8_t, uint8_t);
-extern void console_set_rgb_color(console_ctrl_t *, uint32_t, uint32_t);
-
-extern void console_cursor_visibility(console_ctrl_t *, bool);
-extern errno_t console_set_caption(console_ctrl_t *, const char *);
-extern errno_t console_get_color_cap(console_ctrl_t *, sysarg_t *);
-extern errno_t console_get_event(console_ctrl_t *, cons_event_t *);
-extern errno_t console_get_event_timeout(console_ctrl_t *, cons_event_t *,
-    usec_t *);
-extern errno_t console_map(console_ctrl_t *, sysarg_t, sysarg_t,
-    charfield_t **);
-extern void console_unmap(console_ctrl_t *, charfield_t *);
-extern errno_t console_update(console_ctrl_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/console/include/ipc/console.h
===================================================================
--- uspace/lib/console/include/ipc/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCONSOLE_IPC_CONSOLE_H_
-#define _LIBCONSOLE_IPC_CONSOLE_H_
-
-#include <ipc/vfs.h>
-
-typedef enum {
-	CONSOLE_GET_SIZE = VFS_OUT_LAST,
-	CONSOLE_GET_COLOR_CAP,
-	CONSOLE_GET_EVENT,
-	CONSOLE_GET_POS,
-	CONSOLE_SET_POS,
-	CONSOLE_CLEAR,
-	CONSOLE_SET_STYLE,
-	CONSOLE_SET_COLOR,
-	CONSOLE_SET_RGB_COLOR,
-	CONSOLE_SET_CURSOR_VISIBILITY,
-	CONSOLE_SET_CAPTION,
-	CONSOLE_MAP,
-	CONSOLE_UNMAP,
-	CONSOLE_UPDATE
-} console_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/console/meson.build
===================================================================
--- uspace/lib/console/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input', 'output' ]
-src = files(
-	'src/con_srv.c',
-	'src/console.c',
-)
Index: pace/lib/console/src/con_srv.c
===================================================================
--- uspace/lib/console/src/con_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,543 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/**
- * @file
- * @brief Console protocol server stub
- */
-#include <as.h>
-#include <errno.h>
-#include <io/cons_event.h>
-#include <ipc/console.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-#include <io/con_srv.h>
-
-static errno_t console_ev_encode(cons_event_t *event, ipc_call_t *icall)
-{
-	ipc_set_arg1(icall, event->type);
-
-	switch (event->type) {
-	case CEV_KEY:
-		ipc_set_arg2(icall, event->ev.key.type);
-		ipc_set_arg3(icall, event->ev.key.key);
-		ipc_set_arg4(icall, event->ev.key.mods);
-		ipc_set_arg5(icall, event->ev.key.c);
-		return EOK;
-	case CEV_POS:
-		ipc_set_arg2(icall, (event->ev.pos.pos_id << 16) | (event->ev.pos.type & 0xffff));
-		ipc_set_arg3(icall, event->ev.pos.btn_num);
-		ipc_set_arg4(icall, event->ev.pos.hpos);
-		ipc_set_arg5(icall, event->ev.pos.vpos);
-		return EOK;
-	case CEV_RESIZE:
-		ipc_set_arg2(icall, 0);
-		ipc_set_arg3(icall, 0);
-		ipc_set_arg4(icall, 0);
-		ipc_set_arg5(icall, 0);
-		return EOK;
-	}
-
-	return EIO;
-}
-
-static void con_read_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	void *buf;
-	size_t size;
-	errno_t rc;
-
-	ipc_call_t call;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	buf = malloc(size);
-	if (buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	if (srv->srvs->ops->read == NULL) {
-		async_answer_0(&call, ENOTSUP);
-		async_answer_0(icall, ENOTSUP);
-		free(buf);
-		return;
-	}
-
-	size_t nread;
-	rc = srv->srvs->ops->read(srv, buf, size, &nread);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(buf);
-		return;
-	}
-
-	async_data_read_finalize(&call, buf, nread);
-	free(buf);
-
-	async_answer_1(icall, EOK, nread);
-}
-
-static void con_write_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	void *data;
-	size_t size;
-	errno_t rc;
-
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->srvs->ops->write == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	size_t nwritten = 0;
-	rc = srv->srvs->ops->write(srv, data, size, &nwritten);
-	free(data);
-
-	async_answer_1(icall, rc, nwritten);
-}
-
-static void con_sync_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	if (srv->srvs->ops->sync == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->sync(srv);
-	async_answer_0(icall, EOK);
-}
-
-static void con_clear_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	if (srv->srvs->ops->clear == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->clear(srv);
-	async_answer_0(icall, EOK);
-}
-
-static void con_set_pos_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t col;
-	sysarg_t row;
-
-	col = ipc_get_arg1(icall);
-	row = ipc_get_arg2(icall);
-
-	if (srv->srvs->ops->set_pos == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_pos(srv, col, row);
-	async_answer_0(icall, EOK);
-}
-
-static void con_get_pos_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	sysarg_t col;
-	sysarg_t row;
-
-	if (srv->srvs->ops->get_pos == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_pos(srv, &col, &row);
-	async_answer_2(icall, rc, col, row);
-}
-
-static void con_get_size_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	sysarg_t cols;
-	sysarg_t rows;
-
-	if (srv->srvs->ops->get_size == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_size(srv, &cols, &rows);
-	async_answer_2(icall, rc, cols, rows);
-}
-
-static void con_get_color_cap_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	console_caps_t ccap;
-
-	if (srv->srvs->ops->get_color_cap == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_color_cap(srv, &ccap);
-	async_answer_1(icall, rc, (sysarg_t)ccap);
-}
-
-static void con_set_style_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	console_style_t style;
-
-	style = ipc_get_arg1(icall);
-
-	if (srv->srvs->ops->set_style == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_style(srv, style);
-	async_answer_0(icall, EOK);
-}
-
-static void con_set_color_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	console_color_t bgcolor;
-	console_color_t fgcolor;
-	console_color_attr_t flags;
-
-	bgcolor = ipc_get_arg1(icall);
-	fgcolor = ipc_get_arg2(icall);
-	flags = ipc_get_arg3(icall);
-
-	if (srv->srvs->ops->set_color == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_color(srv, bgcolor, fgcolor, flags);
-	async_answer_0(icall, EOK);
-}
-
-static void con_set_rgb_color_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	pixel_t bgcolor;
-	pixel_t fgcolor;
-
-	bgcolor = ipc_get_arg1(icall);
-	fgcolor = ipc_get_arg2(icall);
-
-	if (srv->srvs->ops->set_rgb_color == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_rgb_color(srv, bgcolor, fgcolor);
-	async_answer_0(icall, EOK);
-}
-
-static void con_set_cursor_visibility_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	bool show;
-
-	show = ipc_get_arg1(icall);
-
-	if (srv->srvs->ops->set_cursor_visibility == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_cursor_visibility(srv, show);
-	async_answer_0(icall, EOK);
-}
-
-static void con_set_caption_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	char *caption;
-	errno_t rc;
-
-	rc = async_data_write_accept((void **) &caption, true, 0,
-	    CON_CAPTION_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->srvs->ops->set_caption == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->set_caption(srv, caption);
-	free(caption);
-	async_answer_0(icall, EOK);
-}
-
-static void con_get_event_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	cons_event_t event;
-	ipc_call_t result;
-
-	if (srv->srvs->ops->get_event == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_event(srv, &event);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = console_ev_encode(&event, &result);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_5(icall, rc, ipc_get_arg1(&result), ipc_get_arg2(&result),
-	    ipc_get_arg3(&result), ipc_get_arg4(&result), ipc_get_arg5(&result));
-}
-
-/** Create shared buffer for efficient rendering */
-static void con_map_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	charfield_t *buf;
-	sysarg_t cols, rows;
-	ipc_call_t call;
-	size_t size;
-
-	if (srv->srvs->ops->map == NULL || srv->srvs->ops->unmap == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	cols = ipc_get_arg1(icall);
-	rows = ipc_get_arg2(icall);
-
-	if (!async_share_in_receive(&call, &size)) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	/* Check size */
-	if (size != PAGES2SIZE(SIZE2PAGES(cols * rows * sizeof(charfield_t)))) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = srv->srvs->ops->map(srv, cols, rows, &buf);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_share_in_finalize(&call, buf, AS_AREA_READ |
-	    AS_AREA_WRITE | AS_AREA_CACHEABLE);
-	if (rc != EOK) {
-		srv->srvs->ops->unmap(srv);
-		async_answer_0(icall, EIO);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** Delete shared buffer */
-static void con_unmap_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	if (srv->srvs->ops->unmap == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->unmap(srv);
-	async_answer_0(icall, EOK);
-}
-
-/** Update console area from shared buffer */
-static void con_update_srv(con_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t c0, r0, c1, r1;
-
-	c0 = ipc_get_arg1(icall);
-	r0 = ipc_get_arg2(icall);
-	c1 = ipc_get_arg3(icall);
-	r1 = ipc_get_arg4(icall);
-
-	if (srv->srvs->ops->update == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	srv->srvs->ops->update(srv, c0, r0, c1, r1);
-	async_answer_0(icall, EOK);
-}
-
-static con_srv_t *con_srv_create(con_srvs_t *srvs)
-{
-	con_srv_t *srv;
-
-	srv = calloc(1, sizeof(*srv));
-	if (srv == NULL)
-		return NULL;
-
-	srv->srvs = srvs;
-	return srv;
-}
-
-void con_srvs_init(con_srvs_t *srvs)
-{
-	srvs->ops = NULL;
-	srvs->sarg = NULL;
-	srvs->abort_timeout = 0;
-	srvs->aborted = false;
-}
-
-errno_t con_conn(ipc_call_t *icall, con_srvs_t *srvs)
-{
-	con_srv_t *srv;
-	errno_t rc;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	srv = con_srv_create(srvs);
-	if (srv == NULL)
-		return ENOMEM;
-
-	srv->client_sess = NULL;
-
-	rc = srvs->ops->open(srvs, srv);
-	if (rc != EOK)
-		return rc;
-
-	while (true) {
-		ipc_call_t call;
-		bool received = false;
-
-		while (!received) {
-			/* XXX Need to be able to abort immediately */
-			received = async_get_call_timeout(&call,
-			    srvs->abort_timeout);
-
-			if (srv->srvs->aborted) {
-				if (received)
-					async_answer_0(&call, EINTR);
-				break;
-			}
-		}
-
-		if (!received || srv->srvs->aborted)
-			break;
-
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case VFS_OUT_READ:
-			con_read_srv(srv, &call);
-			break;
-		case VFS_OUT_WRITE:
-			con_write_srv(srv, &call);
-			break;
-		case VFS_OUT_SYNC:
-			con_sync_srv(srv, &call);
-			break;
-		case CONSOLE_CLEAR:
-			con_clear_srv(srv, &call);
-			break;
-		case CONSOLE_SET_POS:
-			con_set_pos_srv(srv, &call);
-			break;
-		case CONSOLE_GET_POS:
-			con_get_pos_srv(srv, &call);
-			break;
-		case CONSOLE_GET_SIZE:
-			con_get_size_srv(srv, &call);
-			break;
-		case CONSOLE_GET_COLOR_CAP:
-			con_get_color_cap_srv(srv, &call);
-			break;
-		case CONSOLE_SET_STYLE:
-			con_set_style_srv(srv, &call);
-			break;
-		case CONSOLE_SET_COLOR:
-			con_set_color_srv(srv, &call);
-			break;
-		case CONSOLE_SET_RGB_COLOR:
-			con_set_rgb_color_srv(srv, &call);
-			break;
-		case CONSOLE_SET_CURSOR_VISIBILITY:
-			con_set_cursor_visibility_srv(srv, &call);
-			break;
-		case CONSOLE_SET_CAPTION:
-			con_set_caption_srv(srv, &call);
-			break;
-		case CONSOLE_GET_EVENT:
-			con_get_event_srv(srv, &call);
-			break;
-		case CONSOLE_MAP:
-			con_map_srv(srv, &call);
-			break;
-		case CONSOLE_UNMAP:
-			con_unmap_srv(srv, &call);
-			break;
-		case CONSOLE_UPDATE:
-			con_update_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	rc = srvs->ops->close(srv);
-	free(srv);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/console/src/console.c
===================================================================
--- uspace/lib/console/src/console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,379 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2006 Jakub Vana
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libconsole
- * @{
- */
-/** @file
- */
-
-#include <as.h>
-#include <dbgcon.h>
-#include <libc.h>
-#include <async.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/vfs_sess.h>
-#include <io/console.h>
-#include <ipc/console.h>
-
-console_ctrl_t *console_init(FILE *ifile, FILE *ofile)
-{
-	console_ctrl_t *ctrl = malloc(sizeof(console_ctrl_t));
-	if (!ctrl)
-		return NULL;
-
-	ctrl->input_sess = vfs_fsession(ifile, INTERFACE_CONSOLE);
-	if (!ctrl->input_sess) {
-		free(ctrl);
-		return NULL;
-	}
-
-	ctrl->output_sess = vfs_fsession(ofile, INTERFACE_CONSOLE);
-	if (!ctrl->output_sess) {
-		free(ctrl);
-		return NULL;
-	}
-
-	ctrl->input = ifile;
-	ctrl->output = ofile;
-	ctrl->input_aid = 0;
-
-	return ctrl;
-}
-
-void console_done(console_ctrl_t *ctrl)
-{
-	free(ctrl);
-}
-
-bool console_kcon(void)
-{
-	return dbgcon_enable();
-}
-
-void console_flush(console_ctrl_t *ctrl)
-{
-	fflush(ctrl->output);
-}
-
-void console_clear(console_ctrl_t *ctrl)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_0_0(exch, CONSOLE_CLEAR);
-	async_exchange_end(exch);
-}
-
-errno_t console_get_size(console_ctrl_t *ctrl, sysarg_t *cols, sysarg_t *rows)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_2(exch, CONSOLE_GET_SIZE, cols, rows);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-void console_set_style(console_ctrl_t *ctrl, uint8_t style)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_1_0(exch, CONSOLE_SET_STYLE, style);
-	async_exchange_end(exch);
-}
-
-void console_set_color(console_ctrl_t *ctrl, uint8_t bgcolor, uint8_t fgcolor,
-    uint8_t flags)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_3_0(exch, CONSOLE_SET_COLOR, bgcolor, fgcolor, flags);
-	async_exchange_end(exch);
-}
-
-void console_set_rgb_color(console_ctrl_t *ctrl, uint32_t bgcolor,
-    uint32_t fgcolor)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_2_0(exch, CONSOLE_SET_RGB_COLOR, bgcolor, fgcolor);
-	async_exchange_end(exch);
-}
-
-void console_cursor_visibility(console_ctrl_t *ctrl, bool show)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_1_0(exch, CONSOLE_SET_CURSOR_VISIBILITY, (show != false));
-	async_exchange_end(exch);
-}
-
-/** Set console caption.
- *
- * Set caption text for the console (if the console suports captions).
- *
- * @param ctrl Console
- * @param caption Caption text
- * @return EOK on success or an error code
- */
-errno_t console_set_caption(console_ctrl_t *ctrl, const char *caption)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, CONSOLE_SET_CAPTION, &answer);
-	errno_t retval = async_data_write_start(exch, caption, str_size(caption));
-
-	if (retval != EOK) {
-		async_forget(req);
-		async_exchange_end(exch);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	async_exchange_end(exch);
-	return EOK;
-}
-
-errno_t console_get_color_cap(console_ctrl_t *ctrl, sysarg_t *ccap)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_1(exch, CONSOLE_GET_COLOR_CAP, ccap);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t console_get_pos(console_ctrl_t *ctrl, sysarg_t *col, sysarg_t *row)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_0_2(exch, CONSOLE_GET_POS, col, row);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-void console_set_pos(console_ctrl_t *ctrl, sysarg_t col, sysarg_t row)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	async_req_2_0(exch, CONSOLE_SET_POS, col, row);
-	async_exchange_end(exch);
-}
-
-static errno_t console_ev_decode(ipc_call_t *call, cons_event_t *event)
-{
-	event->type = ipc_get_arg1(call);
-
-	switch (event->type) {
-	case CEV_KEY:
-		event->ev.key.type = ipc_get_arg2(call);
-		event->ev.key.key = ipc_get_arg3(call);
-		event->ev.key.mods = ipc_get_arg4(call);
-		event->ev.key.c = ipc_get_arg5(call);
-		return EOK;
-	case CEV_POS:
-		event->ev.pos.pos_id = ipc_get_arg2(call) >> 16;
-		event->ev.pos.type = ipc_get_arg2(call) & 0xffff;
-		event->ev.pos.btn_num = ipc_get_arg3(call);
-		event->ev.pos.hpos = ipc_get_arg4(call);
-		event->ev.pos.vpos = ipc_get_arg5(call);
-		return EOK;
-	case CEV_RESIZE:
-		return EOK;
-	}
-
-	return EIO;
-}
-
-/** Get console event.
- *
- * @param ctrl Console
- * @param event Place to store event
- * @return EOK on success, EIO on failure
- */
-errno_t console_get_event(console_ctrl_t *ctrl, cons_event_t *event)
-{
-	if (ctrl->input_aid == 0) {
-		ipc_call_t result;
-
-		async_exch_t *exch = async_exchange_begin(ctrl->input_sess);
-		aid_t aid = async_send_0(exch, CONSOLE_GET_EVENT, &result);
-		async_exchange_end(exch);
-
-		errno_t rc;
-		async_wait_for(aid, &rc);
-
-		if (rc != EOK)
-			return EIO;
-
-		rc = console_ev_decode(&result, event);
-		if (rc != EOK)
-			return EIO;
-	} else {
-		errno_t retval;
-		async_wait_for(ctrl->input_aid, &retval);
-
-		ctrl->input_aid = 0;
-
-		if (retval != EOK)
-			return EIO;
-
-		errno_t rc = console_ev_decode(&ctrl->input_call, event);
-		if (rc != EOK)
-			return EIO;
-	}
-
-	return EOK;
-}
-
-/** Get console event with timeout.
- *
- * @param ctrl Console
- * @param event Place to store event
- * @param timeout Pointer to timeout. This will be updated to reflect
- *                the remaining time in case of timeout.
- * @return EOK on success (event received), ETIMEOUT on time out,
- *         EIO on I/O error (e.g. lost console connection), ENOMEM
- *         if out of memory
- */
-errno_t console_get_event_timeout(console_ctrl_t *ctrl, cons_event_t *event,
-    usec_t *timeout)
-{
-	struct timespec t0;
-	getuptime(&t0);
-
-	if (ctrl->input_aid == 0) {
-		async_exch_t *exch = async_exchange_begin(ctrl->input_sess);
-		ctrl->input_aid = async_send_0(exch, CONSOLE_GET_EVENT,
-		    &ctrl->input_call);
-		async_exchange_end(exch);
-	}
-
-	errno_t retval;
-	errno_t rc = async_wait_timeout(ctrl->input_aid, &retval, *timeout);
-	if (rc != EOK) {
-		if (rc == ENOMEM)
-			return ENOMEM;
-		*timeout = 0;
-		return ETIMEOUT;
-	}
-
-	ctrl->input_aid = 0;
-
-	if (retval != EOK)
-		return EIO;
-
-	rc = console_ev_decode(&ctrl->input_call, event);
-	if (rc != EOK)
-		return EIO;
-
-	/* Update timeout */
-	struct timespec t1;
-	getuptime(&t1);
-	*timeout -= NSEC2USEC(ts_sub_diff(&t1, &t0));
-
-	return EOK;
-}
-
-/** Create a shared buffer for fast rendering to the console.
- *
- * @param ctrl Console
- * @param cols Number of columns
- * @param rows Number of rows
- * @param rbuf Place to store pointer to the shared buffer
- * @return EOK on success or an error code
- */
-errno_t console_map(console_ctrl_t *ctrl, sysarg_t cols, sysarg_t rows,
-    charfield_t **rbuf)
-{
-	async_exch_t *exch = NULL;
-	void *buf;
-	aid_t req;
-	ipc_call_t answer;
-	size_t asize;
-	errno_t rc;
-
-	exch = async_exchange_begin(ctrl->output_sess);
-	req = async_send_2(exch, CONSOLE_MAP, cols, rows, &answer);
-
-	asize = PAGES2SIZE(SIZE2PAGES(cols * rows * sizeof(charfield_t)));
-
-	rc = async_share_in_start_0_0(exch, asize, &buf);
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-
-	async_exchange_end(exch);
-	exch = NULL;
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	*rbuf = (charfield_t *)buf;
-	return EOK;
-error:
-	if (exch != NULL)
-		async_exchange_end(exch);
-	return rc;
-}
-
-/** Unmap console shared buffer.
- *
- * @param ctrl Console
- * @param buf Buffer
- */
-void console_unmap(console_ctrl_t *ctrl, charfield_t *buf)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	(void) async_req_0_0(exch, CONSOLE_UNMAP);
-	async_exchange_end(exch);
-
-	as_area_destroy(buf);
-}
-
-/** Update console rectangle from shared buffer.
- *
- * @param ctrl Console
- * @param c0 Column coordinate of top-left corner (inclusive)
- * @param r0 Row coordinate of top-left corner (inclusive)
- * @param c1 Column coordinate of bottom-right corner (exclusive)
- * @param r1 Row coordinate of bottom-right corner (exclusive)
- *
- * @return EOK on sucess or an error code
- */
-errno_t console_update(console_ctrl_t *ctrl, sysarg_t c0, sysarg_t r0,
-    sysarg_t c1, sysarg_t r1)
-{
-	async_exch_t *exch = async_exchange_begin(ctrl->output_sess);
-	errno_t rc = async_req_4_0(exch, CONSOLE_UPDATE, c0, r0, c1, r1);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/corecfg/doc/doxygroups.h
===================================================================
--- uspace/lib/corecfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libcorecfg libcorecfg
- * @ingroup libs
- */
Index: pace/lib/corecfg/include/corecfg.h
===================================================================
--- uspace/lib/corecfg/include/corecfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcorecfg
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBCORECFG_CORECFG_H_
-#define _LIBCORECFG_CORECFG_H_
-
-#include <errno.h>
-#include <stdbool.h>
-
-extern errno_t corecfg_init(void);
-extern errno_t corecfg_set_enable(bool);
-extern errno_t corecfg_get_enable(bool *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/corecfg/include/ipc/corecfg.h
===================================================================
--- uspace/lib/corecfg/include/ipc/corecfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libcorecfg
- * @{
- */
-
-#ifndef _LIBCORECFG_IPC_CORECFG_H_
-#define _LIBCORECFG_IPC_CORECFG_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	CORECFG_GET_ENABLE = IPC_FIRST_USER_METHOD,
-	CORECFG_SET_ENABLE
-} corecfg_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/corecfg/meson.build
===================================================================
--- uspace/lib/corecfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/corecfg.c')
Index: pace/lib/corecfg/src/corecfg.c
===================================================================
--- uspace/lib/corecfg/src/corecfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <corecfg.h>
-#include <errno.h>
-#include <ipc/corecfg.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-
-static async_sess_t *corecfg_sess = NULL;
-
-errno_t corecfg_init(void)
-{
-	service_id_t corecfg_svc;
-	errno_t rc;
-
-	assert(corecfg_sess == NULL);
-
-	rc = loc_service_get_id(SERVICE_NAME_CORECFG, &corecfg_svc,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return ENOENT;
-
-	corecfg_sess = loc_service_connect(corecfg_svc, INTERFACE_CORECFG,
-	    IPC_FLAG_BLOCKING);
-	if (corecfg_sess == NULL)
-		return ENOENT;
-
-	return EOK;
-}
-
-/** Get core dump enable status. */
-errno_t corecfg_get_enable(bool *renable)
-{
-	async_exch_t *exch = async_exchange_begin(corecfg_sess);
-	sysarg_t enable;
-
-	errno_t rc = async_req_0_1(exch, CORECFG_GET_ENABLE, &enable);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	*renable = enable;
-	return EOK;
-}
-
-/** Enable or disable core dumps. */
-errno_t corecfg_set_enable(bool enable)
-{
-	async_exch_t *exch = async_exchange_begin(corecfg_sess);
-	errno_t rc = async_req_1_0(exch, CORECFG_SET_ENABLE, (sysarg_t) enable);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/cpp/include/__bits/abi.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/abi.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,164 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ABI
-#define LIBCPP_BITS_ABI
-
-#include <cstddef>
-#include <cstdint>
-#include <typeinfo>
-
-namespace __cxxabiv1
-{
-    /**
-     * Static constructor/destructor helpers.
-     */
-
-    extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
-
-    extern "C" void __cxa_finalize(void*);
-
-    /**
-     * Itanium C++ ABI type infos.
-     * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
-     *
-     * Note: The memory representation of these classes must not
-     *       be modified! (Wel, no modifications at all shall be done.)
-     *
-     * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
-     */
-
-    class __fundamental_type_info: public std::type_info
-    {
-        public:
-            virtual ~__fundamental_type_info();
-    };
-
-    class __array_type_info: public std::type_info
-    {
-        public:
-            virtual ~__array_type_info();
-    };
-
-    class __function_type_info: public std::type_info
-    {
-        public:
-            virtual ~__function_type_info();
-    };
-
-    class __enum_type_info: public std::type_info
-    {
-        public:
-            virtual ~__enum_type_info();
-    };
-
-    class __class_type_info: public std::type_info
-    {
-        public:
-            virtual ~__class_type_info();
-    };
-
-    class __si_class_type_info: public __class_type_info
-    {
-        public:
-            virtual ~__si_class_type_info();
-
-            const __class_type_info* __base_type;
-    };
-
-    struct __base_class_type_info
-    {
-        const __class_type_info* __base_type;
-        long __offset_flags;
-
-        enum __ofset_flags_masks
-        {
-            __virtual_mask = 0x1,
-            __public_mask =  0x2,
-            __offset_shift = 0x8
-        };
-    };
-
-    class __vmi_class_type_info: public __class_type_info
-    {
-        public:
-            virtual ~__vmi_class_type_info();
-
-            std::uint32_t __flags;
-            std::uint32_t __base_count;
-
-            __base_class_type_info __base_info[1];
-
-            enum __flags_mask
-            {
-                __non_diamond_repeat_mask = 0x1,
-                __diamond_shaped_mask     = 0x2
-            };
-    };
-
-    class __pbase_type_info: public std::type_info
-    {
-        public:
-            virtual ~__pbase_type_info();
-
-            std::uint32_t __flags;
-            const std::type_info* __pointee;
-
-            enum __masks
-            {
-                __const_mask            = 0x01,
-                __volatile_mask         = 0x02,
-                __restrict_mask         = 0x04,
-                __incomplete_mask       = 0x08,
-                __incomplete_class_mask = 0x10,
-                __transaction_safe_mask = 0x20,
-                __noexcept_mask         = 0x40
-            };
-    };
-
-    class __pointer_type_info: public __pbase_type_info
-    {
-        public:
-            virtual ~__pointer_type_info();
-    };
-
-    class __pointer_to_member_type_info: public __pbase_type_info
-    {
-        public:
-            virtual ~__pointer_to_member_type_info();
-
-            const __class_type_info* __context;
-    };
-
-    extern "C" void* __dynamic_cast(const void*, const __class_type_info*,
-                                    const __class_type_info*, std::ptrdiff_t);
-}
-
-namespace abi = __cxxabiv1;
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/array.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/array.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_ARRAY
-#define LIBCPP_BITS_ADT_ARRAY
-
-#include <iterator>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.3.2, class template array:
-     */
-
-    template<class T, size_t N>
-    struct array
-    {
-        using value_type             = T;
-        using reference              = T&;
-        using const_reference        = const T&;
-        using size_type              = size_t;
-        using difference_type        = ptrdiff_t;
-        using pointer                = T*;
-        using const_pointer          = const T*;
-        using iterator               = pointer;
-        using const_iterator         = const_pointer;
-        using reverse_iterator       = std::reverse_iterator<iterator>;
-        using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-        /**
-         * Note: In the case of N == 0 the standard mandates that
-         *       begin() == end() which is achieved by setting the size
-         *       to 1. Return value of data() is unspecified and front()
-         *       and back() cause undefined behavior.
-         */
-        value_type elems[N ? N : 1];
-
-        void fill(const T& x)
-        {
-            fill_n(begin(), N, x);
-        }
-
-        void swap(array& other)
-                // TODO: Does not find declval atm :/
-                /* noexcept(noexcept(swap(declval<T&>(), declval<T&>()))) */
-        {
-            swap_ranges(begin(), end(), other.begin());
-        }
-
-        iterator begin() noexcept
-        {
-            return &elems[0];
-        }
-
-        iterator end() noexcept
-        {
-            return &elems[0] + N;
-        }
-
-        reverse_iterator rbegin() noexcept
-        {
-            return make_reverse_iterator(end());
-        }
-
-        reverse_iterator rend() noexcept
-        {
-            return make_reverse_iterator(begin());
-        }
-
-        const_iterator cbegin() const noexcept
-        {
-            return &elems[0];
-        }
-
-        const_iterator cend() const noexcept
-        {
-            return &elems[0] + N;
-        }
-
-        const_reverse_iterator crbegin() const noexcept
-        {
-            return make_reverse_iterator(end());
-        }
-
-        const_reverse_iterator crend() const noexcept
-        {
-            return make_reverse_iterator(begin());
-        }
-
-        reference operator[](size_type idx)
-        {
-            return elems[idx];
-        }
-
-        constexpr const_reference operator[](size_type idx) const
-        {
-            return elems[idx];
-        }
-
-        reference at(size_type idx)
-        {
-            // TODO: Bounds checking.
-            return elems[idx];
-        }
-
-        constexpr const_reference at(size_type idx) const
-        {
-            // TODO: Bounds checking.
-            return elems[idx];
-        }
-
-        reference front()
-        {
-            return elems[0];
-        }
-
-        constexpr const_reference front() const
-        {
-            return elems[0];
-        }
-
-        reference back()
-        {
-            return elems[N - 1];
-        }
-
-        constexpr const_reference back() const
-        {
-            return elems[N - 1];
-        }
-
-        pointer data() noexcept
-        {
-            return &elems[0];
-        }
-
-        const_pointer data() const noexcept
-        {
-            return &elems[0];
-        }
-
-        size_type size() const noexcept
-        {
-            return N;
-        }
-    };
-
-    template<class T, size_t N>
-    void swap(array<T, N>& lhs, array<T, N>& rhs) noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 23.3.2.9, tuple interface for class template array:
-     */
-
-    template<class>
-    struct tuple_size;
-
-    template<class T, size_t N>
-    struct tuple_size<array<T, N>>
-        : integral_constant<size_t, N>
-    { /* DUMMY BODY */ };
-
-    template<size_t, class>
-    struct tuple_element;
-
-    template<size_t I, class T, size_t N>
-    struct tuple_element<I, array<T, N>>
-        : aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<size_t I, class T, size_t N>
-    constexpr T& get(array<T, N>& arr) noexcept
-    {
-        static_assert(I < N, "index out of bounds");
-
-        return arr[I];
-    }
-
-    template<size_t I, class T, size_t N>
-    constexpr T&& get(array<T, N>&& arr) noexcept
-    {
-        return move(get<I>(arr));
-    }
-
-    template<size_t I, class T, size_t N>
-    constexpr const T& get(const array<T, N>& arr) noexcept
-    {
-        static_assert(I < N, "index out of bounds");
-
-        return arr[I];
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/bitset.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/bitset.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,510 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_BITSET
-#define LIBCPP_BITS_ADT_BITSET
-
-#include <iosfwd>
-#include <string>
-
-namespace std
-{
-    /**
-     * 20.6, class template bitset:
-     */
-
-    template<size_t N>
-    class bitset
-    {
-        public:
-            class reference
-            {
-                friend class bitset;
-
-                public:
-                    ~reference() noexcept = default;
-
-                    reference& operator=(bool val) noexcept
-                    {
-                        if (val)
-                            data_ |= mask_;
-                        else
-                            data_ &= ~mask_;
-                    }
-
-                    reference& operator=(const reference& other) noexcept
-                    {
-                        if (other)
-                            data_ |= mask_;
-                        else
-                            data_ &= ~mask_;
-                    }
-
-                    bool operator~() const noexcept
-                    {
-                        return data_ & mask_;
-                    }
-
-                    operator bool() const noexcept
-                    {
-                        return data_ & mask_;
-                    }
-
-                    reference& flip() noexcept
-                    {
-                        data_ ^= mask_;
-
-                        return *this;
-                    }
-
-                private:
-                    reference() noexcept = delete;
-
-                    using data_type = typename bitset::data_type;
-
-                    data_type& data_;
-                    data_type mask_;
-
-                    reference(data_type& data, size_t idx)
-                        : data_{data}, mask_{bitset::one_ << idx}
-                    { /* DUMMY BODY */ }
-            };
-
-            /**
-             * 20.6.1, constructors:
-             */
-
-            constexpr bitset() noexcept
-            {
-                init_(zero_);
-            }
-
-            constexpr bitset(unsigned long long val) noexcept
-            {
-                init_(val);
-            }
-
-            template<class Char, class Traits, class Allocator>
-            explicit bitset(
-                const basic_string<Char, Traits, Allocator>& str,
-                typename basic_string<Char, Traits, Allocator>::size_type pos = 0,
-                typename basic_string<Char, Traits, Allocator>::size_type n =
-                    basic_string<Char, Traits, Allocator>::npos,
-                Char zero = Char('0'), Char one = Char('1')
-            )
-            {
-                // TODO: throw out_of_range if pos > str.size()
-
-                init_(zero_);
-                auto len = n < (str.size() - pos) ? n : (str.size() - pos);
-                len = len < N ? len : N;
-
-                for (size_t i = 0, j = pos + len - 1; i < len; ++i, --j)
-                {
-                    if (Traits::eq(str[j], zero))
-                        set(i, false);
-                    else if (Traits::eq(str[j], one))
-                        set(i, true);
-                    // TODO: else throw invalid_argument
-                }
-            }
-
-            template<class Char>
-            explicit bitset(
-                const Char* str,
-                typename basic_string<Char>::size_type n = basic_string<Char>::npos,
-                Char zero = Char('0'), Char one = Char('1')
-            )
-                : bitset{
-                    n == basic_string<Char>::npos ? basic_string<Char>{str} : basic_string<Char>{str, n},
-                    0, n, zero, one
-                  }
-            { /* DUMMY BODY */ }
-
-            /**
-             * 20.6.2, bitset operations:
-             */
-
-            bitset<N>& operator&=(const bitset<N>& rhs) noexcept
-            {
-                for (size_t i = 0; i < data_size_; ++i)
-                    data_[i] &= rhs.data_[i];
-
-                return *this;
-            }
-
-            bitset<N>& operator|=(const bitset<N>& rhs) noexcept
-            {
-                for (size_t i = 0; i < data_size_; ++i)
-                    data_[i] |= rhs.data_[i];
-
-                return *this;
-            }
-
-            bitset<N>& operator^=(const bitset<N>& rhs) noexcept
-            {
-                for (size_t i = 0; i < data_size_; ++i)
-                    data_[i] ^= rhs.data_[i];
-
-                return *this;
-            }
-
-            bitset<N>& operator<<=(size_t pos) noexcept
-            {
-                for (size_t i = N; i > 1; --i)
-                {
-                    if (i < pos)
-                        set(i - 1, false);
-                    else
-                        set(i - 1, test(i - 1 - pos));
-                }
-
-                return *this;
-            }
-
-            bitset<N>& operator>>=(size_t pos) noexcept
-            {
-                for (size_t i = 0; i < N; ++i)
-                {
-                    if (pos >= N - i)
-                        set(i, false);
-                    else
-                        set(i, test(i + pos));
-                }
-
-                return *this;
-            }
-
-            bitset<N>& set() noexcept
-            {
-                for (size_t i = 0; i < N; ++i)
-                    set(i);
-
-                return *this;
-            }
-
-            bitset<N>& set(size_t pos, bool val = true)
-            {
-                // TODO: throw out_of_range if pos > N
-                set_bit_(get_data_idx_(pos), get_bit_idx_(pos), val);
-
-                return *this;
-            }
-
-            bitset<N>& reset() noexcept
-            {
-                for (size_t i = 0; i < N; ++i)
-                    reset(i);
-
-                return *this;
-            }
-
-            bitset<N>& reset(size_t pos)
-            {
-                set_bit_(get_data_idx_(pos), get_bit_idx_(pos), false);
-
-                return *this;
-            }
-
-            bitset<N> operator~() const noexcept
-            {
-                bitset<N> res{*this};
-
-                return res.flip();
-            }
-
-            bitset<N>& flip() noexcept
-            {
-                for (size_t i = 0; i < N; ++i)
-                    flip(i);
-
-                return *this;
-            }
-
-            bitset<N>& flip(size_t pos)
-            {
-                return set(pos, !test(pos));
-            }
-
-            constexpr bool operator[](size_t pos) const
-            {
-                /**
-                 * Note: The standard doesn't mention any exception
-                 *       here being thrown at any time, so we shouldn't
-                 *       use test().
-                 */
-                return get_bit_(data_[get_data_idx_(pos)], get_bit_idx_(pos));
-            }
-
-            reference operator[](size_t pos)
-            {
-                return reference{data_[get_data_idx_(pos)], get_bit_idx_(pos)};
-            }
-
-            unsigned long to_ulong() const
-            {
-                // TODO: throw overflow_error if N > bits in ulong
-                return static_cast<unsigned long>(data_[0]);
-            }
-
-            unsigned long long to_ullong() const
-            {
-                // TODO: throw overflow_error if N > bits_in_data_type_
-                return data_[0];
-            }
-
-            template<
-                class Char = char,
-                class Traits = char_traits<Char>,
-                class Allocator = allocator<Char>
-            >
-            basic_string<Char, Traits, Allocator> to_string(Char zero = Char('0'),
-                                                            Char one = Char('1')) const
-            {
-                basic_string<Char, Traits, Allocator> res{};
-                res.reserve(N);
-                for (size_t i = N; i > 0; --i)
-                {
-                    if (test(i - 1))
-                        res.push_back(one);
-                    else
-                        res.push_back(zero);
-                }
-
-                return res;
-            }
-
-            size_t count() const noexcept
-            {
-                size_t res{};
-                for (size_t i = 0; i < N; ++i)
-                {
-                    if (test(i))
-                        ++res;
-                }
-
-                return res;
-            }
-
-            constexpr size_t size() const noexcept
-            {
-                return N;
-            }
-
-            bool operator==(const bitset<N>& rhs) const noexcept
-            {
-                for (size_t i = 0; i < data_size_; ++i)
-                {
-                    if (data_[i] != rhs.data_[i])
-                        return false;
-                }
-
-                return true;
-            }
-
-            bool operator!=(const bitset<N>& rhs) const noexcept
-            {
-                return !(*this == rhs);
-            }
-
-            bool test(size_t pos) const
-            {
-                // TODO: throw out of range if pos > N
-                return get_bit_(data_[get_data_idx_(pos)], get_bit_idx_(pos));
-            }
-
-            bool all() const noexcept
-            {
-                return count() == size();
-            }
-
-            bool any() const noexcept
-            {
-                return count() != 0;
-            }
-
-            bool none() const noexcept
-            {
-                return count() == 0;
-            }
-
-            bitset<N> operator<<(size_t pos) const noexcept
-            {
-                return bitset<N>{*this} <<= pos;
-            }
-
-            bitset<N> operator>>(size_t pos) const noexcept
-            {
-                return bitset<N>{*this} >>= pos;
-            }
-
-        private:
-            /**
-             * While this might be a bit more wasteful
-             * than using unsigned or unsigned long,
-             * it will make parts of out code easier
-             * to read.
-             */
-            using data_type = unsigned long long;
-
-            static constexpr size_t bits_in_data_type_ = sizeof(data_type) * 8;
-            static constexpr size_t data_size_ = N / bits_in_data_type_ + 1;
-
-            /**
-             * These are useful for masks, if we use literals
-             * then forgetting to add ULL or changing the data
-             * type could result in wrong indices being computed.
-             */
-            static constexpr data_type zero_ = data_type{0};
-            static constexpr data_type one_ = data_type{1};
-
-            data_type data_[data_size_];
-
-            void init_(data_type val)
-            {
-                data_type mask{~zero_};
-                if (N < bits_in_data_type_)
-                    mask >>= N;
-                data_[0] = val & mask;
-
-                for (size_t i = 1; i < data_size_; ++i)
-                    data_[i] = data_type{};
-            }
-
-            size_t get_data_idx_(size_t pos) const
-            {
-                return pos / bits_in_data_type_;
-            }
-
-            size_t get_bit_idx_(size_t pos) const
-            {
-                return pos % bits_in_data_type_;
-            }
-
-            bool get_bit_(data_type data, size_t bit_idx) const
-            {
-                return data & (one_ << bit_idx);
-            }
-
-            void set_bit_(size_t data_idx, size_t bit_idx, bool val)
-            {
-                if (val)
-                    data_[data_idx] |= (one_ << bit_idx);
-                else
-                    data_[data_idx] &= ~(one_ << bit_idx);
-            }
-    };
-
-    /**
-     * 20.6.3 hash support:
-     */
-
-    template<class T>
-    struct hash;
-
-    template<size_t N>
-    struct hash<bitset<N>>
-    {
-        size_t operator()(const bitset<N>& set) const noexcept
-        {
-            return hash<unsigned long long>{}(set.to_ullong());
-        }
-
-        using argument_type = bitset<N>;
-        using result_type   = size_t;
-    };
-
-    /**
-     * 20.6.4, bitset operators:
-     */
-
-    template<size_t N>
-    bitset<N> operator&(const bitset<N>& lhs, const bitset<N>& rhs) noexcept
-    {
-        return bitset<N>{lhs} &= rhs;
-    }
-
-    template<size_t N>
-    bitset<N> operator|(const bitset<N>& lhs, const bitset<N>& rhs) noexcept
-    {
-        return bitset<N>{lhs} |= rhs;
-    }
-
-    template<size_t N>
-    bitset<N> operator^(const bitset<N>& lhs, const bitset<N>& rhs) noexcept
-    {
-        return bitset<N>{lhs} ^= rhs;
-    }
-
-    template<class Char, class Traits, size_t N>
-    basic_istream<Char, Traits>&
-    operator>>(basic_istream<Char, Traits>& is, bitset<N>& set)
-    {
-        size_t i{};
-        Char c{};
-        Char zero{is.widen('0')};
-        Char one{is.widen('1')};
-
-        basic_string<Char, Traits> str{};
-        while (i < N)
-        {
-            if (is.eof())
-                break;
-
-            is.get(c);
-
-            if (!Traits::eq(c, one) && !Traits::eq(c, zero))
-            {
-                is.putback(c);
-                break;
-            }
-
-            str.push_back(c);
-            ++i;
-        }
-
-        if (i == 0)
-            is.setstate(ios_base::failbit);
-
-        set = bitset<N>{str};
-
-        return is;
-    }
-
-    template<class Char, class Traits, size_t N>
-    basic_ostream<Char, Traits>&
-    operator<<(basic_ostream<Char, Traits>& os, const bitset<N>& set)
-    {
-        return os << set.template to_string<Char, Traits, allocator<Char>>(
-            use_facet<ctype<Char>>(os.getloc()).widen('0'),
-            use_facet<ctype<Char>>(os.getloc()).widen('1')
-        );
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/deque.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/deque.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1218 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_DEQUE
-#define LIBCPP_BITS_ADT_DEQUE
-
-#include <__bits/insert_iterator.hpp>
-#include <algorithm>
-#include <initializer_list>
-#include <iterator>
-#include <memory>
-
-namespace std
-{
-    template<class T, class Allocator = allocator<T>>
-    class deque;
-
-    namespace aux
-    {
-        /**
-         * Note: We decided that these iterators contain a
-         *       reference to the container and an index, which
-         *       allows us to use the already implemented operator[]
-         *       on deque and also allows us to conform to the requirement
-         *       of the standard that functions such as push_back
-         *       invalidate the .end() iterator.
-         */
-
-        template<class T, class Allocator>
-        class deque_iterator;
-
-        template<class T, class Allocator>
-        class deque_const_iterator
-        {
-            public:
-                using size_type         = typename deque<T, Allocator>::size_type;
-                using value_type        = typename deque<T, Allocator>::value_type;
-                using reference         = typename deque<T, Allocator>::const_reference;
-                using difference_type   = size_type;
-                using pointer           = const value_type*;
-                using iterator_category = random_access_iterator_tag;
-
-                deque_const_iterator(const deque<T, Allocator>& deq, size_type idx)
-                    : deq_{deq}, idx_{idx}
-                { /* DUMMY BODY */ }
-
-                deque_const_iterator(const deque_const_iterator& other)
-                    : deq_{other.deq_}, idx_{other.idx_}
-                { /* DUMMY BODY */ }
-
-                deque_const_iterator& operator=(const deque_const_iterator& other)
-                {
-                    deq_ = other.deq_;
-                    idx_ = other.idx_;
-
-                    return *this;
-                }
-
-                reference operator*() const
-                {
-                    return deq_[idx_];
-                }
-
-                pointer operator->() const
-                {
-                    return addressof(deq_[idx_]);
-                }
-
-                deque_const_iterator& operator++()
-                {
-                    ++idx_;
-
-                    return *this;
-                }
-
-                deque_const_iterator operator++(int)
-                {
-                    return deque_const_iterator{deq_, idx_++};
-                }
-
-                deque_const_iterator& operator--()
-                {
-                    --idx_;
-
-                    return *this;
-                }
-
-                deque_const_iterator operator--(int)
-                {
-                    return deque_const_iterator{deq_, idx_--};
-                }
-
-                deque_const_iterator operator+(difference_type n)
-                {
-                    return deque_const_iterator{deq_, idx_ + n};
-                }
-
-                deque_const_iterator& operator+=(difference_type n)
-                {
-                    idx_ += n;
-
-                    return *this;
-                }
-
-                deque_const_iterator operator-(difference_type n)
-                {
-                    return deque_const_iterator{deq_, idx_ - n};
-                }
-
-                deque_const_iterator& operator-=(difference_type n)
-                {
-                    idx_ -= n;
-
-                    return *this;
-                }
-
-                reference operator[](difference_type n) const
-                {
-                    return deq_[idx_ + n];
-                }
-
-                difference_type operator-(const deque_const_iterator& rhs)
-                {
-                    return idx_ - rhs.idx_;
-                }
-
-                size_type idx() const
-                {
-                    return idx_;
-                }
-
-                operator deque_iterator<T, Allocator>()
-                {
-                    return deque_iterator{
-                        const_cast<deque<T, Allocator>&>(deq_), idx_
-                    };
-                }
-
-            private:
-                const deque<T, Allocator>& deq_;
-                size_type idx_;
-        };
-
-        template<class T, class Allocator>
-        bool operator==(const deque_const_iterator<T, Allocator>& lhs,
-                        const deque_const_iterator<T, Allocator>& rhs)
-        {
-            return lhs.idx() == rhs.idx();
-        }
-
-        template<class T, class Allocator>
-        bool operator!=(const deque_const_iterator<T, Allocator>& lhs,
-                        const deque_const_iterator<T, Allocator>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        template<class T, class Allocator>
-        class deque_iterator
-        {
-            public:
-                using size_type         = typename deque<T, Allocator>::size_type;
-                using value_type        = typename deque<T, Allocator>::value_type;
-                using reference         = typename deque<T, Allocator>::reference;
-                using difference_type   = size_type;
-                using pointer           = value_type*;
-                using iterator_category = random_access_iterator_tag;
-
-                deque_iterator(deque<T, Allocator>& deq, size_type idx)
-                    : deq_{deq}, idx_{idx}
-                { /* DUMMY BODY */ }
-
-                deque_iterator(const deque_iterator& other)
-                    : deq_{other.deq_}, idx_{other.idx_}
-                { /* DUMMY BODY */ }
-
-                deque_iterator(const deque_const_iterator<T, Allocator>& other)
-                    : deq_{other.deq_}, idx_{other.idx_}
-                { /* DUMMY BODY */ }
-
-                deque_iterator& operator=(const deque_iterator& other)
-                {
-                    deq_ = other.deq_;
-                    idx_ = other.idx_;
-
-                    return *this;
-                }
-
-                deque_iterator& operator=(const deque_const_iterator<T, Allocator>& other)
-                {
-                    deq_ = other.deq_;
-                    idx_ = other.idx_;
-
-                    return *this;
-                }
-
-                reference operator*()
-                {
-                    return deq_[idx_];
-                }
-
-                pointer operator->()
-                {
-                    return addressof(deq_[idx_]);
-                }
-
-                deque_iterator& operator++()
-                {
-                    ++idx_;
-
-                    return *this;
-                }
-
-                deque_iterator operator++(int)
-                {
-                    return deque_iterator{deq_, idx_++};
-                }
-
-                deque_iterator& operator--()
-                {
-                    --idx_;
-
-                    return *this;
-                }
-
-                deque_iterator operator--(int)
-                {
-                    return deque_iterator{deq_, idx_--};
-                }
-
-                deque_iterator operator+(difference_type n)
-                {
-                    return deque_iterator{deq_, idx_ + n};
-                }
-
-                deque_iterator& operator+=(difference_type n)
-                {
-                    idx_ += n;
-
-                    return *this;
-                }
-
-                deque_iterator operator-(difference_type n)
-                {
-                    return deque_iterator{deq_, idx_ - n};
-                }
-
-                deque_iterator& operator-=(difference_type n)
-                {
-                    idx_ -= n;
-
-                    return *this;
-                }
-
-                reference operator[](difference_type n) const
-                {
-                    return deq_[idx_ + n];
-                }
-
-                difference_type operator-(const deque_iterator& rhs)
-                {
-                    return idx_ - rhs.idx_;
-                }
-
-                size_type idx() const
-                {
-                    return idx_;
-                }
-
-                operator deque_const_iterator<T, Allocator>()
-                {
-                    return deque_const_iterator{deq_, idx_};
-                }
-
-            private:
-                deque<T, Allocator>& deq_;
-                size_type idx_;
-        };
-
-        template<class T, class Allocator>
-        bool operator==(const deque_iterator<T, Allocator>& lhs,
-                        const deque_iterator<T, Allocator>& rhs)
-        {
-            return lhs.idx() == rhs.idx();
-        }
-
-        template<class T, class Allocator>
-        bool operator!=(const deque_iterator<T, Allocator>& lhs,
-                        const deque_iterator<T, Allocator>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-    }
-
-    /**
-     * 23.3.3 deque:
-     */
-
-    template<class T, class Allocator>
-    class deque
-    {
-        public:
-            using allocator_type  = Allocator;
-            using value_type      = T;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-
-            using iterator               = aux::deque_iterator<T, Allocator>;
-            using const_iterator         = aux::deque_const_iterator<T, Allocator>;
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            using size_type       = typename allocator_traits<allocator_type>::size_type;
-            using difference_type = typename allocator_traits<allocator_type>::difference_type;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-
-            /**
-             * 23.3.3.2, construct/copy/destroy:
-             */
-
-            deque()
-                : deque{allocator_type{}}
-            { /* DUMMY BODY */ }
-
-            explicit deque(const allocator_type& alloc)
-                : allocator_{alloc}, front_bucket_idx_{bucket_size_},
-                  back_bucket_idx_{0}, front_bucket_{default_front_},
-                  back_bucket_{default_back_}, bucket_count_{default_bucket_count_},
-                  bucket_capacity_{default_bucket_capacity_}, size_{}, data_{}
-            {
-                init_();
-            }
-
-            explicit deque(size_type n, const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, front_bucket_idx_{bucket_size_}, back_bucket_idx_{},
-                  front_bucket_{}, back_bucket_{}, bucket_count_{},
-                  bucket_capacity_{}, size_{n}, data_{}
-            {
-                prepare_for_size_(n);
-                init_();
-
-                for (size_type i = 0; i < size_; ++i)
-                    allocator_.construct(&(*this)[i]);
-                back_bucket_idx_ = size_ % bucket_size_;
-            }
-
-            deque(size_type n, const value_type& value, const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, front_bucket_idx_{bucket_size_}, back_bucket_idx_{},
-                  front_bucket_{}, back_bucket_{}, bucket_count_{},
-                  bucket_capacity_{}, size_{n}, data_{}
-            {
-                prepare_for_size_(n);
-                init_();
-
-                for (size_type i = 0; i < size_; ++i)
-                    (*this)[i] = value;
-                back_bucket_idx_ = size_ % bucket_size_;
-            }
-
-            template<class InputIterator>
-            deque(InputIterator first, InputIterator last,
-                  const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, front_bucket_idx_{bucket_size_},
-                  back_bucket_idx_{}, front_bucket_{}, back_bucket_{},
-                  bucket_count_{}, bucket_capacity_{}, size_{},
-                  data_{}
-            {
-                copy_from_range_(first, last);
-            }
-
-            deque(const deque& other)
-                : deque{other.begin(), other.end(), other.allocator_}
-            { /* DUMMY BODY */ }
-
-            deque(deque&& other)
-                : allocator_{move(other.allocator_)},
-                  front_bucket_idx_{other.front_bucket_idx_},
-                  back_bucket_idx_{other.back_bucket_idx_},
-                  front_bucket_{other.front_bucket_},
-                  back_bucket_{other.back_bucket_},
-                  bucket_count_{other.bucket_count_},
-                  bucket_capacity_{other.bucket_capacity_},
-                  size_{other.size_}, data_{other.data_}
-            {
-                other.data_ = nullptr;
-                other.clear();
-            }
-
-            deque(const deque& other, const allocator_type& alloc)
-                : deque{other.begin(), other.end(), alloc}
-            { /* DUMMY BODY */ }
-
-            deque(deque&& other, const allocator_type& alloc)
-                : allocator_{alloc},
-                  front_bucket_idx_{other.front_bucket_idx_},
-                  back_bucket_idx_{other.front_bucket_idx_},
-                  front_bucket_{other.front_bucket_},
-                  back_bucket_{other.back_bucket_},
-                  bucket_count_{other.bucket_count_},
-                  bucket_capacity_{other.bucket_capacity_},
-                  size_{other.size_}, data_{other.data_}
-            {
-                other.data_ = nullptr;
-                other.clear();
-            }
-
-            deque(initializer_list<T> init, const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, front_bucket_idx_{bucket_size_},
-                  back_bucket_idx_{}, front_bucket_{}, back_bucket_{},
-                  bucket_count_{}, bucket_capacity_{}, size_{},
-                  data_{}
-            {
-                copy_from_range_(init.begin(), init.end());
-            }
-
-            ~deque()
-            {
-                fini_();
-            }
-
-            deque& operator=(const deque& other)
-            {
-                if (data_)
-                    fini_();
-
-                copy_from_range_(other.begin(), other.end());
-
-                return *this;
-            }
-
-            deque& operator=(deque&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                swap(other);
-                other.clear();
-
-                return *this;
-            }
-
-            deque& operator=(initializer_list<T> init)
-            {
-                if (data_)
-                    fini_();
-
-                copy_from_range_(init.begin(), init.end());
-
-                return *this;
-            }
-
-            template<class InputIterator>
-            void assign(InputIterator first, InputIterator last)
-            {
-                copy_from_range_(first, last);
-            }
-
-            void assign(size_type n, const T& value)
-            {
-                prepare_for_size_(n);
-                init_();
-                size_ = n;
-
-                auto it = begin();
-                for (size_type i = size_type{}; i < n; ++i)
-                    *it++ = value;
-            }
-
-            void assign(initializer_list<T> init)
-            {
-                copy_from_range_(init.begin(), init.end());
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return aux::deque_iterator{*this, 0};
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return aux::deque_const_iterator{*this, 0};
-            }
-
-            iterator end() noexcept
-            {
-                return aux::deque_iterator{*this, size_};
-            }
-
-            const_iterator end() const noexcept
-            {
-                return aux::deque_const_iterator{*this, size_};
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return make_reverse_iterator(end());
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return make_reverse_iterator(begin());
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return aux::deque_const_iterator{*this, 0};
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return aux::deque_const_iterator{*this, size_};
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            /**
-             * 23.3.3.3, capacity:
-             */
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type max_size() const noexcept
-            {
-                return allocator_traits<allocator_type>::max_size(allocator_);
-            }
-
-            void resize(size_type sz)
-            {
-                if (sz <= size_)
-                {
-                    auto count = size_ - sz;
-                    for (size_type i = 0; i < count; ++i)
-                        pop_back();
-                }
-                else
-                {
-                    value_type value{};
-                    auto count = sz - size_;
-                    for (size_type i = 0; i < count; ++i)
-                        push_back(value);
-                }
-            }
-
-            void resize(size_type sz, const value_type& value)
-            {
-                if (sz <= size_)
-                {
-                    auto count = size_ - sz;
-                    for (size_type i = 0; i < count; ++i)
-                        pop_back();
-                }
-                else
-                {
-                    auto count = sz - size_;
-                    for (size_type i = 0; i < count; ++i)
-                        push_back(value);
-                }
-            }
-
-            void shrink_to_fit()
-            {
-                /**
-                 * We lazily allocate buckets and eagerily deallocate them.
-                 * We cannot go into smaller pieces as buckets have fixed size.
-                 * Because of this, shrink_to_fit has no effect (as permitted
-                 * by the standard).
-                 */
-            }
-
-            bool empty() const noexcept
-            {
-                return size_ == size_type{};
-            }
-
-            reference operator[](size_type idx)
-            {
-                return data_[get_bucket_index_(idx)][get_element_index_(idx)];
-            }
-
-            const_reference operator[](size_type idx) const
-            {
-                return data_[get_bucket_index_(idx)][get_element_index_(idx)];
-            }
-
-            reference at(size_type idx)
-            {
-                // TODO: bounds checking
-                return operator[](idx);
-            }
-
-            const_reference at(size_type idx) const
-            {
-                // TODO: bounds checking
-                return operator[](idx);
-            }
-
-            reference front()
-            {
-                return *begin();
-            }
-
-            const_reference front() const
-            {
-                return *cbegin();
-            }
-
-            reference back()
-            {
-                auto tmp = end();
-
-                return *(--tmp);
-            }
-
-            const_reference back() const
-            {
-                auto tmp = cend();
-
-                return *(--tmp);
-            }
-
-            /**
-             * 23.3.3.4, modifiers:
-             */
-
-            template<class... Args>
-            void emplace_front(Args&&... args)
-            {
-                if (front_bucket_idx_ == 0)
-                    add_new_bucket_front_();
-
-                allocator_traits<allocator_type>::construct(
-                    allocator_,
-                    &data_[front_bucket_][--front_bucket_idx_],
-                    forward<Args>(args)...
-                );
-
-                ++size_;
-            }
-
-            template<class... Args>
-            void emplace_back(Args&&... args)
-            {
-                allocator_traits<allocator_type>::construct(
-                    allocator_,
-                    &data_[back_bucket_][back_bucket_idx_++],
-                    forward<Args>(args)...
-                );
-
-                ++size_;
-
-                if (back_bucket_idx_ >= bucket_size_)
-                    add_new_bucket_back_();
-            }
-
-            template<class... Args>
-            iterator emplace(const_iterator position, Args&&... args)
-            {
-                auto idx = position.idx();
-                shift_right_(idx, 1);
-
-                allocator_traits<allocator_type>::construct(
-                    allocator_,
-                    &data_[get_bucket_index_(idx)][get_element_index_(idx)],
-                    forward<Args>(args)...
-                );
-                ++size_;
-
-                return iterator{*this, idx};
-            }
-
-            void push_front(const value_type& value)
-            {
-                if (front_bucket_idx_ == 0)
-                    add_new_bucket_front_();
-
-                data_[front_bucket_][--front_bucket_idx_] = value;
-                ++size_;
-            }
-
-            void push_front(value_type&& value)
-            {
-                if (front_bucket_idx_ == 0)
-                    add_new_bucket_front_();
-
-                data_[front_bucket_][--front_bucket_idx_] = forward<value_type>(value);
-                ++size_;
-            }
-
-            void push_back(const value_type& value)
-            {
-                data_[back_bucket_][back_bucket_idx_++] = value;
-                ++size_;
-
-                if (back_bucket_idx_ >= bucket_size_)
-                    add_new_bucket_back_();
-            }
-
-            void push_back(value_type&& value)
-            {
-                data_[back_bucket_][back_bucket_idx_++] = forward<value_type>(value);
-                ++size_;
-
-                if (back_bucket_idx_ >= bucket_size_)
-                    add_new_bucket_back_();
-            }
-
-            iterator insert(const_iterator position, const value_type& value)
-            {
-                auto idx = position.idx();
-                shift_right_(idx, 1);
-
-                /**
-                 * Note: One may notice that when working with the deque
-                 *       iterator, we use its index without any checks.
-                 *       This is because a valid iterator will always have
-                 *       a valid index as functions like pop_back or erase
-                 *       invalidate iterators.
-                 */
-                data_[get_bucket_index_(idx)][get_element_index_(idx)] = value;
-                ++size_;
-
-                return iterator{*this, idx};
-            }
-
-            iterator insert(const_iterator position, value_type&& value)
-            {
-                auto idx = position.idx();
-                shift_right_(idx, 1);
-
-                data_[get_bucket_index_(idx)][get_element_index_(idx)] = forward<value_type>(value);
-                ++size_;
-
-                return iterator{*this, idx};
-            }
-
-            iterator insert(const_iterator position, size_type n, const value_type& value)
-            {
-                return insert(
-                    position,
-                    aux::insert_iterator<int>{0u, value},
-                    aux::insert_iterator<int>{n}
-                );
-            }
-
-            template<class InputIterator>
-            iterator insert(const_iterator position, InputIterator first, InputIterator last)
-            {
-                auto idx = position.idx();
-                auto count = distance(first, last);
-
-                if (idx < size_ / 2)
-                {
-                    shift_left_(idx, count);
-
-                    iterator it{*this, idx - 1};
-                    while (first != last)
-                        *it++ = *first++;
-                }
-                else
-                {
-                    shift_right_(idx, count);
-
-                    iterator it{*this, idx};
-                    while (first != last)
-                        *it++ = *first++;
-                }
-
-                size_ += count;
-
-                return iterator{*this, idx};
-            }
-
-            iterator insert(const_iterator position, initializer_list<value_type> init)
-            {
-                return insert(position, init.begin(), init.end());
-            }
-
-            void pop_back()
-            {
-                if (empty())
-                    return;
-
-                if (back_bucket_idx_ == 0)
-                { // Means we gotta pop data_[back_bucket_ - 1][bucket_size_ - 1]!
-                    if (data_[back_bucket_])
-                        allocator_.deallocate(data_[back_bucket_], bucket_size_);
-
-                    --back_bucket_;
-                    back_bucket_idx_ = bucket_size_ - 1;
-                }
-                else
-                    --back_bucket_idx_;
-
-                allocator_.destroy(&data_[back_bucket_][back_bucket_idx_]);
-                --size_;
-            }
-
-            void pop_front()
-            {
-                if (empty())
-                    return;
-
-                if (front_bucket_idx_ >= bucket_size_)
-                { // Means we gotta pop data_[front_bucket_ + 1][0]!
-                    if (data_[front_bucket_])
-                        allocator_.deallocate(data_[front_bucket_], bucket_size_);
-
-                    ++front_bucket_;
-                    front_bucket_idx_ = 1;
-
-                    allocator_.destroy(&data_[front_bucket_][0]);
-                }
-                else
-                {
-                    allocator_.destroy(&data_[front_bucket_][front_bucket_idx_]);
-
-                    ++front_bucket_idx_;
-                }
-
-                --size_;
-            }
-
-            iterator erase(const_iterator position)
-            {
-                auto idx = position.idx();
-                copy(
-                    iterator{*this, idx + 1},
-                    end(),
-                    iterator{*this, idx}
-                );
-
-                /**
-                 * Note: We need to not only decrement size,
-                 *       but also take care of any issues caused
-                 *       by decrement bucket indices, which pop_back
-                 *       does for us.
-                 */
-                pop_back();
-
-                return iterator{*this, idx};
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                if (first == last)
-                    return first;
-
-                auto first_idx = first.idx();
-                auto last_idx = last.idx();
-                auto count = distance(first, last);
-
-                copy(
-                    iterator{*this, last_idx},
-                    end(),
-                    iterator{*this, first_idx}
-                );
-
-                for (size_type i = 0; i < count; ++i)
-                    pop_back();
-
-                return iterator{*this, first_idx};
-            }
-
-            void swap(deque& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                std::swap(allocator_, other.allocator_);
-                std::swap(front_bucket_idx_, other.front_bucket_idx_);
-                std::swap(back_bucket_idx_, other.back_bucket_idx_);
-                std::swap(front_bucket_, other.front_bucket_);
-                std::swap(back_bucket_, other.back_bucket_);
-                std::swap(bucket_count_, other.bucket_count_);
-                std::swap(bucket_capacity_, other.bucket_capacity_);
-                std::swap(size_, other.size_);
-                std::swap(data_, other.data_);
-            }
-
-            void clear() noexcept
-            {
-                if (data_)
-                    fini_();
-
-                front_bucket_ = default_front_;
-                back_bucket_ = default_back_;
-                bucket_count_ = default_bucket_count_;
-                bucket_capacity_ = default_bucket_capacity_;
-                size_ = size_type{};
-
-                init_();
-            }
-
-        private:
-            allocator_type allocator_;
-
-            /**
-             * Note: In our implementation, front_bucket_idx_
-             *       points at the first element and back_bucket_idx_
-             *       points at the one past last element. Because of this,
-             *       some operations may be done in inverse order
-             *       depending on the side they are applied to.
-             */
-            size_type front_bucket_idx_;
-            size_type back_bucket_idx_;
-            size_type front_bucket_;
-            size_type back_bucket_;
-
-            static constexpr size_type bucket_size_{16};
-            static constexpr size_type default_bucket_count_{2};
-            static constexpr size_type default_bucket_capacity_{4};
-            static constexpr size_type default_front_{1};
-            static constexpr size_type default_back_{2};
-
-            size_type bucket_count_;
-            size_type bucket_capacity_;
-            size_type size_{};
-
-            value_type** data_;
-
-            void init_()
-            {
-                data_ = new value_type*[bucket_capacity_];
-
-                for (size_type i = front_bucket_; i <= back_bucket_; ++i)
-                    data_[i] = allocator_.allocate(bucket_size_);
-            }
-
-            void prepare_for_size_(size_type size)
-            {
-                if (data_)
-                    fini_();
-
-                bucket_count_ = bucket_capacity_ = size / bucket_size_ + 2;
-
-                front_bucket_ = 0;
-                back_bucket_ = bucket_capacity_ - 1;
-
-                front_bucket_idx_ = bucket_size_;
-                back_bucket_idx_ = size % bucket_size_;
-            }
-
-            template<class Iterator>
-            void copy_from_range_(Iterator first, Iterator last)
-            {
-                size_ = distance(first, last);
-                prepare_for_size_(size_);
-                init_();
-
-                auto it = begin();
-                while (first != last)
-                    *it++ = *first++;
-            }
-
-            void ensure_space_front_(size_type idx, size_type count)
-            {
-                auto free_space = bucket_size_ - elements_in_front_bucket_();
-                if (front_bucket_idx_ == 0)
-                    free_space = 0;
-
-                if (count <= free_space)
-                {
-                    front_bucket_idx_ -= count;
-                    return;
-                }
-
-                count -= free_space;
-
-                auto buckets_needed = count / bucket_size_;
-                if (count % bucket_size_ != 0)
-                    ++buckets_needed;
-
-                for (size_type i = size_type{}; i < buckets_needed; ++i)
-                    add_new_bucket_front_();
-
-                front_bucket_idx_ = bucket_size_ - (count % bucket_size_);
-            }
-
-            void ensure_space_back_(size_type idx, size_type count)
-            {
-                auto free_space = bucket_size_ - back_bucket_idx_;
-                if (count < free_space)
-                    return;
-
-                count -= free_space;
-                auto buckets_needed = count / bucket_size_;
-                if (count % bucket_size_ != 0)
-                    ++buckets_needed;
-
-                for (size_type i = size_type{}; i < buckets_needed; ++i)
-                    add_new_bucket_back_();
-
-                back_bucket_idx_ = (back_bucket_idx_ + count) % bucket_size_;
-            }
-
-            void shift_right_(size_type idx, size_type count)
-            {
-                ensure_space_back_(idx, count);
-
-                iterator it{*this, idx};
-                copy_backward(it, end(), end() + count - 1);
-
-            }
-
-            void shift_left_(size_type idx, size_type count)
-            {
-                ensure_space_front_(idx, count);
-
-                copy(
-                    iterator{*this, count},
-                    iterator{*this, idx + count - 1},
-                    iterator{*this, 0}
-                );
-            }
-
-            void fini_()
-            {
-                for (size_type i = front_bucket_; i <= back_bucket_; ++i)
-                    allocator_.deallocate(data_[i], bucket_size_);
-
-                delete[] data_;
-                data_ = nullptr;
-            }
-
-            bool has_bucket_space_back_() const
-            {
-                return back_bucket_ < bucket_capacity_ - 1;
-            }
-
-            bool has_bucket_space_front_() const
-            {
-                return front_bucket_ > 0;
-            }
-
-            void add_new_bucket_back_()
-            {
-                if (!has_bucket_space_back_())
-                    expand_();
-
-                ++back_bucket_;
-                ++bucket_count_;
-                data_[back_bucket_] = allocator_.allocate(bucket_size_);
-                back_bucket_idx_ = size_type{};
-            }
-
-            void add_new_bucket_front_()
-            {
-                if (!has_bucket_space_front_())
-                    expand_();
-
-                --front_bucket_;
-                ++bucket_count_;
-                data_[front_bucket_] = allocator_.allocate(bucket_size_);
-                front_bucket_idx_ = bucket_size_;
-            }
-
-            void expand_()
-            {
-                bucket_capacity_ *= 2;
-                value_type** new_data = new value_type*[bucket_capacity_];
-
-                /**
-                 * Note: This currently expands both sides whenever one reaches
-                 *       its limit. Might be better to expand only one (or both when
-                 *       the other is near its limit)?
-                 */
-                size_type new_front = bucket_capacity_ / 4;
-                size_type new_back = new_front + bucket_count_ - 1;
-
-                for (size_type i = new_front, j = front_bucket_; i <= new_back; ++i, ++j)
-                    new_data[i] = move(data_[j]);
-                std::swap(data_, new_data);
-
-                delete[] new_data;
-                front_bucket_ = new_front;
-                back_bucket_ = new_back;
-            }
-
-            size_type get_bucket_index_(size_type idx) const
-            {
-                if (idx < elements_in_front_bucket_())
-                    return front_bucket_;
-
-                idx -= elements_in_front_bucket_();
-                return idx / bucket_size_ + front_bucket_ + 1;
-            }
-
-            size_type get_element_index_(size_type idx) const
-            {
-                if (idx < elements_in_front_bucket_())
-                    return bucket_size_ - elements_in_front_bucket_() + idx;
-
-                idx -= elements_in_front_bucket_();
-                return idx % bucket_size_;
-            }
-
-            size_type elements_in_front_bucket_() const
-            {
-                return bucket_size_ - front_bucket_idx_;
-            }
-    };
-
-    template<class T, class Allocator>
-    bool operator==(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        if (lhs.size() != rhs.size())
-            return false;
-
-        for (decltype(lhs.size()) i = 0; i < lhs.size(); ++i)
-        {
-            if (lhs[i] != rhs[i])
-                return false;
-        }
-
-        return true;
-    }
-
-    template<class T, class Allocator>
-    bool operator<(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        auto min_size = min(lhs.size(), rhs.size());
-        for (decltype(lhs.size()) i = 0; i < min_size; ++i)
-        {
-            if (lhs[i] >= rhs[i])
-                return false;
-        }
-
-        if (lhs.size() == rhs.size())
-            return true;
-        else
-            return lhs.size() < rhs.size();
-    }
-
-    template<class T, class Allocator>
-    bool operator!=(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class T, class Allocator>
-    bool operator>(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class T, class Allocator>
-    bool operator<=(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class T, class Allocator>
-    bool operator>=(const deque<T, Allocator>& lhs, const deque<T, Allocator>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    /**
-     * 23.3.3.5, deque specialized algorithms:
-     */
-
-    template<class T, class Allocator>
-    void swap(deque<T, Allocator>& lhs, deque<T, Allocator>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/forward_list.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/forward_list.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_FORWARD_LIST
-#define LIBCPP_BITS_ADT_FORWARD_LIST
-
-#error "<forward_list> is not implemented"
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/hash_table.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/hash_table.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,601 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_HASH_TABLE
-#define LIBCPP_BITS_ADT_HASH_TABLE
-
-#include <__bits/adt/list_node.hpp>
-#include <__bits/adt/key_extractors.hpp>
-#include <__bits/adt/hash_table_iterators.hpp>
-#include <__bits/adt/hash_table_policies.hpp>
-#include <cstdlib>
-#include <iterator>
-#include <limits>
-#include <memory>
-#include <tuple>
-#include <utility>
-
-namespace std::aux
-{
-    /**
-     * To save code, we're going to implement one hash table
-     * for both unordered_map and unordered_set. To do this,
-     * we create one inner hash table that is oblivious to its
-     * held type (and uses a key extractor to get the key from it)
-     * and two proxies that either use plain Key type or a pair
-     * of a key and a value.
-     * Additionally, we will use policies to represent both single
-     * and multi variants of these containers at once.
-     * Note: I am aware the naming is very unimaginative here,
-     *       not my strong side :)
-     */
-
-    template<
-        class Value, class Key, class KeyExtractor,
-        class Hasher, class KeyEq,
-        class Alloc, class Size,
-        class Iterator, class ConstIterator,
-        class LocalIterator, class ConstLocalIterator,
-        class Policy
-    >
-    class hash_table
-    {
-        public:
-            using value_type     = Value;
-            using key_type       = Key;
-            using size_type      = Size;
-            using allocator_type = Alloc;
-            using key_equal      = KeyEq;
-            using hasher         = Hasher;
-            using key_extract    = KeyExtractor;
-
-            using iterator             = Iterator;
-            using const_iterator       = ConstIterator;
-            using local_iterator       = LocalIterator;
-            using const_local_iterator = ConstLocalIterator;
-
-            using node_type = list_node<value_type>;
-
-            using place_type = tuple<
-                hash_table_bucket<value_type, size_type>*,
-                list_node<value_type>*, size_type
-            >;
-
-            hash_table(size_type buckets, float max_load_factor = 1.f)
-                : table_{new hash_table_bucket<value_type, size_type>[buckets]()},
-                  bucket_count_{buckets}, size_{}, hasher_{}, key_eq_{},
-                  key_extractor_{}, max_load_factor_{max_load_factor}
-            { /* DUMMY BODY */ }
-
-            hash_table(size_type buckets, const hasher& hf, const key_equal& eql,
-                       float max_load_factor = 1.f)
-                : table_{new hash_table_bucket<value_type, size_type>[buckets]()},
-                  bucket_count_{buckets}, size_{}, hasher_{hf}, key_eq_{eql},
-                  key_extractor_{}, max_load_factor_{max_load_factor}
-            { /* DUMMY BODY */ }
-
-            hash_table(const hash_table& other)
-                : hash_table{other.bucket_count_, other.hasher_, other.key_eq_,
-                             other.max_load_factor_}
-            {
-                for (const auto& x: other)
-                    insert(x);
-            }
-
-            hash_table(hash_table&& other)
-                : table_{other.table_}, bucket_count_{other.bucket_count_},
-                  size_{other.size_}, hasher_{move(other.hasher_)},
-                  key_eq_{move(other.key_eq_)}, key_extractor_{move(other.key_extractor_)},
-                  max_load_factor_{other.max_load_factor_}
-            {
-                other.table_ = nullptr;
-                other.bucket_count_ = size_type{};
-                other.size_ = size_type{};
-                other.max_load_factor_ = 1.f;
-            }
-
-            hash_table& operator=(const hash_table& other)
-            {
-                hash_table tmp{other};
-                tmp.swap(*this);
-
-                return *this;
-            }
-
-            hash_table& operator=(hash_table&& other)
-            {
-                hash_table tmp{move(other)};
-                tmp.swap(*this);
-
-                return *this;
-            }
-
-            bool empty() const noexcept
-            {
-                return size_ == 0;
-            }
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type max_size(allocator_type& alloc)
-            {
-                return allocator_traits<allocator_type>::max_size(alloc);
-            }
-
-            iterator begin() noexcept
-            {
-                auto idx = first_filled_bucket_();
-                return iterator{
-                    table_, idx, bucket_count_,
-                    table_[idx].head
-                };
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return cbegin();
-            }
-
-            iterator end() noexcept
-            {
-                return iterator{};
-            }
-
-            const_iterator end() const noexcept
-            {
-                return cend();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                auto idx = first_filled_bucket_();
-                return const_iterator{
-                    table_, idx, bucket_count_,
-                    table_[idx].head
-                };
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return const_iterator{};
-            }
-
-            template<class... Args>
-            auto emplace(Args&&... args)
-            {
-                return Policy::emplace(*this, forward<Args>(args)...);
-            }
-
-            auto insert(const value_type& val)
-            {
-                return Policy::insert(*this, val);
-            }
-
-            auto insert(value_type&& val)
-            {
-                return Policy::insert(*this, forward<value_type>(val));
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return Policy::erase(*this, key);
-            }
-
-            iterator erase(const_iterator it)
-            {
-                if (it == cend())
-                    return end();
-
-                auto node = it.node();
-                auto idx = it.idx();
-
-                /**
-                 * Note: This way we will continue on the next bucket
-                 *       if this is the last element in its bucket.
-                 */
-                iterator res{table_, idx, size_, node};
-                ++res;
-
-                if (table_[idx].head == node)
-                {
-                    if (node->next != node)
-                        table_[idx].head = node->next;
-                    else
-                        table_[idx].head = nullptr;
-                }
-                --size_;
-
-                node->unlink();
-                delete node;
-
-                if (empty())
-                    return end();
-                else
-                    return res;
-            }
-
-            void clear() noexcept
-            {
-                for (size_type i = 0; i < bucket_count_; ++i)
-                    table_[i].clear();
-                size_ = size_type{};
-            }
-
-            void swap(hash_table& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<Hasher&>(), declval<Hasher&>())) &&
-                         noexcept(std::swap(declval<KeyEq&>(), declval<KeyEq&>())))
-            {
-                std::swap(table_, other.table_);
-                std::swap(bucket_count_, other.bucket_count_);
-                std::swap(size_, other.size_);
-                std::swap(hasher_, other.hasher_);
-                std::swap(key_eq_, other.key_eq_);
-                std::swap(max_load_factor_, other.max_load_factor_);
-            }
-
-            hasher hash_function() const
-            {
-                return hasher_;
-            }
-
-            key_equal key_eq() const
-            {
-                return key_eq_;
-            }
-
-            iterator find(const key_type& key)
-            {
-                auto idx = get_bucket_idx_(key);
-                auto head = table_[idx].head;
-
-                if (!head)
-                    return end();
-
-                auto current = head;
-                do
-                {
-                    if (key_eq_(key, key_extractor_(current->value)))
-                        return iterator{table_, idx, size_, current};
-                    current = current->next;
-                }
-                while (current && current != head);
-
-                return end();
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                auto idx = get_bucket_idx_(key);
-                auto head = table_[idx].head;
-
-                if (!head)
-                    return end();
-
-                auto current = head;
-                do
-                {
-                    if (key_eq_(key, key_extractor_(current->value)))
-                        return iterator{table_, idx, size_, current};
-                    current = current->next;
-                }
-                while (current != head);
-
-                return end();
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return Policy::count(*this, key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return Policy::equal_range(*this, key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return Policy::equal_range_const(*this, key);
-            }
-
-            size_type bucket_count() const noexcept
-            {
-                return bucket_count_;
-            }
-
-            size_type max_bucket_count() const noexcept
-            {
-                return numeric_limits<size_type>::max() /
-                       sizeof(hash_table_bucket<value_type, size_type>);
-            }
-
-            size_type bucket_size(size_type n) const
-            {
-                return table_[n].size();
-            }
-
-            size_type bucket(const key_type& key) const
-            {
-                return get_bucket_idx_(key);
-            }
-
-            local_iterator begin(size_type n)
-            {
-                return local_iterator{table_[n].head, table_[n].head};
-            }
-
-            const_local_iterator begin(size_type n) const
-            {
-                return cbegin(n);
-            }
-
-            local_iterator end(size_type n)
-            {
-                return local_iterator{};
-            }
-
-            const_local_iterator end(size_type n) const
-            {
-                return cend(n);
-            }
-
-            const_local_iterator cbegin(size_type n) const
-            {
-                return const_local_iterator{table_[n].head, table_[n].head};
-            }
-
-            const_local_iterator cend(size_type n) const
-            {
-                return const_local_iterator{};
-            }
-
-            float load_factor() const noexcept
-            {
-                return size_ / static_cast<float>(bucket_count_);
-            }
-
-            float max_load_factor() const noexcept
-            {
-                return max_load_factor_;
-            }
-
-            void max_load_factor(float factor)
-            {
-                if (factor > 0.f)
-                    max_load_factor_ = factor;
-
-                rehash_if_needed();
-            }
-
-            void rehash(size_type count)
-            {
-                if (count < size_ / max_load_factor_)
-                    count = size_ / max_load_factor_;
-
-                /**
-                 * Note: If an exception is thrown, there
-                 *       is no effect. Since this is the only
-                 *       place where an exception (no mem) can
-                 *       be thrown and no changes to this have been
-                 *       made, we're ok.
-                 */
-                hash_table new_table{count, max_load_factor_};
-
-                for (std::size_t i = 0; i < bucket_count_; ++i)
-                {
-                    auto head = table_[i].head;
-                    if (!head)
-                        continue;
-
-                    auto current = head;
-
-                    do
-                    {
-                        auto next = current->next;
-
-                        current->next = current;
-                        current->prev = current;
-
-                        auto where = Policy::find_insertion_spot(
-                            new_table, key_extractor_(current->value)
-                        );
-
-                        /**
-                         * Note: We're rehashing, so we know each
-                         *       key can be inserted.
-                         */
-                        auto new_bucket = get<0>(where);
-                        auto new_successor = get<1>(where);
-
-                        if (new_successor)
-                            new_successor->append(current);
-                        else
-                            new_bucket->append(current);
-
-                        current = next;
-                    } while (current != head);
-
-                    table_[i].head = nullptr;
-                }
-
-                new_table.size_ = size_;
-                swap(new_table);
-
-                delete[] new_table.table_;
-                new_table.table_ = nullptr;
-            }
-
-            void reserve(size_type count)
-            {
-                rehash(count / max_load_factor_ + 1);
-            }
-
-            bool is_eq_to(const hash_table& other) const
-            {
-                if (size() != other.size())
-                    return false;
-
-                auto it = begin();
-                while (it != end())
-                {
-                    /**
-                     * For each key K we will check how many
-                     * instances of K are there in the table.
-                     * Then we will check if the count for K
-                     * is equal to that amount.
-                     */
-
-                    size_type cnt{};
-                    auto tmp = it;
-
-                    while (key_eq_(key_extractor_(*it), key_extractor_(*tmp)))
-                    {
-                        ++cnt;
-                        if (++tmp == end())
-                            break;
-                    }
-
-                    auto other_cnt = other.count(key_extractor_(*it));
-                    if (cnt != other_cnt)
-                        return false;
-
-                    it = tmp; // tmp  is one past *it's key.
-                }
-
-                return true;
-            }
-
-            ~hash_table()
-            {
-                // Lists are deleted in ~hash_table_bucket.
-                if (table_)
-                    delete[] table_;
-            }
-
-            place_type find_insertion_spot(const key_type& key) const
-            {
-                return Policy::find_insertion_spot(*this, key);
-            }
-
-            place_type find_insertion_spot(key_type&& key) const
-            {
-                return Policy::find_insertion_spot(*this, key);
-            }
-
-            const key_type& get_key(const value_type& val) const
-            {
-                return key_extractor_(val);
-            }
-
-            bool keys_equal(const key_type& key, const value_type& val)
-            {
-                return key_eq_(key, key_extractor_(val));
-            }
-
-            bool keys_equal(const key_type& key, const value_type& val) const
-            {
-                return key_eq_(key, key_extractor_(val));
-            }
-
-            hash_table_bucket<value_type, size_type>* table()
-            {
-                return table_;
-            }
-
-            hash_table_bucket<value_type, size_type>* head(size_type idx)
-            {
-                if (idx < bucket_count_)
-                    return table_[idx]->head;
-                else
-                    return nullptr;
-            }
-
-            void rehash_if_needed()
-            {
-                if (size_ > max_load_factor_ * bucket_count_)
-                    rehash(bucket_count_ * bucket_count_growth_factor_);
-            }
-
-            void increment_size()
-            {
-                ++size_;
-
-                rehash_if_needed();
-            }
-
-            void decrement_size()
-            {
-                --size_;
-            }
-
-        private:
-            hash_table_bucket<value_type, size_type>* table_;
-            size_type bucket_count_;
-            size_type size_;
-            hasher hasher_;
-            key_equal key_eq_;
-            key_extract key_extractor_;
-            float max_load_factor_;
-
-            static constexpr float bucket_count_growth_factor_{1.25};
-
-            size_type get_bucket_idx_(const key_type& key) const
-            {
-                return hasher_(key) % bucket_count_;
-            }
-
-            size_type first_filled_bucket_() const
-            {
-                size_type res{};
-                while (res < bucket_count_)
-                {
-                    if (table_[res].head)
-                        return res;
-                    ++res;
-                }
-
-                /**
-                 * Note: This is used for iterators,
-                 *       so we need to return a valid index.
-                 *       But since table_[0].head is nullptr
-                 *       we know that if we return 0 the
-                 *       created iterator will test as equal
-                 *       to end().
-                 */
-                return 0;
-            }
-
-            friend Policy;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/hash_table_bucket.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/hash_table_bucket.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_HASH_TABLE_BUCKET
-#define LIBCPP_BITS_ADT_HASH_TABLE_BUCKET
-
-#include <__bits/adt/list_node.hpp>
-
-namespace std::aux
-{
-    template<class Value, class Size>
-    struct hash_table_bucket
-    {
-        /**
-         * Note: We use a doubly linked list because
-         *       we need to use hints, which point to the
-         *       element after the hinted spot.
-         */
-
-        list_node<Value>* head;
-
-        hash_table_bucket()
-            : head{}
-        { /* DUMMY BODY */ }
-
-        Size size() const noexcept
-        {
-            auto current = head;
-            Size res{};
-
-            do
-            {
-                ++res;
-                current = current->next;
-            }
-            while (current != head);
-
-            return res;
-        }
-
-        void append(list_node<Value>* node)
-        {
-            if (!head)
-                head = node;
-            else
-                head->append(node);
-        }
-
-        void prepend(list_node<Value>* node)
-        {
-            if (!head)
-                head = node;
-            else
-                head->prepend(node);
-        }
-
-        void clear()
-        {
-            if (!head)
-                return;
-
-            auto current = head;
-            do
-            {
-                auto tmp = current;
-                current = current->next;
-                delete tmp;
-            }
-            while (current && current != head);
-
-            head = nullptr;
-        }
-
-        ~hash_table_bucket()
-        {
-            clear();
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/hash_table_iterators.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/hash_table_iterators.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,485 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_HASH_TABLE_ITERATORS
-#define LIBCPP_BITS_ADT_HASH_TABLE_ITERATORS
-
-#include <__bits/adt/list_node.hpp>
-#include <__bits/adt/hash_table_bucket.hpp>
-#include <__bits/iterator_helpers.hpp>
-#include <iterator>
-
-namespace std::aux
-{
-    template<class Value, class Reference, class Pointer, class Size>
-    class hash_table_iterator
-    {
-        public:
-            using value_type      = Value;
-            using size_type       = Size;
-            using reference       = Reference;
-            using pointer         = Pointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = forward_iterator_tag;
-
-            hash_table_iterator(hash_table_bucket<value_type, size_type>* table = nullptr,
-                                size_type idx = size_type{}, size_type max_idx = size_type{},
-                                list_node<value_type>* current = nullptr)
-                : table_{table}, idx_{idx}, max_idx_{max_idx}, current_{current}
-            { /* DUMMY BODY */ }
-
-            hash_table_iterator(const hash_table_iterator&) = default;
-            hash_table_iterator& operator=(const hash_table_iterator&) = default;
-
-            reference operator*()
-            {
-                return current_->value;
-            }
-
-            pointer operator->()
-            {
-                return &current_->value;
-            }
-
-            hash_table_iterator& operator++()
-            {
-                current_ = current_->next;
-                if (current_ == table_[idx_].head)
-                {
-                    if (idx_ < max_idx_)
-                    {
-                        while (!table_[++idx_].head && idx_ < max_idx_)
-                        { /* DUMMY BODY */ }
-
-                        if (idx_ < max_idx_)
-                            current_ = table_[idx_].head;
-                        else
-                            current_ = nullptr;
-                    }
-                    else
-                        current_ = nullptr;
-                }
-
-                return *this;
-            }
-
-            hash_table_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-            list_node<value_type>* node()
-            {
-                return current_;
-            }
-
-            const list_node<value_type>* node() const
-            {
-                return current_;
-            }
-
-            size_type idx() const
-            {
-                return idx_;
-            }
-
-        private:
-            hash_table_bucket<value_type, size_type>* table_;
-            size_type idx_;
-            size_type max_idx_;
-            list_node<value_type>* current_;
-
-            template<class V, class CR, class CP, class S>
-            friend class hash_table_const_iterator;
-    };
-
-    template<class Value, class Ref, class Ptr, class Size>
-    bool operator==(const hash_table_iterator<Value, Ref, Ptr, Size>& lhs,
-                    const hash_table_iterator<Value, Ref, Ptr, Size>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class Ref, class Ptr, class Size>
-    bool operator!=(const hash_table_iterator<Value, Ref, Ptr, Size>& lhs,
-                    const hash_table_iterator<Value, Ref, Ptr, Size>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class ConstReference, class ConstPointer, class Size>
-    class hash_table_const_iterator
-    {
-        using non_const_iterator_type = hash_table_iterator<
-            Value, get_non_const_ref_t<ConstReference>,
-            get_non_const_ptr_t<ConstPointer>, Size
-        >;
-
-        public:
-            using value_type      = Value;
-            using size_type       = Size;
-            using const_reference = ConstReference;
-            using const_pointer   = ConstPointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = forward_iterator_tag;
-
-            hash_table_const_iterator(const hash_table_bucket<value_type, size_type>* table = nullptr,
-                                      size_type idx = size_type{}, size_type max_idx = size_type{},
-                                      const list_node<value_type>* current = nullptr)
-                : table_{table}, idx_{idx}, max_idx_{max_idx}, current_{current}
-            { /* DUMMY BODY */ }
-
-            hash_table_const_iterator(const hash_table_const_iterator&) = default;
-            hash_table_const_iterator& operator=(const hash_table_const_iterator&) = default;
-
-            hash_table_const_iterator(const non_const_iterator_type& other)
-                : table_{other.table_}, idx_{other.idx_}, max_idx_{other.max_idx_},
-                  current_{other.current_}
-            { /* DUMMY BODY */ }
-
-            hash_table_const_iterator& operator=(const non_const_iterator_type& other)
-            {
-                table_ = other.table_;
-                idx_ = other.idx_;
-                max_idx_ = other.max_idx_;
-                current_ = other.current_;
-
-                return *this;
-            }
-
-            const_reference operator*() const
-            {
-                return current_->value;
-            }
-
-            const_pointer operator->() const
-            {
-                return &current_->value;
-            }
-
-            hash_table_const_iterator& operator++()
-            {
-                current_ = current_->next;
-                if (current_ == table_[idx_].head)
-                {
-                    if (idx_ < max_idx_)
-                    {
-                        while (!table_[++idx_].head && idx_ < max_idx_)
-                        { /* DUMMY BODY */ }
-
-                        if (idx_ < max_idx_)
-                            current_ = table_[idx_].head;
-                        else
-                            current_ = nullptr;
-                    }
-                    else
-                        current_ = nullptr;
-                }
-
-                return *this;
-            }
-
-            hash_table_const_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-            list_node<value_type>* node()
-            {
-                return const_cast<list_node<value_type>*>(current_);
-            }
-
-            const list_node<value_type>* node() const
-            {
-                return current_;
-            }
-
-            size_type idx() const
-            {
-                return idx_;
-            }
-
-        private:
-            const hash_table_bucket<value_type, size_type>* table_;
-            size_type idx_;
-            size_type max_idx_;
-            const list_node<value_type>* current_;
-    };
-
-    template<class Value, class CRef, class CPtr, class Size>
-    bool operator==(const hash_table_const_iterator<Value, CRef, CPtr, Size>& lhs,
-                    const hash_table_const_iterator<Value, CRef, CPtr, Size>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class CRef, class CPtr, class Size>
-    bool operator!=(const hash_table_const_iterator<Value, CRef, CPtr, Size>& lhs,
-                    const hash_table_const_iterator<Value, CRef, CPtr, Size>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class Ref, class Ptr, class CRef, class CPtr, class Size>
-    bool operator==(const hash_table_iterator<Value, Ref, Ptr, Size>& lhs,
-                    const hash_table_const_iterator<Value, CRef, CPtr, Size>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class Ref, class Ptr, class CRef, class CPtr, class Size>
-    bool operator!=(const hash_table_iterator<Value, Ref, Ptr, Size>& lhs,
-                    const hash_table_const_iterator<Value, CRef, CPtr, Size>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class CRef, class CPtr, class Ref, class Ptr, class Size>
-    bool operator==(const hash_table_const_iterator<Value, CRef, CPtr, Size>& lhs,
-                    const hash_table_iterator<Value, Ref, Ptr, Size>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class CRef, class CPtr, class Ref, class Ptr, class Size>
-    bool operator!=(const hash_table_const_iterator<Value, CRef, CPtr, Size>& lhs,
-                    const hash_table_iterator<Value, Ref, Ptr, Size>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class Reference, class Pointer>
-    class hash_table_local_iterator
-    {
-        public:
-            using value_type      = Value;
-            using reference       = Reference;
-            using pointer         = Pointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = forward_iterator_tag;
-
-            hash_table_local_iterator(list_node<value_type>* head = nullptr,
-                                      list_node<value_type>* current = nullptr)
-                : head_{head}, current_{current}
-            { /* DUMMY BODY */ }
-
-            hash_table_local_iterator(const hash_table_local_iterator&) = default;
-            hash_table_local_iterator& operator=(const hash_table_local_iterator&) = default;
-
-            reference operator*()
-            {
-                return current_->value;
-            }
-
-            pointer operator->()
-            {
-                return &current_->value;
-            }
-
-            hash_table_local_iterator& operator++()
-            {
-                current_ = current_->next;
-                if (current_ == head_)
-                    current_ = nullptr;
-
-                return *this;
-            }
-
-            hash_table_local_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-            list_node<value_type>* node()
-            {
-                return current_;
-            }
-
-            const list_node<value_type>* node() const
-            {
-                return current_;
-            }
-
-        private:
-            list_node<value_type>* head_;
-            list_node<value_type>* current_;
-
-            template<class V, class CR, class CP>
-            friend class hash_table_const_local_iterator;
-    };
-
-    template<class Value, class Ref, class Ptr>
-    bool operator==(const hash_table_local_iterator<Value, Ref, Ptr>& lhs,
-                    const hash_table_local_iterator<Value, Ref, Ptr>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class Ref, class Ptr>
-    bool operator!=(const hash_table_local_iterator<Value, Ref, Ptr>& lhs,
-                    const hash_table_local_iterator<Value, Ref, Ptr>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class ConstReference, class ConstPointer>
-    class hash_table_const_local_iterator
-    {
-        using non_const_iterator_type = hash_table_local_iterator<
-            Value, get_non_const_ref_t<ConstReference>,
-            get_non_const_ptr_t<ConstPointer>
-        >;
-
-        public:
-            using value_type      = Value;
-            using const_reference = ConstReference;
-            using const_pointer   = ConstPointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = forward_iterator_tag;
-
-            // TODO: requirement for forward iterator is default constructibility, fix others!
-            hash_table_const_local_iterator(const list_node<value_type>* head = nullptr,
-                                            const list_node<value_type>* current = nullptr)
-                : head_{head}, current_{current}
-            { /* DUMMY BODY */ }
-
-            hash_table_const_local_iterator(const hash_table_const_local_iterator&) = default;
-            hash_table_const_local_iterator& operator=(const hash_table_const_local_iterator&) = default;
-
-            hash_table_const_local_iterator(const non_const_iterator_type& other)
-                : head_{other.head_}, current_{other.current_}
-            { /* DUMMY BODY */ }
-
-            hash_table_const_local_iterator& operator=(const non_const_iterator_type& other)
-            {
-                head_ = other.head_;
-                current_ = other.current_;
-
-                return *this;
-            }
-
-            const_reference operator*() const
-            {
-                return current_->value;
-            }
-
-            const_pointer operator->() const
-            {
-                return &current_->value;
-            }
-
-            hash_table_const_local_iterator& operator++()
-            {
-                current_ = current_->next;
-                if (current_ == head_)
-                    current_ = nullptr;
-
-                return *this;
-            }
-
-            hash_table_const_local_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-
-            list_node<value_type>* node()
-            {
-                return const_cast<list_node<value_type>*>(current_);
-            }
-
-            const list_node<value_type>* node() const
-            {
-                return current_;
-            }
-
-        private:
-            const list_node<value_type>* head_;
-            const list_node<value_type>* current_;
-    };
-
-    template<class Value, class CRef, class CPtr>
-    bool operator==(const hash_table_const_local_iterator<Value, CRef, CPtr>& lhs,
-                    const hash_table_const_local_iterator<Value, CRef, CPtr>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class CRef, class CPtr>
-    bool operator!=(const hash_table_const_local_iterator<Value, CRef, CPtr>& lhs,
-                    const hash_table_const_local_iterator<Value, CRef, CPtr>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class Ref, class Ptr, class CRef, class CPtr>
-    bool operator==(const hash_table_local_iterator<Value, Ref, Ptr>& lhs,
-                    const hash_table_const_local_iterator<Value, CRef, CPtr>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class Ref, class Ptr, class CRef, class CPtr>
-    bool operator!=(const hash_table_local_iterator<Value, Ref, Ptr>& lhs,
-                    const hash_table_const_local_iterator<Value, CRef, CPtr>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class CRef, class CPtr, class Ref, class Ptr>
-    bool operator==(const hash_table_const_local_iterator<Value, CRef, CPtr>& lhs,
-                    const hash_table_local_iterator<Value, Ref, Ptr>& rhs)
-    {
-        return lhs.node() == rhs.node();
-    }
-
-    template<class Value, class CRef, class CPtr, class Ref, class Ptr>
-    bool operator!=(const hash_table_const_local_iterator<Value, CRef, CPtr>& lhs,
-                    const hash_table_local_iterator<Value, Ref, Ptr>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/hash_table_policies.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/hash_table_policies.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,464 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_HASH_TABLE_POLICIES
-#define LIBCPP_BITS_ADT_HASH_TABLE_POLICIES
-
-#include <tuple>
-#include <utility>
-
-namespace std::aux
-{
-    struct hash_single_policy
-    {
-        template<class Table, class Key>
-        static typename Table::size_type count(const Table& table, const Key& key)
-        {
-            return table.find(key) == table.end() ? 0 : 1;
-        }
-
-        template<class Table, class Key>
-        static typename Table::place_type find_insertion_spot(const Table& table, const Key& key)
-        {
-            auto idx = table.get_bucket_idx_(key);
-            auto head = table.table_[idx].head;
-
-            if (head)
-            { // Check if the key is present.
-                auto current = head;
-                do
-                {
-                    if (table.keys_equal(key, current->value))
-                    {
-                        return make_tuple(
-                            &table.table_[idx],
-                            current,
-                            idx
-                        );
-                    }
-
-                    current = current->next;
-                } while (current && current != head);
-            }
-
-            return make_tuple(
-                &table.table_[idx],
-                table.table_[idx].head,
-                idx
-            );
-        }
-
-        template<class Table, class Key>
-        static typename Table::size_type erase(Table& table, const Key& key)
-        {
-            auto idx = table.get_bucket_idx_(key);
-            auto head = table.table_[idx].head;
-            auto current = head;
-
-            if (!current)
-                return 0;
-
-            do
-            {
-                if (table.keys_equal(key, current->value))
-                {
-                    --table.size_;
-
-                    if (current == head)
-                    {
-                        if (current->next != head)
-                            table.table_[idx].head = current->next;
-                        else
-                            table.table_[idx].head = nullptr;
-                    }
-
-                    current->unlink();
-                    delete current;
-
-                    return 1;
-                }
-                else
-                    current = current->next;
-            }
-            while (current && current != head);
-
-            return 0;
-        }
-
-        template<class Table, class Key>
-        static pair<
-            typename Table::iterator,
-            typename Table::iterator
-        > equal_range(Table& table, const Key& key)
-        {
-            auto it = table.find(key);
-            return make_pair(it, ++it);
-        }
-
-        template<class Table, class Key>
-        static pair<
-            typename Table::const_iterator,
-            typename Table::const_iterator
-        > equal_range_const(const Table& table, const Key& key)
-        { // Note: We cannot overload by return type, so we use a different name.
-            auto it = table.find(key);
-            return make_pair(it, ++it);
-        }
-
-        /**
-         * Note: We have to duplicate code for emplace, insert(const&)
-         *       and insert(&&) here, because the node (which makes distinction
-         *       between the arguments) is only created if the value isn't
-         *       in the table already.
-         */
-
-        template<class Table, class... Args>
-        static pair<
-            typename Table::iterator, bool
-        > emplace(Table& table, Args&&... args)
-        {
-            using value_type = typename Table::value_type;
-            using node_type  = typename Table::node_type;
-            using iterator   = typename Table::iterator;
-
-            table.increment_size();
-
-            auto val = value_type{forward<Args>(args)...};
-            const auto& key = table.get_key(val);
-            auto [bucket, target, idx] = table.find_insertion_spot(key);
-
-            if (!bucket)
-                return make_pair(table.end(), false);
-
-            if (target && table.keys_equal(key, target->value))
-            {
-                table.decrement_size();
-
-                return make_pair(
-                    iterator{
-                        table.table(), idx, table.bucket_count(),
-                        target
-                    },
-                    false
-                );
-            }
-            else
-            {
-                auto node = new node_type{move(val)};
-                bucket->prepend(node);
-
-                return make_pair(iterator{
-                    table.table(), idx,
-                    table.bucket_count(),
-                    node
-                }, true);
-            }
-        }
-
-        template<class Table, class Value>
-        static pair<
-            typename Table::iterator, bool
-        > insert(Table& table, const Value& val)
-        {
-            using node_type  = typename Table::node_type;
-            using iterator   = typename Table::iterator;
-
-            table.increment_size();
-
-            const auto& key = table.get_key(val);
-            auto [bucket, target, idx] = table.find_insertion_spot(key);
-
-            if (!bucket)
-                return make_pair(table.end(), false);
-
-            if (target && table.keys_equal(key, target->value))
-            {
-                table.decrement_size();
-
-                return make_pair(
-                    iterator{
-                        table.table(), idx, table.bucket_count(),
-                        target
-                    },
-                    false
-                );
-            }
-            else
-            {
-                auto node = new node_type{val};
-                bucket->prepend(node);
-
-                return make_pair(iterator{
-                    table.table(), idx,
-                    table.bucket_count(),
-                    node
-                }, true);
-            }
-        }
-
-        template<class Table, class Value>
-        static pair<
-            typename Table::iterator, bool
-        > insert(Table& table, Value&& val)
-        {
-            using value_type = typename Table::value_type;
-            using node_type  = typename Table::node_type;
-            using iterator   = typename Table::iterator;
-
-            table.increment_size();
-
-            const auto& key = table.get_key(val);
-            auto [bucket, target, idx] = table.find_insertion_spot(key);
-
-            if (!bucket)
-                return make_pair(table.end(), false);
-
-            if (target && table.keys_equal(key, target->value))
-            {
-                table.decrement_size();
-
-                return make_pair(
-                    iterator{
-                        table.table(), idx, table.bucket_count(),
-                        target
-                    },
-                    false
-                );
-            }
-            else
-            {
-                auto node = new node_type{forward<value_type>(val)};
-                bucket->prepend(node);
-
-                return make_pair(iterator{
-                    table.table(), idx,
-                    table.bucket_count(),
-                    node
-                }, true);
-            }
-        }
-    };
-
-    struct hash_multi_policy
-    {
-        template<class Table, class Key>
-        static typename Table::size_type count(const Table& table, const Key& key)
-        {
-            auto head = table.table_[table.get_bucket_idx_(key)].head;
-            if (!head)
-                return 0;
-
-            auto current = head;
-            typename Table::size_type res = 0;
-            do
-            {
-                if (table.keys_equal(key, current->value))
-                    ++res;
-
-                current = current->next;
-            }
-            while (current && current != head);
-
-            return res;
-        }
-
-        template<class Table, class Key>
-        static typename Table::place_type find_insertion_spot(const Table& table, const Key& key)
-        {
-            auto idx = table.get_bucket_idx_(key);
-            auto head = table.table_[idx].head;
-
-            if (head)
-            {
-                auto current = head;
-                do
-                {
-                    if (table.keys_equal(key, current->value))
-                    {
-                        return make_tuple(
-                            &table.table_[idx],
-                            current,
-                            idx
-                        );
-                    }
-
-                    current = current->next;
-                } while (current && current != head);
-            }
-
-            return make_tuple(
-                &table.table_[idx],
-                table.table_[idx].head,
-                idx
-            );
-        }
-
-        template<class Table, class Key>
-        static typename Table::size_type erase(Table& table, const Key& key)
-        {
-            auto idx = table.get_bucket_idx_(key);
-            auto head = table.table_[idx].head;
-            auto current = head;
-            table.table_[idx].head = nullptr;
-            decltype(head) last = nullptr;
-
-            if (!current)
-                return 0;
-
-            /**
-             * We traverse the list and delete if the keys
-             * equal, if they don't we append the nodes back
-             * to the bucket.
-             */
-            typename Table::size_type res{};
-
-            do
-            {
-                auto tmp = current;
-                current = current->next;
-                tmp->next = tmp;
-                tmp->prev = tmp;
-
-                if (!table.keys_equal(key, tmp->value))
-                {
-                    if (!last)
-                        table.table_[idx].head = tmp;
-                    else
-                        last->append(tmp);
-                    last = tmp;
-                }
-                else
-                {
-                    --table.size_;
-                    ++res;
-
-                    delete tmp;
-                }
-            }
-            while (current && current != head);
-
-            return res;
-        }
-
-        template<class Table, class Key>
-        static pair<
-            typename Table::iterator,
-            typename Table::iterator
-        > equal_range(Table& table, const Key& key)
-        {
-            auto first = table.find(key);
-            if (first == table.end())
-                return make_pair(table.end(), table.end());
-
-            auto last = first;
-            do
-            {
-                ++last;
-            } while (last != table.end() && table.keys_equal(key, *last));
-
-            return make_pair(first, last);
-        }
-
-        template<class Table, class Key>
-        static pair<
-            typename Table::const_iterator,
-            typename Table::const_iterator
-        > equal_range_const(const Table& table, const Key& key)
-        {
-            auto first = table.find(key);
-            if (first == table.end())
-                return make_pair(table.end(), table.end());
-
-            auto last = first;
-            do
-            {
-                ++last;
-            } while (last != table.end() && table.keys_equal(key, *last));
-
-            return make_pair(first, last);
-        }
-
-        template<class Table, class... Args>
-        static typename Table::iterator emplace(Table& table, Args&&... args)
-        {
-            using node_type  = typename Table::node_type;
-
-            auto node = new node_type{forward<Args>(args)...};
-
-            return insert(table, node);
-        }
-
-        template<class Table, class Value>
-        static typename Table::iterator insert(Table& table, const Value& val)
-        {
-            using node_type  = typename Table::node_type;
-
-            auto node = new node_type{val};
-
-            return insert(table, node);
-        }
-
-        template<class Table, class Value>
-        static typename Table::iterator insert(Table& table, Value&& val)
-        {
-            using value_type = typename Table::value_type;
-            using node_type  = typename Table::node_type;
-
-            auto node = new node_type{forward<value_type>(val)};
-
-            return insert(table, node);
-        }
-
-        template<class Table>
-        static typename Table::iterator insert(Table& table, typename Table::node_type* node)
-        {
-            using iterator   = typename Table::iterator;
-
-            table.increment_size();
-
-            const auto& key = table.get_key(node->value);
-            auto [bucket, target, idx] = table.find_insertion_spot(key);
-
-            if (!bucket)
-                return table.end();
-
-            if (target && table.keys_equal(key, target->value))
-                target->append(node);
-            else
-                bucket->prepend(node);
-
-            return iterator{
-                table.table(), idx,
-                table.bucket_count(),
-                node
-            };
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/initializer_list.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/initializer_list.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_INITIALIZER_LIST
-#define LIBCPP_BITS_ADT_INITIALIZER_LIST
-
-#include <cstdlib>
-
-namespace std
-{
-    /**
-     * 18.9, initializer lists:
-     */
-
-    template<class T>
-    class initializer_list
-    {
-        public:
-            using value_type      = T;
-            using const_reference = const T&;
-            using reference       = const_reference;
-            using size_type       = size_t;
-            using const_iterator  = const T*;
-            using iterator        = const_iterator;
-
-            constexpr initializer_list() noexcept
-                : begin_{nullptr}, size_{0}
-            { /* DUMMY BODY */ }
-
-            constexpr size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            constexpr iterator begin() const noexcept
-            {
-                return begin_;
-            }
-
-            constexpr iterator end() const noexcept
-            {
-                return begin_ + size_;
-            }
-
-        private:
-            iterator begin_;
-            size_type size_;
-
-            constexpr initializer_list(iterator begin, size_type size)
-                : begin_{begin}, size_{size}
-            { /* DUMMY BODY */ }
-    };
-
-    /**
-     * 18.9.3, initializer list range access:
-     */
-
-    template<class T>
-    constexpr auto begin(initializer_list<T> init)
-    {
-        return init.begin();
-    }
-
-    template<class T>
-    constexpr auto end(initializer_list<T> init)
-    {
-        return init.end();
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/key_extractors.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/key_extractors.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_KEY_EXTRACTORS
-#define LIBCPP_BITS_ADT_KEY_EXTRACTORS
-
-#include <utility>
-
-namespace std::aux
-{
-    template<class Key, class Value>
-    struct key_value_key_extractor
-    {
-        const Key& operator()(const pair<const Key, Value>& p) const noexcept
-        {
-            return p.first;
-        }
-    };
-
-    template<class Key>
-    struct key_no_value_key_extractor
-    {
-        Key& operator()(Key& k) const noexcept
-        {
-            return k;
-        }
-
-        const Key& operator()(const Key& k) const noexcept
-        {
-            return k;
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/list.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/list.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1203 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_LIST
-#define LIBCPP_BITS_ADT_LIST
-
-#include <__bits/adt/list_node.hpp>
-#include <__bits/insert_iterator.hpp>
-#include <cassert>
-#include <cstdlib>
-#include <iterator>
-#include <memory>
-#include <utility>
-
-namespace std
-{
-    template<class T, class Allocator = allocator<T>>
-    class list;
-
-    namespace aux
-    {
-        template<class T>
-        class list_iterator;
-
-        template<class T>
-        class list_const_iterator
-        {
-            public:
-                using value_type      = typename list<T>::value_type;
-                using reference       = typename list<T>::const_reference;
-                using pointer         = typename list<T>::const_pointer;
-                using difference_type = typename list<T>::difference_type;
-                using size_type       = typename list<T>::size_type;
-
-                using iterator_category = bidirectional_iterator_tag;
-
-                list_const_iterator(list_node<value_type>* node = nullptr,
-                                    list_node<value_type>* head = nullptr,
-                                    bool end = true)
-                    : current_{node}, head_{head}, end_{end}
-                { /* DUMMY BODY */ }
-
-                list_const_iterator(const list_const_iterator&) = default;
-                list_const_iterator& operator=(const list_const_iterator&) = default;
-                list_const_iterator(list_const_iterator&&) = default;
-                list_const_iterator& operator=(list_const_iterator&&) = default;
-
-                list_const_iterator(const list_iterator<T>& other)
-                    : current_{other.node()}, head_{other.head()}, end_{other.end()}
-                { /* DUMMY BODY */ }
-
-                reference operator*() const
-                {
-                    return current_->value;
-                }
-
-                list_const_iterator& operator++()
-                {
-                    if (!end_ && current_)
-                    {
-                        if (current_->next == head_)
-                            end_ = true;
-                        else
-                            current_ = current_->next;
-                    }
-
-                    return *this;
-                }
-
-                list_const_iterator operator++(int)
-                {
-                    auto old = *this;
-                    ++(*this);
-
-                    return old;
-                }
-
-                list_const_iterator& operator--()
-                {
-                    if (end_)
-                        end_ = false;
-                    else if (current_)
-                    {
-                        if (current_ != head_)
-                            current_ = current_->prev;
-                        else
-                            end_ = true;
-                    }
-
-                    return *this;
-                }
-
-                list_const_iterator operator--(int)
-                {
-                    auto old = *this;
-                    --(*this);
-
-                    return old;
-                }
-
-                list_node<value_type>* node()
-                {
-                    return const_cast<list_node<value_type>*>(current_);
-                }
-
-                const list_node<value_type>* node() const
-                {
-                    return current_;
-                }
-
-                list_node<value_type>* head()
-                {
-                    return const_cast<list_node<value_type>*>(head_);
-                }
-
-                const list_node<value_type>* head() const
-                {
-                    return head_;
-                }
-
-                list_const_iterator operator-(difference_type n) const
-                {
-                    /**
-                     * Note: This operator is for internal purposes only,
-                     *       so we do not provide inverse operator or shortcut
-                     *       -= operator.
-                     */
-                    auto tmp = current_;
-
-                    for (difference_type i = 0; i < n; ++i)
-                        tmp = tmp->prev;
-
-                    return list_const_iterator{tmp};
-                }
-
-                bool end() const
-                {
-                    return end_;
-                }
-
-            private:
-                const list_node<value_type>* current_;
-                const list_node<value_type>* head_;
-                bool end_;
-        };
-
-        template<class T>
-        bool operator==(const list_const_iterator<T>& lhs, const list_const_iterator<T>& rhs)
-        {
-            return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-        }
-
-        template<class T>
-        bool operator!=(const list_const_iterator<T>& lhs, const list_const_iterator<T>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        template<class T>
-        class list_iterator
-        {
-            public:
-                using value_type      = typename list<T>::value_type;
-                using reference       = typename list<T>::reference;
-                using pointer         = typename list<T>::pointer;
-                using difference_type = typename list<T>::difference_type;
-                using size_type       = typename list<T>::size_type;
-
-                using iterator_category = bidirectional_iterator_tag;
-
-                list_iterator(list_node<value_type>* node = nullptr,
-                              list_node<value_type>* head = nullptr,
-                              bool end = true)
-                    : current_{node}, head_{head}, end_{end}
-                { /* DUMMY BODY */ }
-
-                list_iterator(const list_iterator&) = default;
-                list_iterator& operator=(const list_iterator&) = default;
-                list_iterator(list_iterator&&) = default;
-                list_iterator& operator=(list_iterator&&) = default;
-
-                reference operator*() const
-                {
-                    return current_->value;
-                }
-
-                list_iterator& operator++()
-                {
-                    if (!end_ && current_)
-                    {
-                        if (current_->next == head_)
-                            end_ = true;
-                        else
-                            current_ = current_->next;
-                    }
-
-                    return *this;
-                }
-
-                list_iterator operator++(int)
-                {
-                    auto old = *this;
-                    ++(*this);
-
-                    return old;
-                }
-
-                list_iterator& operator--()
-                {
-                    if (end_)
-                        end_ = false;
-                    else if (current_)
-                    {
-                        if (current_ != head_)
-                            current_ = current_->prev;
-                        else
-                            end_ = true;
-                    }
-
-                    return *this;
-                }
-
-                list_iterator operator--(int)
-                {
-                    auto old = *this;
-                    --(*this);
-
-                    return old;
-                }
-
-                list_node<value_type>* node()
-                {
-                    return current_;
-                }
-
-                const list_node<value_type>* node() const
-                {
-                    return current_;
-                }
-
-                list_node<value_type>* head()
-                {
-                    return head_;
-                }
-
-                const list_node<value_type>* head() const
-                {
-                    return head_;
-                }
-
-                list_iterator operator-(difference_type n) const
-                {
-                    /**
-                     * Note: This operator is for internal purposes only,
-                     *       so we do not provide inverse operator or shortcut
-                     *       -= operator.
-                     */
-                    auto tmp = current_;
-
-                    for (difference_type i = 0; i < n; ++i)
-                        tmp = tmp->prev;
-
-                    return list_iterator{tmp};
-                }
-
-                bool end() const
-                {
-                    return end_;
-                }
-
-            private:
-                list_node<value_type>* current_;
-                list_node<value_type>* head_;
-                bool end_;
-        };
-
-        template<class T>
-        bool operator==(const list_iterator<T>& lhs, const list_iterator<T>& rhs)
-        {
-            return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-        }
-
-        template<class T>
-        bool operator!=(const list_iterator<T>& lhs, const list_iterator<T>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        template<class T>
-        bool operator==(const list_const_iterator<T>& lhs, const list_iterator<T>& rhs)
-        {
-            return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-        }
-
-        template<class T>
-        bool operator!=(const list_const_iterator<T>& lhs, const list_iterator<T>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        template<class T>
-        bool operator==(const list_iterator<T>& lhs, const list_const_iterator<T>& rhs)
-        {
-            return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-        }
-
-        template<class T>
-        bool operator!=(const list_iterator<T>& lhs, const list_const_iterator<T>& rhs)
-        {
-            return !(lhs == rhs);
-        }
-    }
-
-    /**
-     * 23.3.5, class template list:
-     */
-
-    template<class T, class Allocator>
-    class list
-    {
-        public:
-            using value_type      = T;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using allocator_type  = Allocator;
-
-            using iterator        = aux::list_iterator<value_type>;
-            using const_iterator  = aux::list_const_iterator<value_type>;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using pointer       = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer = typename allocator_traits<allocator_type>::const_pointer;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            /**
-             * 23.3.5.2, construct/copy/destroy:
-             */
-
-            list()
-                : list{allocator_type{}}
-            { /* DUMMY BODY */ }
-
-            explicit list(const allocator_type& alloc)
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            { /* DUMMY BODY */ }
-
-            explicit list(size_type n, const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            {
-                init_(
-                    aux::insert_iterator<value_type>{size_type{}, value_type{}},
-                    aux::insert_iterator<value_type>{size_, value_type{}}
-                );
-            }
-
-            list(size_type n, const value_type& val,
-                 const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            {
-                init_(
-                    aux::insert_iterator<value_type>{size_type{}, val},
-                    aux::insert_iterator<value_type>{n, value_type{}}
-                );
-            }
-
-            template<class InputIterator>
-            list(InputIterator first, InputIterator last,
-                 const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            {
-                init_(first, last);
-            }
-
-            list(const list& other)
-                : list{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            list(list&& other)
-                : allocator_{move(other.allocator_)},
-                  head_{move(other.head_)},
-                  size_{move(other.size_)}
-            {
-                other.head_ = nullptr;
-                other.size_ = size_type{};
-            }
-
-            list(const list& other, const allocator_type alloc)
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            { // Size is set in init_.
-                init_(other.begin(), other.end());
-            }
-
-            list(list&& other, const allocator_type& alloc)
-                : allocator_{alloc},
-                  head_{move(other.head_)},
-                  size_{move(other.size_)}
-            {
-                other.head_ = nullptr;
-                other.size_ = size_type{};
-            }
-
-            list(initializer_list<value_type> init, const allocator_type& alloc = allocator_type{})
-                : allocator_{alloc}, head_{nullptr}, size_{}
-            {
-                init_(init.begin(), init.end());
-            }
-
-            ~list()
-            {
-                fini_();
-            }
-
-            list& operator=(const list& other)
-            {
-                fini_();
-
-                allocator_ = other.allocator_;
-
-                init_(other.begin(), other.end());
-
-                return *this;
-            }
-
-            list& operator=(list&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                fini_();
-
-                head_ = move(other.head_);
-                size_ = move(other.size_);
-                allocator_ = move(other.allocator_);
-
-                other.head_ = nullptr;
-                other.size_ = size_type{};
-
-                return *this;
-            }
-
-            list& operator=(initializer_list<value_type> init)
-            {
-                fini_();
-
-                init_(init.begin(), init.end());
-
-                return *this;
-            }
-
-            template<class InputIterator>
-            void assign(InputIterator first, InputIterator last)
-            {
-                fini_();
-
-                init_(first, last);
-            }
-
-            void assign(size_type n, const value_type& val)
-            {
-                fini_();
-
-                init_(
-                    aux::insert_iterator<value_type>{size_type{}, val},
-                    aux::insert_iterator<value_type>{n, value_type{}}
-                );
-            }
-
-            void assign(initializer_list<value_type> init)
-            {
-                fini_();
-
-                init_(init.begin(), init.end());
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return iterator{head_, head_, size_ == 0U};
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return cbegin();
-            }
-
-            iterator end() noexcept
-            {
-                return iterator{get_last_(), head_, true};
-            }
-
-            const_iterator end() const noexcept
-            {
-                return cend();
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return make_reverse_iterator(end());
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return make_reverse_iterator(begin());
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return const_iterator{head_, head_, size_ == 0U};
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return const_iterator{get_last_(), head_, true};
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return rbegin();
-            }
-
-            /**
-             * 23.3.5.3, capacity:
-             */
-
-            bool empty() const noexcept
-            {
-                return size_ == 0;
-            }
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type max_size() const noexcept
-            {
-                return allocator_traits<allocator_type>::max_size(allocator_);
-            }
-
-            void resize(size_type sz)
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            void resize(size_type sz, const value_type& val)
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            reference front()
-            {
-                // TODO: bounds checking
-                return head_->value;
-            }
-
-            const_reference front() const
-            {
-                // TODO: bounds checking
-                return head_->value;
-            }
-
-            reference back()
-            {
-                // TODO: bounds checking
-                return head_->prev->value;
-            }
-
-            const_reference back() const
-            {
-                // TODO: bounds checking
-                return head_->prev->value;
-            }
-
-            /**
-             * 23.3.5.4, modifiers:
-             * Note: These should have no effect when an exception
-             *       is thrown while inserting, but since the only
-             *       functions that can throw are the constructors,
-             *       creating the node before any modifications to the
-             *       list itself will satisfy this requirement.
-             */
-
-            template<class... Args>
-            void emplace_front(Args&&... args)
-            {
-                prepend_new_(forward<Args>(args)...);
-            }
-
-            void pop_front()
-            {
-                if (head_)
-                {
-                    --size_;
-
-                    if (head_->next == head_)
-                    {
-                        delete head_;
-                        head_ = nullptr;
-                    }
-                    else
-                    {
-                        auto tmp = head_;
-                        head_->prev->next = head_->next;
-                        head_->next->prev = head_->prev;
-                        head_ = head_->next;
-
-                        delete tmp;
-                    }
-                }
-            }
-
-            template<class... Args>
-            void emplace_back(Args&&... args)
-            {
-                append_new_(forward<Args>(args)...);
-            }
-
-            void push_front(const value_type& value)
-            {
-                prepend_new_(value);
-            }
-
-            void push_front(value_type&& value)
-            {
-                prepend_new_(forward<value_type>(value));
-            }
-
-            void push_back(const value_type& value)
-            {
-                append_new_(value);
-            }
-
-            void push_back(value_type&& value)
-            {
-                append_new_(forward<value_type>(value));
-            }
-
-            void pop_back()
-            {
-                if (head_)
-                {
-                    --size_;
-                    auto target = head_->prev;
-
-                    if (!target)
-                    {
-                        delete head_;
-                        head_ = nullptr;
-                    }
-                    else
-                    {
-                        auto tmp = target;
-                        target->prev->next = target->next;
-                        target->next->prev = target->prev;
-                        target = target->next;
-
-                        delete tmp;
-                    }
-                }
-            }
-
-            template<class... Args>
-            iterator emplace(const_iterator position, Args&&... args)
-            {
-                auto node = position.node();
-                node->prepend(new aux::list_node<value_type>{forward<Args>(args)...});
-                ++size_;
-
-                if (node == head_)
-                    head_ = head_->prev;
-
-                return iterator{node->prev, head_, false};
-            }
-
-            iterator insert(const_iterator position, const value_type& val)
-            {
-                return emplace(position, val);
-            }
-
-            iterator insert(const_iterator position, value_type&& val)
-            {
-                return emplace(position, forward<value_type>(val));
-            }
-
-            iterator insert(const_iterator position, size_type n, const value_type& val)
-            {
-                return insert(
-                    position,
-                    aux::insert_iterator<value_type>{size_type{}, val},
-                    aux::insert_iterator<value_type>{n, value_type{}}
-                );
-            }
-
-            template<class InputIterator>
-            iterator insert(const_iterator position, InputIterator first, InputIterator last)
-            {
-                auto node = position.node()->prev;
-
-                while (first != last)
-                {
-                    node->append(new aux::list_node<value_type>{*first++});
-                    node = node->next;
-                    ++size_;
-                }
-
-                return iterator{position.node()->next, head_, false};
-            }
-
-            iterator insert(const_iterator position, initializer_list<value_type> init)
-            {
-                return insert(position, init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                auto node = position.node();
-
-                if (node == head_)
-                {
-                    if (size_ == 1)
-                    {
-                        delete head_;
-                        head_ = nullptr;
-                        size_ = 0;
-
-                        return end();
-                    }
-                    else
-                        head_ = node->next;
-                }
-
-                auto next = node->next;
-
-                --size_;
-
-                node->unlink();
-                delete node;
-
-                return iterator{next, head_, size_ == 0U};
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                if (first == last)
-                    return end();
-
-                auto first_node = first.node();
-                auto last_node = last.node()->prev;
-                auto prev = first_node->prev;
-                auto next = last_node->next;
-
-                first_node->prev = nullptr;
-                last_node->next = nullptr;
-                prev->next = next;
-                next->prev = prev;
-
-                while (first_node)
-                {
-                    if (first_node == head_)
-                    {
-                        head_ = next;
-                        head_->prev = prev;
-                    }
-
-                    auto tmp = first_node;
-                    first_node = first_node->next;
-                    --size_;
-
-                    delete tmp;
-                }
-
-                return iterator{next, head_, size_ == 0U};
-            }
-
-            void swap(list& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                std::swap(allocator_, other.allocator_);
-                std::swap(head_, other.head_);
-                std::swap(size_, other.size_);
-            }
-
-            void clear() noexcept
-            {
-                fini_();
-            }
-
-            /**
-             * 23.3.5.5, list operations:
-             */
-
-            void splice(const_iterator position, list& other)
-            {
-                if (!head_)
-                {
-                    swap(other);
-                    return;
-                }
-
-                auto other_first = other.head_;
-                auto other_last = other.get_last_();
-                auto node = position.node();
-                auto prev = node->prev;
-
-                // Insert a link range.
-                prev->next = other_first;
-                other_first->prev = prev;
-                node->prev = other_last;
-                other_last->next = node;
-
-                size_ += other.size_;
-
-                if (node == head_)
-                    head_ = other_first;
-                other.head_ = nullptr;
-                other.size_ = 0;
-            }
-
-            void splice(const_iterator position, list&& other)
-            {
-                splice(position, other);
-            }
-
-            void splice(const_iterator position, list& other, const_iterator it)
-            {
-                if (&other == this)
-                    return;
-
-                auto node = position.node();
-                auto target = it.node();
-
-                // Unlink from other.
-                target->prev->next = target->next;
-                target->next->prev = target->prev;
-
-                // Link to us.
-                node->prev->next = target;
-                target->prev = node->prev;
-
-                node->prev = target;
-                target->next = node;
-
-                --other.size_;
-                ++size_;
-
-                if (it.node() == other.head_)
-                    other.advance_head_();
-            }
-
-            void splice(const_iterator position, list&& other, const_iterator it)
-            {
-                splice(position, other, it);
-            }
-
-            void splice(const_iterator position, list& other,
-                        const_iterator first, const_iterator last)
-            {
-                if (&other == this || other.empty())
-                    return;
-
-                if (first == other.begin() && last == other.end())
-                { // [first, last) is everything in other.
-                    splice(position, other);
-                    return;
-                }
-
-                // [first_node, last_node] is the inserted range.
-                aux::list_node<value_type>* first_node{};
-                aux::list_node<value_type>* last_node{};
-
-                if (first == other.begin())
-                { // The range is a prefix of other.
-                    other.head_ = last.node();
-                    other.head_->prev = first.node()->prev;
-                    first.node()->prev->next = last.node();
-
-                    first_node = first.node();
-                    last_node = last.node()->prev;
-                }
-                else if (last == other.end())
-                { // The range is a suffix of other.
-                    auto new_last = first.node()->prev;
-                    auto old_last = other.head_->prev;
-                    other.head_->prev = new_last;
-                    new_last->next = other.head_;
-
-                    first_node = first.node();
-                    last_node = old_last;
-                }
-                else
-                { // The range is a subrange of other.
-                    first_node = first.node();
-                    last_node = last.node()->prev;
-
-                    first_node->prev->next = last.node();
-                    last.node()->prev = first_node->prev;
-                }
-
-                if (!head_)
-                { // Assimilate the range.
-                    head_ = first_node;
-                    first_node->prev = last_node;
-                    last_node->next = first_node;
-                }
-                else
-                {
-                    auto target = position.node();
-                    target->prev->next = first_node;
-                    first_node->prev = target->prev;
-
-                    target->prev = last_node;
-                    last_node->next = target;
-                }
-
-                auto count = distance(
-                    iterator{first_node, nullptr, false},
-                    iterator{last_node, nullptr, false}
-                );
-                ++count;
-
-                size_ += count;
-                other.size_ -= count;
-            }
-
-            void splice(const_iterator position, list&& other,
-                        const_iterator first, const_iterator last)
-            {
-                splice(position, other, first, last);
-            }
-
-            void remove(const value_type& val)
-            {
-                if (!head_)
-                    return;
-
-                auto it = begin();
-                while (it != end())
-                {
-                    if (*it == val)
-                        it = erase(it);
-                    else
-                        ++it;
-                }
-            }
-
-            template<class Predicate>
-            void remove_if(Predicate pred)
-            {
-                if (!head_)
-                    return;
-
-                auto it = begin();
-                while (it != end())
-                {
-                    if (pred(*it))
-                        it = erase(it);
-                    else
-                        ++it;
-                }
-            }
-
-            void unique()
-            {
-                if (!head_)
-                    return;
-
-                auto it = begin();
-                ++it;
-
-                while (it != end())
-                {
-                    if (*it == *(it - 1))
-                        it = erase(it);
-                    else
-                        ++it;
-                }
-            }
-
-            template<class BinaryPredicate>
-            void unique(BinaryPredicate pred)
-            {
-                if (!head_)
-                    return;
-
-                auto it = begin();
-                ++it;
-
-                while (it != end())
-                {
-                    if (pred(*it, *(it - 1)))
-                        it = erase(it);
-                    else
-                        ++it;
-                }
-            }
-
-            // TODO: make a generic base for algorithms like merge
-            //       and quicksort that uses a swapper (the <algorithm>
-            //       versions would use std::swap and list versions would
-            //       use a swapper that swaps list nodes)
-
-            void merge(list& other)
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            void merge(list&& other)
-            {
-                merge(other);
-            }
-
-            template<class Compare>
-            void merge(list& other, Compare comp)
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            template<class Compare>
-            void merge(list&& other, Compare comp)
-            {
-                merge(other, comp);
-            }
-
-            void reverse() noexcept
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            void sort()
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-            template<class Compare>
-            void sort(Compare comp)
-            {
-                // TODO: implement
-                __unimplemented();
-            }
-
-        private:
-            allocator_type allocator_;
-            aux::list_node<value_type>* head_;
-            size_type size_;
-
-            template<class InputIterator>
-            void init_(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                {
-                    auto node = append_new_();
-                    allocator_.construct(&node->value, *first++);
-                }
-            }
-
-            void fini_()
-            {
-                if (!head_)
-                    return;
-
-                head_->prev->next = nullptr;
-                while (head_)
-                {
-                    auto tmp = head_;
-                    head_ = head_->next;
-
-                    delete tmp;
-                }
-
-                head_ = nullptr;
-                size_ = size_type{};
-            }
-
-            template<class... Args>
-            aux::list_node<value_type>* append_new_(Args&&... args)
-            {
-                auto node = new aux::list_node<value_type>{forward<Args>(args)...};
-                auto last = get_last_();
-
-                if (!last)
-                    head_ = node;
-                else
-                    last->append(node);
-
-                ++size_;
-
-                return node;
-            }
-
-            template<class... Args>
-            aux::list_node<value_type>* prepend_new_(Args&&... args)
-            {
-                auto node = new aux::list_node<value_type>{forward<Args>(args)...};
-
-                if (!head_)
-                    head_ = node;
-                else
-                {
-                    head_->prepend(node);
-                    head_ = head_->prev;
-                }
-
-                ++size_;
-
-                return node;
-            }
-
-            aux::list_node<value_type>* get_last_() const
-            {
-                if (!head_)
-                    return nullptr;
-
-                return head_->prev;
-            }
-
-            template<class InputIterator>
-            void insert_range_(InputIterator first, InputIterator last,
-                               aux::list_node<value_type>* where = nullptr)
-            {
-                if (first == last)
-                    return;
-
-                if (!where)
-                    where = get_last_();
-
-                while (first != last)
-                {
-                    where->append(new aux::list_node<value_type>{*first++});
-                    where = where->next;
-                }
-            }
-
-            void advance_head_()
-            {
-                if (size_ == 1)
-                {
-                    head_ = nullptr;
-                    size_ = 0;
-                }
-                else
-                { // The head_ is deleted outside.
-                    head_->next->prev = head_->prev;
-                    head_->prev->next = head_->next;
-                    head_ = head_->next;
-                }
-            }
-    };
-
-    template<class T, class Allocator>
-    void swap(list<T, Allocator>& lhs, list<T, Allocator>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/list_node.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/list_node.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_LIST_NODE
-#define LIBCPP_BITS_ADT_LIST_NODE
-
-namespace std::aux
-{
-    template<class T>
-    struct list_node
-    {
-        T value;
-        list_node* next;
-        list_node* prev;
-
-        template<class... Args>
-        list_node(Args&&... args)
-            : value{forward<Args>(args)...},
-              next{}, prev{}
-        {
-            next = this;
-            prev = this;
-        }
-
-        list_node(const T& val)
-            : value{val}, next{}, prev{}
-        {
-            next = this;
-            prev = this;
-        }
-
-        list_node(T&& val)
-            : value{forward<T>(val)}, next{}, prev{}
-        {
-            next = this;
-            prev = this;
-        }
-
-        void append(list_node* node)
-        {
-            if (!node)
-                return;
-
-            node->next = next;
-            node->prev = this;
-            next->prev = node;
-            next = node;
-        }
-
-        void prepend(list_node* node)
-        {
-            if (!node)
-                return;
-
-            node->next = this;
-            node->prev = prev;
-            prev->next = node;
-            prev = node;
-        }
-
-        void unlink()
-        {
-            prev->next = next;
-            next->prev = prev;
-            next = this;
-            prev = this;
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/map.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/map.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1224 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_MAP
-#define LIBCPP_BITS_ADT_MAP
-
-#include <__bits/adt/rbtree.hpp>
-#include <functional>
-#include <iterator>
-#include <memory>
-#include <utility>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 23.4.4, class template map:
-     */
-
-    template<
-        class Key, class Value,
-        class Compare = less<Key>,
-        class Alloc = allocator<pair<const Key, Value>>
-    >
-    class map
-    {
-        public:
-            using key_type        = Key;
-            using mapped_type     = Value;
-            using value_type      = pair<const key_type, mapped_type>;
-            using key_compare     = Compare;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using node_type = aux::rbtree_single_node<value_type>;
-
-            using iterator             = aux::rbtree_iterator<
-                value_type, reference, pointer, size_type, node_type
-            >;
-            using const_iterator       = aux::rbtree_const_iterator<
-                value_type, const_reference, const_pointer, size_type, node_type
-            >;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            class value_compare
-            {
-                friend class map;
-
-                protected:
-                    key_compare comp;
-
-                    value_compare(key_compare c)
-                        : comp{c}
-                    { /* DUMMY BODY */ }
-
-                public:
-                    using result_type          = bool;
-                    using first_argument_type  = value_type;
-                    using second_argument_type = value_type;
-
-                    bool operator()(const value_type& lhs, const value_type& rhs) const
-                    {
-                        return comp(lhs.first, rhs.first);
-                    }
-            };
-
-            /**
-             * 24.4.4.2, construct/copy/destroy:
-             */
-
-            map()
-                : map{key_compare{}}
-            { /* DUMMY BODY */ }
-
-            explicit map(const key_compare& comp,
-                         const allocator_type& alloc = allocator_type{})
-                : tree_{comp}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            map(InputIterator first, InputIterator last,
-                const key_compare& comp = key_compare{},
-                const allocator_type& alloc = allocator_type{})
-                : map{comp, alloc}
-            {
-                insert(first, last);
-            }
-
-            map(const map& other)
-                : map{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            map(map&& other)
-                : tree_{move(other.tree_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit map(const allocator_type& alloc)
-                : tree_{}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            map(const map& other, const allocator_type& alloc)
-                : tree_{other.tree_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            map(map&& other, const allocator_type& alloc)
-                : tree_{move(other.tree_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            map(initializer_list<value_type> init,
-                const key_compare& comp = key_compare{},
-                const allocator_type& alloc = allocator_type{})
-                : map{comp, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class InputIterator>
-            map(InputIterator first, InputIterator last,
-                const allocator_type& alloc)
-                : map{first, last, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            map(initializer_list<value_type> init,
-                const allocator_type& alloc)
-                : map{init, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~map()
-            { /* DUMMY BODY */ }
-
-            map& operator=(const map& other)
-            {
-                tree_ = other.tree_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            map& operator=(map&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<key_compare>::value)
-            {
-                tree_ = move(other.tree_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            map& operator=(initializer_list<value_type>& init)
-            {
-                tree_.clear();
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return tree_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return tree_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return tree_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return tree_.end();
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return tree_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return tree_.cend();
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return tree_.crbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return tree_.crend();
-            }
-
-            bool empty() const noexcept
-            {
-                return tree_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return tree_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return tree_.max_size(allocator_);
-            }
-
-            /**
-             * 23.4.4.3, element access:
-             */
-
-            mapped_type& operator[](const key_type& key)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                    return parent->value.second;
-
-                auto node = new node_type{value_type{key, mapped_type{}}};
-                tree_.insert_node(node, parent);
-
-                return node->value.second;
-            }
-
-            mapped_type& operator[](key_type&& key)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                    return parent->value.second;
-
-                auto node = new node_type{value_type{move(key), mapped_type{}}};
-                tree_.insert_node(node, parent);
-
-                return node->value.second;
-            }
-
-            mapped_type& at(const key_type& key)
-            {
-                auto it = find(key);
-
-                // TODO: throw out_of_range if it == end()
-                return it->second;
-            }
-
-            const mapped_type& at(const key_type& key) const
-            {
-                auto it = find(key);
-
-                // TODO: throw out_of_range if it == end()
-                return it->second;
-            }
-
-            /**
-             * 23.4.4.4, modifiers:
-             */
-
-            template<class... Args>
-            pair<iterator, bool> emplace(Args&&... args)
-            {
-                return tree_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...).first;
-            }
-
-            pair<iterator, bool> insert(const value_type& val)
-            {
-                return tree_.insert(val);
-            }
-
-            pair<iterator, bool> insert(value_type&& val)
-            {
-                return tree_.insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            pair<iterator, bool> insert(
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace(forward<T>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val).first;
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val)).first;
-            }
-
-            template<class T>
-            iterator insert(
-                const_iterator hint,
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace_hint(hint, forward<T>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class... Args>
-            pair<iterator, bool> try_emplace(const key_type& key, Args&&... args)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                    return make_pair(iterator{parent, false}, false);
-                else
-                {
-                    auto node = new node_type{value_type{key, forward<Args>(args)...}};
-                    tree_.insert_node(node, parent);
-
-                    return make_pair(iterator{node, false}, true);
-                }
-            }
-
-            template<class... Args>
-            pair<iterator, bool> try_emplace(key_type&& key, Args&&... args)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                    return make_pair(iterator{parent, false}, false);
-                else
-                {
-                    auto node = new node_type{value_type{move(key), forward<Args>(args)...}};
-                    tree_.insert_node(node, parent);
-
-                    return make_pair(iterator{node, false}, true);
-                }
-            }
-
-            template<class... Args>
-            iterator try_emplace(const_iterator, const key_type& key, Args&&... args)
-            {
-                return try_emplace(key, forward<Args>(args)...).first;
-            }
-
-            template<class... Args>
-            iterator try_emplace(const_iterator, key_type&& key, Args&&... args)
-            {
-                return try_emplace(move(key), forward<Args>(args)...).first;
-            }
-
-            template<class T>
-            pair<iterator, bool> insert_or_assign(const key_type& key, T&& val)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                {
-                    parent->value.second = forward<T>(val);
-
-                    return make_pair(iterator{parent, false}, false);
-                }
-                else
-                {
-                    auto node = new node_type{value_type{key, forward<T>(val)}};
-                    tree_.insert_node(node, parent);
-
-                    return make_pair(iterator{node, false}, true);
-                }
-            }
-
-            template<class T>
-            pair<iterator, bool> insert_or_assign(key_type&& key, T&& val)
-            {
-                auto parent = tree_.find_parent_for_insertion(key);
-                if (parent && tree_.keys_equal(tree_.get_key(parent->value), key))
-                {
-                    parent->value.second = forward<T>(val);
-
-                    return make_pair(iterator{parent, false}, false);
-                }
-                else
-                {
-                    auto node = new node_type{value_type{move(key), forward<T>(val)}};
-                    tree_.insert_node(node, parent);
-
-                    return make_pair(iterator{node, false}, true);
-                }
-            }
-
-            template<class T>
-            iterator insert_or_assign(const_iterator, const key_type& key, T&& val)
-            {
-                return insert_or_assign(key, forward<T>(val)).first;
-            }
-
-            template<class T>
-            iterator insert_or_assign(const_iterator, key_type&& key, T&& val)
-            {
-                return insert_or_assign(move(key), forward<T>(val)).first;
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return tree_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return tree_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    first.node(), first.end()
-                };
-            }
-
-            void swap(map& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<key_compare>(), declval<key_compare>())))
-            {
-                tree_.swap(other.tree_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            void clear() noexcept
-            {
-                tree_.clear();
-            }
-
-            key_compare key_comp() const
-            {
-                return tree_.key_comp();
-            }
-
-            value_compare value_comp() const
-            {
-                return value_compare{tree_.key_comp()};
-            }
-
-            iterator find(const key_type& key)
-            {
-                return tree_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            const_iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return tree_.count(key);
-            }
-
-            template<class K>
-            size_type count(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.count(key);
-            }
-
-            iterator lower_bound(const key_type& key)
-            {
-                return tree_.lower_bound(key);
-            }
-
-            const_iterator lower_bound(const key_type& key) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            const_iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            iterator upper_bound(const key_type& key)
-            {
-                return tree_.upper_bound(key);
-            }
-
-            const_iterator upper_bound(const key_type& key) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            const_iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return tree_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<iterator, iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<const_iterator, const_iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.equal_range(key);
-            }
-
-        private:
-            using tree_type = aux::rbtree<
-                value_type, key_type, aux::key_value_key_extractor<key_type, mapped_type>,
-                key_compare, allocator_type, size_type,
-                iterator, const_iterator,
-                aux::rbtree_single_policy, node_type
-            >;
-
-            tree_type tree_;
-            allocator_type allocator_;
-
-            template<class K, class C, class A>
-            friend bool operator==(const map<K, C, A>&,
-                                   const map<K, C, A>&);
-    };
-
-    template<class Key, class Compare, class Allocator>
-    bool operator==(const map<Key, Compare, Allocator>& lhs,
-                    const map<Key, Compare, Allocator>& rhs)
-    {
-        return lhs.tree_.is_eq_to(rhs.tree_);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<(const map<Key, Compare, Allocator>& lhs,
-                   const map<Key, Compare, Allocator>& rhs)
-    {
-        return lexicographical_compare(
-            lhs.begin(), lhs.end(),
-            rhs.begin(), rhs.end(),
-            lhs.value_comp()
-        );
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator!=(const map<Key, Compare, Allocator>& lhs,
-                    const map<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>(const map<Key, Compare, Allocator>& lhs,
-                   const map<Key, Compare, Allocator>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>=(const map<Key, Compare, Allocator>& lhs,
-                    const map<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<=(const map<Key, Compare, Allocator>& lhs,
-                    const map<Key, Compare, Allocator>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    /**
-     * 23.4.5, class template multimap:
-     */
-
-    template<
-        class Key, class Value,
-        class Compare = less<Key>,
-        class Alloc = allocator<pair<const Key, Value>>
-    >
-    class multimap
-    {
-        public:
-            using key_type        = Key;
-            using mapped_type     = Value;
-            using value_type      = pair<const key_type, mapped_type>;
-            using key_compare     = Compare;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using node_type = aux::rbtree_multi_node<value_type>;
-
-            class value_compare
-            {
-                friend class multimap;
-
-                protected:
-                    key_compare comp;
-
-                    value_compare(key_compare c)
-                        : comp{c}
-                    { /* DUMMY BODY */ }
-
-                public:
-                    using result_type          = bool;
-                    using first_argument_type  = value_type;
-                    using second_argument_type = value_type;
-
-                    bool operator()(const value_type& lhs, const value_type& rhs) const
-                    {
-                        return comp(lhs.first, rhs.first);
-                    }
-            };
-
-            using iterator             = aux::rbtree_iterator<
-                value_type, reference, pointer, size_type, node_type
-            >;
-            using const_iterator       = aux::rbtree_const_iterator<
-                value_type, const_reference, const_pointer, size_type, node_type
-            >;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            multimap()
-                : multimap{key_compare{}}
-            { /* DUMMY BODY */ }
-
-            explicit multimap(const key_compare& comp,
-                              const allocator_type& alloc = allocator_type{})
-                : tree_{comp}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            multimap(InputIterator first, InputIterator last,
-                     const key_compare& comp = key_compare{},
-                     const allocator_type& alloc = allocator_type{})
-                : multimap{comp, alloc}
-            {
-                insert(first, last);
-            }
-
-            multimap(const multimap& other)
-                : multimap{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            multimap(multimap&& other)
-                : tree_{move(other.tree_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit multimap(const allocator_type& alloc)
-                : tree_{}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multimap(const multimap& other, const allocator_type& alloc)
-                : tree_{other.tree_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multimap(multimap&& other, const allocator_type& alloc)
-                : tree_{move(other.tree_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multimap(initializer_list<value_type> init,
-                     const key_compare& comp = key_compare{},
-                     const allocator_type& alloc = allocator_type{})
-                : multimap{comp, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class InputIterator>
-            multimap(InputIterator first, InputIterator last,
-                     const allocator_type& alloc)
-                : multimap{first, last, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            multimap(initializer_list<value_type> init,
-                     const allocator_type& alloc)
-                : multimap{init, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~multimap()
-            { /* DUMMY BODY */ }
-
-            multimap& operator=(const multimap& other)
-            {
-                tree_ = other.tree_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            multimap& operator=(multimap&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<key_compare>::value)
-            {
-                tree_ = move(other.tree_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            multimap& operator=(initializer_list<value_type>& init)
-            {
-                tree_.clear();
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return tree_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return tree_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return tree_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return tree_.end();
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return tree_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return tree_.cend();
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return tree_.crbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return tree_.crend();
-            }
-
-            bool empty() const noexcept
-            {
-                return tree_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return tree_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return tree_.max_size(allocator_);
-            }
-
-            template<class... Args>
-            iterator emplace(Args&&... args)
-            {
-                return tree_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...);
-            }
-
-            iterator insert(const value_type& val)
-            {
-                return tree_.insert(val);
-            }
-
-            iterator insert(value_type&& val)
-            {
-                return tree_.insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            iterator insert(
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace(forward<T>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val);
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            iterator insert(
-                const_iterator hint,
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace_hint(hint, forward<T>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return tree_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return tree_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    first.node(), first.end()
-                };
-            }
-
-            void swap(multimap& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<key_compare>(), declval<key_compare>())))
-            {
-                tree_.swap(other.tree_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            void clear() noexcept
-            {
-                tree_.clear();
-            }
-
-            key_compare key_comp() const
-            {
-                return tree_.key_comp();
-            }
-
-            value_compare value_comp() const
-            {
-                return value_compare{tree_.key_comp()};
-            }
-
-            iterator find(const key_type& key)
-            {
-                return tree_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            const_iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return tree_.count(key);
-            }
-
-            template<class K>
-            size_type count(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.count(key);
-            }
-
-            iterator lower_bound(const key_type& key)
-            {
-                return tree_.lower_bound(key);
-            }
-
-            const_iterator lower_bound(const key_type& key) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            const_iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            iterator upper_bound(const key_type& key)
-            {
-                return tree_.upper_bound(key);
-            }
-
-            const_iterator upper_bound(const key_type& key) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            const_iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return tree_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<iterator, iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<const_iterator, const_iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.equal_range(key);
-            }
-
-        private:
-            using tree_type = aux::rbtree<
-                value_type, key_type, aux::key_value_key_extractor<key_type, mapped_type>,
-                key_compare, allocator_type, size_type,
-                iterator, const_iterator,
-                aux::rbtree_multi_policy, node_type
-            >;
-
-            tree_type tree_;
-            allocator_type allocator_;
-
-            template<class K, class C, class A>
-            friend bool operator==(const multimap<K, C, A>&,
-                                   const multimap<K, C, A>&);
-    };
-
-    template<class Key, class Compare, class Allocator>
-    bool operator==(const multimap<Key, Compare, Allocator>& lhs,
-                    const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return lhs.tree_.is_eq_to(rhs.tree_);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<(const multimap<Key, Compare, Allocator>& lhs,
-                   const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return lexicographical_compare(
-            lhs.begin(), lhs.end(),
-            rhs.begin(), rhs.end(),
-            lhs.value_comp()
-        );
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator!=(const multimap<Key, Compare, Allocator>& lhs,
-                    const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>(const multimap<Key, Compare, Allocator>& lhs,
-                   const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>=(const multimap<Key, Compare, Allocator>& lhs,
-                    const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<=(const multimap<Key, Compare, Allocator>& lhs,
-                    const multimap<Key, Compare, Allocator>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/queue.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/queue.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,407 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_QUEUE
-#define LIBCPP_BITS_ADT_QUEUE
-
-#include <algorithm>
-#include <deque>
-#include <memory>
-#include <type_traits>
-#include <utility>
-#include <vector>
-
-namespace std
-{
-    /**
-     * 23.6.3, class template queue:
-     */
-
-    template<class T, class Container = deque<T>>
-    class queue
-    {
-        public:
-            using value_type      = typename Container::value_type;
-            using reference       = typename Container::reference;
-            using const_reference = typename Container::const_reference;
-            using size_type       = typename Container::size_type;
-            using container_type  = Container;
-
-        protected:
-            container_type c;
-
-        public:
-            explicit queue(const container_type& cc)
-                : c{cc}
-            { /* DUMMY BODY */ }
-
-            explicit queue(container_type&& cc = container_type{})
-                : c{move(cc)}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            explicit queue(const Alloc& alloc)
-                : c{alloc}
-            { /* DUMMY BODY */}
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            queue(const container_type& cc, const Alloc& alloc)
-                : c{cc, alloc}
-            { /* DUMMY BODY */}
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            queue(container_type&& cc, const Alloc& alloc)
-                : c{move(cc), alloc}
-            { /* DUMMY BODY */}
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            queue(const queue& other, const Alloc& alloc)
-                : c{other.c, alloc}
-            { /* DUMMY BODY */}
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            queue(queue&& other, const Alloc& alloc)
-                : c{move(other.c), alloc}
-            { /* DUMMY BODY */}
-
-            bool empty() const
-            {
-                return c.empty();
-            }
-
-            size_type size() const
-            {
-                return c.size();
-            }
-
-            reference front()
-            {
-                return c.front();
-            }
-
-            const_reference front() const
-            {
-                return c.front();
-            }
-
-            reference back()
-            {
-                return c.back();
-            }
-
-            const_reference back() const
-            {
-                return c.back();
-            }
-
-            void push(const value_type& val)
-            {
-                c.push_back(val);
-            }
-
-            void push(value_type&& val)
-            {
-                c.push_back(forward<value_type>(val));
-            }
-
-            template<class... Args>
-            void emplace(Args&&... args)
-            {
-                c.emplace_back(forward<Args>(args)...);
-            }
-
-            void pop()
-            {
-                c.pop_front();
-            }
-
-            void swap(queue& other)
-                noexcept(noexcept(swap(c, other.c)))
-            {
-                std::swap(c, other.c);
-            }
-
-        private:
-            template<class U, class C>
-            friend bool operator==(const queue<U, C>&, const queue<U, C>&);
-
-            template<class U, class C>
-            friend bool operator<(const queue<U, C>&, const queue<U, C>&);
-
-            template<class U, class C>
-            friend bool operator!=(const queue<U, C>&, const queue<U, C>&);
-
-            template<class U, class C>
-            friend bool operator>(const queue<U, C>&, const queue<U, C>&);
-
-            template<class U, class C>
-            friend bool operator>=(const queue<U, C>&, const queue<U, C>&);
-
-            template<class U, class C>
-            friend bool operator<=(const queue<U, C>&, const queue<U, C>&);
-    };
-
-    template<class T, class Container, class Alloc>
-    struct uses_allocator<queue<T, Container>, Alloc>
-        : uses_allocator<Container, Alloc>
-    { /* DUMMY BODY */ };
-
-    /**
-     * 23.6.4, class template priority_queue:
-     */
-
-    template<
-        class T, class Container = vector<T>,
-        class Compare = less<typename Container::value_type>
-    >
-    class priority_queue
-    {
-        public:
-            using value_type      = typename Container::value_type;
-            using reference       = typename Container::reference;
-            using const_reference = typename Container::const_reference;
-            using size_type       = typename Container::size_type;
-            using container_type  = Container;
-
-        protected:
-            using compare_type = Compare;
-
-            compare_type comp;
-            container_type c;
-
-        public:
-            priority_queue(const compare_type& cmp, const container_type& cc)
-                : comp{cmp}, c{cc}
-            {
-                make_heap(c.begin(), c.end(), comp);
-            }
-
-            explicit priority_queue(const compare_type& cmp = compare_type{},
-                                    container_type&& cc = container_type{})
-                : comp{cmp}, c{move(cc)}
-            {
-                make_heap(c.begin(), c.end(), comp);
-            }
-
-            template<class InputIterator>
-            priority_queue(InputIterator first, InputIterator last,
-                           const compare_type& cmp,
-                           const container_type& cc)
-                : comp{cmp}, c{cc}
-            {
-                c.insert(c.end(), first, last);
-                make_heap(c.begin(), c.end(), comp);
-            }
-
-            template<class InputIterator>
-            priority_queue(InputIterator first, InputIterator last,
-                           const compare_type& cmp = compare_type{},
-                           container_type&& cc = container_type{})
-                : comp{cmp}, c{move(cc)}
-            {
-                c.insert(c.end(), first, last);
-                make_heap(c.begin(), c.end(), comp);
-            }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            explicit priority_queue(const Alloc& alloc)
-                : comp{}, c{alloc}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            priority_queue(const compare_type& cmp, const Alloc& alloc)
-                : comp{cmp}, c{alloc}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            priority_queue(const compare_type& cmp, const container_type& cc,
-                           const Alloc& alloc)
-                : comp{cmp}, c{cc, alloc}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            priority_queue(const compare_type& cmp, container_type&& cc,
-                           const Alloc& alloc)
-                : comp{cmp}, c{move(cc), alloc}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            priority_queue(const priority_queue& other, const Alloc& alloc)
-                : comp{other.comp}, c{other.c, alloc}
-            { /* DUMMY BODY */ }
-
-            template<
-                class Alloc,
-                class = enable_if_t<uses_allocator<container_type, Alloc>::value, void>
-            >
-            priority_queue(priority_queue&& other, const Alloc& alloc)
-                : comp{move(other.comp)}, c{move(other.c), alloc}
-            { /* DUMMY BODY */ }
-
-            bool empty() const
-            {
-                return c.empty();
-            }
-
-            size_type size() const
-            {
-                return c.size();
-            }
-
-            const_reference top() const
-            {
-                return c.front();
-            }
-
-            void push(const value_type& val)
-            {
-                c.push_back(val);
-                push_heap(c.begin(), c.end(), comp);
-            }
-
-            void push(value_type&& val)
-            {
-                c.push_back(forward<value_type>(val));
-                push_heap(c.begin(), c.end(), comp);
-            }
-
-            template<class... Args>
-            void emplace(Args&&... args)
-            {
-                c.emplace_back(forward<Args>(args)...);
-                push_heap(c.begin(), c.end(), comp);
-            }
-
-            void pop()
-            {
-                pop_heap(c.begin(), c.end(), comp);
-                c.pop_back();
-            }
-
-            void swap(priority_queue& other)
-                noexcept(noexcept(swap(c, other.c)) && noexcept(swap(comp, other.comp)))
-            {
-                std::swap(c, other.c);
-                std::swap(comp, other.comp);
-            }
-    };
-
-    template<class T, class Container, class Compare, class Alloc>
-    struct uses_allocator<priority_queue<T, Container, Compare>, Alloc>
-        : uses_allocator<Container, Alloc>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Container>
-    bool operator==(const queue<T, Container>& lhs,
-                    const queue<T, Container>& rhs)
-    {
-        return lhs.c == rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator<(const queue<T, Container>& lhs,
-                   const queue<T, Container>& rhs)
-    {
-        return lhs.c < rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator!=(const queue<T, Container>& lhs,
-                    const queue<T, Container>& rhs)
-    {
-        return lhs.c != rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator>(const queue<T, Container>& lhs,
-                   const queue<T, Container>& rhs)
-    {
-        return lhs.c > rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator>=(const queue<T, Container>& lhs,
-                    const queue<T, Container>& rhs)
-    {
-        return lhs.c >= rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator<=(const queue<T, Container>& lhs,
-                    const queue<T, Container>& rhs)
-    {
-        return lhs.c <= rhs.c;
-    }
-
-    template<class T, class Container>
-    void swap(queue<T, Container>& lhs, queue<T, Container>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class T, class Container, class Compare>
-    void swap(priority_queue<T, Container, Compare>& lhs,
-              priority_queue<T, Container, Compare>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/rbtree.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/rbtree.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,491 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_RBTREE
-#define LIBCPP_BITS_ADT_RBTREE
-
-#include <__bits/adt/key_extractors.hpp>
-#include <__bits/adt/rbtree_iterators.hpp>
-#include <__bits/adt/rbtree_node.hpp>
-#include <__bits/adt/rbtree_policies.hpp>
-
-namespace std::aux
-{
-    template<
-        class Value, class Key, class KeyExtractor,
-        class KeyComp, class Alloc, class Size,
-        class Iterator, class ConstIterator,
-        class Policy, class Node
-    >
-    class rbtree
-    {
-        public:
-            using value_type     = Value;
-            using key_type       = Key;
-            using size_type      = Size;
-            using allocator_type = Alloc;
-            using key_compare    = KeyComp;
-            using key_extract    = KeyExtractor;
-
-            using iterator       = Iterator;
-            using const_iterator = ConstIterator;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            using node_type = Node;
-
-            rbtree(const key_compare& kcmp = key_compare{})
-                : root_{nullptr}, size_{}, key_compare_{},
-                  key_extractor_{}
-            { /* DUMMY BODY */ }
-
-            rbtree(const rbtree& other)
-                : rbtree{other.key_compare_}
-            {
-                for (const auto& x: other)
-                    insert(x);
-            }
-
-            rbtree(rbtree&& other)
-                : root_{other.root_}, size_{other.size_},
-                  key_compare_{move(other.key_compare_)},
-                  key_extractor_{move(other.key_extractor_)}
-            {
-                other.root_ = nullptr;
-                other.size_ = size_type{};
-            }
-
-            rbtree& operator=(const rbtree& other)
-            {
-                auto tmp{other};
-                tmp.swap(*this);
-
-                return *this;
-            }
-
-            rbtree& operator=(rbtree&& other)
-            {
-                rbtree tmp{move(other)};
-                tmp.swap(*this);
-
-                return *this;
-            }
-
-            bool empty() const noexcept
-            {
-                return size_ == 0U;
-            }
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type max_size(allocator_type& alloc)
-            {
-                return allocator_traits<allocator_type>::max_size(alloc);
-            }
-
-            iterator begin()
-            {
-                return iterator{find_smallest_(), false};
-            }
-
-            const_iterator begin() const
-            {
-                return cbegin();
-            }
-
-            iterator end()
-            {
-                /**
-                 * In case we have lists of nodes
-                 * we need to get the actual end
-                 * from the largest node.
-                 */
-                auto res = find_largest_();
-                if (res)
-                    return iterator{res->get_end(), true};
-                else
-                    return iterator{res, true};
-            }
-
-            const_iterator end() const
-            {
-                return cend();
-            }
-
-            reverse_iterator rbegin()
-            {
-                return make_reverse_iterator(end());
-            }
-
-            const_reverse_iterator rbegin() const
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            reverse_iterator rend()
-            {
-                return make_reverse_iterator(begin());
-            }
-
-            const_reverse_iterator rend() const
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            const_iterator cbegin() const
-            {
-                return const_iterator{find_smallest_(), false};
-            }
-
-            const_iterator cend() const
-            {
-                auto res = find_largest_();
-                if (res)
-                    return const_iterator{res->get_end(), true};
-                else
-                    return const_iterator{res, true};
-            }
-
-            const_reverse_iterator crbegin() const
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            const_reverse_iterator crend() const
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            template<class... Args>
-            auto emplace(Args&&... args)
-            {
-                return Policy::emplace(*this, forward<Args>(args)...);
-            }
-
-            auto insert(const value_type& val)
-            {
-                return Policy::insert(*this, val);
-            }
-
-            auto insert(value_type&& val)
-            {
-                return Policy::insert(*this, forward<value_type>(val));
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return Policy::erase(*this, key);
-            }
-
-            iterator erase(const_iterator it)
-            {
-                if (it == cend())
-                    return end();
-
-                auto node = const_cast<node_type*>(it.node());
-
-                node = delete_node(node);
-                if (!node)
-                    return iterator{find_largest_(), true};
-                else
-                    return iterator{const_cast<node_type*>(node), false};
-            }
-
-            void clear() noexcept
-            {
-                if (root_)
-                {
-                    delete root_;
-                    root_ = nullptr;
-                    size_ = size_type{};
-                }
-            }
-
-            void swap(rbtree& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<KeyComp&>(), declval<KeyComp&>())))
-            {
-                std::swap(root_, other.root_);
-                std::swap(size_, other.size_);
-                std::swap(key_compare_, other.key_compare_);
-                std::swap(key_extractor_, other.key_extractor_);
-            }
-
-            key_compare key_comp() const
-            {
-                return key_compare_;
-            }
-
-            iterator find(const key_type& key)
-            {
-                auto node = find_(key);
-                if (node)
-                    return iterator{node, false};
-                else
-                    return end();
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                auto node = find_(key);
-                if (node)
-                    return const_iterator{node, false};
-                else
-                    return end();
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return Policy::count(*this, key);
-            }
-
-            iterator upper_bound(const key_type& key)
-            {
-                return Policy::upper_bound(*this, key);
-            }
-
-            const_iterator upper_bound(const key_type& key) const
-            {
-                return Policy::upper_bound_const(*this, key);
-            }
-
-            iterator lower_bound(const key_type& key)
-            {
-                return Policy::lower_bound(*this, key);
-            }
-
-            const_iterator lower_bound(const key_type& key) const
-            {
-                return Policy::lower_bound_const(*this, key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return Policy::equal_range(*this, key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return Policy::equal_range_const(*this, key);
-            }
-
-            bool is_eq_to(const rbtree& other) const
-            {
-                if (size_ != other.size())
-                    return false;
-
-                auto it1 = begin();
-                auto it2 = other.begin();
-
-                // TODO: this doesn't compare values :/
-                while (keys_equal(*it1++, *it2++))
-                { /* DUMMY BODY */ }
-
-                return (it1 == end()) && (it2 == other.end());
-            }
-
-            const key_type& get_key(const value_type& val) const
-            {
-                return key_extractor_(val);
-            }
-
-            bool keys_comp(const key_type& key, const value_type& val) const
-            {
-                return key_compare_(key, key_extractor_(val));
-            }
-
-            bool keys_equal(const key_type& k1, const key_type& k2) const
-            {
-                return !key_compare_(k1, k2) && !key_compare_(k2, k1);
-            }
-
-            node_type* find_parent_for_insertion(const key_type& key) const
-            {
-                auto current = root_;
-                auto parent = current;
-
-                while (current)
-                {
-                    parent = current;
-                    if (key_compare_(key, key_extractor_(current->value)))
-                        current = current->left();
-                    else if (key_compare_(key_extractor_(current->value), key))
-                        current = current->right();
-                    else
-                        return current;
-                }
-
-                return parent;
-            }
-
-            node_type* delete_node(const node_type* n)
-            {
-                auto node = const_cast<node_type*>(n);
-                if (!node)
-                    return nullptr;
-
-                --size_;
-
-                auto succ = node->successor();
-                if (auto tmp = node->get_node_for_deletion(); tmp != nullptr)
-                {
-                    /**
-                     * This will kick in multi containers,
-                     * we popped one node from a list of nodes
-                     * with equivalent keys and we can delete it
-                     * and return the successor which was the next
-                     * in the list.
-                     */
-                    delete tmp;
-
-                    update_root_(succ); // Incase the first in list was root.
-                    return succ;
-                }
-                else if (node == root_)
-                { // Only executed if root_ is unique.
-                    root_ = nullptr;
-                    delete node;
-
-                    return nullptr;
-                }
-
-                if (node->left() && node->right())
-                {
-                    node->swap(succ);
-                    if (succ && !succ->parent())
-                        root_ = succ;
-
-                    // Node now has at most one child.
-                    // Also: If succ was nullptr, the swap
-                    //       didn't do anything and we can
-                    //       safely delete node.
-                    return delete_node(node);
-                }
-
-                auto child = node->right() ? node->right() : node->left();
-                if (!child)
-                {
-                    // Simply remove the node.
-                    // TODO: repair here too?
-                    node->unlink();
-                    delete node;
-                }
-                else
-                {
-                    // Replace with the child.
-                    child->parent(node->parent());
-                    if (node->is_left_child())
-                        child->parent()->left(child);
-                    else if (node->is_right_child())
-                        child->parent()->right(child);
-                    node->parent(nullptr);
-                    node->left(nullptr);
-                    node->right(nullptr);
-
-                    // Repair if needed.
-                    repair_after_erase_(node, child);
-                    update_root_(child);
-
-                    delete node;
-                }
-
-                return succ;
-            }
-
-            void insert_node(node_type* node, node_type* parent)
-            {
-                Policy::insert(*this, node, parent);
-            }
-
-        private:
-            node_type* root_;
-            size_type size_;
-            key_compare key_compare_;
-            key_extract key_extractor_;
-
-            node_type* find_(const key_type& key) const
-            {
-                auto current = root_;
-                while (current != nullptr)
-                {
-                    if (key_compare_(key, key_extractor_(current->value)))
-                        current = current->left();
-                    else if (key_compare_(key_extractor_(current->value), key))
-                        current = current->right();
-                    else
-                        return current;
-                }
-
-                return nullptr;
-            }
-
-            node_type* find_smallest_() const
-            {
-                if (root_)
-                    return root_->find_smallest();
-                else
-                    return nullptr;
-            }
-
-            node_type* find_largest_() const
-            {
-                if (root_)
-                    return root_->find_largest();
-                else
-                    return nullptr;
-            }
-
-            void update_root_(const node_type* node)
-            {
-                if (!node)
-                    return;
-
-                root_ = const_cast<node_type*>(node);
-                while (root_->parent())
-                    root_ = root_->parent();
-            }
-
-            void repair_after_insert_(const node_type* node)
-            {
-                // TODO: implement
-            }
-
-            void repair_after_erase_(const node_type* node, const node_type* child)
-            {
-                // TODO: implement
-            }
-
-            friend Policy;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/rbtree_iterators.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/rbtree_iterators.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_RBTREE_ITERATORS
-#define LIBCPP_BITS_ADT_RBTREE_ITERATORS
-
-#include <__bits/adt/rbtree_node.hpp>
-#include <__bits/iterator_helpers.hpp>
-#include <iterator>
-
-namespace std::aux
-{
-    /**
-     * Note: In order for these iterators to be reversible,
-     *       the end state of an iterator is represented by a flag
-     *       which can be set from true to false in operator--
-     *       (i.e. decrementing end iterator) or set from false to
-     *       true in operator++ (i.e. incrementing last before end
-     *       iterator).
-     */
-
-    template<class Value, class Reference, class Pointer, class Size, class Node>
-    class rbtree_iterator
-    {
-        public:
-            using value_type      = Value;
-            using size_type       = Size;
-            using reference       = Reference;
-            using pointer         = Pointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = bidirectional_iterator_tag;
-
-            using node_type = Node;
-
-            rbtree_iterator(node_type* current = nullptr, bool end = true)
-                : current_{current}, end_{end}
-            { /* DUMMY BODY */ }
-
-            rbtree_iterator(const rbtree_iterator&) = default;
-            rbtree_iterator& operator=(const rbtree_iterator&) = default;
-
-            reference operator*() const
-            {
-                return current_->value;
-            }
-
-            pointer operator->() const
-            {
-                return &current_->value;
-            }
-
-            rbtree_iterator& operator++()
-            {
-                if (end_)
-                    return *this;
-
-                if (current_)
-                {
-                    auto next = current_->successor();
-                    if (next)
-                        current_ = next;
-                    else
-                        end_ = true;
-                }
-
-                return *this;
-            }
-
-            rbtree_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-            rbtree_iterator& operator--()
-            {
-                if (end_)
-                {
-                    end_ = false;
-
-                    return *this;
-                }
-
-                if (current_)
-                {
-                    auto next = current_->predecessor();
-                    if (next)
-                        current_ = next;
-                    else
-                        end_ = true;
-                }
-
-                return *this;
-            }
-
-            rbtree_iterator operator--(int)
-            {
-                auto tmp = *this;
-                --(*this);
-
-                return tmp;
-            }
-
-            const node_type* node() const
-            {
-                return current_;
-            }
-
-            node_type* node()
-            {
-                return current_;
-            }
-
-            bool end() const
-            {
-                return end_;
-            }
-
-        private:
-            node_type* current_;
-            bool end_;
-    };
-
-    template<class Val, class Ref, class Ptr, class Sz, class N>
-    bool operator==(const rbtree_iterator<Val, Ref, Ptr, Sz, N>& lhs,
-                    const rbtree_iterator<Val, Ref, Ptr, Sz, N>& rhs)
-    {
-        return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-    }
-
-    template<class Val, class Ref, class Ptr, class Sz, class N>
-    bool operator!=(const rbtree_iterator<Val, Ref, Ptr, Sz, N>& lhs,
-                    const rbtree_iterator<Val, Ref, Ptr, Sz, N>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Value, class ConstReference, class ConstPointer, class Size, class Node>
-    class rbtree_const_iterator
-    {
-        using non_const_iterator_type = rbtree_iterator<
-            Value, get_non_const_ref_t<ConstReference>,
-            get_non_const_ptr_t<ConstPointer>, Size, Node
-        >;
-
-        public:
-            using value_type      = Value;
-            using size_type       = Size;
-            using const_reference = ConstReference;
-            using const_pointer   = ConstPointer;
-            using difference_type = ptrdiff_t;
-
-            using iterator_category = bidirectional_iterator_tag;
-
-            // For iterator_traits.
-            using reference = ConstReference;
-            using pointer   = ConstPointer;
-
-            using node_type = Node;
-
-            rbtree_const_iterator(const node_type* current = nullptr, bool end = true)
-                : current_{current}, end_{end}
-            { /* DUMMY BODY */ }
-
-            rbtree_const_iterator(const rbtree_const_iterator&) = default;
-            rbtree_const_iterator& operator=(const rbtree_const_iterator&) = default;
-
-            rbtree_const_iterator(const non_const_iterator_type& other)
-                : current_{other.node()}, end_{other.end()}
-            { /* DUMMY BODY */ }
-
-            rbtree_const_iterator& operator=(const non_const_iterator_type& other)
-            {
-                current_ = other.node();
-                end_ = other.end();
-
-                return *this;
-            }
-
-            const_reference operator*() const
-            {
-                return current_->value;
-            }
-
-            const_pointer operator->() const
-            {
-                return &current_->value;
-            }
-
-            rbtree_const_iterator& operator++()
-            {
-                if (end_)
-                    return *this;
-
-                if (current_)
-                {
-                    auto next = current_->successor();
-                    if (next)
-                        current_ = next;
-                    else
-                        end_ = true;
-                }
-
-                return *this;
-            }
-
-            rbtree_const_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++(*this);
-
-                return tmp;
-            }
-
-            rbtree_const_iterator& operator--()
-            {
-                if (end_)
-                {
-                    end_ = false;
-
-                    return *this;
-                }
-
-                if (current_)
-                {
-                    auto next = current_->predecessor();
-                    if (next)
-                        current_ = next;
-                    else
-                        end_ = true;
-                }
-
-                return *this;
-            }
-
-            rbtree_const_iterator operator--(int)
-            {
-                auto tmp = *this;
-                --(*this);
-
-                return tmp;
-            }
-
-            const node_type* node() const
-            {
-                return current_;
-            }
-
-            bool end() const
-            {
-                return end_;
-            }
-
-        private:
-            const node_type* current_;
-            bool end_;
-    };
-
-    template<class Val, class CRef, class CPtr, class Sz, class N>
-    bool operator==(const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& lhs,
-                    const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& rhs)
-    {
-        return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-    }
-
-    template<class Val, class CRef, class CPtr, class Sz, class N>
-    bool operator!=(const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& lhs,
-                    const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Val, class Ref, class Ptr, class CRef, class CPtr, class Sz, class N>
-    bool operator==(const rbtree_iterator<Val, Ref, Ptr, Sz, N>& lhs,
-                    const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& rhs)
-    {
-        return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-    }
-
-    template<class Val, class Ref, class Ptr, class CRef, class CPtr, class Sz, class N>
-    bool operator!=(const rbtree_iterator<Val, Ref, Ptr, Sz, N>& lhs,
-                    const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Val, class CRef, class CPtr, class Ref, class Ptr, class Sz, class N>
-    bool operator==(const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& lhs,
-                    const rbtree_iterator<Val, Ref, Ptr, Sz, N>& rhs)
-    {
-        return (lhs.node() == rhs.node()) && (lhs.end() == rhs.end());
-    }
-
-    template<class Val, class CRef, class CPtr, class Ref, class Ptr, class Sz, class N>
-    bool operator!=(const rbtree_const_iterator<Val, CRef, CPtr, Sz, N>& lhs,
-                    const rbtree_iterator<Val, Ref, Ptr, Sz, N>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/rbtree_node.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/rbtree_node.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,728 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_RBTREE_NODE
-#define LIBCPP_BITS_ADT_RBTREE_NODE
-
-#include <cassert>
-#include <utility>
-
-namespace std::aux
-{
-    enum class rbcolor
-    {
-        red, black
-    };
-
-    template<class Node>
-    struct rbtree_utils
-    {
-        static Node* grandparent(Node* node)
-        {
-            if (node && node->parent())
-                return node->parent()->parent();
-            else
-                return nullptr;
-        }
-
-        static Node* brother(Node* node)
-        {
-            if (node && node->parent())
-            {
-                if (node == node->parent()->left())
-                    return node->parent()->right();
-                else
-                    return node->parent()->left();
-            }
-            else
-                return nullptr;
-        }
-
-        static Node* uncle(Node* node)
-        {
-            auto gp = grandparent(node);
-            if (gp)
-            {
-                if (node->parent() == gp->left())
-                    return gp->right();
-                else
-                    return gp->left();
-            }
-            else
-                return nullptr;
-        }
-
-        static bool is_left_child(const Node* node)
-        {
-            if (!node)
-                return false;
-
-            if (node->parent())
-                return node->parent()->left() == node;
-            else
-                return false;
-        }
-
-        static bool is_right_child(const Node* node)
-        {
-            if (!node)
-                return false;
-
-            if (node->parent())
-                return node->parent()->right() == node;
-            else
-                return false;
-        }
-
-        static void rotate_left(Node* node)
-        {
-            // TODO: implement
-        }
-
-        static void rotate_right(Node* node)
-        {
-            // TODO: implement
-        }
-
-        static Node* find_smallest(Node* node)
-        {
-            return const_cast<Node*>(find_smallest(const_cast<const Node*>(node)));
-        }
-
-        static const Node* find_smallest(const Node* node)
-        {
-            if (!node)
-                return nullptr;
-
-            while (node->left())
-                node = node->left();
-
-            return node;
-        }
-
-        static Node* find_largest(Node* node)
-        {
-            return const_cast<Node*>(find_largest(const_cast<const Node*>(node)));
-        }
-
-        static const Node* find_largest(const Node* node)
-        {
-            if (!node)
-                return nullptr;
-
-            while (node->right())
-                node = node->right();
-
-            return node;
-        }
-
-        static Node* successor(Node* node)
-        {
-            return const_cast<Node*>(successor(const_cast<const Node*>(node)));
-        }
-
-        static const Node* successor(const Node* node)
-        {
-            if (!node)
-                return nullptr;
-
-            if (node->right())
-                return find_smallest(node->right());
-            else
-            {
-                while (node && !is_left_child(node))
-                    node = node->parent();
-
-                if (node)
-                    return node->parent();
-                else
-                    return node;
-            }
-        }
-
-        static Node* predecessor(Node* node)
-        {
-            return const_cast<Node*>(predecessor(const_cast<const Node*>(node)));
-        }
-
-        static const Node* predecessor(const Node* node)
-        {
-            if (!node)
-                return nullptr;
-
-            if (node->left())
-                return find_largest(node->left());
-            else
-            {
-                while (node && is_left_child(node))
-                    node = node->parent();
-
-                if (node)
-                    return node->parent();
-                else
-                    return node;
-            }
-        }
-
-        static void add_left_child(Node* node, Node* child)
-        {
-            if (!node || !child)
-                return;
-
-            node->left(child);
-            child->parent(node);
-        }
-
-        static void add_right_child(Node* node, Node* child)
-        {
-            if (!node || !child)
-                return;
-
-            node->right(child);
-            child->parent(node);
-        }
-
-        static void swap(Node* node1, Node* node2)
-        {
-            if (!node1 || !node2)
-                return;
-
-            auto parent1 = node1->parent();
-            auto left1 = node1->left();
-            auto right1 = node1->right();
-            auto is_right1 = is_right_child(node1);
-
-            auto parent2 = node2->parent();
-            auto left2 = node2->left();
-            auto right2 = node2->right();
-            auto is_right2 = is_right_child(node2);
-
-            assimilate(node1, parent2, left2, right2, is_right2);
-            assimilate(node2, parent1, left1, right1, is_right1);
-        }
-
-        static void assimilate(
-            Node* node, Node* p, Node* l, Node* r, bool is_r
-        )
-        {
-            if (!node)
-                return;
-
-            node->parent(p);
-            if (node->parent())
-            {
-                if (is_r)
-                    node->parent()->right(node);
-                else
-                    node->parent()->left(node);
-            }
-
-            node->left(l);
-            if (node->left())
-                node->left()->parent(node);
-
-            node->right(r);
-            if (node->right())
-                node->right()->parent(node);
-        }
-    };
-
-    template<class T>
-    struct rbtree_single_node
-    {
-        using utils = rbtree_utils<rbtree_single_node<T>>;
-
-        public:
-            T value;
-            rbcolor color;
-
-            template<class... Args>
-            rbtree_single_node(Args&&... args)
-                : value{forward<Args>(args)...}, color{rbcolor::red},
-                  parent_{}, left_{}, right_{}
-            { /* DUMMY BODY */ }
-
-            rbtree_single_node* parent() const
-            {
-                return parent_;
-            }
-
-            void parent(rbtree_single_node* node)
-            {
-                parent_ = node;
-            }
-
-            rbtree_single_node* left() const
-            {
-                return left_;
-            }
-
-            void left(rbtree_single_node* node)
-            {
-                left_ = node;
-            }
-
-            rbtree_single_node* right() const
-            {
-                return right_;
-            }
-
-            void right(rbtree_single_node* node)
-            {
-                right_ = node;
-            }
-
-            rbtree_single_node* grandparent()
-            {
-                return utils::grandparent(this);
-            }
-
-            rbtree_single_node* brother()
-            {
-                return utils::brother(this);
-            }
-
-            rbtree_single_node* uncle()
-            {
-                return utils::uncle(this);
-            }
-
-            bool is_left_child() const
-            {
-                return utils::is_left_child(this);
-            }
-
-            bool is_right_child() const
-            {
-                return utils::is_right_child(this);
-            }
-
-            void rotate_left()
-            {
-                utils::rotate_left(this);
-            }
-
-            void rotate_right()
-            {
-                utils::rotate_right(this);
-            }
-
-            rbtree_single_node* find_smallest()
-            {
-                return utils::find_smallest(this);
-            }
-
-            const rbtree_single_node* find_smallest() const
-            {
-                return utils::find_smallest(this);
-            }
-
-            rbtree_single_node* find_largest()
-            {
-                return utils::find_largest(this);
-            }
-
-            const rbtree_single_node* find_largest() const
-            {
-                return utils::find_largest(this);
-            }
-
-            rbtree_single_node* successor()
-            {
-                return utils::successor(this);
-            }
-
-            const rbtree_single_node* successor() const
-            {
-                return utils::successor(this);
-            }
-
-            rbtree_single_node* predecessor()
-            {
-                return utils::predecessor(this);
-            }
-
-            const rbtree_single_node* predecessor() const
-            {
-                return utils::predecessor(this);
-            }
-
-            void add_left_child(rbtree_single_node* node)
-            {
-                utils::add_left_child(this, node);
-            }
-
-            void add_right_child(rbtree_single_node* node)
-            {
-                utils::add_right_child(this, node);
-            }
-
-            void swap(rbtree_single_node* other)
-            {
-                utils::swap(this, other);
-            }
-
-            void unlink()
-            {
-                if (is_left_child())
-                    parent_->left_ = nullptr;
-                else if (is_right_child())
-                    parent_->right_ = nullptr;
-            }
-
-            rbtree_single_node* get_node_for_deletion()
-            {
-                return nullptr;
-            }
-
-            rbtree_single_node* get_end()
-            {
-                return this;
-            }
-
-            const rbtree_single_node* get_end() const
-            {
-                return this;
-            }
-
-            ~rbtree_single_node()
-            {
-                parent_ = nullptr;
-                if (left_)
-                    delete left_;
-                if (right_)
-                    delete right_;
-            }
-
-        private:
-            rbtree_single_node* parent_;
-            rbtree_single_node* left_;
-            rbtree_single_node* right_;
-    };
-
-    template<class T>
-    struct rbtree_multi_node
-    {
-        using utils = rbtree_utils<rbtree_multi_node<T>>;
-
-        public:
-            T value;
-            rbcolor color;
-
-            template<class... Args>
-            rbtree_multi_node(Args&&... args)
-                : value{forward<Args>(args)...}, color{rbcolor::red},
-                  parent_{}, left_{}, right_{}, next_{}, first_{}
-            {
-                first_ = this;
-            }
-
-            rbtree_multi_node* parent() const
-            {
-                return parent_;
-            }
-
-            void parent(rbtree_multi_node* node)
-            {
-                parent_ = node;
-
-                auto tmp = first_;
-                while (tmp)
-                {
-                    tmp->parent_ = node;
-                    tmp = tmp->next_;
-                }
-            }
-
-            rbtree_multi_node* left() const
-            {
-                return left_;
-            }
-
-            void left(rbtree_multi_node* node)
-            {
-                left_ = node;
-
-                auto tmp = first_;
-                while (tmp)
-                {
-                    tmp->left_ = node;
-                    tmp = tmp->next_;
-                }
-            }
-
-            rbtree_multi_node* right() const
-            {
-                return right_;
-            }
-
-            void right(rbtree_multi_node* node)
-            {
-                right_ = node;
-
-                auto tmp = first_;
-                while (tmp)
-                {
-                    tmp->right_ = node;
-                    tmp = tmp->next_;
-                }
-            }
-
-            rbtree_multi_node* grandparent()
-            {
-                return utils::grandparent(this);
-            }
-
-            rbtree_multi_node* brother()
-            {
-                return utils::brother(this);
-            }
-
-            rbtree_multi_node* uncle()
-            {
-                return utils::uncle(this);
-            }
-
-            bool is_left_child() const
-            {
-                return utils::is_left_child(this);
-            }
-
-            bool is_right_child()
-            {
-                return utils::is_right_child(this);
-            }
-
-            void rotate_left()
-            {
-                utils::rotate_left(this);
-            }
-
-            void rotate_right()
-            {
-                utils::rotate_right(this);
-            }
-
-            rbtree_multi_node* find_smallest()
-            {
-                return utils::find_smallest(this);
-            }
-
-            const rbtree_multi_node* find_smallest() const
-            {
-                return utils::find_smallest(this);
-            }
-
-            rbtree_multi_node* find_largest()
-            {
-                return utils::find_largest(this);
-            }
-
-            const rbtree_multi_node* find_largest() const
-            {
-                return utils::find_largest(this);
-            }
-
-            rbtree_multi_node* successor()
-            {
-                return const_cast<
-                    rbtree_multi_node*
-                >(const_cast<const rbtree_multi_node*>(this)->successor());
-            }
-
-            const rbtree_multi_node* successor() const
-            {
-                if (next_)
-                    return next_;
-                else
-                    return utils::successor(this);
-            }
-
-            rbtree_multi_node* predecessor()
-            {
-                return const_cast<
-                    rbtree_multi_node*
-                >(const_cast<const rbtree_multi_node*>(this)->predecessor());
-            }
-
-            const rbtree_multi_node* predecessor() const
-            {
-                if (this != first_)
-                {
-                    auto tmp = first_;
-                    while (tmp->next_ != this)
-                        tmp = tmp->next_;
-
-                    return tmp;
-                }
-                else
-                {
-                    auto tmp = utils::predecessor(this);
-
-                    /**
-                     * If tmp was duplicate, we got a pointer
-                     * to the first node in the list. So we need
-                     * to move to the end.
-                     */
-                    while (tmp->next_ != nullptr)
-                        tmp = tmp->next_;
-
-                    return tmp;
-                }
-            }
-
-            void add_left_child(rbtree_multi_node* node)
-            {
-                utils::add_left_child(this, node);
-            }
-
-            void add_right_child(rbtree_multi_node* node)
-            {
-                utils::add_right_child(this, node);
-            }
-
-            void swap(rbtree_multi_node* other)
-            {
-                utils::swap(this, other);
-            }
-
-            rbtree_multi_node* get_node_for_deletion()
-            {
-                /**
-                 * To make sure we delete nodes in
-                 * the order of their insertion
-                 * (not required, but sensical), we
-                 * update then list and return this
-                 * for deletion.
-                 */
-                if (next_)
-                {
-                    // Make next the new this.
-                    next_->first_ = next_;
-                    if (is_left_child())
-                        parent_->left_ = next_;
-                    else if (is_right_child())
-                        parent_->right_ = next_;
-
-                    if (left_)
-                        left_->parent_ = next_;
-                    if (right_)
-                        right_->parent_ = next_;
-
-                    /**
-                     * Update the first_ pointer
-                     * of the rest of the list.
-                     */
-                    auto tmp = next_->next_;
-                    while (tmp)
-                    {
-                        tmp->first_ = next_;
-                        tmp = tmp->next_;
-                    }
-
-                    /**
-                     * Otherwise destructor could
-                     * destroy them.
-                     */
-                    parent_ = nullptr;
-                    left_ = nullptr;
-                    right_ = nullptr;
-                    next_ = nullptr;
-                    first_ = nullptr;
-
-                    return this; // This will get deleted.
-                }
-                else
-                    return nullptr;
-            }
-
-            void unlink()
-            {
-                if (is_left_child())
-                    parent_->left_ = nullptr;
-                else if (is_right_child())
-                    parent_->right_ = nullptr;
-            }
-
-            void add(rbtree_multi_node* node)
-            {
-                if (next_)
-                    next_->add(node);
-                else
-                {
-                    next_ = node;
-                    next_->first_ = first_;
-                    next_->parent_ = parent_;
-                    next_->left_ = left_;
-                    next_->right_ = right_;
-                }
-            }
-
-            rbtree_multi_node* get_end()
-            {
-                return const_cast<rbtree_multi_node*>(
-                    const_cast<const rbtree_multi_node*>(this)->get_end()
-                );
-            }
-
-            const rbtree_multi_node* get_end() const
-            {
-                if (!next_)
-                    return this;
-                else
-                {
-                    auto tmp = next_;
-                    while (tmp->next_)
-                        tmp = tmp->next_;
-
-                    return tmp;
-                }
-            }
-
-            ~rbtree_multi_node()
-            {
-                parent_ = nullptr;
-                if (left_)
-                    delete left_;
-                if (right_)
-                    delete right_;
-
-                // TODO: delete the list
-            }
-
-        private:
-            rbtree_multi_node* parent_;
-            rbtree_multi_node* left_;
-            rbtree_multi_node* right_;
-
-            rbtree_multi_node* next_;
-            rbtree_multi_node* first_;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/rbtree_policies.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/rbtree_policies.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,458 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_RBTREE_POLICIES
-#define LIBCPP_BITS_ADT_RBTREE_POLICIES
-
-#include <__bits/adt/rbtree_node.hpp>
-#include <utility>
-
-namespace std::aux
-{
-    struct rbtree_single_policy
-    {
-        template<class Tree, class Key>
-        static typename Tree::size_type count(const Tree& tree, const Key& key)
-        {
-            return tree.find(key) == tree.end() ? 0 : 1;
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::size_type erase(Tree& tree, const Key& key)
-        {
-            using size_type = typename Tree::size_type;
-
-            auto it = tree.find(key);
-            if (it == tree.end())
-                return size_type{};
-            else
-                tree.delete_node(it.node());
-            return size_type{1};
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::iterator lower_bound(const Tree& tree, const Key& key)
-        {
-            using iterator  = typename Tree::iterator;
-            using node_type = typename Tree::node_type;
-
-            auto it = lower_bound_const(tree, key);
-
-            return iterator{const_cast<node_type*>(it.node()), it.end()};
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::const_iterator lower_bound_const(const Tree& tree, const Key& key)
-        {
-            using const_iterator = typename Tree::const_iterator;
-
-            auto node = tree.find_parent_for_insertion(key);
-            const_iterator it{node, false};
-            auto beg = tree.begin();
-            auto end = tree.end();
-
-            if (tree.key_compare_(tree.get_key(*it), key))
-            {
-                // Predecessor.
-                if (it != end)
-                    return ++it;
-                else
-                    return it;
-            }
-            else if (tree.key_compare_(key, tree.get_key(*it)))
-            {
-                // Successor.
-                if (it != beg)
-                    return --it;
-                else
-                    return it;
-            }
-            else // Perfect match.
-                return it;
-
-            return it;
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::iterator upper_bound(const Tree& tree, const Key& key)
-        {
-            using iterator  = typename Tree::iterator;
-            using node_type = typename Tree::node_type;
-
-            auto it = upper_bound_const(tree, key);
-
-            return iterator{const_cast<node_type*>(it.node()), it.end()};
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::const_iterator upper_bound_const(const Tree& tree, const Key& key)
-        {
-            /**
-             * If key isn't in the tree, we get it's
-             * predecessor or tree.end(). If key is
-             * in the tree, we get it. So unless it
-             * is equal to end(), we can increment it
-             * to get the upper bound.
-             */
-            auto it = lower_bound_const(tree, key);
-            if (it == tree.end())
-                return it;
-            else
-                return ++it;
-        }
-
-        template<class Tree, class Key>
-        static pair<
-            typename Tree::iterator,
-            typename Tree::iterator
-        > equal_range(Tree& tree, const Key& key)
-        {
-            return make_pair(
-                lower_bound(tree, key),
-                upper_bound(tree, key)
-            );
-        }
-
-        template<class Tree, class Key>
-        static pair<
-            typename Tree::const_iterator,
-            typename Tree::const_iterator
-        > equal_range_const(const Tree& tree, const Key& key)
-        {
-            return make_pair(
-                lower_bound_const(tree, key),
-                upper_bound_const(tree, key)
-            );
-        }
-
-        /**
-         * Note: We have to duplicate code for emplace, insert(const&)
-         *       and insert(&&) here, because the node (which makes distinction
-         *       between the arguments) is only created if the value isn't
-         *       in the tree already.
-         */
-
-        template<class Tree, class... Args>
-        static pair<
-            typename Tree::iterator, bool
-        > emplace(Tree& tree, Args&&... args)
-        {
-            using value_type = typename Tree::value_type;
-            using iterator   = typename Tree::iterator;
-            using node_type  = typename Tree::node_type;
-
-            auto val = value_type{forward<Args>(args)...};
-            auto parent = tree.find_parent_for_insertion(tree.get_key(val));
-
-            if (parent && tree.keys_equal(tree.get_key(parent->value), tree.get_key(val)))
-                return make_pair(iterator{parent, false}, false);
-
-            auto node = new node_type{move(val)};
-
-            return insert(tree, node, parent);
-        }
-
-        template<class Tree, class Value>
-        static pair<
-            typename Tree::iterator, bool
-        > insert(Tree& tree, const Value& val)
-        {
-            using iterator  = typename Tree::iterator;
-            using node_type = typename Tree::node_type;
-
-            auto parent = tree.find_parent_for_insertion(tree.get_key(val));
-            if (parent && tree.keys_equal(tree.get_key(parent->value), tree.get_key(val)))
-                return make_pair(iterator{parent, false}, false);
-
-            auto node = new node_type{val};
-
-            return insert(tree, node, parent);
-        }
-
-        template<class Tree, class Value>
-        static pair<
-            typename Tree::iterator, bool
-        > insert(Tree& tree, Value&& val)
-        {
-            using iterator  = typename Tree::iterator;
-            using node_type = typename Tree::node_type;
-
-            auto parent = tree.find_parent_for_insertion(tree.get_key(val));
-            if (parent && tree.keys_equal(tree.get_key(parent->value), tree.get_key(val)))
-                return make_pair(iterator{parent, false}, false);
-
-            auto node = new node_type{forward<Value>(val)};
-
-            return insert(tree, node, parent);
-        }
-
-        template<class Tree>
-        static pair<
-            typename Tree::iterator, bool
-        > insert(
-            Tree& tree, typename Tree::node_type* node,
-            typename Tree::node_type* parent
-        )
-        {
-            using iterator  = typename Tree::iterator;
-
-            if (!node)
-                return make_pair(tree.end(), false);
-
-            ++tree.size_;
-            if (!parent)
-            {
-                node->color = rbcolor::black;
-                tree.root_ = node;
-            }
-            else
-            {
-                if (tree.keys_comp(tree.get_key(node->value), parent->value))
-                    parent->add_left_child(node);
-                else
-                    parent->add_right_child(node);
-
-                tree.repair_after_insert_(node);
-                tree.update_root_(node);
-            }
-
-            return make_pair(iterator{node, false}, true);
-        }
-    };
-
-    struct rbtree_multi_policy
-    {
-        template<class Tree, class Key>
-        static typename Tree::size_type count(const Tree& tree, const Key& key)
-        {
-            using size_type = typename Tree::size_type;
-
-            auto it = tree.find(key);
-            if (it == tree.end())
-                return size_type{};
-
-            size_type res{};
-            while (it != tree.end() && tree.keys_equal(tree.get_key(*it), key))
-            {
-                ++res;
-                ++it;
-            }
-
-            return res;
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::size_type erase(Tree& tree, const Key& key)
-        {
-            using size_type = typename Tree::size_type;
-
-            auto it = tree.find(key);
-            if (it == tree.end())
-                return size_type{};
-
-            size_type res{};
-            while (it != tree.end() && tree.keys_equal(tree.get_key(*it), key))
-            {
-                ++res;
-                it = tree.erase(it);
-            }
-
-            return res;
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::iterator lower_bound(const Tree& tree, const Key& key)
-        {
-            auto it = lower_bound_const(tree, key);
-
-            return typename Tree::iterator{
-                const_cast<typename Tree::node_type*>(it.node()), it.end()
-            };
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::const_iterator lower_bound_const(const Tree& tree, const Key& key)
-        {
-            using const_iterator = typename Tree::const_iterator;
-
-            auto node = tree.find_parent_for_insertion(key);
-            const_iterator it{node, false};
-            auto beg = tree.begin();
-            auto end = tree.end();
-
-            if (tree.keys_comp(key, *it))
-                --it; // Incase we are on a successor.
-            while (tree.keys_equal(tree.get_key(*it), key) && it != beg)
-                --it; // Skip keys that are equal.
-            if (it != beg)
-                ++it; // If we moved all the way to the start, key is the smallest.
-
-            if (tree.key_compare_(tree.get_key(*it), key))
-            {
-                // Predecessor.
-                if (it != end)
-                    return ++it;
-                else
-                    return it;
-            }
-
-            return it;
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::iterator upper_bound(const Tree& tree, const Key& key)
-        {
-            auto it = upper_bound_const(tree, key);
-
-            return typename Tree::iterator{
-                const_cast<typename Tree::node_type*>(it.node()), it.end()
-            };
-        }
-
-        template<class Tree, class Key>
-        static typename Tree::const_iterator upper_bound_const(const Tree& tree, const Key& key)
-        {
-            /**
-             * If key isn't in the tree, we get it's
-             * predecessor or tree.end(). If key is
-             * in the tree, we get it. So unless it
-             * is equal to end(), we keep incrementing
-             * until we get to the next key.
-             */
-            auto it = lower_bound(tree, key);
-            if (it == tree.end())
-                return it;
-            else if (tree.keys_equal(tree.get_key(*it), key))
-            {
-                while (it != tree.end() && tree.keys_equal(tree.get_key(*it), key))
-                    ++it;
-
-                return it;
-            }
-
-            return it;
-        }
-
-        template<class Tree, class Key>
-        static pair<
-            typename Tree::iterator,
-            typename Tree::iterator
-        > equal_range(const Tree& tree, const Key& key)
-        {
-            return make_pair(
-                lower_bound(tree, key),
-                upper_bound(tree, key)
-            );
-        }
-
-        template<class Tree, class Key>
-        static pair<
-            typename Tree::const_iterator,
-            typename Tree::const_iterator
-        > equal_range_const(const Tree& tree, const Key& key)
-        {
-            return make_pair(
-                lower_bound_const(tree, key),
-                upper_bound_const(tree, key)
-            );
-        }
-
-        template<class Tree, class... Args>
-        static typename Tree::iterator emplace(Tree& tree, Args&&... args)
-        {
-            using node_type  = typename Tree::node_type;
-
-            auto node = new node_type{forward<Args>(args)...};
-
-            return insert(tree, node);
-        }
-
-        template<class Tree, class Value>
-        static typename Tree::iterator insert(Tree& tree, const Value& val)
-        {
-            using node_type = typename Tree::node_type;
-
-            auto node = new node_type{val};
-
-            return insert(tree, node);
-        }
-
-        template<class Tree, class Value>
-        static typename Tree::iterator insert(Tree& tree, Value&& val)
-        {
-            using node_type = typename Tree::node_type;
-
-            auto node = new node_type{forward<Value>(val)};
-
-            return insert(tree, node);
-        }
-
-        template<class Tree>
-        static typename Tree::iterator insert(
-            Tree& tree, typename Tree::node_type* node,
-            typename Tree::node_type* = nullptr
-        )
-        {
-            using iterator  = typename Tree::iterator;
-
-            if (!node)
-                return tree.end();
-
-            auto parent = tree.find_parent_for_insertion(tree.get_key(node->value));
-
-            ++tree.size_;
-            if (!parent)
-            {
-                node->color = rbcolor::black;
-                tree.root_ = node;
-            }
-            else
-            {
-                if (tree.keys_comp(tree.get_key(node->value), parent->value))
-                    parent->add_left_child(node);
-                else if (tree.keys_comp(tree.get_key(parent->value), node->value))
-                    parent->add_right_child(node);
-                else
-                {
-                    parent->add(node); // List of nodes with equivalent keys.
-                    tree.update_root_(parent);
-
-                    return iterator{node, false};
-                }
-
-                tree.repair_after_insert_(node);
-                tree.update_root_(node);
-            }
-
-            return iterator{node, false};
-        }
-    };
-}
-
-#endif
-
Index: pace/lib/cpp/include/__bits/adt/set.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/set.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1003 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_SET
-#define LIBCPP_BITS_ADT_SET
-
-#include <__bits/adt/rbtree.hpp>
-#include <functional>
-#include <iterator>
-#include <memory>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.4.6, class template set:
-     */
-
-    template<
-        class Key,
-        class Compare = less<Key>,
-        class Alloc = allocator<Key>
-    >
-    class set
-    {
-        public:
-            using key_type        = Key;
-            using value_type      = Key;
-            using key_compare     = Compare;
-            using value_compare   = Compare;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using node_type = aux::rbtree_single_node<value_type>;
-
-            /**
-             * Note: Both the iterator and const_iterator (and their local variants)
-             *       types are constant iterators, the standard does not require them
-             *       to be the same type, but why not? :)
-             */
-            using iterator             = aux::rbtree_const_iterator<
-                value_type, const_reference, const_pointer, size_type, node_type
-            >;
-            using const_iterator       = iterator;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            set()
-                : set{key_compare{}}
-            { /* DUMMY BODY */ }
-
-            explicit set(const key_compare& comp,
-                         const allocator_type& alloc = allocator_type{})
-                : tree_{comp}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            set(InputIterator first, InputIterator last,
-                const key_compare& comp = key_compare{},
-                const allocator_type& alloc = allocator_type{})
-                : set{comp, alloc}
-            {
-                insert(first, last);
-            }
-
-            set(const set& other)
-                : set{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            set(set&& other)
-                : tree_{move(other.tree_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit set(const allocator_type& alloc)
-                : tree_{}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            set(const set& other, const allocator_type& alloc)
-                : tree_{other.tree_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            set(set&& other, const allocator_type& alloc)
-                : tree_{move(other.tree_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            set(initializer_list<value_type> init,
-                const key_compare& comp = key_compare{},
-                const allocator_type& alloc = allocator_type{})
-                : set{comp, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class InputIterator>
-            set(InputIterator first, InputIterator last,
-                const allocator_type& alloc)
-                : set{first, last, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            set(initializer_list<value_type> init,
-                const allocator_type& alloc)
-                : set{init, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~set()
-            { /* DUMMY BODY */ }
-
-            set& operator=(const set& other)
-            {
-                tree_ = other.tree_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            set& operator=(set&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<key_compare>::value)
-            {
-                tree_ = move(other.tree_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            set& operator=(initializer_list<value_type>& init)
-            {
-                tree_.clear();
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return tree_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return tree_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return tree_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return tree_.end();
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return tree_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return tree_.cend();
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return tree_.crbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return tree_.crend();
-            }
-
-            bool empty() const noexcept
-            {
-                return tree_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return tree_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return tree_.max_size(allocator_);
-            }
-
-            template<class... Args>
-            pair<iterator, bool> emplace(Args&&... args)
-            {
-                return tree_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...).first;
-            }
-
-            pair<iterator, bool> insert(const value_type& val)
-            {
-                return tree_.insert(val);
-            }
-
-            pair<iterator, bool> insert(value_type&& val)
-            {
-                return tree_.insert(forward<value_type>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val).first;
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val)).first;
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return tree_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return tree_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    first.node(), first.end()
-                };
-            }
-
-            void swap(set& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<key_compare>(), declval<key_compare>())))
-            {
-                tree_.swap(other.tree_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            void clear() noexcept
-            {
-                tree_.clear();
-            }
-
-            key_compare key_comp() const
-            {
-                return tree_.key_comp();
-            }
-
-            value_compare value_comp() const
-            {
-                return tree_.value_comp();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return tree_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            const_iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return tree_.count(key);
-            }
-
-            template<class K>
-            size_type count(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.count(key);
-            }
-
-            iterator lower_bound(const key_type& key)
-            {
-                return tree_.lower_bound(key);
-            }
-
-            const_iterator lower_bound(const key_type& key) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            const_iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            iterator upper_bound(const key_type& key)
-            {
-                return tree_.upper_bound(key);
-            }
-
-            const_iterator upper_bound(const key_type& key) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            const_iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return tree_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<iterator, iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<const_iterator, const_iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.equal_range(key);
-            }
-
-        private:
-            using tree_type = aux::rbtree<
-                key_type, key_type, aux::key_no_value_key_extractor<key_type>,
-                key_compare, allocator_type, size_type,
-                iterator, const_iterator,
-                aux::rbtree_single_policy, node_type
-            >;
-
-            tree_type tree_;
-            allocator_type allocator_;
-
-            template<class K, class C, class A>
-            friend bool operator==(const set<K, C, A>&,
-                                   const set<K, C, A>&);
-    };
-
-    template<class Key, class Compare, class Allocator>
-    bool operator==(const set<Key, Compare, Allocator>& lhs,
-                    const set<Key, Compare, Allocator>& rhs)
-    {
-        return lhs.tree_.is_eq_to(rhs.tree_);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<(const set<Key, Compare, Allocator>& lhs,
-                   const set<Key, Compare, Allocator>& rhs)
-    {
-        return lexicographical_compare(
-            lhs.begin(), lhs.end(),
-            rhs.begin(), rhs.end(),
-            lhs.key_comp()
-        );
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator!=(const set<Key, Compare, Allocator>& lhs,
-                    const set<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>(const set<Key, Compare, Allocator>& lhs,
-                   const set<Key, Compare, Allocator>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>=(const set<Key, Compare, Allocator>& lhs,
-                    const set<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<=(const set<Key, Compare, Allocator>& lhs,
-                    const set<Key, Compare, Allocator>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    /**
-     * 23.4.7, class template multiset:
-     */
-
-    template<
-        class Key,
-        class Compare = less<Key>,
-        class Alloc = allocator<Key>
-    >
-    class multiset
-    {
-        public:
-            using key_type        = Key;
-            using value_type      = Key;
-            using key_compare     = Compare;
-            using value_compare   = Compare;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using node_type = aux::rbtree_multi_node<value_type>;
-
-            /**
-             * Note: Both the iterator and const_iterator types are constant
-             *       iterators, the standard does not require them
-             *       to be the same type, but why not? :)
-             */
-            using iterator             = aux::rbtree_const_iterator<
-                value_type, const_reference, const_pointer, size_type, node_type
-            >;
-            using const_iterator       = iterator;
-
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            multiset()
-                : multiset{key_compare{}}
-            { /* DUMMY BODY */ }
-
-            explicit multiset(const key_compare& comp,
-                              const allocator_type& alloc = allocator_type{})
-                : tree_{comp}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            multiset(InputIterator first, InputIterator last,
-                     const key_compare& comp = key_compare{},
-                     const allocator_type& alloc = allocator_type{})
-                : multiset{comp, alloc}
-            {
-                insert(first, last);
-            }
-
-            multiset(const multiset& other)
-                : multiset{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            multiset(multiset&& other)
-                : tree_{move(other.tree_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit multiset(const allocator_type& alloc)
-                : tree_{}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multiset(const multiset& other, const allocator_type& alloc)
-                : tree_{other.tree_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multiset(multiset&& other, const allocator_type& alloc)
-                : tree_{move(other.tree_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            multiset(initializer_list<value_type> init,
-                     const key_compare& comp = key_compare{},
-                     const allocator_type& alloc = allocator_type{})
-                : multiset{comp, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class InputIterator>
-            multiset(InputIterator first, InputIterator last,
-                     const allocator_type& alloc)
-                : multiset{first, last, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            multiset(initializer_list<value_type> init,
-                     const allocator_type& alloc)
-                : multiset{init, key_compare{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~multiset()
-            { /* DUMMY BODY */ }
-
-            multiset& operator=(const multiset& other)
-            {
-                tree_ = other.tree_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            multiset& operator=(multiset&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<key_compare>::value)
-            {
-                tree_ = move(other.tree_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            multiset& operator=(initializer_list<value_type>& init)
-            {
-                tree_.clear();
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            iterator begin() noexcept
-            {
-                return tree_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return tree_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return tree_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return tree_.end();
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return tree_.rbegin();
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return tree_.rend();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return tree_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return tree_.cend();
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return tree_.crbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return tree_.crend();
-            }
-
-            bool empty() const noexcept
-            {
-                return tree_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return tree_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return tree_.max_size(allocator_);
-            }
-
-            template<class... Args>
-            iterator emplace(Args&&... args)
-            {
-                return tree_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...);
-            }
-
-            iterator insert(const value_type& val)
-            {
-                return tree_.insert(val);
-            }
-
-            iterator insert(value_type&& val)
-            {
-                return tree_.insert(forward<value_type>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val);
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return tree_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return tree_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    first.node(), first.end()
-                };
-            }
-
-            void swap(multiset& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<key_compare>(), declval<key_compare>())))
-            {
-                tree_.swap(other.tree_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            void clear() noexcept
-            {
-                tree_.clear();
-            }
-
-            key_compare key_comp() const
-            {
-                return tree_.key_comp();
-            }
-
-            value_compare value_comp() const
-            {
-                return tree_.value_comp();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return tree_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.find(key);
-            }
-
-            template<class K>
-            const_iterator find(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return tree_.count(key);
-            }
-
-            template<class K>
-            size_type count(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.count(key);
-            }
-
-            iterator lower_bound(const key_type& key)
-            {
-                return tree_.lower_bound(key);
-            }
-
-            const_iterator lower_bound(const key_type& key) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.lower_bound(key);
-            }
-
-            template<class K>
-            const_iterator lower_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.lower_bound(key);
-            }
-
-            iterator upper_bound(const key_type& key)
-            {
-                return tree_.upper_bound(key);
-            }
-
-            const_iterator upper_bound(const key_type& key) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.upper_bound(key);
-            }
-
-            template<class K>
-            const_iterator upper_bound(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.upper_bound(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return tree_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<iterator, iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            )
-            {
-                return tree_.equal_range(key);
-            }
-
-            template<class K>
-            pair<const_iterator, const_iterator> equal_range(
-                const K& key,
-                enable_if_t<aux::is_transparent_v<key_compare>, K>* = nullptr
-            ) const
-            {
-                return tree_.equal_range(key);
-            }
-
-        private:
-            using tree_type = aux::rbtree<
-                key_type, key_type, aux::key_no_value_key_extractor<key_type>,
-                key_compare, allocator_type, size_type,
-                iterator, const_iterator,
-                aux::rbtree_multi_policy, node_type
-            >;
-
-            tree_type tree_;
-            allocator_type allocator_;
-
-            template<class K, class C, class A>
-            friend bool operator==(const multiset<K, C, A>&,
-                                   const multiset<K, C, A>&);
-    };
-
-    template<class Key, class Compare, class Allocator>
-    bool operator==(const multiset<Key, Compare, Allocator>& lhs,
-                    const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return lhs.tree_.is_eq_to(rhs.tree_);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<(const multiset<Key, Compare, Allocator>& lhs,
-                   const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return lexicographical_compare(
-            lhs.begin(), lhs.end(),
-            rhs.begin(), rhs.end(),
-            lhs.value_comp()
-        );
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator!=(const multiset<Key, Compare, Allocator>& lhs,
-                    const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>(const multiset<Key, Compare, Allocator>& lhs,
-                   const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator>=(const multiset<Key, Compare, Allocator>& lhs,
-                    const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class Key, class Compare, class Allocator>
-    bool operator<=(const multiset<Key, Compare, Allocator>& lhs,
-                    const multiset<Key, Compare, Allocator>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/stack.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/stack.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_STACK
-#define LIBCPP_BITS_ADT_STACK
-
-#include <deque>
-#include <initializer_list>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.5.6.2, stack:
-     */
-
-    template<class T, class Container = deque<T>>
-    class stack
-    {
-        public:
-            using container_type  = Container;
-            using value_type      = typename container_type::value_type;
-            using reference       = typename container_type::reference;
-            using const_reference = typename container_type::const_reference;
-            using size_type       = typename container_type::size_type;
-
-            explicit stack(container_type& cont)
-                : c{cont}
-            { /* DUMMY BODY */ }
-
-            explicit stack(container_type&& cont = container_type{})
-                : c{move(cont)}
-            { /* DUMMY BODY */ }
-
-            /**
-             * TODO: The allocator constructor should use enable_if
-             *       as a last parameter that checks if uses_allocator
-             *       from <memory> holds.
-             */
-            template<class Alloc>
-            explicit stack(Alloc& alloc)
-                : c{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class Alloc>
-            stack(const container_type& cont, const Alloc& alloc)
-                : c{cont, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class Alloc>
-            stack(container_type&& cont, const Alloc& alloc)
-                : c{move(cont), alloc}
-            { /* DUMMY BODY */ }
-
-            template<class Alloc>
-            stack(const stack& other, const Alloc& alloc)
-                : c{other.c, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class Alloc>
-            stack(stack&& other, const Alloc& alloc)
-                : c{move(other.c), alloc}
-            { /* DUMMY BODY */ }
-
-            bool empty()
-            {
-                return c.empty();
-            }
-
-            size_type size()
-            {
-                return c.size();
-            }
-
-            reference top()
-            {
-                return c.back();
-            }
-
-            const_reference top() const
-            {
-                return c.back();
-            }
-
-            void push(const value_type& val)
-            {
-                c.push_back(val);
-            }
-
-            void push(value_type&& val)
-            {
-                c.push_back(move(val));
-            }
-
-            template<class... Args>
-            void emplace(Args&&... args)
-            {
-                c.emplace_back(forward<Args>(args)...);
-            }
-
-            void pop()
-            {
-                c.pop_back();
-            }
-
-            void swap(stack& other) // We cannot use c in the noexcept :/
-                noexcept(noexcept(declval<container_type>().swap(declval<container_type&>())))
-            {
-                std::swap(c, other.c);
-            }
-
-        protected:
-            container_type c;
-    };
-
-    /**
-     * 23.6.5.5, stack operators:
-     */
-
-    template<class T, class Container>
-    bool operator==(const stack<T, Container>& lhs,
-                    const stack<T, Container>& rhs)
-    {
-        return lhs.c == rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator!=(const stack<T, Container>& lhs,
-                    const stack<T, Container>& rhs)
-    {
-        return lhs.c != rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator<(const stack<T, Container>& lhs,
-                   const stack<T, Container>& rhs)
-    {
-        return lhs.c < rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator<=(const stack<T, Container>& lhs,
-                    const stack<T, Container>& rhs)
-    {
-        return lhs.c <= rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator>(const stack<T, Container>& lhs,
-                   const stack<T, Container>& rhs)
-    {
-        return lhs.c > rhs.c;
-    }
-
-    template<class T, class Container>
-    bool operator>=(const stack<T, Container>& lhs,
-                    const stack<T, Container>& rhs)
-    {
-        return lhs.c >= rhs.c;
-    }
-
-    /**
-     * 23.6.5.6, stack specialized algorithms:
-     */
-
-    template<class T, class Container>
-    void swap(stack<T, Container>& lhs, stack<T, Container>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/unordered_map.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/unordered_map.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1193 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_UNORDERED_MAP
-#define LIBCPP_BITS_ADT_UNORDERED_MAP
-
-#include <__bits/adt/hash_table.hpp>
-#include <initializer_list>
-#include <functional>
-#include <memory>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.5.4, class template unordered_map:
-     */
-
-    template<
-        class Key, class Value,
-        class Hash = hash<Key>,
-        class Pred = equal_to<Key>,
-        class Alloc = allocator<pair<const Key, Value>>
-    >
-    class unordered_map
-    {
-        public:
-            using key_type        = Key;
-            using mapped_type     = Value;
-            using value_type      = pair<const key_type, mapped_type>;
-            using hasher          = Hash;
-            using key_equal       = Pred;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using iterator             = aux::hash_table_iterator<
-                value_type, reference, pointer, size_type
-            >;
-            using const_iterator       = aux::hash_table_const_iterator<
-                value_type, const_reference, const_pointer, size_type
-            >;
-            using local_iterator       = aux::hash_table_local_iterator<
-                value_type, reference, pointer
-            >;
-            using const_local_iterator = aux::hash_table_const_local_iterator<
-                value_type, const_reference, const_pointer
-            >;
-
-            unordered_map()
-                : unordered_map{default_bucket_count_}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_map(size_type bucket_count,
-                                   const hasher& hf = hasher{},
-                                   const key_equal& eql = key_equal{},
-                                   const allocator_type& alloc = allocator_type{})
-                : table_{bucket_count, hf, eql}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_map(InputIterator first, InputIterator last,
-                          size_type bucket_count = default_bucket_count_,
-                          const hasher& hf = hasher{},
-                          const key_equal& eql = key_equal{},
-                          const allocator_type& alloc = allocator_type{})
-                : unordered_map{bucket_count, hf, eql, alloc}
-            {
-                insert(first, last);
-            }
-
-            unordered_map(const unordered_map& other)
-                : unordered_map{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            unordered_map(unordered_map&& other)
-                : table_{move(other.table_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_map(const allocator_type& alloc)
-                : table_{default_bucket_count_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(const unordered_map& other, const allocator_type& alloc)
-                : table_{other.table_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(unordered_map&& other, const allocator_type& alloc)
-                : table_{move(other.table_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(initializer_list<value_type> init,
-                          size_type bucket_count = default_bucket_count_,
-                          const hasher& hf = hasher{},
-                          const key_equal& eql = key_equal{},
-                          const allocator_type& alloc = allocator_type{})
-                : unordered_map{bucket_count, hf, eql, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            unordered_map(size_type bucket_count, const allocator_type& alloc)
-                : unordered_map{bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_map{bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_map(InputIterator first, InputIterator last,
-                          size_type bucket_count, const allocator_type& alloc)
-                : unordered_map{first, last, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_map(InputIterator first, InputIterator last,
-                          size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_map{first, last, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(initializer_list<value_type> init, size_type bucket_count,
-                          const allocator_type& alloc)
-                : unordered_map{init, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_map(initializer_list<value_type> init, size_type bucket_count,
-                          const hasher& hf, const allocator_type& alloc)
-                : unordered_map{init, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~unordered_map()
-            { /* DUMMY BODY */ }
-
-            unordered_map& operator=(const unordered_map& other)
-            {
-                table_ = other.table_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            unordered_map& operator=(unordered_map&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<hasher>::value &&
-                         is_nothrow_move_assignable<key_equal>::value)
-            {
-                table_ = move(other.table_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            unordered_map& operator=(initializer_list<value_type>& init)
-            {
-                table_.clear();
-                table_.reserve(init.size());
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            bool empty() const noexcept
-            {
-                return table_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return table_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return table_.max_size(allocator_);
-            }
-
-            iterator begin() noexcept
-            {
-                return table_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return table_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return table_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return table_.cend();
-            }
-
-            template<class... Args>
-            pair<iterator, bool> emplace(Args&&... args)
-            {
-                return table_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...).first;
-            }
-
-            pair<iterator, bool> insert(const value_type& val)
-            {
-                return table_.insert(val);
-            }
-
-            pair<iterator, bool> insert(value_type&& val)
-            {
-                return table_.insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            pair<iterator, bool> insert(
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace(forward<T>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val).first;
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val)).first;
-            }
-
-            template<class T>
-            iterator insert(
-                const_iterator hint,
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace_hint(hint, forward<T>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            template<class... Args>
-            pair<iterator, bool> try_emplace(const key_type& key, Args&&... args)
-            {
-                /**
-                 * Note: If anyone (like me) wonders what is the difference between
-                 *       emplace and try_emplace, the former always constructs the value
-                 *       (in order to get the key) and the latter does it only if
-                 *       an insertion takes place.
-                 */
-
-                table_.increment_size();
-
-                auto [bucket, target, idx] = table_.find_insertion_spot(key);
-
-                if (!bucket)
-                    return make_pair(end(), false);
-
-                if (target && table_.keys_equal(key, target->value))
-                {
-                    table_.decrement_size();
-
-                    return make_pair(
-                        iterator{
-                            table_.table(), idx, table_.bucket_count(),
-                            target
-                        },
-                        false
-                    );
-                }
-                else
-                {
-                    auto node = new node_type{key, forward<Args>(args)...};
-                    bucket->append(node);
-
-                    return make_pair(iterator{
-                        table_.table(), idx,
-                        table_.bucket_count(),
-                        node
-                    }, true);
-                }
-            }
-
-            template<class... Args>
-            pair<iterator, bool> try_emplace(key_type&& key, Args&&... args)
-            {
-                table_.increment_size();
-
-                auto [bucket, target, idx] = table_.find_insertion_spot(key);
-
-                if (!bucket)
-                    return make_pair(end(), false);
-
-                if (target && table_.keys_equal(key, target->value))
-                {
-                    table_.decrement_size();
-
-                    return make_pair(
-                        iterator{
-                            table_.table(), idx, table_.bucket_count(),
-                            target
-                        },
-                        false
-                    );
-                }
-                else
-                {
-                    auto node = new node_type{move(key), forward<Args>(args)...};
-                    bucket->append(node);
-
-                    return make_pair(iterator{
-                        table_.table(), idx,
-                        table_.bucket_count(),
-                        node
-                    }, true);
-                }
-            }
-
-            template<class... Args>
-            iterator try_emplace(const_iterator, const key_type& key, Args&&... args)
-            {
-                return try_emplace(key, forward<Args>(args)...).first;
-            }
-
-            template<class... Args>
-            iterator try_emplace(const_iterator, key_type&& key, Args&&... args)
-            {
-                return try_emplace(move(key), forward<Args>(args)...).first;
-            }
-
-            template<class T>
-            pair<iterator, bool> insert_or_assign(const key_type& key, T&& val)
-            {
-                table_.increment_size();
-
-                auto [bucket, target, idx] = table_.find_insertion_spot(key);
-
-                if (!bucket)
-                    return make_pair(end(), false);
-
-                if (target && table_.keys_equal(key, target->value))
-                {
-                    table_.decrement_size();
-                    target->value.second = forward<T>(val);
-
-                    return make_pair(
-                        iterator{
-                            table_.table(), idx, table_.bucket_count(),
-                            target
-                        },
-                        false
-                    );
-                }
-                else
-                {
-                    auto node = new node_type{key, forward<T>(val)};
-                    bucket->append(node);
-
-                    return make_pair(iterator{
-                        table_.table(), idx,
-                        table_.bucket_count(),
-                        node
-                    }, true);
-                }
-            }
-
-            template<class T>
-            pair<iterator, bool> insert_or_assign(key_type&& key, T&& val)
-            {
-                table_.increment_size();
-
-                auto [bucket, target, idx] = table_.find_insertion_spot(key);
-
-                if (!bucket)
-                    return make_pair(end(), false);
-
-                if (target && table_.keys_equal(key, target->value))
-                {
-                    table_.decrement_size();
-                    target->value.second = forward<T>(val);
-
-                    return make_pair(
-                        iterator{
-                            table_.table(), idx, table_.bucket_count(),
-                            target
-                        },
-                        false
-                    );
-                }
-                else
-                {
-                    auto node = new node_type{move(key), forward<T>(val)};
-                    bucket->append(node);
-
-                    return make_pair(iterator{
-                        table_.table(), idx,
-                        table_.bucket_count(),
-                        node
-                    }, true);
-                }
-            }
-
-            template<class T>
-            iterator insert_or_assign(const_iterator, const key_type& key, T&& val)
-            {
-                return insert_or_assign(key, forward<T>(val)).first;
-            }
-
-            template<class T>
-            iterator insert_or_assign(const_iterator, key_type&& key, T&& val)
-            {
-                return insert_or_assign(move(key), forward<T>(val)).first;
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return table_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return table_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    table_.table(), first.idx(),
-                    table_.bucket_count(), table_.head(first.idx())
-                };
-            }
-
-            void clear() noexcept
-            {
-                table_.clear();
-            }
-
-            void swap(unordered_map& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<hasher>(), declval<hasher>())) &&
-                         noexcept(std::swap(declval<key_equal>(), declval<key_equal>())))
-            {
-                table_.swap(other.table_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            hasher hash_function() const
-            {
-                return table_.hash_function();
-            }
-
-            key_equal key_eq() const
-            {
-                return table_.key_eq();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return table_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return table_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return table_.count(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return table_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return table_.equal_range(key);
-            }
-
-            mapped_type& operator[](const key_type& key)
-            {
-                auto spot = table_.find_insertion_spot(key);
-                auto bucket = get<0>(spot);
-
-                if (bucket->head)
-                {
-                    auto head = bucket->head;
-                    auto current = bucket->head;
-
-                    do
-                    {
-                        if (table_.keys_equal(key, current->value))
-                            return current->value.second;
-                        else
-                            current = current->next;
-                    }
-                    while (current != head);
-                }
-
-                auto node = new node_type{key, mapped_type{}};
-                bucket->append(node);
-
-                table_.increment_size();
-                table_.rehash_if_needed();
-                return node->value.second;
-            }
-
-            mapped_type& operator[](key_type&& key)
-            {
-                auto spot = table_.find_insertion_spot(key);
-                auto bucket = get<0>(spot);
-
-                if (bucket->head)
-                {
-                    auto head = bucket->head;
-                    auto current = bucket->head;
-
-                    do
-                    {
-                        if (table_.keys_equal(key, current->value))
-                            return current->value.second;
-                        else
-                            current = current->next;
-                    }
-                    while (current != head);
-                }
-
-                auto node = new node_type{move(key), mapped_type{}};
-                bucket->append(node);
-
-                table_.increment_size();
-                table_.rehash_if_needed();
-                return node->value.second;
-            }
-
-            mapped_type& at(const key_type& key)
-            {
-                auto it = find(key);
-
-                // TODO: throw out_of_range if it == end()
-                return it->second;
-            }
-
-            const mapped_type& at(const key_type& key) const
-            {
-                auto it = find(key);
-
-                // TODO: throw out_of_range if it == end()
-                return it->second;
-            }
-
-            size_type bucket_count() const noexcept
-            {
-                return table_.bucket_count();
-            }
-
-            size_type max_bucket_count() const noexcept
-            {
-                return table_.max_bucket_count();
-            }
-
-            size_type bucket_size(size_type idx) const
-            {
-                return table_.bucket_size(idx);
-            }
-
-            size_type bucket(const key_type& key) const
-            {
-                return table_.bucket(key);
-            }
-
-            local_iterator begin(size_type idx)
-            {
-                return table_.begin(idx);
-            }
-
-            const_local_iterator begin(size_type idx) const
-            {
-                return table_.begin(idx);
-            }
-
-            local_iterator end(size_type idx)
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator end(size_type idx) const
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator cbegin(size_type idx) const
-            {
-                return table_.cbegin(idx);
-            }
-
-            const_local_iterator cend(size_type idx) const
-            {
-                return table_.cend(idx);
-            }
-
-            float load_factor() const noexcept
-            {
-                return table_.load_factor();
-            }
-
-            float max_load_factor() const noexcept
-            {
-                return table_.max_load_factor();
-            }
-
-            void max_load_factor(float factor)
-            {
-                table_.max_load_factor(factor);
-            }
-
-            void rehash(size_type bucket_count)
-            {
-                table_.rehash(bucket_count);
-            }
-
-            void reserve(size_type count)
-            {
-                table_.reserve(count);
-            }
-
-        private:
-            using table_type = aux::hash_table<
-                value_type, key_type, aux::key_value_key_extractor<key_type, mapped_type>,
-                hasher, key_equal, allocator_type, size_type,
-                iterator, const_iterator, local_iterator, const_local_iterator,
-                aux::hash_single_policy
-            >;
-            using node_type = typename table_type::node_type;
-
-            table_type table_;
-            allocator_type allocator_;
-
-            static constexpr size_type default_bucket_count_{16};
-
-            template<class K, class V, class H, class P, class A>
-            friend bool operator==(unordered_map<K, V, H, P, A>&,
-                                   unordered_map<K, V, H, P, A>&);
-    };
-
-    /**
-     * 23.5.5, class template unordered_multimap:
-     */
-
-    template<
-        class Key, class Value,
-        class Hash = hash<Key>,
-        class Pred = equal_to<Key>,
-        class Alloc = allocator<pair<const Key, Value>>
-    >
-    class unordered_multimap
-    {
-        public:
-            using key_type        = Key;
-            using mapped_type     = Value;
-            using value_type      = pair<const key_type, mapped_type>;
-            using hasher          = Hash;
-            using key_equal       = Pred;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            using iterator             = aux::hash_table_iterator<
-                value_type, reference, pointer, size_type
-            >;
-            using const_iterator       = aux::hash_table_const_iterator<
-                value_type, const_reference, const_pointer, size_type
-            >;
-            using local_iterator       = aux::hash_table_local_iterator<
-                value_type, reference, pointer
-            >;
-            using const_local_iterator = aux::hash_table_const_local_iterator<
-                value_type, const_reference, const_pointer
-            >;
-
-            unordered_multimap()
-                : unordered_multimap{default_bucket_count_}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_multimap(size_type bucket_count,
-                                        const hasher& hf = hasher{},
-                                        const key_equal& eql = key_equal{},
-                                        const allocator_type& alloc = allocator_type{})
-                : table_{bucket_count, hf, eql}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multimap(InputIterator first, InputIterator last,
-                               size_type bucket_count = default_bucket_count_,
-                               const hasher& hf = hasher{},
-                               const key_equal& eql = key_equal{},
-                               const allocator_type& alloc = allocator_type{})
-                : unordered_multimap{bucket_count, hf, eql, alloc}
-            {
-                insert(first, last);
-            }
-
-            unordered_multimap(const unordered_multimap& other)
-                : unordered_multimap{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(unordered_multimap&& other)
-                : table_{move(other.table_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_multimap(const allocator_type& alloc)
-                : table_{default_bucket_count_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(const unordered_multimap& other, const allocator_type& alloc)
-                : table_{other.table_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(unordered_multimap&& other, const allocator_type& alloc)
-                : table_{move(other.table_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(initializer_list<value_type> init,
-                               size_type bucket_count = default_bucket_count_,
-                               const hasher& hf = hasher{},
-                               const key_equal& eql = key_equal{},
-                               const allocator_type& alloc = allocator_type{})
-                : unordered_multimap{bucket_count, hf, eql, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            unordered_multimap(size_type bucket_count, const allocator_type& alloc)
-                : unordered_multimap{bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(size_type bucket_count, const hasher& hf,
-                               const allocator_type& alloc)
-                : unordered_multimap{bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multimap(InputIterator first, InputIterator last,
-                               size_type bucket_count, const allocator_type& alloc)
-                : unordered_multimap{first, last, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multimap(InputIterator first, InputIterator last,
-                               size_type bucket_count, const hasher& hf,
-                               const allocator_type& alloc)
-                : unordered_multimap{first, last, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(initializer_list<value_type> init, size_type bucket_count,
-                               const allocator_type& alloc)
-                : unordered_multimap{init, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multimap(initializer_list<value_type> init, size_type bucket_count,
-                               const hasher& hf, const allocator_type& alloc)
-                : unordered_multimap{init, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~unordered_multimap()
-            { /* DUMMY BODY */ }
-
-            unordered_multimap& operator=(const unordered_multimap& other)
-            {
-                table_ = other.table_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            unordered_multimap& operator=(unordered_multimap&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<hasher>::value &&
-                         is_nothrow_move_assignable<key_equal>::value)
-            {
-                table_ = move(other.table_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            unordered_multimap& operator=(initializer_list<value_type>& init)
-            {
-                table_.clear();
-                table_.reserve(init.size());
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            bool empty() const noexcept
-            {
-                return table_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return table_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return table_.max_size(allocator_);
-            }
-
-            iterator begin() noexcept
-            {
-                return table_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return table_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return table_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return table_.cend();
-            }
-
-            template<class... Args>
-            iterator emplace(Args&&... args)
-            {
-                return table_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...);
-            }
-
-            iterator insert(const value_type& val)
-            {
-                return table_.insert(val);
-            }
-
-            iterator insert(value_type&& val)
-            {
-                return table_.insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            iterator insert(
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace(forward<T>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val);
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val));
-            }
-
-            template<class T>
-            iterator insert(
-                const_iterator hint,
-                T&& val,
-                enable_if_t<is_constructible_v<value_type, T&&>>* = nullptr
-            )
-            {
-                return emplace_hint(hint, forward<T>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return table_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return table_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    table_.table(), first.idx(),
-                    table_.bucket_count(), table_.head(first.idx())
-                };
-            }
-
-            void clear() noexcept
-            {
-                table_.clear();
-            }
-
-            void swap(unordered_multimap& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<hasher>(), declval<hasher>())) &&
-                         noexcept(std::swap(declval<key_equal>(), declval<key_equal>())))
-            {
-                table_.swap(other.table_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            hasher hash_function() const
-            {
-                return table_.hash_function();
-            }
-
-            key_equal key_eq() const
-            {
-                return table_.key_eq();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return table_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return table_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return table_.count(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return table_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return table_.equal_range(key);
-            }
-
-            size_type bucket_count() const noexcept
-            {
-                return table_.bucket_count();
-            }
-
-            size_type max_bucket_count() const noexcept
-            {
-                return table_.max_bucket_count();
-            }
-
-            size_type bucket_size(size_type idx) const
-            {
-                return table_.bucket_size(idx);
-            }
-
-            size_type bucket(const key_type& key) const
-            {
-                return table_.bucket(key);
-            }
-
-            local_iterator begin(size_type idx)
-            {
-                return table_.begin(idx);
-            }
-
-            const_local_iterator begin(size_type idx) const
-            {
-                return table_.begin(idx);
-            }
-
-            local_iterator end(size_type idx)
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator end(size_type idx) const
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator cbegin(size_type idx) const
-            {
-                return table_.cbegin(idx);
-            }
-
-            const_local_iterator cend(size_type idx) const
-            {
-                return table_.cend(idx);
-            }
-
-            float load_factor() const noexcept
-            {
-                return table_.load_factor();
-            }
-
-            float max_load_factor() const noexcept
-            {
-                return table_.max_load_factor();
-            }
-
-            void max_load_factor(float factor)
-            {
-                table_.max_load_factor(factor);
-            }
-
-            void rehash(size_type bucket_count)
-            {
-                table_.rehash(bucket_count);
-            }
-
-            void reserve(size_type count)
-            {
-                table_.reserve(count);
-            }
-
-        private:
-            using table_type = aux::hash_table<
-                value_type, key_type, aux::key_value_key_extractor<key_type, mapped_type>,
-                hasher, key_equal, allocator_type, size_type,
-                iterator, const_iterator, local_iterator, const_local_iterator,
-                aux::hash_multi_policy
-            >;
-
-            table_type table_;
-            allocator_type allocator_;
-
-            static constexpr size_type default_bucket_count_{16};
-
-            template<class K, class V, class H, class P, class A>
-            friend bool operator==(unordered_multimap<K, V, H, P, A>&,
-                                   unordered_multimap<K, V, H, P, A>&);
-    };
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    void swap(unordered_map<Key, Value, Hash, Pred, Alloc>& lhs,
-              unordered_map<Key, Value, Hash, Pred, Alloc>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    void swap(unordered_multimap<Key, Value, Hash, Pred, Alloc>& lhs,
-              unordered_multimap<Key, Value, Hash, Pred, Alloc>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    bool operator==(unordered_map<Key, Value, Hash, Pred, Alloc>& lhs,
-                    unordered_map<Key, Value, Hash, Pred, Alloc>& rhs)
-    {
-        // TODO: this does not compare values, use is_permutation when we have it
-        return lhs.table_.is_eq_to(rhs.table_);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    bool operator!=(unordered_map<Key, Value, Hash, Pred, Alloc>& lhs,
-                    unordered_map<Key, Value, Hash, Pred, Alloc>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    bool operator==(unordered_multimap<Key, Value, Hash, Pred, Alloc>& lhs,
-                    unordered_multimap<Key, Value, Hash, Pred, Alloc>& rhs)
-    {
-        return lhs.table_.is_eq_to(rhs.table_);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    bool operator!=(unordered_multimap<Key, Value, Hash, Pred, Alloc>& lhs,
-                    unordered_multimap<Key, Value, Hash, Pred, Alloc>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/unordered_set.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/unordered_set.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,917 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_UNORDERED_SET
-#define LIBCPP_BITS_ADT_UNORDERED_SET
-
-#include <__bits/adt/hash_table.hpp>
-#include <initializer_list>
-#include <functional>
-#include <memory>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.5.6, class template unordered_set:
-     */
-
-    template<
-        class Key,
-        class Hash = hash<Key>,
-        class Pred = equal_to<Key>,
-        class Alloc = allocator<Key>
-    >
-    class unordered_set
-    {
-        public:
-            using key_type        = Key;
-            using value_type      = Key;
-            using hasher          = Hash;
-            using key_equal       = Pred;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            /**
-             * Note: Both the iterator and const_iterator (and their local variants)
-             *       types are constant iterators, the standard does not require them
-             *       to be the same type, but why not? :)
-             */
-            using iterator             = aux::hash_table_const_iterator<
-                value_type, const_reference, const_pointer, size_type
-            >;
-            using const_iterator       = iterator;
-            using local_iterator       = aux::hash_table_const_local_iterator<
-                value_type, const_reference, const_pointer
-            >;
-            using const_local_iterator = local_iterator;
-
-            /**
-             * Note: We need () to delegate the constructor,
-             *       otherwise it could be deduced as the initializer
-             *       list constructor when size_type is convertible
-             *       to value_type.
-             */
-            unordered_set()
-                : unordered_set(default_bucket_count_)
-            { /* DUMMY BODY */ }
-
-            explicit unordered_set(size_type bucket_count,
-                                   const hasher& hf = hasher{},
-                                   const key_equal& eql = key_equal{},
-                                   const allocator_type& alloc = allocator_type{})
-                : table_{bucket_count, hf, eql}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_set(InputIterator first, InputIterator last,
-                          size_type bucket_count = default_bucket_count_,
-                          const hasher& hf = hasher{},
-                          const key_equal& eql = key_equal{},
-                          const allocator_type& alloc = allocator_type{})
-                : unordered_set{bucket_count, hf, eql, alloc}
-            {
-                insert(first, last);
-            }
-
-            unordered_set(const unordered_set& other)
-                : unordered_set{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            unordered_set(unordered_set&& other)
-                : table_{move(other.table_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_set(const allocator_type& alloc)
-                : table_{default_bucket_count_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(const unordered_set& other, const allocator_type& alloc)
-                : table_{other.table_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(unordered_set&& other, const allocator_type& alloc)
-                : table_{move(other.table_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(initializer_list<value_type> init,
-                          size_type bucket_count = default_bucket_count_,
-                          const hasher& hf = hasher{},
-                          const key_equal& eql = key_equal{},
-                          const allocator_type& alloc = allocator_type{})
-                : unordered_set{bucket_count, hf, eql, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            unordered_set(size_type bucket_count, const allocator_type& alloc)
-                : unordered_set{bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_set{bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_set(InputIterator first, InputIterator last,
-                          size_type bucket_count, const allocator_type& alloc)
-                : unordered_set{first, last, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_set(InputIterator first, InputIterator last,
-                          size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_set{first, last, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(initializer_list<value_type> init, size_type bucket_count,
-                          const allocator_type& alloc)
-                : unordered_set{init, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_set(initializer_list<value_type> init, size_type bucket_count,
-                          const hasher& hf, const allocator_type& alloc)
-                : unordered_set{init, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~unordered_set()
-            { /* DUMMY BODY */ }
-
-            unordered_set& operator=(const unordered_set& other)
-            {
-                table_ = other.table_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            unordered_set& operator=(unordered_set&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<hasher>::value &&
-                         is_nothrow_move_assignable<key_equal>::value)
-            {
-                table_ = move(other.table_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            unordered_set& operator=(initializer_list<value_type>& init)
-            {
-                table_.clear();
-                table_.reserve(init.size());
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            bool empty() const noexcept
-            {
-                return table_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return table_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return table_.max_size(allocator_);
-            }
-
-            iterator begin() noexcept
-            {
-                return table_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return table_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return table_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return table_.cend();
-            }
-
-            template<class... Args>
-            pair<iterator, bool> emplace(Args&&... args)
-            {
-                return table_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...).first;
-            }
-
-            pair<iterator, bool> insert(const value_type& val)
-            {
-                return table_.insert(val);
-            }
-
-            pair<iterator, bool> insert(value_type&& val)
-            {
-                return table_.insert(forward<value_type>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val).first;
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val)).first;
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return table_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return table_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    table_.table(), first.idx(),
-                    table_.bucket_count(), first.node()
-                };
-            }
-
-            void clear() noexcept
-            {
-                table_.clear();
-            }
-
-            void swap(unordered_set& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<hasher>(), declval<hasher>())) &&
-                         noexcept(std::swap(declval<key_equal>(), declval<key_equal>())))
-            {
-                table_.swap(other.table_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            hasher hash_function() const
-            {
-                return table_.hash_function();
-            }
-
-            key_equal key_eq() const
-            {
-                return table_.key_eq();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return table_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return table_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return table_.count(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return table_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return table_.equal_range(key);
-            }
-
-            size_type bucket_count() const noexcept
-            {
-                return table_.bucket_count();
-            }
-
-            size_type max_bucket_count() const noexcept
-            {
-                return table_.max_bucket_count();
-            }
-
-            size_type bucket_size(size_type idx) const
-            {
-                return table_.bucket_size(idx);
-            }
-
-            size_type bucket(const key_type& key) const
-            {
-                return table_.bucket(key);
-            }
-
-            local_iterator begin(size_type idx)
-            {
-                return table_.begin(idx);
-            }
-
-            const_local_iterator begin(size_type idx) const
-            {
-                return table_.begin(idx);
-            }
-
-            local_iterator end(size_type idx)
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator end(size_type idx) const
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator cbegin(size_type idx) const
-            {
-                return table_.cbegin(idx);
-            }
-
-            const_local_iterator cend(size_type idx) const
-            {
-                return table_.cend(idx);
-            }
-
-            float load_factor() const noexcept
-            {
-                return table_.load_factor();
-            }
-
-            float max_load_factor() const noexcept
-            {
-                return table_.max_load_factor();
-            }
-
-            void max_load_factor(float factor)
-            {
-                table_.max_load_factor(factor);
-            }
-
-            void rehash(size_type bucket_count)
-            {
-                table_.rehash(bucket_count);
-            }
-
-            void reserve(size_type count)
-            {
-                table_.reserve(count);
-            }
-
-        private:
-            using table_type = aux::hash_table<
-                key_type, key_type, aux::key_no_value_key_extractor<key_type>,
-                hasher, key_equal, allocator_type, size_type,
-                iterator, const_iterator, local_iterator, const_local_iterator,
-                aux::hash_single_policy
-            >;
-
-            table_type table_;
-            allocator_type allocator_;
-
-            static constexpr size_type default_bucket_count_{16};
-
-            template<class K, class H, class P, class A>
-            friend bool operator==(const unordered_set<K, H, P, A>&,
-                                   const unordered_set<K, H, P, A>&);
-    };
-
-    /**
-     * 23.5.7, class template unordered_multiset:
-     */
-
-    template<
-        class Key,
-        class Hash = hash<Key>,
-        class Pred = equal_to<Key>,
-        class Alloc = allocator<Key>
-    >
-    class unordered_multiset
-    {
-        public:
-            using key_type        = Key;
-            using value_type      = Key;
-            using hasher          = Hash;
-            using key_equal       = Pred;
-            using allocator_type  = Alloc;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-
-            /**
-             * Note: Both the iterator and const_iterator (and their local variants)
-             *       types are constant iterators, the standard does not require them
-             *       to be the same type, but why not? :)
-             */
-            using iterator             = aux::hash_table_const_iterator<
-                value_type, const_reference, const_pointer, size_type
-            >;
-            using const_iterator       = iterator;
-            using local_iterator       = aux::hash_table_const_local_iterator<
-                value_type, const_reference, const_pointer
-            >;
-            using const_local_iterator = local_iterator;
-
-            /**
-             * Note: We need () to delegate the constructor,
-             *       otherwise it could be deduced as the initializer
-             *       list constructor when size_type is convertible
-             *       to value_type.
-             */
-            unordered_multiset()
-                : unordered_multiset(default_bucket_count_)
-            { /* DUMMY BODY */ }
-
-            explicit unordered_multiset(size_type bucket_count,
-                                        const hasher& hf = hasher{},
-                                        const key_equal& eql = key_equal{},
-                                        const allocator_type& alloc = allocator_type{})
-                : table_{bucket_count, hf, eql}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multiset(InputIterator first, InputIterator last,
-                               size_type bucket_count = default_bucket_count_,
-                               const hasher& hf = hasher{},
-                               const key_equal& eql = key_equal{},
-                               const allocator_type& alloc = allocator_type{})
-                : unordered_multiset{bucket_count, hf, eql, alloc}
-            {
-                insert(first, last);
-            }
-
-            unordered_multiset(const unordered_multiset& other)
-                : unordered_multiset{other, other.allocator_}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(unordered_multiset&& other)
-                : table_{move(other.table_)}, allocator_{move(other.allocator_)}
-            { /* DUMMY BODY */ }
-
-            explicit unordered_multiset(const allocator_type& alloc)
-                : table_{default_bucket_count_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(const unordered_multiset& other, const allocator_type& alloc)
-                : table_{other.table_}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(unordered_multiset&& other, const allocator_type& alloc)
-                : table_{move(other.table_)}, allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(initializer_list<value_type> init,
-                               size_type bucket_count = default_bucket_count_,
-                               const hasher& hf = hasher{},
-                               const key_equal& eql = key_equal{},
-                               const allocator_type& alloc = allocator_type{})
-                : unordered_multiset{bucket_count, hf, eql, alloc}
-            {
-                insert(init.begin(), init.end());
-            }
-
-            unordered_multiset(size_type bucket_count, const allocator_type& alloc)
-                : unordered_multiset{bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_multiset{bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multiset(InputIterator first, InputIterator last,
-                               size_type bucket_count, const allocator_type& alloc)
-                : unordered_multiset{first, last, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            unordered_multiset(InputIterator first, InputIterator last,
-                               size_type bucket_count, const hasher& hf, const allocator_type& alloc)
-                : unordered_multiset{first, last, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(initializer_list<value_type> init, size_type bucket_count,
-                               const allocator_type& alloc)
-                : unordered_multiset{init, bucket_count, hasher{}, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            unordered_multiset(initializer_list<value_type> init, size_type bucket_count,
-                               const hasher& hf, const allocator_type& alloc)
-                : unordered_multiset{init, bucket_count, hf, key_equal{}, alloc}
-            { /* DUMMY BODY */ }
-
-            ~unordered_multiset()
-            { /* DUMMY BODY */ }
-
-            unordered_multiset& operator=(const unordered_multiset& other)
-            {
-                table_ = other.table_;
-                allocator_ = other.allocator_;
-
-                return *this;
-            }
-
-            unordered_multiset& operator=(unordered_multiset&& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         is_nothrow_move_assignable<hasher>::value &&
-                         is_nothrow_move_assignable<key_equal>::value)
-            {
-                table_ = move(other.table_);
-                allocator_ = move(other.allocator_);
-
-                return *this;
-            }
-
-            unordered_multiset& operator=(initializer_list<value_type>& init)
-            {
-                table_.clear();
-                table_.reserve(init.size());
-
-                insert(init.begin(), init.end());
-
-                return *this;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_;
-            }
-
-            bool empty() const noexcept
-            {
-                return table_.empty();
-            }
-
-            size_type size() const noexcept
-            {
-                return table_.size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return table_.max_size(allocator_);
-            }
-
-            iterator begin() noexcept
-            {
-                return table_.begin();
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return table_.begin();
-            }
-
-            iterator end() noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator end() const noexcept
-            {
-                return table_.end();
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return table_.cbegin();
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return table_.cend();
-            }
-
-            template<class... Args>
-            iterator emplace(Args&&... args)
-            {
-                return table_.emplace(forward<Args>(args)...);
-            }
-
-            template<class... Args>
-            iterator emplace_hint(const_iterator, Args&&... args)
-            {
-                return emplace(forward<Args>(args)...);
-            }
-
-            iterator insert(const value_type& val)
-            {
-                return table_.insert(val);
-            }
-
-            iterator insert(value_type&& val)
-            {
-                return table_.insert(forward<value_type>(val));
-            }
-
-            iterator insert(const_iterator, const value_type& val)
-            {
-                return insert(val);
-            }
-
-            iterator insert(const_iterator, value_type&& val)
-            {
-                return insert(forward<value_type>(val));
-            }
-
-            template<class InputIterator>
-            void insert(InputIterator first, InputIterator last)
-            {
-                while (first != last)
-                    insert(*first++);
-            }
-
-            void insert(initializer_list<value_type> init)
-            {
-                insert(init.begin(), init.end());
-            }
-
-            iterator erase(const_iterator position)
-            {
-                return table_.erase(position);
-            }
-
-            size_type erase(const key_type& key)
-            {
-                return table_.erase(key);
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                while (first != last)
-                    first = erase(first);
-
-                return iterator{
-                    table_.table(), first.idx(),
-                    table_.bucket_count(), table_.head(first.idx())
-                };
-            }
-
-            void clear() noexcept
-            {
-                table_.clear();
-            }
-
-            void swap(unordered_multiset& other)
-                noexcept(allocator_traits<allocator_type>::is_always_equal::value &&
-                         noexcept(std::swap(declval<hasher>(), declval<hasher>())) &&
-                         noexcept(std::swap(declval<key_equal>(), declval<key_equal>())))
-            {
-                table_.swap(other.table_);
-                std::swap(allocator_, other.allocator_);
-            }
-
-            hasher hash_function() const
-            {
-                return table_.hash_function();
-            }
-
-            key_equal key_eq() const
-            {
-                return table_.key_eq();
-            }
-
-            iterator find(const key_type& key)
-            {
-                return table_.find(key);
-            }
-
-            const_iterator find(const key_type& key) const
-            {
-                return table_.find(key);
-            }
-
-            size_type count(const key_type& key) const
-            {
-                return table_.count(key);
-            }
-
-            pair<iterator, iterator> equal_range(const key_type& key)
-            {
-                return table_.equal_range(key);
-            }
-
-            pair<const_iterator, const_iterator> equal_range(const key_type& key) const
-            {
-                return table_.equal_range(key);
-            }
-
-            size_type bucket_count() const noexcept
-            {
-                return table_.bucket_count();
-            }
-
-            size_type max_bucket_count() const noexcept
-            {
-                return table_.max_bucket_count();
-            }
-
-            size_type bucket_size(size_type idx) const
-            {
-                return table_.bucket_size(idx);
-            }
-
-            size_type bucket(const key_type& key) const
-            {
-                return table_.bucket(key);
-            }
-
-            local_iterator begin(size_type idx)
-            {
-                return table_.begin(idx);
-            }
-
-            const_local_iterator begin(size_type idx) const
-            {
-                return table_.begin(idx);
-            }
-
-            local_iterator end(size_type idx)
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator end(size_type idx) const
-            {
-                return table_.end(idx);
-            }
-
-            const_local_iterator cbegin(size_type idx) const
-            {
-                return table_.cbegin(idx);
-            }
-
-            const_local_iterator cend(size_type idx) const
-            {
-                return table_.cend(idx);
-            }
-
-            float load_factor() const noexcept
-            {
-                return table_.load_factor();
-            }
-
-            float max_load_factor() const noexcept
-            {
-                return table_.max_load_factor();
-            }
-
-            void max_load_factor(float factor)
-            {
-                table_.max_load_factor(factor);
-            }
-
-            void rehash(size_type bucket_count)
-            {
-                table_.rehash(bucket_count);
-            }
-
-            void reserve(size_type count)
-            {
-                table_.reserve(count);
-            }
-
-        private:
-            using table_type = aux::hash_table<
-                key_type, key_type, aux::key_no_value_key_extractor<key_type>,
-                hasher, key_equal, allocator_type, size_type,
-                iterator, const_iterator, local_iterator, const_local_iterator,
-                aux::hash_multi_policy
-            >;
-
-            table_type table_;
-            allocator_type allocator_;
-
-            static constexpr size_type default_bucket_count_{16};
-
-            template<class K, class H, class P, class A>
-            friend bool operator==(const unordered_multiset<K, H, P, A>&,
-                                   const unordered_multiset<K, H, P, A>&);
-    };
-
-    template<class Key, class Hash, class Pred, class Alloc>
-    void swap(unordered_set<Key, Hash, Pred, Alloc>& lhs,
-              unordered_set<Key, Hash, Pred, Alloc>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class Key, class Hash, class Pred, class Alloc>
-    void swap(unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
-              unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class Key, class Hash, class Pred, class Alloc>
-    bool operator==(const unordered_set<Key, Hash, Pred, Alloc>& lhs,
-                    const unordered_set<Key, Hash, Pred, Alloc>& rhs)
-    {
-        return lhs.table_.is_eq_to(rhs.table_);
-    }
-
-    template<class Key, class Hash, class Pred, class Alloc>
-    bool operator!=(const unordered_set<Key, Hash, Pred, Alloc>& lhs,
-                    const unordered_set<Key, Hash, Pred, Alloc>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Key, class Hash, class Pred, class Alloc>
-    bool operator==(const unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
-                    const unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
-    {
-        return lhs.table_.is_eq_to(rhs.table_);
-    }
-
-    template<class Key, class Value, class Hash, class Pred, class Alloc>
-    bool operator!=(const unordered_multiset<Key, Hash, Pred, Alloc>& lhs,
-                    const unordered_multiset<Key, Hash, Pred, Alloc>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/valarray.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/valarray.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_VALARRAY
-#define LIBCPP_BITS_ADT_VALARRAY
-
-#error "<valarray> is not implemented"
-
-#endif
Index: pace/lib/cpp/include/__bits/adt/vector.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/adt/vector.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,666 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ADT_VECTOR
-#define LIBCPP_BITS_ADT_VECTOR
-
-#include <algorithm>
-#include <initializer_list>
-#include <iterator>
-#include <memory>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 23.3.6, vector:
-     */
-
-    template<class T, class Allocator = allocator<T>>
-    class vector
-    {
-        public:
-            using value_type             = T;
-            using reference              = value_type&;
-            using const_reference        = const value_type&;
-            using allocator_type         = Allocator;
-            using size_type              = size_t;
-            using difference_type        = ptrdiff_t;
-            using pointer                = typename allocator_traits<Allocator>::pointer;
-            using const_pointer          = typename allocator_traits<Allocator>::pointer;
-            using iterator               = pointer;
-            using const_iterator         = const_pointer;
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            vector() noexcept
-                : vector{Allocator{}}
-            { /* DUMMY BODY */ }
-
-            explicit vector(const Allocator& alloc)
-                : data_{nullptr}, size_{}, capacity_{},
-                  allocator_{alloc}
-            { /* DUMMY BODY */ }
-
-            explicit vector(size_type n, const Allocator& alloc = Allocator{})
-                : data_{}, size_{n}, capacity_{n}, allocator_{alloc}
-            {
-                data_ = allocator_.allocate(capacity_);
-
-                for (size_type i = 0; i < size_; ++i)
-                    allocator_traits<Allocator>::construct(allocator_, data_ + i);
-            }
-
-            vector(size_type n, const T& val, const Allocator& alloc = Allocator{})
-                : data_{}, size_{n}, capacity_{n}, allocator_{alloc}
-            {
-                data_ = allocator_.allocate(capacity_);
-
-                for (size_type i = 0; i < size_; ++i)
-                    data_[i] = val;
-            }
-
-            template<class InputIterator>
-            vector(InputIterator first, InputIterator last,
-                   const Allocator& alloc = Allocator{})
-            {
-                // TODO: research constraints and provide multiple
-                //       implementations via enable_if
-            }
-
-            vector(const vector& other)
-                : data_{nullptr}, size_{other.size_}, capacity_{other.capacity_},
-                  allocator_{other.allocator_}
-            {
-                data_ = allocator_.allocate(capacity_);
-
-                for (size_type i = 0; i < size_; ++i)
-                    data_[i] = other.data_[i];
-            }
-
-            vector(vector&& other) noexcept
-                : data_{other.data_}, size_{other.size_}, capacity_{other.capacity_},
-                  allocator_{move(other.allocator_)}
-            {
-                // other is guaranteed to be empty()
-                other.size_ = other.capacity_ = 0;
-                other.data_ = nullptr;
-            }
-
-            vector(const vector& other, const Allocator& alloc)
-                : data_{nullptr}, size_{other.size_}, capacity_{other.capacity_},
-                  allocator_{alloc}
-            {
-                data_ = allocator_.allocate(capacity_);
-
-                for (size_type i = 0; i < size_; ++i)
-                    data_[i] = other.data_[i];
-            }
-
-            vector(initializer_list<T> init, const Allocator& alloc = Allocator{})
-                : data_{nullptr}, size_{init.size()}, capacity_{init.size()},
-                  allocator_{alloc}
-            {
-                data_ = allocator_.allocate(capacity_);
-
-                auto it = init.begin();
-                for (size_type i = 0; it != init.end(); ++i, ++it)
-                {
-                    data_[i] = *it;
-                }
-            }
-
-            ~vector()
-            {
-                allocator_.deallocate(data_, capacity_);
-            }
-
-            vector& operator=(const vector& other)
-            {
-                vector tmp{other};
-                swap(tmp);
-
-                return *this;
-            }
-
-            vector& operator=(vector&& other)
-                noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
-                         allocator_traits<Allocator>::is_always_equal::value)
-            {
-                if (data_)
-                    allocator_.deallocate(data_, capacity_);
-
-                // TODO: test this
-                data_ = other.data_;
-                size_ = other.size_;
-                capacity_ = other.capacity_;
-                allocator_ = move(other.allocator_);
-
-                other.data_ = nullptr;
-                other.size_ = size_type{};
-                other.capacity_ = size_type{};
-                other.allocator_ = allocator_type{};
-                return *this;
-            }
-
-            vector& operator=(initializer_list<T> init)
-            {
-                vector tmp{init, allocator_};
-                swap(tmp);
-
-                return *this;
-            }
-
-            template<class InputIterator>
-            void assign(InputIterator first, InputIterator last)
-            {
-                vector tmp{first, last};
-                swap(tmp);
-            }
-
-            void assign(size_type size, const T& val)
-            {
-                // Parenthesies required to avoid initializer list
-                // construction.
-                vector tmp(size, val);
-                swap(tmp);
-            }
-
-            void assign(initializer_list<T> init)
-            {
-                vector tmp{init};
-                swap(tmp);
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_type{allocator_};
-            }
-
-            iterator begin() noexcept
-            {
-                return &data_[0];
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return &data_[0];
-            }
-
-            iterator end() noexcept
-            {
-                return begin() + size_;
-            }
-
-            const_iterator end() const noexcept
-            {
-                return begin() + size_;
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return make_reverse_iterator(end());
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return make_reverse_iterator(begin());
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return &data_[0];
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return cbegin() + size_;
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return rbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return rend();
-            }
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type max_size() const noexcept
-            {
-                return std::allocator_traits<Allocator>::max_size(allocator_);
-            }
-
-            void resize(size_type sz)
-            {
-                resize_with_copy_(size_, capacity_);
-            }
-
-            void resize(size_type sz, const value_type& val)
-            {
-                auto old_size = size_;
-                resize_with_copy_(sz, capacity_);
-
-                for (size_type i = old_size - 1; i < size_; ++i)
-                    data_[i] = val;
-            }
-
-            size_type capacity() const noexcept
-            {
-                return capacity_;
-            }
-
-            bool empty() const noexcept
-            {
-                return size_ == 0;
-            }
-
-            void reserve(size_type new_capacity)
-            {
-                // TODO: if new_capacity > max_size() throw
-                //       length_error (this function shall have no
-                //       effect in such case)
-                if (new_capacity > capacity_)
-                    resize_with_copy_(size_, new_capacity);
-            }
-
-            void shrink_to_fit()
-            {
-                resize_with_copy_(size_, size_);
-            }
-
-            reference operator[](size_type idx)
-            {
-                return data_[idx];
-            }
-
-            const_reference operator[](size_type idx) const
-            {
-                return data_[idx];
-            }
-
-            reference at(size_type idx)
-            {
-                // TODO: bounds checking
-                return data_[idx];
-            }
-
-            const_reference at(size_type idx) const
-            {
-                // TODO: bounds checking
-                return data_[idx];
-            }
-
-            reference front()
-            {
-                /**
-                 * Note: Calling front/back on an empty container
-                 *       is undefined, we opted for at-like
-                 *       behavior to provide our users with means
-                 *       to protect their programs from accidental
-                 *       accesses to an empty vector.
-                 */
-                return at(0);
-            }
-
-            const_reference front() const
-            {
-                return at(0);
-            }
-
-            reference back()
-            {
-                return at(size_ - 1);
-            }
-
-            const_reference back() const
-            {
-                return at(size - 1);
-            }
-
-            T* data() noexcept
-            {
-                return data_;
-            }
-
-            const T* data() const noexcept
-            {
-                return data_;
-            }
-
-            template<class... Args>
-            reference emplace_back(Args&&... args)
-            {
-                if (size_ >= capacity_)
-                    resize_with_copy_(size_, next_capacity_());
-
-                allocator_traits<Allocator>::construct(allocator_,
-                                                       begin() + size_, forward<Args>(args)...);
-
-                return back();
-            }
-
-            void push_back(const T& x)
-            {
-                if (size_ >= capacity_)
-                    resize_with_copy_(size_, next_capacity_());
-                data_[size_++] = x;
-            }
-
-            void push_back(T&& x)
-            {
-                if (size_ >= capacity_)
-                    resize_with_copy_(size_, next_capacity_());
-                data_[size_++] = forward<T>(x);
-            }
-
-            void pop_back()
-            {
-                destroy_from_end_until_(end() - 1);
-                --size_;
-            }
-
-            template<class... Args>
-            iterator emplace(const_iterator position, Args&&... args)
-            {
-                auto pos = const_cast<iterator>(position);
-
-                pos = shift_(pos, 1);
-                allocator_.construct(pos, forward<Args>(args)...);
-
-                return pos;
-            }
-
-            iterator insert(const_iterator position, const value_type& x)
-            {
-                auto pos = const_cast<iterator>(position);
-
-                pos = shift_(pos, 1);
-                *pos = x;
-
-                return pos;
-            }
-
-            iterator insert(const_iterator position, value_type&& x)
-            {
-                auto pos = const_cast<iterator>(position);
-
-                pos = shift_(pos, 1);
-                *pos = forward<value_type>(x);
-
-                return pos;
-            }
-
-            iterator insert(const_iterator position, size_type count, const value_type& x)
-            {
-                auto pos = const_cast<iterator>(position);
-
-                pos = shift_(pos, count);
-                auto copy_target = pos;
-                for (size_type i = 0; i < count; ++i)
-                    *copy_target++ = x;
-
-                return pos;
-            }
-
-            template<class InputIterator>
-            iterator insert(const_iterator position, InputIterator first,
-                            InputIterator last)
-            {
-                auto pos = const_cast<iterator>(position);
-                auto count = static_cast<size_type>(last - first);
-
-                pos = shift_(pos, count);
-                copy(first, last, pos);
-
-                return pos;
-            }
-
-            iterator insert(const_iterator position, initializer_list<T> init)
-            {
-                auto pos = const_cast<iterator>(position);
-
-                pos = shift_(pos, init.size());
-                copy(init.begin(), init.end(), pos);
-
-                return pos;
-            }
-
-            iterator erase(const_iterator position)
-            {
-                iterator pos = const_cast<iterator>(position);
-                copy(position + 1, cend(), pos);
-                --size_;
-
-                return pos;
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                iterator pos = const_cast<iterator>(first);
-                copy(last, cend(), pos);
-                size_ -= static_cast<size_type>(last - first);
-
-                return pos;
-            }
-
-            void swap(vector& other)
-                noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
-                         allocator_traits<Allocator>::is_always_equal::value)
-            {
-                std::swap(data_, other.data_);
-                std::swap(size_, other.size_);
-                std::swap(capacity_, other.capacity_);
-            }
-
-            void clear() noexcept
-            {
-                // Note: Capacity remains unchanged.
-                destroy_from_end_until_(begin());
-                size_ = 0;
-            }
-
-        private:
-            value_type* data_;
-            size_type size_;
-            size_type capacity_;
-            allocator_type allocator_;
-
-            void resize_without_copy_(size_type capacity)
-            {
-                if (data_)
-                    allocator_.deallocate(data_, capacity_);
-
-                data_ = allocator_.allocate(capacity);
-                size_ = 0;
-                capacity_ = capacity;
-            }
-
-            void resize_with_copy_(size_type size, size_type capacity)
-            {
-                if (size < size_)
-                    destroy_from_end_until_(begin() + size);
-
-                if(capacity_ == 0 || capacity_ < capacity)
-                {
-                    auto new_data = allocator_.allocate(capacity);
-
-                    auto to_copy = min(size, size_);
-                    for (size_type i = 0; i < to_copy; ++i)
-                        new_data[i] = move(data_[i]);
-
-                    std::swap(data_, new_data);
-
-                    allocator_.deallocate(new_data, capacity_);
-                }
-
-                capacity_ = capacity;
-                size_ = size;
-            }
-
-            void destroy_from_end_until_(iterator target)
-            {
-                if (!empty())
-                {
-                    auto last = end();
-                    while(last != target)
-                        allocator_traits<Allocator>::destroy(allocator_, --last);
-                }
-            }
-
-            size_type next_capacity_(size_type hint = 0) const noexcept
-            {
-                if (hint != 0)
-                    return max(capacity_ * 2, hint);
-                else
-                    return max(capacity_ * 2, size_type{2u});
-            }
-
-            iterator shift_(iterator position, size_type count)
-            {
-                if (size_ + count < capacity_)
-                {
-                    copy_backward(position, end(), end() + count);
-                    size_ += count;
-
-                    return position;
-                }
-                else
-                {
-                    auto start_idx = static_cast<size_type>(position - begin());
-                    auto end_idx = start_idx + count;
-                    auto new_size = size_ + count;
-
-                    // Auxiliary vector for easier swap.
-                    vector tmp{};
-                    tmp.resize_without_copy_(max(new_size, capacity_));
-                    tmp.size_ = new_size;
-
-                    // Copy before insertion index.
-                    copy(begin(), begin() + start_idx, tmp.begin());
-
-                    // Copy after insertion index.
-                    copy(begin() + start_idx, end(), tmp.begin() + end_idx);
-
-                    swap(tmp);
-
-                    // Position was invalidated!
-                    return begin() + start_idx;
-                }
-            }
-    };
-
-    template<class T, class Alloc>
-    bool operator==(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        if (lhs.size() != rhs.size())
-            return false;
-
-        for (decltype(lhs.size()) i = 0; i < lhs.size(); ++i)
-        {
-            if (lhs[i] != rhs[i])
-                return false;
-        }
-
-        return true;
-    }
-
-    template<class T, class Alloc>
-    bool operator<(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        auto min_size = min(lhs.size(), rhs.size());
-        for (decltype(lhs.size()) i = 0; i < min_size; ++i)
-        {
-            if (lhs[i] >= rhs[i])
-                return false;
-        }
-
-        if (lhs.size() == rhs.size())
-            return true;
-        else
-            return lhs.size() < rhs.size();
-    }
-
-    template<class T, class Alloc>
-    bool operator!=(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class T, class Alloc>
-    bool operator>(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class T, class Alloc>
-    bool operator>=(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class T, class Alloc>
-    bool operator<=(const vector<T, Alloc>& lhs, const vector<T, Alloc>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    /**
-     * 23.3.6.6, specialized algorithms:
-     */
-    template<class T, class Alloc>
-    void swap(vector<T, Alloc>& lhs, vector<T, Alloc>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 23.3.7, class vector<bool>:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/algorithm.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/algorithm.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1162 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ALGORITHM
-#define LIBCPP_BITS_ALGORITHM
-
-#include <iterator>
-#include <utility>
-
-namespace std
-{
-    template<class T>
-    struct less;
-
-    /**
-     * 25.2, non-modyfing sequence operations:
-     */
-
-    /**
-     * 25.2.1, all_of:
-     */
-
-    template<class InputIterator, class Predicate>
-    bool all_of(InputIterator first, InputIterator last, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (!pred(*first++))
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * 25.2.2, any_of:
-     */
-
-    template<class InputIterator, class Predicate>
-    bool any_of(InputIterator first, InputIterator last, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (pred(*first++))
-                return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * 25.2.3, none_of:
-     */
-
-    template<class InputIterator, class Predicate>
-    bool none_of(InputIterator first, InputIterator last, Predicate pred)
-    {
-        return !any_of(first, last, pred);
-    }
-
-    /**
-     * 25.2.4, for_each:
-     */
-
-    template<class InputIterator, class Function>
-    Function for_each(InputIterator first, InputIterator last, Function f)
-    {
-        while (first != last)
-            f(*first++);
-
-        return move(f);
-    }
-
-    /**
-     * 25.2.5, find:
-     */
-
-    template<class InputIterator, class T>
-    InputIterator find(InputIterator first, InputIterator last, const T& value)
-    {
-        while (first != last)
-        {
-            if (*first == value)
-                return first;
-            ++first;
-        }
-
-        return last;
-    }
-
-    template<class InputIterator, class Predicate>
-    InputIterator find_if(InputIterator first, InputIterator last, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (pred(*first))
-                return first;
-            ++first;
-        }
-
-        return last;
-    }
-
-    template<class InputIterator, class Predicate>
-    InputIterator find_if_not(InputIterator first, InputIterator last, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (!pred(*first))
-                return first;
-            ++first;
-        }
-
-        return last;
-    }
-
-    /**
-     * 25.2.6, find_end:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.2.7, find_first:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.2.8, adjacent_find:
-     */
-
-    template<class ForwardIterator>
-    ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last)
-    {
-        while (first != last)
-        {
-            if (*first == *(first + 1))
-                return first;
-            ++first;
-        }
-
-        return last;
-    }
-
-    template<class ForwardIterator, class Predicate>
-    ForwardIterator adjacent_find(ForwardIterator first, ForwardIterator last, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (pred(*first, *(first + 1)))
-                return first;
-            ++first;
-        }
-
-        return last;
-    }
-
-    /**
-     * 25.2.9, count:
-     */
-
-    template<class InputIterator, class T>
-    typename iterator_traits<InputIterator>::difference_type
-    count(InputIterator first, InputIterator last, const T& value)
-    {
-        typename iterator_traits<InputIterator>::difference_type cnt{};
-
-        while (first != last)
-        {
-            if (*first++ == value)
-                ++cnt;
-        }
-
-        return cnt;
-    }
-
-    template<class InputIterator, class Predicate>
-    typename iterator_traits<InputIterator>::difference_type
-    count_if(InputIterator first, InputIterator last, Predicate pred)
-    {
-        typename iterator_traits<InputIterator>::difference_type cnt{};
-
-        while (first != last)
-        {
-            if (pred(*first++))
-                ++cnt;
-        }
-
-        return cnt;
-    }
-
-    /**
-     * 25.2.10, mismatch:
-     */
-
-    template<class InputIterator1, class InputIterator2>
-    pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, InputIterator1 last1,
-                                                  InputIterator2 first2)
-    {
-        while (first1 != last1 && *first1 == *first2)
-        {
-            ++first1;
-            ++first2;
-        }
-
-        return make_pair(first1, first2);
-    }
-
-    template<class InputIterator1, class InputIterator2, class BinaryPredicate>
-    pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, InputIterator1 last1,
-                                                  InputIterator2 first2, BinaryPredicate pred)
-    {
-        while (first1 != last1 && pred(*first1, *first2))
-        {
-            ++first1;
-            ++first2;
-        }
-
-        return make_pair(first1, first2);
-    }
-
-    template<class InputIterator1, class InputIterator2>
-    pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, InputIterator1 last1,
-                                                  InputIterator2 first2, InputIterator2 last2)
-    {
-        while (first1 != last1 && first2 != last2 && *first1 == *first2)
-        {
-            ++first1;
-            ++first2;
-        }
-
-        return make_pair(first1, first2);
-    }
-
-    template<class InputIterator1, class InputIterator2, class BinaryPredicate>
-    pair<InputIterator1, InputIterator2> mismatch(InputIterator1 first1, InputIterator1 last1,
-                                                  InputIterator2 first2, InputIterator2 last2,
-                                                  BinaryPredicate pred)
-    {
-        while (first1 != last1 && first2 != last2 && pred(*first1, *first2))
-        {
-            ++first1;
-            ++first2;
-        }
-
-        return make_pair(first1, first2);
-    }
-
-    /**
-     * 25.2.11, equal:
-     */
-
-    template<class InputIterator1, class InputIterator2>
-    bool equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
-    {
-        while (first1 != last1)
-        {
-            if (*first1++ != *first2++)
-                return false;
-        }
-
-        return true;
-    }
-
-    template<class InputIterator1, class InputIterator2>
-    bool equal(InputIterator1 first1, InputIterator1 last1,
-               InputIterator2 first2, InputIterator2 last2)
-    {
-        while (first1 != last1 && first2 != last2)
-        {
-            if (*first1++ != *first2++)
-                return false;
-        }
-
-        return true;
-    }
-
-    template<class InputIterator1, class InputIterator2, class BinaryPredicate>
-    bool equal(InputIterator1 first1, InputIterator1 last1,
-               InputIterator2 first2, BinaryPredicate pred)
-    {
-        while (first1 != last1)
-        {
-            if (!pred(*first1++, *first2++))
-                return false;
-        }
-
-        return true;
-    }
-
-    template<class InputIterator1, class InputIterator2, class BinaryPredicate>
-    bool equal(InputIterator1 first1, InputIterator1 last1,
-               InputIterator2 first2, InputIterator2 last2,
-               BinaryPredicate pred)
-    {
-        while (first1 != last1 && first2 != last2)
-        {
-            if (!pred(*first1++, *first2++))
-                return false;
-        }
-
-        return true;
-    }
-
-    /**
-     * 25.2.12, is_permutation:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.2.13, search:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.3, mutating sequence operations:
-     */
-
-    /**
-     * 25.3.1, copy:
-     */
-
-    template<class InputIterator, class OutputIterator>
-    OutputIterator copy(InputIterator first, InputIterator last, OutputIterator result)
-    {
-        while (first != last)
-            *result++ = *first++;
-
-        return result;
-    }
-
-    template<class InputIterator, class Size, class OutputIterator>
-    OutputIterator copy_n(InputIterator first, Size count, OutputIterator result)
-    {
-        for (Size i = 0; i < count; ++i, ++first, ++result)
-            *result = *first;
-
-        return result;
-    }
-
-    template<class InputIterator, class OutputIterator, class Predicate>
-    OutputIterator copy_if(InputIterator first, InputIterator last,
-                           OutputIterator result, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (pred(*first))
-                *result++ = *first;
-            ++first;
-        }
-
-        return result;
-    }
-
-    template<class BidirectionalIterator1, class BidirectionalIterator2>
-    BidirectionalIterator2 copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
-                                         BidirectionalIterator2 result)
-    {
-        // Note: We're copying [first, last) so we need to skip the initial value of last.
-        while (last-- != first)
-            *result-- = *last;
-
-        return result;
-    }
-
-    /**
-     * 25.3.2, move:
-     */
-
-    template<class InputIterator, class OutputIterator>
-    OutputIterator move(InputIterator first, InputIterator last, OutputIterator result)
-    {
-        while (first != last)
-            *result++ = move(*first++);
-
-        return result;
-    }
-
-    template<class BidirectionalIterator1, class BidirectionalIterator2>
-    BidirectionalIterator2 move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
-                                         BidirectionalIterator2 result)
-    {
-        // Note: We're copying [first, last) so we need to skip the initial value of last.
-        while (last-- != first)
-            *result-- = move(*last);
-    }
-
-    /**
-     * 25.3.3, swap:
-     */
-
-    template<class ForwardIterator1, class ForwardIterator2>
-    ForwardIterator2 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1,
-                                 ForwardIterator2 first2)
-    {
-        while (first1 != last1)
-            swap(*first1++, *first2++);
-
-        return first2;
-    }
-
-    template<class ForwardIterator1, class ForwardIterator2>
-    void iter_swap(ForwardIterator1 iter1, ForwardIterator2 iter2)
-    {
-        swap(*iter1, *iter2);
-    }
-
-    /**
-     * 25.3.4, transform:
-     */
-
-    template<class InputIterator, class OutputIterator, class UnaryOperation>
-    OutputIterator transform(InputIterator first, InputIterator last,
-                             OutputIterator result, UnaryOperation op)
-    {
-        while (first != last)
-            *result++ = op(*first++);
-
-        return result;
-    }
-
-    template<class InputIterator1, class InputIterator2,
-             class OutputIterator, class BinaryOperation>
-    OutputIterator transform(InputIterator1 first1, InputIterator1 last1,
-                             InputIterator2 first2, OutputIterator result,
-                             BinaryOperation op)
-    {
-        while (first1 != last1)
-            *result++ = op(*first1++, *first2++);
-
-        return result;
-    }
-
-    /**
-     * 25.3.5, replace:
-     */
-
-    template<class ForwardIterator, class T>
-    void replace(ForwardIterator first, ForwardIterator last,
-                 const T& old_value, const T& new_value)
-    {
-        while (first != last)
-        {
-            if (*first == old_value)
-                *first = new_value;
-            ++first;
-        }
-    }
-
-    template<class ForwardIterator, class Predicate, class T>
-    void replace_if(ForwardIterator first, ForwardIterator last,
-                    Predicate pred, const T& new_value)
-    {
-        while (first != last)
-        {
-            if (pred(*first))
-                *first = new_value;
-            ++first;
-        }
-    }
-
-    template<class InputIterator, class OutputIterator, class T>
-    OutputIterator replace_copy(InputIterator first, InputIterator last,
-                                OutputIterator result, const T& old_value,
-                                const T& new_value)
-    {
-        while (first != last)
-        {
-            if (*first == old_value)
-                *result = new_value;
-            else
-                *result = *first;
-
-            ++first;
-            ++result;
-        }
-    }
-
-    template<class InputIterator, class OutputIterator, class Predicate, class T>
-    OutputIterator replace_copy_if(InputIterator first, InputIterator last,
-                                OutputIterator result, Predicate pred,
-                                const T& new_value)
-    {
-        while (first != last)
-        {
-            if (pred(*first))
-                *result = new_value;
-            else
-                *result = *first;
-
-            ++first;
-            ++result;
-        }
-    }
-
-    /**
-     * 25.3.6, fill:
-     */
-
-    template<class ForwardIterator, class T>
-    void fill(ForwardIterator first, ForwardIterator last, const T& value)
-    {
-        while (first != last)
-            *first++ = value;
-    }
-
-    template<class InputIterator, class Size, class T>
-    void fill_n(InputIterator first, Size count, const T& value)
-    {
-        for (Size i = 0; i < count; ++i)
-            *first++ = value;
-    }
-
-    /**
-     * 25.3.7, generate:
-     */
-
-    template<class ForwardIterator, class Generator>
-    void generate(ForwardIterator first, ForwardIterator last,
-                  Generator gen)
-    {
-        while (first != last)
-            *first++ = gen();
-    }
-
-    template<class OutputIterator, class Size, class Generator>
-    void generate(OutputIterator first, Size count, Generator gen)
-    {
-        for (Size i = 0; i < count; ++i)
-            *first++ = gen();
-    }
-
-    /**
-     * 25.3.8, remove:
-     */
-
-    template<class ForwardIterator, class T>
-    ForwardIterator remove(ForwardIterator first, ForwardIterator last,
-                           const T& value)
-    {
-        auto it = first;
-        while (it != last)
-        {
-            if (*it != value)
-                *first++ = move(*it);
-        }
-
-        return first;
-    }
-
-    template<class ForwardIterator, class Predicate>
-    ForwardIterator remove_if(ForwardIterator first, ForwardIterator last,
-                              Predicate pred)
-    {
-        auto it = first;
-        while (it != last)
-        {
-            if (!pred(*it))
-                *first++ = move(*it);
-        }
-
-        return first;
-    }
-
-    template<class InputIterator, class OutputIterator, class T>
-    OutputIterator remove_copy(InputIterator first, InputIterator last,
-                               OutputIterator result, const T& value)
-    {
-        while (first != last)
-        {
-            if (*first != value)
-                *result++ = *first;
-            ++first;
-        }
-
-        return result;
-    }
-
-    template<class InputIterator, class OutputIterator, class Predicate>
-    OutputIterator remove_copy_if(InputIterator first, InputIterator last,
-                                  OutputIterator result, Predicate pred)
-    {
-        while (first != last)
-        {
-            if (!pred(*first))
-                *result++ = *first;
-            ++first;
-        }
-
-        return result;
-    }
-
-    /**
-     * 25.3.9, unique:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.3.10, reverse:
-     */
-
-    template<class BidirectionalIterator>
-    void reverse(BidirectionalIterator first, BidirectionalIterator last)
-    {
-        if (first == last)
-            return;
-        auto mid_count = (last - first) / 2;
-
-        --last;
-        for (decltype(mid_count) i = 0; i < mid_count; ++i)
-            iter_swap(first++, last--);
-    }
-
-    template<class BidirectionalIterator, class OutputIterator>
-    OutputIterator reverse_copy(BidirectionalIterator first,
-                                BidirectionalIterator last,
-                                OutputIterator result)
-    {
-        while (--last != first)
-            *result++ = *last;
-    }
-
-    /**
-     * 25.3.11, rotate:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.3.12, shuffle:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.3.13, partitions:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4, sorting and related operations:
-     */
-
-    /**
-     * 25.4.1, sorting:
-     */
-
-    /**
-     * 25.4.1.1, sort:
-     */
-
-    template<class RandomAccessIterator, class Compare>
-    void make_heap(RandomAccessIterator, RandomAccessIterator,
-                   Compare);
-
-    template<class RandomAccessIterator, class Compare>
-    void sort_heap(RandomAccessIterator, RandomAccessIterator,
-                   Compare);
-
-    template<class RandomAccessIterator>
-    void sort(RandomAccessIterator first, RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        sort(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    void sort(RandomAccessIterator first, RandomAccessIterator last,
-              Compare comp)
-    {
-        /**
-         * Note: This isn't the most effective approach,
-         *       but since we already have these two functions
-         *       and they satisfy asymptotic limitations
-         *       imposed by the standard, we're using them at
-         *       the moment. Might be good to change it to qsort
-         *       or merge sort later.
-         */
-
-        make_heap(first, last, comp);
-        sort_heap(first, last, comp);
-    }
-
-    /**
-     * 25.4.1.2, stable_sort:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.1.3, partial_sort:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.1.4, partial_sort_copy:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.1.5, is_sorted:
-     */
-
-    template<class ForwardIterator>
-    bool is_sorted(ForwardIterator first, ForwardIterator last)
-    {
-        return is_sorted_until(first, last) == last;
-    }
-
-    template<class ForwardIterator, class Comp>
-    bool is_sorted(ForwardIterator first, ForwardIterator last,
-                   Comp comp)
-    {
-        return is_sorted_until(first, last, comp) == last;
-    }
-
-    template<class ForwardIterator>
-    ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last)
-    {
-        if (distance(first, last) < 2)
-            return last;
-
-        while (first != last)
-        {
-            if (*first > *(++first))
-                return first;
-        }
-
-        return last;
-    }
-
-    template<class ForwardIterator, class Comp>
-    ForwardIterator is_sorted_until(ForwardIterator first, ForwardIterator last,
-                                    Comp comp)
-    {
-        if (distance(first, last) < 2)
-            return last;
-
-        while (first != last)
-        {
-            if (!comp(*first, *(++first)))
-                return first;
-        }
-
-        return last;
-    }
-
-    /**
-     * 25.4.2, nth_element:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.3, binary search:
-     */
-
-    /**
-     * 25.4.3.1, lower_bound
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.3.2, upper_bound
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.3.3, equal_range:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.3.4, binary_search:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.4, merge:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.5, set operations on sorted structures:
-     */
-
-    /**
-     * 25.4.5.1, includes:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.5.2, set_union:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.5.3, set_intersection:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.5.4, set_difference:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.5.5, set_symmetric_difference:
-     */
-
-    // TODO: implement
-
-    /**
-     * 25.4.6, heap operations:
-     */
-
-    namespace aux
-    {
-        template<class T>
-        T heap_parent(T idx)
-        {
-            return (idx - 1) / 2;
-        }
-
-        template<class T>
-        T heap_left_child(T idx)
-        {
-            return 2 * idx + 1;
-        }
-
-        template<class T>
-        T heap_right_child(T idx)
-        {
-            return 2 * idx + 2;
-        }
-
-        template<class RandomAccessIterator, class Size, class Compare>
-        void correct_children(RandomAccessIterator first,
-                              Size idx, Size count, Compare comp)
-        {
-            using aux::heap_left_child;
-            using aux::heap_right_child;
-
-            auto left = heap_left_child(idx);
-            auto right = heap_right_child(idx);
-
-            bool left_incorrect{comp(first[idx], first[left])};
-            bool right_incorrect{comp(first[idx], first[right])};
-            while ((left < count && left_incorrect) ||
-                   (right < count && right_incorrect))
-            {
-                if (right >= count || (left_incorrect && comp(first[right], first[left])))
-                {
-                    swap(first[idx], first[left]);
-
-                    idx = left;
-                }
-                else if (right < count && right_incorrect)
-                {
-                    swap(first[idx], first[right]);
-
-                    idx = right;
-                } // Else should not happen because of the while condition.
-
-                left = heap_left_child(idx);
-                right = heap_right_child(idx);
-
-                left_incorrect = comp(first[idx], first[left]);
-                right_incorrect = comp(first[idx], first[right]);
-            }
-        }
-    }
-
-    /**
-     * 25.4.6.1, push_heap:
-     */
-
-    template<class RandomAccessIterator>
-    void push_heap(RandomAccessIterator first,
-                   RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        push_heap(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    void push_heap(RandomAccessIterator first,
-                   RandomAccessIterator last,
-                   Compare comp)
-    {
-        using aux::heap_parent;
-
-        auto count = distance(first, last);
-        if (count <= 1)
-            return;
-
-        auto idx = count - 1;
-        auto parent = heap_parent(idx);
-        while (idx > 0 && comp(first[parent], first[idx]))
-        {
-            swap(first[idx], first[parent]);
-
-            idx = parent;
-            parent = heap_parent(idx);
-        }
-    }
-
-    /**
-     * 25.4.6.2, pop_heap:
-     */
-
-    template<class RandomAccessIterator>
-    void pop_heap(RandomAccessIterator first,
-                  RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        pop_heap(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    void pop_heap(RandomAccessIterator first,
-                  RandomAccessIterator last,
-                  Compare comp)
-    {
-        auto count = distance(first, last);
-        if (count <= 1)
-            return;
-
-        swap(first[0], first[count - 1]);
-        aux::correct_children(first, decltype(count){}, count - 2, comp);
-    }
-
-    /**
-     * 25.4.6.3, make_heap:
-     */
-
-    template<class RandomAccessIterator>
-    void make_heap(RandomAccessIterator first,
-                   RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        make_heap(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    void make_heap(RandomAccessIterator first,
-                   RandomAccessIterator last,
-                   Compare comp)
-    {
-        auto count = distance(first, last);
-        if (count <= 1)
-            return;
-
-        for (auto i = count; i > 0; --i)
-        {
-            auto idx = i - 1;
-
-            aux::correct_children(first, idx, count, comp);
-        }
-    }
-
-    /**
-     * 25.4.6.4, sort_heap:
-     */
-
-    template<class RandomAccessIterator>
-    void sort_heap(RandomAccessIterator first,
-                   RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        sort_heap(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    void sort_heap(RandomAccessIterator first,
-                   RandomAccessIterator last,
-                   Compare comp)
-    {
-        while (first != last)
-            pop_heap(first, last--, comp);
-    }
-
-    /**
-     * 25.4.6.5, is_heap:
-     */
-
-    template<class RandomAccessIterator>
-    auto is_heap_until(RandomAccessIterator first, RandomAccessIterator last)
-    {
-        using value_type = typename iterator_traits<RandomAccessIterator>::value_type;
-
-        return is_heap_until(first, last, less<value_type>{});
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    auto is_heap_until(RandomAccessIterator first, RandomAccessIterator last,
-                       Compare comp)
-    {
-        using aux::heap_left_child;
-        using aux::heap_right_child;
-
-        auto count = distance(first, last);
-        if (count < 2)
-            return last;
-
-        auto res = first;
-        for (decltype(count) idx = 0; idx < count; ++idx)
-        {
-            auto left = heap_left_child(idx);
-            auto right = heap_right_child(idx);
-
-            if (left < count && comp(first[idx], first[left]))
-                return res;
-            if (right < count && comp(first[idx], first[right]))
-                return res;
-
-            ++res;
-        }
-
-        return res;
-    }
-
-    template<class RandomAccessIterator>
-    bool is_heap(RandomAccessIterator first, RandomAccessIterator last)
-    {
-        return is_heap_until(first, last) == last;
-    }
-
-    template<class RandomAccessIterator, class Compare>
-    bool is_heap(RandomAccessIterator first, RandomAccessIterator last,
-                 Compare comp)
-    {
-        return is_heap_until(first, last, comp) == last;
-    }
-
-    /**
-     * 25.4.7, minimum and maximum:
-     * // TODO: implement container versions when we have
-     *          numeric limits and min/max element
-     * // TODO: versions with comparators
-     * // TODO: minmax
-     */
-
-    template<class T>
-    constexpr const T& min(const T& lhs, const T& rhs)
-    {
-        return (lhs < rhs) ? lhs : rhs;
-    }
-
-    template<class T>
-    constexpr const T& max(const T& lhs, const T& rhs)
-    {
-        return (lhs > rhs) ? lhs : rhs;
-    }
-
-    /**
-     * 25.4.8, lexicographical comparison:
-     */
-
-    template<class InputIterator1, class InputIterator2>
-    bool lexicographical_compare(InputIterator1 first1,
-                                 InputIterator1 last1,
-                                 InputIterator2 first2,
-                                 InputIterator2 last2)
-    {
-        while ((first1 != last1) && (first2 != last2))
-        {
-            if (*first1 < *first2)
-                return true;
-            if (*first2 < *first1)
-                return false;
-
-            ++first1;
-            ++first2;
-        }
-
-        /**
-         * Up until now they are same, so we have to check
-         * if we reached the end on one.
-         */
-        return (first1 == last1) && (first2 != last2);
-    }
-
-    template<class InputIterator1, class InputIterator2, class Compare>
-    bool lexicographical_compare(InputIterator1 first1,
-                                 InputIterator1 last1,
-                                 InputIterator2 first2,
-                                 InputIterator2 last2,
-                                 Compare comp)
-    {
-        while ((first1 != last1) && (first2 != last2))
-        {
-            if (comp(*first1, *first2))
-                return true;
-            if (comp(*first2, *first1))
-                return false;
-
-            ++first1;
-            ++first2;
-        }
-
-        /**
-         * Up until now they are same, so we have to check
-         * if we reached the end on one.
-         */
-        return (first1 == last1) && (first2 != last2);
-    }
-
-    /**
-     * 25.4.9, permutation generators:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/atomic.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/atomic.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ATOMIC
-#define LIBCPP_BITS_ATOMIC
-
-#error "<atomic> is not implemented"
-
-#endif
Index: pace/lib/cpp/include/__bits/aux.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/aux.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_AUX
-#define LIBCPP_BITS_AUX
-
-namespace std
-{
-    /**
-     * 20.10.3, helper class:
-     */
-
-    template<class T, T v>
-    struct integral_constant
-    {
-        static constexpr T value = v;
-
-        using value_type = T;
-        using type       = integral_constant<T, v>;
-
-        constexpr operator value_type() const noexcept
-        {
-            return value;
-        }
-
-        constexpr value_type operator()() const noexcept
-        {
-            return value;
-        }
-    };
-
-    using true_type = integral_constant<bool, true>;
-    using false_type = integral_constant<bool, false>;
-}
-
-namespace std::aux
-{
-    /**
-     * Two very handy templates, this allows us
-     * to easily follow the T::type and T::value
-     * convention by simply inheriting from specific
-     * instantiations of these templates.
-     * Examples:
-     *  1) We need a struct with int typedef'd to type:
-     *
-     *      stuct has_type_int: aux::type<int> {};
-     *      typename has_type_int::type x = 1; // x is of type int
-     *
-     *  2) We need a struct with static size_t member called value:
-     *
-     *      struct has_value_size_t: aux::value<size_t, 1u> {};
-     *      std::printf("%u\n", has_value_size_t::value); // prints "1\n"
-     */
-
-    template<class T>
-    struct type_is
-    {
-        using type = T;
-    };
-
-    // For compatibility with integral_constant.
-    template<class T, T v>
-    using value_is = std::integral_constant<T, v>;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/builtins.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/builtins.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_BUILTINS
-#define LIBCPP_BITS_BUILTINS
-
-/**
- * Note: While the primary target of libcpp is the
- *       g++ compiler, using builtin functions that would
- *       unnecessarily limit the library to any specific
- *       compiler is discouraged and as such all the used
- *       builtins should be available atleast in g++ and
- *       clang++.
- * GCC:  https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
- * LLVM: https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/Builtins.def
- *       (If anyone has a better link for LLVM, feel free to update it.)
- */
-
-#include <cstdlib>
-
-namespace std::aux
-{
-    template<class T>
-    constexpr double log2(T val)
-    {
-        return __builtin_log2(static_cast<double>(val));
-    }
-
-    template<class T>
-    constexpr double pow2(T exp)
-    {
-        return __builtin_pow(2.0, static_cast<double>(exp));
-    }
-
-    template<class T>
-    constexpr size_t pow2u(T exp)
-    {
-        return static_cast<size_t>(pow2(exp));
-    }
-
-    template<class T, class U>
-    constexpr T pow(T base, U exp)
-    {
-        return static_cast<T>(
-            __builtin_pow(static_cast<double>(base), static_cast<double>(exp))
-        );
-    }
-
-    template<class T>
-    constexpr size_t ceil(T val)
-    {
-        return static_cast<size_t>(__builtin_ceil(static_cast<double>(val)));
-    }
-
-    template<class T>
-    constexpr size_t floor(T val)
-    {
-        return static_cast<size_t>(__builtin_floor(static_cast<double>(val)));
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/chrono.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/chrono.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,759 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_CHRONO
-#define LIBCPP_BITS_CHRONO
-
-#include <ctime>
-#include <limits>
-#include <ratio>
-#include <type_traits>
-
-namespace std::chrono
-{
-    /**
-     * 20.12.5, class template duration:
-     */
-
-    // Forward declarations.
-    template<class Rep, class Period = ratio<1>>
-    class duration;
-
-    template<class ToDuration, class Rep, class Period>
-    constexpr ToDuration duration_cast(const duration<Rep, Period>& dur);
-
-    template<class Rep>
-    struct duration_values;
-
-    template<class Rep, class Period>
-    class duration
-    {
-        public:
-            using rep    = Rep;
-            using period = Period;
-
-            /**
-             * 20.12.5.1, construct/copy/destroy:
-             */
-
-            constexpr duration() = default;
-
-            // TODO: check remarks to these two constructors, need is_convertible
-            template<class Rep2>
-            constexpr explicit duration(const Rep2& r)
-                : rep_{r}
-            { /* DUMMY BODY */ }
-
-            template<class Rep2, class Period2>
-            constexpr duration(const duration<Rep2, Period2>& other)
-                : rep_{duration_cast<duration>(other).count()}
-            { /* DUMMY BODY */ }
-
-            ~duration() = default;
-
-            duration(const duration&) = default;
-
-            duration& operator=(const duration&) = default;
-
-            /**
-             * 20.12.5.2, observer:
-             */
-
-            constexpr rep count() const
-            {
-                return rep_;
-            }
-
-            /**
-             * 20.12.5.3, arithmetic:
-             */
-
-            constexpr duration operator+() const
-            {
-                return *this;
-            }
-
-            constexpr duration operator-() const
-            {
-                return duration{-rep_};
-            }
-
-            duration& operator++()
-            {
-                ++rep_;
-
-                return *this;
-            }
-
-            duration operator++(int)
-            {
-                return duration{rep_++};
-            }
-
-            duration& operator--()
-            {
-                --rep_;
-
-                *this;
-            }
-
-            duration operator--(int)
-            {
-                return duration{rep_--};
-            }
-
-            duration& operator+=(const duration& rhs)
-            {
-                rep_ += rhs.count();
-
-                return *this;
-            }
-
-            duration& operator-=(const duration& rhs)
-            {
-                rep_ -= rhs.count();
-
-                return *this;
-            }
-
-            duration& operator*=(const rep& rhs)
-            {
-                rep_ *= rhs;
-
-                return *this;
-            }
-
-            duration& operator/=(const rep& rhs)
-            {
-                rep_ /= rhs;
-
-                return *this;
-            }
-
-            duration& operator%=(const rep& rhs)
-            {
-                rep_ %= rhs;
-
-                return *this;
-            }
-
-            duration& operator%=(const duration& rhs)
-            {
-                rep_ %= rhs.count();
-
-                return *this;
-            }
-
-            /**
-             * 20.12.5.4, special values:
-             */
-
-            static constexpr duration zero()
-            {
-                return duration{duration_values<rep>::zero()};
-            }
-
-            static constexpr duration min()
-            {
-                return duration{duration_values<rep>::min()};
-            }
-
-            static constexpr duration max()
-            {
-                return duration{duration_values<rep>::max()};
-            }
-
-        private:
-            rep rep_;
-    };
-
-    /**
-     * 20.12.6, class template time_point:
-     */
-
-    template<class Clock, class Duration = typename Clock::duration>
-    class time_point
-    {
-        public:
-            using clock    = Clock;
-            using duration = Duration;
-            using rep      = typename duration::rep;
-            using period   = typename duration::period;
-
-            /**
-             * 20.12.6.1, construct:
-             */
-
-            constexpr time_point()
-                : duration_{duration::zero()}
-            { /* DUMMY BODY */ }
-
-            constexpr explicit time_point(const duration& d)
-                : duration_{d}
-            { /* DUMMY BODY */ }
-
-            // TODO: see remark to this constuctor
-            template<class Duration2>
-            constexpr time_point(const time_point<clock, Duration2>& other)
-                : duration_{static_cast<duration>(other.time_since_epoch())}
-            { /* DUMMY BODY */ }
-
-            /**
-             * 20.12.6.2, observer:
-             */
-
-            constexpr duration time_since_epoch() const
-            {
-                return duration_;
-            }
-
-            /**
-             * 20.12.6.3, arithmetic:
-             */
-
-            time_point& operator+=(const duration& rhs)
-            {
-                duration_ += rhs;
-
-                return *this;
-            }
-
-            time_point& operator-=(const duration& rhs)
-            {
-                duration_ -= rhs;
-
-                return *this;
-            }
-
-            /**
-             * 20.12.6.4, special values:
-             */
-
-            static constexpr time_point min()
-            {
-                return time_point{duration::min()};
-            }
-
-            static constexpr time_point max()
-            {
-                return time_point{duration::max()};
-            }
-
-        private:
-            duration duration_;
-    };
-}
-
-namespace std
-{
-    /**
-     * 20.12.4.3, common_type specializations:
-     */
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
-    {
-        using type = chrono::duration<
-            common_type_t<Rep1, Rep2>,
-            ratio<aux::gcd_v<Period1::num, Period2::num>, aux::lcm_v<Period1::den, Period2::den>>
-        >;
-    };
-
-    template<class Clock, class Duration1, class Duration2>
-    struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>
-    {
-        using type = chrono::time_point<Clock, common_type_t<Duration1, Duration2>>;
-    };
-}
-
-namespace std::chrono
-{
-    /**
-     * 20.12.4, customization traits:
-     */
-
-    template<class Rep>
-    struct treat_as_floating_point: is_floating_point<Rep>
-    { /* DUMMY BODY */ };
-
-    template<class Rep>
-    struct duration_values
-    {
-        static constexpr Rep zero()
-        {
-            // Note: Using Rep(0) instead of Rep{} is intentional, do not change.
-            return Rep(0);
-        }
-
-        static constexpr Rep min()
-        {
-            return numeric_limits<Rep>::lowest();
-        }
-
-        static constexpr Rep max()
-        {
-            return numeric_limits<Rep>::max();
-        }
-    };
-
-    /**
-     * 20.12.5.5, duration arithmetic:
-     */
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
-    operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        using CD = common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>;
-        return CD(CD(lhs).count() + CD(rhs).count());
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
-    operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        using CD = common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>;
-        return CD(CD(lhs).count() - CD(rhs).count());
-    }
-
-    // TODO: This shall not participate in overloading if Rep2 is not implicitly
-    //       convertible to CR(Rep1, Rep2) -> CR(A, B) defined in standard as
-    //       common_type_t<A, B>.
-    template<class Rep1, class Period, class Rep2>
-    constexpr duration<common_type_t<Rep1, Rep2>, Period>
-    operator*(const duration<Rep1, Period>& dur, const Rep2& rep)
-    {
-        using CD = duration<common_type_t<Rep1, Rep2>, Period>;
-        return CD(CD(dur).count() * rep);
-    }
-
-    // TODO: This shall not participate in overloading if Rep2 is not implicitly
-    //       convertible to CR(Rep1, Rep2) -> CR(A, B) defined in standard as
-    //       common_type_t<A, B>.
-    template<class Rep1, class Period, class Rep2>
-    constexpr duration<common_type_t<Rep1, Rep2>, Period>
-    operator*(const Rep2& rep, const duration<Rep1, Period>& dur)
-    {
-        return dur * rep;
-    }
-
-    // TODO: This shall not participate in overloading if Rep2 is not implicitly
-    //       convertible to CR(Rep1, Rep2) -> CR(A, B) defined in standard as
-    //       common_type_t<A, B>.
-    template<class Rep1, class Period, class Rep2>
-    constexpr duration<common_type_t<Rep1, Rep2>, Period>
-    operator/(const duration<Rep1, Period>& dur, const Rep2& rep)
-    {
-        using CD = duration<common_type_t<Rep1, Rep2>, Period>;
-        return CD(CD(dur).count() / rep);
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr common_type_t<Rep1, Rep2>
-    operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        using CD = common_type_t<Rep1, Rep2>;
-        return CD(lhs).count() / CD(rhs).count();
-    }
-
-    // TODO: This shall not participate in overloading if Rep2 is not implicitly
-    //       convertible to CR(Rep1, Rep2) -> CR(A, B) defined in standard as
-    //       common_type_t<A, B>.
-    template<class Rep1, class Period, class Rep2>
-    constexpr duration<common_type_t<Rep1, Rep2>, Period>
-    operator%(const duration<Rep1, Period>& dur, const Rep2& rep)
-    {
-        using CD = duration<common_type_t<Rep1, Rep2>, Period>;
-        return CD(CD(dur).count() / rep);
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
-    operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        using CD = common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>;
-        return CD(CD(lhs).count() % CD(rhs).count());
-    }
-
-    /**
-     * 20.12.5.6, duration comparisons:
-     */
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator==(const duration<Rep1, Period1>& lhs,
-                              const duration<Rep2, Period2>& rhs)
-    {
-        using CT = common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>;
-        return CT(lhs).count() == CT(rhs).count();
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator!=(const duration<Rep1, Period1>& lhs,
-                              const duration<Rep2, Period2>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator<(const duration<Rep1, Period1>& lhs,
-                             const duration<Rep2, Period2>& rhs)
-    {
-        using CT = common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>;
-        return CT(lhs).count() < CT(rhs).count();
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator<=(const duration<Rep1, Period1>& lhs,
-                              const duration<Rep2, Period2>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator>(const duration<Rep1, Period1>& lhs,
-                             const duration<Rep2, Period2>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Rep1, class Period1, class Rep2, class Period2>
-    constexpr bool operator>=(const duration<Rep1, Period1>& lhs,
-                              const duration<Rep2, Period2>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    /**
-     * 20.12.5.7, duration cast:
-     */
-
-    // TODO: This function should not participate in overloading
-    //       unless ToDuration is an instantiation of duration.
-    template<class ToDuration, class Rep, class Period>
-    constexpr ToDuration duration_cast(const duration<Rep, Period>& dur)
-    {
-        using CF = ratio_divide<Period, typename ToDuration::period>;
-        using CR = typename common_type<typename ToDuration::rep, Rep, intmax_t>::type;
-
-        using to_rep = typename ToDuration::rep;
-
-        if constexpr (CF::num == 1 && CF::den == 1)
-            return ToDuration(static_cast<to_rep>(dur.count()));
-        else if constexpr (CF::num != 1 && CF::den == 1)
-        {
-            return ToDuration(
-                static_cast<to_rep>(
-                    static_cast<CR>(dur.count()) * static_cast<CR>(CF::num)
-                )
-            );
-        }
-        else if constexpr (CF::num == 1 && CF::den != 1)
-        {
-            return ToDuration(
-                static_cast<to_rep>(
-                    static_cast<CR>(dur.count()) / static_cast<CR>(CF::den)
-                )
-            );
-        }
-        else
-        {
-            return ToDuration(
-                static_cast<to_rep>(
-                    static_cast<CR>(dur.count()) * static_cast<CR>(CF::num)
-                    / static_cast<CR>(CF::den)
-                )
-            );
-        }
-    }
-
-    // convenience typedefs
-    using nanoseconds  = duration<int64_t, nano>;
-    using microseconds = duration<int64_t, micro>;
-    using milliseconds = duration<int64_t, milli>;
-    using seconds      = duration<int64_t>;
-    using minutes      = duration<int32_t, ratio<60>>;
-    using hours        = duration<int32_t, ratio<3600>>;
-
-    /**
-     * 20.12.6.5, time_point arithmetic:
-     */
-
-    template<class Clock, class Duration1, class Rep2, class Period2>
-    constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
-    operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        using CT = time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>;
-        return CT(lhs.time_since_epoch() + rhs);
-    }
-
-    template<class Rep1, class Period1, class Clock, class Duration2>
-    constexpr time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
-    operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs)
-    {
-        return rhs + lhs;
-    }
-
-    template<class Clock, class Duration1, class Rep2, class Period2>
-    constexpr time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
-    operator-(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs)
-    {
-        return lhs + (-rhs);
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr common_type_t<Duration1, Duration2>
-    operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs)
-    {
-        return lhs.time_since_epoch() - rhs.time_since_epoch();
-    }
-
-    /**
-     * 20.12.6.6, time_point comparisons:
-     */
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator==(const time_point<Clock, Duration1>& lhs,
-                              const time_point<Clock, Duration2>& rhs)
-    {
-        return lhs.time_since_epoch() == rhs.time_since_epoch();
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator!=(const time_point<Clock, Duration1>& lhs,
-                              const time_point<Clock, Duration2>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator<(const time_point<Clock, Duration1>& lhs,
-                             const time_point<Clock, Duration2>& rhs)
-    {
-        return lhs.time_since_epoch() < rhs.time_since_epoch();
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator<=(const time_point<Clock, Duration1>& lhs,
-                              const time_point<Clock, Duration2>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator>(const time_point<Clock, Duration1>& lhs,
-                             const time_point<Clock, Duration2>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Clock, class Duration1, class Duration2>
-    constexpr bool operator>=(const time_point<Clock, Duration1>& lhs,
-                              const time_point<Clock, Duration2>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    /**
-     * 20.12.6.7, time_point cast:
-     */
-
-    // TODO: This function should not participate in overloading
-    //       unless ToDuration is an instantiation of duration.
-    template<class ToDuration, class Clock, class Duration>
-    constexpr time_point<Clock, ToDuration>
-    time_point_cast(const time_point<Clock, Duration>& tp)
-    {
-        return time_point<Clock, ToDuration>(
-            duration_cast<ToDuration>(tp.time_since_epoch())
-        );
-    }
-
-    /**
-     * 20.12.7, clocks:
-     */
-
-    class system_clock
-    {
-        public:
-            using rep        = int64_t;
-            using period     = micro;
-            using duration   = chrono::duration<rep, period>;
-            using time_point = chrono::time_point<system_clock>;
-
-            // TODO: is it steady?
-            static constexpr bool is_steady = true;
-
-            static time_point now()
-            {
-                ::std::timespec ts{};
-                ::helenos::getrealtime(&ts);
-
-                rep time = NSEC2USEC(ts.tv_nsec);
-                time += (ts.tv_sec * 1'000'000ul);
-
-                return time_point{duration{time - epoch_usecs}};
-            }
-
-            static time_t to_time_t(const time_point& tp)
-            {
-                /* auto dur = tp.time_since_epoch(); */
-                /* auto time_t_dur = duration_cast<chrono::duration<time_t, seconds>>(dur); */
-
-                /* return time_t{time_t_dur.count()}; */
-                return time_t{};
-            }
-
-            static time_point from_time_t(time_t tt)
-            {
-                /* auto time_t_dur = chrono::duration<time_t, seconds>{tt}; */
-                /* auto dur = duration_cast<duration>(time_t_dur); */
-
-                /* return time_point{duration_cast<duration>(chrono::duration<time_t, seconds>{tt})}; */
-                return time_point{};
-            }
-
-        private:
-            static constexpr rep epoch_usecs{11644473600ul * 1'000'000ul};
-    };
-
-    class steady_clock
-    {
-        public:
-            using rep        = int64_t;
-            using period     = micro;
-            using duration   = chrono::duration<rep, period>;
-            using time_point = chrono::time_point<steady_clock>;
-
-            static constexpr bool is_steady = true;
-
-            static time_point now()
-            {
-                ::std::timespec ts{};
-                ::helenos::getuptime(&ts);
-
-                rep time = NSEC2USEC(ts.tv_nsec);
-                time += (ts.tv_sec * 1'000'000ul);
-
-                return time_point{duration{time}};
-            }
-    };
-
-    using high_resolution_clock = system_clock;
-}
-
-namespace std
-{
-    inline namespace literals
-    {
-        inline namespace chrono_literals
-        {
-            /**
-             * 20.125.8, suffixes for duration literals:
-             */
-
-            /**
-             * Note: According to the standard, literal suffixes that do not
-             *       start with an underscore are reserved for future standardization,
-             *       but since we are implementing the standard, we're going to ignore it.
-             *       This should work (according to their documentation) work for clang,
-             *       but that should be tested.
-             */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wliteral-suffix"
-
-            constexpr chrono::hours operator ""h(unsigned long long hrs)
-            {
-                return chrono::hours{static_cast<chrono::hours::rep>(hrs)};
-            }
-
-            constexpr chrono::duration<long double, ratio<3600>> operator ""h(long double hrs)
-            {
-                return chrono::duration<long double, ratio<3600>>{hrs};
-            }
-
-            constexpr chrono::minutes operator ""m(unsigned long long mins)
-            {
-                return chrono::minutes{static_cast<chrono::minutes::rep>(mins)};
-            }
-
-            constexpr chrono::duration<long double, ratio<60>> operator ""m(long double mins)
-            {
-                return chrono::duration<long double, ratio<60>>{mins};
-            }
-
-            constexpr chrono::seconds operator ""s(unsigned long long secs)
-            {
-                return chrono::seconds{static_cast<chrono::seconds::rep>(secs)};
-            }
-
-            constexpr chrono::duration<long double, ratio<1>> operator ""s(long double secs)
-            {
-                return chrono::duration<long double, ratio<1>>{secs};
-            }
-
-            constexpr chrono::milliseconds operator ""ms(unsigned long long msecs)
-            {
-                return chrono::milliseconds{static_cast<chrono::milliseconds::rep>(msecs)};
-            }
-
-            constexpr chrono::duration<long double, milli> operator ""ms(long double msecs)
-            {
-                return chrono::duration<long double, milli>{msecs};
-            }
-
-            constexpr chrono::microseconds operator ""us(unsigned long long usecs)
-            {
-                return chrono::microseconds{static_cast<chrono::microseconds::rep>(usecs)};
-            }
-
-            constexpr chrono::duration<long double, micro> operator ""us(long double usecs)
-            {
-                return chrono::duration<long double, micro>{usecs};
-            }
-
-            constexpr chrono::nanoseconds operator ""ns(unsigned long long nsecs)
-            {
-                return chrono::nanoseconds{static_cast<chrono::nanoseconds::rep>(nsecs)};
-            }
-
-            constexpr chrono::duration<long double, nano> operator ""ns(long double nsecs)
-            {
-                return chrono::duration<long double, nano>{nsecs};
-            }
-
-#pragma GCC diagnostic pop
-        }
-    }
-
-    namespace chrono
-    {
-        using namespace literals::chrono_literals;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/complex.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/complex.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1003 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_COMPLEX
-#define LIBCPP_BITS_COMPLEX
-
-#include <cassert>
-#include <iosfwd>
-#include <sstream>
-
-namespace std
-{
-    template<class T>
-    class complex
-    {
-        public:
-            using value_type = T;
-
-            constexpr complex(const value_type& re = value_type{},
-                              const value_type& im = value_type{})
-                : real_{re}, imag_{im}
-            { /* DUMMY BODY */ }
-
-            constexpr complex(const complex& other)
-                : real_{other.real_}, imag_{other.imag_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            constexpr complex(const complex<U>& other)
-                : real_(other.real()), imag_(other.imag())
-            { /* DUMMY BODY */ }
-
-            constexpr value_type real() const
-            {
-                return real_;
-            }
-
-            void real(value_type val)
-            {
-                real_ = val;
-            }
-
-            constexpr value_type imag() const
-            {
-                return imag_;
-            }
-
-            void imag(value_type val)
-            {
-                imag_ = val;
-            }
-
-            complex& operator=(const value_type& val)
-            {
-                real_ = val;
-                imag_ = value_type{};
-
-                return *this;
-            }
-
-            complex& operator+=(const value_type& val)
-            {
-                real_ += val;
-
-                return *this;
-            }
-
-            complex& operator-=(const value_type& val)
-            {
-                real_ -= val;
-
-                return *this;
-            }
-
-            complex& operator*=(const value_type& val)
-            {
-                real_ *= val;
-                imag_ *= val;
-
-                return *this;
-            }
-
-            complex& operator/=(const value_type& val)
-            {
-                real_ /= val;
-                imag_ /= val;
-
-                return *this;
-            }
-
-            complex& operator=(const complex& other)
-            {
-                real_ = other.real_;
-                imag_ = other.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator=(const complex<U>& rhs)
-            {
-                real_ = rhs.real_;
-                imag_ = rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator+=(const complex<U>& rhs)
-            {
-                real_ += rhs.real_;
-                imag_ += rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator-=(const complex<U>& rhs)
-            {
-                real_ -= rhs.real_;
-                imag_ -= rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator*=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = real_ * rhs.real_ - imag_ * rhs.imag_;
-                imag_ = old_real * rhs.imag_ + imag_ * rhs.real_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator/=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = (real_ * rhs.real_ + imag_ * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-                imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-
-                return *this;
-            }
-
-        private:
-            value_type real_;
-            value_type imag_;
-    };
-
-    template<>
-    class complex<float>
-    {
-        public:
-            using value_type = float;
-
-            constexpr complex(const value_type& re = value_type{},
-                              const value_type& im = value_type{})
-                : real_{re}, imag_{im}
-            { /* DUMMY BODY */ }
-
-            constexpr complex(const complex& other)
-                : real_{other.real_}, imag_{other.imag_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            constexpr complex(const complex<U>& other)
-                : real_(other.real()), imag_(other.imag())
-            { /* DUMMY BODY */ }
-
-            constexpr value_type real() const
-            {
-                return real_;
-            }
-
-            void real(value_type val)
-            {
-                real_ = val;
-            }
-
-            constexpr value_type imag() const
-            {
-                return imag_;
-            }
-
-            void imag(value_type val)
-            {
-                imag_ = val;
-            }
-
-            complex& operator=(const value_type& val)
-            {
-                real_ = val;
-                imag_ = value_type{};
-
-                return *this;
-            }
-
-            complex& operator+=(const value_type& val)
-            {
-                real_ += val;
-
-                return *this;
-            }
-
-            complex& operator-=(const value_type& val)
-            {
-                real_ -= val;
-
-                return *this;
-            }
-
-            complex& operator*=(const value_type& val)
-            {
-                real_ *= val;
-                imag_ *= val;
-
-                return *this;
-            }
-
-            complex& operator/=(const value_type& val)
-            {
-                real_ /= val;
-                imag_ /= val;
-
-                return *this;
-            }
-
-            complex& operator=(const complex& other)
-            {
-                real_ = other.real_;
-                imag_ = other.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator=(const complex<U>& rhs)
-            {
-                real_ = rhs.real_;
-                imag_ = rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator+=(const complex<U>& rhs)
-            {
-                real_ += rhs.real_;
-                imag_ += rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator-=(const complex<U>& rhs)
-            {
-                real_ -= rhs.real_;
-                imag_ -= rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator*=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = real_ * rhs.real_ - imag_ * rhs.imag_;
-                imag_ = old_real * rhs.imag_ + imag_ * rhs.real_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator/=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = (real_ * rhs.real_ + imag_ * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-                imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-
-                return *this;
-            }
-
-        private:
-            value_type real_;
-            value_type imag_;
-    };
-
-    template<>
-    class complex<double>
-    {
-        public:
-            using value_type = double;
-
-            constexpr complex(const value_type& re = value_type{},
-                              const value_type& im = value_type{})
-                : real_{re}, imag_{im}
-            { /* DUMMY BODY */ }
-
-            constexpr complex(const complex& other)
-                : real_{other.real_}, imag_{other.imag_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            constexpr complex(const complex<U>& other)
-                : real_(other.real()), imag_(other.imag())
-            { /* DUMMY BODY */ }
-
-            constexpr value_type real() const
-            {
-                return real_;
-            }
-
-            void real(value_type val)
-            {
-                real_ = val;
-            }
-
-            constexpr value_type imag() const
-            {
-                return imag_;
-            }
-
-            void imag(value_type val)
-            {
-                imag_ = val;
-            }
-
-            complex& operator=(const value_type& val)
-            {
-                real_ = val;
-                imag_ = value_type{};
-
-                return *this;
-            }
-
-            complex& operator+=(const value_type& val)
-            {
-                real_ += val;
-
-                return *this;
-            }
-
-            complex& operator-=(const value_type& val)
-            {
-                real_ -= val;
-
-                return *this;
-            }
-
-            complex& operator*=(const value_type& val)
-            {
-                real_ *= val;
-                imag_ *= val;
-
-                return *this;
-            }
-
-            complex& operator/=(const value_type& val)
-            {
-                real_ /= val;
-                imag_ /= val;
-
-                return *this;
-            }
-
-            complex& operator=(const complex& other)
-            {
-                real_ = other.real_;
-                imag_ = other.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator=(const complex<U>& rhs)
-            {
-                real_ = rhs.real_;
-                imag_ = rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator+=(const complex<U>& rhs)
-            {
-                real_ += rhs.real_;
-                imag_ += rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator-=(const complex<U>& rhs)
-            {
-                real_ -= rhs.real_;
-                imag_ -= rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator*=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = real_ * rhs.real_ - imag_ * rhs.imag_;
-                imag_ = old_real * rhs.imag_ + imag_ * rhs.real_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator/=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = (real_ * rhs.real_ + imag_ * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-                imag_ = (imag_ * rhs.real_ - old_real * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-
-                return *this;
-            }
-
-        private:
-            value_type real_;
-            value_type imag_;
-    };
-
-    template<>
-    class complex<long double>
-    {
-        public:
-            using value_type = long double;
-
-            constexpr complex(const value_type& re = value_type{},
-                              const value_type& im = value_type{})
-                : real_{re}, imag_{im}
-            { /* DUMMY BODY */ }
-
-            constexpr complex(const complex& other)
-                : real_{other.real_}, imag_{other.imag_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            constexpr complex(const complex<U>& other)
-                : real_(other.real()), imag_(other.imag())
-            { /* DUMMY BODY */ }
-
-            constexpr value_type real() const
-            {
-                return real_;
-            }
-
-            void real(value_type val)
-            {
-                real_ = val;
-            }
-
-            constexpr value_type imag() const
-            {
-                return imag_;
-            }
-
-            void imag(value_type val)
-            {
-                imag_ = val;
-            }
-
-            complex& operator=(const value_type& val)
-            {
-                real_ = val;
-                imag_ = value_type{};
-
-                return *this;
-            }
-
-            complex& operator+=(const value_type& val)
-            {
-                real_ += val;
-
-                return *this;
-            }
-
-            complex& operator-=(const value_type& val)
-            {
-                real_ -= val;
-
-                return *this;
-            }
-
-            complex& operator*=(const value_type& val)
-            {
-                real_ *= val;
-                imag_ *= val;
-
-                return *this;
-            }
-
-            complex& operator/=(const value_type& val)
-            {
-                real_ /= val;
-                imag_ /= val;
-
-                return *this;
-            }
-
-            complex& operator=(const complex& other)
-            {
-                real_ = other.real_;
-                imag_ = other.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator=(const complex<U>& rhs)
-            {
-                real_ = rhs.real_;
-                imag_ = rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator+=(const complex<U>& rhs)
-            {
-                real_ += rhs.real_;
-                imag_ += rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator-=(const complex<U>& rhs)
-            {
-                real_ -= rhs.real_;
-                imag_ -= rhs.imag_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator*=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = real_ * rhs.real_ - imag_ * rhs.imag_;
-                imag_ = old_real * rhs.imag_ + imag_ * rhs.real_;
-
-                return *this;
-            }
-
-            template<class U>
-            complex& operator/=(const complex<U>& rhs)
-            {
-                auto old_real = real_;
-                real_ = (real_ * rhs.real_ + imag_ * rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-                imag_ = (imag_ * rhs.real_ - old_real* rhs.imag_)
-                      / (rhs.real_ * rhs.real_ + rhs.imag_ * rhs.imag_);
-
-                return *this;
-            }
-
-        private:
-            value_type real_;
-            value_type imag_;
-    };
-
-    /**
-     * 26.4.6, operators:
-     */
-
-    template<class T>
-    complex<T> operator+(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} += rhs;
-    }
-
-    template<class T>
-    complex<T> operator+(const complex<T>& lhs, const T& rhs)
-    {
-        return complex<T>{lhs} += rhs;
-    }
-
-    template<class T>
-    complex<T> operator+(const T& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} += rhs;
-    }
-
-    template<class T>
-    complex<T> operator-(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} -= rhs;
-    }
-
-    template<class T>
-    complex<T> operator-(const complex<T>& lhs, const T& rhs)
-    {
-        return complex<T>{lhs} -= rhs;
-    }
-
-    template<class T>
-    complex<T> operator-(const T& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} -= rhs;
-    }
-
-    template<class T>
-    complex<T> operator*(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} *= rhs;
-    }
-
-    template<class T>
-    complex<T> operator*(const complex<T>& lhs, const T& rhs)
-    {
-        return complex<T>{lhs} *= rhs;
-    }
-
-    template<class T>
-    complex<T> operator*(const T& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} *= rhs;
-    }
-
-    template<class T>
-    complex<T> operator/(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} /= rhs;
-    }
-
-    template<class T>
-    complex<T> operator/(const complex<T>& lhs, const T& rhs)
-    {
-        return complex<T>{lhs} /= rhs;
-    }
-
-    template<class T>
-    complex<T> operator/(const T& lhs, const complex<T>& rhs)
-    {
-        return complex<T>{lhs} /= rhs;
-    }
-
-    template<class T>
-    complex<T> operator+(const complex<T>& c)
-    {
-        return complex<T>{c};
-    }
-
-    template<class T>
-    complex<T> operator-(const complex<T>& c)
-    {
-        return complex<T>{-c.real(), -c.imag()};
-    }
-
-    template<class T>
-    constexpr bool operator==(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return lhs.real() == rhs.real() && lhs.imag() == rhs.imag();
-    }
-
-    template<class T>
-    constexpr bool operator==(const complex<T>& lhs, const T& rhs)
-    {
-        return lhs.real() == rhs && lhs.imag() == T{};
-    }
-
-    template<class T>
-    constexpr bool operator==(const T& lhs, const complex<T>& rhs)
-    {
-        return lhs == rhs.real() && T{} == rhs.imag();
-    }
-
-    template<class T>
-    constexpr bool operator!=(const complex<T>& lhs, const complex<T>& rhs)
-    {
-        return lhs.real() != rhs.real() || lhs.imag() != rhs.imag();
-    }
-
-    template<class T>
-    constexpr bool operator!=(const complex<T>& lhs, const T& rhs)
-    {
-        return lhs.real() != rhs || lhs.imag() != T{};
-    }
-
-    template<class T>
-    constexpr bool operator!=(const T& lhs, const complex<T>& rhs)
-    {
-        return lhs != rhs.real() || T{} != rhs.imag();
-    }
-
-    template<class T, class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return is;
-    }
-
-    template<class T, class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const complex<T>& c)
-    {
-        basic_ostringstream<Char, Traits> oss{};
-        oss.flags(os.flags());
-        oss.imbue(os.getloc());
-        oss.precision(os.precision());
-
-        oss << "(" << c.real() << "," << c.imag() << ")";
-
-        return os << oss.str();
-    }
-
-    /**
-     * 26.4.7, values:
-     */
-
-    template<class T>
-    constexpr T real(const complex<T>& c)
-    {
-        return c.real();
-    }
-
-    template<class T>
-    constexpr T imag(const complex<T>& c)
-    {
-        return c.imag();
-    }
-
-    template<class T>
-    T abs(const complex<T>& c)
-    {
-        return c.real() * c.real() + c.imag() * c.imag();
-    }
-
-    template<class T>
-    T arg(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    T norm(const complex<T>& c)
-    {
-        return abs(c) * abs(c);
-    }
-
-    template<class T>
-    complex<T> conj(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> proj(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> polar(const T&, const T& = T{})
-    {
-        // TODO: implement
-        __unimplemented();
-        return complex<T>{};
-    }
-
-    /**
-     * 26.4.8, transcendentals:
-     */
-
-    template<class T>
-    complex<T> acos(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> asin(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> atan(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> acosh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> asinh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> atanh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> cos(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> cosh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> exp(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> log(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> log10(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> pow(const complex<T>& base, const T& exp)
-    {
-        // TODO: implement
-        __unimplemented();
-        return base;
-    }
-
-    template<class T>
-    complex<T> pow(const complex<T>& base, const complex<T>& exp)
-    {
-        // TODO: implement
-        __unimplemented();
-        return base;
-    }
-
-    template<class T>
-    complex<T> pow(const T& base, const complex<T>& exp)
-    {
-        // TODO: implement
-        __unimplemented();
-        return complex<T>{base};
-    }
-
-    template<class T>
-    complex<T> sin(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> sinh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> sqrt(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> tan(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    template<class T>
-    complex<T> tanh(const complex<T>& c)
-    {
-        // TODO: implement
-        __unimplemented();
-        return c;
-    }
-
-    /**
-     * 26.4.10, complex literals:
-     */
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wliteral-suffix"
-inline namespace literals {
-inline namespace complex_literals
-{
-    constexpr complex<long double> operator ""il(long double val)
-    {
-        return complex<long double>{0.0L, val};
-    }
-
-    constexpr complex<long double> operator ""il(unsigned long long val)
-    {
-        return complex<long double>{0.0L, static_cast<long double>(val)};
-    }
-
-    constexpr complex<double> operator ""i(long double val)
-    {
-        return complex<double>{0.0, static_cast<double>(val)};
-    }
-
-    constexpr complex<double> operator ""i(unsigned long long val)
-    {
-        return complex<double>{0.0, static_cast<double>(val)};
-    }
-
-    constexpr complex<float> operator ""if(long double val)
-    {
-        return complex<float>{0.0f, static_cast<float>(val)};
-    }
-
-    constexpr complex<float> operator ""if(unsigned long long val)
-    {
-        return complex<float>{0.0f, static_cast<float>(val)};
-    }
-}}
-#pragma GCC diagnostic pop
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/exception.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/exception.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_EXCEPTION
-#define LIBCPP_BITS_EXCEPTION
-
-#include <__bits/trycatch.hpp>
-
-namespace std
-{
-    /**
-     * 18.8.1, class exception:
-     */
-
-    class exception
-    {
-        public:
-            exception() noexcept = default;
-            exception(const exception&) noexcept = default;
-            exception& operator=(const exception&) noexcept = default;
-            virtual ~exception() = default;
-
-            virtual const char* what() const noexcept;
-    };
-
-    /**
-     * 18.8.2, class bad_exception:
-     */
-
-    class bad_exception: public exception
-    {
-        public:
-            bad_exception() noexcept = default;
-            bad_exception(const bad_exception&) noexcept = default;
-            bad_exception& operator=(const bad_exception&) noexcept = default;
-
-            virtual const char* what() const noexcept;
-    };
-
-    /**
-     * 18.8.3, abnormal termination:
-     */
-
-    using terminate_handler = void (*)();
-
-    terminate_handler get_terminate() noexcept;
-    terminate_handler set_terminate(terminate_handler) noexcept;
-    [[noreturn]] void terminate() noexcept;
-
-    /**
-     * 18.8.4, uncaght_exceptions:
-     */
-
-    bool uncaught_exception() noexcept;
-    int uncaught_exceptions() noexcept;
-
-    using unexpected_handler = void (*)();
-
-    unexpected_handler get_unexpected() noexcept;
-    unexpected_handler set_unexpected(unexpected_handler) noexcept;
-    [[noreturn]] void unexpected();
-
-    /**
-     * 18.8.5, exception propagation:
-     */
-
-    namespace aux
-    {
-        class exception_ptr_t
-        { /* DUMMY BODY */ };
-    }
-
-    using exception_ptr = aux::exception_ptr_t;
-
-    exception_ptr current_exception() noexcept;
-    [[noreturn]] void rethrow_exception(exception_ptr);
-
-    template<class E>
-    exception_ptr make_exception_ptr(E e) noexcept
-    {
-        return exception_ptr{};
-    }
-
-    class nested_exception
-    {
-        public:
-            nested_exception() noexcept = default;
-            nested_exception(const nested_exception&) noexcept = default;
-            nested_exception& operator=(const nested_exception&) noexcept = default;
-            virtual ~nested_exception() = default;
-
-            [[noreturn]] void throw_nested() const;
-            exception_ptr nested_ptr() const noexcept;
-
-        private:
-            exception_ptr ptr_;
-    };
-
-    template<class E>
-    [[noreturn]] void throw_with_nested(E&& e)
-    {
-        terminate();
-    }
-
-    template<class E>
-    void rethrow_if_nested(const E& e)
-    {
-        auto casted = dynamic_cast<const nested_exception*>(&e);
-        if (casted)
-            casted->throw_nested();
-    }
-}
-
-#endif
-
Index: pace/lib/cpp/include/__bits/functional/arithmetic_operations.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/arithmetic_operations.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,621 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_ARITHMETIC_OPERATIONS
-#define LIBCPP_BITS_FUNCTIONAL_ARITHMETIC_OPERATIONS
-
-#include <__bits/utility/forward_move.hpp>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 20.9.5, arithmetic operations:
-     */
-
-    template<class T = void>
-    struct plus
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs + rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct minus
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs - rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct multiplies
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs * rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct divides
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs / rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct modulus
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs % rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct negate
-    {
-        constexpr T operator()(const T& x) const
-        {
-            return -x;
-        }
-
-        using argument_type = T;
-        using result_type   = T;
-    };
-
-    namespace aux
-    {
-        /**
-         * Used by some functions like std::set::find to determine
-         * whether a functor is transparent.
-         */
-        struct transparent_t;
-
-        template<class T, class = void>
-        struct is_transparent: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_transparent<T, void_t<typename T::is_transparent>>
-            : true_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        inline constexpr bool is_transparent_v = is_transparent<T>::value;
-    }
-
-    template<>
-    struct plus<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) + forward<U>(rhs))
-        {
-            return forward<T>(lhs) + forward<T>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct minus<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) - forward<U>(rhs))
-        {
-            return forward<T>(lhs) - forward<T>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct multiplies<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) * forward<U>(rhs))
-        {
-            return forward<T>(lhs) * forward<T>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct divides<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) / forward<U>(rhs))
-        {
-            return forward<T>(lhs) / forward<T>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct modulus<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) % forward<U>(rhs))
-        {
-            return forward<T>(lhs) % forward<T>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct negate<void>
-    {
-        template<class T>
-        constexpr auto operator()(T&& x) const
-            -> decltype(-forward<T>(x))
-        {
-            return -forward<T>(x);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    /**
-     * 20.9.6, comparisons:
-     */
-
-    template<class T = void>
-    struct equal_to
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs == rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct not_equal_to
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs != rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct greater
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs > rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct less
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs < rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct greater_equal
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs >= rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct less_equal
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs <= rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<>
-    struct equal_to<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) == forward<U>(rhs))
-        {
-            return forward<T>(lhs) == forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct not_equal_to<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) != forward<U>(rhs))
-        {
-            return forward<T>(lhs) != forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct greater<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) > forward<U>(rhs))
-        {
-            return forward<T>(lhs) > forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct less<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) < forward<U>(rhs))
-        {
-            return forward<T>(lhs) < forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct greater_equal<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) >= forward<U>(rhs))
-        {
-            return forward<T>(lhs) >= forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct less_equal<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) <= forward<U>(rhs))
-        {
-            return forward<T>(lhs) <= forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    /**
-     * 20.9.7, logical operations:
-     */
-
-    template<class T = void>
-    struct logical_and
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs && rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct logical_or
-    {
-        constexpr bool operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs || rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = bool;
-    };
-
-    template<class T = void>
-    struct logical_not
-    {
-        constexpr bool operator()(const T& x) const
-        {
-            return !x;
-        }
-
-        using argument_type = T;
-        using result_type   = bool;
-    };
-
-    template<>
-    struct logical_and<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) && forward<U>(rhs))
-        {
-            return forward<T>(lhs) && forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct logical_or<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) || forward<U>(rhs))
-        {
-            return forward<T>(lhs) || forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct logical_not<void>
-    {
-        template<class T>
-        constexpr auto operator()(T&& x) const
-            -> decltype(!forward<T>(x))
-        {
-            return !forward<T>(x);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    /**
-     * 20.9.8, bitwise operations:
-     */
-
-    template<class T = void>
-    struct bit_and
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs & rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct bit_or
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs | rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct bit_xor
-    {
-        constexpr T operator()(const T& lhs, const T& rhs) const
-        {
-            return lhs ^ rhs;
-        }
-
-        using first_argument_type  = T;
-        using second_argument_type = T;
-        using result_type          = T;
-    };
-
-    template<class T = void>
-    struct bit_not
-    {
-        constexpr bool operator()(const T& x) const
-        {
-            return ~x;
-        }
-
-        using argument_type = T;
-        using result_type   = T;
-    };
-
-    template<>
-    struct bit_and<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) & forward<U>(rhs))
-        {
-            return forward<T>(lhs) & forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct bit_or<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) | forward<U>(rhs))
-        {
-            return forward<T>(lhs) | forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct bit_xor<void>
-    {
-        template<class T, class U>
-        constexpr auto operator()(T&& lhs, U&& rhs) const
-            -> decltype(forward<T>(lhs) ^ forward<U>(rhs))
-        {
-            return forward<T>(lhs) ^ forward<U>(rhs);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    template<>
-    struct bit_not<void>
-    {
-        template<class T>
-        constexpr auto operator()(T&& x) const
-            -> decltype(~forward<T>(x))
-        {
-            return ~forward<T>(x);
-        }
-
-        using is_transparent = aux::transparent_t;
-    };
-
-    /**
-     * 20.9.9, negators:
-     */
-
-    template<class Predicate>
-    class unary_negate
-    {
-        public:
-            using result_type   = bool;
-            using argument_type = typename Predicate::argument_type;
-
-            constexpr explicit unary_negate(const Predicate& pred)
-                : pred_{pred}
-            { /* DUMMY BODY */ }
-
-            constexpr result_type operator()(const argument_type& arg)
-            {
-                return !pred_(arg);
-            }
-
-        private:
-            Predicate pred_;
-    };
-
-    template<class Predicate>
-    constexpr unary_negate<Predicate> not1(const Predicate& pred)
-    {
-        return unary_negate<Predicate>{pred};
-    }
-
-    template<class Predicate>
-    class binary_negate
-    {
-        public:
-            using result_type          = bool;
-            using first_argument_type  = typename Predicate::first_argument_type;
-            using second_argument_type = typename Predicate::second_argument_type;
-
-            constexpr explicit binary_negate(const Predicate& pred)
-                : pred_{pred}
-            { /* DUMMY BODY */ }
-
-            constexpr result_type operator()(const first_argument_type& arg1,
-                                             const second_argument_type& arg2)
-            {
-                return !pred_(arg1, arg2);
-            }
-
-        private:
-            Predicate pred_;
-    };
-
-    template<class Predicate>
-    constexpr binary_negate<Predicate> not2(const Predicate& pred);
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/bind.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/bind.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,242 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_BIND
-#define LIBCPP_BITS_FUNCTIONAL_BIND
-
-#include <__bits/functional/function.hpp>
-#include <__bits/functional/invoke.hpp>
-#include <__bits/functional/reference_wrapper.hpp>
-#include <cassert>
-#include <tuple>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 20.9.10, bind:
-     */
-
-    namespace aux
-    {
-        template<int N>
-        struct placeholder_t
-        {
-            constexpr placeholder_t() = default;
-            constexpr placeholder_t(const placeholder_t&) = default;
-            constexpr placeholder_t(placeholder_t&&) = default;
-        };
-    }
-
-    template<class T>
-    struct is_placeholder: integral_constant<int, 0>
-    { /* DUMMY BODY */ };
-
-    template<int N> // Note: const because they are all constexpr.
-    struct is_placeholder<const aux::placeholder_t<N>>
-        : integral_constant<int, N>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr int is_placeholder_v = is_placeholder<T>::value;
-
-    namespace aux
-    {
-        /**
-         * Note: Our internal bind return type has an extra type
-         *       template parameter and an extra bool template parameter.
-         *       We use this for the special version of bind that has
-         *       the return type to have a result_type typedef
-         *       (i.e. when the bool is true, the extra type parameter
-         *       is typedefed as result_type - see the structure below).
-         *       This is just a simplification of the implementation
-         *       so that we don't need to have two return types for
-         *       the two bind functions, because unlike function or
-         *       mem_fn, we know exactly when to make the typedef.
-         */
-
-        template<class, bool = false>
-        struct bind_conditional_result_type
-        { /* DUMMY BODY */ };
-
-        template<class R>
-        struct bind_conditional_result_type<R, true>
-        {
-            using result_type = R;
-        };
-
-        template<class, bool, class, class...>
-        class bind_t;
-
-        /**
-         * Filter class that uses its overloaded operator[]
-         * to filter our placeholders, reference_wrappers and bind
-         * subexpressions and replace them with the correct
-         * arguments (extracts references, calls the subexpressions etc).
-         */
-        template<class... Args>
-        class bind_arg_filter
-        {
-            public:
-                bind_arg_filter(Args&&... args)
-                    : args_{forward<Args>(args)...}
-                { /* DUMMY BODY */ }
-
-                template<class T>
-                constexpr decltype(auto) operator[](T&& t)
-                {
-                    return forward<T>(t);
-                }
-
-                template<int N>
-                constexpr decltype(auto) operator[](const placeholder_t<N>)
-                { // Since placeholders are constexpr, this is the best match for them.
-                    /**
-                     * Come on, it's int! Why not use -1 as not placeholder
-                     * and start them at 0? -.-
-                     */
-                    return get<N - 1>(args_);
-                }
-
-                template<class T>
-                constexpr T& operator[](reference_wrapper<T> ref)
-                {
-                    return ref.get();
-                }
-
-                template<class R, bool B, class F, class... BindArgs>
-                constexpr decltype(auto) operator[](const bind_t<R, B, F, BindArgs...> b)
-                {
-                    __unimplemented();
-                    return b; // TODO: bind subexpressions
-                }
-
-
-            private:
-                tuple<Args...> args_;
-        };
-
-        template<class R, bool HasResultType, class F, class... Args>
-        class bind_t: public bind_conditional_result_type<R, HasResultType>
-        {
-            public:
-                template<class G, class... BoundArgs>
-                constexpr bind_t(G&& g, BoundArgs&&... args)
-                    : func_{forward<F>(g)},
-                      bound_args_{forward<Args>(args)...}
-                { /* DUMMY BODY */ }
-
-                constexpr bind_t(const bind_t& other) = default;
-                constexpr bind_t(bind_t&& other) = default;
-
-                template<class... ActualArgs>
-                constexpr decltype(auto) operator()(ActualArgs&&... args)
-                {
-                    return invoke_(
-                        make_index_sequence<sizeof...(Args)>{},
-                        forward<ActualArgs>(args)...
-                    );
-                }
-
-            private: // TODO: This has problem with member function pointers.
-                function<remove_reference_t<F>> func_;
-                tuple<decay_t<Args>...> bound_args_;
-
-                template<size_t... Is, class... ActualArgs>
-                constexpr decltype(auto) invoke_(
-                    index_sequence<Is...>, ActualArgs&&... args
-                )
-                {
-                    /**
-                     * The expression filter[bound_args_[bind_arg_index<Is>()]]...
-                     * here expands bind_arg_index to 0, 1, ... sizeof...(ActualArgs) - 1
-                     * and then passes this variadic list of indices to the bound_args_
-                     * tuple which extracts the bound args from it.
-                     * Our filter will then have its operator[] called on each of them
-                     * and filter out the placeholders, reference_wrappers etc and changes
-                     * them to the actual arguments.
-                     */
-                    bind_arg_filter<ActualArgs...> filter{forward<ActualArgs>(args)...};
-
-                    return aux::INVOKE(
-                        func_,
-                        filter[get<Is>(bound_args_)]...
-                    );
-                }
-        };
-    }
-
-    template<class T>
-    struct is_bind_expression: false_type
-    { /* DUMMY BODY */ };
-
-    template<class R, bool B, class F, class... Args>
-    struct is_bind_expression<aux::bind_t<R, B, F, Args...>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class F, class... Args>
-    aux::bind_t<void, false, F, Args...> bind(F&& f, Args&&... args)
-    {
-        return aux::bind_t<void, false, F, Args...>{forward<F>(f), forward<Args>(args)...};
-    }
-
-    template<class R, class F, class... Args>
-    aux::bind_t<R, true, F, Args...> bind(F&& f, Args&&... args)
-    {
-        return aux::bind_t<R, true, F, Args...>{forward<F>(f), forward<Args>(args)...};
-    }
-
-    namespace placeholders
-    {
-        /**
-         * Note: The number of placeholders is
-         *       implementation defined, we've chosen
-         *       8 because it is a nice number
-         *       and should be enough for any function
-         *       call.
-         * Note: According to the C++14 standard, these
-         *       are all extern non-const. We decided to use
-         *       the C++17 form of them being inline constexpr
-         *       because it is more convenient, makes sense
-         *       and would eventually need to be upgraded
-         *       anyway.
-         */
-        inline constexpr aux::placeholder_t<1> _1;
-        inline constexpr aux::placeholder_t<2> _2;
-        inline constexpr aux::placeholder_t<3> _3;
-        inline constexpr aux::placeholder_t<4> _4;
-        inline constexpr aux::placeholder_t<5> _5;
-        inline constexpr aux::placeholder_t<6> _6;
-        inline constexpr aux::placeholder_t<7> _7;
-        inline constexpr aux::placeholder_t<8> _8;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/conditional_function_typedefs.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/conditional_function_typedefs.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTION_CONDITIONAL_FUNCTION_TYPEDEFS
-#define LIBCPP_BITS_FUNCTION_CONDITIONAL_FUNCTION_TYPEDEFS
-
-namespace std::aux
-{
-    /**
-     * Note: Some types with possible function-like behavior
-     *       (e.g. function, reference_wrapper, aux::mem_fn_t)
-     *       have to define a type argument type or two types
-     *       first_argument_type and second_argument_type when
-     *       their invocation takes one or two arguments, respectively.
-     *
-     *       The easiest way to conditionally define a type is using
-     *       inheritance and the types below serve exactly for that
-     *       purpose.
-     *
-     *       If we have a type that is specialized as R(Args...)
-     *       for some return type R and argument types Args...,
-     *       we can simply (publicly) inherit from
-     *       conditional_function_typedefs<Args...>. If it is
-     *       templated by some generic type T, we can inherit from
-     *       conditional_function_typedefs<remove_cv_t<remove_reference_t<T>>>
-     *       so that the correct type below gets chosen.
-     */
-
-    template<class... Args>
-    struct conditional_function_typedefs
-    { /* DUMMY BODY */ };
-
-    template<class A>
-    struct conditional_function_typedefs<A>
-    {
-        using argument_type = A;
-    };
-
-    template<class A1, class A2>
-    struct conditional_function_typedefs<A1, A2>
-    {
-        using first_argument_type  = A1;
-        using second_argument_type = A2;
-    };
-
-    template<class R, class... Args>
-    struct conditional_function_typedefs<R(Args...)>
-        : conditional_function_typedefs<Args...>
-    { /* DUMMY BODY */ };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/function.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/function.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,380 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_FUNCTION
-#define LIBCPP_BITS_FUNCTIONAL_FUNCTION
-
-#include <__bits/functional/conditional_function_typedefs.hpp>
-#include <__bits/functional/reference_wrapper.hpp>
-#include <__bits/memory/allocator_arg.hpp>
-#include <__bits/memory/allocator_traits.hpp>
-#include <typeinfo>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 20.9.12, polymorphic function adaptors:
-     */
-
-    namespace aux
-    {
-        // TODO: fix this
-        /* template<class, class T, class... Args> */
-        /* struct is_callable_impl: false_type */
-        /* { /1* DUMMY BODY *1/ }; */
-
-        /* template<class, class R, class... Args> */
-        /* struct is_callable_impl< */
-        /*     void_t<decltype(aux::invoke(declval<R(Args...)>(), declval<Args>()..., R))>, */
-        /*     R, Args... */
-        /* > : true_type */
-        /* { /1* DUMMY BODY *1/ }; */
-
-        /* template<class T> */
-        /* struct is_callable: is_callable_impl<void_t<>, T> */
-        /* { /1* DUMMY BODY *1/ }; */
-
-        template<class Callable, class R, class... Args>
-        R invoke_callable(Callable* clbl, Args&&... args)
-        {
-            return (*clbl)(forward<Args>(args)...);
-        }
-
-        template<class Callable>
-        void copy_callable(Callable* to, Callable* from)
-        {
-            new(to) Callable{*from};
-        }
-
-        template<class Callable>
-        void destroy_callable(Callable* clbl)
-        {
-            if (clbl)
-                clbl->~Callable();
-        }
-    }
-
-    // TODO: implement
-    class bad_function_call;
-
-    template<class>
-    class function; // undefined
-
-    /**
-     * Note: Ideally, this implementation wouldn't
-     *       copy the target if it was a pointer to
-     *       a function, but for the simplicity of the
-     *       implementation, we do copy even in that
-     *       case for now. It would be a nice optimization
-     *       if this was changed in the future.
-     */
-    template<class R, class... Args>
-    class function<R(Args...)>
-        : public aux::conditional_function_typedefs<Args...>
-    {
-        public:
-            using result_type = R;
-
-            /**
-             * 20.9.12.2.1, construct/copy/destroy:
-             */
-
-            function() noexcept
-                : callable_{}, callable_size_{}, call_{},
-                  copy_{}, dest_{}
-            { /* DUMMY BODY */ }
-
-            function(nullptr_t) noexcept
-                : function{}
-            { /* DUMMY BODY */ }
-
-            function(const function& other)
-                : callable_{}, callable_size_{other.callable_size_},
-                  call_{other.call_}, copy_{other.copy_}, dest_{other.dest_}
-            {
-                callable_ = new uint8_t[callable_size_];
-                (*copy_)(callable_, other.callable_);
-            }
-
-            function(function&& other)
-                : callable_{other.callable_}, callable_size_{other.callable_size_},
-                  call_{other.call_}, copy_{other.copy_}, dest_{other.dest_}
-            {
-                other.callable_ = nullptr;
-                other.callable_size_ = size_t{};
-                other.call_ = nullptr;
-                other.copy_ = nullptr;
-                other.dest_ = nullptr;
-            }
-
-            // TODO: shall not participate in overloading unless aux::is_callable<F>
-            template<class F>
-            function(F f)
-                : callable_{}, callable_size_{sizeof(F)},
-                  call_{(call_t)aux::invoke_callable<F, R, Args...>},
-                  copy_{(copy_t)aux::copy_callable<F>},
-                  dest_{(dest_t)aux::destroy_callable<F>}
-            {
-                callable_ = new uint8_t[callable_size_];
-                (*copy_)(callable_, (uint8_t*)&f);
-            }
-
-            /**
-             * Note: For the moment we're ignoring the allocator
-             *       for simplicity of the implementation.
-             */
-
-            template<class A>
-            function(allocator_arg_t, const A& a) noexcept
-                : function{}
-            { /* DUMMY BODY */ }
-
-            template<class A>
-            function(allocator_arg_t, const A& a, nullptr_t) noexcept
-                : function{}
-            { /* DUMMY BODY */ }
-
-            template<class A>
-            function(allocator_arg_t, const A& a, const function& other)
-                : function{other}
-            { /* DUMMY BODY */ }
-
-            template<class A>
-            function(allocator_arg_t, const A& a, function&& other)
-                : function{move(other)}
-            { /* DUMMY BODY */ }
-
-            // TODO: shall not participate in overloading unless aux::is_callable<F>
-            template<class F, class A>
-            function(allocator_arg_t, const A& a, F f)
-                : function{f}
-            { /* DUMMY BODY */ }
-
-            function& operator=(const function& rhs)
-            {
-                function{rhs}.swap(*this);
-
-                return *this;
-            }
-
-            /**
-             * Note: We have to copy call_, copy_
-             *       and dest_ because they can be templated
-             *       by a type F we don't know.
-             */
-            function& operator=(function&& rhs)
-            {
-                clear_();
-
-                callable_ = rhs.callable_;
-                callable_size_ = rhs.callable_size_;
-                call_ = rhs.call_;
-                copy_ = rhs.copy_;
-                dest_ = rhs.dest_;
-
-                rhs.callable_ = nullptr;
-                rhs.callable_size_ = size_t{};
-                rhs.call_ = nullptr;
-                rhs.copy_ = nullptr;
-                rhs.dest_ = nullptr;
-
-                return *this;
-            }
-
-            function& operator=(nullptr_t) noexcept
-            {
-                clear_();
-
-                return *this;
-            }
-
-            // TODO: shall not participate in overloading unless aux::is_callable<F>
-            template<class F>
-            function& operator=(F&& f)
-            {
-                callable_size_ = sizeof(F);
-                callable_ = new uint8_t[callable_size_];
-                call_ = aux::invoke_callable<F, R, Args...>;
-                copy_ = aux::copy_callable<F>;
-                dest_ = aux::destroy_callable<F>;
-
-                (*copy_)(callable_, (uint8_t*)&f);
-            }
-
-            template<class F>
-            function& operator=(reference_wrapper<F> ref) noexcept
-            {
-                return (*this) = ref.get();
-            }
-
-            ~function()
-            {
-                if (callable_)
-                {
-                    (*dest_)(callable_);
-                    delete[] callable_;
-                }
-            }
-
-            /**
-             * 20.9.12.2.2, function modifiers:
-             */
-
-            void swap(function& other) noexcept
-            {
-                std::swap(callable_, other.callable_);
-                std::swap(callable_size_, other.callable_size_);
-                std::swap(call_, other.call_);
-                std::swap(copy_, other.copy_);
-                std::swap(dest_, other.dest_);
-            }
-
-            template<class F, class A>
-            void assign(F&& f, const A& a)
-            {
-                function{allocator_arg, a, forward<F>(f)}.swap(*this);
-            }
-
-            /**
-             * 20.9.12.2.3, function capacity:
-             */
-
-            explicit operator bool() const noexcept
-            {
-                return callable_ != nullptr;
-            }
-
-            /**
-             * 20.9.12.2.4, function invocation:
-             */
-
-            result_type operator()(Args... args) const
-            {
-                // TODO: throw bad_function_call if !callable_ || !call_
-                if constexpr (is_same_v<R, void>)
-                    (*call_)(callable_, forward<Args>(args)...);
-                else
-                    return (*call_)(callable_, forward<Args>(args)...);
-            }
-
-            /**
-             * 20.9.12.2.5, function target access:
-             */
-
-            const type_info& target_type() const noexcept
-            {
-                return typeid(*callable_);
-            }
-
-            template<class T>
-            T* target() noexcept
-            {
-                if (target_type() == typeid(T))
-                    return (T*)callable_;
-                else
-                    return nullptr;
-            }
-
-            template<class T>
-            const T* target() const noexcept
-            {
-                if (target_type() == typeid(T))
-                    return (T*)callable_;
-                else
-                    return nullptr;
-            }
-
-        private:
-            using call_t = R(*)(uint8_t*, Args&&...);
-            using copy_t = void (*)(uint8_t*, uint8_t*);
-            using dest_t = void (*)(uint8_t*);
-
-            uint8_t* callable_;
-            size_t callable_size_;
-            call_t call_;
-            copy_t copy_;
-            dest_t dest_;
-
-            void clear_()
-            {
-                if (callable_)
-                {
-                    (*dest_)(callable_);
-                    delete[] callable_;
-                    callable_ = nullptr;
-                }
-            }
-    };
-
-    /**
-     * 20.9.12.2.6, null pointer comparisons:
-     */
-
-    template<class R, class... Args>
-    bool operator==(const function<R(Args...)>& f, nullptr_t) noexcept
-    {
-        return !f;
-    }
-
-    template<class R, class... Args>
-    bool operator==(nullptr_t, const function<R(Args...)>& f) noexcept
-    {
-        return !f;
-    }
-
-    template<class R, class... Args>
-    bool operator!=(const function<R(Args...)>& f, nullptr_t) noexcept
-    {
-        return (bool)f;
-    }
-
-    template<class R, class... Args>
-    bool operator!=(nullptr_t, const function<R(Args...)>& f) noexcept
-    {
-        return (bool)f;
-    }
-
-    /**
-     * 20.9.12.2.7, specialized algorithms:
-     */
-
-    template<class R, class... Args>
-    void swap(function<R(Args...)>& f1, function<R(Args...)>& f2)
-    {
-        f1.swap(f2);
-    }
-
-    template<class R, class... Args, class Alloc>
-    struct uses_allocator<function<R(Args...)>, Alloc>
-        : true_type
-    { /* DUMMY BODY */ };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/functional.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/functional.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL
-#define LIBCPP_BITS_FUNCTIONAL
-
-#include <__bits/functional/conditional_function_typedefs.hpp>
-#include <__bits/functional/invoke.hpp>
-#include <limits>
-#include <memory>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 20.9.3, invoke:
-     */
-
-    template<class F, class... Args>
-    decltype(auto) invoke(F&& f, Args&&... args)
-    {
-        return aux::INVOKE(forward<F>(f),forward<Args>(args)...);
-    }
-
-    /**
-     * 20.9.11, member function adaptors:
-     */
-
-    namespace aux
-    {
-        template<class F>
-        class mem_fn_t
-            : public conditional_function_typedefs<remove_cv_t<remove_reference_t<F>>>
-        {
-            public:
-                mem_fn_t(F f)
-                    : func_{f}
-                { /* DUMMY BODY */ }
-
-                template<class... Args>
-                decltype(auto) operator()(Args&&... args)
-                {
-                    return INVOKE(func_, forward<Args>(args)...);
-                }
-
-            private:
-                F func_;
-        };
-    }
-
-    template<class R, class T>
-    aux::mem_fn_t<R T::*> mem_fn(R T::* f)
-    {
-        return aux::mem_fn_t<R T::*>{f};
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/hash.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/hash.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,318 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_HASH
-#define LIBCPP_BITS_FUNCTIONAL_HASH
-
-#include <cstdlib>
-#include <cstdint>
-
-namespace std
-{
-    template<class>
-    struct is_arithmetic;
-
-    template<class>
-    struct is_pointer;
-
-    /**
-     * 20.9.13, hash function primary template:
-     */
-
-    namespace aux
-    {
-        template<class T>
-        union converter
-        {
-            T value;
-            uint64_t converted;
-        };
-
-        template<class T>
-        T hash_(uint64_t x) noexcept
-        {
-            /**
-             * Note: std::hash is used for indexing in
-             *       unordered containers, not for cryptography.
-             *       Because of this, we decided to simply convert
-             *       the value to uin64_t, which will help us
-             *       with testing (since in order to create
-             *       a collision in a multiset or multimap
-             *       we simply need 2 values that congruent
-             *       by the size of the table.
-             */
-            return static_cast<T>(x);
-        }
-
-        template<class T>
-        size_t hash(T x) noexcept
-        {
-            static_assert(is_arithmetic<T>::value || is_pointer<T>::value,
-                          "invalid type passed to aux::hash");
-
-            converter<T> conv;
-            conv.value = x;
-
-            return hash_<size_t>(conv.converted);
-        }
-    }
-
-    template<class T>
-    struct hash
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct hash<bool>
-    {
-        size_t operator()(bool x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = bool;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<char>
-    {
-        size_t operator()(char x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = char;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<signed char>
-    {
-        size_t operator()(signed char x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = signed char;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<unsigned char>
-    {
-        size_t operator()(unsigned char x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = unsigned char;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<char16_t>
-    {
-        size_t operator()(char16_t x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = char16_t;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<char32_t>
-    {
-        size_t operator()(char32_t x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = char32_t;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<wchar_t>
-    {
-        size_t operator()(wchar_t x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = wchar_t;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<short>
-    {
-        size_t operator()(short x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = short;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<unsigned short>
-    {
-        size_t operator()(unsigned short x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = unsigned short;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<int>
-    {
-        size_t operator()(int x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = int;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<unsigned int>
-    {
-        size_t operator()(unsigned int x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = unsigned int;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<long>
-    {
-        size_t operator()(long x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = long;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<long long>
-    {
-        size_t operator()(long long x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = long long;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<unsigned long>
-    {
-        size_t operator()(unsigned long x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = unsigned long;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<unsigned long long>
-    {
-        size_t operator()(unsigned long long x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = unsigned long long;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<float>
-    {
-        size_t operator()(float x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = float;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<double>
-    {
-        size_t operator()(double x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = double;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<long double>
-    {
-        size_t operator()(long double x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = long double;
-        using result_type   = size_t;
-    };
-
-    template<class T>
-    struct hash<T*>
-    {
-        size_t operator()(T* x) const noexcept
-        {
-            return aux::hash(x);
-        }
-
-        using argument_type = T*;
-        using result_type   = size_t;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/invoke.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/invoke.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_INVOKE
-#define LIBCPP_BITS_FUNCTIONAL_INVOKE
-
-#include <__bits/utility/declval.hpp>
-#include <__bits/utility/forward_move.hpp>
-
-namespace std
-{
-    template<class>
-    struct is_member_function_pointer;
-
-    template<class, class>
-    struct is_base_of;
-
-    template<class>
-    struct is_member_object_pointer;
-}
-
-namespace std::aux
-{
-    /**
-     * 20.9.2, requirements:
-     */
-
-    template<class R, class T, class T1, class... Ts>
-    decltype(auto) INVOKE(R T::* f, T1&& t1, Ts&&... args)
-    {
-        if constexpr (is_member_function_pointer<decltype(f)>::value)
-        {
-            if constexpr (is_base_of<T, remove_reference_t<T1>>::value)
-                // (1.1)
-                return (t1.*f)(forward<Ts>(args)...);
-            else
-                // (1.2)
-                return ((*t1).*f)(forward<Ts>(args)...);
-        }
-        else if constexpr (is_member_object_pointer<decltype(f)>::value && sizeof...(args) == 0)
-        {
-            /**
-             * Note: Standard requires to N be equal to 1, but we take t1 directly
-             *       so we need sizeof...(args) to be 0.
-             */
-            if constexpr (is_base_of<T, remove_reference_t<T1>>::value)
-                // (1.3)
-                return t1.*f;
-            else
-                // (1.4)
-                return (*t1).*f;
-        }
-        else
-
-        /**
-         * Note: If this condition holds this will not be reachable,
-         *       but a new addition to the standard (17.7 point (8.1))
-         *       prohibits us from simply using false as the condition here,
-         *       so we use this because we know it is false here.
-         */
-        static_assert(is_member_function_pointer<decltype(f)>::value, "invalid invoke");
-    }
-
-    template<class F, class... Args>
-    decltype(auto) INVOKE(F&& f, Args&&... args)
-    {
-        // (1.5)
-        return f(forward<Args>(args)...);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/functional/reference_wrapper.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/functional/reference_wrapper.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_FUNCTIONAL_REFERENCE_WRAPPER
-#define LIBCPP_BITS_FUNCTIONAL_REFERENCE_WRAPPER
-
-#include <__bits/functional/conditional_function_typedefs.hpp>
-#include <__bits/functional/invoke.hpp>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 20.9.4, reference_wrapper:
-     */
-
-    template<class T>
-    class reference_wrapper
-        : public aux::conditional_function_typedefs<remove_cv_t<remove_reference_t<T>>>
-    {
-        public:
-            using type = T;
-
-            reference_wrapper(type& val) noexcept
-                : data_{&val}
-            { /* DUMMY BODY */ }
-
-            reference_wrapper(type&&) = delete;
-
-            reference_wrapper(const reference_wrapper& other) noexcept
-                : data_{other.data_}
-            { /* DUMMY BODY */ }
-
-            reference_wrapper& operator=(const reference_wrapper& other) noexcept
-            {
-                data_ = other.data_;
-
-                return *this;
-            }
-
-            operator type&() const noexcept
-            {
-                return *data_;
-            }
-
-            type& get() const noexcept
-            {
-                return *data_;
-            }
-
-            template<class... Args>
-            decltype(auto) operator()(Args&&... args) const
-            {
-                return aux::INVOKE(*data_, std::forward<Args>(args)...);
-            }
-
-        private:
-            type* data_;
-    };
-
-    template<class T>
-    reference_wrapper<T> ref(T& t) noexcept
-    {
-        return reference_wrapper<T>{t};
-    }
-
-    template<class T>
-    reference_wrapper<const T> cref(const T& t) noexcept
-    {
-        return reference_wrapper<const T>{t};
-    }
-
-    template<class T>
-    void ref(const T&&) = delete;
-
-    template<class T>
-    void cref(const T&&) = delete;
-
-    template<class T>
-    reference_wrapper<T> ref(reference_wrapper<T> t) noexcept
-    {
-        return ref(t.get());
-    }
-
-    template<class T>
-    reference_wrapper<const T> cref(reference_wrapper<T> t) noexcept
-    {
-        return cref(t.get());
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/insert_iterator.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/insert_iterator.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_INSERT_ITERATOR
-#define LIBCPP_BITS_INSERT_ITERATOR
-
-namespace std
-{
-    struct forward_iterator_tag;
-}
-
-namespace std::aux
-{
-    /**
-     * Note: Commonly the data structures in this library
-     *       contain a set of insert member functions. These
-     *       are often both iterator based and copy based.
-     *       This iterator can change the copy version into
-     *       an iterator version by creating a count based copy
-     *       iterator.
-     * Usage:
-     *      first == insert_iterator{value}
-     *      last  == insert_iterator{count}
-     *
-     *      So the following code:
-     *          while (first != last)
-     *              *data_++ = *first++;
-     *
-     *      Will insert a copy of value into the data_
-     *      iterator exactly count times.
-     * TODO: Apply this to existing containers?
-     */
-    template<class T>
-    class insert_iterator
-    {
-        public:
-            using difference_type   = unsigned long long;
-            using value_type        = T;
-            using iterator_category = input_iterator_tag;
-            using reference         = value_type&;
-            using pointer           = value_type*;
-
-            explicit insert_iterator(difference_type count, const value_type& val = value_type{})
-                : value_{val}, count_{count}
-            { /* DUMMY BODY */ }
-
-            insert_iterator(const insert_iterator&) = default;
-            insert_iterator& operator=(const insert_iterator&) = default;
-
-            insert_iterator(insert_iterator&&) = default;
-            insert_iterator& operator=(insert_iterator&&) = default;
-
-            const value_type& operator*() const
-            {
-                return value_;
-            }
-
-            const value_type* operator->() const
-            {
-                return &value_;
-            }
-
-            insert_iterator& operator++()
-            {
-                ++count_;
-
-                return *this;
-            }
-
-            insert_iterator operator++(int)
-            {
-                ++count_;
-
-                return insert_iterator{count_ - 1, value_};
-            }
-
-            bool operator==(const insert_iterator& other)
-            {
-                return count_ == other.count_;
-            }
-
-            bool operator!=(const insert_iterator& other)
-            {
-                return count_ != other.count_;
-            }
-
-        private:
-            value_type value_;
-            difference_type count_;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/fstream.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/fstream.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,717 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_FSTREAM
-#define LIBCPP_BITS_IO_FSTREAM
-
-#include <cassert>
-#include <cstdio>
-#include <ios>
-#include <iosfwd>
-#include <locale>
-#include <streambuf>
-#include <string>
-
-namespace std
-{
-    /**
-     * 27.9.1.1, class template basic_filebuf:
-     */
-    template<class Char, class Traits>
-    class basic_filebuf: public basic_streambuf<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.9.1.2, constructors/destructor:
-             */
-
-            basic_filebuf()
-                : basic_streambuf<char_type, traits_type>{},
-                  obuf_{nullptr}, ibuf_{nullptr}, mode_{}, file_{nullptr}
-            { /* DUMMY BODY */ }
-
-            basic_filebuf(const basic_filebuf&) = delete;
-
-            basic_filebuf(basic_filebuf&& other)
-                : mode_{other.mode_}
-            {
-                close();
-                std::swap(obuf_, other.obuf_);
-                std::swap(ibuf_, other.ibuf_);
-                std::swap(file_, other.file_);
-
-                basic_streambuf<char_type, traits_type>::swap(other);
-            }
-
-            virtual ~basic_filebuf()
-            {
-                // TODO: exception here caught and not rethrown
-                close();
-            }
-
-            /**
-             * 27.9.1.3: assign/swap:
-             */
-
-            basic_filebuf& operator=(const basic_filebuf&) = delete;
-
-            basic_filebuf& operator=(basic_filebuf&& other)
-            {
-                close();
-                swap(other);
-
-                return *this;
-            }
-
-            void swap(basic_filebuf& rhs)
-            {
-                std::swap(mode_, rhs.mode_);
-                std::swap(obuf_, rhs.obuf_);
-                std::swap(ibuf_, rhs.ibuf_);
-
-                basic_streambuf<char_type, traits_type>::swap(rhs);
-            }
-
-            /**
-             * 27.9.1.4, members:
-             */
-
-            bool is_open() const
-            {
-                return file_ != nullptr;
-            }
-
-            basic_filebuf<char_type, traits_type>* open(const char* name, ios_base::openmode mode)
-            {
-                if (file_)
-                    return nullptr;
-
-                mode_ = mode;
-                mode = (mode & (~ios_base::ate));
-                const char* mode_str = get_mode_str_(mode);
-
-                if (!mode_str)
-                    return nullptr;
-
-                file_ = fopen(name, mode_str);
-                if (!file_)
-                    return nullptr;
-
-                if ((mode_ & ios_base::ate) != 0)
-                {
-                    if (fseek(file_, 0, SEEK_END) != 0)
-                    {
-                        close();
-                        return nullptr;
-                    }
-                }
-
-                if (!ibuf_ && mode_is_in_(mode_))
-                    ibuf_ = new char_type[buf_size_];
-                if (!obuf_ && mode_is_out_(mode_))
-                    obuf_ = new char_type[buf_size_];
-                init_();
-
-                return this;
-            }
-
-            basic_filebuf<char_type, traits_type>* open(const string& name, ios_base::openmode mode)
-            {
-                return open(name.c_str(), mode);
-            }
-
-            basic_filebuf<char_type, traits_type>* close()
-            {
-                // TODO: caught exceptions are to be rethrown after closing the file
-                if (!file_)
-                    return nullptr;
-                // TODO: deallocate buffers?
-
-                if (this->output_next_ != this->output_begin_)
-                    overflow(traits_type::eof());
-                // TODO: unshift? (p. 1084 at the top)
-
-                fclose(file_);
-                file_ = nullptr;
-
-                return this;
-            }
-
-        protected:
-            /**
-             * 27.9.1.5, overriden virtual functions:
-             */
-
-            int_type underflow() override
-            {
-                // TODO: use codecvt
-                if (!mode_is_in_(mode_))
-                    return traits_type::eof();
-
-                if (!ibuf_)
-                {
-                    ibuf_ = new char_type[buf_size_];
-                    this->input_begin_ = this->input_next_ = this->input_end_ = ibuf_;
-                }
-
-                off_type i{};
-                if (this->input_next_ < this->input_end_)
-                {
-                    auto idx = static_cast<off_type>(this->input_next_ - this->input_begin_);
-                    auto count = static_cast<off_type>(buf_size_) - idx;
-
-                    for (; i < count; ++i, ++idx)
-                        ibuf_[i] = ibuf_[idx];
-                }
-
-                for (; i < static_cast<off_type>(buf_size_); ++i)
-                {
-                    auto c = fgetc(file_);
-                    if (c == traits_type::eof())
-                        break;
-
-                    ibuf_[i] = static_cast<char_type>(c);
-
-                    if (ibuf_[i] == '\n')
-                    {
-                        ++i;
-                        break;
-                    }
-                }
-
-                this->input_next_ = this->input_begin_;
-                this->input_end_ = this->input_begin_ + i;
-
-                if (i == 0)
-                    return traits_type::eof();
-
-                return traits_type::to_int_type(*this->input_next_);
-            }
-
-            int_type pbackfail(int_type c = traits_type::eof()) override
-            {
-                auto cc = traits_type::to_char_type(c);
-                if (!traits_type::eq_int_type(c, traits_type::eof()) &&
-                    this->putback_avail_() &&
-                    traits_type::eq(cc, this->gptr()[-1]))
-                {
-                    --this->input_next_;
-
-                    return c;
-                }
-                else if (!traits_type::eq_int_type(c, traits_type::eof()) &&
-                         this->putback_avail_() && (mode_ & ios_base::out) != 0)
-                {
-                    *--this->input_next_ = cc;
-
-                    return c;
-                }
-                else if (traits_type::eq_int_type(c, traits_type::eof()) &&
-                         this->putback_avail_())
-                {
-                    --this->input_next_;
-
-                    return traits_type::not_eof(c);
-                }
-
-                return traits_type::eof();
-            }
-
-            int_type overflow(int_type c = traits_type::eof()) override
-            {
-                // TODO: use codecvt
-                if (!mode_is_out_(mode_))
-                    return traits_type::eof();
-
-                auto count = static_cast<size_t>(this->output_next_ - this->output_begin_);
-                fwrite(obuf_, sizeof(char_type), count, file_);
-                fflush(file_);
-
-                this->output_next_ = this->output_begin_;
-
-                return traits_type::not_eof(c);
-            }
-
-            basic_streambuf<char_type, traits_type>*
-            setbuf(char_type* s, streamsize n) override
-            {
-                // TODO: implement
-                __unimplemented();
-                return nullptr;
-            }
-
-            pos_type seekoff(off_type off, ios_base::seekdir dir,
-                             ios_base::openmode mode = ios_base::in | ios_base::out) override
-            {
-                // TODO: implement
-                __unimplemented();
-                return pos_type{};
-            }
-
-            pos_type seekpos(pos_type pos,
-                             ios_base::openmode mode = ios_base::in | ios_base::out) override
-            {
-                // TODO: implement
-                __unimplemented();
-                return pos_type{};
-            }
-
-            int sync() override
-            {
-                if (mode_is_out_(mode_))
-                    overflow();
-
-                return 0; // TODO: what is the correct return value?
-            }
-
-            void imbue(const locale& loc) override
-            {
-                // TODO: codecvt should be cached when we start using it
-                basic_streambuf<char_type, traits_type>::imbue(loc);
-            }
-
-        private:
-            char_type* obuf_;
-            char_type* ibuf_;
-
-            ios_base::openmode mode_;
-
-            FILE* file_;
-
-            static constexpr size_t buf_size_{128};
-
-            const char* get_mode_str_(ios_base::openmode mode)
-            {
-                /**
-                 * See table 132.
-                 */
-                switch (mode)
-                {
-                    case ios_base::out:
-                    case ios_base::out | ios_base::trunc:
-                        return "w";
-                    case ios_base::out | ios_base::app:
-                    case ios_base::app:
-                        return "a";
-                    case ios_base::in:
-                        return "r";
-                    case ios_base::in | ios_base::out:
-                        return "r+";
-                    case ios_base::in | ios_base::out | ios_base::trunc:
-                        return "w+";
-                    case ios_base::in | ios_base::out | ios_base::app:
-                    case ios_base::in | ios_base::app:
-                        return "a+";
-                    case ios_base::binary | ios_base::out:
-                    case ios_base::binary | ios_base::out | ios_base::trunc:
-                        return "wb";
-                    case ios_base::binary | ios_base::out | ios_base::app:
-                    case ios_base::binary | ios_base::app:
-                        return "ab";
-                    case ios_base::binary | ios_base::in:
-                        return "rb";
-                    case ios_base::binary | ios_base::in | ios_base::out:
-                        return "r+b";
-                    case ios_base::binary | ios_base::in | ios_base::out | ios_base::trunc:
-                        return "w+b";
-                    case ios_base::binary | ios_base::in | ios_base::out | ios_base::app:
-                    case ios_base::binary | ios_base::in | ios_base::app:
-                        return "a+b";
-                    default:
-                        return nullptr;
-                }
-            }
-
-            bool mode_is_in_(ios_base::openmode mode)
-            {
-                return (mode & ios_base::in) != 0;
-            }
-
-            bool mode_is_out_(ios_base::openmode mode)
-            {
-                return (mode & (ios_base::out | ios_base::app | ios_base::trunc)) != 0;
-            }
-
-            void init_()
-            {
-                if (ibuf_)
-                    this->input_begin_ = this->input_next_ = this->input_end_ = ibuf_;
-
-                if (obuf_)
-                {
-                    this->output_begin_ = this->output_next_ = obuf_;
-                    this->output_end_ = obuf_ + buf_size_;
-                }
-            }
-    };
-
-    template<class Char, class Traits>
-    void swap(basic_filebuf<Char, Traits>& lhs, basic_filebuf<Char, Traits>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 27.9.1.6, class template basic_ifstream:
-     */
-
-    template<class Char, class Traits>
-    class basic_ifstream: public basic_istream<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.9.1.7, constructors:
-             */
-
-            basic_ifstream()
-                : basic_istream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            { /* DUMMY BODY */ }
-
-            explicit basic_ifstream(const char* name, ios_base::openmode mode = ios_base::in)
-                : basic_istream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode | ios_base::in))
-                    this->setstate(ios_base::failbit);
-            }
-
-            explicit basic_ifstream(const string& name, ios_base::openmode mode = ios_base::in)
-                : basic_istream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode | ios_base::in))
-                    this->setstate(ios_base::failbit);
-            }
-
-            basic_ifstream(const basic_ifstream&) = delete;
-
-            basic_ifstream(basic_ifstream&& other)
-                : basic_istream<char_type, traits_type>{move(other)},
-                  rdbuf_{other.rdbuf_}
-            {
-                basic_istream<char_type, traits_type>::set_rdbuf(&rdbuf_);
-            }
-
-            /**
-             * 27.9.1.8, assign/swap:
-             */
-
-            basic_ifstream& operator=(const basic_ifstream&) = delete;
-
-            basic_ifstream& operator=(basic_ifstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_ifstream& rhs)
-            {
-                basic_istream<char_type, traits_type>::swap(rhs);
-                rdbuf_.swap(rhs.rdbuf_);
-            }
-
-            /**
-             * 27.9.1.9, members:
-             */
-
-            basic_filebuf<char_type, traits_type>* rdbuf() const
-            {
-                return const_cast<basic_filebuf<char_type, traits_type>*>(&rdbuf_);
-            }
-
-            bool is_open() const
-            {
-                return rdbuf_.is_open();
-            }
-
-            void open(const char* name, ios_base::openmode mode = ios_base::in)
-            {
-                if (!rdbuf_.open(name, mode | ios_base::in))
-                    this->setstate(ios_base::failbit);
-                else
-                    this->clear();
-            }
-
-            void open(const string& name, ios_base::openmode mode = ios_base::in)
-            {
-                open(name.c_str(), mode);
-            }
-
-            void close()
-            {
-                if (!rdbuf_.close())
-                    this->setstate(ios_base::failbit);
-            }
-
-        private:
-            basic_filebuf<char_type, traits_type> rdbuf_;
-    };
-
-    template<class Char, class Traits>
-    void swap(basic_ifstream<Char, Traits>& lhs,
-              basic_ifstream<Char, Traits>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 27.9.1.10, class template basic_ofstream:
-     */
-
-    template<class Char, class Traits>
-    class basic_ofstream: public basic_ostream<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.9.1.11, constructors:
-             */
-
-            basic_ofstream()
-                : basic_ostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            { /* DUMMY BODY */ }
-
-            explicit basic_ofstream(const char* name, ios_base::openmode mode = ios_base::out)
-                : basic_ostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode | ios_base::out))
-                    this->setstate(ios_base::failbit);
-            }
-
-            explicit basic_ofstream(const string& name, ios_base::openmode mode = ios_base::out)
-                : basic_ostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode | ios_base::out))
-                    this->setstate(ios_base::failbit);
-            }
-
-            basic_ofstream(const basic_ofstream&) = delete;
-
-            basic_ofstream(basic_ofstream&& other)
-                : basic_ostream<char_type, traits_type>{move(other)},
-                  rdbuf_{other.rdbuf_}
-            {
-                basic_ostream<char_type, traits_type>::set_rdbuf(&rdbuf_);
-            }
-
-            /**
-             * 27.9.1.12, assign/swap:
-             */
-
-            basic_ofstream& operator=(const basic_ofstream&) = delete;
-
-            basic_ofstream& operator=(basic_ofstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_ofstream& rhs)
-            {
-                basic_ostream<char_type, traits_type>::swap(rhs);
-                rdbuf_.swap(rhs.rdbuf_);
-            }
-
-            /**
-             * 27.9.1.13, members:
-             */
-
-            basic_filebuf<char_type, traits_type>* rdbuf() const
-            {
-                return const_cast<basic_filebuf<char_type, traits_type>*>(&rdbuf_);
-            }
-
-            bool is_open() const
-            {
-                return rdbuf_.is_open();
-            }
-
-            void open(const char* name, ios_base::openmode mode = ios_base::out)
-            {
-                if (!rdbuf_.open(name, mode | ios_base::out))
-                    this->setstate(ios_base::failbit);
-                else
-                    this->clear();
-            }
-
-            void open(const string& name, ios_base::openmode mode = ios_base::out)
-            {
-                open(name.c_str(), mode);
-            }
-
-            void close()
-            {
-                if (!rdbuf_.close())
-                    this->setstate(ios_base::failbit);
-            }
-
-        private:
-            basic_filebuf<char_type, traits_type> rdbuf_;
-    };
-
-    template<class Char, class Traits>
-    void swap(basic_ofstream<Char, Traits>& lhs,
-              basic_ofstream<Char, Traits>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 27.9.1.14, class template basic_fstream:
-     */
-
-    template<class Char, class Traits>
-    class basic_fstream: public basic_iostream<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.9.1.15, constructors:
-             */
-
-            basic_fstream()
-                : basic_iostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            { /* DUMMY BODY */ }
-
-            explicit basic_fstream(const char* name,
-                                   ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_iostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode))
-                    this->setstate(ios_base::failbit);
-            }
-
-            explicit basic_fstream(const string& name,
-                                   ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_iostream<char_type, traits_type>{&rdbuf_},
-                  rdbuf_{}
-            {
-                if (!rdbuf_.open(name, mode))
-                    this->setstate(ios_base::failbit);
-            }
-
-            basic_fstream(const basic_fstream&) = delete;
-
-            basic_fstream(basic_fstream&& other)
-                : basic_iostream<char_type, traits_type>{move(other)},
-                  rdbuf_{other.rdbuf_}
-            {
-                basic_iostream<char_type, traits_type>::set_rdbuf(&rdbuf_);
-            }
-
-            /**
-             * 27.9.1.16, assign/swap:
-             */
-
-            basic_fstream& operator=(const basic_fstream&) = delete;
-
-            basic_fstream& operator=(basic_fstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_fstream& rhs)
-            {
-                basic_iostream<char_type, traits_type>::swap(rhs);
-                rdbuf_.swap(rhs.rdbuf_);
-            }
-
-            /**
-             * 27.9.1.17, members:
-             */
-
-            basic_filebuf<char_type, traits_type>* rdbuf() const
-            {
-                return const_cast<basic_filebuf<char_type, traits_type>*>(&rdbuf_);
-            }
-
-            bool is_open() const
-            {
-                return rdbuf_.is_open();
-            }
-
-            void open(const char* name,
-                      ios_base::openmode mode = ios_base::in | ios_base::out)
-            {
-                if (!rdbuf_.open(name, mode))
-                    this->setstate(ios_base::failbit);
-                else
-                    this->clear();
-            }
-
-            void open(const string& name,
-                      ios_base::openmode mode = ios_base::in | ios_base::out)
-            {
-                open(name.c_str(), mode);
-            }
-
-            void close()
-            {
-                if (!rdbuf_.close())
-                    this->setstate(ios_base::failbit);
-            }
-
-        private:
-            basic_filebuf<char_type, traits_type> rdbuf_;
-    };
-
-    template<class Char, class Traits>
-    void swap(basic_fstream<Char, Traits>& lhs,
-              basic_fstream<Char, Traits>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/iomanip.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/iomanip.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_IOMANIP
-#define LIBCPP_BITS_IO_IOMANIP
-
-#include <__bits/io/iomanip_objs.hpp>
-#include <iosfwd>
-
-namespace std
-{
-    /**
-     * 27.7.4, standard manipulators:
-     */
-
-    aux::manip_wrapper<aux::resetiosflags_t> resetiosflags(ios_base::fmtflags mask);
-    aux::manip_wrapper<aux::setiosflags_t> setiosflags(ios_base::fmtflags mask);
-    aux::manip_wrapper<aux::setbase_t> setbase(int base);
-
-    template<class Char>
-    aux::setfill_t<Char> setfill(Char c)
-    {
-        return aux::setfill_t<Char>{c};
-    }
-
-    aux::manip_wrapper<aux::setprecision_t> setprecision(int prec);
-    aux::manip_wrapper<aux::setw_t> setw(int width);
-
-    /**
-     * 27.7.5, extended manipulators:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/iomanip_objs.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/iomanip_objs.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_IOMANIP_OBJS
-#define LIBCPP_BITS_IO_IOMANIP_OBJS
-
-#include <ios>
-#include <utility>
-
-namespace std::aux
-{
-    /**
-     * Note: This allows us to lower the amount
-     *       of code duplication in this module
-     *       as we can avoid operator<</>> overloading
-     *       for the manipulators.
-     */
-    template<class Manipulator>
-    struct manip_wrapper
-    {
-        template<class... Args>
-        manip_wrapper(Args&&... args)
-            : manipulator{forward<Args>(args)...}
-        { /* DUMMY BODY */ }
-
-        void operator()(ios_base& str)
-        {
-            manipulator(str);
-        }
-
-        Manipulator manipulator;
-    };
-
-    template<class Char, class Traits, class Manipulator>
-    basic_ostream<Char, Traits>& operator<<(
-        basic_ostream<Char, Traits>& os, manip_wrapper<Manipulator> manip
-    )
-    {
-        manip(os);
-
-        return os;
-    }
-
-    template<class Char, class Traits, class Manipulator>
-    basic_istream<Char, Traits>& operator>>(
-        basic_istream<Char, Traits>& is, manip_wrapper<Manipulator> manip
-    )
-    {
-        manip(is);
-
-        return is;
-    }
-
-    struct resetiosflags_t
-    {
-        resetiosflags_t(ios_base::fmtflags m);
-
-        void operator()(ios_base& str) const;
-
-        ios_base::fmtflags mask;
-    };
-
-    struct setiosflags_t
-    {
-        setiosflags_t(ios_base::fmtflags m);
-
-        void operator()(ios_base& str) const;
-
-        ios_base::fmtflags mask;
-    };
-
-    struct setbase_t
-    {
-        setbase_t(int b);
-
-        void operator()(ios_base& str) const;
-
-        int base;
-    };
-
-    /**
-     * Note: setfill is only for basic_ostream so
-     *       this is the only case where we overload
-     *       the appropriate operator again.
-     */
-    template<class Char>
-    struct setfill_t
-    {
-        setfill_t(Char c)
-            : fill{c}
-        { /* DUMMY BODY */ }
-
-        template<class Traits>
-        void operator()(basic_ios<Char, Traits>& str) const
-        {
-            str.fill(fill);
-        }
-
-        Char fill;
-    };
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(
-        basic_ostream<Char, Traits>& is,
-        setfill_t<Char> manip
-    )
-    {
-        manip(is);
-
-        return is;
-    }
-
-    struct setprecision_t
-    {
-        setprecision_t(int);
-
-        void operator()(ios_base&) const;
-
-        int prec;
-    };
-
-    struct setw_t
-    {
-        setw_t(int);
-
-        void operator()(ios_base&) const;
-
-        int width;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/ios.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/ios.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,612 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_IOS
-#define LIBCPP_BITS_IO_IOS
-
-#include <__bits/locale/locale.hpp>
-#include <__bits/locale/ctype.hpp>
-#include <cstdlib>
-#include <iosfwd>
-#include <system_error>
-#include <utility>
-#include <vector>
-
-namespace std
-{
-    using streamoff = long long;
-    using streamsize = ::ssize_t;
-
-    /**
-     * 27.5.3, ios_base:
-     */
-
-    class ios_base
-    {
-        public:
-            virtual ~ios_base();
-
-            ios_base(const ios_base&) = delete;
-            ios_base& operator=(const ios_base&) = delete;
-
-            /**
-             * 27.5.3.1.1, failure:
-             */
-
-            class failure: public system_error
-            {
-                // TODO: implement
-            };
-
-            /**
-             * 27.5.3.1.2, fmtflags:
-             */
-
-            using fmtflags = uint16_t;
-            static constexpr fmtflags boolalpha   = 0b0000'0000'0000'0001;
-            static constexpr fmtflags dec         = 0b0000'0000'0000'0010;
-            static constexpr fmtflags fixed       = 0b0000'0000'0000'0100;
-            static constexpr fmtflags hex         = 0b0000'0000'0000'1000;
-            static constexpr fmtflags internal    = 0b0000'0000'0001'0000;
-            static constexpr fmtflags left        = 0b0000'0000'0010'0000;
-            static constexpr fmtflags oct         = 0b0000'0000'0100'0000;
-            static constexpr fmtflags right       = 0b0000'0000'1000'0000;
-            static constexpr fmtflags scientific  = 0b0000'0001'0000'0000;
-            static constexpr fmtflags showbase    = 0b0000'0010'0000'0000;
-            static constexpr fmtflags showpoint   = 0b0000'0100'0000'0000;
-            static constexpr fmtflags showpos     = 0b0000'1000'0000'0000;
-            static constexpr fmtflags skipws      = 0b0001'0000'0000'0000;
-            static constexpr fmtflags unitbuf     = 0b0010'0000'0000'0000;
-            static constexpr fmtflags uppercase   = 0b0100'0000'0000'0000;
-            static constexpr fmtflags adjustfield = left | right | internal;
-            static constexpr fmtflags basefield   = dec  | oct   | hex;
-            static constexpr fmtflags floatfield  = scientific   | fixed;
-
-            /**
-             * 27.5.3.1.3, iostate:
-             */
-
-            using iostate = uint8_t;
-            static constexpr iostate badbit  = 0b0001;
-            static constexpr iostate eofbit  = 0b0010;
-            static constexpr iostate failbit = 0b0100;
-            static constexpr iostate goodbit = 0b0000;
-
-            /**
-             * 27.5.3.1.4, openmode:
-             */
-
-            using openmode = uint8_t;
-            static constexpr openmode app    = 0b00'0001;
-            static constexpr openmode ate    = 0b00'0010;
-            static constexpr openmode binary = 0b00'0100;
-            static constexpr openmode in     = 0b00'1000;
-            static constexpr openmode out    = 0b01'0000;
-            static constexpr openmode trunc  = 0b10'0000;
-
-            /**
-             * 27.5.3.1.5, seekdir:
-             */
-
-            using seekdir = uint8_t;
-            static constexpr seekdir beg = 0b001;
-            static constexpr seekdir cur = 0b010;
-            static constexpr seekdir end = 0b100;
-
-            /**
-             * 27.5.3.1.6, class Init:
-             */
-
-            class Init
-            {
-                public:
-                    Init();
-                    ~Init();
-
-                private:
-                    static int init_cnt_;
-            };
-
-            /**
-             * 27.5.3.2, fmtflags state:
-             */
-
-            fmtflags flags() const;
-            fmtflags flags(fmtflags fmtfl);
-            fmtflags setf(fmtflags fmtfl);
-            fmtflags setf(fmtflags fmtfl, fmtflags mask);
-            void unsetf(fmtflags mask);
-
-            streamsize precision() const;
-            streamsize precision(streamsize prec);
-            streamsize width() const;
-            streamsize width(streamsize wide);
-
-            /**
-             * 27.5.3.3, locales:
-             */
-
-            locale imbue(const locale& loc);
-            locale getloc() const;
-
-            /**
-             * 27.5.3.5, storage:
-             */
-
-            static int xalloc()
-            {
-                // TODO: Concurrent access to this function
-                //       by multiple threads shall not result
-                //       in a data race.
-                return index_++;
-            }
-
-            long& iword(int index);
-            void*& pword(int index);
-
-            /**
-             * 27.5.3.6, callbacks:
-             */
-
-            enum event
-            {
-                erase_event,
-                imbue_event,
-                copyfmt_event
-            };
-
-            using event_callback = void (*)(event, ios_base&, int);
-            void register_callback(event_callback fn, int index);
-
-            static bool sync_with_stdio(bool sync = true)
-            {
-                auto old = sync_;
-                sync_ = sync;
-
-                return old;
-            }
-
-        protected:
-            ios_base();
-
-            static int index_;
-            static bool sync_;
-
-            static long ierror_;
-            static void* perror_;
-            static constexpr size_t initial_size_{10};
-
-            long* iarray_;
-            void** parray_;
-            size_t iarray_size_;
-            size_t parray_size_;
-
-            fmtflags flags_;
-            streamsize precision_;
-            streamsize width_;
-
-            locale locale_;
-
-            vector<pair<event_callback, int>> callbacks_;
-
-        private:
-            static constexpr size_t buffer_size_{64};
-            char buffer_[buffer_size_];
-
-            template<class Char, class Iterator>
-            friend class num_put;
-
-            template<class Char, class Iterator>
-            friend class num_get;
-    };
-
-    /**
-     * 27.5.4, fpos:
-     */
-
-    template<class State>
-    class fpos
-    {
-        public:
-            State state() const
-            {
-                return state_;
-            }
-
-            void state(State st)
-            {
-                state_ = st;
-            }
-
-        private:
-            State state_;
-    };
-
-    /**
-     * 27.5.4.2, fpos requirements:
-     */
-
-    // TODO: implement
-
-    /**
-     * 27.5.5, basic_ios:
-     */
-
-    template<class Char, class Traits>
-    class basic_ios: public ios_base
-    {
-        public:
-            using traits_type = Traits;
-            using char_type   = Char;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            basic_ios(const basic_ios&) = delete;
-            basic_ios& operator=(const basic_ios&) = delete;
-
-            explicit operator bool() const
-            {
-                return !fail();
-            }
-
-            bool operator!() const
-            {
-                return fail();
-            }
-
-            iostate rdstate() const
-            {
-                return rdstate_;
-            }
-
-            void clear(iostate state = goodbit)
-            {
-                if (rdbuf_)
-                    rdstate_ = state;
-                else
-                    rdstate_ = state | badbit;
-
-                if (((state | (rdbuf_ ? goodbit : badbit)) & exceptions_) == 0)
-                    return;
-                // TODO: Else throw failure.
-                return;
-            }
-
-            void setstate(iostate state)
-            {
-                clear(rdstate_ | state);
-            }
-
-            bool good() const
-            {
-                return rdstate_ == 0;
-            }
-
-            bool eof() const
-            {
-                return (rdstate_ & eofbit) != 0;
-            }
-
-            bool fail() const
-            {
-                return (rdstate_ & (failbit | badbit)) != 0;
-            }
-
-            bool bad() const
-            {
-                return (rdstate_ & badbit) != 0;
-            }
-
-            iostate exceptions() const
-            {
-                return exceptions_;
-            }
-
-            void exceptions(iostate except)
-            {
-                exceptions_ = except;
-                clear(rdstate_);
-            }
-
-            /**
-             * 27.5.5.2, constructor/destructor:
-             */
-
-            explicit basic_ios(basic_streambuf<Char, Traits>* sb)
-            {
-                init(sb);
-            }
-
-            virtual ~basic_ios()
-            { /* DUMMY BODY */ }
-
-            /**
-             * 27.5.5.3, members:
-             */
-
-            basic_ostream<Char, Traits>* tie() const
-            {
-                return tie_;
-            }
-
-            basic_ostream<Char, Traits>* tie(basic_ostream<Char, Traits>* tiestr)
-            {
-                auto old = tie_;
-                tie_ = tiestr;
-
-                return old;
-            }
-
-            basic_streambuf<Char, Traits>* rdbuf() const
-            {
-                return rdbuf_;
-            }
-
-            basic_streambuf<Char, Traits>* rdbuf(basic_streambuf<Char, Traits>* sb)
-            {
-                auto old = rdbuf_;
-                rdbuf_ = sb;
-
-                clear();
-
-                return old;
-            }
-
-            basic_ios& copyfmt(const basic_ios& rhs)
-            {
-                if (this == &rhs)
-                    return *this;
-
-                for (auto& callback: callbacks_)
-                    callback.first(erase_event, *this, index_);
-
-                tie_        = rhs.tie_;
-                flags_      = rhs.flags_;
-                width_      = rhs.width_;
-                precision_  = rhs.precision_;
-                fill_      = rhs.fill_;
-                locale_     = rhs.locale_;
-
-                delete[] iarray_;
-                iarray_size_ = rhs.iarray_size_;
-                iarray_ = new long[iarray_size_];
-
-                for (size_t i = 0; i < iarray_size_; ++i)
-                    iarray_[i] = rhs.iarray_[i];
-
-                delete[] parray_;
-                parray_size_ = rhs.parray_size_;
-                parray_ = new void *[parray_size_];
-
-                for (size_t i = 0; i < parray_size_; ++i)
-                    parray_[i] = rhs.parray_[i];
-
-                for (auto& callback: callbacks_)
-                    callback.first(copyfmt_event, *this, index_);
-
-                exceptions(rhs.exceptions());
-            }
-
-            char_type fill() const
-            {
-                return fill_;
-            }
-
-            char_type fill(char_type c)
-            {
-                char_type old;
-                traits_type::assign(old, fill_);
-                traits_type::assign(fill_, c);
-
-                return old;
-            }
-
-            locale imbue(const locale& loc)
-            {
-                auto res = ios_base::imbue(loc);
-
-                if (rdbuf_)
-                    rdbuf_->pubimbue(loc);
-
-                return res;
-            }
-
-            char narrow(char_type c, char def) const
-            {
-                return use_facet<ctype<char_type>>(locale_).narrow(c, def);
-            }
-
-            char_type widen(char c) const
-            {
-                return use_facet<ctype<char_type>>(locale_).widen(c);
-            }
-
-        protected:
-            basic_ios()
-            { /* DUMMY BODY */ }
-
-            void init(basic_streambuf<Char, Traits>* sb)
-            {
-                // Initialized according to Table 128.
-                rdbuf_ = sb;
-                tie_ = nullptr;
-                rdstate_ = sb ? goodbit : badbit;
-                exceptions_ = goodbit;
-                flags(skipws | dec);
-
-                width(0);
-                precision(6);
-
-                fill_ = widen(' ');
-                locale_ = locale();
-
-                iarray_ = nullptr;
-                parray_ = nullptr;
-            }
-
-            void move(basic_ios& rhs)
-            {
-                rdbuf_      = nullptr; // rhs keeps it!
-                tie_        = rhs.tie_;
-                exceptions_ = rhs.exceptions_;
-                flags_      = rhs.flags_;
-                width_      = rhs.width_;
-                precision_  = rhs.precision_;
-                fill_       = rhs.fill_;
-                locale_     = move(rhs.locale_);
-                rdstate_    = rhs.rdstate_;
-                callbacks_  = move(rhs.callbacks_);
-
-                delete[] iarray_;
-                iarray_      = rhs.iarray_;
-                iarray_size_ = rhs.iarray_size_;
-
-                delete[] parray_;
-                parray_      = rhs.parray_;
-                parray_size_ = rhs.parray_size_;
-
-                rhs.tie_ = nullptr;
-                rhs.iarray_ = nullptr;
-                rhs.parray_ = nullptr;
-            }
-
-            void move(basic_ios&& rhs)
-            {
-                rdbuf_      = nullptr; // rhs keeps it!
-                tie_        = rhs.tie_;
-                exceptions_ = rhs.exceptions_;
-                flags_      = rhs.flags_;
-                width_      = rhs.width_;
-                precision_  = rhs.precision_;
-                fill_       = rhs.fill_;
-                locale_     = move(rhs.locale_);
-                rdstate_    = rhs.rdstate_;
-                callbacks_.swap(rhs.callbacks_);
-
-                delete[] iarray_;
-                iarray_      = rhs.iarray_;
-                iarray_size_ = rhs.iarray_size_;
-
-                delete[] parray_;
-                parray_      = rhs.parray_;
-                parray_size_ = rhs.parray_size_;
-
-                rhs.tie_ = nullptr;
-                rhs.iarray_ = nullptr;
-                rhs.parray_ = nullptr;
-            }
-
-            void swap(basic_ios& rhs) noexcept
-            {
-                // Swap everything but rdbuf_.
-                swap(tie_, rhs.tie_);
-                swap(exceptions_, rhs.exceptions_);
-                swap(flags_, rhs.flags_);
-                swap(width_, rhs.width_);
-                swap(precision_, rhs.precision_);
-                swap(fill_, rhs.fill_);
-                swap(locale_, rhs.locale_);
-                swap(rdstate_, rhs.rdstate_);
-                swap(callbacks_, rhs.callbacks_);
-                swap(iarray_);
-                swap(iarray_size_);
-                swap(parray_);
-                swap(parray_size_);
-            }
-
-            void set_rdbuf(basic_streambuf<Char, Traits>* sb)
-            {
-                // No call to clear is intentional.
-                rdbuf_ = sb;
-            }
-
-        private:
-            basic_streambuf<Char, Traits>* rdbuf_;
-            basic_ostream<Char, Traits>* tie_;
-            iostate rdstate_;
-            iostate exceptions_;
-            char_type fill_;
-    };
-
-    /**
-     * 27.5.6, ios_base manipulators:
-     */
-
-    /**
-     * 27.5.6.1, fmtflags manipulators:
-     */
-
-    ios_base& boolalpha(ios_base& str);
-    ios_base& noboolalpha(ios_base& str);
-    ios_base& showbase(ios_base& str);
-    ios_base& noshowbase(ios_base& str);
-    ios_base& showpoint(ios_base& str);
-    ios_base& noshowpoint(ios_base& str);
-    ios_base& showpos(ios_base& str);
-    ios_base& noshowpos(ios_base& str);
-    ios_base& skipws(ios_base& str);
-    ios_base& noskipws(ios_base& str);
-    ios_base& uppercase(ios_base& str);
-    ios_base& nouppercase(ios_base& str);
-    ios_base& unitbuf(ios_base& str);
-    ios_base& nounitbuf(ios_base& str);
-
-    /**
-     * 27.5.6.2, adjustfield manipulators:
-     */
-
-    ios_base& internal(ios_base& str);
-    ios_base& left(ios_base& str);
-    ios_base& right(ios_base& str);
-
-    /**
-     * 27.5.6.3, basefield manupulators:
-     */
-
-    ios_base& dec(ios_base& str);
-    ios_base& hex(ios_base& str);
-    ios_base& oct(ios_base& str);
-
-    /**
-     * 27.5.6.4, floatfield manupulators:
-     */
-
-    ios_base& fixed(ios_base& str);
-    ios_base& scientific(ios_base& str);
-    ios_base& hexfloat(ios_base& str);
-    ios_base& defaultfloat(ios_base& str);
-
-    /**
-     * 27.5.6.5, error reporting:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/iosfwd.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/iosfwd.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_IOSFWD
-#define LIBCPP_BITS_IO_IOSFWD
-
-namespace std
-{
-    /**
-     * 27.3, forward declarations:
-     */
-
-    template<class Char>
-    class char_traits;
-
-    template<>
-    class char_traits<char>;
-
-    template<>
-    class char_traits<char16_t>;
-
-    template<>
-    class char_traits<char32_t>;
-
-    template<>
-    class char_traits<wchar_t>;
-
-
-
-    template<class T>
-    class allocator;
-
-
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_ios;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_streambuf;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_istream;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_ostream;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_iostream;
-
-
-
-    template<class Char, class Traits = char_traits<Char>,
-             class Allocator = allocator<Char>>
-    class basic_stringbuf;
-
-    template<class Char, class Traits = char_traits<Char>,
-             class Allocator = allocator<Char>>
-    class basic_istringstream;
-
-    template<class Char, class Traits = char_traits<Char>,
-             class Allocator = allocator<Char>>
-    class basic_ostringstream;
-
-    template<class Char, class Traits = char_traits<Char>,
-             class Allocator = allocator<Char>>
-    class basic_stringstream;
-
-
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_filebuf;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_ifstream;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_ofstream;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class basic_fstream;
-
-
-
-    template<class Char, class Traits = char_traits<Char>>
-    class istreambuf_iterator;
-
-    template<class Char, class Traits = char_traits<Char>>
-    class ostreambuf_iterator;
-
-    using ios  = basic_ios<char>;
-    using wios = basic_ios<wchar_t>;
-
-    using streambuf = basic_streambuf<char>;
-    using istream   = basic_istream<char>;
-    using ostream   = basic_ostream<char>;
-    using iostream  = basic_iostream<char>;
-
-    using stringbuf     = basic_stringbuf<char>;
-    using istringstream = basic_istringstream<char>;
-    using ostringstream = basic_ostringstream<char>;
-    using stringstream  = basic_stringstream<char>;
-
-    using filebuf  = basic_filebuf<char>;
-    using ifstream = basic_ifstream<char>;
-    using ofstream = basic_ofstream<char>;
-    using fstream  = basic_fstream<char>;
-
-    using wstreambuf = basic_streambuf<wchar_t>;
-    using wistream   = basic_istream<wchar_t>;
-    using wostream   = basic_ostream<wchar_t>;
-    using wiostream  = basic_iostream<wchar_t>;
-
-    using wstringbuf     = basic_stringbuf<wchar_t>;
-    using wistringstream = basic_istringstream<wchar_t>;
-    using wostringstream = basic_ostringstream<wchar_t>;
-    using wstringstream  = basic_stringstream<wchar_t>;
-
-    using wfilebuf  = basic_filebuf<wchar_t>;
-    using wifstream = basic_ifstream<wchar_t>;
-    using wofstream = basic_ofstream<wchar_t>;
-    using wfstream  = basic_fstream<wchar_t>;
-
-    template<class State>
-    class fpos;
-
-    // TODO: standard p. 1012, this is circular, it offers fix
-    /* using streampos  = fpos<char_traits<char>::state_type>; */
-    /* using wstreampos = fpos<char_traits<wchar_t>::state_type>; */
-    // Temporary workaround.
-    using streampos =  unsigned long long;
-    using wstreampos = unsigned long long;
-    // TODO: This should be in ios and not here?
-    using streamoff = long long;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/iostream.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/iostream.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_IOSTREAM
-#define LIBCPP_BITS_IO_IOSTREAM
-
-#include <ios>
-#include <streambuf>
-#include <istream>
-#include <ostream>
-
-namespace std
-{
-    extern istream cin;
-    extern ostream cout;
-
-    // TODO: add the rest
-
-    namespace aux
-    {
-        extern ios_base::Init init;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/istream.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/istream.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,974 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_ISTREAM
-#define LIBCPP_BITS_IO_ISTREAM
-
-#include <cassert>
-#include <ios>
-#include <iosfwd>
-#include <limits>
-#include <locale>
-#include <ostream>
-#include <utility>
-
-namespace std
-{
-
-    /**
-     * 27.7.2.1, class template basic_stream:
-     */
-
-    template<class Char, class Traits>
-    class basic_istream: virtual public basic_ios<Char, Traits>
-    {
-        public:
-            using traits_type = Traits;
-            using char_type   = Char;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.7.2.1.1, constructor/destructor:
-             */
-
-            explicit basic_istream(basic_streambuf<Char, Traits>* sb)
-                : gcount_{0}
-            {
-                basic_ios<Char, Traits>::init(sb);
-            }
-
-            virtual ~basic_istream()
-            { /* DUMMY BODY */ }
-
-            /**
-             * 27.7.2.1.3, prefix/suffix:
-             */
-
-            class sentry
-            {
-                public:
-                    explicit sentry(basic_istream<Char, Traits>& is, bool noskipws = false)
-                        : ok_{false}
-                    {
-                        if (!is.good())
-                            is.setstate(ios_base::failbit);
-                        else
-                        {
-                            if (is.tie())
-                                is.tie()->flush();
-
-                            if (!noskipws && ((is.flags() & ios_base::skipws) != 0))
-                            {
-                                const auto& ct = use_facet<ctype<Char>>(is.getloc());
-                                while (true)
-                                {
-                                    auto i = is.rdbuf()->sgetc();
-                                    if (Traits::eq_int_type(i, Traits::eof()))
-                                    {
-                                        is.setstate(ios_base::failbit | ios_base::eofbit);
-                                        break;
-                                    }
-
-                                    auto c = Traits::to_char_type(i);
-                                    if (!ct.is(ctype_base::space, c))
-                                        break;
-                                    else
-                                        is.rdbuf()->sbumpc();
-                                }
-                            }
-                        }
-
-                        if (is.good())
-                            ok_ = true;
-                    }
-
-                    ~sentry() = default;
-
-                    explicit operator bool() const
-                    {
-                        return ok_;
-                    }
-
-                    sentry(const sentry&) = delete;
-                    sentry& operator=(const sentry&) = delete;
-
-                private:
-                    using traits_type = Traits;
-                    bool ok_;
-            };
-
-            /**
-             * 27.7.2.2, formatted input:
-             */
-
-            basic_istream<Char, Traits>& operator>>(
-                basic_istream<Char, Traits>& (*pf)(basic_istream<Char, Traits>&)
-            )
-            {
-                return pf(*this);
-            }
-
-            basic_istream<Char, Traits>& operator>>(
-                basic_ios<Char, Traits>& (*pf)(basic_ios<Char, Traits>&)
-            )
-            {
-                pf(*this);
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(
-                ios_base& (*pf)(ios_base&)
-            )
-            {
-                pf(*this);
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(bool& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(short& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    long tmp{};
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, tmp);
-
-                    if (tmp < numeric_limits<short>::min())
-                    {
-                        err |= ios_base::failbit;
-                        x = numeric_limits<short>::min();
-                    }
-                    else if (numeric_limits<short>::max() < tmp)
-                    {
-                        err |= ios_base::failbit;
-                        x = numeric_limits<short>::max();
-                    }
-                    else
-                        x = static_cast<short>(tmp);
-
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(unsigned short& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(int& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    long tmp{};
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, tmp);
-
-                    if (tmp < numeric_limits<int>::min())
-                    {
-                        err |= ios_base::failbit;
-                        x = numeric_limits<int>::min();
-                    }
-                    else if (numeric_limits<int>::max() < tmp)
-                    {
-                        err |= ios_base::failbit;
-                        x = numeric_limits<int>::max();
-                    }
-                    else
-                        x = static_cast<int>(tmp);
-
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(unsigned int& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(long& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(unsigned long& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(long long& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(unsigned long long& x)
-            {
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    using num_get = num_get<Char, istreambuf_iterator<Char, Traits>>;
-                    auto err = ios_base::goodbit;
-
-                    auto loc = this->getloc();
-                    use_facet<num_get>(loc).get(*this, 0, *this, err, x);
-                    this->setstate(err);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(float& x)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(double& x)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(long double& x)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(void*& p)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& operator>>(basic_streambuf<Char, Traits>* sb)
-            {
-                if (!sb)
-                {
-                    this->setstate(ios_base::failbit);
-                    return *this;
-                }
-
-                gcount_ = 0;
-                sentry sen{*this, false};
-
-                if (sen)
-                {
-                    while (true)
-                    {
-                        auto ic = this->rdbuf()->sgetc();
-                        if (traits_type::eq_int_type(ic, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::eofbit);
-                            break;
-                        }
-
-                        auto res = sb->sputc(traits_type::to_char_type(ic));
-                        if (traits_type::eq_int_type(res, traits_type::eof()))
-                            break;
-
-                        ++gcount_;
-                        this->rdbuf()->sbumpc();
-                    }
-                }
-
-                return *this;
-            }
-
-            /**
-             * 27.7.2.3, unformatted input:
-             * TODO: Once we have exceptions, implement
-             *       27.7.2.3 paragraph 1.
-             */
-
-            streamsize gcount() const
-            {
-                return gcount_;
-            }
-
-            int_type get()
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (sen)
-                {
-                    auto res = this->rdbuf()->sbumpc();
-                    if (!traits_type::eq_int_type(res, traits_type::eof()))
-                    {
-                        gcount_ = 1;
-                        return res;
-                    }
-
-                    this->setstate(ios_base::failbit | ios_base::eofbit);
-                }
-
-                return traits_type::eof();
-            }
-
-            basic_istream<Char, Traits>& get(char_type& c)
-            {
-                auto res = get();
-                if (res != traits_type::eof())
-                    c = traits_type::to_char_type(res);
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& get(char_type* s, streamsize n, char_type delim)
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (sen && n > 0)
-                {
-                    while(gcount_ < n - 1)
-                    {
-                        auto c = this->rdbuf()->sbumpc();
-
-                        if (traits_type::eq_int_type(c, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::eofbit);
-                            break;
-                        }
-
-                        s[gcount_++] = traits_type::to_char_type(c);
-
-                        auto peek = traits_type::to_char_type(this->rdbuf()->sgetc());
-                        if (traits_type::eq(peek, delim))
-                            break;
-                    }
-
-                    if (gcount_ == 0)
-                        this->setstate(ios_base::failbit);
-                    s[n] = char_type{};
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& get(char_type* s, streamsize n)
-            {
-                return get(s, n, this->widen('\n'));
-            }
-
-            basic_istream<Char, Traits>& get(basic_streambuf<Char, Traits>& sb)
-            {
-                get(sb, this->widen('\n'));
-            }
-
-            basic_istream<Char, Traits>& get(basic_streambuf<Char, Traits>& sb, char_type delim)
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (sen)
-                {
-                    while (true)
-                    {
-                        auto i = this->rdbuf()->sgetc();
-                        if (traits_type::eq_int_type(i, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::eofbit);
-                            break;
-                        }
-
-                        auto c = traits_type::to_char_type(i);
-                        if (traits_type::eq(c, delim))
-                            break;
-
-                        auto insert_ret = sb.sputc(c);
-                        if (traits_type::eq_int_type(insert_ret, traits_type::eof()))
-                            break;
-
-                        this->rdbuf()->sbumpc();
-                        ++gcount_;
-                    }
-
-                    if (gcount_ == 0)
-                        this->setstate(ios_base::failbit);
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& getline(char_type* s, streamsize n)
-            {
-                return getline(s, n, this->widen('\n'));
-            }
-
-            basic_istream<Char, Traits>& getline(char_type* s, streamsize n, char_type delim)
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (sen)
-                {
-                    while (true)
-                    { // We have exactly specified order of checks, easier to do them in the body.
-                        auto c = this->rdbuf()->sbumpc();
-
-                        if (traits_type::eq_int_type(c, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::eofbit);
-                            break;
-                        }
-
-                        if (traits_type::eq_int_type(c, traits_type::to_int_type(delim)))
-                            break;
-
-                        if (n < 1 || gcount_ >= n - 1)
-                        {
-                            this->setstate(ios_base::failbit);
-                            break;
-                        }
-
-                        s[gcount_++] = traits_type::to_char_type(c);
-                    }
-
-                    if (gcount_ == 0)
-                        this->setstate(ios_base::failbit);
-                    if (n > 0)
-                        s[gcount_] = char_type{};
-                }
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& ignore(streamsize n = 1, int_type delim = traits_type::eof())
-            {
-                sentry sen{*this, true};
-
-                if (sen)
-                {
-                    streamsize i{};
-                    while (n == numeric_limits<streamsize>::max() || i < n)
-                    {
-                        auto c = this->rdbuf()->sbumpc();
-
-                        if (traits_type::eq_int_type(c, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::eofbit);
-                            break;
-                        }
-
-                        if (traits_type::eq_int_type(c, delim))
-                            break;
-                    }
-                }
-
-                return *this;
-            }
-
-            int_type peek()
-            {
-                sentry sen{*this, true};
-
-                if (!this->good())
-                    return traits_type::eof();
-                else
-                    return this->rdbuf()->sgetc();
-            }
-
-            basic_istream<Char, Traits>& read(char_type* s, streamsize n)
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (!this->good())
-                {
-                    this->setstate(ios_base::failbit);
-                    return *this;
-                }
-
-                while (gcount_ < n)
-                {
-                    auto c = this->rdbuf()->sbumpc();
-                    if (traits_type::eq_int_type(c, traits_type::eof()))
-                    {
-                        this->setstate(ios_base::failbit | ios_base::eofbit);
-                        break;
-                    }
-
-                    s[gcount_++] = traits_type::to_char_type(c);
-                }
-
-                return *this;
-            }
-
-            streamsize readsome(char_type* s, streamsize n)
-            {
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (!this->good())
-                {
-                    this->setstate(ios_base::failbit);
-                    return streamsize{};
-                }
-
-                auto avail = this->rdbuf()->in_avail();
-                if (avail == -1)
-                {
-                    this->setstate(ios_base::eofbit);
-                    return streamsize{};
-                } else if (avail > 0)
-                {
-                    auto count = (avail < n ? avail : n);
-                    while (gcount_ < count)
-                        s[gcount_++] = traits_type::to_char_type(this->rdbuf()->sbumpc());
-                }
-
-                return gcount_;
-            }
-
-            basic_istream<Char, Traits>& putback(char_type c)
-            {
-                this->clear(this->rdstate() & (~ios_base::eofbit));
-
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (!this->good())
-                {
-                    this->setstate(ios_base::failbit);
-                    return *this;
-                }
-
-                if (this->rdbuf())
-                {
-                    auto ret = this->rdbuf()->sputbackc(c);
-                    if (traits_type::eq_int_type(ret, traits_type::eof()))
-                        this->setstate(ios_base::badbit);
-                }
-                else
-                    this->setstate(ios_base::badbit);
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& unget()
-            {
-                this->clear(this->rdstate() & (~ios_base::eofbit));
-
-                gcount_ = 0;
-                sentry sen{*this, true};
-
-                if (!this->good())
-                {
-                    this->setstate(ios_base::failbit);
-                    return *this;
-                }
-
-                if (this->rdbuf())
-                {
-                    auto ret = this->rdbuf()->sungetc();
-                    if (traits_type::eq_int_type(ret, traits_type::eof()))
-                        this->setstate(ios_base::badbit);
-                }
-                else
-                    this->setstate(ios_base::badbit);
-
-                return *this;
-            }
-
-            int sync()
-            {
-                sentry s{*this, true};
-
-                if (this->rdbuf())
-                {
-                    auto ret = this->rdbuf()->pubsync();
-                    if (ret == -1)
-                    {
-                        this->setstate(ios_base::badbit);
-                        return -1;
-                    }
-                    else
-                        return 0;
-                }
-                else
-                    return -1;
-            }
-
-            pos_type tellg()
-            {
-                sentry s{*this, true};
-
-                if (this->fail())
-                    return pos_type(-1);
-                else
-                    return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
-            }
-
-            basic_istream<Char, Traits>& seekg(pos_type pos)
-            {
-                this->clear(this->rdstate() & (~ios_base::eofbit));
-
-                sentry sen{*this, true};
-
-                if (!this->fail())
-                    this->rdbuf()->pubseekoff(pos, ios_base::in);
-                else
-                    this->setstate(ios_base::failbit);
-
-                return *this;
-            }
-
-            basic_istream<Char, Traits>& seekg(off_type off, ios_base::seekdir dir)
-            {
-                sentry sen{*this, true};
-
-                if (!this->fail())
-                    this->rdbuf()->pubseekoff(off, dir, ios_base::in);
-                else
-                    this->setstate(ios_base::failbit);
-
-                return *this;
-            }
-
-        protected:
-            streamsize gcount_;
-
-            basic_istream(const basic_istream&) = delete;
-
-            basic_istream(basic_istream&& rhs)
-            {
-                gcount_ = rhs.gcout_;
-
-                basic_ios<Char, Traits>::move(rhs);
-
-                rhs.gcount_ = 0;
-            }
-
-            /**
-             * 27.7.2.1.2, assign/swap:
-             */
-
-            basic_istream& operator=(const basic_istream& rhs) = delete;
-
-            basic_istream& operator=(basic_istream&& rhs)
-            {
-                swap(rhs);
-
-                return *this;
-            }
-
-            void swap(basic_istream& rhs)
-            {
-                basic_ios<Char, Traits>::swap(rhs);
-                swap(gcount_, rhs.gcount_);
-            }
-    };
-
-    /**
-     * 27.7.2.2.3, character extraction templates:
-     */
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            Char& c)
-    {
-        typename basic_istream<Char, Traits>::sentry sen{is, false};
-
-        if (sen)
-        {
-            auto ic = is.rdbuf()->sgetc();
-            if (Traits::eq_int_type(ic, Traits::eof()))
-            {
-                is.setstate(ios_base::failbit | ios_base::eofbit);
-                return is;
-            }
-
-            c = Traits::to_char_type(is.rdbuf()->sbumpc());
-        }
-
-        return is;
-    }
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            unsigned char& c)
-    {
-        return is >> reinterpret_cast<char&>(c);
-    }
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            signed char& c)
-    {
-        return is >> reinterpret_cast<char&>(c);
-    }
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            Char* str)
-    {
-        typename basic_istream<Char, Traits>::sentry sen{is, false};
-
-        if (sen)
-        {
-            const auto& ct = use_facet<ctype<Char>>(is.getloc());
-
-            size_t n{};
-            if (is.width() > 0)
-                n = static_cast<size_t>(is.width());
-            else
-                n = (numeric_limits<size_t>::max() / sizeof(Char)) - sizeof(Char);
-
-            size_t i{};
-            for (; i < n - 1; ++i)
-            {
-                auto ic = is.rdbuf()->sgetc();
-                if (Traits::eq_int_type(ic, Traits::eof()))
-                    break;
-
-                auto c = Traits::to_char_type(ic);
-                if (ct.is(ctype_base::space, c))
-                    break;
-
-                str[i] = c;
-                is.rdbuf()->sbumpc();
-            }
-
-            str[i] = Char{};
-            if (i == 0)
-                is.setstate(ios_base::failbit);
-        }
-
-        return is;
-    }
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            unsigned char* str)
-    {
-        return is >> reinterpret_cast<char*>(str);
-    }
-
-    template<class Char, class Traits>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            signed char* str)
-    {
-        return is >> reinterpret_cast<char*>(str);
-    }
-
-    /**
-     * 27.7.2.4, standard basic_istream manipulators:
-     */
-
-    template<class Char, class Traits = char_traits<Char>>
-    basic_istream<Char, Traits>& ws(basic_istream<Char, Traits>& is)
-    {
-        using sentry = typename basic_istream<Char, Traits>::sentry;
-        sentry sen{is, true};
-
-        if (sen)
-        {
-            const auto& ct = use_facet<ctype<Char>>(is.getloc());
-            while (true)
-            {
-                auto i = is.rdbuf()->sgetc();
-                if (Traits::eq_int_type(i, Traits::eof()))
-                {
-                    is.setstate(ios_base::eofbit);
-                    break;
-                }
-
-                auto c = Traits::to_char_type(i);
-                if (!ct.is(c, ct.space))
-                    break;
-                else
-                    is.rdbuf()->sbumpc();
-            }
-        }
-
-        return is;
-    }
-
-    using istream  = basic_istream<char>;
-    using wistream = basic_istream<wchar_t>;
-
-    /**
-     * 27.7.2.5, class template basic_iostream:
-     */
-
-    template<class Char, class Traits>
-    class basic_iostream
-        : public basic_istream<Char, Traits>,
-          public basic_ostream<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            explicit basic_iostream(basic_streambuf<char_type, traits_type>* sb)
-                : basic_istream<char_type, traits_type>(sb),
-                  basic_ostream<char_type, traits_type>(sb)
-            { /* DUMMY BODY */ }
-
-            virtual ~basic_iostream()
-            { /* DUMMY BODY */ }
-
-        protected:
-            basic_iostream(const basic_iostream&) = delete;
-            basic_iostream& operator=(const basic_iostream&) = delete;
-
-            basic_iostream(basic_iostream&& other)
-                : basic_istream<char_type, traits_type>(move(other))
-            { /* DUMMY BODY */ }
-
-            basic_iostream& operator=(basic_iostream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_iostream& other)
-            {
-                basic_istream<char_type, traits_type>::swap(other);
-            }
-    };
-
-    using iostream  = basic_iostream<char>;
-    using wiostream = basic_iostream<wchar_t>;
-
-    /**
-     * 27.7.2.6, rvalue stream extraction:
-     */
-
-    template<class Char, class Traits, class T>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>&& is, T& x)
-    {
-        is >> x;
-
-        return is;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/ostream.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/ostream.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,817 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_OSTREAM
-#define LIBCPP_BITS_IO_OSTREAM
-
-#include <cassert>
-#include <ios>
-#include <iosfwd>
-#include <locale>
-
-namespace std
-{
-    /**
-     * 27.7.3.1, class template basic_ostream:
-     */
-
-    template<class Char, class Traits>
-    class basic_ostream: virtual public basic_ios<Char, Traits>
-    {
-        public:
-            using char_type   = Char;
-            using traits_type = Traits;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            /**
-             * 27.7.3.2, constructor/destructor:
-             */
-
-            explicit basic_ostream(basic_streambuf<char_type, traits_type>* sb)
-            {
-                basic_ios<Char, Traits>::init(sb);
-            }
-
-            virtual ~basic_ostream()
-            { /* DUMMY BODY */ }
-
-            /**
-             * 27.7.3.4, prefix/suffix:
-             */
-
-            class sentry
-            {
-                public:
-                    explicit sentry(basic_ostream<Char, Traits>& os)
-                        : os_{os}, ok_{false}
-                    {
-                        if (os.good())
-                        {
-                            if (os.tie())
-                                os.tie()->flush();
-                        }
-
-                        ok_ = os.good();
-                    }
-
-                    ~sentry()
-                    {
-                        if ((os_.flags() & ios_base::unitbuf) && os_.good())
-                        {
-                            auto ret = os_.rdbuf()->pubsync();
-                            (void)ret;
-                            // TODO: if ret == -1, set badbit in rdstate
-                        }
-                    }
-
-                    explicit operator bool() const
-                    {
-                        return ok_;
-                    }
-
-                    sentry(const sentry&) = delete;
-                    sentry& operator=(const sentry&) = delete;
-
-                private:
-                    basic_ostream<Char, Traits>& os_;
-                    bool ok_;
-            };
-
-            /**
-             * 27.7.3.6, formatted output:
-             */
-
-            basic_ostream<Char, Traits>& operator<<(
-                basic_ostream<Char, Traits>& (*pf)(basic_ostream<Char, Traits>&)
-            )
-            {
-                return pf(*this);
-            }
-
-            basic_ostream<Char, Traits>& operator<<(
-                basic_ios<Char, Traits>& (*pf)(basic_ios<Char, Traits>&)
-            )
-            {
-                pf(*this);
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(
-                ios_base& (*pf)(ios_base&)
-            )
-            {
-                pf(*this);
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(bool x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(short x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    auto basefield = (this->flags() & ios_base::basefield);
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(),
-                                          (basefield == ios_base::oct || basefield == ios_base::hex)
-                                          ? static_cast<long>(static_cast<unsigned short>(x))
-                                          : static_cast<long>(x)).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(unsigned short x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(),
-                                          static_cast<unsigned long>(x)).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(int x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    auto basefield = (this->flags() & ios_base::basefield);
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(),
-                                          (basefield == ios_base::oct || basefield == ios_base::hex)
-                                          ? static_cast<long>(static_cast<unsigned int>(x))
-                                          : static_cast<long>(x)).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(unsigned int x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(),
-                                          static_cast<unsigned long>(x)).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(long x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(unsigned long x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(long long x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(unsigned long long x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(float x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), static_cast<double>(x)).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(double x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(long double x)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), x).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(const void* p)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    bool failed = use_facet<
-                        num_put<char_type, ostreambuf_iterator<char_type, traits_type>>
-                    >(this->getloc()).put(*this, *this, this->fill(), p).failed();
-
-                    if (failed)
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& operator<<(basic_streambuf<Char, Traits>* sb)
-            {
-                if (!sb)
-                    return *this;
-
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    size_t count{};
-
-                    int_type c = sb->sgetc();
-                    while (!traits_type::eq_int_type(c, traits_type::eof()))
-                    {
-                        this->put(traits_type::to_char_type(c));
-
-                        if (!(*this))
-                            break;
-
-                        ++count;
-                        sb->sbumpc();
-                        c = sb->sgetc();
-                    }
-
-                    if (count == 0)
-                        this->setstate(ios_base::failbit);
-                }
-
-                return *this;
-            }
-
-            /**
-             * 27.7.3.7, unformatted output:
-             * TODO: when we have exceptions, complete these
-             */
-
-            basic_ostream<Char, Traits>& put(char_type c)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    auto ret = this->rdbuf()->sputc(c);
-                    if (traits_type::eq_int_type(ret, traits_type::eof()))
-                        this->setstate(ios_base::badbit);
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& write(const char_type* s, streamsize n)
-            {
-                sentry sen{*this};
-
-                if (sen)
-                {
-                    for (streamsize i = 0; i < n; ++i)
-                    {
-                        auto ret = this->rdbuf()->sputc(s[i]);
-                        if (traits_type::eq_int_type(ret, traits_type::eof()))
-                        {
-                            this->setstate(ios_base::badbit);
-                            break;
-                        }
-                    }
-                }
-
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& flush()
-            {
-                if (this->rdbuf())
-                {
-                    sentry sen{*this};
-
-                    if (sen)
-                    {
-                        auto ret = this->rdbuf()->pubsync();
-                        if (ret == -1)
-                            this->setstate(ios_base::badbit);
-                    }
-                }
-
-                return *this;
-            }
-
-            /**
-             * 27.7.3.5, seeks:
-             */
-
-            pos_type tellp()
-            {
-                // TODO: implement
-                __unimplemented();
-                return pos_type{};
-            }
-
-            basic_ostream<Char, Traits>& seekp(pos_type pos)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-            basic_ostream<Char, Traits>& seekp(off_type off, ios_base::seekdir dir)
-            {
-                // TODO: implement
-                __unimplemented();
-                return *this;
-            }
-
-        protected:
-            basic_ostream(const basic_ostream&) = delete;
-
-            basic_ostream(basic_ostream&& other)
-            {
-                basic_ios<Char, Traits>::move(other);
-            }
-
-            /**
-             * 27.7.3.3, assign/swap:
-             */
-
-            basic_ostream& operator=(const basic_ostream&) = delete;
-
-            basic_ostream& operator=(basic_ostream&& other)
-            {
-                swap(other);
-
-                return *this;
-            }
-
-            void swap(basic_ostream& rhs)
-            {
-                basic_ios<Char, Traits>::swap(rhs);
-            }
-    };
-
-    using ostream  = basic_ostream<char>;
-    using wostream = basic_ostream<wchar_t>;
-
-    /**
-     * 27.7.6.3.4, character inserter function templates:
-     */
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            Char c)
-    {
-        typename basic_ostream<Char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            if (os.width() > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                    os.put(c);
-                }
-                else
-                {
-                    os.put(c);
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.put(c);
-
-            os.width(0);
-        }
-
-        return os;
-    }
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            char c)
-    {
-        typename basic_ostream<Char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            if (os.width() > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                    os.put(os.widen(c));
-                }
-                else
-                {
-                    os.put(os.widen(c));
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.put(os.widen(c));
-
-            os.width(0);
-        }
-        return os;
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            char c)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            if (os.width() > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                    os.put(c);
-                }
-                else
-                {
-                    os.put(c);
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.put(c);
-
-            os.width(0);
-            }
-
-        return os;
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            signed char c)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            if (os.width() > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                    os.put(c);
-                }
-                else
-                {
-                    os.put(c);
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.put(c);
-
-            os.width(0);
-        }
-
-        return os;
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            unsigned char c)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            if (os.width() > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                    os.put(c);
-                }
-                else
-                {
-                    os.put(c);
-                    for (decltype(os.width()) i = 0; i < os.width(); ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.put(c);
-
-            os.width(0);
-        }
-
-        return os;
-    }
-
-    namespace aux
-    {
-        template<class Char, class Traits>
-        basic_ostream<Char, Traits>& insert(basic_ostream<Char, Traits>& os,
-                                            const Char* str, size_t len)
-        {
-            if (os.width() > 0 && static_cast<size_t>(os.width()) > len)
-            {
-                size_t to_pad = (static_cast<size_t>(os.width()) - len);
-
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (size_t i = 0; i < to_pad; ++i)
-                        os.put(os.fill());
-                    for (size_t i = 0; i < len; ++i)
-                        os.put(os.widen(str[i]));
-                }
-                else
-                {
-                    for (size_t i = 0; i < len; ++i)
-                        os.put(os.widen(str[i]));
-                    for (size_t i = 0; i < to_pad; ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-            {
-                for (size_t i = 0; i < len; ++i)
-                    os.put(os.widen(str[i]));
-            }
-
-            os.width(0);
-            return os;
-        }
-    }
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const Char* str)
-    {
-        typename basic_ostream<Char, Traits>::sentry sen{os};
-
-        auto len = Traits::length(str);
-
-        return aux::insert(os, str, len);
-    }
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const char* str)
-    {
-        typename basic_ostream<Char, Traits>::sentry sen{os};
-
-        auto len = std::char_traits<char>::length(str);
-
-        return aux::insert(os, str, len);
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            const char* str)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            auto len = Traits::length(str);
-
-            return aux::insert(os, str, len);
-        }
-        else
-            return os;
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            const signed char* str)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            auto len = Traits::length(reinterpret_cast<const char*>(str));
-
-            return aux::insert(os, str, len);
-        }
-        else
-            return os;
-    }
-
-    template<class Traits>
-    basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
-                                            const unsigned char* str)
-    {
-        typename basic_ostream<char, Traits>::sentry sen{os};
-
-        if (sen)
-        {
-            auto len = Traits::length(reinterpret_cast<const char*>(str));
-
-            return aux::insert(os, str, len);
-        }
-        else
-            return os;
-    }
-
-    /**
-     * 27.7.3.8, standard basic_ostream manipulators:
-     */
-
-    template<class Char, class Traits = char_traits<Char>>
-    basic_ostream<Char, Traits>& endl(basic_ostream<Char, Traits>& os)
-    {
-        os.put(os.widen('\n'));
-        os.flush();
-
-        return os;
-    }
-
-    template<class Char, class Traits = char_traits<Char>>
-    basic_ostream<Char, Traits>& ends(basic_ostream<Char, Traits>& os)
-    {
-        os.put(Char{});
-
-        return os;
-    }
-
-    template<class Char, class Traits = char_traits<Char>>
-    basic_ostream<Char, Traits>& flush(basic_ostream<Char, Traits>& os)
-    {
-        os.flush();
-
-        return os;
-    }
-
-    template<class Char, class Traits = char_traits<Char>, class T>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>&& os, const T& x)
-    {
-        os << x;
-
-        return os;
-    }
-}
-
-#endif
-
Index: pace/lib/cpp/include/__bits/io/sstream.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/sstream.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,530 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_SSTREAM
-#define LIBCPP_BITS_IO_SSTREAM
-
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <streambuf>
-#include <string>
-
-namespace std
-{
-    /**
-     * 27.8.2, class template basic_stringbuf:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    class basic_stringbuf: public basic_streambuf<Char, Traits>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using allocator_type = Allocator;
-            using int_type       = typename traits_type::int_type;
-            using pos_type       = typename traits_type::pos_type;
-            using off_type       = typename traits_type::off_type;
-
-            /**
-             * 27.8.2.1, constructors:
-             */
-
-            explicit basic_stringbuf(ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_streambuf<char_type, traits_type>(), mode_{mode}, str_{}
-            {
-                init_();
-            }
-
-            explicit basic_stringbuf(const basic_string<char_type, traits_type, allocator_type> str,
-                                     ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_streambuf<char_type, traits_type>(), mode_{mode}, str_{str}
-            {
-                init_();
-            }
-
-            basic_stringbuf(const basic_stringbuf&) = delete;
-
-            basic_stringbuf(basic_stringbuf&& other)
-                : mode_{move(other.mode_)}, str_{move(other.str_)}
-            {
-                basic_streambuf<char_type, traits_type>::swap(other);
-            }
-
-            /**
-             * 27.8.2.2, assign and swap:
-             */
-
-            basic_stringbuf& operator=(const basic_stringbuf&) = delete;
-
-            basic_stringbuf& operator=(basic_stringbuf&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_stringbuf& rhs)
-            {
-                std::swap(mode_, rhs.mode_);
-                std::swap(str_, rhs.str_);
-
-                basic_streambuf<char_type, traits_type>::swap(rhs);
-            }
-
-            /**
-             * 27.8.2.3, get and set:
-             */
-
-            basic_string<char_type, traits_type, allocator_type> str() const
-            {
-                if (mode_ & ios_base::out)
-                    return basic_string<char_type, traits_type, allocator_type>{
-                        this->output_begin_, this->output_next_ - 1, str_.get_allocator()
-                    };
-                else if (mode_ == ios_base::in)
-                    return basic_string<char_type, traits_type, allocator_type>{
-                        this->eback(), this->egptr(), str_.get_allocator()
-                    };
-                else
-                    return basic_string<char_type, traits_type, allocator_type>{};
-            }
-
-            void str(const basic_string<char_type, traits_type, allocator_type>& str)
-            {
-                str_ = str;
-                init_();
-            }
-
-        protected:
-            /**
-             * 27.8.2.4, overriden virtual functions:
-             */
-
-            int_type underflow() override
-            {
-                if (this->read_avail_())
-                    return traits_type::to_int_type(*this->gptr());
-                else
-                    return traits_type::eof();
-            }
-
-            int_type pbackfail(int_type c = traits_type::eof()) override
-            {
-                if (!traits_type::eq_int_type(c, traits_type::eof()) &&
-                    this->putback_avail_() &&
-                    traits_type::eq(traits_type::to_char_type(c), this->gptr()[-1]))
-                {
-                    --this->input_next_;
-
-                    return c;
-                }
-                else if (!traits_type::eq_int_type(c, traits_type::eof()) &&
-                         this->putback_avail_() && (mode_ & ios_base::out) != 0)
-                {
-                    *--this->input_next_ = c;
-
-                    return c;
-                }
-                else if (traits_type::eq_int_type(c, traits_type::eof()) &&
-                         this->putback_avail_())
-                {
-                    --this->input_next_;
-
-                    return traits_type::not_eof(c);
-                }
-
-                return traits_type::eof();
-            }
-
-            int_type overflow(int_type c = traits_type::eof()) override
-            {
-                if ((mode_ & ios_base::out) == 0)
-                    return traits_type::eof();
-
-                if (!traits_type::eq_int_type(c, traits_type::eof()))
-                {
-                    if (this->output_next_ < this->output_end_)
-                        return c;
-
-                    auto size = static_cast<size_t>(this->output_next_ - this->output_begin_);
-                    str_.size_ = size;
-
-                    str_.push_back(traits_type::to_char_type(c));
-                    init_();
-
-                    return c;
-                }
-                else if (traits_type::eq_int_type(c, traits_type::eof()))
-                    return traits_type::not_eof(c);
-
-                return traits_type::eof();
-            }
-
-            basic_streambuf<char_type, traits_type>* setbuf(char_type* str, streamsize n) override
-            {
-                if (!str && n == 0)
-                    return this;
-
-                str_.assign(str, str + static_cast<size_t>(n));
-
-                return this;
-            }
-
-            pos_type seekoff(off_type off, ios_base::seekdir dir,
-                             ios_base::openmode mode = ios_base::in | ios_base::out)
-            {
-                if ((mode & ios_base::in) == ios_base::in)
-                {
-                    if (!this->input_next_)
-                        return pos_type(off_type(-1));
-
-                    return seekoff_(off, this->input_begin_, this->input_next_, this->input_end_, dir);
-                }
-                else if ((mode & ios_base::out) == ios_base::out)
-                {
-                    if (!this->output_next_)
-                        return pos_type(off_type(-1));
-
-                    return seekoff_(off, this->output_begin_, this->output_next_, this->output_end_, dir);
-                }
-                else if ((mode & (ios_base::in | ios_base::out)) == (ios_base::in | ios_base::out) &&
-                          (dir == ios_base::beg || dir == ios_base::end))
-                {
-                    if (!this->input_next_ || !this->output_next_)
-                        return pos_type(off_type(-1));
-
-                    seekoff_(off, this->input_begin_, this->input_next_, this->input_end_, dir);
-                    return seekoff_(off, this->output_begin_, this->output_next_, this->output_end_, dir);
-                }
-
-                return pos_type(off_type(-1));
-            }
-
-            pos_type seekpos(pos_type pos, ios_base::openmode mode = ios_base::in | ios_base::out)
-            {
-                return seekoff(off_type(pos), ios_base::beg, mode);
-            }
-
-        private:
-            ios_base::openmode mode_;
-            basic_string<char_type, traits_type, allocator_type> str_;
-
-            void init_()
-            {
-                if ((mode_ & ios_base::in) != 0)
-                {
-                    this->input_begin_ = this->input_next_ = str_.begin();
-                    this->input_end_ = str_.end();
-                }
-
-                if ((mode_ & ios_base::out) != 0)
-                {
-                    this->output_begin_ = str_.begin();
-                    this->output_next_ = str_.end();
-                    this->output_end_ = str_.begin() + str_.size() + 1;
-                }
-            }
-
-            bool ensure_free_space_(size_t n = 1)
-            {
-                str_.ensure_free_space_(n);
-                this->output_end_ = str_.begin() + str_.capacity();
-
-                return true;
-            }
-
-            pos_type seekoff_(off_type off, char_type* begin, char_type*& next, char_type* end,
-                          ios_base::seekdir dir)
-            {
-                off_type new_off{};
-
-                if (dir == ios_base::beg)
-                    new_off = 0;
-                else if (dir == ios_base::cur)
-                    new_off = static_cast<off_type>(next - begin);
-                else if (dir == ios_base::end)
-                    new_off = static_cast<off_type>(end - begin);
-
-                if (new_off + off < 0 || begin + new_off + off >= end)
-                    return pos_type(off_type(-1));
-                else
-                    next = begin + new_off + off;
-
-                return pos_type(new_off);
-            }
-    };
-
-    template<class Char, class Traits, class Allocator>
-    void swap(basic_stringbuf<Char, Traits, Allocator>& lhs,
-              basic_stringbuf<Char, Traits, Allocator>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 27.8.3, class template basic_istringstream:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    class basic_istringstream: public basic_istream<Char, Traits>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using allocator_type = Allocator;
-            using int_type       = typename traits_type::int_type;
-            using pos_type       = typename traits_type::pos_type;
-            using off_type       = typename traits_type::off_type;
-
-            /**
-             * 27.8.3.1, constructors:
-             */
-
-            explicit basic_istringstream(ios_base::openmode mode = ios_base::in)
-                : basic_istream<char_type, traits_type>(&sb_),
-                  sb_(mode | ios_base::in)
-            { /* DUMMY BODY */ }
-
-            explicit basic_istringstream(const basic_string<char_type, traits_type, allocator_type> str,
-                                         ios_base::openmode mode = ios_base::in)
-                : basic_istream<char_type, traits_type>{&sb_},
-                  sb_(str, mode | ios_base::in)
-            { /* DUMMY BODY */ }
-
-            basic_istringstream(const basic_istringstream&) = delete;
-
-            basic_istringstream(basic_istringstream&& other)
-                : basic_istream<char_type, traits_type>{move(other)},
-                  sb_{move(other.sb_)}
-            {
-                basic_istream<char_type, traits_type>::set_rdbuf(&sb_);
-            }
-
-            /**
-             * 27.8.3.2, assign and swap:
-             */
-
-            basic_istringstream& operator=(const basic_istringstream&) = delete;
-
-            basic_istringstream& operator=(basic_istringstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_istringstream& rhs)
-            {
-                basic_istream<char_type, traits_type>::swap(rhs);
-                sb_.swap(rhs.sb_);
-            }
-
-            /**
-             * 27.8.3.3, members:
-             */
-
-            basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const
-            {
-                return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&sb_);
-            }
-
-            basic_string<char_type, traits_type, allocator_type> str() const
-            {
-                return sb_.str();
-            }
-
-            void str(const basic_string<char_type, traits_type, allocator_type>& str)
-            {
-                sb_.str(str);
-            }
-
-        private:
-            basic_stringbuf<char_type, traits_type, allocator_type> sb_;
-    };
-
-    template<class Char, class Traits, class Allocator>
-    void swap(basic_istringstream<Char, Traits, Allocator>& lhs,
-              basic_istringstream<Char, Traits, Allocator>& rhs)
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class Char, class Traits, class Allocator>
-    class basic_ostringstream: public basic_ostream<Char, Traits>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using allocator_type = Allocator;
-            using int_type       = typename traits_type::int_type;
-            using pos_type       = typename traits_type::pos_type;
-            using off_type       = typename traits_type::off_type;
-
-            /**
-             * 27.8.4.1, constructors:
-             */
-
-            explicit basic_ostringstream(ios_base::openmode mode = ios_base::out)
-                : basic_ostream<char_type, traits_type>(&sb_),
-                  sb_(mode | ios_base::out)
-            { /* DUMMY BODY */ }
-
-            explicit basic_ostringstream(const basic_string<char_type, traits_type, allocator_type> str,
-                                         ios_base::openmode mode = ios_base::out)
-                : basic_ostream<char_type, traits_type>{&sb_},
-                  sb_(str, mode | ios_base::out)
-            { /* DUMMY BODY */ }
-
-            basic_ostringstream(const basic_ostringstream&) = delete;
-
-            basic_ostringstream(basic_ostringstream&& other)
-                : basic_ostream<char_type, traits_type>{move(other)},
-                  sb_{move(other.sb_)}
-            {
-                basic_ostream<char_type, traits_type>::set_rdbuf(&sb_);
-            }
-
-            /**
-             * 27.8.4.2, assign and swap:
-             */
-
-            basic_ostringstream& operator=(const basic_ostringstream&) = delete;
-
-            basic_ostringstream& operator=(basic_ostringstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_ostringstream& rhs)
-            {
-                basic_ostream<char_type, traits_type>::swap(rhs);
-                sb_.swap(rhs.sb_);
-            }
-
-            /**
-             * 27.8.3.3, members:
-             */
-
-            basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const
-            {
-                return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&sb_);
-            }
-
-            basic_string<char_type, traits_type, allocator_type> str() const
-            {
-                return sb_.str();
-            }
-
-            void str(const basic_string<char_type, traits_type, allocator_type>& str)
-            {
-                sb_.str(str);
-            }
-
-        private:
-            basic_stringbuf<char_type, traits_type, allocator_type> sb_;
-    };
-
-    /**
-     * 27.8.5, class template basic_stringstream:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    class basic_stringstream: public basic_iostream<Char, Traits>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using allocator_type = Allocator;
-            using int_type       = typename traits_type::int_type;
-            using pos_type       = typename traits_type::pos_type;
-            using off_type       = typename traits_type::off_type;
-
-            /**
-             * 27.8.5.1, constructors:
-             */
-
-            explicit basic_stringstream(ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_iostream<char_type, traits_type>(&sb_),
-                  sb_(mode | ios_base::out)
-            { /* DUMMY BODY */ }
-
-            explicit basic_stringstream(const basic_string<char_type, traits_type, allocator_type> str,
-                                         ios_base::openmode mode = ios_base::in | ios_base::out)
-                : basic_iostream<char_type, traits_type>{&sb_},
-                  sb_(str, mode | ios_base::out)
-            { /* DUMMY BODY */ }
-
-            basic_stringstream(const basic_stringstream&) = delete;
-
-            basic_stringstream(basic_stringstream&& other)
-                : basic_iostream<char_type, traits_type>{move(other)},
-                  sb_{move(other.sb_)}
-            {
-                basic_iostream<char_type, traits_type>::set_rdbuf(&sb_);
-            }
-
-            /**
-             * 27.8.5.2, assign and swap:
-             */
-
-            basic_stringstream& operator=(const basic_stringstream&) = delete;
-
-            basic_stringstream& operator=(basic_stringstream&& other)
-            {
-                swap(other);
-            }
-
-            void swap(basic_stringstream& rhs)
-            {
-                basic_iostream<char_type, traits_type>::swap(rhs);
-                sb_.swap(rhs.sb_);
-            }
-
-            /**
-             * 27.8.5.3, members:
-             */
-
-            basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const
-            {
-                return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&sb_);
-            }
-
-            basic_string<char_type, traits_type, allocator_type> str() const
-            {
-                return sb_.str();
-            }
-
-            void str(const basic_string<char_type, traits_type, allocator_type>& str)
-            {
-                sb_.str(str);
-            }
-
-        private:
-            basic_stringbuf<char_type, traits_type, allocator_type> sb_;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/streambuf.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/streambuf.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,431 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_STREAMBUF
-#define LIBCPP_BITS_IO_STREAMBUF
-
-#include <ios>
-#include <iosfwd>
-#include <locale>
-
-namespace std
-{
-
-    /**
-     * 27.6.3, class template basic_streambuf:
-     */
-
-    template<class Char, class Traits>
-    class basic_streambuf
-    {
-        public:
-            using traits_type = Traits;
-            using char_type   = Char;
-            using int_type    = typename traits_type::int_type;
-            using pos_type    = typename traits_type::pos_type;
-            using off_type    = typename traits_type::off_type;
-
-            virtual ~basic_streambuf()
-            { /* DUMMY BODY */ }
-
-            /**
-             * 27.6.3.2.1, locales:
-             */
-
-            locale pubimbue(const locale& loc)
-            {
-                imbue(loc);
-
-                return locale_;
-            }
-
-            locale getloc() const
-            {
-                return locale_;
-            }
-
-            /**
-             * 27.6.3.2.2, buffer and positioning:
-             */
-
-            basic_streambuf<Char, Traits>* pubsetbuf(char_type* s, streamsize n)
-            {
-                return setbuf(s, n);
-            }
-
-            pos_type pubseekoff(off_type off, ios_base::seekdir way,
-                                ios_base::openmode which = ios_base::in | ios_base::out)
-            {
-                return seekoff(off, way, which);
-            }
-
-            pos_type pubseekpos(pos_type pos, ios_base::openmode which =
-                                ios_base::in | ios_base::out)
-            {
-                return seekpos(pos, which);
-            }
-
-            int pubsync()
-            {
-                return sync();
-            }
-
-            /**
-             * 27.6.3.2.3, get area:
-             */
-
-            streamsize in_avail()
-            {
-                if (read_avail_())
-                    return egptr() - gptr();
-                else
-                    return showmanyc();
-            }
-
-            int_type snextc()
-            {
-                if (traits_type::eq(sbumpc(), traits_type::eof()))
-                    return traits_type::eof();
-                else
-                    return sgetc();
-            }
-
-            int_type sbumpc()
-            {
-                if (read_avail_())
-                    return traits_type::to_int_type(*input_next_++);
-                else
-                    return uflow();
-            }
-
-            int_type sgetc()
-            {
-                if (read_avail_())
-                    return traits_type::to_int_type(*input_next_);
-                else
-                    return underflow();
-            }
-
-            streamsize sgetn(char_type* s, streamsize n)
-            {
-                return xsgetn(s, n);
-            }
-
-            /**
-             * 27.6.2.4, putback:
-             */
-
-            int_type sputbackc(char_type c)
-            {
-                if (!putback_avail_() || traits_type::eq(c, gptr()[-1]))
-                    return pbackfail(traits_type::to_int_type(c));
-                else
-                    return traits_type::to_int_type(*(--input_next_));
-            }
-
-            int_type sungetc()
-            {
-                if (!putback_avail_())
-                    return pbackfail();
-                else
-                    return traits_type::to_int_type(*(--input_next_));
-            }
-
-            /**
-             * 27.6.2.5, put area:
-             */
-
-            int_type sputc(char_type c)
-            {
-                if (!write_avail_())
-                    return overflow(traits_type::to_int_type(c));
-                else
-                {
-                    traits_type::assign(*output_next_++, c);
-
-                    return traits_type::to_int_type(c);
-                }
-            }
-
-            streamsize sputn(const char_type* s, streamsize n)
-            {
-                return xsputn(s, n);
-            }
-
-        protected:
-            basic_streambuf()
-                : input_begin_{}, input_next_{}, input_end_{},
-                  output_begin_{}, output_next_{}, output_end_{},
-                  locale_{locale()}
-            { /* DUMMY BODY */ }
-
-            basic_streambuf(const basic_streambuf& rhs)
-            {
-                input_begin_ = rhs.input_begin_;
-                input_next_ = rhs.input_next_;
-                input_end_ = rhs.input_end_;
-
-                output_begin_ = rhs.output_begin_;
-                output_next_ = rhs.output_next_;
-                output_end_ = rhs.output_end_;
-
-                locale_ = rhs.locale_;
-            }
-
-            basic_streambuf& operator=(const basic_streambuf& rhs)
-            {
-                input_begin_ = rhs.input_begin_;
-                input_next_  = rhs.input_next_;
-                input_end_   = rhs.input_end_;
-
-                output_begin_ = rhs.output_begin_;
-                output_next_  = rhs.output_next_;
-                output_end_   = rhs.output_end_;
-
-                locale_ = rhs.locale_;
-
-                return *this;
-            }
-
-            void swap(basic_streambuf& rhs)
-            {
-                swap(input_begin_, rhs.input_begin_);
-                swap(input_next_, rhs.input_next_);
-                swap(input_end_, rhs.input_end_);
-
-                swap(output_begin_, rhs.output_begin_);
-                swap(output_next_, rhs.output_next_);
-                swap(output_end_, rhs.output_end_);
-
-                swap(locale_, rhs.locale_);
-            }
-
-            /**
-             * 27.6.3.3.2, get area:
-             */
-
-            char_type* eback() const
-            {
-                return input_begin_;
-            }
-
-            char_type* gptr() const
-            {
-                return input_next_;
-            }
-
-            char_type* egptr() const
-            {
-                return input_end_;
-            }
-
-            void gbump(int n)
-            {
-                input_next_ += n;
-            }
-
-            void setg(char_type* gbeg, char_type* gnext, char_type* gend)
-            {
-                input_begin_ = gbeg;
-                input_next_  = gnext;
-                input_end_   = gend;
-            }
-
-            /**
-             * 27.6.3.3.3, put area:
-             */
-
-            char_type* pbase() const
-            {
-                return output_begin_;
-            }
-
-            char_type* pptr() const
-            {
-                return output_next_;
-            }
-
-            char_type* epptr() const
-            {
-                return output_end_;
-            }
-
-            void pbump(int n)
-            {
-                output_next_ += n;
-            }
-
-            void setp(char_type* pbeg, char_type* pend)
-            {
-                output_begin_ = pbeg;
-                output_next_  = pbeg;
-                output_end_   = pend;
-            }
-
-            /**
-             * 27.6.3.4.1, locales:
-             */
-
-            virtual void imbue(const locale& loc)
-            { /* DUMMY BODY */ }
-
-            /**
-             * 27.6.3.4.2, buffer management and positioning:
-             */
-
-            virtual basic_streambuf<Char, Traits>*
-            setbuf(char_type* s, streamsize n)
-            {
-                return this;
-            }
-
-            virtual pos_type seekoff(off_type off, ios_base::seekdir way,
-                                     ios_base::openmode which = ios_base::in | ios_base::out)
-            {
-                return pos_type(off_type(-1));
-            }
-
-            virtual pos_type seekpos(pos_type pos, ios_base::openmode which =
-                                     ios_base::in | ios_base::out)
-            {
-                return pos_type(off_type(-1));
-            }
-
-            virtual int sync()
-            {
-                return 0;
-            }
-
-            /**
-             * 27.6.3.4.3, get area:
-             */
-
-            virtual streamsize showmanyc()
-            {
-                return 0;
-            }
-
-            virtual streamsize xsgetn(char_type* s, streamsize n)
-            {
-                if (!s || n == 0)
-                    return 0;
-
-                streamsize i{0};
-                auto eof = traits_type::eof();
-                for (; i <= n; ++i)
-                {
-                    if (!read_avail_() && traits_type::eq_int_type(uflow(), eof))
-                        break;
-
-                    *s++ = *input_next_++;
-                }
-
-                return i;
-            }
-
-            virtual int_type underflow()
-            {
-                return traits_type::eof();
-            }
-
-            virtual int_type uflow()
-            {
-                auto res = underflow();
-                if (traits_type::eq_int_type(res, traits_type::eof()))
-                    return traits_type::eof();
-                else
-                    return traits_type::to_int_type(*input_next_++);
-            }
-
-            /**
-             * 27.6.3.4.4, putback:
-             */
-
-            virtual int_type pbackfail(int_type c = traits_type::eof())
-            {
-                return traits_type::eof();
-            }
-
-            /**
-             * 27.6.3.4.5, put area:
-             */
-
-            virtual streamsize xsputn(const char_type* s, streamsize n)
-            {
-                if (!s || n == 0)
-                    return 0;
-
-                streamsize i{0};
-                for (; i <= n; ++i)
-                {
-                    if (!write_avail_() && traits_type::eq_int_type(overflow(), traits_type::eof()))
-                        break;
-
-                    *output_next_++ = *s++;
-                }
-
-                return i;
-            }
-
-            virtual int_type overflow(int_type c = traits_type::eof())
-            {
-                return traits_type::eof();
-            }
-
-        protected:
-            char_type* input_begin_;
-            char_type* input_next_;
-            char_type* input_end_;
-
-            char_type* output_begin_;
-            char_type* output_next_;
-            char_type* output_end_;
-
-            locale locale_;
-
-            bool write_avail_() const
-            {
-                return output_next_ && output_next_ < output_end_;
-            }
-
-            bool putback_avail_() const
-            {
-                return input_next_ && input_begin_ < input_next_;
-            }
-
-            bool read_avail_() const
-            {
-                return input_next_ && input_next_ < input_end_;
-            }
-    };
-
-    using streambuf  = basic_streambuf<char>;
-    using wstreambuf = basic_streambuf<wchar_t>;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/io/streambufs.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/io/streambufs.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_IO_STREAMBUFS
-#define LIBCPP_BITS_IO_STREAMBUFS
-
-#include <iosfwd>
-#include <cstdio>
-#include <streambuf>
-
-namespace std::aux
-{
-    template<class Char, class Traits = char_traits<Char>>
-    class stdin_streambuf : public basic_streambuf<Char, Traits>
-    {
-        public:
-            stdin_streambuf()
-                : basic_streambuf<Char, Traits>{}, buffer_{nullptr}
-            { /* DUMMY BODY */ }
-
-            virtual ~stdin_streambuf()
-            {
-                if (buffer_)
-                    delete[] buffer_;
-            }
-
-        protected:
-            using traits_type = Traits;
-            using char_type   = typename traits_type::char_type;
-            using int_type    = typename traits_type::int_type;
-            using off_type    = typename traits_type::off_type;
-
-            using basic_streambuf<Char, Traits>::input_begin_;
-            using basic_streambuf<Char, Traits>::input_next_;
-            using basic_streambuf<Char, Traits>::input_end_;
-
-            int_type underflow() override
-            {
-                if (!this->gptr())
-                {
-                    buffer_ = new char_type[buf_size_];
-                    input_begin_ = input_next_ = input_end_ = buffer_;
-                }
-
-                off_type i{};
-                if (input_next_ < input_end_)
-                {
-                    auto idx = static_cast<off_type>(input_next_ - input_begin_);
-                    auto count = buf_size_ - idx;
-
-                    for (; i < count; ++i, ++idx)
-                        buffer_[i] = buffer_[idx];
-                }
-
-                for (; i < buf_size_; ++i)
-                {
-                    auto c = fgetc(in_);
-                    putchar(c); // TODO: Temporary source of feedback.
-                    if (c == traits_type::eof())
-                        break;
-
-                    buffer_[i] = static_cast<char_type>(c);
-
-                    if (buffer_[i] == '\n')
-                    {
-                        ++i;
-                        break;
-                    }
-                }
-
-                input_next_ = input_begin_;
-                input_end_ = input_begin_ + i;
-
-                if (i == 0)
-                    return traits_type::eof();
-
-                return traits_type::to_int_type(*input_next_);
-            }
-
-            int_type uflow() override
-            {
-                auto res = underflow();
-                ++input_next_;
-
-                return res;
-            }
-
-            void imbue(const locale& loc)
-            {
-                this->locale_ = loc;
-            }
-
-        private:
-            FILE* in_{stdin};
-
-            char_type* buffer_;
-
-            static constexpr off_type buf_size_{128};
-    };
-
-    template<class Char, class Traits = char_traits<Char>>
-    class stdout_streambuf: public basic_streambuf<Char, Traits>
-    {
-        public:
-            stdout_streambuf()
-                : basic_streambuf<Char, Traits>{}
-            { /* DUMMY BODY */ }
-
-            virtual ~stdout_streambuf()
-            { /* DUMMY BODY */ }
-
-        protected:
-            using traits_type = Traits;
-            using char_type   = typename traits_type::char_type;
-            using int_type    = typename traits_type::int_type;
-            using off_type    = typename traits_type::off_type;
-
-            int_type overflow(int_type c = traits_type::eof()) override
-            {
-                if (!traits_type::eq_int_type(c, traits_type::eof()))
-                {
-                    auto cc = traits_type::to_char_type(c);
-                    fwrite(&cc, sizeof(char_type), 1, out_);
-                }
-
-                return traits_type::not_eof(c);
-            }
-
-            streamsize xsputn(const char_type* s, streamsize n) override
-            {
-                return fwrite(s, sizeof(char_type), n, out_);
-            }
-
-            int sync() override
-            {
-                if (fflush(out_))
-                    return -1;
-                return 0;
-            }
-
-        private:
-            FILE* out_{stdout};
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/iterator.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/iterator.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1194 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ITERATOR
-#define LIBCPP_BITS_ITERATOR
-
-#include <__bits/memory/addressof.hpp>
-#include <cstdlib>
-#include <initializer_list>
-#include <iosfwd>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 24.4.3, standard iterator tags:
-     */
-
-    struct input_iterator_tag
-    { /* DUMMY BODY */ };
-
-    struct output_iterator_tag
-    { /* DUMMY BODY */ };
-
-    struct forward_iterator_tag: input_iterator_tag
-    { /* DUMMY BODY */ };
-
-    struct bidirectional_iterator_tag: forward_iterator_tag
-    { /* DUMMY BODY */ };
-
-    struct random_access_iterator_tag: bidirectional_iterator_tag
-    { /* DUMMY BODY */ };
-
-    /**
-     * 24.4.1, iterator traits:
-     */
-
-    template<class Iterator>
-    struct iterator_traits
-    {
-        using difference_type   = typename Iterator::difference_type;
-        using value_type        = typename Iterator::value_type;
-        using iterator_category = typename Iterator::iterator_category;
-        using reference         = typename Iterator::reference;
-        using pointer           = typename Iterator::pointer;
-    };
-
-    template<class T>
-    struct iterator_traits<T*>
-    {
-        using difference_type   = ptrdiff_t;
-        using value_type        = T;
-        using iterator_category = random_access_iterator_tag;
-        using reference         = T&;
-        using pointer           = T*;
-    };
-
-    template<class T>
-    struct iterator_traits<const T*>
-    {
-        using difference_type   = ptrdiff_t;
-        using value_type        = T;
-        using iterator_category = random_access_iterator_tag;
-        using reference         = const T&;
-        using pointer           = const T*;
-    };
-
-    /**
-     * 24.4.2, basic iterator:
-     */
-
-    template<
-        class Category, class T, class Distance = ptrdiff_t,
-        class Pointer = T*, class Reference = T&
-    >
-    struct iterator
-    {
-        using difference_type   = Distance;
-        using value_type        = T;
-        using iterator_category = Category;
-        using reference         = Reference;
-        using pointer           = Pointer;
-    };
-
-    /**
-     * 24.4.4, iterator operations
-     */
-
-    template<class InputIterator, class Distance>
-    void advance(InputIterator& it, Distance n)
-    {
-        for (Distance i = Distance{}; i < n; ++i)
-            ++it;
-    }
-
-    template<class InputIterator>
-    typename iterator_traits<InputIterator>::difference_type
-    distance(InputIterator first, InputIterator last)
-    {
-        using cat_t = typename iterator_traits<InputIterator>::iterator_category;
-        using diff_t = typename iterator_traits<InputIterator>::difference_type;
-
-        if constexpr (is_same_v<cat_t, random_access_iterator_tag>)
-            return last - first;
-        else
-        {
-            diff_t diff{};
-            while (first != last)
-            {
-                ++diff;
-                ++first;
-            }
-
-            return diff;
-        }
-    }
-
-    template<class ForwardIterator>
-    ForwardIterator
-    next(ForwardIterator it, typename iterator_traits<ForwardIterator>::difference_type n = 1)
-    {
-        advance(it, n);
-
-        return it;
-    }
-
-    template<class BidirectionalIterator>
-    BidirectionalIterator
-    prev(BidirectionalIterator it,
-         typename iterator_traits<BidirectionalIterator>::difference_type n = 1)
-    {
-        advance(it, -n);
-
-        return it;
-    }
-
-    /**
-     * 24.5.1, reverse iterator:
-     */
-
-    template<class Iterator>
-    class reverse_iterator
-        : public iterator<
-            typename iterator_traits<Iterator>::iterator_category,
-            typename iterator_traits<Iterator>::value_type,
-            typename iterator_traits<Iterator>::difference_type,
-            typename iterator_traits<Iterator>::pointer,
-            typename iterator_traits<Iterator>::reference
-          >
-    {
-        public:
-            using iterator_type   = Iterator;
-            using difference_type = typename iterator_traits<Iterator>::difference_type;
-            using reference       = typename iterator_traits<Iterator>::reference;
-            using pointer         = typename iterator_traits<Iterator>::pointer;
-
-            reverse_iterator()
-                : current_{}
-            { /* DUMMY BODY */ }
-
-            explicit reverse_iterator(Iterator it)
-                : current_{it}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            reverse_iterator(const reverse_iterator<U>& other)
-                : current_{other.current_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            reverse_iterator& operator=(const reverse_iterator<U>& other)
-            {
-                current_ = other.base();
-
-                return *this;
-            }
-
-            Iterator base() const
-            {
-                return current_;
-            }
-
-            reference operator*() const
-            {
-                auto tmp = current_;
-
-                return *(--tmp);
-            }
-
-            pointer operator->() const
-            {
-                return addressof(operator*());
-            }
-
-            reverse_iterator& operator++()
-            {
-                --current_;
-
-                return *this;
-            }
-
-            reverse_iterator operator++(int)
-            {
-                auto tmp = *this;
-                --current_;
-
-                return tmp;
-            }
-
-            reverse_iterator& operator--()
-            {
-                ++current_;
-
-                return *this;
-            }
-
-            reverse_iterator operator--(int)
-            {
-                auto tmp = *this;
-                ++current_;
-
-                return tmp;
-            }
-
-            reverse_iterator operator+(difference_type n) const
-            {
-                return reverse_iterator{current_ - n};
-            }
-
-            reverse_iterator& operator+=(difference_type n)
-            {
-                current_ -= n;
-
-                return *this;
-            }
-
-            reverse_iterator operator-(difference_type n) const
-            {
-                return reverse_iterator{current_ + n};
-            }
-
-            reverse_iterator& operator-=(difference_type n)
-            {
-                current_ += n;
-
-                return *this;
-            }
-
-            auto operator[](difference_type n) const
-            {
-                return current_[-n - 1];
-            }
-
-        protected:
-            Iterator current_;
-    };
-
-    template<class Iterator1, class Iterator2>
-    bool operator==(const reverse_iterator<Iterator1>& lhs,
-                    const reverse_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() == rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator<(const reverse_iterator<Iterator1>& lhs,
-                   const reverse_iterator<Iterator2>& rhs)
-    {
-        // Remember: they are reversed!
-        return lhs.base() > rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator!=(const reverse_iterator<Iterator1>& lhs,
-                    const reverse_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() != rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator>(const reverse_iterator<Iterator1>& lhs,
-                   const reverse_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() < rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator>=(const reverse_iterator<Iterator1>& lhs,
-                    const reverse_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() <= rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator<=(const reverse_iterator<Iterator1>& lhs,
-                    const reverse_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() >= rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    auto operator-(const reverse_iterator<Iterator1>& lhs,
-                   const reverse_iterator<Iterator2>& rhs)
-        -> decltype(rhs.base() - lhs.base())
-    {
-        return rhs.base() - lhs.base();
-    }
-
-    template<class Iterator>
-    reverse_iterator<Iterator> operator+(
-        typename reverse_iterator<Iterator>::difference_type n,
-        const reverse_iterator<Iterator>& it
-    )
-    {
-        return reverse_iterator<Iterator>{it.base() - n};
-    }
-
-    template<class Iterator>
-    reverse_iterator<Iterator> make_reverse_iterator(Iterator it)
-    {
-        return reverse_iterator<Iterator>(it);
-    }
-
-    /**
-     * 24.5.2, insert iterators:
-     */
-
-    /**
-     * 24.5.2.1, back insert iterator:
-     */
-
-    template<class Container>
-    class back_insert_iterator
-        : public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            using container_type = Container;
-
-            explicit back_insert_iterator(Container& cont)
-                : container{std::addressof(cont)}
-            { /* DUMMY BODY */ }
-
-            back_insert_iterator& operator=(const typename container_type::value_type& value)
-            {
-                container->push_back(value);
-                return *this;
-            }
-
-            back_insert_iterator& operator=(typename container_type::value_type&& value)
-            {
-                container->push_back(move(value));
-                return *this;
-            }
-
-            back_insert_iterator& operator*()
-            {
-                return *this;
-            }
-
-            back_insert_iterator& operator++()
-            {
-                return *this;
-            }
-
-            back_insert_iterator operator++(int)
-            {
-                return *this;
-            }
-
-        protected:
-            Container* container;
-    };
-
-    template<class Container>
-    back_insert_iterator<Container> back_inserter(Container& cont)
-    {
-        return back_insert_iterator<Container>(cont);
-    }
-
-    /**
-     * 24.5.2.3, front insert iterator:
-     */
-
-    template<class Container>
-    class front_insert_iterator
-        : public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            using container_type = Container;
-
-            explicit front_insert_iterator(Container& cont)
-                : container{std::addressof(cont)}
-            { /* DUMMY BODY */ }
-
-            front_insert_iterator& operator=(const typename container_type::value_type& value)
-            {
-                container->push_front(value);
-                return *this;
-            }
-
-            front_insert_iterator& operator=(typename container_type::value_type&& value)
-            {
-                container->push_front(move(value));
-                return *this;
-            }
-
-            front_insert_iterator& operator*()
-            {
-                return *this;
-            }
-
-            front_insert_iterator& operator++()
-            {
-                return *this;
-            }
-
-            front_insert_iterator operator++(int)
-            {
-                return *this;
-            }
-
-        protected:
-            Container* container;
-    };
-
-    template<class Container>
-    front_insert_iterator<Container> front_inserter(Container& cont)
-    {
-        return front_insert_iterator<Container>(cont);
-    }
-
-    /**
-     * 24.5.2.5, front insert iterator:
-     */
-
-    template<class Container>
-    class insert_iterator
-        : public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            using container_type = Container;
-
-            explicit insert_iterator(Container& cont, typename Container::iterator i)
-                : container{std::addressof(cont)}, iter{i}
-            { /* DUMMY BODY */ }
-
-            insert_iterator& operator=(const typename container_type::value_type& value)
-            {
-                iter = container.insert(iter, value);
-                ++iter;
-
-                return *this;
-            }
-
-            insert_iterator& operator=(typename container_type::value_type&& value)
-            {
-                iter = container.insert(iter, move(value));
-                ++iter;
-
-                return *this;
-            }
-
-            insert_iterator& operator*()
-            {
-                return *this;
-            }
-
-            insert_iterator& operator++()
-            {
-                return *this;
-            }
-
-            insert_iterator operator++(int)
-            {
-                return *this;
-            }
-
-        protected:
-            Container* container;
-            typename Container::iterator iter;
-    };
-
-    template<class Container>
-    insert_iterator<Container> inserter(Container& cont, typename Container::iterator i)
-    {
-        return insert_iterator<Container>(cont, i);
-    }
-
-    /**
-     * 24.5.3.1, move iterator:
-     */
-
-    namespace aux
-    {
-        template<class Iterator, class = void>
-        struct move_it_get_reference
-        {
-            using type = typename iterator_traits<Iterator>::reference;
-        };
-
-        template<class Iterator>
-        struct move_it_get_reference<
-            Iterator, enable_if_t<
-                is_reference<typename iterator_traits<Iterator>::reference>::value,
-                void
-            >
-        >
-        {
-            using type = remove_reference_t<typename iterator_traits<Iterator>::reference>&&;
-        };
-    }
-
-    template<class Iterator>
-    class move_iterator
-    {
-        public:
-            using iterator_type     = Iterator;
-            using pointer           = iterator_type;
-            using difference_type   = typename iterator_traits<iterator_type>::difference_type;
-            using value_type        = typename iterator_traits<iterator_type>::value_type;
-            using iterator_category = typename iterator_traits<iterator_type>::iterator_category;
-            using reference         = typename aux::move_it_get_reference<iterator_type>::type;
-
-            move_iterator()
-                : current_{}
-            { /* DUMMY BODY */ }
-
-            explicit move_iterator(iterator_type i)
-                : current_{i}
-            { /* DUMMY BODY */ }
-
-            // TODO: both require is_convertible
-            template<class U>
-            move_iterator(const move_iterator<U>& other)
-                : current_{other.current_}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            move_iterator& operator=(const move_iterator<U>& other)
-            {
-                current_ = other.current_;
-
-                return *this;
-            }
-
-            iterator_type base() const
-            {
-                return current_;
-            }
-
-            reference operator*() const
-            {
-                return static_cast<reference>(*current_);
-            }
-
-            pointer operator->() const
-            {
-                return current_;
-            }
-
-            move_iterator& operator++()
-            {
-                ++current_;
-
-                return *this;
-            }
-
-            move_iterator operator++(int)
-            {
-                auto tmp = *this;
-                ++current_;
-
-                return tmp;
-            }
-
-            move_iterator& operator--()
-            {
-                --current_;
-
-                return *this;
-            }
-
-            move_iterator operator--(int)
-            {
-                auto tmp = *this;
-                --current_;
-
-                return tmp;
-            }
-
-            move_iterator operator+(difference_type n) const
-            {
-                return move_iterator(current_ + n);
-            }
-
-            move_iterator& operator+=(difference_type n)
-            {
-                current_ += n;
-
-                return *this;
-            }
-
-            move_iterator operator-(difference_type n) const
-            {
-                return move_iterator(current_ - n);
-            }
-
-            move_iterator& operator-=(difference_type n)
-            {
-                current_ -= n;
-
-                return *this;
-            }
-
-            auto operator[](difference_type idx) const
-            {
-                return move(current_[idx]);
-            }
-
-        private:
-            iterator_type current_;
-    };
-
-    template<class Iterator1, class Iterator2>
-    bool operator==(const move_iterator<Iterator1>& lhs,
-                    const move_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() == rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator!=(const move_iterator<Iterator1>& lhs,
-                    const move_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() != rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator<(const move_iterator<Iterator1>& lhs,
-                   const move_iterator<Iterator2>& rhs)
-    {
-        return lhs.base() < rhs.base();
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator<=(const move_iterator<Iterator1>& lhs,
-                    const move_iterator<Iterator2>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator>(const move_iterator<Iterator1>& lhs,
-                   const move_iterator<Iterator2>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class Iterator1, class Iterator2>
-    bool operator>=(const move_iterator<Iterator1>& lhs,
-                    const move_iterator<Iterator2>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class Iterator1, class Iterator2>
-    auto operator-(const move_iterator<Iterator1>& lhs,
-                   const move_iterator<Iterator2>& rhs)
-        -> decltype(rhs.base() - lhs.base())
-    {
-        return lhs.base() - rhs.base();
-    }
-
-    template<class Iterator>
-    move_iterator<Iterator> operator+(
-        typename move_iterator<Iterator>::difference_type n,
-        const move_iterator<Iterator>& it
-    )
-    {
-        return it + n;
-    }
-
-    template<class Iterator>
-    move_iterator<Iterator> make_move_iterator(Iterator it)
-    {
-        return move_iterator<Iterator>(it);
-    }
-
-    /**
-     * 24.6, stream iterators:
-     */
-
-    /**
-     * 24.6.1, class template istream_iterator:
-     */
-
-    template<class T, class Char = char, class Traits = char_traits<Char>,
-             class Distance = ptrdiff_t>
-    class istream_iterator
-        : public iterator<input_iterator_tag, T, Distance, const T*, const T&>
-    {
-        public:
-            using char_type    = Char;
-            using traits_type  = Traits;
-            using istream_type = basic_istream<char_type, traits_type>;
-
-            // TODO: if T is literal, this should be constexpr
-            istream_iterator()
-                : is_{nullptr}, value_{}
-            { /* DUMMY BODY */ }
-
-            istream_iterator(istream_type& is)
-                : is_{&is}, value_{}
-            { /* DUMMY BODY */ }
-
-            istream_iterator(const istream_iterator&) = default;
-
-            ~istream_iterator() = default;
-
-            const T& operator*() const
-            {
-                return value_;
-            }
-
-            const T* operator->() const
-            {
-                return &(operator*());
-            }
-
-            istream_iterator& operator++()
-            {
-                if (is_)
-                    (*is_) >> value_;
-
-                return *this;
-            }
-
-            istream_iterator operator++(int)
-            {
-                auto tmp{*this};
-
-                if (is_)
-                    (*is_) >> value_;
-
-                return tmp;
-            }
-
-        private:
-            basic_istream<char_type, traits_type>* is_;
-
-            T value_;
-
-            friend bool operator==<>(const istream_iterator&,
-                                     const istream_iterator&);
-
-            friend bool operator!=<>(const istream_iterator&,
-                                     const istream_iterator&);
-    };
-
-    template<class T, class Char, class Traits, class Distance>
-    bool operator==(const istream_iterator<T, Char, Traits, Distance>& lhs,
-                    const istream_iterator<T, Char, Traits, Distance>& rhs)
-    {
-        return lhs.is_ == rhs.is_;
-    }
-
-    template<class T, class Char, class Traits, class Distance>
-    bool operator!=(const istream_iterator<T, Char, Traits, Distance>& lhs,
-                    const istream_iterator<T, Char, Traits, Distance>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    /**
-     * 24.6.2, class template ostream_iterator:
-     */
-
-    template<class T, class Char = char, class Traits = char_traits<Char>>
-    class ostream_iterator
-        : public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            using char_type    = Char;
-            using traits_type  = Traits;
-            using ostream_type = basic_ostream<char_type, traits_type>;
-
-            ostream_iterator(ostream_type& os)
-                : os_{&os}, delim_{nullptr}
-            { /* DUMMY BODY */ }
-
-            ostream_iterator(ostream_type& os, const char_type* delim)
-                : os_{&os}, delim_{delim}
-            { /* DUMMY BODY */ }
-
-            ostream_iterator(const ostream_iterator&) = default;
-
-            ~ostream_iterator() = default;
-
-            ostream_iterator& operator=(const T& value)
-            {
-                os_ << value;
-                if (delim_)
-                    os_ << delim_;
-
-                return *this;
-            }
-
-            ostream_iterator& operator*() const
-            {
-                return *this;
-            }
-
-            ostream_iterator& operator++()
-            {
-                return *this;
-            }
-
-            ostream_iterator& operator++(int)
-            {
-                return *this;
-            }
-
-        private:
-            basic_ostream<char_type, traits_type>* os_;
-
-            const char_type* delim_;
-    };
-
-    /**
-     * 24.6.3, class template istreambuf_iterator:
-     */
-
-    template<class Char, class Traits>
-    class istreambuf_iterator
-        : public iterator<input_iterator_tag, Char, typename Traits::off_type, Char*, Char>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using int_type       = typename traits_type::int_type;
-            using streambuf_type = basic_streambuf<char_type, traits_type>;
-            using istream_type   = basic_istream<char_type, traits_type>;
-
-            class proxy_type
-            {
-                public:
-                    proxy_type(int_type c, streambuf_type* sbuf)
-                        : char_{c}, sbuf_{sbuf}
-                    { /* DUMMY BODY */ }
-
-                    char_type operator*()
-                    {
-                        return traits_type::to_char_type(char_);
-                    }
-
-                private:
-                    int_type char_;
-
-                    streambuf_type* sbuf_;
-            };
-
-            constexpr istreambuf_iterator() noexcept
-                : sbuf_{nullptr}
-            { /* DUMMY BODY */ }
-
-            istreambuf_iterator(const istreambuf_iterator&) noexcept = default;
-
-            ~istreambuf_iterator() = default;
-
-            istreambuf_iterator(istream_type& is) noexcept
-                : sbuf_{is.rdbuf()}
-            { /* DUMMY BODY */ }
-
-            istreambuf_iterator(streambuf_type* sbuf) noexcept
-                : sbuf_{sbuf}
-            { /* DUMMY BODY */ }
-
-            istreambuf_iterator(const proxy_type& proxy) noexcept
-                : sbuf_{proxy.sbuf_}
-            { /* DUMMY BODY */ }
-
-            char_type operator*() /* const */ // TODO: Should be const :/
-            {
-                if (sbuf_)
-                {
-                    auto res = sbuf_->sgetc();
-                    if (res == traits_type::eof())
-                        sbuf_ = nullptr;
-
-                    return res;
-                }
-                else
-                    return traits_type::eof();
-            }
-
-            istreambuf_iterator& operator++()
-            {
-                if (sbuf_)
-                    sbuf_->sbumpc();
-
-                return *this;
-            }
-
-            proxy_type operator++(int)
-            {
-                if (sbuf_)
-                    return proxy_type{sbuf_->sbumpc(), sbuf_};
-                else
-                    return proxy_type{traits_type::eof(), nullptr};
-            }
-
-            bool equal(const istreambuf_iterator& rhs) const
-            {
-                if ((sbuf_ == nullptr && rhs.sbuf_ == nullptr) ||
-                    (sbuf_ != nullptr && rhs.sbuf_ != nullptr))
-                    return true;
-                else
-                    return false;
-            }
-
-        private:
-            streambuf_type* sbuf_;
-    };
-
-    template<class Char, class Traits>
-    bool operator==(const istreambuf_iterator<Char, Traits>& lhs,
-                    const istreambuf_iterator<Char, Traits>& rhs)
-    {
-        return lhs.equal(rhs);
-    }
-
-    template<class Char, class Traits>
-    bool operator!=(const istreambuf_iterator<Char, Traits>& lhs,
-                    const istreambuf_iterator<Char, Traits>& rhs)
-    {
-        return !lhs.equal(rhs);
-    }
-
-    /**
-     * 24.6.4, class template ostreambuf_iterator:
-     */
-
-    template<class Char, class Traits>
-    class ostreambuf_iterator
-        : public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            using char_type      = Char;
-            using traits_type    = Traits;
-            using streambuf_type = basic_streambuf<char_type, traits_type>;
-            using ostream_type   = basic_ostream<char_type, traits_type>;
-
-            ostreambuf_iterator(ostream_type& os) noexcept
-                : sbuf_{os.rdbuf()}
-            { /* DUMMY BODY */ }
-
-            ostreambuf_iterator(streambuf_type* sbuf) noexcept
-                : sbuf_{sbuf}
-            { /* DUMMY BODY */ }
-
-            ostreambuf_iterator& operator=(char_type c)
-            {
-                if (!failed() && sbuf_->sputc(c) == traits_type::eof())
-                    failed_ = true;
-
-                return *this;
-            }
-
-            ostreambuf_iterator& operator*()
-            {
-                return *this;
-            }
-
-            ostreambuf_iterator& operator++()
-            {
-                return *this;
-            }
-
-            ostreambuf_iterator& operator++(int)
-            {
-                return *this;
-            }
-
-            bool failed() const noexcept
-            {
-                return failed_;
-            }
-
-        private:
-            streambuf_type* sbuf_;
-
-            bool failed_{false};
-    };
-
-    /**
-     * 24.7, range access:
-     */
-
-    template<class Container>
-    auto begin(Container& c) -> decltype(c.begin())
-    {
-        return c.begin();
-    }
-
-    template<class Container>
-    auto begin(const Container& c) -> decltype(c.begin())
-    {
-        return c.begin();
-    }
-
-    template<class Container>
-    auto end(Container& c) -> decltype(c.end())
-    {
-        return c.end();
-    }
-
-    template<class Container>
-    auto end(const Container& c) -> decltype(c.end())
-    {
-        return c.end();
-    }
-
-    template<class T, size_t N>
-    constexpr T* begin(T (&array)[N]) noexcept
-    {
-        return array;
-    }
-
-    template<class T, size_t N>
-    constexpr T* end(T (&array)[N]) noexcept
-    {
-        return array + N;
-    }
-
-    template<class Container>
-    constexpr auto cbegin(const Container& c) noexcept(noexcept(std::begin(c)))
-        -> decltype(std::begin(c))
-    {
-        return std::begin(c);
-    }
-
-    template<class Container>
-    constexpr auto cend(const Container& c) noexcept(noexcept(std::end(c)))
-        -> decltype(std::end(c))
-    {
-        return std::end(c);
-    }
-
-    template<class Container>
-    auto rbegin(Container& c) -> decltype(c.rbegin())
-    {
-        return c.rbegin();
-    }
-
-    template<class Container>
-    auto rbegin(const Container& c) -> decltype(c.rbegin())
-    {
-        return c.rbegin();
-    }
-
-    template<class Container>
-    auto rend(Container& c) -> decltype(c.rend())
-    {
-        return c.rend();
-    }
-
-    template<class Container>
-    auto rend(const Container& c) -> decltype(c.rend())
-    {
-        return c.rend();
-    }
-
-    template<class T, size_t N>
-    reverse_iterator<T*> rbegin(T (&array)[N])
-    {
-        return reverse_iterator<T*>{array + N};
-    }
-
-    template<class T, size_t N>
-    reverse_iterator<T*> rend(T (&array)[N])
-    {
-        return reverse_iterator<T*>{array};
-    }
-
-    template<class T>
-    reverse_iterator<const T*> rbegin(initializer_list<T> init)
-    {
-        return reverse_iterator<const T*>{init.end()};
-    }
-
-    template<class T>
-    reverse_iterator<const T*> rend(initializer_list<T> init)
-    {
-        return reverse_iterator<const T*>{init.begin()};
-    }
-
-    template<class Container>
-    auto crbegin(const Container& c) -> decltype(std::rbegin(c))
-    {
-        return std::rbegin(c);
-    }
-
-    template<class Container>
-    auto crend(const Container& c) -> decltype(std::rend(c))
-    {
-        return std::rend(c);
-    }
-
-    /**
-     * 24.8, container access:
-     */
-
-    template<class Container>
-    constexpr auto size(const Container& c) -> decltype(c.size())
-    {
-        return c.size();
-    }
-
-    template<class T, size_t N>
-    constexpr size_t size(T (&array)[N]) noexcept
-    {
-        return N;
-    }
-
-    template<class Container>
-    constexpr auto empty(const Container& c) -> decltype(c.empty())
-    {
-        return c.empty();
-    }
-
-    template<class T, size_t N>
-    constexpr bool empty(T (&array)[N]) noexcept
-    {
-        return false;
-    }
-
-    template<class T>
-    constexpr bool empty(initializer_list<T> init) noexcept
-    {
-        return init.size() == 0;
-    }
-
-    template<class Container>
-    constexpr auto data(Container& c) -> decltype(c.data())
-    {
-        return c.data();
-    }
-
-    template<class Container>
-    constexpr auto data(const Container& c) -> decltype(c.data())
-    {
-        return c.data();
-    }
-
-    template<class T, size_t N>
-    constexpr T* data(T (&array)[N]) noexcept
-    {
-        return array;
-    }
-
-    template<class T>
-    constexpr const T* data(initializer_list<T> init) noexcept
-    {
-        return init.begin();
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/iterator_helpers.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/iterator_helpers.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_ITERATOR_HELPERS
-#define LIBCPP_BITS_ITERATOR_HELPERS
-
-#include <__bits/aux.hpp>
-
-namespace std::aux
-{
-    /**
-     * Used for our custom iterators where we know
-     * that their references/const_references and
-     * pointers/const_pointers differ only in constness.
-     */
-
-    template<class T>
-    struct get_non_const_ref
-        : type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct get_non_const_ref<const T&>
-        : type_is<T&>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using get_non_const_ref_t = typename get_non_const_ref<T>::type;
-
-    template<class T>
-    struct get_non_const_ptr
-        : type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct get_non_const_ptr<const T*>
-        : type_is<T*>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using get_non_const_ptr_t = typename get_non_const_ptr<T>::type;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/limits.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/limits.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,627 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LIMITS
-#define LIBCPP_BITS_LIMITS
-
-#include <cstdint>
-#include <climits>
-
-namespace std
-{
-
-    /**
-     * 18.3.2.5, type float_round_style:
-     */
-
-    enum float_round_style
-    {
-        round_indeterminate       = -1,
-        round_toward_zero         =  0,
-        round_to_nearest          =  1,
-        round_toward_infinity     =  2,
-        round_toward_neg_infinity =  3
-    };
-
-    /**
-     * 18.3.2.6, type float_denorm_style:
-     */
-
-    enum float_denorm_style
-    {
-        denorm_indeterminate = -1,
-        denorm_absent        =  0,
-        denorm_present       =  1
-    };
-
-    /**
-     * 18.3.2.3, class template numeric_limits:
-     */
-
-    namespace aux
-    {
-        template<class T>
-        class numeric_limits
-        {
-            public:
-                static constexpr bool is_specialized = false;
-
-                static constexpr T min() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T max() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T lowest() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr int digits       = 0;
-                static constexpr int digits10     = 0;
-                static constexpr int max_digits10 = 0;
-
-                static constexpr bool is_signed  = false;
-                static constexpr bool is_integer = false;
-                static constexpr bool is_exact   = false;
-
-                static constexpr int radix = 0;
-
-                static constexpr T epsilon() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T round_error() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr int min_exponent   = 0;
-                static constexpr int min_exponent10 = 0;
-                static constexpr int max_exponent   = 0;
-                static constexpr int max_exponent10 = 0;
-
-                static constexpr bool has_infinity      = false;
-                static constexpr bool has_quiet_NaN     = false;
-                static constexpr bool has_signaling_NaN = false;
-
-                static constexpr float_denorm_style has_denorm = denorm_absent;
-                static constexpr bool has_denorm_loss          = false;
-
-                static constexpr T infinity() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T quiet_NaN() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T signaling_NaN() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr T denorm_min() noexcept
-                {
-                    return T{};
-                }
-
-                static constexpr bool is_iec559  = false;
-                static constexpr bool is_bounded = false;
-                static constexpr bool is_modulo  = false;
-
-                static constexpr bool traps           = false;
-                static constexpr bool tinyness_before = false;
-
-                static constexpr float_round_style round_style = round_toward_zero;
-        };
-    }
-
-    template<class T>
-    class numeric_limits: public aux::numeric_limits<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    class numeric_limits<const T>: public numeric_limits<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    class numeric_limits<volatile T>: public numeric_limits<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    class numeric_limits<const volatile T>: public numeric_limits<T>
-    { /* DUMMY BODY */ };
-
-    /**
-     * 18.3.2.3, class template numeric_limits:
-     */
-
-    template<>
-    class numeric_limits<float>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr float min() noexcept
-            {
-                return 1.17549435e-38f;
-            }
-
-            static constexpr float max() noexcept
-            {
-                return 3.40282347e+38f;
-            }
-
-            static constexpr float lowest() noexcept
-            {
-                return -3.40282347e+38f;
-            }
-
-            static constexpr int digits       = 24;
-            static constexpr int digits10     =  6;
-            static constexpr int max_digits10 =  9;
-
-            static constexpr bool is_signed  = true;
-            static constexpr bool is_integer = false;
-            static constexpr bool is_exact   = false;
-
-            static constexpr int radix = 2;
-
-            static constexpr float epsilon() noexcept
-            {
-                return 1.19209290e-07f;
-            }
-
-            static constexpr float round_error() noexcept
-            {
-                return 0.5f;
-            }
-
-            static constexpr int min_exponent   = -127;
-            static constexpr int min_exponent10 =  -37;
-            static constexpr int max_exponent   =  128;
-            static constexpr int max_exponent10 =   38;
-
-            static constexpr bool has_infinity      = true;
-            static constexpr bool has_quiet_NaN     = true;
-            static constexpr bool has_signaling_NaN = true;
-
-            static constexpr float_denorm_style has_denorm = denorm_absent;
-            static constexpr bool has_denorm_loss          = false;
-
-            static constexpr float infinity() noexcept
-            {
-                // TODO: implement
-                return 0.f;
-            }
-
-            static constexpr float quiet_NaN() noexcept
-            {
-                // TODO: implement
-                return 0.f;
-            }
-
-            static constexpr float signaling_NaN() noexcept
-            {
-                // TODO: implement
-                return 0.f;
-            }
-
-            static constexpr float denorm_min() noexcept
-            {
-                return min();
-            }
-
-            static constexpr bool is_iec559  = true;
-            static constexpr bool is_bounded = true;
-            static constexpr bool is_modulo  = false;
-
-            static constexpr bool traps           = true;
-            static constexpr bool tinyness_before = true;
-
-            static constexpr float_round_style round_style = round_to_nearest;
-    };
-
-    template<>
-    class numeric_limits<bool>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr bool min() noexcept
-            {
-                return false;
-            }
-
-            static constexpr bool max() noexcept
-            {
-                return true;
-            }
-
-            static constexpr bool lowest() noexcept
-            {
-                return false;
-            }
-
-            static constexpr int digits       = 1;
-            static constexpr int digits10     = 0;
-            static constexpr int max_digits10 = 0;
-
-            static constexpr bool is_signed  = false;
-            static constexpr bool is_integer = true;
-            static constexpr bool is_exact   = true;
-
-            static constexpr int radix = 2;
-
-            static constexpr bool epsilon() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr bool round_error() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr int min_exponent   = 0;
-            static constexpr int min_exponent10 = 0;
-            static constexpr int max_exponent   = 0;
-            static constexpr int max_exponent10 = 0;
-
-            static constexpr bool has_infinity      = false;
-            static constexpr bool has_quiet_NaN     = false;
-            static constexpr bool has_signaling_NaN = false;
-
-            static constexpr float_denorm_style has_denorm = denorm_absent;
-            static constexpr bool has_denorm_loss          = false;
-
-            static constexpr bool infinity() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr bool quiet_NaN() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr bool signaling_NaN() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr bool denorm_min() noexcept
-            {
-                return 0;
-            }
-
-            static constexpr bool is_iec559  = false;
-            static constexpr bool is_bounded = true;
-            static constexpr bool is_modulo  = false;
-
-            static constexpr bool traps           = false;
-            static constexpr bool tinyness_before = false;
-
-            static constexpr float_round_style round_style = round_toward_zero;
-    };
-
-    /**
-     * Note: Because of the limited state of limit.h, we define only
-     *       the most basic properties of the most basic types (that are likely
-     *       to be used in a program that is being ported to HelenOS).
-     */
-
-    template<>
-    class numeric_limits<char>: public aux::numeric_limits<char>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(char) * 8;
-
-            static constexpr char max()
-            {
-                return CHAR_MAX;
-            }
-
-            static constexpr char min()
-            {
-                return CHAR_MIN;
-            }
-
-            static constexpr char lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<signed char>: public aux::numeric_limits<signed char>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(signed char) * 8 - 1;
-
-            static constexpr signed char max()
-            {
-                return SCHAR_MAX;
-            }
-
-            static constexpr signed char min()
-            {
-                return SCHAR_MIN;
-            }
-
-            static constexpr signed char lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<short>: public aux::numeric_limits<short>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(short) * 8 - 1;
-
-            static constexpr short max()
-            {
-                return SHRT_MAX;
-            }
-
-            static constexpr short min()
-            {
-                return SHRT_MIN;
-            }
-
-            static constexpr short lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<int>: public aux::numeric_limits<int>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(int) * 8 - 1;
-
-            static constexpr int max()
-            {
-                return INT_MAX;
-            }
-
-            static constexpr int min()
-            {
-                return INT_MIN;
-            }
-
-            static constexpr int lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<long>: public aux::numeric_limits<long>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(long) * 8 - 1;
-
-            static constexpr long max()
-            {
-                return LONG_MAX;
-            }
-
-            static constexpr long min()
-            {
-                return LONG_MIN;
-            }
-
-            static constexpr long lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<long long>: public aux::numeric_limits<long long>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(long long) * 8 - 1;
-
-            static constexpr long long max()
-            {
-                return LLONG_MAX;
-            }
-
-            static constexpr long long min()
-            {
-                return LLONG_MIN;
-            }
-
-            static constexpr long long lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<unsigned char>: public aux::numeric_limits<unsigned char>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(unsigned char) * 8;
-
-            static constexpr unsigned char max()
-            {
-                return SCHAR_MAX;
-            }
-
-            static constexpr unsigned char min()
-            {
-                return SCHAR_MIN;
-            }
-
-            static constexpr unsigned char lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<unsigned short>: public aux::numeric_limits<unsigned short>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(unsigned short) * 8;
-
-            static constexpr unsigned short max()
-            {
-                return USHRT_MAX;
-            }
-
-            static constexpr unsigned short min()
-            {
-                return 0;
-            }
-
-            static constexpr unsigned short lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<unsigned int>: public aux::numeric_limits<unsigned int>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(unsigned int) * 8;
-
-            static constexpr unsigned int max()
-            {
-                return UINT_MAX;
-            }
-
-            static constexpr unsigned int min()
-            {
-                return 0;
-            }
-
-            static constexpr unsigned int lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<unsigned long>: public aux::numeric_limits<unsigned long>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(unsigned long) * 8;
-
-            static constexpr unsigned long max()
-            {
-                return ULONG_MAX;
-            }
-
-            static constexpr unsigned long min()
-            {
-                return 0;
-            }
-
-            static constexpr unsigned long lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<unsigned long long>: public aux::numeric_limits<unsigned long long>
-    {
-        public:
-            static constexpr bool is_specialized = true;
-
-            static constexpr int digits = sizeof(unsigned long long) * 8;
-
-            static constexpr unsigned long long max()
-            {
-                return ULLONG_MAX;
-            }
-
-            static constexpr unsigned long long min()
-            {
-                return 0;
-            }
-
-            static constexpr unsigned long long lowest()
-            {
-                return min();
-            }
-    };
-
-    template<>
-    class numeric_limits<double>: public aux::numeric_limits<double>
-    {
-        public:
-        // TODO: implement
-            static constexpr int digits = sizeof(short) * 8 - 1;
-    };
-
-    template<>
-    class numeric_limits<long double>: public aux::numeric_limits<long double>
-    {
-        public:
-        // TODO: implement
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/codecvt.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/codecvt.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_CODECVT
-#define LIBCPP_BITS_LOCALE_CODECVT
-
-#include <__bits/locale/locale.hpp>
-#include <string>
-
-namespace std
-{
-    /**
-     * 22.4.1.4, class template codecvt:
-     */
-
-    class codecvt_base
-    {
-        public:
-            enum result
-            {
-                ok, partial, error, noconv
-            };
-    };
-
-    template<class Intern, class Extern, class State>
-    class codecvt: public codecvt_base
-    {
-        public:
-            using intern_type = Intern;
-            using extern_type = Extern;
-            using state_type  = State;
-
-            explicit codecvt(size_t = 0)
-            { /* DUMMY BODY */ }
-
-            result out(state_type& state, const intern_type* from, const intern_type* from_end,
-                       const intern_type*& from_next, extern_type* to, extern_type* to_end,
-                       extern_type*& to_next) const
-            {
-                return do_out(state, from, from_end, from_next, to, to_end, to_next);
-            }
-
-            result unshift(state_type& state, extern_type* to, extern_type* to_end,
-                           extern_type*& to_next) const
-            {
-                return do_unshift(state, to, to_end, to_next);
-            }
-
-            result in(state_type& state, const extern_type* from, const extern_type* from_end,
-                      const extern_type*& from_next, intern_type* to, intern_type* to_end,
-                      intern_type*& to_next) const
-            {
-                return do_in(state, from, from_end, from_next, to, to_end, to_next);
-            }
-
-            int encoding() const noexcept
-            {
-                return do_encoding();
-            }
-
-            bool always_noconv() const noexcept
-            {
-                return do_always_noconv();
-            }
-
-            int length(state_type& state, const extern_type* from, const extern_type* end,
-                       size_t max) const
-            {
-                return do_length(state, from, end, max);
-            }
-
-            int max_length() const noexcept
-            {
-                return do_max_length();
-            }
-
-            static locale::id id;
-
-            ~codecvt() = default;
-
-        protected:
-            virtual result do_out(state_type& state, const intern_type* from, const intern_type* from_end,
-                                  const intern_type*& from_next, extern_type* to, extern_type* to_end,
-                                  extern_type*& to_next) const
-            {
-                // TODO: implement
-                return error;
-            }
-
-            virtual result do_unshift(state_type& state, extern_type* to, extern_type* to_end,
-                                      extern_type*& to_next) const
-            {
-                // TODO: implement
-                return error;
-            }
-
-            virtual result do_in(state_type& state, const extern_type* from, const extern_type* from_end,
-                                 const extern_type*& from_next, intern_type* to, intern_type* to_end,
-                                 intern_type*& to_next) const
-            {
-                // TODO: implement
-                return error;
-            }
-
-            virtual int do_encoding() const noexcept
-            {
-                // TODO: implement
-                return 0;
-            }
-
-            virtual bool do_always_noconv() const noexcept
-            {
-                // TODO: implement
-                return false;
-            }
-
-            virtual int do_length(state_type& state, const extern_type* from, const extern_type* end,
-                                  size_t max) const
-            {
-                // TODO: implement
-                return 0;
-            }
-
-            virtual int do_max_length() const noexcept
-            {
-                // TODO: implement
-                return 0;
-            }
-    };
-
-    template<class Intern, class Extern, class State>
-    locale::id codecvt<Intern, Extern, State>::id{};
-
-    /**
-     * 22.4.1.5, class template codecvt_byname:
-     * Note: Dummy, TODO: implement.
-     */
-
-    template<class Intern, class Extern, class State>
-    class codecvt_byname: public codecvt<Intern, Extern, State>
-    {
-        public:
-            explicit codecvt_byname(const char*, size_t = 0)
-            { /* DUMMY BODY */ }
-
-            explicit codecvt_byname(const string&, size_t = 0)
-            { /* DUMMY BODY */ }
-
-            ~codecvt_byname() = default;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/ctype.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/ctype.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,611 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_CTYPE
-#define LIBCPP_BITS_LOCALE_CTYPE
-
-#include <__bits/locale/locale.hpp>
-#include <__bits/string/string.hpp>
-#include <cctype>
-
-namespace std
-{
-    /**
-     * 22.4.1, the type category:
-     */
-
-    class ctype_base
-    {
-        public:
-            using mask = uint16_t;
-
-            static constexpr mask space  = 0b00'0000'0001;
-            static constexpr mask print  = 0b00'0000'0010;
-            static constexpr mask cntrl  = 0b00'0000'0100;
-            static constexpr mask upper  = 0b00'0000'1000;
-            static constexpr mask lower  = 0b00'0001'0000;
-            static constexpr mask alpha  = 0b00'0010'0000;
-            static constexpr mask digit  = 0b00'0100'0000;
-            static constexpr mask punct  = 0b00'1000'0000;
-            static constexpr mask xdigit = 0b01'0000'0000;
-            static constexpr mask blank  = 0b10'0000'0000;
-            static constexpr mask alnum  = alpha | digit;
-            static constexpr mask graph  = alnum | punct;
-    };
-
-    /**
-     * 22.4.1.1, class template ctype:
-     */
-
-    template<class Char>
-    class ctype: public locale::facet, public ctype_base
-    {
-        public:
-            using char_type = Char;
-
-            explicit ctype(size_t)
-            { /* DUMMY BODY */ }
-
-            bool is(mask m, char_type c) const
-            {
-                return do_is(m, c);
-            }
-
-            const char_type* is(const char_type* low, const char_type* high,
-                                mask* vec) const
-            {
-                return do_is(low, high, vec);
-            }
-
-            const char_type* scan_is(mask m, const char_type* low,
-                                     const char_type* high) const
-            {
-                return do_scan_is(m, low, high);
-            }
-
-            const char_type* scan_not(mask m, const char_type* low,
-                                      const char_type* high) const
-            {
-                return do_scan_not(m, low, high);
-            }
-
-            char_type toupper(char_type c) const
-            {
-                return do_toupper(c);
-            }
-
-            const char_type* toupper(char_type* low, const char_type* high) const
-            {
-                return do_toupper(low, high);
-            }
-
-            char_type tolower(char_type c) const
-            {
-                return do_tolower(c);
-            }
-
-            const char_type* tolower(char_type* low, const char_type* high) const
-            {
-                return do_tolower(low, high);
-            }
-
-            char_type widen(char c) const
-            {
-                return do_widen(c);
-            }
-
-            const char_type* widen(const char* low, const char* high, char_type* to) const
-            {
-                return do_widen(low, high, to);
-            }
-
-            char narrow(char_type c, char def) const
-            {
-                return do_narrow(c, def);
-            }
-
-            const char_type* narrow(const char_type* low, const char_type* high,
-                                    char def, char* to) const
-            {
-                return do_narrow(low, high, def, to);
-            }
-
-            static locale::id id;
-
-            /**
-             * Note: This is a deviation from the standard, because in the
-             *       ISO C++ Standard this function is protected (because
-             *       the instances are reference counted, but in our design
-             *       they are not and as such we did this change).
-             *       (This applies to all constructors of all facets.)
-             */
-            ~ctype() = default;
-
-        protected:
-            virtual bool do_is(mask m, char_type c) const
-            {
-                // TODO: implement
-                return false;
-            }
-
-            virtual const char_type* do_is(const char_type* low, const char_type high,
-                                           mask m) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_is(mask m, const char_type* low,
-                                                const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_not(mask m, const char_type* low,
-                                                 const char_type* high) const
-            {
-                // TODO: implement
-                return low;
-            }
-
-            virtual char_type do_toupper(char_type c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_toupper(char_type* low, const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_tolower(char_type c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_tolower(char_type* low, const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_widen(char c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_widen(const char* low, const char* high,
-                                              char_type* dest) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char do_narrow(char_type c, char def) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_narrow(const char_type* low, const char_type* high,
-                                               char def, char* dest) const
-            {
-                // TODO: implement
-                return high;
-            }
-    };
-
-    template<class Char>
-    locale::id ctype<Char>::id{};
-
-    /**
-     * 22.4.1.2, class template ctype_byname:
-     * Note: Dummy, TODO: implement.
-     */
-
-    template<class Char>
-    class ctype_byname: public ctype<Char>
-    {
-        public:
-            using mask = typename ctype<Char>::mask;
-
-            explicit ctype_byname(const char* name, size_t = 0)
-            { /* DUMMY BODY */ }
-
-            explicit ctype_byname(const string& name, size_t = 0)
-            { /* DUMMY BODY */ }
-
-        protected:
-            ~ctype_byname() = default;
-    };
-
-    /**
-     * 22.4.1.3, ctype specialziations:
-     */
-
-    template<>
-    class ctype<char>: public locale::facet, public ctype_base
-    {
-        public:
-            using char_type = char;
-
-            explicit ctype(const mask* tab = nullptr, bool del = false, size_t = 0)
-            { /* DUMMY BODY */ }
-
-            bool is(mask m, char_type c) const
-            {
-                return do_is(m, c);
-            }
-
-            const char_type* is(const char_type* low, const char_type* high,
-                                mask* vec) const
-            {
-                return do_is(low, high, vec);
-            }
-
-            const char_type* scan_is(mask m, const char_type* low,
-                                     const char_type* high) const
-            {
-                return do_scan_is(m, low, high);
-            }
-
-            const char_type* scan_not(mask m, const char_type* low,
-                                      const char_type* high) const
-            {
-                return do_scan_not(m, low, high);
-            }
-
-            char_type toupper(char_type c) const
-            {
-                return do_toupper(c);
-            }
-
-            const char_type* toupper(char_type* low, const char_type* high) const
-            {
-                return do_toupper(low, high);
-            }
-
-            char_type tolower(char_type c) const
-            {
-                return do_tolower(c);
-            }
-
-            const char_type* tolower(char_type* low, const char_type* high) const
-            {
-                return do_tolower(low, high);
-            }
-
-            char_type widen(char c) const
-            {
-                return do_widen(c);
-            }
-
-            const char_type* widen(const char* low, const char* high, char_type* to) const
-            {
-                return do_widen(low, high, to);
-            }
-
-            char narrow(char_type c, char def) const
-            {
-                return do_narrow(c, def);
-            }
-
-            const char_type* narrow(const char_type* low, const char_type* high,
-                                    char def, char* to) const
-            {
-                return do_narrow(low, high, def, to);
-            }
-
-            static locale::id id;
-            static const size_t table_size{0};
-
-            const mask* table() const noexcept
-            {
-                return classic_table();
-            }
-
-            static const mask* classic_table() noexcept
-            {
-                return classic_table_;
-            }
-
-            ~ctype() = default;
-
-        protected:
-            virtual bool do_is(mask m, char_type c) const
-            {
-                // TODO: implement, this is a dummy
-                if ((m & space) != 0 && std::isspace(c))
-                    return true;
-                else if ((m & alpha) != 0 && std::isalpha(c))
-                    return true;
-                else if ((m & upper) != 0 && std::isupper(c))
-                    return true;
-                else if ((m & lower) != 0 && std::islower(c))
-                    return true;
-                else if ((m & digit) != 0 && std::isdigit(c))
-                    return true;
-                return false;
-            }
-
-            virtual const char_type* do_is(const char_type* low, const char_type* high,
-                                           mask* m) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_is(mask m, const char_type* low,
-                                                const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_not(mask m, const char_type* low,
-                                                 const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_toupper(char_type c) const
-            {
-                return std::toupper(c);
-            }
-
-            virtual const char_type* do_toupper(char_type* low, const char_type* high) const
-            {
-                while (low != high)
-                    *low = std::toupper(*low);
-
-                return high;
-            }
-
-            virtual char_type do_tolower(char_type c) const
-            {
-                return std::tolower(c);
-            }
-
-            virtual const char_type* do_tolower(char_type* low, const char_type* high) const
-            {
-                while (low != high)
-                    *low = std::tolower(*low);
-
-                return high;
-            }
-
-            virtual char_type do_widen(char c) const
-            {
-                return c;
-            }
-
-            virtual const char_type* do_widen(const char* low, const char* high,
-                                              char_type* dest) const
-            {
-                while (low != high)
-                    *dest++ = *low++;
-
-                return high;
-            }
-
-            virtual char do_narrow(char_type c, char def) const
-            {
-                return c;
-            }
-
-            virtual const char_type* do_narrow(const char_type* low, const char_type* high,
-                                               char def, char* dest) const
-            {
-                while (low != high)
-                    *dest++ = *low++;
-
-                return high;
-            }
-
-        private:
-            static constexpr mask* classic_table_{nullptr};
-    };
-
-    template<>
-    class ctype<wchar_t>: public locale::facet, public ctype_base
-    {
-        public:
-            using char_type = wchar_t;
-
-            explicit ctype(const mask* tab = nullptr, bool del = false, size_t = 0)
-            { /* DUMMY BODY */ }
-
-            bool is(mask m, char_type c) const
-            {
-                return do_is(m, c);
-            }
-
-            const char_type* is(const char_type* low, const char_type* high,
-                                mask* vec) const
-            {
-                return do_is(low, high, vec);
-            }
-
-            const char_type* scan_is(mask m, const char_type* low,
-                                     const char_type* high) const
-            {
-                return do_scan_is(m, low, high);
-            }
-
-            const char_type* scan_not(mask m, const char_type* low,
-                                      const char_type* high) const
-            {
-                return do_scan_not(m, low, high);
-            }
-
-            char_type toupper(char_type c) const
-            {
-                return do_toupper(c);
-            }
-
-            const char_type* toupper(char_type* low, const char_type* high) const
-            {
-                return do_toupper(low, high);
-            }
-
-            char_type tolower(char_type c) const
-            {
-                return do_tolower(c);
-            }
-
-            const char_type* tolower(char_type* low, const char_type* high) const
-            {
-                return do_tolower(low, high);
-            }
-
-            char_type widen(char c) const
-            {
-                return do_widen(c);
-            }
-
-            const char_type* widen(const char* low, const char* high, char_type* to) const
-            {
-                return do_widen(low, high, to);
-            }
-
-            char narrow(char_type c, char def) const
-            {
-                return do_narrow(c, def);
-            }
-
-            const char_type* narrow(const char_type* low, const char_type* high,
-                                    char def, char* to) const
-            {
-                return do_narrow(low, high, def, to);
-            }
-
-            static locale::id id;
-            static const size_t table_size{0};
-
-            const mask* table() const noexcept
-            {
-                return classic_table();
-            }
-
-            static const mask* classic_table() noexcept
-            {
-                return classic_table_;
-            }
-
-            ~ctype() = default;
-
-        protected:
-            virtual bool do_is(mask m, char_type c) const
-            {
-                // TODO: implement
-                return false;
-            }
-
-            virtual const char_type* do_is(const char_type* low, const char_type* high,
-                                           mask* m) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_is(mask m, const char_type* low,
-                                                const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual const char_type* do_scan_not(mask m, const char_type* low,
-                                                 const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_toupper(char_type c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_toupper(char_type* low, const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_tolower(char_type c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_tolower(char_type* low, const char_type* high) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-            virtual char_type do_widen(char c) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_widen(const char* low, const char* high,
-                                              char_type* dest) const
-            {
-                // TODO: implement
-                return dest;
-            }
-
-            virtual char do_narrow(char_type c, char def) const
-            {
-                // TODO: implement
-                return c;
-            }
-
-            virtual const char_type* do_narrow(const char_type* low, const char_type* high,
-                                               char def, char* dest) const
-            {
-                // TODO: implement
-                return high;
-            }
-
-        private:
-            static constexpr mask* classic_table_{nullptr};
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/locale.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/locale.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2017 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE
-#define LIBCPP_BITS_LOCALE
-
-#include <__bits/string/string.hpp>
-
-namespace std
-{
-    class locale;
-
-    /**
-     * 22.3.1, class locale:
-     */
-
-    class locale
-    {
-        public:
-            class facet
-            {
-                protected:
-                    explicit facet(size_t refs = 0);
-
-                    virtual ~facet();
-
-                    facet(const facet&) = delete;
-                    void operator=(const facet&) = delete;
-            };
-
-            class id
-            {
-                public:
-                    id() = default;
-
-                    id(const id&) = delete;
-                    void operator=(const id&) = delete;
-            };
-
-            using category = int;
-
-            static const category none     = 0b000'0001;
-            static const category collate  = 0b000'0010;
-            static const category ctype    = 0b000'0100;
-            static const category monetary = 0b000'1000;
-            static const category numeric  = 0b001'0000;
-            static const category time     = 0b010'0000;
-            static const category messages = 0b100'0000;
-            static const category all      = collate | ctype | monetary |
-                                             numeric | time | messages;
-
-            locale() noexcept;
-
-            locale(const locale& other) noexcept;
-
-            explicit locale(const char* name);
-
-            explicit locale(const string& name);
-
-            locale(const locale& other, const char* name, category);
-
-            locale(const locale& other, const string& name, category);
-
-            template<class Facet>
-            locale(const locale& other, Facet* f)
-                : name_{other.name_}
-            { /* DUMMY BODY */ }
-
-            locale(const locale& other, const locale& one, category);
-
-            ~locale() = default;
-
-            const locale& operator=(const locale& other) noexcept;
-
-            template<class Facet>
-            locale combine(const locale& other) const
-            {
-                return other;
-            }
-
-            string name() const;
-
-            bool operator==(const locale& other) const;
-            bool operator!=(const locale& other) const;
-
-            template<class Char, class Traits, class Allocator>
-            bool operator()(const basic_string<Char, Traits, Allocator>& s1,
-                            const basic_string<Char, Traits, Allocator>& s2) const
-            {
-                // TODO: define outside locale
-                /* return use_facet<collate<Char>>(*this).compare( */
-                /*     s1.begin(), s1.end(), s2.begin(), s2.end() */
-                /* ) < 0; */
-                return false;
-            }
-
-            static locale global(const locale&)
-            {
-                return *the_locale_;
-            }
-
-            static const locale& classic()
-            {
-                return *the_locale_;
-            }
-
-        private:
-            string name_;
-
-            // TODO: implement the_locale_
-            static constexpr locale* the_locale_{nullptr};
-
-            template<class Facet>
-            friend bool has_facet(const locale&);
-
-            template<class Facet>
-            bool has_()
-            { // Our single locale atm has all facets.
-                return true;
-            }
-
-            template<class Facet>
-            /* friend const Facet& use_facet(const locale&); */
-            friend Facet use_facet(const locale&);
-
-            template<class Facet>
-            /* const Facet& get_() const */
-            Facet get_() const
-            {
-                return Facet{0U};
-            }
-    };
-
-    template<class Facet>
-    /* const Facet& use_facet(const locale& loc) */
-    Facet use_facet(const locale& loc)
-    {
-        return loc.get_<Facet>();
-    }
-
-    template<class Facet>
-    bool has_facet(const locale& loc)
-    {
-        return loc.has_<Facet>();
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/locale_misc.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/locale_misc.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_MISC
-#define LIBCPP_BITS_LOCALE_MISC
-
-#include <__bits/locale/locale.hpp>
-#include <__bits/locale/ctype.hpp>
-#include <__bits/locale/num_get.hpp>
-#include <__bits/locale/num_put.hpp>
-#include <__bits/locale/numpunct.hpp>
-#include <cstdlib>
-#include <ios>
-#include <iosfwd>
-#include <string>
-
-namespace std
-{
-    /**
-     * Note: This is a very simplistic implementation of <locale>.
-     *       We have a single locale that has all of its facets.
-     *       This should behave correctly on the outside but will prevent
-     *       us from using multiple locales so if that becomes necessary
-     *       in the future, TODO: implement :)
-     */
-
-    /**
-     * 22.3.3, convenience interfaces:
-     */
-
-    /**
-     * 22.3.3.1, character classification:
-     */
-
-    template<class Char>
-    bool isspace(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::space, c);
-    }
-
-    template<class Char>
-    bool isprint(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::print, c);
-    }
-
-    template<class Char>
-    bool iscntrl(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::cntrl, c);
-    }
-
-    template<class Char>
-    bool isupper(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::upper, c);
-    }
-
-    template<class Char>
-    bool islower(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::lower, c);
-    }
-
-    template<class Char>
-    bool isalpha(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::alpha, c);
-    }
-
-    template<class Char>
-    bool isdigit(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::digit, c);
-    }
-
-    template<class Char>
-    bool ispunct(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::punct, c);
-    }
-
-    template<class Char>
-    bool isxdigit(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::xdigit, c);
-    }
-
-    template<class Char>
-    bool isalnum(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::alnum, c);
-    }
-
-    template<class Char>
-    bool isgraph(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::graph, c);
-    }
-
-    template<class Char>
-    bool isblank(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).is(ctype_base::blank, c);
-    }
-
-    /**
-     * 22.3.3.2, conversions:
-     */
-
-    /**
-     * 22.3.3.2.1, character conversions:
-     */
-
-    template<class Char>
-    Char toupper(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).toupper(c);
-    }
-
-    template<class Char>
-    Char tolower(Char c, const locale& loc)
-    {
-        return use_facet<ctype<Char>>(loc).tolower(c);
-    }
-
-    /**
-     * 22.3.3.2.2, string conversions:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/num_get.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/num_get.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,372 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_NUM_GET
-#define LIBCPP_BITS_LOCALE_NUM_GET
-
-#include <__bits/locale/locale.hpp>
-#include <__bits/locale/numpunct.hpp>
-#include <cerrno>
-#include <cstring>
-#include <ios>
-#include <iterator>
-#include <limits>
-
-namespace std
-{
-    /**
-     * 22.4.2.1, class template num_get:
-     */
-
-    template<class Char, class InputIterator = istreambuf_iterator<Char>>
-    class num_get: public locale::facet
-    {
-        public:
-            using char_type = Char;
-            using iter_type = InputIterator;
-
-            explicit num_get(size_t refs = 0)
-            { /* DUMMY BODY */ }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, bool& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, long& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, long long& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, unsigned short& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, unsigned int& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, unsigned long& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, unsigned long long& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, float& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, double& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, long double& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            iter_type get(iter_type in, iter_type end, ios_base& base,
-                          ios_base::iostate& err, void*& v) const
-            {
-                return do_get(in, end, base, err, v);
-            }
-
-            static locale::id id;
-
-            ~num_get()
-            { /* DUMMY BODY */ }
-
-        protected:
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, bool& v) const
-            {
-                if (in == end)
-                {
-                    err = ios_base::eofbit;
-                    return in;
-                }
-
-                if ((base.flags() & ios_base::boolalpha) == 0)
-                {
-                    int8_t tmp{};
-                    in = get_integral_<int64_t>(in, end, base, err, tmp);
-
-                    if (tmp == 0)
-                        v = false;
-                    else if (tmp == 1)
-                        v = true;
-                    else
-                    {
-                        v = true;
-                        err = ios_base::failbit;
-                    }
-                }
-                else
-                {
-                    /**
-                     * We track both truename() and falsename()
-                     * at the same time, once either is matched
-                     * or the input is too big without a match
-                     * or the input ends the conversion ends
-                     * and the result is deduced.
-                     */
-
-                    auto loc = base.getloc();
-                    const auto& nt = use_facet<numpunct<char_type>>(loc);
-
-                    auto true_target = nt.truename();
-                    auto false_target = nt.falsename();
-
-                    if (true_target == "" || false_target == "")
-                    {
-                        v = (err == ios_base::failbit);
-                        return in;
-                    }
-
-                    auto true_str = true_target;
-                    auto false_str = false_target;
-
-                    size_t i{};
-                    while (true)
-                    {
-                        if (true_str.size() <= i && false_str.size() <= i)
-                            break;
-                        auto c = *in++;
-
-                        if (i < true_str.size())
-                            true_str[i] = c;
-                        if (i < false_str.size())
-                            false_str[i] = c;
-                        ++i;
-
-                        if (in == end || *in == '\n')
-                        {
-                            err = ios_base::eofbit;
-                            break;
-                        }
-                    }
-
-                    if (i == true_str.size() && true_str == true_target)
-                    {
-                        v = true;
-
-                        if (++in == end)
-                            err = ios_base::eofbit;
-                        else
-                            err = ios_base::goodbit;
-                    }
-                    else if (i == false_str.size() && false_str == false_target)
-                    {
-                        v = false;
-
-                        if (in == end)
-                            err = (ios_base::failbit | ios_base::eofbit);
-                        else
-                            err = ios_base::failbit;
-                    }
-                    else
-                        err = ios_base::failbit;
-                }
-
-                return in;
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, long& v) const
-            {
-                return get_integral_<int64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, long long& v) const
-            {
-                return get_integral_<int64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, unsigned short& v) const
-            {
-                return get_integral_<uint64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, unsigned int& v) const
-            {
-                return get_integral_<uint64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, unsigned long& v) const
-            {
-                return get_integral_<uint64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, unsigned long long& v) const
-            {
-                return get_integral_<uint64_t>(in, end, base, err, v);
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, float& v) const
-            {
-                // TODO: implement
-                return in;
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, double& v) const
-            {
-                // TODO: implement
-                return in;
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, long double& v) const
-            {
-                // TODO: implement
-                return in;
-            }
-
-            iter_type do_get(iter_type in, iter_type end, ios_base& base,
-                             ios_base::iostate& err, void*& v) const
-            {
-                // TODO: implement
-                return in;
-            }
-
-        private:
-            template<class BaseType, class T>
-            iter_type get_integral_(iter_type in, iter_type end, ios_base& base,
-                                    ios_base::iostate& err, T& v) const
-            {
-                BaseType res{};
-                unsigned int num_base{10};
-
-                auto basefield = (base.flags() & ios_base::basefield);
-                if (basefield == ios_base::oct)
-                    num_base = 8;
-                else if (basefield == ios_base::hex)
-                    num_base = 16;
-
-                auto size = fill_buffer_integral_(in, end, base);
-                if (size > 0)
-                {
-                    int olderrno{errno};
-                    errno = EOK;
-                    char *endptr = NULL;
-
-                    if constexpr (is_signed<BaseType>::value)
-                        res = ::strtoll(base.buffer_, &endptr, num_base);
-                    else
-                        res = ::strtoull(base.buffer_, &endptr, num_base);
-
-                    if (errno != EOK || endptr == base.buffer_)
-                        err |= ios_base::failbit;
-
-                    errno = olderrno;
-
-                    if (res > static_cast<BaseType>(numeric_limits<T>::max()))
-                    {
-                        err |= ios_base::failbit;
-                        v = numeric_limits<T>::max();
-                    }
-                    else if (res < static_cast<BaseType>(numeric_limits<T>::min()))
-                    {
-                        err |= ios_base::failbit;
-                        v = numeric_limits<T>::min();
-                    }
-                    else
-                        v = static_cast<T>(res);
-                }
-                else
-                {
-                    err |= ios_base::failbit;
-                    v = 0;
-                }
-
-                return in;
-            }
-
-            size_t fill_buffer_integral_(iter_type& in, iter_type end, ios_base& base) const
-            {
-                if (in == end)
-                    return 0;
-
-                auto loc = base.getloc();
-                const auto& ct = use_facet<ctype<char_type>>(loc);
-                auto hex = ((base.flags() & ios_base::hex) != 0);
-
-                size_t i{};
-                if (*in == '+' || *in == '-')
-                    base.buffer_[i++] = *in++;
-
-                while (in != end && i < ios_base::buffer_size_ - 1)
-                {
-                    auto c = *in;
-                    if (ct.is(ctype_base::digit, c) || (hex &&
-                       ((c >= ct.widen('A') && c <= ct.widen('F')) ||
-                        (c >= ct.widen('a') && c <= ct.widen('f')))))
-                    {
-                        ++in;
-                        base.buffer_[i++] = c;
-                    }
-                    else
-                        break;
-                }
-                base.buffer_[i] = char_type{};
-
-                return i;
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/num_put.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/num_put.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_NUM_PUT
-#define LIBCPP_BITS_LOCALE_NUM_PUT
-
-#include <__bits/locale/locale.hpp>
-#include <__bits/locale/numpunct.hpp>
-#include <ios>
-#include <iterator>
-
-namespace std
-{
-    /**
-     * 22.4.2.2, class template num_put:
-     */
-
-    template<class Char, class OutputIterator = ostreambuf_iterator<Char>>
-    class num_put: public locale::facet
-    {
-        public:
-            using char_type = Char;
-            using iter_type = OutputIterator;
-
-            explicit num_put(size_t refs = 0)
-            { /* DUMMY BODY */ }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, bool v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, long v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, long long v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, unsigned long v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, unsigned long long v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, double v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, long double v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            iter_type put(iter_type it, ios_base& base, char_type fill, const void* v) const
-            {
-                return do_put(it, base, fill, v);
-            }
-
-            ~num_put()
-            { /* DUMMY BODY */ }
-
-        protected:
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, bool v) const
-            {
-                auto loc = base.getloc();
-
-                if ((base.flags() & ios_base::boolalpha) == 0)
-                    return do_put(it, base, fill, (long)v);
-                else
-                {
-                    auto s = v ? use_facet<numpunct<char_type>>(loc).truename()
-                               : use_facet<numpunct<char_type>>(loc).falsename();
-                    for (auto c: s)
-                        *it++ = c;
-                }
-
-                return it;
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, long v) const
-            {
-                auto basefield = (base.flags() & ios_base::basefield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                int ret{};
-                if (basefield == ios_base::oct)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lo", v);
-                else if ((basefield == ios_base::hex) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lx", v);
-                else if (basefield == ios_base::hex)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lX", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%ld", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, long long v) const
-            {
-                auto basefield = (base.flags() & ios_base::basefield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                int ret{};
-                if (basefield == ios_base::oct)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llo", v);
-                else if ((basefield == ios_base::hex) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llx", v);
-                else if (basefield == ios_base::hex)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llX", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lld", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, unsigned long v) const
-            {
-                auto basefield = (base.flags() & ios_base::basefield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                int ret{};
-                if (basefield == ios_base::oct)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lo", v);
-                else if ((basefield == ios_base::hex) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lx", v);
-                else if (basefield == ios_base::hex)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lX", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%lu", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, unsigned long long v) const
-            {
-                auto basefield = (base.flags() & ios_base::basefield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                // TODO: showbase
-                int ret{};
-                if (basefield == ios_base::oct)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llo", v);
-                else if ((basefield == ios_base::hex) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llx", v);
-                else if (basefield == ios_base::hex)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llX", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%llu", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, double v) const
-            {
-                auto floatfield = (base.flags() & ios_base::floatfield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                // TODO: showbase
-                // TODO: precision
-                int ret{};
-                if (floatfield == ios_base::fixed)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%f", v);
-                else if (floatfield == ios_base::scientific && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%e", v);
-                else if (floatfield == ios_base::scientific)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%E", v);
-                else if (floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%a", v);
-                else if (floatfield == (ios_base::fixed | ios_base::scientific))
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%A", v);
-                else if (!uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%g", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%G", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, long double v) const
-            {
-                /**
-                 * Note: Long double is not support at the moment in snprintf.
-                 */
-                auto floatfield = (base.flags() & ios_base::floatfield);
-                auto uppercase = (base.flags() & ios_base::uppercase);
-
-                // TODO: showbase
-                // TODO: precision
-                int ret{};
-                if (floatfield == ios_base::fixed)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%Lf", v);
-                else if (floatfield == ios_base::scientific && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%Le", v);
-                else if (floatfield == ios_base::scientific)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%LE", v);
-                else if (floatfield == (ios_base::fixed | ios_base::scientific) && !uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%La", v);
-                else if (floatfield == (ios_base::fixed | ios_base::scientific))
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%LA", v);
-                else if (!uppercase)
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%Lg", v);
-                else
-                    ret = snprintf(base.buffer_, ios_base::buffer_size_, "%LG", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-            iter_type do_put(iter_type it, ios_base& base, char_type fill, const void* v) const
-            {
-                int ret = snprintf(base.buffer_, ios_base::buffer_size_, "%p", v);
-
-                return put_adjusted_buffer_(it, base, fill, ret);
-            }
-
-        private:
-            iter_type put_adjusted_buffer_(iter_type it, ios_base& base, char_type fill, size_t size) const
-            {
-                auto adjustfield = (base.flags() & ios_base::adjustfield);
-
-                size_t to_fill{};
-                size_t width = static_cast<size_t>(base.width());
-
-                if (base.width() > 0 && size < width)
-                    to_fill = width - size;
-
-                if (to_fill > 0)
-                {
-                    if (adjustfield == ios_base::left)
-                    {
-                        it = put_buffer_(it, base, fill, 0, size);
-                        for (size_t i = 0; i < to_fill; ++i)
-                            *it++ = fill;
-                    }
-                    else if (adjustfield == ios_base::right)
-                    {
-                        for (size_t i = 0; i < to_fill; ++i)
-                            *it++ = fill;
-                        it = put_buffer_(it, base, fill, 0, size);
-                    }
-                    else if (adjustfield == ios_base::internal)
-                    {
-                        // TODO: pad after - or 0x/0X
-                    }
-                    else
-                    {
-                        for (size_t i = 0; i < to_fill; ++i)
-                            *it++ = fill;
-                        it = put_buffer_(it, base, fill, 0, size);
-                    }
-                }
-                else
-                    it = put_buffer_(it, base, fill, 0, size);
-                base.width(0);
-
-                return it;
-            }
-
-            iter_type put_buffer_(iter_type it, ios_base& base, char_type fill, size_t start, size_t size) const
-            {
-                const auto& loc = base.getloc();
-                const auto& ct = use_facet<ctype<char_type>>(loc);
-                const auto& punct = use_facet<numpunct<char_type>>(loc);
-
-                for (size_t i = start; i < size; ++i)
-                {
-                    if (base.buffer_[i] == '.')
-                        *it++ = punct.decimal_point();
-                    else
-                        *it++ = ct.widen(base.buffer_[i]);
-                    // TODO: Should do grouping & thousands_sep, but that's a low
-                    //       priority for now.
-                }
-
-                return it;
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/locale/numpunct.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/locale/numpunct.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_LOCALE_NUMPUNCT
-#define LIBCPP_BITS_LOCALE_NUMPUNCT
-
-#include <__bits/locale/locale.hpp>
-#include <string>
-
-namespace std
-{
-    /**
-     * 22.4.3.1, class template numpunct:
-     */
-
-    template<class Char>
-    class numpunct: public locale::facet
-    {
-        public:
-            using char_type   = Char;
-            using string_type = basic_string<Char>;
-
-            explicit numpunct(size_t refs = 0);
-
-            char_type decimal_point() const
-            {
-                return do_decimal_point();
-            }
-
-            char_type thousands_sep() const
-            {
-                return do_thousands_sep();
-            }
-
-            string_type grouping() const
-            {
-                return do_grouping();
-            }
-
-            string_type truename() const
-            {
-                return do_truename();
-            }
-
-            string_type falsename() const
-            {
-                return do_falsename();
-            }
-
-            ~numpunct();
-
-        protected:
-            char_type do_decimal_point() const;
-            char_type do_thousands_sep() const;
-            string_type do_grouping() const;
-            string_type do_truename() const;
-            string_type do_falsename() const;
-    };
-
-    template<>
-    class numpunct<char>: public locale::facet
-    {
-        public:
-            using char_type   = char;
-            using string_type = basic_string<char>;
-
-            explicit numpunct(size_t refs = 0)
-            { /* DUMMY BODY */ }
-
-            char_type decimal_point() const
-            {
-                return do_decimal_point();
-            }
-
-            char_type thousands_sep() const
-            {
-                return do_thousands_sep();
-            }
-
-            string_type grouping() const
-            {
-                return do_grouping();
-            }
-
-            string_type truename() const
-            {
-                return do_truename();
-            }
-
-            string_type falsename() const
-            {
-                return do_falsename();
-            }
-
-            ~numpunct()
-            { /* DUMMY BODY */ }
-
-        protected:
-            char_type do_decimal_point() const
-            {
-                return '.';
-            }
-
-            char_type do_thousands_sep() const
-            {
-                return ',';
-            }
-
-            string_type do_grouping() const
-            {
-                return "";
-            }
-
-            string_type do_truename() const
-            {
-                return "true";
-            }
-
-            string_type do_falsename() const
-            {
-                return "false";
-            }
-    };
-
-    template<>
-    class numpunct<wchar_t>: public locale::facet
-    {
-        public:
-            using char_type   = wchar_t;
-            using string_type = basic_string<wchar_t>;
-
-            explicit numpunct(size_t refs = 0);
-
-            char_type decimal_point() const
-            {
-                return do_decimal_point();
-            }
-
-            char_type thousands_sep() const
-            {
-                return do_thousands_sep();
-            }
-
-            string_type grouping() const
-            {
-                return do_grouping();
-            }
-
-            string_type truename() const
-            {
-                return do_truename();
-            }
-
-            string_type falsename() const
-            {
-                return do_falsename();
-            }
-
-            ~numpunct();
-
-        protected:
-            char_type do_decimal_point() const
-            {
-                return L'.';
-            }
-
-            char_type do_thousands_sep() const
-            {
-                return L',';
-            }
-
-            string_type do_grouping() const
-            {
-                return L"";
-            }
-
-            string_type do_truename() const
-            {
-                return L"true";
-            }
-
-            string_type do_falsename() const
-            {
-                return L"false";
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/addressof.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/addressof.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_ADDRESSOF
-#define LIBCPP_BITS_MEMORY_ADDRESSOF
-
-namespace std
-{
-    /**
-     * 20.7.12, specialized algorithms:
-     */
-
-    template<class T>
-    T* addressof(T& x) noexcept
-    {
-        return reinterpret_cast<T*>(
-            &const_cast<char&>(
-                reinterpret_cast<const volatile char&>(x)
-        ));
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/allocator_arg.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/allocator_arg.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_ALLOCATOR_ARG
-#define LIBCPP_BITS_MEMORY_ALLOCATOR_ARG
-
-namespace std
-{
-    /**
-     * 20.7.6, allocator argument tag:
-     */
-
-    struct allocator_arg_t
-    { /* DUMMY BODY */ };
-
-    constexpr allocator_arg_t allocator_arg{};
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/allocator_traits.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/allocator_traits.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,255 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_ALLOCATOR_TRAITS
-#define LIBCPP_BITS_MEMORY_ALLOCATOR_TRAITS
-
-#include <__bits/aux.hpp>
-#include <__bits/memory/addressof.hpp>
-#include <__bits/memory/pointer_traits.hpp>
-#include <__bits/memory/type_getters.hpp>
-#include <cstddef>
-#include <limits>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 20.7.7, uses_allocator:
-     */
-
-    namespace aux
-    {
-        template<class T, class = void>
-        struct has_allocator_type: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct has_allocator_type<T, void_t<typename T::allocator_type>>
-            : true_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T, class Alloc>
-    struct uses_allocator
-        : aux::value_is<
-        bool, aux::has_allocator_type<T>::value && is_convertible_v<
-            Alloc, typename T::allocator_type
-        >
-    >
-    { /* DUMMY BODY */ };
-
-    /**
-     * 20.7.8, allocator traits:
-     */
-
-    template<class Alloc>
-    struct allocator_traits
-    {
-        using allocator_type = Alloc;
-
-        using value_type         = typename Alloc::value_type;
-        using pointer            = typename aux::alloc_get_pointer<Alloc>::type;
-        using const_pointer      = typename aux::alloc_get_const_pointer<Alloc, pointer>::type;
-        using void_pointer       = typename aux::alloc_get_void_pointer<Alloc, pointer>::type;
-        using const_void_pointer = typename aux::alloc_get_const_void_pointer<Alloc, pointer>::type;
-        using difference_type    = typename aux::alloc_get_difference_type<Alloc, pointer>::type;
-        using size_type          = typename aux::alloc_get_size_type<Alloc, difference_type>::type;
-
-        using propagate_on_container_copy_assignment = typename aux::alloc_get_copy_propagate<Alloc>::type;
-        using propagate_on_container_move_assignment = typename aux::alloc_get_move_propagate<Alloc>::type;
-        using propagate_on_container_swap            = typename aux::alloc_get_swap_propagate<Alloc>::type;
-        using is_always_equal                        = typename aux::alloc_get_always_equal<Alloc>::type;
-
-        template<class T>
-        using rebind_alloc = typename aux::alloc_get_rebind_alloc<Alloc, T>;
-
-        template<class T>
-        using rebind_traits = allocator_traits<rebind_alloc<T>>;
-
-        static pointer allocate(Alloc& alloc, size_type n)
-        {
-            return alloc.allocate(n);
-        }
-
-        static pointer allocate(Alloc& alloc, size_type n, const_void_pointer hint)
-        {
-            if constexpr (aux::alloc_has_hint_allocate<Alloc, size_type, const_void_pointer>::value)
-                return alloc.allocate(n, hint);
-            else
-                return alloc.allocate(n);
-        }
-
-        static void deallocate(Alloc& alloc, pointer ptr, size_type n)
-        {
-            alloc.deallocate(ptr, n);
-        }
-
-        template<class T, class... Args>
-        static void construct(Alloc& alloc, T* ptr, Args&&... args)
-        {
-            if constexpr (aux::alloc_has_construct<Alloc, T, Args...>::value)
-                alloc.construct(ptr, forward<Args>(args)...);
-            else
-                ::new(static_cast<void*>(ptr)) T(forward<Args>(args)...);
-        }
-
-        template<class T>
-        static void destroy(Alloc& alloc, T* ptr)
-        {
-            if constexpr (aux::alloc_has_destroy<Alloc, T>::value)
-                alloc.destroy(ptr);
-            else
-                ptr->~T();
-        }
-
-        static size_type max_size(const Alloc& alloc) noexcept
-        {
-            if constexpr (aux::alloc_has_max_size<Alloc>::value)
-                return alloc.max_size();
-            else
-                return numeric_limits<size_type>::max();
-        }
-
-        static Alloc select_on_container_copy_construction(const Alloc& alloc)
-        {
-            if constexpr (aux::alloc_has_select<Alloc>::value)
-                return alloc.select_on_container_copy_construction();
-            else
-                return alloc;
-        }
-    };
-
-    /**
-     * 20.7.9, the default allocator
-     */
-
-    template<class T>
-    class allocator;
-
-    template<>
-    class allocator<void>
-    {
-        public:
-            using pointer       = void*;
-            using const_pointer = const void*;
-            using value_type    = void;
-
-            template<class U>
-            struct rebind
-            {
-                using other = allocator<U>;
-            };
-    };
-
-    template<class T>
-    T* addressof(T& x) noexcept;
-
-    template<class T>
-    class allocator
-    {
-        public:
-            using size_type       = size_t;
-            using difference_type = ptrdiff_t;
-            using pointer         = T*;
-            using const_pointer   = const T*;
-            using reference       = T&;
-            using const_reference = const T&;
-            using value_type      = T;
-
-            template<class U>
-            struct rebind
-            {
-                using other = allocator<U>;
-            };
-
-            using propagate_on_container_move_assignment = true_type;
-            using is_always_equal                        = true_type;
-
-            allocator() noexcept = default;
-
-            allocator(const allocator&) noexcept = default;
-
-            template<class U>
-            allocator(const allocator<U>&) noexcept
-            { /* DUMMY BODY */ }
-
-            ~allocator() = default;
-
-            pointer address(reference x) const noexcept
-            {
-                return addressof(x);
-            }
-
-            const_pointer address(const_reference x) const noexcept
-            {
-                return addressof(x);
-            }
-
-            pointer allocate(size_type n, allocator<void>::const_pointer = 0)
-            {
-                return static_cast<pointer>(::operator new(n * sizeof(value_type)));
-            }
-
-            void deallocate(pointer ptr, size_type n)
-            {
-                ::operator delete(ptr, n);
-            }
-
-            size_type max_size() const noexcept
-            {
-                return numeric_limits<size_type>::max();
-            }
-
-            template<class U, class... Args>
-            void construct(U* ptr, Args&&... args)
-            {
-                ::new((void*)ptr) U(forward<Args>(args)...);
-            }
-
-            template<class U>
-            void destroy(U* ptr)
-            {
-                ptr->~U();
-            }
-    };
-
-    template<class T1, class T2>
-    bool operator==(const allocator<T1>&, const allocator<T2>&) noexcept
-    {
-        return true;
-    }
-
-    template<class T1, class T2>
-    bool operator!=(const allocator<T1>&, const allocator<T2>&) noexcept
-    {
-        return false;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/misc.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/misc.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_MISC
-#define LIBCPP_BITS_MEMORY_MISC
-
-#include <cstdlib>
-#include <iterator>
-#include <new>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 20.7.10, raw storage iterator:
-     */
-
-    template<class OutputIterator, class T>
-    class raw_storage_iterator: public iterator<output_iterator_tag, void, void, void, void>
-    {
-        public:
-            explicit raw_storage_iterator(OutputIterator it)
-                : it_{it}
-            { /* DUMMY BODY */ }
-
-            raw_storage_iterator& operator*()
-            {
-                return *this;
-            }
-
-            raw_storage_iterator& operator=(const T& element)
-            {
-                new(it_) T{element};
-
-                return *this;
-            }
-
-            raw_storage_iterator& operator++()
-            {
-                ++it_;
-
-                return *this;
-            }
-
-            raw_storage_iterator operator++(int)
-            {
-                return raw_storage_iterator{it_++};
-            }
-
-        private:
-            OutputIterator it_;
-    };
-
-    /**
-     * 20.7.11, temporary buffers:
-     */
-
-    template<class T>
-    pair<T*, ptrdiff_t> get_temporary_buffer(ptrdiff_t n) noexcept
-    {
-        T* res{};
-
-        while (n > 0)
-        {
-            res = (T*)malloc(n * sizeof(T));
-
-            if (res)
-                return make_pair(res, n);
-
-            --n;
-        }
-
-        return make_pair(nullptr, ptrdiff_t{});
-    }
-
-    template<class T>
-    void return_temporary_buffer(T* ptr)
-    {
-        free(ptr);
-    }
-
-    /**
-     * 20.7.12, specialized algorithms:
-     */
-
-    template<class Iterator>
-    struct iterator_traits;
-
-    template<class InputIterator, class ForwardIterator>
-    ForwardIterator unitialized_copy(
-        InputIterator first, InputIterator last,
-        ForwardIterator result
-    )
-    {
-        for (; first != last; ++first, ++result)
-            ::new (static_cast<void*>(&*result)) typename iterator_traits<ForwardIterator>::value_type(*first);
-
-        return result;
-    }
-
-    template<class InputIterator, class Size, class ForwardIterator>
-    ForwardIterator unitialized_copy_n(
-        InputIterator first, Size n, ForwardIterator result
-    )
-    {
-        for (; n > 0; ++first, --n, ++result)
-            ::new (static_cast<void*>(&*result)) typename iterator_traits<ForwardIterator>::value_type(*first);
-
-        return result;
-    }
-
-    template<class ForwardIterator, class T>
-    void unitialized_fill(
-        ForwardIterator first, ForwardIterator last, const T& x
-    )
-    {
-        for (; first != last; ++first)
-            ::new (static_cast<void*>(&*first)) typename iterator_traits<ForwardIterator>::value_type(x);
-    }
-
-    template<class ForwardIterator, class Size, class T>
-    ForwardIterator unitialized_fill_n(
-        ForwardIterator first, Size n, const T& x
-    )
-    {
-        for (; n > 0; ++first, --n)
-            ::new (static_cast<void*>(&*first)) typename iterator_traits<ForwardIterator>::value_type(x);
-
-        return first;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/owner_less.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/owner_less.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_OWNER_LESS
-#define LIBCPP_BITS_MEMORY_OWNER_LESS
-
-#include <__bits/memory/shared_ptr.hpp>
-#include <__bits/memory/weak_ptr.hpp>
-
-namespace std
-{
-    /**
-     * 20.8.2.4, class template owner_less:
-     */
-
-    template<class>
-    struct owner_less;
-
-    template<class T>
-    struct owner_less<shared_ptr<T>>
-    {
-        using retult_type          = bool;
-        using first_argument_type  = shared_ptr<T>;
-        using second_argument_type = shared_ptr<T>;
-
-        bool operator()(const shared_ptr<T>& lhs, const shared_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-
-        bool operator()(const shared_ptr<T>& lhs, const weak_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-
-        bool operator()(const weak_ptr<T>& lhs, const shared_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-    };
-
-    template<class T>
-    struct owner_less<weak_ptr<T>>
-    {
-        using retult_type          = bool;
-        using first_argument_type  = weak_ptr<T>;
-        using second_argument_type = weak_ptr<T>;
-
-        bool operator()(const weak_ptr<T>& lhs, const weak_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-
-        bool operator()(const shared_ptr<T>& lhs, const weak_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-
-        bool operator()(const weak_ptr<T>& lhs, const shared_ptr<T>& rhs) const
-        {
-            return lhs.owner_before(rhs);
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/pointer_traits.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/pointer_traits.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_POINTER_TRAITS
-#define LIBCPP_BITS_MEMORY_POINTER_TRAITS
-
-#include <__bits/memory/addressof.hpp>
-#include <__bits/memory/type_getters.hpp>
-#include <cstddef>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 20.7.3, pointer traits:
-     */
-
-    template<class Ptr>
-    struct pointer_traits
-    {
-        using pointer         = Ptr;
-        using element_type    = typename aux::ptr_get_element_type<Ptr>::type;
-        using difference_type = typename aux::ptr_get_difference_type<Ptr>::type;
-
-        template<class U>
-        using rebind = typename aux::ptr_get_rebind<Ptr, U>::type;
-
-        static pointer pointer_to( // If is_void_t<element_type>, this type is unspecified.
-            conditional_t<is_void_v<element_type>, char, element_type&> x
-        )
-        {
-            return Ptr::pointer_to(x);
-        }
-    };
-
-    template<class T>
-    struct pointer_traits<T*>
-    {
-        using pointer         = T*;
-        using element_type    = T;
-        using difference_type = ptrdiff_t;
-
-        template<class U>
-        using rebind = U*;
-
-        static pointer pointer_to(
-            conditional_t<is_void_v<element_type>, char, element_type&> x
-        )
-        {
-            return std::addressof(x);
-        }
-    };
-
-    /**
-     * 20.7.4, pointer safety:
-     */
-
-    // TODO: implement
-
-    /**
-     * 20.7.5, align:
-     */
-
-    // TODO: implement
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/shared_payload.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/shared_payload.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_SHARED_PAYLOAD
-#define LIBCPP_BITS_MEMORY_SHARED_PAYLOAD
-
-#include <__bits/refcount_obj.hpp>
-#include <cinttypes>
-#include <utility>
-
-namespace std
-{
-    template<class>
-    struct default_delete;
-
-    struct allocator_arg_t;
-}
-
-namespace std::aux
-{
-    /**
-     * This allows us to construct shared_ptr from
-     * a payload pointer in make_shared etc.
-     */
-    struct payload_tag_t
-    { /* DUMMY BODY */ };
-
-    inline constexpr payload_tag_t payload_tag{};
-
-    template<class D, class T>
-    void use_payload_deleter(D* deleter, T* data)
-    {
-        if (deleter)
-            (*deleter)(data);
-    }
-
-    template<class T>
-    class shared_payload_base: public aux::refcount_obj
-    {
-        public:
-            virtual T* get() const noexcept = 0;
-
-            virtual uint8_t* deleter() const noexcept = 0;
-
-            virtual shared_payload_base* lock() noexcept = 0;
-
-            virtual ~shared_payload_base() = default;
-    };
-
-    template<class T, class D = default_delete<T>>
-    class shared_payload: public shared_payload_base<T>
-    {
-        public:
-            shared_payload(T* ptr, D deleter = D{})
-                : data_{ptr}, deleter_{deleter}
-            { /* DUMMY BODY */ }
-
-            template<class... Args>
-            shared_payload(Args&&... args)
-                : data_{new T{forward<Args>(args)...}},
-                  deleter_{}
-            { /* DUMMY BODY */ }
-
-            template<class Alloc, class... Args>
-            shared_payload(allocator_arg_t, Alloc alloc, Args&&... args)
-                : data_{alloc.allocate(1)},
-                  deleter_{}
-            {
-                alloc.construct(data_, forward<Args>(args)...);
-            }
-
-            template<class Alloc, class... Args>
-            shared_payload(D deleter, Alloc alloc, Args&&... args)
-                : data_{alloc.allocate(1)},
-                  deleter_{deleter}
-            {
-                alloc.construct(data_, forward<Args>(args)...);
-            }
-
-            void destroy() override
-            {
-                if (this->refs() == 0)
-                {
-                    if (data_)
-                    {
-                        deleter_(data_);
-                        data_ = nullptr;
-                    }
-
-                    if (this->weak_refs() == 0)
-                        delete this;
-                }
-            }
-
-            T* get() const noexcept override
-            {
-                return data_;
-            }
-
-            uint8_t* deleter() const noexcept override
-            {
-                return (uint8_t*)&deleter_;
-            }
-
-            shared_payload_base<T>* lock() noexcept override
-            {
-                refcount_t rfs = this->refs();
-                while (rfs != 0L)
-                {
-                    if (__atomic_compare_exchange_n(&this->refcount_, &rfs, rfs + 1,
-                                                    true, __ATOMIC_RELAXED,
-                                                    __ATOMIC_RELAXED))
-                    {
-                        return this;
-                    }
-                }
-
-                return nullptr;
-            }
-
-        private:
-            T* data_;
-            D deleter_;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/shared_ptr.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/shared_ptr.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,646 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_SHARED_PTR
-#define LIBCPP_BITS_MEMORY_SHARED_PTR
-
-#include <__bits/functional/arithmetic_operations.hpp>
-#include <__bits/functional/hash.hpp>
-#include <__bits/memory/allocator_arg.hpp>
-#include <__bits/memory/shared_payload.hpp>
-#include <__bits/memory/unique_ptr.hpp>
-#include <__bits/trycatch.hpp>
-#include <exception>
-#include <type_traits>
-
-namespace std
-{
-    template<class T>
-    class weak_ptr;
-
-    /**
-     * 20.8.2.1, class bad_weak_ptr:
-     */
-
-    class bad_weak_ptr: public exception
-    {
-        public:
-            bad_weak_ptr() noexcept = default;
-
-            const char* what() const noexcept override
-            {
-                return "std::bad_weak_ptr";
-            }
-    };
-
-    /**
-     * 20.8.2.2, class template shared_ptr:
-     */
-
-    template<class T>
-    class shared_ptr
-    {
-        public:
-            using element_type = T;
-
-            /**
-             * 20.8.2.2.1, constructors:
-             */
-
-            constexpr shared_ptr() noexcept
-                : payload_{}, data_{}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            explicit shared_ptr(
-                U* ptr,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : payload_{}, data_{ptr}
-            {
-                try
-                {
-                    payload_ = new aux::shared_payload<T>{ptr};
-                }
-                catch (const bad_alloc&)
-                {
-                    delete ptr;
-
-                    throw;
-                }
-            }
-
-            template<class U, class D>
-            shared_ptr(
-                U* ptr, D deleter,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : shared_ptr{}
-            {
-                try
-                {
-                    payload_ = new aux::shared_payload<T, D>{ptr, deleter};
-                }
-                catch (const bad_alloc&)
-                {
-                    deleter(ptr);
-
-                    throw;
-                }
-            }
-
-            template<class U, class D, class A>
-            shared_ptr(
-                U* ptr, D deleter, A,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : shared_ptr{}
-            {
-                try
-                {
-                    payload_ = new aux::shared_payload<T, D>{ptr, deleter};
-                }
-                catch (const bad_alloc&)
-                {
-                    deleter(ptr);
-
-                    throw;
-                }
-            }
-
-            template<class D>
-            shared_ptr(nullptr_t ptr, D deleter)
-                : shared_ptr{}
-            { /* DUMMY BODY */ }
-
-            template<class D, class A>
-            shared_ptr(nullptr_t, D deleter, A)
-                : shared_ptr{}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            shared_ptr(
-                const shared_ptr<U>& other, element_type* ptr,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : payload_{other.payload_}, data_{ptr}
-            {
-                if (payload_)
-                    payload_->increment();
-            }
-
-            shared_ptr(const shared_ptr& other)
-                : payload_{other.payload_}, data_{other.data_}
-            {
-                if (payload_)
-                    payload_->increment();
-            }
-
-            template<class U>
-            shared_ptr(
-                const shared_ptr<U>& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : payload_{other.payload_}, data_{other.data_}
-            {
-                if (payload_)
-                    payload_->increment();
-            }
-
-            shared_ptr(shared_ptr&& other)
-                : payload_{move(other.payload_)}, data_{move(other.data_)}
-            {
-                other.payload_ = nullptr;
-                other.data_ = nullptr;
-            }
-
-            template<class U>
-            shared_ptr(
-                shared_ptr<U>&& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : payload_{move(other.payload_)}, data_{move(other.data_)}
-            {
-                other.payload_ = nullptr;
-                other.data_ = nullptr;
-            }
-
-            template<class U>
-            explicit shared_ptr(
-                const weak_ptr<U>& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            )
-                : payload_{}, data_{}
-            {
-                if (other.expired())
-                    throw bad_weak_ptr{};
-
-                if (other.payload_)
-                {
-                    payload_ = other.payload_->lock();
-                    data_ = payload_->get();
-                }
-            }
-
-            template<class U, class D>
-            shared_ptr(
-                unique_ptr<U, D>&& other,
-                enable_if_t<
-                    is_convertible_v<
-                        typename unique_ptr<U, D>::pointer,
-                        element_type*
-                    >
-                >* = nullptr
-            ) // TODO: if D is a reference type, it should be ref(other.get_deleter())
-                : shared_ptr{other.release(), other.get_deleter()}
-            { /* DUMMY BODY */ }
-
-            constexpr shared_ptr(nullptr_t) noexcept
-                : shared_ptr{}
-            { /* DUMMY BODY */ }
-
-            /**
-             * 20.8.2.2.2, destructor:
-             */
-
-            ~shared_ptr()
-            {
-                remove_payload_();
-            }
-
-            /**
-             * 20.8.2.2.3, assignment:
-             */
-
-            shared_ptr& operator=(const shared_ptr& rhs) noexcept
-            {
-                if (rhs.payload_)
-                    rhs.payload_->increment();
-
-                remove_payload_();
-
-                payload_ = rhs.payload_;
-                data_ = rhs.data_;
-
-                return *this;
-            }
-
-            template<class U>
-            enable_if_t<is_convertible_v<U*, element_type*>, shared_ptr>&
-            operator=(const shared_ptr<U>& rhs) noexcept
-            {
-                if (rhs.payload_)
-                    rhs.payload_->increment();
-
-                remove_payload_();
-
-                payload_ = rhs.payload_;
-                data_ = rhs.data_;
-
-                return *this;
-            }
-
-            shared_ptr& operator=(shared_ptr&& rhs) noexcept
-            {
-                shared_ptr{move(rhs)}.swap(*this);
-
-                return *this;
-            }
-
-            template<class U>
-            shared_ptr& operator=(shared_ptr<U>&& rhs) noexcept
-            {
-                shared_ptr{move(rhs)}.swap(*this);
-
-                return *this;
-            }
-
-            template<class U, class D>
-            shared_ptr& operator=(unique_ptr<U, D>&& rhs)
-            {
-                shared_ptr{move(rhs)}.swap(*this);
-
-                return *this;
-            }
-
-            /**
-             * 20.8.2.2.4, modifiers:
-             */
-
-            void swap(shared_ptr& other) noexcept
-            {
-                std::swap(payload_, other.payload_);
-                std::swap(data_, other.data_);
-            }
-
-            void reset() noexcept
-            {
-                shared_ptr{}.swap(*this);
-            }
-
-            template<class U>
-            void reset(U* ptr)
-            {
-                shared_ptr{ptr}.swap(*this);
-            }
-
-            template<class U, class D>
-            void reset(U* ptr, D deleter)
-            {
-                shared_ptr{ptr, deleter}.swap(*this);
-            }
-
-            template<class U, class D, class A>
-            void reset(U* ptr, D deleter, A alloc)
-            {
-                shared_ptr{ptr, deleter, alloc}.swap(*this);
-            }
-
-            /**
-             * 20.8.2.2.5, observers:
-             */
-
-            element_type* get() const noexcept
-            {
-                return data_;
-            }
-
-            enable_if_t<!is_void_v<T>, T&> operator*() const noexcept
-            {
-                return *data_;
-            }
-
-            T* operator->() const noexcept
-            {
-                return get();
-            }
-
-            long use_count() const noexcept
-            {
-                if (payload_)
-                    return payload_->refs();
-                else
-                    return 0L;
-            }
-
-            bool unique() const noexcept
-            {
-                return use_count() == 1L;
-            }
-
-            explicit operator bool() const noexcept
-            {
-                return get() != nullptr;
-            }
-
-            template<class U>
-            bool owner_before(const shared_ptr<U>& ptr) const
-            {
-                return payload_ < ptr.payload_;
-            }
-
-            template<class U>
-            bool owner_before(const weak_ptr<U>& ptr) const
-            {
-                return payload_ < ptr.payload_;
-            }
-
-        private:
-            aux::shared_payload_base<element_type>* payload_;
-            element_type* data_;
-
-            shared_ptr(aux::payload_tag_t, aux::shared_payload_base<element_type>* payload)
-                : payload_{payload}, data_{payload->get()}
-            { /* DUMMY BODY */ }
-
-            void remove_payload_()
-            {
-                if (payload_)
-                {
-                    auto res = payload_->decrement();
-                    if (res)
-                        payload_->destroy();
-
-                    payload_ = nullptr;
-                }
-
-                if (data_)
-                    data_ = nullptr;
-            }
-
-            template<class U, class... Args>
-            friend shared_ptr<U> make_shared(Args&&...);
-
-            template<class U, class A, class... Args>
-            friend shared_ptr<U> allocate_shared(const A&, Args&&...);
-
-            template<class D, class U>
-            D* get_deleter(const shared_ptr<U>&) noexcept;
-
-            template<class U>
-            friend class weak_ptr;
-    };
-
-    /**
-     * 20.8.2.2.6, shared_ptr creation:
-     * Note: According to the standard, these two functions
-     *       should perform at most one memory allocation
-     *       (should, don't have to :P). It might be better
-     *       to create payloads that embed the type T to
-     *       perform this optimization.
-     */
-
-    template<class T, class... Args>
-    shared_ptr<T> make_shared(Args&&... args)
-    {
-        return shared_ptr<T>{
-            aux::payload_tag,
-            new aux::shared_payload<T>{forward<Args>(args)...}
-        };
-    }
-
-    template<class T, class A, class... Args>
-    shared_ptr<T> allocate_shared(const A& alloc, Args&&... args)
-    {
-        return shared_ptr<T>{
-            aux::payload_tag,
-            new aux::shared_payload<T>{allocator_arg, A{alloc}, forward<Args>(args)...}
-        };
-    }
-
-    /**
-     * 20.8.2.2.7, shared_ptr comparisons:
-     */
-
-    template<class T, class U>
-    bool operator==(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return lhs.get() == rhs.get();
-    }
-
-    template<class T, class U>
-    bool operator!=(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class T, class U>
-    bool operator<(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return less<common_type_t<T*, U*>>{}(lhs.get(), rhs.get());
-    }
-
-    template<class T, class U>
-    bool operator>(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return rhs < lhs;
-    }
-
-    template<class T, class U>
-    bool operator<=(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class T, class U>
-    bool operator>=(const shared_ptr<T>& lhs, const shared_ptr<U>& rhs) noexcept
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class T>
-    bool operator==(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return !lhs;
-    }
-
-    template<class T>
-    bool operator==(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return !rhs;
-    }
-
-    template<class T>
-    bool operator!=(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return (bool)lhs;
-    }
-
-    template<class T>
-    bool operator!=(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return (bool)rhs;
-    }
-
-    template<class T>
-    bool operator<(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return less<T*>{}(lhs.get(), nullptr);
-    }
-
-    template<class T>
-    bool operator<(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return less<T*>{}(nullptr, rhs.get());
-    }
-
-    template<class T>
-    bool operator>(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return nullptr < lhs;
-    }
-
-    template<class T>
-    bool operator>(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return rhs < nullptr;
-    }
-
-    template<class T>
-    bool operator<=(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return !(nullptr < lhs);
-    }
-
-    template<class T>
-    bool operator<=(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return !(rhs < nullptr);
-    }
-
-    template<class T>
-    bool operator>=(const shared_ptr<T>& lhs, nullptr_t) noexcept
-    {
-        return !(lhs < nullptr);
-    }
-
-    template<class T>
-    bool operator>=(nullptr_t, const shared_ptr<T>& rhs) noexcept
-    {
-        return !(nullptr < rhs);
-    }
-
-    /**
-     * 20.8.2.2.8, shared_ptr specialized algorithms:
-     */
-
-    template<class T>
-    void swap(shared_ptr<T>& lhs, shared_ptr<T>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 20.8.2.2.9, shared_ptr casts:
-     */
-
-    template<class T, class U>
-    shared_ptr<T> static_pointer_cast(const shared_ptr<U>& ptr) noexcept
-    {
-        if (!ptr)
-            return shared_ptr<T>{};
-
-        return shared_ptr<T>{
-            ptr, static_cast<T*>(ptr.get())
-        };
-    }
-
-    template<class T, class U>
-    shared_ptr<T> dynamic_pointer_cast(const shared_ptr<U>& ptr) noexcept
-    {
-        if (auto res = dynamic_cast<T*>(ptr.get()))
-            return shared_ptr<T>{ptr, res};
-        else
-            return shared_ptr<T>{};
-    }
-
-    template<class T, class U>
-    shared_ptr<T> const_pointer_cast(const shared_ptr<U>& ptr) noexcept
-    {
-        if (!ptr)
-            return shared_ptr<T>{};
-
-        return shared_ptr<T>{
-            ptr, const_cast<T*>(ptr.get())
-        };
-    }
-
-    /**
-     * 20.8.2.2.10, shared_ptr get_deleter:
-     */
-
-    template<class D, class T>
-    D* get_deleter(const shared_ptr<T>& ptr) noexcept
-    {
-        if (ptr.payload_)
-            return static_cast<D*>(ptr.payload_->deleter());
-        else
-            return nullptr;
-    }
-
-    /**
-     * 20.8.2.2.11, shared_ptr I/O:
-     */
-
-    template<class Char, class Traits, class T>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const shared_ptr<T>& ptr)
-    {
-        return os << ptr.get();
-    }
-
-    /**
-     * 20.8.2.5, class template enable_shared_from_this:
-     */
-
-    // TODO: implement
-
-    /**
-     * 20.8.2.6, shared_ptr atomic access
-     */
-
-    // TODO: implement
-
-    /**
-     * 20.8.2.7, smart pointer hash support:
-     */
-
-    template<class T>
-    struct hash<shared_ptr<T>>
-    {
-        size_t operator()(const shared_ptr<T>& ptr) const noexcept
-        {
-            return hash<T*>{}(ptr.get());
-        }
-
-        using argument_type = shared_ptr<T>;
-        using result_type   = size_t;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/type_getters.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/type_getters.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_TYPE_GETTERS
-#define LIBCPP_BITS_MEMORY_TYPE_GETTERS
-
-/**
- * Allocator and pointer traits require us to provide
- * conditional typedefs based on whether the wrapped
- * allocator contains them or not. To avoid unnecessary
- * code clutter in <memory>, we moved them to their
- * separate header (though note that these metafunctions
- * have no use outside of <memory>).
- */
-
-#include <__bits/aux.hpp>
-#include <cstddef>
-#include <type_traits>
-
-namespace std
-{
-    template<class T>
-    struct pointer_traits;
-}
-
-namespace std::aux
-{
-    /**
-     * Pointer traits:
-     */
-
-    template<class Ptr, class = void>
-    struct ptr_get_element_type
-    { /* DUMMY BODY */ };
-
-    template<class Ptr>
-    struct ptr_get_element_type<Ptr, void_t<typename Ptr::element_type>>
-        : aux::type_is<typename Ptr::element_type>
-    { /* DUMMY BODY */ };
-
-    template<template <class, class...> class Ptr, class T, class... Args>
-    struct ptr_get_element_type<
-        Ptr<T, Args...>, void_t<typename Ptr<T, Args...>::element_type>
-    >: aux::type_is<typename Ptr<T, Args...>::element_type>
-    { /* DUMMY BODY */ };
-
-    template<class Ptr, class = void>
-    struct ptr_get_difference_type: aux::type_is<ptrdiff_t>
-    { /* DUMMY BODY */ };
-
-    template<class Ptr>
-    struct ptr_get_difference_type<Ptr, void_t<typename Ptr::difference_type>>
-        : aux::type_is<typename Ptr::difference_type>
-    { /* DUMMY BODY */ };
-
-    template<class Ptr, class U, class = void>
-    struct ptr_get_rebind
-    { /* DUMMY BODY */ };
-
-    template<class Ptr, class U>
-    struct ptr_get_rebind<Ptr, U, void_t<typename Ptr::template rebind<U>>>
-        : aux::type_is<typename Ptr::template rebind<U>>
-    { /* DUMMY BODY */ };
-
-    template<template <class, class...> class Ptr, class T, class... Args, class U>
-    struct ptr_get_rebind<Ptr<T, Args...>, U>
-        : aux::type_is<Ptr<U, Args...>>
-    { /* DUMMY BODY */ };
-
-    /**
-     * Allocator traits:
-     */
-
-    template<class T, class = void>
-    struct alloc_get_pointer: aux::type_is<typename T::value_type*>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct alloc_get_pointer<T, void_t<typename T::pointer>>
-        : aux::type_is<typename T::pointer>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr, class = void>
-    struct alloc_get_const_pointer
-        : aux::type_is<typename pointer_traits<Ptr>::template rebind<const typename T::value_type>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr>
-    struct alloc_get_const_pointer<T, Ptr, void_t<typename T::const_pointer>>
-        : aux::type_is<typename T::const_pointer>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr, class = void>
-    struct alloc_get_void_pointer
-        : aux::type_is<typename pointer_traits<Ptr>::template rebind<void>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr>
-    struct alloc_get_void_pointer<T, Ptr, void_t<typename T::void_pointer>>
-        : aux::type_is<typename T::void_pointer>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr, class = void>
-    struct alloc_get_const_void_pointer
-        : aux::type_is<typename pointer_traits<Ptr>::template rebind<const void>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr>
-    struct alloc_get_const_void_pointer<T, Ptr, void_t<typename T::const_void_pointer>>
-        : aux::type_is<typename T::const_void_pointer>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr, class = void>
-    struct alloc_get_difference_type
-        : aux::type_is<typename pointer_traits<Ptr>::difference_type>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Ptr>
-    struct alloc_get_difference_type<T, Ptr, void_t<typename T::difference_type>>
-        : aux::type_is<typename T::difference_type>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Difference, class = void>
-    struct alloc_get_size_type: aux::type_is<make_unsigned_t<Difference>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class Difference>
-    struct alloc_get_size_type<T, Difference, void_t<typename T::size_type>>
-        : aux::type_is<typename T::size_type>
-    { /* DUMMY BODY */ };
-
-    template<class T, class = void>
-    struct alloc_get_copy_propagate: aux::type_is<false_type>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct alloc_get_copy_propagate<T, void_t<typename T::propagate_on_container_copy_assignment>>
-        : aux::type_is<typename T::propagate_on_container_copy_assignment>
-    { /* DUMMY BODY */ };
-
-    template<class T, class = void>
-    struct alloc_get_move_propagate: aux::type_is<false_type>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct alloc_get_move_propagate<T, void_t<typename T::propagate_on_container_move_assignment>>
-        : aux::type_is<typename T::propagate_on_container_move_assignment>
-    { /* DUMMY BODY */ };
-
-    template<class T, class = void>
-    struct alloc_get_swap_propagate: aux::type_is<false_type>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct alloc_get_swap_propagate<T, void_t<typename T::propagate_on_container_swap>>
-        : aux::type_is<typename T::propagate_on_container_swap>
-    { /* DUMMY BODY */ };
-
-    template<class T, class = void>
-    struct alloc_get_always_equal: aux::type_is<typename is_empty<T>::type>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct alloc_get_always_equal<T, void_t<typename T::is_always_equal>>
-        : aux::type_is<typename T::is_always_equal>
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T, class = void>
-    struct alloc_get_rebind_alloc
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T>
-    struct alloc_get_rebind_alloc<Alloc, T, void_t<typename Alloc::template rebind<T>::other>>
-        : aux::type_is<typename Alloc::template rebind<T>::other>
-    { /* DUMMY BODY */ };
-
-    template<template <class, class...> class Alloc, class U, class... Args, class T>
-    struct alloc_get_rebind_alloc<Alloc<U, Args...>, T>
-        : aux::type_is<Alloc<T, Args...>>
-    { /* DUMMY BODY */ };
-
-    /**
-     * These metafunctions are used to check whether an expression
-     * is well-formed for the static functions of allocator_traits:
-     */
-
-    template<class Alloc, class Size, class ConstVoidPointer, class = void>
-    struct alloc_has_hint_allocate: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class Size, class ConstVoidPointer>
-    struct alloc_has_hint_allocate<
-        Alloc, Size, ConstVoidPointer, void_t<
-            decltype(declval<Alloc>().alloc(declval<Size>(), declval<ConstVoidPointer>()))
-        >
-    >: true_type
-    { /* DUMMY BODY */ };
-
-    template<class, class Alloc, class T, class... Args>
-    struct alloc_has_construct_impl: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T, class... Args>
-    struct alloc_has_construct_impl<
-        void_t<decltype(declval<Alloc>().construct(declval<T*>(), forward<Args>(declval<Args>())...))>,
-        Alloc, T, Args...
-    >: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T, class = void>
-    struct alloc_has_destroy: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T>
-    struct alloc_has_destroy<Alloc, T, void_t<decltype(declval<Alloc>().destroy(declval<T>()))>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class T, class... Args>
-    struct alloc_has_construct
-        : alloc_has_construct_impl<void_t<>, Alloc, T, Args...>
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class = void>
-    struct alloc_has_max_size: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc>
-    struct alloc_has_max_size<Alloc, void_t<decltype(declval<Alloc>().max_size())>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc, class = void>
-    struct alloc_has_select: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Alloc>
-    struct alloc_has_select<
-        Alloc, void_t<
-            decltype(declval<Alloc>().select_on_container_copy_construction())
-        >
-    >: true_type
-    { /* DUMMY BODY */ };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/unique_ptr.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/unique_ptr.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,649 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_UNIQUE_PTR
-#define LIBCPP_BITS_MEMORY_UNIQUE_PTR
-
-#include <__bits/aux.hpp>
-#include <__bits/functional/hash.hpp>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 20.8, smart pointers:
-     */
-
-    template<class T>
-    struct default_delete
-    {
-        default_delete() noexcept = default;
-
-        template<class U, class = enable_if_t<is_convertible_v<U*, T*>, void>>
-        default_delete(const default_delete<U>&) noexcept
-        { /* DUMMY BODY */ }
-
-        template<class U>
-        void operator()(U* ptr)
-        {
-            delete ptr;
-        }
-    };
-
-    template<class T>
-    struct default_delete<T[]>
-    {
-        default_delete() noexcept = default;
-
-        template<class U, class = enable_if_t<is_convertible_v<U(*)[], T(*)[]>, void>>
-        default_delete(const default_delete<U[]>&) noexcept
-        { /* DUMMY BODY */ }
-
-        template<class U, class = enable_if_t<is_convertible_v<U(*)[], T(*)[]>, void>>
-        void operator()(U* ptr)
-        {
-            delete[] ptr;
-        }
-    };
-
-    template<class T, class D = default_delete<T>>
-    class unique_ptr;
-
-    namespace aux
-    {
-        template<class P, class D, class = void>
-        struct get_unique_pointer: type_is<typename P::element_type*>
-        { /* DUMMY BODY */ };
-
-        template<class P, class D>
-        struct get_unique_pointer<P, D, void_t<typename remove_reference_t<D>::pointer>>
-            : type_is<typename remove_reference_t<D>::pointer>
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T, class D>
-    class unique_ptr
-    {
-        public:
-            using element_type = T;
-            using deleter_type = D;
-            using pointer      = typename aux::get_unique_pointer<unique_ptr<T, D>, D>::type;
-
-            /**
-             * 20.8.1.2.1, constructors:
-             */
-
-            constexpr unique_ptr() noexcept
-                : ptr_{}, deleter_{}
-            { /* DUMMY BODY */ }
-
-            explicit unique_ptr(pointer ptr) noexcept
-                : ptr_{ptr}, deleter_{}
-            { /* DUMMY BODY */ }
-
-            unique_ptr(pointer ptr, /* TODO */ int d) noexcept;
-
-            unique_ptr(pointer ptr, /* TODO */ char d) noexcept;
-
-            unique_ptr(unique_ptr&& other)
-                : ptr_{move(other.ptr_)}, deleter_{forward<deleter_type>(other.deleter_)}
-            {
-                other.ptr_ = nullptr;
-            }
-
-            constexpr unique_ptr(nullptr_t)
-                : unique_ptr{}
-            { /* DUMMY BODY */ }
-
-            template<
-                class U, class E,
-                class = enable_if_t<
-                    is_convertible_v<
-                        typename unique_ptr<U, E>::pointer,
-                        pointer
-                    >, void
-                >
-            >
-            unique_ptr(unique_ptr<U, E>&& other) noexcept
-                : ptr_{move(other.ptr_)}, deleter_{forward<D>(other.deleter_)}
-            {
-                other.ptr_ = nullptr;
-            }
-
-            /**
-             * 20.8.1.2.2, destructor:
-             */
-
-            ~unique_ptr()
-            {
-                if (ptr_)
-                    deleter_(ptr_);
-            }
-
-            /**
-             * 20.8.1.2.3, assignment:
-             */
-
-            unique_ptr& operator=(unique_ptr&& rhs) noexcept
-            {
-                reset(rhs.release());
-                deleter_ = forward<deleter_type>(rhs.get_deleter());
-
-                return *this;
-            }
-
-            template<
-                class U, class E,
-                class = enable_if_t<
-                    is_convertible_v<
-                        typename unique_ptr<U, E>::pointer,
-                        pointer
-                    > && !is_array_v<U>, void
-                >
-            >
-            unique_ptr& operator=(unique_ptr<U, E>&& rhs) noexcept
-            {
-                reset(rhs.release());
-                deleter_ = forward<E>(rhs.get_deleter());
-
-                return *this;
-            }
-
-            unique_ptr& operator=(nullptr_t) noexcept
-            {
-                reset();
-
-                return *this;
-            }
-
-            /**
-             * 20.8.1.2.4, observers:
-             */
-
-            add_lvalue_reference_t<element_type> operator*() const
-            {
-                return *ptr_;
-            }
-
-            pointer operator->() const noexcept
-            {
-                return ptr_;
-            }
-
-            pointer get() const noexcept
-            {
-                return ptr_;
-            }
-
-            deleter_type& get_deleter() noexcept
-            {
-                return deleter_;
-            }
-
-            const deleter_type& get_deleter() const noexcept
-            {
-                return deleter_;
-            }
-
-            explicit operator bool() const noexcept
-            {
-                return ptr_ != nullptr;
-            }
-
-            /**
-             * 20.8.1.2.5, modifiers:
-             */
-
-            pointer release() noexcept
-            {
-                auto ret = ptr_;
-                ptr_ = nullptr;
-
-                return ret;
-            }
-
-            void reset(pointer ptr = pointer{}) noexcept
-            {
-                /**
-                 * Note: Order is significant, deleter may delete
-                 *       *this.
-                 */
-                auto old = ptr_;
-                ptr_ = ptr;
-
-                if (old)
-                    deleter_(old);
-            }
-
-            void swap(unique_ptr& other) noexcept
-            {
-                std::swap(ptr_, other.ptr_);
-                std::swap(deleter_, other.deleter_);
-            }
-
-            unique_ptr(const unique_ptr&) = delete;
-            unique_ptr& operator=(const unique_ptr&) = delete;
-
-        private:
-            pointer ptr_;
-            deleter_type deleter_;
-    };
-
-    namespace aux
-    {
-        template<class From, class To>
-        struct is_convertible_array: is_convertible<From(*)[], To(*)[]>
-        { /* DUMMY BODY */ };
-
-        template<class From, class To>
-        inline constexpr bool is_convertible_array_v = is_convertible_array<From, To>::value;
-
-        template<class T, class D, class U, class E>
-        struct compatible_ptrs: integral_constant<
-              bool,
-              is_array_v<U> && is_same_v<
-                typename unique_ptr<T, D>::pointer,
-                typename unique_ptr<T, D>::element_type*
-              > && is_same_v<
-                typename unique_ptr<U, E>::pointer,
-                typename unique_ptr<U, E>::element_type*
-              > && is_convertible_array_v<
-                typename unique_ptr<T, D>::element_type,
-                typename unique_ptr<U, E>::element_type
-              > && ((is_reference_v<D> && is_same_v<D, E>) ||
-                   (!is_reference_v<D> && is_convertible_v<E, D>))
-        >
-        { /* DUMMY BODY */ };
-
-        template<class T, class D, class U, class E>
-        inline constexpr bool compatible_ptrs_v = compatible_ptrs<T, D, U, E>::value;
-    }
-
-    template<class T, class D>
-    class unique_ptr<T[], D>
-    {
-        public:
-            using element_type = T;
-            using deleter_type = D;
-            using pointer      = typename aux::get_unique_pointer<unique_ptr<T[], D>, D>::type;
-
-            /**
-             * 20.8.1.3.1, constructors:
-             */
-
-            constexpr unique_ptr() noexcept
-                : ptr_{}, deleter_{}
-            { /* DUMMY BODY */ }
-
-            template<
-                class U,
-                class = enable_if_t<
-                    is_same_v<U, T> || aux::is_convertible_array_v<U, T>, void
-                >
-            >
-            explicit unique_ptr(U ptr) noexcept
-                : ptr_{ptr}, deleter_{}
-            { /* DUMMY BODY */ }
-
-            template<
-                class U, class E,
-                class = enable_if_t<aux::compatible_ptrs_v<T, D, U, E>, void>
-            >
-            unique_ptr(U ptr, /* TODO */ int d) noexcept;
-
-            template<
-                class U, class E,
-                class = enable_if_t<aux::compatible_ptrs_v<T, D, U, E>, void>
-            >
-            unique_ptr(U ptr, /* TODO */ char d) noexcept;
-
-            unique_ptr(unique_ptr&& other) noexcept
-                : ptr_{move(other.ptr_)}, deleter_{forward<deleter_type>(other.deleter_)}
-            {
-                other.ptr_ = nullptr;
-            }
-
-            template<
-                class U, class E,
-                class = enable_if_t<
-                    is_same_v<U, pointer> ||
-                    (is_same_v<pointer, element_type*> && is_pointer_v<U> &&
-                     aux::is_convertible_array_v<remove_pointer_t<U>, element_type>),
-                    void
-                >
-            >
-            unique_ptr(unique_ptr<U, E>&& other) noexcept
-                : ptr_{move(other.ptr_)}, deleter_{forward<D>(other.deleter_)}
-            {
-                other.ptr_ = nullptr;
-            }
-
-            constexpr unique_ptr(nullptr_t) noexcept
-                : unique_ptr{}
-            { /* DUMMY BODY */ }
-
-            ~unique_ptr()
-            {
-                if (ptr_)
-                    deleter_(ptr_);
-            }
-
-            /**
-             * 20.8.1.3.2, assignment:
-             */
-
-            unique_ptr& operator=(unique_ptr&& rhs) noexcept
-            {
-                reset(rhs.release());
-                deleter_ = forward<deleter_type>(rhs.get_deleter());
-
-                return *this;
-            }
-
-            template<
-                class U, class E,
-                class = enable_if_t<aux::compatible_ptrs_v<T, D, U, E>, void>
-            >
-            unique_ptr& operator=(unique_ptr<U, E>&& rhs) noexcept
-            {
-                reset(rhs.release());
-                deleter_ = forward<E>(rhs.get_deleter());
-
-                return *this;
-            }
-
-            unique_ptr& operator=(nullptr_t) noexcept
-            {
-                reset();
-
-                return *this;
-            }
-
-            /**
-             * 20.8.1.3.3, observers:
-             */
-
-            element_type& operator[](size_t idx) const
-            {
-                return ptr_[idx];
-            }
-
-            pointer get() const noexcept
-            {
-                return ptr_;
-            }
-
-            deleter_type& get_deleter() noexcept
-            {
-                return deleter_;
-            }
-
-            const deleter_type& get_deleter() const noexcept
-            {
-                return deleter_;
-            }
-
-            explicit operator bool() const noexcept
-            {
-                return ptr_ != nullptr;
-            }
-
-            /**
-             * 20.8.1.3.4, modifiers:
-             */
-
-            pointer release() noexcept
-            {
-                auto ret = ptr_;
-                ptr_ = nullptr;
-
-                return ret;
-            }
-
-            template<
-                class U,
-                class = enable_if_t<
-                    is_same_v<U, pointer> ||
-                    (is_same_v<pointer, element_type*> && is_pointer_v<U> &&
-                     aux::is_convertible_array_v<remove_pointer_t<U>, element_type>),
-                    void
-                >
-            >
-            void reset(U ptr) noexcept
-            {
-                /**
-                 * Note: Order is significant, deleter may delete
-                 *       *this.
-                 */
-                auto old = ptr_;
-                ptr_ = ptr;
-
-                if (old)
-                    deleter_(old);
-            }
-
-            void reset(nullptr_t = nullptr) noexcept
-            {
-                reset(pointer{});
-            }
-
-            void swap(unique_ptr& other) noexcept
-            {
-                std::swap(ptr_, other.ptr_);
-                std::swap(deleter_, other.deleter_);
-            }
-
-            unique_ptr(const unique_ptr&) = delete;
-            unique_ptr& operator=(const unique_ptr&) = delete;
-
-        private:
-            pointer ptr_;
-            deleter_type deleter_;
-    };
-
-    namespace aux
-    {
-        template<class T>
-        struct is_unbound_array: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_unbound_array<T[]>: true_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_bound_array: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, size_t N>
-        struct is_bound_array<T[N]>: true_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<
-        class T, class... Args,
-        class = enable_if_t<!is_array_v<T>, void>
-    >
-    unique_ptr<T> make_unique(Args&&... args)
-    {
-        return unique_ptr<T>(new T(forward<Args>(args)...));
-    }
-
-    template<
-        class T, class = enable_if_t<aux::is_unbound_array<T>::value, void>
-    >
-    unique_ptr<T> make_unique(size_t n)
-    {
-        return unique_ptr<T>(new remove_extent_t<T>[n]());
-    }
-
-    template<
-        class T, class... Args,
-        class = enable_if_t<aux::is_bound_array<T>::value, void>
-    >
-    void make_unique(Args&&...) = delete;
-
-    template<class T, class D>
-    void swap(unique_ptr<T, D>& lhs, unique_ptr<T, D>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator==(const unique_ptr<T1, D1>& lhs,
-                    const unique_ptr<T2, D2>& rhs)
-    {
-        return lhs.get() == rhs.get();
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator!=(const unique_ptr<T1, D1>& lhs,
-                    const unique_ptr<T2, D2>& rhs)
-    {
-        return lhs.get() != rhs.get();
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator<(const unique_ptr<T1, D1>& lhs,
-                   const unique_ptr<T2, D2>& rhs)
-    {
-        return lhs.get() < rhs.get();
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator<=(const unique_ptr<T1, D1>& lhs,
-                    const unique_ptr<T2, D2>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator>(const unique_ptr<T1, D1>& lhs,
-                   const unique_ptr<T2, D2>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class T1, class D1, class T2, class D2>
-    bool operator>=(const unique_ptr<T1, D1>& lhs,
-                    const unique_ptr<T2, D2>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class T, class D>
-    bool operator==(const unique_ptr<T, D>& ptr, nullptr_t) noexcept
-    {
-        return !ptr;
-    }
-
-    template<class T, class D>
-    bool operator==(nullptr_t, const unique_ptr<T, D>& ptr) noexcept
-    {
-        return !ptr;
-    }
-
-    template<class T, class D>
-    bool operator!=(const unique_ptr<T, D>& ptr, nullptr_t) noexcept
-    {
-        return static_cast<bool>(ptr);
-    }
-
-    template<class T, class D>
-    bool operator!=(nullptr_t, const unique_ptr<T, D>& ptr) noexcept
-    {
-        return static_cast<bool>(ptr);
-    }
-
-    template<class T, class D>
-    bool operator<(const unique_ptr<T, D>& ptr, nullptr_t)
-    {
-        return ptr.get() < nullptr;
-    }
-
-    template<class T, class D>
-    bool operator<(nullptr_t, const unique_ptr<T, D>& ptr)
-    {
-        return nullptr < ptr.get();
-    }
-
-    template<class T, class D>
-    bool operator<=(const unique_ptr<T, D>& ptr, nullptr_t)
-    {
-        return !(nullptr < ptr);
-    }
-
-    template<class T, class D>
-    bool operator<=(nullptr_t, const unique_ptr<T, D>& ptr)
-    {
-        return !(ptr < nullptr);
-    }
-
-    template<class T, class D>
-    bool operator>(const unique_ptr<T, D>& ptr, nullptr_t)
-    {
-        return nullptr < ptr;
-    }
-
-    template<class T, class D>
-    bool operator>(nullptr_t, const unique_ptr<T, D>& ptr)
-    {
-        return ptr < nullptr;
-    }
-
-    template<class T, class D>
-    bool operator>=(const unique_ptr<T, D>& ptr, nullptr_t)
-    {
-        return !(ptr < nullptr);
-    }
-
-    template<class T, class D>
-    bool operator>=(nullptr_t, const unique_ptr<T, D>& ptr)
-    {
-        return !(nullptr < ptr);
-    }
-
-    /**
-     * 20.8.2.7, smart pointer hash support:
-     */
-
-    template<class T, class D>
-    struct hash<unique_ptr<T, D>>
-    {
-        size_t operator()(const unique_ptr<T, D>& ptr) const noexcept
-        {
-            return hash<typename unique_ptr<T, D>::pointer>{}(ptr.get());
-        }
-
-        using argument_type = unique_ptr<T, D>;
-        using result_type   = size_t;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/memory/weak_ptr.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/memory/weak_ptr.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,234 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_MEMORY_WEAK_PTR
-#define LIBCPP_BITS_MEMORY_WEAK_PTR
-
-#include <__bits/memory/shared_payload.hpp>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    template<class T>
-    class shared_ptr;
-
-    /**
-     * 20.8.2.3, class template weak_ptr:
-     */
-
-    template<class T>
-    class weak_ptr
-    {
-        public:
-            using element_type = T;
-
-            /**
-             * 20.8.2.3.1, constructors:
-             */
-
-            constexpr weak_ptr() noexcept
-                : payload_{}
-            { /* DUMMY BODY */ }
-
-            template<class U>
-            weak_ptr(
-                const shared_ptr<U>& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            ) noexcept
-                : payload_{other.payload_}
-            {
-                if (payload_)
-                    payload_->increment_weak();
-            }
-
-            weak_ptr(const weak_ptr& other) noexcept
-                : payload_{other.payload_}
-            {
-                if (payload_)
-                    payload_->increment_weak();
-            }
-
-            template<class U>
-            weak_ptr(
-                const weak_ptr<U>& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            ) noexcept
-                : payload_{other.payload_}
-            {
-                if (payload_)
-                    payload_->increment_weak();
-            }
-
-            weak_ptr(weak_ptr&& other) noexcept
-                : payload_{other.payload_}
-            {
-                other.payload_ = nullptr;
-            }
-
-            template<class U>
-            weak_ptr(
-                weak_ptr<U>&& other,
-                enable_if_t<is_convertible_v<U*, element_type*>>* = nullptr
-            ) noexcept
-                : payload_{other.payload_}
-            {
-                other.payload_ = nullptr;
-            }
-
-            /**
-             * 20.8.2.3.2, destructor:
-             */
-
-            ~weak_ptr()
-            {
-                remove_payload_();
-            }
-
-            /**
-             * 20.8.2.3.3, assignment:
-             */
-
-            weak_ptr& operator=(const weak_ptr& rhs) noexcept
-            {
-                remove_payload_();
-
-                payload_ = rhs.payload_;
-                if (payload_)
-                    payload_->increment_weak();
-
-                return *this;
-            }
-
-            template<class U>
-            weak_ptr& operator=(const weak_ptr<U>& rhs) noexcept
-            {
-                weak_ptr{rhs}.swap(*this);
-
-                return *this;
-            }
-
-            template<class U>
-            weak_ptr& operator=(const shared_ptr<U>& rhs) noexcept
-            {
-                weak_ptr{rhs}.swap(*this);
-
-                return *this;
-            }
-
-            weak_ptr& operator=(weak_ptr&& rhs) noexcept
-            {
-                weak_ptr{move(rhs)}.swap(*this);
-
-                return *this;
-            }
-
-            template<class U>
-            weak_ptr& operator=(
-                weak_ptr<U>&& rhs
-            ) noexcept
-            {
-                weak_ptr{move(rhs)}.swap(*this);
-
-                return *this;
-            }
-
-            /**
-             * 20.8.2.3.4, modifiers:
-             */
-
-            void swap(weak_ptr& other) noexcept
-            {
-                std::swap(payload_, other.payload_);
-            }
-
-            void reset() noexcept
-            {
-                weak_ptr{}.swap(*this);
-            }
-
-            /**
-             * 20.8.2.3.5, observers:
-             */
-
-            long use_count() const noexcept
-            {
-                if (payload_)
-                    return payload_->refs();
-                else
-                    return 0L;
-            }
-
-            bool expired() const noexcept
-            {
-                return use_count() == 0L;
-            }
-
-            shared_ptr<T> lock() const noexcept
-            {
-                return shared_ptr{aux::payload_tag, payload_->lock()};
-            }
-
-            template<class U>
-            bool owner_before(const shared_ptr<U>& other) const
-            {
-                return payload_ < other.payload_;
-            }
-
-            template<class U>
-            bool owner_before(const weak_ptr<U>& other) const
-            {
-                return payload_ < other.payload_;
-            }
-
-        private:
-            aux::shared_payload_base<T>* payload_;
-
-            void remove_payload_()
-            {
-                if (payload_ && payload_->decrement_weak())
-                    payload_->destroy();
-                payload_ = nullptr;
-            }
-
-            template<class U>
-            friend class shared_ptr;
-    };
-
-    /**
-     * 20.8.2.3.6, specialized algorithms:
-     */
-
-    template<class T>
-    void swap(weak_ptr<T>& lhs, weak_ptr<T>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/new.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/new.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_NEW
-#define LIBCPP_BITS_NEW
-
-#include <cstddef>
-#include <exception>
-
-namespace std
-{
-
-class bad_alloc: public std::exception
-{
-	public:
-		bad_alloc() = default;
-		bad_alloc(const bad_alloc&) = default;
-		bad_alloc& operator=(const bad_alloc&) = default;
-		virtual const char* what() const noexcept override;
-		virtual ~bad_alloc() = default;
-};
-
-struct nothrow_t {};
-extern const nothrow_t nothrow;
-
-using new_handler = void (*)();
-
-new_handler set_new_handler(new_handler);
-new_handler get_new_handler() noexcept;
-
-}
-
-void* operator new(std::size_t);
-void* operator new(std::size_t, void*);
-void* operator new(std::size_t, const std::nothrow_t&) noexcept;
-void* operator new[](std::size_t);
-void* operator new[](std::size_t, const std::nothrow_t&) noexcept;
-
-void operator delete(void*) noexcept;
-void operator delete(void*, std::size_t) noexcept;
-void operator delete[](void*) noexcept;
-void operator delete[](void*, std::size_t) noexcept;
-
-#endif
-
Index: pace/lib/cpp/include/__bits/numeric.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/numeric.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_NUMERIC
-#define LIBCPP_BITS_NUMERIC
-
-#include <utility>
-
-namespace std
-{
-
-    /**
-     * 26.7.2, accumulate:
-     */
-
-    template<class InputIterator, class T>
-    T accumulate(InputIterator first, InputIterator last, T init)
-    {
-        auto acc{init};
-        while (first != last)
-            acc += *first++;
-
-        return acc;
-    }
-
-    template<class InputIterator, class T, class BinaryOperation>
-    T accumulate(InputIterator first, InputIterator last, T init,
-                 BinaryOperation op)
-    {
-        auto acc{init};
-        while (first != last)
-            acc = op(acc, *first++);
-
-        return acc;
-    }
-
-    /**
-     * 26.7.3, inner product:
-     */
-
-    template<class InputIterator1, class InputIterator2, class T>
-    T inner_product(InputIterator1 first1, InputIterator1 last1,
-                    InputIterator2 first2, T init)
-    {
-        auto res{init};
-        while (first1 != last1)
-            res += (*first1++) * (*first2++);
-
-        return res;
-    }
-
-    template<class InputIterator1, class InputIterator2, class T,
-             class BinaryOperation1, class BinaryOperation2>
-    T inner_product(InputIterator1 first1, InputIterator1 last1,
-                    InputIterator2 first2, T init,
-                    BinaryOperation1 op1, BinaryOperation2 op2)
-    {
-        auto res{init};
-        while (first1 != last1)
-            res = op1(res, op2(*first1++, *first2++));
-
-        return res;
-    }
-
-    /**
-     * 26.7.4, partial sum:
-     */
-
-    template<class InputIterator, class OutputIterator>
-    OutputIterator partial_sum(InputIterator first, InputIterator last,
-                               OutputIterator result)
-    {
-        if (first == last)
-            return result;
-
-        auto acc{*first++};
-        *result++ = acc;
-
-        while (first != last)
-            *result++ = acc = acc + *first++;
-
-        return result;
-    }
-
-    template<class InputIterator, class OutputIterator, class BinaryOperation>
-    OutputIterator partial_sum(InputIterator first, InputIterator last,
-                               OutputIterator result, BinaryOperation op)
-    {
-        if (first == last)
-            return result;
-
-        auto acc{*first++};
-        *result++ = acc;
-
-        while (first != last)
-            *result++ = acc = op(acc, *first++);
-
-        return result;
-    }
-
-    /**
-     * 26.7.5, adjacent difference:
-     */
-
-    template<class InputIterator, class OutputIterator>
-    OutputIterator adjacent_difference(InputIterator first, InputIterator last,
-                                       OutputIterator result)
-    {
-        if (first == last)
-            return result;
-
-        auto acc{*first++};
-        *result++ = acc;
-
-        while (first != last)
-        {
-            auto val = *first++;
-            *result++ = val - acc;
-            acc = move(val);
-        }
-
-        return result;
-    }
-
-    template<class InputIterator, class OutputIterator, class BinaryOperation>
-    OutputIterator adjacent_difference(InputIterator first, InputIterator last,
-                                       OutputIterator result, BinaryOperation op)
-    {
-        if (first == last)
-            return result;
-
-        auto acc{*first++};
-        *result++ = acc;
-
-        while (first != last)
-        {
-            auto val = *first++;
-            *result++ = op(val, acc);
-            acc = move(val);
-        }
-
-        return result;
-    }
-
-    /**
-     * 26.7.6, iota:
-     */
-
-    template<class ForwardIterator, class T>
-    void iota(ForwardIterator first, ForwardIterator last, T value)
-    {
-        while (first != last)
-            *first++ = value++;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/random.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/random.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1583 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_RANDOM
-#define LIBCPP_BITS_RANDOM
-
-#include <__bits/builtins.hpp>
-#include <cstdint>
-#include <cstdlib>
-#include <ctime>
-#include <initializer_list>
-#include <limits>
-#include <type_traits>
-#include <vector>
-
-/**
- * Note: Variables with one or two lettered
- *       names here are named after their counterparts in
- *       the standard. If one needs to understand their meaning,
- *       they should seek the mentioned standard section near
- *       the declaration of these variables.
- * Note: There will be a lot of mathematical expressions in this header.
- *       All of these are taken directly from the standard's requirements
- *       and as such won't be commented here, check the appropriate
- *       sections if you need explanation of these forumulae.
- */
-
-namespace std
-{
-    namespace aux
-    {
-        /**
-         * This is the minimum requirement imposed by the
-         * standard for a type to qualify as a seed sequence
-         * in overloading resolutions.
-         * (This is because the engines have constructors
-         * that accept sequence and seed and without this
-         * minimal requirements overload resolution would fail.)
-         */
-        template<class Sequence, class ResultType>
-        struct is_seed_sequence
-            : aux::value_is<
-            bool, !is_convertible_v<Sequence, ResultType>
-        >
-        { /* DUMMY BODY */ };
-
-        template<class T, class Engine>
-        inline constexpr bool is_seed_sequence_v = is_seed_sequence<T, Engine>::value;
-    }
-
-    /**
-     * 26.5.3.1, class template linear_congruential_engine:
-     */
-
-    template<class UIntType, UIntType a, UIntType c, UIntType m>
-    class linear_congruential_engine
-    {
-        static_assert(m == 0 || (a < m && c < m));
-
-        public:
-            using result_type = UIntType;
-
-            static constexpr result_type multiplier = a;
-            static constexpr result_type increment = c;
-            static constexpr result_type modulus = m;
-
-            static constexpr result_type min()
-            {
-                return c == 0U ? 1U : 0U;
-            }
-
-            static constexpr result_type max()
-            {
-                return m - 1U;
-            }
-
-            static constexpr result_type default_seed = 1U;
-
-            explicit linear_congruential_engine(result_type s = default_seed)
-                : state_{}
-            {
-                seed(s);
-            }
-
-            linear_congruential_engine(const linear_congruential_engine& other)
-                : state_{other.state_}
-            { /* DUMMY BODY */ }
-
-            template<class Seq>
-            explicit linear_congruential_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : state_{}
-            {
-                seed(q);
-            }
-
-            void seed(result_type s = default_seed)
-            {
-                if (c % modulus_ == 0 && s % modulus_ == 0)
-                    state_ = 1;
-                else
-                    state_ = s % modulus_;
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                auto k = static_cast<size_t>(aux::ceil(aux::log2(modulus_) / 32));
-                auto arr = new result_type[k + 3];
-
-                q.generate(arr, arr + k + 3);
-
-                result_type s{};
-                for (size_t j = 0; j < k; ++j)
-                    s += arr[j + 3] * aux::pow2(32U * j);
-                s = s % modulus_;
-
-                if (c % modulus_ == 0 && s == 0)
-                    state_ = 1;
-                else
-                    state_ = s % modulus_;
-                delete[] arr;
-            }
-
-            result_type operator()()
-            {
-                return generate_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    transition_();
-            }
-
-            bool operator==(const linear_congruential_engine& rhs) const
-            {
-                return state_ = rhs.state_;
-            }
-
-            bool operator!=(const linear_congruential_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                os << state_;
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                result_type tmp{};
-                if (is >> tmp)
-                    state_ = tmp;
-                else
-                    is.setstate(ios::failbit);
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            result_type state_;
-
-            static constexpr result_type modulus_ =
-                (m == 0) ? (numeric_limits<result_type>::max() + 1) : m;
-
-            void transition_()
-            {
-                state_ = (a * state_ + c) % modulus_;
-            }
-
-            result_type generate_()
-            {
-                transition_();
-
-                return state_;
-            }
-    };
-
-    /**
-     * 26.5.3.2, class template mersenne_twister_engine:
-     */
-
-    template<
-        class UIntType, size_t w, size_t n, size_t m, size_t r,
-        UIntType a, size_t u, UIntType d, size_t s,
-        UIntType b, size_t t, UIntType c, size_t l, UIntType f
-    >
-    class mersenne_twister_engine
-    {
-        // TODO: fix these
-        /* static_assert(0 < m && m <= n); */
-        /* static_assert(2 * u < w); */
-        /* static_assert(r <= w && u <= w && s <= w && t <= w && l <= w); */
-        /* /1* static_assert(w <= numeric_limits<UIntType>::digits); *1/ */
-        /* static_assert(a <= (1U << w) - 1U); */
-        /* static_assert(b <= (1U << w) - 1U); */
-        /* static_assert(c <= (1U << w) - 1U); */
-        /* static_assert(d <= (1U << w) - 1U); */
-        /* static_assert(f <= (1U << w) - 1U); */
-
-        public:
-            using result_type = UIntType;
-
-            static constexpr size_t word_size = w;
-            static constexpr size_t state_size = n;
-            static constexpr size_t shift_size = m;
-            static constexpr size_t mask_bits = r;
-            static constexpr UIntType xor_mask = a;
-
-            static constexpr size_t tempering_u = u;
-            static constexpr UIntType tempering_d = d;
-            static constexpr size_t tempering_s = s;
-            static constexpr UIntType tempering_b = b;
-            static constexpr size_t tempering_t = t;
-            static constexpr UIntType tempering_c = c;
-            static constexpr size_t tempering_l = l;
-
-            static constexpr UIntType initialization_multiplier = f;
-
-            static constexpr result_type min()
-            {
-                return result_type{};
-            }
-
-            static constexpr result_type max()
-            {
-                return static_cast<result_type>(aux::pow2(w)) - 1U;
-            }
-
-            static constexpr result_type default_seed = 5489U;
-
-            explicit mersenne_twister_engine(result_type value = default_seed)
-                : state_{}, i_{}
-            {
-                seed(value);
-            }
-
-            template<class Seq>
-            explicit mersenne_twister_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : state_{}, i_{}
-            {
-                seed(q);
-            }
-
-            void seed(result_type value = default_seed)
-            {
-                state_[idx_(-n)] = value % aux::pow2u(w);;
-
-                for (long long i = 1 - n; i <= -1; ++i)
-                {
-                    state_[idx_(i)] = (f * (state_[idx_(i - 1)] ^
-                                      (state_[idx_(i - 1)] >> (w - 2))) + 1 % n) % aux::pow2u(w);
-                }
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                auto k = static_cast<size_t>(w / 32);
-                auto arr = new result_type[n * k];
-                q.generate(arr, arr + n * k);
-
-                for (long long i = -n; i <= -1; ++i)
-                {
-                    state_[idx_(i)] = result_type{};
-                    for (long long j = 0; j < k; ++j)
-                        state_[idx_(i)] += arr[k * (i + n) + j] * aux::pow2(32 * j);
-                    state_[idx_(i)] %= aux::pow2(w);
-                }
-
-                delete[] arr;
-            }
-
-            result_type operator()()
-            {
-                return generate_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    transition_();
-            }
-
-            bool operator==(const mersenne_twister_engine& rhs) const
-            {
-                if (i_ != rhs.i_)
-                    return false;
-
-                for (size_t i = 0; i < n; ++i)
-                {
-                    if (state_[i] != rhs.state_[i])
-                        return false;
-                }
-
-                return true;
-            }
-
-            bool operator!=(const mersenne_twister_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                for (size_t j = n + 1; j > 1; --j)
-                {
-                    os << state_[idx_(i_ - j - 1)];
-
-                    if (j > 2)
-                        os << os.widen(' ');
-                }
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                for (size_t j = n + 1; j > 1; --j)
-                {
-                    if (!(is >> state_[idx_(i_ - j - 1)]))
-                    {
-                        is.setstate(ios::failbit);
-                        break;
-                    }
-                }
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            result_type state_[n];
-            size_t i_;
-
-            void transition_()
-            {
-                auto mask = (result_type{1} << r) - 1;
-                auto y = (state_[idx_(i_ - n)] & ~mask) | (state_[idx_(i_ + 1 - n)] & mask);
-                auto alpha = a * (y & 1);
-                state_[i_] = state_[idx_(i_ + m - n)] ^ (y >> 1) ^ alpha;
-
-                i_ = (i_ + 1) % n;
-            }
-
-            result_type generate_()
-            {
-                auto z1 = state_[i_] ^ ((state_[i_] >> u) & d);
-                auto z2 = z1 ^ (lshift_(z1, s) & b);
-                auto z3 = z2 ^ (lshift_(z2, t) & c);
-                auto z4 = z3 ^ (z3 >> l);
-
-                transition_();
-
-                return z4;
-            }
-
-            size_t idx_(size_t idx) const
-            {
-                return idx % n;
-            }
-
-            result_type lshift_(result_type val, size_t count)
-            {
-                return (val << count) % aux::pow2u(w);
-            }
-    };
-
-    /**
-     * 26.5.3.3, class template subtract_with_carry_engine:
-     */
-
-    template<class UIntType, size_t w, size_t s, size_t r>
-    class subtract_with_carry_engine
-    {
-        // TODO: fix these
-        /* static_assert(0U < s); */
-        /* static_assert(s < r); */
-        /* static_assert(0U < w); */
-        /* static_assert(w <= numeric_limits<UIntType>::digits); */
-
-        public:
-            using result_type = UIntType;
-
-            static constexpr size_t word_size = w;
-            static constexpr size_t short_lag = s;
-            static constexpr size_t long_lag = r;
-
-            static constexpr result_type min()
-            {
-                return result_type{};
-            }
-
-            static constexpr result_type max()
-            {
-                return m_ - 1;
-            }
-
-            static constexpr result_type default_seed = 19780503U;
-
-            explicit subtract_with_carry_engine(result_type value = default_seed)
-                : state_{}, i_{}, carry_{}
-            {
-                seed(value);
-            }
-
-            template<class Seq>
-            explicit subtract_with_carry_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : state_{}, i_{}, carry_{}
-            {
-                seed(q);
-            }
-
-            void seed(result_type value = default_seed)
-            {
-                linear_congruential_engine<
-                    result_type, 40014U, 0U, 2147483563U
-                > e{value == 0U ? default_seed : value};
-
-                auto n = aux::ceil(w / 32.0);
-                auto z = new result_type[n];
-
-                for (long long i = -r; i <= -1; ++i)
-                {
-                    for (size_t i = 0; i < n; ++i)
-                        z[i] = e() % aux::pow2u(32);
-
-                    state_[idx_(i)] = result_type{};
-                    for (size_t j = 0; j < n; ++j)
-                        state_[idx_(i)] += z[j] * aux::pow2u(32 * j);
-                    state_[idx_(i)] %= m_;
-                }
-
-                if (state_[idx_(-1)] == 0)
-                    carry_ = 1;
-                else
-                    carry_ = 0;
-
-                delete[] z;
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                auto k = aux::ceil(w / 32.0);
-                auto arr = new result_type[r * k];
-
-                q.generate(arr, arr + r * k);
-
-                for (long long i = -r; i <= -1; ++i)
-                {
-                    state_[idx_(i)] = result_type{};
-                    for (long long j = 0; j < k; ++j)
-                        state_[idx_(i)] += arr[k * (i + r) + j] * aux::pow2(32 * j);
-                    state_[idx_(i)] %= m_;
-                }
-
-                delete[] arr;
-
-                if (state_[idx_(-1)] == 0)
-                    carry_ = 1;
-                else
-                    carry_ = 0;
-            }
-
-            result_type operator()()
-            {
-                return generate_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    transition_();
-            }
-
-            bool operator==(const subtract_with_carry_engine& rhs) const
-            {
-                if (i_ != rhs.i_)
-                    return false;
-
-                for (size_t i = 0; i < r; ++i)
-                {
-                    if (state_[i] != rhs.state_[i])
-                        return false;
-                }
-
-                return true;
-            }
-
-            bool operator!=(const subtract_with_carry_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                for (size_t j = r + 1; j > 1; --j)
-                {
-                    os << state_[idx_(i_ - j - 1)];
-                    os << os.widen(' ');
-                }
-
-                os << carry_;
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                for (size_t j = r + 1; j > 1; --j)
-                {
-                    if (!(is >> state_[idx_(i_ - j - 1)]))
-                    {
-                        is.setstate(ios::failbit);
-                        break;
-                    }
-                }
-
-                if (!(is >> carry_))
-                    is.setstate(ios::failbit);
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            result_type state_[r];
-            size_t i_;
-            uint8_t carry_;
-
-            static constexpr result_type m_ = aux::pow2u(w);
-
-            auto transition_()
-            {
-                auto y = static_cast<int64_t>(state_[idx_(i_ - s)]) - state_[idx_(i_ - r)] - carry_;
-                state_[i_] = y % m_;
-
-                i_ = (i_ + 1) % r;
-
-                return static_cast<result_type>(y % m_);
-            }
-
-            result_type generate_()
-            {
-                return transition_();
-            }
-
-            size_t idx_(size_t idx) const
-            {
-                return idx % r;
-            }
-    };
-
-    /**
-     * 26.5.4.2, class template discard_block_engine:
-     */
-
-    template<class Engine, size_t p, size_t r>
-    class discard_block_engine
-    {
-        static_assert(0 < r);
-        static_assert(r <= p);
-
-        public:
-            using result_type = typename Engine::result_type;
-
-            static constexpr size_t block_size = p;
-            static constexpr size_t used_block = r;
-
-            static constexpr result_type min()
-            {
-                return Engine::min();
-            }
-
-            static constexpr result_type max()
-            {
-                return Engine::max();
-            }
-
-            discard_block_engine()
-                : engine_{}, n_{}
-            { /* DUMMY BODY */ }
-
-            explicit discard_block_engine(const Engine& e)
-                : engine_{e}, n_{}
-            { /* DUMMY BODY */ }
-
-            explicit discard_block_engine(Engine&& e)
-                : engine_{move(e)}, n_{}
-            { /* DUMMY BODY */ }
-
-            explicit discard_block_engine(result_type s)
-                : engine_{s}, n_{}
-            { /* DUMMY BODY */ }
-
-            template<class Seq>
-            explicit discard_block_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : engine_{q}, n_{}
-            { /* DUMMY BODY */ }
-
-            void seed()
-            {
-                engine_.seed();
-            }
-
-            void seed(result_type s)
-            {
-                engine_.seed(s);
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                engine_.seed(q);
-            }
-
-            result_type operator()()
-            {
-                if (n_ > static_cast<int>(r))
-                {
-                    auto count = p - r;
-                    for (size_t i = 0; i < count; ++i)
-                        engine_();
-                    n_ = 0;
-                }
-                ++n_;
-
-                return engine_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    operator()(); // We need to discard our (), not engine's.
-            }
-
-            const Engine& base() const noexcept
-            {
-                return engine_;
-            }
-
-            bool operator==(const discard_block_engine& rhs) const
-            {
-                return engine_ == rhs.engine_ && n_ == rhs.n_;
-            }
-
-            bool operator!=(const discard_block_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                os << n_ << os.widen(' ') << engine_;
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                if (!(is >> n_) || !(is >> engine_))
-                    is.setstate(ios::failbit);
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            Engine engine_;
-            int n_;
-    };
-
-    /**
-     * 26.5.4.3, class template independent_bits_engine:
-     */
-
-    template<class Engine, size_t w, class UIntType>
-    class independent_bits_engine
-    {
-        static_assert(0U < w);
-        /* static_assert(w <= numeric_limits<result_type>::digits); */
-
-        public:
-            using result_type = UIntType;
-
-            static constexpr result_type min()
-            {
-                return result_type{};
-            }
-
-            static constexpr result_type max()
-            {
-                return aux::pow2u(w) - 1;
-            }
-
-            independent_bits_engine()
-                : engine_{}
-            { /* DUMMY BODY */ }
-
-            explicit independent_bits_engine(const Engine& e)
-                : engine_{e}
-            { /* DUMMY BODY */ }
-
-            explicit independent_bits_engine(Engine&& e)
-                : engine_{move(e)}
-            { /* DUMMY BODY */ }
-
-            explicit independent_bits_engine(result_type s)
-                : engine_{s}
-            { /* DUMMY BODY */ }
-
-            template<class Seq>
-            explicit independent_bits_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : engine_{q}
-            { /* DUMMY BODY */ }
-
-            void seed()
-            {
-                engine_.seed();
-            }
-
-            void seed(result_type s)
-            {
-                engine_.seed(s);
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                engine_.seed(q);
-            }
-
-            result_type operator()()
-            {
-                /* auto r = engine_.max() - engine_.min() + 1; */
-                /* auto m = aux::floor(aux::log2(r)); */
-                // TODO:
-
-                return engine_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    operator()();
-            }
-
-            const Engine& base() const noexcept
-            {
-                return engine_;
-            }
-
-            bool operator==(const independent_bits_engine& rhs) const
-            {
-                return engine_ == rhs.engine_;
-            }
-
-            bool operator!=(const independent_bits_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                return os << engine_;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                return is >> engine_;
-            }
-
-        private:
-            Engine engine_;
-    };
-
-    /**
-     * 26.5.4.4, class template shiffle_order_engine:
-     */
-
-    template<class Engine, size_t k>
-    class shuffle_order_engine
-    {
-        static_assert(0U < k);
-
-        public:
-            using result_type = typename Engine::result_type;
-
-            static constexpr size_t table_size = k;
-
-            static constexpr result_type min()
-            {
-                return Engine::min();
-            }
-
-            static constexpr result_type max()
-            {
-                return Engine::max();
-            }
-
-            shuffle_order_engine()
-                : engine_{}
-            { /* DUMMY BODY */ }
-
-            explicit shuffle_order_engine(const Engine& e)
-                : engine_{e}
-            { /* DUMMY BODY */ }
-
-            explicit shuffle_order_engine(Engine&& e)
-                : engine_{move(e)}
-            { /* DUMMY BODY */ }
-
-            explicit shuffle_order_engine(result_type s)
-                : engine_{s}
-            { /* DUMMY BODY */ }
-
-            template<class Seq>
-            explicit shuffle_order_engine(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-                : engine_{q}
-            { /* DUMMY BODY */ }
-
-            void seed()
-            {
-                engine_.seed();
-            }
-
-            void seed(result_type s)
-            {
-                engine_.seed(s);
-            }
-
-            template<class Seq>
-            void seed(
-                enable_if_t<aux::is_seed_sequence_v<Seq, result_type>, Seq&> q
-            )
-            {
-                engine_.seed(q);
-            }
-
-            result_type operator()()
-            {
-                // TODO:
-
-                return engine_();
-            }
-
-            void discard(unsigned long long z)
-            {
-                for (unsigned long long i = 0ULL; i < z; ++i)
-                    operator()();
-            }
-
-            const Engine& base() const noexcept
-            {
-                return engine_;
-            }
-
-            bool operator==(const shuffle_order_engine& rhs) const
-            {
-                return engine_ == rhs.engine_;
-            }
-
-            bool operator!=(const shuffle_order_engine& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                return os << engine_;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                return is >> engine_;
-            }
-
-        private:
-            Engine engine_;
-            result_type y_;
-            result_type table_[k];
-    };
-
-    /**
-     * 26.5.5, engines and engine adaptors with predefined
-     * parameters:
-     * TODO: check their requirements for testing
-     */
-
-    using minstd_rand0  = linear_congruential_engine<uint_fast32_t, 16807, 0, 2147483647>;
-    using minstd_rand   = linear_congruential_engine<uint_fast32_t, 48271, 0, 2147483647>;
-    using mt19937       = mersenne_twister_engine<
-        uint_fast32_t, 32, 624, 397, 31, 0x9908b0df, 11, 0xffffffff, 7,
-        0x9d2c5680, 15, 0xefc60000, 18, 1812433253
-    >;
-    using mt19937_64    = mersenne_twister_engine<
-        uint_fast64_t, 64, 312, 156, 31, 0xb5026f5aa96619e9, 29,
-        0x5555555555555555, 17, 0x71d67fffeda60000, 37, 0xfff7eee000000000,
-        43, 6364136223846793005
-    >;
-    using ranlux24_base = subtract_with_carry_engine<uint_fast32_t, 24, 10, 24>;
-    using ranlux48_base = subtract_with_carry_engine<uint_fast64_t, 48, 5, 12>;
-    using ranlux24      = discard_block_engine<ranlux24_base, 223, 23>;
-    using ranlux48      = discard_block_engine<ranlux48_base, 389, 11>;
-    using knuth_b       = shuffle_order_engine<minstd_rand0, 256>;
-
-    using default_random_engine = minstd_rand0;
-
-    /**
-     * 26.5.6, class random_device:
-     */
-
-    class random_device
-    {
-        using result_type = unsigned int;
-
-        static constexpr result_type min()
-        {
-            return numeric_limits<result_type>::min();
-        }
-
-        static constexpr result_type max()
-        {
-            return numeric_limits<result_type>::max();
-        }
-
-        explicit random_device(const string& token = "")
-        {
-            /**
-             * Note: token can be used to choose between
-             *       random generators, but HelenOS only
-             *       has one :/
-             *       Also note that it is implementation
-             *       defined how this class generates
-             *       random numbers and I decided to use
-             *       time seeding with C stdlib random,
-             *       - feel free to change it if you know
-             *       something better.
-             */
-            ::srand(::time(nullptr));
-        }
-
-        result_type operator()()
-        {
-            return ::rand();
-        }
-
-        double entropy() const noexcept
-        {
-            return 0.0;
-        }
-
-        random_device(const random_device&) = delete;
-        random_device& operator=(const random_device&) = delete;
-    };
-
-    /**
-     * 26.5.7.1, class seed_seq:
-     */
-
-    class seed_seq
-    {
-        public:
-            using result_type = uint_least32_t;
-
-            seed_seq()
-                : vec_{}
-            { /* DUMMY BODY */ }
-
-            template<class T>
-            seed_seq(initializer_list<T> init)
-                : seed_seq(init.begin(), init.end())
-            { /* DUMMY BODY */ }
-
-            template<class InputIterator>
-            seed_seq(InputIterator first, InputIterator last)
-                : vec_{}
-            {
-                while (first != last)
-                    vec_.push_back((*first++) % aux::pow2u(32));
-            }
-
-            template<class RandomAccessGenerator>
-            void generate(RandomAccessGenerator first,
-                          RandomAccessGenerator last)
-            {
-                if (first == last)
-                    return;
-
-                auto s = vec_.size();
-                size_t n = last - first;
-                result_type t = (n >= 623) ? 11 : (n >= 68) ? 7 : (n >= 39) ? 5 : (n >= 7) ? 3 : (n - 1) / 2;
-                result_type p = (n - t) / 2;
-                result_type q = p + t;
-
-                auto current = first;
-                while (current != last)
-                    *current++ = 0x8b8b8b8b;
-
-                auto m = (s + 1 > n) ? (s + 1) : n;
-                decltype(m) k{};
-                for (; k < m; ++k)
-                {
-                    auto r1 = 1664525 * t_(first[k % n] ^ first[(k + p) % n] ^ first[(k - 1) % n]);
-                    auto r2 = r1;
-
-                    if (k == 0)
-                        r2 += s;
-                    else if (k > 0 && k <= s)
-                        r2 += (k % n) + vec_[(k - 1) % n];
-                    else if (s < k)
-                        r2 += (k % n);
-
-                    first[(k + p) % n] += r1;
-                    first[(k + q) % n] += r2;
-                    first[k % n] = r2;
-                }
-
-                for (; k < m + n - 1; ++k)
-                {
-                    auto r3 = 1566083941 * t_(first[k % n] + first[(k + p) % n] + first[(k - 1) % n]);
-                    auto r4 = r3 - (k % n);
-
-                    first[(k + p) % n] ^= r3;
-                    first[(k + q) % n] ^= r4;
-                    first[k % n] = r4;
-                }
-            }
-
-            size_t size() const
-            {
-                return vec_.size();
-            }
-
-            template<class OutputIterator>
-            void param(OutputIterator dest) const
-            {
-                for (const auto& x: vec_)
-                    *dest++ = x;
-            }
-
-            seed_seq(const seed_seq&) = delete;
-            seed_seq& operator=(const seed_seq&) = delete;
-
-        private:
-            vector<result_type> vec_;
-
-            result_type t_(result_type val) const
-            {
-                return val ^ (val >> 27);
-            }
-    };
-
-    /**
-     * 26.5.7.2, function template generate_canonical:
-     */
-
-    template<class RealType, size_t bits, class URNG>
-    RealType generate_canonical(URNG& g)
-    {
-        auto b = (bits < numeric_limits<RealType>::digits) ? bits : numeric_limits<RealType>::digits;
-        RealType r = g.max() - g.min() + 1;
-        size_t tmp = aux::ceil(b / aux::log2(r));
-        size_t k = (1U < tmp) ? tmp : 1U;
-
-        RealType s{};
-        for (size_t i = 0; i < k; ++i)
-            s += (g() - g.min()) * aux::pow(r, i);
-
-        return s / aux::pow(r, k);
-    }
-
-    /**
-     * 26.5.8.2.1, class template uniform_int_distribution:
-     */
-
-    template<class IntType = int>
-    class uniform_int_distribution
-    {
-        public:
-            using result_type = IntType;
-            using param_type  = pair<result_type, result_type>;
-
-            explicit uniform_int_distribution(result_type a = 0,
-                                              result_type b = numeric_limits<result_type>::max())
-                : a_{a}, b_{b}
-            { /* DUMMY BODY */ }
-
-            explicit uniform_int_distribution(const param_type& p)
-                : a_{p.first}, b_{p.second}
-            { /* DUMMY BODY */ }
-
-            void reset()
-            { /* DUMMY BODY */ }
-
-            template<class URNG>
-            result_type operator()(URNG& g)
-            {
-                auto range = b_ - a_ + 1;
-
-                return g() % range + a_;
-            }
-
-            template<class URNG>
-            result_type operator()(URNG& g, const param_type& p)
-            {
-                auto range = p.second - p.first + 1;
-
-                return g() % range + p.first;
-            }
-
-            result_type a() const
-            {
-                return a_;
-            }
-
-            result_type b() const
-            {
-                return b_;
-            }
-
-            param_type param() const
-            {
-                return param_type{a_, b_};
-            }
-
-            void param(const param_type& p)
-            {
-                a_ = p.first;
-                b_ = p.second;
-            }
-
-            result_type min() const
-            {
-                return a_;
-            }
-
-            result_type max() const
-            {
-                return b_;
-            }
-
-            bool operator==(const uniform_int_distribution& rhs) const
-            {
-                return a_ == rhs.a_ && b_ == rhs.b_;
-            }
-
-            bool operator!=(const uniform_int_distribution& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                os << a_ << os.widen(' ') << b_;
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                if (!(is >> a_) || !(is >> b_))
-                    is.setstate(ios::failbit);
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            result_type a_;
-            result_type b_;
-    };
-
-    /**
-     * 26.5.8.2.2, class template uniform_real_distribution:
-     */
-
-    template<class RealType = double>
-    class uniform_real_distribution
-    {
-        public:
-            using result_type = RealType;
-            using param_type  = pair<result_type, result_type>;
-
-            explicit uniform_real_distribution(result_type a = 0.0,
-                                               result_type b = 1.0)
-                : a_{a}, b_{b}
-            { /* DUMMY BODY */ }
-
-            explicit uniform_real_distribution(const param_type& p)
-                : a_{p.first}, b_{p.second}
-            { /* DUMMY BODY */ }
-
-            void reset()
-            { /* DUMMY BODY */ }
-
-            template<class URNG>
-            result_type operator()(URNG& g)
-            {
-                auto range = b_ - a_ + 1;
-
-                return generate_canonical<
-                    result_type, numeric_limits<result_type>::digits
-                >(g) * range + a_;
-            }
-
-            template<class URNG>
-            result_type operator()(URNG& g, const param_type& p)
-            {
-                auto range = p.second - p.first + 1;
-
-                return generate_canonical<
-                    result_type, numeric_limits<result_type>::digits
-                >(g) * range + p.first;
-            }
-
-            result_type a() const
-            {
-                return a_;
-            }
-
-            result_type b() const
-            {
-                return b_;
-            }
-
-            param_type param() const
-            {
-                return param_type{a_, b_};
-            }
-
-            void param(const param_type& p)
-            {
-                a_ = p.first;
-                b_ = p.second;
-            }
-
-            result_type min() const
-            {
-                return a_;
-            }
-
-            result_type max() const
-            {
-                return b_;
-            }
-
-            bool operator==(const uniform_real_distribution& rhs) const
-            {
-                return a_ == rhs.a_ && b_ == rhs.b_;
-            }
-
-            bool operator!=(const uniform_real_distribution& rhs) const
-            {
-                return !(*this == rhs);
-            }
-
-            // TODO: ostream/istream operators can't be members
-            template<class Char, class Traits>
-            basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os) const
-            {
-                auto flags = os.flags();
-                os.flags(ios_base::dec | ios_base::left);
-
-                os << a_ << os.widen(' ') << b_;
-
-                os.flags(flags);
-                return os;
-            }
-
-            template<class Char, class Traits>
-            basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is) const
-            {
-                auto flags = is.flags();
-                is.flags(ios_base::dec);
-
-                if (!(is >> a_) || !(is >> b_))
-                    is.setstate(ios::failbit);
-
-                is.flags(flags);
-                return is;
-            }
-
-        private:
-            result_type a_;
-            result_type b_;
-    };
-
-    /**
-     * 26.5.8.3.1, class bernoulli_distribution:
-     */
-
-    class bernoulli_distribution
-    {
-        public:
-            using result_type = bool;
-            using param_type  = float;
-
-            explicit bernoulli_distribution(double prob = 0.5)
-                : prob_{static_cast<float>(prob)}
-            { /* DUMMY BODY */ }
-
-            explicit bernoulli_distribution(const param_type& p)
-                : prob_{p}
-            { /* DUMMY BODY */ }
-
-            void reset()
-            { /* DUMMY BODY */ }
-
-            template<class URNG>
-            result_type operator()(URNG& g)
-            {
-                uniform_real_distribution<float> dist{};
-
-                return dist(g) < prob_;
-            }
-
-            template<class URNG>
-            result_type operator()(const param_type& p)
-            {
-                uniform_real_distribution<float> dist{};
-
-                return dist(p) < prob_;
-            }
-
-            double p() const
-            {
-                return prob_;
-            }
-
-            param_type param() const
-            {
-                return prob_;
-            }
-
-            void param(const param_type& p)
-            {
-                prob_ = p;
-            }
-
-            result_type min() const
-            {
-                return false;
-            }
-
-            result_type max() const
-            {
-                return true;
-            }
-
-        private:
-            /**
-             * Note: We use float because we do not
-             *       have the macro DBL_MANT_DIGITS
-             *       for generate_cannonical.
-             */
-            float prob_;
-    };
-
-    // TODO: complete the rest of the distributions
-
-    /**
-     * 26.5.8.3.2, class template binomial_distribution:
-     */
-
-    template<class IntType = int>
-    class binomial_distribution;
-
-    /**
-     * 26.5.8.3.3, class template geometric_distribution:
-     */
-
-    template<class IntType = int>
-    class geometric_distribution;
-
-    /**
-     * 26.5.8.3.4, class template negative_binomial_distribution:
-     */
-
-    template<class IntType = int>
-    class negative_binomial_distribution;
-
-    /**
-     * 26.5.8.4.1, class template poisson_distribution:
-     */
-
-    template<class IntType = int>
-    class poisson_distribution;
-
-    /**
-     * 26.5.8.4.2, class template exponential_distribution:
-     */
-
-    template<class RealType = double>
-    class exponential_distribution;
-
-    /**
-     * 26.5.8.4.3, class template gamma_distribution:
-     */
-
-    template<class RealType = double>
-    class gamma_distribution;
-
-    /**
-     * 26.5.8.4.4, class template weibull_distribution:
-     */
-
-    template<class RealType = double>
-    class weibull_distribution;
-
-    /**
-     * 26.5.8.4.5, class template extreme_value_distribution:
-     */
-
-    template<class RealType = double>
-    class extreme_value_distribution;
-
-    /**
-     * 26.5.8.5.1, class template normal_distribution:
-     */
-
-    template<class RealType = double>
-    class normal_distribution;
-
-    /**
-     * 26.5.8.5.2, class template lognormal_distribution:
-     */
-
-    template<class RealType = double>
-    class lognormal_distribution;
-
-    /**
-     * 26.5.8.5.3, class template chi_squared_distribution:
-     */
-
-    template<class RealType = double>
-    class chi_squared_distribution;
-
-    /**
-     * 26.5.8.5.4, class template cauchy_distribution:
-     */
-
-    template<class RealType = double>
-    class cauchy_distribution;
-
-    /**
-     * 26.5.8.5.5, class template fisher_f_distribution:
-     */
-
-    template<class RealType = double>
-    class fisher_f_distribution;
-
-    /**
-     * 26.5.8.5.6, class template student_t_distribution:
-     */
-
-    template<class RealType = double>
-    class student_t_distribution;
-
-    /**
-     * 26.5.8.6.1, class template discrete_distribution:
-     */
-
-    template<class IntType = int>
-    class discrete_distribution;
-
-    /**
-     * 26.5.8.6.2, class template piecewise_constant_distribution:
-     */
-
-    template<class RealType = double>
-    class piecewise_constant_distribution;
-
-    /**
-     * 26.5.8.6.3, class template piecewise_linear_distribution:
-     */
-
-    template<class RealType = double>
-    class piecewise_linear_distribution;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/ratio.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/ratio.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,207 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_RATIO
-#define LIBCPP_BITS_RATIO
-
-#include <cstdint>
-#include <type_traits>
-
-namespace std
-{
-    namespace aux
-    {
-        template<intmax_t A, intmax_t B>
-        struct gcd
-        {
-            static constexpr intmax_t value = gcd<B, A % B>::value;
-        };
-
-        template<intmax_t A>
-        struct gcd<A, 0>
-        {
-            static constexpr intmax_t value = A;
-        };
-
-        template<intmax_t A, intmax_t B>
-        inline constexpr intmax_t gcd_v = gcd<A, B>::value;
-
-        template<intmax_t A>
-        struct abs
-        {
-            static constexpr intmax_t value = (A > 0 ? A : -A);
-        };
-
-        template<intmax_t A>
-        inline constexpr intmax_t abs_v = abs<A>::value;
-
-        template<intmax_t A>
-        struct sign
-        {
-            static constexpr intmax_t value = (A == 0 ? 0: (A > 0 ? 1 : -1));
-        };
-
-        template<intmax_t A>
-        inline constexpr intmax_t sign_v = sign<A>::value;
-
-        // Not used here, but in <chrono>, better to keep them together.
-        template<intmax_t A, intmax_t B>
-        struct lcm
-        {
-            static constexpr intmax_t value = abs_v<A * B> / gcd_v<A, B>;
-        };
-
-        template<intmax_t A, intmax_t B>
-        inline constexpr intmax_t lcm_v = lcm<A, B>::value;
-    }
-
-    /**
-     * 20.11.3, class template ratio:
-     */
-
-    template<intmax_t N, intmax_t D = 1>
-    class ratio
-    {
-        public:
-            static_assert(D != 0, "ratio with denominator == 0");
-
-            static constexpr intmax_t num = aux::sign_v<N> * aux::sign_v<D>
-                                            * aux::abs_v<N> / aux::gcd_v<N, D>;
-
-            static constexpr intmax_t den = aux::abs_v<D> / aux::gcd_v<N, D>;
-
-            using type = ratio<num, den>;
-    };
-
-    /**
-     * 20.11.4, ratio arithmetic:
-     */
-
-    template<class R1, class R2>
-    using ratio_add = typename ratio<
-        R1::num * R2::den + R2::num * R1::den,
-        R1::den * R2::den
-    >::type;
-
-    template<class R1, class R2>
-    using ratio_subtract = typename ratio<
-        R1::num * R2::den - R2::num * R1::den,
-        R1::den * R2::den
-    >::type;
-
-    template<class R1, class R2>
-    using ratio_multiply = typename ratio<
-        R1::num * R2::num,
-        R1::den * R2::den
-    >::type;
-
-    template<class R1, class R2>
-    using ratio_divide = typename ratio<
-        R1::num * R2::den,
-        R1::den * R2::num
-    >::type;
-
-    /**
-     * 20.11.5, ratio comparison:
-     */
-
-    template<class R1, class R2>
-    struct ratio_equal: integral_constant<
-        bool, (R1::num == R2::num) && (R1::den == R2::den)
-    >
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_equal_v = ratio_equal<R1, R2>::value;
-
-    template<class R1, class R2>
-    struct ratio_not_equal: integral_constant<bool, !ratio_equal<R1, R2>::value>
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_not_equal_v = ratio_not_equal<R1, R2>::value;
-
-    template<class R1, class R2>
-    struct ratio_less: integral_constant<
-        bool, R1::num * R2::den < R2::num * R1::den
-    >
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_less_v = ratio_less<R1, R2>::value;
-
-    template<class R1, class R2>
-    struct ratio_less_equal: integral_constant<bool, !ratio_less<R2, R1>::value>
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_less_equal_v = ratio_less_equal<R1, R2>::value;
-
-    template<class R1, class R2>
-    struct ratio_greater: integral_constant<bool, ratio_less<R2, R1>::value>
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_greater_v = ratio_greater<R1, R2>::value;
-
-    template<class R1, class R2>
-    struct ratio_greater_equal: integral_constant<bool, !ratio_less<R1, R2>::value>
-    { /* DUMMY BODY */ };
-
-    template<class R1, class R2>
-    inline constexpr bool ratio_greater_equal_v = ratio_greater_equal<R1, R2>::value;
-
-    /**
-     * 20.11.6, convenience SI typedefs:
-     */
-
-    // TODO: yocto/zepto and yotta/zetta should not be defined if intmax_t is too small
-
-    /* using yocto = ratio<1, 1'000'000'000'000'000'000'000'000>; */
-    /* using zepto = ratio<1,     1'000'000'000'000'000'000'000>; */
-    using atto  = ratio<1,         1'000'000'000'000'000'000>;
-    using femto = ratio<1,             1'000'000'000'000'000>;
-    using pico  = ratio<1,                 1'000'000'000'000>;
-    using nano  = ratio<1,                     1'000'000'000>;
-    using micro = ratio<1,                         1'000'000>;
-    using milli = ratio<1,                             1'000>;
-    using centi = ratio<1,                               100>;
-    using deci  = ratio<1,                                10>;
-    using deca  = ratio<                               10, 1>;
-    using hecto = ratio<                              100, 1>;
-    using kilo  = ratio<                            1'000, 1>;
-    using mega  = ratio<                        1'000'000, 1>;
-    using giga  = ratio<                    1'000'000'000, 1>;
-    using tera  = ratio<                1'000'000'000'000, 1>;
-    using peta  = ratio<            1'000'000'000'000'000, 1>;
-    using exa   = ratio<        1'000'000'000'000'000'000, 1>;
-    /* using zetta = ratio<    1'000'000'000'000'000'000'000, 1>; */
-    /* using yotta = ratio<1'000'000'000'000'000'000'000'000, 1>; */
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/refcount_obj.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/refcount_obj.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_REFCOUNT_OBJ
-#define LIBCPP_BITS_REFCOUNT_OBJ
-
-namespace std::aux
-{
-    /**
-     * At the moment we do not have atomics, change this
-     * to std::atomic<long> once we do.
-     */
-    using refcount_t = long;
-
-    class refcount_obj
-    {
-        public:
-            refcount_obj() = default;
-
-            void increment() noexcept;
-            void increment_weak() noexcept;
-            bool decrement() noexcept;
-            bool decrement_weak() noexcept;
-            refcount_t refs() const noexcept;
-            refcount_t weak_refs() const noexcept;
-            bool expired() const noexcept;
-
-            virtual ~refcount_obj() = default;
-            virtual void destroy() = 0;
-
-        protected:
-            /**
-             * We're using a trick where refcount_ > 0
-             * means weak_refcount_ has 1 added to it,
-             * this makes it easier for weak_ptrs that
-             * can't decrement the weak_refcount_ to
-             * zero with shared_ptrs using this object.
-             */
-            refcount_t refcount_{1};
-            refcount_t weak_refcount_{1};
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/regex.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/regex.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_REGEX
-#define LIBCPP_BITS_REGEX
-
-#error "<regex> is not implemented"
-
-#endif
Index: pace/lib/cpp/include/__bits/scoped_allocator.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/scoped_allocator.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_SCOPED_ALLOCATOR
-#define LIBCPP_BITS_SCOPED_ALLOCATOR
-
-#error "<scoped_allocator> is not implemented"
-
-#endif
Index: pace/lib/cpp/include/__bits/stdexcept.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/stdexcept.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_STDEXCEPT
-#define LIBCPP_BITS_STDEXCEPT
-
-#include <__bits/string/stringfwd.hpp>
-#include <__bits/trycatch.hpp>
-#include <exception>
-#include <iosfwd>
-
-namespace std
-{
-    class logic_error: public exception
-    {
-        public:
-            explicit logic_error(const string&);
-            explicit logic_error(const char*);
-            logic_error(const logic_error&) noexcept;
-            logic_error& operator=(const logic_error&);
-            ~logic_error() override;
-
-            const char* what() const noexcept override;
-
-        protected:
-            char* what_;
-    };
-
-    class domain_error: public logic_error
-    {
-        public:
-            explicit domain_error(const string&);
-            explicit domain_error(const char*);
-            domain_error(const domain_error&) noexcept;
-    };
-
-    class invalid_argument: public logic_error
-    {
-        public:
-            explicit invalid_argument(const string&);
-            explicit invalid_argument(const char*);
-            invalid_argument(const invalid_argument&) noexcept;
-    };
-
-    class length_error: public logic_error
-    {
-        public:
-            explicit length_error(const string&);
-            explicit length_error(const char*);
-            length_error(const length_error&) noexcept;
-    };
-
-    class out_of_range: public logic_error
-    {
-        public:
-            explicit out_of_range(const string&);
-            explicit out_of_range(const char*);
-            out_of_range(const out_of_range&) noexcept;
-    };
-
-    class runtime_error: public exception
-    {
-        public:
-            explicit runtime_error(const string&);
-            explicit runtime_error(const char*);
-            runtime_error(const runtime_error&) noexcept;
-            runtime_error& operator=(const runtime_error&);
-            ~runtime_error() override;
-
-            const char* what() const noexcept override;
-
-        protected:
-            char* what_;
-    };
-
-    class range_error: public runtime_error
-    {
-        public:
-            explicit range_error(const string&);
-            explicit range_error(const char*);
-            range_error(const range_error&) noexcept;
-    };
-
-    class overflow_error: public runtime_error
-    {
-        public:
-            explicit overflow_error(const string&);
-            explicit overflow_error(const char*);
-            overflow_error(const overflow_error&) noexcept;
-    };
-
-    class underflow_error: public runtime_error
-    {
-        public:
-            explicit underflow_error(const string&);
-            explicit underflow_error(const char*);
-            underflow_error(const underflow_error&) noexcept;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/string/string.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/string/string.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1994 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_STRING
-#define LIBCPP_BITS_STRING
-
-#include <__bits/string/stringfwd.hpp>
-#include <algorithm>
-#include <cassert>
-#include <initializer_list>
-#include <iosfwd>
-#include <iterator>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cwchar>
-#include <memory>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 21.2, char_traits:
-     */
-
-    template<class Char>
-    struct char_traits;
-
-    /**
-     * 21.2.3, char_traits specializations:
-     */
-
-    template<>
-    struct char_traits<char>
-    {
-        using char_type  = char;
-        using int_type   = int;
-        using off_type   = streamoff;
-        using pos_type   = streampos;
-        /* using state_type = mbstate_t; */
-
-        static void assign(char_type& c1, const char_type& c2) noexcept
-        {
-            c1 = c2;
-        }
-
-        static constexpr bool eq(char_type c1, char_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr bool lt(char_type c1, char_type c2) noexcept
-        {
-            return c1 < c2;
-        }
-
-        static int compare(const char_type* s1, const char_type* s2, size_t n)
-        {
-            return ::strncmp(s1, s2, n);
-        }
-
-        static size_t length(const char_type* s)
-        {
-            return ::strlen(s);
-        }
-
-        static const char_type* find(const char_type* s, size_t n, const char_type& c)
-        {
-            size_t i{};
-            while (i++ < n)
-            {
-                if (s[i] == c)
-                    return s + i;
-            }
-
-            return nullptr;
-        }
-
-        static char_type* move(char_type* s1, const char_type* s2, size_t n)
-        {
-            return static_cast<char_type*>(memmove(s1, s2, n));
-        }
-
-        static char_type* copy(char_type* s1, const char_type* s2, size_t n)
-        {
-            return static_cast<char_type*>(memcpy(s1, s2, n));
-        }
-
-        static char_type* assign(char_type* s, size_t n, char_type c)
-        {
-            /**
-             * Note: Even though memset accepts int as its second argument,
-             *       the actual implementation assigns that int to a dereferenced
-             *       char pointer.
-             */
-            return static_cast<char_type*>(memset(s, static_cast<int>(c), n));
-        }
-
-        static constexpr int_type not_eof(int_type c) noexcept
-        {
-            if (!eq_int_type(c, eof()))
-                return c;
-            else
-                return to_int_type('a'); // We just need something that is not eof.
-        }
-
-        static constexpr char_type to_char_type(int_type c) noexcept
-        {
-            return static_cast<char_type>(c);
-        }
-
-        static constexpr int_type to_int_type(char_type c) noexcept
-        {
-            return static_cast<int_type>(c);
-        }
-
-        static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr int_type eof() noexcept
-        {
-            return static_cast<int_type>(EOF);
-        }
-    };
-
-    template<>
-    struct char_traits<char16_t>
-    {
-        // TODO: implement
-        using char_type  = char16_t;
-        using int_type   = int16_t;
-        using off_type   = streamoff;
-        using pos_type   = streampos;
-        /* using state_type = mbstate_t; */
-
-        static void assign(char_type& c1, const char_type& c2) noexcept
-        {
-            c1 = c2;
-        }
-
-        static constexpr bool eq(char_type c1, char_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr bool lt(char_type c1, char_type c2) noexcept
-        {
-            return c1 < c2;
-        }
-
-        static int compare(const char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return 0;
-        }
-
-        static size_t length(const char_type* s)
-        {
-            // TODO: implement
-            __unimplemented();
-            return 0;
-        }
-
-        static const char_type* find(const char_type* s, size_t n, const char_type& c)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* move(char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* copy(char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* assign(char_type* s, size_t n, char_type c)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static constexpr int_type not_eof(int_type c) noexcept
-        {
-            // TODO: implement
-            return int_type{};
-        }
-
-        static constexpr char_type to_char_type(int_type c) noexcept
-        {
-            return static_cast<char_type>(c);
-        }
-
-        static constexpr int_type to_int_type(char_type c) noexcept
-        {
-            return static_cast<int_type>(c);
-        }
-
-        static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr int_type eof() noexcept
-        {
-            return static_cast<int_type>(EOF);
-        }
-    };
-
-    template<>
-    struct char_traits<char32_t>
-    {
-        // TODO: implement
-        using char_type  = char32_t;
-        using int_type   = int32_t;
-        using off_type   = streamoff;
-        using pos_type   = streampos;
-        /* using state_type = mbstate_t; */
-
-        static void assign(char_type& c1, const char_type& c2) noexcept
-        {
-            c1 = c2;
-        }
-
-        static constexpr bool eq(char_type c1, char_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr bool lt(char_type c1, char_type c2) noexcept
-        {
-            return c1 < c2;
-        }
-
-        static int compare(const char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return 0;
-        }
-
-        static size_t length(const char_type* s)
-        {
-            // TODO: implement
-            __unimplemented();
-            return 0;
-        }
-
-        static const char_type* find(const char_type* s, size_t n, const char_type& c)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* move(char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* copy(char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static char_type* assign(char_type* s, size_t n, char_type c)
-        {
-            // TODO: implement
-            __unimplemented();
-            return nullptr;
-        }
-
-        static constexpr int_type not_eof(int_type c) noexcept
-        {
-            // TODO: implement
-            return int_type{};
-        }
-
-        static constexpr char_type to_char_type(int_type c) noexcept
-        {
-            return static_cast<char_type>(c);
-        }
-
-        static constexpr int_type to_int_type(char_type c) noexcept
-        {
-            return static_cast<int_type>(c);
-        }
-
-        static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr int_type eof() noexcept
-        {
-            return static_cast<int_type>(EOF);
-        }
-    };
-
-    template<>
-    struct char_traits<wchar_t>
-    {
-        using char_type  = wchar_t;
-        using int_type   = wint_t;
-        using off_type   = streamoff;
-        using pos_type   = wstreampos;
-        /* using state_type = mbstate_t; */
-
-        static void assign(char_type& c1, const char_type& c2) noexcept
-        {
-            c1 = c2;
-        }
-
-        static constexpr bool eq(char_type c1, char_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr bool lt(char_type c1, char_type c2) noexcept
-        {
-            return c1 < c2;
-        }
-
-        static int compare(const char_type* s1, const char_type* s2, size_t n)
-        {
-            // TODO: This function does not exits...
-            __unimplemented();
-            return 0;
-        }
-
-        static size_t length(const char_type* s)
-        {
-            size_t i = 0;
-            while (s[i] != 0)
-                i++;
-            return i;
-        }
-
-        static const char_type* find(const char_type* s, size_t n, const char_type& c)
-        {
-            size_t i{};
-            while (i++ < n)
-            {
-                if (s[i] == c)
-                    return s + i;
-            }
-
-            return nullptr;
-        }
-
-        static char_type* move(char_type* s1, const char_type* s2, size_t n)
-        {
-            return static_cast<char_type*>(memmove(s1, s2, n * sizeof(wchar_t)));
-        }
-
-        static char_type* copy(char_type* s1, const char_type* s2, size_t n)
-        {
-            return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(wchar_t)));
-        }
-
-        static char_type* assign(char_type* s, size_t n, char_type c)
-        {
-            return static_cast<char_type*>(memset(s, static_cast<int>(c), n * sizeof(wchar_t)));
-        }
-
-        static constexpr int_type not_eof(int_type c) noexcept
-        {
-            if (!eq_int_type(c, eof()))
-                return c;
-            else
-                return to_int_type(L'a'); // We just need something that is not eof.
-        }
-
-        static constexpr char_type to_char_type(int_type c) noexcept
-        {
-            return static_cast<char_type>(c);
-        }
-
-        static constexpr int_type to_int_type(char_type c) noexcept
-        {
-            return static_cast<int_type>(c);
-        }
-
-        static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept
-        {
-            return c1 == c2;
-        }
-
-        static constexpr int_type eof() noexcept
-        {
-            return static_cast<int_type>(EOF);
-        }
-    };
-
-    /**
-     * 21.4, class template basic_string:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    class basic_string
-    {
-        public:
-            using traits_type     = Traits;
-            using value_type      = typename traits_type::char_type;
-            using allocator_type  = Allocator;
-            using size_type       = typename allocator_traits<allocator_type>::size_type;
-            using difference_type = typename allocator_traits<allocator_type>::difference_type;
-
-            using reference       = value_type&;
-            using const_reference = const value_type&;
-            using pointer         = typename allocator_traits<allocator_type>::pointer;
-            using const_pointer   = typename allocator_traits<allocator_type>::const_pointer;
-
-            using iterator               = pointer;
-            using const_iterator         = const_pointer;
-            using reverse_iterator       = std::reverse_iterator<iterator>;
-            using const_reverse_iterator = std::reverse_iterator<const_iterator>;
-
-            static constexpr size_type npos = -1;
-
-            /**
-             * 21.4.2, construct/copy/destroy:
-             * TODO: tagged constructor that moves the char*
-             *       and use that with asprintf in to_string
-             */
-
-            basic_string() noexcept
-                : basic_string(allocator_type{})
-            { /* DUMMY BODY */ }
-
-            explicit basic_string(const allocator_type& alloc)
-                : data_{}, size_{}, capacity_{}, allocator_{alloc}
-            {
-                /**
-                 * Postconditions:
-                 *  data() = non-null copyable value that can have 0 added to it.
-                 *  size() = 0
-                 *  capacity() = unspecified
-                 */
-                data_ = allocator_.allocate(default_capacity_);
-                capacity_ = default_capacity_;
-            }
-
-            basic_string(const basic_string& other)
-                : data_{}, size_{other.size_}, capacity_{other.capacity_},
-                  allocator_{other.allocator_}
-            {
-                init_(other.data(), size_);
-            }
-
-            basic_string(basic_string&& other)
-                : data_{other.data_}, size_{other.size_},
-                  capacity_{other.capacity_}, allocator_{move(other.allocator_)}
-            {
-                other.data_ = nullptr;
-                other.size_ = 0;
-                other.capacity_ = 0;
-            }
-
-            basic_string(const basic_string& other, size_type pos, size_type n = npos,
-                         const allocator_type& alloc = allocator_type{})
-                : data_{}, size_{}, capacity_{}, allocator_{alloc}
-            {
-                // TODO: if pos < other.size() throw out_of_range.
-                auto len = min(n, other.size() - pos);
-                init_(other.data() + pos, len);
-            }
-
-            basic_string(const value_type* str, size_type n, const allocator_type& alloc = allocator_type{})
-                : data_{}, size_{n}, capacity_{n}, allocator_{alloc}
-            {
-                init_(str, size_);
-            }
-
-            basic_string(const value_type* str, const allocator_type& alloc = allocator_type{})
-                : data_{}, size_{}, capacity_{}, allocator_{alloc}
-            {
-                init_(str, traits_type::length(str));
-            }
-
-            basic_string(size_type n, value_type c, const allocator_type& alloc = allocator_type{})
-                : data_{}, size_{n}, capacity_{n + 1}, allocator_{alloc}
-            {
-                data_ = allocator_.allocate(capacity_);
-                for (size_type i = 0; i < size_; ++i)
-                    traits_type::assign(data_[i], c);
-                ensure_null_terminator_();
-            }
-
-            template<class InputIterator>
-            basic_string(InputIterator first, InputIterator last,
-                         const allocator_type& alloc = allocator_type{})
-                : data_{}, size_{}, capacity_{}, allocator_{alloc}
-            {
-                if constexpr (is_integral<InputIterator>::value)
-                { // Required by the standard.
-                    size_ = static_cast<size_type>(first);
-                    capacity_ = size_;
-                    data_ = allocator_.allocate(capacity_);
-
-                    for (size_type i = 0; i < size_; ++i)
-                        traits_type::assign(data_[i], static_cast<value_type>(last));
-                    ensure_null_terminator_();
-                }
-                else
-                {
-                    auto len = static_cast<size_type>(last - first);
-                    init_(first, len);
-                }
-            }
-
-            basic_string(initializer_list<value_type> init, const allocator_type& alloc = allocator_type{})
-                : basic_string{init.begin(), init.size(), alloc}
-            { /* DUMMY BODY */ }
-
-            basic_string(const basic_string& other, const allocator_type& alloc)
-                : data_{}, size_{other.size_}, capacity_{other.capacity_}, allocator_{alloc}
-            {
-                init_(other.data(), size_);
-            }
-
-            basic_string(basic_string&& other, const allocator_type& alloc)
-                : data_{other.data_}, size_{other.size_}, capacity_{other.capacity_}, allocator_{alloc}
-            {
-                other.data_ = nullptr;
-                other.size_ = 0;
-                other.capacity_ = 0;
-            }
-
-            ~basic_string()
-            {
-                allocator_.deallocate(data_, capacity_);
-            }
-
-            basic_string& operator=(const basic_string& other)
-            {
-                if (this != &other)
-                {
-                    basic_string tmp{other};
-                    swap(tmp);
-                }
-
-                return *this;
-            }
-
-            basic_string& operator=(basic_string&& other)
-                noexcept(allocator_traits<allocator_type>::propagate_on_container_move_assignment::value ||
-                         allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                if (this != &other)
-                    swap(other);
-
-                return *this;
-            }
-
-            basic_string& operator=(const value_type* other)
-            {
-                *this = basic_string{other};
-
-                return *this;
-            }
-
-            basic_string& operator=(value_type c)
-            {
-                *this = basic_string{1, c};
-
-                return *this;
-            }
-
-            basic_string& operator=(initializer_list<value_type> init)
-            {
-                *this = basic_string{init};
-
-                return *this;
-            }
-
-            /**
-             * 21.4.3, iterators:
-             */
-
-            iterator begin() noexcept
-            {
-                return &data_[0];
-            }
-
-            const_iterator begin() const noexcept
-            {
-                return &data_[0];
-            }
-
-            iterator end() noexcept
-            {
-                return begin() + size_;
-            }
-
-            const_iterator end() const noexcept
-            {
-                return begin() + size_;
-            }
-
-            reverse_iterator rbegin() noexcept
-            {
-                return make_reverse_iterator(end());
-            }
-
-            const_reverse_iterator rbegin() const noexcept
-            {
-                return make_reverse_iterator(cend());
-            }
-
-            reverse_iterator rend() noexcept
-            {
-                return make_reverse_iterator(begin());
-            }
-
-            const_reverse_iterator rend() const noexcept
-            {
-                return make_reverse_iterator(cbegin());
-            }
-
-            const_iterator cbegin() const noexcept
-            {
-                return &data_[0];
-            }
-
-            const_iterator cend() const noexcept
-            {
-                return cbegin() + size_;
-            }
-
-            const_reverse_iterator crbegin() const noexcept
-            {
-                return rbegin();
-            }
-
-            const_reverse_iterator crend() const noexcept
-            {
-                return rend();
-            }
-
-            /**
-             * 21.4.4, capacity:
-             */
-
-            size_type size() const noexcept
-            {
-                return size_;
-            }
-
-            size_type length() const noexcept
-            {
-                return size();
-            }
-
-            size_type max_size() const noexcept
-            {
-                return 0x7FFF; // TODO: just temporary
-                /* return allocator_traits<allocator_type>::max_size(allocator_); */
-            }
-
-            void resize(size_type new_size, value_type c)
-            {
-                // TODO: if new_size > max_size() throw length_error.
-                if (new_size > size_)
-                {
-                    ensure_free_space_(new_size - size_ + 1);
-                    for (size_type i = size_; i < new_size; ++i)
-                        traits_type::assign(data_[i], i);
-                }
-
-                size_ = new_size;
-                ensure_null_terminator_();
-            }
-
-            void resize(size_type new_size)
-            {
-                resize(new_size, value_type{});
-            }
-
-            size_type capacity() const noexcept
-            {
-                return capacity_;
-            }
-
-            void reserve(size_type new_capacity = 0)
-            {
-                // TODO: if new_capacity > max_size() throw
-                //       length_error (this function shall have no
-                //       effect in such case)
-                if (new_capacity > capacity_)
-                    resize_with_copy_(size_, new_capacity);
-                else if (new_capacity < capacity_)
-                    shrink_to_fit(); // Non-binding request, but why not.
-            }
-
-            void shrink_to_fit()
-            {
-                if (size_ != capacity_)
-                    resize_with_copy_(size_, capacity_);
-            }
-
-            void clear() noexcept
-            {
-                size_ = 0;
-            }
-
-            bool empty() const noexcept
-            {
-                return size_ == 0;
-            }
-
-            /**
-             * 21.4.5, element access:
-             */
-
-            const_reference operator[](size_type idx) const
-            {
-                return data_[idx];
-            }
-
-            reference operator[](size_type idx)
-            {
-                return data_[idx];
-            }
-
-            const_reference at(size_type idx) const
-            {
-                // TODO: bounds checking
-                return data_[idx];
-            }
-
-            reference at(size_type idx)
-            {
-                // TODO: bounds checking
-                return data_[idx];
-            }
-
-            const_reference front() const
-            {
-                return at(0);
-            }
-
-            reference front()
-            {
-                return at(0);
-            }
-
-            const_reference back() const
-            {
-                return at(size_ - 1);
-            }
-
-            reference back()
-            {
-                return at(size_ - 1);
-            }
-
-            /**
-             * 21.4.6, modifiers:
-             */
-
-            basic_string& operator+=(const basic_string& str)
-            {
-                return append(str);
-            }
-
-            basic_string& operator+=(const value_type* str)
-            {
-                return append(str);
-            }
-
-            basic_string& operator+=(value_type c)
-            {
-                push_back(c);
-                return *this;
-            }
-
-            basic_string& operator+=(initializer_list<value_type> init)
-            {
-                return append(init.begin(), init.size());
-            }
-
-            basic_string& append(const basic_string& str)
-            {
-                return append(str.data(), str.size());
-            }
-
-            basic_string& append(const basic_string& str, size_type pos,
-                                 size_type n = npos)
-            {
-                if (pos < str.size())
-                {
-                    auto len = min(n, str.size() - pos);
-
-                    return append(str.data() + pos, len);
-                }
-                // TODO: Else throw out_of_range.
-            }
-
-            basic_string& append(const value_type* str, size_type n)
-            {
-                // TODO: if (size_ + n > max_size()) throw length_error
-                ensure_free_space_(n);
-                traits_type::copy(data_ + size(), str, n);
-                size_ += n;
-                ensure_null_terminator_();
-
-                return *this;
-            }
-
-            basic_string& append(const value_type* str)
-            {
-                return append(str, traits_type::length(str));
-            }
-
-            basic_string& append(size_type n, value_type c)
-            {
-                return append(basic_string(n, c));
-            }
-
-            template<class InputIterator>
-            basic_string& append(InputIterator first, InputIterator last)
-            {
-                return append(basic_string(first, last));
-            }
-
-            basic_string& append(initializer_list<value_type> init)
-            {
-                return append(init.begin(), init.size());
-            }
-
-            void push_back(value_type c)
-            {
-                ensure_free_space_(1);
-                traits_type::assign(data_[size_++], c);
-                ensure_null_terminator_();
-            }
-
-            basic_string& assign(const basic_string& str)
-            {
-                return assign(str, 0, npos);
-            }
-
-            basic_string& assign(basic_string&& str)
-            {
-                swap(str);
-
-                return *this;
-            }
-
-            basic_string& assign(const basic_string& str, size_type pos,
-                                 size_type n = npos)
-            {
-                if (pos < str.size())
-                {
-                    auto len = min(n, str.size() - pos);
-                    ensure_free_space_(len);
-
-                    return assign(str.data() + pos, len);
-                }
-                // TODO: Else throw out_of_range.
-
-                return *this;
-            }
-
-            basic_string& assign(const value_type* str, size_type n)
-            {
-                // TODO: if (n > max_size()) throw length_error.
-                resize_without_copy_(n + 1);
-                traits_type::copy(begin(), str, n);
-                size_ = n;
-                ensure_null_terminator_();
-
-                return *this;
-            }
-
-            basic_string& assign(const value_type* str)
-            {
-                return assign(str, traits_type::length(str));
-            }
-
-            basic_string& assign(size_type n, value_type c)
-            {
-                return assign(basic_string(n, c));
-            }
-
-            template<class InputIterator>
-            basic_string& assign(InputIterator first, InputIterator last)
-            {
-                return assign(basic_string(first, last));
-            }
-
-            basic_string& assign(initializer_list<value_type> init)
-            {
-                return assign(init.begin(), init.size());
-            }
-
-            basic_string& insert(size_type pos, const basic_string& str)
-            {
-                // TODO: if (pos > str.size()) throw out_of_range.
-                return insert(pos, str.data(), str.size());
-            }
-
-            basic_string& insert(size_type pos1, const basic_string& str,
-                                 size_type pos2, size_type n = npos)
-            {
-                // TODO: if (pos1 > size() or pos2 > str.size()) throw
-                //       out_of_range.
-                auto len = min(n, str.size() - pos2);
-
-                return insert(pos1, str.data() + pos2, len);
-            }
-
-            basic_string& insert(size_type pos, const value_type* str, size_type n)
-            {
-                // TODO: throw out_of_range if pos > size()
-                // TODO: throw length_error if size() + n > max_size()
-                ensure_free_space_(n);
-
-                copy_backward_(begin() + pos, end(), end() + n);
-                copy_(str, str + n, begin() + pos);
-                size_ += n;
-
-                ensure_null_terminator_();
-                return *this;
-            }
-
-            basic_string& insert(size_type pos, const value_type* str)
-            {
-                return insert(pos, str, traits_type::length(str));
-            }
-
-            basic_string& insert(size_type pos, size_type n, value_type c)
-            {
-                return insert(pos, basic_string(n, c));
-            }
-
-            iterator insert(const_iterator pos, value_type c)
-            {
-                auto idx = static_cast<size_type>(pos - begin());
-
-                ensure_free_space_(1);
-                copy_backward_(begin() + idx, end(), end() + 1);
-                traits_type::assign(data_[idx], c);
-
-                ++size_;
-                ensure_null_terminator_();
-
-                return begin() + idx;
-            }
-
-            iterator insert(const_iterator pos, size_type n, value_type c)
-            {
-                if (n == 0)
-                    return const_cast<iterator>(pos);
-
-                auto idx = static_cast<size_type>(pos - begin());
-
-                ensure_free_space_(n);
-                copy_backward_(begin() + idx, end(), end() + n);
-
-                auto it = begin() + idx;
-                for (size_type i = 0; i < n; ++i)
-                    traits_type::assign(*it++, c);
-                size_ += n;
-                ensure_null_terminator_();
-
-                return begin() + idx;
-            }
-
-            template<class InputIterator>
-            iterator insert(const_iterator pos, InputIterator first,
-                            InputIterator last)
-            {
-                if (first == last)
-                    return const_cast<iterator>(pos);
-
-                auto idx = static_cast<size_type>(pos - begin());
-                auto str = basic_string{first, last};
-                insert(idx, str);
-
-                return begin() + idx;
-            }
-
-            iterator insert(const_iterator pos, initializer_list<value_type> init)
-            {
-                return insert(pos, init.begin(), init.end());
-            }
-
-            basic_string& erase(size_type pos = 0, size_type n = npos)
-            {
-                auto len = min(n, size_ - pos);
-                copy_(begin() + pos + n, end(), begin() + pos);
-                size_ -= len;
-                ensure_null_terminator_();
-
-                return *this;
-            }
-
-            iterator erase(const_iterator pos)
-            {
-                auto idx = static_cast<size_type>(pos - cbegin());
-                erase(idx, 1);
-
-                return begin() + idx;
-            }
-
-            iterator erase(const_iterator first, const_iterator last)
-            {
-                auto idx = static_cast<size_type>(first - cbegin());
-                auto count = static_cast<size_type>(last - first);
-                erase(idx, count);
-
-                return begin() + idx;
-            }
-
-            void pop_back()
-            {
-                --size_;
-                ensure_null_terminator_();
-            }
-
-            basic_string& replace(size_type pos, size_type n, const basic_string& str)
-            {
-                // TODO: throw out_of_range if pos > size()
-                return replace(pos, n, str.data(), str.size());
-            }
-
-            basic_string& replace(size_type pos1, size_type n1, const basic_string& str,
-                                  size_type pos2, size_type n2 = npos)
-            {
-                // TODO: throw out_of_range if pos1 > size() or pos2 > str.size()
-                auto len = min(n2, str.size() - pos2);
-                return replace(pos1, n1, str.data() + pos2, len);
-            }
-
-            basic_string& replace(size_type pos, size_type n1, const value_type* str,
-                                  size_type n2)
-            {
-                // TODO: throw out_of_range if pos > size()
-                // TODO: if size() - len > max_size() - n2 throw length_error
-                auto len = min(n1, size_ - pos);
-
-                basic_string tmp{};
-                tmp.resize_without_copy_(size_ - len + n2);
-
-                // Prefix.
-                copy_(begin(), begin() + pos, tmp.begin());
-
-                // Substitution.
-                traits_type::copy(tmp.begin() + pos, str, n2);
-
-                // Suffix.
-                copy_(begin() + pos + len, end(), tmp.begin() + pos + n2);
-
-                tmp.size_ = size_ - len + n2;
-                swap(tmp);
-                return *this;
-            }
-
-            basic_string& replace(size_type pos, size_type n, const value_type* str)
-            {
-                return replace(pos, n, str, traits_type::length(str));
-            }
-
-            basic_string& replace(size_type pos, size_type n1, size_type n2,
-                                  value_type c)
-            {
-                return replace(pos, n1, basic_string(n2, c));
-            }
-
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  const basic_string& str)
-            {
-                return replace(i1 - begin(), i2 - i1, str);
-            }
-
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  const value_type* str, size_type n)
-            {
-                return replace(i1 - begin(), i2 - i1, str, n);
-            }
-
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  const value_type* str)
-            {
-                return replace(i1 - begin(), i2 - i1, str, traits_type::length(str));
-            }
-
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  size_type n, value_type c)
-            {
-                return replace(i1 - begin(), i2 - i1, basic_string(n, c));
-            }
-
-            template<class InputIterator>
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  InputIterator j1, InputIterator j2)
-            {
-                return replace(i1 - begin(), i2 - i1, basic_string(j1, j2));
-            }
-
-            basic_string& replace(const_iterator i1, const_iterator i2,
-                                  initializer_list<value_type> init)
-            {
-                return replace(i1 - begin(), i2 - i1, init.begin(), init.size());
-            }
-
-            size_type copy(value_type* str, size_type n, size_type pos = 0) const
-            {
-                auto len = min(n , size_ - pos);
-                for (size_type i = 0; i < len; ++i)
-                    traits_type::assign(str[i], data_[pos + i]);
-
-                return len;
-            }
-
-            void swap(basic_string& other)
-                noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
-                         allocator_traits<allocator_type>::is_always_equal::value)
-            {
-                std::swap(data_, other.data_);
-                std::swap(size_, other.size_);
-                std::swap(capacity_, other.capacity_);
-            }
-
-            /**
-             * 21.4.7, string operations:
-             */
-
-            const value_type* c_str() const noexcept
-            {
-                return data_;
-            }
-
-            const value_type* data() const noexcept
-            {
-                return data_;
-            }
-
-            allocator_type get_allocator() const noexcept
-            {
-                return allocator_type{allocator_};
-            }
-
-            /**
-             * Note: The following find functions have 4 versions each:
-             *       (1) takes basic_string
-             *       (2) takes c string and length
-             *       (3) takes c string
-             *       (4) takes value_type
-             *       According to the C++14 standard, only (1) is marked as
-             *       noexcept and the other three return the first one with
-             *       a newly allocated strings (and thus cannot be noexcept).
-             *       However, allocating a new string results in memory
-             *       allocation and copying of the source and thus we have
-             *       decided to follow C++17 signatures of these functions
-             *       (i.e. all of them being marked as noexcept) and use
-             *       (2) for the actual implementation (and avoiding any
-             *       allocations or copying in the process and also providing
-             *       stronger guarantees to the user).
-             */
-
-            size_type find(const basic_string& str, size_type pos = 0) const noexcept
-            {
-                return find(str.c_str(), pos, str.size());
-            }
-
-            size_type find(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty() || len == 0 || len + pos > size())
-                    return npos;
-
-                size_type idx{pos};
-
-                while (idx + len < size_)
-                {
-                    if (substr_starts_at_(idx, str, len))
-                        return idx;
-                    ++idx;
-                }
-
-                return npos;
-            }
-
-            size_type find(const value_type* str, size_type pos = 0) const noexcept
-            {
-                return find(str, pos, traits_type::length(str));
-            }
-
-            size_type find(value_type c, size_type pos = 0) const noexcept
-            {
-                if (empty())
-                    return npos;
-
-                for (size_type i = pos; i < size_; ++i)
-                {
-                    if (traits_type::eq(c, data_[i]))
-                        return i;
-                }
-
-                return npos;
-            }
-
-            size_type rfind(const basic_string& str, size_type pos = npos) const noexcept
-            {
-                return rfind(str.c_str(), pos, str.size());
-            }
-
-            size_type rfind(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty() || len == 0 || len + pos > size())
-                    return npos;
-
-                size_type idx{min(pos, size_ - 1) + 1};
-
-                while (idx > 0)
-                {
-                    if (substr_starts_at_(idx - 1, str, len))
-                        return idx - 1;
-                    --idx;
-                }
-
-                return npos;
-            }
-
-            size_type rfind(const value_type* str, size_type pos = npos) const noexcept
-            {
-                return rfind(str, pos, traits_type::length(str));
-            }
-
-            size_type rfind(value_type c, size_type pos = npos) const noexcept
-            {
-                if (empty())
-                    return npos;
-
-                for (size_type i = min(pos + 1, size_ - 1) + 1; i > 0; --i)
-                {
-                    if (traits_type::eq(c, data_[i - 1]))
-                        return i - 1;
-                }
-
-                return npos;
-            }
-
-            size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept
-            {
-                return find_first_of(str.c_str(), pos, str.size());
-            }
-
-            size_type find_first_of(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty() || len == 0 || pos >= size())
-                    return npos;
-
-                size_type idx{pos};
-
-                while (idx < size_)
-                {
-                    if (is_any_of_(idx, str, len))
-                        return idx;
-                    ++idx;
-                }
-
-                return npos;
-            }
-
-            size_type find_first_of(const value_type* str, size_type pos = 0) const noexcept
-            {
-                return find_first_of(str, pos, traits_type::length(str));
-            }
-
-            size_type find_first_of(value_type c, size_type pos = 0) const noexcept
-            {
-                return find(c, pos);
-            }
-
-            size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept
-            {
-                return find_last_of(str.c_str(), pos, str.size());
-            }
-
-            size_type find_last_of(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty() || len == 0)
-                    return npos;
-
-                for (size_type i = min(pos, size_ - 1) + 1; i > 0; --i)
-                {
-                    if (is_any_of_(i - 1, str, len))
-                        return i - 1;
-                }
-
-                return npos;
-            }
-
-            size_type find_last_of(const value_type* str, size_type pos = npos) const noexcept
-            {
-                return find_last_of(str, pos, traits_type::length(str));
-            }
-
-            size_type find_last_of(value_type c, size_type pos = npos) const noexcept
-            {
-                return rfind(c, pos);
-            }
-
-            size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept
-            {
-                return find_first_not_of(str.c_str(), pos, str.size());
-            }
-
-            size_type find_first_not_of(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty() || pos >= size())
-                    return npos;
-
-                size_type idx{pos};
-
-                while (idx < size_)
-                {
-                    if (!is_any_of_(idx, str, len))
-                        return idx;
-                    ++idx;
-                }
-
-                return npos;
-            }
-
-            size_type find_first_not_of(const value_type* str, size_type pos = 0) const noexcept
-            {
-                return find_first_not_of(str, pos, traits_type::length(str));
-            }
-
-            size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept
-            {
-                if (empty())
-                    return npos;
-
-                for (size_type i = pos; i < size_; ++i)
-                {
-                    if (!traits_type::eq(c, data_[i]))
-                        return i;
-                }
-
-                return npos;
-            }
-
-            size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept
-            {
-                return find_last_not_of(str.c_str(), pos, str.size());
-            }
-
-            size_type find_last_not_of(const value_type* str, size_type pos, size_type len) const noexcept
-            {
-                if (empty())
-                    return npos;
-
-                for (size_type i = min(pos, size_ - 1) + 1; i > 0; --i)
-                {
-                    if (!is_any_of_(i - 1, str, len))
-                        return i - 1;
-                }
-
-                return npos;
-            }
-
-            size_type find_last_not_of(const value_type* str, size_type pos = npos) const noexcept
-            {
-                return find_last_not_of(str, pos, traits_type::length(str));
-            }
-
-            size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept
-            {
-                if (empty())
-                    return npos;
-
-                pos = min(pos, size_ - 1);
-
-                for (size_type i = min(pos, size_ - 1) + 1; i > 1; --i)
-                {
-                    if (!traits_type::eq(c, data_[i - 1]))
-                        return i - 1;
-                }
-
-                return npos;
-            }
-
-            basic_string substr(size_type pos = 0, size_type n = npos) const
-            {
-                // TODO: throw out_of_range if pos > size().
-                auto len = min(n, size_ - pos);
-                return basic_string{data() + pos, len};
-            }
-
-            int compare(const basic_string& other) const noexcept
-            {
-                auto len = min(size(), other.size());
-                auto comp = traits_type::compare(data_, other.data(), len);
-
-                if (comp != 0)
-                    return comp;
-                else if (size() == other.size())
-                    return 0;
-                else if (size() > other.size())
-                    return 1;
-                else
-                    return -1;
-            }
-
-            int compare(size_type pos, size_type n, const basic_string& other) const
-            {
-                return basic_string{*this, pos, n}.compare(other);
-            }
-
-            int compare(size_type pos1, size_type n1, const basic_string& other,
-                        size_type pos2, size_type n2 = npos) const
-            {
-                return basic_string{*this, pos1, n1}.compare(basic_string{other, pos2, n2});
-            }
-
-            int compare(const value_type* other) const
-            {
-                return compare(basic_string(other));
-            }
-
-            int compare(size_type pos, size_type n, const value_type* other) const
-            {
-                return basic_string{*this, pos, n}.compare(basic_string{other});
-            }
-
-            int compare(size_type pos, size_type n1,
-                        const value_type* other, size_type n2) const
-            {
-                return basic_string{*this, pos, n1}.compare(basic_string{other, n2});
-            }
-
-        private:
-            value_type* data_;
-            size_type size_;
-            size_type capacity_;
-            allocator_type allocator_;
-
-            template<class C, class T, class A>
-            friend class basic_stringbuf;
-
-            /**
-             * Arbitrary value, standard just requires
-             * data() to have some capacity.
-             * (Well, we could've done data_ = &data_ and
-             * set capacity to 0, but that would be too cryptic.)
-             */
-            static constexpr size_type default_capacity_{4};
-
-            void init_(const value_type* str, size_type size)
-            {
-                if (data_)
-                    allocator_.deallocate(data_, capacity_);
-
-                size_ = size;
-                capacity_ = size + 1;
-
-                data_ = allocator_.allocate(capacity_);
-                traits_type::copy(data_, str, size);
-                ensure_null_terminator_();
-            }
-
-            size_type next_capacity_(size_type hint = 0) const noexcept
-            {
-                if (hint != 0)
-                    return max(capacity_ * 2, hint);
-                else
-                    return max(capacity_ * 2, size_type{2u});
-            }
-
-            void ensure_free_space_(size_type n)
-            {
-                /**
-                 * Note: We cannot use reserve like we
-                 *       did in vector, because in string
-                 *       reserve can cause shrinking.
-                 */
-                if (size_ + 1 + n > capacity_)
-                    resize_with_copy_(size_, max(size_ + 1 + n, next_capacity_()));
-            }
-
-            void resize_without_copy_(size_type capacity)
-            {
-                if (data_)
-                    allocator_.deallocate(data_, capacity_);
-
-                data_ = allocator_.allocate(capacity);
-                size_ = 0;
-                capacity_ = capacity;
-                ensure_null_terminator_();
-            }
-
-            void resize_with_copy_(size_type size, size_type capacity)
-            {
-                if(capacity_ == 0 || capacity_ < capacity)
-                {
-                    auto new_data = allocator_.allocate(capacity);
-
-                    auto to_copy = min(size, size_);
-                    traits_type::move(new_data, data_, to_copy);
-
-                    std::swap(data_, new_data);
-
-                    allocator_.deallocate(new_data, capacity_);
-                }
-
-                capacity_ = capacity;
-                size_ = size;
-                ensure_null_terminator_();
-            }
-
-            template<class Iterator1, class Iterator2>
-            Iterator2 copy_(Iterator1 first, Iterator1 last,
-                            Iterator2 result)
-            {
-                while (first != last)
-                    traits_type::assign(*result++, *first++);
-
-                return result;
-            }
-
-            template<class Iterator1, class Iterator2>
-            Iterator2 copy_backward_(Iterator1 first, Iterator1 last,
-                                     Iterator2 result)
-            {
-                while (last != first)
-                    traits_type::assign(*--result, *--last);
-
-                return result;
-            }
-
-            void ensure_null_terminator_()
-            {
-                value_type c{};
-                traits_type::assign(data_[size_], c);
-            }
-
-            bool is_any_of_(size_type idx, const value_type* str, size_type len) const
-            {
-                for (size_type i = 0; i < len; ++i)
-                {
-                    if (traits_type::eq(data_[idx], str[i]))
-                        return true;
-                }
-
-                return false;
-            }
-
-            bool substr_starts_at_(size_type idx, const value_type* str, size_type len) const
-            {
-                size_type i{};
-                for (i = 0; i < len; ++i)
-                {
-                    if (!traits_type::eq(data_[idx + i], str[i]))
-                        break;
-                }
-
-                return i == len;
-            }
-    };
-
-    using string    = basic_string<char>;
-    using u16string = basic_string<char16_t>;
-    using u32string = basic_string<char32_t>;
-    using wstring   = basic_string<wchar_t>;
-
-    /**
-     * 21.4.8, basic_string non-member functions:
-     */
-
-    /**
-     * 21.4.8.1, operator+:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const basic_string<Char, Traits, Allocator>& lhs,
-              const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return basic_string<Char, Traits, Allocator>{lhs}.append(rhs);
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(basic_string<Char, Traits, Allocator>&& lhs,
-              const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return move(lhs.append(rhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const basic_string<Char, Traits, Allocator>& lhs,
-              basic_string<Char, Traits, Allocator>&& rhs)
-    {
-        return move(rhs.insert(0, lhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(basic_string<Char, Traits, Allocator>&& lhs,
-              basic_string<Char, Traits, Allocator>&& rhs)
-    {
-        return move(lhs.append(rhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const Char* lhs,
-              const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return basic_string<Char, Traits, Allocator>{lhs} + rhs;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const Char* lhs,
-              basic_string<Char, Traits, Allocator>&& rhs)
-    {
-        return move(rhs.insert(0, lhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(Char lhs,
-              const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return basic_string<Char, Traits, Allocator>{1, lhs}.append(rhs);
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(Char lhs,
-              basic_string<Char, Traits, Allocator>&& rhs)
-    {
-        return move(rhs.insert(0, 1, lhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const basic_string<Char, Traits, Allocator>& lhs,
-              const Char* rhs)
-    {
-        return lhs + basic_string<Char, Traits, Allocator>{rhs};
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(basic_string<Char, Traits, Allocator>&& lhs,
-              const Char* rhs)
-    {
-        return move(lhs.append(rhs));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(const basic_string<Char, Traits, Allocator>& lhs,
-              Char rhs)
-    {
-        return lhs + basic_string<Char, Traits, Allocator>{1, rhs};
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_string<Char, Traits, Allocator>
-    operator+(basic_string<Char, Traits, Allocator>&& lhs,
-              Char rhs)
-    {
-        return move(lhs.append(1, rhs));
-    }
-
-    /**
-     * 21.4.8.2, operator==:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator==(const basic_string<Char, Traits, Allocator>& lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return lhs.compare(rhs) == 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator==(const Char* lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs == lhs;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator==(const basic_string<Char, Traits, Allocator>& lhs,
-                    const Char* rhs)
-    {
-        return lhs.compare(rhs) == 0;
-    }
-
-    /**
-     * 21.4.8.3, operator!=:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator!=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator!=(const Char* lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs != lhs;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator!=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const Char* rhs)
-    {
-        return lhs.compare(rhs) != 0;
-    }
-
-    /**
-     * 21.4.8.4, operator<:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<(const basic_string<Char, Traits, Allocator>& lhs,
-                   const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return lhs.compare(rhs) < 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<(const Char* lhs,
-                   const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs.compare(lhs) > 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<(const basic_string<Char, Traits, Allocator>& lhs,
-                   const Char* rhs)
-    {
-        return lhs.compare(rhs) < 0;
-    }
-
-    /**
-     * 21.4.8.5, operator>:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>(const basic_string<Char, Traits, Allocator>& lhs,
-                   const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return lhs.compare(rhs) > 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>(const Char* lhs,
-                   const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs.compare(lhs) < 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>(const basic_string<Char, Traits, Allocator>& lhs,
-                   const Char* rhs)
-    {
-        return lhs.compare(rhs) > 0;
-    }
-
-    /**
-     * 21.4.8.6, operator<=:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return lhs.compare(rhs) <= 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<=(const Char* lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs.compare(lhs) >= 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator<=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const Char* rhs)
-    {
-        return lhs.compare(rhs) <= 0;
-    }
-
-    /**
-     * 21.4.8.7, operator>=:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs) noexcept
-    {
-        return lhs.compare(rhs) >= 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>=(const Char* lhs,
-                    const basic_string<Char, Traits, Allocator>& rhs)
-    {
-        return rhs.compare(lhs) <= 0;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    bool operator>=(const basic_string<Char, Traits, Allocator>& lhs,
-                    const Char* rhs)
-    {
-        return lhs.compare(rhs) >= 0;
-    }
-
-    /**
-     * 21.4.8.8, swap:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    void swap(basic_string<Char, Traits, Allocator>& lhs,
-              basic_string<Char, Traits, Allocator>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    /**
-     * 21.5, numeric conversions:
-     */
-
-    int stoi(const string& str, size_t* idx = nullptr, int base = 10);
-    long stol(const string& str, size_t* idx = nullptr, int base = 10);
-    unsigned long stoul(const string& str, size_t* idx = nullptr, int base = 10);
-    long long stoll(const string& str, size_t* idx = nullptr, int base = 10);
-    unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
-
-    float stof(const string& str, size_t* idx = nullptr);
-    double stod(const string& str, size_t* idx = nullptr);
-    long double stold(const string& str, size_t* idx = nullptr);
-
-    string to_string(int val);
-    string to_string(unsigned val);
-    string to_string(long val);
-    string to_string(unsigned long val);
-    string to_string(long long val);
-    string to_string(unsigned long long val);
-    string to_string(float val);
-    string to_string(double val);
-    string to_string(long double val);
-
-    int stoi(const wstring& str, size_t* idx = nullptr, int base = 10);
-    long stol(const wstring& str, size_t* idx = nullptr, int base = 10);
-    unsigned long stoul(const wstring& str, size_t* idx = nullptr, int base = 10);
-    long long stoll(const wstring& str, size_t* idx = nullptr, int base = 10);
-    unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
-
-    float stof(const wstring& str, size_t* idx = nullptr);
-    double stod(const wstring& str, size_t* idx = nullptr);
-    long double stold(const wstring& str, size_t* idx = nullptr);
-
-    wstring to_wstring(int val);
-    wstring to_wstring(unsigned val);
-    wstring to_wstring(long val);
-    wstring to_wstring(unsigned long val);
-    wstring to_wstring(long long val);
-    wstring to_wstring(unsigned long long val);
-    wstring to_wstring(float val);
-    wstring to_wstring(double val);
-    wstring to_wstring(long double val);
-
-    /**
-     * 21.6, hash support:
-     */
-
-    template<class>
-    struct hash;
-
-    template<>
-    struct hash<string>
-    {
-        size_t operator()(const string& str) const noexcept
-        {
-            size_t res{};
-
-            /**
-             * Note: No need for fancy algorithms here,
-             *       std::hash is used for indexing, not
-             *       cryptography.
-             */
-            for (const auto& c: str)
-                res = res * 5 + (res >> 3) + static_cast<size_t>(c);
-
-            return res;
-        }
-
-        using argument_type = string;
-        using result_type   = size_t;
-    };
-
-    template<>
-    struct hash<wstring>
-    {
-        size_t operator()(const wstring& str) const noexcept
-        {
-            // TODO: implement
-            __unimplemented();
-            return size_t{};
-        }
-
-        using argument_type = wstring;
-        using result_type   = size_t;
-    };
-
-    // TODO: add those other 2 string types
-
-    /**
-     * 21.7, suffix for basic_string literals:
-     */
-
-    /**
-     * Note: According to the standard, literal suffixes that do not
-     *       start with an underscore are reserved for future standardization,
-     *       but since we are implementing the standard, we're going to ignore it.
-     *       This should work (according to their documentation) work for clang,
-     *       but that should be tested.
-     */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wliteral-suffix"
-inline namespace literals {
-inline namespace string_literals
-{
-    string operator "" s(const char* str, size_t len);
-    u16string operator "" s(const char16_t* str, size_t len);
-    u32string operator "" s(const char32_t* str, size_t len);
-
-    /* Problem: wchar_t == int in HelenOS, but standard forbids it.
-    wstring operator "" s(const wchar_t* str, size_t len);
-    */
-}}
-#pragma GCC diagnostic pop
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/string/string_io.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/string/string_io.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,192 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_STRING_IO
-#define LIBCPP_BITS_STRING_IO
-
-#include <__bits/string/string.hpp>
-#include <ios>
-
-namespace std
-{
-    /**
-     * 21.4.8.9, inserters and extractors:
-     */
-
-    template<class Char, class Traits, class Allocator>
-    basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
-                                            basic_string<Char, Traits, Allocator>& str)
-    {
-        using sentry = typename basic_istream<Char, Traits>::sentry;
-        sentry sen{is, false};
-
-        if (sen)
-        {
-            str.erase();
-
-            auto max_size = is.width();
-            if (max_size <= 0)
-                max_size = static_cast<streamsize>(str.max_size());
-
-            streamsize i{};
-            for(; i < max_size; ++i)
-            {
-                auto ic = is.rdbuf()->sgetc();
-                if (Traits::eq_int_type(ic, Traits::eof()))
-                {
-                    is.setstate(ios_base::eofbit);
-                    break;
-                }
-
-                auto c = Traits::to_char_type(ic);
-                if(isspace(c, is.getloc()))
-                    break;
-
-                str.push_back(c);
-                is.rdbuf()->sbumpc();
-            }
-
-            if (i == 0)
-                is.setstate(ios_base::failbit);
-        }
-        else
-            is.setstate(ios_base::failbit);
-
-        return is;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const basic_string<Char, Traits, Allocator>& str)
-    {
-        // TODO: determine padding as described in 27.7.3.6.1
-        using sentry = typename basic_ostream<Char, Traits>::sentry;
-        sentry sen{os};
-
-        if (sen)
-        {
-            auto width = os.width();
-            auto size = str.size();
-
-            size_t to_pad{};
-            if (width > 0)
-                to_pad = (static_cast<size_t>(width) - size);
-
-            if (to_pad > 0)
-            {
-                if ((os.flags() & ios_base::adjustfield) != ios_base::left)
-                {
-                    for (std::size_t i = 0; i < to_pad; ++i)
-                        os.put(os.fill());
-                }
-
-                os.rdbuf()->sputn(str.data(), size);
-
-                if ((os.flags() & ios_base::adjustfield) == ios_base::left)
-                {
-                    for (std::size_t i = 0; i < to_pad; ++i)
-                        os.put(os.fill());
-                }
-            }
-            else
-                os.rdbuf()->sputn(str.data(), size);
-
-            os.width(0);
-        }
-
-        return os;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_istream<Char, Traits>& getline(basic_istream<Char, Traits>& is,
-                                         basic_string<Char, Traits, Allocator>& str,
-                                         Char delim)
-    {
-        typename basic_istream<Char, Traits>::sentry sen{is, true};
-
-        if (sen)
-        {
-            str.clear();
-            streamsize count{};
-
-            while (true)
-            {
-                auto ic = is.rdbuf()->sbumpc();
-                if (Traits::eq_int_type(ic, Traits::eof()))
-                {
-                    is.setstate(ios_base::eofbit);
-                    break;
-                }
-
-                auto c = Traits::to_char_type(ic);
-                if (Traits::eq(c, delim))
-                    break;
-
-                str.push_back(c);
-                ++count;
-
-                if (count >= static_cast<streamsize>(str.max_size()))
-                {
-                    is.setstate(ios_base::failbit);
-                    break;
-                }
-            }
-
-            if (count == 0)
-                is.setstate(ios_base::failbit);
-        }
-        else
-            is.setstate(ios_base::failbit);
-
-        return is;
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_istream<Char, Traits>& getline(basic_istream<Char, Traits>&& is,
-                                         basic_string<Char, Traits, Allocator>& str,
-                                         Char delim)
-    {
-        return getline(is, str, delim);
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_istream<Char, Traits>& getline(basic_istream<Char, Traits>& is,
-                                         basic_string<Char, Traits, Allocator>& str)
-    {
-        return getline(is, str, is.widen('\n'));
-    }
-
-    template<class Char, class Traits, class Allocator>
-    basic_istream<Char, Traits>& getline(basic_istream<Char, Traits>&& is,
-                                         basic_string<Char, Traits, Allocator>& str)
-    {
-        return getline(is, str, is.widen('\n'));
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/string/stringfwd.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/string/stringfwd.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_STRING_STRINGFWD
-#define LIBCPP_BITS_STRING_STRINGFWD
-
-namespace std
-{
-    template<class Char>
-    struct char_traits;
-
-    template<class T>
-    struct allocator;
-
-    template<
-        class Char,
-        class Traits = char_traits<Char>,
-        class Allocator = allocator<Char>
-    >
-    class basic_string;
-
-    using string  = basic_string<char>;
-    using wstring = basic_string<wchar_t>;
-
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/system_error.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/system_error.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,368 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_SYSTEM_ERROR
-#define LIBCPP_BITS_SYSTEM_ERROR
-
-#include <__bits/aux.hpp>
-#include <__bits/string/stringfwd.hpp>
-#include <stdexcept>
-#include <type_traits>
-
-namespace std
-{
-    class error_condition;
-    class error_code;
-
-    enum class errc
-    { // TODO: add matching values
-        address_family_not_supported,
-        address_in_use,
-        address_not_available,
-        already_connected,
-        argument_list_too_long,
-        argument_out_of_domain,
-        bad_address,
-        bad_file_descriptor,
-        bad_message,
-        broken_pipe,
-        connection_aborted,
-        connection_already_in_progress,
-        connection_refused,
-        connection_reset,
-        cross_device_link,
-        destination_address_required,
-        device_or_resource_busy,
-        directory_not_empty,
-        executable_format_error,
-        file_exists,
-        file_too_large,
-        filename_too_long,
-        function_not_supported,
-        host_unreachable,
-        identifier_removed,
-        illegal_byte_sequence,
-        inappropriate_io_control_operation,
-        interrupted,
-        invalid_argument,
-        invalid_seek,
-        io_error,
-        is_a_directory,
-        message_size,
-        network_down,
-        network_reset,
-        network_unreachable,
-        no_buffer_space,
-        no_child_process,
-        no_link,
-        no_lock_available,
-        no_message_available,
-        no_message,
-        no_protocol_option,
-        no_space_on_device,
-        no_stream_resources,
-        no_such_device_or_address,
-        no_such_device,
-        no_such_file_or_directory,
-        no_such_process,
-        not_a_directory,
-        not_a_socket,
-        not_a_stream,
-        not_connected,
-        not_enough_memory,
-        not_supported,
-        operation_canceled,
-        operation_in_progress,
-        operation_not_permitted,
-        operation_not_supported,
-        operation_would_block,
-        owner_dead,
-        permission_denied,
-        protocol_error,
-        protocol_not_supported,
-        read_only_file_system,
-        resource_deadlock_would_occur,
-        resource_unavailable_try_again,
-        result_out_of_range,
-        state_not_recoverable,
-        stream_timeout,
-        text_file_busy,
-        timed_out,
-        too_many_files_open_in_system,
-        too_many_files_open,
-        too_many_links,
-        too_many_symbolic_link_levels,
-        value_too_large,
-        wrong_protocol_type
-    };
-
-    template<class>
-    struct is_error_code_enum: false_type
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct is_error_code_enum<errc>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_error_code_enum_v = is_error_code_enum<T>::value;
-
-    template<class>
-    struct is_error_condition_enum: false_type
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct is_error_condition_enum<errc>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<T>::value;
-
-    /**
-     * 19.5.1, class error_category:
-     */
-
-    class error_category
-    {
-        public:
-            constexpr error_category() noexcept = default;
-            virtual ~error_category();
-
-            error_category(const error_category&) = delete;
-            error_category& operator=(const error_category&) = delete;
-
-            virtual const char* name() const noexcept = 0;
-            virtual error_condition default_error_condition(int) const noexcept;
-            virtual bool equivalent(int, const error_condition&) const noexcept;
-            virtual bool equivalent(const error_code&, int) const noexcept;
-            virtual string message(int) const = 0;
-
-            bool operator==(const error_category&) const noexcept;
-            bool operator!=(const error_category&) const noexcept;
-            bool operator<(const error_category&) const noexcept;
-    };
-
-    const error_category& generic_category() noexcept;
-    const error_category& system_category() noexcept;
-
-    /**
-     * 19.5.2, class error_code:
-     */
-
-    class error_code
-    {
-        public:
-            /**
-             * 19.5.2.2, constructors:
-             */
-
-            error_code() noexcept;
-            error_code(int, const error_category&) noexcept;
-
-            template<class ErrorCodeEnum>
-            error_code(
-                enable_if_t<is_error_code_enum_v<ErrorCodeEnum>, ErrorCodeEnum> e
-            ) noexcept
-            {
-                val_ = static_cast<int>(e);
-                cat_ = &generic_category();
-            }
-
-            /**
-             * 19.5.2.3, modifiers:
-             */
-
-            void assign(int, const error_category&) noexcept;
-
-            template<class ErrorCodeEnum>
-            error_code& operator=(
-                enable_if_t<is_error_code_enum_v<ErrorCodeEnum>, ErrorCodeEnum> e
-            ) noexcept
-            {
-                val_ = static_cast<int>(e);
-                cat_ = &generic_category();
-
-                return *this;
-            }
-
-            void clear() noexcept;
-
-            /**
-             * 19.5.2.4, observers:
-             */
-
-            int value() const noexcept;
-            const error_category& category() const noexcept;
-            error_condition default_error_condition() const noexcept;
-            string message() const;
-
-            explicit operator bool() const noexcept
-            {
-                return val_ != 0;
-            }
-
-        private:
-            int val_;
-            const error_category* cat_;
-    };
-
-    /**
-     * 19.5.2.5, non-member functions:
-     */
-
-    error_code make_error_code(errc e) noexcept;
-    bool operator<(const error_code&, const error_code&) noexcept;
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os,
-                                            const error_code& ec)
-    {
-        return os << ec.category().name() << ": " << ec.value();
-    }
-
-    /**
-     * 19.5.3, class error_condition:
-     */
-
-    class error_condition
-    {
-        public:
-            /**
-             * 19.5.3.2, constructors:
-             */
-
-            error_condition() noexcept;
-            error_condition(int, const error_category&) noexcept;
-
-            template<class ErrorCodeEnum>
-            error_condition(
-                enable_if_t<is_error_code_enum_v<ErrorCodeEnum>, ErrorCodeEnum> e
-            ) noexcept
-            {
-                val_ = static_cast<int>(e);
-                cat_ = &generic_category();
-            }
-
-            /**
-             * 19.5.3.3, modifiers:
-             */
-
-            void assign(int, const error_category&) noexcept;
-
-            template<class ErrorCodeEnum>
-            error_condition& operator=(
-                enable_if_t<is_error_code_enum_v<ErrorCodeEnum>, ErrorCodeEnum> e
-            ) noexcept
-            {
-                val_ = static_cast<int>(e);
-                cat_ = &generic_category();
-
-                return *this;
-            }
-
-            void clear() noexcept;
-
-            /**
-             * 19.5.3.4, observers:
-             */
-
-            int value() const noexcept;
-            const error_category& category() const noexcept;
-            string message() const;
-
-            explicit operator bool() const noexcept
-            {
-                return val_ != 0;
-            }
-
-        private:
-            int val_;
-            const error_category* cat_;
-    };
-
-    /**
-     * 19.5.3.4, non-member functions:
-     */
-
-    error_condition make_error_condition(errc e) noexcept;
-    bool operator<(const error_condition&, const error_condition&) noexcept;
-
-    /**
-     * 19.5.4, comparison operators:
-     */
-
-    bool operator==(const error_code&, const error_code&) noexcept;
-    bool operator==(const error_code&, const error_condition&) noexcept;
-    bool operator==(const error_condition&, const error_code&) noexcept;
-    bool operator==(const error_condition&, const error_condition&) noexcept;
-    bool operator!=(const error_code&, const error_code&) noexcept;
-    bool operator!=(const error_code&, const error_condition&) noexcept;
-    bool operator!=(const error_condition&, const error_code&) noexcept;
-    bool operator!=(const error_condition&, const error_condition&) noexcept;
-
-    /**
-     * 19.5.6, class system_error:
-     */
-
-    class system_error: public runtime_error
-    {
-        public:
-            system_error(error_code, const string&);
-            system_error(error_code, const char*);
-            system_error(error_code);
-            system_error(int, const error_category&, const string&);
-            system_error(int, const error_category&, const char*);
-            system_error(int, const error_category&);
-
-            const error_code& code() const noexcept;
-
-        private:
-            error_code code_;
-    };
-
-    /**
-     * 19.5.5, hash support:
-     */
-
-    template<class>
-    struct hash;
-
-    template<>
-    struct hash<error_code>
-    {
-        size_t operator()(const error_code& ec) const noexcept
-        {
-            return static_cast<size_t>(ec.value());
-        }
-
-        using result_type   = size_t;
-        using argument_type = error_code;
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/test/mock.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/test/mock.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2017 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TEST_MOCK
-#define LIBCPP_BITS_TEST_MOCK
-
-#include <cstdlib>
-#include <tuple>
-
-namespace std::test
-{
-    /**
-     * Auxiliary type that lets us to monitor the number
-     * of calls to various functions for the purposes
-     * of testing smart pointers and other features of
-     * the library.
-     */
-    struct mock
-    {
-        static size_t constructor_calls;
-        static size_t copy_constructor_calls;
-        static size_t destructor_calls;
-        static size_t move_constructor_calls;
-
-        mock()
-        {
-            ++constructor_calls;
-        }
-
-        mock(const mock&)
-        {
-            ++copy_constructor_calls;
-        }
-
-        mock(mock&&)
-        {
-            ++move_constructor_calls;
-        }
-
-        ~mock()
-        {
-            ++destructor_calls;
-        }
-
-        static void clear()
-        {
-            constructor_calls = size_t{};
-            copy_constructor_calls = size_t{};
-            destructor_calls = size_t{};
-            move_constructor_calls = size_t{};
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/test/test.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/test/test.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TEST
-#define LIBCPP_BITS_TEST
-
-#include <utility>
-#include <iterator>
-#include <type_traits>
-
-namespace std::test
-{
-    class test_suite
-    {
-        public:
-            virtual bool run(bool) = 0;
-            virtual const char* name() = 0;
-
-            virtual ~test_suite() = default;
-
-            unsigned int get_failed() const noexcept;
-
-            unsigned int get_succeeded() const noexcept;
-
-        protected:
-            void report(bool, const char*);
-            void start();
-            bool end();
-
-            unsigned int failed_{};
-            unsigned int succeeded_{};
-            bool ok_{true};
-            bool report_{true};
-
-            void test(const char* tname, bool expr)
-            {
-                test_eq(tname, expr, true);
-            }
-
-            template<class... Args>
-            void test_eq(const char* tname, Args&&... args)
-            {
-                if (!assert_eq(std::forward<Args>(args)...))
-                {
-                    report(false, tname);
-                    ++failed_;
-                    ok_ = false;
-                }
-                else
-                {
-                    report(true, tname);
-                    ++succeeded_;
-                }
-            }
-
-            template<class T, class U>
-            bool assert_eq(const T& lhs, const U& rhs)
-            {
-                return lhs == rhs;
-            }
-
-            template<class Iterator1, class Iterator2>
-            bool assert_eq(Iterator1 first1, Iterator1 last1,
-                           Iterator2 first2, Iterator2 last2)
-            {
-                auto len1 = std::distance(first1, last1);
-                auto len2 = std::distance(first2, last2);
-
-                using common_t = std::common_type_t<decltype(len1), decltype(len2)>;
-                auto len1_common = static_cast<common_t>(len1);
-                auto len2_common = static_cast<common_t>(len2);
-
-                if (len1_common != len2_common)
-                    return false;
-
-                while (first1 != last1)
-                {
-                    if (*first1++ != *first2++)
-                        return false;
-                }
-
-                return true;
-            }
-
-            template<class Iterator, class Container>
-            void test_contains(const char* tname, Iterator first,
-                               Iterator last, const Container& cont)
-            {
-                if (!assert_contains(first, last, cont))
-                {
-                    report(false, tname);
-                    ++failed_;
-                    ok_ = false;
-                }
-                else
-                {
-                    report(true, tname);
-                    ++succeeded_;
-                }
-            }
-
-            template<class Iterator1, class Iterator2, class Container>
-            void test_contains_multi(const char* tname, Iterator1 first1,
-                               Iterator1 last1, Iterator2 first2,
-                               const Container& cont)
-            {
-                if (!assert_contains_multi(first1, last1, first2, cont))
-                {
-                    report(false, tname);
-                    ++failed_;
-                    ok_ = false;
-                }
-                else
-                {
-                    report(true, tname);
-                    ++succeeded_;
-                }
-            }
-
-            template<class Iterator, class Container>
-            bool assert_contains(Iterator first, Iterator last, const Container& cont)
-            {
-                while (first != last)
-                {
-                    if (cont.find(*first++) == cont.end())
-                        return false;
-                }
-
-                return true;
-            }
-
-            template<class Iterator1, class Iterator2, class Container>
-            bool assert_contains_multi(Iterator1 first1, Iterator1 last1,
-                                       Iterator2 first2, const Container& cont)
-            {
-                while (first1 != last1)
-                {
-                    if (cont.count(*first1++) != *first2++)
-                        return false;
-                }
-
-                return true;
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/test/tests.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/test/tests.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TEST_TESTS
-#define LIBCPP_BITS_TEST_TESTS
-
-#include <__bits/test/test.hpp>
-#include <cstdio>
-#include <vector>
-
-namespace std::test
-{
-    class test_set
-    {
-        public:
-            test_set() = default;
-
-            template<class T>
-            void add()
-            {
-                tests_.push_back(new T{});
-            }
-
-            bool run(bool report)
-            {
-                bool res{true};
-                unsigned int succeeded{};
-                unsigned int failed{};
-
-                for (auto test: tests_)
-                {
-                    res &= test->run(report);
-                    succeeded += test->get_succeeded();
-                    failed += test->get_failed();
-                }
-
-                if (report)
-                {
-                    std::printf("\n");
-                    if (res)
-                        std::printf("[TESTS SUCCEEDED!]");
-                    else
-                        std::printf("[TESTS FAILED]");
-                    std::printf("[%u OK][%u FAIL][%u TOTAL]\n",
-                                succeeded, failed, (succeeded + failed));
-                }
-
-                return res;
-            }
-
-            ~test_set()
-            {
-                for (auto ptr: tests_)
-                    delete ptr;
-            }
-        private:
-            std::vector<test_suite*> tests_{};
-    };
-
-    class array_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-            array_test() = default;
-            ~array_test() = default;
-    };
-
-    class vector_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-            vector_test() = default;
-            ~vector_test() = default;
-
-        private:
-            void test_construction_and_assignment();
-            void test_insert();
-            void test_erase();
-    };
-
-    class string_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_construction_and_assignment();
-            void test_append();
-            void test_insert();
-            void test_erase();
-            void test_replace();
-            void test_copy();
-            void test_find();
-            void test_substr();
-            void test_compare();
-    };
-
-    class bitset_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_strings();
-            void test_operations();
-    };
-
-    class deque_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_resizing();
-            void test_push_pop();
-            void test_operations();
-    };
-
-    class tuple_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_creation();
-            void test_tie_and_structured_bindings();
-            void test_tuple_ops();
-    };
-
-    class map_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_histogram();
-            void test_emplace_insert();
-            void test_bounds_and_ranges();
-            void test_multi();
-            void test_reverse_iterators();
-            void test_multi_bounds_and_ranges();
-    };
-
-    class set_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_emplace_insert();
-            void test_bounds_and_ranges();
-            void test_multi();
-            void test_reverse_iterators();
-            void test_multi_bounds_and_ranges();
-    };
-
-    class unordered_map_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_histogram();
-            void test_emplace_insert();
-            void test_multi();
-    };
-
-    class unordered_set_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_constructors_and_assignment();
-            void test_emplace_insert();
-            void test_multi();
-    };
-
-    class numeric_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_algorithms();
-            void test_complex();
-    };
-
-    class adaptors_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_queue();
-            void test_priority_queue();
-            void test_stack();
-    };
-
-    class memory_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_unique_ptr();
-            void test_shared_ptr();
-            void test_weak_ptr();
-            void test_allocators();
-            void test_pointers();
-    };
-
-    class list_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-
-        private:
-            void test_construction_and_assignment();
-            void test_modifiers();
-    };
-
-    class ratio_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-    };
-
-    class functional_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-        private:
-            void test_reference_wrapper();
-            void test_function();
-            void test_bind();
-    };
-
-    class algorithm_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-        private:
-            void test_non_modifying();
-            void test_mutating();
-    };
-
-    class future_test: public test_suite
-    {
-        public:
-            bool run(bool) override;
-            const char* name() override;
-        private:
-            void test_future();
-            void test_promise();
-            void test_future_promise();
-            void test_async();
-            void test_packaged_task();
-            void test_shared_future();
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/async.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/async.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_ASYNC
-#define LIBCPP_BITS_THREAD_ASYNC
-
-#include <__bits/thread/future.hpp>
-#include <__bits/thread/future_common.hpp>
-#include <__bits/thread/shared_state.hpp>
-#include <__bits/type_traits/result_of.hpp>
-#include <__bits/utility/forward_move.hpp>
-#include <cassert>
-
-namespace std
-{
-
-    enum class launch
-    {
-        async = 1,
-        deferred
-    };
-
-    namespace aux
-    {
-        /**
-         * Note: The reason we keep the actual function
-         *       within the aux namespace is that were the non-policy
-         *       version of the function call the other one in the std
-         *       namespace, we'd get resolution conflicts. This way
-         *       aux::async is properly called even if std::async is
-         *       called either with or without a launch policy.
-         */
-        template<class F, class... Args>
-        future<result_of_t<decay_t<F>(decay_t<Args>...)>>
-        async(launch policy, F&& f, Args&&... args)
-        {
-            using result_t = result_of_t<decay_t<F>(decay_t<Args>...)>;
-
-            bool async = (static_cast<int>(policy) &
-                          static_cast<int>(launch::async)) != 0;
-            bool deferred = (static_cast<int>(policy) &
-                             static_cast<int>(launch::deferred)) != 0;
-
-            /**
-             * Note: The case when async | deferred is set in policy
-             *       is implementation defined, feel free to change.
-             * Rationale: We chose the 'deferred' policy, because unlike
-             *            the 'async' policy it carries no possible
-             *            surprise ('async' can fail due to thread
-             *            creation error).
-             */
-            if (async && deferred)
-            {
-                return future<result_t>{
-                    new aux::deferred_shared_state<
-                        result_t, F, Args...
-                    >{forward<F>(f), forward<Args>(args)...}
-                };
-            }
-            else if (async)
-            {
-                return future<result_t>{
-                    new aux::async_shared_state<
-                        result_t, F, Args...
-                    >{forward<F>(f), forward<Args>(args)...}
-                };
-            }
-            else if (deferred)
-            {
-               /**
-                * Duplicated on purpose because of the default.
-                * Do not remove!
-                */
-                return future<result_t>{
-                    new aux::deferred_shared_state<
-                        result_t, F, Args...
-                    >{forward<F>(f), forward<Args>(args)...}
-                };
-            }
-
-            /**
-             * This is undefined behaviour, abandon ship!
-             */
-            abort();
-        }
-    }
-
-    template<class F>
-    decltype(auto) async(F&& f)
-    {
-        launch policy = static_cast<launch>(
-            static_cast<int>(launch::async) |
-            static_cast<int>(launch::deferred)
-        );
-
-        return aux::async(policy, forward<F>(f));
-    }
-
-    /**
-     * The async(launch, F, Args...) and async(F, Args...)
-     * overloards must not collide, so we check the first template
-     * argument and handle the special case of just a functor
-     * above.
-     */
-    template<class F, class Arg, class... Args>
-    decltype(auto) async(F&& f, Arg&& arg, Args&&... args)
-    {
-        if constexpr (is_same_v<decay_t<F>, launch>)
-            return aux::async(f, forward<Arg>(arg), forward<Args>(args)...);
-        else
-        {
-            launch policy = static_cast<launch>(
-                static_cast<int>(launch::async) |
-                static_cast<int>(launch::deferred)
-            );
-
-            return aux::async(policy, forward<F>(f), forward<Arg>(arg), forward<Args>(args)...);
-        }
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/condition_variable.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/condition_variable.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_CONDITION_VARIABLE
-#define LIBCPP_BITS_THREAD_CONDITION_VARIABLE
-
-#include <__bits/thread/threading.hpp>
-#include <mutex>
-
-namespace std
-{
-    enum class cv_status
-    {
-        no_timeout,
-        timeout
-    };
-
-    namespace aux
-    {
-        template<class Clock, class Duration>
-        aux::time_unit_t time_until(const chrono::time_point<Clock, Duration>& abs_time)
-        {
-            return aux::threading::time::convert(abs_time - Clock::now());
-        }
-    }
-
-    /**
-     * 30.5.1, class condition_variable:
-     */
-
-    class condition_variable
-    {
-        public:
-            condition_variable();
-            ~condition_variable();
-
-            condition_variable(const condition_variable&) = delete;
-            condition_variable& operator=(const condition_variable&) = delete;
-
-            void notify_one() noexcept;
-            void notify_all() noexcept;
-
-            void wait(unique_lock<mutex>&);
-
-            template<class Predicate>
-            void wait(unique_lock<mutex>& lock, Predicate pred)
-            {
-                /**
-                 * Note: lock is supposed to be locked here,
-                 *       so no need to lock it.
-                 */
-                while (!pred())
-                    wait(lock);
-            }
-
-            template<class Clock, class Duration>
-            cv_status wait_until(unique_lock<mutex>& lock,
-                                 const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                auto ret = aux::threading::condvar::wait_for(
-                    cv_, *lock.mutex()->native_handle(), aux::time_until(abs_time)
-                );
-
-                if (ret == EOK)
-                    return cv_status::no_timeout;
-                else
-                    return cv_status::timeout;
-            }
-
-            template<class Clock, class Duration, class Predicate>
-            bool wait_until(unique_lock<mutex>& lock,
-                            const chrono::time_point<Clock, Duration>& abs_time,
-                            Predicate pred)
-            {
-                while (!pred())
-                {
-                    if (wait_until(lock, abs_time) == cv_status::timeout)
-                        return pred();
-                }
-
-                return true;
-            }
-
-            template<class Rep, class Period>
-            cv_status wait_for(unique_lock<mutex>& lock,
-                               const chrono::duration<Rep, Period>& rel_time)
-            {
-                return wait_until(
-                    lock, chrono::steady_clock::now() + rel_time
-                );
-            }
-
-            template<class Rep, class Period, class Predicate>
-            bool wait_for(unique_lock<mutex>& lock,
-                          const chrono::duration<Rep, Period>& rel_time,
-                          Predicate pred)
-            {
-                return wait_until(
-                    lock, chrono::steady_clock::now() + rel_time,
-                    move(pred)
-                );
-            }
-
-            using native_handle_type = aux::condvar_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::condvar_t cv_;
-    };
-
-    /**
-     * 30.5.2, class condition_variable_any:
-     */
-
-    class condition_variable_any
-    {
-        public:
-            condition_variable_any();
-            ~condition_variable_any();
-
-            condition_variable_any(const condition_variable_any&) = delete;
-            condition_variable_any& operator=(const condition_variable_any&) = delete;
-
-            void notify_one() noexcept;
-            void notify_all() noexcept;
-
-            template<class Lock>
-            void wait(Lock& lock)
-            {
-                aux::threading::condvar::wait(cv_, *lock.native_handle());
-            }
-
-            template<class Lock, class Predicate>
-            void wait(Lock& lock, Predicate pred)
-            {
-                while (!pred())
-                    wait(lock);
-            }
-
-            template<class Lock, class Clock, class Duration>
-            cv_status wait_until(Lock& lock,
-                                 const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                auto ret = aux::threading::condvar::wait_for(
-                    cv_, *lock.mutex()->native_handle(), aux::time_until(abs_time)
-                );
-
-                if (ret == EOK)
-                    return cv_status::no_timeout;
-                else
-                    return cv_status::timeout;
-            }
-
-            template<class Lock, class Clock, class Duration, class Predicate>
-            bool wait_until(Lock& lock,
-                            const chrono::time_point<Clock, Duration>& abs_time,
-                            Predicate pred)
-            {
-                while (!pred())
-                {
-                    if (wait_until(lock, abs_time) == cv_status::timeout)
-                        return pred();
-                }
-
-                return true;
-            }
-
-            template<class Lock, class Rep, class Period>
-            cv_status wait_for(Lock& lock,
-                               const chrono::duration<Rep, Period>& rel_time)
-            {
-                return wait_until(
-                    lock, chrono::steady_clock::now() + rel_time
-                );
-            }
-
-            template<class Lock, class Rep, class Period, class Predicate>
-            bool wait_for(Lock& lock,
-                          const chrono::duration<Rep, Period>& rel_time,
-                          Predicate pred)
-            {
-                return wait_until(
-                    lock, chrono::steady_clock::now() + rel_time,
-                    move(pred)
-                );
-            }
-
-            using native_handle_type = aux::condvar_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::condvar_t cv_;
-    };
-
-    void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>&);
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/future.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/future.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_FUTURE
-#define LIBCPP_BITS_THREAD_FUTURE
-
-#include <__bits/thread/future_common.hpp>
-#include <__bits/thread/shared_state.hpp>
-#include <__bits/utility/forward_move.hpp>
-#include <cassert>
-
-namespace std
-{
-    /**
-     * 30.6.6, class template future:
-     */
-
-    namespace aux
-    {
-        /**
-         * Note: Because of shared_future, this base class
-         *       does implement copy constructor and copy
-         *       assignment operator. This means that the
-         *       children (std::future) need to delete this
-         *       constructor and operator themselves.
-         */
-        template<class R>
-        class future_base
-        {
-            public:
-                future_base() noexcept
-                    : state_{nullptr}
-                { /* DUMMY BODY */ }
-
-                future_base(const future_base& rhs)
-                    : state_{rhs.state_}
-                {
-                    state_->increment();
-                }
-
-                future_base(future_base&& rhs) noexcept
-                    : state_{move(rhs.state_)}
-                {
-                    rhs.state_ = nullptr;
-                }
-
-                future_base(aux::shared_state<R>* state)
-                    : state_{state}
-                {
-                    /**
-                     * Note: This is a custom non-standard constructor that allows
-                     *       us to create a future directly from a shared state. This
-                     *       should never be a problem as aux::shared_state is a private
-                     *       type and future has no constructor templates.
-                     */
-                }
-
-                virtual ~future_base()
-                {
-                    release_state_();
-                }
-
-                future_base& operator=(const future_base& rhs)
-                {
-                    release_state_();
-                    state_ = rhs.state_;
-
-                    state_->increment();
-
-                    return *this;
-                }
-
-                future_base& operator=(future_base&& rhs) noexcept
-                {
-                    release_state_();
-                    state_ = move(rhs.state_);
-                    rhs.state_ = nullptr;
-
-                    return *this;
-                }
-
-                bool valid() const noexcept
-                {
-                    return state_ != nullptr;
-                }
-
-                void wait() const noexcept
-                {
-                    assert(state_);
-
-                    state_->wait();
-                }
-
-                template<class Rep, class Period>
-                future_status
-                wait_for(const chrono::duration<Rep, Period>& rel_time) const
-                {
-                    assert(state_);
-
-                    return state_->wait_for(rel_time);
-                }
-
-                template<class Clock, class Duration>
-                future_status
-                wait_until(
-                    const chrono::time_point<Clock, Duration>& abs_time
-                ) const
-                {
-                    assert(state_);
-
-                    return state_->wait_until(abs_time);
-                }
-
-            protected:
-                void release_state_()
-                {
-                    if (!state_)
-                        return;
-
-                    /**
-                     * Note: This is the 'release' move described in
-                     *       30.6.4 (5).
-                     * Last reference to state -> destroy state.
-                     * Decrement refcount of state otherwise.
-                     * Will not block, unless all following hold:
-                     *  1) State was created by call to std::async.
-                     *  2) State is not yet ready.
-                     *  3) This was the last reference to the shared state.
-                     */
-                    if (state_->decrement())
-                    {
-                        /**
-                         * The destroy call handles the special case
-                         * when 1) - 3) hold.
-                         */
-                        state_->destroy();
-                        delete state_;
-                        state_ = nullptr;
-                    }
-                }
-
-                aux::shared_state<R>* state_;
-        };
-    }
-
-    template<class R>
-    class shared_future;
-
-    template<class R>
-    class future: public aux::future_base<aux::future_inner_t<R>>
-    {
-        friend class shared_future<R>;
-
-        public:
-            future() noexcept
-                : aux::future_base<aux::future_inner_t<R>>{}
-            { /* DUMMY BODY */ }
-
-            future(const future&) = delete;
-
-            future(future&& rhs) noexcept
-                : aux::future_base<aux::future_inner_t<R>>{move(rhs)}
-            { /* DUMMY BODY */ }
-
-            future(aux::shared_state<aux::future_inner_t<R>>* state)
-                : aux::future_base<aux::future_inner_t<R>>{state}
-            { /* DUMMY BODY */ }
-
-            future& operator=(const future&) = delete;
-
-            future& operator=(future&& rhs) noexcept = default;
-
-            shared_future<R> share()
-            {
-                return shared_future<R>{move(*this)};
-            }
-
-            R get()
-            {
-                assert(this->state_);
-
-                this->wait();
-
-                if (this->state_->has_exception())
-                    this->state_->throw_stored_exception();
-
-                if constexpr (!is_same_v<R, void>)
-                {
-                    if constexpr (is_reference_v<R>)
-                    {
-                        assert(this->state_->get());
-
-                        return *this->state_->get();
-                    }
-                    else
-                        return this->state_->get();
-                }
-            }
-
-            /**
-             * Useful for testing as we can check some information
-             * otherwise unavailable to us without waiting, e.g.
-             * to check whether the state is ready, its reference
-             * count etc.
-             */
-            aux::shared_state<aux::future_inner_t<R>>* __state() noexcept
-            {
-                return this->state_;
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/future_common.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/future_common.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_FUTURE_COMMON
-#define LIBCPP_BITS_THREAD_FUTURE_COMMON
-
-#include <__bits/aux.hpp>
-#include <system_error>
-#include <stdexcept>
-
-namespace std
-{
-    /**
-     * 30.6, futures:
-     */
-
-    enum class future_errc
-    { // The 5001 start is to not collide with system_error's codes.
-        broken_promise = 5001,
-        future_already_retrieved,
-        promise_already_satisfied,
-        no_state
-    };
-
-    enum class future_status
-    {
-        ready,
-        timeout,
-        deferred
-    };
-
-    /**
-     * 30.6.2, error handling:
-     */
-
-    template<>
-    struct is_error_code_enum<future_errc>: true_type
-    { /* DUMMY BODY */ };
-
-    error_code make_error_code(future_errc) noexcept;
-    error_condition make_error_condition(future_errc) noexcept;
-
-    const error_category& future_category() noexcept;
-
-    /**
-     * 30.6.3, class future_error:
-     */
-
-    class future_error: public logic_error
-    {
-        public:
-            future_error(error_code ec);
-
-            const error_code& code() const noexcept;
-            const char* what() const noexcept;
-
-        private:
-            error_code code_;
-    };
-
-    namespace aux
-    {
-        /**
-         * Auxilliary metafunctions that let us avoid
-         * specializations in some cases. They represent
-         * the inner stored type and the return type of
-         * the get() member function, respectively.
-         */
-
-        template<class T>
-        struct future_inner: aux::type_is<T>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct future_inner<T&>: aux::type_is<T*>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        using future_inner_t = typename future_inner<T>::type;
-
-        template<class T>
-        struct future_return_shared: aux::type_is<const T&>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct future_return_shared<T&>: aux::type_is<T&>
-        { /* DUMMY BODY */ };
-
-        template<>
-        struct future_return_shared<void>: aux::type_is<void>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        using future_return_shared_t = typename future_return_shared<T>::type;
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/mutex.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/mutex.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,541 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_MUTEX
-#define LIBCPP_BITS_THREAD_MUTEX
-
-#include <__bits/thread/threading.hpp>
-#include <functional>
-#include <thread>
-
-namespace std
-{
-    /**
-     * 20.4.1.2.1, class mutex:
-     */
-
-    class mutex
-    {
-        public:
-            constexpr mutex() noexcept
-                : mtx_{}
-            {
-                aux::threading::mutex::init(mtx_);
-            }
-
-            ~mutex() = default;
-
-            mutex(const mutex&) = delete;
-            mutex& operator=(const mutex&) = delete;
-
-            void lock();
-            bool try_lock();
-            void unlock();
-
-            using native_handle_type = aux::mutex_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::mutex_t mtx_;
-    };
-
-    /**
-     * 30.4.1.2.2, class recursive_mutex:
-     */
-
-    class recursive_mutex
-    {
-        public:
-            constexpr recursive_mutex() noexcept
-                : mtx_{}, lock_level_{}, owner_{}
-            {
-                aux::threading::mutex::init(mtx_);
-            }
-
-            ~recursive_mutex();
-
-            recursive_mutex(const recursive_mutex&) = delete;
-            recursive_mutex& operator=(const recursive_mutex&) = delete;
-
-            void lock();
-            bool try_lock() noexcept;
-            void unlock();
-
-            using native_handle_type = aux::mutex_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::mutex_t mtx_;
-            size_t lock_level_;
-            thread::id owner_;
-    };
-
-    /**
-     * 30.4.1.3.1, class timed_mutex:
-     */
-
-    class timed_mutex
-    {
-        public:
-            timed_mutex() noexcept;
-            ~timed_mutex();
-
-            timed_mutex(const timed_mutex&) = delete;
-            timed_mutex& operator=(const timed_mutex&) = delete;
-
-            void lock();
-            bool try_lock();
-            void unlock();
-
-            template<class Rep, class Period>
-            bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                auto time = aux::threading::time::convert(rel_time);
-
-                return aux::threading::mutex::try_lock_for(time);
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                auto dur = (abs_time - Clock::now());
-                auto time = aux::threading::time::convert(dur);
-
-                return aux::threading::mutex::try_lock_for(time);
-            }
-
-            using native_handle_type = aux::mutex_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::mutex_t mtx_;
-    };
-
-    /**
-     * 30.4.1.3.2, class recursive_timed_mutex:
-     */
-
-    class recursive_timed_mutex
-    {
-        public:
-            recursive_timed_mutex() noexcept
-                : mtx_{}, lock_level_{}, owner_{}
-            {
-                aux::threading::mutex::init(mtx_);
-            }
-
-            ~recursive_timed_mutex();
-
-            recursive_timed_mutex(const recursive_timed_mutex&) = delete;
-            recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
-
-            void lock();
-            bool try_lock() noexcept;
-            void unlock();
-
-            template<class Rep, class Period>
-            bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                if (owner_ == this_thread::get_id())
-                    return true;
-
-                auto time = aux::threading::time::convert(rel_time);
-                auto ret = aux::threading::mutex::try_lock_for(time);
-
-                if (ret)
-                    ++lock_level_;
-                return ret;
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                if (owner_ == this_thread::get_id())
-                    return true;
-
-                auto dur = (abs_time - Clock::now());
-                auto time = aux::threading::time::convert(dur);
-                auto ret = aux::threading::mutex::try_lock_for(time);
-
-                if (ret)
-                    ++lock_level_;
-                return ret;
-            }
-
-            using native_handle_type = aux::mutex_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::mutex_t mtx_;
-            size_t lock_level_;
-            thread::id owner_;
-    };
-
-    struct defer_lock_t
-    { /* DUMMY BODY */ };
-
-    struct try_to_lock_t
-    { /* DUMMY BODY */ };
-
-    struct adopt_lock_t
-    { /* DUMMY BODY */ };
-
-    constexpr defer_lock_t defer_lock
-    { /* DUMMY BODY */ };
-
-    constexpr try_to_lock_t try_to_lock
-    { /* DUMMY BODY */ };
-
-    constexpr adopt_lock_t adopt_lock
-    { /* DUMMY BODY */ };
-
-    /**
-     * 30.4.2.1, class template lock_guard:
-     */
-
-    template<class Mutex>
-    class lock_guard
-    {
-        public:
-            using mutex_type = Mutex;
-
-            explicit lock_guard(mutex_type& mtx)
-                : mtx_{mtx}
-            {
-                mtx.lock();
-            }
-
-            lock_guard(mutex_type& mtx, adopt_lock_t)
-                : mtx_{mtx}
-            { /* DUMMY BODY */ }
-
-            ~lock_guard()
-            {
-                mtx_.unlock();
-            }
-
-            lock_guard(const lock_guard&) = delete;
-            lock_guard& operator=(const lock_guard&) = delete;
-
-        private:
-            mutex_type& mtx_;
-    };
-
-    template<class Mutex>
-    class unique_lock
-    {
-        public:
-            using mutex_type = Mutex;
-
-            /**
-             * 30.4.2.2.1, construction/copy/destroy:
-             */
-
-            unique_lock() noexcept
-                : mtx_{nullptr}, owns_{false}
-            { /* DUMMY BODY */ }
-
-            explicit unique_lock(mutex_type& mtx)
-                : mtx_{&mtx}, owns_{true}
-            {
-                mtx_->lock();
-            }
-
-            unique_lock(mutex_type& mtx, defer_lock_t) noexcept
-                : mtx_{&mtx}, owns_{false}
-            { /* DUMMY BODY */ }
-
-            unique_lock(mutex_type& mtx, try_to_lock_t)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock();
-            }
-
-            unique_lock(mutex_type& mtx, adopt_lock_t)
-                : mtx_{&mtx}, owns_{true}
-            { /* DUMMY BODY */ }
-
-            template<class Clock, class Duration>
-            unique_lock(mutex_type& mtx, const chrono::time_point<Clock, Duration>& abs_time)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock_until(abs_time);
-            }
-
-            template<class Rep, class Period>
-            unique_lock(mutex_type& mtx, const chrono::duration<Rep, Period>& rel_time)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock_for(rel_time);
-            }
-
-            ~unique_lock()
-            {
-                if (owns_)
-                    mtx_->unlock();
-            }
-
-            unique_lock(const unique_lock&) = delete;
-            unique_lock& operator=(const unique_lock&) = delete;
-
-            unique_lock(unique_lock&& other) noexcept
-                : mtx_{move(other.mtx_)}, owns_{move(other.owns_)}
-            {
-                other.mtx_ = nullptr;
-                other.owns_ = false;
-            }
-
-            unique_lock& operator=(unique_lock&& other)
-            {
-                if (owns_)
-                    mtx_->unlock();
-
-                mtx_ = move(other.mtx_);
-                owns_ = move(other.owns_);
-
-                other.mtx_ = nullptr;
-                other.owns_ = false;
-            }
-
-            /**
-             * 30.4.2.2.2, locking:
-             */
-
-            void lock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                mtx_->lock();
-                owns_ = true;
-            }
-
-            bool try_lock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock();
-
-                return owns_;
-            }
-
-            template<class Rep, class Period>
-            bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock_for(rel_time);
-
-                return owns_;
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock_until(abs_time);
-
-                return owns_;
-            }
-
-            void unlock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if owns_ == false
-                 */
-
-                mtx_->unlock();
-            }
-
-            /**
-             * 30.4.2.2.3, modifiers:
-             */
-
-            void swap(unique_lock& other) noexcept
-            {
-                std::swap(mtx_, other.mtx_);
-                std::swap(owns_, other.owns_);
-            }
-
-            mutex_type* release() noexcept
-            {
-                auto ret = mtx_;
-                mtx_ = nullptr;
-                owns_ = false;
-
-                return ret;
-            }
-
-            /**
-             * 30.4.2.2.4, observers:
-             */
-
-            bool owns_lock() const noexcept
-            {
-                return owns_;
-            }
-
-            explicit operator bool() const noexcept
-            {
-                return owns_;
-            }
-
-            mutex_type* mutex() const noexcept
-            {
-                return mtx_;
-            }
-
-        private:
-            mutex_type* mtx_;
-            bool owns_;
-    };
-
-    template<class Mutex>
-    void swap(unique_lock<Mutex>& lhs, unique_lock<Mutex>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-
-    namespace aux
-    {
-        template<class L>
-        int try_lock_tail(int idx, L& l)
-        {
-            if (!l.try_lock())
-                return idx;
-            else
-                return -1;
-        }
-
-        template<class L1, class... L2>
-        int try_lock_tail(int idx, L1& l1, L2&... ls)
-        {
-            if (!l1.try_lock())
-                return idx;
-
-            auto ret = try_lock_tail(idx + 1, ls...);
-            if (ret != -1)
-                l1.unlock();
-
-            return ret;
-        }
-    }
-
-    template<class L1, class L2, class... L3>
-    int try_lock(L1& l1, L2& l2, L3&... ls)
-    {
-        return aux::try_lock_tail(0, l1, l2, ls...);
-    }
-
-    namespace aux
-    {
-        template<class L>
-        bool lock_tail(L& l)
-        {
-            return l.try_lock();
-        }
-
-        template<class L1, class... L2>
-        bool lock_tail(L1& l1, L2&... ls)
-        {
-            if (l1.try_lock())
-            {
-                auto ret = lock_tail(ls...);
-                if (ret)
-                    return true;
-
-                l1.unlock();
-            }
-
-            return false;
-        }
-    }
-
-    template<class L1, class L2, class... L3>
-    void lock(L1& l1, L2& l2, L3&... ls)
-    {
-        do
-        {
-            l1.lock();
-
-            if (aux::lock_tail(l2, ls...))
-                return;
-            l1.unlock();
-        } while (true);
-    }
-
-    struct once_flag
-    {
-        constexpr once_flag() noexcept
-            : called_{false}, mtx_{}
-        { /* DUMMY BODY */ }
-
-        once_flag(const once_flag&) = delete;
-        once_flag& operator=(const once_flag&) = delete;
-
-        private:
-            bool called_;
-            mutex mtx_;
-
-            template<class Callable, class... Args>
-            friend void call_once(once_flag&, Callable&&, Args&&...);
-    };
-
-    template<class Callable, class... Args>
-    void call_once(once_flag& flag, Callable&& func, Args&&... args)
-    {
-        flag.mtx_.lock();
-        if (!flag.called_)
-        {
-            // TODO: exception handling
-
-            aux::INVOKE(forward<Callable>(func), forward<Args>(args)...);
-            flag.called_ = true;
-        }
-        flag.mtx_.unlock();
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/packaged_task.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/packaged_task.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,235 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_PACKAGED_TASK
-#define LIBCPP_BITS_THREAD_PACKAGED_TASK
-
-#include <__bits/exception.hpp>
-#include <__bits/functional/function.hpp>
-#include <__bits/memory/allocator_traits.hpp>
-#include <__bits/thread/future.hpp>
-#include <__bits/thread/future_common.hpp>
-#include <__bits/thread/shared_state.hpp>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 30.6.9, class template packaged_task:
-     */
-
-    /**
-     * Note: The base template is not defined because
-     *       we require the template parameter to be
-     *       a callable object (e.g. a function). This
-     *       is achieved by the R(Args...) specialization
-     *       below.
-     */
-    template<class>
-    class packaged_task;
-
-    template<class R, class... Args>
-    class packaged_task<R(Args...)>
-    {
-        public:
-            packaged_task() noexcept
-                : func_{}, state_{}
-            { /* DUMMY BODY */ }
-
-            template<
-                class F, enable_if_t<
-                    !is_same_v<
-                        decay_t<F>, packaged_task<R(Args...)>
-                    >, int
-                > = 0
-            >
-            explicit packaged_task(F&& f)
-                : func_{forward<F>(f)}, state_{new aux::shared_state<R>{}}
-            { /* DUMMY BODY */ }
-
-            template<
-                class F, class Allocator, enable_if_t<
-                    is_same_v<
-                        decay_t<F>, packaged_task<R(Args...)>
-                    >, int
-                > = 0
-            >
-            explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f)
-                : func_{forward<F>(f)}, state_{}
-            {
-                typename allocator_traits<
-                    Allocator
-                >::template rebind_alloc<aux::shared_state<R>> rebound{a};
-
-                state_ = rebound.allocate(1);
-                rebound.construct(state_);
-            }
-
-            ~packaged_task()
-            {
-                if (state_)
-                {
-                    if (!state_->is_set())
-                    {
-                        state_->set_exception(make_exception_ptr(
-                            future_error{make_error_code(future_errc::broken_promise)}
-                        ));
-                        state_->mark_set(true);
-                    }
-
-                    if (state_->decrement())
-                    {
-                        state_->destroy();
-                        delete state_;
-                        state_ = nullptr;
-                    }
-                }
-            }
-
-            packaged_task(const packaged_task&) = delete;
-            packaged_task& operator=(const packaged_task&) = delete;
-
-            packaged_task(packaged_task&& rhs)
-                : func_{move(rhs.func_)}, state_{move(rhs.state_)}
-            { /* DUMMY BODY */ }
-
-            packaged_task& operator=(packaged_task&& rhs)
-            {
-                if (state_)
-                {
-                    if (state_->decrement())
-                    {
-                        state_->destroy();
-                        delete state_;
-                        state_ = nullptr;
-                    }
-                }
-
-                func_ = move(rhs.func_);
-                state_ = move(rhs.state_);
-                rhs.state_ = nullptr;
-
-                return *this;
-            }
-
-            void swap(packaged_task& other) noexcept
-            {
-                std::swap(func_, other.func_);
-                std::swap(state_, other.state_);
-            }
-
-            bool valid() const noexcept
-            {
-                return state_ != nullptr;
-            }
-
-            future<R> get_future()
-            {
-                if (!state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-
-                state_->increment();
-
-                return future<R>{state_};
-            }
-
-            /**
-             * Note: This is how the signature is in the standard,
-             *       should be investigated and verified.
-             */
-            void operator()(Args... args)
-            {
-                if (!state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                try
-                {
-                    state_->set_value(invoke(func_, args...));
-                }
-                catch(const exception& __exception)
-                {
-                    state_->set_exception(make_exception_ptr(__exception));
-                }
-            }
-
-            void make_ready_at_thread_exit(Args... args)
-            {
-                if (!state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                try
-                {
-                    state_->set_value(invoke(func_, args...), false);
-                    aux::set_state_value_at_thread_exit(this->state_);
-                }
-                catch(const exception& __exception)
-                {
-                    state_->set_exception(make_exception_ptr(__exception), false);
-                    aux::set_state_exception_at_thread_exit(this->state_);
-                }
-            }
-
-            void reset()
-            {
-                if (!state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-
-                *this = packaged_task{move(func_)};
-            }
-
-        private:
-            function<R(Args...)> func_;
-
-            aux::shared_state<R>* state_;
-    };
-
-    template<class R, class... Args>
-    void swap(packaged_task<R(Args...)>& lhs, packaged_task<R(Args...)>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    };
-
-    template<class R, class Alloc>
-    struct uses_allocator<packaged_task<R>, Alloc>: true_type
-    { /* DUMMY BODY */ };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/promise.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/promise.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,420 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_PROMISE
-#define LIBCPP_BITS_THREAD_PROMISE
-
-#include <__bits/exception.hpp>
-#include <__bits/memory/allocator_traits.hpp>
-#include <__bits/thread/future.hpp>
-#include <__bits/thread/shared_state.hpp>
-#include <__bits/aux.hpp>
-#include <utility>
-
-namespace std
-{
-    /**
-     * 30.6.5, class template promise:
-     */
-
-    namespace aux
-    {
-        template<class R>
-        class promise_base
-        {
-            public:
-                promise_base()
-                    : state_{new aux::shared_state<R>{}}
-                { /* DUMMY BODY */ }
-
-                template<class Allocator>
-                promise_base(allocator_arg_t, const Allocator& a)
-                    : state_{}
-                {
-                    typename allocator_traits<
-                        Allocator
-                    >::template rebind_alloc<aux::shared_state<R>> rebound{a};
-
-                    state_ = rebound.allocate(1);
-                    rebound.construct(state_);
-                }
-
-                promise_base(promise_base&& rhs) noexcept
-                    : state_{}
-                {
-                    state_ = rhs.state_;
-                    rhs.state_ = nullptr;
-                }
-
-                promise_base(const promise_base&) = delete;
-
-                virtual ~promise_base()
-                {
-                    this->abandon_state_();
-                }
-
-                promise_base& operator=(promise_base&& rhs) noexcept
-                {
-                    abandon_state_();
-                    promise_base{move(rhs)}.swap(*this);
-
-                    return *this;
-                }
-
-                promise_base& operator=(const promise_base&) = delete;
-
-                void swap(promise_base& other) noexcept
-                {
-                    std::swap(state_, other.state_);
-                }
-
-                void set_exception(exception_ptr ptr)
-                {
-                    assert(state_);
-
-                    state_->set_exception(ptr);
-                }
-
-                void set_exception_at_thread_exit(exception_ptr ptr)
-                {
-                    assert(state_);
-
-                    state_->set_exception_ptr(ptr, false);
-                    aux::set_state_exception_at_thread_exit(state_);
-                }
-
-                /**
-                 * Useful for testing as we can check some information
-                 * otherwise unavailable to us without waiting, e.g.
-                 * to check whether the state is ready, its reference
-                 * count etc.
-                 */
-                aux::shared_state<R>* __state()
-                {
-                    return state_;
-                }
-
-            protected:
-                void abandon_state_()
-                {
-                    if (!state_)
-                        return;
-
-                    /**
-                     * Note: This is the 'abandon' move described in
-                     *       30.6.4 (7).
-                     * 1) If state is not ready:
-                     *   a) Store exception of type future_error with
-                     *      error condition broken_promise.
-                     *   b) Mark state as ready.
-                     * 2) Release the state.
-                     */
-
-                    if (!state_->is_set())
-                    {
-                        state_->set_exception(make_exception_ptr(
-                            future_error{make_error_code(future_errc::broken_promise)}
-                        ));
-                        state_->mark_set(true);
-                    }
-
-                    if (state_->decrement())
-                    {
-                        state_->destroy();
-                        delete state_;
-                        state_ = nullptr;
-                    }
-                }
-
-                aux::shared_state<R>* state_;
-        };
-    }
-
-    template<class R>
-    class promise: public aux::promise_base<R>
-    {
-        public:
-            promise()
-                : aux::promise_base<R>{}
-            { /* DUMMY BODY */ }
-
-            template<class Allocator>
-            promise(allocator_arg_t tag, const Allocator& a)
-                : aux::promise_base<R>{tag, a}
-            { /* DUMMY BODY */ }
-
-            promise(promise&& rhs) noexcept
-                : aux::promise_base<R>{move(rhs)}
-            { /* DUMMY BODY */ }
-
-            promise(const promise&) = delete;
-
-            ~promise() override = default;
-
-            promise& operator=(promise&& rhs) noexcept = default;
-
-            promise& operator=(const promise&) = delete;
-
-            future<R> get_future()
-            {
-                assert(this->state_);
-
-                /**
-                 * Note: Future constructor that takes a shared
-                 *       state as its argument does not call increment
-                 *       because a future can be created as the only
-                 *       owner of that state (e.g. when created by
-                 *       std::async), so we have to do it here.
-                 */
-                this->state_->increment();
-
-                return future<R>{this->state_};
-            }
-
-            void set_value(const R& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                this->state_->set_value(val, true);
-            }
-
-            void set_value(R&& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                this->state_->set_value(forward<R>(val), true);
-            }
-
-            void set_value_at_thread_exit(const R& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                try
-                {
-                    this->state_->set_value(val, false);
-                    aux::set_state_value_at_thread_exit(this->state_);
-                }
-                catch(const exception& __exception)
-                {
-                    this->state_->set_exception(make_exception_ptr(__exception), false);
-                    aux::set_state_exception_at_thread_exit(this->state_);
-                }
-            }
-
-            void set_value_at_thread_exit(R&& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                try
-                {
-                    this->state_->set_value(forward<R>(val), false);
-                    aux::set_state_value_at_thread_exit(this->state_);
-                }
-                catch(const exception& __exception)
-                {
-                    this->state_->set_exception(make_exception_ptr(__exception), false);
-                    aux::set_state_exception_at_thread_exit(this->state_);
-                }
-            }
-    };
-
-    template<class R>
-    class promise<R&>: public aux::promise_base<R*>
-    {
-        public:
-            promise()
-                : aux::promise_base<R*>{}
-            { /* DUMMY BODY */ }
-
-            template<class Allocator>
-            promise(allocator_arg_t tag, const Allocator& a)
-                : aux::promise_base<R*>{tag, a}
-            { /* DUMMY BODY */ }
-
-            promise(promise&& rhs) noexcept
-                : aux::promise_base<R*>{move(rhs)}
-            { /* DUMMY BODY */ }
-
-            promise(const promise&) = delete;
-
-            ~promise() override = default;
-
-            promise& operator=(promise&& rhs) noexcept = default;
-
-            promise& operator=(const promise&) = delete;
-
-            future<R&> get_future()
-            {
-                assert(this->state_);
-
-                /**
-                 * Note: Future constructor that takes a shared
-                 *       state as its argument does not call increment
-                 *       because a future can be created as the only
-                 *       owner of that state (e.g. when created by
-                 *       std::async), so we have to do it here.
-                 */
-                this->state_->increment();
-
-                return future<R&>{this->state_};
-            }
-
-            void set_value(R& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                this->state_->set_value(&val, true);
-            }
-
-            void set_value_at_thread_exit(R& val)
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                try
-                {
-                    this->state_->set_value(&val, false);
-                    aux::set_state_value_at_thread_exit(this->state_);
-                }
-                catch(const exception& __exception)
-                {
-                    this->state_->set_exception(make_exception_ptr(__exception), false);
-                    aux::set_state_exception_at_thread_exit(this->state_);
-                }
-            }
-    };
-
-    template<>
-    class promise<void>: public aux::promise_base<void>
-    {
-        public:
-            promise()
-                : aux::promise_base<void>{}
-            { /* DUMMY BODY */ }
-
-            template<class Allocator>
-            promise(allocator_arg_t tag, const Allocator& a)
-                : aux::promise_base<void>{tag, a}
-            { /* DUMMY BODY */ }
-
-            promise(promise&& rhs) noexcept
-                : aux::promise_base<void>{move(rhs)}
-            { /* DUMMY BODY */ }
-
-            promise(const promise&) = delete;
-
-            ~promise() override = default;
-
-            promise& operator=(promise&& rhs) noexcept = default;
-
-            promise& operator=(const promise&) = delete;
-
-            future<void> get_future()
-            {
-                assert(this->state_);
-
-                /**
-                 * Note: Future constructor that takes a shared
-                 *       state as its argument does not call increment
-                 *       because a future can be created as the only
-                 *       owner of that state (e.g. when created by
-                 *       std::async), so we have to do it here.
-                 */
-                this->state_->increment();
-
-                return future<void>{this->state_};
-            }
-
-            void set_value()
-            {
-                if (!this->state_)
-                    throw future_error{make_error_code(future_errc::no_state)};
-                if (this->state_->is_set())
-                {
-                    throw future_error{
-                        make_error_code(future_errc::promise_already_satisfied)
-                    };
-                }
-
-                this->state_->set_value();
-            }
-    };
-
-    template<class R>
-    void swap(promise<R>& lhs, promise<R>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class R, class Alloc>
-    struct uses_allocator<promise<R>, Alloc>: true_type
-    { /* DUMMY BODY */ };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/shared_future.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/shared_future.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_SHARED_FUTURE
-#define LIBCPP_BITS_THREAD_SHARED_FUTURE
-
-#include <__bits/thread/future.hpp>
-#include <__bits/thread/future_common.hpp>
-#include <type_traits>
-
-/**
- * Note: We do synchronization directly on the shared
- *       state, this means that with the exception of
- *       some member functions (which are only defined
- *       for specializations anyway) our future and
- *       shared_future are basically identical. Because
- *       of that, we can use aux::future_base for
- *       shared_future as well.
- */
-
-namespace std
-{
-    /**
-     * 30.6.7, class template shared_future:
-     */
-
-    template<class R>
-    class shared_future: public aux::future_base<aux::future_inner_t<R>>
-    {
-        public:
-            shared_future() noexcept = default;
-
-            shared_future(const shared_future&) = default;
-
-            shared_future(shared_future&&) noexcept = default;
-
-            shared_future(future<R>&& rhs)
-                : aux::future_base<aux::future_inner_t<R>>{move(rhs.state_)}
-            {
-                rhs.state_ = nullptr;
-            }
-
-            shared_future& operator=(const shared_future&) = default;
-
-            shared_future& operator=(shared_future&&) noexcept = default;
-
-            aux::future_return_shared_t<R> get() const
-            {
-                assert(this->state_);
-
-                this->wait();
-
-                if (this->state_->has_exception())
-                    this->state_->throw_stored_exception();
-
-                /**
-                 * Using constexpr if and the future_inner and future_result
-                 * metafunctions we can actually avoid having to create specializations
-                 * for R& and void in this case.
-                 */
-                if constexpr (!is_same_v<R, void>)
-                {
-                    if constexpr (is_reference_v<R>)
-                    {
-                        assert(this->state_->get());
-
-                        return *this->state_->get();
-                    }
-                    else
-                        return this->state_->get();
-                }
-            }
-
-            /**
-             * Useful for testing as we can check some information
-             * otherwise unavailable to us without waiting, e.g.
-             * to check whether the state is ready, its reference
-             * count etc.
-             */
-            aux::shared_state<aux::future_inner_t<R>>* __state() noexcept
-            {
-                return this->state_;
-            }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/shared_mutex.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/shared_mutex.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,297 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_THREAD_SHARED_MUTEX
-#define LIBCPP_THREAD_SHARED_MUTEX
-
-#include <__bits/thread/threading.hpp>
-#include <chrono>
-#include <mutex>
-
-namespace std
-{
-    /**
-     * 30.4.1.4.1, class shared_timed_mutex:
-     */
-
-    class shared_timed_mutex
-    {
-        public:
-            shared_timed_mutex() noexcept;
-            ~shared_timed_mutex();
-
-            shared_timed_mutex(const shared_timed_mutex&) = delete;
-            shared_timed_mutex& operator=(const shared_timed_mutex&) = delete;
-
-            void lock();
-            bool try_lock();
-            void unlock();
-
-            template<class Rep, class Period>
-            bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                auto time = aux::threading::time::convert(rel_time);
-
-                return aux::threading::shared_mutex::try_lock_for(time);
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                auto dur = (abs_time - Clock::now());
-                auto time = aux::threading::time::convert(dur);
-
-                return aux::threading::shared_mutex::try_lock_for(time);
-            }
-
-            void lock_shared();
-            bool try_lock_shared();
-            void unlock_shared();
-
-            template<class Rep, class Period>
-            bool try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                auto time = aux::threading::time::convert(rel_time);
-
-                return aux::threading::shared_mutex::try_lock_shared_for(time);
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                auto dur = (abs_time - Clock::now());
-                auto time = aux::threading::time::convert(dur);
-
-                return aux::threading::shared_mutex::try_lock_shared_for(time);
-            }
-
-            using native_handle_type = aux::shared_mutex_t*;
-            native_handle_type native_handle();
-
-        private:
-            aux::shared_mutex_t mtx_;
-    };
-
-    /**
-     * 30.4.2.3, class template shared_lock:
-     */
-
-    template<class Mutex>
-    class shared_lock
-    {
-        public:
-            using mutex_type = Mutex;
-
-            /**
-             * 30.4.2.2.1, construction/copy/destroy:
-             */
-
-            shared_lock() noexcept
-                : mtx_{nullptr}, owns_{false}
-            { /* DUMMY BODY */ }
-
-            explicit shared_lock(mutex_type& mtx)
-                : mtx_{&mtx}, owns_{true}
-            {
-                mtx_->lock_shared();
-            }
-
-            shared_lock(mutex_type& mtx, defer_lock_t) noexcept
-                : mtx_{&mtx}, owns_{false}
-            { /* DUMMY BODY */ }
-
-            shared_lock(mutex_type& mtx, try_to_lock_t)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock_shared();
-            }
-
-            shared_lock(mutex_type& mtx, adopt_lock_t)
-                : mtx_{&mtx}, owns_{true}
-            { /* DUMMY BODY */ }
-
-            template<class Clock, class Duration>
-            shared_lock(mutex_type& mtx, const chrono::time_point<Clock, Duration>& abs_time)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock_shared_until(abs_time);
-            }
-
-            template<class Rep, class Period>
-            shared_lock(mutex_type& mtx, const chrono::duration<Rep, Period>& rel_time)
-                : mtx_{&mtx}, owns_{}
-            {
-                owns_ = mtx_->try_lock_shared_for(rel_time);
-            }
-
-            ~shared_lock()
-            {
-                if (owns_)
-                    mtx_->unlock_shared();
-            }
-
-            shared_lock(const shared_lock&) = delete;
-            shared_lock& operator=(const shared_lock&) = delete;
-
-            shared_lock(shared_lock&& other) noexcept
-                : mtx_{move(other.mtx_)}, owns_{move(other.owns_)}
-            {
-                other.mtx_ = nullptr;
-                other.owns_ = false;
-            }
-
-            shared_lock& operator=(shared_lock&& other)
-            {
-                if (owns_)
-                    mtx_->unlock_shared();
-
-                mtx_ = move(other.mtx_);
-                owns_ = move(other.owns_);
-
-                other.mtx_ = nullptr;
-                other.owns_ = false;
-            }
-
-            /**
-             * 30.4.2.2.2, locking:
-             */
-
-            void lock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                mtx_->lock_shared();
-                owns_ = true;
-            }
-
-            bool try_lock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock_shared();
-
-                return owns_;
-            }
-
-            template<class Rep, class Period>
-            bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock_shared_for(rel_time);
-
-                return owns_;
-            }
-
-            template<class Clock, class Duration>
-            bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if mtx_ == nullptr
-                 * throw system_error resource_deadlock_would_occur if owns_ == true
-                 */
-
-                owns_ = mtx_->try_lock_shared_until(abs_time);
-
-                return owns_;
-            }
-
-            void unlock()
-            {
-                /**
-                 * TODO:
-                 * throw system_error operation_not_permitted if owns_ == false
-                 */
-
-                mtx_->unlock_shared();
-            }
-
-            /**
-             * 30.4.2.2.3, modifiers:
-             */
-
-            void swap(shared_lock& other) noexcept
-            {
-                std::swap(mtx_, other.mtx_);
-                std::swap(owns_, other.owns_);
-            }
-
-            mutex_type* release() noexcept
-            {
-                auto ret = mtx_;
-                mtx_ = nullptr;
-                owns_ = false;
-
-                return ret;
-            }
-
-            /**
-             * 30.4.2.2.4, observers:
-             */
-
-            bool owns_lock() const noexcept
-            {
-                return owns_;
-            }
-
-            explicit operator bool() const noexcept
-            {
-                return owns_;
-            }
-
-            mutex_type* mutex() const noexcept
-            {
-                return mtx_;
-            }
-
-        private:
-            mutex_type* mtx_;
-            bool owns_;
-    };
-
-    template<class Mutex>
-    void swap(shared_lock<Mutex>& lhs, shared_lock<Mutex>& rhs) noexcept
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/shared_state.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/shared_state.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,429 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_SHARED_STATE
-#define LIBCPP_BITS_THREAD_SHARED_STATE
-
-/**
- * 30.6.4, shared state:
- */
-
-#include <__bits/exception.hpp>
-#include <__bits/functional/function.hpp>
-#include <__bits/functional/invoke.hpp>
-#include <__bits/refcount_obj.hpp>
-#include <__bits/thread/future_common.hpp>
-#include <__bits/thread/threading.hpp>
-#include <cerrno>
-#include <thread>
-#include <tuple>
-
-namespace std::aux
-{
-    class shared_state_base: public aux::refcount_obj
-    {
-        public:
-            shared_state_base()
-                : mutex_{}, condvar_{}, value_set_{false},
-                  exception_{}, has_exception_{false}
-            {
-                threading::mutex::init(mutex_);
-                threading::condvar::init(condvar_);
-            }
-
-            void destroy() override
-            {
-                /**
-                 * Note: No need to act in this case, async shared
-                 *       state is the object that needs to sometimes
-                 *       invoke its payload.
-                 */
-            }
-
-            void mark_set(bool set = true) noexcept
-            {
-                value_set_ = set;
-            }
-
-            bool is_set() const noexcept
-            {
-                return value_set_;
-            }
-
-            void set_exception(exception_ptr ptr, bool set = true)
-            {
-                exception_ = ptr;
-                has_exception_ = set;
-            }
-
-            bool has_exception() const noexcept
-            {
-                return has_exception_;
-            }
-
-            void throw_stored_exception() const
-            {
-                if (has_exception_)
-                    rethrow_exception(exception_);
-            }
-
-            virtual void wait() const
-            {
-                aux::threading::mutex::lock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-
-                while (!value_set_)
-                {
-                    aux::threading::condvar::wait(
-                        const_cast<aux::condvar_t&>(condvar_),
-                        const_cast<aux::mutex_t&>(mutex_)
-                    );
-                }
-
-                aux::threading::mutex::unlock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-            }
-
-            template<class Rep, class Period>
-            future_status
-            wait_for(const chrono::duration<Rep, Period>& rel_time) const
-            {
-                if (value_set_)
-                    return future_status::ready;
-
-                aux::threading::mutex::lock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-
-                auto res = timed_wait_(
-                    aux::threading::time::convert(rel_time)
-                );
-
-                aux::threading::mutex::unlock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-
-                return res;
-            }
-
-            template<class Clock, class Duration>
-            future_status
-            wait_until(const chrono::time_point<Clock, Duration>& abs_time)
-            {
-                if (value_set_)
-                    return future_status::ready;
-
-                aux::threading::mutex::lock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-
-                auto res = timed_wait_(
-                    aux::threading::time::convert(abs_time - Clock::now())
-                );
-
-                aux::threading::mutex::unlock(
-                    const_cast<aux::mutex_t&>(mutex_)
-                );
-
-                return res;
-            }
-
-            ~shared_state_base() override = default;
-
-        protected:
-            aux::mutex_t mutex_;
-            aux::condvar_t condvar_;
-
-            bool value_set_;
-
-            exception_ptr exception_;
-            bool has_exception_;
-
-            /**
-             * Note: wait_for and wait_until are templates and as such
-             *       cannot be virtual and overriden by the deferred_ and
-             *       async_ children. However, we are using aux::time_unit_t
-             *       in the end anyway, so we can work around that
-             *       by using the 'template method' design pattern
-             *       (i.e. by providing a virtual function called by these
-             *       templates and then overriding that function in the
-             *       children).
-             */
-            virtual future_status timed_wait_(aux::time_unit_t time) const
-            {
-                auto res = aux::threading::condvar::wait_for(
-                    const_cast<aux::condvar_t&>(condvar_),
-                    const_cast<aux::mutex_t&>(mutex_), time
-                );
-
-                return res == ETIMEOUT ? future_status::timeout
-                                       : future_status::ready;
-            }
-    };
-
-    template<class R>
-    class shared_state: public shared_state_base
-    {
-        public:
-            shared_state()
-                : shared_state_base{}
-            { /* DUMMY BODY */ }
-
-            void set_value(const R& val, bool set)
-            {
-                /**
-                 * Note: This is the 'mark ready' move described
-                 *       in 30.6.4 (6).
-                 */
-
-                aux::threading::mutex::lock(mutex_);
-                value_ = val;
-                value_set_ = set;
-                aux::threading::mutex::unlock(mutex_);
-
-                if (set)
-                    aux::threading::condvar::broadcast(condvar_);
-            }
-
-            void set_value(R&& val, bool set = true)
-            {
-                aux::threading::mutex::lock(mutex_);
-                value_ = std::move(val);
-                value_set_ = set;
-                aux::threading::mutex::unlock(mutex_);
-
-                if (set)
-                    aux::threading::condvar::broadcast(condvar_);
-            }
-
-            R& get()
-            {
-                return value_;
-            }
-
-        protected:
-            R value_;
-    };
-
-    template<>
-    class shared_state<void>: public shared_state_base
-    {
-        public:
-            shared_state()
-                : shared_state_base{}
-            { /* DUMMY BODY */ }
-
-            void set_value()
-            {
-                value_set_ = true;
-                aux::threading::condvar::broadcast(condvar_);
-            }
-
-            void get()
-            { /* DUMMY BODY */ }
-    };
-
-    /**
-     * We could make one state for both async and
-     * deferred policies, but then we would be wasting
-     * memory and the only benefit would be the ability
-     * for additional implementation defined policies done
-     * directly in that state (as opposed to making new
-     * states for them).
-     *
-     * But since we have no plan (nor need) to make those,
-     * this approach seems to be the best one.
-     *
-     * Also note that unlike the parent class shared_state,
-     * we do not need to specialize these for void. This is because
-     * the difference in class contents are handled by the parent
-     * specialization and setting the value can be handled easily
-     * by if constexpr and checking for the equivalence of the
-     * R template parameter and void.
-     */
-
-    template<class R, class F, class... Args>
-    class async_shared_state: public shared_state<R>
-    {
-        public:
-            async_shared_state(F&& f, Args&&... args)
-                : shared_state<R>{}, thread_{}
-            {
-                thread_ = thread{
-                    [=](){
-                        try
-                        {
-                            if constexpr (!is_same_v<R, void>)
-                                this->set_value(invoke(f, args...));
-                            else
-                            {
-                                invoke(f, args...);
-                                this->mark_set(true);
-                            }
-                        }
-                        catch(const exception& __exception)
-                        {
-                            this->set_exception(make_exception_ptr(__exception));
-                        }
-                    }
-                };
-            }
-
-            void destroy() override
-            {
-                if (!this->is_set())
-                    thread_.join();
-            }
-
-            void wait() const override
-            {
-                if (!this->is_set())
-                    const_cast<thread&>(thread_).join();
-            }
-
-            ~async_shared_state() override
-            {
-                destroy();
-            }
-
-        protected:
-            future_status timed_wait_(aux::time_unit_t time) const override
-            {
-                /**
-                 * Note: Currently we have no timed join, but this
-                 *       behaviour should be compliant.
-                 */
-                aux::threading::time::sleep(time);
-                if (this->value_set_)
-                    return future_status::ready;
-                else
-                    return future_status::timeout;
-            }
-
-        private:
-            thread thread_;
-    };
-
-    template<class R, class F, class... Args>
-    class deferred_shared_state: public shared_state<R>
-    {
-        public:
-            template<class G>
-            deferred_shared_state(G&& f, Args&&... args)
-                : shared_state<R>{}, func_{forward<F>(f)},
-                  args_{forward<Args>(args)...}
-            { /* DUMMY BODY */ }
-
-            void destroy() override
-            {
-                aux::threading::mutex::lock(this->mutex_);
-                if (!this->is_set())
-                    invoke_(make_index_sequence<sizeof...(Args)>{});
-                aux::threading::mutex::unlock(this->mutex_);
-            }
-
-            void wait() const override
-            {
-                /**
-                 * Note: Synchronization done in invoke_ -> set_value.
-                 */
-                if (!this->is_set())
-                {
-                    const_cast<
-                        deferred_shared_state<R, F, Args...>*
-                    >(this)->invoke_(make_index_sequence<sizeof...(Args)>{});
-                }
-            }
-
-            ~deferred_shared_state() override
-            {
-                destroy();
-            }
-
-        protected:
-            function<R(decay_t<Args>...)> func_;
-            tuple<decay_t<Args>...> args_;
-
-            template<size_t... Is>
-            void invoke_(index_sequence<Is...>)
-            {
-                try
-                {
-                    if constexpr (!is_same_v<R, void>)
-                        this->set_value(invoke(move(func_), get<Is>(move(args_))...));
-                    else
-                    {
-                        invoke(move(func_), get<Is>(move(args_))...);
-                        this->mark_set(true);
-                    }
-                }
-                catch(const exception& __exception)
-                {
-                    this->set_exception(make_exception_ptr(__exception));
-                }
-            }
-
-            future_status timed_wait_(aux::time_unit_t) const override
-            {
-                /**
-                 * Note: Neither of the wait_ functions has any effect
-                 *       for deferred functions spawned by async (which
-                 *       are the only users of this state type).
-                 */
-                return future_status::deferred;
-            }
-    };
-
-    /**
-     * Note: The following two functions should:
-     *   1) Increment refcount.
-     *   2) Store ptr to a vector of shared_state_base ptrs
-     *      (as those have ::mark_set member functions).
-     *   3) If not done already, register a function
-     *      executing all these in the thread_atexit function
-     *      once that is implemented.
-     */
-
-    template<class R>
-    void set_state_value_at_thread_exit(shared_state<R>* state)
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    template<class R>
-    void set_state_exception_at_thread_exit(shared_state<R>* state)
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/thread.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/thread.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,293 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD
-#define LIBCPP_BITS_THREAD
-
-#include <__bits/thread/threading.hpp>
-#include <chrono>
-#include <ostream>
-
-namespace std
-{
-    namespace aux
-    {
-        template<class Callable>
-        int thread_main(void*);
-
-        /**
-         * Fibrils in HelenOS are not joinable. They were
-         * in the past, but that functionality was removed from them
-         * so we created a workaround using a conditional variable that
-         * comprises the following two wrapper classes.
-         */
-        class joinable_wrapper
-        {
-            public:
-                joinable_wrapper()
-                    : join_mtx_{}, join_cv_{},
-                      finished_{false}, detached_{false}
-                {
-                    aux::threading::mutex::init(join_mtx_);
-                    aux::threading::condvar::init(join_cv_);
-                }
-
-                void join()
-                {
-                    aux::threading::mutex::lock(join_mtx_);
-                    while (!finished_)
-                        aux::threading::condvar::wait(join_cv_, join_mtx_);
-                    aux::threading::mutex::unlock(join_mtx_);
-                }
-
-                bool finished() const
-                {
-                    return finished_;
-                }
-
-                void detach()
-                {
-                    detached_ = true;
-                }
-
-                bool detached() const
-                {
-                    return detached_;
-                }
-
-            protected:
-                aux::mutex_t join_mtx_;
-                aux::condvar_t join_cv_;
-                bool finished_;
-                bool detached_;
-        };
-
-        template<class Callable>
-        class callable_wrapper: public joinable_wrapper
-        {
-            public:
-                callable_wrapper(Callable&& clbl)
-                    : joinable_wrapper{}, callable_{forward<Callable>(clbl)}
-                { /* DUMMY BODY */ }
-
-                void operator()()
-                {
-                    callable_();
-
-                    aux::threading::mutex::lock(join_mtx_);
-                    finished_ = true;
-                    aux::threading::mutex::unlock(join_mtx_);
-
-                    aux::threading::condvar::broadcast(join_cv_);
-                }
-
-            private:
-                Callable callable_;
-        };
-    }
-
-    /**
-     * 30.3.1, class thread:
-     */
-
-    class thread
-    {
-        public:
-            class id;
-
-            using native_handle_type = aux::thread_t*;
-
-            /**
-             * 30.3.1.2, thread constructors:
-             * 30.3.1.3, thread destructor:
-             * 30.3.1.4, thread assignment:
-             */
-
-            thread() noexcept;
-
-            ~thread();
-
-            // TODO: check the remark in the standard
-            template<class F, class... Args>
-            explicit thread(F&& f, Args&&... args)
-                : id_{}
-            {
-                auto callable = [=](){
-                    return f(forward<Args>(args)...);
-                };
-
-                auto callable_wrapper = new aux::callable_wrapper<decltype(callable)>{move(callable)};
-                joinable_wrapper_ = static_cast<aux::joinable_wrapper*>(callable_wrapper);
-
-                id_ = aux::threading::thread::create(
-                    aux::thread_main<decltype(callable_wrapper)>,
-                    *callable_wrapper
-                );
-
-                aux::threading::thread::start(id_);
-                // TODO: fibrils are weird here, 2 returns with same thread ids
-            }
-
-            thread(const thread&) = delete;
-            thread& operator=(const thread&) = delete;
-
-            thread(thread&& other) noexcept;
-            thread& operator=(thread&& other) noexcept;
-
-            /**
-             * 30.3.1.5, thread members:
-             */
-
-            void swap(thread& other) noexcept;
-
-            bool joinable() const noexcept;
-
-            void join();
-
-            void detach();
-
-            id get_id() const noexcept;
-
-            native_handle_type native_handle();
-
-            static unsigned hardware_concurrency() noexcept;
-
-        private:
-            aux::thread_t id_;
-            aux::joinable_wrapper* joinable_wrapper_{nullptr};
-
-            template<class Callable>
-            friend int aux::thread_main(void*);
-    };
-
-    namespace aux
-    {
-        template<class CallablePtr>
-        int thread_main(void* clbl)
-        {
-            if (!clbl)
-                return 1;
-
-            auto callable = static_cast<CallablePtr>(clbl);
-            (*callable)();
-
-            if (callable->detached())
-                delete callable;
-
-            return 0;
-        }
-    }
-
-    void swap(thread& x, thread& y) noexcept;
-
-    /**
-     * 30.3.2, namespace this_thread:
-     */
-
-    namespace this_thread
-    {
-        thread::id get_id() noexcept;
-
-        void yield() noexcept;
-
-        template<class Clock, class Duration>
-        void sleep_until(const chrono::time_point<Clock, Duration>& abs_time)
-        {
-            auto now = Clock::now();
-
-            auto time = aux::threading::time::convert(abs_time - now);
-            aux::threading::time::sleep(time);
-        }
-
-        template<class Rep, class Period>
-        void sleep_for(const chrono::duration<Rep, Period>& rel_time)
-        {
-            if (rel_time <= chrono::duration<Rep, Period>::zero())
-                return;
-
-            // TODO: timeouts?
-            auto time = aux::threading::time::convert(rel_time);
-            aux::threading::time::sleep(time);
-        }
-    }
-
-    template<class T>
-    struct hash;
-
-    class thread::id
-    {
-        public:
-            constexpr id() noexcept
-                : id_{}
-            { /* DUMMY BODY */ }
-
-        private:
-            aux::thread_t id_;
-
-            id(aux::thread_t id)
-                : id_{id}
-            { /* DUMMY BODY */ }
-
-            friend class thread;
-
-            friend bool operator==(thread::id, thread::id) noexcept;
-            friend bool operator!=(thread::id, thread::id) noexcept;
-            friend bool operator<(thread::id, thread::id) noexcept;
-            friend bool operator<=(thread::id, thread::id) noexcept;
-            friend bool operator>(thread::id, thread::id) noexcept;
-            friend bool operator>=(thread::id, thread::id) noexcept;
-
-            template<class Char, class Traits>
-            friend basic_ostream<Char, Traits>& operator<<(
-                basic_ostream<Char, Traits>&, thread::id);
-
-            friend struct hash<id>;
-
-            friend id this_thread::get_id() noexcept;
-    };
-
-    bool operator==(thread::id lhs, thread::id rhs) noexcept;
-    bool operator!=(thread::id lhs, thread::id rhs) noexcept;
-    bool operator<(thread::id lhs, thread::id rhs) noexcept;
-    bool operator<=(thread::id lhs, thread::id rhs) noexcept;
-    bool operator>(thread::id lhs, thread::id rhs) noexcept;
-    bool operator>=(thread::id lhs, thread::id rhs) noexcept;
-
-    template<class Char, class Traits>
-    basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& out, thread::id id)
-    {
-        out << id.id_;
-
-        return out;
-    }
-
-    template<> // TODO: implement
-    struct hash<thread::id>;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/thread/threading.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/thread/threading.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,228 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_THREAD_THREADING
-#define LIBCPP_BITS_THREAD_THREADING
-
-#include <chrono>
-
-#include <fibril.h>
-#include <fibril_synch.h>
-
-namespace std::aux
-{
-    struct fibril_tag
-    { /* DUMMY BODY */ };
-
-    struct thread_tag
-    { /* DUMMY BODY */ };
-
-    template<class>
-    struct threading_policy;
-
-    template<>
-    struct threading_policy<fibril_tag>
-    {
-        using mutex_type        = ::helenos::fibril_mutex_t;
-        using thread_type       = ::helenos::fid_t;
-        using condvar_type      = ::helenos::fibril_condvar_t;
-        using time_unit         = ::helenos::usec_t;
-        using shared_mutex_type = ::helenos::fibril_rwlock_t;
-
-        struct thread
-        {
-            template<class Callable, class Payload>
-            static thread_type create(Callable clbl, Payload& pld)
-            {
-                return ::helenos::fibril_create(clbl, (void*)&pld);
-            }
-
-            static void start(thread_type thr)
-            {
-                ::helenos::fibril_add_ready(thr);
-            }
-
-            static thread_type this_thread()
-            {
-                return ::helenos::fibril_get_id();
-            }
-
-            static void yield()
-            {
-                ::helenos::fibril_yield();
-            }
-
-            /**
-             * Note: join & detach are performed at the C++
-             *       level at the moment, but eventually should
-             *       be moved here once joinable fibrils are in libc.
-             */
-        };
-
-        struct mutex
-        {
-            static constexpr void init(mutex_type& mtx)
-            {
-                ::helenos::fibril_mutex_initialize(&mtx);
-            }
-
-            static void lock(mutex_type& mtx)
-            {
-                ::helenos::fibril_mutex_lock(&mtx);
-            }
-
-            static void unlock(mutex_type& mtx)
-            {
-                ::helenos::fibril_mutex_unlock(&mtx);
-            }
-
-            static bool try_lock(mutex_type& mtx)
-            {
-                return ::helenos::fibril_mutex_trylock(&mtx);
-            }
-
-            static bool try_lock_for(mutex_type& mtx, time_unit timeout)
-            {
-                // TODO: we need fibril_mutex_trylock_for() :/
-                return try_lock(mtx);
-            }
-        };
-
-        struct condvar
-        {
-            static void init(condvar_type& cv)
-            {
-                ::helenos::fibril_condvar_initialize(&cv);
-            }
-
-            static void wait(condvar_type& cv, mutex_type& mtx)
-            {
-                ::helenos::fibril_condvar_wait(&cv, &mtx);
-            }
-
-            static int wait_for(condvar_type& cv, mutex_type& mtx, time_unit timeout)
-            {
-                return ::helenos::fibril_condvar_wait_timeout(&cv, &mtx, timeout);
-            }
-
-            static void signal(condvar_type& cv)
-            {
-                ::helenos::fibril_condvar_signal(&cv);
-            }
-
-            static void broadcast(condvar_type& cv)
-            {
-                ::helenos::fibril_condvar_broadcast(&cv);
-            }
-        };
-
-        struct time
-        {
-            template<class Rep, class Period>
-            static time_unit convert(const std::chrono::duration<Rep, Period>& dur)
-            {
-                return std::chrono::duration_cast<std::chrono::duration<Rep, micro>>(dur).count();
-            }
-
-            static void sleep(time_unit time)
-            {
-                ::helenos::fibril_usleep(time);
-            }
-        };
-
-        struct shared_mutex
-        {
-            static void init(shared_mutex_type& mtx)
-            {
-                ::helenos::fibril_rwlock_initialize(&mtx);
-            }
-
-            static void lock(shared_mutex_type& mtx)
-            {
-                ::helenos::fibril_rwlock_write_lock(&mtx);
-            }
-
-            static void unlock(shared_mutex_type& mtx)
-            {
-                ::helenos::fibril_rwlock_write_unlock(&mtx);
-            }
-
-            static void lock_shared(shared_mutex_type& mtx)
-            {
-                ::helenos::fibril_rwlock_read_lock(&mtx);
-            }
-
-            static void unlock_shared(shared_mutex_type& mtx)
-            {
-                ::helenos::fibril_rwlock_read_unlock(&mtx);
-            }
-
-            static bool try_lock(shared_mutex_type& mtx)
-            {
-                // TODO: rwlocks don't have try locking capabilities
-                lock(mtx);
-
-                return true;
-            }
-
-            static bool try_lock_shared(shared_mutex_type& mtx)
-            {
-                lock(mtx);
-
-                return true;
-            }
-
-            static bool try_lock_for(shared_mutex_type& mtx, time_unit timeout)
-            {
-                return try_lock(mtx);
-            }
-
-            static bool try_lock_shared_for(shared_mutex_type& mtx, time_unit timeout)
-            {
-                return try_lock(mtx);
-            }
-        };
-    };
-
-    template<>
-    struct threading_policy<thread_tag>
-    {
-        // TODO:
-    };
-
-    using default_tag = fibril_tag;
-    using threading = threading_policy<default_tag>;
-
-    using thread_t       = typename threading::thread_type;
-    using mutex_t        = typename threading::mutex_type;
-    using condvar_t      = typename threading::condvar_type;
-    using time_unit_t    = typename threading::time_unit;
-    using shared_mutex_t = typename threading::shared_mutex_type;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/trycatch.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/trycatch.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TRYCATCH
-#define LIBCPP_BITS_TRYCATCH
-
-// TODO: This header should be included in every libcpp header.
-
-/**
- * For the time that exception support is not present
- * in HelenOS, we use mock macros in place of the keywords
- * try, throw and catch that allow us to atleast partially
- * mimic exception functionality (that is, without propagation
- * and stack unwinding).
- * The value of the macro below determines if the keyword
- * hiding macros get defined.
- */
-#define LIBCPP_EXCEPTIONS_SUPPORTED 0
-
-#if LIBCPP_EXCEPTIONS_SUPPORTED == 0
-
-/**
- * In case the file where our macros get expanded
- * does not include cstdlib.
- */
-extern "C" void abort(void) __attribute__((noreturn));
-extern "C" int printf(const char*, ...);
-
-namespace std
-{
-    namespace aux
-    {
-        /**
-         * Monitors the state of the program with
-         * regards to exceptions.
-         */
-        extern bool exception_thrown;
-
-        inline constexpr bool try_blocks_allowed{true};
-    }
-}
-
-/**
- * The language allows us to odr-use a variable
- * that is not defined. We use this to support
- * macros redefining the catch keyword that are
- * followed by a block that uses that symbol.
- *
- * Normally, that would produce a compiler error
- * as the declaration of that variale would be removed
- * with the catch statement, but if we use the following
- * declaration's name as the name of the caught exception,
- * all will work well because of this extern declaration.
- *
- * Note: We do not follow our usual convention of using
- * the aux:: namespace because that cannot be used in
- * variable declaration.
- */
-extern int __exception;
-
-/**
- * These macros allow us to choose how the program
- * should behave when an exception is thrown
- * (LIBCPP_EXCEPTION_HANDLE_THROW) or caught
- * (LIBCPP_EXCEPTION_HANDLE_CATCH).
- * We also provide three handlers that either
- * hang the program (allowing us to read the
- * message), exit the program (allowing us to
- * redirect the message to some output file and
- * end) or ignore the throw (in which case the
- * state of program will be broken, but since
- * we output messages on both and catch, this option
- * might allow us to see which catch statement
- * catches the "thrown exception" (supposing
- * the program doesn't crash before reaching
- * that statement.
- */
-#define LIBCPP_EXCEPTION_HANG         while (true);
-#define LIBCPP_EXCEPTION_ABORT        ::std::abort();
-#define LIBCPP_EXCEPTION_IGNORE       /* IGNORE */
-#define LIBCPP_EXCEPTION_HANDLE_THROW LIBCPP_EXCEPTION_IGNORE
-#define LIBCPP_EXCEPTION_HANDLE_CATCH LIBCPP_EXCEPTION_ABORT
-
-#define try if constexpr (::std::aux::try_blocks_allowed)
-
-#define throw \
-    do {\
-        ::std::aux::exception_thrown = true; \
-        printf("[EXCEPTION] Thrown at %s:%d\n", __FILE__, __LINE__); \
-        LIBCPP_EXCEPTION_HANDLE_THROW \
-    } while (false);
-
-#define catch(expr) \
-    if (::std::aux::exception_thrown) \
-    { \
-        printf("[EXCEPTION] Caught < "#expr" > at %s:%d\n", __FILE__, __LINE__); \
-        ::std::aux::exception_thrown = false; \
-        LIBCPP_EXCEPTION_HANDLE_CATCH \
-    } \
-    if constexpr (false)
-
-/**
- * This macro can be used for testing the library. If
- * exception handling is not available, it uses the
- * internal bool variable and if it is, it uses a
- * universal catch clause in which it sets the passed
- * checking variable to true.
- */
-#define LIBCPP_EXCEPTION_THROW_CHECK(variable) \
-    variable = ::std::aux::exception_thrown
-
-#else
-#define LIBCPP_EXCEPTION_THROW_CHECK(variable) \
-    catch (...) \
-    { \
-        variable = true; \
-    }
-#endif
-
-#endif
Index: pace/lib/cpp/include/__bits/tuple/tuple.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/tuple/tuple.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,520 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TUPLE
-#define LIBCPP_BITS_TUPLE
-
-#include <__bits/aux.hpp>
-#include <__bits/tuple/tuple_cat.hpp>
-#include <__bits/tuple/tuple_ops.hpp>
-#include <__bits/type_transformation.hpp>
-#include <functional>
-#include <type_traits>
-#include <utility>
-
-namespace std
-{
-    template<class... Ts>
-    class tuple;
-
-    /**
-     * 20.4.2.4, tuple creation functions:
-     */
-
-    namespace aux
-    {
-        struct ignore_t
-        {
-            template<class T>
-            const ignore_t& operator=(const T&) const
-            {
-                return *this;
-            }
-        };
-    }
-
-    inline constexpr aux::ignore_t ignore;
-
-    template<class... Ts> // TODO: test the reference_wrapper version once we got reference_wrapper
-    constexpr auto make_tuple(Ts&&... ts)
-    {
-        return tuple<aux::transform_tuple_types_t<Ts>...>(forward<Ts>(ts)...);
-    }
-
-    template<class... Ts>
-    constexpr tuple<Ts&&...> forward_as_tuple(Ts&&... ts) noexcept
-    {
-        return tuple<Ts&&...>(forward<Ts>(ts)...);
-    }
-
-    template<class... Ts>
-    constexpr tuple<Ts&...> tie(Ts&... ts) noexcept
-    {
-        return tuple<Ts&...>(ts...);
-    }
-
-    template<class... Tuples>
-    constexpr aux::tuple_cat_type_t<Tuples...> tuple_cat(Tuples&&... tpls)
-    { // TODO: currently does not work because of index mismatch
-        return aux::tuple_cat(
-            forward<Tuples>(tpls)...,
-            make_index_sequence<sizeof...(Tuples)>{},
-            aux::generate_indices_t<Tuples...>{}
-        );
-    }
-
-    /**
-     * 20.4.2.5, tuple helper classes:
-     */
-
-    template<class T>
-    class tuple_size; // undefined
-
-    template<class T>
-    class tuple_size<const T>
-        : public integral_constant<size_t, tuple_size<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    class tuple_size<volatile T>
-        : public integral_constant<size_t, tuple_size<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    class tuple_size<const volatile T>
-        : public integral_constant<size_t, tuple_size<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    class tuple_size<tuple<Ts...>>
-        : public integral_constant<size_t, sizeof...(Ts)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr size_t tuple_size_v = tuple_size<T>::value;
-
-    template<size_t I, class T>
-    class tuple_element; // undefined
-
-    template<size_t I, class T>
-    class tuple_element<I, const T>
-    {
-        using type = add_const_t<typename tuple_element<I, T>::type>;
-    };
-
-    template<size_t I, class T>
-    class tuple_element<I, volatile T>
-    {
-        using type = add_volatile_t<typename tuple_element<I, T>::type>;
-    };
-
-    template<size_t I, class T>
-    class tuple_element<I, const volatile T>
-    {
-        using type = add_cv_t<typename tuple_element<I, T>::type>;
-    };
-
-    namespace aux
-    {
-        template<size_t I, class T, class... Ts>
-        struct type_at: type_at<I - 1, Ts...>
-        { /* DUMMY BODY */ };
-
-        template<class T, class... Ts>
-        struct type_at<0, T, Ts...>
-        {
-            using type = T;
-        };
-
-        template<size_t I, class... Ts>
-        using type_at_t = typename type_at<I, Ts...>::type;
-    }
-
-    template<size_t I, class... Ts>
-    class tuple_element<I, tuple<Ts...>>
-    {
-        public:
-            using type = aux::type_at_t<I, Ts...>;
-    };
-
-    template<size_t I, class T>
-    using tuple_element_t = typename tuple_element<I, T>::type;
-
-    namespace aux
-    {
-        template<size_t I, class T>
-        struct tuple_element_wrapper
-        {
-            constexpr tuple_element_wrapper() = default;
-
-            constexpr explicit tuple_element_wrapper(T&& val)
-                : value{forward<T>(val)}
-            { /* DUMMY BODY */ }
-
-            template<
-                class U,
-                class = enable_if_t<
-                    is_convertible_v<U, T> && !is_same_v<U, T>,
-                    void
-                >
-            >
-            constexpr explicit tuple_element_wrapper(U&& val)
-                : value(forward<U>(val))
-            { /* DUMMY BODY */ }
-
-            T value;
-        };
-
-        template<class, class...>
-        class tuple_impl; // undefined
-
-        template<size_t... Is, class... Ts>
-        class tuple_impl<index_sequence<Is...>, Ts...>: public tuple_element_wrapper<Is, Ts>...
-        {
-            public:
-                constexpr tuple_impl()
-                    : tuple_element_wrapper<Is, Ts>{}...
-                { /* DUMMY BODY */ }
-
-                template<class... Us>
-                constexpr explicit tuple_impl(Us&&... us)
-                    : tuple_element_wrapper<Is, Ts>(forward<Us>(us))...
-                { /* DUMMY BODY */ }
-
-                template<class... Us>
-                constexpr tuple_impl(const tuple<Us...>& tpl)
-                    : tuple_impl{tpl, make_index_sequence<sizeof...(Us)>{}}
-                { /* DUMMY BODY */ }
-
-                template<class... Us>
-                constexpr tuple_impl(tuple<Us...>&& tpl)
-                    : tuple_impl{move<tuple<Us...>>(tpl), make_index_sequence<sizeof...(Us)>{}}
-                { /* DUMMY BODY */ }
-
-                template<class... Us, size_t... Iss>
-                constexpr tuple_impl(const tuple<Us...>& tpl, index_sequence<Iss...>)
-                    : tuple_impl{get<Iss>(tpl)...}
-                { /* DUMMY BODY */ }
-
-                template<class... Us, size_t... Iss>
-                constexpr tuple_impl(tuple<Us...>&& tpl, index_sequence<Iss...>)
-                    : tuple_impl{get<Iss>(move(tpl))...}
-                { /* DUMMY BODY */ }
-        };
-
-        template<class T, class... Ts>
-        struct tuple_noexcept_swap
-        {
-            static constexpr bool value = noexcept(std::swap(declval<T&>(), declval<T&>()))
-                && tuple_noexcept_swap<Ts...>::value;
-        };
-
-        template<class T>
-        struct tuple_noexcept_swap<T>
-        {
-            static constexpr bool value = noexcept(std::swap(declval<T&>(), declval<T&>()));
-        };
-
-        template<class T, class... Ts>
-        struct tuple_noexcept_assignment
-        {
-            static constexpr bool value = is_nothrow_move_assignable<T>::value
-                && tuple_noexcept_assignment<Ts...>::value;
-        };
-
-        template<class T>
-        struct tuple_noexcept_assignment<T>
-        {
-            static constexpr bool value = is_nothrow_move_assignable<T>::value;
-        };
-    }
-
-    /**
-     * 20.4.2.6, element access:
-     */
-
-    template<size_t I, class... Ts>
-    constexpr tuple_element_t<I, tuple<Ts...>>& get(tuple<Ts...>& tpl) noexcept
-    {
-        aux::tuple_element_wrapper<I, tuple_element_t<I, tuple<Ts...>>>& wrapper = tpl;
-
-        return wrapper.value;
-    }
-
-    template<size_t I, class... Ts>
-    constexpr tuple_element_t<I, tuple<Ts...>>&& get(tuple<Ts...>&& tpl) noexcept
-    {
-        return forward<typename tuple_element<I, tuple<Ts...>>::type&&>(get<I>(tpl));
-    }
-
-    template<size_t I, class... Ts>
-    constexpr const tuple_element_t<I, tuple<Ts...>>& get(const tuple<Ts...>& tpl) noexcept
-    {
-        const aux::tuple_element_wrapper<I, tuple_element_t<I, tuple<Ts...>>>& wrapper = tpl;
-
-        return wrapper.value;
-    }
-
-    namespace aux
-    {
-        template<size_t I, class U, class T, class... Ts>
-        struct index_of_type: index_of_type<I + 1, U, Ts...>
-        { /* DUMMY BODY */ };
-
-        template<size_t I, class T, class... Ts>
-        struct index_of_type<I, T, T, Ts...>: std::integral_constant<std::size_t, I>
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T, class... Ts>
-    constexpr T& get(tuple<Ts...>& tpl) noexcept
-    {
-        return get<aux::index_of_type<0, T, Ts...>::value>(tpl);
-    }
-
-    template<class T, class... Ts>
-    constexpr T&& get(tuple<Ts...>&& tpl) noexcept
-    {
-        return get<aux::index_of_type<0, T, Ts...>::value>(forward<tuple<Ts...>>(tpl));
-    }
-
-    template<class T, class... Ts>
-    constexpr const T& get(const tuple<Ts...>& tpl) noexcept
-    {
-        return get<aux::index_of_type<0, T, Ts...>::value>(tpl);
-    }
-
-    /**
-     * 20.4.2, class template tuple:
-     */
-
-    template<class... Ts>
-    class tuple: public aux::tuple_impl<make_index_sequence<sizeof...(Ts)>, Ts...>
-    {
-        using base_t = aux::tuple_impl<make_index_sequence<sizeof...(Ts)>, Ts...>;
-
-        public:
-
-            /**
-             * 20.4.2.1, tuple construction:
-             */
-
-            constexpr tuple()
-                : base_t{}
-            { /* DUMMY BODY */ }
-
-            constexpr explicit tuple(
-                const Ts&... ts, enable_if_t<sizeof...(Ts) != 0>* = nullptr)
-                : base_t(ts...)
-            { /* DUMMY BODY */ }
-
-            template<class... Us> // TODO: is_convertible == true for all Us to all Ts
-            constexpr explicit tuple(Us&&... us, enable_if_t<sizeof...(Us) == sizeof...(Ts)>* = nullptr)
-                : base_t(forward<Us>(us)...)
-            { /* DUMMY BODY */ }
-
-            tuple(const tuple&) = default;
-            tuple(tuple&&) = default;
-
-            template<class... Us>
-            constexpr tuple(const tuple<Us...>& tpl, enable_if_t<sizeof...(Us) == sizeof...(Ts)>* = nullptr)
-                : base_t(tpl)
-            { /* DUMMY BODY */ }
-
-            template<class... Us>
-            constexpr tuple(tuple<Us...>&& tpl, enable_if_t<sizeof...(Us) == sizeof...(Ts)>* = nullptr)
-                : base_t(move(tpl))
-            { /* DUMMY BODY */ }
-
-            // TODO: pair related construction and assignment needs convertibility, not size
-            template<class U1, class U2>
-            constexpr tuple(const pair<U1, U2>& p)
-                : base_t{}
-            {
-                get<0>(*this) = p.first;
-                get<1>(*this) = p.second;
-            }
-
-            template<class U1, class U2>
-            constexpr tuple(pair<U1, U2>&& p)
-                : base_t{}
-            {
-                get<0>(*this) = forward<U1>(p.first);
-                get<1>(*this) = forward<U2>(p.second);
-            }
-
-            // TODO: allocator-extended constructors
-
-            /**
-             * 20.4.2.2, tuple assignment:
-             */
-
-            tuple& operator=(const tuple& other)
-            {
-                aux::tuple_ops<0, sizeof...(Ts) - 1>::assign_copy(*this, other);
-
-                return *this;
-            }
-
-            tuple& operator=(tuple&& other) noexcept(aux::tuple_noexcept_assignment<Ts...>::value)
-            {
-                aux::tuple_ops<0, sizeof...(Ts) - 1>::assign_move(*this, move(other));
-
-                return *this;
-            }
-
-            template<class... Us>
-            tuple& operator=(const tuple<Us...>& other)
-            {
-                aux::tuple_ops<0, sizeof...(Ts) - 1>::assign_copy(*this, other);
-
-                return *this;
-            }
-
-            template<class... Us>
-            tuple& operator=(tuple<Us...>&& other)
-            {
-                aux::tuple_ops<0, sizeof...(Ts) - 1>::assign_move(*this, move(other));
-
-                return *this;
-            }
-
-            template<class U1, class U2>
-            tuple& operator=(const pair<U1, U2>& p)
-            {
-                get<0>(*this) = p.first;
-                get<1>(*this) = p.second;
-
-                return *this;
-            }
-
-            template<class U1, class U2>
-            tuple& operator=(pair<U1, U2>&& p)
-            {
-                get<0>(*this) = forward<U1>(p.first);
-                get<1>(*this) = forward<U2>(p.second);
-
-                return *this;
-            }
-
-            /**
-             * 20.4.2.3, tuple swap:
-             */
-
-            void swap(tuple& other) noexcept(aux::tuple_noexcept_swap<Ts...>::value)
-            {
-                aux::tuple_ops<0, sizeof...(Ts) - 1>::swap(*this, other);
-            }
-    };
-
-    template<>
-    class tuple<>
-    {
-        /**
-         * In some cases, e.g. for async() calls
-         * without argument to the functors, we need
-         * zero length tuples, which are provided by
-         * the following specialization.
-         * (Without it we get a resolution conflict between
-         * the default constructor and the Ts... constructor
-         * in the original tuple.)
-         */
-
-        tuple() = default;
-
-        void swap(tuple&) noexcept
-        { /* DUMMY BODY */ }
-    };
-
-    /**
-     * 20.4.2.7, relational operators:
-     */
-
-    template<class... Ts, class... Us>
-    constexpr bool operator==(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        if constexpr (sizeof...(Ts) == 0)
-            return true;
-        else
-            return aux::tuple_ops<0, sizeof...(Ts) - 1>::eq(lhs, rhs);
-    }
-
-    template<class... Ts, class... Us>
-    constexpr bool operator<(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        if constexpr (sizeof...(Ts) == 0)
-            return false;
-        else
-            return aux::tuple_ops<0, sizeof...(Ts) - 1>::lt(lhs, rhs);
-    }
-
-    template<class... Ts, class... Us>
-    constexpr bool operator!=(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class... Ts, class... Us>
-    constexpr bool operator>(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class... Ts, class... Us>
-    constexpr bool operator<=(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class... Ts, class... Us>
-    constexpr bool operator>=(const tuple<Ts...>& lhs, const tuple<Us...> rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    /**
-     * 20.4.2.8, allocator-related traits:
-     */
-
-    template<class... Ts, class Alloc>
-    struct uses_allocator<tuple<Ts...>, Alloc>: true_type
-    { /* DUMMY BODY */ };
-
-    /**
-     * 20.4.2.9, specialized algorithms:
-     */
-
-    template<class... Ts>
-    void swap(tuple<Ts...>& lhs, tuple<Ts...>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/tuple/tuple_cat.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/tuple/tuple_cat.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TUPLE_TUPLE_CAT
-#define LIBCPP_BITS_TUPLE_TUPLE_CAT
-
-#include <utility>
-
-namespace std
-{ // forward declarations
-    template<class... Ts>
-    struct tuple;
-
-    template<size_t I, class T>
-    struct tuple_element;
-
-    template<size_t I, class... Ts>
-    constexpr typename tuple_element<I, tuple<Ts...>>::type& get(tuple<Ts...>& tpl) noexcept;
-
-    template<class T, T...>
-    struct integer_sequence;
-
-    template<size_t... Is>
-    using index_sequence = integer_sequence<size_t, Is...>;
-}
-
-namespace std::aux
-{
-    template<class...>
-    struct tuple_append;
-
-    template<class... Ts, class... Us, class... Vs>
-    struct tuple_append<tuple<Ts...>, tuple<Us...>, Vs...>
-        : type_is<tuple<Ts..., Us...>>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using tuple_append_t = typename tuple_append<Ts...>::type;
-
-    template<class...>
-    struct remove_first_tuple;
-
-    template<class... Ts, class... Tuples>
-    struct remove_first_tuple<tuple<Ts...>, Tuples...>
-        : type_is<Tuples...>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using remove_first_tuple_t = typename remove_first_tuple<Ts...>::type;
-
-    template<class...>
-    struct get_first_tuple;
-
-    template<class... Ts, class... Tuples>
-    struct get_first_tuple<tuple<Ts...>, Tuples...>
-        : type_is<tuple<Ts...>>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using get_first_tuple_t = typename get_first_tuple<Ts...>::type;
-
-    template<class...>
-    struct tuple_cat_type_impl;
-
-    template<class... Ts, class... Tuples>
-    struct tuple_cat_type_impl<tuple<Ts...>, Tuples...>
-        : type_is<
-        typename tuple_cat_type_impl<
-            tuple_append_t<tuple<Ts...>, get_first_tuple_t<Tuples...>>,
-            remove_first_tuple_t<Tuples...>
-        >::type
-    >
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using tuple_cat_type_impl_t = typename tuple_cat_type_impl<Ts...>::type;
-
-    template<class...>
-    struct tuple_cat_type;
-
-    template<class... Ts, class... Tuples>
-    struct tuple_cat_type<tuple<Ts...>, Tuples...>
-        : type_is<tuple_cat_type_impl_t<tuple<Ts...>, Tuples...>>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using tuple_cat_type_t = typename tuple_cat_type<Ts...>::type;
-
-    template<class...>
-    struct concatenate_sequences;
-
-    template<size_t... Is1, size_t... Is2>
-    struct concatenate_sequences<index_sequence<Is1...>, index_sequence<Is2...>>
-        : type_is<index_sequence<Is1..., Is2...>>
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using concatenate_sequences_t = typename concatenate_sequences<Ts...>::type;
-
-    template<class...>
-    struct append_indices;
-
-    template<size_t... Is, class... Ts, class... Tuples>
-    struct append_indices<index_sequence<Is...>, tuple<Ts...>, Tuples...>
-        : append_indices<
-        concatenate_sequences_t<
-            index_sequence<Is...>, make_index_sequence<sizeof...(Ts)>
-        >,
-        Tuples...
-    >
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using append_indices_t = typename append_indices<Ts...>::types;
-
-    template<class...>
-    struct generate_indices;
-
-    template<class... Ts, class... Tuples>
-    struct generate_indices<tuple<Ts...>, Tuples...>
-        : type_is<
-        append_indices_t<
-            make_index_sequence<sizeof...(Ts)>,
-            Tuples...
-        >
-    >
-    { /* DUMMY BODY */ };
-
-    template<class... Ts>
-    using generate_indices_t = typename generate_indices<Ts...>::type;
-
-    template<class... Tuples, size_t... Is1, size_t... Is2>
-    tuple_cat_type_t<Tuples...> tuple_cat(Tuples&&... tpls,
-                                          index_sequence<Is1...>,
-                                          index_sequence<Is2...>)
-    {
-        return tuple_cat_type_t<Tuples...>{
-            get<Is1...>(
-                get<Is2...>(
-                    forward<Tuples>(tpls)
-                )
-            )...
-        };
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/tuple/tuple_ops.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/tuple/tuple_ops.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TUPLE_TUPLE_OPS
-#define LIBCPP_BITS_TUPLE_TUPLE_OPS
-
-#include <utility>
-
-namespace std
-{ // forward declarations
-    template<class... Ts>
-    struct tuple;
-
-    template<size_t I, class T>
-    struct tuple_element;
-
-    template<size_t I, class... Ts>
-    constexpr typename tuple_element<I, tuple<Ts...>>::type& get(tuple<Ts...>& tpl) noexcept;
-}
-
-namespace std::aux
-{
-    template<size_t I, size_t N>
-    struct tuple_ops
-    {
-        template<class T, class U>
-        static void assign_copy(T& lhs, const U& rhs)
-        {
-            get<I>(lhs) = get<I>(rhs);
-
-            tuple_ops<I + 1, N>::assign_copy(lhs, rhs);
-        }
-
-        template<class T, class U>
-        static void assign_move(T& lhs, U&& rhs)
-        {
-            get<I>(lhs) = move(get<I>(rhs));
-
-            tuple_ops<I + 1, N>::assign_move(lhs, move(rhs));
-        }
-
-        template<class T, class U>
-        static void swap(T& lhs, U& rhs)
-        {
-            std::swap(get<I>(lhs), get<I>(rhs));
-
-            tuple_ops<I + 1, N>::swap(lhs, rhs);
-        }
-
-        template<class T, class U>
-        static bool eq(const T& lhs, const U& rhs)
-        {
-            return (get<I>(lhs) == get<I>(rhs)) && tuple_ops<I + 1, N>::eq(lhs, rhs);
-        }
-
-        template<class T, class U>
-        static bool lt(const T& lhs, const U& rhs)
-        {
-            return (get<I>(lhs) < get<I>(rhs)) ||
-                (!(get<I>(rhs) < get<I>(lhs)) && tuple_ops<I + 1, N>::lt(lhs, rhs));
-        }
-    };
-
-    template<size_t N>
-    struct tuple_ops<N, N>
-    {
-        template<class T, class U>
-        static void assign_copy(T& lhs, const U& rhs)
-        {
-            get<N>(lhs) = get<N>(rhs);
-        }
-
-        template<class T, class U>
-        static void assign_move(T& lhs, U&& rhs)
-        {
-            get<N>(lhs) = move(get<N>(rhs));
-        }
-
-        template<class T, class U>
-        static void swap(T& lhs, U& rhs)
-        {
-            std::swap(get<N>(lhs), get<N>(rhs));
-        }
-
-        template<class T, class U>
-        static bool eq(const T& lhs, const U& rhs)
-        {
-            return get<N>(lhs) == get<N>(rhs);
-        }
-
-        template<class T, class U>
-        static bool lt(const T& lhs, const U& rhs)
-        {
-            return get<N>(lhs) < get<N>(rhs);
-        }
-    };
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/type_traits/references.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/type_traits/references.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_TRAITS_REFERENCES
-#define LIBCPP_BITS_TYPE_TRAITS_REFERENCES
-
-#include <__bits/aux.hpp>
-
-namespace std
-{
-    /**
-     * 20.10.7.2, reference modifications:
-     */
-
-    template<class T>
-    struct remove_reference: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_reference<T&>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_reference<T&&>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    // TODO: is this good?
-    template<class T>
-    struct add_lvalue_reference: aux::type_is<T&>
-    { /* DUMMY BODY */ };
-
-    // TODO: Special case when T is not referencable!
-    template<class T>
-    struct add_rvalue_reference: aux::type_is<T&&>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct add_rvalue_reference<T&>: aux::type_is<T&>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using remove_reference_t = typename remove_reference<T>::type;
-
-    template<class T>
-    using add_lvalue_reference_t = typename add_lvalue_reference<T>::type;
-
-    template<class T>
-    using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/type_traits/result_of.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/type_traits/result_of.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_TRAITS_RESULT_OF
-#define LIBCPP_BITS_TYPE_TRAITS_RESULT_OF
-
-#include <__bits/functional/invoke.hpp>
-
-namespace std
-{
-    template<class>
-    struct is_function;
-
-    template<class>
-    struct is_class;
-
-    template<class>
-    struct is_member_pointer;
-
-    template<bool, class>
-    struct enable_if;
-
-    template<class>
-    struct decay;
-
-    template<class>
-    struct remove_pointer;
-
-    template<class>
-    struct result_of
-    { /* DUMMY BODY */ };
-
-    template<class F, class... ArgTypes>
-    struct result_of<F(ArgTypes...)>: aux::type_is<
-        typename enable_if<
-            is_function<typename decay<typename remove_pointer<F>::type>::type>::value ||
-            is_class<typename decay<F>::type>::value ||
-            is_member_pointer<typename decay<F>::type>::value,
-            decltype(aux::INVOKE(declval<F>(), declval<ArgTypes>()...))
-        >::type
-    >
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using result_of_t = typename result_of<T>::type;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/type_traits/type_traits.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/type_traits/type_traits.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1222 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_TRAITS
-#define LIBCPP_BITS_TYPE_TRAITS
-
-#include <__bits/aux.hpp>
-#include <__bits/type_traits/references.hpp>
-#include <cstdlib>
-#include <cstddef>
-#include <cstdint>
-
-namespace std
-{
-    template<class T>
-    struct add_rvalue_reference;
-
-    template<class T>
-    using add_rvalue_reference_t = typename add_rvalue_reference<T>::type;
-
-    template<class T>
-    add_rvalue_reference_t<T> declval() noexcept;
-
-    template<class...>
-    using void_t = void;
-
-    template<class>
-    struct remove_cv;
-
-    template<class T>
-    using remove_cv_t = typename remove_cv<T>::type;
-
-    namespace aux
-    {
-        template<class T, class U>
-        struct is_same: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_same<T, T>: true_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class... Ts>
-        struct is_one_of;
-
-        template<class T>
-        struct is_one_of<T>: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class... Ts>
-        struct is_one_of<T, T, Ts...>: true_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class U, class... Ts>
-        struct is_one_of<T, U, Ts...>: is_one_of<T, Ts...>
-        { /* DUMMY BODY */ };
-    }
-
-    /**
-     * 20.10.4.1, primary type categories:
-     */
-
-    template<class T>
-    struct is_void: aux::is_same<remove_cv_t<T>, void>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_void_v = is_void<T>::value;
-
-    template<class T>
-    struct is_null_pointer: aux::is_same<remove_cv_t<T>, nullptr_t>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
-
-    template<class T>
-    struct is_integral: aux::is_one_of<remove_cv_t<T>,
-            bool, char, unsigned char, signed char,
-            long, unsigned long, int, unsigned int, short,
-            unsigned short, long long, unsigned long long,
-            char16_t, char32_t, wchar_t>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_floating_point
-        : aux::is_one_of<remove_cv_t<T>, float, double, long double>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
-
-    template<class>
-    struct is_array: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_array<T[]>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_array_v = is_array<T>::value;
-
-    namespace aux
-    {
-        template<class>
-        struct is_pointer: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_pointer<T*>: true_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T>
-    struct is_pointer: aux::is_pointer<remove_cv_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_pointer_v = is_pointer<T>::value;
-
-    template<class T>
-    struct is_lvalue_reference: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_lvalue_reference<T&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value;
-
-    template<class T>
-    struct is_rvalue_reference: false_type
-    { /* DUMMY BODY*/ };
-
-    template<class T>
-    struct is_rvalue_reference<T&&>: true_type
-    { /* DUMMY BODY*/ };
-
-    template<class T>
-    inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<T>::value;
-
-    template<class>
-    struct is_member_pointer;
-
-    template<class>
-    struct is_member_function_pointer;
-
-    template<class T>
-    struct is_member_object_pointer
-        : integral_constant<bool, is_member_pointer<T>::value &&
-                            !is_member_function_pointer<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<T>::value;
-
-    template<class>
-    struct is_function;
-
-    namespace aux
-    {
-        template<class T>
-        struct is_member_function_pointer: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class U>
-        struct is_member_function_pointer<T U::*>: is_function<T>
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T>
-    struct is_member_function_pointer: aux::is_member_function_pointer<remove_cv_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<T>::value;
-
-    template<class T>
-    struct is_enum: aux::value_is<bool, __is_enum(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_enum_v = is_enum<T>::value;
-
-    template<class T>
-    struct is_union: aux::value_is<bool, __is_union(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_union_v = is_union<T>::value;
-
-    template<class T>
-    struct is_class: aux::value_is<bool, __is_class(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_class_v = is_class<T>::value;
-
-    /**
-     * Note: is_function taken from possile implementation on cppreference.com
-     */
-    template<class>
-    struct is_function: false_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...)>: true_type
-    { /* DUMMY BODY */ };
-
-    // Note: That hexadot covers variadic functions like printf.
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......)>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile &>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile &&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile & noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) volatile && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args...) const volatile && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) volatile && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class Ret, class... Args>
-    struct is_function<Ret(Args......) const volatile && noexcept>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_function_v = is_function<T>::value;
-
-    /**
-     * 20.10.4.2, composite type categories:
-     */
-
-    template<class T>
-    struct is_reference: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_reference<T&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_reference<T&&>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_reference_v = is_reference<T>::value;
-
-    template<class T>
-    struct is_arithmetic: aux::value_is<
-        bool,
-        is_integral<T>::value || is_floating_point<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
-
-    template<class T>
-    struct is_fundamental;
-
-    template<class T>
-    struct is_object;
-
-    template<class T>
-    struct is_scalar;
-
-    template<class T>
-    struct is_compound;
-
-    namespace aux
-    {
-        template<class T>
-        struct is_member_pointer: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class U>
-        struct is_member_pointer<T U::*>: true_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T>
-    struct is_member_pointer: aux::is_member_pointer<remove_cv_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_member_pointer_v = is_member_pointer<T>::value;
-
-    /**
-     * 20.10.4.3, type properties:
-     */
-
-    template<class T>
-    struct is_const: false_type
-    { /* DUMMY BODY */};
-
-    template<class T>
-    struct is_const<T const>: true_type
-    { /* DUMMY BODY */};
-
-    template<class T>
-    inline constexpr bool is_const_v = is_const<T>::value;
-
-    template<class T>
-    struct is_volatile: false_type
-    { /* DUMMY BODY */};
-
-    template<class T>
-    struct is_volatile<T volatile>: true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_volatile_v = is_volatile<T>::value;
-
-    /**
-     * 2 forward declarations.
-     */
-
-    template<class T>
-    struct is_trivially_copyable;
-
-    template<class T>
-    struct is_trivially_default_constructible;
-
-    template<class T>
-    struct is_trivial: aux::value_is<
-        bool,
-        is_trivially_copyable<T>::value &&
-        is_trivially_default_constructible<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_trivial_v = is_trivial<T>::value;
-
-    template<class T>
-    struct is_trivially_copyable: aux::value_is<bool, __has_trivial_copy(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<T>::value;
-
-    template<class T>
-    struct is_standard_layout: aux::value_is<bool, __is_standard_layout(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_pod: aux::value_is<bool, __is_pod(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_pod_v = is_pod<T>::value;
-
-    template<class T>
-    struct is_literal_type: aux::value_is<bool, __is_literal_type(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_literal_type_v = is_literal_type<T>::value;
-
-    template<class T>
-    struct is_empty: aux::value_is<bool, __is_empty(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_empty_v = is_empty<T>::value;
-
-    template<class T>
-    struct is_polymorphic: aux::value_is<bool, __is_polymorphic(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_polymorphic_v = is_polymorphic<T>::value;
-
-    template<class T>
-    struct is_abstract: aux::value_is<bool, __is_abstract(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_abstract_v = is_abstract<T>::value;
-
-    template<class T>
-    struct is_final: aux::value_is<bool, __is_final(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_final_v = is_final<T>::value;
-
-    namespace aux
-    {
-        /**
-         * Note: We cannot simply use !is_signed to define
-         *       is_unsigned because non-arithmetic types
-         *       are neither signer nor unsigned.
-         */
-        template<class T, bool = is_arithmetic<T>::value>
-        struct is_signed: value_is<bool, T(-1) < T(0)>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_signed<T, false>: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, bool = is_arithmetic<T>::value>
-        struct is_unsigned: value_is<bool, T(0) < T(-1)>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct is_unsigned<T, false>: false_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T>
-    struct is_signed: aux::is_signed<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_signed_v = is_signed<T>::value;
-
-    template<class T>
-    struct is_unsigned: aux::is_unsigned<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
-
-    namespace aux
-    {
-        template<class, class T, class... Args>
-        struct is_constructible: false_type
-        { /* DUMMY BODY */ };
-
-        template<class T, class... Args>
-        struct is_constructible<
-            void_t<decltype(T(declval<Args>()...))>,
-            T, Args...
-        >
-            : true_type
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T, class... Args>
-    struct is_constructible: aux::is_constructible<void_t<>, T, Args...>
-    { /* DUMMY BODY */ };
-
-    template<class T, class... Args>
-    inline constexpr bool is_constructible_v = is_constructible<T, Args...>::value;
-
-    template<class T>
-    struct is_default_constructible
-        : is_constructible<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_copy_constructible
-        : is_constructible<T, add_lvalue_reference<const T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_move_constructible
-        : is_constructible<T, add_rvalue_reference<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U, class = void>
-    struct is_assignable: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    struct is_assignable<T, U, void_t<decltype(declval<T>() = declval<U>())>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_copy_assignable
-        : is_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_move_assignable
-        : is_assignable<add_lvalue_reference_t<T>, add_rvalue_reference_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class, class = void>
-    struct is_destructible: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_destructible<T, void_t<decltype(declval<T&>().~T())>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class T, class... Args>
-    struct is_trivially_constructible: aux::value_is<bool, __has_trivial_constructor(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<T>::value;
-
-    template<class T>
-    struct is_trivially_default_constructible
-        : is_trivially_constructible<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_trivially_copy_constructible: aux::value_is<bool, __has_trivial_copy(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<T>::value;
-
-    template<class T>
-    struct is_trivially_move_constructible
-        : is_trivially_constructible<T, add_rvalue_reference_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    struct is_trivially_assignable: aux::value_is<bool, __has_trivial_assign(T) && is_assignable<T, U>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<T, U>::value;
-
-    template<class T>
-    struct is_trivially_copy_assignable
-        : is_trivially_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_trivially_move_assignable
-        : is_trivially_assignable<add_lvalue_reference_t<T>, add_rvalue_reference_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_trivially_destructible: aux::value_is<bool, __has_trivial_destructor(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<T>::value;
-
-    template<class T, class... Args>
-    struct is_nothrow_constructible: aux::value_is<bool, __has_nothrow_constructor(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<T>::value;
-
-    template<class T>
-    struct is_nothrow_default_constructible
-        : is_nothrow_constructible<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_nothrow_copy_constructible: aux::value_is<bool, __has_nothrow_copy(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<T>::value;
-
-    template<class T>
-    struct is_nothrow_move_constructible
-        : is_nothrow_constructible<add_lvalue_reference_t<T>, add_rvalue_reference_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    struct is_nothrow_assignable: aux::value_is<bool, __has_nothrow_assign(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<T, U>::value;
-
-    template<class T>
-    struct is_nothrow_copy_assignable
-        : is_nothrow_assignable<add_lvalue_reference_t<T>, add_lvalue_reference_t<const T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_nothrow_move_assignable
-        : is_nothrow_assignable<add_lvalue_reference_t<T>, add_rvalue_reference_t<T>>
-    { /* DUMMY BODY */ };
-
-    template<class, class = void>
-    struct is_nothrow_destructible: false_type
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct is_nothrow_destructible<T, void_t<decltype(declval<T&>().~T())>>
-        : aux::value_is<bool, noexcept(declval<T&>().~T())>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct has_virtual_destructor: aux::value_is<bool, __has_virtual_destructor(T)>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<T>::value;
-
-    /**
-     * 20.10.5, type property queries:
-     */
-
-    template<class T>
-    struct alignment_of: aux::value_is<std::size_t, alignof(T)>
-    { /* DUMMY BODY */ };
-
-    template<class>
-    struct rank : aux::value_is<size_t, 0u>
-    { /* DUMMY BODY */ };
-
-    template<class T, size_t N>
-    struct rank<T[N]>: aux::value_is<size_t, 1u + rank<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct rank<T[]>: aux::value_is<size_t, 1u + rank<T>::value>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    inline constexpr size_t rank_v = rank<T>::value;
-
-    template<class T, unsigned I = 0U>
-    struct extent: aux::value_is<size_t, 0U>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct extent<T[], 0U>: aux::value_is<size_t, 0U>
-    { /* DUMMY BODY */ };
-
-    template<class T, unsigned I>
-    struct extent<T[], I>: extent<T, I - 1>
-    { /* DUMMY BODY */ };
-
-    template<class T, size_t N>
-    struct extent<T[N], 0U>: aux::value_is<size_t, 0U>
-    { /* DUMMY BODY */ };
-
-    template<class T, unsigned I, size_t N>
-    struct extent<T[N], I>: extent<T, I - 1>
-    { /* DUMMY BODY */ };
-
-    /**
-     * 20.10.6, type relations:
-     */
-
-    template<class T, class U>
-    struct is_same: aux::is_same<T, U>
-    { /* DUMMY BODY */ };
-
-    template<class T, class U>
-    inline constexpr bool is_same_v = is_same<T, U>::value;
-
-    template<class Base, class Derived>
-    struct is_base_of: aux::value_is<bool, __is_base_of(Base, Derived)>
-    { /* DUMMY BODY */ };
-
-    template<class Base, class Derived>
-    inline constexpr bool is_base_of_v = is_base_of<Base, Derived>::value;
-
-    template<class From, class To, class = void>
-    struct is_convertible: false_type
-    { /* DUMMY BODY */ };
-
-    template<class From, class To>
-    struct is_convertible<From, To, void_t<decltype((To)declval<From>())>>
-        : true_type
-    { /* DUMMY BODY */ };
-
-    template<class From, class To>
-    inline constexpr bool is_convertible_v = is_convertible<From, To>::value;
-
-    /**
-     * 20.10.7.1, const-volatile modifications:
-     */
-
-    template<class T>
-    struct remove_const: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_const<T const>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_volatile: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_volatile<T volatile>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_cv: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_cv<T const>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_cv<T volatile>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_cv<T const volatile>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct add_const: aux::type_is<T const>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct add_volatile: aux::type_is<T volatile>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct add_cv: aux::type_is<T const volatile>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using remove_const_t = typename remove_const<T>::type;
-
-    template<class T>
-    using remove_volatile_t = typename remove_volatile<T>::type;
-
-    template<class T>
-    using remove_cv_t = typename remove_cv<T>::type;
-
-    template<class T>
-    using add_const_t = typename add_const<T>::type;
-
-    template<class T>
-    using add_volatile_t = typename add_volatile<T>::type;
-
-    template<class T>
-    using add_cv_t = typename add_cv<T>::type;
-
-    /**
-     * 20.10.7.3, sign modifications:
-     * Note: These are fairly naive implementations that
-     *       are meant to keep our code going (i.e. they work
-     *       for the most common types, but I'm not sure
-     *       if there are any intricacies required by
-     *       the standard).
-     */
-
-    template<class T>
-    struct make_signed: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<char>: aux::type_is<signed char>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<unsigned char>: aux::type_is<signed char>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<unsigned short>: aux::type_is<short>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<unsigned int>: aux::type_is<int>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<unsigned long>: aux::type_is<long>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_signed<unsigned long long>: aux::type_is<long long>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct make_unsigned: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<char>: aux::type_is<unsigned char>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<signed char>: aux::type_is<unsigned char>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<short>: aux::type_is<unsigned short>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<int>: aux::type_is<unsigned int>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<long>: aux::type_is<unsigned long>
-    { /* DUMMY BODY */ };
-
-    template<>
-    struct make_unsigned<long long>: aux::type_is<unsigned long long>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using make_signed_t = typename make_signed<T>::type;
-
-    template<class T>
-    using make_unsigned_t = typename make_signed<T>::type;
-
-    /**
-     * 20.10.7.4, array modifications:
-     */
-
-    template<class T>
-    struct remove_extent: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_extent<T[]>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T, size_t N>
-    struct remove_extent<T[N]>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_all_extents: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_all_extents<T[]>: remove_all_extents<T>
-    { /* DUMMY BODY */ };
-
-    template<class T, size_t N>
-    struct remove_all_extents<T[N]>: remove_all_extents<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using remove_extent_t = typename remove_extent<T>::type;
-
-    template<class T>
-    using remove_all_extents_t = typename remove_all_extents<T>::type;
-
-    /**
-     * 20.10.7.5, pointer modifications:
-     */
-
-    template<class T>
-    struct remove_pointer: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_pointer<T*>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_pointer<T* const>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_pointer<T* volatile>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_pointer<T* const volatile>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    namespace aux
-    {
-        template<class T>
-        struct add_pointer_to_function: type_is<T>
-        { /* DUMMY BODY */ };
-
-        template<class T, class... Args>
-        struct add_pointer_to_function<T(Args...)>
-            : type_is<T(*)(Args...)>
-        { /* DUMMY BODY */ };
-
-        template<class T, bool = false>
-        struct add_pointer_cond: aux::type_is<remove_reference_t<T>*>
-        { /* DUMMY BODY */ };
-
-        template<class T>
-        struct add_pointer_cond<T, true>
-            : aux::add_pointer_to_function<T>
-        { /* DUMMY BODY */ };
-    }
-
-    template<class T>
-    struct add_pointer: aux::add_pointer_cond<T, is_function_v<T>>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using remove_pointer_t = typename remove_pointer<T>::type;
-
-    template<class T>
-    using add_pointer_t = typename add_pointer<T>::type;
-
-    /**
-     * 20.10.7.6, other transformations:
-     */
-
-    namespace aux
-    {
-        template<size_t Len, size_t Align>
-        struct aligned_t
-        {
-            alignas(Align) uint8_t storage[Len];
-        };
-
-        template<class T>
-        constexpr T max_of_cont(T cont)
-        {
-            if (cont.size() == 0U)
-                return T{};
-
-            auto it = cont.begin();
-            auto res = *it;
-
-            while (++it != cont.end())
-            {
-                if (*it > res)
-                    res = *it;
-            }
-
-            return res;
-        }
-    }
-
-    // TODO: consult standard on the default value of align
-    template<std::size_t Len, std::size_t Align = 0>
-    struct aligned_storage: aux::type_is<aux::aligned_t<Len, Align>>
-    { /* DUMMY BODY */ };
-
-    template<std::size_t Len, class... Types>
-    struct aligned_union: aux::type_is<
-        aux::aligned_t<
-            aux::max_of_cont({Len, alignof(Types)...}),
-            aux::max_of_cont({alignof(Types)...})
-        >
-    >
-    { /* DUMMY BODY */ };
-
-	// TODO: this is very basic implementation for chrono, fix!
-    /* template<class T> */
-    /* struct decay: aux::type_is<remove_cv_t<remove_reference_t<T>>> */
-	/* { /1* DUMMY BODY *1/ }; */
-
-    template<bool, class, class>
-    struct conditional;
-
-    template<class T>
-    struct decay: aux::type_is<
-        typename conditional<
-            is_array_v<remove_reference_t<T>>,
-            remove_extent_t<remove_reference_t<T>>*,
-            typename conditional<
-                is_function_v<remove_reference_t<T>>,
-                add_pointer_t<remove_reference_t<T>>,
-                remove_cv_t<remove_reference_t<T>>
-            >::type
-        >::type
-    >
-    { /* DUMMY BODY */ };
-
-	template<class T>
-    using decay_t = typename decay<T>::type;
-
-    template<bool, class T = void>
-    struct enable_if
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct enable_if<true, T>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<bool, class T, class F>
-    struct conditional: aux::type_is<F>
-    { /* DUMMY BODY */ };
-
-    template<class T, class F>
-    struct conditional<true, T, F>: aux::type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class... T>
-    struct common_type
-    { /* DUMMY BODY */ };
-
-    template<class... T>
-    using common_type_t = typename common_type<T...>::type;
-
-    template<class T>
-    struct common_type<T>: common_type<T, T>
-    { /* DUMMY BODY */ };
-
-    // To avoid circular dependency with <utility>.
-    template<class T>
-    add_rvalue_reference_t<T> declval() noexcept;
-
-    template<class T1, class T2>
-    struct common_type<T1, T2>: aux::type_is<decay_t<decltype(false ? declval<T1>() : declval<T2>())>>
-    { /* DUMMY BODY */ };
-
-    template<class T1, class T2, class... Ts>
-    struct common_type<T1, T2, Ts...>
-        : aux::type_is<common_type_t<common_type_t<T1, T2>, Ts...>>
-    { /* DUMMY BODY */ };
-
-    template<class... T>
-    struct underlying_type;
-
-    template<std::size_t Len, std::size_t Align = 0>
-    using aligned_storage_t = typename aligned_storage<Len, Align>::type;
-
-    template<std::size_t Len, class... Types>
-    using aligned_union_t = typename aligned_union<Len, Types...>::type;
-
-    template<bool b, class T = void>
-    using enable_if_t = typename enable_if<b, T>::type;
-
-    template<bool b, class T, class F>
-    using conditional_t = typename conditional<b, T, F>::type;
-
-    template<class T>
-    using underlying_type_t = typename underlying_type<T>::type;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/type_transformation.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/type_transformation.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_TRANSFORMATION
-#define LIBCPP_BITS_TYPE_TRANSFORMATION
-
-#include <__bits/aux.hpp>
-#include <type_traits>
-
-namespace std
-{
-    template<class>
-    class reference_wrapper;
-}
-
-namespace std::aux
-{
-    /**
-     * Used by tuple to decay reference wrappers to references
-     * in make_tuple.
-     */
-
-    template<class T>
-    struct remove_reference_wrapper: type_is<T>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    struct remove_reference_wrapper<reference_wrapper<T>>: type_is<T&>
-    { /* DUMMY BODY */ };
-
-    template<class T>
-    using remove_reference_wrapper_t = typename remove_reference_wrapper<T>::type;
-
-    template<class T>
-    using transform_tuple_types_t = remove_reference_wrapper_t<decay_t<T>>;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/typeindex.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/typeindex.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_INDEX
-#define LIBCPP_BITS_TYPE_INDEX
-
-#include <cstdlib>
-#include <typeinfo>
-
-namespace std
-{
-
-    /**
-     * 20.14.2, type_index:
-     */
-
-    class type_index
-    {
-        public:
-            type_index(const type_info& rhs) noexcept;
-
-            bool operator==(const type_index& rhs) const noexcept;
-
-            bool operator!=(const type_index& rhs) const noexcept;
-
-            bool operator<(const type_index& rhs) const noexcept;
-
-            bool operator<=(const type_index& rhs) const noexcept;
-
-            bool operator>(const type_index& rhs) const noexcept;
-
-            bool operator>=(const type_index& rhs) const noexcept;
-
-            size_t hash_code() const noexcept;
-
-            const char* name() const noexcept;
-
-        private:
-            const type_info* target_;
-    };
-
-    template<class T>
-    struct hash;
-
-    // TODO: implement
-    template<>
-    struct hash<type_index>;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/typeinfo.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/typeinfo.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_TYPE_INFO
-#define LIBCPP_BITS_TYPE_INFO
-
-#include <cstdlib>
-
-namespace std
-{
-    class type_info
-    {
-        public:
-            virtual ~type_info();
-
-            bool operator==(const type_info&) const noexcept;
-            bool operator!=(const type_info&) const noexcept;
-
-            bool before(const type_info&) const noexcept;
-
-            size_t hash_code() const noexcept;
-
-            const char* name() const noexcept;
-
-            type_info(const type_info&) = delete;
-            type_info& operator=(const type_info&) = delete;
-
-        private:
-            const char* __name;
-    };
-
-    // TODO: class bad_cast, bad_typeid
-}
-
-#endif
-
Index: pace/lib/cpp/include/__bits/utility/declval.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/utility/declval.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_UTILITY_DECLVAL
-#define LIBCPP_BITS_UTILITY_DECLVAL
-
-#include <__bits/type_traits/references.hpp>
-
-namespace std
-{
-    /**
-     * 20.2.5, function template declval:
-     * Note: This function only needs declaration, not
-     *       implementation.
-     */
-
-    template<class T>
-    add_rvalue_reference_t<T> declval() noexcept;
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/utility/forward_move.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/utility/forward_move.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_UTILITY_FORWARD_MOVE
-#define LIBCPP_BITS_UTILITY_FORWARD_MOVE
-
-#include <__bits/type_traits/references.hpp>
-
-namespace std
-{
-    /**
-     * 20.2.4, forward/move helpers:
-     */
-
-    template<class T>
-    constexpr T&& forward(remove_reference_t<T>& t) noexcept
-    {
-        return static_cast<T&&>(t);
-    }
-
-    template<class T>
-    constexpr T&& forward(remove_reference_t<T>&& t) noexcept
-    {
-        return static_cast<T&&>(t);
-    }
-
-    template<class T>
-    constexpr remove_reference_t<T>&& move(T&& t) noexcept
-    {
-        return static_cast<remove_reference_t<T>&&>(t);
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/__bits/utility/utility.hpp
===================================================================
--- uspace/lib/cpp/include/__bits/utility/utility.hpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,458 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_BITS_UTILITY
-#define LIBCPP_BITS_UTILITY
-
-#include <__bits/type_transformation.hpp>
-#include <__bits/utility/forward_move.hpp>
-#include <cstdint>
-#include <type_traits>
-
-namespace std
-{
-    /**
-     * 20.2.1, operators:
-     */
-
-    namespace rel_ops
-    {
-        template<typename T>
-        bool operator!=(const T& lhs, const T& rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        template<typename T>
-        bool operator>(const T& lhs, const T& rhs)
-        {
-            return (rhs < lhs);
-        }
-
-        template<typename T>
-        bool operator<=(const T& lhs, const T& rhs)
-        {
-            return !(rhs < lhs);
-        }
-
-        template<typename T>
-        bool operator>=(const T& lhs, const T& rhs)
-        {
-            return !(lhs < rhs);
-        }
-    }
-
-    /**
-     * 20.2.2, swap:
-     */
-
-    template<class T>
-    void swap(T& x, T& y)
-        /* noexcept(is_nothrow_move_constructible<T>::value && */
-        /*          is_nothrow_move_assignable<T>::value) */
-    {
-        T tmp{move(x)};
-        x = move(y);
-        y = move(tmp);
-    }
-
-    template<class F1, class F2>
-    F2 swap_ranges(F1, F1, F2);
-
-    template<class T, size_t N>
-    void swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)))
-    {
-        swap_ranges(a, a + N, b);
-    }
-
-    /**
-     * 20.2.3, exchange:
-     */
-
-    template<class T, class U = T>
-    T exchange(T& obj, U&& new_val)
-    {
-        T old_val = move(obj);
-        obj = forward<U>(new_val);
-
-        return old_val;
-    }
-
-    /**
-     * 20.5.2, class template integer_sequence:
-     */
-
-    template<class T, T... Is>
-    struct integer_sequence
-    {
-        using value_type = T;
-
-        static constexpr size_t size() noexcept
-        {
-            return sizeof...(Is);
-        }
-
-        using next = integer_sequence<T, Is..., sizeof...(Is)>;
-    };
-
-    template<std::size_t... Is>
-    using index_sequence = integer_sequence<std::size_t, Is...>;
-
-    /**
-     * 20.5.3, alias template make_integer_sequence:
-     */
-
-    namespace aux
-    {
-        template<class T, uintmax_t N>
-        struct make_integer_sequence
-        {
-            /**
-             * Recursive to the bottom case below, appends sizeof...(Is) in
-             * every next "call", building the sequence.
-             */
-            using type = typename make_integer_sequence<T, N - 1>::type::next;
-        };
-
-        template<class T>
-        struct make_integer_sequence<T, std::uintmax_t(0)>
-        {
-            using type = integer_sequence<T>;
-        };
-    }
-
-
-    /**
-     * Problem: We can't specialize the N parameter because it is a value parameter
-     *          depending on a type parameter.
-     * Solution: According to the standard: if N is negative, the program is ill-formed,
-     *           so we just recast it to uintmax_t :)
-     */
-    template<class T, T N>
-    using make_integer_sequence = typename aux::make_integer_sequence<T, std::uintmax_t(N)>::type;
-
-    template<size_t N>
-    using make_index_sequence = make_integer_sequence<std::size_t, N>;
-
-    /**
-     * 20.3, pairs:
-     */
-
-    template<size_t, class>
-    class tuple_element;
-
-    template<size_t I, class T>
-    using tuple_element_t = typename tuple_element<I, T>::type;
-
-    template<class...>
-    class tuple;
-
-    template<size_t I, class... Ts>
-    constexpr tuple_element_t<I, tuple<Ts...>>&& get(tuple<Ts...>&&) noexcept;
-
-    namespace aux
-    {
-        template<class T, class... Args, size_t... Is>
-        T from_tuple(tuple<Args...>&& tpl, index_sequence<Is...>)
-        {
-            return T{get<Is>(move(tpl))...};
-        }
-
-        template<class T, class... Args>
-        T from_tuple(tuple<Args...>&& tpl)
-        {
-            return from_tuple<T>(move(tpl), make_index_sequence<sizeof...(Args)>{});
-        }
-    }
-
-    struct piecewise_construct_t
-    {
-        explicit piecewise_construct_t() = default;
-    };
-
-    inline constexpr piecewise_construct_t piecewise_construct{};
-
-    template<typename T1, typename T2>
-    struct pair
-    {
-        using first_type  = T1;
-        using second_type = T2;
-
-        T1 first;
-        T2 second;
-
-        pair(const pair&) = default;
-        pair(pair&&) = default;
-
-        constexpr pair()
-            : first{}, second{}
-        { /* DUMMY BODY */ }
-
-        constexpr pair(const T1& x, const T2& y)
-            : first{x}, second{y}
-        { /* DUMMY BODY */ }
-
-        template<typename U, typename V>
-        constexpr pair(U&& x, V&& y)
-            : first(x), second(y)
-        { /* DUMMY BODY */ }
-
-        template<typename U, typename V>
-        constexpr pair(const pair<U, V>& other)
-            : first(other.first), second(other.second)
-        { /* DUMMY BODY */ }
-
-        template<typename U, typename V>
-        constexpr pair(pair<U, V>&& other)
-            : first(forward<first_type>(other.first)),
-              second(forward<second_type>(other.second))
-        { /* DUMMY BODY */ }
-
-        template<class... Args1, class... Args2>
-        pair(piecewise_construct_t, tuple<Args1...> first_args, tuple<Args2...> second_args)
-            : first{aux::from_tuple<first_type>(move(first_args))},
-              second{aux::from_tuple<second_type>(move(second_args))}
-        { /* DUMMY BODY */ }
-
-        pair& operator=(const pair& other)
-        {
-            first = other.first;
-            second = other.second;
-
-            return *this;
-        }
-
-        template<typename U, typename V>
-        pair& operator=(const pair<U, V>& other)
-        {
-            first = other.first;
-            second = other.second;
-
-            return *this;
-        }
-
-        pair& operator=(pair&& other) noexcept
-        {
-            first = forward<first_type>(other.first);
-            second = forward<second_type>(other.second);
-
-            return *this;
-        }
-
-        template<typename U, typename V>
-        pair& operator=(pair<U, V>&& other)
-        {
-            first = forward<first_type>(other.first);
-            second = forward<second_type>(other.second);
-
-            return *this;
-        }
-
-        void swap(pair& other) noexcept(
-            noexcept(std::swap(first, other.first)) &&
-            noexcept(std::swap(second, other.second))
-        )
-        {
-            std::swap(first, other.first);
-            std::swap(second, other.second);
-        }
-    };
-
-    /**
-     * 20.3.3, specialized algorithms:
-     */
-
-    template<class T1, class T2>
-    constexpr bool operator==(const pair<T1, T2>& lhs,
-                              const pair<T1, T2>& rhs)
-    {
-        return lhs.first == rhs.first && lhs.second == rhs.second;
-    }
-
-    template<class T1, class T2>
-    constexpr bool operator<(const pair<T1, T2>& lhs,
-                             const pair<T1, T2>& rhs)
-    {
-        return lhs.first < rhs.first ||
-            (!(rhs.first < lhs.first) && lhs.second < rhs.second);
-    }
-
-    template<class T1, class T2>
-    constexpr bool operator!=(const pair<T1, T2>& lhs,
-                              const pair<T1, T2>& rhs)
-    {
-        return !(lhs == rhs);
-    }
-
-    template<class T1, class T2>
-    constexpr bool operator>(const pair<T1, T2>& lhs,
-                             const pair<T1, T2>& rhs)
-    {
-        return rhs < lhs;
-    }
-
-    template<class T1, class T2>
-    constexpr bool operator>=(const pair<T1, T2>& lhs,
-                              const pair<T1, T2>& rhs)
-    {
-        return !(lhs < rhs);
-    }
-
-    template<class T1, class T2>
-    constexpr bool operator<=(const pair<T1, T2>& lhs,
-                              const pair<T1, T2>& rhs)
-    {
-        return !(rhs < lhs);
-    }
-
-    template<class T1, class T2>
-    constexpr void swap(pair<T1, T2>& lhs, pair<T1, T2>& rhs)
-        noexcept(noexcept(lhs.swap(rhs)))
-    {
-        lhs.swap(rhs);
-    }
-
-    template<class T1, class T2>
-    constexpr auto make_pair(T1&& t1, T2&& t2)
-    {
-        return pair<
-            aux::transform_tuple_types_t<T1>,
-            aux::transform_tuple_types_t<T2>
-        >{
-            forward<T1>(t1), forward<T2>(t2)
-        };
-    }
-
-    /**
-     * 20.3.4, tuple-like access to pair:
-     */
-
-    template<class>
-    struct tuple_size;
-
-    template<class T1, class T2>
-    struct tuple_size<pair<T1, T2>>
-        : integral_constant<size_t, 2>
-    { /* DUMMY BODY */ };
-
-    template<size_t, class>
-    struct tuple_element;
-
-    template<class T1, class T2>
-    struct tuple_element<0, pair<T1, T2>>
-        : aux::type_is<T1>
-    { /* DUMMY BODY */ };
-
-    template<class T1, class T2>
-    struct tuple_element<1, pair<T1, T2>>
-        : aux::type_is<T2>
-    { /* DUMMY BODY */ };
-
-    template<size_t I, class T>
-    using tuple_element_t = typename tuple_element<I, T>::type;
-
-    template<size_t I, class T1, class T2>
-    constexpr tuple_element_t<I, pair<T1, T2>>&
-    get(pair<T1, T2>& p) noexcept
-    {
-        if constexpr (I == 0)
-            return p.first;
-        else
-            return p.second;
-    }
-
-    template<size_t I, class T1, class T2>
-    constexpr const tuple_element_t<I, pair<T1, T2>>&
-    get(const pair<T1, T2>& p) noexcept
-    {
-        if constexpr (I == 0)
-            return p.first;
-        else
-            return p.second;
-    }
-
-    template<size_t I, class T1, class T2>
-    constexpr tuple_element_t<I, pair<T1, T2>>&&
-    get(pair<T1, T2>&& p) noexcept
-    {
-        if constexpr (I == 0)
-            return forward<T1>(p.first);
-        else
-            return forward<T2>(p.second);
-    }
-
-    template<class T, class U>
-    constexpr T& get(pair<T, U>& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<0>(p);
-    }
-
-    template<class T, class U>
-    constexpr const T& get(const pair<T, U>& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<0>(p);
-    }
-
-    template<class T, class U>
-    constexpr T&& get(pair<T, U>&& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<0>(move(p));
-    }
-
-    template<class T, class U>
-    constexpr T& get(pair<U, T>& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<1>(p);
-    }
-
-    template<class T, class U>
-    constexpr const T& get(const pair<U, T>& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<1>(p);
-    }
-
-    template<class T, class U>
-    constexpr T&& get(pair<U, T>&& p) noexcept
-    {
-        static_assert(!is_same_v<T, U>, "get(pair) requires distinct types");
-
-        return get<1>(move(p));
-    }
-}
-
-#endif
Index: pace/lib/cpp/include/algorithm
===================================================================
--- uspace/lib/cpp/include/algorithm	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/algorithm.hpp>
Index: pace/lib/cpp/include/array
===================================================================
--- uspace/lib/cpp/include/array	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/array.hpp>
Index: pace/lib/cpp/include/atomic
===================================================================
--- uspace/lib/cpp/include/atomic	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/atomic.hpp>
Index: pace/lib/cpp/include/bitset
===================================================================
--- uspace/lib/cpp/include/bitset	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/bitset.hpp>
Index: pace/lib/cpp/include/cassert
===================================================================
--- uspace/lib/cpp/include/cassert	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CASSERT
-#define LIBCPP_CASSERT
-
-#include <assert.h>
-
-#define __unimplemented() assert(!"Not implemented!")
-
-#endif
Index: pace/lib/cpp/include/cctype
===================================================================
--- uspace/lib/cpp/include/cctype	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CCTYPE
-#define LIBCPP_CCTYPE
-
-#include <ctype.h>
-
-namespace std
-{
-    using ::isalnum;
-    using ::isalpha;
-    using ::islower;
-    using ::isupper;
-    using ::isdigit;
-    using ::isxdigit;
-    using ::iscntrl;
-    using ::isgraph;
-    using ::isspace;
-    using ::isblank;
-    using ::isprint;
-    using ::ispunct;
-    using ::tolower;
-    using ::toupper;
-}
-
-#endif
Index: pace/lib/cpp/include/cerrno
===================================================================
--- uspace/lib/cpp/include/cerrno	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CERRNO
-#define LIBCPP_CERRNO
-
-#include <errno.h>
-
-#endif
Index: pace/lib/cpp/include/cfenv
===================================================================
--- uspace/lib/cpp/include/cfenv	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<cfenv> is not implemented"
Index: pace/lib/cpp/include/cfloat
===================================================================
--- uspace/lib/cpp/include/cfloat	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<cfloat> is not implemented"
Index: pace/lib/cpp/include/chrono
===================================================================
--- uspace/lib/cpp/include/chrono	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/chrono.hpp>
Index: pace/lib/cpp/include/cinttypes
===================================================================
--- uspace/lib/cpp/include/cinttypes	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CINTTYPES
-#define LIBCPP_CINTTYPES
-
-#include <cstdint>
-#include <inttypes.h>
-
-namespace std
-{
-    using ::imaxdiv_t;
-    using ::imaxabs;
-    using ::imaxdiv;
-    using ::strtoimax;
-    using ::strtoumax;
-    using ::wcstoimax;
-    using ::wcstoumax;
-}
-
-#endif
Index: pace/lib/cpp/include/ciso646
===================================================================
--- uspace/lib/cpp/include/ciso646	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * Note: This header is used in C standard library to add
- *       textual versions of operators (and, not, ...) but
- *       these are part of C++, so nothing has to be done
- *       here.
- */
Index: pace/lib/cpp/include/climits
===================================================================
--- uspace/lib/cpp/include/climits	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CLIMITS
-#define LIBCPP_CLIMITS
-
-#include <limits.h>
-
-#endif
Index: pace/lib/cpp/include/clocale
===================================================================
--- uspace/lib/cpp/include/clocale	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<clocale> is not implemented"
Index: pace/lib/cpp/include/cmath
===================================================================
--- uspace/lib/cpp/include/cmath	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<cmath> is not implemented"
Index: pace/lib/cpp/include/complex
===================================================================
--- uspace/lib/cpp/include/complex	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/complex.hpp>
Index: pace/lib/cpp/include/condition_variable
===================================================================
--- uspace/lib/cpp/include/condition_variable	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/thread/condition_variable.hpp>
Index: pace/lib/cpp/include/csetjmp
===================================================================
--- uspace/lib/cpp/include/csetjmp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSETJMP
-#define LIBCPP_CSETJMP
-
-#include <setjmp.h>
-
-namespace std
-{
-    using ::jmp_buf;
-    using ::longjmp;
-}
-
-#endif
Index: pace/lib/cpp/include/csignal
===================================================================
--- uspace/lib/cpp/include/csignal	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<csignal> is not implemented"
Index: pace/lib/cpp/include/cstdarg
===================================================================
--- uspace/lib/cpp/include/cstdarg	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTDARG
-#define LIBCPP_CSTDARG
-
-#include <stdarg.h>
-
-namespace std
-{
-    using ::va_list;
-}
-
-#endif
Index: pace/lib/cpp/include/cstddef
===================================================================
--- uspace/lib/cpp/include/cstddef	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTDDEF
-#define LIBCPP_CSTDDEF
-
-#include <stddef.h>
-
-namespace std
-{
-    using nullptr_t = decltype(nullptr);
-    using ::size_t;
-    using ::ptrdiff_t;
-    using ::max_align_t;
-}
-
-#endif
Index: pace/lib/cpp/include/cstdint
===================================================================
--- uspace/lib/cpp/include/cstdint	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTDINT
-#define LIBCPP_CSTDINT
-
-#include <stdint.h>
-
-namespace std
-{
-    using ::int8_t;
-    using ::int16_t;
-    using ::int32_t;
-    using ::int64_t;
-
-    using ::intmax_t;
-    using ::intptr_t;
-
-    using ::int_fast8_t;
-    using ::int_fast16_t;
-    using ::int_fast32_t;
-    using ::int_fast64_t;
-
-    using ::int_least8_t;
-    using ::int_least16_t;
-    using ::int_least32_t;
-    using ::int_least64_t;
-
-    using ::uint8_t;
-    using ::uint16_t;
-    using ::uint32_t;
-    using ::uint64_t;
-
-    using ::uintmax_t;
-    using ::uintptr_t;
-
-    using ::uint_fast8_t;
-    using ::uint_fast16_t;
-    using ::uint_fast32_t;
-    using ::uint_fast64_t;
-
-    using ::uint_least8_t;
-    using ::uint_least16_t;
-    using ::uint_least32_t;
-    using ::uint_least64_t;
-}
-
-#endif
Index: pace/lib/cpp/include/cstdio
===================================================================
--- uspace/lib/cpp/include/cstdio	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTDIO
-#define LIBCPP_CSTDIO
-
-#include <stdio.h>
-
-namespace std
-{
-    using ::FILE;
-    using ::stdin;
-    using ::stdout;
-    using ::stderr;
-    using ::fpos_t;
-    using ::size_t;
-
-    using ::clearerr;
-    using ::fclose;
-    using ::feof;
-    using ::ferror;
-    using ::fflush;
-    using ::fgetc;
-    using ::fgetpos;
-    using ::fgets;
-    using ::fopen;
-    using ::fprintf;
-    using ::fputc;
-    using ::fputs;
-    using ::fread;
-    using ::freopen;
-    using ::fscanf;
-    using ::fseek;
-    using ::fsetpos;
-    using ::ftell;
-    using ::fwrite;
-    using ::getc;
-    using ::getchar;
-    using ::perror;
-    using ::printf;
-    using ::putc;
-    using ::putchar;
-    using ::puts;
-    using ::remove;
-    using ::rename;
-    using ::rewind;
-    using ::scanf;
-    using ::setbuf;
-    using ::setvbuf;
-    using ::snprintf;
-    /* using ::sprintf; */
-    /* using ::sscanf; */
-    /* using ::tmpfile; */
-    /* using ::tmpnam; */
-    using ::ungetc;
-    using ::vfprintf;
-    using ::vprintf;
-    /* using ::vscanf; */
-    using ::vsnprintf;
-    /* using ::vsprintf; */
-    /* using ::vsscanf; */
-}
-
-#endif
Index: pace/lib/cpp/include/cstdlib
===================================================================
--- uspace/lib/cpp/include/cstdlib	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTDLIB
-#define LIBCPP_CSTDLIB
-
-#include <stdlib.h>
-#include <_bits/ssize_t.h>
-
-namespace std
-{
-    /* using ::div_t; */
-    /* using ::ldiv_t; */
-    /* using ::lldiv_t; */
-    using ::size_t;
-
-    using ::abort;
-    using ::exit;
-    /* using ::quick_exit; */
-    /* using ::_Exit; */
-    using ::atexit;
-    /* using ::at_quick_exit; */
-    /* using ::system; */
-    /* using ::getenv; */
-
-    using ::malloc;
-    using ::calloc;
-    using ::realloc;
-    using ::free;
-
-    /* using ::atof; */
-    /* using ::atoi; */
-    /* using ::atol; */
-    /* using ::atoll; */
-    /* using ::strtol; */
-    /* using ::strtoll; */
-    /* using ::strtoul; */
-    /* using ::strtoull; */
-    /* using ::strtof; */
-    /* using ::strtod; */
-    /* using ::strtold; */
-
-    /* using ::mblen; */
-    /* using ::mbtowc; */
-    /* using ::wctomb; */
-    /* using ::mbstowcs; */
-    /* using ::wcstombs; */
-
-    using ::rand;
-    using ::srand;
-    using ::qsort;
-    /* using ::bsearch; */
-    /* using ::abs; */
-    /* using ::labs; */
-    /* using ::llabs; */
-    /* using ::div; */
-    /* using ::ldiv; */
-    /* using ::lldiv; */
-}
-
-#endif
Index: pace/lib/cpp/include/cstring
===================================================================
--- uspace/lib/cpp/include/cstring	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CSTRING
-#define LIBCPP_CSTRING
-
-#define _REALLY_WANT_STRING_H
-#include <string.h>
-
-namespace std
-{
-    using ::size_t;
-
-    using ::strcpy;
-    using ::strncpy;
-    using ::strcat;
-    using ::strncat;
-    using ::strxfrm;
-
-    using ::strlen;
-    using ::strcmp;
-    using ::strncmp;
-    using ::strcoll;
-    using ::strchr;
-    using ::strrchr;
-    using ::strspn;
-    using ::strcspn;
-    using ::strpbrk;
-    using ::strstr;
-    using ::strtok;
-
-    using ::memchr;
-    using ::memcmp;
-    using ::memset;
-    using ::memcpy;
-    using ::memmove;
-
-    using ::strerror;
-}
-
-#endif
Index: pace/lib/cpp/include/ctime
===================================================================
--- uspace/lib/cpp/include/ctime	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_CTIME
-#define LIBCPP_CTIME
-
-#include <time.h>
-
-namespace std
-{
-    using ::clock_t;
-    using ::size_t;
-    using ::time_t;
-    using ::tm;
-    using ::timespec;
-
-    using ::clock;
-    using ::time;
-    using ::difftime;
-
-    using ::ctime;
-    using ::asctime;
-    using ::strftime;
-    /* using ::wcsftime; */
-    /* using ::gmtime; */
-    /* using ::localtime; */
-    using ::mktime;
-}
-
-#endif
Index: pace/lib/cpp/include/cuchar
===================================================================
--- uspace/lib/cpp/include/cuchar	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<cuchar> is not implemented"
Index: pace/lib/cpp/include/cwchar
===================================================================
--- uspace/lib/cpp/include/cwchar	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCPP_WCHAR
-#define LIBCPP_WCHAR
-
-#include <wchar.h>
-#include <time.h>
-
-namespace std
-{
-    /* using ::mbstate_t; */
-    using ::size_t;
-    using ::wint_t;
-    using ::tm;
-
-    /* using ::wcscpy; */
-    /* using ::wcsncpy; */
-    /* using ::wcscat; */
-    /* using ::wcsncat; */
-    /* using ::wcsnxfrm; */
-
-    /* using ::wcslen; */
-    /* using ::wcscmp; */
-    /* using ::wcsncmp; */
-    /* using ::wcscoll; */
-    /* using ::wcschr; */
-    /* using ::wcsrchr; */
-    /* using ::wcsspn; */
-    /* using ::wcscspn; */
-    /* using ::wcspbrk; */
-    /* using ::wcsstr; */
-    /* using ::wcstok; */
-
-    /* using ::wmemcpy; */
-    /* using ::wmemmove; */
-    /* using ::wmemcmp; */
-    /* using ::wmemchr; */
-    /* using ::wmemset; */
-
-    /* using ::msbinit; */
-    /* using ::btowc; */
-    /* using ::wctob; */
-    /* using ::mbrlen; */
-    /* using ::mbrtowc; */
-    /* using ::wctomb; */
-    /* using ::mbsrtowcs; */
-    /* using ::wcsrtombs; */
-
-    /* using ::fgetwc; */
-    /* using ::getwc; */
-    /* using ::fgetws; */
-    /* using ::fputwc; */
-    /* using ::putwc; */
-    /* using ::fputws; */
-    /* using ::getwchar; */
-    /* using ::putwchar; */
-    /* using ::ungetwc; */
-    /* using ::fwide; */
-    /* using ::wscanf; */
-    /* using ::fwscanf; */
-    /* using ::swscanf; */
-    /* using ::vwscanf; */
-    /* using ::vfwscanf; */
-    /* using ::vswscanf; */
-    /* using ::wprintf; */
-    /* using ::fwprintf; */
-    /* using ::swprintf; */
-
-    /* using ::wcsftime; */
-    /* using ::wcstol; */
-    /* using ::wcstoll; */
-    /* using ::wcstoul; */
-    /* using ::wcstoull; */
-    /* using ::wcstof; */
-    /* using ::wcstod; */
-    /* using ::wcstold; */
-}
-
-#endif
Index: pace/lib/cpp/include/cwctype
===================================================================
--- uspace/lib/cpp/include/cwctype	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#error "<cwctype> is not implemented"
Index: pace/lib/cpp/include/deque
===================================================================
--- uspace/lib/cpp/include/deque	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/deque.hpp>
Index: pace/lib/cpp/include/exception
===================================================================
--- uspace/lib/cpp/include/exception	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/exception.hpp>
Index: pace/lib/cpp/include/forward_list
===================================================================
--- uspace/lib/cpp/include/forward_list	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/forward_list.hpp>
Index: pace/lib/cpp/include/fstream
===================================================================
--- uspace/lib/cpp/include/fstream	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/fstream.hpp>
Index: pace/lib/cpp/include/functional
===================================================================
--- uspace/lib/cpp/include/functional	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/functional/arithmetic_operations.hpp>
-#include <__bits/functional/bind.hpp>
-#include <__bits/functional/function.hpp>
-#include <__bits/functional/functional.hpp>
-#include <__bits/functional/invoke.hpp>
-#include <__bits/functional/hash.hpp>
-#include <__bits/functional/reference_wrapper.hpp>
Index: pace/lib/cpp/include/future
===================================================================
--- uspace/lib/cpp/include/future	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/thread/async.hpp>
-#include <__bits/thread/future.hpp>
-#include <__bits/thread/future_common.hpp>
-#include <__bits/thread/packaged_task.hpp>
-#include <__bits/thread/promise.hpp>
-#include <__bits/thread/shared_future.hpp>
-#include <__bits/thread/shared_state.hpp>
Index: pace/lib/cpp/include/initializer_list
===================================================================
--- uspace/lib/cpp/include/initializer_list	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/initializer_list.hpp>
Index: pace/lib/cpp/include/iomanip
===================================================================
--- uspace/lib/cpp/include/iomanip	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/iomanip.hpp>
Index: pace/lib/cpp/include/ios
===================================================================
--- uspace/lib/cpp/include/ios	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/ios.hpp>
Index: pace/lib/cpp/include/iosfwd
===================================================================
--- uspace/lib/cpp/include/iosfwd	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/iosfwd.hpp>
Index: pace/lib/cpp/include/iostream
===================================================================
--- uspace/lib/cpp/include/iostream	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/iostream.hpp>
Index: pace/lib/cpp/include/istream
===================================================================
--- uspace/lib/cpp/include/istream	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/istream.hpp>
Index: pace/lib/cpp/include/iterator
===================================================================
--- uspace/lib/cpp/include/iterator	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/iterator.hpp>
Index: pace/lib/cpp/include/limits
===================================================================
--- uspace/lib/cpp/include/limits	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/limits.hpp>
Index: pace/lib/cpp/include/list
===================================================================
--- uspace/lib/cpp/include/list	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/list.hpp>
Index: pace/lib/cpp/include/locale
===================================================================
--- uspace/lib/cpp/include/locale	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/locale/codecvt.hpp>
-#include <__bits/locale/ctype.hpp>
-#include <__bits/locale/locale.hpp>
-#include <__bits/locale/locale_misc.hpp>
-#include <__bits/locale/num_get.hpp>
-#include <__bits/locale/num_put.hpp>
-#include <__bits/locale/numpunct.hpp>
Index: pace/lib/cpp/include/map
===================================================================
--- uspace/lib/cpp/include/map	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/map.hpp>
Index: pace/lib/cpp/include/memory
===================================================================
--- uspace/lib/cpp/include/memory	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/memory/allocator_arg.hpp>
-#include <__bits/memory/allocator_traits.hpp>
-#include <__bits/memory/addressof.hpp>
-#include <__bits/memory/misc.hpp>
-#include <__bits/memory/owner_less.hpp>
-#include <__bits/memory/pointer_traits.hpp>
-#include <__bits/memory/shared_ptr.hpp>
-#include <__bits/memory/unique_ptr.hpp>
-#include <__bits/memory/weak_ptr.hpp>
Index: pace/lib/cpp/include/mutex
===================================================================
--- uspace/lib/cpp/include/mutex	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/thread/mutex.hpp>
Index: pace/lib/cpp/include/new
===================================================================
--- uspace/lib/cpp/include/new	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/new.hpp>
Index: pace/lib/cpp/include/numeric
===================================================================
--- uspace/lib/cpp/include/numeric	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/numeric.hpp>
Index: pace/lib/cpp/include/ostream
===================================================================
--- uspace/lib/cpp/include/ostream	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/ostream.hpp>
Index: pace/lib/cpp/include/queue
===================================================================
--- uspace/lib/cpp/include/queue	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/queue.hpp>
Index: pace/lib/cpp/include/random
===================================================================
--- uspace/lib/cpp/include/random	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/random.hpp>
Index: pace/lib/cpp/include/ratio
===================================================================
--- uspace/lib/cpp/include/ratio	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/ratio.hpp>
Index: pace/lib/cpp/include/regex
===================================================================
--- uspace/lib/cpp/include/regex	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/regex.hpp>
Index: pace/lib/cpp/include/scoped_allocator
===================================================================
--- uspace/lib/cpp/include/scoped_allocator	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/scoped_allocator.hpp>
Index: pace/lib/cpp/include/set
===================================================================
--- uspace/lib/cpp/include/set	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/set.hpp>
Index: pace/lib/cpp/include/shared_mutex
===================================================================
--- uspace/lib/cpp/include/shared_mutex	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/thread/shared_mutex.hpp>
Index: pace/lib/cpp/include/sstream
===================================================================
--- uspace/lib/cpp/include/sstream	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/sstream.hpp>
Index: pace/lib/cpp/include/stack
===================================================================
--- uspace/lib/cpp/include/stack	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/stack.hpp>
Index: pace/lib/cpp/include/stdexcept
===================================================================
--- uspace/lib/cpp/include/stdexcept	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/stdexcept.hpp>
Index: pace/lib/cpp/include/streambuf
===================================================================
--- uspace/lib/cpp/include/streambuf	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/streambuf.hpp>
Index: pace/lib/cpp/include/string
===================================================================
--- uspace/lib/cpp/include/string	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/string/string.hpp>
-#include <__bits/string/string_io.hpp>
Index: pace/lib/cpp/include/system_error
===================================================================
--- uspace/lib/cpp/include/system_error	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/system_error.hpp>
Index: pace/lib/cpp/include/thread
===================================================================
--- uspace/lib/cpp/include/thread	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/thread/thread.hpp>
Index: pace/lib/cpp/include/tuple
===================================================================
--- uspace/lib/cpp/include/tuple	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/tuple/tuple.hpp>
Index: pace/lib/cpp/include/type_traits
===================================================================
--- uspace/lib/cpp/include/type_traits	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/type_traits/references.hpp>
-#include <__bits/type_traits/result_of.hpp>
-#include <__bits/type_traits/type_traits.hpp>
Index: pace/lib/cpp/include/typeindex
===================================================================
--- uspace/lib/cpp/include/typeindex	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/typeindex.hpp>
Index: pace/lib/cpp/include/typeinfo
===================================================================
--- uspace/lib/cpp/include/typeinfo	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/typeinfo.hpp>
Index: pace/lib/cpp/include/unordered_map
===================================================================
--- uspace/lib/cpp/include/unordered_map	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/unordered_map.hpp>
Index: pace/lib/cpp/include/unordered_set
===================================================================
--- uspace/lib/cpp/include/unordered_set	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/unordered_set.hpp>
Index: pace/lib/cpp/include/utility
===================================================================
--- uspace/lib/cpp/include/utility	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/utility/declval.hpp>
-#include <__bits/utility/forward_move.hpp>
-#include <__bits/utility/utility.hpp>
Index: pace/lib/cpp/include/valarray
===================================================================
--- uspace/lib/cpp/include/valarray	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/valarray.hpp>
Index: pace/lib/cpp/include/vector
===================================================================
--- uspace/lib/cpp/include/vector	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/adt/vector.hpp>
Index: pace/lib/cpp/meson.build
===================================================================
--- uspace/lib/cpp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#
-# Copyright (c) 2018 Jaroslav Jindrak
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-language = 'cpp'
-allow_shared = true
-src = files(
-	'src/condition_variable.cpp',
-	'src/exception.cpp',
-	'src/future.cpp',
-	'src/iomanip.cpp',
-	'src/ios.cpp',
-	'src/iostream.cpp',
-	'src/locale.cpp',
-	'src/mutex.cpp',
-	'src/new.cpp',
-	'src/refcount_obj.cpp',
-	'src/shared_mutex.cpp',
-	'src/stdexcept.cpp',
-	'src/string.cpp',
-	'src/system_error.cpp',
-	'src/thread.cpp',
-	'src/typeindex.cpp',
-	'src/typeinfo.cpp',
-	'src/__bits/runtime.cpp',
-	'src/__bits/trycatch.cpp',
-	'src/__bits/unwind.cpp',
-	'src/__bits/test/algorithm.cpp',
-	'src/__bits/test/adaptors.cpp',
-	'src/__bits/test/array.cpp',
-	'src/__bits/test/bitset.cpp',
-	'src/__bits/test/deque.cpp',
-	'src/__bits/test/functional.cpp',
-	'src/__bits/test/future.cpp',
-	'src/__bits/test/list.cpp',
-	'src/__bits/test/map.cpp',
-	'src/__bits/test/memory.cpp',
-	'src/__bits/test/mock.cpp',
-	'src/__bits/test/numeric.cpp',
-	'src/__bits/test/ratio.cpp',
-	'src/__bits/test/set.cpp',
-	'src/__bits/test/string.cpp',
-	'src/__bits/test/test.cpp',
-	'src/__bits/test/tuple.cpp',
-	'src/__bits/test/unordered_map.cpp',
-	'src/__bits/test/unordered_set.cpp',
-	'src/__bits/test/vector.cpp',
-)
Index: pace/lib/cpp/src/__bits/runtime.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/runtime.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/abi.hpp>
-#include <cassert>
-#include <cstdlib>
-#include <cstdint>
-#include <exception>
-#include <mutex>
-
-void* __dso_handle = nullptr;
-
-namespace __cxxabiv1
-{
-    namespace aux
-    {
-        struct destructor_t
-        {
-            void (*func)(void*);
-            void* ptr;
-            void* dso;
-        };
-
-        destructor_t* destructors{nullptr};
-        std::size_t destructor_count{0};
-        std::size_t destructor_size{32};
-
-        /**
-         * C atexit does not pass any arguments,
-         * but __cxa_finalize requires one so we
-         * use a wrapper.
-         */
-        void atexit_destructors()
-        {
-            __cxa_finalize(nullptr);
-        }
-    }
-
-    /**
-     * No need for a body, this function is called when a virtual
-     * call of a pure virtual function cannot be made.
-     */
-    extern "C" void __cxa_pure_virtual()
-    {
-        std::terminate();
-    }
-
-#ifdef __arm__
-    extern "C" int __aeabi_atexit(void* p, void (*f)(void*), void* d)
-    {
-        return __cxa_atexit(f, p, d);
-    }
-#endif
-
-    extern "C" int __cxa_atexit(void (*f)(void*), void* p, void* d)
-    {
-        if (!aux::destructors)
-        {
-            aux::destructors = new aux::destructor_t[aux::destructor_size];
-            std::atexit(aux::atexit_destructors);
-        }
-        else if (aux::destructor_count >= aux::destructor_size)
-        {
-            auto tmp = std::realloc(aux::destructors, aux::destructor_size * 2);
-
-            if (!tmp)
-                return -1;
-
-            aux::destructors = static_cast<aux::destructor_t*>(tmp);
-            aux::destructor_size *= 2;
-        }
-
-        auto& destr = aux::destructors[aux::destructor_count++];
-        destr.func = f;
-        destr.ptr = p;
-        destr.dso = d;
-
-        return 0;
-    }
-
-    extern "C" void __cxa_finalize(void *f)
-    {
-        if (!f)
-        {
-            for (std::size_t i = aux::destructor_count; i > 0; --i)
-            {
-                if (aux::destructors[i - 1].func)
-                    (*aux::destructors[i - 1].func)(aux::destructors[i - 1].ptr);
-            }
-        }
-        else
-        {
-            for (std::size_t i = aux::destructor_count; i > 0; --i)
-            {
-                if (aux::destructors[i - 1].func == f)
-                {
-                    (*aux::destructors[i - 1].func)(aux::destructors[i - 1].ptr);
-                    aux::destructors[i - 1].func = nullptr;
-                    aux::destructors[i - 1].ptr = nullptr;
-                    aux::destructors[i - 1].dso = nullptr;
-                    // TODO: shift and decrement count
-                }
-            }
-        }
-    }
-
-    using guard_t = std::uint64_t;
-    std::mutex static_guard_mtx{};
-
-    extern "C" int __cxa_guard_acquire(guard_t* guard)
-    {
-        static_guard_mtx.lock();
-
-        return !*((std::uint8_t*)guard);
-    }
-
-    extern "C" void __cxa_guard_release(guard_t* guard)
-    {
-        *((std::uint8_t*)guard) = 1;
-
-        static_guard_mtx.unlock();
-    }
-
-    extern "C" void __cxa_guard_abort(guard_t* guard)
-    {
-        static_guard_mtx.unlock();
-    }
-
-    __fundamental_type_info::~__fundamental_type_info()
-    { /* DUMMY BODY */ }
-
-    __array_type_info::~__array_type_info()
-    { /* DUMMY BODY */ }
-
-    __function_type_info::~__function_type_info()
-    { /* DUMMY BODY */ }
-
-    __enum_type_info::~__enum_type_info()
-    { /* DUMMY BODY */ }
-
-    __class_type_info::~__class_type_info()
-    { /* DUMMY BODY */ }
-
-    __si_class_type_info::~__si_class_type_info()
-    { /* DUMMY BODY */ }
-
-    __vmi_class_type_info::~__vmi_class_type_info()
-    { /* DUMMY BODY */ }
-
-    __pbase_type_info::~__pbase_type_info()
-    { /* DUMMY BODY */ }
-
-    __pointer_type_info::~__pointer_type_info()
-    { /* DUMMY BODY */ }
-
-    __pointer_to_member_type_info::~__pointer_to_member_type_info()
-    { /* DUMMY BODY */ }
-
-    /**
-     * This structure represents part of the vtable segment
-     * that contains data related to dynamic_cast.
-     */
-    struct vtable
-    {
-        // Unimportant to us.
-
-        std::ptrdiff_t offset_to_top;
-        std::type_info* tinfo;
-
-        // Actual vtable.
-    };
-    extern "C" void* __dynamic_cast(const void* sub, const __class_type_info* src,
-                                    const __class_type_info* dst, std::ptrdiff_t offset)
-    {
-        // TODO: implement
-        // NOTE: as far as I understand it, we get vtable prefix from sub, get the type_info
-        //       ptr from that and then climb the inheritance hierarchy upwards till we either
-        //       fint dst or fail and return nullptr
-        return nullptr;
-    }
-
-    // Needed on arm.
-    extern "C" void __cxa_end_cleanup()
-    { /* DUMMY BODY */ }
-
-    extern "C" int __cxa_thread_atexit(void(*)(void*), void*, void*)
-    {
-        // TODO: needed for thread_local variables
-        __unimplemented();
-        return 0;
-    }
-}
Index: pace/lib/cpp/src/__bits/test/adaptors.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/adaptors.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <cstdlib>
-#include <deque>
-#include <functional>
-#include <initializer_list>
-#include <iterator>
-#include <queue>
-#include <stack>
-#include <vector>
-
-namespace std::test
-{
-    namespace aux
-    {
-        template<class T, class Comp = std::less<T>>
-        class priority_queue_iterator
-        {
-            public:
-                using value_type      = T;
-                using reference       = const T&;
-                using size_type       = size_t;
-                using pointer         = value_type*;
-                using difference_type = size_t;
-
-                using iterator_category = forward_iterator_tag;
-
-                priority_queue_iterator(
-                    priority_queue<value_type, std::vector<value_type>, Comp> q,
-                    bool end = false
-                )
-                    : queue_{q}, end_{end}
-                { /* DUMMY BODY */ }
-
-                priority_queue_iterator(const priority_queue_iterator& other)
-                    : queue_{other.queue_}, end_{other.end_}
-                { /* DUMMY BODY */ }
-
-                reference operator*()
-                {
-                    return queue_.top();
-                }
-
-                priority_queue_iterator& operator++()
-                {
-                    queue_.pop();
-
-                    if (queue_.empty())
-                        end_ = true;
-
-                    return *this;
-                }
-
-                priority_queue_iterator operator++(int)
-                {
-                    auto old = *this;
-                    ++(*this);
-
-                    return old;
-                }
-
-                bool operator==(const priority_queue_iterator& rhs) const
-                {
-                    return end_ == rhs.end_;
-                }
-
-                bool operator!=(const priority_queue_iterator& rhs) const
-                {
-                    return !(*this == rhs);
-                }
-
-            private:
-                priority_queue<value_type, std::vector<value_type>, Comp> queue_;
-                bool end_;
-        };
-    }
-
-    bool adaptors_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_queue();
-        test_priority_queue();
-        test_stack();
-
-        return end();
-    }
-
-    const char* adaptors_test::name()
-    {
-        return "adaptors";
-    }
-
-    void adaptors_test::test_queue()
-    {
-        std::queue<int> q{std::deque<int>{1}};
-
-        test_eq("queue initialized from deque not empty", q.empty(), false);
-        test_eq("queue initialized form queue size", q.size(), 1U);
-        test_eq("single element queue front == back", q.front(), q.back());
-
-        q.push(2);
-        test_eq("queue push", q.back(), 2);
-        test_eq("queue size", q.size(), 2U);
-
-        q.pop();
-        test_eq("queue pop", q.front(), 2);
-
-        q.emplace(4);
-        test_eq("queue emplace", q.back(), 4);
-    }
-
-    void adaptors_test::test_priority_queue()
-    {
-        auto check1 = {9, 8, 5, 4, 2, 1};
-        std::vector<int> data{5, 4, 2, 8, 1};
-        std::priority_queue<int> q1{data.begin(), data.end()};
-
-        test_eq("priority_queue initialized from iterator range not empty", q1.empty(), false);
-        test_eq("priority_queue initialized from iterator range size", q1.size(), 5U);
-
-        q1.push(9);
-        test_eq("priority_queue push pt1", q1.size(), 6U);
-        test_eq("priority_queue push pt2", q1.top(), 9);
-
-        test_eq(
-            "priority_queue initialized from iterator range ops",
-            check1.begin(), check1.end(),
-            aux::priority_queue_iterator<int>{q1},
-            aux::priority_queue_iterator<int>{q1, true}
-        );
-
-        auto check2 = {1, 2, 3, 4, 5, 8};
-        std::priority_queue<int, std::vector<int>, std::greater<int>> q2{std::greater<int>{}, data};
-
-        test_eq("priority_queue initialized from vector and compare not empty", q2.empty(), false);
-        test_eq("priority_queue initialized from vector and compare size", q2.size(), 5U);
-
-        q2.push(3);
-        test_eq("priority_queue push pt1", q2.size(), 6U);
-        test_eq("priority_queue push pt2", q2.top(), 1);
-
-        test_eq(
-            "priority_queue initialized from vector and compare ops",
-            check2.begin(), check2.end(),
-            aux::priority_queue_iterator<int, std::greater<int>>{q2},
-            aux::priority_queue_iterator<int, std::greater<int>>{q2, true}
-        );
-    }
-
-    void adaptors_test::test_stack()
-    {
-        std::stack<int> s{std::deque<int>{1}};
-
-        test_eq("stack initialized from deque top", s.top(), 1);
-        test_eq("stack initialized from deque size", s.size(), 1U);
-        test_eq("stack initialized from deque not empty", s.empty(), false);
-
-        s.push(2);
-        test_eq("stack push top", s.top(), 2);
-        test_eq("stack push size", s.size(), 2U);
-
-        s.pop();
-        test_eq("stack pop top", s.top(), 1);
-        test_eq("stack pop size", s.size(), 1U);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/algorithm.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/algorithm.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,296 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <algorithm>
-#include <array>
-#include <string>
-#include <utility>
-
-namespace std::test
-{
-    bool algorithm_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_non_modifying();
-        test_mutating();
-
-        return end();
-    }
-
-    const char* algorithm_test::name()
-    {
-        return "algorithm";
-    }
-
-    void algorithm_test::test_non_modifying()
-    {
-        auto data1 = {1, 2, 3, 4, 5};
-        auto res1 = std::all_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x > 0; }
-        );
-        auto res2 = std::all_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x < 4; }
-        );
-
-        test("all_of pt1", res1);
-        test("all_of pt2", !res2);
-
-        auto res3 = std::any_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x > 4; }
-        );
-        auto res4 = std::any_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x == 10; }
-        );
-
-        test("any_of pt1", res3);
-        test("any_of pt2", !res4);
-
-        auto res5 = std::none_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x < 0; }
-        );
-        auto res6 = std::none_of(
-            data1.begin(), data1.end(),
-            [](auto x){ return x == 4; }
-        );
-
-        test("none_of pt1", res5);
-        test("none_of pt2", !res6);
-
-        std::array<int, 5> data2{1, 2, 3, 4, 5};
-        auto check1 = {1, 20, 3, 40, 5};
-        std::for_each(
-            data2.begin(), data2.end(),
-            [](auto& x){
-                if (x % 2 == 0)
-                    x *= 10;
-            }
-        );
-
-        test_eq(
-            "for_each", check1.begin(), check1.end(),
-            data2.begin(), data2.end()
-        );
-
-        auto res7 = std::find(data2.begin(), data2.end(), 40);
-        test_eq("find", res7, &data2[3]);
-
-        auto res8 = std::find_if(
-            data2.begin(), data2.end(),
-            [](auto x){ return x > 30; }
-        );
-        test_eq("find_if", res8, &data2[3]);
-
-        auto res9 = std::find_if_not(
-            data2.begin(), data2.end(),
-            [](auto x){ return x < 30; }
-        );
-        test_eq("find_if_not", res9, &data2[3]);
-
-        // TODO: find_end, find_first_of
-
-        std::array<int, 7> data3{1, 2, 3, 3, 4, 6, 5};
-        auto res10 = std::adjacent_find(data3.begin(), data3.end());
-        test_eq("adjacent_find pt1", res10, &data3[2]);
-
-        auto res11 = std::adjacent_find(
-            data3.begin(), data3.end(),
-            [](auto lhs, auto rhs){
-                return rhs < lhs;
-            }
-        );
-        test_eq("adjacent_find pt2", res11, &data3[5]);
-
-        auto res12 = std::count(data3.begin(), data3.end(), 3);
-        test_eq("count", res12, 2);
-
-        auto res13 = std::count_if(
-            data3.begin(), data3.end(),
-            [](auto x){
-                return x % 2 == 1;
-            }
-        );
-        test_eq("count_if", res13, 4);
-
-        std::array<int, 6> data4{1, 2, 3, 4, 5, 6};
-        std::array<int, 6> data5{1, 2, 3, 4, 6, 5};
-        auto res14 = std::mismatch(
-            data4.begin(), data4.end(),
-            data5.begin(), data5.end()
-        );
-
-        test_eq("mismatch pt1", res14.first, &data4[4]);
-        test_eq("mismatch pt2", res14.second, &data5[4]);
-
-        auto res15 = std::equal(
-            data4.begin(), data4.end(),
-            data4.begin(), data4.end()
-        );
-        test("equal pt1", res15);
-
-        auto res16 = std::equal(
-            data4.begin(), data4.end(),
-            data5.begin(), data5.end()
-        );
-        test("equal pt2", !res16);
-
-        auto res17 = std::equal(
-            data4.begin(), data4.end(),
-            data4.begin(), data4.end(),
-            [](auto lhs, auto rhs){
-                return lhs == rhs;
-            }
-        );
-        test("equal pt3", res17);
-
-        auto res18 = std::equal(
-            data4.begin(), data4.end(),
-            data5.begin(), data5.end(),
-            [](auto lhs, auto rhs){
-                return lhs == rhs;
-            }
-        );
-        test("equal pt4", !res18);
-
-        // TODO: is_permutation, search
-    }
-
-    void algorithm_test::test_mutating()
-    {
-        auto check1 = {1, 2, 3, 10, 20, 30, 40};
-        std::array<int, 4> data1{10, 20, 30, 40};
-        std::array<int, 7> data2{1, 2, 3, 4, 5, 6, 7};
-
-        auto res1 = std::copy(
-            data1.begin(), data1.end(), data2.begin() + 3
-        );
-
-        test_eq(
-            "copy pt1", check1.begin(), check1.end(),
-            data2.begin(), data2.end()
-        );
-        test_eq("copy pt2", res1, data2.end());
-
-        auto check2 = {1, 2, 3, 10, 20, 30, 7, 8};
-        std::array<int, 8> data3{1, 2, 3, 4, 5, 6, 7, 8};
-
-        auto res2 = std::copy_n(
-            data1.begin(), 3, data3.begin() + 3
-        );
-        test_eq(
-            "copy_n pt1", check2.begin(), check2.end(),
-            data3.begin(), data3.end()
-        );
-        test_eq("copy_n pt2", res2, &data3[6]);
-
-        auto check3 = {2, 4, 6, 8};
-        std::array<int, 4> data4{0, 0, 0, 0};
-        std::array<int, 9> data5{1, 2, 3, 4, 5, 6, 7, 8, 9};
-
-        auto res3 = std::copy_if(
-            data5.begin(), data5.end(), data4.begin(),
-            [](auto x){ return x % 2 == 0; }
-        );
-
-        test_eq(
-            "copy_if pt1", check3.begin(), check3.end(),
-            data4.begin(), data4.end()
-        );
-        test_eq("copy_if pt2", res3, data4.end());
-
-        /**
-         * Note: Not testing copy_backwards as it isn't
-         *       really easy to test, but since it is
-         *       widely used in the rest of the library
-         *       (mainly right shifting in sequence
-         *       containers) it's tested by other tests.
-         */
-
-        auto check4 = {std::string{"A"}, std::string{"B"}, std::string{"C"}};
-        std::array<std::string, 3> data6{"A", "B", "C"};
-        std::array<std::string, 3> data7{"", "", ""};
-
-        auto res4 = std::move(
-            data6.begin(), data6.end(), data7.begin()
-        );
-        test_eq(
-            "move pt1", check4.begin(), check4.end(),
-            data7.begin(), data7.end()
-        );
-        test(
-            "move pt2", (data6[0].empty() && data6[1].empty(),
-            data6[2].empty())
-        );
-        test_eq("move pt3", res4, data7.end());
-
-        auto check5 = {1, 2, 3, 4};
-        auto check6 = {10, 20, 30, 40};
-        std::array<int, 4> data8{1, 2, 3, 4};
-        std::array<int, 4> data9{10, 20, 30, 40};
-
-        auto res5 = std::swap_ranges(
-            data8.begin(), data8.end(),
-            data9.begin()
-        );
-
-        test_eq(
-            "swap_ranges pt1", check6.begin(), check6.end(),
-            data8.begin(), data8.end()
-        );
-        test_eq(
-            "swap_ranges pt2", check5.begin(), check5.end(),
-            data9.begin(), data9.end()
-        );
-        test_eq("swap_ranges pt3", res5, data9.end());
-
-        std::iter_swap(data8.begin(), data9.begin());
-        test_eq("swap_iter pt1", data8[0], 1);
-        test_eq("swap_iter pt2", data9[0], 10);
-
-        auto check7 = {2, 3, 4, 5};
-        std::array<int, 4> data10{1, 2, 3, 4};
-
-        auto res6 = std::transform(
-            data10.begin(), data10.end(), data10.begin(),
-            [](auto x) { return x + 1; }
-        );
-        test_eq(
-            "transform pt1",
-            check7.begin(), check7.end(),
-            data10.begin(), data10.end()
-        );
-        test_eq("transform pt2", res6, data10.end());
-    }
-}
Index: pace/lib/cpp/src/__bits/test/array.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/array.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,117 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <algorithm>
-#include <array>
-#include <initializer_list>
-
-namespace std::test
-{
-    bool array_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        auto check1 = {1, 2, 3, 4};
-        auto check2 = {4, 3, 2, 1};
-        auto check3 = {5, 5, 5, 5};
-
-        std::array<int, 4> arr1{1, 2, 3, 4};
-        test_eq(
-            "initializer list construction",
-            arr1.begin(), arr1.end(),
-            check1.begin(), check1.end()
-        );
-
-        auto it = arr1.begin();
-        test_eq(
-            "iterator increment",
-            *(++it), arr1[1]
-        );
-        test_eq(
-            "iterator decrement",
-            *(--it), arr1[0]
-        );
-
-        std::array<int, 4> arr2{arr1};
-        test_eq(
-            "copy construction",
-            arr1.begin(), arr1.end(),
-            arr2.begin(), arr2.end()
-        );
-
-        std::reverse(arr2.begin(), arr2.end());
-        test_eq(
-            "reverse",
-            arr2.begin(), arr2.end(),
-            check2.begin(), check2.end()
-        );
-        test_eq(
-            "reverse iterator",
-            arr1.rbegin(), arr1.rend(),
-            arr2.begin(), arr2.end()
-        );
-
-
-        std::array<int, 4> arr3{};
-        arr3.fill(5);
-        test_eq(
-            "fill",
-            arr3.begin(), arr3.end(),
-            check3.begin(), check3.end()
-        );
-
-        arr2.swap(arr3);
-        test_eq(
-            "swap part 1",
-            arr2.begin(), arr2.end(),
-            check3.begin(), check3.end()
-        );
-        test_eq(
-            "swap part 2",
-            arr3.begin(), arr3.end(),
-            check2.begin(), check2.end()
-        );
-
-        // TODO: test bound checking of at when implemented
-
-        std::array<int, 3> arr4{1, 2, 3};
-        auto [a, b, c] = arr4;
-        test_eq("structured binding part 1", a, 1);
-        test_eq("structured binding part 2", b, 2);
-        test_eq("structured binding part 3", c, 3);
-
-        return end();
-    }
-
-    const char* array_test::name()
-    {
-        return "array";
-    }
-}
Index: pace/lib/cpp/src/__bits/test/bitset.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/bitset.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <bitset>
-#include <initializer_list>
-#include <sstream>
-#include <string>
-
-namespace std::test
-{
-    bool bitset_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_strings();
-        test_operations();
-
-        return end();
-    }
-
-    const char* bitset_test::name()
-    {
-        return "bitset";
-    }
-
-    void bitset_test::test_constructors_and_assignment()
-    {
-        // 00101010bin == 42dec (note that the bits are reversed in bitset)
-        auto check1 = {false, true, false, true, false, true, false, false};
-        std::bitset<8> b1{42};
-        test_eq(
-            "from number to number equivalence",
-            b1.to_ulong(), 42UL
-        );
-
-        auto it = check1.begin();
-        size_t i{};
-        for (; i < 8U; ++i)
-        {
-            if (*it++ != b1[i])
-                break;
-        }
-        test_eq("from number iterating over bits", i, 8U);
-
-        std::bitset<8> b2{"00101010"};
-        test_eq(
-            "from string to number equivalence",
-            b2.to_ulong(), 42UL
-        );
-
-        it = check1.begin();
-        i = size_t{};
-        for (; i < 8U; ++i)
-        {
-            if (*it++ != b2[i])
-                break;
-        }
-        test_eq("from string iterating over bits", i, 8U);
-
-        std::bitset<16> b3{0b1111'1101'1011'1010};
-        test_eq(
-            "from binary to number equivalence",
-            b3.to_ulong(), 0b1111'1101'1011'1010UL
-        );
-
-        std::bitset<64> b4{0xABCD'DCBA'DEAD'BEEFULL};
-        test_eq(
-            "from hex to number equivalence",
-            b4.to_ulong(), static_cast<unsigned long>(0xABCD'DCBA'DEAD'BEEFULL)
-        );
-
-        std::bitset<8> b5{"XXYXYXYX", 8U, 'X', 'Y'};
-        test_eq(
-            "from string with different 0/1 values equivalence",
-            b5.to_ulong(), 42U
-        );
-
-        std::bitset<8> b6{"XXYXYXYXXXX IGNORED", 8U, 'X', 'Y'};
-        test_eq(
-            "from prefix string with different 0/1 values equivalence",
-            b6.to_ulong(), 42U
-        );
-
-        std::bitset<8> b7{std::string{"XXXXYXYXYX"}, 2U, 8U, 'X', 'Y'};
-        test_eq(
-            "from substring with different 0/1 values equivalence",
-            b7.to_ulong(), 42U
-        );
-    }
-
-    void bitset_test::test_strings()
-    {
-        std::bitset<8> b1{42};
-        auto s1 = b1.to_string();
-        test_eq(
-            "to string",
-            s1, "00101010"
-        );
-
-        auto s2 = b1.to_string('X', 'Y');
-        test_eq(
-            "to string string with different 0/1 values",
-            s2, "XXYXYXYX"
-        );
-
-        std::istringstream iss{"00101010"};
-        std::bitset<8> b2{};
-        iss >> b2;
-        test_eq(
-            "istream operator>>",
-            b2.to_ulong(), 42UL
-        );
-
-        std::ostringstream oss{};
-        oss << b2;
-        std::string s3{oss.str()};
-        std::string s4{"00101010"};
-        test_eq(
-            "ostream operator<<",
-            s3, s4
-        );
-    }
-
-    void bitset_test::test_operations()
-    {
-        std::bitset<8> b1{};
-
-        b1.set(3);
-        test_eq("set", b1[3], true);
-
-        b1.reset(3);
-        test_eq("reset", b1[3], false);
-
-        b1.flip(3);
-        test_eq("flip", b1[3], true);
-
-        b1 >>= 1;
-        test_eq("lshift new", b1[2], true);
-        test_eq("lshift old", b1[3], false);
-
-        b1 <<= 1;
-        test_eq("rshift new", b1[2], false);
-        test_eq("rshift old", b1[3], true);
-
-        test_eq("any1", b1.any(), true);
-        test_eq("none1", b1.none(), false);
-        test_eq("all1", b1.all(), false);
-
-        /* b1 <<= 7; */
-        /* test_eq("any2", b1.any(), false); */
-        /* test_eq("none2", b1.none(), true); */
-        /* test_eq("all2", b1.all(), false); */
-
-        b1.set();
-        test_eq("set + all", b1.all(), true);
-
-        b1.reset();
-        test_eq("reset + none", b1.none(), true);
-
-        std::bitset<8> b2{0b0101'0101};
-        std::bitset<8> b3{0b1010'1010};
-        b2.flip();
-        test_eq("flip all", b2, b3);
-
-        std::bitset<8> b4{0b0011'0101};
-        std::bitset<8> b5{0b1010'1100};
-        test_eq("and", (b4 & b5), std::bitset<8>{0b0010'0100});
-        test_eq("or", (b4 | b5), std::bitset<8>{0b1011'1101});
-        test_eq("count", b4.count(), 4U);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/deque.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/deque.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,295 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <deque>
-#include <initializer_list>
-#include <utility>
-
-namespace std::test
-{
-    bool deque_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_resizing();
-        test_push_pop();
-        test_operations();
-
-        return end();
-    }
-
-    const char* deque_test::name()
-    {
-        return "deque";
-    }
-
-    void deque_test::test_constructors_and_assignment()
-    {
-        auto check1 = {0, 0, 0, 0, 0};
-        std::deque<int> d1(5U);
-        test_eq(
-            "size construction",
-            check1.begin(), check1.end(),
-            d1.begin(), d1.end()
-        );
-
-        auto check2 = {1, 1, 1, 1, 1};
-        std::deque<int> d2(5U, 1);
-        test_eq(
-            "value construction",
-            check2.begin(), check2.end(),
-            d2.begin(), d2.end()
-        );
-
-        auto check3 = {1, 2, 3, 4, 5};
-        std::deque<int> d3{check3.begin(), check3.end()};
-        test_eq(
-            "iterator range construction",
-            check3.begin(), check3.end(),
-            d3.begin(), d3.end()
-        );
-
-        std::deque<int> d4{d3};
-        test_eq(
-            "copy construction",
-            check3.begin(), check3.end(),
-            d4.begin(), d4.end()
-        );
-
-        std::deque<int> d5{std::move(d4)};
-        test_eq(
-            "move construction",
-            check3.begin(), check3.end(),
-            d5.begin(), d5.end()
-        );
-        test_eq("move construction - origin empty", d4.empty(), true);
-
-        std::deque<int> d6{check3};
-        test_eq(
-            "inializer list construction",
-            check3.begin(), check3.end(),
-            d6.begin(), d6.end()
-        );
-
-        d4 = d6;
-        test_eq(
-            "copy assignment",
-            check3.begin(), check3.end(),
-            d4.begin(), d4.end()
-        );
-
-        d6 = std::move(d4);
-        test_eq(
-            "move assignment",
-            check3.begin(), check3.end(),
-            d6.begin(), d6.end()
-        );
-        test_eq("move assignment - origin empty", d4.empty(), true);
-
-        d4 = check3;
-        test_eq(
-            "initializer list assignment",
-            check3.begin(), check3.end(),
-            d4.begin(), d4.end()
-        );
-
-        std::deque<int> d7{};
-        d7.assign(check3.begin(), check3.end());
-        test_eq(
-            "iterator range assign()",
-            check3.begin(), check3.end(),
-            d7.begin(), d7.end()
-        );
-
-        d7.assign(5U, 1);
-        test_eq(
-            "value assign()",
-            check2.begin(), check2.end(),
-            d7.begin(), d7.end()
-        );
-
-        d7.assign(check3);
-        test_eq(
-            "initializer list assign()",
-            check3.begin(), check3.end(),
-            d7.begin(), d7.end()
-        );
-    }
-
-    void deque_test::test_resizing()
-    {
-        auto check1 = {1, 2, 3};
-        auto check2 = {1, 2, 3, 0, 0};
-        std::deque<int> d1{1, 2, 3, 4, 5};
-
-        d1.resize(3U);
-        test_eq(
-            "downsize",
-            check1.begin(), check1.end(),
-            d1.begin(), d1.end()
-        );
-
-        d1.resize(5U);
-        test_eq(
-            "upsize",
-            check2.begin(), check2.end(),
-            d1.begin(), d1.end()
-        );
-
-        auto check3 = {1, 2, 3, 9, 9};
-        std::deque<int> d2{1, 2, 3, 4, 5};
-
-        d2.resize(3U, 9);
-        test_eq(
-            "downsize with default value",
-            check1.begin(), check1.end(),
-            d2.begin(), d2.end()
-        );
-
-        d2.resize(5U, 9);
-        test_eq(
-            "upsize with default value",
-            check3.begin(), check3.end(),
-            d2.begin(), d2.end()
-        );
-
-        d2.resize(0U);
-        test_eq("resize to 0", d2.empty(), true);
-    }
-
-    void deque_test::test_push_pop()
-    {
-        std::deque<int> d1{};
-
-        d1.push_back(42);
-        test_eq("push_back to empty equivalence", d1[0], 42);
-        test_eq("push_back to empty size", d1.size(), 1U);
-
-        d1.push_front(21);
-        test_eq("push_front after push_back equivalence", d1[0], 21);
-        test_eq("push_front after push_back size", d1.size(), 2U);
-
-        for (int i = 0; i <= 100; ++i)
-            d1.push_back(i);
-        test_eq("back after bucket test", d1.back(), 100);
-
-        d1.pop_back();
-        test_eq("back after pop_back", d1.back(), 99);
-        d1.pop_front();
-        test_eq("front after pop_front", d1.back(), 99);
-
-
-        for (int i = 0; i <= 100; ++i)
-            d1.push_front(i);
-        test_eq("front after bucket test", d1.front(), 100);
-
-        std::deque<int> d2{};
-
-        d2.push_front(42);
-        test_eq("push_front to empty equivalence", d2[0], 42);
-        test_eq("push_front to empty size", d2.size(), 1U);
-
-        d2.push_back(21);
-        test_eq("push_back after push_front equivalence", d2[1], 21);
-        test_eq("push_back after push_front size", d2.size(), 2U);
-
-        d2.clear();
-        test_eq("clear() - empty()", d2.empty(), true);
-        test_eq("clear() - iterators", d2.begin(), d2.end());
-    }
-
-    void deque_test::test_operations()
-    {
-        auto check1 = {
-            1, 2, 3, 4, 11, 22, 33, 44, 55, 66, 77, 88,
-            5, 6, 7, 8, 9, 10, 11, 12
-        };
-        auto to_insert = {11, 22, 33, 44, 55, 66, 77, 88};
-
-        std::deque<int> d1{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
-        std::deque<int> d2{d1};
-        std::deque<int> d3{d1};
-        std::deque<int> d4{d1};
-
-        d1.insert(d1.begin() + 5, to_insert.begin(), to_insert.end());
-        test_eq(
-            "insert iterator range",
-            check1.begin(), check1.end(),
-            d1.begin(), d1.end()
-        );
-
-        d2.insert(d2.begin() + 5, to_insert);
-        test_eq(
-            "insert initializer list",
-            check1.begin(), check1.end(),
-            d2.begin(), d2.end()
-        );
-
-        auto check2 = {
-            1, 2, 3, 4, 99, 99, 99, 99, 99, 99, 99, 99,
-            5, 6, 7, 8, 9, 10, 11, 12
-        };
-        d3.insert(d3.begin() + 5, 8U, 99);
-        test_eq(
-            "insert value n times",
-            check2.begin(), check2.end(),
-            d3.begin(), d3.end()
-        );
-
-        auto check3 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
-        d3.erase(d3.begin() + 4, d3.begin() + 12);
-        test_eq(
-            "erase iterator range",
-            check3.begin(), check3.end(),
-            d3.begin(), d3.end()
-        );
-
-        auto check4 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12};
-        d3.erase(d3.begin() + 10);
-        test_eq(
-            "erase",
-            check4.begin(), check4.end(),
-            d3.begin(), d3.end()
-        );
-
-        d2.swap(d3);
-        test_eq(
-            "swap1",
-            check1.begin(), check1.end(),
-            d3.begin(), d3.end()
-        );
-        test_eq(
-            "swap2",
-            check4.begin(), check4.end(),
-            d2.begin(), d2.end()
-        );
-    }
-}
Index: pace/lib/cpp/src/__bits/test/functional.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/functional.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <functional>
-#include <type_traits>
-#include <utility>
-
-using namespace std::placeholders;
-
-namespace std::test
-{
-    namespace aux
-    {
-        int f1(int a, int b)
-        {
-            return a + b;
-        }
-
-        int f2(int a, int b)
-        {
-            return a * 10 + b;
-        }
-
-        void f3(int& a, int& b)
-        {
-            a = 42;
-            b = 1337;
-        }
-
-        struct Foo
-        {
-            int add(int a)
-            {
-                return a + data;
-            }
-
-            int data;
-        };
-    }
-
-    bool functional_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_reference_wrapper();
-        test_function();
-        test_bind();
-
-        return end();
-    }
-
-    const char* functional_test::name()
-    {
-        return "functional";
-    }
-
-    void functional_test::test_reference_wrapper()
-    {
-        int x{4};
-        auto ref = std::ref(x);
-
-        test("reference_wrapper equivalence after construction (cast)", (ref == x));
-        test("reference_wrapper equivalence after construction (get)", (ref.get() == x));
-
-        ref.get() = 5;
-        test_eq("reference_wrapper equivalence after modification pt1", ref.get(), 5);
-        test_eq("reference_wrapper equivalence after modification pt2", x, 5);
-
-        int y{10};
-        ref = y;
-        test_eq("reference_wrapper equivalence after assignment pt1", ref.get(), 10);
-        test_eq("reference_wrapper equivalence after assignment pt2", x, 5);
-
-        std::function<int(int, int)> wrapped_f1{&aux::f1};
-        auto fref = std::ref(wrapped_f1);
-        auto res = fref(2, 5);
-        test_eq("reference_wrapper function invoke", res, 7);
-    }
-
-    void functional_test::test_function()
-    {
-        std::function<int(int, int)> f1{&aux::f1};
-        auto res1 = f1(1, 2);
-
-        test_eq("function from function pointer", res1, 3);
-
-        int x{};
-        std::function<char(char)> f2{[&](auto c){ x = 42; return ++c; }};
-        auto res2 = f2('B');
-
-        test_eq("function from lambda", res2, 'C');
-        test_eq("function from lambda - capture", x, 42);
-
-        test("function operator bool", (bool)f2);
-        f2 = nullptr;
-        test("function nullptr assignment", !f2);
-    }
-
-    void functional_test::test_bind()
-    {
-        auto f1 = std::bind(aux::f1, _1, 1);
-        auto res1 = f1(3);
-
-        test_eq("bind placeholder", res1, 4);
-
-        auto f2 = std::bind(aux::f2, _2, _1);
-        auto res2 = f2(5, 6);
-
-        test_eq("bind reverse placeholder order", res2, 65);
-
-        int x{};
-        int y{};
-        auto f3 = std::bind(aux::f3, _1, std::ref(y));
-        f3(std::ref(x));
-
-        test_eq("bind std::ref as bound", y, 1337);
-        test_eq("bind std::ref as unbound", x, 42);
-
-        auto f4 = std::bind(aux::f2, x, y);
-        auto res3 = f4();
-
-        test_eq("bind all arguments bound", res3, 1757);
-
-        aux::Foo foo{5};
-        auto f5 = std::mem_fn(&aux::Foo::add);
-        auto res4 = f5(&foo, 4);
-
-        test_eq("mem_fn", res4, 9);
-
-        /* auto f5 = std::bind(&aux::Foo::add, _1, _2); */
-        /* auto res4 = f4(&foo, 10); */
-
-        /* test_eq("bind to member function", res4, 19); */
-    }
-}
Index: pace/lib/cpp/src/__bits/test/future.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/future.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/mock.hpp>
-#include <__bits/test/tests.hpp>
-#include <chrono>
-#include <exception>
-#include <future>
-#include <tuple>
-#include <utility>
-
-using namespace std::chrono_literals;
-
-namespace
-{
-    template<class R>
-    auto prepare()
-    {
-        auto res = std::tuple<
-            std::promise<R>, std::future<R>,
-            std::aux::shared_state<R>*
-        >{};
-        std::get<0>(res) = std::promise<R>{};
-        std::get<1>(res) = std::get<0>(res).get_future();
-        std::get<2>(res) = std::get<1>(res).__state();
-
-        return res;
-    }
-}
-
-namespace std::test
-{
-    bool future_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_future();
-        test_promise();
-        test_future_promise();
-        test_async();
-        test_packaged_task();
-        test_shared_future();
-
-        return end();
-    }
-
-    const char* future_test::name()
-    {
-        return "future";
-    }
-
-    void future_test::test_future()
-    {
-        std::future<int> f1{};
-        test("default constructed invalid", !f1.valid());
-
-        std::future<int> f2{new std::aux::shared_state<int>{}};
-        test("state constructed valid", f2.valid());
-
-        f1 = std::move(f2);
-        test("move assignment source invalid", !f2.valid());
-        test("move assignment destination valid", f1.valid());
-
-        std::future<int> f3{std::move(f1)};
-        test("move construction source invalid", !f1.valid());
-        test("move construction destination valid", f3.valid());
-    }
-
-    void future_test::test_promise()
-    {
-        std::promise<int> p1{};
-        test("default constructed promise has state", p1.__state());
-
-        std::promise<int> p2{};
-        auto* s1 = p1.__state();
-        auto* s2 = p2.__state();
-        p2.swap(p1);
-        std::swap(s1, s2);
-
-        test_eq("swap switches states pt1", s1, p1.__state());
-        test_eq("swap switches states pt2", s2, p2.__state());
-
-        std::promise<int> p3{std::move(p1)};
-        test_eq("move construction state moved", s1, p3.__state());
-        test_eq("move construction source empty", p1.__state(), nullptr);
-
-        p1 = std::move(p3);
-        test_eq("move assignment state move", s1, p1.__state());
-        test_eq("move assignment source empty", p3.__state(), nullptr);
-
-        p1.set_value(42);
-        test("set_value marks state as ready", s1->is_set());
-        test_eq("set_value sets value", s1->get(), 42);
-    }
-
-    void future_test::test_future_promise()
-    {
-        /**
-         * Note: As we currently have no exception
-         *       propagation support, we do not test
-         *       exceptions here. However, the logic there
-         *       is basically identical to that of the value
-         *       setting.
-         */
-        auto [p1, f1, s1] = prepare<int>();
-        test_eq("refcount in basic case", s1->refs(), 2);
-
-        p1.set_value(1);
-        test("simple case valid", f1.valid());
-        test_eq("simple case get", f1.get(), 1);
-
-        auto [p2, f2, s2] = prepare<int>();
-        std::thread t2{
-            [&p2](){
-                std::this_thread::sleep_for(20ms);
-                p2.set_value(42);
-            }
-        };
-
-        test_eq("parallel get waits and has correct value", f2.get(), 42);
-
-        auto [p3, f3, s3] = prepare<int>();
-        std::thread t3{
-            [&p3](){
-                std::this_thread::sleep_for(20ms);
-                p3.set_value(42);
-            }
-        };
-
-        f3.wait();
-        test("after wait value is set", s3->is_set());
-        test_eq("after wait value is correct", s3->get(), 42);
-
-        auto [p4, f4, s4] = prepare<int>();
-        std::thread t4{
-            [&p4](){
-                /* p4.set_value_at_thread_exit(42); */
-            }
-        };
-        std::this_thread::sleep_for(10ms); // Let the value be set inside state.
-
-        /* test("shared state marked as ready at thread exit", s4->is_set()); */
-        /* test_eq("value set inside state while in thread", s4->get(), 42); */
-        /* test_eq("value set at thread exit", f4.get(), 42); */
-
-        mock::clear();
-        std::aux::shared_state<std::test::mock>* s5{};
-        {
-            std::promise<std::test::mock> p5{};
-            s5 = p5.__state();
-            test_eq("refcount with just promise", s5->refs(), 1);
-            {
-                auto f5 = p5.get_future();
-                test_eq("refcount after creating future", s5->refs(), 2);
-            }
-            test_eq("refcount after future is destroyed", s5->refs(), 1);
-            test_eq("state not destroyed with future", mock::destructor_calls, 0U);
-        }
-        test_eq("state destroyed with promise", mock::destructor_calls, 1U);
-
-        mock::clear();
-        {
-            std::aux::shared_state<std::test::mock>* s6{};
-            std::future<std::test::mock> f6{};
-            {
-                std::promise<std::test::mock> p6{};
-                s6 = p6.__state();
-                {
-                    f6 = p6.get_future();
-                    test_eq("move construction only increments refcount once", s6->refs(), 2);
-                }
-            }
-            test_eq("refcount after promise is destroyed", s6->refs(), 1);
-            test_eq("state not destroyed with promise", mock::destructor_calls, 0U);
-        }
-        test_eq("state destroyed with future", mock::destructor_calls, 1U);
-
-        auto [p7, f7, s7] = prepare<int>();
-        auto res7 = f7.wait_for(5ms);
-        test_eq("wait_for timeout", res7, std::future_status::timeout);
-
-        res7 = f7.wait_until(std::chrono::system_clock::now() + 5ms);
-        test_eq("wait_until timeout", res7, std::future_status::timeout);
-
-        std::thread t7{
-            [&p7](){
-                std::this_thread::sleep_for(5ms);
-                p7.set_value(42);
-            }
-        };
-        res7 = f7.wait_for(10ms);
-        test_eq("wait_for ready", res7, std::future_status::ready);
-
-        auto [p8, f8, s8] = prepare<int>();
-        std::thread t8{
-            [&p8](){
-                std::this_thread::sleep_for(5ms);
-                p8.set_value(42);
-            }
-        };
-
-        auto res8 = f8.wait_until(std::chrono::system_clock::now() + 10ms);
-        test_eq("wait_until ready", res8, std::future_status::ready);
-
-        int x{};
-        std::promise<int&> p9{};
-        std::future<int&> f9 = p9.get_future();
-        p9.set_value(x);
-        int& y = f9.get();
-
-        test_eq("reference equal to original", x, y);
-
-        ++x;
-        test_eq("equal after modifying original", x, y);
-
-        ++y;
-        test_eq("equal after modifying reference", x, y);
-    }
-
-    void future_test::test_async()
-    {
-        auto res1 = std::async(
-            [](){
-                return 42;
-            }
-        );
-        test_eq("ret async default policy", res1.get(), 42);
-
-        auto res2 = std::async(
-            std::launch::deferred, [](){
-                return 42;
-            }
-        );
-        test_eq("ret async deferred policy", res2.get(), 42);
-
-        auto res3 = std::async(
-            std::launch::async, [](){
-                return 42;
-            }
-        );
-        test_eq("ret async async policy", res3.get(), 42);
-
-        int x{};
-        auto res4 = std::async(
-            [&x](){
-                x = 42;
-            }
-        );
-
-        res4.get();
-        test_eq("void async", x, 42);
-    }
-
-    void future_test::test_packaged_task()
-    {
-        std::packaged_task<int(int)> pt1{};
-        test("default constructed packaged_task not valid", !pt1.valid());
-
-        pt1 = std::packaged_task<int(int)>{
-            [](int x){
-                return x + 1;
-            }
-        };
-        test("packaged_task default constructed and move assigned valid", pt1.valid());
-
-        auto f1 = pt1.get_future();
-        test("future from valid packaged_task valid", f1.valid());
-
-        pt1(10);
-        test_eq("result stored in future correct", f1.get(), 11);
-
-        std::packaged_task<int()> pt2{
-            [](){
-                return 42;
-            }
-        };
-        auto f2 = pt2.get_future();
-        pt2();
-        test_eq("no argument packaged_task return value correct", f2.get(), 42);
-
-        pt2.reset();
-        test_eq("reset causes refcount decrement", f2.__state()->refs(), 1);
-
-        auto f3 = pt2.get_future();
-        pt2();
-        test_eq("invocation after reset returns correct value", f3.get(), 42);
-        test("reset recreates state", (f2.__state() != f3.__state()));
-    }
-
-    void future_test::test_shared_future()
-    {
-        auto [p1, f1, s1] = prepare<int>();
-        auto sf1 = f1.share();
-
-        test("future invalid after share", !f1.valid());
-        test_eq("shared state moved on share", sf1.__state(), s1);
-        test_eq("no refcount increment on share", s1->refs(), 2);
-
-        {
-            auto sf2 = sf1;
-            test_eq("refcount increment on copy", s1->refs(), 3);
-            test_eq("shared state shared between copies", sf1.__state(), sf2.__state());
-        }
-        test_eq("refcount decrement when copy gets destroyed", s1->refs(), 2);
-
-        auto sf2 = sf1;
-        int res1{}, res2{};
-        std::thread t1{
-            [&](){
-                res1 = sf1.get();
-            }
-        };
-        std::thread t2{
-            [&](){
-                res2 = sf2.get();
-            }
-        };
-
-        std::this_thread::sleep_for(20ms);
-        p1.set_value(42);
-        std::this_thread::sleep_for(20ms);
-        test_eq("first result correct", res1, 42);
-        test_eq("second result correct", res2, 42);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/list.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/list.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,315 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <list>
-#include <utility>
-
-namespace std::test
-{
-    bool list_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_construction_and_assignment();
-        test_modifiers();
-
-        return end();
-    }
-
-    const char* list_test::name()
-    {
-        return "list";
-    }
-
-    void list_test::test_construction_and_assignment()
-    {
-        auto check1 = {1, 1, 1, 1, 1, 1};
-        auto check2 = {1, 2, 3, 4, 5, 6};
-
-        std::list<int> l1(6U, 1);
-        test_eq(
-            "n*value initialization",
-            check1.begin(), check1.end(),
-            l1.begin(), l1.end()
-        );
-
-        std::list<int> l2{check2};
-        test_eq(
-            "initializer_list initialization",
-            check2.begin(), check2.end(),
-            l2.begin(), l2.end()
-        );
-
-        std::list<int> l3{check2.begin(), check2.end()};
-        test_eq(
-            "iterator range initialization",
-            check2.begin(), check2.end(),
-            l3.begin(), l3.end()
-        );
-
-        std::list<int> l4{l3};
-        test_eq(
-            "copy initialization",
-            check2.begin(), check2.end(),
-            l4.begin(), l4.end()
-        );
-        test_eq("size", l4.size(), 6U);
-        test_eq("not empty", l4.empty(), false);
-
-        std::list<int> l5{std::move(l4)};
-        test_eq(
-            "move initialization",
-            check2.begin(), check2.end(),
-            l5.begin(), l5.end()
-        );
-        test_eq("move initializaiton - origin empty pt1", l4.empty(), true);
-        test_eq("move initializaiton - origin empty pt2", l4.size(), 0U);
-
-        l4 = l5;
-        test_eq(
-            "copy assignment",
-            l5.begin(), l5.end(),
-            l4.begin(), l4.end()
-        );
-        test_eq("copy assignment size", l4.size(), l5.size());
-
-        l1 = std::move(l4);
-        test_eq(
-            "move assignment",
-            l5.begin(), l5.end(),
-            l1.begin(), l1.end()
-        );
-        test_eq("move assignment - origin empty", l4.empty(), true);
-
-        auto check3 = {5, 4, 3, 2, 1};
-        l4 = check3;
-        test_eq(
-            "initializer_list assignment pt1",
-            check3.begin(), check3.end(),
-            l4.begin(), l4.end()
-        );
-        test_eq("initializer_list assignment pt2", l4.size(), 5U);
-
-        l5.assign(check3.begin(), check3.end());
-        test_eq(
-            "iterator range assign() pt1",
-            check3.begin(), check3.end(),
-            l5.begin(), l5.end()
-        );
-        test_eq("iterator range assign() pt2", l5.size(), 5U);
-
-        l5.assign(6U, 1);
-        test_eq(
-            "n*value assign() pt1",
-            check1.begin(), check1.end(),
-            l5.begin(), l5.end()
-        );
-        test_eq("n*value assign() pt2", l5.size(), 6U);
-
-        l5.assign(check3);
-        test_eq(
-            "initializer_list assign() pt1",
-            check3.begin(), check3.end(),
-            l5.begin(), l5.end()
-        );
-        test_eq("initializer_list assign() pt2", l5.size(), 5U);
-
-        auto check4 = {1, 2, 3, 4, 5};
-        test_eq(
-            "reverse iterators",
-            check4.begin(), check4.end(),
-            l5.rbegin(), l5.rend()
-        );
-
-        test_eq("front", l5.front(), 5);
-        test_eq("back", l5.back(), 1);
-    }
-
-    void list_test::test_modifiers()
-    {
-        std::list<int> l1{};
-        test_eq("empty list", l1.empty(), true);
-
-        l1.push_back(1);
-        test_eq("empty list push_back pt1", l1.size(), 1U);
-        test_eq("empty list push_back pt2", l1.empty(), false);
-        test_eq("empty list push_back pt3", l1.front(), 1);
-        test_eq("empty list push_back pt4", l1.back(), 1);
-
-        l1.push_front(2);
-        test_eq("push_front pt1", l1.size(), 2U);
-        test_eq("push_front pt2", l1.front(), 2);
-        test_eq("push_front pt3", l1.back(), 1);
-
-        l1.pop_back();
-        test_eq("pop_back pt1", l1.size(), 1U);
-        test_eq("pop_back pt2", l1.back(), 2);
-
-        l1.push_front(3);
-        test_eq("size", l1.size(), 2U);
-
-        l1.pop_front();
-        test_eq("pop_front", l1.front(), 2);
-
-        auto check1 = {2, 42, 42, 42, 42, 42};
-        l1.insert(l1.begin(), 5U, 42);
-        test_eq(
-            "insert n*value",
-            check1.begin(), check1.end(),
-            l1.begin(), l1.end()
-        );
-
-        auto data1 = {33, 34};
-        auto check2 = {2, 42, 33, 34, 42, 42, 42, 42};
-        auto it1 = l1.begin();
-        std::advance(it1, 2);
-
-        l1.insert(it1, data1.begin(), data1.end());
-        test_eq(
-            "insert iterator range",
-            check2.begin(), check2.end(),
-            l1.begin(), l1.end()
-        );
-
-        auto check3 = {2, 42, 33, 34, 42, 33, 34, 42, 42, 42};
-        auto it2 = l1.begin();
-        std::advance(it2, 5);
-
-        l1.insert(it2, data1);
-        test_eq(
-            "insert initializer_list",
-            check3.begin(), check3.end(),
-            l1.begin(), l1.end()
-        );
-
-        auto check4 = {2, 42, 33, 34, 33, 34, 42, 42, 42};
-        auto it3 = l1.begin();
-        std::advance(it3, 4);
-
-        l1.erase(it3);
-        test_eq(
-            "erase iterator",
-            check4.begin(), check4.end(),
-            l1.begin(), l1.end()
-        );
-
-        auto check5 = {33, 34, 42, 42, 42};
-        auto it4 = l1.begin();
-        auto it5 = l1.begin();
-        std::advance(it5, 4);
-
-        l1.erase(it4, it5);
-        test_eq(
-            "erase iterator range",
-            check5.begin(), check5.end(),
-            l1.begin(), l1.end()
-        );
-
-        l1.clear();
-        test_eq("clear empty", l1.empty(), true);
-        test_eq("clear size", l1.size(), 0U);
-
-        std::list<int> l2{1, 2, 3, 4, 5};
-        std::list<int> l3{10, 20, 30, 40, 50};
-
-        auto check6 = {1, 2, 10, 20, 30, 40, 50, 3, 4, 5};
-        auto check7 = {1, 2, 10, 20, 30, 40, 50};
-        auto check8 = {3, 4, 5};
-
-        auto it6 = l2.begin();
-        std::advance(it6, 2);
-
-        l2.splice(it6, l3);
-        test_eq(
-            "splice pt1",
-            check6.begin(), check6.end(),
-            l2.begin(), l2.end()
-        );
-        test_eq("splice pt2", l3.empty(), true);
-
-        l3.splice(l3.begin(), l2, it6, l2.end());
-        test_eq(
-            "splice pt3",
-            check7.begin(), check7.end(),
-            l2.begin(), l2.end()
-        );
-        test_eq(
-            "splice pt4",
-            check8.begin(), check8.end(),
-            l3.begin(), l3.end()
-        );
-        test_eq("splice size pt1", l2.size(), 7U);
-        test_eq("splice size pt2", l3.size(), 3U);
-
-        auto check9 = {1, -1, 2, -2, 3, -3, 4, -4};
-        auto check10 = {1, 2, 3, 4};
-        std::list<int> l4{1, -1, 2, 5, -2, 5, 3, -3, 5, 4, -4};
-
-        l4.remove(5);
-        test_eq(
-            "remove",
-            check9.begin(), check9.end(),
-            l4.begin(), l4.end()
-        );
-        test_eq("remove size", l4.size(), 8U);
-
-        l4.remove_if([](auto x){ return x < 0; });
-        test_eq(
-            "remove_if",
-            check10.begin(), check10.end(),
-            l4.begin(), l4.end()
-        );
-        test_eq("remove_if size", l4.size(), 4U);
-
-        auto check11 = {1, 2, 3, 2, 4, 5};
-        std::list<int> l5{1, 1, 2, 3, 3, 2, 2, 4, 5, 5};
-
-        l5.unique();
-        test_eq(
-            "unique",
-            check11.begin(), check11.end(),
-            l5.begin(), l5.end()
-        );
-        test_eq("unique size", l5.size(), 6U);
-
-        auto check12 = {1, 3, 3, 5, 7, 9, 9};
-        std::list<int> l6{1, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 9};
-
-        l6.unique([](auto lhs, auto rhs){ return lhs == rhs + 1; });
-        test_eq(
-            "unique predicate",
-            check12.begin(), check12.end(),
-            l6.begin(), l6.end()
-        );
-        test_eq("unique predicate size", l6.size(), 7U);
-    }
-}
-
Index: pace/lib/cpp/src/__bits/test/map.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/map.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,434 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <map>
-#include <string>
-#include <sstream>
-#include <utility>
-
-namespace std::test
-{
-    bool map_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_histogram();
-        test_emplace_insert();
-        test_bounds_and_ranges();
-        test_multi();
-        test_reverse_iterators();
-        test_multi_bounds_and_ranges();
-
-        return end();
-    }
-
-    const char* map_test::name()
-    {
-        return "map";
-    }
-
-    void map_test::test_constructors_and_assignment()
-    {
-        auto check1 = {
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{4, 4},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{7, 7}
-        };
-        auto src1 = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::map<int, int> m1{src1};
-        test_eq(
-            "initializer list initialization",
-            check1.begin(), check1.end(),
-            m1.begin(), m1.end()
-        );
-        test_eq("size", m1.size(), 7U);
-
-        std::map<int, int> m2{src1.begin(), src1.end()};
-        test_eq(
-            "iterator range initialization",
-            check1.begin(), check1.end(),
-            m2.begin(), m2.end()
-        );
-
-        std::map<int, int> m3{m1};
-        test_eq(
-            "copy initialization",
-            check1.begin(), check1.end(),
-            m3.begin(), m3.end()
-        );
-
-        std::map<int, int> m4{std::move(m1)};
-        test_eq(
-            "move initialization",
-            check1.begin(), check1.end(),
-            m4.begin(), m4.end()
-        );
-        test_eq("move initialization - origin empty", m1.size(), 0U);
-        test_eq("empty", m1.empty(), true);
-
-        m1 = m4;
-        test_eq(
-            "copy assignment",
-            check1.begin(), check1.end(),
-            m1.begin(), m1.end()
-        );
-
-        m4 = std::move(m1);
-        test_eq(
-            "move assignment",
-            check1.begin(), check1.end(),
-            m4.begin(), m4.end()
-        );
-        test_eq("move assignment - origin empty", m1.size(), 0U);
-
-        m1 = src1;
-        test_eq(
-            "initializer list assignment",
-            check1.begin(), check1.end(),
-            m1.begin(), m1.end()
-        );
-    }
-
-    void map_test::test_histogram()
-    {
-        std::string str{"a b a a c d b e a b b e d c a e"};
-        std::map<std::string, std::size_t> map{};
-        std::istringstream iss{str};
-        std::string word{};
-
-        while (iss >> word)
-            ++map[word];
-
-        test_eq("histogram pt1", map["a"], 5U);
-        test_eq("histogram pt2", map["b"], 4U);
-        test_eq("histogram pt3", map["c"], 2U);
-        test_eq("histogram pt4", map["d"], 2U);
-        test_eq("histogram pt5", map["e"], 3U);
-        test_eq("histogram pt6", map["f"], 0U);
-        test_eq("at", map.at("a"), 5U);
-    }
-
-    void map_test::test_emplace_insert()
-    {
-        std::map<int, int> map1{};
-
-        auto res1 = map1.emplace(1, 2);
-        test_eq("first emplace succession", res1.second, true);
-        test_eq("first emplace equivalence pt1", res1.first->first, 1);
-        test_eq("first emplace equivalence pt2", res1.first->second, 2);
-
-        auto res2 = map1.emplace(1, 3);
-        test_eq("second emplace failure", res2.second, false);
-        test_eq("second emplace equivalence pt1", res2.first->first, 1);
-        test_eq("second emplace equivalence pt2", res2.first->second, 2);
-
-        auto res3 = map1.emplace_hint(map1.begin(), 2, 4);
-        test_eq("first emplace_hint succession", (res3 != map1.end()), true);
-        test_eq("first emplace_hint equivalence pt1", res3->first, 2);
-        test_eq("first emplace_hint equivalence pt2", res3->second, 4);
-
-        auto res4 = map1.emplace_hint(map1.begin(), 2, 5);
-        test_eq("second emplace_hint failure", (res4 != map1.end()), true);
-        test_eq("second emplace_hint equivalence pt1", res4->first, 2);
-        test_eq("second emplace_hint equivalence pt2", res4->second, 4);
-
-        std::map<int, std::string> map2{};
-        auto res5 = map2.insert(std::pair<const int, const char*>{5, "A"});
-        test_eq("conversion insert succession", res5.second, true);
-        test_eq("conversion insert equivalence pt1", res5.first->first, 5);
-        test_eq("conversion insert equivalence pt2", res5.first->second, std::string{"A"});
-
-        auto res6 = map2.insert(std::pair<const int, std::string>{6, "B"});
-        test_eq("first insert succession", res6.second, true);
-        test_eq("first insert equivalence pt1", res6.first->first, 6);
-        test_eq("first insert equivalence pt2", res6.first->second, std::string{"B"});
-
-        auto res7 = map2.insert(std::pair<const int, std::string>{6, "C"});
-        test_eq("second insert failure", res7.second, false);
-        test_eq("second insert equivalence pt1", res7.first->first, 6);
-        test_eq("second insert equivalence pt2", res7.first->second, std::string{"B"});
-
-        auto res8 = map2.insert_or_assign(6, std::string{"D"});
-        test_eq("insert_or_*assign* result", res8.second, false);
-        test_eq("insert_or_*assign* equivalence pt1", res8.first->first, 6);
-        test_eq("insert_or_*assign* equivalence pt2", res8.first->second, std::string{"D"});
-
-        auto res9 = map2.insert_or_assign(7, std::string{"E"});
-        test_eq("*insert*_or_assign result", res9.second, true);
-        test_eq("*insert*_or_assign equivalence pt1", res9.first->first, 7);
-        test_eq("*insert*_or_assign equivalence pt2", res9.first->second, std::string{"E"});
-
-        auto res10 = map2.erase(map2.find(7));
-        test_eq("erase", map2.find(7), map2.end());
-        test_eq("highest erased", res10, map2.end());
-
-        auto res11 = map2.erase(6);
-        test_eq("erase by key pt1", res11, 1U);
-        auto res12 = map2.erase(6);
-        test_eq("erase by key pt2", res12, 0U);
-
-        std::map<int, int> map3{};
-        map3[1] = 1;
-        auto res13 = map3.erase(1);
-        test_eq("erase root by key pt1", res13, 1U);
-        test_eq("erase root by key pt2", map3.empty(), true);
-
-        map3[2] = 2;
-        auto res14 = map3.erase(map3.begin());
-        test_eq("erase root by iterator pt1", res14, map3.end());
-        test_eq("erase root by iterator pt2", map3.empty(), true);
-
-        map2.clear();
-        test_eq("clear", map2.empty(), true);
-
-        map3[1] = 1;
-        auto res15 = map3.count(1);
-        test_eq("count", res15, 1U);
-    }
-
-    void map_test::test_bounds_and_ranges()
-    {
-        std::map<int, int> map{};
-        for (int i = 0; i < 10; ++i)
-            map[i] = i;
-        for (int i = 15; i < 20; ++i)
-            map[i] = i;
-
-        auto res1 = map.lower_bound(5);
-        test_eq("lower_bound of present key", res1->first, 5);
-
-        auto res2 = map.lower_bound(13);
-        test_eq("lower_bound of absent key", res2->first, 9);
-
-        auto res3 = map.upper_bound(7);
-        test_eq("upper_bound of present key", res3->first, 8);
-
-        auto res4 = map.upper_bound(12);
-        test_eq("upper_bound of absent key", res4->first, 15);
-
-        auto res5 = map.equal_range(4);
-        test_eq("equal_range of present key pt1", res5.first->first, 4);
-        test_eq("equal_range of present key pt2", res5.second->first, 5);
-
-        auto res6 = map.equal_range(14);
-        test_eq("equal_range of absent key pt1", res6.first->first, 9);
-        test_eq("equal_range of absent key pt2", res6.second->first, 15);
-    }
-
-    void map_test::test_multi()
-    {
-        auto check1 = {
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{4, 4},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{7, 7}
-        };
-        auto src1 = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::multimap<int, int> mmap{src1};
-        test_eq(
-            "multi construction",
-            check1.begin(), check1.end(),
-            mmap.begin(), mmap.end()
-        );
-
-        auto res1 = mmap.count(6);
-        test_eq("multi count", res1, 3U);
-
-        auto res2 = mmap.emplace(7, 2);
-        test_eq("multi duplicit emplace pt1", res2->first, 7);
-        test_eq("multi duplicit emplace pt2", res2->second, 2);
-        test_eq("multi duplicit emplace pt3", mmap.count(7), 2U);
-
-        auto res3 = mmap.emplace(8, 5);
-        test_eq("multi unique emplace pt1", res3->first, 8);
-        test_eq("multi unique emplace pt2", res3->second, 5);
-        test_eq("multi unique emplace pt3", mmap.count(8), 1U);
-
-        auto res4 = mmap.insert(std::pair<const int, int>{8, 6});
-        test_eq("multi duplicit insert pt1", res4->first, 8);
-        test_eq("multi duplicit insert pt2", res4->second, 6);
-        test_eq("multi duplicit insert pt3", mmap.count(8), 2U);
-
-        auto res5 = mmap.insert(std::pair<const int, int>{9, 8});
-        test_eq("multi unique insert pt1", res5->first, 9);
-        test_eq("multi unique insert pt2", res5->second, 8);
-        test_eq("multi unique insert pt3", mmap.count(9), 1U);
-
-        auto res6 = mmap.erase(8);
-        test_eq("multi erase by key pt1", res6, 2U);
-        test_eq("multi erase by key pt2", mmap.count(8), 0U);
-
-        auto res7 = mmap.erase(mmap.find(7));
-        test_eq("multi erase by iterator pt1", res7->first, 7);
-        test_eq("multi erase by iterator pt2", mmap.count(7), 1U);
-    }
-
-    void map_test::test_reverse_iterators()
-    {
-        auto check1 = {
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{4, 4},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{1, 1}
-        };
-        auto src1 = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::multimap<int, int> mmap{src1};
-        test_eq(
-            "multi reverse iterators",
-            check1.begin(), check1.end(),
-            mmap.rbegin(), mmap.rend()
-        );
-
-        auto check2 = {
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{4, 4},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{1, 1}
-        };
-        auto src2 = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::map<int, int> map{src2};
-        test_eq(
-            "reverse iterators",
-            check2.begin(), check2.end(),
-            map.rbegin(), map.rend()
-        );
-    }
-
-    void map_test::test_multi_bounds_and_ranges()
-    {
-        auto check1 = {
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{1, 2}
-        };
-        auto check2 = {
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{5, 6},
-            std::pair<const int, int>{5, 7}
-        };
-        auto check3 = {
-            std::pair<const int, int>{6, 6}
-        };
-        auto src = {
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{1, 2},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{5, 6},
-            std::pair<const int, int>{5, 7},
-            std::pair<const int, int>{6, 6}
-        };
-
-        std::multimap<int, int> mmap{src};
-        auto res1 = mmap.equal_range(1);
-        test_eq(
-            "multi equal_range at the start",
-            check1.begin(), check1.end(),
-            res1.first, res1.second
-        );
-
-        auto res2 = mmap.equal_range(5);
-        test_eq(
-            "multi equal_range in the middle",
-            check2.begin(), check2.end(),
-            res2.first, res2.second
-        );
-
-        auto res3 = mmap.equal_range(6);
-        test_eq(
-            "multi equal_range at the end + single element range",
-            check3.begin(), check3.end(),
-            res3.first, res3.second
-        );
-    }
-}
Index: pace/lib/cpp/src/__bits/test/memory.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/memory.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,362 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/mock.hpp>
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <memory>
-#include <type_traits>
-#include <utility>
-
-namespace std::test
-{
-    namespace aux
-    {
-        struct dummy_pointer1
-        {
-            using element_type    = int;
-            using difference_type = bool;
-
-            template<class U>
-            using rebind = unsigned;
-
-            int tag{};
-
-            static dummy_pointer1 pointer_to(element_type& x)
-            {
-                dummy_pointer1 res;
-                res.tag = x;
-                return res;
-            }
-        };
-
-        template<class T, class... Args>
-        struct dummy_pointer2
-        {
-            using element_type    = signed char;
-            using difference_type = unsigned char;
-        };
-
-        struct dummy_allocator1
-        {
-            using value_type = int;
-        };
-
-        struct dummy_allocator2
-        {
-            using value_type         = int;
-            using pointer            = char*;
-            using const_pointer      = const void*;
-            using void_pointer       = bool*;
-            using const_void_pointer = volatile bool*;
-            using difference_type    = short;
-            using size_type          = long;
-
-            using propagate_on_container_copy_assignment = std::true_type;
-            using propagate_on_container_move_assignment = std::true_type;
-            using propagate_on_container_swap            = std::true_type;
-            using is_always_equal                        = std::true_type;
-        };
-    }
-
-    bool memory_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_unique_ptr();
-        test_shared_ptr();
-        test_weak_ptr();
-        test_allocators();
-        test_pointers();
-
-        return end();
-    }
-
-    const char* memory_test::name()
-    {
-        return "memory";
-    }
-
-    void memory_test::test_unique_ptr()
-    {
-        mock::clear();
-        {
-            auto ptr = std::make_unique<mock>();
-            test_eq("unique_ptr get() when non-null", (ptr.get() != nullptr), true);
-            test_eq("unique_ptr operator bool when non-null", (bool)ptr, true);
-        }
-        test_eq("unique_ptr make_unique", mock::constructor_calls, 1U);
-        test_eq("unique_ptr out of scope", mock::destructor_calls, 1U);
-
-        mock::clear();
-        {
-            auto ptr = std::make_unique<mock>();
-            delete ptr.release();
-        }
-        test_eq("unique_ptr release", mock::destructor_calls, 1U);
-
-        mock::clear();
-        {
-            auto ptr = std::make_unique<mock>();
-            ptr.reset(new mock{});
-        }
-        test_eq("unique_ptr reset", mock::destructor_calls, 2U);
-
-        mock::clear();
-        {
-            std::unique_ptr<mock> ptr1{};
-            test_eq("unique_ptr get() when null", ptr1.get(), nullptr);
-            test_eq("unique_ptr operator bool when null", (bool)ptr1, false);
-            {
-                auto ptr2 = std::make_unique<mock>();
-                ptr1 = std::move(ptr2);
-            }
-            test_eq("unique_ptr move pt1", mock::destructor_calls, 0U);
-        }
-        test_eq("unique_ptr move pt2", mock::destructor_calls, 1U);
-
-        mock::clear();
-        {
-            auto ptr = std::make_unique<mock[]>(10U);
-            test_eq("unique_ptr make_unique array version", mock::constructor_calls, 10U);
-
-            new(&ptr[5]) mock{};
-            test_eq("placement new into the array", mock::constructor_calls, 11U);
-            test_eq("original not destroyed during placement new", mock::destructor_calls, 0U);
-        }
-        test_eq("unique_ptr array out of scope", mock::destructor_calls, 10U);
-    }
-
-    void memory_test::test_shared_ptr()
-    {
-        mock::clear();
-        {
-            auto ptr1 = std::make_shared<mock>();
-            test_eq("shared_ptr make_shared", mock::constructor_calls, 1U);
-            test_eq("shared_ptr unique", ptr1.unique(), true);
-            {
-                auto ptr2 = ptr1;
-                test_eq("shared_ptr copy pt1", ptr1.use_count(), 2L);
-                test_eq("shared_ptr copy pt2", ptr2.use_count(), 2L);
-                test_eq("shared_ptr copy no constructor call", mock::copy_constructor_calls, 0U);
-                test_eq("shared_ptr not unique", ptr1.unique(), false);
-
-                auto ptr3 = std::move(ptr2);
-                test_eq("shared_ptr move pt1", ptr1.use_count(), 2L);
-                test_eq("shared_ptr move pt2", ptr3.use_count(), 2L);
-                test_eq("shared_ptr move pt3", ptr2.use_count(), 0L);
-
-                test_eq("shared_ptr move origin empty", (bool)ptr2, false);
-            }
-            test_eq("shared_ptr copy out of scope", mock::destructor_calls, 0U);
-        }
-        test_eq("shared_ptr original out of scope", mock::destructor_calls, 1U);
-    }
-
-    void memory_test::test_weak_ptr()
-    {
-        mock::clear();
-        {
-            std::weak_ptr<mock> wptr1{};
-            {
-                auto ptr1 = std::make_shared<mock>();
-                wptr1 = ptr1;
-                {
-                    std::weak_ptr<mock> wptr2 = ptr1;
-                    test_eq("weak_ptr shares use count", wptr2.use_count(), 1L);
-                    test_eq("weak_ptr not expired", wptr2.expired(), false);
-
-                    auto ptr2 = wptr2.lock();
-                    test_eq("locked ptr increases use count", ptr1.use_count(), 2L);
-                }
-            }
-            test_eq("weak_ptr expired after all shared_ptrs die", wptr1.expired(), true);
-            test_eq("shared object destroyed while weak_ptr exists", mock::destructor_calls, 1U);
-        }
-    }
-
-    void memory_test::test_allocators()
-    {
-        using dummy_traits1 = std::allocator_traits<aux::dummy_allocator1>;
-        using dummy_traits2 = std::allocator_traits<aux::dummy_allocator2>;
-
-        /**
-         * First dummy allocator doesn't provide
-         * anything except for the mandatory value_type,
-         * so we get all the defaults here.
-         */
-        test(
-            "allocator traits default for pointer",
-            std::is_same_v<typename dummy_traits1::pointer, int*>
-        );
-        test(
-            "allocator traits default for const_pointer",
-            std::is_same_v<typename dummy_traits1::const_pointer, const int*>
-        );
-        test(
-            "allocator traits default for void_pointer",
-            std::is_same_v<typename dummy_traits1::void_pointer, void*>
-        );
-        test(
-            "allocator traits default for const_void_pointer",
-            std::is_same_v<typename dummy_traits1::const_void_pointer, const void*>
-        );
-        test(
-            "allocator traits default for difference_type",
-            std::is_same_v<typename dummy_traits1::difference_type, ptrdiff_t>
-        );
-        test(
-            "allocator traits default for size_type",
-            std::is_same_v<typename dummy_traits1::size_type, std::make_unsigned_t<ptrdiff_t>>
-        );
-        test(
-            "allocator traits default for copy propagate",
-            std::is_same_v<typename dummy_traits1::propagate_on_container_copy_assignment, std::false_type>
-        );
-        test(
-            "allocator traits default for move propagate",
-            std::is_same_v<typename dummy_traits1::propagate_on_container_move_assignment, std::false_type>
-        );
-        test(
-            "allocator traits default for swap propagate",
-            std::is_same_v<typename dummy_traits1::propagate_on_container_swap, std::false_type>
-        );
-        test(
-            "allocator traits default for is_always_equal",
-            std::is_same_v<typename dummy_traits1::is_always_equal, typename std::is_empty<aux::dummy_allocator1>::type>
-        );
-
-        /**
-         * Second dummy allocator provides all typedefs, so
-         * the the traits just use identity.
-         */
-        test(
-            "allocator traits given pointer",
-            std::is_same_v<typename dummy_traits2::pointer, char*>
-        );
-        test(
-            "allocator traits given const_pointer",
-            std::is_same_v<typename dummy_traits2::const_pointer, const void*>
-        );
-        test(
-            "allocator traits given void_pointer",
-            std::is_same_v<typename dummy_traits2::void_pointer, bool*>
-        );
-        test(
-            "allocator traits given const_void_pointer",
-            std::is_same_v<typename dummy_traits2::const_void_pointer, volatile bool*>
-        );
-        test(
-            "allocator traits given difference_type",
-            std::is_same_v<typename dummy_traits2::difference_type, short>
-        );
-        test(
-            "allocator traits given size_type",
-            std::is_same_v<typename dummy_traits2::size_type, long>
-        );
-        test(
-            "allocator traits given copy propagate",
-            std::is_same_v<typename dummy_traits2::propagate_on_container_copy_assignment, std::true_type>
-        );
-        test(
-            "allocator traits given move propagate",
-            std::is_same_v<typename dummy_traits2::propagate_on_container_move_assignment, std::true_type>
-        );
-        test(
-            "allocator traits given swap propagate",
-            std::is_same_v<typename dummy_traits2::propagate_on_container_swap, std::true_type>
-        );
-        test(
-            "allocator traits given is_always_equal",
-            std::is_same_v<typename dummy_traits2::is_always_equal, std::true_type>
-        );
-    }
-
-    void memory_test::test_pointers()
-    {
-        using dummy_traits1 = std::pointer_traits<aux::dummy_pointer1>;
-        using dummy_traits2 = std::pointer_traits<aux::dummy_pointer2<int, char>>;
-        using int_traits    = std::pointer_traits<int*>;
-
-        test(
-            "pointer traits pointer pt1",
-            std::is_same_v<typename dummy_traits1::pointer, aux::dummy_pointer1>
-        );
-        test(
-            "pointer traits element_type pt1",
-            std::is_same_v<typename dummy_traits1::element_type, int>
-        );
-        test(
-            "pointer traits difference_type pt1",
-            std::is_same_v<typename dummy_traits1::difference_type, bool>
-        );
-        test(
-            "pointer traits rebind pt1",
-            std::is_same_v<typename dummy_traits1::template rebind<long>, unsigned>
-        );
-
-        test(
-            "pointer traits pointer pt2",
-            std::is_same_v<typename dummy_traits2::pointer, aux::dummy_pointer2<int, char>>
-        );
-        test(
-            "pointer traits element_type pt2",
-            std::is_same_v<typename dummy_traits2::element_type, signed char>
-        );
-        test(
-            "pointer traits difference_type pt2",
-            std::is_same_v<typename dummy_traits2::difference_type, unsigned char>
-        );
-        test(
-            "pointer traits rebind pt2",
-            std::is_same_v<typename dummy_traits2::template rebind<long>, aux::dummy_pointer2<long, char>>
-        );
-
-        test(
-            "pointer traits pointer pt3",
-            std::is_same_v<typename int_traits::pointer, int*>
-        );
-        test(
-            "pointer traits element_type pt3",
-            std::is_same_v<typename int_traits::element_type, int>
-        );
-        test(
-            "pointer traits difference_type pt3",
-            std::is_same_v<typename int_traits::difference_type, ptrdiff_t>
-        );
-        test(
-            "pointer traits rebind pt3",
-            std::is_same_v<typename int_traits::rebind<char>, char*>
-        );
-
-        int x{10};
-        test_eq("pointer_traits<Ptr>::pointer_to", dummy_traits1::pointer_to(x).tag, 10);
-        test_eq("pointer_traits<T*>::pointer_to", int_traits::pointer_to(x), &x);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/mock.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/mock.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/mock.hpp>
-
-namespace std::test
-{
-    size_t mock::constructor_calls{};
-    size_t mock::copy_constructor_calls{};
-    size_t mock::destructor_calls{};
-    size_t mock::move_constructor_calls{};
-}
Index: pace/lib/cpp/src/__bits/test/numeric.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/numeric.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <array>
-#include <complex>
-#include <initializer_list>
-#include <numeric>
-#include <utility>
-
-using namespace std::literals;
-using namespace complex_literals;
-
-namespace std::test
-{
-    bool numeric_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_algorithms();
-        test_complex();
-
-        return end();
-    }
-
-    const char* numeric_test::name()
-    {
-        return "numeric";
-    }
-
-    void numeric_test::test_algorithms()
-    {
-        auto data1 = {1, 2, 3, 4, 5};
-
-        auto res1 = std::accumulate(data1.begin(), data1.end(), 5);
-        test_eq("accumulate pt1", res1, 20);
-
-        auto res2 = std::accumulate(
-            data1.begin(), data1.end(), 2,
-            [](const auto& lhs, const auto& rhs){
-                return lhs * rhs;
-            }
-        );
-        test_eq("accumulate pt2", res2, 240);
-
-        auto res3 = std::accumulate(data1.begin(), data1.begin(), 10);
-        test_eq("accumulate pt3", res3, 10);
-
-        auto data2 = {3, 5, 2, 8, 7};
-        auto data3 = {4, 6, 1, 0, 5};
-
-        auto res4 = std::inner_product(
-            data2.begin(), data2.end(), data3.begin(), 0
-        );
-        test_eq("inner_product pt1", res4, 79);
-
-        auto res5 = std::inner_product(
-            data2.begin(), data2.end(), data3.begin(), 10,
-            [](const auto& lhs, const auto& rhs){
-                return lhs + rhs;
-            },
-            [](const auto& lhs, const auto& rhs){
-                return 2 * (lhs + rhs);
-            }
-        );
-        test_eq("inner_product pt2", res5, 92);
-
-        auto data4 = {1, 3, 2, 4, 5};
-        auto check1 = {1, 4, 6, 10, 15};
-        std::array<int, 5> result{};
-
-        auto res6 = std::partial_sum(
-            data4.begin(), data4.end(), result.begin()
-        );
-        test_eq(
-            "partial sum pt1",
-            check1.begin(), check1.end(),
-            result.begin(), result.end()
-        );
-        test_eq("partial sum pt2", res6, result.end());
-
-        auto check2 = {1, 3, 6, 24, 120};
-        auto res7 = std::partial_sum(
-            data4.begin(), data4.end(), result.begin(),
-            [](const auto& lhs, const auto& rhs){
-                return lhs * rhs;
-            }
-        );
-        test_eq(
-            "partial sum pt3",
-            check2.begin(), check2.end(),
-            result.begin(), result.end()
-        );
-        test_eq("partial sum pt4", res7, result.end());
-
-        auto check3 = {1, 2, -1, 2, 1};
-        auto res8 = std::adjacent_difference(
-            data4.begin(), data4.end(), result.begin()
-        );
-        test_eq(
-            "adjacent_difference pt1",
-            check3.begin(), check3.end(),
-            result.begin(), result.end()
-        );
-        test_eq("adjacent_difference pt2", res8, result.end());
-
-        auto check4 = {1, 3, 6, 8, 20};
-        auto res9 = std::adjacent_difference(
-            data4.begin(), data4.end(), result.begin(),
-            [](const auto& lhs, const auto& rhs){
-                return lhs * rhs;
-            }
-        );
-        test_eq(
-            "adjacent_difference pt3",
-            check4.begin(), check4.end(),
-            result.begin(), result.end()
-        );
-        test_eq("adjacent_difference pt4", res9, result.end());
-
-        auto check5 = {4, 5, 6, 7, 8};
-        std::iota(result.begin(), result.end(), 4);
-        test_eq(
-            "iota", check5.begin(), check5.end(),
-            result.begin(), result.end()
-        );
-    }
-
-    void numeric_test::test_complex()
-    {
-        auto c1 = 1.f + 2.5if;
-        test_eq("complex literals pt1", c1.real(), 1.f);
-        test_eq("complex literals pt2", c1.imag(), 2.5f);
-
-        std::complex<double> c2{2.0, 0.5};
-        test_eq("complex value initialization", c2, (2.0 + 0.5i));
-
-        std::complex<double> c3{c2};
-        test_eq("complex copy initialization", c3, (2.0 + 0.5i));
-
-        std::complex<double> c4{c1};
-        test_eq("complex conversion initialization", c4, (1.0 + 2.5i));
-
-        test_eq("complex sum", ((1.0 + 2.5i) + (3.0 + 0.5i)), (4.0 + 3.0i));
-        test_eq("complex sub", ((2.0 + 3.0i) - (1.0 + 5.0i)), (1.0 - 2.0i));
-        test_eq("complex mul", ((2.0 + 2.0i) * (2.0 + 3.0i)), (-2.0 + 10.0i));
-        test_eq("complex div", ((2.0 - 1.0i) / (3.0 + 4.0i)), (0.08 - 0.44i));
-        test_eq("complex unary minus", -(1.0 + 1.0i), (-1.0 - 1.0i));
-        test_eq("complex abs", std::abs(2.0 - 4.0i), 20.0);
-        test_eq("complex real", std::real(2.0 + 3.0i), 2.0);
-        test_eq("complex imag", std::imag(2.0 + 3.0i), 3.0);
-    }
-}
-
Index: pace/lib/cpp/src/__bits/test/ratio.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/ratio.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <ratio>
-#include <utility>
-
-namespace std::test
-{
-    bool ratio_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_eq(
-            "ratio_add pt1",
-            std::ratio_add<std::ratio<2, 3>, std::ratio<1, 6>>::num,
-            5
-        );
-        test_eq(
-            "ratio_add pt2",
-            std::ratio_add<std::ratio<2, 3>, std::ratio<1, 6>>::den,
-            6
-        );
-
-        test_eq(
-            "ratio_subtract pt1",
-            std::ratio_subtract<std::ratio<2, 3>, std::ratio<1, 6>>::num,
-            1
-        );
-        test_eq(
-            "ratio_subtract pt2",
-            std::ratio_subtract<std::ratio<2, 3>, std::ratio<1, 6>>::den,
-            2
-        );
-
-        test_eq(
-            "ratio_multiply pt1",
-            std::ratio_multiply<std::ratio<2, 3>, std::ratio<1, 6>>::num,
-            1
-        );
-        test_eq(
-            "ratio_multiply pt2",
-            std::ratio_multiply<std::ratio<2, 3>, std::ratio<1, 6>>::den,
-            9
-        );
-
-        test_eq(
-            "ratio_divide pt1",
-            std::ratio_divide<std::ratio<2, 3>, std::ratio<1, 6>>::num,
-            4
-        );
-        test_eq(
-            "ratio_divide pt2",
-            std::ratio_divide<std::ratio<2, 3>, std::ratio<1, 6>>::den,
-            1
-        );
-
-        test_eq(
-            "ratio_equal", std::ratio_equal_v<std::ratio<2, 3>, std::ratio<6, 9>>, true
-        );
-
-        test_eq(
-            "ratio_not_equal", std::ratio_not_equal_v<std::ratio<2, 3>, std::ratio<5, 9>>, true
-        );
-
-        test_eq(
-            "ratio_less", std::ratio_less_v<std::ratio<2, 3>, std::ratio<5, 6>>, true
-        );
-
-        test_eq(
-            "ratio_less_equal pt1", std::ratio_less_equal_v<std::ratio<2, 3>, std::ratio<5, 6>>, true
-        );
-
-        test_eq(
-            "ratio_less_equal pt2", std::ratio_less_equal_v<std::ratio<2, 3>, std::ratio<2, 3>>, true
-        );
-
-        test_eq(
-            "ratio_greater", std::ratio_greater_v<std::ratio<2, 3>, std::ratio<2, 6>>, true
-        );
-
-        test_eq(
-            "ratio_greater_equal pt1", std::ratio_greater_equal_v<std::ratio<2, 3>, std::ratio<2, 6>>, true
-        );
-
-        test_eq(
-            "ratio_greater_equal pt2", std::ratio_greater_equal_v<std::ratio<2, 3>, std::ratio<2, 3>>, true
-        );
-
-        return end();
-    }
-
-    const char* ratio_test::name()
-    {
-        return "ratio";
-    }
-}
Index: pace/lib/cpp/src/__bits/test/set.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/set.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <set>
-#include <string>
-#include <utility>
-
-namespace std::test
-{
-    bool set_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_emplace_insert();
-        test_bounds_and_ranges();
-        test_multi();
-        test_reverse_iterators();
-        test_multi_bounds_and_ranges();
-
-        return end();
-    }
-
-    const char* set_test::name()
-    {
-        return "set";
-    }
-
-    void set_test::test_constructors_and_assignment()
-    {
-        auto check1 = {1, 2, 3, 4, 5, 6, 7};
-        auto src1 = {3, 1, 5, 2, 7, 6, 4};
-
-        std::set<int> s1{src1};
-        test_eq(
-            "initializer list initialization",
-            check1.begin(), check1.end(),
-            s1.begin(), s1.end()
-        );
-        test_eq("size", s1.size(), 7U);
-
-        std::set<int> s2{src1.begin(), src1.end()};
-        test_eq(
-            "iterator range initialization",
-            check1.begin(), check1.end(),
-            s2.begin(), s2.end()
-        );
-
-        std::set<int> s3{s1};
-        test_eq(
-            "copy initialization",
-            check1.begin(), check1.end(),
-            s3.begin(), s3.end()
-        );
-
-        std::set<int> s4{std::move(s1)};
-        test_eq(
-            "move initialization",
-            check1.begin(), check1.end(),
-            s4.begin(), s4.end()
-        );
-        test_eq("move initialization - origin empty", s1.size(), 0U);
-        test_eq("empty", s1.empty(), true);
-
-        s1 = s4;
-        test_eq(
-            "copy assignment",
-            check1.begin(), check1.end(),
-            s1.begin(), s1.end()
-        );
-
-        s4 = std::move(s1);
-        test_eq(
-            "move assignment",
-            check1.begin(), check1.end(),
-            s4.begin(), s4.end()
-        );
-        test_eq("move assignment - origin empty", s1.size(), 0U);
-
-        s1 = src1;
-        test_eq(
-            "initializer list assignment",
-            check1.begin(), check1.end(),
-            s1.begin(), s1.end()
-        );
-    }
-
-    void set_test::test_emplace_insert()
-    {
-        std::set<int> set1{};
-
-        auto res1 = set1.emplace(1);
-        test_eq("first emplace succession", res1.second, true);
-        test_eq("first emplace equivalence", *res1.first, 1);
-
-        auto res2 = set1.emplace(1);
-        test_eq("second emplace failure", res2.second, false);
-        test_eq("second emplace equivalence", *res2.first, 1);
-
-        auto res3 = set1.emplace_hint(set1.begin(), 2);
-        test_eq("first emplace_hint succession", (res3 != set1.end()), true);
-        test_eq("first emplace_hint equivalence", *res3, 2);
-
-        auto res4 = set1.emplace_hint(set1.begin(), 2);
-        test_eq("second emplace_hint failure", (res4 != set1.end()), true);
-        test_eq("second emplace_hint equivalence", *res4, 2);
-
-        std::set<std::string> set2{};
-        auto res5 = set2.insert("A");
-        test_eq("conversion insert succession", res5.second, true);
-        test_eq("conversion insert equivalence", *res5.first, std::string{"A"});
-
-        auto res6 = set2.insert(std::string{"B"});
-        test_eq("first insert succession", res6.second, true);
-        test_eq("first insert equivalence", *res6.first, std::string{"B"});
-
-        auto res7 = set2.insert(std::string{"B"});
-        test_eq("second insert failure", res7.second, false);
-        test_eq("second insert equivalence", *res7.first, std::string{"B"});
-
-        auto res10 = set1.erase(set1.find(2));
-        test_eq("erase", set1.find(2), set1.end());
-        test_eq("highest erased", res10, set1.end());
-
-        set2.insert(std::string{"G"});
-        set2.insert(std::string{"H"});
-        set2.insert(std::string{"K"});
-        auto res11 = set2.erase(std::string{"G"});
-        test_eq("erase by key pt1", res11, 1U);
-        auto res12 = set2.erase(std::string{"M"});
-        test_eq("erase by key pt2", res12, 0U);
-
-        std::set<int> set3{};
-        set3.insert(1);
-        auto res13 = set3.erase(1);
-        test_eq("erase root by key pt1", res13, 1U);
-        test_eq("erase root by key pt2", set3.empty(), true);
-
-        set3.insert(3);
-        auto res14 = set3.erase(set3.begin());
-        test_eq("erase root by iterator pt1", res14, set3.end());
-        test_eq("erase root by iterator pt2", set3.empty(), true);
-
-        set2.clear();
-        test_eq("clear", set2.empty(), true);
-
-        set3.insert(1);
-        auto res15 = set3.count(1);
-        test_eq("count", res15, 1U);
-    }
-
-    void set_test::test_bounds_and_ranges()
-    {
-        std::set<int> set{};
-        for (int i = 0; i < 10; ++i)
-            set.insert(i);
-        for (int i = 15; i < 20; ++i)
-            set.insert(i);
-
-        auto res1 = set.lower_bound(5);
-        test_eq("lower_bound of present key", *res1, 5);
-
-        auto res2 = set.lower_bound(13);
-        test_eq("lower_bound of absent key", *res2, 9);
-
-        auto res3 = set.upper_bound(7);
-        test_eq("upper_bound of present key", *res3, 8);
-
-        auto res4 = set.upper_bound(12);
-        test_eq("upper_bound of absent key", *res4, 15);
-
-        auto res5 = set.equal_range(4);
-        test_eq("equal_range of present key pt1", *res5.first, 4);
-        test_eq("equal_range of present key pt2", *res5.second, 5);
-
-        auto res6 = set.equal_range(14);
-        test_eq("equal_range of absent key pt1", *res6.first, 9);
-        test_eq("equal_range of absent key pt2", *res6.second, 15);
-    }
-
-    void set_test::test_multi()
-    {
-        auto check1 = {1, 2, 3, 3, 4, 5, 6, 6, 6, 7};
-        auto src1 = {3, 6, 1, 5, 6, 3, 2, 7, 6, 4};
-
-        std::multiset<int> mset{src1};
-        test_eq(
-            "multi construction",
-            check1.begin(), check1.end(),
-            mset.begin(), mset.end()
-        );
-
-        auto res1 = mset.count(6);
-        test_eq("multi count", res1, 3U);
-
-        auto res2 = mset.emplace(7);
-        test_eq("multi duplicit emplace pt1", *res2, 7);
-        test_eq("multi duplicit emplace pt2", mset.count(7), 2U);
-
-        auto res3 = mset.emplace(8);
-        test_eq("multi unique emplace pt1", *res3, 8);
-        test_eq("multi unique emplace pt2", mset.count(8), 1U);
-
-        auto res4 = mset.insert(8);
-        test_eq("multi duplicit insert pt1", *res4, 8);
-        test_eq("multi duplicit insert pt2", mset.count(8), 2U);
-
-        auto res5 = mset.insert(9);
-        test_eq("multi unique insert pt1", *res5, 9);
-        test_eq("multi unique insert pt2", mset.count(9), 1U);
-
-        auto res6 = mset.erase(8);
-        test_eq("multi erase by key pt1", res6, 2U);
-        test_eq("multi erase by key pt2", mset.count(8), 0U);
-
-        auto res7 = mset.erase(mset.find(7));
-        test_eq("multi erase by iterator pt1", *res7, 7);
-        test_eq("multi erase by iterator pt2", mset.count(7), 1U);
-    }
-
-    void set_test::test_reverse_iterators()
-    {
-        auto check1 = {7, 6, 6, 6, 5, 4, 3, 3, 2, 1};
-        auto src1 = {3, 6, 1, 5, 6, 3, 2, 7, 6, 4};
-
-        std::multiset<int> mset{src1};
-        test_eq(
-            "multi reverse iterators",
-            check1.begin(), check1.end(),
-            mset.rbegin(), mset.rend()
-        );
-
-        auto check2 = {7, 6, 5, 4, 3, 2, 1};
-        auto src2 = {3, 1, 5, 2, 7, 6, 4};
-
-        std::set<int> set{src2};
-        test_eq(
-            "reverse iterators",
-            check2.begin(), check2.end(),
-            set.rbegin(), set.rend()
-        );
-    }
-
-    void set_test::test_multi_bounds_and_ranges()
-    {
-        auto check1 = {1, 1};
-        auto check2 = {5, 5, 5};
-        auto check3 = {6};
-        auto src = {1, 1, 2, 3, 5, 5, 5, 6};
-
-        std::multiset<int> mset{src};
-        auto res1 = mset.equal_range(1);
-        test_eq(
-            "multi equal_range at the start",
-            check1.begin(), check1.end(),
-            res1.first, res1.second
-        );
-
-        auto res2 = mset.equal_range(5);
-        test_eq(
-            "multi equal_range in the middle",
-            check2.begin(), check2.end(),
-            res2.first, res2.second
-        );
-
-        auto res3 = mset.equal_range(6);
-        test_eq(
-            "multi equal_range at the end + single element range",
-            check3.begin(), check3.end(),
-            res3.first, res3.second
-        );
-    }
-}
Index: pace/lib/cpp/src/__bits/test/string.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/string.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,706 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <initializer_list>
-#include <__bits/test/tests.hpp>
-#include <string>
-#include <cstdio>
-
-namespace std::test
-{
-    bool string_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_construction_and_assignment();
-        test_append();
-        test_insert();
-        test_erase();
-        test_replace();
-        test_copy();
-        test_find();
-        test_substr();
-        test_compare();
-
-        return end();
-    }
-
-    const char* string_test::name()
-    {
-        return "string";
-    }
-
-    void string_test::test_construction_and_assignment()
-    {
-        const char* check1 = "hello";
-
-        std::string str1{"hello"};
-        test_eq(
-            "size of string",
-            str1.size(), 5ul
-        );
-        test_eq(
-            "initialization from a cstring literal",
-            str1.begin(), str1.end(),
-            check1, check1 + 5
-        );
-
-        std::string str2{str1};
-        test_eq(
-            "copy constructor",
-            str1.begin(), str1.end(),
-            str2.begin(), str2.end()
-        );
-
-        std::string str3{std::move(str1)};
-        test_eq(
-            "move constructor equality",
-            str2.begin(), str2.end(),
-            str3.begin(), str3.end()
-        );
-        test_eq(
-            "move constructor source empty",
-            str1.size(), 0ul
-        );
-
-        std::string str4{};
-        test_eq(
-            "default constructor empty",
-            str4.size(), 0ul
-        );
-
-        str4.assign(str3, 2ul, 2ul);
-        test_eq(
-            "assign substring to an empty string",
-            str4.begin(), str4.end(),
-            str3.begin() + 2, str3.begin() + 4
-        );
-
-        std::string str5{str3.begin() + 2, str3.begin() + 4};
-        test_eq(
-            "constructor from a pair of iterators",
-            str5.begin(), str5.end(),
-            str3.begin() + 2, str3.begin() + 4
-        );
-    }
-
-    void string_test::test_append()
-    {
-        std::string check{"hello, world"};
-
-        std::string str1{"hello, "};
-        str1.append("world");
-        test_eq(
-            "append cstring",
-            str1.begin(), str1.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str2{"hello, "};
-        str2.append(std::string{"world"});
-        test_eq(
-            "append rvalue string",
-            str2.begin(), str2.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str3{"hello, "};
-        std::string apendee{"world"};
-        str3.append(apendee);
-        test_eq(
-            "append lvalue string",
-            str3.begin(), str3.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str4{"hello, "};
-        str4.append(apendee.begin(), apendee.end());
-        test_eq(
-            "append iterator range",
-            str4.begin(), str4.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str5{"hello, "};
-        str5.append({'w', 'o', 'r', 'l', 'd'});
-        test_eq(
-            "append initializer list",
-            str5.begin(), str5.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str6{"hello, "};
-        str6 += "world";
-        test_eq(
-            "append using +=",
-            str6.begin(), str6.end(),
-            check.begin(), check.end()
-        );
-    }
-
-    void string_test::test_insert()
-    {
-        std::string check{"hello, world"};
-
-        std::string str1{", world"};
-        str1.insert(0, "hello");
-        test_eq(
-            "insert at the beggining",
-            str1.begin(), str1.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str2{"hello,world"};
-        str2.insert(str2.begin() + 6, ' ');
-        test_eq(
-            "insert char in the middle",
-            str2.begin(), str2.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str3{"heo, world"};
-        str3.insert(str3.begin() + 2, 2ul, 'l');
-        test_eq(
-            "insert n chars",
-            str3.begin(), str3.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str4{"h, world"};
-        std::string insertee{"ello"};
-        str4.insert(str4.begin() + 1, insertee.begin(),
-                    insertee.end());
-        test_eq(
-            "insert iterator range",
-            str4.begin(), str4.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str5{"hel, world"};
-        std::initializer_list<char> init{'l', 'o'};
-        str5.insert(str5.begin() + 3, init);
-        test_eq(
-            "insert initializer list",
-            str5.begin(), str5.end(),
-            check.begin(), check.end()
-        );
-    }
-
-    void string_test::test_erase()
-    {
-        std::string check{"hello"};
-
-        std::string str1{"heXllo"};
-        str1.erase(str1.begin() + 2);
-        test_eq(
-            "erase single char in the middle",
-            str1.begin(), str1.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str2{"Xhello"};
-        str2.erase(str2.begin());
-        test_eq(
-            "erase single char at the beginning",
-            str2.begin(), str2.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str3{"helloX"};
-        str3.erase(str3.begin() + 5);
-        test_eq(
-            "erase single char at the end",
-            str3.begin(), str3.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str4{"XXXhello"};
-        str4.erase(0, 3);
-        test_eq(
-            "erase string at the beginning",
-            str4.begin(), str4.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str5{"heXXXllo"};
-        str5.erase(2, 3);
-        test_eq(
-            "erase string in the middle",
-            str5.begin(), str5.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str6{"helloXXX"};
-        str6.erase(5);
-        test_eq(
-            "erase string at the end",
-            str6.begin(), str6.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str7{"hellXXXo"};
-        str7.erase(str7.begin() + 4, str7.begin() + 7);
-        test_eq(
-            "erase iterator range",
-            str7.begin(), str7.end(),
-            check.begin(), check.end()
-        );
-    }
-
-    void string_test::test_replace()
-    {
-        std::string check{"hello, world"};
-
-        std::string str1{"helXXX world"};
-        str1.replace(3, 3, "lo,", 3);
-        test_eq(
-            "replace with full string",
-            str1.begin(), str1.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str2{"helXXX world"};
-        str2.replace(3, 3, "lo,YYY", 3);
-        test_eq(
-            "replace with prefix of a string",
-            str2.begin(), str2.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str3{"helXXX world"};
-        str3.replace(3, 3, "YYlo,YYY", 2, 3);
-        test_eq(
-            "replace with substring of a string",
-            str3.begin(), str3.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str4{"heXXo, world"};
-        str4.replace(2, 2, 2, 'l');
-        test_eq(
-            "replace with repeated characters",
-            str4.begin(), str4.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str5{"heXXXXo, world"};
-        str5.replace(2, 4, 2, 'l');
-        test_eq(
-            "replace with repeated characters (shrinking)",
-            str5.begin(), str5.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str6{"helXXXXX world"};
-        str6.replace(3, 5, "YYlo,YYY", 2, 3);
-        test_eq(
-            "replace with substring of a string (shrinking)",
-            str6.begin(), str6.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str7{"helXXXXX world"};
-        std::string replacer{"YYlo,YYY"};
-        str7.replace(3, 5, replacer, 2, 3);
-        test_eq(
-            "replace with substring of a string (shrinking, std::string)",
-            str7.begin(), str7.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str8{"helXXXXX world"};
-        str8.replace(str8.begin() + 3, str8.begin() + 8, "lo,");
-        test_eq(
-            "replace with a string (iterators)",
-            str8.begin(), str8.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str9{"heXXXXo, world"};
-        str9.replace(str9.begin() + 2, str9.begin() + 6, 2, 'l');
-        test_eq(
-            "replace with repeated characters (shrinking, iterators)",
-            str9.begin(), str9.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str10{"helXXXXX world"};
-        str10.replace(str10.begin() + 3, str10.begin() + 8,
-                      replacer.begin() + 2, replacer.begin() + 5);
-        test_eq(
-            "replace with substring of a string (shrinking, iterators x2)",
-            str10.begin(), str10.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str11{"helXXXXX world"};
-        str11.replace(str11.begin() + 3, str11.begin() + 8,
-                      {'l', 'o', ','});
-        test_eq(
-            "replace with an initializer list (shrinking, iterators)",
-            str11.begin(), str11.end(),
-            check.begin(), check.end()
-        );
-
-        std::string str12{"helXXX world"};
-        str12.replace(str12.begin() + 3, str12.begin() + 6,
-                      {'l', 'o', ','});
-        test_eq(
-            "replace with an initializer list (iterators)",
-            str12.begin(), str12.end(),
-            check.begin(), check.end()
-        );
-    }
-
-    void string_test::test_copy()
-    {
-        std::string check{"CCABB"};
-
-        std::string str1{"ACCCA"};
-        std::string str2{"BBBBB"};
-
-        str1.copy(const_cast<char*>(str2.c_str()), 3, 2);
-        test_eq(
-            "copy",
-            str2.begin(), str2.end(),
-            check.begin(), check.end()
-        );
-    }
-
-    void string_test::test_find()
-    {
-        std::string target{"ABC"};
-        auto miss = std::string::npos;
-
-        std::string str1{"xxABCxx"};
-
-        auto idx = str1.find(target, 0);
-        test_eq(
-            "find from start (success)",
-            idx, 2ul
-        );
-
-        idx = str1.find(target, 3);
-        test_eq(
-            "find from start (fail, late start)",
-            idx, miss
-        );
-
-        idx = str1.rfind(target, miss);
-        test_eq(
-            "rfind from end (success)",
-            idx, 2ul
-        );
-
-        idx = str1.rfind(target, 1);
-        test_eq(
-            "rfind from start (fail, late start)",
-            idx, miss
-        );
-
-        idx = str1.find('B', 2);
-        test_eq(
-            "find char from middle (success)",
-            idx, 3ul
-        );
-
-        idx = str1.rfind('B', 2);
-        test_eq(
-            "rfind char from middle (success)",
-            idx, 3ul
-        );
-
-        std::string str2{"xxABCxxABCxx"};
-
-        idx = str2.find(target, 0);
-        test_eq(
-            "find from start (success, multiple)",
-            idx, 2ul
-        );
-
-        idx = str2.find(target, 5);
-        test_eq(
-            "find from middle (success, multiple)",
-            idx, 7ul
-        );
-
-        idx = str2.rfind(target, miss);
-        test_eq(
-            "rfind from end (success, multiple)",
-            idx, 7ul
-        );
-
-        idx = str2.rfind(target, 6);
-        test_eq(
-            "rfind from mid (success, multiple)",
-            idx, 2ul
-        );
-
-        std::string str3{"xxBxxAxxCxx"};
-
-        idx = str3.find_first_of(target);
-        test_eq(
-            "find first of from start (success)",
-            idx, 2ul
-        );
-
-        idx = str3.find_first_of(target, 6);
-        test_eq(
-            "find first of from middle (success)",
-            idx, 8ul
-        );
-
-        idx = str3.find_first_of("DEF", 3);
-        test_eq(
-            "find first of from middle (fail, not in string)",
-            idx, miss
-        );
-
-        idx = str3.find_first_of(target, 9);
-        test_eq(
-            "find first of from middle (fail, late start)",
-            idx, miss
-        );
-
-        idx = str3.find_first_of("");
-        test_eq(
-            "find first of from start (fail, no target)",
-            idx, miss
-        );
-
-        idx = str3.find_first_of('A', 1);
-        test_eq(
-            "find first of char (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_first_of('A', 6);
-        test_eq(
-            "find first of char (fail)",
-            idx, miss
-        );
-
-        idx = str3.find_last_of(target);
-        test_eq(
-            "find last of from start (success)",
-            idx, 8ul
-        );
-
-        idx = str3.find_last_of(target, 6);
-        test_eq(
-            "find last of from middle (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_last_of("DEF", 3);
-        test_eq(
-            "find last of from middle (fail, not in string)",
-            idx, miss
-        );
-
-        idx = str3.find_last_of(target, 1);
-        test_eq(
-            "find last of from middle (fail, late start)",
-            idx, miss
-        );
-
-        idx = str3.find_last_of("");
-        test_eq(
-            "find last of from start (fail, no target)",
-            idx, miss
-        );
-
-        idx = str3.find_last_of('A', str3.size() - 1);
-        test_eq(
-            "find last of char (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_last_of('A', 3);
-        test_eq(
-            "find last of char (fail)",
-            idx, miss
-        );
-
-        std::string not_target{"xB"};
-
-        idx = str3.find_first_not_of(not_target);
-        test_eq(
-            "find first not of from start (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_first_not_of(not_target, 6);
-        test_eq(
-            "find first not of from middle (success)",
-            idx, 8ul
-        );
-
-        idx = str3.find_first_not_of("xABC", 3);
-        test_eq(
-            "find first not of from middle (fail, not in string)",
-            idx, miss
-        );
-
-        idx = str3.find_first_not_of(not_target, 9);
-        test_eq(
-            "find first not of from middle (fail, late start)",
-            idx, miss
-        );
-
-        idx = str3.find_first_not_of("");
-        test_eq(
-            "find first not of from start (success, no target)",
-            idx, 0ul
-        );
-
-        idx = str3.find_first_not_of('x', 3);
-        test_eq(
-            "find first not of char (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_first_of('a', 9);
-        test_eq(
-            "find first not of char (fail)",
-            idx, miss
-        );
-
-        std::string not_last_target{"xC"};
-
-        idx = str3.find_last_not_of(not_last_target);
-        test_eq(
-            "find last not of from start (success)",
-            idx, 5ul
-        );
-
-        idx = str3.find_last_not_of(not_last_target, 4);
-        test_eq(
-            "find last not of from middle (success)",
-            idx, 2ul
-        );
-
-        idx = str3.find_last_not_of("xABC");
-        test_eq(
-            "find last not of from middle (fail, not in string)",
-            idx, miss
-        );
-
-        idx = str3.find_last_not_of(not_last_target, 1);
-        test_eq(
-            "find last not of from middle (fail, late start)",
-            idx, miss
-        );
-
-        idx = str3.find_last_not_of("");
-        test_eq(
-            "find last not of from start (success, no target)",
-            idx, str3.size() - 1
-        );
-
-        idx = str3.find_last_not_of('x', str3.size() - 1);
-        test_eq(
-            "find last not of char (success)",
-            idx, 8ul
-        );
-
-        idx = str3.find_last_not_of('x', 1);
-        test_eq(
-            "find last not of char (fail)",
-            idx, miss
-        );
-    }
-
-    void string_test::test_substr()
-    {
-        std::string check1{"abcd"};
-        std::string check2{"bcd"};
-        std::string check3{"def"};
-
-        std::string str{"abcdef"};
-        auto substr1 = str.substr(0, 4);
-        auto substr2 = str.substr(1, 3);
-        auto substr3 = str.substr(3);
-
-        test_eq(
-            "prefix substring",
-            substr1.begin(), substr1.end(),
-            check1.begin(), check1.end()
-        );
-
-        test_eq(
-            "substring",
-            substr2.begin(), substr2.end(),
-            check2.begin(), check2.end()
-        );
-
-        test_eq(
-            "suffix substring",
-            substr3.begin(), substr3.end(),
-            check3.begin(), check3.end()
-        );
-    }
-
-    void string_test::test_compare()
-    {
-        std::string str1{"aabbb"};
-        std::string str2{"bbbaa"};
-        std::string str3{"bbb"};
-
-        auto res = str1.compare(str1);
-        test_eq(
-            "compare equal",
-            res, 0
-        );
-
-        res = str1.compare(str2.c_str());
-        test_eq(
-            "compare less",
-            res, -1
-        );
-
-        res = str2.compare(str1);
-        test_eq(
-            "compare greater",
-            res, 1
-        );
-
-        res = str1.compare(2, 3, str2);
-        test_eq(
-            "compare substring less",
-            res, -1
-        );
-
-        res = str1.compare(2, 3, str3);
-        test_eq(
-            "compare substring equal",
-            res, 0
-        );
-    }
-}
Index: pace/lib/cpp/src/__bits/test/test.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/test.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/test.hpp>
-#include <cstdio>
-
-namespace std::test
-{
-    void test_suite::report(bool result, const char* tname)
-    {
-        if (!report_)
-            return;
-
-        if (result)
-            std::printf("[%s][%s] ... OK\n", name(), tname);
-        else
-            std::printf("[%s][%s] ... FAIL\n", name(), tname);
-    }
-
-    void test_suite::start()
-    {
-        if (report_)
-            std::printf("\n[TEST START][%s]\n", name());
-    }
-
-    bool test_suite::end()
-    {
-        if (report_)
-            std::printf("[TEST END][%s][%u OK][%u FAIL]\n",
-                        name(), succeeded_, failed_);
-        return ok_;
-    }
-
-    unsigned int test_suite::get_failed() const noexcept
-    {
-        return failed_;
-    }
-
-    unsigned int test_suite::get_succeeded() const noexcept
-    {
-        return succeeded_;
-    }
-}
Index: pace/lib/cpp/src/__bits/test/tuple.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/tuple.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <functional>
-#include <initializer_list>
-#include <string>
-#include <tuple>
-#include <type_traits>
-#include <utility>
-
-namespace std::test
-{
-    bool tuple_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_creation();
-        test_tie_and_structured_bindings();
-        test_tuple_ops();
-
-        return end();
-    }
-
-    const char* tuple_test::name()
-    {
-        return "tuple";
-    }
-
-    void tuple_test::test_constructors_and_assignment()
-    {
-        std::tuple<int, float> tpl1{1, .5f};
-        test_eq("value initialization pt1", std::get<0>(tpl1), 1);
-        test_eq("value initialization pt2", std::get<1>(tpl1), .5f);
-
-        auto p = std::make_pair(2, 1.f);
-        std::tuple<int, float> tpl2{p};
-        test_eq("pair initialization pt1", std::get<0>(tpl2), 2);
-        test_eq("pair initialization pt2", std::get<1>(tpl2), 1.f);
-
-        tpl1 = p;
-        test_eq("pair assignment pt1", std::get<0>(tpl1), 2);
-        test_eq("pair assignment pt2", std::get<1>(tpl1), 1.f);
-
-        auto tpl3 = std::make_tuple(std::string{"A"}, std::string{"B"});
-        auto tpl4 = std::make_tuple(std::string{"C"}, std::string{"D"});
-        tpl3 = std::move(tpl4);
-        test_eq("move assignment pt1", std::get<0>(tpl3), std::string{"C"});
-        test_eq("move assignment pt2", std::get<1>(tpl3), std::string{"D"});
-
-        auto tpl5 = std::make_tuple(1, .5f);
-        auto tpl6{std::move(tpl5)};
-        test_eq("move initialization pt1", std::get<0>(tpl6), 1);
-        test_eq("move initialization pt2", std::get<1>(tpl6), .5f);
-    }
-
-    void tuple_test::test_creation()
-    {
-        auto tpl1 = std::make_tuple(1, .5f, std::string{"test"}, true);
-        static_assert(std::is_same_v<std::tuple_element_t<0, decltype(tpl1)>, int>);
-        static_assert(std::is_same_v<std::tuple_element_t<1, decltype(tpl1)>, float>);
-        static_assert(std::is_same_v<std::tuple_element_t<2, decltype(tpl1)>, std::string>);
-        static_assert(std::is_same_v<std::tuple_element_t<3, decltype(tpl1)>, bool>);
-
-        test_eq("make_tuple pt1", std::get<0>(tpl1), 1);
-        test_eq("make_tuple pt2", std::get<1>(tpl1), .5f);
-        test_eq("make_tuple pt3", std::get<2>(tpl1), std::string{"test"});
-        test_eq("make_tuple pt4", std::get<3>(tpl1), true);
-
-        static_assert(std::tuple_size_v<decltype(tpl1)> == 4);
-
-        int i{};
-        float f{};
-        auto tpl2 = std::make_tuple(std::ref(i), std::cref(f));
-        static_assert(std::is_same_v<std::tuple_element_t<0, decltype(tpl2)>, int&>);
-        static_assert(std::is_same_v<std::tuple_element_t<1, decltype(tpl2)>, const float&>);
-
-        std::get<0>(tpl2) = 3;
-        test_eq("modify reference in tuple", i, 3);
-
-        auto tpl3 = std::forward_as_tuple(i, f);
-        static_assert(std::is_same_v<std::tuple_element_t<0, decltype(tpl3)>, int&>);
-        static_assert(std::is_same_v<std::tuple_element_t<1, decltype(tpl3)>, float&>);
-
-        std::get<1>(tpl3) = 1.5f;
-        test_eq("modify reference in forward_as_tuple", f, 1.5f);
-    }
-
-    void tuple_test::test_tie_and_structured_bindings()
-    {
-        int i1{};
-        float f1{};
-        auto tpl = std::make_tuple(1, .5f);
-        std::tie(i1, f1) = tpl;
-
-        test_eq("tie unpack pt1", i1, 1);
-        test_eq("tie unpack pt2", f1, .5f);
-
-        std::get<0>(tpl) = 2;
-        /* std::tie(i1, std::ignore) = tpl; */
-
-        /* test_eq("tie unpack with ignore", i1, 2); */
-
-        auto [i2, f2] = tpl;
-        test_eq("structured bindings pt1", i2, 2);
-        test_eq("structured bindings pt2", f2, .5f);
-    }
-
-    void tuple_test::test_tuple_ops()
-    {
-        auto tpl1 = std::make_tuple(1, .5f);
-        auto tpl2 = std::make_tuple(1, .5f);
-        auto tpl3 = std::make_tuple(1, 1.f);
-        auto tpl4 = std::make_tuple(2, .5f);
-        auto tpl5 = std::make_tuple(2, 1.f);
-
-        test_eq("tuple == pt1", (tpl1 == tpl2), true);
-        test_eq("tuple == pt2", (tpl1 == tpl3), false);
-        test_eq("tuple == pt3", (tpl1 == tpl4), false);
-        test_eq("tuple < pt1", (tpl1 < tpl2), false);
-        test_eq("tuple < pt2", (tpl1 < tpl3), true);
-        test_eq("tuple < pt3", (tpl1 < tpl4), true);
-        test_eq("tuple < pt4", (tpl1 < tpl5), true);
-
-        tpl1.swap(tpl5);
-        test_eq("tuple swap pt1", std::get<0>(tpl1), 2);
-        test_eq("tuple swap pt2", std::get<1>(tpl1), 1.f);
-        test_eq("tuple swap pt3", std::get<0>(tpl5), 1);
-        test_eq("tuple swap pt4", std::get<1>(tpl5), .5f);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/unordered_map.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/unordered_map.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <unordered_map>
-#include <string>
-#include <sstream>
-#include <utility>
-
-namespace std::test
-{
-    bool unordered_map_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_histogram();
-        test_emplace_insert();
-        test_multi();
-
-        return end();
-    }
-
-    const char* unordered_map_test::name()
-    {
-        return "unordered_map";
-    }
-
-    void unordered_map_test::test_constructors_and_assignment()
-    {
-        auto check1 = {1, 2, 3, 4, 5, 6, 7};
-        auto src1 = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::unordered_map<int, int> m1{src1};
-        test_contains(
-            "initializer list initialization",
-            check1.begin(), check1.end(), m1
-        );
-        test_eq("size", m1.size(), 7U);
-
-        std::unordered_map<int, int> m2{src1.begin(), src1.end()};
-        test_contains(
-            "iterator range initialization",
-            check1.begin(), check1.end(), m2
-        );
-
-        std::unordered_map<int, int> m3{m1};
-        test_contains(
-            "copy initialization",
-            check1.begin(), check1.end(), m3
-        );
-
-        std::unordered_map<int, int> m4{std::move(m1)};
-        test_contains(
-            "move initialization",
-            check1.begin(), check1.end(), m4
-        );
-        test_eq("move initialization - origin empty", m1.size(), 0U);
-        test_eq("empty", m1.empty(), true);
-
-        m1 = m4;
-        test_contains(
-            "copy assignment",
-            check1.begin(), check1.end(), m1
-        );
-
-        m4 = std::move(m1);
-        test_contains(
-            "move assignment",
-            check1.begin(), check1.end(), m4
-        );
-        test_eq("move assignment - origin empty", m1.size(), 0U);
-
-        m1 = src1;
-        test_contains(
-            "initializer list assignment",
-            check1.begin(), check1.end(), m1
-        );
-    }
-
-    void unordered_map_test::test_histogram()
-    {
-        std::string str{"a b a a c d b e a b b e d c a e"};
-        std::unordered_map<std::string, std::size_t> unordered_map{};
-        std::istringstream iss{str};
-        std::string word{};
-
-        while (iss >> word)
-            ++unordered_map[word];
-
-        test_eq("histogram pt1", unordered_map["a"], 5U);
-        test_eq("histogram pt2", unordered_map["b"], 4U);
-        test_eq("histogram pt3", unordered_map["c"], 2U);
-        test_eq("histogram pt4", unordered_map["d"], 2U);
-        test_eq("histogram pt5", unordered_map["e"], 3U);
-        test_eq("histogram pt6", unordered_map["f"], 0U);
-        test_eq("at", unordered_map.at("a"), 5U);
-    }
-
-    void unordered_map_test::test_emplace_insert()
-    {
-        std::unordered_map<int, int> map1{};
-
-        auto res1 = map1.emplace(1, 2);
-        test_eq("first emplace succession", res1.second, true);
-        test_eq("first emplace equivalence pt1", res1.first->first, 1);
-        test_eq("first emplace equivalence pt2", res1.first->second, 2);
-
-        auto res2 = map1.emplace(1, 3);
-        test_eq("second emplace failure", res2.second, false);
-        test_eq("second emplace equivalence pt1", res2.first->first, 1);
-        test_eq("second emplace equivalence pt2", res2.first->second, 2);
-
-        auto res3 = map1.emplace_hint(map1.begin(), 2, 4);
-        test_eq("first emplace_hint succession", (res3 != map1.end()), true);
-        test_eq("first emplace_hint equivalence pt1", res3->first, 2);
-        test_eq("first emplace_hint equivalence pt2", res3->second, 4);
-
-        auto res4 = map1.emplace_hint(map1.begin(), 2, 5);
-        test_eq("second emplace_hint failure", (res4 != map1.end()), true);
-        test_eq("second emplace_hint equivalence pt1", res4->first, 2);
-        test_eq("second emplace_hint equivalence pt2", res4->second, 4);
-
-        std::unordered_map<int, std::string> map2{};
-        auto res5 = map2.insert(std::pair<const int, const char*>{5, "A"});
-        test_eq("conversion insert succession", res5.second, true);
-        test_eq("conversion insert equivalence pt1", res5.first->first, 5);
-        test_eq("conversion insert equivalence pt2", res5.first->second, std::string{"A"});
-
-        auto res6 = map2.insert(std::pair<const int, std::string>{6, "B"});
-        test_eq("first insert succession", res6.second, true);
-        test_eq("first insert equivalence pt1", res6.first->first, 6);
-        test_eq("first insert equivalence pt2", res6.first->second, std::string{"B"});
-
-        auto res7 = map2.insert(std::pair<const int, std::string>{6, "C"});
-        test_eq("second insert failure", res7.second, false);
-        test_eq("second insert equivalence pt1", res7.first->first, 6);
-        test_eq("second insert equivalence pt2", res7.first->second, std::string{"B"});
-
-        auto res8 = map2.insert_or_assign(6, std::string{"D"});
-        test_eq("insert_or_*assign* result", res8.second, false);
-        test_eq("insert_or_*assign* equivalence pt1", res8.first->first, 6);
-        test_eq("insert_or_*assign* equivalence pt2", res8.first->second, std::string{"D"});
-
-        auto res9 = map2.insert_or_assign(7, std::string{"E"});
-        test_eq("*insert*_or_assign result", res9.second, true);
-        test_eq("*insert*_or_assign equivalence pt1", res9.first->first, 7);
-        test_eq("*insert*_or_assign equivalence pt2", res9.first->second, std::string{"E"});
-
-        map2.erase(map2.find(7));
-        test_eq("erase", map2.find(7), map2.end());
-
-        auto res10 = map2.erase(6);
-        test_eq("erase by key pt1", res10, 1U);
-        auto res11 = map2.erase(6);
-        test_eq("erase by key pt2", res11, 0U);
-
-        auto res12 = map2.insert(std::pair<const int, const char*>{11, "test"});
-        test_eq("insert with constructible argument pt1", res12.second, true);
-        test_eq("insert with constructible argument pt2", res12.first->first, 11);
-        test_eq("insert with constructible argument pt3", res12.first->second, std::string{"test"});
-
-        std::unordered_map<int, int> map3{};
-        map3[1] = 1;
-        auto res13 = map3.count(1);
-        test_eq("count", res13, 1U);
-
-        map2.clear();
-        test_eq("clear", map2.empty(), true);
-    }
-
-    void unordered_map_test::test_multi()
-    {
-        auto check_keys = {1, 2, 3, 4, 5, 6, 7};
-        auto check_counts = {1U, 1U, 2U, 1U, 1U, 3U, 1U};
-        auto src = {
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{1, 1},
-            std::pair<const int, int>{5, 5},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{3, 3},
-            std::pair<const int, int>{2, 2},
-            std::pair<const int, int>{7, 7},
-            std::pair<const int, int>{6, 6},
-            std::pair<const int, int>{4, 4}
-        };
-
-        std::unordered_multimap<int, int> mmap{src};
-        test_contains_multi(
-            "multi construction",
-            check_keys.begin(), check_keys.end(),
-            check_counts.begin(), mmap
-        );
-
-        auto res1 = mmap.count(6);
-        test_eq("multi count", res1, 3U);
-
-        auto res2 = mmap.emplace(7, 2);
-        test_eq("multi duplicit emplace pt1", res2->first, 7);
-        test_eq("multi duplicit emplace pt2", res2->second, 2);
-        test_eq("multi duplicit emplace pt3", mmap.count(7), 2U);
-
-        auto res3 = mmap.emplace(8, 5);
-        test_eq("multi unique emplace pt1", res3->first, 8);
-        test_eq("multi unique emplace pt2", res3->second, 5);
-        test_eq("multi unique emplace pt3", mmap.count(8), 1U);
-
-        auto res4 = mmap.insert(std::pair<const int, int>{8, 6});
-        test_eq("multi duplicit insert pt1", res4->first, 8);
-        test_eq("multi duplicit insert pt2", res4->second, 6);
-        test_eq("multi duplicit insert pt3", mmap.count(8), 2U);
-
-        auto res5 = mmap.insert(std::pair<const int, int>{9, 8});
-        test_eq("multi unique insert pt1", res5->first, 9);
-        test_eq("multi unique insert pt2", res5->second, 8);
-        test_eq("multi unique insert pt3", mmap.count(9), 1U);
-
-        auto res6 = mmap.erase(8);
-        test_eq("multi erase by key pt1", res6, 2U);
-        test_eq("multi erase by key pt2", mmap.count(8), 0U);
-
-        // To check that the bucket still works.
-        mmap.insert(std::pair<const int, int>{8, 8});
-        test_eq("multi erase keeps bucket intact", (mmap.find(8) != mmap.end()), true);
-
-        auto res7 = mmap.erase(mmap.find(7));
-        test_eq("multi erase by iterator pt1", res7->first, 7);
-        test_eq("multi erase by iterator pt2", mmap.count(7), 1U);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/unordered_set.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/unordered_set.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <initializer_list>
-#include <unordered_set>
-#include <string>
-#include <utility>
-
-namespace std::test
-{
-    bool unordered_set_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_constructors_and_assignment();
-        test_emplace_insert();
-        test_multi();
-
-        return end();
-    }
-
-    const char* unordered_set_test::name()
-    {
-        return "unordered_set";
-    }
-
-    void unordered_set_test::test_constructors_and_assignment()
-    {
-        auto check1 = {1, 2, 3, 4, 5, 6, 7};
-        auto src1 = {3, 1, 5, 2, 7, 6, 4};
-
-        std::unordered_set<int> s1{src1};
-        test_contains(
-            "initializer list initialization",
-            check1.begin(), check1.end(), s1
-        );
-        test_eq("size", s1.size(), 7U);
-
-        std::unordered_set<int> s2{src1.begin(), src1.end()};
-        test_contains(
-            "iterator range initialization",
-            check1.begin(), check1.end(), s2
-        );
-
-        std::unordered_set<int> s3{s1};
-        test_contains(
-            "copy initialization",
-            check1.begin(), check1.end(), s3
-        );
-
-        std::unordered_set<int> s4{std::move(s1)};
-        test_contains(
-            "move initialization",
-            check1.begin(), check1.end(), s4
-        );
-        test_eq("move initialization - origin empty", s1.size(), 0U);
-        test_eq("empty", s1.empty(), true);
-
-        s1 = s4;
-        test_contains(
-            "copy assignment",
-            check1.begin(), check1.end(), s1
-        );
-
-        s4 = std::move(s1);
-        test_contains(
-            "move assignment",
-            check1.begin(), check1.end(), s4
-        );
-        test_eq("move assignment - origin empty", s1.size(), 0U);
-
-        s1 = src1;
-        test_contains(
-            "initializer list assignment",
-            check1.begin(), check1.end(), s1
-        );
-    }
-
-    void unordered_set_test::test_emplace_insert()
-    {
-        std::unordered_set<int> set1{};
-
-        auto res1 = set1.emplace(1);
-        test_eq("first emplace succession", res1.second, true);
-        test_eq("first emplace equivalence", *res1.first, 1);
-
-        auto res2 = set1.emplace(1);
-        test_eq("second emplace failure", res2.second, false);
-        test_eq("second emplace equivalence", *res2.first, 1);
-
-        auto res3 = set1.emplace_hint(set1.begin(), 2);
-        test_eq("first emplace_hint succession", (res3 != set1.end()), true);
-        test_eq("first emplace_hint equivalence", *res3, 2);
-
-        auto res4 = set1.emplace_hint(set1.begin(), 2);
-        test_eq("second emplace_hint failure", (res4 != set1.end()), true);
-        test_eq("second emplace_hint equivalence", *res4, 2);
-
-        std::unordered_set<std::string> set2{};
-        auto res5 = set2.insert("A");
-        test_eq("conversion insert succession", res5.second, true);
-        test_eq("conversion insert equivalence", *res5.first, std::string{"A"});
-
-        auto res6 = set2.insert(std::string{"B"});
-        test_eq("first insert succession", res6.second, true);
-        test_eq("first insert equivalence", *res6.first, std::string{"B"});
-
-        auto res7 = set2.insert(std::string{"B"});
-        test_eq("second insert failure", res7.second, false);
-        test_eq("second insert equivalence", *res7.first, std::string{"B"});
-
-        auto res10 = set1.erase(set1.find(2));
-        test_eq("erase", set1.find(2), set1.end());
-        test_eq("highest erased", res10, set1.end());
-
-        set2.insert(std::string{"G"});
-        set2.insert(std::string{"H"});
-        set2.insert(std::string{"K"});
-        auto res11 = set2.erase(std::string{"G"});
-        test_eq("erase by key pt1", res11, 1U);
-        auto res12 = set2.erase(std::string{"M"});
-        test_eq("erase by key pt2", res12, 0U);
-
-        std::unordered_set<int> set3{};
-        set3.insert(1);
-        auto res13 = set3.erase(1);
-        test_eq("erase only element by key pt1", res13, 1U);
-        test_eq("erase only element by key pt2", set3.empty(), true);
-
-        set3.insert(3);
-        auto res14 = set3.erase(set3.begin());
-        test_eq("erase only element by iterator pt1", res14, set3.end());
-        test_eq("erase only element by iterator pt2", set3.empty(), true);
-
-        set2.clear();
-        test_eq("clear", set2.empty(), true);
-
-        set3.insert(1);
-        auto res15 = set3.count(1);
-        test_eq("count", res15, 1U);
-
-        set3.insert(15);
-        auto res16 = set3.find(15);
-        test_eq("find", *res16, 15);
-    }
-
-    void unordered_set_test::test_multi()
-    {
-        auto check_keys = {1, 2, 3, 4, 5, 6, 7};
-        auto check_counts = {1U, 1U, 2U, 1U, 1U, 3U, 1U};
-        auto src1 = {3, 6, 1, 5, 6, 3, 2, 7, 6, 4};
-
-        std::unordered_multiset<int> mset{src1};
-        test_contains_multi(
-            "multi construction",
-            check_keys.begin(), check_keys.end(),
-            check_counts.begin(), mset
-        );
-
-        auto res1 = mset.count(6);
-        test_eq("multi count", res1, 3U);
-
-        auto res2 = mset.emplace(7);
-        test_eq("multi duplicit emplace pt1", *res2, 7);
-        test_eq("multi duplicit emplace pt2", mset.count(7), 2U);
-
-        auto res3 = mset.emplace(8);
-        test_eq("multi unique emplace pt1", *res3, 8);
-        test_eq("multi unique emplace pt2", mset.count(8), 1U);
-
-        auto res4 = mset.insert(8);
-        test_eq("multi duplicit insert pt1", *res4, 8);
-        test_eq("multi duplicit insert pt2", mset.count(8), 2U);
-
-        auto res5 = mset.insert(9);
-        test_eq("multi unique insert pt1", *res5, 9);
-        test_eq("multi unique insert pt2", mset.count(9), 1U);
-
-        auto res6 = mset.erase(8);
-        test_eq("multi erase by key pt1", res6, 2U);
-        test_eq("multi erase by key pt2", mset.count(8), 0U);
-
-        auto res7 = mset.erase(mset.find(7));
-        test_eq("multi erase by iterator pt1", *res7, 7);
-        test_eq("multi erase by iterator pt2", mset.count(7), 1U);
-    }
-}
Index: pace/lib/cpp/src/__bits/test/vector.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/test/vector.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/test/tests.hpp>
-#include <algorithm>
-#include <initializer_list>
-#include <utility>
-#include <vector>
-
-namespace std::test
-{
-    bool vector_test::run(bool report)
-    {
-        report_ = report;
-        start();
-
-        test_construction_and_assignment();
-        test_insert();
-        test_erase();
-
-        return end();
-    }
-
-    const char* vector_test::name()
-    {
-        return "vector";
-    }
-
-    void vector_test::test_construction_and_assignment()
-    {
-        auto check1 = {1, 2, 3, 4};
-        auto check2 = {4, 3, 2, 1};
-        auto check3 = {5, 5, 5, 5};
-
-        std::vector<int> vec1{};
-        vec1.push_back(1);
-        vec1.push_back(2);
-        vec1.push_back(3);
-        vec1.push_back(4);
-        test_eq(
-            "default constructor + push_back",
-            vec1.begin(), vec1.end(),
-            check1.begin(), check1.end()
-        );
-
-        std::vector<int> vec2{4, 3, 2, 1};
-        test_eq(
-            "initializer list constructor",
-            vec2.begin(), vec2.end(),
-            check2.begin(), check2.end()
-        );
-
-        std::vector<int> vec3(11);
-        test_eq("capacity constructor", 11ul, vec3.capacity());
-
-        std::vector<int> vec4(4ul, 5);
-        test_eq(
-            "replication constructor",
-            vec4.begin(), vec4.end(),
-            check3.begin(), check3.end()
-        );
-
-        // TODO: iterator constructor when implemented
-
-        std::vector<int> vec6{vec4};
-        test_eq(
-            "copy constructor",
-            vec6.begin(), vec6.end(),
-            vec4.begin(), vec4.end()
-        );
-
-        std::vector<int> vec7{std::move(vec6)};
-        test_eq(
-            "move constructor equality",
-            vec7.begin(), vec7.end(),
-            vec4.begin(), vec4.end()
-        );
-        test_eq(
-            "move constructor source empty",
-            vec6.size(), 0ul
-        );
-
-        std::vector<int> vec8{check1};
-        test_eq(
-            "explicit initializer list constructor",
-            vec8.begin(), vec8.end(),
-            check1.begin(), check1.end()
-        );
-
-        std::vector<int> vec9{};
-        vec9 = vec8;
-        test_eq(
-            "copy assignment",
-            vec9.begin(), vec9.end(),
-            vec8.begin(), vec8.end()
-        );
-
-        // TODO: move assignment when implemented
-        std::vector<int> vec10{};
-        vec10 = std::move(vec9);
-        test_eq(
-            "move assignment",
-            vec10.begin(), vec10.end(),
-            vec8.begin(), vec8.end()
-        );
-
-        test_eq("move assignment origin empty", vec9.size(), 0U);
-    }
-
-    void vector_test::test_insert()
-    {
-        auto check1 = {1, 2, 3, 99, 4, 5};
-        auto check2 = {1, 2, 3, 99, 99, 99, 99, 99, 4, 5};
-        auto check3 = {1, 2, 3, 1, 2, 3, 99, 4, 5, 4, 5};
-
-        std::vector<int> vec1{1, 2, 3, 4, 5};
-        auto it = vec1.insert(vec1.begin() + 3, 99);
-        test_eq(
-            "single element insert",
-            vec1.begin(), vec1.end(),
-            check1.begin(), check1.end()
-        );
-        test_eq(
-            "iterator returned from insert",
-            *it, 99
-        );
-
-        std::vector<int> vec2{1, 2, 3, 4, 5};
-        vec2.insert(vec2.begin() + 3, 5ul, 99);
-        test_eq(
-            "multiple element insert",
-            vec2.begin(), vec2.end(),
-            check2.begin(), check2.end()
-        );
-
-        std::vector<int> vec3{1, 2, 3, 4, 5};
-        vec3.insert(vec3.begin() + 3, vec2.begin() + 3, vec2.begin() + 8);
-        test_eq(
-            "iterator insert",
-            vec3.begin(), vec3.end(),
-            check2.begin(), check2.end()
-        );
-
-        std::vector<int> vec4{1, 2, 3, 4, 5};
-        vec4.insert(vec4.begin() + 3, check1);
-        test_eq(
-            "initializer list insert",
-            vec4.begin(), vec4.end(),
-            check3.begin(), check3.end()
-        );
-
-        std::vector<int> vec5{1, 2, 3, 4, 5};
-        vec5.insert(vec5.begin() + 3, {1, 2, 3, 99, 4, 5});
-        test_eq(
-            "implicit initializer list insert",
-            vec5.begin(), vec5.end(),
-            check3.begin(), check3.end()
-        );
-
-        std::vector<int> vec6{};
-        vec6.insert(vec6.begin(), check3);
-        test_eq(
-            "insert to empty vector",
-            vec6.begin(), vec6.end(),
-            check3.begin(), check3.end()
-        );
-    }
-
-    void vector_test::test_erase()
-    {
-        auto check1 = {1, 2, 3, 5};
-        auto check2 = {1, 5};
-        auto check3 = {1, 3, 5};
-
-        std::vector<int> vec1{1, 2, 3, 4, 5};
-        vec1.erase(vec1.begin() + 3);
-        test_eq(
-            "single element erase",
-            vec1.begin(), vec1.end(),
-            check1.begin(), check1.end()
-        );
-
-        std::vector<int> vec2{1, 2, 3, 4, 5};
-        vec2.erase(vec2.begin() + 1, vec2.begin() + 4);
-        test_eq(
-            "range erase",
-            vec2.begin(), vec2.end(),
-            check2.begin(), check2.end()
-        );
-
-        std::vector<int> vec3{1, 2, 3, 4, 5};
-        for (auto it = vec3.begin(); it != vec3.end();)
-        {
-            if (*it % 2 == 0)
-                it = vec3.erase(it);
-            else
-                ++it;
-        }
-        test_eq(
-            "erase all even numbers",
-            vec3.begin(), vec3.end(),
-            check3.begin(), check3.end()
-        );
-    }
-}
Index: pace/lib/cpp/src/__bits/trycatch.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/trycatch.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/trycatch.hpp>
-
-bool ::std::aux::exception_thrown{false};
Index: pace/lib/cpp/src/__bits/unwind.cpp
===================================================================
--- uspace/lib/cpp/src/__bits/unwind.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,248 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cassert>
-#include <cstdint>
-#include <cstdlib>
-#include <typeinfo>
-
-namespace __cxxabiv1
-{
-    /**
-     * Stack unwinding functionality - Level 1.
-     */
-
-    enum _Unwind_Reason_Code
-    {
-        _URC_NO_REASON                = 0,
-        _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
-        _URC_FATAL_PHASE2_ERROR       = 2,
-        _URC_FATAL_PHASE1_ERROR       = 3,
-        _URC_NORMAL_STOP              = 4,
-        _URC_END_OF_STACK             = 5,
-        _URC_HANDLER_FOUND            = 6,
-        _URC_INSTALL_CONTEXT          = 7,
-        _URC_CONTINUE_UNWIND          = 8
-    };
-
-    struct _Unwind_Exception;
-    using _Unwind_Exception_Cleanup_Fn = void (*)(_Unwind_Reason_Code, _Unwind_Exception*);
-
-    struct _Unwind_Exception
-    {
-        std::uint64_t exception_class;
-        _Unwind_Exception_Cleanup_Fn exception_cleanup;
-        std::uint64_t private_1;
-        std::uint64_t private_2;
-    };
-
-    /* Opaque structure. */
-    struct _Unwind_Context;
-
-    using _Unwind_Action = int;
-    namespace
-    {
-        const _Unwind_Action _UA_SEARCH_PHASE  = 1;
-        const _Unwind_Action _UA_CLEANUP_PHASE = 2;
-        const _Unwind_Action _UA_HANDLER_FRAME = 4;
-        const _Unwind_Action _UA_FORCE_HANDLER = 8;
-    }
-
-    /**
-     * TODO: Explain parameter semantics.
-     */
-    using _Unwind_Stop_Fn = _Unwind_Reason_Code(*)(
-        int, _Unwind_Action, std::uint64_t, _Unwind_Exception*,
-        _Unwind_Context*, void*
-    );
-
-    extern "C" _Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception*, _Unwind_Stop_Fn, void*)
-    {
-        // TODO: implement
-        return _URC_NO_REASON;
-    }
-
-    extern "C" void _Unwind_Resume(_Unwind_Exception*)
-    {
-        // TODO: implement
-    }
-
-    extern "C" void _Unwind_DeleteException(_Unwind_Exception*)
-    {
-        // TODO: implement
-    }
-
-    extern "C" std::uint64_t _Unwind_GetGR(_Unwind_Context*, int)
-    {
-        // TODO: implement
-        return 0;
-    }
-
-    extern "C" void _Unwind_SetGR(_Unwind_Context*, int, std::uint64_t)
-    {
-        // TODO: implement
-    }
-
-    extern "C" std::uint64_t _Unwind_GetIP(_Unwind_Context*)
-    {
-        // TODO: implement
-        return 0;
-    }
-
-    extern "C" void _Unwind_SetIP(_Unwind_Context*, std::uint64_t)
-    {
-        // TODO: implement
-    }
-
-    extern "C" std::uint64_t _Unwind_GetLanguageSpecificData(_Unwind_Context*)
-    {
-        // TODO: implement
-        return 0;
-    }
-
-    extern "C" std::uint64_t _Unwind_GetRegionStart(_Unwind_Context*)
-    {
-        // TODO: implement
-        return 0;
-    }
-
-    /**
-     * TODO: Explain parameter semantics.
-     */
-    using __personality_routine = _Unwind_Reason_Code(*)(
-        int, _Unwind_Action, std::uint64_t, _Unwind_Exception*,
-        _Unwind_Context*, void*
-    );
-
-    /**
-     * Stack unwinding functionality - Level 2.
-     */
-    struct __cxa_exception
-    {
-        std::type_info* exceptionType;
-        void (*exceptionDestructor)(void*);
-        // TODO: Add handler types to <exception>.
-        /* std::unexpected_handler unexpectedHandler; */
-        void (*unexpectedHandler)();
-        /* std::terminate_handler terminateHandler; */
-        void (*terminateHandler)();
-        __cxa_exception* nextException;
-
-        int handlerCount;
-        int handlerSwitchValue;
-        const char* actionRecord;
-        const char* languageSpecificData;
-        void* catchTemp;
-        void* adjujstedPtr;
-
-        _Unwind_Exception unwindHeader;
-    };
-
-    struct __cxa_eh_globals
-    {
-        __cxa_exception* caughtExceptions;
-        unsigned int uncaughtExceptions;
-    };
-
-    extern "C" __cxa_eh_globals* __cxa_get_globals();
-
-    extern "C" __cxa_eh_globals* __cxa_get_globals_fast();
-
-    extern "C" void* __cxa_allocate_exception(std::size_t thrown_size)
-    {
-        // TODO: implement
-        __unimplemented();
-        return nullptr;
-    }
-
-    extern "C" void __cxa_free_exception(void* thrown_exception)
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void __cxa_throw(void* thrown_exception, std::type_info* tinfo, void (*dest)(void*))
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void* __cxa_get_exception_ptr(void*  exception_object)
-    {
-        // TODO: implement
-        __unimplemented();
-        return nullptr;
-    }
-
-    extern "C" void* __cxa_begin_catch(void* exception_object)
-    {
-        // TODO: implement
-        __unimplemented();
-        return nullptr;
-    }
-
-    extern "C" void __cxa_end_catch()
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void __cxa_rethrow()
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void __cxa_bad_cast()
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void __cxa_bad_typeid()
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" void __cxa_throw_bad_array_new_length()
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-
-    extern "C" _Unwind_Reason_Code __gxx_personality_v0(
-        int, _Unwind_Action, unsigned,
-        struct _Unwind_Exception*, struct _Unwind_Context*
-    )
-    {
-        // TODO: implement
-        __unimplemented();
-        return _URC_NO_REASON;
-    }
-}
Index: pace/lib/cpp/src/condition_variable.cpp
===================================================================
--- uspace/lib/cpp/src/condition_variable.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cassert>
-#include <condition_variable>
-
-namespace std
-{
-    condition_variable::condition_variable()
-        : cv_{}
-    {
-        aux::threading::condvar::init(cv_);
-    }
-
-    condition_variable::~condition_variable()
-    { /* DUMMY BODY */ }
-
-    void condition_variable::notify_one() noexcept
-    {
-        aux::threading::condvar::signal(cv_);
-    }
-
-    void condition_variable::notify_all() noexcept
-    {
-        aux::threading::condvar::broadcast(cv_);
-    }
-
-    void condition_variable::wait(unique_lock<mutex>& lock)
-    {
-        if (lock.owns_lock())
-            aux::threading::condvar::wait(cv_, *lock.mutex()->native_handle());
-    }
-
-    condition_variable::native_handle_type condition_variable::native_handle()
-    {
-        return &cv_;
-    }
-
-    condition_variable_any::condition_variable_any()
-        : cv_{}
-    {
-        aux::threading::condvar::init(cv_);
-    }
-
-    condition_variable_any::~condition_variable_any()
-    { /* DUMMY BODY */ }
-
-    void condition_variable_any::notify_one() noexcept
-    {
-        aux::threading::condvar::signal(cv_);
-    }
-
-    void condition_variable_any::notify_all() noexcept
-    {
-        aux::threading::condvar::broadcast(cv_);
-    }
-
-    condition_variable_any::native_handle_type condition_variable_any::native_handle()
-    {
-        return &cv_;
-    }
-
-    void notify_all_at_thread_exit(condition_variable&, unique_lock<mutex>&)
-    {
-        // TODO: implement
-        __unimplemented();
-    }
-}
Index: pace/lib/cpp/src/exception.cpp
===================================================================
--- uspace/lib/cpp/src/exception.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cstdlib>
-#include <exception>
-
-namespace std
-{
-    const char* exception::what() const noexcept
-    {
-        return "std::exception";
-    }
-
-    const char* bad_exception::what() const noexcept
-    {
-        return "std::bad_exception";
-    }
-
-    namespace aux
-    {
-        terminate_handler term_handler{nullptr};
-        unexpected_handler unex_handler{nullptr};
-    }
-
-    terminate_handler get_terminate() noexcept
-    {
-        return aux::term_handler;
-    }
-
-    terminate_handler set_terminate(terminate_handler h) noexcept
-    {
-        auto res = aux::term_handler;
-        aux::term_handler = h;
-
-        return res;
-    }
-
-    [[noreturn]] void terminate() noexcept
-    {
-        if (aux::term_handler)
-            aux::term_handler();
-
-        abort();
-    }
-
-    bool uncaught_exception() noexcept
-    {
-        /**
-         * Note: The implementation of these two
-         *       functions currently uses our mock
-         *       exception handling system.
-         */
-        return aux::exception_thrown;
-    }
-
-    int uncaught_exceptins() noexcept
-    {
-        return aux::exception_thrown ? 1 : 0;
-    }
-
-    unexpected_handler get_unexpected() noexcept
-    {
-        return aux::unex_handler;
-    }
-
-    unexpected_handler set_unexpected(unexpected_handler h) noexcept
-    {
-        auto res = aux::unex_handler;
-        aux::unex_handler = h;
-
-        return res;
-    }
-
-    [[noreturn]] void unexpected()
-    {
-        if (aux::unex_handler)
-            aux::unex_handler();
-
-        terminate();
-    }
-
-    exception_ptr current_exception() noexcept
-    {
-        return exception_ptr{};
-    }
-
-    [[noreturn]] void rethrow_exception(exception_ptr)
-    {
-        terminate();
-    }
-
-    [[noreturn]] void nested_exception::throw_nested() const
-    {
-        terminate();
-    }
-
-    exception_ptr nested_exception::nested_ptr() const noexcept
-    {
-        return ptr_;
-    }
-}
Index: pace/lib/cpp/src/future.cpp
===================================================================
--- uspace/lib/cpp/src/future.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <future>
-#include <string>
-#include <system_error>
-
-namespace std
-{
-    error_code make_error_code(future_errc ec) noexcept
-    {
-        return error_code{static_cast<int>(ec), future_category()};
-    }
-
-    error_condition make_error_condition(future_errc ec) noexcept
-    {
-        return error_condition{static_cast<int>(ec), future_category()};
-    }
-
-    namespace aux
-    {
-        class future_category_t: public error_category
-        {
-            public:
-                future_category_t()
-                    : error_category{}
-                { /* DUMMY BODY */ }
-
-                ~future_category_t() = default;
-
-                const char* name() const noexcept override
-                {
-                    return "future";
-                }
-
-                string message(int ev) const override
-                {
-                    return "ev: " + std::to_string(ev);
-                }
-        };
-    }
-
-    const error_category& future_category() noexcept
-    {
-        static aux::future_category_t instance{};
-
-        return instance;
-    }
-
-    future_error::future_error(error_code ec)
-        : logic_error{"future_error"}, code_{ec}
-    { /* DUMMY BODY */ }
-
-    const error_code& future_error::code() const noexcept
-    {
-        return code_;
-    }
-
-    const char* future_error::what() const noexcept
-    {
-        /*
-         * FIXME
-         * Following code would be optimal but the message string is
-         * actually destroyed before the function returns so we would
-         * be returning a dangling pointer. No simple fix available, hence
-         * we use the ugly hack.
-         */
-        //return code().message().c_str();
-#define QUOTE_ARG(arg) #arg
-        return "future_error, see " __FILE__ ":" QUOTE_ARG(__LINE__);
-    }
-}
Index: pace/lib/cpp/src/iomanip.cpp
===================================================================
--- uspace/lib/cpp/src/iomanip.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/iomanip_objs.hpp>
-#include <iomanip>
-
-namespace std
-{
-    namespace aux
-    {
-        /**
-         * Manipulator return types:
-         */
-
-        resetiosflags_t::resetiosflags_t(ios_base::fmtflags m)
-            : mask{m}
-        { /* DUMMY BODY */ }
-
-        void resetiosflags_t::operator()(ios_base& str) const
-        {
-            str.setf(ios_base::fmtflags{0}, mask);
-        }
-
-        setiosflags_t::setiosflags_t(ios_base::fmtflags m)
-            : mask{m}
-        { /* DUMMY BODY */ }
-
-        void setiosflags_t::operator()(ios_base& str) const
-        {
-            str.setf(mask);
-        }
-
-        setbase_t::setbase_t(int b)
-            : base{b}
-        { /* DUMMY BODY */ }
-
-        void setbase_t::operator()(ios_base& str) const
-        {
-            str.setf(
-                base == 8  ? ios_base::oct :
-                base == 10 ? ios_base::dec :
-                base == 16 ? ios_base::hex :
-                ios_base::fmtflags{0},
-                ios_base::basefield
-            );
-        }
-
-        setprecision_t::setprecision_t(int p)
-            : prec{p}
-        { /* DUMMY BODY */ }
-
-        void setprecision_t::operator()(ios_base& str) const
-        {
-            str.precision(prec);
-        }
-
-        setw_t::setw_t(int w)
-            : width{w}
-        { /* DUMMY BODY */ }
-
-        void setw_t::operator()(ios_base& str) const
-        {
-            str.width(width);
-        }
-    }
-
-    /**
-     * Manipulators:
-     */
-
-    aux::manip_wrapper<aux::resetiosflags_t> resetiosflags(ios_base::fmtflags mask)
-    {
-        return aux::manip_wrapper<aux::resetiosflags_t>{mask};
-    }
-
-    aux::manip_wrapper<aux::setiosflags_t> setiosflags(ios_base::fmtflags mask)
-    {
-        return aux::manip_wrapper<aux::setiosflags_t>{mask};
-    }
-
-    aux::manip_wrapper<aux::setbase_t> setbase(int base)
-    {
-        return aux::manip_wrapper<aux::setbase_t>{base};
-    }
-
-    aux::manip_wrapper<aux::setprecision_t> setprecision(int prec)
-    {
-        return aux::manip_wrapper<aux::setprecision_t>{prec};
-    }
-
-    aux::manip_wrapper<aux::setw_t> setw(int width)
-    {
-        return aux::manip_wrapper<aux::setw_t>{width};
-    }
-}
Index: pace/lib/cpp/src/ios.cpp
===================================================================
--- uspace/lib/cpp/src/ios.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,339 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ios>
-
-namespace std
-{
-    int ios_base::index_{};
-    bool ios_base::sync_{true};
-    long ios_base::ierror_{0};
-    void* ios_base::perror_{nullptr};
-
-    ios_base::ios_base()
-        : iarray_{}, parray_{}, iarray_size_{}, parray_size_{},
-          flags_{}, precision_{}, width_{}, locale_{/* TODO: use locale()? */},
-          callbacks_{}
-    { /* DUMMY BODY */ }
-
-    ios_base::~ios_base()
-    {
-        for (auto& callback: callbacks_)
-            callback.first(erase_event, *this, callback.second);
-    }
-
-    auto ios_base::flags() const -> fmtflags
-    {
-        return flags_;
-    }
-
-    auto ios_base::flags(fmtflags fmtfl) -> fmtflags
-    {
-        auto old = flags_;
-        flags_ = fmtfl;
-
-        return old;
-    }
-
-    auto ios_base::setf(fmtflags fmtfl) -> fmtflags
-    {
-        auto old = flags_;
-        flags_ |= fmtfl;
-
-        return old;
-    }
-
-    auto ios_base::setf(fmtflags fmtfl, fmtflags mask) -> fmtflags
-    {
-        auto old = flags_;
-        flags_ &= ~mask;
-        flags_ |= fmtfl & mask;
-
-        return old;
-    }
-
-    void ios_base::unsetf(fmtflags fmtfl)
-    {
-        flags_ &= ~fmtfl;
-    }
-
-    streamsize ios_base::precision() const
-    {
-        return precision_;
-    }
-
-    streamsize ios_base::precision(streamsize prec)
-    {
-        auto old = precision_;
-        precision_ = prec;
-
-        return old;
-    }
-
-    streamsize ios_base::width() const
-    {
-        return width_;
-    }
-
-    streamsize ios_base::width(streamsize wide)
-    {
-        auto old = width_;
-        width_ = wide;
-
-        return old;
-    }
-
-    locale ios_base::imbue(const locale& loc)
-    {
-        auto old = locale_;
-        locale_ = loc;
-
-        for (auto& callback: callbacks_)
-            callback.first(imbue_event, *this, callback.second);
-
-        return old;
-    }
-
-    locale ios_base::getloc() const
-    {
-        return locale_;
-    }
-
-    long& ios_base::iword(int index)
-    {
-        if (!iarray_)
-        {
-            iarray_ = new long[initial_size_];
-            iarray_size_ = initial_size_;
-        }
-
-        auto idx = static_cast<size_t>(index);
-        if (idx > iarray_size_)
-        { // TODO: Enclose in try block and set failbit if needed
-          //       and return ierror_.
-            size_t new_size = max(iarray_size_ * 2, idx + 1);
-            auto tmp = new long[new_size];
-
-            for (size_t i = 0; i < iarray_size_; ++i)
-                tmp[i] = iarray_[i];
-            for (size_t i = iarray_size_; i < new_size; ++i)
-                tmp[i] = 0;
-
-            swap(tmp, iarray_);
-            delete[] tmp;
-            iarray_size_ = new_size;
-
-            return iarray_[idx];
-        }
-        else
-            return iarray_[idx];
-
-        return ierror_;
-    }
-
-    void*& ios_base::pword(int index)
-    {
-        if (!parray_)
-        {
-            parray_ = new void*[initial_size_];
-            parray_size_ = initial_size_;
-        }
-
-        auto idx = static_cast<size_t>(index);
-        if (idx > parray_size_)
-        { // TODO: Enclose in try block and set failbit if needed
-          //       and return perror_.
-            size_t new_size = max(parray_size_ * 2, idx + 1);
-            auto tmp = new void*[new_size];
-
-            for (size_t i = 0; i < parray_size_; ++i)
-                tmp[i] = parray_[i];
-            for (size_t i = parray_size_; i < new_size; ++i)
-                tmp[i] = nullptr;
-
-            swap(tmp, parray_);
-            delete[] tmp;
-            parray_size_ = new_size;
-
-            return parray_[idx];
-        }
-        else
-            return parray_[idx];
-
-        return perror_;
-    }
-
-    void ios_base::register_callback(event_callback fn, int index)
-    {
-        callbacks_.emplace_back(fn, index);
-    }
-
-    ios_base& boolalpha(ios_base& str)
-    {
-        str.setf(ios_base::boolalpha);
-        return str;
-    }
-
-    ios_base& noboolalpha(ios_base& str)
-    {
-        str.unsetf(ios_base::boolalpha);
-        return str;
-    }
-
-    ios_base& showbase(ios_base& str)
-    {
-        str.setf(ios_base::showbase);
-        return str;
-    }
-
-    ios_base& noshowbase(ios_base& str)
-    {
-        str.unsetf(ios_base::showbase);
-        return str;
-    }
-
-    ios_base& showpoint(ios_base& str)
-    {
-        str.setf(ios_base::showpoint);
-        return str;
-    }
-
-    ios_base& noshowpoint(ios_base& str)
-    {
-        str.unsetf(ios_base::showpoint);
-        return str;
-    }
-
-    ios_base& showpos(ios_base& str)
-    {
-        str.setf(ios_base::showpos);
-        return str;
-    }
-
-    ios_base& noshowpos(ios_base& str)
-    {
-        str.unsetf(ios_base::showpos);
-        return str;
-    }
-
-    ios_base& skipws(ios_base& str)
-    {
-        str.setf(ios_base::skipws);
-        return str;
-    }
-
-    ios_base& noskipws(ios_base& str)
-    {
-        str.unsetf(ios_base::skipws);
-        return str;
-    }
-
-    ios_base& uppercase(ios_base& str)
-    {
-        str.setf(ios_base::uppercase);
-        return str;
-    }
-
-    ios_base& nouppercase(ios_base& str)
-    {
-        str.unsetf(ios_base::uppercase);
-        return str;
-    }
-
-    ios_base& unitbuf(ios_base& str)
-    {
-        str.setf(ios_base::unitbuf);
-        return str;
-    }
-
-    ios_base& nounitbuf(ios_base& str)
-    {
-        str.unsetf(ios_base::unitbuf);
-        return str;
-    }
-
-    ios_base& internal(ios_base& str)
-    {
-        str.setf(ios_base::internal, ios_base::adjustfield);
-        return str;
-    }
-
-    ios_base& left(ios_base& str)
-    {
-        str.setf(ios_base::left, ios_base::adjustfield);
-        return str;
-    }
-
-    ios_base& right(ios_base& str)
-    {
-        str.setf(ios_base::right, ios_base::adjustfield);
-        return str;
-    }
-
-    ios_base& dec(ios_base& str)
-    {
-        str.setf(ios_base::dec, ios_base::basefield);
-        return str;
-    }
-
-    ios_base& hex(ios_base& str)
-    {
-        str.setf(ios_base::hex, ios_base::basefield);
-        return str;
-    }
-
-    ios_base& oct(ios_base& str)
-    {
-        str.setf(ios_base::oct, ios_base::basefield);
-        return str;
-    }
-
-    ios_base& fixed(ios_base& str)
-    {
-        str.setf(ios_base::fixed, ios_base::floatfield);
-        return str;
-    }
-
-    ios_base& scientific(ios_base& str)
-    {
-        str.setf(ios_base::scientific, ios_base::floatfield);
-        return str;
-    }
-
-    ios_base& hexfloat(ios_base& str)
-    {
-        str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
-        return str;
-    }
-
-    ios_base& defaultfloat(ios_base& str)
-    {
-        str.unsetf(ios_base::floatfield);
-        return str;
-    }
-}
Index: pace/lib/cpp/src/iostream.cpp
===================================================================
--- uspace/lib/cpp/src/iostream.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/io/streambufs.hpp>
-#include <ios>
-#include <iostream>
-#include <new>
-
-namespace std
-{
-    istream cin{nullptr};
-    ostream cout{nullptr};
-
-    namespace aux
-    {
-        ios_base::Init init{};
-    }
-
-    int ios_base::Init::init_cnt_{};
-
-    ios_base::Init::Init()
-    {
-        if (init_cnt_++ == 0)
-        {
-            // TODO: These buffers should be static too
-            //       in case somebody reassigns to cout/cin.
-            ::new(&cin) istream{::new aux::stdin_streambuf<char>{}};
-            ::new(&cout) ostream{::new aux::stdout_streambuf<char>{}};
-
-            cin.tie(&cout);
-        }
-    }
-
-    ios_base::Init::~Init()
-    {
-        if (--init_cnt_ == 0)
-            cout.flush();
-    }
-}
Index: pace/lib/cpp/src/locale.cpp
===================================================================
--- uspace/lib/cpp/src/locale.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <locale>
-
-namespace std
-{
-    locale::facet::facet(size_t refs)
-    {
-        // TODO: implement
-    }
-
-    locale::facet::~facet()
-    {
-        // TODO: implement
-    }
-
-    locale::locale() noexcept
-        : name_{}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const locale& other) noexcept
-        : name_{other.name_}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const char* name)
-        : name_{name}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const string& name)
-        : name_{name}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const locale& other, const char* name, category cat)
-        : name_{name}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const locale& other, const string& name, category cat)
-        : name_{name}
-    { /* DUMMY BODY */ }
-
-    locale::locale(const locale& other, const locale& one, category cat)
-        : name_{other.name_}
-    { /* DUMMY BODY */ }
-
-    const locale& locale::operator=(const locale& other) noexcept
-    {
-        name_ = other.name_;
-
-        return *this;
-    }
-
-    string locale::name() const
-    {
-        return name_;
-    }
-
-    bool locale::operator==(const locale& other) const
-    {
-        return (this == &other) || (name_ == other.name_);
-    }
-
-    bool locale::operator!=(const locale& other) const
-    {
-        return !(*this == other);
-    }
-}
Index: pace/lib/cpp/src/mutex.cpp
===================================================================
--- uspace/lib/cpp/src/mutex.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <mutex>
-
-namespace std
-{
-    void mutex::lock()
-    {
-        aux::threading::mutex::lock(mtx_);
-    }
-
-    bool mutex::try_lock()
-    {
-        return aux::threading::mutex::try_lock(mtx_);
-    }
-
-    void mutex::unlock()
-    {
-        aux::threading::mutex::unlock(mtx_);
-    }
-
-    mutex::native_handle_type mutex::native_handle()
-    {
-        return &mtx_;
-    }
-
-    recursive_mutex::~recursive_mutex()
-    { /* DUMMY BODY */ }
-
-    void recursive_mutex::lock()
-    {
-        if (owner_ != this_thread::get_id())
-        {
-            aux::threading::mutex::lock(mtx_);
-            owner_ = this_thread::get_id();
-            lock_level_ = 1;
-        }
-        else
-            ++lock_level_;
-    }
-
-    bool recursive_mutex::try_lock() noexcept
-    {
-        if (owner_ != this_thread::get_id())
-        {
-            bool res = aux::threading::mutex::try_lock(mtx_);
-            if (res)
-            {
-                owner_ = this_thread::get_id();
-                lock_level_ = 1;
-            }
-
-            return res;
-        }
-        else
-            ++lock_level_;
-
-        return true;
-    }
-
-    void recursive_mutex::unlock()
-    {
-        if (owner_ != this_thread::get_id())
-            return;
-        else if (--lock_level_ == 0)
-            aux::threading::mutex::unlock(mtx_);
-    }
-
-    recursive_mutex::native_handle_type recursive_mutex::native_handle()
-    {
-        return &mtx_;
-    }
-
-    timed_mutex::timed_mutex() noexcept
-        : mtx_{}
-    {
-        aux::threading::mutex::init(mtx_);
-    }
-
-    timed_mutex::~timed_mutex()
-    { /* DUMMY BODY */ }
-
-    void timed_mutex::lock()
-    {
-        aux::threading::mutex::lock(mtx_);
-    }
-
-    bool timed_mutex::try_lock()
-    {
-        return aux::threading::mutex::try_lock(mtx_);
-    }
-
-    void timed_mutex::unlock()
-    {
-        aux::threading::mutex::unlock(mtx_);
-    }
-
-    timed_mutex::native_handle_type timed_mutex::native_handle()
-    {
-        return &mtx_;
-    }
-
-    recursive_timed_mutex::~recursive_timed_mutex()
-    { /* DUMMY BODY */ }
-
-    void recursive_timed_mutex::lock()
-    {
-        if (owner_ != this_thread::get_id())
-        {
-            aux::threading::mutex::lock(mtx_);
-            owner_ = this_thread::get_id();
-            lock_level_ = 1;
-        }
-        else
-            ++lock_level_;
-    }
-
-    bool recursive_timed_mutex::try_lock() noexcept
-    {
-        if (owner_ != this_thread::get_id())
-        {
-            bool res = aux::threading::mutex::try_lock(mtx_);
-            if (res)
-            {
-                owner_ = this_thread::get_id();
-                lock_level_ = 1;
-            }
-
-            return res;
-        }
-        else
-            ++lock_level_;
-
-        return true;
-    }
-
-    void recursive_timed_mutex::unlock()
-    {
-        if (owner_ != this_thread::get_id())
-            return;
-        else if (--lock_level_ == 0)
-            aux::threading::mutex::unlock(mtx_);
-    }
-
-    recursive_timed_mutex::native_handle_type recursive_timed_mutex::native_handle()
-    {
-        return &mtx_;
-    }
-}
Index: pace/lib/cpp/src/new.cpp
===================================================================
--- uspace/lib/cpp/src/new.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <cstdlib>
-#include <new>
-
-namespace std
-{
-    const char* bad_alloc::what() const noexcept
-    {
-        return "std::bad_alloc";
-    }
-
-    const nothrow_t nothrow{};
-
-    static new_handler handler = nullptr;
-
-    new_handler set_new_handler(new_handler h)
-    {
-        auto old = handler;
-        handler = h;
-
-        return old;
-    }
-
-    new_handler get_new_handler() noexcept
-    {
-        return handler;
-    }
-}
-
-void* operator new(std::size_t size)
-{
-    if (size == 0)
-        size = 1;
-
-    void *ptr = std::malloc(size);
-
-    while (!ptr)
-    {
-        auto h = std::get_new_handler();
-        if (h)
-            h();
-        else
-        {
-            // TODO: For this we need stack unwinding support.
-            /*     throw std::bad_alloc{}; */
-        }
-    }
-
-    return ptr;
-}
-
-void* operator new(std::size_t ignored, void* ptr)
-{ // Placement new.
-    return ptr;
-}
-
-void* operator new(std::size_t size, const std::nothrow_t& nt) noexcept
-{
-    void* ptr{nullptr};
-
-    try
-    {
-        ptr = ::operator new(size);
-    }
-    catch(...)
-    { /* DUMMY BODY */ }
-
-    return ptr;
-}
-
-void* operator new[](std::size_t size)
-{
-    return ::operator new(size);
-}
-
-void* operator new[](std::size_t size, const std::nothrow_t& nt) noexcept
-{
-    return ::operator new(size, nt);
-}
-
-void operator delete(void* ptr) noexcept
-{
-    if (ptr)
-        std::free(ptr);
-}
-
-void operator delete(void* ptr, std::size_t ignored) noexcept
-{
-    ::operator delete(ptr);
-}
-
-void operator delete[](void* ptr) noexcept
-{
-    ::operator delete(ptr);
-}
-
-void operator delete[](void* ptr, std::size_t ignored) noexcept
-{
-    ::operator delete(ptr);
-}
Index: pace/lib/cpp/src/refcount_obj.cpp
===================================================================
--- uspace/lib/cpp/src/refcount_obj.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <__bits/refcount_obj.hpp>
-
-namespace std::aux
-{
-    void refcount_obj::increment()
-    {
-        __atomic_add_fetch(&refcount_, 1, __ATOMIC_ACQ_REL);
-    }
-
-    void refcount_obj::increment_weak()
-    {
-        __atomic_add_fetch(&weak_refcount_, 1, __ATOMIC_ACQ_REL);
-    }
-
-    bool refcount_obj::decrement()
-    {
-        if (__atomic_sub_fetch(&refcount_, 1, __ATOMIC_ACQ_REL) == 0)
-        {
-            /**
-             * First call to destroy() will delete the held object,
-             * so it doesn't matter what the weak_refcount_ is,
-             * but we added one and we need to remove it now.
-             */
-            decrement_weak();
-
-            return true;
-        }
-        else
-            return false;
-    }
-
-    bool refcount_obj::decrement_weak()
-    {
-        return __atomic_sub_fetch(&weak_refcount_, 1, __ATOMIC_ACQ_REL) == 0 && refs() == 0;
-    }
-
-    refcount_t refcount_obj::refs() const
-    {
-        return __atomic_load_n(&refcount_, __ATOMIC_RELAXED);
-    }
-
-    refcount_t refcount_obj::weak_refs() const
-    {
-        return __atomic_load_n(&weak_refcount_, __ATOMIC_RELAXED);
-    }
-
-    bool refcount_obj::expired() const
-    {
-        return refs() == 0;
-    }
-}
Index: pace/lib/cpp/src/shared_mutex.cpp
===================================================================
--- uspace/lib/cpp/src/shared_mutex.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <shared_mutex>
-
-namespace std
-{
-    shared_timed_mutex::shared_timed_mutex() noexcept
-        : mtx_{}
-    {
-        aux::threading::shared_mutex::init(mtx_);
-    }
-
-    shared_timed_mutex::~shared_timed_mutex()
-    { /* DUMMY BODY */ }
-
-    void shared_timed_mutex::lock()
-    {
-        aux::threading::shared_mutex::lock(mtx_);
-    }
-
-    bool shared_timed_mutex::try_lock()
-    {
-        return aux::threading::shared_mutex::try_lock(mtx_);
-    }
-
-    void shared_timed_mutex::unlock()
-    {
-        aux::threading::shared_mutex::unlock(mtx_);
-    }
-
-    void shared_timed_mutex::lock_shared()
-    {
-        aux::threading::shared_mutex::lock_shared(mtx_);
-    }
-
-    bool shared_timed_mutex::try_lock_shared()
-    {
-        return aux::threading::shared_mutex::try_lock_shared(mtx_);
-    }
-
-    void shared_timed_mutex::unlock_shared()
-    {
-        aux::threading::shared_mutex::unlock_shared(mtx_);
-    }
-
-    shared_timed_mutex::native_handle_type shared_timed_mutex::native_handle()
-    {
-        return &mtx_;
-    }
-}
Index: pace/lib/cpp/src/stdexcept.cpp
===================================================================
--- uspace/lib/cpp/src/stdexcept.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cstdlib>
-#include <cstring>
-#include <stdexcept>
-#include <string>
-#include <str.h>
-
-namespace std
-{
-    logic_error::logic_error(const string& what)
-        : what_{::helenos::str_dup(what.c_str())}
-    { /* DUMMY BODY */ }
-
-    logic_error::logic_error(const char* what)
-        : what_{::helenos::str_dup(what)}
-    { /* DUMMY BODY */ }
-
-    logic_error::logic_error(const logic_error& other) noexcept
-        : exception{other}, what_{::helenos::str_dup(other.what_)}
-    { /* DUMMY BODY */ }
-
-    logic_error& logic_error::operator=(const logic_error& other)
-    {
-        if (what_)
-            free(what_);
-        what_ = ::helenos::str_dup(other.what_);
-
-        return *this;
-    }
-
-    logic_error::~logic_error()
-    {
-        free(what_);
-    }
-
-    const char* logic_error::what() const noexcept
-    {
-        return what_;
-    }
-
-    domain_error::domain_error(const string& what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    domain_error::domain_error(const char* what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    domain_error::domain_error(const domain_error& other) noexcept
-        : logic_error{other}
-    { /* DUMMY BODY */ }
-
-    invalid_argument::invalid_argument(const string& what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    invalid_argument::invalid_argument(const char* what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    invalid_argument::invalid_argument(const invalid_argument& other) noexcept
-        : logic_error{other}
-    { /* DUMMY BODY */ }
-
-    length_error::length_error(const string& what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    length_error::length_error(const char* what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    length_error::length_error(const length_error& other) noexcept
-        : logic_error{other}
-    { /* DUMMY BODY */ }
-
-    out_of_range::out_of_range(const string& what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    out_of_range::out_of_range(const char* what)
-        : logic_error{what}
-    { /* DUMMY BODY */ }
-
-    out_of_range::out_of_range(const out_of_range& other) noexcept
-        : logic_error{other}
-    { /* DUMMY BODY */ }
-
-    runtime_error::runtime_error(const string& what)
-        : what_{::helenos::str_dup(what.c_str())}
-    { /* DUMMY BODY */ }
-
-    runtime_error::runtime_error(const char* what)
-        : what_{::helenos::str_dup(what)}
-    { /* DUMMY BODY */ }
-
-    runtime_error::runtime_error(const runtime_error& other) noexcept
-        : exception{other}, what_{::helenos::str_dup(other.what_)}
-    { /* DUMMY BODY */ }
-
-    runtime_error& runtime_error::operator=(const runtime_error& other)
-    {
-        if (what_)
-            free(what_);
-        what_ = ::helenos::str_dup(other.what_);
-
-        return *this;
-    }
-
-    runtime_error::~runtime_error()
-    {
-        free(what_);
-    }
-
-    const char* runtime_error::what() const noexcept
-    {
-        return what_;
-    }
-
-    range_error::range_error(const string& what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    range_error::range_error(const char* what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    range_error::range_error(const range_error& other) noexcept
-        : runtime_error{other}
-    { /* DUMMY BODY */ }
-
-    overflow_error::overflow_error(const string& what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    overflow_error::overflow_error(const char* what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    overflow_error::overflow_error(const overflow_error& other) noexcept
-        : runtime_error{other}
-    { /* DUMMY BODY */ }
-
-    underflow_error::underflow_error(const string& what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    underflow_error::underflow_error(const char* what)
-        : runtime_error{what}
-    { /* DUMMY BODY */ }
-
-    underflow_error::underflow_error(const underflow_error& other) noexcept
-        : runtime_error{other}
-    { /* DUMMY BODY */ }
-}
Index: pace/lib/cpp/src/string.cpp
===================================================================
--- uspace/lib/cpp/src/string.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,365 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cassert>
-#include <string>
-
-namespace std
-{
-    int stoi(const string& str, size_t* idx, int base)
-    {
-        // TODO: implement using stol once we have numeric limits
-        __unimplemented();
-        return 0;
-    }
-
-    long stol(const string& str, size_t* idx, int base)
-    {
-        char* end;
-        long result = ::strtol(str.c_str(), &end, base);
-
-        if (end != str.c_str())
-        {
-            if (idx)
-                *idx = static_cast<size_t>(end - str.c_str());
-            return result;
-        }
-        // TODO: no conversion -> invalid_argument
-        // TODO: ERANGE in errno -> out_of_range
-        return 0;
-    }
-
-    unsigned long stoul(const string& str, size_t* idx, int base)
-    {
-        char* end;
-        unsigned long result = ::strtoul(str.c_str(), &end, base);
-
-        if (end != str.c_str())
-        {
-            if (idx)
-                *idx = static_cast<size_t>(end - str.c_str());
-            return result;
-        }
-        // TODO: no conversion -> invalid_argument
-        // TODO: ERANGE in errno -> out_of_range
-        return 0;
-    }
-
-    long long stoll(const string& str, size_t* idx, int base)
-    {
-        // TODO: implement using stol once we have numeric limits
-        __unimplemented();
-        return 0;
-    }
-
-    unsigned long long stoull(const string& str, size_t* idx, int base)
-    {
-        // TODO: implement using stoul once we have numeric limits
-        __unimplemented();
-        return 0;
-    }
-
-    float stof(const string& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.f;
-    }
-
-    double stod(const string& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.0;
-    }
-
-    long double stold(const string& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.0l;
-    }
-
-    string to_string(int val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%d", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(unsigned val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%u", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(long val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%ld", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(unsigned long val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%lu", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(long long val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%lld", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(unsigned long long val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%llu", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(float val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%f", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(double val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%f", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    string to_string(long double val)
-    {
-        char* tmp;
-        ::asprintf(&tmp, "%Lf", val);
-
-        std::string res{tmp};
-        free(tmp);
-
-        return res;
-    }
-
-    int stoi(const wstring& str, size_t* idx, int base)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0;
-    }
-
-    long stol(const wstring& str, size_t* idx, int base)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0;
-    }
-
-    unsigned long stoul(const wstring& str, size_t* idx, int base)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0;
-    }
-
-    long long stoll(const wstring& str, size_t* idx, int base)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0;
-    }
-
-    unsigned long long stoull(const wstring& str, size_t* idx, int base)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0;
-    }
-
-    float stof(const wstring& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.f;
-    }
-
-    double stod(const wstring& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.0;
-    }
-
-    long double stold(const wstring& str, size_t* idx)
-    {
-        // TODO: implement
-        __unimplemented();
-        return 0.0l;
-    }
-
-    wstring to_wstring(int val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(unsigned val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(long val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(unsigned long val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(long long val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(unsigned long long val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(float val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(double val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    wstring to_wstring(long double val)
-    {
-        // TODO: implement
-        __unimplemented();
-        return wstring{};
-    }
-
-    /**
-     * 21.7, suffix for basic_string literals:
-     */
-
-    /**
-     * Note: According to the standard, literal suffixes that do not
-     *       start with an underscore are reserved for future standardization,
-     *       but since we are implementing the standard, we're going to ignore it.
-     *       This should work (according to their documentation) work for clang,
-     *       but that should be tested.
-     */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wliteral-suffix"
-inline namespace literals {
-inline namespace string_literals
-{
-    string operator "" s(const char* str, size_t len)
-    {
-        return string{str, len};
-    }
-
-    u16string operator "" s(const char16_t* str, size_t len)
-    {
-        return u16string{str, len};
-    }
-
-    u32string operator "" s(const char32_t* str, size_t len)
-    {
-        return u32string{str, len};
-    }
-
-    /* Problem: wchar_t == int in HelenOS, but standard forbids it.
-    wstring operator "" s(const wchar_t* str, size_t len)
-    {
-        return wstring{str, len};
-    }
-    */
-}}
-#pragma GCC diagnostic pop
-}
Index: pace/lib/cpp/src/system_error.cpp
===================================================================
--- uspace/lib/cpp/src/system_error.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,295 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cstring>
-#include <functional>
-#include <string>
-#include <system_error>
-
-namespace std
-{
-    error_category::~error_category()
-    { /* DUMMY BODY */ }
-
-    error_condition error_category::default_error_condition(int code) const noexcept
-    {
-        return error_condition{code, *this};
-    }
-
-    bool error_category::equivalent(int code, const error_condition& cond) const noexcept
-    {
-        return default_error_condition(code) == cond;
-    }
-
-    bool error_category::equivalent(const error_code& ec, int cond) const noexcept
-    {
-        return *this == ec.category() && ec.value() == cond;
-    }
-
-    bool error_category::operator==(const error_category& rhs) const noexcept
-    {
-        return this == &rhs;
-    }
-
-    bool error_category::operator!=(const error_category& rhs) const noexcept
-    {
-        return !(*this == rhs);
-    }
-
-    bool error_category::operator<(const error_category& rhs) const noexcept
-    {
-        return less<const error_category*>{}(this, &rhs);
-    }
-
-    namespace aux
-    {
-        class generic_category_t: public error_category
-        {
-            public:
-                generic_category_t()
-                    : error_category{}
-                { /* DUMMY BODY */ }
-
-                ~generic_category_t() = default;
-
-                const char* name() const noexcept override
-                {
-                    return "generic";
-                }
-
-                string message(int ev) const override
-                {
-                    return "ev: " + std::to_string(ev);
-                }
-        };
-
-        class system_category_t: public error_category
-        {
-            public:
-                system_category_t()
-                    : error_category{}
-                { /* DUMMY BODY */ }
-
-                ~system_category_t() = default;
-
-                const char* name() const noexcept override
-                {
-                    return "system";
-                }
-
-                string message(int ev) const override
-                {
-                    return "ev: " + std::to_string(ev);
-                }
-        };
-    }
-
-    const error_category& generic_category() noexcept
-    {
-        static aux::generic_category_t instance{};
-
-        return instance;
-    }
-
-    const error_category& system_category() noexcept
-    {
-        static aux::system_category_t instance{};
-
-        return instance;
-    }
-
-    error_code::error_code() noexcept
-        : val_{}, cat_{&system_category()}
-    { /* DUMMY BODY */ }
-
-    error_code::error_code(int val, const error_category& cat) noexcept
-        : val_{val}, cat_{&cat}
-    { /* DUMMY BODY */ }
-
-    void error_code::assign(int val, const error_category& cat) noexcept
-    {
-        val_ = val;
-        cat_ = &cat;
-    }
-
-    void error_code::clear() noexcept
-    {
-        val_ = 0;
-        cat_ = &system_category();
-    }
-
-    int error_code::value() const noexcept
-    {
-        return val_;
-    }
-
-    const error_category& error_code::category() const noexcept
-    {
-        return *cat_;
-    }
-
-    error_condition error_code::default_error_condition() const noexcept
-    {
-        return cat_->default_error_condition(val_);
-    }
-
-    string error_code::message() const
-    {
-        return cat_->message(val_);
-    }
-
-    error_code make_error_code(errc e) noexcept
-    {
-        return error_code{static_cast<int>(e), generic_category()};
-    }
-
-    bool operator<(const error_code& lhs, const error_code& rhs) noexcept
-    {
-        return lhs.category() < rhs.category() ||
-            (lhs.category() == rhs.category() && lhs.value() < rhs.value());
-    }
-
-    error_condition::error_condition() noexcept
-        : val_{}, cat_{&generic_category()}
-    { /* DUMMY BODY */ }
-
-    error_condition::error_condition(int val, const error_category& cat) noexcept
-        : val_{val}, cat_{&cat}
-    { /* DUMMY BODY */ }
-
-    void error_condition::assign(int val, const error_category& cat) noexcept
-    {
-        val_ = val;
-        cat_ = &cat;
-    }
-
-    void error_condition::clear() noexcept
-    {
-        val_ = 0;
-        cat_ = &generic_category();
-    }
-
-    int error_condition::value() const noexcept
-    {
-        return val_;
-    }
-
-    const error_category& error_condition::category() const noexcept
-    {
-        return *cat_;
-    }
-
-    string error_condition::message() const
-    {
-        return cat_->message(val_);
-    }
-
-    error_condition make_error_condition(errc e) noexcept
-    {
-        return error_condition{static_cast<int>(e), generic_category()};
-    }
-
-    bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept
-    {
-        return lhs.category() < rhs.category() ||
-            (lhs.category() == rhs.category() && lhs.value() < rhs.value());
-    }
-
-    bool operator==(const error_code& lhs, const error_code& rhs) noexcept
-    {
-        return lhs.category() == rhs.category() && lhs.value() == rhs.value();
-    }
-
-    bool operator==(const error_code& lhs, const error_condition& rhs) noexcept
-    {
-        return lhs.category().equivalent(lhs.value(), rhs)
-            || rhs.category().equivalent(lhs, rhs.value());
-    }
-
-    bool operator==(const error_condition& lhs, const error_code& rhs) noexcept
-    {
-        return rhs.category().equivalent(rhs.value(), lhs)
-            || lhs.category().equivalent(rhs, lhs.value());
-    }
-
-    bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept
-    {
-        return lhs.category() == rhs.category() && lhs.value() == rhs.value();
-    }
-
-    bool operator!=(const error_code& lhs, const error_code& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    system_error::system_error(error_code ec, const string& what_arg)
-        : runtime_error{what_arg.c_str()}, code_{ec}
-    { /* DUMMY BODY */ }
-
-    system_error::system_error(error_code ec, const char* what_arg)
-        : runtime_error{what_arg}, code_{ec}
-    { /* DUMMY BODY */ }
-
-    system_error::system_error(error_code ec)
-        : runtime_error{"system_error"}, code_{ec}
-    { /* DUMMY BODY */ }
-
-    system_error::system_error(int code, const error_category& cat,
-                               const string& what_arg)
-        : runtime_error{what_arg.c_str()}, code_{code, cat}
-    { /* DUMMY BODY */ }
-
-    system_error::system_error(int code, const error_category& cat,
-                               const char* what_arg)
-        : runtime_error{what_arg}, code_{code, cat}
-    { /* DUMMY BODY */ }
-
-    system_error::system_error(int code, const error_category& cat)
-        : runtime_error{"system_error"}, code_{code, cat}
-    { /* DUMMY BODY */ }
-
-    const error_code& system_error::code() const noexcept
-    {
-        return code_;
-    }
-}
Index: pace/lib/cpp/src/thread.cpp
===================================================================
--- uspace/lib/cpp/src/thread.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2019 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cassert>
-#include <cstdlib>
-#include <exception>
-#include <thread>
-#include <utility>
-
-namespace std
-{
-    thread::thread() noexcept
-        : id_{}
-    { /* DUMMY BODY */ }
-
-    thread::~thread()
-    {
-        // TODO: investigate joinable() in detail
-        //       + std::terminate behaves weirdly on HelenOS
-        if (joinable() && false)
-            std::terminate();
-
-        // TODO: check for finished too?
-        // TODO: WAIT! if it's not detached, then
-        //       we are joinable and std::terminate was called?
-        // TODO: review this entire thing
-        if (joinable_wrapper_ && !joinable_wrapper_->detached())
-            delete joinable_wrapper_;
-    }
-
-    thread::thread(thread&& other) noexcept
-        : id_{other.id_}, joinable_wrapper_{other.joinable_wrapper_}
-    {
-        other.id_ = aux::thread_t{};
-        other.joinable_wrapper_ = nullptr;
-    }
-
-    thread& thread::operator=(thread&& other) noexcept
-    {
-        if (joinable())
-            std::terminate();
-
-        id_ = other.id_;
-        other.id_ = aux::thread_t{};
-
-        joinable_wrapper_ = other.joinable_wrapper_;
-        other.joinable_wrapper_ = nullptr;
-
-        return *this;
-    }
-
-    void thread::swap(thread& other) noexcept
-    {
-        std::swap(id_, other.id_);
-        std::swap(joinable_wrapper_, other.joinable_wrapper_);
-    }
-
-    bool thread::joinable() const noexcept
-    {
-        return id_ != aux::thread_t{};
-    }
-
-    void thread::join()
-    {
-        if (joinable() && joinable_wrapper_)
-            joinable_wrapper_->join();
-    }
-
-    void thread::detach()
-    {
-        id_ = aux::thread_t{};
-
-        if (joinable_wrapper_)
-        {
-            joinable_wrapper_->detach();
-            joinable_wrapper_ = nullptr;
-        }
-    }
-
-    thread::id thread::get_id() const noexcept
-    {
-        return id{id_};
-    }
-
-    thread::native_handle_type thread::native_handle()
-    {
-        /**
-         * For fibrils the fid_t returned from fibril_create
-         * is a fibril_t* casted to fid_t, native handles
-         * are implementation defined so we just recast back.
-         */
-        return (native_handle_type)id_;
-    }
-
-    unsigned thread::hardware_concurrency() noexcept
-    {
-        // TODO:
-        __unimplemented();
-        return 0;
-    }
-
-    void swap(thread& x, thread& y) noexcept
-    {
-        x.swap(y);
-    }
-
-    namespace this_thread
-    {
-        thread::id get_id() noexcept
-        {
-            return thread::id{aux::threading::thread::this_thread()};
-        }
-
-        void yield() noexcept
-        {
-            aux::threading::thread::yield();
-        }
-    }
-
-    bool operator==(thread::id lhs, thread::id rhs) noexcept
-    {
-        return lhs.id_ == rhs.id_;
-    }
-
-    bool operator!=(thread::id lhs, thread::id rhs) noexcept
-    {
-        return !(lhs == rhs);
-    }
-
-    bool operator<(thread::id lhs, thread::id rhs) noexcept
-    {
-        return lhs.id_ < rhs.id_;
-    }
-
-    bool operator<=(thread::id lhs, thread::id rhs) noexcept
-    {
-        return !(rhs < lhs);
-    }
-
-    bool operator>(thread::id lhs, thread::id rhs) noexcept
-    {
-        return rhs < lhs;
-    }
-
-    bool operator>=(thread::id lhs, thread::id rhs) noexcept
-    {
-        return !(lhs < rhs);
-    }
-}
Index: pace/lib/cpp/src/typeindex.cpp
===================================================================
--- uspace/lib/cpp/src/typeindex.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <typeindex>
-
-namespace std
-{
-    type_index::type_index(const type_info& rhs) noexcept
-        : target_{&rhs}
-    { /* DUMMY BODY */ }
-
-    bool type_index::operator==(const type_index& rhs) const noexcept
-    {
-        return *target_ == *rhs.target_;
-    }
-
-    bool type_index::operator!=(const type_index& rhs) const noexcept
-    {
-        return *target_ != *rhs.target_;
-    }
-
-    bool type_index::operator<(const type_index& rhs) const noexcept
-    {
-        return target_->before(*rhs.target_);
-    }
-
-    bool type_index::operator<=(const type_index& rhs) const noexcept
-    {
-        return !rhs.target_->before(*target_);
-    }
-
-    bool type_index::operator>(const type_index& rhs) const noexcept
-    {
-        return rhs.target_->before(*target_);
-    }
-
-    bool type_index::operator>=(const type_index& rhs) const noexcept
-    {
-        return !target_->before(*rhs.target_);
-    }
-
-    size_t type_index::hash_code() const noexcept
-    {
-        return target_->hash_code();
-    }
-
-    const char* type_index::name() const noexcept
-    {
-        return target_->name();
-    }
-}
Index: pace/lib/cpp/src/typeinfo.cpp
===================================================================
--- uspace/lib/cpp/src/typeinfo.cpp	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2018 Jaroslav Jindrak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <cstring>
-#include <typeinfo>
-
-namespace std
-{
-
-    type_info::~type_info()
-    { /* DUMMY BODY */ }
-
-    bool type_info::operator==(const type_info& other) const noexcept
-    {
-        return (this == &other) || ::strcmp(name(), other.name()) == 0;
-    }
-
-    bool type_info::operator!=(const type_info& other) const noexcept
-    {
-        return !(*this == other);
-    }
-
-    bool type_info::before(const type_info& other) const noexcept
-    {
-        /**
-         * cppreference.com:
-         *  Returns true if the type of this type_info precedes the type
-         *  of rhs in the implementation's collation order. No guarantees
-         *  are given; in particular, the collation order can change
-         *  between the invocations of the same program.
-         *
-         * Seems completely arbitrary and the only guarantee
-         * we have to provide that two comparisons of two same
-         * type_info instances return the same result.
-         */
-        return name() < other.name();
-    }
-
-    size_t type_info::hash_code() const noexcept
-    {
-        /**
-         * We only need for the hash codes of two type_info
-         * instances describing the same type to match, nothing
-         * else.
-         */
-        size_t res{};
-        const char* str = name();
-        while(*str)
-            res += static_cast<size_t>(*str++);
-
-        return res;
-    }
-
-    const char* type_info::name() const noexcept
-    {
-        return __name;
-    }
-}
Index: pace/lib/crypto/aes.c
===================================================================
--- uspace/lib/crypto/aes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,551 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file aes.c
- *
- * Implementation of AES-128 symmetric cipher cryptographic algorithm.
- *
- * Based on FIPS 197.
- */
-
-#include <stdbool.h>
-#include <errno.h>
-#include <mem.h>
-#include "crypto.h"
-
-/* Number of elements in rows/columns in AES arrays. */
-#define ELEMS  4
-
-/* Number of elements (words) in cipher. */
-#define CIPHER_ELEMS  4
-
-/* Length of AES block. */
-#define BLOCK_LEN  16
-
-/* Number of iterations in AES algorithm. */
-#define ROUNDS  10
-
-/** Irreducible polynomial used in AES algorithm.
- *
- * NOTE: x^8 + x^4 + x^3 + x + 1.
- *
- */
-#define AES_IP  0x1b
-
-/** Precomputed values for AES sub_byte transformation. */
-static const uint8_t sbox[BLOCK_LEN][BLOCK_LEN] = {
-	{
-		0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
-		0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76
-	},
-	{
-		0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
-		0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0
-	},
-	{
-		0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
-		0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15
-	},
-	{
-		0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
-		0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75
-	},
-	{
-		0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
-		0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84
-	},
-	{
-		0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
-		0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf
-	},
-	{
-		0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
-		0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8
-	},
-	{
-		0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
-		0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2
-	},
-	{
-		0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
-		0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73
-	},
-	{
-		0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
-		0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb
-	},
-	{
-		0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
-		0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79
-	},
-	{
-		0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
-		0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08
-	},
-	{
-		0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
-		0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a
-	},
-	{
-		0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
-		0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e
-	},
-	{
-		0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
-		0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf
-	},
-	{
-		0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
-		0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
-	}
-};
-
-/** Precomputed values for AES inv_sub_byte transformation. */
-static uint8_t inv_sbox[BLOCK_LEN][BLOCK_LEN] = {
-	{
-		0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38,
-		0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
-	},
-	{
-		0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
-		0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
-	},
-	{
-		0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d,
-		0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
-	},
-	{
-		0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2,
-		0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25
-	},
-	{
-		0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16,
-		0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92
-	},
-	{
-		0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda,
-		0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84
-	},
-	{
-		0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a,
-		0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06
-	},
-	{
-		0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02,
-		0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b
-	},
-	{
-		0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea,
-		0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73
-	},
-	{
-		0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85,
-		0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e
-	},
-	{
-		0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89,
-		0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b
-	},
-	{
-		0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20,
-		0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4
-	},
-	{
-		0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31,
-		0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f
-	},
-	{
-		0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d,
-		0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef
-	},
-	{
-		0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0,
-		0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
-	},
-	{
-		0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26,
-		0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
-	}
-};
-
-/** Precomputed values of powers of 2 in GF(2^8) left shifted by 24b. */
-static const uint32_t r_con_array[] = {
-	0x01000000, 0x02000000, 0x04000000, 0x08000000,
-	0x10000000, 0x20000000, 0x40000000, 0x80000000,
-	0x1b000000, 0x36000000
-};
-
-/** Perform substitution transformation on given byte.
- *
- * @param byte Input byte.
- * @param inv  Flag indicating whether to use inverse table.
- *
- * @return Substituted value.
- *
- */
-static uint8_t sub_byte(uint8_t byte, bool inv)
-{
-	uint8_t i = byte >> 4;
-	uint8_t j = byte & 0xF;
-
-	if (!inv)
-		return sbox[i][j];
-
-	return inv_sbox[i][j];
-}
-
-/** Perform substitution transformation on state table.
- *
- * @param state State table to be modified.
- * @param inv   Flag indicating whether to use inverse table.
- *
- */
-static void sub_bytes(uint8_t state[ELEMS][ELEMS], bool inv)
-{
-	uint8_t val;
-
-	for (size_t i = 0; i < ELEMS; i++) {
-		for (size_t j = 0; j < ELEMS; j++) {
-			val = state[i][j];
-			state[i][j] = sub_byte(val, inv);
-		}
-	}
-}
-
-/** Perform shift rows transformation on state table.
- *
- * @param state State table to be modified.
- *
- */
-static void shift_rows(uint8_t state[ELEMS][ELEMS])
-{
-	uint8_t temp[ELEMS];
-
-	for (size_t i = 1; i < ELEMS; i++) {
-		memcpy(temp, state[i], i);
-		memmove(state[i], state[i] + i, ELEMS - i);
-		memcpy(state[i] + ELEMS - i, temp, i);
-	}
-}
-
-/** Perform inverted shift rows transformation on state table.
- *
- * @param state State table to be modified.
- *
- */
-static void inv_shift_rows(uint8_t state[ELEMS][ELEMS])
-{
-	uint8_t temp[ELEMS];
-
-	for (size_t i = 1; i < ELEMS; i++) {
-		memcpy(temp, state[i], ELEMS - i);
-		memmove(state[i], state[i] + ELEMS - i, i);
-		memcpy(state[i] + i, temp, ELEMS - i);
-	}
-}
-
-/** Multiplication in GF(2^8).
- *
- * @param x First factor.
- * @param y Second factor.
- *
- * @return Multiplication of given factors in GF(2^8).
- *
- */
-static uint8_t galois_mult(uint8_t x, uint8_t y)
-{
-	uint8_t result = 0;
-	uint8_t f_bith;
-
-	for (size_t i = 0; i < 8; i++) {
-		if (y & 1)
-			result ^= x;
-
-		f_bith = (x & 0x80);
-		x <<= 1;
-
-		if (f_bith)
-			x ^= AES_IP;
-
-		y >>= 1;
-	}
-
-	return result;
-}
-
-/** Perform mix columns transformation on state table.
- *
- * @param state State table to be modified.
- *
- */
-static void mix_columns(uint8_t state[ELEMS][ELEMS])
-{
-	uint8_t orig_state[ELEMS][ELEMS];
-	memcpy(orig_state, state, BLOCK_LEN);
-
-	for (size_t j = 0; j < ELEMS; j++) {
-		state[0][j] =
-		    galois_mult(0x2, orig_state[0][j]) ^
-		    galois_mult(0x3, orig_state[1][j]) ^
-		    orig_state[2][j] ^
-		    orig_state[3][j];
-		state[1][j] =
-		    orig_state[0][j] ^
-		    galois_mult(0x2, orig_state[1][j]) ^
-		    galois_mult(0x3, orig_state[2][j]) ^
-		    orig_state[3][j];
-		state[2][j] =
-		    orig_state[0][j] ^
-		    orig_state[1][j] ^
-		    galois_mult(0x2, orig_state[2][j]) ^
-		    galois_mult(0x3, orig_state[3][j]);
-		state[3][j] =
-		    galois_mult(0x3, orig_state[0][j]) ^
-		    orig_state[1][j] ^
-		    orig_state[2][j] ^
-		    galois_mult(0x2, orig_state[3][j]);
-	}
-}
-
-/** Perform inverted mix columns transformation on state table.
- *
- * @param state State table to be modified.
- *
- */
-static void inv_mix_columns(uint8_t state[ELEMS][ELEMS])
-{
-	uint8_t orig_state[ELEMS][ELEMS];
-	memcpy(orig_state, state, BLOCK_LEN);
-
-	for (size_t j = 0; j < ELEMS; j++) {
-		state[0][j] =
-		    galois_mult(0x0e, orig_state[0][j]) ^
-		    galois_mult(0x0b, orig_state[1][j]) ^
-		    galois_mult(0x0d, orig_state[2][j]) ^
-		    galois_mult(0x09, orig_state[3][j]);
-		state[1][j] =
-		    galois_mult(0x09, orig_state[0][j]) ^
-		    galois_mult(0x0e, orig_state[1][j]) ^
-		    galois_mult(0x0b, orig_state[2][j]) ^
-		    galois_mult(0x0d, orig_state[3][j]);
-		state[2][j] =
-		    galois_mult(0x0d, orig_state[0][j]) ^
-		    galois_mult(0x09, orig_state[1][j]) ^
-		    galois_mult(0x0e, orig_state[2][j]) ^
-		    galois_mult(0x0b, orig_state[3][j]);
-		state[3][j] =
-		    galois_mult(0x0b, orig_state[0][j]) ^
-		    galois_mult(0x0d, orig_state[1][j]) ^
-		    galois_mult(0x09, orig_state[2][j]) ^
-		    galois_mult(0x0e, orig_state[3][j]);
-	}
-}
-
-/** Perform round key transformation on state table.
- *
- * @param state     State table to be modified.
- * @param round_key Round key to be applied on state table.
- *
- */
-static void add_round_key(uint8_t state[ELEMS][ELEMS], uint32_t *round_key)
-{
-	uint8_t byte_round;
-	uint8_t shift;
-	uint32_t mask = 0xff;
-
-	for (size_t j = 0; j < ELEMS; j++) {
-		for (size_t i = 0; i < ELEMS; i++) {
-			shift = 24 - 8 * i;
-			byte_round = (round_key[j] & (mask << shift)) >> shift;
-			state[i][j] = state[i][j] ^ byte_round;
-		}
-	}
-}
-
-/** Perform substitution transformation on given word.
- *
- * @param byte Input word.
- *
- * @return Substituted word.
- *
- */
-static uint32_t sub_word(uint32_t word)
-{
-	uint32_t temp = word;
-	uint8_t *start = (uint8_t *) &temp;
-
-	for (size_t i = 0; i < 4; i++)
-		*(start + i) = sub_byte(*(start + i), false);
-
-	return temp;
-}
-
-/** Perform left rotation by one byte on given word.
- *
- * @param byte Input word.
- *
- * @return Rotated word.
- *
- */
-static uint32_t rot_word(uint32_t word)
-{
-	return (word << 8 | word >> 24);
-}
-
-/** Key expansion procedure for AES algorithm.
- *
- * @param key     Input key.
- * @param key_exp Result key expansion.
- *
- */
-static void key_expansion(uint8_t *key, uint32_t *key_exp)
-{
-	uint32_t temp;
-
-	for (size_t i = 0; i < CIPHER_ELEMS; i++) {
-		key_exp[i] =
-		    (key[4 * i] << 24) +
-		    (key[4 * i + 1] << 16) +
-		    (key[4 * i + 2] << 8) +
-		    (key[4 * i + 3]);
-	}
-
-	for (size_t i = CIPHER_ELEMS; i < ELEMS * (ROUNDS + 1); i++) {
-		temp = key_exp[i - 1];
-
-		if ((i % CIPHER_ELEMS) == 0) {
-			temp = sub_word(rot_word(temp)) ^
-			    r_con_array[i / CIPHER_ELEMS - 1];
-		}
-
-		key_exp[i] = key_exp[i - CIPHER_ELEMS] ^ temp;
-	}
-}
-
-/** AES-128 encryption algorithm.
- *
- * @param key    Input key.
- * @param input  Input data sequence to be encrypted.
- * @param output Encrypted data sequence.
- *
- * @return EINVAL when input or key not specified,
- *         ENOMEM when pointer for output is not allocated,
- *         otherwise EOK.
- *
- */
-errno_t aes_encrypt(uint8_t *key, uint8_t *input, uint8_t *output)
-{
-	if ((!key) || (!input))
-		return EINVAL;
-
-	if (!output)
-		return ENOMEM;
-
-	/* Create key expansion. */
-	uint32_t key_exp[ELEMS * (ROUNDS + 1)];
-	key_expansion(key, key_exp);
-
-	/* Copy input into state array. */
-	uint8_t state[ELEMS][ELEMS];
-	for (size_t i = 0; i < ELEMS; i++) {
-		for (size_t j = 0; j < ELEMS; j++)
-			state[i][j] = input[i + ELEMS * j];
-	}
-
-	/* Processing loop. */
-	add_round_key(state, key_exp);
-
-	for (size_t k = 1; k <= ROUNDS; k++) {
-		sub_bytes(state, false);
-		shift_rows(state);
-
-		if (k < ROUNDS)
-			mix_columns(state);
-
-		add_round_key(state, key_exp + k * ELEMS);
-	}
-
-	/* Copy state array into output. */
-	for (size_t i = 0; i < ELEMS; i++) {
-		for (size_t j = 0; j < ELEMS; j++)
-			output[i + j * ELEMS] = state[i][j];
-	}
-
-	return EOK;
-}
-
-/** AES-128 decryption algorithm.
- *
- * @param key    Input key.
- * @param input  Input data sequence to be decrypted.
- * @param output Decrypted data sequence.
- *
- * @return EINVAL when input or key not specified,
- *         ENOMEM when pointer for output is not allocated,
- *         otherwise EOK.
- *
- */
-errno_t aes_decrypt(uint8_t *key, uint8_t *input, uint8_t *output)
-{
-	if ((!key) || (!input))
-		return EINVAL;
-
-	if (!output)
-		return ENOMEM;
-
-	/* Create key expansion. */
-	uint32_t key_exp[ELEMS * (ROUNDS + 1)];
-	key_expansion(key, key_exp);
-
-	/* Copy input into state array. */
-	uint8_t state[ELEMS][ELEMS];
-	for (size_t i = 0; i < ELEMS; i++) {
-		for (size_t j = 0; j < ELEMS; j++)
-			state[i][j] = input[i + ELEMS * j];
-	}
-
-	/* Processing loop. */
-	add_round_key(state, key_exp + ROUNDS * ELEMS);
-
-	for (int k = ROUNDS - 1; k >= 0; k--) {
-		inv_shift_rows(state);
-		sub_bytes(state, true);
-		add_round_key(state, key_exp + k * ELEMS);
-
-		if (k > 0)
-			inv_mix_columns(state);
-	}
-
-	/* Copy state array into output. */
-	for (size_t i = 0; i < ELEMS; i++) {
-		for (size_t j = 0; j < ELEMS; j++)
-			output[i + j * ELEMS] = state[i][j];
-	}
-
-	return EOK;
-}
Index: pace/lib/crypto/crc16_ibm.c
===================================================================
--- uspace/lib/crypto/crc16_ibm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2015 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file crc16_ibm.c
- *
- * Implementation of CRC16-IBM (polynomial = 0xA001)
- *
- */
-
-#include "crypto.h"
-
-static const uint16_t crct[256] = {
-	0x0000,	0xc0c1,	0xc181,	0x0140,	0xc301,	0x03c0,	0x0280,	0xc241,
-	0xc601,	0x06c0,	0x0780,	0xc741,	0x0500,	0xc5c1,	0xc481,	0x0440,
-	0xcc01,	0x0cc0,	0x0d80,	0xcd41,	0x0f00,	0xcfc1,	0xce81,	0x0e40,
-	0x0a00,	0xcac1,	0xcb81,	0x0b40,	0xc901,	0x09c0,	0x0880,	0xc841,
-	0xd801,	0x18c0,	0x1980,	0xd941,	0x1b00,	0xdbc1,	0xda81,	0x1a40,
-	0x1e00,	0xdec1,	0xdf81,	0x1f40,	0xdd01,	0x1dc0,	0x1c80,	0xdc41,
-	0x1400,	0xd4c1,	0xd581,	0x1540,	0xd701,	0x17c0,	0x1680,	0xd641,
-	0xd201,	0x12c0,	0x1380,	0xd341,	0x1100,	0xd1c1,	0xd081,	0x1040,
-	0xf001,	0x30c0,	0x3180,	0xf141,	0x3300,	0xf3c1,	0xf281,	0x3240,
-	0x3600,	0xf6c1,	0xf781,	0x3740,	0xf501,	0x35c0,	0x3480,	0xf441,
-	0x3c00,	0xfcc1,	0xfd81,	0x3d40,	0xff01,	0x3fc0,	0x3e80,	0xfe41,
-	0xfa01,	0x3ac0,	0x3b80,	0xfb41,	0x3900,	0xf9c1,	0xf881,	0x3840,
-	0x2800,	0xe8c1,	0xe981,	0x2940,	0xeb01,	0x2bc0,	0x2a80,	0xea41,
-	0xee01,	0x2ec0,	0x2f80,	0xef41,	0x2d00,	0xedc1,	0xec81,	0x2c40,
-	0xe401,	0x24c0,	0x2580,	0xe541,	0x2700,	0xe7c1,	0xe681,	0x2640,
-	0x2200,	0xe2c1,	0xe381,	0x2340,	0xe101,	0x21c0,	0x2080,	0xe041,
-	0xa001,	0x60c0,	0x6180,	0xa141,	0x6300,	0xa3c1,	0xa281,	0x6240,
-	0x6600,	0xa6c1,	0xa781,	0x6740,	0xa501,	0x65c0,	0x6480,	0xa441,
-	0x6c00,	0xacc1,	0xad81,	0x6d40,	0xaf01,	0x6fc0,	0x6e80,	0xae41,
-	0xaa01,	0x6ac0,	0x6b80,	0xab41,	0x6900,	0xa9c1,	0xa881,	0x6840,
-	0x7800,	0xb8c1,	0xb981,	0x7940,	0xbb01,	0x7bc0,	0x7a80,	0xba41,
-	0xbe01,	0x7ec0,	0x7f80,	0xbf41,	0x7d00,	0xbdc1,	0xbc81,	0x7c40,
-	0xb401,	0x74c0,	0x7580,	0xb541,	0x7700,	0xb7c1,	0xb681,	0x7640,
-	0x7200,	0xb2c1,	0xb381,	0x7340,	0xb101,	0x71c0,	0x7080,	0xb041,
-	0x5000,	0x90c1,	0x9181,	0x5140,	0x9301,	0x53c0,	0x5280,	0x9241,
-	0x9601,	0x56c0,	0x5780,	0x9741,	0x5500,	0x95c1,	0x9481,	0x5440,
-	0x9c01,	0x5cc0,	0x5d80,	0x9d41,	0x5f00,	0x9fc1,	0x9e81,	0x5e40,
-	0x5a00,	0x9ac1,	0x9b81,	0x5b40,	0x9901,	0x59c0,	0x5880,	0x9841,
-	0x8801,	0x48c0,	0x4980,	0x8941,	0x4b00,	0x8bc1,	0x8a81,	0x4a40,
-	0x4e00,	0x8ec1,	0x8f81,	0x4f40,	0x8d01,	0x4dc0,	0x4c80,	0x8c41,
-	0x4400,	0x84c1,	0x8581,	0x4540,	0x8701,	0x47c0,	0x4680,	0x8641,
-	0x8201,	0x42c0,	0x4380,	0x8341,	0x4100,	0x81c1,	0x8081,	0x4040
-};
-
-/*
- * Compute a CRC16
- *
- * @param crc    Init value of the CRC
- * @param buf    Pointer to the data
- * @param len    Size of the buffer
- *
- * @return       Value of the CRC.
- */
-uint16_t crc16_ibm(uint16_t crc, uint8_t *buf, size_t len)
-{
-	while (len--) {
-		crc ^= *buf++;
-		crc = (crc >> 8) ^ crct[crc & 0x00FF];
-	}
-
-	return crc;
-}
Index: pace/lib/crypto/crypto.c
===================================================================
--- uspace/lib/crypto/crypto.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,367 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file crypto.c
- *
- * Cryptographic functions library.
- */
-
-#include <assert.h>
-#include <str.h>
-#include <macros.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <limits.h>
-#include "crypto.h"
-
-/** Hash function procedure definition. */
-typedef void (*hash_fnc_t)(uint32_t *, uint32_t *);
-
-/** Length of HMAC block. */
-#define HMAC_BLOCK_LENGTH  64
-
-/** Ceiling for uint32_t. */
-#define ceil_uint32(val) \
-	(((val) - (uint32_t) (val)) > 0 ? \
-	(uint32_t) ((val) + 1) : (uint32_t) (val))
-
-/** Floor for uint32_t. */
-#define floor_uint32(val) \
-	(((val) - (uint32_t) (val)) < 0 ? \
-	(uint32_t) ((val) - 1) : (uint32_t) (val))
-
-/** Pick value at specified index from array or zero if out of bounds. */
-#define get_at(input, size, i) \
-	((i) < (size) ? (input[i]) : 0)
-
-/** Init values used in SHA1 and MD5 functions. */
-static const uint32_t hash_init[] = {
-	0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
-};
-
-/** Shift amount array for MD5 algorithm. */
-static const uint32_t md5_shift[] = {
-	7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,  7, 12, 17, 22,
-	5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,  5,  9, 14, 20,
-	4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,  4, 11, 16, 23,
-	6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21,  6, 10, 15, 21
-};
-
-/** Substitution box for MD5 algorithm. */
-static const uint32_t md5_sbox[] = {
-	0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
-	0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
-	0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
-	0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
-	0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
-	0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
-	0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
-	0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
-	0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
-	0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
-	0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
-	0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
-	0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
-	0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
-	0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
-	0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391
-};
-
-/** Working procedure of MD5 cryptographic hash function.
- *
- * @param h         Working array with interim hash parts values.
- * @param sched_arr Input array with scheduled values from input string.
- *
- */
-static void md5_proc(uint32_t *h, uint32_t *sched_arr)
-{
-	uint32_t f, g, temp;
-	uint32_t w[HASH_MD5 / 4];
-
-	memcpy(w, h, (HASH_MD5 / 4) * sizeof(uint32_t));
-
-	for (size_t k = 0; k < 64; k++) {
-		if (k < 16) {
-			f = (w[1] & w[2]) | (~w[1] & w[3]);
-			g = k;
-		} else if ((k >= 16) && (k < 32)) {
-			f = (w[1] & w[3]) | (w[2] & ~w[3]);
-			g = (5 * k + 1) % 16;
-		} else if ((k >= 32) && (k < 48)) {
-			f = w[1] ^ w[2] ^ w[3];
-			g = (3 * k + 5) % 16;
-		} else {
-			f = w[2] ^ (w[1] | ~w[3]);
-			g = 7 * k % 16;
-		}
-
-		temp = w[3];
-		w[3] = w[2];
-		w[2] = w[1];
-		w[1] += rotl_uint32(w[0] + f + md5_sbox[k] +
-		    uint32_t_byteorder_swap(sched_arr[g]),
-		    md5_shift[k]);
-		w[0] = temp;
-	}
-
-	for (uint8_t k = 0; k < HASH_MD5 / 4; k++)
-		h[k] += w[k];
-}
-
-/** Working procedure of SHA-1 cryptographic hash function.
- *
- * @param h         Working array with interim hash parts values.
- * @param sched_arr Input array with scheduled values from input string.
- *
- */
-static void sha1_proc(uint32_t *h, uint32_t *sched_arr)
-{
-	uint32_t f, cf, temp;
-	uint32_t w[HASH_SHA1 / 4];
-
-	for (size_t k = 16; k < 80; k++) {
-		sched_arr[k] = rotl_uint32(
-		    sched_arr[k - 3] ^
-		    sched_arr[k - 8] ^
-		    sched_arr[k - 14] ^
-		    sched_arr[k - 16],
-		    1);
-	}
-
-	memcpy(w, h, (HASH_SHA1 / 4) * sizeof(uint32_t));
-
-	for (size_t k = 0; k < 80; k++) {
-		if (k < 20) {
-			f = (w[1] & w[2]) | (~w[1] & w[3]);
-			cf = 0x5A827999;
-		} else if ((k >= 20) && (k < 40)) {
-			f = w[1] ^ w[2] ^ w[3];
-			cf = 0x6ed9eba1;
-		} else if ((k >= 40) && (k < 60)) {
-			f = (w[1] & w[2]) | (w[1] & w[3]) | (w[2] & w[3]);
-			cf = 0x8f1bbcdc;
-		} else {
-			f = w[1] ^ w[2] ^ w[3];
-			cf = 0xca62c1d6;
-		}
-
-		temp = rotl_uint32(w[0], 5) + f + w[4] + cf + sched_arr[k];
-
-		w[4] = w[3];
-		w[3] = w[2];
-		w[2] = rotl_uint32(w[1], 30);
-		w[1] = w[0];
-		w[0] = temp;
-	}
-
-	for (uint8_t k = 0; k < HASH_SHA1 / 4; k++)
-		h[k] += w[k];
-}
-
-/** Create hash based on selected algorithm.
- *
- * @param input      Input message byte sequence.
- * @param input_size Size of message sequence.
- * @param output     Result hash byte sequence.
- * @param hash_sel   Hash function selector.
- *
- * @return EINVAL when input not specified,
- *         ENOMEM when pointer for output hash result
- *         is not allocated, otherwise EOK.
- *
- */
-errno_t create_hash(const uint8_t *input, size_t input_size, uint8_t *output,
-    hash_func_t hash_sel)
-{
-	assert(input_size < SSIZE_MAX);
-
-	if (!input)
-		return EINVAL;
-
-	if (!output)
-		return ENOMEM;
-
-	hash_fnc_t hash_func = (hash_sel == HASH_MD5) ? md5_proc : sha1_proc;
-
-	/* Prepare scheduled input. */
-	uint8_t work_input[input_size + 1];
-	memcpy(work_input, input, input_size);
-	work_input[input_size] = 0x80;
-
-	// FIXME: double?
-	size_t blocks = ceil_uint32((((double) input_size + 1) / 4 + 2) / 16);
-	uint32_t work_arr[blocks * 16];
-	for (size_t i = 0; i < blocks; i++) {
-		for (size_t j = 0; j < 16; j++) {
-			work_arr[i * 16 + j] =
-			    (get_at(work_input, input_size + 1, i * 64 + j * 4) << 24) |
-			    (get_at(work_input, input_size + 1, i * 64 + j * 4 + 1) << 16) |
-			    (get_at(work_input, input_size + 1, i * 64 + j * 4 + 2) << 8) |
-			    get_at(work_input, input_size + 1, i * 64 + j * 4 + 3);
-		}
-	}
-
-	uint64_t bits_size = (uint64_t) (input_size * 8);
-	if (hash_sel == HASH_MD5)
-		bits_size = uint64_t_byteorder_swap(bits_size);
-
-	work_arr[(blocks - 1) * 16 + 14] = bits_size >> 32;
-	work_arr[(blocks - 1) * 16 + 15] = bits_size & 0xffffffff;
-
-	/* Hash computation. */
-	uint32_t h[hash_sel / 4];
-	memcpy(h, hash_init, (hash_sel / 4) * sizeof(uint32_t));
-	uint32_t sched_arr[80];
-	for (size_t i = 0; i < blocks; i++) {
-		for (size_t k = 0; k < 16; k++)
-			sched_arr[k] = work_arr[i * 16 + k];
-
-		hash_func(h, sched_arr);
-	}
-
-	/* Copy hash parts into final result. */
-	for (size_t i = 0; i < hash_sel / 4; i++) {
-		if (hash_sel == HASH_SHA1)
-			h[i] = uint32_t_byteorder_swap(h[i]);
-
-		memcpy(output + i * sizeof(uint32_t), &h[i], sizeof(uint32_t));
-	}
-
-	return EOK;
-}
-
-/** Hash-based message authentication code.
- *
- * @param key      Cryptographic key sequence.
- * @param key_size Size of key sequence.
- * @param msg      Message sequence.
- * @param msg_size Size of message sequence.
- * @param hash     Output parameter for result hash.
- * @param hash_sel Hash function selector.
- *
- * @return EINVAL when key or message not specified,
- *         ENOMEM when pointer for output hash result
- *         is not allocated, otherwise EOK.
- *
- */
-errno_t hmac(uint8_t *key, size_t key_size, uint8_t *msg, size_t msg_size,
-    uint8_t *hash, hash_func_t hash_sel)
-{
-	if ((!key) || (!msg))
-		return EINVAL;
-
-	if (!hash)
-		return ENOMEM;
-
-	uint8_t work_key[HMAC_BLOCK_LENGTH];
-	uint8_t o_key_pad[HMAC_BLOCK_LENGTH];
-	uint8_t i_key_pad[HMAC_BLOCK_LENGTH];
-	uint8_t temp_hash[hash_sel];
-	memset(work_key, 0, HMAC_BLOCK_LENGTH);
-
-	if (key_size > HMAC_BLOCK_LENGTH)
-		create_hash(key, key_size, work_key, hash_sel);
-	else
-		memcpy(work_key, key, key_size);
-
-	for (size_t i = 0; i < HMAC_BLOCK_LENGTH; i++) {
-		o_key_pad[i] = work_key[i] ^ 0x5c;
-		i_key_pad[i] = work_key[i] ^ 0x36;
-	}
-
-	uint8_t temp_work[HMAC_BLOCK_LENGTH + max(msg_size, hash_sel)];
-	memcpy(temp_work, i_key_pad, HMAC_BLOCK_LENGTH);
-	memcpy(temp_work + HMAC_BLOCK_LENGTH, msg, msg_size);
-
-	create_hash(temp_work, HMAC_BLOCK_LENGTH + msg_size, temp_hash,
-	    hash_sel);
-
-	memcpy(temp_work, o_key_pad, HMAC_BLOCK_LENGTH);
-	memcpy(temp_work + HMAC_BLOCK_LENGTH, temp_hash, hash_sel);
-
-	create_hash(temp_work, HMAC_BLOCK_LENGTH + hash_sel, hash, hash_sel);
-
-	return EOK;
-}
-
-/** Password-Based Key Derivation Function 2.
- *
- * As defined in RFC 2898, using HMAC-SHA1 with 4096 iterations
- * and 32 bytes key result used for WPA/WPA2.
- *
- * @param pass      Password sequence.
- * @param pass_size Password sequence length.
- * @param salt      Salt sequence to be used with password.
- * @param salt_size Salt sequence length.
- * @param hash      Output parameter for result hash (32 byte value).
- *
- * @return EINVAL when pass or salt not specified,
- *         ENOMEM when pointer for output hash result
- *         is not allocated, otherwise EOK.
- *
- */
-errno_t pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, size_t salt_size,
-    uint8_t *hash)
-{
-	if ((!pass) || (!salt))
-		return EINVAL;
-
-	if (!hash)
-		return ENOMEM;
-
-	uint8_t work_salt[salt_size + 4];
-	memcpy(work_salt, salt, salt_size);
-	uint8_t work_hmac[HASH_SHA1];
-	uint8_t temp_hmac[HASH_SHA1];
-	uint8_t xor_hmac[HASH_SHA1];
-	uint8_t temp_hash[HASH_SHA1 * 2];
-
-	for (size_t i = 0; i < 2; i++) {
-		uint32_t be_i = host2uint32_t_be(i + 1);
-
-		memcpy(work_salt + salt_size, &be_i, 4);
-		hmac(pass, pass_size, work_salt, salt_size + 4,
-		    work_hmac, HASH_SHA1);
-		memcpy(xor_hmac, work_hmac, HASH_SHA1);
-
-		for (size_t k = 1; k < 4096; k++) {
-			memcpy(temp_hmac, work_hmac, HASH_SHA1);
-			hmac(pass, pass_size, temp_hmac, HASH_SHA1,
-			    work_hmac, HASH_SHA1);
-
-			for (size_t t = 0; t < HASH_SHA1; t++)
-				xor_hmac[t] ^= work_hmac[t];
-		}
-
-		memcpy(temp_hash + i * HASH_SHA1, xor_hmac, HASH_SHA1);
-	}
-
-	memcpy(hash, temp_hash, PBKDF2_KEY_LENGTH);
-
-	return EOK;
-}
Index: pace/lib/crypto/crypto.h
===================================================================
--- uspace/lib/crypto/crypto.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBCRYPTO_H
-#define LIBCRYPTO_H
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define AES_CIPHER_LENGTH  16
-#define PBKDF2_KEY_LENGTH  32
-
-/* Left rotation for uint32_t. */
-#define rotl_uint32(val, shift) \
-	(((val) << shift) | ((val) >> (32 - shift)))
-
-/* Right rotation for uint32_t. */
-#define rotr_uint32(val, shift) \
-	(((val) >> shift) | ((val) << (32 - shift)))
-
-/** Hash function selector and also result hash length indicator. */
-typedef enum {
-	HASH_MD5 =  16,
-	HASH_SHA1 = 20
-} hash_func_t;
-
-extern errno_t rc4(uint8_t *, size_t, uint8_t *, size_t, size_t, uint8_t *);
-extern errno_t aes_encrypt(uint8_t *, uint8_t *, uint8_t *);
-extern errno_t aes_decrypt(uint8_t *, uint8_t *, uint8_t *);
-extern errno_t create_hash(const uint8_t *, size_t, uint8_t *, hash_func_t);
-extern errno_t hmac(uint8_t *, size_t, uint8_t *, size_t, uint8_t *, hash_func_t);
-extern errno_t pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *);
-
-extern uint16_t crc16_ibm(uint16_t crc, uint8_t *buf, size_t len);
-
-#endif
Index: pace/lib/crypto/meson.build
===================================================================
--- uspace/lib/crypto/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2015 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'crypto.c',
-	'aes.c',
-	'rc4.c',
-	'crc16_ibm.c',
-)
Index: pace/lib/crypto/rc4.c
===================================================================
--- uspace/lib/crypto/rc4.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file rc4.c
- *
- * Implementation of ARC4 symmetric cipher cryptographic algorithm.
- *
- */
-
-#include <errno.h>
-#include <mem.h>
-#include "crypto.h"
-
-/* Sbox table size. */
-#define SBOX_SIZE  256
-
-/** Swap two values in sbox.
- *
- * @param i    First index of value in sbox to be swapped.
- * @param j    Second index of value in sbox to be swapped.
- * @param sbox Sbox to be modified.
- *
- */
-static void swap(size_t i, size_t j, uint8_t *sbox)
-{
-	uint8_t temp = sbox[i];
-	sbox[i] = sbox[j];
-	sbox[j] = temp;
-}
-
-/** Sbox initialization procedure.
- *
- * @param key      Input key.
- * @param key_size Size of key sequence.
- * @param sbox     Place for result sbox.
- *
- */
-static void create_sbox(uint8_t *key, size_t key_size, uint8_t *sbox)
-{
-	for (size_t i = 0; i < SBOX_SIZE; i++)
-		sbox[i] = i;
-
-	uint8_t j = 0;
-	for (size_t i = 0; i < SBOX_SIZE; i++) {
-		j = j + sbox[i] + key[i % key_size];
-		swap(i, j, sbox);
-	}
-}
-
-/** ARC4 encryption/decryption algorithm.
- *
- * @param key        Input key.
- * @param key_size   Size of key sequence.
- * @param input      Input data sequence to be processed.
- * @param input_size Size of input data sequence.
- * @param skip       Number of bytes to be skipped from
- *                   the beginning of key stream.
- * @param output     Result data sequence.
- *
- * @return EINVAL when input or key not specified,
- *         ENOMEM when pointer for output is not allocated,
- *         otherwise EOK.
- *
- */
-errno_t rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size,
-    size_t skip, uint8_t *output)
-{
-	if ((!key) || (!input))
-		return EINVAL;
-
-	if (!output)
-		return ENOMEM;
-
-	/* Initialize sbox. */
-	uint8_t sbox[SBOX_SIZE];
-	create_sbox(key, key_size, sbox);
-
-	/* Skip first x bytes. */
-	uint8_t i = 0;
-	uint8_t j = 0;
-	for (size_t k = 0; k < skip; k++) {
-		i = i + 1;
-		j = j + sbox[i];
-		swap(i, j, sbox);
-	}
-
-	/* Processing loop. */
-	uint8_t val;
-	for (size_t k = 0; k < input_size; k++) {
-		i = i + 1;
-		j = j + sbox[i];
-		swap(i, j, sbox);
-		val = sbox[sbox[i] + sbox[j]];
-		output[k] = val ^ input[k];
-	}
-
-	return EOK;
-}
Index: pace/lib/ddev/doc/doxygroups.h
===================================================================
--- uspace/lib/ddev/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libddev libddev
- * @ingroup libs
- */
Index: pace/lib/ddev/include/ddev.h
===================================================================
--- uspace/lib/ddev/include/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDDEV_DDEV_H_
-#define _LIBDDEV_DDEV_H_
-
-#include <ddev/info.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include <stdbool.h>
-#include "types/ddev.h"
-#include "types/ddev/info.h"
-
-extern errno_t ddev_open(const char *, ddev_t **);
-extern void ddev_close(ddev_t *);
-extern errno_t ddev_get_gc(ddev_t *, gfx_context_t **);
-extern errno_t ddev_get_info(ddev_t *, ddev_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/include/ddev/info.h
===================================================================
--- uspace/lib/ddev/include/ddev/info.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDDEV_DDEV_INFO_H_
-#define _LIBDDEV_DDEV_INFO_H_
-
-#include "types/ddev/info.h"
-
-extern void ddev_info_init(ddev_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/include/ddev_srv.h
===================================================================
--- uspace/lib/ddev/include/ddev_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDDEV_DDEV_SRV_H_
-#define _LIBDDEV_DDEV_SRV_H_
-
-#include <async.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include "types/ddev/info.h"
-
-typedef struct ddev_ops ddev_ops_t;
-
-/** Display device server structure (per client session) */
-typedef struct {
-	async_sess_t *client_sess;
-	ddev_ops_t *ops;
-	void *arg;
-} ddev_srv_t;
-
-struct ddev_ops {
-	errno_t (*get_gc)(void *, sysarg_t *, sysarg_t *);
-	errno_t (*get_info)(void *, ddev_info_t *);
-};
-
-extern void ddev_conn(ipc_call_t *, ddev_srv_t *);
-extern void ddev_srv_initialize(ddev_srv_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/include/ipc/ddev.h
===================================================================
--- uspace/lib/ddev/include/ipc/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDDEV_IPC_DDEV_H
-#define LIBDDEV_IPC_DDEV_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	DDEV_GET_GC = IPC_FIRST_USER_METHOD,
-	DDEV_GET_INFO
-} ddev_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/include/types/ddev.h
===================================================================
--- uspace/lib/ddev/include/types/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDDEV_TYPES_DDEV_H_
-#define _LIBDDEV_TYPES_DDEV_H_
-
-#include <async.h>
-
-/** Display server session */
-typedef struct {
-	/** Session with display device */
-	async_sess_t *sess;
-} ddev_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/include/types/ddev/info.h
===================================================================
--- uspace/lib/ddev/include/types/ddev/info.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDDEV_TYPES_DDEV_INFO_H_
-#define _LIBDDEV_TYPES_DDEV_INFO_H_
-
-#include <gfx/coord.h>
-
-/** Display device information */
-typedef struct {
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-} ddev_info_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ddev/meson.build
===================================================================
--- uspace/lib/ddev/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'ipcgfx' ]
-src = files(
-	'src/ddev.c',
-	'src/ddev_srv.c',
-	'src/info.c',
-)
-
-test_src = files(
-	'test/ddev.c',
-	'test/main.c',
-)
Index: pace/lib/ddev/src/ddev.c
===================================================================
--- uspace/lib/ddev/src/ddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <ddev.h>
-#include <errno.h>
-#include <ipc/ddev.h>
-#include <ipc/services.h>
-#include <ipcgfx/client.h>
-#include <loc.h>
-#include <stdlib.h>
-
-/** Open display device.
- *
- * @param ddname Display device service name
- * @param rdisplay Place to store pointer to display session
- * @return EOK on success or an error code
- */
-errno_t ddev_open(const char *ddname, ddev_t **rddev)
-{
-	service_id_t ddev_svc;
-	ddev_t *ddev;
-	errno_t rc;
-
-	ddev = calloc(1, sizeof(ddev_t));
-	if (ddev == NULL)
-		return ENOMEM;
-
-	rc = loc_service_get_id(ddname, &ddev_svc, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		free(ddev);
-		return ENOENT;
-	}
-
-	ddev->sess = loc_service_connect(ddev_svc, INTERFACE_DDEV,
-	    IPC_FLAG_BLOCKING);
-	if (ddev->sess == NULL) {
-		free(ddev);
-		return ENOENT;
-	}
-
-	*rddev = ddev;
-	return EOK;
-}
-
-/** Close display device.
- *
- * @param ddev Display device session
- */
-void ddev_close(ddev_t *ddev)
-{
-	async_hangup(ddev->sess);
-	free(ddev);
-}
-
-/** Create graphics context for drawing to display device.
- *
- * @param ddev Display device
- * @param rgc Place to store pointer to new graphics context
- */
-errno_t ddev_get_gc(ddev_t *ddev, gfx_context_t **rgc)
-{
-	async_sess_t *sess;
-	async_exch_t *exch;
-	sysarg_t arg2;
-	sysarg_t arg3;
-	ipc_gc_t *gc;
-	errno_t rc;
-
-	exch = async_exchange_begin(ddev->sess);
-	rc = async_req_0_2(exch, DDEV_GET_GC, &arg2, &arg3);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	sess = async_connect_me_to(exch, INTERFACE_GC, arg2, arg3, &rc);
-	async_exchange_end(exch);
-
-	if (sess == NULL)
-		return rc;
-
-	rc = ipc_gc_create(sess, &gc);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return ENOMEM;
-	}
-
-	*rgc = ipc_gc_get_ctx(gc);
-	return EOK;
-}
-
-/** Get display device information.
- *
- * @param ddev Display device
- * @param info Place to store information
- */
-errno_t ddev_get_info(ddev_t *ddev, ddev_info_t *info)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(ddev->sess);
-	aid_t req = async_send_0(exch, DDEV_GET_INFO, &answer);
-
-	errno_t rc = async_data_read_start(exch, info, sizeof(ddev_info_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/ddev/src/ddev_srv.c
===================================================================
--- uspace/lib/ddev/src/ddev_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libddev
- * @{
- */
-/**
- * @file
- * @brief Display protocol server stub
- */
-
-#include <ddev_srv.h>
-#include <errno.h>
-#include <io/log.h>
-#include <ipc/ddev.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-/** Connect to a GC.
- *
- * XXX As a workaround here we tell the client the values of arg2 and arg3
- * needed to connect to the GC using async_connect_me_to(), these need
- * to be provided by the ddev_ops_t.get_gc. Different values are needed
- * for a DDF driver or a regular server. This would not be needed if we
- * had a proper way of creating an endpoint and passing it to our client.
- */
-static void ddev_get_gc_srv(ddev_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t arg2;
-	sysarg_t arg3;
-	errno_t rc;
-
-	if (srv->ops->get_gc == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_gc(srv->arg, &arg2, &arg3);
-	async_answer_2(icall, rc, arg2, arg3);
-}
-
-/** Get display device information */
-static void ddev_get_info_srv(ddev_srv_t *srv, ipc_call_t *icall)
-{
-	ddev_info_t info;
-	errno_t rc;
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(ddev_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (srv->ops->get_info == NULL) {
-		async_answer_0(&call, ENOTSUP);
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_info(srv->arg, &info);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &info, sizeof(ddev_info_t));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-void ddev_conn(ipc_call_t *icall, ddev_srv_t *srv)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case DDEV_GET_GC:
-			ddev_get_gc_srv(srv, &call);
-			break;
-		case DDEV_GET_INFO:
-			ddev_get_info_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	/* Hang up callback session */
-	if (srv->client_sess != NULL) {
-		async_hangup(srv->client_sess);
-		srv->client_sess = NULL;
-	}
-}
-
-/** Initialize display device server structure
- *
- * @param srv Display device server structure to initialize
- */
-void ddev_srv_initialize(ddev_srv_t *srv)
-{
-	memset(srv, 0, sizeof(*srv));
-}
-
-/** @}
- */
Index: pace/lib/ddev/src/info.c
===================================================================
--- uspace/lib/ddev/src/info.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ddev/info.h>
-#include <mem.h>
-
-/** Initialize display device information structure.
- *
- * @param info Display device information structure
- */
-void ddev_info_init(ddev_info_t *info)
-{
-	memset(info, 0, sizeof(ddev_info_t));
-}
-
-/** @}
- */
Index: pace/lib/ddev/test/ddev.c
===================================================================
--- uspace/lib/ddev/test/ddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,329 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <ddev.h>
-#include <ddev_srv.h>
-#include <fibril_synch.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <ipcgfx/server.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ddev);
-
-static const char *test_ddev_server = "test-ddev";
-static const char *test_ddev_svc = "test/ddev";
-
-static void test_ddev_conn(ipc_call_t *, void *);
-
-static errno_t test_get_gc(void *, sysarg_t *, sysarg_t *);
-static errno_t test_get_info(void *, ddev_info_t *);
-static errno_t test_gc_set_color(void *, gfx_color_t *);
-
-static ddev_ops_t test_ddev_ops = {
-	.get_gc = test_get_gc,
-	.get_info = test_get_info
-};
-
-static gfx_context_ops_t test_gc_ops = {
-	.set_color = test_gc_set_color
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-	bool set_color_called;
-	ddev_srv_t *srv;
-	ddev_info_t info;
-} test_response_t;
-
-/** ddev_open(), ddev_close() work for valid display device service */
-PCUT_TEST(open_close)
-{
-	errno_t rc;
-	service_id_t sid;
-	ddev_t *ddev = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** ddev_get_gc with server returning failure */
-PCUT_TEST(dev_get_gc_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	ddev_t *ddev = NULL;
-	test_response_t resp;
-	gfx_context_t *gc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	gc = NULL;
-	resp.rc = ENOMEM;
-	rc = ddev_get_gc(ddev, &gc);
-	PCUT_ASSERT_ERRNO_VAL(ENOMEM, rc);
-	PCUT_ASSERT_NULL(gc);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** ddev_get_gc with server returning success */
-PCUT_TEST(dev_get_gc_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	ddev_t *ddev = NULL;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	resp.rc = EOK;
-	gc = NULL;
-	rc = ddev_get_gc(ddev, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.set_color_called = false;
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.set_color_called);
-
-	gfx_color_delete(color);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** ddev_get_info with server returning failure */
-PCUT_TEST(dev_get_info_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	ddev_t *ddev = NULL;
-	test_response_t resp;
-	ddev_info_t info;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	resp.rc = ENOMEM;
-	rc = ddev_get_info(ddev, &info);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** ddev_get_info with server returning success */
-PCUT_TEST(dev_get_info_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	ddev_t *ddev = NULL;
-	test_response_t resp;
-	ddev_info_t info;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ddev_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ddev_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ddev_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ddev_open(test_ddev_svc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ddev);
-
-	resp.rc = EOK;
-
-	ddev_info_init(&resp.info);
-	resp.info.rect.p0.x = 1;
-	resp.info.rect.p0.y = 2;
-	resp.info.rect.p1.x = 3;
-	resp.info.rect.p1.y = 4;
-
-	rc = ddev_get_info(ddev, &info);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_INT_EQUALS(resp.info.rect.p0.x, info.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(resp.info.rect.p0.y, info.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(resp.info.rect.p1.x, info.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(resp.info.rect.p1.y, info.rect.p1.y);
-
-	ddev_close(ddev);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Test display device connection.
- *
- * This is very similar to connection handler in the display server.
- * XXX This should be folded into display_srv, if possible
- */
-static void test_ddev_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	ddev_srv_t srv;
-	sysarg_t svc_id;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	svc_id = ipc_get_arg2(icall);
-
-	if (svc_id != 0) {
-		/* Set up protocol structure */
-		ddev_srv_initialize(&srv);
-		srv.ops = &test_ddev_ops;
-		srv.arg = arg;
-		resp->srv = &srv;
-
-		/* Handle connection */
-		ddev_conn(icall, &srv);
-
-		resp->srv = NULL;
-	} else {
-		if (resp->rc != EOK) {
-			async_answer_0(icall, resp->rc);
-			return;
-		}
-
-		rc = gfx_context_new(&test_gc_ops, arg, &gc);
-		if (rc != EOK) {
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		/* GC connection */
-		gc_conn(icall, gc);
-	}
-}
-
-static errno_t test_get_gc(void *arg, sysarg_t *arg2, sysarg_t *arg3)
-{
-	*arg2 = 0;
-	*arg3 = 42;
-	return EOK;
-}
-
-static errno_t test_get_info(void *arg, ddev_info_t *info)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*info = resp->info;
-	return EOK;
-}
-
-static errno_t test_gc_set_color(void *arg, gfx_color_t *color)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->set_color_called = true;
-	return resp->rc;
-}
-
-PCUT_EXPORT(ddev);
Index: pace/lib/ddev/test/main.c
===================================================================
--- uspace/lib/ddev/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(ddev);
-
-PCUT_MAIN();
Index: pace/lib/device/include/bd.h
===================================================================
--- uspace/lib/device/include/bd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file Block device client interface
- */
-
-#ifndef LIBDEVICE_BD_H
-#define LIBDEVICE_BD_H
-
-#include <async.h>
-#include <offset.h>
-
-typedef struct {
-	async_sess_t *sess;
-} bd_t;
-
-extern errno_t bd_open(async_sess_t *, bd_t **);
-extern void bd_close(bd_t *);
-extern errno_t bd_read_blocks(bd_t *, aoff64_t, size_t, void *, size_t);
-extern errno_t bd_read_toc(bd_t *, uint8_t, void *, size_t);
-extern errno_t bd_write_blocks(bd_t *, aoff64_t, size_t, const void *, size_t);
-extern errno_t bd_sync_cache(bd_t *, aoff64_t, size_t);
-extern errno_t bd_get_block_size(bd_t *, size_t *);
-extern errno_t bd_get_num_blocks(bd_t *, aoff64_t *);
-extern errno_t bd_eject(bd_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/bd_srv.h
===================================================================
--- uspace/lib/device/include/bd_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_BD_SRV_H
-#define LIBDEVICE_BD_SRV_H
-
-#include <adt/list.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <offset.h>
-
-typedef struct bd_ops bd_ops_t;
-
-/** Service setup (per sevice) */
-typedef struct {
-	bd_ops_t *ops;
-	void *sarg;
-} bd_srvs_t;
-
-/** Server structure (per client session) */
-typedef struct {
-	bd_srvs_t *srvs;
-	async_sess_t *client_sess;
-	void *carg;
-} bd_srv_t;
-
-struct bd_ops {
-	errno_t (*open)(bd_srvs_t *, bd_srv_t *);
-	errno_t (*close)(bd_srv_t *);
-	errno_t (*read_blocks)(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-	errno_t (*read_toc)(bd_srv_t *, uint8_t, void *, size_t);
-	errno_t (*sync_cache)(bd_srv_t *, aoff64_t, size_t);
-	errno_t (*write_blocks)(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-	errno_t (*get_block_size)(bd_srv_t *, size_t *);
-	errno_t (*get_num_blocks)(bd_srv_t *, aoff64_t *);
-	errno_t (*eject)(bd_srv_t *);
-};
-
-extern void bd_srvs_init(bd_srvs_t *);
-
-extern errno_t bd_conn(ipc_call_t *, bd_srvs_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/device/led_dev.h
===================================================================
--- uspace/lib/device/include/device/led_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_DEVICE_LED_DEV_H
-#define LIBDEVICE_DEVICE_LED_DEV_H
-
-#include <async.h>
-#include <io/pixel.h>
-
-typedef enum {
-	LED_DEV_COLOR_SET = 0
-} led_dev_method_t;
-
-extern errno_t led_dev_color_set(async_sess_t *, pixel_t);
-
-#endif
Index: pace/lib/device/include/devman.h
===================================================================
--- uspace/lib/device/include/devman.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_DEVMAN_H
-#define LIBDEVICE_DEVMAN_H
-
-#include <ipc/devman.h>
-#include <ipc/loc.h>
-#include <async.h>
-#include <stdbool.h>
-
-extern async_exch_t *devman_exchange_begin_blocking(iface_t);
-extern async_exch_t *devman_exchange_begin(iface_t);
-extern void devman_exchange_end(async_exch_t *);
-
-extern errno_t devman_driver_register(const char *);
-extern errno_t devman_add_function(const char *, fun_type_t, match_id_list_t *,
-    devman_handle_t, devman_handle_t *);
-extern errno_t devman_remove_function(devman_handle_t);
-extern errno_t devman_drv_fun_online(devman_handle_t);
-extern errno_t devman_drv_fun_offline(devman_handle_t);
-extern errno_t devman_drv_fun_quiesce(devman_handle_t);
-extern errno_t devman_drv_fun_wait_stable(devman_handle_t);
-
-extern async_sess_t *devman_device_connect(devman_handle_t, unsigned int);
-extern async_sess_t *devman_parent_device_connect(devman_handle_t,
-    unsigned int);
-
-extern errno_t devman_fun_get_handle(const char *, devman_handle_t *,
-    unsigned int);
-extern errno_t devman_fun_get_child(devman_handle_t, devman_handle_t *);
-extern errno_t devman_dev_get_parent(devman_handle_t, devman_handle_t *);
-extern errno_t devman_dev_get_functions(devman_handle_t, devman_handle_t **,
-    size_t *);
-extern errno_t devman_fun_get_match_id(devman_handle_t, size_t, char *, size_t,
-    unsigned int *);
-extern errno_t devman_fun_get_name(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_get_driver_name(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_get_path(devman_handle_t, char *, size_t);
-extern errno_t devman_fun_online(devman_handle_t);
-extern errno_t devman_fun_offline(devman_handle_t);
-extern errno_t devman_fun_quiesce(devman_handle_t);
-
-extern errno_t devman_add_device_to_category(devman_handle_t, const char *);
-extern errno_t devman_fun_sid_to_handle(service_id_t, devman_handle_t *);
-extern errno_t devman_quiesce_devices(const char *);
-extern errno_t devman_get_drivers(devman_handle_t **, size_t *);
-extern errno_t devman_driver_get_devices(devman_handle_t, devman_handle_t **,
-    size_t *);
-extern errno_t devman_driver_get_handle(const char *, devman_handle_t *);
-extern errno_t devman_driver_get_match_id(devman_handle_t, size_t, char *, size_t,
-    unsigned int *);
-extern errno_t devman_driver_get_name(devman_handle_t, char *, size_t);
-extern errno_t devman_driver_get_state(devman_handle_t, driver_state_t *);
-extern errno_t devman_driver_load(devman_handle_t);
-extern errno_t devman_driver_unload(devman_handle_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ieee80211/ieee80211.h
===================================================================
--- uspace/lib/device/include/ieee80211/ieee80211.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- *  @{
- */
-
-/** @file ieee80211.h
- *  IEEE 802.11 common definitions.
- */
-
-#ifndef LIBDEVICE_IEEE80211_H
-#define LIBDEVICE_IEEE80211_H
-
-#include <adt/list.h>
-#include <nic/nic.h>
-#include <time.h>
-
-/** Max length of scan results array. */
-#define IEEE80211_MAX_RESULTS_LENGTH  32
-
-/** Max SSID length including null character. */
-#define IEEE80211_MAX_SSID_LENGTH  35
-
-/** WiFi security authentication method indicator. */
-typedef enum {
-	IEEE80211_SECURITY_OPEN,
-	IEEE80211_SECURITY_WEP,
-	IEEE80211_SECURITY_WPA,
-	IEEE80211_SECURITY_WPA2
-} ieee80211_security_type_t;
-
-/** WiFi security suite indicator. */
-typedef enum {
-	IEEE80211_SECURITY_SUITE_WEP40,
-	IEEE80211_SECURITY_SUITE_WEP104,
-	IEEE80211_SECURITY_SUITE_CCMP,
-	IEEE80211_SECURITY_SUITE_TKIP
-} ieee80211_security_suite_t;
-
-/** WiFi security authentication method indicator. */
-typedef enum {
-	IEEE80211_SECURITY_AUTH_PSK,
-	IEEE80211_SECURITY_AUTH_8021X
-} ieee80211_security_auth_t;
-
-/** Structure for indicating security network security settings. */
-typedef struct {
-	int type;
-	int group_alg;
-	int pair_alg;
-	int auth;
-} ieee80211_security_t;
-
-/** Structure with scan result info. */
-typedef struct {
-	nic_address_t bssid;
-	char ssid[IEEE80211_MAX_SSID_LENGTH];
-	uint8_t channel;
-	ieee80211_security_t security;
-} ieee80211_scan_result_t;
-
-/** Array of scan results info. */
-typedef struct {
-	uint8_t length;
-	ieee80211_scan_result_t results[IEEE80211_MAX_RESULTS_LENGTH];
-} ieee80211_scan_results_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/io/chardev.h
===================================================================
--- uspace/lib/device/include/io/chardev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libdevice
- * @{
- */
-
-#ifndef LIBDEVICE_IO_CHARDEV_H
-#define LIBDEVICE_IO_CHARDEV_H
-
-#include <async.h>
-#include <stddef.h>
-#include <types/io/chardev.h>
-
-typedef struct {
-	async_sess_t *sess;
-} chardev_t;
-
-extern errno_t chardev_open(async_sess_t *, chardev_t **);
-extern void chardev_close(chardev_t *);
-extern errno_t chardev_read(chardev_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-extern errno_t chardev_write(chardev_t *, const void *, size_t, size_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/device/include/io/chardev_srv.h
===================================================================
--- uspace/lib/device/include/io/chardev_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IO_CHARDEV_SRV_H
-#define LIBDEVICE_IO_CHARDEV_SRV_H
-
-#include <adt/list.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <types/io/chardev.h>
-
-typedef struct chardev_ops chardev_ops_t;
-
-/** Service setup (per sevice) */
-typedef struct {
-	chardev_ops_t *ops;
-	void *sarg;
-} chardev_srvs_t;
-
-/** Server structure (per client session) */
-typedef struct {
-	chardev_srvs_t *srvs;
-	void *carg;
-} chardev_srv_t;
-
-struct chardev_ops {
-	errno_t (*open)(chardev_srvs_t *, chardev_srv_t *);
-	errno_t (*close)(chardev_srv_t *);
-	errno_t (*read)(chardev_srv_t *, void *, size_t, size_t *,
-	    chardev_flags_t);
-	errno_t (*write)(chardev_srv_t *, const void *, size_t, size_t *);
-	void (*def_handler)(chardev_srv_t *, ipc_call_t *);
-};
-
-extern void chardev_srvs_init(chardev_srvs_t *);
-
-extern errno_t chardev_conn(ipc_call_t *, chardev_srvs_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/io/label.h
===================================================================
--- uspace/lib/device/include/io/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IO_LABEL_H
-#define LIBDEVICE_IO_LABEL_H
-
-#include <types/label.h>
-
-extern int label_type_format(label_type_t, char **);
-extern int label_pkind_format(label_pkind_t, char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/io/serial.h
===================================================================
--- uspace/lib/device/include/io/serial.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IO_SERIAL_H
-#define LIBDEVICE_IO_SERIAL_H
-
-#include <async.h>
-#include <ipc/serial_ctl.h>
-
-typedef struct {
-	async_sess_t *sess;
-} serial_t;
-
-extern errno_t serial_open(async_sess_t *, serial_t **);
-extern void serial_close(serial_t *);
-extern errno_t serial_set_comm_props(serial_t *, unsigned, serial_parity_t,
-    unsigned, unsigned);
-extern errno_t serial_get_comm_props(serial_t *, unsigned *, serial_parity_t *,
-    unsigned *, unsigned *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/adb.h
===================================================================
--- uspace/lib/device/include/ipc/adb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- * @brief ADB device interface.
- */
-
-#ifndef LIBDEVICE_IPC_ADB_H
-#define LIBDEVICE_IPC_ADB_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	ADB_REG_WRITE = IPC_FIRST_USER_METHOD
-} adb_request_t;
-
-typedef enum {
-	ADB_REG_NOTIF = IPC_FIRST_USER_METHOD
-} adb_notif_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/bd.h
===================================================================
--- uspace/lib/device/include/ipc/bd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IPC_BD_H
-#define LIBDEVICE_IPC_BD_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	BD_GET_BLOCK_SIZE = IPC_FIRST_USER_METHOD,
-	BD_GET_NUM_BLOCKS,
-	BD_READ_BLOCKS,
-	BD_SYNC_CACHE,
-	BD_WRITE_BLOCKS,
-	BD_READ_TOC,
-	BD_EJECT
-} bd_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/chardev.h
===================================================================
--- uspace/lib/device/include/ipc/chardev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- * @brief Character device interface.
- */
-
-#ifndef LIBDEVICE_IPC_CHARDEV_H
-#define LIBDEVICE_IPC_CHARDEV_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	CHARDEV_READ = IPC_FIRST_USER_METHOD,
-	CHARDEV_WRITE,
-} chardev_request_t;
-
-enum {
-	CHARDEV_LIMIT = CHARDEV_WRITE + 1
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/devman.h
===================================================================
--- uspace/lib/device/include/ipc/devman.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef LIBDEVICE_IPC_DEVMAN_H
-#define LIBDEVICE_IPC_DEVMAN_H
-
-#include <ipc/common.h>
-#include <adt/list.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#define DEVMAN_NAME_MAXLEN  256
-
-typedef sysarg_t devman_handle_t;
-
-typedef enum {
-	/** Driver has not been started. */
-	DRIVER_NOT_STARTED = 0,
-
-	/**
-	 * Driver has been started, but has not registered as running and ready
-	 * to receive requests.
-	 */
-	DRIVER_STARTING,
-
-	/** Driver is running and prepared to serve incomming requests. */
-	DRIVER_RUNNING
-} driver_state_t;
-
-typedef enum {
-	/** Invalid value for debugging purposes */
-	fun_invalid = 0,
-	/** Function to which child devices attach */
-	fun_inner,
-	/** Fuction exported to external clients (leaf function) */
-	fun_exposed
-} fun_type_t;
-
-/** Ids of device models used for device-to-driver matching.
- */
-typedef struct match_id {
-	/** Pointers to next and previous ids.
-	 */
-	link_t link;
-	/** Id of device model.
-	 */
-	char *id;
-	/** Relevancy of device-to-driver match.
-	 * The higher is the product of scores specified for the device by the bus driver and by the leaf driver,
-	 * the more suitable is the leaf driver for handling the device.
-	 */
-	unsigned int score;
-} match_id_t;
-
-/** List of ids for matching devices to drivers sorted
- * according to match scores in descending order.
- */
-typedef struct match_id_list {
-	list_t ids;
-} match_id_list_t;
-
-static inline match_id_t *create_match_id(void)
-{
-	match_id_t *id = malloc(sizeof(match_id_t));
-	memset(id, 0, sizeof(match_id_t));
-	return id;
-}
-
-static inline void delete_match_id(match_id_t *id)
-{
-	if (id) {
-		if (NULL != id->id) {
-			free(id->id);
-		}
-		free(id);
-	}
-}
-
-static inline void add_match_id(match_id_list_t *ids, match_id_t *id)
-{
-	match_id_t *mid = NULL;
-	link_t *link = ids->ids.head.next;
-
-	while (link != &ids->ids.head) {
-		mid = list_get_instance(link, match_id_t, link);
-		if (mid->score < id->score) {
-			break;
-		}
-		link = link->next;
-	}
-
-	list_insert_before(&id->link, link);
-}
-
-static inline void init_match_ids(match_id_list_t *id_list)
-{
-	list_initialize(&id_list->ids);
-}
-
-static inline void clean_match_ids(match_id_list_t *ids)
-{
-	link_t *link = NULL;
-	match_id_t *id;
-
-	while (!list_empty(&ids->ids)) {
-		link = list_first(&ids->ids);
-		list_remove(link);
-		id = list_get_instance(link, match_id_t, link);
-		delete_match_id(id);
-	}
-}
-
-typedef enum {
-	DEVMAN_DRIVER_REGISTER = IPC_FIRST_USER_METHOD,
-	DEVMAN_ADD_FUNCTION,
-	DEVMAN_ADD_MATCH_ID,
-	DEVMAN_ADD_DEVICE_TO_CATEGORY,
-	DEVMAN_DRV_FUN_ONLINE,
-	DEVMAN_DRV_FUN_OFFLINE,
-	DEVMAN_DRV_FUN_QUIESCE,
-	DEVMAN_DRV_FUN_WAIT_STABLE,
-	DEVMAN_REMOVE_FUNCTION
-} driver_to_devman_t;
-
-typedef enum {
-	DRIVER_DEV_ADD = IPC_FIRST_USER_METHOD,
-	DRIVER_DEV_REMOVE,
-	DRIVER_DEV_GONE,
-	DRIVER_DEV_QUIESCE,
-	DRIVER_FUN_ONLINE,
-	DRIVER_FUN_OFFLINE,
-	DRIVER_STOP
-} devman_to_driver_t;
-
-typedef enum {
-	DEVMAN_DEVICE_GET_HANDLE = IPC_FIRST_USER_METHOD,
-	DEVMAN_DEV_GET_FUNCTIONS,
-	DEVMAN_DEV_GET_PARENT,
-	DEVMAN_FUN_GET_CHILD,
-	DEVMAN_FUN_GET_MATCH_ID,
-	DEVMAN_FUN_GET_NAME,
-	DEVMAN_FUN_GET_DRIVER_NAME,
-	DEVMAN_FUN_ONLINE,
-	DEVMAN_FUN_OFFLINE,
-	DEVMAN_FUN_QUIESCE,
-	DEVMAN_FUN_GET_PATH,
-	DEVMAN_FUN_SID_TO_HANDLE,
-	DEVMAN_GET_DRIVERS,
-	DEVMAN_DRIVER_GET_DEVICES,
-	DEVMAN_DRIVER_GET_HANDLE,
-	DEVMAN_DRIVER_GET_MATCH_ID,
-	DEVMAN_DRIVER_GET_NAME,
-	DEVMAN_DRIVER_GET_STATE,
-	DEVMAN_DRIVER_LOAD,
-	DEVMAN_DRIVER_UNLOAD
-} client_to_devman_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/irc.h
===================================================================
--- uspace/lib/device/include/ipc/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IPC_IRC_H
-#define LIBDEVICE_IPC_IRC_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	IRC_ENABLE_INTERRUPT = IPC_FIRST_USER_METHOD,
-	IRC_DISABLE_INTERRUPT,
-	IRC_CLEAR_INTERRUPT
-} irc_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/pci.h
===================================================================
--- uspace/lib/device/include/ipc/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IPC_PCI_H
-#define LIBDEVICE_IPC_PCI_H
-
-#include <ipc/common.h>
-
-/** PCI control service requests */
-typedef enum {
-	PCI_GET_DEVICES = IPC_FIRST_USER_METHOD,
-	PCI_DEV_GET_INFO
-} pci_request_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/device/include/ipc/serial_ctl.h
===================================================================
--- uspace/lib/device/include/ipc/serial_ctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBDEVICE_IPC_SERIAL_CTL_H
-#define LIBDEVICE_IPC_SERIAL_CTL_H
-
-#include <ipc/chardev.h>
-
-/** IPC methods for getting/setting serial communication properties
- *
- * 1st IPC arg: baud rate
- * 2nd IPC arg: parity
- * 3rd IPC arg: number of bits in one word
- * 4th IPC arg: number of stop bits
- *
- */
-typedef enum {
-	SERIAL_GET_COM_PROPS = CHARDEV_LIMIT,
-	SERIAL_SET_COM_PROPS
-} serial_ctl_t;
-
-typedef enum {
-	SERIAL_NO_PARITY = 0,
-	SERIAL_ODD_PARITY = 1,
-	SERIAL_EVEN_PARITY = 3,
-	SERIAL_MARK_PARITY = 5,
-	SERIAL_SPACE_PARITY = 7
-} serial_parity_t;
-
-#endif
Index: pace/lib/device/include/ipc/vbd.h
===================================================================
--- uspace/lib/device/include/ipc/vbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-
-#ifndef LIBDEVICE_IPC_VBD_H
-#define LIBDEVICE_IPC_VBD_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	VBD_GET_DISKS = IPC_FIRST_USER_METHOD,
-	VBD_DISK_INFO,
-	VBD_LABEL_CREATE,
-	VBD_LABEL_DELETE,
-	VBD_LABEL_GET_PARTS,
-	VBD_PART_GET_INFO,
-	VBD_PART_CREATE,
-	VBD_PART_DELETE,
-	VBD_SUGGEST_PTYPE
-} vbd_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/ipc/vol.h
===================================================================
--- uspace/lib/device/include/ipc/vol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-
-#ifndef LIBDEVICE_IPC_VOL_H
-#define LIBDEVICE_IPC_VOL_H
-
-#include <ipc/common.h>
-
-#define VOL_LABEL_MAXLEN 63
-#define VOL_MOUNTP_MAXLEN 4096
-
-typedef enum {
-	VOL_GET_PARTS = IPC_FIRST_USER_METHOD,
-	VOL_PART_ADD,
-	VOL_PART_INFO,
-	VOL_PART_EJECT,
-	VOL_PART_EMPTY,
-	VOL_PART_INSERT,
-	VOL_PART_INSERT_BY_PATH,
-	VOL_PART_LSUPP,
-	VOL_PART_MKFS,
-	VOL_PART_SET_MOUNTP,
-	VOL_GET_VOLUMES,
-	VOL_INFO
-} vol_request_t;
-
-/** Volume eject flags */
-typedef enum {
-	/** No flags */
-	vef_none = 0x0,
-	/** Physically eject medium */
-	vef_physical = 0x1
-} vol_eject_flags_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/irc.h
===================================================================
--- uspace/lib/device/include/irc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_IRC_H
-#define LIBDEVICE_IRC_H
-
-extern errno_t irc_enable_interrupt(int);
-extern errno_t irc_disable_interrupt(int);
-extern errno_t irc_clear_interrupt(int);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/nic/eth_phys.h
===================================================================
--- uspace/lib/device/include/nic/eth_phys.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBDEVICE_NIC_ETH_PHYS_H
-#define LIBDEVICE_NIC_ETH_PHYS_H
-
-#include <stdint.h>
-
-/*
- * Definitions of possible supported physical layers
- */
-
-/* Ethernet physical layers */
-#define ETH_OLD          0
-#define ETH_10M          1
-#define ETH_100M         2
-#define ETH_1000M        3
-#define ETH_10G          4
-#define ETH_40G_100G     5
-/* 6, 7 reserved for future use */
-#define ETH_PHYS_LAYERS  8
-
-/* < 10Mbs ethernets */
-#define ETH_EXPERIMENTAL     0x0001
-#define ETH_1BASE5           0x0002
-/* 10Mbs ethernets */
-#define ETH_10BASE5          0x0001
-#define ETH_10BASE2          0x0002
-#define ETH_10BROAD36        0x0004
-#define ETH_STARLAN_10       0x0008
-#define ETH_LATTISNET        0x0010
-#define ETH_10BASE_T         0x0020
-#define ETH_FOIRL            0x0040
-#define ETH_10BASE_FL        0x0080
-#define ETH_10BASE_FB        0x0100
-#define ETH_10BASE_FP        0x0200
-/* 100Mbs (fast) ethernets */
-#define ETH_100BASE_TX       0x0001
-#define ETH_100BASE_T4       0x0002
-#define ETH_100BASE_T2       0x0004
-#define ETH_100BASE_FX       0x0008
-#define ETH_100BASE_SX       0x0010
-#define ETH_100BASE_BX10     0x0020
-#define ETH_100BASE_LX10     0x0040
-#define ETH_100BASE_VG       0x0080
-/* 1000Mbs (gigabit) ethernets */
-#define ETH_1000BASE_T       0x0001
-#define ETH_1000BASE_TX      0x0002
-#define ETH_1000BASE_SX      0x0004
-#define ETH_1000BASE_LX      0x0008
-#define ETH_1000BASE_LH      0x0010
-#define ETH_1000BASE_CX      0x0020
-#define ETH_1000BASE_BX10    0x0040
-#define ETH_1000BASE_LX10    0x0080
-#define ETH_1000BASE_PX10_D  0x0100
-#define ETH_1000BASE_PX10_U  0x0200
-#define ETH_1000BASE_PX20_D  0x0400
-#define ETH_1000BASE_PX20_U  0x0800
-#define ETH_1000BASE_ZX      0x1000
-#define ETH_1000BASE_KX      0x2000
-/* 10Gbs ethernets */
-#define ETH_10GBASE_SR       0x0001
-#define ETH_10GBASE_LX4      0x0002
-#define ETH_10GBASE_LR       0x0004
-#define ETH_10GBASE_ER       0x0008
-#define ETH_10GBASE_SW       0x0010
-#define ETH_10GBASE_LW       0x0020
-#define ETH_10GBASE_EW       0x0040
-#define ETH_10GBASE_CX4      0x0080
-#define ETH_10GBASE_T        0x0100
-#define ETH_10GBASE_LRM      0x0200
-#define ETH_10GBASE_KX4      0x0400
-#define ETH_10GBASE_KR       0x0800
-/* 40Gbs and 100Gbs ethernets */
-#define ETH_40GBASE_SR4      0x0001
-#define ETH_40GBASE_LR4      0x0002
-#define ETH_40GBASE_CR4      0x0004
-#define ETH_40GBASE_KR4      0x0008
-#define ETH_100GBASE_SR10    0x0010
-#define ETH_100GBASE_LR4     0x0020
-#define ETH_100GBASE_ER4     0x0040
-#define ETH_100GBASE_CR10    0x0080
-
-/*
- * Auto-negotiation advertisement options
- */
-
-#define ETH_AUTONEG_10BASE_T_HALF    UINT32_C(0x00000001)
-#define ETH_AUTONEG_10BASE_T_FULL    UINT32_C(0x00000002)
-#define ETH_AUTONEG_100BASE_TX_HALF  UINT32_C(0x00000004)
-#define ETH_AUTONEG_100BASE_T4_HALF  UINT32_C(0x00000008)
-#define ETH_AUTONEG_100BASE_T2_HALF  UINT32_C(0x00000010)
-#define ETH_AUTONEG_100BASE_TX_FULL  UINT32_C(0x00000020)
-#define ETH_AUTONEG_100BASE_T2_FULL  UINT32_C(0x00000040)
-#define ETH_AUTONEG_1000BASE_T_HALF  UINT32_C(0x00000080)
-#define ETH_AUTONEG_1000BASE_T_FULL  UINT32_C(0x00000100)
-
-/** Symetric pause packet (802.3x standard) */
-#define ETH_AUTONEG_PAUSE_SYMETRIC   UINT32_C(0x10000000)
-/** Asymetric pause packet (802.3z standard, gigabit ethernet) */
-#define ETH_AUTONEG_PAUSE_ASYMETRIC  UINT32_C(0x20000000)
-
-#define ETH_AUTONEG_MODE_MASK      UINT32_C(0x0FFFFFFF)
-#define ETH_AUTONEG_FEATURES_MASK  UINT32_C(~(ETH_AUTONEG_MODE_MASK))
-
-#define ETH_AUTONEG_MODES  9
-
-struct eth_autoneg_map {
-	uint32_t value;
-	const char *name;
-};
-
-extern const char *ethernet_names[8][17];
-extern const struct eth_autoneg_map ethernet_autoneg_mapping[ETH_AUTONEG_MODES];
-
-#endif
Index: pace/lib/device/include/nic/nic.h
===================================================================
--- uspace/lib/device/include/nic/nic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,476 +1,0 @@
-/*
- * Copyright (c) 2009 Lukas Mejdrech
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-
-/** @file
- * NIC interface definitions.
- */
-
-#ifndef LIBDEVICE_NIC_H
-#define LIBDEVICE_NIC_H
-
-#include <nic/eth_phys.h>
-#include <stdbool.h>
-
-/** Ethernet address length. */
-#define ETH_ADDR  6
-
-/** MAC printing format */
-#define PRIMAC  "%02x:%02x:%02x:%02x:%02x:%02x"
-
-/** MAC arguments */
-#define ARGSMAC(__a) \
-	(__a)[0], (__a)[1], (__a)[2], (__a)[3], (__a)[4], (__a)[5]
-
-/* Compare MAC address with specific value */
-#define MAC_EQUALS_VALUE(__a, __a0, __a1, __a2, __a3, __a4, __a5) \
-	((__a)[0] == (__a0) && (__a)[1] == (__a1) && (__a)[2] == (__a2) \
-	&& (__a)[3] == (__a3) && (__a)[4] == (__a4) && (__a)[5] == (__a5))
-
-#define MAC_IS_ZERO(__x) \
-	MAC_EQUALS_VALUE(__x, 0, 0, 0, 0, 0, 0)
-
-/** Max length of any hw nic address (currently only eth) */
-#define NIC_MAX_ADDRESS_LENGTH  16
-
-#define NIC_VENDOR_MAX_LENGTH         64
-#define NIC_MODEL_MAX_LENGTH          64
-#define NIC_PART_NUMBER_MAX_LENGTH    64
-#define NIC_SERIAL_NUMBER_MAX_LENGTH  64
-
-#define NIC_DEFECTIVE_LONG               0x0001
-#define NIC_DEFECTIVE_SHORT              0x0002
-#define NIC_DEFECTIVE_BAD_CRC            0x0010
-#define NIC_DEFECTIVE_BAD_IPV4_CHECKSUM  0x0020
-#define NIC_DEFECTIVE_BAD_IPV6_CHECKSUM  0x0040
-#define NIC_DEFECTIVE_BAD_TCP_CHECKSUM   0x0080
-#define NIC_DEFECTIVE_BAD_UDP_CHECKSUM   0x0100
-
-/**
- * The bitmap uses single bit for each of the 2^12 = 4096 possible VLAN tags.
- * This means its size is 4096/8 = 512 bytes.
- */
-#define NIC_VLAN_BITMAP_SIZE  512
-
-#define NIC_DEVICE_PRINT_FMT  "%x"
-
-/**
- * Structure covering the MAC address.
- */
-typedef struct nic_address {
-	uint8_t address[ETH_ADDR];
-} nic_address_t;
-
-/** Device state. */
-typedef enum nic_device_state {
-	/**
-	 * Device present and stopped. Moving device to this state means to discard
-	 * all settings and WOL virtues, rebooting the NIC to state as if the
-	 * computer just booted (or the NIC was just inserted in case of removable
-	 * NIC).
-	 */
-	NIC_STATE_STOPPED,
-	/**
-	 * If the NIC is in this state no packets (frames) are transmitted nor
-	 * received. However, the settings are not restarted. You can use this state
-	 * to temporarily disable transmition/reception or atomically (with respect
-	 * to incoming/outcoming packets) change frames acceptance etc.
-	 */
-	NIC_STATE_DOWN,
-	/** Device is normally operating. */
-	NIC_STATE_ACTIVE,
-	/** Just a constant to limit the state numbers */
-	NIC_STATE_MAX,
-} nic_device_state_t;
-
-/**
- * Channel operating mode used on the medium.
- */
-typedef enum {
-	NIC_CM_UNKNOWN,
-	NIC_CM_FULL_DUPLEX,
-	NIC_CM_HALF_DUPLEX,
-	NIC_CM_SIMPLEX
-} nic_channel_mode_t;
-
-/**
- * Role for the device (used e.g. for 1000Gb ethernet)
- */
-typedef enum {
-	NIC_ROLE_UNKNOWN,
-	NIC_ROLE_AUTO,
-	NIC_ROLE_MASTER,
-	NIC_ROLE_SLAVE
-} nic_role_t;
-
-/**
- * Current state of the cable in the device
- */
-typedef enum {
-	NIC_CS_UNKNOWN,
-	NIC_CS_PLUGGED,
-	NIC_CS_UNPLUGGED
-} nic_cable_state_t;
-
-/**
- * Result of the requested operation
- */
-typedef enum {
-	/** Successfully disabled */
-	NIC_RESULT_DISABLED,
-	/** Successfully enabled */
-	NIC_RESULT_ENABLED,
-	/** Not supported at all */
-	NIC_RESULT_NOT_SUPPORTED,
-	/** Temporarily not available */
-	NIC_RESULT_NOT_AVAILABLE,
-	/** Result extensions */
-	NIC_RESULT_FIRST_EXTENSION
-} nic_result_t;
-
-/** Device usage statistics. */
-typedef struct nic_device_stats {
-	/** Total packets received (accepted). */
-	unsigned long receive_packets;
-	/** Total packets transmitted. */
-	unsigned long send_packets;
-	/** Total bytes received (accepted). */
-	unsigned long receive_bytes;
-	/** Total bytes transmitted. */
-	unsigned long send_bytes;
-	/** Bad packets received counter. */
-	unsigned long receive_errors;
-	/** Packet transmition problems counter. */
-	unsigned long send_errors;
-	/** Number of frames dropped due to insufficient space in RX buffers */
-	unsigned long receive_dropped;
-	/** Number of frames dropped due to insufficient space in TX buffers */
-	unsigned long send_dropped;
-	/** Total multicast packets received (accepted). */
-	unsigned long receive_multicast;
-	/** Total broadcast packets received (accepted). */
-	unsigned long receive_broadcast;
-	/** The number of collisions due to congestion on the medium. */
-	unsigned long collisions;
-	/** Unicast packets received but not accepted (filtered) */
-	unsigned long receive_filtered_unicast;
-	/** Multicast packets received but not accepted (filtered) */
-	unsigned long receive_filtered_multicast;
-	/** Broadcast packets received but not accepted (filtered) */
-	unsigned long receive_filtered_broadcast;
-
-	/* detailed receive_errors */
-
-	/** Received packet length error counter. */
-	unsigned long receive_length_errors;
-	/** Receiver buffer overflow counter. */
-	unsigned long receive_over_errors;
-	/** Received packet with crc error counter. */
-	unsigned long receive_crc_errors;
-	/** Received frame alignment error counter. */
-	unsigned long receive_frame_errors;
-	/** Receiver fifo overrun counter. */
-	unsigned long receive_fifo_errors;
-	/** Receiver missed packet counter. */
-	unsigned long receive_missed_errors;
-
-	/* detailed send_errors */
-
-	/** Transmitter aborted counter. */
-	unsigned long send_aborted_errors;
-	/** Transmitter carrier errors counter. */
-	unsigned long send_carrier_errors;
-	/** Transmitter fifo overrun counter. */
-	unsigned long send_fifo_errors;
-	/** Transmitter carrier errors counter. */
-	unsigned long send_heartbeat_errors;
-	/** Transmitter window errors counter. */
-	unsigned long send_window_errors;
-
-	/* for cslip etc */
-
-	/** Total compressed packets received. */
-	unsigned long receive_compressed;
-	/** Total compressed packet transmitted. */
-	unsigned long send_compressed;
-} nic_device_stats_t;
-
-/** Errors corresponding to those in the nic_device_stats_t */
-typedef enum {
-	NIC_SEC_BUFFER_FULL,
-	NIC_SEC_ABORTED,
-	NIC_SEC_CARRIER_LOST,
-	NIC_SEC_FIFO_OVERRUN,
-	NIC_SEC_HEARTBEAT,
-	NIC_SEC_WINDOW_ERROR,
-	/* Error encountered during TX but with other type of error */
-	NIC_SEC_OTHER
-} nic_send_error_cause_t;
-
-/** Errors corresponding to those in the nic_device_stats_t */
-typedef enum {
-	NIC_REC_BUFFER_FULL,
-	NIC_REC_LENGTH,
-	NIC_REC_BUFFER_OVERFLOW,
-	NIC_REC_CRC,
-	NIC_REC_FRAME_ALIGNMENT,
-	NIC_REC_FIFO_OVERRUN,
-	NIC_REC_MISSED,
-	/* Error encountered during RX but with other type of error */
-	NIC_REC_OTHER
-} nic_receive_error_cause_t;
-
-/**
- * Information about the NIC that never changes - name, vendor, model,
- * capabilites and so on.
- */
-typedef struct nic_device_info {
-	/* Device identification */
-	char vendor_name[NIC_VENDOR_MAX_LENGTH];
-	char model_name[NIC_MODEL_MAX_LENGTH];
-	char part_number[NIC_PART_NUMBER_MAX_LENGTH];
-	char serial_number[NIC_SERIAL_NUMBER_MAX_LENGTH];
-	uint16_t vendor_id;
-	uint16_t device_id;
-	uint16_t subsystem_vendor_id;
-	uint16_t subsystem_id;
-	/* Device capabilities */
-	uint16_t ethernet_support[ETH_PHYS_LAYERS];
-
-	/** The mask of all modes which the device can advertise
-	 *
-	 *  see ETH_AUTONEG_ macros in nic/eth_phys.h of libdevice
-	 */
-	uint32_t autoneg_support;
-} nic_device_info_t;
-
-/**
- * Type of the ethernet frame
- */
-typedef enum nic_frame_type {
-	NIC_FRAME_UNICAST,
-	NIC_FRAME_MULTICAST,
-	NIC_FRAME_BROADCAST
-} nic_frame_type_t;
-
-/**
- * Specifies which unicast frames is the NIC receiving.
- */
-typedef enum nic_unicast_mode {
-	NIC_UNICAST_UNKNOWN,
-	/** No unicast frames are received */
-	NIC_UNICAST_BLOCKED,
-	/** Only the frames with this NIC's MAC as destination are received */
-	NIC_UNICAST_DEFAULT,
-	/**
-	 * Both frames with this NIC's MAC and those specified in the list are
-	 * received
-	 */
-	NIC_UNICAST_LIST,
-	/** All unicast frames are received */
-	NIC_UNICAST_PROMISC
-} nic_unicast_mode_t;
-
-typedef enum nic_multicast_mode {
-	NIC_MULTICAST_UNKNOWN,
-	/** No multicast frames are received */
-	NIC_MULTICAST_BLOCKED,
-	/** Frames with multicast addresses specified in this list are received */
-	NIC_MULTICAST_LIST,
-	/** All multicast frames are received */
-	NIC_MULTICAST_PROMISC
-} nic_multicast_mode_t;
-
-typedef enum nic_broadcast_mode {
-	NIC_BROADCAST_UNKNOWN,
-	/** Broadcast frames are dropped */
-	NIC_BROADCAST_BLOCKED,
-	/** Broadcast frames are received */
-	NIC_BROADCAST_ACCEPTED
-} nic_broadcast_mode_t;
-
-/**
- * Structure covering the bitmap with VLAN tags.
- */
-typedef struct nic_vlan_mask {
-	uint8_t bitmap[NIC_VLAN_BITMAP_SIZE];
-} nic_vlan_mask_t;
-
-/* WOL virtue identifier */
-typedef unsigned int nic_wv_id_t;
-
-/**
- * Structure passed as argument for virtue NIC_WV_MAGIC_PACKET.
- */
-typedef struct nic_wv_magic_packet_data {
-	uint8_t password[6];
-} nic_wv_magic_packet_data_t;
-
-/**
- * Structure passed as argument for virtue NIC_WV_DIRECTED_IPV4
- */
-typedef struct nic_wv_ipv4_data {
-	uint8_t address[4];
-} nic_wv_ipv4_data_t;
-
-/**
- * Structure passed as argument for virtue NIC_WV_DIRECTED_IPV6
- */
-typedef struct nic_wv_ipv6_data {
-	uint8_t address[16];
-} nic_wv_ipv6_data_t;
-
-/**
- * WOL virtue types defining the interpretation of data passed to the virtue.
- * Those tagged with S can have only single virtue active at one moment, those
- * tagged with M can have multiple ones.
- */
-typedef enum nic_wv_type {
-	/**
-	 * Used for deletion of the virtue - in this case the mask, data and length
-	 * arguments are ignored.
-	 */
-	NIC_WV_NONE,
-	/** S
-	 * Enabled <=> wakeup upon link change
-	 */
-	NIC_WV_LINK_CHANGE,
-	/** S
-	 * If this virtue is set up, wakeup can be issued by a magic packet frame.
-	 * If the data argument is not NULL, it must contain
-	 * nic_wv_magic_packet_data structure with the SecureOn password.
-	 */
-	NIC_WV_MAGIC_PACKET,
-	/** M
-	 * If the virtue is set up, wakeup can be issued by a frame targeted to
-	 * device with MAC address specified in data. The data must contain
-	 * nic_address_t structure.
-	 */
-	NIC_WV_DESTINATION,
-	/** S
-	 * Enabled <=> wakeup upon receiving broadcast frame
-	 */
-	NIC_WV_BROADCAST,
-	/** S
-	 * Enabled <=> wakeup upon receiving ARP Request
-	 */
-	NIC_WV_ARP_REQUEST,
-	/** M
-	 * If enabled, the wakeup is issued upon receiving frame with an IPv4 packet
-	 * with IPv4 address specified in data. The data must contain
-	 * nic_wv_ipv4_data structure.
-	 */
-	NIC_WV_DIRECTED_IPV4,
-	/** M
-	 * If enabled, the wakeup is issued upon receiving frame with an IPv4 packet
-	 * with IPv6 address specified in data. The data must contain
-	 * nic_wv_ipv6_data structure.
-	 */
-	NIC_WV_DIRECTED_IPV6,
-	/** M
-	 * First length/2 bytes in the argument are interpreted as mask, second
-	 * length/2 bytes are interpreted as content.
-	 * If enabled, the wakeup is issued upon receiving frame where the bytes
-	 * with non-zero value in the mask equal to those in the content.
-	 */
-	NIC_WV_FULL_MATCH,
-	/**
-	 * Dummy value, do not use.
-	 */
-	NIC_WV_MAX
-} nic_wv_type_t;
-
-/**
- * Specifies the interrupt/polling mode used by the driver and NIC
- */
-typedef enum nic_poll_mode {
-	/**
-	 * NIC issues interrupts upon events.
-	 */
-	NIC_POLL_IMMEDIATE,
-	/**
-	 * Some uspace app calls nic_poll_now(...) in order to check the NIC state
-	 * - no interrupts are received from the NIC.
-	 */
-	NIC_POLL_ON_DEMAND,
-	/**
-	 * The driver itself issues a poll request in a periodic manner. It is
-	 * allowed to use hardware timer if the NIC supports it.
-	 */
-	NIC_POLL_PERIODIC,
-	/**
-	 * The driver itself issued a poll request in a periodic manner. The driver
-	 * must create software timer, internal hardware timer of NIC must not be
-	 * used even if the NIC supports it.
-	 */
-	NIC_POLL_SOFTWARE_PERIODIC
-} nic_poll_mode_t;
-
-/**
- * Says if this virtue type is a multi-virtue (there can be multiple virtues of
- * this type at once).
- *
- * @param type
- *
- * @return true or false
- */
-static inline int nic_wv_is_multi(nic_wv_type_t type)
-{
-	switch (type) {
-	case NIC_WV_FULL_MATCH:
-	case NIC_WV_DESTINATION:
-	case NIC_WV_DIRECTED_IPV4:
-	case NIC_WV_DIRECTED_IPV6:
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline const char *nic_device_state_to_string(nic_device_state_t state)
-{
-	switch (state) {
-	case NIC_STATE_STOPPED:
-		return "stopped";
-	case NIC_STATE_DOWN:
-		return "down";
-	case NIC_STATE_ACTIVE:
-		return "active";
-	default:
-		return "undefined";
-	}
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/pci.h
===================================================================
--- uspace/lib/device/include/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_PCI_H
-#define LIBDEVICE_PCI_H
-
-#include <errno.h>
-#include <ipc/devman.h>
-#include <loc.h>
-#include <types/pci.h>
-
-extern errno_t pci_open(service_id_t, pci_t **);
-extern void pci_close(pci_t *);
-extern errno_t pci_get_devices(pci_t *, devman_handle_t **, size_t *);
-extern errno_t pci_dev_get_info(pci_t *, devman_handle_t, pci_dev_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/types/io/chardev.h
===================================================================
--- uspace/lib/device/include/types/io/chardev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libdevice
- * @{
- */
-
-#ifndef LIBDEVICE_TYPES_IO_CHARDEV_H
-#define LIBDEVICE_TYPES_IO_CHARDEV_H
-
-/** Chardev read/write operation flags */
-typedef enum {
-	/** No flags */
-	chardev_f_none = 0,
-	/** Do not block even if no bytes can be transferred */
-	chardev_f_nonblock = 0x1
-} chardev_flags_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/device/include/types/label.h
===================================================================
--- uspace/lib/device/include/types/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_TYPES_LABEL_H
-#define LIBDEVICE_TYPES_LABEL_H
-
-#include <types/uuid.h>
-
-/** Partition contents */
-typedef enum {
-	/** Partition is considered empty */
-	ptc_empty = 0,
-	/** Partition contains a recognized filesystem */
-	ptc_fs,
-	/** Partition contains unrecognized data */
-	ptc_unknown
-} label_part_cnt_t;
-
-/** Disk label type */
-typedef enum {
-	/** No label */
-	lt_none,
-	/** BIOS Master Boot Record */
-	lt_mbr,
-	/** UEFI GUID Partition Table */
-	lt_gpt
-} label_type_t;
-
-#define LT_FIRST lt_mbr
-#define LT_LIMIT (lt_gpt + 1)
-
-#define LT_DEFAULT lt_mbr
-
-/** Partition kind */
-typedef enum {
-	/** Primary partition */
-	lpk_primary,
-	/** Extended partition */
-	lpk_extended,
-	/** Logical partition */
-	lpk_logical
-} label_pkind_t;
-
-/** Label flags */
-typedef enum {
-	/** Label supports extended (and logical) partitions */
-	lf_ext_supp = 0x1,
-	/** Partition type is in UUID format (otherwise in small number format) */
-	lf_ptype_uuid = 0x2,
-	/** Currently it is possible to create a primary partition */
-	lf_can_create_pri = 0x4,
-	/** Currently it is possible to create an extended partition */
-	lf_can_create_ext = 0x8,
-	/** Currently it is possible to create a logical partition */
-	lf_can_create_log = 0x10,
-	/** Currently it is possible to delete a partition */
-	lf_can_delete_part = 0x20,
-	/** Currently it is possible to modify a partition */
-	lf_can_modify_part = 0x40
-} label_flags_t;
-
-/** Partition type format */
-typedef enum {
-	/** Small number */
-	lptf_num,
-	/** UUID */
-	lptf_uuid
-} label_pt_fmt;
-
-/** Partition type */
-typedef struct {
-	/** Type format */
-	label_pt_fmt fmt;
-	/** Depending on @c fmt */
-	union {
-		/* Small number */
-		uint8_t num;
-		/** UUID */
-		uuid_t uuid;
-	} t;
-} label_ptype_t;
-
-/** Partition content (used to get partition type suggestion) */
-typedef enum {
-	/** ExFAT */
-	lpc_exfat,
-	/** Ext4 */
-	lpc_ext4,
-	/** FAT12 or FAT16 */
-	lpc_fat12_16,
-	/** FAT32 */
-	lpc_fat32,
-	/** Minix file system */
-	lpc_minix
-} label_pcnt_t;
-
-#define LPC_LIMIT (lpc_minix + 1)
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/types/pci.h
===================================================================
--- uspace/lib/device/include/types/pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_TYPES_PCI_H
-#define LIBDEVICE_TYPES_PCI_H
-
-#include <async.h>
-#include <ipc/devman.h>
-#include <stdint.h>
-
-/** PCI device information */
-typedef struct {
-	/** Devman function handle */
-	devman_handle_t dev_handle;
-	/** Bus number */
-	uint8_t bus_num;
-	/** Device number */
-	uint8_t dev_num;
-	/** Function number */
-	uint8_t fn_num;
-	/** Vendor ID */
-	uint16_t vendor_id;
-	/** Device ID */
-	uint16_t device_id;
-} pci_dev_info_t;
-
-/** PCI service */
-typedef struct {
-	/** Session with PCI control service */
-	async_sess_t *sess;
-} pci_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/types/vol.h
===================================================================
--- uspace/lib/device/include/types/vol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_TYPES_VOL_H
-#define LIBDEVICE_TYPES_VOL_H
-
-#include <async.h>
-#include <ipc/vfs.h>
-#include <ipc/vol.h>
-#include <stdbool.h>
-
-typedef struct {
-	sysarg_t id;
-} volume_id_t;
-
-typedef enum {
-	/** Partition is empty */
-	vpc_empty,
-	/** Partition contains a recognized filesystem */
-	vpc_fs,
-	/** Partition contains unrecognized data */
-	vpc_unknown
-} vol_part_cnt_t;
-
-/** File system type */
-typedef enum {
-	fs_exfat,
-	fs_fat,
-	fs_minix,
-	fs_ext4,
-	fs_cdfs
-} vol_fstype_t;
-
-#define VOL_FSTYPE_LIMIT (fs_ext4 + 1)
-#define VOL_FSTYPE_DEFAULT fs_ext4
-
-/** Volume service */
-typedef struct vol {
-	/** Volume service session */
-	async_sess_t *sess;
-} vol_t;
-
-/** Partition information */
-typedef struct {
-	/** Partition content type */
-	vol_part_cnt_t pcnt;
-	/** Filesystem type */
-	vol_fstype_t fstype;
-	/** Volume label */
-	char label[VOL_LABEL_MAXLEN + 1];
-	/** Current mount point */
-	char cur_mp[MAX_PATH_LEN + 1]; /* XXX too big */
-	/** Current mount point is automatic */
-	bool cur_mp_auto;
-} vol_part_info_t;
-
-/** Volume configuration information */
-typedef struct {
-	/** Volume identifier */
-	volume_id_t id;
-	/** Volume label */
-	char label[VOL_LABEL_MAXLEN + 1];
-	/** Mount path */
-	char path[MAX_PATH_LEN + 1]; /* XXX too big */
-} vol_info_t;
-
-/** Volume label support */
-typedef struct {
-	/** Volume labels are supported */
-	bool supported;
-} vol_label_supp_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/vbd.h
===================================================================
--- uspace/lib/device/include/vbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_VBD_H
-#define LIBDEVICE_VBD_H
-
-#include <async.h>
-#include <loc.h>
-#include <types/label.h>
-#include <offset.h>
-
-/** VBD service */
-typedef struct vbd {
-	/** VBD session */
-	async_sess_t *sess;
-} vbd_t;
-
-/** Disk information */
-typedef struct {
-	/** Label type */
-	label_type_t ltype;
-	/** Label flags */
-	label_flags_t flags;
-	/** First block that can be allocated */
-	aoff64_t ablock0;
-	/** Number of blocks that can be allocated */
-	aoff64_t anblocks;
-	/** Block size */
-	size_t block_size;
-	/** Total number of blocks */
-	aoff64_t nblocks;
-} vbd_disk_info_t;
-
-/** Specification of new partition */
-typedef struct {
-	/** Partition index */
-	int index;
-	/** First block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Number of header blocks (EBR for logical partitions) */
-	aoff64_t hdr_blocks;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** Partition type */
-	label_ptype_t ptype;
-} vbd_part_spec_t;
-
-/** Partition info */
-typedef struct {
-	/** Partition index */
-	int index;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** First block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Service ID */
-	service_id_t svc_id;
-} vbd_part_info_t;
-
-typedef sysarg_t vbd_part_id_t;
-
-extern errno_t vbd_create(vbd_t **);
-extern void vbd_destroy(vbd_t *);
-extern errno_t vbd_get_disks(vbd_t *, service_id_t **, size_t *);
-extern errno_t vbd_disk_info(vbd_t *, service_id_t, vbd_disk_info_t *);
-extern errno_t vbd_label_create(vbd_t *, service_id_t, label_type_t);
-extern errno_t vbd_label_delete(vbd_t *, service_id_t);
-extern errno_t vbd_label_get_parts(vbd_t *, service_id_t, service_id_t **,
-    size_t *);
-extern errno_t vbd_part_get_info(vbd_t *, vbd_part_id_t, vbd_part_info_t *);
-extern errno_t vbd_part_create(vbd_t *, service_id_t, vbd_part_spec_t *,
-    vbd_part_id_t *);
-extern errno_t vbd_part_delete(vbd_t *, vbd_part_id_t);
-extern void vbd_pspec_init(vbd_part_spec_t *);
-extern errno_t vbd_suggest_ptype(vbd_t *, service_id_t, label_pcnt_t,
-    label_ptype_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/include/vol.h
===================================================================
--- uspace/lib/device/include/vol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDEVICE_VOL_H
-#define LIBDEVICE_VOL_H
-
-#include <async.h>
-#include <errno.h>
-#include <loc.h>
-#include <stdint.h>
-#include <types/label.h>
-#include <types/vol.h>
-
-extern errno_t vol_create(vol_t **);
-extern void vol_destroy(vol_t *);
-extern errno_t vol_get_parts(vol_t *, service_id_t **, size_t *);
-extern errno_t vol_part_add(vol_t *, service_id_t);
-extern errno_t vol_part_info(vol_t *, service_id_t, vol_part_info_t *);
-extern errno_t vol_part_eject(vol_t *, service_id_t, vol_eject_flags_t);
-extern errno_t vol_part_empty(vol_t *, service_id_t);
-extern errno_t vol_part_insert(vol_t *, service_id_t);
-extern errno_t vol_part_insert_by_path(vol_t *, const char *);
-extern errno_t vol_part_get_lsupp(vol_t *, vol_fstype_t, vol_label_supp_t *);
-extern errno_t vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t, const char *,
-    const char *);
-extern errno_t vol_part_set_mountp(vol_t *, service_id_t, const char *);
-extern errno_t vol_get_volumes(vol_t *, volume_id_t **, size_t *);
-extern errno_t vol_info(vol_t *, volume_id_t, vol_info_t *);
-extern errno_t vol_fstype_format(vol_fstype_t, char **);
-extern errno_t vol_pcnt_fs_format(vol_part_cnt_t, vol_fstype_t, char **);
-extern errno_t vol_mountp_validate(const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/device/meson.build
===================================================================
--- uspace/lib/device/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/bd.c',
-	'src/bd_srv.c',
-	'src/devman.c',
-	'src/device/led_dev.c',
-	'src/io/chardev.c',
-	'src/io/chardev_srv.c',
-	'src/io/label.c',
-	'src/io/serial.c',
-	'src/irc.c',
-	'src/pci.c',
-	'src/vbd.c',
-	'src/vol.c',
-)
Index: pace/lib/device/src/bd.c
===================================================================
--- uspace/lib/device/src/bd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,231 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/**
- * @file
- * @brief Block device client interface
- */
-
-#include <async.h>
-#include <assert.h>
-#include <bd.h>
-#include <errno.h>
-#include <ipc/bd.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <offset.h>
-
-static void bd_cb_conn(ipc_call_t *icall, void *arg);
-
-errno_t bd_open(async_sess_t *sess, bd_t **rbd)
-{
-	bd_t *bd = calloc(1, sizeof(bd_t));
-	if (bd == NULL)
-		return ENOMEM;
-
-	bd->sess = sess;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_BLOCK_CB, 0, 0,
-	    bd_cb_conn, bd, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		goto error;
-
-	*rbd = bd;
-	return EOK;
-
-error:
-	if (bd != NULL)
-		free(bd);
-
-	return rc;
-}
-
-void bd_close(bd_t *bd)
-{
-	/* XXX Synchronize with bd_cb_conn */
-	free(bd);
-}
-
-errno_t bd_read_blocks(bd_t *bd, aoff64_t ba, size_t cnt, void *data, size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_3(exch, BD_READ_BLOCKS, LOWER32(ba),
-	    UPPER32(ba), cnt, &answer);
-	errno_t rc = async_data_read_start(exch, data, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-errno_t bd_read_toc(bd_t *bd, uint8_t session, void *buf, size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, BD_READ_TOC, session, &answer);
-	errno_t rc = async_data_read_start(exch, buf, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-errno_t bd_write_blocks(bd_t *bd, aoff64_t ba, size_t cnt, const void *data,
-    size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_3(exch, BD_WRITE_BLOCKS, LOWER32(ba),
-	    UPPER32(ba), cnt, &answer);
-	errno_t rc = async_data_write_start(exch, data, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-errno_t bd_sync_cache(bd_t *bd, aoff64_t ba, size_t cnt)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	errno_t rc = async_req_3_0(exch, BD_SYNC_CACHE, LOWER32(ba),
-	    UPPER32(ba), cnt);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t bd_get_block_size(bd_t *bd, size_t *rbsize)
-{
-	sysarg_t bsize;
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	errno_t rc = async_req_0_1(exch, BD_GET_BLOCK_SIZE, &bsize);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	*rbsize = bsize;
-	return EOK;
-}
-
-errno_t bd_get_num_blocks(bd_t *bd, aoff64_t *rnb)
-{
-	sysarg_t nb_l;
-	sysarg_t nb_h;
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	errno_t rc = async_req_0_2(exch, BD_GET_NUM_BLOCKS, &nb_l, &nb_h);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	*rnb = (aoff64_t) MERGE_LOUP32(nb_l, nb_h);
-	return EOK;
-}
-
-errno_t bd_eject(bd_t *bd)
-{
-	async_exch_t *exch = async_exchange_begin(bd->sess);
-
-	errno_t rc = async_req_0_0(exch, BD_EJECT);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-static void bd_cb_conn(ipc_call_t *icall, void *arg)
-{
-	bd_t *bd = (bd_t *)arg;
-
-	(void)bd;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/device/src/bd_srv.c
===================================================================
--- uspace/lib/device/src/bd_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,306 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/**
- * @file
- * @brief Block device server stub
- */
-#include <errno.h>
-#include <ipc/bd.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include <bd_srv.h>
-
-static void bd_read_blocks_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	aoff64_t ba;
-	size_t cnt;
-	void *buf;
-	size_t size;
-	errno_t rc;
-
-	ba = MERGE_LOUP32(ipc_get_arg1(call), ipc_get_arg2(call));
-	cnt = ipc_get_arg3(call);
-
-	ipc_call_t rcall;
-	if (!async_data_read_receive(&rcall, &size)) {
-		async_answer_0(&rcall, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	buf = malloc(size);
-	if (buf == NULL) {
-		async_answer_0(&rcall, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	if (srv->srvs->ops->read_blocks == NULL) {
-		async_answer_0(&rcall, ENOTSUP);
-		async_answer_0(call, ENOTSUP);
-		free(buf);
-		return;
-	}
-
-	rc = srv->srvs->ops->read_blocks(srv, ba, cnt, buf, size);
-	if (rc != EOK) {
-		async_answer_0(&rcall, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		free(buf);
-		return;
-	}
-
-	async_data_read_finalize(&rcall, buf, size);
-
-	free(buf);
-	async_answer_0(call, EOK);
-}
-
-static void bd_read_toc_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	uint8_t session;
-	void *buf;
-	size_t size;
-	errno_t rc;
-
-	session = ipc_get_arg1(call);
-
-	ipc_call_t rcall;
-	if (!async_data_read_receive(&rcall, &size)) {
-		async_answer_0(&rcall, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	buf = malloc(size);
-	if (buf == NULL) {
-		async_answer_0(&rcall, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	if (srv->srvs->ops->read_toc == NULL) {
-		async_answer_0(&rcall, ENOTSUP);
-		async_answer_0(call, ENOTSUP);
-		free(buf);
-		return;
-	}
-
-	rc = srv->srvs->ops->read_toc(srv, session, buf, size);
-	if (rc != EOK) {
-		async_answer_0(&rcall, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		free(buf);
-		return;
-	}
-
-	async_data_read_finalize(&rcall, buf, size);
-
-	free(buf);
-	async_answer_0(call, EOK);
-}
-
-static void bd_sync_cache_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	aoff64_t ba;
-	size_t cnt;
-	errno_t rc;
-
-	ba = MERGE_LOUP32(ipc_get_arg1(call), ipc_get_arg2(call));
-	cnt = ipc_get_arg3(call);
-
-	if (srv->srvs->ops->sync_cache == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->sync_cache(srv, ba, cnt);
-	async_answer_0(call, rc);
-}
-
-static void bd_write_blocks_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	aoff64_t ba;
-	size_t cnt;
-	void *data;
-	size_t size;
-	errno_t rc;
-
-	ba = MERGE_LOUP32(ipc_get_arg1(call), ipc_get_arg2(call));
-	cnt = ipc_get_arg3(call);
-
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return;
-	}
-
-	if (srv->srvs->ops->write_blocks == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->write_blocks(srv, ba, cnt, data, size);
-	free(data);
-	async_answer_0(call, rc);
-}
-
-static void bd_get_block_size_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	errno_t rc;
-	size_t block_size;
-
-	if (srv->srvs->ops->get_block_size == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_block_size(srv, &block_size);
-	async_answer_1(call, rc, block_size);
-}
-
-static void bd_get_num_blocks_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	errno_t rc;
-	aoff64_t num_blocks;
-
-	if (srv->srvs->ops->get_num_blocks == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->get_num_blocks(srv, &num_blocks);
-	async_answer_2(call, rc, LOWER32(num_blocks), UPPER32(num_blocks));
-}
-
-static void bd_eject_srv(bd_srv_t *srv, ipc_call_t *call)
-{
-	errno_t rc;
-
-	if (srv->srvs->ops->eject == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->eject(srv);
-	async_answer_0(call, rc);
-}
-
-static bd_srv_t *bd_srv_create(bd_srvs_t *srvs)
-{
-	bd_srv_t *srv;
-
-	srv = calloc(1, sizeof(bd_srv_t));
-	if (srv == NULL)
-		return NULL;
-
-	srv->srvs = srvs;
-	return srv;
-}
-
-void bd_srvs_init(bd_srvs_t *srvs)
-{
-	srvs->ops = NULL;
-	srvs->sarg = NULL;
-}
-
-errno_t bd_conn(ipc_call_t *icall, bd_srvs_t *srvs)
-{
-	bd_srv_t *srv;
-	errno_t rc;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	srv = bd_srv_create(srvs);
-	if (srv == NULL)
-		return ENOMEM;
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL)
-		return ENOMEM;
-
-	srv->client_sess = sess;
-
-	rc = srvs->ops->open(srvs, srv);
-	if (rc != EOK)
-		return rc;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case BD_READ_BLOCKS:
-			bd_read_blocks_srv(srv, &call);
-			break;
-		case BD_READ_TOC:
-			bd_read_toc_srv(srv, &call);
-			break;
-		case BD_SYNC_CACHE:
-			bd_sync_cache_srv(srv, &call);
-			break;
-		case BD_WRITE_BLOCKS:
-			bd_write_blocks_srv(srv, &call);
-			break;
-		case BD_GET_BLOCK_SIZE:
-			bd_get_block_size_srv(srv, &call);
-			break;
-		case BD_GET_NUM_BLOCKS:
-			bd_get_num_blocks_srv(srv, &call);
-			break;
-		case BD_EJECT:
-			bd_eject_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-
-	rc = srvs->ops->close(srv);
-	free(srv);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/device/src/device/led_dev.c
===================================================================
--- uspace/lib/device/src/device/led_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <async.h>
-#include <io/pixel.h>
-#include <ipc/dev_iface.h>
-#include <device/led_dev.h>
-
-errno_t led_dev_color_set(async_sess_t *sess, pixel_t pixel)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t req = async_send_2(exch, DEV_IFACE_ID(LED_DEV_IFACE),
-	    LED_DEV_COLOR_SET, (sysarg_t) pixel, NULL);
-
-	async_exchange_end(exch);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-
-	return (errno_t) rc;
-}
-
-/** @}
- */
Index: pace/lib/device/src/devman.c
===================================================================
--- uspace/lib/device/src/devman.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,783 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2007 Josef Cejka
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#include <adt/list.h>
-#include <str.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <ipc/devman.h>
-#include <devman.h>
-#include <fibril_synch.h>
-#include <async.h>
-#include <errno.h>
-#include <stdlib.h>
-
-static FIBRIL_MUTEX_INITIALIZE(devman_driver_block_mutex);
-static FIBRIL_MUTEX_INITIALIZE(devman_client_block_mutex);
-
-static FIBRIL_MUTEX_INITIALIZE(devman_driver_mutex);
-static FIBRIL_MUTEX_INITIALIZE(devman_client_mutex);
-
-static async_sess_t *devman_driver_block_sess = NULL;
-static async_sess_t *devman_client_block_sess = NULL;
-
-static async_sess_t *devman_driver_sess = NULL;
-static async_sess_t *devman_client_sess = NULL;
-
-static void clone_session(fibril_mutex_t *mtx, async_sess_t *src,
-    async_sess_t **dst)
-{
-	fibril_mutex_lock(mtx);
-
-	if ((*dst == NULL) && (src != NULL))
-		*dst = src;
-
-	fibril_mutex_unlock(mtx);
-}
-
-/** Start an async exchange on the devman session (blocking).
- *
- * @param iface Device manager interface to choose
- *
- * @return New exchange.
- *
- */
-async_exch_t *devman_exchange_begin_blocking(iface_t iface)
-{
-	switch (iface) {
-	case INTERFACE_DDF_DRIVER:
-		fibril_mutex_lock(&devman_driver_block_mutex);
-
-		while (devman_driver_block_sess == NULL) {
-			clone_session(&devman_driver_mutex, devman_driver_sess,
-			    &devman_driver_block_sess);
-
-			if (devman_driver_block_sess == NULL)
-				devman_driver_block_sess =
-				    service_connect_blocking(SERVICE_DEVMAN,
-				    INTERFACE_DDF_DRIVER, 0, NULL);
-		}
-
-		fibril_mutex_unlock(&devman_driver_block_mutex);
-
-		clone_session(&devman_driver_mutex, devman_driver_block_sess,
-		    &devman_driver_sess);
-
-		return async_exchange_begin(devman_driver_block_sess);
-	case INTERFACE_DDF_CLIENT:
-		fibril_mutex_lock(&devman_client_block_mutex);
-
-		while (devman_client_block_sess == NULL) {
-			clone_session(&devman_client_mutex, devman_client_sess,
-			    &devman_client_block_sess);
-
-			if (devman_client_block_sess == NULL)
-				devman_client_block_sess =
-				    service_connect_blocking(SERVICE_DEVMAN,
-				    INTERFACE_DDF_CLIENT, 0, NULL);
-		}
-
-		fibril_mutex_unlock(&devman_client_block_mutex);
-
-		clone_session(&devman_client_mutex, devman_client_block_sess,
-		    &devman_client_sess);
-
-		return async_exchange_begin(devman_client_block_sess);
-	default:
-		return NULL;
-	}
-}
-
-/** Start an async exchange on the devman session.
- *
- * @param iface Device manager interface to choose
- *
- * @return New exchange.
- *
- */
-async_exch_t *devman_exchange_begin(iface_t iface)
-{
-	switch (iface) {
-	case INTERFACE_DDF_DRIVER:
-		fibril_mutex_lock(&devman_driver_mutex);
-
-		if (devman_driver_sess == NULL)
-			devman_driver_sess =
-			    service_connect(SERVICE_DEVMAN,
-			    INTERFACE_DDF_DRIVER, 0, NULL);
-
-		fibril_mutex_unlock(&devman_driver_mutex);
-
-		if (devman_driver_sess == NULL)
-			return NULL;
-
-		return async_exchange_begin(devman_driver_sess);
-	case INTERFACE_DDF_CLIENT:
-		fibril_mutex_lock(&devman_client_mutex);
-
-		if (devman_client_sess == NULL)
-			devman_client_sess =
-			    service_connect(SERVICE_DEVMAN,
-			    INTERFACE_DDF_CLIENT, 0, NULL);
-
-		fibril_mutex_unlock(&devman_client_mutex);
-
-		if (devman_client_sess == NULL)
-			return NULL;
-
-		return async_exchange_begin(devman_client_sess);
-	default:
-		return NULL;
-	}
-}
-
-/** Finish an async exchange on the devman session.
- *
- * @param exch Exchange to be finished.
- *
- */
-void devman_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Register running driver with device manager. */
-errno_t devman_driver_register(const char *name)
-{
-	async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, DEVMAN_DRIVER_REGISTER, 0, 0, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	devman_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
-	async_connect_to_me(exch, INTERFACE_ANY, 0, 0);
-	devman_exchange_end(exch);
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-/** Add function to a device.
- *
- * Request devman to add a new function to the specified device owned by
- * this driver task.
- *
- * @param name      Name of the new function
- * @param ftype     Function type, fun_inner or fun_exposed
- * @param match_ids Match IDs (should be empty for fun_exposed)
- * @param devh      Devman handle of the device
- * @param funh      Place to store handle of the new function
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t devman_add_function(const char *name, fun_type_t ftype,
-    match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh)
-{
-	unsigned long match_count = list_count(&match_ids->ids);
-	async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
-
-	ipc_call_t answer;
-	aid_t req = async_send_3(exch, DEVMAN_ADD_FUNCTION, (sysarg_t) ftype,
-	    devh, match_count, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-	if (retval != EOK) {
-		devman_exchange_end(exch);
-		async_forget(req);
-		return retval;
-	}
-
-	list_foreach(match_ids->ids, link, match_id_t, match_id) {
-		ipc_call_t answer2;
-		aid_t req2 = async_send_1(exch, DEVMAN_ADD_MATCH_ID,
-		    match_id->score, &answer2);
-		retval = async_data_write_start(exch, match_id->id,
-		    str_size(match_id->id));
-		if (retval != EOK) {
-			devman_exchange_end(exch);
-			async_forget(req2);
-			async_forget(req);
-			return retval;
-		}
-
-		async_wait_for(req2, &retval);
-		if (retval != EOK) {
-			devman_exchange_end(exch);
-			async_forget(req);
-			return retval;
-		}
-	}
-
-	devman_exchange_end(exch);
-
-	async_wait_for(req, &retval);
-	if (retval == EOK) {
-		if (funh != NULL)
-			*funh = (int) ipc_get_arg1(&answer);
-	} else {
-		if (funh != NULL)
-			*funh = -1;
-	}
-
-	return retval;
-}
-
-errno_t devman_add_device_to_category(devman_handle_t devman_handle,
-    const char *cat_name)
-{
-	async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, DEVMAN_ADD_DEVICE_TO_CATEGORY,
-	    devman_handle, &answer);
-	errno_t retval = async_data_write_start(exch, cat_name,
-	    str_size(cat_name));
-
-	devman_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-async_sess_t *devman_device_connect(devman_handle_t handle, unsigned int flags)
-{
-	async_sess_t *sess;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		sess = service_connect_blocking(SERVICE_DEVMAN,
-		    INTERFACE_DEVMAN_DEVICE, handle, NULL);
-	else
-		sess = service_connect(SERVICE_DEVMAN,
-		    INTERFACE_DEVMAN_DEVICE, handle, NULL);
-
-	return sess;
-}
-
-/** Remove function from device.
- *
- * Request devman to remove function owned by this driver task.
- * @param funh      Devman handle of the function
- *
- * @return EOK on success or an error code.
- */
-errno_t devman_remove_function(devman_handle_t funh)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = devman_exchange_begin_blocking(INTERFACE_DDF_DRIVER);
-	retval = async_req_1_0(exch, DEVMAN_REMOVE_FUNCTION, (sysarg_t) funh);
-	devman_exchange_end(exch);
-
-	return retval;
-}
-
-errno_t devman_drv_fun_online(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_ONLINE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_drv_fun_offline(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_OFFLINE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_drv_fun_quiesce(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_QUIESCE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_drv_fun_wait_stable(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_DRIVER);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_DRV_FUN_WAIT_STABLE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-async_sess_t *devman_parent_device_connect(devman_handle_t handle,
-    unsigned int flags)
-{
-	async_sess_t *sess;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		sess = service_connect_blocking(SERVICE_DEVMAN,
-		    INTERFACE_DEVMAN_PARENT, handle, NULL);
-	else
-		sess = service_connect(SERVICE_DEVMAN,
-		    INTERFACE_DEVMAN_PARENT, handle, NULL);
-
-	return sess;
-}
-
-errno_t devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
-    unsigned int flags)
-{
-	async_exch_t *exch;
-
-	if (flags & IPC_FLAG_BLOCKING)
-		exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
-	else {
-		exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-		if (exch == NULL)
-			return ENOMEM;
-	}
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, DEVMAN_DEVICE_GET_HANDLE, flags, 0,
-	    &answer);
-	errno_t retval = async_data_write_start(exch, pathname,
-	    str_size(pathname));
-
-	devman_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = (devman_handle_t) -1;
-
-		return retval;
-	}
-
-	if (handle != NULL)
-		*handle = (devman_handle_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-static errno_t devman_get_str_internal(sysarg_t method, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t *r1, char *buf, size_t buf_size)
-{
-	async_exch_t *exch;
-	ipc_call_t dreply;
-	size_t act_size;
-	errno_t dretval;
-
-	exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, method, arg1, arg2, &answer);
-	aid_t dreq = async_data_read(exch, buf, buf_size - 1, &dreply);
-	async_wait_for(dreq, &dretval);
-
-	devman_exchange_end(exch);
-
-	if (dretval != EOK) {
-		async_forget(req);
-		return dretval;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	if (r1 != NULL)
-		*r1 = ipc_get_arg1(&answer);
-	act_size = ipc_get_arg2(&dreply);
-	assert(act_size <= buf_size - 1);
-	buf[act_size] = '\0';
-
-	return EOK;
-}
-
-errno_t devman_fun_get_path(devman_handle_t handle, char *buf, size_t buf_size)
-{
-	return devman_get_str_internal(DEVMAN_FUN_GET_PATH, handle, 0, NULL,
-	    buf, buf_size);
-}
-
-errno_t devman_fun_get_match_id(devman_handle_t handle, size_t index, char *buf,
-    size_t buf_size, unsigned int *rscore)
-{
-	errno_t rc;
-	sysarg_t score = 0;
-
-	rc = devman_get_str_internal(DEVMAN_FUN_GET_MATCH_ID, handle, index,
-	    &score, buf, buf_size);
-	if (rc != EOK)
-		return rc;
-
-	*rscore = score;
-	return rc;
-}
-
-errno_t devman_fun_get_name(devman_handle_t handle, char *buf, size_t buf_size)
-{
-	return devman_get_str_internal(DEVMAN_FUN_GET_NAME, handle, 0, NULL,
-	    buf, buf_size);
-}
-
-errno_t devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
-{
-	return devman_get_str_internal(DEVMAN_FUN_GET_DRIVER_NAME, handle, 0,
-	    NULL, buf, buf_size);
-}
-
-errno_t devman_fun_online(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_FUN_ONLINE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_fun_offline(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_FUN_OFFLINE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_fun_quiesce(devman_handle_t funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_0(exch, DEVMAN_FUN_QUIESCE, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-static errno_t devman_get_handles_once(sysarg_t method, sysarg_t arg1,
-    devman_handle_t *handle_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = devman_exchange_begin_blocking(INTERFACE_DDF_CLIENT);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, handle_buf, buf_size);
-
-	devman_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of handles.
- *
- * Returns an allocated array of handles.
- *
- * @param method	IPC method
- * @param arg1		IPC argument 1
- * @param data		Place to store pointer to array of handles
- * @param count		Place to store number of handles
- * @return 		EOK on success or an error code
- */
-static errno_t devman_get_handles_internal(sysarg_t method, sysarg_t arg1,
-    devman_handle_t **data, size_t *count)
-{
-	devman_handle_t *handles;
-	size_t act_size;
-	size_t alloc_size;
-	errno_t rc;
-
-	*data = NULL;
-	act_size = 0;	/* silence warning */
-
-	rc = devman_get_handles_once(method, arg1, NULL, 0,
-	    &act_size);
-	if (rc != EOK)
-		return rc;
-
-	alloc_size = act_size;
-	handles = malloc(alloc_size);
-	if (handles == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = devman_get_handles_once(method, arg1, handles, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size *= 2;
-		free(handles);
-
-		handles = malloc(alloc_size);
-		if (handles == NULL)
-			return ENOMEM;
-	}
-
-	*count = act_size / sizeof(devman_handle_t);
-	*data = handles;
-	return EOK;
-}
-
-errno_t devman_fun_get_child(devman_handle_t funh, devman_handle_t *devh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_1(exch, DEVMAN_FUN_GET_CHILD,
-	    funh, devh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_dev_get_functions(devman_handle_t devh, devman_handle_t **funcs,
-    size_t *count)
-{
-	return devman_get_handles_internal(DEVMAN_DEV_GET_FUNCTIONS,
-	    devh, funcs, count);
-}
-
-errno_t devman_dev_get_parent(devman_handle_t devh, devman_handle_t *funh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_1(exch, DEVMAN_DEV_GET_PARENT,
-	    devh, funh);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_fun_sid_to_handle(service_id_t sid, devman_handle_t *handle)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t retval = async_req_1_1(exch, DEVMAN_FUN_SID_TO_HANDLE,
-	    sid, handle);
-
-	devman_exchange_end(exch);
-	return retval;
-}
-
-errno_t devman_quiesce_devices(const char *path)
-{
-	devman_handle_t funh;
-	errno_t rc;
-
-	funh = 0;
-	rc = devman_fun_get_handle(path, &funh, 0);
-	if (rc != EOK)
-		return rc;
-
-	return devman_fun_quiesce(funh);
-}
-
-errno_t devman_get_drivers(devman_handle_t **drvs,
-    size_t *count)
-{
-	return devman_get_handles_internal(DEVMAN_GET_DRIVERS, 0, drvs, count);
-}
-
-errno_t devman_driver_get_devices(devman_handle_t drvh, devman_handle_t **devs,
-    size_t *count)
-{
-	return devman_get_handles_internal(DEVMAN_DRIVER_GET_DEVICES,
-	    drvh, devs, count);
-}
-
-errno_t devman_driver_get_handle(const char *drvname, devman_handle_t *handle)
-{
-	async_exch_t *exch;
-
-	exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, DEVMAN_DRIVER_GET_HANDLE, &answer);
-	errno_t retval = async_data_write_start(exch, drvname,
-	    str_size(drvname));
-
-	devman_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		if (handle != NULL)
-			*handle = (devman_handle_t) -1;
-
-		return retval;
-	}
-
-	if (handle != NULL)
-		*handle = (devman_handle_t) ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-errno_t devman_driver_get_match_id(devman_handle_t handle, size_t index, char *buf,
-    size_t buf_size, unsigned int *rscore)
-{
-	errno_t rc;
-	sysarg_t score = 0;
-
-	rc = devman_get_str_internal(DEVMAN_DRIVER_GET_MATCH_ID, handle, index,
-	    &score, buf, buf_size);
-	if (rc != EOK)
-		return rc;
-
-	*rscore = score;
-	return rc;
-}
-
-errno_t devman_driver_get_name(devman_handle_t handle, char *buf, size_t buf_size)
-{
-	return devman_get_str_internal(DEVMAN_DRIVER_GET_NAME, handle, 0, NULL,
-	    buf, buf_size);
-}
-
-errno_t devman_driver_get_state(devman_handle_t drvh, driver_state_t *rstate)
-{
-	sysarg_t state;
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t rc = async_req_1_1(exch, DEVMAN_DRIVER_GET_STATE, drvh,
-	    &state);
-
-	devman_exchange_end(exch);
-	if (rc != EOK)
-		return rc;
-
-	*rstate = state;
-	return rc;
-}
-
-errno_t devman_driver_load(devman_handle_t drvh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_LOAD, drvh);
-
-	devman_exchange_end(exch);
-	return rc;
-}
-
-errno_t devman_driver_unload(devman_handle_t drvh)
-{
-	async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
-	if (exch == NULL)
-		return ENOMEM;
-
-	errno_t rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
-
-	devman_exchange_end(exch);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/device/src/io/chardev.c
===================================================================
--- uspace/lib/device/src/io/chardev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/**
- * @file
- * @brief Character device client interface
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <io/chardev.h>
-#include <ipc/chardev.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-/** Open character device.
- *
- * @param sess Session with the character device
- * @param rchardev Place to store pointer to the new character device structure
- *
- * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
- */
-errno_t chardev_open(async_sess_t *sess, chardev_t **rchardev)
-{
-	chardev_t *chardev;
-
-	chardev = calloc(1, sizeof(chardev_t));
-	if (chardev == NULL)
-		return ENOMEM;
-
-	chardev->sess = sess;
-	*rchardev = chardev;
-
-	/* EIO might be used in a future implementation */
-	return EOK;
-}
-
-/** Close character device.
- *
- * Frees the character device structure. The underlying session is
- * not affected.
- *
- * @param chardev Character device or @c NULL
- */
-void chardev_close(chardev_t *chardev)
-{
-	free(chardev);
-}
-
-/** Read from character device.
- *
- * Read as much data as is available from character device up to @a size
- * bytes into @a buf. On success EOK is returned and at least one byte
- * is read (if no byte is available the function blocks). The number
- * of bytes read is stored in @a *nread.
- *
- * On error a non-zero error code is returned and @a *nread is filled with
- * the number of bytes that were successfully transferred.
- *
- * @param chardev Character device
- * @param buf Destination buffer
- * @param size Maximum number of bytes to read
- * @param nread Place to store actual number of bytes read
- * @param flags @c chardev_f_nonblock to return immediately even if no
- *              bytes are available
- *
- * @return EOK on success or non-zero error code
- */
-errno_t chardev_read(chardev_t *chardev, void *buf, size_t size, size_t *nread,
-    chardev_flags_t flags)
-{
-	async_exch_t *exch = async_exchange_begin(chardev->sess);
-
-	if (size > DATA_XFER_LIMIT) {
-		/* This should not hurt anything. */
-		size = DATA_XFER_LIMIT;
-	}
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, CHARDEV_READ, flags, &answer);
-	errno_t rc = async_data_read_start(exch, buf, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		*nread = 0;
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		*nread = 0;
-		return retval;
-	}
-
-	*nread = ipc_get_arg2(&answer);
-	/* In case of partial success, ARG1 contains the error code */
-	return (errno_t) ipc_get_arg1(&answer);
-
-}
-
-/** Write up to DATA_XFER_LIMIT bytes to character device.
- *
- * Write up to @a size or DATA_XFER_LIMIT bytes from @a data to character
- * device. On success EOK is returned, bytes were written and @a *nwritten
- * is set to min(@a size, DATA_XFER_LIMIT)
- *
- * On error a non-zero error code is returned and @a *nwritten is filled with
- * the number of bytes that were successfully transferred.
- *
- * @param chardev Character device
- * @param buf Destination buffer
- * @param size Maximum number of bytes to read
- * @param nwritten Place to store actual number of bytes written
- *
- * @return EOK on success or non-zero error code
- */
-static errno_t chardev_write_once(chardev_t *chardev, const void *data,
-    size_t size, size_t *nwritten)
-{
-	async_exch_t *exch = async_exchange_begin(chardev->sess);
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	/* Break down large transfers */
-	if (size > DATA_XFER_LIMIT)
-		size = DATA_XFER_LIMIT;
-
-	req = async_send_0(exch, CHARDEV_WRITE, &answer);
-	rc = async_data_write_start(exch, data, size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		*nwritten = 0;
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK) {
-		*nwritten = 0;
-		return retval;
-	}
-
-	*nwritten = ipc_get_arg2(&answer);
-	/* In case of partial success, ARG1 contains the error code */
-	return (errno_t) ipc_get_arg1(&answer);
-}
-
-/** Write to character device.
- *
- * Write @a size bytes from @a data to character device. On success EOK
- * is returned, all bytes were written and @a *nwritten is set to @a size.
- *
- * On error a non-zero error code is returned and @a *nwritten is filled with
- * the number of bytes that were successfully transferred.
- *
- * @param chardev Character device
- * @param buf Destination buffer
- * @param size Maximum number of bytes to read
- * @param nwritten Place to store actual number of bytes written
- *
- * @return EOK on success or non-zero error code
- */
-errno_t chardev_write(chardev_t *chardev, const void *data, size_t size,
-    size_t *nwritten)
-{
-	size_t nw;
-	size_t p;
-	errno_t rc;
-
-	p = 0;
-	while (p < size) {
-		rc = chardev_write_once(chardev, data + p, size - p, &nw);
-		/* nw is always valid, we can have partial success */
-		p += nw;
-
-		if (rc != EOK) {
-			/* We can return partial success */
-			*nwritten = p;
-			return rc;
-		}
-	}
-
-	*nwritten = p;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/device/src/io/chardev_srv.c
===================================================================
--- uspace/lib/device/src/io/chardev_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/**
- * @file
- * @brief Character device server stub
- */
-#include <errno.h>
-#include <io/chardev_srv.h>
-#include <ipc/chardev.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-static chardev_srv_t *chardev_srv_create(chardev_srvs_t *);
-
-static void chardev_read_srv(chardev_srv_t *srv, ipc_call_t *icall)
-{
-	void *buf;
-	size_t size;
-	size_t nread;
-	chardev_flags_t flags;
-	errno_t rc;
-
-	flags = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	buf = malloc(size);
-	if (buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	if (srv->srvs->ops->read == NULL) {
-		async_answer_0(&call, ENOTSUP);
-		async_answer_0(icall, ENOTSUP);
-		free(buf);
-		return;
-	}
-
-	rc = srv->srvs->ops->read(srv, buf, size, &nread, flags);
-	if (rc != EOK && nread == 0) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(buf);
-		return;
-	}
-
-	async_data_read_finalize(&call, buf, nread);
-
-	free(buf);
-	async_answer_2(icall, EOK, (sysarg_t) rc, nread);
-}
-
-static void chardev_write_srv(chardev_srv_t *srv, ipc_call_t *icall)
-{
-	void *data;
-	size_t size;
-	size_t nwr;
-	errno_t rc;
-
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->srvs->ops->write == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->srvs->ops->write(srv, data, size, &nwr);
-	free(data);
-	if (rc != EOK && nwr == 0) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_2(icall, EOK, (sysarg_t) rc, nwr);
-}
-
-static chardev_srv_t *chardev_srv_create(chardev_srvs_t *srvs)
-{
-	chardev_srv_t *srv;
-
-	srv = calloc(1, sizeof(chardev_srv_t));
-	if (srv == NULL)
-		return NULL;
-
-	srv->srvs = srvs;
-	return srv;
-}
-
-void chardev_srvs_init(chardev_srvs_t *srvs)
-{
-	srvs->ops = NULL;
-	srvs->sarg = NULL;
-}
-
-errno_t chardev_conn(ipc_call_t *icall, chardev_srvs_t *srvs)
-{
-	chardev_srv_t *srv;
-	errno_t rc;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	srv = chardev_srv_create(srvs);
-	if (srv == NULL)
-		return ENOMEM;
-
-	if (srvs->ops->open != NULL) {
-		rc = srvs->ops->open(srvs, srv);
-		if (rc != EOK)
-			return rc;
-	}
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case CHARDEV_READ:
-			chardev_read_srv(srv, &call);
-			break;
-		case CHARDEV_WRITE:
-			chardev_write_srv(srv, &call);
-			break;
-		default:
-			if (srv->srvs->ops->def_handler != NULL)
-				srv->srvs->ops->def_handler(srv, &call);
-			else
-				async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	if (srvs->ops->close != NULL)
-		rc = srvs->ops->close(srv);
-	else
-		rc = EOK;
-
-	free(srv);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/device/src/io/label.c
===================================================================
--- uspace/lib/device/src/io/label.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file Volume service API
- */
-
-#include <errno.h>
-#include <io/label.h>
-#include <stdlib.h>
-#include <str.h>
-
-/** Format label type as string.
- *
- * @param ltype Label type
- * @param rstr Place to return pointer to newly allocated string
- * @return EOK on success, ENOMEM if out of memory
- */
-int label_type_format(label_type_t ltype, char **rstr)
-{
-	const char *sltype;
-	char *s;
-
-	sltype = NULL;
-	switch (ltype) {
-	case lt_none:
-		sltype = "None";
-		break;
-	case lt_mbr:
-		sltype = "MBR";
-		break;
-	case lt_gpt:
-		sltype = "GPT";
-		break;
-	}
-
-	s = str_dup(sltype);
-	if (s == NULL)
-		return ENOMEM;
-
-	*rstr = s;
-	return EOK;
-}
-
-/** Format partition kind as string.
- *
- * @param pkind Partition kind
- * @param rstr Place to return pointer to newly allocated string
- * @return EOK on success, ENOMEM if out of memory
- */
-int label_pkind_format(label_pkind_t pkind, char **rstr)
-{
-	const char *spkind;
-	char *s;
-
-	spkind = NULL;
-	switch (pkind) {
-	case lpk_primary:
-		spkind = "Primary";
-		break;
-	case lpk_extended:
-		spkind = "Extended";
-		break;
-	case lpk_logical:
-		spkind = "Logical";
-		break;
-	}
-
-	s = str_dup(spkind);
-	if (s == NULL)
-		return ENOMEM;
-
-	*rstr = s;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/device/src/io/serial.c
===================================================================
--- uspace/lib/device/src/io/serial.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <io/serial.h>
-#include <ipc/serial_ctl.h>
-#include <ipc/services.h>
-#include <stdlib.h>
-
-/** Open serial port device.
- *
- * @param sess Session with the serial port device
- * @param rchardev Place to store pointer to the new serial port device structure
- *
- * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
- */
-errno_t serial_open(async_sess_t *sess, serial_t **rserial)
-{
-	serial_t *serial;
-
-	serial = calloc(1, sizeof(serial_t));
-	if (serial == NULL)
-		return ENOMEM;
-
-	serial->sess = sess;
-	*rserial = serial;
-
-	return EOK;
-}
-
-/** Close serial port device.
- *
- * Frees the serial port device structure. The underlying session is
- * not affected.
- *
- * @param serial Serial port device or @c NULL
- */
-void serial_close(serial_t *serial)
-{
-	free(serial);
-}
-
-/** Set serial port communication properties. */
-errno_t serial_set_comm_props(serial_t *serial, unsigned rate,
-    serial_parity_t parity, unsigned datab, unsigned stopb)
-{
-	async_exch_t *exch = async_exchange_begin(serial->sess);
-
-	errno_t rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, rate, parity,
-	    datab, stopb);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Get serial port communication properties. */
-errno_t serial_get_comm_props(serial_t *serial, unsigned *rrate,
-    serial_parity_t *rparity, unsigned *rdatab, unsigned *rstopb)
-{
-	async_exch_t *exch = async_exchange_begin(serial->sess);
-	sysarg_t rate, parity, datab, stopb;
-
-	errno_t rc = async_req_0_4(exch, SERIAL_GET_COM_PROPS, &rate, &parity,
-	    &datab, &stopb);
-
-	async_exchange_end(exch);
-	if (rc != EOK)
-		return rc;
-
-	*rrate = rate;
-	*rparity = parity;
-	*rdatab = datab;
-	*rstopb = stopb;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/device/src/irc.c
===================================================================
--- uspace/lib/device/src/irc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <fibril.h>
-#include <ipc/irc.h>
-#include <ipc/services.h>
-#include <irc.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <sysinfo.h>
-
-static async_sess_t *irc_sess;
-
-/** Connect to IRC service.
- *
- * @return	EOK on success, EIO on failure
- */
-static errno_t irc_init(void)
-{
-	category_id_t irc_cat;
-	service_id_t *svcs;
-	size_t count;
-	errno_t rc;
-
-	assert(irc_sess == NULL);
-	rc = loc_category_get_id("irc", &irc_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return EIO;
-
-	while (true) {
-		rc = loc_category_get_svcs(irc_cat, &svcs, &count);
-		if (rc != EOK)
-			return EIO;
-
-		if (count > 0)
-			break;
-
-		free(svcs);
-
-		// XXX This is just a temporary hack
-		fibril_usleep(500 * 1000);
-	}
-
-	irc_sess = loc_service_connect(svcs[0], INTERFACE_IRC,
-	    IPC_FLAG_BLOCKING);
-	free(svcs);
-
-	if (irc_sess == NULL)
-		return EIO;
-
-	return EOK;
-}
-
-/** Enable interrupt.
- *
- * Allow interrupt delivery.
- *
- * @param irq	IRQ number
- */
-errno_t irc_enable_interrupt(int irq)
-{
-	errno_t rc;
-
-	if (irc_sess == NULL) {
-		rc = irc_init();
-		if (rc != EOK)
-			return rc;
-	}
-
-	async_exch_t *exch = async_exchange_begin(irc_sess);
-	rc = async_req_1_0(exch, IRC_ENABLE_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Disable interrupt.
- *
- * Disallow interrupt delivery.
- *
- * @param irq	IRQ number
- */
-errno_t irc_disable_interrupt(int irq)
-{
-	errno_t rc;
-
-	if (irc_sess == NULL) {
-		rc = irc_init();
-		if (rc != EOK)
-			return rc;
-	}
-
-	async_exch_t *exch = async_exchange_begin(irc_sess);
-	rc = async_req_1_0(exch, IRC_DISABLE_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Clear interrupt.
- *
- * Clear/acknowledge interrupt in interrupt controller so that
- * another interrupt can be delivered.
- *
- * @param irq	IRQ number
- */
-errno_t irc_clear_interrupt(int irq)
-{
-	errno_t rc;
-
-	if (irc_sess == NULL) {
-		rc = irc_init();
-		if (rc != EOK)
-			return rc;
-	}
-
-	async_exch_t *exch = async_exchange_begin(irc_sess);
-	rc = async_req_1_0(exch, IRC_CLEAR_INTERRUPT, irq);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/device/src/pci.c
===================================================================
--- uspace/lib/device/src/pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,225 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file PCI control service API
- */
-
-#include <abi/ipc/interfaces.h>
-#include <errno.h>
-#include <ipc/devman.h>
-#include <ipc/services.h>
-#include <ipc/pci.h>
-#include <loc.h>
-#include <pci.h>
-#include <stdlib.h>
-#include <types/pci.h>
-
-/** Open PCI service.
- *
- * @param svc_id PCI sevice ID
- * @param rpci   Place to store pointer to PCI service object.
- *
- * @return EOK on success, ENOMEM if out of memory, EIO if service
- *         cannot be contacted.
- */
-errno_t pci_open(service_id_t svc_id, pci_t **rpci)
-{
-	pci_t *pci;
-	errno_t rc;
-
-	pci = calloc(1, sizeof(pci_t));
-	if (pci == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pci->sess = loc_service_connect(svc_id, INTERFACE_PCI, 0);
-	if (pci->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rpci = pci;
-	return EOK;
-error:
-	free(pci);
-	return rc;
-}
-
-/** Close PCI service.
- *
- * @param pci PCI service object or @c NULL
- */
-void pci_close(pci_t *pci)
-{
-	if (pci == NULL)
-		return;
-
-	async_hangup(pci->sess);
-	free(pci);
-}
-
-/** Get list of IDs into a buffer of fixed size.
- *
- * @param pci      PCI service
- * @param method   IPC method
- * @param arg1     First argument
- * @param id_buf   Buffer to store IDs
- * @param buf_size Buffer size
- * @param act_size Place to store actual size of complete data.
- *
- * @return EOK on success or an error code.
- */
-static errno_t pci_get_ids_once(pci_t *pci, sysarg_t method, sysarg_t arg1,
-    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = async_exchange_begin(pci->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of IDs.
- *
- * Returns an allocated array of service IDs.
- *
- * @param pci    PCI service
- * @param method IPC method
- * @param arg1   IPC argument 1
- * @param data   Place to store pointer to array of IDs
- * @param count  Place to store number of IDs
- * @return       EOK on success or an error code
- */
-static errno_t pci_get_ids_internal(pci_t *pci, sysarg_t method, sysarg_t arg1,
-    sysarg_t **data, size_t *count)
-{
-	*data = NULL;
-	*count = 0;
-
-	size_t act_size = 0;
-	errno_t rc = pci_get_ids_once(pci, method, arg1, NULL, 0, &act_size);
-	if (rc != EOK)
-		return rc;
-
-	size_t alloc_size = act_size;
-	service_id_t *ids = malloc(alloc_size);
-	if (ids == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = pci_get_ids_once(pci, method, arg1, ids, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size = act_size;
-		service_id_t *tmp = realloc(ids, alloc_size);
-		if (tmp == NULL) {
-			free(ids);
-			return ENOMEM;
-		}
-		ids = tmp;
-	}
-
-	*count = act_size / sizeof(service_id_t);
-	*data = ids;
-	return EOK;
-}
-
-/** Get list of PCI devices as array of devman handles.
- *
- * @param pci PCI service
- * @param data Place to store pointer to array
- * @param count Place to store length of array (number of entries)
- *
- * @return EOK on success or an error code
- */
-errno_t pci_get_devices(pci_t *pci, devman_handle_t **data, size_t *count)
-{
-	return pci_get_ids_internal(pci, PCI_GET_DEVICES, 0, data, count);
-}
-
-extern errno_t pci_dev_get_info(pci_t *, devman_handle_t, pci_dev_info_t *);
-
-/** Get PCI device information.
- *
- * @param pci PCI service
- * @param dev_handle Device handle
- * @param info Place to store device information
- * @return EOK on success or an error code
- */
-errno_t pci_dev_get_info(pci_t *pci, devman_handle_t dev_handle,
-    pci_dev_info_t *info)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(pci->sess);
-	aid_t req = async_send_1(exch, PCI_DEV_GET_INFO, dev_handle, &answer);
-
-	errno_t rc = async_data_read_start(exch, info, sizeof(pci_dev_info_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/device/src/vbd.c
===================================================================
--- uspace/lib/device/src/vbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,364 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file Virtual Block Device client API
- */
-
-#include <abi/ipc/interfaces.h>
-#include <errno.h>
-#include <ipc/services.h>
-#include <ipc/vbd.h>
-#include <loc.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <types/label.h>
-#include <vbd.h>
-
-static errno_t vbd_get_ids_internal(vbd_t *, sysarg_t, sysarg_t, sysarg_t **,
-    size_t *);
-
-errno_t vbd_create(vbd_t **rvbd)
-{
-	vbd_t *vbd;
-	service_id_t vbd_svcid;
-	errno_t rc;
-
-	vbd = calloc(1, sizeof(vbd_t));
-	if (vbd == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = loc_service_get_id(SERVICE_NAME_VBD, &vbd_svcid,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	vbd->sess = loc_service_connect(vbd_svcid, INTERFACE_VBD,
-	    IPC_FLAG_BLOCKING);
-	if (vbd->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rvbd = vbd;
-	return EOK;
-error:
-	free(vbd);
-	return rc;
-}
-
-void vbd_destroy(vbd_t *vbd)
-{
-	if (vbd == NULL)
-		return;
-
-	async_hangup(vbd->sess);
-	free(vbd);
-}
-
-/** Get list of partitions as array of service IDs.
- *
- * @param vbd Virtual block device service
- * @param data Place to store pointer to array
- * @param count Place to store length of array (number of entries)
- *
- * @return EOK on success or an error code
- */
-errno_t vbd_get_disks(vbd_t *vbd, service_id_t **data, size_t *count)
-{
-	return vbd_get_ids_internal(vbd, VBD_GET_DISKS, 0, data, count);
-}
-
-/** Get disk information. */
-errno_t vbd_disk_info(vbd_t *vbd, service_id_t sid, vbd_disk_info_t *vinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vbd->sess);
-	aid_t req = async_send_1(exch, VBD_DISK_INFO, sid, &answer);
-	errno_t rc = async_data_read_start(exch, vinfo, sizeof(vbd_disk_info_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t vbd_label_create(vbd_t *vbd, service_id_t sid, label_type_t ltype)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vbd->sess);
-	retval = async_req_2_0(exch, VBD_LABEL_CREATE, sid, ltype);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t vbd_label_delete(vbd_t *vbd, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vbd->sess);
-	retval = async_req_1_0(exch, VBD_LABEL_DELETE, sid);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** Get list of IDs into a buffer of fixed size.
- *
- * @param vbd      Virtual Block Device
- * @param method   IPC method
- * @param arg1     First argument
- * @param id_buf   Buffer to store IDs
- * @param buf_size Buffer size
- * @param act_size Place to store actual size of complete data.
- *
- * @return EOK on success or an error code.
- */
-static errno_t vbd_get_ids_once(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
-    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = async_exchange_begin(vbd->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of IDs.
- *
- * Returns an allocated array of service IDs.
- *
- * @param vbd    Virtual Block Device
- * @param method IPC method
- * @param arg1   IPC argument 1
- * @param data   Place to store pointer to array of IDs
- * @param count  Place to store number of IDs
- * @return       EOK on success or an error code
- */
-static errno_t vbd_get_ids_internal(vbd_t *vbd, sysarg_t method, sysarg_t arg1,
-    sysarg_t **data, size_t *count)
-{
-	*data = NULL;
-	*count = 0;
-
-	size_t act_size = 0;
-	errno_t rc = vbd_get_ids_once(vbd, method, arg1, NULL, 0, &act_size);
-	if (rc != EOK)
-		return rc;
-
-	size_t alloc_size = act_size;
-	service_id_t *ids = malloc(alloc_size);
-	if (ids == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = vbd_get_ids_once(vbd, method, arg1, ids, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size = act_size;
-		service_id_t *tmp = realloc(ids, alloc_size);
-		if (tmp == NULL) {
-			free(ids);
-			return ENOMEM;
-		}
-		ids = tmp;
-	}
-
-	*count = act_size / sizeof(service_id_t);
-	*data = ids;
-	return EOK;
-}
-
-/** Get list of disks as array of service IDs.
- *
- * @param vbd   Virtual Block Device
- * @param data  Place to store pointer to array
- * @param count Place to store length of array (number of entries)
- *
- * @return EOK on success or an error code
- */
-errno_t vbd_label_get_parts(vbd_t *vbd, service_id_t disk,
-    service_id_t **data, size_t *count)
-{
-	return vbd_get_ids_internal(vbd, VBD_LABEL_GET_PARTS, disk,
-	    data, count);
-}
-
-errno_t vbd_part_get_info(vbd_t *vbd, vbd_part_id_t part, vbd_part_info_t *pinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vbd->sess);
-	aid_t req = async_send_1(exch, VBD_PART_GET_INFO, part, &answer);
-	errno_t rc = async_data_read_start(exch, pinfo, sizeof(vbd_part_info_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-errno_t vbd_part_create(vbd_t *vbd, service_id_t disk, vbd_part_spec_t *pspec,
-    vbd_part_id_t *rpart)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vbd->sess);
-	aid_t req = async_send_1(exch, VBD_PART_CREATE, disk, &answer);
-	errno_t rc = async_data_write_start(exch, pspec, sizeof(vbd_part_spec_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	*rpart = (vbd_part_id_t)ipc_get_arg1(&answer);
-	return EOK;
-
-}
-
-errno_t vbd_part_delete(vbd_t *vbd, vbd_part_id_t part)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vbd->sess);
-	retval = async_req_1_0(exch, VBD_PART_DELETE, part);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-void vbd_pspec_init(vbd_part_spec_t *pspec)
-{
-	memset(pspec, 0, sizeof(vbd_part_spec_t));
-}
-
-/** Suggest partition type based on partition content.
- *
- * @param vbd   Virtual Block Device
- * @param disk  Disk on which the partition will be created
- * @param pcnt  Partition content
- * @param ptype Place to store suggested partition type
- *
- * @return EOK on success or an error code
- */
-errno_t vbd_suggest_ptype(vbd_t *vbd, service_id_t disk, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vbd->sess);
-	aid_t req = async_send_2(exch, VBD_SUGGEST_PTYPE, disk, pcnt, &answer);
-	errno_t rc = async_data_read_start(exch, ptype, sizeof(label_ptype_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/device/src/vol.c
===================================================================
--- uspace/lib/device/src/vol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,611 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdevice
- * @{
- */
-/** @file Volume service API
- */
-
-#include <abi/ipc/interfaces.h>
-#include <errno.h>
-#include <ipc/services.h>
-#include <ipc/vol.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-
-/** Create Volume service session.
- *
- * @param rvol Place to store pointer to volume service session.
- * @return     EOK on success, ENOMEM if out of memory, EIO if service
- *             cannot be contacted.
- */
-errno_t vol_create(vol_t **rvol)
-{
-	vol_t *vol;
-	service_id_t vol_svcid;
-	errno_t rc;
-
-	vol = calloc(1, sizeof(vol_t));
-	if (vol == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = loc_service_get_id(SERVICE_NAME_VOLSRV, &vol_svcid, 0);
-	if (rc != EOK) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	vol->sess = loc_service_connect(vol_svcid, INTERFACE_VOL, 0);
-	if (vol->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rvol = vol;
-	return EOK;
-error:
-	free(vol);
-	return rc;
-}
-
-/** Destroy volume service session.
- *
- * @param vol Volume service session
- */
-void vol_destroy(vol_t *vol)
-{
-	if (vol == NULL)
-		return;
-
-	async_hangup(vol->sess);
-	free(vol);
-}
-
-/** Get list of IDs into a buffer of fixed size.
- *
- * @param vol      Volume service
- * @param method   IPC method
- * @param arg1     First argument
- * @param id_buf   Buffer to store IDs
- * @param buf_size Buffer size
- * @param act_size Place to store actual size of complete data.
- *
- * @return EOK on success or an error code.
- */
-static errno_t vol_get_ids_once(vol_t *vol, sysarg_t method, sysarg_t arg1,
-    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = async_exchange_begin(vol->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of IDs.
- *
- * Returns an allocated array of service IDs.
- *
- * @param vol    Volume service
- * @param method IPC method
- * @param arg1   IPC argument 1
- * @param data   Place to store pointer to array of IDs
- * @param count  Place to store number of IDs
- * @return       EOK on success or an error code
- */
-static errno_t vol_get_ids_internal(vol_t *vol, sysarg_t method, sysarg_t arg1,
-    sysarg_t **data, size_t *count)
-{
-	*data = NULL;
-	*count = 0;
-
-	size_t act_size = 0;
-	errno_t rc = vol_get_ids_once(vol, method, arg1, NULL, 0, &act_size);
-	if (rc != EOK)
-		return rc;
-
-	size_t alloc_size = act_size;
-	service_id_t *ids = malloc(alloc_size);
-	if (ids == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = vol_get_ids_once(vol, method, arg1, ids, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size = act_size;
-		service_id_t *temp = realloc(ids, alloc_size);
-		if (temp == NULL) {
-			free(ids);
-			return ENOMEM;
-		}
-		ids = temp;
-	}
-
-	*count = act_size / sizeof(service_id_t);
-	*data = ids;
-	return EOK;
-}
-
-/** Get list of partitions as array of service IDs.
- *
- * @param vol Volume service
- * @param data Place to store pointer to array
- * @param count Place to store length of array (number of entries)
- *
- * @return EOK on success or an error code
- */
-errno_t vol_get_parts(vol_t *vol, service_id_t **data, size_t *count)
-{
-	return vol_get_ids_internal(vol, VOL_GET_PARTS, 0, data, count);
-}
-
-/** Add partition.
- *
- * After a partition is created (e.g. as a result of deleting a label
- * the dummy partition is created), it can take some (unknown) time
- * until it is discovered.
- *
- * @param vol Volume service
- * @param sid Service ID of the partition
- * @return EOK on success or an error code
- */
-errno_t vol_part_add(vol_t *vol, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	retval = async_req_1_0(exch, VOL_PART_ADD, sid);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Get partition information.
- *
- * @param vol Volume service
- * @param sid Service ID of the partition
- * @param vinfo Place to store partition information
- * @return EOK on success or an error code
- */
-errno_t vol_part_info(vol_t *vol, service_id_t sid, vol_part_info_t *vinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_1(exch, VOL_PART_INFO, sid, &answer);
-
-	errno_t rc = async_data_read_start(exch, vinfo, sizeof(vol_part_info_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** Unmount partition (and possibly eject the media).
- *
- * @param vol Volume service
- * @param sid Service ID of the partition
- * @param flags Ejection flags
- * @return EOK on success or an error code
- */
-errno_t vol_part_eject(vol_t *vol, service_id_t sid, vol_eject_flags_t flags)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	retval = async_req_2_0(exch, VOL_PART_EJECT, sid, flags);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Erase partition (to the extent where we will consider it not containing
- * a file system.
- *
- * @param vol Volume service
- * @param sid Service ID of the partition
- * @return EOK on success or an error code
- */
-errno_t vol_part_empty(vol_t *vol, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	retval = async_req_1_0(exch, VOL_PART_EMPTY, sid);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Insert volume.
- *
- * This will re-mount the volume if it has been ejected previously.
- *
- * @param vol Volume service
- * @param sid Service ID of the partition
- * @return EOK on success or an error code
- */
-errno_t vol_part_insert(vol_t *vol, service_id_t sid)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	retval = async_req_1_0(exch, VOL_PART_INSERT, sid);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Insert volume by path.
- *
- * @param vol Volume service
- * @param path Filesystem path
- *
- * @return EOK on success or an error code
- */
-errno_t vol_part_insert_by_path(vol_t *vol, const char *path)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_0(exch, VOL_PART_INSERT_BY_PATH, &answer);
-
-	retval = async_data_write_start(exch, path, str_size(path));
-	if (retval != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Get volume label support.
- *
- * @param vol Volume service
- * @param fstype File system type
- * @param vlsupp Place to store volume label support information
- * @return EOK on success or an error code
- */
-errno_t vol_part_get_lsupp(vol_t *vol, vol_fstype_t fstype,
-    vol_label_supp_t *vlsupp)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_1(exch, VOL_PART_LSUPP, fstype, &answer);
-	errno_t rc = async_data_read_start(exch, vlsupp, sizeof(vol_label_supp_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** Create file system.
- *
- * @param vol Volume service
- * @param sid Partition service ID
- * @param fstype File system type
- * @param label Volume label
- * @param mountp Mount point
- *
- * @return EOK on success or an error code
- */
-errno_t vol_part_mkfs(vol_t *vol, service_id_t sid, vol_fstype_t fstype,
-    const char *label, const char *mountp)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_2(exch, VOL_PART_MKFS, sid, fstype, &answer);
-
-	retval = async_data_write_start(exch, label, str_size(label));
-	if (retval != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval;
-	}
-
-	retval = async_data_write_start(exch, mountp, str_size(mountp));
-	if (retval != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Set mount point for partition.
- *
- * @param vol Volume service
- * @param sid Partition service ID
- * @param mountp Mount point
- *
- * @return EOK on success or an error code
- */
-errno_t vol_part_set_mountp(vol_t *vol, service_id_t sid,
-    const char *mountp)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	errno_t retval;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_1(exch, VOL_PART_SET_MOUNTP, sid,
-	    &answer);
-
-	retval = async_data_write_start(exch, mountp, str_size(mountp));
-	if (retval != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Format file system type as string.
- *
- * @param fstype File system type
- * @param rstr Place to store pointer to newly allocated string
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_fstype_format(vol_fstype_t fstype, char **rstr)
-{
-	const char *sfstype;
-	char *s;
-
-	sfstype = NULL;
-	switch (fstype) {
-	case fs_exfat:
-		sfstype = "ExFAT";
-		break;
-	case fs_fat:
-		sfstype = "FAT";
-		break;
-	case fs_minix:
-		sfstype = "MINIX";
-		break;
-	case fs_ext4:
-		sfstype = "Ext4";
-		break;
-	case fs_cdfs:
-		sfstype = "ISO 9660";
-		break;
-	}
-
-	s = str_dup(sfstype);
-	if (s == NULL)
-		return ENOMEM;
-
-	*rstr = s;
-	return EOK;
-}
-
-/** Format partition content / file system type as string.
- *
- * @param pcnt Partition content
- * @param fstype File system type
- * @param rstr Place to store pointer to newly allocated string
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,
-    char **rstr)
-{
-	int rc;
-	char *s = NULL;
-
-	switch (pcnt) {
-	case vpc_empty:
-		s = str_dup("Empty");
-		if (s == NULL)
-			return ENOMEM;
-		break;
-	case vpc_fs:
-		rc = vol_fstype_format(fstype, &s);
-		if (rc != EOK)
-			return ENOMEM;
-		break;
-	case vpc_unknown:
-		s = str_dup("Unknown");
-		if (s == NULL)
-			return ENOMEM;
-		break;
-	}
-
-	assert(s != NULL);
-	*rstr = s;
-	return EOK;
-}
-
-/** Validate mount point.
- *
- * Verify that mount point is valid. A valid mount point is
- * one of:
- *  - 'Auto'
- *  - 'None'
- *  - /path (string beginning with '/') to an existing directory
- *
- * @return EOK if mount point is in valid, EINVAL if the format is invalid,
- *         ENOENT if the directory does not exist
- */
-errno_t vol_mountp_validate(const char *mountp)
-{
-	errno_t rc;
-	vfs_stat_t stat;
-
-	if (str_cmp(mountp, "Auto") == 0 || str_cmp(mountp, "auto") == 0)
-		return EOK;
-
-	if (str_casecmp(mountp, "None") == 0 || str_cmp(mountp, "none") == 0)
-		return EOK;
-
-	if (mountp[0] == '/') {
-		rc = vfs_stat_path(mountp, &stat);
-		if (rc != EOK || !stat.is_directory)
-			return ENOENT;
-
-		return EOK;
-	}
-
-	return EINVAL;
-}
-
-/** Get list of volumes as array of volume IDs.
- *
- * @param vol Volume service
- * @param data Place to store pointer to array
- * @param count Place to store length of array (number of entries)
- *
- * @return EOK on success or an error code
- */
-errno_t vol_get_volumes(vol_t *vol, volume_id_t **data, size_t *count)
-{
-	return vol_get_ids_internal(vol, VOL_GET_VOLUMES, 0,
-	    (sysarg_t **) data, count);
-}
-
-/** Get volume configuration information.
- *
- * @param vol Volume service
- * @param vid Volume ID
- * @param vinfo Place to store volume configuration information
- * @return EOK on success or an error code
- */
-errno_t vol_info(vol_t *vol, volume_id_t vid, vol_info_t *vinfo)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(vol->sess);
-	aid_t req = async_send_1(exch, VOL_INFO, vid.id, &answer);
-
-	errno_t rc = async_data_read_start(exch, vinfo, sizeof(vol_info_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return EIO;
-	}
-
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/dispcfg/doc/doxygroups.h
===================================================================
--- uspace/lib/dispcfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libdispcfg libdispcfg
- * @ingroup libs
- */
Index: pace/lib/dispcfg/include/dispcfg.h
===================================================================
--- uspace/lib/dispcfg/include/dispcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPCFG_DISPCFG_H_
-#define _LIBDISPCFG_DISPCFG_H_
-
-#include <errno.h>
-#include <types/common.h>
-#include "types/dispcfg.h"
-
-extern errno_t dispcfg_open(const char *, dispcfg_cb_t *, void *, dispcfg_t **);
-extern void dispcfg_close(dispcfg_t *);
-extern errno_t dispcfg_get_seat_list(dispcfg_t *, dispcfg_seat_list_t **);
-extern void dispcfg_free_seat_list(dispcfg_seat_list_t *);
-extern errno_t dispcfg_get_seat_info(dispcfg_t *, sysarg_t,
-    dispcfg_seat_info_t **);
-extern void dispcfg_free_seat_info(dispcfg_seat_info_t *);
-extern errno_t dispcfg_seat_create(dispcfg_t *, const char *, sysarg_t *);
-extern errno_t dispcfg_seat_delete(dispcfg_t *, sysarg_t);
-extern errno_t dispcfg_dev_assign(dispcfg_t *, sysarg_t, sysarg_t);
-extern errno_t dispcfg_dev_unassign(dispcfg_t *, sysarg_t);
-extern errno_t dispcfg_get_asgn_dev_list(dispcfg_t *, sysarg_t,
-    dispcfg_dev_list_t **);
-extern void dispcfg_free_dev_list(dispcfg_dev_list_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/include/dispcfg_srv.h
===================================================================
--- uspace/lib/dispcfg/include/dispcfg_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPCFG_DISPCFG_SRV_H_
-#define _LIBDISPCFG_DISPCFG_SRV_H_
-
-#include <async.h>
-#include <errno.h>
-#include "types/dispcfg.h"
-
-typedef struct dispcfg_ops dispcfg_ops_t;
-
-/** Display configuration server structure (per client session) */
-typedef struct {
-	async_sess_t *client_sess;
-	dispcfg_ops_t *ops;
-	void *arg;
-} dispcfg_srv_t;
-
-struct dispcfg_ops {
-	errno_t (*get_seat_list)(void *, dispcfg_seat_list_t **);
-	errno_t (*get_seat_info)(void *, sysarg_t, dispcfg_seat_info_t **);
-	errno_t (*seat_create)(void *, const char *, sysarg_t *);
-	errno_t (*seat_delete)(void *, sysarg_t);
-	errno_t (*dev_assign)(void *, sysarg_t, sysarg_t);
-	errno_t (*dev_unassign)(void *, sysarg_t);
-	errno_t (*get_asgn_dev_list)(void *, sysarg_t, dispcfg_dev_list_t **);
-	errno_t (*get_event)(void *, dispcfg_ev_t *);
-};
-
-extern void dispcfg_conn(ipc_call_t *, dispcfg_srv_t *);
-extern void dispcfg_srv_initialize(dispcfg_srv_t *);
-extern void dispcfg_srv_ev_pending(dispcfg_srv_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/include/ipc/dispcfg.h
===================================================================
--- uspace/lib/dispcfg/include/ipc/dispcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDISPCFG_IPC_DISPCFG_H
-#define LIBDISPCFG_IPC_DISPCFG_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	DISPCFG_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	DISPCFG_GET_SEAT_LIST,
-	DISPCFG_GET_SEAT_INFO,
-	DISPCFG_SEAT_CREATE,
-	DISPCFG_SEAT_DELETE,
-	DISPCFG_DEV_ASSIGN,
-	DISPCFG_DEV_UNASSIGN,
-	DISPCFG_GET_ASGN_DEV_LIST,
-	DISPCFG_GET_EVENT,
-} dispcfg_request_t;
-
-typedef enum {
-	DISPCFG_EV_PENDING = IPC_FIRST_USER_METHOD
-} dispcfg_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/include/testdc.h
===================================================================
--- uspace/lib/dispcfg/include/testdc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPCFG_TESTDC_H_
-#define _LIBDISPCFG_TESTDC_H_
-
-#include <async.h>
-#include "types/testdc.h"
-
-extern dispcfg_cb_t test_dispcfg_cb;
-
-extern void test_dispcfg_conn(ipc_call_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/include/types/dispcfg.h
===================================================================
--- uspace/lib/dispcfg/include/types/dispcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file Display configuration protocol types
- */
-
-#ifndef _LIBDISPCFG_TYPES_DISPCFG_H_
-#define _LIBDISPCFG_TYPES_DISPCFG_H_
-
-#include <ipc/services.h>
-#include <types/common.h>
-
-/** Use the default display configuration service (argument to dispcfg_open() */
-#define DISPCFG_DEFAULT SERVICE_NAME_DISPCFG
-
-struct dispcfg;
-
-/** Display configuration session */
-typedef struct dispcfg dispcfg_t;
-
-/** Display configuration callbacks */
-typedef struct {
-	/** Seat added */
-	void (*seat_added)(void *, sysarg_t);
-	/** Seat removed */
-	void (*seat_removed)(void *, sysarg_t);
-} dispcfg_cb_t;
-
-/** Display configuration event type */
-typedef enum {
-	/** Seat added */
-	dcev_seat_added,
-	/** Seat removed */
-	dcev_seat_removed,
-} dispcfg_ev_type_t;
-
-/** Display configuration event */
-typedef struct {
-	/** Event type */
-	dispcfg_ev_type_t etype;
-	/** Seat ID */
-	sysarg_t seat_id;
-} dispcfg_ev_t;
-
-/** Seat list */
-typedef struct {
-	/** Number of seats */
-	size_t nseats;
-	/** ID for each seat */
-	sysarg_t *seats;
-} dispcfg_seat_list_t;
-
-/** Seat information */
-typedef struct {
-	/** Seat name */
-	char *name;
-} dispcfg_seat_info_t;
-
-/** Assigned device list */
-typedef struct {
-	/** Number of devices */
-	size_t ndevs;
-	/** ID for each device */
-	sysarg_t *devs;
-} dispcfg_dev_list_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/include/types/testdc.h
===================================================================
--- uspace/lib/dispcfg/include/types/testdc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file Display configuration test service types
- */
-
-#ifndef _LIBDISPCFG_TYPES_TESTDC_H_
-#define _LIBDISPCFG_TYPES_TESTDC_H_
-
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/dispcfg.h>
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-	sysarg_t seat_id;
-	dispcfg_ev_t event;
-	dispcfg_ev_t revent;
-	int event_cnt;
-
-	bool get_seat_list_called;
-	dispcfg_seat_list_t *get_seat_list_rlist;
-
-	bool get_seat_info_called;
-	sysarg_t get_seat_info_seat_id;
-	dispcfg_seat_info_t *get_seat_info_rinfo;
-
-	bool seat_create_called;
-	char *seat_create_name;
-	sysarg_t seat_create_seat_id;
-
-	bool seat_delete_called;
-	sysarg_t seat_delete_seat_id;
-
-	bool dev_assign_called;
-	sysarg_t dev_assign_svc_id;
-	sysarg_t dev_assign_seat_id;
-
-	bool dev_unassign_called;
-	sysarg_t dev_unassign_svc_id;
-
-	bool get_asgn_dev_list_called;
-	sysarg_t get_asgn_dev_list_seat_id;
-	dispcfg_dev_list_t *get_asgn_dev_list_rlist;
-
-	bool get_event_called;
-
-	bool seat_added_called;
-	sysarg_t seat_added_seat_id;
-
-	bool seat_removed_called;
-	sysarg_t seat_removed_seat_id;
-
-	bool seat_changed_called;
-	sysarg_t seat_changed_seat_id;
-
-	fibril_condvar_t event_cv;
-	fibril_mutex_t event_lock;
-	dispcfg_srv_t *srv;
-} test_response_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/meson.build
===================================================================
--- uspace/lib/dispcfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/dispcfg.c',
-	'src/dispcfg_srv.c',
-	'src/testdc.c'
-)
-
-test_src = files(
-	'test/main.c',
-	'test/dispcfg.c'
-)
Index: pace/lib/dispcfg/private/dispcfg.h
===================================================================
--- uspace/lib/dispcfg/private/dispcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPCFG_PRIVATE_DISPCFG_H_
-#define _LIBDISPCFG_PRIVATE_DISPCFG_H_
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-
-/** Display configuration session structure */
-struct dispcfg {
-	/** Session with display configuration service */
-	async_sess_t *sess;
-	/** Callbacks */
-	dispcfg_cb_t *cb;
-	/** Calback argument */
-	void *cb_arg;
-	/** Synchronize access to display configuration object */
-	fibril_mutex_t lock;
-	/** @c true if callback handler terminated */
-	bool cb_done;
-	/** Signalled when cb_done or ev_pending is changed */
-	fibril_condvar_t cv;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/dispcfg/src/dispcfg.c
===================================================================
--- uspace/lib/dispcfg/src/dispcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/**
- * @file
- * @brief Display configuration protocol client
- */
-
-#include <async.h>
-#include <dispcfg.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <ipc/dispcfg.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../private/dispcfg.h"
-
-static errno_t dispcfg_callback_create(dispcfg_t *);
-static void dispcfg_cb_conn(ipc_call_t *, void *);
-
-/** Open display configuration service.
- *
- * @param wmname Display configuration service name or @c NULL to use default
- * @param cb Display configuration callbacks
- * @param cb_arg Callback argument
- * @param rdispcfg Place to store pointer to display configuration session
- * @return EOK on success or an error code
- */
-errno_t dispcfg_open(const char *wmname, dispcfg_cb_t *cb, void *cb_arg,
-    dispcfg_t **rdispcfg)
-{
-	service_id_t dispcfg_svc;
-	dispcfg_t *dispcfg;
-	errno_t rc;
-
-	dispcfg = calloc(1, sizeof(dispcfg_t));
-	if (dispcfg == NULL)
-		return ENOMEM;
-
-	dispcfg->cb = cb;
-	dispcfg->cb_arg = cb_arg;
-
-	fibril_mutex_initialize(&dispcfg->lock);
-	fibril_condvar_initialize(&dispcfg->cv);
-
-	if (wmname == NULL)
-		wmname = SERVICE_NAME_DISPCFG;
-
-	rc = loc_service_get_id(wmname, &dispcfg_svc, 0);
-	if (rc != EOK) {
-		free(dispcfg);
-		return ENOENT;
-	}
-
-	dispcfg->sess = loc_service_connect(dispcfg_svc, INTERFACE_DISPCFG,
-	    0);
-	if (dispcfg->sess == NULL) {
-		free(dispcfg);
-		return ENOENT;
-	}
-
-	rc = dispcfg_callback_create(dispcfg);
-	if (rc != EOK) {
-		async_hangup(dispcfg->sess);
-		free(dispcfg);
-		return EIO;
-	}
-
-	*rdispcfg = dispcfg;
-	return EOK;
-}
-
-/** Create callback connection from display configuration service.
- *
- * @param dispcfg Display configuration
- * @return EOK on success or an error code
- */
-static errno_t dispcfg_callback_create(dispcfg_t *dispcfg)
-{
-	async_exch_t *exch = async_exchange_begin(dispcfg->sess);
-
-	aid_t req = async_send_0(exch, DISPCFG_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_DISPCFG_CB, 0, 0,
-	    dispcfg_cb_conn, dispcfg, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Close display configuration service.
- *
- * @param dispcfg Display configuration
- */
-void dispcfg_close(dispcfg_t *dispcfg)
-{
-	fibril_mutex_lock(&dispcfg->lock);
-	async_hangup(dispcfg->sess);
-	dispcfg->sess = NULL;
-
-	/* Wait for callback handler to terminate */
-
-	while (!dispcfg->cb_done)
-		fibril_condvar_wait(&dispcfg->cv, &dispcfg->lock);
-	fibril_mutex_unlock(&dispcfg->lock);
-
-	free(dispcfg);
-}
-
-/** Get seat list.
- *
- * @param dispcfg Display configuration
- * @param rlist Place to store pointer to new seat list structure
- * @return EOK on success or an error code
- */
-errno_t dispcfg_get_seat_list(dispcfg_t *dispcfg, dispcfg_seat_list_t **rlist)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	dispcfg_seat_list_t *list;
-	sysarg_t nseats;
-	sysarg_t *seats;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	req = async_send_0(exch, DISPCFG_GET_SEAT_LIST, &answer);
-
-	/* Receive seat list length */
-	rc = async_data_read_start(exch, &nseats, sizeof (nseats));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(req, &rc);
-		return rc;
-	}
-
-	seats = calloc(nseats, sizeof(sysarg_t));
-	if (seats == NULL) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	/* Receive seat list */
-	rc = async_data_read_start(exch, seats, nseats * sizeof (sysarg_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	list = calloc(1, sizeof(dispcfg_seat_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	list->nseats = nseats;
-	list->seats = seats;
-	*rlist = list;
-	return EOK;
-}
-
-/** Free seat list.
- *
- * @param list Seat list
- */
-void dispcfg_free_seat_list(dispcfg_seat_list_t *list)
-{
-	free(list->seats);
-	free(list);
-}
-
-/** Get seat information.
- *
- * @param dispcfg Display configuration
- * @param seat_id Seat ID
- * @param rinfo Place to store pointer to new seat information structure
- * @return EOK on success or an error code
- */
-errno_t dispcfg_get_seat_info(dispcfg_t *dispcfg, sysarg_t seat_id,
-    dispcfg_seat_info_t **rinfo)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	dispcfg_seat_info_t *info;
-	sysarg_t namesize;
-	char *name;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	req = async_send_1(exch, DISPCFG_GET_SEAT_INFO, seat_id, &answer);
-
-	/* Receive name size */
-	rc = async_data_read_start(exch, &namesize, sizeof (namesize));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(req, &rc);
-		return rc;
-	}
-
-	name = calloc(namesize + 1, sizeof(char));
-	if (name == NULL) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	/* Receive name */
-	rc = async_data_read_start(exch, name, namesize);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	/* Null-terminate the string */
-	name[namesize] = '\0';
-
-	info = calloc(1, sizeof(dispcfg_seat_info_t));
-	if (info == NULL)
-		return ENOMEM;
-
-	info->name = name;
-	*rinfo = info;
-	return EOK;
-}
-
-/** Free seat information.
- *
- * @param info Seat information
- */
-void dispcfg_free_seat_info(dispcfg_seat_info_t *info)
-{
-	free(info->name);
-	free(info);
-}
-
-/** Create seat.
- *
- * @param dispcfg Display configuration session
- * @param name Seat name
- * @param rseat_id Place to store ID of the new seat
- * @return EOK on success or an error code
- */
-errno_t dispcfg_seat_create(dispcfg_t *dispcfg, const char *name,
-    sysarg_t *rseat_id)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	size_t name_size;
-	errno_t rc;
-
-	name_size = str_size(name);
-
-	exch = async_exchange_begin(dispcfg->sess);
-	req = async_send_0(exch, DISPCFG_SEAT_CREATE, &answer);
-
-	/* Write name */
-	rc = async_data_write_start(exch, name, name_size);
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	*rseat_id = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Delete seat.
- *
- * @param dispcfg Display configuration
- * @param seat_id Seat ID
- * @return EOK on success or an error code
- */
-errno_t dispcfg_seat_delete(dispcfg_t *dispcfg, sysarg_t seat_id)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	rc = async_req_1_0(exch, DISPCFG_SEAT_DELETE, seat_id);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Assign device to seat.
- *
- * @param dispcfg Display configuration
- * @param svc_id Device service ID
- * @param seat_id Seat ID
- * @return EOK on success or an error code
- */
-errno_t dispcfg_dev_assign(dispcfg_t *dispcfg, sysarg_t svc_id,
-    sysarg_t seat_id)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	rc = async_req_2_0(exch, DISPCFG_DEV_ASSIGN, svc_id, seat_id);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Unassign device from any specific seat.
- *
- * The device will fall back to the default seat.
- *
- * @param dispcfg Display configuration
- * @param svc_id Device service ID
- * @return EOK on success or an error code
- */
-errno_t dispcfg_dev_unassign(dispcfg_t *dispcfg, sysarg_t svc_id)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	rc = async_req_1_0(exch, DISPCFG_DEV_UNASSIGN, svc_id);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Get list of devices assigned to a seat.
- *
- * @param dispcfg Display configuration
- * @param seat_id Seat ID
- * @param rlist Place to store pointer to new device list structure
- * @return EOK on success or an error code
- */
-errno_t dispcfg_get_asgn_dev_list(dispcfg_t *dispcfg, sysarg_t seat_id,
-    dispcfg_dev_list_t **rlist)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	dispcfg_dev_list_t *list;
-	sysarg_t ndevs;
-	sysarg_t *devs;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	req = async_send_1(exch, DISPCFG_GET_ASGN_DEV_LIST, seat_id, &answer);
-
-	/* Receive device list length */
-	rc = async_data_read_start(exch, &ndevs, sizeof (ndevs));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(req, &rc);
-		return rc;
-	}
-
-	devs = calloc(ndevs, sizeof(sysarg_t));
-	if (devs == NULL) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	/* Receive device list */
-	rc = async_data_read_start(exch, devs, ndevs * sizeof (sysarg_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	list = calloc(1, sizeof(dispcfg_dev_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	list->ndevs = ndevs;
-	list->devs = devs;
-	*rlist = list;
-	return EOK;
-}
-
-/** Free device list.
- *
- * @param list Device list
- */
-void dispcfg_free_dev_list(dispcfg_dev_list_t *list)
-{
-	free(list->devs);
-	free(list);
-}
-
-/** Get display configuration event.
- *
- * @param dispcfg Display configuration
- * @param event Place to store event
- * @return EOK on success or an error code
- */
-static errno_t dispcfg_get_event(dispcfg_t *dispcfg, dispcfg_ev_t *event)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	exch = async_exchange_begin(dispcfg->sess);
-	req = async_send_0(exch, DISPCFG_GET_EVENT, &answer);
-	rc = async_data_read_start(exch, event, sizeof(*event));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Display configuration events are pending.
- *
- * @param dispcfg Display configuration
- * @param icall Call data
- */
-static void dispcfg_ev_pending(dispcfg_t *dispcfg, ipc_call_t *icall)
-{
-	errno_t rc;
-	dispcfg_ev_t event;
-
-	while (true) {
-		fibril_mutex_lock(&dispcfg->lock);
-
-		if (dispcfg->sess != NULL)
-			rc = dispcfg_get_event(dispcfg, &event);
-		else
-			rc = ENOENT;
-
-		fibril_mutex_unlock(&dispcfg->lock);
-
-		if (rc != EOK)
-			break;
-
-		switch (event.etype) {
-		case dcev_seat_added:
-			if (dispcfg->cb != NULL &&
-			    dispcfg->cb->seat_added != NULL) {
-				dispcfg->cb->seat_added(dispcfg->cb_arg,
-				    event.seat_id);
-			}
-			break;
-		case dcev_seat_removed:
-			if (dispcfg->cb != NULL &&
-			    dispcfg->cb->seat_removed != NULL) {
-				dispcfg->cb->seat_removed(dispcfg->cb_arg,
-				    event.seat_id);
-			}
-			break;
-		}
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** Callback connection handler.
- *
- * @param icall Connect call data
- * @param arg   Argument, dispcfg_t *
- */
-static void dispcfg_cb_conn(ipc_call_t *icall, void *arg)
-{
-	dispcfg_t *dispcfg = (dispcfg_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case DISPCFG_EV_PENDING:
-			dispcfg_ev_pending(dispcfg, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&dispcfg->lock);
-	dispcfg->cb_done = true;
-	fibril_mutex_unlock(&dispcfg->lock);
-	fibril_condvar_broadcast(&dispcfg->cv);
-}
-
-/** @}
- */
Index: pace/lib/dispcfg/src/dispcfg_srv.c
===================================================================
--- uspace/lib/dispcfg/src/dispcfg_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,489 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/**
- * @file
- * @brief Display configuration protocol server stub
- */
-
-#include <dispcfg.h>
-#include <dispcfg_srv.h>
-#include <errno.h>
-#include <ipc/dispcfg.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include "../private/dispcfg.h"
-
-static void dispcfg_callback_create_srv(dispcfg_srv_t *srv, ipc_call_t *call)
-{
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	srv->client_sess = sess;
-	async_answer_0(call, EOK);
-}
-
-static void dispcfg_get_seat_list_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	dispcfg_seat_list_t *list = NULL;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_seat_list == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_seat_list(srv->arg, &list);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send list size */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(list->nseats)) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &list->nseats, size);
-	if (rc != EOK) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send seat list */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != list->nseats * sizeof(sysarg_t)) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, list->seats, size);
-	if (rc != EOK) {
-		dispcfg_free_seat_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	dispcfg_free_seat_list(list);
-}
-
-static void dispcfg_get_seat_info_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t seat_id;
-	ipc_call_t call;
-	dispcfg_seat_info_t *info = NULL;
-	size_t namesize;
-	size_t size;
-	errno_t rc;
-
-	seat_id = ipc_get_arg1(icall);
-
-	if (srv->ops->get_seat_info == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_seat_info(srv->arg, seat_id, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send name size */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(size_t)) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	namesize = str_size(info->name);
-
-	rc = async_data_read_finalize(&call, &namesize, size);
-	if (rc != EOK) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send name */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != namesize) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, info->name, size);
-	if (rc != EOK) {
-		dispcfg_free_seat_info(info);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	dispcfg_free_seat_info(info);
-}
-
-static void dispcfg_seat_create_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t seat_id;
-	ipc_call_t call;
-	char *name;
-	size_t size;
-	errno_t rc;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	name = calloc(size + 1, 1);
-	if (name == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, name, size);
-	if (rc != EOK) {
-		free(name);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->seat_create == NULL) {
-		free(name);
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->seat_create(srv->arg, name, &seat_id);
-	async_answer_1(icall, rc, seat_id);
-	free(name);
-}
-
-static void dispcfg_seat_delete_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t seat_id;
-	errno_t rc;
-
-	seat_id = ipc_get_arg1(icall);
-
-	if (srv->ops->seat_delete == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->seat_delete(srv->arg, seat_id);
-	async_answer_0(icall, rc);
-}
-
-static void dispcfg_dev_assign_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t svc_id;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	svc_id = ipc_get_arg1(icall);
-	seat_id = ipc_get_arg2(icall);
-
-	if (srv->ops->dev_assign == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->dev_assign(srv->arg, svc_id, seat_id);
-	async_answer_0(icall, rc);
-}
-
-static void dispcfg_dev_unassign_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t svc_id;
-	errno_t rc;
-
-	svc_id = ipc_get_arg1(icall);
-
-	if (srv->ops->dev_unassign == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->dev_unassign(srv->arg, svc_id);
-	async_answer_0(icall, rc);
-}
-
-static void dispcfg_get_asgn_dev_list_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t seat_id;
-	ipc_call_t call;
-	dispcfg_dev_list_t *list = NULL;
-	size_t size;
-	errno_t rc;
-
-	seat_id = ipc_get_arg1(icall);
-
-	if (srv->ops->get_asgn_dev_list == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_asgn_dev_list(srv->arg, seat_id, &list);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send list size */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(list->ndevs)) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &list->ndevs, size);
-	if (rc != EOK) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send device list */
-
-	if (!async_data_read_receive(&call, &size)) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != list->ndevs * sizeof(sysarg_t)) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, list->devs, size);
-	if (rc != EOK) {
-		dispcfg_free_dev_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	dispcfg_free_dev_list(list);
-}
-
-static void dispcfg_get_event_srv(dispcfg_srv_t *srv, ipc_call_t *icall)
-{
-	dispcfg_ev_t event;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_event == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_event(srv->arg, &event);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Transfer event data */
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(event)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &event, sizeof(event));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-void dispcfg_conn(ipc_call_t *icall, dispcfg_srv_t *srv)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case DISPCFG_CALLBACK_CREATE:
-			dispcfg_callback_create_srv(srv, &call);
-			break;
-		case DISPCFG_GET_SEAT_LIST:
-			dispcfg_get_seat_list_srv(srv, &call);
-			break;
-		case DISPCFG_GET_SEAT_INFO:
-			dispcfg_get_seat_info_srv(srv, &call);
-			break;
-		case DISPCFG_SEAT_CREATE:
-			dispcfg_seat_create_srv(srv, &call);
-			break;
-		case DISPCFG_SEAT_DELETE:
-			dispcfg_seat_delete_srv(srv, &call);
-			break;
-		case DISPCFG_DEV_ASSIGN:
-			dispcfg_dev_assign_srv(srv, &call);
-			break;
-		case DISPCFG_DEV_UNASSIGN:
-			dispcfg_dev_unassign_srv(srv, &call);
-			break;
-		case DISPCFG_GET_ASGN_DEV_LIST:
-			dispcfg_get_asgn_dev_list_srv(srv, &call);
-			break;
-		case DISPCFG_GET_EVENT:
-			dispcfg_get_event_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	/* Hang up callback session */
-	if (srv->client_sess != NULL) {
-		async_hangup(srv->client_sess);
-		srv->client_sess = NULL;
-	}
-}
-
-/** Initialize display configuration server structure
- *
- * @param srv Display configuration server structure to initialize
- */
-void dispcfg_srv_initialize(dispcfg_srv_t *srv)
-{
-	memset(srv, 0, sizeof(*srv));
-}
-
-/** Send 'pending' event to client.
- *
- * @param srv Display configuration server structure
- */
-void dispcfg_srv_ev_pending(dispcfg_srv_t *srv)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(srv->client_sess);
-	async_msg_0(exch, DISPCFG_EV_PENDING);
-	async_exchange_end(exch);
-}
-
-/** @}
- */
Index: pace/lib/dispcfg/src/testdc.c
===================================================================
--- uspace/lib/dispcfg/src/testdc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdispcfg
- * @{
- */
-/**
- * @file
- * @brief Display configuration test service
- */
-
-#include <errno.h>
-#include <dispcfg.h>
-#include <dispcfg_srv.h>
-#include <fibril_synch.h>
-#include <str.h>
-#include <testdc.h>
-
-static errno_t test_get_seat_list(void *, dispcfg_seat_list_t **);
-static errno_t test_get_seat_info(void *, sysarg_t, dispcfg_seat_info_t **);
-static errno_t test_seat_create(void *, const char *, sysarg_t *);
-static errno_t test_seat_delete(void *, sysarg_t);
-static errno_t test_dev_assign(void *, sysarg_t, sysarg_t);
-static errno_t test_dev_unassign(void *, sysarg_t);
-static errno_t test_get_asgn_dev_list(void *, sysarg_t, dispcfg_dev_list_t **);
-static errno_t test_get_event(void *, dispcfg_ev_t *);
-
-static void test_seat_added(void *, sysarg_t);
-static void test_seat_removed(void *, sysarg_t);
-
-static dispcfg_ops_t test_dispcfg_srv_ops = {
-	.get_seat_list = test_get_seat_list,
-	.get_seat_info = test_get_seat_info,
-	.seat_create = test_seat_create,
-	.seat_delete = test_seat_delete,
-	.dev_assign = test_dev_assign,
-	.dev_unassign = test_dev_unassign,
-	.get_asgn_dev_list = test_get_asgn_dev_list,
-	.get_event = test_get_event
-};
-
-dispcfg_cb_t test_dispcfg_cb = {
-	.seat_added = test_seat_added,
-	.seat_removed = test_seat_removed
-};
-
-/** Test seat management service connection. */
-void test_dispcfg_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	dispcfg_srv_t srv;
-
-	/* Set up protocol structure */
-	dispcfg_srv_initialize(&srv);
-	srv.ops = &test_dispcfg_srv_ops;
-	srv.arg = arg;
-	resp->srv = &srv;
-
-	/* Handle connection */
-	dispcfg_conn(icall, &srv);
-
-	resp->srv = NULL;
-}
-
-static void test_seat_added(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = dcev_seat_added;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->seat_added_called = true;
-	resp->seat_added_seat_id = seat_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_seat_removed(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = dcev_seat_removed;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->seat_removed_called = true;
-	resp->seat_removed_seat_id = seat_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static errno_t test_get_seat_list(void *arg, dispcfg_seat_list_t **rlist)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_seat_list_called = true;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rlist = resp->get_seat_list_rlist;
-	return EOK;
-}
-
-static errno_t test_get_seat_info(void *arg, sysarg_t seat_id,
-    dispcfg_seat_info_t **rinfo)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_seat_info_called = true;
-	resp->get_seat_info_seat_id = seat_id;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rinfo = resp->get_seat_info_rinfo;
-	return EOK;
-}
-
-static errno_t test_seat_create(void *arg, const char *name, sysarg_t *rseat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->seat_create_called = true;
-	resp->seat_create_name = str_dup(name);
-	*rseat_id = resp->seat_create_seat_id;
-	return resp->rc;
-}
-
-static errno_t test_seat_delete(void *arg, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->seat_delete_called = true;
-	resp->seat_delete_seat_id = seat_id;
-	return resp->rc;
-}
-
-static errno_t test_dev_assign(void *arg, sysarg_t svc_id, sysarg_t seat_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->dev_assign_called = true;
-	resp->dev_assign_svc_id = svc_id;
-	resp->dev_assign_seat_id = seat_id;
-	return resp->rc;
-}
-
-static errno_t test_dev_unassign(void *arg, sysarg_t svc_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->dev_unassign_called = true;
-	resp->dev_unassign_svc_id = svc_id;
-	return resp->rc;
-}
-
-static errno_t test_get_asgn_dev_list(void *arg, sysarg_t seat_id,
-    dispcfg_dev_list_t **rlist)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_asgn_dev_list_called = true;
-	resp->get_asgn_dev_list_seat_id = seat_id;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rlist = resp->get_asgn_dev_list_rlist;
-	return EOK;
-}
-
-static errno_t test_get_event(void *arg, dispcfg_ev_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_event_called = true;
-	if (resp->event_cnt > 0) {
-		--resp->event_cnt;
-		*event = resp->event;
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-/** @}
- */
Index: pace/lib/dispcfg/test/dispcfg.c
===================================================================
--- uspace/lib/dispcfg/test/dispcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,746 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <dispcfg.h>
-#include <dispcfg_srv.h>
-#include <fibril_synch.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include <testdc.h>
-#include "../private/dispcfg.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(dispcfg);
-
-static const char *test_dispcfg_server = "test-dispcfg";
-static const char *test_dispcfg_svc = "test/dispcfg";
-
-/** dispcfg_open(), dispcfg_close() work for valid seat management service */
-PCUT_TEST(open_close)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_seat_list() with server returning error response works */
-PCUT_TEST(get_seat_list_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	dispcfg_seat_list_t *list;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = ENOMEM;
-	resp.get_seat_list_called = false;
-
-	rc = dispcfg_get_seat_list(dispcfg, &list);
-	PCUT_ASSERT_TRUE(resp.get_seat_list_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_seat_list() with server returning success response works */
-PCUT_TEST(get_seat_list_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	dispcfg_seat_list_t *list;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = EOK;
-	resp.get_seat_list_called = false;
-	resp.get_seat_list_rlist = calloc(1, sizeof(dispcfg_seat_list_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist);
-	resp.get_seat_list_rlist->nseats = 2;
-	resp.get_seat_list_rlist->seats = calloc(2, sizeof(sysarg_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_list_rlist->seats);
-	resp.get_seat_list_rlist->seats[0] = 42;
-	resp.get_seat_list_rlist->seats[1] = 43;
-
-	rc = dispcfg_get_seat_list(dispcfg, &list);
-	PCUT_ASSERT_TRUE(resp.get_seat_list_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, list->nseats);
-	PCUT_ASSERT_INT_EQUALS(42, list->seats[0]);
-	PCUT_ASSERT_INT_EQUALS(43, list->seats[1]);
-
-	dispcfg_free_seat_list(list);
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_seat_infp() with server returning error response works */
-PCUT_TEST(get_seat_info_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	dispcfg_seat_info_t *info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = ENOMEM;
-	resp.get_seat_info_called = false;
-	seat_id = 1;
-
-	rc = dispcfg_get_seat_info(dispcfg, seat_id, &info);
-	PCUT_ASSERT_TRUE(resp.get_seat_info_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.get_seat_info_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_seat_info() with server returning success response works */
-PCUT_TEST(get_seat_info_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	dispcfg_seat_info_t *info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = EOK;
-	resp.get_seat_info_called = false;
-	resp.get_seat_info_rinfo = calloc(1, sizeof(dispcfg_seat_info_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo);
-	resp.get_seat_info_rinfo->name = str_dup("Hello");
-	PCUT_ASSERT_NOT_NULL(resp.get_seat_info_rinfo->name);
-	seat_id = 1;
-
-	rc = dispcfg_get_seat_info(dispcfg, seat_id, &info);
-	PCUT_ASSERT_TRUE(resp.get_seat_info_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.get_seat_info_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_STR_EQUALS("Hello", info->name);
-
-	dispcfg_free_seat_info(info);
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_seat_create() with server returning error response works */
-PCUT_TEST(seat_create_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	seat_id = 13;
-	seat_id = 42;
-	resp.rc = ENOMEM;
-	resp.seat_create_called = false;
-
-	rc = dispcfg_seat_create(dispcfg, "Alice", &seat_id);
-	PCUT_ASSERT_TRUE(resp.seat_create_called);
-	PCUT_ASSERT_STR_EQUALS("Alice", resp.seat_create_name);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	free(resp.seat_create_name);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_seat_create() with server returning success response works */
-PCUT_TEST(seat_create_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = EOK;
-	resp.seat_create_called = false;
-	resp.seat_create_seat_id = 42;
-
-	rc = dispcfg_seat_create(dispcfg, "Alice", &seat_id);
-	PCUT_ASSERT_TRUE(resp.seat_create_called);
-	PCUT_ASSERT_STR_EQUALS("Alice", resp.seat_create_name);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.seat_create_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	free(resp.seat_create_name);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_seat_delete() with server returning error response works */
-PCUT_TEST(seat_delete_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	seat_id = 42;
-	resp.rc = ENOMEM;
-	resp.seat_delete_called = false;
-
-	rc = dispcfg_seat_delete(dispcfg, seat_id);
-	PCUT_ASSERT_TRUE(resp.seat_delete_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.seat_delete_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_seat_delete() with server returning success response works */
-PCUT_TEST(seat_delete_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	seat_id = 42;
-	resp.rc = EOK;
-	resp.seat_delete_called = false;
-
-	rc = dispcfg_seat_delete(dispcfg, seat_id);
-	PCUT_ASSERT_TRUE(resp.seat_delete_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.seat_delete_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_dev_assign() with server returning error response works */
-PCUT_TEST(dev_assign_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t svc_id;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	svc_id = 12;
-	seat_id = 13;
-	resp.rc = ENOMEM;
-	resp.dev_assign_called = false;
-
-	rc = dispcfg_dev_assign(dispcfg, svc_id, seat_id);
-	PCUT_ASSERT_TRUE(resp.dev_assign_called);
-	PCUT_ASSERT_INT_EQUALS(svc_id, resp.dev_assign_svc_id);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.dev_assign_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_dev_assign() with server returning success response works */
-PCUT_TEST(dev_assign_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t svc_id;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	svc_id = 12;
-	seat_id = 13;
-	resp.rc = EOK;
-	resp.dev_assign_called = false;
-
-	rc = dispcfg_dev_assign(dispcfg, svc_id, seat_id);
-	PCUT_ASSERT_TRUE(resp.dev_assign_called);
-	PCUT_ASSERT_INT_EQUALS(svc_id, resp.dev_assign_svc_id);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.dev_assign_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_dev_unassign() with server returning error response works */
-PCUT_TEST(dev_unassign_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t svc_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	svc_id = 12;
-	resp.rc = ENOMEM;
-	resp.dev_unassign_called = false;
-
-	rc = dispcfg_dev_unassign(dispcfg, svc_id);
-	PCUT_ASSERT_TRUE(resp.dev_unassign_called);
-	PCUT_ASSERT_INT_EQUALS(svc_id, resp.dev_unassign_svc_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_dev_unassign() with server returning success response works */
-PCUT_TEST(dev_unassign_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	sysarg_t svc_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	svc_id = 12;
-	resp.rc = EOK;
-	resp.dev_unassign_called = false;
-
-	rc = dispcfg_dev_unassign(dispcfg, svc_id);
-	PCUT_ASSERT_TRUE(resp.dev_unassign_called);
-	PCUT_ASSERT_INT_EQUALS(svc_id, resp.dev_unassign_svc_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_asgn_dev_list() with server returning error response works */
-PCUT_TEST(get_asgn_dev_list_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	dispcfg_dev_list_t *list;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = ENOMEM;
-	resp.get_asgn_dev_list_called = false;
-	seat_id = 42;
-
-	rc = dispcfg_get_asgn_dev_list(dispcfg, seat_id, &list);
-	PCUT_ASSERT_TRUE(resp.get_asgn_dev_list_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.get_asgn_dev_list_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** dispcfg_get_asgn_dev_list() with server returning success response works */
-PCUT_TEST(get_asgn_dev_list_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	dispcfg_dev_list_t *list;
-	sysarg_t seat_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, NULL, NULL, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-
-	resp.rc = EOK;
-	resp.get_asgn_dev_list_called = false;
-	resp.get_asgn_dev_list_rlist = calloc(1, sizeof(dispcfg_dev_list_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_asgn_dev_list_rlist);
-	resp.get_asgn_dev_list_rlist->ndevs = 2;
-	resp.get_asgn_dev_list_rlist->devs = calloc(2, sizeof(sysarg_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_asgn_dev_list_rlist->devs);
-	resp.get_asgn_dev_list_rlist->devs[0] = 11;
-	resp.get_asgn_dev_list_rlist->devs[1] = 12;
-	seat_id = 42;
-
-	rc = dispcfg_get_asgn_dev_list(dispcfg, seat_id, &list);
-	PCUT_ASSERT_TRUE(resp.get_asgn_dev_list_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.get_asgn_dev_list_seat_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, list->ndevs);
-	PCUT_ASSERT_INT_EQUALS(11, list->devs[0]);
-	PCUT_ASSERT_INT_EQUALS(12, list->devs[1]);
-
-	dispcfg_free_dev_list(list);
-	dispcfg_close(dispcfg);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Window added event can be delivered from server to client callback function */
-PCUT_TEST(seat_added_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, &test_dispcfg_cb, &resp, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.event_cnt = 1;
-	resp.event.etype = dcev_seat_added;
-	resp.event.seat_id = 42;
-	resp.seat_added_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	dispcfg_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.seat_added_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	dispcfg_close(dispcfg);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Window removed event can be delivered from server to client callback function */
-PCUT_TEST(seat_removed_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	dispcfg_t *dispcfg = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_dispcfg_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_dispcfg_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_dispcfg_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = dispcfg_open(test_dispcfg_svc, &test_dispcfg_cb, &resp, &dispcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dispcfg);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.event_cnt = 1;
-	resp.event.etype = dcev_seat_removed;
-	resp.event.seat_id = 42;
-	resp.seat_removed_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	dispcfg_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.seat_removed_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	dispcfg_close(dispcfg);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-PCUT_EXPORT(dispcfg);
Index: pace/lib/dispcfg/test/main.c
===================================================================
--- uspace/lib/dispcfg/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(dispcfg);
-
-PCUT_MAIN();
Index: pace/lib/display/doc/doxygroups.h
===================================================================
--- uspace/lib/display/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libdisplay libdisplay
- * @ingroup libs
- */
Index: pace/lib/display/include/disp_srv.h
===================================================================
--- uspace/lib/display/include/disp_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISP_SRV_H_
-#define _LIBDISPLAY_DISP_SRV_H_
-
-#include <async.h>
-#include <errno.h>
-#include <gfx/coord.h>
-#include "display/wndparams.h"
-#include "types/display/cursor.h"
-#include "types/display/event.h"
-#include "types/display/info.h"
-#include "types/display/wndresize.h"
-
-typedef struct display_ops display_ops_t;
-
-/** Display server structure (per client session) */
-typedef struct {
-	async_sess_t *client_sess;
-	display_ops_t *ops;
-	void *arg;
-} display_srv_t;
-
-struct display_ops {
-	errno_t (*window_create)(void *, display_wnd_params_t *, sysarg_t *);
-	errno_t (*window_destroy)(void *, sysarg_t);
-	errno_t (*window_move_req)(void *, sysarg_t, gfx_coord2_t *,
-	    sysarg_t);
-	errno_t (*window_resize_req)(void *, sysarg_t, display_wnd_rsztype_t,
-	    gfx_coord2_t *, sysarg_t);
-	errno_t (*window_move)(void *, sysarg_t, gfx_coord2_t *);
-	errno_t (*window_get_pos)(void *, sysarg_t, gfx_coord2_t *);
-	errno_t (*window_get_max_rect)(void *, sysarg_t, gfx_rect_t *);
-	errno_t (*window_resize)(void *, sysarg_t, gfx_coord2_t *, gfx_rect_t *);
-	errno_t (*window_minimize)(void *, sysarg_t);
-	errno_t (*window_maximize)(void *, sysarg_t);
-	errno_t (*window_unmaximize)(void *, sysarg_t);
-	errno_t (*window_set_cursor)(void *, sysarg_t, display_stock_cursor_t);
-	errno_t (*window_set_caption)(void *, sysarg_t, const char *);
-	errno_t (*get_event)(void *, sysarg_t *, display_wnd_ev_t *);
-	errno_t (*get_info)(void *, display_info_t *);
-};
-
-extern void display_conn(ipc_call_t *, display_srv_t *);
-extern void display_srv_initialize(display_srv_t *);
-extern void display_srv_ev_pending(display_srv_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/display.h
===================================================================
--- uspace/lib/display/include/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISPLAY_H_
-#define _LIBDISPLAY_DISPLAY_H_
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include "display/wndparams.h"
-#include "display/wndresize.h"
-#include "types/display.h"
-#include "types/display/cursor.h"
-#include "types/display/info.h"
-
-extern errno_t display_open(const char *, display_t **);
-extern void display_close(display_t *);
-extern void display_lock(display_t *);
-extern void display_unlock(display_t *);
-extern errno_t display_get_info(display_t *, display_info_t *);
-
-extern errno_t display_window_create(display_t *, display_wnd_params_t *,
-    display_wnd_cb_t *, void *, display_window_t **);
-extern errno_t display_window_destroy(display_window_t *);
-extern errno_t display_window_get_gc(display_window_t *, gfx_context_t **);
-extern errno_t display_window_move_req(display_window_t *, gfx_coord2_t *,
-    sysarg_t);
-extern errno_t display_window_resize_req(display_window_t *,
-    display_wnd_rsztype_t, gfx_coord2_t *, sysarg_t);
-extern errno_t display_window_move(display_window_t *, gfx_coord2_t *);
-extern errno_t display_window_get_pos(display_window_t *, gfx_coord2_t *);
-extern errno_t display_window_get_max_rect(display_window_t *, gfx_rect_t *);
-extern errno_t display_window_resize(display_window_t *,
-    gfx_coord2_t *, gfx_rect_t *);
-extern errno_t display_window_minimize(display_window_t *);
-extern errno_t display_window_maximize(display_window_t *);
-extern errno_t display_window_unmaximize(display_window_t *);
-extern errno_t display_window_set_cursor(display_window_t *,
-    display_stock_cursor_t);
-extern errno_t display_window_set_caption(display_window_t *, const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/display/event.h
===================================================================
--- uspace/lib/display/include/display/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISPLAY_EVENT_H_
-#define _LIBDISPLAY_DISPLAY_EVENT_H_
-
-#include <types/display/event.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/display/info.h
===================================================================
--- uspace/lib/display/include/display/info.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISPLAY_INFO_H_
-#define _LIBDISPLAY_DISPLAY_INFO_H_
-
-#include <types/display/info.h>
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/display/wndparams.h
===================================================================
--- uspace/lib/display/include/display/wndparams.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISPLAY_WNDPARAMS_H_
-#define _LIBDISPLAY_DISPLAY_WNDPARAMS_H_
-
-#include "../types/display/wndparams.h"
-
-extern void display_wnd_params_init(display_wnd_params_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/display/wndresize.h
===================================================================
--- uspace/lib/display/include/display/wndresize.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_DISPLAY_WNDRESIZE_H_
-#define _LIBDISPLAY_DISPLAY_WNDRESIZE_H_
-
-#include <stdbool.h>
-#include "../types/display/cursor.h"
-#include "../types/display/wndresize.h"
-
-extern display_stock_cursor_t display_cursor_from_wrsz(display_wnd_rsztype_t);
-extern bool display_wndrsz_valid(display_wnd_rsztype_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/ipc/display.h
===================================================================
--- uspace/lib/display/include/ipc/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDISPLAY_IPC_DISPLAY_H
-#define LIBDISPLAY_IPC_DISPLAY_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	DISPLAY_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	DISPLAY_WINDOW_CREATE,
-	DISPLAY_WINDOW_DESTROY,
-	DISPLAY_WINDOW_MINIMIZE,
-	DISPLAY_WINDOW_MAXIMIZE,
-	DISPLAY_WINDOW_MOVE,
-	DISPLAY_WINDOW_MOVE_REQ,
-	DISPLAY_WINDOW_GET_POS,
-	DISPLAY_WINDOW_GET_MAX_RECT,
-	DISPLAY_WINDOW_RESIZE,
-	DISPLAY_WINDOW_RESIZE_REQ,
-	DISPLAY_WINDOW_SET_CURSOR,
-	DISPLAY_WINDOW_SET_CAPTION,
-	DISPLAY_WINDOW_UNMAXIMIZE,
-	DISPLAY_GET_EVENT,
-	DISPLAY_GET_INFO
-} display_request_t;
-
-typedef enum {
-	DISPLAY_EV_PENDING = IPC_FIRST_USER_METHOD
-} display_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display.h
===================================================================
--- uspace/lib/display/include/types/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_H_
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Use the default display service (argument to display_open() */
-#define DISPLAY_DEFAULT NULL
-
-struct display;
-struct display_window;
-
-/** Display server session */
-typedef struct display display_t;
-
-/** Display window */
-typedef struct display_window display_window_t;
-
-/** Display window callbacks */
-typedef struct {
-	/** Close event */
-	void (*close_event)(void *);
-	/** Focus event */
-	void (*focus_event)(void *, unsigned);
-	/** Keyboard event */
-	void (*kbd_event)(void *, kbd_event_t *);
-	/** Position event */
-	void (*pos_event)(void *, pos_event_t *);
-	/** Resize event */
-	void (*resize_event)(void *, gfx_rect_t *);
-	/** Unfocus event */
-	void (*unfocus_event)(void *, unsigned);
-} display_wnd_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display/cursor.h
===================================================================
--- uspace/lib/display/include/types/display/cursor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_CURSOR_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_CURSOR_H_
-
-/** Stock cursor types */
-typedef enum {
-	/** Standard arrow */
-	dcurs_arrow,
-	/** Double arrow pointing up and down */
-	dcurs_size_ud,
-	/** Double arrow pointing left and right */
-	dcurs_size_lr,
-	/** Double arrow pointing up-left and down-right */
-	dcurs_size_uldr,
-	/** Double arrow pointing up-right nad down-left */
-	dcurs_size_urdl,
-	/** I-beam (suggests editable text) */
-	dcurs_ibeam
-} display_stock_cursor_t;
-
-enum {
-	/** Number of stock cursor types */
-	dcurs_limit = dcurs_ibeam + 1
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display/event.h
===================================================================
--- uspace/lib/display/include/types/display/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_EVENT_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_EVENT_H_
-
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-
-/** Display window event type */
-typedef enum {
-	/** Request to close window */
-	wev_close,
-	/** Window gained focus */
-	wev_focus,
-	/** Keyboard event */
-	wev_kbd,
-	/** Position event */
-	wev_pos,
-	/** Resize event */
-	wev_resize,
-	/** Window lost focus */
-	wev_unfocus
-} display_wnd_ev_type_t;
-
-/** Display window focus event */
-typedef struct {
-	/** New number of foci */
-	unsigned nfocus;
-} display_wnd_focus_ev_t;
-
-/** Display window resize event */
-typedef struct {
-	gfx_rect_t rect;
-} display_wnd_resize_ev_t;
-
-/** Display window unfocus event */
-typedef struct {
-	/** Number of remaining foci */
-	unsigned nfocus;
-} display_wnd_unfocus_ev_t;
-
-/** Display window event */
-typedef struct {
-	/** Event type */
-	display_wnd_ev_type_t etype;
-	union {
-		/** Focus event data */
-		display_wnd_focus_ev_t focus;
-		/** Keyboard event data */
-		kbd_event_t kbd;
-		/** Position event data */
-		pos_event_t pos;
-		/** Resize event data */
-		display_wnd_resize_ev_t resize;
-		/** Unfocus event data */
-		display_wnd_unfocus_ev_t unfocus;
-	} ev;
-} display_wnd_ev_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display/info.h
===================================================================
--- uspace/lib/display/include/types/display/info.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_INFO_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_INFO_H_
-
-#include <gfx/coord.h>
-
-/** Display information */
-typedef struct {
-	/** Display bounding rectangle */
-	gfx_rect_t rect;
-} display_info_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display/wndparams.h
===================================================================
--- uspace/lib/display/include/types/display/wndparams.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_WNDPARAMS_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_WNDPARAMS_H_
-
-#include <gfx/coord.h>
-
-/** Window flags */
-typedef enum {
-	/** Popup window (capture events, no focus) */
-	wndf_popup = 0x1,
-	/** Window does not receive focus */
-	wndf_nofocus = 0x2,
-	/** Topmost window */
-	wndf_topmost = 0x4,
-	/** Set specific initial window position */
-	wndf_setpos = 0x8,
-	/** Window is minimized */
-	wndf_minimized = 0x10,
-	/** Window is maximized */
-	wndf_maximized = 0x20,
-	/** Special system window */
-	wndf_system = 0x40,
-	/** Maximized windows should avoid this window */
-	wndf_avoid = 0x80
-} display_wnd_flags_t;
-
-/** Parameters for a new window.
- *
- * The window's dimensions are determined by the bounding rectangle,
- * the position of which does not relate to its position on the display,
- * it just determines which range of logical coordinates is used
- * by the window.
- */
-typedef struct {
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-	/** Window caption */
-	const char *caption;
-	/** Minimum size (when being resized) */
-	gfx_coord2_t min_size;
-	/** Initial position (if flag wndf_setpos is set) */
-	gfx_coord2_t pos;
-	/** Flags */
-	display_wnd_flags_t flags;
-	/** Input device ID associated with window's seat (or zero) */
-	sysarg_t idev_id;
-} display_wnd_params_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/include/types/display/wndresize.h
===================================================================
--- uspace/lib/display/include/types/display/wndresize.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_TYPES_DISPLAY_WNDRESIZE_H_
-#define _LIBDISPLAY_TYPES_DISPLAY_WNDRESIZE_H_
-
-/** Window resize type */
-typedef enum {
-	display_wr_top = 0x1,
-	display_wr_left = 0x2,
-	display_wr_bottom = 0x4,
-	display_wr_right = 0x8,
-
-	display_wr_top_left = display_wr_top | display_wr_left,
-	display_wr_bottom_left = display_wr_bottom | display_wr_left,
-	display_wr_bottom_right = display_wr_bottom | display_wr_right,
-	display_wr_top_right = display_wr_top | display_wr_right
-} display_wnd_rsztype_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/meson.build
===================================================================
--- uspace/lib/display/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'ipcgfx', 'input' ]
-src = files(
-	'src/display.c',
-	'src/disp_srv.c',
-	'src/wndresize.c',
-)
-
-test_src = files(
-	'test/display.c',
-	'test/main.c',
-	'test/wndresize.c',
-)
Index: pace/lib/display/private/display.h
===================================================================
--- uspace/lib/display/private/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_PRIVATE_DISPLAY_H_
-#define _LIBDISPLAY_PRIVATE_DISPLAY_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Display server session structure */
-struct display {
-	/** Session with display server */
-	async_sess_t *sess;
-	/** Synchronize access to display object */
-	fibril_mutex_t lock;
-	/** @c true if callback handler terminated */
-	bool cb_done;
-	/** Signalled when cb_done or ev_pending is changed */
-	fibril_condvar_t cv;
-	/** Windows (of display_window_t) */
-	list_t windows;
-};
-
-/** Display window structure */
-struct display_window {
-	/** Display associated with the window */
-	display_t *display;
-	/** Link to @c display->windows */
-	link_t lwindows;
-	/** Window ID */
-	sysarg_t id;
-	/** Callback functions */
-	display_wnd_cb_t *cb;
-	/** Argument to callback functions */
-	void *cb_arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/private/params.h
===================================================================
--- uspace/lib/display/private/params.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBDISPLAY_PRIVATE_PARAMS_H_
-#define _LIBDISPLAY_PRIVATE_PARAMS_H_
-
-#include <gfx/coord.h>
-#include <types/common.h>
-
-/** Window resize arguments. */
-typedef struct {
-	/** Offset */
-	gfx_coord2_t offs;
-	/** New bounding rectangle */
-	gfx_rect_t nrect;
-} display_wnd_resize_t;
-
-/** Display window parameters encoded for transport
- *
- * This omits variable-length fields (window caption).
- */
-typedef struct {
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-	/** Window caption size in bytes */
-	size_t caption_size;
-	/** Minimum size (when being resized) */
-	gfx_coord2_t min_size;
-	/** Initial position (if flag wndf_setpos is set) */
-	gfx_coord2_t pos;
-	/** Flags */
-	display_wnd_flags_t flags;
-	/** Input device ID associated with window's seat (or zero) */
-	sysarg_t idev_id;
-} display_wnd_params_enc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/display/src/disp_srv.c
===================================================================
--- uspace/lib/display/src/disp_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,695 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdisplay
- * @{
- */
-/**
- * @file
- * @brief Display protocol server stub
- */
-
-#include <disp_srv.h>
-#include <display/event.h>
-#include <display/info.h>
-#include <display/wndresize.h>
-#include <errno.h>
-#include <io/log.h>
-#include <ipc/display.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "../private/params.h"
-
-static void display_callback_create_srv(display_srv_t *srv, ipc_call_t *call)
-{
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	srv->client_sess = sess;
-	async_answer_0(call, EOK);
-}
-
-static void display_window_create_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	display_wnd_params_enc_t eparams;
-	display_wnd_params_t params;
-	char *caption;
-	size_t size;
-	errno_t rc;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(display_wnd_params_enc_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &eparams, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	caption = calloc(eparams.caption_size + 1, 1);
-	if (caption == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		free(caption);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != eparams.caption_size) {
-		free(caption);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, caption, eparams.caption_size);
-	if (rc != EOK) {
-		free(caption);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_create == NULL) {
-		free(caption);
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	/* Decode the parameters from transport */
-	params.rect = eparams.rect;
-	params.caption = caption;
-	params.min_size = eparams.min_size;
-	params.pos = eparams.pos;
-	params.flags = eparams.flags;
-	params.idev_id = eparams.idev_id;
-
-	rc = srv->ops->window_create(srv->arg, &params, &wnd_id);
-	async_answer_1(icall, rc, wnd_id);
-}
-
-static void display_window_destroy_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_destroy == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_destroy(srv->arg, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_move_req_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	sysarg_t pos_id;
-	ipc_call_t call;
-	gfx_coord2_t pos;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-	pos_id = ipc_get_arg2(icall);
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_coord2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &pos, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_move_req == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos, pos_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_move_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	gfx_coord2_t dpos;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_coord2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &dpos, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_move == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_move(srv->arg, wnd_id, &dpos);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_get_pos_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	gfx_coord2_t dpos;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_get_pos == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = srv->ops->window_get_pos(srv->arg, wnd_id, &dpos);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (size != sizeof(gfx_coord2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &dpos, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void display_window_get_max_rect_srv(display_srv_t *srv,
-    ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	gfx_rect_t rect;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_get_max_rect == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = srv->ops->window_get_max_rect(srv->arg, wnd_id, &rect);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (size != sizeof(gfx_rect_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &rect, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void display_window_resize_req_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	display_wnd_rsztype_t rsztype;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-	rsztype = (display_wnd_rsztype_t) ipc_get_arg2(icall);
-	pos_id = ipc_get_arg3(icall);
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_coord2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &pos, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_resize_req == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_resize_req(srv->arg, wnd_id, rsztype, &pos,
-	    pos_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_resize_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	display_wnd_resize_t wresize;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(display_wnd_resize_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &wresize, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_resize == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_resize(srv->arg, wnd_id, &wresize.offs,
-	    &wresize.nrect);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_minimize_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_minimize == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_minimize(srv->arg, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_maximize_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_maximize == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_maximize(srv->arg, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_unmaximize_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->window_unmaximize == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_unmaximize(srv->arg, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_set_cursor_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	display_stock_cursor_t cursor;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-	cursor = ipc_get_arg2(icall);
-
-	if (srv->ops->window_set_cursor == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_set_cursor(srv->arg, wnd_id, cursor);
-	async_answer_0(icall, rc);
-}
-
-static void display_window_set_caption_srv(display_srv_t *srv,
-    ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	char *caption;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	caption = calloc(size + 1, 1);
-	if (caption == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, caption, size);
-	if (rc != EOK) {
-		free(caption);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (srv->ops->window_set_caption == NULL) {
-		free(caption);
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->window_set_caption(srv->arg, wnd_id, caption);
-	async_answer_0(icall, rc);
-	free(caption);
-}
-
-static void display_get_event_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	display_wnd_ev_t event;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_event == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_event(srv->arg, &wnd_id, &event);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Transfer event data */
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(event)) {
-		async_answer_0(icall, EREFUSED);
-		async_answer_0(&call, EREFUSED);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &event, sizeof(event));
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		async_answer_0(&call, rc);
-		return;
-	}
-
-	async_answer_1(icall, EOK, wnd_id);
-}
-
-static void display_get_info_srv(display_srv_t *srv, ipc_call_t *icall)
-{
-	display_info_t info;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_info == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	/* Transfer information */
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(info)) {
-		async_answer_0(icall, EREFUSED);
-		async_answer_0(&call, EREFUSED);
-		return;
-	}
-
-	rc = srv->ops->get_info(srv->arg, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		async_answer_0(&call, rc);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &info, sizeof(info));
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		async_answer_0(&call, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-void display_conn(ipc_call_t *icall, display_srv_t *srv)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case DISPLAY_CALLBACK_CREATE:
-			display_callback_create_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_CREATE:
-			display_window_create_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_DESTROY:
-			display_window_destroy_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_MOVE_REQ:
-			display_window_move_req_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_MOVE:
-			display_window_move_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_GET_POS:
-			display_window_get_pos_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_GET_MAX_RECT:
-			display_window_get_max_rect_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_RESIZE_REQ:
-			display_window_resize_req_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_RESIZE:
-			display_window_resize_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_MINIMIZE:
-			display_window_minimize_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_MAXIMIZE:
-			display_window_maximize_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_UNMAXIMIZE:
-			display_window_unmaximize_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_SET_CURSOR:
-			display_window_set_cursor_srv(srv, &call);
-			break;
-		case DISPLAY_WINDOW_SET_CAPTION:
-			display_window_set_caption_srv(srv, &call);
-			break;
-		case DISPLAY_GET_EVENT:
-			display_get_event_srv(srv, &call);
-			break;
-		case DISPLAY_GET_INFO:
-			display_get_info_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	/* Hang up callback session */
-	if (srv->client_sess != NULL) {
-		async_hangup(srv->client_sess);
-		srv->client_sess = NULL;
-	}
-}
-
-/** Initialize display server structure
- *
- * @param srv Display server structure to initialize
- */
-void display_srv_initialize(display_srv_t *srv)
-{
-	memset(srv, 0, sizeof(*srv));
-}
-
-/** Send 'pending' event to client.
- *
- * @param srv Display server structure
- */
-void display_srv_ev_pending(display_srv_t *srv)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(srv->client_sess);
-	async_msg_0(exch, DISPLAY_EV_PENDING);
-	async_exchange_end(exch);
-}
-
-/** @}
- */
Index: pace/lib/display/src/display.c
===================================================================
--- uspace/lib/display/src/display.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,842 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <display.h>
-#include <display/event.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <ipc/display.h>
-#include <ipc/services.h>
-#include <ipcgfx/client.h>
-#include <loc.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../private/display.h"
-#include "../private/params.h"
-
-static errno_t display_callback_create(display_t *);
-static void display_cb_conn(ipc_call_t *, void *);
-static errno_t display_get_window(display_t *, sysarg_t, display_window_t **);
-
-/** Open display service.
- *
- * @param dsname Display service name or @c NULL to use default display
- * @param rdisplay Place to store pointer to display session
- * @return EOK on success or an error code
- */
-errno_t display_open(const char *dsname, display_t **rdisplay)
-{
-	service_id_t display_svc;
-	display_t *display;
-	errno_t rc;
-
-	display = calloc(1, sizeof(display_t));
-	if (display == NULL)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&display->lock);
-	fibril_condvar_initialize(&display->cv);
-	list_initialize(&display->windows);
-
-	if (dsname == NULL)
-		dsname = SERVICE_NAME_DISPLAY;
-
-	rc = loc_service_get_id(dsname, &display_svc, 0);
-	if (rc != EOK) {
-		free(display);
-		return ENOENT;
-	}
-
-	display->sess = loc_service_connect(display_svc, INTERFACE_DISPLAY,
-	    0);
-	if (display->sess == NULL) {
-		free(display);
-		return ENOENT;
-	}
-
-	rc = display_callback_create(display);
-	if (rc != EOK) {
-		async_hangup(display->sess);
-		free(display);
-		return EIO;
-	}
-
-	*rdisplay = display;
-	return EOK;
-}
-
-/** Create callback connection from display service.
- *
- * @param display Display session
- * @return EOK on success or an error code
- */
-static errno_t display_callback_create(display_t *display)
-{
-	async_exch_t *exch = async_exchange_begin(display->sess);
-
-	aid_t req = async_send_0(exch, DISPLAY_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_DISPLAY_CB, 0, 0,
-	    display_cb_conn, display, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Close display service.
- *
- * @param display Display session
- */
-void display_close(display_t *display)
-{
-	fibril_mutex_lock(&display->lock);
-	async_hangup(display->sess);
-	display->sess = NULL;
-
-	/* Wait for callback handler to terminate */
-
-	while (!display->cb_done)
-		fibril_condvar_wait(&display->cv, &display->lock);
-	fibril_mutex_unlock(&display->lock);
-
-	free(display);
-}
-
-/*
- * Lock display.
- *
- * While display is locked, display event handlers will not be called.
- *
- * @param display Display
- */
-void display_lock(display_t *display)
-{
-	fibril_mutex_lock(&display->lock);
-}
-
-/*
- * Unlock display.
- *
- * @param display Display
- */
-void display_unlock(display_t *display)
-{
-	fibril_mutex_unlock(&display->lock);
-}
-
-/** Initialize window parameters structure.
- *
- * Window parameters structure must always be initialized using this function
- * first.
- *
- * @param params Window parameters structure
- */
-void display_wnd_params_init(display_wnd_params_t *params)
-{
-	memset(params, 0, sizeof(*params));
-	params->caption = "";
-}
-
-/** Create a display window.
- *
- * @param display Display
- * @param params Window parameters
- * @param cb Callback functions
- * @param cb_arg Argument to callback functions
- * @param rwindow Place to store pointer to new window
- * @return EOK on success or an error code
- */
-errno_t display_window_create(display_t *display, display_wnd_params_t *params,
-    display_wnd_cb_t *cb, void *cb_arg, display_window_t **rwindow)
-{
-	display_window_t *window;
-	display_wnd_params_enc_t eparams;
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	/* Encode the parameters for transport */
-	eparams.rect = params->rect;
-	eparams.caption_size = str_size(params->caption);
-	eparams.min_size = params->min_size;
-	eparams.pos = params->pos;
-	eparams.flags = params->flags;
-	eparams.idev_id = params->idev_id;
-
-	window = calloc(1, sizeof(display_window_t));
-	if (window == NULL)
-		return ENOMEM;
-
-	exch = async_exchange_begin(display->sess);
-	req = async_send_0(exch, DISPLAY_WINDOW_CREATE, &answer);
-
-	/* Write fixed fields */
-	rc = async_data_write_start(exch, &eparams,
-	    sizeof (display_wnd_params_enc_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		free(window);
-		return rc;
-	}
-
-	/* Write caption */
-	rc = async_data_write_start(exch, params->caption,
-	    eparams.caption_size);
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		free(window);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK) {
-		free(window);
-		return rc;
-	}
-
-	window->display = display;
-	window->id = ipc_get_arg1(&answer);
-	window->cb = cb;
-	window->cb_arg = cb_arg;
-
-	list_append(&window->lwindows, &display->windows);
-	*rwindow = window;
-	return EOK;
-}
-
-/** Destroy display window.
- *
- * @param window Window or @c NULL
- * @return EOK on success or an error code. In both cases @a window must
- *         not be accessed anymore
- */
-errno_t display_window_destroy(display_window_t *window)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	if (window == NULL)
-		return EOK;
-
-	exch = async_exchange_begin(window->display->sess);
-	rc = async_req_1_0(exch, DISPLAY_WINDOW_DESTROY, window->id);
-
-	async_exchange_end(exch);
-
-	list_remove(&window->lwindows);
-	free(window);
-	return rc;
-}
-
-/** Create graphics context for drawing into a window.
- *
- * @param window Window
- * @param rgc Place to store pointer to new graphics context
- * @return EOK on success or an error code
- */
-errno_t display_window_get_gc(display_window_t *window, gfx_context_t **rgc)
-{
-	async_sess_t *sess;
-	async_exch_t *exch;
-	ipc_gc_t *gc;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	sess = async_connect_me_to(exch, INTERFACE_GC, 0, window->id, &rc);
-	if (sess == NULL) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-
-	rc = ipc_gc_create(sess, &gc);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return ENOMEM;
-	}
-
-	*rgc = ipc_gc_get_ctx(gc);
-	return EOK;
-}
-
-/** Request a window move.
- *
- * Request the display service to initiate a user window move operation
- * (i.e. let the user move the window). Used when the client detects
- * mouse press on the title bar or such.
- *
- * @param window Window
- * @param pos Position in the window where the button was pressed
- * @param pos_id Positioning device ID
- * @return EOK on success or an error code
- */
-errno_t display_window_move_req(display_window_t *window, gfx_coord2_t *pos,
-    sysarg_t pos_id)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_2(exch, DISPLAY_WINDOW_MOVE_REQ, window->id,
-	    pos_id, &answer);
-	rc = async_data_write_start(exch, (void *)pos, sizeof (gfx_coord2_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Move display window.
- *
- * Set new display position of a window. Display position determines where
- * the origin of the window coordinate system lies. Note that the top left
- * corner of the window need not coincide with the window's 0,0 point.
- *
- * @param window Window
- * @param dpos New display position
- * @return EOK on success or an error code
- */
-errno_t display_window_move(display_window_t *window, gfx_coord2_t *dpos)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_1(exch, DISPLAY_WINDOW_MOVE, window->id, &answer);
-	rc = async_data_write_start(exch, dpos, sizeof (gfx_coord2_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Get display window position.
- *
- * Get display window position on the display.
- *
- * @param window Window
- * @param dpos Place to store position
- * @return EOK on success or an error code
- */
-errno_t display_window_get_pos(display_window_t *window, gfx_coord2_t *dpos)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_1(exch, DISPLAY_WINDOW_GET_POS, window->id, &answer);
-	rc = async_data_read_start(exch, dpos, sizeof (gfx_coord2_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Get display window maximized rectangle.
- *
- * Get the rectangle to which a window would be maximized.
- *
- * @param window Window
- * @param rect Place to store maximized rectangle
- * @return EOK on success or an error code
- */
-errno_t display_window_get_max_rect(display_window_t *window, gfx_rect_t *rect)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_1(exch, DISPLAY_WINDOW_GET_MAX_RECT, window->id,
-	    &answer);
-	rc = async_data_read_start(exch, rect, sizeof (gfx_rect_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Request a window resize.
- *
- * Request the display service to initiate a user window resize operation
- * (i.e. let the user resize the window). Used when the client detects
- * mouse press on the window frame or such.
- *
- * @param window Window
- * @param rsztype Resize type (which part of window frame is being dragged)
- * @param pos Position in the window where the button was pressed
- * @param pos_id Positioning device ID
- * @return EOK on success or an error code
- */
-errno_t display_window_resize_req(display_window_t *window,
-    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_3(exch, DISPLAY_WINDOW_RESIZE_REQ, window->id,
-	    (sysarg_t) rsztype, pos_id, &answer);
-	rc = async_data_write_start(exch, (void *)pos, sizeof (gfx_coord2_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Resize display window.
- *
- * It seems resizing windows should be easy with bounding rectangles.
- * You have an old bounding rectangle and a new bounding rectangle (@a nrect).
- * Change .p0 and top-left corner moves. Change .p1 and bottom-right corner
- * moves. Piece of cake!
- *
- * There's always a catch, though. By series of resizes and moves .p0 could
- * drift outside of the range of @c gfx_coord_t. Now what? @a offs to the
- * rescue! @a offs moves the @em boundaries of the window with respect
- * to the display, while keeping the @em contents of the window in the
- * same place (with respect to the display). In other words, @a offs shifts
- * the window's internal coordinate system.
- *
- * A few examples follow:
- *
- * Enlarge window by moving bottom-right corner 1 right, 1 down:
- *
- *   bound = (0, 0, 10, 10)
- *   offs  = (0, 0)
- *   nrect = (0, 0, 11, 11)
- *
- * Enlarge window by moving top-left corner, 1 up, 1 left, allowing the
- * window-relative coordinate of the top-left corner to drift (undesirable)
- *
- *   bound = (0, 0, 10, 10)
- *   offs  = (0, 0)
- *   nrect = (-1, -1, 10, 10) <- this is the new bounding rectangle
- *
- * Enlarge window by moving top-left corner 1 up, 1 left, keeping top-left
- * corner locked to (0,0) window-relative coordinates (desirable):
- *
- *   bound = (0, 0, 10, 10)
- *   off   = (-1,-1)        <- top-left corner goes 1 up, 1 left
- *   nrect = (0, 0, 11, 11) <- window still starts at 0,0 window-relative
- *
- * @param window Window
- * @param nrect New bounding rectangle
- * @param offs
- * @return EOK on success or an error code
- */
-errno_t display_window_resize(display_window_t *window, gfx_coord2_t *offs,
-    gfx_rect_t *nrect)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	display_wnd_resize_t wresize;
-	errno_t rc;
-
-	wresize.offs = *offs;
-	wresize.nrect = *nrect;
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_1(exch, DISPLAY_WINDOW_RESIZE, window->id, &answer);
-	rc = async_data_write_start(exch, &wresize, sizeof (display_wnd_resize_t));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Minimize window.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t display_window_minimize(display_window_t *window)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	rc = async_req_1_0(exch, DISPLAY_WINDOW_MINIMIZE, window->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Maximize window.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t display_window_maximize(display_window_t *window)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	rc = async_req_1_0(exch, DISPLAY_WINDOW_MAXIMIZE, window->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Unmaximize window.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t display_window_unmaximize(display_window_t *window)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	rc = async_req_1_0(exch, DISPLAY_WINDOW_UNMAXIMIZE, window->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Set window cursor.
- *
- * Set cursor that is displayed when pointer is over the window. The default
- * is the arrow pointer.
- *
- * @param window Window
- * @param cursor Cursor to display
- * @return EOK on success or an error code
- */
-errno_t display_window_set_cursor(display_window_t *window,
-    display_stock_cursor_t cursor)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(window->display->sess);
-	rc = async_req_2_0(exch, DISPLAY_WINDOW_SET_CURSOR, window->id,
-	    cursor);
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Set display window caption.
- *
- * @param window Window
- * @param caption New caption
- * @return EOK on success or an error code
- */
-errno_t display_window_set_caption(display_window_t *window,
-    const char *caption)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	size_t cap_size;
-	errno_t rc;
-
-	cap_size = str_size(caption);
-
-	exch = async_exchange_begin(window->display->sess);
-	req = async_send_1(exch, DISPLAY_WINDOW_SET_CAPTION, window->id,
-	    &answer);
-
-	/* Write caption */
-	rc = async_data_write_start(exch, caption, cap_size);
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	return rc;
-}
-
-/** Get display event.
- *
- * @param display Display
- * @param rwindow Place to store pointer to window that received event
- * @param event Place to store event
- * @return EOK on success or an error code
- */
-static errno_t display_get_event(display_t *display, display_window_t **rwindow,
-    display_wnd_ev_t *event)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-	sysarg_t wnd_id;
-	display_window_t *window;
-
-	exch = async_exchange_begin(display->sess);
-	req = async_send_0(exch, DISPLAY_GET_EVENT, &answer);
-	rc = async_data_read_start(exch, event, sizeof(*event));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	wnd_id = ipc_get_arg1(&answer);
-	rc = display_get_window(display, wnd_id, &window);
-	if (rc != EOK)
-		return EIO;
-
-	*rwindow = window;
-	return EOK;
-}
-
-/** Get display information.
- *
- * @param display Display
- * @param info Place to store display information
- * @return EOK on success or an error code
- */
-errno_t display_get_info(display_t *display, display_info_t *info)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	exch = async_exchange_begin(display->sess);
-	req = async_send_0(exch, DISPLAY_GET_INFO, &answer);
-	rc = async_data_read_start(exch, info, sizeof(*info));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Display events are pending.
- *
- * @param display Display
- * @param icall Call data
- */
-static void display_ev_pending(display_t *display, ipc_call_t *icall)
-{
-	errno_t rc;
-	display_window_t *window = NULL;
-	display_wnd_ev_t event;
-
-	display_lock(display);
-
-	while (true) {
-		if (display->sess != NULL)
-			rc = display_get_event(display, &window, &event);
-		else
-			rc = ENOENT;
-
-		if (rc != EOK)
-			break;
-
-		switch (event.etype) {
-		case wev_close:
-			if (window->cb != NULL && window->cb->close_event != NULL) {
-				window->cb->close_event(window->cb_arg);
-			}
-			break;
-		case wev_focus:
-			if (window->cb != NULL && window->cb->focus_event != NULL) {
-				window->cb->focus_event(window->cb_arg,
-				    event.ev.focus.nfocus);
-			}
-			break;
-		case wev_kbd:
-			if (window->cb != NULL && window->cb->kbd_event != NULL) {
-				window->cb->kbd_event(window->cb_arg,
-				    &event.ev.kbd);
-			}
-			break;
-		case wev_pos:
-			if (window->cb != NULL && window->cb->pos_event != NULL) {
-				window->cb->pos_event(window->cb_arg,
-				    &event.ev.pos);
-			}
-			break;
-		case wev_resize:
-			if (window->cb != NULL && window->cb->resize_event != NULL) {
-				window->cb->resize_event(window->cb_arg,
-				    &event.ev.resize.rect);
-			}
-			break;
-		case wev_unfocus:
-			if (window->cb != NULL && window->cb->unfocus_event != NULL) {
-				window->cb->unfocus_event(window->cb_arg,
-				    event.ev.unfocus.nfocus);
-			}
-			break;
-		}
-	}
-
-	display_unlock(display);
-	async_answer_0(icall, EOK);
-}
-
-/** Callback connection handler.
- *
- * @param icall Connect call data
- * @param arg   Argument, display_t *
- */
-static void display_cb_conn(ipc_call_t *icall, void *arg)
-{
-	display_t *display = (display_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case DISPLAY_EV_PENDING:
-			display_ev_pending(display, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&display->lock);
-	display->cb_done = true;
-	fibril_mutex_unlock(&display->lock);
-	fibril_condvar_broadcast(&display->cv);
-}
-
-/** Find window by ID.
- *
- * @param display Display
- * @param wnd_id Window ID
- * @param rwindow Place to store pointer to window
- * @return EOK on success, ENOENT if not found
- */
-static errno_t display_get_window(display_t *display, sysarg_t wnd_id,
-    display_window_t **rwindow)
-{
-	link_t *link;
-	display_window_t *window;
-
-	link = list_first(&display->windows);
-	while (link != NULL) {
-		window = list_get_instance(link, display_window_t, lwindows);
-		if (window->id == wnd_id) {
-			*rwindow = window;
-			return EOK;
-		}
-
-		link = list_next(link, &display->windows);
-	}
-
-	return ENOENT;
-}
-
-/** @}
- */
Index: pace/lib/display/src/wndresize.c
===================================================================
--- uspace/lib/display/src/wndresize.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <display/wndresize.h>
-#include <stdbool.h>
-
-/** Get stock cursor to use for the specified window resize type.
- *
- * The resize type must be valid, otherwise behavior is undefined.
- * Resize type can be validated using @c display_wndrsz_valid().
- *
- * @param rsztype Resize type
- * @return Cursor to use for this resize type
- */
-display_stock_cursor_t display_cursor_from_wrsz(display_wnd_rsztype_t rsztype)
-{
-	switch (rsztype) {
-	case display_wr_top:
-	case display_wr_bottom:
-		return dcurs_size_ud;
-
-	case display_wr_left:
-	case display_wr_right:
-		return dcurs_size_lr;
-
-	case display_wr_top_left:
-	case display_wr_bottom_right:
-		return dcurs_size_uldr;
-
-	case display_wr_top_right:
-	case display_wr_bottom_left:
-		return dcurs_size_urdl;
-
-	default:
-		assert(false);
-		return dcurs_arrow;
-	}
-}
-
-/** Determine if resize type is valid.
- *
- * Determine if the resize type has one of the valid values. This function
- * should be used when the resize type comes from an untrusted source
- * (such as from the client).
- *
- * @param rsztype Resize type
- * @return @c true iff the resize type is valid
- */
-bool display_wndrsz_valid(display_wnd_rsztype_t rsztype)
-{
-	bool valid;
-
-	valid = false;
-
-	switch (rsztype) {
-	case display_wr_top:
-	case display_wr_bottom:
-	case display_wr_left:
-	case display_wr_right:
-	case display_wr_top_left:
-	case display_wr_bottom_right:
-	case display_wr_top_right:
-	case display_wr_bottom_left:
-		valid = true;
-		break;
-	}
-
-	return valid;
-}
-
-/** @}
- */
Index: pace/lib/display/test/display.c
===================================================================
--- uspace/lib/display/test/display.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2386 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <display.h>
-#include <disp_srv.h>
-#include <fibril_synch.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <ipcgfx/server.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../private/display.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(display);
-
-static const char *test_display_server = "test-display";
-static const char *test_display_svc = "test/display";
-
-static void test_display_conn(ipc_call_t *, void *);
-
-static void test_close_event(void *);
-static void test_focus_event(void *, unsigned);
-static void test_kbd_event(void *, kbd_event_t *);
-static void test_pos_event(void *, pos_event_t *);
-static void test_unfocus_event(void *, unsigned);
-
-static errno_t test_window_create(void *, display_wnd_params_t *, sysarg_t *);
-static errno_t test_window_destroy(void *, sysarg_t);
-static errno_t test_window_move_req(void *, sysarg_t, gfx_coord2_t *, sysarg_t);
-static errno_t test_window_move(void *, sysarg_t, gfx_coord2_t *);
-static errno_t test_window_get_pos(void *, sysarg_t, gfx_coord2_t *);
-static errno_t test_window_get_max_rect(void *, sysarg_t, gfx_rect_t *);
-static errno_t test_window_resize_req(void *, sysarg_t, display_wnd_rsztype_t,
-    gfx_coord2_t *, sysarg_t);
-static errno_t test_window_resize(void *, sysarg_t, gfx_coord2_t *,
-    gfx_rect_t *);
-static errno_t test_window_minimize(void *, sysarg_t);
-static errno_t test_window_maximize(void *, sysarg_t);
-static errno_t test_window_unmaximize(void *, sysarg_t);
-static errno_t test_window_set_cursor(void *, sysarg_t, display_stock_cursor_t);
-static errno_t test_window_set_caption(void *, sysarg_t, const char *);
-static errno_t test_get_event(void *, sysarg_t *, display_wnd_ev_t *);
-static errno_t test_get_info(void *, display_info_t *);
-
-static errno_t test_gc_set_color(void *, gfx_color_t *);
-
-static display_ops_t test_display_srv_ops = {
-	.window_create = test_window_create,
-	.window_destroy = test_window_destroy,
-	.window_move_req = test_window_move_req,
-	.window_move = test_window_move,
-	.window_get_pos = test_window_get_pos,
-	.window_get_max_rect = test_window_get_max_rect,
-	.window_resize_req = test_window_resize_req,
-	.window_resize = test_window_resize,
-	.window_minimize = test_window_minimize,
-	.window_maximize = test_window_maximize,
-	.window_unmaximize = test_window_unmaximize,
-	.window_set_cursor = test_window_set_cursor,
-	.window_set_caption = test_window_set_caption,
-	.get_event = test_get_event,
-	.get_info = test_get_info
-};
-
-static display_wnd_cb_t test_display_wnd_cb = {
-	.close_event = test_close_event,
-	.focus_event = test_focus_event,
-	.kbd_event = test_kbd_event,
-	.pos_event = test_pos_event,
-	.unfocus_event = test_unfocus_event
-};
-
-static gfx_context_ops_t test_gc_ops = {
-	.set_color = test_gc_set_color
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-	sysarg_t wnd_id;
-	display_wnd_ev_t event;
-	display_wnd_ev_t revent;
-	int event_cnt;
-	bool window_create_called;
-	gfx_rect_t create_rect;
-	gfx_coord2_t create_min_size;
-	sysarg_t create_idev_id;
-	bool window_destroy_called;
-	sysarg_t destroy_wnd_id;
-
-	bool window_move_req_called;
-	sysarg_t move_req_wnd_id;
-	gfx_coord2_t move_req_pos;
-	sysarg_t move_req_pos_id;
-
-	bool window_move_called;
-	sysarg_t move_wnd_id;
-	gfx_coord2_t move_dpos;
-
-	bool window_get_pos_called;
-	sysarg_t get_pos_wnd_id;
-	gfx_coord2_t get_pos_rpos;
-
-	bool window_get_max_rect_called;
-	sysarg_t get_max_rect_wnd_id;
-	gfx_rect_t get_max_rect_rrect;
-
-	bool window_resize_req_called;
-	sysarg_t resize_req_wnd_id;
-	display_wnd_rsztype_t resize_req_rsztype;
-	gfx_coord2_t resize_req_pos;
-	sysarg_t resize_req_pos_id;
-
-	bool window_resize_called;
-	gfx_coord2_t resize_offs;
-	gfx_rect_t resize_nbound;
-	sysarg_t resize_wnd_id;
-
-	bool window_minimize_called;
-	bool window_maximize_called;
-	bool window_unmaximize_called;
-
-	bool window_set_cursor_called;
-	sysarg_t set_cursor_wnd_id;
-	display_stock_cursor_t set_cursor_cursor;
-
-	bool window_set_caption_called;
-	sysarg_t set_caption_wnd_id;
-	char *set_caption_caption;
-
-	bool get_event_called;
-
-	bool get_info_called;
-	gfx_rect_t get_info_rect;
-
-	bool set_color_called;
-	bool close_event_called;
-
-	bool focus_event_called;
-	bool kbd_event_called;
-	bool pos_event_called;
-	bool unfocus_event_called;
-	fibril_condvar_t event_cv;
-	fibril_mutex_t event_lock;
-	display_srv_t *srv;
-} test_response_t;
-
-/** display_open(), display_close() work for valid display service */
-PCUT_TEST(open_close)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_create() with server returning error response works */
-PCUT_TEST(window_create_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	wnd = NULL;
-	resp.rc = ENOMEM;
-	resp.window_create_called = false;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-	params.min_size.x = 11;
-	params.min_size.y = 12;
-	params.idev_id = 42;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_TRUE(resp.window_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y);
-	PCUT_ASSERT_EQUALS(params.min_size.x, resp.create_min_size.x);
-	PCUT_ASSERT_EQUALS(params.min_size.y, resp.create_min_size.y);
-	PCUT_ASSERT_EQUALS(params.idev_id, resp.create_idev_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_NULL(wnd);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_create() and display_window_destroy() with success
- *
- * with server returning success,
- */
-PCUT_TEST(window_create_destroy_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	resp.window_create_called = false;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-	params.idev_id = 42;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_TRUE(resp.window_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y);
-	PCUT_ASSERT_EQUALS(params.idev_id, resp.create_idev_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.window_destroy_called = false;
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_TRUE(resp.window_destroy_called);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.destroy_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_create() with server returning error response works. */
-PCUT_TEST(window_destroy_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	resp.window_create_called = false;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_TRUE(resp.window_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_destroy_called = false;
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_TRUE(resp.window_destroy_called);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.destroy_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_destroy() can handle NULL argument */
-PCUT_TEST(window_destroy_null)
-{
-	display_window_destroy(NULL);
-}
-
-/** display_window_move_req() with server returning error response works. */
-PCUT_TEST(window_move_req_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_move_req_called = false;
-
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-
-	rc = display_window_move_req(wnd, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.window_move_req_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.move_req_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_move_req() with server returning success response works. */
-PCUT_TEST(window_move_req_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_move_req_called = false;
-
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-
-	rc = display_window_move_req(wnd, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.window_move_req_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.move_req_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.move_req_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.move_req_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.move_req_pos_id);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_move() with server returning error response works. */
-PCUT_TEST(window_move_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t dpos;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_move_called = false;
-	dpos.x = 11;
-	dpos.y = 12;
-
-	rc = display_window_move(wnd, &dpos);
-	PCUT_ASSERT_TRUE(resp.window_move_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.move_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(dpos.x, resp.move_dpos.x);
-	PCUT_ASSERT_INT_EQUALS(dpos.y, resp.move_dpos.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_move() with server returning success response works. */
-PCUT_TEST(window_move_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t dpos;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_move_called = false;
-	dpos.x = 11;
-	dpos.y = 12;
-
-	rc = display_window_move(wnd, &dpos);
-	PCUT_ASSERT_TRUE(resp.window_move_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.move_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(dpos.x, resp.move_dpos.x);
-	PCUT_ASSERT_INT_EQUALS(dpos.y, resp.move_dpos.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_pos() with server returning error response works. */
-PCUT_TEST(window_get_pos_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t dpos;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_get_pos_called = false;
-
-	dpos.x = 0;
-	dpos.y = 0;
-
-	rc = display_window_get_pos(wnd, &dpos);
-	PCUT_ASSERT_TRUE(resp.window_get_pos_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.get_pos_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(0, dpos.x);
-	PCUT_ASSERT_INT_EQUALS(0, dpos.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_pos() with server returning success response works. */
-PCUT_TEST(window_get_pos_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t dpos;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_get_pos_called = false;
-	resp.get_pos_rpos.x = 11;
-	resp.get_pos_rpos.y = 12;
-
-	dpos.x = 0;
-	dpos.y = 0;
-
-	rc = display_window_get_pos(wnd, &dpos);
-	PCUT_ASSERT_TRUE(resp.window_get_pos_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.get_pos_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(resp.get_pos_rpos.x, dpos.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_pos_rpos.y, dpos.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_max_rect() with server returning error response works. */
-PCUT_TEST(window_get_max_rect_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_rect_t rect;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_get_max_rect_called = false;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 0;
-	rect.p1.y = 0;
-
-	rc = display_window_get_max_rect(wnd, &rect);
-	PCUT_ASSERT_TRUE(resp.window_get_max_rect_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.get_max_rect_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_max_rect() with server returning success response works. */
-PCUT_TEST(window_get_max_rect_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_rect_t rect;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_get_max_rect_called = false;
-	resp.get_max_rect_rrect.p0.x = 11;
-	resp.get_max_rect_rrect.p0.y = 12;
-	resp.get_max_rect_rrect.p1.x = 13;
-	resp.get_max_rect_rrect.p1.y = 14;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 0;
-	rect.p1.y = 0;
-
-	rc = display_window_get_max_rect(wnd, &rect);
-	PCUT_ASSERT_TRUE(resp.window_get_max_rect_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.get_max_rect_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(resp.get_max_rect_rrect.p0.x, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_max_rect_rrect.p0.y, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(resp.get_max_rect_rrect.p1.x, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_max_rect_rrect.p1.y, rect.p1.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_resize_req() with server returning error response works. */
-PCUT_TEST(window_resize_req_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	display_wnd_rsztype_t rsztype;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_resize_req_called = false;
-
-	rsztype = display_wr_top_right;
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-
-	rc = display_window_resize_req(wnd, rsztype, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.window_resize_req_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(rsztype, resp.resize_req_rsztype);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.resize_req_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.resize_req_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.resize_req_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.resize_req_pos_id);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_resize_req() with server returning success response works. */
-PCUT_TEST(window_resize_req_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	display_wnd_rsztype_t rsztype;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_resize_req_called = false;
-
-	rsztype = display_wr_top_right;
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-
-	rc = display_window_resize_req(wnd, rsztype, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.window_resize_req_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(rsztype, resp.resize_req_rsztype);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.resize_req_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.resize_req_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.resize_req_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.resize_req_pos_id);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_resize() with server returning error response works. */
-PCUT_TEST(window_resize_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t offs;
-	gfx_rect_t nrect;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_resize_called = false;
-	offs.x = 11;
-	offs.y = 12;
-	nrect.p0.x = 13;
-	nrect.p0.y = 14;
-	nrect.p1.x = 15;
-	nrect.p1.y = 16;
-
-	rc = display_window_resize(wnd, &offs, &nrect);
-	PCUT_ASSERT_TRUE(resp.window_resize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.resize_wnd_id);
-	PCUT_ASSERT_INT_EQUALS(offs.x, resp.resize_offs.x);
-	PCUT_ASSERT_INT_EQUALS(offs.y, resp.resize_offs.y);
-	PCUT_ASSERT_INT_EQUALS(nrect.p0.x, resp.resize_nbound.p0.x);
-	PCUT_ASSERT_INT_EQUALS(nrect.p0.y, resp.resize_nbound.p0.y);
-	PCUT_ASSERT_INT_EQUALS(nrect.p1.x, resp.resize_nbound.p1.x);
-	PCUT_ASSERT_INT_EQUALS(nrect.p1.y, resp.resize_nbound.p1.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_resize() with server returning success response works. */
-PCUT_TEST(window_resize_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	gfx_coord2_t offs;
-	gfx_rect_t nrect;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_resize_called = false;
-	offs.x = 11;
-	offs.y = 12;
-	nrect.p0.x = 13;
-	nrect.p0.y = 14;
-	nrect.p1.x = 15;
-	nrect.p1.y = 16;
-
-	rc = display_window_resize(wnd, &offs, &nrect);
-	PCUT_ASSERT_TRUE(resp.window_resize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(offs.x, resp.resize_offs.x);
-	PCUT_ASSERT_INT_EQUALS(offs.y, resp.resize_offs.y);
-	PCUT_ASSERT_INT_EQUALS(nrect.p0.x, resp.resize_nbound.p0.x);
-	PCUT_ASSERT_INT_EQUALS(nrect.p0.y, resp.resize_nbound.p0.y);
-	PCUT_ASSERT_INT_EQUALS(nrect.p1.x, resp.resize_nbound.p1.x);
-	PCUT_ASSERT_INT_EQUALS(nrect.p1.y, resp.resize_nbound.p1.y);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_minimize() with server returning error response works. */
-PCUT_TEST(window_minimize_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_minimize_called = false;
-
-	rc = display_window_minimize(wnd);
-	PCUT_ASSERT_TRUE(resp.window_minimize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_minimize() with server returning success response works. */
-PCUT_TEST(window_minimize_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_minimize_called = false;
-
-	rc = display_window_minimize(wnd);
-	PCUT_ASSERT_TRUE(resp.window_minimize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_maximize() with server returning error response works. */
-PCUT_TEST(window_maximize_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_maximize_called = false;
-
-	rc = display_window_maximize(wnd);
-	PCUT_ASSERT_TRUE(resp.window_maximize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_maximize() with server returning success response works. */
-PCUT_TEST(window_maximize_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_maximize_called = false;
-
-	rc = display_window_maximize(wnd);
-	PCUT_ASSERT_TRUE(resp.window_maximize_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_set_cursor() with server returning error response works. */
-PCUT_TEST(window_set_cursor_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EIO;
-	resp.window_set_cursor_called = false;
-
-	rc = display_window_set_cursor(wnd, dcurs_size_ud);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.set_cursor_wnd_id);
-	PCUT_ASSERT_TRUE(resp.window_set_cursor_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_ud, resp.set_cursor_cursor);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_set_cursor() with server returning success response works. */
-PCUT_TEST(window_set_cursor_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.rc = EOK;
-	resp.window_set_cursor_called = false;
-
-	rc = display_window_set_cursor(wnd, dcurs_size_ud);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.set_cursor_wnd_id);
-	PCUT_ASSERT_TRUE(resp.window_set_cursor_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, EOK);
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_ud, resp.set_cursor_cursor);
-
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_set_caption() with server returning error response works. */
-PCUT_TEST(window_set_caption_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	const char *caption;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	caption = "Hello";
-
-	resp.rc = EIO;
-	resp.window_set_caption_called = false;
-
-	rc = display_window_set_caption(wnd, caption);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.set_caption_wnd_id);
-	PCUT_ASSERT_TRUE(resp.window_set_caption_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(caption, resp.set_caption_caption));
-
-	//free(resp.set_caption_caption);
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_set_caption() with server returning success response works. */
-PCUT_TEST(window_set_caption_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	const char *caption;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	caption = "Hello";
-
-	resp.rc = EOK;
-	resp.window_set_caption_called = false;
-
-	rc = display_window_set_caption(wnd, caption);
-	PCUT_ASSERT_INT_EQUALS(wnd->id, resp.set_caption_wnd_id);
-	PCUT_ASSERT_TRUE(resp.window_set_caption_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(caption, resp.set_caption_caption));
-
-	//free(resp.set_caption_caption);
-	display_window_destroy(wnd);
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_gc with server returning failure */
-PCUT_TEST(window_get_gc_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	gfx_context_t *gc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	gc = NULL;
-	resp.rc = ENOMEM;
-	rc = display_window_get_gc(wnd, &gc);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_NULL(gc);
-
-	resp.rc = EOK;
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_window_get_gc with server returning success */
-PCUT_TEST(window_get_gc_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	gc = NULL;
-	rc = display_window_get_gc(wnd, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.set_color_called = false;
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.set_color_called);
-
-	gfx_color_delete(color);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Close event can be delivered from server to client callback function */
-PCUT_TEST(close_event_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wev_close;
-	resp.wnd_id = wnd->id;
-	resp.close_event_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	display_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.close_event_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Focus event can be delivered from server to client callback function */
-PCUT_TEST(focus_event_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wev_focus;
-	resp.event.ev.focus.nfocus = 42;
-	resp.wnd_id = wnd->id;
-	resp.focus_event_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	display_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.focus_event_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.focus.nfocus,
-	    resp.revent.ev.focus.nfocus);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Keyboard event can be delivered from server to client callback function */
-PCUT_TEST(kbd_event_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wev_kbd;
-	resp.event.ev.kbd.type = KEY_PRESS;
-	resp.event.ev.kbd.key = KC_ENTER;
-	resp.event.ev.kbd.mods = 0;
-	resp.event.ev.kbd.c = L'\0';
-	resp.wnd_id = wnd->id;
-	resp.kbd_event_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	display_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.kbd_event_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.kbd.type,
-	    resp.revent.ev.kbd.type);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.kbd.key,
-	    resp.revent.ev.kbd.key);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.kbd.mods,
-	    resp.revent.ev.kbd.mods);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.kbd.c,
-	    resp.revent.ev.kbd.c);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Position event can be delivered from server to client callback function */
-PCUT_TEST(pos_event_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wev_pos;
-	resp.event.ev.pos.type = POS_PRESS;
-	resp.event.ev.pos.btn_num = 1;
-	resp.event.ev.pos.hpos = 2;
-	resp.event.ev.pos.vpos = 3;
-	resp.wnd_id = wnd->id;
-	resp.pos_event_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	display_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.pos_event_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.pos.type,
-	    resp.revent.ev.pos.type);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.pos.btn_num,
-	    resp.revent.ev.pos.btn_num);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.pos.hpos,
-	    resp.revent.ev.pos.hpos);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.pos.vpos,
-	    resp.revent.ev.pos.vpos);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Unfocus event can be delivered from server to client callback function */
-PCUT_TEST(unfocus_event_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_wnd_params_t params;
-	display_window_t *wnd;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	wnd = NULL;
-	resp.rc = EOK;
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = display_window_create(disp, &params, &test_display_wnd_cb,
-	    (void *) &resp, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wnd);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wev_unfocus;
-	resp.event.ev.unfocus.nfocus = 42;
-	resp.wnd_id = wnd->id;
-	resp.unfocus_event_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	display_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.unfocus_event_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-	PCUT_ASSERT_INT_EQUALS(resp.event.ev.focus.nfocus,
-	    resp.revent.ev.focus.nfocus);
-
-	rc = display_window_destroy(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_close(disp);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_get_info() with server returning failure response works. */
-PCUT_TEST(get_info_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_info_t info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = ENOMEM;
-	resp.get_info_called = false;
-
-	rc = display_get_info(disp, &info);
-	PCUT_ASSERT_TRUE(resp.get_info_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** display_get_info() with server returning success response works. */
-PCUT_TEST(get_info_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	display_t *disp = NULL;
-	display_info_t info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_display_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_display_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_display_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = display_open(test_display_svc, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(disp);
-
-	resp.rc = EOK;
-	resp.get_info_called = false;
-	resp.get_info_rect.p0.x = 10;
-	resp.get_info_rect.p0.y = 11;
-	resp.get_info_rect.p1.x = 20;
-	resp.get_info_rect.p1.y = 21;
-
-	rc = display_get_info(disp, &info);
-	PCUT_ASSERT_TRUE(resp.get_info_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_INT_EQUALS(resp.get_info_rect.p0.x, info.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_info_rect.p0.y, info.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(resp.get_info_rect.p1.x, info.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_info_rect.p1.y, info.rect.p1.y);
-
-	display_close(disp);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Test display service connection.
- *
- * This is very similar to connection handler in the display server.
- * XXX This should be folded into display_srv, if possible
- */
-static void test_display_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	display_srv_t srv;
-	sysarg_t wnd_id;
-	sysarg_t svc_id;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	svc_id = ipc_get_arg2(icall);
-	wnd_id = ipc_get_arg3(icall);
-
-	if (svc_id != 0) {
-		/* Set up protocol structure */
-		display_srv_initialize(&srv);
-		srv.ops = &test_display_srv_ops;
-		srv.arg = arg;
-		resp->srv = &srv;
-
-		/* Handle connection */
-		display_conn(icall, &srv);
-
-		resp->srv = NULL;
-	} else {
-		(void) wnd_id;
-
-		if (resp->rc != EOK) {
-			async_answer_0(icall, resp->rc);
-			return;
-		}
-
-		rc = gfx_context_new(&test_gc_ops, arg, &gc);
-		if (rc != EOK) {
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		/* Window GC connection */
-		gc_conn(icall, gc);
-	}
-}
-
-static void test_close_event(void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wev_close;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->close_event_called = true;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_focus_event(void *arg, unsigned nfocus)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wev_focus;
-	resp->revent.ev.focus.nfocus = nfocus;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->focus_event_called = true;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_kbd_event(void *arg, kbd_event_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wev_kbd;
-	resp->revent.ev.kbd = *event;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->kbd_event_called = true;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_pos_event(void *arg, pos_event_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wev_pos;
-	resp->revent.ev.pos = *event;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->pos_event_called = true;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_unfocus_event(void *arg, unsigned nfocus)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wev_unfocus;
-	resp->revent.ev.unfocus.nfocus = nfocus;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->unfocus_event_called = true;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static errno_t test_window_create(void *arg, display_wnd_params_t *params,
-    sysarg_t *rwnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_create_called = true;
-	resp->create_rect = params->rect;
-	resp->create_min_size = params->min_size;
-	resp->create_idev_id = params->idev_id;
-	if (resp->rc == EOK)
-		*rwnd_id = resp->wnd_id;
-
-	return resp->rc;
-}
-
-static errno_t test_window_destroy(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_destroy_called = true;
-	resp->destroy_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_window_move_req(void *arg, sysarg_t wnd_id,
-    gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_move_req_called = true;
-	resp->move_req_wnd_id = wnd_id;
-	resp->move_req_pos = *pos;
-	resp->move_req_pos_id = pos_id;
-	return resp->rc;
-}
-
-static errno_t test_window_move(void *arg, sysarg_t wnd_id, gfx_coord2_t *dpos)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_move_called = true;
-	resp->move_wnd_id = wnd_id;
-	resp->move_dpos = *dpos;
-	return resp->rc;
-}
-
-static errno_t test_window_get_pos(void *arg, sysarg_t wnd_id, gfx_coord2_t *dpos)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_get_pos_called = true;
-	resp->get_pos_wnd_id = wnd_id;
-
-	if (resp->rc == EOK)
-		*dpos = resp->get_pos_rpos;
-
-	return resp->rc;
-}
-
-static errno_t test_window_get_max_rect(void *arg, sysarg_t wnd_id,
-    gfx_rect_t *rect)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_get_max_rect_called = true;
-	resp->get_max_rect_wnd_id = wnd_id;
-
-	if (resp->rc == EOK)
-		*rect = resp->get_max_rect_rrect;
-
-	return resp->rc;
-}
-
-static errno_t test_window_resize_req(void *arg, sysarg_t wnd_id,
-    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_resize_req_called = true;
-	resp->resize_req_rsztype = rsztype;
-	resp->resize_req_wnd_id = wnd_id;
-	resp->resize_req_pos = *pos;
-	resp->resize_req_pos_id = pos_id;
-	return resp->rc;
-}
-
-static errno_t test_window_resize(void *arg, sysarg_t wnd_id,
-    gfx_coord2_t *offs, gfx_rect_t *nrect)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_resize_called = true;
-	resp->resize_wnd_id = wnd_id;
-	resp->resize_offs = *offs;
-	resp->resize_nbound = *nrect;
-	return resp->rc;
-}
-
-static errno_t test_window_minimize(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_minimize_called = true;
-	resp->resize_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_window_maximize(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_maximize_called = true;
-	resp->resize_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_window_unmaximize(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_unmaximize_called = true;
-	resp->resize_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_window_set_cursor(void *arg, sysarg_t wnd_id,
-    display_stock_cursor_t cursor)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_set_cursor_called = true;
-	resp->set_cursor_wnd_id = wnd_id;
-	resp->set_cursor_cursor = cursor;
-
-	return resp->rc;
-}
-
-static errno_t test_window_set_caption(void *arg, sysarg_t wnd_id,
-    const char *caption)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->window_set_caption_called = true;
-	resp->set_caption_wnd_id = wnd_id;
-	resp->set_caption_caption = str_dup(caption);
-
-	return resp->rc;
-}
-
-static errno_t test_get_event(void *arg, sysarg_t *wnd_id,
-    display_wnd_ev_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_event_called = true;
-	if (resp->event_cnt > 0) {
-		--resp->event_cnt;
-		*wnd_id = resp->wnd_id;
-		*event = resp->event;
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-static errno_t test_get_info(void *arg, display_info_t *info)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_info_called = true;
-	info->rect = resp->get_info_rect;
-
-	return resp->rc;
-}
-
-static errno_t test_gc_set_color(void *arg, gfx_color_t *color)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->set_color_called = true;
-	return resp->rc;
-}
-
-PCUT_EXPORT(display);
Index: pace/lib/display/test/main.c
===================================================================
--- uspace/lib/display/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(display);
-PCUT_IMPORT(wndresize);
-
-PCUT_MAIN();
Index: pace/lib/display/test/wndresize.c
===================================================================
--- uspace/lib/display/test/wndresize.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <display/wndresize.h>
-#include <errno.h>
-#include <limits.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(wndresize);
-
-/** display_cursor_from_wrsz() correctly translates resize type to cursor */
-PCUT_TEST(cursor_from_wrsz)
-{
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_ud,
-	    display_cursor_from_wrsz(display_wr_top));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_ud,
-	    display_cursor_from_wrsz(display_wr_bottom));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_lr,
-	    display_cursor_from_wrsz(display_wr_left));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_lr,
-	    display_cursor_from_wrsz(display_wr_right));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_uldr,
-	    display_cursor_from_wrsz(display_wr_top_left));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_uldr,
-	    display_cursor_from_wrsz(display_wr_bottom_right));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_urdl,
-	    display_cursor_from_wrsz(display_wr_top_right));
-	PCUT_ASSERT_INT_EQUALS(dcurs_size_urdl,
-	    display_cursor_from_wrsz(display_wr_bottom_left));
-}
-
-/** display_wndrsz_valid() correctly verifies window resize type */
-PCUT_TEST(wndrsz_valid)
-{
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(INT_MIN));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(display_wr_top - 1));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_top));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_left));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_bottom));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_right));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_top_left));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_top_right));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_bottom_left));
-	PCUT_ASSERT_TRUE(display_wndrsz_valid(display_wr_bottom_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(display_wr_bottom_right + 1));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_top | display_wr_bottom));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_left | display_wr_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_top | display_wr_left | display_wr_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_bottom | display_wr_left | display_wr_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_top | display_wr_bottom | display_wr_left));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_top | display_wr_bottom | display_wr_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(
-	    display_wr_top | display_wr_bottom |
-	    display_wr_left | display_wr_right));
-	PCUT_ASSERT_FALSE(display_wndrsz_valid(INT_MAX));
-}
-
-PCUT_EXPORT(wndresize);
Index: pace/lib/dltest/dltest.c
===================================================================
--- uspace/lib/dltest/dltest.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,174 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdltest
- * @{
- */
-/** @file
- */
-
-#include <fibril.h>
-#include "libdltest.h"
-
-/** Private initialized variable */
-static int private_var = dl_private_var_val;
-/** Private uninitialized variable */
-static int private_uvar;
-
-/** Public initialized variable */
-int dl_public_var = dl_public_var_val;
-/** Public variable initialized with the address of a symbol */
-int *dl_public_ptr_var = &dl_public_var;
-/** Public uninitialized variable */
-int dl_public_uvar;
-
-/** Private initialized fibril-local variable */
-static fibril_local int dl_private_fib_var = dl_private_fib_var_val;
-/** Private uninitialized fibril-local variable */
-static fibril_local int dl_private_fib_uvar;
-
-/** Public initialized fibril-local variable */
-fibril_local int dl_public_fib_var = dl_public_fib_var_val;
-/** Public uninitialized fibril-local variable */
-fibril_local int dl_public_fib_uvar;
-
-/** Return constant value. */
-int dl_get_constant(void)
-{
-	return dl_constant;
-}
-
-/** Return constant value by calling another function.
- *
- * This can be used to test dynamically linked call (via PLT) even in case
- * binaries are statically linked.
- */
-int dl_get_constant_via_call(void)
-{
-	return dl_get_constant();
-}
-
-/** Return value of private initialized variable */
-int dl_get_private_var(void)
-{
-	return private_var;
-}
-
-/** Return address of private initialized variable */
-int *dl_get_private_var_addr(void)
-{
-	return &private_var;
-}
-
-/** Return value of private uninitialized variable */
-int dl_get_private_uvar(void)
-{
-	return private_uvar;
-}
-
-/** Return vaddress of private uninitialized variable */
-int *dl_get_private_uvar_addr(void)
-{
-	return &private_uvar;
-}
-
-/** Return value of public initialized variable */
-int dl_get_public_var(void)
-{
-	return dl_public_var;
-}
-
-/** Return address of public initialized variable */
-int *dl_get_public_var_addr(void)
-{
-	return &dl_public_var;
-}
-
-/** Return value of public uninitialized variable */
-int dl_get_public_uvar(void)
-{
-	return dl_public_uvar;
-}
-
-/** Return address of public uninitialized variable */
-int *dl_get_public_uvar_addr(void)
-{
-	return &dl_public_uvar;
-}
-
-/** Return value of private initialized fibril-local variable */
-int dl_get_private_fib_var(void)
-{
-	return dl_private_fib_var;
-}
-
-/** Return address of private initialized fibril-local variable */
-int *dl_get_private_fib_var_addr(void)
-{
-	return &dl_private_fib_var;
-}
-
-/** Return value of private uninitialized fibril-local variable */
-int dl_get_private_fib_uvar(void)
-{
-	return dl_private_fib_uvar;
-}
-
-/** Return address of private uninitialized fibril-local variable */
-int *dl_get_private_fib_uvar_addr(void)
-{
-	return &dl_private_fib_uvar;
-}
-
-/** Return value of public initialized fibril-local variable */
-int dl_get_public_fib_var(void)
-{
-	return dl_public_fib_var;
-}
-
-/** Return value of public initialized fibril-local variable */
-int *dl_get_public_fib_var_addr(void)
-{
-	return &dl_public_fib_var;
-}
-
-/** Return value of public uninitialized fibril-local variable */
-int dl_get_public_fib_uvar(void)
-{
-	return dl_public_fib_uvar;
-}
-
-/** Return value of public uninitialized fibril-local variable */
-int *dl_get_public_fib_uvar_addr(void)
-{
-	return &dl_public_fib_uvar;
-}
-
-/**
- * @}
- */
Index: pace/lib/dltest/doc/doxygroups.h
===================================================================
--- uspace/lib/dltest/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libdltest libdltest
- * @brief Dynamic linking test library
- * @ingroup libs
- */
Index: pace/lib/dltest/libdltest.h
===================================================================
--- uspace/lib/dltest/libdltest.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdltest
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDLTEST_H
-#define LIBDLTEST_H
-
-#include <fibril.h>
-
-enum {
-	dl_constant = 110011,
-	dl_private_var_val = 220022,
-	dl_public_var_val = 330033,
-	dl_private_fib_var_val = 440044,
-	dl_public_fib_var_val = 550055
-};
-
-extern int dl_get_constant(void);
-extern int dl_get_constant_via_call(void);
-extern int dl_get_private_var(void);
-extern int *dl_get_private_var_addr(void);
-extern int dl_get_private_uvar(void);
-extern int *dl_get_private_uvar_addr(void);
-extern int dl_get_public_var(void);
-extern int *dl_get_public_var_addr(void);
-extern int dl_get_public_uvar(void);
-extern int *dl_get_public_uvar_addr(void);
-extern int dl_get_private_fib_var(void);
-extern int *dl_get_private_fib_var_addr(void);
-extern int dl_get_private_fib_uvar(void);
-extern int *dl_get_private_fib_uvar_addr(void);
-extern int dl_get_public_fib_var(void);
-extern int *dl_get_public_fib_var_addr(void);
-extern int dl_get_public_fib_uvar(void);
-extern int *dl_get_public_fib_uvar_addr(void);
-
-extern int dl_public_var;
-extern int dl_public_uvar;
-extern int *dl_public_ptr_var;
-extern fibril_local int dl_public_fib_var;
-extern fibril_local int dl_public_fib_uvar;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/dltest/meson.build
===================================================================
--- uspace/lib/dltest/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2016 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-allow_shared = true
-src = files(
-	'dltest.c',
-)
-
-# For dltests app.
-libdltest_includes = include_directories('.')
Index: pace/lib/drv/doc/doxygroups.h
===================================================================
--- uspace/lib/drv/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libdrv libdrv
- * @ingroup libs
- * @brief Generic device driver support
- */
Index: pace/lib/drv/generic/dev_iface.c
===================================================================
--- uspace/lib/drv/generic/dev_iface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libdrv
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stddef.h>
-
-#include "dev_iface.h"
-#include "remote_hw_res.h"
-#include "remote_pio_window.h"
-#include "remote_clock_dev.h"
-#include "remote_led_dev.h"
-#include "remote_battery_dev.h"
-#include "remote_nic.h"
-#include "remote_ieee80211.h"
-#include "remote_usb.h"
-#include "remote_usbdiag.h"
-#include "remote_usbhc.h"
-#include "remote_usbhid.h"
-#include "remote_pci.h"
-#include "remote_audio_mixer.h"
-#include "remote_audio_pcm.h"
-#include "remote_ahci.h"
-
-static const iface_dipatch_table_t remote_ifaces = {
-	.ifaces = {
-		[AUDIO_MIXER_IFACE] = &remote_audio_mixer_iface,
-		[AUDIO_PCM_BUFFER_IFACE] = &remote_audio_pcm_iface,
-		[HW_RES_DEV_IFACE] = &remote_hw_res_iface,
-		[PIO_WINDOW_DEV_IFACE] = &remote_pio_window_iface,
-		[NIC_DEV_IFACE] = &remote_nic_iface,
-		[IEEE80211_DEV_IFACE] = &remote_ieee80211_iface,
-		[PCI_DEV_IFACE] = &remote_pci_iface,
-		[USB_DEV_IFACE] = &remote_usb_iface,
-		[USBDIAG_DEV_IFACE] = &remote_usbdiag_iface,
-		[USBHC_DEV_IFACE] = &remote_usbhc_iface,
-		[USBHID_DEV_IFACE] = &remote_usbhid_iface,
-		[CLOCK_DEV_IFACE] = &remote_clock_dev_iface,
-		[LED_DEV_IFACE] = &remote_led_dev_iface,
-		[BATTERY_DEV_IFACE] = &remote_battery_dev_iface,
-		[AHCI_DEV_IFACE] = &remote_ahci_iface,
-	}
-};
-
-const remote_iface_t *get_remote_iface(int idx)
-{
-	assert(is_valid_iface_idx(idx));
-	return remote_ifaces.ifaces[idx];
-}
-
-remote_iface_func_ptr_t
-get_remote_method(const remote_iface_t *rem_iface, sysarg_t iface_method_idx)
-{
-	if (iface_method_idx >= rem_iface->method_count)
-		return NULL;
-
-	return rem_iface->methods[iface_method_idx];
-}
-
-bool is_valid_iface_idx(int idx)
-{
-	return (0 <= idx) && (idx < DEV_IFACE_MAX);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1099 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libdrv
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <ipc/services.h>
-#include <ipc/ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <ctype.h>
-#include <inttypes.h>
-#include <devman.h>
-
-#include "dev_iface.h"
-#include "ddf/driver.h"
-#include "ddf/interrupt.h"
-#include "private/driver.h"
-
-/** Driver structure */
-static const driver_t *driver;
-
-/** Devices */
-LIST_INITIALIZE(devices);
-FIBRIL_MUTEX_INITIALIZE(devices_mutex);
-
-/** Functions */
-LIST_INITIALIZE(functions);
-FIBRIL_MUTEX_INITIALIZE(functions_mutex);
-
-FIBRIL_RWLOCK_INITIALIZE(stopping_lock);
-static bool stopping = false;
-
-static ddf_dev_t *create_device(void);
-static void delete_device(ddf_dev_t *);
-static void dev_add_ref(ddf_dev_t *);
-static void dev_del_ref(ddf_dev_t *);
-static void fun_add_ref(ddf_fun_t *);
-static void fun_del_ref(ddf_fun_t *);
-static remote_handler_t *function_get_default_handler(ddf_fun_t *);
-static void *function_get_ops(ddf_fun_t *, dev_inferface_idx_t);
-
-static void add_to_functions_list(ddf_fun_t *fun)
-{
-	fibril_mutex_lock(&functions_mutex);
-	list_append(&fun->link, &functions);
-	fibril_mutex_unlock(&functions_mutex);
-}
-
-static void remove_from_functions_list(ddf_fun_t *fun)
-{
-	fibril_mutex_lock(&functions_mutex);
-	list_remove(&fun->link);
-	fibril_mutex_unlock(&functions_mutex);
-}
-
-static ddf_dev_t *driver_get_device(devman_handle_t handle)
-{
-	assert(fibril_mutex_is_locked(&devices_mutex));
-
-	list_foreach(devices, link, ddf_dev_t, dev) {
-		if (dev->handle == handle)
-			return dev;
-	}
-
-	return NULL;
-}
-
-static ddf_fun_t *driver_get_function(devman_handle_t handle)
-{
-	assert(fibril_mutex_is_locked(&functions_mutex));
-
-	list_foreach(functions, link, ddf_fun_t, fun) {
-		if (fun->handle == handle)
-			return fun;
-	}
-
-	return NULL;
-}
-
-static void driver_dev_add(ipc_call_t *icall)
-{
-	devman_handle_t dev_handle = ipc_get_arg1(icall);
-	devman_handle_t parent_fun_handle = ipc_get_arg2(icall);
-
-	char *dev_name = NULL;
-	errno_t rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&stopping_lock);
-
-	if (stopping) {
-		fibril_rwlock_read_unlock(&stopping_lock);
-		async_answer_0(icall, EIO);
-		return;
-	}
-
-	ddf_dev_t *dev = create_device();
-	if (!dev) {
-		fibril_rwlock_read_unlock(&stopping_lock);
-		free(dev_name);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	dev->handle = dev_handle;
-	dev->name = dev_name;
-
-	/*
-	 * Currently not used, parent fun handle is stored in context
-	 * of the connection to the parent device driver.
-	 */
-	(void) parent_fun_handle;
-
-	errno_t res = driver->driver_ops->dev_add(dev);
-
-	if (res != EOK) {
-		fibril_rwlock_read_unlock(&stopping_lock);
-		dev_del_ref(dev);
-		async_answer_0(icall, res);
-		return;
-	}
-
-	fibril_mutex_lock(&devices_mutex);
-	list_append(&dev->link, &devices);
-	fibril_mutex_unlock(&devices_mutex);
-	fibril_rwlock_read_unlock(&stopping_lock);
-
-	async_answer_0(icall, res);
-}
-
-static void driver_dev_remove(ipc_call_t *icall)
-{
-	devman_handle_t devh = ipc_get_arg1(icall);
-
-	fibril_mutex_lock(&devices_mutex);
-	ddf_dev_t *dev = driver_get_device(devh);
-	if (dev != NULL)
-		dev_add_ref(dev);
-	fibril_mutex_unlock(&devices_mutex);
-
-	if (dev == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	errno_t rc;
-
-	if (driver->driver_ops->dev_remove != NULL)
-		rc = driver->driver_ops->dev_remove(dev);
-	else
-		rc = ENOTSUP;
-
-	if (rc == EOK) {
-		fibril_mutex_lock(&devices_mutex);
-		list_remove(&dev->link);
-		fibril_mutex_unlock(&devices_mutex);
-		dev_del_ref(dev);
-	}
-
-	dev_del_ref(dev);
-	async_answer_0(icall, rc);
-}
-
-static void driver_dev_gone(ipc_call_t *icall)
-{
-	devman_handle_t devh = ipc_get_arg1(icall);
-
-	fibril_mutex_lock(&devices_mutex);
-	ddf_dev_t *dev = driver_get_device(devh);
-	if (dev != NULL)
-		dev_add_ref(dev);
-	fibril_mutex_unlock(&devices_mutex);
-
-	if (dev == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	errno_t rc;
-
-	if (driver->driver_ops->dev_gone != NULL)
-		rc = driver->driver_ops->dev_gone(dev);
-	else
-		rc = ENOTSUP;
-
-	if (rc == EOK) {
-		fibril_mutex_lock(&devices_mutex);
-		list_remove(&dev->link);
-		fibril_mutex_unlock(&devices_mutex);
-		dev_del_ref(dev);
-	}
-
-	dev_del_ref(dev);
-	async_answer_0(icall, rc);
-}
-
-static void driver_dev_quiesce(ipc_call_t *icall)
-{
-	devman_handle_t devh = ipc_get_arg1(icall);
-	ddf_fun_t *fun;
-	link_t *link;
-
-	fibril_mutex_lock(&devices_mutex);
-	ddf_dev_t *dev = driver_get_device(devh);
-	if (dev != NULL)
-		dev_add_ref(dev);
-	fibril_mutex_unlock(&devices_mutex);
-
-	if (dev == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	errno_t rc;
-
-	if (driver->driver_ops->dev_quiesce != NULL) {
-		rc = driver->driver_ops->dev_quiesce(dev);
-	} else {
-		/*
-		 * If the driver does not implement quiesce, we will
-		 * simply request all subordinate functions to quiesce.
-		 */
-		fibril_mutex_lock(&functions_mutex);
-		link = list_first(&functions);
-		while (link != NULL) {
-			fun = list_get_instance(link, ddf_fun_t, link);
-			if (fun->dev == dev)
-				ddf_fun_quiesce(fun);
-			link = list_next(link, &functions);
-		}
-		fibril_mutex_unlock(&functions_mutex);
-		rc = EOK;
-	}
-
-	dev_del_ref(dev);
-	async_answer_0(icall, rc);
-}
-
-static void driver_fun_online(ipc_call_t *icall)
-{
-	devman_handle_t funh = ipc_get_arg1(icall);
-
-	/*
-	 * Look the function up. Bump reference count so that
-	 * the function continues to exist until we return
-	 * from the driver.
-	 */
-	fibril_mutex_lock(&functions_mutex);
-
-	ddf_fun_t *fun = driver_get_function(funh);
-	if (fun != NULL)
-		fun_add_ref(fun);
-
-	fibril_mutex_unlock(&functions_mutex);
-
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	/* Call driver entry point */
-	errno_t rc;
-
-	if (driver->driver_ops->fun_online != NULL)
-		rc = driver->driver_ops->fun_online(fun);
-	else
-		rc = ENOTSUP;
-
-	fun_del_ref(fun);
-
-	async_answer_0(icall, rc);
-}
-
-static void driver_fun_offline(ipc_call_t *icall)
-{
-	devman_handle_t funh = ipc_get_arg1(icall);
-
-	/*
-	 * Look the function up. Bump reference count so that
-	 * the function continues to exist until we return
-	 * from the driver.
-	 */
-	fibril_mutex_lock(&functions_mutex);
-
-	ddf_fun_t *fun = driver_get_function(funh);
-	if (fun != NULL)
-		fun_add_ref(fun);
-
-	fibril_mutex_unlock(&functions_mutex);
-
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	/* Call driver entry point */
-	errno_t rc;
-
-	if (driver->driver_ops->fun_offline != NULL)
-		rc = driver->driver_ops->fun_offline(fun);
-	else
-		rc = ENOTSUP;
-
-	async_answer_0(icall, rc);
-}
-
-static void driver_stop(ipc_call_t *icall)
-{
-	/* Prevent new devices from being added */
-	fibril_rwlock_write_lock(&stopping_lock);
-	stopping = true;
-
-	/* Check if there are any devices */
-	fibril_mutex_lock(&devices_mutex);
-	if (list_first(&devices) != NULL) {
-		/* Devices exist, roll back */
-		fibril_mutex_unlock(&devices_mutex);
-		stopping = false;
-		fibril_rwlock_write_unlock(&stopping_lock);
-		async_answer_0(icall, EBUSY);
-		return;
-	}
-
-	fibril_rwlock_write_unlock(&stopping_lock);
-
-	/* There should be no functions at this point */
-	fibril_mutex_lock(&functions_mutex);
-	assert(list_first(&functions) == NULL);
-	fibril_mutex_unlock(&functions_mutex);
-
-	/* Reply with success and terminate */
-	async_answer_0(icall, EOK);
-	exit(0);
-}
-
-static void driver_connection_devman(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case DRIVER_DEV_ADD:
-			driver_dev_add(&call);
-			break;
-		case DRIVER_DEV_REMOVE:
-			driver_dev_remove(&call);
-			break;
-		case DRIVER_DEV_GONE:
-			driver_dev_gone(&call);
-			break;
-		case DRIVER_DEV_QUIESCE:
-			driver_dev_quiesce(&call);
-			break;
-		case DRIVER_FUN_ONLINE:
-			driver_fun_online(&call);
-			break;
-		case DRIVER_FUN_OFFLINE:
-			driver_fun_offline(&call);
-			break;
-		case DRIVER_STOP:
-			driver_stop(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** Generic client connection handler both for applications and drivers.
- *
- * @param drv True for driver client, false for other clients
- *            (applications, services, etc.).
- *
- */
-static void driver_connection_gen(ipc_call_t *icall, bool drv)
-{
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call and remember the handle of
-	 * the device to which the client connected.
-	 */
-	devman_handle_t handle = ipc_get_arg2(icall);
-
-	fibril_mutex_lock(&functions_mutex);
-	ddf_fun_t *fun = driver_get_function(handle);
-	if (fun != NULL)
-		fun_add_ref(fun);
-	fibril_mutex_unlock(&functions_mutex);
-
-	if (fun == NULL) {
-		printf("%s: driver_connection_gen error - no function with handle"
-		    " %" PRIun " was found.\n", driver->name, handle);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (fun->conn_handler != NULL) {
-		/* Driver has a custom connection handler. */
-		(*fun->conn_handler)(icall, (void *)fun);
-		fun_del_ref(fun);
-		return;
-	}
-
-	/*
-	 * TODO - if the client is not a driver, check whether it is allowed to
-	 * use the device.
-	 */
-
-	errno_t ret = EOK;
-	/* Open device function */
-	if (fun->ops != NULL && fun->ops->open != NULL)
-		ret = (*fun->ops->open)(fun);
-
-	if (ret != EOK) {
-		async_answer_0(icall, ret);
-		fun_del_ref(fun);
-		return;
-	}
-
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* Close device function */
-			if (fun->ops != NULL && fun->ops->close != NULL)
-				(*fun->ops->close)(fun);
-			async_answer_0(&call, EOK);
-			fun_del_ref(fun);
-			return;
-		}
-
-		/* Convert ipc interface id to interface index */
-
-		int iface_idx = DEV_IFACE_IDX(method);
-
-		if (!is_valid_iface_idx(iface_idx)) {
-			remote_handler_t *default_handler =
-			    function_get_default_handler(fun);
-			if (default_handler != NULL) {
-				(*default_handler)(fun, &call);
-				continue;
-			}
-
-			/*
-			 * Function has no such interface and
-			 * default handler is not provided.
-			 */
-			printf("%s: driver_connection_gen error - "
-			    "invalid interface id %d.",
-			    driver->name, iface_idx);
-			async_answer_0(&call, ENOTSUP);
-			continue;
-		}
-
-		/* Calling one of the function's interfaces */
-
-		/* Get the interface ops structure. */
-		void *ops = function_get_ops(fun, iface_idx);
-		if (ops == NULL) {
-			printf("%s: driver_connection_gen error - ", driver->name);
-			printf("Function with handle %" PRIun " has no interface "
-			    "with id %d.\n", handle, iface_idx);
-			async_answer_0(&call, ENOTSUP);
-			continue;
-		}
-
-		/*
-		 * Get the corresponding interface for remote request
-		 * handling ("remote interface").
-		 */
-		const remote_iface_t *rem_iface = get_remote_iface(iface_idx);
-		assert(rem_iface != NULL);
-
-		/* get the method of the remote interface */
-		sysarg_t iface_method_idx = ipc_get_arg1(&call);
-		remote_iface_func_ptr_t iface_method_ptr =
-		    get_remote_method(rem_iface, iface_method_idx);
-		if (iface_method_ptr == NULL) {
-			/* The interface has not such method */
-			printf("%s: driver_connection_gen error - "
-			    "invalid interface method.", driver->name);
-			async_answer_0(&call, ENOTSUP);
-			continue;
-		}
-
-		/*
-		 * Call the remote interface's method, which will
-		 * receive parameters from the remote client and it will
-		 * pass it to the corresponding local interface method
-		 * associated with the function by its driver.
-		 */
-		(*iface_method_ptr)(fun, ops, &call);
-	}
-}
-
-static void driver_connection_driver(ipc_call_t *icall, void *arg)
-{
-	driver_connection_gen(icall, true);
-}
-
-static void driver_connection_client(ipc_call_t *icall, void *arg)
-{
-	driver_connection_gen(icall, false);
-}
-
-/** Create new device structure.
- *
- * @return		The device structure.
- */
-static ddf_dev_t *create_device(void)
-{
-	ddf_dev_t *dev;
-
-	dev = calloc(1, sizeof(ddf_dev_t));
-	if (dev == NULL)
-		return NULL;
-
-	refcount_init(&dev->refcnt);
-
-	return dev;
-}
-
-/** Create new function structure.
- *
- * @return		The device structure.
- */
-static ddf_fun_t *create_function(void)
-{
-	ddf_fun_t *fun;
-
-	fun = calloc(1, sizeof(ddf_fun_t));
-	if (fun == NULL)
-		return NULL;
-
-	refcount_init(&fun->refcnt);
-	init_match_ids(&fun->match_ids);
-	link_initialize(&fun->link);
-
-	return fun;
-}
-
-/** Delete device structure.
- *
- * @param dev		The device structure.
- */
-static void delete_device(ddf_dev_t *dev)
-{
-	if (dev->parent_sess)
-		async_hangup(dev->parent_sess);
-	if (dev->driver_data != NULL)
-		free(dev->driver_data);
-	if (dev->name)
-		free(dev->name);
-	free(dev);
-}
-
-/** Delete function structure.
- *
- * @param dev		The device structure.
- */
-static void delete_function(ddf_fun_t *fun)
-{
-	clean_match_ids(&fun->match_ids);
-	if (fun->driver_data != NULL)
-		free(fun->driver_data);
-	if (fun->name != NULL)
-		free(fun->name);
-	free(fun);
-}
-
-/** Increase device reference count. */
-static void dev_add_ref(ddf_dev_t *dev)
-{
-	refcount_up(&dev->refcnt);
-}
-
-/** Decrease device reference count.
- *
- * Free the device structure if the reference count drops to zero.
- */
-static void dev_del_ref(ddf_dev_t *dev)
-{
-	if (refcount_down(&dev->refcnt))
-		delete_device(dev);
-}
-
-/** Increase function reference count.
- *
- * This also increases reference count on the device. The device structure
- * will thus not be deallocated while there are some associated function
- * structures.
- */
-static void fun_add_ref(ddf_fun_t *fun)
-{
-	dev_add_ref(fun->dev);
-	refcount_up(&fun->refcnt);
-}
-
-/** Decrease function reference count.
- *
- * Free the function structure if the reference count drops to zero.
- */
-static void fun_del_ref(ddf_fun_t *fun)
-{
-	ddf_dev_t *dev = fun->dev;
-
-	if (refcount_down(&fun->refcnt))
-		delete_function(fun);
-
-	dev_del_ref(dev);
-}
-
-/** Allocate driver-specific device data. */
-void *ddf_dev_data_alloc(ddf_dev_t *dev, size_t size)
-{
-	assert(dev->driver_data == NULL);
-
-	void *data = calloc(1, size);
-	if (data == NULL)
-		return NULL;
-
-	dev->driver_data = data;
-	return data;
-}
-
-/** Return driver-specific device data. */
-void *ddf_dev_data_get(ddf_dev_t *dev)
-{
-	return dev->driver_data;
-}
-
-/** Get device handle. */
-devman_handle_t ddf_dev_get_handle(ddf_dev_t *dev)
-{
-	return dev->handle;
-}
-
-/** Return device name.
- *
- * @param dev	Device
- * @return	Device name. Valid as long as @a dev is valid.
- */
-const char *ddf_dev_get_name(ddf_dev_t *dev)
-{
-	return dev->name;
-}
-
-/** Return existing session with the parent function.
- *
- * @param dev	Device
- * @return	Session with parent function or NULL upon failure
- */
-async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *dev)
-{
-	if (dev->parent_sess == NULL) {
-		dev->parent_sess = devman_parent_device_connect(dev->handle,
-		    IPC_FLAG_BLOCKING);
-	}
-
-	return dev->parent_sess;
-}
-
-/** Set function name (if it was not specified when node was created.)
- *
- * @param dev	Device whose name has not been set yet
- * @param name	Name, will be copied
- * @return	EOK on success, ENOMEM if out of memory
- */
-errno_t ddf_fun_set_name(ddf_fun_t *dev, const char *name)
-{
-	assert(dev->name == NULL);
-
-	dev->name = str_dup(name);
-	if (dev->name == NULL)
-		return ENOENT;
-
-	return EOK;
-}
-
-/** Get device to which function belongs. */
-ddf_dev_t *ddf_fun_get_dev(ddf_fun_t *fun)
-{
-	return fun->dev;
-}
-
-/** Get function handle.
- *
- * XXX USB uses this, but its use should be eliminated.
- */
-devman_handle_t ddf_fun_get_handle(ddf_fun_t *fun)
-{
-	return fun->handle;
-}
-
-/** Create a DDF function node.
- *
- * Create a DDF function (in memory). Both child devices and external clients
- * communicate with a device via its functions.
- *
- * The created function node is fully formed, but only exists in the memory
- * of the client task. In order to be visible to the system, the function
- * must be bound using ddf_fun_bind().
- *
- * This function should only fail if there is not enough free memory.
- * Specifically, this function succeeds even if @a dev already has
- * a (bound) function with the same name. @a name can be NULL in which
- * case the caller will set the name later using ddf_fun_set_name().
- * He must do this before binding the function.
- *
- * Type: A function of type fun_inner indicates that DDF should attempt
- * to attach child devices to the function. fun_exposed means that
- * the function should be exported to external clients (applications).
- *
- * @param dev		Device to which we are adding function
- * @param ftype		Type of function (fun_inner or fun_exposed)
- * @param name		Name of function or NULL
- *
- * @return		New function or @c NULL if memory is not available
- */
-ddf_fun_t *ddf_fun_create(ddf_dev_t *dev, fun_type_t ftype, const char *name)
-{
-	ddf_fun_t *fun = create_function();
-	if (fun == NULL)
-		return NULL;
-
-	fun->dev = dev;
-	dev_add_ref(fun->dev);
-
-	fun->bound = false;
-	fun->ftype = ftype;
-
-	if (name != NULL) {
-		fun->name = str_dup(name);
-		if (fun->name == NULL) {
-			fun_del_ref(fun);	/* fun is destroyed */
-			return NULL;
-		}
-	}
-
-	return fun;
-}
-
-/** Allocate driver-specific function data. */
-void *ddf_fun_data_alloc(ddf_fun_t *fun, size_t size)
-{
-	assert(fun->bound == false);
-	assert(fun->driver_data == NULL);
-
-	void *data = calloc(1, size);
-	if (data == NULL)
-		return NULL;
-
-	fun->driver_data = data;
-	return data;
-}
-
-/** Return driver-specific function data. */
-void *ddf_fun_data_get(ddf_fun_t *fun)
-{
-	return fun->driver_data;
-}
-
-/** Return function name.
- *
- * @param fun	Function
- * @return	Function name. Valid as long as @a fun is valid.
- */
-const char *ddf_fun_get_name(ddf_fun_t *fun)
-{
-	return fun->name;
-}
-
-/** Destroy DDF function node.
- *
- * Destroy a function previously created with ddf_fun_create(). The function
- * must not be bound.
- *
- * @param fun Function to destroy
- *
- */
-void ddf_fun_destroy(ddf_fun_t *fun)
-{
-	assert(fun->bound == false);
-
-	/*
-	 * Drop the reference added by ddf_fun_create(). This will deallocate
-	 * the function as soon as all other references are dropped (i.e.
-	 * as soon control leaves all driver entry points called in context
-	 * of this function.
-	 */
-	fun_del_ref(fun);
-}
-
-static void *function_get_ops(ddf_fun_t *fun, dev_inferface_idx_t idx)
-{
-	assert(is_valid_iface_idx(idx));
-	if (fun->ops == NULL)
-		return NULL;
-
-	return fun->ops->interfaces[idx];
-}
-
-/** Bind a function node.
- *
- * Bind the specified function to the system. This effectively makes
- * the function visible to the system (uploads it to the server).
- *
- * This function can fail for several reasons. Specifically,
- * it will fail if the device already has a bound function of
- * the same name.
- *
- * @param fun Function to bind
- *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_bind(ddf_fun_t *fun)
-{
-	assert(fun->bound == false);
-	assert(fun->name != NULL);
-	assert(fun->dev != NULL);
-
-	add_to_functions_list(fun);
-	errno_t res = devman_add_function(fun->name, fun->ftype, &fun->match_ids,
-	    fun->dev->handle, &fun->handle);
-	if (res != EOK) {
-		remove_from_functions_list(fun);
-		return res;
-	}
-
-	fun->bound = true;
-	return res;
-}
-
-/** Unbind a function node.
- *
- * Unbind the specified function from the system. This effectively makes
- * the function invisible to the system.
- *
- * @param fun Function to unbind
- *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_unbind(ddf_fun_t *fun)
-{
-	assert(fun->bound == true);
-
-	errno_t res = devman_remove_function(fun->handle);
-	if (res != EOK)
-		return res;
-
-	remove_from_functions_list(fun);
-
-	fun->bound = false;
-	return EOK;
-}
-
-/** Online function.
- *
- * @param fun Function to online
- *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_online(ddf_fun_t *fun)
-{
-	assert(fun->bound == true);
-
-	errno_t res = devman_drv_fun_online(fun->handle);
-	if (res != EOK)
-		return res;
-
-	return EOK;
-}
-
-/** Offline function.
- *
- * @param fun Function to offline
- *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_offline(ddf_fun_t *fun)
-{
-	assert(fun->bound == true);
-
-	errno_t res = devman_drv_fun_offline(fun->handle);
-	if (res != EOK)
-		return res;
-
-	return EOK;
-}
-
-/** Quiesce function.
- *
- * @param fun Function to quiesce
- *
- * @return EOK on success or an error code
- *
- */
-errno_t ddf_fun_quiesce(ddf_fun_t *fun)
-{
-	assert(fun->bound == true);
-
-	errno_t res = devman_drv_fun_quiesce(fun->handle);
-	if (res != EOK)
-		return res;
-
-	return EOK;
-}
-
-/** Add single match ID to inner function.
- *
- * Construct and add a single match ID to the specified function.
- * Cannot be called when the function node is bound.
- *
- * @param fun          Function
- * @param match_id_str Match string
- * @param match_score  Match score
- *
- * @return EOK on success.
- * @return ENOMEM if out of memory.
- *
- */
-errno_t ddf_fun_add_match_id(ddf_fun_t *fun, const char *match_id_str,
-    int match_score)
-{
-	assert(fun->bound == false);
-	assert(fun->ftype == fun_inner);
-
-	match_id_t *match_id = create_match_id();
-	if (match_id == NULL)
-		return ENOMEM;
-
-	match_id->id = str_dup(match_id_str);
-	match_id->score = match_score;
-
-	add_match_id(&fun->match_ids, match_id);
-	return EOK;
-}
-
-/** Set function ops. */
-void ddf_fun_set_ops(ddf_fun_t *fun, const ddf_dev_ops_t *dev_ops)
-{
-	assert(fun->conn_handler == NULL);
-	fun->ops = dev_ops;
-}
-
-/** Set user-defined connection handler.
- *
- * This allows handling connections the non-devman way.
- */
-void ddf_fun_set_conn_handler(ddf_fun_t *fun, async_port_handler_t conn)
-{
-	assert(fun->ops == NULL);
-	fun->conn_handler = conn;
-}
-
-/** Get default handler for client requests */
-static remote_handler_t *function_get_default_handler(ddf_fun_t *fun)
-{
-	if (fun->ops == NULL)
-		return NULL;
-	return fun->ops->default_handler;
-}
-
-/** Add exposed function to category.
- *
- * Must only be called when the function is bound.
- *
- */
-errno_t ddf_fun_add_to_category(ddf_fun_t *fun, const char *cat_name)
-{
-	assert(fun->bound == true);
-	assert(fun->ftype == fun_exposed);
-
-	return devman_add_device_to_category(fun->handle, cat_name);
-}
-
-/** Wait for function to enter stable state.
- *
- * @param fun Function
- * @return EOK on success or an error code
- */
-errno_t ddf_fun_wait_stable(ddf_fun_t *fun)
-{
-	return devman_drv_fun_wait_stable(fun->handle);
-}
-
-errno_t ddf_driver_main(const driver_t *drv)
-{
-	/*
-	 * Remember the driver structure - driver_ops will be called by generic
-	 * handler for incoming connections.
-	 */
-	driver = drv;
-
-	/*
-	 * Register driver with device manager using generic handler for
-	 * incoming connections.
-	 */
-	port_id_t port;
-	errno_t rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver,
-	    NULL, &port);
-	if (rc != EOK) {
-		printf("Error: Failed to create driver port.\n");
-		return rc;
-	}
-
-	rc = async_create_port(INTERFACE_DDF_DEVMAN, driver_connection_devman,
-	    NULL, &port);
-	if (rc != EOK) {
-		printf("Error: Failed to create devman port.\n");
-		return rc;
-	}
-
-	async_set_fallback_port_handler(driver_connection_client, NULL);
-
-	rc = devman_driver_register(driver->name);
-	if (rc != EOK) {
-		printf("Error: Failed to register driver with device manager "
-		    "(%s).\n", (rc == EEXIST) ? "driver already started" :
-		    str_error(rc));
-
-		return rc;
-	}
-
-	/* Return success from the task since server has started. */
-	rc = task_retval(0);
-	if (rc != EOK) {
-		printf("Error: Failed returning task value.\n");
-		return rc;
-	}
-
-	async_manager();
-
-	/* Never reached. */
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/interrupt.c
===================================================================
--- uspace/lib/drv/generic/interrupt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libdrv
- * @{
- */
-
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-
-#include "ddf/interrupt.h"
-#include "private/driver.h"
-
-errno_t register_interrupt_handler(ddf_dev_t *dev, int irq,
-    interrupt_handler_t *handler, void *arg, const irq_code_t *irq_code,
-    cap_irq_handle_t *handle)
-{
-	(void)dev;
-	return async_irq_subscribe(irq, (async_notification_handler_t) handler,
-	    arg, irq_code, handle);
-}
-
-errno_t unregister_interrupt_handler(ddf_dev_t *dev, cap_irq_handle_t handle)
-{
-	return async_irq_unsubscribe(handle);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/log.c
===================================================================
--- uspace/lib/drv/generic/log.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-
-#include <io/log.h>
-#include <stdarg.h>
-#include <ddf/log.h>
-
-/** Initialize the logging system.
- *
- * @param drv_name Driver name, will be printed as part of message
- *
- */
-errno_t ddf_log_init(const char *drv_name)
-{
-	return log_init(drv_name);
-}
-
-/** Log a driver message.
- *
- * @param level Message verbosity level. Message is only printed
- *              if verbosity is less than or equal to current
- *              reporting level.
- * @param fmt   Format string (no trailing newline)
- *
- */
-void ddf_msg(log_level_t level, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	log_msgv(LOG_DEFAULT, level, fmt, args);
-	va_end(args);
-}
-
-/** @}
- */
Index: pace/lib/drv/generic/logbuf.c
===================================================================
--- uspace/lib/drv/generic/logbuf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <ddf/log.h>
-#include <assert.h>
-#include <str.h>
-
-/** Formatting string for printing number of not-printed items. */
-#define REMAINDER_STR_FMT " (%zu)..."
-/** Expected max size of the remainder string.
- * String + terminator + number width (enough for 4GB).
- */
-#define REMAINDER_STR_LEN (5 + 1 + 10)
-
-/** Groups size. */
-#define BUFFER_DUMP_GROUP_SIZE 4
-
-/** Space between two items. */
-#define SPACE_NORMAL " "
-/** Space between two groups. */
-#define SPACE_GROUP "  "
-
-/** Formats the dump with space before, takes care of type casting (ugly). */
-#define _FORMAT(digits, bits) \
-	snprintf(dump, dump_size, "%s%0" #digits PRIx##bits, \
-	    space_before, ((uint##bits##_t *)buf)[0]);
-
-/** Dump one item into given buffer.
- *
- * @param buffer Data buffer.
- * @param item_size Size of the item (1, 2, 4).
- * @param index Index into the @p buffer (respecting @p item_size).
- * @param dump Where to store the dump.
- * @param dump_size Size of @p dump size.
- * @return Number of characters printed (see snprintf).
- */
-static int dump_one_item(const void *buffer, size_t item_size, size_t index,
-    char *dump, size_t dump_size)
-{
-	/* Determine space before the number. */
-	const char *space_before;
-	if (index == 0) {
-		space_before = "";
-	} else if ((index % BUFFER_DUMP_GROUP_SIZE) == 0) {
-		space_before = SPACE_GROUP;
-	} else {
-		space_before = SPACE_NORMAL;
-	}
-
-	/* Let buf point to the item to be printed. */
-	const uint8_t *buf = (const uint8_t *) buffer;
-	buf += index * item_size;
-
-	switch (item_size) {
-	case 4:
-		return _FORMAT(8, 32);
-	case 2:
-		return _FORMAT(4, 16);
-	default:
-		return _FORMAT(2, 8);
-	}
-}
-
-/** Count number of characters needed for dumping buffer of given size.
- *
- * @param item_size Item size in bytes.
- * @param items Number of items to print.
- * @return Number of characters the full dump would occupy.
- */
-static size_t count_dump_length(size_t item_size, size_t items)
-{
-	size_t group_space_count = items / BUFFER_DUMP_GROUP_SIZE - 1;
-	size_t normal_space_count = items - 1 - group_space_count;
-
-	size_t dump_itself = item_size * 2 * items;
-	size_t group_spaces = str_size(SPACE_GROUP) * group_space_count;
-	size_t normal_spaces = str_size(SPACE_NORMAL) * normal_space_count;
-
-	return dump_itself + group_spaces + normal_spaces;
-}
-
-/** Dumps data buffer to a string in hexadecimal format.
- *
- * Setting @p items_to_print to zero would dump the whole buffer together
- * with information how many items were omitted. Otherwise, no information
- * about omitted items is printed.
- *
- * @param dump Where to store the dumped buffer.
- * @param dump_size Size of @p dump in bytes.
- * @param buffer Data buffer to be dumped.
- * @param item_size Size of items in the @p buffer in bytes (1,2,4 allowed).
- * @param items Number of items in the @p buffer.
- * @param items_to_print How many items to actually print.
- */
-void ddf_dump_buffer(char *dump, size_t dump_size,
-    const void *buffer, size_t item_size, size_t items, size_t items_to_print)
-{
-	if ((dump_size == 0) || (dump == NULL)) {
-		return;
-	}
-	/* We need space for one byte at least. */
-	if (dump_size < 3) {
-		str_cpy(dump, dump_size, "...");
-		return;
-	}
-
-	/* Special cases first. */
-	if (buffer == NULL) {
-		str_cpy(dump, dump_size, "(null)");
-		return;
-	}
-	if (items == 0) {
-		str_cpy(dump, dump_size, "(empty)");
-	}
-
-	if (items_to_print > items) {
-		items_to_print = items;
-	}
-
-	bool print_remainder = items_to_print == 0;
-
-	/* How many available bytes we do have. */
-	size_t dump_size_remaining = dump_size - 1;
-
-	if (print_remainder) {
-		/* Can't do much when user supplied small buffer. */
-		if (dump_size_remaining < REMAINDER_STR_LEN) {
-			print_remainder = false;
-		} else {
-			size_t needed_size = count_dump_length(item_size, items);
-			if (needed_size > dump_size_remaining) {
-				dump_size_remaining -= REMAINDER_STR_LEN;
-			} else {
-				print_remainder = false;
-			}
-		}
-		items_to_print = items;
-	}
-
-	str_cpy(dump, dump_size, "");
-
-	size_t index = 0;
-	while (index < items) {
-		char current_item[32];
-		int printed = dump_one_item(buffer, item_size, index,
-		    current_item, 32);
-		assert(printed >= 0);
-
-		if ((size_t) printed > dump_size_remaining) {
-			break;
-		}
-
-		str_append(dump, dump_size, current_item);
-
-		dump_size_remaining -= printed;
-		index++;
-
-		if (index >= items_to_print) {
-			break;
-		}
-	}
-
-	if (print_remainder && (index < items)) {
-		size_t s = str_size(dump);
-		snprintf(dump + s, dump_size - s, REMAINDER_STR_FMT,
-		    items - index);
-	}
-}
-
-/** @}
- */
Index: pace/lib/drv/generic/private/driver.h
===================================================================
--- uspace/lib/drv/generic/private/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef DDF_PRIVATE_DRIVER_H_
-#define DDF_PRIVATE_DRIVER_H_
-
-#include <async.h>
-#include <refcount.h>
-#include <ipc/devman.h>
-#include <ipc/dev_iface.h>
-#include "dev_iface.h"
-
-/** Device structure */
-struct ddf_dev {
-	/**
-	 * Globally unique device identifier (assigned to the device by the
-	 * device manager).
-	 */
-	devman_handle_t handle;
-
-	/** Reference count */
-	atomic_refcount_t refcnt;
-
-	/** Session with the parent device driver */
-	async_sess_t *parent_sess;
-
-	/** Device name */
-	char *name;
-
-	/** Driver-specific data associated with this device */
-	void *driver_data;
-
-	/** Link in the list of devices handled by the driver */
-	link_t link;
-};
-
-/** Function structure */
-struct ddf_fun {
-	/** True if bound to the device manager */
-	bool bound;
-
-	/** Function indentifier (asigned by device manager) */
-	devman_handle_t handle;
-
-	/** Reference count */
-	atomic_refcount_t refcnt;
-
-	/** Device which this function belogs to */
-	struct ddf_dev *dev;
-
-	/** Function type */
-	fun_type_t ftype;
-
-	/** Function name */
-	char *name;
-
-	/** List of device ids for driver matching */
-	match_id_list_t match_ids;
-
-	/** Driver-specific data associated with this function */
-	void *driver_data;
-
-	/** Implementation of operations provided by this function */
-	const ddf_dev_ops_t *ops;
-
-	/** Connection handler or @c NULL to use the DDF default handler. */
-	async_port_handler_t conn_handler;
-
-	/** Link in the list of functions handled by the driver */
-	link_t link;
-};
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_ahci.h
===================================================================
--- uspace/lib/drv/generic/private/remote_ahci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_AHCI_H_
-#define LIBDRV_REMOTE_AHCI_H_
-
-extern remote_iface_t remote_ahci_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_audio_mixer.h
===================================================================
--- uspace/lib/drv/generic/private/remote_audio_mixer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_AUDIO_MIXER_H_
-#define LIBDRV_REMOTE_AUDIO_MIXER_H_
-
-extern remote_iface_t remote_audio_mixer_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_audio_pcm.h
===================================================================
--- uspace/lib/drv/generic/private/remote_audio_pcm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_AUDIO_PCM_H_
-#define LIBDRV_REMOTE_AUDIO_PCM_H_
-
-extern remote_iface_t remote_audio_pcm_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_battery_dev.h
===================================================================
--- uspace/lib/drv/generic/private/remote_battery_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_BATTERY_DEV_H_
-#define LIBDRV_REMOTE_BATTERY_DEV_H_
-
-extern remote_iface_t remote_battery_dev_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_clock_dev.h
===================================================================
--- uspace/lib/drv/generic/private/remote_clock_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_CLOCK_DEV_H_
-#define LIBDRV_REMOTE_CLOCK_DEV_H_
-
-extern remote_iface_t remote_clock_dev_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_hw_res.h
===================================================================
--- uspace/lib/drv/generic/private/remote_hw_res.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_HW_RES_H_
-#define LIBDRV_REMOTE_HW_RES_H_
-
-extern remote_iface_t remote_hw_res_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_ieee80211.h
===================================================================
--- uspace/lib/drv/generic/private/remote_ieee80211.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_IEEE80211_H_
-#define LIBDRV_REMOTE_IEEE80211_H_
-
-extern remote_iface_t remote_ieee80211_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_led_dev.h
===================================================================
--- uspace/lib/drv/generic/private/remote_led_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_LED_DEV_H_
-#define LIBDRV_REMOTE_LED_DEV_H_
-
-extern remote_iface_t remote_led_dev_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_nic.h
===================================================================
--- uspace/lib/drv/generic/private/remote_nic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_NIC_H_
-#define LIBDRV_REMOTE_NIC_H_
-
-extern remote_iface_t remote_nic_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_pci.h
===================================================================
--- uspace/lib/drv/generic/private/remote_pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_PCI_H_
-#define LIBDRV_REMOTE_PCI_H_
-
-extern remote_iface_t remote_pci_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_pio_window.h
===================================================================
--- uspace/lib/drv/generic/private/remote_pio_window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_PIO_WINDOW_H_
-#define LIBDRV_REMOTE_PIO_WINDOW_H_
-
-extern remote_iface_t remote_pio_window_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_usb.h
===================================================================
--- uspace/lib/drv/generic/private/remote_usb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_USB_H_
-#define LIBDRV_REMOTE_USB_H_
-
-extern remote_iface_t remote_usb_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_usbdiag.h
===================================================================
--- uspace/lib/drv/generic/private/remote_usbdiag.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_USBDIAG_H_
-#define LIBDRV_REMOTE_USBDIAG_H_
-
-extern remote_iface_t remote_usbdiag_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_usbhc.h
===================================================================
--- uspace/lib/drv/generic/private/remote_usbhc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2017 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_USBHC_H_
-#define LIBDRV_REMOTE_USBHC_H_
-
-extern remote_iface_t remote_usbhc_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/private/remote_usbhid.h
===================================================================
--- uspace/lib/drv/generic/private/remote_usbhid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_REMOTE_USBHID_H_
-#define LIBDRV_REMOTE_USBHID_H_
-
-extern remote_iface_t remote_usbhid_iface;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_ahci.c
===================================================================
--- uspace/lib/drv/generic/remote_ahci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,333 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <as.h>
-#include <async.h>
-#include <devman.h>
-#include <errno.h>
-#include <stdio.h>
-#include <macros.h>
-#include <str.h>
-#include "ahci_iface.h"
-#include "ddf/driver.h"
-
-typedef enum {
-	IPC_M_AHCI_GET_SATA_DEVICE_NAME,
-	IPC_M_AHCI_GET_NUM_BLOCKS,
-	IPC_M_AHCI_GET_BLOCK_SIZE,
-	IPC_M_AHCI_READ_BLOCKS,
-	IPC_M_AHCI_WRITE_BLOCKS
-} ahci_iface_funcs_t;
-
-#define MAX_NAME_LENGTH  1024
-
-#define LO(ptr) \
-	((uint32_t) (((uint64_t) ((uintptr_t) (ptr))) & 0xffffffff))
-
-#define HI(ptr) \
-	((uint32_t) (((uint64_t) ((uintptr_t) (ptr))) >> 32))
-
-async_sess_t *ahci_get_sess(devman_handle_t funh, char **name)
-{
-	// FIXME: Use a better way than substring match
-
-	*name = NULL;
-
-	char devn[MAX_NAME_LENGTH];
-	errno_t rc = devman_fun_get_name(funh, devn, MAX_NAME_LENGTH);
-	if (rc != EOK)
-		return NULL;
-
-	size_t devn_size = str_size(devn);
-
-	if ((devn_size > 5) && (str_lcmp(devn, "ahci_", 5) == 0)) {
-		async_sess_t *sess = devman_device_connect(funh, IPC_FLAG_BLOCKING);
-
-		if (sess) {
-			*name = str_dup(devn);
-			return sess;
-		}
-	}
-
-	return NULL;
-}
-
-errno_t ahci_get_sata_device_name(async_sess_t *sess, size_t sata_dev_name_length,
-    char *sata_dev_name)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EINVAL;
-
-	aid_t req = async_send_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
-	    IPC_M_AHCI_GET_SATA_DEVICE_NAME, sata_dev_name_length, NULL);
-
-	async_data_read_start(exch, sata_dev_name, sata_dev_name_length);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-errno_t ahci_get_num_blocks(async_sess_t *sess, uint64_t *blocks)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EINVAL;
-
-	sysarg_t blocks_hi;
-	sysarg_t blocks_lo;
-	errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
-	    IPC_M_AHCI_GET_NUM_BLOCKS, &blocks_hi, &blocks_lo);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK) {
-		*blocks = (((uint64_t) blocks_hi) << 32) |
-		    (((uint64_t) blocks_lo) & 0xffffffff);
-	}
-
-	return rc;
-}
-
-errno_t ahci_get_block_size(async_sess_t *sess, size_t *blocks_size)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EINVAL;
-
-	sysarg_t bs;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
-	    IPC_M_AHCI_GET_BLOCK_SIZE, &bs);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK)
-		*blocks_size = (size_t) bs;
-
-	return rc;
-}
-
-errno_t ahci_read_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
-    void *buf)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EINVAL;
-
-	aid_t req;
-	req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
-	    IPC_M_AHCI_READ_BLOCKS, HI(blocknum),  LO(blocknum), count, NULL);
-
-	async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
-
-	async_exchange_end(exch);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-errno_t ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
-    void *buf)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EINVAL;
-
-	aid_t req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
-	    IPC_M_AHCI_WRITE_BLOCKS, HI(blocknum),  LO(blocknum), count, NULL);
-
-	async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
-
-	async_exchange_end(exch);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-static void remote_ahci_get_sata_device_name(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_ahci_get_num_blocks(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_ahci_get_block_size(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_ahci_read_blocks(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_ahci_write_blocks(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote AHCI interface operations. */
-static const remote_iface_func_ptr_t remote_ahci_iface_ops [] = {
-	[IPC_M_AHCI_GET_SATA_DEVICE_NAME] = remote_ahci_get_sata_device_name,
-	[IPC_M_AHCI_GET_NUM_BLOCKS] = remote_ahci_get_num_blocks,
-	[IPC_M_AHCI_GET_BLOCK_SIZE] = remote_ahci_get_block_size,
-	[IPC_M_AHCI_READ_BLOCKS] = remote_ahci_read_blocks,
-	[IPC_M_AHCI_WRITE_BLOCKS] = remote_ahci_write_blocks
-};
-
-/** Remote AHCI interface structure.
- */
-const remote_iface_t remote_ahci_iface = {
-	.method_count = ARRAY_SIZE(remote_ahci_iface_ops),
-	.methods = remote_ahci_iface_ops
-};
-
-void remote_ahci_get_sata_device_name(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
-
-	if (ahci_iface->get_sata_device_name == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const size_t sata_dev_name_length =
-	    (size_t) DEV_IPC_GET_ARG1(*call);
-
-	char *sata_dev_name = malloc(sata_dev_name_length);
-	if (sata_dev_name == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	const errno_t ret = ahci_iface->get_sata_device_name(fun,
-	    sata_dev_name_length, sata_dev_name);
-
-	ipc_call_t data;
-	size_t real_size;
-	if ((async_data_read_receive(&data, &real_size)) &&
-	    (real_size == sata_dev_name_length))
-		async_data_read_finalize(&data, sata_dev_name,
-		    sata_dev_name_length);
-
-	free(sata_dev_name);
-	async_answer_0(call, ret);
-}
-
-static void remote_ahci_get_num_blocks(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
-
-	if (ahci_iface->get_num_blocks == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint64_t blocks;
-	const errno_t ret = ahci_iface->get_num_blocks(fun, &blocks);
-
-	if (ret != EOK)
-		async_answer_0(call, ret);
-	else
-		async_answer_2(call, EOK, HI(blocks), LO(blocks));
-}
-
-static void remote_ahci_get_block_size(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
-
-	if (ahci_iface->get_block_size == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t blocks;
-	const errno_t ret = ahci_iface->get_block_size(fun, &blocks);
-
-	if (ret != EOK)
-		async_answer_0(call, ret);
-	else
-		async_answer_1(call, EOK, blocks);
-}
-
-void remote_ahci_read_blocks(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
-
-	if (ahci_iface->read_blocks == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t maxblock_size;
-	unsigned int flags;
-	async_share_out_receive(&data, &maxblock_size, &flags);
-
-	void *buf;
-	async_share_out_finalize(&data, &buf);
-
-	const uint64_t blocknum =
-	    (((uint64_t) (DEV_IPC_GET_ARG1(*call))) << 32) |
-	    (((uint64_t) (DEV_IPC_GET_ARG2(*call))) & 0xffffffff);
-	const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
-
-	const errno_t ret = ahci_iface->read_blocks(fun, blocknum, cnt, buf);
-
-	async_answer_0(call, ret);
-}
-
-void remote_ahci_write_blocks(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
-
-	if (ahci_iface->read_blocks == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t maxblock_size;
-	unsigned int flags;
-	async_share_out_receive(&data, &maxblock_size, &flags);
-
-	void *buf;
-	async_share_out_finalize(&data, &buf);
-
-	const uint64_t blocknum =
-	    (((uint64_t)(DEV_IPC_GET_ARG1(*call))) << 32) |
-	    (((uint64_t)(DEV_IPC_GET_ARG2(*call))) & 0xffffffff);
-	const size_t cnt = (size_t) DEV_IPC_GET_ARG3(*call);
-
-	const errno_t ret = ahci_iface->write_blocks(fun, blocknum, cnt, buf);
-
-	async_answer_0(call, ret);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_audio_mixer.c
===================================================================
--- uspace/lib/drv/generic/remote_audio_mixer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,327 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <assert.h>
-#include <str.h>
-#include <macros.h>
-
-#include "audio_mixer_iface.h"
-#include "ddf/driver.h"
-
-typedef enum {
-	/** Asks for basic mixer info: Mixer name and number of controllable
-	 * items.
-	 * Answer:
-	 * - ENOTSUP - call not supported
-	 * - EOK - call successful, info is valid
-	 * Answer arguments:
-	 * - Mixer name
-	 * - Number of controllable items
-	 */
-	IPC_M_AUDIO_MIXER_GET_INFO,
-
-	/** Asks for item mixer info: Item name and number of controllable
-	 * channels.
-	 * Answer:
-	 * - ENOTSUP - call not supported
-	 * - ENOENT - no such item
-	 * - EOK - call successful, info is valid
-	 * Answer arguments:
-	 * - Item name
-	 * - Number of controllable channels
-	 */
-	IPC_M_AUDIO_MIXER_GET_ITEM_INFO,
-
-	/** Set new control item setting
-	 * Answer:
-	 * - ENOTSUP - call not supported
-	 * - ENOENT - no such control item
-	 * - EOK - call successful, info is valid
-	 */
-	IPC_M_AUDIO_MIXER_SET_ITEM_LEVEL,
-
-	/** Get control item setting
-	 * Answer:
-	 * - ENOTSUP - call not supported
-	 * - ENOENT - no such control item
-	 * - EOK - call successful, info is valid
-	 */
-	IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL,
-} audio_mixer_iface_funcs_t;
-
-/*
- * CLIENT SIDE
- */
-
-/**
- * Query audio mixer for basic info (name and items count).
- * @param[in] exch IPC exchange connected to the device
- * @param[out] name Audio mixer string identifier
- * @param[out] items Number of items controlled by the mixer.
- * @return Error code.
- */
-errno_t audio_mixer_get_info(async_exch_t *exch, char **name, unsigned *items)
-{
-	if (!exch)
-		return EINVAL;
-	sysarg_t name_size, itemc;
-	const errno_t ret = async_req_1_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
-	    IPC_M_AUDIO_MIXER_GET_INFO, &name_size, &itemc);
-	if (ret == EOK && name) {
-		char *name_place = calloc(1, name_size);
-		if (!name_place) {
-			/*
-			 * Make the other side fail
-			 * as it waits for read request
-			 */
-			async_data_read_start(exch, (void *)-1, 0);
-			return ENOMEM;
-		}
-		const errno_t ret =
-		    async_data_read_start(exch, name_place, name_size);
-		if (ret != EOK) {
-			free(name_place);
-			return ret;
-		}
-		*name = name_place;
-	}
-	if (ret == EOK && items)
-		*items = itemc;
-	return ret;
-}
-
-/**
- * Query audio mixer for item specific info (name and channels count).
- * @param[in] exch IPC exchange connected to the device
- * @param[in] item The control item
- * @param[out] name Control item string identifier.
- * @param[out] channles Number of channels associated with this control item.
- * @return Error code.
- */
-errno_t audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
-    char **name, unsigned *levels)
-{
-	if (!exch)
-		return EINVAL;
-	sysarg_t name_size, lvls;
-	const errno_t ret = async_req_2_2(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
-	    IPC_M_AUDIO_MIXER_GET_ITEM_INFO, item, &name_size, &lvls);
-	if (ret == EOK && name) {
-		char *name_place = calloc(1, name_size);
-		if (!name_place) {
-			/*
-			 * Make the other side fail
-			 * as it waits for read request
-			 */
-			async_data_read_start(exch, (void *)-1, 0);
-			return ENOMEM;
-		}
-		const errno_t ret =
-		    async_data_read_start(exch, name_place, name_size);
-		if (ret != EOK) {
-			free(name_place);
-			return ret;
-		}
-		*name = name_place;
-	}
-	if (ret == EOK && levels)
-		*levels = lvls;
-	return ret;
-}
-
-/**
- * Set control item to a new level.
- * @param[in] exch IPC exchange connected to the device.
- * @param[in] item The control item controlling the channel.
- * @param[in] level The new value.
- * @return Error code.
- */
-errno_t audio_mixer_set_item_level(async_exch_t *exch, unsigned item,
-    unsigned level)
-{
-	if (!exch)
-		return EINVAL;
-	return async_req_3_0(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
-	    IPC_M_AUDIO_MIXER_SET_ITEM_LEVEL, item, level);
-}
-
-/**
- * Get current level of a control item.
- * @param[in] exch IPC exchange connected to the device.
- * @param[in] item The control item controlling the channel.
- * @param[in] channel The channel index.
- * @param[out] level Currently set value.
- * @return Error code.
- */
-errno_t audio_mixer_get_item_level(async_exch_t *exch, unsigned item,
-    unsigned *level)
-{
-	if (!exch)
-		return EINVAL;
-	sysarg_t current;
-	const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_MIXER_IFACE),
-	    IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL, item, &current);
-	if (ret == EOK && level)
-		*level = current;
-	return ret;
-}
-
-/*
- * SERVER SIDE
- */
-static void remote_audio_mixer_get_info(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_mixer_get_item_info(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_mixer_get_item_level(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_mixer_set_item_level(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote audio mixer interface operations. */
-static const remote_iface_func_ptr_t remote_audio_mixer_iface_ops[] = {
-	[IPC_M_AUDIO_MIXER_GET_INFO] = remote_audio_mixer_get_info,
-	[IPC_M_AUDIO_MIXER_GET_ITEM_INFO] = remote_audio_mixer_get_item_info,
-	[IPC_M_AUDIO_MIXER_GET_ITEM_LEVEL] = remote_audio_mixer_get_item_level,
-	[IPC_M_AUDIO_MIXER_SET_ITEM_LEVEL] = remote_audio_mixer_set_item_level,
-};
-
-/** Remote audio mixer interface structure. */
-const remote_iface_t remote_audio_mixer_iface = {
-	.method_count = ARRAY_SIZE(remote_audio_mixer_iface_ops),
-	.methods = remote_audio_mixer_iface_ops
-};
-
-void remote_audio_mixer_get_info(ddf_fun_t *fun, void *iface, ipc_call_t *icall)
-{
-	audio_mixer_iface_t *mixer_iface = iface;
-
-	if (!mixer_iface->get_info) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	const char *name = NULL;
-	unsigned items = 0;
-	const errno_t ret = mixer_iface->get_info(fun, &name, &items);
-	const size_t name_size = name ? str_size(name) + 1 : 0;
-	async_answer_2(icall, ret, name_size, items);
-
-	/* Send the name. */
-	if (ret == EOK && name_size > 0) {
-		ipc_call_t call;
-		size_t size;
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EPARTY);
-			return;
-		}
-
-		if (size != name_size) {
-			async_answer_0(&call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&call, name, name_size);
-	}
-}
-
-void remote_audio_mixer_get_item_info(ddf_fun_t *fun, void *iface,
-    ipc_call_t *icall)
-{
-	audio_mixer_iface_t *mixer_iface = iface;
-
-	if (!mixer_iface->get_item_info) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	const unsigned item = DEV_IPC_GET_ARG1(*icall);
-	const char *name = NULL;
-	unsigned values = 0;
-	const errno_t ret = mixer_iface->get_item_info(fun, item, &name, &values);
-	const size_t name_size = name ? str_size(name) + 1 : 0;
-	async_answer_2(icall, ret, name_size, values);
-
-	/* Send the name. */
-	if (ret == EOK && name_size > 0) {
-		ipc_call_t call;
-		size_t size;
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EPARTY);
-			return;
-		}
-
-		if (size != name_size) {
-			async_answer_0(&call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&call, name, name_size);
-	}
-}
-
-void remote_audio_mixer_set_item_level(ddf_fun_t *fun, void *iface,
-    ipc_call_t *icall)
-{
-	audio_mixer_iface_t *mixer_iface = iface;
-
-	if (!mixer_iface->set_item_level) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	const unsigned item = DEV_IPC_GET_ARG1(*icall);
-	const unsigned value = DEV_IPC_GET_ARG2(*icall);
-	const errno_t ret = mixer_iface->set_item_level(fun, item, value);
-	async_answer_0(icall, ret);
-}
-
-void remote_audio_mixer_get_item_level(ddf_fun_t *fun, void *iface,
-    ipc_call_t *icall)
-{
-	audio_mixer_iface_t *mixer_iface = iface;
-
-	if (!mixer_iface->get_item_level) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	const unsigned item = DEV_IPC_GET_ARG1(*icall);
-	unsigned current = 0;
-	const errno_t ret =
-	    mixer_iface->get_item_level(fun, item, &current);
-	async_answer_1(icall, ret, current);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_audio_pcm.c
===================================================================
--- uspace/lib/drv/generic/remote_audio_pcm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,871 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <devman.h>
-#include <ddf/log.h>
-#include <errno.h>
-#include <macros.h>
-#include <str.h>
-#include <as.h>
-
-#include "audio_pcm_iface.h"
-#include "ddf/driver.h"
-
-typedef enum {
-	IPC_M_AUDIO_PCM_GET_INFO_STR,
-	IPC_M_AUDIO_PCM_QUERY_CAPS,
-	IPC_M_AUDIO_PCM_REGISTER_EVENTS,
-	IPC_M_AUDIO_PCM_UNREGISTER_EVENTS,
-	IPC_M_AUDIO_PCM_TEST_FORMAT,
-	IPC_M_AUDIO_PCM_GET_BUFFER,
-	IPC_M_AUDIO_PCM_RELEASE_BUFFER,
-	IPC_M_AUDIO_PCM_GET_BUFFER_POS,
-	IPC_M_AUDIO_PCM_START_PLAYBACK,
-	IPC_M_AUDIO_PCM_STOP_PLAYBACK,
-	IPC_M_AUDIO_PCM_START_CAPTURE,
-	IPC_M_AUDIO_PCM_STOP_CAPTURE,
-} audio_pcm_iface_funcs_t;
-
-/**
- * Get human readable capability name.
- * @param cap audio capability.
- * @return Valid string
- */
-const char *audio_pcm_cap_str(audio_cap_t cap)
-{
-	static const char *caps[] = {
-		[AUDIO_CAP_CAPTURE] = "CAPTURE",
-		[AUDIO_CAP_PLAYBACK] = "PLAYBACK",
-		[AUDIO_CAP_MAX_BUFFER] = "MAXIMUM BUFFER SIZE",
-		[AUDIO_CAP_BUFFER_POS] = "KNOWS BUFFER POSITION",
-		[AUDIO_CAP_INTERRUPT] = "FRAGMENT INTERRUPTS",
-		[AUDIO_CAP_INTERRUPT_MIN_FRAMES] = "MINIMUM FRAGMENT SIZE",
-		[AUDIO_CAP_INTERRUPT_MAX_FRAMES] = "MAXIMUM FRAGMENT SIZE",
-	};
-	if (cap >= ARRAY_SIZE(caps))
-		return "UNKNOWN CAP";
-	return caps[cap];
-
-}
-
-/**
- * Get human readable event name.
- * @param event Audio device event
- * @return Valid string
- */
-const char *audio_pcm_event_str(pcm_event_t event)
-{
-	static const char *events[] = {
-		[PCM_EVENT_PLAYBACK_STARTED] = "PLAYBACK STARTED",
-		[PCM_EVENT_CAPTURE_STARTED] = "CAPTURE STARTED",
-		[PCM_EVENT_FRAMES_PLAYED] = "FRAGMENT PLAYED",
-		[PCM_EVENT_FRAMES_CAPTURED] = "FRAGMENT CAPTURED",
-		[PCM_EVENT_PLAYBACK_TERMINATED] = "PLAYBACK TERMINATED",
-		[PCM_EVENT_CAPTURE_TERMINATED] = "CAPTURE TERMINATED",
-	};
-	if (event >= ARRAY_SIZE(events))
-		return "UNKNOWN EVENT";
-	return events[event];
-}
-
-/*
- * CLIENT SIDE
- */
-
-/**
- * Open audio session with the first registered device.
- *
- * @return Pointer to a new audio device session, NULL on failure.
- */
-audio_pcm_sess_t *audio_pcm_open_default(void)
-{
-	static bool resolved = false;
-	static category_id_t pcm_id = 0;
-	if (!resolved) {
-		const errno_t ret = loc_category_get_id("audio-pcm", &pcm_id,
-		    IPC_FLAG_BLOCKING);
-		if (ret != EOK)
-			return NULL;
-		resolved = true;
-	}
-
-	service_id_t *svcs = NULL;
-	size_t count = 0;
-	const errno_t ret = loc_category_get_svcs(pcm_id, &svcs, &count);
-	if (ret != EOK)
-		return NULL;
-
-	audio_pcm_sess_t *session = NULL;
-	if (count)
-		session = audio_pcm_open_service(svcs[0]);
-	free(svcs);
-	return session;
-}
-
-/**
- * Open audio session with device identified by location service string.
- *
- * @param name Location service string.
- * @return Pointer to a new audio device session, NULL on failure.
- */
-audio_pcm_sess_t *audio_pcm_open(const char *name)
-{
-	service_id_t sid;
-	const errno_t ret = loc_service_get_id(name, &sid, 0);
-	if (ret != EOK)
-		return NULL;
-	return loc_service_connect(sid, INTERFACE_DDF, 0);
-}
-
-/**
- * Open audio session with device identified by location service id
- *
- * @param name Location service id.
- * @return Pointer to a new audio device session, NULL on failure.
- */
-audio_pcm_sess_t *audio_pcm_open_service(service_id_t id)
-{
-	return loc_service_connect(id, INTERFACE_DDF, IPC_FLAG_BLOCKING);
-}
-
-/**
- * Close open audio device session.
- *
- * @param name Open audio device session.
- *
- * @note Calling this function on already closed or invalid session results
- * in undefined behavior.
- */
-void audio_pcm_close(audio_pcm_sess_t *sess)
-{
-	if (sess)
-		async_hangup(sess);
-}
-
-/**
- * Get a short description string.
- *
- * @param sess Audio device session.
- * @param name Place to store newly allocated string.
- *
- * @return Error code.
- *
- * @note Caller is responsible for freeing newly allocated memory.
- */
-errno_t audio_pcm_get_info_str(audio_pcm_sess_t *sess, char **name)
-{
-	if (!name)
-		return EINVAL;
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t name_size;
-	const errno_t ret = async_req_1_1(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_GET_INFO_STR, &name_size);
-	if (ret == EOK) {
-		char *name_place = calloc(1, name_size);
-		if (!name_place) {
-			/*
-			 * Make the other side fail
-			 * as it waits for read request
-			 */
-			async_data_read_start(exch, (void *)-1, 0);
-			async_exchange_end(exch);
-			return ENOMEM;
-		}
-		const errno_t ret =
-		    async_data_read_start(exch, name_place, name_size);
-		if (ret != EOK) {
-			free(name_place);
-			async_exchange_end(exch);
-			return ret;
-		}
-		*name = name_place;
-	}
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Query value of specified capability.
- *
- * @param sess Audio device session.
- * @param cap  Audio device capability.
- * @param[out] val  Place to store queried value.
- *
- * @return Error code.
- */
-errno_t audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_1(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS,
-	    cap, value);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Query current position in device buffer.
- *
- * @param sess Audio device session.
- * @param pos Place to store the result.
- *
- * @return Error code.
- *
- * Works for both playback and capture.
- */
-errno_t audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)
-{
-	if (!pos)
-		return EINVAL;
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t value = 0;
-	const errno_t ret = async_req_1_1(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_GET_BUFFER_POS, &value);
-	if (ret == EOK)
-		*pos = value;
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Test format parameters for device support.
- *
- * @param sess Audio device session.
- * @param channels Number of channels
- * @param rate Sampling rate.
- * @format Sample format.
- *
- * @return Error code.
- *
- * Works for both playback and capture. This function modifies provided
- * parameters to the nearest values supported by the device.
- */
-errno_t audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels,
-    unsigned *rate, pcm_sample_format_t *format)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	sysarg_t channels_arg = channels ? *channels : 0;
-	sysarg_t rate_arg = rate ? *rate : 0;
-	sysarg_t format_arg = format ? *format : 0;
-	const errno_t ret = async_req_4_3(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_TEST_FORMAT, channels_arg, rate_arg, format_arg,
-	    &channels_arg, &rate_arg, &format_arg);
-	async_exchange_end(exch);
-
-	/*
-	 * All OK or something has changed. Verify that it was not one of the
-	 * params we care about
-	 */
-	if ((ret == EOK || ret == ELIMIT) &&
-	    (!channels || *channels == channels_arg) &&
-	    (!rate || *rate == rate_arg) &&
-	    (!format || *format == format_arg))
-		return EOK;
-	if (channels)
-		*channels = channels_arg;
-	if (rate)
-		*rate = rate_arg;
-	if (format)
-		*format = format_arg;
-	return ret;
-}
-
-/**
- * Register callback for device generated events.
- *
- * @param sess Audio device session.
- * @param event_rec Event callback function.
- * @param arg Event callback custom parameter.
- *
- * @return Error code.
- */
-errno_t audio_pcm_register_event_callback(audio_pcm_sess_t *sess,
-    async_port_handler_t event_callback, void *arg)
-{
-	if (!event_callback)
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t ret = async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_REGISTER_EVENTS);
-	if (ret == EOK) {
-		port_id_t port;
-		ret = async_create_callback_port(exch, INTERFACE_AUDIO_PCM_CB, 0, 0,
-		    event_callback, arg, &port);
-	}
-
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Unregister callback for device generated events.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_unregister_event_callback(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_1_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_UNREGISTER_EVENTS);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Get device accessible playback/capture buffer.
- *
- * @param sess Audio device session.
- * @param buffer Place to store pointer to the buffer.
- * @param size Place to store buffer size (bytes).
- *
- * @return Error code.
- */
-errno_t audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size)
-{
-	if (!buffer || !size)
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	sysarg_t buffer_size = *size;
-	errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_GET_BUFFER, (sysarg_t)buffer_size, &buffer_size);
-	if (ret == EOK) {
-		void *dst = NULL;
-		ret = async_share_in_start_0_0(exch, buffer_size, &dst);
-		if (ret != EOK) {
-			async_exchange_end(exch);
-			return ret;
-		}
-		*buffer = dst;
-		*size = buffer_size;
-	}
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Release device accessible playback/capture buffer.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_release_buffer(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_1_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_RELEASE_BUFFER);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Start playback on buffer from position 0.
- *
- * @param sess Audio device session.
- * @param frames Size of fragment (in frames).
- * @param channels Number of channels.
- * @param sample_rate Sampling rate (for one channel).
- * @param format Sample format.
- *
- * @return Error code.
- *
- * Event will be generated after every fragment. Set fragment size to
- * 0 to turn off event generation.
- */
-errno_t audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	if (channels > UINT16_MAX)
-		return EINVAL;
-	assert((format & UINT16_MAX) == format);
-	const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_4_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_START_PLAYBACK,
-	    frames, sample_rate, packed);
-	async_exchange_end(exch);
-	return ret;
-}
-/**
- * Stops playback after current fragment.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, false);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Start playback on buffer from the current position.
- *
- * @param sess Audio device session.
- * @param channels Number of channels.
- * @param sample_rate Sampling rate (for one channel).
- * @param format Sample format.
- *
- * @return Error code.
- */
-errno_t audio_pcm_start_playback(audio_pcm_sess_t *sess,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	return audio_pcm_start_playback_fragment(
-	    sess, 0, channels, sample_rate, format);
-}
-
-/**
- * Immediately stops current playback.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_stop_playback_immediate(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, true);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Stops playback at the end of the current fragment.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_stop_playback(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_PLAYBACK, false);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Start capture on buffer from the current position.
- *
- * @param sess Audio device session.
- * @param frames Size of fragment (in frames).
- * @param channels Number of channels.
- * @param sample_rate Sampling rate (for one channel).
- * @param format Sample format.
- *
- * @return Error code.
- *
- * Event will be generated after every fragment. Set fragment size to
- * 0 to turn off event generation.
- */
-errno_t audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	if (channels > UINT16_MAX)
-		return EINVAL;
-	assert((format & UINT16_MAX) == format);
-	const sysarg_t packed = (channels << 16) | (format & UINT16_MAX);
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_4_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_CAPTURE,
-	    frames, sample_rate, packed);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Start capture on buffer from the current position.
- *
- * @param sess Audio device session.
- * @param channels Number of channels.
- * @param sample_rate Sampling rate (for one channel).
- * @param format Sample format.
- *
- * @return Error code.
- */
-errno_t audio_pcm_start_capture(audio_pcm_sess_t *sess,
-    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
-{
-	return audio_pcm_start_capture_fragment(
-	    sess, 0, channels, sample_rate, format);
-}
-
-/**
- * Stops capture at the end of current fragment.
- *
- * Won't work if capture was started with fragment size 0.
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_CAPTURE, false);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Immediately stops current capture.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_stop_capture_immediate(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_CAPTURE, true);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Stops capture at the end of the current fragment.
- *
- * @param sess Audio device session.
- *
- * @return Error code.
- */
-errno_t audio_pcm_stop_capture(audio_pcm_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_2_0(exch,
-	    DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),
-	    IPC_M_AUDIO_PCM_STOP_CAPTURE, false);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/*
- * SERVER SIDE
- */
-static void remote_audio_pcm_get_info_str(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_query_caps(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_events_register(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_events_unregister(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_get_buffer_pos(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_test_format(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_get_buffer(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_release_buffer(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_start_playback(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_stop_playback(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_start_capture(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_audio_pcm_stop_capture(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote audio pcm buffer interface operations. */
-static const remote_iface_func_ptr_t remote_audio_pcm_iface_ops[] = {
-	[IPC_M_AUDIO_PCM_GET_INFO_STR] = remote_audio_pcm_get_info_str,
-	[IPC_M_AUDIO_PCM_QUERY_CAPS] = remote_audio_pcm_query_caps,
-	[IPC_M_AUDIO_PCM_REGISTER_EVENTS] = remote_audio_pcm_events_register,
-	[IPC_M_AUDIO_PCM_UNREGISTER_EVENTS] = remote_audio_pcm_events_unregister,
-	[IPC_M_AUDIO_PCM_GET_BUFFER_POS] = remote_audio_pcm_get_buffer_pos,
-	[IPC_M_AUDIO_PCM_TEST_FORMAT] = remote_audio_pcm_test_format,
-	[IPC_M_AUDIO_PCM_GET_BUFFER] = remote_audio_pcm_get_buffer,
-	[IPC_M_AUDIO_PCM_RELEASE_BUFFER] = remote_audio_pcm_release_buffer,
-	[IPC_M_AUDIO_PCM_START_PLAYBACK] = remote_audio_pcm_start_playback,
-	[IPC_M_AUDIO_PCM_STOP_PLAYBACK] = remote_audio_pcm_stop_playback,
-	[IPC_M_AUDIO_PCM_START_CAPTURE] = remote_audio_pcm_start_capture,
-	[IPC_M_AUDIO_PCM_STOP_CAPTURE] = remote_audio_pcm_stop_capture,
-};
-
-/** Remote audio mixer interface structure. */
-const remote_iface_t remote_audio_pcm_iface = {
-	.method_count = ARRAY_SIZE(remote_audio_pcm_iface_ops),
-	.methods = remote_audio_pcm_iface_ops
-};
-
-void remote_audio_pcm_get_info_str(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-
-	if (!pcm_iface->get_info_str) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const char *name = NULL;
-	const errno_t ret = pcm_iface->get_info_str(fun, &name);
-	const size_t name_size = name ? str_size(name) + 1 : 0;
-	async_answer_1(call, ret, name_size);
-
-	/* Send the string. */
-	if (ret == EOK && name_size > 0) {
-		ipc_call_t call;
-		size_t size;
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EPARTY);
-			return;
-		}
-
-		if (size != name_size) {
-			async_answer_0(&call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&call, name, name_size);
-	}
-}
-
-void remote_audio_pcm_query_caps(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	const audio_cap_t cap = DEV_IPC_GET_ARG1(*call);
-	if (pcm_iface->query_cap) {
-		const unsigned value = pcm_iface->query_cap(fun, cap);
-		async_answer_1(call, EOK, value);
-	} else {
-		async_answer_0(call, ENOTSUP);
-	}
-}
-
-static void remote_audio_pcm_events_register(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	if (!pcm_iface->get_event_session ||
-	    !pcm_iface->set_event_session) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	async_answer_0(call, EOK);
-
-	ipc_call_t callback_call;
-	async_get_call(&callback_call);
-	async_sess_t *sess =
-	    async_callback_receive_start(EXCHANGE_ATOMIC, &callback_call);
-	if (sess == NULL) {
-		ddf_msg(LVL_DEBUG, "Failed to create event callback");
-		async_answer_0(&callback_call, EAGAIN);
-		return;
-	}
-
-	const errno_t ret = pcm_iface->set_event_session(fun, sess);
-	if (ret != EOK) {
-		ddf_msg(LVL_DEBUG, "Failed to set event callback.");
-		async_hangup(sess);
-		async_answer_0(&callback_call, ret);
-		return;
-	}
-
-	async_answer_0(&callback_call, EOK);
-}
-
-static void remote_audio_pcm_events_unregister(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	if (!pcm_iface->get_event_session ||
-	    !pcm_iface->set_event_session) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	async_sess_t *sess = pcm_iface->get_event_session(fun);
-	if (sess) {
-		async_hangup(sess);
-		pcm_iface->set_event_session(fun, NULL);
-	}
-
-	async_answer_0(call, EOK);
-}
-
-void remote_audio_pcm_get_buffer_pos(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	size_t pos = 0;
-	const errno_t ret = pcm_iface->get_buffer_pos ?
-	    pcm_iface->get_buffer_pos(fun, &pos) : ENOTSUP;
-	async_answer_1(call, ret, pos);
-}
-
-void remote_audio_pcm_test_format(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	unsigned channels = DEV_IPC_GET_ARG1(*call);
-	unsigned rate = DEV_IPC_GET_ARG2(*call);
-	pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call);
-	const errno_t ret = pcm_iface->test_format ?
-	    pcm_iface->test_format(fun, &channels, &rate, &format) : ENOTSUP;
-	async_answer_3(call, ret, channels, rate, format);
-}
-
-void remote_audio_pcm_get_buffer(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-
-	if (!pcm_iface->get_buffer ||
-	    !pcm_iface->release_buffer) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	void *buffer = NULL;
-	size_t size = DEV_IPC_GET_ARG1(*call);
-	errno_t ret = pcm_iface->get_buffer(fun, &buffer, &size);
-	async_answer_1(call, ret, size);
-	if (ret != EOK || size == 0)
-		return;
-
-	/* Share the buffer. */
-	ipc_call_t share;
-	size_t share_size = 0;
-
-	ddf_msg(LVL_DEBUG2, "Receiving share request.");
-	if (!async_share_in_receive(&share, &share_size)) {
-		ddf_msg(LVL_DEBUG, "Failed to share pcm buffer.");
-		pcm_iface->release_buffer(fun);
-		async_answer_0(&share, EPARTY);
-		return;
-	}
-
-	ddf_msg(LVL_DEBUG2, "Checking requested share size.");
-	if (share_size != size) {
-		ddf_msg(LVL_DEBUG, "Incorrect pcm buffer size requested.");
-		pcm_iface->release_buffer(fun);
-		async_answer_0(&share, ELIMIT);
-		return;
-	}
-
-	ddf_msg(LVL_DEBUG2, "Calling share finalize.");
-	ret = async_share_in_finalize(&share, buffer, AS_AREA_WRITE |
-	    AS_AREA_READ);
-	if (ret != EOK) {
-		ddf_msg(LVL_DEBUG, "Failed to share buffer.");
-		pcm_iface->release_buffer(fun);
-		return;
-	}
-
-	ddf_msg(LVL_DEBUG2, "Buffer shared with size %zu.", share_size);
-}
-
-void remote_audio_pcm_release_buffer(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-
-	const errno_t ret = pcm_iface->release_buffer ?
-	    pcm_iface->release_buffer(fun) : ENOTSUP;
-	async_answer_0(call, ret);
-}
-
-void remote_audio_pcm_start_playback(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-
-	const unsigned frames = DEV_IPC_GET_ARG1(*call);
-	const unsigned rate = DEV_IPC_GET_ARG2(*call);
-	const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX;
-	const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
-
-	const errno_t ret = pcm_iface->start_playback ?
-	    pcm_iface->start_playback(fun, frames, channels, rate, format) :
-	    ENOTSUP;
-	async_answer_0(call, ret);
-}
-
-void remote_audio_pcm_stop_playback(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	const bool immediate = DEV_IPC_GET_ARG1(*call);
-
-	const errno_t ret = pcm_iface->stop_playback ?
-	    pcm_iface->stop_playback(fun, immediate) : ENOTSUP;
-	async_answer_0(call, ret);
-}
-
-void remote_audio_pcm_start_capture(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-
-	const unsigned frames = DEV_IPC_GET_ARG1(*call);
-	const unsigned rate = DEV_IPC_GET_ARG2(*call);
-	const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT16_MAX;
-	const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX;
-
-	const errno_t ret = pcm_iface->start_capture ?
-	    pcm_iface->start_capture(fun, frames, channels, rate, format) :
-	    ENOTSUP;
-	async_answer_0(call, ret);
-}
-
-void remote_audio_pcm_stop_capture(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const audio_pcm_iface_t *pcm_iface = iface;
-	const bool immediate = DEV_IPC_GET_ARG1(*call);
-
-	const errno_t ret = pcm_iface->stop_capture ?
-	    pcm_iface->stop_capture(fun, immediate) : ENOTSUP;
-	async_answer_0(call, ret);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_battery_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_battery_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <ops/battery_dev.h>
-#include <battery_iface.h>
-#include <ddf/driver.h>
-#include <macros.h>
-
-/** Read the current battery status from the device
- *
- * @param sess     Session of the device
- * @param status   Current status of the battery
- *
- * @return         EOK on success or an error code
- */
-errno_t
-battery_status_get(async_sess_t *sess, battery_status_t *batt_status)
-{
-	sysarg_t status;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
-	    BATTERY_STATUS_GET, &status);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK)
-		*batt_status = (battery_status_t) status;
-
-	return rc;
-}
-
-/** Read the current battery charge level from the device
- *
- * @param sess     Session of the device
- * @param level    Battery charge level (0 - 100)
- *
- * @return         EOK on success or an error code
- */
-errno_t
-battery_charge_level_get(async_sess_t *sess, int *level)
-{
-	sysarg_t charge_level;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	errno_t const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE),
-	    BATTERY_CHARGE_LEVEL_GET, &charge_level);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK)
-		*level = (int) charge_level;
-
-	return rc;
-}
-
-static void remote_battery_status_get(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_battery_charge_level_get(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote battery interface operations */
-static const remote_iface_func_ptr_t remote_battery_dev_iface_ops[] = {
-	[BATTERY_STATUS_GET] = remote_battery_status_get,
-	[BATTERY_CHARGE_LEVEL_GET] = remote_battery_charge_level_get,
-};
-
-/** Remote battery interface structure
- *
- * Interface for processing request from remote clients
- * addressed by the battery interface.
- *
- */
-const remote_iface_t remote_battery_dev_iface = {
-	.method_count = ARRAY_SIZE(remote_battery_dev_iface_ops),
-	.methods = remote_battery_dev_iface_ops,
-};
-
-/** Process the status_get() request from the remote client
- *
- * @param fun The function from which the battery status is read
- * @param ops The local ops structure
- *
- */
-static void remote_battery_status_get(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	const battery_dev_ops_t *bops = (battery_dev_ops_t *) ops;
-
-	if (bops->battery_status_get == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	battery_status_t batt_status;
-	const errno_t rc = bops->battery_status_get(fun, &batt_status);
-
-	if (rc != EOK)
-		async_answer_0(call, rc);
-	else
-		async_answer_1(call, rc, batt_status);
-}
-
-/** Process the battery_charge_level_get() request from the remote client
- *
- * @param fun  The function from which the battery charge level is read
- * @param ops The local ops structure
- *
- */
-static void remote_battery_charge_level_get(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	const battery_dev_ops_t *bops = (battery_dev_ops_t *) ops;
-
-	if (bops->battery_charge_level_get == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	int battery_level;
-	const errno_t rc = bops->battery_charge_level_get(fun, &battery_level);
-
-	if (rc != EOK)
-		async_answer_0(call, rc);
-	else
-		async_answer_1(call, rc, battery_level);
-}
Index: pace/lib/drv/generic/remote_clock_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_clock_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <time.h>
-#include <macros.h>
-#include <device/clock_dev.h>
-
-#include <ops/clock_dev.h>
-#include <ddf/driver.h>
-
-static void remote_clock_time_get(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_clock_time_set(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote clock interface operations */
-static const remote_iface_func_ptr_t remote_clock_dev_iface_ops[] = {
-	[CLOCK_DEV_TIME_GET] = remote_clock_time_get,
-	[CLOCK_DEV_TIME_SET] = remote_clock_time_set,
-};
-
-/** Remote clock interface structure
- *
- * Interface for processing requests from remote clients
- * addressed by the clock interface.
- */
-const remote_iface_t remote_clock_dev_iface = {
-	.method_count = ARRAY_SIZE(remote_clock_dev_iface_ops),
-	.methods = remote_clock_dev_iface_ops,
-};
-
-/** Process the time_get() request from the remote client
- *
- * @param fun The function from which the time is read
- * @param ops The local ops structure
- *
- */
-static void remote_clock_time_get(ddf_fun_t *fun, void *ops, ipc_call_t *call)
-{
-	clock_dev_ops_t *clock_dev_ops = (clock_dev_ops_t *) ops;
-	struct tm t;
-	errno_t rc;
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_read_receive(&data, &len)) {
-		/* TODO: Handle protocol error */
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (!clock_dev_ops->time_get) {
-		/* The driver does not provide the time_get() functionality */
-		async_answer_0(&data, ENOTSUP);
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	rc = (*clock_dev_ops->time_get)(fun, &t);
-
-	if (rc != EOK) {
-		/* Some error occurred */
-		async_answer_0(&data, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	/* The operation was successful */
-	async_data_read_finalize(&data, &t, sizeof(struct tm));
-	async_answer_0(call, rc);
-}
-
-/** Process the time_set() request from the remote client
- *
- * @param fun The function to which the data are written
- * @param ops The local ops structure
- *
- */
-static void remote_clock_time_set(ddf_fun_t *fun, void *ops, ipc_call_t *call)
-{
-	clock_dev_ops_t *clock_dev_ops = (clock_dev_ops_t *) ops;
-	errno_t rc;
-	struct tm t;
-
-	ipc_call_t data;
-	size_t len;
-
-	if (!async_data_write_receive(&data, &len)) {
-		/* TODO: Handle protocol error */
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (!clock_dev_ops->time_set) {
-		/* The driver does not support the time_set() functionality */
-		async_answer_0(&data, ENOTSUP);
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	async_data_write_finalize(&data, &t, sizeof(struct tm));
-
-	rc = (*clock_dev_ops->time_set)(fun, &t);
-
-	async_answer_0(call, rc);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_hw_res.c
===================================================================
--- uspace/lib/drv/generic/remote_hw_res.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-
-#include "ops/hw_res.h"
-#include "ddf/driver.h"
-
-static void remote_hw_res_get_resource_list(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_disable_interrupt(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_clear_interrupt(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_dma_channel_remain(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_query_legacy_io(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_hw_res_claim_legacy_io(ddf_fun_t *, void *, ipc_call_t *);
-
-static const remote_iface_func_ptr_t remote_hw_res_iface_ops [] = {
-	[HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list,
-	[HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt,
-	[HW_RES_DISABLE_INTERRUPT] = &remote_hw_res_disable_interrupt,
-	[HW_RES_CLEAR_INTERRUPT] = &remote_hw_res_clear_interrupt,
-	[HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup,
-	[HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain,
-	[HW_RES_QUERY_LEGACY_IO] = &remote_hw_res_query_legacy_io,
-	[HW_RES_CLAIM_LEGACY_IO] = &remote_hw_res_claim_legacy_io
-};
-
-const remote_iface_t remote_hw_res_iface = {
-	.method_count = ARRAY_SIZE(remote_hw_res_iface_ops),
-	.methods = remote_hw_res_iface_ops
-};
-
-static void remote_hw_res_enable_interrupt(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
-
-	if (hw_res_ops->enable_interrupt == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->enable_interrupt(fun, irq);
-	async_answer_0(call, ret);
-}
-
-static void remote_hw_res_disable_interrupt(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
-
-	if (hw_res_ops->disable_interrupt == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->disable_interrupt(fun, irq);
-	async_answer_0(call, ret);
-}
-
-static void remote_hw_res_clear_interrupt(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
-
-	if (hw_res_ops->clear_interrupt == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const int irq = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = hw_res_ops->clear_interrupt(fun, irq);
-	async_answer_0(call, ret);
-}
-
-static void remote_hw_res_get_resource_list(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
-
-	if (hw_res_ops->get_resource_list == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(fun);
-	if (hw_resources == NULL) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	async_answer_1(call, EOK, hw_resources->count);
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_read_receive(&data, &len)) {
-		/* Protocol error - the recipient is not accepting data */
-		return;
-	}
-
-	async_data_read_finalize(&data, hw_resources->resources, len);
-}
-
-static void remote_hw_res_dma_channel_setup(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = ops;
-
-	if (hw_res_ops->dma_channel_setup == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const unsigned channel = DEV_IPC_GET_ARG1(*call) & 0xffff;
-	const uint8_t  mode = DEV_IPC_GET_ARG1(*call) >> 16;
-	const uint32_t address = DEV_IPC_GET_ARG2(*call);
-	const uint32_t size = DEV_IPC_GET_ARG3(*call);
-
-	const errno_t ret = hw_res_ops->dma_channel_setup(
-	    fun, channel, address, size, mode);
-	async_answer_0(call, ret);
-}
-
-static void remote_hw_res_dma_channel_remain(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = ops;
-
-	if (hw_res_ops->dma_channel_setup == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const unsigned channel = DEV_IPC_GET_ARG1(*call);
-	size_t remain = 0;
-	const errno_t ret = hw_res_ops->dma_channel_remain(fun, channel, &remain);
-	async_answer_1(call, ret, remain);
-}
-
-static void remote_hw_res_query_legacy_io(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = ops;
-
-	if (hw_res_ops->query_legacy_io == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	hw_res_claims_t claims = 0;
-	const errno_t ret = hw_res_ops->query_legacy_io(fun, &claims);
-	async_answer_1(call, ret, claims);
-}
-
-static void remote_hw_res_claim_legacy_io(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	hw_res_ops_t *hw_res_ops = ops;
-	hw_res_claims_t claims;
-
-	if (hw_res_ops->claim_legacy_io == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	claims = DEV_IPC_GET_ARG1(*call);
-
-	const errno_t ret = hw_res_ops->claim_legacy_io(fun, claims);
-	async_answer_0(call, ret);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_ieee80211.c
===================================================================
--- uspace/lib/drv/generic/remote_ieee80211.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,390 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/**
- * @file
- * @brief Driver-side RPC skeletons for IEEE 802.11 interface
- */
-
-#include <errno.h>
-#include <macros.h>
-#include <str.h>
-#include <inet/dhcp.h>
-#include <inet/inetcfg.h>
-#include "ops/ieee80211.h"
-#include "ieee80211_iface.h"
-#include "nic_iface.h"
-
-#define MAX_STRING_SIZE  32
-
-/** IEEE 802.11 RPC functions IDs. */
-typedef enum {
-	IEEE80211_GET_SCAN_RESULTS,
-	IEEE80211_CONNECT,
-	IEEE80211_DISCONNECT
-} ieee80211_funcs_t;
-
-/** Get scan results from IEEE 802.11 device
- *
- * @param[in]  dev_sess Device session.
- * @param[out] results  Structure where to put scan results.
- *
- * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_get_scan_results(async_sess_t *dev_sess,
-    ieee80211_scan_results_t *results, bool now)
-{
-	assert(results);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t aid = async_send_2(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
-	    IEEE80211_GET_SCAN_RESULTS, now, NULL);
-	errno_t rc = async_data_read_start(exch, results,
-	    sizeof(ieee80211_scan_results_t));
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(aid, &res);
-
-	if (res != EOK)
-		return (errno_t) res;
-
-	return rc;
-}
-
-// XXX This is wrong. Wifi should not have anything to do with IP links
-static sysarg_t get_link_id(uint8_t *mac)
-{
-	sysarg_t *link_list;
-	inet_link_info_t link_info;
-	eth_addr_t eth_addr;
-	size_t count;
-
-	eth_addr_decode(mac, &eth_addr);
-
-	errno_t rc = inetcfg_get_link_list(&link_list, &count);
-	if (rc != EOK)
-		return -1;
-
-	for (size_t i = 0; i < count; i++) {
-		rc = inetcfg_link_get(link_list[i], &link_info);
-		if (rc != EOK)
-			return -1;
-
-		if (eth_addr_compare(&eth_addr, &link_info.mac_addr) == 0)
-			return link_list[i];
-	}
-
-	return -1;
-}
-
-/** Connect to specified network.
- *
- * @param[in] dev_sess   Device session.
- * @param[in] ssid_start Network SSID prefix.
- * @param[in] password   Network password (pass empty string if not needed).
- *
- * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_connect(async_sess_t *dev_sess, char *ssid_start, char *password)
-{
-	assert(ssid_start);
-
-	errno_t rc_orig;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t aid = async_send_1(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
-	    IEEE80211_CONNECT, NULL);
-
-	errno_t rc = async_data_write_start(exch, ssid_start,
-	    str_size(ssid_start) + 1);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(aid, &rc_orig);
-
-		if (rc_orig == EOK)
-			return (errno_t) rc;
-
-		return (errno_t) rc_orig;
-	}
-
-	// FIXME: Typecasting string literal
-	if (password == NULL)
-		password = (char *) "";
-
-	rc = async_data_write_start(exch, password, str_size(password) + 1);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(aid, &rc_orig);
-
-		if (rc_orig == EOK)
-			return (errno_t) rc;
-
-		return (errno_t) rc_orig;
-	}
-
-	async_exchange_end(exch);
-
-	async_wait_for(aid, &rc);
-	if (rc != EOK)
-		return rc;
-
-	// XXX This is wrong. Wifi should not initiate DHCP
-
-	/* Send DHCP discover. */
-	nic_address_t wifi_mac;
-	rc = nic_get_address(dev_sess, &wifi_mac);
-	if (rc != EOK)
-		return rc;
-
-	sysarg_t link_id = get_link_id(wifi_mac.address);
-	if (link_id == ((sysarg_t) -1))
-		return EINVAL;
-
-	rc = dhcp_discover(link_id);
-
-	return (errno_t) rc;
-}
-
-/** Disconnect device from network.
- *
- * @param[in] dev_sess Device session.
- *
- * @return EOK If the operation was successfully completed,
- *         error code otherwise.
- *
- */
-errno_t ieee80211_disconnect(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(IEEE80211_DEV_IFACE),
-	    IEEE80211_DISCONNECT);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	nic_address_t wifi_mac;
-	rc = nic_get_address(dev_sess, &wifi_mac);
-	if (rc != EOK)
-		return rc;
-
-	eth_addr_t eth_addr;
-	eth_addr_decode(wifi_mac.address, &eth_addr);
-
-	inet_link_info_t link_info;
-	inet_addr_info_t addr_info;
-	inet_sroute_info_t route_info;
-	sysarg_t *addr_list;
-	sysarg_t *route_list;
-	size_t count;
-
-	/// XXX This is wrong. Wifi should do nothing with DHCP
-
-	/* Remove previous DHCP address. */
-	rc = inetcfg_get_addr_list(&addr_list, &count);
-	if (rc != EOK)
-		return rc;
-
-	for (size_t i = 0; i < count; i++) {
-		rc = inetcfg_addr_get(addr_list[i], &addr_info);
-		if (rc != EOK)
-			return rc;
-
-		rc = inetcfg_link_get(addr_info.ilink, &link_info);
-		if (rc != EOK)
-			return rc;
-
-		if (eth_addr_compare(&eth_addr, &link_info.mac_addr) == 0) {
-			if (str_test_prefix(addr_info.name, "dhcp")) {
-				rc = inetcfg_addr_delete(addr_list[i]);
-				if (rc != EOK)
-					return rc;
-
-				break;
-			}
-		}
-	}
-
-	/*
-	 * TODO: At this moment there can be only one DHCP route,
-	 * so it must be reimplemented after this limitation will be
-	 * dropped.
-	 */
-	/* Remove previous DHCP static route. */
-	rc = inetcfg_get_sroute_list(&route_list, &count);
-	if (rc != EOK)
-		return rc;
-
-	for (size_t i = 0; i < count; i++) {
-		rc = inetcfg_sroute_get(route_list[i], &route_info);
-		if (rc != EOK)
-			return rc;
-
-		if (str_test_prefix(route_info.name, "dhcp")) {
-			rc = inetcfg_sroute_delete(route_list[i]);
-			if (rc != EOK)
-				return rc;
-
-			break;
-		}
-	}
-
-	return rc;
-}
-
-static void remote_ieee80211_get_scan_results(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
-	assert(ieee80211_iface->get_scan_results);
-
-	ieee80211_scan_results_t scan_results;
-	memset(&scan_results, 0, sizeof(ieee80211_scan_results_t));
-
-	bool now = ipc_get_arg2(call);
-
-	errno_t rc = ieee80211_iface->get_scan_results(fun, &scan_results, now);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t max_len;
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len < sizeof(ieee80211_scan_results_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&data, &scan_results,
-		    sizeof(ieee80211_scan_results_t));
-	}
-
-	async_answer_0(call, rc);
-}
-
-static void remote_ieee80211_connect(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
-	assert(ieee80211_iface->connect);
-
-	char ssid_start[MAX_STRING_SIZE];
-	char password[MAX_STRING_SIZE];
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_write_receive(&data, &len)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (len > MAX_STRING_SIZE) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&data, ssid_start, len);
-	if (rc != EOK) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (!async_data_write_receive(&data, &len)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (len > MAX_STRING_SIZE) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&data, password, len);
-	if (rc != EOK) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	rc = ieee80211_iface->connect(fun, ssid_start, password);
-
-	async_answer_0(call, rc);
-}
-
-static void remote_ieee80211_disconnect(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	ieee80211_iface_t *ieee80211_iface = (ieee80211_iface_t *) iface;
-	assert(ieee80211_iface->disconnect);
-	errno_t rc = ieee80211_iface->disconnect(fun);
-	async_answer_0(call, rc);
-}
-
-/** Remote IEEE 802.11 interface operations.
- *
- */
-static const remote_iface_func_ptr_t remote_ieee80211_iface_ops[] = {
-	[IEEE80211_GET_SCAN_RESULTS] = remote_ieee80211_get_scan_results,
-	[IEEE80211_CONNECT] = remote_ieee80211_connect,
-	[IEEE80211_DISCONNECT] = remote_ieee80211_disconnect
-};
-
-/** Remote IEEE 802.11 interface structure.
- *
- * Interface for processing request from remote
- * clients addressed to the IEEE 802.11 interface.
- *
- */
-const remote_iface_t remote_ieee80211_iface = {
-	.method_count = ARRAY_SIZE(remote_ieee80211_iface_ops),
-	.methods = remote_ieee80211_iface_ops
-};
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_led_dev.c
===================================================================
--- uspace/lib/drv/generic/remote_led_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <io/pixel.h>
-#include <macros.h>
-#include <device/led_dev.h>
-#include <ops/led_dev.h>
-#include <ddf/driver.h>
-
-static void remote_led_color_set(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote LED interface operations */
-static const remote_iface_func_ptr_t remote_led_dev_iface_ops[] = {
-	[LED_DEV_COLOR_SET] = remote_led_color_set
-};
-
-/** Remote LED interface structure
- *
- * Interface for processing requests from remote clients
- * addressed by the LED interface.
- *
- */
-const remote_iface_t remote_led_dev_iface = {
-	.method_count = ARRAY_SIZE(remote_led_dev_iface_ops),
-	.methods = remote_led_dev_iface_ops
-};
-
-/** Process the color_set() request from the remote client
- *
- * @param fun The function to which the data are written
- * @param ops The local ops structure
- *
- */
-static void remote_led_color_set(ddf_fun_t *fun, void *ops, ipc_call_t *call)
-{
-	led_dev_ops_t *led_dev_ops = (led_dev_ops_t *) ops;
-	pixel_t color = DEV_IPC_GET_ARG1(*call);
-
-	if (!led_dev_ops->color_set) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	errno_t rc = (*led_dev_ops->color_set)(fun, color);
-	async_answer_0(call, rc);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_nic.c
===================================================================
--- uspace/lib/drv/generic/remote_nic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2548 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/**
- * @file
- * @brief Driver-side RPC skeletons for DDF NIC interface
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <ipc/services.h>
-#include <time.h>
-#include <macros.h>
-
-#include "ops/nic.h"
-#include "nic_iface.h"
-
-typedef enum {
-	NIC_SEND_MESSAGE = 0,
-	NIC_CALLBACK_CREATE,
-	NIC_GET_STATE,
-	NIC_SET_STATE,
-	NIC_GET_ADDRESS,
-	NIC_SET_ADDRESS,
-	NIC_GET_STATS,
-	NIC_GET_DEVICE_INFO,
-	NIC_GET_CABLE_STATE,
-	NIC_GET_OPERATION_MODE,
-	NIC_SET_OPERATION_MODE,
-	NIC_AUTONEG_ENABLE,
-	NIC_AUTONEG_DISABLE,
-	NIC_AUTONEG_PROBE,
-	NIC_AUTONEG_RESTART,
-	NIC_GET_PAUSE,
-	NIC_SET_PAUSE,
-	NIC_UNICAST_GET_MODE,
-	NIC_UNICAST_SET_MODE,
-	NIC_MULTICAST_GET_MODE,
-	NIC_MULTICAST_SET_MODE,
-	NIC_BROADCAST_GET_MODE,
-	NIC_BROADCAST_SET_MODE,
-	NIC_DEFECTIVE_GET_MODE,
-	NIC_DEFECTIVE_SET_MODE,
-	NIC_BLOCKED_SOURCES_GET,
-	NIC_BLOCKED_SOURCES_SET,
-	NIC_VLAN_GET_MASK,
-	NIC_VLAN_SET_MASK,
-	NIC_VLAN_SET_TAG,
-	NIC_WOL_VIRTUE_ADD,
-	NIC_WOL_VIRTUE_REMOVE,
-	NIC_WOL_VIRTUE_PROBE,
-	NIC_WOL_VIRTUE_LIST,
-	NIC_WOL_VIRTUE_GET_CAPS,
-	NIC_WOL_LOAD_INFO,
-	NIC_OFFLOAD_PROBE,
-	NIC_OFFLOAD_SET,
-	NIC_POLL_GET_MODE,
-	NIC_POLL_SET_MODE,
-	NIC_POLL_NOW
-} nic_funcs_t;
-
-/** Send frame from NIC
- *
- * @param[in] dev_sess
- * @param[in] data     Frame data
- * @param[in] size     Frame size in bytes
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_send_frame(async_sess_t *dev_sess, void *data, size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_SEND_MESSAGE, &answer);
-	errno_t retval = async_data_write_start(exch, data, size);
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-/** Create callback connection from NIC service
- *
- * @param[in] dev_sess
- * @param[in] device_id
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_callback_create(async_sess_t *dev_sess, async_port_handler_t cfun,
-    void *carg)
-{
-	ipc_call_t answer;
-	errno_t rc;
-	errno_t retval;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	aid_t req = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_CALLBACK_CREATE, &answer);
-
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_NIC_CB, 0, 0,
-	    cfun, carg, &port);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-	async_exchange_end(exch);
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-/** Get the current state of the device
- *
- * @param[in]  dev_sess
- * @param[out] state    Current state
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_state(async_sess_t *dev_sess, nic_device_state_t *state)
-{
-	assert(state);
-
-	sysarg_t _state;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_STATE, &_state);
-	async_exchange_end(exch);
-
-	*state = (nic_device_state_t) _state;
-
-	return rc;
-}
-
-/** Request the device to change its state
- *
- * @param[in] dev_sess
- * @param[in] state    New state
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_set_state(async_sess_t *dev_sess, nic_device_state_t state)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_SET_STATE, state);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Request the MAC address of the device
- *
- * @param[in]  dev_sess
- * @param[out] address  Structure with buffer for the address
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_address(async_sess_t *dev_sess, nic_address_t *address)
-{
-	assert(address);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_ADDRESS, NULL);
-	errno_t rc = async_data_read_start(exch, address, sizeof(nic_address_t));
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(aid, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Set the address of the device (e.g. MAC on Ethernet)
- *
- * @param[in] dev_sess
- * @param[in] address  Pointer to the address
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_set_address(async_sess_t *dev_sess, const nic_address_t *address)
-{
-	assert(address);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_SET_ADDRESS, NULL);
-	errno_t rc = async_data_write_start(exch, address, sizeof(nic_address_t));
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(aid, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Request statistic data about NIC operation.
- *
- * @param[in]  dev_sess
- * @param[out] stats    Structure with the statistics
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_stats(async_sess_t *dev_sess, nic_device_stats_t *stats)
-{
-	assert(stats);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_STATS);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, stats, sizeof(nic_device_stats_t));
-
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Request information about the device.
- *
- * @see nic_device_info_t
- *
- * @param[in]  dev_sess
- * @param[out] device_info Information about the device
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_device_info(async_sess_t *dev_sess, nic_device_info_t *device_info)
-{
-	assert(device_info);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t aid = async_send_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_DEVICE_INFO, NULL);
-	errno_t rc = async_data_read_start(exch, device_info, sizeof(nic_device_info_t));
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(aid, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Request status of the cable (plugged/unplugged)
- *
- * @param[in]  dev_sess
- * @param[out] cable_state Current cable state
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_cable_state(async_sess_t *dev_sess, nic_cable_state_t *cable_state)
-{
-	assert(cable_state);
-
-	sysarg_t _cable_state;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_CABLE_STATE, &_cable_state);
-	async_exchange_end(exch);
-
-	*cable_state = (nic_cable_state_t) _cable_state;
-
-	return rc;
-}
-
-/** Request current operation mode.
- *
- * @param[in]  dev_sess
- * @param[out] speed    Current operation speed in Mbps. Can be NULL.
- * @param[out] duplex   Full duplex/half duplex. Can be NULL.
- * @param[out] role     Master/slave/auto. Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_operation_mode(async_sess_t *dev_sess, int *speed,
-    nic_channel_mode_t *duplex, nic_role_t *role)
-{
-	sysarg_t _speed;
-	sysarg_t _duplex;
-	sysarg_t _role;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_OPERATION_MODE, &_speed, &_duplex, &_role);
-	async_exchange_end(exch);
-
-	if (speed)
-		*speed = (int) _speed;
-
-	if (duplex)
-		*duplex = (nic_channel_mode_t) _duplex;
-
-	if (role)
-		*role = (nic_role_t) _role;
-
-	return rc;
-}
-
-/** Set current operation mode.
- *
- * If the NIC has auto-negotiation enabled, this command
- * disables auto-negotiation and sets the operation mode.
- *
- * @param[in] dev_sess
- * @param[in] speed    Operation speed in Mbps
- * @param[in] duplex   Full duplex/half duplex
- * @param[in] role     Master/slave/auto (e.g. in Gbit Ethernet]
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_set_operation_mode(async_sess_t *dev_sess, int speed,
-    nic_channel_mode_t duplex, nic_role_t role)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_SET_OPERATION_MODE, (sysarg_t) speed, (sysarg_t) duplex,
-	    (sysarg_t) role);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Enable auto-negotiation.
- *
- * The advertisement argument can only limit some modes,
- * it can never force the NIC to advertise unsupported modes.
- *
- * The allowed modes are defined in "nic/eth_phys.h" in the C library.
- *
- * @param[in] dev_sess
- * @param[in] advertisement Allowed advertised modes. Use 0 for all modes.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_autoneg_enable(async_sess_t *dev_sess, uint32_t advertisement)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_AUTONEG_ENABLE, (sysarg_t) advertisement);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Disable auto-negotiation.
- *
- * @param[in] dev_sess
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_autoneg_disable(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_AUTONEG_DISABLE);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Probe current state of auto-negotiation.
- *
- * Modes are defined in the "nic/eth_phys.h" in the C library.
- *
- * @param[in]  dev_sess
- * @param[out] our_advertisement   Modes advertised by this NIC.
- *                                 Can be NULL.
- * @param[out] their_advertisement Modes advertised by the other side.
- *                                 Can be NULL.
- * @param[out] result              General state of auto-negotiation.
- *                                 Can be NULL.
- * @param[out]  their_result       State of other side auto-negotiation.
- *                                 Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_autoneg_probe(async_sess_t *dev_sess, uint32_t *our_advertisement,
-    uint32_t *their_advertisement, nic_result_t *result,
-    nic_result_t *their_result)
-{
-	sysarg_t _our_advertisement;
-	sysarg_t _their_advertisement;
-	sysarg_t _result;
-	sysarg_t _their_result;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_4(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_AUTONEG_PROBE, &_our_advertisement, &_their_advertisement,
-	    &_result, &_their_result);
-	async_exchange_end(exch);
-
-	if (our_advertisement)
-		*our_advertisement = (uint32_t) _our_advertisement;
-
-	if (*their_advertisement)
-		*their_advertisement = (uint32_t) _their_advertisement;
-
-	if (result)
-		*result = (nic_result_t) _result;
-
-	if (their_result)
-		*their_result = (nic_result_t) _their_result;
-
-	return rc;
-}
-
-/** Restart the auto-negotiation process.
- *
- * @param[in] dev_sess
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_autoneg_restart(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_AUTONEG_RESTART);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Query party's sending and reception of the PAUSE frame.
- *
- * @param[in]  dev_sess
- * @param[out] we_send    This NIC sends the PAUSE frame (true/false)
- * @param[out] we_receive This NIC receives the PAUSE frame (true/false)
- * @param[out] pause      The time set to transmitted PAUSE frames.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_get_pause(async_sess_t *dev_sess, nic_result_t *we_send,
-    nic_result_t *we_receive, uint16_t *pause)
-{
-	sysarg_t _we_send;
-	sysarg_t _we_receive;
-	sysarg_t _pause;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_GET_PAUSE, &_we_send, &_we_receive, &_pause);
-	async_exchange_end(exch);
-
-	if (we_send)
-		*we_send = _we_send;
-
-	if (we_receive)
-		*we_receive = _we_receive;
-
-	if (pause)
-		*pause = _pause;
-
-	return rc;
-}
-
-/** Control sending and reception of the PAUSE frame.
- *
- * @param[in] dev_sess
- * @param[in] allow_send    Allow sending the PAUSE frame (true/false)
- * @param[in] allow_receive Allow reception of the PAUSE frame (true/false)
- * @param[in] pause         Pause length in 512 bit units written
- *                          to transmitted frames. The value 0 means
- *                          auto value (the best). If the requested
- *                          time cannot be set the driver is allowed
- *                          to set the nearest supported value.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_set_pause(async_sess_t *dev_sess, int allow_send, int allow_receive,
-    uint16_t pause)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_SET_PAUSE, allow_send, allow_receive, pause);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Retrieve current settings of unicast frames reception.
- *
- * Note: In case of mode != NIC_UNICAST_LIST the contents of
- * address_list and address_count are undefined.
- *
- * @param[in]   dev_sess
- * @param[out]  mode          Current operation mode
- * @param[in]   max_count     Maximal number of addresses that could
- *                            be written into the list buffer.
- * @param[out]  address_list  Buffer for the list (array). Can be NULL.
- * @param[out]  address_count Number of addresses in the list before
- *                            possible truncation due to the max_count.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_unicast_get_mode(async_sess_t *dev_sess, nic_unicast_mode_t *mode,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	assert(mode);
-
-	sysarg_t _mode;
-	sysarg_t _address_count;
-
-	if (!address_list)
-		max_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_UNICAST_GET_MODE, max_count, &_mode, &_address_count);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	*mode = (nic_unicast_mode_t) _mode;
-	if (address_count)
-		*address_count = (size_t) _address_count;
-
-	if ((max_count) && (_address_count))
-		rc = async_data_read_start(exch, address_list,
-		    max_count * sizeof(nic_address_t));
-
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Set which unicast frames are received.
- *
- * @param[in] dev_sess
- * @param[in] mode          Current operation mode
- * @param[in] address_list  The list of addresses. Can be NULL.
- * @param[in] address_count Number of addresses in the list.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_unicast_set_mode(async_sess_t *dev_sess, nic_unicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	if (address_list == NULL)
-		address_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_UNICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
-
-	errno_t rc;
-	if (address_count)
-		rc = async_data_write_start(exch, address_list,
-		    address_count * sizeof(nic_address_t));
-	else
-		rc = EOK;
-
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(message_id, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Retrieve current settings of multicast frames reception.
- *
- * Note: In case of mode != NIC_MULTICAST_LIST the contents of
- * address_list and address_count are undefined.
- *
- * @param[in]  dev_sess
- * @param[out] mode          Current operation mode
- * @param[in]  max_count     Maximal number of addresses that could
- *                           be written into the list buffer.
- * @param[out] address_list  Buffer for the list (array). Can be NULL.
- * @param[out] address_count Number of addresses in the list before
- *                           possible truncation due to the max_count.
- *                           Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_multicast_get_mode(async_sess_t *dev_sess, nic_multicast_mode_t *mode,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	assert(mode);
-
-	sysarg_t _mode;
-
-	if (!address_list)
-		max_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	sysarg_t ac;
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_MULTICAST_GET_MODE, max_count, &_mode, &ac);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	*mode = (nic_multicast_mode_t) _mode;
-	if (address_count)
-		*address_count = (size_t) ac;
-
-	if ((max_count) && (ac))
-		rc = async_data_read_start(exch, address_list,
-		    max_count * sizeof(nic_address_t));
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Set which multicast frames are received.
- *
- * @param[in] dev_sess
- * @param[in] mode          Current operation mode
- * @param[in] address_list  The list of addresses. Can be NULL.
- * @param[in] address_count Number of addresses in the list.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_multicast_set_mode(async_sess_t *dev_sess, nic_multicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	if (address_list == NULL)
-		address_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_MULTICAST_SET_MODE, (sysarg_t) mode, address_count, NULL);
-
-	errno_t rc;
-	if (address_count)
-		rc = async_data_write_start(exch, address_list,
-		    address_count * sizeof(nic_address_t));
-	else
-		rc = EOK;
-
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(message_id, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Determine if broadcast packets are received.
- *
- * @param[in]  dev_sess
- * @param[out] mode     Current operation mode
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_broadcast_get_mode(async_sess_t *dev_sess, nic_broadcast_mode_t *mode)
-{
-	assert(mode);
-
-	sysarg_t _mode;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_BROADCAST_GET_MODE, &_mode);
-	async_exchange_end(exch);
-
-	*mode = (nic_broadcast_mode_t) _mode;
-
-	return rc;
-}
-
-/** Set whether broadcast packets are received.
- *
- * @param[in] dev_sess
- * @param[in] mode     Current operation mode
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_broadcast_set_mode(async_sess_t *dev_sess, nic_broadcast_mode_t mode)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_BROADCAST_SET_MODE, mode);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Determine if defective (erroneous) packets are received.
- *
- * @param[in]  dev_sess
- * @param[out] mode     Bitmask specifying allowed errors
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_defective_get_mode(async_sess_t *dev_sess, uint32_t *mode)
-{
-	assert(mode);
-
-	sysarg_t _mode;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_DEFECTIVE_GET_MODE, &_mode);
-	async_exchange_end(exch);
-
-	*mode = (uint32_t) _mode;
-
-	return rc;
-}
-
-/** Set whether defective (erroneous) packets are received.
- *
- * @param[in]  dev_sess
- * @param[out] mode     Bitmask specifying allowed errors
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_defective_set_mode(async_sess_t *dev_sess, uint32_t mode)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_DEFECTIVE_SET_MODE, mode);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Retrieve the currently blocked source MAC addresses.
- *
- * @param[in]  dev_sess
- * @param[in]  max_count     Maximal number of addresses that could
- *                           be written into the list buffer.
- * @param[out] address_list  Buffer for the list (array). Can be NULL.
- * @param[out] address_count Number of addresses in the list before
- *                           possible truncation due to the max_count.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_blocked_sources_get(async_sess_t *dev_sess, size_t max_count,
-    nic_address_t *address_list, size_t *address_count)
-{
-	if (!address_list)
-		max_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	sysarg_t ac;
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_BLOCKED_SOURCES_GET, max_count, &ac);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	if (address_count)
-		*address_count = (size_t) ac;
-
-	if ((max_count) && (ac))
-		rc = async_data_read_start(exch, address_list,
-		    max_count * sizeof(nic_address_t));
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Set which source MACs are blocked
- *
- * @param[in] dev_sess
- * @param[in] address_list  The list of addresses. Can be NULL.
- * @param[in] address_count Number of addresses in the list.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_blocked_sources_set(async_sess_t *dev_sess,
-    const nic_address_t *address_list, size_t address_count)
-{
-	if (address_list == NULL)
-		address_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_BLOCKED_SOURCES_SET, address_count, NULL);
-
-	errno_t rc;
-	if (address_count)
-		rc = async_data_write_start(exch, address_list,
-		    address_count * sizeof(nic_address_t));
-	else
-		rc = EOK;
-
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(message_id, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Request current VLAN filtering mask.
- *
- * @param[in]  dev_sess
- * @param[out] stats    Structure with the statistics
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_vlan_get_mask(async_sess_t *dev_sess, nic_vlan_mask_t *mask)
-{
-	assert(mask);
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_VLAN_GET_MASK);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, mask, sizeof(nic_vlan_mask_t));
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Set the mask used for VLAN filtering.
- *
- * If NULL, VLAN filtering is disabled.
- *
- * @param[in] dev_sess
- * @param[in] mask     Pointer to mask structure or NULL to disable.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_vlan_set_mask(async_sess_t *dev_sess, const nic_vlan_mask_t *mask)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t message_id = async_send_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_VLAN_SET_MASK, mask != NULL, NULL);
-
-	errno_t rc;
-	if (mask != NULL)
-		rc = async_data_write_start(exch, mask, sizeof(nic_vlan_mask_t));
-	else
-		rc = EOK;
-
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(message_id, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Set VLAN (802.1q) tag.
- *
- * Set whether the tag is to be signaled in offload info and
- * if the tag should be stripped from received frames and added
- * to sent frames automatically. Not every combination of add
- * and strip must be supported.
- *
- * @param[in] dev_sess
- * @param[in] tag      VLAN priority (top 3 bits) and
- *                     the VLAN tag (bottom 12 bits)
- * @param[in] add      Add the VLAN tag automatically (boolean)
- * @param[in] strip    Strip the VLAN tag automatically (boolean)
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_vlan_set_tag(async_sess_t *dev_sess, uint16_t tag, bool add, bool strip)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_4_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_VLAN_SET_TAG, (sysarg_t) tag, (sysarg_t) add, (sysarg_t) strip);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Add new Wake-On-LAN virtue.
- *
- * @param[in]  dev_sess
- * @param[in]  type     Type of the virtue
- * @param[in]  data     Data required for this virtue
- *                      (depends on type)
- * @param[in]  length   Length of the data
- * @param[out] id       Identifier of the new virtue
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_virtue_add(async_sess_t *dev_sess, nic_wv_type_t type,
-    const void *data, size_t length, nic_wv_id_t *id)
-{
-	assert(id);
-
-	bool send_data = ((data != NULL) && (length != 0));
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	ipc_call_t result;
-	aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_VIRTUE_ADD, (sysarg_t) type, send_data, &result);
-
-	errno_t res;
-	if (send_data) {
-		errno_t rc = async_data_write_start(exch, data, length);
-		if (rc != EOK) {
-			async_exchange_end(exch);
-			async_wait_for(message_id, &res);
-			return rc;
-		}
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(message_id, &res);
-
-	*id = ipc_get_arg1(&result);
-	return res;
-}
-
-/** Remove Wake-On-LAN virtue.
- *
- * @param[in] dev_sess
- * @param[in] id       Virtue identifier
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_virtue_remove(async_sess_t *dev_sess, nic_wv_id_t id)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_VIRTUE_REMOVE, (sysarg_t) id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Get information about virtue.
- *
- * @param[in]  dev_sess
- * @param[in]  id         Virtue identifier
- * @param[out] type       Type of the filter. Can be NULL.
- * @param[out] max_length Size of the data buffer.
- * @param[out] data       Buffer for data used when the
- *                        virtue was created. Can be NULL.
- * @param[out] length     Length of the data. Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_virtue_probe(async_sess_t *dev_sess, nic_wv_id_t id,
-    nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
-{
-	sysarg_t _type;
-	sysarg_t _length;
-
-	if (data == NULL)
-		max_length = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	errno_t rc = async_req_3_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_VIRTUE_PROBE, (sysarg_t) id, max_length,
-	    &_type, &_length);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	if (type)
-		*type = _type;
-
-	if (length)
-		*length = _length;
-
-	if ((max_length) && (_length != 0))
-		rc = async_data_read_start(exch, data, max_length);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Get a list of all virtues of the specified type.
- *
- * When NIC_WV_NONE is specified as the virtue type the function
- * lists virtues of all types.
- *
- * @param[in]  dev_sess
- * @param[in]  type      Type of the virtues
- * @param[in]  max_count Maximum number of ids that can be
- *                       written into the list buffer.
- * @param[out] id_list   Buffer for to the list of virtue ids.
- *                       Can be NULL.
- * @param[out] id_count  Number of virtue identifiers in the list
- *                       before possible truncation due to the
- *                       max_count. Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_virtue_list(async_sess_t *dev_sess, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
-{
-	if (id_list == NULL)
-		max_count = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	sysarg_t count;
-	errno_t rc = async_req_3_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_VIRTUE_LIST, (sysarg_t) type, max_count, &count);
-
-	if (id_count)
-		*id_count = (size_t) count;
-
-	if ((rc != EOK) || (!max_count)) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, id_list,
-	    max_count * sizeof(nic_wv_id_t));
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Get number of virtues that can be enabled yet.
- *
- * Count: < 0 => Virtue of this type can be never used
- *        = 0 => No more virtues can be enabled
- *        > 0 => #count virtues can be enabled yet
- *
- * @param[in]  dev_sess
- * @param[in]  type     Virtue type
- * @param[out] count    Number of virtues
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_virtue_get_caps(async_sess_t *dev_sess, nic_wv_type_t type,
-    int *count)
-{
-	assert(count);
-
-	sysarg_t _count;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_VIRTUE_GET_CAPS, (sysarg_t) type, &_count);
-	async_exchange_end(exch);
-
-	*count = (int) _count;
-	return rc;
-}
-
-/** Load the frame that issued the wakeup.
- *
- * The NIC can support only matched_type,  only part of the frame
- * can be available or not at all. Sometimes even the type can be
- * uncertain -- in this case the matched_type contains NIC_WV_NONE.
- *
- * Frame_length can be greater than max_length, but at most max_length
- * bytes will be copied into the frame buffer.
- *
- * Note: Only the type of the filter can be detected, not the concrete
- * filter, because the driver is probably not running when the wakeup
- * is issued.
- *
- * @param[in]  dev_sess
- * @param[out] matched_type Type of the filter that issued wakeup.
- * @param[in]  max_length   Size of the buffer
- * @param[out] frame        Buffer for the frame. Can be NULL.
- * @param[out] frame_length Length of the stored frame. Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_wol_load_info(async_sess_t *dev_sess, nic_wv_type_t *matched_type,
-    size_t max_length, uint8_t *frame, size_t *frame_length)
-{
-	assert(matched_type);
-
-	sysarg_t _matched_type;
-	sysarg_t _frame_length;
-
-	if (frame == NULL)
-		max_length = 0;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	errno_t rc = async_req_2_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_WOL_LOAD_INFO, max_length, &_matched_type, &_frame_length);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	*matched_type = (nic_wv_type_t) _matched_type;
-	if (frame_length)
-		*frame_length = (size_t) _frame_length;
-
-	if ((max_length != 0) && (_frame_length != 0))
-		rc = async_data_read_start(exch, frame, max_length);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Probe supported options and current setting of offload computations
- *
- * @param[in]  dev_sess
- * @param[out] supported Supported offload options
- * @param[out] active    Currently active offload options
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_offload_probe(async_sess_t *dev_sess, uint32_t *supported,
-    uint32_t *active)
-{
-	assert(supported);
-	assert(active);
-
-	sysarg_t _supported;
-	sysarg_t _active;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_2(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_OFFLOAD_PROBE, &_supported, &_active);
-	async_exchange_end(exch);
-
-	*supported = (uint32_t) _supported;
-	*active = (uint32_t) _active;
-	return rc;
-}
-
-/** Set which offload computations can be performed on the NIC.
- *
- * @param[in] dev_sess
- * @param[in] mask     Mask for the options (only those set here will be set)
- * @param[in] active   Which options should be enabled and which disabled
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_offload_set(async_sess_t *dev_sess, uint32_t mask, uint32_t active)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_AUTONEG_RESTART, (sysarg_t) mask, (sysarg_t) active);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Query the current interrupt/poll mode of the NIC
- *
- * @param[in]  dev_sess
- * @param[out] mode     Current poll mode
- * @param[out] period   Period used in periodic polling.
- *                      Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_poll_get_mode(async_sess_t *dev_sess, nic_poll_mode_t *mode,
-    struct timespec *period)
-{
-	assert(mode);
-
-	sysarg_t _mode;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_POLL_GET_MODE, period != NULL, &_mode);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		return rc;
-	}
-
-	*mode = (nic_poll_mode_t) _mode;
-
-	if (period != NULL)
-		rc = async_data_read_start(exch, period, sizeof(struct timespec));
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Set the interrupt/poll mode of the NIC.
- *
- * @param[in] dev_sess
- * @param[in] mode     New poll mode
- * @param[in] period   Period used in periodic polling. Can be NULL.
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_poll_set_mode(async_sess_t *dev_sess, nic_poll_mode_t mode,
-    const struct timespec *period)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t message_id = async_send_3(exch, DEV_IFACE_ID(NIC_DEV_IFACE),
-	    NIC_POLL_SET_MODE, (sysarg_t) mode, period != NULL, NULL);
-
-	errno_t rc;
-	if (period)
-		rc = async_data_write_start(exch, period, sizeof(struct timespec));
-	else
-		rc = EOK;
-
-	async_exchange_end(exch);
-
-	errno_t res;
-	async_wait_for(message_id, &res);
-
-	if (rc != EOK)
-		return rc;
-
-	return res;
-}
-
-/** Request the driver to poll the NIC.
- *
- * @param[in] dev_sess
- *
- * @return EOK If the operation was successfully completed
- *
- */
-errno_t nic_poll_now(async_sess_t *dev_sess)
-{
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-	errno_t rc = async_req_1_0(exch, DEV_IFACE_ID(NIC_DEV_IFACE), NIC_POLL_NOW);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-static void remote_nic_send_frame(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	assert(nic_iface->send_frame);
-
-	void *data;
-	size_t size;
-	errno_t rc;
-
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	rc = nic_iface->send_frame(dev, data, size);
-	async_answer_0(call, rc);
-	free(data);
-}
-
-static void remote_nic_callback_create(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	assert(nic_iface->callback_create);
-
-	errno_t rc = nic_iface->callback_create(dev);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_get_state(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	assert(nic_iface->get_state);
-
-	nic_device_state_t state = NIC_STATE_MAX;
-
-	errno_t rc = nic_iface->get_state(dev, &state);
-	async_answer_1(call, rc, state);
-}
-
-static void remote_nic_set_state(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	assert(nic_iface->set_state);
-
-	nic_device_state_t state = (nic_device_state_t) ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->set_state(dev, state);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_get_address(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	assert(nic_iface->get_address);
-
-	nic_address_t address;
-	memset(&address, 0, sizeof(nic_address_t));
-
-	errno_t rc = nic_iface->get_address(dev, &address);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t max_len;
-
-		/* All errors will be translated into EPARTY anyway */
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len != sizeof(nic_address_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&data, &address,
-		    sizeof(nic_address_t));
-	}
-
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_set_address(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	ipc_call_t data;
-	size_t length;
-	if (!async_data_write_receive(&data, &length)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (length > sizeof(nic_address_t)) {
-		async_answer_0(&data, ELIMIT);
-		async_answer_0(call, ELIMIT);
-		return;
-	}
-
-	nic_address_t address;
-	if (async_data_write_finalize(&data, &address, length) != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (nic_iface->set_address != NULL) {
-		errno_t rc = nic_iface->set_address(dev, &address);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-}
-
-static void remote_nic_get_stats(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->get_stats == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_device_stats_t stats;
-	memset(&stats, 0, sizeof(nic_device_stats_t));
-
-	errno_t rc = nic_iface->get_stats(dev, &stats);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t max_len;
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len < sizeof(nic_device_stats_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&data, &stats,
-		    sizeof(nic_device_stats_t));
-	}
-
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_get_device_info(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->get_device_info == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_device_info_t info;
-	memset(&info, 0, sizeof(nic_device_info_t));
-
-	errno_t rc = nic_iface->get_device_info(dev, &info);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t max_len;
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len < sizeof (nic_device_info_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&data, &info,
-		    sizeof(nic_device_info_t));
-	}
-
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_get_cable_state(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->get_cable_state == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_cable_state_t cs = NIC_CS_UNKNOWN;
-
-	errno_t rc = nic_iface->get_cable_state(dev, &cs);
-	async_answer_1(call, rc, (sysarg_t) cs);
-}
-
-static void remote_nic_get_operation_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->get_operation_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	int speed = 0;
-	nic_channel_mode_t duplex = NIC_CM_UNKNOWN;
-	nic_role_t role = NIC_ROLE_UNKNOWN;
-
-	errno_t rc = nic_iface->get_operation_mode(dev, &speed, &duplex, &role);
-	async_answer_3(call, rc, (sysarg_t) speed, (sysarg_t) duplex,
-	    (sysarg_t) role);
-}
-
-static void remote_nic_set_operation_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->set_operation_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	int speed = (int) ipc_get_arg2(call);
-	nic_channel_mode_t duplex = (nic_channel_mode_t) ipc_get_arg3(call);
-	nic_role_t role = (nic_role_t) ipc_get_arg4(call);
-
-	errno_t rc = nic_iface->set_operation_mode(dev, speed, duplex, role);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_autoneg_enable(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->autoneg_enable == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t advertisement = (uint32_t) ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->autoneg_enable(dev, advertisement);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_autoneg_disable(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->autoneg_disable == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	errno_t rc = nic_iface->autoneg_disable(dev);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_autoneg_probe(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->autoneg_probe == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t our_adv = 0;
-	uint32_t their_adv = 0;
-	nic_result_t result = NIC_RESULT_NOT_AVAILABLE;
-	nic_result_t their_result = NIC_RESULT_NOT_AVAILABLE;
-
-	errno_t rc = nic_iface->autoneg_probe(dev, &our_adv, &their_adv, &result,
-	    &their_result);
-	async_answer_4(call, rc, our_adv, their_adv, (sysarg_t) result,
-	    (sysarg_t) their_result);
-}
-
-static void remote_nic_autoneg_restart(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->autoneg_restart == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	errno_t rc = nic_iface->autoneg_restart(dev);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_get_pause(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->get_pause == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_result_t we_send;
-	nic_result_t we_receive;
-	uint16_t pause;
-
-	errno_t rc = nic_iface->get_pause(dev, &we_send, &we_receive, &pause);
-	async_answer_3(call, rc, we_send, we_receive, pause);
-}
-
-static void remote_nic_set_pause(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->set_pause == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	int allow_send = (int) ipc_get_arg2(call);
-	int allow_receive = (int) ipc_get_arg3(call);
-	uint16_t pause = (uint16_t) ipc_get_arg4(call);
-
-	errno_t rc = nic_iface->set_pause(dev, allow_send, allow_receive,
-	    pause);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_unicast_get_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->unicast_get_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t max_count = ipc_get_arg2(call);
-	nic_address_t *address_list = NULL;
-
-	if (max_count != 0) {
-		address_list = malloc(max_count * sizeof (nic_address_t));
-		if (!address_list) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(address_list, 0, max_count * sizeof(nic_address_t));
-	nic_unicast_mode_t mode = NIC_UNICAST_DEFAULT;
-	size_t address_count = 0;
-
-	errno_t rc = nic_iface->unicast_get_mode(dev, &mode, max_count, address_list,
-	    &address_count);
-
-	if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
-		free(address_list);
-		async_answer_2(call, rc, mode, address_count);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t max_len;
-	if (!async_data_read_receive(&data, &max_len)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_2(call, rc, mode, address_count);
-		free(address_list);
-		return;
-	}
-
-	if (max_len > address_count * sizeof(nic_address_t))
-		max_len = address_count * sizeof(nic_address_t);
-
-	if (max_len > max_count * sizeof(nic_address_t))
-		max_len = max_count * sizeof(nic_address_t);
-
-	async_data_read_finalize(&data, address_list, max_len);
-
-	free(address_list);
-	async_answer_2(call, rc, mode, address_count);
-}
-
-static void remote_nic_unicast_set_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	size_t length;
-	nic_unicast_mode_t mode = ipc_get_arg2(call);
-	size_t address_count = ipc_get_arg3(call);
-	nic_address_t *address_list = NULL;
-
-	if (address_count) {
-		ipc_call_t data;
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (length != address_count * sizeof(nic_address_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		address_list = malloc(length);
-		if (address_list == NULL) {
-			async_answer_0(&data, ENOMEM);
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-
-		if (async_data_write_finalize(&data, address_list,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			free(address_list);
-			return;
-		}
-	}
-
-	if (nic_iface->unicast_set_mode != NULL) {
-		errno_t rc = nic_iface->unicast_set_mode(dev, mode, address_list,
-		    address_count);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-
-	free(address_list);
-}
-
-static void remote_nic_multicast_get_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->multicast_get_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t max_count = ipc_get_arg2(call);
-	nic_address_t *address_list = NULL;
-
-	if (max_count != 0) {
-		address_list = malloc(max_count * sizeof(nic_address_t));
-		if (!address_list) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(address_list, 0, max_count * sizeof(nic_address_t));
-	nic_multicast_mode_t mode = NIC_MULTICAST_BLOCKED;
-	size_t address_count = 0;
-
-	errno_t rc = nic_iface->multicast_get_mode(dev, &mode, max_count, address_list,
-	    &address_count);
-
-	if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
-		free(address_list);
-		async_answer_2(call, rc, mode, address_count);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t max_len;
-	if (!async_data_read_receive(&data, &max_len)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_2(call, rc, mode, address_count);
-		free(address_list);
-		return;
-	}
-
-	if (max_len > address_count * sizeof(nic_address_t))
-		max_len = address_count * sizeof(nic_address_t);
-
-	if (max_len > max_count * sizeof(nic_address_t))
-		max_len = max_count * sizeof(nic_address_t);
-
-	async_data_read_finalize(&data, address_list, max_len);
-
-	free(address_list);
-	async_answer_2(call, rc, mode, address_count);
-}
-
-static void remote_nic_multicast_set_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	nic_multicast_mode_t mode = ipc_get_arg2(call);
-	size_t address_count = ipc_get_arg3(call);
-	nic_address_t *address_list = NULL;
-
-	if (address_count) {
-		ipc_call_t data;
-		size_t length;
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (length != address_count * sizeof (nic_address_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		address_list = malloc(length);
-		if (address_list == NULL) {
-			async_answer_0(&data, ENOMEM);
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-
-		if (async_data_write_finalize(&data, address_list,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			free(address_list);
-			return;
-		}
-	}
-
-	if (nic_iface->multicast_set_mode != NULL) {
-		errno_t rc = nic_iface->multicast_set_mode(dev, mode, address_list,
-		    address_count);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-
-	free(address_list);
-}
-
-static void remote_nic_broadcast_get_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->broadcast_get_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_broadcast_mode_t mode = NIC_BROADCAST_ACCEPTED;
-
-	errno_t rc = nic_iface->broadcast_get_mode(dev, &mode);
-	async_answer_1(call, rc, mode);
-}
-
-static void remote_nic_broadcast_set_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->broadcast_set_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_broadcast_mode_t mode = ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->broadcast_set_mode(dev, mode);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_defective_get_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->defective_get_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t mode = 0;
-
-	errno_t rc = nic_iface->defective_get_mode(dev, &mode);
-	async_answer_1(call, rc, mode);
-}
-
-static void remote_nic_defective_set_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->defective_set_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t mode = ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->defective_set_mode(dev, mode);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_blocked_sources_get(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->blocked_sources_get == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t max_count = ipc_get_arg2(call);
-	nic_address_t *address_list = NULL;
-
-	if (max_count != 0) {
-		address_list = malloc(max_count * sizeof(nic_address_t));
-		if (!address_list) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(address_list, 0, max_count * sizeof(nic_address_t));
-	size_t address_count = 0;
-
-	errno_t rc = nic_iface->blocked_sources_get(dev, max_count, address_list,
-	    &address_count);
-
-	if ((rc != EOK) || (max_count == 0) || (address_count == 0)) {
-		async_answer_1(call, rc, address_count);
-		free(address_list);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t max_len;
-	if (!async_data_read_receive(&data, &max_len)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_1(call, rc, address_count);
-		free(address_list);
-		return;
-	}
-
-	if (max_len > address_count * sizeof(nic_address_t))
-		max_len = address_count * sizeof(nic_address_t);
-
-	if (max_len > max_count * sizeof(nic_address_t))
-		max_len = max_count * sizeof(nic_address_t);
-
-	async_data_read_finalize(&data, address_list, max_len);
-
-	free(address_list);
-	async_answer_1(call, rc, address_count);
-}
-
-static void remote_nic_blocked_sources_set(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	size_t length;
-	size_t address_count = ipc_get_arg2(call);
-	nic_address_t *address_list = NULL;
-
-	if (address_count) {
-		ipc_call_t data;
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (length != address_count * sizeof(nic_address_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		address_list = malloc(length);
-		if (address_list == NULL) {
-			async_answer_0(&data, ENOMEM);
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-
-		if (async_data_write_finalize(&data, address_list,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			free(address_list);
-			return;
-		}
-	}
-
-	if (nic_iface->blocked_sources_set != NULL) {
-		errno_t rc = nic_iface->blocked_sources_set(dev, address_list,
-		    address_count);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-
-	free(address_list);
-}
-
-static void remote_nic_vlan_get_mask(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->vlan_get_mask == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_vlan_mask_t vlan_mask;
-	memset(&vlan_mask, 0, sizeof(nic_vlan_mask_t));
-
-	errno_t rc = nic_iface->vlan_get_mask(dev, &vlan_mask);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t max_len;
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len != sizeof(nic_vlan_mask_t)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		async_data_read_finalize(&data, &vlan_mask, max_len);
-	}
-
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_vlan_set_mask(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	nic_vlan_mask_t vlan_mask;
-	nic_vlan_mask_t *vlan_mask_pointer = NULL;
-	bool vlan_mask_set = (bool) ipc_get_arg2(call);
-
-	if (vlan_mask_set) {
-		ipc_call_t data;
-		size_t length;
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (length != sizeof(nic_vlan_mask_t)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		if (async_data_write_finalize(&data, &vlan_mask,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		vlan_mask_pointer = &vlan_mask;
-	}
-
-	if (nic_iface->vlan_set_mask != NULL) {
-		errno_t rc = nic_iface->vlan_set_mask(dev, vlan_mask_pointer);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-}
-
-static void remote_nic_vlan_set_tag(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	if (nic_iface->vlan_set_tag == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint16_t tag = (uint16_t) ipc_get_arg2(call);
-	bool add = (int) ipc_get_arg3(call);
-	bool strip = (int) ipc_get_arg4(call);
-
-	errno_t rc = nic_iface->vlan_set_tag(dev, tag, add, strip);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_wol_virtue_add(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	int send_data = (int) ipc_get_arg3(call);
-	ipc_call_t data;
-
-	if (nic_iface->wol_virtue_add == NULL) {
-		if (send_data) {
-			async_data_write_receive(&data, NULL);
-			async_answer_0(&data, ENOTSUP);
-		}
-
-		async_answer_0(call, ENOTSUP);
-	}
-
-	size_t length = 0;
-	void *virtue = NULL;
-
-	if (send_data) {
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		virtue = malloc(length);
-		if (virtue == NULL) {
-			async_answer_0(&data, ENOMEM);
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-
-		if (async_data_write_finalize(&data, virtue,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			free(virtue);
-			return;
-		}
-	}
-
-	nic_wv_id_t id = 0;
-	nic_wv_type_t type = (nic_wv_type_t) ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->wol_virtue_add(dev, type, virtue, length, &id);
-	async_answer_1(call, rc, (sysarg_t) id);
-	free(virtue);
-}
-
-static void remote_nic_wol_virtue_remove(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	if (nic_iface->wol_virtue_remove == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_wv_id_t id = (nic_wv_id_t) ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->wol_virtue_remove(dev, id);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_wol_virtue_probe(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	if (nic_iface->wol_virtue_probe == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_wv_id_t id = (nic_wv_id_t) ipc_get_arg2(call);
-	size_t max_length = ipc_get_arg3(call);
-	nic_wv_type_t type = NIC_WV_NONE;
-	size_t length = 0;
-	ipc_call_t data;
-	void *virtue = NULL;
-
-	if (max_length != 0) {
-		virtue = malloc(max_length);
-		if (virtue == NULL) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(virtue, 0, max_length);
-
-	errno_t rc = nic_iface->wol_virtue_probe(dev, id, &type, max_length,
-	    virtue, &length);
-
-	if ((max_length != 0) && (length != 0)) {
-		size_t req_length;
-		if (!async_data_read_receive(&data, &req_length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			free(virtue);
-			return;
-		}
-
-		if (req_length > length)
-			req_length = length;
-
-		if (req_length > max_length)
-			req_length = max_length;
-
-		async_data_read_finalize(&data, virtue, req_length);
-	}
-
-	async_answer_2(call, rc, (sysarg_t) type, (sysarg_t) length);
-	free(virtue);
-}
-
-static void remote_nic_wol_virtue_list(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->wol_virtue_list == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_wv_type_t type = (nic_wv_type_t) ipc_get_arg2(call);
-	size_t max_count = ipc_get_arg3(call);
-	size_t count = 0;
-	nic_wv_id_t *id_list = NULL;
-	ipc_call_t data;
-
-	if (max_count != 0) {
-		id_list = malloc(max_count * sizeof(nic_wv_id_t));
-		if (id_list == NULL) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(id_list, 0, max_count * sizeof (nic_wv_id_t));
-
-	errno_t rc = nic_iface->wol_virtue_list(dev, type, max_count, id_list,
-	    &count);
-
-	if ((max_count != 0) && (count != 0)) {
-		size_t req_length;
-		if (!async_data_read_receive(&data, &req_length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			free(id_list);
-			return;
-		}
-
-		if (req_length > count * sizeof(nic_wv_id_t))
-			req_length = count * sizeof(nic_wv_id_t);
-
-		if (req_length > max_count * sizeof(nic_wv_id_t))
-			req_length = max_count * sizeof(nic_wv_id_t);
-
-		rc = async_data_read_finalize(&data, id_list, req_length);
-	}
-
-	async_answer_1(call, rc, (sysarg_t) count);
-	free(id_list);
-}
-
-static void remote_nic_wol_virtue_get_caps(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->wol_virtue_get_caps == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	int count = -1;
-	nic_wv_type_t type = (nic_wv_type_t) ipc_get_arg2(call);
-
-	errno_t rc = nic_iface->wol_virtue_get_caps(dev, type, &count);
-	async_answer_1(call, rc, (sysarg_t) count);
-}
-
-static void remote_nic_wol_load_info(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->wol_load_info == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t max_length = (size_t) ipc_get_arg2(call);
-	size_t frame_length = 0;
-	nic_wv_type_t type = NIC_WV_NONE;
-	uint8_t *info = NULL;
-
-	if (max_length != 0) {
-		info = malloc(max_length);
-		if (info == NULL) {
-			async_answer_0(call, ENOMEM);
-			return;
-		}
-	}
-
-	memset(info, 0, max_length);
-
-	errno_t rc = nic_iface->wol_load_info(dev, &type, max_length, info,
-	    &frame_length);
-	if (rc == EOK) {
-		ipc_call_t data;
-		size_t req_length;
-		if (!async_data_read_receive(&data, &req_length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			free(info);
-			return;
-		}
-
-		req_length = req_length > max_length ? max_length : req_length;
-		req_length = req_length > frame_length ? frame_length : req_length;
-		async_data_read_finalize(&data, info, req_length);
-	}
-
-	async_answer_2(call, rc, (sysarg_t) type, (sysarg_t) frame_length);
-	free(info);
-}
-
-static void remote_nic_offload_probe(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->offload_probe == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t supported = 0;
-	uint32_t active = 0;
-
-	errno_t rc = nic_iface->offload_probe(dev, &supported, &active);
-	async_answer_2(call, rc, supported, active);
-}
-
-static void remote_nic_offload_set(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->offload_set == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	uint32_t mask = (uint32_t) ipc_get_arg2(call);
-	uint32_t active = (uint32_t) ipc_get_arg3(call);
-
-	errno_t rc = nic_iface->offload_set(dev, mask, active);
-	async_answer_0(call, rc);
-}
-
-static void remote_nic_poll_get_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->poll_get_mode == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	nic_poll_mode_t mode = NIC_POLL_IMMEDIATE;
-	int request_data = ipc_get_arg2(call);
-	struct timespec period = {
-		.tv_sec = 0,
-		.tv_nsec = 0
-	};
-
-	errno_t rc = nic_iface->poll_get_mode(dev, &mode, &period);
-	if ((rc == EOK) && (request_data)) {
-		ipc_call_t data;
-		size_t max_len;
-
-		if (!async_data_read_receive(&data, &max_len)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (max_len != sizeof(struct timespec)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		async_data_read_finalize(&data, &period,
-		    sizeof(struct timespec));
-	}
-
-	async_answer_1(call, rc, (sysarg_t) mode);
-}
-
-static void remote_nic_poll_set_mode(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-
-	nic_poll_mode_t mode = ipc_get_arg2(call);
-	int has_period = ipc_get_arg3(call);
-	struct timespec period_buf;
-	struct timespec *period = NULL;
-	size_t length;
-
-	if (has_period) {
-		ipc_call_t data;
-		if (!async_data_write_receive(&data, &length)) {
-			async_answer_0(&data, EINVAL);
-			async_answer_0(call, EINVAL);
-			return;
-		}
-
-		if (length != sizeof(struct timespec)) {
-			async_answer_0(&data, ELIMIT);
-			async_answer_0(call, ELIMIT);
-			return;
-		}
-
-		period = &period_buf;
-		if (async_data_write_finalize(&data, period,
-		    length) != EOK) {
-			async_answer_0(call, EINVAL);
-			return;
-		}
-	}
-
-	if (nic_iface->poll_set_mode != NULL) {
-		errno_t rc = nic_iface->poll_set_mode(dev, mode, period);
-		async_answer_0(call, rc);
-	} else
-		async_answer_0(call, ENOTSUP);
-}
-
-static void remote_nic_poll_now(ddf_fun_t *dev, void *iface,
-    ipc_call_t *call)
-{
-	nic_iface_t *nic_iface = (nic_iface_t *) iface;
-	if (nic_iface->poll_now == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	errno_t rc = nic_iface->poll_now(dev);
-	async_answer_0(call, rc);
-}
-
-/** Remote NIC interface operations.
- *
- */
-static const remote_iface_func_ptr_t remote_nic_iface_ops[] = {
-	[NIC_SEND_MESSAGE] = remote_nic_send_frame,
-	[NIC_CALLBACK_CREATE] = remote_nic_callback_create,
-	[NIC_GET_STATE] = remote_nic_get_state,
-	[NIC_SET_STATE] = remote_nic_set_state,
-	[NIC_GET_ADDRESS] = remote_nic_get_address,
-	[NIC_SET_ADDRESS] = remote_nic_set_address,
-	[NIC_GET_STATS] = remote_nic_get_stats,
-	[NIC_GET_DEVICE_INFO] = remote_nic_get_device_info,
-	[NIC_GET_CABLE_STATE] = remote_nic_get_cable_state,
-	[NIC_GET_OPERATION_MODE] = remote_nic_get_operation_mode,
-	[NIC_SET_OPERATION_MODE] = remote_nic_set_operation_mode,
-	[NIC_AUTONEG_ENABLE] = remote_nic_autoneg_enable,
-	[NIC_AUTONEG_DISABLE] = remote_nic_autoneg_disable,
-	[NIC_AUTONEG_PROBE] = remote_nic_autoneg_probe,
-	[NIC_AUTONEG_RESTART] = remote_nic_autoneg_restart,
-	[NIC_GET_PAUSE] = remote_nic_get_pause,
-	[NIC_SET_PAUSE] = remote_nic_set_pause,
-	[NIC_UNICAST_GET_MODE] = remote_nic_unicast_get_mode,
-	[NIC_UNICAST_SET_MODE] = remote_nic_unicast_set_mode,
-	[NIC_MULTICAST_GET_MODE] = remote_nic_multicast_get_mode,
-	[NIC_MULTICAST_SET_MODE] = remote_nic_multicast_set_mode,
-	[NIC_BROADCAST_GET_MODE] = remote_nic_broadcast_get_mode,
-	[NIC_BROADCAST_SET_MODE] = remote_nic_broadcast_set_mode,
-	[NIC_DEFECTIVE_GET_MODE] = remote_nic_defective_get_mode,
-	[NIC_DEFECTIVE_SET_MODE] = remote_nic_defective_set_mode,
-	[NIC_BLOCKED_SOURCES_GET] = remote_nic_blocked_sources_get,
-	[NIC_BLOCKED_SOURCES_SET] = remote_nic_blocked_sources_set,
-	[NIC_VLAN_GET_MASK] = remote_nic_vlan_get_mask,
-	[NIC_VLAN_SET_MASK] = remote_nic_vlan_set_mask,
-	[NIC_VLAN_SET_TAG] = remote_nic_vlan_set_tag,
-	[NIC_WOL_VIRTUE_ADD] = remote_nic_wol_virtue_add,
-	[NIC_WOL_VIRTUE_REMOVE] = remote_nic_wol_virtue_remove,
-	[NIC_WOL_VIRTUE_PROBE] = remote_nic_wol_virtue_probe,
-	[NIC_WOL_VIRTUE_LIST] = remote_nic_wol_virtue_list,
-	[NIC_WOL_VIRTUE_GET_CAPS] = remote_nic_wol_virtue_get_caps,
-	[NIC_WOL_LOAD_INFO] = remote_nic_wol_load_info,
-	[NIC_OFFLOAD_PROBE] = remote_nic_offload_probe,
-	[NIC_OFFLOAD_SET] = remote_nic_offload_set,
-	[NIC_POLL_GET_MODE] = remote_nic_poll_get_mode,
-	[NIC_POLL_SET_MODE] = remote_nic_poll_set_mode,
-	[NIC_POLL_NOW] = remote_nic_poll_now
-};
-
-/** Remote NIC interface structure.
- *
- * Interface for processing request from remote
- * clients addressed to the NIC interface.
- *
- */
-const remote_iface_t remote_nic_iface = {
-	.method_count = ARRAY_SIZE(remote_nic_iface_ops),
-	.methods = remote_nic_iface_ops
-};
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_pci.c
===================================================================
--- uspace/lib/drv/generic/remote_pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-
-#include "pci_dev_iface.h"
-#include "ddf/driver.h"
-
-typedef enum {
-	IPC_M_CONFIG_SPACE_READ_8,
-	IPC_M_CONFIG_SPACE_READ_16,
-	IPC_M_CONFIG_SPACE_READ_32,
-
-	IPC_M_CONFIG_SPACE_WRITE_8,
-	IPC_M_CONFIG_SPACE_WRITE_16,
-	IPC_M_CONFIG_SPACE_WRITE_32
-} pci_dev_iface_funcs_t;
-
-errno_t pci_config_space_read_8(async_sess_t *sess, uint32_t address, uint8_t *val)
-{
-	sysarg_t res = 0;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_READ_8, address, &res);
-	async_exchange_end(exch);
-
-	*val = (uint8_t) res;
-	return rc;
-}
-
-errno_t pci_config_space_read_16(async_sess_t *sess, uint32_t address,
-    uint16_t *val)
-{
-	sysarg_t res = 0;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_READ_16, address, &res);
-	async_exchange_end(exch);
-
-	*val = (uint16_t) res;
-	return rc;
-}
-
-errno_t pci_config_space_read_32(async_sess_t *sess, uint32_t address,
-    uint32_t *val)
-{
-	sysarg_t res = 0;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_2_1(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_READ_32, address, &res);
-	async_exchange_end(exch);
-
-	*val = (uint32_t) res;
-	return rc;
-}
-
-errno_t pci_config_space_write_8(async_sess_t *sess, uint32_t address, uint8_t val)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_WRITE_8, address, val);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t pci_config_space_write_16(async_sess_t *sess, uint32_t address,
-    uint16_t val)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_WRITE_16, address, val);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t pci_config_space_write_32(async_sess_t *sess, uint32_t address,
-    uint32_t val)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t rc = async_req_3_0(exch, DEV_IFACE_ID(PCI_DEV_IFACE),
-	    IPC_M_CONFIG_SPACE_WRITE_32, address, val);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-static void remote_config_space_read_8(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_config_space_read_16(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_config_space_read_32(ddf_fun_t *, void *, ipc_call_t *);
-
-static void remote_config_space_write_8(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_config_space_write_16(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_config_space_write_32(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote USB interface operations. */
-static const remote_iface_func_ptr_t remote_pci_iface_ops [] = {
-	[IPC_M_CONFIG_SPACE_READ_8] = remote_config_space_read_8,
-	[IPC_M_CONFIG_SPACE_READ_16] = remote_config_space_read_16,
-	[IPC_M_CONFIG_SPACE_READ_32] = remote_config_space_read_32,
-
-	[IPC_M_CONFIG_SPACE_WRITE_8] = remote_config_space_write_8,
-	[IPC_M_CONFIG_SPACE_WRITE_16] = remote_config_space_write_16,
-	[IPC_M_CONFIG_SPACE_WRITE_32] = remote_config_space_write_32
-};
-
-/** Remote USB interface structure.
- */
-const remote_iface_t remote_pci_iface = {
-	.method_count = ARRAY_SIZE(remote_pci_iface_ops),
-	.methods = remote_pci_iface_ops
-};
-
-void remote_config_space_read_8(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_read_8 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint8_t value;
-	errno_t ret = pci_iface->config_space_read_8(fun, address, &value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_1(call, EOK, value);
-	}
-}
-
-void remote_config_space_read_16(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_read_16 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint16_t value;
-	errno_t ret = pci_iface->config_space_read_16(fun, address, &value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_1(call, EOK, value);
-	}
-}
-void remote_config_space_read_32(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_read_32 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint32_t value;
-	errno_t ret = pci_iface->config_space_read_32(fun, address, &value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_1(call, EOK, value);
-	}
-}
-
-void remote_config_space_write_8(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_write_8 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint8_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_8(fun, address, value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_0(call, EOK);
-	}
-}
-
-void remote_config_space_write_16(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_write_16 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint16_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_16(fun, address, value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_0(call, EOK);
-	}
-}
-
-void remote_config_space_write_32(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(iface);
-	pci_dev_iface_t *pci_iface = (pci_dev_iface_t *)iface;
-	if (pci_iface->config_space_write_32 == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-	uint32_t address = DEV_IPC_GET_ARG1(*call);
-	uint32_t value = DEV_IPC_GET_ARG2(*call);
-	errno_t ret = pci_iface->config_space_write_32(fun, address, value);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_0(call, EOK);
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_pio_window.c
===================================================================
--- uspace/lib/drv/generic/remote_pio_window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-
-#include "ops/pio_window.h"
-#include "ddf/driver.h"
-
-static void remote_pio_window_get(ddf_fun_t *, void *, ipc_call_t *);
-
-static const remote_iface_func_ptr_t remote_pio_window_iface_ops [] = {
-	[PIO_WINDOW_GET] = &remote_pio_window_get
-};
-
-const remote_iface_t remote_pio_window_iface = {
-	.method_count = ARRAY_SIZE(remote_pio_window_iface_ops),
-	.methods = remote_pio_window_iface_ops
-};
-
-static void remote_pio_window_get(ddf_fun_t *fun, void *ops,
-    ipc_call_t *call)
-{
-	pio_window_ops_t *pio_win_ops = (pio_window_ops_t *) ops;
-
-	if (!pio_win_ops->get_pio_window) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	pio_window_t *pio_window = pio_win_ops->get_pio_window(fun);
-	if (!pio_window) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	async_answer_0(call, EOK);
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_read_receive(&data, &len)) {
-		/* Protocol error - the recipient is not accepting data */
-		return;
-	}
-
-	async_data_read_finalize(&data, pio_window, len);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_usb.c
===================================================================
--- uspace/lib/drv/generic/remote_usb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Michal Staruch, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <assert.h>
-#include <macros.h>
-#include <errno.h>
-#include <devman.h>
-
-#include "usb_iface.h"
-#include "ddf/driver.h"
-
-usb_dev_session_t *usb_dev_connect(devman_handle_t handle)
-{
-	return devman_device_connect(handle, IPC_FLAG_BLOCKING);
-}
-
-usb_dev_session_t *usb_dev_connect_to_self(ddf_dev_t *dev)
-{
-	return devman_parent_device_connect(ddf_dev_get_handle(dev),
-	    IPC_FLAG_BLOCKING);
-}
-
-void usb_dev_disconnect(usb_dev_session_t *sess)
-{
-	if (sess)
-		async_hangup(sess);
-}
-
-typedef enum {
-	IPC_M_USB_GET_MY_DESCRIPTION,
-} usb_iface_funcs_t;
-
-/** Tell interface number given device can use.
- * @param[in] exch IPC communication exchange
- * @param[in] handle Id of the device
- * @param[out] usb_iface Assigned USB interface
- * @return Error code.
- */
-errno_t usb_get_my_description(async_exch_t *exch, usb_device_desc_t *desc)
-{
-	if (!exch)
-		return EBADMEM;
-
-	sysarg_t address, depth, speed, handle, iface;
-
-	const errno_t ret = async_req_1_5(exch, DEV_IFACE_ID(USB_DEV_IFACE),
-	    IPC_M_USB_GET_MY_DESCRIPTION, &address, &depth, &speed, &handle,
-	    &iface);
-	if (ret == EOK && desc) {
-		*desc = (usb_device_desc_t) {
-			.address = address,
-			.depth = depth,
-			.speed = speed,
-			.handle = handle,
-			.iface = iface,
-		};
-	}
-
-	return ret;
-}
-
-static void remote_usb_get_my_description(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote USB interface operations. */
-static const remote_iface_func_ptr_t remote_usb_iface_ops [] = {
-	[IPC_M_USB_GET_MY_DESCRIPTION] = remote_usb_get_my_description,
-};
-
-/** Remote USB interface structure.
- */
-const remote_iface_t remote_usb_iface = {
-	.method_count = ARRAY_SIZE(remote_usb_iface_ops),
-	.methods = remote_usb_iface_ops,
-};
-
-void remote_usb_get_my_description(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const usb_iface_t *usb_iface = (usb_iface_t *) iface;
-
-	if (usb_iface->get_my_description == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	usb_device_desc_t desc;
-	const errno_t ret = usb_iface->get_my_description(fun, &desc);
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-	} else {
-		async_answer_5(call, EOK,
-		    (sysarg_t) desc.address,
-		    (sysarg_t) desc.depth,
-		    (sysarg_t) desc.speed,
-		    desc.handle,
-		    desc.iface);
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_usbdiag.c
===================================================================
--- uspace/lib/drv/generic/remote_usbdiag.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,251 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- * USB diagnostic device remote interface.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <macros.h>
-#include <errno.h>
-#include <devman.h>
-
-#include "usbdiag_iface.h"
-
-typedef enum {
-	IPC_M_USBDIAG_TEST_IN,
-	IPC_M_USBDIAG_TEST_OUT,
-} usb_iface_funcs_t;
-
-async_sess_t *usbdiag_connect(devman_handle_t handle)
-{
-	return devman_device_connect(handle, IPC_FLAG_BLOCKING);
-}
-
-void usbdiag_disconnect(async_sess_t *sess)
-{
-	if (sess)
-		async_hangup(sess);
-}
-
-errno_t usbdiag_test_in(async_exch_t *exch,
-    const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	if (!exch)
-		return EBADMEM;
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE),
-	    IPC_M_USBDIAG_TEST_IN, &answer);
-
-	errno_t rc = async_data_write_start(exch, params,
-	    sizeof(usbdiag_test_params_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, results,
-	    sizeof(usbdiag_test_results_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return (errno_t) retval;
-}
-
-errno_t usbdiag_test_out(async_exch_t *exch,
-    const usbdiag_test_params_t *params, usbdiag_test_results_t *results)
-{
-	if (!exch)
-		return EBADMEM;
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE),
-	    IPC_M_USBDIAG_TEST_OUT, &answer);
-
-	errno_t rc = async_data_write_start(exch, params,
-	    sizeof(usbdiag_test_params_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, results,
-	    sizeof(usbdiag_test_results_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return (errno_t) retval;
-}
-
-static void remote_usbdiag_test_in(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbdiag_test_out(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote USB diagnostic interface operations. */
-static const remote_iface_func_ptr_t remote_usbdiag_iface_ops [] = {
-	[IPC_M_USBDIAG_TEST_IN] = remote_usbdiag_test_in,
-	[IPC_M_USBDIAG_TEST_OUT] = remote_usbdiag_test_out
-};
-
-/** Remote USB diagnostic interface structure. */
-const remote_iface_t remote_usbdiag_iface = {
-	.method_count = ARRAY_SIZE(remote_usbdiag_iface_ops),
-	.methods = remote_usbdiag_iface_ops,
-};
-
-void remote_usbdiag_test_in(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
-
-	ipc_call_t data;
-	size_t size;
-	if (!async_data_write_receive(&data, &size)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(usbdiag_test_params_t)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	usbdiag_test_params_t params;
-	if (async_data_write_finalize(&data, &params, size) != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	usbdiag_test_results_t results;
-	const errno_t ret = !diag_iface->test_in ? ENOTSUP :
-	    diag_iface->test_in(fun, &params, &results);
-
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-		return;
-	}
-
-	if (!async_data_read_receive(&data, &size)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(usbdiag_test_results_t)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (async_data_read_finalize(&data, &results, size) != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	async_answer_0(call, ret);
-}
-
-void remote_usbdiag_test_out(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
-
-	ipc_call_t data;
-	size_t size;
-	if (!async_data_write_receive(&data, &size)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(usbdiag_test_params_t)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	usbdiag_test_params_t params;
-	if (async_data_write_finalize(&data, &params, size) != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	usbdiag_test_results_t results;
-	const errno_t ret = !diag_iface->test_out ? ENOTSUP :
-	    diag_iface->test_out(fun, &params, &results);
-
-	if (ret != EOK) {
-		async_answer_0(call, ret);
-		return;
-	}
-
-	if (!async_data_read_receive(&data, &size)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(usbdiag_test_results_t)) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (async_data_read_finalize(&data, &results, size) != EOK) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	async_answer_0(call, ret);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_usbhc.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,502 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <macros.h>
-#include <errno.h>
-#include <devman.h>
-#include <as.h>
-
-#include "usbhc_iface.h"
-#include "ddf/driver.h"
-
-typedef enum {
-	IPC_M_USB_DEFAULT_ADDRESS_RESERVATION,
-	IPC_M_USB_DEVICE_ENUMERATE,
-	IPC_M_USB_DEVICE_REMOVE,
-	IPC_M_USB_REGISTER_ENDPOINT,
-	IPC_M_USB_UNREGISTER_ENDPOINT,
-	IPC_M_USB_TRANSFER,
-} usbhc_iface_funcs_t;
-
-/** Reserve default USB address.
- * @param[in] exch IPC communication exchange
- * @return Error code.
- */
-errno_t usbhc_reserve_default_address(async_exch_t *exch)
-{
-	if (!exch)
-		return EBADMEM;
-	return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_DEFAULT_ADDRESS_RESERVATION, true);
-}
-
-/** Release default USB address.
- *
- * @param[in] exch IPC communication exchange
- *
- * @return Error code.
- */
-errno_t usbhc_release_default_address(async_exch_t *exch)
-{
-	if (!exch)
-		return EBADMEM;
-	return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_DEFAULT_ADDRESS_RESERVATION, false);
-}
-
-/**
- * Trigger USB device enumeration
- *
- * @param[in] exch IPC communication exchange
- * @param[in] port Port number at which the device is attached
- * @param[in] speed Communication speed of the newly attached device
- *
- * @return Error code.
- */
-errno_t usbhc_device_enumerate(async_exch_t *exch, unsigned port, usb_speed_t speed)
-{
-	if (!exch)
-		return EBADMEM;
-	const errno_t ret = async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
-	    IPC_M_USB_DEVICE_ENUMERATE, port, speed);
-	return ret;
-}
-
-/** Trigger USB device enumeration
- *
- * @param[in] exch   IPC communication exchange
- * @param[in] handle Identifier of the device
- *
- * @return Error code.
- *
- */
-errno_t usbhc_device_remove(async_exch_t *exch, unsigned port)
-{
-	if (!exch)
-		return EBADMEM;
-	return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
-	    IPC_M_USB_DEVICE_REMOVE, port);
-}
-
-errno_t usbhc_register_endpoint(async_exch_t *exch, usb_pipe_desc_t *pipe_desc,
-    const usb_endpoint_descriptors_t *desc)
-{
-	if (!exch)
-		return EBADMEM;
-
-	if (!desc)
-		return EINVAL;
-
-	aid_t opening_request = async_send_1(exch,
-	    DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_REGISTER_ENDPOINT, NULL);
-
-	if (opening_request == 0) {
-		return ENOMEM;
-	}
-
-	errno_t ret = async_data_write_start(exch, desc, sizeof(*desc));
-	if (ret != EOK) {
-		async_forget(opening_request);
-		return ret;
-	}
-
-	/* Wait for the answer. */
-	errno_t opening_request_rc;
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (opening_request_rc)
-		return (errno_t) opening_request_rc;
-
-	usb_pipe_desc_t dest;
-	ret = async_data_read_start(exch, &dest, sizeof(dest));
-	if (ret != EOK) {
-		return ret;
-	}
-
-	if (pipe_desc)
-		*pipe_desc = dest;
-
-	return EOK;
-}
-
-errno_t usbhc_unregister_endpoint(async_exch_t *exch, const usb_pipe_desc_t *pipe_desc)
-{
-	if (!exch)
-		return EBADMEM;
-
-	aid_t opening_request = async_send_1(exch,
-	    DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USB_UNREGISTER_ENDPOINT, NULL);
-
-	if (opening_request == 0) {
-		return ENOMEM;
-	}
-
-	const errno_t ret = async_data_write_start(exch, pipe_desc, sizeof(*pipe_desc));
-	if (ret != EOK) {
-		async_forget(opening_request);
-		return ret;
-	}
-
-	/* Wait for the answer. */
-	errno_t opening_request_rc;
-	async_wait_for(opening_request, &opening_request_rc);
-
-	return (errno_t) opening_request_rc;
-}
-
-/**
- * Issue a USB transfer with a data contained in memory area. That area is
- * temporarily shared with the HC.
- */
-errno_t usbhc_transfer(async_exch_t *exch,
-    const usbhc_iface_transfer_request_t *req, size_t *transferred)
-{
-	if (transferred)
-		*transferred = 0;
-
-	if (!exch)
-		return EBADMEM;
-
-	ipc_call_t call;
-
-	aid_t opening_request = async_send_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
-	    IPC_M_USB_TRANSFER, &call);
-
-	if (opening_request == 0)
-		return ENOMEM;
-
-	const errno_t ret = async_data_write_start(exch, req, sizeof(*req));
-	if (ret != EOK) {
-		async_forget(opening_request);
-		return ret;
-	}
-
-	/* Share the data, if any. */
-	if (req->size > 0) {
-		unsigned flags = (req->dir == USB_DIRECTION_IN) ?
-		    AS_AREA_WRITE : AS_AREA_READ;
-
-		const errno_t ret = async_share_out_start(exch, req->buffer.virt, flags);
-		if (ret != EOK) {
-			async_forget(opening_request);
-			return ret;
-		}
-	}
-
-	/* Wait for the answer. */
-	errno_t opening_request_rc;
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (transferred)
-		*transferred = ipc_get_arg1(&call);
-
-	return (errno_t) opening_request_rc;
-}
-
-static void remote_usbhc_default_address_reservation(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhc_device_enumerate(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhc_device_remove(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, ipc_call_t *call);
-
-/** Remote USB interface operations. */
-static const remote_iface_func_ptr_t remote_usbhc_iface_ops [] = {
-	[IPC_M_USB_DEFAULT_ADDRESS_RESERVATION] = remote_usbhc_default_address_reservation,
-	[IPC_M_USB_DEVICE_ENUMERATE] = remote_usbhc_device_enumerate,
-	[IPC_M_USB_DEVICE_REMOVE] = remote_usbhc_device_remove,
-	[IPC_M_USB_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
-	[IPC_M_USB_UNREGISTER_ENDPOINT] = remote_usbhc_unregister_endpoint,
-	[IPC_M_USB_TRANSFER] = remote_usbhc_transfer,
-};
-
-/** Remote USB interface structure.
- */
-const remote_iface_t remote_usbhc_iface = {
-	.method_count = ARRAY_SIZE(remote_usbhc_iface_ops),
-	.methods = remote_usbhc_iface_ops,
-};
-
-typedef struct {
-	ipc_call_t call;
-	usbhc_iface_transfer_request_t request;
-} async_transaction_t;
-
-void remote_usbhc_default_address_reservation(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
-
-	if (usbhc_iface->default_address_reservation == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const bool reserve = ipc_get_arg2(call);
-	const errno_t ret = usbhc_iface->default_address_reservation(fun, reserve);
-	async_answer_0(call, ret);
-}
-
-static void remote_usbhc_device_enumerate(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
-
-	if (usbhc_iface->device_enumerate == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const unsigned port = DEV_IPC_GET_ARG1(*call);
-	usb_speed_t speed = DEV_IPC_GET_ARG2(*call);
-	const errno_t ret = usbhc_iface->device_enumerate(fun, port, speed);
-	async_answer_0(call, ret);
-}
-
-static void remote_usbhc_device_remove(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
-
-	if (usbhc_iface->device_remove == NULL) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	const unsigned port = DEV_IPC_GET_ARG1(*call);
-	const errno_t ret = usbhc_iface->device_remove(fun, port);
-	async_answer_0(call, ret);
-}
-
-static void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	assert(fun);
-	assert(iface);
-	assert(call);
-
-	const usbhc_iface_t *usbhc_iface = iface;
-
-	if (!usbhc_iface->register_endpoint) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	usb_endpoint_descriptors_t ep_desc;
-	ipc_call_t data;
-	size_t len;
-
-	if (!async_data_write_receive(&data, &len) ||
-	    len != sizeof(ep_desc)) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	async_data_write_finalize(&data, &ep_desc, sizeof(ep_desc));
-
-	usb_pipe_desc_t pipe_desc;
-
-	const errno_t rc = usbhc_iface->register_endpoint(fun, &pipe_desc, &ep_desc);
-	async_answer_0(call, rc);
-
-	if (!async_data_read_receive(&data, &len) ||
-	    len != sizeof(pipe_desc)) {
-		return;
-	}
-	async_data_read_finalize(&data, &pipe_desc, sizeof(pipe_desc));
-}
-
-static void remote_usbhc_unregister_endpoint(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	assert(fun);
-	assert(iface);
-	assert(call);
-
-	const usbhc_iface_t *usbhc_iface = iface;
-
-	if (!usbhc_iface->unregister_endpoint) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	usb_pipe_desc_t pipe_desc;
-	ipc_call_t data;
-	size_t len;
-
-	if (!async_data_write_receive(&data, &len) ||
-	    len != sizeof(pipe_desc)) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-	async_data_write_finalize(&data, &pipe_desc, sizeof(pipe_desc));
-
-	const errno_t rc = usbhc_iface->unregister_endpoint(fun, &pipe_desc);
-	async_answer_0(call, rc);
-}
-
-static void async_transaction_destroy(async_transaction_t *trans)
-{
-	if (trans == NULL) {
-		return;
-	}
-	if (trans->request.buffer.virt != NULL) {
-		as_area_destroy(trans->request.buffer.virt);
-	}
-
-	free(trans);
-}
-
-static async_transaction_t *async_transaction_create(ipc_call_t *call)
-{
-	async_transaction_t *trans = calloc(1, sizeof(async_transaction_t));
-
-	if (trans != NULL)
-		trans->call = *call;
-
-	return trans;
-}
-
-static errno_t transfer_finished(void *arg, errno_t error, size_t transferred_size)
-{
-	async_transaction_t *trans = arg;
-	const errno_t err = async_answer_1(&trans->call, error, transferred_size);
-	async_transaction_destroy(trans);
-	return err;
-}
-
-static errno_t receive_memory_buffer(async_transaction_t *trans)
-{
-	assert(trans);
-	assert(trans->request.size > 0);
-
-	const size_t required_size = trans->request.offset + trans->request.size;
-	const unsigned required_flags =
-	    (trans->request.dir == USB_DIRECTION_IN) ?
-	    AS_AREA_WRITE : AS_AREA_READ;
-
-	errno_t err;
-	ipc_call_t data;
-	size_t size;
-	unsigned flags;
-
-	if (!async_share_out_receive(&data, &size, &flags))
-		return EPARTY;
-
-	if (size < required_size || (flags & required_flags) != required_flags) {
-		async_answer_0(&data, EINVAL);
-		return EINVAL;
-	}
-
-	if ((err = async_share_out_finalize(&data, &trans->request.buffer.virt)))
-		return err;
-
-	/*
-	 * As we're going to get physical addresses of the mapping, we must make
-	 * sure the memory is actually mapped. We must do it right now, because
-	 * the area might be read-only or write-only, and we may be unsure
-	 * later.
-	 */
-	if (flags & AS_AREA_READ) {
-		char foo = 0;
-		volatile const char *buf = trans->request.buffer.virt + trans->request.offset;
-		for (size_t i = 0; i < size; i += PAGE_SIZE)
-			foo += buf[i];
-	} else {
-		volatile char *buf = trans->request.buffer.virt + trans->request.offset;
-		for (size_t i = 0; i < size; i += PAGE_SIZE)
-			buf[i] = 0xff;
-	}
-
-	return EOK;
-}
-
-void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, ipc_call_t *call)
-{
-	assert(fun);
-	assert(iface);
-	assert(call);
-
-	const usbhc_iface_t *usbhc_iface = iface;
-
-	if (!usbhc_iface->transfer) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	async_transaction_t *trans =
-	    async_transaction_create(call);
-	if (trans == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	errno_t err = EPARTY;
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_write_receive(&data, &len) ||
-	    len != sizeof(trans->request)) {
-		async_answer_0(&data, EINVAL);
-		goto err;
-	}
-
-	if ((err = async_data_write_finalize(&data,
-	    &trans->request, sizeof(trans->request))))
-		goto err;
-
-	if (trans->request.size > 0) {
-		if ((err = receive_memory_buffer(trans)))
-			goto err;
-	} else {
-		/* The value was valid on the other side, for us, its garbage. */
-		trans->request.buffer.virt = NULL;
-	}
-
-	if ((err = usbhc_iface->transfer(fun, &trans->request,
-	    &transfer_finished, trans)))
-		goto err;
-
-	/* The call will be answered asynchronously by the callback. */
-	return;
-
-err:
-	async_answer_0(call, err);
-	async_transaction_destroy(trans);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/generic/remote_usbhid.c
===================================================================
--- uspace/lib/drv/generic/remote_usbhid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,444 +1,0 @@
-/*
- * Copyright (c) 2010-2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-#include <macros.h>
-
-#include "usbhid_iface.h"
-#include "ddf/driver.h"
-
-/** IPC methods for USB HID device interface. */
-typedef enum {
-	/** Get number of events reported in single burst.
-	 * Parameters: none
-	 * Answer:
-	 * - Size of one report in bytes.
-	 */
-	IPC_M_USBHID_GET_EVENT_LENGTH,
-	/** Get single event from the HID device.
-	 * The word single refers to set of individual events that were
-	 * available at particular point in time.
-	 * Parameters:
-	 * - flags
-	 * The call is followed by data read expecting two concatenated
-	 * arrays.
-	 * Answer:
-	 * - EOK - events returned
-	 * - EAGAIN - no event ready (only in non-blocking mode)
-	 *
-	 * It is okay if the client requests less data. Extra data must
-	 * be truncated by the driver.
-	 *
-	 * @todo Change this comment.
-	 */
-	IPC_M_USBHID_GET_EVENT,
-
-	/** Get the size of the report descriptor from the HID device.
-	 *
-	 * Parameters:
-	 * - none
-	 * Answer:
-	 * - EOK - method is implemented (expected always)
-	 * Parameters of the answer:
-	 * - Size of the report in bytes.
-	 */
-	IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH,
-
-	/** Get the report descriptor from the HID device.
-	 *
-	 * Parameters:
-	 * - none
-	 * The call is followed by data read expecting the descriptor itself.
-	 * Answer:
-	 * - EOK - report descriptor returned.
-	 */
-	IPC_M_USBHID_GET_REPORT_DESCRIPTOR
-} usbhid_iface_funcs_t;
-
-/** Ask for event array length.
- *
- * @param dev_sess Session to DDF device providing USB HID interface.
- *
- * @return Number of usages returned or an error code.
- *
- */
-errno_t usbhid_dev_get_event_length(async_sess_t *dev_sess, size_t *size)
-{
-	if (!dev_sess)
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	sysarg_t len;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
-	    IPC_M_USBHID_GET_EVENT_LENGTH, &len);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK) {
-		if (size != NULL)
-			*size = (size_t) len;
-	}
-
-	return rc;
-}
-
-/** Request for next event from HID device.
- *
- * @param[in]  dev_sess    Session to DDF device providing USB HID interface.
- * @param[out] usage_pages Where to store usage pages.
- * @param[out] usages      Where to store usages (actual data).
- * @param[in]  usage_count Length of @p usage_pages and @p usages buffer
- *                         (in items, not bytes).
- * @param[out] actual_usage_count Number of usages actually returned by the
- *                                device driver.
- * @param[in] flags        Flags (see USBHID_IFACE_FLAG_*).
- *
- * @return Error code.
- *
- */
-errno_t usbhid_dev_get_event(async_sess_t *dev_sess, uint8_t *buf,
-    size_t size, size_t *actual_size, int *event_nr, unsigned int flags)
-{
-	if (!dev_sess)
-		return EINVAL;
-
-	if (buf == NULL)
-		return ENOMEM;
-
-	if (size == 0)
-		return EINVAL;
-
-	size_t buffer_size =  size;
-	uint8_t *buffer = malloc(buffer_size);
-	if (buffer == NULL)
-		return ENOMEM;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	ipc_call_t opening_request_call;
-	aid_t opening_request = async_send_2(exch,
-	    DEV_IFACE_ID(USBHID_DEV_IFACE), IPC_M_USBHID_GET_EVENT,
-	    flags, &opening_request_call);
-
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		free(buffer);
-		return ENOMEM;
-	}
-
-	ipc_call_t data_request_call;
-	aid_t data_request = async_data_read(exch, buffer, buffer_size,
-	    &data_request_call);
-
-	async_exchange_end(exch);
-
-	if (data_request == 0) {
-		async_forget(opening_request);
-		free(buffer);
-		return ENOMEM;
-	}
-
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
-	async_wait_for(data_request, &data_request_rc);
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (data_request_rc != EOK) {
-		/* Prefer return code of the opening request. */
-		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
-		else
-			return (errno_t) data_request_rc;
-	}
-
-	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
-
-	size_t act_size = ipc_get_arg2(&data_request_call);
-
-	/* Copy the individual items. */
-	memcpy(buf, buffer, act_size);
-
-	if (actual_size != NULL)
-		*actual_size = act_size;
-
-	if (event_nr != NULL)
-		*event_nr = ipc_get_arg1(&opening_request_call);
-
-	return EOK;
-}
-
-errno_t usbhid_dev_get_report_descriptor_length(async_sess_t *dev_sess,
-    size_t *size)
-{
-	if (!dev_sess)
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	sysarg_t arg_size;
-	errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(USBHID_DEV_IFACE),
-	    IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH, &arg_size);
-
-	async_exchange_end(exch);
-
-	if (rc == EOK) {
-		if (size != NULL)
-			*size = (size_t) arg_size;
-	}
-
-	return rc;
-}
-
-errno_t usbhid_dev_get_report_descriptor(async_sess_t *dev_sess, uint8_t *buf,
-    size_t size, size_t *actual_size)
-{
-	if (!dev_sess)
-		return EINVAL;
-
-	if (buf == NULL)
-		return ENOMEM;
-
-	if (size == 0)
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(dev_sess);
-
-	aid_t opening_request = async_send_1(exch,
-	    DEV_IFACE_ID(USBHID_DEV_IFACE), IPC_M_USBHID_GET_REPORT_DESCRIPTOR,
-	    NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	ipc_call_t data_request_call;
-	aid_t data_request = async_data_read(exch, buf, size,
-	    &data_request_call);
-
-	async_exchange_end(exch);
-
-	if (data_request == 0) {
-		async_forget(opening_request);
-		return ENOMEM;
-	}
-
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
-	async_wait_for(data_request, &data_request_rc);
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (data_request_rc != EOK) {
-		/* Prefer return code of the opening request. */
-		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
-		else
-			return (errno_t) data_request_rc;
-	}
-
-	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
-
-	size_t act_size = ipc_get_arg2(&data_request_call);
-
-	if (actual_size != NULL)
-		*actual_size = act_size;
-
-	return EOK;
-}
-
-static void remote_usbhid_get_event_length(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhid_get_event(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhid_get_report_descriptor_length(ddf_fun_t *, void *, ipc_call_t *);
-static void remote_usbhid_get_report_descriptor(ddf_fun_t *, void *, ipc_call_t *);
-
-/** Remote USB HID interface operations. */
-static const remote_iface_func_ptr_t remote_usbhid_iface_ops [] = {
-	[IPC_M_USBHID_GET_EVENT_LENGTH] = remote_usbhid_get_event_length,
-	[IPC_M_USBHID_GET_EVENT] = remote_usbhid_get_event,
-	[IPC_M_USBHID_GET_REPORT_DESCRIPTOR_LENGTH] =
-	    remote_usbhid_get_report_descriptor_length,
-	[IPC_M_USBHID_GET_REPORT_DESCRIPTOR] = remote_usbhid_get_report_descriptor
-};
-
-/** Remote USB HID interface structure.
- */
-const remote_iface_t remote_usbhid_iface = {
-	.method_count = ARRAY_SIZE(remote_usbhid_iface_ops),
-	.methods = remote_usbhid_iface_ops
-};
-
-void remote_usbhid_get_event_length(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	printf("remote_usbhid_get_event_length()\n");
-
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_event_length) {
-		printf("Get event length not set!\n");
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t len = hid_iface->get_event_length(fun);
-	async_answer_1(call, EOK, len);
-}
-
-void remote_usbhid_get_event(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_event) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	unsigned int flags = DEV_IPC_GET_ARG1(*call);
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_read_receive(&data, &len)) {
-		async_answer_0(call, EPARTY);
-		return;
-	}
-
-	if (len == 0) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	errno_t rc;
-
-	uint8_t *event = malloc(len);
-	if (event == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	size_t act_length;
-	int event_nr;
-	rc = hid_iface->get_event(fun, event, len, &act_length, &event_nr, flags);
-	if (rc != EOK) {
-		free(event);
-		async_answer_0(&data, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-	if (act_length >= len) {
-		/* This shall not happen. */
-		// FIXME: how about an assert here?
-		act_length = len;
-	}
-
-	async_data_read_finalize(&data, event, act_length);
-
-	free(event);
-
-	async_answer_1(call, EOK, event_nr);
-}
-
-void remote_usbhid_get_report_descriptor_length(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_report_descriptor_length) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	size_t len = hid_iface->get_report_descriptor_length(fun);
-	async_answer_1(call, EOK, (sysarg_t) len);
-}
-
-void remote_usbhid_get_report_descriptor(ddf_fun_t *fun, void *iface,
-    ipc_call_t *call)
-{
-	usbhid_iface_t *hid_iface = (usbhid_iface_t *) iface;
-
-	if (!hid_iface->get_report_descriptor) {
-		async_answer_0(call, ENOTSUP);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t len;
-	if (!async_data_read_receive(&data, &len)) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	if (len == 0) {
-		async_answer_0(&data, EINVAL);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	uint8_t *descriptor = malloc(len);
-	if (descriptor == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	size_t act_len = 0;
-	errno_t rc = hid_iface->get_report_descriptor(fun, descriptor, len,
-	    &act_len);
-	if (act_len > len) {
-		rc = ELIMIT;
-	}
-	if (rc != EOK) {
-		free(descriptor);
-		async_answer_0(&data, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	async_data_read_finalize(&data, descriptor, act_len);
-	async_answer_0(call, EOK);
-
-	free(descriptor);
-}
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ahci_iface.h
===================================================================
--- uspace/lib/drv/include/ahci_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- * @brief AHCI interface definition.
- */
-
-#ifndef LIBDRV_AHCI_IFACE_H_
-#define LIBDRV_AHCI_IFACE_H_
-
-#include "ddf/driver.h"
-#include <async.h>
-
-extern async_sess_t *ahci_get_sess(devman_handle_t, char **);
-
-extern errno_t ahci_get_sata_device_name(async_sess_t *, size_t, char *);
-extern errno_t ahci_get_num_blocks(async_sess_t *, uint64_t *);
-extern errno_t ahci_get_block_size(async_sess_t *, size_t *);
-extern errno_t ahci_read_blocks(async_sess_t *, uint64_t, size_t, void *);
-extern errno_t ahci_write_blocks(async_sess_t *, uint64_t, size_t, void *);
-
-/** AHCI device communication interface. */
-typedef struct {
-	errno_t (*get_sata_device_name)(ddf_fun_t *, size_t, char *);
-	errno_t (*get_num_blocks)(ddf_fun_t *, uint64_t *);
-	errno_t (*get_block_size)(ddf_fun_t *, size_t *);
-	errno_t (*read_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
-	errno_t (*write_blocks)(ddf_fun_t *, uint64_t, size_t, void *);
-} ahci_iface_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/audio_mixer_iface.h
===================================================================
--- uspace/lib/drv/include/audio_mixer_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief Audio mixer control interface.
- */
-
-#ifndef LIBDRV_AUDIO_MIXER_IFACE_H_
-#define LIBDRV_AUDIO_MIXER_IFACE_H_
-
-#include <async.h>
-#include <stdbool.h>
-
-#include "ddf/driver.h"
-
-errno_t audio_mixer_get_info(async_exch_t *, char **, unsigned *);
-errno_t audio_mixer_get_item_info(async_exch_t *, unsigned,
-    char **, unsigned *);
-errno_t audio_mixer_get_item_level(async_exch_t *, unsigned, unsigned *);
-errno_t audio_mixer_set_item_level(async_exch_t *, unsigned, unsigned);
-
-/** Audio mixer communication interface. */
-typedef struct {
-	errno_t (*get_info)(ddf_fun_t *, const char **, unsigned *);
-	errno_t (*get_item_info)(ddf_fun_t *, unsigned, const char **, unsigned *);
-	errno_t (*get_item_level)(ddf_fun_t *, unsigned, unsigned *);
-	errno_t (*set_item_level)(ddf_fun_t *, unsigned, unsigned);
-} audio_mixer_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/audio_pcm_iface.h
===================================================================
--- uspace/lib/drv/include/audio_pcm_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief Audio PCM buffer interface.
- */
-
-#ifndef LIBDRV_AUDIO_PCM_IFACE_H_
-#define LIBDRV_AUDIO_PCM_IFACE_H_
-
-#include <async.h>
-#include <stdbool.h>
-#include <loc.h>
-#include <pcm/sample_format.h>
-
-#include "ddf/driver.h"
-
-typedef enum {
-	/** Device is capable of audio capture */
-	AUDIO_CAP_CAPTURE,
-	/** Device is capable of audio playback */
-	AUDIO_CAP_PLAYBACK,
-	/** Maximum size of device buffer */
-	AUDIO_CAP_MAX_BUFFER,
-	/** Device is capable of providing accurate buffer position info */
-	AUDIO_CAP_BUFFER_POS,
-	/** Device is capable of event based playback or capture */
-	AUDIO_CAP_INTERRUPT,
-	/** Minimal size of playback/record fragment */
-	AUDIO_CAP_INTERRUPT_MIN_FRAMES,
-	/** Maximum size of playback/record fragment */
-	AUDIO_CAP_INTERRUPT_MAX_FRAMES,
-} audio_cap_t;
-
-typedef enum {
-	PCM_EVENT_PLAYBACK_STARTED = IPC_FIRST_USER_METHOD,
-	PCM_EVENT_CAPTURE_STARTED,
-	PCM_EVENT_FRAMES_PLAYED,
-	PCM_EVENT_FRAMES_CAPTURED,
-	PCM_EVENT_PLAYBACK_TERMINATED,
-	PCM_EVENT_CAPTURE_TERMINATED,
-} pcm_event_t;
-
-const char *audio_pcm_cap_str(audio_cap_t);
-const char *audio_pcm_event_str(pcm_event_t);
-
-typedef async_sess_t audio_pcm_sess_t;
-
-audio_pcm_sess_t *audio_pcm_open(const char *);
-audio_pcm_sess_t *audio_pcm_open_default(void);
-audio_pcm_sess_t *audio_pcm_open_service(service_id_t service);
-void audio_pcm_close(audio_pcm_sess_t *);
-
-errno_t audio_pcm_get_info_str(audio_pcm_sess_t *, char **);
-errno_t audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *,
-    pcm_sample_format_t *);
-errno_t audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t, sysarg_t *);
-errno_t audio_pcm_register_event_callback(audio_pcm_sess_t *,
-    async_port_handler_t, void *);
-errno_t audio_pcm_unregister_event_callback(audio_pcm_sess_t *);
-
-errno_t audio_pcm_get_buffer(audio_pcm_sess_t *, void **, size_t *);
-errno_t audio_pcm_get_buffer_pos(audio_pcm_sess_t *, size_t *);
-errno_t audio_pcm_release_buffer(audio_pcm_sess_t *);
-
-errno_t audio_pcm_start_playback_fragment(audio_pcm_sess_t *, unsigned,
-    unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_last_playback_fragment(audio_pcm_sess_t *);
-
-errno_t audio_pcm_start_playback(audio_pcm_sess_t *,
-    unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_stop_playback_immediate(audio_pcm_sess_t *);
-errno_t audio_pcm_stop_playback(audio_pcm_sess_t *);
-
-errno_t audio_pcm_start_capture_fragment(audio_pcm_sess_t *, unsigned,
-    unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_last_capture_fragment(audio_pcm_sess_t *);
-
-errno_t audio_pcm_start_capture(audio_pcm_sess_t *,
-    unsigned, unsigned, pcm_sample_format_t);
-errno_t audio_pcm_stop_capture_immediate(audio_pcm_sess_t *);
-errno_t audio_pcm_stop_capture(audio_pcm_sess_t *);
-
-/** Audio pcm communication interface. */
-typedef struct {
-	errno_t (*get_info_str)(ddf_fun_t *, const char **);
-	errno_t (*test_format)(ddf_fun_t *, unsigned *, unsigned *,
-	    pcm_sample_format_t *);
-	unsigned (*query_cap)(ddf_fun_t *, audio_cap_t);
-	errno_t (*get_buffer_pos)(ddf_fun_t *, size_t *);
-	errno_t (*get_buffer)(ddf_fun_t *, void **, size_t *);
-	errno_t (*release_buffer)(ddf_fun_t *);
-	errno_t (*set_event_session)(ddf_fun_t *, async_sess_t *);
-	async_sess_t *(*get_event_session)(ddf_fun_t *);
-	errno_t (*start_playback)(ddf_fun_t *, unsigned,
-	    unsigned, unsigned, pcm_sample_format_t);
-	errno_t (*stop_playback)(ddf_fun_t *, bool);
-	errno_t (*start_capture)(ddf_fun_t *, unsigned,
-	    unsigned, unsigned, pcm_sample_format_t);
-	errno_t (*stop_capture)(ddf_fun_t *, bool);
-} audio_pcm_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/battery_iface.h
===================================================================
--- uspace/lib/drv/include/battery_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_BATTERY_IFACE_H_
-#define LIBDRV_BATTERY_IFACE_H_
-
-#include <async.h>
-
-typedef enum {
-	BATTERY_OK,
-	BATTERY_LOW,
-	BATTERY_NOT_PRESENT,
-} battery_status_t;
-
-typedef enum {
-	BATTERY_STATUS_GET = 0,
-	BATTERY_CHARGE_LEVEL_GET,
-} battery_dev_method_t;
-
-extern errno_t battery_status_get(async_sess_t *, battery_status_t *);
-extern errno_t battery_charge_level_get(async_sess_t *, int *);
-
-#endif
Index: pace/lib/drv/include/ddf/driver.h
===================================================================
--- uspace/lib/drv/include/ddf/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,145 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef DDF_DRIVER_H_
-#define DDF_DRIVER_H_
-
-#include <async.h>
-#include <ipc/devman.h>
-#include <ipc/dev_iface.h>
-#include "../dev_iface.h"
-
-/*
- * Device
- */
-
-typedef struct ddf_dev ddf_dev_t;
-typedef struct ddf_fun ddf_fun_t;
-
-/** Devices operations */
-typedef struct ddf_dev_ops {
-	/**
-	 * Optional callback function called when a client is connecting to the
-	 * device.
-	 */
-	errno_t (*open)(ddf_fun_t *);
-
-	/**
-	 * Optional callback function called when a client is disconnecting from
-	 * the device.
-	 */
-	void (*close)(ddf_fun_t *);
-
-	/** The table of standard interfaces implemented by the device. */
-	void *interfaces[DEV_IFACE_COUNT];
-
-	/**
-	 * The default handler of remote client requests. If the client's remote
-	 * request cannot be handled by any of the standard interfaces, the
-	 * default handler is used.
-	 */
-	remote_handler_t *default_handler;
-} ddf_dev_ops_t;
-
-/** Device structure */
-struct ddf_dev;
-
-/** Function structure */
-struct ddf_fun;
-
-/*
- * Driver
- */
-
-/** Generic device driver operations */
-typedef struct driver_ops {
-	/** Ask driver to add a new device */
-	errno_t (*dev_add)(ddf_dev_t *);
-
-	/** Ask driver to remove a device */
-	errno_t (*dev_remove)(ddf_dev_t *);
-
-	/** Inform driver a device disappeared */
-	errno_t (*dev_gone)(ddf_dev_t *);
-
-	/** Ask driver to quiesce device (disable interrupts and DMA) */
-	errno_t (*dev_quiesce)(ddf_dev_t *);
-
-	/** Ask driver to online a specific function */
-	errno_t (*fun_online)(ddf_fun_t *);
-
-	/** Ask driver to offline a specific function */
-	errno_t (*fun_offline)(ddf_fun_t *);
-} driver_ops_t;
-
-/** Driver structure */
-typedef struct driver {
-	/** Name of the device driver */
-	const char *name;
-	/** Generic device driver operations */
-	const driver_ops_t *driver_ops;
-} driver_t;
-
-extern int ddf_driver_main(const driver_t *);
-
-extern void *ddf_dev_data_alloc(ddf_dev_t *, size_t);
-extern void *ddf_dev_data_get(ddf_dev_t *);
-extern devman_handle_t ddf_dev_get_handle(ddf_dev_t *);
-extern const char *ddf_dev_get_name(ddf_dev_t *);
-extern async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *);
-extern ddf_fun_t *ddf_fun_create(ddf_dev_t *, fun_type_t, const char *);
-extern devman_handle_t ddf_fun_get_handle(ddf_fun_t *);
-extern void ddf_fun_destroy(ddf_fun_t *);
-extern void *ddf_fun_data_alloc(ddf_fun_t *, size_t);
-extern void *ddf_fun_data_get(ddf_fun_t *);
-extern const char *ddf_fun_get_name(ddf_fun_t *);
-extern errno_t ddf_fun_set_name(ddf_fun_t *, const char *);
-extern ddf_dev_t *ddf_fun_get_dev(ddf_fun_t *);
-extern errno_t ddf_fun_bind(ddf_fun_t *);
-extern errno_t ddf_fun_unbind(ddf_fun_t *);
-extern errno_t ddf_fun_online(ddf_fun_t *);
-extern errno_t ddf_fun_offline(ddf_fun_t *);
-extern errno_t ddf_fun_quiesce(ddf_fun_t *);
-extern errno_t ddf_fun_add_match_id(ddf_fun_t *, const char *, int);
-extern void ddf_fun_set_ops(ddf_fun_t *, const ddf_dev_ops_t *);
-extern void ddf_fun_set_conn_handler(ddf_fun_t *, async_port_handler_t);
-extern errno_t ddf_fun_add_to_category(ddf_fun_t *, const char *);
-extern errno_t ddf_fun_wait_stable(ddf_fun_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ddf/interrupt.h
===================================================================
--- uspace/lib/drv/include/ddf/interrupt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef DDF_INTERRUPT_H_
-#define DDF_INTERRUPT_H_
-
-#include <types/common.h>
-#include <abi/ddi/irq.h>
-#include <adt/list.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-#include "driver.h"
-#include "../dev_iface.h"
-
-/*
- * Interrupts
- */
-
-typedef void interrupt_handler_t(ipc_call_t *, void *);
-
-extern errno_t register_interrupt_handler(ddf_dev_t *, int,
-    interrupt_handler_t *, void *, const irq_code_t *, cap_irq_handle_t *);
-extern errno_t unregister_interrupt_handler(ddf_dev_t *, cap_irq_handle_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ddf/log.h
===================================================================
--- uspace/lib/drv/include/ddf/log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-
-#ifndef DDF_LOG_H_
-#define DDF_LOG_H_
-
-#include <io/log.h>
-#include <io/verify.h>
-
-extern errno_t ddf_log_init(const char *);
-extern void ddf_msg(log_level_t, const char *, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-
-extern void ddf_dump_buffer(char *, size_t, const void *, size_t, size_t,
-    size_t);
-
-#define ddf_log_fatal(msg...) ddf_msg(LVL_FATAL, msg)
-#define ddf_log_error(msg...) ddf_msg(LVL_ERROR, msg)
-#define ddf_log_warning(msg...) ddf_msg(LVL_WARN, msg)
-#define ddf_log_note(msg...) ddf_msg(LVL_NOTE, msg)
-#define ddf_log_debug(msg...) ddf_msg(LVL_DEBUG, msg)
-#define ddf_log_verbose(msg...) ddf_msg(LVL_DEBUG2, msg)
-
-#endif
-
-/** @}
- */
Index: pace/lib/drv/include/dev_iface.h
===================================================================
--- uspace/lib/drv/include/dev_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_DEV_IFACE_H_
-#define LIBDRV_DEV_IFACE_H_
-
-#include <ipc/common.h>
-#include <ipc/dev_iface.h>
-#include <stdbool.h>
-
-/*
- * Device interface
- */
-
-struct ddf_fun;
-
-/*
- * First two parameters: device and interface structure registered by the
- * devices driver.
- */
-typedef void remote_iface_func_t(struct ddf_fun *, void *, ipc_call_t *);
-typedef remote_iface_func_t *remote_iface_func_ptr_t;
-typedef void remote_handler_t(struct ddf_fun *, ipc_call_t *);
-
-typedef struct {
-	const size_t method_count;
-	const remote_iface_func_ptr_t *methods;
-} remote_iface_t;
-
-typedef struct {
-	const remote_iface_t *ifaces[DEV_IFACE_COUNT];
-} iface_dipatch_table_t;
-
-extern const remote_iface_t *get_remote_iface(int);
-extern remote_iface_func_ptr_t get_remote_method(const remote_iface_t *, sysarg_t);
-
-extern bool is_valid_iface_idx(int);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ieee80211_iface.h
===================================================================
--- uspace/lib/drv/include/ieee80211_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file ieee80211_iface.h
- */
-
-#ifndef LIBDRV_IEEE80211_IFACE_H_
-#define LIBDRV_IEEE80211_IFACE_H_
-
-#include <ieee80211/ieee80211.h>
-#include <async.h>
-
-extern errno_t ieee80211_get_scan_results(async_sess_t *,
-    ieee80211_scan_results_t *, bool);
-extern errno_t ieee80211_connect(async_sess_t *, char *, char *);
-extern errno_t ieee80211_disconnect(async_sess_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/drv/include/nic_iface.h
===================================================================
--- uspace/lib/drv/include/nic_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2010 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_NIC_IFACE_H_
-#define LIBDRV_NIC_IFACE_H_
-
-#include <async.h>
-#include <nic/nic.h>
-#include <ipc/common.h>
-
-typedef enum {
-	NIC_EV_ADDR_CHANGED = IPC_FIRST_USER_METHOD,
-	NIC_EV_RECEIVED,
-	NIC_EV_DEVICE_STATE
-} nic_event_t;
-
-extern errno_t nic_send_frame(async_sess_t *, void *, size_t);
-extern errno_t nic_callback_create(async_sess_t *, async_port_handler_t, void *);
-extern errno_t nic_get_state(async_sess_t *, nic_device_state_t *);
-extern errno_t nic_set_state(async_sess_t *, nic_device_state_t);
-extern errno_t nic_get_address(async_sess_t *, nic_address_t *);
-extern errno_t nic_set_address(async_sess_t *, const nic_address_t *);
-extern errno_t nic_get_stats(async_sess_t *, nic_device_stats_t *);
-extern errno_t nic_get_device_info(async_sess_t *, nic_device_info_t *);
-extern errno_t nic_get_cable_state(async_sess_t *, nic_cable_state_t *);
-
-extern errno_t nic_get_operation_mode(async_sess_t *, int *, nic_channel_mode_t *,
-    nic_role_t *);
-extern errno_t nic_set_operation_mode(async_sess_t *, int, nic_channel_mode_t,
-    nic_role_t);
-extern errno_t nic_autoneg_enable(async_sess_t *, uint32_t);
-extern errno_t nic_autoneg_disable(async_sess_t *);
-extern errno_t nic_autoneg_probe(async_sess_t *, uint32_t *, uint32_t *,
-    nic_result_t *, nic_result_t *);
-extern errno_t nic_autoneg_restart(async_sess_t *);
-extern errno_t nic_get_pause(async_sess_t *, nic_result_t *, nic_result_t *,
-    uint16_t *);
-extern errno_t nic_set_pause(async_sess_t *, int, int, uint16_t);
-
-extern errno_t nic_unicast_get_mode(async_sess_t *, nic_unicast_mode_t *, size_t,
-    nic_address_t *, size_t *);
-extern errno_t nic_unicast_set_mode(async_sess_t *, nic_unicast_mode_t,
-    const nic_address_t *, size_t);
-extern errno_t nic_multicast_get_mode(async_sess_t *, nic_multicast_mode_t *,
-    size_t, nic_address_t *, size_t *);
-extern errno_t nic_multicast_set_mode(async_sess_t *, nic_multicast_mode_t,
-    const nic_address_t *, size_t);
-extern errno_t nic_broadcast_get_mode(async_sess_t *, nic_broadcast_mode_t *);
-extern errno_t nic_broadcast_set_mode(async_sess_t *, nic_broadcast_mode_t);
-extern errno_t nic_defective_get_mode(async_sess_t *, uint32_t *);
-extern errno_t nic_defective_set_mode(async_sess_t *, uint32_t);
-extern errno_t nic_blocked_sources_get(async_sess_t *, size_t, nic_address_t *,
-    size_t *);
-extern errno_t nic_blocked_sources_set(async_sess_t *, const nic_address_t *,
-    size_t);
-
-extern errno_t nic_vlan_get_mask(async_sess_t *, nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_mask(async_sess_t *, const nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_tag(async_sess_t *, uint16_t, bool, bool);
-
-extern errno_t nic_wol_virtue_add(async_sess_t *, nic_wv_type_t, const void *,
-    size_t, nic_wv_id_t *);
-extern errno_t nic_wol_virtue_remove(async_sess_t *, nic_wv_id_t);
-extern errno_t nic_wol_virtue_probe(async_sess_t *, nic_wv_id_t, nic_wv_type_t *,
-    size_t, void *, size_t *);
-extern errno_t nic_wol_virtue_list(async_sess_t *, nic_wv_type_t, size_t,
-    nic_wv_id_t *, size_t *);
-extern errno_t nic_wol_virtue_get_caps(async_sess_t *, nic_wv_type_t, int *);
-extern errno_t nic_wol_load_info(async_sess_t *, nic_wv_type_t *, size_t, uint8_t *,
-    size_t *);
-
-extern errno_t nic_offload_probe(async_sess_t *, uint32_t *, uint32_t *);
-extern errno_t nic_offload_set(async_sess_t *, uint32_t, uint32_t);
-
-extern errno_t nic_poll_get_mode(async_sess_t *, nic_poll_mode_t *,
-    struct timespec *);
-extern errno_t nic_poll_set_mode(async_sess_t *, nic_poll_mode_t,
-    const struct timespec *);
-extern errno_t nic_poll_now(async_sess_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/drv/include/ops/battery_dev.h
===================================================================
--- uspace/lib/drv/include/ops/battery_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_OPS_BATTERY_DEV_H_
-#define LIBDRV_OPS_BATTERY_DEV_H_
-
-#include "../ddf/driver.h"
-#include "battery_iface.h"
-
-typedef struct {
-	errno_t (*battery_status_get)(ddf_fun_t *, battery_status_t *);
-	errno_t (*battery_charge_level_get)(ddf_fun_t *, int *);
-} battery_dev_ops_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/clock_dev.h
===================================================================
--- uspace/lib/drv/include/ops/clock_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_OPS_CLOCK_DEV_H_
-#define LIBDRV_OPS_CLOCK_DEV_H_
-
-#include <time.h>
-#include "../ddf/driver.h"
-
-typedef struct {
-	errno_t (*time_get)(ddf_fun_t *, struct tm *);
-	errno_t (*time_set)(ddf_fun_t *, struct tm *);
-} clock_dev_ops_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/hw_res.h
===================================================================
--- uspace/lib/drv/include/ops/hw_res.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_OPS_HW_RES_H_
-#define LIBDRV_OPS_HW_RES_H_
-
-#include <device/hw_res.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "../ddf/driver.h"
-
-typedef struct {
-	hw_resource_list_t *(*get_resource_list)(ddf_fun_t *);
-	errno_t (*enable_interrupt)(ddf_fun_t *, int);
-	errno_t (*disable_interrupt)(ddf_fun_t *, int);
-	errno_t (*clear_interrupt)(ddf_fun_t *, int);
-	errno_t (*dma_channel_setup)(ddf_fun_t *, unsigned, uint32_t, uint32_t, uint8_t);
-	errno_t (*dma_channel_remain)(ddf_fun_t *, unsigned, size_t *);
-	errno_t (*query_legacy_io)(ddf_fun_t *, hw_res_claims_t *);
-	errno_t (*claim_legacy_io)(ddf_fun_t *, hw_res_claims_t);
-} hw_res_ops_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/ieee80211.h
===================================================================
--- uspace/lib/drv/include/ops/ieee80211.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file ieee80211.h
- * @brief IEEE 802.11 WiFi interface definition
- */
-
-#ifndef LIBDRV_OPS_IEEE80211_H_
-#define LIBDRV_OPS_IEEE80211_H_
-
-#include <ddf/driver.h>
-#include <ieee80211/ieee80211.h>
-
-/** IEEE 802.11 interface functions definition. */
-typedef struct ieee80211_iface {
-	/** Fetch scan results from IEEE 802.11 device.
-	 *
-	 * @param fun     IEEE 802.11 function.
-	 * @param results Structure where to put scan results.
-	 * @param now     Whether to initiate scan immediately.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*get_scan_results)(ddf_fun_t *, ieee80211_scan_results_t *, bool);
-
-	/** Connect IEEE 802.11 device to specified network.
-	 *
-	 * @param fun      IEEE 802.11 function.
-	 * @param ssid     Network SSID.
-	 * @param password Network password (empty string if not needed).
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*connect)(ddf_fun_t *, char *, char *);
-
-	/** Disconnect IEEE 802.11 device from network.
-	 *
-	 * @param fun IEEE 802.11 function.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*disconnect)(ddf_fun_t *);
-} ieee80211_iface_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/led_dev.h
===================================================================
--- uspace/lib/drv/include/ops/led_dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_OPS_LED_DEV_H_
-#define LIBDRV_OPS_LED_DEV_H_
-
-#include <io/pixel.h>
-#include "../ddf/driver.h"
-
-typedef struct {
-	errno_t (*color_set)(ddf_fun_t *, pixel_t);
-} led_dev_ops_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/nic.h
===================================================================
--- uspace/lib/drv/include/ops/nic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- * @brief DDF NIC interface definition
- */
-
-#ifndef LIBDRV_OPS_NIC_H_
-#define LIBDRV_OPS_NIC_H_
-
-#include <ipc/services.h>
-#include <nic/nic.h>
-#include <time.h>
-#include "../ddf/driver.h"
-
-typedef struct nic_iface {
-	/** Mandatory methods */
-	errno_t (*send_frame)(ddf_fun_t *, void *, size_t);
-	errno_t (*callback_create)(ddf_fun_t *);
-	errno_t (*get_state)(ddf_fun_t *, nic_device_state_t *);
-	errno_t (*set_state)(ddf_fun_t *, nic_device_state_t);
-	errno_t (*get_address)(ddf_fun_t *, nic_address_t *);
-
-	/** Optional methods */
-	errno_t (*set_address)(ddf_fun_t *, const nic_address_t *);
-	errno_t (*get_stats)(ddf_fun_t *, nic_device_stats_t *);
-	errno_t (*get_device_info)(ddf_fun_t *, nic_device_info_t *);
-	errno_t (*get_cable_state)(ddf_fun_t *, nic_cable_state_t *);
-
-	errno_t (*get_operation_mode)(ddf_fun_t *, int *, nic_channel_mode_t *,
-	    nic_role_t *);
-	errno_t (*set_operation_mode)(ddf_fun_t *, int, nic_channel_mode_t,
-	    nic_role_t);
-	errno_t (*autoneg_enable)(ddf_fun_t *, uint32_t);
-	errno_t (*autoneg_disable)(ddf_fun_t *);
-	errno_t (*autoneg_probe)(ddf_fun_t *, uint32_t *, uint32_t *,
-	    nic_result_t *, nic_result_t *);
-	errno_t (*autoneg_restart)(ddf_fun_t *);
-	errno_t (*get_pause)(ddf_fun_t *, nic_result_t *, nic_result_t *,
-	    uint16_t *);
-	errno_t (*set_pause)(ddf_fun_t *, int, int, uint16_t);
-
-	errno_t (*unicast_get_mode)(ddf_fun_t *, nic_unicast_mode_t *, size_t,
-	    nic_address_t *, size_t *);
-	errno_t (*unicast_set_mode)(ddf_fun_t *, nic_unicast_mode_t,
-	    const nic_address_t *, size_t);
-	errno_t (*multicast_get_mode)(ddf_fun_t *, nic_multicast_mode_t *, size_t,
-	    nic_address_t *, size_t *);
-	errno_t (*multicast_set_mode)(ddf_fun_t *, nic_multicast_mode_t,
-	    const nic_address_t *, size_t);
-	errno_t (*broadcast_get_mode)(ddf_fun_t *, nic_broadcast_mode_t *);
-	errno_t (*broadcast_set_mode)(ddf_fun_t *, nic_broadcast_mode_t);
-	errno_t (*defective_get_mode)(ddf_fun_t *, uint32_t *);
-	errno_t (*defective_set_mode)(ddf_fun_t *, uint32_t);
-	errno_t (*blocked_sources_get)(ddf_fun_t *, size_t, nic_address_t *,
-	    size_t *);
-	errno_t (*blocked_sources_set)(ddf_fun_t *, const nic_address_t *, size_t);
-
-	errno_t (*vlan_get_mask)(ddf_fun_t *, nic_vlan_mask_t *);
-	errno_t (*vlan_set_mask)(ddf_fun_t *, const nic_vlan_mask_t *);
-	errno_t (*vlan_set_tag)(ddf_fun_t *, uint16_t, bool, bool);
-
-	errno_t (*wol_virtue_add)(ddf_fun_t *, nic_wv_type_t, const void *,
-	    size_t, nic_wv_id_t *);
-	errno_t (*wol_virtue_remove)(ddf_fun_t *, nic_wv_id_t);
-	errno_t (*wol_virtue_probe)(ddf_fun_t *, nic_wv_id_t, nic_wv_type_t *,
-	    size_t, void *, size_t *);
-	errno_t (*wol_virtue_list)(ddf_fun_t *, nic_wv_type_t, size_t,
-	    nic_wv_id_t *, size_t *);
-	errno_t (*wol_virtue_get_caps)(ddf_fun_t *, nic_wv_type_t, int *);
-	errno_t (*wol_load_info)(ddf_fun_t *, nic_wv_type_t *, size_t,
-	    uint8_t *, size_t *);
-
-	errno_t (*offload_probe)(ddf_fun_t *, uint32_t *, uint32_t *);
-	errno_t (*offload_set)(ddf_fun_t *, uint32_t, uint32_t);
-
-	errno_t (*poll_get_mode)(ddf_fun_t *, nic_poll_mode_t *,
-	    struct timespec *);
-	errno_t (*poll_set_mode)(ddf_fun_t *, nic_poll_mode_t,
-	    const struct timespec *);
-	errno_t (*poll_now)(ddf_fun_t *);
-} nic_iface_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/ops/pio_window.h
===================================================================
--- uspace/lib/drv/include/ops/pio_window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- */
-
-#ifndef LIBDRV_OPS_PIO_WINDOW_H_
-#define LIBDRV_OPS_PIO_WINDOW_H_
-
-#include <device/pio_window.h>
-#include "../ddf/driver.h"
-
-typedef struct {
-	pio_window_t *(*get_pio_window)(ddf_fun_t *);
-} pio_window_ops_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/drv/include/pci_dev_iface.h
===================================================================
--- uspace/lib/drv/include/pci_dev_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief PCI device interface definition.
- */
-
-#ifndef LIBDRV_PCI_DEV_IFACE_H_
-#define LIBDRV_PCI_DEV_IFACE_H_
-
-#include <errno.h>
-
-#include "ddf/driver.h"
-
-#define PCI_VENDOR_ID	0x00
-#define PCI_DEVICE_ID	0x02
-#define PCI_STATUS 	0x06
-#define PCI_SUB_CLASS	0x0A
-#define PCI_BASE_CLASS	0x0B
-#define PCI_BAR0	0x10
-#define PCI_CAP_PTR	0x34
-
-#define PCI_BAR_COUNT	6
-
-#define PCI_STATUS_CAP_LIST	(1 << 4)
-
-#define PCI_CAP_ID(c)	((c) + 0x0)
-#define PCI_CAP_NEXT(c)	((c) + 0x1)
-
-#define PCI_CAP_PMID		0x1
-#define PCI_CAP_VENDORSPECID	0x9
-
-extern errno_t pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *);
-extern errno_t pci_config_space_read_16(async_sess_t *, uint32_t, uint16_t *);
-extern errno_t pci_config_space_read_32(async_sess_t *, uint32_t, uint32_t *);
-
-extern errno_t pci_config_space_write_8(async_sess_t *, uint32_t, uint8_t);
-extern errno_t pci_config_space_write_16(async_sess_t *, uint32_t, uint16_t);
-extern errno_t pci_config_space_write_32(async_sess_t *, uint32_t, uint32_t);
-
-static inline errno_t
-pci_config_space_cap_first(async_sess_t *sess, uint8_t *c, uint8_t *id)
-{
-	errno_t rc;
-	uint16_t status;
-
-	rc = pci_config_space_read_16(sess, PCI_STATUS, &status);
-	if (rc != EOK)
-		return rc;
-
-	if (!(status & PCI_STATUS_CAP_LIST)) {
-		*c = 0;
-		return EOK;
-	}
-
-	rc = pci_config_space_read_8(sess, PCI_CAP_PTR, c);
-	if (rc != EOK)
-		return rc;
-	if (!c)
-		return EOK;
-	return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id);
-}
-
-static inline errno_t
-pci_config_space_cap_next(async_sess_t *sess, uint8_t *c, uint8_t *id)
-{
-	errno_t rc = pci_config_space_read_8(sess, PCI_CAP_NEXT(*c), c);
-	if (rc != EOK)
-		return rc;
-	if (!c)
-		return EOK;
-	return pci_config_space_read_8(sess, PCI_CAP_ID(*c), id);
-}
-
-/** PCI device communication interface. */
-typedef struct {
-	errno_t (*config_space_read_8)(ddf_fun_t *, uint32_t address, uint8_t *data);
-	errno_t (*config_space_read_16)(ddf_fun_t *, uint32_t address, uint16_t *data);
-	errno_t (*config_space_read_32)(ddf_fun_t *, uint32_t address, uint32_t *data);
-
-	errno_t (*config_space_write_8)(ddf_fun_t *, uint32_t address, uint8_t data);
-	errno_t (*config_space_write_16)(ddf_fun_t *, uint32_t address, uint16_t data);
-	errno_t (*config_space_write_32)(ddf_fun_t *, uint32_t address, uint32_t data);
-} pci_dev_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/usb_iface.h
===================================================================
--- uspace/lib/drv/include/usb_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief USB device interface definition.
- */
-
-#ifndef LIBDRV_USB_IFACE_H_
-#define LIBDRV_USB_IFACE_H_
-
-#include "ddf/driver.h"
-#include <async.h>
-#include <usbhc_iface.h>
-
-typedef async_sess_t usb_dev_session_t;
-
-typedef struct {
-	usb_address_t address;	/**< Current USB address */
-	uint8_t depth;		/**< Depth in the hub hiearchy */
-	usb_speed_t speed;	/**< Speed of the device */
-	devman_handle_t handle;	/**< Handle to DDF function of the HC driver */
-	/** Interface set by multi interface driver,  -1 if none */
-	int iface;
-} usb_device_desc_t;
-
-extern usb_dev_session_t *usb_dev_connect(devman_handle_t);
-extern usb_dev_session_t *usb_dev_connect_to_self(ddf_dev_t *);
-extern void usb_dev_disconnect(usb_dev_session_t *);
-
-extern errno_t usb_get_my_description(async_exch_t *, usb_device_desc_t *);
-
-/** USB device communication interface. */
-typedef struct {
-	errno_t (*get_my_description)(ddf_fun_t *, usb_device_desc_t *);
-} usb_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/usbdiag_iface.h
===================================================================
--- uspace/lib/drv/include/usbdiag_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief USB diagnostic device interface definition.
- */
-
-#ifndef LIBDRV_USBDIAG_IFACE_H_
-#define LIBDRV_USBDIAG_IFACE_H_
-
-#include <async.h>
-#include <usbhc_iface.h>
-#include "ddf/driver.h"
-
-#define USBDIAG_CATEGORY "usbdiag"
-
-/** Milliseconds */
-typedef unsigned long usbdiag_dur_t;
-
-/** Test parameters. */
-typedef struct usbdiag_test_params {
-	usb_transfer_type_t transfer_type;
-	size_t transfer_size;
-	usbdiag_dur_t min_duration;
-	bool validate_data;
-} usbdiag_test_params_t;
-
-/** Test results. */
-typedef struct usbdiag_test_results {
-	usbdiag_dur_t act_duration;
-	uint32_t transfer_count;
-	size_t transfer_size;
-} usbdiag_test_results_t;
-
-async_sess_t *usbdiag_connect(devman_handle_t);
-void usbdiag_disconnect(async_sess_t *);
-
-errno_t usbdiag_test_in(async_exch_t *,
-    const usbdiag_test_params_t *, usbdiag_test_results_t *);
-errno_t usbdiag_test_out(async_exch_t *,
-    const usbdiag_test_params_t *, usbdiag_test_results_t *);
-
-/** USB diagnostic device communication interface. */
-typedef struct {
-	errno_t (*test_in)(ddf_fun_t *,
-	    const usbdiag_test_params_t *, usbdiag_test_results_t *);
-	errno_t (*test_out)(ddf_fun_t *,
-	    const usbdiag_test_params_t *, usbdiag_test_results_t *);
-} usbdiag_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/usbhc_iface.h
===================================================================
--- uspace/lib/drv/include/usbhc_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2017 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @addtogroup usb
- * @{
- */
-/** @file
- * @brief USB host controler interface definition. This is the interface of
- * USB host controller function, which can be used by usb device drivers.
- */
-
-#ifndef LIBDRV_USBHC_IFACE_H_
-#define LIBDRV_USBHC_IFACE_H_
-
-#include "ddf/driver.h"
-#include <async.h>
-
-/** USB speeds. */
-typedef enum {
-	/** USB 1.1 low speed (1.5Mbits/s). */
-	USB_SPEED_LOW,
-	/** USB 1.1 full speed (12Mbits/s). */
-	USB_SPEED_FULL,
-	/** USB 2.0 high speed (480Mbits/s). */
-	USB_SPEED_HIGH,
-	/** USB 3.0 super speed (5Gbits/s). */
-	USB_SPEED_SUPER,
-	/** Psuedo-speed serving as a boundary. */
-	USB_SPEED_MAX
-} usb_speed_t;
-
-/** USB endpoint number type.
- * Negative values could be used to indicate error.
- */
-typedef uint16_t usb_endpoint_t;
-
-/** USB address type.
- * Negative values could be used to indicate error.
- */
-typedef uint16_t usb_address_t;
-
-/**
- * USB Stream ID type.
- */
-typedef uint16_t usb_stream_t;
-
-/** USB transfer type. */
-typedef enum {
-	USB_TRANSFER_CONTROL = 0,
-	USB_TRANSFER_ISOCHRONOUS = 1,
-	USB_TRANSFER_BULK = 2,
-	USB_TRANSFER_INTERRUPT = 3,
-} usb_transfer_type_t;
-
-#define USB_TRANSFER_COUNT  (USB_TRANSFER_INTERRUPT + 1)
-
-/** USB data transfer direction. */
-typedef enum {
-	USB_DIRECTION_IN,
-	USB_DIRECTION_OUT,
-	USB_DIRECTION_BOTH,
-} usb_direction_t;
-
-#define USB_DIRECTION_COUNT  (USB_DIRECTION_BOTH + 1)
-
-/** USB complete address type.
- * Pair address + endpoint is identification of transaction recipient.
- */
-typedef union {
-	struct {
-		usb_address_t address;
-		usb_endpoint_t endpoint;
-		usb_stream_t stream;
-	} __attribute__((packed));
-	uint64_t packed;
-} usb_target_t;
-
-// FIXME: DMA buffers shall be part of libdrv anyway.
-typedef uintptr_t dma_policy_t;
-
-typedef struct dma_buffer {
-	void *virt;
-	dma_policy_t policy;
-} dma_buffer_t;
-
-typedef struct usb_pipe_desc {
-	/** Endpoint number. */
-	usb_endpoint_t endpoint_no;
-
-	/** Endpoint transfer type. */
-	usb_transfer_type_t transfer_type;
-
-	/** Endpoint direction. */
-	usb_direction_t direction;
-
-	/**
-	 * Maximum size of one transfer. Non-periodic endpoints may handle
-	 * bigger transfers, but those can be split into multiple USB transfers.
-	 */
-	size_t max_transfer_size;
-
-	/** Constraints on buffers to be transferred without copying */
-	dma_policy_t transfer_buffer_policy;
-} usb_pipe_desc_t;
-
-typedef struct usb_pipe_transfer_request {
-	usb_direction_t dir;
-	usb_endpoint_t endpoint;
-	usb_stream_t stream;
-
-	uint64_t setup;			/**< Valid iff the transfer is of control type */
-
-	/**
-	 * The DMA buffer to share. Must be at least offset + size large. Is
-	 * patched after being transmitted over IPC, so the pointer is still
-	 * valid.
-	 */
-	dma_buffer_t buffer;
-	size_t offset;			/**< Offset to the buffer */
-	size_t size;			/**< Requested size. */
-} usbhc_iface_transfer_request_t;
-
-/** This structure follows standard endpoint descriptor + superspeed companion
- * descriptor, and exists to avoid dependency of libdrv on libusb. Keep the
- * internal fields named exactly like their source (because we want to use the
- * same macros to access them).
- * Callers shall fill it with bare contents of respective descriptors (in usb endianity).
- */
-typedef struct usb_endpoint_descriptors {
-	struct {
-		uint8_t endpoint_address;
-		uint8_t attributes;
-		uint16_t max_packet_size;
-		uint8_t poll_interval;
-	} endpoint;
-
-	/* Superspeed companion descriptor */
-	struct companion_desc_t {
-		uint8_t max_burst;
-		uint8_t attributes;
-		uint16_t bytes_per_interval;
-	} companion;
-} usb_endpoint_descriptors_t;
-
-extern errno_t usbhc_reserve_default_address(async_exch_t *);
-extern errno_t usbhc_release_default_address(async_exch_t *);
-
-extern errno_t usbhc_device_enumerate(async_exch_t *, unsigned, usb_speed_t);
-extern errno_t usbhc_device_remove(async_exch_t *, unsigned);
-
-extern errno_t usbhc_register_endpoint(async_exch_t *, usb_pipe_desc_t *, const usb_endpoint_descriptors_t *);
-extern errno_t usbhc_unregister_endpoint(async_exch_t *, const usb_pipe_desc_t *);
-
-extern errno_t usbhc_transfer(async_exch_t *, const usbhc_iface_transfer_request_t *, size_t *);
-
-/** Callback for outgoing transfer */
-typedef errno_t (*usbhc_iface_transfer_callback_t)(void *, int, size_t);
-
-/** USB device communication interface. */
-typedef struct {
-	errno_t (*default_address_reservation)(ddf_fun_t *, bool);
-
-	errno_t (*device_enumerate)(ddf_fun_t *, unsigned, usb_speed_t);
-	errno_t (*device_remove)(ddf_fun_t *, unsigned);
-
-	errno_t (*register_endpoint)(ddf_fun_t *, usb_pipe_desc_t *, const usb_endpoint_descriptors_t *);
-	errno_t (*unregister_endpoint)(ddf_fun_t *, const usb_pipe_desc_t *);
-
-	errno_t (*transfer)(ddf_fun_t *, const usbhc_iface_transfer_request_t *,
-	    usbhc_iface_transfer_callback_t, void *);
-} usbhc_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/include/usbhid_iface.h
===================================================================
--- uspace/lib/drv/include/usbhid_iface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libdrv
- * @{
- */
-/** @file
- * USB HID interface definition.
- */
-
-#ifndef LIBDRV_USBHID_IFACE_H_
-#define LIBDRV_USBHID_IFACE_H_
-
-#include "ddf/driver.h"
-
-extern errno_t usbhid_dev_get_event_length(async_sess_t *, size_t *);
-extern errno_t usbhid_dev_get_event(async_sess_t *, uint8_t *, size_t, size_t *,
-    int *, unsigned int);
-extern errno_t usbhid_dev_get_report_descriptor_length(async_sess_t *, size_t *);
-extern errno_t usbhid_dev_get_report_descriptor(async_sess_t *, uint8_t *, size_t,
-    size_t *);
-
-/** USB HID device communication interface. */
-typedef struct {
-	/** Get size of the event in bytes.
-	 *
-	 * @param[in] fun DDF function answering the request.
-	 * @return Size of the event in bytes.
-	 */
-	size_t (*get_event_length)(ddf_fun_t *fun);
-
-	/** Get single event from the HID device.
-	 *
-	 * @param[in] fun DDF function answering the request.
-	 * @param[out] buffer Buffer with raw data from the device.
-	 * @param[out] act_size Actual number of returned events.
-	 * @param[in] flags Flags (see USBHID_IFACE_FLAG_*).
-	 * @return Error code.
-	 */
-	errno_t (*get_event)(ddf_fun_t *fun, uint8_t *buffer, size_t size,
-	    size_t *act_size, int *event_nr, unsigned int flags);
-
-	/** Get size of the report descriptor in bytes.
-	 *
-	 * @param[in] fun DDF function answering the request.
-	 * @return Size of the report descriptor in bytes.
-	 */
-	size_t (*get_report_descriptor_length)(ddf_fun_t *fun);
-
-	/** Get the report descriptor from the HID device.
-	 *
-	 * @param[in] fun DDF function answering the request.
-	 * @param[out] desc Buffer with the report descriptor.
-	 * @param[in] size Size of the allocated @p desc buffer.
-	 * @param[out] act_size Actual size of the report descriptor returned.
-	 * @return Error code.
-	 */
-	errno_t (*get_report_descriptor)(ddf_fun_t *fun, uint8_t *desc,
-	    size_t size, size_t *act_size);
-} usbhid_iface_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/drv/meson.build
===================================================================
--- uspace/lib/drv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'pcm', 'device' ]
-private_includes += include_directories('generic/private')
-src = files(
-	'generic/driver.c',
-	'generic/dev_iface.c',
-	'generic/interrupt.c',
-	'generic/log.c',
-	'generic/logbuf.c',
-	'generic/remote_audio_mixer.c',
-	'generic/remote_audio_pcm.c',
-	'generic/remote_hw_res.c',
-	'generic/remote_pio_window.c',
-	'generic/remote_nic.c',
-	'generic/remote_ieee80211.c',
-	'generic/remote_usb.c',
-	'generic/remote_pci.c',
-	'generic/remote_usbdiag.c',
-	'generic/remote_usbhc.c',
-	'generic/remote_usbhid.c',
-	'generic/remote_clock_dev.c',
-	'generic/remote_led_dev.c',
-	'generic/remote_battery_dev.c',
-	'generic/remote_ahci.c',
-)
Index: pace/lib/ext4/doc/doxygroups.h
===================================================================
--- uspace/lib/ext4/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libext4 libext4
- * @ingroup libs
- * @brief Library for implementing the ext4 file system and utilities
- */
Index: pace/lib/ext4/include/ext4/balloc.h
===================================================================
--- uspace/lib/ext4/include/ext4/balloc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_BALLOC_H_
-#define LIBEXT4_BALLOC_H_
-
-#include <stdint.h>
-#include "types.h"
-
-extern errno_t ext4_balloc_free_block(ext4_inode_ref_t *, uint32_t);
-extern errno_t ext4_balloc_free_blocks(ext4_inode_ref_t *, uint32_t, uint32_t);
-extern uint32_t ext4_balloc_get_first_data_block_in_group(ext4_superblock_t *,
-    ext4_block_group_ref_t *);
-extern errno_t ext4_balloc_alloc_block(ext4_inode_ref_t *, uint32_t *);
-extern errno_t ext4_balloc_try_alloc_block(ext4_inode_ref_t *, uint32_t, bool *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/bitmap.h
===================================================================
--- uspace/lib/ext4/include/ext4/bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_BITMAP_H_
-#define LIBEXT4_BITMAP_H_
-
-#include <stdint.h>
-
-extern void ext4_bitmap_free_bit(uint8_t *, uint32_t);
-extern void ext4_bitmap_free_bits(uint8_t *, uint32_t, uint32_t);
-extern void ext4_bitmap_set_bit(uint8_t *, uint32_t);
-extern bool ext4_bitmap_is_free_bit(uint8_t *, uint32_t);
-extern errno_t ext4_bitmap_find_free_byte_and_set_bit(uint8_t *, uint32_t,
-    uint32_t *, uint32_t);
-extern errno_t ext4_bitmap_find_free_bit_and_set(uint8_t *, uint32_t, uint32_t *,
-    uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/block_group.h
===================================================================
--- uspace/lib/ext4/include/ext4/block_group.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_BLOCK_GROUP_H_
-#define LIBEXT4_BLOCK_GROUP_H_
-
-#include <block.h>
-#include <stdint.h>
-#include "types.h"
-
-extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_block_bitmap(ext4_block_group_t *,
-    ext4_superblock_t *, uint64_t);
-extern uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_inode_bitmap(ext4_block_group_t *,
-    ext4_superblock_t *, uint64_t);
-extern uint64_t ext4_block_group_get_inode_table_first_block(
-    ext4_block_group_t *, ext4_superblock_t *);
-extern void ext4_block_group_set_inode_table_first_block(ext4_block_group_t *,
-    ext4_superblock_t *, uint64_t);
-extern uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_free_blocks_count(ext4_block_group_t *,
-    ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_free_inodes_count(ext4_block_group_t *,
-    ext4_superblock_t *, uint32_t);
-extern void ext4_block_group_set_free_inodes_count(ext4_block_group_t *,
-    ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_used_dirs_count(ext4_block_group_t *,
-    ext4_superblock_t *, uint32_t);
-extern uint16_t ext4_block_group_get_flags(ext4_block_group_t *);
-extern void ext4_block_group_set_flags(ext4_block_group_t *, uint16_t);
-extern uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *,
-    ext4_superblock_t *);
-extern void ext4_block_group_set_itable_unused(ext4_block_group_t *,
-    ext4_superblock_t *, uint32_t);
-extern uint16_t ext4_block_group_get_checksum(ext4_block_group_t *);
-extern void ext4_block_group_set_checksum(ext4_block_group_t *, uint16_t);
-
-extern bool ext4_block_group_has_flag(ext4_block_group_t *, uint32_t);
-extern void ext4_block_group_set_flag(ext4_block_group_t *, uint32_t);
-extern void ext4_block_group_clear_flag(ext4_block_group_t *, uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/cfg.h
===================================================================
--- uspace/lib/ext4/include/ext4/cfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_CFG_H_
-#define LIBEXT4_CFG_H_
-
-#include "types.h"
-
-/** Versions available to choose from when creating a new file system. */
-typedef enum {
-	/** Ext2 original */
-	extver_ext2_old,
-	/** Ext2 dynamic revision */
-	extver_ext2
-} ext4_cfg_ver_t;
-
-/** Default file system version */
-#define ext4_def_fs_version extver_ext2
-
-/** Configuration of a new ext4 file system */
-typedef struct {
-	/** File system version */
-	ext4_cfg_ver_t version;
-	/** Volume name encoded as UTF-8 string */
-	const char *volume_name;
-	/** Filesystem block size */
-	size_t bsize;
-} ext4_cfg_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/directory.h
===================================================================
--- uspace/lib/ext4/include/ext4/directory.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_DIRECTORY_H_
-#define LIBEXT4_DIRECTORY_H_
-
-#include "ext4/types.h"
-
-extern uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *);
-extern void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *,
-    uint32_t);
-extern uint16_t ext4_directory_entry_ll_get_entry_length(
-    ext4_directory_entry_ll_t *);
-extern void ext4_directory_entry_ll_set_entry_length(ext4_directory_entry_ll_t *,
-    uint16_t);
-extern uint16_t ext4_directory_entry_ll_get_name_length(ext4_superblock_t *,
-    ext4_directory_entry_ll_t *);
-extern void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *,
-    ext4_directory_entry_ll_t *, uint16_t);
-extern uint8_t ext4_directory_entry_ll_get_inode_type(ext4_superblock_t *,
-    ext4_directory_entry_ll_t *);
-extern void ext4_directory_entry_ll_set_inode_type(ext4_superblock_t *,
-    ext4_directory_entry_ll_t *, uint8_t);
-
-extern errno_t ext4_directory_iterator_init(ext4_directory_iterator_t *,
-    ext4_inode_ref_t *, aoff64_t);
-extern errno_t ext4_directory_iterator_next(ext4_directory_iterator_t *);
-extern errno_t ext4_directory_iterator_fini(ext4_directory_iterator_t *);
-
-extern void ext4_directory_write_entry(ext4_superblock_t *,
-    ext4_directory_entry_ll_t *, uint16_t, ext4_inode_ref_t *,
-    const char *, size_t);
-extern errno_t ext4_directory_add_entry(ext4_inode_ref_t *, const char *,
-    ext4_inode_ref_t *);
-extern errno_t ext4_directory_find_entry(ext4_directory_search_result_t *,
-    ext4_inode_ref_t *, const char *);
-extern errno_t ext4_directory_remove_entry(ext4_inode_ref_t *, const char *);
-
-extern errno_t ext4_directory_try_insert_entry(ext4_superblock_t *, block_t *,
-    ext4_inode_ref_t *, const char *, uint32_t);
-
-extern errno_t ext4_directory_find_in_block(block_t *, ext4_superblock_t *, size_t,
-    const char *, ext4_directory_entry_ll_t **);
-
-extern errno_t ext4_directory_destroy_result(ext4_directory_search_result_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/directory_index.h
===================================================================
--- uspace/lib/ext4/include/ext4/directory_index.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_DIRECTORY_INDEX_H_
-#define LIBEXT4_DIRECTORY_INDEX_H_
-
-#include "ext4/types.h"
-
-extern uint8_t ext4_directory_dx_root_info_get_hash_version(
-    ext4_directory_dx_root_info_t *);
-extern void ext4_directory_dx_root_info_set_hash_version(
-    ext4_directory_dx_root_info_t *, uint8_t);
-extern uint8_t ext4_directory_dx_root_info_get_info_length(
-    ext4_directory_dx_root_info_t *);
-extern void ext4_directory_dx_root_info_set_info_length(
-    ext4_directory_dx_root_info_t *, uint8_t);
-extern uint8_t ext4_directory_dx_root_info_get_indirect_levels(
-    ext4_directory_dx_root_info_t *);
-extern void ext4_directory_dx_root_info_set_indirect_levels(
-    ext4_directory_dx_root_info_t *, uint8_t);
-
-extern uint16_t ext4_directory_dx_countlimit_get_limit(
-    ext4_directory_dx_countlimit_t *);
-extern void ext4_directory_dx_countlimit_set_limit(
-    ext4_directory_dx_countlimit_t *, uint16_t);
-extern uint16_t ext4_directory_dx_countlimit_get_count(
-    ext4_directory_dx_countlimit_t *);
-extern void ext4_directory_dx_countlimit_set_count(
-    ext4_directory_dx_countlimit_t *, uint16_t);
-
-extern uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *);
-extern void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *,
-    uint32_t);
-extern uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *);
-extern void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *,
-    uint32_t);
-
-extern errno_t ext4_directory_dx_init(ext4_inode_ref_t *);
-extern errno_t ext4_directory_dx_find_entry(ext4_directory_search_result_t *,
-    ext4_inode_ref_t *, size_t, const char *);
-extern errno_t ext4_directory_dx_add_entry(ext4_inode_ref_t *, ext4_inode_ref_t *,
-    const char *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/extent.h
===================================================================
--- uspace/lib/ext4/include/ext4/extent.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_EXTENT_H_
-#define LIBEXT4_EXTENT_H_
-
-#include "ext4/types.h"
-
-extern uint32_t ext4_extent_get_first_block(ext4_extent_t *);
-extern void ext4_extent_set_first_block(ext4_extent_t *, uint32_t);
-extern uint16_t ext4_extent_get_block_count(ext4_extent_t *);
-extern void ext4_extent_set_block_count(ext4_extent_t *, uint16_t);
-extern uint64_t ext4_extent_get_start(ext4_extent_t *);
-extern void ext4_extent_set_start(ext4_extent_t *, uint64_t);
-
-extern uint32_t ext4_extent_index_get_first_block(ext4_extent_index_t *);
-extern void ext4_extent_index_set_first_block(ext4_extent_index_t *, uint32_t);
-extern uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *);
-extern void ext4_extent_index_set_leaf(ext4_extent_index_t *, uint64_t);
-
-extern uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *);
-extern void ext4_extent_header_set_magic(ext4_extent_header_t *, uint16_t);
-extern uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *);
-extern void ext4_extent_header_set_entries_count(ext4_extent_header_t *,
-    uint16_t);
-extern uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *);
-extern void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *,
-    uint16_t);
-extern uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *);
-extern void ext4_extent_header_set_depth(ext4_extent_header_t *, uint16_t);
-extern uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *);
-extern void ext4_extent_header_set_generation(ext4_extent_header_t *, uint32_t);
-
-extern errno_t ext4_extent_find_block(ext4_inode_ref_t *, uint32_t, uint32_t *);
-extern errno_t ext4_extent_release_blocks_from(ext4_inode_ref_t *, uint32_t);
-
-extern errno_t ext4_extent_append_block(ext4_inode_ref_t *, uint32_t *, uint32_t *,
-    bool);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/filesystem.h
===================================================================
--- uspace/lib/ext4/include/ext4/filesystem.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_FILESYSTEM_H_
-#define LIBEXT4_FILESYSTEM_H_
-
-#include <block.h>
-#include "ext4/cfg.h"
-#include "ext4/fstypes.h"
-#include "ext4/types.h"
-
-extern errno_t ext4_filesystem_probe(service_id_t, ext4_fs_probe_info_t *);
-extern errno_t ext4_filesystem_create(ext4_cfg_t *, service_id_t);
-extern errno_t ext4_filesystem_open(ext4_instance_t *, service_id_t,
-    enum cache_mode, aoff64_t *, ext4_filesystem_t **);
-extern errno_t ext4_filesystem_close(ext4_filesystem_t *);
-extern uint32_t ext4_filesystem_blockaddr2_index_in_group(ext4_superblock_t *,
-    uint32_t);
-extern uint32_t ext4_filesystem_index_in_group2blockaddr(ext4_superblock_t *,
-    uint32_t, uint32_t);
-extern uint32_t ext4_filesystem_blockaddr2group(ext4_superblock_t *, uint64_t);
-extern errno_t ext4_filesystem_get_block_group_ref(ext4_filesystem_t *, uint32_t,
-    ext4_block_group_ref_t **);
-extern errno_t ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *);
-extern errno_t ext4_filesystem_get_inode_ref(ext4_filesystem_t *, uint32_t,
-    ext4_inode_ref_t **);
-extern errno_t ext4_filesystem_put_inode_ref(ext4_inode_ref_t *);
-extern errno_t ext4_filesystem_alloc_inode(ext4_filesystem_t *, ext4_inode_ref_t **,
-    int);
-extern errno_t ext4_filesystem_free_inode(ext4_inode_ref_t *);
-extern errno_t ext4_filesystem_truncate_inode(ext4_inode_ref_t *, aoff64_t);
-extern errno_t ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *,
-    aoff64_t iblock, uint32_t *);
-extern errno_t ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *,
-    aoff64_t, uint32_t);
-extern errno_t ext4_filesystem_release_inode_block(ext4_inode_ref_t *, uint32_t);
-extern errno_t ext4_filesystem_append_inode_block(ext4_inode_ref_t *, uint32_t *,
-    uint32_t *);
-uint32_t ext4_filesystem_bg_get_backup_blocks(ext4_block_group_ref_t *bg);
-uint32_t ext4_filesystem_bg_get_itable_size(ext4_superblock_t *sb,
-    uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/fstypes.h
===================================================================
--- uspace/lib/ext4/include/ext4/fstypes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_FSTYPES_H_
-#define LIBEXT4_FSTYPES_H_
-
-#include <adt/list.h>
-#include <libfs.h>
-#include <loc.h>
-#include "ext4/types.h"
-
-/**
- * Type for holding an instance of mounted partition.
- */
-typedef struct ext4_instance {
-	link_t link;
-	service_id_t service_id;
-	ext4_filesystem_t *filesystem;
-	unsigned int open_nodes_count;
-} ext4_instance_t;
-
-/**
- * Type for wrapping common fs_node and add some useful pointers.
- */
-typedef struct ext4_node {
-	ext4_instance_t *instance;
-	ext4_inode_ref_t *inode_ref;
-	fs_node_t *fs_node;
-	ht_link_t link;
-	unsigned int references;
-} ext4_node_t;
-
-#define EXT4_NODE(node) \
-	((node) ? (ext4_node_t *) (node)->data : NULL)
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/hash.h
===================================================================
--- uspace/lib/ext4/include/ext4/hash.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_HASH_H_
-#define LIBEXT4_HASH_H_
-
-#include "ext4/types.h"
-
-extern errno_t ext4_hash_string(ext4_hash_info_t *, int, const char *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/ialloc.h
===================================================================
--- uspace/lib/ext4/include/ext4/ialloc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_IALLOC_H_
-#define LIBEXT4_IALLOC_H_
-
-#include "ext4/types.h"
-
-extern errno_t ext4_ialloc_free_inode(ext4_filesystem_t *, uint32_t, bool);
-extern errno_t ext4_ialloc_alloc_inode(ext4_filesystem_t *, uint32_t *, bool);
-extern errno_t ext4_ialloc_alloc_this_inode(ext4_filesystem_t *, uint32_t,
-    bool);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/inode.h
===================================================================
--- uspace/lib/ext4/include/ext4/inode.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_INODE_H_
-#define LIBEXT4_INODE_H_
-
-#include <block.h>
-#include <stdint.h>
-#include "ext4/types.h"
-
-extern uint32_t ext4_inode_get_mode(ext4_superblock_t *, ext4_inode_t *);
-extern void ext4_inode_set_mode(ext4_superblock_t *, ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_uid(ext4_inode_t *);
-extern void ext4_inode_set_uid(ext4_inode_t *, uint32_t);
-extern uint64_t ext4_inode_get_size(ext4_superblock_t *, ext4_inode_t *);
-extern void ext4_inode_set_size(ext4_inode_t *, uint64_t);
-extern uint32_t ext4_inode_get_access_time(ext4_inode_t *);
-extern void ext4_inode_set_access_time(ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *);
-extern void ext4_inode_set_change_inode_time(ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_modification_time(ext4_inode_t *);
-extern void ext4_inode_set_modification_time(ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_deletion_time(ext4_inode_t *);
-extern void ext4_inode_set_deletion_time(ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_gid(ext4_inode_t *);
-extern void ext4_inode_set_gid(ext4_inode_t *, uint32_t);
-extern uint16_t ext4_inode_get_links_count(ext4_inode_t *);
-extern void ext4_inode_set_links_count(ext4_inode_t *, uint16_t);
-extern uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *,
-    ext4_inode_t *);
-extern errno_t ext4_inode_set_blocks_count(ext4_superblock_t *, ext4_inode_t *,
-    uint64_t);
-extern uint32_t ext4_inode_get_flags(ext4_inode_t *);
-extern void ext4_inode_set_flags(ext4_inode_t *, uint32_t);
-extern uint32_t ext4_inode_get_generation(ext4_inode_t *);
-extern void ext4_inode_set_generation(ext4_inode_t *, uint32_t);
-extern uint64_t ext4_inode_get_file_acl(ext4_inode_t *, ext4_superblock_t *);
-extern void ext4_inode_set_file_acl(ext4_inode_t *, ext4_superblock_t *,
-    uint64_t);
-
-extern uint32_t ext4_inode_get_direct_block(ext4_inode_t *, uint32_t);
-extern void ext4_inode_set_direct_block(ext4_inode_t *, uint32_t, uint32_t);
-extern uint32_t ext4_inode_get_indirect_block(ext4_inode_t *, uint32_t);
-extern void ext4_inode_set_indirect_block(ext4_inode_t *, uint32_t, uint32_t);
-extern ext4_extent_header_t *ext4_inode_get_extent_header(ext4_inode_t *);
-extern bool ext4_inode_is_type(ext4_superblock_t *, ext4_inode_t *, uint32_t);
-extern bool ext4_inode_has_flag(ext4_inode_t *, uint32_t);
-extern void ext4_inode_clear_flag(ext4_inode_t *, uint32_t);
-extern void ext4_inode_set_flag(ext4_inode_t *, uint32_t);
-extern bool ext4_inode_can_truncate(ext4_superblock_t *, ext4_inode_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/ops.h
===================================================================
--- uspace/lib/ext4/include/ext4/ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_OPS_H_
-#define LIBEXT4_OPS_H_
-
-#include <libfs.h>
-#include "ext4/fstypes.h"
-
-extern vfs_out_ops_t ext4_ops;
-extern libfs_ops_t ext4_libfs_ops;
-
-extern errno_t ext4_global_init(void);
-extern errno_t ext4_global_fini(void);
-
-extern errno_t ext4_node_get_core(fs_node_t **, ext4_instance_t *, fs_index_t);
-extern errno_t ext4_node_put(fs_node_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/superblock.h
===================================================================
--- uspace/lib/ext4/include/ext4/superblock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_SUPERBLOCK_H_
-#define LIBEXT4_SUPERBLOCK_H_
-
-#include <block.h>
-#include <stdint.h>
-#include <uuid.h>
-#include "ext4/cfg.h"
-#include "ext4/types.h"
-
-extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *);
-extern void ext4_superblock_set_inodes_count(ext4_superblock_t *, uint32_t);
-extern uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *);
-extern void ext4_superblock_set_blocks_count(ext4_superblock_t *, uint64_t);
-extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
-extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *,
-    uint64_t);
-extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
-extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *,
-    uint64_t);
-extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
-extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *,
-    uint32_t);
-extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
-extern void ext4_superblock_set_first_data_block(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *);
-extern void ext4_superblock_set_log_block_size(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
-extern void ext4_superblock_set_block_size(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_log_frag_size(ext4_superblock_t *);
-extern void ext4_superblock_set_log_frag_size(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_frag_size(ext4_superblock_t *);
-extern void ext4_superblock_set_frag_size(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *);
-extern void ext4_superblock_set_blocks_per_group(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_frags_per_group(ext4_superblock_t *);
-extern void ext4_superblock_set_frags_per_group(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
-extern void ext4_superblock_set_inodes_per_group(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *);
-extern void ext4_superblock_set_mount_time(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_write_time(ext4_superblock_t *);
-extern void ext4_superblock_set_write_time(ext4_superblock_t *, uint32_t);
-extern uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *);
-extern void ext4_superblock_set_mount_count(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *);
-extern void ext4_superblock_set_max_mount_count(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_magic(ext4_superblock_t *);
-extern void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic);
-extern uint16_t ext4_superblock_get_state(ext4_superblock_t *);
-extern void ext4_superblock_set_state(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_errors(ext4_superblock_t *);
-extern void ext4_superblock_set_errors(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *);
-extern void ext4_superblock_set_minor_rev_level(ext4_superblock_t *, uint16_t);
-extern uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *);
-extern void ext4_superblock_set_last_check_time(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *);
-extern void ext4_superblock_set_check_interval(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *);
-extern void ext4_superblock_set_creator_os(ext4_superblock_t *, uint32_t);
-extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
-extern void ext4_superblock_set_rev_level(ext4_superblock_t *, uint32_t);
-extern uint16_t ext4_superblock_get_def_resuid(ext4_superblock_t *);
-extern void ext4_superblock_set_def_resuid(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_def_resgid(ext4_superblock_t *);
-extern void ext4_superblock_set_def_resgid(ext4_superblock_t *, uint16_t);
-extern uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *);
-extern void ext4_superblock_set_first_inode(ext4_superblock_t *, uint32_t);
-extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
-extern void ext4_superblock_set_inode_size(ext4_superblock_t *, uint16_t);
-extern uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *);
-extern void ext4_superblock_set_block_group_index(ext4_superblock_t *,
-    uint16_t);
-extern uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *);
-extern void ext4_superblock_set_features_compatible(ext4_superblock_t *,
-    uint32_t);
-extern uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *);
-extern void ext4_superblock_set_features_incompatible(ext4_superblock_t *,
-    uint32_t);
-extern uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *);
-extern void ext4_superblock_set_features_read_only(ext4_superblock_t *,
-    uint32_t);
-
-extern void ext4_superblock_get_uuid(ext4_superblock_t *, uuid_t *);
-extern void ext4_superblock_set_uuid(ext4_superblock_t *, uuid_t *);
-extern errno_t ext4_superblock_get_volume_name(ext4_superblock_t *, char *,
-    size_t);
-extern errno_t ext4_superblock_set_volume_name(ext4_superblock_t *, const char *);
-extern const char *ext4_superblock_get_last_mounted(ext4_superblock_t *);
-extern void ext4_superblock_set_last_mounted(ext4_superblock_t *, const char *);
-
-extern uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *);
-extern void ext4_superblock_set_last_orphan(ext4_superblock_t *, uint32_t);
-extern const uint32_t *ext4_superblock_get_hash_seed(ext4_superblock_t *);
-extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
-    const uint32_t *);
-extern uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *);
-extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *,
-    uint8_t);
-
-extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *);
-extern void ext4_superblock_set_desc_size(ext4_superblock_t *, uint16_t);
-
-extern uint32_t ext4_superblock_get_flags(ext4_superblock_t *);
-extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
-
-extern void ext4_superblock_get_backup_groups_sparse2(ext4_superblock_t *sb,
-    uint32_t *g1, uint32_t *g2);
-extern void ext4_superblock_set_backup_groups_sparse2(ext4_superblock_t *sb,
-    uint32_t g1, uint32_t g2);
-
-extern uint32_t ext4_superblock_get_reserved_gdt_blocks(ext4_superblock_t *sb);
-extern void ext4_superblock_set_reserved_gdt_blocks(ext4_superblock_t *sb,
-    uint32_t n);
-extern uint32_t ext4_superblock_get_flex_group_size(ext4_superblock_t *sb);
-
-/* More complex superblock functions */
-extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
-extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *,
-    uint32_t);
-extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *,
-    uint32_t);
-extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *,
-    uint32_t);
-extern errno_t ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
-extern errno_t ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
-extern void ext4_superblock_release(ext4_superblock_t *);
-extern errno_t ext4_superblock_check_sanity(ext4_superblock_t *);
-
-extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
-extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *,
-    uint32_t);
-extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *,
-    uint32_t);
-extern errno_t ext4_superblock_create(size_t, uint64_t, ext4_cfg_t *,
-    ext4_superblock_t **);
-extern uint32_t ext4_superblock_get_group_backup_blocks(ext4_superblock_t *,
-    uint32_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/include/ext4/types.h
===================================================================
--- uspace/lib/ext4/include/ext4/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,564 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-#ifndef LIBEXT4_TYPES_H_
-#define LIBEXT4_TYPES_H_
-
-#include <block.h>
-
-/*
- * Structure of the super block
- */
-typedef struct ext4_superblock {
-	uint32_t inodes_count;              /* I-nodes count */
-	uint32_t blocks_count_lo;           /* Blocks count */
-	uint32_t reserved_blocks_count_lo;  /* Reserved blocks count */
-	uint32_t free_blocks_count_lo;      /* Free blocks count */
-	uint32_t free_inodes_count;         /* Free inodes count */
-	uint32_t first_data_block;          /* First Data Block */
-	uint32_t log_block_size;            /* Block size */
-	uint32_t log_frag_size;             /* Obsoleted fragment size */
-	uint32_t blocks_per_group;          /* Number of blocks per group */
-	uint32_t frags_per_group;           /* Obsoleted fragments per group */
-	uint32_t inodes_per_group;          /* Number of inodes per group */
-	uint32_t mount_time;                /* Mount time */
-	uint32_t write_time;                /* Write time */
-	uint16_t mount_count;               /* Mount count */
-	uint16_t max_mount_count;           /* Maximal mount count */
-	uint16_t magic;                     /* Magic signature */
-	uint16_t state;                     /* File system state */
-	uint16_t errors;                    /* Behaviour when detecting errors */
-	uint16_t minor_rev_level;           /* Minor revision level */
-	uint32_t last_check_time;           /* Time of last check */
-	uint32_t check_interval;            /* Maximum time between checks */
-	uint32_t creator_os;                /* Creator OS */
-	uint32_t rev_level;                 /* Revision level */
-	uint16_t def_resuid;                /* Default uid for reserved blocks */
-	uint16_t def_resgid;                /* Default gid for reserved blocks */
-
-	/* Fields for EXT4_DYNAMIC_REV superblocks only. */
-	uint32_t first_inode;             /* First non-reserved inode */
-	uint16_t inode_size;              /* Size of inode structure */
-	uint16_t block_group_index;       /* Block group index of this superblock */
-	uint32_t features_compatible;     /* Compatible feature set */
-	uint32_t features_incompatible;   /* Incompatible feature set */
-	uint32_t features_read_only;      /* Readonly-compatible feature set */
-	uint8_t uuid[16];                 /* 128-bit uuid for volume */
-	char volume_name[16];             /* Volume name */
-	char last_mounted[64];            /* Directory where last mounted */
-	uint32_t algorithm_usage_bitmap;  /* For compression */
-
-	/*
-	 * Performance hints. Directory preallocation should only
-	 * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
-	 */
-	uint8_t prealloc_blocks;        /* Number of blocks to try to preallocate */
-	uint8_t prealloc_dir_blocks;    /* Number to preallocate for dirs */
-	uint16_t reserved_gdt_blocks;   /* Per group desc for online growth */
-
-	/*
-	 * Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set.
-	 */
-	uint8_t journal_uuid[16];       /* UUID of journal superblock */
-	uint32_t journal_inode_number;  /* Inode number of journal file */
-	uint32_t journal_dev;           /* Device number of journal file */
-	uint32_t last_orphan;           /* Head of list of inodes to delete */
-	uint32_t hash_seed[4];          /* HTREE hash seed */
-	uint8_t default_hash_version;   /* Default hash version to use */
-	uint8_t journal_backup_type;
-	uint16_t desc_size;             /* Size of group descriptor */
-	uint32_t default_mount_opts;    /* Default mount options */
-	uint32_t first_meta_bg;         /* First metablock block group */
-	uint32_t mkfs_time;             /* When the filesystem was created */
-	uint32_t journal_blocks[17];    /* Backup of the journal inode */
-
-	/* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
-	uint32_t blocks_count_hi;           /* Blocks count */
-	uint32_t reserved_blocks_count_hi;  /* Reserved blocks count */
-	uint32_t free_blocks_count_hi;      /* Free blocks count */
-	uint16_t min_extra_isize;           /* All inodes have at least # bytes */
-	uint16_t want_extra_isize;          /* New inodes should reserve # bytes */
-	uint32_t flags;                     /* Miscellaneous flags */
-	uint16_t raid_stride;               /* RAID stride */
-	uint16_t mmp_interval;              /* # seconds to wait in MMP checking */
-	uint64_t mmp_block;                 /* Block for multi-mount protection */
-	uint32_t raid_stripe_width;         /* Blocks on all data disks (N * stride) */
-	uint8_t log_groups_per_flex;        /* FLEX_BG group size */
-	uint8_t reserved_char_pad;
-	uint16_t reserved_pad;
-	uint64_t kbytes_written;            /* Number of lifetime kilobytes written */
-	uint32_t snapshot_inum;             /* I-node number of active snapshot */
-	uint32_t snapshot_id;               /* Sequential ID of active snapshot */
-	uint64_t snapshot_r_blocks_count;   /* Reserved blocks for active snapshot's future use */
-	uint32_t snapshot_list;             /* I-node number of the head of the on-disk snapshot list */
-	uint32_t error_count;               /* Number of file system errors */
-	uint32_t first_error_time;          /* First time an error happened */
-	uint32_t first_error_ino;           /* I-node involved in first error */
-	uint64_t first_error_block;         /* Block involved of first error */
-	uint8_t first_error_func[32];       /* Function where the error happened */
-	uint32_t first_error_line;          /* Line number where error happened */
-	uint32_t last_error_time;           /* Most recent time of an error */
-	uint32_t last_error_ino;            /* I-node involved in last error */
-	uint32_t last_error_line;           /* Line number where error happened */
-	uint64_t last_error_block;          /* Block involved of last error */
-	uint8_t last_error_func[32];        /* Function where the error happened */
-	uint8_t mount_opts[64];             /* String containing the mount options */
-	uint32_t usr_quota_inum;            /* Inode number of user quota file */
-	uint32_t grp_quota_inum;            /* Inode number of group quota file */
-	uint32_t overhead_blocks;           /* Overhead blocks/clusters */
-	uint32_t backup_bgs[2];             /* Block groups containing superblock backups (if SPARSE_SUPER2) */
-	uint32_t encrypt_algos;             /* Encrypt algorithm in use */
-	uint32_t padding[105];              /* Padding to the end of the block */
-} ext4_superblock_t;
-
-#define EXT4_GOOD_OLD_REV 0
-#define EXT4_DYNAMIC_REV 1
-
-#define EXT4_SUPERBLOCK_MAGIC   0xEF53
-#define EXT4_SUPERBLOCK_SIZE    1024
-#define EXT4_SUPERBLOCK_OFFSET  1024
-
-#define EXT4_SUPERBLOCK_OS_LINUX  0
-#define EXT4_SUPERBLOCK_OS_HURD   1
-
-/*
- * Misc. filesystem flags
- */
-#define EXT4_SUPERBLOCK_FLAGS_SIGNED_HASH    0x0001  /* Signed dirhash in use */
-#define EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH  0x0002  /* Unsigned dirhash in use */
-#define EXT4_SUPERBLOCK_FLAGS_TEST_FILESYS   0x0004  /* to test development code */
-
-/*
- * Filesystem states
- */
-#define EXT4_SUPERBLOCK_STATE_VALID_FS   0x0001  /* Unmounted cleanly */
-#define EXT4_SUPERBLOCK_STATE_ERROR_FS   0x0002  /* Errors detected */
-#define EXT4_SUPERBLOCK_STATE_ORPHAN_FS  0x0004  /* Orphans being recovered */
-
-/*
- * Behaviour when errors detected
- */
-#define EXT4_SUPERBLOCK_ERRORS_CONTINUE  1  /* Continue execution */
-#define EXT4_SUPERBLOCK_ERRORS_RO        2  /* Remount fs read-only */
-#define EXT4_SUPERBLOCK_ERRORS_PANIC     3  /* Panic */
-#define EXT4_SUPERBLOCK_ERRORS_DEFAULT   EXT4_ERRORS_CONTINUE
-
-/*
- * Compatible features
- */
-#define EXT4_FEATURE_COMPAT_DIR_PREALLOC   0x0001
-#define EXT4_FEATURE_COMPAT_IMAGIC_INODES  0x0002
-#define EXT4_FEATURE_COMPAT_HAS_JOURNAL    0x0004
-#define EXT4_FEATURE_COMPAT_EXT_ATTR       0x0008
-#define EXT4_FEATURE_COMPAT_RESIZE_INODE   0x0010
-#define EXT4_FEATURE_COMPAT_DIR_INDEX      0x0020
-#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2  0x0200
-
-/*
- * Read-only compatible features
- */
-#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER  0x0001
-#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE    0x0002
-#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR     0x0004
-#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE     0x0008
-#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM      0x0010
-#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK     0x0020
-#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE   0x0040
-
-/*
- * Incompatible features
- */
-#define EXT4_FEATURE_INCOMPAT_COMPRESSION  0x0001
-#define EXT4_FEATURE_INCOMPAT_FILETYPE     0x0002
-#define EXT4_FEATURE_INCOMPAT_RECOVER      0x0004  /* Needs recovery */
-#define EXT4_FEATURE_INCOMPAT_JOURNAL_DEV  0x0008  /* Journal device */
-#define EXT4_FEATURE_INCOMPAT_META_BG      0x0010
-#define EXT4_FEATURE_INCOMPAT_EXTENTS      0x0040  /* extents support */
-#define EXT4_FEATURE_INCOMPAT_64BIT        0x0080
-#define EXT4_FEATURE_INCOMPAT_MMP          0x0100
-#define EXT4_FEATURE_INCOMPAT_FLEX_BG      0x0200
-#define EXT4_FEATURE_INCOMPAT_EA_INODE     0x0400  /* EA in inode */
-#define EXT4_FEATURE_INCOMPAT_DIRDATA      0x1000  /* data in dirent */
-
-#define EXT4_FEATURE_COMPAT_SUPP  (EXT4_FEATURE_COMPAT_DIR_INDEX)
-
-#define EXT4_FEATURE_INCOMPAT_SUPP \
-	(EXT4_FEATURE_INCOMPAT_FILETYPE | \
-	EXT4_FEATURE_INCOMPAT_EXTENTS | \
-	EXT4_FEATURE_INCOMPAT_64BIT | \
-	EXT4_FEATURE_INCOMPAT_FLEX_BG)
-
-#define EXT4_FEATURE_RO_COMPAT_SUPP \
-	(EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER | \
-	EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
-	EXT4_FEATURE_RO_COMPAT_HUGE_FILE | \
-	EXT4_FEATURE_RO_COMPAT_LARGE_FILE | \
-	EXT4_FEATURE_RO_COMPAT_GDT_CSUM | \
-	EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE)
-
-typedef struct ext4_filesystem {
-	service_id_t device;
-	ext4_superblock_t *superblock;
-	aoff64_t inode_block_limits[4];
-	aoff64_t inode_blocks_per_level[4];
-} ext4_filesystem_t;
-
-/** Size of buffer for volume name. To hold 16 latin-1 chars encoded as UTF-8
- * and a null terminator we need 2 * 16 + 1 bytes
- */
-#define EXT4_VOL_NAME_BYTES 33
-
-typedef struct {
-	char vol_name[EXT4_VOL_NAME_BYTES];
-} ext4_fs_probe_info_t;
-
-#define EXT4_BLOCK_GROUP_INODE_UNINIT   0x0001  /* Inode table/bitmap not in use */
-#define EXT4_BLOCK_GROUP_BLOCK_UNINIT   0x0002  /* Block bitmap not in use */
-#define EXT4_BLOCK_GROUP_ITABLE_ZEROED  0x0004  /* On-disk itable initialized to zero */
-
-/*
- * Structure of a blocks group descriptor
- */
-typedef struct ext4_block_group {
-	uint32_t block_bitmap_lo;             /* Blocks bitmap block */
-	uint32_t inode_bitmap_lo;             /* Inodes bitmap block */
-	uint32_t inode_table_first_block_lo;  /* Inodes table block */
-	uint16_t free_blocks_count_lo;        /* Free blocks count */
-	uint16_t free_inodes_count_lo;        /* Free inodes count */
-	uint16_t used_dirs_count_lo;          /* Directories count */
-	uint16_t flags;                       /* EXT4_BG_flags (INODE_UNINIT, etc) */
-	uint32_t reserved[2];                 /* Likely block/inode bitmap checksum */
-	uint16_t itable_unused_lo;            /* Unused inodes count */
-	uint16_t checksum;                    /* crc16(sb_uuid+group+desc) */
-
-	uint32_t block_bitmap_hi;             /* Blocks bitmap block MSB */
-	uint32_t inode_bitmap_hi;             /* I-nodes bitmap block MSB */
-	uint32_t inode_table_first_block_hi;  /* I-nodes table block MSB */
-	uint16_t free_blocks_count_hi;        /* Free blocks count MSB */
-	uint16_t free_inodes_count_hi;        /* Free i-nodes count MSB */
-	uint16_t used_dirs_count_hi;          /* Directories count MSB */
-	uint16_t itable_unused_hi;            /* Unused inodes count MSB */
-	uint32_t reserved2[3];                /* Padding */
-} ext4_block_group_t;
-
-typedef struct ext4_block_group_ref {
-	block_t *block;                   /* Reference to a block containing this block group descr */
-	ext4_block_group_t *block_group;
-	ext4_filesystem_t *fs;
-	uint32_t index;
-	bool dirty;
-} ext4_block_group_ref_t;
-
-#define EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE  32
-#define EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE  64
-
-#define EXT4_MIN_BLOCK_SIZE   1024   /* 1 KiB */
-#define EXT4_MAX_BLOCK_SIZE   65536  /* 64 KiB */
-#define EXT4_REV0_INODE_SIZE  128
-#define EXT4_REV0_FIRST_INO   11
-
-#define EXT4_INODE_BLOCK_SIZE  512
-
-#define EXT4_INODE_DIRECT_BLOCK_COUNT      12
-#define EXT4_INODE_INDIRECT_BLOCK          EXT4_INODE_DIRECT_BLOCK_COUNT
-#define EXT4_INODE_DOUBLE_INDIRECT_BLOCK   (EXT4_INODE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_TRIPPLE_INDIRECT_BLOCK  (EXT4_INODE_DOUBLE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_BLOCKS                  (EXT4_INODE_TRIPPLE_INDIRECT_BLOCK + 1)
-#define EXT4_INODE_INDIRECT_BLOCK_COUNT    (EXT4_INODE_BLOCKS - EXT4_INODE_DIRECT_BLOCK_COUNT)
-
-/*
- * Structure of an inode on the disk
- */
-typedef struct ext4_inode {
-	uint16_t mode;                       /* File mode */
-	uint16_t uid;                        /* Low 16 bits of owner uid */
-	uint32_t size_lo;                    /* Size in bytes */
-	uint32_t access_time;                /* Access time */
-	uint32_t change_inode_time;          /* I-node change time */
-	uint32_t modification_time;          /* Modification time */
-	uint32_t deletion_time;              /* Deletion time */
-	uint16_t gid;                        /* Low 16 bits of group id */
-	uint16_t links_count;                /* Links count */
-	uint32_t blocks_count_lo;            /* Blocks count */
-	uint32_t flags;                      /* File flags */
-	uint32_t unused_osd1;                /* OS dependent - not used in HelenOS */
-	uint32_t blocks[EXT4_INODE_BLOCKS];  /* Pointers to blocks */
-	uint32_t generation;                 /* File version (for NFS) */
-	uint32_t file_acl_lo;                /* File ACL */
-	uint32_t size_hi;
-	uint32_t obso_faddr;                 /* Obsoleted fragment address */
-
-	union {
-		struct {
-			uint16_t blocks_high;
-			uint16_t file_acl_high;
-			uint16_t uid_high;
-			uint16_t gid_high;
-			uint32_t reserved2;
-		} linux2;
-		struct {
-			uint16_t reserved1;
-			uint16_t mode_high;
-			uint16_t uid_high;
-			uint16_t gid_high;
-			uint32_t author;
-		} hurd2;
-	} osd2;
-
-	uint16_t extra_isize;
-	uint16_t pad1;
-	uint32_t ctime_extra;   /* Extra change time (nsec << 2 | epoch) */
-	uint32_t mtime_extra;   /* Extra Modification time (nsec << 2 | epoch) */
-	uint32_t atime_extra;   /* Extra Access time (nsec << 2 | epoch) */
-	uint32_t crtime;        /* File creation time */
-	uint32_t crtime_extra;  /* Extra file creation time (nsec << 2 | epoch) */
-	uint32_t version_hi;    /* High 32 bits for 64-bit version */
-} ext4_inode_t;
-
-#define EXT4_INODE_MODE_FIFO       0x1000
-#define EXT4_INODE_MODE_CHARDEV    0x2000
-#define EXT4_INODE_MODE_DIRECTORY  0x4000
-#define EXT4_INODE_MODE_BLOCKDEV   0x6000
-#define EXT4_INODE_MODE_FILE       0x8000
-#define EXT4_INODE_MODE_SOFTLINK   0xA000
-#define EXT4_INODE_MODE_SOCKET     0xC000
-#define EXT4_INODE_MODE_TYPE_MASK  0xF000
-
-/*
- * Inode flags
- */
-#define EXT4_INODE_FLAG_SECRM      0x00000001  /* Secure deletion */
-#define EXT4_INODE_FLAG_UNRM       0x00000002  /* Undelete */
-#define EXT4_INODE_FLAG_COMPR      0x00000004  /* Compress file */
-#define EXT4_INODE_FLAG_SYNC       0x00000008  /* Synchronous updates */
-#define EXT4_INODE_FLAG_IMMUTABLE  0x00000010  /* Immutable file */
-#define EXT4_INODE_FLAG_APPEND     0x00000020  /* writes to file may only append */
-#define EXT4_INODE_FLAG_NODUMP     0x00000040  /* do not dump file */
-#define EXT4_INODE_FLAG_NOATIME    0x00000080  /* do not update atime */
-
-/* Compression flags */
-#define EXT4_INODE_FLAG_DIRTY     0x00000100
-#define EXT4_INODE_FLAG_COMPRBLK  0x00000200  /* One or more compressed clusters */
-#define EXT4_INODE_FLAG_NOCOMPR   0x00000400  /* Don't compress */
-#define EXT4_INODE_FLAG_ECOMPR    0x00000800  /* Compression error */
-
-#define EXT4_INODE_FLAG_INDEX         0x00001000  /* hash-indexed directory */
-#define EXT4_INODE_FLAG_IMAGIC        0x00002000  /* AFS directory */
-#define EXT4_INODE_FLAG_JOURNAL_DATA  0x00004000  /* File data should be journaled */
-#define EXT4_INODE_FLAG_NOTAIL        0x00008000  /* File tail should not be merged */
-#define EXT4_INODE_FLAG_DIRSYNC       0x00010000  /* Dirsync behaviour (directories only) */
-#define EXT4_INODE_FLAG_TOPDIR        0x00020000  /* Top of directory hierarchies */
-#define EXT4_INODE_FLAG_HUGE_FILE     0x00040000  /* Set to each huge file */
-#define EXT4_INODE_FLAG_EXTENTS       0x00080000  /* Inode uses extents */
-#define EXT4_INODE_FLAG_EA_INODE      0x00200000  /* Inode used for large EA */
-#define EXT4_INODE_FLAG_EOFBLOCKS     0x00400000  /* Blocks allocated beyond EOF */
-#define EXT4_INODE_FLAG_RESERVED      0x80000000  /* reserved for ext4 lib */
-
-#define EXT4_INODE_ROOT_INDEX  2
-
-typedef struct ext4_inode_ref {
-	block_t *block;         /* Reference to a block containing this inode */
-	ext4_inode_t *inode;
-	ext4_filesystem_t *fs;
-	uint32_t index;         /* Index number of this inode */
-	bool dirty;
-} ext4_inode_ref_t;
-
-#define EXT4_DIRECTORY_FILENAME_LEN  255
-
-#define EXT4_DIRECTORY_FILETYPE_UNKNOWN   0
-#define EXT4_DIRECTORY_FILETYPE_REG_FILE  1
-#define EXT4_DIRECTORY_FILETYPE_DIR       2
-#define EXT4_DIRECTORY_FILETYPE_CHRDEV    3
-#define EXT4_DIRECTORY_FILETYPE_BLKDEV    4
-#define EXT4_DIRECTORY_FILETYPE_FIFO      5
-#define EXT4_DIRECTORY_FILETYPE_SOCK      6
-#define EXT4_DIRECTORY_FILETYPE_SYMLINK   7
-
-/**
- * Linked list directory entry structure
- */
-typedef struct ext4_directory_entry_ll {
-	uint32_t inode;         /* I-node for the entry */
-	uint16_t entry_length;  /* Distance to the next directory entry */
-	uint8_t name_length;    /* Lower 8 bits of name length */
-
-	union {
-		uint8_t name_length_high;  /* Higher 8 bits of name length */
-		uint8_t inode_type;        /* Type of referenced inode (in rev >= 0.5) */
-	};
-
-	uint8_t name[EXT4_DIRECTORY_FILENAME_LEN];  /* Entry name */
-} ext4_directory_entry_ll_t;
-
-typedef struct ext4_directory_iterator {
-	ext4_inode_ref_t *inode_ref;
-	block_t *current_block;
-	aoff64_t current_offset;
-	ext4_directory_entry_ll_t *current;
-} ext4_directory_iterator_t;
-
-typedef struct ext4_directory_search_result {
-	block_t *block;
-	ext4_directory_entry_ll_t *dentry;
-} ext4_directory_search_result_t;
-
-/* Structures for indexed directory */
-
-typedef struct ext4_directory_dx_countlimit {
-	uint16_t limit;
-	uint16_t count;
-} ext4_directory_dx_countlimit_t;
-
-typedef struct ext4_directory_dx_dot_entry {
-	uint32_t inode;
-	uint16_t entry_length;
-	uint8_t name_length;
-	uint8_t inode_type;
-	uint8_t name[4];
-} ext4_directory_dx_dot_entry_t;
-
-typedef struct ext4_directory_dx_root_info {
-	uint32_t reserved_zero;
-	uint8_t hash_version;
-	uint8_t info_length;
-	uint8_t indirect_levels;
-	uint8_t unused_flags;
-} ext4_directory_dx_root_info_t;
-
-typedef struct ext4_directory_dx_entry {
-	uint32_t hash;
-	uint32_t block;
-} ext4_directory_dx_entry_t;
-
-typedef struct ext4_directory_dx_root {
-	ext4_directory_dx_dot_entry_t dots[2];
-	ext4_directory_dx_root_info_t info;
-	ext4_directory_dx_entry_t entries[0];
-} ext4_directory_dx_root_t;
-
-typedef struct ext4_fake_directory_entry {
-	uint32_t inode;
-	uint16_t entry_length;
-	uint8_t name_length;
-	uint8_t inode_type;
-} ext4_fake_directory_entry_t;
-
-typedef struct ext4_directory_dx_node {
-	ext4_fake_directory_entry_t fake;
-	ext4_directory_dx_entry_t entries[0];
-} ext4_directory_dx_node_t;
-
-typedef struct ext4_directory_dx_block {
-	block_t *block;
-	ext4_directory_dx_entry_t *entries;
-	ext4_directory_dx_entry_t *position;
-} ext4_directory_dx_block_t;
-
-#define EXT4_DIRECTORY_HTREE_EOF  UINT32_C(0x7fffffff)
-
-/*
- * This is the extent on-disk structure.
- * It's used at the bottom of the tree.
- */
-typedef struct ext4_extent {
-	uint32_t first_block;  /* First logical block extent covers */
-	uint16_t block_count;  /* Number of blocks covered by extent */
-	uint16_t start_hi;     /* High 16 bits of physical block */
-	uint32_t start_lo;     /* Low 32 bits of physical block */
-} ext4_extent_t;
-
-/*
- * This is index on-disk structure.
- * It's used at all the levels except the bottom.
- */
-typedef struct ext4_extent_index {
-	uint32_t first_block;  /* Index covers logical blocks from 'block' */
-
-	/**
-	 * Pointer to the physical block of the next
-	 * level. leaf or next index could be there
-	 * high 16 bits of physical block
-	 */
-	uint32_t leaf_lo;
-	uint16_t leaf_hi;
-	uint16_t padding;
-} ext4_extent_index_t;
-
-/*
- * Each block (leaves and indexes), even inode-stored has header.
- */
-typedef struct ext4_extent_header {
-	uint16_t magic;
-	uint16_t entries_count;      /* Number of valid entries */
-	uint16_t max_entries_count;  /* Capacity of store in entries */
-	uint16_t depth;              /* Has tree real underlying blocks? */
-	uint32_t generation;         /* generation of the tree */
-} ext4_extent_header_t;
-
-typedef struct ext4_extent_path {
-	block_t *block;
-	uint16_t depth;
-	ext4_extent_header_t *header;
-	ext4_extent_index_t *index;
-	ext4_extent_t *extent;
-} ext4_extent_path_t;
-
-#define EXT4_EXTENT_MAGIC  0xF30A
-
-#define	EXT4_EXTENT_FIRST(header) \
-	((ext4_extent_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
-
-#define	EXT4_EXTENT_FIRST_INDEX(header) \
-	((ext4_extent_index_t *) (((void *) (header)) + sizeof(ext4_extent_header_t)))
-
-#define EXT4_HASH_VERSION_LEGACY             0
-#define EXT4_HASH_VERSION_HALF_MD4           1
-#define EXT4_HASH_VERSION_TEA                2
-#define EXT4_HASH_VERSION_LEGACY_UNSIGNED    3
-#define EXT4_HASH_VERSION_HALF_MD4_UNSIGNED  4
-#define EXT4_HASH_VERSION_TEA_UNSIGNED       5
-
-typedef struct ext4_hash_info {
-	uint32_t hash;
-	uint32_t minor_hash;
-	uint32_t hash_version;
-	const uint32_t *seed;
-} ext4_hash_info_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/ext4/meson.build
===================================================================
--- uspace/lib/ext4/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2012 Frantisek Princ
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block' , 'crypto' , 'fs' ]
-src = files(
-	'src/balloc.c',
-	'src/bitmap.c',
-	'src/block_group.c',
-	'src/directory.c',
-	'src/directory_index.c',
-	'src/extent.c',
-	'src/filesystem.c',
-	'src/hash.c',
-	'src/ialloc.c',
-	'src/inode.c',
-	'src/ops.c',
-	'src/superblock.c',
-)
Index: pace/lib/ext4/src/balloc.c
===================================================================
--- uspace/lib/ext4/src/balloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,704 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  balloc.c
- * @brief Physical block allocator.
- */
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "ext4/balloc.h"
-#include "ext4/bitmap.h"
-#include "ext4/block_group.h"
-#include "ext4/filesystem.h"
-#include "ext4/inode.h"
-#include "ext4/superblock.h"
-#include "ext4/types.h"
-
-/** Free block.
- *
- * @param inode_ref  Inode, where the block is allocated
- * @param block_addr Absolute block address to free
- *
- * @return Error code
- *
- */
-errno_t ext4_balloc_free_block(ext4_inode_ref_t *inode_ref, uint32_t block_addr)
-{
-	ext4_filesystem_t *fs = inode_ref->fs;
-	ext4_superblock_t *sb = fs->superblock;
-
-	/* Compute indexes */
-	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, block_addr);
-	uint32_t index_in_group =
-	    ext4_filesystem_blockaddr2_index_in_group(sb, block_addr);
-
-	/* Load block group reference */
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Load block with bitmap */
-	uint32_t bitmap_block_addr =
-	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Modify bitmap */
-	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
-	bitmap_block->dirty = true;
-
-	/* Release block with bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		/* Error in saving bitmap */
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks =
-	    ext4_superblock_get_free_blocks_count(sb);
-	sb_free_blocks++;
-	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
-	/* Update inode blocks count */
-	uint64_t ino_blocks =
-	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
-	ino_blocks -= block_size / EXT4_INODE_BLOCK_SIZE;
-	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
-	inode_ref->dirty = true;
-
-	/* Update block group free blocks count */
-	uint32_t free_blocks =
-	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-	free_blocks++;
-	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-	    sb, free_blocks);
-	bg_ref->dirty = true;
-
-	/* Release block group reference */
-	return ext4_filesystem_put_block_group_ref(bg_ref);
-}
-
-static errno_t ext4_balloc_free_blocks_internal(ext4_inode_ref_t *inode_ref,
-    uint32_t first, uint32_t count)
-{
-	ext4_filesystem_t *fs = inode_ref->fs;
-	ext4_superblock_t *sb = fs->superblock;
-
-	/* Compute indexes */
-	uint32_t block_group_first = ext4_filesystem_blockaddr2group(sb,
-	    first);
-	uint32_t block_group_last = ext4_filesystem_blockaddr2group(sb,
-	    first + count - 1);
-
-	assert(block_group_first == block_group_last);
-
-	/* Load block group reference */
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group_first, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	uint32_t index_in_group_first =
-	    ext4_filesystem_blockaddr2_index_in_group(sb, first);
-
-	/* Load block with bitmap */
-	uint32_t bitmap_block_addr =
-	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-
-	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Modify bitmap */
-	ext4_bitmap_free_bits(bitmap_block->data, index_in_group_first, count);
-	bitmap_block->dirty = true;
-
-	/* Release block with bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		/* Error in saving bitmap */
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks =
-	    ext4_superblock_get_free_blocks_count(sb);
-	sb_free_blocks += count;
-	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
-	/* Update inode blocks count */
-	uint64_t ino_blocks =
-	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
-	ino_blocks -= count * (block_size / EXT4_INODE_BLOCK_SIZE);
-	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
-	inode_ref->dirty = true;
-
-	/* Update block group free blocks count */
-	uint32_t free_blocks =
-	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-	free_blocks += count;
-	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-	    sb, free_blocks);
-	bg_ref->dirty = true;
-
-	/* Release block group reference */
-	return ext4_filesystem_put_block_group_ref(bg_ref);
-}
-
-/** Free continuous set of blocks.
- *
- * @param inode_ref Inode, where the blocks are allocated
- * @param first     First block to release
- * @param count     Number of blocks to release
- *
- */
-errno_t ext4_balloc_free_blocks(ext4_inode_ref_t *inode_ref,
-    uint32_t first, uint32_t count)
-{
-	errno_t r;
-	uint32_t gid;
-	uint64_t limit;
-	ext4_filesystem_t *fs = inode_ref->fs;
-	ext4_superblock_t *sb = fs->superblock;
-
-	while (count) {
-		gid = ext4_filesystem_blockaddr2group(sb, first);
-		limit = ext4_filesystem_index_in_group2blockaddr(sb, 0,
-		    gid + 1);
-
-		if ((first + count) >= limit) {
-			/*
-			 * This extent spans over 2 or more block groups,
-			 * we'll break it into smaller parts.
-			 */
-			uint32_t s = limit - first;
-
-			r = ext4_balloc_free_blocks_internal(inode_ref,
-			    first, s);
-			if (r != EOK)
-				return r;
-
-			first = limit;
-			count -= s;
-		} else {
-			return ext4_balloc_free_blocks_internal(inode_ref,
-			    first, count);
-		}
-	}
-
-	return EOK;
-}
-
-/** Compute first block for data in block group.
- *
- * @param sb   Pointer to superblock
- * @param bg   Pointer to block group
- * @param bgid Index of block group
- *
- * @return Absolute block index of first block
- *
- */
-uint32_t ext4_balloc_get_first_data_block_in_group(ext4_superblock_t *sb,
-    ext4_block_group_ref_t *bg_ref)
-{
-	uint32_t r;
-	uint64_t itable = ext4_block_group_get_inode_table_first_block(
-	    bg_ref->block_group, sb);
-	uint32_t itable_sz = ext4_filesystem_bg_get_itable_size(sb,
-	    bg_ref->index);
-
-	if (!ext4_superblock_has_feature_incompatible(sb,
-	    EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
-		/*
-		 * If we are not using FLEX_BG, the first data block
-		 * is always after the inode table.
-		 */
-		return itable + itable_sz;
-	}
-
-	uint32_t flex_group_size = ext4_superblock_get_flex_group_size(sb);
-	if ((bg_ref->index % flex_group_size) == 0) {
-		/* This is the base group */
-		uint32_t i;
-
-		r = itable + itable_sz;
-
-		uint32_t total_groups = ext4_superblock_get_block_group_count(sb);
-		for (i = bg_ref->index + 1;
-		    i < min(total_groups, bg_ref->index + flex_group_size); ++i) {
-			r += ext4_filesystem_bg_get_itable_size(sb, i);
-		}
-
-		return r;
-	}
-
-	uint64_t base_addr = ext4_filesystem_index_in_group2blockaddr(sb, 0,
-	    bg_ref->index);
-	uint32_t reserved = ext4_filesystem_bg_get_backup_blocks(bg_ref);
-
-	return base_addr + reserved;
-}
-
-/** Compute 'goal' for allocation algorithm.
- *
- * @param inode_ref Reference to inode, to allocate block for
- *
- * @return Goal block number
- *
- */
-static errno_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
-{
-	*goal = 0;
-	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
-	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint32_t inode_block_count = inode_size / block_size;
-
-	if (inode_size % block_size != 0)
-		inode_block_count++;
-
-	/* If inode has some blocks, get last block address + 1 */
-	if (inode_block_count > 0) {
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-		    inode_block_count - 1, goal);
-		if (rc != EOK)
-			return rc;
-
-		if (goal != 0) {
-			(*goal)++;
-			return EOK;
-		}
-		/* If goal == 0, sparse file -> continue */
-	}
-
-	/* Identify block group of inode */
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	uint32_t block_group = (inode_ref->index - 1) / inodes_per_group;
-
-	/* Load block group reference */
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
-	    block_group, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	*goal = ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
-
-	return ext4_filesystem_put_block_group_ref(bg_ref);
-}
-
-/** Data block allocation algorithm.
- *
- * @param inode_ref Inode to allocate block for
- * @param fblock    Allocated block address
- *
- * @return Error code
- *
- */
-errno_t ext4_balloc_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t *fblock)
-{
-	uint32_t allocated_block = 0;
-
-	uint32_t bitmap_block_addr;
-	block_t *bitmap_block;
-	uint32_t rel_block_idx = 0;
-	uint32_t free_blocks;
-	uint32_t goal;
-	uint32_t block_size;
-
-	/* Find GOAL */
-	errno_t rc = ext4_balloc_find_goal(inode_ref, &goal);
-	if (rc != EOK)
-		return rc;
-
-	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
-	/* Load block group number for goal and relative index */
-	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, goal);
-	uint32_t index_in_group =
-	    ext4_filesystem_blockaddr2_index_in_group(sb, goal);
-
-	/* Load block group reference */
-	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
-	    block_group, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	free_blocks =
-	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-	if (free_blocks == 0) {
-		/* This group has no free blocks */
-		goto goal_failed;
-	}
-
-	/* Compute indexes */
-	uint32_t first_in_group =
-	    ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
-
-	uint32_t first_in_group_index =
-	    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
-
-	if (index_in_group < first_in_group_index)
-		index_in_group = first_in_group_index;
-
-	/* Load block with bitmap */
-	bitmap_block_addr =
-	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-
-	rc = block_get(&bitmap_block, inode_ref->fs->device,
-	    bitmap_block_addr, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Check if goal is free */
-	if (ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group)) {
-		ext4_bitmap_set_bit(bitmap_block->data, index_in_group);
-		bitmap_block->dirty = true;
-		rc = block_put(bitmap_block);
-		if (rc != EOK) {
-			ext4_filesystem_put_block_group_ref(bg_ref);
-			return rc;
-		}
-
-		allocated_block =
-		    ext4_filesystem_index_in_group2blockaddr(sb, index_in_group,
-		    block_group);
-
-		goto success;
-	}
-
-	uint32_t blocks_in_group =
-	    ext4_superblock_get_blocks_in_group(sb, block_group);
-
-	uint32_t end_idx = (index_in_group + 63) & ~63;
-	if (end_idx > blocks_in_group)
-		end_idx = blocks_in_group;
-
-	/* Try to find free block near to goal */
-	for (uint32_t tmp_idx = index_in_group + 1; tmp_idx < end_idx;
-	    ++tmp_idx) {
-		if (ext4_bitmap_is_free_bit(bitmap_block->data, tmp_idx)) {
-			ext4_bitmap_set_bit(bitmap_block->data, tmp_idx);
-			bitmap_block->dirty = true;
-			rc = block_put(bitmap_block);
-			if (rc != EOK)
-				return rc;
-
-			allocated_block =
-			    ext4_filesystem_index_in_group2blockaddr(sb, tmp_idx,
-			    block_group);
-
-			goto success;
-		}
-	}
-
-	/* Find free BYTE in bitmap */
-	rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
-	    index_in_group, &rel_block_idx, blocks_in_group);
-	if (rc == EOK) {
-		bitmap_block->dirty = true;
-		rc = block_put(bitmap_block);
-		if (rc != EOK)
-			return rc;
-
-		allocated_block =
-		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
-		    block_group);
-
-		goto success;
-	}
-
-	/* Find free bit in bitmap */
-	rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
-	    index_in_group, &rel_block_idx, blocks_in_group);
-	if (rc == EOK) {
-		bitmap_block->dirty = true;
-		rc = block_put(bitmap_block);
-		if (rc != EOK)
-			return rc;
-
-		allocated_block =
-		    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
-		    block_group);
-
-		goto success;
-	}
-
-	/* No free block found yet */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-goal_failed:
-
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Try other block groups */
-	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-
-	uint32_t bgid = (block_group + 1) % block_group_count;
-	uint32_t count = block_group_count;
-
-	while (count > 0) {
-		rc = ext4_filesystem_get_block_group_ref(inode_ref->fs, bgid,
-		    &bg_ref);
-		if (rc != EOK)
-			return rc;
-
-		free_blocks =
-		    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-		if (free_blocks == 0) {
-			/* This group has no free blocks */
-			goto next_group;
-		}
-
-		/* Load block with bitmap */
-		bitmap_block_addr =
-		    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-
-		rc = block_get(&bitmap_block, inode_ref->fs->device,
-		    bitmap_block_addr, 0);
-		if (rc != EOK) {
-			ext4_filesystem_put_block_group_ref(bg_ref);
-			return rc;
-		}
-
-		/* Compute indexes */
-		first_in_group =
-		    ext4_balloc_get_first_data_block_in_group(sb, bg_ref);
-		index_in_group =
-		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
-		blocks_in_group = ext4_superblock_get_blocks_in_group(sb, bgid);
-
-		first_in_group_index =
-		    ext4_filesystem_blockaddr2_index_in_group(sb, first_in_group);
-
-		if (index_in_group < first_in_group_index)
-			index_in_group = first_in_group_index;
-
-		/* Try to find free byte in bitmap */
-		rc = ext4_bitmap_find_free_byte_and_set_bit(bitmap_block->data,
-		    index_in_group, &rel_block_idx, blocks_in_group);
-		if (rc == EOK) {
-			bitmap_block->dirty = true;
-			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
-				return rc;
-			}
-
-			allocated_block =
-			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
-			    bgid);
-
-			goto success;
-		}
-
-		/* Try to find free bit in bitmap */
-		rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
-		    index_in_group, &rel_block_idx, blocks_in_group);
-		if (rc == EOK) {
-			bitmap_block->dirty = true;
-			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
-				return rc;
-			}
-
-			allocated_block =
-			    ext4_filesystem_index_in_group2blockaddr(sb, rel_block_idx,
-			    bgid);
-
-			goto success;
-		}
-
-		rc = block_put(bitmap_block);
-		if (rc != EOK) {
-			ext4_filesystem_put_block_group_ref(bg_ref);
-			return rc;
-		}
-
-	next_group:
-		rc = ext4_filesystem_put_block_group_ref(bg_ref);
-		if (rc != EOK)
-			return rc;
-
-		/* Goto next group */
-		bgid = (bgid + 1) % block_group_count;
-		count--;
-	}
-
-	return ENOSPC;
-
-success:
-	block_size = ext4_superblock_get_block_size(sb);
-
-	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
-	sb_free_blocks--;
-	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
-	/* Update inode blocks (different block size!) count */
-	uint64_t ino_blocks =
-	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
-	ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
-	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
-	inode_ref->dirty = true;
-
-	/* Update block group free blocks count */
-	uint32_t bg_free_blocks =
-	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-	bg_free_blocks--;
-	ext4_block_group_set_free_blocks_count(bg_ref->block_group, sb,
-	    bg_free_blocks);
-	bg_ref->dirty = true;
-
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-
-	*fblock = allocated_block;
-	return rc;
-}
-
-/** Try to allocate concrete block.
- *
- * @param inode_ref Inode to allocate block for
- * @param fblock    Block address to allocate
- * @param free      Output value - if target block is free
- *
- * @return Error code
- *
- */
-errno_t ext4_balloc_try_alloc_block(ext4_inode_ref_t *inode_ref, uint32_t fblock,
-    bool *free)
-{
-	errno_t rc;
-
-	ext4_filesystem_t *fs = inode_ref->fs;
-	ext4_superblock_t *sb = fs->superblock;
-
-	/* Compute indexes */
-	uint32_t block_group = ext4_filesystem_blockaddr2group(sb, fblock);
-	uint32_t index_in_group =
-	    ext4_filesystem_blockaddr2_index_in_group(sb, fblock);
-
-	/* Load block group reference */
-	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Load block with bitmap */
-	uint32_t bitmap_block_addr =
-	    ext4_block_group_get_block_bitmap(bg_ref->block_group, sb);
-	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Check if block is free */
-	*free = ext4_bitmap_is_free_bit(bitmap_block->data, index_in_group);
-
-	/* Allocate block if possible */
-	if (*free) {
-		ext4_bitmap_set_bit(bitmap_block->data, index_in_group);
-		bitmap_block->dirty = true;
-	}
-
-	/* Release block with bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		/* Error in saving bitmap */
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* If block is not free, return */
-	if (!(*free))
-		goto terminate;
-
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	/* Update superblock free blocks count */
-	uint32_t sb_free_blocks = ext4_superblock_get_free_blocks_count(sb);
-	sb_free_blocks--;
-	ext4_superblock_set_free_blocks_count(sb, sb_free_blocks);
-
-	/* Update inode blocks count */
-	uint64_t ino_blocks =
-	    ext4_inode_get_blocks_count(sb, inode_ref->inode);
-	ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE;
-	ext4_inode_set_blocks_count(sb, inode_ref->inode, ino_blocks);
-	inode_ref->dirty = true;
-
-	/* Update block group free blocks count */
-	uint32_t free_blocks =
-	    ext4_block_group_get_free_blocks_count(bg_ref->block_group, sb);
-	free_blocks--;
-	ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-	    sb, free_blocks);
-	bg_ref->dirty = true;
-
-terminate:
-	return ext4_filesystem_put_block_group_ref(bg_ref);
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/bitmap.c
===================================================================
--- uspace/lib/ext4/src/bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,269 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  bitmap.c
- * @brief Ext4 bitmap operations.
- */
-
-#include <errno.h>
-#include <block.h>
-#include <stdint.h>
-#include "ext4/bitmap.h"
-
-/** Set bit in bitmap to 0 (free).
- *
- * Index must be checked by caller, if it's not out of bounds.
- *
- * @param bitmap Pointer to bitmap
- * @param index  Index of bit in bitmap
- *
- */
-void ext4_bitmap_free_bit(uint8_t *bitmap, uint32_t index)
-{
-	uint32_t byte_index = index / 8;
-	uint32_t bit_index = index % 8;
-
-	uint8_t *target = bitmap + byte_index;
-
-	*target &= ~(1 << bit_index);
-}
-
-/** Free continous set of bits (set to 0).
- *
- * Index and count must be checked by caller, if they aren't out of bounds.
- *
- * @param bitmap Pointer to bitmap
- * @param index  Index of first bit to zeroed
- * @param count  Number of bits to be zeroed
- *
- */
-void ext4_bitmap_free_bits(uint8_t *bitmap, uint32_t index, uint32_t count)
-{
-	uint8_t *target;
-	uint32_t idx = index;
-	uint32_t remaining = count;
-	uint32_t byte_index;
-
-	/* Align index to multiple of 8 */
-	while (((idx % 8) != 0) && (remaining > 0)) {
-		byte_index = idx / 8;
-		uint32_t bit_index = idx % 8;
-
-		target = bitmap + byte_index;
-		*target &= ~(1 << bit_index);
-
-		idx++;
-		remaining--;
-	}
-
-	/* For < 8 bits this check necessary */
-	if (remaining == 0)
-		return;
-
-	assert((idx % 8) == 0);
-
-	byte_index = idx / 8;
-	target = bitmap + byte_index;
-
-	/* Zero the whole bytes */
-	while (remaining >= 8) {
-		*target = 0;
-
-		idx += 8;
-		remaining -= 8;
-		target++;
-	}
-
-	assert(remaining < 8);
-
-	/* Zero remaining bytes */
-	while (remaining != 0) {
-		byte_index = idx / 8;
-		uint32_t bit_index = idx % 8;
-
-		target = bitmap + byte_index;
-		*target &= ~(1 << bit_index);
-
-		idx++;
-		remaining--;
-	}
-}
-
-/** Set bit in bitmap to 1 (used).
- *
- * @param bitmap Pointer to bitmap
- * @param index  Index of bit to set
- *
- */
-void ext4_bitmap_set_bit(uint8_t *bitmap, uint32_t index)
-{
-	uint32_t byte_index = index / 8;
-	uint32_t bit_index = index % 8;
-
-	uint8_t *target = bitmap + byte_index;
-
-	*target |= 1 << bit_index;
-}
-
-/** Check if requested bit is free.
- *
- * @param bitmap Pointer to bitmap
- * @param index  Index of bit to be checked
- *
- * @return True if bit is free, else false
- *
- */
-bool ext4_bitmap_is_free_bit(uint8_t *bitmap, uint32_t index)
-{
-	uint32_t byte_index = index / 8;
-	uint32_t bit_index = index % 8;
-
-	uint8_t *target = bitmap + byte_index;
-
-	if (*target & (1 << bit_index))
-		return false;
-	else
-		return true;
-}
-
-/** Try to find free byte and set the first bit as used.
- *
- * Walk through bitmap and try to find free byte (equal to 0).
- * If byte found, set the first bit as used.
- *
- * @param bitmap Pointer to bitmap
- * @param start  Index of bit, where the algorithm will begin
- * @param index  Output value - index of bit (if found free byte)
- * @param max    Maximum index of bit in bitmap
- *
- * @return Error code
- *
- */
-errno_t ext4_bitmap_find_free_byte_and_set_bit(uint8_t *bitmap, uint32_t start,
-    uint32_t *index, uint32_t max)
-{
-	uint32_t idx;
-
-	/* Align idx */
-	if (start % 8)
-		idx = start + (8 - (start % 8));
-	else
-		idx = start;
-
-	uint8_t *pos = bitmap + (idx / 8);
-
-	/* Try to find free byte */
-	while (idx < max) {
-		if (*pos == 0) {
-			*pos |= 1;
-
-			*index = idx;
-			return EOK;
-		}
-
-		idx += 8;
-		++pos;
-	}
-
-	/* Free byte not found */
-	return ENOSPC;
-}
-
-/** Try to find free bit and set it as used (1).
- *
- * Walk through bitmap and try to find any free bit.
- *
- * @param bitmap    Pointer to bitmap
- * @param start_idx Index of bit, where algorithm will begin
- * @param index     Output value - index of set bit (if found)
- * @param max       Maximum index of bit in bitmap
- *
- * @return Error code
- *
- */
-errno_t ext4_bitmap_find_free_bit_and_set(uint8_t *bitmap, uint32_t start_idx,
-    uint32_t *index, uint32_t max)
-{
-	uint8_t *pos = bitmap + (start_idx / 8);
-	uint32_t idx = start_idx;
-	bool byte_part = false;
-
-	/* Check the rest of first byte */
-	while ((idx % 8) != 0) {
-		byte_part = true;
-
-		if ((*pos & (1 << (idx % 8))) == 0) {
-			*pos |= (1 << (idx % 8));
-			*index = idx;
-			return EOK;
-		}
-
-		++idx;
-	}
-
-	if (byte_part)
-		++pos;
-
-	/* Check the whole bytes (255 = 11111111 binary) */
-	while (idx < max) {
-		if ((*pos & 255) != 255) {
-			/* Free bit found */
-			break;
-		}
-
-		idx += 8;
-		++pos;
-	}
-
-	/* If idx < max, some free bit found */
-	if (idx < max) {
-		/* Check which bit from byte is free */
-		for (uint8_t i = 0; i < 8; ++i) {
-			if ((*pos & (1 << i)) == 0) {
-				/* Free bit found */
-				*pos |= (1 << i);
-
-				*index = idx;
-				return EOK;
-			}
-
-			idx++;
-		}
-	}
-
-	/* Free bit not found */
-	return ENOSPC;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/block_group.c
===================================================================
--- uspace/lib/ext4/src/block_group.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,387 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  block_group.c
- * @brief Ext4 block group structure operations.
- */
-
-#include <byteorder.h>
-#include "ext4/block_group.h"
-#include "ext4/superblock.h"
-
-/** Get address of block with data block bitmap.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Address of block with block bitmap
- *
- */
-uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint64_t) uint32_t_le2host(bg->block_bitmap_hi) << 32) |
-		    uint32_t_le2host(bg->block_bitmap_lo);
-	else
-		return uint32_t_le2host(bg->block_bitmap_lo);
-}
-
-/** Set address of block with data block bitmap.
- *
- * @param bg           Pointer to block group
- * @param sb           Pointer to superblock
- * @param block_bitmap Address of block with block bitmap
- *
- */
-void ext4_block_group_set_block_bitmap(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint64_t block_bitmap)
-{
-	bg->block_bitmap_lo = host2uint32_t_le((block_bitmap << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->block_bitmap_hi = host2uint32_t_le(block_bitmap >> 32);
-}
-
-/** Get address of block with i-node bitmap.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Address of block with i-node bitmap
- *
- */
-uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint64_t) uint32_t_le2host(bg->inode_bitmap_hi) << 32) |
-		    uint32_t_le2host(bg->inode_bitmap_lo);
-	else
-		return uint32_t_le2host(bg->inode_bitmap_lo);
-}
-
-/** Set address of block with i-node bitmap.
- *
- * @param bg           Pointer to block group
- * @param sb           Pointer to superblock
- * @param inode_bitmap Address of block with i-node bitmap
- *
- */
-void ext4_block_group_set_inode_bitmap(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint64_t inode_bitmap)
-{
-	bg->inode_bitmap_lo = host2uint32_t_le((inode_bitmap << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->inode_bitmap_hi = host2uint32_t_le(inode_bitmap >> 32);
-}
-
-/** Get address of the first block of the i-node table.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Address of first block of i-node table
- *
- */
-uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint64_t)
-		    uint32_t_le2host(bg->inode_table_first_block_hi) << 32) |
-		    uint32_t_le2host(bg->inode_table_first_block_lo);
-	else
-		return uint32_t_le2host(bg->inode_table_first_block_lo);
-}
-
-/** Set address of the first block of the i-node table.
- *
- * @param bg                Pointer to block group
- * @param sb                Pointer to superblock
- * @param inode_table_first Address of first block of i-node table
- *
- */
-void ext4_block_group_set_inode_table_first_block(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint64_t inode_table_first)
-{
-	bg->inode_table_first_block_lo =
-	    host2uint32_t_le((inode_table_first << 32) >> 32);
-
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->inode_table_first_block_hi =
-		    host2uint32_t_le(inode_table_first >> 32);
-}
-
-/** Get number of free blocks in block group.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Number of free blocks in block group
- *
- */
-uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint32_t)
-		    uint16_t_le2host(bg->free_blocks_count_hi) << 16) |
-		    uint16_t_le2host(bg->free_blocks_count_lo);
-	else
-		return uint16_t_le2host(bg->free_blocks_count_lo);
-}
-
-/** Set number of free blocks in block group.
- *
- * @param bg    Pointer to block group
- * @param sb    Pointer to superblock
- * @param value Number of free blocks in block group
- *
- */
-void ext4_block_group_set_free_blocks_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint32_t value)
-{
-	bg->free_blocks_count_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->free_blocks_count_hi = host2uint16_t_le(value >> 16);
-}
-
-/** Get number of free i-nodes in block group.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Number of free i-nodes in block group
- *
- */
-uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint32_t)
-		    uint16_t_le2host(bg->free_inodes_count_hi) << 16) |
-		    uint16_t_le2host(bg->free_inodes_count_lo);
-	else
-		return uint16_t_le2host(bg->free_inodes_count_lo);
-}
-
-/** Set number of free i-nodes in block group.
- *
- * @param bg    Pointer to block group
- * @param sb    Pointer to superblock
- * @param value Number of free i-nodes in block group
- *
- */
-void ext4_block_group_set_free_inodes_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint32_t value)
-{
-	bg->free_inodes_count_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->free_inodes_count_hi = host2uint16_t_le(value >> 16);
-}
-
-/** Get number of used directories in block group.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Number of used directories in block group
- *
- */
-uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint32_t)
-		    uint16_t_le2host(bg->used_dirs_count_hi) << 16) |
-		    uint16_t_le2host(bg->used_dirs_count_lo);
-	else
-		return uint16_t_le2host(bg->used_dirs_count_lo);
-}
-
-/** Set number of used directories in block group.
- *
- * @param bg    Pointer to block group
- * @param sb    Pointer to superblock
- * @param value Number of used directories in block group
- *
- */
-void ext4_block_group_set_used_dirs_count(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint32_t count)
-{
-	bg->used_dirs_count_lo = host2uint16_t_le((count << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->used_dirs_count_hi = host2uint16_t_le(count >> 16);
-}
-
-/** Get flags of block group.
- *
- * @param bg Pointer to block group
- *
- * @return Flags of block group
- *
- */
-uint16_t ext4_block_group_get_flags(ext4_block_group_t *bg)
-{
-	return uint16_t_le2host(bg->flags);
-}
-
-/** Set flags for block group.
- *
- * @param bg    Pointer to block group
- * @param flags Flags for block group
- *
- */
-void ext4_block_group_set_flags(ext4_block_group_t *bg, uint16_t flags)
-{
-	bg->flags = host2uint16_t_le(flags);
-}
-
-/** Get number of unused i-nodes.
- *
- * @param bg Pointer to block group
- * @param sb Pointer to superblock
- *
- * @return Number of unused i-nodes
- *
- */
-uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *bg,
-    ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ((uint32_t)
-		    uint16_t_le2host(bg->itable_unused_hi) << 16) |
-		    uint16_t_le2host(bg->itable_unused_lo);
-	else
-		return uint16_t_le2host(bg->itable_unused_lo);
-}
-
-/** Set number of unused i-nodes.
- *
- * @param bg    Pointer to block group
- * @param sb    Pointer to superblock
- * @param value Number of unused i-nodes
- *
- */
-void ext4_block_group_set_itable_unused(ext4_block_group_t *bg,
-    ext4_superblock_t *sb, uint32_t value)
-{
-	bg->itable_unused_lo = host2uint16_t_le((value << 16) >> 16);
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		bg->itable_unused_hi = host2uint16_t_le(value >> 16);
-}
-
-/** Get checksum of block group.
- *
- * @param bg Pointer to block group
- *
- * @return checksum of block group
- *
- */
-uint16_t ext4_block_group_get_checksum(ext4_block_group_t *bg)
-{
-	return uint16_t_le2host(bg->checksum);
-}
-
-/** Set checksum of block group.
- *
- * @param bg       Pointer to block group
- * @param checksum Cheksum of block group
- *
- */
-void ext4_block_group_set_checksum(ext4_block_group_t *bg, uint16_t checksum)
-{
-	bg->checksum = host2uint16_t_le(checksum);
-}
-
-/** Check if block group has a flag.
- *
- * @param bg   Pointer to block group
- * @param flag Flag to be checked
- *
- * @return True if flag is set to 1
- *
- */
-bool ext4_block_group_has_flag(ext4_block_group_t *bg, uint32_t flag)
-{
-	if (ext4_block_group_get_flags(bg) & flag)
-		return true;
-
-	return false;
-}
-
-/** Set (add) flag of block group.
- *
- * @param bg   Pointer to block group
- * @param flag Flag to be set
- *
- */
-void ext4_block_group_set_flag(ext4_block_group_t *bg, uint32_t set_flag)
-{
-	uint32_t flags = ext4_block_group_get_flags(bg);
-	flags = flags | set_flag;
-	ext4_block_group_set_flags(bg, flags);
-}
-
-/** Clear (remove) flag of block group.
- *
- * @param bg   Pointer to block group
- * @param flag Flag to be cleared
- *
- */
-void ext4_block_group_clear_flag(ext4_block_group_t *bg, uint32_t clear_flag)
-{
-	uint32_t flags = ext4_block_group_get_flags(bg);
-	flags = flags & (~clear_flag);
-	ext4_block_group_set_flags(bg, flags);
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/directory.c
===================================================================
--- uspace/lib/ext4/src/directory.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,771 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  directory.c
- * @brief Ext4 directory structure operations.
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "ext4/directory.h"
-#include "ext4/directory_index.h"
-#include "ext4/filesystem.h"
-#include "ext4/inode.h"
-#include "ext4/superblock.h"
-
-/** Get i-node number from directory entry.
- *
- * @param de Directory entry
- *
- * @return I-node number
- *
- */
-uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *de)
-{
-	return uint32_t_le2host(de->inode);
-}
-
-/** Set i-node number to directory entry.
- *
- * @param de    Directory entry
- * @param inode I-node number
- *
- */
-void ext4_directory_entry_ll_set_inode(ext4_directory_entry_ll_t *de,
-    uint32_t inode)
-{
-	de->inode = host2uint32_t_le(inode);
-}
-
-/** Get directory entry length.
- *
- * @param de Directory entry
- *
- * @return Entry length
- *
- */
-uint16_t ext4_directory_entry_ll_get_entry_length(ext4_directory_entry_ll_t *de)
-{
-	return uint16_t_le2host(de->entry_length);
-}
-
-/** Set directory entry length.
- *
- * @param de     Directory entry
- * @param length Entry length
- *
- */
-void ext4_directory_entry_ll_set_entry_length(ext4_directory_entry_ll_t *de,
-    uint16_t length)
-{
-	de->entry_length = host2uint16_t_le(length);
-}
-
-/** Get directory entry name length.
- *
- * @param sb Superblock
- * @param de Directory entry
- *
- * @return Entry name length
- *
- */
-uint16_t ext4_directory_entry_ll_get_name_length(ext4_superblock_t *sb,
-    ext4_directory_entry_ll_t *de)
-{
-	if ((ext4_superblock_get_rev_level(sb) == 0) &&
-	    (ext4_superblock_get_minor_rev_level(sb) < 5))
-		return ((uint16_t)de->name_length_high) << 8 |
-		    ((uint16_t)de->name_length);
-
-	return de->name_length;
-
-}
-
-/** Set directory entry name length.
- *
- * @param sb     Superblock
- * @param de     Directory entry
- * @param length Entry name length
- *
- */
-void ext4_directory_entry_ll_set_name_length(ext4_superblock_t *sb,
-    ext4_directory_entry_ll_t *de, uint16_t length)
-{
-	de->name_length = (length << 8) >> 8;
-
-	if ((ext4_superblock_get_rev_level(sb) == 0) &&
-	    (ext4_superblock_get_minor_rev_level(sb) < 5))
-		de->name_length_high = length >> 8;
-
-	/* Else do nothing */
-}
-
-/** Get i-node type of directory entry.
- *
- * @param sb Superblock
- * @param de Directory entry
- *
- * @return I-node type (file, dir, etc.)
- *
- */
-uint8_t ext4_directory_entry_ll_get_inode_type(ext4_superblock_t *sb,
-    ext4_directory_entry_ll_t *de)
-{
-	if ((ext4_superblock_get_rev_level(sb) > 0) ||
-	    (ext4_superblock_get_minor_rev_level(sb) >= 5))
-		return de->inode_type;
-
-	return EXT4_DIRECTORY_FILETYPE_UNKNOWN;
-}
-
-/** Set i-node type of directory entry.
- *
- * @param sb   Superblock
- * @param de   Directory entry
- * @param type I-node type (file, dir, etc.)
- *
- */
-void ext4_directory_entry_ll_set_inode_type(ext4_superblock_t *sb,
-    ext4_directory_entry_ll_t *de, uint8_t type)
-{
-	if ((ext4_superblock_get_rev_level(sb) > 0) ||
-	    (ext4_superblock_get_minor_rev_level(sb) >= 5))
-		de->inode_type = type;
-
-	/* Else do nothing */
-}
-
-static errno_t ext4_directory_iterator_seek(ext4_directory_iterator_t *, aoff64_t);
-static errno_t ext4_directory_iterator_set(ext4_directory_iterator_t *, uint32_t);
-
-/** Initialize directory iterator.
- *
- * Set position to the first valid entry from the required position.
- *
- * @param it        Pointer to iterator to be initialized
- * @param inode_ref Directory i-node
- * @param pos       Position to start reading entries from
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_iterator_init(ext4_directory_iterator_t *it,
-    ext4_inode_ref_t *inode_ref, aoff64_t pos)
-{
-	it->inode_ref = inode_ref;
-	it->current = NULL;
-	it->current_offset = 0;
-	it->current_block = NULL;
-
-	return ext4_directory_iterator_seek(it, pos);
-}
-
-/** Jump to the next valid entry
- *
- * @param it Initialized iterator
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_iterator_next(ext4_directory_iterator_t *it)
-{
-	assert(it->current != NULL);
-
-	uint16_t skip = ext4_directory_entry_ll_get_entry_length(it->current);
-
-	return ext4_directory_iterator_seek(it, it->current_offset + skip);
-}
-
-/** Seek to next valid directory entry.
- *
- * Here can be jumped to the next data block.
- *
- * @param it  Initialized iterator
- * @param pos Position of the next entry
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_iterator_seek(ext4_directory_iterator_t *it, aoff64_t pos)
-{
-	uint64_t size = ext4_inode_get_size(it->inode_ref->fs->superblock,
-	    it->inode_ref->inode);
-
-	/* The iterator is not valid until we seek to the desired position */
-	it->current = NULL;
-
-	/* Are we at the end? */
-	if (pos >= size) {
-		if (it->current_block) {
-			errno_t rc = block_put(it->current_block);
-			it->current_block = NULL;
-
-			if (rc != EOK)
-				return rc;
-		}
-
-		it->current_offset = pos;
-		return EOK;
-	}
-
-	/* Compute next block address */
-	uint32_t block_size =
-	    ext4_superblock_get_block_size(it->inode_ref->fs->superblock);
-	aoff64_t current_block_idx = it->current_offset / block_size;
-	aoff64_t next_block_idx = pos / block_size;
-
-	/*
-	 * If we don't have a block or are moving accross block boundary,
-	 * we need to get another block
-	 */
-	if ((it->current_block == NULL) ||
-	    (current_block_idx != next_block_idx)) {
-		if (it->current_block) {
-			errno_t rc = block_put(it->current_block);
-			it->current_block = NULL;
-
-			if (rc != EOK)
-				return rc;
-		}
-
-		uint32_t next_block_phys_idx;
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(it->inode_ref,
-		    next_block_idx, &next_block_phys_idx);
-		if (rc != EOK)
-			return rc;
-
-		rc = block_get(&it->current_block, it->inode_ref->fs->device,
-		    next_block_phys_idx, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			it->current_block = NULL;
-			return rc;
-		}
-	}
-
-	it->current_offset = pos;
-
-	return ext4_directory_iterator_set(it, block_size);
-}
-
-/** Do some checks before returning iterator.
- *
- * @param it         Iterator to be checked
- * @param block_size Size of data block
- *
- * @return Error code
- *
- */
-static errno_t ext4_directory_iterator_set(ext4_directory_iterator_t *it,
-    uint32_t block_size)
-{
-	it->current = NULL;
-
-	uint32_t offset_in_block = it->current_offset % block_size;
-
-	/* Ensure proper alignment */
-	if ((offset_in_block % 4) != 0)
-		return EIO;
-
-	/* Ensure that the core of the entry does not overflow the block */
-	if (offset_in_block > block_size - 8)
-		return EIO;
-
-	ext4_directory_entry_ll_t *entry =
-	    it->current_block->data + offset_in_block;
-
-	/* Ensure that the whole entry does not overflow the block */
-	uint16_t length = ext4_directory_entry_ll_get_entry_length(entry);
-	if (offset_in_block + length > block_size)
-		return EIO;
-
-	/* Ensure the name length is not too large */
-	if (ext4_directory_entry_ll_get_name_length(
-	    it->inode_ref->fs->superblock, entry) > length - 8)
-		return EIO;
-
-	/* Everything OK - "publish" the entry */
-	it->current = entry;
-	return EOK;
-}
-
-/** Uninitialize directory iterator.
- *
- * Release all allocated structures.
- *
- * @param it Iterator to be finished
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_iterator_fini(ext4_directory_iterator_t *it)
-{
-	it->inode_ref = NULL;
-	it->current = NULL;
-
-	if (it->current_block)
-		return block_put(it->current_block);
-
-	return EOK;
-}
-
-/** Write directory entry to concrete data block.
- *
- * @param sb        Superblock
- * @param entry     Pointer to entry to be written
- * @param entry_len Length of new entry
- * @param child     Child i-node to be written to new entry
- * @param name      Name of the new entry
- * @param name_len  Length of entry name
- *
- */
-void ext4_directory_write_entry(ext4_superblock_t *sb,
-    ext4_directory_entry_ll_t *entry, uint16_t entry_len,
-    ext4_inode_ref_t *child, const char *name, size_t name_len)
-{
-	/* Check maximum entry length */
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	assert(entry_len <= block_size);
-
-	/* Set basic attributes */
-	ext4_directory_entry_ll_set_inode(entry, child->index);
-	ext4_directory_entry_ll_set_entry_length(entry, entry_len);
-	ext4_directory_entry_ll_set_name_length(sb, entry, name_len);
-
-	/* Write name */
-	memcpy(entry->name, name, name_len);
-
-	/* Set type of entry */
-	if (!ext4_superblock_has_feature_incompatible(sb, EXT4_FEATURE_INCOMPAT_FILETYPE))
-		ext4_directory_entry_ll_set_inode_type(sb, entry,
-		    EXT4_DIRECTORY_FILETYPE_UNKNOWN);
-	else if (ext4_inode_is_type(sb, child->inode, EXT4_INODE_MODE_DIRECTORY))
-		ext4_directory_entry_ll_set_inode_type(sb, entry,
-		    EXT4_DIRECTORY_FILETYPE_DIR);
-	else
-		ext4_directory_entry_ll_set_inode_type(sb, entry,
-		    EXT4_DIRECTORY_FILETYPE_REG_FILE);
-}
-
-/** Add new entry to the directory.
- *
- * @param parent Directory i-node
- * @param name   Name of new entry
- * @param child  I-node to be referenced from new entry
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_add_entry(ext4_inode_ref_t *parent, const char *name,
-    ext4_inode_ref_t *child)
-{
-	ext4_filesystem_t *fs = parent->fs;
-
-	/* Index adding (if allowed) */
-	if ((ext4_superblock_has_feature_compatible(fs->superblock,
-	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
-	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
-		errno_t rc = ext4_directory_dx_add_entry(parent, child, name);
-
-		/* Check if index is not corrupted */
-		if (rc != EXT4_ERR_BAD_DX_DIR)
-			return rc;
-
-		/* Needed to clear dir index flag if corrupted */
-		ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
-		parent->dirty = true;
-	}
-
-	/* Linear algorithm */
-
-	uint32_t iblock = 0;
-	uint32_t fblock = 0;
-	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-	uint32_t inode_size = ext4_inode_get_size(fs->superblock, parent->inode);
-	uint32_t total_blocks = inode_size / block_size;
-
-	uint32_t name_len = str_size(name);
-
-	/* Find block, where is space for new entry and try to add */
-	bool success = false;
-	for (iblock = 0; iblock < total_blocks; ++iblock) {
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(parent,
-		    iblock, &fblock);
-		if (rc != EOK)
-			return rc;
-
-		block_t *block;
-		rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		/* If adding is successful, function can finish */
-		rc = ext4_directory_try_insert_entry(fs->superblock, block,
-		    child, name, name_len);
-		if (rc == EOK)
-			success = true;
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		if (success)
-			return EOK;
-	}
-
-	/* No free block found - needed to allocate next data block */
-
-	iblock = 0;
-	fblock = 0;
-	errno_t rc = ext4_filesystem_append_inode_block(parent, &fblock, &iblock);
-	if (rc != EOK)
-		return rc;
-
-	/* Load new block */
-	block_t *new_block;
-	rc = block_get(&new_block, fs->device, fblock, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK)
-		return rc;
-
-	/* Fill block with zeroes */
-	memset(new_block->data, 0, block_size);
-	ext4_directory_entry_ll_t *block_entry = new_block->data;
-	ext4_directory_write_entry(fs->superblock, block_entry, block_size,
-	    child, name, name_len);
-
-	/* Save new block */
-	new_block->dirty = true;
-	rc = block_put(new_block);
-
-	return rc;
-}
-
-/** Find directory entry with passed name.
- *
- * @param result Result structure to be returned if entry found
- * @param parent Directory i-node
- * @param name   Name of entry to be found
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_find_entry(ext4_directory_search_result_t *result,
-    ext4_inode_ref_t *parent, const char *name)
-{
-	uint32_t name_len = str_size(name);
-
-	ext4_superblock_t *sb = parent->fs->superblock;
-
-	/* Index search */
-	if ((ext4_superblock_has_feature_compatible(sb,
-	    EXT4_FEATURE_COMPAT_DIR_INDEX)) &&
-	    (ext4_inode_has_flag(parent->inode, EXT4_INODE_FLAG_INDEX))) {
-		errno_t rc = ext4_directory_dx_find_entry(result, parent, name_len,
-		    name);
-
-		/* Check if index is not corrupted */
-		if (rc != EXT4_ERR_BAD_DX_DIR) {
-			if (rc != EOK)
-				return rc;
-
-			return EOK;
-		}
-
-		/* Needed to clear dir index flag if corrupted */
-		ext4_inode_clear_flag(parent->inode, EXT4_INODE_FLAG_INDEX);
-		parent->dirty = true;
-	}
-
-	/* Linear algorithm */
-
-	uint32_t iblock;
-	uint32_t fblock;
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint32_t inode_size = ext4_inode_get_size(sb, parent->inode);
-	uint32_t total_blocks = inode_size / block_size;
-
-	/* Walk through all data blocks */
-	for (iblock = 0; iblock < total_blocks; ++iblock) {
-		/* Load block address */
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(parent, iblock,
-		    &fblock);
-		if (rc != EOK)
-			return rc;
-
-		/* Load data block */
-		block_t *block;
-		rc = block_get(&block, parent->fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		/* Try to find entry in block */
-		ext4_directory_entry_ll_t *res_entry;
-		rc = ext4_directory_find_in_block(block, sb, name_len, name,
-		    &res_entry);
-		if (rc == EOK) {
-			result->block = block;
-			result->dentry = res_entry;
-			return EOK;
-		}
-
-		/* Entry not found - put block and continue to the next block */
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-	}
-
-	/* Entry was not found */
-
-	result->block = NULL;
-	result->dentry =  NULL;
-
-	return ENOENT;
-}
-
-/** Remove directory entry.
- *
- * @param parent Directory i-node
- * @param name   Name of the entry to be removed
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_remove_entry(ext4_inode_ref_t *parent, const char *name)
-{
-	/* Check if removing from directory */
-	if (!ext4_inode_is_type(parent->fs->superblock, parent->inode,
-	    EXT4_INODE_MODE_DIRECTORY))
-		return ENOTDIR;
-
-	/* Try to find entry */
-	ext4_directory_search_result_t result;
-	errno_t rc = ext4_directory_find_entry(&result, parent, name);
-	if (rc != EOK)
-		return rc;
-
-	/* Invalidate entry */
-	ext4_directory_entry_ll_set_inode(result.dentry, 0);
-
-	/* Store entry position in block */
-	uint32_t pos = (void *) result.dentry - result.block->data;
-
-	/*
-	 * If entry is not the first in block, it must be merged
-	 * with previous entry
-	 */
-	if (pos != 0) {
-		uint32_t offset = 0;
-
-		/* Start from the first entry in block */
-		ext4_directory_entry_ll_t *tmp_dentry = result.block->data;
-		uint16_t tmp_dentry_length =
-		    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
-
-		/* Find direct predecessor of removed entry */
-		while ((offset + tmp_dentry_length) < pos) {
-			offset +=
-			    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
-			tmp_dentry = result.block->data + offset;
-			tmp_dentry_length =
-			    ext4_directory_entry_ll_get_entry_length(tmp_dentry);
-		}
-
-		assert(tmp_dentry_length + offset == pos);
-
-		/* Add to removed entry length to predecessor's length */
-		uint16_t del_entry_length =
-		    ext4_directory_entry_ll_get_entry_length(result.dentry);
-		ext4_directory_entry_ll_set_entry_length(tmp_dentry,
-		    tmp_dentry_length + del_entry_length);
-	}
-
-	result.block->dirty = true;
-
-	return ext4_directory_destroy_result(&result);
-}
-
-/** Try to insert entry to concrete data block.
- *
- * @param sb           Superblock
- * @param target_block Block to try to insert entry to
- * @param child        Child i-node to be inserted by new entry
- * @param name         Name of the new entry
- * @param name_len     Length of the new entry name
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_try_insert_entry(ext4_superblock_t *sb,
-    block_t *target_block, ext4_inode_ref_t *child, const char *name,
-    uint32_t name_len)
-{
-	/* Compute required length entry and align it to 4 bytes */
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint16_t required_len = sizeof(ext4_fake_directory_entry_t) + name_len;
-
-	if ((required_len % 4) != 0)
-		required_len += 4 - (required_len % 4);
-
-	/* Initialize pointers, stop means to upper bound */
-	ext4_directory_entry_ll_t *dentry = target_block->data;
-	ext4_directory_entry_ll_t *stop = target_block->data + block_size;
-
-	/*
-	 * Walk through the block and check for invalid entries
-	 * or entries with free space for new entry
-	 */
-	while (dentry < stop) {
-		uint32_t inode = ext4_directory_entry_ll_get_inode(dentry);
-		uint16_t rec_len = ext4_directory_entry_ll_get_entry_length(dentry);
-
-		/* If invalid and large enough entry, use it */
-		if ((inode == 0) && (rec_len >= required_len)) {
-			ext4_directory_write_entry(sb, dentry, rec_len, child,
-			    name, name_len);
-			target_block->dirty = true;
-
-			return EOK;
-		}
-
-		/* Valid entry, try to split it */
-		if (inode != 0) {
-			uint16_t used_name_len =
-			    ext4_directory_entry_ll_get_name_length(sb, dentry);
-
-			uint16_t used_space =
-			    sizeof(ext4_fake_directory_entry_t) + used_name_len;
-
-			if ((used_name_len % 4) != 0)
-				used_space += 4 - (used_name_len % 4);
-
-			uint16_t free_space = rec_len - used_space;
-
-			/* There is free space for new entry */
-			if (free_space >= required_len) {
-				/* Cut tail of current entry */
-				ext4_directory_entry_ll_set_entry_length(dentry, used_space);
-				ext4_directory_entry_ll_t *new_entry =
-				    (void *) dentry + used_space;
-				ext4_directory_write_entry(sb, new_entry,
-				    free_space, child, name, name_len);
-
-				target_block->dirty = true;
-
-				return EOK;
-			}
-		}
-
-		/* Jump to the next entry */
-		dentry = (void *) dentry + rec_len;
-	}
-
-	/* No free space found for new entry */
-	return ENOSPC;
-}
-
-/** Try to find entry in block by name.
- *
- * @param block     Block containing entries
- * @param sb        Superblock
- * @param name_len  Length of entry name
- * @param name      Name of entry to be found
- * @param res_entry Output pointer to found entry, NULL if not found
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_find_in_block(block_t *block, ext4_superblock_t *sb,
-    size_t name_len, const char *name, ext4_directory_entry_ll_t **res_entry)
-{
-	/* Start from the first entry in block */
-	ext4_directory_entry_ll_t *dentry =
-	    (ext4_directory_entry_ll_t *) block->data;
-
-	/* Set upper bound for cycling */
-	uint8_t *addr_limit = block->data + ext4_superblock_get_block_size(sb);
-
-	/* Walk through the block and check entries */
-	while ((uint8_t *) dentry < addr_limit) {
-		/* Termination condition */
-		if ((uint8_t *) dentry + name_len > addr_limit)
-			break;
-
-		/* Valid entry - check it */
-		if (dentry->inode != 0) {
-			/* For more effectivity compare firstly only lengths */
-			if (ext4_directory_entry_ll_get_name_length(sb, dentry) ==
-			    name_len) {
-				/* Compare names */
-				if (memcmp((uint8_t *) name, dentry->name, name_len) == 0) {
-					*res_entry = dentry;
-					return EOK;
-				}
-			}
-		}
-
-		uint16_t dentry_len =
-		    ext4_directory_entry_ll_get_entry_length(dentry);
-
-		/* Corrupted entry */
-		if (dentry_len == 0)
-			return EINVAL;
-
-		/* Jump to next entry */
-		dentry = (ext4_directory_entry_ll_t *) ((uint8_t *) dentry + dentry_len);
-	}
-
-	/* Entry not found */
-	return ENOENT;
-}
-
-/** Simple function to release allocated data from result.
- *
- * @param result Search result to destroy
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_destroy_result(ext4_directory_search_result_t *result)
-{
-	if (result->block)
-		return block_put(result->block);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/directory_index.c
===================================================================
--- uspace/lib/ext4/src/directory_index.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1173 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  directory_index.c
- * @brief Ext4 directory index operations.
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "ext4/directory.h"
-#include "ext4/directory_index.h"
-#include "ext4/filesystem.h"
-#include "ext4/hash.h"
-#include "ext4/inode.h"
-#include "ext4/superblock.h"
-
-/** Type entry to pass to sorting algorithm.
- *
- */
-typedef struct ext4_dx_sort_entry {
-	uint32_t hash;
-	uint32_t rec_len;
-	void *dentry;
-} ext4_dx_sort_entry_t;
-
-/** Get hash version used in directory index.
- *
- * @param root_info Pointer to root info structure of index
- *
- * @return Hash algorithm version
- *
- */
-uint8_t ext4_directory_dx_root_info_get_hash_version(
-    ext4_directory_dx_root_info_t *root_info)
-{
-	return root_info->hash_version;
-}
-
-/** Set hash version, that will be used in directory index.
- *
- * @param root_info Pointer to root info structure of index
- * @param version   Hash algorithm version
- *
- */
-void ext4_directory_dx_root_info_set_hash_version(
-    ext4_directory_dx_root_info_t *root_info, uint8_t version)
-{
-	root_info->hash_version = version;
-}
-
-/** Get length of root_info structure in bytes.
- *
- * @param root_info Pointer to root info structure of index
- *
- * @return Length of the structure
- *
- */
-uint8_t ext4_directory_dx_root_info_get_info_length(
-    ext4_directory_dx_root_info_t *root_info)
-{
-	return root_info->info_length;
-}
-
-/** Set length of root_info structure in bytes.
- *
- * @param root_info   Pointer to root info structure of index
- * @param info_length Length of the structure
- *
- */
-void ext4_directory_dx_root_info_set_info_length(
-    ext4_directory_dx_root_info_t *root_info, uint8_t info_length)
-{
-	root_info->info_length = info_length;
-}
-
-/** Get number of indirect levels of HTree.
- *
- * @param root_info Pointer to root info structure of index
- *
- * @return Height of HTree (actually only 0 or 1)
- *
- */
-uint8_t ext4_directory_dx_root_info_get_indirect_levels(
-    ext4_directory_dx_root_info_t *root_info)
-{
-	return root_info->indirect_levels;
-}
-
-/** Set number of indirect levels of HTree.
- *
- * @param root_info Pointer to root info structure of index
- * @param levels    Height of HTree (actually only 0 or 1)
- *
- */
-void ext4_directory_dx_root_info_set_indirect_levels(
-    ext4_directory_dx_root_info_t *root_info, uint8_t levels)
-{
-	root_info->indirect_levels = levels;
-}
-
-/** Get maximum number of index node entries.
- *
- * @param countlimit Pointer to counlimit structure
- *
- * @return Maximum of entries in node
- *
- */
-uint16_t ext4_directory_dx_countlimit_get_limit(
-    ext4_directory_dx_countlimit_t *countlimit)
-{
-	return uint16_t_le2host(countlimit->limit);
-}
-
-/** Set maximum number of index node entries.
- *
- * @param countlimit Pointer to counlimit structure
- * @param limit      Maximum of entries in node
- *
- */
-void ext4_directory_dx_countlimit_set_limit(
-    ext4_directory_dx_countlimit_t *countlimit, uint16_t limit)
-{
-	countlimit->limit = host2uint16_t_le(limit);
-}
-
-/** Get current number of index node entries.
- *
- * @param countlimit Pointer to counlimit structure
- *
- * @return Number of entries in node
- *
- */
-uint16_t ext4_directory_dx_countlimit_get_count(
-    ext4_directory_dx_countlimit_t *countlimit)
-{
-	return uint16_t_le2host(countlimit->count);
-}
-
-/** Set current number of index node entries.
- *
- * @param countlimit Pointer to counlimit structure
- * @param count      Number of entries in node
- *
- */
-void ext4_directory_dx_countlimit_set_count(
-    ext4_directory_dx_countlimit_t *countlimit, uint16_t count)
-{
-	countlimit->count = host2uint16_t_le(count);
-}
-
-/** Get hash value of index entry.
- *
- * @param entry Pointer to index entry
- *
- * @return Hash value
- *
- */
-uint32_t ext4_directory_dx_entry_get_hash(ext4_directory_dx_entry_t *entry)
-{
-	return uint32_t_le2host(entry->hash);
-}
-
-/** Set hash value of index entry.
- *
- * @param entry Pointer to index entry
- * @param hash  Hash value
- *
- */
-void ext4_directory_dx_entry_set_hash(ext4_directory_dx_entry_t *entry,
-    uint32_t hash)
-{
-	entry->hash = host2uint32_t_le(hash);
-}
-
-/** Get block address where child node is located.
- *
- * @param entry Pointer to index entry
- *
- * @return Block address of child node
- *
- */
-uint32_t ext4_directory_dx_entry_get_block(ext4_directory_dx_entry_t *entry)
-{
-	return uint32_t_le2host(entry->block);
-}
-
-/** Set block address where child node is located.
- *
- * @param entry Pointer to index entry
- * @param block Block address of child node
- *
- */
-void ext4_directory_dx_entry_set_block(ext4_directory_dx_entry_t *entry,
-    uint32_t block)
-{
-	entry->block = host2uint32_t_le(block);
-}
-
-/** Initialize index structure of new directory.
- *
- * @param dir Pointer to directory i-node
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_dx_init(ext4_inode_ref_t *dir)
-{
-	/* Load block 0, where will be index root located */
-	uint32_t fblock;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(dir, 0,
-	    &fblock);
-	if (rc != EOK)
-		return rc;
-
-	block_t *block;
-	rc = block_get(&block, dir->fs->device, fblock, BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	/* Initialize pointers to data structures */
-	ext4_directory_dx_root_t *root = block->data;
-	ext4_directory_dx_root_info_t *info = &(root->info);
-
-	/* Initialize root info structure */
-	uint8_t hash_version =
-	    ext4_superblock_get_default_hash_version(dir->fs->superblock);
-
-	ext4_directory_dx_root_info_set_hash_version(info, hash_version);
-	ext4_directory_dx_root_info_set_indirect_levels(info, 0);
-	ext4_directory_dx_root_info_set_info_length(info, 8);
-
-	/* Set limit and current number of entries */
-	ext4_directory_dx_countlimit_t *countlimit =
-	    (ext4_directory_dx_countlimit_t *) &root->entries;
-	ext4_directory_dx_countlimit_set_count(countlimit, 1);
-
-	uint32_t block_size =
-	    ext4_superblock_get_block_size(dir->fs->superblock);
-	uint32_t entry_space =
-	    block_size - 2 * sizeof(ext4_directory_dx_dot_entry_t) -
-	    sizeof(ext4_directory_dx_root_info_t);
-	uint16_t root_limit = entry_space / sizeof(ext4_directory_dx_entry_t);
-	ext4_directory_dx_countlimit_set_limit(countlimit, root_limit);
-
-	/* Append new block, where will be new entries inserted in the future */
-	uint32_t iblock;
-	rc = ext4_filesystem_append_inode_block(dir, &fblock, &iblock);
-	if (rc != EOK) {
-		block_put(block);
-		return rc;
-	}
-
-	block_t *new_block;
-	rc = block_get(&new_block, dir->fs->device, fblock, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK) {
-		block_put(block);
-		return rc;
-	}
-
-	/* Fill the whole block with empty entry */
-	ext4_directory_entry_ll_t *block_entry = new_block->data;
-	ext4_directory_entry_ll_set_entry_length(block_entry, block_size);
-	ext4_directory_entry_ll_set_inode(block_entry, 0);
-
-	new_block->dirty = true;
-	rc = block_put(new_block);
-	if (rc != EOK) {
-		block_put(block);
-		return rc;
-	}
-
-	/* Connect new block to the only entry in index */
-	ext4_directory_dx_entry_t *entry = root->entries;
-	ext4_directory_dx_entry_set_block(entry, iblock);
-
-	block->dirty = true;
-
-	return block_put(block);
-}
-
-/** Initialize hash info structure necessary for index operations.
- *
- * @param hinfo      Pointer to hinfo to be initialized
- * @param root_block Root block (number 0) of index
- * @param sb         Pointer to superblock
- * @param name_len   Length of name to be computed hash value from
- * @param name       Name to be computed hash value from
- *
- * @return Error code
- *
- */
-static errno_t ext4_directory_hinfo_init(ext4_hash_info_t *hinfo,
-    block_t *root_block, ext4_superblock_t *sb, size_t name_len,
-    const char *name)
-{
-	ext4_directory_dx_root_t *root =
-	    (ext4_directory_dx_root_t *) root_block->data;
-
-	if ((root->info.hash_version != EXT4_HASH_VERSION_TEA) &&
-	    (root->info.hash_version != EXT4_HASH_VERSION_HALF_MD4) &&
-	    (root->info.hash_version != EXT4_HASH_VERSION_LEGACY))
-		return EXT4_ERR_BAD_DX_DIR;
-
-	/* Check unused flags */
-	if (root->info.unused_flags != 0)
-		return EXT4_ERR_BAD_DX_DIR;
-
-	/* Check indirect levels */
-	if (root->info.indirect_levels > 1)
-		return EXT4_ERR_BAD_DX_DIR;
-
-	/* Check if node limit is correct */
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint32_t entry_space = block_size;
-	entry_space -= 2 * sizeof(ext4_directory_dx_dot_entry_t);
-	entry_space -= sizeof(ext4_directory_dx_root_info_t);
-	entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
-
-	uint16_t limit = ext4_directory_dx_countlimit_get_limit(
-	    (ext4_directory_dx_countlimit_t *) &root->entries);
-	if (limit != entry_space)
-		return EXT4_ERR_BAD_DX_DIR;
-
-	/* Check hash version and modify if necessary */
-	hinfo->hash_version =
-	    ext4_directory_dx_root_info_get_hash_version(&root->info);
-	if ((hinfo->hash_version <= EXT4_HASH_VERSION_TEA) &&
-	    (ext4_superblock_has_flag(sb, EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH))) {
-		/* 3 is magic from ext4 linux implementation */
-		hinfo->hash_version += 3;
-	}
-
-	/* Load hash seed from superblock */
-	hinfo->seed = ext4_superblock_get_hash_seed(sb);
-
-	/* Compute hash value of name */
-	if (name)
-		ext4_hash_string(hinfo, name_len, name);
-
-	return EOK;
-}
-
-/** Walk through index tree and load leaf with corresponding hash value.
- *
- * @param hinfo      Initialized hash info structure
- * @param inode_ref  Current i-node
- * @param root_block Root block (iblock 0), where is root node located
- * @param dx_block   Pointer to leaf node in dx_blocks array
- * @param dx_blocks  Array with the whole path from root to leaf
- *
- * @return Error code
- *
- */
-static errno_t ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo,
-    ext4_inode_ref_t *inode_ref, block_t *root_block,
-    ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks)
-{
-	ext4_directory_dx_block_t *tmp_dx_block = dx_blocks;
-	ext4_directory_dx_root_t *root =
-	    (ext4_directory_dx_root_t *) root_block->data;
-	ext4_directory_dx_entry_t *entries =
-	    (ext4_directory_dx_entry_t *) &root->entries;
-
-	uint16_t limit = ext4_directory_dx_countlimit_get_limit(
-	    (ext4_directory_dx_countlimit_t *) entries);
-	uint8_t indirect_level =
-	    ext4_directory_dx_root_info_get_indirect_levels(&root->info);
-
-	block_t *tmp_block = root_block;
-	ext4_directory_dx_entry_t *p;
-	ext4_directory_dx_entry_t *q;
-	ext4_directory_dx_entry_t *m;
-	ext4_directory_dx_entry_t *at;
-
-	/* Walk through the index tree */
-	while (true) {
-		uint16_t count = ext4_directory_dx_countlimit_get_count(
-		    (ext4_directory_dx_countlimit_t *) entries);
-		if ((count == 0) || (count > limit))
-			return EXT4_ERR_BAD_DX_DIR;
-
-		/* Do binary search in every node */
-		p = entries + 1;
-		q = entries + count - 1;
-
-		while (p <= q) {
-			m = p + (q - p) / 2;
-			if (ext4_directory_dx_entry_get_hash(m) > hinfo->hash)
-				q = m - 1;
-			else
-				p = m + 1;
-		}
-
-		at = p - 1;
-
-		/* Write results */
-		tmp_dx_block->block = tmp_block;
-		tmp_dx_block->entries = entries;
-		tmp_dx_block->position = at;
-
-		/* Is algorithm in the leaf? */
-		if (indirect_level == 0) {
-			*dx_block = tmp_dx_block;
-			return EOK;
-		}
-
-		/* Goto child node */
-		uint32_t next_block = ext4_directory_dx_entry_get_block(at);
-
-		indirect_level--;
-
-		uint32_t fblock;
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-		    next_block, &fblock);
-		if (rc != EOK)
-			return rc;
-
-		rc = block_get(&tmp_block, inode_ref->fs->device, fblock,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		entries = ((ext4_directory_dx_node_t *) tmp_block->data)->entries;
-		limit = ext4_directory_dx_countlimit_get_limit(
-		    (ext4_directory_dx_countlimit_t *) entries);
-
-		uint16_t entry_space =
-		    ext4_superblock_get_block_size(inode_ref->fs->superblock) -
-		    sizeof(ext4_directory_dx_dot_entry_t);
-		entry_space = entry_space / sizeof(ext4_directory_dx_entry_t);
-
-		if (limit != entry_space) {
-			block_put(tmp_block);
-			return EXT4_ERR_BAD_DX_DIR;
-		}
-
-		++tmp_dx_block;
-	}
-
-	/* Unreachable */
-	return EOK;
-}
-
-/** Check if the the next block would be checked during entry search.
- *
- * @param inode_ref Directory i-node
- * @param hash      Hash value to check
- * @param dx_block  Current block
- * @param dx_blocks Array with path from root to leaf node
- *
- * @return Error code
- *
- */
-static errno_t ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref,
-    uint32_t hash, ext4_directory_dx_block_t *dx_block,
-    ext4_directory_dx_block_t *dx_blocks)
-{
-	uint32_t num_handles = 0;
-	ext4_directory_dx_block_t *p = dx_block;
-
-	/* Try to find data block with next bunch of entries */
-	while (true) {
-		p->position++;
-		uint16_t count = ext4_directory_dx_countlimit_get_count(
-		    (ext4_directory_dx_countlimit_t *) p->entries);
-
-		if (p->position < p->entries + count)
-			break;
-
-		if (p == dx_blocks)
-			return EOK;
-
-		num_handles++;
-		p--;
-	}
-
-	/* Check hash collision (if not occured - no next block cannot be used) */
-	uint32_t current_hash = ext4_directory_dx_entry_get_hash(p->position);
-	if ((hash & 1) == 0) {
-		if ((current_hash & ~1) != hash)
-			return 0;
-	}
-
-	/* Fill new path */
-	while (num_handles--) {
-		uint32_t block_idx =
-		    ext4_directory_dx_entry_get_block(p->position);
-		uint32_t block_addr;
-
-		errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-		    block_idx, &block_addr);
-		if (rc != EOK)
-			return rc;
-
-		block_t *block;
-		rc = block_get(&block, inode_ref->fs->device, block_addr, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		p++;
-
-		/* Don't forget to put old block (prevent memory leak) */
-		rc = block_put(p->block);
-		if (rc != EOK)
-			return rc;
-
-		p->block = block;
-		p->entries = ((ext4_directory_dx_node_t *) block->data)->entries;
-		p->position = p->entries;
-	}
-
-	return ENOENT;
-}
-
-/** Try to find directory entry using directory index.
- *
- * @param result    Output value - if entry will be found,
- *                  than will be passed through this parameter
- * @param inode_ref Directory i-node
- * @param name_len  Length of name to be found
- * @param name      Name to be found
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_dx_find_entry(ext4_directory_search_result_t *result,
-    ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)
-{
-	/* Load direct block 0 (index root) */
-	uint32_t root_block_addr;
-	errno_t rc2;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
-	    &root_block_addr);
-	if (rc != EOK)
-		return rc;
-
-	ext4_filesystem_t *fs = inode_ref->fs;
-
-	block_t *root_block;
-	rc = block_get(&root_block, fs->device, root_block_addr,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	/* Initialize hash info (compute hash value) */
-	ext4_hash_info_t hinfo;
-	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock,
-	    name_len, name);
-	if (rc != EOK) {
-		block_put(root_block);
-		return EXT4_ERR_BAD_DX_DIR;
-	}
-
-	/*
-	 * Hardcoded number 2 means maximum height of index tree,
-	 * specified in the Linux driver.
-	 */
-	ext4_directory_dx_block_t dx_blocks[2];
-	ext4_directory_dx_block_t *dx_block;
-	ext4_directory_dx_block_t *tmp;
-
-	rc = ext4_directory_dx_get_leaf(&hinfo, inode_ref, root_block,
-	    &dx_block, dx_blocks);
-	if (rc != EOK) {
-		block_put(root_block);
-		return EXT4_ERR_BAD_DX_DIR;
-	}
-
-	do {
-		/* Load leaf block */
-		uint32_t leaf_block_idx =
-		    ext4_directory_dx_entry_get_block(dx_block->position);
-		uint32_t leaf_block_addr;
-
-		rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-		    leaf_block_idx, &leaf_block_addr);
-		if (rc != EOK)
-			goto cleanup;
-
-		block_t *leaf_block;
-		rc = block_get(&leaf_block, fs->device, leaf_block_addr,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			goto cleanup;
-
-		/* Linear search inside block */
-		ext4_directory_entry_ll_t *res_dentry;
-		rc = ext4_directory_find_in_block(leaf_block, fs->superblock,
-		    name_len, name, &res_dentry);
-
-		/* Found => return it */
-		if (rc == EOK) {
-			result->block = leaf_block;
-			result->dentry = res_dentry;
-			goto cleanup;
-		}
-
-		/* Not found, leave untouched */
-		rc2 = block_put(leaf_block);
-		if (rc2 != EOK)
-			goto cleanup;
-
-		if (rc != ENOENT)
-			goto cleanup;
-
-		/* check if the next block could be checked */
-		rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash,
-		    dx_block, &dx_blocks[0]);
-		if (rc != EOK)
-			goto cleanup;
-
-	} while (rc == ENOENT);
-
-	/* Entry not found */
-	rc = ENOENT;
-
-cleanup:
-	/* The whole path must be released (preventing memory leak) */
-	tmp = dx_blocks;
-
-	while (tmp <= dx_block) {
-		rc2 = block_put(tmp->block);
-		if (rc == EOK && rc2 != EOK)
-			rc = rc2;
-		++tmp;
-	}
-
-	return rc;
-}
-
-/** Compare function used to pass in quicksort implementation.
- *
- * It can compare two entries by hash value.
- *
- * @param arg1  First entry
- * @param arg2  Second entry
- *
- * @return Classic compare result
- *         (0: equal, -1: arg1 < arg2, 1: arg1 > arg2)
- *
- */
-static int ext4_directory_dx_entry_comparator(const void *arg1,
-    const void *arg2)
-{
-	ext4_dx_sort_entry_t const *entry1 = arg1;
-	ext4_dx_sort_entry_t const *entry2 = arg2;
-
-	if (entry1->hash == entry2->hash)
-		return 0;
-
-	if (entry1->hash < entry2->hash)
-		return -1;
-	else
-		return 1;
-}
-
-/** Insert new index entry to block.
- *
- * Note that space for new entry must be checked by caller.
- *
- * @param index_block Block where to insert new entry
- * @param hash        Hash value covered by child node
- * @param iblock      Logical number of child block
- *
- */
-static void ext4_directory_dx_insert_entry(
-    ext4_directory_dx_block_t *index_block, uint32_t hash, uint32_t iblock)
-{
-	ext4_directory_dx_entry_t *old_index_entry = index_block->position;
-	ext4_directory_dx_entry_t *new_index_entry = old_index_entry + 1;
-
-	ext4_directory_dx_countlimit_t *countlimit =
-	    (ext4_directory_dx_countlimit_t *) index_block->entries;
-	uint32_t count = ext4_directory_dx_countlimit_get_count(countlimit);
-
-	ext4_directory_dx_entry_t *start_index = index_block->entries;
-	size_t bytes = (void *) (start_index + count) - (void *) (new_index_entry);
-
-	memmove(new_index_entry + 1, new_index_entry, bytes);
-
-	ext4_directory_dx_entry_set_block(new_index_entry, iblock);
-	ext4_directory_dx_entry_set_hash(new_index_entry, hash);
-
-	ext4_directory_dx_countlimit_set_count(countlimit, count + 1);
-
-	index_block->block->dirty = true;
-}
-
-/** Split directory entries to two parts preventing node overflow.
- *
- * @param inode_ref      Directory i-node
- * @param hinfo          Hash info
- * @param old_data_block Block with data to be split
- * @param index_block    Block where index entries are located
- * @param new_data_block Output value for newly allocated data block
- *
- */
-static errno_t ext4_directory_dx_split_data(ext4_inode_ref_t *inode_ref,
-    ext4_hash_info_t *hinfo, block_t *old_data_block,
-    ext4_directory_dx_block_t *index_block, block_t **new_data_block)
-{
-	errno_t rc = EOK;
-
-	/* Allocate buffer for directory entries */
-	uint32_t block_size =
-	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
-	void *entry_buffer = malloc(block_size);
-	if (entry_buffer == NULL)
-		return ENOMEM;
-
-	/* dot entry has the smallest size available */
-	uint32_t max_entry_count =
-	    block_size / sizeof(ext4_directory_dx_dot_entry_t);
-
-	/* Allocate sort entry */
-	ext4_dx_sort_entry_t *sort_array =
-	    malloc(max_entry_count * sizeof(ext4_dx_sort_entry_t));
-	if (sort_array == NULL) {
-		free(entry_buffer);
-		return ENOMEM;
-	}
-
-	uint32_t idx = 0;
-	uint32_t real_size = 0;
-
-	/* Initialize hinfo */
-	ext4_hash_info_t tmp_hinfo;
-	memcpy(&tmp_hinfo, hinfo, sizeof(ext4_hash_info_t));
-
-	/* Load all valid entries to the buffer */
-	ext4_directory_entry_ll_t *dentry = old_data_block->data;
-	void *entry_buffer_ptr = entry_buffer;
-	while ((void *)dentry < old_data_block->data + block_size) {
-		/* Read only valid entries */
-		if (ext4_directory_entry_ll_get_inode(dentry) != 0) {
-			uint8_t len = ext4_directory_entry_ll_get_name_length(
-			    inode_ref->fs->superblock, dentry);
-			ext4_hash_string(&tmp_hinfo, len, (char *) dentry->name);
-
-			uint32_t rec_len = 8 + len;
-
-			if ((rec_len % 4) != 0)
-				rec_len += 4 - (rec_len % 4);
-
-			memcpy(entry_buffer_ptr, dentry, rec_len);
-
-			sort_array[idx].dentry = entry_buffer_ptr;
-			sort_array[idx].rec_len = rec_len;
-			sort_array[idx].hash = tmp_hinfo.hash;
-
-			entry_buffer_ptr += rec_len;
-			real_size += rec_len;
-			idx++;
-		}
-
-		dentry = (void *) dentry +
-		    ext4_directory_entry_ll_get_entry_length(dentry);
-	}
-
-	/* Sort all entries */
-	qsort(sort_array, idx, sizeof(ext4_dx_sort_entry_t),
-	    ext4_directory_dx_entry_comparator);
-
-	/* Allocate new block for store the second part of entries */
-	uint32_t new_fblock;
-	uint32_t new_iblock;
-	rc = ext4_filesystem_append_inode_block(inode_ref, &new_fblock,
-	    &new_iblock);
-	if (rc != EOK) {
-		free(sort_array);
-		free(entry_buffer);
-		return rc;
-	}
-
-	/* Load new block */
-	block_t *new_data_block_tmp;
-	rc = block_get(&new_data_block_tmp, inode_ref->fs->device,
-	    new_fblock, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK) {
-		free(sort_array);
-		free(entry_buffer);
-		return rc;
-	}
-
-	/*
-	 * Distribute entries to two blocks (by size)
-	 * - compute the half
-	 */
-	uint32_t new_hash = 0;
-	uint32_t current_size = 0;
-	uint32_t mid = 0;
-	for (uint32_t i = 0; i < idx; ++i) {
-		if ((current_size + sort_array[i].rec_len) > (real_size / 2)) {
-			new_hash = sort_array[i].hash;
-			mid = i;
-			break;
-		}
-
-		current_size += sort_array[i].rec_len;
-	}
-
-	/* Check hash collision */
-	uint32_t continued = 0;
-	if (new_hash == sort_array[mid - 1].hash)
-		continued = 1;
-
-	uint32_t offset = 0;
-	void *ptr;
-
-	/* First part - to the old block */
-	for (uint32_t i = 0; i < mid; ++i) {
-		ptr = old_data_block->data + offset;
-		memcpy(ptr, sort_array[i].dentry, sort_array[i].rec_len);
-
-		ext4_directory_entry_ll_t *tmp = ptr;
-		if (i < (mid - 1))
-			ext4_directory_entry_ll_set_entry_length(tmp,
-			    sort_array[i].rec_len);
-		else
-			ext4_directory_entry_ll_set_entry_length(tmp,
-			    block_size - offset);
-
-		offset += sort_array[i].rec_len;
-	}
-
-	/* Second part - to the new block */
-	offset = 0;
-	for (uint32_t i = mid; i < idx; ++i) {
-		ptr = new_data_block_tmp->data + offset;
-		memcpy(ptr, sort_array[i].dentry, sort_array[i].rec_len);
-
-		ext4_directory_entry_ll_t *tmp = ptr;
-		if (i < (idx - 1))
-			ext4_directory_entry_ll_set_entry_length(tmp,
-			    sort_array[i].rec_len);
-		else
-			ext4_directory_entry_ll_set_entry_length(tmp,
-			    block_size - offset);
-
-		offset += sort_array[i].rec_len;
-	}
-
-	/* Do some steps to finish operation */
-	old_data_block->dirty = true;
-	new_data_block_tmp->dirty = true;
-
-	free(sort_array);
-	free(entry_buffer);
-
-	ext4_directory_dx_insert_entry(index_block, new_hash + continued,
-	    new_iblock);
-
-	*new_data_block = new_data_block_tmp;
-
-	return EOK;
-}
-
-/** Split index node and maybe some parent nodes in the tree hierarchy.
- *
- * @param inode_ref Directory i-node
- * @param dx_blocks Array with path from root to leaf node
- * @param dx_block  Leaf block to be split if needed
- *
- * @return Error code
- *
- */
-static errno_t ext4_directory_dx_split_index(ext4_inode_ref_t *inode_ref,
-    ext4_directory_dx_block_t *dx_blocks, ext4_directory_dx_block_t *dx_block)
-{
-	ext4_directory_dx_entry_t *entries;
-	if (dx_block == dx_blocks)
-		entries =
-		    ((ext4_directory_dx_root_t *) dx_block->block->data)->entries;
-	else
-		entries =
-		    ((ext4_directory_dx_node_t *) dx_block->block->data)->entries;
-
-	ext4_directory_dx_countlimit_t *countlimit =
-	    (ext4_directory_dx_countlimit_t *) entries;
-
-	uint16_t leaf_limit =
-	    ext4_directory_dx_countlimit_get_limit(countlimit);
-	uint16_t leaf_count =
-	    ext4_directory_dx_countlimit_get_count(countlimit);
-
-	/* Check if is necessary to split index block */
-	if (leaf_limit == leaf_count) {
-		size_t levels = dx_block - dx_blocks;
-
-		ext4_directory_dx_entry_t *root_entries =
-		    ((ext4_directory_dx_root_t *) dx_blocks[0].block->data)->entries;
-
-		ext4_directory_dx_countlimit_t *root_countlimit =
-		    (ext4_directory_dx_countlimit_t *) root_entries;
-		uint16_t root_limit =
-		    ext4_directory_dx_countlimit_get_limit(root_countlimit);
-		uint16_t root_count =
-		    ext4_directory_dx_countlimit_get_count(root_countlimit);
-
-		/* Linux limitation */
-		if ((levels > 0) && (root_limit == root_count))
-			return ENOSPC;
-
-		/* Add new block to directory */
-		uint32_t new_fblock;
-		uint32_t new_iblock;
-		errno_t rc = ext4_filesystem_append_inode_block(inode_ref,
-		    &new_fblock, &new_iblock);
-		if (rc != EOK)
-			return rc;
-
-		/* load new block */
-		block_t *new_block;
-		rc = block_get(&new_block, inode_ref->fs->device,
-		    new_fblock, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-
-		ext4_directory_dx_node_t *new_node = new_block->data;
-		ext4_directory_dx_entry_t *new_entries = new_node->entries;
-
-		uint32_t block_size =
-		    ext4_superblock_get_block_size(inode_ref->fs->superblock);
-
-		/* Split leaf node */
-		if (levels > 0) {
-			uint32_t count_left = leaf_count / 2;
-			uint32_t count_right = leaf_count - count_left;
-			uint32_t hash_right =
-			    ext4_directory_dx_entry_get_hash(entries + count_left);
-
-			/* Copy data to new node */
-			memcpy((void *) new_entries, (void *) (entries + count_left),
-			    count_right * sizeof(ext4_directory_dx_entry_t));
-
-			/* Initialize new node */
-			ext4_directory_dx_countlimit_t *left_countlimit =
-			    (ext4_directory_dx_countlimit_t *) entries;
-			ext4_directory_dx_countlimit_t *right_countlimit =
-			    (ext4_directory_dx_countlimit_t *) new_entries;
-
-			ext4_directory_dx_countlimit_set_count(left_countlimit, count_left);
-			ext4_directory_dx_countlimit_set_count(right_countlimit, count_right);
-
-			uint32_t entry_space =
-			    block_size - sizeof(ext4_fake_directory_entry_t);
-			uint32_t node_limit =
-			    entry_space / sizeof(ext4_directory_dx_entry_t);
-			ext4_directory_dx_countlimit_set_limit(right_countlimit, node_limit);
-
-			/* Which index block is target for new entry */
-			uint32_t position_index = (dx_block->position - dx_block->entries);
-			if (position_index >= count_left) {
-				dx_block->block->dirty = true;
-
-				block_t *block_tmp = dx_block->block;
-				dx_block->block = new_block;
-				dx_block->position =
-				    new_entries + position_index - count_left;
-				dx_block->entries = new_entries;
-
-				new_block = block_tmp;
-			}
-
-			/* Finally insert new entry */
-			ext4_directory_dx_insert_entry(dx_blocks, hash_right, new_iblock);
-
-			return block_put(new_block);
-		} else {
-			/* Create second level index */
-
-			/* Copy data from root to child block */
-			memcpy((void *) new_entries, (void *) entries,
-			    leaf_count * sizeof(ext4_directory_dx_entry_t));
-
-			ext4_directory_dx_countlimit_t *new_countlimit =
-			    (ext4_directory_dx_countlimit_t *) new_entries;
-
-			uint32_t entry_space =
-			    block_size - sizeof(ext4_fake_directory_entry_t);
-			uint32_t node_limit =
-			    entry_space / sizeof(ext4_directory_dx_entry_t);
-			ext4_directory_dx_countlimit_set_limit(new_countlimit, node_limit);
-
-			/* Set values in root node */
-			ext4_directory_dx_countlimit_t *new_root_countlimit =
-			    (ext4_directory_dx_countlimit_t *) entries;
-
-			ext4_directory_dx_countlimit_set_count(new_root_countlimit, 1);
-			ext4_directory_dx_entry_set_block(entries, new_iblock);
-
-			((ext4_directory_dx_root_t *)
-			    dx_blocks[0].block->data)->info.indirect_levels = 1;
-
-			/* Add new entry to the path */
-			dx_block = dx_blocks + 1;
-			dx_block->position = dx_block->position - entries + new_entries;
-			dx_block->entries = new_entries;
-			dx_block->block = new_block;
-		}
-	}
-
-	return EOK;
-}
-
-/** Add new entry to indexed directory
- *
- * @param parent Directory i-node
- * @param child  I-node to be referenced from directory entry
- * @param name   Name of new directory entry
- *
- * @return Error code
- *
- */
-errno_t ext4_directory_dx_add_entry(ext4_inode_ref_t *parent,
-    ext4_inode_ref_t *child, const char *name)
-{
-	errno_t rc2 = EOK;
-
-	/* Get direct block 0 (index root) */
-	uint32_t root_block_addr;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(parent, 0,
-	    &root_block_addr);
-	if (rc != EOK)
-		return rc;
-
-	ext4_filesystem_t *fs = parent->fs;
-
-	block_t *root_block;
-	rc = block_get(&root_block, fs->device, root_block_addr,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	/* Initialize hinfo structure (mainly compute hash) */
-	uint32_t name_len = str_size(name);
-	ext4_hash_info_t hinfo;
-	rc = ext4_directory_hinfo_init(&hinfo, root_block, fs->superblock,
-	    name_len, name);
-	if (rc != EOK) {
-		block_put(root_block);
-		return EXT4_ERR_BAD_DX_DIR;
-	}
-
-	/*
-	 * Hardcoded number 2 means maximum height of index
-	 * tree defined in Linux.
-	 */
-	ext4_directory_dx_block_t dx_blocks[2];
-	ext4_directory_dx_block_t *dx_block;
-	ext4_directory_dx_block_t *dx_it;
-
-	rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block,
-	    &dx_block, dx_blocks);
-	if (rc != EOK) {
-		rc = EXT4_ERR_BAD_DX_DIR;
-		goto release_index;
-	}
-
-	/* Try to insert to existing data block */
-	uint32_t leaf_block_idx =
-	    ext4_directory_dx_entry_get_block(dx_block->position);
-	uint32_t leaf_block_addr;
-	rc = ext4_filesystem_get_inode_data_block_index(parent, leaf_block_idx,
-	    &leaf_block_addr);
-	if (rc != EOK)
-		goto release_index;
-
-	block_t *target_block;
-	rc = block_get(&target_block, fs->device, leaf_block_addr,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		goto release_index;
-
-	/* Check if insert operation passed */
-	rc = ext4_directory_try_insert_entry(fs->superblock, target_block, child,
-	    name, name_len);
-	if (rc == EOK)
-		goto release_target_index;
-
-	/*
-	 * Check if there is needed to split index node
-	 * (and recursively also parent nodes)
-	 */
-	rc = ext4_directory_dx_split_index(parent, dx_blocks, dx_block);
-	if (rc != EOK)
-		goto release_target_index;
-
-	/* Split entries to two blocks (includes sorting by hash value) */
-	block_t *new_block = NULL;
-	rc = ext4_directory_dx_split_data(parent, &hinfo, target_block,
-	    dx_block, &new_block);
-	if (rc != EOK) {
-		rc2 = rc;
-		goto release_target_index;
-	}
-
-	/* Where to save new entry */
-	uint32_t new_block_hash =
-	    ext4_directory_dx_entry_get_hash(dx_block->position + 1);
-	if (hinfo.hash >= new_block_hash)
-		rc = ext4_directory_try_insert_entry(fs->superblock, new_block,
-		    child, name, name_len);
-	else
-		rc = ext4_directory_try_insert_entry(fs->superblock, target_block,
-		    child, name, name_len);
-
-	/* Cleanup */
-	rc = block_put(new_block);
-	if (rc != EOK)
-		return rc;
-
-	/* Cleanup operations */
-
-release_target_index:
-	rc2 = rc;
-
-	rc = block_put(target_block);
-	if (rc != EOK)
-		return rc;
-
-release_index:
-	if (rc != EOK)
-		rc2 = rc;
-
-	dx_it = dx_blocks;
-
-	while (dx_it <= dx_block) {
-		rc = block_put(dx_it->block);
-		if (rc != EOK)
-			return rc;
-
-		dx_it++;
-	}
-
-	return rc2;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/extent.c
===================================================================
--- uspace/lib/ext4/src/extent.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1113 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  extent.c
- * @brief Ext4 extent structures operations.
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "ext4/balloc.h"
-#include "ext4/extent.h"
-#include "ext4/inode.h"
-#include "ext4/superblock.h"
-
-/** Get logical number of the block covered by extent.
- *
- * @param extent Extent to load number from
- *
- * @return Logical number of the first block covered by extent
- *
- */
-uint32_t ext4_extent_get_first_block(ext4_extent_t *extent)
-{
-	return uint32_t_le2host(extent->first_block);
-}
-
-/** Set logical number of the first block covered by extent.
- *
- * @param extent Extent to set number to
- * @param iblock Logical number of the first block covered by extent
- *
- */
-void ext4_extent_set_first_block(ext4_extent_t *extent, uint32_t iblock)
-{
-	extent->first_block = host2uint32_t_le(iblock);
-}
-
-/** Get number of blocks covered by extent.
- *
- * @param extent Extent to load count from
- *
- * @return Number of blocks covered by extent
- *
- */
-uint16_t ext4_extent_get_block_count(ext4_extent_t *extent)
-{
-	return uint16_t_le2host(extent->block_count);
-}
-
-/** Set number of blocks covered by extent.
- *
- * @param extent Extent to load count from
- * @param count  Number of blocks covered by extent
- *
- */
-void ext4_extent_set_block_count(ext4_extent_t *extent, uint16_t count)
-{
-	extent->block_count = host2uint16_t_le(count);
-}
-
-/** Get physical number of the first block covered by extent.
- *
- * @param extent Extent to load number
- *
- * @return Physical number of the first block covered by extent
- *
- */
-uint64_t ext4_extent_get_start(ext4_extent_t *extent)
-{
-	return ((uint64_t)uint16_t_le2host(extent->start_hi)) << 32 |
-	    ((uint64_t)uint32_t_le2host(extent->start_lo));
-}
-
-/** Set physical number of the first block covered by extent.
- *
- * @param extent Extent to load number
- * @param fblock Physical number of the first block covered by extent
- *
- */
-void ext4_extent_set_start(ext4_extent_t *extent, uint64_t fblock)
-{
-	extent->start_lo = host2uint32_t_le((fblock << 32) >> 32);
-	extent->start_hi = host2uint16_t_le((uint16_t)(fblock >> 32));
-}
-
-/** Get logical number of the block covered by extent index.
- *
- * @param index Extent index to load number from
- *
- * @return Logical number of the first block covered by extent index
- *
- */
-uint32_t ext4_extent_index_get_first_block(ext4_extent_index_t *index)
-{
-	return uint32_t_le2host(index->first_block);
-}
-
-/** Set logical number of the block covered by extent index.
- *
- * @param index  Extent index to set number to
- * @param iblock Logical number of the first block covered by extent index
- *
- */
-void ext4_extent_index_set_first_block(ext4_extent_index_t *index,
-    uint32_t iblock)
-{
-	index->first_block = host2uint32_t_le(iblock);
-}
-
-/** Get physical number of block where the child node is located.
- *
- * @param index Extent index to load number from
- *
- * @return Physical number of the block with child node
- *
- */
-uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *index)
-{
-	return ((uint64_t) uint16_t_le2host(index->leaf_hi)) << 32 |
-	    ((uint64_t)uint32_t_le2host(index->leaf_lo));
-}
-
-/** Set physical number of block where the child node is located.
- *
- * @param index  Extent index to set number to
- * @param fblock Ohysical number of the block with child node
- *
- */
-void ext4_extent_index_set_leaf(ext4_extent_index_t *index, uint64_t fblock)
-{
-	index->leaf_lo = host2uint32_t_le((fblock << 32) >> 32);
-	index->leaf_hi = host2uint16_t_le((uint16_t) (fblock >> 32));
-}
-
-/** Get magic value from extent header.
- *
- * @param header Extent header to load value from
- *
- * @return Magic value of extent header
- *
- */
-uint16_t ext4_extent_header_get_magic(ext4_extent_header_t *header)
-{
-	return uint16_t_le2host(header->magic);
-}
-
-/** Set magic value to extent header.
- *
- * @param header Extent header to set value to
- * @param magic  Magic value of extent header
- *
- */
-void ext4_extent_header_set_magic(ext4_extent_header_t *header, uint16_t magic)
-{
-	header->magic = host2uint16_t_le(magic);
-}
-
-/** Get number of entries from extent header
- *
- * @param header Extent header to get value from
- *
- * @return Number of entries covered by extent header
- *
- */
-uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *header)
-{
-	return uint16_t_le2host(header->entries_count);
-}
-
-/** Set number of entries to extent header
- *
- * @param header Extent header to set value to
- * @param count  Number of entries covered by extent header
- *
- */
-void ext4_extent_header_set_entries_count(ext4_extent_header_t *header,
-    uint16_t count)
-{
-	header->entries_count = host2uint16_t_le(count);
-}
-
-/** Get maximum number of entries from extent header
- *
- * @param header Extent header to get value from
- *
- * @return Maximum number of entries covered by extent header
- *
- */
-uint16_t ext4_extent_header_get_max_entries_count(ext4_extent_header_t *header)
-{
-	return uint16_t_le2host(header->max_entries_count);
-}
-
-/** Set maximum number of entries to extent header
- *
- * @param header    Extent header to set value to
- * @param max_count Maximum number of entries covered by extent header
- *
- */
-void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *header,
-    uint16_t max_count)
-{
-	header->max_entries_count = host2uint16_t_le(max_count);
-}
-
-/** Get depth of extent subtree.
- *
- * @param header Extent header to get value from
- *
- * @return Depth of extent subtree
- *
- */
-uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *header)
-{
-	return uint16_t_le2host(header->depth);
-}
-
-/** Set depth of extent subtree.
- *
- * @param header Extent header to set value to
- * @param depth  Depth of extent subtree
- *
- */
-void ext4_extent_header_set_depth(ext4_extent_header_t *header, uint16_t depth)
-{
-	header->depth = host2uint16_t_le(depth);
-}
-
-/** Get generation from extent header
- *
- * @param header Extent header to get value from
- *
- * @return Generation
- *
- */
-uint32_t ext4_extent_header_get_generation(ext4_extent_header_t *header)
-{
-	return uint32_t_le2host(header->generation);
-}
-
-/** Set generation to extent header
- *
- * @param header     Extent header to set value to
- * @param generation Generation
- *
- */
-void ext4_extent_header_set_generation(ext4_extent_header_t *header,
-    uint32_t generation)
-{
-	header->generation = host2uint32_t_le(generation);
-}
-
-/** Binary search in extent index node.
- *
- * @param header Extent header of index node
- * @param index  Output value - found index will be set here
- * @param iblock Logical block number to find in index node
- *
- */
-static void ext4_extent_binsearch_idx(ext4_extent_header_t *header,
-    ext4_extent_index_t **index, uint32_t iblock)
-{
-	ext4_extent_index_t *r;
-	ext4_extent_index_t *l;
-	ext4_extent_index_t *m;
-
-	uint16_t entries_count =
-	    ext4_extent_header_get_entries_count(header);
-
-	/* Initialize bounds */
-	l = EXT4_EXTENT_FIRST_INDEX(header) + 1;
-	r = EXT4_EXTENT_FIRST_INDEX(header) + entries_count - 1;
-
-	/* Do binary search */
-	while (l <= r) {
-		m = l + (r - l) / 2;
-		uint32_t first_block = ext4_extent_index_get_first_block(m);
-
-		if (iblock < first_block)
-			r = m - 1;
-		else
-			l = m + 1;
-	}
-
-	/* Set output value */
-	*index = l - 1;
-}
-
-/** Binary search in extent leaf node.
- *
- * @param header Extent header of leaf node
- * @param extent Output value - found extent will be set here,
- *               or NULL if node is empty
- * @param iblock Logical block number to find in leaf node
- *
- */
-static void ext4_extent_binsearch(ext4_extent_header_t *header,
-    ext4_extent_t **extent, uint32_t iblock)
-{
-	ext4_extent_t *r;
-	ext4_extent_t *l;
-	ext4_extent_t *m;
-
-	uint16_t entries_count =
-	    ext4_extent_header_get_entries_count(header);
-
-	if (entries_count == 0) {
-		/* this leaf is empty */
-		*extent = NULL;
-		return;
-	}
-
-	/* Initialize bounds */
-	l = EXT4_EXTENT_FIRST(header) + 1;
-	r = EXT4_EXTENT_FIRST(header) + entries_count - 1;
-
-	/* Do binary search */
-	while (l <= r) {
-		m = l + (r - l) / 2;
-		uint32_t first_block = ext4_extent_get_first_block(m);
-
-		if (iblock < first_block)
-			r = m - 1;
-		else
-			l = m + 1;
-	}
-
-	/* Set output value */
-	*extent = l - 1;
-}
-
-/** Find physical block in the extent tree by logical block number.
- *
- * There is no need to save path in the tree during this algorithm.
- *
- * @param inode_ref I-node to load block from
- * @param iblock    Logical block number to find
- * @param fblock    Output value for physical block number
- *
- * @return Error code
- *
- */
-errno_t ext4_extent_find_block(ext4_inode_ref_t *inode_ref, uint32_t iblock,
-    uint32_t *fblock)
-{
-	errno_t rc = EOK;
-	/* Compute bound defined by i-node size */
-	uint64_t inode_size =
-	    ext4_inode_get_size(inode_ref->fs->superblock, inode_ref->inode);
-
-	uint32_t block_size =
-	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
-
-	uint32_t last_idx = (inode_size - 1) / block_size;
-
-	/* Check if requested iblock is not over size of i-node */
-	if (iblock > last_idx) {
-		*fblock = 0;
-		return EOK;
-	}
-
-	block_t *block = NULL;
-
-	/* Walk through extent tree */
-	ext4_extent_header_t *header =
-	    ext4_inode_get_extent_header(inode_ref->inode);
-
-	while (ext4_extent_header_get_depth(header) != 0) {
-		/* Search index in node */
-		ext4_extent_index_t *index;
-		ext4_extent_binsearch_idx(header, &index, iblock);
-
-		/* Load child node and set values for the next iteration */
-		uint64_t child = ext4_extent_index_get_leaf(index);
-
-		if (block != NULL) {
-			rc = block_put(block);
-			if (rc != EOK)
-				return rc;
-		}
-
-		rc = block_get(&block, inode_ref->fs->device, child,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		header = (ext4_extent_header_t *)block->data;
-	}
-
-	/* Search extent in the leaf block */
-	ext4_extent_t *extent = NULL;
-	ext4_extent_binsearch(header, &extent, iblock);
-
-	/* Prevent empty leaf */
-	if (extent == NULL) {
-		*fblock = 0;
-	} else {
-		/* Compute requested physical block address */
-		uint32_t phys_block;
-		uint32_t first = ext4_extent_get_first_block(extent);
-		phys_block = ext4_extent_get_start(extent) + iblock - first;
-
-		*fblock = phys_block;
-	}
-
-	/* Cleanup */
-	if (block != NULL)
-		rc = block_put(block);
-
-	return rc;
-}
-
-/** Find extent for specified iblock.
- *
- * This function is used for finding block in the extent tree with
- * saving the path through the tree for possible future modifications.
- *
- * @param inode_ref I-node to read extent tree from
- * @param iblock    Iblock to find extent for
- * @param ret_path  Output value for loaded path from extent tree
- *
- * @return Error code
- *
- */
-static errno_t ext4_extent_find_extent(ext4_inode_ref_t *inode_ref, uint32_t iblock,
-    ext4_extent_path_t **ret_path)
-{
-	ext4_extent_header_t *eh =
-	    ext4_inode_get_extent_header(inode_ref->inode);
-
-	uint16_t depth = ext4_extent_header_get_depth(eh);
-
-	ext4_extent_path_t *tmp_path;
-
-	/* Added 2 for possible tree growing */
-	tmp_path = malloc(sizeof(ext4_extent_path_t) * (depth + 2));
-	if (tmp_path == NULL)
-		return ENOMEM;
-
-	/* Initialize structure for algorithm start */
-	tmp_path[0].block = inode_ref->block;
-	tmp_path[0].header = eh;
-
-	/* Walk through the extent tree */
-	uint16_t pos = 0;
-	errno_t rc;
-	errno_t rc2;
-	while (ext4_extent_header_get_depth(eh) != 0) {
-		/* Search index in index node by iblock */
-		ext4_extent_binsearch_idx(tmp_path[pos].header,
-		    &tmp_path[pos].index, iblock);
-
-		tmp_path[pos].depth = depth;
-		tmp_path[pos].extent = NULL;
-
-		assert(tmp_path[pos].index != NULL);
-
-		/* Load information for the next iteration */
-		uint64_t fblock = ext4_extent_index_get_leaf(tmp_path[pos].index);
-
-		block_t *block;
-		rc = block_get(&block, inode_ref->fs->device, fblock,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			goto cleanup;
-
-		pos++;
-
-		eh = (ext4_extent_header_t *)block->data;
-		tmp_path[pos].block = block;
-		tmp_path[pos].header = eh;
-	}
-
-	tmp_path[pos].depth = 0;
-	tmp_path[pos].extent = NULL;
-	tmp_path[pos].index = NULL;
-
-	/* Find extent in the leaf node */
-	ext4_extent_binsearch(tmp_path[pos].header, &tmp_path[pos].extent, iblock);
-	*ret_path = tmp_path;
-
-	return EOK;
-
-cleanup:
-	rc2 = EOK;
-
-	/*
-	 * Put loaded blocks
-	 * From 1: 0 is a block with inode data
-	 */
-	for (uint16_t i = 1; i < tmp_path->depth; ++i) {
-		if (tmp_path[i].block) {
-			rc2 = block_put(tmp_path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
-	}
-
-	/* Destroy temporary data structure */
-	free(tmp_path);
-
-	return rc;
-}
-
-/** Release extent and all data blocks covered by the extent.
- *
- * @param inode_ref I-node to release extent and block from
- * @param extent    Extent to release
- *
- * @return Error code
- *
- */
-static errno_t ext4_extent_release(ext4_inode_ref_t *inode_ref,
-    ext4_extent_t *extent)
-{
-	/* Compute number of the first physical block to release */
-	uint64_t start = ext4_extent_get_start(extent);
-	uint16_t block_count = ext4_extent_get_block_count(extent);
-
-	return ext4_balloc_free_blocks(inode_ref, start, block_count);
-}
-
-/** Recursively release the whole branch of the extent tree.
- *
- * For each entry of the node release the subbranch and finally release
- * the node. In the leaf node all extents will be released.
- *
- * @param inode_ref I-node where the branch is released
- * @param index     Index in the non-leaf node to be released
- *                  with the whole subtree
- *
- * @return Error code
- *
- */
-static errno_t ext4_extent_release_branch(ext4_inode_ref_t *inode_ref,
-    ext4_extent_index_t *index)
-{
-	uint32_t fblock = ext4_extent_index_get_leaf(index);
-
-	block_t *block;
-	errno_t rc = block_get(&block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	ext4_extent_header_t *header = block->data;
-
-	if (ext4_extent_header_get_depth(header)) {
-		/* The node is non-leaf, do recursion */
-		ext4_extent_index_t *idx = EXT4_EXTENT_FIRST_INDEX(header);
-
-		/* Release all subbranches */
-		for (uint32_t i = 0;
-		    i < ext4_extent_header_get_entries_count(header);
-		    ++i, ++idx) {
-			rc = ext4_extent_release_branch(inode_ref, idx);
-			if (rc != EOK)
-				return rc;
-		}
-	} else {
-		/* Leaf node reached */
-		ext4_extent_t *ext = EXT4_EXTENT_FIRST(header);
-
-		/* Release all extents and stop recursion */
-		for (uint32_t i = 0;
-		    i < ext4_extent_header_get_entries_count(header);
-		    ++i, ++ext) {
-			rc = ext4_extent_release(inode_ref, ext);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	/* Release data block where the node was stored */
-
-	rc = block_put(block);
-	if (rc != EOK)
-		return rc;
-
-	return ext4_balloc_free_block(inode_ref, fblock);
-}
-
-/** Release all data blocks starting from specified logical block.
- *
- * @param inode_ref   I-node to release blocks from
- * @param iblock_from First logical block to release
- *
- */
-errno_t ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
-    uint32_t iblock_from)
-{
-	/* Find the first extent to modify */
-	ext4_extent_path_t *path;
-	errno_t rc2;
-	errno_t rc = ext4_extent_find_extent(inode_ref, iblock_from, &path);
-	if (rc != EOK)
-		return rc;
-
-	/* Jump to last item of the path (extent) */
-	ext4_extent_path_t *path_ptr = path;
-	while (path_ptr->depth != 0)
-		path_ptr++;
-
-	assert(path_ptr->extent != NULL);
-
-	/* First extent maybe released partially */
-	uint32_t first_iblock =
-	    ext4_extent_get_first_block(path_ptr->extent);
-	uint32_t first_fblock =
-	    ext4_extent_get_start(path_ptr->extent) + iblock_from - first_iblock;
-
-	uint16_t block_count = ext4_extent_get_block_count(path_ptr->extent);
-
-	uint16_t delete_count = block_count -
-	    (first_fblock - ext4_extent_get_start(path_ptr->extent));
-
-	/* Release all blocks */
-	rc = ext4_balloc_free_blocks(inode_ref, first_fblock, delete_count);
-	if (rc != EOK)
-		goto cleanup;
-
-	/* Correct counter */
-	block_count -= delete_count;
-	ext4_extent_set_block_count(path_ptr->extent, block_count);
-
-	/* Initialize the following loop */
-	uint16_t entries =
-	    ext4_extent_header_get_entries_count(path_ptr->header);
-	ext4_extent_t *tmp_ext = path_ptr->extent + 1;
-	ext4_extent_t *stop_ext = EXT4_EXTENT_FIRST(path_ptr->header) + entries;
-
-	/* If first extent empty, release it */
-	if (block_count == 0)
-		entries--;
-
-	/* Release all successors of the first extent in the same node */
-	while (tmp_ext < stop_ext) {
-		first_fblock = ext4_extent_get_start(tmp_ext);
-		delete_count = ext4_extent_get_block_count(tmp_ext);
-
-		rc = ext4_balloc_free_blocks(inode_ref, first_fblock, delete_count);
-		if (rc != EOK)
-			goto cleanup;
-
-		entries--;
-		tmp_ext++;
-	}
-
-	ext4_extent_header_set_entries_count(path_ptr->header, entries);
-	path_ptr->block->dirty = true;
-
-	/* If leaf node is empty, parent entry must be modified */
-	bool remove_parent_record = false;
-
-	/* Don't release root block (including inode data) !!! */
-	if ((path_ptr != path) && (entries == 0)) {
-		rc = ext4_balloc_free_block(inode_ref, path_ptr->block->lba);
-		if (rc != EOK)
-			goto cleanup;
-
-		remove_parent_record = true;
-	}
-
-	/* Jump to the parent */
-	--path_ptr;
-
-	/* Release all successors in all tree levels */
-	while (path_ptr >= path) {
-		entries = ext4_extent_header_get_entries_count(path_ptr->header);
-		ext4_extent_index_t *index = path_ptr->index + 1;
-		ext4_extent_index_t *stop =
-		    EXT4_EXTENT_FIRST_INDEX(path_ptr->header) + entries;
-
-		/* Correct entries count because of changes in the previous iteration */
-		if (remove_parent_record)
-			entries--;
-
-		/* Iterate over all entries and release the whole subtrees */
-		while (index < stop) {
-			rc = ext4_extent_release_branch(inode_ref, index);
-			if (rc != EOK)
-				goto cleanup;
-
-			++index;
-			--entries;
-		}
-
-		ext4_extent_header_set_entries_count(path_ptr->header, entries);
-		path_ptr->block->dirty = true;
-
-		/* Free the node if it is empty */
-		if ((entries == 0) && (path_ptr != path)) {
-			rc = ext4_balloc_free_block(inode_ref, path_ptr->block->lba);
-			if (rc != EOK)
-				goto cleanup;
-
-			/* Mark parent to be checked */
-			remove_parent_record = true;
-		} else
-			remove_parent_record = false;
-
-		--path_ptr;
-	}
-
-cleanup:
-	rc2 = EOK;
-
-	/*
-	 * Put loaded blocks
-	 * starting from 1: 0 is a block with inode data
-	 */
-	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
-			rc2 = block_put(path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
-	}
-
-	/* Destroy temporary data structure */
-	free(path);
-
-	return rc;
-}
-
-/** Append new extent to the i-node and do some splitting if necessary.
- *
- * @param inode_ref      I-node to append extent to
- * @param path           Path in the extent tree for possible splitting
- * @param last_path_item Input/output parameter for pointer to the last
- *                       valid item in the extent tree path
- * @param iblock         Logical index of block to append extent for
- *
- * @return Error code
- *
- */
-static errno_t ext4_extent_append_extent(ext4_inode_ref_t *inode_ref,
-    ext4_extent_path_t *path, uint32_t iblock)
-{
-	ext4_extent_path_t *path_ptr = path + path->depth;
-
-	uint32_t block_size =
-	    ext4_superblock_get_block_size(inode_ref->fs->superblock);
-
-	/* Start splitting */
-	while (path_ptr > path) {
-		uint16_t entries =
-		    ext4_extent_header_get_entries_count(path_ptr->header);
-		uint16_t limit =
-		    ext4_extent_header_get_max_entries_count(path_ptr->header);
-
-		if (entries == limit) {
-			/* Full node - allocate block for new one */
-			uint32_t fblock;
-			errno_t rc = ext4_balloc_alloc_block(inode_ref, &fblock);
-			if (rc != EOK)
-				return rc;
-
-			block_t *block;
-			rc = block_get(&block, inode_ref->fs->device, fblock,
-			    BLOCK_FLAGS_NOREAD);
-			if (rc != EOK) {
-				ext4_balloc_free_block(inode_ref, fblock);
-				return rc;
-			}
-
-			/* Put back not modified old block */
-			rc = block_put(path_ptr->block);
-			if (rc != EOK) {
-				ext4_balloc_free_block(inode_ref, fblock);
-				block_put(block);
-				return rc;
-			}
-
-			/* Initialize newly allocated block and remember it */
-			memset(block->data, 0, block_size);
-			path_ptr->block = block;
-
-			/* Update pointers in extent path structure */
-			path_ptr->header = block->data;
-			if (path_ptr->depth) {
-				path_ptr->index = EXT4_EXTENT_FIRST_INDEX(path_ptr->header);
-				ext4_extent_index_set_first_block(path_ptr->index, iblock);
-				ext4_extent_index_set_leaf(path_ptr->index, (path_ptr + 1)->block->lba);
-				limit = (block_size - sizeof(ext4_extent_header_t)) /
-				    sizeof(ext4_extent_index_t);
-			} else {
-				path_ptr->extent = EXT4_EXTENT_FIRST(path_ptr->header);
-				ext4_extent_set_first_block(path_ptr->extent, iblock);
-				limit = (block_size - sizeof(ext4_extent_header_t)) /
-				    sizeof(ext4_extent_t);
-			}
-
-			/* Initialize on-disk structure (header) */
-			ext4_extent_header_set_entries_count(path_ptr->header, 1);
-			ext4_extent_header_set_max_entries_count(path_ptr->header, limit);
-			ext4_extent_header_set_magic(path_ptr->header, EXT4_EXTENT_MAGIC);
-			ext4_extent_header_set_depth(path_ptr->header, path_ptr->depth);
-			ext4_extent_header_set_generation(path_ptr->header, 0);
-
-			path_ptr->block->dirty = true;
-
-			/* Jump to the preceeding item */
-			path_ptr--;
-		} else {
-			/* Node with free space */
-			if (path_ptr->depth) {
-				path_ptr->index = EXT4_EXTENT_FIRST_INDEX(path_ptr->header) + entries;
-				ext4_extent_index_set_first_block(path_ptr->index, iblock);
-				ext4_extent_index_set_leaf(path_ptr->index, (path_ptr + 1)->block->lba);
-			} else {
-				path_ptr->extent = EXT4_EXTENT_FIRST(path_ptr->header) + entries;
-				ext4_extent_set_first_block(path_ptr->extent, iblock);
-			}
-
-			ext4_extent_header_set_entries_count(path_ptr->header, entries + 1);
-			path_ptr->block->dirty = true;
-
-			/* No more splitting needed */
-			return EOK;
-		}
-	}
-
-	assert(path_ptr == path);
-
-	/* Should be the root split too? */
-
-	uint16_t entries = ext4_extent_header_get_entries_count(path->header);
-	uint16_t limit = ext4_extent_header_get_max_entries_count(path->header);
-
-	if (entries == limit) {
-		uint32_t new_fblock;
-		errno_t rc = ext4_balloc_alloc_block(inode_ref, &new_fblock);
-		if (rc != EOK)
-			return rc;
-
-		block_t *block;
-		rc = block_get(&block, inode_ref->fs->device, new_fblock,
-		    BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-
-		/* Initialize newly allocated block */
-		memset(block->data, 0, block_size);
-
-		/* Move data from root to the new block */
-		memcpy(block->data, inode_ref->inode->blocks,
-		    EXT4_INODE_BLOCKS * sizeof(uint32_t));
-
-		/* Data block is initialized */
-
-		block_t *root_block = path->block;
-		uint16_t root_depth = path->depth;
-		ext4_extent_header_t *root_header = path->header;
-
-		/* Make space for tree growing */
-		ext4_extent_path_t *new_root = path;
-		ext4_extent_path_t *old_root = path + 1;
-
-		for (int i = path->depth; i >= 0; i--)
-			path[i + 1] = path[i];
-
-		memset(new_root, 0, sizeof(ext4_extent_path_t));
-
-		/* Update old root structure */
-		old_root->block = block;
-		old_root->header = (ext4_extent_header_t *)block->data;
-
-		/* Add new entry and update limit for entries */
-		if (old_root->depth) {
-			limit = (block_size - sizeof(ext4_extent_header_t)) /
-			    sizeof(ext4_extent_index_t);
-			old_root->index = EXT4_EXTENT_FIRST_INDEX(old_root->header) + entries;
-			ext4_extent_index_set_first_block(old_root->index, iblock);
-			ext4_extent_index_set_leaf(old_root->index, (old_root + 1)->block->lba);
-			old_root->extent = NULL;
-		} else {
-			limit = (block_size - sizeof(ext4_extent_header_t)) /
-			    sizeof(ext4_extent_t);
-			old_root->extent = EXT4_EXTENT_FIRST(old_root->header) + entries;
-			ext4_extent_set_first_block(old_root->extent, iblock);
-			old_root->index = NULL;
-		}
-
-		ext4_extent_header_set_entries_count(old_root->header, entries + 1);
-		ext4_extent_header_set_max_entries_count(old_root->header, limit);
-
-		old_root->block->dirty = true;
-
-		/* Re-initialize new root metadata */
-		new_root->depth = root_depth + 1;
-		new_root->block = root_block;
-		new_root->header = root_header;
-		new_root->extent = NULL;
-		new_root->index = EXT4_EXTENT_FIRST_INDEX(new_root->header);
-
-		ext4_extent_header_set_depth(new_root->header, new_root->depth);
-
-		/* Create new entry in root */
-		ext4_extent_header_set_entries_count(new_root->header, 1);
-		ext4_extent_index_set_first_block(new_root->index, 0);
-		ext4_extent_index_set_leaf(new_root->index, new_fblock);
-
-		new_root->block->dirty = true;
-	} else {
-		if (path->depth) {
-			path->index = EXT4_EXTENT_FIRST_INDEX(path->header) + entries;
-			ext4_extent_index_set_first_block(path->index, iblock);
-			ext4_extent_index_set_leaf(path->index, (path + 1)->block->lba);
-		} else {
-			path->extent = EXT4_EXTENT_FIRST(path->header) + entries;
-			ext4_extent_set_first_block(path->extent, iblock);
-		}
-
-		ext4_extent_header_set_entries_count(path->header, entries + 1);
-		path->block->dirty = true;
-	}
-
-	return EOK;
-}
-
-/** Append data block to the i-node.
- *
- * This function allocates data block, tries to append it
- * to some existing extent or creates new extents.
- * It includes possible extent tree modifications (splitting).
- *
- * @param inode_ref I-node to append block to
- * @param iblock    Output logical number of newly allocated block
- * @param fblock    Output physical block address of newly allocated block
- *
- * @return Error code
- *
- */
-errno_t ext4_extent_append_block(ext4_inode_ref_t *inode_ref, uint32_t *iblock,
-    uint32_t *fblock, bool update_size)
-{
-	ext4_superblock_t *sb = inode_ref->fs->superblock;
-	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	/* Calculate number of new logical block */
-	uint32_t new_block_idx = 0;
-	if (inode_size > 0) {
-		if ((inode_size % block_size) != 0)
-			inode_size += block_size - (inode_size % block_size);
-
-		new_block_idx = inode_size / block_size;
-	}
-
-	/* Load the nearest leaf (with extent) */
-	ext4_extent_path_t *path;
-	errno_t rc2;
-	errno_t rc = ext4_extent_find_extent(inode_ref, new_block_idx, &path);
-	if (rc != EOK)
-		return rc;
-
-	/* Jump to last item of the path (extent) */
-	ext4_extent_path_t *path_ptr = path;
-	while (path_ptr->depth != 0)
-		path_ptr++;
-
-	/* Add new extent to the node if not present */
-	if (path_ptr->extent == NULL)
-		goto append_extent;
-
-	uint16_t block_count = ext4_extent_get_block_count(path_ptr->extent);
-	uint16_t block_limit = (1 << 15);
-
-	uint32_t phys_block = 0;
-	if (block_count < block_limit) {
-		/* There is space for new block in the extent */
-		if (block_count == 0) {
-			/* Existing extent is empty */
-			rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
-			if (rc != EOK)
-				goto finish;
-
-			/* Initialize extent */
-			ext4_extent_set_first_block(path_ptr->extent, new_block_idx);
-			ext4_extent_set_start(path_ptr->extent, phys_block);
-			ext4_extent_set_block_count(path_ptr->extent, 1);
-
-			/* Update i-node */
-			if (update_size) {
-				ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
-				inode_ref->dirty = true;
-			}
-
-			path_ptr->block->dirty = true;
-
-			goto finish;
-		} else {
-			/* Existing extent contains some blocks */
-			phys_block = ext4_extent_get_start(path_ptr->extent);
-			phys_block += ext4_extent_get_block_count(path_ptr->extent);
-
-			/* Check if the following block is free for allocation */
-			bool free;
-			rc = ext4_balloc_try_alloc_block(inode_ref, phys_block, &free);
-			if (rc != EOK)
-				goto finish;
-
-			if (!free) {
-				/* Target is not free, new block must be appended to new extent */
-				goto append_extent;
-			}
-
-			/* Update extent */
-			ext4_extent_set_block_count(path_ptr->extent, block_count + 1);
-
-			/* Update i-node */
-			if (update_size) {
-				ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
-				inode_ref->dirty = true;
-			}
-
-			path_ptr->block->dirty = true;
-
-			goto finish;
-		}
-	}
-
-append_extent:
-	/* Append new extent to the tree */
-	phys_block = 0;
-
-	/* Allocate new data block */
-	rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
-	if (rc != EOK)
-		goto finish;
-
-	/* Append extent for new block (includes tree splitting if needed) */
-	rc = ext4_extent_append_extent(inode_ref, path, new_block_idx);
-	if (rc != EOK) {
-		ext4_balloc_free_block(inode_ref, phys_block);
-		goto finish;
-	}
-
-	uint32_t tree_depth = ext4_extent_header_get_depth(path->header);
-	path_ptr = path + tree_depth;
-
-	/* Initialize newly created extent */
-	ext4_extent_set_block_count(path_ptr->extent, 1);
-	ext4_extent_set_first_block(path_ptr->extent, new_block_idx);
-	ext4_extent_set_start(path_ptr->extent, phys_block);
-
-	/* Update i-node */
-	if (update_size) {
-		ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
-		inode_ref->dirty = true;
-	}
-
-	path_ptr->block->dirty = true;
-
-finish:
-	rc2 = EOK;
-
-	/* Set return values */
-	*iblock = new_block_idx;
-	*fblock = phys_block;
-
-	/*
-	 * Put loaded blocks
-	 * starting from 1: 0 is a block with inode data
-	 */
-	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
-			rc2 = block_put(path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
-	}
-
-	/* Destroy temporary data structure */
-	free(path);
-
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/filesystem.c
===================================================================
--- uspace/lib/ext4/src/filesystem.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2030 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  filesystem.c
- * @brief More complex filesystem operations.
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <align.h>
-#include <crypto.h>
-#include <ipc/vfs.h>
-#include <libfs.h>
-#include <stdlib.h>
-#include "ext4/balloc.h"
-#include "ext4/bitmap.h"
-#include "ext4/block_group.h"
-#include "ext4/cfg.h"
-#include "ext4/directory.h"
-#include "ext4/extent.h"
-#include "ext4/filesystem.h"
-#include "ext4/ialloc.h"
-#include "ext4/inode.h"
-#include "ext4/ops.h"
-#include "ext4/superblock.h"
-
-static errno_t ext4_filesystem_check_features(ext4_filesystem_t *, bool *);
-static errno_t ext4_filesystem_init_block_groups(ext4_filesystem_t *);
-static errno_t ext4_filesystem_alloc_this_inode(ext4_filesystem_t *,
-    uint32_t, ext4_inode_ref_t **, int);
-static uint32_t ext4_filesystem_inodes_per_block(ext4_superblock_t *);
-
-/** Initialize filesystem for opening.
- *
- * But do not mark mounted just yet.
- *
- * @param fs         Filesystem instance to be initialized
- * @param service_id Block device to open
- * @param cmode      Cache mode
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_init(ext4_filesystem_t *fs, service_id_t service_id,
-    enum cache_mode cmode)
-{
-	errno_t rc;
-	ext4_superblock_t *temp_superblock = NULL;
-
-	fs->device = service_id;
-
-	/* Initialize block library (4096 is size of communication channel) */
-	rc = block_init(fs->device);
-	if (rc != EOK)
-		goto err;
-
-	/* Read superblock from device to memory */
-	rc = ext4_superblock_read_direct(fs->device, &temp_superblock);
-	if (rc != EOK)
-		goto err_1;
-
-	/* Read block size from superblock and check */
-	uint32_t block_size = ext4_superblock_get_block_size(temp_superblock);
-	if (block_size > EXT4_MAX_BLOCK_SIZE) {
-		rc = ENOTSUP;
-		goto err_1;
-	}
-
-	/* Initialize block caching by libblock */
-	rc = block_cache_init(service_id, block_size, 0, cmode);
-	if (rc != EOK)
-		goto err_1;
-
-	/* Compute limits for indirect block levels */
-	uint32_t block_ids_per_block = block_size / sizeof(uint32_t);
-	fs->inode_block_limits[0] = EXT4_INODE_DIRECT_BLOCK_COUNT;
-	fs->inode_blocks_per_level[0] = 1;
-	for (unsigned int i = 1; i < 4; i++) {
-		fs->inode_blocks_per_level[i] = fs->inode_blocks_per_level[i - 1] *
-		    block_ids_per_block;
-		fs->inode_block_limits[i] = fs->inode_block_limits[i - 1] +
-		    fs->inode_blocks_per_level[i];
-	}
-
-	/* Return loaded superblock */
-	fs->superblock = temp_superblock;
-
-	uint16_t state = ext4_superblock_get_state(fs->superblock);
-
-	if (((state & EXT4_SUPERBLOCK_STATE_VALID_FS) !=
-	    EXT4_SUPERBLOCK_STATE_VALID_FS) ||
-	    ((state & EXT4_SUPERBLOCK_STATE_ERROR_FS) ==
-	    EXT4_SUPERBLOCK_STATE_ERROR_FS)) {
-		rc = ENOTSUP;
-		goto err_2;
-	}
-
-	rc = ext4_superblock_check_sanity(fs->superblock);
-	if (rc != EOK)
-		goto err_2;
-
-	/* Check flags */
-	bool read_only;
-	rc = ext4_filesystem_check_features(fs, &read_only);
-	if (rc != EOK)
-		goto err_2;
-
-	return EOK;
-err_2:
-	block_cache_fini(fs->device);
-err_1:
-	block_fini(fs->device);
-err:
-	if (temp_superblock)
-		ext4_superblock_release(temp_superblock);
-	return rc;
-}
-
-/** Finalize filesystem.
- *
- * @param fs Filesystem to be finalized
- *
- */
-static void ext4_filesystem_fini(ext4_filesystem_t *fs)
-{
-	/* Release memory space for superblock */
-	free(fs->superblock);
-
-	/* Finish work with block library */
-	block_cache_fini(fs->device);
-	block_fini(fs->device);
-}
-
-/** Create lost+found directory.
- *
- * @param fs Filesystem
- * @return EOK on success or error code
- */
-static errno_t ext4_filesystem_create_lost_found(ext4_filesystem_t *fs,
-    ext4_inode_ref_t *root_dir_ref)
-{
-	errno_t rc;
-	ext4_inode_ref_t *inode_ref;
-
-	rc = ext4_filesystem_alloc_inode(fs, &inode_ref, L_DIRECTORY);
-	if (rc != EOK)
-		goto error;
-
-	rc = ext4_directory_add_entry(inode_ref, ".", inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	rc = ext4_directory_add_entry(inode_ref, "..", root_dir_ref);
-	if (rc != EOK)
-		goto error;
-
-	rc = ext4_directory_add_entry(root_dir_ref, "lost+found", inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	inode_ref->dirty = true;
-
-	uint16_t nlinks = ext4_inode_get_links_count(inode_ref->inode);
-	ext4_inode_set_links_count(inode_ref->inode, nlinks + 1);
-
-	rc = ext4_filesystem_put_inode_ref(inode_ref);
-	if (rc != EOK)
-		goto error;
-
-error:
-	return rc;
-}
-
-/** Create root directory.
- *
- * @param fs Filesystem
- * @return EOK on success or error code
- */
-static errno_t ext4_filesystem_create_root_dir(ext4_filesystem_t *fs)
-{
-	errno_t rc;
-	ext4_inode_ref_t *inode_ref;
-
-	rc = ext4_filesystem_get_inode_ref(fs, EXT4_INODE_ROOT_INDEX,
-	    &inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	inode_ref->dirty = true;
-
-	rc = ext4_directory_add_entry(inode_ref, ".", inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	rc = ext4_directory_add_entry(inode_ref, "..", inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	uint16_t nlinks = ext4_inode_get_links_count(inode_ref->inode);
-	ext4_inode_set_links_count(inode_ref->inode, nlinks + 1);
-
-	rc = ext4_filesystem_create_lost_found(fs, inode_ref);
-	if (rc != EOK)
-		goto error;
-
-	nlinks = ext4_inode_get_links_count(inode_ref->inode);
-	ext4_inode_set_links_count(inode_ref->inode, nlinks + 1);
-
-	rc = ext4_filesystem_put_inode_ref(inode_ref);
-	if (rc != EOK)
-		goto error;
-
-error:
-	return rc;
-}
-
-/** Create new filesystem.
- *
- * @param cfg Configuration of new file system
- * @param service_id Block device where to create new file system
- */
-errno_t ext4_filesystem_create(ext4_cfg_t *cfg, service_id_t service_id)
-{
-	errno_t rc;
-	ext4_superblock_t *superblock = NULL;
-	ext4_filesystem_t *fs = NULL;
-	size_t dev_bsize;
-	aoff64_t dev_nblocks;
-	ext4_inode_ref_t *inode_ref = NULL;
-	bool block_inited = false;
-	bool fs_inited = false;
-	uint32_t idx;
-
-	/* Initialize block library (4096 is size of communication channel) */
-	rc = block_init(service_id);
-	if (rc != EOK)
-		goto err;
-
-	block_inited = true;
-
-	/* Get device block size */
-	rc = block_get_bsize(service_id, &dev_bsize);
-	if (rc != EOK)
-		goto err;
-
-	/* Get device number of blocks */
-	rc = block_get_nblocks(service_id, &dev_nblocks);
-	if (rc != EOK)
-		goto err;
-
-	/* Create superblock */
-	rc = ext4_superblock_create(dev_bsize, dev_nblocks, cfg, &superblock);
-	if (rc != EOK)
-		goto err;
-
-	/* Write superblock to device */
-	rc = ext4_superblock_write_direct(service_id, superblock);
-	if (rc != EOK)
-		goto err;
-
-	block_fini(service_id);
-	block_inited = false;
-	ext4_superblock_release(superblock);
-	superblock = NULL;
-
-	fs = calloc(1, sizeof(ext4_filesystem_t));
-	if (fs == NULL)
-		goto err;
-
-	/* Open file system */
-	rc = ext4_filesystem_init(fs, service_id, CACHE_MODE_WT);
-	if (rc != EOK)
-		goto err;
-
-	fs_inited = true;
-
-	/* Init block groups */
-	rc = ext4_filesystem_init_block_groups(fs);
-	if (rc != EOK)
-		goto err;
-
-	/* Reserved i-nodes */
-	for (idx = 1; idx < EXT4_REV0_FIRST_INO; idx++) {
-		if (idx == EXT4_INODE_ROOT_INDEX) {
-			rc = ext4_filesystem_alloc_this_inode(fs, idx,
-			    &inode_ref, L_DIRECTORY);
-			if (rc != EOK)
-				goto error;
-
-			rc = ext4_filesystem_put_inode_ref(inode_ref);
-			if (rc != EOK)
-				goto error;
-		} else {
-			/* Allocate inode by allocation algorithm */
-			errno_t rc = ext4_ialloc_alloc_this_inode(fs, idx,
-			    false);
-			if (rc != EOK)
-				return rc;
-
-			rc = ext4_filesystem_get_inode_ref(fs, idx,
-			    &inode_ref);
-			if (rc != EOK)
-				goto error;
-
-			memset(inode_ref->inode, 0, ext4_superblock_get_inode_size(fs->superblock));
-			inode_ref->dirty = true;
-
-			rc = ext4_filesystem_put_inode_ref(inode_ref);
-			if (rc != EOK)
-				goto error;
-		}
-	}
-
-	/* Create root directory */
-	rc = ext4_filesystem_create_root_dir(fs);
-	if (rc != EOK)
-		goto err;
-
-	/* Write superblock to device */
-	rc = ext4_superblock_write_direct(service_id, fs->superblock);
-	if (rc != EOK)
-		goto err;
-
-	ext4_filesystem_fini(fs);
-	free(fs);
-	return EOK;
-err:
-	if (fs_inited)
-		ext4_filesystem_fini(fs);
-	if (fs != NULL)
-		free(fs);
-	if (superblock != NULL)
-		ext4_superblock_release(superblock);
-	if (block_inited)
-		block_fini(service_id);
-	return rc;
-error:
-	return rc;
-}
-
-/** Probe filesystem.
- *
- * @param service_id Block device to probe
- * @param info Place to store probe information
- *
- * @return EOK or an error code.
- *
- */
-errno_t ext4_filesystem_probe(service_id_t service_id,
-    ext4_fs_probe_info_t *info)
-{
-	ext4_filesystem_t *fs = NULL;
-	errno_t rc;
-
-	fs = calloc(1, sizeof(ext4_filesystem_t));
-	if (fs == NULL)
-		return ENOMEM;
-
-	/* Initialize the file system for opening */
-	rc = ext4_filesystem_init(fs, service_id, CACHE_MODE_WT);
-	if (rc != EOK) {
-		free(fs);
-		return rc;
-	}
-
-	rc = ext4_superblock_get_volume_name(fs->superblock, info->vol_name,
-	    sizeof(info->vol_name));
-	if (rc != EOK) {
-		ext4_filesystem_fini(fs);
-		return rc;
-	}
-
-	ext4_filesystem_fini(fs);
-	return EOK;
-}
-
-/** Open filesystem and read all needed data.
- *
- * @param fs         Filesystem to be initialized
- * @param inst       Instance
- * @param service_id Identifier if device with the filesystem
- * @param cmode      Cache mode
- * @param size       Output value - size of root node
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_open(ext4_instance_t *inst, service_id_t service_id,
-    enum cache_mode cmode, aoff64_t *size, ext4_filesystem_t **rfs)
-{
-	int fs_inited = 0;
-	ext4_filesystem_t *fs = NULL;
-	fs_node_t *root_node = NULL;
-	errno_t rc;
-
-	fs = calloc(1, sizeof(ext4_filesystem_t));
-	if (fs == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	inst->filesystem = fs;
-
-	/* Initialize the file system for opening */
-	rc = ext4_filesystem_init(fs, service_id, cmode);
-	if (rc != EOK)
-		goto error;
-
-	fs_inited = 1;
-
-	/* Read root node */
-	rc = ext4_node_get_core(&root_node, inst, EXT4_INODE_ROOT_INDEX);
-	if (rc != EOK)
-		goto error;
-
-	/* Mark system as mounted */
-	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_ERROR_FS);
-	rc = ext4_superblock_write_direct(fs->device, fs->superblock);
-	if (rc != EOK)
-		goto error;
-
-	uint16_t mnt_count = ext4_superblock_get_mount_count(fs->superblock);
-	ext4_superblock_set_mount_count(fs->superblock, mnt_count + 1);
-
-	ext4_node_t *enode = EXT4_NODE(root_node);
-
-	*size = ext4_inode_get_size(fs->superblock, enode->inode_ref->inode);
-
-	ext4_node_put(root_node);
-	*rfs = fs;
-	return EOK;
-error:
-	if (root_node != NULL)
-		ext4_node_put(root_node);
-
-	if (fs_inited)
-		ext4_filesystem_fini(fs);
-	free(fs);
-	return rc;
-}
-
-/** Close filesystem.
- *
- * @param fs Filesystem to be destroyed
- *
- * @return EOK or an error code. On error the state of the file
- *         system is unchanged.
- *
- */
-errno_t ext4_filesystem_close(ext4_filesystem_t *fs)
-{
-	/* Write the superblock to the device */
-	ext4_superblock_set_state(fs->superblock, EXT4_SUPERBLOCK_STATE_VALID_FS);
-	errno_t rc = ext4_superblock_write_direct(fs->device, fs->superblock);
-	if (rc != EOK)
-		return rc;
-
-	ext4_filesystem_fini(fs);
-	return EOK;
-}
-
-/** Check filesystem's features, if supported by this driver
- *
- * Function can return EOK and set read_only flag. It mean's that
- * there are some not-supported features, that can cause problems
- * during some write operations.
- *
- * @param fs        Filesystem to be checked
- * @param read_only Place to write flag saying whether filesystem
- *                  should be mounted only for reading
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_check_features(ext4_filesystem_t *fs,
-    bool *read_only)
-{
-	/* Feature flags are present only in higher revisions */
-	if (ext4_superblock_get_rev_level(fs->superblock) == 0) {
-		*read_only = false;
-		return EOK;
-	}
-
-	/*
-	 * Check incompatible features - if filesystem has some,
-	 * volume can't be mounted
-	 */
-	uint32_t incompatible_features;
-	incompatible_features =
-	    ext4_superblock_get_features_incompatible(fs->superblock);
-	incompatible_features &= ~EXT4_FEATURE_INCOMPAT_SUPP;
-	if (incompatible_features > 0)
-		return ENOTSUP;
-
-	/*
-	 * Check read-only features, if filesystem has some,
-	 * volume can be mount only in read-only mode
-	 */
-	uint32_t compatible_read_only;
-	compatible_read_only =
-	    ext4_superblock_get_features_read_only(fs->superblock);
-	compatible_read_only &= ~EXT4_FEATURE_RO_COMPAT_SUPP;
-	if (compatible_read_only > 0) {
-		*read_only = true;
-		return EOK;
-	}
-
-	return EOK;
-}
-
-/** Convert block address to relative index in block group.
- *
- * @param sb         Superblock pointer
- * @param block_addr Block number to convert
- *
- * @return Relative number of block
- *
- */
-uint32_t ext4_filesystem_blockaddr2_index_in_group(ext4_superblock_t *sb,
-    uint32_t block_addr)
-{
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-	uint32_t first_block = ext4_superblock_get_first_data_block(sb);
-
-	/* First block == 0 or 1 */
-	if (first_block == 0)
-		return block_addr % blocks_per_group;
-	else
-		return (block_addr - 1) % blocks_per_group;
-}
-
-/** Convert relative block address in group to absolute address.
- *
- * @param sb Superblock pointer
- *
- * @return Absolute block address
- *
- */
-uint32_t ext4_filesystem_index_in_group2blockaddr(ext4_superblock_t *sb,
-    uint32_t index, uint32_t bgid)
-{
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-
-	if (ext4_superblock_get_first_data_block(sb) == 0)
-		return bgid * blocks_per_group + index;
-	else
-		return bgid * blocks_per_group + index + 1;
-}
-
-/** Convert the absolute block number to group number
- *
- * @param sb    Pointer to the superblock
- * @param b     Absolute block number
- *
- * @return      Group number
- */
-uint32_t ext4_filesystem_blockaddr2group(ext4_superblock_t *sb, uint64_t b)
-{
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-	uint32_t first_block = ext4_superblock_get_first_data_block(sb);
-
-	return (b - first_block) / blocks_per_group;
-}
-
-/** Initialize block group structures
- */
-static errno_t ext4_filesystem_init_block_groups(ext4_filesystem_t *fs)
-{
-	errno_t rc;
-	block_t *block;
-	aoff64_t b;
-	ext4_block_group_t *bg;
-	ext4_superblock_t *sb = fs->superblock;
-	ext4_block_group_ref_t *bg_ref;
-
-	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint32_t desc_size = ext4_superblock_get_desc_size(fs->superblock);
-	/* Number of descriptors per block */
-	uint32_t descriptors_per_block =
-	    ext4_superblock_get_block_size(fs->superblock) / desc_size;
-	/* Block where block group descriptor (and first block group) starts */
-	aoff64_t block_id =
-	    ext4_superblock_get_first_data_block(fs->superblock) + 1;
-	/* Number of blocks containing descriptor table */
-	uint32_t dtable_blocks =
-	    (block_group_count + descriptors_per_block - 1) /
-	    descriptors_per_block;
-
-	uint32_t bg_index;
-	aoff64_t bg_block0;
-	uint32_t dcnt;
-	uint32_t i;
-	uint32_t now;
-
-	aoff64_t block_bitmap;
-	aoff64_t inode_bitmap;
-	aoff64_t inode_table;
-	uint32_t free_blocks;
-	uint32_t free_inodes;
-	uint32_t used_dirs;
-	uint32_t reserved;
-	uint32_t inode_table_blocks;
-
-	dcnt = block_group_count;
-
-	/* Fill in block descriptors */
-	b = block_id;
-	bg_index = 0;
-	bg_block0 = block_id;
-	while (dcnt > 0) {
-		rc = block_get(&block, fs->device, b, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-
-		if (dcnt > descriptors_per_block)
-			now = descriptors_per_block;
-		else
-			now = dcnt;
-
-		memset(block->data, 0, block_size);
-
-		for (i = 0; i < now; i++) {
-			bg = (ext4_block_group_t *) (block->data + i *
-			    desc_size);
-
-			block_bitmap = bg_block0 + dtable_blocks;
-			inode_bitmap = block_bitmap + 1;
-			inode_table = inode_bitmap + 1;
-
-			free_blocks = ext4_superblock_get_blocks_in_group(sb,
-			    bg_index);
-
-			free_inodes =
-			    ext4_filesystem_bg_get_itable_size(sb, bg_index) *
-			    ext4_filesystem_inodes_per_block(sb);
-			used_dirs = 0;
-
-			ext4_block_group_set_block_bitmap(bg, sb, block_bitmap);
-			ext4_block_group_set_inode_bitmap(bg, sb, inode_bitmap);
-			ext4_block_group_set_inode_table_first_block(bg, sb,
-			    inode_table);
-			ext4_block_group_set_free_blocks_count(bg, sb,
-			    free_blocks);
-			ext4_block_group_set_free_inodes_count(bg, sb,
-			    free_inodes);
-			ext4_block_group_set_used_dirs_count(bg, sb,
-			    used_dirs);
-
-			/// XX Lazy
-			ext4_block_group_set_flag(bg,
-			    EXT4_BLOCK_GROUP_BLOCK_UNINIT);
-			ext4_block_group_set_flag(bg,
-			    EXT4_BLOCK_GROUP_INODE_UNINIT);
-
-			bg_index++;
-			bg_block0 += ext4_superblock_get_blocks_per_group(sb);
-		}
-
-		block->dirty = true;
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		++b;
-		dcnt -= now;
-	}
-
-	/* This initializes the bitmaps and inode table */
-	for (bg_index = 0; bg_index < block_group_count; bg_index++) {
-		rc = ext4_filesystem_get_block_group_ref(fs, bg_index, &bg_ref);
-		if (rc != EOK)
-			return rc;
-
-		/*
-		 * Adjust number of free blocks
-		 */
-		free_blocks = ext4_superblock_get_blocks_in_group(sb, bg_index);
-		reserved = ext4_filesystem_bg_get_backup_blocks(bg_ref);
-		inode_table_blocks = ext4_filesystem_bg_get_itable_size(sb,
-		    bg_ref->index);
-		/* One for block bitmap one for inode bitmap */
-		free_blocks = free_blocks - reserved - 2 - inode_table_blocks;
-
-		ext4_block_group_set_free_blocks_count(bg_ref->block_group,
-		    sb, free_blocks);
-		bg_ref->dirty = true;
-
-		rc = ext4_filesystem_put_block_group_ref(bg_ref);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Initialize block bitmap in block group.
- *
- * @param bg_ref Reference to block group
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_init_block_bitmap(ext4_block_group_ref_t *bg_ref)
-{
-	uint64_t itb;
-	uint32_t sz;
-	uint32_t i;
-
-	/* Load bitmap */
-	ext4_superblock_t *sb = bg_ref->fs->superblock;
-	uint64_t bitmap_block_addr = ext4_block_group_get_block_bitmap(
-	    bg_ref->block_group, bg_ref->fs->superblock);
-	uint64_t bitmap_inode_addr = ext4_block_group_get_inode_bitmap(
-	    bg_ref->block_group, bg_ref->fs->superblock);
-	uint32_t blocks_group = ext4_superblock_get_blocks_per_group(sb);
-	uint32_t bg_blocks = ext4_superblock_get_blocks_in_group(sb,
-	    bg_ref->index);
-
-	block_t *bitmap_block;
-	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
-	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK)
-		return rc;
-
-	uint8_t *bitmap = bitmap_block->data;
-
-	/* Initialize all bitmap bits to zero */
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	memset(bitmap, 0, block_size);
-
-	/* Determine the number of reserved blocks in the group */
-	uint32_t reserved_cnt = ext4_filesystem_bg_get_backup_blocks(bg_ref);
-
-	/* Set bits from to first block to first data block - 1 to one (allocated) */
-	for (uint32_t block = 0; block < reserved_cnt; ++block)
-		ext4_bitmap_set_bit(bitmap, block);
-
-	uint32_t bitmap_block_gid = ext4_filesystem_blockaddr2group(sb,
-	    bitmap_block_addr);
-	if (bitmap_block_gid == bg_ref->index) {
-		ext4_bitmap_set_bit(bitmap,
-		    ext4_filesystem_blockaddr2_index_in_group(sb, bitmap_block_addr));
-	}
-
-	uint32_t bitmap_inode_gid = ext4_filesystem_blockaddr2group(sb,
-	    bitmap_inode_addr);
-	if (bitmap_inode_gid == bg_ref->index) {
-		ext4_bitmap_set_bit(bitmap,
-		    ext4_filesystem_blockaddr2_index_in_group(sb, bitmap_inode_addr));
-	}
-
-	itb = ext4_block_group_get_inode_table_first_block(bg_ref->block_group,
-	    sb);
-	sz = ext4_filesystem_bg_get_itable_size(sb, bg_ref->index);
-
-	for (i = 0; i < sz; ++i, ++itb) {
-		uint32_t gid = ext4_filesystem_blockaddr2group(sb, itb);
-		if (gid == bg_ref->index) {
-			ext4_bitmap_set_bit(bitmap,
-			    ext4_filesystem_blockaddr2_index_in_group(sb, itb));
-		}
-	}
-
-	/* For last group need to mark blocks which are outside of the FS */
-	for (uint32_t block = bg_blocks; block < blocks_group; block++) {
-		ext4_bitmap_set_bit(bitmap, block);
-	}
-
-	bitmap_block->dirty = true;
-
-	/* Save bitmap */
-	return block_put(bitmap_block);
-}
-
-/** Initialize i-node bitmap in block group.
- *
- * @param bg_ref Reference to block group
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_init_inode_bitmap(ext4_block_group_ref_t *bg_ref)
-{
-	/* Load bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-	    bg_ref->block_group, bg_ref->fs->superblock);
-	block_t *bitmap_block;
-
-	errno_t rc = block_get(&bitmap_block, bg_ref->fs->device,
-	    bitmap_block_addr, BLOCK_FLAGS_NOREAD);
-	if (rc != EOK)
-		return rc;
-
-	uint8_t *bitmap = bitmap_block->data;
-
-	/* Initialize all bitmap bits to zero */
-	uint32_t block_size = ext4_superblock_get_block_size(bg_ref->fs->superblock);
-	uint32_t inodes_per_group =
-	    ext4_superblock_get_inodes_per_group(bg_ref->fs->superblock);
-	memset(bitmap, 0, (inodes_per_group + 7) / 8);
-
-	uint32_t start_bit = inodes_per_group;
-	uint32_t end_bit = block_size * 8;
-
-	uint32_t i;
-	for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
-		ext4_bitmap_set_bit(bitmap, i);
-
-	if (i < end_bit)
-		memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
-
-	bitmap_block->dirty = true;
-
-	/* Save bitmap */
-	return block_put(bitmap_block);
-}
-
-/** Initialize i-node table in block group.
- *
- * @param bg_ref Reference to block group
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_init_inode_table(ext4_block_group_ref_t *bg_ref)
-{
-	ext4_superblock_t *sb = bg_ref->fs->superblock;
-
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	uint32_t inodes_per_block = ext4_filesystem_inodes_per_block(sb);
-
-	uint32_t inodes_in_group =
-	    ext4_superblock_get_inodes_in_group(sb, bg_ref->index);
-
-	uint32_t table_blocks = inodes_in_group / inodes_per_block;
-
-	if (inodes_in_group % inodes_per_block)
-		table_blocks++;
-
-	/* Compute initialization bounds */
-	uint32_t first_block = ext4_block_group_get_inode_table_first_block(
-	    bg_ref->block_group, sb);
-
-	uint32_t last_block = first_block + table_blocks - 1;
-
-	/* Initialization of all itable blocks */
-	for (uint32_t fblock = first_block; fblock <= last_block; ++fblock) {
-		block_t *block;
-		errno_t rc = block_get(&block, bg_ref->fs->device, fblock,
-		    BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-
-		memset(block->data, 0, block_size);
-		block->dirty = true;
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Get reference to block group specified by index.
- *
- * @param fs   Filesystem to find block group on
- * @param bgid Index of block group to load
- * @param ref  Output pointer for reference
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_get_block_group_ref(ext4_filesystem_t *fs, uint32_t bgid,
-    ext4_block_group_ref_t **ref)
-{
-	/* Allocate memory for new structure */
-	ext4_block_group_ref_t *newref =
-	    malloc(sizeof(ext4_block_group_ref_t));
-	if (newref == NULL)
-		return ENOMEM;
-
-	/* Compute number of descriptors, that fits in one data block */
-	uint32_t descriptors_per_block =
-	    ext4_superblock_get_block_size(fs->superblock) /
-	    ext4_superblock_get_desc_size(fs->superblock);
-
-	/* Block group descriptor table starts at the next block after superblock */
-	aoff64_t block_id =
-	    ext4_superblock_get_first_data_block(fs->superblock) + 1;
-
-	/* Find the block containing the descriptor we are looking for */
-	block_id += bgid / descriptors_per_block;
-	uint32_t offset = (bgid % descriptors_per_block) *
-	    ext4_superblock_get_desc_size(fs->superblock);
-
-	/* Load block with descriptors */
-	errno_t rc = block_get(&newref->block, fs->device, block_id, 0);
-	if (rc != EOK) {
-		free(newref);
-		return rc;
-	}
-
-	/* Initialize in-memory representation */
-	newref->block_group = newref->block->data + offset;
-	newref->fs = fs;
-	newref->index = bgid;
-	newref->dirty = false;
-
-	*ref = newref;
-
-	if (ext4_block_group_has_flag(newref->block_group,
-	    EXT4_BLOCK_GROUP_BLOCK_UNINIT)) {
-		rc = ext4_filesystem_init_block_bitmap(newref);
-		if (rc != EOK) {
-			block_put(newref->block);
-			free(newref);
-			return rc;
-		}
-
-		ext4_block_group_clear_flag(newref->block_group,
-		    EXT4_BLOCK_GROUP_BLOCK_UNINIT);
-
-		newref->dirty = true;
-	}
-
-	if (ext4_block_group_has_flag(newref->block_group,
-	    EXT4_BLOCK_GROUP_INODE_UNINIT)) {
-		rc = ext4_filesystem_init_inode_bitmap(newref);
-		if (rc != EOK) {
-			block_put(newref->block);
-			free(newref);
-			return rc;
-		}
-
-		ext4_block_group_clear_flag(newref->block_group,
-		    EXT4_BLOCK_GROUP_INODE_UNINIT);
-
-		if (!ext4_block_group_has_flag(newref->block_group,
-		    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
-			rc = ext4_filesystem_init_inode_table(newref);
-			if (rc != EOK) {
-				block_put(newref->block);
-				free(newref);
-				return rc;
-			}
-
-			ext4_block_group_set_flag(newref->block_group,
-			    EXT4_BLOCK_GROUP_ITABLE_ZEROED);
-		}
-
-		newref->dirty = true;
-	}
-
-	return EOK;
-}
-
-/** Compute checksum of block group descriptor.
- *
- * @param sb   Superblock
- * @param bgid Index of block group in the filesystem
- * @param bg   Block group to compute checksum for
- *
- * @return Checksum value
- *
- */
-static uint16_t ext4_filesystem_bg_checksum(ext4_superblock_t *sb, uint32_t bgid,
-    ext4_block_group_t *bg)
-{
-	/* If checksum not supported, 0 will be returned */
-	uint16_t crc = 0;
-
-	/* Compute the checksum only if the filesystem supports it */
-	if (ext4_superblock_has_feature_read_only(sb,
-	    EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
-		void *base = bg;
-		void *checksum = &bg->checksum;
-
-		uint32_t offset = (uint32_t) (checksum - base);
-
-		/* Convert block group index to little endian */
-		uint32_t le_group = host2uint32_t_le(bgid);
-
-		/* Initialization */
-		crc = crc16_ibm(~0, sb->uuid, sizeof(sb->uuid));
-
-		/* Include index of block group */
-		crc = crc16_ibm(crc, (uint8_t *) &le_group, sizeof(le_group));
-
-		/* Compute crc from the first part (stop before checksum field) */
-		crc = crc16_ibm(crc, (uint8_t *) bg, offset);
-
-		/* Skip checksum */
-		offset += sizeof(bg->checksum);
-
-		/* Checksum of the rest of block group descriptor */
-		if ((ext4_superblock_has_feature_incompatible(sb,
-		    EXT4_FEATURE_INCOMPAT_64BIT)) &&
-		    (offset < ext4_superblock_get_desc_size(sb)))
-			crc = crc16_ibm(crc, ((uint8_t *) bg) + offset,
-			    ext4_superblock_get_desc_size(sb) - offset);
-	}
-
-	return crc;
-}
-
-/** Get the size of the block group's inode table
- *
- * @param sb       Pointer to the superblock
- * @param bg_index Block group index
- *
- * @return         Size of the inode table in blocks.
- */
-uint32_t ext4_filesystem_bg_get_itable_size(ext4_superblock_t *sb,
-    uint32_t bg_index)
-{
-	uint32_t itable_size;
-	uint32_t block_group_count = ext4_superblock_get_block_group_count(sb);
-	uint16_t inode_table_item_size = ext4_superblock_get_inode_size(sb);
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	if (bg_index < block_group_count - 1) {
-		itable_size = inodes_per_group * inode_table_item_size;
-	} else {
-		/* Last block group could be smaller */
-		uint32_t inodes_count_total = ext4_superblock_get_inodes_count(sb);
-		itable_size =
-		    (inodes_count_total - ((block_group_count - 1) * inodes_per_group)) *
-		    inode_table_item_size;
-	}
-
-	return ROUND_UP(itable_size, block_size) / block_size;
-}
-
-/** Get the number of blocks used by superblock + gdt + reserved gdt backups
- *
- * @param bg    Pointer to block group
- *
- * @return      Number of blocks
- */
-uint32_t ext4_filesystem_bg_get_backup_blocks(ext4_block_group_ref_t *bg)
-{
-	return ext4_superblock_get_group_backup_blocks(bg->fs->superblock,
-	    bg->index);
-}
-
-/** Put reference to block group.
- *
- * @param ref Pointer for reference to be put back
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_put_block_group_ref(ext4_block_group_ref_t *ref)
-{
-	/* Check if reference modified */
-	if (ref->dirty) {
-		/* Compute new checksum of block group */
-		uint16_t checksum =
-		    ext4_filesystem_bg_checksum(ref->fs->superblock, ref->index,
-		    ref->block_group);
-		ext4_block_group_set_checksum(ref->block_group, checksum);
-
-		/* Mark block dirty for writing changes to physical device */
-		ref->block->dirty = true;
-	}
-
-	/* Put back block, that contains block group descriptor */
-	errno_t rc = block_put(ref->block);
-	free(ref);
-
-	return rc;
-}
-
-/** Get reference to i-node specified by index.
- *
- * @param fs    Filesystem to find i-node on
- * @param index Index of i-node to load
- * @oaram ref   Output pointer for reference
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_get_inode_ref(ext4_filesystem_t *fs, uint32_t index,
-    ext4_inode_ref_t **ref)
-{
-	/* Allocate memory for new structure */
-	ext4_inode_ref_t *newref =
-	    malloc(sizeof(ext4_inode_ref_t));
-	if (newref == NULL)
-		return ENOMEM;
-
-	/* Compute number of i-nodes, that fits in one data block */
-	uint32_t inodes_per_group =
-	    ext4_superblock_get_inodes_per_group(fs->superblock);
-
-	/*
-	 * Inode numbers are 1-based, but it is simpler to work with 0-based
-	 * when computing indices
-	 */
-	index -= 1;
-	uint32_t block_group = index / inodes_per_group;
-	uint32_t offset_in_group = index % inodes_per_group;
-
-	/* Load block group, where i-node is located */
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK) {
-		free(newref);
-		return rc;
-	}
-
-	/* Load block address, where i-node table is located */
-	uint32_t inode_table_start =
-	    ext4_block_group_get_inode_table_first_block(bg_ref->block_group,
-	    fs->superblock);
-
-	/* Put back block group reference (not needed more) */
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK) {
-		free(newref);
-		return rc;
-	}
-
-	/* Compute position of i-node in the block group */
-	uint16_t inode_size = ext4_superblock_get_inode_size(fs->superblock);
-	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-	uint32_t byte_offset_in_group = offset_in_group * inode_size;
-
-	/* Compute block address */
-	aoff64_t block_id = inode_table_start + (byte_offset_in_group / block_size);
-	rc = block_get(&newref->block, fs->device, block_id, 0);
-	if (rc != EOK) {
-		free(newref);
-		return rc;
-	}
-
-	/* Compute position of i-node in the data block */
-	uint32_t offset_in_block = byte_offset_in_group % block_size;
-	newref->inode = newref->block->data + offset_in_block;
-
-	/* We need to store the original value of index in the reference */
-	newref->index = index + 1;
-	newref->fs = fs;
-	newref->dirty = false;
-
-	*ref = newref;
-
-	return EOK;
-}
-
-/** Put reference to i-node.
- *
- * @param ref Pointer for reference to be put back
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_put_inode_ref(ext4_inode_ref_t *ref)
-{
-	/* Check if reference modified */
-	if (ref->dirty) {
-		/* Mark block dirty for writing changes to physical device */
-		ref->block->dirty = true;
-	}
-
-	/* Put back block, that contains i-node */
-	errno_t rc = block_put(ref->block);
-	free(ref);
-
-	return rc;
-}
-
-/** Initialize newly allocated i-node in the filesystem.
- *
- * @param fs        Filesystem to initialize i-node on
- * @param index     I-node index
- * @param inode_ref Output pointer to return reference to allocated i-node
- * @param flags     Flags to be set for newly created i-node
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_init_inode(ext4_filesystem_t *fs, uint32_t index,
-    ext4_inode_ref_t **inode_ref, int flags)
-{
-	/* Check if newly allocated i-node will be a directory */
-	bool is_dir = false;
-	if (flags & L_DIRECTORY)
-		is_dir = true;
-
-	/* Load i-node from on-disk i-node table */
-	errno_t rc = ext4_filesystem_get_inode_ref(fs, index, inode_ref);
-	if (rc != EOK) {
-		ext4_ialloc_free_inode(fs, index, is_dir);
-		return rc;
-	}
-
-	/* Initialize i-node */
-	ext4_inode_t *inode = (*inode_ref)->inode;
-
-	uint16_t mode;
-	if (is_dir) {
-		/*
-		 * Default directory permissions to be compatible with other systems
-		 * 0777 (octal) == rwxrwxrwx
-		 */
-
-		mode = 0777;
-		mode |= EXT4_INODE_MODE_DIRECTORY;
-		ext4_inode_set_mode(fs->superblock, inode, mode);
-		ext4_inode_set_links_count(inode, 1);  /* '.' entry */
-	} else {
-		/*
-		 * Default file permissions to be compatible with other systems
-		 * 0666 (octal) == rw-rw-rw-
-		 */
-
-		mode = 0666;
-		mode |= EXT4_INODE_MODE_FILE;
-		ext4_inode_set_mode(fs->superblock, inode, mode);
-		ext4_inode_set_links_count(inode, 0);
-	}
-
-	ext4_inode_set_uid(inode, 0);
-	ext4_inode_set_gid(inode, 0);
-	ext4_inode_set_size(inode, 0);
-	ext4_inode_set_access_time(inode, 0);
-	ext4_inode_set_change_inode_time(inode, 0);
-	ext4_inode_set_modification_time(inode, 0);
-	ext4_inode_set_deletion_time(inode, 0);
-	ext4_inode_set_blocks_count(fs->superblock, inode, 0);
-	ext4_inode_set_flags(inode, 0);
-	ext4_inode_set_generation(inode, 0);
-
-	/* Reset blocks array */
-	for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++)
-		inode->blocks[i] = 0;
-
-	/* Initialize extents if needed */
-	if (ext4_superblock_has_feature_incompatible(
-	    fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
-		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
-
-		/* Initialize extent root header */
-		ext4_extent_header_t *header = ext4_inode_get_extent_header(inode);
-		ext4_extent_header_set_depth(header, 0);
-		ext4_extent_header_set_entries_count(header, 0);
-		ext4_extent_header_set_generation(header, 0);
-		ext4_extent_header_set_magic(header, EXT4_EXTENT_MAGIC);
-
-		uint16_t max_entries = (EXT4_INODE_BLOCKS * sizeof(uint32_t) -
-		    sizeof(ext4_extent_header_t)) / sizeof(ext4_extent_t);
-
-		ext4_extent_header_set_max_entries_count(header, max_entries);
-	}
-
-	(*inode_ref)->dirty = true;
-
-	return EOK;
-}
-
-/** Allocate new i-node in the filesystem.
- *
- * @param fs        Filesystem to allocated i-node on
- * @param inode_ref Output pointer to return reference to allocated i-node
- * @param flags     Flags to be set for newly created i-node
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_alloc_inode(ext4_filesystem_t *fs,
-    ext4_inode_ref_t **inode_ref, int flags)
-{
-	/* Check if newly allocated i-node will be a directory */
-	bool is_dir = false;
-	if (flags & L_DIRECTORY)
-		is_dir = true;
-
-	/* Allocate inode by allocation algorithm */
-	uint32_t index;
-	errno_t rc = ext4_ialloc_alloc_inode(fs, &index, is_dir);
-	if (rc != EOK)
-		return rc;
-
-	rc = ext4_filesystem_init_inode(fs, index, inode_ref, flags);
-	if (rc != EOK) {
-		ext4_ialloc_free_inode(fs, index, is_dir);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Allocate specific i-node in the filesystem.
- *
- * @param fs        Filesystem to allocated i-node on
- * @param index     Index of i-node to allocate
- * @param inode_ref Output pointer to return reference to allocated i-node
- * @param flags     Flags to be set for newly created i-node
- *
- * @return Error code
- *
- */
-static errno_t ext4_filesystem_alloc_this_inode(ext4_filesystem_t *fs,
-    uint32_t index, ext4_inode_ref_t **inode_ref, int flags)
-{
-	/* Check if newly allocated i-node will be a directory */
-	bool is_dir = false;
-	if (flags & L_DIRECTORY)
-		is_dir = true;
-
-	/* Allocate inode by allocation algorithm */
-	errno_t rc = ext4_ialloc_alloc_this_inode(fs, index, is_dir);
-	if (rc != EOK)
-		return rc;
-
-	rc = ext4_filesystem_init_inode(fs, index, inode_ref, flags);
-	if (rc != EOK) {
-		ext4_ialloc_free_inode(fs, index, is_dir);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Release i-node and mark it as free.
- *
- * @param inode_ref I-node to be released
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_free_inode(ext4_inode_ref_t *inode_ref)
-{
-	ext4_filesystem_t *fs = inode_ref->fs;
-
-	/* For extents must be data block destroyed by other way */
-	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		/* Data structures are released during truncate operation... */
-		goto finish;
-	}
-
-	/* Release all indirect (no data) blocks */
-
-	/* 1) Single indirect */
-	uint32_t fblock = ext4_inode_get_indirect_block(inode_ref->inode, 0);
-	if (fblock != 0) {
-		errno_t rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK)
-			return rc;
-
-		ext4_inode_set_indirect_block(inode_ref->inode, 0, 0);
-	}
-
-	block_t *block;
-	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-	uint32_t count = block_size / sizeof(uint32_t);
-
-	/* 2) Double indirect */
-	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 1);
-	if (fblock != 0) {
-		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		uint32_t ind_block;
-		for (uint32_t offset = 0; offset < count; ++offset) {
-			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
-
-			if (ind_block != 0) {
-				rc = ext4_balloc_free_block(inode_ref, ind_block);
-				if (rc != EOK) {
-					block_put(block);
-					return rc;
-				}
-			}
-		}
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK)
-			return rc;
-
-		ext4_inode_set_indirect_block(inode_ref->inode, 1, 0);
-	}
-
-	/* 3) Tripple indirect */
-	block_t *subblock;
-	fblock = ext4_inode_get_indirect_block(inode_ref->inode, 2);
-	if (fblock != 0) {
-		errno_t rc = block_get(&block, fs->device, fblock, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		uint32_t ind_block;
-		for (uint32_t offset = 0; offset < count; ++offset) {
-			ind_block = uint32_t_le2host(((uint32_t *) block->data)[offset]);
-
-			if (ind_block != 0) {
-				rc = block_get(&subblock, fs->device, ind_block,
-				    BLOCK_FLAGS_NONE);
-				if (rc != EOK) {
-					block_put(block);
-					return rc;
-				}
-
-				uint32_t ind_subblock;
-				for (uint32_t suboffset = 0; suboffset < count;
-				    ++suboffset) {
-					ind_subblock = uint32_t_le2host(((uint32_t *)
-					    subblock->data)[suboffset]);
-
-					if (ind_subblock != 0) {
-						rc = ext4_balloc_free_block(inode_ref, ind_subblock);
-						if (rc != EOK) {
-							block_put(subblock);
-							block_put(block);
-							return rc;
-						}
-					}
-				}
-
-				rc = block_put(subblock);
-				if (rc != EOK) {
-					block_put(block);
-					return rc;
-				}
-			}
-
-			rc = ext4_balloc_free_block(inode_ref, ind_block);
-			if (rc != EOK) {
-				block_put(block);
-				return rc;
-			}
-		}
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		rc = ext4_balloc_free_block(inode_ref, fblock);
-		if (rc != EOK)
-			return rc;
-
-		ext4_inode_set_indirect_block(inode_ref->inode, 2, 0);
-	}
-
-finish:
-	/* Mark inode dirty for writing to the physical device */
-	inode_ref->dirty = true;
-
-	/* Free block with extended attributes if present */
-	uint32_t xattr_block = ext4_inode_get_file_acl(
-	    inode_ref->inode, fs->superblock);
-	if (xattr_block) {
-		errno_t rc = ext4_balloc_free_block(inode_ref, xattr_block);
-		if (rc != EOK)
-			return rc;
-
-		ext4_inode_set_file_acl(inode_ref->inode, fs->superblock, 0);
-	}
-
-	/* Free inode by allocator */
-	errno_t rc;
-	if (ext4_inode_is_type(fs->superblock, inode_ref->inode,
-	    EXT4_INODE_MODE_DIRECTORY))
-		rc = ext4_ialloc_free_inode(fs, inode_ref->index, true);
-	else
-		rc = ext4_ialloc_free_inode(fs, inode_ref->index, false);
-
-	return rc;
-}
-
-/** Truncate i-node data blocks.
- *
- * @param inode_ref I-node to be truncated
- * @param new_size  New size of inode (must be < current size)
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_truncate_inode(ext4_inode_ref_t *inode_ref,
-    aoff64_t new_size)
-{
-	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
-	/* Check flags, if i-node can be truncated */
-	if (!ext4_inode_can_truncate(sb, inode_ref->inode))
-		return EINVAL;
-
-	/* If sizes are equal, nothing has to be done. */
-	aoff64_t old_size = ext4_inode_get_size(sb, inode_ref->inode);
-	if (old_size == new_size)
-		return EOK;
-
-	/* It's not suppported to make the larger file by truncate operation */
-	if (old_size < new_size)
-		return EINVAL;
-
-	/* Compute how many blocks will be released */
-	aoff64_t size_diff = old_size - new_size;
-	uint32_t block_size  = ext4_superblock_get_block_size(sb);
-	uint32_t diff_blocks_count = size_diff / block_size;
-	if (size_diff % block_size != 0)
-		diff_blocks_count++;
-
-	uint32_t old_blocks_count = old_size / block_size;
-	if (old_size % block_size != 0)
-		old_blocks_count++;
-
-	if ((ext4_superblock_has_feature_incompatible(inode_ref->fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		/* Extents require special operation */
-		errno_t rc = ext4_extent_release_blocks_from(inode_ref,
-		    old_blocks_count - diff_blocks_count);
-		if (rc != EOK)
-			return rc;
-	} else {
-		/* Release data blocks from the end of file */
-
-		/* Starting from 1 because of logical blocks are numbered from 0 */
-		for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
-			errno_t rc = ext4_filesystem_release_inode_block(inode_ref,
-			    old_blocks_count - i);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	/* Update i-node */
-	ext4_inode_set_size(inode_ref->inode, new_size);
-	inode_ref->dirty = true;
-
-	return EOK;
-}
-
-/** Get physical block address by logical index of the block.
- *
- * @param inode_ref I-node to read block address from
- * @param iblock    Logical index of block
- * @param fblock    Output pointer for return physical block address
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_get_inode_data_block_index(ext4_inode_ref_t *inode_ref,
-    aoff64_t iblock, uint32_t *fblock)
-{
-	ext4_filesystem_t *fs = inode_ref->fs;
-
-	/* For empty file is situation simple */
-	if (ext4_inode_get_size(fs->superblock, inode_ref->inode) == 0) {
-		*fblock = 0;
-		return EOK;
-	}
-
-	uint32_t current_block;
-
-	/* Handle i-node using extents */
-	if ((ext4_superblock_has_feature_incompatible(fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		errno_t rc = ext4_extent_find_block(inode_ref, iblock, &current_block);
-		if (rc != EOK)
-			return rc;
-
-		*fblock = current_block;
-		return EOK;
-	}
-
-	ext4_inode_t *inode = inode_ref->inode;
-
-	/* Direct block are read directly from array in i-node structure */
-	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
-		current_block = ext4_inode_get_direct_block(inode, (uint32_t) iblock);
-		*fblock = current_block;
-		return EOK;
-	}
-
-	/* Determine indirection level of the target block */
-	unsigned int level = 0;
-	for (unsigned int i = 1; i < 4; i++) {
-		if (iblock < fs->inode_block_limits[i]) {
-			level = i;
-			break;
-		}
-	}
-
-	if (level == 0)
-		return EIO;
-
-	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level =
-	    iblock - fs->inode_block_limits[level - 1];
-	current_block = ext4_inode_get_indirect_block(inode, level - 1);
-	uint32_t offset_in_block =
-	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-
-	/* Sparse file */
-	if (current_block == 0) {
-		*fblock = 0;
-		return EOK;
-	}
-
-	block_t *block;
-
-	/*
-	 * Navigate through other levels, until we find the block number
-	 * or find null reference meaning we are dealing with sparse file
-	 */
-	while (level > 0) {
-		/* Load indirect block */
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK)
-			return rc;
-
-		/* Read block address from indirect block */
-		current_block =
-		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-
-		/* Put back indirect block untouched */
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		/* Check for sparse file */
-		if (current_block == 0) {
-			*fblock = 0;
-			return EOK;
-		}
-
-		/* Jump to the next level */
-		level--;
-
-		/* Termination condition - we have address of data block loaded */
-		if (level == 0)
-			break;
-
-		/* Visit the next level */
-		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block =
-		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	}
-
-	*fblock = current_block;
-
-	return EOK;
-}
-
-/** Set physical block address for the block logical address into the i-node.
- *
- * @param inode_ref I-node to set block address to
- * @param iblock    Logical index of block
- * @param fblock    Physical block address
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_set_inode_data_block_index(ext4_inode_ref_t *inode_ref,
-    aoff64_t iblock, uint32_t fblock)
-{
-	ext4_filesystem_t *fs = inode_ref->fs;
-
-	/* Handle inode using extents */
-	if ((ext4_superblock_has_feature_compatible(fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-		/* Not reachable */
-		return ENOTSUP;
-	}
-
-	/* Handle simple case when we are dealing with direct reference */
-	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
-		ext4_inode_set_direct_block(inode_ref->inode, (uint32_t) iblock, fblock);
-		inode_ref->dirty = true;
-
-		return EOK;
-	}
-
-	/* Determine the indirection level needed to get the desired block */
-	unsigned int level = 0;
-	for (unsigned int i = 1; i < 4; i++) {
-		if (iblock < fs->inode_block_limits[i]) {
-			level = i;
-			break;
-		}
-	}
-
-	if (level == 0)
-		return EIO;
-
-	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-
-	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level =
-	    iblock - fs->inode_block_limits[level - 1];
-	uint32_t current_block =
-	    ext4_inode_get_indirect_block(inode_ref->inode, level - 1);
-	uint32_t offset_in_block =
-	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-
-	uint32_t new_block_addr;
-	block_t *block;
-	block_t *new_block;
-
-	/* Is needed to allocate indirect block on the i-node level */
-	if (current_block == 0) {
-		/* Allocate new indirect block */
-		errno_t rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
-		if (rc != EOK)
-			return rc;
-
-		/* Update i-node */
-		ext4_inode_set_indirect_block(inode_ref->inode, level - 1,
-		    new_block_addr);
-		inode_ref->dirty = true;
-
-		/* Load newly allocated block */
-		rc = block_get(&new_block, fs->device, new_block_addr,
-		    BLOCK_FLAGS_NOREAD);
-		if (rc != EOK) {
-			ext4_balloc_free_block(inode_ref, new_block_addr);
-			return rc;
-		}
-
-		/* Initialize new block */
-		memset(new_block->data, 0, block_size);
-		new_block->dirty = true;
-
-		/* Put back the allocated block */
-		rc = block_put(new_block);
-		if (rc != EOK)
-			return rc;
-
-		current_block = new_block_addr;
-	}
-
-	/*
-	 * Navigate through other levels, until we find the block number
-	 * or find null reference meaning we are dealing with sparse file
-	 */
-	while (level > 0) {
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK)
-			return rc;
-
-		current_block =
-		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-
-		if ((level > 1) && (current_block == 0)) {
-			/* Allocate new block */
-			rc = ext4_balloc_alloc_block(inode_ref, &new_block_addr);
-			if (rc != EOK) {
-				block_put(block);
-				return rc;
-			}
-
-			/* Load newly allocated block */
-			rc = block_get(&new_block, fs->device, new_block_addr,
-			    BLOCK_FLAGS_NOREAD);
-			if (rc != EOK) {
-				block_put(block);
-				return rc;
-			}
-
-			/* Initialize allocated block */
-			memset(new_block->data, 0, block_size);
-			new_block->dirty = true;
-
-			rc = block_put(new_block);
-			if (rc != EOK) {
-				block_put(block);
-				return rc;
-			}
-
-			/* Write block address to the parent */
-			((uint32_t *) block->data)[offset_in_block] =
-			    host2uint32_t_le(new_block_addr);
-			block->dirty = true;
-			current_block = new_block_addr;
-		}
-
-		/* Will be finished, write the fblock address */
-		if (level == 1) {
-			((uint32_t *) block->data)[offset_in_block] =
-			    host2uint32_t_le(fblock);
-			block->dirty = true;
-		}
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		level--;
-
-		/*
-		 * If we are on the last level, break here as
-		 * there is no next level to visit
-		 */
-		if (level == 0)
-			break;
-
-		/* Visit the next level */
-		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block =
-		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	}
-
-	return EOK;
-}
-
-/** Release data block from i-node
- *
- * @param inode_ref I-node to release block from
- * @param iblock    Logical block to be released
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_release_inode_block(ext4_inode_ref_t *inode_ref,
-    uint32_t iblock)
-{
-	uint32_t fblock;
-
-	ext4_filesystem_t *fs = inode_ref->fs;
-
-	/* Extents are handled otherwise = there is not support in this function */
-	assert(!(ext4_superblock_has_feature_incompatible(fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))));
-
-	ext4_inode_t *inode = inode_ref->inode;
-
-	/* Handle simple case when we are dealing with direct reference */
-	if (iblock < EXT4_INODE_DIRECT_BLOCK_COUNT) {
-		fblock = ext4_inode_get_direct_block(inode, iblock);
-
-		/* Sparse file */
-		if (fblock == 0)
-			return EOK;
-
-		ext4_inode_set_direct_block(inode, iblock, 0);
-		return ext4_balloc_free_block(inode_ref, fblock);
-	}
-
-	/* Determine the indirection level needed to get the desired block */
-	unsigned int level = 0;
-	for (unsigned int i = 1; i < 4; i++) {
-		if (iblock < fs->inode_block_limits[i]) {
-			level = i;
-			break;
-		}
-	}
-
-	if (level == 0)
-		return EIO;
-
-	/* Compute offsets for the topmost level */
-	aoff64_t block_offset_in_level =
-	    iblock - fs->inode_block_limits[level - 1];
-	uint32_t current_block =
-	    ext4_inode_get_indirect_block(inode, level - 1);
-	uint32_t offset_in_block =
-	    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-
-	/*
-	 * Navigate through other levels, until we find the block number
-	 * or find null reference meaning we are dealing with sparse file
-	 */
-	block_t *block;
-	while (level > 0) {
-
-		/* Sparse check */
-		if (current_block == 0)
-			return EOK;
-
-		errno_t rc = block_get(&block, fs->device, current_block, 0);
-		if (rc != EOK)
-			return rc;
-
-		current_block =
-		    uint32_t_le2host(((uint32_t *) block->data)[offset_in_block]);
-
-		/* Set zero if physical data block address found */
-		if (level == 1) {
-			((uint32_t *) block->data)[offset_in_block] =
-			    host2uint32_t_le(0);
-			block->dirty = true;
-		}
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
-		level--;
-
-		/*
-		 * If we are on the last level, break here as
-		 * there is no next level to visit
-		 */
-		if (level == 0)
-			break;
-
-		/* Visit the next level */
-		block_offset_in_level %= fs->inode_blocks_per_level[level];
-		offset_in_block =
-		    block_offset_in_level / fs->inode_blocks_per_level[level - 1];
-	}
-
-	fblock = current_block;
-	if (fblock == 0)
-		return EOK;
-
-	/* Physical block is not referenced, it can be released */
-	return ext4_balloc_free_block(inode_ref, fblock);
-}
-
-/** Append following logical block to the i-node.
- *
- * @param inode_ref I-node to append block to
- * @param fblock    Output physical block address of newly allocated block
- * @param iblock    Output logical number of newly allocated block
- *
- * @return Error code
- *
- */
-errno_t ext4_filesystem_append_inode_block(ext4_inode_ref_t *inode_ref,
-    uint32_t *fblock, uint32_t *iblock)
-{
-	/* Handle extents separately */
-	if ((ext4_superblock_has_feature_incompatible(inode_ref->fs->superblock,
-	    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-	    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)))
-		return ext4_extent_append_block(inode_ref, iblock, fblock, true);
-
-	ext4_superblock_t *sb = inode_ref->fs->superblock;
-
-	/* Compute next block index and allocate data block */
-	uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	/* Align size i-node size */
-	if ((inode_size % block_size) != 0)
-		inode_size += block_size - (inode_size % block_size);
-
-	/* Logical blocks are numbered from 0 */
-	uint32_t new_block_idx = inode_size / block_size;
-
-	/* Allocate new physical block */
-	uint32_t phys_block;
-	errno_t rc = ext4_balloc_alloc_block(inode_ref, &phys_block);
-	if (rc != EOK)
-		return rc;
-
-	/* Add physical block address to the i-node */
-	rc = ext4_filesystem_set_inode_data_block_index(inode_ref,
-	    new_block_idx, phys_block);
-	if (rc != EOK) {
-		ext4_balloc_free_block(inode_ref, phys_block);
-		return rc;
-	}
-
-	/* Update i-node */
-	ext4_inode_set_size(inode_ref->inode, inode_size + block_size);
-	inode_ref->dirty = true;
-
-	*fblock = phys_block;
-	*iblock = new_block_idx;
-
-	return EOK;
-}
-
-/** Get the number of inodes per block.
- *
- * @param sb Superblock
- * @return   Number of inodes per block
- */
-static uint32_t ext4_filesystem_inodes_per_block(ext4_superblock_t *sb)
-{
-	uint32_t inode_size = ext4_superblock_get_inode_size(sb);
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-	return block_size / inode_size;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/hash.c
===================================================================
--- uspace/lib/ext4/src/hash.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  hash.c
- * @brief Hashing algorithms for ext4 HTree.
- */
-
-#include <errno.h>
-#include "ext4/hash.h"
-
-errno_t ext4_hash_string(ext4_hash_info_t *hinfo, int len, const char *name)
-{
-	// TODO
-	hinfo->hash = 0;
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/ialloc.c
===================================================================
--- uspace/lib/ext4/src/ialloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,421 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  ialloc.c
- * @brief I-node (de)allocation operations.
- */
-
-#include <errno.h>
-#include <stdbool.h>
-#include "ext4/bitmap.h"
-#include "ext4/block_group.h"
-#include "ext4/filesystem.h"
-#include "ext4/ialloc.h"
-#include "ext4/superblock.h"
-
-/** Convert i-node number to relative index in block group.
- *
- * @param sb    Superblock
- * @param inode I-node number to be converted
- *
- * @return Index of the i-node in the block group
- *
- */
-static uint32_t ext4_ialloc_inode2index_in_group(ext4_superblock_t *sb,
-    uint32_t inode)
-{
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	return (inode - 1) % inodes_per_group;
-}
-
-/** Convert relative index of i-node to absolute i-node number.
- *
- * @param sb    Superblock
- * @param inode Index to be converted
- *
- * @return Absolute number of the i-node
- *
- */
-static uint32_t ext4_ialloc_index_in_group2inode(ext4_superblock_t *sb,
-    uint32_t index, uint32_t bgid)
-{
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	return bgid * inodes_per_group + (index + 1);
-}
-
-/** Compute block group number from the i-node number.
- *
- * @param sb    Superblock
- * @param inode I-node number to be found the block group for
- *
- * @return Block group number computed from i-node number
- *
- */
-static uint32_t ext4_ialloc_get_bgid_of_inode(ext4_superblock_t *sb,
-    uint32_t inode)
-{
-	uint32_t inodes_per_group = ext4_superblock_get_inodes_per_group(sb);
-	return (inode - 1) / inodes_per_group;
-}
-
-/** Free i-node number and modify filesystem data structers.
- *
- * @param fs     Filesystem, where the i-node is located
- * @param index  Index of i-node to be release
- * @param is_dir Flag us for information whether i-node is directory or not
- *
- */
-errno_t ext4_ialloc_free_inode(ext4_filesystem_t *fs, uint32_t index, bool is_dir)
-{
-	ext4_superblock_t *sb = fs->superblock;
-
-	/* Compute index of block group and load it */
-	uint32_t block_group = ext4_ialloc_get_bgid_of_inode(sb, index);
-
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, block_group, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Load i-node bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-	    bg_ref->block_group, sb);
-	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	/* Free i-node in the bitmap */
-	uint32_t index_in_group = ext4_ialloc_inode2index_in_group(sb, index);
-	ext4_bitmap_free_bit(bitmap_block->data, index_in_group);
-	bitmap_block->dirty = true;
-
-	/* Put back the block with bitmap */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		/* Error in saving bitmap */
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* If released i-node is a directory, decrement used directories count */
-	if (is_dir) {
-		uint32_t bg_used_dirs = ext4_block_group_get_used_dirs_count(
-		    bg_ref->block_group, sb);
-		bg_used_dirs--;
-		ext4_block_group_set_used_dirs_count(bg_ref->block_group, sb,
-		    bg_used_dirs);
-	}
-
-	/* Update block group free inodes count */
-	uint32_t free_inodes = ext4_block_group_get_free_inodes_count(
-	    bg_ref->block_group, sb);
-	free_inodes++;
-	ext4_block_group_set_free_inodes_count(bg_ref->block_group, sb,
-	    free_inodes);
-
-	bg_ref->dirty = true;
-
-	/* Put back the modified block group */
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Update superblock free inodes count */
-	uint32_t sb_free_inodes =
-	    ext4_superblock_get_free_inodes_count(sb);
-	sb_free_inodes++;
-	ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
-
-	return EOK;
-}
-
-/** I-node allocation algorithm.
- *
- * This is more simple algorithm, than Orlov allocator used
- * in the Linux kernel.
- *
- * @param fs     Filesystem to allocate i-node on
- * @param index  Output value - allocated i-node number
- * @param is_dir Flag if allocated i-node will be file or directory
- *
- * @return Error code
- *
- */
-errno_t ext4_ialloc_alloc_inode(ext4_filesystem_t *fs, uint32_t *index, bool is_dir)
-{
-	int pick_first_free = 0;
-	ext4_superblock_t *sb = fs->superblock;
-	uint32_t bgid;
-	uint32_t sb_free_inodes;
-	uint32_t avg_free_inodes;
-	uint32_t const bg_count = ext4_superblock_get_block_group_count(sb);
-
-retry:
-
-	bgid = 0;
-	sb_free_inodes = ext4_superblock_get_free_inodes_count(sb);
-	avg_free_inodes = sb_free_inodes / bg_count;
-
-	/* Try to find free i-node in all block groups */
-	while (bgid < bg_count) {
-		/* Load block group to check */
-		ext4_block_group_ref_t *bg_ref;
-		errno_t rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
-		if (rc != EOK)
-			return rc;
-
-		ext4_block_group_t *bg = bg_ref->block_group;
-
-		/* Read necessary values for algorithm */
-		uint32_t free_blocks = ext4_block_group_get_free_blocks_count(bg, sb);
-		uint32_t free_inodes = ext4_block_group_get_free_inodes_count(bg, sb);
-		uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
-
-		/*
-		 * Check if this block group is a good candidate
-		 * for allocation.
-		 *
-		 * The criterion is based on the average number
-		 * of free inodes, unless we examine the last block
-		 * group. In that case the last block group might
-		 * have less than the average number of free inodes,
-		 * but it still needs to be taken as a candidate
-		 * because the previous block groups have zero free
-		 * blocks.
-		 */
-		if (((free_inodes >= avg_free_inodes) ||
-		    (bgid == bg_count - 1) || pick_first_free) && (free_blocks > 0)) {
-			/* Load block with bitmap */
-			uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-			    bg_ref->block_group, sb);
-
-			block_t *bitmap_block;
-			rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
-				return rc;
-			}
-
-			/* Try to allocate i-node in the bitmap */
-			uint32_t inodes_in_group = ext4_superblock_get_inodes_in_group(sb, bgid);
-			uint32_t index_in_group;
-			rc = ext4_bitmap_find_free_bit_and_set(bitmap_block->data,
-			    0, &index_in_group, inodes_in_group);
-
-			/* Block group has not any free i-node */
-			if (rc == ENOSPC) {
-				rc = block_put(bitmap_block);
-				if (rc != EOK) {
-					ext4_filesystem_put_block_group_ref(bg_ref);
-					return rc;
-				}
-
-				rc = ext4_filesystem_put_block_group_ref(bg_ref);
-				if (rc != EOK)
-					return rc;
-
-				bgid++;
-				continue;
-			}
-
-			/* Free i-node found, save the bitmap */
-			bitmap_block->dirty = true;
-
-			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
-				return rc;
-			}
-
-			/* Modify filesystem counters */
-			free_inodes--;
-			ext4_block_group_set_free_inodes_count(bg, sb, free_inodes);
-
-			/* Increment used directories counter */
-			if (is_dir) {
-				used_dirs++;
-				ext4_block_group_set_used_dirs_count(bg, sb, used_dirs);
-			}
-
-			/* Decrease unused inodes count */
-			if (ext4_block_group_has_flag(bg,
-			    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
-				uint32_t unused =
-				    ext4_block_group_get_itable_unused(bg, sb);
-
-				uint32_t inodes_in_group =
-				    ext4_superblock_get_inodes_in_group(sb, bgid);
-
-				uint32_t free = inodes_in_group - unused;
-
-				if (index_in_group >= free) {
-					unused = inodes_in_group - (index_in_group + 1);
-					ext4_block_group_set_itable_unused(bg, sb, unused);
-				}
-			}
-
-			/* Save modified block group */
-			bg_ref->dirty = true;
-
-			rc = ext4_filesystem_put_block_group_ref(bg_ref);
-			if (rc != EOK)
-				return rc;
-
-			/* Update superblock */
-			sb_free_inodes--;
-			ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
-
-			/* Compute the absolute i-nodex number */
-			*index = ext4_ialloc_index_in_group2inode(sb, index_in_group, bgid);
-
-			return EOK;
-		}
-
-		/* Block group not modified, put it and jump to the next block group */
-		rc = ext4_filesystem_put_block_group_ref(bg_ref);
-		if (rc != EOK)
-			return rc;
-
-		++bgid;
-	}
-
-	/* Try again with less strict conditions */
-	if (pick_first_free == 0) {
-		pick_first_free = 1;
-		goto retry;
-	}
-
-	return ENOSPC;
-}
-
-/** Allocate a specific I-node.
- *
- * @param fs     Filesystem to allocate i-node on
- * @param inode  I-node to allocate
- * @param is_dir Flag if allocated i-node will be file or directory
- *
- * @return Error code
- *
- */
-errno_t ext4_ialloc_alloc_this_inode(ext4_filesystem_t *fs, uint32_t inode,
-    bool is_dir)
-{
-	ext4_superblock_t *sb = fs->superblock;
-
-	uint32_t bgid = ext4_ialloc_get_bgid_of_inode(sb, inode);
-	uint32_t sb_free_inodes = ext4_superblock_get_free_inodes_count(sb);
-
-	/* Load block group */
-	ext4_block_group_ref_t *bg_ref;
-	errno_t rc = ext4_filesystem_get_block_group_ref(fs, bgid, &bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	ext4_block_group_t *bg = bg_ref->block_group;
-
-	/* Read necessary values for algorithm */
-	uint32_t free_inodes = ext4_block_group_get_free_inodes_count(bg, sb);
-	uint32_t used_dirs = ext4_block_group_get_used_dirs_count(bg, sb);
-
-	/* Load block with bitmap */
-	uint32_t bitmap_block_addr = ext4_block_group_get_inode_bitmap(
-	    bg_ref->block_group, sb);
-
-	block_t *bitmap_block;
-	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Allocate i-node in the bitmap */
-	uint32_t index_in_group = ext4_ialloc_inode2index_in_group(sb, inode);
-	ext4_bitmap_set_bit(bitmap_block->data, index_in_group);
-
-	/* Save the bitmap */
-	bitmap_block->dirty = true;
-
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	/* Modify filesystem counters */
-	free_inodes--;
-	ext4_block_group_set_free_inodes_count(bg, sb, free_inodes);
-
-	/* Increment used directories counter */
-	if (is_dir) {
-		used_dirs++;
-		ext4_block_group_set_used_dirs_count(bg, sb, used_dirs);
-	}
-
-	/* Decrease unused inodes count */
-	if (ext4_block_group_has_flag(bg,
-	    EXT4_BLOCK_GROUP_ITABLE_ZEROED)) {
-		uint32_t unused =
-		    ext4_block_group_get_itable_unused(bg, sb);
-
-		uint32_t inodes_in_group =
-		    ext4_superblock_get_inodes_in_group(sb, bgid);
-
-		uint32_t free = inodes_in_group - unused;
-
-		if (index_in_group >= free) {
-			unused = inodes_in_group - (index_in_group + 1);
-			ext4_block_group_set_itable_unused(bg, sb, unused);
-		}
-	}
-
-	/* Save modified block group */
-	bg_ref->dirty = true;
-
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Update superblock */
-	sb_free_inodes--;
-	ext4_superblock_set_free_inodes_count(sb, sb_free_inodes);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/inode.c
===================================================================
--- uspace/lib/ext4/src/inode.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,595 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  inode.c
- * @brief Ext4 i-node structure operations.
- */
-
-#include <block.h>
-#include <byteorder.h>
-#include <errno.h>
-#include "ext4/inode.h"
-#include "ext4/superblock.h"
-
-/** Compute number of bits for block count.
- *
- *  @param block_size Filesystem block_size
- *
- *  @return Number of bits
- *
- */
-static uint32_t ext4_inode_block_bits_count(uint32_t block_size)
-{
-	uint32_t bits = 8;
-	uint32_t size = block_size;
-
-	do {
-		bits++;
-		size = size >> 1;
-	} while (size > 256);
-
-	return bits;
-}
-
-/** Get mode of the i-node.
- *
- * @param sb    Superblock
- * @param inode I-node to load mode from
- *
- * @return Mode of the i-node
- *
- */
-uint32_t ext4_inode_get_mode(ext4_superblock_t *sb, ext4_inode_t *inode)
-{
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_HURD) {
-		return ((uint32_t) uint16_t_le2host(inode->osd2.hurd2.mode_high)) << 16 |
-		    ((uint32_t) uint16_t_le2host(inode->mode));
-	}
-
-	return uint16_t_le2host(inode->mode);
-}
-
-/** Set mode of the i-node.
- *
- * @param sb    Superblock
- * @param inode I-node to set mode to
- * @param mode  Mode to set to i-node
- *
- */
-void ext4_inode_set_mode(ext4_superblock_t *sb, ext4_inode_t *inode, uint32_t mode)
-{
-	inode->mode = host2uint16_t_le((mode << 16) >> 16);
-
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_HURD)
-		inode->osd2.hurd2.mode_high = host2uint16_t_le(mode >> 16);
-}
-
-/** Get ID of the i-node owner (user id).
- *
- * @param inode I-node to load uid from
- *
- * @return User ID of the i-node owner
- *
- */
-uint32_t ext4_inode_get_uid(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->uid);
-}
-
-/** Set ID of the i-node owner.
- *
- * @param inode I-node to set uid to
- * @param uid   ID of the i-node owner
- *
- */
-void ext4_inode_set_uid(ext4_inode_t *inode, uint32_t uid)
-{
-	inode->uid = host2uint32_t_le(uid);
-}
-
-/** Get real i-node size.
- *
- * @param sb    Superblock
- * @param inode I-node to load size from
- *
- * @return Real size of i-node
- *
- */
-uint64_t ext4_inode_get_size(ext4_superblock_t *sb, ext4_inode_t *inode)
-{
-	uint32_t major_rev = ext4_superblock_get_rev_level(sb);
-
-	if ((major_rev > 0) &&
-	    (ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)))
-		return ((uint64_t)uint32_t_le2host(inode->size_hi)) << 32 |
-		    ((uint64_t)uint32_t_le2host(inode->size_lo));
-
-	return uint32_t_le2host(inode->size_lo);
-}
-
-/** Set real i-node size.
- *
- * @param inode I-node to set size to
- * @param size  Size of the i-node
- *
- */
-void ext4_inode_set_size(ext4_inode_t *inode, uint64_t size)
-{
-	inode->size_lo = host2uint32_t_le((size << 32) >> 32);
-	inode->size_hi = host2uint32_t_le(size >> 32);
-}
-
-/** Get time, when i-node was last accessed.
- *
- * @param inode I-node
- *
- * @return Time of the last access (POSIX)
- *
- */
-uint32_t ext4_inode_get_access_time(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->access_time);
-}
-
-/** Set time, when i-node was last accessed.
- *
- * @param inode I-node
- * @param time  Time of the last access (POSIX)
- *
- */
-void ext4_inode_set_access_time(ext4_inode_t *inode, uint32_t time)
-{
-	inode->access_time = host2uint32_t_le(time);
-}
-
-/** Get time, when i-node was last changed.
- *
- * @param inode I-node
- *
- * @return Time of the last change (POSIX)
- *
- */
-uint32_t ext4_inode_get_change_inode_time(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->change_inode_time);
-}
-
-/** Set time, when i-node was last changed.
- *
- * @param inode I-node
- * @param time  Time of the last change (POSIX)
- *
- */
-void ext4_inode_set_change_inode_time(ext4_inode_t *inode, uint32_t time)
-{
-	inode->change_inode_time = host2uint32_t_le(time);
-}
-
-/** Get time, when i-node content was last modified.
- *
- * @param inode I-node
- *
- * @return Time of the last content modification (POSIX)
- *
- */
-uint32_t ext4_inode_get_modification_time(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->modification_time);
-}
-
-/** Set time, when i-node content was last modified.
- *
- * @param inode I-node
- * @param time  Time of the last content modification (POSIX)
- *
- */
-void ext4_inode_set_modification_time(ext4_inode_t *inode, uint32_t time)
-{
-	inode->modification_time = host2uint32_t_le(time);
-}
-
-/** Get time, when i-node was deleted.
- *
- * @param inode I-node
- *
- * @return Time of the delete action (POSIX)
- *
- */
-uint32_t ext4_inode_get_deletion_time(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->deletion_time);
-}
-
-/** Set time, when i-node was deleted.
- *
- * @param inode I-node
- * @param time  Time of the delete action (POSIX)
- *
- */
-void ext4_inode_set_deletion_time(ext4_inode_t *inode, uint32_t time)
-{
-	inode->deletion_time = host2uint32_t_le(time);
-}
-
-/** Get ID of the i-node owner's group.
- *
- * @param inode I-node to load gid from
- *
- * @return Group ID of the i-node owner
- *
- */
-uint32_t ext4_inode_get_gid(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->gid);
-}
-
-/** Set ID ot the i-node owner's group.
- *
- * @param inode I-node to set gid to
- * @param gid   Group ID of the i-node owner
- *
- */
-void ext4_inode_set_gid(ext4_inode_t *inode, uint32_t gid)
-{
-	inode->gid = host2uint32_t_le(gid);
-}
-
-/** Get number of links to i-node.
- *
- * @param inode I-node to load number of links from
- *
- * @return Number of links to i-node
- *
- */
-uint16_t ext4_inode_get_links_count(ext4_inode_t *inode)
-{
-	return uint16_t_le2host(inode->links_count);
-}
-
-/** Set number of links to i-node.
- *
- * @param inode I-node to set number of links to
- * @param count Number of links to i-node
- *
- */
-void ext4_inode_set_links_count(ext4_inode_t *inode, uint16_t count)
-{
-	inode->links_count = host2uint16_t_le(count);
-}
-
-/** Get number of 512-bytes blocks used for i-node.
- *
- * @param sb    Superblock
- * @param inode I-node
- *
- * @return Number of 512-bytes blocks
- *
- */
-uint64_t ext4_inode_get_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode)
-{
-	if (ext4_superblock_has_feature_read_only(sb,
-	    EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
-		/* 48-bit field */
-		uint64_t count = ((uint64_t)
-		    uint16_t_le2host(inode->osd2.linux2.blocks_high)) << 32 |
-		    uint32_t_le2host(inode->blocks_count_lo);
-
-		if (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_HUGE_FILE)) {
-			uint32_t block_size = ext4_superblock_get_block_size(sb);
-			uint32_t block_bits = ext4_inode_block_bits_count(block_size);
-			return count << (block_bits - 9);
-		} else
-			return count;
-	} else
-		return uint32_t_le2host(inode->blocks_count_lo);
-}
-
-/** Set number of 512-bytes blocks used for i-node.
- *
- * @param sb    Superblock
- * @param inode I-node
- * @param count Number of 512-bytes blocks
- *
- * @return Error code
- *
- */
-errno_t ext4_inode_set_blocks_count(ext4_superblock_t *sb, ext4_inode_t *inode,
-    uint64_t count)
-{
-	/* 32-bit maximum */
-	uint64_t max = 0;
-	max = ~max >> 32;
-
-	if (count <= max) {
-		inode->blocks_count_lo = host2uint32_t_le(count);
-		inode->osd2.linux2.blocks_high = 0;
-		ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-
-		return EOK;
-	}
-
-	/* Check if there can be used huge files (many blocks) */
-	if (!ext4_superblock_has_feature_read_only(sb,
-	    EXT4_FEATURE_RO_COMPAT_HUGE_FILE))
-		return EINVAL;
-
-	/* 48-bit maximum */
-	max = 0;
-	max = ~max >> 16;
-
-	if (count <= max) {
-		inode->blocks_count_lo = host2uint32_t_le(count);
-		inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
-		ext4_inode_clear_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-	} else {
-		uint32_t block_size = ext4_superblock_get_block_size(sb);
-		uint32_t block_bits = ext4_inode_block_bits_count(block_size);
-		ext4_inode_set_flag(inode, EXT4_INODE_FLAG_HUGE_FILE);
-		count = count >> (block_bits - 9);
-		inode->blocks_count_lo = host2uint32_t_le(count);
-		inode->osd2.linux2.blocks_high = host2uint16_t_le(count >> 32);
-	}
-
-	return EOK;
-}
-
-/** Get flags (features) of i-node.
- *
- * @param inode I-node to get flags from
- *
- * @return Flags (bitmap)
- *
- */
-uint32_t ext4_inode_get_flags(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->flags);
-}
-
-/** Set flags (features) of i-node.
- *
- * @param inode I-node to set flags to
- * @param flags Flags to set to i-node
- *
- */
-void ext4_inode_set_flags(ext4_inode_t *inode, uint32_t flags)
-{
-	inode->flags = host2uint32_t_le(flags);
-}
-
-/** Get file generation (used by NFS).
- *
- * @param inode I-node
- *
- * @return File generation
- *
- */
-uint32_t ext4_inode_get_generation(ext4_inode_t *inode)
-{
-	return uint32_t_le2host(inode->generation);
-}
-
-/** Set file generation (used by NFS).
- *
- * @param inode      I-node
- * @param generation File generation
- *
- */
-void ext4_inode_set_generation(ext4_inode_t *inode, uint32_t generation)
-{
-	inode->generation = host2uint32_t_le(generation);
-}
-
-/** Get address of block, where are extended attributes located.
- *
- * @param inode I-node
- * @param sb    Superblock
- *
- * @return Block address
- *
- */
-uint64_t ext4_inode_get_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX)
-		return ((uint32_t)
-		    uint16_t_le2host(inode->osd2.linux2.file_acl_high)) << 16 |
-		    (uint32_t_le2host(inode->file_acl_lo));
-
-	return uint32_t_le2host(inode->file_acl_lo);
-}
-
-/** Set address of block, where are extended attributes located.
- *
- * @param inode    I-node
- * @param sb       Superblock
- * @param file_acl Block address
- *
- */
-void ext4_inode_set_file_acl(ext4_inode_t *inode, ext4_superblock_t *sb,
-    uint64_t file_acl)
-{
-	inode->file_acl_lo = host2uint32_t_le((file_acl << 32) >> 32);
-
-	if (ext4_superblock_get_creator_os(sb) == EXT4_SUPERBLOCK_OS_LINUX)
-		inode->osd2.linux2.file_acl_high = host2uint16_t_le(file_acl >> 32);
-}
-
-/** Get block address of specified direct block.
- *
- * @param inode I-node to load block from
- * @param idx   Index of logical block
- *
- * @return Physical block address
- *
- */
-uint32_t ext4_inode_get_direct_block(ext4_inode_t *inode, uint32_t idx)
-{
-	assert(idx < EXT4_INODE_DIRECT_BLOCK_COUNT);
-
-	return uint32_t_le2host(inode->blocks[idx]);
-}
-
-/** Set block address of specified direct block.
- *
- * @param inode  I-node to set block address to
- * @param idx    Index of logical block
- * @param fblock Physical block address
- *
- */
-void ext4_inode_set_direct_block(ext4_inode_t *inode, uint32_t idx, uint32_t fblock)
-{
-	assert(idx < EXT4_INODE_DIRECT_BLOCK_COUNT);
-
-	inode->blocks[idx] = host2uint32_t_le(fblock);
-}
-
-/** Get block address of specified indirect block.
- *
- * @param inode I-node to get block address from
- * @param idx   Index of indirect block
- *
- * @return Physical block address
- *
- */
-uint32_t ext4_inode_get_indirect_block(ext4_inode_t *inode, uint32_t idx)
-{
-	return uint32_t_le2host(inode->blocks[idx + EXT4_INODE_INDIRECT_BLOCK]);
-}
-
-/** Set block address of specified indirect block.
- *
- * @param inode  I-node to set block address to
- * @param idx    Index of indirect block
- * @param fblock Physical block address
- *
- */
-void ext4_inode_set_indirect_block(ext4_inode_t *inode, uint32_t idx,
-    uint32_t fblock)
-{
-	inode->blocks[idx + EXT4_INODE_INDIRECT_BLOCK] =
-	    host2uint32_t_le(fblock);
-}
-
-/** Check if i-node has specified type.
- *
- * @param sb    Superblock
- * @param inode I-node to check type of
- * @param type  Type to check
- *
- * @return Result of check operation
- *
- */
-bool ext4_inode_is_type(ext4_superblock_t *sb, ext4_inode_t *inode,
-    uint32_t type)
-{
-	uint32_t mode = ext4_inode_get_mode(sb, inode);
-	return (mode & EXT4_INODE_MODE_TYPE_MASK) == type;
-}
-
-/** Get extent header from the root of the extent tree.
- *
- * @param inode I-node to get extent header from
- *
- * @return Pointer to extent header of the root node
- *
- */
-ext4_extent_header_t *ext4_inode_get_extent_header(ext4_inode_t *inode)
-{
-	return (ext4_extent_header_t *) inode->blocks;
-}
-
-/** Check if i-node has specified flag.
- *
- * @param inode I-node to check flags of
- * @param flag  Flag to check
- *
- * @return Result of check operation
- *
- */
-bool ext4_inode_has_flag(ext4_inode_t *inode, uint32_t flag)
-{
-	if (ext4_inode_get_flags(inode) & flag)
-		return true;
-
-	return false;
-}
-
-/** Remove specified flag from i-node.
- *
- * @param inode      I-node to clear flag on
- * @param clear_flag Flag to be cleared
- *
- */
-void ext4_inode_clear_flag(ext4_inode_t *inode, uint32_t clear_flag)
-{
-	uint32_t flags = ext4_inode_get_flags(inode);
-	flags = flags & (~clear_flag);
-	ext4_inode_set_flags(inode, flags);
-}
-
-/** Set specified flag to i-node.
- *
- * @param inode    I-node to set flag on
- * @param set_flag Flag to be set
- *
- */
-void ext4_inode_set_flag(ext4_inode_t *inode, uint32_t set_flag)
-{
-	uint32_t flags = ext4_inode_get_flags(inode);
-	flags = flags | set_flag;
-	ext4_inode_set_flags(inode, flags);
-}
-
-/** Check if i-node can be truncated.
- *
- * @param sb    Superblock
- * @param inode I-node to check
- *
- * @return Result of the check operation
- *
- */
-bool ext4_inode_can_truncate(ext4_superblock_t *sb, ext4_inode_t *inode)
-{
-	if ((ext4_inode_has_flag(inode, EXT4_INODE_FLAG_APPEND)) ||
-	    (ext4_inode_has_flag(inode, EXT4_INODE_FLAG_IMMUTABLE)))
-		return false;
-
-	if ((ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_FILE)) ||
-	    (ext4_inode_is_type(sb, inode, EXT4_INODE_MODE_DIRECTORY)))
-		return true;
-
-	return false;
-}
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/ops.c
===================================================================
--- uspace/lib/ext4/src/ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1504 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-/**
- * @file  ops.c
- * @brief Operations for ext4 filesystem.
- */
-
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <libfs.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ipc/loc.h>
-#include "ext4/balloc.h"
-#include "ext4/directory.h"
-#include "ext4/directory_index.h"
-#include "ext4/extent.h"
-#include "ext4/inode.h"
-#include "ext4/ops.h"
-#include "ext4/filesystem.h"
-#include "ext4/fstypes.h"
-#include "ext4/superblock.h"
-
-/* Forward declarations of auxiliary functions */
-
-static errno_t ext4_read_directory(ipc_call_t *, aoff64_t, size_t,
-    ext4_instance_t *, ext4_inode_ref_t *, size_t *);
-static errno_t ext4_read_file(ipc_call_t *, aoff64_t, size_t, ext4_instance_t *,
-    ext4_inode_ref_t *, size_t *);
-static bool ext4_is_dots(const uint8_t *, size_t);
-static errno_t ext4_instance_get(service_id_t, ext4_instance_t **);
-
-/* Forward declarations of ext4 libfs operations. */
-
-static errno_t ext4_root_get(fs_node_t **, service_id_t);
-static errno_t ext4_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t ext4_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t ext4_node_open(fs_node_t *);
-errno_t ext4_node_put(fs_node_t *);
-static errno_t ext4_create_node(fs_node_t **, service_id_t, int);
-static errno_t ext4_destroy_node(fs_node_t *);
-static errno_t ext4_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t ext4_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t ext4_has_children(bool *, fs_node_t *);
-static fs_index_t ext4_index_get(fs_node_t *);
-static aoff64_t ext4_size_get(fs_node_t *);
-static unsigned ext4_lnkcnt_get(fs_node_t *);
-static bool ext4_is_directory(fs_node_t *);
-static bool ext4_is_file(fs_node_t *node);
-static service_id_t ext4_service_get(fs_node_t *node);
-static errno_t ext4_size_block(service_id_t, uint32_t *);
-static errno_t ext4_total_block_count(service_id_t, uint64_t *);
-static errno_t ext4_free_block_count(service_id_t, uint64_t *);
-
-/* Static variables */
-
-static LIST_INITIALIZE(instance_list);
-static FIBRIL_MUTEX_INITIALIZE(instance_list_mutex);
-static hash_table_t open_nodes;
-static FIBRIL_MUTEX_INITIALIZE(open_nodes_lock);
-
-/* Hash table interface for open nodes hash table */
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} node_key_t;
-
-static size_t open_nodes_key_hash(const void *key_arg)
-{
-	const node_key_t *key = key_arg;
-	return hash_combine(key->service_id, key->index);
-}
-
-static size_t open_nodes_hash(const ht_link_t *item)
-{
-	ext4_node_t *enode = hash_table_get_inst(item, ext4_node_t, link);
-	return hash_combine(enode->instance->service_id, enode->inode_ref->index);
-}
-
-static bool open_nodes_key_equal(const void *key_arg, size_t hash, const ht_link_t *item)
-{
-	const node_key_t *key = key_arg;
-	ext4_node_t *enode = hash_table_get_inst(item, ext4_node_t, link);
-
-	return key->service_id == enode->instance->service_id &&
-	    key->index == enode->inode_ref->index;
-}
-
-static const hash_table_ops_t open_nodes_ops = {
-	.hash = open_nodes_hash,
-	.key_hash = open_nodes_key_hash,
-	.key_equal = open_nodes_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL,
-};
-
-/** Basic initialization of the driver.
- *
- * This is only needed to create the hash table
- * for storing open nodes.
- *
- * @return Error code
- *
- */
-errno_t ext4_global_init(void)
-{
-	if (!hash_table_create(&open_nodes, 0, 0, &open_nodes_ops))
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Finalization of the driver.
- *
- * This is only needed to destroy the hash table.
- *
- * @return Error code
- */
-errno_t ext4_global_fini(void)
-{
-	hash_table_destroy(&open_nodes);
-	return EOK;
-}
-
-/*
- * Ext4 libfs operations.
- */
-
-/** Get instance from internal table by service_id.
- *
- * @param service_id Device identifier
- * @param inst       Output instance if successful operation
- *
- * @return Error code
- *
- */
-errno_t ext4_instance_get(service_id_t service_id, ext4_instance_t **inst)
-{
-	fibril_mutex_lock(&instance_list_mutex);
-
-	if (list_empty(&instance_list)) {
-		fibril_mutex_unlock(&instance_list_mutex);
-		return EINVAL;
-	}
-
-	list_foreach(instance_list, link, ext4_instance_t, tmp) {
-		if (tmp->service_id == service_id) {
-			*inst = tmp;
-			fibril_mutex_unlock(&instance_list_mutex);
-			return EOK;
-		}
-	}
-
-	fibril_mutex_unlock(&instance_list_mutex);
-	return EINVAL;
-}
-
-/** Get root node of filesystem specified by service_id.
- *
- * @param rfn        Output pointer to loaded node
- * @param service_id Device to load root node from
- *
- * @return Error code
- *
- */
-errno_t ext4_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return ext4_node_get(rfn, service_id, EXT4_INODE_ROOT_INDEX);
-}
-
-/** Check if specified name (component) matches with any directory entry.
- *
- * If match is found, load and return matching node.
- *
- * @param rfn       Output pointer to node if operation successful
- * @param pfn       Parent directory node
- * @param component Name to check directory for
- *
- * @return Error code
- *
- */
-errno_t ext4_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	ext4_node_t *eparent = EXT4_NODE(pfn);
-	ext4_filesystem_t *fs = eparent->instance->filesystem;
-	errno_t rc2;
-
-	if (!ext4_inode_is_type(fs->superblock, eparent->inode_ref->inode,
-	    EXT4_INODE_MODE_DIRECTORY))
-		return ENOTDIR;
-
-	/* Try to find entry */
-	ext4_directory_search_result_t result;
-	errno_t rc = ext4_directory_find_entry(&result, eparent->inode_ref,
-	    component);
-	if (rc != EOK) {
-		if (rc == ENOENT) {
-			*rfn = NULL;
-			return EOK;
-		}
-
-		return rc;
-	}
-
-	/* Load node from search result */
-	uint32_t inode = ext4_directory_entry_ll_get_inode(result.dentry);
-	rc = ext4_node_get_core(rfn, eparent->instance, inode);
-	if (rc != EOK)
-		goto exit;
-
-exit:
-	/* Destroy search result structure */
-	rc2 = ext4_directory_destroy_result(&result);
-	return rc == EOK ? rc2 : rc;
-}
-
-/** Get node specified by index
- *
- * It's wrapper for node_put_core operation
- *
- * @param rfn        Output pointer to loaded node if operation successful
- * @param service_id Device identifier
- * @param index      Node index (here i-node number)
- *
- * @return Error code
- *
- */
-errno_t ext4_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
-{
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	return ext4_node_get_core(rfn, inst, index);
-}
-
-/** Main function for getting node from the filesystem.
- *
- * @param rfn   Output point to loaded node if operation successful
- * @param inst  Instance of filesystem
- * @param index Index of node (i-node number)
- *
- * @return Error code
- *
- */
-errno_t ext4_node_get_core(fs_node_t **rfn, ext4_instance_t *inst,
-    fs_index_t index)
-{
-	fibril_mutex_lock(&open_nodes_lock);
-
-	/* Check if the node is not already open */
-	node_key_t key = {
-		.service_id = inst->service_id,
-		.index = index
-	};
-
-	ht_link_t *already_open = hash_table_find(&open_nodes, &key);
-	ext4_node_t *enode = NULL;
-	if (already_open) {
-		enode = hash_table_get_inst(already_open, ext4_node_t, link);
-		*rfn = enode->fs_node;
-		enode->references++;
-
-		fibril_mutex_unlock(&open_nodes_lock);
-		return EOK;
-	}
-
-	/* Prepare new enode */
-	enode = malloc(sizeof(ext4_node_t));
-	if (enode == NULL) {
-		fibril_mutex_unlock(&open_nodes_lock);
-		return ENOMEM;
-	}
-
-	/* Prepare new fs_node and initialize */
-	fs_node_t *fs_node = malloc(sizeof(fs_node_t));
-	if (fs_node == NULL) {
-		free(enode);
-		fibril_mutex_unlock(&open_nodes_lock);
-		return ENOMEM;
-	}
-
-	fs_node_initialize(fs_node);
-
-	/* Load i-node from filesystem */
-	ext4_inode_ref_t *inode_ref;
-	errno_t rc = ext4_filesystem_get_inode_ref(inst->filesystem, index,
-	    &inode_ref);
-	if (rc != EOK) {
-		free(enode);
-		free(fs_node);
-		fibril_mutex_unlock(&open_nodes_lock);
-		return rc;
-	}
-
-	/* Initialize enode */
-	enode->inode_ref = inode_ref;
-	enode->instance = inst;
-	enode->references = 1;
-	enode->fs_node = fs_node;
-
-	fs_node->data = enode;
-	*rfn = fs_node;
-
-	hash_table_insert(&open_nodes, &enode->link);
-	inst->open_nodes_count++;
-
-	fibril_mutex_unlock(&open_nodes_lock);
-
-	return EOK;
-}
-
-/** Put previously loaded node.
- *
- * @param enode Node to put back
- *
- * @return Error code
- *
- */
-static errno_t ext4_node_put_core(ext4_node_t *enode)
-{
-	hash_table_remove_item(&open_nodes, &enode->link);
-	assert(enode->instance->open_nodes_count > 0);
-	enode->instance->open_nodes_count--;
-
-	/* Put inode back in filesystem */
-	errno_t rc = ext4_filesystem_put_inode_ref(enode->inode_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Destroy data structure */
-	free(enode->fs_node);
-	free(enode);
-
-	return EOK;
-}
-
-/** Open node.
- *
- * This operation is stateless in this driver.
- *
- * @param fn Node to open
- *
- * @return EOK
- *
- */
-errno_t ext4_node_open(fs_node_t *fn)
-{
-	/* Stateless operation */
-	return EOK;
-}
-
-/** Put previously loaded node.
- *
- * A wrapper for node_put_core operation
- *
- * @param fn Node to put back
- * @return Error code
- *
- */
-errno_t ext4_node_put(fs_node_t *fn)
-{
-	fibril_mutex_lock(&open_nodes_lock);
-
-	ext4_node_t *enode = EXT4_NODE(fn);
-	assert(enode->references > 0);
-	enode->references--;
-	if (enode->references == 0) {
-		errno_t rc = ext4_node_put_core(enode);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&open_nodes_lock);
-			return rc;
-		}
-	}
-
-	fibril_mutex_unlock(&open_nodes_lock);
-
-	return EOK;
-}
-
-/** Create new node in filesystem.
- *
- * @param rfn        Output pointer to newly created node if successful
- * @param service_id Device identifier, where the filesystem is
- * @param flags      Flags for specification of new node parameters
- *
- * @return Error code
- *
- */
-errno_t ext4_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	/* Allocate enode */
-	ext4_node_t *enode;
-	enode = malloc(sizeof(ext4_node_t));
-	if (enode == NULL)
-		return ENOMEM;
-
-	/* Allocate fs_node */
-	fs_node_t *fs_node;
-	fs_node = malloc(sizeof(fs_node_t));
-	if (fs_node == NULL) {
-		free(enode);
-		return ENOMEM;
-	}
-
-	/* Load instance */
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK) {
-		free(enode);
-		free(fs_node);
-		return rc;
-	}
-
-	/* Allocate new i-node in filesystem */
-	ext4_inode_ref_t *inode_ref;
-	rc = ext4_filesystem_alloc_inode(inst->filesystem, &inode_ref, flags);
-	if (rc != EOK) {
-		free(enode);
-		free(fs_node);
-		return rc;
-	}
-
-	/* Do some interconnections in references */
-	enode->inode_ref = inode_ref;
-	enode->instance = inst;
-	enode->references = 1;
-
-	fibril_mutex_lock(&open_nodes_lock);
-	hash_table_insert(&open_nodes, &enode->link);
-	fibril_mutex_unlock(&open_nodes_lock);
-	inst->open_nodes_count++;
-
-	enode->inode_ref->dirty = true;
-
-	fs_node_initialize(fs_node);
-	fs_node->data = enode;
-	enode->fs_node = fs_node;
-	*rfn = fs_node;
-
-	return EOK;
-}
-
-/** Destroy existing node.
- *
- * @param fs Node to destroy
- *
- * @return Error code
- *
- */
-errno_t ext4_destroy_node(fs_node_t *fn)
-{
-	/* If directory, check for children */
-	bool has_children;
-	errno_t rc = ext4_has_children(&has_children, fn);
-	if (rc != EOK) {
-		ext4_node_put(fn);
-		return rc;
-	}
-
-	if (has_children) {
-		ext4_node_put(fn);
-		return EINVAL;
-	}
-
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_inode_ref_t *inode_ref = enode->inode_ref;
-
-	/* Release data blocks */
-	rc = ext4_filesystem_truncate_inode(inode_ref, 0);
-	if (rc != EOK) {
-		ext4_node_put(fn);
-		return rc;
-	}
-
-	/*
-	 * TODO: Sset real deletion time when it will be supported.
-	 * Temporary set fake deletion time.
-	 */
-	ext4_inode_set_deletion_time(inode_ref->inode, 0xdeadbeef);
-	inode_ref->dirty = true;
-
-	/* Free inode */
-	rc = ext4_filesystem_free_inode(inode_ref);
-	if (rc != EOK) {
-		ext4_node_put(fn);
-		return rc;
-	}
-
-	return ext4_node_put(fn);
-}
-
-/** Link the specfied node to directory.
- *
- * @param pfn  Parent node to link in
- * @param cfn  Node to be linked
- * @param name Name which will be assigned to directory entry
- *
- * @return Error code
- *
- */
-errno_t ext4_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	/* Check maximum name length */
-	if (str_size(name) > EXT4_DIRECTORY_FILENAME_LEN)
-		return ENAMETOOLONG;
-
-	ext4_node_t *parent = EXT4_NODE(pfn);
-	ext4_node_t *child = EXT4_NODE(cfn);
-	ext4_filesystem_t *fs = parent->instance->filesystem;
-
-	/* Add entry to parent directory */
-	errno_t rc = ext4_directory_add_entry(parent->inode_ref, name,
-	    child->inode_ref);
-	if (rc != EOK)
-		return rc;
-
-	/* Fill new dir -> add '.' and '..' entries */
-	if (ext4_inode_is_type(fs->superblock, child->inode_ref->inode,
-	    EXT4_INODE_MODE_DIRECTORY)) {
-		rc = ext4_directory_add_entry(child->inode_ref, ".",
-		    child->inode_ref);
-		if (rc != EOK) {
-			ext4_directory_remove_entry(parent->inode_ref, name);
-			return rc;
-		}
-
-		rc = ext4_directory_add_entry(child->inode_ref, "..",
-		    parent->inode_ref);
-		if (rc != EOK) {
-			ext4_directory_remove_entry(parent->inode_ref, name);
-			ext4_directory_remove_entry(child->inode_ref, ".");
-			return rc;
-		}
-
-		/* Initialize directory index if supported */
-		if (ext4_superblock_has_feature_compatible(fs->superblock,
-		    EXT4_FEATURE_COMPAT_DIR_INDEX)) {
-			rc = ext4_directory_dx_init(child->inode_ref);
-			if (rc != EOK)
-				return rc;
-
-			ext4_inode_set_flag(child->inode_ref->inode,
-			    EXT4_INODE_FLAG_INDEX);
-			child->inode_ref->dirty = true;
-		}
-
-		uint16_t parent_links =
-		    ext4_inode_get_links_count(parent->inode_ref->inode);
-		parent_links++;
-		ext4_inode_set_links_count(parent->inode_ref->inode, parent_links);
-
-		parent->inode_ref->dirty = true;
-	}
-
-	uint16_t child_links =
-	    ext4_inode_get_links_count(child->inode_ref->inode);
-	child_links++;
-	ext4_inode_set_links_count(child->inode_ref->inode, child_links);
-
-	child->inode_ref->dirty = true;
-
-	return EOK;
-}
-
-/** Unlink node from specified directory.
- *
- * @param pfn  Parent node to delete node from
- * @param cfn  Child node to be unlinked from directory
- * @param name Name of entry that will be removed
- *
- * @return Error code
- *
- */
-errno_t ext4_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	bool has_children;
-	errno_t rc = ext4_has_children(&has_children, cfn);
-	if (rc != EOK)
-		return rc;
-
-	/* Cannot unlink non-empty node */
-	if (has_children)
-		return ENOTEMPTY;
-
-	/* Remove entry from parent directory */
-	ext4_inode_ref_t *parent = EXT4_NODE(pfn)->inode_ref;
-	rc = ext4_directory_remove_entry(parent, name);
-	if (rc != EOK)
-		return rc;
-
-	/* Decrement links count */
-	ext4_inode_ref_t *child_inode_ref = EXT4_NODE(cfn)->inode_ref;
-
-	uint32_t lnk_count =
-	    ext4_inode_get_links_count(child_inode_ref->inode);
-	lnk_count--;
-
-	/* If directory - handle links from parent */
-	if ((lnk_count <= 1) && (ext4_is_directory(cfn))) {
-		assert(lnk_count == 1);
-
-		lnk_count--;
-
-		ext4_inode_ref_t *parent_inode_ref = EXT4_NODE(pfn)->inode_ref;
-
-		uint32_t parent_lnk_count = ext4_inode_get_links_count(
-		    parent_inode_ref->inode);
-
-		parent_lnk_count--;
-		ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count);
-
-		parent->dirty = true;
-	}
-
-	/*
-	 * TODO: Update timestamps of the parent
-	 * (when we have wall-clock time).
-	 *
-	 * ext4_inode_set_change_inode_time(parent->inode, (uint32_t) now);
-	 * ext4_inode_set_modification_time(parent->inode, (uint32_t) now);
-	 * parent->dirty = true;
-	 */
-
-	/*
-	 * TODO: Update timestamp for inode.
-	 *
-	 * ext4_inode_set_change_inode_time(child_inode_ref->inode,
-	 *     (uint32_t) now);
-	 */
-
-	ext4_inode_set_links_count(child_inode_ref->inode, lnk_count);
-	child_inode_ref->dirty = true;
-
-	return EOK;
-}
-
-/** Check if specified node has children.
- *
- * For files is response allways false and check is executed only for directories.
- *
- * @param has_children Output value for response
- * @param fn           Node to check
- *
- * @return Error code
- *
- */
-errno_t ext4_has_children(bool *has_children, fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_filesystem_t *fs = enode->instance->filesystem;
-
-	/* Check if node is directory */
-	if (!ext4_inode_is_type(fs->superblock, enode->inode_ref->inode,
-	    EXT4_INODE_MODE_DIRECTORY)) {
-		*has_children = false;
-		return EOK;
-	}
-
-	ext4_directory_iterator_t it;
-	errno_t rc = ext4_directory_iterator_init(&it, enode->inode_ref, 0);
-	if (rc != EOK)
-		return rc;
-
-	/* Find a non-empty directory entry */
-	bool found = false;
-	while (it.current != NULL) {
-		if (it.current->inode != 0) {
-			uint16_t name_size =
-			    ext4_directory_entry_ll_get_name_length(fs->superblock,
-			    it.current);
-			if (!ext4_is_dots(it.current->name, name_size)) {
-				found = true;
-				break;
-			}
-		}
-
-		rc = ext4_directory_iterator_next(&it);
-		if (rc != EOK) {
-			ext4_directory_iterator_fini(&it);
-			return rc;
-		}
-	}
-
-	rc = ext4_directory_iterator_fini(&it);
-	if (rc != EOK)
-		return rc;
-
-	*has_children = found;
-
-	return EOK;
-}
-
-/** Unpack index number from node.
- *
- * @param fn Node to load index from
- *
- * @return Index number of i-node
- *
- */
-fs_index_t ext4_index_get(fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	return enode->inode_ref->index;
-}
-
-/** Get real size of file / directory.
- *
- * @param fn Node to get size of
- *
- * @return Real size of node
- *
- */
-aoff64_t ext4_size_get(fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_superblock_t *sb = enode->instance->filesystem->superblock;
-	return ext4_inode_get_size(sb, enode->inode_ref->inode);
-}
-
-/** Get number of links to specified node.
- *
- * @param fn Node to get links to
- *
- * @return Number of links
- *
- */
-unsigned ext4_lnkcnt_get(fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	uint32_t lnkcnt = ext4_inode_get_links_count(enode->inode_ref->inode);
-
-	if (ext4_is_directory(fn)) {
-		if (lnkcnt > 1)
-			return 1;
-		else
-			return 0;
-	}
-
-	/* For regular files return real links count */
-	return lnkcnt;
-}
-
-/** Check if node is directory.
- *
- * @param fn Node to check
- *
- * @return Result of check
- *
- */
-bool ext4_is_directory(fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_superblock_t *sb = enode->instance->filesystem->superblock;
-
-	return ext4_inode_is_type(sb, enode->inode_ref->inode,
-	    EXT4_INODE_MODE_DIRECTORY);
-}
-
-/** Check if node is regular file.
- *
- * @param fn Node to check
- *
- * @return Result of check
- *
- */
-bool ext4_is_file(fs_node_t *fn)
-{
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_superblock_t *sb = enode->instance->filesystem->superblock;
-
-	return ext4_inode_is_type(sb, enode->inode_ref->inode,
-	    EXT4_INODE_MODE_FILE);
-}
-
-/** Get service ID for a service-special file.
- *
- * @param node Node to extract id from
- *
- * @return Service ID for a service-special file, zero for a regular file.
- *
- */
-service_id_t ext4_service_get(fs_node_t *fn)
-{
-	return 0;
-}
-
-errno_t ext4_size_block(service_id_t service_id, uint32_t *size)
-{
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	if (NULL == inst)
-		return ENOENT;
-
-	ext4_superblock_t *sb = inst->filesystem->superblock;
-	*size = ext4_superblock_get_block_size(sb);
-
-	return EOK;
-}
-
-errno_t ext4_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	if (NULL == inst)
-		return ENOENT;
-
-	ext4_superblock_t *sb = inst->filesystem->superblock;
-	*count = ext4_superblock_get_blocks_count(sb);
-
-	return EOK;
-}
-
-errno_t ext4_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	ext4_superblock_t *sb = inst->filesystem->superblock;
-	*count = ext4_superblock_get_free_blocks_count(sb);
-
-	return EOK;
-}
-
-/*
- * libfs operations.
- */
-libfs_ops_t ext4_libfs_ops = {
-	.root_get = ext4_root_get,
-	.match = ext4_match,
-	.node_get = ext4_node_get,
-	.node_open = ext4_node_open,
-	.node_put = ext4_node_put,
-	.create = ext4_create_node,
-	.destroy = ext4_destroy_node,
-	.link = ext4_link,
-	.unlink = ext4_unlink,
-	.has_children = ext4_has_children,
-	.index_get = ext4_index_get,
-	.size_get = ext4_size_get,
-	.lnkcnt_get = ext4_lnkcnt_get,
-	.is_directory = ext4_is_directory,
-	.is_file = ext4_is_file,
-	.service_get = ext4_service_get,
-	.size_block = ext4_size_block,
-	.total_block_count = ext4_total_block_count,
-	.free_block_count = ext4_free_block_count
-};
-
-/*
- * VFS operations.
- */
-
-/** Probe operation.
- *
- * Try to get information about specified filesystem from device.
- *
- * @param sevice_id Service ID
- * @param info Place to store information
- *
- * @return Error code
- */
-static errno_t ext4_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	ext4_fs_probe_info_t pinfo;
-	errno_t rc;
-
-	rc = ext4_filesystem_probe(service_id, &pinfo);
-	if (rc != EOK)
-		return rc;
-
-	memcpy(info->label, pinfo.vol_name, sizeof(pinfo.vol_name));
-	return EOK;
-}
-
-/** Mount operation.
- *
- * Try to mount specified filesystem from device.
- *
- * @param service_id Identifier of device
- * @param opts       Mount options
- * @param index      Output value - index of root node
- * @param size       Output value - size of root node
- *
- * @return Error code
- *
- */
-static errno_t ext4_mounted(service_id_t service_id, const char *opts,
-    fs_index_t *index, aoff64_t *size)
-{
-	ext4_filesystem_t *fs;
-
-	/* Allocate instance structure */
-	ext4_instance_t *inst = (ext4_instance_t *)
-	    malloc(sizeof(ext4_instance_t));
-	if (inst == NULL)
-		return ENOMEM;
-
-	enum cache_mode cmode;
-	if (str_cmp(opts, "wtcache") == 0)
-		cmode = CACHE_MODE_WT;
-	else
-		cmode = CACHE_MODE_WB;
-
-	/* Initialize instance */
-	link_initialize(&inst->link);
-	inst->service_id = service_id;
-	inst->open_nodes_count = 0;
-
-	/* Initialize the filesystem */
-	aoff64_t rnsize;
-	errno_t rc = ext4_filesystem_open(inst, service_id, cmode, &rnsize, &fs);
-	if (rc != EOK) {
-		free(inst);
-		return rc;
-	}
-
-	/* Add instance to the list */
-	fibril_mutex_lock(&instance_list_mutex);
-	list_append(&inst->link, &instance_list);
-	fibril_mutex_unlock(&instance_list_mutex);
-
-	*index = EXT4_INODE_ROOT_INDEX;
-	*size = rnsize;
-
-	return EOK;
-}
-
-/** Unmount operation.
- *
- * Correctly release the filesystem.
- *
- * @param service_id Device to be unmounted
- *
- * @return Error code
- *
- */
-static errno_t ext4_unmounted(service_id_t service_id)
-{
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	fibril_mutex_lock(&open_nodes_lock);
-
-	if (inst->open_nodes_count != 0) {
-		fibril_mutex_unlock(&open_nodes_lock);
-		return EBUSY;
-	}
-
-	/* Remove the instance from the list */
-	fibril_mutex_lock(&instance_list_mutex);
-	list_remove(&inst->link);
-	fibril_mutex_unlock(&instance_list_mutex);
-
-	fibril_mutex_unlock(&open_nodes_lock);
-
-	rc = ext4_filesystem_close(inst->filesystem);
-	if (rc != EOK) {
-		fibril_mutex_lock(&instance_list_mutex);
-		list_append(&inst->link, &instance_list);
-		fibril_mutex_unlock(&instance_list_mutex);
-	}
-
-	free(inst);
-	return EOK;
-}
-
-/** Read bytes from node.
- *
- * @param service_id Device to read data from
- * @param index      Number of node to read from
- * @param pos        Position where the read should be started
- * @param rbytes     Output value, where the real size was returned
- *
- * @return Error code
- *
- */
-static errno_t ext4_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	/*
-	 * Receive the read request.
-	 */
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	ext4_instance_t *inst;
-	errno_t rc = ext4_instance_get(service_id, &inst);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		return rc;
-	}
-
-	/* Load i-node */
-	ext4_inode_ref_t *inode_ref;
-	rc = ext4_filesystem_get_inode_ref(inst->filesystem, index, &inode_ref);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		return rc;
-	}
-
-	/* Read from i-node by type */
-	if (ext4_inode_is_type(inst->filesystem->superblock, inode_ref->inode,
-	    EXT4_INODE_MODE_FILE)) {
-		rc = ext4_read_file(&call, pos, size, inst, inode_ref,
-		    rbytes);
-	} else if (ext4_inode_is_type(inst->filesystem->superblock,
-	    inode_ref->inode, EXT4_INODE_MODE_DIRECTORY)) {
-		rc = ext4_read_directory(&call, pos, size, inst, inode_ref,
-		    rbytes);
-	} else {
-		/* Other inode types not supported */
-		async_answer_0(&call, ENOTSUP);
-		rc = ENOTSUP;
-	}
-
-	errno_t const rc2 = ext4_filesystem_put_inode_ref(inode_ref);
-
-	return rc == EOK ? rc2 : rc;
-}
-
-/** Check if filename is dot or dotdot (reserved names).
- *
- * @param name      Name to check
- * @param name_size Length of string name
- *
- * @return Result of the check
- *
- */
-bool ext4_is_dots(const uint8_t *name, size_t name_size)
-{
-	if ((name_size == 1) && (name[0] == '.'))
-		return true;
-
-	if ((name_size == 2) && (name[0] == '.') && (name[1] == '.'))
-		return true;
-
-	return false;
-}
-
-/** Read data from directory.
- *
- * @param call      IPC call
- * @param pos       Position to start reading from
- * @param size      How many bytes to read
- * @param inst      Filesystem instance
- * @param inode_ref Node to read data from
- * @param rbytes    Output value to return real number of bytes was read
- *
- * @return Error code
- *
- */
-errno_t ext4_read_directory(ipc_call_t *call, aoff64_t pos, size_t size,
-    ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
-{
-	ext4_directory_iterator_t it;
-	errno_t rc = ext4_directory_iterator_init(&it, inode_ref, pos);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return rc;
-	}
-
-	/*
-	 * Find next interesting directory entry.
-	 * We want to skip . and .. entries
-	 * as these are not used in HelenOS
-	 */
-	bool found = false;
-	while (it.current != NULL) {
-		if (it.current->inode == 0)
-			goto skip;
-
-		uint16_t name_size = ext4_directory_entry_ll_get_name_length(
-		    inst->filesystem->superblock, it.current);
-
-		/* Skip . and .. */
-		if (ext4_is_dots(it.current->name, name_size))
-			goto skip;
-
-		/*
-		 * The on-disk entry does not contain \0 at the end
-		 * end of entry name, so we copy it to new buffer
-		 * and add the \0 at the end
-		 */
-		uint8_t *buf = malloc(name_size + 1);
-		if (buf == NULL) {
-			ext4_directory_iterator_fini(&it);
-			async_answer_0(call, ENOMEM);
-			return ENOMEM;
-		}
-
-		memcpy(buf, &it.current->name, name_size);
-		*(buf + name_size) = 0;
-		found = true;
-
-		(void) async_data_read_finalize(call, buf, name_size + 1);
-		free(buf);
-		break;
-
-	skip:
-		rc = ext4_directory_iterator_next(&it);
-		if (rc != EOK) {
-			ext4_directory_iterator_fini(&it);
-			async_answer_0(call, rc);
-			return rc;
-		}
-	}
-
-	uint64_t next;
-	if (found) {
-		rc = ext4_directory_iterator_next(&it);
-		if (rc != EOK)
-			return rc;
-
-		next = it.current_offset;
-	}
-
-	rc = ext4_directory_iterator_fini(&it);
-	if (rc != EOK)
-		return rc;
-
-	/* Prepare return values */
-	if (found) {
-		*rbytes = next - pos;
-		return EOK;
-	} else {
-		async_answer_0(call, ENOENT);
-		return ENOENT;
-	}
-}
-
-/** Read data from file.
- *
- * @param call      IPC call
- * @param pos       Position to start reading from
- * @param size      How many bytes to read
- * @param inst      Filesystem instance
- * @param inode_ref Node to read data from
- * @param rbytes    Output value to return real number of bytes was read
- *
- * @return Error code
- *
- */
-errno_t ext4_read_file(ipc_call_t *call, aoff64_t pos, size_t size,
-    ext4_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
-{
-	ext4_superblock_t *sb = inst->filesystem->superblock;
-	uint64_t file_size = ext4_inode_get_size(sb, inode_ref->inode);
-
-	if (pos >= file_size) {
-		/* Read 0 bytes successfully */
-		async_data_read_finalize(call, NULL, 0);
-		*rbytes = 0;
-		return EOK;
-	}
-
-	/* For now, we only read data from one block at a time */
-	uint32_t block_size = ext4_superblock_get_block_size(sb);
-	aoff64_t file_block = pos / block_size;
-	uint32_t offset_in_block = pos % block_size;
-	uint32_t bytes = min(block_size - offset_in_block, size);
-
-	/* Handle end of file */
-	if (pos + bytes > file_size)
-		bytes = file_size - pos;
-
-	/* Get the real block number */
-	uint32_t fs_block;
-	errno_t rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-	    file_block, &fs_block);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return rc;
-	}
-
-	/*
-	 * Check for sparse file.
-	 * If ext4_filesystem_get_inode_data_block_index returned
-	 * fs_block == 0, it means that the given block is not allocated for the
-	 * file and we need to return a buffer of zeros
-	 */
-	uint8_t *buffer;
-	if (fs_block == 0) {
-		buffer = malloc(bytes);
-		if (buffer == NULL) {
-			async_answer_0(call, ENOMEM);
-			return ENOMEM;
-		}
-
-		memset(buffer, 0, bytes);
-
-		rc = async_data_read_finalize(call, buffer, bytes);
-		*rbytes = bytes;
-
-		free(buffer);
-		return rc;
-	}
-
-	/* Usual case - we need to read a block from device */
-	block_t *block;
-	rc = block_get(&block, inst->service_id, fs_block, BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return rc;
-	}
-
-	assert(offset_in_block + bytes <= block_size);
-	rc = async_data_read_finalize(call, block->data + offset_in_block, bytes);
-	if (rc != EOK) {
-		block_put(block);
-		return rc;
-	}
-
-	rc = block_put(block);
-	if (rc != EOK)
-		return rc;
-
-	*rbytes = bytes;
-	return EOK;
-}
-
-/** Write bytes to file
- *
- * @param service_id Device identifier
- * @param index      I-node number of file
- * @param pos        Position in file to start reading from
- * @param wbytes     Output value - real number of written bytes
- * @param nsize      Output value - new size of i-node
- *
- * @return Error code
- *
- */
-static errno_t ext4_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	fs_node_t *fn;
-	errno_t rc2;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_write_receive(&call, &len)) {
-		rc = EINVAL;
-		async_answer_0(&call, rc);
-		goto exit;
-	}
-
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_filesystem_t *fs = enode->instance->filesystem;
-
-	uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
-
-	/* Prevent writing to more than one block */
-	uint32_t bytes = min(len, block_size - (pos % block_size));
-
-	int flags = BLOCK_FLAGS_NONE;
-	if (bytes == block_size)
-		flags = BLOCK_FLAGS_NOREAD;
-
-	uint32_t iblock =  pos / block_size;
-	uint32_t fblock;
-
-	/* Load inode */
-	ext4_inode_ref_t *inode_ref = enode->inode_ref;
-	rc = ext4_filesystem_get_inode_data_block_index(inode_ref, iblock,
-	    &fblock);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		goto exit;
-	}
-
-	/* Check for sparse file */
-	if (fblock == 0) {
-		if ((ext4_superblock_has_feature_incompatible(fs->superblock,
-		    EXT4_FEATURE_INCOMPAT_EXTENTS)) &&
-		    (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) {
-			uint32_t last_iblock =
-			    ext4_inode_get_size(fs->superblock, inode_ref->inode) /
-			    block_size;
-
-			while (last_iblock < iblock) {
-				rc = ext4_extent_append_block(inode_ref, &last_iblock,
-				    &fblock, true);
-				if (rc != EOK) {
-					async_answer_0(&call, rc);
-					goto exit;
-				}
-			}
-
-			rc = ext4_extent_append_block(inode_ref, &last_iblock,
-			    &fblock, false);
-			if (rc != EOK) {
-				async_answer_0(&call, rc);
-				goto exit;
-			}
-		} else {
-			rc = ext4_balloc_alloc_block(inode_ref, &fblock);
-			if (rc != EOK) {
-				async_answer_0(&call, rc);
-				goto exit;
-			}
-
-			rc = ext4_filesystem_set_inode_data_block_index(inode_ref,
-			    iblock, fblock);
-			if (rc != EOK) {
-				ext4_balloc_free_block(inode_ref, fblock);
-				async_answer_0(&call, rc);
-				goto exit;
-			}
-		}
-
-		flags = BLOCK_FLAGS_NOREAD;
-		inode_ref->dirty = true;
-	}
-
-	/* Load target block */
-	block_t *write_block;
-	rc = block_get(&write_block, service_id, fblock, flags);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		goto exit;
-	}
-
-	if (flags == BLOCK_FLAGS_NOREAD)
-		memset(write_block->data, 0, block_size);
-
-	rc = async_data_write_finalize(&call, write_block->data +
-	    (pos % block_size), bytes);
-	if (rc != EOK) {
-		block_put(write_block);
-		goto exit;
-	}
-
-	write_block->dirty = true;
-
-	rc = block_put(write_block);
-	if (rc != EOK)
-		goto exit;
-
-	/* Do some counting */
-	uint32_t old_inode_size = ext4_inode_get_size(fs->superblock,
-	    inode_ref->inode);
-	if (pos + bytes > old_inode_size) {
-		ext4_inode_set_size(inode_ref->inode, pos + bytes);
-		inode_ref->dirty = true;
-	}
-
-	*nsize = ext4_inode_get_size(fs->superblock, inode_ref->inode);
-	*wbytes = bytes;
-
-exit:
-	rc2 = ext4_node_put(fn);
-	return rc == EOK ? rc2 : rc;
-}
-
-/** Truncate file.
- *
- * Only the direction to shorter file is supported.
- *
- * @param service_id Device identifier
- * @param index      Index if node to truncated
- * @param new_size   New size of file
- *
- * @return Error code
- *
- */
-static errno_t ext4_truncate(service_id_t service_id, fs_index_t index,
-    aoff64_t new_size)
-{
-	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-
-	ext4_node_t *enode = EXT4_NODE(fn);
-	ext4_inode_ref_t *inode_ref = enode->inode_ref;
-
-	rc = ext4_filesystem_truncate_inode(inode_ref, new_size);
-	errno_t const rc2 = ext4_node_put(fn);
-
-	return rc == EOK ? rc2 : rc;
-}
-
-/** Close file.
- *
- * @param service_id Device identifier
- * @param index      I-node number
- *
- * @return Error code
- *
- */
-static errno_t ext4_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-/** Destroy node specified by index.
- *
- * @param service_id Device identifier
- * @param index      I-node to destroy
- *
- * @return Error code
- *
- */
-static errno_t ext4_destroy(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-
-	/* Destroy the inode */
-	return ext4_destroy_node(fn);
-}
-
-/** Enforce inode synchronization (write) to device.
- *
- * @param service_id Device identifier
- * @param index      I-node number.
- *
- */
-static errno_t ext4_sync(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	errno_t rc = ext4_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-
-	ext4_node_t *enode = EXT4_NODE(fn);
-	enode->inode_ref->dirty = true;
-
-	return ext4_node_put(fn);
-}
-
-/** VFS operations
- *
- */
-vfs_out_ops_t ext4_ops = {
-	.fsprobe = ext4_fsprobe,
-	.mounted = ext4_mounted,
-	.unmounted = ext4_unmounted,
-	.read = ext4_read,
-	.write = ext4_write,
-	.truncate = ext4_truncate,
-	.close = ext4_close,
-	.destroy = ext4_destroy,
-	.sync = ext4_sync
-};
-
-/**
- * @}
- */
Index: pace/lib/ext4/src/superblock.c
===================================================================
--- uspace/lib/ext4/src/superblock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1690 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * Copyright (c) 2011 Martin Sucha
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libext4
- * @{
- */
-
-/**
- * @file  superblock.c
- * @brief Ext4 superblock operations.
- */
-
-#include <align.h>
-#include <block.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include <time.h>
-#include "ext4/cfg.h"
-#include "ext4/superblock.h"
-
-/** Get number of i-nodes in the whole filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of i-nodes
- *
- */
-uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->inodes_count);
-}
-
-/** Set number of i-nodes in the whole filesystem.
- *
- * @param sb    Superblock
- * @param count Number of i-nodes
- *
- */
-void ext4_superblock_set_inodes_count(ext4_superblock_t *sb, uint32_t count)
-{
-	sb->inodes_count = host2uint32_t_le(count);
-}
-
-/** Get number of data blocks in the whole filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of data blocks
- *
- */
-uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *sb)
-{
-	return ((uint64_t) uint32_t_le2host(sb->blocks_count_hi) << 32) |
-	    uint32_t_le2host(sb->blocks_count_lo);
-}
-
-/** Set number of data blocks in the whole filesystem.
- *
- * @param sb    Superblock
- * @param count Number of data blocks
- *
- */
-void ext4_superblock_set_blocks_count(ext4_superblock_t *sb, uint64_t count)
-{
-	sb->blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
-	sb->blocks_count_hi = host2uint32_t_le(count >> 32);
-}
-
-/** Get number of reserved data blocks in the whole filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of reserved data blocks
- *
- */
-uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *sb)
-{
-	return ((uint64_t)
-	    uint32_t_le2host(sb->reserved_blocks_count_hi) << 32) |
-	    uint32_t_le2host(sb->reserved_blocks_count_lo);
-}
-
-/** Set number of reserved data blocks in the whole filesystem.
- *
- * @param sb    Superblock
- * @param count Number of reserved data blocks
- *
- */
-void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *sb,
-    uint64_t count)
-{
-	sb->reserved_blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
-	sb->reserved_blocks_count_hi = host2uint32_t_le(count >> 32);
-}
-
-/** Get number of free data blocks in the whole filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of free data blocks
- *
- */
-uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *sb)
-{
-	return ((uint64_t)
-	    uint32_t_le2host(sb->free_blocks_count_hi) << 32) |
-	    uint32_t_le2host(sb->free_blocks_count_lo);
-}
-
-/** Set number of free data blocks in the whole filesystem.
- *
- * @param sb    Superblock
- * @param count Number of free data blocks
- *
- */
-void ext4_superblock_set_free_blocks_count(ext4_superblock_t *sb,
-    uint64_t count)
-{
-	sb->free_blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
-	sb->free_blocks_count_hi = host2uint32_t_le(count >> 32);
-}
-
-/** Get number of free i-nodes in the whole filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of free i-nodes
- *
- */
-uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->free_inodes_count);
-}
-
-/** Set number of free i-nodes in the whole filesystem.
- *
- * @param sb    Superblock
- * @param count Number of free i-nodes
- *
- */
-void ext4_superblock_set_free_inodes_count(ext4_superblock_t *sb,
-    uint32_t count)
-{
-	sb->free_inodes_count = host2uint32_t_le(count);
-}
-
-/** Get index of first data block (block where the superblock is located)
- *
- * @param sb Superblock
- *
- * @return Index of the first data block
- *
- */
-uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->first_data_block);
-}
-
-/** Set index of first data block (block where the superblock is located)
- *
- * @param sb    Superblock
- * @param first Index of the first data block
- *
- */
-void ext4_superblock_set_first_data_block(ext4_superblock_t *sb,
-    uint32_t first)
-{
-	sb->first_data_block = host2uint32_t_le(first);
-}
-
-/** Get logarithmic block size (1024 << size == block_size)
- *
- * @param sb Superblock
- *
- * @return Logarithmic block size
- *
- */
-uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->log_block_size);
-}
-
-/** Set logarithmic block size (1024 << size == block_size)
- *
- * @param sb Superblock
- *
- * @return Logarithmic block size
- *
- */
-void ext4_superblock_set_log_block_size(ext4_superblock_t *sb,
-    uint32_t log_size)
-{
-	sb->log_block_size = host2uint32_t_le(log_size);
-}
-
-/** Get size of data block (in bytes).
- *
- * @param sb Superblock
- *
- * @return Size of data block
- *
- */
-uint32_t ext4_superblock_get_block_size(ext4_superblock_t *sb)
-{
-	return 1024 << ext4_superblock_get_log_block_size(sb);
-}
-
-/** Set size of data block (in bytes).
- *
- * @param sb   Superblock
- * @param size Size of data block (must be power of 2, at least 1024)
- *
- */
-void ext4_superblock_set_block_size(ext4_superblock_t *sb, uint32_t size)
-{
-	uint32_t log = 0;
-	uint32_t tmp = size / EXT4_MIN_BLOCK_SIZE;
-
-	tmp >>= 1;
-	while (tmp) {
-		log++;
-		tmp >>= 1;
-	}
-
-	ext4_superblock_set_log_block_size(sb, log);
-}
-
-/** Get logarithmic fragment size (1024 << size)
- *
- * @param sb Superblock
- *
- * @return Logarithmic fragment size
- *
- */
-uint32_t ext4_superblock_get_log_frag_size(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->log_frag_size);
-}
-
-/** Set logarithmic fragment size (1024 << size)
- *
- * @param sb        Superblock
- * @param frag_size Logarithmic fragment size
- *
- */
-void ext4_superblock_set_log_frag_size(ext4_superblock_t *sb,
-    uint32_t frag_size)
-{
-	sb->log_frag_size = host2uint32_t_le(frag_size);
-}
-
-/** Get size of fragment (in bytes).
- *
- * @param sb Superblock
- *
- * @return Size of fragment
- *
- */
-uint32_t ext4_superblock_get_frag_size(ext4_superblock_t *sb)
-{
-	return 1024 << ext4_superblock_get_log_frag_size(sb);
-}
-
-/** Set size of fragment (in bytes).
- *
- * @param sb   Superblock
- * @param size Size of fragment (must be power of 2, at least 1024)
- *
- */
-void ext4_superblock_set_frag_size(ext4_superblock_t *sb, uint32_t size)
-{
-	uint32_t log = 0;
-	uint32_t tmp = size / EXT4_MIN_BLOCK_SIZE;
-
-	tmp >>= 1;
-	while (tmp) {
-		log++;
-		tmp >>= 1;
-	}
-
-	ext4_superblock_set_log_frag_size(sb, log);
-}
-
-/** Get number of data blocks per block group (except last BG)
- *
- * @param sb Superblock
- *
- * @return Data blocks per block group
- *
- */
-uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->blocks_per_group);
-}
-
-/** Set number of data blocks per block group (except last BG)
- *
- * @param sb     Superblock
- * @param blocks Data blocks per block group
- *
- */
-void ext4_superblock_set_blocks_per_group(ext4_superblock_t *sb,
-    uint32_t blocks)
-{
-	sb->blocks_per_group = host2uint32_t_le(blocks);
-}
-
-/** Get number of fragments per block group (except last BG)
- *
- * @param sb Superblock
- *
- * @return Fragments per block group
- *
- */
-uint32_t ext4_superblock_get_frags_per_group(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->frags_per_group);
-}
-
-/** Set number of fragment per block group (except last BG)
- *
- * @param sb    Superblock
- * @param frags Fragments per block group
- */
-void ext4_superblock_set_frags_per_group(ext4_superblock_t *sb, uint32_t frags)
-{
-	sb->frags_per_group = host2uint32_t_le(frags);
-}
-
-/** Get number of i-nodes per block group (except last BG)
- *
- * @param sb Superblock
- *
- * @return I-nodes per block group
- *
- */
-uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->inodes_per_group);
-}
-
-/** Set number of i-nodes per block group (except last BG)
- *
- * @param sb     Superblock
- * @param inodes I-nodes per block group
- *
- */
-void ext4_superblock_set_inodes_per_group(ext4_superblock_t *sb,
-    uint32_t inodes)
-{
-	sb->inodes_per_group = host2uint32_t_le(inodes);
-}
-
-/** Get time when filesystem was mounted (POSIX time).
- *
- * @param sb Superblock
- *
- * @return Mount time
- *
- */
-uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->mount_time);
-}
-
-/** Set time when filesystem was mounted (POSIX time).
- *
- * @param sb   Superblock
- * @param time Mount time
- *
- */
-void ext4_superblock_set_mount_time(ext4_superblock_t *sb, uint32_t time)
-{
-	sb->mount_time = host2uint32_t_le(time);
-}
-
-/** Get time when filesystem was last accesed by write operation (POSIX time).
- *
- * @param sb Superblock
- *
- * @return Write time
- *
- */
-uint32_t ext4_superblock_get_write_time(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->write_time);
-}
-
-/** Set time when filesystem was last accesed by write operation (POSIX time).
- *
- * @param sb   Superblock
- * @param time Write time
- *
- */
-void ext4_superblock_set_write_time(ext4_superblock_t *sb, uint32_t time)
-{
-	sb->write_time = host2uint32_t_le(time);
-}
-
-/** Get number of mount from last filesystem check.
- *
- * @param sb Superblock
- *
- * @return Number of mounts
- *
- */
-uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->mount_count);
-}
-
-/** Set number of mount from last filesystem check.
- *
- * @param sb    Superblock
- * @param count Number of mounts
- *
- */
-void ext4_superblock_set_mount_count(ext4_superblock_t *sb, uint16_t count)
-{
-	sb->mount_count = host2uint16_t_le(count);
-}
-
-/** Get maximum number of mount from last filesystem check.
- *
- * @param sb Superblock
- *
- * @return Maximum number of mounts
- *
- */
-uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->max_mount_count);
-}
-
-/** Set maximum number of mount from last filesystem check.
- *
- * @param sb    Superblock
- * @param count Maximum number of mounts
- *
- */
-void ext4_superblock_set_max_mount_count(ext4_superblock_t *sb, uint16_t count)
-{
-	sb->max_mount_count = host2uint16_t_le(count);
-}
-
-/** Get superblock magic value.
- *
- * @param sb Superblock
- *
- * @return Magic value
- *
- */
-uint16_t ext4_superblock_get_magic(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->magic);
-}
-
-/** Set superblock magic value.
- *
- * @param sb    Superblock
- * @param magic Magic value
- *
- */
-void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic)
-{
-	sb->magic = host2uint16_t_le(magic);
-}
-
-/** Get filesystem state.
- *
- * @param sb Superblock
- *
- * @return Filesystem state
- *
- */
-uint16_t ext4_superblock_get_state(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->state);
-}
-
-/** Set filesystem state.
- *
- * @param sb    Superblock
- * @param state Filesystem state
- *
- */
-void ext4_superblock_set_state(ext4_superblock_t *sb, uint16_t state)
-{
-	sb->state = host2uint16_t_le(state);
-}
-
-/** Get behavior code when errors detected.
- *
- * @param sb Superblock
- *
- * @return Behavior code
- *
- */
-uint16_t ext4_superblock_get_errors(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->errors);
-}
-
-/** Set behavior code when errors detected.
- *
- * @param sb     Superblock
- * @param errors Behavior code
- *
- */
-void ext4_superblock_set_errors(ext4_superblock_t *sb, uint16_t errors)
-{
-	sb->errors = host2uint16_t_le(errors);
-}
-
-/** Get minor revision level of the filesystem.
- *
- * @param sb Superblock
- *
- * @return Minor revision level
- *
- */
-uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->minor_rev_level);
-}
-
-/** Set minor revision level of the filesystem.
- *
- * @param sb    Superblock
- * @param level Minor revision level
- *
- */
-void ext4_superblock_set_minor_rev_level(ext4_superblock_t *sb, uint16_t level)
-{
-	sb->minor_rev_level = host2uint16_t_le(level);
-}
-
-/** Get time of the last filesystem check.
- *
- * @param sb Superblock
- *
- * @return Time of the last check (POSIX)
- *
- */
-uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->last_check_time);
-}
-
-/** Set time of the last filesystem check.
- *
- * @param sb   Superblock
- * @param time Time of the last check (POSIX)
- *
- */
-void ext4_superblock_set_last_check_time(ext4_superblock_t *sb, uint32_t time)
-{
-	sb->last_check_time = host2uint32_t_le(time);
-}
-
-/** Get maximum time interval between two filesystem checks.
- *
- * @param sb Superblock
- *
- * @return Time interval between two check (POSIX)
- *
- */
-uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->check_interval);
-}
-
-/** Set maximum time interval between two filesystem checks.
- *
- * @param sb       Superblock
- * @param interval Time interval between two check (POSIX)
- *
- */
-void ext4_superblock_set_check_interval(ext4_superblock_t *sb, uint32_t interval)
-{
-	sb->check_interval = host2uint32_t_le(interval);
-}
-
-/** Get operation system identifier, on which the filesystem was created.
- *
- * @param sb Superblock
- *
- * @return Operation system identifier
- *
- */
-uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->creator_os);
-}
-
-/** Set operation system identifier, on which the filesystem was created.
- *
- * @param sb Superblock
- * @param os Operation system identifier
- *
- */
-void ext4_superblock_set_creator_os(ext4_superblock_t *sb, uint32_t os)
-{
-	sb->creator_os = host2uint32_t_le(os);
-}
-
-/** Get revision level of the filesystem.
- *
- * @param sb Superblock
- *
- * @return Revision level
- *
- */
-uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->rev_level);
-}
-
-/** Set revision level of the filesystem.
- *
- * @param sb    Superblock
- * @param level Revision level
- *
- */
-void ext4_superblock_set_rev_level(ext4_superblock_t *sb, uint32_t level)
-{
-	sb->rev_level = host2uint32_t_le(level);
-}
-
-/** Get default user id for reserved blocks.
- *
- * @param sb Superblock
- *
- * @return Default user id for reserved blocks.
- *
- */
-uint16_t ext4_superblock_get_def_resuid(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->def_resuid);
-}
-
-/** Set default user id for reserved blocks.
- *
- * @param sb  Superblock
- * @param uid Default user id for reserved blocks.
- *
- */
-void ext4_superblock_set_def_resuid(ext4_superblock_t *sb, uint16_t uid)
-{
-	sb->def_resuid = host2uint16_t_le(uid);
-}
-
-/** Get default group id for reserved blocks.
- *
- * @param sb Superblock
- *
- * @return Default group id for reserved blocks.
- *
- */
-uint16_t ext4_superblock_get_def_resgid(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->def_resgid);
-}
-
-/** Set default group id for reserved blocks.
- *
- * @param sb  Superblock
- * @param gid Default group id for reserved blocks.
- *
- */
-void ext4_superblock_set_def_resgid(ext4_superblock_t *sb, uint16_t gid)
-{
-	sb->def_resgid = host2uint16_t_le(gid);
-}
-
-/** Get index of the first i-node, which can be used for allocation.
- *
- * @param sb Superblock
- *
- * @return I-node index
- *
- */
-uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_rev_level(sb) == 0)
-		return EXT4_REV0_FIRST_INO;
-
-	return uint32_t_le2host(sb->first_inode);
-}
-
-/** Set index of the first i-node, which can be used for allocation.
- *
- * @param sb          Superblock
- * @param first_inode I-node index
- *
- */
-void ext4_superblock_set_first_inode(ext4_superblock_t *sb,
-    uint32_t first_inode)
-{
-	sb->first_inode = host2uint32_t_le(first_inode);
-}
-
-/** Get size of i-node structure.
- *
- * For the oldest revision return constant number.
- *
- * @param sb Superblock
- *
- * @return Size of i-node structure
- *
- */
-uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_rev_level(sb) == 0)
-		return EXT4_REV0_INODE_SIZE;
-
-	return uint16_t_le2host(sb->inode_size);
-}
-
-/** Set size of i-node structure.
- *
- * @param sb   Superblock
- * @param size Size of i-node structure
- *
- */
-void ext4_superblock_set_inode_size(ext4_superblock_t *sb, uint16_t size)
-{
-	sb->inode_size = host2uint16_t_le(size);
-}
-
-/** Get index of block group, where superblock copy is located.
- *
- * @param sb Superblock
- *
- * @return Block group index
- *
- */
-uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *sb)
-{
-	return uint16_t_le2host(sb->block_group_index);
-}
-
-/** Set index of block group, where superblock copy is located.
- *
- * @param sb   Superblock
- * @param bgid Block group index
- *
- */
-void ext4_superblock_set_block_group_index(ext4_superblock_t *sb, uint16_t bgid)
-{
-	sb->block_group_index = host2uint16_t_le(bgid);
-}
-
-/** Get compatible features supported by the filesystem.
- *
- * @param sb Superblock
- *
- * @return Compatible features bitmap
- *
- */
-uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->features_compatible);
-}
-
-/** Set compatible features supported by the filesystem.
- *
- * @param sb       Superblock
- * @param features Compatible features bitmap
- *
- */
-void ext4_superblock_set_features_compatible(ext4_superblock_t *sb,
-    uint32_t features)
-{
-	sb->features_compatible = host2uint32_t_le(features);
-}
-
-/** Get incompatible features supported by the filesystem.
- *
- * @param sb Superblock
- *
- * @return Incompatible features bitmap
- *
- */
-uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->features_incompatible);
-}
-
-/** Set incompatible features supported by the filesystem.
- *
- * @param sb       Superblock
- * @param features Incompatible features bitmap
- *
- */
-void ext4_superblock_set_features_incompatible(ext4_superblock_t *sb,
-    uint32_t features)
-{
-	sb->features_incompatible = host2uint32_t_le(features);
-}
-
-/** Get compatible features supported by the filesystem.
- *
- * @param sb Superblock
- *
- * @return Read-only compatible features bitmap
- *
- */
-uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->features_read_only);
-}
-
-/** Set compatible features supported by the filesystem.
- *
- * @param sb      Superblock
- * @param feature Read-only compatible features bitmap
- *
- */
-void ext4_superblock_set_features_read_only(ext4_superblock_t *sb,
-    uint32_t features)
-{
-	sb->features_read_only = host2uint32_t_le(features);
-}
-
-/** Get UUID of the filesystem.
- *
- * @param sb superblock
- *
- * @return Pointer to UUID array
- *
- */
-void ext4_superblock_get_uuid(ext4_superblock_t *sb, uuid_t *uuid)
-{
-	uuid_decode(sb->uuid, uuid);
-}
-
-/** Set UUID of the filesystem.
- *
- * @param sb   Superblock
- * @param uuid Pointer to UUID
- *
- */
-void ext4_superblock_set_uuid(ext4_superblock_t *sb, uuid_t *uuid)
-{
-	uuid_encode(uuid, sb->uuid);
-}
-
-/** Get name of the filesystem volume.
- *
- * @param sb Superblock
- *
- * @return Name of the volume
- *
- */
-errno_t ext4_superblock_get_volume_name(ext4_superblock_t *sb, char *buf,
-    size_t bufsz)
-{
-	size_t i;
-	size_t wi;
-	char32_t ch;
-	errno_t rc;
-
-	i = 0;
-	wi = 0;
-	while (sb->volume_name[i] != '\0' && i < sizeof(sb->volume_name)) {
-		/* ISO 8859-1 codes map to identical Unicode code points */
-		ch = (char32_t)(uint8_t)sb->volume_name[i];
-		rc = chr_encode(ch, buf, &wi, bufsz - 1);
-		if (rc != EOK)
-			return rc;
-
-		i++;
-	}
-
-	buf[wi] = '\0';
-	return EOK;
-}
-
-/** Set name of the filesystem volume.
- *
- * @param sb   Superblock
- * @param name New name of the volume
- * @return EOK on success or error code
- */
-errno_t ext4_superblock_set_volume_name(ext4_superblock_t *sb, const char *name)
-{
-	size_t off;
-	char32_t ch;
-	size_t wi;
-
-	off = 0;
-	wi = 0;
-	while (wi < sizeof(sb->volume_name)) {
-		ch = str_decode(name, &off, STR_NO_LIMIT);
-		if (ch == 0)
-			break;
-		if (ch > 255)
-			return EINVAL;
-
-		sb->volume_name[wi++] = ch;
-	}
-
-	while (wi < sizeof(sb->volume_name))
-		sb->volume_name[wi++] = '\0';
-
-	return EOK;
-}
-
-/** Get name of the directory, where this filesystem was mounted at last.
- *
- * @param sb Superblock
- *
- * @return Directory name
- *
- */
-const char *ext4_superblock_get_last_mounted(ext4_superblock_t *sb)
-{
-	return sb->last_mounted;
-}
-
-/** Set name of the directory, where this filesystem was mounted at last.
- *
- * @param sb   Superblock
- * @param last Directory name
- *
- */
-void ext4_superblock_set_last_mounted(ext4_superblock_t *sb, const char *last)
-{
-	memcpy(sb->last_mounted, last, sizeof(sb->last_mounted));
-}
-
-/** Get last orphaned i-node index.
- *
- * Orphans are stored in linked list.
- *
- * @param sb Superblock
- *
- * @return Last orphaned i-node index
- *
- */
-uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->last_orphan);
-}
-
-/** Set last orphaned i-node index.
- *
- * Orphans are stored in linked list.
- *
- * @param sb          Superblock
- * @param last_orphan Last orphaned i-node index
- *
- */
-void ext4_superblock_set_last_orphan(ext4_superblock_t *sb,
-    uint32_t last_orphan)
-{
-	sb->last_orphan = host2uint32_t_le(last_orphan);
-}
-
-/** Get hash seed for directory index hash function.
- *
- * @param sb Superblock
- *
- * @return Hash seed pointer
- *
- */
-const uint32_t *ext4_superblock_get_hash_seed(ext4_superblock_t *sb)
-{
-	return sb->hash_seed;
-}
-
-/** Set hash seed for directory index hash function.
- *
- * @param sb   Superblock
- * @param seed Hash seed pointer
- *
- */
-void ext4_superblock_set_hash_seed(ext4_superblock_t *sb, const uint32_t *seed)
-{
-	memcpy(sb->hash_seed, seed, sizeof(sb->hash_seed));
-}
-
-/** Get default version of the hash algorithm version for directory index.
- *
- * @param sb Superblock
- *
- * @return Default hash version
- *
- */
-uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *sb)
-{
-	return sb->default_hash_version;
-}
-
-/** Set default version of the hash algorithm version for directory index.
- *
- * @param sb      Superblock
- * @param version Default hash version
- *
- */
-void ext4_superblock_set_default_hash_version(ext4_superblock_t *sb,
-    uint8_t version)
-{
-	sb->default_hash_version = version;
-}
-
-/** Get size of block group descriptor structure.
- *
- * Output value is checked for minimal size.
- *
- * @param sb Superblock
- *
- * @return Size of block group descriptor
- *
- */
-uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *sb)
-{
-	uint16_t size = uint16_t_le2host(sb->desc_size);
-
-	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		size = EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE;
-
-	return size;
-}
-
-/** Set size of block group descriptor structure.
- *
- * Input value is checked for minimal size.
- *
- * @param sb   Superblock
- * @param size Size of block group descriptor
- *
- */
-void ext4_superblock_set_desc_size(ext4_superblock_t *sb, uint16_t size)
-{
-	if (size < EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		sb->desc_size =
-		    host2uint16_t_le(EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE);
-
-	sb->desc_size = host2uint16_t_le(size);
-}
-
-/** Get superblock flags.
- *
- * @param sb Superblock
- *
- * @return Flags from the superblock
- *
- */
-uint32_t ext4_superblock_get_flags(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->flags);
-}
-
-/** Set superblock flags.
- *
- * @param sb    Superblock
- * @param flags Flags for the superblock
- *
- */
-void ext4_superblock_set_flags(ext4_superblock_t *sb, uint32_t flags)
-{
-	sb->flags = host2uint32_t_le(flags);
-}
-
-/*
- * More complex superblock operations
- */
-
-/** Check if superblock has specified flag.
- *
- * @param sb   Superblock
- * @param flag Flag to be checked
- *
- * @return True, if superblock has the flag
- *
- */
-bool ext4_superblock_has_flag(ext4_superblock_t *sb, uint32_t flag)
-{
-	if (ext4_superblock_get_flags(sb) & flag)
-		return true;
-
-	return false;
-}
-
-/** Check if filesystem supports compatible feature.
- *
- * @param sb      Superblock
- * @param feature Feature to be checked
- *
- * @return True, if filesystem supports the feature
- *
- */
-bool ext4_superblock_has_feature_compatible(ext4_superblock_t *sb,
-    uint32_t feature)
-{
-	if (ext4_superblock_get_features_compatible(sb) & feature)
-		return true;
-
-	return false;
-}
-
-/** Check if filesystem supports incompatible feature.
- *
- * @param sb      Superblock
- * @param feature Feature to be checked
- *
- * @return True, if filesystem supports the feature
- *
- */
-bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *sb,
-    uint32_t feature)
-{
-	if (ext4_superblock_get_features_incompatible(sb) & feature)
-		return true;
-
-	return false;
-}
-
-/** Check if filesystem supports read-only compatible feature.
- *
- * @param sb      Superblock
- * @param feature Feature to be checked
- *
- * @return True, if filesystem supports the feature
- *
- */
-bool ext4_superblock_has_feature_read_only(ext4_superblock_t *sb,
-    uint32_t feature)
-{
-	if (ext4_superblock_get_features_read_only(sb) & feature)
-		return true;
-
-	return false;
-}
-
-/** Read superblock directly from block device.
- *
- * @param service_id Block device identifier
- * @param sb         Output pointer to memory structure
- *
- * @return Eerror code.
- *
- */
-errno_t ext4_superblock_read_direct(service_id_t service_id, ext4_superblock_t **sb)
-{
-	/* Allocated memory for superblock structure */
-	void *data = malloc(EXT4_SUPERBLOCK_SIZE);
-	if (data == NULL)
-		return ENOMEM;
-
-	/* Read data from block device */
-	errno_t rc = block_read_bytes_direct(service_id, EXT4_SUPERBLOCK_OFFSET,
-	    EXT4_SUPERBLOCK_SIZE, data);
-
-	if (rc != EOK) {
-		free(data);
-		return rc;
-	}
-
-	/* Set output value */
-	(*sb) = data;
-
-	return EOK;
-}
-
-/** Write superblock structure directly to block device.
- *
- * @param service_id Block device identifier
- * @param sb         Superblock to be written
- *
- * @return Error code
- *
- */
-errno_t ext4_superblock_write_direct(service_id_t service_id, ext4_superblock_t *sb)
-{
-	/* Load physical block size from block device */
-	size_t phys_block_size;
-	errno_t rc = block_get_bsize(service_id, &phys_block_size);
-	if (rc != EOK)
-		return rc;
-
-	/* Compute address of the first block */
-	uint64_t first_block = EXT4_SUPERBLOCK_OFFSET / phys_block_size;
-
-	if (phys_block_size <= EXT4_SUPERBLOCK_SIZE) {
-		/* Superblock is a multiple of physical block sizes */
-		size_t block_count = EXT4_SUPERBLOCK_SIZE / phys_block_size;
-		return block_write_direct(service_id, first_block, block_count, sb);
-	}
-
-	/*
-	 * Superblock fills only a part of the physical block,
-	 * but we can only overwrite an entire physical block.
-	 */
-	void *tmp_sb = malloc(phys_block_size);
-	if (tmp_sb == NULL)
-		return ENOMEM;
-
-	/* Preserve physical block data */
-	rc = block_read_direct(service_id, first_block, 1, tmp_sb);
-	if (rc == EOK) {
-		/* Write the superblock */
-		void *sb_pos = tmp_sb + EXT4_SUPERBLOCK_OFFSET % phys_block_size;
-		memcpy(sb_pos, sb, EXT4_SUPERBLOCK_SIZE);
-
-		/* Write physical block to device */
-		rc = block_write_direct(service_id, first_block, 1, tmp_sb);
-	}
-
-	free(tmp_sb);
-	return rc;
-}
-
-/** Release the memory allocated for the superblock structure
- *
- * @param sb         Superblock to be freed
- *
- */
-void ext4_superblock_release(ext4_superblock_t *sb)
-{
-	free(sb);
-}
-
-/** Check sanity of the superblock.
- *
- * This check is performed at mount time.
- * Checks are described by one-line comments in the code.
- *
- * @param sb Superblock to check
- *
- * @return Error code
- *
- */
-errno_t ext4_superblock_check_sanity(ext4_superblock_t *sb)
-{
-	if (ext4_superblock_get_magic(sb) != EXT4_SUPERBLOCK_MAGIC)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_inodes_count(sb) == 0)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_blocks_count(sb) == 0)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_blocks_per_group(sb) == 0)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_inodes_per_group(sb) == 0)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_inode_size(sb) < 128)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_first_inode(sb) < 11)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_desc_size(sb) <
-	    EXT4_MIN_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ENOTSUP;
-
-	if (ext4_superblock_get_desc_size(sb) >
-	    EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE)
-		return ENOTSUP;
-
-	return EOK;
-}
-
-/** Compute number of block groups in the filesystem.
- *
- * @param sb Superblock
- *
- * @return Number of block groups
- *
- */
-uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *sb)
-{
-	uint64_t blocks_count = ext4_superblock_get_blocks_count(sb) - 1;
-	uint32_t blocks_per_group = ext4_superblock_get_blocks_per_group(sb);
-
-	uint32_t block_groups_count = blocks_count / blocks_per_group;
-
-	if (blocks_count % blocks_per_group)
-		block_groups_count++;
-
-	return block_groups_count;
-}
-
-/** Compute number of blocks in specified block group.
- *
- * @param sb   Superblock
- * @param bgid Block group index
- *
- * @return Number of blocks
- *
- */
-uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *sb, uint32_t bgid)
-{
-	uint32_t block_group_count =
-	    ext4_superblock_get_block_group_count(sb);
-	uint32_t blocks_per_group =
-	    ext4_superblock_get_blocks_per_group(sb);
-	uint64_t total_blocks =
-	    ext4_superblock_get_blocks_count(sb);
-	uint32_t first_block =
-	    ext4_superblock_get_first_data_block(sb);
-
-	if (bgid < block_group_count - 1)
-		return blocks_per_group;
-	else
-		return (total_blocks - ((block_group_count - 1) * blocks_per_group)) - first_block;
-}
-
-/** Compute number of i-nodes in specified block group.
- *
- * @param sb   Superblock
- * @param bgid Block group index
- *
- * @return Number of i-nodes
- *
- */
-uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *sb, uint32_t bgid)
-{
-	uint32_t block_group_count =
-	    ext4_superblock_get_block_group_count(sb);
-	uint32_t inodes_per_group =
-	    ext4_superblock_get_inodes_per_group(sb);
-	uint32_t total_inodes =
-	    ext4_superblock_get_inodes_count(sb);
-
-	if (bgid < block_group_count - 1)
-		return inodes_per_group;
-	else
-		return (total_inodes - ((block_group_count - 1) * inodes_per_group));
-}
-
-/** Get the backup groups used with SPARSE_SUPER2
- *
- * @param sb    Pointer to the superblock
- * @param g1    Output pointer to the first backup group
- * @param g2    Output pointer to the second backup group
- */
-void ext4_superblock_get_backup_groups_sparse2(ext4_superblock_t *sb,
-    uint32_t *g1, uint32_t *g2)
-{
-	*g1 = uint32_t_le2host(sb->backup_bgs[0]);
-	*g2 = uint32_t_le2host(sb->backup_bgs[1]);
-}
-
-/** Set the backup groups (SPARSE SUPER2)
- *
- * @param sb    Pointer to the superblock
- * @param g1    Index of the first group
- * @param g2    Index of the second group
- */
-void ext4_superblock_set_backup_groups_sparse2(ext4_superblock_t *sb,
-    uint32_t g1, uint32_t g2)
-{
-	sb->backup_bgs[0] = host2uint32_t_le(g1);
-	sb->backup_bgs[1] = host2uint32_t_le(g2);
-}
-
-/** Get the number of blocks (per group) reserved to GDT expansion
- *
- * @param sb    Pointer to the superblock
- *
- * @return      Number of blocks
- */
-uint32_t ext4_superblock_get_reserved_gdt_blocks(ext4_superblock_t *sb)
-{
-	return uint32_t_le2host(sb->reserved_gdt_blocks);
-}
-
-/** Set the number of blocks (per group) reserved to GDT expansion
- *
- * @param sb    Pointer to the superblock
- * @param n     Number of reserved blocks
- */
-void ext4_superblock_set_reserved_gdt_blocks(ext4_superblock_t *sb,
-    uint32_t n)
-{
-	sb->reserved_gdt_blocks = host2uint32_t_le(n);
-}
-
-/** Get the size of the flex groups
- *
- * @param sb	Pointer to the superblock
- *
- * @return	Size of the flex groups
- */
-uint32_t ext4_superblock_get_flex_group_size(ext4_superblock_t *sb)
-{
-	return 2 << sb->log_groups_per_flex;
-}
-
-/* Check if n is a power of p */
-static bool is_power_of(uint32_t n, unsigned p)
-{
-	if (p == 1 && n != p)
-		return false;
-
-	while (n != p) {
-		if (n < p)
-			return false;
-		else if ((n % p) != 0)
-			return false;
-
-		n /= p;
-	}
-
-	return true;
-}
-
-/** Get the number of blocks used by superblock + gdt + reserved gdt backups
- *
- * @param sb    Superblock
- * @param idx   Block group index
- *
- * @return      Number of blocks
- */
-uint32_t ext4_superblock_get_group_backup_blocks(ext4_superblock_t *sb,
-    uint32_t idx)
-{
-	uint32_t r = 0;
-	bool has_backups = false;
-
-	/* First step: determine if the block group contains the backups */
-
-	if (idx <= 1)
-		has_backups = true;
-	else {
-		if (ext4_superblock_has_feature_compatible(sb,
-		    EXT4_FEATURE_COMPAT_SPARSE_SUPER2)) {
-			uint32_t g1, g2;
-
-			ext4_superblock_get_backup_groups_sparse2(sb,
-			    &g1, &g2);
-
-			if (idx == g1 || idx == g2)
-				has_backups = true;
-		} else if (!ext4_superblock_has_feature_read_only(sb,
-		    EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
-			/*
-			 * Very old fs were all block groups have
-			 * superblock and block descriptors backups.
-			 */
-			has_backups = true;
-		} else {
-			if ((idx & 1) && (is_power_of(idx, 3) ||
-			    is_power_of(idx, 5) || is_power_of(idx, 7)))
-				has_backups = true;
-		}
-	}
-
-	if (has_backups) {
-		uint32_t bg_count;
-		uint32_t bg_desc_sz;
-		uint32_t gdt_table; /* Size of the GDT in blocks */
-		uint32_t block_size = ext4_superblock_get_block_size(sb);
-
-		/*
-		 * Now we know that this block group has backups,
-		 * we have to compute how many blocks are reserved
-		 * for them
-		 */
-
-		/* This accounts for the superblock */
-		r++;
-
-		/* Add the number of blocks used for the GDT */
-		bg_count = ext4_superblock_get_block_group_count(sb);
-		bg_desc_sz = ext4_superblock_get_desc_size(sb);
-		gdt_table = ROUND_UP(bg_count * bg_desc_sz, block_size) /
-		    block_size;
-
-		r += gdt_table;
-
-		/* And now the number of reserved GDT blocks */
-		r += ext4_superblock_get_reserved_gdt_blocks(sb);
-	}
-
-	return r;
-}
-
-/** Create superblock for new file system.
- *
- * @param dev_bsize Device block size
- * @param dev_bcnt Device number of blocks
- * @param cfg Configuration of new file system
- * @param rsb Place to store pointer to newly allocated superblock
- * @return EOK on success or error code
- */
-errno_t ext4_superblock_create(size_t dev_bsize, uint64_t dev_bcnt,
-    ext4_cfg_t *cfg, ext4_superblock_t **rsb)
-{
-	ext4_superblock_t *sb;
-	uuid_t uuid;
-	uint32_t cur_ts;
-	uint64_t first_block = 0;
-	uint64_t fs_blocks;
-	uint32_t blocks_count;
-	uint32_t free_blocks;
-	uint32_t inodes_count;
-	uint64_t blocks_group;
-	uint64_t inodes_group;
-	uint32_t inodes_block;
-	uint32_t inode_table_blocks;
-	uint32_t res_blocks;
-	uint32_t ngroups;
-	uint32_t idx;
-	size_t fs_bsize;
-	size_t fs_bsize_log;
-	errno_t rc;
-	struct timespec ts;
-
-	sb = calloc(1, sizeof(ext4_superblock_t));
-	if (sb == NULL)
-		return ENOMEM;
-
-	rc = uuid_generate(&uuid);
-	if (rc != EOK)
-		goto error;
-
-	/* Current UNIX time */
-	getrealtime(&ts); // XXX ISO C does not say what the epoch is
-	cur_ts = ts.tv_sec;
-
-	fs_bsize = cfg->bsize;
-	switch (fs_bsize) {
-	case 1024:
-		first_block = 1;
-		fs_bsize_log = 0;
-		blocks_group = 8192;
-		break;
-	case 2048:
-		fs_bsize_log = 1;
-		blocks_group = 8192 * 2;
-		break;
-	case 4096:
-		fs_bsize_log = 2;
-		blocks_group = 8192 * 4;
-		break;
-	default:
-		return ENOTSUP;
-	}
-
-	if (fs_bsize % dev_bsize == 0) {
-		/* Small device blocks */
-		fs_blocks = dev_bcnt / (fs_bsize / dev_bsize);
-	} else {
-		/* Large device blocks */
-		fs_blocks = dev_bcnt * (dev_bsize / fs_bsize);
-	}
-
-	/* Inodes per group */
-	inodes_block = fs_bsize / EXT4_REV0_INODE_SIZE;
-	inodes_group = min((fs_blocks - first_block) / 8,
-	    blocks_group / 4);
-	if (inodes_group < 16)
-		inodes_group = 16;
-
-	/* Align up to multiple of inodes_block */
-	if (inodes_group % inodes_block != 0)
-		inodes_group += inodes_block - inodes_group % inodes_block;
-	inode_table_blocks = inodes_group / inodes_block;
-
-	/* Number of groups */
-	ngroups = ((fs_blocks - first_block) + blocks_group - 1) / blocks_group;
-
-	/* Count of all blocks in groups */
-	blocks_count = fs_blocks - first_block;
-
-	/* Count of all inodes */
-	inodes_count = ngroups * inodes_group;
-
-	/* Count of blocks reserved for superuser */
-	res_blocks = (blocks_count + 19) / 20;
-
-	free_blocks = blocks_count;
-
-	ext4_superblock_set_magic(sb, EXT4_SUPERBLOCK_MAGIC);
-	ext4_superblock_set_inodes_count(sb, inodes_count);
-	/* This seems to include the boot block, despite the ext2fs docs */
-	ext4_superblock_set_blocks_count(sb, fs_blocks);
-	ext4_superblock_set_reserved_blocks_count(sb, res_blocks);
-	ext4_superblock_set_free_blocks_count(sb, free_blocks);
-	ext4_superblock_set_free_inodes_count(sb, inodes_count);
-	ext4_superblock_set_first_data_block(sb, first_block);
-	ext4_superblock_set_log_block_size(sb, fs_bsize_log);
-	/* Fragment size should be equal to block size */
-	ext4_superblock_set_log_frag_size(sb, fs_bsize_log);
-	ext4_superblock_set_blocks_per_group(sb, blocks_group);
-	/* Should be the same as blocks per group. */
-	ext4_superblock_set_frags_per_group(sb, blocks_group);
-	ext4_superblock_set_inodes_per_group(sb, inodes_group);
-	ext4_superblock_set_mount_time(sb, 0);
-	ext4_superblock_set_write_time(sb, cur_ts);
-	ext4_superblock_set_mount_count(sb, 0);
-	ext4_superblock_set_max_mount_count(sb, (uint16_t)-1);
-	ext4_superblock_set_state(sb, EXT4_SUPERBLOCK_STATE_VALID_FS);
-	ext4_superblock_set_errors(sb, EXT4_SUPERBLOCK_ERRORS_CONTINUE);
-	ext4_superblock_set_minor_rev_level(sb, 0); // XXX
-	ext4_superblock_set_last_check_time(sb, cur_ts);
-	ext4_superblock_set_check_interval(sb, 0);
-	ext4_superblock_set_creator_os(sb, EXT4_SUPERBLOCK_OS_LINUX);
-	if (cfg->version >= extver_ext2)
-		ext4_superblock_set_rev_level(sb, EXT4_DYNAMIC_REV);
-	else
-		ext4_superblock_set_rev_level(sb, EXT4_GOOD_OLD_REV);
-	ext4_superblock_set_def_resuid(sb, 0);
-	ext4_superblock_set_def_resgid(sb, 0);
-
-	if (cfg->version >= extver_ext2) {
-		/* Dynamic rev */
-		ext4_superblock_set_first_inode(sb, EXT4_REV0_FIRST_INO);
-		ext4_superblock_set_inode_size(sb, EXT4_REV0_INODE_SIZE);
-		ext4_superblock_set_block_group_index(sb, 0); // XXX
-		ext4_superblock_set_features_compatible(sb, 0);
-		ext4_superblock_set_features_incompatible(sb, 0);
-		ext4_superblock_set_features_read_only(sb, 0);
-
-		ext4_superblock_set_uuid(sb, &uuid);
-
-		rc = ext4_superblock_set_volume_name(sb, cfg->volume_name);
-		if (rc != EOK)
-			goto error;
-
-		/* 64-byte Latin-1 string padded with null characters */
-		ext4_superblock_set_last_mounted(sb,
-		    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-		    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
-		sb->algorithm_usage_bitmap = 0;
-	}
-#if 0
-	/* Journalling */
-	ext4_superblock_set_desc_size(sb, EXT4_MAX_BLOCK_GROUP_DESCRIPTOR_SIZE);
-#endif
-
-	/* Compute free blocks */
-	free_blocks = blocks_count;
-	for (idx = 0; idx < ngroups; idx++) {
-		free_blocks -= ext4_superblock_get_group_backup_blocks(sb, idx);
-		/* One for block bitmap, one for inode bitamp */
-		free_blocks -= 2;
-		free_blocks -= inode_table_blocks;
-	}
-
-	ext4_superblock_set_free_blocks_count(sb, free_blocks);
-
-	*rsb = sb;
-	return EOK;
-error:
-	free(sb);
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/lib/fbfont/doc/doxygroups.h
===================================================================
--- uspace/lib/fbfont/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libfbfont libfbfont
- * @ingroup libs
- */
Index: pace/lib/fbfont/include/fbfont/font-8x16.h
===================================================================
--- uspace/lib/fbfont/include/fbfont/font-8x16.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2005 Martin Decky
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-/** @file
- */
-
-#ifndef FONT_8X16_H_
-#define FONT_8X16_H_
-
-#include <stdint.h>
-#include <str.h>
-
-#define FONT_GLYPHS     2899
-#define FONT_WIDTH      8
-#define FONT_SCANLINES  16
-#define FONT_ASCENDER   12
-
-extern uint16_t fb_font_glyph(const char32_t, bool *);
-extern uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES];
-
-#endif
-
-/** @}
- */
Index: pace/lib/fbfont/meson.build
===================================================================
--- uspace/lib/fbfont/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/font-8x16.c',
-)
Index: pace/lib/fbfont/src/font-8x16.c
===================================================================
--- uspace/lib/fbfont/src/font-8x16.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3281 +1,0 @@
-/*
- * Copyright (c) 2000 Dmitry Bolkhovityanov
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfbfont
- * @{
- */
-/** @file
- */
-
-#include <stdint.h>
-#include <str.h>
-#include "../include/fbfont/font-8x16.h"
-
-/** Convert character to font glyph index
- *
- * The font does not cover all Unicode characters.
- * This function converts the character to an appropriate
- * glyph in the font or returns an index to the question
- * mark glyph if no specific glyph exists.
- *
- * If found is not null, indicate whether the glyph was found or not.
- *
- */
-uint16_t fb_font_glyph(const char32_t ch, bool *found)
-{
-	if (found)
-		*found = true;
-
-	if (ch == 0x0000)
-		return 0;
-
-	if ((ch >= 0x0020) && (ch <= 0x007f))
-		return (ch - 32);
-
-	if ((ch >= 0x00a0) && (ch <= 0x021f))
-		return (ch - 64);
-
-	if ((ch >= 0x0222) && (ch <= 0x0233))
-		return (ch - 66);
-
-	if ((ch >= 0x0250) && (ch <= 0x02ad))
-		return (ch - 94);
-
-	if ((ch >= 0x02b0) && (ch <= 0x02cf))
-		return (ch - 96);
-
-	if ((ch >= 0x02d8) && (ch <= 0x02dd))
-		return (ch - 104);
-
-	if (ch == 0x02ee)
-		return 630;
-
-	if ((ch >= 0x0300) && (ch <= 0x0301))
-		return (ch - 137);
-
-	if (ch == 0x0303)
-		return 633;
-
-	if (ch == 0x0309)
-		return 634;
-
-	if ((ch >= 0x0312) && (ch <= 0x0314))
-		return (ch - 151);
-
-	if (ch == 0x0323)
-		return 638;
-
-	if ((ch >= 0x0340) && (ch <= 0x0341))
-		return (ch - 193);
-
-	if ((ch >= 0x0374) && (ch <= 0x0375))
-		return (ch - 243);
-
-	if (ch == 0x037a)
-		return 643;
-
-	if (ch == 0x037e)
-		return 644;
-
-	if ((ch >= 0x0384) && (ch <= 0x038a))
-		return (ch - 255);
-
-	if (ch == 0x038c)
-		return 652;
-
-	if ((ch >= 0x038e) && (ch <= 0x03a1))
-		return (ch - 257);
-
-	if ((ch >= 0x03a3) && (ch <= 0x03ce))
-		return (ch - 258);
-
-	if ((ch >= 0x03d0) && (ch <= 0x03d7))
-		return (ch - 259);
-
-	if ((ch >= 0x03da) && (ch <= 0x03f3))
-		return (ch - 261);
-
-	if ((ch >= 0x0400) && (ch <= 0x0486))
-		return (ch - 273);
-
-	if ((ch >= 0x0488) && (ch <= 0x04ce))
-		return (ch - 274);
-
-	if ((ch >= 0x04d0) && (ch <= 0x04f5))
-		return (ch - 275);
-
-	if ((ch >= 0x04f8) && (ch <= 0x04f9))
-		return (ch - 277);
-
-	if ((ch >= 0x0500) && (ch <= 0x050f))
-		return (ch - 283);
-
-	if ((ch >= 0x0530) && (ch <= 0x0556))
-		return (ch - 315);
-
-	if ((ch >= 0x0559) && (ch <= 0x055f))
-		return (ch - 317);
-
-	if ((ch >= 0x0561) && (ch <= 0x0587))
-		return (ch - 318);
-
-	if ((ch >= 0x0589) && (ch <= 0x058a))
-		return (ch - 319);
-
-	if ((ch >= 0x0591) && (ch <= 0x05a1))
-		return (ch - 325);
-
-	if ((ch >= 0x05a3) && (ch <= 0x05b9))
-		return (ch - 326);
-
-	if ((ch >= 0x05bb) && (ch <= 0x05c4))
-		return (ch - 327);
-
-	if ((ch >= 0x05d0) && (ch <= 0x05ea))
-		return (ch - 338);
-
-	if ((ch >= 0x05f0) && (ch <= 0x05f4))
-		return (ch - 343);
-
-	if (ch == 0x060c)
-		return 1182;
-
-	if (ch == 0x061b)
-		return 1183;
-
-	if (ch == 0x061f)
-		return 1184;
-
-	if ((ch >= 0x0621) && (ch <= 0x063a))
-		return (ch - 384);
-
-	if ((ch >= 0x0640) && (ch <= 0x0655))
-		return (ch - 389);
-
-	if ((ch >= 0x0660) && (ch <= 0x066d))
-		return (ch - 399);
-
-	if ((ch >= 0x0670) && (ch <= 0x06ed))
-		return (ch - 401);
-
-	if ((ch >= 0x06f0) && (ch <= 0x06fe))
-		return (ch - 403);
-
-	if (ch == 0x10d3)
-		return 1388;
-
-	if (ch == 0x10d7)
-		return 1389;
-
-	if (ch == 0x10da)
-		return 1390;
-
-	if (ch == 0x10dd)
-		return 1391;
-
-	if (ch == 0x10e6)
-		return 1392;
-
-	if ((ch >= 0x1e00) && (ch <= 0x1e9b))
-		return (ch - 6287);
-
-	if ((ch >= 0x1ea0) && (ch <= 0x1ef9))
-		return (ch - 6291);
-
-	if ((ch >= 0x1f00) && (ch <= 0x1f07))
-		return (ch - 6297);
-
-	if ((ch >= 0x2000) && (ch <= 0x2027))
-		return (ch - 6545);
-
-	if ((ch >= 0x2030) && (ch <= 0x2046))
-		return (ch - 6553);
-
-	if ((ch >= 0x2048) && (ch <= 0x204d))
-		return (ch - 6554);
-
-	if (ch == 0x2070)
-		return 1716;
-
-	if ((ch >= 0x2074) && (ch <= 0x208f))
-		return (ch - 6591);
-
-	if ((ch >= 0x20a0) && (ch <= 0x20af))
-		return (ch - 6607);
-
-	if ((ch >= 0x2100) && (ch <= 0x213a))
-		return (ch - 6687);
-
-	if ((ch >= 0x2153) && (ch <= 0x2183))
-		return (ch - 6711);
-
-	if ((ch >= 0x2190) && (ch <= 0x21f3))
-		return (ch - 6723);
-
-	if ((ch >= 0x2200) && (ch <= 0x22f1))
-		return (ch - 6735);
-
-	if (ch == 0x2300)
-		return 2211;
-
-	if (ch == 0x2302)
-		return 2212;
-
-	if ((ch >= 0x2308) && (ch <= 0x230b))
-		return (ch - 6755);
-
-	if (ch == 0x2310)
-		return 2217;
-
-	if (ch == 0x2318)
-		return 2218;
-
-	if ((ch >= 0x231a) && (ch <= 0x231b))
-		return (ch - 6767);
-
-	if ((ch >= 0x2320) && (ch <= 0x2321))
-		return (ch - 6771);
-
-	if ((ch >= 0x2329) && (ch <= 0x232a))
-		return (ch - 6778);
-
-	if ((ch >= 0x239b) && (ch <= 0x23bd))
-		return (ch - 6890);
-
-	if (ch == 0x23ce)
-		return 2260;
-
-	if ((ch >= 0x2409) && (ch <= 0x240d))
-		return (ch - 6964);
-
-	if ((ch >= 0x2423) && (ch <= 0x2424))
-		return (ch - 6985);
-
-	if (ch == 0x2426)
-		return 2268;
-
-	if ((ch >= 0x2500) && (ch <= 0x2595))
-		return (ch - 7203);
-
-	if ((ch >= 0x25a0) && (ch <= 0x25f7))
-		return (ch - 7213);
-
-	if ((ch >= 0x2600) && (ch <= 0x2602))
-		return (ch - 7221);
-
-	if ((ch >= 0x2605) && (ch <= 0x260d))
-		return (ch - 7223);
-
-	if ((ch >= 0x2610) && (ch <= 0x2613))
-		return (ch - 7225);
-
-	if (ch == 0x2620)
-		return 2523;
-
-	if (ch == 0x2622)
-		return 2524;
-
-	if (ch == 0x2626)
-		return 2525;
-
-	if ((ch >= 0x2628) && (ch <= 0x262b))
-		return (ch - 7242);
-
-	if ((ch >= 0x262e) && (ch <= 0x2637))
-		return (ch - 7244);
-
-	if ((ch >= 0x2639) && (ch <= 0x2653))
-		return (ch - 7245);
-
-	if ((ch >= 0x2660) && (ch <= 0x2667))
-		return (ch - 7257);
-
-	if ((ch >= 0x2669) && (ch <= 0x266f))
-		return (ch - 7258);
-
-	if ((ch >= 0xfb00) && (ch <= 0xfb05))
-		return (ch - 61674);
-
-	if ((ch >= 0xfb50) && (ch <= 0xfbb1))
-		return (ch - 61748);
-
-	if ((ch >= 0xfbd3) && (ch <= 0xfbe9))
-		return (ch - 61781);
-
-	if ((ch >= 0xfbfc) && (ch <= 0xfbff))
-		return (ch - 61799);
-
-	if ((ch >= 0xfc5b) && (ch <= 0xfc63))
-		return (ch - 61890);
-
-	if (ch == 0xfc90)
-		return 2722;
-
-	if ((ch >= 0xfcf2) && (ch <= 0xfcf4))
-		return (ch - 62031);
-
-	if ((ch >= 0xfd3c) && (ch <= 0xfd3f))
-		return (ch - 62102);
-
-	if (ch == 0xfdf2)
-		return 2730;
-
-	if ((ch >= 0xfe50) && (ch <= 0xfe52))
-		return (ch - 62373);
-
-	if ((ch >= 0xfe54) && (ch <= 0xfe66))
-		return (ch - 62374);
-
-	if ((ch >= 0xfe68) && (ch <= 0xfe6b))
-		return (ch - 62375);
-
-	if ((ch >= 0xfe70) && (ch <= 0xfe72))
-		return (ch - 62379);
-
-	if (ch == 0xfe74)
-		return 2760;
-
-	if ((ch >= 0xfe76) && (ch <= 0xfefc))
-		return (ch - 62381);
-
-	if (ch == 0xfeff)
-		return 2896;
-
-	if (found)
-		*found = false;
-
-	return 2898;
-}
-
-uint8_t fb_font[FONT_GLYPHS][FONT_SCANLINES] = {
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0xa1, 0xa1, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x44, 0xba, 0xb2, 0xaa, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x30, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf6, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x0c, 0x18, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x66, 0xce, 0x9e, 0x3e, 0x06, 0x06, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x3c, 0x42, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7a, 0xc4, 0xce, 0xce, 0xd6, 0xd6, 0xe6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x66, 0x66, 0x66, 0x66, 0xec, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0x1c, 0x3c, 0x06, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xc4, 0xce, 0xd6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x3e, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x10, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xff, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7e, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x3c, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x3c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf7, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7b, 0x7b, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0xee, 0x66, 0x66, 0x66, 0x66, 0x66, 0xf6, 0x06, 0x66, 0x3c, 0x00 },
-	{ 0x08, 0x1c, 0x22, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x0e, 0x1b, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x30, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x66, 0x66, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x36, 0x36, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x78, 0xe0, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x1e, 0x78, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x60, 0xc0, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6e, 0xd8, 0xd8, 0xd8, 0xde, 0xd8, 0xd8, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd6, 0xd6, 0xde, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x6c, 0x38, 0x10, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x10, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0xfc, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x78, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x78, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xb3, 0xb3, 0x33, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x64, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x62, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xe6, 0xe6, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xe0, 0xe0, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x06, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x3e, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x7e, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0xf6, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xb6, 0xb3, 0x33, 0x33, 0x33, 0x33, 0x33, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x4c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x4c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x18, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xcc, 0x8c, 0x2c, 0x3c, 0x2c, 0x0c, 0x8c, 0xcc, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc2, 0xc0, 0x78, 0xc0, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x32, 0x30, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, 0x00 },
-	{ 0x00, 0x03, 0x3e, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x38, 0x6c, 0x38, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x6d, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc8, 0x38, 0x70, 0xd0, 0x38, 0x38, 0x6c, 0x64, 0xc6, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0xec, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x73, 0xdf, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x03, 0x03, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xdf, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x03, 0x03, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xb3, 0xb3, 0x33, 0x3e, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x78, 0x6c, 0x6c, 0xe6, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x38, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x0c, 0x38, 0x60, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x62, 0x30, 0x18, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x0c, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xfe, 0x9a, 0x58, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00 },
-	{ 0x03, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0xb3, 0xb3, 0x33, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x7e, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0xfc, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x30, 0x7c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc0, 0x60, 0x30, 0x18, 0x7c, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0x60, 0x30, 0x78, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x7c, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x7e, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x60, 0x60, 0x78, 0x0c, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x60, 0x78, 0x0c, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x18, 0x4c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x70, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1b, 0x0e, 0x04, 0xf7, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf5, 0xda, 0xd8, 0xdf, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3d, 0x1a, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xcb, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf3, 0x63, 0x60, 0x67, 0x63, 0x63, 0x63, 0x67, 0x6f, 0xff, 0x03, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe3, 0x63, 0x60, 0x67, 0x63, 0x63, 0x63, 0x63, 0x63, 0xf3, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xfb, 0xfb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xf8, 0xff, 0xfb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xb7, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x78, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x28, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x78, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x10, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x30, 0x30, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xdf, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x3e, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xfe, 0x0c, 0x18, 0x30, 0x7c, 0x06, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x1b, 0x0e, 0x04, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xf7, 0xd9, 0xd9, 0xda, 0xda, 0xda, 0xda, 0xdc, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0xd8, 0xd8, 0xdf, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0xf7, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xdb, 0xfb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x70, 0x60, 0x60, 0x60, 0x60, 0xe0, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x38, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x38, 0x6c, 0x38, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7a, 0xc4, 0xce, 0xce, 0xd6, 0xe6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7a, 0xc4, 0xce, 0xd6, 0xe6, 0x46, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x3c, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x18, 0x18, 0x30 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x1c, 0x74, 0x06, 0x06, 0x06, 0x06, 0x1c, 0xf0, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0e, 0x3c, 0x06, 0x06, 0x1c, 0xf0, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc0, 0xfc, 0x06, 0x0c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc0, 0xfc, 0x06, 0x0c, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x7c, 0x00, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x00, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x3c, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x5c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xdc, 0xe6, 0x7c, 0x80, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0d, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x0d, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x6c, 0x8e, 0x16, 0x26, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xcd, 0x0d, 0x38, 0x0c, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xdc, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x06, 0x06, 0x1f, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x46, 0x6c, 0x2c, 0x2c, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x64, 0x28, 0x38, 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x6c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3c, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x7b, 0xde, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x78, 0x58, 0x3e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x7f, 0x63, 0x66, 0x6c, 0x7e, 0x63, 0xf3, 0x03, 0x33, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xd8, 0xd8, 0xde, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xdc, 0x6c, 0x0c, 0x0d, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xfc, 0xc0, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x19, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x98, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x19, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x98, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0xd8, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x3b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xd6, 0xd6, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x06, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x66, 0xcb, 0xfe, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x7e, 0xc7, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0x70, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc3, 0xc3, 0xdb, 0xdb, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x76, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x7e, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7e, 0xcc, 0x78, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xcc, 0x6c, 0x3c, 0x3c, 0x6c, 0xcc, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x0d, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x1c, 0x18, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc0, 0x70, 0x30, 0xfc, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xda, 0xdc, 0x6f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xdb, 0xdb, 0xde, 0xde, 0xdb, 0x6b, 0x03, 0x1b, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x7f, 0xd9, 0xda, 0xda, 0xdb, 0xdd, 0x6f, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x60, 0x60, 0xf6, 0x6d, 0x6c, 0x66, 0x63, 0x6b, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x26, 0x6d, 0x6c, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x3c, 0x0c, 0x2c, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x60, 0x60, 0xf6, 0x6d, 0x6c, 0x6c, 0x6e, 0x6d, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xc0, 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x03, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6d, 0x6c, 0x66, 0x63, 0x6b, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6f, 0x6b, 0x63, 0x66, 0x6c, 0x6d, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0x7c, 0x6c, 0x28, 0xc6, 0xd6, 0x7c, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xf0, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xf0, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xb0, 0xd8, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0xd8, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0xd8, 0x68, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xd8, 0xd8, 0xf0, 0xd8, 0xd8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xd6, 0x7c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0x78, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xc0, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x70, 0xc0, 0x70, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x70, 0x18, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x20, 0x70, 0x70, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xd8, 0xd8, 0x70, 0x70, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x6c, 0x6c, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x34, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 },
-	{ 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x34, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3e, 0x32, 0x30, 0x34, 0x3c, 0x34, 0x30, 0x30, 0x32, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x33, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x3e, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x36, 0x36, 0x77, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x82, 0x44, 0x7c, 0x44, 0x00, 0x82, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x62, 0x30, 0x18, 0x18, 0x30, 0x62, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x92, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x6c, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x6c, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x46, 0x6c, 0x2c, 0x2c, 0x38, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x30, 0x18, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x46, 0x7c, 0x18, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x20, 0x30, 0x10, 0x38, 0x38, 0x6c, 0x64, 0xc6, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf6, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x66, 0x6c, 0x3c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x3c, 0x30, 0x60, 0x3c, 0x60, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x46, 0x2c, 0x2c, 0x18, 0x30, 0x68, 0x68, 0xc4, 0xc2, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xcc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x6c, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x36, 0x1e, 0xc6, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc2, 0x65, 0x24, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0xc0, 0x21, 0x32, 0x12, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc2, 0x65, 0x24, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xa6, 0x2c, 0x38, 0x68, 0xca, 0xc4, 0x0c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x3c, 0x06, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x7c, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x32, 0x30, 0x30, 0x3c, 0x34, 0x30, 0x30, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x60, 0x30, 0x30, 0x60, 0x63, 0xff, 0xc6, 0x06, 0x0c, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x60, 0x60, 0xfe, 0xfe, 0x0c, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xac, 0x26, 0x26, 0x0b, 0x0b, 0x1b, 0x1b, 0x1b, 0x1b, 0x03, 0x02, 0x04, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x30, 0x18, 0x28, 0x4c, 0x14, 0x24, 0x06, 0x02, 0x02, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6d, 0x03, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6d, 0x03, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xd6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x36, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x76, 0x9c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x7c, 0xd6, 0x66, 0x06, 0x06, 0x66, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x06, 0x3c, 0x60, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x26, 0x1c, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0x68, 0x38, 0x30, 0x38, 0x38, 0x4c, 0x4c, 0x86, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0xba, 0x30, 0x38, 0x28, 0x4c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xc0, 0xcc, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xdc, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x7e, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x1c, 0x18, 0x7e, 0x58, 0x18, 0x18, 0x18, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xa6, 0x2c, 0x38, 0x68, 0xca, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0xc0, 0x60, 0x3c, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xb2, 0x30, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x03, 0x06, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xf8, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xd8, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xb2, 0x30, 0x3e, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x18, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x38, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0xc6, 0x82, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfe, 0x06, 0x02, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xff, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xb0, 0xb0, 0x30, 0x3c, 0x36, 0x36, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x3e, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x9c, 0xb6, 0xb6, 0xb6, 0xf6, 0xb6, 0xb6, 0xb6, 0xb6, 0x9c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0xcc, 0x7c, 0x6c, 0x6c, 0x6c, 0x6c, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x7c, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0xc6, 0x82, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfe, 0x06, 0x02, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xff, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xb0, 0x30, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xb6, 0xb6, 0xf6, 0xb6, 0xb6, 0x9c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xcc, 0xcc, 0x7c, 0x6c, 0x6c, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x06, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xf8, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf8, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x38, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0xfc, 0xb4, 0x30, 0x3c, 0x36, 0x36, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x30, 0xfc, 0xb4, 0x30, 0x3c, 0x36, 0x36, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xce, 0xdb, 0xd9, 0xd8, 0xfe, 0xd8, 0xd8, 0xd9, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xdb, 0xd8, 0xfe, 0xd8, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0x6c, 0xfe, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x6c, 0x7c, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x88, 0x8c, 0x9c, 0x96, 0xf6, 0xb6, 0xbf, 0xab, 0xeb, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x8c, 0x9c, 0xf6, 0xbe, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x6c, 0x6c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0x6c, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xa3, 0xb2, 0x96, 0xfc, 0x9c, 0xbe, 0xaa, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0xa3, 0x96, 0xfe, 0xab, 0xab, 0xeb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x10, 0x7c, 0xc6, 0x06, 0x06, 0x7c, 0x06, 0x06, 0x06, 0x7c, 0xc0, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x6c, 0x38, 0x10, 0x00, 0x7c, 0x86, 0x06, 0x7c, 0x06, 0x06, 0x7c, 0xc0, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x96, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x96, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc2, 0xc6, 0xc6, 0xc4, 0xcc, 0x6c, 0x68, 0x78, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x64, 0x6c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0x66, 0x00, 0xc2, 0xc6, 0xc4, 0xc4, 0x6c, 0x68, 0x78, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0x66, 0x00, 0xc2, 0xc6, 0x64, 0x6c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd8, 0xd8, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6f, 0x03, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x6f, 0x03, 0x06, 0x1c, 0x00 },
-	{ 0x00, 0x10, 0x7c, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x7c, 0x40, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x40, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x7c, 0x54, 0x00, 0x6c, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x54, 0x00, 0x6c, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x60, 0x3c, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0x78, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x3c, 0x0f, 0x18, 0x18, 0xf0, 0x3c, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x24, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x7c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x7c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0xc3, 0x00, 0x66, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x50, 0x46, 0x00, 0x82, 0x41, 0x00, 0x62, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xc6, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xf0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x6e, 0x64, 0x7a, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x6e, 0x64, 0x7a, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x02, 0x06, 0xfe, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x06, 0xfe, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0xf8, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0xf8, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xf6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x66, 0x62, 0x78, 0x6c, 0x66, 0xf6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x30, 0x60, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0xdc, 0xf8, 0xdc, 0xd6, 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xdc, 0xf8, 0xdc, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0xf6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0xf0, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf3, 0xb3, 0xb3, 0x36, 0x3c, 0x3c, 0x36, 0x33, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0xb6, 0xbc, 0x3c, 0x36, 0x33, 0x73, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdf, 0xdb, 0xd9, 0xd8, 0xf8, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, 0xdb, 0xd9, 0xf8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xd8, 0xd8, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x03, 0x0b, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xfe, 0xdb, 0xdb, 0xdb, 0x03, 0x0b, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc2, 0xcc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc2, 0xcc, 0xd6, 0xd6, 0xcc, 0x7a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0c, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x0c, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7f, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0x7e, 0x16, 0x16, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xd6, 0x7e, 0x16, 0x16, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0xb3, 0xb3, 0x7f, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0xb3, 0x7f, 0x30, 0x30, 0x33, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0xb3, 0xb3, 0x7f, 0x30, 0x30, 0x30, 0x33, 0x1e, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0xb3, 0x7f, 0x30, 0x30, 0x33, 0x1e, 0x0c, 0x18, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x06, 0x16, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0e, 0x0c, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x0e, 0x0c, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc7, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0xfe, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0x38, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xd6, 0xd6, 0xd6, 0x7c, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x0c, 0x18, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xce, 0xde, 0xfe, 0xf6, 0xe6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x3e, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x7c, 0xc6, 0x06, 0x3e, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc3, 0xc3, 0xc3, 0xf3, 0xdb, 0xdb, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x7c, 0xcd, 0xcd, 0xcd, 0xcd, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcd, 0xcd, 0xcd, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x8c, 0x0c, 0x38, 0x0d, 0x0d, 0x0d, 0x0d, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0x0c, 0x39, 0x0d, 0x0d, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0x86, 0x06, 0x3c, 0x06, 0x06, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x06, 0x3c, 0x06, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0x6d, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x6c, 0x6c, 0x6d, 0x6d, 0x6d, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0xcd, 0xcd, 0xcd, 0xcd, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xfd, 0xcd, 0xcd, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xce, 0xc6, 0xc6, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xce, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x1b, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x5a, 0x18, 0x1b, 0x1b, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x64, 0x94, 0xba, 0x52, 0x4c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x7b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x7e, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0xd8, 0xfe, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xcf, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xf6, 0xd6, 0xd6, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0x7f, 0x24, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0xf0, 0x3c, 0x0e, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x6c, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x30, 0x60, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcf, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x06, 0x06, 0x7c, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x60, 0x60, 0x60, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x06, 0x06, 0x6c, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x16, 0x16, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x76, 0x1e, 0x0e, 0x0c, 0xd8, 0xfe, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x30, 0x18, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x06, 0x06, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x63, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xfe, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd0, 0xd0, 0xd0, 0x7c, 0x16, 0x16, 0x16, 0xd6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x3c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x6a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x0c, 0x0c, 0x0c, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x0c, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x7e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc6, 0xc6, 0xcf, 0xd6, 0xd6, 0xcc, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xca, 0xc0, 0xc0, 0xc0, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x38, 0x0c, 0x7f, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x1c, 0x0c, 0x18, 0x3c, 0x64, 0x66, 0x62, 0x63, 0x3d, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x18, 0x30, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0f, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x7e, 0x06, 0x06, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x76, 0x1c, 0x18, 0x30, 0x60, 0x3e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcf, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x0f, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0xdc, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x76, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xfe, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xd0, 0xd0, 0x7c, 0x16, 0x16, 0x16, 0x16, 0xd6, 0x7c, 0x10, 0x10, 0x10, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xcc, 0xcc, 0xcc, 0x77, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x6c },
-	{ 0x18, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x38, 0x10, 0x38, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x60, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0c, 0x00 },
-	{ 0x10, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x74, 0xd6, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x18, 0x30, 0x00 },
-	{ 0x0c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1b, 0x36, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x44, 0xaa, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x0a, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x50, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x3c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x6c, 0xd8, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x08, 0x30 },
-	{ 0x60, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0xa0, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x38, 0x10, 0x10 },
-	{ 0x18, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x06, 0x03, 0x00 },
-	{ 0x48, 0xa8, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x33, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x00, 0x06, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x60, 0x66, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18 },
-	{ 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x18, 0x03, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x66, 0x76, 0xdc, 0xcc, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x36, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0xd6, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0xc6, 0xc6, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x66, 0x66, 0x66, 0x2c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x4c, 0xcc, 0xcc, 0xec, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0e, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x46, 0xc6, 0xc6, 0xe6, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x6c, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xee, 0x66, 0x66, 0x34, 0x18, 0x0c, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x66, 0x64, 0x6c, 0x6e, 0x60, 0x60, 0x60, 0x60, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xf6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe6, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0xc6, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x22, 0x20, 0x10, 0x08, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x3c, 0x40, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x20, 0x1c, 0x20, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x28, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x40, 0x30, 0x4e, 0x49, 0x39, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x24, 0x00 },
-	{ 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x12, 0xca, 0x2c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0a, 0x2a, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x7e, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x10, 0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x0c, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x70, 0x70, 0x38, 0x18, 0x18, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0xfc, 0xf8, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4a, 0xfe, 0xf4, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x20, 0x40, 0x30, 0x10, 0x20, 0x42, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x2c, 0x44, 0x42, 0x82, 0x82, 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xf8, 0x78, 0x08, 0x08, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x82, 0xc6, 0xc6, 0x6c, 0x28, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x28, 0x6c, 0xc6, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xf8, 0x88, 0xf8, 0x78, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x91, 0x92, 0x64, 0x08, 0x10, 0x26, 0x49, 0x89, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x18, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0xfe, 0x7c, 0x38, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x28, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x06, 0x28, 0x5e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x07, 0x08, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x04, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x54, 0x33, 0x24, 0x40, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x04, 0x03, 0x04, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00 },
-	{ 0x06, 0x08, 0x06, 0x08, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x08, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x94, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x88, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x94, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x08, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x08, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x1c, 0x6a, 0x04, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x14, 0x08, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x12, 0x04, 0x18, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x15, 0x88, 0x88, 0x8a, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x88, 0x90, 0x65, 0x00, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x00, 0x0a, 0x00, 0x01, 0x15, 0x88, 0x88, 0x90, 0x65, 0x00, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x90, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x2a, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x00, 0x50, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x20, 0x40, 0x3e, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x05, 0x0b, 0x48, 0x84, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x29, 0x01, 0x19, 0x21, 0x19, 0xa1, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x05, 0x0b, 0x48, 0x84, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x44, 0x09, 0xa2, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x08, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x02, 0x2a, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x14, 0x00, 0x08, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x08, 0x14, 0x08, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x40, 0x38, 0x40, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x40, 0x38, 0x40, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x12, 0x2c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x20, 0x47, 0x88, 0x08, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x50, 0x20, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x08, 0x00, 0x08 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x14, 0x00, 0x08 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x80, 0x60, 0x80, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x40, 0x43, 0x55, 0x7e, 0x80, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x2a, 0x20, 0x26, 0x2a, 0x7c, 0x80, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0e, 0x1c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x14, 0x08, 0x14, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x2c, 0x10, 0x28, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x15, 0x8a, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x5a, 0xa5, 0x66, 0x5b, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x5a, 0x66, 0xa5, 0x5a, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x66, 0x42, 0x42, 0x81, 0x99, 0x99, 0x81, 0x42, 0x42, 0x66, 0x18, 0x00, 0x00 },
-	{ 0x08, 0x1c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x26, 0x08, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x8a, 0x90, 0x60 },
-	{ 0x32, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x0c, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x40, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x30, 0x40, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x54, 0xaa, 0x92, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x82, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x14, 0x08 },
-	{ 0x08, 0x14, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x10, 0x10, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x70, 0x70, 0x38, 0x18, 0x18, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0xfc, 0xf8, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4a, 0xfe, 0xf4, 0x60, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4e, 0xf0, 0xfe, 0x7c, 0x30, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x38, 0x2c, 0x44, 0x42, 0x82, 0x92, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x60, 0x7e, 0x3c, 0x30, 0x60, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x82, 0xc6, 0xc6, 0x6c, 0x28, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x28, 0x6c, 0xc6, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xf8, 0x88, 0xf8, 0x78, 0x08, 0x0c, 0x0e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x88, 0x88, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x54, 0x54, 0x54, 0x54, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x4c, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0xaa, 0xaa, 0xaa, 0x82, 0x82, 0x40, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x82, 0x82, 0x44, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x92, 0x92, 0x82, 0x82, 0x40, 0x30, 0x4c, 0x02, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0x38 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x38, 0x6c, 0x38 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0c, 0xec, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x0c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x18, 0x0c, 0x38, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x38, 0x6c, 0x64, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x60, 0x30, 0xe0, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x30, 0x18, 0x70, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x6c, 0x38, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x0c, 0x18, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0c, 0xec, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x72, 0x9c, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0x7c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00 },
-	{ 0x18, 0x18, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x7c, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x60, 0x6c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0x70, 0x1c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x44, 0x38, 0x10, 0x7c, 0xc6, 0xc6, 0x70, 0x1c, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x44, 0x38, 0x10, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x16, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x7e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x08, 0x1c, 0x36, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x6c, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x6c, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x76, 0xdc, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x10, 0x38, 0x6c, 0x00 },
-	{ 0x0c, 0x18, 0x72, 0x9c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x76, 0xdc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x00, 0x7c, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xcc, 0xcc, 0x00, 0xfc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0xee, 0x6c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x30, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0xc6, 0x8c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x6c, 0x6c, 0x00, 0x10, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xd6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x6c, 0x38, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x18, 0x0c, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x30, 0x00, 0x38, 0x6c, 0x64, 0x60, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x16, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x16, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x68, 0x1c, 0x36, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x68, 0x1c, 0x36, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x28, 0x54, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x6c, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x0c, 0x18, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x18, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x30, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x08, 0x54, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x08, 0x54, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x72, 0x9c, 0x44, 0x38, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x72, 0x9c, 0x44, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x6c, 0x38, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x76, 0x88, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x26, 0x70, 0xd8, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc4, 0x6e, 0x11, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x64, 0x0e, 0x1b, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x62, 0x66, 0xfe, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x76, 0x88, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x26, 0x70, 0xd8, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc4, 0x6e, 0x11, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xc0, 0x64, 0x0e, 0x1b, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0x13, 0x3a, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x28, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x76, 0xdc, 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x38, 0x44, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x18, 0x33, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1b, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x33, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x1b, 0x33, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x1b, 0x33, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0xb3, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x68, 0xb3, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0x7a, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x18, 0x30, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x33, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1b, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x33, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x63, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x1b, 0x33, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0x1b, 0x33, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0xb3, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x68, 0xb3, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x03, 0x03, 0xce, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x30, 0x30, 0x00 },
-	{ 0x30, 0x18, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x18, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x0c, 0x18, 0xf6, 0x06, 0x00 },
-	{ 0x38, 0x0c, 0x18, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x38, 0x0c, 0x18, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x3a, 0x5c, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x76, 0xdc, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x30, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x6c, 0xc6, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xcc, 0x66, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x66, 0xcc, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc6, 0x6c, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x34, 0x58, 0x0c, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x34, 0x58, 0x30, 0x18, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xfe, 0x00, 0xa4, 0xaa, 0xea, 0xea, 0xa6, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xa4, 0xea, 0xaa, 0xaa, 0xa6, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x8a, 0xce, 0x8e, 0xea, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x8e, 0xca, 0x8a, 0xea, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xca, 0x2e, 0x4a, 0x2a, 0xca, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xaa, 0xae, 0xea, 0x2a, 0x2a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x6a, 0x8e, 0xca, 0xaa, 0x4a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x38, 0x20, 0x30, 0x20, 0x20, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x30, 0x28, 0x30, 0x20, 0x20, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x4a, 0x4e, 0x4a, 0x4a, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x28, 0x28, 0x38, 0x28, 0x28, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0x6c, 0x8a, 0x4c, 0x28, 0xc8, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0xa2, 0xa2, 0xe2, 0xea, 0xa4, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xea, 0x2a, 0x4e, 0x8e, 0xee, 0x00, 0x08, 0x08, 0x08, 0x28, 0x10, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0x80, 0x80, 0x80, 0xf0, 0x28, 0x30, 0x28, 0x0a, 0x0e, 0x0e, 0x0a, 0x00, 0xfe, 0x00 },
-	{ 0xfe, 0x00, 0xc0, 0xa0, 0xc0, 0xa0, 0x20, 0x20, 0x38, 0x0a, 0x0e, 0x0e, 0x0a, 0x00, 0xfe, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x9c, 0xd2, 0xbc, 0x92, 0x9c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xfe, 0x00 },
-	{ 0x00, 0x18, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x00, 0xcc, 0xcc, 0xcc, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x20, 0x30, 0x38, 0x3c, 0x38, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x6b, 0x6b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x92, 0x44, 0x28, 0x92, 0x28, 0x44, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xc3, 0xdb, 0x1b, 0x1e, 0x1c, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x7c, 0x00, 0x00 },
-	{ 0x7c, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x38, 0x6c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x28, 0x00, 0x00, 0x44, 0xee, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7b, 0xcf, 0xcf, 0x1b, 0x33, 0x33, 0x33, 0x00, 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xde, 0xf3, 0xf3, 0xc6, 0xcc, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x06, 0x06, 0x0c, 0x0c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xdb, 0xdb, 0xdb, 0xde, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3e, 0x72, 0xf2, 0xf2, 0xf2, 0x72, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x9c, 0x9e, 0x9e, 0x9e, 0x9c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x18, 0x38, 0x78, 0xd8, 0xfc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xf8, 0xc0, 0xf0, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x78, 0xc0, 0xf0, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xf8, 0xd8, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd8, 0xd8, 0x78, 0x18, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x60, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xb0, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x30, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0xd8, 0xfc, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xc0, 0xf0, 0x18, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xc0, 0xf0, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xd8, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xd8, 0x78, 0x18, 0xf0, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcf, 0xcc, 0xcc, 0x7f, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x04, 0x7c, 0xce, 0xc8, 0xc8, 0xd0, 0xd0, 0xd0, 0xe0, 0xe6, 0x7c, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xd6, 0xd8, 0xd8, 0xd8, 0xde, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xc0, 0xc0, 0xc0, 0xf0, 0xcd, 0xce, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x60, 0xf8, 0x60, 0xf8, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0xec, 0xd6, 0xde, 0xd6, 0xd6, 0xf6, 0xd6, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x66, 0x76, 0xff, 0x76, 0x6e, 0xff, 0x6e, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0xe0, 0xf3, 0xd6, 0xdb, 0xce, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x81, 0x81, 0x81, 0x5a, 0xff, 0x5a, 0xff, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf2, 0x8a, 0xaa, 0xaa, 0xaa, 0xaa, 0xa2, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x3e, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x7c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x60, 0xfc, 0x60, 0xf8, 0x60, 0x60, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x6c, 0x78, 0xfe, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x1e, 0x78, 0x1e, 0x78, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x7c, 0xb6, 0x36, 0x33, 0x33, 0x33, 0x63, 0x66, 0xf6, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd0, 0xd2, 0xd6, 0x7c, 0x18, 0x30, 0x6e, 0xd8, 0x98, 0x18, 0x0e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xd0, 0xd2, 0xd6, 0x7c, 0x18, 0x30, 0x6e, 0xd8, 0x8c, 0x06, 0x1c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x62, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0x62, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4e, 0xb9, 0x58, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x7c, 0xda, 0xd8, 0xd8, 0xda, 0x7c, 0x19, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x18, 0x30, 0x6e, 0xdb, 0x9b, 0x1b, 0x0e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x70, 0xc0, 0xc2, 0xc6, 0x7c, 0x18, 0x30, 0x7b, 0xdb, 0x9b, 0x1b, 0x0d, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc2, 0xc0, 0x78, 0xc0, 0xc0, 0xc2, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x26, 0x3e, 0x26, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0xb9, 0x58, 0x1a, 0x1e, 0x1a, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x66, 0x46, 0x87, 0x8c, 0x8c, 0x7c, 0x98, 0x98, 0x70, 0x00 },
-	{ 0x00, 0x00, 0x52, 0xb5, 0x15, 0x16, 0x2c, 0x34, 0x68, 0xa9, 0xaa, 0x4c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x48, 0xb0, 0x80, 0x48, 0x7c, 0x66, 0x26, 0x26, 0xa6, 0x46, 0x06, 0x34, 0x48, 0x00 },
-	{ 0x00, 0x00, 0xe2, 0xa2, 0xa2, 0xa2, 0xbe, 0xa2, 0xa2, 0xa2, 0xa2, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x36, 0x3b, 0x3b, 0x33, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x1e, 0x18, 0x76, 0x3b, 0x3b, 0x33, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x33, 0x4e, 0x06, 0x06, 0x0c, 0x0c, 0x1f, 0x6c, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x71, 0x8e, 0x04, 0x0c, 0x06, 0x03, 0x63, 0xc3, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x46, 0x49, 0x39, 0x1e, 0x18, 0x30, 0x70, 0xb1, 0xba, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x19, 0x31, 0x32, 0x64, 0x68, 0x70, 0xe1, 0x66, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xff, 0xd8, 0xde, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xde, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe2, 0xa2, 0xb2, 0xb2, 0xaa, 0xaa, 0xa6, 0xa6, 0xa2, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xcc, 0xcf, 0xed, 0xff, 0xfc, 0xdf, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0xb9, 0xa5, 0xa5, 0xb9, 0xa1, 0xa1, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x40, 0x8e, 0x93, 0xa3, 0x63, 0x4b, 0x6a, 0xa4, 0xb0, 0xb0, 0x60, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0xa2, 0xa2, 0xa2, 0xa2, 0xbc, 0xa0, 0xa0, 0xa0, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xa2, 0xaa, 0xa6, 0x7e, 0x01, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x4d, 0x4d, 0x19, 0x1e, 0x1c, 0x34, 0x34, 0xb5, 0x62, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x58, 0xa6, 0xa3, 0x6c, 0xb8, 0x26, 0x26, 0x26, 0xa7, 0xc2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0xa2, 0xa2, 0xa2, 0xa2, 0xbc, 0xb0, 0xa8, 0xa4, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x6d, 0x67, 0x66, 0xee, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x0c, 0xfc, 0xc6, 0xc6, 0xc6, 0xfc, 0xd8, 0xdc, 0xdc, 0xe6, 0xe6, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x71, 0xdb, 0x35, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x52, 0x5a, 0x52, 0x5f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf1, 0x5b, 0x55, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x18, 0xce, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0xe6, 0x6c, 0x38, 0x50, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x0a, 0x14, 0x14, 0x28, 0x28, 0x50, 0x50, 0xa0, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x9c, 0x30, 0xfe, 0x0c, 0x18, 0x38, 0x0c, 0x06, 0x06, 0xc6, 0xc6, 0x7c, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0x6c, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x26, 0x03, 0x13, 0x0c, 0x13, 0x03, 0x03, 0x66, 0x98, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x6c, 0x38, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x2d, 0x2d, 0x1a, 0x1e, 0x1b, 0x31, 0x31, 0xb2, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x6b, 0xc8, 0xcc, 0xc6, 0xc6, 0xcc, 0xc0, 0x63, 0x1c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0xe7, 0xff, 0xe0, 0x67, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x26, 0x44, 0xf8, 0xc0, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x4c, 0x52, 0x3c, 0x10, 0x3c, 0x60, 0xc0, 0xc3, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x73, 0xce, 0x18, 0x3a, 0x5c, 0x18, 0x30, 0x30, 0xb0, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x2c, 0x3c, 0x2c, 0x8c, 0xcc, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x12, 0x12, 0x12, 0x16, 0x36, 0x3e, 0x3a, 0x5a, 0x52, 0x91, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x26, 0x46, 0xc6, 0xc4, 0xc8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0xc6, 0xe7, 0x7a, 0x38, 0x5c, 0xce, 0xe7, 0x63, 0xe2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xfc, 0x7e, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x7e, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x40, 0x78, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1e, 0x7e, 0xf2, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xfe, 0x7e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x38, 0x00, 0x78, 0x38, 0x38, 0x38, 0x38, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0xff, 0x83, 0x86, 0x82, 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0xc6, 0xfc, 0x18, 0x30, 0x60, 0xdc, 0x86, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0xc6, 0xfc, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x70, 0xb2, 0xf6, 0x3c, 0x18, 0x30, 0x60, 0xde, 0x98, 0x1c, 0x06, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0xb0, 0x3c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0xc0, 0xe2, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb0, 0x3c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x30, 0x62, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0x80, 0xe2, 0x36, 0xec, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xf0, 0x30, 0x62, 0x66, 0x6c, 0x18, 0x30, 0x60, 0xdc, 0xb6, 0x1c, 0x36, 0x1c, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0xce, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x73, 0x23, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x95, 0x65, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0xb5, 0x55, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xce, 0xce, 0xce, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0xdb, 0x73, 0x73, 0x73, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x95, 0x95, 0x95, 0x65, 0x65, 0x65, 0x95, 0x95, 0x95, 0x95, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xdb, 0xdb, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xce, 0xc4, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x73, 0x23, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x05, 0x05, 0x00, 0x95, 0x95, 0x95, 0x95, 0x95, 0x65, 0x65, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x15, 0x15, 0x00, 0xb5, 0xb5, 0xb5, 0xb5, 0x55, 0x55, 0x55, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0xdb, 0xdb, 0xce, 0xce, 0xce, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0xdb, 0xdb, 0x73, 0x73, 0x73, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x05, 0x05, 0x00, 0x95, 0x95, 0x65, 0x65, 0x95, 0x95, 0x95, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xe6, 0xd6, 0xd6, 0xd6, 0xd6, 0xe6, 0xcc, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0x99, 0xbd, 0xdb, 0xdb, 0xbd, 0x99, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0xcc, 0x86, 0x06, 0x06, 0x06, 0x06, 0x86, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xb0, 0x18, 0x0c, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0f, 0x07, 0x0d, 0x18, 0x30, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x60, 0x30, 0x18, 0x0d, 0x07, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x06, 0x0c, 0x18, 0xb0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x62, 0xff, 0x64, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x26, 0xff, 0x46, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xce, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x73, 0xdd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xff, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x36, 0xff, 0x36, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xfc, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x3f, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x63, 0xff, 0x63, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xc6, 0xff, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x33, 0x63, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xcc, 0xc6, 0x7f, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x3b, 0x6b, 0xfe, 0x68, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x60, 0xdc, 0xd6, 0x7f, 0x16, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x5a, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x6e, 0xff, 0x76, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x30, 0x60, 0x63, 0xff, 0xc6, 0x16, 0x1c, 0x1c, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x66, 0x36, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0xcc, 0xd8, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x36, 0x66, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xd8, 0xcc, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x36, 0x66, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x30, 0xfc, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x0c, 0x3f, 0x1e, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x00, 0xf0, 0xe0, 0xb0, 0x18, 0x0c, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x98, 0xb0, 0xff, 0xb0, 0x98, 0x19, 0x0d, 0xff, 0x0d, 0x19, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x1e, 0x1c, 0x16, 0x03, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x78, 0x38, 0x68, 0xc0, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x1c, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x30, 0x60, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x2e, 0x3f, 0x24, 0x24, 0x24, 0x24, 0xfc, 0x74, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x60, 0xff, 0x60, 0x30, 0x0c, 0x06, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x7e, 0xff, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0xff, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xff, 0x00, 0xff, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xff, 0x00, 0xff, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x7f, 0xc4, 0x7f, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x7e, 0xcb, 0x7e, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0xfe, 0x23, 0xfe, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7f, 0xc0, 0x7f, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x7c, 0xee, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfe, 0x03, 0xfe, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x7e, 0xc3, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x7c, 0xee, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf0, 0xe0, 0xb0, 0xd8, 0xec, 0xb6, 0x1b, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0f, 0x07, 0x0d, 0x1b, 0x37, 0x6d, 0xd8, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x20, 0x30, 0xd8, 0x6d, 0x37, 0x1b, 0x0d, 0x07, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x0c, 0x1b, 0xb6, 0xec, 0xd8, 0xb0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x60, 0xff, 0x60, 0x3f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xfc, 0x06, 0xff, 0x06, 0xfc, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x6a, 0xff, 0x65, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa6, 0xff, 0x56, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xd5, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0x66, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x06, 0xab, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x00, 0x18, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0xb0, 0xff, 0xb0, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x0d, 0xff, 0x0d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x41, 0x81, 0x41, 0x3f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xfc, 0x82, 0x81, 0x82, 0xfc, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x44, 0xc6, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x7c, 0x00, 0x7c, 0x44, 0x7c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x7c, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x54, 0xd6, 0x54, 0x54, 0x54, 0xd6, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x54, 0xee, 0x44, 0xc6, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x54, 0xee, 0x44, 0xc6, 0x44, 0x44, 0xc6, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe8, 0xbc, 0x82, 0x81, 0x82, 0xbc, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x80, 0xbc, 0xb8, 0xac, 0x86, 0x83, 0x81, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x01, 0x81, 0xc1, 0x61, 0x35, 0x1d, 0x3d, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0xc6, 0x44, 0x44, 0x44, 0xc6, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0xfe, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x06, 0x06, 0x3e, 0x66, 0xc6, 0xc6, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x7e, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xfe, 0x16, 0x16, 0x16, 0x7e, 0x16, 0x26, 0x26, 0x26, 0xfe, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x3e, 0x66, 0xcf, 0xdb, 0xdb, 0xf3, 0x66, 0x7c, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xc0, 0xfe, 0xc0, 0xc0, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x3e, 0x64, 0xc8, 0xc8, 0xfe, 0xc8, 0xd0, 0x70, 0x3e, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3e, 0x60, 0xc0, 0xfe, 0xc0, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x06, 0x06, 0xfe, 0x06, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xf8, 0x1c, 0x16, 0x26, 0xfe, 0x26, 0x26, 0x4c, 0xf8, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0c, 0x06, 0xfe, 0x06, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xe7, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe7, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0xc0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x7e, 0x18, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x06, 0x06, 0x06, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe3, 0x33, 0x66, 0x36, 0xe6, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x33, 0x73, 0xb6, 0xf6, 0x36, 0x0c, 0xcc, 0x6c, 0x38, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdb, 0xdb, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x16, 0x0c, 0x1c, 0x34, 0x62, 0xff, 0x02, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x1a, 0x1c, 0x38, 0x58, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6c, 0x6c, 0x6c, 0x6e, 0x7c, 0xec, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x33, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x2a, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0xa8, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0x99, 0x99, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x33, 0x66, 0x66, 0x66, 0x7e, 0xe7, 0xe7, 0xe7, 0xe7, 0x7e, 0x66, 0x66, 0x66, 0xcc, 0x00, 0x00 },
-	{ 0x2a, 0x54, 0x54, 0x54, 0x7c, 0xd6, 0xd6, 0xd6, 0xd6, 0x7c, 0x54, 0x54, 0x54, 0xa8, 0x00, 0x00 },
-	{ 0x18, 0x34, 0x30, 0x30, 0x38, 0x35, 0x33, 0x37, 0x30, 0x30, 0x30, 0x30, 0xb0, 0x60, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0xfa, 0x5a, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x1a, 0x18, 0x18, 0x3c, 0x5a, 0x5f, 0x5a, 0x5a, 0x3c, 0x18, 0x18, 0x58, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0xfc, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x7e, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x76, 0xdc, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0xdb, 0xdb, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0xd8, 0xdb, 0xdb, 0x1b, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x1c, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x10, 0x76, 0xdc, 0x10, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0xfe, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0xfe, 0x20, 0xfe, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x76, 0xdc, 0x10, 0x76, 0xdc, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x7c, 0x00, 0x7c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0x00, 0x66, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x66, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x06, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x00, 0x00, 0xdf, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x00, 0x00, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x28, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x10, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x44, 0x28, 0x10, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x10, 0x7c, 0x28, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x10, 0x28, 0x44, 0x7c, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x26, 0x7c, 0xb4, 0x6c, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x68, 0x54, 0x54, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x08, 0x10, 0x00, 0x10, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x08, 0x7e, 0x08, 0x10, 0x7e, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x08, 0xfe, 0x08, 0x10, 0xfe, 0x10, 0x20, 0xfe, 0x20, 0x40, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x08, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1b, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x1b, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x66, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x66, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0xce, 0x7c, 0x10, 0x7c, 0xe6, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x0e, 0x38, 0xe8, 0x38, 0x0e, 0x10, 0x76, 0xdc, 0x20, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0xe0, 0x38, 0x2e, 0x38, 0xe0, 0x40, 0x76, 0xdc, 0x80, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x0e, 0x38, 0xe8, 0x38, 0x1e, 0xf0, 0x38, 0x2e, 0x38, 0xe0, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xe8, 0x38, 0x0e, 0x38, 0xf0, 0x1e, 0x38, 0xe0, 0x38, 0x2e, 0x20, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0xf2, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x9e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x06, 0x0c, 0x38, 0xe8, 0x38, 0x1c, 0x16, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0xd0, 0x70, 0x38, 0x2e, 0x38, 0x60, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x7e, 0xc8, 0xc8, 0xd0, 0xd0, 0x7e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0xfc, 0x16, 0x16, 0x26, 0x26, 0xfc, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x7e, 0xc8, 0xc8, 0xd0, 0xd0, 0x7e, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xfc, 0x16, 0x16, 0x26, 0x26, 0xfc, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7e, 0xc0, 0xc0, 0xc0, 0xc0, 0x7e, 0x08, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfc, 0x06, 0x06, 0x06, 0x06, 0xfc, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x92, 0xa2, 0xfa, 0xa2, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0xba, 0xba, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x92, 0xba, 0x92, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x54, 0x92, 0xfe, 0x92, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0xfe, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0xaa, 0x92, 0xaa, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x8a, 0x92, 0xa2, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xba, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xaa, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x54, 0xd6, 0xba, 0xd6, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0xba, 0x82, 0xba, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0xba, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0xfe, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0xfe, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x92, 0xba, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0xff, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0x60, 0x60, 0x7e, 0x60, 0x7e, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xff, 0xc0, 0xff, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xd8, 0xdf, 0xd8, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xa8, 0xa8, 0xa8, 0xa8, 0xaf, 0xa8, 0xa8, 0xa8, 0xa8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd8, 0xd8, 0xdf, 0xd8, 0xdf, 0xd8, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc2, 0xc4, 0xc4, 0xff, 0xc8, 0xc8, 0xd0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xc4, 0xc4, 0xff, 0xc8, 0xff, 0xd0, 0xd0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd9, 0xda, 0xda, 0xdf, 0xda, 0xda, 0xdc, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xd8, 0xd9, 0xda, 0xdf, 0xda, 0xdf, 0xda, 0xdc, 0xd8, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x0c, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x60, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x06, 0x1e, 0x76, 0xc6, 0x76, 0x1e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc0, 0xf0, 0xdc, 0xc6, 0xdc, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x1e, 0x76, 0xc6, 0x76, 0x1e, 0x06, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xf0, 0xdc, 0xc6, 0xdc, 0xf0, 0xc0, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xbf, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xfd, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7d, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0xc6, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xf0, 0xc8, 0xc4, 0xc4, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0b, 0x13, 0x23, 0x43, 0x83, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x38, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x92, 0x44, 0x28, 0x92, 0x28, 0x44, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0xc4, 0xa8, 0x90, 0xa8, 0xc4, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x82, 0x46, 0x2a, 0x12, 0x2a, 0x46, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x3e, 0x60, 0xce, 0xd8, 0xd8, 0xce, 0x60, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xf8, 0x0c, 0xe6, 0x36, 0x36, 0xe6, 0x0c, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x92, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x10, 0x38, 0x54, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0x64, 0xce, 0x64, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x18, 0x4c, 0xe6, 0x4c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x15, 0x2a, 0x54, 0xa8, 0x54, 0x2a, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xa8, 0x54, 0x2a, 0x15, 0x2a, 0x54, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0xfe, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00 },
-	{ 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0xfe, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf2, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x9e, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x0e, 0x1c, 0xf0, 0x1c, 0x16, 0xf2, 0x1c, 0x26, 0x22, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x88, 0xc8, 0x70, 0x1e, 0x70, 0xd0, 0x9e, 0x70, 0xe0, 0xa0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0xfe, 0xc8, 0xc8, 0xd0, 0xd0, 0xfe, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xfe, 0x16, 0x16, 0x26, 0x26, 0xfe, 0x40, 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x08, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0xfe, 0x10, 0xfe, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x38, 0x0e, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x38, 0x0e, 0x38, 0xe0, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x02, 0x06, 0x1c, 0xf0, 0x1c, 0x06, 0x02, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x80, 0xc0, 0x70, 0x1e, 0x70, 0xc0, 0x80, 0x10, 0x76, 0xdc, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x0e, 0x1e, 0x76, 0xd6, 0x76, 0x1e, 0x26, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0xc8, 0xf0, 0xdc, 0xd6, 0xdc, 0xf0, 0xe0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x0e, 0x1e, 0x76, 0xd6, 0x76, 0x1e, 0x26, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0xc8, 0xf0, 0xdc, 0xd6, 0xdc, 0xf0, 0xe0, 0x20, 0xfe, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x3d, 0x66, 0xc7, 0xcb, 0xd3, 0xe3, 0x66, 0xbc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x42, 0xa5, 0x7e, 0x24, 0x24, 0x7e, 0xa5, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x38, 0x54, 0x8a, 0xf6, 0x82, 0x54, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0xfe, 0xfe, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x00, 0x00 },
-	{ 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x03, 0x00, 0x00 },
-	{ 0x00, 0xc0, 0x60, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x18, 0x18, 0x30, 0x30, 0x60, 0xc0, 0x00, 0x00 },
-	{ 0x00, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 },
-	{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3f, 0x00, 0x00 },
-	{ 0x00, 0xfc, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c },
-	{ 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xfc, 0x00, 0x00 },
-	{ 0x00, 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0xe0 },
-	{ 0xe0, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07 },
-	{ 0x00, 0x00, 0xff, 0xc1, 0xc0, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x30, 0x60, 0x60, 0x60, 0x60, 0xc0, 0xc1, 0xff, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xff, 0x00, 0xff, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x78, 0x78, 0x38, 0x38, 0x18, 0x18, 0x00, 0x00 },
-	{ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0 },
-	{ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
-	{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x07, 0x05, 0x05, 0x05, 0x05, 0x25, 0x79, 0xc2, 0x7c, 0x20, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xf8, 0xd8, 0xd8, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xf0, 0x0f, 0x0c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd8, 0xd8, 0xf8, 0x70, 0x20, 0x0f, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf0, 0xc0, 0xe0, 0xc0, 0xc0, 0x0f, 0x0c, 0x0e, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0xc0, 0xc0, 0xc0, 0x70, 0x1e, 0x1b, 0x1e, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x98, 0xd8, 0xf8, 0xd8, 0xd8, 0x0c, 0x0c, 0x0c, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7c, 0xfe, 0xc6, 0xc6, 0x60, 0x30, 0x30, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1f, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xfc, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0x1f, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0e, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x30, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x0e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80 },
-	{ 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01 },
-	{ 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
-	{ 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc },
-	{ 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8 },
-	{ 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 },
-	{ 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0 },
-	{ 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0 },
-	{ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
-	{ 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f },
-	{ 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44 },
-	{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa },
-	{ 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77 },
-	{ 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0xba, 0xba, 0xba, 0xba, 0xba, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x8a, 0xc6, 0xa2, 0x92, 0x8a, 0xc6, 0xa2, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xa2, 0xc6, 0x8a, 0x92, 0xa2, 0xc6, 0x8a, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0xaa, 0xc6, 0xaa, 0x92, 0xaa, 0xc6, 0xaa, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x84, 0x84, 0xfc, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x80, 0xc0, 0xa0, 0x90, 0x88, 0x84, 0x88, 0x90, 0xa0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70, 0x78, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70, 0x48, 0x70, 0x40, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x98, 0x86, 0x98, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x06, 0x0a, 0x12, 0x22, 0x42, 0x22, 0x12, 0x0a, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x78, 0x38, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x38, 0x48, 0x38, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x02, 0x0e, 0x32, 0xc2, 0x32, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x44, 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x44, 0x54, 0xba, 0xba, 0x54, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0xbd, 0xbd, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x28, 0x28, 0x44, 0x82, 0x82, 0x44, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x14, 0x40, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x02, 0x28, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x99, 0xa5, 0xa5, 0xa5, 0xa5, 0x99, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x72, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0x72, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x4e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x7e, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4e, 0x8f, 0x8f, 0x8f, 0xff, 0xff, 0xff, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x70, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x70, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xc3, 0xbd, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0xbd, 0xc3, 0xff, 0xff, 0xff, 0xff },
-	{ 0xff, 0xff, 0xc3, 0xbd, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0xbd, 0xc3, 0xff, 0xff, 0xff, 0xff },
-	{ 0x00, 0x00, 0x30, 0x40, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0c, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x40, 0x30, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f, 0xff, 0xff },
-	{ 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff },
-	{ 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80 },
-	{ 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01, 0x01 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0xff, 0xfd, 0xf9, 0xf1, 0xf1, 0xe1, 0xc1, 0x81, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x81, 0x83, 0x87, 0x8f, 0x8f, 0x9f, 0xbf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xff, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0x99, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x74, 0x74, 0xf2, 0xf2, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0x38, 0x5c, 0x5c, 0x9e, 0x9e, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0x92, 0xf2, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0xf2, 0x92, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x9e, 0x92, 0x92, 0x92, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xfe, 0x92, 0x92, 0x92, 0x9e, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x4a, 0x89, 0x89, 0x89, 0xf9, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0xf9, 0x89, 0x89, 0x89, 0x4a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x81, 0x9f, 0x91, 0x91, 0x91, 0x52, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x52, 0x91, 0x91, 0x91, 0x9f, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x30, 0x7c, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x7c, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x38, 0xfe, 0x7c, 0x38, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0xee, 0x44, 0x54, 0x6c, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x34, 0x1c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xc6, 0xcc, 0xd8, 0xf0, 0xd8, 0xcd, 0xc7, 0xcf, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x92, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x42, 0x42, 0xa5, 0xa5, 0x42, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x42, 0xa5, 0xa5, 0x42, 0x42, 0x42, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x36, 0x36, 0x1c, 0x18, 0x30, 0x70, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0x86, 0x8a, 0xba, 0x92, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, 0xee, 0xba, 0xba, 0xee, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x82, 0xc6, 0x6c, 0x7c, 0x38, 0x7c, 0x6c, 0xc6, 0x82, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x7c, 0x82, 0xaa, 0x82, 0x44, 0x7c, 0x44, 0x38, 0x00, 0x44, 0xc6, 0x38, 0xc6, 0x44, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x44, 0xee, 0xfe, 0x92, 0xba, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0xff, 0x18, 0x1e, 0x78, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x38, 0x10, 0x10, 0x92, 0xfe, 0x92, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x72, 0xe0, 0xc4, 0xdf, 0xce, 0xca, 0xe0, 0x72, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x54, 0x28, 0x54, 0xaa, 0xaa, 0xaa, 0xaa, 0x54, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x5a, 0x99, 0x99, 0x99, 0xbd, 0xff, 0xdb, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x42, 0x81, 0x85, 0xb1, 0xf9, 0xff, 0xdf, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0xee, 0xee, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0x81, 0x99, 0xa5, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xa5, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xdb, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x54, 0x28, 0xc6, 0x28, 0x54, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x78, 0x14, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x14, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x28, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x28, 0x1e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x06, 0x0e, 0x1a, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x03, 0x03, 0x7b, 0xcf, 0xcf, 0xcf, 0x0f, 0x1b, 0x33, 0xff, 0x03, 0x03, 0x03, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x60, 0xf0, 0x60, 0x6e, 0x73, 0x63, 0x63, 0x66, 0x66, 0x63, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xd6, 0x54, 0x54, 0x7c, 0x54, 0x54, 0xd6, 0x38, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x3c, 0xdb, 0xdb, 0xdb, 0xdb, 0x7e, 0x3c, 0x18, 0x3c, 0x18, 0x18, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0xa5, 0xa5, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0xc3, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0x7e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7e, 0xc3, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7e, 0xdb, 0xd8, 0x70, 0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1e, 0x33, 0x33, 0x33, 0x33, 0x1b, 0x7b, 0xdb, 0xdb, 0x73, 0x03, 0x01, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x94, 0x7c, 0x55, 0x57, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x06, 0x0b, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x24, 0xe7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x94, 0x7c, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x04, 0x03, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1f, 0x07, 0x8f, 0xdb, 0x73, 0x70, 0xd8, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x90, 0x50, 0x70, 0x68, 0x48, 0x48, 0x4e, 0x49, 0x09, 0x0e, 0x10, 0x20, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x2a, 0x7e, 0xaa, 0x00, 0x00, 0x2a, 0x7e, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc3, 0x66, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x6c, 0x92, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x81, 0x81, 0x66, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x18, 0x24, 0x3c, 0xe7, 0xa5, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x38, 0x78, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x30, 0x3c, 0x3e, 0x32, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x7f, 0x6f, 0x63, 0x63, 0x63, 0x63, 0xe3, 0xe7, 0xc7, 0x06, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x63, 0xe7, 0xe7, 0xc6, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0xde, 0xe6, 0xc4, 0xd8, 0xe0, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x40, 0x40, 0x44, 0x5c, 0x74, 0x44, 0x44, 0x5c, 0x74, 0x44, 0x04, 0x04, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x04, 0x46, 0x5c, 0x74, 0xc4, 0x46, 0x5c, 0x74, 0xc4, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3b, 0x66, 0x66, 0x66, 0xff, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3c, 0x6e, 0x66, 0x60, 0xfe, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x3e, 0x6e, 0x66, 0x66, 0xfe, 0x66, 0x66, 0x66, 0x66, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6e, 0xdb, 0xdb, 0xd8, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x6f, 0xdb, 0xdb, 0xdb, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xff, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x6f, 0x6c, 0x6c, 0x6c, 0x6c, 0x6d, 0xf6, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x29, 0x5e, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0a, 0x00, 0x0a, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x14, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x88, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x88, 0x80, 0x88, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x94, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x94, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x88, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x94, 0x80, 0x88, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x14, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x94, 0x80, 0x94, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x94, 0x80, 0x94, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x28, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x28, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x28, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x28, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x38, 0x28, 0x70, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x01, 0x02, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x46, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x44, 0x82, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa4, 0x09, 0x12, 0x04, 0x08, 0x48, 0x84, 0x82, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa2, 0x0c, 0x13, 0x0c, 0x10, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xa2, 0x0c, 0x13, 0x0c, 0x10, 0x10, 0x08, 0x04, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x00, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x1c, 0x14, 0x38, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x38, 0x40, 0x38, 0x40, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x70, 0x80, 0x70, 0x80, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf0, 0x10, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xf7, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3d, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0x3d, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x38, 0x4c, 0x52, 0x32, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x70, 0x80, 0x70, 0x80, 0x08, 0x14, 0x60, 0x80, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x00, 0x07, 0x18, 0x20, 0x3f, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x29, 0x01, 0x19, 0x21, 0x19, 0xa1, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x00, 0x2a, 0x02, 0x32, 0x42, 0x32, 0xc6, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x00, 0xa3, 0x0c, 0x10, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x40, 0x00, 0xa3, 0x0c, 0x10, 0x10, 0x08, 0x04, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x18, 0x10, 0x20, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x23, 0x54, 0x33, 0x24, 0x40, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x08, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x3c, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x10, 0x00, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x10, 0x00, 0x10 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x82, 0x7c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x20, 0x20, 0x20, 0x20, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x98, 0x60, 0xc2, 0x12, 0x92, 0x9c, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x92, 0x9c, 0x60, 0x0e, 0x70, 0x0e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x60, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x10, 0x60, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x04, 0x54, 0x58, 0x20, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x04, 0x54, 0x58, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x0e, 0xf0, 0x02, 0x92, 0x9c, 0x60, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x60, 0x02, 0x92, 0x9c, 0x60, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x12, 0x9c, 0x60, 0x0e, 0x70, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x10, 0x28, 0x50, 0x28, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x28, 0x14, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x08, 0x10, 0x54, 0x38, 0x54, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x10, 0x08, 0x2a, 0x1c, 0x2a, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x2a, 0x14, 0x00, 0x21, 0x69, 0xa9, 0x69, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x08, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x20, 0x10, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x04, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x28, 0x10, 0x2a, 0x24, 0x1a, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x38, 0x38, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x30, 0x18, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x08, 0x08, 0x10, 0x10, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x54, 0x58, 0x40, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x06, 0x18, 0x60, 0x06, 0x18, 0x60, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x12, 0xca, 0x2c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x06, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x08, 0x14, 0x0c, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x14, 0x18, 0x60, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x06, 0x18, 0x60, 0x00, 0x00 },
-	{ 0x0a, 0x2a, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x12, 0x92, 0x9c, 0x60, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x20, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x02, 0x3c, 0x40, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x01, 0x3e, 0x40, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x18, 0x20, 0x1c, 0x20, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x0c, 0x10, 0x0e, 0x10, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x0c, 0x10, 0x0e, 0x10, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x00, 0x0c, 0x10, 0x0e, 0x10, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x30, 0x40, 0x38, 0x40, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x1c, 0x20, 0x1c, 0x20, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x28, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x50, 0x00, 0x10, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x40, 0x80, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x88, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x88, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x30, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x00, 0x00, 0x70, 0x8f, 0x32, 0x41, 0x80, 0x80, 0x80, 0x40, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x00, 0x38, 0x47, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x70, 0x8f, 0x32, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x08, 0x08, 0x04, 0x46, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x02, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x07, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x15, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x14, 0x00, 0x01, 0x15, 0x88, 0x84, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00, 0x01, 0x15, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2a, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0x09, 0x31, 0x9e, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x29, 0x31, 0xde, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x20, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0xa2, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x24, 0x20, 0x20, 0x2c, 0x32, 0x22, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0x22, 0x41, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x10, 0x10, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x40, 0x00, 0x00, 0x70, 0x80, 0x8c, 0x70, 0x40, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x08, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0x22, 0x41, 0x80, 0x80, 0x80, 0x41, 0x3e, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x10, 0x00, 0x00, 0x0e, 0x10, 0x10, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x1e, 0x22, 0x1c, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x85, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x04, 0x00, 0x06, 0x49, 0x89, 0x86, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x06, 0x09, 0x09, 0x47, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x0a, 0x00, 0x00, 0x06, 0x09, 0x49, 0x87, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x0a, 0x06, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x14, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x0c, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x19, 0x21, 0x19, 0x21, 0x01, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x32, 0x42, 0x32, 0x42, 0x02, 0x86, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x10, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x06, 0x18, 0x20, 0x20, 0x10, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x42, 0x82, 0x82, 0x84, 0x78, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3c, 0x4b, 0x4a, 0x44, 0x40, 0x40, 0x40, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x32, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x32, 0xcd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x08, 0x00, 0x00, 0x41, 0x81, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x41, 0x81, 0x81, 0x42, 0x3c, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x22, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x10, 0x10, 0x68, 0x88, 0x74, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x40, 0x30, 0x4e, 0x49, 0x39, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x24, 0x28, 0xf3, 0x24, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0e, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x0f, 0x02, 0x04, 0x18, 0x60, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x88, 0x86, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x24, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x88, 0x87, 0x81, 0x7e, 0x00, 0x24, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x04, 0xf8, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf7, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0x90, 0x02, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x68, 0x90, 0x02, 0x32, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x60, 0x80, 0x72, 0xa2, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x30, 0x40, 0x3a, 0x52, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x42, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00 },
-	{ 0x00, 0x00, 0x22, 0x12, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x18, 0x20, 0x1c, 0x20, 0x00 },
-	{ 0x00, 0x00, 0x42, 0x22, 0x12, 0x0a, 0x04, 0x0c, 0x12, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0x00, 0x00, 0x22, 0x12, 0x12, 0x0a, 0x0a, 0x0e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-	{ 0xf1, 0x35, 0x55, 0x8a, 0xe0, 0x06, 0x95, 0xd6, 0xb5, 0x97, 0x00, 0xee, 0x8a, 0xee, 0x28, 0xe8 },
-	{ 0x00, 0x38, 0x7c, 0x7c, 0xc6, 0x92, 0xf2, 0xe6, 0xfe, 0xe6, 0x7c, 0x7c, 0x38, 0x00, 0x00, 0x00 },
-
-	/* Special glyph for unknown character */
-	{ 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
-};
-
-/** @}
- */
Index: pace/lib/fdisk/doc/doxygroups.h
===================================================================
--- uspace/lib/fdisk/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libfdisk libfdisk
- * @ingroup libs
- */
Index: pace/lib/fdisk/include/fdisk.h
===================================================================
--- uspace/lib/fdisk/include/fdisk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfdisk
- * @{
- */
-/**
- * @file Disk management library.
- */
-
-#ifndef LIBFDISK_FDISK_H_
-#define LIBFDISK_FDISK_H_
-
-#include <errno.h>
-#include <loc.h>
-#include <types/fdisk.h>
-#include <types/vol.h>
-
-extern errno_t fdisk_create(fdisk_t **);
-extern void fdisk_destroy(fdisk_t *);
-extern errno_t fdisk_dev_list_get(fdisk_t *, fdisk_dev_list_t **);
-extern void fdisk_dev_list_free(fdisk_dev_list_t *);
-extern fdisk_dev_info_t *fdisk_dev_first(fdisk_dev_list_t *);
-extern fdisk_dev_info_t *fdisk_dev_next(fdisk_dev_info_t *);
-extern errno_t fdisk_dev_info_get_svcname(fdisk_dev_info_t *, char **);
-extern void fdisk_dev_info_get_svcid(fdisk_dev_info_t *, service_id_t *);
-extern errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *, capa_spec_t *);
-
-extern errno_t fdisk_dev_open(fdisk_t *, service_id_t, fdisk_dev_t **);
-extern void fdisk_dev_close(fdisk_dev_t *);
-extern errno_t fdisk_dev_erase(fdisk_dev_t *);
-extern void fdisk_dev_get_flags(fdisk_dev_t *, fdisk_dev_flags_t *);
-extern errno_t fdisk_dev_get_svcname(fdisk_dev_t *, char **);
-extern errno_t fdisk_dev_capacity(fdisk_dev_t *, capa_spec_t *);
-
-extern errno_t fdisk_label_get_info(fdisk_dev_t *, fdisk_label_info_t *);
-extern errno_t fdisk_label_create(fdisk_dev_t *, label_type_t);
-extern errno_t fdisk_label_destroy(fdisk_dev_t *);
-
-extern fdisk_part_t *fdisk_part_first(fdisk_dev_t *);
-extern fdisk_part_t *fdisk_part_next(fdisk_part_t *);
-extern errno_t fdisk_part_get_info(fdisk_part_t *, fdisk_part_info_t *);
-extern errno_t fdisk_part_get_max_avail(fdisk_dev_t *, fdisk_spc_t, capa_spec_t *);
-extern errno_t fdisk_part_get_tot_avail(fdisk_dev_t *, fdisk_spc_t, capa_spec_t *);
-extern errno_t fdisk_part_create(fdisk_dev_t *, fdisk_part_spec_t *,
-    fdisk_part_t **);
-extern errno_t fdisk_part_destroy(fdisk_part_t *);
-extern errno_t fdisk_part_set_mountp(fdisk_part_t *, const char *);
-extern void fdisk_pspec_init(fdisk_part_spec_t *);
-
-extern errno_t fdisk_get_vollabel_support(fdisk_dev_t *, vol_fstype_t,
-    vol_label_supp_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/fdisk/include/types/fdisk.h
===================================================================
--- uspace/lib/fdisk/include/types/fdisk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,204 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfdisk
- * @{
- */
-/**
- * @file Disk management library types.
- */
-
-#ifndef LIBFDISK_TYPES_H_
-#define LIBFDISK_TYPES_H_
-
-#include <adt/list.h>
-#include <capa.h>
-#include <loc.h>
-#include <stdint.h>
-#include <types/label.h>
-#include <types/vol.h>
-#include <vbd.h>
-
-typedef enum {
-	/** Primary partition space */
-	spc_pri,
-	/** Logical partition space */
-	spc_log
-} fdisk_spc_t;
-
-/** Fdisk device flags */
-typedef enum {
-	/** Currently we can create a label */
-	fdf_can_create_label = 0x1,
-	/** Currently we can delete the label */
-	fdf_can_delete_label = 0x2,
-	/** Currently we can erase unknown data from disk */
-	fdf_can_erase_dev = 0x4
-} fdisk_dev_flags_t;
-
-#define CU_LIMIT (cu_ybyte + 1)
-
-/** List of devices available for managing by fdisk */
-typedef struct {
-	/** Fdisk instance */
-	struct fdisk *fdisk;
-	/** List of device info structures */
-	list_t devinfos; /* of fdisk_dev_info_t */
-} fdisk_dev_list_t;
-
-/** Device information */
-typedef struct {
-	/** Containing device list */
-	fdisk_dev_list_t *devlist;
-	/** Link in fdisk_dev_list_t.devinfos */
-	link_t ldevlist;
-	/** Service ID */
-	service_id_t svcid;
-	/** Service name or NULL if not determined yet */
-	char *svcname;
-} fdisk_dev_info_t;
-
-/** Open fdisk device */
-typedef struct {
-	/** Fdisk instance */
-	struct fdisk *fdisk;
-	/** Service ID */
-	service_id_t sid;
-	/** All partitions */
-	list_t parts;
-	/** Primary partitions sorted by index */
-	list_t pri_idx; /* of fdisk_part_t */
-	/** Primary partitions sorted by block address */
-	list_t pri_ba;
-	/** Logical partitions sorted by block address */
-	list_t log_ba;
-	/** Extended partition or NULL */
-	struct fdisk_part *ext_part;
-	/** Disk info */
-	vbd_disk_info_t dinfo;
-	/** Alignment in blocks */
-	uint64_t align;
-} fdisk_dev_t;
-
-typedef struct {
-	/** Label type */
-	label_type_t ltype;
-	/** Label flags */
-	label_flags_t flags;
-} fdisk_label_info_t;
-
-/** Partition */
-typedef struct fdisk_part {
-	/** Containing device */
-	fdisk_dev_t *dev;
-	/** Link to fdisk_dev_t.parts */
-	link_t lparts;
-	/** Link to fdisk_dev_t.pri_idx */
-	link_t lpri_idx;
-	/** Link to fdisk_dev_t.pri_ba */
-	link_t lpri_ba;
-	/** Link to fdisk_dev_t.log_ba */
-	link_t llog_ba;
-	/** Capacity */
-	capa_spec_t capacity;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** Partition contents */
-	vol_part_cnt_t pcnt;
-	/** File system type */
-	vol_fstype_t fstype;
-	/** Partition ID */
-	vbd_part_id_t part_id;
-	/** Partition index */
-	int index;
-	/** First block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Volume label */
-	char *label;
-} fdisk_part_t;
-
-/** Specification of new partition */
-typedef struct {
-	/** Desired capacity */
-	capa_spec_t capacity;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** File system type */
-	vol_fstype_t fstype;
-	/** Volume label */
-	const char *label;
-	/** Mount point */
-	const char *mountp;
-} fdisk_part_spec_t;
-
-/** Partition info */
-typedef struct {
-	/** Capacity */
-	capa_spec_t capacity;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** Partition contents */
-	vol_part_cnt_t pcnt;
-	/** File system type */
-	vol_fstype_t fstype;
-	/** Volume label */
-	char *label;
-	/** Service ID */
-	service_id_t svc_id;
-} fdisk_part_info_t;
-
-/** Free range iterator */
-typedef struct {
-	/** Device */
-	fdisk_dev_t *dev;
-	/** Primary or logical partition space */
-	fdisk_spc_t spc;
-	/** First block of free range */
-	aoff64_t b0;
-	/** Next partition following the free range or @c NULL if the range
-	 * is at the end.
-	 */
-	fdisk_part_t *npart;
-} fdisk_free_range_t;
-
-/** Fdisk instance */
-typedef struct fdisk {
-	/** Volume service */
-	vol_t *vol;
-	/** Virtual Block Device */
-	vbd_t *vbd;
-} fdisk_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/fdisk/meson.build
===================================================================
--- uspace/lib/fdisk/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('src/fdisk.c')
Index: pace/lib/fdisk/src/fdisk.c
===================================================================
--- uspace/lib/fdisk/src/fdisk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1184 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfdisk
- * @{
- */
-/**
- * @file Disk management library.
- */
-
-#include <adt/list.h>
-#include <capa.h>
-#include <errno.h>
-#include <fdisk.h>
-#include <loc.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vbd.h>
-#include <vol.h>
-
-static errno_t fdisk_dev_add_parts(fdisk_dev_t *);
-static void fdisk_dev_remove_parts(fdisk_dev_t *);
-static errno_t fdisk_part_spec_prepare(fdisk_dev_t *, fdisk_part_spec_t *,
-    vbd_part_spec_t *);
-static void fdisk_pri_part_insert_lists(fdisk_dev_t *, fdisk_part_t *);
-static void fdisk_log_part_insert_lists(fdisk_dev_t *, fdisk_part_t *);
-static errno_t fdisk_update_dev_info(fdisk_dev_t *);
-static uint64_t fdisk_ba_align_up(fdisk_dev_t *, uint64_t);
-static uint64_t fdisk_ba_align_down(fdisk_dev_t *, uint64_t);
-static errno_t fdisk_part_get_max_free_range(fdisk_dev_t *, fdisk_spc_t, aoff64_t *,
-    aoff64_t *);
-static void fdisk_free_range_first(fdisk_dev_t *, fdisk_spc_t, fdisk_free_range_t *);
-static bool fdisk_free_range_next(fdisk_free_range_t *);
-static bool fdisk_free_range_get(fdisk_free_range_t *, aoff64_t *, aoff64_t *);
-
-static void fdisk_dev_info_delete(fdisk_dev_info_t *info)
-{
-	if (info == NULL)
-		return;
-
-	free(info->svcname);
-	free(info);
-}
-
-errno_t fdisk_create(fdisk_t **rfdisk)
-{
-	fdisk_t *fdisk = NULL;
-	errno_t rc;
-
-	fdisk = calloc(1, sizeof(fdisk_t));
-	if (fdisk == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = vol_create(&fdisk->vol);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = vbd_create(&fdisk->vbd);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rfdisk = fdisk;
-	return EOK;
-error:
-	fdisk_destroy(fdisk);
-
-	return rc;
-}
-
-void fdisk_destroy(fdisk_t *fdisk)
-{
-	if (fdisk == NULL)
-		return;
-
-	vol_destroy(fdisk->vol);
-	vbd_destroy(fdisk->vbd);
-	free(fdisk);
-}
-
-errno_t fdisk_dev_list_get(fdisk_t *fdisk, fdisk_dev_list_t **rdevlist)
-{
-	fdisk_dev_list_t *devlist = NULL;
-	fdisk_dev_info_t *info;
-	service_id_t *svcs = NULL;
-	size_t count, i;
-	errno_t rc;
-
-	devlist = calloc(1, sizeof(fdisk_dev_list_t));
-	if (devlist == NULL)
-		return ENOMEM;
-
-	devlist->fdisk = fdisk;
-	list_initialize(&devlist->devinfos);
-
-	rc = vbd_get_disks(fdisk->vbd, &svcs, &count);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	for (i = 0; i < count; i++) {
-		info = calloc(1, sizeof(fdisk_dev_info_t));
-		if (info == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		info->svcid = svcs[i];
-		info->devlist = devlist;
-		list_append(&info->ldevlist, &devlist->devinfos);
-	}
-
-	*rdevlist = devlist;
-	free(svcs);
-	return EOK;
-error:
-	free(svcs);
-	fdisk_dev_list_free(devlist);
-	return rc;
-}
-
-void fdisk_dev_list_free(fdisk_dev_list_t *devlist)
-{
-	fdisk_dev_info_t *info;
-
-	if (devlist == NULL)
-		return;
-
-	while (!list_empty(&devlist->devinfos)) {
-		info = list_get_instance(list_first(
-		    &devlist->devinfos), fdisk_dev_info_t,
-		    ldevlist);
-
-		list_remove(&info->ldevlist);
-		fdisk_dev_info_delete(info);
-	}
-
-	free(devlist);
-}
-
-fdisk_dev_info_t *fdisk_dev_first(fdisk_dev_list_t *devlist)
-{
-	if (list_empty(&devlist->devinfos))
-		return NULL;
-
-	return list_get_instance(list_first(&devlist->devinfos),
-	    fdisk_dev_info_t, ldevlist);
-}
-
-fdisk_dev_info_t *fdisk_dev_next(fdisk_dev_info_t *devinfo)
-{
-	link_t *lnext;
-
-	lnext = list_next(&devinfo->ldevlist,
-	    &devinfo->devlist->devinfos);
-	if (lnext == NULL)
-		return NULL;
-
-	return list_get_instance(lnext, fdisk_dev_info_t,
-	    ldevlist);
-}
-
-void fdisk_dev_info_get_svcid(fdisk_dev_info_t *info, service_id_t *rsid)
-{
-	*rsid = info->svcid;
-}
-
-errno_t fdisk_dev_info_get_svcname(fdisk_dev_info_t *info, char **rname)
-{
-	char *name;
-	errno_t rc;
-
-	if (info->svcname == NULL) {
-		rc = loc_service_get_name(info->svcid,
-		    &info->svcname);
-		if (rc != EOK)
-			return rc;
-	}
-
-	name = str_dup(info->svcname);
-	if (name == NULL)
-		return ENOMEM;
-
-	*rname = name;
-	return EOK;
-}
-
-errno_t fdisk_dev_info_capacity(fdisk_dev_info_t *info, capa_spec_t *capa)
-{
-	vbd_disk_info_t vinfo;
-	errno_t rc;
-
-	rc = vbd_disk_info(info->devlist->fdisk->vbd, info->svcid, &vinfo);
-	if (rc != EOK)
-		return EIO;
-
-	capa_from_blocks(vinfo.nblocks, vinfo.block_size, capa);
-	return EOK;
-}
-
-/** Add partition to our inventory. */
-static errno_t fdisk_part_add(fdisk_dev_t *dev, vbd_part_id_t partid,
-    fdisk_part_t **rpart)
-{
-	fdisk_part_t *part;
-	vbd_part_info_t pinfo;
-	vol_part_info_t vpinfo;
-	errno_t rc;
-
-	part = calloc(1, sizeof(fdisk_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	rc = vbd_part_get_info(dev->fdisk->vbd, partid, &pinfo);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (pinfo.svc_id != 0) {
-		/*
-		 * Normally vol service discovers the partition asynchronously.
-		 * Here we need to make sure the partition is already known to it.
-		 */
-		rc = vol_part_add(dev->fdisk->vol, pinfo.svc_id);
-		if (rc != EOK && rc != EEXIST) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = vol_part_info(dev->fdisk->vol, pinfo.svc_id, &vpinfo);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		part->pcnt = vpinfo.pcnt;
-		part->fstype = vpinfo.fstype;
-		part->label = str_dup(vpinfo.label);
-	}
-
-	part->dev = dev;
-	part->index = pinfo.index;
-	part->block0 = pinfo.block0;
-	part->nblocks = pinfo.nblocks;
-	part->pkind = pinfo.pkind;
-	part->svc_id = pinfo.svc_id;
-
-	switch (part->pkind) {
-	case lpk_primary:
-	case lpk_extended:
-		fdisk_pri_part_insert_lists(dev, part);
-		break;
-	case lpk_logical:
-		fdisk_log_part_insert_lists(dev, part);
-		break;
-	}
-
-	list_append(&part->lparts, &dev->parts);
-
-	if (part->pkind == lpk_extended)
-		dev->ext_part = part;
-
-	capa_from_blocks(part->nblocks, dev->dinfo.block_size,
-	    &part->capacity);
-	part->part_id = partid;
-
-	if (rpart != NULL)
-		*rpart = part;
-	return EOK;
-error:
-	if (part != NULL)
-		free(part->label);
-	free(part);
-	return rc;
-}
-
-/** Remove partition from our inventory. */
-static void fdisk_part_remove(fdisk_part_t *part)
-{
-	list_remove(&part->lparts);
-	if (link_used(&part->lpri_ba))
-		list_remove(&part->lpri_ba);
-	if (link_used(&part->lpri_idx))
-		list_remove(&part->lpri_idx);
-	if (link_used(&part->llog_ba))
-		list_remove(&part->llog_ba);
-
-	free(part->label);
-	free(part);
-}
-
-static void fdisk_pri_part_insert_lists(fdisk_dev_t *dev, fdisk_part_t *part)
-{
-	link_t *link;
-	fdisk_part_t *p;
-
-	/* Insert to list by block address */
-	link = list_first(&dev->pri_ba);
-	while (link != NULL) {
-		p = list_get_instance(link, fdisk_part_t, lpri_ba);
-		if (p->block0 > part->block0) {
-			list_insert_before(&part->lpri_ba, &p->lpri_ba);
-			break;
-		}
-
-		link = list_next(link, &dev->pri_ba);
-	}
-
-	if (link == NULL)
-		list_append(&part->lpri_ba, &dev->pri_ba);
-
-	/* Insert to list by index */
-	link = list_first(&dev->pri_idx);
-	while (link != NULL) {
-		p = list_get_instance(link, fdisk_part_t, lpri_idx);
-		if (p->index > part->index) {
-			list_insert_before(&part->lpri_idx, &p->lpri_idx);
-			break;
-		}
-
-		link = list_next(link, &dev->pri_idx);
-	}
-
-	if (link == NULL)
-		list_append(&part->lpri_idx, &dev->pri_idx);
-}
-
-static void fdisk_log_part_insert_lists(fdisk_dev_t *dev, fdisk_part_t *part)
-{
-	link_t *link;
-	fdisk_part_t *p;
-
-	/* Insert to list by block address */
-	link = list_first(&dev->log_ba);
-	while (link != NULL) {
-		p = list_get_instance(link, fdisk_part_t, llog_ba);
-		if (p->block0 > part->block0) {
-			list_insert_before(&part->llog_ba, &p->llog_ba);
-			break;
-		}
-
-		link = list_next(link, &dev->log_ba);
-	}
-
-	if (link == NULL)
-		list_append(&part->llog_ba, &dev->log_ba);
-}
-
-static errno_t fdisk_dev_add_parts(fdisk_dev_t *dev)
-{
-	service_id_t *psids = NULL;
-	size_t nparts, i;
-	errno_t rc;
-
-	rc = fdisk_update_dev_info(dev);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = vbd_label_get_parts(dev->fdisk->vbd, dev->sid, &psids, &nparts);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	for (i = 0; i < nparts; i++) {
-		rc = fdisk_part_add(dev, psids[i], NULL);
-		if (rc != EOK) {
-			goto error;
-		}
-	}
-
-	free(psids);
-	return EOK;
-error:
-	fdisk_dev_remove_parts(dev);
-	return rc;
-}
-
-static void fdisk_dev_remove_parts(fdisk_dev_t *dev)
-{
-	fdisk_part_t *part;
-
-	part = fdisk_part_first(dev);
-	while (part != NULL) {
-		fdisk_part_remove(part);
-		part = fdisk_part_first(dev);
-	}
-}
-
-errno_t fdisk_dev_open(fdisk_t *fdisk, service_id_t sid, fdisk_dev_t **rdev)
-{
-	fdisk_dev_t *dev = NULL;
-	service_id_t *psids = NULL;
-	size_t nparts, i;
-	errno_t rc;
-
-	dev = calloc(1, sizeof(fdisk_dev_t));
-	if (dev == NULL)
-		return ENOMEM;
-
-	dev->fdisk = fdisk;
-	dev->sid = sid;
-	list_initialize(&dev->parts);
-	list_initialize(&dev->pri_idx);
-	list_initialize(&dev->pri_ba);
-	list_initialize(&dev->log_ba);
-
-	rc = fdisk_update_dev_info(dev);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = vbd_label_get_parts(fdisk->vbd, sid, &psids, &nparts);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	for (i = 0; i < nparts; i++) {
-		rc = fdisk_part_add(dev, psids[i], NULL);
-		if (rc != EOK) {
-			goto error;
-		}
-	}
-
-	free(psids);
-	*rdev = dev;
-	return EOK;
-error:
-	fdisk_dev_close(dev);
-	return rc;
-}
-
-void fdisk_dev_close(fdisk_dev_t *dev)
-{
-	if (dev == NULL)
-		return;
-
-	fdisk_dev_remove_parts(dev);
-	free(dev);
-}
-
-/** Erase contents of unlabeled disk. */
-errno_t fdisk_dev_erase(fdisk_dev_t *dev)
-{
-	fdisk_part_t *part;
-	errno_t rc;
-
-	if (dev->dinfo.ltype != lt_none)
-		return EINVAL;
-
-	part = fdisk_part_first(dev);
-	assert(part != NULL);
-	if (part->pcnt == vpc_empty)
-		return EINVAL;
-
-	rc = vol_part_empty(dev->fdisk->vol, part->svc_id);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	part->pcnt = vpc_empty;
-	return EOK;
-}
-
-void fdisk_dev_get_flags(fdisk_dev_t *dev, fdisk_dev_flags_t *rflags)
-{
-	fdisk_dev_flags_t flags;
-	fdisk_part_t *part;
-
-	flags = 0;
-
-	/* fdf_can_create_label */
-	if (dev->dinfo.ltype == lt_none) {
-		part = fdisk_part_first(dev);
-		assert(part != NULL);
-		if (part->pcnt == vpc_empty)
-			flags |= fdf_can_create_label;
-		else
-			flags |= fdf_can_erase_dev;
-	} else {
-		flags |= fdf_can_delete_label;
-	}
-
-	*rflags = flags;
-}
-
-errno_t fdisk_dev_get_svcname(fdisk_dev_t *dev, char **rname)
-{
-	char *name;
-	errno_t rc;
-
-	rc = loc_service_get_name(dev->sid, &name);
-	if (rc != EOK)
-		return rc;
-
-	*rname = name;
-	return EOK;
-}
-
-errno_t fdisk_dev_capacity(fdisk_dev_t *dev, capa_spec_t *capa)
-{
-	capa_from_blocks(dev->dinfo.nblocks, dev->dinfo.block_size, capa);
-	return EOK;
-}
-
-errno_t fdisk_label_get_info(fdisk_dev_t *dev, fdisk_label_info_t *info)
-{
-	vbd_disk_info_t vinfo;
-	uint64_t b0, nb;
-	uint64_t hdrb;
-	errno_t rc;
-
-	rc = vbd_disk_info(dev->fdisk->vbd, dev->sid, &vinfo);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	info->ltype = vinfo.ltype;
-	info->flags = vinfo.flags;
-
-	if ((info->flags & lf_can_create_pri) != 0 ||
-	    (info->flags & lf_can_create_ext) != 0) {
-		/* Verify there is enough space to create partition */
-
-		rc = fdisk_part_get_max_free_range(dev, spc_pri, &b0, &nb);
-		if (rc != EOK)
-			info->flags &= ~(lf_can_create_pri | lf_can_create_ext);
-	}
-
-	if ((info->flags & lf_can_create_log) != 0) {
-		/* Verify there is enough space to create logical partition */
-		hdrb = max(1, dev->align);
-		rc = fdisk_part_get_max_free_range(dev, spc_log, &b0, &nb);
-		if (rc != EOK || nb <= hdrb)
-			info->flags &= ~lf_can_create_log;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-errno_t fdisk_label_create(fdisk_dev_t *dev, label_type_t ltype)
-{
-	fdisk_part_t *part;
-	errno_t rc;
-
-	/* Disk must not contain a label. */
-	if (dev->dinfo.ltype != lt_none)
-		return EEXIST;
-
-	/* Dummy partition spanning entire disk must be considered empty */
-	part = fdisk_part_first(dev);
-	assert(part != NULL);
-	if (part->pcnt != vpc_empty)
-		return EEXIST;
-
-	/* Remove dummy partition */
-	fdisk_dev_remove_parts(dev);
-
-	rc = vbd_label_create(dev->fdisk->vbd, dev->sid, ltype);
-	if (rc != EOK) {
-		/* Re-add dummy partition */
-		(void) fdisk_dev_add_parts(dev);
-		return rc;
-	}
-
-	rc = fdisk_update_dev_info(dev);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-errno_t fdisk_label_destroy(fdisk_dev_t *dev)
-{
-	fdisk_part_t *part;
-	fdisk_dev_flags_t dflags;
-	errno_t rc;
-
-	part = fdisk_part_first(dev);
-	while (part != NULL) {
-		rc = fdisk_part_destroy(part);
-		if (rc != EOK)
-			return EIO;
-		part = fdisk_part_first(dev);
-	}
-
-	rc = vbd_label_delete(dev->fdisk->vbd, dev->sid);
-	if (rc != EOK)
-		return EIO;
-
-	rc = fdisk_dev_add_parts(dev);
-	if (rc != EOK)
-		return rc;
-
-	/* Make sure device is considered empty */
-	fdisk_dev_get_flags(dev, &dflags);
-	if ((dflags & fdf_can_erase_dev) != 0) {
-		rc = fdisk_dev_erase(dev);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-fdisk_part_t *fdisk_part_first(fdisk_dev_t *dev)
-{
-	link_t *link;
-
-	link = list_first(&dev->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, fdisk_part_t, lparts);
-}
-
-fdisk_part_t *fdisk_part_next(fdisk_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->lparts, &part->dev->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, fdisk_part_t, lparts);
-}
-
-errno_t fdisk_part_get_info(fdisk_part_t *part, fdisk_part_info_t *info)
-{
-	info->capacity = part->capacity;
-	info->pcnt = part->pcnt;
-	info->fstype = part->fstype;
-	info->pkind = part->pkind;
-	info->label = part->label;
-	info->svc_id = part->svc_id;
-	return EOK;
-}
-
-/** Get size of largest free block. */
-errno_t fdisk_part_get_max_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
-    capa_spec_t *capa)
-{
-	errno_t rc;
-	uint64_t b0;
-	uint64_t nb;
-	aoff64_t hdrb;
-
-	rc = fdisk_part_get_max_free_range(dev, spc, &b0, &nb);
-	if (rc != EOK)
-		return rc;
-
-	/* For logical partitions we need to subtract header size */
-	if (spc == spc_log) {
-		hdrb = max(1, dev->align);
-		if (nb <= hdrb)
-			return ENOSPC;
-		nb -= hdrb;
-	}
-
-	capa_from_blocks(nb, dev->dinfo.block_size, capa);
-	return EOK;
-}
-
-/** Get total free space capacity. */
-errno_t fdisk_part_get_tot_avail(fdisk_dev_t *dev, fdisk_spc_t spc,
-    capa_spec_t *capa)
-{
-	fdisk_free_range_t fr;
-	uint64_t hdrb;
-	uint64_t b0;
-	uint64_t nb;
-	uint64_t totb;
-
-	if (spc == spc_log)
-		hdrb = max(1, dev->align);
-	else
-		hdrb = 0;
-
-	totb = 0;
-	fdisk_free_range_first(dev, spc, &fr);
-	do {
-		if (fdisk_free_range_get(&fr, &b0, &nb)) {
-			if (nb > hdrb)
-				totb += nb - hdrb;
-		}
-	} while (fdisk_free_range_next(&fr));
-
-	capa_from_blocks(totb, dev->dinfo.block_size, capa);
-	return EOK;
-}
-
-/** Create partition.
- *
- * Create new partition based on a specification.
- *
- * @param dev Fdisk device
- * @param pspec Partition specification
- * @param rpart Place to store pointer to new partition
- *
- * @return EOK on success or error code
- */
-errno_t fdisk_part_create(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
-    fdisk_part_t **rpart)
-{
-	fdisk_part_t *part = NULL;
-	vbd_part_spec_t vpspec;
-	vbd_part_id_t partid = 0;
-	vol_part_info_t vpinfo;
-	const char *label;
-	const char *mountp;
-	errno_t rc;
-
-	label = pspec->label != NULL ? pspec->label : "";
-	mountp = pspec->mountp != NULL ? pspec->mountp : "";
-
-	rc = fdisk_part_spec_prepare(dev, pspec, &vpspec);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = vbd_part_create(dev->fdisk->vbd, dev->sid, &vpspec, &partid);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = fdisk_part_add(dev, partid, &part);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (part->svc_id != 0) {
-		rc = vol_part_mkfs(dev->fdisk->vol, part->svc_id, pspec->fstype,
-		    label, mountp);
-		if (rc != EOK && rc != ENOTSUP) {
-			rc = EIO;
-			goto error;
-		}
-
-		/* Get the real label value */
-		rc = vol_part_info(dev->fdisk->vol, part->svc_id, &vpinfo);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		part->pcnt = vpinfo.pcnt;
-		part->fstype = vpinfo.fstype;
-		part->label = str_dup(vpinfo.label);
-
-		if (part->label == NULL) {
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	if (rpart != NULL)
-		*rpart = part;
-	return EOK;
-error:
-	/* Try rolling back */
-	if (part != NULL)
-		fdisk_part_remove(part);
-	if (partid != 0)
-		(void) vbd_part_delete(dev->fdisk->vbd, partid);
-	return rc;
-}
-
-/** Destroy partition.
- *
- * @param part Partition
- * @return EOK on success or error code
- */
-errno_t fdisk_part_destroy(fdisk_part_t *part)
-{
-	errno_t rc;
-
-	rc = vol_part_eject(part->dev->fdisk->vol, part->svc_id, vef_none);
-	if (rc != EOK)
-		return EIO;
-
-	rc = vbd_part_delete(part->dev->fdisk->vbd, part->part_id);
-	if (rc != EOK)
-		return EIO;
-
-	fdisk_part_remove(part);
-	return EOK;
-}
-
-/** Set partition mount point.
- *
- * @param part Fdisk partition
- * @param mountp Mount point
- *
- * @return EOK on success or error code
- */
-errno_t fdisk_part_set_mountp(fdisk_part_t *part, const char *mountp)
-{
-	return vol_part_set_mountp(part->dev->fdisk->vol,
-	    part->svc_id, mountp);
-}
-
-void fdisk_pspec_init(fdisk_part_spec_t *pspec)
-{
-	memset(pspec, 0, sizeof(fdisk_part_spec_t));
-}
-
-/** Get free partition index. */
-static errno_t fdisk_part_get_free_idx(fdisk_dev_t *dev, int *rindex)
-{
-	link_t *link;
-	fdisk_part_t *part;
-	int nidx;
-
-	link = list_first(&dev->pri_idx);
-	nidx = 1;
-	while (link != NULL) {
-		part = list_get_instance(link, fdisk_part_t, lpri_idx);
-		if (part->index > nidx)
-			break;
-		nidx = part->index + 1;
-		link = list_next(link, &dev->pri_idx);
-	}
-
-	if (nidx > 4 /* XXXX actual number of slots */) {
-		return ELIMIT;
-	}
-
-	*rindex = nidx;
-	return EOK;
-}
-
-/** Get free range of blocks.
- *
- * Get free range of blocks of at least the specified size (first fit).
- */
-static errno_t fdisk_part_get_free_range(fdisk_dev_t *dev, aoff64_t nblocks,
-    fdisk_spc_t spc, aoff64_t *rblock0, aoff64_t *rnblocks)
-{
-	fdisk_free_range_t fr;
-	uint64_t b0;
-	uint64_t nb;
-
-	fdisk_free_range_first(dev, spc, &fr);
-	do {
-		if (fdisk_free_range_get(&fr, &b0, &nb)) {
-			if (nb >= nblocks) {
-				*rblock0 = b0;
-				*rnblocks = nb;
-				return EOK;
-			}
-		}
-	} while (fdisk_free_range_next(&fr));
-
-	/* No conforming free range found */
-	return ENOSPC;
-}
-
-/** Get largest free range of blocks.
- *
- * Get free range of blocks of the maximum size.
- */
-static errno_t fdisk_part_get_max_free_range(fdisk_dev_t *dev, fdisk_spc_t spc,
-    aoff64_t *rblock0, aoff64_t *rnblocks)
-{
-	fdisk_free_range_t fr;
-	uint64_t b0;
-	uint64_t nb;
-	uint64_t best_b0;
-	uint64_t best_nb;
-
-	best_b0 = best_nb = 0;
-	fdisk_free_range_first(dev, spc, &fr);
-	do {
-		if (fdisk_free_range_get(&fr, &b0, &nb)) {
-			if (nb > best_nb) {
-				best_b0 = b0;
-				best_nb = nb;
-			}
-		}
-	} while (fdisk_free_range_next(&fr));
-
-	if (best_nb == 0)
-		return ENOSPC;
-
-	*rblock0 = best_b0;
-	*rnblocks = best_nb;
-	return EOK;
-}
-
-/** Prepare new partition specification for VBD. */
-static errno_t fdisk_part_spec_prepare(fdisk_dev_t *dev, fdisk_part_spec_t *pspec,
-    vbd_part_spec_t *vpspec)
-{
-	aoff64_t nom_blocks;
-	aoff64_t min_blocks;
-	aoff64_t max_blocks;
-	aoff64_t act_blocks;
-	aoff64_t fblock0;
-	aoff64_t fnblocks;
-	aoff64_t hdrb;
-	label_pcnt_t pcnt;
-	fdisk_spc_t spc;
-	int index;
-	errno_t rc;
-
-	rc = capa_to_blocks(&pspec->capacity, cv_nom, dev->dinfo.block_size,
-	    &nom_blocks);
-	if (rc != EOK)
-		return rc;
-
-	rc = capa_to_blocks(&pspec->capacity, cv_min, dev->dinfo.block_size,
-	    &min_blocks);
-	if (rc != EOK)
-		return rc;
-
-	rc = capa_to_blocks(&pspec->capacity, cv_max, dev->dinfo.block_size,
-	    &max_blocks);
-	if (rc != EOK)
-		return rc;
-
-	nom_blocks = fdisk_ba_align_up(dev, nom_blocks);
-	min_blocks = fdisk_ba_align_up(dev, min_blocks);
-	max_blocks = fdisk_ba_align_up(dev, max_blocks);
-
-	pcnt = LPC_LIMIT;
-
-	switch (pspec->fstype) {
-	case fs_exfat:
-		pcnt = lpc_exfat;
-		break;
-	case fs_fat:
-		pcnt = lpc_fat32; /* XXX Detect FAT12/16 vs FAT32 */
-		break;
-	case fs_minix:
-		pcnt = lpc_minix;
-		break;
-	case fs_ext4:
-		pcnt = lpc_ext4;
-		break;
-	case fs_cdfs:
-		return EINVAL; /* You cannot create an ISO partition */
-	}
-
-	if (pcnt == LPC_LIMIT)
-		return EINVAL;
-
-	if (pspec->pkind == lpk_logical) {
-		hdrb = max(1, dev->align);
-		spc = spc_log;
-	} else {
-		hdrb = 0;
-		spc = spc_pri;
-	}
-
-	rc = fdisk_part_get_free_range(dev, hdrb + nom_blocks, spc,
-	    &fblock0, &fnblocks);
-
-	if (rc == EOK) {
-		/*
-		 * If the size of the free range would still give the same capacity
-		 * when rounded, allocate entire range. Otherwise allocate exactly
-		 * what we were asked for.
-		 */
-		if (fnblocks <= max_blocks) {
-			act_blocks = fnblocks;
-		} else {
-			act_blocks = hdrb + nom_blocks;
-		}
-	} else {
-		assert(rc == ENOSPC);
-
-		/*
-		 * There is no free range that can contain exactly the requested
-		 * capacity. Try to allocate at least such number of blocks
-		 * that would still fullfill the request within the limits
-		 * of the precision with witch the capacity was specified
-		 * (i.e. when rounded up).
-		 */
-		rc = fdisk_part_get_free_range(dev, hdrb + min_blocks, spc,
-		    &fblock0, &fnblocks);
-		if (rc != EOK)
-			return rc;
-
-		assert(fnblocks < hdrb + nom_blocks);
-		act_blocks = fnblocks;
-	}
-
-	if (pspec->pkind != lpk_logical) {
-		rc = fdisk_part_get_free_idx(dev, &index);
-		if (rc != EOK)
-			return EIO;
-	} else {
-		index = 0;
-	}
-
-	memset(vpspec, 0, sizeof(vbd_part_spec_t));
-	vpspec->index = index;
-	vpspec->hdr_blocks = hdrb;
-	vpspec->block0 = fblock0 + hdrb;
-	vpspec->nblocks = act_blocks - hdrb;
-	vpspec->pkind = pspec->pkind;
-
-	if (pspec->pkind != lpk_extended) {
-		rc = vbd_suggest_ptype(dev->fdisk->vbd, dev->sid, pcnt,
-		    &vpspec->ptype);
-		if (rc != EOK)
-			return EIO;
-	}
-
-	return EOK;
-}
-
-static errno_t fdisk_update_dev_info(fdisk_dev_t *dev)
-{
-	errno_t rc;
-	size_t align_bytes;
-	uint64_t avail_cap;
-
-	rc = vbd_disk_info(dev->fdisk->vbd, dev->sid, &dev->dinfo);
-	if (rc != EOK)
-		return EIO;
-
-	/* Capacity available for partition in bytes */
-	avail_cap = dev->dinfo.anblocks * dev->dinfo.block_size;
-
-	/* Determine optimum alignment */
-	align_bytes = 1024 * 1024; /* 1 MiB */
-	while (align_bytes > 1 && avail_cap / align_bytes < 256) {
-		align_bytes = align_bytes / 16;
-	}
-
-	dev->align = align_bytes / dev->dinfo.block_size;
-	if (dev->align < 1)
-		dev->align = 1;
-	return EOK;
-}
-
-static uint64_t fdisk_ba_align_up(fdisk_dev_t *dev, uint64_t ba)
-{
-	return ((ba + dev->align - 1) / dev->align) * dev->align;
-}
-
-static uint64_t fdisk_ba_align_down(fdisk_dev_t *dev, uint64_t ba)
-{
-	return ba - (ba % dev->align);
-}
-
-static void fdisk_free_range_first(fdisk_dev_t *dev, fdisk_spc_t spc,
-    fdisk_free_range_t *fr)
-{
-	link_t *link;
-
-	fr->dev = dev;
-	fr->spc = spc;
-
-	if (fr->spc == spc_pri) {
-		/* Primary partitions */
-		fr->b0 = fdisk_ba_align_up(fr->dev, fr->dev->dinfo.ablock0);
-
-		link = list_first(&dev->pri_ba);
-		if (link != NULL)
-			fr->npart = list_get_instance(link, fdisk_part_t, lpri_ba);
-		else
-			fr->npart = NULL;
-	} else { /* fr->spc == spc_log */
-		/* Logical partitions */
-		fr->b0 = fdisk_ba_align_up(fr->dev, fr->dev->ext_part->block0);
-
-		link = list_first(&dev->log_ba);
-		if (link != NULL)
-			fr->npart = list_get_instance(link, fdisk_part_t, llog_ba);
-		else
-			fr->npart = NULL;
-	}
-}
-
-static bool fdisk_free_range_next(fdisk_free_range_t *fr)
-{
-	link_t *link;
-
-	if (fr->npart == NULL)
-		return false;
-
-	fr->b0 = fdisk_ba_align_up(fr->dev, fr->npart->block0 +
-	    fr->npart->nblocks);
-
-	if (fr->spc == spc_pri) {
-		/* Primary partitions */
-		link = list_next(&fr->npart->lpri_ba, &fr->dev->pri_ba);
-		if (link != NULL)
-			fr->npart = list_get_instance(link, fdisk_part_t, lpri_ba);
-		else
-			fr->npart = NULL;
-	} else { /* fr->spc == spc_log */
-		/* Logical partitions */
-		link = list_next(&fr->npart->llog_ba, &fr->dev->log_ba);
-		if (link != NULL)
-			fr->npart = list_get_instance(link, fdisk_part_t, llog_ba);
-		else
-			fr->npart = NULL;
-	}
-
-	return true;
-}
-
-static bool fdisk_free_range_get(fdisk_free_range_t *fr,
-    aoff64_t *b0, aoff64_t *nb)
-{
-	aoff64_t b1;
-
-	if (fr->npart != NULL) {
-		b1 = fdisk_ba_align_down(fr->dev, fr->npart->block0);
-	} else {
-		if (fr->spc == spc_pri) {
-			b1 = fdisk_ba_align_down(fr->dev,
-			    fr->dev->dinfo.ablock0 + fr->dev->dinfo.anblocks);
-		} else { /* fr->spc == spc_log */
-			b1 = fdisk_ba_align_down(fr->dev,
-			    fr->dev->ext_part->block0 + fr->dev->ext_part->nblocks);
-		}
-	}
-
-	if (b1 < fr->b0)
-		return false;
-
-	*b0 = fr->b0;
-	*nb = b1 - fr->b0;
-
-	return true;
-}
-
-/** Get volume label support. */
-errno_t fdisk_get_vollabel_support(fdisk_dev_t *dev, vol_fstype_t fstype,
-    vol_label_supp_t *vlsupp)
-{
-	return vol_part_get_lsupp(dev->fdisk->vol, fstype, vlsupp);
-}
-
-/** @}
- */
Index: pace/lib/fmtutil/fmtutil.c
===================================================================
--- uspace/lib/fmtutil/fmtutil.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,236 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <io/console.h>
-#include <errno.h>
-#include <fmtutil.h>
-#include <stdlib.h>
-#include <str.h>
-
-typedef struct {
-	align_mode_t alignment;
-	bool newline_always;
-	size_t width;
-} printmode_t;
-
-errno_t print_wrapped_console(const char *str, align_mode_t alignment)
-{
-	console_ctrl_t *console = console_init(stdin, stdout);
-	if (console == NULL) {
-		printf("%s", str);
-		return EOK;
-	}
-	sysarg_t con_rows, con_cols, con_col, con_row;
-	errno_t rc = console_get_size(console, &con_cols, &con_rows);
-	if (rc != EOK) {
-		return rc;
-	}
-	rc = console_get_pos(console, &con_col, &con_row);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (con_col != 0) {
-		printf("\n");
-	}
-	return print_wrapped(str, con_cols, alignment);
-}
-
-/** Line consumer that prints the lines aligned according to spec */
-static errno_t print_line(char32_t *wstr, size_t chars, bool last, void *data)
-{
-	printmode_t *pm = (printmode_t *) data;
-	char32_t old_char = wstr[chars];
-	wstr[chars] = 0;
-	errno_t rc = print_aligned_w(wstr, pm->width, last, pm->alignment);
-	wstr[chars] = old_char;
-	return rc;
-}
-
-errno_t print_wrapped(const char *str, size_t width, align_mode_t mode)
-{
-	printmode_t pm;
-	pm.alignment = mode;
-	pm.newline_always = false;
-	pm.width = width;
-	char32_t *wstr = str_to_awstr(str);
-	if (wstr == NULL) {
-		return ENOMEM;
-	}
-	errno_t rc = wrap(wstr, width, print_line, &pm);
-	free(wstr);
-	return rc;
-}
-
-errno_t print_aligned_w(const char32_t *wstr, size_t width, bool last,
-    align_mode_t mode)
-{
-	size_t i;
-	size_t len = wstr_length(wstr);
-	if (mode == ALIGN_LEFT || (mode == ALIGN_JUSTIFY && last)) {
-		for (i = 0; i < width; i++) {
-			if (i < len)
-				putuchar(wstr[i]);
-			else
-				putuchar(' ');
-		}
-	} else if (mode == ALIGN_RIGHT) {
-		for (i = 0; i < width; i++) {
-			if (i < width - len)
-				putuchar(' ');
-			else
-				putuchar(wstr[i - (width - len)]);
-		}
-	} else if (mode == ALIGN_CENTER) {
-		size_t padding = (width - len) / 2;
-		for (i = 0; i < width; i++) {
-			if ((i < padding) || ((i - padding) >= len))
-				putuchar(' ');
-			else
-				putuchar(wstr[i - padding]);
-		}
-	} else if (mode == ALIGN_JUSTIFY) {
-		size_t words = 0;
-		size_t word_chars = 0;
-		bool space = true;
-		for (i = 0; i < len; i++) {
-			if (space && wstr[i] != ' ') {
-				words++;
-			}
-			space = wstr[i] == ' ';
-			if (!space)
-				word_chars++;
-		}
-		size_t done_words = 0;
-		size_t done_chars = 0;
-		if (words == 0)
-			goto skip_words;
-		size_t excess_spaces = width - word_chars - (words - 1);
-		space = true;
-		i = 0;
-		size_t j;
-		while (i < len) {
-			/* Find a word */
-			while (i < len && wstr[i] == ' ')
-				i++;
-			if (i == len)
-				break;
-			if (done_words) {
-				size_t spaces = 1 + (((done_words *
-				    excess_spaces) / (words - 1)) -
-				    (((done_words - 1) * excess_spaces) /
-				    (words - 1)));
-				for (j = 0; j < spaces; j++) {
-					putuchar(' ');
-				}
-				done_chars += spaces;
-			}
-			while (i < len && wstr[i] != ' ') {
-				putuchar(wstr[i++]);
-				done_chars++;
-			}
-			done_words++;
-		}
-	skip_words:
-		while (done_chars < width) {
-			putuchar(' ');
-			done_chars++;
-		}
-	} else {
-		return EINVAL;
-	}
-
-	return EOK;
-}
-errno_t print_aligned(const char *str, size_t width, bool last, align_mode_t mode)
-{
-	char32_t *wstr = str_to_awstr(str);
-	if (wstr == NULL) {
-		return ENOMEM;
-	}
-	errno_t rc = print_aligned_w(wstr, width, last, mode);
-	free(wstr);
-	return rc;
-}
-
-errno_t wrap(char32_t *wstr, size_t width, line_consumer_fn consumer, void *data)
-{
-	size_t word_start = 0;
-	size_t last_word_end = 0;
-	size_t line_start = 0;
-	size_t line_len = 0;
-	size_t pos = 0;
-
-	/*
-	 * Invariants:
-	 *  * line_len = last_word_end - line_start
-	 *  * line_start <= last_word_end <= word_start <= pos
-	 */
-
-	while (wstr[pos] != 0) {
-		/* Skip spaces and process newlines */
-		while (wstr[pos] == ' ' || wstr[pos] == '\n') {
-			if (wstr[pos] == '\n') {
-				consumer(wstr + line_start, line_len, true,
-				    data);
-				last_word_end = line_start = pos + 1;
-				line_len = 0;
-			}
-			pos++;
-		}
-		word_start = pos;
-		/* Find end of word */
-		while (wstr[pos] != 0 && wstr[pos] != ' ' &&
-		    wstr[pos] != '\n')
-			pos++;
-		bool last = wstr[pos] == 0;
-		/* Check if the line still fits width */
-		if (pos - line_start > width) {
-			if (line_len > 0)
-				consumer(wstr + line_start, line_len, last,
-				    data);
-			line_start = last_word_end = word_start;
-			line_len = 0;
-		}
-		/* Check if we need to force wrap of long word */
-		if (pos - word_start > width) {
-			consumer(wstr + word_start, width, last, data);
-			pos = line_start = last_word_end = word_start + width;
-			line_len = 0;
-		}
-		last_word_end = pos;
-		line_len = last_word_end - line_start;
-	}
-	/*
-	 * Here we have less than width chars starting from line_start.
-	 * Moreover, the last portion does not contain spaces or newlines
-	 */
-	if (pos - line_start > 0)
-		consumer(wstr + line_start, pos - line_start, true, data);
-
-	return EOK;
-}
Index: pace/lib/fmtutil/fmtutil.h
===================================================================
--- uspace/lib/fmtutil/fmtutil.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-typedef enum {
-	ALIGN_LEFT,
-	ALIGN_RIGHT,
-	ALIGN_CENTER,
-	ALIGN_JUSTIFY
-} align_mode_t;
-
-/** Callback that processes a line of characters.
- * (e.g. as a result of wrap operation)
- *
- * @param content pointer to line data (note: this is NOT null-terminated)
- * @param size number of characters in line
- * @param end_of_para true if the line is the last line of the paragraph
- * @param data user data
- *
- * @returns EOK on success or an error code on failure
- */
-typedef errno_t (*line_consumer_fn)(char32_t *, size_t, bool, void *);
-
-extern errno_t print_aligned_w(const char32_t *, size_t, bool, align_mode_t);
-extern errno_t print_aligned(const char *, size_t, bool, align_mode_t);
-extern errno_t print_wrapped(const char *, size_t, align_mode_t);
-extern errno_t print_wrapped_console(const char *, align_mode_t);
-
-/** Wrap characters in a wide string to the given length.
- *
- * @param wstr the null-terminated wide string to wrap
- * @param size number of characters to wrap to
- * @param consumer the function that receives wrapped lines
- * @param data user data to pass to the consumer function
- */
-extern errno_t wrap(char32_t *, size_t, line_consumer_fn, void *);
Index: pace/lib/fmtutil/meson.build
===================================================================
--- uspace/lib/fmtutil/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2011 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'console' ]
-src = files('fmtutil.c')
Index: pace/lib/fs/doc/doxygroups.h
===================================================================
--- uspace/lib/fs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libfs libfs
- * @brief Library for implementing file systems
- * @ingroup libs
- */
Index: pace/lib/fs/libfs.c
===================================================================
--- uspace/lib/fs/libfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,908 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfs
- * @{
- */
-/**
- * @file
- * Glue code which is common to all FS implementations.
- */
-
-#include "libfs.h"
-#include <macros.h>
-#include <errno.h>
-#include <async.h>
-#include <as.h>
-#include <assert.h>
-#include <dirent.h>
-#include <mem.h>
-#include <str.h>
-#include <stdlib.h>
-#include <fibril_synch.h>
-#include <ipc/vfs.h>
-#include <vfs/vfs.h>
-
-#define on_error(rc, action) \
-	do { \
-		if ((rc) != EOK) \
-			action; \
-	} while (0)
-
-#define combine_rc(rc1, rc2) \
-	((rc1) == EOK ? (rc2) : (rc1))
-
-#define answer_and_return(call, rc) \
-	do { \
-		async_answer_0((call), (rc)); \
-		return; \
-	} while (0)
-
-static fs_reg_t reg;
-
-static vfs_out_ops_t *vfs_out_ops = NULL;
-static libfs_ops_t *libfs_ops = NULL;
-
-static char fs_name[FS_NAME_MAXLEN + 1];
-
-static void libfs_link(libfs_ops_t *, fs_handle_t, ipc_call_t *);
-static void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_call_t *);
-static void libfs_stat(libfs_ops_t *, fs_handle_t, ipc_call_t *);
-static void libfs_open_node(libfs_ops_t *, fs_handle_t, ipc_call_t *);
-static void libfs_statfs(libfs_ops_t *, fs_handle_t, ipc_call_t *);
-
-static void vfs_out_fsprobe(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	errno_t rc;
-	vfs_fs_probe_info_t info;
-
-	ipc_call_t call;
-	size_t size;
-	if ((!async_data_read_receive(&call, &size)) ||
-	    (size != sizeof(info))) {
-		async_answer_0(&call, EIO);
-		async_answer_0(req, EIO);
-		return;
-	}
-
-	memset(&info, 0, sizeof(info));
-	rc = vfs_out_ops->fsprobe(service_id, &info);
-	if (rc != EOK) {
-		async_answer_0(&call, EIO);
-		async_answer_0(req, rc);
-		return;
-	}
-
-	async_data_read_finalize(&call, &info, sizeof(info));
-	async_answer_0(req, EOK);
-}
-
-static void vfs_out_mounted(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	char *opts;
-	errno_t rc;
-
-	/* Accept the mount options. */
-	rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(req, rc);
-		return;
-	}
-
-	fs_index_t index;
-	aoff64_t size;
-	rc = vfs_out_ops->mounted(service_id, opts, &index, &size);
-
-	if (rc == EOK) {
-		async_answer_3(req, EOK, index, LOWER32(size),
-		    UPPER32(size));
-	} else
-		async_answer_0(req, rc);
-
-	free(opts);
-}
-
-static void vfs_out_unmounted(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	errno_t rc;
-
-	rc = vfs_out_ops->unmounted(service_id);
-
-	async_answer_0(req, rc);
-}
-
-static void vfs_out_link(ipc_call_t *req)
-{
-	libfs_link(libfs_ops, reg.fs_handle, req);
-}
-
-static void vfs_out_lookup(ipc_call_t *req)
-{
-	libfs_lookup(libfs_ops, reg.fs_handle, req);
-}
-
-static void vfs_out_read(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	aoff64_t pos = (aoff64_t) MERGE_LOUP32(ipc_get_arg3(req),
-	    ipc_get_arg4(req));
-	size_t rbytes;
-	errno_t rc;
-
-	rc = vfs_out_ops->read(service_id, index, pos, &rbytes);
-
-	if (rc == EOK)
-		async_answer_1(req, EOK, rbytes);
-	else
-		async_answer_0(req, rc);
-}
-
-static void vfs_out_write(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	aoff64_t pos = (aoff64_t) MERGE_LOUP32(ipc_get_arg3(req),
-	    ipc_get_arg4(req));
-	size_t wbytes;
-	aoff64_t nsize;
-	errno_t rc;
-
-	rc = vfs_out_ops->write(service_id, index, pos, &wbytes, &nsize);
-
-	if (rc == EOK) {
-		async_answer_3(req, EOK, wbytes, LOWER32(nsize),
-		    UPPER32(nsize));
-	} else
-		async_answer_0(req, rc);
-}
-
-static void vfs_out_truncate(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	aoff64_t size = (aoff64_t) MERGE_LOUP32(ipc_get_arg3(req),
-	    ipc_get_arg4(req));
-	errno_t rc;
-
-	rc = vfs_out_ops->truncate(service_id, index, size);
-
-	async_answer_0(req, rc);
-}
-
-static void vfs_out_close(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	errno_t rc;
-
-	rc = vfs_out_ops->close(service_id, index);
-
-	async_answer_0(req, rc);
-}
-
-static void vfs_out_destroy(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-
-	errno_t rc;
-	fs_node_t *node = NULL;
-	rc = libfs_ops->node_get(&node, service_id, index);
-	if (rc == EOK && node != NULL) {
-		bool destroy = (libfs_ops->lnkcnt_get(node) == 0);
-		libfs_ops->node_put(node);
-		if (destroy)
-			rc = vfs_out_ops->destroy(service_id, index);
-	}
-	async_answer_0(req, rc);
-}
-
-static void vfs_out_open_node(ipc_call_t *req)
-{
-	libfs_open_node(libfs_ops, reg.fs_handle, req);
-}
-
-static void vfs_out_stat(ipc_call_t *req)
-{
-	libfs_stat(libfs_ops, reg.fs_handle, req);
-}
-
-static void vfs_out_sync(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	errno_t rc;
-
-	rc = vfs_out_ops->sync(service_id, index);
-
-	async_answer_0(req, rc);
-}
-
-static void vfs_out_statfs(ipc_call_t *req)
-{
-	libfs_statfs(libfs_ops, reg.fs_handle, req);
-}
-
-static void vfs_out_is_empty(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-	errno_t rc;
-
-	fs_node_t *node = NULL;
-	rc = libfs_ops->node_get(&node, service_id, index);
-	if (rc != EOK)
-		async_answer_0(req, rc);
-	if (node == NULL)
-		async_answer_0(req, EINVAL);
-
-	bool children = false;
-	rc = libfs_ops->has_children(&children, node);
-	libfs_ops->node_put(node);
-
-	if (rc != EOK)
-		async_answer_0(req, rc);
-	async_answer_0(req, children ? ENOTEMPTY : EOK);
-}
-
-static void vfs_connection(ipc_call_t *icall, void *arg)
-{
-	if (icall->cap_handle) {
-		/*
-		 * This only happens for connections opened by
-		 * IPC_M_CONNECT_ME_TO calls as opposed to callback connections
-		 * created by IPC_M_CONNECT_TO_ME.
-		 */
-		async_accept_0(icall);
-	}
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case VFS_OUT_FSPROBE:
-			vfs_out_fsprobe(&call);
-			break;
-		case VFS_OUT_MOUNTED:
-			vfs_out_mounted(&call);
-			break;
-		case VFS_OUT_UNMOUNTED:
-			vfs_out_unmounted(&call);
-			break;
-		case VFS_OUT_LINK:
-			vfs_out_link(&call);
-			break;
-		case VFS_OUT_LOOKUP:
-			vfs_out_lookup(&call);
-			break;
-		case VFS_OUT_READ:
-			vfs_out_read(&call);
-			break;
-		case VFS_OUT_WRITE:
-			vfs_out_write(&call);
-			break;
-		case VFS_OUT_TRUNCATE:
-			vfs_out_truncate(&call);
-			break;
-		case VFS_OUT_CLOSE:
-			vfs_out_close(&call);
-			break;
-		case VFS_OUT_DESTROY:
-			vfs_out_destroy(&call);
-			break;
-		case VFS_OUT_OPEN_NODE:
-			vfs_out_open_node(&call);
-			break;
-		case VFS_OUT_STAT:
-			vfs_out_stat(&call);
-			break;
-		case VFS_OUT_SYNC:
-			vfs_out_sync(&call);
-			break;
-		case VFS_OUT_STATFS:
-			vfs_out_statfs(&call);
-			break;
-		case VFS_OUT_IS_EMPTY:
-			vfs_out_is_empty(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-}
-
-/** Register file system server.
- *
- * This function abstracts away the tedious registration protocol from
- * file system implementations and lets them to reuse this registration glue
- * code.
- *
- * @param sess Session for communication with VFS.
- * @param info VFS info structure supplied by the file system
- *             implementation.
- * @param vops Address of the vfs_out_ops_t structure.
- * @param lops Address of the libfs_ops_t structure.
- *
- * @return EOK on success or a non-zero error code on errror.
- *
- */
-errno_t fs_register(async_sess_t *sess, vfs_info_t *info, vfs_out_ops_t *vops,
-    libfs_ops_t *lops)
-{
-	/*
-	 * Tell VFS that we are here and want to get registered.
-	 * We use the async framework because VFS will answer the request
-	 * out-of-order, when it knows that the operation succeeded or failed.
-	 */
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, VFS_IN_REGISTER, &answer);
-
-	/*
-	 * Send our VFS info structure to VFS.
-	 */
-	errno_t rc = async_data_write_start(exch, info, sizeof(*info));
-
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	/*
-	 * Set VFS_OUT and libfs operations.
-	 */
-	vfs_out_ops = vops;
-	libfs_ops = lops;
-
-	str_cpy(fs_name, sizeof(fs_name), info->name);
-
-	/*
-	 * Ask VFS for callback connection.
-	 */
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_VFS_DRIVER_CB, 0, 0,
-	    vfs_connection, NULL, &port);
-
-	/*
-	 * Request sharing the Path Lookup Buffer with VFS.
-	 */
-	rc = async_share_in_start_0_0(exch, PLB_SIZE, (void *) &reg.plb_ro);
-	if (reg.plb_ro == AS_MAP_FAILED) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	async_exchange_end(exch);
-
-	if (rc) {
-		async_forget(req);
-		return rc;
-	}
-
-	/*
-	 * Pick up the answer for the request to the VFS_IN_REQUEST call.
-	 */
-	async_wait_for(req, NULL);
-	reg.fs_handle = (int) ipc_get_arg1(&answer);
-
-	return ipc_get_retval(&answer);
-}
-
-void fs_node_initialize(fs_node_t *fn)
-{
-	memset(fn, 0, sizeof(fs_node_t));
-}
-
-static char plb_get_char(unsigned pos)
-{
-	return reg.plb_ro[pos % PLB_SIZE];
-}
-
-static errno_t plb_get_component(char *dest, unsigned *sz, unsigned *ppos,
-    unsigned last)
-{
-	unsigned pos = *ppos;
-	unsigned size = 0;
-
-	if (pos == last) {
-		*sz = 0;
-		return ERANGE;
-	}
-
-	char c = plb_get_char(pos);
-	if (c == '/')
-		pos++;
-
-	for (int i = 0; i <= NAME_MAX; i++) {
-		c = plb_get_char(pos);
-		if (pos == last || c == '/') {
-			dest[i] = 0;
-			*ppos = pos;
-			*sz = size;
-			return EOK;
-		}
-		dest[i] = c;
-		pos++;
-		size++;
-	}
-	return ENAMETOOLONG;
-}
-
-static errno_t receive_fname(char *buffer)
-{
-	ipc_call_t call;
-	size_t size;
-
-	if (!async_data_write_receive(&call, &size))
-		return ENOENT;
-
-	if (size > NAME_MAX + 1) {
-		async_answer_0(&call, ERANGE);
-		return ERANGE;
-	}
-
-	return async_data_write_finalize(&call, buffer, size);
-}
-
-/** Link a file at a path.
- *
- */
-void libfs_link(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_call_t *req)
-{
-	service_id_t parent_sid = ipc_get_arg1(req);
-	fs_index_t parent_index = ipc_get_arg2(req);
-	fs_index_t child_index = ipc_get_arg3(req);
-
-	char component[NAME_MAX + 1];
-	errno_t rc = receive_fname(component);
-	if (rc != EOK) {
-		async_answer_0(req, rc);
-		return;
-	}
-
-	fs_node_t *parent = NULL;
-	rc = ops->node_get(&parent, parent_sid, parent_index);
-	if (parent == NULL) {
-		async_answer_0(req, rc == EOK ? EBADF : rc);
-		return;
-	}
-
-	fs_node_t *child = NULL;
-	rc = ops->node_get(&child, parent_sid, child_index);
-	if (child == NULL) {
-		async_answer_0(req, rc == EOK ? EBADF : rc);
-		ops->node_put(parent);
-		return;
-	}
-
-	rc = ops->link(parent, child, component);
-	ops->node_put(parent);
-	ops->node_put(child);
-	async_answer_0(req, rc);
-}
-
-/** Lookup VFS triplet by name in the file system name space.
- *
- * The path passed in the PLB must be in the canonical file system path format
- * as returned by the canonify() function.
- *
- * @param ops       libfs operations structure with function pointers to
- *                  file system implementation
- * @param fs_handle File system handle of the file system where to perform
- *                  the lookup.
- * @param req       VFS_OUT_LOOKUP request data itself.
- *
- */
-void libfs_lookup(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_call_t *req)
-{
-	unsigned first = ipc_get_arg1(req);
-	unsigned len = ipc_get_arg2(req);
-	service_id_t service_id = ipc_get_arg3(req);
-	fs_index_t index = ipc_get_arg4(req);
-	int lflag = ipc_get_arg5(req);
-
-	// TODO: Validate flags.
-
-	unsigned next = first;
-	unsigned last = first + len;
-
-	char component[NAME_MAX + 1];
-	errno_t rc;
-
-	fs_node_t *par = NULL;
-	fs_node_t *cur = NULL;
-	fs_node_t *tmp = NULL;
-	unsigned clen = 0;
-
-	rc = ops->node_get(&cur, service_id, index);
-	if (rc != EOK) {
-		async_answer_0(req, rc);
-		goto out;
-	}
-
-	assert(cur != NULL);
-
-	/* Find the file and its parent. */
-
-	unsigned last_next = 0;
-
-	while (next != last) {
-		if (cur == NULL) {
-			assert(par != NULL);
-			goto out1;
-		}
-
-		if (!ops->is_directory(cur)) {
-			async_answer_0(req, ENOTDIR);
-			goto out;
-		}
-
-		last_next = next;
-		/* Collect the component */
-		rc = plb_get_component(component, &clen, &next, last);
-		assert(rc != ERANGE);
-		if (rc != EOK) {
-			async_answer_0(req, rc);
-			goto out;
-		}
-
-		if (clen == 0) {
-			/* The path is just "/". */
-			break;
-		}
-
-		assert(component[clen] == 0);
-
-		/* Match the component */
-		rc = ops->match(&tmp, cur, component);
-		if (rc != EOK) {
-			async_answer_0(req, rc);
-			goto out;
-		}
-
-		/* Descend one level */
-		if (par) {
-			rc = ops->node_put(par);
-			if (rc != EOK) {
-				async_answer_0(req, rc);
-				goto out;
-			}
-		}
-
-		par = cur;
-		cur = tmp;
-		tmp = NULL;
-	}
-
-	/*
-	 * At this point, par is either NULL or a directory.
-	 * If cur is NULL, the looked up file does not exist yet.
-	 */
-
-	assert(par == NULL || ops->is_directory(par));
-	assert(par != NULL || cur != NULL);
-
-	/* Check for some error conditions. */
-
-	if (cur && (lflag & L_FILE) && (ops->is_directory(cur))) {
-		async_answer_0(req, EISDIR);
-		goto out;
-	}
-
-	if (cur && (lflag & L_DIRECTORY) && (ops->is_file(cur))) {
-		async_answer_0(req, ENOTDIR);
-		goto out;
-	}
-
-	/* Unlink. */
-
-	if (lflag & L_UNLINK) {
-		if (!cur) {
-			async_answer_0(req, ENOENT);
-			goto out;
-		}
-		if (!par) {
-			async_answer_0(req, EINVAL);
-			goto out;
-		}
-
-		rc = ops->unlink(par, cur, component);
-		if (rc == EOK) {
-			aoff64_t size = ops->size_get(cur);
-			async_answer_5(req, EOK, fs_handle,
-			    ops->index_get(cur),
-			    (ops->is_directory(cur) << 16) | last,
-			    LOWER32(size), UPPER32(size));
-		} else {
-			async_answer_0(req, rc);
-		}
-		goto out;
-	}
-
-	/* Create. */
-
-	if (lflag & L_CREATE) {
-		if (cur && (lflag & L_EXCLUSIVE)) {
-			async_answer_0(req, EEXIST);
-			goto out;
-		}
-
-		if (!cur) {
-			rc = ops->create(&cur, service_id,
-			    lflag & (L_FILE | L_DIRECTORY));
-			if (rc != EOK) {
-				async_answer_0(req, rc);
-				goto out;
-			}
-			if (!cur) {
-				async_answer_0(req, ENOSPC);
-				goto out;
-			}
-
-			rc = ops->link(par, cur, component);
-			if (rc != EOK) {
-				(void) ops->destroy(cur);
-				cur = NULL;
-				async_answer_0(req, rc);
-				goto out;
-			}
-		}
-	}
-
-	/* Return. */
-out1:
-	if (!cur) {
-		async_answer_5(req, EOK, fs_handle, ops->index_get(par),
-		    (ops->is_directory(par) << 16) | last_next,
-		    LOWER32(ops->size_get(par)), UPPER32(ops->size_get(par)));
-		goto out;
-	}
-
-	async_answer_5(req, EOK, fs_handle, ops->index_get(cur),
-	    (ops->is_directory(cur) << 16) | last, LOWER32(ops->size_get(cur)),
-	    UPPER32(ops->size_get(cur)));
-
-out:
-	if (par)
-		(void) ops->node_put(par);
-
-	if (cur)
-		(void) ops->node_put(cur);
-
-	if (tmp)
-		(void) ops->node_put(tmp);
-}
-
-void libfs_stat(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-
-	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
-	on_error(rc, answer_and_return(req, rc));
-
-	ipc_call_t call;
-	size_t size;
-	if ((!async_data_read_receive(&call, &size)) ||
-	    (size != sizeof(vfs_stat_t))) {
-		ops->node_put(fn);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	vfs_stat_t stat;
-	memset(&stat, 0, sizeof(vfs_stat_t));
-
-	stat.fs_handle = fs_handle;
-	stat.service_id = service_id;
-	stat.index = index;
-	stat.lnkcnt = ops->lnkcnt_get(fn);
-	stat.is_file = ops->is_file(fn);
-	stat.is_directory = ops->is_directory(fn);
-	stat.size = ops->size_get(fn);
-	stat.service = ops->service_get(fn);
-
-	ops->node_put(fn);
-
-	async_data_read_finalize(&call, &stat, sizeof(vfs_stat_t));
-	async_answer_0(req, EOK);
-}
-
-void libfs_statfs(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	fs_index_t index = (fs_index_t) ipc_get_arg2(req);
-
-	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
-	on_error(rc, answer_and_return(req, rc));
-
-	ipc_call_t call;
-	size_t size;
-	if ((!async_data_read_receive(&call, &size)) ||
-	    (size != sizeof(vfs_statfs_t))) {
-		goto error;
-	}
-
-	vfs_statfs_t st;
-	memset(&st, 0, sizeof(vfs_statfs_t));
-
-	str_cpy(st.fs_name, sizeof(st.fs_name), fs_name);
-
-	if (ops->size_block != NULL) {
-		rc = ops->size_block(service_id, &st.f_bsize);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (ops->total_block_count != NULL) {
-		rc = ops->total_block_count(service_id, &st.f_blocks);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (ops->free_block_count != NULL) {
-		rc = ops->free_block_count(service_id, &st.f_bfree);
-		if (rc != EOK)
-			goto error;
-	}
-
-	ops->node_put(fn);
-	async_data_read_finalize(&call, &st, sizeof(vfs_statfs_t));
-	async_answer_0(req, EOK);
-	return;
-
-error:
-	ops->node_put(fn);
-	async_answer_0(&call, EINVAL);
-	async_answer_0(req, EINVAL);
-}
-
-/** Open VFS triplet.
- *
- * @param ops libfs operations structure with function pointers to
- *            file system implementation
- * @param req VFS_OUT_OPEN_NODE request data itself.
- *
- */
-void libfs_open_node(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_call_t *req)
-{
-	service_id_t service_id = ipc_get_arg1(req);
-	fs_index_t index = ipc_get_arg2(req);
-
-	fs_node_t *fn;
-	errno_t rc = ops->node_get(&fn, service_id, index);
-	on_error(rc, answer_and_return(req, rc));
-
-	if (fn == NULL) {
-		async_answer_0(req, ENOENT);
-		return;
-	}
-
-	rc = ops->node_open(fn);
-	aoff64_t size = ops->size_get(fn);
-	async_answer_4(req, rc, LOWER32(size), UPPER32(size),
-	    ops->lnkcnt_get(fn),
-	    (ops->is_file(fn) ? L_FILE : 0) |
-	    (ops->is_directory(fn) ? L_DIRECTORY : 0));
-
-	(void) ops->node_put(fn);
-}
-
-static FIBRIL_MUTEX_INITIALIZE(instances_mutex);
-static LIST_INITIALIZE(instances_list);
-
-typedef struct {
-	service_id_t service_id;
-	link_t link;
-	void *data;
-} fs_instance_t;
-
-errno_t fs_instance_create(service_id_t service_id, void *data)
-{
-	fs_instance_t *inst = malloc(sizeof(fs_instance_t));
-	if (!inst)
-		return ENOMEM;
-
-	link_initialize(&inst->link);
-	inst->service_id = service_id;
-	inst->data = data;
-
-	fibril_mutex_lock(&instances_mutex);
-	list_foreach(instances_list, link, fs_instance_t, cur) {
-		if (cur->service_id == service_id) {
-			fibril_mutex_unlock(&instances_mutex);
-			free(inst);
-			return EEXIST;
-		}
-
-		/* keep the list sorted */
-		if (cur->service_id < service_id) {
-			list_insert_before(&inst->link, &cur->link);
-			fibril_mutex_unlock(&instances_mutex);
-			return EOK;
-		}
-	}
-	list_append(&inst->link, &instances_list);
-	fibril_mutex_unlock(&instances_mutex);
-
-	return EOK;
-}
-
-errno_t fs_instance_get(service_id_t service_id, void **idp)
-{
-	fibril_mutex_lock(&instances_mutex);
-
-	list_foreach(instances_list, link, fs_instance_t, inst) {
-		if (inst->service_id == service_id) {
-			*idp = inst->data;
-			fibril_mutex_unlock(&instances_mutex);
-			return EOK;
-		}
-	}
-
-	fibril_mutex_unlock(&instances_mutex);
-	return ENOENT;
-}
-
-errno_t fs_instance_destroy(service_id_t service_id)
-{
-	fibril_mutex_lock(&instances_mutex);
-
-	list_foreach(instances_list, link, fs_instance_t, inst) {
-		if (inst->service_id == service_id) {
-			list_remove(&inst->link);
-			fibril_mutex_unlock(&instances_mutex);
-			free(inst);
-			return EOK;
-		}
-	}
-
-	fibril_mutex_unlock(&instances_mutex);
-	return ENOENT;
-}
-
-/** @}
- */
Index: pace/lib/fs/libfs.h
===================================================================
--- uspace/lib/fs/libfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2009 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libfs
- * @{
- */
-/**
- * @file
- */
-
-#ifndef LIBFS_LIBFS_H_
-#define LIBFS_LIBFS_H_
-
-#include <ipc/vfs.h>
-#include <offset.h>
-#include <async.h>
-#include <loc.h>
-
-typedef struct {
-	errno_t (*fsprobe)(service_id_t, vfs_fs_probe_info_t *);
-	errno_t (*mounted)(service_id_t, const char *, fs_index_t *, aoff64_t *);
-	errno_t (*unmounted)(service_id_t);
-	errno_t (*read)(service_id_t, fs_index_t, aoff64_t, size_t *);
-	errno_t (*write)(service_id_t, fs_index_t, aoff64_t, size_t *,
-	    aoff64_t *);
-	errno_t (*truncate)(service_id_t, fs_index_t, aoff64_t);
-	errno_t (*close)(service_id_t, fs_index_t);
-	errno_t (*destroy)(service_id_t, fs_index_t);
-	errno_t (*sync)(service_id_t, fs_index_t);
-} vfs_out_ops_t;
-
-typedef struct {
-	void *data;         /**< Data of the file system implementation. */
-} fs_node_t;
-
-typedef struct {
-	/*
-	 * The first set of methods are functions that return an integer error
-	 * code. If some additional return value is to be returned, the first
-	 * argument holds the output argument.
-	 */
-	errno_t (*root_get)(fs_node_t **, service_id_t);
-	errno_t (*match)(fs_node_t **, fs_node_t *, const char *);
-	errno_t (*node_get)(fs_node_t **, service_id_t, fs_index_t);
-	errno_t (*node_open)(fs_node_t *);
-	errno_t (*node_put)(fs_node_t *);
-	errno_t (*create)(fs_node_t **, service_id_t, int);
-	errno_t (*destroy)(fs_node_t *);
-	errno_t (*link)(fs_node_t *, fs_node_t *, const char *);
-	errno_t (*unlink)(fs_node_t *, fs_node_t *, const char *);
-	errno_t (*has_children)(bool *, fs_node_t *);
-	/*
-	 * The second set of methods are usually mere getters that do not
-	 * return an integer error code.
-	 */
-	fs_index_t (*index_get)(fs_node_t *);
-	aoff64_t (*size_get)(fs_node_t *);
-	unsigned int (*lnkcnt_get)(fs_node_t *);
-	bool (*is_directory)(fs_node_t *);
-	bool (*is_file)(fs_node_t *);
-	service_id_t (*service_get)(fs_node_t *);
-	errno_t (*size_block)(service_id_t, uint32_t *);
-	errno_t (*total_block_count)(service_id_t, uint64_t *);
-	errno_t (*free_block_count)(service_id_t, uint64_t *);
-} libfs_ops_t;
-
-typedef struct {
-	int fs_handle;           /**< File system handle. */
-	uint8_t *plb_ro;         /**< Read-only PLB view. */
-} fs_reg_t;
-
-extern errno_t fs_register(async_sess_t *, vfs_info_t *, vfs_out_ops_t *,
-    libfs_ops_t *);
-
-extern void fs_node_initialize(fs_node_t *);
-
-extern errno_t fs_instance_create(service_id_t, void *);
-extern errno_t fs_instance_get(service_id_t, void **);
-extern errno_t fs_instance_destroy(service_id_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/fs/meson.build
===================================================================
--- uspace/lib/fs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('libfs.c')
Index: pace/lib/futil/doc/doxygroups.h
===================================================================
--- uspace/lib/futil/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libfutil libfutil
- * @ingroup libs
- */
Index: pace/lib/futil/include/futil.h
===================================================================
--- uspace/lib/futil/include/futil.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup futil
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef FUTIL_H
-#define FUTIL_H
-
-#include <errno.h>
-#include <stddef.h>
-#include "types/futil.h"
-
-extern errno_t futil_create(futil_cb_t *, void *, futil_t **);
-extern void futil_destroy(futil_t *);
-extern errno_t futil_copy_file(futil_t *, const char *, const char *);
-extern errno_t futil_rcopy_contents(futil_t *, const char *, const char *);
-extern errno_t futil_get_file(futil_t *, const char *, void **, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/futil/include/types/futil.h
===================================================================
--- uspace/lib/futil/include/types/futil.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup futil
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef TYPES_FUTIL_H
-#define TYPES_FUTIL_H
-
-/** File utility callbacks */
-typedef struct {
-	/** Copying file */
-	void (*copy_file)(void *, const char *, const char *);
-	/** Creating directory */
-	void (*create_dir)(void *, const char *);
-} futil_cb_t;
-
-typedef struct {
-	/** Callback functions */
-	futil_cb_t *cb;
-	/** Argument to callback functions */
-	void *cb_arg;
-} futil_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/futil/meson.build
===================================================================
--- uspace/lib/futil/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/futil.c'
-)
Index: pace/lib/futil/src/futil.c
===================================================================
--- uspace/lib/futil/src/futil.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup futil
- * @{
- */
-/** @file File manipulation utility functions
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <vfs/vfs.h>
-#include <dirent.h>
-
-#include "futil.h"
-
-#define BUF_SIZE 16384
-static char buf[BUF_SIZE];
-
-/** Create file utility instance.
- *
- * @param cb Callback functions
- * @param arg Argument to callback functions
- * @param rfutil Place to store pointer to new file utility instance
- * @return EOK on succcess, ENOMEM if out of memory.
- */
-errno_t futil_create(futil_cb_t *cb, void *arg, futil_t **rfutil)
-{
-	futil_t *futil;
-
-	futil = calloc(1, sizeof(futil_t));
-	if (futil == NULL)
-		return ENOMEM;
-
-	futil->cb = cb;
-	futil->cb_arg = arg;
-	*rfutil = futil;
-	return EOK;
-}
-
-/** Destroy file utility instance.
- *
- * @param futil File utility instance
- */
-void futil_destroy(futil_t *futil)
-{
-	free(futil);
-}
-
-/** Copy file.
- *
- * @param futil File utility instance
- * @param srcp Source path
- * @param dstp Destination path
- *
- * @return EOK on success, EIO on I/O error
- */
-errno_t futil_copy_file(futil_t *futil, const char *srcp, const char *destp)
-{
-	int sf, df;
-	size_t nr, nw;
-	errno_t rc;
-	aoff64_t posr = 0, posw = 0;
-
-	if (futil->cb != NULL && futil->cb->copy_file != NULL)
-		futil->cb->copy_file(futil->cb_arg, srcp, destp);
-
-	rc = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ, &sf);
-	if (rc != EOK)
-		return EIO;
-
-	rc = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE, &df);
-	if (rc != EOK)
-		return EIO;
-
-	do {
-		rc = vfs_read(sf, &posr, buf, BUF_SIZE, &nr);
-		if (rc != EOK)
-			goto error;
-		if (nr == 0)
-			break;
-
-		rc = vfs_write(df, &posw, buf, nr, &nw);
-		if (rc != EOK)
-			goto error;
-
-	} while (nr == BUF_SIZE);
-
-	(void) vfs_put(sf);
-
-	rc = vfs_put(df);
-	if (rc != EOK)
-		return EIO;
-
-	return EOK;
-error:
-	vfs_put(sf);
-	vfs_put(df);
-	return rc;
-}
-
-/** Copy contents of srcdir (recursively) into destdir.
- *
- * @param futil File utility instance
- * @param srcdir Source directory
- * @param destdir Destination directory
- *
- * @return EOK on success, ENOMEM if out of memory, EIO on I/O error
- */
-errno_t futil_rcopy_contents(futil_t *futil, const char *srcdir,
-    const char *destdir)
-{
-	DIR *dir;
-	struct dirent *de;
-	vfs_stat_t s;
-	char *srcp, *destp;
-	errno_t rc;
-
-	dir = opendir(srcdir);
-	if (dir == NULL)
-		return EIO;
-
-	de = readdir(dir);
-	while (de != NULL) {
-		if (asprintf(&srcp, "%s/%s", srcdir, de->d_name) < 0)
-			return ENOMEM;
-		if (asprintf(&destp, "%s/%s", destdir, de->d_name) < 0)
-			return ENOMEM;
-
-		rc = vfs_stat_path(srcp, &s);
-		if (rc != EOK)
-			return EIO;
-
-		if (s.is_file) {
-			rc = futil_copy_file(futil, srcp, destp);
-			if (rc != EOK)
-				return EIO;
-		} else if (s.is_directory) {
-			if (futil->cb != NULL && futil->cb->create_dir != NULL)
-				futil->cb->create_dir(futil->cb_arg, destp);
-			rc = vfs_link_path(destp, KIND_DIRECTORY, NULL);
-			if (rc != EOK)
-				return EIO;
-			rc = futil_rcopy_contents(futil, srcp, destp);
-			if (rc != EOK)
-				return EIO;
-		} else {
-			return EIO;
-		}
-
-		de = readdir(dir);
-	}
-
-	return EOK;
-}
-
-/** Return file contents as a heap-allocated block of bytes.
- *
- * @param futil File utility instance
- * @param srcp File path
- * @param rdata Place to store pointer to data
- * @param rsize Place to store size of data
- *
- * @return EOK on success, ENOENT if failed to open file, EIO on other
- *         I/O error, ENOMEM if out of memory
- */
-errno_t futil_get_file(futil_t *futil, const char *srcp, void **rdata,
-    size_t *rsize)
-{
-	int sf;
-	size_t nr;
-	errno_t rc;
-	size_t fsize;
-	char *data;
-	vfs_stat_t st;
-
-	rc = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ, &sf);
-	if (rc != EOK)
-		return ENOENT;
-
-	if (vfs_stat(sf, &st) != EOK) {
-		vfs_put(sf);
-		return EIO;
-	}
-
-	fsize = st.size;
-
-	data = calloc(fsize, 1);
-	if (data == NULL) {
-		vfs_put(sf);
-		return ENOMEM;
-	}
-
-	rc = vfs_read(sf, (aoff64_t []) { 0 }, data, fsize, &nr);
-	if (rc != EOK || nr != fsize) {
-		vfs_put(sf);
-		free(data);
-		return EIO;
-	}
-
-	(void) vfs_put(sf);
-	*rdata = data;
-	*rsize = fsize;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfx/doc/doxygroups.h
===================================================================
--- uspace/lib/gfx/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libgfx libgfx
- * @ingroup libs
- */
Index: pace/lib/gfx/include/gfx/bitmap.h
===================================================================
--- uspace/lib/gfx/include/gfx/bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Bitmap
- */
-
-#ifndef _GFX_BITMAP_H
-#define _GFX_BITMAP_H
-
-#include <errno.h>
-#include <types/gfx/context.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/bitmap.h>
-
-extern void gfx_bitmap_params_init(gfx_bitmap_params_t *);
-extern errno_t gfx_bitmap_create(gfx_context_t *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, gfx_bitmap_t **);
-extern errno_t gfx_bitmap_destroy(gfx_bitmap_t *);
-extern errno_t gfx_bitmap_render(gfx_bitmap_t *, gfx_rect_t *, gfx_coord2_t *);
-extern errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *, gfx_bitmap_alloc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/gfx/color.h
===================================================================
--- uspace/lib/gfx/include/gfx/color.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Color operations
- */
-
-#ifndef _GFX_COLOR_H
-#define _GFX_COLOR_H
-
-#include <errno.h>
-#include <stdint.h>
-#include <types/gfx/color.h>
-
-extern errno_t gfx_color_new_rgb_i16(uint16_t, uint16_t,
-    uint16_t, gfx_color_t **);
-extern errno_t gfx_color_new_ega(uint8_t, gfx_color_t **);
-extern void gfx_color_delete(gfx_color_t *);
-extern void gfx_color_get_rgb_i16(gfx_color_t *, uint16_t *, uint16_t *,
-    uint16_t *);
-extern void gfx_color_get_ega(gfx_color_t *, uint8_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/gfx/context.h
===================================================================
--- uspace/lib/gfx/include/gfx/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphic context
- *
- * A graphics context is the target of rendering operations. It can carry
- * some additional state (hence context). It is an abstract interface,
- * to be implemented by various backends (drivers).
- */
-
-#ifndef _GFX_CONTEXT_H
-#define _GFX_CONTEXT_H
-
-#include <errno.h>
-#include <types/gfx/context.h>
-#include <types/gfx/ops/context.h>
-
-extern errno_t gfx_context_new(gfx_context_ops_t *, void *,
-    gfx_context_t **);
-extern errno_t gfx_context_delete(gfx_context_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/gfx/coord.h
===================================================================
--- uspace/lib/gfx/include/gfx/coord.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphic coordinates
- */
-
-#ifndef _GFX_COORD_H
-#define _GFX_COORD_H
-
-#include <stdbool.h>
-#include <types/gfx/coord.h>
-
-extern gfx_coord_t gfx_coord_div_rneg(gfx_coord_t, gfx_coord_t);
-extern void gfx_coord2_add(gfx_coord2_t *, gfx_coord2_t *, gfx_coord2_t *);
-extern void gfx_coord2_subtract(gfx_coord2_t *, gfx_coord2_t *, gfx_coord2_t *);
-extern void gfx_coord2_clip(gfx_coord2_t *, gfx_rect_t *, gfx_coord2_t *);
-extern void gfx_coord2_project(gfx_coord2_t *, gfx_rect_t *, gfx_rect_t *,
-    gfx_coord2_t *);
-extern void gfx_span_points_sort(gfx_coord_t, gfx_coord_t, gfx_coord_t *,
-    gfx_coord_t *);
-extern void gfx_rect_translate(gfx_coord2_t *, gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_rtranslate(gfx_coord2_t *, gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_envelope(gfx_rect_t *, gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_clip(gfx_rect_t *, gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_ctr_on_rect(gfx_rect_t *, gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_points_sort(gfx_rect_t *, gfx_rect_t *);
-extern void gfx_rect_dims(gfx_rect_t *, gfx_coord2_t *);
-extern bool gfx_rect_is_empty(gfx_rect_t *);
-extern bool gfx_rect_is_incident(gfx_rect_t *, gfx_rect_t *);
-extern bool gfx_rect_is_inside(gfx_rect_t *, gfx_rect_t *);
-extern bool gfx_pix_inside_rect(gfx_coord2_t *, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/gfx/cursor.h
===================================================================
--- uspace/lib/gfx/include/gfx/cursor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Hardware cursor control
- */
-
-#ifndef _GFX_CURSOR_H
-#define _GFX_CURSOR_H
-
-#include <errno.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/context.h>
-#include <stdbool.h>
-
-extern errno_t gfx_cursor_get_pos(gfx_context_t *, gfx_coord2_t *);
-extern errno_t gfx_cursor_set_pos(gfx_context_t *, gfx_coord2_t *);
-extern errno_t gfx_cursor_set_visible(gfx_context_t *, bool);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/gfx/render.h
===================================================================
--- uspace/lib/gfx/include/gfx/render.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Rendering operations
- */
-
-#ifndef _GFX_RENDER_H
-#define _GFX_RENDER_H
-
-#include <errno.h>
-#include <types/gfx/color.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/context.h>
-
-extern errno_t gfx_set_clip_rect(gfx_context_t *, gfx_rect_t *);
-extern errno_t gfx_set_color(gfx_context_t *, gfx_color_t *);
-extern errno_t gfx_fill_rect(gfx_context_t *, gfx_rect_t *);
-extern errno_t gfx_update(gfx_context_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/types/gfx/bitmap.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Color types
- */
-
-#ifndef _GFX_TYPES_BITMAP_H
-#define _GFX_TYPES_BITMAP_H
-
-#include <errno.h>
-#include <io/pixel.h>
-#include <stddef.h>
-#include <types/gfx/coord.h>
-
-struct gfx_bitmap;
-typedef struct gfx_bitmap gfx_bitmap_t;
-
-/** Bitmap flags */
-typedef enum {
-	/** Directly map GC output into this bitmap */
-	bmpf_direct_output = 0x1,
-	/** Enable color key */
-	bmpf_color_key = 0x2,
-	/** Paint non-background pixels with current drawing color */
-	bmpf_colorize = 0x4
-} gfx_bitmap_flags_t;
-
-/** Bitmap parameters */
-typedef struct {
-	/** Rectangle represented in pixel array */
-	gfx_rect_t rect;
-	/** Bitmap flags */
-	gfx_bitmap_flags_t flags;
-	/** Key color */
-	pixel_t key_color;
-} gfx_bitmap_params_t;
-
-/** Bitmap allocation info */
-typedef struct {
-	/** Byte offset from one successive line to the next */
-	int pitch;
-	/** Byte offset of first pixel */
-	size_t off0;
-	/** Pixel array */
-	void *pixels;
-} gfx_bitmap_alloc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/types/gfx/color.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/color.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Color types
- */
-
-#ifndef _GFX_TYPES_COLOR_H
-#define _GFX_TYPES_COLOR_H
-
-#include <errno.h>
-#include <stdint.h>
-
-struct gfx_color;
-typedef struct gfx_color gfx_color_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/types/gfx/context.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphics context
- *
- * A graphics context is the target of rendering operations. It can carry
- * some additional state (hence context). It is an abstract interface,
- * to be implemented by various backends (drivers).
- */
-
-#ifndef _GFX_TYPES_CONTEXT_H
-#define _GFX_TYPES_CONTEXT_H
-
-struct gfx_context;
-typedef struct gfx_context gfx_context_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/types/gfx/coord.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/coord.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphic coordinates
- */
-
-#ifndef _GFX_TYPES_COORD_H
-#define _GFX_TYPES_COORD_H
-
-#include <errno.h>
-#include <stdint.h>
-
-typedef int gfx_coord_t;
-
-typedef struct {
-	gfx_coord_t x;
-	gfx_coord_t y;
-} gfx_coord2_t;
-
-typedef struct {
-	gfx_coord2_t p0;
-	gfx_coord2_t p1;
-} gfx_rect_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/include/types/gfx/ops/context.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/ops/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphics context ops
- *
- * The ops structure describing an implementation of a graphics context.
- */
-
-#ifndef _GFX_TYPES_OPS_CONTEXT_H
-#define _GFX_TYPES_OPS_CONTEXT_H
-
-#include <errno.h>
-#include <types/gfx/bitmap.h>
-#include <types/gfx/color.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/context.h>
-#include <stdbool.h>
-
-/** Graphics context ops */
-typedef struct {
-	/** Set clipping rectangle */
-	errno_t (*set_clip_rect)(void *, gfx_rect_t *);
-	/** Set drawing color */
-	errno_t (*set_color)(void *, gfx_color_t *);
-	/** Fill rectangle using the current drawing color */
-	errno_t (*fill_rect)(void *, gfx_rect_t *);
-	/** Update display */
-	errno_t (*update)(void *);
-	/** Create bitmap */
-	errno_t (*bitmap_create)(void *, gfx_bitmap_params_t *,
-	    gfx_bitmap_alloc_t *, void **);
-	/** Destroy bitmap */
-	errno_t (*bitmap_destroy)(void *);
-	/** Render bitmap */
-	errno_t (*bitmap_render)(void *, gfx_rect_t *, gfx_coord2_t *);
-	/** Get bitmap allocation info */
-	errno_t (*bitmap_get_alloc)(void *, gfx_bitmap_alloc_t *);
-	/** Get hardware cursor position */
-	errno_t (*cursor_get_pos)(void *, gfx_coord2_t *);
-	/** Set hardware cursor position */
-	errno_t (*cursor_set_pos)(void *, gfx_coord2_t *);
-	/** Set hardware cursor visibility */
-	errno_t (*cursor_set_visible)(void *, bool);
-} gfx_context_ops_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/meson.build
===================================================================
--- uspace/lib/gfx/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/bitmap.c',
-	'src/color.c',
-	'src/coord.c',
-	'src/context.c',
-	'src/cursor.c',
-	'src/render.c'
-)
-
-test_src = files(
-	'test/bitmap.c',
-	'test/color.c',
-	'test/coord.c',
-	'test/cursor.c',
-	'test/main.c',
-	'test/render.c',
-)
Index: pace/lib/gfx/private/bitmap.h
===================================================================
--- uspace/lib/gfx/private/bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Bitmap structure
- *
- */
-
-#ifndef _GFX_PRIVATE_BITMAP_H
-#define _GFX_PRIVATE_BITMAP_H
-
-#include <types/gfx/context.h>
-
-/** Bitmap
- *
- * This is private to libgfx. It is not visible to clients nor backends.
- */
-struct gfx_bitmap {
-	/** Graphics context of the bitmap */
-	gfx_context_t *gc;
-	/** GC-private data */
-	void *gc_priv;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/private/color.h
===================================================================
--- uspace/lib/gfx/private/color.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Color structure
- *
- */
-
-#ifndef _GFX_PRIVATE_COLOR_H
-#define _GFX_PRIVATE_COLOR_H
-
-#include <stdint.h>
-
-/** Actual structure of graphics color.
- *
- * This is private to libgfx. It is not visible to clients nor backends.
- */
-struct gfx_color {
-	uint16_t r;
-	uint16_t g;
-	uint16_t b;
-	uint8_t attr;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/private/context.h
===================================================================
--- uspace/lib/gfx/private/context.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphics context structure
- *
- */
-
-#ifndef _GFX_PRIVATE_CONTEXT_H
-#define _GFX_PRIVATE_CONTEXT_H
-
-#include <types/gfx/ops/context.h>
-
-/** Actual structure of graphics context.
- *
- * This is private to libgfx. It is not visible to clients nor backends.
- */
-struct gfx_context {
-	/** Graphics context ops */
-	gfx_context_ops_t *ops;
-	/** Instance argument */
-	void *arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfx/src/bitmap.c
===================================================================
--- uspace/lib/gfx/src/bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Bitmap
- */
-
-#include <gfx/bitmap.h>
-#include <mem.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "../private/bitmap.h"
-#include "../private/context.h"
-
-/** Initialize bitmap parameters structure.
- *
- * Bitmap parameters structure must always be initialized using this function
- * first.
- *
- * @param params Bitmap parameters structure
- */
-void gfx_bitmap_params_init(gfx_bitmap_params_t *params)
-{
-	memset(params, 0, sizeof(gfx_bitmap_params_t));
-}
-
-/** Allocate bitmap in a graphics context.
- *
- * @param gc Graphic context
- * @param params Bitmap parameters
- * @param alloc Bitmap allocation info or @c NULL to let GC allocate
- *               pixel storage
- * @param rbitmap Place to store pointer to new bitmap
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-errno_t gfx_bitmap_create(gfx_context_t *gc, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, gfx_bitmap_t **rbitmap)
-{
-	void *bm_priv;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	bitmap = calloc(1, sizeof(gfx_bitmap_t));
-	if (bitmap == NULL)
-		return ENOMEM;
-
-	rc = gc->ops->bitmap_create(gc->arg, params, alloc, &bm_priv);
-	if (rc != EOK) {
-		free(bitmap);
-		return rc;
-	}
-
-	bitmap->gc = gc;
-	bitmap->gc_priv = bm_priv;
-	*rbitmap = bitmap;
-	return EOK;
-}
-
-/** Destroy bitmap from graphics context.
- *
- * @param bitmap Bitmap
- *
- * @return EOK on success, EIO if graphic device connection was lost
- */
-errno_t gfx_bitmap_destroy(gfx_bitmap_t *bitmap)
-{
-	errno_t rc;
-
-	rc = bitmap->gc->ops->bitmap_destroy(bitmap->gc_priv);
-	if (rc != EOK)
-		return rc;
-
-	free(bitmap);
-	return EOK;
-}
-
-/** Render bitmap in graphics context.
- *
- * @param bitmap Bitmap
- * @param srect Source rectangle or @c NULL to render entire bitmap
- * @param offs Bitmap offset or @c NULL for zero offset
- *
- * @return EOK on success, EIO if graphic device connection was lost
- */
-errno_t gfx_bitmap_render(gfx_bitmap_t *bitmap, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	return bitmap->gc->ops->bitmap_render(bitmap->gc_priv, srect, offs);
-}
-
-/** Get bitmap allocation info.
- *
- * @param bitmap Bitmap
- * @param alloc Allocation info structure to fill in
- *
- * @return EOK on success, EIO if graphic device connection was lost
- */
-errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *bitmap, gfx_bitmap_alloc_t *alloc)
-{
-	return bitmap->gc->ops->bitmap_get_alloc(bitmap->gc_priv, alloc);
-}
-
-/** @}
- */
Index: pace/lib/gfx/src/color.c
===================================================================
--- uspace/lib/gfx/src/color.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Color operations
- */
-
-#include <gfx/color.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "../private/color.h"
-
-/** Create new 16-bit per channel RGB color.
- *
- * Create a new RGB color where the R, G, B components have 16 bits
- * of precision each.
- *
- * @param r Red component
- * @param g Green component
- * @param b Blue component
- * @param rcolor Place to store pointer to new color
- *
- * @return EOK on success or an error code, ENOMEM if out of resources,
- *         EIO if the graphic device connection was lost
- */
-errno_t gfx_color_new_rgb_i16(uint16_t r, uint16_t g, uint16_t b,
-    gfx_color_t **rcolor)
-{
-	gfx_color_t *color;
-
-	color = calloc(1, sizeof(gfx_color_t));
-	if (color == NULL)
-		return ENOMEM;
-
-	color->r = r;
-	color->g = g;
-	color->b = b;
-	color->attr = 0xff;
-
-	*rcolor = color;
-	return EOK;
-}
-
-/** Create new EGA color.
- *
- * @param attr EGA attributes
- * @param rcolor Place to store pointer to new color
- *
- * @return EOK on success or an error code, ENOMEM if out of resources,
- *         EIO if the graphic device connection was lost
- */
-errno_t gfx_color_new_ega(uint8_t attr, gfx_color_t **rcolor)
-{
-	gfx_color_t *color;
-
-	color = calloc(1, sizeof(gfx_color_t));
-	if (color == NULL)
-		return ENOMEM;
-
-	color->attr = attr;
-
-	*rcolor = color;
-	return EOK;
-}
-
-/** Delete color.
- *
- * @param color Color
- */
-void gfx_color_delete(gfx_color_t *color)
-{
-	free(color);
-}
-
-/** Convert color to 16-bit RGB coordinates.
- *
- * @param color Color
- * @param r Place to store red coordinate
- * @param g Place to store green coordinate
- * @param b Place to store blue coordinate
- */
-void gfx_color_get_rgb_i16(gfx_color_t *color, uint16_t *r, uint16_t *g,
-    uint16_t *b)
-{
-	*r = color->r;
-	*g = color->g;
-	*b = color->b;
-}
-
-/** Convert color to EGA attributes.
- *
- * @param color Color
- * @param attr Place to store EGA attributes
- */
-void gfx_color_get_ega(gfx_color_t *color, uint8_t *attr)
-{
-	*attr = color->attr;
-}
-
-/** @}
- */
Index: pace/lib/gfx/src/context.c
===================================================================
--- uspace/lib/gfx/src/context.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Graphics context
- */
-
-#include <gfx/context.h>
-#include <stdlib.h>
-#include "../private/context.h"
-
-/** Create new graphics context.
- *
- * Create new graphics context with the specified ops and argument.
- *
- * @param ops Graphics context ops
- * @param arg Instance argument
- * @param rgc Place to store pointer to new graphics context on success
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t gfx_context_new(gfx_context_ops_t *ops, void *arg,
-    gfx_context_t **rgc)
-{
-	gfx_context_t *gc;
-
-	gc = calloc(1, sizeof(gfx_context_t));
-	if (gc == NULL)
-		return ENOMEM;
-
-	gc->ops = ops;
-	gc->arg = arg;
-	*rgc = gc;
-	return EOK;
-}
-
-/** Delete graphics context.
- *
- * @param gc Graphics context or @c NULL
- */
-errno_t gfx_context_delete(gfx_context_t *gc)
-{
-	if (gc == NULL)
-		return EOK;
-
-	free(gc);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfx/src/coord.c
===================================================================
--- uspace/lib/gfx/src/coord.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,358 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Coordinates
- */
-
-#include <gfx/coord.h>
-#include <macros.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-/** Divide @a a by @a b and round towards negative numbers.
- *
- * Regular integer division always rounds towards zero. This is not useful
- * e.g. for scaling down, where we always need to round towards negative
- * numbers.
- *
- * @param a Dividend
- * @param b Divisor
- * @return Quotient
- */
-gfx_coord_t gfx_coord_div_rneg(gfx_coord_t a, gfx_coord_t b)
-{
-	if ((a > 0 && b > 0) || (a < 0 && b < 0)) {
-		/* Result is non-negative, round towards zero */
-		return a / b;
-	} else {
-		/* Result is negative, round away from zero */
-		return (a - b + 1) / b;
-	}
-}
-
-/** Add two vectors.
- *
- * @param a First vector
- * @param b Second vector
- * @param d Destination
- */
-void gfx_coord2_add(gfx_coord2_t *a, gfx_coord2_t *b, gfx_coord2_t *d)
-{
-	d->x = a->x + b->x;
-	d->y = a->y + b->y;
-}
-
-/** Subtract two vectors.
- *
- * @param a First vector
- * @param b Second vector
- * @param d Destination
- */
-void gfx_coord2_subtract(gfx_coord2_t *a, gfx_coord2_t *b, gfx_coord2_t *d)
-{
-	d->x = a->x - b->x;
-	d->y = a->y - b->y;
-}
-
-/** Clip point coordinates to be within a rectangle.
- *
- * @param a Pixel coordinates
- * @param clip Clipping rectangle
- * @param d Place to store clipped coordinates
- */
-void gfx_coord2_clip(gfx_coord2_t *a, gfx_rect_t *clip, gfx_coord2_t *d)
-{
-	gfx_rect_t sclip;
-	gfx_coord2_t t;
-
-	gfx_rect_points_sort(clip, &sclip);
-
-	t.x = min(a->x, clip->p1.x - 1);
-	t.y = min(a->y, clip->p1.y - 1);
-
-	d->x = max(clip->p0.x, t.x);
-	d->y = max(clip->p0.y, t.y);
-}
-
-/** Transform coordinates via rectangle to rectangle projection.
- *
- * Transform pixel coordinate via a projection that maps one rectangle
- * onto another rectangle. The source rectangle must have both dimensions
- * greater than one.
- *
- * @param a Pixel coordinates
- * @param srect Source rectangle
- * @param drect Destination rectangle
- * @param d Place to store resulting coordinates.
- */
-void gfx_coord2_project(gfx_coord2_t *a, gfx_rect_t *srect, gfx_rect_t *drect,
-    gfx_coord2_t *d)
-{
-	gfx_rect_t sr;
-	gfx_rect_t dr;
-
-	gfx_rect_points_sort(srect, &sr);
-	gfx_rect_points_sort(drect, &dr);
-
-	d->x = dr.p0.x + (a->x - sr.p0.x) * (dr.p1.x - dr.p0.x - 1) /
-	    (sr.p1.x - sr.p0.x - 1);
-	d->y = dr.p0.y + (a->y - sr.p0.y) * (dr.p1.y - dr.p0.y - 1) /
-	    (sr.p1.y - sr.p0.y - 1);
-}
-
-/** Sort points of a span.
- *
- * Sort the begin and end points so that the begin point has the lower
- * coordinate (i.e. if needed, the span is transposed, if not, it is simply
- * copied).
- *
- * @param s0 Source span start point
- * @param s1 Source span end point
- * @param d0 Destination span start point
- * @param d1 Destination span end point
- */
-void gfx_span_points_sort(gfx_coord_t s0, gfx_coord_t s1, gfx_coord_t *d0,
-    gfx_coord_t *d1)
-{
-	if (s0 <= s1) {
-		*d0 = s0;
-		*d1 = s1;
-	} else {
-		*d0 = s1 + 1;
-		*d1 = s0 + 1;
-	}
-}
-
-/** Move (translate) rectangle.
- *
- * @param trans Translation offset
- * @param src Source rectangle
- * @param dest Destination rectangle
- */
-void gfx_rect_translate(gfx_coord2_t *trans, gfx_rect_t *src, gfx_rect_t *dest)
-{
-	gfx_coord2_add(&src->p0, trans, &dest->p0);
-	gfx_coord2_add(&src->p1, trans, &dest->p1);
-}
-
-/** Reverse move (translate) rectangle.
- *
- * @param trans Translation offset
- * @param src Source rectangle
- * @param dest Destination rectangle
- */
-void gfx_rect_rtranslate(gfx_coord2_t *trans, gfx_rect_t *src, gfx_rect_t *dest)
-{
-	gfx_coord2_subtract(&src->p0, trans, &dest->p0);
-	gfx_coord2_subtract(&src->p1, trans, &dest->p1);
-}
-
-/** Compute envelope of two rectangles.
- *
- * Envelope is the minimal rectangle covering all pixels of both rectangles.
- *
- * @param a First rectangle
- * @param b Second rectangle
- * @param dest Place to store enveloping rectangle
- */
-void gfx_rect_envelope(gfx_rect_t *a, gfx_rect_t *b, gfx_rect_t *dest)
-{
-	gfx_rect_t sa, sb;
-
-	if (gfx_rect_is_empty(a)) {
-		*dest = *b;
-		return;
-	}
-
-	if (gfx_rect_is_empty(b)) {
-		*dest = *a;
-		return;
-	}
-
-	/* a and b are both non-empty */
-
-	gfx_rect_points_sort(a, &sa);
-	gfx_rect_points_sort(b, &sb);
-
-	dest->p0.x = min(sa.p0.x, sb.p0.x);
-	dest->p0.y = min(sa.p0.y, sb.p0.y);
-	dest->p1.x = max(sa.p1.x, sb.p1.x);
-	dest->p1.y = max(sa.p1.y, sb.p1.y);
-}
-
-/** Compute intersection of two rectangles.
- *
- * If the two rectangles do not intersect, the result will be an empty
- * rectangle (check with gfx_rect_is_empty()). The resulting rectangle
- * is always sorted. If @a clip is NULL, no clipping is performed.
- *
- * @param rect Source rectangle
- * @param clip Clipping rectangle or @c NULL
- * @param dest Place to store clipped rectangle
- */
-void gfx_rect_clip(gfx_rect_t *rect, gfx_rect_t *clip, gfx_rect_t *dest)
-{
-	gfx_rect_t srect, sclip;
-
-	if (clip == NULL) {
-		*dest = *rect;
-		return;
-	}
-
-	gfx_rect_points_sort(rect, &srect);
-	gfx_rect_points_sort(clip, &sclip);
-
-	dest->p0.x = min(max(srect.p0.x, sclip.p0.x), sclip.p1.x);
-	dest->p0.y = min(max(srect.p0.y, sclip.p0.y), sclip.p1.y);
-	dest->p1.x = max(sclip.p0.x, min(srect.p1.x, sclip.p1.x));
-	dest->p1.y = max(sclip.p0.y, min(srect.p1.y, sclip.p1.y));
-}
-
-/** Center rectangle on rectangle.
- *
- * Translate rectangle @a a so that its center coincides with the
- * center of rectangle @a b, saving the result in @a dest.
- *
- * @param a Rectnagle to translate
- * @param b Rectangle on which to center
- * @param dest Place to store resulting rectangle
- */
-void gfx_rect_ctr_on_rect(gfx_rect_t *a, gfx_rect_t *b, gfx_rect_t *dest)
-{
-	gfx_coord2_t adim;
-	gfx_coord2_t bdim;
-
-	gfx_rect_dims(a, &adim);
-	gfx_rect_dims(b, &bdim);
-
-	dest->p0.x = b->p0.x + bdim.x / 2 - adim.x / 2;
-	dest->p0.y = b->p0.y + bdim.y / 2 - adim.y / 2;
-
-	dest->p1.x = dest->p0.x + adim.x;
-	dest->p1.y = dest->p0.y + adim.y;
-}
-
-/** Sort points of a rectangle.
- *
- * Shuffle around coordinates of a rectangle so that p0.x < p1.x and
- * p0.y < p0.y.
- *
- * @param src Source rectangle
- * @param dest Destination (sorted) rectangle
- */
-void gfx_rect_points_sort(gfx_rect_t *src, gfx_rect_t *dest)
-{
-	gfx_span_points_sort(src->p0.x, src->p1.x, &dest->p0.x, &dest->p1.x);
-	gfx_span_points_sort(src->p0.y, src->p1.y, &dest->p0.y, &dest->p1.y);
-}
-
-/** Determine if rectangle contains no pixels
- *
- * @param rect Rectangle
- * @return @c true iff rectangle contains no pixels
- */
-bool gfx_rect_is_empty(gfx_rect_t *rect)
-{
-	return rect->p0.x == rect->p1.x || rect->p0.y == rect->p1.y;
-}
-
-/** Determine if two rectangles share any pixels
- *
- * @param a First rectangle
- * @param b Second rectangle
- * @return @c true iff rectangles share any pixels
- */
-bool gfx_rect_is_incident(gfx_rect_t *a, gfx_rect_t *b)
-{
-	gfx_rect_t r;
-
-	gfx_rect_clip(a, b, &r);
-	return !gfx_rect_is_empty(&r);
-}
-
-/** Return true if rectangle @a a is contained in rectangle @a b.
- *
- * @param a Inside rectangle
- * @param b Outside rectangle
- * @return @c true iff @a a is (non-strictly) inside @a b
- */
-bool gfx_rect_is_inside(gfx_rect_t *a, gfx_rect_t *b)
-{
-	gfx_rect_t sa;
-	gfx_rect_t sb;
-
-	gfx_rect_points_sort(a, &sa);
-	gfx_rect_points_sort(b, &sb);
-
-	if (sa.p0.x < sb.p0.x || sa.p0.y < sb.p0.y)
-		return false;
-
-	if (sa.p1.x > sb.p1.x || sa.p1.y > sb.p1.y)
-		return false;
-
-	return true;
-}
-
-/** Get rectangle dimensions.
- *
- * Get a vector containing the x, y dimensions of a rectangle. These are
- * always nonnegative.
- *
- * @param rect Rectangle
- * @param dims Place to store dimensions
- */
-void gfx_rect_dims(gfx_rect_t *rect, gfx_coord2_t *dims)
-{
-	gfx_rect_t srect;
-
-	gfx_rect_points_sort(rect, &srect);
-	gfx_coord2_subtract(&srect.p1, &srect.p0, dims);
-}
-
-/** Return true if pixel at coordinate @a coord lies within rectangle @a rect. */
-bool gfx_pix_inside_rect(gfx_coord2_t *coord, gfx_rect_t *rect)
-{
-	gfx_rect_t sr;
-
-	gfx_rect_points_sort(rect, &sr);
-
-	if (coord->x < sr.p0.x || coord->y < sr.p0.y)
-		return false;
-
-	if (coord->x >= sr.p1.x || coord->y >= sr.p1.y)
-		return false;
-
-	return true;
-}
-
-/** @}
- */
Index: pace/lib/gfx/src/cursor.c
===================================================================
--- uspace/lib/gfx/src/cursor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Hardware cursor control
- */
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <stdbool.h>
-#include "../private/context.h"
-
-/** Get hardware cursor position.
- *
- * @param gc Graphic context
- * @param pos Place to store cursor position
- *
- * @return EOK on success, ENOTSUP if not supported,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_cursor_get_pos(gfx_context_t *gc, gfx_coord2_t *pos)
-{
-	if (gc->ops->cursor_get_pos != NULL)
-		return gc->ops->cursor_get_pos(gc->arg, pos);
-	else
-		return ENOTSUP;
-}
-
-/** Set hardware cursor position.
- *
- * @param gc Graphic context
- * @param pos New cursor position
- *
- * @return EOK on success, ENOTSUP if not supported,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_cursor_set_pos(gfx_context_t *gc, gfx_coord2_t *pos)
-{
-	if (gc->ops->cursor_set_pos != NULL)
-		return gc->ops->cursor_set_pos(gc->arg, pos);
-	else
-		return ENOTSUP;
-}
-
-/** Set hardware cursor visibility.
- *
- * @param gc Graphic context
- * @param visible @c true iff cursor should be made visible
- *
- * @return EOK on success, ENOTSUP if not supported,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_cursor_set_visible(gfx_context_t *gc, bool visible)
-{
-	if (gc->ops->cursor_set_visible != NULL)
-		return gc->ops->cursor_set_visible(gc->arg, visible);
-	else
-		return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/gfx/src/render.c
===================================================================
--- uspace/lib/gfx/src/render.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfx
- * @{
- */
-/**
- * @file Rendering operations
- */
-
-#include <gfx/render.h>
-#include "../private/context.h"
-
-/** Set clipping rectangle.
- *
- * @param gc Graphic context
- * @param rect Rectangle or @c NULL (no extra clipping)
- *
- * @return EOK on success, ENOMEM if insufficient resources,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_set_clip_rect(gfx_context_t *gc, gfx_rect_t *rect)
-{
-	return gc->ops->set_clip_rect(gc->arg, rect);
-}
-
-/** Set drawing color.
- *
- * @param gc Graphic context
- * @param color Color
- *
- * @return EOK on success, ENOMEM if insufficient resources,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_set_color(gfx_context_t *gc, gfx_color_t *color)
-{
-	return gc->ops->set_color(gc->arg, color);
-}
-
-/** Fill rectangle using the current drawing color.
- *
- * @param gc Graphic context
- * @param rect Rectangle
- *
- * @return EOK on success, ENOMEM if insufficient resources,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_fill_rect(gfx_context_t *gc, gfx_rect_t *rect)
-{
-	return gc->ops->fill_rect(gc->arg, rect);
-}
-
-/** Update display.
- *
- * Finish any deferred rendering.
- *
- * @param gc Graphic context
- *
- * @return EOK on success, ENOMEM if insufficient resources,
- *         EIO if grahic device connection was lost
- */
-errno_t gfx_update(gfx_context_t *gc)
-{
-	return gc->ops->update(gc->arg);
-}
-
-/** @}
- */
Index: pace/lib/gfx/test/bitmap.c
===================================================================
--- uspace/lib/gfx/test/bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,243 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(bitmap);
-
-static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t testgc_bitmap_destroy(void *);
-static errno_t testgc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t testgc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static gfx_context_ops_t ops = {
-	.bitmap_create = testgc_bitmap_create,
-	.bitmap_destroy = testgc_bitmap_destroy,
-	.bitmap_render = testgc_bitmap_render,
-	.bitmap_get_alloc = testgc_bitmap_get_alloc
-};
-
-typedef struct {
-	bool bm_created;
-	bool bm_destroyed;
-	gfx_bitmap_params_t bm_params;
-	void *bm_pixels;
-	gfx_rect_t bm_srect;
-	gfx_coord2_t bm_offs;
-	bool bm_rendered;
-	bool bm_got_alloc;
-} test_gc_t;
-
-typedef struct {
-	test_gc_t *tgc;
-	gfx_bitmap_alloc_t alloc;
-	bool myalloc;
-} testgc_bitmap_t;
-
-enum {
-	alloc_pitch = 42,
-	alloc_off0 = 33
-};
-
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap = NULL;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-	PCUT_ASSERT_TRUE(tgc.bm_created);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, tgc.bm_params.rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, tgc.bm_params.rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, tgc.bm_params.rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, tgc.bm_params.rect.p1.y);
-
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(tgc.bm_destroyed);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_TEST(render)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap = NULL;
-	gfx_rect_t srect;
-	gfx_coord2_t offs;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_bitmap_params_init(&params);
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	srect.p0.x = 1;
-	srect.p0.y = 2;
-	srect.p1.x = 3;
-	srect.p1.y = 4;
-	offs.x = 5;
-	offs.y = 6;
-
-	rc = gfx_bitmap_render(bitmap, &srect, &offs);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(tgc.bm_rendered);
-	PCUT_ASSERT_EQUALS(srect.p0.x, tgc.bm_srect.p0.x);
-	PCUT_ASSERT_EQUALS(srect.p0.y, tgc.bm_srect.p0.y);
-	PCUT_ASSERT_EQUALS(srect.p1.x, tgc.bm_srect.p1.x);
-	PCUT_ASSERT_EQUALS(srect.p1.y, tgc.bm_srect.p1.y);
-	PCUT_ASSERT_EQUALS(offs.x, tgc.bm_offs.x);
-	PCUT_ASSERT_EQUALS(offs.y, tgc.bm_offs.y);
-
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_TEST(get_alloc)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap = NULL;
-	gfx_bitmap_alloc_t alloc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_bitmap_params_init(&params);
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(tgc.bm_got_alloc);
-	PCUT_ASSERT_EQUALS(alloc_pitch, alloc.pitch);
-	PCUT_ASSERT_EQUALS(alloc_off0, alloc.off0);
-	PCUT_ASSERT_EQUALS(tgc.bm_pixels, alloc.pixels);
-
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-	testgc_bitmap_t *tbm;
-
-	tbm = calloc(1, sizeof(testgc_bitmap_t));
-	if (tbm == NULL)
-		return ENOMEM;
-
-	if (alloc == NULL) {
-		tbm->alloc.pitch = alloc_pitch;
-		tbm->alloc.off0 = alloc_off0;
-		tbm->alloc.pixels = calloc(1, 420);
-		tbm->myalloc = true;
-		if (tbm->alloc.pixels == NULL) {
-			free(tbm);
-			return ENOMEM;
-		}
-	} else {
-		tbm->alloc = *alloc;
-	}
-
-	tbm->tgc = tgc;
-	tgc->bm_created = true;
-	tgc->bm_params = *params;
-	tgc->bm_pixels = tbm->alloc.pixels;
-	*rbm = (void *)tbm;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_destroy(void *bm)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	if (tbm->myalloc)
-		free(tbm->alloc.pixels);
-	tbm->tgc->bm_destroyed = true;
-	free(tbm);
-	return EOK;
-}
-
-static errno_t testgc_bitmap_render(void *bm, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	tbm->tgc->bm_rendered = true;
-	tbm->tgc->bm_srect = *srect;
-	tbm->tgc->bm_offs = *offs;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	*alloc = tbm->alloc;
-	tbm->tgc->bm_got_alloc = true;
-	return EOK;
-}
-
-PCUT_EXPORT(bitmap);
Index: pace/lib/gfx/test/color.c
===================================================================
--- uspace/lib/gfx/test/color.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(color);
-
-PCUT_TEST(init_rgb_i16)
-{
-	errno_t rc;
-	gfx_color_t *color;
-
-	/* White */
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color);
-}
-
-PCUT_EXPORT(color);
Index: pace/lib/gfx/test/coord.c
===================================================================
--- uspace/lib/gfx/test/coord.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,979 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/coord.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(coord);
-
-/** gfx_coord_div_rneg rounds towards negative numbers */
-PCUT_TEST(coord_div_rneg)
-{
-	PCUT_ASSERT_INT_EQUALS(-3, gfx_coord_div_rneg(-7, 3));
-	PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-6, 3));
-	PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-5, 3));
-	PCUT_ASSERT_INT_EQUALS(-2, gfx_coord_div_rneg(-4, 3));
-	PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-3, 3));
-	PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-2, 3));
-	PCUT_ASSERT_INT_EQUALS(-1, gfx_coord_div_rneg(-1, 3));
-	PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(0, 3));
-	PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(1, 3));
-	PCUT_ASSERT_INT_EQUALS(0, gfx_coord_div_rneg(2, 3));
-	PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(3, 3));
-	PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(4, 3));
-	PCUT_ASSERT_INT_EQUALS(1, gfx_coord_div_rneg(5, 3));
-	PCUT_ASSERT_INT_EQUALS(2, gfx_coord_div_rneg(6, 3));
-}
-
-/** gfx_coord2_add should add two coordinate vectors */
-PCUT_TEST(coord2_add)
-{
-	gfx_coord2_t a, b;
-	gfx_coord2_t d;
-
-	a.x = 10;
-	a.y = 11;
-	b.x = 20;
-	b.y = 22;
-
-	gfx_coord2_add(&a, &b, &d);
-
-	PCUT_ASSERT_INT_EQUALS(a.x + b.x, d.x);
-	PCUT_ASSERT_INT_EQUALS(a.y + b.y, d.y);
-}
-
-/** gfx_coord2_subtract should subtract two coordinate vectors */
-PCUT_TEST(coord2_subtract)
-{
-	gfx_coord2_t a, b;
-	gfx_coord2_t d;
-
-	a.x = 10;
-	a.y = 11;
-	b.x = 20;
-	b.y = 22;
-
-	gfx_coord2_subtract(&a, &b, &d);
-
-	PCUT_ASSERT_INT_EQUALS(a.x - b.x, d.x);
-	PCUT_ASSERT_INT_EQUALS(a.y - b.y, d.y);
-}
-
-/** gfx_coord2_clip with point to lower-left of clipping rectangle */
-PCUT_TEST(coord2_clip_ll)
-{
-	gfx_coord2_t p;
-	gfx_coord2_t cp;
-	gfx_rect_t rect;
-
-	p.x = 1;
-	p.y = 2;
-
-	rect.p0.x = 3;
-	rect.p0.y = 4;
-	rect.p1.x = 5;
-	rect.p1.y = 6;
-
-	gfx_coord2_clip(&p, &rect, &cp);
-
-	PCUT_ASSERT_INT_EQUALS(3, cp.x);
-	PCUT_ASSERT_INT_EQUALS(4, cp.y);
-}
-
-/** gfx_coord2_clip with point inside the clipping rectangle */
-PCUT_TEST(coord2_clip_mm)
-{
-	gfx_coord2_t p;
-	gfx_coord2_t cp;
-	gfx_rect_t rect;
-
-	p.x = 2;
-	p.y = 3;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	gfx_coord2_clip(&p, &rect, &cp);
-
-	PCUT_ASSERT_INT_EQUALS(2, cp.x);
-	PCUT_ASSERT_INT_EQUALS(3, cp.y);
-}
-
-/** gfx_coord2_clip with point to upper-right of clipping rectangle */
-PCUT_TEST(coord2_clip_hh)
-{
-	gfx_coord2_t p;
-	gfx_coord2_t cp;
-	gfx_rect_t rect;
-
-	p.x = 5;
-	p.y = 6;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	gfx_coord2_clip(&p, &rect, &cp);
-
-	PCUT_ASSERT_INT_EQUALS(2, cp.x);
-	PCUT_ASSERT_INT_EQUALS(3, cp.y);
-}
-
-/** gfx_coord2_project projects pixel from one rectangle to another  */
-PCUT_TEST(coord2_project)
-{
-	gfx_coord2_t a, d;
-	gfx_rect_t srect, drect;
-
-	srect.p0.x = 10;
-	srect.p0.y = 10;
-	srect.p1.x = 20 + 1;
-	srect.p1.y = 20 + 1;
-
-	drect.p0.x = 100;
-	drect.p0.y = 100;
-	drect.p1.x = 200 + 1;
-	drect.p1.y = 200 + 1;
-
-	a.x = 10;
-	a.y = 10;
-	gfx_coord2_project(&a, &srect, &drect, &d);
-	PCUT_ASSERT_INT_EQUALS(100, d.x);
-	PCUT_ASSERT_INT_EQUALS(100, d.y);
-
-	a.x = 15;
-	a.y = 15;
-	gfx_coord2_project(&a, &srect, &drect, &d);
-	PCUT_ASSERT_INT_EQUALS(150, d.x);
-	PCUT_ASSERT_INT_EQUALS(150, d.y);
-
-	a.x = 12;
-	a.y = 16;
-	gfx_coord2_project(&a, &srect, &drect, &d);
-	PCUT_ASSERT_INT_EQUALS(120, d.x);
-	PCUT_ASSERT_INT_EQUALS(160, d.y);
-
-	a.x = 20;
-	a.y = 20;
-	gfx_coord2_project(&a, &srect, &drect, &d);
-	PCUT_ASSERT_INT_EQUALS(200, d.x);
-	PCUT_ASSERT_INT_EQUALS(200, d.y);
-}
-
-/** gfx_rect_translate should translate rectangle */
-PCUT_TEST(rect_translate)
-{
-	gfx_coord2_t offs;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-
-	offs.x = 5;
-	offs.y = 6;
-
-	srect.p0.x = 10;
-	srect.p0.y = 11;
-	srect.p1.x = 20;
-	srect.p1.y = 22;
-
-	gfx_rect_translate(&offs, &srect, &drect);
-
-	PCUT_ASSERT_INT_EQUALS(offs.x + srect.p0.x, drect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(offs.y + srect.p0.y, drect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(offs.x + srect.p1.x, drect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(offs.y + srect.p1.y, drect.p1.y);
-}
-
-/** gfx_rect_rtranslate should reverse-translate rectangle */
-PCUT_TEST(rect_rtranslate)
-{
-	gfx_coord2_t offs;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-
-	offs.x = 5;
-	offs.y = 6;
-
-	srect.p0.x = 10;
-	srect.p0.y = 11;
-	srect.p1.x = 20;
-	srect.p1.y = 22;
-
-	gfx_rect_rtranslate(&offs, &srect, &drect);
-
-	PCUT_ASSERT_INT_EQUALS(srect.p0.x - offs.x, drect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(srect.p0.y - offs.y, drect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(srect.p1.x - offs.x, drect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(srect.p1.y - offs.y, drect.p1.y);
-}
-
-/** Sorting span with lower start and higher end point results in the same span. */
-PCUT_TEST(span_points_sort_asc)
-{
-	gfx_coord_t a, b;
-
-	gfx_span_points_sort(1, 2, &a, &b);
-	PCUT_ASSERT_INT_EQUALS(1, a);
-	PCUT_ASSERT_INT_EQUALS(2, b);
-}
-
-/** Sorting span with same start and end point results in the same span. */
-PCUT_TEST(span_points_sort_equal)
-{
-	gfx_coord_t a, b;
-
-	gfx_span_points_sort(1, 1, &a, &b);
-	PCUT_ASSERT_INT_EQUALS(1, a);
-	PCUT_ASSERT_INT_EQUALS(1, b);
-}
-
-/** Sorting span with hight start and lower end point results in transposed span. */
-PCUT_TEST(span_points_sort_desc)
-{
-	gfx_coord_t a, b;
-
-	gfx_span_points_sort(1, 0, &a, &b);
-	PCUT_ASSERT_INT_EQUALS(1, a);
-	PCUT_ASSERT_INT_EQUALS(2, b);
-}
-
-/** Rectangle envelope with first rectangle empty should return the second rectangle. */
-PCUT_TEST(rect_envelope_a_empty)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 0;
-	a.p0.y = 0;
-	a.p1.x = 0;
-	a.p1.y = 0;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, e.p1.y);
-}
-
-/** Rectangle envelope with second rectangle empty should return the first rectangle. */
-PCUT_TEST(rect_envelope_b_empty)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 0;
-	b.p0.y = 0;
-	b.p1.x = 0;
-	b.p1.y = 0;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, e.p1.y);
-}
-
-/** Rectangle envelope, a has both coordinates lower than b */
-PCUT_TEST(rect_envelope_nonempty_a_lt_b)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 5;
-	b.p0.y = 6;
-	b.p1.x = 7;
-	b.p1.y = 8;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(7, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, e.p1.y);
-}
-
-/** Rectangle envelope, a has both coordinates higher than b */
-PCUT_TEST(rect_envelope_nonempty_a_gt_b)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 5;
-	a.p0.y = 6;
-	a.p1.x = 7;
-	a.p1.y = 8;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(7, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, e.p1.y);
-}
-
-/** Rectangle envelope, a is inside b */
-PCUT_TEST(rect_envelope_nonempty_a_inside_b)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 7;
-	a.p1.y = 8;
-
-	b.p0.x = 3;
-	b.p0.y = 4;
-	b.p1.x = 5;
-	b.p1.y = 6;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(7, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, e.p1.y);
-}
-
-/** Rectangle envelope, b is inside a */
-PCUT_TEST(rect_envelope_nonempty_b_inside_a)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 3;
-	a.p0.y = 4;
-	a.p1.x = 5;
-	a.p1.y = 6;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 7;
-	b.p1.y = 8;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(7, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, e.p1.y);
-}
-
-/** Rectangle envelope, a and b cross */
-PCUT_TEST(rect_envelope_nonempty_a_crosses_b)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t e;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 4;
-	a.p1.y = 3;
-
-	b.p0.x = 2;
-	b.p0.y = 1;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	gfx_rect_envelope(&a, &b, &e);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.x);
-	PCUT_ASSERT_INT_EQUALS(1, e.p0.y);
-	PCUT_ASSERT_INT_EQUALS(4, e.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, e.p1.y);
-}
-
-/** Clip rectangle with rect completely inside the clipping rectangle */
-PCUT_TEST(rect_clip_rect_inside)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 3;
-	rect.p0.y = 4;
-	rect.p1.x = 5;
-	rect.p1.y = 6;
-
-	clip.p0.x = 1;
-	clip.p0.y = 2;
-	clip.p1.x = 7;
-	clip.p1.y = 8;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p1.y);
-}
-
-/** Clip rectangle with rect covering the clipping rectangle */
-PCUT_TEST(rect_clip_rect_covering)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 7;
-	rect.p1.y = 8;
-
-	clip.p0.x = 3;
-	clip.p0.y = 4;
-	clip.p1.x = 5;
-	clip.p1.y = 6;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p1.y);
-}
-
-/** Clip rectangle with rect outside, having lower coordinates */
-PCUT_TEST(rect_clip_rect_out_ll)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	clip.p0.x = 5;
-	clip.p0.y = 6;
-	clip.p1.x = 7;
-	clip.p1.y = 8;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p1.y);
-}
-
-/** Clip rectangle with rect outside, having higher coordinates */
-PCUT_TEST(rect_clip_rect_out_hh)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 5;
-	rect.p0.y = 6;
-	rect.p1.x = 7;
-	rect.p1.y = 8;
-
-	clip.p0.x = 1;
-	clip.p0.y = 2;
-	clip.p1.x = 3;
-	clip.p1.y = 4;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p1.y);
-}
-
-/** Clip rectangle with rect partially outside, having lower coordinates */
-PCUT_TEST(rect_clip_rect_ll)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 5;
-	rect.p1.y = 6;
-
-	clip.p0.x = 3;
-	clip.p0.y = 4;
-	clip.p1.x = 7;
-	clip.p1.y = 8;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p1.y);
-}
-
-/** Clip rectangle with rect partially outside, having higher coordinates */
-PCUT_TEST(rect_clip_rect_hh)
-{
-	gfx_rect_t rect;
-	gfx_rect_t clip;
-	gfx_rect_t dest;
-
-	rect.p0.x = 3;
-	rect.p0.y = 4;
-	rect.p1.x = 7;
-	rect.p1.y = 8;
-
-	clip.p0.x = 1;
-	clip.p0.y = 2;
-	clip.p1.x = 5;
-	clip.p1.y = 6;
-
-	gfx_rect_clip(&rect, &clip, &dest);
-	PCUT_ASSERT_INT_EQUALS(3, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(5, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(6, dest.p1.y);
-}
-
-/** Clip rectangle with no clipping rectangle */
-PCUT_TEST(rect_clip_rect_noclip)
-{
-	gfx_rect_t rect;
-	gfx_rect_t dest;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	gfx_rect_clip(&rect, NULL, &dest);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, dest.p1.y);
-}
-
-/** Center rectangle on rectangle */
-PCUT_TEST(rect_ctr_on_rect)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-	gfx_rect_t dest;
-
-	/* Dimensions: 20 x 20 */
-	b.p0.x = 10;
-	b.p0.y = 20;
-	b.p1.x = 30;
-	b.p1.y = 40;
-
-	/* Dimensions: 20 x 20 */
-	a.p0.x = 100;
-	a.p0.y = 200;
-	a.p1.x = 120;
-	a.p1.y = 220;
-
-	/* Centering rectangle of same size should give us the same rectangle */
-	gfx_rect_ctr_on_rect(&a, &b, &dest);
-	PCUT_ASSERT_INT_EQUALS(b.p0.x, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(b.p0.y, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(b.p1.x, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(b.p1.y, dest.p1.y);
-
-	/* Dimensions: 10 x 10 */
-	a.p0.x = 100;
-	a.p0.y = 200;
-	a.p1.x = 110;
-	a.p1.y = 210;
-
-	gfx_rect_ctr_on_rect(&a, &b, &dest);
-	PCUT_ASSERT_INT_EQUALS(15, dest.p0.x);
-	PCUT_ASSERT_INT_EQUALS(25, dest.p0.y);
-	PCUT_ASSERT_INT_EQUALS(25, dest.p1.x);
-	PCUT_ASSERT_INT_EQUALS(35, dest.p1.y);
-}
-
-/** Sort span points that are already sorted should produde indentical points */
-PCUT_TEST(rect_points_sort_sorted)
-{
-	gfx_coord_t s0, s1;
-
-	gfx_span_points_sort(1, 2, &s0, &s1);
-	PCUT_ASSERT_INT_EQUALS(1, s0);
-	PCUT_ASSERT_INT_EQUALS(2, s1);
-}
-
-/** Sort span points that are reversed should transpose them */
-PCUT_TEST(rect_points_sort_reversed)
-{
-	gfx_coord_t s0, s1;
-
-	gfx_span_points_sort(2, 1, &s0, &s1);
-	PCUT_ASSERT_INT_EQUALS(2, s0);
-	PCUT_ASSERT_INT_EQUALS(3, s1);
-}
-
-/** Rectangle dimensions for straight rectangle are computed correctly */
-PCUT_TEST(rect_dims_straight)
-{
-	gfx_rect_t rect;
-	gfx_coord2_t dims;
-
-	rect.p0.x = 1;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 1000;
-
-	gfx_rect_dims(&rect, &dims);
-
-	PCUT_ASSERT_INT_EQUALS(99, dims.x);
-	PCUT_ASSERT_INT_EQUALS(990, dims.y);
-}
-
-/** Rectangle dimensions for reversed rectangle are computed correctly */
-PCUT_TEST(rect_dims_reversed)
-{
-	gfx_rect_t rect;
-	gfx_coord2_t dims;
-
-	rect.p0.x = 1000;
-	rect.p0.y = 100;
-	rect.p1.x = 10;
-	rect.p1.y = 1;
-
-	gfx_rect_dims(&rect, &dims);
-
-	PCUT_ASSERT_INT_EQUALS(990, dims.x);
-	PCUT_ASSERT_INT_EQUALS(99, dims.y);
-}
-
-/** gfx_rect_is_empty for straight rectangle with zero columns returns true */
-PCUT_TEST(rect_is_empty_pos_x)
-{
-	gfx_rect_t rect;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 1;
-	rect.p1.y = 3;
-	PCUT_ASSERT_TRUE(gfx_rect_is_empty(&rect));
-}
-
-/** gfx_rect_is_empty for straight rectangle with zero rows returns true */
-PCUT_TEST(rect_is_empty_pos_y)
-{
-	gfx_rect_t rect;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 2;
-	rect.p1.y = 2;
-	PCUT_ASSERT_TRUE(gfx_rect_is_empty(&rect));
-}
-
-/** gfx_rect_is_empty for straight non-empty rectangle returns false */
-PCUT_TEST(rect_is_empty_neg)
-{
-	gfx_rect_t rect;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 2;
-	rect.p1.y = 3;
-	PCUT_ASSERT_FALSE(gfx_rect_is_empty(&rect));
-}
-
-/** gfx_rect_is_empty for reverse non-empty rectangle returns false */
-PCUT_TEST(rect_is_empty_reverse_neg)
-{
-	gfx_rect_t rect;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 0;
-	rect.p1.y = 1;
-	PCUT_ASSERT_FALSE(gfx_rect_is_empty(&rect));
-}
-
-/** gfx_rect_is_incident for neighboring rectangles returns false */
-PCUT_TEST(rect_is_incident_neighbor)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 3;
-	b.p0.y = 2;
-	b.p1.x = 5;
-	b.p1.y = 6;
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_incident(&a, &b));
-}
-
-/** gfx_rect_is_incident for a inside b returns true */
-PCUT_TEST(rect_is_incident_a_inside_b)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 2;
-	a.p0.y = 3;
-	a.p1.x = 4;
-	a.p1.y = 5;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 5;
-	b.p1.y = 6;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_incident(&a, &b));
-}
-
-/** gfx_rect_is_incident for b inside a returns true */
-PCUT_TEST(rect_is_incident_b_inside_a)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 5;
-	a.p1.y = 6;
-
-	b.p0.x = 2;
-	b.p0.y = 3;
-	b.p1.x = 4;
-	b.p1.y = 5;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_incident(&a, &b));
-}
-
-/** gfx_rect_is_incident for a and b sharing corner returns true */
-PCUT_TEST(rect_is_incident_corner)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 2;
-	b.p0.y = 3;
-	b.p1.x = 4;
-	b.p1.y = 5;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_incident(&a, &b));
-}
-
-/** gfx_rect_is_incident for a == b returns true */
-PCUT_TEST(rect_is_incident_same)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_incident(&a, &b));
-}
-
-/** gfx_rect_is_inside is true for rectangle strictly inside */
-PCUT_TEST(rect_is_inside_strict)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 2;
-	a.p0.y = 3;
-	a.p1.x = 4;
-	a.p1.y = 5;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 5;
-	b.p1.y = 6;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_inside(&a, &b));
-}
-
-/** gfx_rect_is_inside is true for two equal rectangles */
-PCUT_TEST(rect_is_inside_same)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_TRUE(gfx_rect_is_inside(&a, &b));
-}
-
-/** gfx_rect_is_inside is false for @c a.p0 outside */
-PCUT_TEST(rect_is_inside_p0_outside)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 0;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
-
-	a.p0.x = 1;
-	a.p0.y = 1;
-	a.p1.x = 3;
-	a.p1.y = 4;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
-}
-
-/** gfx_rect_is_inside is false for @c a.p1 outside */
-PCUT_TEST(rect_is_inside_p1_outside)
-{
-	gfx_rect_t a;
-	gfx_rect_t b;
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 4;
-	a.p1.y = 4;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
-
-	a.p0.x = 1;
-	a.p0.y = 2;
-	a.p1.x = 3;
-	a.p1.y = 5;
-
-	b.p0.x = 1;
-	b.p0.y = 2;
-	b.p1.x = 3;
-	b.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_inside(&a, &b));
-}
-
-/** gfx_pix_inside_rect for  */
-PCUT_TEST(pix_inside_rect)
-{
-	gfx_coord2_t coord;
-	gfx_rect_t rect;
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	coord.x = 0;
-	coord.y = 1;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 1;
-	coord.y = 1;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 0;
-	coord.y = 2;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 1;
-	coord.y = 2;
-	PCUT_ASSERT_TRUE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 2;
-	coord.y = 3;
-	PCUT_ASSERT_TRUE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 3;
-	coord.y = 3;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 2;
-	coord.y = 4;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-
-	coord.x = 3;
-	coord.y = 4;
-	PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect));
-}
-
-PCUT_EXPORT(coord);
Index: pace/lib/gfx/test/cursor.c
===================================================================
--- uspace/lib/gfx/test/cursor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <pcut/pcut.h>
-#include <mem.h>
-#include <stdbool.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(cursor);
-
-static errno_t testgc_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t testgc_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t testgc_cursor_set_visible(void *, bool);
-
-static gfx_context_ops_t ops = {
-	.cursor_get_pos = testgc_cursor_get_pos,
-	.cursor_set_pos = testgc_cursor_set_pos,
-	.cursor_set_visible = testgc_cursor_set_visible
-};
-
-/** Test graphics context data */
-typedef struct {
-	errno_t rc;
-
-	bool cursor_get_pos;
-	gfx_coord2_t get_pos_pos;
-
-	bool cursor_set_pos;
-	gfx_coord2_t set_pos_pos;
-
-	bool cursor_set_visible;
-	bool set_visible_vis;
-} test_gc_t;
-
-/** Get hardware cursor position with error return */
-PCUT_TEST(cursor_get_pos_failure)
-{
-	errno_t rc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EIO;
-
-	rc = gfx_cursor_get_pos(gc, &pos);
-	PCUT_ASSERT_ERRNO_VAL(tgc.rc, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_get_pos);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Get hardware cursor position */
-PCUT_TEST(cursor_get_pos_success)
-{
-	errno_t rc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EOK;
-	tgc.get_pos_pos.x = 1;
-	tgc.get_pos_pos.y = 2;
-
-	rc = gfx_cursor_get_pos(gc, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_get_pos);
-	PCUT_ASSERT_INT_EQUALS(tgc.get_pos_pos.x, pos.x);
-	PCUT_ASSERT_INT_EQUALS(tgc.get_pos_pos.y, pos.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set hardware cursor position with error return */
-PCUT_TEST(cursor_set_pos_failure)
-{
-	errno_t rc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EIO;
-	pos.x = 1;
-	pos.y = 2;
-
-	rc = gfx_cursor_set_pos(gc, &pos);
-	PCUT_ASSERT_ERRNO_VAL(tgc.rc, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_pos);
-	PCUT_ASSERT_INT_EQUALS(pos.x, tgc.set_pos_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, tgc.set_pos_pos.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set hardware cursor position */
-PCUT_TEST(cursor_set_pos_success)
-{
-	errno_t rc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EOK;
-	pos.x = 1;
-	pos.y = 2;
-
-	rc = gfx_cursor_set_pos(gc, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_pos);
-	PCUT_ASSERT_INT_EQUALS(pos.x, tgc.set_pos_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, tgc.set_pos_pos.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set hardware cursor visibility with error return */
-PCUT_TEST(cursor_set_visible_failure)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EIO;
-
-	rc = gfx_cursor_set_visible(gc, true);
-	PCUT_ASSERT_ERRNO_VAL(tgc.rc, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_visible);
-	PCUT_ASSERT_TRUE(tgc.set_visible_vis);
-
-	tgc.cursor_set_visible = false;
-
-	rc = gfx_cursor_set_visible(gc, false);
-	PCUT_ASSERT_ERRNO_VAL(tgc.rc, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_visible);
-	PCUT_ASSERT_FALSE(tgc.set_visible_vis);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set hardware cursor visibility */
-PCUT_TEST(cursor_set_visible_success)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EOK;
-
-	rc = gfx_cursor_set_visible(gc, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_visible);
-	PCUT_ASSERT_TRUE(tgc.set_visible_vis);
-
-	tgc.cursor_set_visible = false;
-
-	rc = gfx_cursor_set_visible(gc, false);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.cursor_set_visible);
-	PCUT_ASSERT_FALSE(tgc.set_visible_vis);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static errno_t testgc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->cursor_get_pos = true;
-	*pos = tgc->get_pos_pos;
-
-	return tgc->rc;
-}
-
-static errno_t testgc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->cursor_set_pos = true;
-	tgc->set_pos_pos = *pos;
-
-	return tgc->rc;
-}
-
-static errno_t testgc_cursor_set_visible(void *arg, bool visible)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->cursor_set_visible = true;
-	tgc->set_visible_vis = visible;
-
-	return tgc->rc;
-}
-
-PCUT_EXPORT(cursor);
Index: pace/lib/gfx/test/main.c
===================================================================
--- uspace/lib/gfx/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(bitmap);
-PCUT_IMPORT(color);
-PCUT_IMPORT(coord);
-PCUT_IMPORT(cursor);
-PCUT_IMPORT(render);
-
-PCUT_MAIN();
Index: pace/lib/gfx/test/render.c
===================================================================
--- uspace/lib/gfx/test/render.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,365 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <pcut/pcut.h>
-#include <mem.h>
-#include <stdbool.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(render);
-
-static errno_t testgc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t testgc_set_color(void *, gfx_color_t *);
-static errno_t testgc_fill_rect(void *, gfx_rect_t *);
-static errno_t testgc_update(void *);
-
-static gfx_context_ops_t ops = {
-	.set_clip_rect = testgc_set_clip_rect,
-	.set_color = testgc_set_color,
-	.fill_rect = testgc_fill_rect,
-	.update = testgc_update
-};
-
-/** Test graphics context data */
-typedef struct {
-	errno_t rc;
-
-	bool set_clip_rect;
-	gfx_rect_t crect;
-	bool do_clip;
-
-	bool set_color;
-	gfx_color_t *dclr;
-
-	bool fill_rect;
-	gfx_rect_t frect;
-
-	bool update;
-} test_gc_t;
-
-/** Set clipping rectangle */
-PCUT_TEST(set_clip_rect)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	tgc.rc = EOK;
-
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.set_clip_rect);
-	PCUT_ASSERT_TRUE(tgc.do_clip);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc.crect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc.crect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc.crect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc.crect.p1.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set null clipping rectangle */
-PCUT_TEST(set_clip_rect_null)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EOK;
-
-	rc = gfx_set_clip_rect(gc, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.set_clip_rect);
-	PCUT_ASSERT_FALSE(tgc.do_clip);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set clipping rectangle with error return */
-PCUT_TEST(set_clip_rect_failure)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EIO;
-
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set drawing color */
-PCUT_TEST(set_color)
-{
-	errno_t rc;
-	gfx_color_t *color;
-	gfx_context_t *gc = NULL;
-	uint16_t r, g, b;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(tgc.set_color);
-
-	tgc.rc = EOK;
-
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.set_color);
-
-	gfx_color_get_rgb_i16(tgc.dclr, &r, &g, &b);
-
-	PCUT_ASSERT_INT_EQUALS(0xffff, r);
-	PCUT_ASSERT_INT_EQUALS(0xffff, g);
-	PCUT_ASSERT_INT_EQUALS(0xffff, b);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set drawing color with error return */
-PCUT_TEST(set_color_failure)
-{
-	errno_t rc;
-	gfx_color_t *color;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(tgc.set_color);
-
-	tgc.rc = EIO;
-
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	gfx_color_delete(color);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Fill rectangle */
-PCUT_TEST(fill_rect)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(tgc.fill_rect);
-
-	tgc.rc = EOK;
-
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc.fill_rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc.frect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc.frect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc.frect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc.frect.p1.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Fill rectangle with error return */
-PCUT_TEST(fill_rect_failure)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	PCUT_ASSERT_FALSE(tgc.fill_rect);
-
-	tgc.rc = EIO;
-
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Update GC */
-PCUT_TEST(update)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EOK;
-
-	PCUT_ASSERT_FALSE(tgc.update);
-	rc = gfx_update(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(tgc.update);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Update GC with error return */
-PCUT_TEST(update_failure)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-
-	memset(&tgc, 0, sizeof(tgc));
-
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tgc.rc = EIO;
-	rc = gfx_update(gc);
-
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->set_clip_rect = true;
-	if (rect != NULL) {
-		tgc->do_clip = true;
-		tgc->crect = *rect;
-	} else {
-		tgc->do_clip = false;
-	}
-
-	return tgc->rc;
-}
-
-static errno_t testgc_set_color(void *arg, gfx_color_t *color)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->set_color = true;
-
-	/* Technically we should copy the data */
-	tgc->dclr = color;
-	return tgc->rc;
-}
-
-static errno_t testgc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->fill_rect = true;
-	tgc->frect = *rect;
-	return tgc->rc;
-}
-
-static errno_t testgc_update(void *arg)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->update = true;
-	return tgc->rc;
-}
-
-PCUT_EXPORT(render);
Index: pace/lib/gfxfont/doc/doxygroups.h
===================================================================
--- uspace/lib/gfxfont/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libgfxfont libgfxfont
- * @ingroup libs
- */
Index: pace/lib/gfxfont/include/gfx/font.h
===================================================================
--- uspace/lib/gfxfont/include/gfx/font.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Font
- */
-
-#ifndef _GFX_FONT_H
-#define _GFX_FONT_H
-
-#include <errno.h>
-#include <stddef.h>
-#include <types/gfx/context.h>
-#include <types/gfx/font.h>
-#include <types/gfx/glyph.h>
-#include <types/gfx/text.h>
-#include <types/gfx/typeface.h>
-
-extern void gfx_font_metrics_init(gfx_font_metrics_t *);
-extern void gfx_font_props_init(gfx_font_props_t *);
-extern void gfx_font_get_props(gfx_font_info_t *, gfx_font_props_t *);
-extern errno_t gfx_font_create(gfx_typeface_t *, gfx_font_props_t *,
-    gfx_font_metrics_t *, gfx_font_t **);
-extern errno_t gfx_font_create_textmode(gfx_typeface_t *, gfx_font_t **);
-extern errno_t gfx_font_open(gfx_font_info_t *, gfx_font_t **);
-extern void gfx_font_close(gfx_font_t *);
-extern void gfx_font_get_metrics(gfx_font_t *, gfx_font_metrics_t *);
-extern errno_t gfx_font_set_metrics(gfx_font_t *,
-    gfx_font_metrics_t *);
-extern gfx_glyph_t *gfx_font_first_glyph(gfx_font_t *);
-extern gfx_glyph_t *gfx_font_next_glyph(gfx_glyph_t *);
-extern gfx_glyph_t *gfx_font_last_glyph(gfx_font_t *);
-extern gfx_glyph_t *gfx_font_prev_glyph(gfx_glyph_t *);
-extern errno_t gfx_font_search_glyph(gfx_font_t *, const char *, gfx_glyph_t **,
-    size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/gfx/glyph.h
===================================================================
--- uspace/lib/gfxfont/include/gfx/glyph.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph
- */
-
-#ifndef _GFX_GLYPH_H
-#define _GFX_GLYPH_H
-
-#include <errno.h>
-#include <types/gfx/font.h>
-#include <types/gfx/glyph.h>
-#include <stdbool.h>
-#include <stddef.h>
-
-extern void gfx_glyph_metrics_init(gfx_glyph_metrics_t *);
-extern errno_t gfx_glyph_create(gfx_font_t *, gfx_glyph_metrics_t *,
-    gfx_glyph_t **);
-extern void gfx_glyph_destroy(gfx_glyph_t *);
-extern void gfx_glyph_get_metrics(gfx_glyph_t *, gfx_glyph_metrics_t *);
-extern errno_t gfx_glyph_set_metrics(gfx_glyph_t *, gfx_glyph_metrics_t *);
-extern errno_t gfx_glyph_set_pattern(gfx_glyph_t *, const char *);
-extern void gfx_glyph_clear_pattern(gfx_glyph_t *, const char *);
-extern bool gfx_glyph_matches(gfx_glyph_t *, const char *, size_t *);
-extern gfx_glyph_pattern_t *gfx_glyph_first_pattern(gfx_glyph_t *);
-extern gfx_glyph_pattern_t *gfx_glyph_next_pattern(gfx_glyph_pattern_t *);
-extern const char *gfx_glyph_pattern_str(gfx_glyph_pattern_t *);
-extern errno_t gfx_glyph_render(gfx_glyph_t *, gfx_coord2_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/gfx/glyph_bmp.h
===================================================================
--- uspace/lib/gfxfont/include/gfx/glyph_bmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph bitmap
- */
-
-#ifndef _GFX_GLYPH_BMP_H
-#define _GFX_GLYPH_BMP_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <types/gfx/glyph.h>
-#include <types/gfx/glyph_bmp.h>
-
-extern errno_t gfx_glyph_bmp_open(gfx_glyph_t *, gfx_glyph_bmp_t **);
-extern errno_t gfx_glyph_bmp_save(gfx_glyph_bmp_t *);
-extern void gfx_glyph_bmp_close(gfx_glyph_bmp_t *);
-extern void gfx_glyph_bmp_get_rect(gfx_glyph_bmp_t *, gfx_rect_t *);
-extern int gfx_glyph_bmp_getpix(gfx_glyph_bmp_t *, gfx_coord_t, gfx_coord_t);
-extern errno_t gfx_glyph_bmp_setpix(gfx_glyph_bmp_t *, gfx_coord_t,
-    gfx_coord_t, int);
-extern errno_t gfx_glyph_bmp_clear(gfx_glyph_bmp_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/gfx/text.h
===================================================================
--- uspace/lib/gfxfont/include/gfx/text.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Text formatting
- */
-
-#ifndef _GFX_TEXT_H
-#define _GFX_TEXT_H
-
-#include <errno.h>
-#include <stddef.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/font.h>
-#include <types/gfx/text.h>
-
-extern void gfx_text_fmt_init(gfx_text_fmt_t *);
-extern gfx_coord_t gfx_text_width(gfx_font_t *, const char *);
-extern errno_t gfx_puttext(gfx_coord2_t *, gfx_text_fmt_t *, const char *);
-extern void gfx_text_start_pos(gfx_coord2_t *, gfx_text_fmt_t *, const char *,
-    gfx_coord2_t *);
-extern size_t gfx_text_find_pos(gfx_coord2_t *, gfx_text_fmt_t *, const char *,
-    gfx_coord2_t *);
-extern void gfx_text_cont(gfx_coord2_t *, gfx_text_fmt_t *, const char *,
-    gfx_coord2_t *, gfx_text_fmt_t *);
-extern void gfx_text_rect(gfx_coord2_t *, gfx_text_fmt_t *, const char *,
-    gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/gfx/typeface.h
===================================================================
--- uspace/lib/gfxfont/include/gfx/typeface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Typeface
- */
-
-#ifndef _GFX_TYPEFACE_H
-#define _GFX_TYPEFACE_H
-
-#include <errno.h>
-#include <stddef.h>
-#include <types/gfx/context.h>
-#include <types/gfx/font.h>
-#include <types/gfx/glyph.h>
-#include <types/gfx/typeface.h>
-
-extern errno_t gfx_typeface_create(gfx_context_t *, gfx_typeface_t **);
-extern void gfx_typeface_destroy(gfx_typeface_t *);
-extern gfx_font_info_t *gfx_typeface_first_font(gfx_typeface_t *);
-extern gfx_font_info_t *gfx_typeface_next_font(gfx_font_info_t *);
-extern errno_t gfx_typeface_open(gfx_context_t *, const char *,
-    gfx_typeface_t **);
-extern errno_t gfx_typeface_save(gfx_typeface_t *, const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/types/gfx/font.h
===================================================================
--- uspace/lib/gfxfont/include/types/gfx/font.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Font types
- */
-
-#ifndef _TYPES_GFX_FONT_H
-#define _TYPES_GFX_FONT_H
-
-#include <types/gfx/coord.h>
-
-struct gfx_font;
-typedef struct gfx_font gfx_font_t;
-
-struct gfx_font_info;
-typedef struct gfx_font_info gfx_font_info_t;
-
-/** Font flags */
-typedef enum {
-	/** Bold */
-	gff_bold = 0x1,
-	/** Italic */
-	gff_italic = 0x2,
-	/** Bold, italic */
-	gff_bold_italic = gff_bold | gff_italic,
-	/** Text mode */
-	gff_text_mode = 0x4
-} gfx_font_flags_t;
-
-/** Font properties */
-typedef struct {
-	/** Size */
-	gfx_coord_t size;
-	/** Flags */
-	gfx_font_flags_t flags;
-} gfx_font_props_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/types/gfx/glyph.h
===================================================================
--- uspace/lib/gfxfont/include/types/gfx/glyph.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph types
- */
-
-#ifndef _TYPES_GFX_GLYPH_H
-#define _TYPES_GFX_GLYPH_H
-
-#include <types/gfx/coord.h>
-
-struct gfx_glyph;
-typedef struct gfx_glyph gfx_glyph_t;
-
-struct gfx_glyph_pattern;
-typedef struct gfx_glyph_pattern gfx_glyph_pattern_t;
-
-/** Glyph metrics */
-typedef struct {
-	/** Advance */
-	gfx_coord_t advance;
-} gfx_glyph_metrics_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/types/gfx/glyph_bmp.h
===================================================================
--- uspace/lib/gfxfont/include/types/gfx/glyph_bmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph types
- */
-
-#ifndef _TYPES_GFX_GLYPH_BMP_H
-#define _TYPES_GFX_GLYPH_BMP_H
-
-struct gfx_glyph_bmp;
-typedef struct gfx_glyph_bmp gfx_glyph_bmp_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/types/gfx/text.h
===================================================================
--- uspace/lib/gfxfont/include/types/gfx/text.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Text types
- */
-
-#ifndef _TYPES_GFX_TEXT_H
-#define _TYPES_GFX_TEXT_H
-
-#include <stdbool.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/color.h>
-
-/** Text horizontal alignment */
-typedef enum {
-	/** Align text left (start at anchor point) */
-	gfx_halign_left,
-	/** Align text on the center (center around anchor point) */
-	gfx_halign_center,
-	/** Align text right (end just before anchor point) */
-	gfx_halign_right,
-	/** Justify text on both left and right edge */
-	gfx_halign_justify
-} gfx_halign_t;
-
-/** Text vertical alignment */
-typedef enum {
-	/** Align top (starts at anchor point) */
-	gfx_valign_top,
-	/** Align center (centered around anchor point) */
-	gfx_valign_center,
-	/** Align bottom (end just before anchor point) */
-	gfx_valign_bottom,
-	/** Align to baseline */
-	gfx_valign_baseline
-} gfx_valign_t;
-
-/** Text formatting */
-typedef struct {
-	/** Text font */
-	struct gfx_font *font;
-	/** Text color */
-	gfx_color_t *color;
-	/** Horizontal alignment */
-	gfx_halign_t halign;
-	/** Width available for the text */
-	gfx_coord_t width;
-	/** Vertical alignment */
-	gfx_valign_t valign;
-	/** Abbreviate the text with ellipsis if it does not fit @c width */
-	bool abbreviate;
-	/** Underline */
-	bool underline;
-} gfx_text_fmt_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/include/types/gfx/typeface.h
===================================================================
--- uspace/lib/gfxfont/include/types/gfx/typeface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Font types
- */
-
-#ifndef _TYPES_GFX_TYPEFACE_H
-#define _TYPES_GFX_TYPEFACE_H
-
-#include <types/gfx/coord.h>
-
-struct gfx_typeface;
-typedef struct gfx_typeface gfx_typeface_t;
-
-/** Font metrics */
-typedef struct {
-	/** Ascent */
-	gfx_coord_t ascent;
-	/** Descent */
-	gfx_coord_t descent;
-	/** Leading */
-	gfx_coord_t leading;
-	/** Underline start Y coordinate (inclusive) */
-	gfx_coord_t underline_y0;
-	/** Underline end Y coordinate (exclusive) */
-	gfx_coord_t underline_y1;
-} gfx_font_metrics_t;
-
-/** Text metrics */
-typedef struct {
-	/** Bounding rectangle (not including oversize elements) */
-	gfx_rect_t bounds;
-} gfx_text_metrics_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/meson.build
===================================================================
--- uspace/lib/gfxfont/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'riff' ]
-src = files(
-	'src/font.c',
-	'src/glyph.c',
-	'src/glyph_bmp.c',
-	'src/text.c',
-	'src/typeface.c',
-)
-
-test_src = files(
-	'test/font.c',
-	'test/glyph.c',
-	'test/glyph_bmp.c',
-	'test/main.c',
-	'test/text.c',
-	'test/tpf.c',
-	'test/typeface.c',
-)
Index: pace/lib/gfxfont/private/font.h
===================================================================
--- uspace/lib/gfxfont/private/font.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Font structure
- *
- */
-
-#ifndef _GFX_PRIVATE_FONT_H
-#define _GFX_PRIVATE_FONT_H
-
-#include <adt/list.h>
-#include <errno.h>
-#include <stdint.h>
-#include <types/gfx/bitmap.h>
-#include <types/gfx/context.h>
-#include <types/gfx/font.h>
-#include <types/gfx/typeface.h>
-#include <riff/chunk.h>
-
-/** Font
- *
- * This is private to libgfxfont.
- *
- * Font bitmap contains all the glyphs packed side by side (in order of
- * @c gfx_font_t.glyphs). This is to conserve space and number of bitmaps
- * used. The baselines of the glyphs are not mutually aligned.
- * For each glyph @c gfx_glyph_t.origin designates
- * pen start point (and thus the position of the baseline).
- */
-struct gfx_font {
-	/** Containing typeface */
-	struct gfx_typeface *typeface;
-	/** Containing font info */
-	struct gfx_font_info *finfo;
-	/** Font metrics */
-	gfx_font_metrics_t metrics;
-	/** Glyphs */
-	list_t glyphs;
-	/** Font bitmap */
-	gfx_bitmap_t *bitmap;
-	/** Bitmap rectangle */
-	gfx_rect_t rect;
-};
-
-/** Font info
- *
- * This is an entry in the list of fonts in typeface
- */
-struct gfx_font_info {
-	/** Containing typeface */
-	struct gfx_typeface *typeface;
-	/** Link to @c typeface->fonts */
-	link_t lfonts;
-	/** Font properties */
-	gfx_font_props_t props;
-	/** Font or @c NULL if font is not present in memory */
-	struct gfx_font *font;
-	/** Font chunk from which font can be read */
-	riff_rchunk_t fontck;
-};
-
-extern errno_t gfx_font_splice_at_glyph(gfx_font_t *, gfx_glyph_t *,
-    gfx_rect_t *);
-extern errno_t gfx_font_info_load(gfx_typeface_t *, riff_rchunk_t *);
-extern errno_t gfx_font_bitmap_pack(gfx_coord_t, gfx_coord_t, uint32_t *,
-    void **, size_t *);
-extern errno_t gfx_font_bitmap_unpack(gfx_coord_t, gfx_coord_t, void *, size_t,
-    uint32_t *);
-extern errno_t gfx_font_load(gfx_font_info_t *);
-extern errno_t gfx_font_save(gfx_font_info_t *, riffw_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/private/glyph.h
===================================================================
--- uspace/lib/gfxfont/private/glyph.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph structure
- *
- */
-
-#ifndef _GFX_PRIVATE_GLYPH_H
-#define _GFX_PRIVATE_GLYPH_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <types/gfx/glyph.h>
-#include <riff/chunk.h>
-
-/** Glyph
- *
- * This is private to libgfxfont.
- */
-struct gfx_glyph {
-	/** Containing font */
-	struct gfx_font *font;
-	/** Link to list of glyphs in the font */
-	link_t lglyphs;
-	/** Glyph metrics */
-	gfx_glyph_metrics_t metrics;
-	/** Text patterns (of gfx_glyph_pattern_t) */
-	list_t patterns;
-	/** Rectangle within font bitmap containing the glyph */
-	gfx_rect_t rect;
-	/** Glyph origin within font bitmap (pen start point) */
-	gfx_coord2_t origin;
-};
-
-/** Glyph pattern.
- *
- * Glyph is set if pattern is found in text.
- */
-struct gfx_glyph_pattern {
-	/** Containing glyph */
-	struct gfx_glyph *glyph;
-	/** Link to gfx_glyph.patterns */
-	link_t lpatterns;
-	/** Pattern text */
-	char *text;
-};
-
-extern errno_t gfx_glyph_transfer(gfx_glyph_t *, gfx_coord_t, gfx_bitmap_t *,
-    gfx_rect_t *);
-extern errno_t gfx_glyph_load(gfx_font_t *, riff_rchunk_t *);
-extern errno_t gfx_glyph_save(gfx_glyph_t *, riffw_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/private/glyph_bmp.h
===================================================================
--- uspace/lib/gfxfont/private/glyph_bmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph structure
- *
- */
-
-#ifndef _GFX_PRIVATE_GLYPH_BMP_H
-#define _GFX_PRIVATE_GLYPH_BMP_H
-
-#include <gfx/coord.h>
-#include <types/gfx/glyph_bmp.h>
-
-/** Glyph bitmap
- *
- * Glyph bitmap open for editing. This is used to edit glyph bitmap.
- * Updating the entire font bitmap whenever the glyph is resized could
- * be costly. This allows to postpone the update until we are done editing.
- *
- * This is private to libgfxfont.
- */
-struct gfx_glyph_bmp {
-	/** Containing glyph */
-	struct gfx_glyph *glyph;
-	/** Rectangle covered by bitmap */
-	gfx_rect_t rect;
-	/** Pixel array */
-	int *pixels;
-};
-
-extern void gfx_glyph_bmp_find_used_rect(gfx_glyph_bmp_t *, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/private/testgc.h
===================================================================
--- uspace/lib/gfxfont/private/testgc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-typedef struct {
-	gfx_bitmap_params_t bm_params;
-	void *bm_pixels;
-	gfx_rect_t bm_srect;
-	gfx_coord2_t bm_offs;
-} test_gc_t;
-
-typedef struct {
-	test_gc_t *tgc;
-	gfx_bitmap_alloc_t alloc;
-	bool myalloc;
-} testgc_bitmap_t;
-
-static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	return EOK;
-}
-
-static errno_t testgc_set_color(void *arg, gfx_color_t *color)
-{
-	return EOK;
-}
-
-static errno_t testgc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	return EOK;
-}
-
-static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-	testgc_bitmap_t *tbm;
-
-	tbm = calloc(1, sizeof(testgc_bitmap_t));
-	if (tbm == NULL)
-		return ENOMEM;
-
-	if (alloc == NULL) {
-		tbm->alloc.pitch = (params->rect.p1.x - params->rect.p0.x) *
-		    sizeof(uint32_t);
-		tbm->alloc.off0 = 0;
-		tbm->alloc.pixels = calloc(
-		    tbm->alloc.pitch * (params->rect.p1.y - params->rect.p0.y),
-		    sizeof(uint32_t));
-		tbm->myalloc = true;
-		if (tbm->alloc.pixels == NULL) {
-			free(tbm);
-			return ENOMEM;
-		}
-	} else {
-		tbm->alloc = *alloc;
-	}
-
-	tbm->tgc = tgc;
-	tgc->bm_params = *params;
-	tgc->bm_pixels = tbm->alloc.pixels;
-	*rbm = (void *)tbm;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_destroy(void *bm)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	if (tbm->myalloc)
-		free(tbm->alloc.pixels);
-	free(tbm);
-	return EOK;
-}
-
-static errno_t testgc_bitmap_render(void *bm, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	tbm->tgc->bm_srect = *srect;
-	tbm->tgc->bm_offs = *offs;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	*alloc = tbm->alloc;
-	return EOK;
-}
-
-static gfx_context_ops_t test_ops = {
-	.set_clip_rect = testgc_set_clip_rect,
-	.set_color = testgc_set_color,
-	.fill_rect = testgc_fill_rect,
-	.bitmap_create = testgc_bitmap_create,
-	.bitmap_destroy = testgc_bitmap_destroy,
-	.bitmap_render = testgc_bitmap_render,
-	.bitmap_get_alloc = testgc_bitmap_get_alloc
-};
Index: pace/lib/gfxfont/private/tpf_file.h
===================================================================
--- uspace/lib/gfxfont/private/tpf_file.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file TPF file definitions
- *
- */
-
-#ifndef _GFX_PRIVATE_TPF_FILE_H
-#define _GFX_PRIVATE_TPF_FILE_H
-
-#include <stdint.h>
-
-enum {
-	/** Typeface RIFF format ID */
-	FORM_TPFC = 0x43465054,
-
-	/** Font list type */
-	LTYPE_font = 0x746e6f66,
-
-	/** Font properties chunk ID */
-	CKID_fprp = 0x70727066,
-	/** Font metrics chunk ID */
-	CKID_fmtr = 0x72746d66,
-	/** Font bitmap chunk ID */
-	CKID_fbmp = 0x706d6266,
-
-	/** Glyph list type */
-	LTYPE_glph = 0x68706c67,
-
-	/** Glyph metrics chunk ID */
-	CKID_gmtr = 0x72746d67,
-	/** Glyph patterns chunk ID */
-	CKID_gpat = 0x74617067,
-	/** Glyph rectangle/origin chunk ID */
-	CKID_gror = 0x726f7267
-};
-
-/** TPF font properties */
-typedef struct {
-	uint16_t size;
-	uint16_t flags;
-} tpf_font_props_t;
-
-/** TPF font metrics */
-typedef struct {
-	uint16_t ascent;
-	uint16_t descent;
-	uint16_t leading;
-	int16_t underline_y0;
-	int16_t underline_y1;
-} tpf_font_metrics_t;
-
-/** TPF glyph metrics */
-typedef struct {
-	uint16_t advance;
-} tpf_glyph_metrics_t;
-
-/** TPF glyph rectangle/origin */
-typedef struct {
-	/** Rectangle p0.x */
-	uint32_t p0x;
-	/** Rectangle p0.y */
-	uint32_t p0y;
-	/** Rectangle p1.x */
-	uint32_t p1x;
-	/** Rectangle p1.y */
-	uint32_t p1y;
-	/** Origin X */
-	uint32_t orig_x;
-	/** Origin Y */
-	uint32_t orig_y;
-} tpf_glyph_ror_t;
-
-/** TPF font bitmap header */
-typedef struct {
-	/** Width in pixels */
-	uint32_t width;
-	/** Height in pixels */
-	uint32_t height;
-	/** Format (0) */
-	uint16_t fmt;
-	/** Depth (bits/pixel) */
-	uint16_t depth;
-} tpf_font_bmp_hdr_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/private/typeface.h
===================================================================
--- uspace/lib/gfxfont/private/typeface.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Typeface structure
- *
- */
-
-#ifndef _GFX_PRIVATE_TYPEFACE_H
-#define _GFX_PRIVATE_TYPEFACE_H
-
-#include <adt/list.h>
-#include <errno.h>
-#include <riff/chunk.h>
-#include <types/gfx/bitmap.h>
-#include <types/gfx/context.h>
-#include <types/gfx/typeface.h>
-
-/** Typeface
- *
- * A typeface can contain several fonts of varying size and attributes
- * (such as bold, italic). Fonts present in a typeface can be enumerated
- * without actually loading them into memory.
- *
- * This is private to libgfxfont.
- */
-struct gfx_typeface {
-	/** Graphics context of the typeface */
-	gfx_context_t *gc;
-	/** Fonts (of gfx_font_info_t) */
-	list_t fonts;
-	/** RIFF reader of the open typeface file or @c NULL */
-	riffr_t *riffr;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfxfont/src/font.c
===================================================================
--- uspace/lib/gfxfont/src/font.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,976 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Font
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "../private/font.h"
-#include "../private/glyph.h"
-#include "../private/tpf_file.h"
-#include "../private/typeface.h"
-
-/** Initialize font metrics structure.
- *
- * Font metrics structure must always be initialized using this function
- * first.
- *
- * @param metrics Font metrics structure
- */
-void gfx_font_metrics_init(gfx_font_metrics_t *metrics)
-{
-	memset(metrics, 0, sizeof(gfx_font_metrics_t));
-}
-
-/** Initialize font properties structure.
- *
- * Font properties structure must always be initialized using this function
- * first.
- *
- * @param props Font properties structure
- */
-void gfx_font_props_init(gfx_font_props_t *props)
-{
-	memset(props, 0, sizeof(gfx_font_props_t));
-}
-
-/** Get font properties.
- *
- * @param finfo Font info
- * @param props Place to store font properties
- */
-void gfx_font_get_props(gfx_font_info_t *finfo, gfx_font_props_t *props)
-{
-	*props = finfo->props;
-}
-
-/** Create font with existing font info structure.
- *
- * @param tface Typeface
- * @param finfo Font info
- * @param metrics Font metrics
- * @param rfont Place to store pointer to new font
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-static errno_t gfx_font_create_with_info(gfx_typeface_t *tface,
-    gfx_font_info_t *finfo, gfx_font_metrics_t *metrics, gfx_font_t **rfont)
-{
-	gfx_font_t *font = NULL;
-	gfx_bitmap_params_t params;
-	errno_t rc;
-
-	font = calloc(1, sizeof(gfx_font_t));
-	if (font == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-	font->typeface = tface;
-	font->finfo = finfo;
-
-	font->rect.p0.x = 0;
-	font->rect.p0.y = 0;
-	font->rect.p1.x = 1;
-	font->rect.p1.y = 1;
-
-	rc = gfx_font_set_metrics(font, metrics);
-	if (rc != EOK) {
-		assert(rc == EINVAL);
-		goto error;
-	}
-
-	/* Create font bitmap */
-	gfx_bitmap_params_init(&params);
-	params.rect = font->rect;
-	params.flags = bmpf_color_key | bmpf_colorize;
-	params.key_color = PIXEL(0, 0, 0, 0);
-
-	rc = gfx_bitmap_create(tface->gc, &params, NULL, &font->bitmap);
-	if (rc != EOK)
-		goto error;
-
-	font->metrics = *metrics;
-	list_initialize(&font->glyphs);
-	*rfont = font;
-	return EOK;
-error:
-	if (font != NULL)
-		free(font);
-	return rc;
-}
-
-/** Create font.
- *
- * @param tface Typeface
- * @param props Font properties
- * @param metrics Font metrics
- * @param rfont Place to store pointer to new font
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-errno_t gfx_font_create(gfx_typeface_t *tface, gfx_font_props_t *props,
-    gfx_font_metrics_t *metrics, gfx_font_t **rfont)
-{
-	gfx_font_info_t *finfo = NULL;
-	gfx_font_t *font = NULL;
-	errno_t rc;
-
-	finfo = calloc(1, sizeof(gfx_font_info_t));
-	if (finfo == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	finfo->typeface = tface;
-	finfo->props = *props;
-
-	rc = gfx_font_create_with_info(tface, finfo, metrics, &font);
-	if (rc != EOK)
-		goto error;
-
-	finfo->font = font;
-	list_append(&finfo->lfonts, &tface->fonts);
-	*rfont = font;
-	return EOK;
-error:
-	if (finfo != NULL)
-		free(finfo);
-	return rc;
-}
-
-/** Create dummy font for printing text in text mode.
- *
- * @param tface Typeface
- * @param rfont Place to store pointer to new font
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-errno_t gfx_font_create_textmode(gfx_typeface_t *tface, gfx_font_t **rfont)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-
-	gfx_font_props_init(&props);
-	props.size = 1;
-	props.flags = gff_text_mode;
-
-	gfx_font_metrics_init(&metrics);
-	metrics.ascent = 0;
-	metrics.descent = 0;
-	metrics.leading = 1;
-
-	return gfx_font_create(tface, &props, &metrics, rfont);
-}
-
-/** Open font.
- *
- * @param finfo Font info
- * @param rfont Place to store pointer to open font
- * @return EOK on success or an error code
- */
-errno_t gfx_font_open(gfx_font_info_t *finfo, gfx_font_t **rfont)
-{
-	errno_t rc;
-
-	if (finfo->font == NULL) {
-		/* Load absent font from TPF file */
-		rc = gfx_font_load(finfo);
-		if (rc != EOK)
-			return rc;
-
-		assert(finfo->font != NULL);
-		finfo->font->finfo = finfo;
-	}
-
-	*rfont = finfo->font;
-	return EOK;
-}
-
-/** Close font.
- *
- * @param font Font
- */
-void gfx_font_close(gfx_font_t *font)
-{
-	gfx_glyph_t *glyph;
-
-	glyph = gfx_font_first_glyph(font);
-	while (glyph != NULL) {
-		gfx_glyph_destroy(glyph);
-		glyph = gfx_font_first_glyph(font);
-	}
-
-	font->finfo->font = NULL;
-	free(font);
-}
-
-/** Get font metrics.
- *
- * @param font Font
- * @param metrics Place to store metrics
- */
-void gfx_font_get_metrics(gfx_font_t *font, gfx_font_metrics_t *metrics)
-{
-	*metrics = font->metrics;
-}
-
-/** Set font metrics.
- *
- * @param font Font
- * @param metrics Place to store metrics
- * @return EOK on success, EINVAL if supplied metrics are invalid
- */
-errno_t gfx_font_set_metrics(gfx_font_t *font, gfx_font_metrics_t *metrics)
-{
-	font->metrics = *metrics;
-	return EOK;
-}
-
-/** Get first glyph in font.
- *
- * @param font Font
- * @return First glyph or @c NULL if there are none
- */
-gfx_glyph_t *gfx_font_first_glyph(gfx_font_t *font)
-{
-	link_t *link;
-
-	link = list_first(&font->glyphs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_t, lglyphs);
-}
-
-/** Get next glyph in font.
- *
- * @param cur Current glyph
- * @return Next glyph in font or @c NULL if @a cur was the last one
- */
-gfx_glyph_t *gfx_font_next_glyph(gfx_glyph_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lglyphs, &cur->font->glyphs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_t, lglyphs);
-}
-
-/** Get last glyph in font.
- *
- * @param font Font
- * @return Last glyph or @c NULL if there are none
- */
-gfx_glyph_t *gfx_font_last_glyph(gfx_font_t *font)
-{
-	link_t *link;
-
-	link = list_last(&font->glyphs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_t, lglyphs);
-}
-
-/** Get previous glyph in font.
- *
- * @param cur Current glyph
- * @return Previous glyph in font or @c NULL if @a cur was the last one
- */
-gfx_glyph_t *gfx_font_prev_glyph(gfx_glyph_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->lglyphs, &cur->font->glyphs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_t, lglyphs);
-}
-
-/** Search for glyph that should be set for the beginning of a string.
- *
- * @param font Font
- * @param str String whose beginning we would like to set
- * @param rglyph Place to store glyph that should be set
- * @param rsize Place to store number of bytes to advance in the string
- * @return EOK on success, ENOENT if no matching glyph was found
- */
-errno_t gfx_font_search_glyph(gfx_font_t *font, const char *str,
-    gfx_glyph_t **rglyph, size_t *rsize)
-{
-	gfx_glyph_t *glyph;
-	size_t msize;
-
-	glyph = gfx_font_first_glyph(font);
-	while (glyph != NULL) {
-		if (gfx_glyph_matches(glyph, str, &msize)) {
-			*rglyph = glyph;
-			*rsize = msize;
-			return EOK;
-		}
-
-		glyph = gfx_font_next_glyph(glyph);
-	}
-
-	return ENOENT;
-}
-
-/** Replace glyph graphic with empty space of specified width.
- *
- * This is used to resize a glyph in the font bitmap. This changes
- * the bitmap widht might also make the bitmap taller.
- * Dimensions of the glyph are also adjusted according to @a nrect.
- *
- * @param font Font
- * @param glyph Glyph to replace
- * @param nrect Replacement rectangle
- */
-errno_t gfx_font_splice_at_glyph(gfx_font_t *font, gfx_glyph_t *glyph,
-    gfx_rect_t *nrect)
-{
-	gfx_glyph_t *g;
-	gfx_bitmap_t *nbitmap;
-	gfx_bitmap_params_t params;
-	gfx_coord_t dwidth;
-	gfx_coord_t x0;
-	errno_t rc;
-
-	/* Change of width of glyph */
-	dwidth = (nrect->p1.x - nrect->p0.x) -
-	    (glyph->rect.p1.x - glyph->rect.p0.x);
-
-	/* Create new font bitmap, wider by dwidth pixels */
-	gfx_bitmap_params_init(&params);
-	params.rect = font->rect;
-	params.rect.p1.x += dwidth;
-	if (nrect->p1.y - nrect->p0.y > params.rect.p1.y)
-		params.rect.p1.y = nrect->p1.y - nrect->p0.y;
-	params.flags = bmpf_color_key | bmpf_colorize;
-	params.key_color = PIXEL(0, 0, 0, 0);
-
-	rc = gfx_bitmap_create(font->typeface->gc, &params, NULL, &nbitmap);
-	if (rc != EOK)
-		goto error;
-
-	/*
-	 * In x0 we compute the left margin of @a glyph. We start with
-	 * zero and then, if there are any preceding glyphs, we set it
-	 * to the right margin of the last one.
-	 */
-	x0 = 0;
-
-	/* Transfer glyphs before @a glyph */
-	g = gfx_font_first_glyph(font);
-	while (g != glyph) {
-		assert(g != NULL);
-
-		rc = gfx_glyph_transfer(g, 0, nbitmap, &params.rect);
-		if (rc != EOK)
-			goto error;
-
-		/* Left margin of the next glyph */
-		x0 = g->rect.p1.x;
-
-		g = gfx_font_next_glyph(g);
-	}
-
-	/* Skip @a glyph */
-	g = gfx_font_next_glyph(g);
-
-	/* Transfer glyphs after glyph */
-	while (g != NULL) {
-		rc = gfx_glyph_transfer(g, dwidth, nbitmap, &params.rect);
-		if (rc != EOK)
-			goto error;
-
-		/* Update glyph coordinates */
-		g->rect.p0.x += dwidth;
-		g->rect.p1.x += dwidth;
-		g->origin.x += dwidth;
-
-		g = gfx_font_next_glyph(g);
-	}
-
-	/* Place glyph rectangle inside the newly created space */
-	glyph->origin.x = x0 - nrect->p0.x;
-	glyph->origin.y = 0 - nrect->p0.y;
-	gfx_rect_translate(&glyph->origin, nrect, &glyph->rect);
-
-	/* Update font bitmap */
-	gfx_bitmap_destroy(font->bitmap);
-	font->bitmap = nbitmap;
-	font->rect = params.rect;
-
-	return EOK;
-error:
-	if (nbitmap != NULL)
-		gfx_bitmap_destroy(nbitmap);
-	return rc;
-}
-
-/** Load font properties from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param props Font properties
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_props_load(riff_rchunk_t *parent,
-    gfx_font_props_t *props)
-{
-	errno_t rc;
-	riff_rchunk_t propsck;
-	tpf_font_props_t tprops;
-	size_t nread;
-
-	rc = riff_rchunk_match(parent, CKID_fprp, &propsck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_read(&propsck, (void *) &tprops, sizeof(tprops), &nread);
-	if (rc != EOK || nread != sizeof(tprops))
-		return EIO;
-
-	rc = riff_rchunk_end(&propsck);
-	if (rc != EOK)
-		return rc;
-
-	props->size = uint16_t_le2host(tprops.size);
-	props->flags = uint16_t_le2host(tprops.flags);
-
-	return EOK;
-}
-
-/** Save font properties to RIFF TPF file.
- *
- * @param props Font properties
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_props_save(gfx_font_props_t *props, riffw_t *riffw)
-{
-	errno_t rc;
-	riff_wchunk_t propsck;
-	tpf_font_props_t tprops;
-
-	tprops.size = host2uint16_t_le(props->size);
-	tprops.flags = host2uint16_t_le(props->flags);
-
-	rc = riff_wchunk_start(riffw, CKID_fprp, &propsck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write(riffw, (void *) &tprops, sizeof(tprops));
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_end(riffw, &propsck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Load font metrics from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param metrics Font metrics
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_metrics_load(riff_rchunk_t *parent,
-    gfx_font_metrics_t *metrics)
-{
-	errno_t rc;
-	riff_rchunk_t mtrck;
-	tpf_font_metrics_t tmetrics;
-	size_t nread;
-
-	rc = riff_rchunk_match(parent, CKID_fmtr, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_read(&mtrck, (void *) &tmetrics, sizeof(tmetrics), &nread);
-	if (rc != EOK || nread != sizeof(tmetrics))
-		return EIO;
-
-	rc = riff_rchunk_end(&mtrck);
-	if (rc != EOK)
-		return rc;
-
-	metrics->ascent = uint16_t_le2host(tmetrics.ascent);
-	metrics->descent = uint16_t_le2host(tmetrics.descent);
-	metrics->leading = uint16_t_le2host(tmetrics.leading);
-	metrics->underline_y0 = uint16_t_le2host(tmetrics.underline_y0);
-	metrics->underline_y1 = uint16_t_le2host(tmetrics.underline_y1);
-	return EOK;
-}
-
-/** Save font metrics to RIFF TPF file.
- *
- * @param metrics Font metrics
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_metrics_save(gfx_font_metrics_t *metrics,
-    riffw_t *riffw)
-{
-	errno_t rc;
-	tpf_font_metrics_t tmetrics;
-	riff_wchunk_t mtrck;
-
-	tmetrics.ascent = host2uint16_t_le(metrics->ascent);
-	tmetrics.descent = host2uint16_t_le(metrics->descent);
-	tmetrics.leading = host2uint16_t_le(metrics->leading);
-	tmetrics.underline_y0 = host2uint16_t_le(metrics->underline_y0);
-	tmetrics.underline_y1 = host2uint16_t_le(metrics->underline_y1);
-
-	rc = riff_wchunk_start(riffw, CKID_fmtr, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write(riffw, (void *) &tmetrics, sizeof(tmetrics));
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_end(riffw, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Bit pack font bitmap into 1 bits/pixel format.
- *
- * @param width Bitmap width
- * @param height Bitmap height
- * @param pixels Bitmap pixels
- * @param rdata Place to store pointer to packed data
- * @param rsize Place to store size of packed data
- * @return EOK on sucess, ENOMEM if out of memory
- */
-errno_t gfx_font_bitmap_pack(gfx_coord_t width, gfx_coord_t height,
-    uint32_t *pixels, void **rdata, size_t *rsize)
-{
-	void *data;
-	size_t size;
-	size_t bytes_line;
-	gfx_coord_t x, y;
-	uint8_t b;
-	uint8_t *dp;
-	uint32_t *sp;
-	uint32_t pix;
-
-	bytes_line = (width + 7) / 8;
-	size = height * bytes_line;
-
-	data = malloc(size);
-	if (data == NULL)
-		return ENOMEM;
-
-	sp = pixels;
-	dp = data;
-	for (y = 0; y < height; y++) {
-		b = 0;
-		for (x = 0; x < width; x++) {
-			pix = *sp++;
-			b = (b << 1) | (pix & 1);
-			/* Write eight bits */
-			if ((x & 7) == 7) {
-				*dp++ = b;
-				b = 0;
-			}
-		}
-
-		/* Write remaining bits */
-		if ((x & 7) != 0) {
-			b = b << (8 - (x & 7));
-			*dp++ = b;
-		}
-	}
-
-	*rdata = data;
-	*rsize = size;
-	return EOK;
-}
-
-/** Unpack font bitmap from 1 bits/pixel format.
- *
- * @param width Bitmap width
- * @param height Bitmap height
- * @param data Packed data
- * @param dsize Size of packed data
- * @param pixels Bitmap pixels
- * @return EOK on success, EINVAL if data size is invalid
- */
-errno_t gfx_font_bitmap_unpack(gfx_coord_t width, gfx_coord_t height,
-    void *data, size_t dsize, uint32_t *pixels)
-{
-	size_t size;
-	size_t bytes_line;
-	gfx_coord_t x, y;
-	uint8_t b;
-	uint8_t *sp;
-	uint32_t *dp;
-
-	bytes_line = (width + 7) / 8;
-	size = height * bytes_line;
-
-	if (dsize != size)
-		return EINVAL;
-
-	sp = data;
-	dp = pixels;
-	for (y = 0; y < height; y++) {
-		b = 0;
-		for (x = 0; x < width; x++) {
-			if ((x & 7) == 0)
-				b = *sp++;
-			*dp++ = (b >> 7) ? PIXEL(255, 255, 255, 255) :
-			    PIXEL(0, 0, 0, 0);
-			b = b << 1;
-		}
-	}
-
-	return EOK;
-}
-
-/** Load font bitmap from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param font Font
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_bitmap_load(riff_rchunk_t *parent, gfx_font_t *font)
-{
-	errno_t rc;
-	riff_rchunk_t bmpck;
-	tpf_font_bmp_hdr_t thdr;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bitmap = NULL;
-	uint32_t width;
-	uint32_t height;
-	uint16_t fmt;
-	uint16_t depth;
-	size_t bytes_line;
-	void *data = NULL;
-	size_t size;
-	size_t nread;
-
-	rc = riff_rchunk_match(parent, CKID_fbmp, &bmpck);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_read(&bmpck, &thdr, sizeof(thdr), &nread);
-	if (rc != EOK || nread != sizeof(thdr))
-		goto error;
-
-	width = uint32_t_le2host(thdr.width);
-	height = uint32_t_le2host(thdr.height);
-	fmt = uint16_t_le2host(thdr.fmt);
-	depth = uint16_t_le2host(thdr.depth);
-
-	if (fmt != 0 || depth != 1) {
-		rc = ENOTSUP;
-		goto error;
-	}
-
-	bytes_line = (width + 7) / 8;
-	size = height * bytes_line;
-
-	data = malloc(size);
-	if (data == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = width;
-	params.rect.p1.y = height;
-	params.flags = bmpf_color_key | bmpf_colorize;
-	params.key_color = PIXEL(0, 0, 0, 0);
-
-	rc = gfx_bitmap_create(font->typeface->gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_read(&bmpck, data, size, &nread);
-	if (rc != EOK)
-		goto error;
-
-	if (nread != size) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = riff_rchunk_end(&bmpck);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_bitmap_unpack(width, height, data, size, alloc.pixels);
-	if (rc != EOK)
-		goto error;
-
-	free(data);
-	gfx_bitmap_destroy(font->bitmap);
-	font->bitmap = bitmap;
-	font->rect = params.rect;
-	return EOK;
-error:
-	if (data != NULL)
-		free(data);
-	if (bitmap != NULL)
-		gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Save font bitmap to RIFF TPF file.
- *
- * @param font Font
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_font_bitmap_save(gfx_font_t *font, riffw_t *riffw)
-{
-	errno_t rc;
-	tpf_font_bmp_hdr_t thdr;
-	riff_wchunk_t bmpck;
-	gfx_bitmap_alloc_t alloc;
-	void *data = NULL;
-	size_t dsize;
-
-	rc = gfx_bitmap_get_alloc(font->bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_font_bitmap_pack(font->rect.p1.x, font->rect.p1.y,
-	    alloc.pixels, &data, &dsize);
-	if (rc != EOK)
-		return rc;
-
-	thdr.width = host2uint32_t_le(font->rect.p1.x);
-	thdr.height = host2uint32_t_le(font->rect.p1.y);
-	thdr.fmt = 0;
-	thdr.depth = host2uint16_t_le(1);
-
-	rc = riff_wchunk_start(riffw, CKID_fbmp, &bmpck);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_write(riffw, &thdr, sizeof(thdr));
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_write(riffw, data, dsize);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_wchunk_end(riffw, &bmpck);
-	if (rc != EOK)
-		goto error;
-
-	free(data);
-	return EOK;
-error:
-	if (data != NULL)
-		free(data);
-	return rc;
-}
-
-/** Load font info from RIFF TPF file.
- *
- * @param tface Containing typeface
- * @param parent Parent chunk
- * @return EOK on success or an error code
- */
-errno_t gfx_font_info_load(gfx_typeface_t *tface, riff_rchunk_t *parent)
-{
-	errno_t rc;
-	riff_rchunk_t fontck;
-	gfx_font_props_t props;
-	gfx_font_info_t *finfo = NULL;
-	gfx_font_t *font = NULL;
-
-	rc = riff_rchunk_list_match(parent, LTYPE_font, &fontck);
-	if (rc != EOK)
-		goto error;
-
-	finfo = calloc(1, sizeof(gfx_font_info_t));
-	if (finfo == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	finfo->fontck = fontck;
-
-	rc = gfx_font_props_load(&fontck, &props);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_rchunk_end(&fontck);
-	if (rc != EOK)
-		goto error;
-
-	finfo->typeface = tface;
-	list_append(&finfo->lfonts, &tface->fonts);
-	finfo->props = props;
-	finfo->font = NULL;
-
-	return EOK;
-error:
-	if (finfo != NULL)
-		free(finfo);
-	if (font != NULL)
-		gfx_font_close(font);
-	return rc;
-}
-
-/** Load font from RIFF TPF file.
- *
- * @param finfo Font information
- * @return EOK on success or an error code
- */
-errno_t gfx_font_load(gfx_font_info_t *finfo)
-{
-	errno_t rc;
-	gfx_font_metrics_t metrics;
-	gfx_font_t *font = NULL;
-
-	/* Seek to beginning of chunk (just after list type) */
-	rc = riff_rchunk_seek(&finfo->fontck, sizeof(uint32_t), SEEK_SET);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_props_load(&finfo->fontck, &finfo->props);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_metrics_load(&finfo->fontck, &metrics);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_create_with_info(finfo->typeface, finfo, &metrics, &font);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_bitmap_load(&finfo->fontck, font);
-	if (rc != EOK)
-		goto error;
-
-	while (true) {
-		rc = gfx_glyph_load(font, &finfo->fontck);
-		if (rc == ENOENT)
-			break;
-		if (rc != EOK)
-			goto error;
-	}
-
-	finfo->font = font;
-	return EOK;
-error:
-	if (font != NULL)
-		gfx_font_close(font);
-	return rc;
-}
-
-/** Save font into RIFF TPF file.
- *
- * @param finfo Font info
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-errno_t gfx_font_save(gfx_font_info_t *finfo, riffw_t *riffw)
-{
-	errno_t rc;
-	riff_wchunk_t fontck;
-	gfx_glyph_t *glyph;
-
-	rc = riff_wchunk_start(riffw, CKID_LIST, &fontck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write_uint32(riffw, LTYPE_font);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_font_props_save(&finfo->props, riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_font_metrics_save(&finfo->font->metrics, riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_font_bitmap_save(finfo->font, riffw);
-	if (rc != EOK)
-		return rc;
-
-	glyph = gfx_font_first_glyph(finfo->font);
-	while (glyph != NULL) {
-		rc = gfx_glyph_save(glyph, riffw);
-		if (rc != EOK)
-			return rc;
-
-		glyph = gfx_font_next_glyph(glyph);
-	}
-
-	rc = riff_wchunk_end(riffw, &fontck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfxfont/src/glyph.c
===================================================================
--- uspace/lib/gfxfont/src/glyph.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,643 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph
- */
-
-#include <assert.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <io/pixelmap.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../private/font.h"
-#include "../private/glyph.h"
-#include "../private/tpf_file.h"
-
-/** Initialize glyph metrics structure.
- *
- * Glyph metrics structure must always be initialized using this function
- * first.
- *
- * @param metrics Glyph metrics structure
- */
-void gfx_glyph_metrics_init(gfx_glyph_metrics_t *metrics)
-{
-	memset(metrics, 0, sizeof(gfx_glyph_metrics_t));
-}
-
-/** Create glyph.
- *
- * @param font Containing font
- * @param metrics Glyph metrics
- * @param rglyph Place to store pointer to new glyph
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-errno_t gfx_glyph_create(gfx_font_t *font, gfx_glyph_metrics_t *metrics,
-    gfx_glyph_t **rglyph)
-{
-	gfx_glyph_t *glyph;
-	gfx_glyph_t *last;
-	errno_t rc;
-
-	glyph = calloc(1, sizeof(gfx_glyph_t));
-	if (glyph == NULL)
-		return ENOMEM;
-
-	glyph->font = font;
-
-	rc = gfx_glyph_set_metrics(glyph, metrics);
-	if (rc != EOK) {
-		assert(rc == EINVAL);
-		free(glyph);
-		return rc;
-	}
-
-	last = gfx_font_last_glyph(font);
-
-	glyph->metrics = *metrics;
-	list_append(&glyph->lglyphs, &glyph->font->glyphs);
-	list_initialize(&glyph->patterns);
-
-	if (last != NULL)
-		glyph->rect.p0.x = last->rect.p1.x;
-	else
-		glyph->rect.p0.x = 0;
-
-	glyph->rect.p0.y = 0;
-	glyph->rect.p1.x = glyph->rect.p0.x;
-	glyph->rect.p1.y = glyph->rect.p1.y;
-
-	glyph->origin.x = glyph->rect.p0.x;
-	glyph->origin.y = glyph->rect.p0.y;
-
-	*rglyph = glyph;
-	return EOK;
-}
-
-/** Destroy glyph.
- *
- * @param glyph Glyph
- */
-void gfx_glyph_destroy(gfx_glyph_t *glyph)
-{
-	list_remove(&glyph->lglyphs);
-	free(glyph);
-}
-
-/** Get glyph metrics.
- *
- * @param glyph Glyph
- * @param metrics Place to store metrics
- */
-void gfx_glyph_get_metrics(gfx_glyph_t *glyph, gfx_glyph_metrics_t *metrics)
-{
-	*metrics = glyph->metrics;
-}
-
-/** Set glyph metrics.
- *
- * @param glyph Glyph
- * @param metrics Place to store metrics
- * @return EOK on success, EINVAL if supplied metrics are invalid
- */
-errno_t gfx_glyph_set_metrics(gfx_glyph_t *glyph, gfx_glyph_metrics_t *metrics)
-{
-	glyph->metrics = *metrics;
-	return EOK;
-}
-
-/** Set a pattern that the glyph will match.
- *
- * A glyph can match any number of patterns. Setting the same pattern
- * again has no effect. The pattern is a simple (sub)string. Matching
- * is done using maximum munch rule.
- *
- * @param glyph Glyph
- * @param pattern Pattern
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t gfx_glyph_set_pattern(gfx_glyph_t *glyph, const char *pattern)
-{
-	gfx_glyph_pattern_t *pat;
-
-	pat = gfx_glyph_first_pattern(glyph);
-	while (pat != NULL) {
-		if (str_cmp(pat->text, pattern) == 0) {
-			/* Already set */
-			return EOK;
-		}
-
-		pat = gfx_glyph_next_pattern(pat);
-	}
-
-	pat = calloc(1, sizeof(gfx_glyph_pattern_t));
-	if (pat == NULL)
-		return ENOMEM;
-
-	pat->glyph = glyph;
-	pat->text = str_dup(pattern);
-	if (pat->text == NULL) {
-		free(pat);
-		return ENOMEM;
-	}
-
-	list_append(&pat->lpatterns, &glyph->patterns);
-	return EOK;
-}
-
-/** Clear a matching pattern from a glyph.
- *
- * Clearing a pattern that is not set has no effect.
- *
- * @param Glyph
- * @param pattern Pattern
- */
-void gfx_glyph_clear_pattern(gfx_glyph_t *glyph, const char *pattern)
-{
-	gfx_glyph_pattern_t *pat;
-
-	pat = gfx_glyph_first_pattern(glyph);
-	while (pat != NULL) {
-		if (str_cmp(pat->text, pattern) == 0) {
-			list_remove(&pat->lpatterns);
-			free(pat->text);
-			free(pat);
-			return;
-		}
-
-		pat = gfx_glyph_next_pattern(pat);
-	}
-}
-
-/** Determine if glyph maches the beginning of a string.
- *
- * @param glyph Glyph
- * @param str String
- * @param rsize Place to store number of bytes in the matching pattern
- * @return @c true iff glyph matches the beginning of the string
- */
-bool gfx_glyph_matches(gfx_glyph_t *glyph, const char *str, size_t *rsize)
-{
-	gfx_glyph_pattern_t *pat;
-
-	pat = gfx_glyph_first_pattern(glyph);
-	while (pat != NULL) {
-		if (str_test_prefix(str, pat->text)) {
-			*rsize = str_size(pat->text);
-			return true;
-		}
-
-		pat = gfx_glyph_next_pattern(pat);
-	}
-
-	return false;
-}
-
-/** Get first glyph pattern.
- *
- * @param glyph Glyph
- * @return First pattern or @c NULL if there are none
- */
-gfx_glyph_pattern_t *gfx_glyph_first_pattern(gfx_glyph_t *glyph)
-{
-	link_t *link;
-
-	link = list_first(&glyph->patterns);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_pattern_t, lpatterns);
-}
-
-/** Get next glyph pattern.
- *
- * @param cur Current pattern
- * @return Next pattern or @c NULL if there are none
- */
-gfx_glyph_pattern_t *gfx_glyph_next_pattern(gfx_glyph_pattern_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lpatterns, &cur->glyph->patterns);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_glyph_pattern_t, lpatterns);
-}
-
-/** Return pattern string.
- *
- * @param pattern Pattern
- * @return Pattern string (owned by @a pattern)
- */
-const char *gfx_glyph_pattern_str(gfx_glyph_pattern_t *pattern)
-{
-	return pattern->text;
-}
-
-/** Render glyph to GC.
- *
- * @param glyph Glyph
- * @param pos Position to render to (where glyph origin is placed)
- */
-errno_t gfx_glyph_render(gfx_glyph_t *glyph, gfx_coord2_t *pos)
-{
-	gfx_coord2_t offs;
-
-	gfx_coord2_subtract(pos, &glyph->origin, &offs);
-
-	return gfx_bitmap_render(glyph->font->bitmap, &glyph->rect, &offs);
-}
-
-/** Transfer glyph to new font bitmap.
- *
- * @param glyph Glyph
- * @param offs Offset in new font bitmap
- * @param dbmp New font bitmap
- * @param dbrect Bounding rectangle for @a dbmp
- *
- * @return EOK on success or an error code
- */
-errno_t gfx_glyph_transfer(gfx_glyph_t *glyph, gfx_coord_t offs,
-    gfx_bitmap_t *dbmp, gfx_rect_t *dbrect)
-{
-	pixelmap_t smap;
-	pixelmap_t dmap;
-	gfx_bitmap_alloc_t salloc;
-	gfx_bitmap_alloc_t dalloc;
-	gfx_rect_t drect;
-	gfx_coord_t x, y;
-	gfx_coord2_t off2;
-	pixel_t pixel;
-	errno_t rc;
-
-	rc = gfx_bitmap_get_alloc(glyph->font->bitmap, &salloc);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_bitmap_get_alloc(dbmp, &dalloc);
-	if (rc != EOK)
-		return rc;
-
-	smap.width = glyph->font->rect.p1.x;
-	smap.height = glyph->font->rect.p1.y;
-	smap.data = salloc.pixels;
-
-	dmap.width = dbrect->p1.x;
-	dmap.height = dbrect->p1.y;
-	dmap.data = dalloc.pixels;
-
-	/* Compute destination rectangle */
-	off2.x = offs;
-	off2.y = 0;
-	gfx_rect_translate(&off2, &glyph->rect, &drect);
-	assert(gfx_rect_is_inside(&drect, dbrect));
-
-	for (y = drect.p0.y; y < drect.p1.y; y++) {
-		for (x = drect.p0.x; x < drect.p1.x; x++) {
-			pixel = pixelmap_get_pixel(&smap, x - offs, y);
-			pixelmap_put_pixel(&dmap, x, y, pixel);
-		}
-	}
-
-	return EOK;
-}
-
-/** Load glyph metrics from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param metrics Place to store glyph metrics
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_metrics_load(riff_rchunk_t *parent,
-    gfx_glyph_metrics_t *metrics)
-{
-	errno_t rc;
-	riff_rchunk_t mtrck;
-	tpf_glyph_metrics_t tmetrics;
-	size_t nread;
-
-	rc = riff_rchunk_match(parent, CKID_gmtr, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_read(&mtrck, (void *) &tmetrics, sizeof(tmetrics), &nread);
-	if (rc != EOK || nread != sizeof(tmetrics))
-		return EIO;
-
-	rc = riff_rchunk_end(&mtrck);
-	if (rc != EOK)
-		return rc;
-
-	metrics->advance = uint16_t_le2host(tmetrics.advance);
-	return EOK;
-}
-
-/** Save glyph metrics to RIFF TPF file.
- *
- * @param metrics Glyph metrics
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_metrics_save(gfx_glyph_metrics_t *metrics,
-    riffw_t *riffw)
-{
-	errno_t rc;
-	tpf_glyph_metrics_t tmetrics;
-	riff_wchunk_t mtrck;
-
-	tmetrics.advance = host2uint16_t_le(metrics->advance);
-
-	rc = riff_wchunk_start(riffw, CKID_gmtr, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write(riffw, (void *) &tmetrics, sizeof(tmetrics));
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_end(riffw, &mtrck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Load glyph patterns from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param glyph Glyph
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_patterns_load(riff_rchunk_t *parent,
-    gfx_glyph_t *glyph)
-{
-	errno_t rc;
-	riff_rchunk_t patck;
-	uint32_t cksize;
-	size_t i;
-	size_t nread;
-	char *buf = NULL;
-
-	rc = riff_rchunk_match(parent, CKID_gpat, &patck);
-	if (rc != EOK)
-		goto error;
-
-	cksize = riff_rchunk_size(&patck);
-	buf = malloc(cksize);
-	if (buf == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = riff_read(&patck, buf, cksize, &nread);
-	if (rc != EOK || nread != cksize)
-		goto error;
-
-	i = 0;
-	while (i < cksize) {
-		rc = gfx_glyph_set_pattern(glyph, &buf[i]);
-		if (rc != EOK)
-			goto error;
-
-		i += str_size(&buf[i]) + 1;
-	}
-
-	rc = riff_rchunk_end(&patck);
-	if (rc != EOK)
-		goto error;
-
-	free(buf);
-	return EOK;
-error:
-	if (buf != NULL)
-		free(buf);
-	return rc;
-}
-/** Save glyph patterns to RIFF TPF file.
- *
- * @param glyph Glyph
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_patterns_save(gfx_glyph_t *glyph, riffw_t *riffw)
-{
-	errno_t rc;
-	riff_wchunk_t patck;
-	gfx_glyph_pattern_t *pat;
-	const char *str;
-
-	rc = riff_wchunk_start(riffw, CKID_gpat, &patck);
-	if (rc != EOK)
-		return rc;
-
-	pat = gfx_glyph_first_pattern(glyph);
-	while (pat != NULL) {
-		str = gfx_glyph_pattern_str(pat);
-
-		rc = riff_write(riffw, (void *) str, 1 + str_size(str));
-		if (rc != EOK)
-			return rc;
-
-		pat = gfx_glyph_next_pattern(pat);
-	}
-
-	rc = riff_wchunk_end(riffw, &patck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Load glyph rectangle/origin from RIFF TPF file.
- *
- * @param parent Parent chunk
- * @param glyph Glyph
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_rectangle_origin_load(riff_rchunk_t *parent,
-    gfx_glyph_t *glyph)
-{
-	errno_t rc;
-	tpf_glyph_ror_t tror;
-	riff_rchunk_t rorck;
-	size_t nread;
-
-	rc = riff_rchunk_match(parent, CKID_gror, &rorck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_read(&rorck, (void *) &tror, sizeof(tror),
-	    &nread);
-	if (rc != EOK || nread != sizeof(tror))
-		return EIO;
-
-	rc = riff_rchunk_end(&rorck);
-	if (rc != EOK)
-		return rc;
-
-	glyph->rect.p0.x = uint32_t_le2host(tror.p0x);
-	glyph->rect.p0.y = uint32_t_le2host(tror.p0y);
-	glyph->rect.p1.x = uint32_t_le2host(tror.p1x);
-	glyph->rect.p1.y = uint32_t_le2host(tror.p1y);
-	glyph->origin.x = uint32_t_le2host(tror.orig_x);
-	glyph->origin.y = uint32_t_le2host(tror.orig_y);
-	return EOK;
-}
-
-/** Save glyph rectangle/origin to RIFF TPF file.
- *
- * @param glyph Glyph
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-static errno_t gfx_glyph_rectangle_origin_save(gfx_glyph_t *glyph,
-    riffw_t *riffw)
-{
-	errno_t rc;
-	tpf_glyph_ror_t tror;
-	riff_wchunk_t rorck;
-
-	tror.p0x = host2uint32_t_le(glyph->rect.p0.x);
-	tror.p0y = host2uint32_t_le(glyph->rect.p0.y);
-	tror.p1x = host2uint32_t_le(glyph->rect.p1.x);
-	tror.p1y = host2uint32_t_le(glyph->rect.p1.y);
-	tror.orig_x = host2uint32_t_le(glyph->origin.x);
-	tror.orig_y = host2uint32_t_le(glyph->origin.y);
-
-	rc = riff_wchunk_start(riffw, CKID_gror, &rorck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write(riffw, (void *) &tror, sizeof(tror));
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_end(riffw, &rorck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Load glyph from RIFF TPF file.
- *
- * @param font Containing font
- * @param parent Parent chunk
- * @return EOK on success or an error code
- */
-errno_t gfx_glyph_load(gfx_font_t *font, riff_rchunk_t *parent)
-{
-	errno_t rc;
-	gfx_glyph_metrics_t metrics;
-	gfx_glyph_t *glyph = NULL;
-	riff_rchunk_t glyphck;
-
-	rc = riff_rchunk_list_match(parent, LTYPE_glph, &glyphck);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_glyph_metrics_load(&glyphck, &metrics);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_glyph_create(font, &metrics, &glyph);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_glyph_patterns_load(&glyphck, glyph);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_glyph_rectangle_origin_load(&glyphck, glyph);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_rchunk_end(&glyphck);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (glyph != NULL)
-		gfx_glyph_destroy(glyph);
-	return rc;
-}
-
-/** Save glyph into RIFF TPF file.
- *
- * @param glyph Glyph
- * @param riffw RIFF writer
- * @return EOK on success or an error code
- */
-errno_t gfx_glyph_save(gfx_glyph_t *glyph, riffw_t *riffw)
-{
-	errno_t rc;
-	riff_wchunk_t glyphck;
-
-	rc = riff_wchunk_start(riffw, CKID_LIST, &glyphck);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_write_uint32(riffw, LTYPE_glph);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_glyph_metrics_save(&glyph->metrics, riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_glyph_patterns_save(glyph, riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_glyph_rectangle_origin_save(glyph, riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_end(riffw, &glyphck);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfxfont/src/glyph_bmp.c
===================================================================
--- uspace/lib/gfxfont/src/glyph_bmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,360 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Glyph bitmap
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-#include <gfx/glyph_bmp.h>
-#include <io/pixelmap.h>
-#include <stdlib.h>
-#include "../private/font.h"
-#include "../private/glyph.h"
-#include "../private/glyph_bmp.h"
-
-static errno_t gfx_glyph_bmp_extend(gfx_glyph_bmp_t *, gfx_coord2_t *);
-
-/** Open glyph bitmap for editing.
- *
- * @param glyph Glyph
- * @param rbmp Place to store glyph bitmap
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t gfx_glyph_bmp_open(gfx_glyph_t *glyph, gfx_glyph_bmp_t **rbmp)
-{
-	gfx_font_t *font = glyph->font;
-	gfx_glyph_bmp_t *bmp;
-	pixelmap_t pmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord_t x, y;
-	pixel_t pixel;
-	errno_t rc;
-
-	bmp = calloc(1, sizeof(gfx_glyph_bmp_t));
-	if (bmp == NULL)
-		return ENOMEM;
-
-	/* Bitmap coordinates are relative to glyph origin point */
-	gfx_rect_rtranslate(&glyph->origin, &glyph->rect, &bmp->rect);
-
-	bmp->pixels = calloc((bmp->rect.p1.x - bmp->rect.p0.x) *
-	    (bmp->rect.p1.y - bmp->rect.p0.y), sizeof(int));
-	if (bmp->pixels == NULL) {
-		free(bmp);
-		return ENOMEM;
-	}
-
-	rc = gfx_bitmap_get_alloc(font->bitmap, &alloc);
-	if (rc != EOK) {
-		free(bmp->pixels);
-		free(bmp);
-		return rc;
-	}
-
-	assert(font->rect.p0.x == 0);
-	assert(font->rect.p0.y == 0);
-	pmap.width = font->rect.p1.x;
-	pmap.height = font->rect.p1.y;
-	pmap.data = alloc.pixels;
-
-	/* Copy pixels from font bitmap */
-
-	for (y = bmp->rect.p0.y; y < bmp->rect.p1.y; y++) {
-		for (x = bmp->rect.p0.x; x < bmp->rect.p1.x; x++) {
-			pixel = pixelmap_get_pixel(&pmap, glyph->origin.x + x,
-			    glyph->origin.y + y);
-			bmp->pixels[(y - bmp->rect.p0.y) *
-			    (bmp->rect.p1.x - bmp->rect.p0.x) +
-			    (x - bmp->rect.p0.x)] = (pixel != 0) ? 1 : 0;
-		}
-	}
-
-	bmp->glyph = glyph;
-	*rbmp = bmp;
-	return EOK;
-}
-
-/** Save glyph bitmap.
- *
- * @param bmp Glyph bitmap
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t gfx_glyph_bmp_save(gfx_glyph_bmp_t *bmp)
-{
-	gfx_glyph_t *glyph = bmp->glyph;
-	gfx_font_t *font = glyph->font;
-	gfx_coord_t x, y;
-	gfx_rect_t used_rect;
-	pixel_t pixel;
-	pixelmap_t pmap;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	/* Find actual rectangle being used */
-	gfx_glyph_bmp_find_used_rect(bmp, &used_rect);
-
-	/*
-	 * Replace glyph with empty space in the font bitmap, the width
-	 * of the empty equal to new glyph bitmap width. The glyph width
-	 * is adjusted.
-	 */
-	rc = gfx_font_splice_at_glyph(font, glyph, &used_rect);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_bitmap_get_alloc(font->bitmap, &alloc);
-	if (rc != EOK)
-		return rc;
-
-	assert(font->rect.p0.x == 0);
-	assert(font->rect.p0.y == 0);
-	pmap.width = font->rect.p1.x;
-	pmap.height = font->rect.p1.y;
-	pmap.data = alloc.pixels;
-
-	/* Copy pixels to font bitmap */
-
-	for (y = used_rect.p0.y; y < used_rect.p1.y; y++) {
-		for (x = used_rect.p0.x; x < used_rect.p1.x; x++) {
-			pixel = bmp->pixels[(y - bmp->rect.p0.y) *
-			    (bmp->rect.p1.x - bmp->rect.p0.x) +
-			    (x - bmp->rect.p0.x)] ?
-			    PIXEL(255, 255, 255, 255) : PIXEL(0, 0, 0, 0);
-			pixelmap_put_pixel(&pmap, glyph->origin.x + x,
-			    glyph->origin.y + y, pixel);
-		}
-	}
-
-	return EOK;
-}
-
-/** Close glyph bitmap.
- *
- * @param bmp Glyph bitmap
- */
-void gfx_glyph_bmp_close(gfx_glyph_bmp_t *bmp)
-{
-	free(bmp->pixels);
-	free(bmp);
-}
-
-/** Get rectangle covered by glyph bitmap.
- *
- * @param bmp Glyph bitmap
- * @param rect Place to store rectangle
- */
-void gfx_glyph_bmp_get_rect(gfx_glyph_bmp_t *bmp, gfx_rect_t *rect)
-{
-	*rect = bmp->rect;
-}
-
-/** Find minimum rectangle covering all non-background pixels.
- *
- * @param bmp Glyph bitmap
- * @param rect Place to store rectangle
- */
-void gfx_glyph_bmp_find_used_rect(gfx_glyph_bmp_t *bmp, gfx_rect_t *rect)
-{
-	gfx_coord_t x, y;
-	gfx_coord2_t min;
-	gfx_coord2_t max;
-	bool anypix;
-	int pix;
-
-	min.x = bmp->rect.p1.x;
-	min.y = bmp->rect.p1.y;
-	max.x = bmp->rect.p0.x;
-	max.y = bmp->rect.p0.y;
-
-	anypix = false;
-	for (y = bmp->rect.p0.y; y < bmp->rect.p1.y; y++) {
-		for (x = bmp->rect.p0.x; x < bmp->rect.p1.x; x++) {
-			pix = gfx_glyph_bmp_getpix(bmp, x, y);
-			if (pix != 0) {
-				anypix = true;
-				if (x < min.x)
-					min.x = x;
-				if (y < min.y)
-					min.y = y;
-				if (x > max.x)
-					max.x = x;
-				if (y > max.y)
-					max.y = y;
-			}
-		}
-	}
-
-	if (anypix) {
-		rect->p0.x = min.x;
-		rect->p0.y = min.y;
-		rect->p1.x = max.x + 1;
-		rect->p1.y = max.y + 1;
-	} else {
-		rect->p0.x = 0;
-		rect->p0.y = 0;
-		rect->p1.x = 0;
-		rect->p1.y = 0;
-	}
-}
-
-/** Get pixel from glyph bitmap.
- *
- * @param bmp Glyph bitmap
- * @param x X-coordinate
- * @param y Y-coordinate
- * @return Pixel value
- */
-int gfx_glyph_bmp_getpix(gfx_glyph_bmp_t *bmp, gfx_coord_t x, gfx_coord_t y)
-{
-	gfx_coord2_t pos;
-	size_t pitch;
-
-	pos.x = x;
-	pos.y = y;
-	if (!gfx_pix_inside_rect(&pos, &bmp->rect))
-		return 0;
-
-	pitch = bmp->rect.p1.x - bmp->rect.p0.x;
-
-	return bmp->pixels[(y - bmp->rect.p0.y) * pitch +
-	    (x - bmp->rect.p0.x)];
-}
-
-/** Set pixel in glyph bitmap.
- *
- * @param bmp Glyph bitmap
- * @param x X-coordinate
- * @param y Y-coordinate
- *
- * @reutrn EOK on success, ENOMEM if out of memory
- */
-errno_t gfx_glyph_bmp_setpix(gfx_glyph_bmp_t *bmp, gfx_coord_t x,
-    gfx_coord_t y, int value)
-{
-	gfx_coord2_t pos;
-	size_t pitch;
-	errno_t rc;
-
-	pos.x = x;
-	pos.y = y;
-
-	if (!gfx_pix_inside_rect(&pos, &bmp->rect)) {
-		rc = gfx_glyph_bmp_extend(bmp, &pos);
-		if (rc != EOK)
-			return rc;
-	}
-
-	pitch = bmp->rect.p1.x - bmp->rect.p0.x;
-	bmp->pixels[(y - bmp->rect.p0.y) * pitch +
-	    (x - bmp->rect.p0.x)] = value;
-	return EOK;
-}
-
-/** Clear glyph bitmap
- *
- * @param bmp Glyph bitmap
- *
- * @return EOK on sucesss, ENOMEM if out of memory
- */
-errno_t gfx_glyph_bmp_clear(gfx_glyph_bmp_t *bmp)
-{
-	int *npixels;
-
-	/* Allocate new pixel array */
-	npixels = calloc(1, sizeof(int));
-	if (npixels == NULL)
-		return ENOMEM;
-
-	/* Switch new and old data */
-	free(bmp->pixels);
-	bmp->pixels = npixels;
-	bmp->rect.p0.x = 0;
-	bmp->rect.p0.y = 0;
-	bmp->rect.p1.x = 0;
-	bmp->rect.p1.y = 0;
-
-	return EOK;
-}
-
-/** Extend glyph bitmap to cover a patricular pixel.
- *
- * @param bmp Glyph bitmap
- * @param pos Pixel position
- *
- * @return EOK on sucesss, ENOMEM if out of memory
- */
-static errno_t gfx_glyph_bmp_extend(gfx_glyph_bmp_t *bmp, gfx_coord2_t *pos)
-{
-	gfx_rect_t prect;
-	gfx_rect_t nrect;
-	int *npixels;
-	size_t npitch;
-	size_t opitch;
-	gfx_coord_t x, y;
-
-	/* Compute new rectangle enveloping current rectangle and new pixel */
-	prect.p0 = *pos;
-	prect.p1.x = prect.p0.x + 1;
-	prect.p1.y = prect.p0.y + 1;
-
-	gfx_rect_envelope(&bmp->rect, &prect, &nrect);
-
-	/* Allocate new pixel array */
-	npixels = calloc((nrect.p1.x - nrect.p0.x) *
-	    (nrect.p1.y - nrect.p0.y), sizeof(int));
-	if (npixels == NULL)
-		return ENOMEM;
-
-	/* Transfer pixel data */
-	opitch = bmp->rect.p1.x - bmp->rect.p0.x;
-	npitch = nrect.p1.x - nrect.p0.x;
-
-	for (y = bmp->rect.p0.y; y < bmp->rect.p1.y; y++) {
-		for (x = bmp->rect.p0.x; x < bmp->rect.p1.x; x++) {
-			npixels[(y - nrect.p0.y) * npitch + x - nrect.p0.x] =
-			    bmp->pixels[(y - bmp->rect.p0.y) * opitch +
-			    x - bmp->rect.p0.x];
-		}
-	}
-
-	/* Switch new and old data */
-	free(bmp->pixels);
-	bmp->pixels = npixels;
-	bmp->rect = nrect;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfxfont/src/text.c
===================================================================
--- uspace/lib/gfxfont/src/text.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,482 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Text rendering
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pixelmap.h>
-#include <mem.h>
-#include <str.h>
-#include "../private/font.h"
-#include "../private/typeface.h"
-
-/** Initialize text formatting structure.
- *
- * Text formatting structure must always be initialized using this function
- * first.
- *
- * @param fmt Text formatting structure
- */
-void gfx_text_fmt_init(gfx_text_fmt_t *fmt)
-{
-	memset(fmt, 0, sizeof(gfx_text_fmt_t));
-}
-
-/** Compute text width.
- *
- * @param font Font
- * @param str String
- * @return Text width
- */
-gfx_coord_t gfx_text_width(gfx_font_t *font, const char *str)
-{
-	gfx_glyph_metrics_t gmetrics;
-	size_t stradv;
-	const char *cp;
-	gfx_glyph_t *glyph;
-	gfx_coord_t width;
-	errno_t rc;
-
-	if ((font->finfo->props.flags & gff_text_mode) != 0)
-		return str_width(str);
-
-	width = 0;
-	cp = str;
-	while (*cp != '\0') {
-		rc = gfx_font_search_glyph(font, cp, &glyph, &stradv);
-		if (rc != EOK) {
-			++cp;
-			continue;
-		}
-
-		gfx_glyph_get_metrics(glyph, &gmetrics);
-
-		cp += stradv;
-		width += gmetrics.advance;
-	}
-
-	return width;
-}
-
-/** Print string using text characters in text mode.
- *
- * @param pos Position of top-left corner of text
- * @param fmt Formatting
- * @param str String
- * @return EOK on success or an error code
- */
-static errno_t gfx_puttext_textmode(gfx_coord2_t *pos, gfx_text_fmt_t *fmt,
-    const char *str)
-{
-	gfx_context_t *gc = fmt->font->typeface->gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord_t width;
-	uint8_t attr;
-	pixelmap_t pmap;
-	gfx_coord_t x;
-	gfx_coord_t rmargin;
-	pixel_t pixel;
-	char32_t c;
-	size_t off;
-	bool ellipsis;
-	errno_t rc;
-
-	width = str_width(str);
-	if (fmt->abbreviate && width > fmt->width) {
-		ellipsis = true;
-		width = fmt->width;
-		if (width > 3)
-			rmargin = width - 3;
-		else
-			rmargin = width;
-	} else {
-		ellipsis = false;
-		rmargin = width;
-	}
-
-	/*
-	 * NOTE: Creating and destroying bitmap each time is not probably
-	 * the most efficient way.
-	 */
-
-	gfx_color_get_ega(fmt->color, &attr);
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = width;
-	params.rect.p1.y = 1;
-
-	if (params.rect.p1.x == 0) {
-		/* Nothing to do. Avoid creating bitmap of zero width. */
-		return EOK;
-	}
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(bitmap);
-		return rc;
-	}
-
-	pmap.width = params.rect.p1.x;
-	pmap.height = 1;
-	pmap.data = alloc.pixels;
-
-	off = 0;
-	for (x = 0; x < rmargin; x++) {
-		c = str_decode(str, &off, STR_NO_LIMIT);
-		pixel = PIXEL(attr,
-		    (c >> 16) & 0xff,
-		    (c >> 8) & 0xff,
-		    c & 0xff);
-		pixelmap_put_pixel(&pmap, x, 0, pixel);
-	}
-
-	if (ellipsis) {
-		for (x = rmargin; x < params.rect.p1.x; x++) {
-			c = '.';
-			pixel = PIXEL(attr,
-			    (c >> 16) & 0xff,
-			    (c >> 8) & 0xff,
-			    c & 0xff);
-			pixelmap_put_pixel(&pmap, x, 0, pixel);
-		}
-	}
-
-	rc = gfx_bitmap_render(bitmap, NULL, pos);
-
-	gfx_bitmap_destroy(bitmap);
-	return rc;
-}
-
-/** Get text starting position.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String
- * @param spos Place to store starting position
- */
-void gfx_text_start_pos(gfx_coord2_t *pos, gfx_text_fmt_t *fmt,
-    const char *str, gfx_coord2_t *spos)
-{
-	gfx_font_metrics_t fmetrics;
-	gfx_coord_t width;
-
-	*spos = *pos;
-
-	/* Adjust position for horizontal alignment */
-	if (fmt->halign != gfx_halign_left) {
-		/* Compute text width */
-		width = gfx_text_width(fmt->font, str);
-		if (fmt->abbreviate && width > fmt->width)
-			width = fmt->width;
-
-		switch (fmt->halign) {
-		case gfx_halign_center:
-			spos->x -= width / 2;
-			break;
-		case gfx_halign_right:
-			spos->x -= width;
-			break;
-		default:
-			break;
-		}
-	}
-
-	/* Adjust position for vertical alignment */
-	gfx_font_get_metrics(fmt->font, &fmetrics);
-
-	if (fmt->valign != gfx_valign_baseline) {
-		switch (fmt->valign) {
-		case gfx_valign_top:
-			spos->y += fmetrics.ascent;
-			break;
-		case gfx_valign_center:
-			spos->y += fmetrics.ascent / 2;
-			break;
-		case gfx_valign_bottom:
-			spos->y -= fmetrics.descent + 1;
-			break;
-		default:
-			break;
-		}
-	}
-}
-
-/** Render text.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String
- * @return EOK on success or an error code
- */
-errno_t gfx_puttext(gfx_coord2_t *pos, gfx_text_fmt_t *fmt, const char *str)
-{
-	gfx_glyph_metrics_t gmetrics;
-	gfx_font_metrics_t fmetrics;
-	size_t stradv;
-	const char *cp;
-	gfx_glyph_t *glyph;
-	gfx_coord2_t cpos;
-	gfx_coord2_t spos;
-	gfx_rect_t rect;
-	gfx_coord_t width;
-	gfx_coord_t rmargin;
-	bool ellipsis;
-	errno_t rc;
-
-	gfx_text_start_pos(pos, fmt, str, &spos);
-
-	/* Text mode */
-	if ((fmt->font->finfo->props.flags & gff_text_mode) != 0)
-		return gfx_puttext_textmode(&spos, fmt, str);
-
-	rc = gfx_set_color(fmt->font->typeface->gc, fmt->color);
-	if (rc != EOK)
-		return rc;
-
-	width = gfx_text_width(fmt->font, str);
-
-	if (fmt->abbreviate && width > fmt->width) {
-		/* Need to append ellipsis */
-		ellipsis = true;
-		rmargin = spos.x + fmt->width - gfx_text_width(fmt->font, "...");
-	} else {
-		ellipsis = false;
-		rmargin = spos.x + width;
-	}
-
-	cpos = spos;
-	cp = str;
-	while (*cp != '\0') {
-		rc = gfx_font_search_glyph(fmt->font, cp, &glyph, &stradv);
-		if (rc != EOK) {
-			++cp;
-			continue;
-		}
-
-		gfx_glyph_get_metrics(glyph, &gmetrics);
-
-		/* Stop if we would run over the right margin */
-		if (fmt->abbreviate && cpos.x + gmetrics.advance > rmargin)
-			break;
-
-		rc = gfx_glyph_render(glyph, &cpos);
-		if (rc != EOK)
-			return rc;
-
-		cp += stradv;
-		cpos.x += gmetrics.advance;
-	}
-
-	/* Text underlining */
-	if (fmt->underline) {
-		gfx_font_get_metrics(fmt->font, &fmetrics);
-
-		rect.p0.x = spos.x;
-		rect.p0.y = spos.y + fmetrics.underline_y0;
-		rect.p1.x = cpos.x;
-		rect.p1.y = spos.y + fmetrics.underline_y1;
-
-		rc = gfx_fill_rect(fmt->font->typeface->gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	/* Render ellipsis, if required */
-	if (ellipsis) {
-		rc = gfx_font_search_glyph(fmt->font, ".", &glyph, &stradv);
-		if (rc != EOK)
-			return EOK;
-
-		gfx_glyph_get_metrics(glyph, &gmetrics);
-
-		rc = gfx_glyph_render(glyph, &cpos);
-		if (rc != EOK)
-			return rc;
-
-		cpos.x += gmetrics.advance;
-
-		rc = gfx_glyph_render(glyph, &cpos);
-		if (rc != EOK)
-			return rc;
-
-		cpos.x += gmetrics.advance;
-
-		rc = gfx_glyph_render(glyph, &cpos);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Find character position in string by X coordinate.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String
- * @param fpos Position for which we need to find offset
- *
- * @return Byte offset in @a str of character corresponding to position
- *         @a fpos. Note that the position is rounded, that is,
- *         if it is before the center of character A, it will return
- *         offset of A, if it is after the center of A, it will return
- *         offset of the following character.
- */
-size_t gfx_text_find_pos(gfx_coord2_t *pos, gfx_text_fmt_t *fmt,
-    const char *str, gfx_coord2_t *fpos)
-{
-	gfx_glyph_metrics_t gmetrics;
-	size_t stradv;
-	const char *cp;
-	gfx_glyph_t *glyph;
-	gfx_coord2_t cpos;
-	size_t off;
-	size_t strsize;
-	errno_t rc;
-
-	gfx_text_start_pos(pos, fmt, str, &cpos);
-
-	/* Text mode */
-	if ((fmt->font->finfo->props.flags & gff_text_mode) != 0) {
-		off = 0;
-		strsize = str_size(str);
-		while (off < strsize) {
-			if (fpos->x <= cpos.x)
-				return off;
-			(void) str_decode(str, &off, strsize);
-			cpos.x++;
-		}
-
-		return off;
-	}
-
-	cp = str;
-	off = 0;
-	while (*cp != '\0') {
-		rc = gfx_font_search_glyph(fmt->font, cp, &glyph, &stradv);
-		if (rc != EOK) {
-			++cp;
-			continue;
-		}
-
-		gfx_glyph_get_metrics(glyph, &gmetrics);
-
-		if (fpos->x < cpos.x + gmetrics.advance / 2)
-			return off;
-
-		cp += stradv;
-		off += stradv;
-		cpos.x += gmetrics.advance;
-	}
-
-	return off;
-}
-
-/** Get text continuation parameters.
- *
- * Return the anchor position and format needed to continue printing
- * text after the specified string. It is allowed for the sources
- * (@a pos, @a fmt) and destinations (@a cpos, @a cfmt) to point
- * to the same objects, respectively.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String
- * @param cpos Place to store anchor position for continuation
- * @param cfmt Place to store format for continuation
- */
-void gfx_text_cont(gfx_coord2_t *pos, gfx_text_fmt_t *fmt, const char *str,
-    gfx_coord2_t *cpos, gfx_text_fmt_t *cfmt)
-{
-	gfx_coord2_t spos;
-	gfx_text_fmt_t tfmt;
-
-	/* Continuation should start where the current string ends */
-	gfx_text_start_pos(pos, fmt, str, &spos);
-	cpos->x = spos.x + gfx_text_width(fmt->font, str);
-	cpos->y = spos.y;
-
-	/*
-	 * Formatting is the same, except the text should be aligned
-	 * so that it starts at the anchor point.
-	 */
-	tfmt = *fmt;
-	tfmt.halign = gfx_halign_left;
-	tfmt.valign = gfx_valign_baseline;
-
-	/* Remaining available width */
-	tfmt.width = fmt->width - (cpos->x - spos.x);
-
-	*cfmt = tfmt;
-}
-
-/** Get text bounding rectangle.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String
- * @param rect Place to store bounding rectangle
- */
-void gfx_text_rect(gfx_coord2_t *pos, gfx_text_fmt_t *fmt, const char *str,
-    gfx_rect_t *rect)
-{
-	gfx_coord2_t spos;
-	gfx_coord_t width;
-
-	gfx_text_start_pos(pos, fmt, str, &spos);
-	width = gfx_text_width(fmt->font, str);
-	if (fmt->abbreviate && width > fmt->width)
-		width = fmt->width;
-
-	rect->p0.x = spos.x;
-	rect->p0.y = spos.y - fmt->font->metrics.ascent;
-	rect->p1.x = spos.x + width;
-	rect->p1.y = spos.y +  fmt->font->metrics.descent + 1;
-}
-
-/** @}
- */
Index: pace/lib/gfxfont/src/typeface.c
===================================================================
--- uspace/lib/gfxfont/src/typeface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,274 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfxfont
- * @{
- */
-/**
- * @file Typeface
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/typeface.h>
-#include <mem.h>
-#include <riff/chunk.h>
-#include <stdlib.h>
-#include "../private/font.h"
-#include "../private/glyph.h"
-#include "../private/tpf_file.h"
-#include "../private/typeface.h"
-
-/** Create typeface in graphics context.
- *
- * @param gc Graphic context
- * @param rtface Place to store pointer to new typeface
- *
- * @return EOK on success, EINVAL if parameters are invald,
- *         ENOMEM if insufficient resources, EIO if graphic device connection
- *         was lost
- */
-errno_t gfx_typeface_create(gfx_context_t *gc, gfx_typeface_t **rtface)
-{
-	gfx_typeface_t *tface;
-
-	tface = calloc(1, sizeof(gfx_typeface_t));
-	if (tface == NULL)
-		return ENOMEM;
-
-	tface->gc = gc;
-	list_initialize(&tface->fonts);
-
-	*rtface = tface;
-	return EOK;
-}
-
-/** Destroy typeface.
- *
- * @param tface Typeface
- */
-void gfx_typeface_destroy(gfx_typeface_t *tface)
-{
-	gfx_font_info_t *finfo;
-
-	if (tface->riffr != NULL)
-		(void) riff_rclose(tface->riffr);
-
-	finfo = gfx_typeface_first_font(tface);
-	while (finfo != NULL) {
-		if (finfo->font != NULL)
-			gfx_font_close(finfo->font);
-		list_remove(&finfo->lfonts);
-		free(finfo);
-
-		finfo = gfx_typeface_first_font(tface);
-	}
-
-	free(tface);
-}
-
-/** Get info on first font in typeface.
- *
- * @param tface Typeface
- * @return First font info or @c NULL if there are none
- */
-gfx_font_info_t *gfx_typeface_first_font(gfx_typeface_t *tface)
-{
-	link_t *link;
-
-	link = list_first(&tface->fonts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_font_info_t, lfonts);
-}
-
-/** Get info on next font in typeface.
- *
- * @param cur Current font info
- * @return Next font info in font or @c NULL if @a cur was the last one
- */
-gfx_font_info_t *gfx_typeface_next_font(gfx_font_info_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lfonts, &cur->typeface->fonts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, gfx_font_info_t, lfonts);
-}
-
-/** Open typeface from a TPF file.
- *
- * @param gc Graphic context
- * @param fname File name
- * @param rtface Place to store pointer to open typeface
- * @return EOK on success or an error code
- */
-errno_t gfx_typeface_open(gfx_context_t *gc, const char *fname,
-    gfx_typeface_t **rtface)
-{
-	riffr_t *riffr = NULL;
-	gfx_typeface_t *tface = NULL;
-	errno_t rc;
-	riff_rchunk_t riffck;
-	uint32_t format;
-
-	rc = gfx_typeface_create(gc, &tface);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_ropen(fname, &riffck, &riffr);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_read_uint32(&riffck, &format);
-	if (rc != EOK)
-		goto error;
-
-	if (format != FORM_TPFC) {
-		rc = ENOTSUP;
-		goto error;
-	}
-
-	while (true) {
-		rc = gfx_font_info_load(tface, &riffck);
-		if (rc == ENOENT)
-			break;
-
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = riff_rchunk_end(&riffck);
-	if (rc != EOK)
-		goto error;
-
-	tface->riffr = riffr;
-	*rtface = tface;
-	return EOK;
-error:
-	if (riffr != NULL)
-		riff_rclose(riffr);
-	if (tface != NULL)
-		gfx_typeface_destroy(tface);
-	return rc;
-}
-
-/** Make sure all typeface fonts are loaded.
- *
- * @param tface Typeface
- * @return EOK on success or an error code
- */
-static errno_t gfx_typeface_loadin(gfx_typeface_t *tface)
-{
-	gfx_font_t *font;
-	gfx_font_info_t *finfo;
-	errno_t rc;
-
-	finfo = gfx_typeface_first_font(tface);
-	while (finfo != NULL) {
-		/* Open font to make sure it is loaded */
-		rc = gfx_font_open(finfo, &font);
-		if (rc != EOK)
-			return rc;
-
-		/* Don't need this anymore */
-		(void)font;
-
-		finfo = gfx_typeface_next_font(finfo);
-	}
-
-	return EOK;
-}
-
-/** Save typeface into a TPF file.
- *
- * @param tface Typeface
- * @param fname Destination file name
- * @return EOK on success or an error code
- */
-errno_t gfx_typeface_save(gfx_typeface_t *tface, const char *fname)
-{
-	riffw_t *riffw = NULL;
-	errno_t rc;
-	gfx_font_info_t *finfo;
-	riff_wchunk_t riffck;
-
-	/*
-	 * Make sure all fonts are loaded before writing (in case
-	 * we are writing into our original backing file).
-	 */
-	rc = gfx_typeface_loadin(tface);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wopen(fname, &riffw);
-	if (rc != EOK)
-		return rc;
-
-	rc = riff_wchunk_start(riffw, CKID_RIFF, &riffck);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_write_uint32(riffw, FORM_TPFC);
-	if (rc != EOK)
-		goto error;
-
-	finfo = gfx_typeface_first_font(tface);
-	while (finfo != NULL) {
-		/* Save font */
-		rc = gfx_font_save(finfo, riffw);
-		if (rc != EOK)
-			goto error;
-
-		finfo = gfx_typeface_next_font(finfo);
-	}
-
-	rc = riff_wchunk_end(riffw, &riffck);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_wclose(riffw);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-error:
-	if (riffw != NULL)
-		riff_wclose(riffw);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/gfxfont/test/font.c
===================================================================
--- uspace/lib/gfxfont/test/font.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,543 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/typeface.h>
-#include <pcut/pcut.h>
-#include "../private/font.h"
-#include "../private/typeface.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(font);
-
-/** Test creating and destroying font */
-PCUT_TEST(create_destroy)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test creating and destroying text-mode font */
-PCUT_TEST(create_textmode_destroy)
-{
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_font_create_textmode(tface, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_get_metrics() */
-PCUT_TEST(get_metrics)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_font_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-	metrics.ascent = 1;
-	metrics.descent = 2;
-	metrics.leading = 3;
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_get_metrics(font, &gmetrics);
-	PCUT_ASSERT_INT_EQUALS(metrics.ascent, gmetrics.ascent);
-	PCUT_ASSERT_INT_EQUALS(metrics.descent, gmetrics.descent);
-	PCUT_ASSERT_INT_EQUALS(metrics.leading, gmetrics.leading);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_set_metrics() */
-PCUT_TEST(set_metrics)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics1;
-	gfx_font_metrics_t metrics2;
-	gfx_font_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-
-	gfx_font_metrics_init(&metrics1);
-	metrics1.ascent = 1;
-	metrics1.descent = 2;
-	metrics1.leading = 3;
-
-	rc = gfx_font_create(tface, &props, &metrics1, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics2);
-	metrics1.ascent = 4;
-	metrics1.descent = 5;
-	metrics1.leading = 6;
-
-	rc = gfx_font_set_metrics(font, &metrics2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_get_metrics(font, &gmetrics);
-	PCUT_ASSERT_INT_EQUALS(metrics2.ascent, gmetrics.ascent);
-	PCUT_ASSERT_INT_EQUALS(metrics2.descent, gmetrics.descent);
-	PCUT_ASSERT_INT_EQUALS(metrics2.leading, gmetrics.leading);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_first_glyph() */
-PCUT_TEST(first_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph;
-	gfx_glyph_t *gfirst;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Should get NULL since there is no glyph in the font */
-	glyph = gfx_font_first_glyph(font);
-	PCUT_ASSERT_NULL(glyph);
-
-	/* Now add one */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* gfx_font_first_glyph() should return the same */
-	gfirst = gfx_font_first_glyph(font);
-	PCUT_ASSERT_EQUALS(glyph, gfirst);
-
-	gfx_glyph_destroy(glyph);
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_next_glyph() */
-PCUT_TEST(next_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph1;
-	gfx_glyph_t *glyph2;
-	gfx_glyph_t *gfirst;
-	gfx_glyph_t *gsecond;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add first glyph */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add second glyph */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* gfx_font_first_glyph() should return glyph1 */
-	gfirst = gfx_font_first_glyph(font);
-	PCUT_ASSERT_EQUALS(glyph1, gfirst);
-
-	/* gfx_font_next_glyph() should return glyph2 */
-	gsecond = gfx_font_next_glyph(gfirst);
-	PCUT_ASSERT_EQUALS(glyph2, gsecond);
-
-	gfx_glyph_destroy(glyph1);
-	gfx_glyph_destroy(glyph2);
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_last_glyph() */
-PCUT_TEST(last_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph;
-	gfx_glyph_t *glast;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Should get NULL since there is no glyph in the font */
-	glyph = gfx_font_last_glyph(font);
-	PCUT_ASSERT_NULL(glyph);
-
-	/* Now add one */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* gfx_font_last_glyph() should return the same */
-	glast = gfx_font_last_glyph(font);
-	PCUT_ASSERT_EQUALS(glyph, glast);
-
-	gfx_glyph_destroy(glyph);
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_prev_glyph() */
-PCUT_TEST(prev_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph1;
-	gfx_glyph_t *glyph2;
-	gfx_glyph_t *gfirst;
-	gfx_glyph_t *gsecond;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add first glyph */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add second glyph */
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* gfx_font_last_glyph() should return glyph2 */
-	gsecond = gfx_font_last_glyph(font);
-	PCUT_ASSERT_EQUALS(glyph2, gsecond);
-
-	/* gfx_font_prev_glyph() should return glyph1 */
-	gfirst = gfx_font_prev_glyph(gsecond);
-	PCUT_ASSERT_EQUALS(glyph1, gfirst);
-
-	gfx_glyph_destroy(glyph1);
-	gfx_glyph_destroy(glyph2);
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_search_glyph() */
-PCUT_TEST(search_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph;
-	size_t bytes;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_metrics_init(&metrics);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_font_search_glyph(font, "Hello", &glyph, &bytes);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_splice_at_glyph() */
-PCUT_TEST(splice_at_glyph)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_rect_t nrect;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &props, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	nrect.p0.x = -5;
-	nrect.p0.y = -5;
-	nrect.p1.x = 5;
-	nrect.p1.y = 5;
-	rc = gfx_font_splice_at_glyph(font, glyph, &nrect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_font_bitmap_pack() properly packs bitmap */
-PCUT_TEST(bitmap_pack)
-{
-	errno_t rc;
-	gfx_coord_t width, height;
-	gfx_coord_t i;
-	uint32_t *pixels;
-	void *data;
-	size_t size;
-	uint8_t *dp;
-
-	width = 10;
-	height = 10;
-
-	pixels = calloc(width * height, sizeof(uint32_t));
-	PCUT_ASSERT_NOT_NULL(pixels);
-
-	for (i = 0; i < 10; i++)
-		pixels[i * width + i] = PIXEL(255, 255, 255, 255);
-
-	rc = gfx_font_bitmap_pack(width, height, pixels, &data, &size);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(data);
-	PCUT_ASSERT_INT_EQUALS(20, size);
-
-	dp = data;
-
-	for (i = 0; i < 8; i++) {
-		PCUT_ASSERT_INT_EQUALS(0x80 >> i, dp[2 * i]);
-		PCUT_ASSERT_INT_EQUALS(0, dp[2 * i + 1]);
-	}
-
-	for (i = 8; i < 10; i++) {
-		PCUT_ASSERT_INT_EQUALS(0, dp[2 * i]);
-		PCUT_ASSERT_INT_EQUALS(0x80 >> (i - 8), dp[2 * i + 1]);
-	}
-}
-
-/** Test gfx_font_bitmap_unpack() properly unpacks bitmap */
-PCUT_TEST(bitmap_unpack)
-{
-	errno_t rc;
-	gfx_coord_t width, height;
-	gfx_coord_t i, j;
-	uint32_t epix;
-	uint32_t *pixels;
-	uint8_t data[20];
-
-	width = 10;
-	height = 10;
-
-	for (i = 0; i < 8; i++) {
-		data[2 * i] = 0x80 >> i;
-		data[2 * i + 1] = 0;
-	}
-
-	for (i = 8; i < 10; i++) {
-		data[2 * i] = 0;
-		data[2 * i + 1] = 0x80 >> (i - 8);
-	}
-
-	pixels = calloc(width * height, sizeof(uint32_t));
-	PCUT_ASSERT_NOT_NULL(pixels);
-
-	rc = gfx_font_bitmap_unpack(width, height, data, sizeof(data),
-	    pixels);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	for (j = 0; j < 10; j++) {
-		for (i = 0; i < 10; i++) {
-			epix = (i == j) ? PIXEL(255, 255, 255, 255) :
-			    PIXEL(0, 0, 0, 0);
-			PCUT_ASSERT_INT_EQUALS(epix, pixels[j * width + i]);
-		}
-	}
-}
-
-PCUT_EXPORT(font);
Index: pace/lib/gfxfont/test/glyph.c
===================================================================
--- uspace/lib/gfxfont/test/glyph.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,542 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/glyph_bmp.h>
-#include <gfx/typeface.h>
-#include <io/pixelmap.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <str.h>
-#include "../private/glyph.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(glyph);
-
-/** Test creating and destroying glyph */
-PCUT_TEST(create_destroy)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_get_metrics() */
-PCUT_TEST(get_metrics)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_glyph_metrics_t rmetrics;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 42;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_get_metrics(glyph, &rmetrics);
-	PCUT_ASSERT_INT_EQUALS(gmetrics.advance, rmetrics.advance);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_set_metrics() */
-PCUT_TEST(set_metrics)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics1;
-	gfx_glyph_metrics_t gmetrics2;
-	gfx_glyph_t *glyph;
-	gfx_glyph_metrics_t rmetrics;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics1);
-	gmetrics1.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics1, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics2);
-	gmetrics2.advance = 2;
-
-	gfx_glyph_set_metrics(glyph, &gmetrics2);
-
-	gfx_glyph_get_metrics(glyph, &rmetrics);
-	PCUT_ASSERT_INT_EQUALS(gmetrics2.advance, rmetrics.advance);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_set_pattern() */
-PCUT_TEST(set_pattern)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Set a pattern */
-	rc = gfx_glyph_set_pattern(glyph, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Setting the same pattern again should be OK */
-	rc = gfx_glyph_set_pattern(glyph, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_clear_pattern() */
-PCUT_TEST(clear_pattern)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Set a pattern */
-	rc = gfx_glyph_set_pattern(glyph, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Now clear a different pattern - should be OK */
-	gfx_glyph_clear_pattern(glyph, "AA");
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Now clear the pattern which has been set */
-	gfx_glyph_clear_pattern(glyph, "A");
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_matches() */
-PCUT_TEST(matches)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	bool match;
-	size_t msize;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Set a pattern */
-	rc = gfx_glyph_set_pattern(glyph, "AB");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	match = gfx_glyph_matches(glyph, "A", &msize);
-	PCUT_ASSERT_FALSE(match);
-
-	match = gfx_glyph_matches(glyph, "AB", &msize);
-	PCUT_ASSERT_TRUE(match);
-	PCUT_ASSERT_INT_EQUALS(2, msize);
-
-	match = gfx_glyph_matches(glyph, "ABC", &msize);
-	PCUT_ASSERT_TRUE(match);
-	PCUT_ASSERT_INT_EQUALS(2, msize);
-
-	match = gfx_glyph_matches(glyph, "BAB", &msize);
-	PCUT_ASSERT_FALSE(match);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_first_pattern(), gfx_glyph_next_pattern() */
-PCUT_TEST(first_next_pattern)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	gfx_glyph_pattern_t *pat;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Set a pattern */
-	rc = gfx_glyph_set_pattern(glyph, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	pat = gfx_glyph_first_pattern(glyph);
-	PCUT_ASSERT_NOT_NULL(pat);
-
-	pat = gfx_glyph_next_pattern(pat);
-	PCUT_ASSERT_NULL(pat);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_pattern_str() */
-PCUT_TEST(pattern_str)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	gfx_glyph_pattern_t *pat;
-	const char *pstr;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NULL(gfx_glyph_first_pattern(glyph));
-
-	/* Set a pattern */
-	rc = gfx_glyph_set_pattern(glyph, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gfx_glyph_first_pattern(glyph));
-
-	pat = gfx_glyph_first_pattern(glyph);
-	PCUT_ASSERT_NOT_NULL(pat);
-
-	pstr = gfx_glyph_pattern_str(pat);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp("A", pstr));
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test gfx_glyph_transfer() */
-PCUT_TEST(transfer)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_glyph_bmp_t *bmp;
-	pixelmap_t pmap;
-	pixel_t pixel;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * We need to fill some pixels of the glyph.
-	 * We'll use the glyph bitmap for that.
-	 * That means this test won't pass unless glyph
-	 * bitmap works.
-	 */
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, 1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_save(bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	gfx_glyph_bmp_close(bmp);
-
-	/* Now create a new bitmap */
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 10;
-	params.rect.p1.y = 10;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Transfer the glyph to new bitmap */
-	rc = gfx_glyph_transfer(glyph, 0, bitmap, &params.rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now let's read pixels from the new bitmap */
-	pmap.width = params.rect.p1.x;
-	pmap.height = params.rect.p1.y;
-	pmap.data = alloc.pixels;
-
-	pixel = pixelmap_get_pixel(&pmap, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(PIXEL(255, 255, 255, 255), pixel);
-
-	pixel = pixelmap_get_pixel(&pmap, 1, 1);
-	PCUT_ASSERT_INT_EQUALS(PIXEL(255, 255, 255, 255), pixel);
-
-	pixel = pixelmap_get_pixel(&pmap, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(PIXEL(0, 0, 0, 0), pixel);
-
-	pixel = pixelmap_get_pixel(&pmap, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(PIXEL(0, 0, 0, 0), pixel);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(glyph);
Index: pace/lib/gfxfont/test/glyph_bmp.c
===================================================================
--- uspace/lib/gfxfont/test/glyph_bmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,556 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/glyph_bmp.h>
-#include <gfx/typeface.h>
-#include <pcut/pcut.h>
-#include "../private/glyph_bmp.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(glyph_bmp);
-
-/** Test opening and closing glyph bitmap */
-PCUT_TEST(open_close)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_save() */
-PCUT_TEST(save)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	int pix;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	/* Open bitmap and set some pixels */
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, 1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_save(bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_bmp_close(bmp);
-	bmp = NULL;
-
-	/* Re-open the saved bimap and verify pixel values were preserved */
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 1);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	/* ... */
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, -1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_save(bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_bmp_close(bmp);
-
-	/* Once again */
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 1);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 1, -1);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, -1);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_getpix() */
-PCUT_TEST(getpix)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	test_gc_t tgc;
-	int pix;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_setpix() can flip pixel value both ways */
-PCUT_TEST(setpix_flip)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	test_gc_t tgc;
-	int pix;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_setpix() properly extends pixel array */
-PCUT_TEST(setpix_extend)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	gfx_coord_t x, y;
-	test_gc_t tgc;
-	int pix;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	/*
-	 * Fill the rectangle [0, 0]..[3, 3] with alternating pixel pattern
-	 * and then check it.
-	 */
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, 1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 2, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 2, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 2, 2, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	for (y = 0; y <= 2; y++) {
-		for (x = 0; x <= 2; x++) {
-			pix = gfx_glyph_bmp_getpix(bmp, x, y);
-			PCUT_ASSERT_INT_EQUALS((x & 1) ^ (y & 1) ^ 1, pix);
-		}
-	}
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_clear() properly clears bitmap */
-PCUT_TEST(clear)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	gfx_rect_t rect;
-	test_gc_t tgc;
-	int pix;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	/* Set some pixels */
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, 1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Clear the bitmap and check */
-	gfx_glyph_bmp_clear(bmp);
-
-	gfx_glyph_bmp_get_rect(bmp, &rect);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.y);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 1);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test glyph_bmp_find_used_rect() find minimum used rectangle */
-PCUT_TEST(find_used_rect)
-{
-	gfx_font_props_t fprops;
-	gfx_font_metrics_t fmetrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph;
-	gfx_context_t *gc;
-	gfx_glyph_bmp_t *bmp;
-	gfx_rect_t rect;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *) &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&fprops);
-	gfx_font_metrics_init(&fmetrics);
-	rc = gfx_font_create(tface, &fprops, &fmetrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bmp = NULL;
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bmp);
-
-	/* Check used rectangle */
-
-	gfx_glyph_bmp_find_used_rect(bmp, &rect);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, rect.p1.y);
-
-	/* Set some pixels */
-
-	rc = gfx_glyph_bmp_setpix(bmp, -4, -5, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, -2, -1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 3, 4, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 7, 6, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check used rectangle */
-
-	gfx_glyph_bmp_find_used_rect(bmp, &rect);
-	PCUT_ASSERT_INT_EQUALS(-4, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(-5, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(8, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(7, rect.p1.y);
-
-	/* Clear the corner pixels */
-
-	rc = gfx_glyph_bmp_setpix(bmp, -4, -5, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 7, 6, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check used rectangle got smaller */
-
-	gfx_glyph_bmp_find_used_rect(bmp, &rect);
-	PCUT_ASSERT_INT_EQUALS(-2, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(-1, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(4, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(5, rect.p1.y);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_glyph_destroy(glyph);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(glyph_bmp);
Index: pace/lib/gfxfont/test/main.c
===================================================================
--- uspace/lib/gfxfont/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(font);
-PCUT_IMPORT(glyph);
-PCUT_IMPORT(glyph_bmp);
-PCUT_IMPORT(text);
-PCUT_IMPORT(tpf);
-PCUT_IMPORT(typeface);
-
-PCUT_MAIN();
Index: pace/lib/gfxfont/test/text.c
===================================================================
--- uspace/lib/gfxfont/test/text.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,425 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/text.h>
-#include <gfx/typeface.h>
-#include <pcut/pcut.h>
-#include "../private/font.h"
-#include "../private/typeface.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(text);
-
-/** Test text width computation with a dummy font */
-PCUT_TEST(dummy_text_width)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_coord_t width;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	width = gfx_text_width(font, "Hello world!");
-	PCUT_ASSERT_INT_EQUALS(0, width);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test text rendering with a dummy font */
-PCUT_TEST(dummy_puttext)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = color;
-	pos.x = 0;
-	pos.y = 0;
-
-	rc = gfx_puttext(&pos, &fmt, "Hello world!");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	gfx_color_delete(color);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** gfx_text_start_pos() correctly computes text start position */
-PCUT_TEST(text_start_pos)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	metrics.ascent = 10; // XXX
-	metrics.descent = 10; // XXX
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = color;
-	pos.x = 0;
-	pos.y = 0;
-
-	rc = gfx_puttext(&pos, &fmt, "Hello world!");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	gfx_color_delete(color);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** gfx_text_find_pos() finds position in text */
-PCUT_TEST(text_find_pos)
-{
-	gfx_font_props_t props;
-	gfx_font_metrics_t metrics;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_t *glyph1;
-	gfx_glyph_t *glyph2;
-	gfx_context_t *gc;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t anchor;
-	gfx_coord2_t fpos;
-	size_t off;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	gfx_font_metrics_init(&metrics);
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Need to create some glyphs with metrics */
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 10;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_set_pattern(glyph1, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = 1;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_set_pattern(glyph2, "i");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	anchor.x = 10;
-	anchor.y = 0;
-
-	fpos.x = 9;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(0, off);
-
-	fpos.x = 10;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(0, off);
-
-	fpos.x = 11;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(0, off);
-
-	fpos.x = 19;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(1, off);
-
-	fpos.x = 20;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(2, off);
-
-	fpos.x = 21;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(3, off);
-
-	fpos.x = 22;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Aii", &fpos);
-	PCUT_ASSERT_INT_EQUALS(3, off);
-
-	gfx_glyph_destroy(glyph1);
-	gfx_glyph_destroy(glyph2);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** gfx_text_find_pos() finds position in text in text mode */
-PCUT_TEST(text_find_pos_text)
-{
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	size_t off;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t anchor;
-	gfx_coord2_t fpos;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_font_create_textmode(tface, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	anchor.x = 10;
-	anchor.y = 0;
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-
-	fpos.x = 9;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(0, off);
-
-	fpos.x = 10;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(0, off);
-
-	fpos.x = 11;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(1, off);
-
-	fpos.x = 12;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(2, off);
-
-	fpos.x = 13;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(3, off);
-
-	fpos.x = 14;
-	fpos.y = 0;
-	off = gfx_text_find_pos(&anchor, &fmt, "Abc", &fpos);
-	PCUT_ASSERT_INT_EQUALS(3, off);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** gfx_text_cont() produces correct continuation parameters */
-PCUT_TEST(text_cont)
-{
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	test_gc_t tgc;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t anchor;
-	gfx_coord2_t cpos;
-	gfx_text_fmt_t cfmt;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_font_create_textmode(tface, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	anchor.x = 10;
-	anchor.y = 20;
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = color;
-
-	gfx_text_cont(&anchor, &fmt, "Abc", &cpos, &cfmt);
-
-	PCUT_ASSERT_INT_EQUALS(13, cpos.x);
-	PCUT_ASSERT_INT_EQUALS(20, cpos.y);
-	PCUT_ASSERT_EQUALS(fmt.color, cfmt.color);
-	PCUT_ASSERT_EQUALS(gfx_halign_left, cfmt.halign);
-	PCUT_ASSERT_EQUALS(gfx_valign_baseline, cfmt.valign);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	gfx_color_delete(color);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** gfx_text_rect() computes bounding rectangle */
-PCUT_TEST(text_rect)
-{
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	test_gc_t tgc;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t anchor;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_font_create_textmode(tface, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	anchor.x = 10;
-	anchor.y = 20;
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	fmt.color = color;
-
-	gfx_text_rect(&anchor, &fmt, "Abc", &rect);
-
-	PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(13, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(21, rect.p1.y);
-
-	gfx_font_close(font);
-	gfx_typeface_destroy(tface);
-	gfx_color_delete(color);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(text);
Index: pace/lib/gfxfont/test/tpf.c
===================================================================
--- uspace/lib/gfxfont/test/tpf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/glyph.h>
-#include <gfx/glyph_bmp.h>
-#include <gfx/typeface.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../private/font.h"
-#include "../private/typeface.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tpf);
-
-static const gfx_font_flags_t test_font_flags = gff_bold_italic;
-
-enum {
-	test_font_size = 9,
-	test_font_ascent = 4,
-	test_font_descent = 3,
-	test_font_leading = 2,
-	test_glyph_advance = 10
-};
-
-static const char *test_glyph_pattern = "ff";
-
-/** Test saving typeface to and loading from TPF file */
-PCUT_TEST(save_load)
-{
-	char fname[L_tmpnam];
-	char *p;
-	gfx_font_props_t props;
-	gfx_font_props_t rprops;
-	gfx_font_metrics_t metrics;
-	gfx_font_metrics_t rmetrics;
-	gfx_glyph_metrics_t gmetrics;
-	gfx_glyph_metrics_t rgmetrics;
-	gfx_glyph_pattern_t *pat;
-	const char *str;
-	gfx_typeface_t *tface;
-	gfx_font_t *font;
-	gfx_font_info_t *finfo;
-	gfx_context_t *gc;
-	gfx_glyph_t *glyph;
-	gfx_glyph_bmp_t *bmp;
-	int pix;
-	test_gc_t tgc;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_font_props_init(&props);
-	props.size = test_font_size;
-	props.flags = test_font_flags;
-
-	gfx_font_metrics_init(&metrics);
-	metrics.ascent = test_font_ascent;
-	metrics.descent = test_font_descent;
-	metrics.leading = test_font_leading;
-
-	rc = gfx_font_create(tface, &props, &metrics, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_metrics_init(&gmetrics);
-	gmetrics.advance = test_glyph_advance;
-
-	rc = gfx_glyph_create(font, &gmetrics, &glyph);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_set_pattern(glyph, test_glyph_pattern);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 0, 0, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_setpix(bmp, 1, 1, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_glyph_bmp_save(bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_glyph_bmp_close(bmp);
-
-	rc = gfx_typeface_save(tface, fname);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_typeface_destroy(tface);
-	tface = NULL;
-
-	rc = gfx_typeface_open(gc, fname, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tface);
-
-	finfo = gfx_typeface_first_font(tface);
-	PCUT_ASSERT_NOT_NULL(finfo);
-
-	gfx_font_get_props(finfo, &rprops);
-	PCUT_ASSERT_INT_EQUALS(props.size, rprops.size);
-	PCUT_ASSERT_INT_EQUALS(props.flags, rprops.flags);
-
-	rc = gfx_font_open(finfo, &font);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(font);
-
-	gfx_font_get_metrics(font, &rmetrics);
-	PCUT_ASSERT_INT_EQUALS(metrics.ascent, rmetrics.ascent);
-	PCUT_ASSERT_INT_EQUALS(metrics.descent, rmetrics.descent);
-	PCUT_ASSERT_INT_EQUALS(metrics.leading, rmetrics.leading);
-
-	glyph = gfx_font_first_glyph(font);
-	PCUT_ASSERT_NOT_NULL(glyph);
-
-	gfx_glyph_get_metrics(glyph, &rgmetrics);
-	PCUT_ASSERT_INT_EQUALS(gmetrics.advance, rgmetrics.advance);
-
-	pat = gfx_glyph_first_pattern(glyph);
-	str = gfx_glyph_pattern_str(pat);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(test_glyph_pattern, str));
-
-	rc = gfx_glyph_bmp_open(glyph, &bmp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 0);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 1);
-	PCUT_ASSERT_INT_EQUALS(1, pix);
-	pix = gfx_glyph_bmp_getpix(bmp, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-	pix = gfx_glyph_bmp_getpix(bmp, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(0, pix);
-
-	gfx_glyph_bmp_close(bmp);
-
-	gfx_typeface_destroy(tface);
-	tface = NULL;
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-PCUT_EXPORT(tpf);
Index: pace/lib/gfxfont/test/typeface.c
===================================================================
--- uspace/lib/gfxfont/test/typeface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/glyph.h>
-#include <gfx/typeface.h>
-#include <pcut/pcut.h>
-#include "../private/typeface.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(typeface);
-
-/** Test creating and destroying typeface */
-PCUT_TEST(create_destroy)
-{
-	gfx_typeface_t *tface;
-	gfx_context_t *gc;
-	test_gc_t tgc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_ops, (void *)&tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_typeface_create(gc, &tface);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_typeface_destroy(tface);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_TEST(first_font)
-{
-	// TODO
-}
-
-PCUT_TEST(next_font)
-{
-	// TODO
-}
-
-PCUT_EXPORT(typeface);
Index: pace/lib/gfximage/doc/doxygroups.h
===================================================================
--- uspace/lib/gfximage/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libgfximage libgfximage
- * @ingroup libs
- */
Index: pace/lib/gfximage/include/gfximage/tga.h
===================================================================
--- uspace/lib/gfximage/include/gfximage/tga.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfximage
- * @{
- */
-/**
- * @file
- */
-
-#ifndef GFXIMAGE_TGA_H_
-#define GFXIMAGE_TGA_H_
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <stddef.h>
-
-extern errno_t decode_tga(gfx_context_t *, void *, size_t,
-    gfx_bitmap_t **, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfximage/include/gfximage/tga_gz.h
===================================================================
--- uspace/lib/gfximage/include/gfximage/tga_gz.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfximage
- * @{
- */
-/**
- * @file
- */
-
-#ifndef GFXIMAGE_TGA_GZ_H_
-#define GFXIMAGE_TGA_GZ_H_
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <stddef.h>
-
-extern errno_t decode_tga_gz(gfx_context_t *, void *, size_t,
-    gfx_bitmap_t **, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/gfximage/meson.build
===================================================================
--- uspace/lib/gfximage/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'pixconv' , 'compress' ]
-src = files(
-	'src/tga.c',
-	'src/tga_gz.c',
-)
Index: pace/lib/gfximage/src/tga.c
===================================================================
--- uspace/lib/gfximage/src/tga.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,294 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfximage
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <byteorder.h>
-#include <align.h>
-#include <stdbool.h>
-#include <pixconv.h>
-#include <gfx/bitmap.h>
-#include <gfximage/tga.h>
-#include <io/pixelmap.h>
-
-typedef struct {
-	uint8_t id_length;
-	uint8_t cmap_type;
-	uint8_t img_type;
-
-	uint16_t cmap_first_entry;
-	uint16_t cmap_entries;
-	uint8_t cmap_bpp;
-
-	uint16_t startx;
-	uint16_t starty;
-	uint16_t width;
-	uint16_t height;
-	uint8_t img_bpp;
-	uint8_t img_descr;
-} __attribute__((packed)) tga_header_t;
-
-typedef enum {
-	CMAP_NOT_PRESENT = 0,
-	CMAP_PRESENT = 1,
-	CMAP_RESERVED_START = 2,
-	CMAP_PRIVATE_START = 128
-} cmap_type_t;
-
-typedef enum {
-	IMG_EMTPY = 0,
-	IMG_CMAP = 1,
-	IMG_BGRA = 2,
-	IMG_GRAY = 3,
-	IMG_CMAP_RLE = 9,
-	IMG_BGRA_RLE = 10,
-	IMG_GRAY_RLE = 11
-} img_type_t;
-
-typedef struct {
-	cmap_type_t cmap_type;
-	img_type_t img_type;
-
-	uint16_t cmap_first_entry;
-	uint16_t cmap_entries;
-	uint8_t cmap_bpp;
-
-	uint16_t startx;
-	uint16_t starty;
-	uint16_t width;
-	uint16_t height;
-	uint8_t img_bpp;
-	uint8_t img_alpha_bpp;
-	uint8_t img_alpha_dir;
-
-	void *id_data;
-	size_t id_length;
-
-	void *cmap_data;
-	size_t cmap_length;
-
-	void *img_data;
-	size_t img_length;
-} tga_t;
-
-/** Decode Truevision TGA header
- *
- * @param[in]  data Memory representation of TGA.
- * @param[in]  size Size of the representation (in bytes).
- * @param[out] tga  Decoded TGA.
- *
- * @return True on succesful decoding.
- * @return False on failure.
- *
- */
-static bool decode_tga_header(void *data, size_t size, tga_t *tga)
-{
-	/* Header sanity check */
-	if (size < sizeof(tga_header_t))
-		return false;
-
-	tga_header_t *head = (tga_header_t *) data;
-
-	/* Image ID field */
-	tga->id_data = data + sizeof(tga_header_t);
-	tga->id_length = head->id_length;
-
-	if (size < sizeof(tga_header_t) + tga->id_length)
-		return false;
-
-	/* Color map type */
-	tga->cmap_type = head->cmap_type;
-
-	/* Image type */
-	tga->img_type = head->img_type;
-
-	/* Color map specification */
-	tga->cmap_first_entry = uint16_t_le2host(head->cmap_first_entry);
-	tga->cmap_entries = uint16_t_le2host(head->cmap_entries);
-	tga->cmap_bpp = head->cmap_bpp;
-	tga->cmap_data = tga->id_data + tga->id_length;
-	tga->cmap_length = ALIGN_UP(tga->cmap_entries * tga->cmap_bpp, 8) >> 3;
-
-	if (size < sizeof(tga_header_t) + tga->id_length +
-	    tga->cmap_length)
-		return false;
-
-	/* Image specification */
-	tga->startx = uint16_t_le2host(head->startx);
-	tga->starty = uint16_t_le2host(head->starty);
-	tga->width = uint16_t_le2host(head->width);
-	tga->height = uint16_t_le2host(head->height);
-	tga->img_bpp = head->img_bpp;
-	tga->img_alpha_bpp = head->img_descr & 0x0f;
-	tga->img_alpha_dir = (head->img_descr & 0xf0) >> 4;
-	tga->img_data = tga->cmap_data + tga->cmap_length;
-
-	uint64_t length = (uint64_t) tga->width * tga->height * tga->img_bpp;
-	if (length & 0x7)
-		length += 8;
-	length >>= 3;
-
-	if (length > SIZE_MAX - sizeof(tga_header_t) - tga->id_length -
-	    tga->cmap_length)
-		return false;
-
-	tga->img_length = length;
-
-	if (size < sizeof(tga_header_t) + tga->id_length +
-	    tga->cmap_length + tga->img_length)
-		return false;
-
-	return true;
-}
-
-/** Decode Truevision TGA format
- *
- * Decode Truevision TGA format and create a surface
- * from it. The supported variants of TGA are currently
- * limited to uncompressed 24 bit true-color images without
- * alpha channel.
- *
- * @param gc      Graphic context
- * @param data    Memory representation of gzipped TGA.
- * @param size    Size of the representation (in bytes).
- * @param rbitmap Place to store pointer to new bitmap
- * @param rrect   Place to store bitmap rectangle
- *
- * @return EOK un success or an error code
- */
-errno_t decode_tga(gfx_context_t *gc, void *data, size_t size,
-    gfx_bitmap_t **rbitmap, gfx_rect_t *rrect)
-{
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bitmap = NULL;
-	pixelmap_t pixelmap;
-	errno_t rc;
-
-	tga_t tga;
-	if (!decode_tga_header(data, size, &tga))
-		return EINVAL;
-
-	/*
-	 * Check for unsupported features.
-	 */
-
-	switch (tga.cmap_type) {
-	case CMAP_NOT_PRESENT:
-		break;
-	default:
-		/* Unsupported */
-		return ENOTSUP;
-	}
-
-	switch (tga.img_type) {
-	case IMG_BGRA:
-		if (tga.img_bpp != 24)
-			return ENOTSUP;
-		break;
-	case IMG_GRAY:
-		if (tga.img_bpp != 8)
-			return ENOTSUP;
-		break;
-	default:
-		/* Unsupported */
-		return ENOTSUP;
-	}
-
-	if (tga.img_alpha_bpp != 0)
-		return ENOTSUP;
-
-	sysarg_t twidth = tga.startx + tga.width;
-	sysarg_t theight = tga.starty + tga.height;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p1.x = twidth;
-	params.rect.p1.y = theight;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(bitmap);
-		return rc;
-	}
-
-	pixelmap.width = twidth;
-	pixelmap.height = theight;
-	pixelmap.data = alloc.pixels;
-
-	/*
-	 * TGA is encoded in a bottom-up manner, the true-color
-	 * variant is in BGR 8:8:8 encoding.
-	 */
-
-	switch (tga.img_type) {
-	case IMG_BGRA:
-		for (sysarg_t y = tga.starty; y < theight; y++) {
-			for (sysarg_t x = tga.startx; x < twidth; x++) {
-				size_t offset =
-				    ((y - tga.starty) * tga.width + (x - tga.startx)) * 3;
-
-				pixel_t pixel =
-				    bgr_888_2pixel(((uint8_t *) tga.img_data) + offset);
-				pixelmap_put_pixel(&pixelmap, x, theight - y - 1, pixel);
-			}
-		}
-		break;
-	case IMG_GRAY:
-		for (sysarg_t y = tga.starty; y < theight; y++) {
-			for (sysarg_t x = tga.startx; x < twidth; x++) {
-				size_t offset =
-				    (y - tga.starty) * tga.width + (x - tga.startx);
-
-				pixel_t pixel =
-				    gray_8_2pixel(((uint8_t *) tga.img_data) + offset);
-				pixelmap_put_pixel(&pixelmap, x, theight - y - 1, pixel);
-			}
-		}
-		break;
-	default:
-		break;
-	}
-
-	*rbitmap = bitmap;
-	*rrect = params.rect;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/gfximage/src/tga_gz.c
===================================================================
--- uspace/lib/gfximage/src/tga_gz.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libgfximage
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <gzip.h>
-#include <stdlib.h>
-#include <gfximage/tga.h>
-#include <gfximage/tga_gz.h>
-
-/** Decode gzipped Truevision TGA format
- *
- * Decode gzipped Truevision TGA format and create a bitmap
- * from it. The supported variants of TGA are limited those
- * supported by decode_tga().
- *
- * @param gc      Graphic context
- * @param data    Memory representation of gzipped TGA.
- * @param size    Size of the representation (in bytes).
- * @param rbitmap Place to store pointer to new bitmap
- * @param rrect   Place to store bitmap rectangle
- *
- * @return EOK un success or an error code
- */
-errno_t decode_tga_gz(gfx_context_t *gc, void *data, size_t size,
-    gfx_bitmap_t **rbitmap, gfx_rect_t *rrect)
-{
-	void *data_expanded;
-	size_t size_expanded;
-	errno_t rc;
-
-	rc = gzip_expand(data, size, &data_expanded, &size_expanded);
-	if (rc != EOK)
-		return rc;
-
-	rc = decode_tga(gc, data_expanded, size_expanded, rbitmap, rrect);
-	free(data_expanded);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/hound/doc/doxygroups.h
===================================================================
--- uspace/lib/hound/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libhound libhound
- * @ingroup libs
- */
Index: pace/lib/hound/include/hound/client.h
===================================================================
--- uspace/lib/hound/include/hound/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libhound
- * @addtogroup audio
- * @{
- */
-/** @file
- * @brief Audio PCM buffer interface.
- */
-
-#ifndef LIBHOUND_CLIENT_H_
-#define LIBHOUND_CLIENT_H_
-
-#include <async.h>
-#include <pcm/format.h>
-#include <hound/protocol.h>
-
-#define HOUND_DEFAULT_TARGET "default"
-#define HOUND_ALL_TARGETS "all"
-
-typedef struct hound_context hound_context_t;
-typedef struct hound_stream hound_stream_t;
-
-hound_context_t *hound_context_create_playback(const char *name,
-    pcm_format_t format, size_t bsize);
-hound_context_t *hound_context_create_capture(const char *name,
-    pcm_format_t format, size_t bsize);
-void hound_context_destroy(hound_context_t *hound);
-
-errno_t hound_context_set_main_stream_params(hound_context_t *hound,
-    pcm_format_t format, size_t bsize);
-
-errno_t hound_context_get_available_targets(hound_context_t *hound,
-    char ***names, size_t *count);
-errno_t hound_context_get_connected_targets(hound_context_t *hound,
-    char ***names, size_t *count);
-
-errno_t hound_context_connect_target(hound_context_t *hound, const char *target);
-errno_t hound_context_disconnect_target(hound_context_t *hound, const char *target);
-
-hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
-    pcm_format_t format, size_t bsize);
-void hound_stream_destroy(hound_stream_t *stream);
-
-errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
-errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size);
-errno_t hound_stream_drain(hound_stream_t *stream);
-
-errno_t hound_write_main_stream(hound_context_t *hound,
-    const void *data, size_t size);
-errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
-errno_t hound_write_replace_main_stream(hound_context_t *hound,
-    const void *data, size_t size);
-errno_t hound_write_immediate(hound_context_t *hound,
-    pcm_format_t format, const void *data, size_t size);
-
-#endif
Index: pace/lib/hound/include/hound/protocol.h
===================================================================
--- uspace/lib/hound/include/hound/protocol.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libhound
- * @addtogroup audio
- * @{
- */
-/** @file
- * @brief Audio PCM buffer interface.
- */
-
-#ifndef LIBHOUND_PROTOCOL_H_
-#define LIBHOUND_PROTOCOL_H_
-
-#include <async.h>
-#include <errno.h>
-#include <pcm/format.h>
-
-extern const char *HOUND_SERVICE;
-
-typedef enum {
-	HOUND_SINK_APPS = 0x1,
-	HOUND_SINK_DEVS = 0x2,
-	HOUND_SOURCE_APPS = 0x4,
-	HOUND_SOURCE_DEVS = 0x8,
-	HOUND_CONNECTED = 0x10,
-
-	HOUND_STREAM_DRAIN_ON_EXIT = 0x1,
-	HOUND_STREAM_IGNORE_UNDERFLOW = 0x2,
-	HOUND_STREAM_IGNORE_OVERFLOW = 0x4,
-} hound_flags_t;
-
-typedef async_sess_t hound_sess_t;
-
-typedef struct {
-} *hound_context_id_t;
-
-hound_sess_t *hound_service_connect(const char *service);
-void hound_service_disconnect(hound_sess_t *sess);
-
-errno_t hound_service_register_context(hound_sess_t *sess,
-    const char *name, bool record, hound_context_id_t *id);
-errno_t hound_service_unregister_context(hound_sess_t *sess, hound_context_id_t id);
-
-errno_t hound_service_get_list(hound_sess_t *sess, char ***ids, size_t *count,
-    int flags, const char *connection);
-
-/**
- * Wrapper for list queries with no connection parameter.
- * @param[in] sess hound daemon session.
- * @param[out] ids list of string identifiers
- * @param[out] count Number of elements in @p ids
- * @param[in] flags Flags limiting the query.
- * @return Error code.
- */
-static inline errno_t hound_service_get_list_all(hound_sess_t *sess,
-    char ***ids, size_t *count, int flags)
-{
-	return hound_service_get_list(sess, ids, count, flags, NULL);
-}
-
-errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
-    const char *sink);
-errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
-    const char *sink);
-
-errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
-    int flags, pcm_format_t format, size_t bsize);
-errno_t hound_service_stream_drain(async_exch_t *exch);
-errno_t hound_service_stream_exit(async_exch_t *exch);
-
-errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size);
-errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size);
-
-/* Server */
-
-/** Hound server interace structure */
-typedef struct hound_server_iface {
-	/** Create new context */
-	errno_t (*add_context)(void *, hound_context_id_t *, const char *, bool);
-	/** Destroy existing context */
-	errno_t (*rem_context)(void *, hound_context_id_t);
-	/** Query context direction */
-	bool (*is_record_context)(void *, hound_context_id_t);
-	/** Get string identifiers of specified objects */
-	errno_t (*get_list)(void *, char ***, size_t *, const char *, int);
-	/** Create connection between source and sink */
-	errno_t (*connect)(void *, const char *, const char *);
-	/** Destroy connection between source and sink */
-	errno_t (*disconnect)(void *, const char *, const char *);
-	/** Create new stream tied to the context */
-	errno_t (*add_stream)(void *, hound_context_id_t, int, pcm_format_t, size_t,
-	    void **);
-	/** Destroy existing stream */
-	errno_t (*rem_stream)(void *, void *);
-	/** Block until the stream buffer is empty */
-	errno_t (*drain_stream)(void *);
-	/** Write new data to the stream */
-	errno_t (*stream_data_write)(void *, void *, size_t);
-	/** Read data from the stream */
-	errno_t (*stream_data_read)(void *, void *, size_t);
-	void *server;
-} hound_server_iface_t;
-
-extern void hound_service_set_server_iface(const hound_server_iface_t *);
-extern void hound_connection_handler(ipc_call_t *, void *);
-
-#endif
-/** @}
- */
Index: pace/lib/hound/include/hound/server.h
===================================================================
--- uspace/lib/hound/include/hound/server.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libhound
- * @addtogroup audio
- * @{
- */
-/** @file
- * @brief Audio PCM buffer interface.
- */
-
-#ifndef LIBHOUND_SERVER_H_
-#define LIBHOUND_SERVER_H_
-
-#include <async.h>
-#include <loc.h>
-
-typedef void (*dev_change_callback_t)(void *);
-typedef errno_t (*device_callback_t)(service_id_t, const char *);
-
-errno_t hound_server_register(const char *name, service_id_t *id);
-void hound_server_unregister(service_id_t id);
-errno_t hound_server_set_device_change_callback(dev_change_callback_t cb,
-    void *);
-errno_t hound_server_devices_iterate(device_callback_t callback);
-
-#endif
Index: pace/lib/hound/meson.build
===================================================================
--- uspace/lib/hound/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'pcm' ]
-private_includes += include_directories('include/hound')
-src = files(
-	'src/protocol.c',
-	'src/client.c',
-)
Index: pace/lib/hound/src/client.c
===================================================================
--- uspace/lib/hound/src/client.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,500 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libhound
- * @addtogroup audio
- * @{
- */
-/** @file
- * Common USB functions.
- */
-#include <adt/list.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <loc.h>
-#include <str.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <types/common.h>
-#include <task.h>
-
-#include "protocol.h"
-#include "client.h"
-
-/** Stream structure */
-struct hound_stream {
-	/** link in context's list */
-	link_t link;
-	/** audio data format fo the stream */
-	pcm_format_t format;
-	/** IPC exchange representing the stream (in STREAM MODE) */
-	async_exch_t *exch;
-	/** parent context */
-	hound_context_t *context;
-	/** Stream flags */
-	int flags;
-};
-
-/**
- * Linked list isntacen helper function.
- * @param l link
- * @return hound stream isntance.
- */
-static inline hound_stream_t *hound_stream_from_link(link_t *l)
-{
-	return l ? list_get_instance(l, hound_stream_t, link) : NULL;
-}
-
-/** Hound client context structure */
-struct hound_context {
-	/** Audio session */
-	hound_sess_t *session;
-	/** context name, reported to the daemon */
-	char *name;
-	/** True if the instance is record context */
-	bool record;
-	/** List of associated streams */
-	list_t stream_list;
-	/** Main stream helper structure */
-	struct {
-		hound_stream_t *stream;
-		pcm_format_t format;
-		size_t bsize;
-	} main;
-	/** Assigned context id */
-	hound_context_id_t id;
-};
-
-/**
- * Alloc and initialize context structure.
- * @param name Base for the real context name, will add task id.
- * @param record True if the new context should capture audio data.
- * @param format PCM format of the main pipe.
- * @param bsize Server size buffer size of the main stream.
- * @return valid pointer to initialized structure on success, NULL on failure
- */
-static hound_context_t *hound_context_create(const char *name, bool record,
-    pcm_format_t format, size_t bsize)
-{
-	hound_context_t *new_context = malloc(sizeof(hound_context_t));
-	if (new_context) {
-		char *cont_name;
-		int ret = asprintf(&cont_name, "%" PRIu64 ":%s",
-		    task_get_id(), name);
-		if (ret < 0) {
-			free(new_context);
-			return NULL;
-		}
-		list_initialize(&new_context->stream_list);
-		new_context->name = cont_name;
-		new_context->record = record;
-		new_context->session = hound_service_connect(HOUND_SERVICE);
-		new_context->main.stream = NULL;
-		new_context->main.format = format;
-		new_context->main.bsize = bsize;
-		if (!new_context->session) {
-			free(new_context->name);
-			free(new_context);
-			return NULL;
-		}
-		errno_t rc = hound_service_register_context(
-		    new_context->session, new_context->name, record,
-		    &new_context->id);
-		if (rc != EOK) {
-			hound_service_disconnect(new_context->session);
-			free(new_context->name);
-			free(new_context);
-			return NULL;
-		}
-	}
-	return new_context;
-}
-
-/**
- * Playback context helper function.
- * @param name Base for the real context name, will add task id.
- * @param format PCM format of the main pipe.
- * @param bsize Server size buffer size of the main stream.
- * @return valid pointer to initialized structure on success, NULL on failure
- */
-hound_context_t *hound_context_create_playback(const char *name,
-    pcm_format_t format, size_t bsize)
-{
-	return hound_context_create(name, false, format, bsize);
-}
-
-/**
- * Record context helper function.
- * @param name Base for the real context name, will add task id.
- * @param format PCM format of the main pipe.
- * @param bsize Server size buffer size of the main stream.
- * @return valid pointer to initialized structure on success, NULL on failure
- */
-hound_context_t *hound_context_create_capture(const char *name,
-    pcm_format_t format, size_t bsize)
-{
-	return hound_context_create(name, true, format, bsize);
-}
-
-/**
- * Correctly dispose of the hound context structure.
- * @param hound context to remove.
- *
- * The function will destroy all associated streams first. Pointers
- * to these structures will become invalid and the function will block
- * if any of these stream needs to be drained first.
- */
-void hound_context_destroy(hound_context_t *hound)
-{
-	assert(hound);
-
-	while (!list_empty(&hound->stream_list)) {
-		link_t *first = list_first(&hound->stream_list);
-		hound_stream_t *stream = hound_stream_from_link(first);
-		hound_stream_destroy(stream);
-	}
-
-	hound_service_unregister_context(hound->session, hound->id);
-	hound_service_disconnect(hound->session);
-	free(hound->name);
-	free(hound);
-}
-
-/**
- * Get a list of possible connection targets.
- * @param[in] hound Hound context.
- * @param[out] names list of target string ids.
- * @param[out] count Number of elements in @p names list
- * @return Error code.
- *
- * The function will return deice sinks or source based on the context type.
- */
-errno_t hound_context_get_available_targets(hound_context_t *hound,
-    char ***names, size_t *count)
-{
-	assert(hound);
-	assert(names);
-	assert(count);
-	return hound_service_get_list_all(hound->session, names, count,
-	    hound->record ? HOUND_SOURCE_DEVS : HOUND_SINK_DEVS);
-}
-
-/**
- * Get a list of targets connected to the context.
- * @param[in] hound Hound context.
- * @param[out] names list of target string ids.
- * @param[out] count Number of elements in @p names list
- * @return Error code.
- */
-errno_t hound_context_get_connected_targets(hound_context_t *hound,
-    char ***names, size_t *count)
-{
-	assert(hound);
-	assert(names);
-	assert(count);
-	return hound_service_get_list(hound->session, names, count,
-	    HOUND_CONNECTED | (hound->record ?
-	    HOUND_SOURCE_DEVS : HOUND_SINK_DEVS), hound->name);
-}
-
-/**
- * Create a new connection to the target.
- * @param hound Hound context.
- * @param target String identifier of the desired target.
- * @return Error code.
- *
- * The function recognizes special 'HOUND_DEFAULT_TARGET' and will
- * connect to the first possible target if it is passed this value.
- */
-errno_t hound_context_connect_target(hound_context_t *hound, const char *target)
-{
-	assert(hound);
-	assert(target);
-
-	char **tgt = NULL;
-	size_t count = 1;
-	errno_t ret = EOK;
-	if (str_cmp(target, HOUND_DEFAULT_TARGET) == 0) {
-		ret = hound_context_get_available_targets(hound, &tgt, &count);
-		if (ret != EOK)
-			return ret;
-		if (count == 0)
-			return ENOENT;
-		target = tgt[0];
-	}
-	//TODO handle all-targets
-
-	if (hound->record) {
-		ret = hound_service_connect_source_sink(
-		    hound->session, target, hound->name);
-	} else {
-		ret = hound_service_connect_source_sink(
-		    hound->session, hound->name, target);
-	}
-	if (tgt)
-		free(tgt[0]);
-	free(tgt);
-	return ret;
-}
-
-/**
- * Destroy a connection to the target.
- * @param hound Hound context.
- * @param target String identifier of the desired target.
- * @return Error code.
- */
-errno_t hound_context_disconnect_target(hound_context_t *hound, const char *target)
-{
-	assert(hound);
-	assert(target);
-	//TODO handle all-targets
-	if (hound->record) {
-		return hound_service_disconnect_source_sink(
-		    hound->session, target, hound->name);
-	} else {
-		return hound_service_disconnect_source_sink(
-		    hound->session, hound->name, target);
-	}
-}
-
-/**
- * Create a new stream associated with the context.
- * @param hound Hound context.
- * @param flags new stream flags.
- * @param format new stream PCM format.
- * @param bzise new stream server side buffer size (in bytes)
- * @return Valid pointer to a stream instance, NULL on failure.
- */
-hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
-    pcm_format_t format, size_t bsize)
-{
-	assert(hound);
-	async_exch_t *stream_exch = async_exchange_begin(hound->session);
-	if (!stream_exch)
-		return NULL;
-	hound_stream_t *new_stream = malloc(sizeof(hound_stream_t));
-	if (new_stream) {
-		link_initialize(&new_stream->link);
-		new_stream->exch = stream_exch;
-		new_stream->format = format;
-		new_stream->context = hound;
-		new_stream->flags = flags;
-		const errno_t ret = hound_service_stream_enter(new_stream->exch,
-		    hound->id, flags, format, bsize);
-		if (ret != EOK) {
-			async_exchange_end(new_stream->exch);
-			free(new_stream);
-			return NULL;
-		}
-		list_append(&new_stream->link, &hound->stream_list);
-	}
-	return new_stream;
-}
-
-/**
- * Destroy existing stream
- * @param stream The stream to destroy.
- *
- * Function will wait until the server side buffer is empty if the
- * HOUND_STREAM_DRAIN_ON_EXIT flag was set on creation.
- */
-void hound_stream_destroy(hound_stream_t *stream)
-{
-	if (stream) {
-		if (stream->flags & HOUND_STREAM_DRAIN_ON_EXIT)
-			hound_service_stream_drain(stream->exch);
-		hound_service_stream_exit(stream->exch);
-		async_exchange_end(stream->exch);
-		list_remove(&stream->link);
-		free(stream);
-	}
-}
-
-/**
- * Send new data to a stream.
- * @param stream The target stream
- * @param data data buffer
- * @param size size of the @p data buffer.
- * @return error code.
- */
-errno_t hound_stream_write(hound_stream_t *stream, const void *data, size_t size)
-{
-	assert(stream);
-	if (!data || size == 0)
-		return EBADMEM;
-	return hound_service_stream_write(stream->exch, data, size);
-}
-
-/**
- * Get data from a stream.
- * @param stream The target stream.
- * @param data data buffer.
- * @param size size of the @p data buffer.
- * @return error code.
- */
-errno_t hound_stream_read(hound_stream_t *stream, void *data, size_t size)
-{
-	assert(stream);
-	if (!data || size == 0)
-		return EBADMEM;
-	return hound_service_stream_read(stream->exch, data, size);
-}
-
-/**
- * Wait until the server side buffer is empty.
- * @param stream The stream that shoulod be drained.
- * @return Error code.
- */
-errno_t hound_stream_drain(hound_stream_t *stream)
-{
-	assert(stream);
-	return hound_service_stream_drain(stream->exch);
-}
-
-/**
- * Main stream getter function.
- * @param hound Houndcontext.
- * @return Valid stream pointer, NULL on failure.
- *
- * The function will create new stream, or return a pointer to the exiting one
- * if it exists.
- */
-static hound_stream_t *hound_get_main_stream(hound_context_t *hound)
-{
-	assert(hound);
-	if (!hound->main.stream)
-		hound->main.stream = hound_stream_create(hound,
-		    HOUND_STREAM_DRAIN_ON_EXIT, hound->main.format,
-		    hound->main.bsize);
-	return hound->main.stream;
-}
-
-/**
- * Send new data to the main stream.
- * @param stream The target stream
- * @param data data buffer
- * @param size size of the @p data buffer.
- * @return error code.
- */
-errno_t hound_write_main_stream(hound_context_t *hound,
-    const void *data, size_t size)
-{
-	assert(hound);
-	if (hound->record)
-		return EINVAL;
-
-	hound_stream_t *mstream = hound_get_main_stream(hound);
-	if (!mstream)
-		return ENOMEM;
-	return hound_stream_write(mstream, data, size);
-}
-
-/**
- * Get data from the main stream.
- * @param stream The target stream
- * @param data data buffer
- * @param size size of the @p data buffer.
- * @return error code.
- */
-errno_t hound_read_main_stream(hound_context_t *hound, void *data, size_t size)
-{
-	assert(hound);
-	if (!hound->record)
-		return EINVAL;
-	hound_stream_t *mstream = hound_get_main_stream(hound);
-	if (!mstream)
-		return ENOMEM;
-	return hound_stream_read(mstream, data, size);
-}
-
-/**
- * Destroy the old main stream and replace it with a new one with fresh data.
- * @param hound Hound context.
- * @param data data buffer.
- * @param size size of the @p data buffer.
- * @return error code.
- *
- * NOT IMPLEMENTED
- */
-errno_t hound_write_replace_main_stream(hound_context_t *hound,
-    const void *data, size_t size)
-{
-	assert(hound);
-	if (!data || size == 0)
-		return EBADMEM;
-	// TODO implement
-	return ENOTSUP;
-}
-
-/**
- * Destroy the old main stream and replace it with a new one using new params.
- * @param hound Hound context.
- * @param channels
- * @return error code.
- *
- * NOT IMPLEMENTED
- */
-errno_t hound_context_set_main_stream_params(hound_context_t *hound,
-    pcm_format_t format, size_t bsize)
-{
-	assert(hound);
-	// TODO implement
-	return ENOTSUP;
-}
-
-/**
- * Write data immediately to a new stream, and wait for it to drain.
- * @param hound Hound context.
- * @param format pcm data format.
- * @param data data buffer
- * @param size @p data buffer size
- * @return Error code.
- *
- * This functnion creates a new stream writes the data, ti waits for the stream
- * to drain and destroys it before returning.
- */
-errno_t hound_write_immediate(hound_context_t *hound, pcm_format_t format,
-    const void *data, size_t size)
-{
-	assert(hound);
-	if (hound->record)
-		return EINVAL;
-	hound_stream_t *tmpstream = hound_stream_create(hound, 0, format, size);
-	if (!tmpstream)
-		return ENOMEM;
-	const errno_t ret = hound_stream_write(tmpstream, data, size);
-	if (ret == EOK) {
-		//TODO drain?
-		hound_service_stream_drain(tmpstream->exch);
-	}
-	hound_stream_destroy(tmpstream);
-	return ret;
-}
-/**
- * @}
- */
Index: pace/lib/hound/src/protocol.c
===================================================================
--- uspace/lib/hound/src/protocol.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,815 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libhound
- * @addtogroup audio
- * @{
- */
-/** @file
- * Common USB functions.
- */
-#include <adt/list.h>
-#include <errno.h>
-#include <loc.h>
-#include <macros.h>
-#include <str.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <types/common.h>
-
-#include "protocol.h"
-#include "client.h"
-#include "server.h"
-
-enum ipc_methods {
-	/** Create new context representation on the server side */
-	IPC_M_HOUND_CONTEXT_REGISTER = IPC_FIRST_USER_METHOD,
-	/** Release existing context representation on the server side */
-	IPC_M_HOUND_CONTEXT_UNREGISTER,
-	/** Request list of objects */
-	IPC_M_HOUND_GET_LIST,
-	/** Create new connection */
-	IPC_M_HOUND_CONNECT,
-	/** Destroy connection */
-	IPC_M_HOUND_DISCONNECT,
-	/** Switch IPC pipe to stream mode */
-	IPC_M_HOUND_STREAM_ENTER,
-	/** Switch IPC pipe back to general mode */
-	IPC_M_HOUND_STREAM_EXIT,
-	/** Wait until there is no data in the stream */
-	IPC_M_HOUND_STREAM_DRAIN,
-};
-
-/** PCM format conversion helper structure */
-typedef union {
-	struct {
-		uint16_t rate;
-		uint8_t channels;
-		uint8_t format;
-	} __attribute__((packed)) f;
-	sysarg_t arg;
-} format_convert_t;
-
-/*
- * CLIENT
- */
-
-/** Well defined service name */
-const char *HOUND_SERVICE = "audio/hound";
-
-/** Server object */
-static loc_srv_t *hound_srv;
-
-/**
- * Start a new audio session.
- * @param service Named service typically 'HOUND_SERVICE' constant.
- * @return Valid session on success, NULL on failure.
- */
-hound_sess_t *hound_service_connect(const char *service)
-{
-	service_id_t id = 0;
-	const errno_t ret =
-	    loc_service_get_id(service, &id, IPC_FLAG_BLOCKING);
-	if (ret != EOK)
-		return NULL;
-	return loc_service_connect(id, INTERFACE_HOUND, IPC_FLAG_BLOCKING);
-}
-
-/**
- * End an existing audio session.
- * @param sess The session.
- */
-void hound_service_disconnect(hound_sess_t *sess)
-{
-	if (sess)
-		async_hangup(sess);
-}
-
-/**
- * Register a named application context to the audio server.
- * @param sess Valid audio session.
- * @param name Valid string identifier
- * @param record True if the application context wishes to receive data.
- *
- * @param[out] id  Return context ID.
- *
- * @return EOK on success, Error code on failure.
- */
-errno_t hound_service_register_context(hound_sess_t *sess,
-    const char *name, bool record, hound_context_id_t *id)
-{
-	assert(sess);
-	assert(name);
-	ipc_call_t call;
-	async_exch_t *exch = async_exchange_begin(sess);
-	aid_t mid =
-	    async_send_1(exch, IPC_M_HOUND_CONTEXT_REGISTER, record, &call);
-	errno_t ret = mid ? EOK : EPARTY;
-
-	if (ret == EOK)
-		ret = async_data_write_start(exch, name, str_size(name));
-	else
-		async_forget(mid);
-
-	if (ret == EOK)
-		async_wait_for(mid, &ret);
-
-	async_exchange_end(exch);
-	if (ret == EOK) {
-		*id = (hound_context_id_t) ipc_get_arg1(&call);
-	}
-
-	return ret;
-}
-
-/**
- * Remove application context from the server's list.
- * @param sess Valid audio session.
- * @param id Valid context id.
- * @return Error code.
- */
-errno_t hound_service_unregister_context(hound_sess_t *sess,
-    hound_context_id_t id)
-{
-	assert(sess);
-	async_exch_t *exch = async_exchange_begin(sess);
-	const errno_t ret = async_req_1_0(exch, IPC_M_HOUND_CONTEXT_UNREGISTER,
-	    cap_handle_raw(id));
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Retrieve a list of server side actors.
- * @param[in] sess Valid audio session.
- * @param[out] ids list of string identifiers.
- * @param[out] count Number of elements int the @p ids list.
- * @param[in] flags list requirements.
- * @param[in] connection name of target actor. Used only if the list should
- *            contain connected actors.
- * @retval Error code.
- */
-errno_t hound_service_get_list(hound_sess_t *sess, char ***ids, size_t *count,
-    int flags, const char *connection)
-{
-	assert(sess);
-	assert(ids);
-	assert(count);
-
-	if (connection && !(flags & HOUND_CONNECTED))
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return ENOMEM;
-
-	ipc_call_t res_call;
-	aid_t mid = async_send_3(exch, IPC_M_HOUND_GET_LIST, flags, *count,
-	    connection != NULL, &res_call);
-
-	errno_t ret = EOK;
-	if (mid && connection)
-		ret = async_data_write_start(exch, connection,
-		    str_size(connection));
-
-	if (ret == EOK)
-		async_wait_for(mid, &ret);
-
-	if (ret != EOK) {
-		async_exchange_end(exch);
-		return ret;
-	}
-	unsigned name_count = ipc_get_arg1(&res_call);
-
-	/* Start receiving names */
-	char **names = NULL;
-	if (name_count) {
-		size_t *sizes = calloc(name_count, sizeof(size_t));
-		names = calloc(name_count, sizeof(char *));
-		if (!names || !sizes)
-			ret = ENOMEM;
-
-		if (ret == EOK)
-			ret = async_data_read_start(exch, sizes,
-			    name_count * sizeof(size_t));
-		for (unsigned i = 0; i < name_count && ret == EOK; ++i) {
-			char *name = malloc(sizes[i] + 1);
-			if (name) {
-				memset(name, 0, sizes[i] + 1);
-				ret = async_data_read_start(exch, name, sizes[i]);
-				names[i] = name;
-			} else {
-				ret = ENOMEM;
-			}
-		}
-		free(sizes);
-	}
-	async_exchange_end(exch);
-	if (ret != EOK) {
-		for (unsigned i = 0; i < name_count; ++i)
-			free(names[i]);
-		free(names);
-	} else {
-		*ids = names;
-		*count = name_count;
-	}
-	return ret;
-}
-
-/**
- * Create a new connection between a source and a sink.
- * @param sess Valid audio session.
- * @param source Source name, valid string.
- * @param sink Sink name, valid string.
- * @return Error code.
- */
-errno_t hound_service_connect_source_sink(hound_sess_t *sess, const char *source,
-    const char *sink)
-{
-	assert(sess);
-	assert(source);
-	assert(sink);
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return ENOMEM;
-	ipc_call_t call;
-	aid_t id = async_send_0(exch, IPC_M_HOUND_CONNECT, &call);
-	errno_t ret = id ? EOK : EPARTY;
-	if (ret == EOK)
-		ret = async_data_write_start(exch, source, str_size(source));
-	if (ret == EOK)
-		ret = async_data_write_start(exch, sink, str_size(sink));
-	async_wait_for(id, &ret);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * Destroy an existing connection between a source and a sink.
- * @param sess Valid audio session.
- * @param source Source name, valid string.
- * @param sink Sink name, valid string.
- * @return Error code.
- */
-errno_t hound_service_disconnect_source_sink(hound_sess_t *sess, const char *source,
-    const char *sink)
-{
-	assert(sess);
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return ENOMEM;
-	ipc_call_t call;
-	aid_t id = async_send_0(exch, IPC_M_HOUND_DISCONNECT, &call);
-	errno_t ret = id ? EOK : EPARTY;
-	if (ret == EOK)
-		ret = async_data_write_start(exch, source, str_size(source));
-	if (ret == EOK)
-		ret = async_data_write_start(exch, sink, str_size(sink));
-	async_wait_for(id, &ret);
-	async_exchange_end(exch);
-	return ENOTSUP;
-}
-
-/**
- * Switch IPC exchange to a STREAM mode.
- * @param exch IPC exchange.
- * @param id context id this stream should be associated with
- * @param flags set stream properties
- * @param format format of the new stream.
- * @param bsize size of the server side buffer.
- * @return Error code.
- */
-errno_t hound_service_stream_enter(async_exch_t *exch, hound_context_id_t id,
-    int flags, pcm_format_t format, size_t bsize)
-{
-	const format_convert_t c = {
-		.f = {
-			.channels = format.channels,
-			.rate = format.sampling_rate / 100,
-			.format = format.sample_format,
-		}
-	};
-
-	return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, cap_handle_raw(id),
-	    flags, c.arg, bsize);
-}
-
-/**
- * Destroy existing stream and return IPC exchange to general mode.
- * @param exch IPC exchange.
- * @return Error code.
- */
-errno_t hound_service_stream_exit(async_exch_t *exch)
-{
-	return async_req_0_0(exch, IPC_M_HOUND_STREAM_EXIT);
-}
-
-/**
- * Wait until the server side buffer is empty.
- * @param exch IPC exchange.
- * @return Error code.
- */
-errno_t hound_service_stream_drain(async_exch_t *exch)
-{
-	return async_req_0_0(exch, IPC_M_HOUND_STREAM_DRAIN);
-}
-
-/**
- * Write audio data to a stream.
- * @param exch IPC exchange in STREAM MODE.
- * @param data Audio data buffer.
- * @size size of the buffer
- * @return Error code.
- */
-errno_t hound_service_stream_write(async_exch_t *exch, const void *data, size_t size)
-{
-	return async_data_write_start(exch, data, size);
-}
-
-/**
- * Read data from a stream.
- * @param exch IPC exchange in STREAM MODE.
- * @param data Audio data buffer.
- * @size size of the buffer
- * @return Error code.
- */
-errno_t hound_service_stream_read(async_exch_t *exch, void *data, size_t size)
-{
-	return async_data_read_start(exch, data, size);
-}
-
-/*
- * SERVER
- */
-
-static void hound_server_read_data(void *stream);
-static void hound_server_write_data(void *stream);
-static const hound_server_iface_t *server_iface;
-
-/**
- * Set hound server interface implementation.
- * @param iface Initialized Hound server interface.
- */
-void hound_service_set_server_iface(const hound_server_iface_t *iface)
-{
-	server_iface = iface;
-}
-
-/** Server side implementation of the hound protocol. IPC connection handler.
- *
- * @param icall Pointer to initial call structure.
- * @param arg   (unused)
- *
- */
-void hound_connection_handler(ipc_call_t *icall, void *arg)
-{
-	hound_context_id_t context;
-	errno_t ret;
-	int flags;
-	void *source;
-	void *sink;
-
-	/* Accept connection if there is a valid iface */
-	if (server_iface) {
-		async_accept_0(icall);
-	} else {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		switch (ipc_get_imethod(&call)) {
-		case IPC_M_HOUND_CONTEXT_REGISTER:
-			/* check interface functions */
-			if (!server_iface || !server_iface->add_context) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-			bool record = ipc_get_arg1(&call);
-			void *name;
-
-			/* Get context name */
-			ret = async_data_write_accept(&name, true, 0, 0, 0, 0);
-			if (ret != EOK) {
-				async_answer_0(&call, ret);
-				break;
-			}
-
-			context = 0;
-			ret = server_iface->add_context(server_iface->server,
-			    &context, name, record);
-			/** new context should create a copy */
-			free(name);
-			if (ret != EOK) {
-				async_answer_0(&call, ret);
-			} else {
-				async_answer_1(&call, EOK, cap_handle_raw(context));
-			}
-			break;
-		case IPC_M_HOUND_CONTEXT_UNREGISTER:
-			/* check interface functions */
-			if (!server_iface || !server_iface->rem_context) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-
-			/* get id, 1st param */
-			context = (hound_context_id_t) ipc_get_arg1(&call);
-			ret = server_iface->rem_context(server_iface->server,
-			    context);
-			async_answer_0(&call, ret);
-			break;
-		case IPC_M_HOUND_GET_LIST:
-			/* check interface functions */
-			if (!server_iface || !server_iface->get_list) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-
-			char **list = NULL;
-			flags = ipc_get_arg1(&call);
-			size_t count = ipc_get_arg2(&call);
-			const bool conn = ipc_get_arg3(&call);
-			char *conn_name = NULL;
-			ret = EOK;
-
-			/* get connected actor name if provided */
-			if (conn)
-				ret = async_data_write_accept(
-				    (void **)&conn_name, true, 0, 0, 0, 0);
-
-			if (ret == EOK)
-				ret = server_iface->get_list(
-				    server_iface->server, &list, &count,
-				    conn_name, flags);
-			free(conn_name);
-
-			/* Alloc string sizes array */
-			size_t *sizes = NULL;
-			if (count)
-				sizes = calloc(count, sizeof(size_t));
-			if (count && !sizes)
-				ret = ENOMEM;
-			async_answer_1(&call, ret, count);
-
-			/* We are done */
-			if (count == 0 || ret != EOK)
-				break;
-
-			/* Prepare sizes table */
-			for (unsigned i = 0; i < count; ++i)
-				sizes[i] = str_size(list[i]);
-
-			/* Send sizes table */
-			ipc_call_t id;
-			if (async_data_read_receive(&id, NULL)) {
-				ret = async_data_read_finalize(&id, sizes,
-				    count * sizeof(size_t));
-			}
-			free(sizes);
-
-			/* Proceed to send names */
-			for (unsigned i = 0; i < count; ++i) {
-				size_t size = str_size(list[i]);
-				ipc_call_t id;
-				if (ret == EOK &&
-				    async_data_read_receive(&id, NULL)) {
-					ret = async_data_read_finalize(&id,
-					    list[i], size);
-				}
-				free(list[i]);
-			}
-			free(list);
-			break;
-		case IPC_M_HOUND_CONNECT:
-			/* check interface functions */
-			if (!server_iface || !server_iface->connect) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-
-			source = NULL;
-			sink = NULL;
-
-			/* read source name */
-			ret = async_data_write_accept(&source, true, 0, 0, 0,
-			    0);
-			/* read sink name */
-			if (ret == EOK)
-				ret = async_data_write_accept(&sink,
-				    true, 0, 0, 0, 0);
-
-			if (ret == EOK)
-				ret = server_iface->connect(
-				    server_iface->server, source, sink);
-			free(source);
-			free(sink);
-			async_answer_0(&call, ret);
-			break;
-		case IPC_M_HOUND_DISCONNECT:
-			/* check interface functions */
-			if (!server_iface || !server_iface->disconnect) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-
-			source = NULL;
-			sink = NULL;
-
-			/* read source name */
-			ret = async_data_write_accept(&source, true, 0, 0, 0,
-			    0);
-			/* read sink name */
-			if (ret == EOK)
-				ret = async_data_write_accept(&sink,
-				    true, 0, 0, 0, 0);
-			if (ret == EOK)
-				ret = server_iface->connect(
-				    server_iface->server, source, sink);
-			free(source);
-			free(sink);
-			async_answer_0(&call, ret);
-			break;
-		case IPC_M_HOUND_STREAM_ENTER:
-			/* check interface functions */
-			if (!server_iface || !server_iface->is_record_context ||
-			    !server_iface->add_stream ||
-			    !server_iface->rem_stream) {
-				async_answer_0(&call, ENOTSUP);
-				break;
-			}
-
-			/* get parameters */
-			context = (hound_context_id_t) ipc_get_arg1(&call);
-			flags = ipc_get_arg2(&call);
-			const format_convert_t c = { .arg = ipc_get_arg3(&call) };
-			const pcm_format_t f = {
-				.sampling_rate = c.f.rate * 100,
-				.channels = c.f.channels,
-				.sample_format = c.f.format,
-			};
-			size_t bsize = ipc_get_arg4(&call);
-
-			void *stream;
-			ret = server_iface->add_stream(server_iface->server,
-			    context, flags, f, bsize, &stream);
-			if (ret != EOK) {
-				async_answer_0(&call, ret);
-				break;
-			}
-			const bool rec = server_iface->is_record_context(
-			    server_iface->server, context);
-			if (rec) {
-				if (server_iface->stream_data_read) {
-					async_answer_0(&call, EOK);
-					/* start answering read calls */
-					hound_server_write_data(stream);
-					server_iface->rem_stream(
-					    server_iface->server, stream);
-				} else {
-					async_answer_0(&call, ENOTSUP);
-				}
-			} else {
-				if (server_iface->stream_data_write) {
-					async_answer_0(&call, EOK);
-					/* accept write calls */
-					hound_server_read_data(stream);
-					server_iface->rem_stream(
-					    server_iface->server, stream);
-				} else {
-					async_answer_0(&call, ENOTSUP);
-				}
-			}
-			break;
-		case IPC_M_HOUND_STREAM_EXIT:
-		case IPC_M_HOUND_STREAM_DRAIN:
-			/* Stream exit/drain is only allowed in stream context */
-			async_answer_0(&call, EINVAL);
-			break;
-		default:
-			/*
-			 * In case we called async_get_call() after we had
-			 * already received IPC_M_PHONE_HUNGUP deeper in the
-			 * protocol handling, the capability handle will be
-			 * invalid, so act carefully here.
-			 */
-			if (call.cap_handle != CAP_NIL)
-				async_answer_0(&call, ENOTSUP);
-			return;
-		}
-	}
-}
-
-/**
- * Read data and push it to the stream.
- * @param stream target stream, will push data there.
- */
-static void hound_server_read_data(void *stream)
-{
-	ipc_call_t call;
-	size_t size = 0;
-	errno_t ret_answer = EOK;
-
-	/* accept data write or drain */
-	while (async_data_write_receive(&call, &size) ||
-	    (ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_DRAIN)) {
-		/* check drain first */
-		if (ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_DRAIN) {
-			errno_t ret = ENOTSUP;
-			if (server_iface->drain_stream)
-				ret = server_iface->drain_stream(stream);
-			async_answer_0(&call, ret);
-			continue;
-		}
-
-		/* there was an error last time */
-		if (ret_answer != EOK) {
-			async_answer_0(&call, ret_answer);
-			continue;
-		}
-
-		char *buffer = malloc(size);
-		if (!buffer) {
-			async_answer_0(&call, ENOMEM);
-			continue;
-		}
-		const errno_t ret = async_data_write_finalize(&call, buffer, size);
-		if (ret == EOK) {
-			/* push data to stream */
-			ret_answer = server_iface->stream_data_write(
-			    stream, buffer, size);
-		}
-	}
-	const errno_t ret = ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_EXIT ?
-	    EOK : EINVAL;
-
-	async_answer_0(&call, ret);
-}
-
-/**
- * Accept reads and pull data from the stream.
- * @param stream target stream, will pull data from there.
- */
-static void hound_server_write_data(void *stream)
-{
-
-	ipc_call_t call;
-	size_t size = 0;
-	errno_t ret_answer = EOK;
-
-	/* accept data read and drain */
-	while (async_data_read_receive(&call, &size) ||
-	    (ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_DRAIN)) {
-		/* drain does not make much sense but it is allowed */
-		if (ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_DRAIN) {
-			errno_t ret = ENOTSUP;
-			if (server_iface->drain_stream)
-				ret = server_iface->drain_stream(stream);
-			async_answer_0(&call, ret);
-			continue;
-		}
-		/* there was an error last time */
-		if (ret_answer != EOK) {
-			async_answer_0(&call, ret_answer);
-			continue;
-		}
-		char *buffer = malloc(size);
-		if (!buffer) {
-			async_answer_0(&call, ENOMEM);
-			continue;
-		}
-		errno_t ret = server_iface->stream_data_read(stream, buffer, size);
-		if (ret == EOK) {
-			ret_answer =
-			    async_data_read_finalize(&call, buffer, size);
-		}
-	}
-	const errno_t ret = ipc_get_imethod(&call) == IPC_M_HOUND_STREAM_EXIT ?
-	    EOK : EINVAL;
-
-	async_answer_0(&call, ret);
-}
-
-/*
- * SERVER SIDE
- */
-
-/**
- * Register new hound service to the location service.
- * @param[in] name server name
- * @param[out] id assigned service id.
- * @return Error code.
- */
-errno_t hound_server_register(const char *name, service_id_t *id)
-{
-	errno_t rc;
-
-	if (!name || !id)
-		return EINVAL;
-
-	if (hound_srv != NULL)
-		return EBUSY;
-
-	rc = loc_server_register(name, &hound_srv);
-	if (rc != EOK)
-		return rc;
-
-	rc = loc_service_register(hound_srv, HOUND_SERVICE, id);
-	if (rc != EOK) {
-		loc_server_unregister(hound_srv);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * Unregister server from the location service.
- * @param id previously assigned service id.
- */
-void hound_server_unregister(service_id_t id)
-{
-	loc_service_unregister(hound_srv, id);
-	loc_server_unregister(hound_srv);
-}
-
-/**
- * Set callback on device category change event.
- * @param cb Callback function.
- * @return Error code.
- */
-errno_t hound_server_set_device_change_callback(dev_change_callback_t cb,
-    void *arg)
-{
-	return loc_register_cat_change_cb(cb, arg);
-}
-
-/**
- * Walk through all device in the audio-pcm category.
- * @param callback Function to call on every device.
- * @return Error code.
- */
-errno_t hound_server_devices_iterate(device_callback_t callback)
-{
-	if (!callback)
-		return EINVAL;
-	static bool resolved = false;
-	static category_id_t cat_id = 0;
-
-	if (!resolved) {
-		const errno_t ret = loc_category_get_id("audio-pcm", &cat_id,
-		    IPC_FLAG_BLOCKING);
-		if (ret != EOK)
-			return ret;
-		resolved = true;
-	}
-
-	service_id_t *svcs = NULL;
-	size_t count = 0;
-	const errno_t ret = loc_category_get_svcs(cat_id, &svcs, &count);
-	if (ret != EOK)
-		return ret;
-
-	for (unsigned i = 0; i < count; ++i) {
-		char *name = NULL;
-		loc_service_get_name(svcs[i], &name);
-		callback(svcs[i], name);
-		free(name);
-	}
-	free(svcs);
-	return EOK;
-}
-/**
- * @}
- */
Index: pace/lib/http/doc/doxygroups.h
===================================================================
--- uspace/lib/http/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup http libhttp
- * @ingroup libs
- */
Index: pace/lib/http/include/http/ctype.h
===================================================================
--- uspace/lib/http/include/http/ctype.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#ifndef HTTP_CTYPE_H_
-#define HTTP_CTYPE_H_
-
-static inline bool is_separator(char c)
-{
-	switch (c) {
-	case '(':
-	case ')':
-	case '<':
-	case '>':
-	case '@':
-	case ',':
-	case ';':
-	case ':':
-	case '\\':
-	case '"':
-	case '/':
-	case '[':
-	case ']':
-	case '?':
-	case '=':
-	case '{':
-	case '}':
-	case ' ':
-	case '\t':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_lws(char c)
-{
-	switch (c) {
-	case '\r':
-	case '\n':
-	case ' ':
-	case '\t':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_ctl(char c)
-{
-	return c < 32 || c == 127;
-}
-
-static inline bool is_token(char c)
-{
-	return !is_separator(c) && !is_ctl(c);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/http/include/http/http.h
===================================================================
--- uspace/lib/http/include/http/http.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#ifndef HTTP_HTTP_H_
-#define HTTP_HTTP_H_
-
-#include <adt/list.h>
-#include <inet/addr.h>
-#include <inet/tcp.h>
-
-#include "receive-buffer.h"
-
-typedef struct {
-	char *host;
-	uint16_t port;
-	inet_addr_t addr;
-
-	tcp_t *tcp;
-	tcp_conn_t *conn;
-
-	size_t buffer_size;
-	receive_buffer_t recv_buffer;
-} http_t;
-
-typedef struct {
-	uint8_t minor;
-	uint8_t major;
-} http_version_t;
-
-typedef struct {
-	link_t link;
-	char *name;
-	char *value;
-} http_header_t;
-
-typedef struct {
-	list_t list;
-} http_headers_t;
-
-typedef struct {
-	char *method;
-	char *path;
-	http_headers_t headers;
-} http_request_t;
-
-typedef struct {
-	http_version_t version;
-	uint16_t status;
-	char *message;
-	http_headers_t headers;
-} http_response_t;
-
-extern http_t *http_create(const char *, uint16_t);
-extern errno_t http_connect(http_t *);
-
-extern void http_header_init(http_header_t *);
-extern http_header_t *http_header_create(const char *, const char *);
-extern errno_t http_header_receive_name(receive_buffer_t *, receive_buffer_mark_t *);
-extern errno_t http_header_receive_value(receive_buffer_t *, receive_buffer_mark_t *,
-    receive_buffer_mark_t *);
-extern errno_t http_header_receive(receive_buffer_t *, http_header_t *, size_t,
-    size_t *);
-extern void http_header_normalize_value(char *);
-extern bool http_header_name_match(const char *, const char *);
-ssize_t http_header_encode(http_header_t *, char *, size_t);
-extern void http_header_destroy(http_header_t *);
-
-extern void http_headers_init(http_headers_t *);
-extern errno_t http_headers_find_single(http_headers_t *, const char *,
-    http_header_t **);
-extern errno_t http_headers_append(http_headers_t *, const char *, const char *);
-extern errno_t http_headers_set(http_headers_t *, const char *, const char *);
-extern errno_t http_headers_get(http_headers_t *, const char *, char **);
-extern errno_t http_headers_receive(receive_buffer_t *, http_headers_t *, size_t,
-    unsigned);
-extern void http_headers_clear(http_headers_t *);
-
-#define http_headers_foreach(headers, iter) \
-    list_foreach((headers).list, link, http_header_t, (iter))
-
-static inline void http_headers_remove(http_headers_t *headers,
-    http_header_t *header)
-{
-	list_remove(&header->link);
-}
-
-static inline void http_headers_append_header(http_headers_t *headers,
-    http_header_t *header)
-{
-	list_append(&header->link, &headers->list);
-}
-
-extern http_request_t *http_request_create(const char *, const char *);
-extern void http_request_destroy(http_request_t *);
-extern errno_t http_request_format(http_request_t *, char **, size_t *);
-extern errno_t http_send_request(http_t *, http_request_t *);
-extern errno_t http_receive_status(receive_buffer_t *, http_version_t *, uint16_t *,
-    char **);
-extern errno_t http_receive_response(receive_buffer_t *, http_response_t **,
-    size_t, unsigned);
-extern void http_response_destroy(http_response_t *);
-extern errno_t http_close(http_t *);
-extern void http_destroy(http_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/http/include/http/receive-buffer.h
===================================================================
--- uspace/lib/http/include/http/receive-buffer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#ifndef HTTP_RECEIVE_BUFFER_H_
-#define HTTP_RECEIVE_BUFFER_H_
-
-#include <adt/list.h>
-#include <stddef.h>
-#include <types/common.h>
-
-/** Receive data.
- *
- * @param client_data client data
- * @param buf buffer to store the data
- * @param buf_size buffer size
- * @param nrecv number of bytes actually received
- * @return EOK on success or an error code
- */
-typedef errno_t (*receive_func_t)(void *, void *, size_t, size_t *);
-
-typedef struct {
-	size_t size;
-	char *buffer;
-	size_t in;
-	size_t out;
-
-	void *client_data;
-	receive_func_t receive;
-
-	list_t marks;
-} receive_buffer_t;
-
-typedef struct {
-	link_t link;
-	size_t offset;
-} receive_buffer_mark_t;
-
-typedef bool (*char_class_func_t)(char);
-
-extern errno_t recv_buffer_init(receive_buffer_t *, size_t, receive_func_t, void *);
-extern errno_t recv_buffer_init_const(receive_buffer_t *, void *, size_t);
-extern void recv_buffer_fini(receive_buffer_t *);
-extern void recv_reset(receive_buffer_t *);
-extern void recv_mark(receive_buffer_t *, receive_buffer_mark_t *);
-extern void recv_unmark(receive_buffer_t *, receive_buffer_mark_t *);
-extern void recv_mark_update(receive_buffer_t *, receive_buffer_mark_t *);
-extern errno_t recv_cut(receive_buffer_t *, receive_buffer_mark_t *,
-    receive_buffer_mark_t *, void **, size_t *);
-extern errno_t recv_cut_str(receive_buffer_t *, receive_buffer_mark_t *,
-    receive_buffer_mark_t *, char **);
-extern errno_t recv_char(receive_buffer_t *, char *, bool);
-extern errno_t recv_buffer(receive_buffer_t *, char *, size_t, size_t *);
-extern errno_t recv_discard(receive_buffer_t *, char, size_t *);
-extern errno_t recv_discard_str(receive_buffer_t *, const char *, size_t *);
-extern errno_t recv_while(receive_buffer_t *, char_class_func_t);
-extern errno_t recv_eol(receive_buffer_t *, size_t *);
-extern errno_t recv_line(receive_buffer_t *, char *, size_t, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/http/meson.build
===================================================================
--- uspace/lib/http/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files(
-	'src/http.c',
-	'src/headers.c',
-	'src/request.c',
-	'src/response.c',
-	'src/receive-buffer.c',
-)
Index: pace/lib/http/src/headers.c
===================================================================
--- uspace/lib/http/src/headers.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,386 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-
-#include <http/http.h>
-#include <http/ctype.h>
-
-#define HTTP_HEADER_LINE "%s: %s\r\n"
-
-void http_header_init(http_header_t *header)
-{
-	link_initialize(&header->link);
-	header->name = NULL;
-	header->value = NULL;
-}
-
-http_header_t *http_header_create(const char *name, const char *value)
-{
-	http_header_t *header = malloc(sizeof(http_header_t));
-	if (header == NULL)
-		return NULL;
-	http_header_init(header);
-
-	header->name = str_dup(name);
-	if (header->name == NULL) {
-		free(header);
-		return NULL;
-	}
-
-	header->value = str_dup(value);
-	if (header->value == NULL) {
-		free(header->name);
-		free(header);
-		return NULL;
-	}
-
-	return header;
-}
-
-void http_header_destroy(http_header_t *header)
-{
-	free(header->name);
-	free(header->value);
-	free(header);
-}
-
-ssize_t http_header_encode(http_header_t *header, char *buf, size_t buf_size)
-{
-	/* TODO properly split long header values */
-	return snprintf(buf, buf_size,
-	    HTTP_HEADER_LINE, header->name, header->value);
-}
-
-errno_t http_header_receive_name(receive_buffer_t *rb,
-    receive_buffer_mark_t *name_end)
-{
-	char c = 0;
-	do {
-		if (name_end)
-			recv_mark_update(rb, name_end);
-
-		errno_t rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-	} while (is_token(c));
-
-	if (c != ':')
-		return EINVAL;
-
-	return EOK;
-}
-
-errno_t http_header_receive_value(receive_buffer_t *rb,
-    receive_buffer_mark_t *value_start, receive_buffer_mark_t *value_end)
-{
-	errno_t rc = EOK;
-	char c = 0;
-
-	/* Ignore any inline LWS */
-	while (true) {
-		if (value_start)
-			recv_mark_update(rb, value_start);
-
-		rc = recv_char(rb, &c, false);
-		if (rc != EOK)
-			return rc;
-
-		if (c != ' ' && c != '\t')
-			break;
-
-		rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-	}
-
-	while (true) {
-		recv_mark_update(rb, value_end);
-
-		rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-
-		if (c != '\r' && c != '\n')
-			continue;
-
-		size_t nrecv;
-		rc = recv_discard(rb, (c == '\r' ? '\n' : '\r'), &nrecv);
-		if (rc != EOK)
-			return rc;
-
-		rc = recv_char(rb, &c, false);
-		if (rc != EOK)
-			return rc;
-
-		if (c != ' ' && c != '\t')
-			break;
-
-		/* Ignore the char */
-		rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-errno_t http_header_receive(receive_buffer_t *rb, http_header_t *header,
-    size_t size_limit, size_t *out_bytes_used)
-{
-	receive_buffer_mark_t mark_start;
-	receive_buffer_mark_t mark_end;
-
-	recv_mark(rb, &mark_start);
-	recv_mark(rb, &mark_end);
-
-	errno_t rc = http_header_receive_name(rb, &mark_end);
-	if (rc != EOK)
-		goto end;
-
-	size_t name_size = mark_end.offset - mark_start.offset;
-	if (size_limit > 0 && name_size > size_limit) {
-		rc = ELIMIT;
-		goto end;
-	}
-
-	char *name = NULL;
-	rc = recv_cut_str(rb, &mark_start, &mark_end, &name);
-	if (rc != EOK)
-		goto end;
-
-	rc = http_header_receive_value(rb, &mark_start, &mark_end);
-	if (rc != EOK)
-		goto end_with_name;
-
-	size_t value_size = mark_end.offset - mark_start.offset;
-	if (size_limit > 0 && (name_size + value_size) > size_limit) {
-		rc = ELIMIT;
-		goto end_with_name;
-	}
-
-	char *value = NULL;
-	rc = recv_cut_str(rb, &mark_start, &mark_end, &value);
-	if (rc != EOK)
-		goto end_with_name;
-
-	if (out_bytes_used)
-		*out_bytes_used = name_size + value_size;
-
-	header->name = name;
-	header->value = value;
-	goto end;
-end_with_name:
-	free(name);
-end:
-	recv_unmark(rb, &mark_start);
-	recv_unmark(rb, &mark_end);
-	return rc;
-}
-
-/** Normalize HTTP header value
- *
- * @see RFC2616 section 4.2
- */
-void http_header_normalize_value(char *value)
-{
-	size_t read_index = 0;
-	size_t write_index = 0;
-
-	while (is_lws(value[read_index]))
-		read_index++;
-
-	while (value[read_index] != 0) {
-		if (is_lws(value[read_index])) {
-			while (is_lws(value[read_index]))
-				read_index++;
-
-			if (value[read_index] != 0)
-				value[write_index++] = ' ';
-
-			continue;
-		}
-
-		value[write_index++] = value[read_index++];
-	}
-
-	value[write_index] = 0;
-}
-
-/** Test if two header names are equivalent
- *
- */
-bool http_header_name_match(const char *name_a, const char *name_b)
-{
-	return str_casecmp(name_a, name_b) == 0;
-}
-
-void http_headers_init(http_headers_t *headers)
-{
-	list_initialize(&headers->list);
-}
-
-errno_t http_headers_find_single(http_headers_t *headers, const char *name,
-    http_header_t **out_header)
-{
-	http_header_t *found = NULL;
-	http_headers_foreach(*headers, header) {
-		if (!http_header_name_match(header->name, name))
-			continue;
-
-		if (found == NULL) {
-			found = header;
-		} else {
-			return HTTP_EMULTIPLE_HEADERS;
-		}
-	}
-
-	if (found == NULL)
-		return HTTP_EMISSING_HEADER;
-
-	*out_header = found;
-	return EOK;
-}
-
-errno_t http_headers_append(http_headers_t *headers, const char *name,
-    const char *value)
-{
-	http_header_t *header = http_header_create(name, value);
-	if (header == NULL)
-		return ENOMEM;
-
-	http_headers_append_header(headers, header);
-	return EOK;
-}
-
-errno_t http_headers_set(http_headers_t *headers, const char *name,
-    const char *value)
-{
-	http_header_t *header = NULL;
-	errno_t rc = http_headers_find_single(headers, name, &header);
-	if (rc != EOK && rc != HTTP_EMISSING_HEADER)
-		return rc;
-
-	if (rc == HTTP_EMISSING_HEADER)
-		return http_headers_append(headers, name, value);
-
-	char *new_value = str_dup(value);
-	if (new_value == NULL)
-		return ENOMEM;
-
-	free(header->value);
-	header->value = new_value;
-	return EOK;
-}
-
-errno_t http_headers_get(http_headers_t *headers, const char *name, char **value)
-{
-	http_header_t *header = NULL;
-	errno_t rc = http_headers_find_single(headers, name, &header);
-	if (rc != EOK)
-		return rc;
-
-	*value = header->value;
-	return EOK;
-}
-
-errno_t http_headers_receive(receive_buffer_t *rb, http_headers_t *headers,
-    size_t limit_alloc, unsigned limit_count)
-{
-	errno_t rc = EOK;
-	unsigned added = 0;
-
-	while (true) {
-		char c = 0;
-		rc = recv_char(rb, &c, false);
-		if (rc != EOK)
-			goto error;
-
-		if (c == '\n' || c == '\r')
-			break;
-
-		if (limit_count > 0 && added >= limit_count) {
-			rc = ELIMIT;
-			goto error;
-		}
-
-		http_header_t *header = malloc(sizeof(http_header_t));
-		if (header == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-		http_header_init(header);
-
-		size_t header_size;
-		rc = http_header_receive(rb, header, limit_alloc, &header_size);
-		if (rc != EOK) {
-			free(header);
-			goto error;
-		}
-		limit_alloc -= header_size;
-
-		http_headers_append_header(headers, header);
-		added++;
-	}
-
-	return EOK;
-error:
-	while (added-- > 0) {
-		link_t *link = list_last(&headers->list);
-		http_header_t *header = list_get_instance(link, http_header_t, link);
-		http_headers_remove(headers, header);
-		http_header_destroy(header);
-	}
-	return rc;
-}
-
-void http_headers_clear(http_headers_t *headers)
-{
-	link_t *link = list_first(&headers->list);
-	while (link != NULL) {
-		link_t *next = list_next(link, &headers->list);
-		http_header_t *header = list_get_instance(link, http_header_t, link);
-		list_remove(link);
-		http_header_destroy(header);
-		link = next;
-	}
-}
-
-/** @}
- */
Index: pace/lib/http/src/http.c
===================================================================
--- uspace/lib/http/src/http.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-
-#include <inet/endpoint.h>
-#include <inet/host.h>
-#include <inet/tcp.h>
-
-#include <http/http.h>
-#include <http/receive-buffer.h>
-
-static errno_t http_receive(void *client_data, void *buf, size_t buf_size,
-    size_t *nrecv)
-{
-	http_t *http = client_data;
-
-	return tcp_conn_recv_wait(http->conn, buf, buf_size, nrecv);
-}
-
-http_t *http_create(const char *host, uint16_t port)
-{
-	http_t *http = malloc(sizeof(http_t));
-	if (http == NULL)
-		return NULL;
-
-	http->host = str_dup(host);
-	if (http->host == NULL) {
-		free(http);
-		return NULL;
-	}
-	http->port = port;
-
-	http->buffer_size = 4096;
-	errno_t rc = recv_buffer_init(&http->recv_buffer, http->buffer_size,
-	    http_receive, http);
-	if (rc != EOK) {
-		free(http);
-		return NULL;
-	}
-
-	return http;
-}
-
-errno_t http_connect(http_t *http)
-{
-	if (http->conn != NULL)
-		return EBUSY;
-
-	errno_t rc = inet_host_plookup_one(http->host, ip_any, &http->addr, NULL,
-	    NULL);
-	if (rc != EOK)
-		return rc;
-
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	epp.remote.addr = http->addr;
-	epp.remote.port = http->port;
-
-	rc = tcp_create(&http->tcp);
-	if (rc != EOK)
-		return rc;
-
-	rc = tcp_conn_create(http->tcp, &epp, NULL, NULL, &http->conn);
-	if (rc != EOK)
-		return rc;
-
-	rc = tcp_conn_wait_connected(http->conn);
-	if (rc != EOK)
-		return rc;
-
-	return rc;
-}
-
-errno_t http_close(http_t *http)
-{
-	if (http->conn == NULL)
-		return EINVAL;
-
-	tcp_conn_destroy(http->conn);
-	http->conn = NULL;
-	tcp_destroy(http->tcp);
-	http->tcp = NULL;
-
-	return EOK;
-}
-
-void http_destroy(http_t *http)
-{
-	(void) http_close(http);
-	recv_buffer_fini(&http->recv_buffer);
-	free(http);
-}
-
-/** @}
- */
Index: pace/lib/http/src/receive-buffer.c
===================================================================
--- uspace/lib/http/src/receive-buffer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,326 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <errno.h>
-#include <macros.h>
-#include <adt/list.h>
-
-#include <http/receive-buffer.h>
-
-errno_t recv_buffer_init(receive_buffer_t *rb, size_t buffer_size,
-    receive_func_t receive, void *client_data)
-{
-	rb->receive = receive;
-	rb->client_data = client_data;
-
-	rb->in = 0;
-	rb->out = 0;
-	rb->size = buffer_size;
-
-	list_initialize(&rb->marks);
-
-	rb->buffer = malloc(buffer_size);
-	if (rb->buffer == NULL)
-		return ENOMEM;
-	return EOK;
-}
-
-static errno_t dummy_receive(void *unused, void *buf, size_t buf_size,
-    size_t *nrecv)
-{
-	*nrecv = 0;
-	return EOK;
-}
-
-errno_t recv_buffer_init_const(receive_buffer_t *rb, void *buf, size_t size)
-{
-	errno_t rc = recv_buffer_init(rb, size, dummy_receive, NULL);
-	if (rc != EOK)
-		return rc;
-
-	memcpy(rb->buffer, buf, size);
-	rb->in = size;
-	return EOK;
-}
-
-void recv_buffer_fini(receive_buffer_t *rb)
-{
-	free(rb->buffer);
-}
-
-void recv_reset(receive_buffer_t *rb)
-{
-	rb->in = 0;
-	rb->out = 0;
-}
-
-void recv_mark(receive_buffer_t *rb, receive_buffer_mark_t *mark)
-{
-	link_initialize(&mark->link);
-	list_append(&mark->link, &rb->marks);
-	recv_mark_update(rb, mark);
-}
-
-void recv_unmark(receive_buffer_t *rb, receive_buffer_mark_t *mark)
-{
-	list_remove(&mark->link);
-}
-
-void recv_mark_update(receive_buffer_t *rb, receive_buffer_mark_t *mark)
-{
-	mark->offset = rb->out;
-}
-
-errno_t recv_cut(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, void **out_buf, size_t *out_size)
-{
-	if (a->offset > b->offset)
-		return EINVAL;
-
-	size_t size = b->offset - a->offset;
-	void *buf = malloc(size);
-	if (buf == NULL)
-		return ENOMEM;
-
-	memcpy(buf, rb->buffer + a->offset, size);
-	*out_buf = buf;
-	*out_size = size;
-	return EOK;
-}
-
-errno_t recv_cut_str(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, char **out_buf)
-{
-	if (a->offset > b->offset)
-		return EINVAL;
-
-	size_t size = b->offset - a->offset;
-	char *buf = malloc(size + 1);
-	if (buf == NULL)
-		return ENOMEM;
-
-	memcpy(buf, rb->buffer + a->offset, size);
-	buf[size] = 0;
-	for (size_t i = 0; i < size; i++) {
-		if (buf[i] == 0) {
-			free(buf);
-			return EIO;
-		}
-	}
-	*out_buf = buf;
-	return EOK;
-}
-
-/** Receive one character (with buffering) */
-errno_t recv_char(receive_buffer_t *rb, char *c, bool consume)
-{
-	if (rb->out == rb->in) {
-		size_t free = rb->size - rb->in;
-		if (free == 0) {
-			size_t min_mark = rb->size;
-			list_foreach(rb->marks, link, receive_buffer_mark_t, mark) {
-				min_mark = min(min_mark, mark->offset);
-			}
-
-			if (min_mark == 0)
-				return ELIMIT;
-
-			size_t new_in = rb->in - min_mark;
-			memmove(rb->buffer, rb->buffer + min_mark, new_in);
-			rb->out = rb->in = new_in;
-			free = rb->size - rb->in;
-			list_foreach(rb->marks, link, receive_buffer_mark_t, mark) {
-				mark->offset -= min_mark;
-			}
-		}
-
-		size_t nrecv;
-		errno_t rc = rb->receive(rb->client_data, rb->buffer + rb->in, free, &nrecv);
-		if (rc != EOK)
-			return rc;
-
-		rb->in = nrecv;
-	}
-
-	*c = rb->buffer[rb->out];
-	if (consume)
-		rb->out++;
-	return EOK;
-}
-
-errno_t recv_buffer(receive_buffer_t *rb, char *buf, size_t buf_size,
-    size_t *nrecv)
-{
-	/* Flush any buffered data */
-	if (rb->out != rb->in) {
-		size_t size = min(rb->in - rb->out, buf_size);
-		memcpy(buf, rb->buffer + rb->out, size);
-		rb->out += size;
-		*nrecv = size;
-		return EOK;
-	}
-
-	return rb->receive(rb->client_data, buf, buf_size, nrecv);
-}
-
-/** Receive a character and if it is c, discard it from input buffer
- * @param ndisc Place to store number of characters discarded
- * @return EOK or an error code
- */
-errno_t recv_discard(receive_buffer_t *rb, char discard, size_t *ndisc)
-{
-	char c = 0;
-	errno_t rc = recv_char(rb, &c, false);
-	if (rc != EOK)
-		return rc;
-	if (c != discard) {
-		*ndisc = 0;
-		return EOK;
-	}
-	rc = recv_char(rb, &c, true);
-	if (rc != EOK)
-		return rc;
-	*ndisc = 1;
-	return EOK;
-}
-
-/** Receive a prefix of constant string discard and return number of bytes read
- * @param ndisc Place to store number of characters discarded
- * @return EOK or an error code
- */
-errno_t recv_discard_str(receive_buffer_t *rb, const char *discard, size_t *ndisc)
-{
-	size_t discarded = 0;
-	while (*discard) {
-		size_t nd;
-		errno_t rc = recv_discard(rb, *discard, &nd);
-		if (rc != EOK)
-			return rc;
-		if (nd == 0)
-			break;
-		discarded += nd;
-		discard++;
-	}
-
-	*ndisc = discarded;
-	return EOK;
-}
-
-errno_t recv_while(receive_buffer_t *rb, char_class_func_t class)
-{
-	while (true) {
-		char c = 0;
-		errno_t rc = recv_char(rb, &c, false);
-		if (rc != EOK)
-			return rc;
-
-		if (!class(c))
-			break;
-
-		rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Receive an end of line, either CR, LF, CRLF or LFCR
- *
- * @param nrecv Place to store number of bytes received (zero if
- *              no newline is present in the stream)
- * @return EOK on success or an error code
- */
-errno_t recv_eol(receive_buffer_t *rb, size_t *nrecv)
-{
-	char c = 0;
-	errno_t rc = recv_char(rb, &c, false);
-	if (rc != EOK)
-		return rc;
-
-	if (c != '\r' && c != '\n') {
-		*nrecv = 0;
-		return EOK;
-	}
-
-	rc = recv_char(rb, &c, true);
-	if (rc != EOK)
-		return rc;
-
-	size_t nr;
-	rc = recv_discard(rb, (c == '\r' ? '\n' : '\r'), &nr);
-	if (rc != EOK)
-		return rc;
-
-	*nrecv = 1 + nr;
-	return EOK;
-}
-
-/* Receive a single line */
-errno_t recv_line(receive_buffer_t *rb, char *line, size_t size, size_t *nrecv)
-{
-	size_t written = 0;
-	size_t nr;
-
-	while (written < size) {
-		char c = 0;
-		errno_t rc = recv_char(rb, &c, true);
-		if (rc != EOK)
-			return rc;
-		if (c == '\n') {
-			rc = recv_discard(rb, '\r', &nr);
-			if (rc != EOK)
-				return rc;
-
-			line[written++] = 0;
-			*nrecv = written;
-			return EOK;
-		} else if (c == '\r') {
-			rc = recv_discard(rb, '\n', &nr);
-			if (rc != EOK)
-				return rc;
-			line[written++] = 0;
-			*nrecv = written;
-			return EOK;
-		}
-		line[written++] = c;
-	}
-
-	return ELIMIT;
-}
-
-/** @}
- */
Index: pace/lib/http/src/request.c
===================================================================
--- uspace/lib/http/src/request.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,154 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-
-#include <inet/tcp.h>
-
-#include <http/http.h>
-
-#define HTTP_METHOD_LINE "%s %s HTTP/1.1\r\n"
-#define HTTP_REQUEST_LINE "\r\n"
-
-http_request_t *http_request_create(const char *method, const char *path)
-{
-	http_request_t *req = malloc(sizeof(http_request_t));
-	if (req == NULL)
-		return NULL;
-
-	req->method = str_dup(method);
-	if (req->method == NULL) {
-		free(req);
-		return NULL;
-	}
-
-	req->path = str_dup(path);
-	if (req->path == NULL) {
-		free(req->method);
-		free(req);
-		return NULL;
-	}
-
-	http_headers_init(&req->headers);
-
-	return req;
-}
-
-void http_request_destroy(http_request_t *req)
-{
-	free(req->method);
-	free(req->path);
-	http_headers_clear(&req->headers);
-	free(req);
-}
-
-static ssize_t http_encode_method(char *buf, size_t buf_size,
-    const char *method, const char *path)
-{
-	return snprintf(buf, buf_size, HTTP_METHOD_LINE, method, path);
-}
-
-errno_t http_request_format(http_request_t *req, char **out_buf,
-    size_t *out_buf_size)
-{
-	/* Compute the size of the request */
-	ssize_t meth_size = http_encode_method(NULL, 0, req->method, req->path);
-	if (meth_size < 0)
-		return EINVAL;
-	size_t size = meth_size;
-
-	http_headers_foreach(req->headers, header) {
-		ssize_t header_size = http_header_encode(header, NULL, 0);
-		if (header_size < 0)
-			return EINVAL;
-		size += header_size;
-	}
-	size += str_length(HTTP_REQUEST_LINE);
-
-	char *buf = malloc(size);
-	if (buf == NULL)
-		return ENOMEM;
-
-	char *pos = buf;
-	size_t pos_size = size;
-	ssize_t written = http_encode_method(pos, pos_size, req->method, req->path);
-	if (written < 0) {
-		free(buf);
-		return EINVAL;
-	}
-	pos += written;
-	pos_size -= written;
-
-	http_headers_foreach(req->headers, header) {
-		written = http_header_encode(header, pos, pos_size);
-		if (written < 0) {
-			free(buf);
-			return EINVAL;
-		}
-		pos += written;
-		pos_size -= written;
-	}
-
-	size_t rlsize = str_size(HTTP_REQUEST_LINE);
-	memcpy(pos, HTTP_REQUEST_LINE, rlsize);
-	pos_size -= rlsize;
-	assert(pos_size == 0);
-
-	*out_buf = buf;
-	*out_buf_size = size;
-	return EOK;
-}
-
-errno_t http_send_request(http_t *http, http_request_t *req)
-{
-	char *buf = NULL;
-	size_t buf_size = 0;
-
-	errno_t rc = http_request_format(req, &buf, &buf_size);
-	if (rc != EOK)
-		return rc;
-
-	rc = tcp_conn_send(http->conn, buf, buf_size);
-	free(buf);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/http/src/response.c
===================================================================
--- uspace/lib/http/src/response.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,231 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup http
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-
-#include <http/http.h>
-
-static bool is_digit(char c)
-{
-	return (c >= '0' && c <= '9');
-}
-
-static errno_t receive_number(receive_buffer_t *rb, char **str)
-{
-	receive_buffer_mark_t start;
-	receive_buffer_mark_t end;
-
-	recv_mark(rb, &start);
-	errno_t rc = recv_while(rb, is_digit);
-	if (rc != EOK) {
-		recv_unmark(rb, &start);
-		return rc;
-	}
-	recv_mark(rb, &end);
-
-	rc = recv_cut_str(rb, &start, &end, str);
-	recv_unmark(rb, &start);
-	recv_unmark(rb, &end);
-	return rc;
-}
-
-static errno_t receive_uint8_t(receive_buffer_t *rb, uint8_t *out_value)
-{
-	char *str = NULL;
-	errno_t rc = receive_number(rb, &str);
-
-	if (rc != EOK)
-		return rc;
-
-	rc = str_uint8_t(str, NULL, 10, true, out_value);
-	free(str);
-
-	return rc;
-}
-
-static errno_t receive_uint16_t(receive_buffer_t *rb, uint16_t *out_value)
-{
-	char *str = NULL;
-	errno_t rc = receive_number(rb, &str);
-
-	if (rc != EOK)
-		return rc;
-
-	rc = str_uint16_t(str, NULL, 10, true, out_value);
-	free(str);
-
-	return rc;
-}
-
-static errno_t expect(receive_buffer_t *rb, const char *expect)
-{
-	size_t ndisc;
-	errno_t rc = recv_discard_str(rb, expect, &ndisc);
-	if (rc != EOK)
-		return rc;
-	if (ndisc < str_length(expect))
-		return HTTP_EPARSE;
-	return EOK;
-}
-
-static bool is_not_newline(char c)
-{
-	return (c != '\n' && c != '\r');
-}
-
-errno_t http_receive_status(receive_buffer_t *rb, http_version_t *out_version,
-    uint16_t *out_status, char **out_message)
-{
-	http_version_t version;
-	uint16_t status;
-	char *message = NULL;
-
-	errno_t rc = expect(rb, "HTTP/");
-	if (rc != EOK)
-		return rc;
-
-	rc = receive_uint8_t(rb, &version.major);
-	if (rc != EOK)
-		return rc;
-
-	rc = expect(rb, ".");
-	if (rc != EOK)
-		return rc;
-
-	rc = receive_uint8_t(rb, &version.minor);
-	if (rc != EOK)
-		return rc;
-
-	rc = expect(rb, " ");
-	if (rc != EOK)
-		return rc;
-
-	rc = receive_uint16_t(rb, &status);
-	if (rc != EOK)
-		return rc;
-
-	rc = expect(rb, " ");
-	if (rc != EOK)
-		return rc;
-
-	receive_buffer_mark_t msg_start;
-	recv_mark(rb, &msg_start);
-
-	rc = recv_while(rb, is_not_newline);
-	if (rc != EOK) {
-		recv_unmark(rb, &msg_start);
-		return rc;
-	}
-
-	receive_buffer_mark_t msg_end;
-	recv_mark(rb, &msg_end);
-
-	if (out_message) {
-		rc = recv_cut_str(rb, &msg_start, &msg_end, &message);
-		if (rc != EOK) {
-			recv_unmark(rb, &msg_start);
-			recv_unmark(rb, &msg_end);
-			return rc;
-		}
-	}
-
-	recv_unmark(rb, &msg_start);
-	recv_unmark(rb, &msg_end);
-
-	size_t nrecv;
-	rc = recv_eol(rb, &nrecv);
-	if (rc == EOK && nrecv == 0)
-		rc = HTTP_EPARSE;
-	if (rc != EOK) {
-		free(message);
-		return rc;
-	}
-
-	if (out_version)
-		*out_version = version;
-	if (out_status)
-		*out_status = status;
-	if (out_message)
-		*out_message = message;
-	return EOK;
-}
-
-errno_t http_receive_response(receive_buffer_t *rb, http_response_t **out_response,
-    size_t max_headers_size, unsigned max_headers_count)
-{
-	http_response_t *resp = malloc(sizeof(http_response_t));
-	if (resp == NULL)
-		return ENOMEM;
-	memset(resp, 0, sizeof(http_response_t));
-	http_headers_init(&resp->headers);
-
-	errno_t rc = http_receive_status(rb, &resp->version, &resp->status,
-	    &resp->message);
-	if (rc != EOK)
-		goto error;
-
-	rc = http_headers_receive(rb, &resp->headers, max_headers_size,
-	    max_headers_count);
-	if (rc != EOK)
-		goto error;
-
-	size_t nrecv;
-	rc = recv_eol(rb, &nrecv);
-	if (rc == EOK && nrecv == 0)
-		rc = HTTP_EPARSE;
-	if (rc != EOK)
-		goto error;
-
-	*out_response = resp;
-
-	return EOK;
-error:
-	http_response_destroy(resp);
-	return rc;
-}
-
-void http_response_destroy(http_response_t *resp)
-{
-	free(resp->message);
-	http_headers_clear(&resp->headers);
-	free(resp);
-}
-
-/** @}
- */
Index: pace/lib/ieee80211/doc/doxygroups.h
===================================================================
--- uspace/lib/ieee80211/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libieee80211 libieee80211
- * @ingroup libs
- */
Index: pace/lib/ieee80211/include/ieee80211.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,208 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libieee80211
- * @{
- */
-/**
- * @file ieee80211.h
- * @brief Public header exposing IEEE 802.11 to drivers.
- */
-
-#ifndef LIB_IEEE80211_H
-#define LIB_IEEE80211_H
-
-#include <ddf/driver.h>
-#include <nic.h>
-#include <ops/ieee80211.h>
-
-#define DEVICE_CATEGORY_IEEE80211  "ieee80211"
-
-struct ieee80211_dev;
-typedef struct ieee80211_dev ieee80211_dev_t;
-
-/** Initial channel frequency. */
-#define IEEE80211_FIRST_FREQ  2412
-
-/** Max supported channel frequency. */
-#define IEEE80211_MAX_FREQ  2472
-
-/** Gap between IEEE80211 channels in MHz. */
-#define IEEE80211_CHANNEL_GAP  5
-
-/** Max AMPDU factor. */
-#define IEEE80211_MAX_AMPDU_FACTOR  13
-
-/** Max authentication password length. */
-#define IEEE80211_MAX_PASSW_LEN  64
-
-/** IEEE 802.11 b/g supported data rates in units of 500 kb/s. */
-static const uint8_t ieee80211bg_data_rates[] = {
-	2, 4, 11, 12, 18, 22, 24, 36, 48, 72, 96, 108
-};
-
-/** Device operating modes. */
-typedef enum {
-	IEEE80211_OPMODE_ADHOC,
-	IEEE80211_OPMODE_MESH,
-	IEEE80211_OPMODE_AP,
-	IEEE80211_OPMODE_STATION
-} ieee80211_operating_mode_t;
-
-/** Key flags. */
-typedef enum {
-	IEEE80211_KEY_FLAG_TYPE_PAIRWISE = 0x01,
-	IEEE80211_KEY_FLAG_TYPE_GROUP = 0x02
-} ieee80211_key_flags_t;
-
-typedef enum {
-	IEEE80211_TKIP_TX_MIC_OFFSET = 16,
-	IEEE80211_TKIP_RX_MIC_OFFSET = 24
-} ieee80211_tkip_mic_offset_t;
-
-/** Key config structure. */
-typedef struct {
-	uint8_t id;
-	uint8_t flags;
-	ieee80211_security_suite_t suite;
-	uint8_t data[32];
-} ieee80211_key_config_t;
-
-/** IEEE 802.11 callback functions. */
-typedef struct {
-	/** unction that is called at device initalization.
-	 *
-	 * This should get device into running state.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*start)(struct ieee80211_dev *);
-
-	/** Scan neighborhood for networks.
-	 *
-	 * There should be implemented scanning of whole bandwidth.
-	 * Incoming results are processed by IEEE 802.11 framework itself.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*scan)(struct ieee80211_dev *);
-
-	/** Handler for TX frames to be send from device.
-	 *
-	 * This should be called for every frame that has to be send
-	 * from IEEE 802.11 device.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 * @param buffer        Buffer with data to be send.
-	 * @param buffer_size   Size of buffer.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*tx_handler)(struct ieee80211_dev *, void *, size_t);
-
-	/** Set device operating frequency to given value.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 * @param freq          New device operating frequency.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*set_freq)(struct ieee80211_dev *, uint16_t);
-
-	/** Callback to inform device about BSSID change.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 * @param connected     True if connected to new BSSID, otherwise false.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*bssid_change)(struct ieee80211_dev *, bool);
-
-	/** Callback to setup encryption key in IEEE 802.11 device.
-	 *
-	 * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
-	 * @param key_conf      Key config structure.
-	 * @param insert        True to insert this key to device,
-	 *                      false to remove it.
-	 *
-	 * @return EOK if succeed, error code otherwise.
-	 *
-	 */
-	errno_t (*key_config)(struct ieee80211_dev *,
-	    ieee80211_key_config_t *key_conf, bool);
-} ieee80211_ops_t;
-
-/* Initialization functions. */
-extern ieee80211_dev_t *ieee80211_device_create(void);
-extern errno_t ieee80211_device_init(ieee80211_dev_t *, ddf_dev_t *);
-extern errno_t ieee80211_init(ieee80211_dev_t *, ieee80211_ops_t *,
-    ieee80211_iface_t *, nic_iface_t *, ddf_dev_ops_t *);
-
-/* Getters & setters, queries & reports. */
-extern void *ieee80211_get_specific(ieee80211_dev_t *);
-extern void ieee80211_set_specific(ieee80211_dev_t *, void *);
-extern ddf_dev_t *ieee80211_get_ddf_dev(ieee80211_dev_t *);
-extern ieee80211_operating_mode_t ieee80211_query_current_op_mode(
-    ieee80211_dev_t *);
-extern uint16_t ieee80211_query_current_freq(ieee80211_dev_t *);
-extern void ieee80211_query_bssid(ieee80211_dev_t *, nic_address_t *);
-extern bool ieee80211_is_connected(ieee80211_dev_t *);
-extern void ieee80211_report_current_op_mode(ieee80211_dev_t *,
-    ieee80211_operating_mode_t);
-extern void ieee80211_report_current_freq(ieee80211_dev_t *, uint16_t);
-extern uint16_t ieee80211_get_aid(ieee80211_dev_t *);
-extern int ieee80211_get_pairwise_security(ieee80211_dev_t *);
-extern bool ieee80211_is_ready(ieee80211_dev_t *);
-extern void ieee80211_set_ready(ieee80211_dev_t *, bool);
-extern bool ieee80211_query_using_key(ieee80211_dev_t *);
-extern void ieee80211_setup_key_confirm(ieee80211_dev_t *, bool);
-
-extern bool ieee80211_is_data_frame(uint16_t);
-extern bool ieee80211_is_mgmt_frame(uint16_t);
-extern bool ieee80211_is_beacon_frame(uint16_t);
-extern bool ieee80211_is_probe_response_frame(uint16_t);
-extern bool ieee80211_is_auth_frame(uint16_t);
-extern bool ieee80211_is_assoc_response_frame(uint16_t);
-
-/* Worker functions. */
-extern errno_t ieee80211_rx_handler(ieee80211_dev_t *, void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ieee80211/include/ieee80211_iface_impl.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_iface_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211_iface_impl.h
- *
- * IEEE 802.11 default interface functions definition.
- */
-
-#ifndef LIB_IEEE80211_IFACE_IMPL_H
-#define LIB_IEEE80211_IFACE_IMPL_H
-
-#include <ddf/driver.h>
-#include "ieee80211.h"
-
-extern errno_t ieee80211_get_scan_results_impl(ddf_fun_t *,
-    ieee80211_scan_results_t *, bool);
-extern errno_t ieee80211_connect_impl(ddf_fun_t *, char *, char *);
-extern errno_t ieee80211_disconnect_impl(ddf_fun_t *);
-
-#endif  /* LIB_IEEE80211_IFACE_IMPL_H */
-
-/** @}
- */
Index: pace/lib/ieee80211/include/ieee80211_impl.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211_impl.h
- *
- * IEEE 802.11 default device functions definition.
- */
-
-#ifndef LIB_IEEE80211_IMPL_H
-#define LIB_IEEE80211_IMPL_H
-
-#include "ieee80211_private.h"
-
-extern errno_t ieee80211_start_impl(ieee80211_dev_t *);
-extern errno_t ieee80211_tx_handler_impl(ieee80211_dev_t *, void *, size_t);
-extern errno_t ieee80211_set_freq_impl(ieee80211_dev_t *, uint16_t);
-extern errno_t ieee80211_bssid_change_impl(ieee80211_dev_t *, bool);
-extern errno_t ieee80211_key_config_impl(ieee80211_dev_t *,
-    ieee80211_key_config_t *, bool);
-extern errno_t ieee80211_scan_impl(ieee80211_dev_t *);
-extern errno_t ieee80211_prf(uint8_t *, uint8_t *, uint8_t *, size_t);
-extern errno_t ieee80211_rc4_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
-extern errno_t ieee80211_aes_key_unwrap(uint8_t *, uint8_t *, size_t, uint8_t *);
-extern errno_t ieee80211_michael_mic(uint8_t *, uint8_t *, size_t, uint8_t *);
-extern uint16_t uint16le_from_seq(void *);
-extern uint32_t uint32le_from_seq(void *);
-extern uint16_t uint16be_from_seq(void *);
-extern uint32_t uint32be_from_seq(void *);
-extern errno_t rnd_sequence(uint8_t *, size_t);
-extern uint8_t *min_sequence(uint8_t *, uint8_t *, size_t);
-extern uint8_t *max_sequence(uint8_t *, uint8_t *, size_t);
-
-#endif  /* LIB_IEEE80211_IMPL_H */
-
-/** @}
- */
Index: pace/lib/ieee80211/include/ieee80211_private.h
===================================================================
--- uspace/lib/ieee80211/include/ieee80211_private.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,416 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211.h
- *
- * Internal IEEE 802.11 header that should not be included.
- */
-
-#ifndef LIB_IEEE80211_PRIVATE_H
-#define LIB_IEEE80211_PRIVATE_H
-
-#include <fibril_synch.h>
-#include <byteorder.h>
-#include <ddf/driver.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <ieee80211/ieee80211.h>
-#include "ieee80211.h"
-
-/** Timeout in us for waiting to authentication/association response. */
-#define AUTH_TIMEOUT  200000
-
-/** Timeout in us for waiting to finish 4-way handshake process. */
-#define HANDSHAKE_TIMEOUT  5000000
-
-/** Scanning period. */
-#define SCAN_PERIOD_USEC  35000000
-
-/** Time to wait for beacons on channel. */
-#define SCAN_CHANNEL_WAIT_USEC  200000
-
-/** Max time to keep scan result. */
-#define MAX_KEEP_SCAN_SPAN_SEC  120
-
-/** Security bit in capability info field. */
-#define CAP_SECURITY  0x10
-
-/** Protocol type used in EAPOL frames. */
-#define ETH_TYPE_PAE  0x888e
-
-/** WPA OUI used in vendor specific IE. */
-#define WPA_OUI  0x0050f201
-
-/** GTK OUI used in vendor specific IE. */
-#define GTK_OUI  0x000fac01
-
-/** Max PTK key length. */
-#define MAX_PTK_LENGTH  64
-
-/** Max GTK key length. */
-#define MAX_GTK_LENGTH  64
-
-/** KEK offset inside PTK. */
-#define KEK_OFFSET  16
-
-/** TK offset inside PTK. */
-#define TK_OFFSET  32
-
-/** Length of Michael MIC code used in TKIP security suite. */
-#define MIC_LENGTH  8
-
-/** Length of data to be encrypted by PRF function.
- *
- * NONCE + SNONCE (2 * 32) + DEST_MAC + SOURCE_MAC (2 * ETH_ADDR)
- *
- */
-#define PRF_CRYPT_DATA_LENGTH  (2 * 32 + 2 * ETH_ADDR)
-
-/** Special room in header reserved for encryption. */
-#define IEEE80211_TKIP_HEADER_LENGTH 8
-#define IEEE80211_CCMP_HEADER_LENGTH 8
-/* Maximum of the above. */
-#define IEEE80211_MAX_HEADER_LENGTH 8
-
-/** IEEE 802.11 PTK key length. */
-#define IEEE80211_PTK_CCMP_LENGTH 48
-#define IEEE80211_PTK_TKIP_LENGTH 64
-
-/** IEEE 802.11 GTK key length. */
-#define IEEE80211_GTK_CCMP_LENGTH 16
-#define IEEE80211_GTK_TKIP_LENGTH 32
-
-/** IEEE 802.11 frame types. */
-typedef enum {
-	IEEE80211_MGMT_FRAME = 0x0,
-	IEEE80211_CTRL_FRAME = 0x4,
-	IEEE80211_DATA_FRAME = 0x8,
-	IEEE80211_EXT_FRAME = 0xC
-} ieee80211_frame_type_t;
-
-/** IEEE 802.11 management frame subtypes. */
-typedef enum {
-	IEEE80211_MGMT_ASSOC_REQ_FRAME = 0x00,
-	IEEE80211_MGMT_ASSOC_RESP_FRAME = 0x10,
-	IEEE80211_MGMT_REASSOC_REQ_FRAME = 0x20,
-	IEEE80211_MGMT_REASSOC_RESP_FRAME = 0x30,
-	IEEE80211_MGMT_PROBE_REQ_FRAME = 0x40,
-	IEEE80211_MGMT_PROBE_RESP_FRAME = 0x50,
-	IEEE80211_MGMT_BEACON_FRAME = 0x80,
-	IEEE80211_MGMT_DISASSOC_FRAME = 0xA0,
-	IEEE80211_MGMT_AUTH_FRAME = 0xB0,
-	IEEE80211_MGMT_DEAUTH_FRAME = 0xC0,
-} ieee80211_frame_mgmt_subtype_t;
-
-/** IEEE 802.11 data frame subtypes. */
-typedef enum {
-	IEEE80211_DATA_DATA_FRAME = 0x0000,
-	IEEE80211_DATA_QOS_FRAME = 0x0080
-} ieee80211_frame_data_subtype_t;
-
-/** IEEE 802.11 frame control value masks. */
-typedef enum {
-	IEEE80211_FRAME_CTRL_FRAME_TYPE = 0x000C,
-	IEEE80211_FRAME_CTRL_FRAME_SUBTYPE = 0x00F0,
-	IEEE80211_FRAME_CTRL_PROTECTED = 0x4000
-} ieee80211_frame_ctrl_mask_t;
-
-/** IEEE 802.11 frame control DS field values. */
-typedef enum {
-	IEEE80211_FRAME_CTRL_TODS = 0x0100,
-	IEEE80211_FRAME_CTRL_FROMDS = 0x0200
-} ieee80211_frame_ctrl_ds_t;
-
-/** IEEE 802.11 authentication cipher suites values. */
-typedef enum {
-	IEEE80211_AUTH_CIPHER_TKIP = 0x02,
-	IEEE80211_AUTH_CIPHER_CCMP = 0x04
-} ieee80211_auth_cipher_type_t;
-
-/** IEEE 802.11 AKM suites values. */
-typedef enum {
-	IEEE80211_AUTH_AKM_8021X = 0x01,
-	IEEE80211_AUTH_AKM_PSK = 0x02
-} ieee80211_auth_akm_type_t;
-
-typedef enum {
-	IEEE80211_EAPOL_START = 0x1,
-	IEEE80211_EAPOL_KEY = 0x3
-} ieee80211_eapol_frame_type_t;
-
-typedef enum {
-	IEEE80211_EAPOL_KEY_KEYINFO_KEYTYPE = 0x0008,
-	IEEE80211_EAPOL_KEY_KEYINFO_KEYID = 0x0010,
-	IEEE80211_EAPOL_KEY_KEYINFO_INSTALL = 0x0040,
-	IEEE80211_EAPOL_KEY_KEYINFO_ACK = 0x0080,
-	IEEE80211_EAPOL_KEY_KEYINFO_MIC = 0x0100,
-	IEEE80211_EAPOL_KEY_KEYINFO_SECURE = 0x0200,
-	IEEE80211_EAPOL_KEY_KEYINFO_ENCDATA = 0x1000
-} ieee80211_eapol_key_keyinfo_t;
-
-/** IEEE 802.11 information element types. */
-typedef enum {
-	IEEE80211_SSID_IE = 0,        /**< Target SSID. */
-	IEEE80211_RATES_IE = 1,       /**< Supported data rates. */
-	IEEE80211_CHANNEL_IE = 3,     /**< Current channel number. */
-	IEEE80211_CHALLENGE_IE = 16,  /**< Challenge text. */
-	IEEE80211_RSN_IE = 48,        /**< RSN. */
-	IEEE80211_EXT_RATES_IE = 50,  /**< Extended data rates. */
-	IEEE80211_VENDOR_IE = 221     /**< Vendor specific IE. */
-} ieee80211_ie_type_t;
-
-/** IEEE 802.11 authentication phases. */
-typedef enum {
-	IEEE80211_AUTH_DISCONNECTED,
-	IEEE80211_AUTH_AUTHENTICATED,
-	IEEE80211_AUTH_ASSOCIATED,
-	IEEE80211_AUTH_CONNECTED
-} ieee80211_auth_phase_t;
-
-/** Link with scan result info. */
-typedef struct {
-	link_t link;
-	time_t last_beacon;
-	ieee80211_scan_result_t scan_result;
-	uint8_t auth_ie[256];
-	size_t auth_ie_len;
-} ieee80211_scan_result_link_t;
-
-/** List of scan results info. */
-typedef struct {
-	list_t list;
-	fibril_mutex_t results_mutex;
-	size_t size;
-} ieee80211_scan_result_list_t;
-
-/** BSSID info. */
-typedef struct {
-	uint16_t aid;
-	char password[IEEE80211_MAX_PASSW_LEN];
-	uint8_t ptk[MAX_PTK_LENGTH];
-	uint8_t gtk[MAX_GTK_LENGTH];
-	ieee80211_scan_result_link_t *res_link;
-} ieee80211_bssid_info_t;
-
-/** IEEE 802.11 WiFi device structure. */
-struct ieee80211_dev {
-	/** Backing DDF device. */
-	ddf_dev_t *ddf_dev;
-
-	/** Pointer to implemented IEEE 802.11 device operations. */
-	ieee80211_ops_t *ops;
-
-	/** Pointer to implemented IEEE 802.11 interface operations. */
-	ieee80211_iface_t *iface;
-
-	/** Pointer to driver specific data. */
-	void *specific;
-
-	/** Current operating frequency. */
-	uint16_t current_freq;
-
-	/** Current operating mode. */
-	ieee80211_operating_mode_t current_op_mode;
-
-	/** Info about BSSID we are connected to. */
-	ieee80211_bssid_info_t bssid_info;
-
-	/**
-	 * Flag indicating that data traffic is encrypted by HW key
-	 * that is set up in device.
-	 */
-	bool using_hw_key;
-
-	/** BSSIDs we listen to. */
-	nic_address_t bssid_mask;
-
-	/** List of APs in neighborhood. */
-	ieee80211_scan_result_list_t ap_list;
-
-	/** Current sequence number used in data frames. */
-	uint16_t sequence_number;
-
-	/** Current authentication phase. */
-	ieee80211_auth_phase_t current_auth_phase;
-
-	/** Flag indicating whether client wants connect to network. */
-	bool pending_conn_req;
-
-	/** Scanning guard. */
-	fibril_mutex_t scan_mutex;
-
-	/** General purpose guard. */
-	fibril_mutex_t gen_mutex;
-
-	/** General purpose condition variable. */
-	fibril_condvar_t gen_cond;
-
-	/** Indicates whether device is fully initialized. */
-	bool ready;
-
-	/** Indicates whether driver has already started. */
-	bool started;
-};
-
-/** IEEE 802.3 (ethernet) header. */
-typedef struct {
-	uint8_t dest_addr[ETH_ADDR];
-	uint8_t src_addr[ETH_ADDR];
-	uint16_t proto;  /**< Big Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    eth_header_t;
-
-/** IEEE 802.11 management header structure. */
-typedef struct {
-	uint16_t frame_ctrl;          /**< Little Endian value! */
-	uint16_t duration_id;         /**< Little Endian value! */
-	uint8_t dest_addr[ETH_ADDR];
-	uint8_t src_addr[ETH_ADDR];
-	uint8_t bssid[ETH_ADDR];
-	uint16_t seq_ctrl;            /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_mgmt_header_t;
-
-/** IEEE 802.11 data header structure. */
-typedef struct {
-	uint16_t frame_ctrl;         /**< Little Endian value! */
-	uint16_t duration_id;        /**< Little Endian value! */
-	uint8_t address1[ETH_ADDR];
-	uint8_t address2[ETH_ADDR];
-	uint8_t address3[ETH_ADDR];
-	uint16_t seq_ctrl;           /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_data_header_t;
-
-/** IEEE 802.11 information element header. */
-typedef struct {
-	uint8_t element_id;
-	uint8_t length;
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_ie_header_t;
-
-/** IEEE 802.11 authentication frame body. */
-typedef struct {
-	uint16_t auth_alg;       /**< Little Endian value! */
-	uint16_t auth_trans_no;  /**< Little Endian value! */
-	uint16_t status;         /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_auth_body_t;
-
-/** IEEE 802.11 deauthentication frame body. */
-typedef struct {
-	uint16_t reason;    /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_deauth_body_t;
-
-/** IEEE 802.11 association request frame body. */
-typedef struct {
-	uint16_t capability;       /**< Little Endian value! */
-	uint16_t listen_interval;  /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_assoc_req_body_t;
-
-/** IEEE 802.11 association response frame body. */
-typedef struct {
-	uint16_t capability;  /**< Little Endian value! */
-	uint16_t status;      /**< Little Endian value! */
-	uint16_t aid;         /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_assoc_resp_body_t;
-
-/** IEEE 802.11 beacon frame body start. */
-typedef struct {
-	uint8_t timestamp[8];
-	uint16_t beacon_interval;  /**< Little Endian value! */
-	uint16_t capability;       /**< Little Endian value! */
-} __attribute__((packed)) __attribute__((aligned(2)))
-    ieee80211_beacon_start_t;
-
-/** IEEE 802.11i EAPOL-Key frame format. */
-typedef struct {
-	uint8_t proto_version;
-	uint8_t packet_type;
-	uint16_t body_length;      /**< Big Endian value! */
-	uint8_t descriptor_type;
-	uint16_t key_info;         /**< Big Endian value! */
-	uint16_t key_length;       /**< Big Endian value! */
-	uint8_t key_replay_counter[8];
-	uint8_t key_nonce[32];
-	uint8_t eapol_key_iv[16];
-	uint8_t key_rsc[8];
-	uint8_t reserved[8];
-	uint8_t key_mic[16];
-	uint16_t key_data_length;  /**< Big Endian value! */
-} __attribute__((packed)) ieee80211_eapol_key_frame_t;
-
-#define ieee80211_scan_result_list_foreach(results, iter) \
-	list_foreach((results).list, link, ieee80211_scan_result_link_t, (iter))
-
-static inline void
-ieee80211_scan_result_list_init(ieee80211_scan_result_list_t *results)
-{
-	list_initialize(&results->list);
-	fibril_mutex_initialize(&results->results_mutex);
-}
-
-static inline void
-ieee80211_scan_result_list_remove(ieee80211_scan_result_list_t *results,
-    ieee80211_scan_result_link_t *result)
-{
-	list_remove(&result->link);
-	results->size--;
-}
-
-static inline void
-ieee80211_scan_result_list_append(ieee80211_scan_result_list_t *results,
-    ieee80211_scan_result_link_t *result)
-{
-	list_append(&result->link, &results->list);
-	results->size++;
-}
-
-extern bool ieee80211_is_fromds_frame(uint16_t);
-extern bool ieee80211_is_tods_frame(uint16_t);
-extern void ieee80211_set_connect_request(ieee80211_dev_t *);
-extern bool ieee80211_pending_connect_request(ieee80211_dev_t *);
-extern ieee80211_auth_phase_t ieee80211_get_auth_phase(ieee80211_dev_t *);
-extern void ieee80211_set_auth_phase(ieee80211_dev_t *, ieee80211_auth_phase_t);
-extern errno_t ieee80211_probe_request(ieee80211_dev_t *, char *);
-extern errno_t ieee80211_authenticate(ieee80211_dev_t *);
-extern errno_t ieee80211_associate(ieee80211_dev_t *, char *);
-extern errno_t ieee80211_deauthenticate(ieee80211_dev_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ieee80211/meson.build
===================================================================
--- uspace/lib/ieee80211/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2015 Jan Kolarik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' , 'nic' , 'crypto' ]
-src = files(
-	'src/ieee80211.c',
-	'src/ieee80211_impl.c',
-	'src/ieee80211_iface_impl.c',
-)
Index: pace/lib/ieee80211/src/ieee80211.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1729 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211.c
- *
- * IEEE 802.11 interface implementation.
- */
-
-#include <stdio.h>
-#include <crypto.h>
-#include <str.h>
-#include <macros.h>
-#include <errno.h>
-#include <ieee80211.h>
-#include <ieee80211_impl.h>
-#include <ieee80211_iface_impl.h>
-#include <ieee80211_private.h>
-#include <ops/ieee80211.h>
-
-#define IEEE80211_DATA_RATES_SIZE      8
-#define IEEE80211_EXT_DATA_RATES_SIZE  4
-
-#define ATOMIC_GET(state)
-
-/** Frame encapsulation used in IEEE 802.11. */
-static const uint8_t rfc1042_header[] = {
-	0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
-};
-
-/** Broadcast MAC address. */
-static const uint8_t ieee80211_broadcast_mac_addr[] = {
-	0xff, 0xff, 0xff, 0xff, 0xff, 0xff
-};
-
-/** Check data frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is data frame, otherwise false.
- *
- */
-inline bool ieee80211_is_data_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_TYPE) ==
-	    IEEE80211_DATA_FRAME;
-}
-
-/** Check management frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is management frame, otherwise false.
- *
- */
-inline bool ieee80211_is_mgmt_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_TYPE) ==
-	    IEEE80211_MGMT_FRAME;
-}
-
-/** Check management beacon frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is beacon frame, otherwise false.
- *
- */
-inline bool ieee80211_is_beacon_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_SUBTYPE) ==
-	    IEEE80211_MGMT_BEACON_FRAME;
-}
-
-/** Check management probe response frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is probe resp frame, otherwise false.
- *
- */
-inline bool ieee80211_is_probe_response_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_SUBTYPE) ==
-	    IEEE80211_MGMT_PROBE_RESP_FRAME;
-}
-
-/** Check management authentication frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is auth frame, otherwise false.
- *
- */
-inline bool ieee80211_is_auth_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_SUBTYPE) ==
-	    IEEE80211_MGMT_AUTH_FRAME;
-}
-
-/** Check management association response frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is assoc resp frame, otherwise false.
- *
- */
-inline bool ieee80211_is_assoc_response_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FRAME_SUBTYPE) ==
-	    IEEE80211_MGMT_ASSOC_RESP_FRAME;
-}
-
-/** Check data frame "to distribution system" direction.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is TODS frame, otherwise false.
- *
- */
-inline bool ieee80211_is_tods_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_TODS);
-}
-
-/** Check data frame "from distribution system" direction.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it is FROMDS frame, otherwise false.
- *
- */
-inline bool ieee80211_is_fromds_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_FROMDS);
-}
-
-/** Check if it is data frame containing payload data.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if it has payload data, otherwise false.
- *
- */
-static inline bool ieee80211_has_data_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & (IEEE80211_FRAME_CTRL_FRAME_TYPE | 0x40)) ==
-	    IEEE80211_DATA_FRAME;
-}
-
-/** Check if it is encrypted frame.
- *
- * @param frame_ctrl Frame control field in little endian (!).
- *
- * @return True if the frame is encrypted, otherwise false.
- *
- */
-static inline bool ieee80211_is_encrypted_frame(uint16_t frame_ctrl)
-{
-	frame_ctrl = uint16_t_le2host(frame_ctrl);
-
-	return (frame_ctrl & IEEE80211_FRAME_CTRL_PROTECTED);
-}
-
-/** Check if PAE packet is EAPOL-Key frame.
- *
- * @param key_frame Pointer to start of EAPOL frame.
- *
- * @return True if it is EAPOL-Key frame, otherwise false.
- *
- */
-static inline bool
-ieee80211_is_eapol_key_frame(ieee80211_eapol_key_frame_t *key_frame)
-{
-	return (key_frame->packet_type == IEEE80211_EAPOL_KEY);
-}
-
-/** Generate packet sequence number.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return True if it has payload data, otherwise false.
- *
- */
-static uint16_t ieee80211_get_sequence_number(ieee80211_dev_t *ieee80211_dev)
-{
-	uint16_t ret_val = ieee80211_dev->sequence_number;
-	ieee80211_dev->sequence_number += (1 << 4);
-
-	return ret_val;
-}
-
-/** Get driver-specific structure for IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return Driver-specific structure.
- *
- */
-void *ieee80211_get_specific(ieee80211_dev_t *ieee80211_dev)
-{
-	return ieee80211_dev->specific;
-}
-
-/** Set driver-specific structure for IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- * @param specific      Driver-specific structure.
- *
- */
-void ieee80211_set_specific(ieee80211_dev_t *ieee80211_dev,
-    void *specific)
-{
-	ieee80211_dev->specific = specific;
-}
-
-/** Get related DDF device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return DDF device.
- *
- */
-ddf_dev_t *ieee80211_get_ddf_dev(ieee80211_dev_t *ieee80211_dev)
-{
-	return ieee80211_dev->ddf_dev;
-}
-
-/** Query current operating mode of IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return Current IEEE 802.11 operating mode.
- *
- */
-ieee80211_operating_mode_t
-ieee80211_query_current_op_mode(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_operating_mode_t op_mode = ieee80211_dev->current_op_mode;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return op_mode;
-}
-
-/** Query current frequency of IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return Current device operating frequency.
- *
- */
-uint16_t ieee80211_query_current_freq(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	uint16_t current_freq = ieee80211_dev->current_freq;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return current_freq;
-}
-
-/** Query BSSID the device is connected to.
- *
- * Note: Expecting locked results_mutex.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- * @param bssid         Pointer to structure where should be stored BSSID.
- *
- */
-void ieee80211_query_bssid(ieee80211_dev_t *ieee80211_dev,
-    nic_address_t *bssid)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-
-	if (bssid) {
-		ieee80211_scan_result_link_t *res_link =
-		    ieee80211_dev->bssid_info.res_link;
-
-		if (res_link) {
-			memcpy(bssid, &res_link->scan_result.bssid,
-			    sizeof(nic_address_t));
-		} else {
-			nic_address_t broadcast_addr;
-			memcpy(broadcast_addr.address,
-			    ieee80211_broadcast_mac_addr, ETH_ADDR);
-			memcpy(bssid, &broadcast_addr, sizeof(nic_address_t));
-		}
-	}
-
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-/** Get AID of network we are connected to.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return AID.
- *
- */
-uint16_t ieee80211_get_aid(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	uint16_t aid = ieee80211_dev->bssid_info.aid;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return aid;
-}
-
-/** Get pairwise security suite used for HW encryption.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return Security suite indicator.
- *
- */
-int ieee80211_get_pairwise_security(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_scan_result_link_t *auth_link =
-	    ieee80211_dev->bssid_info.res_link;
-	int suite = auth_link->scan_result.security.pair_alg;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return suite;
-}
-
-/** Check if IEEE 802.11 device is connected to network.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return True if device is connected to network, otherwise false.
- *
- */
-bool ieee80211_is_connected(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	bool conn_state =
-	    ieee80211_dev->current_auth_phase == IEEE80211_AUTH_CONNECTED;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return conn_state;
-}
-
-void ieee80211_set_auth_phase(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_auth_phase_t auth_phase)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->current_auth_phase = auth_phase;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-ieee80211_auth_phase_t ieee80211_get_auth_phase(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_auth_phase_t conn_state = ieee80211_dev->current_auth_phase;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return conn_state;
-}
-
-void ieee80211_set_connect_request(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->pending_conn_req = true;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-bool ieee80211_pending_connect_request(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	bool conn_request = ieee80211_dev->pending_conn_req;
-	ieee80211_dev->pending_conn_req = false;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return conn_request;
-}
-
-/** Report current operating mode for IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- * @param op_mode       Current IEEE 802.11 operating mode.
- *
- */
-void ieee80211_report_current_op_mode(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_operating_mode_t op_mode)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->current_op_mode = op_mode;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-/** Report current frequency for IEEE 802.11 device.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- * @param freq          Current device operating frequency.
- *
- */
-void ieee80211_report_current_freq(ieee80211_dev_t *ieee80211_dev,
-    uint16_t freq)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->current_freq = freq;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-/** Check if IEEE 802.11 device is ready (fully initialized).
- *
- * @param ieee80211_dev IEEE 802.11 device.
- *
- * @return True if device is ready to work, otherwise false.
- *
- */
-bool ieee80211_is_ready(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	bool ready_state = ieee80211_dev->ready;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return ready_state;
-}
-
-/** Set IEEE 802.11 device to ready state.
- *
- * @param ieee80211_dev IEEE 802.11 device.
- * @param ready         Ready state to be set.
- *
- */
-void ieee80211_set_ready(ieee80211_dev_t *ieee80211_dev, bool ready)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->ready = ready;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-bool ieee80211_query_using_key(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	bool using_key = ieee80211_dev->using_hw_key;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return using_key;
-}
-
-void ieee80211_setup_key_confirm(ieee80211_dev_t *ieee80211_dev,
-    bool using_key)
-{
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	ieee80211_dev->using_hw_key = using_key;
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-}
-
-static errno_t ieee80211_scan(void *arg)
-{
-	assert(arg);
-
-	ieee80211_dev_t *ieee80211_dev = (ieee80211_dev_t *) arg;
-
-	while (true) {
-		ieee80211_dev->ops->scan(ieee80211_dev);
-		fibril_usleep(SCAN_PERIOD_USEC);
-	}
-
-	return EOK;
-}
-
-/** Implementation of NIC open callback for IEEE 802.11 devices.
- *
- * @param fun NIC function.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_open(ddf_fun_t *fun)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	ieee80211_dev_t *ieee80211_dev = nic_get_specific(nic_data);
-
-	if (ieee80211_dev->started)
-		return EOK;
-
-	ieee80211_dev->started = true;
-
-	errno_t rc = ieee80211_dev->ops->start(ieee80211_dev);
-	if (rc != EOK)
-		return rc;
-
-	/* Add scanning fibril. */
-	fid_t fibril = fibril_create(ieee80211_scan, ieee80211_dev);
-	if (fibril == 0)
-		return ENOMEM;
-
-	fibril_add_ready(fibril);
-
-	return EOK;
-}
-
-/** Send frame handler.
- *
- * @param nic  Pointer to NIC device.
- * @param data Data buffer.
- * @param size Data buffer size.
- *
- */
-static void ieee80211_send_frame(nic_t *nic, void *data, size_t size)
-{
-	ieee80211_dev_t *ieee80211_dev = (ieee80211_dev_t *)
-	    nic_get_specific(nic);
-
-	ieee80211_auth_phase_t auth_phase =
-	    ieee80211_get_auth_phase(ieee80211_dev);
-	if ((auth_phase != IEEE80211_AUTH_ASSOCIATED) &&
-	    (auth_phase != IEEE80211_AUTH_CONNECTED))
-		return;
-
-	ieee80211_scan_result_t *auth_data =
-	    &ieee80211_dev->bssid_info.res_link->scan_result;
-
-	/* We drop part of IEEE 802.3 ethernet header. */
-	size_t drop_bytes = sizeof(eth_header_t) - 2;
-
-	size_t complete_size = (size - drop_bytes) +
-	    sizeof(ieee80211_data_header_t) +
-	    ARRAY_SIZE(rfc1042_header);
-
-	/* Init crypto data. */
-	bool add_mic = false;
-	size_t head_space = 0, mic_space = 0;
-	uint16_t crypto = 0;
-	uint8_t head_data[IEEE80211_MAX_HEADER_LENGTH];
-	memset(head_data, 0, IEEE80211_MAX_HEADER_LENGTH);
-
-	// TODO: Distinguish used key (pair/group) by dest address ?
-	if (ieee80211_query_using_key(ieee80211_dev)) {
-		int sec_suite = auth_data->security.pair_alg;
-		switch (sec_suite) {
-		case IEEE80211_SECURITY_SUITE_TKIP:
-			head_space = IEEE80211_TKIP_HEADER_LENGTH;
-			mic_space = MIC_LENGTH;
-			add_mic = true;
-			break;
-		case IEEE80211_SECURITY_SUITE_CCMP:
-			head_space = IEEE80211_CCMP_HEADER_LENGTH;
-			head_data[3] = 0x20;
-			break;
-		default:
-			break;
-		}
-
-		crypto = uint16_t_le2host(IEEE80211_FRAME_CTRL_PROTECTED);
-	}
-
-	complete_size += head_space + mic_space;
-
-	void *complete_buffer = malloc(complete_size);
-	if (!complete_buffer)
-		return;
-
-	memset(complete_buffer, 0, complete_size);
-
-	if (head_space)
-		memcpy(complete_buffer + sizeof(ieee80211_data_header_t),
-		    head_data, head_space);
-
-	memcpy(complete_buffer + sizeof(ieee80211_data_header_t) + head_space,
-	    rfc1042_header, ARRAY_SIZE(rfc1042_header));
-
-	memcpy(complete_buffer + sizeof(ieee80211_data_header_t) +
-	    ARRAY_SIZE(rfc1042_header) + head_space,
-	    data + drop_bytes, size - drop_bytes);
-
-	ieee80211_data_header_t *data_header =
-	    (ieee80211_data_header_t *) complete_buffer;
-	data_header->frame_ctrl =
-	    uint16_t_le2host(IEEE80211_DATA_FRAME) |
-	    uint16_t_le2host(IEEE80211_DATA_DATA_FRAME) |
-	    uint16_t_le2host(IEEE80211_FRAME_CTRL_TODS) |
-	    crypto;
-	data_header->seq_ctrl = ieee80211_get_sequence_number(ieee80211_dev);
-
-	/* BSSID, SA, DA. */
-	memcpy(data_header->address1, auth_data->bssid.address, ETH_ADDR);
-	memcpy(data_header->address2, data + ETH_ADDR, ETH_ADDR);
-	memcpy(data_header->address3, data, ETH_ADDR);
-
-	if (add_mic) {
-		size_t size_wo_mic = complete_size - MIC_LENGTH;
-		uint8_t *tx_mic = ieee80211_dev->bssid_info.ptk +
-		    TK_OFFSET + IEEE80211_TKIP_TX_MIC_OFFSET;
-		ieee80211_michael_mic(tx_mic, complete_buffer, size_wo_mic,
-		    complete_buffer + size_wo_mic);
-	}
-
-	ieee80211_dev->ops->tx_handler(ieee80211_dev,
-	    complete_buffer, complete_size);
-
-	free(complete_buffer);
-}
-
-/** Fill out IEEE 802.11 device functions implementations.
- *
- * @param ieee80211_dev   IEEE 802.11 device.
- * @param ieee80211_ops   Callbacks implementation.
- * @param ieee80211_iface Interface functions implementation.
- * @param nic_iface       NIC interface functions implementation.
- * @param nic_dev_ops     NIC device functions implementation.
- *
- * @return EINVAL when missing pointer to ieee80211_ops
- *         or ieee80211_iface, otherwise EOK.
- *
- */
-static errno_t ieee80211_implement(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_ops_t *ieee80211_ops, ieee80211_iface_t *ieee80211_iface,
-    nic_iface_t *nic_iface, ddf_dev_ops_t *nic_dev_ops)
-{
-	if (ieee80211_ops) {
-		if (!ieee80211_ops->start)
-			ieee80211_ops->start = ieee80211_start_impl;
-
-		if (!ieee80211_ops->tx_handler)
-			ieee80211_ops->tx_handler = ieee80211_tx_handler_impl;
-
-		if (!ieee80211_ops->set_freq)
-			ieee80211_ops->set_freq = ieee80211_set_freq_impl;
-
-		if (!ieee80211_ops->bssid_change)
-			ieee80211_ops->bssid_change = ieee80211_bssid_change_impl;
-
-		if (!ieee80211_ops->key_config)
-			ieee80211_ops->key_config = ieee80211_key_config_impl;
-
-		if (!ieee80211_ops->scan)
-			ieee80211_ops->scan = ieee80211_scan_impl;
-	} else
-		return EINVAL;
-
-	ieee80211_dev->ops = ieee80211_ops;
-
-	if (ieee80211_iface) {
-		if (nic_dev_ops)
-			if (!nic_dev_ops->interfaces[IEEE80211_DEV_IFACE])
-				nic_dev_ops->interfaces[IEEE80211_DEV_IFACE] =
-				    ieee80211_iface;
-
-		if (!ieee80211_iface->get_scan_results)
-			ieee80211_iface->get_scan_results =
-			    ieee80211_get_scan_results_impl;
-
-		if (!ieee80211_iface->connect)
-			ieee80211_iface->connect = ieee80211_connect_impl;
-
-		if (!ieee80211_iface->disconnect)
-			ieee80211_iface->disconnect = ieee80211_disconnect_impl;
-	} else
-		return EINVAL;
-
-	if (nic_dev_ops) {
-		if (!nic_dev_ops->open)
-			nic_dev_ops->open = ieee80211_open;
-	} else
-		return EINVAL;
-
-	ieee80211_dev->iface = ieee80211_iface;
-
-	nic_driver_implement(NULL, nic_dev_ops, nic_iface);
-
-	return EOK;
-}
-
-/** Allocate IEEE802.11 device structure.
- *
- * @return Pointer to allocated IEEE802.11 device structure.
- *
- */
-ieee80211_dev_t *ieee80211_device_create(void)
-{
-	return calloc(1, sizeof(ieee80211_dev_t));
-}
-
-/** Initialize an IEEE802.11 framework structure.
- *
- * @param ieee80211_dev Device structure to initialize.
- * @param ddf_dev       Pointer to backing DDF device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_device_init(ieee80211_dev_t *ieee80211_dev, ddf_dev_t *ddf_dev)
-{
-	ieee80211_dev->ddf_dev = ddf_dev;
-	ieee80211_dev->started = false;
-	ieee80211_dev->ready = false;
-	ieee80211_dev->using_hw_key = false;
-	ieee80211_dev->pending_conn_req = false;
-	ieee80211_dev->current_op_mode = IEEE80211_OPMODE_STATION;
-	ieee80211_dev->current_auth_phase = IEEE80211_AUTH_DISCONNECTED;
-
-	memcpy(ieee80211_dev->bssid_mask.address, ieee80211_broadcast_mac_addr,
-	    ETH_ADDR);
-
-	ieee80211_scan_result_list_init(&ieee80211_dev->ap_list);
-
-	fibril_mutex_initialize(&ieee80211_dev->scan_mutex);
-	fibril_mutex_initialize(&ieee80211_dev->gen_mutex);
-	fibril_condvar_initialize(&ieee80211_dev->gen_cond);
-
-	/* Bind NIC to device */
-	nic_t *nic = nic_create_and_bind(ddf_dev);
-	if (!nic)
-		return ENOMEM;
-
-	nic_set_specific(nic, ieee80211_dev);
-
-	return EOK;
-}
-
-/** IEEE802.11 WiFi framework initialization.
- *
- * @param ieee80211_dev   Device structure to initialize.
- * @param ieee80211_ops   Structure with implemented IEEE802.11
- *                        device operations.
- * @param ieee80211_iface Structure with implemented IEEE802.11
- *                        interface operations.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_init(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_ops_t *ieee80211_ops, ieee80211_iface_t *ieee80211_iface,
-    nic_iface_t *ieee80211_nic_iface, ddf_dev_ops_t *ieee80211_nic_dev_ops)
-{
-	errno_t rc = ieee80211_implement(ieee80211_dev,
-	    ieee80211_ops, ieee80211_iface,
-	    ieee80211_nic_iface, ieee80211_nic_dev_ops);
-	if (rc != EOK)
-		return rc;
-
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-
-	/* TODO: Set NIC handlers here. */
-	nic_set_send_frame_handler(nic, ieee80211_send_frame);
-
-	ddf_fun_t *fun = ddf_fun_create(ieee80211_dev->ddf_dev, fun_exposed,
-	    "port0");
-	if (fun == NULL)
-		return EINVAL;
-
-	nic_set_ddf_fun(nic, fun);
-	ddf_fun_set_ops(fun, ieee80211_nic_dev_ops);
-
-	rc = ddf_fun_bind(fun);
-	if (rc != EOK) {
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_NIC);
-	if (rc != EOK) {
-		ddf_fun_unbind(fun);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	rc = ddf_fun_add_to_category(fun, DEVICE_CATEGORY_IEEE80211);
-	if (rc != EOK) {
-		ddf_fun_unbind(fun);
-		ddf_fun_destroy(fun);
-		return rc;
-	}
-
-	return EOK;
-}
-
-/** Convert frequency value to channel number.
- *
- * @param freq IEEE 802.11 operating frequency.
- *
- * @return Operating channel number.
- *
- */
-static uint8_t ieee80211_freq_to_channel(uint16_t freq)
-{
-	return (freq - IEEE80211_FIRST_FREQ) / IEEE80211_CHANNEL_GAP + 1;
-}
-
-static void ieee80211_prepare_ie_header(void **ie_header,
-    uint8_t id, uint8_t length, void *data)
-{
-	ieee80211_ie_header_t *header =
-	    (ieee80211_ie_header_t *) *ie_header;
-
-	header->element_id = id;
-	header->length = length;
-
-	memcpy(*ie_header + sizeof(ieee80211_ie_header_t), data, length);
-
-	*ie_header = (void *) ((void *) header +
-	    sizeof(ieee80211_ie_header_t) + length);
-}
-
-/** Probe request implementation.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param ssid          Probing SSID or NULL if broadcast.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_probe_request(ieee80211_dev_t *ieee80211_dev, char *ssid)
-{
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-	nic_address_t nic_address;
-	nic_query_address(nic, &nic_address);
-
-	size_t ssid_data_size = (ssid != NULL) ? str_size(ssid) : 0;
-	size_t channel_data_size = 1;
-
-	uint8_t channel =
-	    ieee80211_freq_to_channel(ieee80211_dev->current_freq);
-
-	/*
-	 * 4 headers - (ssid, rates, ext rates, current channel)
-	 * and their data lengths.
-	 */
-	size_t payload_size =
-	    sizeof(ieee80211_ie_header_t) * 4 +
-	    ssid_data_size +
-	    IEEE80211_DATA_RATES_SIZE + IEEE80211_EXT_DATA_RATES_SIZE +
-	    channel_data_size;
-
-	size_t buffer_size = sizeof(ieee80211_mgmt_header_t) + payload_size;
-	void *buffer = malloc(buffer_size);
-	if (!buffer)
-		return ENOMEM;
-
-	memset(buffer, 0, buffer_size);
-
-	ieee80211_mgmt_header_t *mgmt_header =
-	    (ieee80211_mgmt_header_t *) buffer;
-
-	mgmt_header->frame_ctrl =
-	    host2uint16_t_le(IEEE80211_MGMT_FRAME |
-	    IEEE80211_MGMT_PROBE_REQ_FRAME);
-	memcpy(mgmt_header->dest_addr, ieee80211_broadcast_mac_addr, ETH_ADDR);
-	memcpy(mgmt_header->src_addr, nic_address.address, ETH_ADDR);
-	memcpy(mgmt_header->bssid, ieee80211_broadcast_mac_addr, ETH_ADDR);
-	mgmt_header->seq_ctrl =
-	    host2uint16_t_le(ieee80211_get_sequence_number(ieee80211_dev));
-
-	/* Jump to payload. */
-	void *it = (void *) buffer + sizeof(ieee80211_mgmt_header_t);
-	ieee80211_prepare_ie_header(&it, IEEE80211_SSID_IE, ssid_data_size,
-	    (void *) ssid);
-	ieee80211_prepare_ie_header(&it, IEEE80211_RATES_IE,
-	    IEEE80211_DATA_RATES_SIZE, (void *) &ieee80211bg_data_rates);
-	ieee80211_prepare_ie_header(&it, IEEE80211_EXT_RATES_IE,
-	    IEEE80211_EXT_DATA_RATES_SIZE,
-	    (void *) &ieee80211bg_data_rates[IEEE80211_DATA_RATES_SIZE]);
-	ieee80211_prepare_ie_header(&it, IEEE80211_CHANNEL_IE,
-	    channel_data_size, (void *) &channel);
-
-	ieee80211_dev->ops->tx_handler(ieee80211_dev, buffer, buffer_size);
-
-	free(buffer);
-
-	return EOK;
-}
-
-/** IEEE 802.11 authentication implementation.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_authenticate(ieee80211_dev_t *ieee80211_dev)
-{
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-	nic_address_t nic_address;
-	nic_query_address(nic, &nic_address);
-
-	ieee80211_scan_result_t *auth_data =
-	    &ieee80211_dev->bssid_info.res_link->scan_result;
-
-	size_t buffer_size = sizeof(ieee80211_mgmt_header_t) +
-	    sizeof(ieee80211_auth_body_t);
-
-	void *buffer = malloc(buffer_size);
-	if (!buffer)
-		return ENOMEM;
-
-	memset(buffer, 0, buffer_size);
-
-	ieee80211_mgmt_header_t *mgmt_header =
-	    (ieee80211_mgmt_header_t *) buffer;
-
-	mgmt_header->frame_ctrl =
-	    host2uint16_t_le(IEEE80211_MGMT_FRAME |
-	    IEEE80211_MGMT_AUTH_FRAME);
-	memcpy(mgmt_header->dest_addr, auth_data->bssid.address, ETH_ADDR);
-	memcpy(mgmt_header->src_addr, nic_address.address, ETH_ADDR);
-	memcpy(mgmt_header->bssid, auth_data->bssid.address, ETH_ADDR);
-
-	ieee80211_auth_body_t *auth_body =
-	    (ieee80211_auth_body_t *)
-	    (buffer + sizeof(ieee80211_mgmt_header_t));
-	auth_body->auth_alg = host2uint16_t_le(0);
-	auth_body->auth_trans_no = host2uint16_t_le(1);
-
-	ieee80211_dev->ops->tx_handler(ieee80211_dev, buffer, buffer_size);
-
-	free(buffer);
-
-	return EOK;
-}
-
-/** IEEE 802.11 association implementation.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param password      Passphrase to be used in encrypted communication
- *                      or NULL for open networks.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_associate(ieee80211_dev_t *ieee80211_dev, char *password)
-{
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-	nic_address_t nic_address;
-	nic_query_address(nic, &nic_address);
-
-	ieee80211_scan_result_link_t *auth_link =
-	    ieee80211_dev->bssid_info.res_link;
-
-	ieee80211_scan_result_t *auth_data = &auth_link->scan_result;
-
-	size_t ssid_data_size = str_size(auth_data->ssid);
-
-	size_t payload_size =
-	    sizeof(ieee80211_ie_header_t) * 3 +
-	    ssid_data_size +
-	    IEEE80211_DATA_RATES_SIZE +
-	    IEEE80211_EXT_DATA_RATES_SIZE;
-
-	size_t buffer_size =
-	    sizeof(ieee80211_mgmt_header_t) +
-	    sizeof(ieee80211_assoc_req_body_t) +
-	    payload_size;
-
-	if ((auth_data->security.type == IEEE80211_SECURITY_WPA) ||
-	    (auth_data->security.type == IEEE80211_SECURITY_WPA2))
-		buffer_size += auth_link->auth_ie_len;
-
-	void *buffer = malloc(buffer_size);
-	if (!buffer)
-		return ENOMEM;
-
-	memset(buffer, 0, buffer_size);
-
-	ieee80211_mgmt_header_t *mgmt_header =
-	    (ieee80211_mgmt_header_t *) buffer;
-
-	mgmt_header->frame_ctrl =
-	    host2uint16_t_le(IEEE80211_MGMT_FRAME |
-	    IEEE80211_MGMT_ASSOC_REQ_FRAME);
-	memcpy(mgmt_header->dest_addr, auth_data->bssid.address, ETH_ADDR);
-	memcpy(mgmt_header->src_addr, nic_address.address, ETH_ADDR);
-	memcpy(mgmt_header->bssid, auth_data->bssid.address, ETH_ADDR);
-
-	ieee80211_assoc_req_body_t *assoc_body =
-	    (ieee80211_assoc_req_body_t *)
-	    (buffer + sizeof(ieee80211_mgmt_header_t));
-	assoc_body->listen_interval = host2uint16_t_le(1);
-
-	/* Jump to payload. */
-	void *it = buffer + sizeof(ieee80211_mgmt_header_t) +
-	    sizeof(ieee80211_assoc_req_body_t);
-	ieee80211_prepare_ie_header(&it, IEEE80211_SSID_IE,
-	    ssid_data_size, (void *) auth_data->ssid);
-	ieee80211_prepare_ie_header(&it, IEEE80211_RATES_IE,
-	    IEEE80211_DATA_RATES_SIZE, (void *) &ieee80211bg_data_rates);
-	ieee80211_prepare_ie_header(&it, IEEE80211_EXT_RATES_IE,
-	    IEEE80211_EXT_DATA_RATES_SIZE,
-	    (void *) &ieee80211bg_data_rates[IEEE80211_DATA_RATES_SIZE]);
-
-	if (auth_data->security.type != IEEE80211_SECURITY_OPEN)
-		assoc_body->capability |= host2uint16_t_le(CAP_SECURITY);
-
-	if ((auth_data->security.type == IEEE80211_SECURITY_WPA) ||
-	    (auth_data->security.type == IEEE80211_SECURITY_WPA2))
-		memcpy(it, auth_link->auth_ie, auth_link->auth_ie_len);
-
-	ieee80211_dev->ops->tx_handler(ieee80211_dev, buffer, buffer_size);
-
-	/*
-	 * Save password to be used in eventual authentication handshake.
-	 */
-	memset(ieee80211_dev->bssid_info.password, 0, IEEE80211_MAX_PASSW_LEN);
-	memcpy(ieee80211_dev->bssid_info.password, password,
-	    str_size(password));
-
-	free(buffer);
-
-	return EOK;
-}
-
-/** IEEE 802.11 deauthentication implementation.
- *
- * Note: Expecting locked results_mutex or scan_mutex.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_deauthenticate(ieee80211_dev_t *ieee80211_dev)
-{
-	ieee80211_scan_result_t *auth_data =
-	    &ieee80211_dev->bssid_info.res_link->scan_result;
-
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-	nic_address_t nic_address;
-	nic_query_address(nic, &nic_address);
-
-	size_t buffer_size = sizeof(ieee80211_mgmt_header_t) +
-	    sizeof(ieee80211_deauth_body_t);
-
-	void *buffer = malloc(buffer_size);
-	if (!buffer)
-		return ENOMEM;
-
-	memset(buffer, 0, buffer_size);
-
-	ieee80211_mgmt_header_t *mgmt_header =
-	    (ieee80211_mgmt_header_t *) buffer;
-
-	mgmt_header->frame_ctrl =
-	    host2uint16_t_le(IEEE80211_MGMT_FRAME |
-	    IEEE80211_MGMT_DEAUTH_FRAME);
-	memcpy(mgmt_header->dest_addr, auth_data->bssid.address, ETH_ADDR);
-	memcpy(mgmt_header->src_addr, nic_address.address, ETH_ADDR);
-	memcpy(mgmt_header->bssid, auth_data->bssid.address, ETH_ADDR);
-
-	ieee80211_dev->ops->tx_handler(ieee80211_dev, buffer, buffer_size);
-
-	free(buffer);
-
-	ieee80211_dev->bssid_info.res_link = NULL;
-	ieee80211_dev->ops->bssid_change(ieee80211_dev, false);
-
-	if (ieee80211_query_using_key(ieee80211_dev))
-		ieee80211_dev->ops->key_config(ieee80211_dev, NULL, false);
-
-	ieee80211_set_auth_phase(ieee80211_dev, IEEE80211_AUTH_DISCONNECTED);
-
-	return EOK;
-}
-
-static void ieee80211_process_auth_info(ieee80211_scan_result_link_t *ap_data,
-    void *buffer)
-{
-	uint8_t *it = (uint8_t *) buffer;
-
-	uint16_t *version = (uint16_t *) it;
-	if (uint16_t_le2host(*version) != 0x1) {
-		ap_data->scan_result.security.type = -1;
-		return;
-	}
-
-	it += sizeof(uint16_t);
-
-	uint32_t group_cipher = *(it + 3);
-	switch (group_cipher) {
-	case IEEE80211_AUTH_CIPHER_TKIP:
-		ap_data->scan_result.security.group_alg =
-		    IEEE80211_SECURITY_SUITE_TKIP;
-		break;
-	case IEEE80211_AUTH_CIPHER_CCMP:
-		ap_data->scan_result.security.group_alg =
-		    IEEE80211_SECURITY_SUITE_CCMP;
-		break;
-	default:
-		ap_data->scan_result.security.group_alg = -1;
-	}
-
-	it += 4 * sizeof(uint8_t);
-
-	uint16_t *pairwise_count = (uint16_t *) it;
-	uint32_t pairwise_cipher = *(it + sizeof(uint16_t) + 3);
-	switch (pairwise_cipher) {
-	case IEEE80211_AUTH_CIPHER_TKIP:
-		ap_data->scan_result.security.pair_alg =
-		    IEEE80211_SECURITY_SUITE_TKIP;
-		break;
-	case IEEE80211_AUTH_CIPHER_CCMP:
-		ap_data->scan_result.security.pair_alg =
-		    IEEE80211_SECURITY_SUITE_CCMP;
-		break;
-	default:
-		ap_data->scan_result.security.pair_alg = -1;
-	}
-
-	it += 2 * sizeof(uint16_t) +
-	    uint16_t_le2host(*pairwise_count) * sizeof(uint32_t);
-
-	uint32_t auth_suite = *(it + 3);
-	switch (auth_suite) {
-	case IEEE80211_AUTH_AKM_PSK:
-		ap_data->scan_result.security.auth =
-		    IEEE80211_SECURITY_AUTH_PSK;
-		break;
-	case IEEE80211_AUTH_AKM_8021X:
-		ap_data->scan_result.security.auth =
-		    IEEE80211_SECURITY_AUTH_8021X;
-		break;
-	default:
-		ap_data->scan_result.security.auth = -1;
-	}
-}
-
-static void copy_auth_ie(ieee80211_ie_header_t *ie_header,
-    ieee80211_scan_result_link_t *ap_data, void *it)
-{
-	ap_data->auth_ie_len = ie_header->length +
-	    sizeof(ieee80211_ie_header_t);
-
-	memcpy(ap_data->auth_ie, it, ap_data->auth_ie_len);
-}
-
-static uint8_t *ieee80211_process_ies(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_scan_result_link_t *ap_data, void *buffer, size_t buffer_size)
-{
-	void *it = buffer;
-	while ((it + sizeof(ieee80211_ie_header_t)) < buffer + buffer_size) {
-		ieee80211_ie_header_t *ie_header =
-		    (ieee80211_ie_header_t *) it;
-		uint8_t *channel;
-		uint32_t oui;
-
-		switch (ie_header->element_id) {
-		case IEEE80211_CHANNEL_IE:
-			if (!ap_data)
-				break;
-
-			channel = (uint8_t *)
-			    (it + sizeof(ieee80211_ie_header_t));
-			ap_data->scan_result.channel = *channel;
-			break;
-		case IEEE80211_RSN_IE:
-			if (!ap_data)
-				break;
-
-			ap_data->scan_result.security.type =
-			    IEEE80211_SECURITY_WPA2;
-			ieee80211_process_auth_info(ap_data,
-			    it + sizeof(ieee80211_ie_header_t));
-			copy_auth_ie(ie_header, ap_data, it);
-			break;
-		case IEEE80211_VENDOR_IE:
-			oui = uint32be_from_seq(it +
-			    sizeof(ieee80211_ie_header_t));
-
-			if (oui == WPA_OUI) {
-				if (!ap_data)
-					break;
-
-				/* Prefering WPA2. */
-				if (ap_data->scan_result.security.type ==
-				    IEEE80211_SECURITY_WPA2)
-					break;
-
-				ap_data->scan_result.security.type =
-				    IEEE80211_SECURITY_WPA;
-
-				ieee80211_process_auth_info(ap_data,
-				    it + sizeof(ieee80211_ie_header_t) +
-				    sizeof(uint32_t));
-				copy_auth_ie(ie_header, ap_data, it);
-			} else if (oui == GTK_OUI) {
-				return it +
-				    sizeof(ieee80211_ie_header_t) +
-				    sizeof(uint32_t);
-			}
-		}
-
-		it += sizeof(ieee80211_ie_header_t) + ie_header->length;
-	}
-
-	return NULL;
-}
-
-/** Process probe response and store results.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param mgmt_header   Pointer to start of management frame header.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_probe_response(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_mgmt_header_t *mgmt_header, size_t buffer_size)
-{
-	ieee80211_beacon_start_t *beacon_body = (ieee80211_beacon_start_t *)
-	    ((void *) mgmt_header + sizeof(ieee80211_mgmt_header_t));
-
-	ieee80211_ie_header_t *ssid_ie_header = (ieee80211_ie_header_t *)
-	    ((void *) beacon_body + sizeof(ieee80211_beacon_start_t));
-
-	/* Not empty SSID. */
-	if (ssid_ie_header->length > 0) {
-		ieee80211_scan_result_list_t *result_list =
-		    &ieee80211_dev->ap_list;
-
-		uint8_t *ssid_start = (uint8_t *) ((void *) ssid_ie_header +
-		    sizeof(ieee80211_ie_header_t));
-		char ssid[IEEE80211_MAX_SSID_LENGTH];
-
-		memcpy(ssid, ssid_start, ssid_ie_header->length);
-		ssid[ssid_ie_header->length] = '\0';
-
-		/* Check whether SSID is already in results. */
-		ieee80211_scan_result_list_foreach(*result_list, result) {
-			if (!str_cmp(ssid, result->scan_result.ssid)) {
-				result->last_beacon = time(NULL);
-				return EOK;
-			}
-		}
-
-		/* Results are full. */
-		if (result_list->size == IEEE80211_MAX_RESULTS_LENGTH - 1)
-			return EOK;
-
-		ieee80211_scan_result_link_t *ap_data =
-		    malloc(sizeof(ieee80211_scan_result_link_t));
-		if (!ap_data)
-			return ENOMEM;
-
-		memset(ap_data, 0, sizeof(ieee80211_scan_result_link_t));
-		link_initialize(&ap_data->link);
-
-		memcpy(ap_data->scan_result.bssid.address,
-		    mgmt_header->bssid, ETH_ADDR);
-		memcpy(ap_data->scan_result.ssid, ssid,
-		    ssid_ie_header->length + 1);
-
-		if (uint16_t_le2host(beacon_body->capability) & CAP_SECURITY) {
-			ap_data->scan_result.security.type =
-			    IEEE80211_SECURITY_WEP;
-		} else {
-			ap_data->scan_result.security.type =
-			    IEEE80211_SECURITY_OPEN;
-			ap_data->scan_result.security.auth = -1;
-			ap_data->scan_result.security.pair_alg = -1;
-			ap_data->scan_result.security.group_alg = -1;
-		}
-
-		void *rest_ies_start = ssid_start + ssid_ie_header->length;
-		size_t rest_buffer_size =
-		    buffer_size -
-		    sizeof(ieee80211_mgmt_header_t) -
-		    sizeof(ieee80211_beacon_start_t) -
-		    sizeof(ieee80211_ie_header_t) -
-		    ssid_ie_header->length;
-
-		ieee80211_process_ies(ieee80211_dev, ap_data, rest_ies_start,
-		    rest_buffer_size);
-
-		ap_data->last_beacon = time(NULL);
-
-		fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
-		ieee80211_scan_result_list_append(result_list, ap_data);
-		fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
-	}
-
-	return EOK;
-}
-
-/** Process authentication response.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param mgmt_header   Pointer to start of management frame header.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_auth_response(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_mgmt_header_t *mgmt_header)
-{
-	ieee80211_auth_body_t *auth_body =
-	    (ieee80211_auth_body_t *)
-	    ((void *) mgmt_header + sizeof(ieee80211_mgmt_header_t));
-
-	if (auth_body->status != 0)
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_DISCONNECTED);
-	else
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_AUTHENTICATED);
-
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	fibril_condvar_signal(&ieee80211_dev->gen_cond);
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return EOK;
-}
-
-/** Process association response.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param mgmt_header   Pointer to start of management frame header.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_assoc_response(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_mgmt_header_t *mgmt_header)
-{
-	ieee80211_assoc_resp_body_t *assoc_resp =
-	    (ieee80211_assoc_resp_body_t *) ((void *) mgmt_header +
-	    sizeof(ieee80211_mgmt_header_t));
-
-	if (assoc_resp->status != 0)
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_DISCONNECTED);
-	else {
-		ieee80211_dev->bssid_info.aid =
-		    uint16_t_le2host(assoc_resp->aid);
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_ASSOCIATED);
-		ieee80211_dev->ops->bssid_change(ieee80211_dev, true);
-	}
-
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	fibril_condvar_signal(&ieee80211_dev->gen_cond);
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	return EOK;
-}
-
-static errno_t ieee80211_process_4way_handshake(ieee80211_dev_t *ieee80211_dev,
-    void *buffer, size_t buffer_size)
-{
-	ieee80211_eapol_key_frame_t *key_frame =
-	    (ieee80211_eapol_key_frame_t *) buffer;
-
-	ieee80211_scan_result_link_t *auth_link =
-	    ieee80211_dev->bssid_info.res_link;
-
-	ieee80211_scan_result_t *auth_data = &auth_link->scan_result;
-
-	/* We don't support 802.1X authentication yet. */
-	if (auth_data->security.auth == IEEE80211_AUTH_AKM_8021X)
-		return ENOTSUP;
-
-	uint8_t *ptk = ieee80211_dev->bssid_info.ptk;
-	uint8_t *gtk = ieee80211_dev->bssid_info.gtk;
-	uint8_t gtk_id = 1;
-
-	bool handshake_done = false;
-
-	bool old_wpa =
-	    auth_data->security.type == IEEE80211_SECURITY_WPA;
-
-	bool key_phase =
-	    uint16_t_be2host(key_frame->key_info) &
-	    IEEE80211_EAPOL_KEY_KEYINFO_MIC;
-
-	bool final_phase =
-	    uint16_t_be2host(key_frame->key_info) &
-	    IEEE80211_EAPOL_KEY_KEYINFO_SECURE;
-
-	bool ccmp_used =
-	    (auth_data->security.pair_alg == IEEE80211_SECURITY_SUITE_CCMP) ||
-	    (auth_data->security.group_alg == IEEE80211_SECURITY_SUITE_CCMP);
-
-	size_t ptk_key_length, gtk_key_length;
-	hash_func_t mic_hash;
-	if (ccmp_used)
-		mic_hash = HASH_SHA1;
-	else
-		mic_hash = HASH_MD5;
-
-	if (auth_data->security.pair_alg == IEEE80211_SECURITY_SUITE_CCMP)
-		ptk_key_length = IEEE80211_PTK_CCMP_LENGTH;
-	else
-		ptk_key_length = IEEE80211_PTK_TKIP_LENGTH;
-
-	if (auth_data->security.group_alg == IEEE80211_SECURITY_SUITE_CCMP)
-		gtk_key_length = IEEE80211_GTK_CCMP_LENGTH;
-	else
-		gtk_key_length = IEEE80211_GTK_TKIP_LENGTH;
-
-	size_t output_size =
-	    sizeof(eth_header_t) +
-	    sizeof(ieee80211_eapol_key_frame_t);
-
-	if (!(uint16_t_be2host(key_frame->key_info) &
-	    IEEE80211_EAPOL_KEY_KEYINFO_MIC))
-		output_size += auth_link->auth_ie_len;
-
-	nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-	nic_address_t nic_address;
-	nic_query_address(nic, &nic_address);
-
-	void *output_buffer = malloc(output_size);
-	if (!output_buffer)
-		return ENOMEM;
-
-	memset(output_buffer, 0, output_size);
-
-	/* Setup ethernet header. */
-	eth_header_t *eth_header = (eth_header_t *) output_buffer;
-	memcpy(eth_header->dest_addr, auth_data->bssid.address, ETH_ADDR);
-	memcpy(eth_header->src_addr, nic_address.address, ETH_ADDR);
-	eth_header->proto = host2uint16_t_be(ETH_TYPE_PAE);
-
-	ieee80211_eapol_key_frame_t *output_key_frame =
-	    (ieee80211_eapol_key_frame_t *)
-	    (output_buffer + sizeof(eth_header_t));
-
-	/* Copy content of incoming EAPOL-Key frame. */
-	memcpy((void *) output_key_frame, buffer,
-	    sizeof(ieee80211_eapol_key_frame_t));
-
-	output_key_frame->proto_version = 0x1;
-	output_key_frame->body_length =
-	    host2uint16_t_be(output_size - sizeof(eth_header_t) - 4);
-	output_key_frame->key_info &=
-	    ~host2uint16_t_be(IEEE80211_EAPOL_KEY_KEYINFO_ACK);
-
-	if (key_phase) {
-		output_key_frame->key_info &=
-		    ~host2uint16_t_be(IEEE80211_EAPOL_KEY_KEYINFO_ENCDATA);
-		output_key_frame->key_info &=
-		    ~host2uint16_t_be(IEEE80211_EAPOL_KEY_KEYINFO_INSTALL);
-		output_key_frame->key_data_length = 0;
-		memset(output_key_frame->key_nonce, 0, 32);
-		memset(output_key_frame->key_mic, 0, 16);
-		memset(output_key_frame->key_rsc, 0, 8);
-		memset(output_key_frame->eapol_key_iv, 0, 16);
-
-		/* Derive GTK and save it. */
-		if (final_phase) {
-			uint16_t key_data_length =
-			    uint16_t_be2host(key_frame->key_data_length);
-			uint8_t key_data[key_data_length];
-			uint8_t *data_ptr = (uint8_t *)
-			    (buffer + sizeof(ieee80211_eapol_key_frame_t));
-
-			errno_t rc;
-			uint8_t work_key[32];
-
-			if (ccmp_used) {
-				rc = ieee80211_aes_key_unwrap(ptk + KEK_OFFSET,
-				    data_ptr, key_data_length, key_data);
-			} else {
-				memcpy(work_key, key_frame->eapol_key_iv, 16);
-				memcpy(work_key + 16, ptk + KEK_OFFSET, 16);
-				rc = ieee80211_rc4_key_unwrap(work_key,
-				    data_ptr, key_data_length, key_data);
-			}
-
-			if (rc == EOK) {
-				uint8_t *key_data_ptr = old_wpa ? key_data :
-				    ieee80211_process_ies(ieee80211_dev,
-				    NULL, key_data, key_data_length);
-
-				if (key_data_ptr) {
-					uint8_t *key_ptr;
-
-					if (old_wpa)
-						key_ptr = key_data_ptr;
-					else {
-						gtk_id = *key_data_ptr & 0x3;
-						key_ptr = key_data_ptr + 2;
-					}
-
-					memcpy(gtk, key_ptr, gtk_key_length);
-					handshake_done = true;
-				}
-			}
-		}
-	} else {
-		output_key_frame->key_info |=
-		    host2uint16_t_be(IEEE80211_EAPOL_KEY_KEYINFO_MIC);
-		output_key_frame->key_data_length =
-		    host2uint16_t_be(auth_link->auth_ie_len);
-		memcpy((void *) output_key_frame +
-		    sizeof(ieee80211_eapol_key_frame_t),
-		    auth_link->auth_ie, auth_link->auth_ie_len);
-
-		/* Compute PMK. */
-		uint8_t pmk[PBKDF2_KEY_LENGTH];
-		pbkdf2((uint8_t *) ieee80211_dev->bssid_info.password,
-		    str_size(ieee80211_dev->bssid_info.password),
-		    (uint8_t *) auth_data->ssid,
-		    str_size(auth_data->ssid), pmk);
-
-		uint8_t *anonce = key_frame->key_nonce;
-
-		/* Generate SNONCE. */
-		uint8_t snonce[32];
-		rnd_sequence(snonce, 32);
-
-		memcpy(output_key_frame->key_nonce, snonce, 32);
-
-		uint8_t *dest_addr = eth_header->dest_addr;
-		uint8_t *src_addr = eth_header->src_addr;
-
-		/* Derive PTK and save it. */
-		uint8_t crypt_data[PRF_CRYPT_DATA_LENGTH];
-		memcpy(crypt_data,
-		    min_sequence(dest_addr, src_addr, ETH_ADDR), ETH_ADDR);
-		memcpy(crypt_data + ETH_ADDR,
-		    max_sequence(dest_addr, src_addr, ETH_ADDR), ETH_ADDR);
-		memcpy(crypt_data + 2 * ETH_ADDR,
-		    min_sequence(anonce, snonce, 32), 32);
-		memcpy(crypt_data + 2 * ETH_ADDR + 32,
-		    max_sequence(anonce, snonce, 32), 32);
-		ieee80211_prf(pmk, crypt_data, ptk, ptk_key_length);
-	}
-
-	/* Compute MIC of key frame data from KCK part of PTK. */
-	uint8_t mic[mic_hash];
-	hmac(ptk, 16, (uint8_t *) output_key_frame,
-	    output_size - sizeof(eth_header_t), mic, mic_hash);
-
-	memcpy(output_key_frame->key_mic, mic, 16);
-
-	ieee80211_send_frame(nic, output_buffer, output_size);
-
-	free(output_buffer);
-
-	ieee80211_key_config_t key_config;
-
-	/* Insert Pairwise key. */
-	if ((key_phase && old_wpa) || (final_phase && !old_wpa)) {
-		key_config.suite = auth_data->security.pair_alg;
-		key_config.flags =
-		    IEEE80211_KEY_FLAG_TYPE_PAIRWISE;
-		memcpy(key_config.data,
-		    ptk + TK_OFFSET, ptk_key_length - TK_OFFSET);
-
-		ieee80211_dev->ops->key_config(ieee80211_dev,
-		    &key_config, true);
-	}
-
-	/* Insert Group key. */
-	if (final_phase) {
-		key_config.id = gtk_id;
-		key_config.suite = auth_data->security.group_alg;
-		key_config.flags = IEEE80211_KEY_FLAG_TYPE_GROUP;
-		memcpy(key_config.data, gtk, gtk_key_length);
-
-		ieee80211_dev->ops->key_config(ieee80211_dev,
-		    &key_config, true);
-	}
-
-	/* Signal successful handshake completion. */
-	if (handshake_done) {
-		fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-		fibril_condvar_signal(&ieee80211_dev->gen_cond);
-		fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-	}
-
-	return EOK;
-}
-
-static errno_t ieee80211_process_eapol_frame(ieee80211_dev_t *ieee80211_dev,
-    void *buffer, size_t buffer_size)
-{
-	ieee80211_eapol_key_frame_t *key_frame =
-	    (ieee80211_eapol_key_frame_t *) buffer;
-
-	if (ieee80211_is_eapol_key_frame(key_frame))
-		return ieee80211_process_4way_handshake(ieee80211_dev, buffer,
-		    buffer_size);
-
-	return EOK;
-}
-
-/** Process data frame.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param buffer        Data buffer starting with IEEE 802.11 data header.
- * @param buffer_size   Size of buffer.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t ieee80211_process_data(ieee80211_dev_t *ieee80211_dev,
-    void *buffer, size_t buffer_size)
-{
-	ieee80211_data_header_t *data_header =
-	    (ieee80211_data_header_t *) buffer;
-
-	if (ieee80211_has_data_frame(data_header->frame_ctrl)) {
-		nic_t *nic = nic_get_from_ddf_dev(ieee80211_dev->ddf_dev);
-		size_t strip_length = sizeof(ieee80211_data_header_t) +
-		    ARRAY_SIZE(rfc1042_header);
-
-		/* TODO: Different by used security alg. */
-		/* TODO: Trim frame by used security alg. */
-		// TODO: Distinguish used key (pair/group) by dest address ?
-		if (ieee80211_is_encrypted_frame(data_header->frame_ctrl))
-			strip_length += 8;
-
-		/* Process 4-way authentication handshake. */
-		uint16_t *proto = (uint16_t *) (buffer + strip_length);
-		if (uint16_t_be2host(*proto) == ETH_TYPE_PAE)
-			return ieee80211_process_eapol_frame(ieee80211_dev,
-			    buffer + strip_length + sizeof(uint16_t),
-			    buffer_size - strip_length - sizeof(uint16_t));
-
-		/*
-		 * Note: ETH protocol ID is already there, so we don't create
-		 * whole ETH header.
-		 */
-		size_t frame_size =
-		    buffer_size - strip_length + sizeof(eth_header_t) - 2;
-		nic_frame_t *frame = nic_alloc_frame(nic, frame_size);
-
-		if (frame == NULL)
-			return ENOMEM;
-
-		uint8_t *src_addr =
-		    ieee80211_is_fromds_frame(data_header->frame_ctrl) ?
-		    data_header->address3 : data_header->address2;
-		uint8_t *dest_addr =
-		    ieee80211_is_tods_frame(data_header->frame_ctrl) ?
-		    data_header->address3 : data_header->address1;
-
-		eth_header_t *eth_header = (eth_header_t *) frame->data;
-		memcpy(eth_header->src_addr, src_addr, ETH_ADDR);
-		memcpy(eth_header->dest_addr, dest_addr, ETH_ADDR);
-
-		memcpy(frame->data + sizeof(eth_header_t) - 2,
-		    buffer + strip_length, buffer_size - strip_length);
-
-		nic_received_frame(nic, frame);
-	}
-
-	return EOK;
-}
-
-/** IEEE 802.11 RX frames handler.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device structure.
- * @param buffer        Buffer with data.
- * @param buffer_size   Size of buffer.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_rx_handler(ieee80211_dev_t *ieee80211_dev, void *buffer,
-    size_t buffer_size)
-{
-	uint16_t frame_ctrl = *((uint16_t *) buffer);
-
-	if (ieee80211_is_mgmt_frame(frame_ctrl)) {
-		ieee80211_mgmt_header_t *mgmt_header =
-		    (ieee80211_mgmt_header_t *) buffer;
-
-		if ((ieee80211_is_probe_response_frame(mgmt_header->frame_ctrl)) ||
-		    (ieee80211_is_beacon_frame(mgmt_header->frame_ctrl)))
-			return ieee80211_process_probe_response(ieee80211_dev,
-			    mgmt_header, buffer_size);
-
-		if (ieee80211_is_auth_frame(mgmt_header->frame_ctrl))
-			return ieee80211_process_auth_response(ieee80211_dev,
-			    mgmt_header);
-
-		if (ieee80211_is_assoc_response_frame(mgmt_header->frame_ctrl))
-			return ieee80211_process_assoc_response(ieee80211_dev,
-			    mgmt_header);
-	} else if (ieee80211_is_data_frame(frame_ctrl))
-		return ieee80211_process_data(ieee80211_dev, buffer,
-		    buffer_size);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/ieee80211/src/ieee80211_iface_impl.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211_iface_impl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211_iface_impl.c
- *
- * IEEE 802.11 default interface functions implementation.
- */
-
-#include <str.h>
-#include <errno.h>
-#include <ieee80211_private.h>
-#include <ieee80211_iface_impl.h>
-
-/** Implementation of fetching scan results.
- *
- * @param fun     Device function.
- * @param results Structure where should be stored scan results.
- *
- * @return EOK if everything went OK,
- *         EREFUSED when device is not ready yet.
- *
- */
-errno_t ieee80211_get_scan_results_impl(ddf_fun_t *fun,
-    ieee80211_scan_results_t *results, bool now)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	ieee80211_dev_t *ieee80211_dev = nic_get_specific(nic_data);
-
-	if (!ieee80211_is_ready(ieee80211_dev))
-		return EREFUSED;
-
-	if (now)
-		ieee80211_dev->ops->scan(ieee80211_dev);
-
-	fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
-
-	if (results) {
-		ieee80211_scan_result_list_t *result_list =
-		    &ieee80211_dev->ap_list;
-
-		unsigned int i = 0;
-		ieee80211_scan_result_list_foreach(*result_list, result) {
-			memcpy(&results->results[i],
-			    &result->scan_result,
-			    sizeof(ieee80211_scan_result_t));
-			i++;
-		}
-
-		results->length = i;
-	}
-
-	fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
-
-	return EOK;
-}
-
-static uint16_t ieee80211_channel_to_freq(uint8_t channel)
-{
-	return IEEE80211_CHANNEL_GAP * (channel - 1) + IEEE80211_FIRST_FREQ;
-}
-
-/** Working procedure of connect function.
- *
- * @param ieee80211_dev Pointer to IEEE 802.11 device.
- * @param auth_data     Selected AP data we want to connect to.
- *
- * @return EOK if everything OK,
- *         ETIMEOUT when timeout during authenticating.
- *
- */
-static errno_t ieee80211_connect_proc(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_scan_result_link_t *auth_data, char *password)
-{
-	ieee80211_dev->bssid_info.res_link = auth_data;
-
-	/* Set channel. */
-	errno_t rc = ieee80211_dev->ops->set_freq(ieee80211_dev,
-	    ieee80211_channel_to_freq(auth_data->scan_result.channel));
-	if (rc != EOK)
-		return rc;
-
-	/* Try to authenticate. */
-	ieee80211_authenticate(ieee80211_dev);
-
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	rc = fibril_condvar_wait_timeout(&ieee80211_dev->gen_cond,
-	    &ieee80211_dev->gen_mutex, AUTH_TIMEOUT);
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	if (rc != EOK)
-		return rc;
-
-	if (ieee80211_get_auth_phase(ieee80211_dev) !=
-	    IEEE80211_AUTH_AUTHENTICATED) {
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_DISCONNECTED);
-		return EINVAL;
-	}
-
-	/* Try to associate. */
-	ieee80211_associate(ieee80211_dev, password);
-
-	fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-	rc = fibril_condvar_wait_timeout(&ieee80211_dev->gen_cond,
-	    &ieee80211_dev->gen_mutex, AUTH_TIMEOUT);
-	fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-	if (rc != EOK)
-		return rc;
-
-	if (ieee80211_get_auth_phase(ieee80211_dev) !=
-	    IEEE80211_AUTH_ASSOCIATED) {
-		ieee80211_set_auth_phase(ieee80211_dev,
-		    IEEE80211_AUTH_DISCONNECTED);
-		return EINVAL;
-	}
-
-	/* On open network, we are finished. */
-	if (auth_data->scan_result.security.type !=
-	    IEEE80211_SECURITY_OPEN) {
-		/* Otherwise wait for 4-way handshake to complete. */
-
-		fibril_mutex_lock(&ieee80211_dev->gen_mutex);
-		rc = fibril_condvar_wait_timeout(&ieee80211_dev->gen_cond,
-		    &ieee80211_dev->gen_mutex, HANDSHAKE_TIMEOUT);
-		fibril_mutex_unlock(&ieee80211_dev->gen_mutex);
-
-		if (rc != EOK) {
-			ieee80211_deauthenticate(ieee80211_dev);
-			return rc;
-		}
-	}
-
-	ieee80211_set_auth_phase(ieee80211_dev, IEEE80211_AUTH_CONNECTED);
-
-	return EOK;
-}
-
-/** Implementation of connecting to specified SSID.
- *
- * @param fun        Device function.
- * @param ssid_start SSID prefix of access point we want to connect to.
- *
- * @return EOK if everything OK,
- *         ETIMEOUT when timeout during authenticating,
- *         EINVAL when SSID not in scan results list,
- *         EPERM when incorrect password passed,
- *         EREFUSED when device is not ready yet.
- *
- */
-errno_t ieee80211_connect_impl(ddf_fun_t *fun, char *ssid_start, char *password)
-{
-	assert(ssid_start);
-	assert(password);
-
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	ieee80211_dev_t *ieee80211_dev = nic_get_specific(nic_data);
-
-	if (!ieee80211_is_ready(ieee80211_dev))
-		return EREFUSED;
-
-	if (ieee80211_is_connected(ieee80211_dev)) {
-		errno_t rc = ieee80211_dev->iface->disconnect(fun);
-		if (rc != EOK)
-			return rc;
-	}
-
-	ieee80211_set_connect_request(ieee80211_dev);
-
-	errno_t rc = ENOENT;
-	fibril_mutex_lock(&ieee80211_dev->scan_mutex);
-
-	ieee80211_dev->pending_conn_req = false;
-
-	ieee80211_scan_result_list_foreach(ieee80211_dev->ap_list, result) {
-		if (!str_lcmp(ssid_start, result->scan_result.ssid,
-		    str_size(ssid_start))) {
-			rc = ieee80211_connect_proc(ieee80211_dev, result,
-			    password);
-			break;
-		}
-	}
-
-	fibril_mutex_unlock(&ieee80211_dev->scan_mutex);
-
-	return rc;
-}
-
-/** Implementation of disconnecting device from network.
- *
- * @param fun Device function.
- *
- * @return EOK if everything OK,
- *         EREFUSED if device is not ready yet.
- *
- */
-errno_t ieee80211_disconnect_impl(ddf_fun_t *fun)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	ieee80211_dev_t *ieee80211_dev = nic_get_specific(nic_data);
-
-	if (!ieee80211_is_ready(ieee80211_dev))
-		return EREFUSED;
-
-	if (!ieee80211_is_connected(ieee80211_dev))
-		return EOK;
-
-	fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
-	errno_t rc = ieee80211_deauthenticate(ieee80211_dev);
-	fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/ieee80211/src/ieee80211_impl.c
===================================================================
--- uspace/lib/ieee80211/src/ieee80211_impl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,410 +1,0 @@
-/*
- * Copyright (c) 2015 Jan Kolarik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libieee80211
- * @{
- */
-
-/** @file ieee80211_impl.c
- *
- * IEEE 802.11 default device functions implementation.
- */
-
-#include <stdio.h>
-#include <crypto.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ieee80211_impl.h>
-
-/** Default implementation of IEEE802.11 start function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- *
- * @return EOK.
- *
- */
-errno_t ieee80211_start_impl(ieee80211_dev_t *ieee80211_dev)
-{
-	return EOK;
-}
-
-/** Default implementation of IEEE802.11 TX handler function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- * @param buffer        Buffer with data to send.
- * @param buffer_size   Size of buffer.
- *
- * @return EOK.
- *
- */
-errno_t ieee80211_tx_handler_impl(ieee80211_dev_t *ieee80211_dev, void *buffer,
-    size_t buffer_size)
-{
-	return EOK;
-}
-
-/** Default implementation of IEEE802.11 set frequency function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- * @param freq          Value of frequency to be switched on.
- *
- * @return EOK.
- *
- */
-errno_t ieee80211_set_freq_impl(ieee80211_dev_t *ieee80211_dev, uint16_t freq)
-{
-	return EOK;
-}
-
-/** Default implementation of IEEE802.11 BSSID change function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- *
- * @return EOK.
- *
- */
-errno_t ieee80211_bssid_change_impl(ieee80211_dev_t *ieee80211_dev,
-    bool connected)
-{
-	return EOK;
-}
-
-/** Default implementation of IEEE802.11 key config function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- *
- * @return EOK.
- *
- */
-errno_t ieee80211_key_config_impl(ieee80211_dev_t *ieee80211_dev,
-    ieee80211_key_config_t *key_conf, bool insert)
-{
-	return EOK;
-}
-
-/** Default implementation of IEEE802.11 scan function.
- *
- * @param ieee80211_dev Structure of IEEE802.11 device.
- * @param clear         Whether to clear current scan results.
- *
- * @return EOK if succeed, error code otherwise.
- *
- */
-errno_t ieee80211_scan_impl(ieee80211_dev_t *ieee80211_dev)
-{
-	fibril_mutex_lock(&ieee80211_dev->scan_mutex);
-
-	if (ieee80211_get_auth_phase(ieee80211_dev) ==
-	    IEEE80211_AUTH_DISCONNECTED) {
-		fibril_mutex_lock(&ieee80211_dev->ap_list.results_mutex);
-
-		/* Remove old entries we don't receive beacons from. */
-		ieee80211_scan_result_list_t *result_list =
-		    &ieee80211_dev->ap_list;
-
-		list_foreach_safe(result_list->list, cur_link, next_link) {
-			ieee80211_scan_result_link_t *cur_result =
-			    list_get_instance(cur_link,
-			    ieee80211_scan_result_link_t, link);
-
-			if ((time(NULL) - cur_result->last_beacon) >
-			    MAX_KEEP_SCAN_SPAN_SEC)
-				ieee80211_scan_result_list_remove(result_list,
-				    cur_result);
-		}
-
-		fibril_mutex_unlock(&ieee80211_dev->ap_list.results_mutex);
-
-		uint16_t orig_freq = ieee80211_dev->current_freq;
-
-		for (uint16_t freq = IEEE80211_FIRST_FREQ;
-		    freq <= IEEE80211_MAX_FREQ; freq += IEEE80211_CHANNEL_GAP) {
-			if (ieee80211_pending_connect_request(ieee80211_dev))
-				break;
-
-			ieee80211_dev->ops->set_freq(ieee80211_dev, freq);
-			ieee80211_probe_request(ieee80211_dev, NULL);
-
-			/* Wait for probe responses. */
-			fibril_usleep(SCAN_CHANNEL_WAIT_USEC);
-		}
-
-		ieee80211_dev->ops->set_freq(ieee80211_dev, orig_freq);
-	}
-
-	fibril_mutex_unlock(&ieee80211_dev->scan_mutex);
-
-	return EOK;
-}
-
-/** Pseudorandom function used for IEEE 802.11 pairwise key computation.
- *
- * Using SHA1 hash algorithm.
- *
- * @param key         Key with PBKDF2 encrypted passphrase.
- * @param data        Concatenated sequence of both MAC
- *                    addresses and nonces.
- * @param hash        Output parameter for result hash.
- * @param output_size Length of output sequence to be generated.
- *
- * @return EINVAL when key or data not specified,
- *         ENOMEM when pointer for output hash result
- *         is not allocated, otherwise EOK.
- *
- */
-errno_t ieee80211_prf(uint8_t *key, uint8_t *data, uint8_t *hash,
-    size_t output_size)
-{
-	if ((!key) || (!data))
-		return EINVAL;
-
-	if (!hash)
-		return ENOMEM;
-
-	size_t iters = ((output_size * 8) + 159) / 160;
-
-	const char *a = "Pairwise key expansion";
-	uint8_t result[HASH_SHA1 * iters];
-	uint8_t temp[HASH_SHA1];
-
-	size_t data_size = PRF_CRYPT_DATA_LENGTH + str_size(a) + 2;
-	uint8_t work_arr[data_size];
-	memset(work_arr, 0, data_size);
-
-	memcpy(work_arr, a, str_size(a));
-	memcpy(work_arr + str_size(a) + 1, data, PRF_CRYPT_DATA_LENGTH);
-
-	for (uint8_t i = 0; i < iters; i++) {
-		memcpy(work_arr + data_size - 1, &i, 1);
-		hmac(key, PBKDF2_KEY_LENGTH, work_arr, data_size, temp,
-		    HASH_SHA1);
-		memcpy(result + i * HASH_SHA1, temp, HASH_SHA1);
-	}
-
-	memcpy(hash, result, output_size);
-
-	return EOK;
-}
-
-errno_t ieee80211_rc4_key_unwrap(uint8_t *key, uint8_t *data, size_t data_size,
-    uint8_t *output)
-{
-	return rc4(key, 32, data, data_size, 256, output);
-}
-
-errno_t ieee80211_aes_key_unwrap(uint8_t *kek, uint8_t *data, size_t data_size,
-    uint8_t *output)
-{
-	if ((!kek) || (!data))
-		return EINVAL;
-
-	if (!output)
-		return ENOMEM;
-
-	uint32_t n = data_size / 8 - 1;
-	uint8_t work_data[n * 8];
-	uint8_t work_input[AES_CIPHER_LENGTH];
-	uint8_t work_output[AES_CIPHER_LENGTH];
-	uint8_t *work_block;
-	uint8_t a[8];
-
-	memcpy(a, data, 8);
-
-	uint64_t mask = 0xff;
-	uint8_t shift, shb;
-
-	memcpy(work_data, data + 8, n * 8);
-	for (int j = 5; j >= 0; j--) {
-		for (int i = n; i > 0; i--) {
-			for (size_t k = 0; k < 8; k++) {
-				shift = 56 - 8 * k;
-				shb = ((n * j + i) & (mask << shift)) >> shift;
-				a[k] ^= shb;
-			}
-
-			work_block = work_data + (i - 1) * 8;
-			memcpy(work_input, a, 8);
-			memcpy(work_input + 8, work_block, 8);
-			aes_decrypt(kek, work_input, work_output);
-			memcpy(a, work_output, 8);
-			memcpy(work_data + (i - 1) * 8, work_output + 8, 8);
-		}
-	}
-
-	size_t it;
-	for (it = 0; it < 8; it++) {
-		if (a[it] != 0xa6)
-			break;
-	}
-
-	if (it == 8) {
-		memcpy(output, work_data, n * 8);
-		return EOK;
-	}
-
-	return EINVAL;
-}
-
-static void ieee80211_michael_mic_block(uint32_t *l, uint32_t *r,
-    uint32_t value)
-{
-	*l ^= value;
-	*r ^= rotl_uint32(*l, 17);
-	*l += *r;
-	*r ^= ((*l & 0x00ff00ff) << 8) | ((*l & 0xff00ff00) >> 8);
-	*l += *r;
-	*r ^= rotl_uint32(*l, 3);
-	*l += *r;
-	*r ^= rotr_uint32(*l, 2);
-	*l += *r;
-}
-
-errno_t ieee80211_michael_mic(uint8_t *key, uint8_t *buffer, size_t size,
-    uint8_t *mic)
-{
-	if ((!key) || (!buffer))
-		return EINVAL;
-
-	if (!mic)
-		return ENOMEM;
-
-	uint32_t l = uint32le_from_seq(key);
-	uint32_t r = uint32le_from_seq(key + 4);
-
-	ieee80211_data_header_t *data_header =
-	    (ieee80211_data_header_t *) buffer;
-
-	uint8_t *data = buffer + sizeof(ieee80211_data_header_t) +
-	    IEEE80211_TKIP_HEADER_LENGTH;
-	size_t data_size = size - sizeof(ieee80211_data_header_t) -
-	    IEEE80211_TKIP_HEADER_LENGTH;
-
-	/* Process header. */
-	uint8_t *src_addr =
-	    ieee80211_is_fromds_frame(data_header->frame_ctrl) ?
-	    data_header->address3 : data_header->address2;
-	uint8_t *dest_addr =
-	    ieee80211_is_tods_frame(data_header->frame_ctrl) ?
-	    data_header->address3 : data_header->address1;
-
-	ieee80211_michael_mic_block(&l, &r, uint32le_from_seq(dest_addr));
-	ieee80211_michael_mic_block(&l, &r,
-	    uint16le_from_seq(dest_addr + 4) |
-	    (uint16le_from_seq(src_addr) << 16));
-	ieee80211_michael_mic_block(&l, &r, uint32le_from_seq(src_addr + 2));
-	ieee80211_michael_mic_block(&l, &r, 0);
-
-	/* Process data. */
-	size_t blocks = data_size / 4;
-	size_t pad = data_size % 4;
-
-	for (size_t k = 0; k < blocks; k++) {
-		ieee80211_michael_mic_block(&l, &r,
-		    uint32le_from_seq(&data[k * 4]));
-	}
-
-	/* Add padding. */
-	uint32_t value = 0x5a;
-	for (size_t i = pad; i > 0; i--) {
-		value <<= 8;
-		value |= data[blocks * 4 + (i - 1)];
-	}
-
-	ieee80211_michael_mic_block(&l, &r, value);
-	ieee80211_michael_mic_block(&l, &r, 0);
-
-	l = host2uint32_t_le(l);
-	r = host2uint32_t_le(r);
-
-	memcpy(mic, &l, 4);
-	memcpy(mic + 4, &r, 4);
-
-	return EOK;
-}
-
-uint16_t uint16le_from_seq(void *seq)
-{
-	uint16_t *u16 = (uint16_t *) seq;
-	return uint16_t_le2host(*u16);
-}
-
-uint32_t uint32le_from_seq(void *seq)
-{
-	uint32_t *u32 = (uint32_t *) seq;
-	return uint32_t_le2host(*u32);
-}
-
-uint16_t uint16be_from_seq(void *seq)
-{
-	uint16_t *u16 = (uint16_t *) seq;
-	return uint16_t_be2host(*u16);
-}
-
-uint32_t uint32be_from_seq(void *seq)
-{
-	uint32_t *u32 = (uint32_t *) seq;
-	return uint32_t_be2host(*u32);
-}
-
-errno_t rnd_sequence(uint8_t *sequence, size_t length)
-{
-	if (!sequence)
-		return ENOMEM;
-
-	for (size_t i = 0; i < length; i++)
-		sequence[i] = (uint8_t) rand();
-
-	return EOK;
-}
-
-uint8_t *min_sequence(uint8_t *seq1, uint8_t *seq2, size_t size)
-{
-	if ((!seq1) || (!seq2))
-		return NULL;
-
-	for (size_t i = 0; i < size; i++) {
-		if (seq1[i] < seq2[i])
-			return seq1;
-		else if (seq1[i] > seq2[i])
-			return seq2;
-	}
-
-	return seq1;
-}
-
-uint8_t *max_sequence(uint8_t *seq1, uint8_t *seq2, size_t size)
-{
-	uint8_t *min = min_sequence(seq1, seq2, size);
-	if (min == seq1)
-		return seq2;
-
-	return seq1;
-}
-
-/** @}
- */
Index: pace/lib/inet/doc/doxygroups.h
===================================================================
--- uspace/lib/inet/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libinet libinet
- * @ingroup libs
- */
Index: pace/lib/inet/include/inet/addr.h
===================================================================
--- uspace/lib/inet/include/inet/addr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_ADDR_H
-#define LIBINET_INET_ADDR_H
-
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <stdint.h>
-
-typedef uint32_t addr32_t;
-
-typedef uint8_t addr128_t[16];
-
-typedef enum {
-	/** Any IP protocol version */
-	ip_any,
-	/** IPv4 */
-	ip_v4,
-	/** IPv6 */
-	ip_v6
-} ip_ver_t;
-
-/** Node address */
-typedef struct {
-	/** IP version */
-	ip_ver_t version;
-	union {
-		addr32_t addr;
-		addr128_t addr6;
-	};
-} inet_addr_t;
-
-/** Network address */
-typedef struct {
-	/** IP version */
-	ip_ver_t version;
-
-	/** Address */
-	union {
-		addr32_t addr;
-		addr128_t addr6;
-	};
-
-	/** Number of valid bits */
-	uint8_t prefix;
-} inet_naddr_t;
-
-extern const addr32_t addr32_broadcast_all_hosts;
-
-extern void addr128(const addr128_t, addr128_t);
-
-extern int addr128_compare(const addr128_t, const addr128_t);
-extern void eth_addr_solicited_node(const addr128_t, eth_addr_t *);
-
-extern void host2addr128_t_be(const addr128_t, addr128_t);
-extern void addr128_t_be2host(const addr128_t, addr128_t);
-
-extern void inet_addr(inet_addr_t *, uint8_t, uint8_t, uint8_t, uint8_t);
-extern void inet_naddr(inet_naddr_t *, uint8_t, uint8_t, uint8_t, uint8_t,
-    uint8_t);
-
-extern void inet_addr6(inet_addr_t *, uint16_t, uint16_t, uint16_t, uint16_t,
-    uint16_t, uint16_t, uint16_t, uint16_t);
-extern void inet_naddr6(inet_naddr_t *, uint16_t, uint16_t, uint16_t, uint16_t,
-    uint16_t, uint16_t, uint16_t, uint16_t, uint8_t);
-
-extern void inet_naddr_addr(const inet_naddr_t *, inet_addr_t *);
-extern void inet_addr_naddr(const inet_addr_t *, uint8_t, inet_naddr_t *);
-
-extern void inet_addr_any(inet_addr_t *);
-extern void inet_naddr_any(inet_naddr_t *);
-
-extern int inet_addr_compare(const inet_addr_t *, const inet_addr_t *);
-extern int inet_addr_is_any(const inet_addr_t *);
-
-extern int inet_naddr_compare(const inet_naddr_t *, const inet_addr_t *);
-extern int inet_naddr_compare_mask(const inet_naddr_t *, const inet_addr_t *);
-
-extern errno_t inet_addr_parse(const char *, inet_addr_t *, char **);
-extern errno_t inet_naddr_parse(const char *, inet_naddr_t *, char **);
-
-extern errno_t inet_addr_format(const inet_addr_t *, char **);
-extern errno_t inet_naddr_format(const inet_naddr_t *, char **);
-
-extern ip_ver_t inet_addr_get(const inet_addr_t *, addr32_t *, addr128_t *);
-extern ip_ver_t inet_naddr_get(const inet_naddr_t *, addr32_t *, addr128_t *,
-    uint8_t *);
-
-extern void inet_addr_set(addr32_t, inet_addr_t *);
-extern void inet_naddr_set(addr32_t, uint8_t, inet_naddr_t *);
-
-extern void inet_addr_set6(addr128_t, inet_addr_t *);
-extern void inet_naddr_set6(addr128_t, uint8_t, inet_naddr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/dhcp.h
===================================================================
--- uspace/lib/inet/include/inet/dhcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_DHCP_H
-#define LIBINET_INET_DHCP_H
-
-#include <types/common.h>
-
-extern errno_t dhcp_init(void);
-extern errno_t dhcp_link_add(sysarg_t);
-extern errno_t dhcp_link_remove(sysarg_t);
-extern errno_t dhcp_discover(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/dnsr.h
===================================================================
--- uspace/lib/inet/include/inet/dnsr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_DNSR_H
-#define LIBINET_INET_DNSR_H
-
-#include <inet/inet.h>
-#include <inet/addr.h>
-
-enum {
-	DNSR_NAME_MAX_SIZE = 255
-};
-
-typedef struct {
-	/** Host canonical name */
-	char *cname;
-	/** Host address */
-	inet_addr_t addr;
-} dnsr_hostinfo_t;
-
-extern errno_t dnsr_init(void);
-extern errno_t dnsr_name2host(const char *, dnsr_hostinfo_t **, ip_ver_t);
-extern void dnsr_hostinfo_destroy(dnsr_hostinfo_t *);
-extern errno_t dnsr_get_srvaddr(inet_addr_t *);
-extern errno_t dnsr_set_srvaddr(inet_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/endpoint.h
===================================================================
--- uspace/lib/inet/include/inet/endpoint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_ENDPOINT_H
-#define LIBINET_INET_ENDPOINT_H
-
-#include <stdint.h>
-#include <inet/addr.h>
-#include <loc.h>
-
-/** Internet port number ranges
- *
- * Port number ranges per RFC 6335 section 6 (Port Number Ranges.
- * Technically port zero is a system port. But since it is reserved,
- * we will use it as a special value denoting no port is specified
- * and we will exclude it from the system port range to disallow
- * ever assigning it.
- */
-enum inet_port_ranges {
-	/** Special value meaning no specific port */
-	inet_port_any = 0,
-	/** Lowest system port (a.k.a. well known port) */
-	inet_port_sys_lo = 1,
-	/** Highest system port (a.k.a. well known port) */
-	inet_port_sys_hi = 1023,
-	/** Lowest user port (a.k.a. registered port) */
-	inet_port_user_lo = 1024,
-	/** Highest user port (a.k.a. registered port) */
-	inet_port_user_hi = 49151,
-	/** Lowest dynamic port (a.k.a. private or ephemeral port) */
-	inet_port_dyn_lo = 49152,
-	/** Highest dynamic port (a.k.a. private or ephemeral port) */
-	inet_port_dyn_hi = 65535
-};
-
-/** Internet endpoint (address-port pair), a.k.a. socket */
-typedef struct {
-	inet_addr_t addr;
-	uint16_t port;
-} inet_ep_t;
-
-/** Internet endpoint pair */
-typedef struct {
-	service_id_t local_link;
-	inet_ep_t local;
-	inet_ep_t remote;
-} inet_ep2_t;
-
-extern void inet_ep_init(inet_ep_t *);
-extern void inet_ep2_init(inet_ep2_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/eth_addr.h
===================================================================
--- uspace/lib/inet/include/inet/eth_addr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef LIBINET_INET_ETH_ADDR_H
-#define LIBINET_INET_ETH_ADDR_H
-
-#include <stdint.h>
-
-#define ETH_ADDR_SIZE 6
-#define ETH_ADDR_STR_SIZE (6 * 2 + 5)
-
-#define ETH_ADDR_INITIALIZER(aa, bb, cc, dd, ee, ff) \
-    { .a = ((uint64_t)(aa) << 40) | ((uint64_t)(bb) << 32) | \
-    ((uint64_t)(cc) << 24) | ((uint64_t)(dd) << 16) | \
-    ((uint64_t)(ee) << 8) | (ff) }
-
-/** Ethernet address.
- *
- * Defined as a structure. This provides strong type checking.
- *
- * Since the structure is not opaque, this allows eth_addr_t to be
- * allocated statically and copied around using the assignment operator.
- *
- * It is stored in the lower 48 bits of a 64-bit integer. This is an internal
- * representation that allows simple and efficient operation. Most CPUs
- * will be much faster (and we will need less instructions) operating
- * on a single 64-bit integer than on six individual 8-bit integers.
- *
- * Kind reader will appreciate the cleverness and elegance of this
- * representation.
- */
-typedef struct {
-	uint64_t a;
-} eth_addr_t;
-
-/** Ethernet address in the form of a string */
-typedef struct {
-	char str[ETH_ADDR_STR_SIZE + 1];
-} eth_addr_str_t;
-
-extern const eth_addr_t eth_addr_broadcast;
-
-extern void eth_addr_encode(eth_addr_t *, uint8_t *);
-extern void eth_addr_decode(const uint8_t *, eth_addr_t *);
-
-extern int eth_addr_compare(const eth_addr_t *, const eth_addr_t *);
-extern void eth_addr_format(eth_addr_t *, eth_addr_str_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/host.h
===================================================================
--- uspace/lib/inet/include/inet/host.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_HOST_H
-#define LIBINET_INET_HOST_H
-
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <types/inet/hostport.h>
-
-extern errno_t inet_host_parse(const char *, inet_host_t **, char **);
-extern errno_t inet_host_format(inet_host_t *, char **);
-extern void inet_host_destroy(inet_host_t *);
-extern errno_t inet_host_lookup_one(inet_host_t *, ip_ver_t, inet_addr_t *);
-extern errno_t inet_host_plookup_one(const char *, ip_ver_t, inet_addr_t *,
-    char **, const char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/hostname.h
===================================================================
--- uspace/lib/inet/include/inet/hostname.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_HOSTNAME_H
-#define LIBINET_INET_HOSTNAME_H
-
-extern errno_t inet_hostname_parse(const char *, char **, char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/hostport.h
===================================================================
--- uspace/lib/inet/include/inet/hostport.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_HOSTPORT_H
-#define LIBINET_INET_HOSTPORT_H
-
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <types/inet/hostport.h>
-
-extern errno_t inet_hostport_parse(const char *, inet_hostport_t **, char **);
-extern errno_t inet_hostport_format(inet_hostport_t *, char **);
-extern void inet_hostport_destroy(inet_hostport_t *);
-extern errno_t inet_hostport_lookup_one(inet_hostport_t *, ip_ver_t, inet_ep_t *);
-extern errno_t inet_hostport_plookup_one(const char *, ip_ver_t, inet_ep_t *,
-    char **, const char **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/inet.h
===================================================================
--- uspace/lib/inet/include/inet/inet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_INET_H
-#define LIBINET_INET_INET_H
-
-#include <inet/addr.h>
-#include <ipc/loc.h>
-#include <stdint.h>
-#include <types/inet.h>
-
-extern errno_t inet_init(uint8_t, inet_ev_ops_t *);
-extern errno_t inet_send(inet_dgram_t *, uint8_t, inet_df_t);
-extern errno_t inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/inetcfg.h
===================================================================
--- uspace/lib/inet/include/inet/inetcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_INETCFG_H
-#define LIBINET_INET_INETCFG_H
-
-#include <inet/inet.h>
-#include <stddef.h>
-#include <types/inetcfg.h>
-
-extern errno_t inetcfg_init(void);
-extern errno_t inetcfg_addr_create_static(const char *, inet_naddr_t *, sysarg_t, sysarg_t *);
-extern errno_t inetcfg_addr_delete(sysarg_t);
-extern errno_t inetcfg_addr_get(sysarg_t, inet_addr_info_t *);
-extern errno_t inetcfg_addr_get_id(const char *, sysarg_t, sysarg_t *);
-extern errno_t inetcfg_get_addr_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_get_link_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_get_sroute_list(sysarg_t **, size_t *);
-extern errno_t inetcfg_link_add(sysarg_t);
-extern errno_t inetcfg_link_get(sysarg_t, inet_link_info_t *);
-extern errno_t inetcfg_link_remove(sysarg_t);
-extern errno_t inetcfg_sroute_get(sysarg_t, inet_sroute_info_t *);
-extern errno_t inetcfg_sroute_get_id(const char *, sysarg_t *);
-extern errno_t inetcfg_sroute_create(const char *, inet_naddr_t *, inet_addr_t *,
-    sysarg_t *);
-extern errno_t inetcfg_sroute_delete(sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/inetping.h
===================================================================
--- uspace/lib/inet/include/inet/inetping.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_INETPING_H
-#define LIBINET_INET_INETPING_H
-
-#include <inet/inet.h>
-#include <types/inetping.h>
-
-typedef struct inetping_ev_ops {
-	errno_t (*recv)(inetping_sdu_t *);
-} inetping_ev_ops_t;
-
-extern errno_t inetping_init(inetping_ev_ops_t *);
-extern errno_t inetping_send(inetping_sdu_t *);
-extern errno_t inetping_get_srcaddr(const inet_addr_t *, inet_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/iplink.h
===================================================================
--- uspace/lib/inet/include/inet/iplink.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_IPLINK_H
-#define LIBINET_INET_IPLINK_H
-
-#include <async.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-
-struct iplink_ev_ops;
-
-typedef struct {
-	async_sess_t *sess;
-	struct iplink_ev_ops *ev_ops;
-	void *arg;
-} iplink_t;
-
-/** IPv4 link Service Data Unit */
-typedef struct {
-	/** Local source address */
-	addr32_t src;
-	/** Local destination address */
-	addr32_t dest;
-	/** Serialized IP packet */
-	void *data;
-	/** Size of @c data in bytes */
-	size_t size;
-} iplink_sdu_t;
-
-/** IPv6 link Service Data Unit */
-typedef struct {
-	/** Local MAC destination address */
-	eth_addr_t dest;
-	/** Serialized IP packet */
-	void *data;
-	/** Size of @c data in bytes */
-	size_t size;
-} iplink_sdu6_t;
-
-/** Internet link receive Service Data Unit */
-typedef struct {
-	/** Serialized datagram */
-	void *data;
-	/** Size of @c data in bytes */
-	size_t size;
-} iplink_recv_sdu_t;
-
-typedef struct iplink_ev_ops {
-	errno_t (*recv)(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
-	errno_t (*change_addr)(iplink_t *, eth_addr_t *);
-} iplink_ev_ops_t;
-
-extern errno_t iplink_open(async_sess_t *, iplink_ev_ops_t *, void *, iplink_t **);
-extern void iplink_close(iplink_t *);
-extern errno_t iplink_send(iplink_t *, iplink_sdu_t *);
-extern errno_t iplink_send6(iplink_t *, iplink_sdu6_t *);
-extern errno_t iplink_addr_add(iplink_t *, inet_addr_t *);
-extern errno_t iplink_addr_remove(iplink_t *, inet_addr_t *);
-extern errno_t iplink_get_mtu(iplink_t *, size_t *);
-extern errno_t iplink_get_mac48(iplink_t *, eth_addr_t *);
-extern errno_t iplink_set_mac48(iplink_t *, eth_addr_t *);
-extern void *iplink_get_userptr(iplink_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/iplink_srv.h
===================================================================
--- uspace/lib/inet/include/inet/iplink_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_IPLINK_SRV_H
-#define LIBINET_INET_IPLINK_SRV_H
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink.h>
-#include <stdbool.h>
-
-struct iplink_ops;
-
-typedef struct {
-	fibril_mutex_t lock;
-	bool connected;
-	struct iplink_ops *ops;
-	void *arg;
-	async_sess_t *client_sess;
-} iplink_srv_t;
-
-typedef struct iplink_ops {
-	errno_t (*open)(iplink_srv_t *);
-	errno_t (*close)(iplink_srv_t *);
-	errno_t (*send)(iplink_srv_t *, iplink_sdu_t *);
-	errno_t (*send6)(iplink_srv_t *, iplink_sdu6_t *);
-	errno_t (*get_mtu)(iplink_srv_t *, size_t *);
-	errno_t (*get_mac48)(iplink_srv_t *, eth_addr_t *);
-	errno_t (*set_mac48)(iplink_srv_t *, eth_addr_t *);
-	errno_t (*addr_add)(iplink_srv_t *, inet_addr_t *);
-	errno_t (*addr_remove)(iplink_srv_t *, inet_addr_t *);
-} iplink_ops_t;
-
-extern void iplink_srv_init(iplink_srv_t *);
-
-extern errno_t iplink_conn(ipc_call_t *, void *);
-extern errno_t iplink_ev_recv(iplink_srv_t *, iplink_recv_sdu_t *, ip_ver_t);
-extern errno_t iplink_ev_change_addr(iplink_srv_t *, eth_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/tcp.h
===================================================================
--- uspace/lib/inet/include/inet/tcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_TCP_H
-#define LIBINET_INET_TCP_H
-
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/inet.h>
-
-/** TCP connection */
-typedef struct {
-	fibril_mutex_t lock;
-	fibril_condvar_t cv;
-	struct tcp *tcp;
-	link_t ltcp;
-	sysarg_t id;
-	struct tcp_cb *cb;
-	void *cb_arg;
-	/** Some received data available in TCP server */
-	bool data_avail;
-	bool connected;
-	bool conn_failed;
-	bool conn_reset;
-} tcp_conn_t;
-
-/** TCP connection listener */
-typedef struct {
-	struct tcp *tcp;
-	link_t ltcp;
-	sysarg_t id;
-	struct tcp_listen_cb *lcb;
-	void *lcb_arg;
-	struct tcp_cb *cb;
-	void *cb_arg;
-} tcp_listener_t;
-
-/** TCP connection callbacks */
-typedef struct tcp_cb {
-	void (*connected)(tcp_conn_t *);
-	void (*conn_failed)(tcp_conn_t *);
-	void (*conn_reset)(tcp_conn_t *);
-	void (*data_avail)(tcp_conn_t *);
-	void (*urg_data)(tcp_conn_t *);
-} tcp_cb_t;
-
-/** TCP listener callbacks */
-typedef struct tcp_listen_cb {
-	void (*new_conn)(tcp_listener_t *, tcp_conn_t *);
-} tcp_listen_cb_t;
-
-/** TCP service */
-typedef struct tcp {
-	/** TCP session */
-	async_sess_t *sess;
-	/** List of connections */
-	list_t conn; /* of tcp_conn_t */
-	/** List of listeners */
-	list_t listener; /* of tcp_listener_t */
-	/** TCP service lock */
-	fibril_mutex_t lock;
-	/** For waiting on cb_done */
-	fibril_condvar_t cv;
-	/** Set to @a true when callback connection handler has terminated */
-	bool cb_done;
-} tcp_t;
-
-extern errno_t tcp_create(tcp_t **);
-extern void tcp_destroy(tcp_t *);
-extern errno_t tcp_conn_create(tcp_t *, inet_ep2_t *, tcp_cb_t *, void *,
-    tcp_conn_t **);
-extern void tcp_conn_destroy(tcp_conn_t *);
-extern void *tcp_conn_userptr(tcp_conn_t *);
-extern errno_t tcp_listener_create(tcp_t *, inet_ep_t *, tcp_listen_cb_t *, void *,
-    tcp_cb_t *, void *, tcp_listener_t **);
-extern void tcp_listener_destroy(tcp_listener_t *);
-extern void *tcp_listener_userptr(tcp_listener_t *);
-
-extern errno_t tcp_conn_wait_connected(tcp_conn_t *);
-extern errno_t tcp_conn_send(tcp_conn_t *, const void *, size_t);
-extern errno_t tcp_conn_send_fin(tcp_conn_t *);
-extern errno_t tcp_conn_push(tcp_conn_t *);
-extern errno_t tcp_conn_reset(tcp_conn_t *);
-
-extern errno_t tcp_conn_recv(tcp_conn_t *, void *, size_t, size_t *);
-extern errno_t tcp_conn_recv_wait(tcp_conn_t *, void *, size_t, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/inet/udp.h
===================================================================
--- uspace/lib/inet/include/inet/udp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_INET_UDP_H
-#define LIBINET_INET_UDP_H
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/inet.h>
-#include <stdbool.h>
-
-/** UDP link state */
-typedef enum {
-	udp_ls_down,
-	udp_ls_up
-} udp_link_state_t;
-
-/** UDP received message */
-typedef struct {
-	struct udp *udp;
-	sysarg_t assoc_id;
-	size_t size;
-	inet_ep_t remote_ep;
-} udp_rmsg_t;
-
-/** UDP received error */
-typedef struct {
-} udp_rerr_t;
-
-/** UDP association */
-typedef struct {
-	struct udp *udp;
-	link_t ludp;
-	sysarg_t id;
-	struct udp_cb *cb;
-	void *cb_arg;
-} udp_assoc_t;
-
-/** UDP callbacks */
-typedef struct udp_cb {
-	void (*recv_msg)(udp_assoc_t *, udp_rmsg_t *);
-	void (*recv_err)(udp_assoc_t *, udp_rerr_t *);
-	void (*link_state)(udp_assoc_t *, udp_link_state_t);
-} udp_cb_t;
-
-/** UDP service */
-typedef struct udp {
-	/** UDP session */
-	async_sess_t *sess;
-	/** List of associations */
-	list_t assoc; /* of udp_assoc_t */
-	/** UDP service lock */
-	fibril_mutex_t lock;
-	/** For waiting on cb_done */
-	fibril_condvar_t cv;
-	/** Set to @a true when callback connection handler has terminated */
-	bool cb_done;
-} udp_t;
-
-extern errno_t udp_create(udp_t **);
-extern void udp_destroy(udp_t *);
-extern errno_t udp_assoc_create(udp_t *, inet_ep2_t *, udp_cb_t *, void *,
-    udp_assoc_t **);
-extern errno_t udp_assoc_set_nolocal(udp_assoc_t *);
-extern void udp_assoc_destroy(udp_assoc_t *);
-extern errno_t udp_assoc_send_msg(udp_assoc_t *, inet_ep_t *, void *, size_t);
-extern void *udp_assoc_userptr(udp_assoc_t *);
-extern size_t udp_rmsg_size(udp_rmsg_t *);
-extern errno_t udp_rmsg_read(udp_rmsg_t *, size_t, void *, size_t);
-extern void udp_rmsg_remote_ep(udp_rmsg_t *, inet_ep_t *);
-extern uint8_t udp_rerr_type(udp_rerr_t *);
-extern uint8_t udp_rerr_code(udp_rerr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/ipc/dhcp.h
===================================================================
--- uspace/lib/inet/include/ipc/dhcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_IPC_DHCP_H
-#define LIBINET_IPC_DHCP_H
-
-#include <ipc/common.h>
-
-/** DHCP service requests */
-typedef enum {
-	DHCP_LINK_ADD = IPC_FIRST_USER_METHOD,
-	DHCP_LINK_REMOVE,
-	DHCP_DISCOVER
-} dhcp_request_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/inet/include/ipc/dnsr.h
===================================================================
--- uspace/lib/inet/include/ipc/dnsr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-
-#ifndef LIBINET_IPC_DNSR_H
-#define LIBINET_IPC_DNSR_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	DNSR_NAME2HOST = IPC_FIRST_USER_METHOD,
-	DNSR_GET_SRVADDR,
-	DNSR_SET_SRVADDR
-} dnsr_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/ipc/inet.h
===================================================================
--- uspace/lib/inet/include/ipc/inet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_IPC_INET_H
-#define LIBINET_IPC_INET_H
-
-#include <ipc/common.h>
-
-/** Requests on Inet default port */
-typedef enum {
-	INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	INET_GET_SRCADDR,
-	INET_SEND,
-	INET_SET_PROTO
-} inet_request_t;
-
-/** Events on Inet default port */
-typedef enum {
-	INET_EV_RECV = IPC_FIRST_USER_METHOD
-} inet_event_t;
-
-/** Requests on Inet configuration port */
-typedef enum {
-	INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD,
-	INETCFG_ADDR_DELETE,
-	INETCFG_ADDR_GET,
-	INETCFG_ADDR_GET_ID,
-	INETCFG_GET_ADDR_LIST,
-	INETCFG_GET_LINK_LIST,
-	INETCFG_GET_SROUTE_LIST,
-	INETCFG_LINK_ADD,
-	INETCFG_LINK_GET,
-	INETCFG_LINK_REMOVE,
-	INETCFG_SROUTE_CREATE,
-	INETCFG_SROUTE_DELETE,
-	INETCFG_SROUTE_GET,
-	INETCFG_SROUTE_GET_ID
-} inetcfg_request_t;
-
-/** Events on Inet ping port */
-typedef enum {
-	INETPING_EV_RECV = IPC_FIRST_USER_METHOD
-} inetping_event_t;
-
-/** Requests on Inet ping port */
-typedef enum {
-	INETPING_SEND = IPC_FIRST_USER_METHOD,
-	INETPING_GET_SRCADDR
-} inetping_request_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/inet/include/ipc/iplink.h
===================================================================
--- uspace/lib/inet/include/ipc/iplink.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_IPC_IPLINK_H
-#define LIBINET_IPC_IPLINK_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	IPLINK_GET_MTU = IPC_FIRST_USER_METHOD,
-	IPLINK_GET_MAC48,
-	IPLINK_SET_MAC48,
-	IPLINK_SEND,
-	IPLINK_SEND6,
-	IPLINK_ADDR_ADD,
-	IPLINK_ADDR_REMOVE
-} iplink_request_t;
-
-typedef enum {
-	IPLINK_EV_RECV = IPC_FIRST_USER_METHOD,
-	IPLINK_EV_CHANGE_ADDR,
-} iplink_event_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/inet/include/ipc/tcp.h
===================================================================
--- uspace/lib/inet/include/ipc/tcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_IPC_TCP_H
-#define LIBINET_IPC_TCP_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	TCP_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	TCP_CONN_CREATE,
-	TCP_CONN_DESTROY,
-	TCP_LISTENER_CREATE,
-	TCP_LISTENER_DESTROY,
-	TCP_CONN_SEND,
-	TCP_CONN_SEND_FIN,
-	TCP_CONN_PUSH,
-	TCP_CONN_RESET,
-	TCP_CONN_RECV,
-	TCP_CONN_RECV_WAIT
-} tcp_request_t;
-
-typedef enum {
-	TCP_EV_CONNECTED = IPC_FIRST_USER_METHOD,
-	TCP_EV_CONN_FAILED,
-	TCP_EV_CONN_RESET,
-	TCP_EV_DATA,
-	TCP_EV_URG_DATA,
-	TCP_EV_NEW_CONN
-} tcp_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/ipc/udp.h
===================================================================
--- uspace/lib/inet/include/ipc/udp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_IPC_UDP_H
-#define LIBINET_IPC_UDP_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	UDP_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	UDP_ASSOC_CREATE,
-	UDP_ASSOC_DESTROY,
-	UDP_ASSOC_SET_NOLOCAL,
-	UDP_ASSOC_SEND_MSG,
-	UDP_RMSG_INFO,
-	UDP_RMSG_READ,
-	UDP_RMSG_DISCARD
-} udp_request_t;
-
-typedef enum {
-	UDP_EV_DATA = IPC_FIRST_USER_METHOD
-} udp_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/types/inet.h
===================================================================
--- uspace/lib/inet/include/types/inet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_TYPES_INET_H
-#define LIBINET_TYPES_INET_H
-
-#include <inet/addr.h>
-#include <ipc/loc.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define INET_TTL_MAX 255
-
-typedef struct {
-	/** Local IP link service ID (optional) */
-	service_id_t iplink;
-	inet_addr_t src;
-	inet_addr_t dest;
-	uint8_t tos;
-	void *data;
-	size_t size;
-} inet_dgram_t;
-
-typedef struct {
-	errno_t (*recv)(inet_dgram_t *);
-} inet_ev_ops_t;
-
-typedef enum {
-	INET_DF = 1
-} inet_df_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/types/inet/host.h
===================================================================
--- uspace/lib/inet/include/types/inet/host.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINETTYPES_INET_HOST_H
-#define LIBINETTYPES_INET_HOST_H
-
-#include <inet/addr.h>
-
-typedef enum {
-	/** Host name */
-	inet_host_name,
-	/** Host address */
-	inet_host_addr
-} inet_host_form_t;
-
-/** Internet host:port specification
- *
- * As in RFC 1738 Uniform Resouce Locators (URL) and RFC 2732 Format for
- * literal IPv6 Addresses in URLs
- */
-typedef struct {
-	/** Host form */
-	inet_host_form_t hform;
-
-	union {
-		/** Host name */
-		char *name;
-		/** Host address */
-		inet_addr_t addr;
-	} host;
-} inet_host_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/types/inet/hostport.h
===================================================================
--- uspace/lib/inet/include/types/inet/hostport.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_TYPES_INET_HOSTPORT_H
-#define LIBINET_TYPES_INET_HOSTPORT_H
-
-#include <inet/addr.h>
-#include <stdint.h>
-#include <types/inet/host.h>
-
-/** Internet host:port specification
- *
- * As in RFC 1738 Uniform Resouce Locators (URL) and RFC 2732 Format for
- * literal IPv6 Addresses in URLs
- */
-typedef struct {
-	/** Host form */
-	inet_host_form_t hform;
-
-	union {
-		/** Host name */
-		char *name;
-		/** Host address */
-		inet_addr_t addr;
-	} host;
-
-	/** Port number of 0 if omitted */
-	uint16_t port;
-} inet_hostport_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/types/inetcfg.h
===================================================================
--- uspace/lib/inet/include/types/inetcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#ifndef LIBINET_TYPES_INETCFG_H
-#define LIBINET_TYPES_INETCFG_H
-
-#include <inet/eth_addr.h>
-#include <inet/inet.h>
-#include <stddef.h>
-
-/** Address object info */
-typedef struct {
-	/** Network address */
-	inet_naddr_t naddr;
-	/** Link service ID */
-	sysarg_t ilink;
-	/** Address object name */
-	char *name;
-} inet_addr_info_t;
-
-/** IP link info */
-typedef struct {
-	/** Link service name */
-	char *name;
-	/** Default MTU */
-	size_t def_mtu;
-	/** Link layer address */
-	eth_addr_t mac_addr;
-} inet_link_info_t;
-
-/** Static route info */
-typedef struct {
-	/** Destination network address */
-	inet_naddr_t dest;
-	/** Router address */
-	inet_addr_t router;
-	/** Static route name */
-	char *name;
-} inet_sroute_info_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/include/types/inetping.h
===================================================================
--- uspace/lib/inet/include/types/inetping.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef LIBINET_TYPES_INETPING_H
-#define LIBINET_TYPES_INETPING_H
-
-#include <inet/addr.h>
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct {
-	inet_addr_t src;
-	inet_addr_t dest;
-	uint16_t seq_no;
-	void *data;
-	size_t size;
-} inetping_sdu_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/inet/meson.build
===================================================================
--- uspace/lib/inet/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/addr.c',
-	'src/dhcp.c',
-	'src/dnsr.c',
-	'src/endpoint.c',
-	'src/eth_addr.c',
-	'src/host.c',
-	'src/hostname.c',
-	'src/hostport.c',
-	'src/inet.c',
-	'src/inetcfg.c',
-	'src/inetping.c',
-	'src/iplink.c',
-	'src/iplink_srv.c',
-	'src/tcp.c',
-	'src/udp.c',
-)
-
-test_src = files(
-	'test/addr.c',
-	'test/eth_addr.c',
-	'test/main.c',
-)
Index: pace/lib/inet/src/addr.c
===================================================================
--- uspace/lib/inet/src/addr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,724 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2013 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file Internet address parsing and formatting.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <bitops.h>
-#include <inttypes.h>
-#include <str.h>
-
-#define INET_PREFIXSTRSIZE  5
-
-#define INET6_ADDRSTRLEN (8 * 4 + 7 + 1)
-
-#if !(defined(__BE__) ^ defined(__LE__))
-#error The architecture must be either big-endian or little-endian.
-#endif
-
-const addr32_t addr32_broadcast_all_hosts = 0xffffffff;
-
-static eth_addr_t inet_eth_addr_solicited_node =
-    ETH_ADDR_INITIALIZER(0x33, 0x33, 0xff, 0, 0, 0);
-
-static const inet_addr_t inet_addr_any_addr = {
-	.version = ip_v4,
-	.addr = 0
-};
-
-static const inet_addr_t inet_addr_any_addr6 = {
-	.version = ip_v6,
-	.addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-};
-
-void addr128(const addr128_t src, addr128_t dst)
-{
-	memcpy(dst, src, 16);
-}
-
-/** Compare addr128.
- *
- * @return Non-zero if equal, zero if not equal.
- */
-int addr128_compare(const addr128_t a, const addr128_t b)
-{
-	return memcmp(a, b, 16) == 0;
-}
-
-/** Compute solicited node MAC multicast address from target IPv6 address
- *
- * @param ip  Target IPv6 address
- * @param mac Solicited MAC address to be assigned
- *
- */
-void eth_addr_solicited_node(const addr128_t ip, eth_addr_t *mac)
-{
-	uint8_t b[6];
-	mac->a = inet_eth_addr_solicited_node.a;
-
-	eth_addr_encode(&inet_eth_addr_solicited_node, b);
-	memcpy(&b[3], ip + 13, 3);
-	eth_addr_decode(b, mac);
-}
-
-void host2addr128_t_be(const addr128_t host, addr128_t be)
-{
-	memcpy(be, host, 16);
-}
-
-void addr128_t_be2host(const addr128_t be, addr128_t host)
-{
-	memcpy(host, be, 16);
-}
-
-void inet_addr(inet_addr_t *addr, uint8_t a, uint8_t b, uint8_t c, uint8_t d)
-{
-	addr->version = ip_v4;
-	addr->addr = ((addr32_t) a << 24) | ((addr32_t) b << 16) |
-	    ((addr32_t) c << 8) | ((addr32_t) d);
-}
-
-void inet_naddr(inet_naddr_t *naddr, uint8_t a, uint8_t b, uint8_t c, uint8_t d,
-    uint8_t prefix)
-{
-	naddr->version = ip_v4;
-	naddr->addr = ((addr32_t) a << 24) | ((addr32_t) b << 16) |
-	    ((addr32_t) c << 8) | ((addr32_t) d);
-	naddr->prefix = prefix;
-}
-
-void inet_addr6(inet_addr_t *addr, uint16_t a, uint16_t b, uint16_t c,
-    uint16_t d, uint16_t e, uint16_t f, uint16_t g, uint16_t h)
-{
-	addr->version = ip_v6;
-	addr->addr6[0] = (a >> 8) & 0xff;
-	addr->addr6[1] = a & 0xff;
-	addr->addr6[2] = (b >> 8) & 0xff;
-	addr->addr6[3] = b & 0xff;
-	addr->addr6[4] = (c >> 8) & 0xff;
-	addr->addr6[5] = c & 0xff;
-	addr->addr6[6] = (d >> 8) & 0xff;
-	addr->addr6[7] = d & 0xff;
-	addr->addr6[8] = (e >> 8) & 0xff;
-	addr->addr6[9] = e & 0xff;
-	addr->addr6[10] = (f >> 8) & 0xff;
-	addr->addr6[11] = f & 0xff;
-	addr->addr6[12] = (g >> 8) & 0xff;
-	addr->addr6[13] = g & 0xff;
-	addr->addr6[14] = (h >> 8) & 0xff;
-	addr->addr6[15] = h & 0xff;
-}
-
-void inet_naddr6(inet_naddr_t *naddr, uint16_t a, uint16_t b, uint16_t c,
-    uint16_t d, uint16_t e, uint16_t f, uint16_t g, uint16_t h, uint8_t prefix)
-{
-	naddr->version = ip_v6;
-	naddr->addr6[0] = (a >> 8) & 0xff;
-	naddr->addr6[1] = a & 0xff;
-	naddr->addr6[2] = (b >> 8) & 0xff;
-	naddr->addr6[3] = b & 0xff;
-	naddr->addr6[4] = (c >> 8) & 0xff;
-	naddr->addr6[5] = c & 0xff;
-	naddr->addr6[6] = (d >> 8) & 0xff;
-	naddr->addr6[7] = d & 0xff;
-	naddr->addr6[8] = (e >> 8) & 0xff;
-	naddr->addr6[9] = e & 0xff;
-	naddr->addr6[10] = (f >> 8) & 0xff;
-	naddr->addr6[11] = f & 0xff;
-	naddr->addr6[12] = (g >> 8) & 0xff;
-	naddr->addr6[13] = g & 0xff;
-	naddr->addr6[14] = (h >> 8) & 0xff;
-	naddr->addr6[15] = h & 0xff;
-	naddr->prefix = prefix;
-}
-
-void inet_naddr_addr(const inet_naddr_t *naddr, inet_addr_t *addr)
-{
-	addr->version = naddr->version;
-	memcpy(addr->addr6, naddr->addr6, 16);
-}
-
-void inet_addr_naddr(const inet_addr_t *addr, uint8_t prefix,
-    inet_naddr_t *naddr)
-{
-	naddr->version = addr->version;
-	memcpy(naddr->addr6, addr->addr6, 16);
-	naddr->prefix = prefix;
-}
-
-void inet_addr_any(inet_addr_t *addr)
-{
-	addr->version = ip_any;
-	memset(addr->addr6, 0, 16);
-}
-
-void inet_naddr_any(inet_naddr_t *naddr)
-{
-	naddr->version = ip_any;
-	memset(naddr->addr6, 0, 16);
-	naddr->prefix = 0;
-}
-
-int inet_addr_compare(const inet_addr_t *a, const inet_addr_t *b)
-{
-	if (a->version != b->version)
-		return 0;
-
-	switch (a->version) {
-	case ip_v4:
-		return (a->addr == b->addr);
-	case ip_v6:
-		return addr128_compare(a->addr6, b->addr6);
-	default:
-		return 0;
-	}
-}
-
-int inet_addr_is_any(const inet_addr_t *addr)
-{
-	return ((addr->version == ip_any) ||
-	    (inet_addr_compare(addr, &inet_addr_any_addr)) ||
-	    (inet_addr_compare(addr, &inet_addr_any_addr6)));
-}
-
-int inet_naddr_compare(const inet_naddr_t *naddr, const inet_addr_t *addr)
-{
-	if (naddr->version != addr->version)
-		return 0;
-
-	switch (naddr->version) {
-	case ip_v4:
-		return (naddr->addr == addr->addr);
-	case ip_v6:
-		return addr128_compare(naddr->addr6, addr->addr6);
-	default:
-		return 0;
-	}
-}
-
-int inet_naddr_compare_mask(const inet_naddr_t *naddr, const inet_addr_t *addr)
-{
-	if (naddr->version != addr->version)
-		return 0;
-
-	switch (naddr->version) {
-	case ip_v4:
-		if (naddr->prefix > 32)
-			return 0;
-
-		addr32_t mask =
-		    BIT_RANGE(addr32_t, 31, 31 - (naddr->prefix - 1));
-		return ((naddr->addr & mask) == (addr->addr & mask));
-	case ip_v6:
-		if (naddr->prefix > 128)
-			return 0;
-
-		size_t pos = 0;
-		for (size_t i = 0; i < 16; i++) {
-			/* Further bits do not matter */
-			if (naddr->prefix < pos)
-				break;
-
-			if (naddr->prefix - pos > 8) {
-				/* Comparison without masking */
-				if (naddr->addr6[i] != addr->addr6[i])
-					return 0;
-			} else {
-				/* Comparison with masking */
-				uint8_t mask =
-				    BIT_RANGE(uint8_t, 8, 8 - (naddr->prefix - pos - 1));
-				if ((naddr->addr6[i] & mask) != (addr->addr6[i] & mask))
-					return 0;
-			}
-
-			pos += 8;
-		}
-
-		return 1;
-	default:
-		return 0;
-	}
-}
-
-static errno_t inet_addr_parse_v4(const char *str, inet_addr_t *raddr,
-    int *prefix, char **endptr)
-{
-	uint32_t a = 0;
-	uint8_t b;
-	char *cur = (char *)str;
-	size_t i = 0;
-
-	while (i < 4) {
-		errno_t rc = str_uint8_t(cur, (const char **)&cur, 10, false, &b);
-		if (rc != EOK)
-			return rc;
-
-		a = (a << 8) + b;
-
-		i++;
-
-		if (*cur != '.')
-			break;
-
-		if (i < 4)
-			cur++;
-	}
-
-	if (prefix != NULL) {
-		if (*cur != '/')
-			return EINVAL;
-		cur++;
-
-		*prefix = strtoul(cur, &cur, 10);
-		if (*prefix > 32)
-			return EINVAL;
-	}
-
-	if (i != 4)
-		return EINVAL;
-
-	if (endptr == NULL && *cur != '\0')
-		return EINVAL;
-
-	raddr->version = ip_v4;
-	raddr->addr = a;
-
-	if (endptr != NULL)
-		*endptr = cur;
-
-	return EOK;
-}
-
-static errno_t inet_addr_parse_v6(const char *str, inet_addr_t *raddr, int *prefix,
-    char **endptr)
-{
-	uint8_t data[16];
-	int explicit_groups;
-
-	memset(data, 0, 16);
-
-	const char *cur = str;
-	size_t i = 0;
-	size_t wildcard_pos = (size_t) -1;
-	size_t wildcard_size = 0;
-
-	/* Handle initial wildcard */
-	if ((str[0] == ':') && (str[1] == ':')) {
-		cur = str + 2;
-		wildcard_pos = 0;
-		wildcard_size = 16;
-	}
-
-	while (i < 16) {
-		uint16_t bioctet;
-		const char *gend;
-		errno_t rc = str_uint16_t(cur, &gend, 16, false, &bioctet);
-		if (rc != EOK)
-			break;
-
-		data[i] = (bioctet >> 8) & 0xff;
-		data[i + 1] = bioctet & 0xff;
-
-		if (wildcard_pos != (size_t) -1) {
-			if (wildcard_size < 2)
-				return EINVAL;
-
-			wildcard_size -= 2;
-		}
-
-		i += 2;
-
-		if (*gend != ':') {
-			cur = gend;
-			break;
-		}
-
-		if (i < 16) {
-			/* Handle wildcard */
-			if (gend[1] == ':') {
-				if (wildcard_pos != (size_t) -1)
-					return EINVAL;
-
-				wildcard_pos = i;
-				wildcard_size = 16 - i;
-				cur = gend + 2;
-				continue;
-			}
-		}
-
-		cur = gend + 1;
-	}
-
-	/* Number of explicitly specified groups */
-	explicit_groups = i;
-
-	if (prefix != NULL) {
-		if (*cur != '/')
-			return EINVAL;
-		cur++;
-
-		*prefix = strtoul(cur, (char **)&cur, 10);
-		if (*prefix > 128)
-			return EINVAL;
-	}
-
-	if (endptr == NULL && *cur != '\0')
-		return EINVAL;
-
-	/* Create wildcard positions */
-	if ((wildcard_pos != (size_t) -1) && (wildcard_size > 0)) {
-		size_t wildcard_shift = 16 - wildcard_size;
-
-		for (i = wildcard_pos + wildcard_shift; i > wildcard_pos; i--) {
-			size_t j = i - 1;
-			data[j + wildcard_size] = data[j];
-			data[j] = 0;
-		}
-	} else {
-		/* Verify that all groups have been specified */
-		if (explicit_groups != 16)
-			return EINVAL;
-	}
-
-	raddr->version = ip_v6;
-	memcpy(raddr->addr6, data, 16);
-	if (endptr != NULL)
-		*endptr = (char *)cur;
-	return EOK;
-}
-
-/** Parse node address.
- *
- * Will fail if @a text contains extra characters at the and and @a endptr
- * is @c NULL.
- *
- * @param text Network address in common notation.
- * @param addr Place to store node address.
- * @param endptr Place to store pointer to next character oc @c NULL
- *
- * @return EOK on success, EINVAL if input is not in valid format.
- *
- */
-errno_t inet_addr_parse(const char *text, inet_addr_t *addr, char **endptr)
-{
-	errno_t rc;
-
-	rc = inet_addr_parse_v4(text, addr, NULL, endptr);
-	if (rc == EOK)
-		return EOK;
-
-	rc = inet_addr_parse_v6(text, addr, NULL, endptr);
-	if (rc == EOK)
-		return EOK;
-
-	return EINVAL;
-}
-
-/** Parse network address.
- *
- * Will fail if @a text contains extra characters at the and and @a endptr
- * is @c NULL.
- *
- * @param text  Network address in common notation.
- * @param naddr Place to store network address.
- * @param endptr Place to store pointer to next character oc @c NULL
- *
- * @return EOK on success, EINVAL if input is not in valid format.
- *
- */
-errno_t inet_naddr_parse(const char *text, inet_naddr_t *naddr, char **endptr)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	int prefix;
-
-	rc = inet_addr_parse_v4(text, &addr, &prefix, endptr);
-	if (rc == EOK) {
-		inet_addr_naddr(&addr, prefix, naddr);
-		return EOK;
-	}
-
-	rc = inet_addr_parse_v6(text, &addr, &prefix, endptr);
-	if (rc == EOK) {
-		inet_addr_naddr(&addr, prefix, naddr);
-		return EOK;
-	}
-
-	return EINVAL;
-}
-
-static errno_t inet_addr_format_v4(addr32_t addr, char **bufp)
-{
-	int rc;
-
-	rc = asprintf(bufp, "%u.%u.%u.%u", (addr >> 24) & 0xff,
-	    (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
-	if (rc < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
-static errno_t inet_addr_format_v6(const addr128_t addr, char **bufp)
-{
-	*bufp = (char *) malloc(INET6_ADDRSTRLEN);
-	if (*bufp == NULL)
-		return ENOMEM;
-
-	/* Find the longest zero subsequence */
-
-	uint16_t zeroes[8];
-	uint16_t bioctets[8];
-
-	for (size_t i = 8; i > 0; i--) {
-		size_t j = i - 1;
-
-		bioctets[j] = (addr[j << 1] << 8) | addr[(j << 1) + 1];
-
-		if (bioctets[j] == 0) {
-			zeroes[j] = 1;
-			if (j < 7)
-				zeroes[j] += zeroes[j + 1];
-		} else
-			zeroes[j] = 0;
-	}
-
-	size_t wildcard_pos = (size_t) -1;
-	size_t wildcard_size = 0;
-
-	for (size_t i = 0; i < 8; i++) {
-		if (zeroes[i] > wildcard_size) {
-			wildcard_pos = i;
-			wildcard_size = zeroes[i];
-		}
-	}
-
-	char *cur = *bufp;
-	size_t rest = INET6_ADDRSTRLEN;
-	bool tail_zero = false;
-	int ret;
-
-	for (size_t i = 0; i < 8; i++) {
-		if ((i == wildcard_pos) && (wildcard_size > 1)) {
-			ret = snprintf(cur, rest, ":");
-			i += wildcard_size - 1;
-			tail_zero = true;
-		} else if (i == 0) {
-			ret = snprintf(cur, rest, "%" PRIx16, bioctets[i]);
-			tail_zero = false;
-		} else {
-			ret = snprintf(cur, rest, ":%" PRIx16, bioctets[i]);
-			tail_zero = false;
-		}
-
-		if (ret < 0)
-			return EINVAL;
-
-		cur += ret;
-		rest -= ret;
-	}
-
-	if (tail_zero)
-		(void) snprintf(cur, rest, ":");
-
-	return EOK;
-}
-
-/** Format node address.
- *
- * @param addr Node address.
- * @param bufp Place to store pointer to formatted string.
- *
- * @return EOK on success.
- * @return ENOMEM if out of memory.
- * @return ENOTSUP on unsupported address family.
- *
- */
-errno_t inet_addr_format(const inet_addr_t *addr, char **bufp)
-{
-	errno_t rc;
-	int ret;
-
-	rc = ENOTSUP;
-
-	switch (addr->version) {
-	case ip_any:
-		ret = asprintf(bufp, "none");
-		if (ret < 0)
-			return ENOMEM;
-		rc = EOK;
-		break;
-	case ip_v4:
-		rc = inet_addr_format_v4(addr->addr, bufp);
-		break;
-	case ip_v6:
-		rc = inet_addr_format_v6(addr->addr6, bufp);
-		break;
-	}
-
-	return rc;
-}
-
-/** Format network address.
- *
- * @param naddr Network address.
- * @param bufp  Place to store pointer to formatted string.
- *
- * @return EOK on success.
- * @return ENOMEM if out of memory.
- * @return ENOTSUP on unsupported address family.
- *
- */
-errno_t inet_naddr_format(const inet_naddr_t *naddr, char **bufp)
-{
-	errno_t rc;
-	int ret;
-	char *astr;
-
-	rc = ENOTSUP;
-
-	switch (naddr->version) {
-	case ip_any:
-		ret = asprintf(bufp, "none");
-		if (ret < 0)
-			return ENOMEM;
-		rc = EOK;
-		break;
-	case ip_v4:
-		rc = inet_addr_format_v4(naddr->addr, &astr);
-		if (rc != EOK)
-			return ENOMEM;
-
-		ret = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
-		if (ret < 0) {
-			free(astr);
-			return ENOMEM;
-		}
-
-		rc = EOK;
-		break;
-	case ip_v6:
-		rc = inet_addr_format_v6(naddr->addr6, &astr);
-		if (rc != EOK)
-			return ENOMEM;
-
-		ret = asprintf(bufp, "%s/%" PRIu8, astr, naddr->prefix);
-		if (ret < 0) {
-			free(astr);
-			return ENOMEM;
-		}
-
-		rc = EOK;
-		break;
-	}
-
-	return rc;
-}
-
-ip_ver_t inet_addr_get(const inet_addr_t *addr, addr32_t *v4, addr128_t *v6)
-{
-	switch (addr->version) {
-	case ip_v4:
-		if (v4 != NULL)
-			*v4 = addr->addr;
-		break;
-	case ip_v6:
-		if (v6 != NULL)
-			memcpy(*v6, addr->addr6, 16);
-		break;
-	default:
-		assert(false);
-		break;
-	}
-
-	return addr->version;
-}
-
-ip_ver_t inet_naddr_get(const inet_naddr_t *naddr, addr32_t *v4, addr128_t *v6,
-    uint8_t *prefix)
-{
-	switch (naddr->version) {
-	case ip_v4:
-		if (v4 != NULL)
-			*v4 = naddr->addr;
-		if (prefix != NULL)
-			*prefix = naddr->prefix;
-		break;
-	case ip_v6:
-		if (v6 != NULL)
-			memcpy(*v6, naddr->addr6, 16);
-		if (prefix != NULL)
-			*prefix = naddr->prefix;
-		break;
-	default:
-		assert(false);
-		break;
-	}
-
-	return naddr->version;
-}
-
-void inet_addr_set(addr32_t v4, inet_addr_t *addr)
-{
-	addr->version = ip_v4;
-	addr->addr = v4;
-}
-
-void inet_naddr_set(addr32_t v4, uint8_t prefix, inet_naddr_t *naddr)
-{
-	naddr->version = ip_v4;
-	naddr->addr = v4;
-	naddr->prefix = prefix;
-}
-
-void inet_addr_set6(addr128_t v6, inet_addr_t *addr)
-{
-	addr->version = ip_v6;
-	memcpy(addr->addr6, v6, 16);
-}
-
-void inet_naddr_set6(addr128_t v6, uint8_t prefix, inet_naddr_t *naddr)
-{
-	naddr->version = ip_v6;
-	memcpy(naddr->addr6, v6, 16);
-	naddr->prefix = prefix;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/dhcp.c
===================================================================
--- uspace/lib/inet/src/dhcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <inet/dhcp.h>
-#include <ipc/dhcp.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-
-static async_sess_t *dhcp_sess = NULL;
-
-errno_t dhcp_init(void)
-{
-	service_id_t dhcp_svc;
-	errno_t rc;
-
-	assert(dhcp_sess == NULL);
-
-	rc = loc_service_get_id(SERVICE_NAME_DHCP, &dhcp_svc,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return ENOENT;
-
-	dhcp_sess = loc_service_connect(dhcp_svc, INTERFACE_DHCP,
-	    IPC_FLAG_BLOCKING);
-	if (dhcp_sess == NULL)
-		return ENOENT;
-
-	return EOK;
-}
-
-errno_t dhcp_link_add(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(dhcp_sess);
-
-	errno_t rc = async_req_1_0(exch, DHCP_LINK_ADD, link_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t dhcp_link_remove(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(dhcp_sess);
-
-	errno_t rc = async_req_1_0(exch, DHCP_LINK_REMOVE, link_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t dhcp_discover(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(dhcp_sess);
-
-	errno_t rc = async_req_1_0(exch, DHCP_DISCOVER, link_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/dnsr.c
===================================================================
--- uspace/lib/inet/src/dnsr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/dnsr.h>
-#include <ipc/dnsr.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-
-static FIBRIL_MUTEX_INITIALIZE(dnsr_sess_mutex);
-
-static async_sess_t *dnsr_sess = NULL;
-
-static async_exch_t *dnsr_exchange_begin(void)
-{
-	fibril_mutex_lock(&dnsr_sess_mutex);
-
-	if (dnsr_sess == NULL) {
-		service_id_t dnsr_svc;
-
-		(void) loc_service_get_id(SERVICE_NAME_DNSR, &dnsr_svc,
-		    IPC_FLAG_BLOCKING);
-
-		dnsr_sess = loc_service_connect(dnsr_svc, INTERFACE_DNSR,
-		    IPC_FLAG_BLOCKING);
-	}
-
-	async_sess_t *sess = dnsr_sess;
-	fibril_mutex_unlock(&dnsr_sess_mutex);
-
-	return async_exchange_begin(sess);
-}
-
-static void dnsr_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-errno_t dnsr_name2host(const char *name, dnsr_hostinfo_t **rinfo, ip_ver_t ver)
-{
-	async_exch_t *exch = dnsr_exchange_begin();
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, DNSR_NAME2HOST, (sysarg_t) ver,
-	    &answer);
-
-	errno_t rc = async_data_write_start(exch, name, str_size(name));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	dnsr_hostinfo_t *info = calloc(1, sizeof(dnsr_hostinfo_t));
-	if (info == NULL)
-		return ENOMEM;
-
-	ipc_call_t answer_addr;
-	aid_t req_addr = async_data_read(exch, &info->addr,
-	    sizeof(inet_addr_t), &answer_addr);
-
-	errno_t retval_addr;
-	async_wait_for(req_addr, &retval_addr);
-
-	if (retval_addr != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		free(info);
-		return retval_addr;
-	}
-
-	ipc_call_t answer_cname;
-	char cname_buf[DNSR_NAME_MAX_SIZE + 1];
-	aid_t req_cname = async_data_read(exch, cname_buf, DNSR_NAME_MAX_SIZE,
-	    &answer_cname);
-
-	dnsr_exchange_end(exch);
-
-	errno_t retval_cname;
-	async_wait_for(req_cname, &retval_cname);
-
-	if (retval_cname != EOK) {
-		async_forget(req);
-		free(info);
-		return retval_cname;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		async_forget(req);
-		free(info);
-		return retval;
-	}
-
-	size_t act_size = ipc_get_arg2(&answer_cname);
-	assert(act_size <= DNSR_NAME_MAX_SIZE);
-
-	cname_buf[act_size] = '\0';
-
-	info->cname = str_dup(cname_buf);
-
-	if (info->cname == NULL) {
-		free(info);
-		return ENOMEM;
-	}
-
-	*rinfo = info;
-	return EOK;
-}
-
-void dnsr_hostinfo_destroy(dnsr_hostinfo_t *info)
-{
-	if (info == NULL)
-		return;
-
-	free(info->cname);
-	free(info);
-}
-
-errno_t dnsr_get_srvaddr(inet_addr_t *srvaddr)
-{
-	async_exch_t *exch = dnsr_exchange_begin();
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, DNSR_GET_SRVADDR, &answer);
-	errno_t rc = async_data_read_start(exch, srvaddr, sizeof(inet_addr_t));
-
-	loc_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t dnsr_set_srvaddr(inet_addr_t *srvaddr)
-{
-	async_exch_t *exch = dnsr_exchange_begin();
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, DNSR_SET_SRVADDR, &answer);
-	errno_t rc = async_data_write_start(exch, srvaddr, sizeof(inet_addr_t));
-
-	loc_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/endpoint.c
===================================================================
--- uspace/lib/inet/src/endpoint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file Internet endpoint
- */
-
-#include <inet/endpoint.h>
-#include <mem.h>
-
-/** Initialize endpoint structure.
- *
- * Sets any address, any port number.
- *
- * @param ep Endpoint
- */
-void inet_ep_init(inet_ep_t *ep)
-{
-	memset(ep, 0, sizeof(*ep));
-}
-
-/** Initialize endpoint pair structure.
- *
- * Sets any address, any port number for both local and remote sides.
- *
- * @param ep2 Endpoint pair
- */
-void inet_ep2_init(inet_ep2_t *ep2)
-{
-	memset(ep2, 0, sizeof(*ep2));
-}
-
-/** @}
- */
Index: pace/lib/inet/src/eth_addr.c
===================================================================
--- uspace/lib/inet/src/eth_addr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <inet/eth_addr.h>
-#include <mem.h>
-#include <stdio.h>
-
-/** Ethernet broadcast address */
-const eth_addr_t eth_addr_broadcast =
-    ETH_ADDR_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
-
-/** Encode Ethernet address to buffer.
- *
- * Encode Ethernet address as a sequence of ETH_ADDR_SIZE bytes into a buffer.
- *
- * @param addr Ethernet address
- * @param buf Buffer (ETH_ADDR_SIZE bytes in size) to store bytes
- */
-void eth_addr_encode(eth_addr_t *addr, uint8_t *buf)
-{
-	uint64_t a;
-	int i;
-
-	a = addr->a;
-
-	for (i = 0; i < ETH_ADDR_SIZE; i++)
-		buf[i] = (a >> (40 - 8 * i)) & 0xff;
-}
-
-/** Decode Ethernet address from buffer.
- *
- * Decode Ethernet address from a buffer containing a sequence of
- * ETH_ADDR_SIZE bytes.
- *
- * @param buf Buffer (ETH_ADDR_SIZE bytes in size)
- * @param addr Place to store Ethernet address
- */
-void eth_addr_decode(const uint8_t *buf, eth_addr_t *addr)
-{
-	uint64_t a;
-	int i;
-
-	a = 0;
-	for (i = 0; i < ETH_ADDR_SIZE; i++)
-		a |= (uint64_t)buf[i] << (40 - 8 * i);
-
-	addr->a = a;
-}
-
-/** Compare Ethernet addresses.
- *
- * @param a First address
- * @param b Second address,
- * @return -1, 0, 1 iff @a a is less than, equal to or greater than @a b,
- *         respectively.
- */
-int eth_addr_compare(const eth_addr_t *a, const eth_addr_t *b)
-{
-	if (a->a < b->a)
-		return -1;
-	else if (a->a == b->a)
-		return 0;
-	else
-		return 1;
-}
-
-/** Format Ethernet address as a string.
- *
- * @param addr Ethernet address
- * @param saddr Structure for storing string representation
- *        of @a addr. The caller can access it as @a saddr->str.
- */
-void eth_addr_format(eth_addr_t *addr, eth_addr_str_t *saddr)
-{
-	int i;
-
-	snprintf(saddr->str, 3, "%02x",
-	    (unsigned)((addr->a >> 40) & 0xff));
-	for (i = 1; i < ETH_ADDR_SIZE; i++) {
-		snprintf(saddr->str + 2 + 3 * (i - 1), 4, ":%02x",
-		    (unsigned)((addr->a >> (40 - i * 8)) & 0xff));
-	}
-}
-
-/** @}
- */
Index: pace/lib/inet/src/host.c
===================================================================
--- uspace/lib/inet/src/host.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file Internet host specification
- *
- * Either a host name or an address.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/dnsr.h>
-#include <inet/host.h>
-#include <inet/hostname.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-/** Parse host string.
- *
- * @param str Host string
- * @param rhost Place to store pointer to new host structure
- * @param endptr Place to store pointer to next character in string or @c NULL
- *
- * @return EOK on success. EINVAL if @a str does not start with a valid
- *         host specification or if @a endptr is @c NULL and @a str contains
- *         extra characters at the end. ENOMEM if out of memory
- */
-errno_t inet_host_parse(const char *str, inet_host_t **rhost,
-    char **endptr)
-{
-	inet_host_t *host;
-	inet_addr_t addr;
-	char *name;
-	char *aend;
-	errno_t rc;
-
-	host = calloc(1, sizeof(inet_host_t));
-	if (host == NULL)
-		return ENOMEM;
-
-	/* Try address */
-	rc = inet_addr_parse(str, &addr, &aend);
-	if (rc == EOK) {
-		host->hform = inet_host_addr;
-		host->host.addr = addr;
-		goto have_host;
-	}
-
-	/* Try <hostname> */
-	rc = inet_hostname_parse(str, &name, &aend);
-	if (rc == EOK) {
-		host->hform = inet_host_name;
-		host->host.name = name;
-		goto have_host;
-	}
-
-	free(host);
-	return EINVAL;
-
-have_host:
-	if (*aend != '\0' && endptr == NULL) {
-		/* Extra characters */
-		free(host);
-		return EINVAL;
-	}
-
-	*rhost = host;
-	if (endptr != NULL)
-		*endptr = (char *)aend;
-	return EOK;
-}
-
-/** Convert host structure to string representation.
- *
- * @param host Host structure
- * @param rstr Place to store pointer to new string
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t inet_host_format(inet_host_t *host, char **rstr)
-{
-	errno_t rc;
-	char *str = NULL;
-
-	switch (host->hform) {
-	case inet_host_addr:
-		rc = inet_addr_format(&host->host.addr, &str);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return ENOMEM;
-		}
-
-		break;
-	case inet_host_name:
-		str = str_dup(host->host.name);
-		if (str == NULL)
-			return ENOMEM;
-		break;
-	}
-
-	*rstr = str;
-	return EOK;
-}
-
-/** Destroy host structure.
- *
- * @param host Host structure or @c NULL
- */
-void inet_host_destroy(inet_host_t *host)
-{
-	if (host == NULL)
-		return;
-
-	switch (host->hform) {
-	case inet_host_addr:
-		break;
-	case inet_host_name:
-		free(host->host.name);
-		break;
-	}
-
-	free(host);
-}
-
-/** Look up first address corresponding to host.
- *
- * If host contains a host name, name resolution is performed.
- *
- * @param host Host structure
- * @param version Desired IP version (ip_any to get any version)
- * @param addr Place to store address
- *
- * @reutrn EOK on success, ENOENT on resolurion failure
- */
-errno_t inet_host_lookup_one(inet_host_t *host, ip_ver_t version, inet_addr_t *addr)
-{
-	dnsr_hostinfo_t *hinfo = NULL;
-	errno_t rc;
-
-	switch (host->hform) {
-	case inet_host_addr:
-		*addr = host->host.addr;
-		break;
-	case inet_host_name:
-		rc = dnsr_name2host(host->host.name, &hinfo, version);
-		if (rc != EOK) {
-			dnsr_hostinfo_destroy(hinfo);
-			return ENOENT;
-		}
-
-		*addr = hinfo->addr;
-		dnsr_hostinfo_destroy(hinfo);
-		break;
-	}
-
-	return EOK;
-}
-
-/** Look up first address corresponding to host string.
- *
- * If host contains a host name, name resolution is performed.
- *
- * @param str Host string
- * @param version Desired IP version (ip_any to get any version)
- * @param addr Place to store address
- * @param endptr Place to store pointer to next character in string or @c NULL
- * @param errmsg Place to store pointer to error message (no need to free it)
- *               or @c NULL
- *
- * @return EOK on success. EINVAL if @a str has incorrect format or if
- *         @a endptr is @c NULL and @a str contains extra characters at
- *         the end. ENOENT if host was not found during resolution,
- *         ENOMEM if out of memory
- */
-errno_t inet_host_plookup_one(const char *str, ip_ver_t version, inet_addr_t *addr,
-    char **endptr, const char **errmsg)
-{
-	inet_host_t *host = NULL;
-	char *eptr;
-	errno_t rc;
-
-	rc = inet_host_parse(str, &host, endptr != NULL ? &eptr : NULL);
-	if (rc != EOK) {
-		switch (rc) {
-		case EINVAL:
-			if (errmsg != NULL)
-				*errmsg = "Invalid format";
-			goto error;
-		case ENOMEM:
-			if (errmsg != NULL)
-				*errmsg = "Out of memory";
-			goto error;
-		default:
-			assert(false);
-		}
-	}
-
-	rc = inet_host_lookup_one(host, version, addr);
-	if (rc != EOK) {
-		/* XXX Distinguish between 'not found' and other error */
-		rc = ENOENT;
-		if (errmsg != NULL)
-			*errmsg = "Name resolution failed";
-		goto error;
-	}
-
-	inet_host_destroy(host);
-	if (endptr != NULL)
-		*endptr = eptr;
-	return EOK;
-error:
-	inet_host_destroy(host);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/hostname.c
===================================================================
--- uspace/lib/inet/src/hostname.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file Internet host name
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <inet/hostname.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-
-/** Parse host name
- *
- * Determine whether string begins with a valid host name and where that
- * host name ends.
- *
- * Currntly accepting names per 'host' definition in RFC 1738
- * (Uniform Resource Locators) - generic URI syntax not accepted.
- *
- * @param str String containing host name
- * @param rname Place to store pointer to new string containing just the
- *              host name or @c NULL if not interested
- * @param endptr Place to store pointer to next character in string or @c NULL
- *               if no extra characters in the string are allowed
- *
- * @return EOK on success. EINVAL if @a str does not start with a valid
- *         host name or if @a endptr is @c NULL and @a str contains
- *         extra characters at the end. ENOMEM if out of memory
- */
-errno_t inet_hostname_parse(const char *str, char **rname, char **endptr)
-{
-	const char *c;
-	const char *dstart = NULL;
-	char *name;
-
-	c = str;
-	while (isalnum(*c)) {
-		/* Domain label */
-		dstart = c;
-
-		do {
-			++c;
-		} while (isalnum(*c) || *c == '-');
-
-		/* Domain separator? */
-		if (*c != '.' || !isalnum(c[1]))
-			break;
-
-		++c;
-	}
-
-	/*
-	 * Last domain label must not start with a digit (to distinguish from
-	 * IPv4 address)
-	 */
-	if (dstart == NULL || !isalpha(*dstart))
-		return EINVAL;
-
-	/* If endptr is null, check that entire string matched */
-	if (endptr == NULL && *c != '\0')
-		return EINVAL;
-
-	if (endptr != NULL)
-		*endptr = (char *)c;
-
-	if (rname != NULL) {
-		name = str_ndup(str, c - str);
-		if (name == NULL)
-			return ENOMEM;
-
-		*rname = name;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/hostport.c
===================================================================
--- uspace/lib/inet/src/hostport.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,302 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file Internet host:port specification
- *
- * As in RFC 1738 Uniform Resouce Locators (URL) and RFC 2732 Format for
- * literal IPv6 Addresses in URLs
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/dnsr.h>
-#include <inet/endpoint.h>
-#include <inet/hostname.h>
-#include <inet/hostport.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-/** Parse host:port string.
- *
- * @param str Host:port string
- * @param rhp Place to store pointer to new hostport structure
- * @param endptr Place to store pointer to next character in string or @c NULL
- *
- * @return EOK on success. EINVAL if @a str does not start with a valid
- *         host:port or if @a endptr is @c NULL and @a str contains
- *         extra characters at the end. ENOMEM if out of memory
- */
-errno_t inet_hostport_parse(const char *str, inet_hostport_t **rhp,
-    char **endptr)
-{
-	inet_hostport_t *hp;
-	inet_addr_t addr;
-	uint16_t port;
-	char *name;
-	char *aend;
-	const char *pend;
-	errno_t rc;
-
-	hp = calloc(1, sizeof(inet_hostport_t));
-	if (hp == NULL)
-		return ENOMEM;
-
-	if (str[0] == '[') {
-		/* Try [<ip-addr-literal>] */
-		rc = inet_addr_parse(str + 1, &addr, &aend);
-		if (rc == EOK) {
-			if (*aend == ']') {
-				hp->hform = inet_host_addr;
-				hp->host.addr = addr;
-				++aend;
-			}
-			goto have_host;
-		}
-	}
-
-	/* Try <ipv4-addr> */
-	rc = inet_addr_parse(str, &addr, &aend);
-	if (rc == EOK) {
-		hp->hform = inet_host_addr;
-		hp->host.addr = addr;
-		goto have_host;
-	}
-
-	/* Try <hostname> */
-	rc = inet_hostname_parse(str, &name, &aend);
-	if (rc == EOK) {
-		hp->hform = inet_host_name;
-		hp->host.name = name;
-		goto have_host;
-	}
-
-	free(hp);
-	return EINVAL;
-
-have_host:
-	if (*aend == ':') {
-		/* Port number */
-		rc = str_uint16_t(aend + 1, &pend, 10, false, &port);
-		if (rc != EOK) {
-			free(hp);
-			return EINVAL;
-		}
-	} else {
-		/* Port number omitted */
-		port = 0;
-		pend = aend;
-	}
-
-	hp->port = port;
-
-	if (*pend != '\0' && endptr == NULL) {
-		/* Extra characters */
-		free(hp);
-		return EINVAL;
-	}
-
-	*rhp = hp;
-	if (endptr != NULL)
-		*endptr = (char *)pend;
-	return EOK;
-}
-
-/** Convert host:port to string representation.
- *
- * @param hp Host:port structure
- * @param rstr Place to store pointer to new string
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t inet_hostport_format(inet_hostport_t *hp, char **rstr)
-{
-	errno_t rc;
-	int ret;
-	char *astr, *str;
-	char *hstr = NULL;
-
-	switch (hp->hform) {
-	case inet_host_addr:
-		rc = inet_addr_format(&hp->host.addr, &astr);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return ENOMEM;
-		}
-
-		if (hp->host.addr.version != ip_v4) {
-			hstr = astr;
-		} else {
-			ret = asprintf(&hstr, "[%s]", astr);
-			if (ret < 0) {
-				free(astr);
-				return ENOMEM;
-			}
-
-			free(astr);
-		}
-
-		break;
-	case inet_host_name:
-		hstr = str_dup(hp->host.name);
-		if (hstr == NULL)
-			return ENOMEM;
-		break;
-	}
-
-	ret = asprintf(&str, "%s:%u", hstr, hp->port);
-	if (ret < 0)
-		return ENOMEM;
-
-	free(hstr);
-	*rstr = str;
-	return EOK;
-}
-
-/** Destroy host:port structure.
- *
- * @param hp Host:port or @c NULL
- */
-void inet_hostport_destroy(inet_hostport_t *hp)
-{
-	if (hp == NULL)
-		return;
-
-	switch (hp->hform) {
-	case inet_host_addr:
-		break;
-	case inet_host_name:
-		free(hp->host.name);
-		break;
-	}
-
-	free(hp);
-}
-
-/** Look up first endpoint corresponding to host:port.
- *
- * If host:port contains a host name, name resolution is performed.
- *
- * @param hp Host:port structure
- * @param version Desired IP version (ip_any to get any version)
- * @param ep Place to store endpoint
- *
- * @return EOK on success, ENOENT on resolution failure
- */
-errno_t inet_hostport_lookup_one(inet_hostport_t *hp, ip_ver_t version,
-    inet_ep_t *ep)
-{
-	dnsr_hostinfo_t *hinfo = NULL;
-	errno_t rc;
-
-	inet_ep_init(ep);
-
-	switch (hp->hform) {
-	case inet_host_addr:
-		ep->addr = hp->host.addr;
-		break;
-	case inet_host_name:
-		rc = dnsr_name2host(hp->host.name, &hinfo, ip_any);
-		if (rc != EOK) {
-			dnsr_hostinfo_destroy(hinfo);
-			return ENOENT;
-		}
-
-		ep->addr = hinfo->addr;
-		dnsr_hostinfo_destroy(hinfo);
-		break;
-	}
-
-	ep->port = hp->port;
-	return EOK;
-}
-
-/** Look up first endpoint corresponding to host:port string.
- *
- * If host:port contains a host name, name resolution is performed.
- *
- * @param str Host:port string
- * @param version Desired IP version (ip_any to get any version)
- * @param ep Place to store endpoint
- * @param endptr Place to store pointer to next character in string or @c NULL
- * @param errmsg Place to store pointer to error message (no need to free it)
- *               or @c NULL
- *
- * @return EOK on success. EINVAL if @a str has incorrect format or if
- *         @a endptr is @c NULL and @a str contains extra characters at
- *         the end. ENOENT if host was not found during resolution,
- *         ENOMEM if out of memory
- */
-errno_t inet_hostport_plookup_one(const char *str, ip_ver_t version, inet_ep_t *ep,
-    char **endptr, const char **errmsg)
-{
-	inet_hostport_t *hp = NULL;
-	char *eptr;
-	errno_t rc;
-
-	rc = inet_hostport_parse(str, &hp, endptr != NULL ? &eptr : NULL);
-	if (rc != EOK) {
-		switch (rc) {
-		case EINVAL:
-			if (errmsg != NULL)
-				*errmsg = "Invalid format";
-			goto error;
-		case ENOMEM:
-			if (errmsg != NULL)
-				*errmsg = "Out of memory";
-			goto error;
-		case EOK:
-			break;
-		default:
-			assert(false);
-		}
-	}
-
-	rc = inet_hostport_lookup_one(hp, version, ep);
-	if (rc != EOK) {
-		/* XXX Distinguish between 'not found' and other error */
-		rc = ENOENT;
-		if (errmsg != NULL)
-			*errmsg = "Name resolution failed";
-		goto error;
-	}
-
-	inet_hostport_destroy(hp);
-	if (endptr != NULL)
-		*endptr = eptr;
-	return EOK;
-error:
-	inet_hostport_destroy(hp);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/inet.c
===================================================================
--- uspace/lib/inet/src/inet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <inet/inet.h>
-#include <ipc/inet.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-
-static void inet_cb_conn(ipc_call_t *icall, void *arg);
-
-static async_sess_t *inet_sess = NULL;
-static inet_ev_ops_t *inet_ev_ops = NULL;
-static uint8_t inet_protocol = 0;
-
-static errno_t inet_callback_create(void)
-{
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, INET_CALLBACK_CREATE, &answer);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_INET_CB, 0, 0,
-	    inet_cb_conn, NULL, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-static errno_t inet_set_proto(uint8_t protocol)
-{
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-	errno_t rc = async_req_1_0(exch, INET_SET_PROTO, protocol);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t inet_init(uint8_t protocol, inet_ev_ops_t *ev_ops)
-{
-	service_id_t inet_svc;
-	errno_t rc;
-
-	assert(inet_sess == NULL);
-	assert(inet_ev_ops == NULL);
-	assert(inet_protocol == 0);
-
-	rc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return ENOENT;
-
-	inet_sess = loc_service_connect(inet_svc, INTERFACE_INET,
-	    IPC_FLAG_BLOCKING);
-	if (inet_sess == NULL)
-		return ENOENT;
-
-	if (inet_set_proto(protocol) != EOK) {
-		async_hangup(inet_sess);
-		inet_sess = NULL;
-		return EIO;
-	}
-
-	if (inet_callback_create() != EOK) {
-		async_hangup(inet_sess);
-		inet_sess = NULL;
-		return EIO;
-	}
-
-	inet_protocol = protocol;
-	inet_ev_ops = ev_ops;
-
-	return EOK;
-}
-
-errno_t inet_send(inet_dgram_t *dgram, uint8_t ttl, inet_df_t df)
-{
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_4(exch, INET_SEND, dgram->iplink, dgram->tos,
-	    ttl, df, &answer);
-
-	errno_t rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, &dgram->dest, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, dgram->data, dgram->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
-{
-	async_exch_t *exch = async_exchange_begin(inet_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INET_GET_SRCADDR, tos, &answer);
-
-	errno_t rc = async_data_write_start(exch, remote, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_read_start(exch, local, sizeof(inet_addr_t));
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-static void inet_ev_recv(ipc_call_t *icall)
-{
-	inet_dgram_t dgram;
-
-	dgram.tos = ipc_get_arg1(icall);
-	dgram.iplink = ipc_get_arg2(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, &dgram.src, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &dgram.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = inet_ev_ops->recv(&dgram);
-	free(dgram.data);
-	async_answer_0(icall, rc);
-}
-
-static void inet_cb_conn(ipc_call_t *icall, void *arg)
-{
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case INET_EV_RECV:
-			inet_ev_recv(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/inet/src/inetcfg.c
===================================================================
--- uspace/lib/inet/src/inetcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,466 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <inet/inetcfg.h>
-#include <ipc/inet.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-
-static async_sess_t *inetcfg_sess = NULL;
-
-static errno_t inetcfg_get_ids_once(sysarg_t method, sysarg_t arg1,
-    sysarg_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, method, arg1, &answer);
-	errno_t rc = async_data_read_start(exch, id_buf, buf_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK) {
-		return retval;
-	}
-
-	*act_size = ipc_get_arg1(&answer);
-	return EOK;
-}
-
-/** Get list of IDs.
- *
- * Returns an allocated array of service IDs.
- *
- * @param method	IPC method
- * @param arg1		IPC argument 1
- * @param data		Place to store pointer to array of IDs
- * @param count		Place to store number of IDs
- * @return 		EOK on success or an error code
- */
-static errno_t inetcfg_get_ids_internal(sysarg_t method, sysarg_t arg1,
-    sysarg_t **data, size_t *count)
-{
-	*data = NULL;
-	*count = 0;
-
-	size_t act_size = 0;
-	errno_t rc = inetcfg_get_ids_once(method, arg1, NULL, 0,
-	    &act_size);
-	if (rc != EOK)
-		return rc;
-
-	size_t alloc_size = act_size;
-	service_id_t *ids = malloc(alloc_size);
-	if (ids == NULL)
-		return ENOMEM;
-
-	while (true) {
-		rc = inetcfg_get_ids_once(method, arg1, ids, alloc_size,
-		    &act_size);
-		if (rc != EOK)
-			return rc;
-
-		if (act_size <= alloc_size)
-			break;
-
-		alloc_size = act_size;
-		service_id_t *tmp = realloc(ids, alloc_size);
-		if (tmp == NULL) {
-			free(ids);
-			return ENOMEM;
-		}
-		ids = tmp;
-	}
-
-	*count = act_size / sizeof(sysarg_t);
-	*data = ids;
-	return EOK;
-}
-
-errno_t inetcfg_init(void)
-{
-	service_id_t inet_svc;
-	errno_t rc;
-
-	assert(inetcfg_sess == NULL);
-
-	rc = loc_service_get_id(SERVICE_NAME_INET, &inet_svc,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return ENOENT;
-
-	inetcfg_sess = loc_service_connect(inet_svc, INTERFACE_INETCFG,
-	    IPC_FLAG_BLOCKING);
-	if (inetcfg_sess == NULL)
-		return ENOENT;
-
-	return EOK;
-}
-
-errno_t inetcfg_addr_create_static(const char *name, inet_naddr_t *naddr,
-    sysarg_t link_id, sysarg_t *addr_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_ADDR_CREATE_STATIC, link_id,
-	    &answer);
-
-	errno_t rc = async_data_write_start(exch, naddr, sizeof(inet_naddr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	*addr_id = ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-errno_t inetcfg_addr_delete(sysarg_t addr_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_ADDR_DELETE, addr_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_ADDR_GET, addr_id, &answer);
-
-	ipc_call_t answer_naddr;
-	aid_t req_naddr = async_data_read(exch, &ainfo->naddr,
-	    sizeof(inet_naddr_t), &answer_naddr);
-
-	errno_t retval_naddr;
-	async_wait_for(req_naddr, &retval_naddr);
-
-	if (retval_naddr != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval_naddr;
-	}
-
-	ipc_call_t answer_name;
-	char name_buf[LOC_NAME_MAXLEN + 1];
-	aid_t req_name = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
-	    &answer_name);
-
-	async_exchange_end(exch);
-
-	errno_t retval_name;
-	async_wait_for(req_name, &retval_name);
-
-	if (retval_name != EOK) {
-		async_forget(req);
-		return retval_name;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	size_t act_size = ipc_get_arg2(&answer_name);
-	assert(act_size <= LOC_NAME_MAXLEN);
-
-	name_buf[act_size] = '\0';
-
-	ainfo->ilink = ipc_get_arg1(&answer);
-	ainfo->name = str_dup(name_buf);
-
-	return EOK;
-}
-
-errno_t inetcfg_addr_get_id(const char *name, sysarg_t link_id, sysarg_t *addr_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_ADDR_GET_ID, link_id, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	*addr_id = ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_ADDR_LIST,
-	    0, addrs, count);
-}
-
-errno_t inetcfg_get_link_list(sysarg_t **links, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_LINK_LIST,
-	    0, links, count);
-}
-
-errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
-{
-	return inetcfg_get_ids_internal(INETCFG_GET_SROUTE_LIST,
-	    0, sroutes, count);
-}
-
-errno_t inetcfg_link_add(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_LINK_ADD, link_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
-{
-	ipc_call_t dreply;
-	errno_t dretval;
-	size_t act_size;
-	char name_buf[LOC_NAME_MAXLEN + 1];
-
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_LINK_GET, link_id, &answer);
-	aid_t dreq = async_data_read(exch, name_buf, LOC_NAME_MAXLEN, &dreply);
-	errno_t rc = async_data_read_start(exch, &linfo->mac_addr, sizeof(eth_addr_t));
-	async_wait_for(dreq, &dretval);
-
-	async_exchange_end(exch);
-
-	if (dretval != EOK || rc != EOK) {
-		async_forget(req);
-		return dretval;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	act_size = ipc_get_arg2(&dreply);
-	assert(act_size <= LOC_NAME_MAXLEN);
-	name_buf[act_size] = '\0';
-
-	linfo->name = str_dup(name_buf);
-	linfo->def_mtu = ipc_get_arg1(&answer);
-
-	return EOK;
-}
-
-errno_t inetcfg_link_remove(sysarg_t link_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_LINK_REMOVE, link_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t inetcfg_sroute_create(const char *name, inet_naddr_t *dest,
-    inet_addr_t *router, sysarg_t *sroute_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, INETCFG_SROUTE_CREATE, &answer);
-
-	errno_t rc = async_data_write_start(exch, dest, sizeof(inet_naddr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, router, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	*sroute_id = ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-errno_t inetcfg_sroute_delete(sysarg_t sroute_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	errno_t rc = async_req_1_0(exch, INETCFG_SROUTE_DELETE, sroute_id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETCFG_SROUTE_GET, sroute_id, &answer);
-
-	ipc_call_t answer_dest;
-	aid_t req_dest = async_data_read(exch, &srinfo->dest,
-	    sizeof(inet_naddr_t), &answer_dest);
-
-	errno_t retval_dest;
-	async_wait_for(req_dest, &retval_dest);
-
-	if (retval_dest != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval_dest;
-	}
-
-	ipc_call_t answer_router;
-	aid_t req_router = async_data_read(exch, &srinfo->router,
-	    sizeof(inet_addr_t), &answer_router);
-
-	errno_t retval_router;
-	async_wait_for(req_router, &retval_router);
-
-	if (retval_router != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return retval_router;
-	}
-
-	ipc_call_t answer_name;
-	char name_buf[LOC_NAME_MAXLEN + 1];
-	aid_t req_name = async_data_read(exch, name_buf, LOC_NAME_MAXLEN,
-	    &answer_name);
-
-	async_exchange_end(exch);
-
-	errno_t retval_name;
-	async_wait_for(req_name, &retval_name);
-
-	if (retval_name != EOK) {
-		async_forget(req);
-		return retval_name;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	if (retval != EOK)
-		return retval;
-
-	size_t act_size = ipc_get_arg2(&answer_name);
-	assert(act_size <= LOC_NAME_MAXLEN);
-
-	name_buf[act_size] = '\0';
-
-	srinfo->name = str_dup(name_buf);
-
-	return EOK;
-}
-
-errno_t inetcfg_sroute_get_id(const char *name, sysarg_t *sroute_id)
-{
-	async_exch_t *exch = async_exchange_begin(inetcfg_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, INETCFG_SROUTE_GET_ID, &answer);
-	errno_t retval = async_data_write_start(exch, name, str_size(name));
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	*sroute_id = ipc_get_arg1(&answer);
-
-	return retval;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/inetping.c
===================================================================
--- uspace/lib/inet/src/inetping.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,231 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * Copyright (c) 2013 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <inet/inetping.h>
-#include <ipc/inet.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-
-static void inetping_cb_conn(ipc_call_t *, void *);
-static void inetping_ev_recv(ipc_call_t *);
-
-static async_sess_t *inetping_sess = NULL;
-static inetping_ev_ops_t *inetping_ev_ops;
-
-errno_t inetping_init(inetping_ev_ops_t *ev_ops)
-{
-	service_id_t inetping_svc;
-	errno_t rc;
-
-	assert(inetping_sess == NULL);
-
-	inetping_ev_ops = ev_ops;
-
-	rc = loc_service_get_id(SERVICE_NAME_INET, &inetping_svc,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		return ENOENT;
-
-	inetping_sess = loc_service_connect(inetping_svc, INTERFACE_INETPING,
-	    IPC_FLAG_BLOCKING);
-	if (inetping_sess == NULL)
-		return ENOENT;
-
-	async_exch_t *exch = async_exchange_begin(inetping_sess);
-
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_INETPING_CB, 0, 0,
-	    inetping_cb_conn, NULL, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_hangup(inetping_sess);
-		inetping_sess = NULL;
-		return rc;
-	}
-
-	return EOK;
-}
-
-errno_t inetping_send(inetping_sdu_t *sdu)
-{
-	async_exch_t *exch = async_exchange_begin(inetping_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETPING_SEND, sdu->seq_no, &answer);
-
-	errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, &sdu->dest, sizeof(sdu->dest));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, sdu->data, sdu->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t inetping_get_srcaddr(const inet_addr_t *remote, inet_addr_t *local)
-{
-	async_exch_t *exch = async_exchange_begin(inetping_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, INETPING_GET_SRCADDR, &answer);
-
-	errno_t rc = async_data_write_start(exch, remote, sizeof(*remote));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	ipc_call_t answer_local;
-	aid_t req_local = async_data_read(exch, local, sizeof(*local),
-	    &answer_local);
-
-	async_exchange_end(exch);
-
-	errno_t retval_local;
-	async_wait_for(req_local, &retval_local);
-
-	if (retval_local != EOK) {
-		async_forget(req);
-		return retval_local;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-static void inetping_ev_recv(ipc_call_t *icall)
-{
-	inetping_sdu_t sdu;
-
-	sdu.seq_no = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(sdu.src)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, &sdu.src, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(sdu.dest)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &sdu.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = inetping_ev_ops->recv(&sdu);
-	free(sdu.data);
-	async_answer_0(icall, rc);
-}
-
-static void inetping_cb_conn(ipc_call_t *icall, void *arg)
-{
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case INETPING_EV_RECV:
-			inetping_ev_recv(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/inet/src/iplink.c
===================================================================
--- uspace/lib/inet/src/iplink.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,309 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/**
- * @file
- * @brief IP link client stub
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink.h>
-#include <ipc/iplink.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdlib.h>
-
-static void iplink_cb_conn(ipc_call_t *icall, void *arg);
-
-errno_t iplink_open(async_sess_t *sess, iplink_ev_ops_t *ev_ops, void *arg,
-    iplink_t **riplink)
-{
-	iplink_t *iplink = calloc(1, sizeof(iplink_t));
-	if (iplink == NULL)
-		return ENOMEM;
-
-	iplink->sess = sess;
-	iplink->ev_ops = ev_ops;
-	iplink->arg = arg;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_IPLINK_CB, 0, 0,
-	    iplink_cb_conn, iplink, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		goto error;
-
-	*riplink = iplink;
-	return EOK;
-
-error:
-	if (iplink != NULL)
-		free(iplink);
-
-	return rc;
-}
-
-void iplink_close(iplink_t *iplink)
-{
-	/* XXX Synchronize with iplink_cb_conn */
-	free(iplink);
-}
-
-errno_t iplink_send(iplink_t *iplink, iplink_sdu_t *sdu)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, IPLINK_SEND, (sysarg_t) sdu->src,
-	    (sysarg_t) sdu->dest, &answer);
-
-	errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t iplink_send6(iplink_t *iplink, iplink_sdu6_t *sdu)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_SEND6, &answer);
-
-	errno_t rc = async_data_write_start(exch, &sdu->dest, sizeof(eth_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, sdu->data, sdu->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t iplink_get_mtu(iplink_t *iplink, size_t *rmtu)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	sysarg_t mtu;
-	errno_t rc = async_req_0_1(exch, IPLINK_GET_MTU, &mtu);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	*rmtu = mtu;
-	return EOK;
-}
-
-errno_t iplink_get_mac48(iplink_t *iplink, eth_addr_t *mac)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
-
-	errno_t rc = async_data_read_start(exch, mac, sizeof(eth_addr_t));
-
-	loc_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t iplink_set_mac48(iplink_t *iplink, eth_addr_t *mac)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_GET_MAC48, &answer);
-
-	errno_t rc = async_data_read_start(exch, mac, sizeof(eth_addr_t));
-
-	loc_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t iplink_addr_add(iplink_t *iplink, inet_addr_t *addr)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_ADDR_ADD, &answer);
-
-	errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t iplink_addr_remove(iplink_t *iplink, inet_addr_t *addr)
-{
-	async_exch_t *exch = async_exchange_begin(iplink->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_ADDR_REMOVE, &answer);
-
-	errno_t rc = async_data_write_start(exch, addr, sizeof(inet_addr_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-void *iplink_get_userptr(iplink_t *iplink)
-{
-	return iplink->arg;
-}
-
-static void iplink_ev_recv(iplink_t *iplink, ipc_call_t *icall)
-{
-	iplink_recv_sdu_t sdu;
-
-	ip_ver_t ver = ipc_get_arg1(icall);
-
-	errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
-	    &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = iplink->ev_ops->recv(iplink, &sdu, ver);
-	free(sdu.data);
-	async_answer_0(icall, rc);
-}
-
-static void iplink_ev_change_addr(iplink_t *iplink, ipc_call_t *icall)
-{
-	eth_addr_t *addr;
-	size_t size;
-
-	errno_t rc = async_data_write_accept((void **) &addr, false,
-	    sizeof(eth_addr_t), sizeof(eth_addr_t), 0, &size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = iplink->ev_ops->change_addr(iplink, addr);
-	free(addr);
-	async_answer_0(icall, EOK);
-}
-
-static void iplink_cb_conn(ipc_call_t *icall, void *arg)
-{
-	iplink_t *iplink = (iplink_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IPLINK_EV_RECV:
-			iplink_ev_recv(iplink, &call);
-			break;
-		case IPLINK_EV_CHANGE_ADDR:
-			iplink_ev_change_addr(iplink, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/inet/src/iplink_srv.c
===================================================================
--- uspace/lib/inet/src/iplink_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,363 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/**
- * @file
- * @brief IP link server stub
- */
-
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <ipc/iplink.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <inet/addr.h>
-#include <inet/iplink_srv.h>
-
-static void iplink_get_mtu_srv(iplink_srv_t *srv, ipc_call_t *call)
-{
-	size_t mtu;
-	errno_t rc = srv->ops->get_mtu(srv, &mtu);
-	async_answer_1(call, rc, mtu);
-}
-
-static void iplink_get_mac48_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	eth_addr_t mac;
-	errno_t rc = srv->ops->get_mac48(srv, &mac);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(eth_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &mac, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, rc);
-}
-
-static void iplink_set_mac48_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-	size_t size;
-	eth_addr_t mac;
-
-	ipc_call_t call;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-	}
-
-	rc = srv->ops->set_mac48(srv, &mac);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &mac, sizeof(eth_addr_t));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, rc);
-}
-
-static void iplink_addr_add_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_addr_t addr;
-	errno_t rc = async_data_write_finalize(&call, &addr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = srv->ops->addr_add(srv, &addr);
-	async_answer_0(icall, rc);
-}
-
-static void iplink_addr_remove_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_addr_t addr;
-	errno_t rc = async_data_write_finalize(&call, &addr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = srv->ops->addr_remove(srv, &addr);
-	async_answer_0(icall, rc);
-}
-
-static void iplink_send_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	iplink_sdu_t sdu;
-
-	sdu.src = ipc_get_arg1(icall);
-	sdu.dest = ipc_get_arg2(icall);
-
-	errno_t rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
-	    &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = srv->ops->send(srv, &sdu);
-	free(sdu.data);
-	async_answer_0(icall, rc);
-}
-
-static void iplink_send6_srv(iplink_srv_t *srv, ipc_call_t *icall)
-{
-	iplink_sdu6_t sdu;
-	ipc_call_t call;
-	size_t size;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(eth_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, &sdu.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-	}
-
-	rc = async_data_write_accept(&sdu.data, false, 0, 0, 0,
-	    &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = srv->ops->send6(srv, &sdu);
-	free(sdu.data);
-	async_answer_0(icall, rc);
-}
-
-void iplink_srv_init(iplink_srv_t *srv)
-{
-	fibril_mutex_initialize(&srv->lock);
-	srv->connected = false;
-	srv->ops = NULL;
-	srv->arg = NULL;
-	srv->client_sess = NULL;
-}
-
-errno_t iplink_conn(ipc_call_t *icall, void *arg)
-{
-	iplink_srv_t *srv = (iplink_srv_t *) arg;
-	errno_t rc;
-
-	fibril_mutex_lock(&srv->lock);
-	if (srv->connected) {
-		fibril_mutex_unlock(&srv->lock);
-		async_answer_0(icall, EBUSY);
-		return EBUSY;
-	}
-
-	srv->connected = true;
-	fibril_mutex_unlock(&srv->lock);
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL)
-		return ENOMEM;
-
-	srv->client_sess = sess;
-
-	rc = srv->ops->open(srv);
-	if (rc != EOK)
-		return rc;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			fibril_mutex_lock(&srv->lock);
-			srv->connected = false;
-			fibril_mutex_unlock(&srv->lock);
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case IPLINK_GET_MTU:
-			iplink_get_mtu_srv(srv, &call);
-			break;
-		case IPLINK_GET_MAC48:
-			iplink_get_mac48_srv(srv, &call);
-			break;
-		case IPLINK_SET_MAC48:
-			iplink_set_mac48_srv(srv, &call);
-			break;
-		case IPLINK_SEND:
-			iplink_send_srv(srv, &call);
-			break;
-		case IPLINK_SEND6:
-			iplink_send6_srv(srv, &call);
-			break;
-		case IPLINK_ADDR_ADD:
-			iplink_addr_add_srv(srv, &call);
-			break;
-		case IPLINK_ADDR_REMOVE:
-			iplink_addr_remove_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-
-	return srv->ops->close(srv);
-}
-
-/* XXX Version should be part of @a sdu */
-errno_t iplink_ev_recv(iplink_srv_t *srv, iplink_recv_sdu_t *sdu, ip_ver_t ver)
-{
-	if (srv->client_sess == NULL)
-		return EIO;
-
-	async_exch_t *exch = async_exchange_begin(srv->client_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, IPLINK_EV_RECV, (sysarg_t)ver,
-	    &answer);
-
-	errno_t rc = async_data_write_start(exch, sdu->data, sdu->size);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-errno_t iplink_ev_change_addr(iplink_srv_t *srv, eth_addr_t *addr)
-{
-	if (srv->client_sess == NULL)
-		return EIO;
-
-	async_exch_t *exch = async_exchange_begin(srv->client_sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, IPLINK_EV_CHANGE_ADDR, &answer);
-
-	errno_t rc = async_data_write_start(exch, addr, sizeof(eth_addr_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/tcp.c
===================================================================
--- uspace/lib/inet/src/tcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,875 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file TCP API
- */
-
-#include <errno.h>
-#include <fibril.h>
-#include <inet/endpoint.h>
-#include <inet/tcp.h>
-#include <ipc/services.h>
-#include <ipc/tcp.h>
-#include <stdlib.h>
-
-static void tcp_cb_conn(ipc_call_t *, void *);
-static errno_t tcp_conn_fibril(void *);
-
-/** Incoming TCP connection info
- *
- * Used to pass information about incoming TCP connection to the connection
- * fibril
- */
-typedef struct {
-	/** Listener who received the connection */
-	tcp_listener_t *lst;
-	/** Incoming connection */
-	tcp_conn_t *conn;
-} tcp_in_conn_t;
-
-/** Create callback connection from TCP service.
- *
- * @param tcp TCP service
- * @return EOK on success or an error code
- */
-static errno_t tcp_callback_create(tcp_t *tcp)
-{
-	async_exch_t *exch = async_exchange_begin(tcp->sess);
-
-	aid_t req = async_send_0(exch, TCP_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_TCP_CB, 0, 0,
-	    tcp_cb_conn, tcp, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Create TCP client instance.
- *
- * @param  rtcp Place to store pointer to new TCP client
- * @return EOK on success, ENOMEM if out of memory, EIO if service
- *         cannot be contacted
- */
-errno_t tcp_create(tcp_t **rtcp)
-{
-	tcp_t *tcp;
-	service_id_t tcp_svcid;
-	errno_t rc;
-
-	tcp = calloc(1, sizeof(tcp_t));
-	if (tcp == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	list_initialize(&tcp->conn);
-	list_initialize(&tcp->listener);
-	fibril_mutex_initialize(&tcp->lock);
-	fibril_condvar_initialize(&tcp->cv);
-
-	rc = loc_service_get_id(SERVICE_NAME_TCP, &tcp_svcid,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	tcp->sess = loc_service_connect(tcp_svcid, INTERFACE_TCP,
-	    IPC_FLAG_BLOCKING);
-	if (tcp->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = tcp_callback_create(tcp);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rtcp = tcp;
-	return EOK;
-error:
-	free(tcp);
-	return rc;
-}
-
-/** Destroy TCP client instance.
- *
- * @param tcp TCP client
- */
-void tcp_destroy(tcp_t *tcp)
-{
-	if (tcp == NULL)
-		return;
-
-	async_hangup(tcp->sess);
-
-	fibril_mutex_lock(&tcp->lock);
-	while (!tcp->cb_done)
-		fibril_condvar_wait(&tcp->cv, &tcp->lock);
-	fibril_mutex_unlock(&tcp->lock);
-
-	free(tcp);
-}
-
-/** Create new TCP connection
- *
- * @param tcp   TCP client instance
- * @param id    Connection ID
- * @param cb    Callbacks
- * @param arg   Callback argument
- * @param rconn Place to store pointer to new connection
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t tcp_conn_new(tcp_t *tcp, sysarg_t id, tcp_cb_t *cb, void *arg,
-    tcp_conn_t **rconn)
-{
-	tcp_conn_t *conn;
-
-	conn = calloc(1, sizeof(tcp_conn_t));
-	if (conn == NULL)
-		return ENOMEM;
-
-	conn->data_avail = false;
-	fibril_mutex_initialize(&conn->lock);
-	fibril_condvar_initialize(&conn->cv);
-
-	conn->tcp = tcp;
-	conn->id = id;
-	conn->cb = cb;
-	conn->cb_arg = arg;
-
-	list_append(&conn->ltcp, &tcp->conn);
-	*rconn = conn;
-
-	return EOK;
-}
-
-/** Create new TCP connection.
- *
- * Open a connection to the specified destination. This function returns
- * even before the connection is established (or not). When the connection
- * is established, @a cb->connected is called. If the connection fails,
- * @a cb->conn_failed is called. Alternatively, the caller can call
- * @c tcp_conn_wait_connected() to wait for connection to complete or fail.
- * Other callbacks are available to monitor the changes in connection state.
- *
- * @a epp must specify the remote address and port. Both local address and
- * port are optional. If local address is not specified, address selection
- * will take place. If local port number is not specified, a suitable
- * free dynamic port number will be allocated.
- *
- * @param tcp   TCP client
- * @param epp   Internet endpoint pair
- * @param cb    Callbacks
- * @param arg   Argument to callbacks
- * @param rconn Place to store pointer to new connection
- *
- * @return EOK on success or an error code.
- */
-errno_t tcp_conn_create(tcp_t *tcp, inet_ep2_t *epp, tcp_cb_t *cb, void *arg,
-    tcp_conn_t **rconn)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	sysarg_t conn_id;
-
-	exch = async_exchange_begin(tcp->sess);
-	aid_t req = async_send_0(exch, TCP_CONN_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)epp,
-	    sizeof(inet_ep2_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		errno_t rc_orig;
-		async_wait_for(req, &rc_orig);
-		if (rc_orig != EOK)
-			rc = rc_orig;
-		goto error;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	conn_id = ipc_get_arg1(&answer);
-
-	rc = tcp_conn_new(tcp, conn_id, cb, arg, rconn);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-error:
-	return (errno_t) rc;
-}
-
-/** Destroy TCP connection.
- *
- * Destroy TCP connection. The caller should destroy all connections
- * he created before destroying the TCP client and before terminating.
- *
- * @param conn TCP connection
- */
-void tcp_conn_destroy(tcp_conn_t *conn)
-{
-	async_exch_t *exch;
-
-	if (conn == NULL)
-		return;
-
-	list_remove(&conn->ltcp);
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_DESTROY, conn->id);
-	async_exchange_end(exch);
-
-	free(conn);
-	(void) rc;
-}
-
-/** Get connection based on its ID.
- *
- * @param tcp   TCP client
- * @param id    Connection ID
- * @param rconn Place to store pointer to connection
- *
- * @return EOK on success, EINVAL if no connection with the given ID exists
- */
-static errno_t tcp_conn_get(tcp_t *tcp, sysarg_t id, tcp_conn_t **rconn)
-{
-	list_foreach(tcp->conn, ltcp, tcp_conn_t, conn) {
-		if (conn->id == id) {
-			*rconn = conn;
-			return EOK;
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Get the user/callback argument for a connection.
- *
- * @param conn TCP connection
- * @return User argument associated with connection
- */
-void *tcp_conn_userptr(tcp_conn_t *conn)
-{
-	return conn->cb_arg;
-}
-
-/** Create a TCP connection listener.
- *
- * A listener listens for connections on the set of endpoints specified
- * by @a ep. Each time a new incoming connection is established,
- * @a lcb->new_conn is called (and passed @a larg). Also, the new connection
- * will have callbacks set to @a cb and argument to @a arg.
- *
- * @a ep must specify a valid port number. @a ep may specify an address
- * or link to listen on. If it does not, the listener will listen on
- * all links/addresses.
- *
- * @param tcp  TCP client
- * @param ep   Internet endpoint
- * @param lcb  Listener callbacks
- * @param larg Listener callback argument
- * @param cb   Connection callbacks for every new connection
- * @param arg  Connection argument for every new connection
- * @param rlst Place to store pointer to new listener
- *
- * @return EOK on success or an error code
- */
-errno_t tcp_listener_create(tcp_t *tcp, inet_ep_t *ep, tcp_listen_cb_t *lcb,
-    void *larg, tcp_cb_t *cb, void *arg, tcp_listener_t **rlst)
-{
-	async_exch_t *exch;
-	tcp_listener_t *lst;
-	ipc_call_t answer;
-
-	lst = calloc(1, sizeof(tcp_listener_t));
-	if (lst == NULL)
-		return ENOMEM;
-
-	exch = async_exchange_begin(tcp->sess);
-	aid_t req = async_send_0(exch, TCP_LISTENER_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)ep,
-	    sizeof(inet_ep_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		errno_t rc_orig;
-		async_wait_for(req, &rc_orig);
-		if (rc_orig != EOK)
-			rc = rc_orig;
-		goto error;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	lst->tcp = tcp;
-	lst->id = ipc_get_arg1(&answer);
-	lst->lcb = lcb;
-	lst->lcb_arg = larg;
-	lst->cb = cb;
-	lst->cb_arg = arg;
-
-	list_append(&lst->ltcp, &tcp->listener);
-	*rlst = lst;
-
-	return EOK;
-error:
-	free(lst);
-	return (errno_t) rc;
-}
-
-/** Destroy TCP connection listener.
- *
- * @param lst Listener
- */
-void tcp_listener_destroy(tcp_listener_t *lst)
-{
-	async_exch_t *exch;
-
-	if (lst == NULL)
-		return;
-
-	list_remove(&lst->ltcp);
-
-	exch = async_exchange_begin(lst->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_LISTENER_DESTROY, lst->id);
-	async_exchange_end(exch);
-
-	free(lst);
-	(void) rc;
-}
-
-/** Get TCP connection listener based on its ID.
- *
- * @param tcp TCP client
- * @param id  Listener ID
- * @param rlst Place to store pointer to listener
- *
- * @return EOK on success, EINVAL if no listener with the given ID is found
- */
-static errno_t tcp_listener_get(tcp_t *tcp, sysarg_t id, tcp_listener_t **rlst)
-{
-	list_foreach(tcp->listener, ltcp, tcp_listener_t, lst) {
-		if (lst->id == id) {
-			*rlst = lst;
-			return EOK;
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Get callback/user argument associated with listener.
- *
- * @param lst Listener
- * @return Callback/user argument
- */
-void *tcp_listener_userptr(tcp_listener_t *lst)
-{
-	return lst->lcb_arg;
-}
-
-/** Wait until connection is either established or connection fails.
- *
- * Can be called after calling tcp_conn_create() to block until connection
- * either completes or fails. If the connection fails, EIO is returned.
- * In this case the connection still exists, but is in a failed
- * state.
- *
- * @param conn Connection
- * @return EOK if connection is established, EIO otherwise
- */
-errno_t tcp_conn_wait_connected(tcp_conn_t *conn)
-{
-	fibril_mutex_lock(&conn->lock);
-	while (!conn->connected && !conn->conn_failed && !conn->conn_reset)
-		fibril_condvar_wait(&conn->cv, &conn->lock);
-
-	if (conn->connected) {
-		fibril_mutex_unlock(&conn->lock);
-		return EOK;
-	} else {
-		assert(conn->conn_failed || conn->conn_reset);
-		fibril_mutex_unlock(&conn->lock);
-		return EIO;
-	}
-}
-
-/** Send data over TCP connection.
- *
- * @param conn  Connection
- * @param data  Data
- * @param bytes Data size in bytes
- *
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_send(tcp_conn_t *conn, const void *data, size_t bytes)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	aid_t req = async_send_1(exch, TCP_CONN_SEND, conn->id, NULL);
-	rc = async_data_write_start(exch, data, bytes);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	return rc;
-}
-
-/** Send FIN.
- *
- * Send FIN, indicating no more data will be send over the connection.
- *
- * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_send_fin(tcp_conn_t *conn)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_SEND_FIN, conn->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Push connection.
- *
- * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_push(tcp_conn_t *conn)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_PUSH, conn->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Reset connection.
- *
- * @param conn Connection
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_reset(tcp_conn_t *conn)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	errno_t rc = async_req_1_0(exch, TCP_CONN_RESET, conn->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Read received data from connection without blocking.
- *
- * If any received data is pending on the connection, up to @a bsize bytes
- * are copied to @a buf and the acutal number is stored in @a *nrecv.
- * The entire buffer of @a bsize bytes is filled except when less data
- * is currently available or FIN is received. EOK is returned.
- *
- * If no received data is pending, returns EAGAIN.
- *
- * @param conn Connection
- * @param buf  Buffer
- * @param bsize Buffer size
- * @param nrecv Place to store actual number of received bytes
- *
- * @return EOK on success, EAGAIN if no received data is pending, or other
- *         error code in case of other error
- */
-errno_t tcp_conn_recv(tcp_conn_t *conn, void *buf, size_t bsize, size_t *nrecv)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-
-	fibril_mutex_lock(&conn->lock);
-	if (!conn->data_avail) {
-		fibril_mutex_unlock(&conn->lock);
-		return EAGAIN;
-	}
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	aid_t req = async_send_1(exch, TCP_CONN_RECV, conn->id, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		fibril_mutex_unlock(&conn->lock);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK) {
-		fibril_mutex_unlock(&conn->lock);
-		return retval;
-	}
-
-	*nrecv = ipc_get_arg1(&answer);
-	fibril_mutex_unlock(&conn->lock);
-	return EOK;
-}
-
-/** Read received data from connection with blocking.
- *
- * Wait for @a bsize bytes of data to be received and copy them to
- * @a buf. Less data may be returned if FIN is received on the connection.
- * The actual If any received data is written to @a *nrecv and EOK
- * is returned on success.
- *
- * @param conn Connection
- * @param buf  Buffer
- * @param bsize Buffer size
- * @param nrecv Place to store actual number of received bytes
- *
- * @return EOK on success or an error code
- */
-errno_t tcp_conn_recv_wait(tcp_conn_t *conn, void *buf, size_t bsize,
-    size_t *nrecv)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-
-again:
-	fibril_mutex_lock(&conn->lock);
-	while (!conn->data_avail) {
-		fibril_condvar_wait(&conn->cv, &conn->lock);
-	}
-
-	exch = async_exchange_begin(conn->tcp->sess);
-	aid_t req = async_send_1(exch, TCP_CONN_RECV_WAIT, conn->id, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		if (rc == EAGAIN) {
-			conn->data_avail = false;
-			fibril_mutex_unlock(&conn->lock);
-			goto again;
-		}
-		fibril_mutex_unlock(&conn->lock);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK) {
-		if (rc == EAGAIN) {
-			conn->data_avail = false;
-		}
-		fibril_mutex_unlock(&conn->lock);
-		return retval;
-	}
-
-	*nrecv = ipc_get_arg1(&answer);
-	fibril_mutex_unlock(&conn->lock);
-	return EOK;
-}
-
-/** Connection established event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_connected(tcp_t *tcp, ipc_call_t *icall)
-{
-	tcp_conn_t *conn;
-	sysarg_t conn_id;
-	errno_t rc;
-
-	conn_id = ipc_get_arg1(icall);
-
-	rc = tcp_conn_get(tcp, conn_id, &conn);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&conn->lock);
-	conn->connected = true;
-	fibril_condvar_broadcast(&conn->cv);
-	fibril_mutex_unlock(&conn->lock);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Connection failed event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_conn_failed(tcp_t *tcp, ipc_call_t *icall)
-{
-	tcp_conn_t *conn;
-	sysarg_t conn_id;
-	errno_t rc;
-
-	conn_id = ipc_get_arg1(icall);
-
-	rc = tcp_conn_get(tcp, conn_id, &conn);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&conn->lock);
-	conn->conn_failed = true;
-	fibril_condvar_broadcast(&conn->cv);
-	fibril_mutex_unlock(&conn->lock);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Connection reset event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_conn_reset(tcp_t *tcp, ipc_call_t *icall)
-{
-	tcp_conn_t *conn;
-	sysarg_t conn_id;
-	errno_t rc;
-
-	conn_id = ipc_get_arg1(icall);
-
-	rc = tcp_conn_get(tcp, conn_id, &conn);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&conn->lock);
-	conn->conn_reset = true;
-	fibril_condvar_broadcast(&conn->cv);
-	fibril_mutex_unlock(&conn->lock);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Data available event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_data(tcp_t *tcp, ipc_call_t *icall)
-{
-	tcp_conn_t *conn;
-	sysarg_t conn_id;
-	errno_t rc;
-
-	conn_id = ipc_get_arg1(icall);
-
-	rc = tcp_conn_get(tcp, conn_id, &conn);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	conn->data_avail = true;
-	fibril_condvar_broadcast(&conn->cv);
-
-	if (conn->cb != NULL && conn->cb->data_avail != NULL)
-		conn->cb->data_avail(conn);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Urgent data event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_urg_data(tcp_t *tcp, ipc_call_t *icall)
-{
-	async_answer_0(icall, ENOTSUP);
-}
-
-/** New connection event.
- *
- * @param tcp   TCP client
- * @param icall Call data
- *
- */
-static void tcp_ev_new_conn(tcp_t *tcp, ipc_call_t *icall)
-{
-	tcp_listener_t *lst;
-	tcp_conn_t *conn;
-	sysarg_t lst_id;
-	sysarg_t conn_id;
-	fid_t fid;
-	tcp_in_conn_t *cinfo;
-	errno_t rc;
-
-	lst_id = ipc_get_arg1(icall);
-	conn_id = ipc_get_arg2(icall);
-
-	rc = tcp_listener_get(tcp, lst_id, &lst);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = tcp_conn_new(tcp, conn_id, lst->cb, lst->cb_arg, &conn);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	if (lst->lcb != NULL && lst->lcb->new_conn != NULL) {
-		cinfo = calloc(1, sizeof(tcp_in_conn_t));
-		if (cinfo == NULL) {
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		cinfo->lst = lst;
-		cinfo->conn = conn;
-
-		fid = fibril_create(tcp_conn_fibril, cinfo);
-		if (fid == 0) {
-			async_answer_0(icall, ENOMEM);
-		}
-
-		fibril_add_ready(fid);
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** Callback connection handler.
- *
- * @param icall Connect call data
- * @param arg   Argument, TCP client
- *
- */
-static void tcp_cb_conn(ipc_call_t *icall, void *arg)
-{
-	tcp_t *tcp = (tcp_t *)arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case TCP_EV_CONNECTED:
-			tcp_ev_connected(tcp, &call);
-			break;
-		case TCP_EV_CONN_FAILED:
-			tcp_ev_conn_failed(tcp, &call);
-			break;
-		case TCP_EV_CONN_RESET:
-			tcp_ev_conn_reset(tcp, &call);
-			break;
-		case TCP_EV_DATA:
-			tcp_ev_data(tcp, &call);
-			break;
-		case TCP_EV_URG_DATA:
-			tcp_ev_urg_data(tcp, &call);
-			break;
-		case TCP_EV_NEW_CONN:
-			tcp_ev_new_conn(tcp, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&tcp->lock);
-	tcp->cb_done = true;
-	fibril_mutex_unlock(&tcp->lock);
-	fibril_condvar_broadcast(&tcp->cv);
-}
-
-/** Fibril for handling incoming TCP connection in background.
- *
- * @param arg Argument, incoming connection information (@c tcp_in_conn_t)
- */
-static errno_t tcp_conn_fibril(void *arg)
-{
-	tcp_in_conn_t *cinfo = (tcp_in_conn_t *)arg;
-
-	cinfo->lst->lcb->new_conn(cinfo->lst, cinfo->conn);
-	tcp_conn_destroy(cinfo->conn);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/inet/src/udp.c
===================================================================
--- uspace/lib/inet/src/udp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,531 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinet
- * @{
- */
-/** @file UDP API
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <inet/udp.h>
-#include <ipc/services.h>
-#include <ipc/udp.h>
-#include <loc.h>
-#include <stdlib.h>
-
-static void udp_cb_conn(ipc_call_t *, void *);
-
-/** Create callback connection from UDP service.
- *
- * @param udp UDP service
- * @return EOK on success or an error code
- */
-static errno_t udp_callback_create(udp_t *udp)
-{
-	async_exch_t *exch = async_exchange_begin(udp->sess);
-
-	aid_t req = async_send_0(exch, UDP_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_UDP_CB, 0, 0,
-	    udp_cb_conn, udp, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Create UDP client instance.
- *
- * @param  rudp Place to store pointer to new UDP client
- * @return EOK on success, ENOMEM if out of memory, EIO if service
- *         cannot be contacted
- */
-errno_t udp_create(udp_t **rudp)
-{
-	udp_t *udp;
-	service_id_t udp_svcid;
-	errno_t rc;
-
-	udp = calloc(1, sizeof(udp_t));
-	if (udp == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	list_initialize(&udp->assoc);
-	fibril_mutex_initialize(&udp->lock);
-	fibril_condvar_initialize(&udp->cv);
-
-	rc = loc_service_get_id(SERVICE_NAME_UDP, &udp_svcid,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	udp->sess = loc_service_connect(udp_svcid, INTERFACE_UDP,
-	    IPC_FLAG_BLOCKING);
-	if (udp->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = udp_callback_create(udp);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rudp = udp;
-	return EOK;
-error:
-	free(udp);
-	return rc;
-}
-
-/** Destroy UDP client instance.
- *
- * @param udp UDP client
- */
-void udp_destroy(udp_t *udp)
-{
-	if (udp == NULL)
-		return;
-
-	async_hangup(udp->sess);
-
-	fibril_mutex_lock(&udp->lock);
-	while (!udp->cb_done)
-		fibril_condvar_wait(&udp->cv, &udp->lock);
-	fibril_mutex_unlock(&udp->lock);
-
-	free(udp);
-}
-
-/** Create new UDP association.
- *
- * Create a UDP association that allows sending and receiving messages.
- *
- * @a epp may specify remote address and port, in which case only messages
- * from that remote endpoint will be received. Also, that remote endpoint
- * is used as default when @c NULL is passed as destination to
- * udp_assoc_send_msg.
- *
- * @a epp may specify a local link or address. If it does not, the association
- * will listen on all local links/addresses. If @a epp does not specify
- * a local port number, a free dynamic port number will be allocated.
- *
- * The caller is informed about incoming data by invoking @a cb->recv_msg
- *
- * @param udp    UDP client
- * @param epp    Internet endpoint pair
- * @param cb     Callbacks
- * @param arg    Argument to callbacks
- * @param rassoc Place to store pointer to new association
- *
- * @return EOK on success or an error code.
- */
-errno_t udp_assoc_create(udp_t *udp, inet_ep2_t *epp, udp_cb_t *cb, void *arg,
-    udp_assoc_t **rassoc)
-{
-	async_exch_t *exch;
-	udp_assoc_t *assoc;
-	ipc_call_t answer;
-
-	assoc = calloc(1, sizeof(udp_assoc_t));
-	if (assoc == NULL)
-		return ENOMEM;
-
-	exch = async_exchange_begin(udp->sess);
-	aid_t req = async_send_0(exch, UDP_ASSOC_CREATE, &answer);
-	errno_t rc = async_data_write_start(exch, (void *)epp,
-	    sizeof(inet_ep2_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		errno_t rc_orig;
-		async_wait_for(req, &rc_orig);
-		if (rc_orig != EOK)
-			rc = rc_orig;
-		goto error;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	assoc->udp = udp;
-	assoc->id = ipc_get_arg1(&answer);
-	assoc->cb = cb;
-	assoc->cb_arg = arg;
-
-	list_append(&assoc->ludp, &udp->assoc);
-	*rassoc = assoc;
-
-	return EOK;
-error:
-	free(assoc);
-	return (errno_t) rc;
-}
-
-/** Destroy UDP association.
- *
- * Destroy UDP association. The caller should destroy all associations
- * he created before destroying the UDP client and before terminating.
- *
- * @param assoc UDP association
- */
-void udp_assoc_destroy(udp_assoc_t *assoc)
-{
-	async_exch_t *exch;
-
-	if (assoc == NULL)
-		return;
-
-	list_remove(&assoc->ludp);
-
-	exch = async_exchange_begin(assoc->udp->sess);
-	errno_t rc = async_req_1_0(exch, UDP_ASSOC_DESTROY, assoc->id);
-	async_exchange_end(exch);
-
-	free(assoc);
-	(void) rc;
-}
-
-/** Set UDP association sending messages with no local address
- *
- * @param assoc Association
- * @param flags Flags
- */
-errno_t udp_assoc_set_nolocal(udp_assoc_t *assoc)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(assoc->udp->sess);
-	errno_t rc = async_req_1_0(exch, UDP_ASSOC_SET_NOLOCAL, assoc->id);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Send message via UDP association.
- *
- * @param assoc Association
- * @param dest	Destination endpoint or @c NULL to use association's remote ep.
- * @param data	Message data
- * @param bytes Message size in bytes
- *
- * @return EOK on success or an error code
- */
-errno_t udp_assoc_send_msg(udp_assoc_t *assoc, inet_ep_t *dest, void *data,
-    size_t bytes)
-{
-	async_exch_t *exch;
-	inet_ep_t ddest;
-
-	exch = async_exchange_begin(assoc->udp->sess);
-	aid_t req = async_send_1(exch, UDP_ASSOC_SEND_MSG, assoc->id, NULL);
-
-	/* If dest is null, use default destination */
-	if (dest == NULL) {
-		inet_ep_init(&ddest);
-		dest = &ddest;
-	}
-
-	errno_t rc = async_data_write_start(exch, (void *)dest,
-	    sizeof(inet_ep_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, data, bytes);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	return rc;
-}
-
-/** Get the user/callback argument for an association.
- *
- * @param assoc UDP association
- * @return User argument associated with association
- */
-void *udp_assoc_userptr(udp_assoc_t *assoc)
-{
-	return assoc->cb_arg;
-}
-
-/** Get size of received message in bytes.
- *
- * Assuming jumbo messages can be received, the caller first needs to determine
- * the size of the received message by calling this function, then they can
- * read the message piece-wise using udp_rmsg_read().
- *
- * @param rmsg Received message
- * @return Size of received message in bytes
- */
-size_t udp_rmsg_size(udp_rmsg_t *rmsg)
-{
-	return rmsg->size;
-}
-
-/** Read part of received message.
- *
- * @param rmsg  Received message
- * @param off   Start offset
- * @param buf   Buffer for storing data
- * @param bsize Buffer size
- *
- * @return EOK on success or an error code.
- */
-errno_t udp_rmsg_read(udp_rmsg_t *rmsg, size_t off, void *buf, size_t bsize)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(rmsg->udp->sess);
-	aid_t req = async_send_1(exch, UDP_RMSG_READ, off, &answer);
-	errno_t rc = async_data_read_start(exch, buf, bsize);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK) {
-		return retval;
-	}
-
-	return EOK;
-}
-
-/** Get remote endpoint of received message.
- *
- * Place the remote endpoint (the one from which the message was supposedly
- * sent) to @a ep.
- *
- * @param rmsg Received message
- * @param ep   Place to store remote endpoint
- */
-void udp_rmsg_remote_ep(udp_rmsg_t *rmsg, inet_ep_t *ep)
-{
-	*ep = rmsg->remote_ep;
-}
-
-/** Get type of received ICMP error message.
- *
- * @param rerr Received error message
- * @return Error message type
- */
-uint8_t udp_rerr_type(udp_rerr_t *rerr)
-{
-	return 0;
-}
-
-/** Get code of received ICMP error message.
- *
- * @param rerr Received error message
- * @return Error message code
- */
-uint8_t udp_rerr_code(udp_rerr_t *rerr)
-{
-	return 0;
-}
-
-/** Get information about the next received message from UDP service.
- *
- * @param udp  UDP client
- * @param rmsg Place to store message information
- *
- * @return EOK on success or an error code
- */
-static errno_t udp_rmsg_info(udp_t *udp, udp_rmsg_t *rmsg)
-{
-	async_exch_t *exch;
-	inet_ep_t ep;
-	ipc_call_t answer;
-
-	exch = async_exchange_begin(udp->sess);
-	aid_t req = async_send_0(exch, UDP_RMSG_INFO, &answer);
-	errno_t rc = async_data_read_start(exch, &ep, sizeof(inet_ep_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-	if (retval != EOK)
-		return retval;
-
-	rmsg->udp = udp;
-	rmsg->assoc_id = ipc_get_arg1(&answer);
-	rmsg->size = ipc_get_arg2(&answer);
-	rmsg->remote_ep = ep;
-	return EOK;
-}
-
-/** Discard next received message in UDP service.
- *
- * @param udp UDP client
- * @return EOK on success or an error code
- */
-static errno_t udp_rmsg_discard(udp_t *udp)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(udp->sess);
-	errno_t rc = async_req_0_0(exch, UDP_RMSG_DISCARD);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Get association based on its ID.
- *
- * @param udp    UDP client
- * @param id     Association ID
- * @param rassoc Place to store pointer to association
- *
- * @return EOK on success, EINVAL if no association with the given ID exists
- */
-static errno_t udp_assoc_get(udp_t *udp, sysarg_t id, udp_assoc_t **rassoc)
-{
-	list_foreach(udp->assoc, ludp, udp_assoc_t, assoc) {
-		if (assoc->id == id) {
-			*rassoc = assoc;
-			return EOK;
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Handle 'data' event, i.e. some message(s) arrived.
- *
- * For each received message, get information about it, call @c recv_msg
- * callback and discard it.
- *
- * @param udp   UDP client
- * @param icall IPC message
- *
- */
-static void udp_ev_data(udp_t *udp, ipc_call_t *icall)
-{
-	udp_rmsg_t rmsg;
-	udp_assoc_t *assoc;
-	errno_t rc;
-
-	while (true) {
-		rc = udp_rmsg_info(udp, &rmsg);
-		if (rc != EOK) {
-			break;
-		}
-
-		rc = udp_assoc_get(udp, rmsg.assoc_id, &assoc);
-		if (rc != EOK) {
-			continue;
-		}
-
-		if (assoc->cb != NULL && assoc->cb->recv_msg != NULL)
-			assoc->cb->recv_msg(assoc, &rmsg);
-
-		rc = udp_rmsg_discard(udp);
-		if (rc != EOK) {
-			break;
-		}
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** UDP service callback connection.
- *
- * @param icall Connect message
- * @param arg   Argument, UDP client
- *
- */
-static void udp_cb_conn(ipc_call_t *icall, void *arg)
-{
-	udp_t *udp = (udp_t *)arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case UDP_EV_DATA:
-			udp_ev_data(udp, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&udp->lock);
-	udp->cb_done = true;
-	fibril_mutex_unlock(&udp->lock);
-	fibril_condvar_broadcast(&udp->cv);
-}
-
-/** @}
- */
Index: pace/lib/inet/test/addr.c
===================================================================
--- uspace/lib/inet/test/addr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/addr.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(addr);
-
-/** Test inet_addr_parse() with unabbreviated address */
-PCUT_TEST(inet_addr_parse_full)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	char *endptr;
-
-	rc = inet_addr_parse("1122:3344:5566:7788:99aa:bbcc:ddee:ff00/", &addr,
-	    &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS('/', *endptr);
-
-	PCUT_ASSERT_INT_EQUALS(ip_v6, addr.version);
-
-	PCUT_ASSERT_INT_EQUALS(0x11, addr.addr6[0]);
-	PCUT_ASSERT_INT_EQUALS(0x22, addr.addr6[1]);
-	PCUT_ASSERT_INT_EQUALS(0x33, addr.addr6[2]);
-	PCUT_ASSERT_INT_EQUALS(0x44, addr.addr6[3]);
-	PCUT_ASSERT_INT_EQUALS(0x55, addr.addr6[4]);
-	PCUT_ASSERT_INT_EQUALS(0x66, addr.addr6[5]);
-	PCUT_ASSERT_INT_EQUALS(0x77, addr.addr6[6]);
-	PCUT_ASSERT_INT_EQUALS(0x88, addr.addr6[7]);
-
-	PCUT_ASSERT_INT_EQUALS(0x99, addr.addr6[8]);
-	PCUT_ASSERT_INT_EQUALS(0xaa, addr.addr6[9]);
-	PCUT_ASSERT_INT_EQUALS(0xbb, addr.addr6[10]);
-	PCUT_ASSERT_INT_EQUALS(0xcc, addr.addr6[11]);
-	PCUT_ASSERT_INT_EQUALS(0xdd, addr.addr6[12]);
-	PCUT_ASSERT_INT_EQUALS(0xee, addr.addr6[13]);
-	PCUT_ASSERT_INT_EQUALS(0xff, addr.addr6[14]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[15]);
-}
-
-/** Test inet_addr_parse() with short groups (< 0x1000) */
-PCUT_TEST(inet_addr_parse_shortgr)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	char *endptr;
-
-	rc = inet_addr_parse("1:22:333:4444:5:66:777:8888/", &addr,
-	    &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS('/', *endptr);
-
-	PCUT_ASSERT_INT_EQUALS(ip_v6, addr.version);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[0]);
-	PCUT_ASSERT_INT_EQUALS(0x01, addr.addr6[1]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[2]);
-	PCUT_ASSERT_INT_EQUALS(0x22, addr.addr6[3]);
-	PCUT_ASSERT_INT_EQUALS(0x03, addr.addr6[4]);
-	PCUT_ASSERT_INT_EQUALS(0x33, addr.addr6[5]);
-	PCUT_ASSERT_INT_EQUALS(0x44, addr.addr6[6]);
-	PCUT_ASSERT_INT_EQUALS(0x44, addr.addr6[7]);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[8]);
-	PCUT_ASSERT_INT_EQUALS(0x05, addr.addr6[9]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[10]);
-	PCUT_ASSERT_INT_EQUALS(0x66, addr.addr6[11]);
-	PCUT_ASSERT_INT_EQUALS(0x07, addr.addr6[12]);
-	PCUT_ASSERT_INT_EQUALS(0x77, addr.addr6[13]);
-	PCUT_ASSERT_INT_EQUALS(0x88, addr.addr6[14]);
-	PCUT_ASSERT_INT_EQUALS(0x88, addr.addr6[15]);
-}
-
-/** Test inet_addr_parse() with wildcard at the beginning */
-PCUT_TEST(inet_addr_parse_wcbegin)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	char *endptr;
-
-	rc = inet_addr_parse("::1234/", &addr, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS('/', *endptr);
-
-	PCUT_ASSERT_INT_EQUALS(ip_v6, addr.version);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[0]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[1]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[2]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[3]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[4]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[5]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[6]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[7]);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[8]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[9]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[10]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[11]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[12]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[13]);
-	PCUT_ASSERT_INT_EQUALS(0x12, addr.addr6[14]);
-	PCUT_ASSERT_INT_EQUALS(0x34, addr.addr6[15]);
-}
-
-/** Test inet_addr_parse() with wildcard in the middle */
-PCUT_TEST(inet_addr_parse_wcmiddle)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	char *endptr;
-
-	rc = inet_addr_parse("1122:3344::5566/", &addr, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS('/', *endptr);
-
-	PCUT_ASSERT_INT_EQUALS(ip_v6, addr.version);
-
-	PCUT_ASSERT_INT_EQUALS(0x11, addr.addr6[0]);
-	PCUT_ASSERT_INT_EQUALS(0x22, addr.addr6[1]);
-	PCUT_ASSERT_INT_EQUALS(0x33, addr.addr6[2]);
-	PCUT_ASSERT_INT_EQUALS(0x44, addr.addr6[3]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[4]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[5]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[6]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[7]);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[8]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[9]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[10]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[11]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[12]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[13]);
-	PCUT_ASSERT_INT_EQUALS(0x55, addr.addr6[14]);
-	PCUT_ASSERT_INT_EQUALS(0x66, addr.addr6[15]);
-}
-
-/** Test inet_addr_parse() with wildcard at the end */
-PCUT_TEST(inet_addr_parse_wcend)
-{
-	errno_t rc;
-	inet_addr_t addr;
-	char *endptr;
-
-	rc = inet_addr_parse("1234:5678::/", &addr, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS('/', *endptr);
-
-	PCUT_ASSERT_INT_EQUALS(ip_v6, addr.version);
-
-	PCUT_ASSERT_INT_EQUALS(0x12, addr.addr6[0]);
-	PCUT_ASSERT_INT_EQUALS(0x34, addr.addr6[1]);
-	PCUT_ASSERT_INT_EQUALS(0x56, addr.addr6[2]);
-	PCUT_ASSERT_INT_EQUALS(0x78, addr.addr6[3]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[4]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[5]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[6]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[7]);
-
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[8]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[9]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[10]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[11]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[12]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[13]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[14]);
-	PCUT_ASSERT_INT_EQUALS(0x00, addr.addr6[15]);
-}
-
-PCUT_EXPORT(addr);
Index: pace/lib/inet/test/eth_addr.c
===================================================================
--- uspace/lib/inet/test/eth_addr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(eth_addr);
-
-/** Test ETH_ADDR_INITIALIZER constructs correct Ethernet address */
-PCUT_TEST(initializer)
-{
-	eth_addr_t addr = ETH_ADDR_INITIALIZER(0x11, 0x22, 0x33, 0x44, 0x55,
-	    0x66);
-	PCUT_ASSERT_INT_EQUALS(0x112233445566, addr.a);
-}
-
-/** Test eth_addr_decode() correctly decodes from array of bytes */
-PCUT_TEST(decode)
-{
-	eth_addr_t addr;
-	uint8_t b[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
-
-	eth_addr_decode(b, &addr);
-	PCUT_ASSERT_INT_EQUALS(0x112233445566, addr.a);
-}
-
-/** Test eth_addr_encode() correctly encodes to array of bytes */
-PCUT_TEST(encode)
-{
-	eth_addr_t addr;
-	uint8_t b[7] = { 0, 0, 0, 0, 0, 0, 0 };
-
-	addr.a = 0x112233445566;
-	eth_addr_encode(&addr, b);
-
-	PCUT_ASSERT_INT_EQUALS(0x11, b[0]);
-	PCUT_ASSERT_INT_EQUALS(0x22, b[1]);
-	PCUT_ASSERT_INT_EQUALS(0x33, b[2]);
-	PCUT_ASSERT_INT_EQUALS(0x44, b[3]);
-	PCUT_ASSERT_INT_EQUALS(0x55, b[4]);
-	PCUT_ASSERT_INT_EQUALS(0x66, b[5]);
-}
-
-/** Test eth_addr_compare() correctly compares two Ethernet addresses */
-PCUT_TEST(compare)
-{
-	eth_addr_t a;
-	eth_addr_t b;
-
-	a.a = 1;
-	b.a = 2;
-	PCUT_ASSERT_INT_EQUALS(-1, eth_addr_compare(&a, &b));
-
-	a.a = 2;
-	b.a = 2;
-	PCUT_ASSERT_INT_EQUALS(0, eth_addr_compare(&a, &b));
-
-	a.a = 2;
-	b.a = 1;
-	PCUT_ASSERT_INT_EQUALS(1, eth_addr_compare(&a, &b));
-}
-
-/** Tets eth_addr_format() correctly formats Ethernet address to string */
-PCUT_TEST(format)
-{
-	eth_addr_t addr1 = ETH_ADDR_INITIALIZER(0x11, 0x22, 0x33, 0x44, 0x55, 0x66);
-	eth_addr_t addr2 = ETH_ADDR_INITIALIZER(0x01, 0x02, 0x03, 0x04, 0x05, 0x06);
-	eth_addr_t addr3 = ETH_ADDR_INITIALIZER(0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff);
-	eth_addr_str_t saddr;
-
-	eth_addr_format(&addr1, &saddr);
-	PCUT_ASSERT_STR_EQUALS("11:22:33:44:55:66", saddr.str);
-
-	eth_addr_format(&addr2, &saddr);
-	PCUT_ASSERT_STR_EQUALS("01:02:03:04:05:06", saddr.str);
-
-	eth_addr_format(&addr3, &saddr);
-	PCUT_ASSERT_STR_EQUALS("aa:bb:cc:dd:ee:ff", saddr.str);
-}
-
-PCUT_EXPORT(eth_addr);
Index: pace/lib/inet/test/main.c
===================================================================
--- uspace/lib/inet/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(addr);
-PCUT_IMPORT(eth_addr);
-
-PCUT_MAIN();
Index: pace/lib/input/doc/doxygroups.h
===================================================================
--- uspace/lib/input/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libinput libinput
- * @ingroup libs
- */
Index: pace/lib/input/include/io/input.h
===================================================================
--- uspace/lib/input/include/io/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_INPUT_H_
-#define _LIBINPUT_INPUT_H_
-
-#include <async.h>
-#include <io/kbd_event.h>
-
-struct input_ev_ops;
-
-typedef struct {
-	async_sess_t *sess;
-	struct input_ev_ops *ev_ops;
-	void *user;
-} input_t;
-
-typedef struct input_ev_ops {
-	errno_t (*active)(input_t *);
-	errno_t (*deactive)(input_t *);
-	errno_t (*key)(input_t *, unsigned, kbd_event_type_t, keycode_t,
-	    keymod_t, char32_t);
-	errno_t (*move)(input_t *, unsigned, int, int);
-	errno_t (*abs_move)(input_t *, unsigned, unsigned, unsigned, unsigned,
-	    unsigned);
-	errno_t (*button)(input_t *, unsigned, int, int);
-	errno_t (*dclick)(input_t *, unsigned, int);
-} input_ev_ops_t;
-
-extern errno_t input_open(async_sess_t *, input_ev_ops_t *, void *, input_t **);
-extern void input_close(input_t *);
-extern errno_t input_activate(input_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/input/include/io/kbd_event.h
===================================================================
--- uspace/lib/input/include/io/kbd_event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IO_KBD_EVENT_H_
-#define _LIBINPUT_IO_KBD_EVENT_H_
-
-#include <inttypes.h>
-#include <io/keycode.h>
-#include <types/common.h>
-
-typedef enum {
-	KEY_PRESS,
-	KEY_RELEASE
-} kbd_event_type_t;
-
-/** Console event structure. */
-typedef struct {
-	/** Keyboard device ID */
-	sysarg_t kbd_id;
-
-	/** Press or release event. */
-	kbd_event_type_t type;
-
-	/** Keycode of the key that was pressed or released. */
-	keycode_t key;
-
-	/** Bitmask of modifiers held. */
-	keymod_t mods;
-
-	/** The character that was generated or '\0' for none. */
-	char32_t c;
-} kbd_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/input/include/io/keycode.h
===================================================================
--- uspace/lib/input/include/io/keycode.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IO_KEYCODE_H_
-#define _LIBINPUT_IO_KEYCODE_H_
-
-/** Keycode definitions.
- *
- * A keycode identifies a key by its position on the keyboard, rather
- * than by its label. For human readability, key positions are noted
- * with the key label on a keyboard with US layout. This label has
- * nothing to do with the character, that the key produces
- * -- this is determined by the keymap.
- *
- * The keyboard model reflects a standard PC keyboard layout.
- * Non-standard keyboards need to be mapped to this model in some
- * logical way. Scancodes are mapped to keycodes with a scanmap.
- *
- * For easier mapping to the model and to emphasize the nature of keycodes,
- * they really are organized here by position, rather than by label.
- */
-typedef enum {
-
-	/* Main block row 1 */
-
-	KC_BACKTICK = 1,
-
-	KC_1,
-	KC_2,
-	KC_3,
-	KC_4,
-	KC_5,
-	KC_6,
-	KC_7,
-	KC_8,
-	KC_9,
-	KC_0,
-
-	KC_MINUS,
-	KC_EQUALS,
-	KC_BACKSPACE,
-
-	/* Main block row 2 */
-
-	KC_TAB,
-
-	KC_Q,
-	KC_W,
-	KC_E,
-	KC_R,
-	KC_T,
-	KC_Y,
-	KC_U,
-	KC_I,
-	KC_O,
-	KC_P,
-
-	KC_LBRACKET,
-	KC_RBRACKET,
-
-	/* Main block row 3 */
-
-	KC_CAPS_LOCK,
-
-	KC_A,
-	KC_S,
-	KC_D,
-	KC_F,
-	KC_G,
-	KC_H,
-	KC_J,
-	KC_K,
-	KC_L,
-
-	KC_SEMICOLON,
-	KC_QUOTE,
-	KC_BACKSLASH,
-	KC_HASH,
-
-	KC_ENTER,
-
-	/* Main block row 4 */
-
-	KC_LSHIFT,
-
-	KC_Z,
-	KC_X,
-	KC_C,
-	KC_V,
-	KC_B,
-	KC_N,
-	KC_M,
-
-	KC_COMMA,
-	KC_PERIOD,
-	KC_SLASH,
-
-	KC_RSHIFT,
-
-	/* Main block row 5 */
-
-	KC_LCTRL,
-	KC_LALT,
-	KC_SPACE,
-	KC_RALT,
-	KC_RCTRL,
-
-	/* Function keys block */
-
-	KC_ESCAPE,
-
-	KC_F1,
-	KC_F2,
-	KC_F3,
-	KC_F4,
-	KC_F5,
-	KC_F6,
-	KC_F7,
-	KC_F8,
-	KC_F9,
-	KC_F10,
-	KC_F11,
-	KC_F12,
-
-	KC_PRTSCR,
-	KC_SYSREQ,
-	KC_SCROLL_LOCK,
-	KC_PAUSE,
-	KC_BREAK,
-
-	/* Cursor keys block */
-
-	KC_INSERT,
-	KC_HOME,
-	KC_PAGE_UP,
-
-	KC_DELETE,
-	KC_END,
-	KC_PAGE_DOWN,
-
-	KC_UP,
-	KC_LEFT,
-	KC_DOWN,
-	KC_RIGHT,
-
-	/* Numeric block */
-
-	KC_NUM_LOCK,
-	KC_NSLASH,
-	KC_NTIMES,
-	KC_NMINUS,
-
-	KC_NPLUS,
-	KC_NENTER,
-
-	KC_N7,
-	KC_N8,
-	KC_N9,
-
-	KC_N4,
-	KC_N5,
-	KC_N6,
-
-	KC_N1,
-	KC_N2,
-	KC_N3,
-
-	KC_N0,
-	KC_NPERIOD
-
-} keycode_t;
-
-typedef enum {
-	KM_LSHIFT      = 0x001,
-	KM_RSHIFT      = 0x002,
-	KM_LCTRL       = 0x004,
-	KM_RCTRL       = 0x008,
-	KM_LALT        = 0x010,
-	KM_RALT        = 0x020,
-	KM_CAPS_LOCK   = 0x040,
-	KM_NUM_LOCK    = 0x080,
-	KM_SCROLL_LOCK = 0x100,
-
-	KM_SHIFT       = KM_LSHIFT | KM_RSHIFT,
-	KM_CTRL        = KM_LCTRL | KM_RCTRL,
-	KM_ALT         = KM_LALT | KM_RALT
-} keymod_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/input/include/io/pos_event.h
===================================================================
--- uspace/lib/input/include/io/pos_event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2012 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IO_POS_EVENT_H_
-#define _LIBINPUT_IO_POS_EVENT_H_
-
-#include <types/common.h>
-
-typedef enum {
-	/** Position update */
-	POS_UPDATE,
-	/** Button press */
-	POS_PRESS,
-	/** Button release */
-	POS_RELEASE,
-	/** Double click */
-	POS_DCLICK
-} pos_event_type_t;
-
-/** Positioning device event */
-typedef struct {
-	sysarg_t pos_id;
-	pos_event_type_t type;
-	sysarg_t btn_num;
-	sysarg_t hpos;
-	sysarg_t vpos;
-} pos_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/input/include/ipc/input.h
===================================================================
--- uspace/lib/input/include/ipc/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IPC_INPUT_H_
-#define _LIBINPUT_IPC_INPUT_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	INPUT_ACTIVATE = IPC_FIRST_USER_METHOD
-} input_request_t;
-
-typedef enum {
-	INPUT_EVENT_ACTIVE = IPC_FIRST_USER_METHOD,
-	INPUT_EVENT_DEACTIVE,
-	INPUT_EVENT_KEY,
-	INPUT_EVENT_MOVE,
-	INPUT_EVENT_ABS_MOVE,
-	INPUT_EVENT_BUTTON,
-	INPUT_EVENT_DCLICK
-} input_notif_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/input/include/ipc/kbdev.h
===================================================================
--- uspace/lib/input/include/ipc/kbdev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IPC_KBDEV_H_
-#define _LIBINPUT_IPC_KBDEV_H_
-
-#include <ipc/common.h>
-#include <ipc/dev_iface.h>
-
-typedef enum {
-	KBDEV_YIELD = DEV_FIRST_CUSTOM_METHOD,
-	KBDEV_RECLAIM,
-	KBDEV_SET_IND
-} kbdev_request_t;
-
-typedef enum {
-	KBDEV_EVENT = IPC_FIRST_USER_METHOD
-} kbdev_notif_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/input/include/ipc/mouseev.h
===================================================================
--- uspace/lib/input/include/ipc/mouseev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @brief
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBINPUT_IPC_MOUSEEV_H_
-#define _LIBINPUT_IPC_MOUSEEV_H_
-
-#include <ipc/common.h>
-#include <ipc/dev_iface.h>
-
-typedef enum {
-	MOUSEEV_YIELD = DEV_FIRST_CUSTOM_METHOD,
-	MOUSEEV_RECLAIM
-} mouseev_request_t;
-
-typedef enum {
-	MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD,
-	MOUSEEV_ABS_MOVE_EVENT,
-	MOUSEEV_BUTTON_EVENT
-} mouseev_notif_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/input/meson.build
===================================================================
--- uspace/lib/input/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/input.c',
-)
Index: pace/lib/input/src/input.c
===================================================================
--- uspace/lib/input/src/input.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libinput
- * @{
- */
-/**
- * @file
- * @brief Input protocol client stub
- */
-
-#include <async.h>
-#include <assert.h>
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/input.h>
-#include <ipc/input.h>
-#include <stdlib.h>
-
-static void input_cb_conn(ipc_call_t *icall, void *arg);
-
-errno_t input_open(async_sess_t *sess, input_ev_ops_t *ev_ops,
-    void *arg, input_t **rinput)
-{
-	input_t *input = calloc(1, sizeof(input_t));
-	if (input == NULL)
-		return ENOMEM;
-
-	input->sess = sess;
-	input->ev_ops = ev_ops;
-	input->user = arg;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_INPUT_CB, 0, 0,
-	    input_cb_conn, input, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		goto error;
-
-	*rinput = input;
-	return EOK;
-
-error:
-	if (input != NULL)
-		free(input);
-
-	return rc;
-}
-
-void input_close(input_t *input)
-{
-	/* XXX Synchronize with input_cb_conn */
-	free(input);
-}
-
-errno_t input_activate(input_t *input)
-{
-	async_exch_t *exch = async_exchange_begin(input->sess);
-	errno_t rc = async_req_0_0(exch, INPUT_ACTIVATE);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-static void input_ev_active(input_t *input, ipc_call_t *call)
-{
-	errno_t rc = input->ev_ops->active(input);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_deactive(input_t *input, ipc_call_t *call)
-{
-	errno_t rc = input->ev_ops->deactive(input);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_key(input_t *input, ipc_call_t *call)
-{
-	unsigned kbd_id;
-	kbd_event_type_t type;
-	keycode_t key;
-	keymod_t mods;
-	char32_t c;
-	errno_t rc;
-
-	kbd_id = ipc_get_arg1(call);
-	type = ipc_get_arg2(call);
-	key = ipc_get_arg3(call);
-	mods = ipc_get_arg4(call);
-	c = ipc_get_arg5(call);
-
-	rc = input->ev_ops->key(input, kbd_id, type, key, mods, c);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_move(input_t *input, ipc_call_t *call)
-{
-	unsigned pos_id;
-	int dx;
-	int dy;
-	errno_t rc;
-
-	pos_id = ipc_get_arg1(call);
-	dx = ipc_get_arg2(call);
-	dy = ipc_get_arg3(call);
-
-	rc = input->ev_ops->move(input, pos_id, dx, dy);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_abs_move(input_t *input, ipc_call_t *call)
-{
-	unsigned pos_id;
-	unsigned x;
-	unsigned y;
-	unsigned max_x;
-	unsigned max_y;
-	errno_t rc;
-
-	pos_id = ipc_get_arg1(call);
-	x = ipc_get_arg2(call);
-	y = ipc_get_arg3(call);
-	max_x = ipc_get_arg4(call);
-	max_y = ipc_get_arg5(call);
-
-	rc = input->ev_ops->abs_move(input, pos_id, x, y, max_x, max_y);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_button(input_t *input, ipc_call_t *call)
-{
-	unsigned pos_id;
-	int bnum;
-	int press;
-	errno_t rc;
-
-	pos_id = ipc_get_arg1(call);
-	bnum = ipc_get_arg2(call);
-	press = ipc_get_arg3(call);
-
-	rc = input->ev_ops->button(input, pos_id, bnum, press);
-	async_answer_0(call, rc);
-}
-
-static void input_ev_dclick(input_t *input, ipc_call_t *call)
-{
-	unsigned pos_id;
-	int bnum;
-	errno_t rc;
-
-	pos_id = ipc_get_arg1(call);
-	bnum = ipc_get_arg2(call);
-
-	rc = input->ev_ops->dclick(input, pos_id, bnum);
-	async_answer_0(call, rc);
-}
-
-static void input_cb_conn(ipc_call_t *icall, void *arg)
-{
-	input_t *input = (input_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case INPUT_EVENT_ACTIVE:
-			input_ev_active(input, &call);
-			break;
-		case INPUT_EVENT_DEACTIVE:
-			input_ev_deactive(input, &call);
-			break;
-		case INPUT_EVENT_KEY:
-			input_ev_key(input, &call);
-			break;
-		case INPUT_EVENT_MOVE:
-			input_ev_move(input, &call);
-			break;
-		case INPUT_EVENT_ABS_MOVE:
-			input_ev_abs_move(input, &call);
-			break;
-		case INPUT_EVENT_BUTTON:
-			input_ev_button(input, &call);
-			break;
-		case INPUT_EVENT_DCLICK:
-			input_ev_dclick(input, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/ipcgfx/doc/doxygroups.h
===================================================================
--- uspace/lib/ipcgfx/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libcongfx libcongfx
- * @ingroup libs
- */
Index: pace/lib/ipcgfx/include/ipcgfx/client.h
===================================================================
--- uspace/lib/ipcgfx/include/ipcgfx/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX IPC backend
- */
-
-#ifndef _IPCGFX_CLIENT_H
-#define _IPCGFX_CLIENT_H
-
-#include <async.h>
-#include <types/ipcgfx/client.h>
-#include <types/gfx/context.h>
-#include <types/gfx/ops/context.h>
-
-extern gfx_context_ops_t ipc_gc_ops;
-
-extern errno_t ipc_gc_create(async_sess_t *, ipc_gc_t **);
-extern errno_t ipc_gc_delete(ipc_gc_t *);
-extern gfx_context_t *ipc_gc_get_ctx(ipc_gc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/include/ipcgfx/ipc/gc.h
===================================================================
--- uspace/lib/ipcgfx/include/ipcgfx/ipc/gc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/** @file
- */
-
-#ifndef _IPCGFX_IPC_GC_H_
-#define _IPCGFX_IPC_GC_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	GC_SET_CLIP_RECT = IPC_FIRST_USER_METHOD,
-	GC_SET_CLIP_RECT_NULL,
-	GC_SET_RGB_COLOR,
-	GC_FILL_RECT,
-	GC_UPDATE,
-	GC_BITMAP_CREATE,
-	GC_BITMAP_CREATE_DOUTPUT,
-	GC_BITMAP_DESTROY,
-	GC_BITMAP_RENDER,
-	GC_BITMAP_GET_ALLOC,
-} gc_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/include/ipcgfx/server.h
===================================================================
--- uspace/lib/ipcgfx/include/ipcgfx/server.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX IPC server
- */
-
-#ifndef _IPCGFX_SERVER_H
-#define _IPCGFX_SERVER_H
-
-#include <async.h>
-#include <errno.h>
-#include <gfx/context.h>
-
-extern errno_t gc_conn(ipc_call_t *icall, gfx_context_t *gc);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/include/types/ipcgfx/client.h
===================================================================
--- uspace/lib/ipcgfx/include/types/ipcgfx/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX IPC backend
- */
-
-#ifndef _IPCGFX_TYPES_CLIENT_H
-#define _IPCGFX_TYPES_CLIENT_H
-
-struct ipc_gc;
-typedef struct ipc_gc ipc_gc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/meson.build
===================================================================
--- uspace/lib/ipcgfx/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2019 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx' ]
-src = files(
-	'src/client.c',
-	'src/server.c'
-)
-
-test_src = files(
-	'test/ipcgfx.c',
-	'test/main.c',
-)
Index: pace/lib/ipcgfx/private/client.h
===================================================================
--- uspace/lib/ipcgfx/private/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX console backend structure
- *
- */
-
-#ifndef _IPCGFX_PRIVATE_CLIENT_H
-#define _IPCGFX_PRIVATE_CLIENT_H
-
-#include <async.h>
-#include <gfx/context.h>
-
-/** Actual structure of graphics context.
- *
- * This is private to libcongfx. It is not visible to clients nor backends.
- */
-struct ipc_gc {
-	/** Base graphic context */
-	gfx_context_t *gc;
-	/** Session with GFX server */
-	async_sess_t *sess;
-};
-
-/** Bitmap in IPC GC */
-typedef struct {
-	/** Containing IPC GC */
-	struct ipc_gc *ipcgc;
-	/** Allocation info */
-	gfx_bitmap_alloc_t alloc;
-	/** @c true if we allocated the bitmap, @c false if allocated by caller */
-	bool myalloc;
-	/** Rectangle covered by bitmap */
-	gfx_rect_t rect;
-	/** Server bitmap ID */
-	sysarg_t bmp_id;
-} ipc_gc_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/private/server.h
===================================================================
--- uspace/lib/ipcgfx/private/server.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file IPC GFX backend structure
- *
- */
-
-#ifndef _IPCGFX_PRIVATE_SERVER_H
-#define _IPCGFX_PRIVATE_SERVER_H
-
-#include <adt/list.h>
-#include <async.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-
-/** Server-side of IPC GC connection.
- */
-typedef struct {
-	/** Graphics context to serve */
-	gfx_context_t *gc;
-	/** List of bitmaps (ipc_gc_srv_bitmap_t) */
-	list_t bitmaps;
-	/** Next bitmap ID to allocate */
-	sysarg_t next_bmp_id;
-} ipc_gc_srv_t;
-
-/** Bitmap in canvas GC */
-typedef struct {
-	/** Containing canvas GC */
-	ipc_gc_srv_t *srvgc;
-	/** Link to srvgc->bitmaps */
-	link_t lbitmaps;
-	/** Backing bitmap */
-	gfx_bitmap_t *bmp;
-	/** Bitmap ID */
-	sysarg_t bmp_id;
-	/** @c true if we allocated the pixels */
-	bool myalloc;
-	/** Pixels of the bitmap */
-	void *pixels;
-} ipc_gc_srv_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipcgfx/src/client.c
===================================================================
--- uspace/lib/ipcgfx/src/client.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,513 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX IPC backend
- *
- * This implements a graphics context via HelenOS IPC.
- */
-
-#include <as.h>
-#include <ipcgfx/client.h>
-#include <ipcgfx/ipc/gc.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <stdlib.h>
-#include "../private/client.h"
-
-static errno_t ipc_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t ipc_gc_set_color(void *, gfx_color_t *);
-static errno_t ipc_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t ipc_gc_update(void *);
-static errno_t ipc_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t ipc_gc_bitmap_destroy(void *);
-static errno_t ipc_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t ipc_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-gfx_context_ops_t ipc_gc_ops = {
-	.set_clip_rect = ipc_gc_set_clip_rect,
-	.set_color = ipc_gc_set_color,
-	.fill_rect = ipc_gc_fill_rect,
-	.update = ipc_gc_update,
-	.bitmap_create = ipc_gc_bitmap_create,
-	.bitmap_destroy = ipc_gc_bitmap_destroy,
-	.bitmap_render = ipc_gc_bitmap_render,
-	.bitmap_get_alloc = ipc_gc_bitmap_get_alloc
-};
-
-/** Set clipping rectangle on IPC GC.
- *
- * @param arg IPC GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(ipcgc->sess);
-	if (rect != NULL) {
-		rc = async_req_4_0(exch, GC_SET_CLIP_RECT, rect->p0.x, rect->p0.y,
-		    rect->p1.x, rect->p1.y);
-	} else {
-		rc = async_req_0_0(exch, GC_SET_CLIP_RECT_NULL);
-	}
-
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Set color on IPC GC.
- *
- * Set drawing color on IPC GC.
- *
- * @param arg IPC GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_set_color(void *arg, gfx_color_t *color)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	async_exch_t *exch;
-	uint16_t r, g, b;
-	errno_t rc;
-
-	gfx_color_get_rgb_i16(color, &r, &g, &b);
-
-	exch = async_exchange_begin(ipcgc->sess);
-	rc = async_req_3_0(exch, GC_SET_RGB_COLOR, r, g, b);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Fill rectangle on IPC GC.
- *
- * @param arg IPC GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(ipcgc->sess);
-	rc = async_req_4_0(exch, GC_FILL_RECT, rect->p0.x, rect->p0.y,
-	    rect->p1.x, rect->p1.y);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Update display on IPC GC.
- *
- * @param arg IPC GC
- *
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_update(void *arg)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(ipcgc->sess);
-	rc = async_req_0_0(exch, GC_UPDATE);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Create normal bitmap in IPC GC.
- *
- * @param arg IPC GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_bitmap_create_normal(void *arg,
-    gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	ipc_gc_bitmap_t *ipcbm = NULL;
-	gfx_coord2_t dim;
-	async_exch_t *exch = NULL;
-	as_area_info_t info;
-	ipc_call_t answer;
-	size_t asize;
-	aid_t req;
-	errno_t rc;
-
-	ipcbm = calloc(1, sizeof(ipc_gc_bitmap_t));
-	if (ipcbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	ipcbm->rect = params->rect;
-
-	if (alloc == NULL) {
-		ipcbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		ipcbm->alloc.off0 = 0;
-		ipcbm->alloc.pixels = as_area_create(AS_AREA_ANY,
-		    dim.x * dim.y * sizeof(uint32_t), AS_AREA_READ |
-		    AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-		if (ipcbm->alloc.pixels == AS_MAP_FAILED) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		ipcbm->myalloc = true;
-	} else {
-		/*
-		 * Accept user allocation if it points to a an acceptable
-		 * memory area.
-		 */
-		rc = as_area_get_info(alloc->pixels, &info);
-		if (rc != EOK)
-			goto error;
-
-		/* Pixels should start at the beginning of the area */
-		if (info.start_addr != (uintptr_t) alloc->pixels) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		/* Size of area should be size of bitmap rounded up to page size */
-		asize = PAGES2SIZE(SIZE2PAGES(alloc->pitch * dim.y));
-		if (info.size != asize) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		ipcbm->alloc = *alloc;
-	}
-
-	exch = async_exchange_begin(ipcgc->sess);
-	req = async_send_0(exch, GC_BITMAP_CREATE, &answer);
-	rc = async_data_write_start(exch, params, sizeof (gfx_bitmap_params_t));
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-
-	rc = async_share_out_start(exch, ipcbm->alloc.pixels,
-	    AS_AREA_READ | AS_AREA_CACHEABLE);
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-	async_exchange_end(exch);
-	exch = NULL;
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	ipcbm->ipcgc = ipcgc;
-	ipcbm->bmp_id = ipc_get_arg1(&answer);
-	*rbm = (void *)ipcbm;
-	return EOK;
-error:
-	if (exch != NULL)
-		async_exchange_end(exch);
-	if (ipcbm != NULL) {
-		if (ipcbm->alloc.pixels != NULL)
-			as_area_destroy(ipcbm->alloc.pixels);
-		free(ipcbm);
-	}
-	return rc;
-}
-
-/** Create direct output bitmap in IPC GC.
- *
- * @param arg IPC GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_bitmap_create_direct_output(void *arg,
-    gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	ipc_gc_t *ipcgc = (ipc_gc_t *) arg;
-	ipc_gc_bitmap_t *ipcbm = NULL;
-	gfx_coord2_t dim;
-	async_exch_t *exch = NULL;
-	void *pixels;
-	ipc_call_t answer;
-	size_t asize;
-	aid_t req;
-	errno_t rc;
-
-	/* Cannot specify allocation for direct output bitmap */
-	if (alloc != NULL)
-		return EINVAL;
-
-	ipcbm = calloc(1, sizeof(ipc_gc_bitmap_t));
-	if (ipcbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	ipcbm->rect = params->rect;
-
-	ipcbm->alloc.pitch = dim.x * sizeof(uint32_t);
-	ipcbm->alloc.off0 = 0;
-	ipcbm->myalloc = true;
-
-	asize = PAGES2SIZE(SIZE2PAGES(ipcbm->alloc.pitch * dim.y));
-
-	exch = async_exchange_begin(ipcgc->sess);
-	req = async_send_0(exch, GC_BITMAP_CREATE_DOUTPUT, &answer);
-	rc = async_data_write_start(exch, params, sizeof (gfx_bitmap_params_t));
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-
-	rc = async_share_in_start_0_0(exch, asize, &pixels);
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-	async_exchange_end(exch);
-	exch = NULL;
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	ipcbm->ipcgc = ipcgc;
-	ipcbm->bmp_id = ipc_get_arg1(&answer);
-	ipcbm->alloc.pixels = pixels;
-	*rbm = (void *)ipcbm;
-	return EOK;
-error:
-	if (exch != NULL)
-		async_exchange_end(exch);
-	if (ipcbm != NULL) {
-		if (ipcbm->alloc.pixels != NULL)
-			as_area_destroy(ipcbm->alloc.pixels);
-		free(ipcbm);
-	}
-	return rc;
-}
-
-/** Create bitmap in IPC GC.
- *
- * @param arg IPC GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t ipc_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	if ((params->flags & bmpf_direct_output) != 0) {
-		return ipc_gc_bitmap_create_direct_output(arg, params, alloc,
-		    rbm);
-	} else {
-		return ipc_gc_bitmap_create_normal(arg, params, alloc, rbm);
-	}
-}
-
-/** Destroy bitmap in IPC GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_bitmap_destroy(void *bm)
-{
-	ipc_gc_bitmap_t *ipcbm = (ipc_gc_bitmap_t *)bm;
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(ipcbm->ipcgc->sess);
-	rc = async_req_1_0(exch, GC_BITMAP_DESTROY, ipcbm->bmp_id);
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	if (ipcbm->myalloc)
-		as_area_destroy(ipcbm->alloc.pixels);
-	free(ipcbm);
-	return EOK;
-}
-
-/** Render bitmap in IPC GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	ipc_gc_bitmap_t *ipcbm = (ipc_gc_bitmap_t *)bm;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_coord2_t offs;
-	async_exch_t *exch = NULL;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	if (srect0 != NULL)
-		srect = *srect0;
-	else
-		srect = ipcbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	/* Destination rectangle */
-	gfx_rect_translate(&offs, &srect, &drect);
-
-	exch = async_exchange_begin(ipcbm->ipcgc->sess);
-	req = async_send_3(exch, GC_BITMAP_RENDER, ipcbm->bmp_id, offs.x,
-	    offs.y, &answer);
-
-	rc = async_data_write_start(exch, &srect, sizeof (gfx_rect_t));
-	if (rc != EOK) {
-		async_forget(req);
-		goto error;
-	}
-
-	async_exchange_end(exch);
-	exch = NULL;
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (exch != NULL)
-		async_exchange_end(exch);
-	return rc;
-}
-
-/** Get allocation info for bitmap in IPC GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t ipc_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	ipc_gc_bitmap_t *ipcbm = (ipc_gc_bitmap_t *)bm;
-	*alloc = ipcbm->alloc;
-	return EOK;
-}
-
-/** Create IPC GC.
- *
- * Create graphics context for rendering via IPC.
- *
- * @param sess Async session
- * @param rgc Place to store pointer to new GC.
- *
- * @return EOK on success or an error code
- */
-errno_t ipc_gc_create(async_sess_t *sess, ipc_gc_t **rgc)
-{
-	ipc_gc_t *ipcgc = NULL;
-	gfx_context_t *gc = NULL;
-	errno_t rc;
-
-	ipcgc = calloc(1, sizeof(ipc_gc_t));
-	if (ipcgc == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = gfx_context_new(&ipc_gc_ops, ipcgc, &gc);
-	if (rc != EOK)
-		goto error;
-
-	ipcgc->gc = gc;
-	ipcgc->sess = sess;
-	*rgc = ipcgc;
-	return EOK;
-error:
-	if (ipcgc != NULL)
-		free(ipcgc);
-	gfx_context_delete(gc);
-	return rc;
-}
-
-/** Delete IPC GC.
- *
- * @param ipcgc IPC GC
- */
-errno_t ipc_gc_delete(ipc_gc_t *ipcgc)
-{
-	errno_t rc;
-
-	rc = gfx_context_delete(ipcgc->gc);
-	if (rc != EOK)
-		return rc;
-
-	free(ipcgc);
-	return EOK;
-}
-
-/** Get generic graphic context from IPC GC.
- *
- * @param ipcgc IPC GC
- * @return Graphic context
- */
-gfx_context_t *ipc_gc_get_ctx(ipc_gc_t *ipcgc)
-{
-	return ipcgc->gc;
-}
-
-/** @}
- */
Index: pace/lib/ipcgfx/src/server.c
===================================================================
--- uspace/lib/ipcgfx/src/server.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,461 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipcgfx
- * @{
- */
-/**
- * @file GFX IPC server
- *
- * Serve a graphics context via HelenOS IPC.
- */
-
-#include <as.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/render.h>
-#include <ipcgfx/ipc/gc.h>
-#include <ipcgfx/server.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "../private/server.h"
-
-static ipc_gc_srv_bitmap_t *gc_bitmap_lookup(ipc_gc_srv_t *, sysarg_t);
-
-static void gc_set_clip_rect_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rect.p0.x = ipc_get_arg1(call);
-	rect.p0.y = ipc_get_arg2(call);
-	rect.p1.x = ipc_get_arg3(call);
-	rect.p1.y = ipc_get_arg4(call);
-
-	rc = gfx_set_clip_rect(srvgc->gc, &rect);
-	async_answer_0(call, rc);
-}
-
-static void gc_set_clip_rect_null_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	errno_t rc;
-
-	rc = gfx_set_clip_rect(srvgc->gc, NULL);
-	async_answer_0(call, rc);
-}
-
-static void gc_set_rgb_color_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	uint16_t r, g, b;
-	gfx_color_t *color;
-	errno_t rc;
-
-	r = ipc_get_arg1(call);
-	g = ipc_get_arg2(call);
-	b = ipc_get_arg3(call);
-
-	rc = gfx_color_new_rgb_i16(r, g, b, &color);
-	if (rc != EOK) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	rc = gfx_set_color(srvgc->gc, color);
-	async_answer_0(call, rc);
-}
-
-static void gc_fill_rect_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rect.p0.x = ipc_get_arg1(call);
-	rect.p0.y = ipc_get_arg2(call);
-	rect.p1.x = ipc_get_arg3(call);
-	rect.p1.y = ipc_get_arg4(call);
-
-	rc = gfx_fill_rect(srvgc->gc, &rect);
-	async_answer_0(call, rc);
-}
-
-static void gc_update_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	errno_t rc;
-
-	rc = gfx_update(srvgc->gc);
-	async_answer_0(call, rc);
-}
-
-static void gc_bitmap_create_srv(ipc_gc_srv_t *srvgc, ipc_call_t *icall)
-{
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bitmap;
-	gfx_coord2_t dim;
-	ipc_gc_srv_bitmap_t *srvbmp = NULL;
-	ipc_call_t call;
-	size_t size;
-	unsigned int flags;
-	void *pixels;
-	errno_t rc;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_bitmap_params_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &params, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Bitmap dimensions */
-	gfx_coord2_subtract(&params.rect.p1, &params.rect.p0, &dim);
-
-	if (!async_share_out_receive(&call, &size, &flags)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	/* Check size */
-	if (size != PAGES2SIZE(SIZE2PAGES(dim.x * dim.y * sizeof(uint32_t)))) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_share_out_finalize(&call, &pixels);
-	if (rc != EOK || pixels == AS_MAP_FAILED) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	alloc.pitch = dim.x * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = pixels;
-
-	srvbmp = calloc(1, sizeof(ipc_gc_srv_bitmap_t));
-	if (srvbmp == NULL) {
-		as_area_destroy(pixels);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = gfx_bitmap_create(srvgc->gc, &params, &alloc, &bitmap);
-	if (rc != EOK) {
-		free(srvbmp);
-		as_area_destroy(pixels);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	srvbmp->srvgc = srvgc;
-	list_append(&srvbmp->lbitmaps, &srvgc->bitmaps);
-	srvbmp->bmp = bitmap;
-	srvbmp->bmp_id = srvgc->next_bmp_id++;
-
-	/* We created the memory area by sharing it in */
-	srvbmp->myalloc = true;
-	srvbmp->pixels = pixels;
-
-	async_answer_1(icall, EOK, srvbmp->bmp_id);
-}
-
-static void gc_bitmap_create_doutput_srv(ipc_gc_srv_t *srvgc, ipc_call_t *icall)
-{
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bitmap;
-	gfx_coord2_t dim;
-	ipc_gc_srv_bitmap_t *srvbmp = NULL;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_bitmap_params_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &params, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Bitmap dimensions */
-	gfx_coord2_subtract(&params.rect.p1, &params.rect.p0, &dim);
-
-	if (!async_share_in_receive(&call, &size)) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	/* Check size */
-	if (size != PAGES2SIZE(SIZE2PAGES(dim.x * dim.y * sizeof(uint32_t)))) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = gfx_bitmap_create(srvgc->gc, &params, NULL, &bitmap);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(bitmap);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_share_in_finalize(&call, alloc.pixels, AS_AREA_READ |
-	    AS_AREA_WRITE | AS_AREA_CACHEABLE);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(bitmap);
-		async_answer_0(icall, EIO);
-		return;
-	}
-
-	srvbmp = calloc(1, sizeof(ipc_gc_srv_bitmap_t));
-	if (srvbmp == NULL) {
-		gfx_bitmap_destroy(bitmap);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	srvbmp->srvgc = srvgc;
-	list_append(&srvbmp->lbitmaps, &srvgc->bitmaps);
-	srvbmp->bmp = bitmap;
-	srvbmp->bmp_id = srvgc->next_bmp_id++;
-
-	/* Area allocated by backing GC, we just shared it out */
-	srvbmp->myalloc = false;
-	srvbmp->pixels = alloc.pixels; // Not really needed
-
-	async_answer_1(icall, EOK, srvbmp->bmp_id);
-}
-
-static void gc_bitmap_destroy_srv(ipc_gc_srv_t *srvgc, ipc_call_t *call)
-{
-	sysarg_t bmp_id;
-	ipc_gc_srv_bitmap_t *bitmap;
-	errno_t rc;
-
-	bmp_id = ipc_get_arg1(call);
-
-	bitmap = gc_bitmap_lookup(srvgc, bmp_id);
-	if (bitmap == NULL) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	rc = gfx_bitmap_destroy(bitmap->bmp);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return;
-	}
-
-	if (bitmap->myalloc)
-		as_area_destroy(bitmap->pixels);
-
-	list_remove(&bitmap->lbitmaps);
-	free(bitmap);
-
-	async_answer_0(call, rc);
-}
-
-static void gc_bitmap_render_srv(ipc_gc_srv_t *srvgc, ipc_call_t *icall)
-{
-	ipc_gc_srv_bitmap_t *bitmap;
-	sysarg_t bmp_id;
-	gfx_rect_t srect;
-	gfx_coord2_t offs;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(gfx_rect_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &srect, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	bmp_id = ipc_get_arg1(icall);
-	offs.x = ipc_get_arg2(icall);
-	offs.y = ipc_get_arg3(icall);
-
-	bitmap = gc_bitmap_lookup(srvgc, bmp_id);
-	if (bitmap == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = gfx_bitmap_render(bitmap->bmp, &srect, &offs);
-	async_answer_0(icall, rc);
-}
-
-errno_t gc_conn(ipc_call_t *icall, gfx_context_t *gc)
-{
-	ipc_gc_srv_t srvgc;
-	ipc_gc_srv_bitmap_t *bitmap;
-	link_t *link;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	srvgc.gc = gc;
-	list_initialize(&srvgc.bitmaps);
-	srvgc.next_bmp_id = 1;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case GC_SET_CLIP_RECT:
-			gc_set_clip_rect_srv(&srvgc, &call);
-			break;
-		case GC_SET_CLIP_RECT_NULL:
-			gc_set_clip_rect_null_srv(&srvgc, &call);
-			break;
-		case GC_SET_RGB_COLOR:
-			gc_set_rgb_color_srv(&srvgc, &call);
-			break;
-		case GC_FILL_RECT:
-			gc_fill_rect_srv(&srvgc, &call);
-			break;
-		case GC_UPDATE:
-			gc_update_srv(&srvgc, &call);
-			break;
-		case GC_BITMAP_CREATE:
-			gc_bitmap_create_srv(&srvgc, &call);
-			break;
-		case GC_BITMAP_CREATE_DOUTPUT:
-			gc_bitmap_create_doutput_srv(&srvgc, &call);
-			break;
-		case GC_BITMAP_DESTROY:
-			gc_bitmap_destroy_srv(&srvgc, &call);
-			break;
-		case GC_BITMAP_RENDER:
-			gc_bitmap_render_srv(&srvgc, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-
-	/*
-	 * Destroy all remaining bitmaps. A client should destroy all
-	 * the bitmaps before closing connection. But it could happen
-	 * that the client is misbehaving or was abruptly disconnected
-	 * (e.g. crashed).
-	 */
-	link = list_first(&srvgc.bitmaps);
-	while (link != NULL) {
-		bitmap = list_get_instance(link, ipc_gc_srv_bitmap_t,
-		    lbitmaps);
-
-		(void) gfx_bitmap_destroy(bitmap->bmp);
-		if (bitmap->myalloc)
-			as_area_destroy(bitmap->pixels);
-		list_remove(&bitmap->lbitmaps);
-		free(bitmap);
-
-		link = list_first(&srvgc.bitmaps);
-	}
-
-	return EOK;
-}
-
-static ipc_gc_srv_bitmap_t *gc_bitmap_lookup(ipc_gc_srv_t *srvgc,
-    sysarg_t bmp_id)
-{
-	link_t *link;
-	ipc_gc_srv_bitmap_t *bmp;
-
-	link = list_first(&srvgc->bitmaps);
-	while (link != NULL) {
-		bmp = list_get_instance(link, ipc_gc_srv_bitmap_t, lbitmaps);
-		if (bmp->bmp_id == bmp_id)
-			return bmp;
-		link = list_next(link, &srvgc->bitmaps);
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: pace/lib/ipcgfx/test/ipcgfx.c
===================================================================
--- uspace/lib/ipcgfx/test/ipcgfx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1254 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <as.h>
-#include <async.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <ipcgfx/client.h>
-#include <ipcgfx/server.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <stdint.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ipcgfx);
-
-static const char *test_ipcgfx_server = "test-ipcgfx";
-static const char *test_ipcgfx_svc = "test/ipcgfx";
-
-static void test_ipcgc_conn(ipc_call_t *, void *);
-
-static errno_t test_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t test_gc_set_color(void *, gfx_color_t *);
-static errno_t test_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t test_gc_update(void *);
-static errno_t test_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t test_gc_bitmap_destroy(void *);
-static errno_t test_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t test_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static gfx_context_ops_t test_gc_ops = {
-	.set_clip_rect = test_gc_set_clip_rect,
-	.set_color = test_gc_set_color,
-	.fill_rect = test_gc_fill_rect,
-	.update = test_gc_update,
-	.bitmap_create = test_gc_bitmap_create,
-	.bitmap_destroy = test_gc_bitmap_destroy,
-	.bitmap_render = test_gc_bitmap_render,
-	.bitmap_get_alloc = test_gc_bitmap_get_alloc
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-
-	bool set_clip_rect_called;
-	bool do_clip;
-	gfx_rect_t set_clip_rect_rect;
-
-	bool set_color_called;
-	uint16_t set_color_r;
-	uint16_t set_color_g;
-	uint16_t set_color_b;
-
-	bool fill_rect_called;
-	gfx_rect_t fill_rect_rect;
-
-	bool update_called;
-
-	bool bitmap_create_called;
-	gfx_bitmap_params_t bitmap_create_params;
-	gfx_bitmap_alloc_t bitmap_create_alloc;
-
-	bool bitmap_destroy_called;
-
-	bool bitmap_render_called;
-	gfx_rect_t bitmap_render_srect;
-	gfx_coord2_t bitmap_render_offs;
-
-	bool bitmap_get_alloc_called;
-} test_response_t;
-
-/** Bitmap in test GC */
-typedef struct {
-	test_response_t *resp;
-	gfx_bitmap_alloc_t alloc;
-} test_bitmap_t;
-
-/** gfx_set_clip_rect with server returning failure */
-PCUT_TEST(set_clip_rect_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = ENOMEM;
-	resp.set_clip_rect_called = false;
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.set_clip_rect_called);
-	PCUT_ASSERT_EQUALS(rect.p0.x, resp.set_clip_rect_rect.p0.x);
-	PCUT_ASSERT_EQUALS(rect.p0.y, resp.set_clip_rect_rect.p0.y);
-	PCUT_ASSERT_EQUALS(rect.p1.x, resp.set_clip_rect_rect.p1.x);
-	PCUT_ASSERT_EQUALS(rect.p1.y, resp.set_clip_rect_rect.p1.y);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_set_clip_rect with server returning success */
-PCUT_TEST(set_clip_rect_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.set_clip_rect_called = false;
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.set_clip_rect_called);
-	PCUT_ASSERT_TRUE(resp.do_clip);
-	PCUT_ASSERT_EQUALS(rect.p0.x, resp.set_clip_rect_rect.p0.x);
-	PCUT_ASSERT_EQUALS(rect.p0.y, resp.set_clip_rect_rect.p0.y);
-	PCUT_ASSERT_EQUALS(rect.p1.x, resp.set_clip_rect_rect.p1.x);
-	PCUT_ASSERT_EQUALS(rect.p1.y, resp.set_clip_rect_rect.p1.y);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_set_clip_rect with null rectangle, server returning success */
-PCUT_TEST(set_clip_rect_null_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.set_clip_rect_called = false;
-
-	rc = gfx_set_clip_rect(gc, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.set_clip_rect_called);
-	PCUT_ASSERT_FALSE(resp.do_clip);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_set_color with server returning failure */
-PCUT_TEST(set_color_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.rc = ENOMEM;
-	resp.set_color_called = false;
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.set_color_called);
-	PCUT_ASSERT_EQUALS(1, resp.set_color_r);
-	PCUT_ASSERT_EQUALS(2, resp.set_color_g);
-	PCUT_ASSERT_EQUALS(3, resp.set_color_b);
-
-	gfx_color_delete(color);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_set_color with server returning success */
-PCUT_TEST(set_color_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.rc = EOK;
-	resp.set_color_called = false;
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.set_color_called);
-	PCUT_ASSERT_EQUALS(1, resp.set_color_r);
-	PCUT_ASSERT_EQUALS(2, resp.set_color_g);
-	PCUT_ASSERT_EQUALS(3, resp.set_color_b);
-
-	gfx_color_delete(color);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_fill_rect with server returning failure */
-PCUT_TEST(fill_rect_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = ENOMEM;
-	resp.fill_rect_called = false;
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.fill_rect_called);
-	PCUT_ASSERT_EQUALS(rect.p0.x, resp.fill_rect_rect.p0.x);
-	PCUT_ASSERT_EQUALS(rect.p0.y, resp.fill_rect_rect.p0.y);
-	PCUT_ASSERT_EQUALS(rect.p1.x, resp.fill_rect_rect.p1.x);
-	PCUT_ASSERT_EQUALS(rect.p1.y, resp.fill_rect_rect.p1.y);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_fill_rect with server returning success */
-PCUT_TEST(fill_rect_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.fill_rect_called = false;
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.fill_rect_called);
-	PCUT_ASSERT_EQUALS(rect.p0.x, resp.fill_rect_rect.p0.x);
-	PCUT_ASSERT_EQUALS(rect.p0.y, resp.fill_rect_rect.p0.y);
-	PCUT_ASSERT_EQUALS(rect.p1.x, resp.fill_rect_rect.p1.x);
-	PCUT_ASSERT_EQUALS(rect.p1.y, resp.fill_rect_rect.p1.y);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_update with server returning failure */
-PCUT_TEST(update_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = ENOMEM;
-	resp.update_called = false;
-	rc = gfx_update(gc);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.update_called);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_update with server returning success */
-PCUT_TEST(update_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.update_called = false;
-	rc = gfx_update(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.update_called);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_create with server returning failure */
-PCUT_TEST(bitmap_create_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = ENOMEM;
-	resp.bitmap_create_called = false;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	bitmap = NULL;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.bitmap_create_params.rect.p1.y);
-	PCUT_ASSERT_EQUALS((params.rect.p1.x - params.rect.p0.x) *
-	    sizeof(uint32_t), (unsigned) resp.bitmap_create_alloc.pitch);
-	PCUT_ASSERT_EQUALS(0, resp.bitmap_create_alloc.off0);
-	PCUT_ASSERT_NOT_NULL(resp.bitmap_create_alloc.pixels);
-	PCUT_ASSERT_NULL(bitmap);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_create and gfx_bitmap_destroy with server returning success */
-PCUT_TEST(bitmap_create_destroy_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.bitmap_create_called = false;
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	bitmap = NULL;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.bitmap_create_params.rect.p1.y);
-	PCUT_ASSERT_EQUALS((params.rect.p1.x - params.rect.p0.x) *
-	    sizeof(uint32_t), (unsigned) resp.bitmap_create_alloc.pitch);
-	PCUT_ASSERT_EQUALS(0, resp.bitmap_create_alloc.off0);
-	PCUT_ASSERT_NOT_NULL(resp.bitmap_create_alloc.pixels);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	resp.bitmap_destroy_called = false;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_destroy_called);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_destroy with server returning failure */
-PCUT_TEST(bitmap_destroy_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	resp.rc = EIO;
-	resp.bitmap_destroy_called = false;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_destroy_called);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_create direct output bitmap with server returning failure */
-PCUT_TEST(bitmap_create_dout_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = ENOMEM;
-	resp.bitmap_create_called = false;
-
-	gfx_bitmap_params_init(&params);
-	params.flags = bmpf_direct_output;
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	bitmap = NULL;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.bitmap_create_params.rect.p1.y);
-	PCUT_ASSERT_EQUALS((params.rect.p1.x - params.rect.p0.x) *
-	    sizeof(uint32_t), (unsigned) resp.bitmap_create_alloc.pitch);
-	PCUT_ASSERT_EQUALS(0, resp.bitmap_create_alloc.off0);
-	PCUT_ASSERT_NOT_NULL(resp.bitmap_create_alloc.pixels);
-	PCUT_ASSERT_NULL(bitmap);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_create direct output bitmap with server returning success */
-PCUT_TEST(bitmap_create_dout_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	resp.bitmap_create_called = false;
-
-	gfx_bitmap_params_init(&params);
-	params.flags = bmpf_direct_output;
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	bitmap = NULL;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_create_called);
-	PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.bitmap_create_params.rect.p1.y);
-	PCUT_ASSERT_EQUALS((params.rect.p1.x - params.rect.p0.x) *
-	    sizeof(uint32_t), (unsigned) resp.bitmap_create_alloc.pitch);
-	PCUT_ASSERT_EQUALS(0, resp.bitmap_create_alloc.off0);
-	PCUT_ASSERT_NOT_NULL(resp.bitmap_create_alloc.pixels);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	resp.bitmap_destroy_called = false;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_destroy_called);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_render with server returning failure */
-PCUT_TEST(bitmap_render_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_rect_t srect;
-	gfx_coord2_t offs;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	resp.rc = EIO;
-	srect.p0.x = 1;
-	srect.p0.y = 2;
-	srect.p1.x = 3;
-	srect.p1.y = 4;
-	rc = gfx_bitmap_render(bitmap, &srect, &offs);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_render_called);
-	PCUT_ASSERT_EQUALS(srect.p0.x, resp.bitmap_render_srect.p0.x);
-	PCUT_ASSERT_EQUALS(srect.p0.y, resp.bitmap_render_srect.p0.y);
-	PCUT_ASSERT_EQUALS(srect.p1.x, resp.bitmap_render_srect.p1.x);
-	PCUT_ASSERT_EQUALS(srect.p1.y, resp.bitmap_render_srect.p1.y);
-	PCUT_ASSERT_EQUALS(offs.x, resp.bitmap_render_offs.x);
-	PCUT_ASSERT_EQUALS(offs.y, resp.bitmap_render_offs.y);
-
-	resp.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_render with server returning success */
-PCUT_TEST(bitmap_render_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_rect_t srect;
-	gfx_coord2_t offs;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	resp.rc = EOK;
-	srect.p0.x = 1;
-	srect.p0.y = 2;
-	srect.p1.x = 3;
-	srect.p1.y = 4;
-	rc = gfx_bitmap_render(bitmap, &srect, &offs);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.bitmap_render_called);
-	PCUT_ASSERT_EQUALS(srect.p0.x, resp.bitmap_render_srect.p0.x);
-	PCUT_ASSERT_EQUALS(srect.p0.y, resp.bitmap_render_srect.p0.y);
-	PCUT_ASSERT_EQUALS(srect.p1.x, resp.bitmap_render_srect.p1.x);
-	PCUT_ASSERT_EQUALS(srect.p1.y, resp.bitmap_render_srect.p1.y);
-	PCUT_ASSERT_EQUALS(offs.x, resp.bitmap_render_offs.x);
-	PCUT_ASSERT_EQUALS(offs.y, resp.bitmap_render_offs.y);
-
-	resp.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** gfx_bitmap_get_alloc - server is not currently involved */
-PCUT_TEST(bitmap_get_alloc)
-{
-	errno_t rc;
-	service_id_t sid;
-	test_response_t resp;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	async_sess_t *sess;
-	ipc_gc_t *ipcgc;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_ipcgc_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_ipcgfx_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_ipcgfx_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sess = loc_service_connect(sid, INTERFACE_GC, 0);
-	PCUT_ASSERT_NOT_NULL(sess);
-
-	rc = ipc_gc_create(sess, &ipcgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ipc_gc_get_ctx(ipcgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	resp.rc = EOK;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(bitmap);
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS((params.rect.p1.x - params.rect.p0.x) *
-	    sizeof(uint32_t), (unsigned) alloc.pitch);
-	PCUT_ASSERT_EQUALS(0, alloc.off0);
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	resp.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ipc_gc_delete(ipcgc);
-	async_hangup(sess);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-static void test_ipcgc_conn(ipc_call_t *icall, void *arg)
-{
-	gfx_context_t *gc;
-	errno_t rc;
-
-	rc = gfx_context_new(&test_gc_ops, arg, &gc);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	/* Window GC connection */
-	gc_conn(icall, gc);
-}
-
-/** Set clipping rectangle in test GC.
- *
- * @param arg Test GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t test_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->set_clip_rect_called = true;
-	if (rect != NULL) {
-		resp->do_clip = true;
-		resp->set_clip_rect_rect = *rect;
-	} else {
-		resp->do_clip = false;
-	}
-
-	return resp->rc;
-}
-
-/** Set color in test GC.
- *
- * Set drawing color in test GC.
- *
- * @param arg Test GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t test_gc_set_color(void *arg, gfx_color_t *color)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->set_color_called = true;
-	gfx_color_get_rgb_i16(color, &resp->set_color_r, &resp->set_color_g,
-	    &resp->set_color_b);
-	return resp->rc;
-}
-
-/** Fill rectangle in test GC.
- *
- * @param arg Test GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t test_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->fill_rect_called = true;
-	resp->fill_rect_rect = *rect;
-	return resp->rc;
-}
-
-/** Update test GC.
- *
- * @param arg Test GC
- *
- * @return EOK on success or an error code
- */
-static errno_t test_gc_update(void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->update_called = true;
-	return resp->rc;
-}
-
-/** Create bitmap in test GC.
- *
- * @param arg Test GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t test_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	test_bitmap_t *bitmap;
-	gfx_coord2_t dim;
-
-	resp->bitmap_create_called = true;
-	resp->bitmap_create_params = *params;
-
-	if ((params->flags & bmpf_direct_output) != 0) {
-		gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-
-		resp->bitmap_create_alloc.pitch = dim.x * sizeof(uint32_t);
-		resp->bitmap_create_alloc.off0 = 0;
-		resp->bitmap_create_alloc.pixels = as_area_create(AS_AREA_ANY,
-		    dim.x * dim.y * sizeof(uint32_t), AS_AREA_READ |
-		    AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-		if (resp->bitmap_create_alloc.pixels == AS_MAP_FAILED)
-			return ENOMEM;
-	} else {
-		resp->bitmap_create_alloc = *alloc;
-	}
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	bitmap = calloc(1, sizeof(test_bitmap_t));
-	if (bitmap == NULL)
-		return ENOMEM;
-
-	bitmap->resp = resp;
-	bitmap->alloc = resp->bitmap_create_alloc;
-	*rbm = (void *) bitmap;
-	return EOK;
-}
-
-/** Destroy bitmap in test GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t test_gc_bitmap_destroy(void *bm)
-{
-	test_bitmap_t *bitmap = (test_bitmap_t *) bm;
-	test_response_t *resp = bitmap->resp;
-
-	resp->bitmap_destroy_called = true;
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	if ((resp->bitmap_create_params.flags & bmpf_direct_output) != 0)
-		as_area_destroy(resp->bitmap_create_alloc.pixels);
-
-	free(bitmap);
-	return EOK;
-}
-
-/** Render bitmap in test GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t test_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	test_bitmap_t *bitmap = (test_bitmap_t *) bm;
-	test_response_t *resp = bitmap->resp;
-
-	resp->bitmap_render_called = true;
-	resp->bitmap_render_srect = *srect0;
-	resp->bitmap_render_offs = *offs0;
-	return resp->rc;
-}
-
-/** Get allocation info for bitmap in test GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t test_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	test_bitmap_t *bitmap = (test_bitmap_t *) bm;
-
-	*alloc = bitmap->alloc;
-	return EOK;
-}
-
-PCUT_EXPORT(ipcgfx);
Index: pace/lib/ipcgfx/test/main.c
===================================================================
--- uspace/lib/ipcgfx/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(ipcgfx);
-
-PCUT_MAIN();
Index: pace/lib/ipctest/doc/doxygroups.h
===================================================================
--- uspace/lib/ipctest/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libipctest libipctest
- * @ingroup libs
- */
Index: pace/lib/ipctest/include/ipc/ipc_test.h
===================================================================
--- uspace/lib/ipctest/include/ipc/ipc_test.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipctest
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBIPCTEST_IPC_IPC_TEST_H_
-#define _LIBIPCTEST_IPC_IPC_TEST_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	IPC_TEST_PING = IPC_FIRST_USER_METHOD,
-	IPC_TEST_GET_RO_AREA_SIZE,
-	IPC_TEST_GET_RW_AREA_SIZE,
-	IPC_TEST_SHARE_IN_RO,
-	IPC_TEST_SHARE_IN_RW,
-	IPC_TEST_SET_RW_BUF_SIZE,
-	IPC_TEST_READ,
-	IPC_TEST_WRITE
-} ipc_test_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipctest/include/ipc_test.h
===================================================================
--- uspace/lib/ipctest/include/ipc_test.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libipctest
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBIPCTEST_H_
-#define _LIBIPCTEST_H_
-
-#include <async.h>
-#include <errno.h>
-
-typedef struct {
-	async_sess_t *sess;
-} ipc_test_t;
-
-extern errno_t ipc_test_create(ipc_test_t **);
-extern void ipc_test_destroy(ipc_test_t *);
-extern errno_t ipc_test_ping(ipc_test_t *);
-extern errno_t ipc_test_get_ro_area_size(ipc_test_t *, size_t *);
-extern errno_t ipc_test_get_rw_area_size(ipc_test_t *, size_t *);
-extern errno_t ipc_test_share_in_ro(ipc_test_t *, size_t, const void **);
-extern errno_t ipc_test_share_in_rw(ipc_test_t *, size_t, void **);
-extern errno_t ipc_test_set_rw_buf_size(ipc_test_t *, size_t);
-extern errno_t ipc_test_read(ipc_test_t *, void *, size_t);
-extern errno_t ipc_test_write(ipc_test_t *, const void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ipctest/meson.build
===================================================================
--- uspace/lib/ipctest/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/ipc_test.c')
Index: pace/lib/ipctest/src/ipc_test.c
===================================================================
--- uspace/lib/ipctest/src/ipc_test.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,303 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file IPC test service API
- */
-
-#include <abi/ipc/interfaces.h>
-#include <as.h>
-#include <errno.h>
-#include <ipc/services.h>
-#include <ipc/ipc_test.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <ipc_test.h>
-
-/** Create IPC test service session.
- *
- * @param rvol Place to store pointer to volume service session.
- * @return     EOK on success, ENOMEM if out of memory, EIO if service
- *             cannot be contacted.
- */
-errno_t ipc_test_create(ipc_test_t **rtest)
-{
-	ipc_test_t *test;
-	service_id_t test_svcid;
-	errno_t rc;
-
-	test = calloc(1, sizeof(ipc_test_t));
-	if (test == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = loc_service_get_id(SERVICE_NAME_IPC_TEST, &test_svcid, 0);
-	if (rc != EOK) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	test->sess = loc_service_connect(test_svcid, INTERFACE_IPC_TEST, 0);
-	if (test->sess == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	*rtest = test;
-	return EOK;
-error:
-	free(test);
-	return rc;
-}
-
-/** Destroy IPC test service session.
- *
- * @param test IPC test service session
- */
-void ipc_test_destroy(ipc_test_t *test)
-{
-	if (test == NULL)
-		return;
-
-	async_hangup(test->sess);
-	free(test);
-}
-
-/** Simple ping.
- *
- * @param test IPC test service
- * @return EOK on success or an error code
- */
-errno_t ipc_test_ping(ipc_test_t *test)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(test->sess);
-	retval = async_req_0_0(exch, IPC_TEST_PING);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Get size of shared read-only memory area.
- *
- * @param test IPC test service
- * @param rsize Place to store size of the shared area
- * @return EOK on success or an error code
- */
-errno_t ipc_test_get_ro_area_size(ipc_test_t *test, size_t *rsize)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	sysarg_t size;
-
-	exch = async_exchange_begin(test->sess);
-	retval = async_req_0_1(exch, IPC_TEST_GET_RO_AREA_SIZE, &size);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	*rsize = size;
-	return EOK;
-}
-
-/** Get size of shared read-write memory area.
- *
- * @param test IPC test service
- * @param rsize Place to store size of the shared area
- * @return EOK on success or an error code
- */
-errno_t ipc_test_get_rw_area_size(ipc_test_t *test, size_t *rsize)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	sysarg_t size;
-
-	exch = async_exchange_begin(test->sess);
-	retval = async_req_0_1(exch, IPC_TEST_GET_RW_AREA_SIZE, &size);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	*rsize = size;
-	return EOK;
-}
-
-/** Test share-in of read-only area.
- *
- * @param test IPC test service
- * @param size Size of the shared area
- * @param rptr Place to store pointer to the shared-in area
- * @return EOK on success or an error code
- */
-errno_t ipc_test_share_in_ro(ipc_test_t *test, size_t size, const void **rptr)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	void *dst;
-	errno_t rc;
-
-	exch = async_exchange_begin(test->sess);
-	req = async_send_0(exch, IPC_TEST_SHARE_IN_RO, &answer);
-
-	dst = NULL;
-	rc = async_share_in_start_0_0(exch, size, &dst);
-	if (rc != EOK || dst == AS_MAP_FAILED) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, NULL);
-	*rptr = dst;
-	return EOK;
-}
-
-/** Test share-in of read-write area.
- *
- * @param test IPC test service
- * @param size Size of the shared area
- * @param rptr Place to store pointer to the shared-in area
- * @return EOK on success or an error code
- */
-errno_t ipc_test_share_in_rw(ipc_test_t *test, size_t size, void **rptr)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	void *dst;
-	errno_t rc;
-
-	exch = async_exchange_begin(test->sess);
-	req = async_send_0(exch, IPC_TEST_SHARE_IN_RW, &answer);
-
-	rc = async_share_in_start_0_0(exch, size, &dst);
-	if (rc != EOK || dst == AS_MAP_FAILED) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, NULL);
-	*rptr = dst;
-	return EOK;
-}
-
-/** Set server-side read/write buffer size.
- *
- * @param test IPC test service
- * @param size Requested read/write buffer size
- * @return EOK on success or an error code
- */
-errno_t ipc_test_set_rw_buf_size(ipc_test_t *test, size_t size)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	exch = async_exchange_begin(test->sess);
-	retval = async_req_1_0(exch, IPC_TEST_SET_RW_BUF_SIZE, size);
-	async_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	return EOK;
-}
-
-/** Test IPC read.
- *
- * @param test IPC test service
- * @param dest Destination buffer
- * @param size Number of bytes to read / size of destination buffer
- * @return EOK on success or an error code
- */
-errno_t ipc_test_read(ipc_test_t *test, void *dest, size_t size)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	exch = async_exchange_begin(test->sess);
-	req = async_send_0(exch, IPC_TEST_READ, &answer);
-
-	rc = async_data_read_start(exch, dest, size);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, NULL);
-	return EOK;
-}
-
-/** Test IPC write.
- *
- * @param test IPC test service
- * @param data Source buffer
- * @param size Number of bytes to write
- * @return EOK on success or an error code
- */
-errno_t ipc_test_write(ipc_test_t *test, const void *data, size_t size)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	exch = async_exchange_begin(test->sess);
-	req = async_send_0(exch, IPC_TEST_WRITE, &answer);
-
-	rc = async_data_write_start(exch, data, size);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-	async_wait_for(req, NULL);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/label/doc/doxygroups.h
===================================================================
--- uspace/lib/label/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup liblabel liblabel
- * @ingroup libs
- */
Index: pace/lib/label/include/label/empty.h
===================================================================
--- uspace/lib/label/include/label/empty.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef LABEL_EMPTY_H_
-#define LABEL_EMPTY_H_
-
-#include <loc.h>
-#include <types/liblabel.h>
-
-extern errno_t label_bd_is_empty(label_bd_t *, bool *);
-extern errno_t label_bd_empty(label_bd_t *);
-extern errno_t label_part_empty(label_part_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/include/label/label.h
===================================================================
--- uspace/lib/label/include/label/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Disk label library.
- */
-
-#ifndef LIBLABEL_LABEL_H_
-#define LIBLABEL_LABEL_H_
-
-#include <types/label.h>
-#include <types/liblabel.h>
-
-extern errno_t label_open(label_bd_t *, label_t **);
-extern errno_t label_create(label_bd_t *, label_type_t, label_t **);
-extern void label_close(label_t *);
-extern errno_t label_destroy(label_t *);
-extern errno_t label_get_info(label_t *, label_info_t *);
-
-extern label_part_t *label_part_first(label_t *);
-extern label_part_t *label_part_next(label_part_t *);
-extern void label_part_get_info(label_part_t *, label_part_info_t *);
-
-extern errno_t label_part_create(label_t *, label_part_spec_t *,
-    label_part_t **);
-extern errno_t label_part_destroy(label_part_t *);
-extern void label_pspec_init(label_part_spec_t *);
-extern errno_t label_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/include/std/fat.h
===================================================================
--- uspace/lib/label/include/std/fat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-
-#ifndef FAT_FAT_H_
-#define FAT_FAT_H_
-
-#include <stdint.h>
-
-#define BS_BLOCK		0
-#define BS_SIZE			512
-#define DIRENT_SIZE		32
-
-#define FAT12_CLST_MAX    4085
-#define FAT16_CLST_MAX    65525
-
-#define FATAUTO	0
-#define FAT12	12
-#define FAT16	16
-#define FAT32	32
-
-#define FAT_CLUSTER_DOUBLE_SIZE(a) ((a) / 4)
-
-typedef struct fat_bs {
-	/** Jump instruction */
-	uint8_t		ji[3];
-	uint8_t		oem_name[8];
-
-	/* BIOS Parameter Block */
-
-	/** Bytes per sector */
-	uint16_t	bps;
-	/** Sectors per cluster */
-	uint8_t		spc;
-	/** Reserved sector count */
-	uint16_t	rscnt;
-	/** Number of FATs */
-	uint8_t		fatcnt;
-	/** Maximum number of root directory entries */
-	uint16_t	root_ent_max;
-	/** Total sectors. 16-bit version */
-	uint16_t	totsec16;
-	/** Media descriptor */
-	uint8_t		mdesc;
-	/** Sectors per FAT12/FAT16 */
-	uint16_t	sec_per_fat;
-	/** Sectors per track */
-	uint16_t	sec_per_track;
-	/** Number of heads */
-	uint16_t	headcnt;
-	/** Hidden sectors */
-	uint32_t	hidden_sec;
-	/** Total sectors. 32-bit version */
-	uint32_t	totsec32;
-
-	union {
-		struct {
-			/* FAT12/FAT16 only: Extended BIOS Parameter Block */
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[448];
-			/** Boot sector signature. */
-			uint16_t	signature;
-		} __attribute__((packed));
-		struct {
-			/* FAT32 only */
-			/** Sectors per FAT. */
-			uint32_t	sectors_per_fat;
-			/** FAT flags. */
-			uint16_t	flags;
-			/** Version. */
-			uint16_t	version;
-			/** Cluster number of root directory. */
-			uint32_t	root_cluster;
-			/** Sector number of file system information sector. */
-			uint16_t	fsinfo_sec;
-			/** Sector number of boot sector copy. */
-			uint16_t	bscopy_sec;
-			uint8_t		reserved1[12];
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved2;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[420];
-			/** Signature. */
-			uint16_t	signature;
-		} __attribute__((packed)) fat32;
-	};
-} __attribute__((packed)) fat_bs_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/label/include/std/gpt.h
===================================================================
--- uspace/lib/label/include/std/gpt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/** @file
- */
-
-#ifndef LIBLABEL_STD_GPT_H_
-#define LIBLABEL_STD_GPT_H_
-
-#include <stdint.h>
-
-enum {
-	/** Block address of primary GPT header. */
-	gpt_hdr_ba = 1,
-
-	/** Minimum size of partition table in bytes, required by std. */
-	gpt_ptable_min_size = 16384,
-
-	/** GPT revision */
-	gpt_revision = 0x00010000
-};
-
-/** GPT header */
-typedef struct {
-	uint8_t efi_signature[8];
-	uint32_t revision;
-	uint32_t header_size;
-	uint32_t header_crc32;
-	uint32_t reserved;
-	uint64_t my_lba;
-	uint64_t alternate_lba;
-	uint64_t first_usable_lba;
-	uint64_t last_usable_lba;
-	uint8_t disk_guid[16];
-	uint64_t entry_lba;
-	uint32_t num_entries;
-	uint32_t entry_size;
-	uint32_t pe_array_crc32;
-} __attribute__((packed)) gpt_header_t;
-
-/** GPT partition entry */
-typedef struct {
-	uint8_t part_type[16];
-	uint8_t part_id[16];
-	uint64_t start_lba;
-	uint64_t end_lba;
-	uint64_t attributes;
-	uint16_t part_name[36];
-} __attribute__((packed)) gpt_entry_t;
-
-/** Microsoft Basic Data Partition */
-#define GPT_MS_BASIC_DATA "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
-/** Linux Filesystem Data */
-#define GPT_LINUX_FS_DATA "0FC63DAF-8483-4772-8E79-3D69D8477DE4"
-/** I could not find any definition of Minix GUID partition type.
- * This is a randomly generated UUID
- */
-#define GPT_MINIX_FAKE "8308e350-4e2d-46c7-8e3b-24b07e8ac674"
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/include/std/mbr.h
===================================================================
--- uspace/lib/label/include/std/mbr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/** @file
- */
-
-#ifndef LIBLABEL_STD_MBR_H_
-#define LIBLABEL_STD_MBR_H_
-
-#include <stdint.h>
-
-enum {
-	/** Block address of Master Boot Record. */
-	mbr_ba = 0,
-
-	/** First block allowed for allocation */
-	mbr_ablock0 = 18,
-
-	/** Number of primary partition records */
-	mbr_nprimary = 4,
-
-	/** Boot record signature */
-	mbr_br_signature = 0xAA55,
-
-	/** EBR PTE slot describing partition corresponding to this EBR */
-	mbr_ebr_pte_this = 0,
-	/** EBR PTE slot describing the next EBR */
-	mbr_ebr_pte_next = 1
-};
-
-enum mbr_ptype {
-	/** Unused partition entry */
-	mbr_pt_unused	    = 0x00,
-	/** Extended partition */
-	mbr_pt_extended	    = 0x05,
-	/** Extended partition with LBA */
-	mbr_pt_extended_lba = 0x0f,
-	/** FAT16 with LBA */
-	mbr_pt_fat16_lba    = 0x0e,
-	/** FAT32 with LBA */
-	mbr_pt_fat32_lba    = 0x0c,
-	/** IFS, HPFS, NTFS, exFAT */
-	mbr_pt_ms_advanced  = 0x07,
-	/** Minix */
-	mbr_pt_minix        = 0x81,
-	/** Linux */
-	mbr_pt_linux        = 0x83,
-	/** GPT Protective */
-	mbr_pt_gpt_protect  = 0xee
-};
-
-/** Structure of a partition table entry */
-typedef struct {
-	uint8_t status;
-	/** CHS of fist block in partition */
-	uint8_t first_chs[3];
-	/** Partition type */
-	uint8_t ptype;
-	/** CHS of last block in partition */
-	uint8_t last_chs[3];
-	/** LBA of first block in partition */
-	uint32_t first_lba;
-	/** Number of blocks in partition */
-	uint32_t length;
-} __attribute__((packed)) mbr_pte_t;
-
-/** Structure of a boot-record block */
-typedef struct {
-	/* Area for boot code */
-	uint8_t code_area[440];
-
-	/* Optional media ID */
-	uint32_t media_id;
-
-	uint16_t pad0;
-
-	/** Partition table entries */
-	mbr_pte_t pte[mbr_nprimary];
-
-	/** Boot record block signature (@c BR_SIGNATURE) */
-	uint16_t signature;
-} __attribute__((packed)) mbr_br_block_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/include/types/liblabel.h
===================================================================
--- uspace/lib/label/include/types/liblabel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,196 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Disk label library types.
- */
-
-#ifndef LIBLABEL_TYPES_H_
-#define LIBLABEL_TYPES_H_
-
-#include <adt/list.h>
-#include <types/label.h>
-#include <offset.h>
-#include <stddef.h>
-#include <vol.h>
-#include <uuid.h>
-
-typedef struct label label_t;
-typedef struct label_info label_info_t;
-typedef struct label_part label_part_t;
-typedef struct label_part_info label_part_info_t;
-typedef struct label_part_spec label_part_spec_t;
-typedef struct label_bd label_bd_t;
-typedef struct label_bd_ops label_bd_ops_t;
-
-/** Ops for individual label type */
-typedef struct {
-	errno_t (*open)(label_bd_t *, label_t **);
-	errno_t (*create)(label_bd_t *, label_t **);
-	void (*close)(label_t *);
-	errno_t (*destroy)(label_t *);
-	errno_t (*get_info)(label_t *, label_info_t *);
-	label_part_t *(*part_first)(label_t *);
-	label_part_t *(*part_next)(label_part_t *);
-	void (*part_get_info)(label_part_t *, label_part_info_t *);
-	errno_t (*part_create)(label_t *, label_part_spec_t *, label_part_t **);
-	errno_t (*part_destroy)(label_part_t *);
-	errno_t (*suggest_ptype)(label_t *, label_pcnt_t, label_ptype_t *);
-} label_ops_t;
-
-struct label_info {
-	/** Label type */
-	label_type_t ltype;
-	/** Label flags */
-	label_flags_t flags;
-	/** First block that can be allocated */
-	aoff64_t ablock0;
-	/** Number of blocks that can be allocated */
-	aoff64_t anblocks;
-};
-
-struct label_part_info {
-	/** Partition index */
-	int index;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** Address of first block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-};
-
-/** Partition */
-struct label_part {
-	/** Containing label */
-	struct label *label;
-	/** Link to label_t.parts */
-	link_t lparts;
-	/** Link to label_t.pri_parts */
-	link_t lpri;
-	/** Link to label_t.log_parts */
-	link_t llog;
-	/** Index */
-	int index;
-	/** Number of EBR blocks preceding a logical partition */
-	aoff64_t hdr_blocks;
-	/** First block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Partition type */
-	label_ptype_t ptype;
-	/** Partition UUID */
-	uuid_t part_uuid;
-};
-
-/** Specification of new partition */
-struct label_part_spec {
-	/** Partition index */
-	int index;
-	/** First block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Number of header blocks (EBR for logical partitions) */
-	aoff64_t hdr_blocks;
-	/** Partition kind */
-	label_pkind_t pkind;
-	/** Partition type */
-	label_ptype_t ptype;
-};
-
-typedef struct {
-	uint64_t hdr_ba[2];
-	uint32_t hdr_size;
-	uint64_t ptable_ba[2];
-	uint64_t pt_blocks;
-	size_t esize;
-	uint32_t pt_crc;
-} label_gpt_t;
-
-typedef struct {
-} label_mbr_t;
-
-/** Block device operations */
-struct label_bd_ops {
-	/** Get block size */
-	errno_t (*get_bsize)(void *, size_t *);
-	/** Get number of blocks */
-	errno_t (*get_nblocks)(void *, aoff64_t *);
-	/** Read blocks */
-	errno_t (*read)(void *, aoff64_t, size_t, void *);
-	/** Write blocks */
-	errno_t (*write)(void *, aoff64_t, size_t, const void *);
-};
-
-/** Block device */
-struct label_bd {
-	/** Ops structure */
-	label_bd_ops_t *ops;
-	/** Argument */
-	void *arg;
-};
-
-/** Label instance */
-struct label {
-	/** Label type ops */
-	label_ops_t *ops;
-	/** Label type */
-	label_type_t ltype;
-	/** Block device */
-	label_bd_t bd;
-	/** Partitions */
-	list_t parts; /* of label_part_t */
-	/** Primary partitions */
-	list_t pri_parts; /* of label_part_t */
-	/** Logical partitions */
-	list_t log_parts; /* of label_part_t */
-	/** First block that can be allocated */
-	aoff64_t ablock0;
-	/** Number of blocks that can be allocated */
-	aoff64_t anblocks;
-	/** Number of primary partition entries */
-	int pri_entries;
-	/** Extended partition or NULL if there is none */
-	label_part_t *ext_part;
-	/** Block size */
-	size_t block_size;
-	union {
-		label_gpt_t gpt;
-		label_mbr_t mbr;
-	} lt;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/meson.build
===================================================================
--- uspace/lib/label/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files(
-	'src/dummy.c',
-	'src/empty.c',
-	'src/mbr.c',
-	'src/gpt.c',
-	'src/label.c',
-)
-
-test_src = files(
-	'test/main.c',
-	'test/label.c',
-)
Index: pace/lib/label/src/dummy.c
===================================================================
--- uspace/lib/label/src/dummy.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,212 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Dummy label (for disks that have no recognized label)
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "dummy.h"
-
-static errno_t dummy_open(label_bd_t *, label_t **);
-static errno_t dummy_create(label_bd_t *, label_t **);
-static void dummy_close(label_t *);
-static errno_t dummy_destroy(label_t *);
-static errno_t dummy_get_info(label_t *, label_info_t *);
-static label_part_t *dummy_part_first(label_t *);
-static label_part_t *dummy_part_next(label_part_t *);
-static void dummy_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t dummy_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t dummy_part_destroy(label_part_t *);
-static errno_t dummy_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-label_ops_t dummy_label_ops = {
-	.open = dummy_open,
-	.create = dummy_create,
-	.close = dummy_close,
-	.destroy = dummy_destroy,
-	.get_info = dummy_get_info,
-	.part_first = dummy_part_first,
-	.part_next = dummy_part_next,
-	.part_get_info = dummy_part_get_info,
-	.part_create = dummy_part_create,
-	.part_destroy = dummy_part_destroy,
-	.suggest_ptype = dummy_suggest_ptype
-};
-
-static errno_t dummy_open(label_bd_t *bd, label_t **rlabel)
-{
-	label_t *label = NULL;
-	label_part_t *part = NULL;
-	size_t bsize;
-	aoff64_t nblocks;
-	uint64_t ba_min, ba_max;
-	errno_t rc;
-
-	rc = bd->ops->get_bsize(bd->arg, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	label = calloc(1, sizeof(label_t));
-	if (label == NULL)
-		return ENOMEM;
-
-	list_initialize(&label->parts);
-	list_initialize(&label->pri_parts);
-	list_initialize(&label->log_parts);
-
-	ba_min = 0;
-	ba_max = nblocks;
-
-	label->ops = &dummy_label_ops;
-	label->ltype = lt_none;
-	label->bd = *bd;
-	label->ablock0 = ba_min;
-	label->anblocks = ba_max - ba_min + 1;
-	label->pri_entries = 0;
-	label->block_size = bsize;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	part->index = 0;
-	part->block0 = ba_min;
-	part->nblocks = ba_max - ba_min;
-	part->ptype.fmt = lptf_num;
-
-	part->label = label;
-	list_append(&part->lparts, &label->parts);
-	list_append(&part->lpri, &label->pri_parts);
-
-	*rlabel = label;
-	return EOK;
-error:
-	free(part);
-	free(label);
-	return rc;
-}
-
-static errno_t dummy_create(label_bd_t *bd, label_t **rlabel)
-{
-	return ENOTSUP;
-}
-
-static void dummy_close(label_t *label)
-{
-	label_part_t *part;
-
-	part = dummy_part_first(label);
-	while (part != NULL) {
-		list_remove(&part->lparts);
-		list_remove(&part->lpri);
-		free(part);
-		part = dummy_part_first(label);
-	}
-
-	free(label);
-}
-
-static errno_t dummy_destroy(label_t *label)
-{
-	return ENOTSUP;
-}
-
-static errno_t dummy_get_info(label_t *label, label_info_t *linfo)
-{
-	memset(linfo, 0, sizeof(label_info_t));
-	linfo->ltype = lt_none;
-	linfo->flags = 0;
-	linfo->ablock0 = label->ablock0;
-	linfo->anblocks = label->anblocks;
-	return EOK;
-}
-
-static label_part_t *dummy_part_first(label_t *label)
-{
-	link_t *link;
-
-	link = list_first(&label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static label_part_t *dummy_part_next(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->lparts, &part->label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static void dummy_part_get_info(label_part_t *part, label_part_info_t *pinfo)
-{
-	pinfo->index = part->index;
-	pinfo->pkind = lpk_primary;
-	pinfo->block0 = part->block0;
-	pinfo->nblocks = part->nblocks;
-}
-
-static errno_t dummy_part_create(label_t *label, label_part_spec_t *pspec,
-    label_part_t **rpart)
-{
-	return ENOTSUP;
-}
-
-static errno_t dummy_part_destroy(label_part_t *part)
-{
-	return ENOTSUP;
-}
-
-static errno_t dummy_suggest_ptype(label_t *label, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/label/src/dummy.h
===================================================================
--- uspace/lib/label/src/dummy.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Dummy label (fallback for disks that have no recognized label).
- */
-
-#ifndef LIBLABEL_DUMMY_H_
-#define LIBLABEL_DUMMY_H_
-
-#include <types/liblabel.h>
-
-extern label_ops_t dummy_label_ops;
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/src/empty.c
===================================================================
--- uspace/lib/label/src/empty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,293 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Empty partition handling
- * @brief
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <label/empty.h>
-#include <loc.h>
-#include <stdlib.h>
-
-/*
- * The partition will be considered empty if at least a minimum number of
- * bytes *and* blocks (whichever is larger) at the beginning and end of
- * the partition is zero.
- */
-enum {
-	min_empty_bytes = 16384,
-	/*
-	 * First block in ISO 9660 that cannot be empty is the first
-	 * volume descriptor at LBA 16
-	 */
-	min_empty_blocks = 17
-};
-
-static bool mem_is_zero(void *buf, size_t size)
-{
-	uint8_t *bp;
-	size_t i;
-
-	bp = (uint8_t *)buf;
-	for (i = 0; i < size; i++) {
-		if (bp[i] != 0)
-			return false;
-	}
-
-	return true;
-}
-
-/** Calculate number of blocks to check.
- *
- * Will store to @a *ncb the number of blocks that should be checked
- * at the beginning and end of device each.
- *
- * @param nblocks Total number of blocks on block device
- * @param block_size Block size
- * @param ncb Place to store number of blocks to check.
- */
-static void calc_num_check_blocks(aoff64_t nblocks, size_t block_size,
-    aoff64_t *ncb)
-{
-	aoff64_t n;
-
-	/* Check first 16 kiB / 16 blocks, whichever is more */
-	n = (min_empty_bytes + block_size - 1) / block_size;
-	if (n < min_empty_blocks)
-		n = min_empty_blocks;
-	/*
-	 * Limit to half of the device so we do not process the same blocks
-	 * twice
-	 */
-	if (n > (nblocks + 1) / 2)
-		n = (nblocks + 1) / 2;
-
-	*ncb = n;
-}
-
-errno_t label_bd_is_empty(label_bd_t *bd, bool *rempty)
-{
-	errno_t rc;
-	void *buf = NULL;
-	aoff64_t nblocks;
-	aoff64_t n;
-	aoff64_t i;
-	size_t block_size;
-	bool empty;
-
-	rc = bd->ops->get_bsize(bd->arg, &block_size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting "
-		    "block size.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting "
-		    "number of blocks.");
-		rc = EIO;
-		goto error;
-	}
-
-	calc_num_check_blocks(nblocks, block_size, &n);
-
-	buf = calloc(block_size, 1);
-	if (buf == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error allocating buffer.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	empty = true;
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->read(bd->arg, i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-
-		if (!mem_is_zero(buf, block_size)) {
-			empty = false;
-			goto done;
-		}
-	}
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->read(bd->arg, nblocks - n + i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-
-		if (!mem_is_zero(buf, block_size)) {
-			empty = false;
-			goto done;
-		}
-	}
-
-done:
-	free(buf);
-	*rempty = empty;
-	return EOK;
-error:
-	if (buf != NULL)
-		free(buf);
-	return rc;
-}
-
-errno_t label_bd_empty(label_bd_t *bd)
-{
-	errno_t rc;
-	void *buf = NULL;
-	aoff64_t nblocks;
-	aoff64_t n;
-	aoff64_t i;
-	size_t block_size;
-
-	rc = bd->ops->get_bsize(bd->arg, &block_size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting "
-		    "block size.");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting "
-		    "number of blocks.");
-		rc = EIO;
-		goto error;
-	}
-
-	calc_num_check_blocks(nblocks, block_size, &n);
-
-	buf = calloc(block_size, 1);
-	if (buf == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error allocating buffer.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->write(bd->arg, i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->write(bd->arg, nblocks - n + i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	free(buf);
-	return EOK;
-error:
-	if (buf != NULL)
-		free(buf);
-	return rc;
-}
-
-errno_t label_part_empty(label_part_t *part)
-{
-	errno_t rc;
-	void *buf = NULL;
-	aoff64_t block0;
-	aoff64_t nblocks;
-	aoff64_t n;
-	aoff64_t i;
-	size_t block_size;
-	label_bd_t *bd;
-
-	bd = &part->label->bd;
-
-	block_size = part->label->block_size;
-	block0 = part->block0;
-	nblocks = part->nblocks;
-
-	calc_num_check_blocks(nblocks, block_size, &n);
-
-	buf = calloc(block_size, 1);
-	if (buf == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error allocating buffer.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->write(bd->arg, block0 + i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	for (i = 0; i < n; i++) {
-		rc = bd->ops->write(bd->arg, block0 + nblocks - n + i, 1, buf);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-			    "reading blocks.");
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	free(buf);
-	return EOK;
-error:
-	if (buf != NULL)
-		free(buf);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/label/src/gpt.c
===================================================================
--- uspace/lib/label/src/gpt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1057 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file GUID Partition Table label.
- */
-
-#include <adt/checksum.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <uuid.h>
-
-#include "std/mbr.h"
-#include "std/gpt.h"
-#include "gpt.h"
-
-static errno_t gpt_open(label_bd_t *, label_t **);
-static errno_t gpt_create(label_bd_t *, label_t **);
-static void gpt_close(label_t *);
-static errno_t gpt_destroy(label_t *);
-static errno_t gpt_get_info(label_t *, label_info_t *);
-static label_part_t *gpt_part_first(label_t *);
-static label_part_t *gpt_part_next(label_part_t *);
-static void gpt_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t gpt_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t gpt_part_destroy(label_part_t *);
-static errno_t gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-static errno_t gpt_check_free_idx(label_t *, int);
-static errno_t gpt_check_free_range(label_t *, uint64_t, uint64_t);
-
-static void gpt_unused_pte(gpt_entry_t *);
-static errno_t gpt_part_to_pte(label_part_t *, gpt_entry_t *);
-static errno_t gpt_pte_to_part(label_t *, gpt_entry_t *, int);
-static errno_t gpt_pte_update(label_t *, gpt_entry_t *, int);
-
-static errno_t gpt_update_pt_crc(label_t *, uint32_t);
-static void gpt_hdr_compute_crc(gpt_header_t *, size_t);
-static errno_t gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);
-
-static errno_t gpt_pmbr_create(label_bd_t *, size_t, uint64_t);
-static errno_t gpt_pmbr_destroy(label_bd_t *, size_t);
-
-const uint8_t efi_signature[8] = {
-	/* "EFI PART" in ASCII */
-	0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54
-};
-
-label_ops_t gpt_label_ops = {
-	.open = gpt_open,
-	.create = gpt_create,
-	.close = gpt_close,
-	.destroy = gpt_destroy,
-	.get_info = gpt_get_info,
-	.part_first = gpt_part_first,
-	.part_next = gpt_part_next,
-	.part_get_info = gpt_part_get_info,
-	.part_create = gpt_part_create,
-	.part_destroy = gpt_part_destroy,
-	.suggest_ptype = gpt_suggest_ptype
-};
-
-static errno_t gpt_open(label_bd_t *bd, label_t **rlabel)
-{
-	label_t *label = NULL;
-	gpt_header_t *gpt_hdr[2];
-	gpt_entry_t *eptr;
-	uint8_t *etable[2];
-	size_t bsize;
-	aoff64_t nblocks;
-	uint32_t num_entries;
-	uint32_t esize;
-	uint32_t pt_blocks;
-	uint64_t ptba[2];
-	uint64_t h1ba;
-	uint32_t entry;
-	uint32_t pt_crc;
-	uint64_t ba_min, ba_max;
-	uint32_t hdr_size;
-	uint32_t hdr_crc;
-	int i, j;
-	errno_t rc;
-
-	gpt_hdr[0] = NULL;
-	gpt_hdr[1] = NULL;
-	etable[0] = NULL;
-	etable[1] = NULL;
-
-	rc = bd->ops->get_bsize(bd->arg, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (bsize < 512 || (bsize % 512) != 0) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	gpt_hdr[0] = calloc(1, bsize);
-	if (gpt_hdr[0] == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	gpt_hdr[1] = calloc(1, bsize);
-	if (gpt_hdr[1] == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bd->ops->read(bd->arg, gpt_hdr_ba, 1, gpt_hdr[0]);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	h1ba = uint64_t_le2host(gpt_hdr[0]->alternate_lba);
-
-	if (h1ba >= nblocks) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	rc = bd->ops->read(bd->arg, h1ba, 1, gpt_hdr[1]);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	label = calloc(1, sizeof(label_t));
-	if (label == NULL)
-		return ENOMEM;
-
-	list_initialize(&label->parts);
-	list_initialize(&label->pri_parts);
-	list_initialize(&label->log_parts);
-
-	for (j = 0; j < 2; j++) {
-		for (i = 0; i < 8; ++i) {
-			if (gpt_hdr[j]->efi_signature[i] != efi_signature[i]) {
-				rc = EINVAL;
-				goto error;
-			}
-		}
-	}
-
-	if (uint32_t_le2host(gpt_hdr[0]->revision) !=
-	    uint32_t_le2host(gpt_hdr[1]->revision)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uint32_t_le2host(gpt_hdr[0]->header_size) !=
-	    uint32_t_le2host(gpt_hdr[1]->header_size)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	hdr_size = uint32_t_le2host(gpt_hdr[0]->header_size);
-	if (hdr_size < sizeof(gpt_header_t) ||
-	    hdr_size > bsize) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	for (j = 0; j < 2; j++) {
-		rc = gpt_hdr_get_crc(gpt_hdr[j], hdr_size, &hdr_crc);
-		if (rc != EOK)
-			goto error;
-
-		if (uint32_t_le2host(gpt_hdr[j]->header_crc32) != hdr_crc) {
-			rc = EINVAL;
-			goto error;
-		}
-	}
-
-	if (uint64_t_le2host(gpt_hdr[0]->my_lba) != gpt_hdr_ba) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uint64_t_le2host(gpt_hdr[1]->my_lba) != h1ba) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uint64_t_le2host(gpt_hdr[1]->alternate_lba) != gpt_hdr_ba) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	num_entries = uint32_t_le2host(gpt_hdr[0]->num_entries);
-	esize = uint32_t_le2host(gpt_hdr[0]->entry_size);
-	pt_blocks = (num_entries * esize + bsize - 1) / bsize;
-	ptba[0] = uint64_t_le2host(gpt_hdr[0]->entry_lba);
-	ptba[1] = uint64_t_le2host(gpt_hdr[1]->entry_lba);
-	ba_min = uint64_t_le2host(gpt_hdr[0]->first_usable_lba);
-	ba_max = uint64_t_le2host(gpt_hdr[0]->last_usable_lba);
-	pt_crc = uint32_t_le2host(gpt_hdr[0]->pe_array_crc32);
-
-	if (uint64_t_le2host(gpt_hdr[1]->first_usable_lba) != ba_min) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uint64_t_le2host(gpt_hdr[1]->last_usable_lba) != ba_max) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	for (i = 0; i < 16; i++) {
-		if (gpt_hdr[1]->disk_guid[i] != gpt_hdr[0]->disk_guid[i]) {
-			rc = EINVAL;
-			goto error;
-		}
-	}
-
-	if (uint32_t_le2host(gpt_hdr[1]->num_entries) != num_entries) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (uint32_t_le2host(gpt_hdr[1]->entry_size) != esize) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (num_entries < 1) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (esize < sizeof(gpt_entry_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (ba_max < ba_min) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Check fields in backup header for validity */
-
-	for (j = 0; j < 2; j++) {
-		etable[j] = calloc(1, pt_blocks * bsize);
-		if (etable[j] == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = bd->ops->read(bd->arg, ptba[j], pt_blocks / 2, etable[j]);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		if (compute_crc32(etable[j], num_entries * esize) != pt_crc) {
-			rc = EIO;
-			goto error;
-		}
-
-	}
-
-	for (entry = 0; entry < num_entries; entry++) {
-		eptr = (gpt_entry_t *)(etable[0] + entry * esize);
-		rc = gpt_pte_to_part(label, eptr, entry + 1);
-		if (rc != EOK)
-			goto error;
-	}
-
-	free(etable[0]);
-	etable[0] = NULL;
-	free(etable[1]);
-	etable[1] = NULL;
-	free(gpt_hdr[0]);
-	gpt_hdr[0] = NULL;
-	free(gpt_hdr[1]);
-	gpt_hdr[1] = NULL;
-
-	label->ops = &gpt_label_ops;
-	label->ltype = lt_gpt;
-	label->bd = *bd;
-	label->ablock0 = ba_min;
-	label->anblocks = ba_max - ba_min + 1;
-	label->pri_entries = num_entries;
-	label->block_size = bsize;
-
-	label->lt.gpt.hdr_ba[0] = gpt_hdr_ba;
-	label->lt.gpt.hdr_ba[1] = h1ba;
-	label->lt.gpt.ptable_ba[0] = ptba[0];
-	label->lt.gpt.ptable_ba[1] = ptba[1];
-	label->lt.gpt.esize = esize;
-	label->lt.gpt.pt_blocks = pt_blocks;
-	label->lt.gpt.pt_crc = pt_crc;
-	label->lt.gpt.hdr_size = hdr_size;
-
-	*rlabel = label;
-	return EOK;
-error:
-	free(etable[0]);
-	free(etable[1]);
-	free(gpt_hdr[0]);
-	free(gpt_hdr[1]);
-	free(label);
-	return rc;
-}
-
-static errno_t gpt_create(label_bd_t *bd, label_t **rlabel)
-{
-	label_t *label = NULL;
-	gpt_header_t *gpt_hdr = NULL;
-	uint8_t *etable = NULL;
-	size_t bsize;
-	uint32_t num_entries;
-	uint32_t esize;
-	uint64_t ptba[2];
-	uint64_t hdr_ba[2];
-	uint64_t pt_blocks;
-	uint64_t ba_min, ba_max;
-	aoff64_t nblocks;
-	uint64_t resv_blocks;
-	uint32_t pt_crc;
-	uuid_t disk_uuid;
-	int i, j;
-	errno_t rc;
-
-	rc = bd->ops->get_bsize(bd->arg, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (bsize < 512 || (bsize % 512) != 0) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	/* Number of blocks of a partition table */
-	pt_blocks = gpt_ptable_min_size / bsize;
-	/* Minimum number of reserved (not allocatable) blocks */
-	resv_blocks = 3 + 2 * pt_blocks;
-
-	if (nblocks <= resv_blocks) {
-		rc = ENOSPC;
-		goto error;
-	}
-
-	rc = gpt_pmbr_create(bd, bsize, nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	uuid_generate(&disk_uuid);
-
-	hdr_ba[0] = gpt_hdr_ba;
-	hdr_ba[1] = nblocks - 1;
-	ptba[0] = 2;
-	ptba[1] = nblocks - 1 - pt_blocks;
-	ba_min = ptba[0] + pt_blocks;
-	ba_max = ptba[1] - 1;
-	esize = sizeof(gpt_entry_t);
-
-	num_entries = pt_blocks * bsize / sizeof(gpt_entry_t);
-
-	for (i = 0; i < 2; i++) {
-		etable = calloc(1, pt_blocks * bsize);
-		if (etable == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = bd->ops->write(bd->arg, ptba[i], pt_blocks, etable);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		pt_crc = compute_crc32((uint8_t *)etable,
-		    num_entries * esize);
-
-		free(etable);
-		etable = NULL;
-
-		gpt_hdr = calloc(1, bsize);
-		if (gpt_hdr == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		for (j = 0; j < 8; ++j)
-			gpt_hdr->efi_signature[j] = efi_signature[j];
-		gpt_hdr->revision = host2uint32_t_le(gpt_revision);
-		gpt_hdr->header_size = host2uint32_t_le(sizeof(gpt_header_t));
-		gpt_hdr->header_crc32 = 0;
-		gpt_hdr->my_lba = host2uint64_t_le(hdr_ba[i]);
-		gpt_hdr->alternate_lba = host2uint64_t_le(hdr_ba[1 - i]);
-		gpt_hdr->first_usable_lba = host2uint64_t_le(ba_min);
-		gpt_hdr->last_usable_lba = host2uint64_t_le(ba_max);
-		uuid_encode_le(&disk_uuid, gpt_hdr->disk_guid);
-		gpt_hdr->entry_lba = host2uint64_t_le(ptba[i]);
-		gpt_hdr->num_entries = host2uint32_t_le(num_entries);
-		gpt_hdr->entry_size = host2uint32_t_le(esize);
-		gpt_hdr->pe_array_crc32 = pt_crc;
-
-		gpt_hdr_compute_crc(gpt_hdr, sizeof(gpt_header_t));
-
-		rc = bd->ops->write(bd->arg, hdr_ba[i], 1, gpt_hdr);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		free(gpt_hdr);
-		gpt_hdr = NULL;
-	}
-
-	label = calloc(1, sizeof(label_t));
-	if (label == NULL)
-		return ENOMEM;
-
-	list_initialize(&label->parts);
-	list_initialize(&label->pri_parts);
-	list_initialize(&label->log_parts);
-
-	label->ops = &gpt_label_ops;
-	label->ltype = lt_gpt;
-	label->bd = *bd;
-	label->ablock0 = ba_min;
-	label->anblocks = ba_max - ba_min + 1;
-	label->pri_entries = num_entries;
-	label->block_size = bsize;
-
-	label->lt.gpt.hdr_ba[0] = hdr_ba[0];
-	label->lt.gpt.hdr_ba[1] = hdr_ba[1];
-	label->lt.gpt.ptable_ba[0] = ptba[0];
-	label->lt.gpt.ptable_ba[1] = ptba[1];
-	label->lt.gpt.esize = esize;
-	label->lt.gpt.pt_blocks = pt_blocks;
-	label->lt.gpt.pt_crc = pt_crc;
-	label->lt.gpt.hdr_size = sizeof(gpt_header_t);
-
-	*rlabel = label;
-	return EOK;
-error:
-	free(etable);
-	free(gpt_hdr);
-	free(label);
-	return rc;
-}
-
-static void gpt_close(label_t *label)
-{
-	label_part_t *part;
-
-	part = gpt_part_first(label);
-	while (part != NULL) {
-		list_remove(&part->lparts);
-		list_remove(&part->lpri);
-		free(part);
-		part = gpt_part_first(label);
-	}
-
-	free(label);
-}
-
-static errno_t gpt_destroy(label_t *label)
-{
-	gpt_header_t *gpt_hdr = NULL;
-	uint8_t *etable = NULL;
-	label_part_t *part;
-	int i;
-	errno_t rc;
-
-	part = gpt_part_first(label);
-	if (part != NULL) {
-		rc = ENOTEMPTY;
-		goto error;
-	}
-
-	for (i = 0; i < 2; i++) {
-		gpt_hdr = calloc(1, label->block_size);
-		if (gpt_hdr == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = label->bd.ops->write(label->bd.arg, label->lt.gpt.hdr_ba[i],
-		    1, gpt_hdr);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		free(gpt_hdr);
-		gpt_hdr = NULL;
-
-		etable = calloc(1, label->lt.gpt.pt_blocks *
-		    label->block_size);
-		if (etable == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		rc = label->bd.ops->write(label->bd.arg,
-		    label->lt.gpt.ptable_ba[i], label->lt.gpt.pt_blocks,
-		    etable);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		free(etable);
-		etable = 0;
-	}
-
-	rc = gpt_pmbr_destroy(&label->bd, label->block_size);
-	if (rc != EOK)
-		goto error;
-
-	free(label);
-	return EOK;
-error:
-	return rc;
-}
-
-static bool gpt_can_create_pri(label_t *label)
-{
-	return list_count(&label->parts) < (size_t)label->pri_entries;
-}
-
-static bool gpt_can_delete_part(label_t *label)
-{
-	return list_count(&label->parts) > 0;
-}
-
-static bool gpt_can_modify_part(label_t *label)
-{
-	return list_count(&label->parts) > 0;
-}
-
-static errno_t gpt_get_info(label_t *label, label_info_t *linfo)
-{
-	memset(linfo, 0, sizeof(label_info_t));
-	linfo->ltype = lt_gpt;
-	linfo->flags = lf_ptype_uuid; /* Partition type is in UUID format */
-	if (gpt_can_create_pri(label))
-		linfo->flags = linfo->flags | lf_can_create_pri;
-	if (gpt_can_delete_part(label))
-		linfo->flags = linfo->flags | lf_can_delete_part;
-	if (gpt_can_modify_part(label))
-		linfo->flags = linfo->flags | lf_can_modify_part;
-	linfo->ablock0 = label->ablock0;
-	linfo->anblocks = label->anblocks;
-	return EOK;
-}
-
-static label_part_t *gpt_part_first(label_t *label)
-{
-	link_t *link;
-
-	link = list_first(&label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static label_part_t *gpt_part_next(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->lparts, &part->label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static void gpt_part_get_info(label_part_t *part, label_part_info_t *pinfo)
-{
-	pinfo->index = part->index;
-	pinfo->pkind = lpk_primary;
-	pinfo->block0 = part->block0;
-	pinfo->nblocks = part->nblocks;
-}
-
-static errno_t gpt_part_create(label_t *label, label_part_spec_t *pspec,
-    label_part_t **rpart)
-{
-	label_part_t *part;
-	gpt_entry_t pte;
-	errno_t rc;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Verify index is within bounds and free */
-	rc = gpt_check_free_idx(label, pspec->index);
-	if (rc != EOK) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Verify range is within bounds and free */
-	rc = gpt_check_free_range(label, pspec->block0, pspec->nblocks);
-	if (rc != EOK) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* GPT only has primary partitions */
-	if (pspec->pkind != lpk_primary) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Partition type must be in UUID format */
-	if (pspec->ptype.fmt != lptf_uuid) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* XXX Check if index is used */
-
-	part->label = label;
-	part->index = pspec->index;
-	part->block0 = pspec->block0;
-	part->nblocks = pspec->nblocks;
-	part->ptype = pspec->ptype;
-	uuid_generate(&part->part_uuid);
-
-	/* Prepare partition table entry */
-	rc = gpt_part_to_pte(part, &pte);
-	if (rc != EOK) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Modify partition tables */
-	rc = gpt_pte_update(label, &pte, pspec->index - 1);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	list_append(&part->lparts, &label->parts);
-	list_append(&part->lpri, &label->pri_parts);
-
-	*rpart = part;
-	return EOK;
-error:
-	free(part);
-	return rc;
-}
-
-static errno_t gpt_part_destroy(label_part_t *part)
-{
-	gpt_entry_t pte;
-	errno_t rc;
-
-	/* Prepare unused partition table entry */
-	gpt_unused_pte(&pte);
-
-	/* Modify partition tables */
-	rc = gpt_pte_update(part->label, &pte, part->index - 1);
-	if (rc != EOK)
-		return EIO;
-
-	list_remove(&part->lparts);
-	list_remove(&part->lpri);
-	free(part);
-	return EOK;
-}
-
-static errno_t gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	const char *ptid;
-	errno_t rc;
-
-	ptid = NULL;
-
-	switch (pcnt) {
-	case lpc_fat12_16:
-	case lpc_exfat:
-	case lpc_fat32:
-		ptid = GPT_MS_BASIC_DATA;
-		break;
-	case lpc_ext4:
-		ptid = GPT_LINUX_FS_DATA;
-		break;
-	case lpc_minix:
-		ptid = GPT_MINIX_FAKE;
-		break;
-	}
-
-	if (ptid == NULL)
-		return EINVAL;
-
-	ptype->fmt = lptf_uuid;
-	rc = uuid_parse(ptid, &ptype->t.uuid, NULL);
-	assert(rc == EOK);
-
-	return EOK;
-}
-
-/** Verify that the specified index is valid and free. */
-static errno_t gpt_check_free_idx(label_t *label, int index)
-{
-	label_part_t *part;
-
-	if (index < 1 || index > label->pri_entries)
-		return EINVAL;
-
-	part = gpt_part_first(label);
-	while (part != NULL) {
-		if (part->index == index)
-			return EEXIST;
-		part = gpt_part_next(part);
-	}
-
-	return EOK;
-}
-
-/** Determine if two block address ranges overlap. */
-static bool gpt_overlap(uint64_t a0, uint64_t an, uint64_t b0, uint64_t bn)
-{
-	return !(a0 + an <= b0 || b0 + bn <= a0);
-}
-
-static errno_t gpt_check_free_range(label_t *label, uint64_t block0,
-    uint64_t nblocks)
-{
-	label_part_t *part;
-
-	if (block0 < label->ablock0)
-		return EINVAL;
-	if (block0 + nblocks > label->ablock0 + label->anblocks)
-		return EINVAL;
-
-	part = gpt_part_first(label);
-	while (part != NULL) {
-		if (gpt_overlap(block0, nblocks, part->block0, part->nblocks))
-			return EEXIST;
-		part = gpt_part_next(part);
-	}
-
-	return EOK;
-}
-
-static void gpt_unused_pte(gpt_entry_t *pte)
-{
-	memset(pte, 0, sizeof(gpt_entry_t));
-}
-
-static errno_t gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)
-{
-	uint64_t eblock;
-
-	eblock = part->block0 + part->nblocks - 1;
-	if (eblock < part->block0)
-		return EINVAL;
-
-	memset(pte, 0, sizeof(gpt_entry_t));
-	uuid_encode_le(&part->ptype.t.uuid, pte->part_type);
-	uuid_encode_le(&part->part_uuid, pte->part_id);
-	pte->start_lba = host2uint64_t_le(part->block0);
-	pte->end_lba = host2uint64_t_le(eblock);
-	//pte->attributes
-	//pte->part_name
-	return EOK;
-}
-
-static errno_t gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)
-{
-	label_part_t *part;
-	bool present;
-	uint64_t b0, b1;
-	int i;
-
-	present = false;
-	for (i = 0; i < 8; i++)
-		if (pte->part_type[i] != 0x00)
-			present = true;
-
-	if (!present)
-		return EOK;
-
-	b0 = uint64_t_le2host(pte->start_lba);
-	b1 = uint64_t_le2host(pte->end_lba);
-	if (b1 <= b0)
-		return EINVAL;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	part->index = index;
-	part->block0 = b0;
-	part->nblocks = b1 - b0 + 1;
-	part->ptype.fmt = lptf_uuid;
-	uuid_decode_le(pte->part_type, &part->ptype.t.uuid);
-	uuid_decode_le(pte->part_id, &part->part_uuid);
-
-	part->label = label;
-	list_append(&part->lparts, &label->parts);
-	list_append(&part->lpri, &label->pri_parts);
-	return EOK;
-}
-
-/** Update partition table entry at specified index.
- *
- * Replace partition entry at index @a index with the contents of
- * @a pte.
- */
-static errno_t gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)
-{
-	size_t pos;
-	uint64_t ba;
-	uint64_t nblocks;
-	size_t ptbytes;
-	uint8_t *buf;
-	gpt_entry_t *e;
-	uint32_t crc;
-	int i;
-	errno_t rc;
-
-	/* Byte offset of partition entry */
-	pos = index * label->lt.gpt.esize;
-	/* Number of bytes in partition table */
-	ptbytes = label->pri_entries * label->lt.gpt.esize;
-
-	buf = calloc(1, label->block_size * label->lt.gpt.pt_blocks);
-	if (buf == NULL)
-		return ENOMEM;
-
-	/* For both partition tables: read, modify, write */
-	for (i = 0; i < 2; i++) {
-		ba = label->lt.gpt.ptable_ba[i];
-		nblocks = label->lt.gpt.pt_blocks;
-
-		rc = label->bd.ops->read(label->bd.arg, ba, nblocks, buf);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		crc = compute_crc32(buf, ptbytes);
-		if (crc != label->lt.gpt.pt_crc) {
-			/* Corruption detected */
-			rc = EIO;
-			goto error;
-		}
-
-		/* Replace single entry */
-		e = (gpt_entry_t *)(&buf[pos]);
-		*e = *pte;
-
-		rc = label->bd.ops->write(label->bd.arg, ba, nblocks, buf);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		crc = compute_crc32(buf, ptbytes);
-		rc = gpt_update_pt_crc(label, crc);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	label->lt.gpt.pt_crc = crc;
-	free(buf);
-	return EOK;
-error:
-	free(buf);
-	return rc;
-}
-
-static errno_t gpt_update_pt_crc(label_t *label, uint32_t crc)
-{
-	gpt_header_t *gpt_hdr;
-	errno_t rc;
-	int i;
-
-	gpt_hdr = calloc(1, label->block_size);
-	if (gpt_hdr == NULL) {
-		rc = ENOMEM;
-		goto exit;
-	}
-
-	for (i = 0; i < 2; i++) {
-		rc = label->bd.ops->read(label->bd.arg,
-		    label->lt.gpt.hdr_ba[i], 1, gpt_hdr);
-		if (rc != EOK) {
-			rc = EIO;
-			goto exit;
-		}
-
-		gpt_hdr->pe_array_crc32 = host2uint32_t_le(crc);
-		gpt_hdr_compute_crc(gpt_hdr, label->lt.gpt.hdr_size);
-
-		rc = label->bd.ops->write(label->bd.arg,
-		    label->lt.gpt.hdr_ba[i], 1, gpt_hdr);
-		if (rc != EOK) {
-			rc = EIO;
-			goto exit;
-		}
-	}
-
-	rc = EOK;
-
-exit:
-	free(gpt_hdr);
-	return rc;
-}
-
-static void gpt_hdr_compute_crc(gpt_header_t *hdr, size_t hdr_size)
-{
-	uint32_t crc;
-
-	hdr->header_crc32 = 0;
-	crc = compute_crc32((uint8_t *)hdr, hdr_size);
-	hdr->header_crc32 = crc;
-}
-
-static errno_t gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)
-{
-	gpt_header_t *c;
-
-	c = calloc(1, hdr_size);
-	if (c == NULL)
-		return ENOMEM;
-
-	memcpy(c, hdr, hdr_size);
-	c->header_crc32 = 0;
-	*crc = compute_crc32((uint8_t *)c, hdr_size);
-	free(c);
-
-	return EOK;
-}
-
-/** Create GPT Protective MBR */
-static errno_t gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
-{
-	mbr_br_block_t *pmbr = NULL;
-	uint64_t pmbr_nb;
-	errno_t rc;
-
-	pmbr = calloc(1, bsize);
-	if (pmbr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	pmbr_nb = nblocks - gpt_hdr_ba;
-
-	pmbr->pte[0].ptype = mbr_pt_gpt_protect;
-	pmbr->pte[0].first_lba = gpt_hdr_ba;
-
-	if (pmbr_nb <= UINT32_MAX)
-		pmbr->pte[0].length = host2uint32_t_le((uint32_t)pmbr_nb);
-	else
-		pmbr->pte[0].length = host2uint32_t_le(UINT32_MAX);
-
-	pmbr->signature = host2uint16_t_le(mbr_br_signature);
-
-	rc = bd->ops->write(bd->arg, mbr_ba, 1, pmbr);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(pmbr);
-	return EOK;
-error:
-	free(pmbr);
-	return rc;
-}
-
-/** Destroy GPT Protective MBR */
-static errno_t gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
-{
-	mbr_br_block_t *pmbr = NULL;
-	errno_t rc;
-
-	pmbr = calloc(1, bsize);
-	if (pmbr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = bd->ops->write(bd->arg, mbr_ba, 1, pmbr);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(pmbr);
-	return EOK;
-error:
-	free(pmbr);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/label/src/gpt.h
===================================================================
--- uspace/lib/label/src/gpt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file GUID Partition Table label.
- */
-
-#ifndef LIBLABEL_GPT_H_
-#define LIBLABEL_GPT_H_
-
-#include <types/liblabel.h>
-
-extern label_ops_t gpt_label_ops;
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/src/label.c
===================================================================
--- uspace/lib/label/src/label.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Disk label library.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <label/label.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "dummy.h"
-#include "gpt.h"
-#include "mbr.h"
-
-static label_ops_t *probe_list[] = {
-	&gpt_label_ops,
-	&mbr_label_ops,
-	&dummy_label_ops,
-	NULL
-};
-
-errno_t label_open(label_bd_t *bd, label_t **rlabel)
-{
-	label_ops_t **ops;
-	errno_t rc;
-
-	ops = &probe_list[0];
-	while (ops[0] != NULL) {
-		rc = ops[0]->open(bd, rlabel);
-		if (rc == EOK)
-			return EOK;
-		++ops;
-	}
-
-	return ENOTSUP;
-}
-
-errno_t label_create(label_bd_t *bd, label_type_t ltype, label_t **rlabel)
-{
-	label_ops_t *ops = NULL;
-
-	switch (ltype) {
-	case lt_none:
-		return EINVAL;
-	case lt_gpt:
-		ops = &gpt_label_ops;
-		break;
-	case lt_mbr:
-		ops = &mbr_label_ops;
-		break;
-	}
-
-	if (ops == NULL)
-		return ENOTSUP;
-
-	return ops->create(bd, rlabel);
-}
-
-void label_close(label_t *label)
-{
-	if (label == NULL)
-		return;
-
-	label->ops->close(label);
-}
-
-errno_t label_destroy(label_t *label)
-{
-	return label->ops->destroy(label);
-}
-
-errno_t label_get_info(label_t *label, label_info_t *linfo)
-{
-	return label->ops->get_info(label, linfo);
-}
-
-label_part_t *label_part_first(label_t *label)
-{
-	return label->ops->part_first(label);
-}
-
-label_part_t *label_part_next(label_part_t *part)
-{
-	return part->label->ops->part_next(part);
-}
-
-void label_part_get_info(label_part_t *part, label_part_info_t *pinfo)
-{
-	return part->label->ops->part_get_info(part, pinfo);
-}
-
-errno_t label_part_create(label_t *label, label_part_spec_t *pspec,
-    label_part_t **rpart)
-{
-	return label->ops->part_create(label, pspec, rpart);
-}
-
-errno_t label_part_destroy(label_part_t *part)
-{
-	return part->label->ops->part_destroy(part);
-}
-
-void label_pspec_init(label_part_spec_t *pspec)
-{
-	memset(pspec, 0, sizeof(label_part_spec_t));
-}
-
-errno_t label_suggest_ptype(label_t *label, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	return label->ops->suggest_ptype(label, pcnt, ptype);
-}
-
-/** @}
- */
Index: pace/lib/label/src/mbr.c
===================================================================
--- uspace/lib/label/src/mbr.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1200 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Master Boot Record label
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "std/fat.h"
-#include "std/mbr.h"
-#include "mbr.h"
-
-static errno_t mbr_open(label_bd_t *, label_t **);
-static errno_t mbr_open_ext(label_t *);
-static errno_t mbr_create(label_bd_t *, label_t **);
-static void mbr_close(label_t *);
-static errno_t mbr_destroy(label_t *);
-static errno_t mbr_get_info(label_t *, label_info_t *);
-static label_part_t *mbr_part_first(label_t *);
-static label_part_t *mbr_part_next(label_part_t *);
-static void mbr_part_get_info(label_part_t *, label_part_info_t *);
-static errno_t mbr_part_create(label_t *, label_part_spec_t *, label_part_t **);
-static errno_t mbr_part_destroy(label_part_t *);
-static errno_t mbr_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
-
-static errno_t mbr_check_free_idx(label_t *, int);
-static errno_t mbr_check_free_pri_range(label_t *, uint64_t, uint64_t);
-static errno_t mbr_check_free_log_range(label_t *, uint64_t, uint64_t, uint64_t);
-
-static void mbr_unused_pte(mbr_pte_t *);
-static errno_t mbr_part_to_pte(label_part_t *, mbr_pte_t *);
-static errno_t mbr_pte_to_part(label_t *, mbr_pte_t *, int);
-static errno_t mbr_pte_to_log_part(label_t *, uint64_t, mbr_pte_t *);
-static void mbr_log_part_to_ptes(label_part_t *, mbr_pte_t *, mbr_pte_t *);
-static errno_t mbr_pte_update(label_t *, mbr_pte_t *, int);
-static errno_t mbr_log_part_insert(label_t *, label_part_t *);
-static errno_t mbr_ebr_create(label_t *, label_part_t *);
-static errno_t mbr_ebr_delete(label_t *, label_part_t *);
-static errno_t mbr_ebr_update_next(label_t *, label_part_t *);
-static void mbr_update_log_indices(label_t *);
-
-label_ops_t mbr_label_ops = {
-	.open = mbr_open,
-	.create = mbr_create,
-	.close = mbr_close,
-	.destroy = mbr_destroy,
-	.get_info = mbr_get_info,
-	.part_first = mbr_part_first,
-	.part_next = mbr_part_next,
-	.part_get_info = mbr_part_get_info,
-	.part_create = mbr_part_create,
-	.part_destroy = mbr_part_destroy,
-	.suggest_ptype = mbr_suggest_ptype
-};
-
-static errno_t mbr_open(label_bd_t *bd, label_t **rlabel)
-{
-	label_t *label = NULL;
-	mbr_br_block_t *mbr = NULL;
-	fat_bs_t *bs;
-	mbr_pte_t *eptr;
-	uint16_t sgn;
-	size_t bsize;
-	aoff64_t nblocks;
-	uint32_t entry;
-	errno_t rc;
-
-	rc = bd->ops->get_bsize(bd->arg, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (bsize < 512 || (bsize % 512) != 0) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (nblocks < mbr_ablock0) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	mbr = calloc(1, bsize);
-	if (mbr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	bs = (fat_bs_t *)mbr;
-
-	rc = bd->ops->read(bd->arg, mbr_ba, 1, mbr);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	label = calloc(1, sizeof(label_t));
-	if (label == NULL)
-		return ENOMEM;
-
-	list_initialize(&label->parts);
-	list_initialize(&label->pri_parts);
-	list_initialize(&label->log_parts);
-
-	/* Verify boot record signature */
-	sgn = uint16_t_le2host(mbr->signature);
-	if (sgn != mbr_br_signature) {
-		rc = EIO;
-		goto error;
-	}
-
-	/*
-	 * We can't really tell whether this is an MBR. Make sure
-	 * this is not actually the BR of a 12/16-bit FAT file system
-	 */
-	if (bs->type[0] == 'F' && bs->type[1] == 'A' && bs->type[2] == 'T') {
-		rc = EIO;
-		goto error;
-	}
-
-	/*
-	 * Or a 32-bit FAT file system
-	 */
-	if (bs->fat32.type[0] == 'F' && bs->fat32.type[1] == 'A' &&
-	    bs->fat32.type[2] == 'T') {
-		rc = EIO;
-		goto error;
-	}
-
-	label->ext_part = NULL;
-	for (entry = 0; entry < mbr_nprimary; entry++) {
-		eptr = &mbr->pte[entry];
-		rc = mbr_pte_to_part(label, eptr, entry + 1);
-		if (rc != EOK)
-			goto error;
-	}
-
-	free(mbr);
-	mbr = NULL;
-
-	label->ops = &mbr_label_ops;
-	label->ltype = lt_mbr;
-	label->bd = *bd;
-	label->block_size = bsize;
-	label->ablock0 = mbr_ablock0;
-	label->anblocks = nblocks - mbr_ablock0;
-	label->pri_entries = mbr_nprimary;
-
-	if (label->ext_part != NULL) {
-		/* Open extended partition */
-		rc = mbr_open_ext(label);
-		if (rc != EOK)
-			goto error;
-	}
-
-	*rlabel = label;
-	return EOK;
-error:
-	free(mbr);
-	mbr_close(label);
-	return rc;
-}
-
-/** Open extended partition */
-static errno_t mbr_open_ext(label_t *label)
-{
-	mbr_br_block_t *ebr = NULL;
-	mbr_pte_t *ethis;
-	mbr_pte_t *enext;
-	uint64_t ebr_b0;
-	uint64_t ebr_nblocks_min;
-	uint64_t ebr_nblocks_max;
-	uint64_t pebr_b0;
-	uint64_t pebr_nblocks;
-	uint64_t pb0;
-	uint64_t pnblocks;
-	uint64_t ep_b0;
-	errno_t rc;
-
-	ebr = calloc(1, label->block_size);
-	if (ebr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* First block of extended partition */
-	ep_b0 = label->ext_part->block0;
-
-	/* First block of current EBR */
-	ebr_b0 = label->ext_part->block0;
-
-	/*
-	 * We don't have bounds for the first EBR, so for purpose of
-	 * verification let's say it contains at least one block and
-	 * at most all blocks from the extended partition.
-	 */
-	ebr_nblocks_min = 1;
-	ebr_nblocks_max = label->ext_part->nblocks;
-
-	while (true) {
-		/* Read EBR */
-		rc = label->bd.ops->read(label->bd.arg, ebr_b0, 1, ebr);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		ethis = &ebr->pte[mbr_ebr_pte_this];
-		enext = &ebr->pte[mbr_ebr_pte_next];
-
-		pb0 = ebr_b0 + uint32_t_le2host(ethis->first_lba);
-		pnblocks = uint32_t_le2host(ethis->length);
-
-		if (ethis->ptype == mbr_pt_unused || pnblocks == 0)
-			break;
-
-		/* Verify partition lies within the range of EBR */
-		if (pb0 + pnblocks > ebr_b0 + ebr_nblocks_max) {
-			rc = EIO;
-			goto error;
-		}
-
-		/* Create partition structure */
-		rc = mbr_pte_to_log_part(label, ebr_b0, ethis);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		/* Save previous EBR range */
-		pebr_b0 = ebr_b0;
-		pebr_nblocks = ebr_nblocks_min;
-
-		/* Proceed to next EBR */
-		ebr_b0 = ep_b0 + uint32_t_le2host(enext->first_lba);
-		ebr_nblocks_min = uint32_t_le2host(enext->length);
-		ebr_nblocks_max = ebr_nblocks_min;
-
-		if (enext->ptype == mbr_pt_unused || ebr_nblocks_min == 0)
-			break;
-
-		/* Verify next EBR does not overlap this EBR */
-		if (ebr_b0 < pebr_b0 + pebr_nblocks) {
-			rc = EIO;
-			goto error;
-		}
-
-		/* Verify next EBR does not extend beyond end of label */
-		if (ebr_b0 + ebr_nblocks_max > label->ablock0 + label->anblocks) {
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	free(ebr);
-	return EOK;
-error:
-	/* Note that logical partitions need to be deleted by caller */
-	free(ebr);
-	return rc;
-}
-
-static errno_t mbr_create(label_bd_t *bd, label_t **rlabel)
-{
-	label_t *label = NULL;
-	mbr_br_block_t *mbr = NULL;
-	aoff64_t nblocks;
-	size_t bsize;
-	int i;
-	errno_t rc;
-
-	rc = bd->ops->get_bsize(bd->arg, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = bd->ops->get_nblocks(bd->arg, &nblocks);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	mbr = calloc(1, bsize);
-	if (mbr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	label = calloc(1, sizeof(label_t));
-	if (label == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	list_initialize(&label->parts);
-	list_initialize(&label->pri_parts);
-	list_initialize(&label->log_parts);
-
-	mbr->media_id = 0;
-	mbr->pad0 = 0;
-	for (i = 0; i < mbr_nprimary; i++)
-		mbr_unused_pte(&mbr->pte[i]);
-	mbr->signature = host2uint16_t_le(mbr_br_signature);
-
-	rc = bd->ops->write(bd->arg, mbr_ba, 1, mbr);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(mbr);
-	mbr = NULL;
-
-	label->ops = &mbr_label_ops;
-	label->ltype = lt_mbr;
-	label->block_size = bsize;
-	label->bd = *bd;
-	label->ablock0 = mbr_ablock0;
-	label->anblocks = nblocks - mbr_ablock0;
-	label->pri_entries = mbr_nprimary;
-	label->ext_part = NULL;
-
-	*rlabel = label;
-	return EOK;
-error:
-	free(mbr);
-	free(label);
-	return rc;
-}
-
-static void mbr_close(label_t *label)
-{
-	label_part_t *part;
-
-	if (label == NULL)
-		return;
-
-	part = mbr_part_first(label);
-	while (part != NULL) {
-		list_remove(&part->lparts);
-		if (link_used(&part->lpri))
-			list_remove(&part->lpri);
-		if (link_used(&part->llog))
-			list_remove(&part->llog);
-		free(part);
-
-		part = mbr_part_first(label);
-	}
-
-	free(label);
-}
-
-static errno_t mbr_destroy(label_t *label)
-{
-	mbr_br_block_t *mbr = NULL;
-	label_part_t *part;
-	errno_t rc;
-
-	part = mbr_part_first(label);
-	if (part != NULL) {
-		rc = ENOTEMPTY;
-		goto error;
-	}
-
-	mbr = calloc(1, label->block_size);
-	if (mbr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = label->bd.ops->write(label->bd.arg, mbr_ba, 1, mbr);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(mbr);
-	mbr = NULL;
-
-	free(label);
-	return EOK;
-error:
-	free(mbr);
-	return rc;
-}
-
-static bool mbr_can_delete_part(label_t *label)
-{
-	return list_count(&label->parts) > 0;
-}
-
-static bool mbr_can_modify_part(label_t *label)
-{
-	return list_count(&label->parts) > 0;
-}
-
-static errno_t mbr_get_info(label_t *label, label_info_t *linfo)
-{
-	memset(linfo, 0, sizeof(label_info_t));
-	linfo->ltype = lt_mbr;
-
-	/* We support extended partitions */
-	linfo->flags = lf_ext_supp;
-
-	/** Can create primary if there is a free slot */
-	if (list_count(&label->pri_parts) < mbr_nprimary)
-		linfo->flags |= lf_can_create_pri;
-	/* Can create extended if there is a free slot and no extended */
-	if ((linfo->flags & lf_can_create_pri) != 0 && label->ext_part == NULL)
-		linfo->flags |= lf_can_create_ext;
-	/* Can create logical if there is an extended partition */
-	if (label->ext_part != NULL)
-		linfo->flags |= lf_can_create_log;
-	/* Can delete partition */
-	if (mbr_can_delete_part(label))
-		linfo->flags |= lf_can_delete_part;
-	/* Can modify partition */
-	if (mbr_can_modify_part(label))
-		linfo->flags |= lf_can_modify_part;
-
-	linfo->ablock0 = label->ablock0;
-	linfo->anblocks = label->anblocks;
-
-	return EOK;
-}
-
-static label_part_t *mbr_part_first(label_t *label)
-{
-	link_t *link;
-
-	link = list_first(&label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static label_part_t *mbr_part_next(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->lparts, &part->label->parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lparts);
-}
-
-static label_part_t *mbr_log_part_first(label_t *label)
-{
-	link_t *link;
-
-	link = list_first(&label->log_parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, llog);
-}
-
-static label_part_t *mbr_log_part_next(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->llog, &part->label->log_parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, llog);
-}
-
-static label_part_t *mbr_log_part_prev(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_prev(&part->llog, &part->label->log_parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, llog);
-}
-
-static label_part_t *mbr_pri_part_first(label_t *label)
-{
-	link_t *link;
-
-	link = list_first(&label->pri_parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lpri);
-}
-
-static label_part_t *mbr_pri_part_next(label_part_t *part)
-{
-	link_t *link;
-
-	link = list_next(&part->lpri, &part->label->pri_parts);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, label_part_t, lpri);
-}
-
-static void mbr_part_get_info(label_part_t *part, label_part_info_t *pinfo)
-{
-	pinfo->index = part->index;
-	pinfo->block0 = part->block0;
-	pinfo->nblocks = part->nblocks;
-
-	if (link_used(&part->llog))
-		pinfo->pkind = lpk_logical;
-	else if (part->ptype.t.num == mbr_pt_extended)
-		pinfo->pkind = lpk_extended;
-	else
-		pinfo->pkind = lpk_primary;
-}
-
-static errno_t mbr_part_create(label_t *label, label_part_spec_t *pspec,
-    label_part_t **rpart)
-{
-	label_part_t *part;
-	label_part_t *prev;
-	label_part_t *next;
-	mbr_pte_t pte;
-	errno_t rc;
-
-	if (pspec->ptype.fmt != lptf_num)
-		return EINVAL;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	/* XXX Check if index is used */
-	part->label = label;
-	part->index = pspec->index;
-	part->block0 = pspec->block0;
-	part->nblocks = pspec->nblocks;
-	part->hdr_blocks = pspec->hdr_blocks;
-
-	switch (pspec->pkind) {
-	case lpk_primary:
-		part->ptype = pspec->ptype;
-		break;
-	case lpk_extended:
-		part->ptype.fmt = lptf_num;
-		part->ptype.t.num = mbr_pt_extended;
-		if (pspec->ptype.t.num != 0) {
-			rc = EINVAL;
-			goto error;
-		}
-		if (label->ext_part != NULL) {
-			rc = EEXIST;
-			goto error;
-		}
-		break;
-	case lpk_logical:
-		part->ptype = pspec->ptype;
-		if (pspec->index != 0) {
-			rc = EINVAL;
-			goto error;
-		}
-		break;
-	}
-
-	if (pspec->pkind != lpk_logical) {
-		/* Primary or extended partition */
-
-		/* Verify index is within bounds and free */
-		rc = mbr_check_free_idx(label, pspec->index);
-		if (rc != EOK) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		/* Verify range is within bounds and free */
-		rc = mbr_check_free_pri_range(label, pspec->block0, pspec->nblocks);
-		if (rc != EOK) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		if (pspec->hdr_blocks != 0) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		rc = mbr_part_to_pte(part, &pte);
-		if (rc != EOK) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		rc = mbr_pte_update(label, &pte, pspec->index - 1);
-		if (rc != EOK) {
-			rc = EIO;
-			goto error;
-		}
-
-		if (pspec->pkind == lpk_extended) {
-			label->ext_part = part;
-
-			/* Create EBR for empty partition chain */
-			rc = mbr_ebr_create(label, NULL);
-			if (rc != EOK) {
-				label->ext_part = NULL;
-				rc = EIO;
-				goto error;
-			}
-		}
-
-		list_append(&part->lparts, &label->parts);
-		list_append(&part->lpri, &label->pri_parts);
-	} else {
-		/* Verify range is within bounds and free */
-		rc = mbr_check_free_log_range(label, pspec->hdr_blocks,
-		    pspec->block0, pspec->nblocks);
-		if (rc != EOK) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		/* Logical partition */
-		rc = mbr_log_part_insert(label, part);
-		if (rc != EOK)
-			goto error;
-
-		/* Create EBR for new partition */
-		rc = mbr_ebr_create(label, part);
-		if (rc != EOK)
-			goto error;
-
-		prev = mbr_log_part_prev(part);
-		if (prev != NULL) {
-			/* Update 'next' PTE in EBR of previous partition */
-			rc = mbr_ebr_update_next(label, prev);
-			if (rc != EOK) {
-				goto error;
-			}
-		} else {
-			/* New partition is now the first one */
-			next = mbr_log_part_next(part);
-			if (next != NULL) {
-				/*
-				 * Create new, relocated EBR for the former
-				 * first partition
-				 */
-				next->hdr_blocks = pspec->hdr_blocks;
-				rc = mbr_ebr_create(label, next);
-				if (rc != EOK)
-					goto error;
-			}
-		}
-
-		/* This also sets index for the new partition. */
-		mbr_update_log_indices(label);
-	}
-
-	*rpart = part;
-	return EOK;
-error:
-	free(part);
-	return rc;
-}
-
-static errno_t mbr_part_destroy(label_part_t *part)
-{
-	mbr_pte_t pte;
-	label_part_t *prev;
-	label_part_t *next;
-	uint64_t ep_b0;
-	errno_t rc;
-
-	if (link_used(&part->lpri)) {
-		/* Primary/extended partition */
-
-		/* Prepare unused partition table entry */
-		mbr_unused_pte(&pte);
-
-		/* Modify partition table */
-		rc = mbr_pte_update(part->label, &pte, part->index - 1);
-		if (rc != EOK)
-			return EIO;
-
-		/* If it was the extended partition, clear ext. part. pointer */
-		if (part == part->label->ext_part)
-			part->label->ext_part = NULL;
-
-		list_remove(&part->lpri);
-	} else {
-		/* Logical partition */
-
-		prev = mbr_log_part_prev(part);
-		if (prev != NULL) {
-			/* Update next link in previous EBR */
-			list_remove(&part->llog);
-
-			rc = mbr_ebr_update_next(part->label, prev);
-			if (rc != EOK) {
-				/* Roll back */
-				list_insert_after(&part->llog, &prev->llog);
-				return EIO;
-			}
-
-			/* Delete EBR */
-			rc = mbr_ebr_delete(part->label, part);
-			if (rc != EOK)
-				return EIO;
-		} else {
-			next = mbr_log_part_next(part);
-			list_remove(&part->llog);
-
-			if (next != NULL) {
-				/*
-				 * Relocate next partition's EBR to the beginning
-				 * of the extended partition. This also
-				 * overwrites the EBR of the former first
-				 * partition.
-				 */
-
-				/* First block of extended partition */
-				ep_b0 = part->label->ext_part->block0;
-
-				next->hdr_blocks = next->block0 - ep_b0;
-
-				rc = mbr_ebr_create(part->label, next);
-				if (rc != EOK) {
-					list_prepend(&part->llog, &part->label->log_parts);
-					return EIO;
-				}
-			} else {
-				/* Delete EBR */
-				rc = mbr_ebr_delete(part->label, part);
-				if (rc != EOK)
-					return EIO;
-			}
-		}
-
-		/* Update indices */
-		mbr_update_log_indices(part->label);
-	}
-
-	list_remove(&part->lparts);
-	free(part);
-	return EOK;
-}
-
-static errno_t mbr_suggest_ptype(label_t *label, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	ptype->fmt = lptf_num;
-	ptype->t.num = 0;
-
-	switch (pcnt) {
-	case lpc_exfat:
-		ptype->t.num = mbr_pt_ms_advanced;
-		break;
-	case lpc_ext4:
-		ptype->t.num = mbr_pt_linux;
-		break;
-	case lpc_fat12_16:
-		ptype->t.num = mbr_pt_fat16_lba;
-		break;
-	case lpc_fat32:
-		ptype->t.num = mbr_pt_fat32_lba;
-		break;
-	case lpc_minix:
-		ptype->t.num = mbr_pt_minix;
-		break;
-	}
-
-	if (ptype->t.num == 0)
-		return EINVAL;
-
-	return EOK;
-}
-
-/** Determine if two block address ranges overlap. */
-static bool mbr_overlap(uint64_t a0, uint64_t an, uint64_t b0, uint64_t bn)
-{
-	return !(a0 + an <= b0 || b0 + bn <= a0);
-}
-
-/** Verify that the specified index is valid and free. */
-static errno_t mbr_check_free_idx(label_t *label, int index)
-{
-	label_part_t *part;
-
-	if (index < 1 || index > label->pri_entries)
-		return EINVAL;
-
-	part = mbr_pri_part_first(label);
-	while (part != NULL) {
-		if (part->index == index)
-			return EEXIST;
-		part = mbr_pri_part_next(part);
-	}
-
-	return EOK;
-}
-
-static errno_t mbr_check_free_pri_range(label_t *label, uint64_t block0,
-    uint64_t nblocks)
-{
-	label_part_t *part;
-
-	if (block0 < label->ablock0)
-		return EINVAL;
-	if (block0 + nblocks > label->ablock0 + label->anblocks)
-		return EINVAL;
-
-	part = mbr_pri_part_first(label);
-	while (part != NULL) {
-		if (mbr_overlap(block0, nblocks, part->block0, part->nblocks))
-			return EEXIST;
-		part = mbr_pri_part_next(part);
-	}
-
-	return EOK;
-}
-
-static errno_t mbr_check_free_log_range(label_t *label, uint64_t hdr_blocks,
-    uint64_t block0, uint64_t nblocks)
-{
-	label_part_t *part;
-
-	if (block0 - hdr_blocks < label->ext_part->block0)
-		return EINVAL;
-	if (block0 + nblocks > label->ext_part->block0 + label->ext_part->nblocks)
-		return EINVAL;
-
-	part = mbr_log_part_first(label);
-	while (part != NULL) {
-		if (mbr_overlap(block0 - hdr_blocks, nblocks + hdr_blocks,
-		    part->block0 - part->hdr_blocks, part->nblocks + part->hdr_blocks))
-			return EEXIST;
-		part = mbr_log_part_next(part);
-	}
-
-	return EOK;
-}
-
-static void mbr_unused_pte(mbr_pte_t *pte)
-{
-	memset(pte, 0, sizeof(mbr_pte_t));
-}
-
-static errno_t mbr_part_to_pte(label_part_t *part, mbr_pte_t *pte)
-{
-	if ((part->block0 >> 32) != 0)
-		return EINVAL;
-	if ((part->nblocks >> 32) != 0)
-		return EINVAL;
-	if ((part->ptype.t.num >> 8) != 0)
-		return EINVAL;
-
-	memset(pte, 0, sizeof(mbr_pte_t));
-	pte->ptype = part->ptype.t.num;
-	pte->first_lba = host2uint32_t_le(part->block0);
-	pte->length = host2uint32_t_le(part->nblocks);
-	return EOK;
-}
-
-static errno_t mbr_pte_to_part(label_t *label, mbr_pte_t *pte, int index)
-{
-	label_part_t *part;
-	uint32_t block0;
-	uint32_t nblocks;
-
-	block0 = uint32_t_le2host(pte->first_lba);
-	nblocks = uint32_t_le2host(pte->length);
-
-	/* See UEFI specification 2.0 section 5.2.1 Legacy Master Boot Record */
-	if (pte->ptype == mbr_pt_unused || nblocks == 0)
-		return EOK;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	part->ptype.fmt = lptf_num;
-	part->ptype.t.num = pte->ptype;
-	part->index = index;
-	part->block0 = block0;
-	part->nblocks = nblocks;
-
-	/*
-	 * TODO: Verify
-	 *   - partition must reside on disk
-	 *   - partition must not overlap any other partition
-	 */
-
-	part->label = label;
-	list_append(&part->lparts, &label->parts);
-	list_append(&part->lpri, &label->pri_parts);
-
-	if (pte->ptype == mbr_pt_extended)
-		label->ext_part = part;
-	return EOK;
-}
-
-static errno_t mbr_pte_to_log_part(label_t *label, uint64_t ebr_b0,
-    mbr_pte_t *pte)
-{
-	label_part_t *part;
-	uint32_t block0;
-	uint32_t nblocks;
-	size_t nlparts;
-
-	block0 = ebr_b0 + uint32_t_le2host(pte->first_lba);
-	nblocks = uint32_t_le2host(pte->length);
-
-	if (pte->ptype == mbr_pt_unused || nblocks == 0)
-		return EOK;
-
-	part = calloc(1, sizeof(label_part_t));
-	if (part == NULL)
-		return ENOMEM;
-
-	nlparts = list_count(&label->log_parts);
-
-	part->ptype.fmt = lptf_num;
-	part->ptype.t.num = pte->ptype;
-	part->index = mbr_nprimary + 1 + nlparts;
-	part->block0 = block0;
-	part->nblocks = nblocks;
-	part->hdr_blocks = block0 - ebr_b0;
-
-	part->label = label;
-	list_append(&part->lparts, &label->parts);
-	list_append(&part->llog, &label->log_parts);
-
-	return EOK;
-}
-
-static void mbr_log_part_to_ptes(label_part_t *part, mbr_pte_t *pthis,
-    mbr_pte_t *pnext)
-{
-	label_part_t *next;
-	uint64_t ep_b0;
-	uint64_t totsize;
-
-	/* First block of extended partition */
-	ep_b0 = part->label->ext_part->block0;
-
-	assert(link_used(&part->llog));
-	assert(part->block0 >= ep_b0);
-	assert(part->hdr_blocks <= part->block0 - ep_b0);
-
-	/* 'This' EBR entry */
-	if (pthis != NULL) {
-		memset(pthis, 0, sizeof(mbr_pte_t));
-		pthis->ptype = part->ptype.t.num;
-		pthis->first_lba = host2uint32_t_le(part->hdr_blocks);
-		pthis->length = host2uint32_t_le(part->nblocks);
-	}
-
-	/* 'Next' EBR entry */
-	if (pnext != NULL) {
-		next = mbr_log_part_next(part);
-
-		memset(pnext, 0, sizeof(mbr_pte_t));
-		if (next != NULL) {
-			/* Total size of EBR + partition */
-			totsize = next->hdr_blocks + next->nblocks;
-
-			pnext->ptype = mbr_pt_extended;
-			pnext->first_lba = host2uint32_t_le(next->block0 -
-			    next->hdr_blocks - ep_b0);
-			pnext->length = host2uint32_t_le(totsize);
-		}
-	}
-}
-
-/** Update partition table entry at specified index.
- *
- * Replace partition entry at index @a index with the contents of
- * @a pte.
- */
-static errno_t mbr_pte_update(label_t *label, mbr_pte_t *pte, int index)
-{
-	mbr_br_block_t *br;
-	errno_t rc;
-
-	br = calloc(1, label->block_size);
-	if (br == NULL)
-		return ENOMEM;
-
-	rc = label->bd.ops->read(label->bd.arg, mbr_ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	br->pte[index] = *pte;
-
-	rc = label->bd.ops->write(label->bd.arg, mbr_ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(br);
-	return EOK;
-error:
-	free(br);
-	return rc;
-}
-
-/** Insert logical partition into logical partition list. */
-static errno_t mbr_log_part_insert(label_t *label, label_part_t *part)
-{
-	label_part_t *cur;
-
-	cur = mbr_log_part_first(label);
-	while (cur != NULL) {
-		if (cur->block0 + cur->nblocks > part->block0)
-			break;
-		cur = mbr_log_part_next(part);
-	}
-
-	if (cur != NULL)
-		list_insert_before(&part->llog, &cur->llog);
-	else
-		list_append(&part->llog, &label->log_parts);
-
-	return EOK;
-}
-
-/** Create EBR for partition.
- *
- * @param label Label
- * @param part Partition for which to create EBR or @c NULL to create
- *        EBR for empty partition chain
- * @return EOK on success or non-zero error code
- */
-static errno_t mbr_ebr_create(label_t *label, label_part_t *part)
-{
-	mbr_br_block_t *br;
-	uint64_t ba;
-	errno_t rc;
-
-	br = calloc(1, label->block_size);
-	if (br == NULL)
-		return ENOMEM;
-
-	if (part != NULL) {
-		ba = part->block0 - part->hdr_blocks;
-		mbr_log_part_to_ptes(part, &br->pte[mbr_ebr_pte_this],
-		    &br->pte[mbr_ebr_pte_next]);
-	} else {
-		ba = label->ext_part->block0;
-	}
-
-	br->signature = host2uint16_t_le(mbr_br_signature);
-
-	rc = label->bd.ops->write(label->bd.arg, ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(br);
-	return EOK;
-error:
-	free(br);
-	return rc;
-}
-
-static errno_t mbr_ebr_delete(label_t *label, label_part_t *part)
-{
-	mbr_br_block_t *br;
-	uint64_t ba;
-	errno_t rc;
-
-	br = calloc(1, label->block_size);
-	if (br == NULL)
-		return ENOMEM;
-
-	ba = part->block0 - part->hdr_blocks;
-
-	rc = label->bd.ops->write(label->bd.arg, ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(br);
-	return EOK;
-error:
-	free(br);
-	return rc;
-}
-
-/** Update 'next' PTE in EBR of partition. */
-static errno_t mbr_ebr_update_next(label_t *label, label_part_t *part)
-{
-	mbr_br_block_t *br;
-	uint64_t ba;
-	uint16_t sgn;
-	errno_t rc;
-
-	ba = part->block0 - part->hdr_blocks;
-
-	br = calloc(1, label->block_size);
-	if (br == NULL)
-		return ENOMEM;
-
-	rc = label->bd.ops->read(label->bd.arg, ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	/* Verify boot record signature */
-	sgn = uint16_t_le2host(br->signature);
-	if (sgn != mbr_br_signature) {
-		rc = EIO;
-		goto error;
-	}
-
-	mbr_log_part_to_ptes(part, NULL, &br->pte[mbr_ebr_pte_next]);
-
-	rc = label->bd.ops->write(label->bd.arg, ba, 1, br);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	free(br);
-	return EOK;
-error:
-	free(br);
-	return rc;
-}
-
-/** Update indices of logical partitions.
- *
- * Logical partition indices are unstable, i.e. they can change during
- * the lifetime of a logical partition. Since the index corresponds to the
- * position of the partition in order of block address, anytime a partition
- * is created or deleted, indices of all partitions at higher addresses
- * change.
- */
-static void mbr_update_log_indices(label_t *label)
-{
-	label_part_t *part;
-	int idx;
-
-	idx = mbr_nprimary + 1;
-
-	part = mbr_log_part_first(label);
-	while (part != NULL) {
-		part->index = idx++;
-		part = mbr_log_part_next(part);
-	}
-}
-
-/** @}
- */
Index: pace/lib/label/src/mbr.h
===================================================================
--- uspace/lib/label/src/mbr.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liblabel
- * @{
- */
-/**
- * @file Master Boot Record label
- */
-
-#ifndef LIBLABEL_MBR_H_
-#define LIBLABEL_MBR_H_
-
-#include <types/liblabel.h>
-
-extern label_ops_t mbr_label_ops;
-
-#endif
-
-/** @}
- */
Index: pace/lib/label/test/label.c
===================================================================
--- uspace/lib/label/test/label.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,620 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <label/label.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stddef.h>
-#include <stdlib.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(label);
-
-static errno_t label_test_get_bsize(void *, size_t *);
-static errno_t label_test_get_nblocks(void *, aoff64_t *);
-static errno_t label_test_read(void *, aoff64_t, size_t, void *);
-static errno_t label_test_write(void *, aoff64_t, size_t, const void *);
-
-label_bd_ops_t label_test_ops = {
-	.get_bsize = label_test_get_bsize,
-	.get_nblocks = label_test_get_nblocks,
-	.read = label_test_read,
-	.write = label_test_write
-};
-
-/** Pretended block device for testing */
-typedef struct {
-	char *data;
-	size_t bsize;
-	aoff64_t nblocks;
-} test_bd_t;
-
-enum {
-	test_block_size = 512,
-	test_nblocks = 1024
-};
-
-/** Create pretended block device.
- *
- * @param bsize Block size
- * @param nblocks Number of blocks
- * @param rbd Place to store pointer to new pretended block device
- */
-static errno_t test_bd_create(size_t bsize, aoff64_t nblocks, test_bd_t **rbd)
-{
-	test_bd_t *bd;
-
-	bd = calloc(1, sizeof(test_bd_t));
-	if (bd == NULL)
-		return ENOMEM;
-
-	bd->data = calloc(bsize, nblocks);
-	if (bd->data == NULL) {
-		free(bd);
-		return ENOMEM;
-	}
-
-	bd->bsize = bsize;
-	bd->nblocks = nblocks;
-	*rbd = bd;
-
-	return EOK;
-}
-
-/** Destroy pretended block device.
- *
- * @param bd Pretended block device
- */
-static void test_bd_destroy(test_bd_t *bd)
-{
-	free(bd->data);
-	free(bd);
-}
-
-/** Get block size wrapper for liblabel */
-static errno_t label_test_get_bsize(void *arg, size_t *bsize)
-{
-	test_bd_t *bd = (test_bd_t *)arg;
-
-	*bsize = bd->bsize;
-	return EOK;
-}
-
-/** Get number of blocks wrapper for liblabel */
-static errno_t label_test_get_nblocks(void *arg, aoff64_t *nblocks)
-{
-	test_bd_t *bd = (test_bd_t *)arg;
-
-	*nblocks = bd->nblocks;
-	return EOK;
-}
-
-/** Read blocks wrapper for liblabel */
-static errno_t label_test_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
-{
-	test_bd_t *bd = (test_bd_t *)arg;
-
-	if (ba >= bd->nblocks)
-		return EINVAL;
-
-	memcpy(buf, bd->data + ba * bd->bsize, bd->bsize);
-	return EOK;
-}
-
-/** Write blocks wrapper for liblabel */
-static errno_t label_test_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
-{
-	test_bd_t *bd = (test_bd_t *)arg;
-
-	if (ba >= bd->nblocks)
-		return EINVAL;
-
-	memcpy(bd->data + ba * bd->bsize, data, bd->bsize);
-	return EOK;
-}
-
-PCUT_TEST(open_empty)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_none, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(0, linfo.flags);
-
-	/* There should be exactly one pseudo partition */
-	part = label_part_first(label);
-	PCUT_ASSERT_NOT_NULL(part);
-
-	part = label_part_next(part);
-	PCUT_ASSERT_NULL(part);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_TEST(create_destroy_mbr)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_create(&lbd, lt_mbr, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_mbr, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_ext_supp | lf_can_create_pri |
-	    lf_can_create_ext, linfo.flags);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Everything should still be the same */
-	PCUT_ASSERT_INT_EQUALS(lt_mbr, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_ext_supp | lf_can_create_pri |
-	    lf_can_create_ext, linfo.flags);
-
-	rc = label_destroy(label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no label now */
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_none, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(0, linfo.flags);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_TEST(create_destroy_gpt)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_create(&lbd, lt_gpt, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_gpt, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_can_create_pri | lf_ptype_uuid, linfo.flags);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Everything should still be the same */
-	PCUT_ASSERT_INT_EQUALS(lt_gpt, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_can_create_pri | lf_ptype_uuid, linfo.flags);
-
-	rc = label_destroy(label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no label now */
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_none, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(0, linfo.flags);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_TEST(mbr_primary_part)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part;
-	label_part_spec_t pspec;
-	label_part_info_t pinfo;
-	label_ptype_t ptype;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_create(&lbd, lt_mbr, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	rc = label_suggest_ptype(label, lpc_ext4, &ptype);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	memset(&pspec, 0, sizeof(pspec));
-	pspec.index = 1;
-	pspec.block0 = linfo.ablock0;
-	pspec.nblocks = linfo.anblocks;
-	pspec.hdr_blocks = 0;
-	pspec.pkind = lpk_primary;
-	pspec.ptype = ptype;
-
-	rc = label_part_create(label, &pspec, &part);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	label_part_get_info(part, &pinfo);
-	PCUT_ASSERT_INT_EQUALS(1, pinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_primary, pinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, pinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, pinfo.nblocks);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_mbr, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_ext_supp | lf_can_create_pri |
-	    lf_can_create_ext | lf_can_delete_part | lf_can_modify_part,
-	    linfo.flags);
-
-	part = label_part_first(label);
-	PCUT_ASSERT_NOT_NULL(part);
-	PCUT_ASSERT_NULL(label_part_next(part));
-
-	label_part_get_info(part, &pinfo);
-	PCUT_ASSERT_INT_EQUALS(1, pinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_primary, pinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, pinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, pinfo.nblocks);
-
-	/* Destroy the partition */
-	rc = label_part_destroy(part);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_TEST(mbr_logical_part)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part, *lpart, *epart;
-	label_part_spec_t pspec;
-	label_ptype_t ptype;
-	label_part_info_t pinfo, lpinfo, epinfo;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_create(&lbd, lt_mbr, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	memset(&pspec, 0, sizeof(pspec));
-	pspec.index = 1;
-	pspec.block0 = linfo.ablock0;
-	pspec.nblocks = linfo.anblocks;
-	pspec.hdr_blocks = 0;
-	pspec.pkind = lpk_extended;
-
-	rc = label_part_create(label, &pspec, &epart);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	label_part_get_info(epart, &epinfo);
-	PCUT_ASSERT_INT_EQUALS(1, epinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_extended, epinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, epinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, epinfo.nblocks);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_mbr, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_ext_supp | lf_can_create_pri |
-	    lf_can_create_log | lf_can_delete_part | lf_can_modify_part,
-	    linfo.flags);
-
-	epart = label_part_first(label);
-	PCUT_ASSERT_NOT_NULL(epart);
-	PCUT_ASSERT_NULL(label_part_next(epart));
-
-	label_part_get_info(epart, &epinfo);
-	PCUT_ASSERT_INT_EQUALS(1, epinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_extended, epinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, epinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, epinfo.nblocks);
-
-	/* Create logical partition */
-	rc = label_suggest_ptype(label, lpc_ext4, &ptype);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	memset(&pspec, 0, sizeof(pspec));
-	pspec.index = 0;
-	pspec.block0 = epinfo.block0 + 1;
-	pspec.nblocks = epinfo.nblocks - 1;
-	pspec.hdr_blocks = 1;
-	pspec.pkind = lpk_logical;
-	pspec.ptype = ptype;
-
-	rc = label_part_create(label, &pspec, &lpart);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	label_part_get_info(lpart, &lpinfo);
-	PCUT_ASSERT_INT_EQUALS(5, lpinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_logical, lpinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(epinfo.block0 + 1, lpinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(epinfo.nblocks - 1, lpinfo.nblocks);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Find the extended and the logical partition */
-
-	epart = NULL;
-	lpart = NULL;
-
-	part = label_part_first(label);
-	while (part != NULL) {
-		label_part_get_info(part, &pinfo);
-		if (pinfo.pkind == lpk_extended) {
-			epart = part;
-		} else {
-			PCUT_ASSERT_INT_EQUALS(lpk_logical, pinfo.pkind);
-			lpart = part;
-		}
-
-		part = label_part_next(part);
-	}
-
-	PCUT_ASSERT_NOT_NULL(epart);
-	PCUT_ASSERT_NOT_NULL(lpart);
-
-	/* Destroy the logical partition */
-	rc = label_part_destroy(lpart);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Destroy the extended partition */
-	rc = label_part_destroy(epart);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_TEST(gpt_part)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	label_part_t *part;
-	label_part_spec_t pspec;
-	label_part_info_t pinfo;
-	label_ptype_t ptype;
-	test_bd_t *bd = NULL;
-	errno_t rc;
-
-	rc = test_bd_create(test_block_size, test_nblocks, &bd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	lbd.ops = &label_test_ops;
-	lbd.arg = (void *)bd;
-
-	rc = label_create(&lbd, lt_gpt, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	rc = label_suggest_ptype(label, lpc_ext4, &ptype);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	memset(&pspec, 0, sizeof(pspec));
-	pspec.index = 1;
-	pspec.block0 = linfo.ablock0;
-	pspec.nblocks = linfo.anblocks;
-	pspec.hdr_blocks = 0;
-	pspec.pkind = lpk_primary;
-	pspec.ptype = ptype;
-
-	rc = label_part_create(label, &pspec, &part);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	label_part_get_info(part, &pinfo);
-	PCUT_ASSERT_INT_EQUALS(1, pinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_primary, pinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, pinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, pinfo.nblocks);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = label_get_info(label, &linfo);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(lt_gpt, linfo.ltype);
-	PCUT_ASSERT_INT_EQUALS(lf_can_create_pri | lf_ptype_uuid |
-	    lf_can_delete_part | lf_can_modify_part, linfo.flags);
-
-	part = label_part_first(label);
-	PCUT_ASSERT_NOT_NULL(part);
-	PCUT_ASSERT_NULL(label_part_next(part));
-
-	label_part_get_info(part, &pinfo);
-	PCUT_ASSERT_INT_EQUALS(1, pinfo.index);
-	PCUT_ASSERT_INT_EQUALS(lpk_primary, pinfo.pkind);
-	PCUT_ASSERT_INT_EQUALS(linfo.ablock0, pinfo.block0);
-	PCUT_ASSERT_INT_EQUALS(linfo.anblocks, pinfo.nblocks);
-
-	/* Destroy the partition */
-	rc = label_part_destroy(part);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Close and reopen */
-	label_close(label);
-
-	rc = label_open(&lbd, &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* There should be no partitions */
-	part = label_part_first(label);
-	PCUT_ASSERT_NULL(part);
-
-	label_close(label);
-
-	test_bd_destroy(bd);
-}
-
-PCUT_EXPORT(label);
Index: pace/lib/label/test/main.c
===================================================================
--- uspace/lib/label/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(label);
-
-PCUT_MAIN();
Index: pace/lib/math/_dummy.h
===================================================================
--- uspace/lib/math/_dummy.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-/* Just to prevent tools/export.sh from failing */
Index: pace/lib/math/doc/doxygroups.h
===================================================================
--- uspace/lib/math/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/**
- * @addtogroup libmath libmath
- * @ingroup libs
- */
-
-/**
- * @addtogroup libmathabs32le abs32le
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathamd64 amd64
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmatharm32 arm32
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathia32 ia32
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathia64 ia64
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathmips32 mips32
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathmips32eb mips32eb
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathppc32 ppc32
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathriscv64 riscv64
- * @ingroup libmath
- */
-
-/**
- * @addtogroup libmathsparc64 sparc64
- * @ingroup libmath
- */
Index: pace/lib/math/generic/__fcompare.c
===================================================================
--- uspace/lib/math/generic/__fcompare.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <math.h>
-#include <stdarg.h>
-
-/**
- * Fallback symbol used when code including <math.h> is compiled with something
- * other than GCC or Clang. The function itself must be built with GCC or Clang.
- */
-int __fcompare(size_t sz1, size_t sz2, ...)
-{
-	va_list ap;
-	va_start(ap, sz2);
-
-	long double val1;
-	long double val2;
-
-	switch (sz1) {
-	case 4:
-		val1 = (long double) va_arg(ap, double);
-		break;
-	case 8:
-		val1 = (long double) va_arg(ap, double);
-		break;
-	default:
-		val1 = va_arg(ap, long double);
-		break;
-	}
-
-	switch (sz2) {
-	case 4:
-		val2 = (long double) va_arg(ap, double);
-		break;
-	case 8:
-		val2 = (long double) va_arg(ap, double);
-		break;
-	default:
-		val2 = va_arg(ap, long double);
-		break;
-	}
-
-	va_end(ap);
-
-	if (isgreaterequal(val1, val2)) {
-		if (isgreater(val1, val2))
-			return __FCOMPARE_GREATER;
-		else
-			return __FCOMPARE_EQUAL;
-	} else {
-		if (isless(val1, val2))
-			return __FCOMPARE_LESS;
-		else
-			return 0;
-	}
-}
Index: pace/lib/math/generic/__fpclassify.c
===================================================================
--- uspace/lib/math/generic/__fpclassify.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <math.h>
-#include <stdarg.h>
-
-/**
- * Fallback symbol used when code including <math.h> is compiled with something
- * other than GCC or Clang. The function itself must be built with GCC or Clang.
- */
-int __fpclassify(size_t sz, ...)
-{
-	va_list ap;
-	va_start(ap, sz);
-
-	int result;
-
-	switch (sz) {
-	case 4:
-		result = fpclassify((float) va_arg(ap, double));
-		break;
-	case 8:
-		result = fpclassify(va_arg(ap, double));
-		break;
-	default:
-		result = fpclassify(va_arg(ap, long double));
-		break;
-	}
-
-	va_end(ap);
-	return result;
-}
Index: pace/lib/math/generic/__signbit.c
===================================================================
--- uspace/lib/math/generic/__signbit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <math.h>
-#include <stdarg.h>
-
-/**
- * Fallback symbol used when code including <math.h> is compiled with something
- * other than GCC or Clang. The function itself must be built with GCC or Clang.
- */
-int __signbit(size_t sz, ...)
-{
-	va_list ap;
-	va_start(ap, sz);
-
-	int result;
-
-	switch (sz) {
-	case 4:
-		result = signbit(va_arg(ap, double));
-		break;
-	case 8:
-		result = signbit(va_arg(ap, double));
-		break;
-	default:
-		result = signbit(va_arg(ap, long double));
-		break;
-	}
-
-	va_end(ap);
-	return result;
-}
Index: pace/lib/math/generic/cos.c
===================================================================
--- uspace/lib/math/generic/cos.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include "internal.h"
-
-/** Cosine (32-bit floating point)
- *
- * Compute cosine value.
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value.
- *
- */
-float cosf(float arg)
-{
-	float base_arg = fmodf(arg, 2 * M_PI);
-
-	if (base_arg < 0)
-		return __math_base_cos_32(-base_arg);
-
-	return __math_base_cos_32(base_arg);
-}
-
-/** Cosine (64-bit floating point)
- *
- * Compute cosine value.
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value.
- *
- */
-double cos(double arg)
-{
-	double base_arg = fmod(arg, 2 * M_PI);
-
-	if (base_arg < 0)
-		return __math_base_cos_64(-base_arg);
-
-	return __math_base_cos_64(base_arg);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/fabs.c
===================================================================
--- uspace/lib/math/generic/fabs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-
-float fabsf(float val)
-{
-	return copysignf(val, 1.0f);
-}
-
-double fabs(double val)
-{
-	return copysign(val, 1.0);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/fmod.c
===================================================================
--- uspace/lib/math/generic/fmod.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-
-/** Remainder function (64-bit floating point)
- *
- * Calculate the modulo of dividend by divisor.
- *
- * This is a very basic implementation that uses
- * division and multiplication (instead of exact
- * arithmetics). Thus the result might be very
- * imprecise (depending on the magnitude of the
- * arguments).
- *
- * @param dividend Dividend.
- * @param divisor  Divisor.
- *
- * @return Modulo.
- *
- */
-double fmod(double dividend, double divisor)
-{
-	// FIXME: replace with exact arithmetics
-
-	double quotient = trunc(dividend / divisor);
-
-	return (dividend - quotient * divisor);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/fmodf.c
===================================================================
--- uspace/lib/math/generic/fmodf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-
-/** Remainder function (32-bit floating point)
- *
- * Calculate the modulo of dividend by divisor.
- *
- * This is a very basic implementation that uses
- * division and multiplication (instead of exact
- * arithmetics). Thus the result might be very
- * imprecise (depending on the magnitude of the
- * arguments).
- *
- * @param dividend Dividend.
- * @param divisor  Divisor.
- *
- * @return Modulo.
- *
- */
-float fmodf(float dividend, float divisor)
-{
-	// FIXME: replace with exact arithmetics
-
-	float quotient = truncf(dividend / divisor);
-
-	return (dividend - quotient * divisor);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/internal.h
===================================================================
--- uspace/lib/math/generic/internal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MATH_INTERNAL_H_
-#define MATH_INTERNAL_H_
-
-float __math_base_sin_32(float);
-float __math_base_cos_32(float);
-double __math_base_sin_64(double);
-double __math_base_cos_64(double);
-
-#endif
Index: pace/lib/math/generic/nearbyint.c
===================================================================
--- uspace/lib/math/generic/nearbyint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <math.h>
-#include <fenv.h>
-#include <float.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-static float _roundf_even(float val)
-{
-	assert(!signbit(val));
-
-	/* Get some special cases out of the way first. */
-
-	if (islessequal(val, 0.5f))
-		return 0.0f;
-
-	if (isless(val, 1.5f))
-		return 1.0f;
-
-	if (islessequal(val, 2.5f))
-		return 2.0f;
-
-	const int exp_bias = FLT_MAX_EXP - 1;
-	const int mant_bits = FLT_MANT_DIG - 1;
-	const uint32_t mant_mask = (UINT32_C(1) << mant_bits) - 1;
-
-	union {
-		float f;
-		uint32_t i;
-	} u = { .f = val };
-
-	int exp = (u.i >> mant_bits) - exp_bias;
-	assert(exp > 0);
-
-	/* Mantissa has no fractional places. */
-	if (exp >= mant_bits)
-		return val;
-
-	/* Check whether we are rounding up or down. */
-	uint32_t first = (UINT32_C(1) << (mant_bits - exp));
-	uint32_t midpoint = first >> 1;
-	uint32_t frac = u.i & (mant_mask >> exp);
-
-	bool up;
-	if (frac == midpoint) {
-		up = (u.i & first);
-	} else {
-		up = (frac > midpoint);
-	}
-
-	u.i &= ~(mant_mask >> exp);
-	if (up) {
-		u.i += first;
-	}
-	return copysignf(u.f, val);
-}
-
-static float _round_even(float val)
-{
-	assert(!signbit(val));
-
-	/* Get some special cases out of the way first. */
-
-	if (islessequal(val, 0.5))
-		return 0.0;
-
-	if (isless(val, 1.5))
-		return 1.0;
-
-	if (islessequal(val, 2.5))
-		return 2.0;
-
-	const int exp_bias = DBL_MAX_EXP - 1;
-	const int mant_bits = DBL_MANT_DIG - 1;
-	const uint64_t mant_mask = (UINT64_C(1) << mant_bits) - 1;
-
-	union {
-		double f;
-		uint64_t i;
-	} u = { .f = val };
-
-	int exp = (u.i >> mant_bits) - exp_bias;
-	assert(exp > 0);
-
-	/* Mantissa has no fractional places. */
-	if (exp >= mant_bits)
-		return val;
-
-	/* Check whether we are rounding up or down. */
-	uint64_t first = (UINT64_C(1) << (mant_bits - exp));
-	uint64_t midpoint = first >> 1;
-	uint64_t frac = u.i & (mant_mask >> exp);
-
-	bool up;
-	if (frac == midpoint) {
-		up = (u.i & first);
-	} else {
-		up = (frac > midpoint);
-	}
-
-	u.i &= ~(mant_mask >> exp);
-	if (up) {
-		u.i += first;
-	}
-	return copysignf(u.f, val);
-}
-
-/**
- * Rounds its argument to the nearest integer value in floating-point format,
- * using the current rounding direction and without raising the inexact
- * floating-point exception.
- */
-float nearbyintf(float val)
-{
-	switch (fegetround()) {
-	case FE_DOWNWARD:
-		return floorf(val);
-	case FE_UPWARD:
-		return ceilf(val);
-	case FE_TOWARDZERO:
-		return truncf(val);
-	case FE_TONEAREST:
-		return copysignf(_roundf_even(fabsf(val)), val);
-	}
-
-	assert(false);
-}
-
-/**
- * Rounds its argument to the nearest integer value in floating-point format,
- * using the current rounding direction and without raising the inexact
- * floating-point exception.
- */
-double nearbyint(double val)
-{
-	switch (fegetround()) {
-	case FE_DOWNWARD:
-		return floor(val);
-	case FE_UPWARD:
-		return ceil(val);
-	case FE_TOWARDZERO:
-		return trunc(val);
-	case FE_TONEAREST:
-		return copysign(_round_even(fabs(val)), val);
-	}
-
-	assert(false);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/round.c
===================================================================
--- uspace/lib/math/generic/round.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,99 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include <float.h>
-#include <stdint.h>
-
-/**
- * Rounds its argument to the nearest integer value in floating-point format,
- * rounding halfway cases away from zero, regardless of the current rounding
- * direction.
- */
-float roundf(float val)
-{
-	const int exp_bias = FLT_MAX_EXP - 1;
-	const int mant_bits = FLT_MANT_DIG - 1;
-
-	union {
-		float f;
-		uint32_t i;
-	} u = { .f = fabsf(val) };
-
-	int exp = (u.i >> mant_bits) - exp_bias;
-
-	/* If value is less than 0.5, return zero with appropriate sign. */
-	if (exp < -1)
-		return copysignf(0.0f, val);
-
-	/* If exponent is exactly mant_bits, adding 0.5 could change the result. */
-	if (exp >= mant_bits)
-		return val;
-
-	/* Use trunc with adjusted value to do the rounding. */
-	return copysignf(truncf(u.f + 0.5), val);
-}
-
-/**
- * Rounds its argument to the nearest integer value in floating-point format,
- * rounding halfway cases away from zero, regardless of the current rounding
- * direction.
- */
-double round(double val)
-{
-	const int exp_bias = DBL_MAX_EXP - 1;
-	const int mant_bits = DBL_MANT_DIG - 1;
-
-	union {
-		double f;
-		uint64_t i;
-	} u = { .f = fabs(val) };
-
-	int exp = ((int)(u.i >> mant_bits)) - exp_bias;
-
-	/* If value is less than 0.5, return zero with appropriate sign. */
-	if (exp < -1)
-		return copysign(0.0, val);
-
-	/* If exponent is exactly mant_bits, adding 0.5 could change the result. */
-	if (exp >= mant_bits)
-		return val;
-
-	/* Use trunc with adjusted value to do the rounding. */
-	return copysign(trunc(u.f + 0.5), val);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/sin.c
===================================================================
--- uspace/lib/math/generic/sin.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include "internal.h"
-
-/** Sine (32-bit floating point)
- *
- * Compute sine value.
- *
- * @param arg Sine argument.
- *
- * @return Sine value.
- *
- */
-float sinf(float arg)
-{
-	float base_arg = fmodf(arg, 2 * M_PI);
-
-	if (base_arg < 0)
-		return -__math_base_sin_32(-base_arg);
-
-	return __math_base_sin_32(base_arg);
-}
-
-/** Sine (64-bit floating point)
- *
- * Compute sine value.
- *
- * @param arg Sine argument.
- *
- * @return Sine value.
- *
- */
-double sin(double arg)
-{
-	double base_arg = fmod(arg, 2 * M_PI);
-
-	if (base_arg < 0)
-		return -__math_base_sin_64(-base_arg);
-
-	return __math_base_sin_64(base_arg);
-}
-
-/** @}
- */
Index: pace/lib/math/generic/sincos.c
===================================================================
--- uspace/lib/math/generic/sincos.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include "internal.h"
-
-/**
- * Computes sine and cosine at the same time, which might be more efficient than
- * computing each separately.
- *
- * @param x  Input value.
- * @param s  Output sine value, *s = sinf(x).
- * @param c  Output cosine value, *c = cosf(x).
- */
-void sincosf(float x, float *s, float *c)
-{
-	float base_arg = fmodf(x, 2 * M_PI);
-
-	if (base_arg < 0) {
-		*s = -__math_base_sin_32(-base_arg);
-		*c = __math_base_cos_32(-base_arg);
-	} else {
-		*s = __math_base_sin_32(base_arg);
-		*c = __math_base_cos_32(base_arg);
-	}
-}
-
-/**
- * Computes sine and cosine at the same time, which might be more efficient than
- * computing each separately.
- *
- * @param x  Input value.
- * @param s  Output sine value, *s = sin(x).
- * @param c  Output cosine value, *c = cos(x).
- */
-void sincos(double x, double *s, double *c)
-{
-	double base_arg = fmod(x, 2 * M_PI);
-
-	if (base_arg < 0) {
-		*s = -__math_base_sin_64(-base_arg);
-		*c = __math_base_cos_64(-base_arg);
-	} else {
-		*s = __math_base_sin_64(base_arg);
-		*c = __math_base_cos_64(base_arg);
-	}
-}
-
-/** @}
- */
Index: pace/lib/math/generic/trig.c
===================================================================
--- uspace/lib/math/generic/trig.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include "internal.h"
-
-#define TAYLOR_DEGREE_32 13
-#define TAYLOR_DEGREE_64 21
-
-/** Precomputed values for factorial (starting from 1!) */
-static double factorials[TAYLOR_DEGREE_64] = {
-	1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800,
-	479001600, 6227020800.0L, 87178291200.0L, 1307674368000.0L,
-	20922789888000.0L, 355687428096000.0L, 6402373705728000.0L,
-	121645100408832000.0L, 2432902008176640000.0L, 51090942171709440000.0L
-};
-
-/** Sine approximation by Taylor series (32-bit floating point)
- *
- * Compute the approximation of sine by a Taylor
- * series (using the first TAYLOR_DEGREE terms).
- * The approximation is reasonably accurate for
- * arguments within the interval [-pi/4, pi/4].
- *
- * @param arg Sine argument.
- *
- * @return Sine value approximation.
- *
- */
-static float taylor_sin_32(float arg)
-{
-	float ret = 0;
-	float nom = 1;
-
-	for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) {
-		nom *= arg;
-
-		if ((i % 4) == 0)
-			ret += nom / factorials[i];
-		else if ((i % 4) == 2)
-			ret -= nom / factorials[i];
-	}
-
-	return ret;
-}
-
-/** Sine approximation by Taylor series (64-bit floating point)
- *
- * Compute the approximation of sine by a Taylor
- * series (using the first TAYLOR_DEGREE terms).
- * The approximation is reasonably accurate for
- * arguments within the interval [-pi/4, pi/4].
- *
- * @param arg Sine argument.
- *
- * @return Sine value approximation.
- *
- */
-static double taylor_sin_64(double arg)
-{
-	double ret = 0;
-	double nom = 1;
-
-	for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
-		nom *= arg;
-
-		if ((i % 4) == 0)
-			ret += nom / factorials[i];
-		else if ((i % 4) == 2)
-			ret -= nom / factorials[i];
-	}
-
-	return ret;
-}
-
-/** Cosine approximation by Taylor series (32-bit floating point)
- *
- * Compute the approximation of cosine by a Taylor
- * series (using the first TAYLOR_DEGREE terms).
- * The approximation is reasonably accurate for
- * arguments within the interval [-pi/4, pi/4].
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value approximation.
- *
- */
-static float taylor_cos_32(float arg)
-{
-	float ret = 1;
-	float nom = 1;
-
-	for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) {
-		nom *= arg;
-
-		if ((i % 4) == 1)
-			ret -= nom / factorials[i];
-		else if ((i % 4) == 3)
-			ret += nom / factorials[i];
-	}
-
-	return ret;
-}
-
-/** Cosine approximation by Taylor series (64-bit floating point)
- *
- * Compute the approximation of cosine by a Taylor
- * series (using the first TAYLOR_DEGREE terms).
- * The approximation is reasonably accurate for
- * arguments within the interval [-pi/4, pi/4].
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value approximation.
- *
- */
-static double taylor_cos_64(double arg)
-{
-	double ret = 1;
-	double nom = 1;
-
-	for (unsigned int i = 0; i < TAYLOR_DEGREE_64; i++) {
-		nom *= arg;
-
-		if ((i % 4) == 1)
-			ret -= nom / factorials[i];
-		else if ((i % 4) == 3)
-			ret += nom / factorials[i];
-	}
-
-	return ret;
-}
-
-/** Sine value for values within base period (32-bit floating point)
- *
- * Compute the value of sine for arguments within
- * the base period [0, 2pi]. For arguments outside
- * the base period the returned values can be
- * very inaccurate or even completely wrong.
- *
- * @param arg Sine argument.
- *
- * @return Sine value.
- *
- */
-float __math_base_sin_32(float arg)
-{
-	unsigned int period = arg / (M_PI / 4);
-
-	switch (period) {
-	case 0:
-		return taylor_sin_32(arg);
-	case 1:
-	case 2:
-		return taylor_cos_32(arg - M_PI / 2);
-	case 3:
-	case 4:
-		return -taylor_sin_32(arg - M_PI);
-	case 5:
-	case 6:
-		return -taylor_cos_32(arg - 3 * M_PI / 2);
-	default:
-		return taylor_sin_32(arg - 2 * M_PI);
-	}
-}
-
-/** Sine value for values within base period (64-bit floating point)
- *
- * Compute the value of sine for arguments within
- * the base period [0, 2pi]. For arguments outside
- * the base period the returned values can be
- * very inaccurate or even completely wrong.
- *
- * @param arg Sine argument.
- *
- * @return Sine value.
- *
- */
-double __math_base_sin_64(double arg)
-{
-	unsigned int period = arg / (M_PI / 4);
-
-	switch (period) {
-	case 0:
-		return taylor_sin_64(arg);
-	case 1:
-	case 2:
-		return taylor_cos_64(arg - M_PI / 2);
-	case 3:
-	case 4:
-		return -taylor_sin_64(arg - M_PI);
-	case 5:
-	case 6:
-		return -taylor_cos_64(arg - 3 * M_PI / 2);
-	default:
-		return taylor_sin_64(arg - 2 * M_PI);
-	}
-}
-
-/** Cosine value for values within base period (32-bit floating point)
- *
- * Compute the value of cosine for arguments within
- * the base period [0, 2pi]. For arguments outside
- * the base period the returned values can be
- * very inaccurate or even completely wrong.
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value.
- *
- */
-float __math_base_cos_32(float arg)
-{
-	unsigned int period = arg / (M_PI / 4);
-
-	switch (period) {
-	case 0:
-		return taylor_cos_32(arg);
-	case 1:
-	case 2:
-		return -taylor_sin_32(arg - M_PI / 2);
-	case 3:
-	case 4:
-		return -taylor_cos_32(arg - M_PI);
-	case 5:
-	case 6:
-		return taylor_sin_32(arg - 3 * M_PI / 2);
-	default:
-		return taylor_cos_32(arg - 2 * M_PI);
-	}
-}
-
-/** Cosine value for values within base period (64-bit floating point)
- *
- * Compute the value of cosine for arguments within
- * the base period [0, 2pi]. For arguments outside
- * the base period the returned values can be
- * very inaccurate or even completely wrong.
- *
- * @param arg Cosine argument.
- *
- * @return Cosine value.
- *
- */
-double __math_base_cos_64(double arg)
-{
-	unsigned int period = arg / (M_PI / 4);
-
-	switch (period) {
-	case 0:
-		return taylor_cos_64(arg);
-	case 1:
-	case 2:
-		return -taylor_sin_64(arg - M_PI / 2);
-	case 3:
-	case 4:
-		return -taylor_cos_64(arg - M_PI);
-	case 5:
-	case 6:
-		return taylor_sin_64(arg - 3 * M_PI / 2);
-	default:
-		return taylor_cos_64(arg - 2 * M_PI);
-	}
-}
-
-/** @}
- */
Index: pace/lib/math/generic/trunc.c
===================================================================
--- uspace/lib/math/generic/trunc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * Copyright (c) 2014 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmath
- * @{
- */
-/** @file
- */
-
-#include <math.h>
-#include <float.h>
-#include <stdint.h>
-
-/** Truncate fractional part (round towards zero)
- *
- * Truncate the fractional part of IEEE 754 single
- * precision floating point number by zeroing fraction
- * bits, effectively rounding the number towards zero
- * to the nearest whole number.
- *
- * If the argument is infinity or NaN, an exception
- * should be indicated. This is not implemented yet.
- *
- * @param val Floating point number.
- *
- * @return Number rounded towards zero.
- *
- */
-float truncf(float val)
-{
-	const int exp_bias = FLT_MAX_EXP - 1;
-	const int mant_bits = FLT_MANT_DIG - 1;
-	const uint32_t mant_mask = (UINT32_C(1) << mant_bits) - 1;
-
-	union {
-		float f;
-		uint32_t i;
-	} u = { .f = fabsf(val) };
-
-	int exp = (u.i >> mant_bits) - exp_bias;
-
-	/* If value is less than one, return zero with appropriate sign. */
-	if (exp < 0)
-		return copysignf(0.0f, val);
-
-	if (exp >= mant_bits)
-		return val;
-
-	/* Truncate irrelevant fraction bits */
-	u.i &= ~(mant_mask >> exp);
-	return copysignf(u.f, val);
-}
-
-/** Truncate fractional part (round towards zero)
- *
- * Truncate the fractional part of IEEE 754 double
- * precision floating point number by zeroing fraction
- * bits, effectively rounding the number towards zero
- * to the nearest whole number.
- *
- * If the argument is infinity or NaN, an exception
- * should be indicated. This is not implemented yet.
- *
- * @param val Floating point number.
- *
- * @return Number rounded towards zero.
- *
- */
-double trunc(double val)
-{
-	const int exp_bias = DBL_MAX_EXP - 1;
-	const int mant_bits = DBL_MANT_DIG - 1;
-	const uint64_t mant_mask = (UINT64_C(1) << mant_bits) - 1;
-
-	union {
-		double f;
-		uint64_t i;
-	} u = { .f = fabs(val) };
-
-	int exp = ((int)(u.i >> mant_bits)) - exp_bias;
-
-	/* If value is less than one, return zero with appropriate sign. */
-	if (exp < 0)
-		return copysign(0.0, val);
-
-	if (exp >= mant_bits)
-		return val;
-
-	/* Truncate irrelevant fraction bits */
-	u.i &= ~(mant_mask >> exp);
-	return copysign(u.f, val);
-}
-
-/** @}
- */
Index: pace/lib/math/meson.build
===================================================================
--- uspace/lib/math/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#
-# Copyright (c) 2013 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-allow_shared = true
-
-src = files(
-	'generic/__fcompare.c',
-	'generic/__fpclassify.c',
-	'generic/__signbit.c',
-	'generic/cos.c',
-	'generic/fabs.c',
-	'generic/fmod.c',
-	'generic/fmodf.c',
-	'generic/nearbyint.c',
-	'generic/round.c',
-	'generic/trig.c',
-	'generic/sin.c',
-	'generic/cos.c',
-	'generic/sincos.c',
-	'generic/trunc.c',
-)
-
-test_src = files(
-	'test/rounding.c',
-	'test/main.c',
-)
Index: pace/lib/math/test/main.c
===================================================================
--- uspace/lib/math/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(rounding);
-
-PCUT_MAIN();
Index: pace/lib/math/test/rounding.c
===================================================================
--- uspace/lib/math/test/rounding.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1199 +1,0 @@
-/*
- * Copyright (c) 2018 CZ.NIC, z.s.p.o.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <math.h>
-#include <inttypes.h>
-#include <float.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(rounding);
-
-static inline uint32_t fint(float x)
-{
-	union {
-		float f;
-		uint32_t i;
-	} u = { .f = x };
-	return u.i;
-}
-
-static inline uint64_t dint(double x)
-{
-	union {
-		double f;
-		uint64_t i;
-	} u = { .f = x };
-	return u.i;
-}
-
-#define assert_float_equals(x, y) PCUT_ASSERT_EQUALS(fint(x), fint(y))
-#define assert_double_equals(x, y) PCUT_ASSERT_EQUALS(dint(x), dint(y))
-
-#define FLOAT_CASES 200
-#define DOUBLE_CASES 0
-
-static float float_arguments[FLOAT_CASES] = {
-	HUGE_VALF,
-	-HUGE_VALF,
-	__builtin_nanf(""),
-	-__builtin_nanf(""),
-	__builtin_nanf("0xdeadbe"),
-	-__builtin_nanf("0xdeadbe"),
-
-	0x0.000000p0f,       /* zero */
-	0x0.000002p-126f,    /* smallest denormal > 0 */
-	0x1.000000p-126f,    /* smallest normal > 0 */
-	0x1.fffffep-2f,      /* largest < 0.5 */
-	0x1.000000p-1f,      /* 0.5 */
-	0x1.000002p-1f,      /* smallest > 0.5 */
-	0x1.fffffep-1f,      /* largest < 1 */
-	0x1.000000p0f,       /* 1 */
-	0x1.000002p0f,       /* smallest > 1 */
-	0x1.7ffffep0f,       /* largest < 1.5 */
-	0x1.800000p0f,       /* 1.5 */
-	0x1.800002p0f,       /* smallest > 1.5 */
-	0x1.fffffep0f,       /* largest < 2 */
-	0x1.000000p1f,       /* 2 */
-	0x1.000002p1f,       /* smallest > 2 */
-	0x1.3ffffep1f,       /* largest < 2.5 */
-	0x1.400000p1f,       /* 2.5 */
-	0x1.400002p1f,       /* smallest > 2.5 */
-	0x1.7ffffep1f,       /* largest < 3 */
-	0x1.800000p1f,       /* 3 */
-	0x1.800002p1f,       /* smallest > 3 */
-	0x1.bffffep1f,       /* largest < 3.5 */
-	0x1.c00000p1f,       /* 3.5 */
-	0x1.c00002p1f,       /* smallest > 3.5 */
-	0x1.fffffep1f,       /* largest < 4 */
-	0x1.000000p2f,       /* 4 */
-	0x1.000002p2f,       /* smallest > 4 */
-
-	0x1.ffffe0p20f,      /* 2^21 - 2 */
-	0x1.ffffe2p20f,      /* 2^21 - 1.875 */
-	0x1.ffffe4p20f,      /* 2^21 - 1.75 */
-	0x1.ffffe6p20f,      /* 2^21 - 1.625 */
-	0x1.ffffe8p20f,      /* 2^21 - 1.5 */
-	0x1.ffffeap20f,      /* 2^21 - 1.375 */
-	0x1.ffffecp20f,      /* 2^21 - 1.25 */
-	0x1.ffffeep20f,      /* 2^21 - 1.125 */
-	0x1.fffff0p20f,      /* 2^21 - 1 */
-	0x1.fffff2p20f,      /* 2^21 - 0.875 */
-	0x1.fffff4p20f,      /* 2^21 - 0.75 */
-	0x1.fffff6p20f,      /* 2^21 - 0.625 */
-	0x1.fffff8p20f,      /* 2^21 - 0.5 */
-	0x1.fffffap20f,      /* 2^21 - 0.375 */
-	0x1.fffffcp20f,      /* 2^21 - 0.25 */
-	0x1.fffffep20f,      /* 2^21 - 0.125 */
-	0x1.000000p21f,      /* 2^21 */
-	0x1.000002p21f,      /* 2^21 + 0.25 */
-	0x1.000004p21f,      /* 2^21 + 0.5 */
-	0x1.000006p21f,      /* 2^21 + 0.75 */
-	0x1.000008p21f,      /* 2^21 + 1 */
-	0x1.00000ap21f,      /* 2^21 + 1.25 */
-	0x1.00000cp21f,      /* 2^21 + 1.5 */
-	0x1.00000ep21f,      /* 2^21 + 1.75 */
-	0x1.000010p21f,      /* 2^21 + 2 */
-
-	0x1.fffff0p21f,      /* 2^22 - 2 */
-	0x1.fffff2p21f,      /* 2^22 - 1.75 */
-	0x1.fffff4p21f,      /* 2^22 - 1.5 */
-	0x1.fffff6p21f,      /* 2^22 - 1.25 */
-	0x1.fffff8p21f,      /* 2^22 - 1 */
-	0x1.fffffap21f,      /* 2^22 - 0.75 */
-	0x1.fffffcp21f,      /* 2^22 - 0.5 */
-	0x1.fffffep21f,      /* 2^22 - 0.25 */
-	0x1.000000p22f,      /* 2^22 */
-	0x1.000002p22f,      /* 2^22 + 0.5 */
-	0x1.000004p22f,      /* 2^22 + 1 */
-	0x1.000006p22f,      /* 2^22 + 1.5 */
-	0x1.000008p22f,      /* 2^22 + 2 */
-
-	0x1.fffff0p22f,      /* 2^23 - 4 */
-	0x1.fffff2p22f,      /* 2^23 - 3.5 */
-	0x1.fffff4p22f,      /* 2^23 - 3 */
-	0x1.fffff6p22f,      /* 2^23 - 2.5 */
-	0x1.fffff8p22f,      /* 2^23 - 2 */
-	0x1.fffffap22f,      /* 2^23 - 1.5 */
-	0x1.fffffcp22f,      /* 2^23 - 1 */
-	0x1.fffffep22f,      /* 2^23 - 0.5 */
-	0x1.000000p23f,      /* 2^23 */
-	0x1.000002p23f,      /* 2^23 + 1 */
-	0x1.000004p23f,      /* 2^23 + 2 */
-	0x1.000006p23f,      /* 2^23 + 3 */
-	0x1.000008p23f,      /* 2^23 + 4 */
-
-	0x1.fffff0p23f,      /* 2^24 - 8 */
-	0x1.fffff2p23f,      /* 2^24 - 7 */
-	0x1.fffff4p23f,      /* 2^24 - 6 */
-	0x1.fffff6p23f,      /* 2^24 - 5 */
-	0x1.fffff8p23f,      /* 2^24 - 4 */
-	0x1.fffffap23f,      /* 2^24 - 3 */
-	0x1.fffffcp23f,      /* 2^24 - 2 */
-	0x1.fffffep23f,      /* 2^24 - 1 */
-	0x1.000000p24f,      /* 2^24 */
-	0x1.000002p24f,      /* 2^24 + 2 */
-	0x1.000004p24f,      /* 2^24 + 4 */
-	0x1.000006p24f,      /* 2^24 + 6 */
-	0x1.000008p24f,      /* 2^24 + 8 */
-
-	0x1.fffffep100f,     /* large integer */
-
-	/* Same as above but negative */
-
-	-0x0.000000p0f,       /* zero */
-	-0x0.000002p-126f,    /* smallest denormal > 0 */
-	-0x1.000000p-126f,    /* smallest normal > 0 */
-	-0x1.fffffep-2f,      /* largest < 0.5 */
-	-0x1.000000p-1f,      /* 0.5 */
-	-0x1.000002p-1f,      /* smallest > 0.5 */
-	-0x1.fffffep-1f,      /* largest < 1 */
-	-0x1.000000p0f,       /* 1 */
-	-0x1.000002p0f,       /* smallest > 1 */
-	-0x1.7ffffep0f,       /* largest < 1.5 */
-	-0x1.800000p0f,       /* 1.5 */
-	-0x1.800002p0f,       /* smallest > 1.5 */
-	-0x1.fffffep0f,       /* largest < 2 */
-	-0x1.000000p1f,       /* 2 */
-	-0x1.000002p1f,       /* smallest > 2 */
-	-0x1.3ffffep1f,       /* largest < 2.5 */
-	-0x1.400000p1f,       /* 2.5 */
-	-0x1.400002p1f,       /* smallest > 2.5 */
-	-0x1.7ffffep1f,       /* largest < 3 */
-	-0x1.800000p1f,       /* 3 */
-	-0x1.800002p1f,       /* smallest > 3 */
-	-0x1.bffffep1f,       /* largest < 3.5 */
-	-0x1.c00000p1f,       /* 3.5 */
-	-0x1.c00002p1f,       /* smallest > 3.5 */
-	-0x1.fffffep1f,       /* largest < 4 */
-	-0x1.000000p2f,       /* 4 */
-	-0x1.000002p2f,       /* smallest > 4 */
-
-	-0x1.ffffe0p20f,      /* 2^21 - 2 */
-	-0x1.ffffe2p20f,      /* 2^21 - 1.875 */
-	-0x1.ffffe4p20f,      /* 2^21 - 1.75 */
-	-0x1.ffffe6p20f,      /* 2^21 - 1.625 */
-	-0x1.ffffe8p20f,      /* 2^21 - 1.5 */
-	-0x1.ffffeap20f,      /* 2^21 - 1.375 */
-	-0x1.ffffecp20f,      /* 2^21 - 1.25 */
-	-0x1.ffffeep20f,      /* 2^21 - 1.125 */
-	-0x1.fffff0p20f,      /* 2^21 - 1 */
-	-0x1.fffff2p20f,      /* 2^21 - 0.875 */
-	-0x1.fffff4p20f,      /* 2^21 - 0.75 */
-	-0x1.fffff6p20f,      /* 2^21 - 0.625 */
-	-0x1.fffff8p20f,      /* 2^21 - 0.5 */
-	-0x1.fffffap20f,      /* 2^21 - 0.375 */
-	-0x1.fffffcp20f,      /* 2^21 - 0.25 */
-	-0x1.fffffep20f,      /* 2^21 - 0.125 */
-	-0x1.000000p21f,      /* 2^21 */
-	-0x1.000002p21f,      /* 2^21 + 0.25 */
-	-0x1.000004p21f,      /* 2^21 + 0.5 */
-	-0x1.000006p21f,      /* 2^21 + 0.75 */
-	-0x1.000008p21f,      /* 2^21 + 1 */
-	-0x1.00000ap21f,      /* 2^21 + 1.25 */
-	-0x1.00000cp21f,      /* 2^21 + 1.5 */
-	-0x1.00000ep21f,      /* 2^21 + 1.75 */
-	-0x1.000010p21f,      /* 2^21 + 2 */
-
-	-0x1.fffff0p21f,      /* 2^22 - 2 */
-	-0x1.fffff2p21f,      /* 2^22 - 1.75 */
-	-0x1.fffff4p21f,      /* 2^22 - 1.5 */
-	-0x1.fffff6p21f,      /* 2^22 - 1.25 */
-	-0x1.fffff8p21f,      /* 2^22 - 1 */
-	-0x1.fffffap21f,      /* 2^22 - 0.75 */
-	-0x1.fffffcp21f,      /* 2^22 - 0.5 */
-	-0x1.fffffep21f,      /* 2^22 - 0.25 */
-	-0x1.000000p22f,      /* 2^22 */
-	-0x1.000002p22f,      /* 2^22 + 0.5 */
-	-0x1.000004p22f,      /* 2^22 + 1 */
-	-0x1.000006p22f,      /* 2^22 + 1.5 */
-	-0x1.000008p22f,      /* 2^22 + 2 */
-
-	-0x1.fffff0p22f,      /* 2^23 - 4 */
-	-0x1.fffff2p22f,      /* 2^23 - 3.5 */
-	-0x1.fffff4p22f,      /* 2^23 - 3 */
-	-0x1.fffff6p22f,      /* 2^23 - 2.5 */
-	-0x1.fffff8p22f,      /* 2^23 - 2 */
-	-0x1.fffffap22f,      /* 2^23 - 1.5 */
-	-0x1.fffffcp22f,      /* 2^23 - 1 */
-	-0x1.fffffep22f,      /* 2^23 - 0.5 */
-	-0x1.000000p23f,      /* 2^23 */
-	-0x1.000002p23f,      /* 2^23 + 1 */
-	-0x1.000004p23f,      /* 2^23 + 2 */
-	-0x1.000006p23f,      /* 2^23 + 3 */
-	-0x1.000008p23f,      /* 2^23 + 4 */
-
-	-0x1.fffff0p23f,      /* 2^24 - 8 */
-	-0x1.fffff2p23f,      /* 2^24 - 7 */
-	-0x1.fffff4p23f,      /* 2^24 - 6 */
-	-0x1.fffff6p23f,      /* 2^24 - 5 */
-	-0x1.fffff8p23f,      /* 2^24 - 4 */
-	-0x1.fffffap23f,      /* 2^24 - 3 */
-	-0x1.fffffcp23f,      /* 2^24 - 2 */
-	-0x1.fffffep23f,      /* 2^24 - 1 */
-	-0x1.000000p24f,      /* 2^24 */
-	-0x1.000002p24f,      /* 2^24 + 2 */
-	-0x1.000004p24f,      /* 2^24 + 4 */
-	-0x1.000006p24f,      /* 2^24 + 6 */
-	-0x1.000008p24f,      /* 2^24 + 8 */
-
-	-0x1.fffffep100f,     /* large integer with full mantissa */
-
-	/* a few random numbers */
-	3.5, -2.1, 100.0, 50.0, -1024.0, 0.0, 768.3156, 1080.499999, -600.0, 1.0
-};
-
-static float float_identity[FLOAT_CASES] = {
-	HUGE_VALF,
-	-HUGE_VALF,
-	__builtin_nanf(""),
-	-__builtin_nanf(""),
-	__builtin_nanf("0xdeadbe"),
-	-__builtin_nanf("0xdeadbe"),
-
-	0.0,
-	FLT_TRUE_MIN,    /* smallest denormal > 0 */
-	FLT_MIN,         /* smallest normal > 0 */
-	0.5 - (FLT_EPSILON / 4.),
-	0.5,
-	0.5 + (FLT_EPSILON / 2.),
-	1.0 - (FLT_EPSILON / 2.),
-	1.0,
-	1.0 + FLT_EPSILON,
-	1.5 - FLT_EPSILON,
-	1.5,
-	1.5 + FLT_EPSILON,
-	2.0 - FLT_EPSILON,
-	2.0,
-	2.0 + (2.0 * FLT_EPSILON),
-	2.5 - (2.0 * FLT_EPSILON),
-	2.5,
-	2.5 + (2.0 * FLT_EPSILON),
-	3.0 - (2.0 * FLT_EPSILON),
-	3.0,
-	3.0 + (2.0 * FLT_EPSILON),
-	3.5 - (2.0 * FLT_EPSILON),
-	3.5,
-	3.5 + (2.0 * FLT_EPSILON),
-	4.0 - (2.0 * FLT_EPSILON),
-	4.0,
-	4.0 + (4.0 * FLT_EPSILON),
-
-	2097150.000,     /* 2^21 - 2 */
-	2097150.125,     /* 2^21 - 1.875 */
-	2097150.250,     /* 2^21 - 1.75 */
-	2097150.375,     /* 2^21 - 1.625 */
-	2097150.500,     /* 2^21 - 1.5 */
-	2097150.625,     /* 2^21 - 1.375 */
-	2097150.750,     /* 2^21 - 1.25 */
-	2097150.875,     /* 2^21 - 1.125 */
-	2097151.000,     /* 2^21 - 1 */
-	2097151.125,     /* 2^21 - 0.875 */
-	2097151.250,     /* 2^21 - 0.75 */
-	2097151.375,     /* 2^21 - 0.625 */
-	2097151.500,     /* 2^21 - 0.5 */
-	2097151.625,     /* 2^21 - 0.375 */
-	2097151.750,     /* 2^21 - 0.25 */
-	2097151.875,     /* 2^21 - 0.125 */
-	2097152.00,      /* 2^21 */
-	2097152.25,      /* 2^21 + 0.25 */
-	2097152.50,      /* 2^21 + 0.5 */
-	2097152.75,      /* 2^21 + 0.75 */
-	2097153.00,      /* 2^21 + 1 */
-	2097153.25,      /* 2^21 + 1.25 */
-	2097153.50,      /* 2^21 + 1.5 */
-	2097153.75,      /* 2^21 + 1.75 */
-	2097154.00,      /* 2^21 + 2 */
-
-	4194302.00,      /* 2^22 - 2 */
-	4194302.25,      /* 2^22 - 1.75 */
-	4194302.50,      /* 2^22 - 1.5 */
-	4194302.75,      /* 2^22 - 1.25 */
-	4194303.00,      /* 2^22 - 1 */
-	4194303.25,      /* 2^22 - 0.75 */
-	4194303.50,      /* 2^22 - 0.5 */
-	4194303.75,      /* 2^22 - 0.25 */
-	4194304.0,       /* 2^22 */
-	4194304.5,       /* 2^22 + 0.5 */
-	4194305.0,       /* 2^22 + 1 */
-	4194305.5,       /* 2^22 + 1.5 */
-	4194306.0,       /* 2^22 + 2 */
-
-	8388604.0,      /* 2^23 - 4 */
-	8388604.5,      /* 2^23 - 3.5 */
-	8388605.0,      /* 2^23 - 3 */
-	8388605.5,      /* 2^23 - 2.5 */
-	8388606.0,      /* 2^23 - 2 */
-	8388606.5,      /* 2^23 - 1.5 */
-	8388607.0,      /* 2^23 - 1 */
-	8388607.5,      /* 2^23 - 0.5 */
-	8388608.0,      /* 2^23 */
-	8388609.0,      /* 2^23 + 1 */
-	8388610.0,      /* 2^23 + 2 */
-	8388611.0,      /* 2^23 + 3 */
-	8388612.0,      /* 2^23 + 4 */
-
-	16777208.0,      /* 2^24 - 8 */
-	16777209.0,      /* 2^24 - 7 */
-	16777210.0,      /* 2^24 - 6 */
-	16777211.0,      /* 2^24 - 5 */
-	16777212.0,      /* 2^24 - 4 */
-	16777213.0,      /* 2^24 - 3 */
-	16777214.0,      /* 2^24 - 2 */
-	16777215.0,      /* 2^24 - 1 */
-	16777216.0,      /* 2^24 */
-	16777218.0,      /* 2^24 + 2 */
-	16777220.0,      /* 2^24 + 4 */
-	16777222.0,      /* 2^24 + 6 */
-	16777224.0,      /* 2^24 + 8 */
-
-	0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* Same as above but negative */
-
-	-0.0,
-	-FLT_TRUE_MIN,    /* smallest denormal > 0 */
-	-FLT_MIN,         /* smallest normal > 0 */
-	-(0.5 - (FLT_EPSILON / 4.)),
-	-0.5,
-	-(0.5 + (FLT_EPSILON / 2.)),
-	-(1.0 - (FLT_EPSILON / 2.)),
-	-1.0,
-	-(1.0 + FLT_EPSILON),
-	-(1.5 - FLT_EPSILON),
-	-1.5,
-	-(1.5 + FLT_EPSILON),
-	-(2.0 - FLT_EPSILON),
-	-2.0,
-	-(2.0 + (2.0 * FLT_EPSILON)),
-	-(2.5 - (2.0 * FLT_EPSILON)),
-	-2.5,
-	-(2.5 + (2.0 * FLT_EPSILON)),
-	-(3.0 - (2.0 * FLT_EPSILON)),
-	-3.0,
-	-(3.0 + (2.0 * FLT_EPSILON)),
-	-(3.5 - (2.0 * FLT_EPSILON)),
-	-3.5,
-	-(3.5 + (2.0 * FLT_EPSILON)),
-	-(4.0 - (2.0 * FLT_EPSILON)),
-	-4.0,
-	-(4.0 + (4.0 * FLT_EPSILON)),
-
-	-2097150.000,     /* 2^21 - 2 */
-	-2097150.125,     /* 2^21 - 1.875 */
-	-2097150.250,     /* 2^21 - 1.75 */
-	-2097150.375,     /* 2^21 - 1.625 */
-	-2097150.500,     /* 2^21 - 1.5 */
-	-2097150.625,     /* 2^21 - 1.375 */
-	-2097150.750,     /* 2^21 - 1.25 */
-	-2097150.875,     /* 2^21 - 1.125 */
-	-2097151.000,     /* 2^21 - 1 */
-	-2097151.125,     /* 2^21 - 0.875 */
-	-2097151.250,     /* 2^21 - 0.75 */
-	-2097151.375,     /* 2^21 - 0.625 */
-	-2097151.500,     /* 2^21 - 0.5 */
-	-2097151.625,     /* 2^21 - 0.375 */
-	-2097151.750,     /* 2^21 - 0.25 */
-	-2097151.875,     /* 2^21 - 0.125 */
-	-2097152.00,      /* 2^21 */
-	-2097152.25,      /* 2^21 + 0.25 */
-	-2097152.50,      /* 2^21 + 0.5 */
-	-2097152.75,      /* 2^21 + 0.75 */
-	-2097153.00,      /* 2^21 + 1 */
-	-2097153.25,      /* 2^21 + 1.25 */
-	-2097153.50,      /* 2^21 + 1.5 */
-	-2097153.75,      /* 2^21 + 1.75 */
-	-2097154.00,      /* 2^21 + 2 */
-
-	-4194302.00,      /* 2^22 - 2 */
-	-4194302.25,      /* 2^22 - 1.75 */
-	-4194302.50,      /* 2^22 - 1.5 */
-	-4194302.75,      /* 2^22 - 1.25 */
-	-4194303.00,      /* 2^22 - 1 */
-	-4194303.25,      /* 2^22 - 0.75 */
-	-4194303.50,      /* 2^22 - 0.5 */
-	-4194303.75,      /* 2^22 - 0.25 */
-	-4194304.0,       /* 2^22 */
-	-4194304.5,       /* 2^22 + 0.5 */
-	-4194305.0,       /* 2^22 + 1 */
-	-4194305.5,       /* 2^22 + 1.5 */
-	-4194306.0,       /* 2^22 + 2 */
-
-	-8388604.0,      /* 2^23 - 4 */
-	-8388604.5,      /* 2^23 - 3.5 */
-	-8388605.0,      /* 2^23 - 3 */
-	-8388605.5,      /* 2^23 - 2.5 */
-	-8388606.0,      /* 2^23 - 2 */
-	-8388606.5,      /* 2^23 - 1.5 */
-	-8388607.0,      /* 2^23 - 1 */
-	-8388607.5,      /* 2^23 - 0.5 */
-	-8388608.0,      /* 2^23 */
-	-8388609.0,      /* 2^23 + 1 */
-	-8388610.0,      /* 2^23 + 2 */
-	-8388611.0,      /* 2^23 + 3 */
-	-8388612.0,      /* 2^23 + 4 */
-
-	-16777208.0,      /* 2^24 - 8 */
-	-16777209.0,      /* 2^24 - 7 */
-	-16777210.0,      /* 2^24 - 6 */
-	-16777211.0,      /* 2^24 - 5 */
-	-16777212.0,      /* 2^24 - 4 */
-	-16777213.0,      /* 2^24 - 3 */
-	-16777214.0,      /* 2^24 - 2 */
-	-16777215.0,      /* 2^24 - 1 */
-	-16777216.0,      /* 2^24 */
-	-16777218.0,      /* 2^24 + 2 */
-	-16777220.0,      /* 2^24 + 4 */
-	-16777222.0,      /* 2^24 + 6 */
-	-16777224.0,      /* 2^24 + 8 */
-
-	-0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* a few random numbers */
-	3.5, -2.1, 100.0, 50.0, -1024.0, 0.0, 768.3156, 1080.5, -600.0, 1.0
-};
-
-static float float_results_trunc[FLOAT_CASES] = {
-	HUGE_VALF,
-	-HUGE_VALF,
-	__builtin_nanf(""),
-	-__builtin_nanf(""),
-	__builtin_nanf("0xdeadbe"),
-	-__builtin_nanf("0xdeadbe"),
-
-	0.0,
-	0.0,
-	0.0,
-	0.0,
-	0.0,
-	0.0,
-	0.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	4.0,
-	4.0,
-
-	2097150.000,     /* 2^21 - 2 */
-	2097150.000,     /* 2^21 - 1.875 */
-	2097150.000,     /* 2^21 - 1.75 */
-	2097150.000,     /* 2^21 - 1.625 */
-	2097150.000,     /* 2^21 - 1.5 */
-	2097150.000,     /* 2^21 - 1.375 */
-	2097150.000,     /* 2^21 - 1.25 */
-	2097150.000,     /* 2^21 - 1.125 */
-	2097151.000,     /* 2^21 - 1 */
-	2097151.000,     /* 2^21 - 0.875 */
-	2097151.000,     /* 2^21 - 0.75 */
-	2097151.000,     /* 2^21 - 0.625 */
-	2097151.000,     /* 2^21 - 0.5 */
-	2097151.000,     /* 2^21 - 0.375 */
-	2097151.000,     /* 2^21 - 0.25 */
-	2097151.000,     /* 2^21 - 0.125 */
-	2097152.00,      /* 2^21 */
-	2097152.00,      /* 2^21 + 0.25 */
-	2097152.00,      /* 2^21 + 0.5 */
-	2097152.00,      /* 2^21 + 0.75 */
-	2097153.00,      /* 2^21 + 1 */
-	2097153.00,      /* 2^21 + 1.25 */
-	2097153.00,      /* 2^21 + 1.5 */
-	2097153.00,      /* 2^21 + 1.75 */
-	2097154.00,      /* 2^21 + 2 */
-
-	4194302.00,      /* 2^22 - 2 */
-	4194302.00,      /* 2^22 - 1.75 */
-	4194302.00,      /* 2^22 - 1.5 */
-	4194302.00,      /* 2^22 - 1.25 */
-	4194303.00,      /* 2^22 - 1 */
-	4194303.00,      /* 2^22 - 0.75 */
-	4194303.00,      /* 2^22 - 0.5 */
-	4194303.00,      /* 2^22 - 0.25 */
-	4194304.0,       /* 2^22 */
-	4194304.0,       /* 2^22 + 0.5 */
-	4194305.0,       /* 2^22 + 1 */
-	4194305.0,       /* 2^22 + 1.5 */
-	4194306.0,       /* 2^22 + 2 */
-
-	8388604.0,      /* 2^23 - 4 */
-	8388604.0,      /* 2^23 - 3.5 */
-	8388605.0,      /* 2^23 - 3 */
-	8388605.0,      /* 2^23 - 2.5 */
-	8388606.0,      /* 2^23 - 2 */
-	8388606.0,      /* 2^23 - 1.5 */
-	8388607.0,      /* 2^23 - 1 */
-	8388607.0,      /* 2^23 - 0.5 */
-	8388608.0,      /* 2^23 */
-	8388609.0,      /* 2^23 + 1 */
-	8388610.0,      /* 2^23 + 2 */
-	8388611.0,      /* 2^23 + 3 */
-	8388612.0,      /* 2^23 + 4 */
-
-	16777208.0,      /* 2^24 - 8 */
-	16777209.0,      /* 2^24 - 7 */
-	16777210.0,      /* 2^24 - 6 */
-	16777211.0,      /* 2^24 - 5 */
-	16777212.0,      /* 2^24 - 4 */
-	16777213.0,      /* 2^24 - 3 */
-	16777214.0,      /* 2^24 - 2 */
-	16777215.0,      /* 2^24 - 1 */
-	16777216.0,      /* 2^24 */
-	16777218.0,      /* 2^24 + 2 */
-	16777220.0,      /* 2^24 + 4 */
-	16777222.0,      /* 2^24 + 6 */
-	16777224.0,      /* 2^24 + 8 */
-
-	0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* Same as above but negative */
-
-	-0.0,
-	-0.0,
-	-0.0,
-	-0.0,
-	-0.0,
-	-0.0,
-	-0.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-4.0,
-	-4.0,
-
-	-2097150.000,     /* 2^21 - 2 */
-	-2097150.000,     /* 2^21 - 1.875 */
-	-2097150.000,     /* 2^21 - 1.75 */
-	-2097150.000,     /* 2^21 - 1.625 */
-	-2097150.000,     /* 2^21 - 1.5 */
-	-2097150.000,     /* 2^21 - 1.375 */
-	-2097150.000,     /* 2^21 - 1.25 */
-	-2097150.000,     /* 2^21 - 1.125 */
-	-2097151.000,     /* 2^21 - 1 */
-	-2097151.000,     /* 2^21 - 0.875 */
-	-2097151.000,     /* 2^21 - 0.75 */
-	-2097151.000,     /* 2^21 - 0.625 */
-	-2097151.000,     /* 2^21 - 0.5 */
-	-2097151.000,     /* 2^21 - 0.375 */
-	-2097151.000,     /* 2^21 - 0.25 */
-	-2097151.000,     /* 2^21 - 0.125 */
-	-2097152.00,      /* 2^21 */
-	-2097152.00,      /* 2^21 + 0.25 */
-	-2097152.00,      /* 2^21 + 0.5 */
-	-2097152.00,      /* 2^21 + 0.75 */
-	-2097153.00,      /* 2^21 + 1 */
-	-2097153.00,      /* 2^21 + 1.25 */
-	-2097153.00,      /* 2^21 + 1.5 */
-	-2097153.00,      /* 2^21 + 1.75 */
-	-2097154.00,      /* 2^21 + 2 */
-
-	-4194302.00,      /* 2^22 - 2 */
-	-4194302.00,      /* 2^22 - 1.75 */
-	-4194302.00,      /* 2^22 - 1.5 */
-	-4194302.00,      /* 2^22 - 1.25 */
-	-4194303.00,      /* 2^22 - 1 */
-	-4194303.00,      /* 2^22 - 0.75 */
-	-4194303.00,      /* 2^22 - 0.5 */
-	-4194303.00,      /* 2^22 - 0.25 */
-	-4194304.0,       /* 2^22 */
-	-4194304.0,       /* 2^22 + 0.5 */
-	-4194305.0,       /* 2^22 + 1 */
-	-4194305.0,       /* 2^22 + 1.5 */
-	-4194306.0,       /* 2^22 + 2 */
-
-	-8388604.0,      /* 2^23 - 4 */
-	-8388604.0,      /* 2^23 - 3.5 */
-	-8388605.0,      /* 2^23 - 3 */
-	-8388605.0,      /* 2^23 - 2.5 */
-	-8388606.0,      /* 2^23 - 2 */
-	-8388606.0,      /* 2^23 - 1.5 */
-	-8388607.0,      /* 2^23 - 1 */
-	-8388607.0,      /* 2^23 - 0.5 */
-	-8388608.0,      /* 2^23 */
-	-8388609.0,      /* 2^23 + 1 */
-	-8388610.0,      /* 2^23 + 2 */
-	-8388611.0,      /* 2^23 + 3 */
-	-8388612.0,      /* 2^23 + 4 */
-
-	-16777208.0,      /* 2^24 - 8 */
-	-16777209.0,      /* 2^24 - 7 */
-	-16777210.0,      /* 2^24 - 6 */
-	-16777211.0,      /* 2^24 - 5 */
-	-16777212.0,      /* 2^24 - 4 */
-	-16777213.0,      /* 2^24 - 3 */
-	-16777214.0,      /* 2^24 - 2 */
-	-16777215.0,      /* 2^24 - 1 */
-	-16777216.0,      /* 2^24 */
-	-16777218.0,      /* 2^24 + 2 */
-	-16777220.0,      /* 2^24 + 4 */
-	-16777222.0,      /* 2^24 + 6 */
-	-16777224.0,      /* 2^24 + 8 */
-
-	-0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* a few random numbers */
-	3.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0
-};
-
-static float float_results_round[FLOAT_CASES] = {
-	HUGE_VALF,
-	-HUGE_VALF,
-	__builtin_nanf(""),
-	-__builtin_nanf(""),
-	__builtin_nanf("0xdeadbe"),
-	-__builtin_nanf("0xdeadbe"),
-
-	0.0,
-	0.0,    /* smallest denormal > 0 */
-	0.0,         /* smallest normal > 0 */
-	0.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	4.0,
-	4.0,
-	4.0,
-	4.0,
-	4.0,
-
-	2097150.000,     /* 2^21 - 2 */
-	2097150.000,     /* 2^21 - 1.875 */
-	2097150.000,     /* 2^21 - 1.75 */
-	2097150.000,     /* 2^21 - 1.625 */
-	2097151.000,     /* 2^21 - 1.5 */
-	2097151.000,     /* 2^21 - 1.375 */
-	2097151.000,     /* 2^21 - 1.25 */
-	2097151.000,     /* 2^21 - 1.125 */
-	2097151.000,     /* 2^21 - 1 */
-	2097151.000,     /* 2^21 - 0.875 */
-	2097151.000,     /* 2^21 - 0.75 */
-	2097151.000,     /* 2^21 - 0.625 */
-	2097152.000,     /* 2^21 - 0.5 */
-	2097152.000,     /* 2^21 - 0.375 */
-	2097152.000,     /* 2^21 - 0.25 */
-	2097152.000,     /* 2^21 - 0.125 */
-	2097152.00,      /* 2^21 */
-	2097152.00,      /* 2^21 + 0.25 */
-	2097153.00,      /* 2^21 + 0.5 */
-	2097153.00,      /* 2^21 + 0.75 */
-	2097153.00,      /* 2^21 + 1 */
-	2097153.00,      /* 2^21 + 1.25 */
-	2097154.00,      /* 2^21 + 1.5 */
-	2097154.00,      /* 2^21 + 1.75 */
-	2097154.00,      /* 2^21 + 2 */
-
-	4194302.00,      /* 2^22 - 2 */
-	4194302.00,      /* 2^22 - 1.75 */
-	4194303.00,      /* 2^22 - 1.5 */
-	4194303.00,      /* 2^22 - 1.25 */
-	4194303.00,      /* 2^22 - 1 */
-	4194303.00,      /* 2^22 - 0.75 */
-	4194304.00,      /* 2^22 - 0.5 */
-	4194304.00,      /* 2^22 - 0.25 */
-	4194304.0,       /* 2^22 */
-	4194305.0,       /* 2^22 + 0.5 */
-	4194305.0,       /* 2^22 + 1 */
-	4194306.0,       /* 2^22 + 1.5 */
-	4194306.0,       /* 2^22 + 2 */
-
-	8388604.0,      /* 2^23 - 4 */
-	8388605.0,      /* 2^23 - 3.5 */
-	8388605.0,      /* 2^23 - 3 */
-	8388606.0,      /* 2^23 - 2.5 */
-	8388606.0,      /* 2^23 - 2 */
-	8388607.0,      /* 2^23 - 1.5 */
-	8388607.0,      /* 2^23 - 1 */
-	8388608.0,      /* 2^23 - 0.5 */
-	8388608.0,      /* 2^23 */
-	8388609.0,      /* 2^23 + 1 */
-	8388610.0,      /* 2^23 + 2 */
-	8388611.0,      /* 2^23 + 3 */
-	8388612.0,      /* 2^23 + 4 */
-
-	16777208.0,      /* 2^24 - 8 */
-	16777209.0,      /* 2^24 - 7 */
-	16777210.0,      /* 2^24 - 6 */
-	16777211.0,      /* 2^24 - 5 */
-	16777212.0,      /* 2^24 - 4 */
-	16777213.0,      /* 2^24 - 3 */
-	16777214.0,      /* 2^24 - 2 */
-	16777215.0,      /* 2^24 - 1 */
-	16777216.0,      /* 2^24 */
-	16777218.0,      /* 2^24 + 2 */
-	16777220.0,      /* 2^24 + 4 */
-	16777222.0,      /* 2^24 + 6 */
-	16777224.0,      /* 2^24 + 8 */
-
-	0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* Same as above but negative */
-
-	-0.0,
-	-0.0,    /* smallest denormal > 0 */
-	-0.0,         /* smallest normal > 0 */
-	-0.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-4.0,
-	-4.0,
-	-4.0,
-	-4.0,
-	-4.0,
-
-	-2097150.000,     /* 2^21 - 2 */
-	-2097150.000,     /* 2^21 - 1.875 */
-	-2097150.000,     /* 2^21 - 1.75 */
-	-2097150.000,     /* 2^21 - 1.625 */
-	-2097151.000,     /* 2^21 - 1.5 */
-	-2097151.000,     /* 2^21 - 1.375 */
-	-2097151.000,     /* 2^21 - 1.25 */
-	-2097151.000,     /* 2^21 - 1.125 */
-	-2097151.000,     /* 2^21 - 1 */
-	-2097151.000,     /* 2^21 - 0.875 */
-	-2097151.000,     /* 2^21 - 0.75 */
-	-2097151.000,     /* 2^21 - 0.625 */
-	-2097152.000,     /* 2^21 - 0.5 */
-	-2097152.000,     /* 2^21 - 0.375 */
-	-2097152.000,     /* 2^21 - 0.25 */
-	-2097152.000,     /* 2^21 - 0.125 */
-	-2097152.00,      /* 2^21 */
-	-2097152.00,      /* 2^21 + 0.25 */
-	-2097153.00,      /* 2^21 + 0.5 */
-	-2097153.00,      /* 2^21 + 0.75 */
-	-2097153.00,      /* 2^21 + 1 */
-	-2097153.00,      /* 2^21 + 1.25 */
-	-2097154.00,      /* 2^21 + 1.5 */
-	-2097154.00,      /* 2^21 + 1.75 */
-	-2097154.00,      /* 2^21 + 2 */
-
-	-4194302.00,      /* 2^22 - 2 */
-	-4194302.00,      /* 2^22 - 1.75 */
-	-4194303.00,      /* 2^22 - 1.5 */
-	-4194303.00,      /* 2^22 - 1.25 */
-	-4194303.00,      /* 2^22 - 1 */
-	-4194303.00,      /* 2^22 - 0.75 */
-	-4194304.00,      /* 2^22 - 0.5 */
-	-4194304.00,      /* 2^22 - 0.25 */
-	-4194304.0,       /* 2^22 */
-	-4194305.0,       /* 2^22 + 0.5 */
-	-4194305.0,       /* 2^22 + 1 */
-	-4194306.0,       /* 2^22 + 1.5 */
-	-4194306.0,       /* 2^22 + 2 */
-
-	-8388604.0,      /* 2^23 - 4 */
-	-8388605.0,      /* 2^23 - 3.5 */
-	-8388605.0,      /* 2^23 - 3 */
-	-8388606.0,      /* 2^23 - 2.5 */
-	-8388606.0,      /* 2^23 - 2 */
-	-8388607.0,      /* 2^23 - 1.5 */
-	-8388607.0,      /* 2^23 - 1 */
-	-8388608.0,      /* 2^23 - 0.5 */
-	-8388608.0,      /* 2^23 */
-	-8388609.0,      /* 2^23 + 1 */
-	-8388610.0,      /* 2^23 + 2 */
-	-8388611.0,      /* 2^23 + 3 */
-	-8388612.0,      /* 2^23 + 4 */
-
-	-16777208.0,      /* 2^24 - 8 */
-	-16777209.0,      /* 2^24 - 7 */
-	-16777210.0,      /* 2^24 - 6 */
-	-16777211.0,      /* 2^24 - 5 */
-	-16777212.0,      /* 2^24 - 4 */
-	-16777213.0,      /* 2^24 - 3 */
-	-16777214.0,      /* 2^24 - 2 */
-	-16777215.0,      /* 2^24 - 1 */
-	-16777216.0,      /* 2^24 */
-	-16777218.0,      /* 2^24 + 2 */
-	-16777220.0,      /* 2^24 + 4 */
-	-16777222.0,      /* 2^24 + 6 */
-	-16777224.0,      /* 2^24 + 8 */
-
-	-0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* a few random numbers */
-	4.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1081.0, -600.0, 1.0
-};
-
-static float float_results_nearbyint[FLOAT_CASES] = {
-	HUGE_VALF,
-	-HUGE_VALF,
-	__builtin_nanf(""),
-	-__builtin_nanf(""),
-	__builtin_nanf("0xdeadbe"),
-	-__builtin_nanf("0xdeadbe"),
-
-	0.0,
-	0.0,    /* smallest denormal > 0 */
-	0.0,         /* smallest normal > 0 */
-	0.0,
-	0.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	1.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	2.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	3.0,
-	4.0,
-	4.0,
-	4.0,
-	4.0,
-	4.0,
-
-	2097150.000,     /* 2^21 - 2 */
-	2097150.000,     /* 2^21 - 1.875 */
-	2097150.000,     /* 2^21 - 1.75 */
-	2097150.000,     /* 2^21 - 1.625 */
-	2097150.000,     /* 2^21 - 1.5 */
-	2097151.000,     /* 2^21 - 1.375 */
-	2097151.000,     /* 2^21 - 1.25 */
-	2097151.000,     /* 2^21 - 1.125 */
-	2097151.000,     /* 2^21 - 1 */
-	2097151.000,     /* 2^21 - 0.875 */
-	2097151.000,     /* 2^21 - 0.75 */
-	2097151.000,     /* 2^21 - 0.625 */
-	2097152.000,     /* 2^21 - 0.5 */
-	2097152.000,     /* 2^21 - 0.375 */
-	2097152.000,     /* 2^21 - 0.25 */
-	2097152.000,     /* 2^21 - 0.125 */
-	2097152.00,      /* 2^21 */
-	2097152.00,      /* 2^21 + 0.25 */
-	2097152.00,      /* 2^21 + 0.5 */
-	2097153.00,      /* 2^21 + 0.75 */
-	2097153.00,      /* 2^21 + 1 */
-	2097153.00,      /* 2^21 + 1.25 */
-	2097154.00,      /* 2^21 + 1.5 */
-	2097154.00,      /* 2^21 + 1.75 */
-	2097154.00,      /* 2^21 + 2 */
-
-	4194302.00,      /* 2^22 - 2 */
-	4194302.00,      /* 2^22 - 1.75 */
-	4194302.00,      /* 2^22 - 1.5 */
-	4194303.00,      /* 2^22 - 1.25 */
-	4194303.00,      /* 2^22 - 1 */
-	4194303.00,      /* 2^22 - 0.75 */
-	4194304.00,      /* 2^22 - 0.5 */
-	4194304.0,      /* 2^22 - 0.25 */
-	4194304.0,       /* 2^22 */
-	4194304.0,       /* 2^22 + 0.5 */
-	4194305.0,       /* 2^22 + 1 */
-	4194306.0,       /* 2^22 + 1.5 */
-	4194306.0,       /* 2^22 + 2 */
-
-	8388604.0,      /* 2^23 - 4 */
-	8388604.0,      /* 2^23 - 3.5 */
-	8388605.0,      /* 2^23 - 3 */
-	8388606.0,      /* 2^23 - 2.5 */
-	8388606.0,      /* 2^23 - 2 */
-	8388606.0,      /* 2^23 - 1.5 */
-	8388607.0,      /* 2^23 - 1 */
-	8388608.0,      /* 2^23 - 0.5 */
-	8388608.0,      /* 2^23 */
-	8388609.0,      /* 2^23 + 1 */
-	8388610.0,      /* 2^23 + 2 */
-	8388611.0,      /* 2^23 + 3 */
-	8388612.0,      /* 2^23 + 4 */
-
-	16777208.0,      /* 2^24 - 8 */
-	16777209.0,      /* 2^24 - 7 */
-	16777210.0,      /* 2^24 - 6 */
-	16777211.0,      /* 2^24 - 5 */
-	16777212.0,      /* 2^24 - 4 */
-	16777213.0,      /* 2^24 - 3 */
-	16777214.0,      /* 2^24 - 2 */
-	16777215.0,      /* 2^24 - 1 */
-	16777216.0,      /* 2^24 */
-	16777218.0,      /* 2^24 + 2 */
-	16777220.0,      /* 2^24 + 4 */
-	16777222.0,      /* 2^24 + 6 */
-	16777224.0,      /* 2^24 + 8 */
-
-	0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* Same as above but negative */
-
-	-0.0,
-	-0.0,    /* smallest denormal > 0 */
-	-0.0,         /* smallest normal > 0 */
-	-0.0,
-	-0.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-1.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-2.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-3.0,
-	-4.0,
-	-4.0,
-	-4.0,
-	-4.0,
-	-4.0,
-
-	-2097150.000,     /* 2^21 - 2 */
-	-2097150.000,     /* 2^21 - 1.875 */
-	-2097150.000,     /* 2^21 - 1.75 */
-	-2097150.000,     /* 2^21 - 1.625 */
-	-2097150.000,     /* 2^21 - 1.5 */
-	-2097151.000,     /* 2^21 - 1.375 */
-	-2097151.000,     /* 2^21 - 1.25 */
-	-2097151.000,     /* 2^21 - 1.125 */
-	-2097151.000,     /* 2^21 - 1 */
-	-2097151.000,     /* 2^21 - 0.875 */
-	-2097151.000,     /* 2^21 - 0.75 */
-	-2097151.000,     /* 2^21 - 0.625 */
-	-2097152.000,     /* 2^21 - 0.5 */
-	-2097152.000,     /* 2^21 - 0.375 */
-	-2097152.000,     /* 2^21 - 0.25 */
-	-2097152.000,     /* 2^21 - 0.125 */
-	-2097152.00,      /* 2^21 */
-	-2097152.00,      /* 2^21 + 0.25 */
-	-2097152.00,      /* 2^21 + 0.5 */
-	-2097153.00,      /* 2^21 + 0.75 */
-	-2097153.00,      /* 2^21 + 1 */
-	-2097153.00,      /* 2^21 + 1.25 */
-	-2097154.00,      /* 2^21 + 1.5 */
-	-2097154.00,      /* 2^21 + 1.75 */
-	-2097154.00,      /* 2^21 + 2 */
-
-	-4194302.00,      /* 2^22 - 2 */
-	-4194302.00,      /* 2^22 - 1.75 */
-	-4194302.00,      /* 2^22 - 1.5 */
-	-4194303.00,      /* 2^22 - 1.25 */
-	-4194303.00,      /* 2^22 - 1 */
-	-4194303.00,      /* 2^22 - 0.75 */
-	-4194304.00,      /* 2^22 - 0.5 */
-	-4194304.0,      /* 2^22 - 0.25 */
-	-4194304.0,       /* 2^22 */
-	-4194304.0,       /* 2^22 + 0.5 */
-	-4194305.0,       /* 2^22 + 1 */
-	-4194306.0,       /* 2^22 + 1.5 */
-	-4194306.0,       /* 2^22 + 2 */
-
-	-8388604.0,      /* 2^23 - 4 */
-	-8388604.0,      /* 2^23 - 3.5 */
-	-8388605.0,      /* 2^23 - 3 */
-	-8388606.0,      /* 2^23 - 2.5 */
-	-8388606.0,      /* 2^23 - 2 */
-	-8388606.0,      /* 2^23 - 1.5 */
-	-8388607.0,      /* 2^23 - 1 */
-	-8388608.0,      /* 2^23 - 0.5 */
-	-8388608.0,      /* 2^23 */
-	-8388609.0,      /* 2^23 + 1 */
-	-8388610.0,      /* 2^23 + 2 */
-	-8388611.0,      /* 2^23 + 3 */
-	-8388612.0,      /* 2^23 + 4 */
-
-	-16777208.0,      /* 2^24 - 8 */
-	-16777209.0,      /* 2^24 - 7 */
-	-16777210.0,      /* 2^24 - 6 */
-	-16777211.0,      /* 2^24 - 5 */
-	-16777212.0,      /* 2^24 - 4 */
-	-16777213.0,      /* 2^24 - 3 */
-	-16777214.0,      /* 2^24 - 2 */
-	-16777215.0,      /* 2^24 - 1 */
-	-16777216.0,      /* 2^24 */
-	-16777218.0,      /* 2^24 + 2 */
-	-16777220.0,      /* 2^24 + 4 */
-	-16777222.0,      /* 2^24 + 6 */
-	-16777224.0,      /* 2^24 + 8 */
-
-	-0x1.fffffep100f,   /* large integer with full mantissa */
-
-	/* a few random numbers */
-	4.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0
-};
-
-PCUT_TEST(identity)
-{
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint32_t f1 = fint(float_arguments[i]);
-		uint32_t f2 = fint(float_identity[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%08x != 0x%08x\n", i, f1, f2);
-		}
-	}
-}
-
-PCUT_TEST(truncf)
-{
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint32_t f1 = fint(truncf(float_arguments[i]));
-		uint32_t f2 = fint(float_results_trunc[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%08x != 0x%08x\n", i, f1, f2);
-		}
-	}
-}
-
-PCUT_TEST(trunc)
-{
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint64_t f1 = dint(trunc(float_arguments[i]));
-		uint64_t f2 = dint(float_results_trunc[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%016" PRIx64 " != 0x%016" PRIx64 "\n", i, f1, f2);
-		}
-	}
-
-	// TODO: double test cases
-}
-
-PCUT_TEST(roundf)
-{
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint32_t f1 = fint(roundf(float_arguments[i]));
-		uint32_t f2 = fint(float_results_round[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%08x != 0x%08x\n", i, f1, f2);
-		}
-	}
-}
-
-PCUT_TEST(round)
-{
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint64_t f1 = dint(round(float_arguments[i]));
-		uint64_t f2 = dint(float_results_round[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%016" PRIx64 " != 0x%016" PRIx64 "\n", i, f1, f2);
-		}
-	}
-
-	// TODO: double test cases
-}
-
-PCUT_TEST(nearbyintf)
-{
-	// FIXME: ensure default rounding mode
-
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint32_t f1 = fint(nearbyintf(float_arguments[i]));
-		uint32_t f2 = fint(float_results_nearbyint[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%08x != 0x%08x\n", i, f1, f2);
-		}
-	}
-}
-
-PCUT_TEST(nearbyint)
-{
-	// FIXME: ensure default rounding mode
-
-	for (int i = 0; i < FLOAT_CASES; i++) {
-		uint64_t f1 = dint(nearbyint(float_arguments[i]));
-		uint64_t f2 = dint(float_results_nearbyint[i]);
-		if (f1 != f2) {
-			PCUT_ASSERTION_FAILED("case %d: 0x%016" PRIx64 " != 0x%016" PRIx64 "\n", i, f1, f2);
-		}
-	}
-
-	// TODO: double test cases
-}
-
-PCUT_EXPORT(rounding);
Index: pace/lib/memgfx/doc/doxygroups.h
===================================================================
--- uspace/lib/memgfx/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libmemgfx libmemgfx
- * @ingroup libs
- */
Index: pace/lib/memgfx/include/memgfx/memgc.h
===================================================================
--- uspace/lib/memgfx/include/memgfx/memgc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file GFX memory backend
- */
-
-#ifndef _MEMGFX_MEMGC_H
-#define _MEMGFX_MEMGC_H
-
-#include <errno.h>
-#include <types/gfx/bitmap.h>
-#include <types/gfx/context.h>
-#include <types/gfx/ops/context.h>
-#include <types/memgfx/memgc.h>
-
-extern gfx_context_ops_t mem_gc_ops;
-
-extern errno_t mem_gc_create(gfx_rect_t *, gfx_bitmap_alloc_t *,
-    mem_gc_cb_t *, void *, mem_gc_t **);
-extern errno_t mem_gc_delete(mem_gc_t *);
-extern void mem_gc_retarget(mem_gc_t *, gfx_rect_t *, gfx_bitmap_alloc_t *);
-extern gfx_context_t *mem_gc_get_ctx(mem_gc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/include/memgfx/xlategc.h
===================================================================
--- uspace/lib/memgfx/include/memgfx/xlategc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file Translating graphics context
- */
-
-#ifndef _MEMGFX_XLATEGC_H
-#define _MEMGFX_XLATEGC_H
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <types/memgfx/xlategc.h>
-
-extern gfx_context_ops_t xlate_gc_ops;
-
-extern errno_t xlate_gc_create(gfx_coord2_t *, gfx_context_t *, xlate_gc_t **);
-extern errno_t xlate_gc_delete(xlate_gc_t *);
-extern gfx_context_t *xlate_gc_get_ctx(xlate_gc_t *);
-extern void xlate_gc_set_off(xlate_gc_t *, gfx_coord2_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/include/types/memgfx/memgc.h
===================================================================
--- uspace/lib/memgfx/include/types/memgfx/memgc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file GFX memory backend
- */
-
-#ifndef _MEMGFX_TYPES_MEMGC_H
-#define _MEMGFX_TYPES_MEMGC_H
-
-#include <errno.h>
-#include <stdbool.h>
-#include <types/gfx/coord.h>
-
-struct mem_gc;
-typedef struct mem_gc mem_gc_t;
-
-typedef struct {
-	/** Invalidate rectangle */
-	void (*invalidate)(void *, gfx_rect_t *);
-	/** Update display */
-	void (*update)(void *);
-	/** Get cursor position */
-	errno_t (*cursor_get_pos)(void *, gfx_coord2_t *);
-	/** Set cursor position */
-	errno_t (*cursor_set_pos)(void *, gfx_coord2_t *);
-	/** Set cursor visibility */
-	errno_t (*cursor_set_visible)(void *, bool);
-} mem_gc_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/include/types/memgfx/xlategc.h
===================================================================
--- uspace/lib/memgfx/include/types/memgfx/xlategc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file Translating grapics context
- */
-
-#ifndef _MEMGFX_TYPES_XLATEGC_H
-#define _MEMGFX_TYPES_XLATEGC_H
-
-struct xlate_gc;
-typedef struct xlate_gc xlate_gc_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/meson.build
===================================================================
--- uspace/lib/memgfx/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx' ]
-src = files(
-	'src/memgc.c',
-	'src/xlategc.c'
-)
-
-test_src = files(
-	'test/main.c',
-	'test/memgfx.c',
-	'test/xlategc.c'
-)
Index: pace/lib/memgfx/private/memgc.h
===================================================================
--- uspace/lib/memgfx/private/memgc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file GFX memory backend structure
- *
- */
-
-#ifndef _MEMGFX_PRIVATE_MEMGC_H
-#define _MEMGFX_PRIVATE_MEMGC_H
-
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/pixel.h>
-
-/** Actual structure of memory GC. */
-struct mem_gc {
-	/** Base graphic context */
-	gfx_context_t *gc;
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-	/** Clipping rectangle */
-	gfx_rect_t clip_rect;
-	/** Allocation info */
-	gfx_bitmap_alloc_t alloc;
-	/** Callbacks */
-	mem_gc_cb_t *cb;
-	/** Argument to callbacks */
-	void *cb_arg;
-	/** Current drawing color */
-	pixel_t color;
-};
-
-/** Bitmap in memory GC */
-typedef struct {
-	/** Containing memory GC */
-	struct mem_gc *mgc;
-	/** Allocation info */
-	gfx_bitmap_alloc_t alloc;
-	/** @c true if we allocated the bitmap, @c false if allocated by caller */
-	bool myalloc;
-	/** Rectangle covered by bitmap */
-	gfx_rect_t rect;
-	/** Bitmap flags */
-	gfx_bitmap_flags_t flags;
-	/** Key color */
-	pixel_t key_color;
-} mem_gc_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/private/xlategc.h
===================================================================
--- uspace/lib/memgfx/private/xlategc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file Translating graphics context structure
- *
- */
-
-#ifndef _MEMGFX_PRIVATE_XLATEGC_H
-#define _MEMGFX_PRIVATE_XLATEGC_H
-
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/pixel.h>
-
-/** Actual structure of translating GC. */
-struct xlate_gc {
-	/** Graphic context */
-	gfx_context_t *gc;
-	/** Backing graphic context */
-	gfx_context_t *bgc;
-	/** Translation offset */
-	gfx_coord2_t off;
-};
-
-/** Bitmap in translating GC */
-typedef struct {
-	/** Containing translating GC */
-	struct xlate_gc *xgc;
-	/** Base bitmap in base GC */
-	gfx_bitmap_t *bm;
-} xlate_gc_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/memgfx/src/memgc.c
===================================================================
--- uspace/lib/memgfx/src/memgc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,524 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file GFX memory backend
- *
- * This implements a graphics context over a block of memory (i.e. a simple
- * software renderer).
- */
-
-#include <as.h>
-#include <assert.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <io/pixel.h>
-#include <io/pixelmap.h>
-#include <memgfx/memgc.h>
-#include <stdlib.h>
-#include "../private/memgc.h"
-
-static errno_t mem_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t mem_gc_set_color(void *, gfx_color_t *);
-static errno_t mem_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t mem_gc_update(void *);
-static errno_t mem_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t mem_gc_bitmap_destroy(void *);
-static errno_t mem_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t mem_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-static errno_t mem_gc_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t mem_gc_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t mem_gc_cursor_set_visible(void *, bool);
-static void mem_gc_invalidate_rect(mem_gc_t *, gfx_rect_t *);
-
-gfx_context_ops_t mem_gc_ops = {
-	.set_clip_rect = mem_gc_set_clip_rect,
-	.set_color = mem_gc_set_color,
-	.fill_rect = mem_gc_fill_rect,
-	.update = mem_gc_update,
-	.bitmap_create = mem_gc_bitmap_create,
-	.bitmap_destroy = mem_gc_bitmap_destroy,
-	.bitmap_render = mem_gc_bitmap_render,
-	.bitmap_get_alloc = mem_gc_bitmap_get_alloc,
-	.cursor_get_pos = mem_gc_cursor_get_pos,
-	.cursor_set_pos = mem_gc_cursor_set_pos,
-	.cursor_set_visible = mem_gc_cursor_set_visible
-};
-
-/** Set clipping rectangle on memory GC.
- *
- * @param arg Memory GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-
-	if (rect != NULL)
-		gfx_rect_clip(rect, &mgc->rect, &mgc->clip_rect);
-	else
-		mgc->clip_rect = mgc->rect;
-
-	return EOK;
-}
-
-/** Set color on memory GC.
- *
- * Set drawing color on memory GC.
- *
- * @param arg Memory GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_set_color(void *arg, gfx_color_t *color)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-	uint16_t r, g, b;
-	uint8_t attr;
-
-	gfx_color_get_rgb_i16(color, &r, &g, &b);
-	gfx_color_get_ega(color, &attr);
-	mgc->color = PIXEL(attr, r >> 8, g >> 8, b >> 8);
-	return EOK;
-}
-
-/** Fill rectangle on memory GC.
- *
- * @param arg Memory GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-	gfx_rect_t crect;
-	gfx_coord_t x, y;
-	pixelmap_t pixelmap;
-
-	/* Make sure we have a sorted, clipped rectangle */
-	gfx_rect_clip(rect, &mgc->clip_rect, &crect);
-
-	assert(mgc->rect.p0.x == 0);
-	assert(mgc->rect.p0.y == 0);
-	assert(mgc->alloc.pitch == mgc->rect.p1.x * (int)sizeof(uint32_t));
-	pixelmap.width = mgc->rect.p1.x;
-	pixelmap.height = mgc->rect.p1.y;
-	pixelmap.data = mgc->alloc.pixels;
-
-	for (y = crect.p0.y; y < crect.p1.y; y++) {
-		for (x = crect.p0.x; x < crect.p1.x; x++) {
-			pixelmap_put_pixel(&pixelmap, x, y, mgc->color);
-		}
-	}
-
-	mem_gc_invalidate_rect(mgc, &crect);
-	return EOK;
-}
-
-/** Update memory GC.
- *
- * @param arg Memory GC
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_update(void *arg)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-
-	mgc->cb->update(mgc->cb_arg);
-	return EOK;
-}
-
-/** Create memory GC.
- *
- * Create graphics context for rendering into a block of memory.
- *
- * @param rect Bounding rectangle
- * @param alloc Allocation info
- * @param cb Pointer to memory GC callbacks
- * @param cb_arg Argument to callback functions
- * @param rgc Place to store pointer to new memory GC
- *
- * @return EOK on success or an error code
- */
-errno_t mem_gc_create(gfx_rect_t *rect, gfx_bitmap_alloc_t *alloc,
-    mem_gc_cb_t *cb, void *cb_arg, mem_gc_t **rgc)
-{
-	mem_gc_t *mgc = NULL;
-	gfx_context_t *gc = NULL;
-	errno_t rc;
-
-	mgc = calloc(1, sizeof(mem_gc_t));
-	if (mgc == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = gfx_context_new(&mem_gc_ops, mgc, &gc);
-	if (rc != EOK)
-		goto error;
-
-	mgc->gc = gc;
-	mgc->rect = *rect;
-	mgc->clip_rect = *rect;
-	mgc->alloc = *alloc;
-
-	mgc->cb = cb;
-	mgc->cb_arg = cb_arg;
-
-	*rgc = mgc;
-	return EOK;
-error:
-	if (mgc != NULL)
-		free(mgc);
-	gfx_context_delete(gc);
-	return rc;
-}
-
-/** Delete memory GC.
- *
- * @param mgc Memory GC
- */
-errno_t mem_gc_delete(mem_gc_t *mgc)
-{
-	errno_t rc;
-
-	rc = gfx_context_delete(mgc->gc);
-	if (rc != EOK)
-		return rc;
-
-	free(mgc);
-	return EOK;
-}
-
-/** Retarget memory GC to a different block of memory.
- *
- * @param mgc Memory GC
- * @param rect New bounding rectangle
- * @param alloc Allocation info of the new block
- */
-void mem_gc_retarget(mem_gc_t *mgc, gfx_rect_t *rect,
-    gfx_bitmap_alloc_t *alloc)
-{
-	mgc->rect = *rect;
-	mgc->clip_rect = *rect;
-	mgc->alloc = *alloc;
-}
-
-/** Get generic graphic context from memory GC.
- *
- * @param mgc Memory GC
- * @return Graphic context
- */
-gfx_context_t *mem_gc_get_ctx(mem_gc_t *mgc)
-{
-	return mgc->gc;
-}
-
-static void mem_gc_invalidate_rect(mem_gc_t *mgc, gfx_rect_t *rect)
-{
-	mgc->cb->invalidate(mgc->cb_arg, rect);
-}
-
-/** Create bitmap in memory GC.
- *
- * @param arg Memory GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t mem_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-	mem_gc_bitmap_t *mbm = NULL;
-	gfx_coord2_t dim;
-	errno_t rc;
-
-	/* Check that we support all requested flags */
-	if ((params->flags & ~(bmpf_color_key | bmpf_colorize |
-	    bmpf_direct_output)) != 0)
-		return ENOTSUP;
-
-	mbm = calloc(1, sizeof(mem_gc_bitmap_t));
-	if (mbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	mbm->rect = params->rect;
-	mbm->flags = params->flags;
-	mbm->key_color = params->key_color;
-
-	if ((params->flags & bmpf_direct_output) != 0) {
-		/* Caller cannot specify allocation for direct output */
-		if (alloc != NULL) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		/* Bounding rectangle must be within GC bounding rectangle */
-		if (!gfx_rect_is_inside(&mbm->rect, &mgc->rect)) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		mbm->alloc = mgc->alloc;
-
-		/* Don't free pixel array when destroying bitmap */
-		mbm->myalloc = false;
-	} else if (alloc == NULL) {
-#if 0
-		/*
-		 * TODO: If the bitmap is not required to be sharable,
-		 * we could allocate it with a simple malloc.
-		 * Need to have a bitmap flag specifying that the
-		 * allocation should be sharable. IPC GC could
-		 * automatically add this flag
-		 */
-		mbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		mbm->alloc.off0 = 0;
-		mbm->alloc.pixels = malloc(mbm->alloc.pitch * dim.y);
-		mbm->myalloc = true;
-
-		if (mbm->alloc.pixels == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-#endif
-		mbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		mbm->alloc.off0 = 0;
-		mbm->alloc.pixels = as_area_create(AS_AREA_ANY,
-		    dim.x * dim.y * sizeof(uint32_t), AS_AREA_READ |
-		    AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-		mbm->myalloc = true;
-
-		if (mbm->alloc.pixels == AS_MAP_FAILED) {
-			rc = ENOMEM;
-			goto error;
-		}
-	} else {
-		mbm->alloc = *alloc;
-	}
-
-	mbm->mgc = mgc;
-	*rbm = (void *)mbm;
-	return EOK;
-error:
-	if (mbm != NULL)
-		free(mbm);
-	return rc;
-}
-
-/** Destroy bitmap in memory GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_bitmap_destroy(void *bm)
-{
-	mem_gc_bitmap_t *mbm = (mem_gc_bitmap_t *)bm;
-	if (mbm->myalloc) {
-#if 0
-		/* TODO: if we alloc allocating the bitmap with malloc */
-		free(mbm->alloc.pixels);
-#endif
-		as_area_destroy(mbm->alloc.pixels);
-	}
-
-	free(mbm);
-	return EOK;
-}
-
-/** Render bitmap in memory GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	mem_gc_bitmap_t *mbm = (mem_gc_bitmap_t *)bm;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_rect_t crect;
-	gfx_coord2_t offs;
-	gfx_coord_t x, y;
-	pixelmap_t smap;
-	pixelmap_t dmap;
-	pixel_t pixel;
-
-	if (srect0 != NULL)
-		gfx_rect_clip(srect0, &mbm->rect, &srect);
-	else
-		srect = mbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	/* Destination rectangle */
-	gfx_rect_translate(&offs, &srect, &drect);
-
-	/* Clip destination rectangle */
-	gfx_rect_clip(&drect, &mbm->mgc->clip_rect, &crect);
-
-	assert(mbm->alloc.pitch == (mbm->rect.p1.x - mbm->rect.p0.x) *
-	    (int)sizeof(uint32_t));
-	smap.width = mbm->rect.p1.x - mbm->rect.p0.x;
-	smap.height = mbm->rect.p1.y - mbm->rect.p0.y;
-	smap.data = mbm->alloc.pixels;
-
-	assert(mbm->mgc->rect.p0.x == 0);
-	assert(mbm->mgc->rect.p0.y == 0);
-	assert(mbm->mgc->alloc.pitch == mbm->mgc->rect.p1.x * (int)sizeof(uint32_t));
-	dmap.width = mbm->mgc->rect.p1.x;
-	dmap.height = mbm->mgc->rect.p1.y;
-	dmap.data = mbm->mgc->alloc.pixels;
-
-	if ((mbm->flags & bmpf_direct_output) != 0) {
-		/* Nothing to do */
-	} else if ((mbm->flags & bmpf_color_key) == 0) {
-		/* Simple copy */
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-				pixel = pixelmap_get_pixel(&smap,
-				    x - mbm->rect.p0.x - offs.x,
-				    y - mbm->rect.p0.y - offs.y);
-				pixelmap_put_pixel(&dmap, x, y, pixel);
-			}
-		}
-	} else if ((mbm->flags & bmpf_colorize) == 0) {
-		/* Color key */
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-				pixel = pixelmap_get_pixel(&smap,
-				    x - mbm->rect.p0.x - offs.x,
-				    y - mbm->rect.p0.y - offs.y);
-				if (pixel != mbm->key_color)
-					pixelmap_put_pixel(&dmap, x, y, pixel);
-			}
-		}
-	} else {
-		/* Color key & colorization */
-		for (y = crect.p0.y; y < crect.p1.y; y++) {
-			for (x = crect.p0.x; x < crect.p1.x; x++) {
-				pixel = pixelmap_get_pixel(&smap,
-				    x - mbm->rect.p0.x - offs.x,
-				    y - mbm->rect.p0.y - offs.y);
-				if (pixel != mbm->key_color)
-					pixelmap_put_pixel(&dmap, x, y,
-					    mbm->mgc->color);
-			}
-		}
-	}
-
-	mem_gc_invalidate_rect(mbm->mgc, &crect);
-	return EOK;
-}
-
-/** Get allocation info for bitmap in memory GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	mem_gc_bitmap_t *mbm = (mem_gc_bitmap_t *)bm;
-	*alloc = mbm->alloc;
-	return EOK;
-}
-
-/** Get cursor position on memory GC.
- *
- * @param arg Memory GC
- * @param pos Place to store position
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-
-	if (mgc->cb->cursor_get_pos != NULL)
-		return mgc->cb->cursor_get_pos(mgc->cb_arg, pos);
-	else
-		return ENOTSUP;
-}
-
-/** Set cursor position on memory GC.
- *
- * @param arg Memory GC
- * @param pos New position
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-
-	if (mgc->cb->cursor_set_pos != NULL)
-		return mgc->cb->cursor_set_pos(mgc->cb_arg, pos);
-	else
-		return ENOTSUP;
-}
-
-/** Set cursor visibility on memory GC.
- *
- * @param arg Memory GC
- * @param visible @c true iff cursor should be made visible
- *
- * @return EOK on success or an error code
- */
-static errno_t mem_gc_cursor_set_visible(void *arg, bool visible)
-{
-	mem_gc_t *mgc = (mem_gc_t *) arg;
-
-	if (mgc->cb->cursor_set_visible != NULL)
-		return mgc->cb->cursor_set_visible(mgc->cb_arg, visible);
-	else
-		return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/memgfx/src/xlategc.c
===================================================================
--- uspace/lib/memgfx/src/xlategc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,349 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libmemgfx
- * @{
- */
-/**
- * @file Translating graphics context
- *
- * A graphics context that just forwards all operations to another graphics
- * context with an offset.
- */
-
-#include <assert.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <memgfx/xlategc.h>
-#include <stdlib.h>
-#include "../private/xlategc.h"
-
-static errno_t xlate_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t xlate_gc_set_color(void *, gfx_color_t *);
-static errno_t xlate_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t xlate_gc_update(void *);
-static errno_t xlate_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t xlate_gc_bitmap_destroy(void *);
-static errno_t xlate_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t xlate_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-static errno_t xlate_gc_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t xlate_gc_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t xlate_gc_cursor_set_visible(void *, bool);
-
-gfx_context_ops_t xlate_gc_ops = {
-	.set_clip_rect = xlate_gc_set_clip_rect,
-	.set_color = xlate_gc_set_color,
-	.fill_rect = xlate_gc_fill_rect,
-	.update = xlate_gc_update,
-	.bitmap_create = xlate_gc_bitmap_create,
-	.bitmap_destroy = xlate_gc_bitmap_destroy,
-	.bitmap_render = xlate_gc_bitmap_render,
-	.bitmap_get_alloc = xlate_gc_bitmap_get_alloc,
-	.cursor_get_pos = xlate_gc_cursor_get_pos,
-	.cursor_set_pos = xlate_gc_cursor_set_pos,
-	.cursor_set_visible = xlate_gc_cursor_set_visible
-};
-
-/** Set clipping rectangle on translating GC.
- *
- * @param arg Translating GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-	gfx_rect_t crect;
-
-	if (rect != NULL) {
-		gfx_rect_translate(&xgc->off, rect, &crect);
-		return gfx_set_clip_rect(xgc->bgc, &crect);
-	} else {
-		return gfx_set_clip_rect(xgc->bgc, NULL);
-	}
-}
-
-/** Set color on translating GC.
- *
- * Set drawing color on translating GC.
- *
- * @param arg Translating GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_set_color(void *arg, gfx_color_t *color)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-
-	return gfx_set_color(xgc->bgc, color);
-}
-
-/** Fill rectangle on translating GC.
- *
- * @param arg Translating GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-	gfx_rect_t frect;
-
-	gfx_rect_translate(&xgc->off, rect, &frect);
-	return gfx_fill_rect(xgc->bgc, &frect);
-}
-
-/** Update translating GC.
- *
- * @param arg Translating GC
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_update(void *arg)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-
-	return gfx_update(xgc->bgc);
-}
-
-/** Create translating GC.
- *
- * Create graphics context that renders into another GC with offset.
- *
- * @param off Offset
- * @param bgc Backing GC
- * @param rgc Place to store pointer to new translating GC
- *
- * @return EOK on success or an error code
- */
-errno_t xlate_gc_create(gfx_coord2_t *off, gfx_context_t *bgc,
-    xlate_gc_t **rgc)
-{
-	xlate_gc_t *xgc = NULL;
-	gfx_context_t *gc = NULL;
-	errno_t rc;
-
-	xgc = calloc(1, sizeof(xlate_gc_t));
-	if (xgc == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = gfx_context_new(&xlate_gc_ops, xgc, &gc);
-	if (rc != EOK)
-		goto error;
-
-	xgc->bgc = bgc;
-	xgc->gc = gc;
-	xgc->off = *off;
-
-	*rgc = xgc;
-	return EOK;
-error:
-	if (xgc != NULL)
-		free(xgc);
-	gfx_context_delete(gc);
-	return rc;
-}
-
-/** Delete translating GC.
- *
- * @param xgc Translating GC
- */
-errno_t xlate_gc_delete(xlate_gc_t *xgc)
-{
-	errno_t rc;
-
-	rc = gfx_context_delete(xgc->gc);
-	if (rc != EOK)
-		return rc;
-
-	free(xgc);
-	return EOK;
-}
-
-/** Get generic graphic context from translating GC.
- *
- * @param xgc Translating GC
- * @return Graphic context
- */
-gfx_context_t *xlate_gc_get_ctx(xlate_gc_t *xgc)
-{
-	return xgc->gc;
-}
-
-/** Create bitmap in translating GC.
- *
- * @param arg Translating GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t xlate_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-	xlate_gc_bitmap_t *xbm;
-	gfx_bitmap_t *bm = NULL;
-	errno_t rc;
-
-	xbm = calloc(1, sizeof(xlate_gc_bitmap_t));
-	if (xbm == NULL)
-		return ENOMEM;
-
-	rc = gfx_bitmap_create(xgc->bgc, params, alloc, &bm);
-	if (rc != EOK) {
-		free(xbm);
-		return rc;
-	}
-
-	xbm->xgc = xgc;
-	xbm->bm = bm;
-
-	*rbm = (void *)xbm;
-	return EOK;
-}
-
-/** Destroy bitmap in translating GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_bitmap_destroy(void *bm)
-{
-	xlate_gc_bitmap_t *xbm = (xlate_gc_bitmap_t *)bm;
-	errno_t rc;
-
-	rc = gfx_bitmap_destroy(xbm->bm);
-	free(xbm);
-	return rc;
-}
-
-/** Render bitmap in translating GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	xlate_gc_bitmap_t *xbm = (xlate_gc_bitmap_t *)bm;
-	gfx_coord2_t offs;
-
-	if (offs0 != NULL)
-		gfx_coord2_add(offs0, &xbm->xgc->off, &offs);
-	else
-		offs = xbm->xgc->off;
-
-	return gfx_bitmap_render(xbm->bm, srect0, &offs);
-}
-
-/** Get allocation info for bitmap in translating GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	xlate_gc_bitmap_t *xbm = (xlate_gc_bitmap_t *)bm;
-	return gfx_bitmap_get_alloc(xbm->bm, alloc);
-}
-
-/** Get cursor position on translating GC.
- *
- * @param arg Translating GC
- * @param pos Place to store position
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-	gfx_coord2_t cpos;
-	errno_t rc;
-
-	rc = gfx_cursor_get_pos(xgc->bgc, &cpos);
-	if (rc != EOK)
-		return rc;
-
-	gfx_coord2_subtract(&cpos, &xgc->off, pos);
-	return EOK;
-}
-
-/** Set cursor position on translating GC.
- *
- * @param arg Translating GC
- * @param pos New position
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-	gfx_coord2_t cpos;
-
-	gfx_coord2_add(pos, &xgc->off, &cpos);
-	return gfx_cursor_set_pos(xgc->bgc, &cpos);
-}
-
-/** Set cursor visibility on translating GC.
- *
- * @param arg Translating GC
- * @param visible @c true iff cursor should be made visible
- *
- * @return EOK on success or an error code
- */
-static errno_t xlate_gc_cursor_set_visible(void *arg, bool visible)
-{
-	xlate_gc_t *xgc = (xlate_gc_t *) arg;
-
-	return gfx_cursor_set_visible(xgc->bgc, visible);
-}
-
-/** Set translation offset on translating GC.
- *
- * @param xgc Translating GC
- * @param off Offset
- */
-void xlate_gc_set_off(xlate_gc_t *xgc, gfx_coord2_t *off)
-{
-	xgc->off = *off;
-}
-
-/** @}
- */
Index: pace/lib/memgfx/test/main.c
===================================================================
--- uspace/lib/memgfx/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(memgfx);
-PCUT_IMPORT(xlategc);
-
-PCUT_MAIN();
Index: pace/lib/memgfx/test/memgfx.c
===================================================================
--- uspace/lib/memgfx/test/memgfx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,497 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <io/pixelmap.h>
-#include <mem.h>
-#include <memgfx/memgc.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(memgfx);
-
-static void test_invalidate_rect(void *arg, gfx_rect_t *rect);
-static void test_update(void *arg);
-static errno_t test_cursor_get_pos(void *arg, gfx_coord2_t *);
-static errno_t test_cursor_set_pos(void *arg, gfx_coord2_t *);
-static errno_t test_cursor_set_visible(void *arg, bool);
-
-static mem_gc_cb_t test_mem_gc_cb = {
-	.invalidate = test_invalidate_rect,
-	.update = test_update,
-	.cursor_get_pos = test_cursor_get_pos,
-	.cursor_set_pos = test_cursor_set_pos,
-	.cursor_set_visible = test_cursor_set_visible
-};
-
-typedef struct {
-	/** Return code to return */
-	errno_t rc;
-	/** True if invalidate was called */
-	bool invalidate_called;
-	/** Invalidate rectangle */
-	gfx_rect_t inv_rect;
-	/** True if update was called */
-	bool update_called;
-	/** True if cursor_get_pos was called */
-	bool cursor_get_pos_called;
-	/** Position to return from cursor_get_pos */
-	gfx_coord2_t get_pos_pos;
-	/** True if cursor_set_pos was called */
-	bool cursor_set_pos_called;
-	/** Position passed to cursor_set_pos */
-	gfx_coord2_t set_pos_pos;
-	/** True if cursor_set_visible was called */
-	bool cursor_set_visible_called;
-	/** Value passed to cursor_set_visible */
-	bool set_visible_vis;
-} test_resp_t;
-
-/** Test creating and deleting a memory GC */
-PCUT_TEST(create_delete)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, NULL, NULL, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test filling a rectangle in memory GC */
-PCUT_TEST(fill_rect)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_rect_t frect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_context_t *gc;
-	gfx_color_t *color;
-	gfx_coord2_t pos;
-	pixelmap_t pixelmap;
-	pixel_t pixel;
-	pixel_t expected;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Fill a rectangle */
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	frect.p0.x = 2;
-	frect.p0.y = 2;
-	frect.p1.x = 5;
-	frect.p1.y = 5;
-
-	memset(&resp, 0, sizeof(resp));
-
-	rc = gfx_fill_rect(gc, &frect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pixelmap.width = rect.p1.x - rect.p0.x;
-	pixelmap.height = rect.p1.y - rect.p0.y;
-	pixelmap.data = alloc.pixels;
-
-	/* Check that the pixels of the rectangle are set and no others are */
-	for (pos.y = rect.p0.y; pos.y < rect.p1.y; pos.y++) {
-		for (pos.x = rect.p0.x; pos.x < rect.p1.x; pos.x++) {
-			pixel = pixelmap_get_pixel(&pixelmap, pos.x, pos.y);
-			expected = gfx_pix_inside_rect(&pos, &frect) ?
-			    PIXEL(0, 255, 255, 0) : PIXEL(0, 0, 0, 0);
-			PCUT_ASSERT_INT_EQUALS(expected, pixel);
-		}
-	}
-
-	/* Check that the invalidate rect is equal to the filled rect */
-	PCUT_ASSERT_TRUE(resp.invalidate_called);
-	PCUT_ASSERT_INT_EQUALS(frect.p0.x, resp.inv_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(frect.p0.y, resp.inv_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(frect.p1.x, resp.inv_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(frect.p1.y, resp.inv_rect.p1.y);
-
-	/* TODO: Check clipping once memgc can support pitch != width etc. */
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test rendering a bitmap in memory GC */
-PCUT_TEST(bitmap_render)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_context_t *gc;
-	gfx_coord2_t pos;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t balloc;
-	gfx_bitmap_t *bitmap;
-	pixelmap_t bpmap;
-	pixelmap_t dpmap;
-	pixel_t pixel;
-	pixel_t expected;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Create bitmap */
-
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 6;
-	params.rect.p1.y = 6;
-
-	/* TODO Test client allocation */
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_bitmap_get_alloc(bitmap, &balloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	bpmap.width = params.rect.p1.x - params.rect.p0.x;
-	bpmap.height = params.rect.p1.y - params.rect.p0.y;
-	bpmap.data = balloc.pixels;
-
-	/* Fill bitmap pixels with constant color */
-	for (pos.y = params.rect.p0.y; pos.y < params.rect.p1.y; pos.y++) {
-		for (pos.x =  params.rect.p0.x; pos.x <  params.rect.p1.x; pos.x++) {
-			pixelmap_put_pixel(&bpmap, pos.x, pos.y,
-			    PIXEL(0, 255, 255, 0));
-		}
-	}
-
-	dpmap.width = rect.p1.x - rect.p0.x;
-	dpmap.height = rect.p1.y - rect.p0.y;
-	dpmap.data = alloc.pixels;
-
-	memset(&resp, 0, sizeof(resp));
-
-	/* Render the bitmap */
-	/* TODO Test rendering sub-rectangle */
-	/* TODO Test rendering with offset */
-	rc = gfx_bitmap_render(bitmap, NULL, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check that the pixels of the rectangle are set and no others are */
-	for (pos.y = rect.p0.y; pos.y < rect.p1.y; pos.y++) {
-		for (pos.x = rect.p0.x; pos.x < rect.p1.x; pos.x++) {
-			pixel = pixelmap_get_pixel(&dpmap, pos.x, pos.y);
-			expected = gfx_pix_inside_rect(&pos, &params.rect) ?
-			    PIXEL(0, 255, 255, 0) : PIXEL(0, 0, 0, 0);
-			PCUT_ASSERT_INT_EQUALS(expected, pixel);
-		}
-	}
-
-	/* Check that the invalidate rect is equal to the filled rect */
-	PCUT_ASSERT_TRUE(resp.invalidate_called);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, resp.inv_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, resp.inv_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, resp.inv_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, resp.inv_rect.p1.y);
-
-	/* TODO: Check clipping once memgc can support pitch != width etc. */
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test gfx_update() on a memory GC */
-PCUT_TEST(gfx_update)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_context_t *gc;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	memset(&resp, 0, sizeof(resp));
-	PCUT_ASSERT_FALSE(resp.update_called);
-
-	gfx_update(gc);
-	PCUT_ASSERT_TRUE(resp.update_called);
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test gfx_cursor_get_pos() on a memory GC */
-PCUT_TEST(gfx_cursor_get_pos)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	memset(&resp, 0, sizeof(resp));
-	resp.rc = EOK;
-	resp.get_pos_pos.x = 1;
-	resp.get_pos_pos.y = 2;
-	PCUT_ASSERT_FALSE(resp.cursor_get_pos_called);
-
-	rc = gfx_cursor_get_pos(gc, &pos);
-	PCUT_ASSERT_TRUE(resp.cursor_get_pos_called);
-	PCUT_ASSERT_INT_EQUALS(resp.get_pos_pos.x, pos.x);
-	PCUT_ASSERT_INT_EQUALS(resp.get_pos_pos.y, pos.y);
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test gfx_cursor_set_pos() on a memory GC */
-PCUT_TEST(gfx_cursor_set_pos)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t pos;
-	gfx_context_t *gc;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	memset(&resp, 0, sizeof(resp));
-	resp.rc = EOK;
-	pos.x = 1;
-	pos.y = 2;
-	PCUT_ASSERT_FALSE(resp.cursor_set_pos_called);
-
-	rc = gfx_cursor_set_pos(gc, &pos);
-	PCUT_ASSERT_TRUE(resp.cursor_set_pos_called);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.set_pos_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.set_pos_pos.y);
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Test gfx_cursor_set_visible() on a memory GC */
-PCUT_TEST(gfx_cursor_set_visible)
-{
-	mem_gc_t *mgc;
-	gfx_rect_t rect;
-	gfx_bitmap_alloc_t alloc;
-	gfx_context_t *gc;
-	test_resp_t resp;
-	errno_t rc;
-
-	/* Bounding rectangle for memory GC */
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 10;
-
-	alloc.pitch = (rect.p1.x - rect.p0.x) * sizeof(uint32_t);
-	alloc.off0 = 0;
-	alloc.pixels = calloc(1, alloc.pitch * (rect.p1.y - rect.p0.y));
-	PCUT_ASSERT_NOT_NULL(alloc.pixels);
-
-	rc = mem_gc_create(&rect, &alloc, &test_mem_gc_cb, &resp, &mgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = mem_gc_get_ctx(mgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	memset(&resp, 0, sizeof(resp));
-	resp.rc = EOK;
-	PCUT_ASSERT_FALSE(resp.cursor_set_visible_called);
-
-	rc = gfx_cursor_set_visible(gc, true);
-	PCUT_ASSERT_TRUE(resp.cursor_set_visible_called);
-	PCUT_ASSERT_TRUE(resp.set_visible_vis);
-
-	resp.cursor_set_visible_called = false;
-
-	rc = gfx_cursor_set_visible(gc, false);
-	PCUT_ASSERT_TRUE(resp.cursor_set_visible_called);
-	PCUT_ASSERT_FALSE(resp.set_visible_vis);
-
-	mem_gc_delete(mgc);
-	free(alloc.pixels);
-}
-
-/** Called by memory GC when a rectangle is modified. */
-static void test_invalidate_rect(void *arg, gfx_rect_t *rect)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->invalidate_called = true;
-	resp->inv_rect = *rect;
-}
-
-/** Called by memory GC when update is called. */
-static void test_update(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->update_called = true;
-}
-
-/** Called by memory GC when cursor_get_pos is called. */
-static errno_t test_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->cursor_get_pos_called = true;
-	*pos = resp->get_pos_pos;
-	return resp->rc;
-}
-
-/** Called by memory GC when cursor_set_pos is called. */
-static errno_t test_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->cursor_set_pos_called = true;
-	resp->set_pos_pos = *pos;
-	return resp->rc;
-}
-
-/** Called by memory GC when cursor_set_visible is called. */
-static errno_t test_cursor_set_visible(void *arg, bool visible)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->cursor_set_visible_called = true;
-	resp->set_visible_vis = visible;
-	return resp->rc;
-}
-
-PCUT_EXPORT(memgfx);
Index: pace/lib/memgfx/test/xlategc.c
===================================================================
--- uspace/lib/memgfx/test/xlategc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,916 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <mem.h>
-#include <memgfx/xlategc.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(xlategc);
-
-static errno_t testgc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t testgc_set_color(void *, gfx_color_t *);
-static errno_t testgc_fill_rect(void *, gfx_rect_t *);
-static errno_t testgc_update(void *);
-static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t testgc_bitmap_destroy(void *);
-static errno_t testgc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t testgc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-static errno_t testgc_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t testgc_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t testgc_cursor_set_visible(void *, bool);
-
-static gfx_context_ops_t testgc_ops = {
-	.set_clip_rect = testgc_set_clip_rect,
-	.set_color = testgc_set_color,
-	.fill_rect = testgc_fill_rect,
-	.update = testgc_update,
-	.bitmap_create = testgc_bitmap_create,
-	.bitmap_destroy = testgc_bitmap_destroy,
-	.bitmap_render = testgc_bitmap_render,
-	.bitmap_get_alloc = testgc_bitmap_get_alloc,
-	.cursor_get_pos = testgc_cursor_get_pos,
-	.cursor_set_pos = testgc_cursor_set_pos,
-	.cursor_set_visible = testgc_cursor_set_visible
-};
-
-typedef struct {
-	/** Return code to return */
-	errno_t rc;
-	/** True if set_clip_rect was called */
-	bool set_clip_rect_called;
-	/** Argument to set_clip_rect */
-	gfx_rect_t set_clip_rect_rect;
-	/** True if set_color was called */
-	bool set_color_called;
-	/** Argument to set_color (red) */
-	uint16_t set_color_r;
-	/** Argument to set_color (green) */
-	uint16_t set_color_g;
-	/** Argument to set_color (blue) */
-	uint16_t set_color_b;
-	/** True if fill_rect was called */
-	bool fill_rect_called;
-	/** Argument to fill_rect */
-	gfx_rect_t fill_rect_rect;
-	/** True if bitmap_create was called */
-	bool bitmap_create_called;
-	/** Bitmap parameters passed to bitmap_create */
-	gfx_bitmap_params_t bitmap_create_params;
-	/** Allocation info passed to bitmap_create */
-	gfx_bitmap_alloc_t bitmap_create_alloc;
-	/** Cookie to store in the created bitmap */
-	uint32_t bitmap_create_cookie;
-	/** True if bitmap_destroy was called */
-	bool bitmap_destroy_called;
-	/** Cookie retrieved from bitmap by bitmap_destroy */
-	uint32_t bitmap_destroy_cookie;
-	/** True if bitmap_render was called */
-	bool bitmap_render_called;
-	/** Source rectangle passed to bitmap_render */
-	gfx_rect_t bitmap_render_srect;
-	/** Offset passed to bitmap_render */
-	gfx_coord2_t bitmap_render_off;
-	/** Cookie retrieved from bitmap by bitmap_render */
-	uint32_t bitmap_render_cookie;
-	/** True if bitmap_get_alloc was called */
-	bool bitmap_get_alloc_called;
-	/** Cookie retrieved from bitmap by bitmap_get_alloc */
-	uint32_t bitmap_get_alloc_cookie;
-	/** Allocation info to return from bitmap_get_alloc */
-	gfx_bitmap_alloc_t bitmap_get_alloc_alloc;
-	/** True if update was called */
-	bool update_called;
-	/** True if cursor_get_pos was called */
-	bool cursor_get_pos_called;
-	/** Position to return from cursor_get_pos */
-	gfx_coord2_t cursor_get_pos_pos;
-	/** True if cursor_set_pos was called */
-	bool cursor_set_pos_called;
-	/** Position passed to cursor_set_pos */
-	gfx_coord2_t cursor_set_pos_pos;
-	/** True if cursor_set_visible was called */
-	bool cursor_set_visible_called;
-	/** Value passed to cursor_set_visible */
-	bool cursor_set_visible_vis;
-} test_gc_t;
-
-typedef struct {
-	test_gc_t *gc;
-	/** Cookie passed around for verification */
-	uint32_t cookie;
-} test_gc_bitmap_t;
-
-/** Test creating and deleting a translation GC */
-PCUT_TEST(create_delete)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test setting a clipping rectangle in translation GC */
-PCUT_TEST(set_clip_rect)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	test_gc.rc = EOK;
-	rc = gfx_set_clip_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_gc.set_clip_rect_called);
-	PCUT_ASSERT_INT_EQUALS(11, test_gc.set_clip_rect_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(22, test_gc.set_clip_rect_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(13, test_gc.set_clip_rect_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(24, test_gc.set_clip_rect_rect.p1.y);
-
-	test_gc.rc = EIO;
-	rc = gfx_set_clip_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test setting color in translation GC */
-PCUT_TEST(set_color)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_color_t *color;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	test_gc.rc = EOK;
-	rc = gfx_set_color(xgc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_gc.set_color_called);
-	PCUT_ASSERT_INT_EQUALS(1, test_gc.set_color_r);
-	PCUT_ASSERT_INT_EQUALS(2, test_gc.set_color_g);
-	PCUT_ASSERT_INT_EQUALS(3, test_gc.set_color_b);
-
-	test_gc.rc = EIO;
-	rc = gfx_set_color(xgc, color);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test filling a rectangle in translation GC */
-PCUT_TEST(fill_rect)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	test_gc.rc = EOK;
-	rc = gfx_fill_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_gc.fill_rect_called);
-	PCUT_ASSERT_INT_EQUALS(11, test_gc.fill_rect_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(22, test_gc.fill_rect_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(13, test_gc.fill_rect_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(24, test_gc.fill_rect_rect.p1.y);
-
-	test_gc.rc = EIO;
-	rc = gfx_fill_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test updating a translation GC */
-PCUT_TEST(update)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	test_gc.rc = EOK;
-	rc = gfx_set_clip_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_gc.set_clip_rect_called);
-	PCUT_ASSERT_INT_EQUALS(11, test_gc.set_clip_rect_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(22, test_gc.set_clip_rect_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(13, test_gc.set_clip_rect_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(24, test_gc.set_clip_rect_rect.p1.y);
-
-	test_gc.rc = EIO;
-	rc = gfx_set_clip_rect(xgc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test creating bitmap in translating GC */
-PCUT_TEST(bitmap_create)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t off;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	params.flags = bmpf_direct_output;
-	params.key_color = 0x112233;
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_gc.bitmap_create_called);
-	PCUT_ASSERT_INT_EQUALS(1, test_gc.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, test_gc.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, test_gc.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, test_gc.bitmap_create_params.rect.p1.y);
-
-	test_gc.rc = EOK;
-	gfx_bitmap_destroy(bitmap);
-
-	test_gc.rc = EIO;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test destroying bitmap in translating GC */
-PCUT_TEST(bitmap_destroy)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t off;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-	params.flags = bmpf_direct_output;
-	params.key_color = 0x112233;
-
-	test_gc.rc = EOK;
-	test_gc.bitmap_create_cookie = 0x12345678;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(1, test_gc.bitmap_create_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2, test_gc.bitmap_create_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(3, test_gc.bitmap_create_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, test_gc.bitmap_create_params.rect.p1.y);
-	PCUT_ASSERT_INT_EQUALS(bmpf_direct_output,
-	    test_gc.bitmap_create_params.flags);
-	PCUT_ASSERT_INT_EQUALS(0x112233,
-	    test_gc.bitmap_create_params.key_color);
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.bitmap_destroy_called);
-	PCUT_ASSERT_INT_EQUALS(0x12345678, test_gc.bitmap_destroy_cookie);
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	test_gc.rc = EIO;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test rendering bitmap in translation GC */
-PCUT_TEST(bitmap_render)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t srect;
-	gfx_coord2_t off;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	test_gc.rc = EOK;
-	test_gc.bitmap_create_cookie = 0x12345678;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	srect.p0.x = 5;
-	srect.p0.y = 6;
-	srect.p1.x = 7;
-	srect.p1.y = 8;
-
-	off.x = 100;
-	off.y = 200;
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_render(bitmap, &srect, &off);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.bitmap_render_called);
-	PCUT_ASSERT_INT_EQUALS(0x12345678, test_gc.bitmap_render_cookie);
-	PCUT_ASSERT_INT_EQUALS(5, test_gc.bitmap_render_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(6, test_gc.bitmap_render_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(7, test_gc.bitmap_render_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, test_gc.bitmap_render_srect.p1.y);
-	PCUT_ASSERT_INT_EQUALS(110, test_gc.bitmap_render_off.x);
-	PCUT_ASSERT_INT_EQUALS(220, test_gc.bitmap_render_off.y);
-
-	test_gc.rc = EIO;
-	rc = gfx_bitmap_render(bitmap, &srect, &off);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test getting bitmap allocation info in translation GC */
-PCUT_TEST(bitmap_get_alloc)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_alloc_t galloc;
-	gfx_coord2_t off;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	test_gc.rc = EOK;
-	test_gc.bitmap_create_cookie = 0x12345678;
-	rc = gfx_bitmap_create(xgc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	test_gc.bitmap_get_alloc_alloc.pitch = 42;
-	test_gc.bitmap_get_alloc_alloc.off0 = 43;
-	test_gc.bitmap_get_alloc_alloc.pixels = malloc(1);
-	PCUT_ASSERT_NOT_NULL(test_gc.bitmap_get_alloc_alloc.pixels);
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_get_alloc(bitmap, &galloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.bitmap_get_alloc_called);
-	PCUT_ASSERT_INT_EQUALS(42, galloc.pitch);
-	PCUT_ASSERT_INT_EQUALS(43, galloc.off0);
-	PCUT_ASSERT_EQUALS(test_gc.bitmap_get_alloc_alloc.pixels, galloc.pixels);
-
-	test_gc.rc = EIO;
-	rc = gfx_bitmap_get_alloc(bitmap, &galloc);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-
-	test_gc.rc = EOK;
-	rc = gfx_bitmap_destroy(bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	free(test_gc.bitmap_get_alloc_alloc.pixels);
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test getting cursor position in translation GC */
-PCUT_TEST(cursor_get_pos)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_coord2_t off;
-	gfx_coord2_t gpos;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	test_gc.cursor_get_pos_pos.x = 13;
-	test_gc.cursor_get_pos_pos.y = 24;
-	test_gc.rc = EOK;
-	rc = gfx_cursor_get_pos(xgc, &gpos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.cursor_get_pos_called);
-
-	/*
-	 * Note that translation GC performs inverse translation when getting
-	 * cursor coordinates.
-	 */
-	PCUT_ASSERT_INT_EQUALS(3, gpos.x);
-	PCUT_ASSERT_INT_EQUALS(4, gpos.y);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test setting cursor position in translation GC */
-PCUT_TEST(cursor_set_pos)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_coord2_t off;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	pos.x = 3;
-	pos.y = 4;
-
-	test_gc.rc = EOK;
-	rc = gfx_cursor_set_pos(xgc, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.cursor_set_pos_called);
-	PCUT_ASSERT_INT_EQUALS(13, test_gc.cursor_set_pos_pos.x);
-	PCUT_ASSERT_INT_EQUALS(24, test_gc.cursor_set_pos_pos.y);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Test setting cursor visibility in translation GC */
-PCUT_TEST(cursor_set_visible)
-{
-	test_gc_t test_gc;
-	gfx_context_t *tgc;
-	xlate_gc_t *xlategc;
-	gfx_context_t *xgc;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	rc = gfx_context_new(&testgc_ops, &test_gc, &tgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	off.x = 10;
-	off.y = 20;
-	rc = xlate_gc_create(&off, tgc, &xlategc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	xgc = xlate_gc_get_ctx(xlategc);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	test_gc.rc = EOK;
-	rc = gfx_cursor_set_visible(xgc, true);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.cursor_set_visible_called);
-	PCUT_ASSERT_TRUE(test_gc.cursor_set_visible_vis);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	test_gc.rc = EOK;
-	rc = gfx_cursor_set_visible(xgc, false);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(test_gc.cursor_set_visible_called);
-	PCUT_ASSERT_FALSE(test_gc.cursor_set_visible_vis);
-
-	memset(&test_gc, 0, sizeof(test_gc));
-
-	test_gc.rc = EIO;
-	rc = gfx_cursor_set_visible(xgc, false);
-	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
-	PCUT_ASSERT_TRUE(test_gc.cursor_set_visible_called);
-	PCUT_ASSERT_FALSE(test_gc.cursor_set_visible_vis);
-
-	xlate_gc_delete(xlategc);
-	gfx_context_delete(tgc);
-}
-
-/** Set clipping rectangle in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param rect Rectangle
- * @return EOK on success or an error code
- */
-static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->set_clip_rect_called = true;
-	test_gc->set_clip_rect_rect = *rect;
-
-	return test_gc->rc;
-}
-
-/** Set drawing color in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param color Color
- * @return EOK on success or an error code
- */
-static errno_t testgc_set_color(void *arg, gfx_color_t *color)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->set_color_called = true;
-	gfx_color_get_rgb_i16(color, &test_gc->set_color_r,
-	    &test_gc->set_color_g, &test_gc->set_color_b);
-
-	return test_gc->rc;
-}
-
-/** Fill rectangle in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param rect Rectangle
- * @return EOK on success or an error code
- */
-static errno_t testgc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->fill_rect_called = true;
-	test_gc->fill_rect_rect = *rect;
-
-	return test_gc->rc;
-}
-
-/** Update test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @return EOK on success or an error code
- */
-static errno_t testgc_update(void *arg)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->update_called = true;
-	return test_gc->rc;
-}
-
-/** Create bitmap in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param params Bitmap parameters
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbitmap Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbitmap)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-	test_gc_bitmap_t *tbitmap;
-
-	test_gc->bitmap_create_called = true;
-	if (params != NULL)
-		test_gc->bitmap_create_params = *params;
-	if (alloc != NULL)
-		test_gc->bitmap_create_alloc = *alloc;
-
-	if (test_gc->rc != EOK)
-		return test_gc->rc;
-
-	tbitmap = calloc(1, sizeof(test_gc_bitmap_t));
-	if (tbitmap == NULL)
-		return ENOMEM;
-
-	tbitmap->gc = test_gc;
-	tbitmap->cookie = test_gc->bitmap_create_cookie;
-	*rbitmap = (void *)tbitmap;
-	return EOK;
-}
-
-/** Destroy bitmap in test GC.
- *
- * @param bitmap Bitmap
- * @return EOK on success or an error code
- */
-static errno_t testgc_bitmap_destroy(void *bitmap)
-{
-	test_gc_bitmap_t *tbitmap = (test_gc_bitmap_t *)bitmap;
-	test_gc_t *test_gc = tbitmap->gc;
-
-	test_gc->bitmap_destroy_called = true;
-	test_gc->bitmap_destroy_cookie = tbitmap->cookie;
-	return test_gc->rc;
-}
-
-/** Render bitmap in test GC.
- *
- * @param arg Bitmap
- * @param srect Source rectangle (or @c NULL)
- * @param off Offset (or @c NULL)
- * @return EOK on success or an error code
- */
-static errno_t testgc_bitmap_render(void *bitmap, gfx_rect_t *srect,
-    gfx_coord2_t *off)
-{
-	test_gc_bitmap_t *tbitmap = (test_gc_bitmap_t *)bitmap;
-	test_gc_t *test_gc = tbitmap->gc;
-
-	test_gc->bitmap_render_called = true;
-	test_gc->bitmap_render_cookie = tbitmap->cookie;
-	if (srect != NULL)
-		test_gc->bitmap_render_srect = *srect;
-	if (off != NULL)
-		test_gc->bitmap_render_off = *off;
-	return test_gc->rc;
-}
-
-/** Get bitmap allocation info in test GC.
- *
- * @param bitmap Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t testgc_bitmap_get_alloc(void *bitmap, gfx_bitmap_alloc_t *alloc)
-{
-	test_gc_bitmap_t *tbitmap = (test_gc_bitmap_t *)bitmap;
-	test_gc_t *test_gc = tbitmap->gc;
-
-	test_gc->bitmap_get_alloc_called = true;
-	test_gc->bitmap_get_alloc_cookie = tbitmap->cookie;
-
-	if (test_gc->rc != EOK)
-		return test_gc->rc;
-
-	*alloc = test_gc->bitmap_get_alloc_alloc;
-	return EOK;
-}
-
-/** Get cursor position in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param pos Place to store cursor position
- * @return EOK on success or an error code
- */
-static errno_t testgc_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->cursor_get_pos_called = true;
-
-	if (test_gc->rc != EOK)
-		return test_gc->rc;
-
-	*pos = test_gc->cursor_get_pos_pos;
-	return EOK;
-}
-
-/** Set cursor position in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param pos Cursor position
- * @return EOK on success or an error code
- */
-static errno_t testgc_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->cursor_set_pos_called = true;
-	test_gc->cursor_set_pos_pos = *pos;
-
-	return test_gc->rc;
-}
-
-/** Set cursor visibility in test GC.
- *
- * @param arg Argument (test_gc_t *)
- * @param visible @c true iff cursor should be visible
- * @return EOK on success or an error code
- */
-static errno_t testgc_cursor_set_visible(void *arg, bool visible)
-{
-	test_gc_t *test_gc = (test_gc_t *)arg;
-
-	test_gc->cursor_set_visible_called = true;
-	test_gc->cursor_set_visible_vis = visible;
-
-	return test_gc->rc;
-}
-
-PCUT_EXPORT(xlategc);
Index: pace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,411 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-always_static = not CONFIG_BUILD_SHARED_LIBS
-
-# Which libraries are installed when CONFIG_DEVEL_FILES is enabled
-installed_libs = [
-	'c',
-	'math',
-	'console',
-	'display',
-	'input',
-	'output',
-	'pixconv',
-	'posix',
-	'clui',
-	'pcm',
-	'hound',
-	'gfx',
-	'gfximage',
-	'ipcgfx',
-	'congfx',
-	'display',
-	'ui',
-]
-
-# IMPORTANT: Dependencies must be listed before libs that depend on them.
-libs = [
-	'c',
-
-	'inet',
-
-	'input',
-	'output',
-	'console',
-	'device',
-
-	'block',
-	'clipboard',
-	'clui',
-	'codepage',
-	'compress',
-	'corecfg',
-	'cpp',
-	'crypto',
-	'dltest',
-	'fbfont',
-	'fdisk',
-	'fmtutil',
-	'fs',
-	'futil',
-	'gfx',
-	'http',
-	'ipctest',
-	'label',
-	'math',
-	'minix',
-	'nettl',
-	'ofw',
-	'pcm',
-	'pcut',
-	'pixconv',
-	'posix',
-	'riff',
-	'scsi',
-	'sif',
-	'system',
-	'tbarcfg',
-	'termui',
-	'trackmod',
-	'untar',
-	'uri',
-
-	'bithenge',
-	'congfx',
-	'drv',
-	'ext4',
-	'gfxfont',
-	'gfximage',
-	'hound',
-	'ipcgfx',
-	'memgfx',
-	'nic',
-	'usb',
-	'usbdev',
-	'usbhid',
-	'usbhost',
-	'usbvirt',
-	'virtio',
-
-	'ata',
-	'ieee80211',
-	'ddev',
-	'dispcfg',
-	'display',
-	'wndmgt',
-
-	'ui',
-	'vt',
-]
-
-# Generated list of include directory paths
-include_paths = []
-
-# Generated list of test sources
-testfiles = []
-
-# Text of the install script.
-uspace_lib_devel_install_script_text = []
-
-foreach l : libs
-	# Variables that might be defined in library meson files:
-
-	# List of source files.
-	# To set it correctly, use files('list.c', 'of.c', 'files.c')
-	# Often this is the only variable that needs to be set.
-	src = files()
-
-	# Public include directories. These are used by everyone who depends
-	# on this library.
-	# Use include_directories('include_dir1', 'include_dir2') to set this.
-	# If the variable is omitted, it defaults to 'include' subdirectory
-	# if it exists, or the source directory otherwise.
-	# If the library has no headers, you can use
-	# includes += include_directories()
-	includes = []
-
-	# Private include directories.
-	# Unnecessary if you always include private headers using relative
-	# paths, but may be useful if you need to override system headers.
-	private_includes = []
-
-	# List of dependency names.
-	# E.g. to use libnic and libuntar use
-	# `deps = [ 'nic', 'untar' ]`
-	deps = []
-
-	# Extra arguments for the C compiler.
-	# Don't use for arguments involving file paths.
-	c_args = []
-
-	# Shared object version of the library.
-	version = '0.0'
-
-	# Sources of unit tests.
-	# Automatically get compiled into a test binary,
-	# but not into the library itself.
-	test_src = []
-
-	# Language of the library.
-	# Currently supported options are 'c' and 'cpp', with 'c' being default.
-	language = 'c'
-
-	# Whether the library can be dynamically linked.
-	# Eventually, all libraries will be shared by default and this will go away.
-	allow_shared = false
-
-	subdir(l)
-
-	# Add `include` or `.` subdirectory to include dirs if needed.
-	if includes.length() == 0
-		incdir = join_paths(l, 'include')
-		if run_command('[', '-d', incdir, ']').returncode() == 0
-			includes += include_directories(incdir)
-			_sdir = meson.current_source_dir() / l / 'include'
-
-			if installed_libs.contains(l)
-				uspace_lib_devel_install_script_text += 'cp -R -L -T "@0@" "${DESTDIR}include/lib@1@"'.format(_sdir, l)
-			endif
-
-			exported_devel_files += ['include', _sdir, 'lib' + l]
-		else
-			includes += include_directories(l)
-
-			if installed_libs.contains(l)
-				_sdir = meson.current_source_dir() / l
-				uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/lib@0@"'.format(l)
-				uspace_lib_devel_install_script_text += 'cp -L -t "${DESTDIR}include/lib@0@" "@1@"/*.h || true'.format(l, _sdir)
-			endif
-		endif
-	endif
-
-	# Pretty much everything depends on libc.
-	if l != 'c'
-		deps += 'c'
-	endif
-
-	if language == 'cpp' and l != 'cpp'
-		deps += 'cpp'
-	endif
-
-	mapfile = meson.current_build_dir() / 'lib' + l + '.map'
-
-	link_args = [ '-Wl,--no-undefined,--no-allow-shlib-undefined' ]
-	# We want linker to generate link map for debugging.
-	link_args += [ '-Wl,-Map,' + mapfile ]
-
-	# Convert strings to dependency objects
-	# TODO: this dependency business is way too convoluted due to issues in current Meson
-	_any_deps = []
-	_static_deps = []
-	_shared_deps = []
-	_include_deps = []
-	foreach s : deps
-		_any_deps += get_variable('lib' + s).get('any')
-		_static_deps += get_variable('lib' + s).get('static')
-		if not always_static
-			_shared_deps += get_variable('lib' + s).get('shared')
-		endif
-		_include_deps += get_variable('lib' + s).get('include')
-	endforeach
-
-	install_static_lib = CONFIG_DEVEL_FILES and installed_libs.contains(l)
-	install_shared_lib = allow_shared
-
-	_shared_dep = disabler()
-
-	if src.length() > 0
-		if not always_static
-			_libname = 'lib' + l + '.so.' + version.split('.')[0]
-
-			_shared_lib = shared_library(l, src,
-				# TODO: Include private headers using #include "quoted",
-				#       and get rid of private_includes.
-				include_directories: [ private_includes, includes ],
-				dependencies: _shared_deps,
-				c_args: arch_uspace_c_args + c_args,
-				cpp_args: arch_uspace_c_args + c_args,
-				link_args: arch_uspace_c_args + arch_uspace_link_args + link_args,
-				version: version,
-				build_by_default: true,
-			)
-
-			if install_shared_lib
-				install_files += [[ 'lib', _shared_lib.full_path(), _libname ]]
-				install_deps += [ _shared_lib ]
-			endif
-
-			if install_shared_lib and install_debug_files
-				install_files += [[ 'debug/lib', mapfile, _libname + '.map' ]]
-			endif
-
-			if disassemble
-				_disasm = custom_target('lib' + l + '.disasm',
-					command: [ objdump, '-S', '@INPUT@' ],
-					input: _shared_lib,
-					output: 'lib' + l + '.disasm',
-					capture: true,
-					build_by_default: true,
-				)
-
-				if install_shared_lib and install_debug_files
-					install_files += [[ 'debug/lib', _disasm.full_path(), _libname + '.disasm' ]]
-					install_deps += [ _disasm ]
-				endif
-			endif
-
-			_shared_dep = declare_dependency(
-				link_with: _shared_lib,
-				# TODO: Always use `include` subdirectory for public headers,
-				#       and ditch the variable.
-				include_directories: includes,
-				dependencies: _shared_deps,
-			)
-		endif
-
-		_static_lib = static_library(l, src,
-			# TODO: Include private headers using #include "quoted",
-			#       and get rid of private_includes.
-			include_directories: [ private_includes, includes ],
-			dependencies: _include_deps,
-			c_args: arch_uspace_c_args + c_args,
-			cpp_args: arch_uspace_c_args + c_args,
-		)
-
-		if install_static_lib
-			install_files += [[ 'lib', _static_lib.full_path(), 'lib' + l + '.a' ]]
-			install_deps += [ _static_lib ]
-		endif
-
-		exported_devel_files += ['staticlib', _static_lib, 'lib' + l + '.a']
-
-		_static_dep = declare_dependency(
-			link_with: _static_lib,
-			# TODO: Always use `include` subdirectory for public headers,
-			#       and ditch the variable.
-			include_directories: includes,
-			dependencies: _static_deps,
-		)
-
-		if always_static or not allow_shared
-			_any_dep = declare_dependency(
-				link_with: _static_lib,
-				# TODO: Always use `include` subdirectory for public headers,
-				#       and ditch the variable.
-				include_directories: includes,
-				dependencies: _any_deps,
-			)
-		else
-			_any_dep = declare_dependency(
-				link_with: _shared_lib,
-				# TODO: Always use `include` subdirectory for public headers,
-				#       and ditch the variable.
-				include_directories: includes,
-				dependencies: _any_deps,
-			)
-		endif
-
-		_include_dep = declare_dependency(
-			# TODO: Always use `include` subdirectory for public headers,
-			#       and ditch the variable.
-			include_directories: includes,
-			dependencies: _include_deps,
-		)
-	else
-		# Header-only library.
-		_any_dep = declare_dependency(
-			include_directories: includes,
-			dependencies: _any_deps,
-		)
-		_static_dep = declare_dependency(
-			include_directories: includes,
-			dependencies: _static_deps,
-		)
-	endif
-
-	if test_src.length() > 0
-		testfiles += [ {
-			'name': l,
-			'src': test_src,
-			'includes': [ private_includes, includes ],
-		} ]
-	endif
-
-	set_variable('lib' + l, {
-		'any': _any_dep,
-		'static': _static_dep,
-		'shared': _shared_dep,
-		'include': _include_dep,
-	})
-endforeach
-
-if not CONFIG_PCUT_TESTS
-	subdir_done()
-endif
-
-# Test binaries
-foreach test : testfiles
-	_testname = test['name']
-	_libname = _testname.split('-')[0]
-	_ldargs = []
-	_test_binname = 'test-lib' + _testname
-
-	if link_map
-		# We want linker to generate link map for debugging.
-		_ldargs += [ '-Wl,-Map,' + meson.current_build_dir() / _test_binname + '.map' ]
-	endif
-
-	_bin = executable(_test_binname, test.get('src'),
-		include_directories: test.get('includes'),
-		dependencies: [ get_variable('lib' + _libname).get('any'), libpcut.get('any') ],
-		link_whole: libstartfiles,
-		c_args: arch_uspace_c_args,
-		cpp_args: arch_uspace_c_args,
-		link_args: arch_uspace_c_args + arch_uspace_link_args + _ldargs,
-		build_by_default: true,
-	)
-
-	install_files += [[ 'test', _bin.full_path(), _test_binname ]]
-	install_deps += [ _bin ]
-
-	if disassemble
-		_disasm = custom_target(_test_binname + '.disasm',
-			command: [ objdump, '-S', '@INPUT@' ],
-			input: _bin,
-			output: _test_binname + '.disasm',
-			capture: true,
-			build_by_default: true,
-		)
-
-		if install_debug_files
-			install_files += [[ 'debug/test', _disasm.full_path(), _test_binname + '.disasm' ]]
-			install_deps += [ _disasm ]
-		endif
-	endif
-endforeach
Index: pace/lib/minix/doc/doxygroups.h
===================================================================
--- uspace/lib/minix/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libminix libminix
- * @ingroup libs
- * @brief Library for implementing the MFS file system and utilities
- */
Index: pace/lib/minix/meson.build
===================================================================
--- uspace/lib/minix/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,28 +1,0 @@
-#
-# Copyright (c) 2017 CZ.NIC, z.s.p.o.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
Index: pace/lib/minix/minix.c
===================================================================
--- uspace/lib/minix/minix.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-// Just an empty file to keep the build system happy.
Index: pace/lib/minix/minix.h
===================================================================
--- uspace/lib/minix/minix.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libminix
- * @{
- */
-
-#ifndef _MINIX_FS_H_
-#define _MINIX_FS_H_
-
-#include <stdint.h>
-
-#define MFS_BLOCKSIZE		1024
-#define S_ISDIR(m)		(((m) & S_IFMT) == S_IFDIR)
-#define S_ISREG(m)		(((m) & S_IFMT) == S_IFREG)
-#define S_IFDIR			0040000		/* Directory */
-#define S_IFREG			0100000		/* Regular file */
-#define S_IFMT			00170000
-
-/* The following block sizes are valid only on V3 filesystem */
-#define MFS_MIN_BLOCKSIZE	1024
-#define MFS_MAX_BLOCKSIZE	4096
-
-#define MFS_ROOT_INO		1
-#define MFS_SUPERBLOCK		1
-#define MFS_SUPERBLOCK_SIZE	1024
-#define MFS_BOOTBLOCK_SIZE	1024
-
-#define V2_NR_DIRECT_ZONES	7
-#define V2_NR_INDIRECT_ZONES	3
-
-#define V1_NR_DIRECT_ZONES	7
-#define V1_NR_INDIRECT_ZONES	2
-
-#define V1_INODES_PER_BLOCK	(MFS_BLOCKSIZE / sizeof(struct mfs_inode))
-#define V2_INODES_PER_BLOCK	(MFS_BLOCKSIZE / sizeof(struct mfs2_inode))
-#define V3_INODES_PER_BLOCK(bs)	((bs) / sizeof(struct mfs2_inode))
-
-#define MFS_DIRSIZE		16
-#define MFSL_DIRSIZE		32
-#define MFS3_DIRSIZE		64
-
-#define MFS_MAX_NAME_LEN	14
-#define MFS_L_MAX_NAME_LEN	30
-#define MFS3_MAX_NAME_LEN	60
-
-#define MFS_MAGIC_V1		0x137F
-#define MFS_MAGIC_V1R		0x7F13
-
-#define MFS_MAGIC_V1L		0x138F
-#define MFS_MAGIC_V1LR		0x8F13
-
-#define MFS_MAGIC_V2		0x2468
-#define MFS_MAGIC_V2R		0x6824
-
-#define MFS_MAGIC_V2L		0x2478
-#define MFS_MAGIC_V2LR		0x7824
-
-#define MFS_MAGIC_V3		0x4D5A
-#define MFS_MAGIC_V3R		0x5A4D
-
-#define MFS_VALID_FS		0x0001
-#define MFS_ERROR_FS		0x0002
-
-/* MFS V1/V2 superblock data on disk */
-struct mfs_superblock {
-	/* Total number of inodes on the device */
-	uint16_t	s_ninodes;
-	/* Total number of zones on the device */
-	uint16_t	s_nzones;
-	/* Number of inode bitmap blocks */
-	uint16_t	s_ibmap_blocks;
-	/* Number of zone bitmap blocks */
-	uint16_t	s_zbmap_blocks;
-	/* First data zone on device */
-	uint16_t	s_first_data_zone;
-	/* Base 2 logarithm of the zone to block ratio */
-	uint16_t	s_log2_zone_size;
-	/* Maximum file size expressed in bytes */
-	uint32_t	s_max_file_size;
-	/*
-	 * Magic number used to recognize MinixFS
-	 * and to detect on-disk endianness
-	 */
-	uint16_t	s_magic;
-	/* Flag used to detect FS errors */
-	uint16_t	s_state;
-	/* Total number of zones on the device (V2 only) */
-	uint32_t	s_nzones2;
-} __attribute__((packed));
-
-/* MFS V3 superblock data on disk */
-struct mfs3_superblock {
-	/* Total number of inodes on the device */
-	uint32_t	s_ninodes;
-	uint16_t	s_pad0;
-	/* Number of inode bitmap blocks */
-	int16_t		s_ibmap_blocks;
-	/* Number of zone bitmap blocks */
-	int16_t		s_zbmap_blocks;
-	/* First data zone on device */
-	uint16_t	s_first_data_zone;
-	/* Base 2 logarithm of the zone to block ratio */
-	int16_t		s_log2_zone_size;
-	int16_t		s_pad1;
-	/* Maximum file size expressed in bytes */
-	uint32_t	s_max_file_size;
-	/* Total number of zones on the device */
-	uint32_t	s_nzones;
-	/*
-	 * Magic number used to recognize MinixFS
-	 * and to detect on-disk endianness
-	 */
-	int16_t		s_magic;
-	int16_t		s_pad2;
-	/* Filesystem block size expressed in bytes */
-	uint16_t	s_block_size;
-	/* Filesystem disk format version */
-	int8_t		s_disk_version;
-} __attribute__((packed));
-
-/* MinixFS V1 inode structure as it is on disk */
-struct mfs_inode {
-	uint16_t	i_mode;
-	int16_t		i_uid;
-	int32_t		i_size;
-	int32_t		i_mtime;
-	uint8_t		i_gid;
-	uint8_t		i_nlinks;
-	/* Block numbers for direct zones */
-	uint16_t	i_dzone[V1_NR_DIRECT_ZONES];
-	/* Block numbers for indirect zones */
-	uint16_t	i_izone[V1_NR_INDIRECT_ZONES];
-} __attribute__((packed));
-
-/* MinixFS V2 inode structure as it is on disk (also valid for V3). */
-struct mfs2_inode {
-	uint16_t 	i_mode;
-	uint16_t 	i_nlinks;
-	int16_t 	i_uid;
-	uint16_t 	i_gid;
-	int32_t 	i_size;
-	int32_t		i_atime;
-	int32_t		i_mtime;
-	int32_t		i_ctime;
-	/* Block numbers for direct zones */
-	uint32_t	i_dzone[V2_NR_DIRECT_ZONES];
-	/* Block numbers for indirect zones */
-	uint32_t	i_izone[V2_NR_INDIRECT_ZONES];
-} __attribute__((packed));
-
-/* MinixFS V1/V2 directory entry on-disk structure */
-struct mfs_dentry {
-	uint16_t d_inum;
-	char d_name[0];
-};
-
-/* MinixFS V3 directory entry on-disk structure */
-struct mfs3_dentry {
-	uint32_t d_inum;
-	char d_name[0];
-};
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/nettl/doc/doxygroups.h
===================================================================
--- uspace/lib/nettl/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libnettl libnettl
- * @ingroup libs
- */
Index: pace/lib/nettl/include/nettl/amap.h
===================================================================
--- uspace/lib/nettl/include/nettl/amap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnettl
- * @{
- */
-/**
- * @file Association map.
- */
-
-#ifndef LIBNETTL_AMAP_H_
-#define LIBNETTL_AMAP_H_
-
-#include <adt/list.h>
-#include <inet/endpoint.h>
-#include <nettl/portrng.h>
-#include <loc.h>
-
-/** Port range for (remote endpoint, local address) */
-typedef struct {
-	/** Link to amap_t.repla */
-	link_t lamap;
-	/** Remote endpoint */
-	inet_ep_t rep;
-	/* Local address */
-	inet_addr_t laddr;
-	/** Port range */
-	portrng_t *portrng;
-} amap_repla_t;
-
-/** Port range for local address */
-typedef struct {
-	/** Link to amap_t.laddr */
-	link_t lamap;
-	/** Local address */
-	inet_addr_t laddr;
-	/** Port range */
-	portrng_t *portrng;
-} amap_laddr_t;
-
-/** Port range for local link */
-typedef struct {
-	/** Link to amap_t.llink */
-	link_t lamap;
-	/** Local link ID */
-	service_id_t llink;
-	/** Port range */
-	portrng_t *portrng;
-} amap_llink_t;
-
-/** Association map */
-typedef struct {
-	/** Remote endpoint, local address */
-	list_t repla; /* of amap_repla_t */
-	/** Local addresses */
-	list_t laddr; /* of amap_laddr_t */
-	/** Local links */
-	list_t llink; /* of amap_llink_t */
-	/** Nothing specified (listen on all local addresses) */
-	portrng_t *unspec;
-} amap_t;
-
-typedef enum {
-	/** Allow specifying port number from system range */
-	af_allow_system = 0x1
-} amap_flags_t;
-
-extern errno_t amap_create(amap_t **);
-extern void amap_destroy(amap_t *);
-extern errno_t amap_insert(amap_t *, inet_ep2_t *, void *, amap_flags_t,
-    inet_ep2_t *);
-extern void amap_remove(amap_t *, inet_ep2_t *);
-extern errno_t amap_find_match(amap_t *, inet_ep2_t *, void **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nettl/include/nettl/portrng.h
===================================================================
--- uspace/lib/nettl/include/nettl/portrng.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnettl
- * @{
- */
-/**
- * @file Port range allocator.
- */
-
-#ifndef LIBNETTL_PORTRNG_H_
-#define LIBNETTL_PORTRNG_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/** Allocated port */
-typedef struct {
-	/** Link to portrng_t.used */
-	link_t lprng;
-	/** Port number */
-	uint16_t pn;
-	/** User argument */
-	void *arg;
-} portrng_port_t;
-
-typedef struct {
-	list_t used; /* of portrng_port_t */
-} portrng_t;
-
-typedef enum {
-	pf_allow_system = 0x1
-} portrng_flags_t;
-
-extern errno_t portrng_create(portrng_t **);
-extern void portrng_destroy(portrng_t *);
-extern errno_t portrng_alloc(portrng_t *, uint16_t, void *,
-    portrng_flags_t, uint16_t *);
-extern errno_t portrng_find_port(portrng_t *, uint16_t, void **);
-extern void portrng_free_port(portrng_t *, uint16_t);
-extern bool portrng_empty(portrng_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nettl/meson.build
===================================================================
--- uspace/lib/nettl/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files(
-	'src/amap.c',
-	'src/portrng.c',
-)
Index: pace/lib/nettl/src/amap.c
===================================================================
--- uspace/lib/nettl/src/amap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,783 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnettl
- * @{
- */
-
-/**
- * @file Association map
- *
- * Manages allocations of endpoints / endpoint pairs (corresponding to
- * UDP associations, TCP listeners and TCP connections)
- *
- * An association map contains different types of entries, based on which
- * set of attributes (key) they specify. In order from most specific to the
- * least specific one:
- *
- *  - repla (remote endpoint, local address)
- *  - laddr (local address)
- *  - llink (local link)
- *  - unspec (unspecified)
- *
- * In the unspecified case only the local port is known and the entry matches
- * all remote and local addresses.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/inet.h>
-#include <io/log.h>
-#include <nettl/amap.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-/** Convert association map flags to port range flags.
- *
- * @param flags Association map flags
- * @return Port range flags
- */
-static portrng_flags_t aflags_to_pflags(amap_flags_t flags)
-{
-	portrng_flags_t pflags;
-
-	pflags = 0;
-	if ((flags & af_allow_system) != 0)
-		pflags |= pf_allow_system;
-
-	return pflags;
-}
-
-/** Create association map.
- *
- * @param rmap Place to store pointer to new association map
- * @return EOk on success, ENOMEM if out of memory
- */
-errno_t amap_create(amap_t **rmap)
-{
-	amap_t *map;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_create()");
-
-	map = calloc(1, sizeof(amap_t));
-	if (map == NULL)
-		return ENOMEM;
-
-	rc = portrng_create(&map->unspec);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		free(map);
-		return ENOMEM;
-	}
-
-	list_initialize(&map->repla);
-	list_initialize(&map->laddr);
-	list_initialize(&map->llink);
-
-	*rmap = map;
-	return EOK;
-}
-
-/** Destroy association map.
- *
- * @param map Association map
- */
-void amap_destroy(amap_t *map)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_destroy()");
-
-	assert(list_empty(&map->repla));
-	assert(list_empty(&map->laddr));
-	assert(list_empty(&map->llink));
-	free(map);
-}
-
-/** Find exact repla.
- *
- * Find repla (remote endpoint, local address) entry by exact match.
- *
- * @param map Association map
- * @param rep Remote endpoint
- * @param la  Local address
- * @param rrepla Place to store pointer to repla
- *
- * @return EOK on success, ENOENT if not found
- */
-static errno_t amap_repla_find(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
-    amap_repla_t **rrepla)
-{
-	char *sraddr, *sladdr;
-
-	(void) inet_addr_format(&rep->addr, &sraddr);
-	(void) inet_addr_format(la, &sladdr);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_repla_find(): rep=(%s,%" PRIu16
-	    ") la=%s", sraddr, rep->port, sladdr);
-	free(sraddr);
-	free(sladdr);
-
-	list_foreach(map->repla, lamap, amap_repla_t, repla) {
-		(void) inet_addr_format(&repla->rep.addr, &sraddr);
-		(void) inet_addr_format(&repla->laddr, &sladdr);
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_repla_find(): "
-		    "compare to rep=(%s, %" PRIu16 ") la=%s",
-		    sraddr, repla->rep.port, sladdr);
-		free(sraddr);
-		free(sladdr);
-		if (inet_addr_compare(&repla->rep.addr, &rep->addr) &&
-		    repla->rep.port == rep->port &&
-		    inet_addr_compare(&repla->laddr, la)) {
-			*rrepla = repla;
-			return EOK;
-		}
-	}
-
-	*rrepla = NULL;
-	return ENOENT;
-}
-
-/** Insert repla.
- *
- * Insert new repla (remote endpoint, local address) entry to association map.
- *
- * @param amap   Association map
- * @param rep    Remote endpoint
- * @param la     Local address
- * @param rrepla Place to store pointer to new repla
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t amap_repla_insert(amap_t *map, inet_ep_t *rep, inet_addr_t *la,
-    amap_repla_t **rrepla)
-{
-	amap_repla_t *repla;
-	errno_t rc;
-
-	repla = calloc(1, sizeof(amap_repla_t));
-	if (repla == NULL) {
-		*rrepla = NULL;
-		return ENOMEM;
-	}
-
-	rc = portrng_create(&repla->portrng);
-	if (rc != EOK) {
-		free(repla);
-		return ENOMEM;
-	}
-
-	repla->rep = *rep;
-	repla->laddr = *la;
-	list_append(&repla->lamap, &map->repla);
-
-	*rrepla = repla;
-	return EOK;
-}
-
-/** Remove repla from association map.
- *
- * Remove repla (remote endpoint, local address) from association map.
- *
- * @param map   Association map
- * @param repla Repla
- */
-static void amap_repla_remove(amap_t *map, amap_repla_t *repla)
-{
-	list_remove(&repla->lamap);
-	portrng_destroy(repla->portrng);
-	free(repla);
-}
-
-/** Find exact laddr.
- *
- * Find laddr (local address) entry by exact match.
- *
- * @param map    Association map
- * @param addr   Address
- * @param rladdr Place to store pointer to laddr entry
- *
- * @return EOK on success, ENOENT if not found.
- */
-static errno_t amap_laddr_find(amap_t *map, inet_addr_t *addr,
-    amap_laddr_t **rladdr)
-{
-	list_foreach(map->laddr, lamap, amap_laddr_t, laddr) {
-		if (inet_addr_compare(&laddr->laddr, addr)) {
-			*rladdr = laddr;
-			return EOK;
-		}
-	}
-
-	*rladdr = NULL;
-	return ENOENT;
-}
-
-/** Insert laddr.
- *
- * Insert new laddr (local address) entry to association map.
- *
- * @param addr   Local address
- * @param rladdr Place to store pointer to new laddr
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t amap_laddr_insert(amap_t *map, inet_addr_t *addr,
-    amap_laddr_t **rladdr)
-{
-	amap_laddr_t *laddr;
-	errno_t rc;
-
-	laddr = calloc(1, sizeof(amap_laddr_t));
-	if (laddr == NULL) {
-		*rladdr = NULL;
-		return ENOMEM;
-	}
-
-	rc = portrng_create(&laddr->portrng);
-	if (rc != EOK) {
-		free(laddr);
-		return ENOMEM;
-	}
-
-	laddr->laddr = *addr;
-	list_append(&laddr->lamap, &map->laddr);
-
-	*rladdr = laddr;
-	return EOK;
-}
-
-/** Remove laddr from association map.
- *
- * Remove laddr (local address) entry from association map.
- *
- * @param map   Association map
- * @param laddr Laddr entry
- */
-static void amap_laddr_remove(amap_t *map, amap_laddr_t *laddr)
-{
-	list_remove(&laddr->lamap);
-	portrng_destroy(laddr->portrng);
-	free(laddr);
-}
-
-/** Find exact llink.
- *
- * Find llink (local link) entry by exact match.
- *
- * @param map     Association map
- * @param link_id Local link ID
- * @param rllink  Place to store pointer to llink entry
- *
- * @return EOK on success, ENOENT if not found.
- */
-static errno_t amap_llink_find(amap_t *map, sysarg_t link_id,
-    amap_llink_t **rllink)
-{
-	list_foreach(map->llink, lamap, amap_llink_t, llink) {
-		if (llink->llink == link_id) {
-			*rllink = llink;
-			return EOK;
-		}
-	}
-
-	*rllink = NULL;
-	return ENOENT;
-}
-
-/** Insert llink.
- *
- * Insert new llink (local link) entry to association map.
- *
- * @param link_id Local link
- * @param rllink  Place to store pointer to new llink
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t amap_llink_insert(amap_t *map, sysarg_t link_id,
-    amap_llink_t **rllink)
-{
-	amap_llink_t *llink;
-	errno_t rc;
-
-	llink = calloc(1, sizeof(amap_llink_t));
-	if (llink == NULL) {
-		*rllink = NULL;
-		return ENOMEM;
-	}
-
-	rc = portrng_create(&llink->portrng);
-	if (rc != EOK) {
-		free(llink);
-		return ENOMEM;
-	}
-
-	llink->llink = link_id;
-	list_append(&llink->lamap, &map->llink);
-
-	*rllink = llink;
-	return EOK;
-}
-
-/** Remove llink from association map.
- *
- * Remove llink (local link) entry from association map.
- *
- * @param map   Association map
- * @param llink Llink entry
- */
-static void amap_llink_remove(amap_t *map, amap_llink_t *llink)
-{
-	list_remove(&llink->lamap);
-	portrng_destroy(llink->portrng);
-	free(llink);
-}
-
-/** Insert endpoint pair into map with repla as key.
- *
- * If local port number is not specified, it is allocated.
- *
- * @param map Association map
- * @param epp Endpoint pair, possibly with local port inet_port_any
- * @param arg arg User value
- * @param flags Flags
- * @param aepp Place to store actual endpoint pair, possibly with allocated port
- *
- * @return EOK on success, EEXIST if conflicting epp exists,
- *         ENOMEM if out of memory
- */
-static errno_t amap_insert_repla(amap_t *map, inet_ep2_t *epp, void *arg,
-    amap_flags_t flags, inet_ep2_t *aepp)
-{
-	amap_repla_t *repla;
-	inet_ep2_t mepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_repla()");
-
-	rc = amap_repla_find(map, &epp->remote, &epp->local.addr, &repla);
-	if (rc != EOK) {
-		/* New repla */
-		rc = amap_repla_insert(map, &epp->remote, &epp->local.addr,
-		    &repla);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return rc;
-		}
-	}
-
-	mepp = *epp;
-
-	rc = portrng_alloc(repla->portrng, epp->local.port, arg, aflags_to_pflags(flags),
-	    &mepp.local.port);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	*aepp = mepp;
-	return EOK;
-}
-
-/** Insert endpoint pair into map with laddr as key.
- *
- * If local port number is not specified, it is allocated.
- *
- * @param map Association map
- * @param epp Endpoint pair, possibly with local port inet_port_any
- * @param arg arg User value
- * @param flags Flags
- * @param aepp Place to store actual endpoint pair, possibly with allocated port
- *
- * @return EOK on success, EEXIST if conflicting epp exists,
- *         ENOMEM if out of memory
- */
-static errno_t amap_insert_laddr(amap_t *map, inet_ep2_t *epp, void *arg,
-    amap_flags_t flags, inet_ep2_t *aepp)
-{
-	amap_laddr_t *laddr;
-	inet_ep2_t mepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_laddr()");
-
-	rc = amap_laddr_find(map, &epp->local.addr, &laddr);
-	if (rc != EOK) {
-		/* New laddr */
-		rc = amap_laddr_insert(map, &epp->local.addr, &laddr);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return rc;
-		}
-	}
-
-	mepp = *epp;
-
-	rc = portrng_alloc(laddr->portrng, epp->local.port, arg, aflags_to_pflags(flags),
-	    &mepp.local.port);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	*aepp = mepp;
-	return EOK;
-}
-
-/** Insert endpoint pair into map with llink as key.
- *
- * If local port number is not specified, it is allocated.
- *
- * @param map Association map
- * @param epp Endpoint pair, possibly with local port inet_port_any
- * @param arg arg User value
- * @param flags Flags
- * @param aepp Place to store actual endpoint pair, possibly with allocated port
- *
- * @return EOK on success, EEXIST if conflicting epp exists,
- *         ENOMEM if out of memory
- */
-static errno_t amap_insert_llink(amap_t *map, inet_ep2_t *epp, void *arg,
-    amap_flags_t flags, inet_ep2_t *aepp)
-{
-	amap_llink_t *llink;
-	inet_ep2_t mepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_llink()");
-
-	rc = amap_llink_find(map, epp->local_link, &llink);
-	if (rc != EOK) {
-		/* New llink */
-		rc = amap_llink_insert(map, epp->local_link, &llink);
-		if (rc != EOK) {
-			assert(rc == ENOMEM);
-			return rc;
-		}
-	}
-
-	mepp = *epp;
-
-	rc = portrng_alloc(llink->portrng, epp->local.port, arg, aflags_to_pflags(flags),
-	    &mepp.local.port);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	*aepp = mepp;
-	return EOK;
-}
-
-/** Insert endpoint pair into map with unspec as key.
- *
- * If local port number is not specified, it is allocated.
- *
- * @param map Association map
- * @param epp Endpoint pair, possibly with local port inet_port_any
- * @param arg arg User value
- * @param flags Flags
- * @param aepp Place to store actual endpoint pair, possibly with allocated port
- *
- * @return EOK on success, EEXIST if conflicting epp exists,
- *         ENOMEM if out of memory
- */
-static errno_t amap_insert_unspec(amap_t *map, inet_ep2_t *epp, void *arg,
-    amap_flags_t flags, inet_ep2_t *aepp)
-{
-	inet_ep2_t mepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert_unspec()");
-	mepp = *epp;
-
-	rc = portrng_alloc(map->unspec, epp->local.port, arg, aflags_to_pflags(flags),
-	    &mepp.local.port);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	*aepp = mepp;
-	return EOK;
-}
-
-/** Insert endpoint pair into map.
- *
- * If local endpoint is not fully specified, it is filled in (determine
- * source address, allocate port number). Checks for conflicting endpoint pair.
- *
- * @param map Association map
- * @param epp Endpoint pair, possibly with local port inet_port_any
- * @param arg arg User value
- * @param flags Flags
- * @param aepp Place to store actual endpoint pair, possibly with allocated port
- *
- * @return EOK on success, EEXIST if conflicting epp exists,
- *         ENOMEM if out of memory
- */
-errno_t amap_insert(amap_t *map, inet_ep2_t *epp, void *arg, amap_flags_t flags,
-    inet_ep2_t *aepp)
-{
-	bool raddr, rport, laddr, llink;
-	inet_ep2_t mepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert()");
-
-	mepp = *epp;
-
-	/* Fill in local address? */
-	if (!inet_addr_is_any(&epp->remote.addr) &&
-	    inet_addr_is_any(&epp->local.addr)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert: "
-		    "determine local address");
-		rc = inet_get_srcaddr(&epp->remote.addr, 0, &mepp.local.addr);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert: "
-			    "cannot determine local address");
-			return rc;
-		}
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert: "
-		    "local address specified or remote address not specified");
-	}
-
-	raddr = !inet_addr_is_any(&mepp.remote.addr);
-	rport = mepp.remote.port != inet_port_any;
-	laddr = !inet_addr_is_any(&mepp.local.addr);
-	llink = mepp.local_link != 0;
-
-	if (raddr && rport && laddr && !llink) {
-		return amap_insert_repla(map, &mepp, arg, flags, aepp);
-	} else if (!raddr && !rport && laddr && !llink) {
-		return amap_insert_laddr(map, &mepp, arg, flags, aepp);
-	} else if (!raddr && !rport && !laddr && llink) {
-		return amap_insert_llink(map, &mepp, arg, flags, aepp);
-	} else if (!raddr && !rport && !laddr && !llink) {
-		return amap_insert_unspec(map, &mepp, arg, flags, aepp);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_insert: invalid "
-		    "combination of raddr=%d rport=%d laddr=%d llink=%d",
-		    raddr, rport, laddr, llink);
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-/** Remove endpoint pair using repla as key from map.
- *
- * The endpoint pair must be present in the map, otherwise behavior
- * is unspecified.
- *
- * @param map Association map
- * @param epp Endpoint pair
- */
-static void amap_remove_repla(amap_t *map, inet_ep2_t *epp)
-{
-	amap_repla_t *repla;
-	errno_t rc;
-
-	rc = amap_repla_find(map, &epp->remote, &epp->local.addr, &repla);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_remove_repla: not found");
-		return;
-	}
-
-	portrng_free_port(repla->portrng, epp->local.port);
-
-	if (portrng_empty(repla->portrng))
-		amap_repla_remove(map, repla);
-}
-
-/** Remove endpoint pair using laddr as key from map.
- *
- * The endpoint pair must be present in the map, otherwise behavior
- * is unspecified.
- *
- * @param map Association map
- * @param epp Endpoint pair
- */
-static void amap_remove_laddr(amap_t *map, inet_ep2_t *epp)
-{
-	amap_laddr_t *laddr;
-	errno_t rc;
-
-	rc = amap_laddr_find(map, &epp->local.addr, &laddr);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_remove_laddr: not found");
-		return;
-	}
-
-	portrng_free_port(laddr->portrng, epp->local.port);
-
-	if (portrng_empty(laddr->portrng))
-		amap_laddr_remove(map, laddr);
-}
-
-/** Remove endpoint pair using llink as key from map.
- *
- * The endpoint pair must be present in the map, otherwise behavior
- * is unspecified.
- *
- * @param map Association map
- * @param epp Endpoint pair
- */
-static void amap_remove_llink(amap_t *map, inet_ep2_t *epp)
-{
-	amap_llink_t *llink;
-	errno_t rc;
-
-	rc = amap_llink_find(map, epp->local_link, &llink);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_remove_llink: not found");
-		return;
-	}
-
-	portrng_free_port(llink->portrng, epp->local.port);
-
-	if (portrng_empty(llink->portrng))
-		amap_llink_remove(map, llink);
-}
-
-/** Remove endpoint pair using unspec as key from map.
- *
- * The endpoint pair must be present in the map, otherwise behavior
- * is unspecified.
- *
- * @param map Association map
- * @param epp Endpoint pair
- */
-static void amap_remove_unspec(amap_t *map, inet_ep2_t *epp)
-{
-	portrng_free_port(map->unspec, epp->local.port);
-}
-
-/** Remove endpoint pair from map.
- *
- * The endpoint pair must be present in the map, otherwise behavior
- * is unspecified.
- *
- * @param map Association map
- * @param epp Endpoint pair
- */
-void amap_remove(amap_t *map, inet_ep2_t *epp)
-{
-	bool raddr, rport, laddr, llink;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_remove()");
-
-	raddr = !inet_addr_is_any(&epp->remote.addr);
-	rport = epp->remote.port != inet_port_any;
-	laddr = !inet_addr_is_any(&epp->local.addr);
-	llink = epp->local_link != 0;
-
-	if (raddr && rport && laddr && !llink) {
-		amap_remove_repla(map, epp);
-	} else if (!raddr && !rport && laddr && !llink) {
-		amap_remove_laddr(map, epp);
-	} else if (!raddr && !rport && !laddr && llink) {
-		amap_remove_llink(map, epp);
-	} else if (!raddr && !rport && !laddr && !llink) {
-		amap_remove_unspec(map, epp);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_remove: invalid "
-		    "combination of raddr=%d rport=%d laddr=%d llink=%d",
-		    raddr, rport, laddr, llink);
-		return;
-	}
-}
-
-/** Find association matching an endpoint pair.
- *
- * Used to find which association to deliver a datagram to.
- *
- * @param map	Association map
- * @param epp	Endpoint pair
- * @param rarg	Place to store user argument for the matching association.
- *
- * @return	EOK on success, ENOENT if not found.
- */
-errno_t amap_find_match(amap_t *map, inet_ep2_t *epp, void **rarg)
-{
-	errno_t rc;
-	amap_repla_t *repla;
-	amap_laddr_t *laddr;
-	amap_llink_t *llink;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "amap_find_match(llink=%zu)",
-	    epp->local_link);
-
-	/* Remode endpoint, local address */
-	rc = amap_repla_find(map, &epp->remote, &epp->local.addr, &repla);
-	if (rc == EOK) {
-		rc = portrng_find_port(repla->portrng, epp->local.port,
-		    rarg);
-		if (rc == EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Matched repla / "
-			    "port %" PRIu16, epp->local.port);
-			return EOK;
-		}
-	}
-
-	/* Local address */
-	rc = amap_laddr_find(map, &epp->local.addr, &laddr);
-	if (rc == EOK) {
-		rc = portrng_find_port(laddr->portrng, epp->local.port,
-		    rarg);
-		if (rc == EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Matched laddr / "
-			    "port %" PRIu16, epp->local.port);
-			return EOK;
-		}
-	}
-
-	/* Local link */
-	rc = amap_llink_find(map, epp->local_link, &llink);
-	if (epp->local_link != 0 && rc == EOK) {
-		rc = portrng_find_port(llink->portrng, epp->local.port,
-		    rarg);
-		if (rc == EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Matched llink / "
-			    "port %" PRIu16, epp->local.port);
-			return EOK;
-		}
-	}
-
-	/* Unspecified */
-	rc = portrng_find_port(map->unspec, epp->local.port, rarg);
-	if (rc == EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "Matched unspec / port %" PRIu16,
-		    epp->local.port);
-		return EOK;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "No match.");
-	return ENOENT;
-}
-
-/**
- * @}
- */
Index: pace/lib/nettl/src/portrng.c
===================================================================
--- uspace/lib/nettl/src/portrng.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libnettl
- * @{
- */
-
-/**
- * @file Port range allocator
- *
- * Allocates port numbers from IETF port number ranges.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <nettl/portrng.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include <io/log.h>
-
-/** Create port range.
- *
- * @param rpr Place to store pointer to new port range
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t portrng_create(portrng_t **rpr)
-{
-	portrng_t *pr;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_create() - begin");
-
-	pr = calloc(1, sizeof(portrng_t));
-	if (pr == NULL)
-		return ENOMEM;
-
-	list_initialize(&pr->used);
-	*rpr = pr;
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_create() - end");
-	return EOK;
-}
-
-/** Destroy port range.
- *
- * @param pr Port range
- */
-void portrng_destroy(portrng_t *pr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_destroy()");
-	assert(list_empty(&pr->used));
-	free(pr);
-}
-
-/** Allocate port number from port range.
- *
- * @param pr    Port range
- * @param pnum  Port number to allocate specific port, or zero to allocate
- *              any valid port from range
- * @param arg   User argument to set for port
- * @param flags Flags, @c pf_allow_system to allow ports from system range
- *              to be specified by @a pnum.
- * @param apnum Place to store allocated port number
- *
- * @return EOK on success, ENOENT if no free port number found, EEXIST
- *         if @a pnum is specified but it is already allocated,
- *         EINVAL if @a pnum is specified from the system range, but
- *         @c pf_allow_system was not set.
- */
-errno_t portrng_alloc(portrng_t *pr, uint16_t pnum, void *arg,
-    portrng_flags_t flags, uint16_t *apnum)
-{
-	portrng_port_t *p;
-	uint32_t i;
-	bool found;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_alloc() - begin");
-
-	if (pnum == inet_port_any) {
-
-		for (i = inet_port_dyn_lo; i <= inet_port_dyn_hi; i++) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "trying %" PRIu32, i);
-			found = false;
-			list_foreach(pr->used, lprng, portrng_port_t, port) {
-				if (port->pn == pnum) {
-					found = true;
-					break;
-				}
-			}
-
-			if (!found) {
-				pnum = i;
-				break;
-			}
-		}
-
-		if (pnum == inet_port_any) {
-			/* No free port found */
-			return ENOENT;
-		}
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "selected %" PRIu16, pnum);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "user asked for %" PRIu16, pnum);
-
-		if ((flags & pf_allow_system) == 0 &&
-		    pnum < inet_port_user_lo) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "system port not allowed");
-			return EINVAL;
-		}
-
-		list_foreach(pr->used, lprng, portrng_port_t, port) {
-			if (port->pn == pnum) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG2, "port already used");
-				return EEXIST;
-			}
-		}
-	}
-
-	p = calloc(1, sizeof(portrng_port_t));
-	if (p == NULL)
-		return ENOMEM;
-
-	p->pn = pnum;
-	p->arg = arg;
-	list_append(&p->lprng, &pr->used);
-	*apnum = pnum;
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_alloc() - end OK pn=%" PRIu16,
-	    pnum);
-	return EOK;
-}
-
-/** Find allocated port number and return its argument.
- *
- * @param pr   Port range
- * @param pnum Port number
- * @param rarg Place to store user argument
- *
- * @return EOK on success, ENOENT if specified port number is not allocated
- */
-errno_t portrng_find_port(portrng_t *pr, uint16_t pnum, void **rarg)
-{
-	list_foreach(pr->used, lprng, portrng_port_t, port) {
-		if (port->pn == pnum) {
-			*rarg = port->arg;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Free port in port range.
- *
- * @param pr   Port range
- * @param pnum Port number
- */
-void portrng_free_port(portrng_t *pr, uint16_t pnum)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port(%u)", pnum);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port() - begin");
-	list_foreach(pr->used, lprng, portrng_port_t, port) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port - check port %u", port->pn);
-		if (port->pn == pnum) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port - OK");
-			list_remove(&port->lprng);
-			free(port);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port() - end");
-			return;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_free_port - FAIL");
-	assert(false);
-}
-
-/** Determine if port range is empty.
- *
- * @param pr Port range
- * @return @c true if no ports are allocated from @a pr, @c false otherwise
- */
-bool portrng_empty(portrng_t *pr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "portrng_empty()");
-	return list_empty(&pr->used);
-}
-
-/**
- * @}
- */
Index: pace/lib/nic/doc/doxygroups.h
===================================================================
--- uspace/lib/nic/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libnic libnic
- * @ingroup libs
- */
Index: pace/lib/nic/include/nic.h
===================================================================
--- uspace/lib/nic/include/nic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,283 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Public header exposing NICF to drivers
- */
-
-#ifndef __NIC_H__
-#define __NIC_H__
-
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <ddf/driver.h>
-#include <device/hw_res_parsed.h>
-#include <ops/nic.h>
-
-#define DEVICE_CATEGORY_NIC "nic"
-
-struct nic;
-typedef struct nic nic_t;
-
-/**
- * Single WOL virtue descriptor.
- */
-typedef struct nic_wol_virtue {
-	ht_link_t item;
-	nic_wv_id_t id;
-	nic_wv_type_t type;
-	void *data;
-	size_t length;
-	struct nic_wol_virtue *next;
-} nic_wol_virtue_t;
-
-/**
- * Simple structure for sending lists of frames.
- */
-typedef struct {
-	link_t link;
-	void *data;
-	size_t size;
-} nic_frame_t;
-
-typedef list_t nic_frame_list_t;
-
-/**
- * Handler for writing frame data to the NIC device.
- * The function is responsible for releasing the frame.
- * It does not return anything, if some error is detected the function just
- * silently fails (logging on debug level is suggested).
- *
- * @param nic_data
- * @param data		Pointer to frame data
- * @param size		Size of frame data in bytes
- */
-typedef void (*send_frame_handler)(nic_t *, void *, size_t);
-
-/**
- * The handler for transitions between driver states.
- * If the handler returns error code, the transition between
- * states is canceled (the state is not changed).
- *
- * @param nic_data	NICF main structure
- *
- * @return EOK	If everything is all right.
- * @return error code on error.
- */
-typedef errno_t (*state_change_handler)(nic_t *);
-
-/**
- * Handler for unicast filtering mode change.
- *
- * @param nic_data		NICF main structure
- * @param new_mode		The mode that should be set up
- * @param address_list	Addresses as argument to the mode
- * @param address_count	Number of addresses in the list
- *
- * @return EOK		If the mode is set up
- * @return ENOTSUP	If this mode is not supported
- */
-typedef errno_t (*unicast_mode_change_handler)(nic_t *,
-    nic_unicast_mode_t, const nic_address_t *, size_t);
-
-/**
- * Handler for multicast filtering mode change.
- *
- * @param nic_data		NICF main structure
- * @param new_mode		The mode that should be set up
- * @param address_list	Addresses as argument to the mode
- * @param address_count	Number of addresses in the list
- *
- * @return EOK		If the mode is set up
- * @return ENOTSUP	If this mode is not supported
- */
-typedef errno_t (*multicast_mode_change_handler)(nic_t *,
-    nic_multicast_mode_t, const nic_address_t *, size_t);
-
-/**
- * Handler for broadcast filtering mode change.
- *
- * @param nic_data	NICF main structure
- * @param new_mode	The mode that should be set up
- *
- * @return EOK		If the mode is set up
- * @return ENOTSUP	If this mode is not supported
- */
-typedef errno_t (*broadcast_mode_change_handler)(nic_t *, nic_broadcast_mode_t);
-
-/**
- * Handler for blocked sources list change.
- *
- * @param nic_data		NICF main structure
- * @param address_list	Addresses as argument to the mode
- * @param address_count	Number of addresses in the list
- */
-typedef void (*blocked_sources_change_handler)(nic_t *,
-    const nic_address_t *, size_t);
-
-/**
- * Handler for VLAN filtering mask change.
- * @param nic_data		NICF main structure
- * @param vlan_mask		The new mask | NULL for disabling vlan filter
- */
-typedef void (*vlan_mask_change_handler)(nic_t *, const nic_vlan_mask_t *);
-
-/**
- * Handler called when a WOL virtue is added.
- * If the maximum of accepted WOL virtues changes due to adding this virtue
- * you should update the vector wol_virtues.caps_max.
- * The driver is allowed to store pointer to the virtue data until
- * on_wol_virtue_remove on these data is called (although probably this is
- * not a good practice).
- *
- * @param nic_data	NICF main structure
- * @param virtue	Structure with virtue description
- *
- * @return EOK		If the filter can be used. Software emulation of the
- * 					filter is activated unless the emulate is set to 0.
- * @return ENOTSUP	If this filter cannot work on this NIC (e.g. the NIC
- * 					cannot run in promiscuous node or the limit of WOL
- * 					frames' specifications was reached).
- * @return ELIMIT	If this filter must implemented in HW but currently the
- * 					limit of these HW filters was reached.
- */
-typedef errno_t (*wol_virtue_add_handler)(nic_t *, const nic_wol_virtue_t *);
-
-/**
- * Handler called when a WOL virtue is removed.
- * If the maximum of accepted WOL virtues changes due to removing this
- * virtue you should update the vector wol_virtues.caps_max.
- *
- * @param nic_data	NICF main structure
- * @param virtue		Structure with virtue description
- */
-typedef void (*wol_virtue_remove_handler)(nic_t *, const nic_wol_virtue_t *);
-
-/**
- * Handler for poll mode change.
- *
- * @param nic_data	NICF main structure
- * @param mode		Mode to be set up
- * @param period	New period of polling (with NIC_POLL_PERIODIC)
- *
- * @return EOK		If the mode was fully setup
- * @return ENOTSUP	If NICF should do the periodic polling
- * @return EINVAL	If this mode cannot be set up under no circumstances
- */
-typedef errno_t (*poll_mode_change_handler)(nic_t *,
-    nic_poll_mode_t, const struct timespec *);
-
-/**
- * Event handler called when the NIC should poll its buffers for a new frame
- * (in NIC_POLL_PERIODIC or NIC_POLL_ON_DEMAND) modes.
- *
- * @param nic_data	NICF main structure
- */
-typedef void (*poll_request_handler)(nic_t *);
-
-/* nic_t allocation and deallocation */
-extern nic_t *nic_create_and_bind(ddf_dev_t *);
-extern void nic_unbind_and_destroy(ddf_dev_t *);
-
-/* Functions called in the main function */
-extern errno_t nic_driver_init(const char *);
-extern void nic_driver_implement(driver_ops_t *, ddf_dev_ops_t *,
-    nic_iface_t *);
-
-/* Functions called in add_device */
-extern errno_t nic_get_resources(nic_t *, hw_res_list_parsed_t *);
-extern void nic_set_specific(nic_t *, void *);
-extern void nic_set_send_frame_handler(nic_t *, send_frame_handler);
-extern void nic_set_state_change_handlers(nic_t *,
-    state_change_handler, state_change_handler, state_change_handler);
-extern void nic_set_filtering_change_handlers(nic_t *,
-    unicast_mode_change_handler, multicast_mode_change_handler,
-    broadcast_mode_change_handler, blocked_sources_change_handler,
-    vlan_mask_change_handler);
-extern void nic_set_wol_virtue_change_handlers(nic_t *,
-    wol_virtue_add_handler, wol_virtue_remove_handler);
-extern void nic_set_poll_handlers(nic_t *,
-    poll_mode_change_handler, poll_request_handler);
-
-/* General driver functions */
-extern ddf_dev_t *nic_get_ddf_dev(nic_t *);
-extern ddf_fun_t *nic_get_ddf_fun(nic_t *);
-extern void nic_set_ddf_fun(nic_t *, ddf_fun_t *);
-extern nic_t *nic_get_from_ddf_dev(ddf_dev_t *);
-extern nic_t *nic_get_from_ddf_fun(ddf_fun_t *);
-extern void *nic_get_specific(nic_t *);
-extern nic_device_state_t nic_query_state(nic_t *);
-extern void nic_set_tx_busy(nic_t *, int);
-extern errno_t nic_report_address(nic_t *, const nic_address_t *);
-extern errno_t nic_report_poll_mode(nic_t *, nic_poll_mode_t, struct timespec *);
-extern void nic_query_address(nic_t *, nic_address_t *);
-extern void nic_received_frame(nic_t *, nic_frame_t *);
-extern void nic_received_frame_list(nic_t *, nic_frame_list_t *);
-extern nic_poll_mode_t nic_query_poll_mode(nic_t *, struct timespec *);
-
-/* Statistics updates */
-extern void nic_report_send_ok(nic_t *, size_t, size_t);
-extern void nic_report_send_error(nic_t *, nic_send_error_cause_t, unsigned);
-extern void nic_report_receive_error(nic_t *, nic_receive_error_cause_t,
-    unsigned);
-extern void nic_report_collisions(nic_t *, unsigned);
-
-/* Frame / frame list allocation and deallocation */
-extern nic_frame_t *nic_alloc_frame(nic_t *, size_t);
-extern nic_frame_list_t *nic_alloc_frame_list(void);
-extern void nic_frame_list_append(nic_frame_list_t *, nic_frame_t *);
-extern void nic_release_frame(nic_t *, nic_frame_t *);
-
-/* RXC query and report functions */
-extern void nic_report_hw_filtering(nic_t *, int, int, int);
-extern void nic_query_unicast(const nic_t *,
-    nic_unicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern void nic_query_multicast(const nic_t *,
-    nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern void nic_query_broadcast(const nic_t *, nic_broadcast_mode_t *);
-extern void nic_query_blocked_sources(const nic_t *,
-    size_t, nic_address_t *, size_t *);
-extern errno_t nic_query_vlan_mask(const nic_t *, nic_vlan_mask_t *);
-extern int nic_query_wol_max_caps(const nic_t *, nic_wv_type_t);
-extern void nic_set_wol_max_caps(nic_t *, nic_wv_type_t, int);
-extern uint64_t nic_mcast_hash(const nic_address_t *, size_t);
-extern uint64_t nic_query_mcast_hash(nic_t *);
-
-/* Software period functions */
-extern void nic_sw_period_start(nic_t *);
-extern void nic_sw_period_stop(nic_t *);
-
-#endif // __NIC_H__
-
-/** @}
- */
Index: pace/lib/nic/include/nic_addr_db.h
===================================================================
--- uspace/lib/nic/include/nic_addr_db.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Generic hash-set based database of addresses
- */
-
-#ifndef __NIC_ADDR_DB_H__
-#define __NIC_ADDR_DB_H__
-
-#ifndef LIBNIC_INTERNAL
-#error "This is internal libnic header, please don't include it"
-#endif
-
-#include <adt/hash_table.h>
-#include <types/common.h>
-
-/**
- * Fibril-safe database of addresses implemented using hash set.
- */
-typedef struct nic_addr_db {
-	hash_table_t set;
-	size_t addr_len;
-} nic_addr_db_t;
-
-extern errno_t nic_addr_db_init(nic_addr_db_t *db, size_t addr_len);
-extern void nic_addr_db_clear(nic_addr_db_t *db);
-extern void nic_addr_db_destroy(nic_addr_db_t *db);
-extern errno_t nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr);
-extern errno_t nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr);
-extern bool nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr);
-extern void nic_addr_db_foreach(const nic_addr_db_t *db,
-    void (*func)(const uint8_t *, void *), void *arg);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/include/nic_driver.h
===================================================================
--- uspace/lib/nic/include/nic_driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,215 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Internal NICF structures
- */
-
-#ifndef __NIC_DRIVER_H__
-#define __NIC_DRIVER_H__
-
-#ifndef LIBNIC_INTERNAL
-#error "This is internal libnic's header, please do not include it"
-#endif
-
-#include <fibril_synch.h>
-#include <nic/nic.h>
-#include <async.h>
-
-#include "nic.h"
-#include "nic_rx_control.h"
-#include "nic_wol_virtues.h"
-
-struct sw_poll_info {
-	fid_t fibril;
-	volatile int run;
-	volatile int running;
-};
-
-struct nic {
-	/**
-	 * Device from device manager's point of view.
-	 * The value must be set within the add_device handler
-	 * (in nic_create_and_bind) and must not be changed.
-	 */
-	ddf_dev_t *dev;
-	/**
-	 * Device's NIC function.
-	 * The value must be set within the add_device handler
-	 * (in nic_driver_register_as_ddf_function) and must not be changed.
-	 */
-	ddf_fun_t *fun;
-	/** Current state of the device */
-	nic_device_state_t state;
-	/** Transmiter is busy - messages are dropped */
-	int tx_busy;
-	/** Device's MAC address */
-	nic_address_t mac;
-	/** Device's default MAC address (assigned the first time, used in STOP) */
-	nic_address_t default_mac;
-	/** Client callback session */
-	async_sess_t *client_session;
-	/** Current polling mode of the NIC */
-	nic_poll_mode_t poll_mode;
-	/** Polling period (applicable when poll_mode == NIC_POLL_PERIODIC) */
-	struct timespec poll_period;
-	/** Current polling mode of the NIC */
-	nic_poll_mode_t default_poll_mode;
-	/** Polling period (applicable when default_poll_mode == NIC_POLL_PERIODIC) */
-	struct timespec default_poll_period;
-	/** Software period fibrill information */
-	struct sw_poll_info sw_poll_info;
-	/**
-	 * Lock on everything but statistics, rx control and wol virtues. This lock
-	 * cannot be used if filters_lock or stats_lock is already held - you must
-	 * acquire main_lock first (otherwise deadlock could happen).
-	 */
-	fibril_rwlock_t main_lock;
-	/** Device statistics */
-	nic_device_stats_t stats;
-	/**
-	 * Lock for statistics. You must not hold any other lock from nic_t except
-	 * the main_lock at the same moment. If both this lock and main_lock should
-	 * be locked, the main_lock must be locked as the first.
-	 */
-	fibril_rwlock_t stats_lock;
-	/** Receive control configuration */
-	nic_rxc_t rx_control;
-	/**
-	 * Lock for receive control. You must not hold any other lock from nic_t
-	 * except the main_lock at the same moment. If both this lock and main_lock
-	 * should be locked, the main_lock must be locked as the first.
-	 */
-	fibril_rwlock_t rxc_lock;
-	/** WOL virtues configuration */
-	nic_wol_virtues_t wol_virtues;
-	/**
-	 * Lock for WOL virtues. You must not hold any other lock from nic_t
-	 * except the main_lock at the same moment. If both this lock and main_lock
-	 * should be locked, the main_lock must be locked as the first.
-	 */
-	fibril_rwlock_t wv_lock;
-	/**
-	 * Function really sending the data. This MUST be filled in if the
-	 * nic_send_message_impl function is used for sending messages (filled
-	 * as send_message member of the nic_iface_t structure).
-	 * Called with the main_lock locked for reading.
-	 */
-	send_frame_handler send_frame;
-	/**
-	 * Event handler called when device goes to the ACTIVE state.
-	 * The implementation is optional.
-	 * Called with the main_lock locked for writing.
-	 */
-	state_change_handler on_activating;
-	/**
-	 * Event handler called when device goes to the DOWN state.
-	 * The implementation is optional.
-	 * Called with the main_lock locked for writing.
-	 */
-	state_change_handler on_going_down;
-	/**
-	 * Event handler called when device goes to the STOPPED state.
-	 * The implementation is optional.
-	 * Called with the main_lock locked for writing.
-	 */
-	state_change_handler on_stopping;
-	/**
-	 * Event handler called when the unicast receive mode is changed.
-	 * The implementation is optional. Called with rxc_lock locked for writing.
-	 */
-	unicast_mode_change_handler on_unicast_mode_change;
-	/**
-	 * Event handler called when the multicast receive mode is changed.
-	 * The implementation is optional. Called with rxc_lock locked for writing.
-	 */
-	multicast_mode_change_handler on_multicast_mode_change;
-	/**
-	 * Event handler called when the broadcast receive mode is changed.
-	 * The implementation is optional. Called with rxc_lock locked for writing.
-	 */
-	broadcast_mode_change_handler on_broadcast_mode_change;
-	/**
-	 * Event handler called when the blocked sources set is changed.
-	 * The implementation is optional. Called with rxc_lock locked for writing.
-	 */
-	blocked_sources_change_handler on_blocked_sources_change;
-	/**
-	 * Event handler called when the VLAN mask is changed.
-	 * The implementation is optional. Called with rxc_lock locked for writing.
-	 */
-	vlan_mask_change_handler on_vlan_mask_change;
-	/**
-	 * Event handler called when a new WOL virtue is added.
-	 * The implementation is optional.
-	 * Called with filters_lock locked for writing.
-	 */
-	wol_virtue_add_handler on_wol_virtue_add;
-	/**
-	 * Event handler called when a WOL virtue is removed.
-	 * The implementation is optional.
-	 * Called with filters_lock locked for writing.
-	 */
-	wol_virtue_remove_handler on_wol_virtue_remove;
-	/**
-	 * Event handler called when the polling mode is changed.
-	 * The implementation is optional.
-	 * Called with main_lock locked for writing.
-	 */
-	poll_mode_change_handler on_poll_mode_change;
-	/**
-	 * Event handler called when the NIC should poll its buffers for a new frame
-	 * (in NIC_POLL_PERIODIC or NIC_POLL_ON_DEMAND) modes.
-	 * Called with the main_lock locked for reading.
-	 * The implementation is optional.
-	 */
-	poll_request_handler on_poll_request;
-	/** Data specific for particular driver */
-	void *specific;
-};
-
-/**
- * Structure keeping global data
- */
-typedef struct nic_globals {
-	list_t frame_list_cache;
-	size_t frame_list_cache_size;
-	list_t frame_cache;
-	size_t frame_cache_size;
-	fibril_mutex_t lock;
-} nic_globals_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/include/nic_ev.h
===================================================================
--- uspace/lib/nic/include/nic_ev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Prototypes of default DDF NIC interface methods implementations
- */
-
-#ifndef NIC_EV_H__
-#define NIC_EV_H__
-
-#include <async.h>
-#include <nic/nic.h>
-#include <stddef.h>
-
-extern errno_t nic_ev_addr_changed(async_sess_t *, const nic_address_t *);
-extern errno_t nic_ev_device_state(async_sess_t *, sysarg_t);
-extern errno_t nic_ev_received(async_sess_t *, void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/include/nic_impl.h
===================================================================
--- uspace/lib/nic/include/nic_impl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Prototypes of default DDF NIC interface methods implementations
- */
-
-#ifndef NIC_IMPL_H__
-#define NIC_IMPL_H__
-
-#include <assert.h>
-#include <nic/nic.h>
-#include <ddf/driver.h>
-
-/*
- * Inclusion of this file is not prohibited, because drivers could want to
- * inject some adaptation layer between the DDF call and NICF implementation
- */
-
-extern errno_t nic_get_address_impl(ddf_fun_t *dev_fun, nic_address_t *address);
-extern errno_t nic_send_frame_impl(ddf_fun_t *dev_fun, void *data, size_t size);
-extern errno_t nic_callback_create_impl(ddf_fun_t *dev_fun);
-extern errno_t nic_get_state_impl(ddf_fun_t *dev_fun, nic_device_state_t *state);
-extern errno_t nic_set_state_impl(ddf_fun_t *dev_fun, nic_device_state_t state);
-extern errno_t nic_get_stats_impl(ddf_fun_t *dev_fun, nic_device_stats_t *stats);
-extern errno_t nic_unicast_get_mode_impl(ddf_fun_t *dev_fun,
-    nic_unicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_unicast_set_mode_impl(ddf_fun_t *dev_fun,
-    nic_unicast_mode_t, const nic_address_t *, size_t);
-extern errno_t nic_multicast_get_mode_impl(ddf_fun_t *dev_fun,
-    nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_multicast_set_mode_impl(ddf_fun_t *dev_fun,
-    nic_multicast_mode_t, const nic_address_t *, size_t);
-extern errno_t nic_broadcast_get_mode_impl(ddf_fun_t *, nic_broadcast_mode_t *);
-extern errno_t nic_broadcast_set_mode_impl(ddf_fun_t *, nic_broadcast_mode_t);
-extern errno_t nic_blocked_sources_get_impl(ddf_fun_t *,
-    size_t, nic_address_t *, size_t *);
-extern errno_t nic_blocked_sources_set_impl(ddf_fun_t *, const nic_address_t *, size_t);
-extern errno_t nic_vlan_get_mask_impl(ddf_fun_t *, nic_vlan_mask_t *);
-extern errno_t nic_vlan_set_mask_impl(ddf_fun_t *, const nic_vlan_mask_t *);
-extern errno_t nic_wol_virtue_add_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
-    const void *data, size_t length, nic_wv_id_t *new_id);
-extern errno_t nic_wol_virtue_remove_impl(ddf_fun_t *dev_fun, nic_wv_id_t id);
-extern errno_t nic_wol_virtue_probe_impl(ddf_fun_t *dev_fun, nic_wv_id_t id,
-    nic_wv_type_t *type, size_t max_length, void *data, size_t *length);
-extern errno_t nic_wol_virtue_list_impl(ddf_fun_t *dev_fun, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
-extern errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *, nic_wv_type_t, int *);
-extern errno_t nic_poll_get_mode_impl(ddf_fun_t *,
-    nic_poll_mode_t *, struct timespec *);
-extern errno_t nic_poll_set_mode_impl(ddf_fun_t *,
-    nic_poll_mode_t, const struct timespec *);
-extern errno_t nic_poll_now_impl(ddf_fun_t *);
-
-extern void nic_default_handler_impl(ddf_fun_t *dev_fun, ipc_call_t *call);
-extern errno_t nic_open_impl(ddf_fun_t *fun);
-extern void nic_close_impl(ddf_fun_t *fun);
-
-extern void nic_device_added_impl(ddf_dev_t *dev);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/include/nic_rx_control.h
===================================================================
--- uspace/lib/nic/include/nic_rx_control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Incoming packets (frames) filtering control structures
- */
-
-#ifndef __NIC_FILTERS_H__
-#define __NIC_FILTERS_H__
-
-#ifndef LIBNIC_INTERNAL
-#error "This is internal libnic's header, please do not include it"
-#endif
-
-#include <adt/hash_table.h>
-#include <fibril_synch.h>
-#include <nic/nic.h>
-
-#include "nic_addr_db.h"
-
-/**
- * General structure describing receive control.
- * The structure is not synchronized inside, the nic_driver should provide
- * a synchronized facade.
- */
-typedef struct nic_rxc {
-	/**
-	 * Allowed unicast destination MAC addresses
-	 */
-	nic_addr_db_t unicast_addrs;
-	/**
-	 * Allowed unicast destination MAC addresses
-	 */
-	nic_addr_db_t multicast_addrs;
-	/**
-	 * Single flag if any source is blocked
-	 */
-	int block_sources;
-	/**
-	 * Blocked source MAC addresses
-	 */
-	nic_addr_db_t blocked_sources;
-	/**
-	 * Selected mode for unicast frames
-	 */
-	nic_unicast_mode_t unicast_mode;
-	/**
-	 * Selected mode for multicast frames
-	 */
-	nic_multicast_mode_t multicast_mode;
-	/**
-	 * Selected mode for broadcast frames
-	 */
-	nic_broadcast_mode_t broadcast_mode;
-	/**
-	 * Mask for VLAN tags. This vector must be at least 512 bytes long.
-	 */
-	nic_vlan_mask_t *vlan_mask;
-	/**
-	 * If true, the NIC is receiving only unicast frames which we really want to
-	 * receive (the filtering is perfect).
-	 */
-	int unicast_exact;
-	/**
-	 * If true, the NIC is receiving only multicast frames which we really want
-	 * to receive (the filtering is perfect).
-	 */
-	int multicast_exact;
-	/**
-	 * If true, the NIC is receiving only frames with VLAN tags which we really
-	 * want to receive (the filtering is perfect).
-	 */
-	int vlan_exact;
-} nic_rxc_t;
-
-#define VLAN_TPID_UPPER 0x81
-#define VLAN_TPID_LOWER 0x00
-
-typedef struct vlan_header {
-	uint8_t tpid_upper;
-	uint8_t tpid_lower;
-	uint8_t vid_upper;
-	uint8_t vid_lower;
-} __attribute__((packed)) vlan_header_t;
-
-extern errno_t nic_rxc_init(nic_rxc_t *rxc);
-extern errno_t nic_rxc_clear(nic_rxc_t *rxc);
-extern errno_t nic_rxc_set_addr(nic_rxc_t *rxc,
-    const nic_address_t *prev_addr, const nic_address_t *curr_addr);
-extern bool nic_rxc_check(const nic_rxc_t *rxc,
-    const void *data, size_t size, nic_frame_type_t *frame_type);
-extern void nic_rxc_hw_filtering(nic_rxc_t *rxc,
-    int unicast_exact, int multicast_exact, int vlan_exact);
-extern uint64_t nic_rxc_mcast_hash(const nic_address_t *list, size_t count);
-extern uint64_t nic_rxc_multicast_get_hash(const nic_rxc_t *rxc);
-extern void nic_rxc_unicast_get_mode(const nic_rxc_t *, nic_unicast_mode_t *,
-    size_t max_count, nic_address_t *address_list, size_t *address_count);
-extern errno_t nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count);
-extern void nic_rxc_multicast_get_mode(const nic_rxc_t *,
-    nic_multicast_mode_t *, size_t, nic_address_t *, size_t *);
-extern errno_t nic_rxc_multicast_set_mode(nic_rxc_t *, nic_multicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count);
-extern void nic_rxc_broadcast_get_mode(const nic_rxc_t *,
-    nic_broadcast_mode_t *mode);
-extern errno_t nic_rxc_broadcast_set_mode(nic_rxc_t *,
-    nic_broadcast_mode_t mode);
-extern void nic_rxc_blocked_sources_get(const nic_rxc_t *,
-    size_t max_count, nic_address_t *address_list, size_t *address_count);
-extern errno_t nic_rxc_blocked_sources_set(nic_rxc_t *,
-    const nic_address_t *address_list, size_t address_count);
-extern errno_t nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask);
-extern errno_t nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/include/nic_wol_virtues.h
===================================================================
--- uspace/lib/nic/include/nic_wol_virtues.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Wake-on-LAN support
- */
-
-#ifndef __NIC_WOL_VIRTUES_H__
-#define __NIC_WOL_VIRTUES_H__
-
-#ifndef LIBNIC_INTERNAL
-#error "This is internal libnic's header, please do not include it"
-#endif
-
-#include <nic/nic.h>
-#include <adt/hash_table.h>
-#include "nic.h"
-
-typedef struct nic_wol_virtues {
-	/**
-	 * Operations for table
-	 */
-	hash_table_ops_t table_operations;
-	/**
-	 * WOL virtues hashed by their ID's.
-	 */
-	hash_table_t table;
-	/**
-	 * WOL virtues in lists by their type
-	 */
-	nic_wol_virtue_t *lists[NIC_WV_MAX];
-	/**
-	 * Number of virtues in the wv_types list
-	 */
-	size_t lists_sizes[NIC_WV_MAX];
-	/**
-	 * Counter for the ID's
-	 */
-	nic_wv_id_t next_id;
-	/**
-	 * Maximum capabilities
-	 */
-	int caps_max[NIC_WV_MAX];
-} nic_wol_virtues_t;
-
-extern errno_t nic_wol_virtues_init(nic_wol_virtues_t *);
-extern void nic_wol_virtues_clear(nic_wol_virtues_t *);
-extern errno_t nic_wol_virtues_verify(nic_wv_type_t, const void *, size_t);
-extern errno_t nic_wol_virtues_list(const nic_wol_virtues_t *, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count);
-extern errno_t nic_wol_virtues_add(nic_wol_virtues_t *, nic_wol_virtue_t *);
-extern nic_wol_virtue_t *nic_wol_virtues_remove(nic_wol_virtues_t *,
-    nic_wv_id_t);
-extern const nic_wol_virtue_t *nic_wol_virtues_find(const nic_wol_virtues_t *,
-    nic_wv_id_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/nic/meson.build
===================================================================
--- uspace/lib/nic/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2011 Radim Vansa
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-c_args = [ '-DLIBNIC_INTERNAL', ]
-src = files(
-	'src/nic_driver.c',
-	'src/nic_ev.c',
-	'src/nic_addr_db.c',
-	'src/nic_rx_control.c',
-	'src/nic_wol_virtues.c',
-	'src/nic_impl.c',
-)
Index: pace/lib/nic/src/nic_addr_db.c
===================================================================
--- uspace/lib/nic/src/nic_addr_db.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,273 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Generic hash-set based database of addresses
- */
-
-#include "nic_addr_db.h"
-#include <assert.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <mem.h>
-#include <member.h>
-#include <adt/hash_table.h>
-#include <macros.h>
-#include <stdint.h>
-
-/**
- * Helper structure for keeping the address in the hash set.
- */
-typedef struct nic_addr_entry {
-	ht_link_t link;
-	size_t hash;
-	uint8_t len;
-	uint8_t addr[];
-} nic_addr_entry_t;
-
-/*
- * Hash table helper functions
- */
-typedef struct {
-	size_t hash;
-	size_t len;
-	const uint8_t *addr;
-} addr_key_t;
-
-static bool nic_addr_key_equal(const void *key_arg, size_t hash, const ht_link_t *item)
-{
-	const addr_key_t *key = key_arg;
-	nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
-	return entry->hash == hash && memcmp(entry->addr, key->addr, entry->len) == 0;
-}
-
-static size_t addr_hash(size_t len, const uint8_t *addr)
-{
-	size_t hash = 0;
-
-	for (size_t i = 0; i < len; ++i) {
-		hash = (hash << 5) ^ addr[i];
-	}
-
-	return hash;
-}
-
-static size_t nic_addr_key_hash(const void *k)
-{
-	const addr_key_t *key = k;
-	return key->hash ? key->hash : addr_hash(key->len, key->addr);
-}
-
-static size_t nic_addr_hash(const ht_link_t *item)
-{
-	nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
-	return entry->hash;
-}
-
-static void nic_addr_removed(ht_link_t *item)
-{
-	nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
-	free(entry);
-}
-
-static const hash_table_ops_t set_ops = {
-	.hash = nic_addr_hash,
-	.key_hash = nic_addr_key_hash,
-	.key_equal = nic_addr_key_equal,
-	.equal = NULL,
-	.remove_callback = nic_addr_removed
-};
-
-/**
- * Initialize the database
- *
- * @param[in,out]	db			Uninitialized storage
- * @param[in]		addr_len	Size of addresses in the db
- *
- * @return EOK		If successfully initialized
- * @return EINVAL	If the address length is too big
- * @return ENOMEM	If there was not enough memory to initialize the storage
- */
-errno_t nic_addr_db_init(nic_addr_db_t *db, size_t addr_len)
-{
-	assert(db);
-
-	if (addr_len > UCHAR_MAX)
-		return EINVAL;
-
-	if (!hash_table_create(&db->set, 0, 0, &set_ops))
-		return ENOMEM;
-
-	db->addr_len = addr_len;
-	return EOK;
-}
-
-/**
- * Remove all records from the DB
- *
- * @param db
- */
-void nic_addr_db_clear(nic_addr_db_t *db)
-{
-	assert(db);
-	hash_table_clear(&db->set);
-}
-
-/**
- * Free the memory used by db, including all records...
- *
- * @param	db
- */
-void nic_addr_db_destroy(nic_addr_db_t *db)
-{
-	assert(db);
-	hash_table_destroy(&db->set);
-}
-
-/**
- * Insert an address to the db
- *
- * @param	db
- * @param	addr 	Inserted address. Length is implicitly concluded from the
- * 					db's address length.
- *
- * @return EOK		If the address was inserted
- * @return ENOMEM	If there was not enough memory
- * @return EEXIST	If this address already is in the db
- */
-errno_t nic_addr_db_insert(nic_addr_db_t *db, const uint8_t *addr)
-{
-	assert(db && addr);
-
-	addr_key_t key = {
-		.len = db->addr_len,
-		.addr = addr,
-		.hash = addr_hash(db->addr_len, addr),
-	};
-
-	if (hash_table_find(&db->set, &key))
-		return EEXIST;
-
-	nic_addr_entry_t *entry = malloc(offsetof(nic_addr_entry_t, addr) + db->addr_len);
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->len = (uint8_t) db->addr_len;
-	memcpy(entry->addr, addr, db->addr_len);
-	entry->hash = key.hash;
-
-	hash_table_insert(&db->set, &entry->link);
-	return EOK;
-}
-
-/**
- * Remove the address from the db
- *
- * @param	db
- * @param	addr	Removed address.
- *
- * @return EOK		If the address was removed
- * @return ENOENT	If there is no address
- */
-errno_t nic_addr_db_remove(nic_addr_db_t *db, const uint8_t *addr)
-{
-	assert(db && addr);
-
-	addr_key_t key = {
-		.len = db->addr_len,
-		.addr = addr
-	};
-
-	if (hash_table_remove(&db->set, &key))
-		return EOK;
-	else
-		return ENOENT;
-}
-
-/**
- * Test if the address is contained in the db
- *
- * @param	db
- * @param	addr	Tested addresss
- *
- * @return true if the address is in the db, false otherwise
- */
-bool nic_addr_db_contains(const nic_addr_db_t *db, const uint8_t *addr)
-{
-	assert(db && addr);
-
-	addr_key_t key = {
-		.len = db->addr_len,
-		.addr = addr
-	};
-
-	return 0 != hash_table_find(&db->set, &key);
-}
-
-/**
- * Helper structure for nic_addr_db_foreach
- */
-typedef struct {
-	void (*func)(const uint8_t *, void *);
-	void *arg;
-} nic_addr_db_fe_arg_t;
-
-/**
- * Helper function for nic_addr_db_foreach
- */
-static bool nic_addr_db_fe_helper(ht_link_t *item, void *arg)
-{
-	nic_addr_db_fe_arg_t *hs = (nic_addr_db_fe_arg_t *) arg;
-	nic_addr_entry_t *entry = member_to_inst(item, nic_addr_entry_t, link);
-	hs->func(entry->addr, hs->arg);
-	return true;
-}
-
-/**
- * Executes a user-defined function on all addresses in the DB. The function
- * must not change the addresses.
- *
- * @param	db
- * @param	func	User-defined function
- * @param	arg		Custom argument passed to the function
- */
-void nic_addr_db_foreach(const nic_addr_db_t *db,
-    void (*func)(const uint8_t *, void *), void *arg)
-{
-	nic_addr_db_fe_arg_t hs = { .func = func, .arg = arg };
-	hash_table_apply((hash_table_t *)&db->set, nic_addr_db_fe_helper, &hs);
-}
-
-/** @}
- */
Index: pace/lib/nic/src/nic_driver.c
===================================================================
--- uspace/lib/nic/src/nic_driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1136 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * Copyright (c) 2011 Jiri Michalec
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Internal implementation of general NIC operations
- */
-
-#include <assert.h>
-#include <fibril_synch.h>
-#include <ns.h>
-#include <stdio.h>
-#include <str_error.h>
-#include <sysinfo.h>
-#include <as.h>
-#include <ddf/interrupt.h>
-#include <ops/nic.h>
-#include <errno.h>
-
-#include "nic_driver.h"
-#include "nic_ev.h"
-#include "nic_impl.h"
-
-#define NIC_GLOBALS_MAX_CACHE_SIZE 16
-
-nic_globals_t nic_globals;
-
-/**
- * Initializes libraries required for NIC framework - logger
- *
- * @param name	Name of the device/driver (used in logging)
- */
-errno_t nic_driver_init(const char *name)
-{
-	list_initialize(&nic_globals.frame_list_cache);
-	nic_globals.frame_list_cache_size = 0;
-	list_initialize(&nic_globals.frame_cache);
-	nic_globals.frame_cache_size = 0;
-	fibril_mutex_initialize(&nic_globals.lock);
-
-	char buffer[256];
-	snprintf(buffer, 256, "drv/" DEVICE_CATEGORY_NIC "/%s", name);
-
-	return EOK;
-}
-
-/** Fill in the default implementations for device options and NIC interface.
- *
- * @param driver_ops
- * @param dev_ops
- * @param iface
- */
-void nic_driver_implement(driver_ops_t *driver_ops, ddf_dev_ops_t *dev_ops,
-    nic_iface_t *iface)
-{
-	if (dev_ops) {
-		if (!dev_ops->open)
-			dev_ops->open = nic_open_impl;
-		if (!dev_ops->close)
-			dev_ops->close = nic_close_impl;
-		if (!dev_ops->interfaces[NIC_DEV_IFACE])
-			dev_ops->interfaces[NIC_DEV_IFACE] = iface;
-		if (!dev_ops->default_handler)
-			dev_ops->default_handler = nic_default_handler_impl;
-	}
-
-	if (iface) {
-		if (!iface->get_state)
-			iface->get_state = nic_get_state_impl;
-		if (!iface->set_state)
-			iface->set_state = nic_set_state_impl;
-		if (!iface->send_frame)
-			iface->send_frame = nic_send_frame_impl;
-		if (!iface->callback_create)
-			iface->callback_create = nic_callback_create_impl;
-		if (!iface->get_address)
-			iface->get_address = nic_get_address_impl;
-		if (!iface->get_stats)
-			iface->get_stats = nic_get_stats_impl;
-		if (!iface->unicast_get_mode)
-			iface->unicast_get_mode = nic_unicast_get_mode_impl;
-		if (!iface->unicast_set_mode)
-			iface->unicast_set_mode = nic_unicast_set_mode_impl;
-		if (!iface->multicast_get_mode)
-			iface->multicast_get_mode = nic_multicast_get_mode_impl;
-		if (!iface->multicast_set_mode)
-			iface->multicast_set_mode = nic_multicast_set_mode_impl;
-		if (!iface->broadcast_get_mode)
-			iface->broadcast_get_mode = nic_broadcast_get_mode_impl;
-		if (!iface->broadcast_set_mode)
-			iface->broadcast_set_mode = nic_broadcast_set_mode_impl;
-		if (!iface->blocked_sources_get)
-			iface->blocked_sources_get = nic_blocked_sources_get_impl;
-		if (!iface->blocked_sources_set)
-			iface->blocked_sources_set = nic_blocked_sources_set_impl;
-		if (!iface->vlan_get_mask)
-			iface->vlan_get_mask = nic_vlan_get_mask_impl;
-		if (!iface->vlan_set_mask)
-			iface->vlan_set_mask = nic_vlan_set_mask_impl;
-		if (!iface->wol_virtue_add)
-			iface->wol_virtue_add = nic_wol_virtue_add_impl;
-		if (!iface->wol_virtue_remove)
-			iface->wol_virtue_remove = nic_wol_virtue_remove_impl;
-		if (!iface->wol_virtue_probe)
-			iface->wol_virtue_probe = nic_wol_virtue_probe_impl;
-		if (!iface->wol_virtue_list)
-			iface->wol_virtue_list = nic_wol_virtue_list_impl;
-		if (!iface->wol_virtue_get_caps)
-			iface->wol_virtue_get_caps = nic_wol_virtue_get_caps_impl;
-		if (!iface->poll_get_mode)
-			iface->poll_get_mode = nic_poll_get_mode_impl;
-		if (!iface->poll_set_mode)
-			iface->poll_set_mode = nic_poll_set_mode_impl;
-		if (!iface->poll_now)
-			iface->poll_now = nic_poll_now_impl;
-	}
-}
-
-/**
- * Setup send frame handler. This MUST be called in the add_device handler
- * if the nic_send_message_impl function is used for sending messages (filled
- * as send_message member of the nic_iface_t structure). The function must not
- * be called anywhere else.
- *
- * @param nic_data
- * @param sffunc	Function handling the send_frame request
- */
-void nic_set_send_frame_handler(nic_t *nic_data, send_frame_handler sffunc)
-{
-	nic_data->send_frame = sffunc;
-}
-
-/**
- * Setup event handlers for transitions between driver states.
- * This function can be called only in the add_device handler.
- *
- * @param on_activating	Called when device is going to the ACTIVE state.
- * @param on_going_down Called when device is going to the DOWN state.
- * @param on_stopping	Called when device is going to the STOP state.
- */
-void nic_set_state_change_handlers(nic_t *nic_data,
-    state_change_handler on_activating, state_change_handler on_going_down,
-    state_change_handler on_stopping)
-{
-	nic_data->on_activating = on_activating;
-	nic_data->on_going_down = on_going_down;
-	nic_data->on_stopping = on_stopping;
-}
-
-/**
- * Setup event handlers for changing the filtering modes.
- * This function can be called only in the add_device handler.
- *
- * @param nic_data
- * @param on_unicast_mode_change
- * @param on_multicast_mode_change
- * @param on_broadcast_mode_change
- * @param on_blocked_sources_change
- * @param on_vlan_mask_change
- */
-void nic_set_filtering_change_handlers(nic_t *nic_data,
-    unicast_mode_change_handler on_unicast_mode_change,
-    multicast_mode_change_handler on_multicast_mode_change,
-    broadcast_mode_change_handler on_broadcast_mode_change,
-    blocked_sources_change_handler on_blocked_sources_change,
-    vlan_mask_change_handler on_vlan_mask_change)
-{
-	nic_data->on_unicast_mode_change = on_unicast_mode_change;
-	nic_data->on_multicast_mode_change = on_multicast_mode_change;
-	nic_data->on_broadcast_mode_change = on_broadcast_mode_change;
-	nic_data->on_blocked_sources_change = on_blocked_sources_change;
-	nic_data->on_vlan_mask_change = on_vlan_mask_change;
-}
-
-/**
- * Setup filters for WOL virtues add and removal.
- * This function can be called only in the add_device handler. Both handlers
- * must be set or none of them.
- *
- * @param on_wv_add		Called when a virtue is added
- * @param on_wv_remove	Called when a virtue is removed
- */
-void nic_set_wol_virtue_change_handlers(nic_t *nic_data,
-    wol_virtue_add_handler on_wv_add, wol_virtue_remove_handler on_wv_remove)
-{
-	assert(on_wv_add != NULL && on_wv_remove != NULL);
-	nic_data->on_wol_virtue_add = on_wv_add;
-	nic_data->on_wol_virtue_remove = on_wv_remove;
-}
-
-/**
- * Setup poll handlers.
- * This function can be called only in the add_device handler.
- *
- * @param on_poll_mode_change	Called when the mode is about to be changed
- * @param on_poll_request		Called when poll request is triggered
- */
-void nic_set_poll_handlers(nic_t *nic_data,
-    poll_mode_change_handler on_poll_mode_change, poll_request_handler on_poll_req)
-{
-	nic_data->on_poll_mode_change = on_poll_mode_change;
-	nic_data->on_poll_request = on_poll_req;
-}
-
-/**
- * Connect to the parent's driver and get HW resources list in parsed format.
- * Note: this function should be called only from add_device handler, therefore
- * we don't need to use locks.
- *
- * @param		nic_data
- * @param[out]	resources	Parsed lists of resources.
- *
- * @return EOK or an error code
- */
-errno_t nic_get_resources(nic_t *nic_data, hw_res_list_parsed_t *resources)
-{
-	ddf_dev_t *dev = nic_data->dev;
-	async_sess_t *parent_sess;
-
-	/* Connect to the parent's driver. */
-	parent_sess = ddf_dev_parent_sess_get(dev);
-	if (parent_sess == NULL)
-		return EIO;
-
-	return hw_res_get_list_parsed(parent_sess, resources, 0);
-}
-
-/** Allocate frame
- *
- *  @param nic_data 	The NIC driver data
- *  @param size	        Frame size in bytes
- *  @return pointer to allocated frame if success, NULL otherwise
- */
-nic_frame_t *nic_alloc_frame(nic_t *nic_data, size_t size)
-{
-	nic_frame_t *frame;
-	fibril_mutex_lock(&nic_globals.lock);
-	if (nic_globals.frame_cache_size > 0) {
-		link_t *first = list_first(&nic_globals.frame_cache);
-		list_remove(first);
-		nic_globals.frame_cache_size--;
-		frame = list_get_instance(first, nic_frame_t, link);
-		fibril_mutex_unlock(&nic_globals.lock);
-	} else {
-		fibril_mutex_unlock(&nic_globals.lock);
-		frame = malloc(sizeof(nic_frame_t));
-		if (!frame)
-			return NULL;
-
-		link_initialize(&frame->link);
-	}
-
-	frame->data = malloc(size);
-	if (frame->data == NULL) {
-		free(frame);
-		return NULL;
-	}
-
-	frame->size = size;
-	return frame;
-}
-
-/** Release frame
- *
- * @param nic_data	The driver data
- * @param frame		The frame to release
- */
-void nic_release_frame(nic_t *nic_data, nic_frame_t *frame)
-{
-	if (!frame)
-		return;
-
-	if (frame->data != NULL) {
-		free(frame->data);
-		frame->data = NULL;
-		frame->size = 0;
-	}
-
-	fibril_mutex_lock(&nic_globals.lock);
-	if (nic_globals.frame_cache_size >= NIC_GLOBALS_MAX_CACHE_SIZE) {
-		fibril_mutex_unlock(&nic_globals.lock);
-		free(frame);
-	} else {
-		list_prepend(&frame->link, &nic_globals.frame_cache);
-		nic_globals.frame_cache_size++;
-		fibril_mutex_unlock(&nic_globals.lock);
-	}
-}
-
-/**
- * Allocate a new frame list
- *
- * @return New frame list or NULL on error.
- */
-nic_frame_list_t *nic_alloc_frame_list(void)
-{
-	nic_frame_list_t *frames;
-	fibril_mutex_lock(&nic_globals.lock);
-
-	if (nic_globals.frame_list_cache_size > 0) {
-		frames =
-		    list_get_instance(list_first(&nic_globals.frame_list_cache),
-		    nic_frame_list_t, head);
-		list_remove(&frames->head);
-		list_initialize(frames);
-		nic_globals.frame_list_cache_size--;
-		fibril_mutex_unlock(&nic_globals.lock);
-	} else {
-		fibril_mutex_unlock(&nic_globals.lock);
-
-		frames = malloc(sizeof (nic_frame_list_t));
-		if (frames != NULL)
-			list_initialize(frames);
-	}
-
-	return frames;
-}
-
-static void nic_driver_release_frame_list(nic_frame_list_t *frames)
-{
-	if (!frames)
-		return;
-	fibril_mutex_lock(&nic_globals.lock);
-	if (nic_globals.frame_list_cache_size >= NIC_GLOBALS_MAX_CACHE_SIZE) {
-		fibril_mutex_unlock(&nic_globals.lock);
-		free(frames);
-	} else {
-		list_prepend(&frames->head, &nic_globals.frame_list_cache);
-		nic_globals.frame_list_cache_size++;
-		fibril_mutex_unlock(&nic_globals.lock);
-	}
-}
-
-/**
- * Append a frame to the frame list
- *
- * @param frames	Frame list
- * @param frame		Appended frame
- */
-void nic_frame_list_append(nic_frame_list_t *frames,
-    nic_frame_t *frame)
-{
-	assert(frame != NULL && frames != NULL);
-	list_append(&frame->link, frames);
-}
-
-/** Get the polling mode information from the device
- *
- *	The main lock should be locked, otherwise the inconsistency between
- *	mode and period can occure.
- *
- *  @param nic_data The controller data
- *  @param period [out] The the period. Valid only if mode == NIC_POLL_PERIODIC
- *  @return Current polling mode of the controller
- */
-nic_poll_mode_t nic_query_poll_mode(nic_t *nic_data, struct timespec *period)
-{
-	if (period)
-		*period = nic_data->poll_period;
-	return nic_data->poll_mode;
-}
-
-/** Inform the NICF about poll mode
- *
- *  @param nic_data The controller data
- *  @param mode
- *  @param period [out] The the period. Valid only if mode == NIC_POLL_PERIODIC
- *  @return EOK
- *  @return EINVAL
- */
-errno_t nic_report_poll_mode(nic_t *nic_data, nic_poll_mode_t mode,
-    struct timespec *period)
-{
-	errno_t rc = EOK;
-	fibril_rwlock_write_lock(&nic_data->main_lock);
-	nic_data->poll_mode = mode;
-	nic_data->default_poll_mode = mode;
-	if (mode == NIC_POLL_PERIODIC) {
-		if (period) {
-			memcpy(&nic_data->default_poll_period, period, sizeof(struct timespec));
-			memcpy(&nic_data->poll_period, period, sizeof(struct timespec));
-		} else {
-			rc = EINVAL;
-		}
-	}
-	fibril_rwlock_write_unlock(&nic_data->main_lock);
-	return rc;
-}
-
-/** Inform the NICF about device's MAC address.
- *
- * @return EOK On success
- *
- */
-errno_t nic_report_address(nic_t *nic_data, const nic_address_t *address)
-{
-	assert(nic_data);
-
-	if (address->address[0] & 1)
-		return EINVAL;
-
-	fibril_rwlock_write_lock(&nic_data->main_lock);
-
-	/* Notify NIL layer (and uppper) if bound - not in add_device */
-	if (nic_data->client_session != NULL) {
-		errno_t rc = nic_ev_addr_changed(nic_data->client_session,
-		    address);
-
-		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&nic_data->main_lock);
-			return rc;
-		}
-	}
-
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-
-	/*
-	 * The initial address (all zeroes) shouldn't be
-	 * there and we will ignore that error -- in next
-	 * calls this should not happen.
-	 */
-	errno_t rc = nic_rxc_set_addr(&nic_data->rx_control,
-	    &nic_data->mac, address);
-
-	/* For the first time also record the default MAC */
-	if (MAC_IS_ZERO(nic_data->default_mac.address)) {
-		assert(MAC_IS_ZERO(nic_data->mac.address));
-		memcpy(&nic_data->default_mac, address, sizeof(nic_address_t));
-	}
-
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-
-	if ((rc != EOK) && (rc != ENOENT)) {
-		fibril_rwlock_write_unlock(&nic_data->main_lock);
-		return rc;
-	}
-
-	memcpy(&nic_data->mac, address, sizeof(nic_address_t));
-
-	fibril_rwlock_write_unlock(&nic_data->main_lock);
-
-	return EOK;
-}
-
-/**
- * Used to obtain devices MAC address.
- *
- * The main lock should be locked, otherwise the inconsistent address
- * can be returend.
- *
- * @param nic_data The controller data
- * @param address The output for address.
- */
-void nic_query_address(nic_t *nic_data, nic_address_t *addr)
-{
-	if (!addr)
-		return;
-
-	memcpy(addr, &nic_data->mac, sizeof(nic_address_t));
-}
-
-/**
- * The busy flag can be set to 1 only in the send_frame handler, to 0 it can
- * be set anywhere.
- *
- * @param nic_data
- * @param busy
- */
-void nic_set_tx_busy(nic_t *nic_data, int busy)
-{
-	/*
-	 * When the function is called in send_frame handler the main lock is
-	 * locked so no race can happen.
-	 * Otherwise, when it is unexpectedly set to 0 (even with main lock held
-	 * by other fibril) it cannot crash anything.
-	 */
-	nic_data->tx_busy = busy;
-}
-
-/**
- * This is the function that the driver should call when it receives a frame.
- * The frame is checked by filters and then sent up to the NIL layer or
- * discarded. The frame is released.
- *
- * @param nic_data
- * @param frame		The received frame
- */
-void nic_received_frame(nic_t *nic_data, nic_frame_t *frame)
-{
-	/*
-	 * Note: this function must not lock main lock, because loopback driver
-	 * 		 calls it inside send_frame handler (with locked main lock)
-	 */
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	nic_frame_type_t frame_type;
-	bool check = nic_rxc_check(&nic_data->rx_control, frame->data,
-	    frame->size, &frame_type);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	/* Update statistics */
-	fibril_rwlock_write_lock(&nic_data->stats_lock);
-
-	if (nic_data->state == NIC_STATE_ACTIVE && check) {
-		nic_data->stats.receive_packets++;
-		nic_data->stats.receive_bytes += frame->size;
-		switch (frame_type) {
-		case NIC_FRAME_MULTICAST:
-			nic_data->stats.receive_multicast++;
-			break;
-		case NIC_FRAME_BROADCAST:
-			nic_data->stats.receive_broadcast++;
-			break;
-		default:
-			break;
-		}
-		fibril_rwlock_write_unlock(&nic_data->stats_lock);
-		nic_ev_received(nic_data->client_session, frame->data,
-		    frame->size);
-	} else {
-		switch (frame_type) {
-		case NIC_FRAME_UNICAST:
-			nic_data->stats.receive_filtered_unicast++;
-			break;
-		case NIC_FRAME_MULTICAST:
-			nic_data->stats.receive_filtered_multicast++;
-			break;
-		case NIC_FRAME_BROADCAST:
-			nic_data->stats.receive_filtered_broadcast++;
-			break;
-		}
-		fibril_rwlock_write_unlock(&nic_data->stats_lock);
-	}
-	nic_release_frame(nic_data, frame);
-}
-
-/**
- * Some NICs can receive multiple frames during single interrupt. These can
- * send them in whole list of frames (actually nic_frame_t structures), then
- * the list is deallocated and each frame is passed to the
- * nic_received_packet function.
- *
- * @param nic_data
- * @param frames		List of received frames
- */
-void nic_received_frame_list(nic_t *nic_data, nic_frame_list_t *frames)
-{
-	if (frames == NULL)
-		return;
-	while (!list_empty(frames)) {
-		nic_frame_t *frame =
-		    list_get_instance(list_first(frames), nic_frame_t, link);
-
-		list_remove(&frame->link);
-		nic_received_frame(nic_data, frame);
-	}
-	nic_driver_release_frame_list(frames);
-}
-
-/** Allocate and initialize the driver data.
- *
- * @return Allocated structure or NULL.
- *
- */
-static nic_t *nic_create(ddf_dev_t *dev)
-{
-	nic_t *nic_data = ddf_dev_data_alloc(dev, sizeof(nic_t));
-	if (nic_data == NULL)
-		return NULL;
-
-	/* Force zero to all uninitialized fields (e.g. added in future) */
-	if (nic_rxc_init(&nic_data->rx_control) != EOK) {
-		return NULL;
-	}
-
-	if (nic_wol_virtues_init(&nic_data->wol_virtues) != EOK) {
-		return NULL;
-	}
-
-	nic_data->dev = NULL;
-	nic_data->fun = NULL;
-	nic_data->state = NIC_STATE_STOPPED;
-	nic_data->client_session = NULL;
-	nic_data->poll_mode = NIC_POLL_IMMEDIATE;
-	nic_data->default_poll_mode = NIC_POLL_IMMEDIATE;
-	nic_data->send_frame = NULL;
-	nic_data->on_activating = NULL;
-	nic_data->on_going_down = NULL;
-	nic_data->on_stopping = NULL;
-	nic_data->specific = NULL;
-
-	fibril_rwlock_initialize(&nic_data->main_lock);
-	fibril_rwlock_initialize(&nic_data->stats_lock);
-	fibril_rwlock_initialize(&nic_data->rxc_lock);
-	fibril_rwlock_initialize(&nic_data->wv_lock);
-
-	memset(&nic_data->mac, 0, sizeof(nic_address_t));
-	memset(&nic_data->default_mac, 0, sizeof(nic_address_t));
-	memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));
-
-	return nic_data;
-}
-
-/** Create NIC structure for the device and bind it to dev_fun_t
- *
- * The pointer to the created and initialized NIC structure will
- * be stored in device->nic_data.
- *
- * @param device The NIC device structure
- *
- * @return Pointer to created nic_t structure or NULL
- *
- */
-nic_t *nic_create_and_bind(ddf_dev_t *device)
-{
-	nic_t *nic_data = nic_create(device);
-	if (!nic_data)
-		return NULL;
-
-	nic_data->dev = device;
-
-	return nic_data;
-}
-
-/**
- * Hangs up the phones in the structure, deallocates specific data and then
- * the structure itself.
- *
- * @param data
- */
-static void nic_destroy(nic_t *nic_data)
-{
-	free(nic_data->specific);
-}
-
-/**
- * Unbind and destroy nic_t stored in ddf_dev_t.nic_data.
- * The ddf_dev_t.nic_data will be set to NULL, specific driver data will be
- * destroyed.
- *
- * @param device The NIC device structure
- */
-void nic_unbind_and_destroy(ddf_dev_t *device)
-{
-	nic_destroy(nic_get_from_ddf_dev(device));
-	return;
-}
-
-/**
- * Set information about current HW filtering.
- *  1 ...	Only those frames we want to receive are passed through HW
- *  0 ...	The HW filtering is imperfect
- * -1 ...	Don't change the setting
- * Can be called only from the on_*_change handler.
- *
- * @param	nic_data
- * @param	unicast_exact	Unicast frames
- * @param	mcast_exact		Multicast frames
- * @param	vlan_exact		VLAN tags
- */
-void nic_report_hw_filtering(nic_t *nic_data,
-    int unicast_exact, int multicast_exact, int vlan_exact)
-{
-	nic_rxc_hw_filtering(&nic_data->rx_control,
-	    unicast_exact, multicast_exact, vlan_exact);
-}
-
-/**
- * Computes hash for the address list based on standard multicast address
- * hashing.
- *
- * @param address_list
- * @param count
- *
- * @return Multicast hash
- *
- * @see multicast_hash
- */
-uint64_t nic_mcast_hash(const nic_address_t *list, size_t count)
-{
-	return nic_rxc_mcast_hash(list, count);
-}
-
-/**
- * Computes hash for multicast addresses currently set up in the RX multicast
- * filtering. For promiscuous mode returns all ones, for blocking all zeroes.
- * Can be called only from the state change handlers (on_activating,
- * on_going_down and on_stopping).
- *
- * @param nic_data
- *
- * @return Multicast hash
- *
- * @see multicast_hash
- */
-uint64_t nic_query_mcast_hash(nic_t *nic_data)
-{
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	uint64_t hash = nic_rxc_multicast_get_hash(&nic_data->rx_control);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return hash;
-}
-
-/**
- * Queries the current mode of unicast frames receiving.
- * Can be called only from the on_*_change handler.
- *
- * @param nic_data
- * @param mode			The new unicast mode
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of addresses in the list
- */
-void nic_query_unicast(const nic_t *nic_data,
-    nic_unicast_mode_t *mode,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	assert(mode != NULL);
-	nic_rxc_unicast_get_mode(&nic_data->rx_control, mode,
-	    max_count, address_list, address_count);
-}
-
-/**
- * Queries the current mode of multicast frames receiving.
- * Can be called only from the on_*_change handler.
- *
- * @param nic_data
- * @param mode			The current multicast mode
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of addresses in the list
- */
-void nic_query_multicast(const nic_t *nic_data,
-    nic_multicast_mode_t *mode,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	assert(mode != NULL);
-	nic_rxc_multicast_get_mode(&nic_data->rx_control, mode,
-	    max_count, address_list, address_count);
-}
-
-/**
- * Queries the current mode of broadcast frames receiving.
- * Can be called only from the on_*_change handler.
- *
- * @param nic_data
- * @param mode			The new broadcast mode
- */
-void nic_query_broadcast(const nic_t *nic_data,
-    nic_broadcast_mode_t *mode)
-{
-	assert(mode != NULL);
-	nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode);
-}
-
-/**
- * Queries the current blocked source addresses.
- * Can be called only from the on_*_change handler.
- *
- * @param nic_data
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of addresses in the list
- */
-void nic_query_blocked_sources(const nic_t *nic_data,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	nic_rxc_blocked_sources_get(&nic_data->rx_control,
-	    max_count, address_list, address_count);
-}
-
-/**
- * Query mask used for filtering according to the VLAN tags.
- * Can be called only from the on_*_change handler.
- *
- * @param nic_data
- * @param mask		Must be 512 bytes long
- *
- * @return EOK
- * @return ENOENT
- */
-errno_t nic_query_vlan_mask(const nic_t *nic_data, nic_vlan_mask_t *mask)
-{
-	assert(mask);
-	return nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
-}
-
-/**
- * Query maximum number of WOL virtues of specified type allowed on the device.
- * Can be called only from add_device and on_wol_virtue_* handlers.
- *
- * @param nic_data
- * @param type		The type of the WOL virtues
- *
- * @return	Maximal number of allowed virtues of this type. -1 means this type
- * 			is not supported at all.
- */
-int nic_query_wol_max_caps(const nic_t *nic_data, nic_wv_type_t type)
-{
-	return nic_data->wol_virtues.caps_max[type];
-}
-
-/**
- * Sets maximum number of WOL virtues of specified type allowed on the device.
- * Can be called only from add_device and on_wol_virtue_* handlers.
- *
- * @param nic_data
- * @param type		The type of the WOL virtues
- * @param count		Maximal number of allowed virtues of this type. -1 means
- * 					this type is not supported at all.
- */
-void nic_set_wol_max_caps(nic_t *nic_data, nic_wv_type_t type, int count)
-{
-	nic_data->wol_virtues.caps_max[type] = count;
-}
-
-/**
- * @param nic_data
- * @return The driver-specific structure for this NIC.
- */
-void *nic_get_specific(nic_t *nic_data)
-{
-	return nic_data->specific;
-}
-
-/**
- * @param nic_data
- * @param specific The driver-specific structure for this NIC.
- */
-void nic_set_specific(nic_t *nic_data, void *specific)
-{
-	nic_data->specific = specific;
-}
-
-/**
- * You can call the function only from one of the state change handlers.
- * @param	nic_data
- * @return	Current state of the NIC, prior to the actually executed change
- */
-nic_device_state_t nic_query_state(nic_t *nic_data)
-{
-	return nic_data->state;
-}
-
-/**
- * @param nic_data
- * @return DDF device associated with this NIC.
- */
-ddf_dev_t *nic_get_ddf_dev(nic_t *nic_data)
-{
-	return nic_data->dev;
-}
-
-/**
- * @param nic_data
- * @return DDF function associated with this NIC.
- */
-ddf_fun_t *nic_get_ddf_fun(nic_t *nic_data)
-{
-	return nic_data->fun;
-}
-
-/**
- * @param nic_data
- * @param fun
- */
-void nic_set_ddf_fun(nic_t *nic_data, ddf_fun_t *fun)
-{
-	nic_data->fun = fun;
-}
-
-/**
- * @param dev DDF device associated with NIC
- * @return The associated NIC structure
- */
-nic_t *nic_get_from_ddf_dev(ddf_dev_t *dev)
-{
-	return (nic_t *) ddf_dev_data_get(dev);
-}
-
-/**
- * @param dev DDF function associated with NIC
- * @return The associated NIC structure
- */
-nic_t *nic_get_from_ddf_fun(ddf_fun_t *fun)
-{
-	return (nic_t *) ddf_dev_data_get(ddf_fun_get_dev(fun));
-}
-
-/**
- * Raises the send_packets and send_bytes in device statistics.
- *
- * @param nic_data
- * @param packets	Number of received packets
- * @param bytes		Number of received bytes
- */
-void nic_report_send_ok(nic_t *nic_data, size_t packets, size_t bytes)
-{
-	fibril_rwlock_write_lock(&nic_data->stats_lock);
-	nic_data->stats.send_packets += packets;
-	nic_data->stats.send_bytes += bytes;
-	fibril_rwlock_write_unlock(&nic_data->stats_lock);
-}
-
-/**
- * Raises total error counter (send_errors) and the concrete send error counter
- * determined by the cause argument.
- *
- * @param nic_data
- * @param cause		The concrete error cause.
- */
-void nic_report_send_error(nic_t *nic_data, nic_send_error_cause_t cause,
-    unsigned count)
-{
-	if (count == 0)
-		return;
-
-	fibril_rwlock_write_lock(&nic_data->stats_lock);
-	nic_data->stats.send_errors += count;
-	switch (cause) {
-	case NIC_SEC_BUFFER_FULL:
-		nic_data->stats.send_dropped += count;
-		break;
-	case NIC_SEC_ABORTED:
-		nic_data->stats.send_aborted_errors += count;
-		break;
-	case NIC_SEC_CARRIER_LOST:
-		nic_data->stats.send_carrier_errors += count;
-		break;
-	case NIC_SEC_FIFO_OVERRUN:
-		nic_data->stats.send_fifo_errors += count;
-		break;
-	case NIC_SEC_HEARTBEAT:
-		nic_data->stats.send_heartbeat_errors += count;
-		break;
-	case NIC_SEC_WINDOW_ERROR:
-		nic_data->stats.send_window_errors += count;
-		break;
-	case NIC_SEC_OTHER:
-		break;
-	}
-	fibril_rwlock_write_unlock(&nic_data->stats_lock);
-}
-
-/**
- * Raises total error counter (receive_errors) and the concrete receive error
- * counter determined by the cause argument.
- *
- * @param nic_data
- * @param cause		The concrete error cause
- */
-void nic_report_receive_error(nic_t *nic_data,
-    nic_receive_error_cause_t cause, unsigned count)
-{
-	fibril_rwlock_write_lock(&nic_data->stats_lock);
-	nic_data->stats.receive_errors += count;
-	switch (cause) {
-	case NIC_REC_BUFFER_FULL:
-		nic_data->stats.receive_dropped += count;
-		break;
-	case NIC_REC_LENGTH:
-		nic_data->stats.receive_length_errors += count;
-		break;
-	case NIC_REC_BUFFER_OVERFLOW:
-		nic_data->stats.receive_dropped += count;
-		break;
-	case NIC_REC_CRC:
-		nic_data->stats.receive_crc_errors += count;
-		break;
-	case NIC_REC_FRAME_ALIGNMENT:
-		nic_data->stats.receive_frame_errors += count;
-		break;
-	case NIC_REC_FIFO_OVERRUN:
-		nic_data->stats.receive_fifo_errors += count;
-		break;
-	case NIC_REC_MISSED:
-		nic_data->stats.receive_missed_errors += count;
-		break;
-	case NIC_REC_OTHER:
-		break;
-	}
-	fibril_rwlock_write_unlock(&nic_data->stats_lock);
-}
-
-/**
- * Raises the collisions counter in device statistics.
- */
-void nic_report_collisions(nic_t *nic_data, unsigned count)
-{
-	fibril_rwlock_write_lock(&nic_data->stats_lock);
-	nic_data->stats.collisions += count;
-	fibril_rwlock_write_unlock(&nic_data->stats_lock);
-}
-
-/** Just wrapper for checking nonzero time interval
- *
- *  @oaram t The interval to check
- *  @returns Zero if the t is nonzero interval
- *  @returns Nonzero if t is zero interval
- */
-static int timespec_nonpositive(struct timespec t)
-{
-	return (t.tv_sec <= 0) && (t.tv_nsec <= 0);
-}
-
-/** Main function of software period fibrill
- *
- *  Just calls poll() in the nic->poll_period period
- *
- *  @param  data The NIC structure pointer
- *
- *  @return 0, never reached
- */
-static errno_t period_fibril_fun(void *data)
-{
-	nic_t *nic = data;
-	struct sw_poll_info *info = &nic->sw_poll_info;
-	while (true) {
-		fibril_rwlock_read_lock(&nic->main_lock);
-		int run = info->run;
-		int running = info->running;
-		struct timespec remaining = nic->poll_period;
-		fibril_rwlock_read_unlock(&nic->main_lock);
-
-		if (!running) {
-			remaining.tv_sec = 5;
-			remaining.tv_nsec = 0;
-		}
-
-		/* Wait the period (keep attention to overflows) */
-		while (!timespec_nonpositive(remaining)) {
-			usec_t wait = 0;
-			if (remaining.tv_sec > 0) {
-				time_t wait_sec = remaining.tv_sec;
-				/*
-				 * wait maximaly 5 seconds to get reasonable reaction time
-				 * when period is reset
-				 */
-				if (wait_sec > 5)
-					wait_sec = 5;
-
-				wait = SEC2USEC(wait_sec);
-
-				remaining.tv_sec -= wait_sec;
-			} else {
-				wait = NSEC2USEC(remaining.tv_nsec);
-
-				if (wait > 5 * 1000000) {
-					wait = 5 * 1000000;
-				}
-
-				remaining.tv_nsec -= USEC2NSEC(wait);
-			}
-			fibril_usleep(wait);
-
-			/* Check if the period was not reset */
-			if (info->run != run)
-				break;
-		}
-
-		/* Provide polling if the period finished */
-		fibril_rwlock_read_lock(&nic->main_lock);
-		if (info->running && info->run == run) {
-			nic->on_poll_request(nic);
-		}
-		fibril_rwlock_read_unlock(&nic->main_lock);
-	}
-	return EOK;
-}
-
-/** Starts software periodic polling
- *
- *  Reset to new period if the original period was running
- *
- *  @param nic_data Nic data structure
- */
-void nic_sw_period_start(nic_t *nic_data)
-{
-	/* Create the fibril if it is not crated */
-	if (nic_data->sw_poll_info.fibril == 0) {
-		nic_data->sw_poll_info.fibril = fibril_create(period_fibril_fun,
-		    nic_data);
-		nic_data->sw_poll_info.running = 0;
-		nic_data->sw_poll_info.run = 0;
-
-		/* Start fibril */
-		fibril_add_ready(nic_data->sw_poll_info.fibril);
-	}
-
-	/* Inform fibril about running with new period */
-	nic_data->sw_poll_info.run = (nic_data->sw_poll_info.run + 1) % 100;
-	nic_data->sw_poll_info.running = 1;
-}
-
-/** Stops software periodic polling
- *
- *  @param nic_data Nic data structure
- */
-void nic_sw_period_stop(nic_t *nic_data)
-{
-	nic_data->sw_poll_info.running = 0;
-}
-
-/** @}
- */
Index: pace/lib/nic/src/nic_ev.c
===================================================================
--- uspace/lib/nic/src/nic_ev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <async.h>
-#include <nic_iface.h>
-#include <errno.h>
-#include "nic_ev.h"
-
-/** Device address changed. */
-errno_t nic_ev_addr_changed(async_sess_t *sess, const nic_address_t *addr)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, NIC_EV_ADDR_CHANGED, &answer);
-	errno_t retval = async_data_write_start(exch, addr,
-	    sizeof(nic_address_t));
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-/** Device state changed. */
-errno_t nic_ev_device_state(async_sess_t *sess, sysarg_t state)
-{
-	errno_t rc;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	rc = async_req_1_0(exch, NIC_EV_DEVICE_STATE, state);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Frame received. */
-errno_t nic_ev_received(async_sess_t *sess, void *data, size_t size)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, NIC_EV_RECEIVED, &answer);
-	errno_t retval = async_data_write_start(exch, data, size);
-
-	async_exchange_end(exch);
-
-	if (retval != EOK) {
-		async_forget(req);
-		return retval;
-	}
-
-	async_wait_for(req, &retval);
-	return retval;
-}
-
-/** @}
- */
Index: pace/lib/nic/src/nic_impl.c
===================================================================
--- uspace/lib/nic/src/nic_impl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,846 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Default DDF NIC interface methods implementations
- */
-
-#include <errno.h>
-#include <str_error.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include "nic_driver.h"
-#include "nic_ev.h"
-#include "nic_impl.h"
-
-/**
- * Default implementation of the set_state method. Trivial.
- *
- * @param		fun
- * @param[out]	state
- *
- * @return EOK always.
- */
-errno_t nic_get_state_impl(ddf_fun_t *fun, nic_device_state_t *state)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->main_lock);
-	*state = nic_data->state;
-	fibril_rwlock_read_unlock(&nic_data->main_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the set_state method. Changes the internal
- * driver's state, calls the appropriate callback and notifies the NIL service
- * about this change.
- *
- * @param	fun
- * @param	state	The new device's state
- *
- * @return EOK		If the state was changed
- * @return EINVAL	If the state cannot be changed
- */
-errno_t nic_set_state_impl(ddf_fun_t *fun, nic_device_state_t state)
-{
-	if (state >= NIC_STATE_MAX) {
-		return EINVAL;
-	}
-
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-
-	fibril_rwlock_write_lock(&nic_data->main_lock);
-	if (nic_data->state == state) {
-		/* No change, nothing to do */
-		fibril_rwlock_write_unlock(&nic_data->main_lock);
-		return EOK;
-	}
-	if (state == NIC_STATE_ACTIVE) {
-		if (nic_data->client_session == NULL) {
-			fibril_rwlock_write_unlock(&nic_data->main_lock);
-			return EINVAL;
-		}
-	}
-
-	state_change_handler event_handler = NULL;
-	switch (state) {
-	case NIC_STATE_STOPPED:
-		event_handler = nic_data->on_stopping;
-		break;
-	case NIC_STATE_DOWN:
-		event_handler = nic_data->on_going_down;
-		break;
-	case NIC_STATE_ACTIVE:
-		event_handler = nic_data->on_activating;
-		break;
-	default:
-		break;
-	}
-	if (event_handler != NULL) {
-		errno_t rc = event_handler(nic_data);
-		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&nic_data->main_lock);
-			return EINVAL;
-		}
-	}
-
-	if (state == NIC_STATE_STOPPED) {
-		/* Notify upper layers that we are reseting the MAC */
-		errno_t rc = nic_ev_addr_changed(nic_data->client_session,
-		    &nic_data->default_mac);
-		nic_data->poll_mode = nic_data->default_poll_mode;
-		memcpy(&nic_data->poll_period, &nic_data->default_poll_period,
-		    sizeof(struct timespec));
-		if (rc != EOK) {
-			/*
-			 * We have already ran the on stopped handler, even if we
-			 * terminated the state change we would end up in undefined state.
-			 * Therefore we just log the problem.
-			 */
-		}
-
-		fibril_rwlock_write_lock(&nic_data->stats_lock);
-		memset(&nic_data->stats, 0, sizeof(nic_device_stats_t));
-		fibril_rwlock_write_unlock(&nic_data->stats_lock);
-
-		fibril_rwlock_write_lock(&nic_data->rxc_lock);
-		nic_rxc_clear(&nic_data->rx_control);
-		/* Reinsert device's default MAC */
-		nic_rxc_set_addr(&nic_data->rx_control, NULL,
-		    &nic_data->default_mac);
-		fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-		memcpy(&nic_data->mac, &nic_data->default_mac, sizeof (nic_address_t));
-
-		fibril_rwlock_write_lock(&nic_data->wv_lock);
-		nic_wol_virtues_clear(&nic_data->wol_virtues);
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-
-		/* Ensure stopping period of NIC_POLL_SOFTWARE_PERIODIC */
-		nic_sw_period_stop(nic_data);
-	}
-
-	nic_data->state = state;
-
-	nic_ev_device_state(nic_data->client_session, state);
-
-	fibril_rwlock_write_unlock(&nic_data->main_lock);
-
-	return EOK;
-}
-
-/**
- * Default implementation of the send_frame method.
- * Send messages to the network.
- *
- * @param	fun
- * @param	data	Frame data
- * @param 	size	Frame size in bytes
- *
- * @return EOK		If the message was sent
- * @return EBUSY	If the device is not in state when the frame can be sent.
- */
-errno_t nic_send_frame_impl(ddf_fun_t *fun, void *data, size_t size)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-
-	fibril_rwlock_read_lock(&nic_data->main_lock);
-	if (nic_data->state != NIC_STATE_ACTIVE || nic_data->tx_busy) {
-		fibril_rwlock_read_unlock(&nic_data->main_lock);
-		return EBUSY;
-	}
-
-	nic_data->send_frame(nic_data, data, size);
-	fibril_rwlock_read_unlock(&nic_data->main_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the connect_client method.
- * Creates callback connection to the client.
- *
- * @param	fun
- *
- * @return EOK		On success, or an error code.
- */
-errno_t nic_callback_create_impl(ddf_fun_t *fun)
-{
-	nic_t *nic = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic->main_lock);
-
-	nic->client_session = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (nic->client_session == NULL) {
-		fibril_rwlock_write_unlock(&nic->main_lock);
-		return ENOMEM;
-	}
-
-	fibril_rwlock_write_unlock(&nic->main_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the get_address method.
- * Retrieves the NIC's physical address.
- *
- * @param	fun
- * @param	address	Pointer to the structure where the address will be stored.
- *
- * @return EOK		If the services were bound
- * @return ELIMIT	If the buffer is too short
- */
-errno_t nic_get_address_impl(ddf_fun_t *fun, nic_address_t *address)
-{
-	assert(address);
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->main_lock);
-	memcpy(address, &nic_data->mac, sizeof (nic_address_t));
-	fibril_rwlock_read_unlock(&nic_data->main_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the get_stats method. Copies the statistics from
- * the drivers data to supplied buffer.
- *
- * @param		fun
- * @param[out]	stats	The buffer for statistics
- *
- * @return EOK (cannot fail)
- */
-errno_t nic_get_stats_impl(ddf_fun_t *fun, nic_device_stats_t *stats)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	assert (stats != NULL);
-	fibril_rwlock_read_lock(&nic_data->stats_lock);
-	memcpy(stats, &nic_data->stats, sizeof (nic_device_stats_t));
-	fibril_rwlock_read_unlock(&nic_data->stats_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of unicast_get_mode method.
- *
- * @param		fun
- * @param[out]	mode		Current operation mode
- * @param[in]	max_count	Max number of addresses that can be written into the
- * 							buffer (addr_list).
- * @param[out]	addr_list	Buffer for addresses
- * @param[out]	addr_count	Number of addresses written into the list
- *
- * @return EOK
- */
-errno_t nic_unicast_get_mode_impl(ddf_fun_t *fun, nic_unicast_mode_t *mode,
-    size_t max_count, nic_address_t *addr_list, size_t *addr_count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	nic_rxc_unicast_get_mode(&nic_data->rx_control, mode, max_count,
-	    addr_list, addr_count);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of unicast_set_mode method.
- *
- * @param		fun
- * @param[in]	mode		New operation mode
- * @param[in]	addr_list	List of unicast addresses
- * @param[in]	addr_count	Number of addresses in the list
- *
- * @return EOK
- * @return EINVAL
- * @return ENOTSUP
- * @return ENOMEM
- */
-errno_t nic_unicast_set_mode_impl(ddf_fun_t *fun,
-    nic_unicast_mode_t mode, const nic_address_t *addr_list, size_t addr_count)
-{
-	assert((addr_count == 0 && addr_list == NULL) ||
-	    (addr_count != 0 && addr_list != NULL));
-	size_t i;
-	for (i = 0; i < addr_count; ++i) {
-		if (addr_list[i].address[0] & 1)
-			return EINVAL;
-	}
-
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
-	if (nic_data->on_unicast_mode_change) {
-		rc = nic_data->on_unicast_mode_change(nic_data,
-		    mode, addr_list, addr_count);
-	}
-	if (rc == EOK) {
-		rc = nic_rxc_unicast_set_mode(&nic_data->rx_control, mode,
-		    addr_list, addr_count);
-		/*
-		 * After changing the mode the addr db gets cleared, therefore we have
-		 * to reinsert also the physical address of NIC.
-		 */
-		nic_rxc_set_addr(&nic_data->rx_control, NULL, &nic_data->mac);
-	}
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of multicast_get_mode method.
- *
- * @param		fun
- * @param[out]	mode		Current operation mode
- * @param[in]	max_count	Max number of addresses that can be written into the
- * 							buffer (addr_list).
- * @param[out]	addr_list	Buffer for addresses
- * @param[out]	addr_count	Number of addresses written into the list
- *
- * @return EOK
- */
-errno_t nic_multicast_get_mode_impl(ddf_fun_t *fun, nic_multicast_mode_t *mode,
-    size_t max_count, nic_address_t *addr_list, size_t *addr_count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	nic_rxc_multicast_get_mode(&nic_data->rx_control, mode, max_count,
-	    addr_list, addr_count);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of multicast_set_mode method.
- *
- * @param		fun
- * @param[in]	mode		New operation mode
- * @param[in]	addr_list	List of multicast addresses
- * @param[in]	addr_count	Number of addresses in the list
- *
- * @return EOK
- * @return EINVAL
- * @return ENOTSUP
- * @return ENOMEM
- */
-errno_t nic_multicast_set_mode_impl(ddf_fun_t *fun,	nic_multicast_mode_t mode,
-    const nic_address_t *addr_list, size_t addr_count)
-{
-	assert((addr_count == 0 && addr_list == NULL) ||
-	    (addr_count != 0 && addr_list != NULL));
-	size_t i;
-	for (i = 0; i < addr_count; ++i) {
-		if (!(addr_list[i].address[0] & 1))
-			return EINVAL;
-	}
-
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
-	if (nic_data->on_multicast_mode_change) {
-		rc = nic_data->on_multicast_mode_change(nic_data, mode, addr_list, addr_count);
-	}
-	if (rc == EOK) {
-		rc = nic_rxc_multicast_set_mode(&nic_data->rx_control, mode,
-		    addr_list, addr_count);
-	}
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of broadcast_get_mode method.
- *
- * @param		fun
- * @param[out]	mode		Current operation mode
- *
- * @return EOK
- */
-errno_t nic_broadcast_get_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t *mode)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	nic_rxc_broadcast_get_mode(&nic_data->rx_control, mode);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of broadcast_set_mode method.
- *
- * @param		fun
- * @param[in]	mode		New operation mode
- *
- * @return EOK
- * @return EINVAL
- * @return ENOTSUP
- * @return ENOMEM
- */
-errno_t nic_broadcast_set_mode_impl(ddf_fun_t *fun, nic_broadcast_mode_t mode)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = ENOTSUP;
-	if (nic_data->on_broadcast_mode_change) {
-		rc = nic_data->on_broadcast_mode_change(nic_data, mode);
-	}
-	if (rc == EOK) {
-		rc = nic_rxc_broadcast_set_mode(&nic_data->rx_control, mode);
-	}
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of blocked_sources_get method.
- *
- * @param		fun
- * @param[in]	max_count	Max number of addresses that can be written into the
- * 							buffer (addr_list).
- * @param[out]	addr_list	Buffer for addresses
- * @param[out]	addr_count	Number of addresses written into the list
- *
- * @return EOK
- */
-errno_t nic_blocked_sources_get_impl(ddf_fun_t *fun,
-    size_t max_count, nic_address_t *addr_list, size_t *addr_count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	nic_rxc_blocked_sources_get(&nic_data->rx_control,
-	    max_count, addr_list, addr_count);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of blocked_sources_set method.
- *
- * @param		fun
- * @param[in]	addr_list	List of blocked addresses
- * @param[in]	addr_count	Number of addresses in the list
- *
- * @return EOK
- * @return EINVAL
- * @return ENOTSUP
- * @return ENOMEM
- */
-errno_t nic_blocked_sources_set_impl(ddf_fun_t *fun,
-    const nic_address_t *addr_list, size_t addr_count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	if (nic_data->on_blocked_sources_change) {
-		nic_data->on_blocked_sources_change(nic_data, addr_list, addr_count);
-	}
-	errno_t rc = nic_rxc_blocked_sources_set(&nic_data->rx_control,
-	    addr_list, addr_count);
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of vlan_get_mask method.
- *
- * @param		fun
- * @param[out]	mask	Current VLAN mask
- *
- * @return EOK
- * @return ENOENT	If the mask is not set
- */
-errno_t nic_vlan_get_mask_impl(ddf_fun_t *fun, nic_vlan_mask_t *mask)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->rxc_lock);
-	errno_t rc = nic_rxc_vlan_get_mask(&nic_data->rx_control, mask);
-	fibril_rwlock_read_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of vlan_set_mask method.
- *
- * @param		fun
- * @param[in]	mask	The new VLAN mask
- *
- * @return EOK
- * @return ENOMEM
- */
-errno_t nic_vlan_set_mask_impl(ddf_fun_t *fun, const nic_vlan_mask_t *mask)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_write_lock(&nic_data->rxc_lock);
-	errno_t rc = nic_rxc_vlan_set_mask(&nic_data->rx_control, mask);
-	if (rc == EOK && nic_data->on_vlan_mask_change) {
-		nic_data->on_vlan_mask_change(nic_data, mask);
-	}
-	fibril_rwlock_write_unlock(&nic_data->rxc_lock);
-	return rc;
-}
-
-/**
- * Default implementation of the wol_virtue_add method.
- * Create a new WOL virtue.
- *
- * @param[in]	fun
- * @param[in]	type		Type of the virtue
- * @param[in]	data		Data required for this virtue (depends on type)
- * @param[in]	length		Length of the data
- * @param[out]	filter		Identifier of the new virtue
- *
- * @return EOK		If the operation was successfully completed
- * @return EINVAL	If virtue type is not supported or the data are invalid
- * @return ELIMIT	If the driver does not allow to create more virtues
- * @return ENOMEM	If there was not enough memory to complete the operation
- */
-errno_t nic_wol_virtue_add_impl(ddf_fun_t *fun, nic_wv_type_t type,
-    const void *data, size_t length, nic_wv_id_t *new_id)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	if (nic_data->on_wol_virtue_add == NULL ||
-	    nic_data->on_wol_virtue_remove == NULL) {
-		return ENOTSUP;
-	}
-	if (type == NIC_WV_NONE || type >= NIC_WV_MAX) {
-		return EINVAL;
-	}
-	if (nic_wol_virtues_verify(type, data, length) != EOK) {
-		return EINVAL;
-	}
-	nic_wol_virtue_t *virtue = malloc(sizeof (nic_wol_virtue_t));
-	if (virtue == NULL) {
-		return ENOMEM;
-	}
-	memset(virtue, 0, sizeof(nic_wol_virtue_t));
-	if (length != 0) {
-		virtue->data = malloc(length);
-		if (virtue->data == NULL) {
-			free(virtue);
-			return ENOMEM;
-		}
-		memcpy((void *) virtue->data, data, length);
-	}
-	virtue->type = type;
-	virtue->length = length;
-
-	fibril_rwlock_write_lock(&nic_data->wv_lock);
-	/* Check if we haven't reached the maximum */
-	if (nic_data->wol_virtues.caps_max[type] < 0) {
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-		free(virtue->data);
-		free(virtue);
-		return EINVAL;
-	}
-	if ((int) nic_data->wol_virtues.lists_sizes[type] >=
-	    nic_data->wol_virtues.caps_max[type]) {
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-		free(virtue->data);
-		free(virtue);
-		return ELIMIT;
-	}
-	/* Call the user-defined add callback */
-	errno_t rc = nic_data->on_wol_virtue_add(nic_data, virtue);
-	if (rc != EOK) {
-		free(virtue->data);
-		free(virtue);
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-		return rc;
-	}
-	rc = nic_wol_virtues_add(&nic_data->wol_virtues, virtue);
-	if (rc != EOK) {
-		/* If the adding fails, call user-defined remove callback */
-		nic_data->on_wol_virtue_remove(nic_data, virtue);
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-		free(virtue->data);
-		free(virtue);
-		return rc;
-	} else {
-		*new_id = virtue->id;
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-	}
-	return EOK;
-}
-
-/**
- * Default implementation of the wol_virtue_remove method.
- * Destroys the WOL virtue.
- *
- * @param[in] fun
- * @param[in] id	WOL virtue identification
- *
- * @return EOK		If the operation was successfully completed
- * @return ENOTSUP	If the function is not supported by the driver or device
- * @return ENOENT	If the virtue identifier is not valid.
- */
-errno_t nic_wol_virtue_remove_impl(ddf_fun_t *fun, nic_wv_id_t id)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	if (nic_data->on_wol_virtue_add == NULL ||
-	    nic_data->on_wol_virtue_remove == NULL) {
-		return ENOTSUP;
-	}
-	fibril_rwlock_write_lock(&nic_data->wv_lock);
-	nic_wol_virtue_t *virtue =
-	    nic_wol_virtues_remove(&nic_data->wol_virtues, id);
-	if (virtue == NULL) {
-		fibril_rwlock_write_unlock(&nic_data->wv_lock);
-		return ENOENT;
-	}
-	/* The event handler is called after the filter was removed */
-	nic_data->on_wol_virtue_remove(nic_data, virtue);
-	fibril_rwlock_write_unlock(&nic_data->wv_lock);
-	free(virtue->data);
-	free(virtue);
-	return EOK;
-}
-
-/**
- * Default implementation of the wol_virtue_probe method.
- * Queries the type and data of the virtue.
- *
- * @param[in]	fun
- * @param[in]	id		Virtue identifier
- * @param[out]	type		Type of the virtue. Can be NULL.
- * @param[out]	data		Data used when the virtue was created. Can be NULL.
- * @param[out]	length		Length of the data. Can be NULL.
- *
- * @return EOK		If the operation was successfully completed
- * @return ENOENT	If the virtue identifier is not valid.
- * @return ENOMEM	If there was not enough memory to complete the operation
- */
-errno_t nic_wol_virtue_probe_impl(ddf_fun_t *fun, nic_wv_id_t id,
-    nic_wv_type_t *type, size_t max_length, void *data, size_t *length)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->wv_lock);
-	const nic_wol_virtue_t *virtue =
-	    nic_wol_virtues_find(&nic_data->wol_virtues, id);
-	if (virtue == NULL) {
-		*type = NIC_WV_NONE;
-		*length = 0;
-		fibril_rwlock_read_unlock(&nic_data->wv_lock);
-		return ENOENT;
-	} else {
-		*type = virtue->type;
-		if (max_length > virtue->length) {
-			max_length = virtue->length;
-		}
-		memcpy(data, virtue->data, max_length);
-		*length = virtue->length;
-		fibril_rwlock_read_unlock(&nic_data->wv_lock);
-		return EOK;
-	}
-}
-
-/**
- * Default implementation of the wol_virtue_list method.
- * List filters of the specified type. If NIC_WV_NONE is the type, it lists all
- * filters.
- *
- * @param[in]	fun
- * @param[in]	type	Type of the virtues
- * @param[out]	virtues	Vector of virtue ID's.
- * @param[out]	count	Length of the data. Can be NULL.
- *
- * @return EOK		If the operation was successfully completed
- * @return ENOENT	If the filter identification is not valid.
- * @return ENOMEM	If there was not enough memory to complete the operation
- */
-errno_t nic_wol_virtue_list_impl(ddf_fun_t *fun, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->wv_lock);
-	errno_t rc = nic_wol_virtues_list(&nic_data->wol_virtues, type,
-	    max_count, id_list, id_count);
-	fibril_rwlock_read_unlock(&nic_data->wv_lock);
-	return rc;
-}
-
-/**
- * Default implementation of the wol_virtue_get_caps method.
- * Queries for the current capabilities for some type of filter.
- *
- * @param[in]	fun
- * @param[in]	type	Type of the virtues
- * @param[out]	count	Number of virtues of this type that can be currently set
- *
- * @return EOK		If the operation was successfully completed
- */
-errno_t nic_wol_virtue_get_caps_impl(ddf_fun_t *fun, nic_wv_type_t type, int *count)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->wv_lock);
-	*count = nic_data->wol_virtues.caps_max[type] -
-	    (int) nic_data->wol_virtues.lists_sizes[type];
-	fibril_rwlock_read_unlock(&nic_data->wv_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the poll_get_mode method.
- * Queries the current interrupt/poll mode of the NIC
- *
- * @param[in]	fun
- * @param[out]	mode		Current poll mode
- * @param[out]	period		Period used in periodic polling. Can be NULL.
- *
- * @return EOK		If the operation was successfully completed
- * @return ENOTSUP	This function is not supported.
- * @return EPARTY	Error in communication protocol
- */
-errno_t nic_poll_get_mode_impl(ddf_fun_t *fun,
-    nic_poll_mode_t *mode, struct timespec *period)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->main_lock);
-	*mode = nic_data->poll_mode;
-	memcpy(period, &nic_data->poll_period, sizeof(struct timespec));
-	fibril_rwlock_read_unlock(&nic_data->main_lock);
-	return EOK;
-}
-
-/**
- * Default implementation of the poll_set_mode_impl method.
- * Sets the interrupt/poll mode of the NIC.
- *
- * @param[in]	fun
- * @param[in]	mode		The new poll mode
- * @param[in]	period		Period used in periodic polling. Can be NULL.
- *
- * @return EOK		If the operation was successfully completed
- * @return ENOTSUP	This operation is not supported.
- * @return EPARTY	Error in communication protocol
- */
-errno_t nic_poll_set_mode_impl(ddf_fun_t *fun,
-    nic_poll_mode_t mode, const struct timespec *period)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	/*
-	 * If the driver does not implement the poll mode change handler it cannot
-	 * switch off interrupts and this is not supported.
-	 */
-	if (nic_data->on_poll_mode_change == NULL)
-		return ENOTSUP;
-
-	if ((mode == NIC_POLL_ON_DEMAND) && nic_data->on_poll_request == NULL)
-		return ENOTSUP;
-
-	if (mode == NIC_POLL_PERIODIC || mode == NIC_POLL_SOFTWARE_PERIODIC) {
-		if (period == NULL)
-			return EINVAL;
-		if (period->tv_sec == 0 && period->tv_nsec == 0)
-			return EINVAL;
-		if (period->tv_sec < 0 || period->tv_nsec < 0)
-			return EINVAL;
-	}
-	fibril_rwlock_write_lock(&nic_data->main_lock);
-	errno_t rc = nic_data->on_poll_mode_change(nic_data, mode, period);
-	assert(rc == EOK || rc == ENOTSUP || rc == EINVAL);
-	if (rc == ENOTSUP && (nic_data->on_poll_request != NULL) &&
-	    (mode == NIC_POLL_PERIODIC || mode == NIC_POLL_SOFTWARE_PERIODIC)) {
-
-		rc = nic_data->on_poll_mode_change(nic_data, NIC_POLL_ON_DEMAND, NULL);
-		assert(rc == EOK || rc == ENOTSUP);
-		if (rc == EOK)
-			nic_sw_period_start(nic_data);
-	}
-	if (rc == EOK) {
-		nic_data->poll_mode = mode;
-		if (period)
-			nic_data->poll_period = *period;
-	}
-	fibril_rwlock_write_unlock(&nic_data->main_lock);
-	return rc;
-}
-
-/**
- * Default implementation of the poll_now method.
- * Wrapper for the actual poll implementation.
- *
- * @param[in]	fun
- *
- * @return EOK		If the NIC was polled
- * @return ENOTSUP	If the function is not supported
- * @return EINVAL	If the NIC is not in state where it allows on demand polling
- */
-errno_t nic_poll_now_impl(ddf_fun_t *fun)
-{
-	nic_t *nic_data = nic_get_from_ddf_fun(fun);
-	fibril_rwlock_read_lock(&nic_data->main_lock);
-	if (nic_data->poll_mode != NIC_POLL_ON_DEMAND) {
-		fibril_rwlock_read_unlock(&nic_data->main_lock);
-		return EINVAL;
-	}
-	if (nic_data->on_poll_request != NULL) {
-		nic_data->on_poll_request(nic_data);
-		fibril_rwlock_read_unlock(&nic_data->main_lock);
-		return EOK;
-	} else {
-		fibril_rwlock_read_unlock(&nic_data->main_lock);
-		return ENOTSUP;
-	}
-}
-
-/**
- * Default handler for unknown methods (outside of the NIC interface).
- * Logs a warning message and returns ENOTSUP to the caller.
- *
- * @param fun  The DDF function where the method should be called.
- * @param call IPC call data
- *
- */
-void nic_default_handler_impl(ddf_fun_t *fun, ipc_call_t *call)
-{
-	async_answer_0(call, ENOTSUP);
-}
-
-/**
- * Default (empty) OPEN function implementation.
- *
- * @param fun	The DDF function
- *
- * @return EOK always.
- */
-errno_t nic_open_impl(ddf_fun_t *fun)
-{
-	return EOK;
-}
-
-/**
- * Default (empty) OPEN function implementation.
- *
- * @param fun	The DDF function
- */
-void nic_close_impl(ddf_fun_t *fun)
-{
-}
-
-/** @}
- */
Index: pace/lib/nic/src/nic_rx_control.c
===================================================================
--- uspace/lib/nic/src/nic_rx_control.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,579 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Incoming packets (frames) filtering functions
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <mem.h>
-#include <nic/nic.h>
-#include "nic_rx_control.h"
-
-/**
- * Initializes the receive control structure
- *
- * @param rxc
- *
- * @return EOK		On success
- * @return ENOMEM	On not enough memory
- * @return EINVAL	Internal error, should not happen
- */
-errno_t nic_rxc_init(nic_rxc_t *rxc)
-{
-	memset(rxc, 0, sizeof(nic_rxc_t));
-	errno_t rc;
-	rc = nic_addr_db_init(&rxc->blocked_sources, ETH_ADDR);
-	if (rc != EOK) {
-		return rc;
-	}
-	rc = nic_addr_db_init(&rxc->unicast_addrs, ETH_ADDR);
-	if (rc != EOK) {
-		return rc;
-	}
-	rc = nic_addr_db_init(&rxc->multicast_addrs, ETH_ADDR);
-	if (rc != EOK) {
-		return rc;
-	}
-	rxc->block_sources = false;
-	rxc->unicast_mode = NIC_UNICAST_DEFAULT;
-	rxc->multicast_mode = NIC_MULTICAST_BLOCKED;
-	rxc->broadcast_mode = NIC_BROADCAST_ACCEPTED;
-
-	/* Default NIC behavior */
-	rxc->unicast_exact = true;
-	rxc->multicast_exact = false;
-	rxc->vlan_exact = true;
-	return EOK;
-}
-
-/** Reinitialize the structure.
- *
- * @param filters
- */
-errno_t nic_rxc_clear(nic_rxc_t *rxc)
-{
-	nic_addr_db_destroy(&rxc->unicast_addrs);
-	nic_addr_db_destroy(&rxc->multicast_addrs);
-	nic_addr_db_destroy(&rxc->blocked_sources);
-	return nic_rxc_init(rxc);
-}
-
-/** Set the NIC's address that should be used as the default address during
- * the checks.
- *
- * @param rxc
- * @param prev_addr Previously used default address. Can be NULL
- *                  if this is the first call after filters' initialization.
- * @param curr_addr The new default address.
- *
- * @return EOK On success
- *
- */
-errno_t nic_rxc_set_addr(nic_rxc_t *rxc, const nic_address_t *prev_addr,
-    const nic_address_t *curr_addr)
-{
-	if (prev_addr != NULL) {
-		errno_t rc = nic_addr_db_remove(&rxc->unicast_addrs,
-		    (const uint8_t *) &prev_addr->address);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return nic_addr_db_insert(&rxc->unicast_addrs,
-	    (const uint8_t *) &curr_addr->address);
-}
-
-/* Helper structure */
-typedef struct {
-	size_t max_count;
-	nic_address_t *address_list;
-	size_t address_count;
-} nic_rxc_add_addr_t;
-
-/** Helper function */
-static void nic_rxc_add_addr(const uint8_t *addr, void *arg)
-{
-	nic_rxc_add_addr_t *hs = (nic_rxc_add_addr_t *) arg;
-	if (hs->address_count < hs->max_count && hs->address_list != NULL) {
-		memcpy(&hs->address_list[hs->address_count].address, addr, ETH_ADDR);
-	}
-	hs->address_count++;
-}
-
-/**
- * Queries the current mode of unicast frames receiving.
- *
- * @param rxc
- * @param mode			The new unicast mode
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of accepted addresses (can be > max_count)
- */
-void nic_rxc_unicast_get_mode(const nic_rxc_t *rxc, nic_unicast_mode_t *mode,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	*mode = rxc->unicast_mode;
-	if (rxc->unicast_mode == NIC_UNICAST_LIST) {
-		nic_rxc_add_addr_t hs = {
-			.max_count = max_count,
-			.address_list = address_list,
-			.address_count = 0
-		};
-		nic_addr_db_foreach(&rxc->unicast_addrs, nic_rxc_add_addr, &hs);
-		if (address_count) {
-			*address_count = hs.address_count;
-		}
-	}
-}
-
-/**
- * Sets the current mode of unicast frames receiving.
- *
- * @param rxc
- * @param mode			The current unicast mode
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of addresses in the list
- *
- * @return EOK		On success
- * @return EINVAL	If any of the MAC addresses is not a unicast address.
- * @return ENOMEM	If there was not enough memory
- */
-errno_t nic_rxc_unicast_set_mode(nic_rxc_t *rxc, nic_unicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	if (mode == NIC_UNICAST_LIST && address_list == NULL) {
-		return EINVAL;
-	} else if (mode != NIC_UNICAST_LIST && address_list != NULL) {
-		return EINVAL;
-	}
-
-	if (rxc->unicast_mode == NIC_UNICAST_LIST) {
-		nic_addr_db_clear(&rxc->unicast_addrs);
-	}
-	rxc->unicast_mode = mode;
-	size_t i;
-	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->unicast_addrs,
-		    (const uint8_t *) &address_list[i].address);
-		if (rc == ENOMEM) {
-			return ENOMEM;
-		}
-	}
-	return EOK;
-}
-
-/**
- * Queries the current mode of multicast frames receiving.
- *
- * @param rxc
- * @param mode			The current multicast mode
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of accepted addresses (can be > max_count)
- */
-void nic_rxc_multicast_get_mode(const nic_rxc_t *rxc,
-    nic_multicast_mode_t *mode, size_t max_count, nic_address_t *address_list,
-    size_t *address_count)
-{
-	*mode = rxc->multicast_mode;
-	if (rxc->multicast_mode == NIC_MULTICAST_LIST) {
-		nic_rxc_add_addr_t hs = {
-			.max_count = max_count,
-			.address_list = address_list,
-			.address_count = 0
-		};
-		nic_addr_db_foreach(&rxc->multicast_addrs, nic_rxc_add_addr, &hs);
-		if (address_count) {
-			*address_count = hs.address_count;
-		}
-	}
-}
-
-/**
- * Sets the current mode of multicast frames receiving.
- *
- * @param rxc
- * @param mode			The new multicast mode
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of addresses in the list
- *
- * @return EOK		On success
- * @return EINVAL	If any of the MAC addresses is not a multicast address.
- * @return ENOMEM	If there was not enough memory
- */
-errno_t nic_rxc_multicast_set_mode(nic_rxc_t *rxc, nic_multicast_mode_t mode,
-    const nic_address_t *address_list, size_t address_count)
-{
-	if (mode == NIC_MULTICAST_LIST && address_list == NULL)
-		return EINVAL;
-	else if (mode != NIC_MULTICAST_LIST && address_list != NULL)
-		return EINVAL;
-
-	if (rxc->multicast_mode == NIC_MULTICAST_LIST)
-		nic_addr_db_clear(&rxc->multicast_addrs);
-
-	rxc->multicast_mode = mode;
-	size_t i;
-	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->multicast_addrs,
-		    (const uint8_t *)&address_list[i].address);
-		if (rc == ENOMEM) {
-			return ENOMEM;
-		}
-	}
-	return EOK;
-}
-
-/**
- * Queries the current mode of broadcast frames receiving.
- *
- * @param rxc
- * @param mode			The new broadcast mode
- */
-void nic_rxc_broadcast_get_mode(const nic_rxc_t *rxc, nic_broadcast_mode_t *mode)
-{
-	*mode = rxc->broadcast_mode;
-}
-
-/**
- * Sets the current mode of broadcast frames receiving.
- *
- * @param rxc
- * @param mode			The new broadcast mode
- *
- * @return EOK		On success
- */
-errno_t nic_rxc_broadcast_set_mode(nic_rxc_t *rxc, nic_broadcast_mode_t mode)
-{
-	rxc->broadcast_mode = mode;
-	return EOK;
-}
-
-/**
- * Queries the current blocked source addresses.
- *
- * @param rxc
- * @param max_count		Max number of addresses that can be written into the
- * 						address_list.
- * @param address_list	List of MAC addresses or NULL.
- * @param address_count Number of blocked addresses (can be > max_count)
- */
-void nic_rxc_blocked_sources_get(const nic_rxc_t *rxc,
-    size_t max_count, nic_address_t *address_list, size_t *address_count)
-{
-	nic_rxc_add_addr_t hs = {
-		.max_count = max_count,
-		.address_list = address_list,
-		.address_count = 0
-	};
-	nic_addr_db_foreach(&rxc->blocked_sources, nic_rxc_add_addr, &hs);
-	if (address_count) {
-		*address_count = hs.address_count;
-	}
-}
-
-/**
- * Clears the currently blocked addresses and sets the addresses contained in
- * the list as the set of blocked source addresses (no frame with this source
- * address will be received). Duplicated addresses are ignored.
- *
- * @param rxc
- * @param address_list	List of the blocked addresses. Can be NULL.
- * @param address_count Number of addresses in the list
- *
- * @return EOK		On success
- * @return ENOMEM	If there was not enough memory
- */
-errno_t nic_rxc_blocked_sources_set(nic_rxc_t *rxc,
-    const nic_address_t *address_list, size_t address_count)
-{
-	assert((address_count == 0 && address_list == NULL) ||
-	    (address_count != 0 && address_list != NULL));
-
-	nic_addr_db_clear(&rxc->blocked_sources);
-	rxc->block_sources = (address_count != 0);
-	size_t i;
-	for (i = 0; i < address_count; ++i) {
-		errno_t rc = nic_addr_db_insert(&rxc->blocked_sources,
-		    (const uint8_t *) &address_list[i].address);
-		if (rc == ENOMEM) {
-			return ENOMEM;
-		}
-	}
-	return EOK;
-}
-
-/**
- * Query mask used for filtering according to the VLAN tags.
- *
- * @param rxc
- * @param mask		Must be 512 bytes long
- *
- * @return EOK
- * @return ENOENT
- */
-errno_t nic_rxc_vlan_get_mask(const nic_rxc_t *rxc, nic_vlan_mask_t *mask)
-{
-	if (rxc->vlan_mask == NULL) {
-		return ENOENT;
-	}
-	memcpy(mask, rxc->vlan_mask, sizeof (nic_vlan_mask_t));
-	return EOK;
-}
-
-/**
- * Set mask for filtering according to the VLAN tags.
- *
- * @param rxc
- * @param mask		Must be 512 bytes long
- *
- * @return EOK
- * @return ENOMEM
- */
-errno_t nic_rxc_vlan_set_mask(nic_rxc_t *rxc, const nic_vlan_mask_t *mask)
-{
-	if (mask == NULL) {
-		if (rxc->vlan_mask) {
-			free(rxc->vlan_mask);
-		}
-		rxc->vlan_mask = NULL;
-		return EOK;
-	}
-	if (!rxc->vlan_mask) {
-		rxc->vlan_mask = malloc(sizeof (nic_vlan_mask_t));
-		if (rxc->vlan_mask == NULL) {
-			return ENOMEM;
-		}
-	}
-	memcpy(rxc->vlan_mask, mask, sizeof (nic_vlan_mask_t));
-	return EOK;
-}
-
-/**
- * Check if the frame passes through the receive control.
- *
- * @param rxc
- * @param frame	    The probed frame
- *
- * @return True if the frame passes, false if it does not
- */
-bool nic_rxc_check(const nic_rxc_t *rxc, const void *data, size_t size,
-    nic_frame_type_t *frame_type)
-{
-	assert(frame_type != NULL);
-	uint8_t *dest_addr = (uint8_t *) data;
-	uint8_t *src_addr = dest_addr + ETH_ADDR;
-
-	if (size < 2 * ETH_ADDR)
-		return false;
-
-	if (dest_addr[0] & 1) {
-		/* Multicast or broadcast */
-		if (*(uint32_t *) dest_addr == 0xFFFFFFFF &&
-		    *(uint16_t *) (dest_addr + 4) == 0xFFFF) {
-			/* It is broadcast */
-			*frame_type = NIC_FRAME_BROADCAST;
-			if (rxc->broadcast_mode == NIC_BROADCAST_BLOCKED)
-				return false;
-		} else {
-			*frame_type = NIC_FRAME_MULTICAST;
-			/* In promiscuous mode the multicast_exact should be set to true */
-			if (!rxc->multicast_exact) {
-				if (rxc->multicast_mode == NIC_MULTICAST_BLOCKED)
-					return false;
-				else {
-					if (!nic_addr_db_contains(&rxc->multicast_addrs,
-					    dest_addr))
-						return false;
-				}
-			}
-		}
-	} else {
-		/* Unicast */
-		*frame_type = NIC_FRAME_UNICAST;
-		/* In promiscuous mode the unicast_exact should be set to true */
-		if (!rxc->unicast_exact) {
-			if (rxc->unicast_mode == NIC_UNICAST_BLOCKED)
-				return false;
-			else {
-				if (!nic_addr_db_contains(&rxc->unicast_addrs,
-				    dest_addr))
-					return false;
-			}
-		}
-	}
-
-	/* Blocked source addresses */
-	if (rxc->block_sources) {
-		if (nic_addr_db_contains(&rxc->blocked_sources, src_addr))
-			return false;
-	}
-
-	/* VLAN filtering */
-	if (!rxc->vlan_exact && rxc->vlan_mask != NULL) {
-		vlan_header_t *vlan_header = (vlan_header_t *)
-		    ((uint8_t *) data + 2 * ETH_ADDR);
-		if (vlan_header->tpid_upper == VLAN_TPID_UPPER &&
-		    vlan_header->tpid_lower == VLAN_TPID_LOWER) {
-			int index = ((int) (vlan_header->vid_upper & 0xF) << 5) |
-			    (vlan_header->vid_lower >> 3);
-			if (!(rxc->vlan_mask->bitmap[index] &
-			    (1 << (vlan_header->vid_lower & 0x7))))
-				return false;
-		}
-	}
-
-	return true;
-}
-
-/**
- * Set information about current HW filtering.
- *  1 ...	Only those frames we want to receive are passed through HW
- *  0 ...	The HW filtering is imperfect
- * -1 ...	Don't change the setting
- * This function should be called only from the mode change event handler.
- *
- * @param	rxc
- * @param	unicast_exact	Unicast frames
- * @param	mcast_exact		Multicast frames
- * @param	vlan_exact		VLAN tags
- */
-void nic_rxc_hw_filtering(nic_rxc_t *rxc,
-    int unicast_exact, int multicast_exact, int vlan_exact)
-{
-	if (unicast_exact >= 0)
-		rxc->unicast_exact = unicast_exact;
-	if (multicast_exact >= 0)
-		rxc->multicast_exact = multicast_exact;
-	if (vlan_exact >= 0)
-		rxc->vlan_exact = vlan_exact;
-}
-
-/** Polynomial used in multicast address hashing */
-#define CRC_MCAST_POLYNOMIAL  0x04c11db6
-
-/** Compute the standard hash from MAC
- *
- * Hashing MAC into 64 possible values and using the value as index to
- * 64bit number.
- *
- * The code is copied from qemu-0.13's implementation of ne2000 and rt8139
- * drivers, but according to documentation there it originates in FreeBSD.
- *
- * @param[in] addr The 6-byte MAC address to be hashed
- *
- * @return 64-bit number with only single bit set to 1
- *
- */
-static uint64_t multicast_hash(const uint8_t addr[6])
-{
-	uint32_t crc;
-	int carry, i, j;
-	uint8_t b;
-
-	crc = 0xffffffff;
-	for (i = 0; i < 6; i++) {
-		b = addr[i];
-		for (j = 0; j < 8; j++) {
-			carry = ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01);
-			crc <<= 1;
-			b >>= 1;
-			if (carry)
-				crc = ((crc ^ CRC_MCAST_POLYNOMIAL) | carry);
-		}
-	}
-
-	uint64_t one64 = 1;
-	return one64 << (crc >> 26);
-}
-
-/**
- * Computes hash for the address list based on standard multicast address
- * hashing.
- *
- * @param address_list
- * @param count
- *
- * @return Multicast hash
- *
- * @see multicast_hash
- */
-uint64_t nic_rxc_mcast_hash(const nic_address_t *address_list, size_t count)
-{
-	size_t i;
-	uint64_t hash = 0;
-	for (i = 0; i < count; ++i) {
-		hash |= multicast_hash(address_list[i].address);
-	}
-	return hash;
-}
-
-static void nic_rxc_hash_addr(const uint8_t *address, void *arg)
-{
-	*((uint64_t *) arg) |= multicast_hash(address);
-}
-
-/**
- * Computes hash for multicast addresses currently set up in the RX multicast
- * filtering. For promiscuous mode returns all ones, for blocking all zeroes.
- * Can be called only from the on_*_change handler.
- *
- * @param rxc
- *
- * @return Multicast hash
- *
- * @see multicast_hash
- */
-uint64_t nic_rxc_multicast_get_hash(const nic_rxc_t *rxc)
-{
-	switch (rxc->multicast_mode) {
-	case NIC_MULTICAST_UNKNOWN:
-	case NIC_MULTICAST_BLOCKED:
-		return 0;
-	case NIC_MULTICAST_LIST:
-		break;
-	case NIC_MULTICAST_PROMISC:
-		return ~(uint64_t) 0;
-	}
-	uint64_t hash;
-	nic_addr_db_foreach(&rxc->multicast_addrs, nic_rxc_hash_addr, &hash);
-	return hash;
-}
-
-/** @}
- */
Index: pace/lib/nic/src/nic_wol_virtues.c
===================================================================
--- uspace/lib/nic/src/nic_wol_virtues.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,292 +1,0 @@
-/*
- * Copyright (c) 2011 Radim Vansa
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup libnic
- * @{
- */
-/**
- * @file
- * @brief Wake-on-LAN support
- */
-
-#include "nic_wol_virtues.h"
-#include "nic.h"
-#include <assert.h>
-#include <errno.h>
-
-/*
- * Hash table helper functions
- */
-
-static size_t nic_wv_key_hash(const void *key)
-{
-	const nic_wv_id_t *k = key;
-	return *k;
-}
-
-static size_t nic_wv_hash(const ht_link_t *item)
-{
-	nic_wol_virtue_t *virtue = (nic_wol_virtue_t *) item;
-	return virtue->id;
-}
-
-static bool nic_wv_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const nic_wv_id_t *k = key;
-	const nic_wol_virtue_t *virtue = (const nic_wol_virtue_t *) item;
-	return (virtue->id == *k);
-}
-
-/**
- * Initializes the WOL virtues structure
- *
- * @param wvs
- *
- * @return EOK		On success
- * @return ENOMEM	On not enough memory
- */
-errno_t nic_wol_virtues_init(nic_wol_virtues_t *wvs)
-{
-	memset(wvs, 0, sizeof(nic_wol_virtues_t));
-	wvs->table_operations.hash = nic_wv_hash;
-	wvs->table_operations.key_hash = nic_wv_key_hash;
-	wvs->table_operations.key_equal = nic_wv_key_equal;
-	wvs->table_operations.equal = 0;
-	wvs->table_operations.remove_callback = 0;
-
-	if (!hash_table_create(&wvs->table, 0, 0, &wvs->table_operations)) {
-		return ENOMEM;
-	}
-	size_t i;
-	for (i = 0; i < NIC_WV_MAX; ++i) {
-		wvs->caps_max[i] = -1;
-	}
-	wvs->next_id = 0;
-	return EOK;
-}
-
-/**
- * Reinitializes the structure, destroying all virtues. The next_id is not
- * changed (some apps could still hold the filter IDs).
- *
- * @param wvs
- */
-void nic_wol_virtues_clear(nic_wol_virtues_t *wvs)
-{
-	hash_table_clear(&wvs->table);
-	nic_wv_type_t type;
-	for (type = NIC_WV_NONE; type < NIC_WV_MAX; ++type) {
-		nic_wol_virtue_t *virtue = wvs->lists[type];
-		while (virtue != NULL) {
-			nic_wol_virtue_t *next = virtue->next;
-			free(virtue->data);
-			free(virtue);
-			virtue = next;
-		}
-		wvs->lists_sizes[type] = 0;
-	}
-}
-
-/**
- * Verifies that the arguments for the WOL virtues are correct.
- *
- * @param type		Type of the virtue
- * @param data		Data argument for the virtue
- * @param length	Length of the data
- *
- * @return EOK		The arguments are correct
- * @return EINVAL	The arguments are incorrect
- * @return ENOTSUP	This type is unknown
- */
-errno_t nic_wol_virtues_verify(nic_wv_type_t type, const void *data, size_t length)
-{
-	switch (type) {
-	case NIC_WV_ARP_REQUEST:
-	case NIC_WV_BROADCAST:
-	case NIC_WV_LINK_CHANGE:
-		return EOK;
-	case NIC_WV_DESTINATION:
-		return length == sizeof (nic_address_t) ? EOK : EINVAL;
-	case NIC_WV_DIRECTED_IPV4:
-		return length == sizeof (nic_wv_ipv4_data_t) ? EOK : EINVAL;
-	case NIC_WV_DIRECTED_IPV6:
-		return length == sizeof (nic_wv_ipv6_data_t) ? EOK : EINVAL;
-	case NIC_WV_FULL_MATCH:
-		return length % 2 == 0 ? EOK : EINVAL;
-	case NIC_WV_MAGIC_PACKET:
-		return data == NULL || length == sizeof (nic_wv_magic_packet_data_t) ?
-		    EOK : EINVAL;
-	default:
-		return ENOTSUP;
-	}
-}
-
-/**
- * Adds the virtue to the list of known virtues, activating it.
- *
- * @param wvs
- * @param virtue	The virtue structure
- *
- * @return EOK		On success
- * @return ENOTSUP	If the virtue type is not supported
- * @return EINVAL	If the virtue type is a single-filter and there's already
- * 					a virtue of this type defined, or there is something wrong
- * 					with the data
- * @return ENOMEM	Not enough memory to activate the virtue
- */
-errno_t nic_wol_virtues_add(nic_wol_virtues_t *wvs, nic_wol_virtue_t *virtue)
-{
-	if (!nic_wv_is_multi(virtue->type) &&
-	    wvs->lists[virtue->type] != NULL) {
-		return EINVAL;
-	}
-	do {
-		virtue->id = wvs->next_id++;
-	} while (NULL != hash_table_find(&wvs->table, &virtue->id));
-	hash_table_insert(&wvs->table, &virtue->item);
-	virtue->next = wvs->lists[virtue->type];
-	wvs->lists[virtue->type] = virtue;
-	wvs->lists_sizes[virtue->type]++;
-	return EOK;
-}
-
-/**
- * Removes the virtue from the list of virtues, but NOT deallocating the
- * nic_wol_virtue structure.
- *
- * @param wvs
- * @param id	Identifier of the removed virtue
- *
- * @return Removed virtue structure or NULL if not found.
- */
-nic_wol_virtue_t *nic_wol_virtues_remove(nic_wol_virtues_t *wvs, nic_wv_id_t id)
-{
-	nic_wol_virtue_t *virtue =
-	    (nic_wol_virtue_t *) hash_table_find(&wvs->table, &id);
-	if (virtue == NULL) {
-		return NULL;
-	}
-
-	/* Remove from filter_table */
-	hash_table_remove_item(&wvs->table, &virtue->item);
-
-	/* Remove from filter_types */
-	assert(wvs->lists[virtue->type] != NULL);
-	if (wvs->lists[virtue->type] == virtue) {
-		wvs->lists[virtue->type] = virtue->next;
-	} else {
-		nic_wol_virtue_t *wv = wvs->lists[virtue->type];
-		while (wv->next != virtue) {
-			wv = wv->next;
-			assert(wv != NULL);
-		}
-		wv->next = virtue->next;
-	}
-	wvs->lists_sizes[virtue->type]--;
-
-	virtue->next = NULL;
-	return virtue;
-}
-
-/**
- * Searches the filters table for a filter with specified ID
- *
- * @param wvs
- * @param id	Identifier of the searched virtue
- *
- * @return Requested filter or NULL if not found.
- */
-const nic_wol_virtue_t *nic_wol_virtues_find(const nic_wol_virtues_t *wvs,
-    nic_wv_id_t id)
-{
-	/*
-	 * The hash_table_find cannot be const, because it would require the
-	 * returned link to be const as well. But in this case, when we're returning
-	 * constant virtue the retyping is correct.
-	 */
-	ht_link_t *virtue = hash_table_find(&((nic_wol_virtues_t *) wvs)->table, &id);
-	return (const nic_wol_virtue_t *) virtue;
-}
-
-/**
- * Fill identifiers of current wol virtues of the specified type into the list.
- * If the type is set to NIC_WV_NONE, all virtues are used.
- *
- * @param		wvs
- * @param[in]	type		Type of the virtues or NIC_WV_NONE
- * @param[out]	id_list		The new vector of filter IDs. Can be NULL.
- * @param[out]	count		Number of IDs in the filter_list. Can be NULL.
- *
- * @return EOK		If it completes successfully
- * @return EINVAL	If the filter type is invalid
- */
-errno_t nic_wol_virtues_list(const nic_wol_virtues_t *wvs, nic_wv_type_t type,
-    size_t max_count, nic_wv_id_t *id_list, size_t *id_count)
-{
-	size_t count = 0;
-	if (type == NIC_WV_NONE) {
-		size_t i;
-		for (i = NIC_WV_NONE; i < NIC_WV_MAX; ++i) {
-			if (id_list != NULL) {
-				nic_wol_virtue_t *virtue = wvs->lists[i];
-				while (virtue != NULL) {
-					if (count < max_count) {
-						id_list[count] = virtue->id;
-					}
-					++count;
-					virtue = virtue->next;
-				}
-			} else {
-				count += wvs->lists_sizes[i];
-			}
-		}
-	} else if (type >= NIC_WV_MAX) {
-		return EINVAL;
-	} else {
-		if (id_list != NULL) {
-			nic_wol_virtue_t *virtue = wvs->lists[type];
-			while (virtue != NULL) {
-				if (count < max_count) {
-					id_list[count] = virtue->id;
-				}
-				++count;
-				virtue = virtue->next;
-			}
-		} else {
-			count = wvs->lists_sizes[type];
-		}
-	}
-	if (id_count != NULL) {
-		*id_count = count;
-	}
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/ofw/doc/doxygroups.h
===================================================================
--- uspace/lib/ofw/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libofw libofw
- * @ingroup libs
- */
Index: pace/lib/ofw/include/ofw.h
===================================================================
--- uspace/lib/ofw/include/ofw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libofw
- * @{
- */
-/**
- * @file OpenFirmware device tree access
- */
-
-#ifndef _OFW_H
-#define _OFW_H
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <types/ofw.h>
-
-extern errno_t ofw_child_it_first(ofw_child_it_t *, const char *);
-extern void ofw_child_it_next(ofw_child_it_t *);
-extern bool ofw_child_it_end(ofw_child_it_t *);
-extern const char *ofw_child_it_get_name(ofw_child_it_t *);
-extern errno_t ofw_child_it_get_path(ofw_child_it_t *, char **);
-extern void ofw_child_it_fini(ofw_child_it_t *);
-
-extern errno_t ofw_prop_it_first(ofw_prop_it_t *, const char *);
-extern void ofw_prop_it_next(ofw_prop_it_t *);
-extern bool ofw_prop_it_end(ofw_prop_it_t *);
-extern const char *ofw_prop_it_get_name(ofw_prop_it_t *);
-extern const void *ofw_prop_it_get_data(ofw_prop_it_t *, size_t *);
-extern void ofw_prop_it_fini(ofw_prop_it_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ofw/include/types/ofw.h
===================================================================
--- uspace/lib/ofw/include/types/ofw.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libofw
- * @{
- */
-/**
- * @file OpenFirmware device tree access
- */
-
-#ifndef _TYPES_OFW_H
-#define _TYPES_OFW_H
-
-#include <stddef.h>
-
-/** OpenFirmware child iterator */
-typedef struct {
-	/** OpenFirmware path of the parent */
-	char *ofwpath;
-	/** Key data from sysinfo */
-	char *keys;
-	/** Size of key data */
-	size_t keys_sz;
-	/** Byte offset of current child in @c keys */
-	size_t pos;
-} ofw_child_it_t;
-
-/** OpenFirmware property iterator */
-typedef struct {
-	/** Data from sysinfo */
-	void *data;
-	/** Size of data from sysinfo */
-	size_t data_sz;
-	/** Byte offset of current property in @c data */
-	size_t pos;
-} ofw_prop_it_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ofw/meson.build
===================================================================
--- uspace/lib/ofw/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/ofw.c',
-)
Index: pace/lib/ofw/src/ofw.c
===================================================================
--- uspace/lib/ofw/src/ofw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,320 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libofw
- * @{
- */
-/**
- * @file OpenFirmware device tree access
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <ofw.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <sysinfo.h>
-
-/** Convert OpenFirmware path to sysinfo path.
- *
- * @param ofwpath OpenFirmware path
- * @param sipath place to store pointer to newly allocated sysinfo path
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t ofw_path_to_sipath(const char *ofwpath, char **sipath)
-{
-	int rv;
-	size_t size;
-	size_t i;
-
-	if (str_cmp(ofwpath, "/") == 0)
-		ofwpath = "";
-
-	/* Append path to firmware.ofw */
-	rv = asprintf(sipath, "firmware.ofw%s", ofwpath);
-	if (rv < 0)
-		return ENOMEM;
-
-	/* Replace '/' with '.' */
-	size = str_size(*sipath);
-	for (i = 0; i < size; i++)
-		if ((*sipath)[i] == '/')
-			(*sipath)[i] = '.';
-
-	return EOK;
-}
-
-/** Initialize child iterator with first child entry.
- *
- * Initialize the child iterator and make it point to the first child
- * of the specified OpenFirmware device node.
- *
- * @param it Child iterator to initialize
- * @param ofwpath OpenFirmware path of the parent node
- */
-errno_t ofw_child_it_first(ofw_child_it_t *it, const char *ofwpath)
-{
-	errno_t rc;
-	char *sipath = NULL;
-
-	it->ofwpath = NULL;
-	it->keys = NULL;
-	it->keys_sz = 0;
-	it->pos = 0;
-
-	rc = ofw_path_to_sipath(ofwpath, &sipath);
-	if (rc != EOK)
-		goto error;
-
-	if (str_cmp(ofwpath, "/") == 0) {
-		it->ofwpath = str_dup("");
-	} else {
-		it->ofwpath = str_dup(ofwpath);
-	}
-
-	if (it->ofwpath == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	it->keys = sysinfo_get_keys(sipath, &it->keys_sz);
-	if (it->keys == NULL) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (sipath != NULL)
-		free(sipath);
-
-	if (it->ofwpath != NULL) {
-		free(it->ofwpath);
-		it->ofwpath = NULL;
-	}
-
-	return rc;
-}
-
-/** Move child iterator to the next child.
- *
- * @param it Child iterator
- */
-void ofw_child_it_next(ofw_child_it_t *it)
-{
-	size_t adj;
-
-	assert(!ofw_child_it_end(it));
-
-	adj = str_nsize(it->keys + it->pos, it->keys_sz - it->pos) + 1;
-	assert(it->pos + adj <= it->keys_sz);
-	it->pos += adj;
-}
-
-/** Determine if there are no more child nodes.
- *
- * @param it Child iterator
- * @return @c true iff iterator is beyond the last entry
- */
-bool ofw_child_it_end(ofw_child_it_t *it)
-{
-	return it->pos >= it->keys_sz;
-}
-
-/** Get child name from iterator.
- *
- * @param it Child iterator
- * @return Child name (valid until next operation on @a it
- */
-const char *ofw_child_it_get_name(ofw_child_it_t *it)
-{
-	assert(!ofw_child_it_end(it));
-	return it->keys + it->pos;
-}
-
-/** Get child path from iterator.
- *
- * @param it Child iterator
- * @param rpath Place to store pointer to allocated OpenFirmware path
- * @return @c EOK on success or an error code
- */
-errno_t ofw_child_it_get_path(ofw_child_it_t *it, char **rpath)
-{
-	const char *name;
-	int rv;
-
-	assert(!ofw_child_it_end(it));
-	name = ofw_child_it_get_name(it);
-
-	rv = asprintf(rpath, "%s/%s", it->ofwpath, name);
-	if (rv < 0)
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Finalize child iterator.
- *
- * This must be called after using a child iterator.
- *
- * @param it Child iterator
- */
-void ofw_child_it_fini(ofw_child_it_t *it)
-{
-	free(it->ofwpath);
-	free(it->keys);
-	it->keys = NULL;
-	it->keys_sz = 0;
-}
-
-/** Initialize property iterator with property.
- *
- * Initialize the property iterator and make it point to the first property
- * of the specified OpenFirmware device node.
- *
- * @param it Property iterator to initialize
- * @param ofwpath OpenFirmware path of the node
- */
-errno_t ofw_prop_it_first(ofw_prop_it_t *it, const char *ofwpath)
-{
-	errno_t rc;
-	char *sipath;
-
-	it->data = NULL;
-	it->data_sz = 0;
-	it->pos = 0;
-
-	rc = ofw_path_to_sipath(ofwpath, &sipath);
-	if (rc != EOK)
-		goto error;
-
-	it->data = sysinfo_get_data(sipath, &it->data_sz);
-	if (it->data == NULL) {
-		rc = ENOENT;
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (sipath != NULL)
-		free(sipath);
-	return rc;
-}
-
-/** Move property iterator to the next property.
- *
- * @param it Child iterator
- */
-void ofw_prop_it_next(ofw_prop_it_t *it)
-{
-	size_t cur_size;
-	size_t value_size;
-
-	cur_size = str_nsize(it->data + it->pos, it->data_sz - it->pos);
-	if (((char *) it->data)[it->pos + cur_size] != 0)
-		return;
-
-	it->pos += cur_size + 1;
-
-	/* Process value size */
-	memcpy(&value_size, it->data + it->pos, sizeof(value_size));
-
-	it->pos += sizeof(value_size);
-	if ((it->pos >= it->data_sz) || (it->pos + value_size > it->data_sz))
-		return;
-
-	it->pos += value_size;
-}
-
-/** Determine if there are no more properties.
- *
- * @param it Property iterator
- * @return @c true iff iterator is beyond the last entry
- */
-bool ofw_prop_it_end(ofw_prop_it_t *it)
-{
-	return it->pos >= it->data_sz;
-}
-
-/** Get property name from iterator.
- *
- * @param it Child iterator
- * @return Property name (valid until next operation on @a it
- */
-const char *ofw_prop_it_get_name(ofw_prop_it_t *it)
-{
-	assert(!ofw_prop_it_end(it));
-	return it->data + it->pos;
-}
-
-/** Get property data from iterator.
- *
- * @param it Property iterator
- * @param rsize Place to store size of data
- * @return Pointer to data
- */
-const void *ofw_prop_it_get_data(ofw_prop_it_t *it, size_t *rsize)
-{
-	size_t cur_size;
-	size_t value_size;
-	size_t pos;
-
-	assert(!ofw_prop_it_end(it));
-	pos = it->pos;
-
-	cur_size = str_nsize(it->data + pos, it->data_sz - pos);
-	if (((char *) it->data)[pos + cur_size] != 0)
-		return NULL;
-
-	pos += cur_size + 1;
-
-	/* Process value size */
-	memcpy(&value_size, it->data + pos, sizeof(value_size));
-	pos += sizeof(value_size);
-
-	*rsize = value_size;
-	return it->data + pos;
-}
-
-/** Finalize property iterator.
- *
- * This must be called after using a child iterator.
- *
- * @param it Child iterator
- */
-void ofw_prop_it_fini(ofw_prop_it_t *it)
-{
-	free(it->data);
-	it->data = NULL;
-	it->data_sz = 0;
-	it->pos = 0;
-}
-
-/** @}
- */
Index: pace/lib/output/doc/doxygroups.h
===================================================================
--- uspace/lib/output/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup liboutput liboutput
- * @ingroup libs
- */
Index: pace/lib/output/include/io/charfield.h
===================================================================
--- uspace/lib/output/include/io/charfield.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBOUTPUT_IO_CHARFIELD_H_
-#define _LIBOUTPUT_IO_CHARFIELD_H_
-
-#include <stdbool.h>
-#include <uchar.h>
-#include <io/color.h>
-#include <io/style.h>
-#include <io/pixel.h>
-
-typedef enum {
-	CHAR_FLAG_NONE = 0,
-	CHAR_FLAG_DIRTY = 1
-} char_flags_t;
-
-typedef enum {
-	CHAR_ATTR_STYLE,
-	CHAR_ATTR_INDEX,
-	CHAR_ATTR_RGB
-} char_attr_type_t;
-
-typedef struct {
-	console_color_t bgcolor;
-	console_color_t fgcolor;
-	console_color_attr_t attr;
-} char_attr_index_t;
-
-typedef struct {
-	pixel_t bgcolor;
-	pixel_t fgcolor;
-} char_attr_rgb_t;
-
-typedef union {
-	console_style_t style;
-	char_attr_index_t index;
-	char_attr_rgb_t rgb;
-} char_attr_val_t;
-
-typedef struct {
-	char_attr_type_t type;
-	char_attr_val_t val;
-} char_attrs_t;
-
-typedef struct {
-	char32_t ch;
-	char_attrs_t attrs;
-	char_flags_t flags;
-} charfield_t;
-
-static inline bool attrs_same(char_attrs_t a1, char_attrs_t a2)
-{
-	if (a1.type != a2.type)
-		return false;
-
-	switch (a1.type) {
-	case CHAR_ATTR_STYLE:
-		return (a1.val.style == a2.val.style);
-	case CHAR_ATTR_INDEX:
-		return (a1.val.index.bgcolor == a2.val.index.bgcolor) &&
-		    (a1.val.index.fgcolor == a2.val.index.fgcolor) &&
-		    (a1.val.index.attr == a2.val.index.attr);
-	case CHAR_ATTR_RGB:
-		return (a1.val.rgb.bgcolor == a2.val.rgb.bgcolor) &&
-		    (a1.val.rgb.fgcolor == a2.val.rgb.fgcolor);
-	}
-
-	return false;
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/output/include/io/chargrid.h
===================================================================
--- uspace/lib/output/include/io/chargrid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/**
- * @file
- */
-
-#ifndef _LIBOUTPUT_IO_CHARGRID_H_
-#define _LIBOUTPUT_IO_CHARGRID_H_
-
-#include <io/charfield.h>
-#include <types/common.h>
-#include <stddef.h>
-
-typedef enum {
-	CHARGRID_FLAG_NONE = 0,
-	CHARGRID_FLAG_SHARED = 1
-} chargrid_flag_t;
-
-typedef struct {
-	size_t size;            /**< Structure size */
-	chargrid_flag_t flags;  /**< Screenbuffer flags */
-
-	sysarg_t cols;          /**< Number of columns */
-	sysarg_t rows;          /**< Number of rows */
-
-	sysarg_t col;           /**< Current column */
-	sysarg_t row;           /**< Current row */
-	bool cursor_visible;    /**< Cursor visibility */
-
-	char_attrs_t attrs;     /**< Current attributes */
-
-	sysarg_t top_row;       /**< The first row in the cyclic buffer */
-	charfield_t data[];     /**< Screen contents (cyclic buffer) */
-} chargrid_t;
-
-static inline charfield_t *chargrid_charfield_at(chargrid_t *chargrid,
-    sysarg_t col, sysarg_t row)
-{
-	return chargrid->data +
-	    ((row + chargrid->top_row) % chargrid->rows) * chargrid->cols +
-	    col;
-}
-
-extern chargrid_t *chargrid_create(sysarg_t, sysarg_t,
-    chargrid_flag_t);
-extern void chargrid_destroy(chargrid_t *);
-
-extern bool chargrid_cursor_at(chargrid_t *, sysarg_t, sysarg_t);
-
-extern sysarg_t chargrid_get_top_row(chargrid_t *);
-
-extern sysarg_t chargrid_putuchar(chargrid_t *, char32_t, bool);
-extern sysarg_t chargrid_newline(chargrid_t *);
-extern sysarg_t chargrid_tabstop(chargrid_t *, sysarg_t);
-extern sysarg_t chargrid_backspace(chargrid_t *);
-
-extern void chargrid_clear(chargrid_t *);
-extern void chargrid_clear_row(chargrid_t *, sysarg_t);
-
-extern void chargrid_set_cursor(chargrid_t *, sysarg_t, sysarg_t);
-extern void chargrid_set_cursor_visibility(chargrid_t *, bool);
-extern bool chargrid_get_cursor_visibility(chargrid_t *);
-
-extern void chargrid_get_cursor(chargrid_t *, sysarg_t *, sysarg_t *);
-
-extern void chargrid_set_style(chargrid_t *, console_style_t);
-extern void chargrid_set_color(chargrid_t *, console_color_t,
-    console_color_t, console_color_attr_t);
-extern void chargrid_set_rgb_color(chargrid_t *, pixel_t, pixel_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/output/include/io/color.h
===================================================================
--- uspace/lib/output/include/io/color.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBOUTPUT_IO_COLOR_H_
-#define _LIBOUTPUT_IO_COLOR_H_
-
-typedef enum {
-	COLOR_BLACK   = 0,
-	COLOR_BLUE    = 1,
-	COLOR_GREEN   = 2,
-	COLOR_CYAN    = 3,
-	COLOR_RED     = 4,
-	COLOR_MAGENTA = 5,
-	COLOR_YELLOW  = 6,
-	COLOR_WHITE   = 7
-} console_color_t;
-
-typedef enum {
-	CATTR_NORMAL = 0,
-	CATTR_BRIGHT = 8,
-	CATTR_BLINK  = 16
-} console_color_attr_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/output/include/io/concaps.h
===================================================================
--- uspace/lib/output/include/io/concaps.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBOUTPUT_IO_CONCAPS_H_
-#define _LIBOUTPUT_IO_CONCAPS_H_
-
-typedef enum {
-	CONSOLE_CAP_NONE = 0,
-	CONSOLE_CAP_CURSORCTL = 1,
-	CONSOLE_CAP_STYLE = 2,
-	CONSOLE_CAP_INDEXED = 4,
-	CONSOLE_CAP_RGB = 8
-} console_caps_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/output/include/io/output.h
===================================================================
--- uspace/lib/output/include/io/output.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBOUTPUT_IO_OUTPUT_H_
-#define _LIBOUTPUT_IO_OUTPUT_H_
-
-#include <ipc/output.h>
-#include <io/chargrid.h>
-#include <io/concaps.h>
-#include <io/style.h>
-
-extern errno_t output_yield(async_sess_t *);
-extern errno_t output_claim(async_sess_t *);
-extern errno_t output_get_dimensions(async_sess_t *, sysarg_t *, sysarg_t *);
-extern errno_t output_get_caps(async_sess_t *, console_caps_t *);
-
-extern frontbuf_handle_t output_frontbuf_create(async_sess_t *, chargrid_t *);
-
-extern errno_t output_cursor_update(async_sess_t *, frontbuf_handle_t);
-extern errno_t output_set_style(async_sess_t *, console_style_t);
-
-extern errno_t output_update(async_sess_t *, frontbuf_handle_t);
-extern errno_t output_damage(async_sess_t *, frontbuf_handle_t,
-    sysarg_t, sysarg_t, sysarg_t, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/output/include/ipc/output.h
===================================================================
--- uspace/lib/output/include/ipc/output.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBOUTPUT_IPC_OUTPUT_H_
-#define _LIBOUTPUT_IPC_OUTPUT_H_
-
-#include <ipc/common.h>
-
-typedef sysarg_t frontbuf_handle_t;
-
-typedef enum {
-	OUTPUT_YIELD = IPC_FIRST_USER_METHOD,
-	OUTPUT_CLAIM,
-	OUTPUT_GET_DIMENSIONS,
-	OUTPUT_GET_CAPS,
-
-	OUTPUT_FRONTBUF_CREATE,
-	OUTPUT_FRONTBUF_DESTROY,
-
-	OUTPUT_CURSOR_UPDATE,
-	OUTPUT_SET_STYLE,
-	OUTPUT_SET_COLOR,
-	OUTPUT_SET_RGB_COLOR,
-
-	OUTPUT_UPDATE,
-	OUTPUT_DAMAGE
-} output_request_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/output/meson.build
===================================================================
--- uspace/lib/output/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/chargrid.c',
-	'src/output.c',
-)
Index: pace/lib/output/src/chargrid.c
===================================================================
--- uspace/lib/output/src/chargrid.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,362 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#include <io/style.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <as.h>
-#include <io/chargrid.h>
-
-/** Create a chargrid.
- *
- * @param[in] cols  Number of columns.
- * @param[in] rows  Number of rows.
- * @param[in] flags Chargrid flags.
- *
- * @return New chargrid.
- * @return NULL on failure.
- *
- */
-chargrid_t *chargrid_create(sysarg_t cols, sysarg_t rows,
-    chargrid_flag_t flags)
-{
-	size_t size =
-	    sizeof(chargrid_t) + cols * rows * sizeof(charfield_t);
-	chargrid_t *scrbuf;
-
-	if ((flags & CHARGRID_FLAG_SHARED) == CHARGRID_FLAG_SHARED) {
-		scrbuf = (chargrid_t *) as_area_create(AS_AREA_ANY, size,
-		    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
-		    AS_AREA_UNPAGED);
-		if (scrbuf == AS_MAP_FAILED)
-			return NULL;
-	} else {
-		scrbuf = (chargrid_t *) malloc(size);
-		if (scrbuf == NULL)
-			return NULL;
-	}
-
-	scrbuf->size = size;
-	scrbuf->flags = flags;
-	scrbuf->cols = cols;
-	scrbuf->rows = rows;
-	scrbuf->cursor_visible = false;
-
-	scrbuf->attrs.type = CHAR_ATTR_STYLE;
-	scrbuf->attrs.val.style = STYLE_NORMAL;
-
-	scrbuf->top_row = 0;
-	chargrid_clear(scrbuf);
-
-	return scrbuf;
-}
-
-void chargrid_destroy(chargrid_t *srcbuf)
-{
-	// TODO
-}
-
-bool chargrid_cursor_at(chargrid_t *scrbuf, sysarg_t col, sysarg_t row)
-{
-	return ((scrbuf->cursor_visible) && (scrbuf->col == col) &&
-	    (scrbuf->row == row));
-}
-
-sysarg_t chargrid_get_top_row(chargrid_t *scrbuf)
-{
-	return scrbuf->top_row;
-}
-
-static sysarg_t chargrid_update_rows(chargrid_t *scrbuf)
-{
-	if (scrbuf->row == scrbuf->rows) {
-		scrbuf->row = scrbuf->rows - 1;
-		scrbuf->top_row = (scrbuf->top_row + 1) % scrbuf->rows;
-		chargrid_clear_row(scrbuf, scrbuf->row);
-
-		return scrbuf->rows;
-	}
-
-	return 2;
-}
-
-static sysarg_t chargrid_update_cols(chargrid_t *scrbuf)
-{
-	/* Column overflow */
-	if (scrbuf->col == scrbuf->cols) {
-		scrbuf->col = 0;
-		scrbuf->row++;
-		return chargrid_update_rows(scrbuf);
-	}
-
-	return 1;
-}
-
-/** Store one character to chargrid.
- *
- * Its position is determined by scrbuf->col
- * and scrbuf->row.
- *
- * @param scrbuf Chargrid.
- * @param ch     Character to store.
- * @param update Update coordinates.
- *
- * @return Number of rows which have been affected. In usual
- *         situations this is 1. If the current position was
- *         updated to a new row, this value is 2.
- *
- */
-sysarg_t chargrid_putuchar(chargrid_t *scrbuf, char32_t ch, bool update)
-{
-	assert(scrbuf->col < scrbuf->cols);
-	assert(scrbuf->row < scrbuf->rows);
-
-	charfield_t *field =
-	    chargrid_charfield_at(scrbuf, scrbuf->col, scrbuf->row);
-
-	field->ch = ch;
-	field->attrs = scrbuf->attrs;
-	field->flags |= CHAR_FLAG_DIRTY;
-
-	if (update) {
-		scrbuf->col++;
-		return chargrid_update_cols(scrbuf);
-	}
-
-	return 1;
-}
-
-/** Jump to a new row in chargrid.
- *
- * @param scrbuf Chargrid.
- *
- * @return Number of rows which have been affected. In usual
- *         situations this is 2 (the original row and the new
- *         row).
- *
- */
-sysarg_t chargrid_newline(chargrid_t *scrbuf)
-{
-	assert(scrbuf->col < scrbuf->cols);
-	assert(scrbuf->row < scrbuf->rows);
-
-	scrbuf->col = 0;
-	scrbuf->row++;
-
-	return chargrid_update_rows(scrbuf);
-}
-
-/** Jump to a new row in chargrid.
- *
- * @param scrbuf   Chargrid.
- * @param tab_size Tab size.
- *
- * @return Number of rows which have been affected. In usual
- *         situations this is 1. If the current position was
- *         updated to a new row, this value is 2.
- *
- */
-sysarg_t chargrid_tabstop(chargrid_t *scrbuf, sysarg_t tab_size)
-{
-	assert(scrbuf->col < scrbuf->cols);
-	assert(scrbuf->row < scrbuf->rows);
-
-	sysarg_t spaces = tab_size - scrbuf->cols % tab_size;
-	sysarg_t flush = 1;
-
-	for (sysarg_t i = 0; i < spaces; i++)
-		flush += chargrid_putuchar(scrbuf, ' ', true) - 1;
-
-	return flush;
-}
-
-/** Jump to the previous character in chargrid.
- *
- * Currently no scrollback is supported.
- *
- * @param scrbuf Chargrid.
- *
- * @return Number of rows which have been affected. In usual
- *         situations this is 1. If the current position was
- *         updated to the previous row, this value is 2.
- * @return 0 if no backspace is possible.
- *
- */
-sysarg_t chargrid_backspace(chargrid_t *scrbuf)
-{
-	assert(scrbuf->col < scrbuf->cols);
-	assert(scrbuf->row < scrbuf->rows);
-
-	if ((scrbuf->col == 0) && (scrbuf->row == 0))
-		return 0;
-
-	if (scrbuf->col == 0) {
-		scrbuf->col = scrbuf->cols - 1;
-		scrbuf->row--;
-
-		chargrid_putuchar(scrbuf, ' ', false);
-		return 2;
-	}
-
-	scrbuf->col--;
-	chargrid_putuchar(scrbuf, ' ', false);
-	return 1;
-}
-
-/** Clear the chargrid.
- *
- * @param scrbuf Chargrid.
- *
- */
-void chargrid_clear(chargrid_t *scrbuf)
-{
-	for (size_t pos = 0; pos < (scrbuf->cols * scrbuf->rows); pos++) {
-		scrbuf->data[pos].ch = 0;
-		scrbuf->data[pos].attrs = scrbuf->attrs;
-		scrbuf->data[pos].flags = CHAR_FLAG_DIRTY;
-	}
-
-	scrbuf->col = 0;
-	scrbuf->row = 0;
-}
-
-/** Update current chargrid coordinates
- *
- * @param scrbuf Chargrid.
- * @param col    New column.
- * @param row    New row.
- *
- */
-void chargrid_set_cursor(chargrid_t *scrbuf, sysarg_t col, sysarg_t row)
-{
-	if (col >= scrbuf->cols || row >= scrbuf->rows)
-		return;
-
-	scrbuf->col = col;
-	scrbuf->row = row;
-}
-
-void chargrid_set_cursor_visibility(chargrid_t *scrbuf, bool visible)
-{
-	scrbuf->cursor_visible = visible;
-}
-
-/** Get current chargrid coordinates
- *
- * @param scrbuf Chargrid.
- * @param col    Column.
- * @param row    Row.
- *
- */
-void chargrid_get_cursor(chargrid_t *scrbuf, sysarg_t *col,
-    sysarg_t *row)
-{
-	assert(col);
-	assert(row);
-
-	*col = scrbuf->col;
-	*row = scrbuf->row;
-}
-
-bool chargrid_get_cursor_visibility(chargrid_t *scrbuf)
-{
-	return scrbuf->cursor_visible;
-}
-
-/** Clear one buffer row.
- *
- * @param scrbuf Chargrid.
- * @param row    Row to clear.
- *
- */
-void chargrid_clear_row(chargrid_t *scrbuf, sysarg_t row)
-{
-	for (sysarg_t col = 0; col < scrbuf->cols; col++) {
-		charfield_t *field =
-		    chargrid_charfield_at(scrbuf, col, row);
-
-		field->ch = 0;
-		field->attrs = scrbuf->attrs;
-		field->flags |= CHAR_FLAG_DIRTY;
-	}
-}
-
-/** Set chargrid style.
- *
- * @param scrbuf Chargrid.
- * @param style  Style.
- *
- */
-void chargrid_set_style(chargrid_t *scrbuf, console_style_t style)
-{
-	scrbuf->attrs.type = CHAR_ATTR_STYLE;
-	scrbuf->attrs.val.style = style;
-}
-
-/** Set chargrid color.
- *
- * @param scrbuf  Chargrid.
- * @param bgcolor Background color.
- * @param fgcolor Foreground color.
- * @param attr    Color attribute.
- *
- */
-void chargrid_set_color(chargrid_t *scrbuf, console_color_t bgcolor,
-    console_color_t fgcolor, console_color_attr_t attr)
-{
-	scrbuf->attrs.type = CHAR_ATTR_INDEX;
-	scrbuf->attrs.val.index.bgcolor = bgcolor;
-	scrbuf->attrs.val.index.fgcolor = fgcolor;
-	scrbuf->attrs.val.index.attr = attr;
-}
-
-/** Set chargrid RGB color.
- *
- * @param scrbuf  Chargrid.
- * @param bgcolor Background color.
- * @param fgcolor Foreground color.
- *
- */
-void chargrid_set_rgb_color(chargrid_t *scrbuf, pixel_t bgcolor,
-    pixel_t fgcolor)
-{
-	scrbuf->attrs.type = CHAR_ATTR_RGB;
-	scrbuf->attrs.val.rgb.bgcolor = bgcolor;
-	scrbuf->attrs.val.rgb.fgcolor = fgcolor;
-}
-
-/** @}
- */
Index: pace/lib/output/src/output.c
===================================================================
--- uspace/lib/output/src/output.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup liboutput
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <as.h>
-#include <ipc/output.h>
-#include <io/concaps.h>
-#include <io/output.h>
-
-errno_t output_yield(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, OUTPUT_YIELD);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_claim(async_sess_t *sess)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_0(exch, OUTPUT_CLAIM);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_get_dimensions(async_sess_t *sess, sysarg_t *maxx, sysarg_t *maxy)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_0_2(exch, OUTPUT_GET_DIMENSIONS, maxx, maxy);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_get_caps(async_sess_t *sess, console_caps_t *ccaps)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	sysarg_t rv;
-	errno_t ret = async_req_0_1(exch, OUTPUT_GET_CAPS, &rv);
-
-	async_exchange_end(exch);
-
-	if (ret == EOK)
-		*ccaps = (console_caps_t) rv;
-
-	return ret;
-}
-
-frontbuf_handle_t output_frontbuf_create(async_sess_t *sess,
-    chargrid_t *frontbuf)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_0(exch, OUTPUT_FRONTBUF_CREATE, &answer);
-	errno_t rc = async_share_out_start(exch, frontbuf, AS_AREA_READ |
-	    AS_AREA_WRITE | AS_AREA_CACHEABLE);
-
-	async_exchange_end(exch);
-
-	errno_t ret;
-	async_wait_for(req, &ret);
-
-	if ((rc != EOK) || (ret != EOK))
-		return 0;
-
-	return (frontbuf_handle_t) ipc_get_arg1(&answer);
-}
-
-errno_t output_set_style(async_sess_t *sess, console_style_t style)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_SET_STYLE, style);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_cursor_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_CURSOR_UPDATE, frontbuf);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_update(async_sess_t *sess, frontbuf_handle_t frontbuf)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_1_0(exch, OUTPUT_UPDATE, frontbuf);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-errno_t output_damage(async_sess_t *sess, frontbuf_handle_t frontbuf, sysarg_t col,
-    sysarg_t row, sysarg_t cols, sysarg_t rows)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	errno_t ret = async_req_5_0(exch, OUTPUT_DAMAGE, frontbuf, col, row,
-	    cols, rows);
-	async_exchange_end(exch);
-
-	return ret;
-}
-
-/** @}
- */
Index: pace/lib/pcm/include/pcm/format.h
===================================================================
--- uspace/lib/pcm/include/pcm/format.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef PCM_FORMAT_H_
-#define PCM_FORMAT_H_
-
-#include <assert.h>
-#include <stdbool.h>
-#include <pcm/sample_format.h>
-
-/** Linear PCM audio parameters */
-typedef struct {
-	unsigned channels;
-	unsigned sampling_rate;
-	pcm_sample_format_t sample_format;
-} pcm_format_t;
-
-extern const pcm_format_t AUDIO_FORMAT_DEFAULT;
-extern const pcm_format_t AUDIO_FORMAT_ANY;
-
-/**
- * Frame size helper function.
- * @param a pointer to a PCM format structure.
- * @return Size in bytes.
- */
-static inline size_t pcm_format_frame_size(const pcm_format_t *a)
-{
-	return pcm_sample_format_frame_size(a->channels, a->sample_format);
-}
-
-/**
- * Convert byte size to frame count.
- * @param size Byte-size.
- * @param a pointer to a PCM format structure.
- * @return Frame count.
- */
-static inline size_t pcm_format_size_to_frames(size_t size,
-    const pcm_format_t *a)
-{
-	return pcm_sample_format_size_to_frames(size, a->channels,
-	    a->sample_format);
-}
-
-/**
- * Convert byte size to audio playback time.
- * @param size Byte-size.
- * @param a pointer to a PCM format structure.
- * @return Number of microseconds.
- */
-static inline usec_t pcm_format_size_to_usec(size_t size, const pcm_format_t *a)
-{
-	return pcm_sample_format_size_to_usec(size, a->sampling_rate,
-	    a->channels, a->sample_format);
-}
-
-bool pcm_format_same(const pcm_format_t *a, const pcm_format_t *b);
-
-/**
- * Helper function, compares with ANY metaformat.
- * @param f pointer to format structure.
- * @return True if @p f points to ANY format, false otherwise.
- */
-static inline bool pcm_format_is_any(const pcm_format_t *f)
-{
-	return pcm_format_same(f, &AUDIO_FORMAT_ANY);
-}
-void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f);
-errno_t pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
-    size_t src_size, const pcm_format_t *sf, const pcm_format_t *df);
-errno_t pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f);
-errno_t pcm_format_convert(pcm_format_t a, void *srca, size_t sizea,
-    pcm_format_t b, void *srcb, size_t *sizeb);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/pcm/include/pcm/sample_format.h
===================================================================
--- uspace/lib/pcm/include/pcm/sample_format.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief PCM sample format
- * @{
- */
-/** @file
- */
-
-#ifndef PCM_SAMPLE_FORMAT_H_
-#define PCM_SAMPLE_FORMAT_H_
-
-#include <stdbool.h>
-#include <time.h>
-
-/** Known and supported PCM sample formats */
-typedef enum {
-	PCM_SAMPLE_UINT8,
-	PCM_SAMPLE_SINT8,
-	PCM_SAMPLE_UINT16_LE,
-	PCM_SAMPLE_UINT16_BE,
-	PCM_SAMPLE_SINT16_LE,
-	PCM_SAMPLE_SINT16_BE,
-	PCM_SAMPLE_UINT24_LE,
-	PCM_SAMPLE_UINT24_BE,
-	PCM_SAMPLE_SINT24_LE,
-	PCM_SAMPLE_SINT24_BE,
-	PCM_SAMPLE_UINT24_32_LE,
-	PCM_SAMPLE_UINT24_32_BE,
-	PCM_SAMPLE_SINT24_32_LE,
-	PCM_SAMPLE_SINT24_32_BE,
-	PCM_SAMPLE_UINT32_LE,
-	PCM_SAMPLE_UINT32_BE,
-	PCM_SAMPLE_SINT32_LE,
-	PCM_SAMPLE_SINT32_BE,
-	PCM_SAMPLE_FLOAT32,
-	PCM_SAMPLE_FORMAT_LAST = PCM_SAMPLE_FLOAT32,
-} pcm_sample_format_t;
-
-/**
- * Query if the format uses signed values.
- * @param format PCM sample format.
- * @return True if the format uses signed values, false otherwise.
- */
-static inline bool pcm_sample_format_is_signed(pcm_sample_format_t format)
-{
-	switch (format) {
-	case PCM_SAMPLE_SINT8:
-	case PCM_SAMPLE_SINT16_LE:
-	case PCM_SAMPLE_SINT16_BE:
-	case PCM_SAMPLE_SINT24_LE:
-	case PCM_SAMPLE_SINT24_BE:
-	case PCM_SAMPLE_SINT24_32_LE:
-	case PCM_SAMPLE_SINT24_32_BE:
-	case PCM_SAMPLE_SINT32_LE:
-	case PCM_SAMPLE_SINT32_BE:
-		return true;
-	case PCM_SAMPLE_UINT8:
-	case PCM_SAMPLE_UINT16_LE:
-	case PCM_SAMPLE_UINT16_BE:
-	case PCM_SAMPLE_UINT24_LE:
-	case PCM_SAMPLE_UINT24_BE:
-	case PCM_SAMPLE_UINT24_32_LE:
-	case PCM_SAMPLE_UINT24_32_BE:
-	case PCM_SAMPLE_UINT32_LE:
-	case PCM_SAMPLE_UINT32_BE:
-	case PCM_SAMPLE_FLOAT32:
-	default:
-		return false;
-	}
-}
-
-/**
- * Query byte-size of samples.
- * @param format PCM sample format.
- * @return Size in bytes of a single sample.
- */
-static inline size_t pcm_sample_format_size(pcm_sample_format_t format)
-{
-	switch (format) {
-	case PCM_SAMPLE_UINT8:
-	case PCM_SAMPLE_SINT8:
-		return 1;
-	case PCM_SAMPLE_UINT16_LE:
-	case PCM_SAMPLE_UINT16_BE:
-	case PCM_SAMPLE_SINT16_LE:
-	case PCM_SAMPLE_SINT16_BE:
-		return 2;
-	case PCM_SAMPLE_UINT24_LE:
-	case PCM_SAMPLE_UINT24_BE:
-	case PCM_SAMPLE_SINT24_LE:
-	case PCM_SAMPLE_SINT24_BE:
-		return 3;
-	case PCM_SAMPLE_UINT24_32_LE:
-	case PCM_SAMPLE_UINT24_32_BE:
-	case PCM_SAMPLE_SINT24_32_LE:
-	case PCM_SAMPLE_SINT24_32_BE:
-	case PCM_SAMPLE_UINT32_LE:
-	case PCM_SAMPLE_UINT32_BE:
-	case PCM_SAMPLE_SINT32_LE:
-	case PCM_SAMPLE_SINT32_BE:
-	case PCM_SAMPLE_FLOAT32:
-		return 4;
-	default:
-		return 0;
-	}
-}
-
-/**
- * Query sie of the entire frame.
- * @param channels Number of samples in every frame.
- * @param format PCM sample format.
- * @return Size in bytes.
- */
-static inline size_t pcm_sample_format_frame_size(unsigned channels,
-    pcm_sample_format_t format)
-{
-	return pcm_sample_format_size(format) * channels;
-}
-
-/**
- * Count number of frames that fit into a buffer (even incomplete frames).
- * @param size Size of the buffer.
- * @param channels Number of samples in every frame.
- * @param format PCM sample format.
- * @return Number of frames (even incomplete).
- */
-static inline size_t pcm_sample_format_size_to_frames(size_t size,
-    unsigned channels, pcm_sample_format_t format)
-{
-	const size_t frame_size = pcm_sample_format_frame_size(channels, format);
-	return (size + frame_size - 1) / frame_size;
-}
-
-/**
- * Convert byte size to time.
- * @param size Size of the buffer.
- * @param sample_rate Samples per second.
- * @param channels Number of samples in every frame.
- * @param format PCM sample format.
- * @return Number of useconds of audio data.
- */
-static inline usec_t pcm_sample_format_size_to_usec(size_t size,
-    unsigned sample_rate, unsigned channels, pcm_sample_format_t format)
-{
-	const unsigned long long frames =
-	    pcm_sample_format_size_to_frames(size, channels, format);
-	return (frames * 1000000ULL) / sample_rate;
-}
-
-/**
- * Get readable name of a sample format.
- * @param format PCM sample format.
- * @return Valid string representation.
- */
-static inline const char *pcm_sample_format_str(pcm_sample_format_t format)
-{
-	switch (format) {
-	case PCM_SAMPLE_UINT8:
-		return "8 bit unsigned";
-	case PCM_SAMPLE_SINT8:
-		return "8 bit signed";
-	case PCM_SAMPLE_UINT16_LE:
-		return "16 bit unsigned(LE)";
-	case PCM_SAMPLE_SINT16_LE:
-		return "16 bit signed(LE)";
-	case PCM_SAMPLE_UINT16_BE:
-		return "16 bit unsigned(BE)";
-	case PCM_SAMPLE_SINT16_BE:
-		return "16 bit signed(BE)";
-	case PCM_SAMPLE_UINT24_LE:
-		return "24 bit unsigned(LE)";
-	case PCM_SAMPLE_SINT24_LE:
-		return "24 bit signed(LE)";
-	case PCM_SAMPLE_UINT24_BE:
-		return "24 bit unsigned(BE)";
-	case PCM_SAMPLE_SINT24_BE:
-		return "24 bit signed(BE)";
-	case PCM_SAMPLE_UINT24_32_LE:
-		return "24 bit(4byte aligned) unsigned(LE)";
-	case PCM_SAMPLE_UINT24_32_BE:
-		return "24 bit(4byte aligned) unsigned(BE)";
-	case PCM_SAMPLE_SINT24_32_LE:
-		return "24 bit(4byte aligned) signed(LE)";
-	case PCM_SAMPLE_SINT24_32_BE:
-		return "24 bit(4byte aligned) signed(BE)";
-	case PCM_SAMPLE_UINT32_LE:
-		return "32 bit unsigned(LE)";
-	case PCM_SAMPLE_UINT32_BE:
-		return "32 bit unsigned(BE)";
-	case PCM_SAMPLE_SINT32_LE:
-		return "32 bit signed(LE)";
-	case PCM_SAMPLE_SINT32_BE:
-		return "32 bit signed(BE)";
-	case PCM_SAMPLE_FLOAT32:
-		return "32 bit float";
-	default:
-		return "Unknown sample format";
-	}
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/pcm/meson.build
===================================================================
--- uspace/lib/pcm/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-private_includes += include_directories('include/pcm')
-src = files(
-	'src/format.c',
-)
Index: pace/lib/pcm/src/format.c
===================================================================
--- uspace/lib/pcm/src/format.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <macros.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <limits.h>
-
-#include "format.h"
-
-// TODO float endian?
-#define float_le2host(x) (x)
-#define float_be2host(x) (x)
-
-#define host2float_le(x) (x)
-#define host2float_be(x) (x)
-
-#define from(x, type, endian) (float)(type ## _ ## endian ## 2host(x))
-#define to(x, type, endian) (float)(host2 ## type ## _ ## endian(x))
-
-/** Default linear PCM format */
-const pcm_format_t AUDIO_FORMAT_DEFAULT = {
-	.channels = 2,
-	.sampling_rate = 44100,
-	.sample_format = PCM_SAMPLE_SINT16_LE,
-};
-
-/** Special ANY PCM format.
- * This format is used if the real format is no know or important.
- */
-const pcm_format_t AUDIO_FORMAT_ANY = {
-	.channels = 0,
-	.sampling_rate = 0,
-	.sample_format = 0,
-};
-
-static float get_normalized_sample(const void *buffer, size_t size,
-    unsigned frame, unsigned channel, const pcm_format_t *f);
-
-/**
- * Compare PCM format attribtues.
- * @param a Format description.
- * @param b Format description.
- * @return True if a and b describe the same format, false otherwise.
- */
-bool pcm_format_same(const pcm_format_t *a, const pcm_format_t *b)
-{
-	assert(a);
-	assert(b);
-	return
-	    a->sampling_rate == b->sampling_rate &&
-	    a->channels == b->channels &&
-	    a->sample_format == b->sample_format;
-}
-
-/**
- * Fill audio buffer with silence in the specified format.
- * @param dst Destination audio buffer.
- * @param size Size of the destination audio buffer.
- * @param f Pointer to the format description.
- */
-void pcm_format_silence(void *dst, size_t size, const pcm_format_t *f)
-{
-#define SET_NULL(type, endian, nullv) \
-do { \
-	type *buffer = dst; \
-	const size_t sample_count = size / sizeof(type); \
-	for (unsigned i = 0; i < sample_count; ++i) { \
-		buffer[i] = to((type)nullv, type, endian); \
-	} \
-} while (0)
-
-	switch (f->sample_format) {
-	case PCM_SAMPLE_UINT8:
-		SET_NULL(uint8_t, le, INT8_MIN);
-		break;
-	case PCM_SAMPLE_SINT8:
-		SET_NULL(int8_t, le, 0);
-		break;
-	case PCM_SAMPLE_UINT16_LE:
-		SET_NULL(uint16_t, le, INT16_MIN);
-		break;
-	case PCM_SAMPLE_SINT16_LE:
-		SET_NULL(int16_t, le, 0);
-		break;
-	case PCM_SAMPLE_UINT16_BE:
-		SET_NULL(uint16_t, be, INT16_MIN);
-		break;
-	case PCM_SAMPLE_SINT16_BE:
-		SET_NULL(int16_t, be, 0);
-		break;
-	case PCM_SAMPLE_UINT32_LE:
-		SET_NULL(uint32_t, le, INT32_MIN);
-		break;
-	case PCM_SAMPLE_SINT32_LE:
-		SET_NULL(int32_t, le, 0);
-		break;
-	case PCM_SAMPLE_UINT32_BE:
-		SET_NULL(uint32_t, be, INT32_MIN);
-		break;
-	case PCM_SAMPLE_SINT32_BE:
-		SET_NULL(int32_t, le, 0);
-		break;
-	case PCM_SAMPLE_UINT24_32_LE:
-	case PCM_SAMPLE_SINT24_32_LE:
-	case PCM_SAMPLE_UINT24_32_BE:
-	case PCM_SAMPLE_SINT24_32_BE:
-	case PCM_SAMPLE_UINT24_LE:
-	case PCM_SAMPLE_SINT24_LE:
-	case PCM_SAMPLE_UINT24_BE:
-	case PCM_SAMPLE_SINT24_BE:
-	case PCM_SAMPLE_FLOAT32:
-	default:
-		break;
-	}
-#undef SET_NULL
-}
-
-/**
- * Mix audio data of the same format and size.
- * @param dst Destination buffer
- * @param src Source buffer
- * @param size Size of both the destination and the source buffer
- * @param f Pointer to the format descriptor.
- * @return Error code.
- */
-errno_t pcm_format_mix(void *dst, const void *src, size_t size, const pcm_format_t *f)
-{
-	return pcm_format_convert_and_mix(dst, size, src, size, f, f);
-}
-
-/**
- * Add and mix audio data.
- * @param dst Destination audio buffer
- * @param dst_size Size of the destination buffer
- * @param src Source audio buffer
- * @param src_size Size of the source buffer.
- * @param sf Pointer to the source format descriptor.
- * @param df Pointer to the destination format descriptor.
- * @return Error code.
- *
- * Buffers must contain entire frames. Destination buffer is always filled.
- * If there are not enough data in the source buffer silent data is assumed.
- */
-errno_t pcm_format_convert_and_mix(void *dst, size_t dst_size, const void *src,
-    size_t src_size, const pcm_format_t *sf, const pcm_format_t *df)
-{
-	if (!dst || !src || !sf || !df)
-		return EINVAL;
-	const size_t src_frame_size = pcm_format_frame_size(sf);
-	if ((src_size % src_frame_size) != 0)
-		return EINVAL;
-
-	const size_t dst_frame_size = pcm_format_frame_size(df);
-	if ((dst_size % dst_frame_size) != 0)
-		return EINVAL;
-
-	/*
-	 * This is so ugly it eats kittens, and puppies, and ducklings,
-	 * and all little fluffy things...
-	 */
-#define LOOP_ADD(type, endian, low, high) \
-do { \
-	const unsigned frame_count = dst_size / dst_frame_size; \
-	for (size_t i = 0; i < frame_count; ++i) { \
-		for (unsigned j = 0; j < df->channels; ++j) { \
-			const float a = \
-			    get_normalized_sample(dst, dst_size, i, j, df);\
-			const float b = \
-			    get_normalized_sample(src, src_size, i, j, sf);\
-			float c = (a + b); \
-			if (c < -1.0) c = -1.0; \
-			if (c > 1.0) c = 1.0; \
-			c += 1.0; \
-			c *= ((float)(type)high - (float)(type)low) / 2; \
-			c += (float)(type)low; \
-			type *dst_buf = dst; \
-			const unsigned pos = i * df->channels  + j; \
-			if (pos < (dst_size / sizeof(type))) \
-				dst_buf[pos] = to((type)c, type, endian); \
-		} \
-	} \
-} while (0)
-
-	switch (df->sample_format) {
-	case PCM_SAMPLE_UINT8:
-		LOOP_ADD(uint8_t, le, UINT8_MIN, UINT8_MAX);
-		break;
-	case PCM_SAMPLE_SINT8:
-		LOOP_ADD(uint8_t, le, INT8_MIN, INT8_MAX);
-		break;
-	case PCM_SAMPLE_UINT16_LE:
-		LOOP_ADD(uint16_t, le, UINT16_MIN, UINT16_MAX);
-		break;
-	case PCM_SAMPLE_SINT16_LE:
-		LOOP_ADD(int16_t, le, INT16_MIN, INT16_MAX);
-		break;
-	case PCM_SAMPLE_UINT16_BE:
-		LOOP_ADD(uint16_t, be, UINT16_MIN, UINT16_MAX);
-		break;
-	case PCM_SAMPLE_SINT16_BE:
-		LOOP_ADD(int16_t, be, INT16_MIN, INT16_MAX);
-		break;
-	case PCM_SAMPLE_UINT24_32_LE:
-	case PCM_SAMPLE_UINT32_LE: // TODO this are not right for 24bit
-		LOOP_ADD(uint32_t, le, UINT32_MIN, UINT32_MAX);
-		break;
-	case PCM_SAMPLE_SINT24_32_LE:
-	case PCM_SAMPLE_SINT32_LE:
-		LOOP_ADD(int32_t, le, INT32_MIN, INT32_MAX);
-		break;
-	case PCM_SAMPLE_UINT24_32_BE:
-	case PCM_SAMPLE_UINT32_BE:
-		LOOP_ADD(uint32_t, be, UINT32_MIN, UINT32_MAX);
-		break;
-	case PCM_SAMPLE_SINT24_32_BE:
-	case PCM_SAMPLE_SINT32_BE:
-		LOOP_ADD(int32_t, be, INT32_MIN, INT32_MAX);
-		break;
-	case PCM_SAMPLE_UINT24_LE:
-	case PCM_SAMPLE_SINT24_LE:
-	case PCM_SAMPLE_UINT24_BE:
-	case PCM_SAMPLE_SINT24_BE:
-	case PCM_SAMPLE_FLOAT32:
-	default:
-		return ENOTSUP;
-	}
-	return EOK;
-#undef LOOP_ADD
-}
-
-/**
- * Converts all sample formats to float <-1,1>
- * @param buffer Audio data
- * @param size Size of the buffer
- * @param frame Index of the frame to read
- * @param channel Channel within the frame
- * @param f Pointer to a format descriptor
- * @return Normalized sample <-1,1>, 0.0 if the data could not be read
- */
-static float get_normalized_sample(const void *buffer, size_t size,
-    unsigned frame, unsigned channel, const pcm_format_t *f)
-{
-	assert(f);
-	assert(buffer);
-	if (channel >= f->channels)
-		return 0.0f;
-#define GET(type, endian, low, high) \
-do { \
-	const type *src = buffer; \
-	const size_t sample_count = size / sizeof(type); \
-	const size_t sample_pos = frame * f->channels + channel; \
-	if (sample_pos >= sample_count) {\
-		return 0.0f; \
-	} \
-	float sample = from(src[sample_pos], type, endian); \
-	/* This makes it positive */ \
-	sample -= (float)(type)low; \
-	/* This makes it <0,2> */ \
-	sample /= (((float)(type)high - (float)(type)low) / 2.0f); \
-	return sample - 1.0f; \
-} while (0)
-
-	switch (f->sample_format) {
-	case PCM_SAMPLE_UINT8:
-		GET(uint8_t, le, UINT8_MIN, UINT8_MAX);
-	case PCM_SAMPLE_SINT8:
-		GET(int8_t, le, INT8_MIN, INT8_MAX);
-	case PCM_SAMPLE_UINT16_LE:
-		GET(uint16_t, le, UINT16_MIN, UINT16_MAX);
-	case PCM_SAMPLE_SINT16_LE:
-		GET(int16_t, le, INT16_MIN, INT16_MAX);
-	case PCM_SAMPLE_UINT16_BE:
-		GET(uint16_t, be, UINT16_MIN, UINT16_MAX);
-	case PCM_SAMPLE_SINT16_BE:
-		GET(int16_t, be, INT16_MIN, INT16_MAX);
-	case PCM_SAMPLE_UINT24_32_LE:
-	case PCM_SAMPLE_UINT32_LE:
-		GET(uint32_t, le, UINT32_MIN, UINT32_MAX);
-	case PCM_SAMPLE_SINT24_32_LE:
-	case PCM_SAMPLE_SINT32_LE:
-		GET(int32_t, le, INT32_MIN, INT32_MAX);
-	case PCM_SAMPLE_UINT24_32_BE:
-	case PCM_SAMPLE_UINT32_BE:
-		GET(uint32_t, be, UINT32_MIN, UINT32_MAX);
-	case PCM_SAMPLE_SINT24_32_BE:
-	case PCM_SAMPLE_SINT32_BE:
-		GET(int32_t, le, INT32_MIN, INT32_MAX);
-	case PCM_SAMPLE_UINT24_LE:
-	case PCM_SAMPLE_SINT24_LE:
-	case PCM_SAMPLE_UINT24_BE:
-	case PCM_SAMPLE_SINT24_BE:
-	case PCM_SAMPLE_FLOAT32:
-	default:
-		break;
-	}
-	return 0;
-#undef GET
-}
-/**
- * @}
- */
Index: pace/lib/pcut/NOTE
===================================================================
--- uspace/lib/pcut/NOTE	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,22 +1,0 @@
-Important notes for maintenance of this library
------------------------------------------------
-
-This directory contains PCUT [1], a library for simple unit testing of C
-code.
-
-If you want to update PCUT to the latest revision, run
-
-./update-from-master.sh really-overwrite
-
-and commit the changes.
-
-Please, never update sources here without updating them in upstream too.
-Especially, do not try to fix PCUT formatting and special pragmas to fit
-with the rest of HelenOS.  They are there for a reason ;-). And it makes
-reviewing the changes after updates really painful.
-
-If you do not have write access to upstream, please, open a pull-request
-or an issue on GitHub [2].
-
-[1] https://github.com/vhotspur/pcut/wiki
-[2] https://github.com/vhotspur/pcut/issues
Index: pace/lib/pcut/doc/doxygroups.h
===================================================================
--- uspace/lib/pcut/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-/** @addtogroup libpcut libpcut
- * @ingroup libs
- */
-
-/**    @addtogroup asserts asserts
- *     @ingroup libpcut
- */
-
-/**    @addtogroup tests tests
- *     @ingroup libpcut
- */
Index: pace/lib/pcut/helenos.mak
===================================================================
--- uspace/lib/pcut/helenos.mak	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2013 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-SOURCES = \
-	src/os/helenos.c \
-	src/assert.c \
-	src/helper.c \
-	src/list.c \
-	src/main.c \
-	src/print.c \
-	src/report/report.c \
-	src/report/tap.c \
-	src/report/xml.c \
-	src/run.c
-
-EXTRA_CFLAGS = -D__helenos__ -Wno-unknown-pragmas
-
-LIBRARY = libpcut
Index: pace/lib/pcut/helenos.test.mak
===================================================================
--- uspace/lib/pcut/helenos.test.mak	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-# Re-generate with CMake
-
-# abort
-$(PCUT_TEST_PREFIX)abort$(PCUT_TEST_SUFFIX): tests/abort.o
-
-# asserts
-$(PCUT_TEST_PREFIX)asserts$(PCUT_TEST_SUFFIX): tests/asserts.o
-
-# beforeafter
-$(PCUT_TEST_PREFIX)beforeafter$(PCUT_TEST_SUFFIX): tests/beforeafter.o
-
-# errno
-$(PCUT_TEST_PREFIX)errno$(PCUT_TEST_SUFFIX): tests/errno.o
-
-# inithook
-$(PCUT_TEST_PREFIX)inithook$(PCUT_TEST_SUFFIX): tests/inithook.o
-
-# manytests
-$(PCUT_TEST_PREFIX)manytests$(PCUT_TEST_SUFFIX): tests/manytests.o
-
-# multisuite
-$(PCUT_TEST_PREFIX)multisuite$(PCUT_TEST_SUFFIX): tests/suite_all.o tests/suite1.o tests/suite2.o tests/tested.o
-
-# preinithook
-$(PCUT_TEST_PREFIX)preinithook$(PCUT_TEST_SUFFIX): tests/inithook.o
-
-# printing
-$(PCUT_TEST_PREFIX)printing$(PCUT_TEST_SUFFIX): tests/printing.o
-
-# simple
-$(PCUT_TEST_PREFIX)simple$(PCUT_TEST_SUFFIX): tests/simple.o tests/tested.o
-
-# skip
-$(PCUT_TEST_PREFIX)skip$(PCUT_TEST_SUFFIX): tests/skip.o
-
-# suites
-$(PCUT_TEST_PREFIX)suites$(PCUT_TEST_SUFFIX): tests/suites.o tests/tested.o
-
-# teardownaborts
-$(PCUT_TEST_PREFIX)teardownaborts$(PCUT_TEST_SUFFIX): tests/teardownaborts.o
-
-# teardown
-$(PCUT_TEST_PREFIX)teardown$(PCUT_TEST_SUFFIX): tests/teardown.o tests/tested.o
-
-# testlist
-$(PCUT_TEST_PREFIX)testlist$(PCUT_TEST_SUFFIX): tests/testlist.o
-
-# timeout
-$(PCUT_TEST_PREFIX)timeout$(PCUT_TEST_SUFFIX): tests/timeout.o
-
-# xmlreport
-$(PCUT_TEST_PREFIX)xmlreport$(PCUT_TEST_SUFFIX): tests/xmlreport.o tests/tested.o
-
Index: pace/lib/pcut/include/pcut/asserts.h
===================================================================
--- uspace/lib/pcut/include/pcut/asserts.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Predefined asserts.
- *
- * @defgroup asserts Asserts
- * Predefined asserts you can use with PCUT.
- * @{
- */
-#ifndef PCUT_ASSERTS_H_GUARD
-#define PCUT_ASSERTS_H_GUARD
-
-#include <errno.h>
-
-/** @def PCUT_CURRENT_FILENAME
- * Overwrite contents of __FILE__ when printing assertion errors.
- */
-#ifndef PCUT_CURRENT_FILENAME
-#define PCUT_CURRENT_FILENAME __FILE__
-#endif
-
-/** @cond devel */
-
-/** Raise assertion error.
- *
- * This function immediately terminates current test and executes a tear-down
- * (if registered).
- *
- * @param filename File where the assertion occurred.
- * @param line Line where the assertion occurred.
- * @param fmt Printf-like format string.
- * @param ... Extra arguments.
- */
-void pcut_failed_assertion_fmt(const char *filename, int line, const char *fmt, ...);
-
-/** OS-agnostic string comparison.
- *
- * @param a First string to compare.
- * @param b Second string to compare.
- * @return Whether the strings are equal.
- */
-int pcut_str_equals(const char *a, const char *b);
-
-/** OS-agnostic conversion from error code to error description.
- *
- * This function ensures that the description stored in @p buffer is
- * always a nul-terminated string.
- *
- * @param error Error code.
- * @param buffer Where to store the error description.
- * @param size Size of the buffer.
- */
-void pcut_str_error(int error, char *buffer, int size);
-
-/** Raise assertion error (internal version).
- *
- * We expect to be always called from PCUT_ASSERTION_FAILED() where
- * the last argument is empty string to conform to strict ISO C99
- * ("ISO C99 requires rest arguments to be used").
- *
- * @param fmt Printf-like format string.
- * @param ... Extra arguments.
- */
-#define PCUT_ASSERTION_FAILED_INTERNAL(fmt, ...) \
-	pcut_failed_assertion_fmt(PCUT_CURRENT_FILENAME, __LINE__, fmt, __VA_ARGS__)
-
-
-/** @endcond */
-
-/** Raise assertion error.
- *
- * This macro adds current file and line and triggers immediate test
- * abort (tear-down function of the test suite is run when available).
- *
- * @param ... Printf-like arguments.
- */
-#define PCUT_ASSERTION_FAILED(...) \
-	PCUT_ASSERTION_FAILED_INTERNAL(__VA_ARGS__, "")
-
-
-/** Generic assertion for a boolean expression.
- *
- * @param actual Actually obtained (computed) value we wish to test to true.
- */
-#define PCUT_ASSERT_TRUE(actual) \
-	do { \
-		if (!(actual)) { \
-			PCUT_ASSERTION_FAILED("Expected true but got <%s>", \
-				#actual); \
-		} \
-	} while (0)
-
-/** Generic assertion for a boolean expression.
- *
- * @param actual Actually obtained (computed) value we wish to test to false.
- */
-#define PCUT_ASSERT_FALSE(actual) \
-	do { \
-		if ((actual)) { \
-			PCUT_ASSERTION_FAILED("Expected false but got <%s>", \
-				#actual); \
-		} \
-	} while (0)
-
-
-/** Generic assertion for types where == is defined.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_EQUALS(expected, actual) \
-	do {\
-		if (!((expected) == (actual))) { \
-			PCUT_ASSERTION_FAILED("Expected <"#expected "> but got <" #actual ">"); \
-		} \
-	} while (0)
-
-/** Asserts that given pointer is NULL.
- *
- * @param pointer The pointer to be tested.
- */
-#define PCUT_ASSERT_NULL(pointer) \
-	do { \
-		const void *pcut_ptr_eval = (pointer); \
-		if (pcut_ptr_eval != (NULL)) { \
-			PCUT_ASSERTION_FAILED("Expected <" #pointer "> to be NULL, " \
-				"instead it points to %p", pcut_ptr_eval); \
-		} \
-	} while (0)
-
-/** Asserts that given pointer is not NULL.
- *
- * Use this function when directly quoting the original pointer variable
- * does not provide sufficient information.
- *
- * @param pointer The pointer to be tested.
- * @param pointer_name Name of the pointer.
- */
-#define PCUT_ASSERT_NOT_NULL_WITH_NAME(pointer, pointer_name) \
-	do { \
-		const void *pcut_ptr_eval = (pointer); \
-		if (pcut_ptr_eval == (NULL)) { \
-			PCUT_ASSERTION_FAILED("Pointer <" pointer_name "> ought not to be NULL"); \
-		} \
-	} while (0)
-
-/** Asserts that given pointer is not NULL.
- *
- * @param pointer The pointer to be tested.
- */
-#define PCUT_ASSERT_NOT_NULL(pointer) \
-	PCUT_ASSERT_NOT_NULL_WITH_NAME(pointer, #pointer)
-
-
-/** Assertion for checking that two integers are equal.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_INT_EQUALS(expected, actual) \
-	do {\
-		long long pcut_expected_eval = (expected); \
-		long long pcut_actual_eval = (actual); \
-		if (pcut_expected_eval != pcut_actual_eval) { \
-			PCUT_ASSERTION_FAILED("Expected <%lld> but got <%lld> (%s != %s)", \
-				pcut_expected_eval, pcut_actual_eval, \
-				#expected, #actual); \
-		} \
-	} while (0)
-
-/** Assertion for checking that two integers are equal.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_UINT_EQUALS(expected, actual) \
-	do {\
-		unsigned long long pcut_expected_eval = (expected); \
-		unsigned long long pcut_actual_eval = (actual); \
-		if (pcut_expected_eval != pcut_actual_eval) { \
-			PCUT_ASSERTION_FAILED("Expected <%llu> but got <%llu> (%s != %s)", \
-				pcut_expected_eval, pcut_actual_eval, \
-				#expected, #actual); \
-		} \
-	} while (0)
-
-/** Assertion for checking that two pointers are equal.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_PTR_EQUALS(expected, actual) \
-	do {\
-		const void *pcut_expected_eval = (expected); \
-		const void *pcut_actual_eval = (actual); \
-		if (pcut_expected_eval != pcut_actual_eval) { \
-			PCUT_ASSERTION_FAILED("Expected '" #actual "' = '" #expected "' = <%p> but got '" #actual "' = <%p>", \
-				pcut_expected_eval, pcut_actual_eval); \
-		} \
-	} while (0)
-
-/** Assertion for checking that two doubles are close enough.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- * @param epsilon How much the actual value can differ from the expected one.
- */
-#define PCUT_ASSERT_DOUBLE_EQUALS(expected, actual, epsilon) \
-	do {\
-		double pcut_expected_eval = (expected); \
-		double pcut_actual_eval = (actual); \
-		double pcut_epsilon_eval = (epsilon); \
-		double pcut_double_diff = pcut_expected_eval - pcut_actual_eval; \
-		if ((pcut_double_diff < -pcut_epsilon_eval) | (pcut_double_diff > pcut_epsilon_eval)) { \
-			PCUT_ASSERTION_FAILED("Expected <%lf+-%lf> but got <%lf> (%s != %s)", \
-				pcut_expected_eval, pcut_epsilon_eval, pcut_actual_eval, \
-				#expected, #actual); \
-		} \
-	} while (0)
-
-/** Assertion for checking that two strings (`const char *`) are equal.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_STR_EQUALS(expected, actual) \
-	do {\
-		const char *pcut_expected_eval = (expected); \
-		const char *pcut_actual_eval = (actual); \
-		PCUT_ASSERT_NOT_NULL_WITH_NAME(pcut_expected_eval, #expected); \
-		PCUT_ASSERT_NOT_NULL_WITH_NAME(pcut_actual_eval, #actual); \
-		if (!pcut_str_equals(pcut_expected_eval, pcut_actual_eval)) { \
-			PCUT_ASSERTION_FAILED("Expected <%s> but got <%s> (%s != %s)", \
-				pcut_expected_eval, pcut_actual_eval, \
-				#expected, #actual); \
-		} \
-	} while (0)
-
-
-/** Assertion for checking that two strings (`const char *`) are equal or both NULL.
- *
- * @param expected Expected (correct) value.
- * @param actual Actually obtained (computed) value we wish to test.
- */
-#define PCUT_ASSERT_STR_EQUALS_OR_NULL(expected, actual) \
-	do {\
-		const char *pcut_expected_eval = (expected); \
-		const char *pcut_actual_eval = (actual); \
-		int pcut_both_null = (pcut_expected_eval == NULL) && (pcut_actual_eval == NULL); \
-		int pcut_some_null = (pcut_expected_eval == NULL) || (pcut_actual_eval == NULL); \
-		if (!pcut_both_null && (pcut_some_null || !pcut_str_equals(pcut_expected_eval, pcut_actual_eval))) { \
-			PCUT_ASSERTION_FAILED("Expected <%s> but got <%s> (%s != %s)", \
-				pcut_expected_eval == NULL ? "NULL" : pcut_expected_eval, \
-				pcut_actual_eval == NULL ? "NULL" : pcut_actual_eval, \
-				#expected, #actual); \
-		} \
-	} while (0)
-
-
-/** Assertion for checking errno-style variables for errors.
- *
- * Use this function when directly quoting the original error code does
- * not provide sufficient information.
- *
- * @param expected_value Expected errno error code.
- * @param expected_quoted Expected error code as a string.
- * @param actual_value Actual value of the error code.
- */
-#define PCUT_ASSERT_ERRNO_VAL_WITH_NAME(expected_value, expected_quoted, actual_value) \
-	do {\
-		int pcut_expected_eval = (expected_value); \
-		int pcut_actual_eval = (actual_value); \
-		if (pcut_expected_eval != pcut_actual_eval) { \
-			char pcut_expected_description[100]; \
-			char pcut_actual_description[100]; \
-			pcut_str_error(pcut_expected_eval, pcut_expected_description, 100); \
-			pcut_str_error(pcut_actual_eval, pcut_actual_description, 100); \
-			PCUT_ASSERTION_FAILED("Expected error %d (%s, %s) but got error %d (%s)", \
-				pcut_expected_eval, expected_quoted, \
-				pcut_expected_description, \
-				pcut_actual_eval, pcut_actual_description); \
-		} \
-	} while (0)
-
-/** Assertion for checking errno-style variables for errors.
- *
- * @param expected Expected errno error code.
- * @param actual Actual value of the error code.
- */
-#define PCUT_ASSERT_ERRNO_VAL(expected, actual) \
-	PCUT_ASSERT_ERRNO_VAL_WITH_NAME(expected, #expected, actual)
-
-/** Assertion for checking errno variable for errors.
- *
- * @param expected Expected errno error code.
- */
-#define PCUT_ASSERT_ERRNO(expected) \
-	PCUT_ASSERT_ERRNO_VAL_WITH_NAME(expected, #expected, (errno))
-
-/**
- * @}
- */
-
-#endif
Index: pace/lib/pcut/include/pcut/datadef.h
===================================================================
--- uspace/lib/pcut/include/pcut/datadef.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Data types internally used by PCUT.
- */
-#ifndef PCUT_DATADEF_H_GUARD
-#define PCUT_DATADEF_H_GUARD
-
-#include <pcut/prevs.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-/** @cond devel */
-
-#if defined(__GNUC__) || defined(__clang__)
-#define PCUT_CC_UNUSED_VARIABLE(name, initializer) \
-	name __attribute__((unused)) = initializer
-#else
-#define PCUT_CC_UNUSED_VARIABLE(name, initializer) \
-	name = initializer
-#endif
-
-
-enum {
-	PCUT_KIND_SKIP,
-	PCUT_KIND_NESTED,
-	PCUT_KIND_SETUP,
-	PCUT_KIND_TEARDOWN,
-	PCUT_KIND_TESTSUITE,
-	PCUT_KIND_TEST
-};
-
-enum {
-	PCUT_EXTRA_TIMEOUT,
-	PCUT_EXTRA_SKIP,
-	PCUT_EXTRA_LAST
-};
-
-enum {
-	PCUT_MAIN_EXTRA_PREINIT_HOOK,
-	PCUT_MAIN_EXTRA_INIT_HOOK,
-	PCUT_MAIN_EXTRA_REPORT_XML,
-	PCUT_MAIN_EXTRA_LAST
-};
-
-/** Generic wrapper for test cases, test suites etc. */
-typedef struct pcut_item pcut_item_t;
-
-/** Extra information about a test. */
-typedef struct pcut_extra pcut_extra_t;
-
-/** Extra information for the main() function. */
-typedef struct pcut_main_extra pcut_main_extra_t;
-
-/** Test method type. */
-typedef void (*pcut_test_func_t)(void);
-
-/** Set-up or tear-down method type. */
-typedef void (*pcut_setup_func_t)(void);
-
-/** @copydoc pcut_extra_t */
-struct pcut_extra {
-	/** Discriminator for the union.
-	 *
-	 * Use PCUT_EXTRA_* to determine which field of the union is used.
-	 */
-	int type;
-	/** Test-specific time-out in seconds. */
-	int timeout;
-};
-
-/** @copydoc pcut_main_extra_t */
-struct pcut_main_extra {
-	/** Discriminator for the union.
-	 *
-	 * Use PCUT_MAIN_EXTRA_* to determine which field of the union is used.
-	 */
-	int type;
-	/** Callback once PCUT initializes itself. */
-	void (*init_hook)(void);
-	/** Callback even before command-line arguments are processed. */
-	void (*preinit_hook)(int *, char ***);
-};
-
-/** @copydoc pcut_item_t */
-struct pcut_item {
-	/** Link to previous item. */
-	pcut_item_t *previous;
-	/** Link to next item. */
-	pcut_item_t *next;
-
-	/** Unique id of this item. */
-	int id;
-
-	/** Discriminator for this item. */
-	int kind;
-
-	/** Name of this item. */
-	const char *name;
-
-	/** Test-case function. */
-	pcut_test_func_t test_func;
-
-	/** Set-up function of a suite. */
-	pcut_setup_func_t setup_func;
-	/** Tear-down function of a suite. */
-	pcut_setup_func_t teardown_func;
-
-	/** Extra attributes. */
-	pcut_extra_t *extras;
-
-	/** Extra attributes for main() function. */
-	pcut_main_extra_t *main_extras;
-
-	/** Nested lists. */
-	pcut_item_t *nested;
-};
-
-/** @endcond */
-
-#endif
Index: pace/lib/pcut/include/pcut/helper.h
===================================================================
--- uspace/lib/pcut/include/pcut/helper.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Helper macros.
- */
-#ifndef PCUT_HELPER_H_GUARD
-#define PCUT_HELPER_H_GUARD
-
-/** @cond devel */
-
-/** Join the two arguments on preprocessor level (inner call). */
-#define PCUT_JOIN_IMPL(a, b) a##b
-
-/** Join the two arguments on preprocessor level. */
-#define PCUT_JOIN(a, b) PCUT_JOIN_IMPL(a, b)
-
-/** Quote the parameter (inner call). */
-#define PCUT_QUOTE_IMPL(x) #x
-
-/** Quote the parameter. */
-#define PCUT_QUOTE(x) PCUT_QUOTE_IMPL(x)
-
-/** Get first argument from macro var-args. */
-#define PCUT_VARG_GET_FIRST(x, ...) x
-
-/** Get all but first arguments from macro var-args. */
-#define PCUT_VARG_SKIP_FIRST(x, ...) __VA_ARGS__
-
-#endif
Index: pace/lib/pcut/include/pcut/pcut.h
===================================================================
--- uspace/lib/pcut/include/pcut/pcut.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2012-2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * PCUT: Plain-C unit-testing mini-framework.
- */
-#ifndef PCUT_PCUT_H_GUARD
-#define PCUT_PCUT_H_GUARD
-
-#include <pcut/asserts.h>
-#include <pcut/tests.h>
-
-
-/** PCUT outcome: test passed. */
-#define PCUT_OUTCOME_PASS 0
-
-/** PCUT outcome: test failed. */
-#define PCUT_OUTCOME_FAIL 1
-
-/** PCUT outcome: test failed unexpectedly. */
-#define PCUT_OUTCOME_INTERNAL_ERROR 2
-
-/** PCUT outcome: invalid invocation of the final program. */
-#define PCUT_OUTCOME_BAD_INVOCATION 3
-
-
-#endif
Index: pace/lib/pcut/include/pcut/prevs.h
===================================================================
--- uspace/lib/pcut/include/pcut/prevs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,346 +1,0 @@
-/*
- * Copyright (c) 2012-2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * Counter macros internally used by PCUT.
- */
-
-#ifndef PCUT_PREVS_H_GUARD
-#define PCUT_PREVS_H_GUARD
-
-#ifndef PCUT_DOXYGEN_IS_RUNNING
-/** @cond devel */
-
-#define PCUT_PREV_1 0
-#define PCUT_PREV_2 1
-#define PCUT_PREV_3 2
-#define PCUT_PREV_4 3
-#define PCUT_PREV_5 4
-#define PCUT_PREV_6 5
-#define PCUT_PREV_7 6
-#define PCUT_PREV_8 7
-#define PCUT_PREV_9 8
-#define PCUT_PREV_10 9
-#define PCUT_PREV_11 10
-#define PCUT_PREV_12 11
-#define PCUT_PREV_13 12
-#define PCUT_PREV_14 13
-#define PCUT_PREV_15 14
-#define PCUT_PREV_16 15
-#define PCUT_PREV_17 16
-#define PCUT_PREV_18 17
-#define PCUT_PREV_19 18
-#define PCUT_PREV_20 19
-#define PCUT_PREV_21 20
-#define PCUT_PREV_22 21
-#define PCUT_PREV_23 22
-#define PCUT_PREV_24 23
-#define PCUT_PREV_25 24
-#define PCUT_PREV_26 25
-#define PCUT_PREV_27 26
-#define PCUT_PREV_28 27
-#define PCUT_PREV_29 28
-#define PCUT_PREV_30 29
-#define PCUT_PREV_31 30
-#define PCUT_PREV_32 31
-#define PCUT_PREV_33 32
-#define PCUT_PREV_34 33
-#define PCUT_PREV_35 34
-#define PCUT_PREV_36 35
-#define PCUT_PREV_37 36
-#define PCUT_PREV_38 37
-#define PCUT_PREV_39 38
-#define PCUT_PREV_40 39
-#define PCUT_PREV_41 40
-#define PCUT_PREV_42 41
-#define PCUT_PREV_43 42
-#define PCUT_PREV_44 43
-#define PCUT_PREV_45 44
-#define PCUT_PREV_46 45
-#define PCUT_PREV_47 46
-#define PCUT_PREV_48 47
-#define PCUT_PREV_49 48
-#define PCUT_PREV_50 49
-#define PCUT_PREV_51 50
-#define PCUT_PREV_52 51
-#define PCUT_PREV_53 52
-#define PCUT_PREV_54 53
-#define PCUT_PREV_55 54
-#define PCUT_PREV_56 55
-#define PCUT_PREV_57 56
-#define PCUT_PREV_58 57
-#define PCUT_PREV_59 58
-#define PCUT_PREV_60 59
-#define PCUT_PREV_61 60
-#define PCUT_PREV_62 61
-#define PCUT_PREV_63 62
-#define PCUT_PREV_64 63
-#define PCUT_PREV_65 64
-#define PCUT_PREV_66 65
-#define PCUT_PREV_67 66
-#define PCUT_PREV_68 67
-#define PCUT_PREV_69 68
-#define PCUT_PREV_70 69
-#define PCUT_PREV_71 70
-#define PCUT_PREV_72 71
-#define PCUT_PREV_73 72
-#define PCUT_PREV_74 73
-#define PCUT_PREV_75 74
-#define PCUT_PREV_76 75
-#define PCUT_PREV_77 76
-#define PCUT_PREV_78 77
-#define PCUT_PREV_79 78
-#define PCUT_PREV_80 79
-#define PCUT_PREV_81 80
-#define PCUT_PREV_82 81
-#define PCUT_PREV_83 82
-#define PCUT_PREV_84 83
-#define PCUT_PREV_85 84
-#define PCUT_PREV_86 85
-#define PCUT_PREV_87 86
-#define PCUT_PREV_88 87
-#define PCUT_PREV_89 88
-#define PCUT_PREV_90 89
-#define PCUT_PREV_91 90
-#define PCUT_PREV_92 91
-#define PCUT_PREV_93 92
-#define PCUT_PREV_94 93
-#define PCUT_PREV_95 94
-#define PCUT_PREV_96 95
-#define PCUT_PREV_97 96
-#define PCUT_PREV_98 97
-#define PCUT_PREV_99 98
-#define PCUT_PREV_100 99
-#define PCUT_PREV_101 100
-#define PCUT_PREV_102 101
-#define PCUT_PREV_103 102
-#define PCUT_PREV_104 103
-#define PCUT_PREV_105 104
-#define PCUT_PREV_106 105
-#define PCUT_PREV_107 106
-#define PCUT_PREV_108 107
-#define PCUT_PREV_109 108
-#define PCUT_PREV_110 109
-#define PCUT_PREV_111 110
-#define PCUT_PREV_112 111
-#define PCUT_PREV_113 112
-#define PCUT_PREV_114 113
-#define PCUT_PREV_115 114
-#define PCUT_PREV_116 115
-#define PCUT_PREV_117 116
-#define PCUT_PREV_118 117
-#define PCUT_PREV_119 118
-#define PCUT_PREV_120 119
-#define PCUT_PREV_121 120
-#define PCUT_PREV_122 121
-#define PCUT_PREV_123 122
-#define PCUT_PREV_124 123
-#define PCUT_PREV_125 124
-#define PCUT_PREV_126 125
-#define PCUT_PREV_127 126
-#define PCUT_PREV_128 127
-#define PCUT_PREV_129 128
-#define PCUT_PREV_130 129
-#define PCUT_PREV_131 130
-#define PCUT_PREV_132 131
-#define PCUT_PREV_133 132
-#define PCUT_PREV_134 133
-#define PCUT_PREV_135 134
-#define PCUT_PREV_136 135
-#define PCUT_PREV_137 136
-#define PCUT_PREV_138 137
-#define PCUT_PREV_139 138
-#define PCUT_PREV_140 139
-#define PCUT_PREV_141 140
-#define PCUT_PREV_142 141
-#define PCUT_PREV_143 142
-#define PCUT_PREV_144 143
-#define PCUT_PREV_145 144
-#define PCUT_PREV_146 145
-#define PCUT_PREV_147 146
-#define PCUT_PREV_148 147
-#define PCUT_PREV_149 148
-#define PCUT_PREV_150 149
-#define PCUT_PREV_151 150
-#define PCUT_PREV_152 151
-#define PCUT_PREV_153 152
-#define PCUT_PREV_154 153
-#define PCUT_PREV_155 154
-#define PCUT_PREV_156 155
-#define PCUT_PREV_157 156
-#define PCUT_PREV_158 157
-#define PCUT_PREV_159 158
-#define PCUT_PREV_160 159
-#define PCUT_PREV_161 160
-#define PCUT_PREV_162 161
-#define PCUT_PREV_163 162
-#define PCUT_PREV_164 163
-#define PCUT_PREV_165 164
-#define PCUT_PREV_166 165
-#define PCUT_PREV_167 166
-#define PCUT_PREV_168 167
-#define PCUT_PREV_169 168
-#define PCUT_PREV_170 169
-#define PCUT_PREV_171 170
-#define PCUT_PREV_172 171
-#define PCUT_PREV_173 172
-#define PCUT_PREV_174 173
-#define PCUT_PREV_175 174
-#define PCUT_PREV_176 175
-#define PCUT_PREV_177 176
-#define PCUT_PREV_178 177
-#define PCUT_PREV_179 178
-#define PCUT_PREV_180 179
-#define PCUT_PREV_181 180
-#define PCUT_PREV_182 181
-#define PCUT_PREV_183 182
-#define PCUT_PREV_184 183
-#define PCUT_PREV_185 184
-#define PCUT_PREV_186 185
-#define PCUT_PREV_187 186
-#define PCUT_PREV_188 187
-#define PCUT_PREV_189 188
-#define PCUT_PREV_190 189
-#define PCUT_PREV_191 190
-#define PCUT_PREV_192 191
-#define PCUT_PREV_193 192
-#define PCUT_PREV_194 193
-#define PCUT_PREV_195 194
-#define PCUT_PREV_196 195
-#define PCUT_PREV_197 196
-#define PCUT_PREV_198 197
-#define PCUT_PREV_199 198
-#define PCUT_PREV_200 199
-#define PCUT_PREV_201 200
-#define PCUT_PREV_202 201
-#define PCUT_PREV_203 202
-#define PCUT_PREV_204 203
-#define PCUT_PREV_205 204
-#define PCUT_PREV_206 205
-#define PCUT_PREV_207 206
-#define PCUT_PREV_208 207
-#define PCUT_PREV_209 208
-#define PCUT_PREV_210 209
-#define PCUT_PREV_211 210
-#define PCUT_PREV_212 211
-#define PCUT_PREV_213 212
-#define PCUT_PREV_214 213
-#define PCUT_PREV_215 214
-#define PCUT_PREV_216 215
-#define PCUT_PREV_217 216
-#define PCUT_PREV_218 217
-#define PCUT_PREV_219 218
-#define PCUT_PREV_220 219
-#define PCUT_PREV_221 220
-#define PCUT_PREV_222 221
-#define PCUT_PREV_223 222
-#define PCUT_PREV_224 223
-#define PCUT_PREV_225 224
-#define PCUT_PREV_226 225
-#define PCUT_PREV_227 226
-#define PCUT_PREV_228 227
-#define PCUT_PREV_229 228
-#define PCUT_PREV_230 229
-#define PCUT_PREV_231 230
-#define PCUT_PREV_232 231
-#define PCUT_PREV_233 232
-#define PCUT_PREV_234 233
-#define PCUT_PREV_235 234
-#define PCUT_PREV_236 235
-#define PCUT_PREV_237 236
-#define PCUT_PREV_238 237
-#define PCUT_PREV_239 238
-#define PCUT_PREV_240 239
-#define PCUT_PREV_241 240
-#define PCUT_PREV_242 241
-#define PCUT_PREV_243 242
-#define PCUT_PREV_244 243
-#define PCUT_PREV_245 244
-#define PCUT_PREV_246 245
-#define PCUT_PREV_247 246
-#define PCUT_PREV_248 247
-#define PCUT_PREV_249 248
-#define PCUT_PREV_250 249
-#define PCUT_PREV_251 250
-#define PCUT_PREV_252 251
-#define PCUT_PREV_253 252
-#define PCUT_PREV_254 253
-#define PCUT_PREV_255 254
-#define PCUT_PREV_256 255
-#define PCUT_PREV_257 256
-#define PCUT_PREV_258 257
-#define PCUT_PREV_259 258
-#define PCUT_PREV_260 259
-#define PCUT_PREV_261 260
-#define PCUT_PREV_262 261
-#define PCUT_PREV_263 262
-#define PCUT_PREV_264 263
-#define PCUT_PREV_265 264
-#define PCUT_PREV_266 265
-#define PCUT_PREV_267 266
-#define PCUT_PREV_268 267
-#define PCUT_PREV_269 268
-#define PCUT_PREV_270 269
-#define PCUT_PREV_271 270
-#define PCUT_PREV_272 271
-#define PCUT_PREV_273 272
-#define PCUT_PREV_274 273
-#define PCUT_PREV_275 274
-#define PCUT_PREV_276 275
-#define PCUT_PREV_277 276
-#define PCUT_PREV_278 277
-#define PCUT_PREV_279 278
-#define PCUT_PREV_280 279
-#define PCUT_PREV_281 280
-#define PCUT_PREV_282 281
-#define PCUT_PREV_283 282
-#define PCUT_PREV_284 283
-#define PCUT_PREV_285 284
-#define PCUT_PREV_286 285
-#define PCUT_PREV_287 286
-#define PCUT_PREV_288 287
-#define PCUT_PREV_289 288
-#define PCUT_PREV_290 289
-#define PCUT_PREV_291 290
-#define PCUT_PREV_292 291
-#define PCUT_PREV_293 292
-#define PCUT_PREV_294 293
-#define PCUT_PREV_295 294
-#define PCUT_PREV_296 295
-#define PCUT_PREV_297 296
-#define PCUT_PREV_298 297
-#define PCUT_PREV_299 298
-#define PCUT_PREV_300 299
-
-/** @endcond */
-
-#endif
-
-#endif
-
Index: pace/lib/pcut/include/pcut/tests.h
===================================================================
--- uspace/lib/pcut/include/pcut/tests.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,481 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Tests and test suites.
- *
- * @defgroup tests Tests
- * Create test suites and test cases.
- * @{
- */
-#ifndef PCUT_TESTS_H_GUARD
-#define PCUT_TESTS_H_GUARD
-
-#include <pcut/helper.h>
-#include <pcut/datadef.h>
-
-/*
- * Trick with [] and & copied from
- * http://bytes.com/topic/c/answers/553555-initializer-element-not-constant#post2159846
- * because following does not work:
- * extern int *a;
- * int *b = a;
- */
-
-
-#ifndef __COUNTER__
-#define PCUT_WITHOUT_COUNTER
-#endif
-
-#ifndef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_COUNTER_INCREMENT
-#endif
-
-
-/** Default timeout for a single test (in seconds).
- * @showinitializer
- */
-#define PCUT_DEFAULT_TEST_TIMEOUT 3
-
-/** Item counter that is expected to be incremented by preprocessor.
- *
- * Used compiler must support __COUNTER__ for this to work without any
- * extra preprocessing.
- */
-#ifdef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_COUNTER PCUT_you_need_to_run_pcut_preprocessor
-#else
-#define PCUT_ITEM_COUNTER __COUNTER__
-#endif
-
-
-/*
- * Helper macros
- * -------------
- */
-
-/** @cond devel */
-
-/** Produce identifier name for an item with given number.
- *
- * @param number Item number.
- */
-#ifndef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_NAME(number) \
-	PCUT_JOIN(pcut_item_, number)
-#else
-#define PCUT_ITEM_NAME(number) PCUT_ITEM_NAME
-#endif
-
-/** Produce identifier name for a preceding item.
- *
- * @param number Number of the current item.
- */
-#ifndef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_NAME_PREV(number) \
-	PCUT_JOIN(pcut_item_, PCUT_JOIN(PCUT_PREV_, number))
-#else
-#define PCUT_ITEM_NAME_PREV(number) PCUT_ITEM_NAME_PREV
-#endif
-
-#ifndef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_EXTRAS_NAME(number) \
-	PCUT_JOIN(pcut_extras_, number)
-#else
-#define PCUT_ITEM_EXTRAS_NAME(number) PCUT_ITEM2_NAME
-#endif
-
-#ifndef PCUT_WITHOUT_COUNTER
-#define PCUT_ITEM_SETUP_NAME(number) \
-	PCUT_JOIN(pcut_setup_, number)
-#else
-#define PCUT_ITEM_SETUP_NAME(number) PCUT_ITEM3_NAME
-#endif
-
-
-
-/** Create a new item, append it to the list.
- *
- * @param number Number of this item.
- * @param itemkind Kind of this item (PCUT_KIND_*).
- * @param ... Other initializers of the pcut_item_t.
- */
-#define PCUT_ADD_ITEM(number, itemkind, ...) \
-	static pcut_item_t PCUT_ITEM_NAME(number) = { \
-		&PCUT_ITEM_NAME_PREV(number), \
-		NULL, \
-		-1, \
-		itemkind, \
-		__VA_ARGS__ \
-	}
-
-/** @endcond */
-
-
-
-/*
- * Test-case related macros
- * ------------------------
- */
-
-/** Define test time-out.
- *
- * Use as argument to PCUT_TEST().
- *
- * @param time_out Time-out value in seconds.
- */
-#define PCUT_TEST_SET_TIMEOUT(time_out) \
-	{ PCUT_EXTRA_TIMEOUT, (time_out) }
-
-/** Skip current test.
- *
- * Use as argument to PCUT_TEST().
- */
-#define PCUT_TEST_SKIP \
-	{ PCUT_EXTRA_SKIP, 0 }
-
-
-/** @cond devel */
-
-/** Terminate list of extra test options. */
-#define PCUT_TEST_EXTRA_LAST { PCUT_EXTRA_LAST, 0 }
-
-/** Define a new test with given name and given item number.
- *
- * @param testname A valid C identifier name (not quoted).
- * @param number Number of the item describing this test.
- * @param ... Extra test properties.
- */
-#define PCUT_TEST_WITH_NUMBER(number, testname, ...) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	static pcut_extra_t PCUT_ITEM_EXTRAS_NAME(number)[] = { \
-		__VA_ARGS__ \
-	}; \
-	static int PCUT_CC_UNUSED_VARIABLE(PCUT_JOIN(testname, 0_test_name_missing_or_duplicated), 0); \
-	static void PCUT_JOIN(test_, testname)(void); \
-	PCUT_ADD_ITEM(number, PCUT_KIND_TEST, \
-		PCUT_QUOTE(testname), \
-		PCUT_JOIN(test_, testname), \
-		NULL, NULL, \
-		PCUT_ITEM_EXTRAS_NAME(number), \
-		NULL, NULL \
-	); \
-	void PCUT_JOIN(test_, testname)(void)
-
-/** @endcond */
-
-/** Define a new test with given name.
- *
- * @param ... Test name (C identifier) followed by extra test properties.
- */
-#define PCUT_TEST(...) \
-	PCUT_TEST_WITH_NUMBER(PCUT_ITEM_COUNTER, \
-		PCUT_VARG_GET_FIRST(__VA_ARGS__, this_arg_is_ignored), \
-		PCUT_VARG_SKIP_FIRST(__VA_ARGS__, PCUT_TEST_EXTRA_LAST) \
-	)
-
-
-
-
-
-/*
- * Test suite related macros
- * -------------------------
- */
-
-/** @cond devel */
-
-/** Define and start a new test suite.
- *
- * @see PCUT_TEST_SUITE
- *
- * @param suitename Suite name (a valid C identifier).
- * @param number Item number.
- */
-#define PCUT_TEST_SUITE_WITH_NUMBER(suitename, number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	PCUT_ADD_ITEM(number, PCUT_KIND_TESTSUITE, \
-		#suitename, \
-		NULL, \
-		NULL, NULL, \
-		NULL, NULL, \
-		NULL \
-	)
-
-/** Define a set-up function for a test suite.
- *
- * @see PCUT_TEST_BEFORE
- *
- * @param number Item number.
- */
-#define PCUT_TEST_BEFORE_WITH_NUMBER(number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	static void PCUT_ITEM_SETUP_NAME(number)(void); \
-	PCUT_ADD_ITEM(number, PCUT_KIND_SETUP, \
-		"setup", NULL, \
-		PCUT_ITEM_SETUP_NAME(number), \
-		NULL, NULL, NULL, NULL \
-	); \
-	void PCUT_ITEM_SETUP_NAME(number)(void)
-
-/** Define a tear-down function for a test suite.
- *
- * @see PCUT_TEST_AFTER
- *
- * @param number Item number.
- */
-#define PCUT_TEST_AFTER_WITH_NUMBER(number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	static void PCUT_ITEM_SETUP_NAME(number)(void); \
-	PCUT_ADD_ITEM(number, PCUT_KIND_TEARDOWN, \
-		"teardown", NULL, NULL, \
-		PCUT_ITEM_SETUP_NAME(number), \
-		NULL, NULL, NULL \
-	); \
-	void PCUT_ITEM_SETUP_NAME(number)(void)
-
-/** @endcond */
-
-
-/** Define and start a new test suite.
- *
- * All tests following this macro belong to the new suite
- * (up to next occurrence of PCUT_TEST_SUITE).
- *
- * This command shall be used as is without any extra code.
- *
- * @param name Suite name (a valid C identifier).
- */
-#define PCUT_TEST_SUITE(name) \
-	PCUT_TEST_SUITE_WITH_NUMBER(name, PCUT_ITEM_COUNTER)
-
-/** Define a set-up function for a test suite.
- *
- * The code of the function immediately follows this macro.
- *
- * @code
- * PCUT_TEST_SUITE(my_suite);
- *
- * PCUT_TEST_BEFORE {
- *     printf("This is executed before each test in this suite.\n");
- * }
- * @endcode
- *
- * There could be only a single set-up function for each suite.
- */
-#define PCUT_TEST_BEFORE \
-	PCUT_TEST_BEFORE_WITH_NUMBER(PCUT_ITEM_COUNTER)
-
-/** Define a tear-down function for a test suite.
- *
- * The code of the function immediately follows this macro.
- *
- * @code
- * PCUT_TEST_SUITE(my_suite);
- *
- * PCUT_TEST_AFTER {
- *     printf("This is executed after each test in this suite.\n");
- * }
- * @endcode
- *
- * There could be only a single tear-down function for each suite.
- */
-#define PCUT_TEST_AFTER \
-	PCUT_TEST_AFTER_WITH_NUMBER(PCUT_ITEM_COUNTER)
-
-
-
-
-
-/*
- * Import/export related macros
- * ----------------------------
- */
-
-/** @cond devel */
-
-/** Export test cases from current file.
- *
- * @see PCUT_EXPORT
- *
- * @param identifier Identifier of this block of tests.
- * @param number Item number.
- */
-#define PCUT_EXPORT_WITH_NUMBER(identifier, number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	pcut_item_t pcut_exported_##identifier = { \
-		&PCUT_ITEM_NAME_PREV(number), \
-		NULL, \
-		-1, \
-		PCUT_KIND_SKIP, \
-		"exported_" #identifier, NULL, NULL, NULL, NULL, NULL, NULL \
-	}
-
-/** Import test cases from a different file.
- *
- * @see PCUT_EXPORT
- *
- * @param identifier Identifier of the tests to import.
- * @param number Item number.
- */
-#define PCUT_IMPORT_WITH_NUMBER(identifier, number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	extern pcut_item_t pcut_exported_##identifier; \
-	PCUT_ADD_ITEM(number, PCUT_KIND_NESTED, \
-		"import_" #identifier, NULL, NULL, NULL, NULL, NULL, \
-		&pcut_exported_##identifier \
-	)
-
-/** @endcond */
-
-/** Export test cases from current file.
- *
- * @param identifier Identifier of this block of tests.
- */
-#define PCUT_EXPORT(identifier) \
-	PCUT_EXPORT_WITH_NUMBER(identifier, PCUT_ITEM_COUNTER)
-
-/** Import test cases from a different file.
- *
- * @param identifier Identifier of the tests to import.
- * (previously exported with PCUT_EXPORT).
- */
-#define PCUT_IMPORT(identifier) \
-	PCUT_IMPORT_WITH_NUMBER(identifier, PCUT_ITEM_COUNTER)
-
-
-
-
-
-/*
- * PCUT initialization and invocation macros
- * -----------------------------------------
- */
-
-/** @cond devel */
-
-/** Initialize the PCUT testing framework with a first item.
- *
- * @param first_number Number of the first item.
- */
-#define PCUT_INIT_WITH_NUMBER(first_number) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	static pcut_item_t PCUT_ITEM_NAME(first_number) = { \
-		NULL, \
-		NULL, \
-		-1, \
-		PCUT_KIND_SKIP, \
-		"init", NULL, NULL, NULL, NULL, NULL, NULL \
-	}; \
-	PCUT_TEST_SUITE(Default);
-
-int pcut_main(pcut_item_t *last, int argc, char *argv[]);
-
-/** Insert code to run all the tests.
- *
- * @param number Item number.
- */
-#define PCUT_MAIN_WITH_NUMBER(number, ...) \
-	PCUT_ITEM_COUNTER_INCREMENT \
-	static pcut_main_extra_t pcut_main_extras[] = { \
-		__VA_ARGS__ \
-	}; \
-	static pcut_item_t pcut_item_last = { \
-		&PCUT_ITEM_NAME_PREV(number), \
-		NULL, \
-		-1, \
-		PCUT_KIND_SKIP, \
-		"main", NULL, NULL, NULL, \
-		NULL, \
-		pcut_main_extras, \
-		NULL \
-	}; \
-	int main(int argc, char *argv[]) { \
-		return pcut_main(&pcut_item_last, argc, argv); \
-	}
-
-/** Terminate list of extra options for main. */
-#define PCUT_MAIN_EXTRA_SET_LAST \
-	{ PCUT_MAIN_EXTRA_LAST, NULL, NULL }
-
-/** @endcond */
-
-/** Initialize the PCUT testing framework. */
-#define PCUT_INIT \
-	PCUT_INIT_WITH_NUMBER(PCUT_ITEM_COUNTER)
-
-/** Insert code to run all the tests. */
-#define PCUT_MAIN() \
-	PCUT_MAIN_WITH_NUMBER(PCUT_ITEM_COUNTER, PCUT_MAIN_EXTRA_SET_LAST)
-
-
-/** Set callback for PCUT initialization.
- *
- * Use from within PCUT_CUSTOM_MAIN().
- *
- * @warning The callback is called for each test and also for the wrapping
- * invocation.
- */
-#define PCUT_MAIN_SET_INIT_HOOK(callback) \
-	{ PCUT_MAIN_EXTRA_INIT_HOOK, callback, NULL }
-
-/** Set callback for PCUT pre-initialization.
- *
- * Use from within PCUT_CUSTOM_MAIN().
- * This callback is useful only if you want to manipulate command-line
- * arguments.
- * You probably will not need this.
- *
- * @warning The callback is called for each test and also for the wrapping
- * invocation.
- */
-#define PCUT_MAIN_SET_PREINIT_HOOK(callback) \
-	{ PCUT_MAIN_EXTRA_PREINIT_HOOK, NULL, callback }
-
-
-/** Set XML report as default.
- *
- * Use from within PCUT_CUSTOM_MAIN().
- *
- */
-#define PCUT_MAIN_SET_XML_REPORT \
-	{ PCUT_MAIN_EXTRA_REPORT_XML, NULL, NULL }
-
-
-/** Insert code to run all tests. */
-#define PCUT_CUSTOM_MAIN(...) \
-	PCUT_MAIN_WITH_NUMBER(PCUT_ITEM_COUNTER, \
-		PCUT_VARG_GET_FIRST(__VA_ARGS__, PCUT_MAIN_EXTRA_SET_LAST), \
-		PCUT_VARG_SKIP_FIRST(__VA_ARGS__, PCUT_MAIN_EXTRA_SET_LAST) \
- 	)
-
-/**
- * @}
- */
-
-#endif
Index: pace/lib/pcut/meson.build
===================================================================
--- uspace/lib/pcut/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-c_args += [ '-D__helenos__', '-Wno-unknown-pragmas' ]
-
-src = files(
-	'src/os/helenos.c',
-	'src/assert.c',
-	'src/helper.c',
-	'src/list.c',
-	'src/main.c',
-	'src/print.c',
-	'src/report/report.c',
-	'src/report/tap.c',
-	'src/report/xml.c',
-	'src/run.c',
-)
-
-if CONFIG_PCUT_SELF_TESTS
-	subdir('tests')
-endif
Index: pace/lib/pcut/src/assert.c
===================================================================
--- uspace/lib/pcut/src/assert.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * Formatting and processing of failed assertion messages.
- *
- * We are using static buffers to prevent any calls to malloc()/free()
- * by the testing framework.
- */
-
-/*
- * We need _BSD_SOURCE because of vsnprintf() when compiling under C89.
- * In newer versions of features.h, _DEFAULT_SOURCE must be defined as well.
- */
-#define _BSD_SOURCE
-#define _DEFAULT_SOURCE
-
-#include "internal.h"
-
-#pragma warning(push, 0)
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stdio.h>
-#pragma warning(pop)
-
-
-/** Maximum length of failed-assert message. */
-#define MAX_MESSAGE_LENGTH 256
-
-/** How many assertion messages we need to keep in memory at once. */
-#define MESSAGE_BUFFER_COUNT 2
-
-/** Assertion message buffers. */
-static char message_buffer[MESSAGE_BUFFER_COUNT][MAX_MESSAGE_LENGTH + 1];
-
-/** Currently active assertion buffer. */
-static int message_buffer_index = 0;
-
-void pcut_failed_assertion_fmt(const char *filename, int line, const char *fmt, ...) {
-	va_list args;
-	char *current_buffer = message_buffer[message_buffer_index];
-	size_t offset = 0;
-	message_buffer_index = (message_buffer_index + 1) % MESSAGE_BUFFER_COUNT;
-
-	pcut_snprintf(current_buffer, MAX_MESSAGE_LENGTH, "%s:%d: ", filename, line);
-	offset = pcut_str_size(current_buffer);
-
-	if (offset + 1 < MAX_MESSAGE_LENGTH) {
-		va_start(args, fmt);
-		vsnprintf(current_buffer + offset, MAX_MESSAGE_LENGTH - offset, fmt, args);
-		va_end(args);
-	}
-
-	pcut_failed_assertion(current_buffer);
-}
Index: pace/lib/pcut/src/helper.c
===================================================================
--- uspace/lib/pcut/src/helper.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Helper functions.
- */
-
-#include "internal.h"
-
-#pragma warning(push, 0)
-#include <stdarg.h>
-#include <stdio.h>
-#pragma warning(pop)
-
-/*
- * It seems that not all Unixes are the same and snprintf
- * may not be always exported?
- */
-#ifdef __unix
-extern int snprintf(char *, size_t, const char *, ...);
-#endif
-
-
-int pcut_snprintf(char *dest, size_t size, const char *format, ...) {
-	va_list args;
-	int ret;
-
-	va_start(args, format);
-
-	/*
-	 * Use sprintf_s in Windows but only with Microsoft compiler.
-	 * Namely, let MinGW use snprintf.
-	 */
-#if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
-	ret = _vsnprintf_s(dest, size, _TRUNCATE, format, args);
-#else
-	ret = vsnprintf(dest, size, format, args);
-#endif
-
-	va_end(args);
-
-	return ret;
-}
Index: pace/lib/pcut/src/internal.h
===================================================================
--- uspace/lib/pcut/src/internal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- * Common definitions internally used in PCUT.
- */
-
-#ifndef PCUT_INTERNAL_H_GUARD
-#define PCUT_INTERNAL_H_GUARD
-
-#include <pcut/pcut.h>
-
-#pragma warning(push, 0)
-#include <stdlib.h>
-#pragma warning(pop)
-
-
-/** @def PCUT_DEBUG(msg, ...)
- * Debug printing.
- *
- * By default, this macro does nothing. Define PCUT_DEBUG_BUILD to
- * actually print the messages to the console.
- *
- * @param msg Printf-like formatting message.
- * @param ... Extra arguments for printf.
- */
-#ifdef PCUT_DEBUG_BUILD
-#pragma warning(push, 0)
-#include <stdio.h>
-#pragma warning(pop)
-#define PCUT_DEBUG_INTERNAL(msg, ...) \
-	fprintf(stderr, "[PCUT %s:%d]: " msg "%s", __FILE__, __LINE__, __VA_ARGS__)
-#define PCUT_DEBUG(...) \
-	PCUT_DEBUG_INTERNAL( \
-		PCUT_VARG_GET_FIRST(__VA_ARGS__, this_arg_is_ignored), \
-		PCUT_VARG_SKIP_FIRST(__VA_ARGS__, "\n") \
-	)
-#else
-#define PCUT_DEBUG(...) (void)0
-#endif
-
-
-/** Mark a variable as unused. */
-#define PCUT_UNUSED(x) ((void)x)
-
-/** Forking mode for test execution.
- *
- * In this mode, each test is run in a separate process.
- * This ensures that even SIGSEGV does not stop the framework itself.
- */
-#define PCUT_RUN_MODE_FORKING 1
-
-/** Single-process mode for test execution.
- *
- * This mode is used when new process is launched when in forking-mode or
- * this mode can be used if we are sure that no test would fail
- * fatally (that is causing an unexpected program exit).
- */
-#define PCUT_RUN_MODE_SINGLE 2
-
-extern int pcut_run_mode;
-
-
-pcut_item_t *pcut_fix_list_get_real_head(pcut_item_t *last);
-int pcut_count_tests(pcut_item_t *it);
-void pcut_print_items(pcut_item_t *first);
-
-pcut_item_t *pcut_get_real_next(pcut_item_t *item);
-pcut_item_t *pcut_get_real(pcut_item_t *item);
-void pcut_print_tests(pcut_item_t *first);
-int pcut_is_arg_with_number(const char *arg, const char *opt, int *value);
-
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test);
-int pcut_run_test_forked(pcut_item_t *test);
-int pcut_run_test_single(pcut_item_t *test);
-
-int pcut_get_test_timeout(pcut_item_t *test);
-
-void pcut_failed_assertion(const char *message);
-void pcut_print_fail_message(const char *msg);
-
-/** Reporting callbacks structure. */
-typedef struct pcut_report_ops pcut_report_ops_t;
-
-/** @copydoc pcut_report_ops_t */
-struct pcut_report_ops {
-	/** Initialize the reporting, given all tests. */
-	void (*init)(pcut_item_t *);
-	/** Finalize the reporting. */
-	void (*done)(void);
-	/** Test suite just started. */
-	void (*suite_start)(pcut_item_t *);
-	/** Test suite completed. */
-	void (*suite_done)(pcut_item_t *);
-	/** Test is about to start. */
-	void (*test_start)(pcut_item_t *);
-	/** Test completed. */
-	void (*test_done)(pcut_item_t *, int, const char *, const char *,
-		const char *);
-};
-
-void pcut_report_register_handler(pcut_report_ops_t *ops);
-
-void pcut_report_init(pcut_item_t *all_items);
-void pcut_report_suite_start(pcut_item_t *suite);
-void pcut_report_suite_done(pcut_item_t *suite);
-void pcut_report_test_start(pcut_item_t *test);
-void pcut_report_test_done(pcut_item_t *test, int outcome,
-		const char *error_message, const char *teardown_error_message,
-		const char *extra_output);
-void pcut_report_test_done_unparsed(pcut_item_t *test, int outcome,
-		const char *unparsed_output, size_t unparsed_output_size);
-void pcut_report_done(void);
-
-/* OS-dependent functions. */
-
-/** Hook to execute before test starts.
- *
- * Useful for OS-specific preparations prior to launching the actual
- * test code (i. e. sandboxing the process more etc.).
- *
- * This function is not run by the launcher process that only
- * starts other tests in separate processes.
- *
- * @param test The test that is about to be executed.
- */
-void pcut_hook_before_test(pcut_item_t *test);
-
-/** Tell whether two strings start with the same prefix.
- *
- * @param a First string.
- * @param b Second string.
- * @param len Length of common prefix.
- * @return Whether first @p len characters of @p a are the same as in @p b.
- */
-int pcut_str_start_equals(const char *a, const char *b, int len);
-
-/** Get size of string in bytes.
- *
- * @param s String in question.
- * @return Size of @p s in bytes.
- */
-int pcut_str_size(const char *s);
-
-/** Convert string to integer.
- *
- * @param s String with integer.
- * @return Converted integer.
- */
-int pcut_str_to_int(const char *s);
-
-/** Find character in a string.
- *
- * @param haystack Where to look for the @p needle.
- * @param needle Character to find.
- * @return String starting with @p needle.
- * @retval NULL there is no @p needle in @p haystack.
- */
-char *pcut_str_find_char(const char *haystack, const char needle);
-
-/** Format string to a buffer.
- *
- */
-int pcut_snprintf(char *dest, size_t size, const char *format, ...);
-
-#endif
Index: pace/lib/pcut/src/list.c
===================================================================
--- uspace/lib/pcut/src/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,209 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Helper functions for working with list of items.
- */
-
-#pragma warning(push, 0)
-#include <assert.h>
-#include <stdlib.h>
-#pragma warning(pop)
-
-#include "internal.h"
-#include <pcut/pcut.h>
-
-
-/** Find next item with actual content.
- *
- * @param item Head of the list.
- * @return First item with actual content or NULL on end of list.
- */
-pcut_item_t *pcut_get_real_next(pcut_item_t *item) {
-	if (item == NULL) {
-		return NULL;
-	}
-
-	do {
-		item = item->next;
-	} while ((item != NULL) && (item->kind == PCUT_KIND_SKIP));
-
-
-	return item;
-}
-
-/** Retrieve the first item with actual content.
- *
- * Unlike pcut_get_real_next(), where we always advance after the
- * first item, here the @p item itself could be returned.
- *
- * @param item Head of the list.
- * @return First item with actual content or NULL on end of list.
- */
-pcut_item_t *pcut_get_real(pcut_item_t *item) {
-	if (item == NULL) {
-		return NULL;
-	}
-
-	if (item->kind == PCUT_KIND_SKIP) {
-		return pcut_get_real_next(item);
-	} else {
-		return item;
-	}
-}
-
-
-/** In-line nested lists into the parent.
- *
- * @param nested Head of the nested list.
- */
-static void inline_nested_lists(pcut_item_t *nested) {
-	pcut_item_t *first;
-
-	if (nested->kind != PCUT_KIND_NESTED) {
-		return;
-	}
-
-	if (nested->nested == NULL) {
-		nested->kind = PCUT_KIND_SKIP;
-		return;
-	}
-
-	first = pcut_fix_list_get_real_head(nested->nested);
-	nested->nested->next = nested->next;
-	if (nested->next != NULL) {
-		nested->next->previous = nested->nested;
-	}
-	nested->next = first;
-	first->previous = nested;
-
-	nested->kind = PCUT_KIND_SKIP;
-}
-
-/** Assing unique ids to each item in the list.
- *
- * @param first List head.
- */
-static void set_ids(pcut_item_t *first) {
-	int id = 1;
-	pcut_item_t *it;
-
-	assert(first != NULL);
-
-	if (first->kind == PCUT_KIND_SKIP) {
-		first = pcut_get_real_next(first);
-	}
-
-	for (it = first; it != NULL; it = pcut_get_real_next(it)) {
-		it->id = id;
-		id++;
-	}
-}
-
-/** Hide tests that are marked to be skipped.
- *
- * Go through all tests and those that have PCUT_EXTRA_SKIP mark
- * as skipped with PCUT_KIND_SKIP.
- *
- * @param first Head of the list.
- */
-static void detect_skipped_tests(pcut_item_t *first) {
-	pcut_item_t *it;
-
-	assert(first != NULL);
-	if (first->kind == PCUT_KIND_SKIP) {
-		first = pcut_get_real_next(first);
-	}
-
-	for (it = first; it != NULL; it = pcut_get_real_next(it)) {
-		pcut_extra_t *extras;
-
-		if (it->kind != PCUT_KIND_TEST) {
-			continue;
-		}
-
-		extras = it->extras;
-		while (extras->type != PCUT_EXTRA_LAST) {
-			if (extras->type == PCUT_EXTRA_SKIP) {
-				it->kind = PCUT_KIND_SKIP;
-				break;
-			}
-			extras++;
-		}
-	}
-}
-
-/** Convert the static single-linked list into a flat double-linked list.
- *
- * The conversion includes
- * * adding forward links
- * * flattening of any nested lists
- * * assigning of unique ids
- *
- * @param last Tail of the list.
- * @return Head of the fixed list.
- */
-pcut_item_t *pcut_fix_list_get_real_head(pcut_item_t *last) {
-	pcut_item_t *next, *it;
-
-	last->next = NULL;
-
-	inline_nested_lists(last);
-
-	next = last;
-	it = last->previous;
-	while (it != NULL) {
-		it->next = next;
-		inline_nested_lists(it);
-		next = it;
-		it = it->previous;
-	}
-
-	detect_skipped_tests(next);
-
-	set_ids(next);
-
-	return next;
-}
-
-/** Compute the number of all tests in a list.
- *
- * @param it Head of the list.
- * @return Number of tests.
- */
-int pcut_count_tests(pcut_item_t *it) {
-	int count = 0;
-	while (it != NULL) {
-		if (it->kind == PCUT_KIND_TEST) {
-			count++;
-		}
-		it = pcut_get_real_next(it);
-	}
-	return count;
-}
Index: pace/lib/pcut/src/main.c
===================================================================
--- uspace/lib/pcut/src/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,313 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * The main control loop of the whole library.
- */
-
-#include "internal.h"
-#include "report/report.h"
-
-#pragma warning(push, 0)
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#pragma warning(pop)
-
-
-/** Current running mode. */
-int pcut_run_mode = PCUT_RUN_MODE_FORKING;
-
-/** Empty list to bypass special handling for NULL. */
-static pcut_main_extra_t empty_main_extra[] = {
-	PCUT_MAIN_EXTRA_SET_LAST
-};
-
-/** Helper for iteration over main extras. */
-#define FOR_EACH_MAIN_EXTRA(extras, it) \
-	for (it = extras; it->type != PCUT_MAIN_EXTRA_LAST; it++)
-
-/** Checks whether the argument is an option followed by a number.
- *
- * @param arg Argument from the user.
- * @param opt Option, including the leading dashes.
- * @param value Where to store the integer value.
- * @return Whether @p arg is @p opt followed by a number.
- */
-int pcut_is_arg_with_number(const char *arg, const char *opt, int *value) {
-	int opt_len = pcut_str_size(opt);
-	if (! pcut_str_start_equals(arg, opt, opt_len)) {
-		return 0;
-	}
-	*value = pcut_str_to_int(arg + opt_len);
-	return 1;
-}
-
-
-/** Find item by its id.
- *
- * @param first List to search.
- * @param id Id to find.
- * @return The item with given id.
- * @retval NULL No item with such id exists in the list.
- */
-static pcut_item_t *pcut_find_by_id(pcut_item_t *first, int id) {
-	pcut_item_t *it = pcut_get_real(first);
-	while (it != NULL) {
-		if (it->id == id) {
-			return it;
-		}
-		it = pcut_get_real_next(it);
-	}
-	return NULL;
-}
-
-/** Run the whole test suite.
- *
- * @param suite Suite to run.
- * @param last Pointer to first item after this suite is stored here.
- * @param prog_path Path to the current binary (used in forked mode).
- * @return Error code.
- */
-static int run_suite(pcut_item_t *suite, pcut_item_t **last, const char *prog_path) {
-	int is_first_test = 1;
-	int total_count = 0;
-	int ret_code = PCUT_OUTCOME_PASS;
-	int ret_code_tmp;
-
-	pcut_item_t *it = pcut_get_real_next(suite);
-	if ((it == NULL) || (it->kind == PCUT_KIND_TESTSUITE)) {
-		goto leave_no_print;
-	}
-
-	for (; it != NULL; it = pcut_get_real_next(it)) {
-		if (it->kind == PCUT_KIND_TESTSUITE) {
-			goto leave_ok;
-		}
-		if (it->kind != PCUT_KIND_TEST) {
-			continue;
-		}
-
-		if (is_first_test) {
-			pcut_report_suite_start(suite);
-			is_first_test = 0;
-		}
-
-		if (pcut_run_mode == PCUT_RUN_MODE_FORKING) {
-			ret_code_tmp = pcut_run_test_forking(prog_path, it);
-		} else {
-			ret_code_tmp = pcut_run_test_single(it);
-		}
-
-		/*
-		 * Override final return code in case of failure.
-		 *
-		 * In this case we suppress any special error codes as
-		 * to the outside, there was a failure.
-		 */
-		if (ret_code_tmp != PCUT_OUTCOME_PASS) {
-			ret_code = PCUT_OUTCOME_FAIL;
-		}
-
-		total_count++;
-	}
-
-leave_ok:
-	if (total_count > 0) {
-		pcut_report_suite_done(suite);
-	}
-
-leave_no_print:
-	if (last != NULL) {
-		*last = it;
-	}
-
-	return ret_code;
-}
-
-/** Add direct pointers to set-up/tear-down functions to a suites.
- *
- * At start-up, set-up and tear-down functions are scattered in the
- * list as siblings of suites and tests.
- * This puts them into the structure describing the suite itself.
- *
- * @param first First item of the list.
- */
-static void set_setup_teardown_callbacks(pcut_item_t *first) {
-	pcut_item_t *active_suite = NULL;
-	pcut_item_t *it;
-	for (it = first; it != NULL; it = pcut_get_real_next(it)) {
-		if (it->kind == PCUT_KIND_TESTSUITE) {
-			active_suite = it;
-		} else if (it->kind == PCUT_KIND_SETUP) {
-			if (active_suite != NULL) {
-				active_suite->setup_func = it->setup_func;
-			}
-			it->kind = PCUT_KIND_SKIP;
-		} else if (it->kind == PCUT_KIND_TEARDOWN) {
-			if (active_suite != NULL) {
-				active_suite->teardown_func = it->teardown_func;
-			}
-			it->kind = PCUT_KIND_SKIP;
-		} else {
-			/* Not interesting right now. */
-		}
-	}
-}
-
-/** The main function of PCUT.
- *
- * This function is expected to be called as the only function in
- * normal main().
- *
- * @param last Pointer to the last item defined by PCUT_TEST macros.
- * @param argc Original argc of the program.
- * @param argv Original argv of the program.
- * @return Program exit code.
- */
-int pcut_main(pcut_item_t *last, int argc, char *argv[]) {
-	pcut_item_t *items = pcut_fix_list_get_real_head(last);
-	pcut_item_t *it;
-	pcut_main_extra_t *main_extras = last->main_extras;
-	pcut_main_extra_t *main_extras_it;
-
-	int run_only_suite = -1;
-	int run_only_test = -1;
-
-	int rc, rc_tmp;
-
-	if (main_extras == NULL) {
-		main_extras = empty_main_extra;
-	}
-
-	pcut_report_register_handler(&pcut_report_tap);
-
-	FOR_EACH_MAIN_EXTRA(main_extras, main_extras_it) {
-		if (main_extras_it->type == PCUT_MAIN_EXTRA_REPORT_XML) {
-			pcut_report_register_handler(&pcut_report_xml);
-		}
-		if (main_extras_it->type == PCUT_MAIN_EXTRA_PREINIT_HOOK) {
-			main_extras_it->preinit_hook(&argc, &argv);
-		}
-	}
-
-	if (argc > 1) {
-		int i;
-		for (i = 1; i < argc; i++) {
-			pcut_is_arg_with_number(argv[i], "-s", &run_only_suite);
-			pcut_is_arg_with_number(argv[i], "-t", &run_only_test);
-			if (pcut_str_equals(argv[i], "-l")) {
-				pcut_print_tests(items);
-				return PCUT_OUTCOME_PASS;
-			}
-			if (pcut_str_equals(argv[i], "-x")) {
-				pcut_report_register_handler(&pcut_report_xml);
-			}
-#ifndef PCUT_NO_LONG_JUMP
-			if (pcut_str_equals(argv[i], "-u")) {
-				pcut_run_mode = PCUT_RUN_MODE_SINGLE;
-			}
-#endif
-		}
-	}
-
-	setvbuf(stdout, NULL, _IONBF, 0);
-	set_setup_teardown_callbacks(items);
-
-	FOR_EACH_MAIN_EXTRA(main_extras, main_extras_it) {
-		if (main_extras_it->type == PCUT_MAIN_EXTRA_INIT_HOOK) {
-			main_extras_it->init_hook();
-		}
-	}
-
-	PCUT_DEBUG("run_only_suite = %d   run_only_test = %d", run_only_suite, run_only_test);
-
-	if ((run_only_suite >= 0) && (run_only_test >= 0)) {
-		printf("Specify either -s or -t!\n");
-		return PCUT_OUTCOME_BAD_INVOCATION;
-	}
-
-	if (run_only_suite > 0) {
-		pcut_item_t *suite = pcut_find_by_id(items, run_only_suite);
-		if (suite == NULL) {
-			printf("Suite not found, aborting!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
-		}
-		if (suite->kind != PCUT_KIND_TESTSUITE) {
-			printf("Invalid suite id!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
-		}
-
-		run_suite(suite, NULL, argv[0]);
-		return PCUT_OUTCOME_PASS;
-	}
-
-	if (run_only_test > 0) {
-		pcut_item_t *test = pcut_find_by_id(items, run_only_test);
-		if (test == NULL) {
-			printf("Test not found, aborting!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
-		}
-		if (test->kind != PCUT_KIND_TEST) {
-			printf("Invalid test id!\n");
-			return PCUT_OUTCOME_BAD_INVOCATION;
-		}
-
-		if (pcut_run_mode == PCUT_RUN_MODE_SINGLE) {
-			rc = pcut_run_test_single(test);
-		} else {
-			rc = pcut_run_test_forked(test);
-		}
-
-		return rc;
-	}
-
-	/* Otherwise, run the whole thing. */
-	pcut_report_init(items);
-
-	rc = PCUT_OUTCOME_PASS;
-
-	it = items;
-	while (it != NULL) {
-		if (it->kind == PCUT_KIND_TESTSUITE) {
-			pcut_item_t *tmp;
-			rc_tmp = run_suite(it, &tmp, argv[0]);
-			if (rc_tmp != PCUT_OUTCOME_PASS) {
-				rc = rc_tmp;
-			}
-			it = tmp;
-		} else {
-			it = pcut_get_real_next(it);
-		}
-	}
-
-	pcut_report_done();
-
-	return rc;
-}
Index: pace/lib/pcut/src/os/generic.c
===================================================================
--- uspace/lib/pcut/src/os/generic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Platform-dependent test execution function when system() is available.
- */
-#pragma warning(push, 0)
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
-#pragma warning(pop)
-
-#include "../internal.h"
-
-/** Maximum command-line length. */
-#define PCUT_COMMAND_LINE_BUFFER_SIZE 256
-
-/** Maximum length of a temporary file name. */
-#define PCUT_TEMP_FILENAME_BUFFER_SIZE 128
-
-/** Maximum size of stdout we are able to capture. */
-#define OUTPUT_BUFFER_SIZE 8192
-
-/* Format the command to launch a test according to OS we are running on. */
-
-#if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
-#include <process.h>
-
-#define FORMAT_COMMAND(buffer, buffer_size, self_path, test_id, temp_file) \
-	pcut_snprintf(buffer, buffer_size, "\"\"%s\" -t%d >%s\"", self_path, test_id, temp_file)
-#define FORMAT_TEMP_FILENAME(buffer, buffer_size) \
-	pcut_snprintf(buffer, buffer_size, "pcut_%d.tmp", _getpid())
-
-#elif defined(__unix)
-#include <unistd.h>
-
-#define FORMAT_COMMAND(buffer, buffer_size, self_path, test_id, temp_file) \
-	pcut_snprintf(buffer, buffer_size, "%s -t%d &>%s", self_path, test_id, temp_file)
-#define FORMAT_TEMP_FILENAME(buffer, buffer_size) \
-	pcut_snprintf(buffer, buffer_size, "pcut_%d.tmp", getpid())
-
-#else
-#error "Unknown operating system."
-#endif
-
-/** Buffer for assertion and other error messages. */
-static char error_message_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Buffer for stdout from the test. */
-static char extra_output_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Prepare for a new test.
- *
- * @param test Test that is about to start.
- */
-static void before_test_start(pcut_item_t *test) {
-	pcut_report_test_start(test);
-
-	memset(error_message_buffer, 0, OUTPUT_BUFFER_SIZE);
-	memset(extra_output_buffer, 0, OUTPUT_BUFFER_SIZE);
-}
-
-/** Convert program exit code to test outcome.
- *
- * @param status Return value from the system() function.
- * @return Test outcome code.
- */
-static int convert_wait_status_to_outcome(int status) {
-	if (status < 0) {
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	} else if (status == 0) {
-		return PCUT_OUTCOME_PASS;
-	} else {
-		return PCUT_OUTCOME_FAIL;
-	}
-}
-
-/** Run the test as a new process and report the result.
- *
- * @param self_path Path to itself, that is to current binary.
- * @param test Test to be run.
- */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
-	int rc, outcome;
-	FILE *tempfile;
-	char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
-	char command[PCUT_COMMAND_LINE_BUFFER_SIZE];
-
-	before_test_start(test);
-
-	FORMAT_TEMP_FILENAME(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1);
-	FORMAT_COMMAND(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1,
-		self_path, (test)->id, tempfile_name);
-
-	PCUT_DEBUG("Will execute <%s> (temp file <%s>) with system().",
-		command, tempfile_name);
-
-	rc = system(command);
-
-	PCUT_DEBUG("system() returned 0x%04X", rc);
-
-	outcome = convert_wait_status_to_outcome(rc);
-
-	tempfile = fopen(tempfile_name, "rb");
-	if (tempfile == NULL) {
-		pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to open temporary file.", NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	fread(extra_output_buffer, 1, OUTPUT_BUFFER_SIZE, tempfile);
-	fclose(tempfile);
-	remove(tempfile_name);
-
-	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
-}
-
-void pcut_hook_before_test(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	/* Do nothing. */
-}
-
Index: pace/lib/pcut/src/os/helenos.c
===================================================================
--- uspace/lib/pcut/src/os/helenos.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Implementation of platform-dependent functions for HelenOS.
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-#include <task.h>
-#include <fibril_synch.h>
-#include <vfs/vfs.h>
-#include "../internal.h"
-
-
-/* String functions. */
-
-int pcut_str_equals(const char *a, const char *b) {
-	return str_cmp(a, b) == 0;
-}
-
-
-int pcut_str_start_equals(const char *a, const char *b, int len) {
-	return str_lcmp(a, b, len) == 0;
-}
-
-int pcut_str_size(const char *s) {
-	return str_size(s);
-}
-
-int pcut_str_to_int(const char *s) {
-	int result = strtol(s, NULL, 10);
-	return result;
-}
-
-char *pcut_str_find_char(const char *haystack, const char needle) {
-	return str_chr(haystack, needle);
-}
-
-void pcut_str_error(int error, char *buffer, int size) {
-	const char *str = str_error(error);
-	if (str == NULL) {
-		str = "(strerror failure)";
-	}
-	str_cpy(buffer, size, str);
-}
-
-
-/* Forking-mode related functions. */
-
-/** Maximum width of a test number. */
-#define MAX_TEST_NUMBER_WIDTH 24
-
-/** Maximum length of a temporary file name. */
-#define PCUT_TEMP_FILENAME_BUFFER_SIZE 128
-
-/** Maximum command-line length. */
-#define MAX_COMMAND_LINE_LENGTH 1024
-
-/** Maximum size of stdout we are able to capture. */
-#define OUTPUT_BUFFER_SIZE 8192
-
-/** Buffer for assertion and other error messages. */
-static char error_message_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Buffer for stdout from the test. */
-static char extra_output_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Prepare for a new test.
- *
- * @param test Test that is about to be run.
- */
-static void before_test_start(pcut_item_t *test) {
-	pcut_report_test_start(test);
-
-	memset(error_message_buffer, 0, OUTPUT_BUFFER_SIZE);
-	memset(extra_output_buffer, 0, OUTPUT_BUFFER_SIZE);
-}
-
-/** Mutex guard for forced_termination_cv. */
-static FIBRIL_MUTEX_INITIALIZE(forced_termination_mutex);
-
-/** Condition-variable for checking whether test timed-out. */
-static FIBRIL_CONDVAR_INITIALIZE(forced_termination_cv);
-
-/** Spawned task id. */
-static task_id_t test_task_id;
-
-/** Flag whether test is still running.
- *
- * This flag is used when checking whether test timed-out.
- */
-static int test_running;
-
-/** Main fibril for checking whether test timed-out.
- *
- * @param arg Test that is currently running (pcut_item_t *).
- * @return EOK Always.
- */
-static int test_timeout_handler_fibril(void *arg) {
-	pcut_item_t *test = arg;
-	int timeout_sec = pcut_get_test_timeout(test);
-	usec_t timeout_us = SEC2USEC(timeout_sec);
-
-	fibril_mutex_lock(&forced_termination_mutex);
-	if (!test_running) {
-		goto leave_no_kill;
-	}
-	errno_t rc = fibril_condvar_wait_timeout(&forced_termination_cv,
-		&forced_termination_mutex, timeout_us);
-	if (rc == ETIMEOUT) {
-		task_kill(test_task_id);
-	}
-leave_no_kill:
-	fibril_mutex_unlock(&forced_termination_mutex);
-	return EOK;
-}
-
-/** Run the test as a new task and report the result.
- *
- * @param self_path Path to itself, that is to current binary.
- * @param test Test to be run.
- */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
-	before_test_start(test);
-
-	char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
-	snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id());
-	int tempfile;
-	errno_t rc = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE, &tempfile);
-	if (rc != EOK) {
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, "Failed to create temporary file.", NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	char test_number_argument[MAX_TEST_NUMBER_WIDTH];
-	snprintf(test_number_argument, MAX_TEST_NUMBER_WIDTH, "-t%d", test->id);
-
-	const char *const arguments[3] = {
-		self_path,
-		test_number_argument,
-		NULL
-	};
-
-	int status = PCUT_OUTCOME_PASS;
-
-	task_wait_t test_task_wait;
-	rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
-	    fileno(stdin), tempfile, tempfile);
-	if (rc != EOK) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
-		goto leave_close_tempfile;
-	}
-
-	test_running = 1;
-
-	fid_t killer_fibril = fibril_create(test_timeout_handler_fibril, test);
-	if (killer_fibril == 0) {
-		/* FIXME: somehow announce this problem. */
-		task_kill(test_task_id);
-	} else {
-		fibril_add_ready(killer_fibril);
-	}
-
-	task_exit_t task_exit;
-	int task_retval;
-	rc = task_wait(&test_task_wait, &task_exit, &task_retval);
-	if (rc != EOK) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
-		goto leave_close_tempfile;
-	}
-	if (task_exit == TASK_EXIT_UNEXPECTED) {
-		status = PCUT_OUTCOME_INTERNAL_ERROR;
-	} else {
-		status = task_retval == 0 ? PCUT_OUTCOME_PASS : PCUT_OUTCOME_FAIL;
-	}
-
-	fibril_mutex_lock(&forced_termination_mutex);
-	test_running = 0;
-	fibril_condvar_signal(&forced_termination_cv);
-	fibril_mutex_unlock(&forced_termination_mutex);
-
-	aoff64_t pos = 0;
-	size_t nread;
-	vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE, &nread);
-
-leave_close_tempfile:
-	vfs_put(tempfile);
-	vfs_unlink_path(tempfile_name);
-
-	pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return status;
-}
-
-void pcut_hook_before_test(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	/* Do nothing. */
-}
Index: pace/lib/pcut/src/os/stdc.c
===================================================================
--- uspace/lib/pcut/src/os/stdc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * String operation functions for systems with a standard C library.
- */
-
-#pragma warning(push, 0)
-#include <string.h>
-#pragma warning(pop)
-
-#include "../internal.h"
-
-int pcut_str_equals(const char *a, const char *b) {
-	return strcmp(a, b) == 0;
-}
-
-int pcut_str_start_equals(const char *a, const char *b, int len) {
-	return strncmp(a, b, len) == 0;
-}
-
-int pcut_str_size(const char *s) {
-	return strlen(s);
-}
-
-int pcut_str_to_int(const char *s) {
-	return atoi(s);
-}
-
-char *pcut_str_find_char(const char *haystack, const char needle) {
-	return strchr(haystack, needle);
-}
-
-void pcut_str_error(int error, char *buffer, int size) {
-	const char *str = strerror(error);
-	if (str == NULL) {
-		str = "(strerror failure)";
-	}
-	strncpy(buffer, str, size - 1);
-	/* Ensure correct termination. */
-	buffer[size - 1] = 0;
-}
Index: pace/lib/pcut/src/os/unix.c
===================================================================
--- uspace/lib/pcut/src/os/unix.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,222 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Unix-specific functions for test execution via the fork() system call.
- */
-
-/** We need _POSIX_SOURCE because of kill(). */
-#define _POSIX_SOURCE
-/** We need _BSD_SOURCE because of snprintf() when compiling under C89. */
-#define _BSD_SOURCE
-
-/** Newer versions of features.h needs _DEFAULT_SOURCE. */
-#define _DEFAULT_SOURCE
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <signal.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#include <string.h>
-#include "../internal.h"
-
-/** Maximum size of stdout we are able to capture. */
-#define OUTPUT_BUFFER_SIZE 8192
-
-/** Buffer for assertion and other error messages. */
-static char error_message_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Buffer for stdout from the test. */
-static char extra_output_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Prepare for a new test.
- *
- * @param test Test that is about to be run.
- */
-static void before_test_start(pcut_item_t *test) {
-	pcut_report_test_start(test);
-
-	memset(error_message_buffer, 0, OUTPUT_BUFFER_SIZE);
-	memset(extra_output_buffer, 0, OUTPUT_BUFFER_SIZE);
-}
-
-/** PID of the forked process running the actual test. */
-static pid_t child_pid;
-
-/** Signal handler that kills the child.
- *
- * @param sig Signal number.
- */
-static void kill_child_on_alarm(int sig) {
-	PCUT_UNUSED(sig);
-	kill(child_pid, SIGKILL);
-}
-
-/** Read full buffer from given file descriptor.
- *
- * This function exists to overcome the possibility that read() may
- * not fill the full length of the provided buffer even when EOF is
- * not reached.
- *
- * @param fd Opened file descriptor.
- * @param buffer Buffer to store data into.
- * @param buffer_size Size of the @p buffer in bytes.
- * @return Number of actually read bytes.
- */
-static size_t read_all(int fd, char *buffer, size_t buffer_size) {
-	ssize_t actually_read;
-	char *buffer_start = buffer;
-	do {
-		actually_read = read(fd, buffer, buffer_size);
-		if (actually_read > 0) {
-			buffer += actually_read;
-			buffer_size -= actually_read;
-			if (buffer_size == 0) {
-				break;
-			}
-		}
-	} while (actually_read > 0);
-	if (buffer_start != buffer) {
-		if (*(buffer - 1) == 10) {
-			*(buffer - 1) = 0;
-			buffer--;
-		}
-	}
-	return buffer - buffer_start;
-}
-
-/** Convert program exit code to test outcome.
- *
- * @param status Status value from the wait() function.
- * @return Test outcome code.
- */
-static int convert_wait_status_to_outcome(int status) {
-	if (WIFEXITED(status)) {
-		if (WEXITSTATUS(status) != 0) {
-			return PCUT_OUTCOME_FAIL;
-		} else {
-			return PCUT_OUTCOME_PASS;
-		}
-	}
-
-	if (WIFSIGNALED(status)) {
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	return status;
-}
-
-/** Run the test in a forked environment and report the result.
- *
- * @param self_path Ignored.
- * @param test Test to be run.
- */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
-	int link_stdout[2], link_stderr[2];
-	int rc, status, outcome;
-	size_t stderr_size;
-
-	PCUT_UNUSED(self_path);
-
-	before_test_start(test);
-
-
-	rc = pipe(link_stdout);
-	if (rc == -1) {
-		pcut_snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
-				"pipe() failed: %s.", strerror(rc));
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	rc = pipe(link_stderr);
-	if (rc == -1) {
-		pcut_snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
-				"pipe() failed: %s.", strerror(rc));
-		pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	child_pid = fork();
-	if (child_pid == (pid_t)-1) {
-		pcut_snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
-			"fork() failed: %s.", strerror(rc));
-		outcome = PCUT_OUTCOME_INTERNAL_ERROR;
-		goto leave_close_pipes;
-	}
-
-	if (child_pid == 0) {
-		/* We are the child. */
-		dup2(link_stdout[1], STDOUT_FILENO);
-		close(link_stdout[0]);
-		dup2(link_stderr[1], STDERR_FILENO);
-		close(link_stderr[0]);
-
-		outcome = pcut_run_test_forked(test);
-
-		exit(outcome);
-	}
-
-	close(link_stdout[1]);
-	close(link_stderr[1]);
-
-	signal(SIGALRM, kill_child_on_alarm);
-	alarm(pcut_get_test_timeout(test));
-
-	stderr_size = read_all(link_stderr[0], extra_output_buffer, OUTPUT_BUFFER_SIZE - 1);
-	read_all(link_stdout[0], extra_output_buffer, OUTPUT_BUFFER_SIZE - 1 - stderr_size);
-
-	wait(&status);
-	alarm(0);
-
-	outcome = convert_wait_status_to_outcome(status);
-
-	goto leave_close_parent_pipe;
-
-leave_close_pipes:
-	close(link_stdout[1]);
-	close(link_stderr[1]);
-leave_close_parent_pipe:
-	close(link_stdout[0]);
-	close(link_stderr[0]);
-
-	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
-}
-
-void pcut_hook_before_test(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	/* Do nothing. */
-}
-
Index: pace/lib/pcut/src/os/windows.c
===================================================================
--- uspace/lib/pcut/src/os/windows.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,330 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Windows-specific functions for test execution via the popen() system call.
- */
-
-/*
- * Code inspired by Creating a Child Process with Redirected Input and Output:
- * http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx
- */
-
-#include "../internal.h"
-
-#pragma warning(push, 0)
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <strsafe.h>
-#pragma warning(pop)
-
-
-
-/** Maximum size of stdout we are able to capture. */
-#define OUTPUT_BUFFER_SIZE 8192
-
-/** Maximum command-line length. */
-#define PCUT_COMMAND_LINE_BUFFER_SIZE 256
-
-/** Buffer for assertion and other error messages. */
-static char error_message_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Buffer for stdout from the test. */
-static char extra_output_buffer[OUTPUT_BUFFER_SIZE];
-
-/** Prepare for a new test.
- *
- * @param test Test that is about to be run.
- */
-static void before_test_start(pcut_item_t *test) {
-	pcut_report_test_start(test);
-
-	memset(error_message_buffer, 0, OUTPUT_BUFFER_SIZE);
-	memset(extra_output_buffer, 0, OUTPUT_BUFFER_SIZE);
-}
-
-/** Report that a certain function failed.
- *
- * @param test Current test.
- * @param failed_function_name Name of the failed function.
- */
-static void report_func_fail(pcut_item_t *test, const char *failed_function_name) {
-	/* TODO: get error description. */
-	pcut_snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1,
-		"%s failed: %s.", failed_function_name, "unknown reason");
-	pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);
-}
-
-/** Read full buffer from given file descriptor.
- *
- * This function exists to overcome the possibility that read() may
- * not fill the full length of the provided buffer even when EOF is
- * not reached.
- *
- * @param fd Opened file descriptor.
- * @param buffer Buffer to store data into.
- * @param buffer_size Size of the @p buffer in bytes.
- * @return Number of actually read bytes.
- */
-static size_t read_all(HANDLE fd, char *buffer, size_t buffer_size) {
-	DWORD actually_read;
-	char *buffer_start = buffer;
-	BOOL okay = FALSE;
-
-	do {
-		okay = ReadFile(fd, buffer, buffer_size, &actually_read, NULL);
-		if (!okay) {
-			break;
-		}
-		if (actually_read > 0) {
-			buffer += actually_read;
-			buffer_size -= actually_read;
-			if (buffer_size == 0) {
-				break;
-			}
-		}
-	} while (actually_read > 0);
-	if (buffer_start != buffer) {
-		if (*(buffer - 1) == 10) {
-			*(buffer - 1) = 0;
-			buffer--;
-		}
-	}
-	return buffer - buffer_start;
-}
-
-struct test_output_data {
-	HANDLE pipe_stdout;
-	HANDLE pipe_stderr;
-	char *output_buffer;
-	size_t output_buffer_size;
-};
-
-static DWORD WINAPI read_test_output_on_background(LPVOID test_output_data_ptr) {
-	size_t stderr_size = 0;
-	struct test_output_data *test_output_data = (struct test_output_data *) test_output_data_ptr;
-
-	stderr_size = read_all(test_output_data->pipe_stderr,
-		test_output_data->output_buffer,
-		test_output_data->output_buffer_size - 1);
-	read_all(test_output_data->pipe_stdout,
-		test_output_data->output_buffer,
-		test_output_data->output_buffer_size - 1 - stderr_size);
-
-	return 0;
-}
-
-/** Run the test as a new process and report the result.
- *
- * @param self_path Path to itself, that is to current binary.
- * @param test Test to be run.
- */
-int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
-	/* TODO: clean-up if something goes wrong "in the middle" */
-	BOOL okay = FALSE;
-	DWORD rc;
-	int outcome;
-	int timed_out;
-	int time_out_millis;
-	SECURITY_ATTRIBUTES security_attributes;
-	HANDLE link_stdout[2] = { NULL, NULL };
-	HANDLE link_stderr[2] = { NULL, NULL };
-	HANDLE link_stdin[2] = { NULL, NULL };
-	PROCESS_INFORMATION process_info;
-	STARTUPINFO start_info;
-	char command[PCUT_COMMAND_LINE_BUFFER_SIZE];
-	struct test_output_data test_output_data;
-	HANDLE test_output_thread_reader;
-
-
-	before_test_start(test);
-
-	/* Pipe handles are inherited. */
-	security_attributes.nLength = sizeof(SECURITY_ATTRIBUTES);
-	security_attributes.bInheritHandle = TRUE;
-	security_attributes.lpSecurityDescriptor = NULL;
-
-	/* Create pipe for stdout, make sure it is not inherited. */
-	okay = CreatePipe(&link_stdout[0], &link_stdout[1], &security_attributes, 0);
-	if (!okay) {
-		report_func_fail(test, "CreatePipe(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	okay = SetHandleInformation(link_stdout[0], HANDLE_FLAG_INHERIT, 0);
-	if (!okay) {
-		report_func_fail(test, "SetHandleInformation(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Create pipe for stderr, make sure it is not inherited. */
-	okay = CreatePipe(&link_stderr[0], &link_stderr[1], &security_attributes, 0);
-	if (!okay) {
-		report_func_fail(test, "CreatePipe(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	okay = SetHandleInformation(link_stderr[0], HANDLE_FLAG_INHERIT, 0);
-	if (!okay) {
-		report_func_fail(test, "SetHandleInformation(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Create pipe for stdin, make sure it is not inherited. */
-	okay = CreatePipe(&link_stdin[0], &link_stdin[1], &security_attributes, 0);
-	if (!okay) {
-		report_func_fail(test, "CreatePipe(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	okay = SetHandleInformation(link_stdin[1], HANDLE_FLAG_INHERIT, 0);
-	if (!okay) {
-		report_func_fail(test, "SetHandleInformation(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Prepare information for the child process. */
-	ZeroMemory(&process_info, sizeof(PROCESS_INFORMATION));
-	ZeroMemory(&start_info, sizeof(STARTUPINFO));
-	start_info.cb = sizeof(STARTUPINFO);
-	start_info.hStdError = link_stderr[1];
-	start_info.hStdOutput = link_stdout[1];
-	start_info.hStdInput = link_stdin[0];
-	start_info.dwFlags |= STARTF_USESTDHANDLES;
-
-	/* Format the command line. */
-	pcut_snprintf(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1,
-		"\"%s\" -t%d", self_path, test->id);
-
-	/* Run the process. */
-	okay = CreateProcess(NULL, command, NULL, NULL, TRUE, 0, NULL, NULL,
-		&start_info, &process_info);
-
-	if (!okay) {
-		report_func_fail(test, "CreateProcess()");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	// FIXME: kill the process on error
-
-	/* Close handles to the first thread. */
-	CloseHandle(process_info.hThread);
-
-	/* Close the other ends of the pipes. */
-	okay = CloseHandle(link_stdout[1]);
-	if (!okay) {
-		report_func_fail(test, "CloseHandle(/* stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	okay = CloseHandle(link_stderr[1]);
-	if (!okay) {
-		report_func_fail(test, "CloseHandle(/* stderr */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-	okay = CloseHandle(link_stdin[0]);
-	if (!okay) {
-		report_func_fail(test, "CloseHandle(/* stdin */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/*
-	 * Read data from stdout and stderr.
-	 * We need to do this in a separate thread to allow the
-	 * time-out to work correctly.
-	 * Probably, this can be done with asynchronous I/O but
-	 * this works for now pretty well.
-	 */
-	test_output_data.pipe_stderr = link_stderr[0];
-	test_output_data.pipe_stdout = link_stdout[0];
-	test_output_data.output_buffer = extra_output_buffer;
-	test_output_data.output_buffer_size = OUTPUT_BUFFER_SIZE;
-
-	test_output_thread_reader = CreateThread(NULL, 0,
-		read_test_output_on_background, &test_output_data,
-		0, NULL);
-
-	if (test_output_thread_reader == NULL) {
-		report_func_fail(test, "CreateThread(/* read test stdout */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Wait for the process to terminate. */
-	timed_out = 0;
-	time_out_millis = pcut_get_test_timeout(test) * 1000;
-	rc = WaitForSingleObject(process_info.hProcess, time_out_millis);
-	PCUT_DEBUG("Waiting for test %s (%dms) returned %d.", test->name, time_out_millis, rc);
-	if (rc == WAIT_TIMEOUT) {
-		/* We timed-out: kill the process and wait for its termination again. */
-		timed_out = 1;
-		okay = TerminateProcess(process_info.hProcess, 5);
-		if (!okay) {
-			report_func_fail(test, "TerminateProcess(/* PROCESS_INFORMATION.hProcess */)");
-			return PCUT_OUTCOME_INTERNAL_ERROR;
-		}
-		rc = WaitForSingleObject(process_info.hProcess, INFINITE);
-	}
-	if (rc != WAIT_OBJECT_0) {
-		report_func_fail(test, "WaitForSingleObject(/* PROCESS_INFORMATION.hProcess */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Get the return code and convert it to outcome. */
-	okay = GetExitCodeProcess(process_info.hProcess, &rc);
-	if (!okay) {
-		report_func_fail(test, "GetExitCodeProcess()");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	if (rc == 0) {
-		outcome = PCUT_OUTCOME_PASS;
-	} else if ((rc > 0) && (rc < 10) && !timed_out) {
-		outcome = PCUT_OUTCOME_FAIL;
-	} else {
-		outcome = PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	/* Wait for the reader thread (shall be terminated by now). */
-	rc = WaitForSingleObject(test_output_thread_reader, INFINITE);
-	if (rc != WAIT_OBJECT_0) {
-		report_func_fail(test, "WaitForSingleObject(/* stdout reader thread */)");
-		return PCUT_OUTCOME_INTERNAL_ERROR;
-	}
-
-	pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
-
-	return outcome;
-}
-
-void pcut_hook_before_test(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	/*
-	 * Prevent displaying the dialog informing the user that the
-	 * program unexpectedly failed.
-	 */
-	SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
-}
Index: pace/lib/pcut/src/preproc.c
===================================================================
--- uspace/lib/pcut/src/preproc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,137 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma warning(push, 0)
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#pragma warning(pop)
-
-
-#define MAX_IDENTIFIER_LENGTH 256
-
-static int counter = 0;
-
-static void print_numbered_identifier(int value, FILE *output) {
-	fprintf(output, "pcut_item_%d", value);
-}
-
-static void print_numbered_identifier2(int value, FILE *output) {
-	fprintf(output, "pcut_item2_%d", value);
-}
-
-static void print_numbered_identifier3(int value, FILE *output) {
-	fprintf(output, "pcut_item3_%d", value);
-}
-
-typedef struct {
-	char name[MAX_IDENTIFIER_LENGTH];
-	size_t length;
-} identifier_t;
-
-static void identifier_init(identifier_t *identifier) {
-	identifier->name[0] = 0;
-	identifier->length = 0;
-}
-
-static void identifier_add_char(identifier_t *identifier, char c) {
-	if (identifier->length + 1 >= MAX_IDENTIFIER_LENGTH) {
-		fprintf(stderr, "Identifier %s is too long, aborting!\n", identifier->name);
-		exit(1);
-	}
-
-	identifier->name[identifier->length] = c;
-	identifier->length++;
-	identifier->name[identifier->length] = 0;
-}
-
-static void identifier_print_or_expand(identifier_t *identifier, FILE *output) {
-	const char *name = identifier->name;
-	if (strcmp(name, "PCUT_ITEM_NAME") == 0) {
-		print_numbered_identifier(counter, output);
-	} else if (strcmp(name, "PCUT_ITEM_NAME_PREV") == 0) {
-		print_numbered_identifier(counter - 1, output);
-	} else if (strcmp(name, "PCUT_ITEM_COUNTER_INCREMENT") == 0) {
-		counter++;
-	} else if (strcmp(name, "PCUT_ITEM2_NAME") == 0) {
-		print_numbered_identifier2(counter, output);
-	} else if (strcmp(name, "PCUT_ITEM3_NAME") == 0) {
-		print_numbered_identifier3(counter, output);
-	} else {
-		fprintf(output, "%s", name);
-	}
-}
-
-static int is_identifier_char(int c, int inside_identifier) {
-	return isalpha(c) || (c == '_')
-			|| (inside_identifier && isdigit(c));
-}
-
-int main(int argc, char *argv[]) {
-	FILE *input = stdin;
-	FILE *output = stdout;
-
-	int last_char_was_identifier = 0;
-	identifier_t last_identifier;
-
-	/* Unused parameters. */
-	(void) argc;
-	(void) argv;
-
-	while (1) {
-		int current_char_denotes_identifier;
-
-		int current_char = fgetc(input);
-		if (current_char == EOF) {
-			break;
-		}
-
-		current_char_denotes_identifier = is_identifier_char(current_char, last_char_was_identifier);
-		if (current_char_denotes_identifier) {
-			if (!last_char_was_identifier) {
-				identifier_init(&last_identifier);
-			}
-			identifier_add_char(&last_identifier, current_char);
-			last_char_was_identifier = 1;
-		} else {
-			if (last_char_was_identifier) {
-				identifier_print_or_expand(&last_identifier, output);
-			}
-			fprintf(stdout, "%c", current_char);
-			last_char_was_identifier = 0;
-		}
-	}
-
-	if (last_char_was_identifier) {
-		identifier_print_or_expand(&last_identifier, output);
-	}
-	fprintf(output, "\n");
-
-	return 0;
-}
Index: pace/lib/pcut/src/print.c
===================================================================
--- uspace/lib/pcut/src/print.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Helper functions for debugging prints.
- */
-
-#include <pcut/pcut.h>
-
-#pragma warning(push, 0)
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#pragma warning(pop)
-
-#include "internal.h"
-
-/** Print all items in the given list.
- *
- * @param first First item to be printed.
- */
-void pcut_print_items(pcut_item_t *first) {
-	pcut_item_t *it = first;
-	printf("====>\n");
-	while (it != NULL) {
-		switch (it->kind) {
-		case PCUT_KIND_TEST:
-			printf("TEST %s\n", it->name);
-			break;
-		case PCUT_KIND_TESTSUITE:
-			printf("SUITE %s\n", it->name);
-			break;
-		case PCUT_KIND_SKIP:
-			break;
-		case PCUT_KIND_NESTED:
-			printf("NESTED ...\n");
-			break;
-		default:
-			printf("UNKNOWN (%d)\n", it->kind);
-			break;
-		}
-		it = it->next;
-	}
-	printf("----\n");
-}
-
-/** Print valid items in the list.
- *
- * @param first First item to be printed.
- */
-void pcut_print_tests(pcut_item_t *first) {
-	pcut_item_t *it;
-	for (it = pcut_get_real(first); it != NULL; it = pcut_get_real_next(it)) {
-		switch (it->kind) {
-		case PCUT_KIND_TESTSUITE:
-			printf("  Suite `%s' [%d]\n", it->name, it->id);
-			break;
-		case PCUT_KIND_TEST:
-			printf("    Test `%s' [%d]\n", it->name, it->id);
-			break;
-		case PCUT_KIND_SETUP:
-		case PCUT_KIND_TEARDOWN:
-			/* Fall-through, do nothing. */
-			break;
-		default:
-			assert(0 && "unreachable case in item-kind switch");
-			break;
-		}
-	}
-}
Index: pace/lib/pcut/src/report/report.c
===================================================================
--- uspace/lib/pcut/src/report/report.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,237 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Common functions for test results reporting.
- */
-
-#include "../internal.h"
-
-#ifdef __helenos__
-#include <mem.h>
-#else
-#pragma warning(push, 0)
-#include <string.h>
-#pragma warning(pop)
-#endif
-
-#pragma warning(push, 0)
-#include <stdio.h>
-#pragma warning(pop)
-
-
-/** Currently used report ops. */
-static pcut_report_ops_t *report_ops = NULL;
-
-/** Call a report function if it is available.
- *
- * @param op Operation to be called on the pcut_report_ops_t.
- * @param ... Arguments to the operation.
- */
-#define REPORT_CALL(op, ...) \
-	if ((report_ops != NULL) && (report_ops->op != NULL)) report_ops->op(__VA_ARGS__)
-
-/** Call a report function if it is available.
- *
- * @param op Operation to be called on the pcut_report_ops_t.
- */
-#define REPORT_CALL_NO_ARGS(op) \
-		if ((report_ops != NULL) && (report_ops->op != NULL)) report_ops->op()
-
-/** Print error message.
- *
- * NULL or empty message is silently ignored.
- *
- * The message is printed with a special 3-zero-byte prefix to be later
- * parsed when reporting the results from a different process.
- *
- * @param msg The message to be printed.
- */
-void pcut_print_fail_message(const char *msg) {
-	if (msg == NULL) {
-		return;
-	}
-	if (pcut_str_size(msg) == 0) {
-		return;
-	}
-
-	printf("%c%c%c%s\n%c", 0, 0, 0, msg, 0);
-}
-
-/** Size of buffer for storing error messages or extra test output. */
-#define BUFFER_SIZE 4096
-
-/** Buffer for stdout from the test. */
-static char buffer_for_extra_output[BUFFER_SIZE];
-
-/** Buffer for assertion and other error messages. */
-static char buffer_for_error_messages[BUFFER_SIZE];
-
-/** Parse output of a single test.
- *
- * @param full_output Full unparsed output.
- * @param full_output_size Size of @p full_output in bytes.
- * @param stdio_buffer Where to store normal output from the test.
- * @param stdio_buffer_size Size of @p stdio_buffer in bytes.
- * @param error_buffer Where to store error messages from the test.
- * @param error_buffer_size Size of @p error_buffer in bytes.
- */
-static void parse_command_output(const char *full_output, size_t full_output_size,
-		char *stdio_buffer, size_t stdio_buffer_size,
-		char *error_buffer, size_t error_buffer_size) {
-	memset(stdio_buffer, 0, stdio_buffer_size);
-	memset(error_buffer, 0, error_buffer_size);
-
-	/* Ensure that we do not read past the full_output. */
-	if (full_output[full_output_size - 1] != 0) {
-		/* FIXME: can this happen? */
-		return;
-	}
-
-	while (1) {
-		size_t message_length;
-
-		/* First of all, count number of zero bytes before the text. */
-		size_t cont_zeros_count = 0;
-		while (full_output[0] == 0) {
-			cont_zeros_count++;
-			full_output++;
-			full_output_size--;
-			if (full_output_size == 0) {
-				return;
-			}
-		}
-
-		/* Determine the length of the text after the zeros. */
-		message_length = pcut_str_size(full_output);
-
-		if (cont_zeros_count < 2) {
-			/* Okay, standard I/O. */
-			if (message_length > stdio_buffer_size) {
-				/* TODO: handle gracefully */
-				return;
-			}
-			memcpy(stdio_buffer, full_output, message_length);
-			stdio_buffer += message_length;
-			stdio_buffer_size -= message_length;
-		} else {
-			/* Error message. */
-			if (message_length > error_buffer_size) {
-				/* TODO: handle gracefully */
-				return;
-			}
-			memcpy(error_buffer, full_output, message_length);
-			error_buffer += message_length;
-			error_buffer_size -= message_length;
-		}
-
-		full_output += message_length + 1;
-		full_output_size -= message_length + 1;
-	}
-}
-
-/** Use given set of functions for error reporting.
- *
- * @param ops Functions to use.
- */
-void pcut_report_register_handler(pcut_report_ops_t *ops) {
-	report_ops = ops;
-}
-
-/** Initialize the report.
- *
- * @param all_items List of all tests that could be run.
- */
-void pcut_report_init(pcut_item_t *all_items) {
-	REPORT_CALL(init, all_items);
-}
-
-/** Report that a test suite was started.
- *
- * @param suite Suite that was just started.
- */
-void pcut_report_suite_start(pcut_item_t *suite) {
-	REPORT_CALL(suite_start, suite);
-}
-
-/** Report that a test suite was completed.
- *
- * @param suite Suite that just completed.
- */
-void pcut_report_suite_done(pcut_item_t *suite) {
-	REPORT_CALL(suite_done, suite);
-}
-
-/** Report that a test is about to start.
- *
- * @param test Test to be run just about now.
- */
-void pcut_report_test_start(pcut_item_t *test) {
-	REPORT_CALL(test_start, test);
-}
-
-/** Report that a test was completed.
- *
- * @param test Test that just finished.
- * @param outcome Outcome of the test.
- * @param error_message Buffer with error message.
- * @param teardown_error_message Buffer with error message from a tear-down function.
- * @param extra_output Extra output from the test (stdout).
- */
-void pcut_report_test_done(pcut_item_t *test, int outcome,
-		const char *error_message, const char *teardown_error_message,
-		const char *extra_output) {
-	REPORT_CALL(test_done, test, outcome, error_message, teardown_error_message,
-			extra_output);
-}
-
-/** Report that a test was completed with unparsed test output.
- *
- * @param test Test that just finished
- * @param outcome Outcome of the test.
- * @param unparsed_output Buffer with all the output from the test.
- * @param unparsed_output_size Size of @p unparsed_output in bytes.
- */
-void pcut_report_test_done_unparsed(pcut_item_t *test, int outcome,
-		const char *unparsed_output, size_t unparsed_output_size) {
-
-	parse_command_output(unparsed_output, unparsed_output_size,
-			buffer_for_extra_output, BUFFER_SIZE,
-			buffer_for_error_messages, BUFFER_SIZE);
-
-	pcut_report_test_done(test, outcome, buffer_for_error_messages, NULL, buffer_for_extra_output);
-}
-
-/** Close the report.
- *
- */
-void pcut_report_done(void) {
-	REPORT_CALL_NO_ARGS(done);
-}
-
Index: pace/lib/pcut/src/report/report.h
===================================================================
--- uspace/lib/pcut/src/report/report.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Test results reporting.
- */
-
-#ifndef PCUT_REPORT_H_GUARD
-#define PCUT_REPORT_H_GUARD
-
-#include "../internal.h"
-
-/** Reporting functions for the test-anything-protocol. */
-extern pcut_report_ops_t pcut_report_tap;
-
-/** Reporting functions for XML report output. */
-extern pcut_report_ops_t pcut_report_xml;
-
-#endif
Index: pace/lib/pcut/src/report/tap.c
===================================================================
--- uspace/lib/pcut/src/report/tap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,204 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Test-anything-protocol reporting routines.
- */
-
-#include "../internal.h"
-#include "report.h"
-
-#ifdef __helenos__
-#define _REALLY_WANT_STRING_H
-#endif
-
-#pragma warning(push, 0)
-#include <string.h>
-#include <stdio.h>
-#pragma warning(pop)
-
-
-/** Counter of all run tests. */
-static int test_counter;
-
-/** Counter of all failures. */
-static int failed_test_counter;
-
-/** Counter for tests in a current suite. */
-static int tests_in_suite;
-
-/** Counter of failed tests in current suite. */
-static int failed_tests_in_suite;
-
-/** Comma-separated list of failed test names. */
-static char *failed_test_names;
-
-/** Initialize the TAP output.
- *
- * @param all_items Start of the list with all items.
- */
-static void tap_init(pcut_item_t *all_items) {
-	int tests_total = pcut_count_tests(all_items);
-	test_counter = 0;
-	failed_test_counter = 0;
-
-	printf("1..%d\n", tests_total);
-}
-
-/** Report that a suite was started.
- *
- * @param suite Suite that just started.
- */
-static void tap_suite_start(pcut_item_t *suite) {
-	tests_in_suite = 0;
-	failed_tests_in_suite = 0;
-
-	printf("#> Starting suite %s.\n", suite->name);
-}
-
-/** Report that a suite was completed.
- *
- * @param suite Suite that just ended.
- */
-static void tap_suite_done(pcut_item_t *suite) {
-	if (failed_tests_in_suite == 0) {
-		printf("#> Finished suite %s (passed).\n",
-				suite->name);
-	} else {
-		printf("#> Finished suite %s (failed %d of %d).\n",
-				suite->name, failed_tests_in_suite, tests_in_suite);
-	}
-}
-
-/** Report that a test was started.
- *
- * We do nothing - all handling is done after the test completes.
- *
- * @param test Test that is started.
- */
-static void tap_test_start(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	tests_in_suite++;
-	test_counter++;
-}
-
-/** Print the buffer, prefix new line with a given string.
- *
- * @param message Message to print.
- * @param prefix Prefix for each new line, such as comment character.
- */
-static void print_by_lines(const char *message, const char *prefix) {
-	char *next_line_start;
-	if ((message == NULL) || (message[0] == 0)) {
-		return;
-	}
-	next_line_start = pcut_str_find_char(message, '\n');
-	while (next_line_start != NULL) {
-		next_line_start[0] = 0;
-		printf("%s%s\n", prefix, message);
-		message = next_line_start + 1;
-		next_line_start = pcut_str_find_char(message, '\n');
-	}
-	if (message[0] != 0) {
-		printf("%s%s\n", prefix, message);
-	}
-}
-
-/** Report a completed test.
- *
- * @param test Test that just finished.
- * @param outcome Outcome of the test.
- * @param error_message Buffer with error message.
- * @param teardown_error_message Buffer with error message from a tear-down function.
- * @param extra_output Extra output from the test (stdout).
- */
-static void tap_test_done(pcut_item_t *test, int outcome,
-		const char *error_message, const char *teardown_error_message,
-		const char *extra_output) {
-	const char *test_name = test->name;
-	const char *status_str = NULL;
-	const char *fail_error_str = NULL;
-
-	if (outcome != PCUT_OUTCOME_PASS) {
-		failed_tests_in_suite++;
-		failed_test_counter++;
-	}
-
-	switch (outcome) {
-	case PCUT_OUTCOME_PASS:
-		status_str = "ok";
-		fail_error_str = "";
-		break;
-	case PCUT_OUTCOME_FAIL:
-		status_str = "not ok";
-		fail_error_str = " failed";
-		break;
-	default:
-		status_str = "not ok";
-		fail_error_str = " aborted";
-		break;
-	}
-	printf("%s %d %s%s\n", status_str, test_counter, test_name, fail_error_str);
-
-	print_by_lines(error_message, "# error: ");
-	print_by_lines(teardown_error_message, "# error: ");
-
-	print_by_lines(extra_output, "# stdio: ");
-
-	if (outcome != PCUT_OUTCOME_PASS) {
-		if (failed_test_names == NULL) {
-			failed_test_names = strdup(test_name);
-		} else {
-			char *fs = NULL;
-			if (asprintf(&fs, "%s, %s",
-			    failed_test_names, test_name) >= 0) {
-				free(failed_test_names);
-				failed_test_names = fs;
-			}
-		}
-	}
-}
-
-/** Report testing done. */
-static void tap_done(void) {
-	if (failed_test_counter == 0) {
-		printf("#> Done: all tests passed.\n");
-	} else {
-		printf("#> Done: %d of %d tests failed.\n", failed_test_counter, test_counter);
-		printf("#> Failed tests: %s\n", failed_test_names);
-	}
-}
-
-
-pcut_report_ops_t pcut_report_tap = {
-	tap_init, tap_done,
-	tap_suite_start, tap_suite_done,
-	tap_test_start, tap_test_done
-};
Index: pace/lib/pcut/src/report/xml.c
===================================================================
--- uspace/lib/pcut/src/report/xml.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Reporting routines for XML output (non-standard).
- */
-
-#include "../internal.h"
-#include "report.h"
-
-#ifndef __helenos__
-#pragma warning(push, 0)
-#include <string.h>
-#pragma warning(pop)
-#endif
-
-#pragma warning(push, 0)
-#include <stdio.h>
-#pragma warning(pop)
-
-
-/** Counter of all run tests. */
-static int test_counter;
-
-/** Counter for tests in a current suite. */
-static int tests_in_suite;
-
-/** Counter of failed tests in current suite. */
-static int failed_tests_in_suite;
-
-/** Initialize the XML output.
- *
- * @param all_items Start of the list with all items.
- */
-static void xml_init(pcut_item_t *all_items) {
-	int tests_total = pcut_count_tests(all_items);
-	test_counter = 0;
-
-	printf("<?xml version=\"1.0\"?>\n");
-	printf("<report tests-total=\"%d\">\n", tests_total);
-}
-
-/** Report that a suite was started.
- *
- * @param suite Suite that just started.
- */
-static void xml_suite_start(pcut_item_t *suite) {
-	tests_in_suite = 0;
-	failed_tests_in_suite = 0;
-
-	printf("\t<suite name=\"%s\">\n", suite->name);
-}
-
-/** Report that a suite was completed.
- *
- * @param suite Suite that just ended.
- */
-static void xml_suite_done(pcut_item_t *suite) {
-	printf("\t</suite><!-- %s: %d / %d -->\n", suite->name,
-		failed_tests_in_suite, tests_in_suite);
-}
-
-/** Report that a test was started.
- *
- * We do nothing - all handling is done after the test completes.
- *
- * @param test Test that is started.
- */
-static void xml_test_start(pcut_item_t *test) {
-	PCUT_UNUSED(test);
-
-	tests_in_suite++;
-	test_counter++;
-}
-
-/** Print the buffer as a CDATA into given element.
- *
- * @param message Message to print.
- * @param element_name Wrapping XML element name.
- */
-static void print_by_lines(const char *message, const char *element_name) {
-	char *next_line_start;
-
-	if ((message == NULL) || (message[0] == 0)) {
-		return;
-	}
-
-	printf("\t\t\t<%s><![CDATA[", element_name);
-
-	next_line_start = pcut_str_find_char(message, '\n');
-	while (next_line_start != NULL) {
-		next_line_start[0] = 0;
-		printf("%s\n", message);
-		message = next_line_start + 1;
-		next_line_start = pcut_str_find_char(message, '\n');
-	}
-	if (message[0] != 0) {
-		printf("%s\n", message);
-	}
-
-	printf("]]></%s>\n", element_name);
-}
-
-/** Report a completed test.
- *
- * @param test Test that just finished.
- * @param outcome Outcome of the test.
- * @param error_message Buffer with error message.
- * @param teardown_error_message Buffer with error message from a tear-down function.
- * @param extra_output Extra output from the test (stdout).
- */
-static void xml_test_done(pcut_item_t *test, int outcome,
-		const char *error_message, const char *teardown_error_message,
-		const char *extra_output) {
-	const char *test_name = test->name;
-	const char *status_str = NULL;
-
-	if (outcome != PCUT_OUTCOME_PASS) {
-		failed_tests_in_suite++;
-	}
-
-	switch (outcome) {
-	case PCUT_OUTCOME_PASS:
-		status_str = "pass";
-		break;
-	case PCUT_OUTCOME_FAIL:
-		status_str = "fail";
-		break;
-	default:
-		status_str = "error";
-		break;
-	}
-
-	printf("\t\t<testcase name=\"%s\" status=\"%s\">\n", test_name,
-		status_str);
-
-	print_by_lines(error_message, "error-message");
-	print_by_lines(teardown_error_message, "error-message");
-
-	print_by_lines(extra_output, "standard-output");
-
-	printf("\t\t</testcase><!-- %s -->\n", test_name);
-}
-
-/** Report testing done. */
-static void xml_done(void) {
-	printf("</report>\n");
-}
-
-
-pcut_report_ops_t pcut_report_xml = {
-	xml_init, xml_done,
-	xml_suite_start, xml_suite_done,
-	xml_test_start, xml_test_done
-};
Index: pace/lib/pcut/src/run.c
===================================================================
--- uspace/lib/pcut/src/run.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,303 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file
- *
- * Test execution routines.
- */
-
-#include "internal.h"
-
-#ifndef PCUT_NO_LONG_JUMP
-#pragma warning(push, 0)
-#include <setjmp.h>
-#pragma warning(pop)
-#endif
-
-#ifndef PCUT_NO_LONG_JUMP
-/** Long-jump buffer. */
-static jmp_buf start_test_jump;
-#endif
-
-/** Whether to run a tear-down function on a failure.
- *
- * Used to determine whether we are already in a tear-down context.
- */
-static int execute_teardown_on_failure;
-
-/** Whether to report test result at all.
- *
- * Used to determine whether we are the forked or the parent process.
- */
-static int report_test_result;
-
-/** Whether to print test error.
- *
- * Used to determine whether we are the forked or the parent process.
- */
-static int print_test_error;
-
-/** Whether leaving a test means a process exit. */
-static int leave_means_exit;
-
-/** Pointer to currently running test. */
-static pcut_item_t *current_test = NULL;
-
-/** Pointer to current test suite. */
-static pcut_item_t *current_suite = NULL;
-
-/** A NULL-like suite. */
-static pcut_item_t default_suite;
-static int default_suite_initialized = 0;
-
-static void init_default_suite_when_needed() {
-	if (default_suite_initialized) {
-		return;
-	}
-	default_suite.id = -1;
-	default_suite.kind = PCUT_KIND_TESTSUITE;
-	default_suite.previous = NULL;
-	default_suite.next = NULL;
-	default_suite.name = "Default";
-	default_suite.setup_func = NULL;
-	default_suite.teardown_func = NULL;
-}
-
-/** Find the suite given test belongs to.
- *
- * @param it The test.
- * @return Always a valid test suite item.
- */
-static pcut_item_t *pcut_find_parent_suite(pcut_item_t *it) {
-	while (it != NULL) {
-		if (it->kind == PCUT_KIND_TESTSUITE) {
-			return it;
-		}
-		it = it->previous;
-	}
-	init_default_suite_when_needed();
-	return &default_suite;
-}
-
-/** Run a set-up (tear-down) function.
- *
- * @param func Function to run (can be NULL).
- */
-static void run_setup_teardown(pcut_setup_func_t func) {
-	if (func != NULL) {
-		func();
-	}
-}
-
-/** Terminate current test with given outcome.
- *
- * @warning This function may execute a long jump or terminate
- * current process.
- *
- * @param outcome Outcome of the current test.
- */
-static void leave_test(int outcome) {
-	PCUT_DEBUG("leave_test(outcome=%d), will_exit=%s", outcome,
-		leave_means_exit ? "yes" : "no");
-	if (leave_means_exit) {
-		exit(outcome);
-	}
-
-#ifndef PCUT_NO_LONG_JUMP
-	longjmp(start_test_jump, 1);
-#endif
-}
-
-/** Process a failed assertion.
- *
- * @warning This function calls leave_test() and typically will not
- * return.
- *
- * @param message Message describing the failure.
- */
-void pcut_failed_assertion(const char *message) {
-	static const char *prev_message = NULL;
-	/*
-	 * The assertion failed. We need to abort the current test,
-	 * inform the user and perform some clean-up. That could
-	 * include running the tear-down routine.
-	 */
-	if (print_test_error) {
-		pcut_print_fail_message(message);
-	}
-
-	if (execute_teardown_on_failure) {
-		execute_teardown_on_failure = 0;
-		prev_message = message;
-		run_setup_teardown(current_suite->teardown_func);
-
-		/* Tear-down was okay. */
-		if (report_test_result) {
-			pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
-				message, NULL, NULL);
-		}
-	} else {
-		if (report_test_result) {
-			pcut_report_test_done(current_test, PCUT_OUTCOME_FAIL,
-				prev_message, message, NULL);
-		}
-	}
-
-	prev_message = NULL;
-
-	leave_test(PCUT_OUTCOME_FAIL); /* No return. */
-}
-
-/** Run a test.
- *
- * @param test Test to execute.
- * @return Error status (zero means success).
- */
-static int run_test(pcut_item_t *test) {
-	/*
-	 * Set here as the returning point in case of test failure.
-	 * If we get here, it means something failed during the
-	 * test execution.
-	 */
-#ifndef PCUT_NO_LONG_JUMP
-	int test_finished = setjmp(start_test_jump);
-	if (test_finished) {
-		return PCUT_OUTCOME_FAIL;
-	}
-#endif
-
-	if (report_test_result) {
-		pcut_report_test_start(test);
-	}
-
-	current_suite = pcut_find_parent_suite(test);
-	current_test = test;
-
-	pcut_hook_before_test(test);
-
-	/*
-	 * If anything goes wrong, execute the tear-down function
-	 * as well.
-	 */
-	execute_teardown_on_failure = 1;
-
-	/*
-	 * Run the set-up function.
-	 */
-	run_setup_teardown(current_suite->setup_func);
-
-	/*
-	 * The setup function was performed, it is time to run
-	 * the actual test.
-	 */
-	test->test_func();
-
-	/*
-	 * Finally, run the tear-down function. We need to clear
-	 * the flag to prevent endless loop.
-	 */
-	execute_teardown_on_failure = 0;
-	run_setup_teardown(current_suite->teardown_func);
-
-	/*
-	 * If we got here, it means everything went well with
-	 * this test.
-	 */
-	if (report_test_result) {
-		pcut_report_test_done(current_test, PCUT_OUTCOME_PASS,
-			NULL, NULL, NULL);
-	}
-
-	return PCUT_OUTCOME_PASS;
-}
-
-/** Run a test in a forked mode.
- *
- * Forked mode means that the caller of the test is already a new
- * process running this test only.
- *
- * @param test Test to execute.
- * @return Error status (zero means success).
- */
-int pcut_run_test_forked(pcut_item_t *test) {
-	int rc;
-
-	report_test_result = 0;
-	print_test_error = 1;
-	leave_means_exit = 1;
-
-	rc = run_test(test);
-
-	current_test = NULL;
-	current_suite = NULL;
-
-	return rc;
-}
-
-/** Run a test in a single mode.
- *
- * Single mode means that the test is called in the context of the
- * parent process, that is no new process is forked.
- *
- * @param test Test to execute.
- * @return Error status (zero means success).
- */
-int pcut_run_test_single(pcut_item_t *test) {
-	int rc;
-
-	report_test_result = 1;
-	print_test_error = 0;
-	leave_means_exit = 0;
-
-	rc = run_test(test);
-
-	current_test = NULL;
-	current_suite = NULL;
-
-	return rc;
-}
-
-/** Tells time-out length for a given test.
- *
- * @param test Test for which the time-out is questioned.
- * @return Timeout in seconds.
- */
-int pcut_get_test_timeout(pcut_item_t *test) {
-	int timeout = PCUT_DEFAULT_TEST_TIMEOUT;
-	pcut_extra_t *extras = test->extras;
-
-
-	while (extras->type != PCUT_EXTRA_LAST) {
-		if (extras->type == PCUT_EXTRA_TIMEOUT) {
-			timeout = extras->timeout;
-		}
-		extras++;
-	}
-
-	return timeout;
-}
Index: pace/lib/pcut/tests/.gitignore
===================================================================
--- uspace/lib/pcut/tests/.gitignore	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-*.run
-*.got
Index: pace/lib/pcut/tests/abort.c
===================================================================
--- uspace/lib/pcut/tests/abort.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdlib.h>
-
-PCUT_INIT
-
-PCUT_TEST(access_null_pointer) {
-	abort();
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/abort.expected
===================================================================
--- uspace/lib/pcut/tests/abort.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,5 +1,0 @@
-1..1
-#> Starting suite Default.
-not ok 1 access_null_pointer aborted
-#> Finished suite Default (failed 1 of 1).
-#> Done: 1 of 1 tests failed.
Index: pace/lib/pcut/tests/asserts.c
===================================================================
--- uspace/lib/pcut/tests/asserts.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST(int_equals) {
-	PCUT_ASSERT_INT_EQUALS(1, 1);
-	PCUT_ASSERT_INT_EQUALS(1, 0);
-}
-
-PCUT_TEST(double_equals) {
-	PCUT_ASSERT_DOUBLE_EQUALS(1., 1., 0.001);
-	PCUT_ASSERT_DOUBLE_EQUALS(1., 0.5, 0.4);
-}
-
-PCUT_TEST(str_equals) {
-	PCUT_ASSERT_STR_EQUALS("xyz", "xyz");
-	PCUT_ASSERT_STR_EQUALS("abc", "xyz");
-}
-
-PCUT_TEST(str_equals_or_null_base) {
-	PCUT_ASSERT_STR_EQUALS_OR_NULL("xyz", "xyz");
-}
-
-PCUT_TEST(str_equals_or_null_different) {
-	PCUT_ASSERT_STR_EQUALS_OR_NULL("abc", "xyz");
-}
-
-PCUT_TEST(str_equals_or_null_one_null) {
-	PCUT_ASSERT_STR_EQUALS_OR_NULL(NULL, "xyz");
-}
-
-PCUT_TEST(str_equals_or_null_both) {
-	PCUT_ASSERT_STR_EQUALS_OR_NULL(NULL, NULL);
-}
-
-PCUT_TEST(assert_true) {
-	PCUT_ASSERT_TRUE(42);
-	PCUT_ASSERT_TRUE(0);
-}
-
-PCUT_TEST(assert_false) {
-	PCUT_ASSERT_FALSE(0);
-	PCUT_ASSERT_FALSE(42);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/asserts.expected
===================================================================
--- uspace/lib/pcut/tests/asserts.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,20 +1,0 @@
-1..9
-#> Starting suite Default.
-not ok 1 int_equals failed
-# error: asserts.c:36: Expected <1> but got <0> (1 != 0)
-not ok 2 double_equals failed
-# error: asserts.c:41: Expected <1.000000+-0.400000> but got <0.500000> (1. != 0.5)
-not ok 3 str_equals failed
-# error: asserts.c:46: Expected <abc> but got <xyz> ("abc" != "xyz")
-ok 4 str_equals_or_null_base
-not ok 5 str_equals_or_null_different failed
-# error: asserts.c:54: Expected <abc> but got <xyz> ("abc" != "xyz")
-not ok 6 str_equals_or_null_one_null failed
-# error: asserts.c:58: Expected <NULL> but got <xyz> (NULL != "xyz")
-ok 7 str_equals_or_null_both
-not ok 8 assert_true failed
-# error: asserts.c:67: Expected true but got <0>
-not ok 9 assert_false failed
-# error: asserts.c:72: Expected false but got <42>
-#> Finished suite Default (failed 7 of 9).
-#> Done: 7 of 9 tests failed.
Index: pace/lib/pcut/tests/beforeafter.c
===================================================================
--- uspace/lib/pcut/tests/beforeafter.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define _BSD_SOURCE
-#define _DEFAULT_SOURCE
-
-#include <pcut/pcut.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-PCUT_INIT
-
-static char *buffer = NULL;
-#define BUFFER_SIZE 512
-
-PCUT_TEST_SUITE(suite_with_setup_and_teardown);
-
-PCUT_TEST_BEFORE {
-	buffer = malloc(BUFFER_SIZE);
-	PCUT_ASSERT_NOT_NULL(buffer);
-}
-
-PCUT_TEST_AFTER {
-	free(buffer);
-	buffer = NULL;
-}
-
-PCUT_TEST(test_with_setup_and_teardown) {
-#if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
-	_snprintf_s(buffer, BUFFER_SIZE - 1, _TRUNCATE, "%d-%s", 56, "abcd");
-#else
-	snprintf(buffer, BUFFER_SIZE - 1, "%d-%s", 56, "abcd");
-#endif
-
-	PCUT_ASSERT_STR_EQUALS("56-abcd", buffer);
-}
-
-PCUT_TEST_SUITE(another_without_setup);
-
-PCUT_TEST(test_without_any_setup_or_teardown) {
-	PCUT_ASSERT_NULL(buffer);
-}
-
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/beforeafter.expected
===================================================================
--- uspace/lib/pcut/tests/beforeafter.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-1..2
-#> Starting suite suite_with_setup_and_teardown.
-ok 1 test_with_setup_and_teardown
-#> Finished suite suite_with_setup_and_teardown (passed).
-#> Starting suite another_without_setup.
-ok 2 test_without_any_setup_or_teardown
-#> Finished suite another_without_setup (passed).
-#> Done: all tests passed.
Index: pace/lib/pcut/tests/errno.c
===================================================================
--- uspace/lib/pcut/tests/errno.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <errno.h>
-#include "tested.h"
-
-#ifndef EOK
-#define EOK 0
-#endif
-
-PCUT_INIT
-
-PCUT_TEST(errno_value) {
-	int value = EOK;
-	PCUT_ASSERT_ERRNO_VAL(EOK, value);
-	value = ENOENT;
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, value);
-
-	/* This fails. */
-	PCUT_ASSERT_ERRNO_VAL(EOK, value);
-}
-
-PCUT_TEST(errno_variable) {
-	errno = ENOENT;
-	PCUT_ASSERT_ERRNO(ENOENT);
-
-	/* This fails. */
-	PCUT_ASSERT_ERRNO(EOK);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/errno.expected
===================================================================
--- uspace/lib/pcut/tests/errno.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,8 +1,0 @@
-1..2
-#> Starting suite Default.
-not ok 1 errno_value failed
-# error: errno.c:46: Expected error 0 (EOK, *****) but got error ***** (*****)
-not ok 2 errno_variable failed
-# error: errno.c:54: Expected error 0 (EOK, *****) but got error ***** (*****)
-#> Finished suite Default (failed 2 of 2).
-#> Done: 2 of 2 tests failed.
Index: pace/lib/pcut/tests/inithook.c
===================================================================
--- uspace/lib/pcut/tests/inithook.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-static int init_counter = 0;
-
-static void init_hook(void) {
-	init_counter++;
-}
-
-PCUT_TEST_BEFORE {
-	PCUT_ASSERT_INT_EQUALS(1, init_counter);
-	init_counter++;
-}
-
-PCUT_TEST(check_init_counter) {
-	PCUT_ASSERT_INT_EQUALS(2, init_counter);
-}
-
-PCUT_TEST(check_init_counter_2) {
-	PCUT_ASSERT_INT_EQUALS(2, init_counter);
-}
-
-
-PCUT_CUSTOM_MAIN(
-	PCUT_MAIN_SET_INIT_HOOK(init_hook)
-)
-
Index: pace/lib/pcut/tests/inithook.expected
===================================================================
--- uspace/lib/pcut/tests/inithook.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-1..2
-#> Starting suite Default.
-ok 1 check_init_counter
-ok 2 check_init_counter_2
-#> Finished suite Default (passed).
-#> Done: all tests passed.
Index: pace/lib/pcut/tests/manytests.c
===================================================================
--- uspace/lib/pcut/tests/manytests.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-/*
- * Just test how it will look like if a huge number of tests would
- * be present in the suite.
- */
-
-PCUT_INIT
-
-PCUT_TEST(my_test_001) { }
-PCUT_TEST(my_test_002) { }
-PCUT_TEST(my_test_003) { }
-PCUT_TEST(my_test_004) { }
-PCUT_TEST(my_test_005) { }
-PCUT_TEST(my_test_006) { }
-PCUT_TEST(my_test_007) { }
-PCUT_TEST(my_test_008) { }
-PCUT_TEST(my_test_009) { }
-PCUT_TEST(my_test_010) { }
-PCUT_TEST(my_test_011) { }
-PCUT_TEST(my_test_012) { }
-PCUT_TEST(my_test_013) { }
-PCUT_TEST(my_test_014) { }
-PCUT_TEST(my_test_015) { }
-PCUT_TEST(my_test_016) { }
-PCUT_TEST(my_test_017) { }
-PCUT_TEST(my_test_018) { }
-PCUT_TEST(my_test_019) { }
-PCUT_TEST(my_test_020) { }
-PCUT_TEST(my_test_021) { }
-PCUT_TEST(my_test_022) { }
-PCUT_TEST(my_test_023) { }
-PCUT_TEST(my_test_024) { }
-PCUT_TEST(my_test_025) { }
-PCUT_TEST(my_test_026) { }
-PCUT_TEST(my_test_027) { }
-PCUT_TEST(my_test_028) { }
-PCUT_TEST(my_test_029) { }
-PCUT_TEST(my_test_030) { }
-PCUT_TEST(my_test_031) { }
-PCUT_TEST(my_test_032) { }
-PCUT_TEST(my_test_033) { }
-PCUT_TEST(my_test_034) { }
-PCUT_TEST(my_test_035) { }
-PCUT_TEST(my_test_036) { }
-PCUT_TEST(my_test_037) { }
-PCUT_TEST(my_test_038) { }
-PCUT_TEST(my_test_039) { }
-PCUT_TEST(my_test_040) { }
-PCUT_TEST(my_test_041) { }
-PCUT_TEST(my_test_042) { }
-PCUT_TEST(my_test_043) { }
-PCUT_TEST(my_test_044) { }
-PCUT_TEST(my_test_045) { }
-PCUT_TEST(my_test_046) { }
-PCUT_TEST(my_test_047) { }
-PCUT_TEST(my_test_048) { }
-PCUT_TEST(my_test_049) { }
-PCUT_TEST(my_test_050) { }
-PCUT_TEST(my_test_051) { }
-PCUT_TEST(my_test_052) { }
-PCUT_TEST(my_test_053) { }
-PCUT_TEST(my_test_054) { }
-PCUT_TEST(my_test_055) { }
-PCUT_TEST(my_test_056) { }
-PCUT_TEST(my_test_057) { }
-PCUT_TEST(my_test_058) { }
-PCUT_TEST(my_test_059) { }
-PCUT_TEST(my_test_060) { }
-PCUT_TEST(my_test_061) { }
-PCUT_TEST(my_test_062) { }
-PCUT_TEST(my_test_063) { }
-PCUT_TEST(my_test_064) { }
-PCUT_TEST(my_test_065) { }
-PCUT_TEST(my_test_066) { }
-PCUT_TEST(my_test_067) { }
-PCUT_TEST(my_test_068) { }
-PCUT_TEST(my_test_069) { }
-PCUT_TEST(my_test_070) { }
-PCUT_TEST(my_test_071) { }
-PCUT_TEST(my_test_072) { }
-PCUT_TEST(my_test_073) { }
-PCUT_TEST(my_test_074) { }
-PCUT_TEST(my_test_075) { }
-PCUT_TEST(my_test_076) { }
-PCUT_TEST(my_test_077) { }
-PCUT_TEST(my_test_078) { }
-PCUT_TEST(my_test_079) { }
-PCUT_TEST(my_test_080) { }
-
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/manytests.expected
===================================================================
--- uspace/lib/pcut/tests/manytests.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-1..80
-#> Starting suite Default.
-ok 1 my_test_001
-ok 2 my_test_002
-ok 3 my_test_003
-ok 4 my_test_004
-ok 5 my_test_005
-ok 6 my_test_006
-ok 7 my_test_007
-ok 8 my_test_008
-ok 9 my_test_009
-ok 10 my_test_010
-ok 11 my_test_011
-ok 12 my_test_012
-ok 13 my_test_013
-ok 14 my_test_014
-ok 15 my_test_015
-ok 16 my_test_016
-ok 17 my_test_017
-ok 18 my_test_018
-ok 19 my_test_019
-ok 20 my_test_020
-ok 21 my_test_021
-ok 22 my_test_022
-ok 23 my_test_023
-ok 24 my_test_024
-ok 25 my_test_025
-ok 26 my_test_026
-ok 27 my_test_027
-ok 28 my_test_028
-ok 29 my_test_029
-ok 30 my_test_030
-ok 31 my_test_031
-ok 32 my_test_032
-ok 33 my_test_033
-ok 34 my_test_034
-ok 35 my_test_035
-ok 36 my_test_036
-ok 37 my_test_037
-ok 38 my_test_038
-ok 39 my_test_039
-ok 40 my_test_040
-ok 41 my_test_041
-ok 42 my_test_042
-ok 43 my_test_043
-ok 44 my_test_044
-ok 45 my_test_045
-ok 46 my_test_046
-ok 47 my_test_047
-ok 48 my_test_048
-ok 49 my_test_049
-ok 50 my_test_050
-ok 51 my_test_051
-ok 52 my_test_052
-ok 53 my_test_053
-ok 54 my_test_054
-ok 55 my_test_055
-ok 56 my_test_056
-ok 57 my_test_057
-ok 58 my_test_058
-ok 59 my_test_059
-ok 60 my_test_060
-ok 61 my_test_061
-ok 62 my_test_062
-ok 63 my_test_063
-ok 64 my_test_064
-ok 65 my_test_065
-ok 66 my_test_066
-ok 67 my_test_067
-ok 68 my_test_068
-ok 69 my_test_069
-ok 70 my_test_070
-ok 71 my_test_071
-ok 72 my_test_072
-ok 73 my_test_073
-ok 74 my_test_074
-ok 75 my_test_075
-ok 76 my_test_076
-ok 77 my_test_077
-ok 78 my_test_078
-ok 79 my_test_079
-ok 80 my_test_080
-#> Finished suite Default (passed).
-#> Done: all tests passed.
Index: pace/lib/pcut/tests/meson.build
===================================================================
--- uspace/lib/pcut/tests/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-#
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-self_tests = [
-	[ 'abort', files('abort.c') ],
-	[ 'asserts', files('asserts.c') ],
-	[ 'beforeafter', files('beforeafter.c') ],
-	[ 'errno', files('errno.c') ],
-	[ 'inithook', files('inithook.c') ],
-	[ 'manytests', files('manytests.c') ],
-	[ 'multisuite', files('suite_all.c', 'suite1.c', 'suite2.c', 'tested.c') ],
-	[ 'preinithook', files('inithook.c') ],
-	[ 'printing', files('printing.c') ],
-	[ 'simple', files('simple.c', 'tested.c') ],
-	[ 'skip', files('skip.c') ],
-	[ 'suites', files('suites.c', 'tested.c') ],
-	[ 'teardownaborts', files('teardownaborts.c') ],
-	[ 'teardown', files('teardown.c', 'tested.c') ],
-	[ 'testlist', files('testlist.c') ],
-	[ 'timeout', files('timeout.c') ],
-	[ 'xmlreport', files('xmlreport.c', 'tested.c') ],
-]
-
-foreach t : self_tests
-		testfiles += [ {
-			'name': 'pcut-' + t[0],
-			'src': t[1],
-			'includes': include_directories('../include'),
-		} ]
-endforeach
Index: pace/lib/pcut/tests/multisuite.expected
===================================================================
--- uspace/lib/pcut/tests/multisuite.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,13 +1,0 @@
-1..4
-#> Starting suite intpow.
-not ok 1 zero_exponent failed
-# error: suite1.c:37: Expected <1> but got <0> (1 != intpow(2, 0))
-not ok 2 one_exponent failed
-# error: suite1.c:41: Expected <2> but got <0> (2 != intpow(2, 1))
-#> Finished suite intpow (failed 2 of 2).
-#> Starting suite intmin.
-not ok 3 test_min failed
-# error: suite2.c:38: Expected <5> but got <654> (5 != intmin(654, 5))
-ok 4 test_same_numbers
-#> Finished suite intmin (failed 1 of 2).
-#> Done: 3 of 4 tests failed.
Index: pace/lib/pcut/tests/preinithook.c
===================================================================
--- uspace/lib/pcut/tests/preinithook.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-static int init_counter = 1;
-
-static void init_hook(void) {
-	init_counter++;
-}
-
-static void pre_init_hook(int *argc, char **argv[]) {
-	(void) argc;
-	(void) argv;
-	init_counter *= 2;
-}
-
-PCUT_TEST_BEFORE {
-	PCUT_ASSERT_INT_EQUALS(4, init_counter);
-	init_counter++;
-}
-
-PCUT_TEST(check_init_counter) {
-	PCUT_ASSERT_INT_EQUALS(5, init_counter);
-}
-
-PCUT_TEST(check_init_counter_2) {
-	PCUT_ASSERT_INT_EQUALS(5, init_counter);
-}
-
-
-PCUT_CUSTOM_MAIN(
-	PCUT_MAIN_SET_INIT_HOOK(init_hook),
-	PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
-)
-
Index: pace/lib/pcut/tests/preinithook.expected
===================================================================
--- uspace/lib/pcut/tests/preinithook.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-1..2
-#> Starting suite Default.
-ok 1 check_init_counter
-ok 2 check_init_counter_2
-#> Finished suite Default (passed).
-#> Done: all tests passed.
Index: pace/lib/pcut/tests/printing.c
===================================================================
--- uspace/lib/pcut/tests/printing.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-#include <stdio.h>
-
-PCUT_INIT
-
-PCUT_TEST(print_to_stdout) {
-	printf("Printed from a test to stdout!\n");
-}
-
-PCUT_TEST(print_to_stderr) {
-	fprintf(stderr, "Printed from a test to stderr!\n");
-}
-
-PCUT_TEST(print_to_stdout_and_fail) {
-	printf("Printed from a test to stdout!\n");
-	PCUT_ASSERT_NOT_NULL(0);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/printing.expected
===================================================================
--- uspace/lib/pcut/tests/printing.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,11 +1,0 @@
-1..3
-#> Starting suite Default.
-ok 1 print_to_stdout
-# stdio: Printed from a test to stdout!
-ok 2 print_to_stderr
-# stdio: Printed from a test to stderr!
-not ok 3 print_to_stdout_and_fail failed
-# error: printing.c:45: Pointer <0> ought not to be NULL
-# stdio: Printed from a test to stdout!
-#> Finished suite Default (failed 1 of 3).
-#> Done: 1 of 3 tests failed.
Index: pace/lib/pcut/tests/simple.c
===================================================================
--- uspace/lib/pcut/tests/simple.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST(zero_exponent) {
-	PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
-}
-
-PCUT_TEST(one_exponent) {
-	PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
-	PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
-}
-
-PCUT_TEST(same_strings) {
-	const char *p = "xyz";
-	PCUT_ASSERT_STR_EQUALS("xyz", p);
-	PCUT_ASSERT_STR_EQUALS("abc", "XXXabd" + 3);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/simple.expected
===================================================================
--- uspace/lib/pcut/tests/simple.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,10 +1,0 @@
-1..3
-#> Starting suite Default.
-not ok 1 zero_exponent failed
-# error: simple.c:35: Expected <1> but got <0> (1 != intpow(2, 0))
-not ok 2 one_exponent failed
-# error: simple.c:39: Expected <2> but got <0> (2 != intpow(2, 1))
-not ok 3 same_strings failed
-# error: simple.c:46: Expected <abc> but got <abd> ("abc" != "XXXabd" + 3)
-#> Finished suite Default (failed 3 of 3).
-#> Done: 3 of 3 tests failed.
Index: pace/lib/pcut/tests/skip.c
===================================================================
--- uspace/lib/pcut/tests/skip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST(normal_test) {
-	PCUT_ASSERT_INT_EQUALS(1, 1);
-}
-
-PCUT_TEST(skipped, PCUT_TEST_SKIP) {
-	PCUT_ASSERT_STR_EQUALS("skip", "not skipped");
-}
-
-PCUT_TEST(again_normal_test) {
-	PCUT_ASSERT_INT_EQUALS(1, 1);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/skip.expected
===================================================================
--- uspace/lib/pcut/tests/skip.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,6 +1,0 @@
-1..2
-#> Starting suite Default.
-ok 1 normal_test
-ok 2 again_normal_test
-#> Finished suite Default (passed).
-#> Done: all tests passed.
Index: pace/lib/pcut/tests/suite1.c
===================================================================
--- uspace/lib/pcut/tests/suite1.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST_SUITE(intpow);
-
-PCUT_TEST(zero_exponent) {
-	PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
-}
-
-PCUT_TEST(one_exponent) {
-	PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
-	PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
-}
-
-PCUT_EXPORT(intpow_suite);
Index: pace/lib/pcut/tests/suite2.c
===================================================================
--- uspace/lib/pcut/tests/suite2.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST_SUITE(intmin);
-
-PCUT_TEST(test_min) {
-	PCUT_ASSERT_INT_EQUALS(5, intmin(5, 654));
-	PCUT_ASSERT_INT_EQUALS(5, intmin(654, 5));
-
-	PCUT_ASSERT_INT_EQUALS(-17, intmin(-17, -2));
-}
-
-PCUT_TEST(test_same_numbers) {
-	PCUT_ASSERT_INT_EQUALS(5, intmin(5, 5));
-	PCUT_ASSERT_INT_EQUALS(719, intmin(719, 719));
-	PCUT_ASSERT_INT_EQUALS(-4589, intmin(-4589, 4589));
-}
-
-PCUT_EXPORT(intmin_suite);
Index: pace/lib/pcut/tests/suite_all.c
===================================================================
--- uspace/lib/pcut/tests/suite_all.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT
-
-PCUT_IMPORT(intpow_suite);
-PCUT_IMPORT(intmin_suite);
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/suites.c
===================================================================
--- uspace/lib/pcut/tests/suites.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST_SUITE(intpow);
-
-PCUT_TEST(zero_exponent) {
-	PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
-}
-
-PCUT_TEST(one_exponent) {
-	PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
-	PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
-}
-
-PCUT_TEST_SUITE(intmin);
-
-PCUT_TEST(test_min) {
-	PCUT_ASSERT_INT_EQUALS(5, intmin(5, 654));
-	PCUT_ASSERT_INT_EQUALS(5, intmin(654, 5));
-
-	PCUT_ASSERT_INT_EQUALS(-17, intmin(-17, -2));
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/suites.expected
===================================================================
--- uspace/lib/pcut/tests/suites.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,12 +1,0 @@
-1..3
-#> Starting suite intpow.
-not ok 1 zero_exponent failed
-# error: suites.c:37: Expected <1> but got <0> (1 != intpow(2, 0))
-not ok 2 one_exponent failed
-# error: suites.c:41: Expected <2> but got <0> (2 != intpow(2, 1))
-#> Finished suite intpow (failed 2 of 2).
-#> Starting suite intmin.
-not ok 3 test_min failed
-# error: suites.c:49: Expected <5> but got <654> (5 != intmin(654, 5))
-#> Finished suite intmin (failed 1 of 1).
-#> Done: 3 of 3 tests failed.
Index: pace/lib/pcut/tests/teardown.c
===================================================================
--- uspace/lib/pcut/tests/teardown.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-
-
-PCUT_TEST_SUITE(with_teardown);
-
-PCUT_TEST_AFTER {
-	printf("This is teardown-function.\n");
-}
-
-PCUT_TEST(empty) {
-}
-
-PCUT_TEST(failing) {
-	PCUT_ASSERT_INT_EQUALS(10, intmin(1, 2));
-}
-
-
-
-PCUT_TEST_SUITE(with_failing_teardown);
-
-PCUT_TEST_AFTER {
-	printf("This is failing teardown-function.\n");
-	PCUT_ASSERT_INT_EQUALS(42, intmin(10, 20));
-}
-
-PCUT_TEST(empty2) {
-}
-
-PCUT_TEST(printing2) {
-	printf("Printed before test failure.\n");
-	PCUT_ASSERT_INT_EQUALS(0, intmin(-17, -19));
-}
-
-PCUT_TEST(failing2) {
-	PCUT_ASSERT_INT_EQUALS(12, intmin(3, 5));
-}
-
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/teardown.expected
===================================================================
--- uspace/lib/pcut/tests/teardown.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,23 +1,0 @@
-1..5
-#> Starting suite with_teardown.
-ok 1 empty
-# stdio: This is teardown-function.
-not ok 2 failing failed
-# error: teardown.c:47: Expected <10> but got <1> (10 != intmin(1, 2))
-# stdio: This is teardown-function.
-#> Finished suite with_teardown (failed 1 of 2).
-#> Starting suite with_failing_teardown.
-not ok 3 empty2 failed
-# error: teardown.c:56: Expected <42> but got <10> (42 != intmin(10, 20))
-# stdio: This is failing teardown-function.
-not ok 4 printing2 failed
-# error: teardown.c:64: Expected <0> but got <-17> (0 != intmin(-17, -19))
-# error: teardown.c:56: Expected <42> but got <10> (42 != intmin(10, 20))
-# stdio: Printed before test failure.
-# stdio: This is failing teardown-function.
-not ok 5 failing2 failed
-# error: teardown.c:68: Expected <12> but got <3> (12 != intmin(3, 5))
-# error: teardown.c:56: Expected <42> but got <10> (42 != intmin(10, 20))
-# stdio: This is failing teardown-function.
-#> Finished suite with_failing_teardown (failed 3 of 3).
-#> Done: 4 of 5 tests failed.
Index: pace/lib/pcut/tests/teardownaborts.c
===================================================================
--- uspace/lib/pcut/tests/teardownaborts.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-#include <stdlib.h>
-
-PCUT_INIT
-
-PCUT_TEST_AFTER {
-	abort();
-}
-
-PCUT_TEST(print_and_fail) {
-	printf("Tear-down will cause null pointer access...\n");
-	PCUT_ASSERT_NOT_NULL(NULL);
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/teardownaborts.expected
===================================================================
--- uspace/lib/pcut/tests/teardownaborts.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,7 +1,0 @@
-1..1
-#> Starting suite Default.
-not ok 1 print_and_fail aborted
-# error: teardownaborts.c:41: Pointer <NULL> ought not to be NULL
-# stdio: Tear-down will cause null pointer access...
-#> Finished suite Default (failed 1 of 1).
-#> Done: 1 of 1 tests failed.
Index: pace/lib/pcut/tests/tested.c
===================================================================
--- uspace/lib/pcut/tests/tested.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "tested.h"
-
-#define UNUSED(a) ((void)a)
-
-long intpow(int base, int exp) {
-	UNUSED(base); UNUSED(exp);
-	return 0;
-}
-
-int intmin(int a, int b) {
-	UNUSED(b);
-	return a;
-}
Index: pace/lib/pcut/tests/tested.h
===================================================================
--- uspace/lib/pcut/tests/tested.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2012-2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TESTED_H
-#define TESTED_H
-
-long intpow(int base, int exp);
-
-int intmin(int a, int b);
-
-#endif
Index: pace/lib/pcut/tests/testlist.c
===================================================================
--- uspace/lib/pcut/tests/testlist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-static char *argv_patched[] = {
-	NULL, /* Will be patched at run-time. */
-	(char *) "-l",
-	NULL
-};
-
-static void pre_init_hook(int *argc, char **argv[]) {
-	argv_patched[0] = (*argv)[0];
-	*argc = 2;
-	*argv = argv_patched;
-}
-
-PCUT_TEST(unreachable) {
-	PCUT_ASSERT_TRUE(0 && "unreachable code");
-}
-
-
-PCUT_CUSTOM_MAIN(
-	PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
-)
-
Index: pace/lib/pcut/tests/testlist.expected
===================================================================
--- uspace/lib/pcut/tests/testlist.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,2 +1,0 @@
-*****Suite `Default' [1]
-*****Test `unreachable' [2]
Index: pace/lib/pcut/tests/timeout.c
===================================================================
--- uspace/lib/pcut/tests/timeout.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2012-2018 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-#ifdef __helenos__
-#include <fibril.h>
-#else
-#if defined(__unix) || defined(__APPLE__)
-#include <unistd.h>
-#endif
-#if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
-#include <windows.h>
-#endif
-#endif
-
-#include <stdio.h>
-#include "tested.h"
-
-static void my_sleep(int sec) {
-#ifdef __helenos__
-	fibril_sleep(sec);
-#else
-#if defined(__unix) || defined(__APPLE__)
-	sleep(sec);
-#endif
-#if defined(__WIN64) || defined(__WIN32) || defined(_WIN32)
-	Sleep(1000 * sec);
-#endif
-#endif
-}
-
-PCUT_INIT
-
-PCUT_TEST(shall_time_out) {
-	printf("Text before sleeping.\n");
-	my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 5);
-	printf("Text after the sleep.\n");
-}
-
-PCUT_TEST(custom_time_out,
-		PCUT_TEST_SET_TIMEOUT(PCUT_DEFAULT_TEST_TIMEOUT * 3)) {
-	printf("Text before sleeping.\n");
-	my_sleep(PCUT_DEFAULT_TEST_TIMEOUT * 2);
-	printf("Text after the sleep.\n");
-}
-
-PCUT_MAIN()
Index: pace/lib/pcut/tests/timeout.expected
===================================================================
--- uspace/lib/pcut/tests/timeout.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,9 +1,0 @@
-1..2
-#> Starting suite Default.
-not ok 1 shall_time_out aborted
-# stdio: Text before sleeping.
-ok 2 custom_time_out
-# stdio: Text before sleeping.
-# stdio: Text after the sleep.
-#> Finished suite Default (failed 1 of 2).
-#> Done: 1 of 2 tests failed.
Index: pace/lib/pcut/tests/xmlreport.c
===================================================================
--- uspace/lib/pcut/tests/xmlreport.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-#include <pcut/pcut.h>
-#include "tested.h"
-
-PCUT_INIT
-
-PCUT_TEST(zero_exponent) {
-	PCUT_ASSERT_INT_EQUALS(1, intpow(2, 0));
-}
-
-PCUT_TEST(one_exponent) {
-	PCUT_ASSERT_INT_EQUALS(2, intpow(2, 1));
-	PCUT_ASSERT_INT_EQUALS(39, intpow(39, 1));
-}
-
-PCUT_TEST(same_strings) {
-	const char *p = "xyz";
-	PCUT_ASSERT_STR_EQUALS("xyz", p);
-	PCUT_ASSERT_STR_EQUALS("abc", "XXXabd" + 3);
-}
-
-PCUT_CUSTOM_MAIN(
-	PCUT_MAIN_SET_XML_REPORT
-)
Index: pace/lib/pcut/tests/xmlreport.expected
===================================================================
--- uspace/lib/pcut/tests/xmlreport.expected	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,17 +1,0 @@
-<?xml version="1.0"?>
-<report tests-total="3">
-	<suite name="Default">
-		<testcase name="zero_exponent" status="fail">
-			<error-message><![CDATA[xmlreport.c:38: Expected <1> but got <0> (1 != intpow(2, 0))
-]]></error-message>
-		</testcase><!-- zero_exponent -->
-		<testcase name="one_exponent" status="fail">
-			<error-message><![CDATA[xmlreport.c:42: Expected <2> but got <0> (2 != intpow(2, 1))
-]]></error-message>
-		</testcase><!-- one_exponent -->
-		<testcase name="same_strings" status="fail">
-			<error-message><![CDATA[xmlreport.c:49: Expected <abc> but got <abd> ("abc" != "XXXabd" + 3)
-]]></error-message>
-		</testcase><!-- same_strings -->
-	</suite><!-- Default: 3 / 3 -->
-</report>
Index: pace/lib/pcut/update-from-master.sh
===================================================================
--- uspace/lib/pcut/update-from-master.sh	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#!/bin/bash
-
-#
-# Copyright (c) 2014 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# FIXME: update for meson config
-
-run_echo() {
-	echo "[exec]:" "$@"
-	"$@"
-}
-
-RUN=run_echo
-
-
-# Because of the very first command we issue that deletes about everything
-if ! [ "$1" == "really-overwrite" ]; then
-	echo "Wrong argument, see sources!"
-	exit 1
-fi
-
-$RUN find -not -name update-from-master.sh -and -not -name doc -and -not -name 'doxygroups.h' -delete
-$RUN wget -q https://github.com/vhotspur/pcut/archive/master.zip -O pcut-master.zip
-$RUN unzip -q -u pcut-master.zip
-$RUN mv -f pcut-master/src .
-$RUN mv -f pcut-master/include .
-$RUN mv -f pcut-master/tests .
-$RUN mv -f pcut-master/helenos*.mak .
-$RUN rm -rf pcut-master pcut-master.zip
-$RUN rm -f CMakeLists.txt *.cmake run_test.sh
-
-cat >Makefile <<'EOF_MAKEFILE_HEAD'
-#
-# This file was generated by call to update-from-master.sh
-#
-
-USPACE_PREFIX = ../..
-PCUT_TEST_PREFIX = test-libpcut-
-
-SELF_TESTS = \
-EOF_MAKEFILE_HEAD
-
-for testfile in tests/*.expected; do
-	testname=`basename "$testfile" .expected`
-	echo "	\$(PCUT_TEST_PREFIX)${testname}\$(PCUT_TEST_SUFFIX) \\"
-done | sed '$s/\\$//' >>Makefile
-
-cat >>Makefile <<'EOF_MAKEFILE_TAIL'
-
-EXTRA_CLEAN = $(SELF_TESTS)
-
-include helenos.mak
-
-include $(USPACE_PREFIX)/Makefile.common
-
-include helenos.test.mak
-
-all-test: $(SELF_TESTS)
-
-test-libpcut-%: $(LIBRARY).a
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(START_FILES) $^ $(LIBRARY).a $(BASE_LIBS)
-
-EOF_MAKEFILE_TAIL
Index: pace/lib/pixconv/doc/doxygroups.h
===================================================================
--- uspace/lib/pixconv/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup softrend libsoftrend
- * @ingroup libs
- */
Index: pace/lib/pixconv/meson.build
===================================================================
--- uspace/lib/pixconv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'pixconv.c',
-)
Index: pace/lib/pixconv/pixconv.c
===================================================================
--- uspace/lib/pixconv/pixconv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup softrend
- * @{
- */
-/**
- * @file Pixel conversion and mask functions.
- *
- * These functions write an ARGB pixel value to a memory location
- * in a predefined format. The naming convention corresponds to
- * the names of the visuals and the format created by these functions.
- * The functions use the so called network bit order (i.e. big endian)
- * with respect to their names.
- */
-
-#include <byteorder.h>
-#include "pixconv.h"
-
-void pixel2argb_8888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (ALPHA(pix) << 24) | (RED(pix) << 16) | (GREEN(pix) << 8) | (BLUE(pix)));
-}
-
-void pixel2abgr_8888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (ALPHA(pix) << 24) | (BLUE(pix) << 16) | (GREEN(pix) << 8) | (RED(pix)));
-}
-
-void pixel2rgba_8888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (RED(pix) << 24) | (GREEN(pix) << 16) | (BLUE(pix) << 8) | (ALPHA(pix)));
-}
-
-void pixel2bgra_8888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (BLUE(pix) << 24) | (GREEN(pix) << 16) | (RED(pix) << 8) | (ALPHA(pix)));
-}
-
-void pixel2rgb_0888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (RED(pix) << 16) | (GREEN(pix) << 8) | (BLUE(pix)));
-}
-
-void pixel2bgr_0888(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (BLUE(pix) << 16) | (GREEN(pix) << 8) | (RED(pix)));
-}
-
-void pixel2rgb_8880(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (RED(pix) << 24) | (GREEN(pix) << 16) | (BLUE(pix) << 8));
-}
-
-void pixel2bgr_8880(void *dst, pixel_t pix)
-{
-	*((uint32_t *) dst) = host2uint32_t_be(
-	    (BLUE(pix) << 24) | (GREEN(pix) << 16) | (RED(pix) << 8));
-}
-
-void pixel2rgb_888(void *dst, pixel_t pix)
-{
-	((uint8_t *) dst)[0] = RED(pix);
-	((uint8_t *) dst)[1] = GREEN(pix);
-	((uint8_t *) dst)[2] = BLUE(pix);
-}
-
-void pixel2bgr_888(void *dst, pixel_t pix)
-{
-	((uint8_t *) dst)[0] = BLUE(pix);
-	((uint8_t *) dst)[1] = GREEN(pix);
-	((uint8_t *) dst)[2] = RED(pix);
-}
-
-void pixel2rgb_555_be(void *dst, pixel_t pix)
-{
-	*((uint16_t *) dst) = host2uint16_t_be(
-	    (NARROW(RED(pix), 5) << 10) | (NARROW(GREEN(pix), 5) << 5) | (NARROW(BLUE(pix), 5)));
-}
-
-void pixel2rgb_555_le(void *dst, pixel_t pix)
-{
-	*((uint16_t *) dst) = host2uint16_t_le(
-	    (NARROW(RED(pix), 5) << 10) | (NARROW(GREEN(pix), 5) << 5) | (NARROW(BLUE(pix), 5)));
-}
-
-void pixel2rgb_565_be(void *dst, pixel_t pix)
-{
-	*((uint16_t *) dst) = host2uint16_t_be(
-	    (NARROW(RED(pix), 5) << 11) | (NARROW(GREEN(pix), 6) << 5) | (NARROW(BLUE(pix), 5)));
-}
-
-void pixel2rgb_565_le(void *dst, pixel_t pix)
-{
-	*((uint16_t *) dst) = host2uint16_t_le(
-	    (NARROW(RED(pix), 5) << 11) | (NARROW(GREEN(pix), 6) << 5) | (NARROW(BLUE(pix), 5)));
-}
-
-void pixel2bgr_323(void *dst, pixel_t pix)
-{
-	*((uint8_t *) dst) =
-	    ~((NARROW(RED(pix), 3) << 5) | (NARROW(GREEN(pix), 2) << 3) | NARROW(BLUE(pix), 3));
-}
-
-void pixel2gray_8(void *dst, pixel_t pix)
-{
-	uint32_t red = RED(pix) * 5034375;
-	uint32_t green = GREEN(pix) * 9886846;
-	uint32_t blue = BLUE(pix) * 1920103;
-
-	*((uint8_t *) dst) = (red + green + blue) >> 24;
-}
-
-void visual_mask_8888(void *dst, bool mask)
-{
-	pixel2abgr_8888(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_0888(void *dst, bool mask)
-{
-	pixel2bgr_0888(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_8880(void *dst, bool mask)
-{
-	pixel2bgr_8880(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_888(void *dst, bool mask)
-{
-	pixel2bgr_888(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_555(void *dst, bool mask)
-{
-	pixel2rgb_555_be(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_565(void *dst, bool mask)
-{
-	pixel2rgb_565_be(dst, mask ? 0xffffffff : 0);
-}
-
-void visual_mask_323(void *dst, bool mask)
-{
-	pixel2bgr_323(dst, mask ? 0x0 : ~0x0);
-}
-
-void visual_mask_8(void *dst, bool mask)
-{
-	pixel2gray_8(dst, mask ? 0xffffffff : 0);
-}
-
-pixel_t argb_8888_2pixel(void *src)
-{
-	return (uint32_t_be2host(*((uint32_t *) src)));
-}
-
-pixel_t abgr_8888_2pixel(void *src)
-{
-	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
-	return ((val & 0xff000000) | ((val & 0xff0000) >> 16) | (val & 0xff00) | ((val & 0xff) << 16));
-}
-
-pixel_t rgba_8888_2pixel(void *src)
-{
-	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
-	return ((val << 24) | (val >> 8));
-}
-
-pixel_t bgra_8888_2pixel(void *src)
-{
-	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
-	return ((val >> 24) | ((val & 0xff0000) >> 8) | ((val & 0xff00) << 8) | (val << 24));
-}
-
-pixel_t rgb_0888_2pixel(void *src)
-{
-	return (0xff000000 | (uint32_t_be2host(*((uint32_t *) src)) & 0xffffff));
-}
-
-pixel_t bgr_0888_2pixel(void *src)
-{
-	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
-	return (0xff000000 | ((val & 0xff0000) >> 16) | (val & 0xff00) | ((val & 0xff) << 16));
-}
-
-pixel_t rgb_8880_2pixel(void *src)
-{
-	return (0xff000000 | (uint32_t_be2host(*((uint32_t *) src)) >> 8));
-}
-
-pixel_t bgr_8880_2pixel(void *src)
-{
-	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
-	return (0xff000000 | (val >> 24) | ((val & 0xff0000) >> 8) | ((val & 0xff00) << 8));
-}
-
-pixel_t rgb_888_2pixel(void *src)
-{
-	uint8_t red = ((uint8_t *) src)[0];
-	uint8_t green = ((uint8_t *) src)[1];
-	uint8_t blue = ((uint8_t *) src)[2];
-
-	return (0xff000000 | (red << 16) | (green << 8) | (blue));
-}
-
-pixel_t bgr_888_2pixel(void *src)
-{
-	uint8_t blue = ((uint8_t *) src)[0];
-	uint8_t green = ((uint8_t *) src)[1];
-	uint8_t red = ((uint8_t *) src)[2];
-
-	return (0xff000000 | (red << 16) | (green << 8) | (blue));
-}
-
-pixel_t rgb_555_be_2pixel(void *src)
-{
-	uint16_t val = uint16_t_be2host(*((uint16_t *) src));
-	return (0xff000000 | ((val & 0x7c00) << 9) | ((val & 0x3e0) << 6) | ((val & 0x1f) << 3));
-}
-
-pixel_t rgb_555_le_2pixel(void *src)
-{
-	uint16_t val = uint16_t_le2host(*((uint16_t *) src));
-	return (0xff000000 | ((val & 0x7c00) << 9) | ((val & 0x3e0) << 6) | ((val & 0x1f) << 3));
-}
-
-pixel_t rgb_565_be_2pixel(void *src)
-{
-	uint16_t val = uint16_t_be2host(*((uint16_t *) src));
-	return (0xff000000 | ((val & 0xf800) << 8) | ((val & 0x7e0) << 5) | ((val & 0x1f) << 3));
-}
-
-pixel_t rgb_565_le_2pixel(void *src)
-{
-	uint16_t val = uint16_t_le2host(*((uint16_t *) src));
-	return (0xff000000 | ((val & 0xf800) << 8) | ((val & 0x7e0) << 5) | ((val & 0x1f) << 3));
-}
-
-pixel_t bgr_323_2pixel(void *src)
-{
-	uint8_t val = ~(*((uint8_t *) src));
-	return (0xff000000 | ((val & 0xe0) << 16) | ((val & 0x18) << 11) | ((val & 0x7) << 5));
-}
-
-pixel_t gray_8_2pixel(void *src)
-{
-	uint8_t val = *((uint8_t *) src);
-	return (0xff000000 | (val << 16) | (val << 8) | (val));
-}
-
-/** @}
- */
Index: pace/lib/pixconv/pixconv.h
===================================================================
--- uspace/lib/pixconv/pixconv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup softrend
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SOFTREND_PIXCONV_H_
-#define SOFTREND_PIXCONV_H_
-
-#include <stdbool.h>
-#include <io/pixel.h>
-
-/** Function to render a pixel. */
-typedef void (*pixel2visual_t)(void *, pixel_t);
-
-/** Function to render a bit mask. */
-typedef void (*visual_mask_t)(void *, bool);
-
-/** Function to retrieve a pixel. */
-typedef pixel_t (*visual2pixel_t)(void *);
-
-extern void pixel2argb_8888(void *, pixel_t);
-extern void pixel2abgr_8888(void *, pixel_t);
-extern void pixel2rgba_8888(void *, pixel_t);
-extern void pixel2bgra_8888(void *, pixel_t);
-extern void pixel2rgb_0888(void *, pixel_t);
-extern void pixel2bgr_0888(void *, pixel_t);
-extern void pixel2rgb_8880(void *, pixel_t);
-extern void pixel2bgr_8880(void *, pixel_t);
-extern void pixel2rgb_888(void *, pixel_t);
-extern void pixel2bgr_888(void *, pixel_t);
-extern void pixel2rgb_555_be(void *, pixel_t);
-extern void pixel2rgb_555_le(void *, pixel_t);
-extern void pixel2rgb_565_be(void *, pixel_t);
-extern void pixel2rgb_565_le(void *, pixel_t);
-extern void pixel2bgr_323(void *, pixel_t);
-extern void pixel2gray_8(void *, pixel_t);
-
-extern void visual_mask_8888(void *, bool);
-extern void visual_mask_0888(void *, bool);
-extern void visual_mask_8880(void *, bool);
-extern void visual_mask_888(void *, bool);
-extern void visual_mask_555(void *, bool);
-extern void visual_mask_565(void *, bool);
-extern void visual_mask_323(void *, bool);
-extern void visual_mask_8(void *, bool);
-
-extern pixel_t argb_8888_2pixel(void *);
-extern pixel_t abgr_8888_2pixel(void *);
-extern pixel_t rgba_8888_2pixel(void *);
-extern pixel_t bgra_8888_2pixel(void *);
-extern pixel_t rgb_0888_2pixel(void *);
-extern pixel_t bgr_0888_2pixel(void *);
-extern pixel_t rgb_8880_2pixel(void *);
-extern pixel_t bgr_8880_2pixel(void *);
-extern pixel_t rgb_888_2pixel(void *);
-extern pixel_t bgr_888_2pixel(void *);
-extern pixel_t rgb_555_be_2pixel(void *);
-extern pixel_t rgb_555_le_2pixel(void *);
-extern pixel_t rgb_565_be_2pixel(void *);
-extern pixel_t rgb_565_le_2pixel(void *);
-extern pixel_t bgr_323_2pixel(void *);
-extern pixel_t gray_8_2pixel(void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/doc/doxygroups.h
===================================================================
--- uspace/lib/posix/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup libposix libposix
- * @ingroup libs
- * @brief POSIX emulation library
- */
Index: pace/lib/posix/include/common
===================================================================
--- uspace/lib/posix/include/common	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../../../common/include
Index: pace/lib/posix/include/libc
===================================================================
--- uspace/lib/posix/include/libc	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1 +1,0 @@
-../../c/include
Index: pace/lib/posix/include/posix/ctype.h
===================================================================
--- uspace/lib/posix/include/posix/ctype.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Character classification.
- */
-
-#ifndef POSIX_CTYPE_H_
-#define POSIX_CTYPE_H_
-
-#include <common/ctype.h>
-
-__C_DECLS_BEGIN;
-
-/* Obsolete Functions and Macros */
-extern int isascii(int c);
-extern int toascii(int c);
-
-#define _tolower(c) ((c) - 'A' + 'a')
-#define _toupper(c) ((c) - 'a' + 'A')
-
-__C_DECLS_END;
-
-#endif /* POSIX_CTYPE_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/dlfcn.h
===================================================================
--- uspace/lib/posix/include/posix/dlfcn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2017 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-
-#ifndef POSIX_DLFCN_H_
-#define POSIX_DLFCN_H_
-
-#include <libc/dlfcn.h>
-
-#define RTLD_LAZY 1
-#define RTLD_NOW 2
-#define RTLD_GLOBAL 32
-#define RTLD_LOCAL 0
-
-__C_DECLS_BEGIN;
-
-extern void *dlopen(const char *, int);
-extern void *dlsym(void *, const char *);
-extern int dlclose(void *);
-extern char *dlerror(void);
-
-__C_DECLS_END;
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/posix/include/posix/fcntl.h
===================================================================
--- uspace/lib/posix/include/posix/fcntl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File control.
- */
-
-#ifndef POSIX_FCNTL_H_
-#define POSIX_FCNTL_H_
-
-#include <sys/types.h>
-
-#define O_CREAT   1
-#define O_EXCL    2
-#define O_TRUNC   4
-#define O_APPEND  8
-#define O_RDONLY  16
-#define O_RDWR    32
-#define O_WRONLY  64
-
-/* Mask for file access modes. */
-#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-
-/* Dummy compatibility flag */
-#define O_NOCTTY 0
-
-/* fcntl commands */
-#define F_DUPFD            0 /* Duplicate file descriptor. */
-#define F_DUPFD_CLOEXEC    1 /* Same as F_DUPFD but with FD_CLOEXEC flag set. */
-#define F_GETFD            2 /* Get file descriptor flags. */
-#define F_SETFD            3 /* Set file descriptor flags. */
-#define F_GETFL            4 /* Get file status and access flags. */
-#define F_SETFL            5 /* Set file status flags. */
-#define F_GETOWN           6 /* Get socket owner. */
-#define F_SETOWN           7 /* Set socket owner. */
-#define F_GETLK            8 /* Get locking information. */
-#define F_SETLK            9 /* Set locking information. */
-#define F_SETLKW          10 /* Set locking information; wait if blocked. */
-
-/* File descriptor flags used with F_GETFD and F_SETFD. */
-#define FD_CLOEXEC         1 /* Close on exec. */
-
-__C_DECLS_BEGIN;
-
-extern int open(const char *pathname, int flags, ...);
-extern int fcntl(int fd, int cmd, ...);
-
-__C_DECLS_END;
-
-#endif /* POSIX_FCNTL_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/fenv.h
===================================================================
--- uspace/lib/posix/include/posix/fenv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file
- * Floating point related constants.
- */
-
-#ifndef POSIX_FENV_H_
-#define POSIX_FENV_H_
-
-#define FE_DIVBYZERO 1
-#define FE_INEXACT 2
-#define FE_INVALID 4
-#define FE_OVERFLOW 8
-#define FE_UNDERFLOW 16
-#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/include/posix/fnmatch.h
===================================================================
--- uspace/lib/posix/include/posix/fnmatch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Filename-matching.
- */
-
-#ifndef POSIX_FNMATCH_H_
-#define POSIX_FNMATCH_H_
-
-#include <_bits/decls.h>
-
-/* Error Values */
-#define FNM_NOMATCH 1
-
-/* Flags */
-#define FNM_PATHNAME 1
-#define FNM_PERIOD 2
-#define FNM_NOESCAPE 4
-
-/* GNU Extensions */
-#define FNM_FILE_NAME FNM_PATHNAME
-#define FNM_LEADING_DIR 8
-#define FNM_CASEFOLD 16
-
-__C_DECLS_BEGIN;
-
-extern int fnmatch(const char *pattern, const char *string, int flags);
-
-__C_DECLS_END;
-
-#endif /* POSIX_FNMATCH_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/getopt.h
===================================================================
--- uspace/lib/posix/include/posix/getopt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Command line argument parsing.
- */
-#ifndef POSIX_GETOPT_H
-#define POSIX_GETOPT_H
-
-#include <unistd.h>
-#include <libc/getopt.h>
-
-#endif
-/**
- * @}
- */
Index: pace/lib/posix/include/posix/limits.h
===================================================================
--- uspace/lib/posix/include/posix/limits.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Implementation-defined limit constants.
- */
-
-#ifndef POSIX_LIMITS_H_
-#define POSIX_LIMITS_H_
-
-#include_next <limits.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 256
-#endif
-
-#endif /* POSIX_LIMITS_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/locale.h
===================================================================
--- uspace/lib/posix/include/posix/locale.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Locale-specific definitions.
- */
-
-#ifndef POSIX_LOCALE_H_
-#define POSIX_LOCALE_H_
-
-#include <stddef.h>
-#include <_bits/decls.h>
-
-#define LC_ALL 0
-#define LC_COLLATE 1
-#define LC_CTYPE 2
-#define LC_MESSAGES 3
-#define LC_MONETARY 4
-#define LC_NUMERIC 5
-#define LC_TIME 6
-
-#define LC_COLLATE_MASK (1 << 0)
-#define LC_CTYPE_MASK (1 << 1)
-#define LC_MESSAGES_MASK (1 << 2)
-#define LC_MONETARY_MASK (1 << 3)
-#define LC_NUMERIC_MASK (1 << 4)
-#define LC_TIME_MASK (1 << 5)
-#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
-    LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
-
-#define LC_GLOBAL_LOCALE NULL
-
-__C_DECLS_BEGIN;
-
-#ifndef __locale_t_defined
-#define __locale_t_defined
-typedef struct __posix_locale *locale_t;
-#endif
-
-struct lconv {
-	char *currency_symbol;
-	char *decimal_point;
-	char  frac_digits;
-	char *grouping;
-	char *int_curr_symbol;
-	char  int_frac_digits;
-	char  int_n_cs_precedes;
-	char  int_n_sep_by_space;
-	char  int_n_sign_posn;
-	char  int_p_cs_precedes;
-	char  int_p_sep_by_space;
-	char  int_p_sign_posn;
-	char *mon_decimal_point;
-	char *mon_grouping;
-	char *mon_thousands_sep;
-	char *negative_sign;
-	char  n_cs_precedes;
-	char  n_sep_by_space;
-	char  n_sign_posn;
-	char *positive_sign;
-	char  p_cs_precedes;
-	char  p_sep_by_space;
-	char  p_sign_posn;
-	char *thousands_sep;
-};
-
-extern char *setlocale(int category, const char *locale);
-extern struct lconv *localeconv(void);
-
-/* POSIX Extensions */
-extern locale_t duplocale(locale_t locobj);
-extern void freelocale(locale_t locobj);
-extern locale_t newlocale(int category_mask, const char *locale,
-    locale_t base);
-extern locale_t uselocale(locale_t newloc);
-
-__C_DECLS_END;
-
-#endif /* POSIX_LOCALE_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/pthread.h
===================================================================
--- uspace/lib/posix/include/posix/pthread.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-#ifndef POSIX_PTHREAD_H_
-#define POSIX_PTHREAD_H_
-
-#include <time.h>
-#include <_bits/decls.h>
-
-#define PTHREAD_MUTEX_RECURSIVE 1
-
-#define PTHREAD_MUTEX_INITIALIZER { 0 }
-
-#define PTHREAD_COND_INITIALIZER { 0 }
-
-__C_DECLS_BEGIN;
-
-typedef void *pthread_t;
-
-typedef struct {
-	int dummy;
-} pthread_attr_t;
-
-typedef int pthread_key_t;
-
-typedef struct pthread_mutex {
-	int dummy;
-} pthread_mutex_t;
-
-typedef struct {
-	int dummy;
-} pthread_mutexattr_t;
-
-typedef struct {
-	int dummy;
-} pthread_condattr_t;
-
-typedef struct {
-	int dummy;
-} pthread_cond_t;
-
-extern pthread_t pthread_self(void);
-extern int pthread_equal(pthread_t, pthread_t);
-extern int pthread_create(pthread_t *, const pthread_attr_t *,
-    void *(*)(void *), void *);
-extern int pthread_join(pthread_t, void **);
-extern int pthread_detach(pthread_t);
-
-extern int pthread_attr_init(pthread_attr_t *);
-extern int pthread_attr_destroy(pthread_attr_t *);
-
-extern int pthread_mutex_init(pthread_mutex_t *__restrict__,
-    const pthread_mutexattr_t *__restrict__);
-extern int pthread_mutex_destroy(pthread_mutex_t *);
-extern int pthread_mutex_lock(pthread_mutex_t *);
-extern int pthread_mutex_trylock(pthread_mutex_t *);
-extern int pthread_mutex_unlock(pthread_mutex_t *);
-
-extern int pthread_mutexattr_init(pthread_mutexattr_t *);
-extern int pthread_mutexattr_destroy(pthread_mutexattr_t *);
-extern int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict__,
-    int *__restrict__);
-extern int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
-
-extern int pthread_cond_init(pthread_cond_t *__restrict__,
-    const pthread_condattr_t *__restrict__);
-extern int pthread_cond_destroy(pthread_cond_t *);
-extern int pthread_cond_broadcast(pthread_cond_t *);
-extern int pthread_cond_signal(pthread_cond_t *);
-extern int pthread_cond_timedwait(pthread_cond_t *__restrict__,
-    pthread_mutex_t *__restrict__, const struct timespec *__restrict__);
-extern int pthread_cond_wait(pthread_cond_t *__restrict__,
-    pthread_mutex_t *__restrict__);
-
-extern int pthread_condattr_destroy(pthread_condattr_t *);
-extern int pthread_condattr_init(pthread_condattr_t *);
-
-extern void *pthread_getspecific(pthread_key_t);
-extern int pthread_setspecific(pthread_key_t, const void *);
-extern int pthread_key_delete(pthread_key_t);
-extern int pthread_key_create(pthread_key_t *, void (*)(void *));
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/include/posix/pwd.h
===================================================================
--- uspace/lib/posix/include/posix/pwd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Password handling.
- */
-
-#ifndef POSIX_PWD_H_
-#define POSIX_PWD_H_
-
-#include <sys/types.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-struct passwd {
-	char *pw_name;
-	uid_t pw_uid;
-	gid_t pw_gid;
-	char *pw_dir;
-	char *pw_shell;
-};
-
-extern struct passwd *getpwent(void);
-extern void setpwent(void);
-extern void endpwent(void);
-
-extern struct passwd *getpwnam(const char *name);
-extern int getpwnam_r(const char *name, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result);
-
-extern struct passwd *getpwuid(uid_t uid);
-extern int getpwuid_r(uid_t uid, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result);
-
-__C_DECLS_END;
-
-#endif /* POSIX_PWD_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/signal.h
===================================================================
--- uspace/lib/posix/include/posix/signal.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,231 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Signal handling.
- */
-
-#ifndef POSIX_SIGNAL_H_
-#define POSIX_SIGNAL_H_
-
-#include <sys/types.h>
-#include <ucontext.h>
-
-#define SIG_DFL ((void (*)(int)) __posix_default_signal_handler)
-#define SIG_ERR ((void (*)(int)) NULL)
-#define SIG_HOLD ((void (*)(int)) __posix_hold_signal_handler)
-#define SIG_IGN ((void (*)(int)) __posix_ignore_signal_handler)
-
-/* Values of sigevent::sigev_notify */
-#define SIGEV_NONE 0
-#define SIGEV_SIGNAL 0
-#define SIGEV_THREAD 0
-
-#define SIGRT_MIN 0
-#define SIGRT_MAX 0
-
-#define SIG_BLOCK 0
-#define SIG_UNBLOCK 1
-#define SIG_SETMASK 2
-
-#define SA_NOCLDSTOP (1 << 0)
-#define SA_ONSTACK (1 << 1)
-#define SA_RESETHAND (1 << 2)
-#define SA_RESTART (1 << 3)
-#define SA_SIGINFO (1 << 4)
-#define SA_NOCLDWAIT (1 << 5)
-#define SA_NODEFER (1 << 6)
-
-#define SS_ONSTACK 0
-#define SS_DISABLE 0
-
-#define MINSIGSTKSZ 0
-#define SIGSTKSZ 0
-
-__C_DECLS_BEGIN;
-
-extern void __posix_default_signal_handler(int signo);
-extern void __posix_hold_signal_handler(int signo);
-extern void __posix_ignore_signal_handler(int signo);
-
-typedef struct {
-	int si_signo;
-	int si_code;
-
-	int si_errno;
-
-	pid_t si_pid;
-	uid_t si_uid;
-	void *si_addr;
-	int si_status;
-
-	long si_band;
-
-	union sigval si_value;
-} siginfo_t;
-
-struct sigaction {
-	void (*sa_handler)(int);
-	sigset_t sa_mask;
-	int sa_flags;
-	void (*sa_sigaction)(int, siginfo_t *, void *);
-};
-
-/* Full POSIX set */
-enum {
-	/* Termination Signals */
-	SIGABRT,
-	SIGQUIT,
-	SIGINT,
-	SIGTERM,
-
-	/* Child Signal */
-	SIGCHLD,
-
-	/* User signals */
-	SIGUSR1,
-	SIGUSR2,
-
-	/* Timer */
-	SIGALRM,
-	SIGVTALRM,
-	SIGPROF, /* obsolete */
-
-	_TOP_CATCHABLE_SIGNAL = SIGPROF,
-
-	/* Process Scheduler Interaction - not supported */
-	SIGSTOP,
-	SIGCONT,
-
-	/* Process Termination - can't be caught */
-	SIGKILL,
-
-	_TOP_SENDABLE_SIGNAL = SIGKILL,
-
-	/* Hardware Exceptions - can't be caught or sent */
-	SIGFPE,
-	SIGBUS,
-	SIGILL,
-	SIGSEGV,
-
-	/* Other Exceptions - not supported */
-	SIGSYS,
-	SIGXCPU,
-	SIGXFSZ,
-
-	/* Debugging - not supported */
-	SIGTRAP,
-
-	/* Communication Signals - not supported */
-	SIGHUP,
-	SIGPIPE,
-	SIGPOLL, /* obsolete */
-	SIGURG,
-
-	/* Terminal Signals - not supported */
-	SIGTSTP,
-	SIGTTIN,
-	SIGTTOU,
-
-	_TOP_SIGNAL = SIGTTOU
-};
-
-/* Values for sigaction field si_code. */
-enum {
-	SI_USER,
-	SI_QUEUE,
-	SI_TIMER,
-	SI_ASYNCIO,
-	SI_MESGQ,
-	ILL_ILLOPC,
-	ILL_ILLOPN,
-	ILL_ILLADR,
-	ILL_ILLTRP,
-	ILL_PRVOPC,
-	ILL_PRVREG,
-	ILL_COPROC,
-	ILL_BADSTK,
-	FPE_INTDIV,
-	FPE_INTOVF,
-	FPE_FLTDIV,
-	FPE_FLTOVF,
-	FPE_FLTUND,
-	FPE_FLTRES,
-	FPE_FLTINV,
-	FPE_FLTSUB,
-	SEGV_MAPERR,
-	SEGV_ACCERR,
-	BUS_ADRALN,
-	BUS_ADRERR,
-	BUS_OBJERR,
-	TRAP_BRKPT,
-	TRAP_TRACE,
-	CLD_EXITED,
-	CLD_KILLED,
-	CLD_DUMPED,
-	CLD_TRAPPED,
-	CLD_STOPPED,
-	CLD_CONTINUED,
-	POLL_IN,
-	POLL_OUT,
-	POLL_MSG,
-	POLL_ERR,
-	POLL_PRI,
-	POLL_HUP
-};
-
-extern int sigaction(int sig, const struct sigaction *__restrict__ act,
-    struct sigaction *__restrict__ oact);
-
-extern void (*signal(int sig, void (*func)(int)))(int);
-extern int raise(int sig);
-extern int kill(pid_t pid, int sig);
-extern int killpg(pid_t pid, int sig);
-
-extern void psiginfo(const siginfo_t *pinfo, const char *message);
-extern void psignal(int signum, const char *message);
-
-extern int sigemptyset(sigset_t *set);
-extern int sigfillset(sigset_t *set);
-extern int sigaddset(sigset_t *set, int signo);
-extern int sigdelset(sigset_t *set, int signo);
-extern int sigismember(const sigset_t *set, int signo);
-
-extern int thread_sigmask(int how, const sigset_t *__restrict__ set,
-    sigset_t *__restrict__ oset);
-extern int sigprocmask(int how, const sigset_t *__restrict__ set,
-    sigset_t *__restrict__ oset);
-
-__C_DECLS_END;
-
-#endif /* POSIX_SIGNAL_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/stdio.h
===================================================================
--- uspace/lib/posix/include/posix/stdio.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard buffered input/output.
- */
-
-#ifndef POSIX_STDIO_H_
-#define POSIX_STDIO_H_
-
-#include <libc/stdio.h>
-
-#include <stddef.h>
-#include <io/verify.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <limits.h>
-
-#define P_tmpdir "/tmp"
-
-#define L_ctermid PATH_MAX
-
-__C_DECLS_BEGIN;
-
-extern FILE *fdopen(int, const char *);
-extern int fileno(FILE *);
-
-/* Identifying the Terminal */
-extern char *ctermid(char *s);
-
-/* Input/Output */
-extern ssize_t getdelim(char **__restrict__ lineptr, size_t *__restrict__ n,
-    int delimiter, FILE *__restrict__ stream);
-extern ssize_t getline(char **__restrict__ lineptr, size_t *__restrict__ n,
-    FILE *__restrict__ stream);
-
-#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
-extern int fseeko64(FILE *stream, off64_t offset, int whence);
-extern off64_t ftello64(FILE *stream);
-#endif
-
-#if _FILE_OFFSET_BITS == 64 && LONG_MAX == INT_MAX
-#ifdef __GNUC__
-extern int fseeko(FILE *stream, off_t offset, int whence) __asm__("fseeko64");
-extern off_t ftello(FILE *stream) __asm__("ftello64");
-#else
-extern int fseeko64(FILE *stream, off_t offset, int whence);
-extern off_t ftello64(FILE *stream);
-#define fseeko fseeko64
-#define ftello ftello64
-#endif
-#else
-extern int fseeko(FILE *stream, off_t offset, int whence);
-extern off_t ftello(FILE *stream);
-#endif
-
-/* Formatted Output */
-extern int dprintf(int fildes, const char *__restrict__ format, ...)
-    _HELENOS_PRINTF_ATTRIBUTE(2, 3);
-extern int vdprintf(int fildes, const char *__restrict__ format, va_list ap);
-
-/* File Locking */
-extern void flockfile(FILE *file);
-extern int ftrylockfile(FILE *file);
-extern void funlockfile(FILE *file);
-extern int getc_unlocked(FILE *stream);
-extern int getchar_unlocked(void);
-extern int putc_unlocked(int c, FILE *stream);
-extern int putchar_unlocked(int c);
-
-/* Temporary Files */
-extern char *tempnam(const char *dir, const char *pfx);
-
-__C_DECLS_END;
-
-#endif /* POSIX_STDIO_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/stdlib.h
===================================================================
--- uspace/lib/posix/include/posix/stdlib.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard library definitions.
- */
-
-#ifndef POSIX_STDLIB_H_
-#define POSIX_STDLIB_H_
-
-#include <common/stdlib.h>
-#include <sys/types.h>
-
-#include <stddef.h>
-
-__C_DECLS_BEGIN;
-
-/* Environment Access */
-extern int putenv(char *string);
-
-/* Symbolic Links */
-extern char *realpath(const char *__restrict__ name, char *__restrict__ resolved);
-
-/* Floating Point Conversion */
-extern double atof(const char *nptr);
-extern float strtof(const char *__restrict__ nptr, char **__restrict__ endptr);
-extern double strtod(const char *__restrict__ nptr, char **__restrict__ endptr);
-
-/* Temporary Files */
-extern int mkstemp(char *tmpl);
-
-/* Legacy Declarations */
-extern char *mktemp(char *tmpl) __attribute__((deprecated));
-extern int bsd_getloadavg(double loadavg[], int nelem);
-
-__C_DECLS_END;
-
-#endif  // POSIX_STDLIB_H_
-
-/** @}
- */
Index: pace/lib/posix/include/posix/string.h
===================================================================
--- uspace/lib/posix/include/posix/string.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file String manipulation.
- */
-
-#ifndef POSIX_STRING_H_
-#define POSIX_STRING_H_
-/*
- * TODO: not implemented due to missing locale support
- *
- * int      strcoll_l(const char *, const char *, locale_t);
- * char    *strerror_l(int, locale_t);
- * size_t   strxfrm_l(char *__restrict__, const char *__restrict__, size_t, locale_t);
- */
-
-#include <stddef.h>
-
-#include <common/mem.h>
-
-#define _REALLY_WANT_STRING_H
-#include <libc/string.h>
-
-__C_DECLS_BEGIN;
-
-/* Copying and Concatenation */
-extern char *stpcpy(char *__restrict__ dest, const char *__restrict__ src);
-extern char *stpncpy(char *__restrict__ dest, const char *__restrict__ src, size_t n);
-extern void *memccpy(void *__restrict__ dest, const void *__restrict__ src, int c, size_t n);
-
-/* Search Functions */
-extern char *gnu_strchrnul(const char *s, int c);
-
-/* Tokenization functions. */
-extern char *strtok_r(char *, const char *, char **);
-
-/* Error Messages */
-extern int strerror_r(int errnum, char *buf, size_t bufsz);
-
-/* Signal Messages */
-extern char *strsignal(int signum);
-
-/* Legacy Declarations */
-extern int ffs(int i);
-extern int strcasecmp(const char *s1, const char *s2);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
-
-__C_DECLS_END;
-
-#endif  // POSIX_STRING_H_
-
-/** @}
- */
Index: pace/lib/posix/include/posix/strings.h
===================================================================
--- uspace/lib/posix/include/posix/strings.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Additional string manipulation.
- */
-
-#ifndef POSIX_STRINGS_H_
-#define POSIX_STRINGS_H_
-
-#include <types/common.h>
-
-__C_DECLS_BEGIN;
-
-/* Search Functions */
-extern int ffs(int i);
-
-/* String/Array Comparison */
-extern int strcasecmp(const char *s1, const char *s2);
-extern int strncasecmp(const char *s1, const char *s2, size_t n);
-
-/*
- * TODO: not implemented due to missing locale support
- *
- * int strcasecmp_l(const char *, const char *, locale_t);
- * int strncasecmp_l(const char *, const char *, size_t, locale_t);
- */
-
-/* Legacy Functions */
-extern int bcmp(const void *mem1, const void *mem2, size_t n);
-extern void bcopy(const void *src, void *dest, size_t n);
-extern void bzero(void *mem, size_t n);
-extern char *index(const char *s, int c);
-extern char *rindex(const char *s, int c);
-
-__C_DECLS_END;
-
-#endif  // POSIX_STRINGS_H_
-
-/** @}
- */
Index: pace/lib/posix/include/posix/sys/mman.h
===================================================================
--- uspace/lib/posix/include/posix/sys/mman.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Memory management declarations.
- */
-
-#ifndef POSIX_SYS_MMAN_H_
-#define POSIX_SYS_MMAN_H_
-
-#include <sys/types.h>
-#include <_bits/decls.h>
-
-#define MAP_FAILED  ((void *) -1)
-
-#define MAP_SHARED     (1 << 0)
-#define MAP_PRIVATE    (1 << 1)
-#define MAP_FIXED      (1 << 2)
-#define MAP_ANONYMOUS  (1 << 3)
-#define MAP_ANON       MAP_ANONYMOUS
-
-#define PROT_NONE   0
-#define PROT_READ   1
-#define PROT_WRITE  2
-#define PROT_EXEC   4
-
-__C_DECLS_BEGIN;
-
-extern void *mmap(void *start, size_t length, int prot, int flags, int fd,
-    off_t offset);
-extern int munmap(void *start, size_t length);
-
-__C_DECLS_END;
-
-#endif /* POSIX_SYS_MMAN_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/sys/stat.h
===================================================================
--- uspace/lib/posix/include/posix/sys/stat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File status handling.
- */
-
-#ifndef POSIX_SYS_STAT_H_
-#define POSIX_SYS_STAT_H_
-
-#include <sys/types.h>
-#include <time.h>
-#include <_bits/decls.h>
-
-/* values are the same as on Linux */
-
-#define S_IFMT     0170000   /* all file types */
-#define S_IFSOCK   0140000   /* socket */
-#define S_IFLNK    0120000   /* symbolic link */
-#define S_IFREG    0100000   /* regular file */
-#define S_IFBLK    0060000   /* block device */
-#define S_IFDIR    0040000   /* directory */
-#define S_IFCHR    0020000   /* character device */
-#define S_IFIFO    0010000   /* FIFO */
-
-#define S_ISUID    0004000   /* SUID */
-#define S_ISGID    0002000   /* SGID */
-#define S_ISVTX    0001000   /* sticky */
-
-#define S_IRWXU    00700     /* owner permissions */
-#define S_IRUSR    00400
-#define S_IWUSR    00200
-#define S_IXUSR    00100
-
-#define S_IRWXG    00070     /* group permissions */
-#define S_IRGRP    00040
-#define S_IWGRP    00020
-#define S_IXGRP    00010
-
-#define S_IRWXO    00007     /* other permissions */
-#define S_IROTH    00004
-#define S_IWOTH    00002
-#define S_IXOTH    00001
-
-#define S_ISREG(m) ((m & S_IFREG) != 0)
-#define S_ISDIR(m) ((m & S_IFDIR) != 0)
-#define S_ISCHR(m) ((m & S_IFCHR) != 0)
-#define S_ISBLK(m) ((m & S_IFBLK) != 0)
-#define S_ISFIFO(m) ((m & S_IFIFO) != 0)
-#define S_ISLNK(m) ((m & S_IFLNK) != 0) /* symbolic link? (Not in POSIX.1-1996.) */
-#define S_ISSOCK(m) ((m & S_IFSOCK) != 0) /* socket? (Not in POSIX.1-1996.) */
-
-__C_DECLS_BEGIN;
-
-struct stat {
-	dev_t     st_dev;     /* ID of device containing file */
-	ino_t     st_ino;     /* inode number */
-	mode_t    st_mode;    /* protection */
-	nlink_t   st_nlink;   /* number of hard links */
-	uid_t     st_uid;     /* user ID of owner */
-	gid_t     st_gid;     /* group ID of owner */
-	dev_t     st_rdev;    /* device ID (if special file) */
-	off_t     st_size;    /* total size, in bytes */
-	blksize_t st_blksize; /* blocksize for file system I/O */
-	blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
-	time_t          st_atime;   /* time of last access */
-	time_t          st_mtime;   /* time of last modification */
-	time_t          st_ctime;   /* time of last status change */
-};
-
-extern int fstat(int fd, struct stat *st);
-extern int lstat(const char *__restrict__ path, struct stat *__restrict__ st);
-extern int stat(const char *__restrict__ path, struct stat *__restrict__ st);
-extern int chmod(const char *path, mode_t mode);
-extern mode_t umask(mode_t mask);
-extern int mkdir(const char *path, mode_t mode);
-
-__C_DECLS_END;
-
-#endif /* POSIX_SYS_STAT_H */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/sys/time.h
===================================================================
--- uspace/lib/posix/include/posix/sys/time.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2017 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-
-#ifndef POSIX_SYS_TIME_H_
-#define POSIX_SYS_TIME_H_
-
-#include <time.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-struct timeval {
-	time_t tv_sec;        /* seconds */
-	suseconds_t tv_usec;  /* microseconds */
-};
-
-extern int gettimeofday(struct timeval *, void *);
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/include/posix/sys/types.h
===================================================================
--- uspace/lib/posix/include/posix/sys/types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Data types definitions.
- */
-
-#ifndef POSIX_SYS_TYPES_H_
-#define POSIX_SYS_TYPES_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <_bits/ssize_t.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-typedef unsigned int ino_t;
-typedef unsigned int nlink_t;
-typedef unsigned int uid_t;
-typedef unsigned int gid_t;
-typedef long blksize_t;
-typedef long blkcnt_t;
-typedef int pid_t;
-typedef unsigned long dev_t;
-typedef unsigned int mode_t;
-
-#if _FILE_OFFSET_BITS == 64
-typedef int64_t off_t;
-#else
-typedef long off_t;
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
-typedef int64_t off64_t;
-#endif
-
-/* PThread Types */
-typedef struct thread_attr thread_attr_t;
-
-/* Clock Types */
-typedef int clockid_t;
-
-typedef long suseconds_t;
-
-__C_DECLS_END;
-
-#endif /* POSIX_SYS_TYPES_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/sys/wait.h
===================================================================
--- uspace/lib/posix/include/posix/sys/wait.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Support for waiting.
- */
-
-#ifndef POSIX_SYS_WAIT_H_
-#define POSIX_SYS_WAIT_H_
-
-#include <sys/types.h>
-#include <_bits/decls.h>
-
-#define WIFEXITED(status) __posix_wifexited(status)
-#define WEXITSTATUS(status) __posix_wexitstatus(status)
-#define WIFSIGNALED(status) __posix_wifsignaled(status)
-#define WTERMSIG(status) __posix_wtermsig(status)
-
-__C_DECLS_BEGIN;
-
-extern int __posix_wifexited(int status);
-extern int __posix_wexitstatus(int status);
-extern int __posix_wifsignaled(int status);
-extern int __posix_wtermsig(int status);
-
-extern pid_t wait(int *stat_ptr);
-extern pid_t waitpid(pid_t pid, int *stat_ptr, int options);
-
-__C_DECLS_END;
-
-#endif /* POSIX_SYS_WAIT_H_ */
-
-/** @}
- */
Index: pace/lib/posix/include/posix/time.h
===================================================================
--- uspace/lib/posix/include/posix/time.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Time measurement support.
- */
-
-#ifndef POSIX_TIME_H_
-#define POSIX_TIME_H_
-
-#include <stddef.h>
-#include <sys/types.h>
-#include <libc/time.h>
-
-#define CLOCK_REALTIME ((clockid_t) 0)
-
-#define ASCTIME_BUF_LEN  26
-
-__C_DECLS_BEGIN;
-
-#ifndef __locale_t_defined
-#define __locale_t_defined
-typedef struct __posix_locale *locale_t;
-#endif
-
-struct sigevent;
-
-struct itimerspec {
-	struct timespec it_interval; /* Timer period. */
-	struct timespec it_value; /* Timer expiration. */
-};
-
-typedef struct __posix_timer *timer_t;
-
-/* Timezones */
-extern int daylight;
-extern long timezone;
-extern char *tzname[2];
-extern void tzset(void);
-
-/* Time */
-extern time_t time(time_t *t);
-
-/* Broken-down Time */
-extern struct tm *gmtime_r(const time_t *__restrict__ timer,
-    struct tm *__restrict__ result);
-extern struct tm *gmtime(const time_t *__restrict__ timep);
-extern struct tm *localtime_r(const time_t *__restrict__ timer,
-    struct tm *__restrict__ result);
-extern struct tm *localtime(const time_t *__restrict__ timep);
-
-/* Formatting Calendar Time */
-extern char *asctime_r(const struct tm *__restrict__ timeptr,
-    char *__restrict__ buf);
-extern char *asctime(const struct tm *__restrict__ timeptr);
-extern char *ctime_r(const time_t *timer, char *buf);
-extern char *ctime(const time_t *timer);
-extern time_t time(time_t *t);
-
-/* Clocks */
-extern int clock_getres(clockid_t clock_id,
-    struct timespec *res);
-extern int clock_gettime(clockid_t clock_id,
-    struct timespec *tp);
-extern int clock_settime(clockid_t clock_id,
-    const struct timespec *tp);
-extern int clock_nanosleep(clockid_t clock_id, int flags,
-    const struct timespec *rqtp, struct timespec *rmtp);
-
-__C_DECLS_END;
-
-#endif  // POSIX_TIME_H_
-
-/** @}
- */
Index: pace/lib/posix/include/posix/ucontext.h
===================================================================
--- uspace/lib/posix/include/posix/ucontext.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Userspace context handling.
- */
-
-#ifndef POSIX_UCONTEXT_H_
-#define POSIX_UCONTEXT_H_
-
-#include <sys/types.h>
-#include <_bits/decls.h>
-
-__C_DECLS_BEGIN;
-
-typedef int sig_atomic_t;
-typedef uint32_t sigset_t;
-typedef struct mcontext {
-	/* must not be empty to avoid compiler warnings (-pedantic) */
-	int dummy;
-} mcontext_t;
-
-union sigval {
-	int sival_int;
-	void *sival_ptr;
-};
-
-struct sigevent {
-	int sigev_notify; /* Notification type. */
-	int sigev_signo; /* Signal number. */
-	union sigval sigev_value; /* Signal value. */
-	void (*sigev_notify_function)(union sigval); /* Notification function. */
-	thread_attr_t *sigev_notify_attributes; /* Notification attributes. */
-};
-
-typedef struct {
-	void *ss_sp;
-	size_t ss_size;
-	int ss_flags;
-} stack_t;
-
-typedef struct ucontext {
-	struct ucontext *uc_link;
-	sigset_t uc_sigmask;
-	stack_t uc_stack;
-	mcontext_t uc_mcontext;
-} ucontext_t;
-
-__C_DECLS_END;
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/include/posix/unistd.h
===================================================================
--- uspace/lib/posix/include/posix/unistd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Miscellaneous standard definitions.
- */
-
-#ifndef POSIX_UNISTD_H_
-#define POSIX_UNISTD_H_
-
-#include <stddef.h>
-#include <sys/types.h>
-
-#define SEEK_SET  0
-#define SEEK_CUR  1
-#define SEEK_END  2
-
-/* Process Termination */
-#define _exit exit
-
-/* Standard Streams */
-#define STDIN_FILENO (fileno(stdin))
-#define STDOUT_FILENO (fileno(stdout))
-#define STDERR_FILENO (fileno(stderr))
-
-#define	F_OK 0 /* Test for existence. */
-#define	X_OK 1 /* Test for execute permission. */
-#define	W_OK 2 /* Test for write permission. */
-#define	R_OK 4 /* Test for read permission. */
-
-__C_DECLS_BEGIN;
-
-extern char *optarg;
-extern int optind, opterr, optopt;
-extern int getopt(int, char *const [], const char *);
-
-/* Environment */
-extern char **environ;
-
-/* Sleeping */
-extern unsigned int sleep(unsigned int);
-
-/* Login Information */
-extern char *getlogin(void);
-extern int getlogin_r(char *name, size_t namesize);
-
-/* Identifying Terminals */
-extern int isatty(int fd);
-
-/* Working Directory */
-extern char *getcwd(char *buf, size_t size);
-extern int chdir(const char *path);
-
-/* Query Memory Parameters */
-extern int getpagesize(void);
-
-/* Process Identification */
-extern pid_t getpid(void);
-extern uid_t getuid(void);
-extern gid_t getgid(void);
-
-/* File Manipulation */
-extern int close(int fildes);
-extern ssize_t read(int fildes, void *buf, size_t nbyte);
-extern ssize_t write(int fildes, const void *buf, size_t nbyte);
-extern int fsync(int fildes);
-extern int rmdir(const char *path);
-extern int unlink(const char *path);
-extern int dup(int fildes);
-extern int dup2(int fildes, int fildes2);
-
-#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
-// FIXME: this should just be defined in <sys/types.h>, but for some reason
-//        build of coastline binutils on mips32 doesn't see the definition there
-typedef int64_t off64_t;
-
-extern off64_t lseek64(int fildes, off64_t offset, int whence);
-extern int ftruncate64(int fildes, off64_t length);
-#endif
-
-#if _FILE_OFFSET_BITS == 64 && LONG_MAX == INT_MAX
-#ifdef __GNUC__
-extern off_t lseek(int fildes, off_t offset, int whence) __asm__("lseek64");
-extern int ftruncate(int fildes, off_t length) __asm__("ftruncate64");
-#else
-extern off_t lseek64(int fildes, off_t offset, int whence);
-extern int ftruncate64(int fildes, off_t length);
-#define lseek lseek64
-#define ftruncate ftruncate64
-#endif
-#else
-extern off_t lseek(int fildes, off_t offset, int whence);
-extern int ftruncate(int fildes, off_t length);
-#endif
-
-/* File Accessibility */
-extern int access(const char *path, int amode);
-
-/* System Parameters */
-enum {
-	_SC_PHYS_PAGES,
-	_SC_AVPHYS_PAGES,
-	_SC_PAGESIZE,
-	_SC_CLK_TCK
-};
-extern long sysconf(int name);
-
-/* Path Configuration Parameters */
-enum {
-	_PC_2_SYMLINKS,
-	_PC_ALLOC_SIZE_MIN,
-	_PC_ASYNC_IO,
-	_PC_CHOWN_RESTRICTED,
-	_PC_FILESIZEBITS,
-	_PC_LINK_MAX,
-	_PC_MAX_CANON,
-	_PC_MAX_INPUT,
-	_PC_NAME_MAX,
-	_PC_NO_TRUNC,
-	_PC_PATH_MAX,
-	_PC_PIPE_BUF,
-	_PC_PRIO_IO,
-	_PC_REC_INCR_XFER_SIZE,
-	_PC_REC_MIN_XFER_SIZE,
-	_PC_REC_XFER_ALIGN,
-	_PC_SYMLINK_MAX,
-	_PC_SYNC_IO,
-	_PC_VDISABLE
-};
-extern long pathconf(const char *path, int name);
-
-/* Creating a Process */
-extern pid_t fork(void);
-
-/* Executing a File */
-extern int execv(const char *path, char *const argv[]);
-extern int execvp(const char *file, char *const argv[]);
-
-/* Creating a Pipe */
-extern int pipe(int fildes[2]);
-
-/* Issue alarm signal. */
-extern unsigned int alarm(unsigned int);
-
-__C_DECLS_END;
-
-#endif /* POSIX_UNISTD_H_ */
-
-/** @}
- */
Index: pace/lib/posix/meson.build
===================================================================
--- uspace/lib/posix/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#
-# Copyright (c) 2011 Petr Koupy
-# Copyright (c) 2011 Jiri Zarevucky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-includes += include_directories('include/posix', 'include')
-c_args += [ '-fno-builtin', '-D_XOPEN_SOURCE' ]
-
-# TODO
-
-src = files(
-	'src/ctype.c',
-	'src/dlfcn.c',
-	'src/fcntl.c',
-	'src/fnmatch.c',
-	'src/locale.c',
-	'src/pthread/condvar.c',
-	'src/pthread/keys.c',
-	'src/pthread/mutex.c',
-	'src/pthread/threads.c',
-	'src/pwd.c',
-	'src/signal.c',
-	'src/stdio.c',
-	'src/stdlib.c',
-	'src/string.c',
-	'src/strings.c',
-	'src/sys/mman.c',
-	'src/sys/stat.c',
-	'src/sys/wait.c',
-	'src/time.c',
-	'src/unistd.c',
-)
-
-test_src = files(
-	'test/main.c',
-	'test/stdio.c',
-	'test/stdlib.c',
-	'test/unistd.c',
-	'test/pthread/keys.c',
-)
-
-_sdir = meson.current_source_dir() / 'include' / 'posix'
-uspace_lib_devel_install_script_text += 'mkdir -p "${DESTDIR}include/libposix"'
-uspace_lib_devel_install_script_text += 'cp -R -L -T "@0@" "${DESTDIR}include/libposix"'.format(_sdir)
-uspace_lib_devel_install_script_text += 'ln -s -r "${DESTDIR}include/libc" "${DESTDIR}/include/common"'
-
-exported_devel_files += [ 'include', meson.current_source_dir() / 'include' / 'posix', 'libposix' ]
-exported_devel_files += [ 'includesymlink', 'libc', 'libposix' ]
Index: pace/lib/posix/src/ctype.c
===================================================================
--- uspace/lib/posix/src/ctype.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Character classification.
- */
-
-#include <ctype.h>
-
-/**
- * Checks whether character is ASCII. (obsolete)
- *
- * @param c Character to inspect.
- * @return Non-zero if character match the definition, zero otherwise.
- */
-int isascii(int c)
-{
-	return c >= 0 && c < 128;
-}
-
-/**
- * Converts argument to a 7-bit ASCII character. (obsolete)
- *
- * @param c Character to convert.
- * @return Coverted character.
- */
-int toascii(int c)
-{
-	return c & 0x7F;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/dlfcn.c
===================================================================
--- uspace/lib/posix/src/dlfcn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2017 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-
-#include "internal/common.h"
-#include <dlfcn.h>
-
-int dlclose(void *handle)
-{
-	not_implemented();
-	return 0;
-}
-
-char *dlerror(void)
-{
-	not_implemented();
-	return (char *)"dlerror()";
-}
-
-/** @}
- */
Index: pace/lib/posix/src/fcntl.c
===================================================================
--- uspace/lib/posix/src/fcntl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File control.
- */
-
-#include "internal/common.h"
-#include <fcntl.h>
-#include <vfs/vfs.h>
-#include <errno.h>
-
-/**
- * Performs set of operations on the opened files.
- *
- * @param fd File descriptor of the opened file.
- * @param cmd Operation to carry out.
- * @return Non-negative on success. Might have special meaning corresponding
- *     to the requested operation.
- */
-int fcntl(int fd, int cmd, ...)
-{
-	int flags;
-
-	switch (cmd) {
-	case F_DUPFD:
-	case F_DUPFD_CLOEXEC:
-		/*
-		 * VFS currently does not provide the functionality to duplicate
-		 * opened file descriptor.
-		 */
-		// FIXME: implement this once dup() is available
-		errno = ENOTSUP;
-		return -1;
-	case F_GETFD:
-		/* FD_CLOEXEC is not supported. There are no other flags. */
-		return 0;
-	case F_SETFD:
-		/* FD_CLOEXEC is not supported. Ignore arguments and report success. */
-		return 0;
-	case F_GETFL:
-		/*
-		 * File status flags (i.e. O_APPEND) are currently private to the
-		 * VFS server so it cannot be easily retrieved.
-		 */
-		flags = 0;
-		/*
-		 * File access flags are currently not supported for file descriptors.
-		 * Provide full access.
-		 */
-		flags |= O_RDWR;
-		return flags;
-	case F_SETFL:
-		/*
-		 * File access flags are currently not supported for file descriptors.
-		 * Ignore arguments and report success.
-		 */
-		return 0;
-	case F_GETOWN:
-	case F_SETOWN:
-	case F_GETLK:
-	case F_SETLK:
-	case F_SETLKW:
-		/* Signals (SIGURG) and file locks are not supported. */
-		errno = ENOTSUP;
-		return -1;
-	default:
-		/* Unknown command */
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Open, possibly create, a file.
- *
- * @param pathname Path to the file.
- * @param posix_flags Access mode flags.
- */
-int open(const char *pathname, int posix_flags, ...)
-{
-	mode_t posix_mode = 0;
-	if (posix_flags & O_CREAT) {
-		va_list args;
-		va_start(args, posix_flags);
-		posix_mode = va_arg(args, mode_t);
-		va_end(args);
-		(void) posix_mode;
-	}
-
-	if (((posix_flags & (O_RDONLY | O_WRONLY | O_RDWR)) == 0) ||
-	    ((posix_flags & (O_RDONLY | O_WRONLY)) == (O_RDONLY | O_WRONLY)) ||
-	    ((posix_flags & (O_RDONLY | O_RDWR)) == (O_RDONLY | O_RDWR)) ||
-	    ((posix_flags & (O_WRONLY | O_RDWR)) == (O_WRONLY | O_RDWR))) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	int flags = WALK_REGULAR;
-	if (posix_flags & O_CREAT) {
-		if (posix_flags & O_EXCL)
-			flags |= WALK_MUST_CREATE;
-		else
-			flags |= WALK_MAY_CREATE;
-	}
-
-	int mode =
-	    ((posix_flags & O_RDWR) ? MODE_READ | MODE_WRITE : 0) |
-	    ((posix_flags & O_RDONLY) ? MODE_READ : 0) |
-	    ((posix_flags & O_WRONLY) ? MODE_WRITE : 0) |
-	    ((posix_flags & O_APPEND) ? MODE_APPEND : 0);
-
-	int file;
-
-	if (failed(vfs_lookup(pathname, flags, &file)))
-		return -1;
-
-	if (failed(vfs_open(file, mode))) {
-		vfs_put(file);
-		return -1;
-	}
-
-	if (posix_flags & O_TRUNC) {
-		if (posix_flags & (O_RDWR | O_WRONLY)) {
-			if (failed(vfs_resize(file, 0))) {
-				vfs_put(file);
-				return -1;
-			}
-		}
-	}
-
-	return file;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/fnmatch.c
===================================================================
--- uspace/lib/posix/src/fnmatch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,720 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Filename-matching.
- */
-
-/*
- * This file contains an implementation of the fnmatch() pattern matching
- * function. There is more code than necessary to account for the possibility
- * of adding POSIX-like locale support to the system in the future. Functions
- * that are only necessary for locale support currently simply use single
- * characters for "collation elements".
- * When (or if) locales are properly implemented, extending this implementation
- * will be fairly straightforward.
- */
-
-#include <stdbool.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "internal/common.h"
-#include <fnmatch.h>
-
-/* Returned by _match... functions. */
-#define INVALID_PATTERN -1
-
-/*
- * Type for collating element, simple identity with characters now,
- * but may be extended for better locale support.
- */
-typedef int coll_elm_t;
-
-/** Return value indicating that the element in question
- * is not valid in the current locale. (That is, if locales are supported.)
- */
-#define COLL_ELM_INVALID -1
-
-/**
- * Get collating element matching a string.
- *
- * @param str String representation of the element.
- * @return Matching collating element or COLL_ELM_INVALID.
- */
-static coll_elm_t _coll_elm_get(const char *str)
-{
-	if (str[0] == '\0' || str[1] != '\0') {
-		return COLL_ELM_INVALID;
-	}
-	return str[0];
-}
-
-/**
- * Get collating element matching a single character.
- *
- * @param c Character representation of the element.
- * @return Matching collating element.
- */
-static coll_elm_t _coll_elm_char(int c)
-{
-	return c;
-}
-
-/**
- * Match collating element with a beginning of a string.
- *
- * @param elm Collating element to match.
- * @param str String which beginning should match the element.
- * @return 0 if the element doesn't match, or the number of characters matched.
- */
-static int _coll_elm_match(coll_elm_t elm, const char *str)
-{
-	return elm == *str;
-}
-
-/**
- * Checks whether a string begins with a collating element in the given range.
- * Ordering depends on the locale (if locales are supported).
- *
- * @param first First element of the range.
- * @param second Last element of the range.
- * @param str String to match.
- * @return 0 if there is no match, or the number of characters matched.
- */
-static int _coll_elm_between(coll_elm_t first, coll_elm_t second,
-    const char *str)
-{
-	return *str >= first && *str <= second;
-}
-
-/**
- * Read a string delimited by [? and ?].
- *
- * @param pattern Pointer to the string to read from. Its position is moved
- *    to the first character after the closing ].
- * @param seq The character on the inside of brackets.
- * @param buf Read buffer.
- * @param buf_sz Read buffer's size. If the buffer is not large enough for
- *    the entire string, the string is cut with no error indication.
- * @param flags Flags modifying the behavior.
- * @return True on success, false if the pattern is invalid.
- */
-static bool _get_delimited(
-    const char **pattern, int seq,
-    char *buf, size_t buf_sz, int flags)
-{
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-
-	const char *p = *pattern;
-	assert(p[0] == '[' && p[1] == seq /* Caller should ensure this. */);
-	p += 2;
-
-	while (true) {
-		if (*p == seq && *(p + 1) == ']') {
-			/* String properly ended, return. */
-			*pattern = p + 2;
-			*buf = '\0';
-			return true;
-		}
-		if (!noescape && *p == '\\') {
-			p++;
-		}
-		if (*p == '\0') {
-			/* String not ended properly, invalid pattern. */
-			return false;
-		}
-		if (pathname && *p == '/') {
-			/* Slash in a pathname pattern is invalid. */
-			return false;
-		}
-		if (buf_sz > 1) {
-			/* Only add to the buffer if there is space. */
-			*buf = *p;
-			buf++;
-			buf_sz--;
-		}
-		p++;
-	}
-}
-
-/*
- * CHARACTER CLASSES
- */
-
-#define MAX_CLASS_OR_COLL_LEN 6
-
-struct _char_class {
-	const char *name;
-	int (*func) (int);
-};
-
-/* List of supported character classes. */
-static const struct _char_class _char_classes[] = {
-	{ "alnum", isalnum },
-	{ "alpha", isalpha },
-	{ "blank", isblank },
-	{ "cntrl", iscntrl },
-	{ "digit", isdigit },
-	{ "graph", isgraph },
-	{ "lower", islower },
-	{ "print", isprint },
-	{ "punct", ispunct },
-	{ "space", isspace },
-	{ "upper", isupper },
-	{ "xdigit", isxdigit }
-};
-
-/**
- * Compare function for binary search in the _char_classes array.
- *
- * @param key Key of the searched element.
- * @param elem Element of _char_classes array.
- * @return Ordering indicator (-1 less than, 0 equal, 1 greater than).
- */
-static int _class_compare(const void *key, const void *elem)
-{
-	const struct _char_class *class = elem;
-	return strcmp((const char *) key, class->name);
-}
-
-/**
- * Returns whether the given character belongs to the specified character class.
- *
- * @param cname Name of the character class.
- * @param c Character.
- * @return True if the character belongs to the class, false otherwise.
- */
-static bool _is_in_class (const char *cname, int c)
-{
-	/* Search for class in the array of supported character classes. */
-	const struct _char_class *class = bsearch(cname, _char_classes,
-	    sizeof(_char_classes) / sizeof(struct _char_class),
-	    sizeof(struct _char_class), _class_compare);
-
-	if (class == NULL) {
-		/* No such class supported - treat as an empty class. */
-		return false;
-	} else {
-		/* Class matched. */
-		return class->func(c);
-	}
-}
-
-/**
- * Tries to parse an initial part of the pattern as a character class pattern,
- * and if successful, matches the beginning of the given string against the class.
- *
- * @param pattern Pointer to the pattern to match. Must begin with a class
- *    specifier and is repositioned to the first character after the specifier
- *    if successful.
- * @param str String to match.
- * @param flags Flags modifying the behavior (see fnmatch()).
- * @return INVALID_PATTERN if the pattern doesn't start with a valid class
- *    specifier, 0 if the beginning of the matched string doesn't belong
- *    to the class, or positive number of characters matched.
- */
-static int _match_char_class(const char **pattern, const char *str, int flags)
-{
-	char class[MAX_CLASS_OR_COLL_LEN + 1];
-
-	if (!_get_delimited(pattern, ':', class, sizeof(class), flags)) {
-		return INVALID_PATTERN;
-	}
-
-	return _is_in_class(class, *str);
-}
-
-/*
- * END CHARACTER CLASSES
- */
-
-/**
- * Reads the next collating element in the pattern, taking into account
- * locale (if supported) and flags (see fnmatch()).
- *
- * @param pattern Pattern.
- * @param flags Flags given to fnmatch().
- * @return Collating element on success,
- *     or COLL_ELM_INVALID if the pattern is invalid.
- */
-static coll_elm_t _next_coll_elm(const char **pattern, int flags)
-{
-	assert(pattern != NULL);
-	assert(*pattern != NULL);
-	assert(**pattern != '\0');
-
-	const char *p = *pattern;
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-
-	if (*p == '[') {
-		if (*(p + 1) == '.') {
-			char buf[MAX_CLASS_OR_COLL_LEN + 1];
-			if (!_get_delimited(pattern, '.', buf, sizeof(buf), flags)) {
-				return COLL_ELM_INVALID;
-			}
-			return _coll_elm_get(buf);
-		}
-
-		if (*(p + 1) == '=') {
-			char buf[MAX_CLASS_OR_COLL_LEN + 1];
-			if (!_get_delimited(pattern, '=', buf, sizeof(buf), flags)) {
-				return COLL_ELM_INVALID;
-			}
-			return _coll_elm_get(buf);
-		}
-	}
-
-	if (!noescape && *p == '\\') {
-		p++;
-		if (*p == '\0') {
-			*pattern = p;
-			return COLL_ELM_INVALID;
-		}
-	}
-	if (pathname && *p == '/') {
-		return COLL_ELM_INVALID;
-	}
-
-	*pattern = p + 1;
-	return _coll_elm_char(*p);
-}
-
-#define _matched(match) { \
-		int _match = match; \
-		if (_match < 0) { \
-			/* Invalid pattern */ \
-			return _match; \
-		} else if (matched == 0 && _match > 0) { \
-			/* First match */ \
-			matched = _match; \
-		} \
-	}
-
-/**
- * Matches the beginning of the given string against a bracket expression
- * the pattern begins with.
- *
- * @param pattern Pointer to the beginning of a bracket expression in a pattern.
- *     On success, the pointer is moved to the first character after the
- *     bracket expression.
- * @param str Unmatched part of the string.
- * @param flags Flags given to fnmatch().
- * @return INVALID_PATTERN if the pattern is invalid, 0 if there is no match
- *     or the number of matched characters on success.
- */
-static int _match_bracket_expr(const char **pattern, const char *str, int flags)
-{
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const char *p = *pattern;
-	bool negative = false;
-	int matched = 0;
-
-	assert(*p == '[');  /* calling code should ensure this */
-	p++;
-
-	if (*str == '\0' || (pathname && *str == '/') ||
-	    (pathname && special_period && *str == '.' && *(str - 1) == '/')) {
-		/*
-		 * No bracket expression matches end of string,
-		 * slash in pathname match or initial period with FNM_PERIOD
-		 * option.
-		 */
-		return 0;
-	}
-
-	if (*p == '^' || *p == '!') {
-		negative = true;
-		p++;
-	}
-
-	if (*p == ']') {
-		/* When ']' is first, treat it as a normal character. */
-		_matched(*str == ']');
-		p++;
-	}
-
-	coll_elm_t current_elm = COLL_ELM_INVALID;
-
-	while (*p != ']') {
-		if (*p == '-' && *(p + 1) != ']' &&
-		    current_elm != COLL_ELM_INVALID) {
-			/* Range expression. */
-			p++;
-			coll_elm_t end_elm = _next_coll_elm(&p, flags);
-			if (end_elm == COLL_ELM_INVALID) {
-				return INVALID_PATTERN;
-			}
-			_matched(_coll_elm_between(current_elm, end_elm, str));
-			continue;
-		}
-
-		if (*p == '[' && *(p + 1) == ':') {
-			current_elm = COLL_ELM_INVALID;
-			_matched(_match_char_class(&p, str, flags));
-			continue;
-		}
-
-		current_elm = _next_coll_elm(&p, flags);
-		if (current_elm == COLL_ELM_INVALID) {
-			return INVALID_PATTERN;
-		}
-		_matched(_coll_elm_match(current_elm, str));
-	}
-
-	/* No error occured - update pattern pointer. */
-	*pattern = p + 1;
-
-	if (matched == 0) {
-		/* No match found */
-		return negative;
-	} else {
-		/* Matched 'match' characters. */
-		return negative ? 0 : matched;
-	}
-}
-
-/**
- * Matches a portion of the pattern containing no asterisks (*) against
- * the given string.
- *
- * @param pattern Pointer to the unmatched portion of the pattern.
- *     On success, the pointer is moved to the first asterisk, or to the
- *     terminating nul character, whichever occurs first.
- * @param string Pointer to the input string. On success, the pointer is moved
- *     to the first character that wasn't explicitly matched.
- * @param flags Flags given to fnmatch().
- * @return True if the entire subpattern matched. False otherwise.
- */
-static bool _partial_match(const char **pattern, const char **string, int flags)
-{
-	/*
-	 * Only a single *-delimited subpattern is matched here.
-	 * So in this function, '*' is understood as the end of pattern.
-	 */
-
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const bool noescape = (flags & FNM_NOESCAPE) != 0;
-	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
-
-	const char *s = *string;
-	const char *p = *pattern;
-
-	while (*p != '*') {
-		/* Bracket expression. */
-		if (*p == '[') {
-			int matched = _match_bracket_expr(&p, s, flags);
-			if (matched == 0) {
-				/* Doesn't match. */
-				return false;
-			}
-			if (matched != INVALID_PATTERN) {
-				s += matched;
-				continue;
-			}
-
-			assert(matched == INVALID_PATTERN);
-			/* Fall through to match [ as an ordinary character. */
-		}
-
-		/* Wildcard match. */
-		if (*p == '?') {
-			if (*s == '\0') {
-				/* No character to match. */
-				return false;
-			}
-			if (pathname && *s == '/') {
-				/* Slash must be matched explicitly. */
-				return false;
-			}
-			if (special_period && pathname &&
-			    *s == '.' && *(s - 1) == '/') {
-				/* Initial period must be matched explicitly. */
-				return false;
-			}
-
-			/* None of the above, match anything else. */
-			p++;
-			s++;
-			continue;
-		}
-
-		if (!noescape && *p == '\\') {
-			/* Escaped character. */
-			p++;
-		}
-
-		if (*p == '\0') {
-			/*
-			 * End of pattern, must match end of string or
-			 * an end of subdirectory name (optional).
-			 */
-
-			if (*s == '\0' || (leading_dir && *s == '/')) {
-				break;
-			}
-
-			return false;
-		}
-
-		if (*p == *s) {
-			/* Exact match. */
-			p++;
-			s++;
-			continue;
-		}
-
-		/* Nothing matched. */
-		return false;
-	}
-
-	/* Entire sub-pattern matched. */
-
-	/* postconditions */
-	assert(*p == '\0' || *p == '*');
-	assert(*p != '\0' || *s == '\0' || (leading_dir && *s == '/'));
-
-	*pattern = p;
-	*string = s;
-	return true;
-}
-
-/**
- * Match string against a pattern.
- *
- * @param pattern Pattern.
- * @param string String to match.
- * @param flags Flags given to fnmatch().
- * @return True if the string matched the pattern, false otherwise.
- */
-static bool _full_match(const char *pattern, const char *string, int flags)
-{
-	const bool pathname = (flags & FNM_PATHNAME) != 0;
-	const bool special_period = (flags & FNM_PERIOD) != 0;
-	const bool leading_dir = (flags & FNM_LEADING_DIR) != 0;
-
-	if (special_period && *string == '.') {
-		/* Initial dot must be matched by an explicit dot in pattern. */
-		if (*pattern != '.') {
-			return false;
-		}
-		pattern++;
-		string++;
-	}
-
-	if (*pattern != '*') {
-		if (!_partial_match(&pattern, &string, flags)) {
-			/* The initial match must succeed. */
-			return false;
-		}
-	}
-
-	while (*pattern != '\0') {
-		assert(*pattern == '*');
-		pattern++;
-
-		bool matched = false;
-
-		const char *end;
-		if (pathname && special_period &&
-		    *string == '.' && *(string - 1) == '/') {
-			end = string;
-		} else {
-			end = gnu_strchrnul(string, pathname ? '/' : '\0');
-		}
-
-		/* Try to match every possible offset. */
-		while (string <= end) {
-			if (_partial_match(&pattern, &string, flags)) {
-				matched = true;
-				break;
-			}
-			string++;
-		}
-
-		if (matched) {
-			continue;
-		}
-
-		return false;
-	}
-
-	return *string == '\0' || (leading_dir && *string == '/');
-}
-
-/**
- * Transform the entire string to lowercase.
- *
- * @param s Input string.
- * @return Newly allocated copy of the input string with all uppercase
- *     characters folded to their lowercase variants.
- */
-static char *_casefold(const char *s)
-{
-	assert(s != NULL);
-	char *result = strdup(s);
-	for (char *i = result; *i != '\0'; ++i) {
-		*i = tolower(*i);
-	}
-	return result;
-}
-
-/**
- * Filename pattern matching.
- *
- * @param pattern Pattern to match the string against.
- * @param string Matched string.
- * @param flags Flags altering the matching of special characters
- *     (mainly for dot and slash).
- * @return Zero if the string matches the pattern, FNM_NOMATCH otherwise.
- */
-int fnmatch(const char *pattern, const char *string, int flags)
-{
-	assert(pattern != NULL);
-	assert(string != NULL);
-
-	// TODO: don't fold everything in advance, but only when needed
-
-	if ((flags & FNM_CASEFOLD) != 0) {
-		/* Just fold the entire pattern and string. */
-		pattern = _casefold(pattern);
-		string = _casefold(string);
-	}
-
-	bool result = _full_match(pattern, string, flags);
-
-	if ((flags & FNM_CASEFOLD) != 0) {
-		if (pattern) {
-			free((char *) pattern);
-		}
-		if (string) {
-			free((char *) string);
-		}
-	}
-
-	return result ? 0 : FNM_NOMATCH;
-}
-
-// FIXME: put the testcases to the app/tester after fnmatch is included into libc
-
-#if 0
-
-#include <stdio.h>
-
-#define fnmatch_test(x) { if (x) printf("SUCCESS: "#x"\n"); else { printf("FAILED: "#x"\n"); fail++; } }
-#define match(s1, s2, flags) fnmatch_test(fnmatch(s1, s2, flags) == 0)
-#define nomatch(s1, s2, flags) fnmatch_test(fnmatch(s1, s2, flags) == FNM_NOMATCH)
-
-void __posix_fnmatch_test()
-{
-	int fail = 0;
-
-	static_assert(FNM_PATHNAME == FNM_FILE_NAME);
-	match("", "", 0);
-	match("*", "hello", 0);
-	match("hello", "hello", 0);
-	match("hello*", "hello", 0);
-	nomatch("hello?", "hello", 0);
-	match("*hello", "prdel hello", 0);
-	match("he[sl]lo", "hello", 0);
-	match("he[sl]lo", "heslo", 0);
-	nomatch("he[sl]lo", "heblo", 0);
-	nomatch("he[^sl]lo", "hello", 0);
-	nomatch("he[^sl]lo", "heslo", 0);
-	match("he[^sl]lo", "heblo", 0);
-	nomatch("he[!sl]lo", "hello", 0);
-	nomatch("he[!sl]lo", "heslo", 0);
-	match("he[!sl]lo", "heblo", 0);
-	match("al*[c-t]a*vis*ta", "alheimer talir jehovista", 0);
-	match("al*[c-t]a*vis*ta", "alfons had jehovista", 0);
-	match("[a-ce-z]", "a", 0);
-	match("[a-ce-z]", "c", 0);
-	nomatch("[a-ce-z]", "d", 0);
-	match("[a-ce-z]", "e", 0);
-	match("[a-ce-z]", "z", 0);
-	nomatch("[^a-ce-z]", "a", 0);
-	nomatch("[^a-ce-z]", "c", 0);
-	match("[^a-ce-z]", "d", 0);
-	nomatch("[^a-ce-z]", "e", 0);
-	nomatch("[^a-ce-z]", "z", 0);
-	match("helen??", "helenos", 0);
-	match("****booo****", "booo", 0);
-
-	match("hello[[:space:]]world", "hello world", 0);
-	nomatch("hello[[:alpha:]]world", "hello world", 0);
-
-	match("/hoooo*", "/hooooooo/hooo", 0);
-	nomatch("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME);
-	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*/*", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*/hooo", "/hooooooo/hooo", FNM_PATHNAME);
-	match("/hoooo*", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
-	nomatch("/hoooo*/", "/hooooooo/hooo", FNM_PATHNAME | FNM_LEADING_DIR);
-	nomatch("/hoooo", "/hooooooo/hooo", FNM_LEADING_DIR);
-	match("/hooooooo", "/hooooooo/hooo", FNM_LEADING_DIR);
-
-	match("*", "hell", 0);
-	match("*?", "hell", 0);
-	match("?*?", "hell", 0);
-	match("?*??", "hell", 0);
-	match("??*??", "hell", 0);
-	nomatch("???*??", "hell", 0);
-
-	nomatch("", "hell", 0);
-	nomatch("?", "hell", 0);
-	nomatch("??", "hell", 0);
-	nomatch("???", "hell", 0);
-	match("????", "hell", 0);
-
-	match("*", "h.ello", FNM_PERIOD);
-	match("*", "h.ello", FNM_PATHNAME | FNM_PERIOD);
-	nomatch("*", ".hello", FNM_PERIOD);
-	match("h?ello", "h.ello", FNM_PERIOD);
-	nomatch("?hello", ".hello", FNM_PERIOD);
-	match("/home/user/.*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
-	match("/home/user/*", "/home/user/.hello", FNM_PERIOD);
-	nomatch("/home/user/*", "/home/user/.hello", FNM_PATHNAME | FNM_PERIOD);
-
-	nomatch("HeLlO", "hello", 0);
-	match("HeLlO", "hello", FNM_CASEFOLD);
-
-	printf("Failed: %d\n", fail);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/posix/src/internal/common.h
===================================================================
--- uspace/lib/posix/src/internal/common.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Helper definitions common for all libposix files.
- */
-
-#ifndef LIBPOSIX_COMMON_H_
-#define LIBPOSIX_COMMON_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <offset.h>
-#include <vfs/vfs.h>
-
-#define not_implemented() do { \
-		static int __not_implemented_counter = 0; \
-		if (__not_implemented_counter == 0) { \
-			fprintf(stderr, "%s() not implemented in %s:%d, something will NOT work.\n", \
-				__func__, __FILE__, __LINE__); \
-		} \
-		__not_implemented_counter++; \
-	} while (0)
-
-// Just a marker for external tools.
-#define _HIDE_LIBC_SYMBOL(symbol)
-
-/** Checks if the value is a failing error code.
- *
- * If so, writes the error code to errno and returns true.
- */
-static inline bool failed(int rc)
-{
-	if (rc != EOK) {
-		errno = rc;
-		return true;
-	}
-	return false;
-}
-
-// TODO: Remove this arbitrary limit.
-#define VFS_MAX_OPEN_FILES 128
-
-extern aoff64_t posix_pos[VFS_MAX_OPEN_FILES];
-
-#endif /* LIBPOSIX_COMMON_H_ */
-
-/** @}
- */
Index: pace/lib/posix/src/locale.c
===================================================================
--- uspace/lib/posix/src/locale.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,183 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Locale-specific definitions.
- */
-
-#include "internal/common.h"
-#include <locale.h>
-
-#include <errno.h>
-
-#include <limits.h>
-#include <string.h>
-
-/*
- * Just a very basic dummy implementation.
- * This should allow code using locales to work properly, but doesn't provide
- * any localization functionality.
- * Should be extended/rewritten when or if HelenOS supports locales natively.
- */
-
-struct __posix_locale {
-	int _dummy;
-};
-
-const struct lconv C_LOCALE = {
-	.currency_symbol = (char *) "",
-	.decimal_point = (char *) ".",
-	.frac_digits = CHAR_MAX,
-	.grouping = (char *) "",
-	.int_curr_symbol = (char *) "",
-	.int_frac_digits = CHAR_MAX,
-	.int_n_cs_precedes = CHAR_MAX,
-	.int_n_sep_by_space = CHAR_MAX,
-	.int_n_sign_posn = CHAR_MAX,
-	.int_p_cs_precedes = CHAR_MAX,
-	.int_p_sep_by_space = CHAR_MAX,
-	.int_p_sign_posn = CHAR_MAX,
-	.mon_decimal_point = (char *) "",
-	.mon_grouping = (char *) "",
-	.mon_thousands_sep = (char *) "",
-	.negative_sign = (char *) "",
-	.n_cs_precedes = CHAR_MAX,
-	.n_sep_by_space = CHAR_MAX,
-	.n_sign_posn = CHAR_MAX,
-	.positive_sign = (char *) "",
-	.p_cs_precedes = CHAR_MAX,
-	.p_sep_by_space = CHAR_MAX,
-	.p_sign_posn = CHAR_MAX,
-	.thousands_sep = (char *) ""
-};
-
-/**
- * Set program locale.
- *
- * @param category What category to set.
- * @param locale Locale name.
- * @return Original locale name on success, NULL on failure.
- */
-char *setlocale(int category, const char *locale)
-{
-	// TODO
-	if (locale == NULL || *locale == '\0' ||
-	    strcmp(locale, "C") == 0) {
-		return (char *) "C";
-	}
-	return NULL;
-}
-
-/**
- * Return locale-specific information.
- *
- * @return Information about the current locale.
- */
-struct lconv *localeconv(void)
-{
-	// TODO
-	return (struct lconv *) &C_LOCALE;
-}
-
-/**
- * Duplicate locale object.
- *
- * @param locobj Object to duplicate.
- * @return Duplicated object.
- */
-locale_t duplocale(locale_t locobj)
-{
-	if (locobj == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-	locale_t copy = malloc(sizeof(struct __posix_locale));
-	if (copy == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	memcpy(copy, locobj, sizeof(struct __posix_locale));
-	return copy;
-}
-
-/**
- * Free locale object.
- *
- * @param locobj Object to free.
- */
-void freelocale(locale_t locobj)
-{
-	if (locobj) {
-		free(locobj);
-	}
-}
-
-/**
- * Create or modify a locale object.
- *
- * @param category_mask Mask of categories to be set or modified.
- * @param locale Locale to be used.
- * @param base Object to modify. 0 if new object is to be created.
- * @return The new/modified locale object.
- */
-locale_t newlocale(int category_mask, const char *locale,
-    locale_t base)
-{
-	if (locale == NULL ||
-	    (category_mask & LC_ALL_MASK) != category_mask) {
-		errno = EINVAL;
-		return NULL;
-	}
-	// TODO
-	locale_t new = malloc(sizeof(struct __posix_locale));
-	if (new == NULL) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	if (base != NULL) {
-		freelocale(base);
-	}
-	return new;
-}
-
-/**
- * Set locale for the current thread.
- *
- * @param newloc Locale to use.
- * @return The previously set locale or LC_GLOBAL_LOCALE
- */
-locale_t uselocale(locale_t newloc)
-{
-	// TODO
-	return LC_GLOBAL_LOCALE;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/condvar.c
===================================================================
--- uspace/lib/posix/src/pthread/condvar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: condition variables.
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include "../internal/common.h"
-
-int pthread_cond_init(pthread_cond_t *restrict condvar,
-    const pthread_condattr_t *restrict attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_destroy(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_broadcast(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_signal(pthread_cond_t *condvar)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_timedwait(pthread_cond_t *restrict condvar,
-    pthread_mutex_t *restrict mutex, const struct timespec *restrict timeout)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_cond_wait(pthread_cond_t *restrict condvar,
-    pthread_mutex_t *restrict mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_condattr_init(pthread_condattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_condattr_destroy(pthread_condattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/keys.c
===================================================================
--- uspace/lib/posix/src/pthread/keys.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: keys and thread-specific storage.
- */
-
-#include <stdlib.h>
-#include <pthread.h>
-#include <errno.h>
-#include <fibril.h>
-#include <stdatomic.h>
-#include "../internal/common.h"
-
-#include <stdio.h>
-#define DPRINTF(format, ...) ((void) 0);
-
-static atomic_ushort next_key = 1; // skip the key 'zero'
-
-/*
- * For now, we just support maximum of 100 keys. This can be improved
- * in the future by implementing a dynamically growing array with
- * reallocations, but that will require more synchronization.
- */
-#define PTHREAD_KEYS_MAX 100
-
-static fibril_local void *key_data[PTHREAD_KEYS_MAX];
-
-void *pthread_getspecific(pthread_key_t key)
-{
-	assert(key < PTHREAD_KEYS_MAX);
-	assert(key < next_key);
-	assert(key > 0);
-
-	DPRINTF("pthread_getspecific(%d) = %p\n", key, key_data[key]);
-	return key_data[key];
-}
-
-int pthread_setspecific(pthread_key_t key, const void *data)
-{
-	DPRINTF("pthread_setspecific(%d, %p)\n", key, data);
-	assert(key < PTHREAD_KEYS_MAX);
-	assert(key < next_key);
-	assert(key > 0);
-
-	key_data[key] = (void *) data;
-	return EOK;
-}
-
-int pthread_key_delete(pthread_key_t key)
-{
-	/* see https://github.com/HelenOS/helenos/pull/245#issuecomment-2706795848 */
-	not_implemented();
-	return EOK;
-}
-
-int pthread_key_create(pthread_key_t *key, void (*destructor)(void *))
-{
-	unsigned short k = atomic_fetch_add(&next_key, 1);
-	DPRINTF("pthread_key_create(%p, %p) = %d\n", key, destructor, k);
-	if (k >= PTHREAD_KEYS_MAX) {
-		atomic_store(&next_key, PTHREAD_KEYS_MAX + 1);
-		return ELIMIT;
-	}
-	if (destructor != NULL) {
-		/* Inlined not_implemented() macro to add custom message */
-		static int __not_implemented_counter = 0;
-		if (__not_implemented_counter == 0) {
-			fprintf(stderr, "pthread_key_create: destructors not supported\n");
-		}
-		__not_implemented_counter++;
-	}
-
-	*key = k;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/mutex.c
===================================================================
--- uspace/lib/posix/src/pthread/mutex.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: mutexes.
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include "../internal/common.h"
-
-int pthread_mutex_init(pthread_mutex_t *restrict mutex,
-    const pthread_mutexattr_t *restrict attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_destroy(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_lock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_trylock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutex_unlock(pthread_mutex_t *mutex)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_init(pthread_mutexattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr,
-    int *restrict type)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pthread/threads.c
===================================================================
--- uspace/lib/posix/src/pthread/threads.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Pthread: thread management.
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <fibril.h>
-#include "../internal/common.h"
-
-pthread_t pthread_self(void)
-{
-	return (pthread_t) fibril_get_id();
-}
-
-int pthread_equal(pthread_t thread1, pthread_t thread2)
-{
-	return thread1 == thread2;
-}
-
-int pthread_create(pthread_t *thread_id, const pthread_attr_t *attributes,
-    void *(*start_routine)(void *), void *arg)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_join(pthread_t thread, void **ret_val)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_detach(pthread_t thread)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_attr_init(pthread_attr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-int pthread_attr_destroy(pthread_attr_t *attr)
-{
-	not_implemented();
-	return ENOTSUP;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/pwd.c
===================================================================
--- uspace/lib/posix/src/pwd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Password handling.
- */
-
-#include <stdbool.h>
-#include <pwd.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-static bool entry_read = false;
-
-/* dummy user account */
-static const struct passwd dummy_pwd = {
-	.pw_name = (char *) "user",
-	.pw_uid = 0,
-	.pw_gid = 0,
-	.pw_dir = (char *) "/",
-	.pw_shell = (char *) "/app/bdsh"
-};
-
-/**
- * Retrieve next broken-down entry from the user database.
- *
- * Since HelenOS doesn't have user accounts, this always returns
- * the same made-up entry.
- *
- * @return Next user database entry or NULL if not possible. Since HelenOS
- *     doesn't have user accounts, this always returns the same made-up entry.
- */
-struct passwd *getpwent(void)
-{
-	if (entry_read) {
-		return NULL;
-	}
-
-	entry_read = true;
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Rewind the user list.
- */
-void setpwent(void)
-{
-	entry_read = false;
-}
-
-/**
- * Ends enumerating and releases all resources. (Noop)
- */
-void endpwent(void)
-{
-	/* noop */
-}
-
-/**
- * Find an entry by name.
- *
- * @param name Name of the entry.
- * @return Either found entry or NULL if no such entry exists.
- */
-struct passwd *getpwnam(const char *name)
-{
-	assert(name != NULL);
-
-	if (strcmp(name, "user") != 0) {
-		return NULL;
-	}
-
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Find an entry by name, thread safely.
- *
- * @param name Name of the entry.
- * @param pwd Original structure.
- * @param buffer Buffer for the strings referenced from the result structure.
- * @param bufsize Length of the buffer.
- * @param result Where to store updated structure.
- * @return Zero on success (either found or not found, but without an error),
- *     non-zero error number if error occured.
- */
-int getpwnam_r(const char *name, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result)
-{
-	assert(name != NULL);
-	assert(pwd != NULL);
-	assert(buffer != NULL);
-	assert(result != NULL);
-
-	if (strcmp(name, "user") != 0) {
-		*result = NULL;
-		return 0;
-	}
-
-	return getpwuid_r(0, pwd, buffer, bufsize, result);
-}
-
-/**
- * Find an entry by UID.
- *
- * @param uid UID of the entry.
- * @return Either found entry or NULL if no such entry exists.
- */
-struct passwd *getpwuid(uid_t uid)
-{
-	if (uid != 0) {
-		return NULL;
-	}
-
-	return (struct passwd *) &dummy_pwd;
-}
-
-/**
- * Find an entry by UID, thread safely.
- *
- * @param uid UID of the entry.
- * @param pwd Original structure.
- * @param buffer Buffer for the strings referenced from the result structure.
- * @param bufsize Length of the buffer.
- * @param result Where to store updated structure.
- * @return Zero on success (either found or not found, but without an error),
- *     non-zero error number if error occured.
- */
-int getpwuid_r(uid_t uid, struct passwd *pwd,
-    char *buffer, size_t bufsize, struct passwd **result)
-{
-	assert(pwd != NULL);
-	assert(buffer != NULL);
-	assert(result != NULL);
-
-	static const char bf[] = { 'u', 's', 'e', 'r', '\0',
-		'/', '\0', 'b', 'd', 's', 'h', '\0' };
-
-	if (uid != 0) {
-		*result = NULL;
-		return 0;
-	}
-	if (bufsize < sizeof(bf)) {
-		*result = NULL;
-		return ERANGE;
-	}
-
-	memcpy(buffer, bf, sizeof(bf));
-
-	pwd->pw_name = (char *) bf;
-	pwd->pw_uid = 0;
-	pwd->pw_gid = 0;
-	pwd->pw_dir = (char *) bf + 5;
-	pwd->pw_shell = (char *) bf + 7;
-	*result = (struct passwd *) pwd;
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/signal.c
===================================================================
--- uspace/lib/posix/src/signal.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,566 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Signal handling.
- */
-
-#include <signal.h>
-#include "internal/common.h"
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <errno.h>
-
-#include <fibril_synch.h>
-#include <task.h>
-
-/*
- * This file implements a fairly dumb and incomplete "simulation" of
- * POSIX signals. Since HelenOS doesn't support signals and mostly doesn't
- * have any equivalent functionality, most of the signals are useless. The
- * main purpose of this implementation is thus to help port applications using
- * signals with minimal modification, but if the application uses signals for
- * anything non-trivial, it's quite probable it won't work properly even if
- * it builds without problems.
- */
-
-/* Used to serialize signal handling. */
-static FIBRIL_MUTEX_INITIALIZE(_signal_mutex);
-
-static LIST_INITIALIZE(_signal_queue);
-
-static sigset_t _signal_mask = 0;
-
-#define DEFAULT_HANDLER { .sa_handler = SIG_DFL, \
-    .sa_mask = 0, .sa_flags = 0, .sa_sigaction = NULL }
-
-/* Actions associated with each signal number. */
-static struct sigaction _signal_actions[_TOP_SIGNAL + 1] = {
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER,
-	DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER, DEFAULT_HANDLER
-};
-
-/**
- * Default signal handler. Executes the default action for each signal,
- * as reasonable within HelenOS.
- *
- * @param signo Signal number.
- */
-void __posix_default_signal_handler(int signo)
-{
-	switch (signo) {
-	case SIGABRT:
-		abort();
-	case SIGQUIT:
-		fprintf(stderr, "Quit signal raised. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGINT:
-		fprintf(stderr, "Interrupt signal caught. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGTERM:
-		fprintf(stderr, "Termination signal caught. Exiting.\n");
-		exit(EXIT_FAILURE);
-	case SIGSTOP:
-		fprintf(stderr, "Stop signal caught, but unsupported. Ignoring.\n");
-		break;
-	case SIGKILL:
-		/* This will only occur when raise or similar is called. */
-		/* Commit suicide. */
-		task_kill(task_get_id());
-
-		/* Should not be reached. */
-		abort();
-	case SIGFPE:
-	case SIGBUS:
-	case SIGILL:
-	case SIGSEGV:
-		psignal(signo, "Hardware exception raised by user code");
-		abort();
-	case SIGSYS:
-	case SIGXCPU:
-	case SIGXFSZ:
-	case SIGTRAP:
-	case SIGHUP:
-	case SIGPIPE:
-	case SIGPOLL:
-	case SIGURG:
-	case SIGTSTP:
-	case SIGTTIN:
-	case SIGTTOU:
-		psignal(signo, "Unsupported signal caught");
-		abort();
-	case SIGCHLD:
-	case SIGUSR1:
-	case SIGUSR2:
-	case SIGALRM:
-	case SIGVTALRM:
-	case SIGPROF:
-	case SIGCONT:
-		/* ignored */
-		break;
-	}
-}
-
-/**
- * Just an empty function to get an unique pointer value for comparison.
- *
- * @param signo Signal number.
- */
-void __posix_hold_signal_handler(int signo)
-{
-	/* Nothing */
-}
-
-/**
- * Empty function to be used as ignoring handler.
- *
- * @param signo Signal number.
- */
-void __posix_ignore_signal_handler(int signo)
-{
-	/* Nothing */
-}
-
-/**
- * Clear the signal set.
- *
- * @param set Pointer to the signal set.
- * @return Always returns zero.
- */
-int sigemptyset(sigset_t *set)
-{
-	assert(set != NULL);
-
-	*set = 0;
-	return 0;
-}
-
-/**
- * Fill the signal set (i.e. add all signals).
- *
- * @param set Pointer to the signal set.
- * @return Always returns zero.
- */
-int sigfillset(sigset_t *set)
-{
-	assert(set != NULL);
-
-	*set = UINT32_MAX;
-	return 0;
-}
-
-/**
- * Add a signal to the set.
- *
- * @param set Pointer to the signal set.
- * @param signo Signal number to add.
- * @return Always returns zero.
- */
-int sigaddset(sigset_t *set, int signo)
-{
-	assert(set != NULL);
-
-	*set |= (1 << signo);
-	return 0;
-}
-
-/**
- * Delete a signal from the set.
- *
- * @param set Pointer to the signal set.
- * @param signo Signal number to remove.
- * @return Always returns zero.
- */
-int sigdelset(sigset_t *set, int signo)
-{
-	assert(set != NULL);
-
-	*set &= ~(1 << signo);
-	return 0;
-}
-
-/**
- * Inclusion test for a signal set.
- *
- * @param set Pointer to the signal set.
- * @param signo Signal number to query.
- * @return 1 if the signal is in the set, 0 otherwise.
- */
-int sigismember(const sigset_t *set, int signo)
-{
-	assert(set != NULL);
-
-	return (*set & (1 << signo)) != 0;
-}
-
-/**
- * Unsafe variant of the sigaction() function.
- * Doesn't do any checking of its arguments and
- * does not deal with thread-safety.
- *
- * @param sig
- * @param act
- * @param oact
- */
-static void _sigaction_unsafe(int sig, const struct sigaction *restrict act,
-    struct sigaction *restrict oact)
-{
-	if (oact != NULL) {
-		memcpy(oact, &_signal_actions[sig],
-		    sizeof(struct sigaction));
-	}
-
-	if (act != NULL) {
-		memcpy(&_signal_actions[sig], act,
-		    sizeof(struct sigaction));
-	}
-}
-
-/**
- * Sets a new action for the given signal number.
- *
- * @param sig Signal number to set action for.
- * @param act If not NULL, contents of this structure are
- *     used as the new action for the signal.
- * @param oact If not NULL, the original action associated with the signal
- *     is stored in the structure pointer to.
- * @return -1 with errno set on failure, 0 on success.
- */
-int sigaction(int sig, const struct sigaction *restrict act,
-    struct sigaction *restrict oact)
-{
-	if (sig > _TOP_SIGNAL || (act != NULL &&
-	    (sig == SIGKILL || sig == SIGSTOP))) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (sig > _TOP_CATCHABLE_SIGNAL) {
-		psignal(sig,
-		    "WARNING: registering handler for a partially"
-		    " or fully unsupported signal. This handler may only be"
-		    " invoked by the raise() function, which may not be what"
-		    " the application developer intended");
-	}
-
-	fibril_mutex_lock(&_signal_mutex);
-	_sigaction_unsafe(sig, act, oact);
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Sets a new handler for the given signal number.
- *
- * @param sig Signal number to set handler for.
- * @param func Handler function.
- * @return SIG_ERR on failure, original handler on success.
- */
-void (*signal(int sig, void (*func)(int)))(int)
-{
-	struct sigaction new = {
-		.sa_handler = func,
-		.sa_mask = 0,
-		.sa_flags = 0,
-		.sa_sigaction = NULL
-	};
-	struct sigaction old;
-	if (sigaction(sig, func == NULL ? NULL : &new, &old) == 0) {
-		return old.sa_handler;
-	} else {
-		return SIG_ERR;
-	}
-}
-
-typedef struct {
-	link_t link;
-	int signo;
-	siginfo_t siginfo;
-} signal_queue_item;
-
-/**
- * Queue blocked signal.
- *
- * @param signo Signal number.
- * @param siginfo Additional information about the signal.
- */
-static void _queue_signal(int signo, siginfo_t *siginfo)
-{
-	assert(signo >= 0 && signo <= _TOP_SIGNAL);
-	assert(siginfo != NULL);
-
-	signal_queue_item *item = malloc(sizeof(signal_queue_item));
-	link_initialize(&(item->link));
-	item->signo = signo;
-	memcpy(&item->siginfo, siginfo, sizeof(siginfo_t));
-	list_append(&(item->link), &_signal_queue);
-}
-
-/**
- * Executes an action associated with the given signal.
- *
- * @param signo Signal number.
- * @param siginfo Additional information about the circumstances of this raise.
- * @return 0 if the action has been successfully executed. -1 if the signal is
- *     blocked.
- */
-static int _raise_sigaction(int signo, siginfo_t *siginfo)
-{
-	assert(signo >= 0 && signo <= _TOP_SIGNAL);
-	assert(siginfo != NULL);
-
-	fibril_mutex_lock(&_signal_mutex);
-
-	struct sigaction action = _signal_actions[signo];
-
-	if (sigismember(&_signal_mask, signo) ||
-	    action.sa_handler == SIG_HOLD) {
-		_queue_signal(signo, siginfo);
-		fibril_mutex_unlock(&_signal_mutex);
-		return -1;
-	}
-
-	/*
-	 * Modifying signal mask is unnecessary,
-	 * signal handling is serialized.
-	 */
-
-	if ((action.sa_flags & SA_RESETHAND) && signo != SIGILL && signo != SIGTRAP) {
-		_signal_actions[signo] = (struct sigaction) DEFAULT_HANDLER;
-	}
-
-	if (action.sa_flags & SA_SIGINFO) {
-		assert(action.sa_sigaction != NULL);
-		action.sa_sigaction(signo, siginfo, NULL);
-	} else {
-		assert(action.sa_handler != NULL);
-		action.sa_handler(signo);
-	}
-
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Raise all unblocked previously queued signals.
- */
-static void _dequeue_unblocked_signals(void)
-{
-	link_t *iterator = _signal_queue.head.next;
-	link_t *next;
-
-	while (iterator != &(_signal_queue).head) {
-		next = iterator->next;
-
-		signal_queue_item *item =
-		    list_get_instance(iterator, signal_queue_item, link);
-
-		if (!sigismember(&_signal_mask, item->signo) &&
-		    _signal_actions[item->signo].sa_handler != SIG_HOLD) {
-			list_remove(&(item->link));
-			_raise_sigaction(item->signo, &(item->siginfo));
-			free(item);
-		}
-
-		iterator = next;
-	}
-}
-
-/**
- * Raise a signal for the calling process.
- *
- * @param sig Signal number.
- * @return -1 with errno set on failure, 0 on success.
- */
-int raise(int sig)
-{
-	if (sig >= 0 && sig <= _TOP_SIGNAL) {
-		siginfo_t siginfo = {
-			.si_signo = sig,
-			.si_code = SI_USER
-		};
-		return _raise_sigaction(sig, &siginfo);
-	} else {
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Raises a signal for a selected process.
- *
- * @param pid PID of the process for which the signal shall be raised.
- * @param signo Signal to raise.
- * @return -1 with errno set on failure (possible errors include unsupported
- *     action, invalid signal number, lack of permissions, etc.), 0 on success.
- */
-int kill(pid_t pid, int signo)
-{
-	if (pid < 1) {
-		// TODO
-		errno = ENOTSUP;
-		return -1;
-	}
-
-	if (signo > _TOP_SIGNAL) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (pid == (pid_t) task_get_id()) {
-		return raise(signo);
-	}
-
-	switch (signo) {
-	case SIGKILL:
-		task_kill(pid);
-		break;
-	default:
-		/* Nothing else supported yet. */
-		errno = ENOTSUP;
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * Send a signal to a process group. Always fails at the moment because of
- * lack of this functionality in HelenOS.
- *
- * @param pid PID of the process group.
- * @param sig Signal number.
- * @return -1 on failure, 0 on success (see kill()).
- */
-int killpg(pid_t pid, int sig)
-{
-	assert(pid > 1);
-	return kill(-pid, sig);
-}
-
-/**
- * Outputs information about the signal to the standard error stream.
- *
- * @param pinfo SigInfo struct to write.
- * @param message String to output alongside human-readable signal description.
- */
-void psiginfo(const siginfo_t *pinfo, const char *message)
-{
-	assert(pinfo != NULL);
-	psignal(pinfo->si_signo, message);
-	// TODO: print si_code
-}
-
-/**
- * Outputs information about the signal to the standard error stream.
- *
- * @param signum Signal number.
- * @param message String to output alongside human-readable signal description.
- */
-void psignal(int signum, const char *message)
-{
-	char *sigmsg = strsignal(signum);
-	if (message == NULL || *message == '\0') {
-		fprintf(stderr, "%s\n", sigmsg);
-	} else {
-		fprintf(stderr, "%s: %s\n", message, sigmsg);
-	}
-}
-
-/**
- * Manipulate the signal mask of the calling thread.
- *
- * @param how What to do with the mask.
- * @param set Signal set to work with.
- * @param oset If not NULL, the original signal mask is coppied here.
- * @return 0 success, errorcode on failure.
- */
-int thread_sigmask(int how, const sigset_t *restrict set,
-    sigset_t *restrict oset)
-{
-	fibril_mutex_lock(&_signal_mutex);
-
-	if (oset != NULL) {
-		*oset = _signal_mask;
-	}
-	if (set != NULL) {
-		switch (how) {
-		case SIG_BLOCK:
-			_signal_mask |= *set;
-			break;
-		case SIG_UNBLOCK:
-			_signal_mask &= ~*set;
-			break;
-		case SIG_SETMASK:
-			_signal_mask = *set;
-			break;
-		default:
-			fibril_mutex_unlock(&_signal_mutex);
-			return EINVAL;
-		}
-	}
-
-	_dequeue_unblocked_signals();
-
-	fibril_mutex_unlock(&_signal_mutex);
-
-	return 0;
-}
-
-/**
- * Manipulate the signal mask of the process.
- *
- * @param how What to do with the mask.
- * @param set Signal set to work with.
- * @param oset If not NULL, the original signal mask is coppied here.
- * @return 0 on success, -1 with errno set on failure.
- */
-int sigprocmask(int how, const sigset_t *restrict set,
-    sigset_t *restrict oset)
-{
-	int result = thread_sigmask(how, set, oset);
-	if (result != 0) {
-		errno = result;
-		return -1;
-	}
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdio.c
===================================================================
--- uspace/lib/posix/src/stdio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,409 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard buffered input/output.
- */
-
-#define _LARGEFILE64_SOURCE
-#undef _FILE_OFFSET_BITS
-
-#include "internal/common.h"
-#include <stdio.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <tmpfile.h>
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <printf_core.h>
-#include <str.h>
-#include <stdlib.h>
-#include <adt/list.h>
-
-/**
- * Generate a pathname for the controlling terminal.
- *
- * @param s Allocated buffer to which the pathname shall be put.
- * @return Either s or static location filled with the requested pathname.
- */
-char *ctermid(char *s)
-{
-	/* Currently always returns an error value (empty string). */
-	// TODO: return a real terminal path
-
-	static char dummy_path[L_ctermid] = { '\0' };
-
-	if (s == NULL) {
-		return dummy_path;
-	}
-
-	s[0] = '\0';
-	return s;
-}
-
-/**
- * Read a stream until the delimiter (or EOF) is encountered.
- *
- * @param lineptr Pointer to the output buffer in which there will be stored
- *     nul-terminated string together with the delimiter (if encountered).
- *     Will be resized if necessary.
- * @param n Pointer to the size of the output buffer. Will be increased if
- *     necessary.
- * @param delimiter Delimiter on which to finish reading the stream.
- * @param stream Input stream.
- * @return Number of fetched characters (including delimiter if encountered)
- *     or -1 on error (set in errno).
- */
-ssize_t getdelim(char **restrict lineptr, size_t *restrict n,
-    int delimiter, FILE *restrict stream)
-{
-	/* Check arguments for sanity. */
-	if (!lineptr || !n) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	size_t alloc_step = 80; /* Buffer size gain during reallocation. */
-	char *pos = *lineptr; /* Next free byte of the output buffer. */
-	size_t cnt = 0; /* Number of fetched characters. */
-	int c = fgetc(stream); /* Current input character. Might be EOF. */
-
-	do {
-		/* Mask EOF as NUL to terminate string. */
-		if (c == EOF) {
-			c = '\0';
-		}
-
-		/* Ensure there is still space left in the buffer. */
-		if (pos == *lineptr + *n) {
-			*lineptr = realloc(*lineptr, *n + alloc_step);
-			if (*lineptr) {
-				pos = *lineptr + *n;
-				*n += alloc_step;
-			} else {
-				errno = ENOMEM;
-				return -1;
-			}
-		}
-
-		/* Store the fetched character. */
-		*pos = c;
-
-		/* Fetch the next character according to the current character. */
-		if (c != '\0') {
-			++pos;
-			++cnt;
-			if (c == delimiter) {
-				/*
-				 * Delimiter was just stored. Provide EOF as the next
-				 * character - it will be masked as NUL and output string
-				 * will be properly terminated.
-				 */
-				c = EOF;
-			} else {
-				/*
-				 * Neither delimiter nor EOF were encountered. Just fetch
-				 * the next character from the stream.
-				 */
-				c = fgetc(stream);
-			}
-		}
-	} while (c != '\0');
-
-	if (errno == EOK && cnt > 0) {
-		return cnt;
-	} else {
-		/* Either some error occured or the stream was already at EOF. */
-		return -1;
-	}
-}
-
-/**
- * Read a stream until the newline (or EOF) is encountered.
- *
- * @param lineptr Pointer to the output buffer in which there will be stored
- *     nul-terminated string together with the delimiter (if encountered).
- *     Will be resized if necessary.
- * @param n Pointer to the size of the output buffer. Will be increased if
- *     necessary.
- * @param stream Input stream.
- * @return Number of fetched characters (including newline if encountered)
- *     or -1 on error (set in errno).
- */
-ssize_t getline(char **restrict lineptr, size_t *restrict n,
-    FILE *restrict stream)
-{
-	return getdelim(lineptr, n, '\n', stream);
-}
-
-/**
- * Reposition a file-position indicator in a stream.
- *
- * @param stream Stream to seek in.
- * @param offset Direction and amount of bytes to seek.
- * @param whence From where to seek.
- * @return Zero on success, -1 otherwise.
- */
-int fseeko(FILE *stream, off_t offset, int whence)
-{
-	return fseek(stream, offset, whence);
-}
-
-/**
- * Discover current file offset in a stream.
- *
- * @param stream Stream for which the offset shall be retrieved.
- * @return Current offset or -1 if not possible.
- */
-off_t ftello(FILE *stream)
-{
-	return ftell(stream);
-}
-
-int fseeko64(FILE *stream, off64_t offset, int whence)
-{
-	return fseek64(stream, offset, whence);
-}
-
-off64_t ftello64(FILE *stream)
-{
-	return ftell64(stream);
-}
-
-/**
- * Print formatted output to the opened file.
- *
- * @param fildes File descriptor of the opened file.
- * @param format Format description.
- * @return Either the number of printed characters or negative value on error.
- */
-int dprintf(int fildes, const char *restrict format, ...)
-{
-	va_list list;
-	va_start(list, format);
-	int result = vdprintf(fildes, format, list);
-	va_end(list);
-	return result;
-}
-
-/**
- * Write ordinary string to the opened file.
- *
- * @param str String to be written.
- * @param size Size of the string (in bytes)..
- * @param fd File descriptor of the opened file.
- * @return The number of written characters.
- */
-static errno_t _dprintf_str_write(const char *str, size_t size, void *fd)
-{
-	const int fildes = *(int *) fd;
-	size_t wr;
-	return vfs_write(fildes, &posix_pos[fildes], str, size, &wr);
-}
-
-/**
- * Print formatted output to the opened file.
- *
- * @param fildes File descriptor of the opened file.
- * @param format Format description.
- * @param ap Print arguments.
- * @return Either the number of printed characters or negative value on error.
- */
-int vdprintf(int fildes, const char *restrict format, va_list ap)
-{
-	printf_spec_t spec = {
-		.write = _dprintf_str_write,
-		.data = &fildes
-	};
-
-	return printf_core(format, &spec, ap);
-}
-
-/**
- * Acquire file stream for the thread.
- *
- * @param file File stream to lock.
- */
-void flockfile(FILE *file)
-{
-	/* dummy */
-}
-
-/**
- * Acquire file stream for the thread (non-blocking).
- *
- * @param file File stream to lock.
- * @return Zero for success and non-zero if the lock cannot be acquired.
- */
-int ftrylockfile(FILE *file)
-{
-	/* dummy */
-	return 0;
-}
-
-/**
- * Relinquish the ownership of the locked file stream.
- *
- * @param file File stream to unlock.
- */
-void funlockfile(FILE *file)
-{
-	/* dummy */
-}
-
-/**
- * Get a byte from a stream (thread-unsafe).
- *
- * @param stream Input file stream.
- * @return Either read byte or EOF.
- */
-int getc_unlocked(FILE *stream)
-{
-	return getc(stream);
-}
-
-/**
- * Get a byte from the standard input stream (thread-unsafe).
- *
- * @return Either read byte or EOF.
- */
-int getchar_unlocked(void)
-{
-	return getchar();
-}
-
-/**
- * Put a byte on a stream (thread-unsafe).
- *
- * @param c Byte to output.
- * @param stream Output file stream.
- * @return Either written byte or EOF.
- */
-int putc_unlocked(int c, FILE *stream)
-{
-	return putc(c, stream);
-}
-
-/**
- * Put a byte on the standard output stream (thread-unsafe).
- *
- * @param c Byte to output.
- * @return Either written byte or EOF.
- */
-int putchar_unlocked(int c)
-{
-	return putchar(c);
-}
-
-/** Determine if directory is an 'appropriate' temporary directory.
- *
- * @param dir Directory path
- * @return @c true iff directory is appropriate.
- */
-static bool is_appropriate_tmpdir(const char *dir)
-{
-	struct stat sbuf;
-
-	/* Must not be NULL */
-	if (dir == NULL)
-		return false;
-
-	/* Must not be empty */
-	if (dir[0] == '\0')
-		return false;
-
-	if (stat(dir, &sbuf) != 0)
-		return false;
-
-	/* Must be a directory */
-	if ((sbuf.st_mode & S_IFMT) != S_IFDIR)
-		return false;
-
-	/* Must be writable */
-	if (access(dir, W_OK) != 0)
-		return false;
-
-	return true;
-}
-
-/** Construct unique file name.
- *
- * Never use this function.
- *
- * @param dir Path to directory, where the file should be created.
- * @param pfx Optional prefix up to 5 characters long.
- * @return Newly allocated unique path for temporary file. NULL on failure.
- */
-char *tempnam(const char *dir, const char *pfx)
-{
-	const char *dpref;
-	char *d;
-	char *buf;
-	int rc;
-
-	d = getenv("TMPDIR");
-	if (is_appropriate_tmpdir(d))
-		dpref = d;
-	else if (is_appropriate_tmpdir(dir))
-		dpref = dir;
-	else if (is_appropriate_tmpdir(P_tmpdir))
-		dpref = P_tmpdir;
-	else
-		dpref = "/";
-
-	if (dpref[strlen(dpref) - 1] != '/')
-		rc = asprintf(&buf, "%s/%sXXXXXX", dpref, pfx);
-	else
-		rc = asprintf(&buf, "%s%sXXXXXX", dpref, pfx);
-
-	if (rc < 0)
-		return NULL;
-
-	rc = __tmpfile_templ(buf, false);
-	if (rc != 0) {
-		free(buf);
-		return NULL;
-	}
-
-	return buf;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/stdlib.c
===================================================================
--- uspace/lib/posix/src/stdlib.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Standard library definitions.
- */
-
-#include "internal/common.h"
-#include <stdlib.h>
-
-#include <errno.h>
-#include <tmpfile.h>
-
-#include <fcntl.h>
-#include <limits.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <qsort.h>
-#include <str.h>
-#include <vfs/vfs.h>
-#include <stats.h>
-
-/**
- *
- * @param name
- * @param resolved
- * @return
- */
-int putenv(char *string)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return 0;
-}
-
-/**
- * Resolve absolute pathname.
- *
- * @param name Pathname to be resolved.
- * @param resolved Either buffer for the resolved absolute pathname or NULL.
- * @return On success, either resolved (if it was not NULL) or pointer to the
- *     newly allocated buffer containing the absolute pathname (if resolved was
- *     NULL). Otherwise NULL.
- *
- */
-char *realpath(const char *restrict name, char *restrict resolved)
-{
-#ifndef PATH_MAX
-	assert(resolved == NULL);
-#endif
-
-	if (name == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-
-	// TODO: symlink resolution
-
-	/*
-	 * Function absolutize is implemented in libc and declared in vfs.h.
-	 * No more processing is required as HelenOS doesn't have symlinks
-	 * so far (as far as I can tell), although this function will need
-	 * to be updated when that support is implemented.
-	 */
-	char *absolute = vfs_absolutize(name, NULL);
-
-	if (absolute == NULL) {
-		/*
-		 * POSIX requires some specific errnos to be set
-		 * for some cases, but there is no way to find out from
-		 * absolutize().
-		 */
-		errno = EINVAL;
-		return NULL;
-	}
-
-	if (resolved == NULL) {
-		return absolute;
-	} else {
-#ifdef PATH_MAX
-		str_cpy(resolved, PATH_MAX, absolute);
-#endif
-		free(absolute);
-		return resolved;
-	}
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @return Double-precision number resulting from the string conversion.
- */
-double atof(const char *nptr)
-{
-	return strtod(nptr, NULL);
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @param endptr Pointer to the final part of the string which
- *     was not used for conversion.
- * @return Single-precision number resulting from the string conversion.
- */
-float strtof(const char *restrict nptr, char **restrict endptr)
-{
-	return (float) strtold(nptr, endptr);
-}
-
-/**
- * Converts a string representation of a floating-point number to
- * its native representation. See strtold().
- *
- * @param nptr String representation of a floating-point number.
- * @param endptr Pointer to the final part of the string which
- *     was not used for conversion.
- * @return Double-precision number resulting from the string conversion.
- */
-double strtod(const char *restrict nptr, char **restrict endptr)
-{
-	return (double) strtold(nptr, endptr);
-}
-
-/**
- * Creates and opens an unique temporary file from template.
- *
- * @param tmpl Template. Last six characters must be XXXXXX.
- * @return The opened file descriptor or -1 on error.
- */
-int mkstemp(char *tmpl)
-{
-	int tmpl_len;
-	int file;
-
-	tmpl_len = strlen(tmpl);
-	if (tmpl_len < 6) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	char *tptr = tmpl + tmpl_len - 6;
-	if (strcmp(tptr, "XXXXXX") != 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	file = __tmpfile_templ(tmpl, true);
-	if (file < 0) {
-		errno = EIO; // XXX could be more specific
-		return -1;
-	}
-
-	return file;
-}
-
-/**
- * Creates an unique temporary file name from template.
- *
- * @param tmpl Template. Last six characters must be XXXXXX.
- * @return The value of tmpl. The template is modified in place.
- *    If no temporary file name can be created, template is
- *    reduced to an empty string.
- */
-char *mktemp(char *tmpl)
-{
-	int tmpl_len;
-	int rc;
-
-	tmpl_len = strlen(tmpl);
-	if (tmpl_len < 6) {
-		errno = EINVAL;
-		*tmpl = '\0';
-		return tmpl;
-	}
-
-	char *tptr = tmpl + tmpl_len - 6;
-	if (strcmp(tptr, "XXXXXX") != 0) {
-		errno = EINVAL;
-		*tmpl = '\0';
-		return tmpl;
-	}
-
-	rc = __tmpfile_templ(tmpl, false);
-	if (rc != 0) {
-		errno = EIO; // XXX could be more specific
-		*tmpl = '\0';
-		return tmpl;
-	}
-
-	return tmpl;
-}
-
-/**
- * Get system load average statistics.
- *
- * @param loadavg Array where the load averages shall be placed.
- * @param nelem Maximum number of elements to be placed into the array.
- * @return Number of elements placed into the array on success, -1 otherwise.
- */
-int bsd_getloadavg(double loadavg[], int nelem)
-{
-	assert(nelem > 0);
-
-	size_t count;
-	load_t *loads = stats_get_load(&count);
-
-	if (loads == NULL) {
-		return -1;
-	}
-
-	if (((size_t) nelem) < count) {
-		count = nelem;
-	}
-
-	for (size_t i = 0; i < count; ++i) {
-		loadavg[i] = (double) loads[i];
-	}
-
-	free(loads);
-	return count;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/string.c
===================================================================
--- uspace/lib/posix/src/string.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,242 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file String manipulation.
- */
-
-#include "internal/common.h"
-#include <string.h>
-
-#include <assert.h>
-
-#include <errno.h>
-
-#include <limits.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <str.h>
-#include <str_error.h>
-
-/**
- * Copy a string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @return Pointer to the nul character in the destination string.
- */
-char *stpcpy(char *restrict dest, const char *restrict src)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	for (size_t i = 0; ; ++i) {
-		dest[i] = src[i];
-
-		if (src[i] == '\0') {
-			/* pointer to the terminating nul character */
-			return &dest[i];
-		}
-	}
-
-	/* unreachable */
-	return NULL;
-}
-
-/**
- * Copy fixed length string.
- *
- * @param dest Destination pre-allocated buffer.
- * @param src Source string to be copied.
- * @param n Number of bytes to be stored into destination buffer.
- * @return Pointer to the first written nul character or &dest[n].
- */
-char *stpncpy(char *restrict dest, const char *restrict src, size_t n)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	for (size_t i = 0; i < n; ++i) {
-		dest[i] = src[i];
-
-		/*
-		 * the standard requires that nul characters
-		 * are appended to the length of n, in case src is shorter
-		 */
-		if (src[i] == '\0') {
-			char *result = &dest[i];
-			for (++i; i < n; ++i) {
-				dest[i] = '\0';
-			}
-			return result;
-		}
-	}
-
-	return &dest[n];
-}
-
-/**
- * Copy limited number of bytes in memory.
- *
- * @param dest Destination buffer.
- * @param src Source buffer.
- * @param c Character after which the copying shall stop.
- * @param n Number of bytes that shall be copied if not stopped earlier by c.
- * @return Pointer to the first byte after c in dest if found, NULL otherwise.
- */
-void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
-{
-	assert(dest != NULL);
-	assert(src != NULL);
-
-	unsigned char *bdest = dest;
-	const unsigned char *bsrc = src;
-
-	for (size_t i = 0; i < n; ++i) {
-		bdest[i] = bsrc[i];
-
-		if (bsrc[i] == (unsigned char) c) {
-			/* pointer to the next byte */
-			return &bdest[i + 1];
-		}
-	}
-
-	return NULL;
-}
-
-/**
- * Scan string for a first occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success, pointer to the
- *     string terminator otherwise.
- */
-char *gnu_strchrnul(const char *s, int c)
-{
-	assert(s != NULL);
-
-	while (*s != c && *s != '\0') {
-		s++;
-	}
-
-	return (char *) s;
-}
-
-/** Split string by delimiters.
- *
- * @param s             String to be tokenized. May not be NULL.
- * @param delim		String with the delimiters.
- * @param next		Variable which will receive the pointer to the
- *                      continuation of the string following the first
- *                      occurrence of any of the delimiter characters.
- *                      May be NULL.
- * @return              Pointer to the prefix of @a s before the first
- *                      delimiter character. NULL if no such prefix
- *                      exists.
- */
-char *strtok_r(char *s, const char *delim, char **next)
-{
-	return __strtok_r(s, delim, next);
-}
-
-/**
- * Get error message string.
- *
- * @param errnum Error code for which to obtain human readable string.
- * @param buf Buffer to store a human readable string to.
- * @param bufsz Size of buffer pointed to by buf.
- * @return Zero on success, errno otherwise.
- */
-int strerror_r(int errnum, char *buf, size_t bufsz)
-{
-	assert(buf != NULL);
-
-	char *errstr = strerror(errnum);
-
-	if (strlen(errstr) + 1 > bufsz) {
-		return ERANGE;
-	} else {
-		strcpy(buf, errstr);
-	}
-
-	return EOK;
-}
-
-/**
- * Get description of a signal.
- *
- * @param signum Signal number.
- * @return Human readable signal description.
- */
-char *strsignal(int signum)
-{
-	static const char *const sigstrings[] = {
-		[SIGABRT] = "SIGABRT (Process abort signal)",
-		[SIGALRM] = "SIGALRM (Alarm clock)",
-		[SIGBUS] = "SIGBUS (Access to an undefined portion of a memory object)",
-		[SIGCHLD] = "SIGCHLD (Child process terminated, stopped, or continued)",
-		[SIGCONT] = "SIGCONT (Continue executing, if stopped)",
-		[SIGFPE] = "SIGFPE (Erroneous arithmetic operation)",
-		[SIGHUP] = "SIGHUP (Hangup)",
-		[SIGILL] = "SIGILL (Illegal instruction)",
-		[SIGINT] = "SIGINT (Terminal interrupt signal)",
-		[SIGKILL] = "SIGKILL (Kill process)",
-		[SIGPIPE] = "SIGPIPE (Write on a pipe with no one to read it)",
-		[SIGQUIT] = "SIGQUIT (Terminal quit signal)",
-		[SIGSEGV] = "SIGSEGV (Invalid memory reference)",
-		[SIGSTOP] = "SIGSTOP (Stop executing)",
-		[SIGTERM] = "SIGTERM (Termination signal)",
-		[SIGTSTP] = "SIGTSTP (Terminal stop signal)",
-		[SIGTTIN] = "SIGTTIN (Background process attempting read)",
-		[SIGTTOU] = "SIGTTOU (Background process attempting write)",
-		[SIGUSR1] = "SIGUSR1 (User-defined signal 1)",
-		[SIGUSR2] = "SIGUSR2 (User-defined signal 2)",
-		[SIGPOLL] = "SIGPOLL (Pollable event)",
-		[SIGPROF] = "SIGPROF (Profiling timer expired)",
-		[SIGSYS] = "SIGSYS (Bad system call)",
-		[SIGTRAP] = "SIGTRAP (Trace/breakpoint trap)",
-		[SIGURG] = "SIGURG (High bandwidth data is available at a socket)",
-		[SIGVTALRM] = "SIGVTALRM (Virtual timer expired)",
-		[SIGXCPU] = "SIGXCPU (CPU time limit exceeded)",
-		[SIGXFSZ] = "SIGXFSZ (File size limit exceeded)"
-	};
-
-	if (signum <= _TOP_SIGNAL) {
-		return (char *) sigstrings[signum];
-	}
-
-	return (char *) "ERROR, Invalid signal number";
-}
-
-/** @}
- */
Index: pace/lib/posix/src/strings.c
===================================================================
--- uspace/lib/posix/src/strings.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Additional string manipulation.
- */
-
-#include "internal/common.h"
-#include <strings.h>
-
-#include <string.h>
-#include <ctype.h>
-
-#include <mem.h>
-#include <str.h>
-
-/**
- * Find first set bit (beginning with the least significant bit).
- *
- * @param i Integer in which to look for the first set bit.
- * @return Index of first set bit. Bits are numbered starting at one.
- */
-int ffs(int i)
-{
-	if (i == 0) {
-		return 0;
-	}
-
-	int result = 0;
-
-	// XXX: assumes at most 32-bit int
-	if (!(i & 0xFFFF)) {
-		result |= 16;
-		i >>= 16;
-	}
-	if (!(i & 0xFF)) {
-		result |= 8;
-		i >>= 8;
-	}
-	if (!(i & 0xF)) {
-		result |= 4;
-		i >>= 4;
-	}
-	if (!(i & 0x3)) {
-		result |= 2;
-		i >>= 2;
-	}
-	if (!(i & 0x1)) {
-		result |= 1;
-	}
-
-	return result + 1;
-}
-
-/**
- * Compare two strings (case-insensitive).
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strcasecmp(const char *s1, const char *s2)
-{
-	return strncasecmp(s1, s2, STR_NO_LIMIT);
-}
-
-/**
- * Compare part of two strings (case-insensitive).
- *
- * @param s1 First string to be compared.
- * @param s2 Second string to be compared.
- * @param n Maximum number of characters to be compared.
- * @return Difference of the first pair of inequal characters,
- *     or 0 if strings have the same content.
- */
-int strncasecmp(const char *s1, const char *s2, size_t n)
-{
-	for (size_t i = 0; i < n; ++i) {
-		int cmp = tolower(s1[i]) - tolower(s2[i]);
-		if (cmp != 0) {
-			return cmp;
-		}
-
-		if (s1[i] == 0) {
-			return 0;
-		}
-	}
-
-	return 0;
-}
-
-/**
- * Compare two memory areas.
- *
- * @param mem1 Pointer to the first area to compare.
- * @param mem2 Pointer to the second area to compare.
- * @param n Common size of both areas.
- * @return If n is 0, return zero. If the areas match, return
- *     zero. Otherwise return non-zero.
- */
-int bcmp(const void *mem1, const void *mem2, size_t n)
-{
-	return memcmp(mem1, mem2, n);
-}
-
-/**
- * Copy bytes in memory with overlapping areas.
- *
- * @param src Source area.
- * @param dest Destination area.
- * @param n Number of bytes to copy.
- */
-void bcopy(const void *src, void *dest, size_t n)
-{
-	/* Note that memmove has different order of arguments. */
-	memmove(dest, src, n);
-}
-
-/**
- * Reset bytes in memory area to zero.
- *
- * @param mem Memory area to be zeroed.
- * @param n Number of bytes to reset.
- */
-void bzero(void *mem, size_t n)
-{
-	memset(mem, 0, n);
-}
-
-/**
- * Scan string for a first occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *index(const char *s, int c)
-{
-	return strchr(s, c);
-}
-
-/**
- * Scan string for a last occurence of a character.
- *
- * @param s String in which to look for the character.
- * @param c Character to look for.
- * @return Pointer to the specified character on success,
- *     NULL pointer otherwise.
- */
-char *rindex(const char *s, int c)
-{
-	return strrchr(s, c);
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/mman.c
===================================================================
--- uspace/lib/posix/src/sys/mman.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file
- */
-
-#include "../internal/common.h"
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <as.h>
-#include <unistd.h>
-
-static int _prot_to_as(int prot)
-{
-	int ret = 0;
-
-	if (prot & PROT_READ)
-		ret |= AS_AREA_READ;
-
-	if (prot & PROT_WRITE)
-		ret |= AS_AREA_WRITE;
-
-	if (prot & PROT_EXEC)
-		ret |= AS_AREA_EXEC;
-
-	return ret;
-}
-
-void *mmap(void *start, size_t length, int prot, int flags, int fd,
-    off_t offset)
-{
-	if (!start)
-		start = AS_AREA_ANY;
-
-#if 0
-	if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
-		return MAP_FAILED;
-#endif
-
-	if (!(flags & MAP_ANONYMOUS))
-		return MAP_FAILED;
-
-	return as_area_create(start, length, _prot_to_as(prot), AS_AREA_UNPAGED);
-}
-
-int munmap(void *start, size_t length)
-{
-	int rc = as_area_destroy(start);
-	if (rc != EOK) {
-		errno = rc;
-		return -1;
-	}
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/stat.c
===================================================================
--- uspace/lib/posix/src/sys/stat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file File status handling.
- */
-
-#include "../internal/common.h"
-#include <sys/stat.h>
-#include <vfs/vfs.h>
-
-#include <errno.h>
-#include <mem.h>
-
-/**
- * Convert HelenOS stat struct into POSIX stat struct (if possible).
- *
- * @param dest POSIX stat struct.
- * @param src HelenOS stat struct.
- *
- * @return 0 on success, -1 on error.
- */
-static int stat_to_posix(struct stat *dest, vfs_stat_t *src)
-{
-	memset(dest, 0, sizeof(struct stat));
-
-	dest->st_dev = src->service;
-	dest->st_ino = src->index;
-
-	/* HelenOS doesn't support permissions, so we set them all */
-	dest->st_mode = S_IRWXU | S_IRWXG | S_IRWXO;
-	if (src->is_file) {
-		dest->st_mode |= S_IFREG;
-	}
-	if (src->is_directory) {
-		dest->st_mode |= S_IFDIR;
-	}
-
-	dest->st_nlink = src->lnkcnt;
-	dest->st_size = src->size;
-
-	if (src->size > INT64_MAX) {
-		errno = ERANGE;
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * Retrieve file status for file associated with file descriptor.
- *
- * @param fd File descriptor of the opened file.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int fstat(int fd, struct stat *st)
-{
-	vfs_stat_t hst;
-	if (failed(vfs_stat(fd, &hst)))
-		return -1;
-	return stat_to_posix(st, &hst);
-}
-
-/**
- * Retrieve file status for symbolic link.
- *
- * @param path Path to the symbolic link.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int lstat(const char *restrict path, struct stat *restrict st)
-{
-	/* There are currently no symbolic links in HelenOS. */
-	return stat(path, st);
-}
-
-/**
- * Retrieve file status for regular file (or symbolic link target).
- *
- * @param path Path to the file/link.
- * @param st Status structure to be filled with information.
- * @return Zero on success, -1 otherwise.
- */
-int stat(const char *restrict path, struct stat *restrict st)
-{
-	vfs_stat_t hst;
-	if (failed(vfs_stat_path(path, &hst)))
-		return -1;
-	return stat_to_posix(st, &hst);
-}
-
-/**
- * Change permission bits for the file if possible.
- *
- * @param path Path to the file.
- * @param mode Permission bits to be set.
- * @return Zero on success, -1 otherwise.
- */
-int chmod(const char *path, mode_t mode)
-{
-	/* HelenOS doesn't support permissions, return success. */
-	return 0;
-}
-
-/**
- * Set the file mode creation mask of the process.
- *
- * @param mask Set permission bits are cleared in the related creation
- *     functions. Non-permission bits are ignored.
- * @return Previous file mode creation mask.
- */
-mode_t umask(mode_t mask)
-{
-	/* HelenOS doesn't support permissions, return empty mask. */
-	return 0;
-}
-
-/**
- * Create a directory.
- *
- * @param path Path to the new directory.
- * @param mode Permission bits to be set.
- * @return Zero on success, -1 otherwise.
- */
-int mkdir(const char *path, mode_t mode)
-{
-	if (failed(vfs_link_path(path, KIND_DIRECTORY, NULL)))
-		return -1;
-	else
-		return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/sys/wait.c
===================================================================
--- uspace/lib/posix/src/sys/wait.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Support for waiting.
- */
-
-#include "../internal/common.h"
-#include <sys/wait.h>
-
-#include <task.h>
-#include <assert.h>
-
-#include <errno.h>
-
-#include <limits.h>
-#include <signal.h>
-
-int __posix_wifexited(int status)
-{
-	return status != INT_MIN;
-}
-
-int __posix_wexitstatus(int status)
-{
-	assert(__posix_wifexited(status));
-	return status;
-}
-
-int __posix_wifsignaled(int status)
-{
-	return status == INT_MIN;
-}
-
-int __posix_wtermsig(int status)
-{
-	assert(__posix_wifsignaled(status));
-	/*
-	 * There is no way to distinguish reason
-	 * for unexpected termination at the moment.
-	 */
-	return SIGABRT;
-}
-
-/**
- * Wait for any child process to stop or terminate.
- *
- * @param stat_ptr Location of the final status code of the child process.
- * @return ID of the child process for which status is reported,
- *     -1 on signal interrupt, (pid_t)-1 otherwise.
- */
-pid_t wait(int *stat_ptr)
-{
-	/* HelenOS does not support this. */
-	errno = ENOSYS;
-	return (pid_t) -1;
-}
-
-/**
- * Wait for a child process to stop or terminate.
- *
- * @param pid What child process shall the caller wait for. See POSIX manual
- *     for details.
- * @param stat_ptr Location of the final status code of the child process.
- * @param options Constraints of the waiting. See POSIX manual for details.
- * @return ID of the child process for which status is reported,
- *     -1 on signal interrupt, 0 if non-blocking wait is requested but there is
- *     no child process whose status can be reported, (pid_t)-1 otherwise.
- */
-pid_t waitpid(pid_t pid, int *stat_ptr, int options)
-{
-	assert(stat_ptr != NULL);
-	assert(options == 0 /* None of the options are supported. */);
-
-	task_exit_t texit;
-	int retval;
-
-	if (failed(task_wait_task_id((task_id_t) pid, &texit, &retval))) {
-		/* Unable to retrieve status. */
-		return (pid_t) -1;
-	}
-
-	if (texit == TASK_EXIT_NORMAL) {
-		// FIXME: relies on application not returning this value
-		assert(retval != INT_MIN);
-		*stat_ptr = retval;
-	} else {
-		/* Reserve the lowest value for unexpected termination. */
-		*stat_ptr = INT_MIN;
-	}
-
-	return pid;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/time.c
===================================================================
--- uspace/lib/posix/src/time.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,323 +1,0 @@
-/*
- * Copyright (c) 2011 Petr Koupy
- * Copyright (c) 2011 Jiri Zarevucky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Time measurement support.
- */
-
-#include "internal/common.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include <ctype.h>
-
-#include <errno.h>
-
-#include <signal.h>
-#include <assert.h>
-
-#include <fibril.h>
-#include <stdlib.h>
-#include <task.h>
-#include <stddef.h>
-
-// TODO: test everything in this file
-
-/*
- * In some places in this file, phrase "normalized broken-down time" is used.
- * This means time broken down to components (year, month, day, hour, min, sec),
- * in which every component is in its proper bounds. Non-normalized time could
- * e.g. be 2011-54-5 29:13:-5, which would semantically mean start of year 2011
- * + 53 months + 4 days + 29 hours + 13 minutes - 5 seconds.
- */
-
-int posix_daylight;
-long posix_timezone;
-char *posix_tzname[2];
-
-/**
- * Set timezone conversion information.
- */
-void tzset(void)
-{
-	// TODO: read environment
-	posix_tzname[0] = (char *) "GMT";
-	posix_tzname[1] = (char *) "GMT";
-	posix_daylight = 0;
-	posix_timezone = 0;
-}
-
-/**
- * Converts a time value to a broken-down UTC time.
- *
- * @param timer Time to convert.
- * @param result Structure to store the result to.
- * @return Value of result on success, NULL on overflow.
- */
-struct tm *gmtime_r(const time_t *restrict timer,
-    struct tm *restrict result)
-{
-	if (failed(time_utc2tm(*timer, result))) {
-		return NULL;
-	}
-
-	return result;
-}
-
-/**
- * Converts a time value to a broken-down UTC time.
- * (non reentrant version)
- *
- * @param timep  Time to convert
- * @return       Pointer to a statically allocated structure that stores
- *               the result, NULL in case of error.
- */
-struct tm *gmtime(const time_t *restrict timep)
-{
-	static struct tm result;
-
-	return gmtime_r(timep, &result);
-}
-
-/**
- * Converts a time value to a broken-down local time.
- *
- * @param timer Time to convert.
- * @param result Structure to store the result to.
- * @return Value of result on success, NULL on overflow.
- */
-struct tm *localtime_r(const time_t *restrict timer,
-    struct tm *restrict result)
-{
-	// TODO: deal with timezone
-	// currently assumes system and all times are in GMT
-	return gmtime_r(timer, result);
-}
-
-/**
- * Converts a time value to a broken-down local time.
- * (non reentrant version)
- *
- * @param timep    Time to convert.
- * @return         Pointer to a statically allocated structure that stores
- *                 the result, NULL in case of error.
- */
-struct tm *localtime(const time_t *restrict timep)
-{
-	static struct tm result;
-
-	return localtime_r(timep, &result);
-}
-
-/**
- * Converts broken-down time to a string in format
- * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
- *
- * @param timeptr Broken-down time structure.
- * @param buf Buffer to store string to, must be at least ASCTIME_BUF_LEN
- *     bytes long.
- * @return Value of buf.
- */
-char *asctime_r(const struct tm *restrict timeptr,
-    char *restrict buf)
-{
-	time_tm2str(timeptr, buf);
-	return buf;
-}
-
-/**
- * Convers broken-down time to a string in format
- * "Sun Jan 1 00:00:00 1970\n". (Obsolete)
- * (non reentrant version)
- *
- * @param timeptr    Broken-down time structure.
- * @return           Pointer to a statically allocated buffer that stores
- *                   the result, NULL in case of error.
- */
-char *asctime(const struct tm *restrict timeptr)
-{
-	static char buf[ASCTIME_BUF_LEN];
-
-	return asctime_r(timeptr, buf);
-}
-
-/**
- * Converts the calendar time to a string in format
- * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
- *
- * @param timer Time to convert.
- * @param buf Buffer to store string to. Must be at least ASCTIME_BUF_LEN
- *     bytes long.
- * @return Pointer to buf on success, NULL on failure.
- */
-char *ctime_r(const time_t *timer, char *buf)
-{
-	if (failed(time_local2str(*timer, buf))) {
-		return NULL;
-	}
-
-	return buf;
-}
-
-/**
- * Converts the calendar time to a string in format
- * "Sun Jan 1 00:00:00 1970\n" (Obsolete)
- * (non reentrant version)
- *
- * @param timep    Time to convert.
- * @return         Pointer to a statically allocated buffer that stores
- *                 the result, NULL in case of error.
- */
-char *ctime(const time_t *timep)
-{
-	static char buf[ASCTIME_BUF_LEN];
-
-	return ctime_r(timep, buf);
-}
-
-/**
- * Get clock resolution. Only CLOCK_REALTIME is supported.
- *
- * @param clock_id Clock ID.
- * @param res Pointer to the variable where the resolution is to be written.
- * @return 0 on success, -1 with errno set on failure.
- */
-int clock_getres(clockid_t clock_id, struct timespec *res)
-{
-	assert(res != NULL);
-
-	switch (clock_id) {
-	case CLOCK_REALTIME:
-		res->tv_sec = 0;
-		res->tv_nsec = USEC2NSEC(1); /* Microsecond resolution. */
-		return 0;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Get time. Only CLOCK_REALTIME is supported.
- *
- * @param clock_id ID of the clock to query.
- * @param tp Pointer to the variable where the time is to be written.
- * @return 0 on success, -1 with errno on failure.
- */
-int clock_gettime(clockid_t clock_id, struct timespec *tp)
-{
-	struct timeval tv;
-
-	assert(tp != NULL);
-
-	switch (clock_id) {
-	case CLOCK_REALTIME:
-		gettimeofday(&tv, NULL);
-		tp->tv_sec = tv.tv_sec;
-		tp->tv_nsec = USEC2NSEC(tv.tv_usec);
-		return 0;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Set time on a specified clock. As HelenOS doesn't support this yet,
- * this function always fails.
- *
- * @param clock_id ID of the clock to set.
- * @param tp Time to set.
- * @return 0 on success, -1 with errno on failure.
- */
-int clock_settime(clockid_t clock_id,
-    const struct timespec *tp)
-{
-	assert(tp != NULL);
-
-	switch (clock_id) {
-	case CLOCK_REALTIME:
-		// TODO: setting clock
-		// FIXME: HelenOS doesn't actually support hardware
-		//        clock yet
-		errno = EPERM;
-		return -1;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Sleep on a specified clock.
- *
- * @param clock_id ID of the clock to sleep on (only CLOCK_REALTIME supported).
- * @param flags Flags (none supported).
- * @param rqtp Sleep time.
- * @param rmtp Remaining time is written here if sleep is interrupted.
- * @return 0 on success, -1 with errno set on failure.
- */
-int clock_nanosleep(clockid_t clock_id, int flags,
-    const struct timespec *rqtp, struct timespec *rmtp)
-{
-	assert(rqtp != NULL);
-	assert(rmtp != NULL);
-
-	switch (clock_id) {
-	case CLOCK_REALTIME:
-		// TODO: interruptible sleep
-		if (rqtp->tv_sec != 0) {
-			fibril_sleep(rqtp->tv_sec);
-		}
-		if (rqtp->tv_nsec != 0) {
-			fibril_usleep(NSEC2USEC(rqtp->tv_nsec));
-		}
-		return 0;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-int gettimeofday(struct timeval *tv, void *tz)
-{
-	struct timespec ts;
-
-	getrealtime(&ts);
-	tv->tv_sec = ts.tv_sec;
-	tv->tv_usec = NSEC2USEC(ts.tv_nsec);
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/src/unistd.c
===================================================================
--- uspace/lib/posix/src/unistd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,549 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Zarevucky
- * Copyright (c) 2011 Petr Koupy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libposix
- * @{
- */
-/** @file Miscellaneous standard definitions.
- */
-
-#define _LARGEFILE64_SOURCE
-#undef _FILE_OFFSET_BITS
-
-#include "internal/common.h"
-#include <unistd.h>
-
-#include <errno.h>
-
-#include <dirent.h>
-#include <string.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include <fibril.h>
-#include <task.h>
-#include <stats.h>
-#include <stdlib.h>
-#include <vfs/vfs.h>
-
-#include <libarch/config.h>
-
-// FIXME: replace with a hash table
-aoff64_t posix_pos[VFS_MAX_OPEN_FILES];
-
-/* Array of environment variable strings (NAME=VALUE). */
-char **environ = NULL;
-
-/**
- * Sleep for the specified number of seconds.
- *
- * Note that POSIX allows this call to be interrupted and then the return
- * value represents remaining seconds for the sleep. HelenOS does not offer
- * such functionality and thus always the whole sleep is taken.
- *
- * @param seconds Number of seconds to sleep.
- * @return Always 0 on HelenOS.
- */
-unsigned int sleep(unsigned int seconds)
-{
-	fibril_sleep(seconds);
-	return 0;
-}
-
-/**
- * Get current user name.
- *
- * @return User name (static) string or NULL if not found.
- */
-char *getlogin(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return (char *) "user";
-}
-
-/**
- * Get current user name.
- *
- * @param name Pointer to a user supplied buffer.
- * @param namesize Length of the buffer.
- * @return Zero on success, error code otherwise.
- */
-int getlogin_r(char *name, size_t namesize)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	if (namesize >= 5) {
-		strcpy(name, (char *) "user");
-		return 0;
-	} else {
-		errno = ERANGE;
-		return -1;
-	}
-}
-
-/**
- * Test whether open file descriptor is associated with a terminal.
- *
- * @param fd Open file descriptor to test.
- * @return Boolean result of the test.
- */
-int isatty(int fd)
-{
-	// TODO
-	/*
-	 * Always returns false, because there is no easy way to find
-	 * out under HelenOS.
-	 */
-	return 0;
-}
-
-/**
- * Get the pathname of the current working directory.
- *
- * @param buf Buffer into which the pathname shall be put.
- * @param size Size of the buffer.
- * @return Buffer pointer on success, NULL on failure.
- */
-char *getcwd(char *buf, size_t size)
-{
-	if (failed(vfs_cwd_get(buf, size)))
-		return NULL;
-	return buf;
-}
-
-/**
- * Change the current working directory.
- *
- * @param path New working directory.
- */
-int chdir(const char *path)
-{
-	if (failed(vfs_cwd_set(path)))
-		return -1;
-	return 0;
-}
-
-/**
- * Determine the page size of the current run of the process.
- *
- * @return Page size of the process.
- */
-int getpagesize(void)
-{
-	return PAGE_SIZE;
-}
-
-/**
- * Get the process ID of the calling process.
- *
- * @return Process ID.
- */
-pid_t getpid(void)
-{
-	return task_get_id();
-}
-
-/**
- * Get the real user ID of the calling process.
- *
- * @return User ID.
- */
-uid_t getuid(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return 0;
-}
-
-/**
- * Get the real group ID of the calling process.
- *
- * @return Group ID.
- */
-gid_t getgid(void)
-{
-	/* There is currently no support for user accounts in HelenOS. */
-	return 0;
-}
-
-/**
- * Close a file.
- *
- * @param fildes File descriptor of the opened file.
- * @return 0 on success, -1 on error.
- */
-int close(int fildes)
-{
-	posix_pos[fildes] = 0;
-	if (failed(vfs_put(fildes)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Read from a file.
- *
- * @param fildes File descriptor of the opened file.
- * @param buf Buffer to which the read bytes shall be stored.
- * @param nbyte Upper limit on the number of read bytes.
- * @return Number of read bytes on success, -1 otherwise.
- */
-ssize_t read(int fildes, void *buf, size_t nbyte)
-{
-	size_t nread;
-	if (failed(vfs_read(fildes, &posix_pos[fildes], buf, nbyte, &nread)))
-		return -1;
-	return (ssize_t) nread;
-}
-
-/**
- * Write to a file.
- *
- * @param fildes File descriptor of the opened file.
- * @param buf Buffer to write.
- * @param nbyte Size of the buffer.
- * @return Number of written bytes on success, -1 otherwise.
- */
-ssize_t write(int fildes, const void *buf, size_t nbyte)
-{
-	size_t nwr;
-	if (failed(vfs_write(fildes, &posix_pos[fildes], buf, nbyte, &nwr)))
-		return -1;
-	return nwr;
-}
-
-static off64_t _lseek(int fildes, off64_t offset, off64_t max_pos, int whence)
-{
-	vfs_stat_t st;
-	off64_t new_pos;
-
-	switch (whence) {
-	case SEEK_SET:
-		new_pos = offset;
-		break;
-	case SEEK_CUR:
-		if (__builtin_add_overflow(posix_pos[fildes], offset, &new_pos)) {
-			errno = EOVERFLOW;
-			return -1;
-		}
-		break;
-	case SEEK_END:
-		if (failed(vfs_stat(fildes, &st)))
-			return -1;
-
-		if (__builtin_add_overflow(st.size, offset, &new_pos)) {
-			errno = EOVERFLOW;
-			return -1;
-		}
-		break;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (new_pos < 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (new_pos > max_pos) {
-		/* The resulting file offset is too large for the interface. */
-		errno = EOVERFLOW;
-		return -1;
-	}
-
-	posix_pos[fildes] = new_pos;
-	return new_pos;
-}
-
-static off64_t _lseek64(int fildes, off64_t offset, int whence)
-{
-	return _lseek(fildes, offset, INT64_MAX, whence);
-}
-
-off64_t lseek64(int fildes, off64_t offset, int whence)
-{
-	return _lseek64(fildes, offset, whence);
-}
-
-/**
- * Reposition read/write file offset
- *
- * @param fildes File descriptor of the opened file.
- * @param offset New offset in the file.
- * @param whence The position from which the offset argument is specified.
- * @return Upon successful completion, returns the resulting offset
- *         as measured in bytes from the beginning of the file, -1 otherwise.
- */
-off_t lseek(int fildes, off_t offset, int whence)
-{
-#if LONG_MAX == INT_MAX
-	return _lseek(fildes, offset, LONG_MAX, whence);
-#else
-	return _lseek64(fildes, offset, whence);
-#endif
-}
-
-/**
- * Requests outstanding data to be written to the underlying storage device.
- *
- * @param fildes File descriptor of the opened file.
- * @return Zero on success, -1 otherwise.
- */
-int fsync(int fildes)
-{
-	if (failed(vfs_sync(fildes)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Truncate a file to a specified length.
- *
- * @param fildes File descriptor of the opened file.
- * @param length New length of the file.
- * @return Zero on success, -1 otherwise.
- */
-int ftruncate(int fildes, off_t length)
-{
-	return ftruncate64(fildes, length);
-}
-
-int ftruncate64(int fildes, off64_t length)
-{
-	if (failed(vfs_resize(fildes, (aoff64_t) length)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Remove a directory.
- *
- * @param path Directory pathname.
- * @return Zero on success, -1 otherwise.
- */
-int rmdir(const char *path)
-{
-	if (failed(vfs_unlink_path(path)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Remove a link to a file.
- *
- * @param path File pathname.
- * @return Zero on success, -1 otherwise.
- */
-int unlink(const char *path)
-{
-	if (failed(vfs_unlink_path(path)))
-		return -1;
-	else
-		return 0;
-}
-
-/**
- * Duplicate an open file descriptor.
- *
- * @param fildes File descriptor to be duplicated.
- * @return On success, new file descriptor for the same file, otherwise -1.
- */
-int dup(int fildes)
-{
-	return fcntl(fildes, F_DUPFD, 0);
-}
-
-/**
- * Duplicate an open file descriptor.
- *
- * @param fildes File descriptor to be duplicated.
- * @param fildes2 File descriptor to be paired with the same file description
- *     as is paired fildes.
- * @return fildes2 on success, -1 otherwise.
- */
-int dup2(int fildes, int fildes2)
-{
-	int file;
-	if (failed(vfs_clone(fildes, fildes2, false, &file))) {
-		return -1;
-	}
-	return file;
-}
-
-/**
- * Determine accessibility of a file.
- *
- * @param path File to check accessibility for.
- * @param amode Either check for existence or intended access mode.
- * @return Zero on success, -1 otherwise.
- */
-int access(const char *path, int amode)
-{
-	if (amode == F_OK || (amode & (X_OK | W_OK | R_OK))) {
-		/*
-		 * HelenOS doesn't support permissions, permission checks
-		 * are equal to existence check.
-		 *
-		 * Check file existence by attempting to open it.
-		 */
-		int fd = open(path, O_RDONLY);
-		if (fd >= 0) {
-			close(fd);
-			return 0;
-		}
-		DIR *dir = opendir(path);
-		if (dir != NULL) {
-			closedir(dir);
-			return 0;
-		}
-		return -1;
-	} else {
-		/* Invalid amode argument. */
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- * Get configurable system variables.
- *
- * @param name Variable name.
- * @return Variable value.
- */
-long sysconf(int name)
-{
-	long clk_tck = 0;
-	size_t cpu_count = 0;
-	stats_cpu_t *cpu_stats = stats_get_cpus(&cpu_count);
-	if (cpu_stats && cpu_count > 0) {
-		clk_tck = ((long) cpu_stats[0].frequency_mhz) * 1000000L;
-	}
-	if (cpu_stats) {
-		free(cpu_stats);
-		cpu_stats = 0;
-	}
-
-	long phys_pages = 0;
-	long avphys_pages = 0;
-	stats_physmem_t *mem_stats = stats_get_physmem();
-	if (mem_stats) {
-		phys_pages = (long) (mem_stats->total / getpagesize());
-		avphys_pages = (long) (mem_stats->free / getpagesize());
-		free(mem_stats);
-		mem_stats = 0;
-	}
-
-	switch (name) {
-	case _SC_PHYS_PAGES:
-		return phys_pages;
-	case _SC_AVPHYS_PAGES:
-		return avphys_pages;
-	case _SC_PAGESIZE:
-		return getpagesize();
-	case _SC_CLK_TCK:
-		return clk_tck;
-	default:
-		errno = EINVAL;
-		return -1;
-	}
-}
-
-/**
- *
- * @param path
- * @param name
- * @return
- */
-long pathconf(const char *path, int name)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- *
- * @return
- */
-pid_t fork(void)
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- *
- * @param path
- * @param argv
- * @return
- */
-int execv(const char *path, char *const argv[])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- *
- * @param file
- * @param argv
- * @return
- */
-int execvp(const char *file, char *const argv[])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-/**
- *
- * @param fildes
- * @return
- */
-int pipe(int fildes[2])
-{
-	// TODO: low priority, just a compile-time dependency of binutils
-	not_implemented();
-	return -1;
-}
-
-unsigned int alarm(unsigned int seconds)
-{
-	not_implemented();
-	return 0;
-}
-
-/** @}
- */
Index: pace/lib/posix/test/main.c
===================================================================
--- uspace/lib/posix/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(stdio);
-PCUT_IMPORT(stdlib);
-PCUT_IMPORT(unistd);
-PCUT_IMPORT(pthread_keys);
-
-PCUT_MAIN();
Index: pace/lib/posix/test/pthread/keys.c
===================================================================
--- uspace/lib/posix/test/pthread/keys.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2025 Matej Volf
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <fibril.h>
-#include <posix/pthread.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(pthread_keys);
-
-pthread_key_t key;
-
-static errno_t simple_fibril(void *_arg)
-{
-	PCUT_ASSERT_INT_EQUALS(0, pthread_setspecific(key, (void *) 0x0d9e));
-	PCUT_ASSERT_PTR_EQUALS((void *) 0x0d9e, pthread_getspecific(key));
-
-	for (int i = 0; i < 10; i++) {
-		fibril_yield();
-	}
-
-	return EOK;
-}
-
-PCUT_TEST(pthread_keys_basic)
-{
-	PCUT_ASSERT_INT_EQUALS(0, pthread_key_create(&key, NULL));
-	PCUT_ASSERT_PTR_EQUALS(NULL, pthread_getspecific(key));
-
-	PCUT_ASSERT_INT_EQUALS(0, pthread_setspecific(key, (void *) 0x42));
-	PCUT_ASSERT_PTR_EQUALS((void *) 0x42, pthread_getspecific(key));
-
-	fid_t other = fibril_create(simple_fibril, NULL);
-	fibril_start(other);
-
-	for (int i = 0; i < 5; i++) {
-		fibril_yield();
-	}
-
-	PCUT_ASSERT_PTR_EQUALS((void *) 0x42, pthread_getspecific(key));
-
-	for (int i = 0; i < 10; i++) {
-		fibril_yield();
-	}
-
-	PCUT_ASSERT_PTR_EQUALS((void *) 0x42, pthread_getspecific(key));
-}
-
-PCUT_EXPORT(pthread_keys);
Index: pace/lib/posix/test/stdio.c
===================================================================
--- uspace/lib/posix/test/stdio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <str.h>
-#include <stdio.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(stdio);
-
-/** tempnam function with directory argument not having trailing slash */
-PCUT_TEST(tempnam_no_slash)
-{
-	char *p;
-	FILE *f;
-
-	p = tempnam("/tmp", "tmp.");
-	PCUT_ASSERT_NOT_NULL(p);
-
-	PCUT_ASSERT_TRUE(str_lcmp(p, "/tmp/tmp.",
-	    str_length("/tmp/tmp.")) == 0);
-
-	f = fopen(p, "w+x");
-	PCUT_ASSERT_NOT_NULL(f);
-
-	(void) remove(p);
-	fclose(f);
-}
-
-/** tempnam function with directory argument having trailing slash */
-PCUT_TEST(tempnam_with_slash)
-{
-	char *p;
-	FILE *f;
-
-	p = tempnam("/tmp/", "tmp.");
-	PCUT_ASSERT_NOT_NULL(p);
-
-	PCUT_ASSERT_TRUE(str_lcmp(p, "/tmp/tmp.",
-	    str_length("/tmp/tmp.")) == 0);
-
-	f = fopen(p, "w+x");
-	PCUT_ASSERT_NOT_NULL(f);
-
-	(void) remove(p);
-	fclose(f);
-}
-
-/** tempnam function with NULL directory argument */
-PCUT_TEST(tempnam_no_dir)
-{
-	char *p;
-	FILE *f;
-
-	p = tempnam(NULL, "tmp.");
-	PCUT_ASSERT_NOT_NULL(p);
-
-	PCUT_ASSERT_TRUE(str_lcmp(p, P_tmpdir "/tmp.",
-	    str_length(P_tmpdir "/tmp.")) == 0);
-
-	f = fopen(p, "w+x");
-	PCUT_ASSERT_NOT_NULL(f);
-
-	(void) remove(p);
-	fclose(f);
-}
-
-PCUT_EXPORT(stdio);
Index: pace/lib/posix/test/stdlib.c
===================================================================
--- uspace/lib/posix/test/stdlib.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <str.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(stdlib);
-
-#define MKSTEMP_TEMPL "/tmp/tmp.XXXXXX"
-#define MKTEMP_BAD_TEMPL "/tmp/tmp.XXXXX"
-#define MKTEMP_SHORT_TEMPL "XXXXX"
-
-/** mktemp function */
-PCUT_TEST(mktemp)
-{
-	int file;
-	char buf[sizeof(MKSTEMP_TEMPL)];
-	char *p;
-
-	str_cpy(buf, sizeof(buf), MKSTEMP_TEMPL);
-
-	p = mktemp(buf);
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(str_lcmp(p, MKSTEMP_TEMPL,
-	    str_length(MKSTEMP_TEMPL) - 6) == 0);
-
-	file = open(p, O_CREAT | O_EXCL | O_RDWR, 0600);
-	PCUT_ASSERT_TRUE(file >= 0);
-	close(file);
-
-	(void) unlink(p);
-}
-
-/** mktemp function called twice should return different names */
-PCUT_TEST(mktemp_twice)
-{
-	char buf1[sizeof(MKSTEMP_TEMPL)];
-	char buf2[sizeof(MKSTEMP_TEMPL)];
-	char *p;
-
-	str_cpy(buf1, sizeof(buf1), MKSTEMP_TEMPL);
-	str_cpy(buf2, sizeof(buf2), MKSTEMP_TEMPL);
-
-	p = mktemp(buf1);
-	PCUT_ASSERT_TRUE(p == buf1);
-	PCUT_ASSERT_TRUE(str_lcmp(p, MKSTEMP_TEMPL,
-	    str_length(MKSTEMP_TEMPL) - 6) == 0);
-
-	p = mktemp(buf2);
-	PCUT_ASSERT_TRUE(p == buf2);
-	PCUT_ASSERT_TRUE(str_lcmp(p, MKSTEMP_TEMPL,
-	    str_length(MKSTEMP_TEMPL) - 6) == 0);
-
-	PCUT_ASSERT_TRUE(str_cmp(buf1, buf2) != 0);
-}
-
-/** mktemp function with malformed template */
-PCUT_TEST(mktemp_bad_templ)
-{
-	char buf[sizeof(MKTEMP_BAD_TEMPL)];
-	char *p;
-
-	str_cpy(buf, sizeof(buf), MKTEMP_BAD_TEMPL);
-
-	p = mktemp(buf);
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(p[0] == '\0');
-}
-
-/** mktemp function with too short template */
-PCUT_TEST(mktemp_short_templ)
-{
-	char buf[sizeof(MKTEMP_SHORT_TEMPL)];
-	char *p;
-
-	str_cpy(buf, sizeof(buf), MKTEMP_SHORT_TEMPL);
-
-	p = mktemp(buf);
-	PCUT_ASSERT_TRUE(p == buf);
-	PCUT_ASSERT_TRUE(p[0] == '\0');
-}
-
-/** mkstemp function */
-PCUT_TEST(mkstemp)
-{
-	int file;
-	char buf[sizeof(MKSTEMP_TEMPL)];
-	ssize_t rc;
-	char c;
-
-	str_cpy(buf, sizeof(buf), MKSTEMP_TEMPL);
-
-	file = mkstemp(buf);
-	PCUT_ASSERT_TRUE(file >= 0);
-
-	(void) unlink(buf);
-
-	c = 'x';
-	rc = write(file, &c, sizeof(c));
-	PCUT_ASSERT_TRUE(rc == sizeof(c));
-
-	(void) lseek(file, 0, SEEK_SET);
-	c = '\0';
-	rc = read(file, &c, sizeof(c));
-	PCUT_ASSERT_TRUE(rc == sizeof(c));
-	PCUT_ASSERT_INT_EQUALS('x', c);
-
-	close(file);
-}
-
-PCUT_EXPORT(stdlib);
Index: pace/lib/posix/test/unistd.c
===================================================================
--- uspace/lib/posix/test/unistd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(unistd);
-
-#define MKSTEMP_TEMPL "/tmp/tmp.XXXXXX"
-#define MKTEMP_BAD_TEMPL "/tmp/tmp.XXXXX"
-#define MKTEMP_SHORT_TEMPL "XXXXX"
-
-/** access function with nonexisting entry */
-PCUT_TEST(access_nonexist)
-{
-	char name[L_tmpnam];
-	char *p;
-	int rc;
-
-	p = tmpnam(name);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = access(name, F_OK);
-	PCUT_ASSERT_INT_EQUALS(-1, rc);
-}
-
-/** access function with file */
-PCUT_TEST(access_file)
-{
-	char name[L_tmpnam];
-	char *p;
-	int file;
-	int rc;
-
-	p = tmpnam(name);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	file = open(name, O_CREAT | O_EXCL | O_RDWR, 0600);
-	PCUT_ASSERT_TRUE(file >= 0);
-
-	rc = access(name, F_OK);
-	PCUT_ASSERT_INT_EQUALS(0, rc);
-
-	(void) unlink(name);
-	close(file);
-}
-
-PCUT_EXPORT(unistd);
Index: pace/lib/riff/doc/doxygroups.h
===================================================================
--- uspace/lib/riff/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libriff libriff
- * @ingroup libs
- */
Index: pace/lib/riff/include/riff/chunk.h
===================================================================
--- uspace/lib/riff/include/riff/chunk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file RIFF chunk.
- */
-
-#ifndef RIFF_CHUNK_H
-#define RIFF_CHUNK_H
-
-#include <errno.h>
-#include <stddef.h>
-#include <types/riff/chunk.h>
-
-extern errno_t riff_wopen(const char *, riffw_t **);
-extern errno_t riff_wclose(riffw_t *);
-extern errno_t riff_wchunk_start(riffw_t *, riff_ckid_t, riff_wchunk_t *);
-extern errno_t riff_wchunk_end(riffw_t *, riff_wchunk_t *);
-extern errno_t riff_write(riffw_t *, void *, size_t);
-extern errno_t riff_write_uint32(riffw_t *, uint32_t);
-
-extern errno_t riff_ropen(const char *, riff_rchunk_t *, riffr_t **);
-extern errno_t riff_rclose(riffr_t *);
-extern errno_t riff_read_uint32(riff_rchunk_t *, uint32_t *);
-extern errno_t riff_rchunk_start(riff_rchunk_t *, riff_rchunk_t *);
-extern errno_t riff_rchunk_match(riff_rchunk_t *, riff_ckid_t, riff_rchunk_t *);
-extern errno_t riff_rchunk_list_match(riff_rchunk_t *, riff_ltype_t,
-    riff_rchunk_t *);
-extern errno_t riff_rchunk_seek(riff_rchunk_t *, long, int);
-extern errno_t riff_rchunk_end(riff_rchunk_t *);
-extern errno_t riff_read(riff_rchunk_t *, void *, size_t, size_t *);
-extern uint32_t riff_rchunk_size(riff_rchunk_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/riff/include/riff/rwave.h
===================================================================
--- uspace/lib/riff/include/riff/rwave.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file Waveform Audio File Format (WAVE).
- */
-
-#ifndef RIFF_RWAVE_H
-#define RIFF_RWAVE_H
-
-#include <errno.h>
-#include <types/riff/rwave.h>
-
-extern errno_t rwave_wopen(const char *, rwave_params_t *params, rwavew_t **);
-extern errno_t rwave_write_samples(rwavew_t *, void *, size_t);
-extern errno_t rwave_wclose(rwavew_t *);
-
-extern errno_t rwave_ropen(const char *, rwave_params_t *params, rwaver_t **);
-extern errno_t rwave_read_samples(rwaver_t *, void *, size_t, size_t *);
-extern errno_t rwave_rclose(rwaver_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/riff/include/types/riff/chunk.h
===================================================================
--- uspace/lib/riff/include/types/riff/chunk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file RIFF chunk types.
- */
-
-#ifndef RIFF_TYPES_CHUNK_H
-#define RIFF_TYPES_CHUNK_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-typedef uint32_t riff_ckid_t;
-typedef uint32_t riff_cksize_t;
-typedef uint32_t riff_ltype_t;
-
-/** RIFF writer */
-typedef struct {
-	FILE *f;
-	/** Chunk start offset */
-	long ckstart;
-} riffw_t;
-
-/** RIFF reader */
-typedef struct {
-	FILE *f;
-	/** Current file position */
-	long pos;
-} riffr_t;
-
-/** RIFF chunk for reading */
-typedef struct {
-	riffr_t *riffr;
-	long ckstart;
-	riff_ckid_t ckid;
-	riff_cksize_t cksize;
-} riff_rchunk_t;
-
-/** RIFF chunk for writing */
-typedef struct {
-	long ckstart;
-} riff_wchunk_t;
-
-/** RIFF chunk info */
-typedef struct {
-	long ckstart;
-	riff_ckid_t ckid;
-	riff_cksize_t cksize;
-} riff_ckinfo_t;
-
-enum {
-	/** RIFF chunk ID */
-	CKID_RIFF = 0x46464952,
-	/** LIST chunk ID */
-	CKID_LIST = 0x5453494C,
-
-	/** WAVE RIFF form ID */
-	FORM_WAVE = 0x45564157,
-	/** fmt chunk ID */
-	CKID_fmt = 0x20746d66,
-	/** data chunk ID */
-	CKID_data = 0x61746164,
-
-	/** PCM wave format */
-	WFMT_PCM = 0x0001
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/riff/include/types/riff/rwave.h
===================================================================
--- uspace/lib/riff/include/types/riff/rwave.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file Waveform Audio File Format (WAVE) types.
- */
-
-#ifndef RIFF_TYPES_WAVE_H
-#define RIFF_TYPES_WAVE_H
-
-#include <stdint.h>
-#include <types/riff/chunk.h>
-
-/** WAVE format chunk data
- *
- * Actual data structure in the RIFF file
- */
-typedef struct {
-	/** Format category */
-	uint16_t format_tag;
-	/** Number of channels */
-	uint16_t channels;
-	/** Sampling rate */
-	uint32_t smp_sec;
-	/** For buffer estimation */
-	uint32_t avg_bytes_sec;
-	/** Data block size */
-	uint16_t block_align;
-	/** Bits per sample (PCM only) */
-	uint16_t bits_smp;
-} rwave_fmt_t;
-
-/** RIFF WAVE params
- *
- * Used by the API
- */
-typedef struct {
-	/** Number of channels */
-	int channels;
-	/** Number of bits per sample */
-	int bits_smp;
-	/** Sample frequency in Hz */
-	int smp_freq;
-} rwave_params_t;
-
-/** RIFF WAVE writer */
-typedef struct {
-	/** RIFF writer */
-	riffw_t *rw;
-	/** Buffer size in bytes */
-	size_t bufsize;
-	/** Conversion buffer */
-	void *buf;
-	/** WAVE file parameters */
-	rwave_params_t params;
-	/** RIFF WAVE chunk */
-	riff_wchunk_t wave;
-	/** data chunk */
-	riff_wchunk_t data;
-} rwavew_t;
-
-/** RIFF WAVE reader */
-typedef struct {
-	/** RIFF reader */
-	riffr_t *rr;
-	/** RIFF WAVE chunk */
-	riff_rchunk_t wave;
-	/** data chunk */
-	riff_rchunk_t data;
-} rwaver_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/riff/meson.build
===================================================================
--- uspace/lib/riff/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2020 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/chunk.c',
-	'src/rwave.c',
-)
-
-test_src = files(
-	'test/chunk.c',
-	'test/main.c',
-	'test/rwave.c',
-)
Index: pace/lib/riff/src/chunk.c
===================================================================
--- uspace/lib/riff/src/chunk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,551 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file RIFF chunk.
- */
-
-#include <assert.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <macros.h>
-#include <riff/chunk.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-/** Open RIFF file for writing
- *
- * @param fname File name
- * @param rrw   Place to store pointer to RIFF writer
- *
- * @return EOK on success, ENOMEM if out of memory, EIO if failed to open
- *         file.
- */
-errno_t riff_wopen(const char *fname, riffw_t **rrw)
-{
-	riffw_t *rw;
-
-	rw = calloc(1, sizeof(riffw_t));
-	if (rw == NULL)
-		return ENOMEM;
-
-	rw->f = fopen(fname, "wb");
-	if (rw->f == NULL) {
-		free(rw);
-		return EIO;
-	}
-
-	*rrw = rw;
-	return EOK;
-}
-
-/** Close RIFF for writing.
- *
- * @param rw RIFF writer
- * @return EOK on success. On write error EIO is returned and RIFF writer
- *         is destroyed anyway.
- */
-errno_t riff_wclose(riffw_t *rw)
-{
-	int rv;
-
-	rv = fclose(rw->f);
-	free(rw);
-
-	return (rv == 0) ? EOK : EIO;
-}
-
-/** Write uint32_t value into RIFF file
- *
- * @param rw RIFF writer
- * @param v  Value
- * @return EOK on success, EIO on error.
- */
-errno_t riff_write_uint32(riffw_t *rw, uint32_t v)
-{
-	uint32_t vle;
-
-	vle = host2uint32_t_le(v);
-	if (fwrite(&vle, 1, sizeof(vle), rw->f) < sizeof(vle))
-		return EIO;
-
-	return EOK;
-}
-
-/** Begin writing chunk.
- *
- * @param rw     RIFF writer
- * @param ckid   Chunk ID
- * @param wchunk Pointer to chunk structure to fill in
- *
- * @return EOK on success, EIO on write error
- */
-errno_t riff_wchunk_start(riffw_t *rw, riff_ckid_t ckid, riff_wchunk_t *wchunk)
-{
-	long pos;
-	errno_t rc;
-
-	pos = ftell(rw->f);
-	if (pos < 0)
-		return EIO;
-
-	wchunk->ckstart = pos + 2 * sizeof(uint32_t);
-
-	rc = riff_write_uint32(rw, ckid);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		return EIO;
-	}
-
-	rc = riff_write_uint32(rw, 0);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Finish writing chunk.
- *
- * @param rw     RIFF writer
- * @param wchunk Pointer to chunk structure
- *
- * @return EOK on success, EIO error.
- */
-errno_t riff_wchunk_end(riffw_t *rw, riff_wchunk_t *wchunk)
-{
-	long pos;
-	long cksize;
-	uint8_t pad;
-	size_t nw;
-	errno_t rc;
-
-	pos = ftell(rw->f);
-	if (pos < 0)
-		return EIO;
-
-	cksize = pos - wchunk->ckstart;
-	if (pos % 2 != 0) {
-		++pos;
-		pad = 0;
-		nw = fwrite(&pad, 1, sizeof(pad), rw->f);
-		if (nw != sizeof(pad))
-			return EIO;
-	}
-
-	if (fseek(rw->f, wchunk->ckstart - 4, SEEK_SET) < 0)
-		return EIO;
-
-	rc = riff_write_uint32(rw, cksize);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		return EIO;
-	}
-
-	if (fseek(rw->f, pos, SEEK_SET) < 0)
-		return EIO;
-
-	return EOK;
-}
-
-/** Write data into RIFF file.
- *
- * @param rw    RIFF writer
- * @param data  Pointer to data
- * @param bytes Number of bytes to write
- *
- * @return EOK on success, EIO on error.
- */
-errno_t riff_write(riffw_t *rw, void *data, size_t bytes)
-{
-	size_t nw;
-
-	nw = fwrite(data, 1, bytes, rw->f);
-	if (nw != bytes)
-		return EIO;
-
-	return EOK;
-}
-
-/** Open RIFF file for reading.
- *
- * @param fname File name
- * @param riffck Place to store root (RIFF) chunk
- * @param rrr   Place to store pointer to RIFF reader
- *
- * @return EOK on success, ENOMEM if out of memory, EIO if failed to open
- *         file..
- */
-errno_t riff_ropen(const char *fname, riff_rchunk_t *riffck, riffr_t **rrr)
-{
-	riffr_t *rr;
-	riff_rchunk_t fchunk;
-	long fsize;
-	errno_t rc;
-	int rv;
-
-	rr = calloc(1, sizeof(riffr_t));
-	if (rr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rr->pos = 0;
-
-	rr->f = fopen(fname, "rb");
-	if (rr->f == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rv = fseek(rr->f, 0, SEEK_END);
-	if (rv < 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	fsize = ftell(rr->f);
-	if (fsize < 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	rv = fseek(rr->f, 0, SEEK_SET);
-	if (rv < 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	fchunk.riffr = rr;
-	fchunk.ckstart = 0;
-	fchunk.cksize = fsize;
-
-	rc = riff_rchunk_start(&fchunk, riffck);
-	if (rc != EOK)
-		goto error;
-
-	*rrr = rr;
-	return EOK;
-error:
-	if (rr != NULL && rr->f != NULL)
-		fclose(rr->f);
-	free(rr);
-	return rc;
-}
-
-/** Close RIFF for reading.
- *
- * @param rr RIFF reader
- * @return EOK on success, EIO on error.
- */
-errno_t riff_rclose(riffr_t *rr)
-{
-	errno_t rc;
-
-	rc = fclose(rr->f);
-	free(rr);
-	return rc == 0 ? EOK : EIO;
-}
-
-/** Read uint32_t from RIFF file.
- *
- * @param rchunk RIFF chunk
- * @param v  Place to store value
- * @return EOK on success, ELIMIT if at the end of parent chunk, EIO on error.
- */
-errno_t riff_read_uint32(riff_rchunk_t *rchunk, uint32_t *v)
-{
-	uint32_t vle;
-	errno_t rc;
-	size_t nread;
-
-	rc = riff_read(rchunk, &vle, sizeof(vle), &nread);
-	if (rc != EOK)
-		return rc;
-
-	if (nread != sizeof(vle))
-		return ELIMIT;
-
-	*v = uint32_t_le2host(vle);
-	return EOK;
-}
-
-/** Start reading RIFF chunk.
- *
- * @param parent Parent chunk
- * @param rchunk Pointer to chunk structure to fill in
- *
- * @return EOK on success, ELIMIT if at the end of parent chunk,
- *         EIO on error.
- */
-errno_t riff_rchunk_start(riff_rchunk_t *parent, riff_rchunk_t *rchunk)
-{
-	errno_t rc;
-
-	rchunk->riffr = parent->riffr;
-	rchunk->ckstart = parent->riffr->pos + 8;
-	rc = riff_read_uint32(parent, &rchunk->ckid);
-	if (rc != EOK)
-		goto error;
-	rc = riff_read_uint32(parent, &rchunk->cksize);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Find and start reading RIFF chunk of with specific chunk ID.
- * Other types of chunks are skipped.
- *
- * @param parent Parent chunk
- * @param rchunk Pointer to chunk structure to fill in
- *
- * @return EOK on success, ENOENT chunk was not found and end was reached
- *         EIO on error.
- */
-errno_t riff_rchunk_match(riff_rchunk_t *parent, riff_ckid_t ckid,
-    riff_rchunk_t *rchunk)
-{
-	errno_t rc;
-
-	while (true) {
-		rc = riff_rchunk_start(parent, rchunk);
-		if (rc == ELIMIT)
-			return ENOENT;
-		if (rc != EOK)
-			return rc;
-
-		if (rchunk->ckid == ckid)
-			break;
-
-		rc = riff_rchunk_end(rchunk);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Find and start reading RIFF LIST chunk of specified type.
- * Other chunks or LIST chunks of other type are skipped.
- *
- * @param parent Parent chunk
- * @param rchunk Pointer to chunk structure to fill in
- *
- * @return EOK on success, ENOENT chunk was not found and end was reached
- *         EIO on error.
- */
-errno_t riff_rchunk_list_match(riff_rchunk_t *parent, riff_ltype_t ltype,
-    riff_rchunk_t *rchunk)
-{
-	errno_t rc;
-	riff_ltype_t rltype;
-
-	while (true) {
-		rc = riff_rchunk_match(parent, CKID_LIST, rchunk);
-		if (rc == ELIMIT)
-			return ENOENT;
-		if (rc != EOK)
-			return rc;
-
-		rc = riff_read_uint32(parent, &rltype);
-		if (rc != EOK)
-			return rc;
-
-		if (rltype == ltype)
-			break;
-
-		rc = riff_rchunk_end(rchunk);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Seek to position in chunk.
- *
- * @param rchunk RIFF chunk
- * @param offset Offset
- * @param whence SEEK_SET, SEEK_CUR or SEEK_END
- * @return EOK on success or an error code
- */
-errno_t riff_rchunk_seek(riff_rchunk_t *rchunk, long offset, int whence)
-{
-	long dest;
-	int rv;
-
-	switch (whence) {
-	case SEEK_SET:
-		dest = rchunk->ckstart + offset;
-		break;
-	case SEEK_END:
-		dest = rchunk->ckstart + rchunk->cksize + offset;
-		break;
-	case SEEK_CUR:
-		dest = rchunk->riffr->pos + offset;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	if (dest < rchunk->ckstart || (unsigned long) dest >
-	    (unsigned long) rchunk->ckstart + rchunk->cksize) {
-		return ELIMIT;
-	}
-
-	rv = fseek(rchunk->riffr->f, dest, SEEK_SET);
-	if (rv < 0)
-		return EIO;
-
-	rchunk->riffr->pos = dest;
-	return EOK;
-}
-
-/** Return chunk data size.
- *
- * @param rchunk RIFF chunk
- * @return Pure data size (excluding type+size header) in bytes
- */
-uint32_t riff_rchunk_size(riff_rchunk_t *rchunk)
-{
-	return rchunk->cksize;
-}
-
-/** Return file offset where chunk ends
- *
- * @param rchunk RIFF chunk
- * @return File offset just after last data byte of the chunk
- */
-static long riff_rchunk_get_end(riff_rchunk_t *rchunk)
-{
-	return rchunk->ckstart + rchunk->cksize;
-}
-
-/** Return file offset of first (non-padding) byte after end of chunk.
- *
- * @param rchunk RIFF chunk
- * @return File offset of first non-padding byte after end of chunk
- */
-static long riff_rchunk_get_ndpos(riff_rchunk_t *rchunk)
-{
-	long ckend;
-
-	ckend = riff_rchunk_get_end(rchunk);
-	if ((ckend % 2) != 0)
-		return ckend + 1;
-	else
-		return ckend;
-}
-
-/** Finish reading RIFF chunk.
- *
- * Seek to the first byte after end of chunk. It is allowed, though,
- * to return to the chunk later, e.g. using riff_rchunk_seek(@a rchunk, ..).
- *
- * @param rchunk Chunk structure
- * @return EOK on success, EIO on error.
- */
-errno_t riff_rchunk_end(riff_rchunk_t *rchunk)
-{
-	long ckend;
-	uint8_t byte;
-	size_t nread;
-
-	ckend = riff_rchunk_get_ndpos(rchunk);
-	if (rchunk->riffr->pos < ckend &&
-	    ckend <= rchunk->riffr->pos + 512) {
-		/* (Buffered) reading is faster than seeking */
-		while (rchunk->riffr->pos < ckend) {
-			nread = fread(&byte, 1, sizeof(byte), rchunk->riffr->f);
-			if (nread != sizeof(byte))
-				return EIO;
-
-			rchunk->riffr->pos += sizeof(byte);
-		}
-
-	} else if (rchunk->riffr->pos != ckend) {
-		/* Need to seek (backwards or too far) */
-		if (fseek(rchunk->riffr->f, ckend, SEEK_SET) < 0)
-			return EIO;
-
-		rchunk->riffr->pos = ckend;
-	}
-
-	return EOK;
-}
-
-/** Read data from RIFF chunk.
- *
- * Attempt to read @a bytes bytes from the chunk. If there is less data
- * left until the end of the chunk, less will be read. The actual number
- * of bytes read is returned in @a *nbytes (can even be 0).
- *
- * @param rchunk RIFF chunk for reading
- * @param buf Buffer to read to
- * @param bytes Number of bytes to read
- * @param nread Place to store number of bytes actually read
- *
- * @return EOK on success, ELIMIT if file position is not within @a rchunk,
- *         EIO on I/O error.
- */
-errno_t riff_read(riff_rchunk_t *rchunk, void *buf, size_t bytes,
-    size_t *nread)
-{
-	long pos;
-	long ckend;
-	long toread;
-
-	pos = rchunk->riffr->pos;
-
-	ckend = riff_rchunk_get_end(rchunk);
-	if (pos < rchunk->ckstart || pos > ckend)
-		return ELIMIT;
-
-	toread = min(bytes, (size_t)(ckend - pos));
-	if (toread == 0) {
-		*nread = 0;
-		return EOK;
-	}
-
-	*nread = fread(buf, 1, toread, rchunk->riffr->f);
-	if (*nread == 0)
-		return EIO;
-
-	rchunk->riffr->pos += *nread;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/riff/src/rwave.c
===================================================================
--- uspace/lib/riff/src/rwave.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,389 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libriff
- * @{
- */
-/**
- * @file Waveform Audio File Format (WAVE).
- */
-
-#include <assert.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <riff/chunk.h>
-#include <riff/rwave.h>
-#include <stdlib.h>
-
-/** Encode format chunk data.
- *
- * @params params	WAVE parameters
- * @params fmt		Pointer to fmt chunk data structure to fill in
- */
-static void rwave_encode_fmt(rwave_params_t *params, rwave_fmt_t *fmt)
-{
-	int bytes_smp;
-
-	bytes_smp = (params->bits_smp + 7) / 8;
-
-	fmt->format_tag = host2uint16_t_le(WFMT_PCM);
-	fmt->channels = host2uint16_t_le(params->channels);
-	fmt->smp_sec = host2uint32_t_le(params->smp_freq);
-	fmt->avg_bytes_sec = host2uint32_t_le(bytes_smp * params->smp_freq *
-	    params->channels);
-	fmt->block_align = host2uint16_t_le(bytes_smp);
-	fmt->bits_smp = host2uint16_t_le(params->bits_smp);
-}
-
-/** Decode format chunk data.
- *
- * @param fmt	 Pointer to format chunk data
- * @param params WAVE parameters to fill in
- *
- * @return EOK on success, EINVAL if format is not supported.
- */
-static int rwave_decode_fmt(rwave_fmt_t *fmt, rwave_params_t *params)
-{
-	uint16_t fmt_tag;
-
-	fmt_tag = uint16_t_le2host(fmt->format_tag);
-	printf("fmt_tag=0x%x\n", fmt_tag);
-	if (fmt_tag != WFMT_PCM)
-		return EINVAL;
-
-	params->channels = uint16_t_le2host(fmt->channels);
-	params->smp_freq = uint32_t_le2host(fmt->smp_sec);
-	params->bits_smp = uint16_t_le2host(fmt->bits_smp);
-
-	return EOK;
-}
-
-/** Open WAVE file for writing.
- *
- * @param fname  File name
- * @param params WAVE file parameters
- * @param rww    Place to store pointer to WAVE writer
- *
- * @return EOK on success, EIO on I/O error, ENOMEM if out of memory.
- */
-errno_t rwave_wopen(const char *fname, rwave_params_t *params, rwavew_t **rww)
-{
-	riff_wchunk_t fmt;
-	rwave_fmt_t rwfmt;
-	errno_t rc;
-	rwavew_t *ww;
-
-	rwave_encode_fmt(params, &rwfmt);
-
-	ww = calloc(1, sizeof(rwavew_t));
-	if (ww == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ww->bufsize = 4096;
-	ww->buf = calloc(1, ww->bufsize);
-	if (ww->buf == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Make a copy of parameters */
-	ww->params = *params;
-
-	rc = riff_wopen(fname, &ww->rw);
-	if (rc != EOK) {
-		assert(rc == EIO || rc == ENOMEM);
-		goto error;
-	}
-
-	rc = riff_wchunk_start(ww->rw, CKID_RIFF, &ww->wave);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_write_uint32(ww->rw, FORM_WAVE);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_wchunk_start(ww->rw, CKID_fmt, &fmt);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_write(ww->rw, &rwfmt, sizeof(rwfmt));
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_wchunk_end(ww->rw, &fmt);
-	if (rc != EOK)
-		goto error;
-
-	rc = riff_wchunk_start(ww->rw, CKID_data, &ww->data);
-	if (rc != EOK)
-		goto error;
-
-	*rww = ww;
-	return EOK;
-error:
-	if (ww != NULL)
-		free(ww->buf);
-	if (ww->rw != NULL)
-		riff_wclose(ww->rw);
-	free(ww);
-	return rc;
-}
-
-/** Write samples to WAVE file.
- *
- * @param ww    WAVE writer
- * @param data  Pointer to data
- * @param bytes Number of bytes to write
- *
- * @return EOK on success, EIO on I/O error, ENOTSUP if sample format is
- *         not supported.
- */
-errno_t rwave_write_samples(rwavew_t *ww, void *data, size_t bytes)
-{
-	size_t i;
-	uint16_t *d16, *b16;
-	size_t now;
-	errno_t rc;
-
-	/* Convert sample data to little endian */
-
-	while (bytes > 0) {
-		now = min(bytes, ww->bufsize);
-
-		switch (ww->params.bits_smp / 8) {
-		case 1:
-			memcpy(ww->buf, data, now);
-			break;
-		case 2:
-			b16 = (uint16_t *)ww->buf;
-			d16 = (uint16_t *)data;
-			for (i = 0; i < now / 2; i++) {
-				b16[i] = host2uint16_t_le(d16[i]);
-			}
-			break;
-		default:
-			return ENOTSUP;
-		}
-
-		rc = riff_write(ww->rw, ww->buf, now);
-		if (rc != EOK) {
-			assert(rc == EIO);
-			return rc;
-		}
-
-		bytes -= now;
-		data += now;
-	}
-
-	return EOK;
-}
-
-/** Close WAVE file for writing.
- *
- * @param ww WAVE writer
- * @return EOK on success, EIO on I/O error - in which case @a ww is destroyed
- *         anyway.
- */
-errno_t rwave_wclose(rwavew_t *ww)
-{
-	errno_t rc;
-
-	rc = riff_wchunk_end(ww->rw, &ww->wave);
-	if (rc == EOK)
-		rc = riff_wchunk_end(ww->rw, &ww->data);
-
-	rc = riff_wclose(ww->rw);
-
-	ww->rw = NULL;
-	free(ww->buf);
-	free(ww);
-
-	return rc;
-}
-
-/** Open WAVE file for reading.
- *
- * @param fname  File name
- * @param params WAVE file parameters
- * @param rwaver Place to store pointer to new wave reader
- *
- * @return EOK on success, EIO on I/O error, ENOMEM if out of memory
- */
-errno_t rwave_ropen(const char *fname, rwave_params_t *params, rwaver_t **rwr)
-{
-	rwaver_t *wr = NULL;
-	uint32_t form_id;
-	riff_rchunk_t fmt;
-	rwave_fmt_t wfmt;
-	size_t nread;
-	errno_t rc;
-
-	wr = calloc(1, sizeof(rwaver_t));
-	if (wr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = riff_ropen(fname, &wr->wave, &wr->rr);
-	if (rc != EOK) {
-		assert(rc == EIO || rc == ENOMEM);
-		goto error;
-	}
-
-	if (wr->wave.ckid != CKID_RIFF) {
-		printf("Not RIFF file\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = riff_read_uint32(&wr->wave, &form_id);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		goto error;
-	}
-
-	if (form_id != FORM_WAVE) {
-		printf("wrong form ID\n");
-		rc = EIO;
-		goto error;
-	}
-
-	rc = riff_rchunk_start(&wr->wave, &fmt);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		goto error;
-	}
-
-	if (fmt.ckid != CKID_fmt) {
-		printf("not fmt chunk\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = riff_read(&fmt, &wfmt, sizeof(rwave_fmt_t), &nread);
-	if (rc != EOK) {
-		printf("error reading fmt chunk\n");
-		assert(rc == EIO || rc == ELIMIT);
-		rc = EIO;
-		goto error;
-	}
-
-	if (nread < sizeof(rwave_fmt_t)) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = riff_rchunk_end(&fmt);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		goto error;
-	}
-
-	rc = rwave_decode_fmt(&wfmt, params);
-	if (rc != EOK) {
-		printf("decode fmt fail\n");
-		assert(rc == EINVAL);
-		rc = EIO;
-		goto error;
-	}
-
-	rc = riff_rchunk_start(&wr->wave, &wr->data);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		goto error;
-	}
-
-	if (wr->data.ckid != CKID_data) {
-		printf("not data ckid\n");
-		rc = EIO;
-		goto error;
-	}
-
-	*rwr = wr;
-	return EOK;
-error:
-	if (wr != NULL && wr->rr != NULL)
-		riff_rclose(wr->rr);
-	free(wr);
-	return rc;
-}
-
-/** Read samples from WAVE file.
- *
- * @param wr    WAVE reader
- * @param buf   Buffer for storing the data
- * @param bytes Number of bytes to read
- * @param nread Place to store number of bytes actually read (>= 0).
- *
- * @return EOK if zero or more bytes successfully read and @a *nread is set,
- *         EIO on I/O error.
- */
-errno_t rwave_read_samples(rwaver_t *wr, void *buf, size_t bytes, size_t *nread)
-{
-	errno_t rc;
-
-	rc = riff_read(&wr->data, buf, bytes, nread);
-	if (rc != EOK) {
-		assert(rc == EIO || rc == ELIMIT);
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Close WAVE file for reading.
- *
- * @param wr WAVE reader
- *
- * @return EOK on success, EIO on I/O error in which case @a wr is destroyed
- *         anyway.
- */
-errno_t rwave_rclose(rwaver_t *wr)
-{
-	errno_t rc;
-
-	rc = riff_rchunk_end(&wr->wave);
-	if (rc != EOK) {
-		assert(rc == EIO);
-		goto error;
-	}
-
-	riff_rclose(wr->rr);
-	free(wr);
-	return EOK;
-error:
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/riff/test/chunk.c
===================================================================
--- uspace/lib/riff/test/chunk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,652 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-#include <riff/chunk.h>
-#include <str.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(chunk);
-
-enum {
-	CKID_dat1 = 0x31746164,
-	CKID_dat2 = 0x32746164,
-	LTYPE_lst1 = 0x3174736C,
-	LTYPE_lst2 = 0x3274736C
-};
-
-/** Write and read back RIFF file containing just empty RIFF chunk */
-PCUT_TEST(empty)
-{
-	char fname[L_tmpnam];
-	char *p;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_rchunk_t rriffck;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-	PCUT_ASSERT_INT_EQUALS(0, riff_rchunk_size(&rriffck));
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-/** Write and read back RIFF file containing two data chunks */
-PCUT_TEST(data_chunks)
-{
-	char fname[L_tmpnam];
-	char *p;
-	char str1[] = "Hello";
-	char str2[] = "World!";
-	char buf[10];
-	size_t nread;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_wchunk_t wdatack;
-	riff_rchunk_t rriffck;
-	riff_rchunk_t rdatack;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write first data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write(rw, str1, str_size(str1));
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write second data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat2, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write(rw, str2, str_size(str2));
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-
-	/* Read first data chunk */
-
-	rc = riff_rchunk_start(&rriffck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat1, rdatack.ckid);
-
-	rc = riff_read(&rdatack, buf, sizeof(buf), &nread);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(str_size(str1), nread);
-	PCUT_ASSERT_INT_EQUALS(0, memcmp(buf, str1, nread));
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read second data chunk */
-
-	rc = riff_rchunk_start(&rriffck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat2, rdatack.ckid);
-
-	rc = riff_read(&rdatack, buf, sizeof(buf), &nread);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(str_size(str2), nread);
-	PCUT_ASSERT_INT_EQUALS(0, memcmp(buf, str2, nread));
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-/** Write and read back RIFF file containing two list chunks */
-PCUT_TEST(list_chunks)
-{
-	char fname[L_tmpnam];
-	char *p;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_wchunk_t wlistck;
-	riff_wchunk_t wdatack;
-	riff_rchunk_t rriffck;
-	riff_rchunk_t rlistck;
-	riff_rchunk_t rdatack;
-	uint32_t ltype;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write first list chunk with two data chunks */
-
-	rc = riff_wchunk_start(rw, CKID_LIST, &wlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, LTYPE_lst1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_start(rw, CKID_dat2, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write second list chunk with one data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_LIST, &wlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, LTYPE_lst2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-
-	/* Read first list chunk with two data chunks */
-
-	rc = riff_rchunk_start(&rriffck, &rlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_LIST, rlistck.ckid);
-
-	rc = riff_read_uint32(&rlistck, &ltype);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(LTYPE_lst1, ltype);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat1, rdatack.ckid);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat2, rdatack.ckid);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ELIMIT, rc);
-
-	rc = riff_rchunk_end(&rlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read second list chunk with one data chunk */
-
-	rc = riff_rchunk_start(&rriffck, &rlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_LIST, rlistck.ckid);
-
-	rc = riff_read_uint32(&rlistck, &ltype);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(LTYPE_lst2, ltype);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat1, rdatack.ckid);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ELIMIT, rc);
-
-	rc = riff_rchunk_start(&rlistck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ELIMIT, rc);
-
-	rc = riff_rchunk_end(&rlistck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-/** Match specific chunk type in a RIFF file */
-PCUT_TEST(match_chunk)
-{
-	char fname[L_tmpnam];
-	char *p;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_wchunk_t wdatack;
-	riff_rchunk_t rriffck;
-	riff_rchunk_t rdatack;
-	uint32_t rword;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write first data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write second data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat2, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write third data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-
-	/* Match second data chunk */
-
-	rc = riff_rchunk_match(&rriffck, CKID_dat2, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat2, rdatack.ckid);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, rword);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try matching dat2 again (should not match) */
-
-	rc = riff_rchunk_match(&rriffck, CKID_dat2, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	/* Try matching dat1 again (but there's nothing left) */
-
-	rc = riff_rchunk_match(&rriffck, CKID_dat1, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-/** Match specific LIST chunk type in a RIFF file */
-PCUT_TEST(list_match)
-{
-	char fname[L_tmpnam];
-	char *p;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_wchunk_t wdatack;
-	riff_rchunk_t rriffck;
-	riff_rchunk_t rdatack;
-	uint32_t rword;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write first LIST chunk */
-
-	rc = riff_wchunk_start(rw, CKID_LIST, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, LTYPE_lst1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write second data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_LIST, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, LTYPE_lst2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write third data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_LIST, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, LTYPE_lst1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-
-	/* Match second LIST chunk */
-
-	rc = riff_rchunk_list_match(&rriffck, LTYPE_lst2, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, rword);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try matching lst2 again (should not match) */
-
-	rc = riff_rchunk_list_match(&rriffck, LTYPE_lst2, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	/* Try matching lst1 again (but there's nothing left) */
-
-	rc = riff_rchunk_list_match(&rriffck, LTYPE_lst1, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-/** Seek back to different positions in a chunk */
-PCUT_TEST(rchunk_seek)
-{
-	char fname[L_tmpnam];
-	char *p;
-	riffw_t *rw;
-	riffr_t *rr;
-	riff_wchunk_t wriffck;
-	riff_wchunk_t wdatack;
-	riff_rchunk_t rriffck;
-	riff_rchunk_t rdatack;
-	uint32_t rword;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF file */
-
-	rc = riff_wopen(p, &rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rw);
-
-	rc = riff_wchunk_start(rw, CKID_RIFF, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Write data chunk */
-
-	rc = riff_wchunk_start(rw, CKID_dat1, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_write_uint32(rw, 4);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wchunk_end(rw, &wriffck);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_wclose(rw);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF file */
-
-	rc = riff_ropen(p, &rriffck, &rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rr);
-
-	PCUT_ASSERT_INT_EQUALS(CKID_RIFF, rriffck.ckid);
-
-	/* Read data chunk */
-
-	rc = riff_rchunk_start(&rriffck, &rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(CKID_dat1, rdatack.ckid);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(1, rword);
-
-	rc = riff_rchunk_end(&rdatack);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try reading first word of data chunk again */
-
-	rc = riff_rchunk_seek(&rdatack, 0, SEEK_SET);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(1, rword);
-
-	/* Try reading last word of data chunk */
-
-	rc = riff_rchunk_seek(&rdatack, -4, SEEK_END);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(4, rword);
-
-	/* Try reading previous word of data chunk */
-
-	rc = riff_rchunk_seek(&rdatack, -8, SEEK_CUR);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = riff_read_uint32(&rdatack, &rword);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(3, rword);
-
-	rc = riff_rclose(rr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-PCUT_EXPORT(chunk);
Index: pace/lib/riff/test/main.c
===================================================================
--- uspace/lib/riff/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(chunk);
-PCUT_IMPORT(rwave);
-
-PCUT_MAIN();
Index: pace/lib/riff/test/rwave.c
===================================================================
--- uspace/lib/riff/test/rwave.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <riff/rwave.h>
-#include <stdio.h>
-#include <stdint.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(rwave);
-
-/** Write a WAVE file and read it back */
-PCUT_TEST(write_read)
-{
-	char fname[L_tmpnam];
-	char *p;
-	uint16_t samples[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
-	uint16_t rsamples[10];
-	size_t nread;
-	rwavew_t *ww = NULL;
-	rwaver_t *wr = NULL;
-	rwave_params_t params;
-	rwave_params_t rparams;
-	errno_t rc;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Write RIFF wAVE file */
-
-	params.channels = 2;
-	params.bits_smp = 16;
-	params.smp_freq = 44100;
-
-	rc = rwave_wopen(p, &params, &ww);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ww);
-
-	rc = rwave_write_samples(ww, (void *) samples, sizeof(samples));
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = rwave_wclose(ww);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Read back RIFF WAVE file */
-
-	rc = rwave_ropen(p, &rparams, &wr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wr);
-
-	PCUT_ASSERT_INT_EQUALS(params.channels, rparams.channels);
-	PCUT_ASSERT_INT_EQUALS(params.bits_smp, rparams.bits_smp);
-	PCUT_ASSERT_INT_EQUALS(params.smp_freq, rparams.smp_freq);
-
-	rc = rwave_read_samples(wr, rsamples, sizeof(rsamples), &nread);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(sizeof(samples), nread);
-
-	PCUT_ASSERT_INT_EQUALS(0, memcmp(samples, rsamples, sizeof(samples)));
-
-	rc = rwave_rclose(wr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	(void) remove(p);
-}
-
-PCUT_EXPORT(rwave);
Index: pace/lib/scsi/doc/doxygroups.h
===================================================================
--- uspace/lib/scsi/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libscsi libscsi
- * @ingroup libs
- */
Index: pace/lib/scsi/include/scsi/mmc.h
===================================================================
--- uspace/lib/scsi/include/scsi/mmc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libscsi
- * @{
- */
-/**
- * @file SCSI Multi-Media Commands.
- */
-
-#ifndef LIBSCSI_MMC_H_
-#define LIBSCSI_MMC_H_
-
-#include <stdint.h>
-
-/** SCSI command codes defined in SCSI-MMC */
-enum scsi_cmd_mmc {
-	SCSI_CMD_READ_TOC	= 0x43
-};
-
-/** SCSI Read TOC/PMA/ATIP command.
- *
- * Note: For SFF 8020 the command must be padded to 12 bytes.
- */
-typedef struct {
-	/** Operation code (SCSI_CMD_READ_TOC) */
-	uint8_t op_code;
-	/** Reserved, MSF, Reserved */
-	uint8_t msf;
-	/** Reserved, Format */
-	uint8_t format;
-	/** Reserved */
-	uint8_t reserved_3;
-	/** Reserved */
-	uint8_t reserved_4;
-	/** Reserved */
-	uint8_t reserved_5;
-	/** Track/Session Number */
-	uint8_t track_sess_no;
-	/** Allocation Length */
-	uint16_t alloc_len;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_read_toc_t;
-
-/** TOC Track Descriptor */
-typedef struct {
-	/** Reserved */
-	uint8_t reserved0;
-	/** ADR, Control */
-	uint8_t adr_control;
-	/** Track Number */
-	uint8_t track_no;
-	/** Reserved */
-	uint8_t reserved3;
-	/** Track Start Address */
-	uint32_t start_addr;
-} __attribute__((packed)) scsi_toc_track_desc_t;
-
-/** Read TOC response format 00001b: Multi-session Information
- *
- * Returned for Read TOC command with Format 0001b
- */
-typedef struct {
-	/** TOC Data Length */
-	uint16_t toc_len;
-	/** First Complete Session Number */
-	uint8_t first_sess;
-	/** Last Complete Session Number */
-	uint8_t last_sess;
-	/** TOC Track Descriptor for first track in last complete session */
-	scsi_toc_track_desc_t ftrack_lsess;
-} __attribute__((packed)) scsi_toc_multisess_data_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/scsi/include/scsi/sbc.h
===================================================================
--- uspace/lib/scsi/include/scsi/sbc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libscsi
- * @{
- */
-/**
- * @file SCSI Block Commands.
- */
-
-#ifndef LIBSCSI_SBC_H_
-#define LIBSCSI_SBC_H_
-
-#include <stdint.h>
-
-/** SCSI command codes defined in SCSI-SBC */
-enum scsi_cmd_sbc {
-	SCSI_CMD_READ_6			= 0x08,
-	SCSI_CMD_READ_10		= 0x28,
-	SCSI_CMD_READ_12		= 0xa8,
-	SCSI_CMD_READ_16		= 0x88,
-	SCSI_CMD_READ_32		= 0x7f,
-
-	SCSI_CMD_READ_CAPACITY_10	= 0x25,
-	SCSI_CMD_READ_CAPACITY_16	= 0x9e,
-
-	SCSI_CMD_START_STOP_UNIT	= 0x1b,
-
-	SCSI_CMD_SYNC_CACHE_10		= 0x35,
-	SCSI_CMD_SYNC_CACHE_16		= 0x91,
-
-	SCSI_CMD_WRITE_6		= 0x0a,
-	SCSI_CMD_WRITE_10		= 0x2a,
-	SCSI_CMD_WRITE_12		= 0xaa,
-	SCSI_CMD_WRITE_16		= 0x8a
-};
-
-/** SCSI Read (10) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_READ_10) */
-	uint8_t op_code;
-	/** RdProtect, DPO, FUA, Reserved, FUA_NV, Obsolete */
-	uint8_t flags;
-	/** Logical block address */
-	uint32_t lba;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Transfer length */
-	uint16_t xfer_len;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_read_10_t;
-
-/** SCSI Read (12) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_READ_12) */
-	uint8_t op_code;
-	/** RdProtect, DPO, FUA, Reserved, FUA_NV, Obsolete */
-	uint8_t flags;
-	/** Logical block address */
-	uint32_t lba;
-	/** Transfer length */
-	uint32_t xfer_len;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_read_12_t;
-
-/** SCSI Read (16) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_READ_16) */
-	uint8_t op_code;
-	/** RdProtect, DPO, FUA, Reserved, FUA_NV, Reserved */
-	uint8_t flags;
-	/** Logical block address */
-	uint64_t lba;
-	/** Transfer length */
-	uint32_t xfer_len;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_read_16_t;
-
-/** SCSI Read Capacity (10) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_READ_CAPACITY_10) */
-	uint8_t op_code;
-	/** Reserved, Obsolete */
-	uint8_t reserved_1;
-	/** Logical block address */
-	uint32_t lba;
-	/** Reserved */
-	uint32_t reserved_6;
-	/** Reserved, PM */
-	uint8_t pm;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_read_capacity_10_t;
-
-/** Read Capacity (10) parameter data.
- *
- * Returned for Read Capacity (10) command.
- */
-typedef struct {
-	/** Logical address of last block */
-	uint32_t last_lba;
-	/** Size of block in bytes */
-	uint32_t block_size;
-} scsi_read_capacity_10_data_t;
-
-/** SCSI Synchronize Cache (10) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_SYNC_CACHE_10) */
-	uint8_t op_code;
-	/** Reserved, Sync_NV, Immed, Reserved */
-	uint8_t flags;
-	/** Logical block address */
-	uint32_t lba;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Number of Logical Blocks */
-	uint16_t numlb;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_sync_cache_10_t;
-
-/** SCSI Synchronize Cache (16) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_SYNC_CACHE_16) */
-	uint8_t op_code;
-	/** Reserved, Sync_NV, Immed, Reserved */
-	uint8_t flags;
-	/** Logical block address */
-	uint64_t lba;
-	/** Number of Logical Blocks */
-	uint32_t numlb;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_sync_cache_16_t;
-
-/** SCSI Write (10) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_WRITE_10) */
-	uint8_t op_code;
-	/** WrProtect, DPO, FUA, Reserved, FUA_NV, Obsolete */
-	uint8_t flags;
-	/** Logical block address */
-	uint32_t lba;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Transfer length */
-	uint16_t xfer_len;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_write_10_t;
-
-/** SCSI Write (12) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_WRITE_12) */
-	uint8_t op_code;
-	/** WrProtect, DPO, FUA, Reserved, FUA_NV, Obsolete */
-	uint8_t flags;
-	/** Logical block address */
-	uint32_t lba;
-	/** Transfer length */
-	uint32_t xfer_len;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_write_12_t;
-
-/** SCSI Write (16) command */
-typedef struct {
-	/** Operation code (SCSI_CMD_WRITE_16) */
-	uint8_t op_code;
-	/** WrProtect, DPO, FUA, Reserved, FUA_NV, Reserved */
-	uint8_t flags;
-	/** Logical block address */
-	uint64_t lba;
-	/** Transfer length */
-	uint32_t xfer_len;
-	/** Reserved, Group Number */
-	uint8_t group_no;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_write_16_t;
-
-/** SCSI Start Stop Unit command */
-typedef struct {
-	/** Operation code (SCSI_CMD_START_STOP_UNIT) */
-	uint8_t op_code;
-	/** Immediate */
-	uint8_t immed;
-	/** Reserved */
-	uint8_t reserved_2;
-	/** Reserved */
-	uint8_t reserved_3;
-	/** Power Conditions | Reserved | LoEj | Start */
-	uint8_t flags;
-	/** Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_start_stop_unit_t;
-
-/** Constants for values in sccsi_cdb_start_stop_unit_t.flags */
-enum scsi_start_stop_flags {
-	ssf_pc_no_change = 0x00,
-	ssf_pc_idle = 0x10,
-	ssf_pc_standby = 0x20,
-	ssf_pc_sleep = 0x50,
-	ssf_loej = 0x02,
-	ssf_start = 0x01
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/scsi/include/scsi/spc.h
===================================================================
--- uspace/lib/scsi/include/scsi/spc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,236 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libscsi
- * @{
- */
-/**
- * @file SCSI Primary Commands.
- */
-
-#ifndef LIBSCSI_SPC_H_
-#define LIBSCSI_SPC_H_
-
-#include <stdint.h>
-#include <str.h>
-
-/** SCSI command codes defined in SCSI-SPC */
-enum scsi_cmd_spc {
-	SCSI_CMD_TEST_UNIT_READY = 0x00,
-	SCSI_CMD_REQUEST_SENSE	 = 0x03,
-	SCSI_CMD_INQUIRY	 = 0x12,
-};
-
-/** SCSI Inquiry command
- *
- * Note: for SFF 8020 the command must be zero-padded to 12 bytes
- * and alloc_len must be <= 0xff.
- */
-typedef struct {
-	/** Operation code (SCSI_CMD_INQUIRY) */
-	uint8_t op_code;
-	/** Reserved:7-2, obsolete:1, evpd:0 */
-	uint8_t evpd;
-	/* Page Code */
-	uint8_t page_code;
-	/* Allocation Length */
-	uint16_t alloc_len;
-	/* Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_inquiry_t;
-
-/** Minimum size of inquiry data required since SCSI-2 */
-#define SCSI_STD_INQUIRY_DATA_MIN_SIZE 36
-
-/** Standard inquiry data.
- *
- * Returned for Inquiry command with evpd bit cleared.
- */
-typedef struct {
-	/** Peripheral qualifier, Peripheral device type */
-	uint8_t pqual_devtype;
-	/** RMB, reserved */
-	uint8_t rmb;
-	/** Version */
-	uint8_t version;
-	/** Obsolete, NormACA, HiSup, Response Data Format */
-	uint8_t aca_hisup_rdf;
-	/** Additional Length */
-	uint8_t additional_len;
-	/** SCCS, ACC, TPGS, 3PC, Reserved, Protect */
-	uint8_t cap1;
-	/** Obsolete, EncServ, VS, MuliP, Obsolete, Addr16 */
-	uint8_t cap2;
-	/** Obsolete, WBus16, Sync, Obsolete, CmdQue, VS */
-	uint8_t cap3;
-
-	/** Vendor string */
-	uint8_t vendor[8];
-	/** Product string */
-	uint8_t product[16];
-	/** Revision string */
-	uint8_t revision[4];
-
-	/* End of required data */
-} __attribute__((packed)) scsi_std_inquiry_data_t;
-
-/** Size of struct or union member. */
-#define SCSI_MEMBER_SIZE(type, member) \
-    (sizeof(((type *)0) -> member))
-
-/** Size of string buffer needed to hold converted inquiry vendor string */
-#define SCSI_INQ_VENDOR_STR_BUFSIZE \
-    SPASCII_STR_BUFSIZE(SCSI_MEMBER_SIZE(scsi_std_inquiry_data_t, vendor))
-
-/** Size of string buffer needed to hold converted inquiry product string */
-#define SCSI_INQ_PRODUCT_STR_BUFSIZE \
-    SPASCII_STR_BUFSIZE(SCSI_MEMBER_SIZE(scsi_std_inquiry_data_t, product))
-
-/** Size of string buffer needed to hold converted inquiry revision string */
-#define SCSI_INQ_REVISION_STR_BUFSIZE \
-    SPASCII_STR_BUFSIZE(SCSI_MEMBER_SIZE(scsi_std_inquiry_data_t, revision))
-
-/** Bits in scsi_std_inquiry_data_t.pqual_devtype */
-enum scsi_pqual_devtype_bits {
-	/* Peripheral qualifier */
-	SCSI_PQDT_PQUAL_h	= 7,
-	SCSI_PQDT_PQUAL_l	= 5,
-
-	/* Peripheral device type */
-	SCSI_PQDT_DEV_TYPE_h	= 4,
-	SCSI_PQDT_DEV_TYPE_l	= 0
-};
-
-/** Bits in scsi_std_inquiry_data_t.rmb */
-enum scsi_rmb_bits {
-	SCSI_RMB_RMB		= 7
-};
-
-/** SCSI peripheral device type */
-enum scsi_device_type {
-	SCSI_DEV_BLOCK		= 0x00,
-	SCSI_DEV_STREAM		= 0x01,
-	SCSI_DEV_CD_DVD		= 0x05,
-	SCSI_DEV_CHANGER	= 0x08,
-	SCSI_DEV_ENCLOSURE	= 0x0d,
-	SCSI_DEV_OSD		= 0x11,
-
-	SCSI_DEV_LIMIT		= 0x20
-};
-
-/** SCSI Request Sense command */
-typedef struct {
-	/** Operation code (SCSI_CMD_REQUEST_SENSE) */
-	uint8_t op_code;
-	/** Reserved, Desc */
-	uint8_t desc;
-	/* Reserved */
-	uint16_t res_2;
-	/* Allocation Length */
-	uint8_t alloc_len;
-	/* Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_request_sense_t;
-
-/** Minimum size of sense data.
- *
- * If the target returns less data, the missing bytes should be considered
- * zero.
- */
-#define SCSI_SENSE_DATA_MIN_SIZE 18
-
-/** Maximum size of sense data */
-#define SCSI_SENSE_DATA_MAX_SIZE 252
-
-/** Fixed-format sense data.
- *
- * Returned for Request Sense command with Desc bit cleared.
- */
-typedef struct {
-	/** Valid, Response Code */
-	uint8_t valid_rcode;
-	/** Peripheral qualifier, Peripheral device type */
-	uint8_t obsolete_1;
-	/** Filemark, EOM, ILI, Reserved, Sense Key */
-	uint8_t flags_key;
-	/** Information */
-	uint32_t info;
-	/** Additional Sense Length */
-	uint8_t additional_len;
-	/** Command-specific Information */
-	uint32_t cmd_spec;
-	/** Additional Sense Code */
-	uint8_t additional_code;
-	/** Additional Sense Code Qualifier */
-	uint8_t additional_cqual;
-	/** Field-replaceable Unit Code */
-	uint8_t fru_code;
-	/** SKSV, Sense-key specific */
-	uint8_t key_spec[3];
-} __attribute__((packed)) scsi_sense_data_t;
-
-/** Sense key */
-enum scsi_sense_key {
-	SCSI_SK_NO_SENSE	= 0x0,
-	SCSI_SK_RECOVERED_ERROR	= 0x1,
-	SCSI_SK_NOT_READY	= 0x2,
-	SCSI_SK_MEDIUM_ERROR	= 0x3,
-	SCSI_SK_HARDWARE_ERROR	= 0x4,
-	SCSI_SK_ILLEGAL_REQUEST	= 0x5,
-	SCSI_SK_UNIT_ATTENTION	= 0x6,
-	SCSI_SK_DATA_PROTECT	= 0x7,
-	SCSI_SK_BLANK_CHECK	= 0x8,
-	SCSI_SK_VENDOR_SPECIFIC	= 0x9,
-	SCSI_SK_COPY_ABORTED	= 0xa,
-	SCSI_SK_ABORTED_COMMAND	= 0xb,
-	SCSI_SK_VOLUME_OVERFLOW	= 0xd,
-	SCSI_SK_MISCOMPARE	= 0xe,
-
-	SCSI_SK_LIMIT		= 0x10
-};
-
-extern const char *scsi_dev_type_str[SCSI_DEV_LIMIT];
-extern const char *scsi_sense_key_str[SCSI_SK_LIMIT];
-
-extern const char *scsi_get_dev_type_str(unsigned);
-extern const char *scsi_get_sense_key_str(unsigned);
-
-/** SCSI Test Unit Ready command */
-typedef struct {
-	/** Operation code (SCSI_CMD_TEST_UNIT_READY) */
-	uint8_t op_code;
-	/** Reserved */
-	uint32_t reserved;
-	/* Control */
-	uint8_t control;
-} __attribute__((packed)) scsi_cdb_test_unit_ready_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/scsi/meson.build
===================================================================
--- uspace/lib/scsi/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2011 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/spc.c')
Index: pace/lib/scsi/src/spc.c
===================================================================
--- uspace/lib/scsi/src/spc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include "scsi/spc.h"
-
-/** String descriptions for SCSI peripheral device type.
- *
- * Only device types that we are ever likely to encounter are listed here.
- */
-const char *scsi_dev_type_str[SCSI_DEV_LIMIT] = {
-	[SCSI_DEV_BLOCK]	= "Direct-Access Block Device (Disk)",
-	[SCSI_DEV_STREAM]	= "Sequential-Access Device (Tape)",
-	[SCSI_DEV_CD_DVD]	= "CD/DVD",
-	[SCSI_DEV_CHANGER]	= "Media Changer",
-	[SCSI_DEV_ENCLOSURE]	= "SCSI Enclosure",
-	[SCSI_DEV_OSD]		= "Object Storage Device"
-};
-
-const char *scsi_sense_key_str[SCSI_SK_LIMIT] = {
-	[SCSI_SK_NO_SENSE]		= "No Sense",
-	[SCSI_SK_RECOVERED_ERROR]	= "Recovered Error",
-	[SCSI_SK_NOT_READY]		= "Not Ready",
-	[SCSI_SK_MEDIUM_ERROR]		= "Medium Error",
-	[SCSI_SK_HARDWARE_ERROR]	= "Hardware Error",
-	[SCSI_SK_ILLEGAL_REQUEST]	= "Illegal Request",
-	[SCSI_SK_UNIT_ATTENTION]	= "Unit Attention",
-	[SCSI_SK_DATA_PROTECT]		= "Data Protect",
-	[SCSI_SK_BLANK_CHECK]		= "Blank Check",
-	[SCSI_SK_VENDOR_SPECIFIC]	= "Vendor-specific",
-	[SCSI_SK_COPY_ABORTED]		= "Copy Aborted",
-	[SCSI_SK_ABORTED_COMMAND]	= "Aborted Command",
-	[SCSI_SK_VOLUME_OVERFLOW]	= "Volume Overflow",
-	[SCSI_SK_MISCOMPARE]		= "Miscompare"
-};
-
-/** Get peripheral device type string.
- *
- * Return string description of SCSI peripheral device type.
- * The returned string is valid indefinitely, the caller should
- * not attempt to free it.
- */
-const char *scsi_get_dev_type_str(unsigned dev_type)
-{
-	if (dev_type >= SCSI_DEV_LIMIT || scsi_dev_type_str[dev_type] == NULL)
-		return "Unknown";
-
-	return scsi_dev_type_str[dev_type];
-}
-
-/** Get sense key string.
- *
- * Return string description of SCSI sense key.
- * The returned string is valid indefinitely, the caller should
- * not attempt to free it.
- */
-const char *scsi_get_sense_key_str(unsigned sense_key)
-{
-	if (sense_key >= SCSI_SK_LIMIT || scsi_sense_key_str[sense_key] == NULL)
-		return "Unknown";
-
-	return scsi_sense_key_str[sense_key];
-}
Index: pace/lib/sif/doc/doxygroups.h
===================================================================
--- uspace/lib/sif/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libsif libsif
- * @ingroup libs
- */
Index: pace/lib/sif/include/sif.h
===================================================================
--- uspace/lib/sif/include/sif.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsif
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef LIBSIF_SIF_H_
-#define LIBSIF_SIF_H_
-
-#include <errno.h>
-
-struct sif_sess;
-typedef struct sif_sess sif_doc_t;
-
-struct sif_node;
-typedef struct sif_node sif_node_t;
-
-errno_t sif_new(sif_doc_t **);
-errno_t sif_load(const char *, sif_doc_t **);
-errno_t sif_save(sif_doc_t *, const char *);
-void sif_delete(sif_doc_t *);
-sif_node_t *sif_get_root(sif_doc_t *);
-
-sif_node_t *sif_node_first_child(sif_node_t *);
-sif_node_t *sif_node_next_child(sif_node_t *);
-const char *sif_node_get_type(sif_node_t *);
-const char *sif_node_get_attr(sif_node_t *, const char *);
-
-errno_t sif_node_prepend_child(sif_node_t *, const char *, sif_node_t **);
-errno_t sif_node_append_child(sif_node_t *, const char *, sif_node_t **);
-errno_t sif_node_insert_before(sif_node_t *, const char *, sif_node_t **);
-errno_t sif_node_insert_after(sif_node_t *, const char *, sif_node_t **);
-void sif_node_destroy(sif_node_t *);
-errno_t sif_node_set_attr(sif_node_t *, const char *,
-    const char *);
-void sif_node_unset_attr(sif_node_t *, const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/sif/meson.build
===================================================================
--- uspace/lib/sif/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2018 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/sif.c')
-test_src = files('test/main.c', 'test/sif.c')
Index: pace/lib/sif/private/sif.h
===================================================================
--- uspace/lib/sif/private/sif.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsif
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef PRIVATE_SIF_H_
-#define PRIVATE_SIF_H_
-
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <stdio.h>
-
-/** SIF session */
-struct sif_sess {
-	/** Repository file */
-	FILE *f;
-	/** Repository file name */
-	char *fname;
-	/** Root node */
-	struct sif_node *root;
-};
-
-/** SIF transaction */
-struct sif_trans {
-	struct sif_sess *sess;
-};
-
-/** SIF attribute */
-typedef struct {
-	/** Node to which this attribute belongs */
-	struct sif_node *node;
-	/** Link to @c node->attrs */
-	odlink_t lattrs;
-	/** Attribute name */
-	char *aname;
-	/** Attribute value */
-	char *avalue;
-} sif_attr_t;
-
-/** SIF node */
-struct sif_node {
-	/** Parent node or @c NULL in case of root node */
-	struct sif_node *parent;
-	/** Link to parent->children */
-	link_t lparent;
-	/** Node type */
-	char *ntype;
-	/** Attributes (of sif_attr_t) */
-	odict_t attrs;
-	/** Child nodes */
-	list_t children;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/sif/src/sif.c
===================================================================
--- uspace/lib/sif/src/sif.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1098 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libsif
- * @{
- */
-/**
- * @file Structured Information Format
- *
- * Structured Information Format (SIF) is an API that allows an application
- * to maintain data in a persistent repository in a format that is
- * structured (and hence extensible).
- *
- * SIF is meant to be used as the basis for the storage backend used to
- * maintain application or configuration data. SIF is *not* a (relational)
- * database (not even close). The structure of a SIF repository is quite
- * similar to an XML document that contains just tags with attributes
- * (but no text).
- */
-
-#include <adt/list.h>
-#include <adt/odict.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../include/sif.h"
-#include "../private/sif.h"
-
-static errno_t sif_export_node(sif_node_t *, FILE *);
-static errno_t sif_import_node(sif_node_t *, FILE *, sif_node_t **, bool *);
-static sif_attr_t *sif_node_first_attr(sif_node_t *);
-static sif_attr_t *sif_node_next_attr(sif_attr_t *);
-static void sif_attr_delete(sif_attr_t *);
-static void *sif_attr_getkey(odlink_t *);
-static int sif_attr_cmp(void *, void *);
-
-/** Determine if character can start a name.
- *
- * @param c Character
- * @return @c true iff the character can start a name
- */
-static bool sif_is_name_start_char(char c)
-{
-	return isalpha(c) || c == '_';
-}
-
-/** Determine if character can continue a name.
- *
- * @param c Character
- * @return @c true iff the character can continue a name
- */
-static bool sif_is_name_char(char c)
-{
-	return isalnum(c) || c == '-' || c == '.';
-}
-
-/** Create new SIF node.
- *
- * @param parent Parent node
- * @return Pointer to new node on success or @c NULL if out of memory
- */
-static sif_node_t *sif_node_new(sif_node_t *parent)
-{
-	sif_node_t *node;
-
-	node = calloc(1, sizeof(sif_node_t));
-	if (node == NULL)
-		return NULL;
-
-	node->parent = parent;
-	odict_initialize(&node->attrs, sif_attr_getkey, sif_attr_cmp);
-	list_initialize(&node->children);
-
-	return node;
-}
-
-/** Delete SIF node.
- *
- * Delete a SIF node that has been already unlinked from the tree.
- * This will also delete any attributes or child nodes.
- *
- * @param node Node
- */
-static void sif_node_delete(sif_node_t *node)
-{
-	sif_attr_t *attr;
-	sif_node_t *child;
-
-	if (node == NULL)
-		return;
-
-	assert(!link_used(&node->lparent));
-
-	if (node->ntype != NULL)
-		free(node->ntype);
-
-	attr = sif_node_first_attr(node);
-	while (attr != NULL) {
-		odict_remove(&attr->lattrs);
-		sif_attr_delete(attr);
-		attr = sif_node_first_attr(node);
-	}
-
-	child = sif_node_first_child(node);
-	while (child != NULL) {
-		list_remove(&child->lparent);
-		sif_node_delete(child);
-		child = sif_node_first_child(node);
-	}
-
-	free(node);
-}
-
-/** Create new SIF attribute.
- *
- * @param node Containing node
- * @return Pointer to new node on success or @c NULL if out of memory
- */
-static sif_attr_t *sif_attr_new(sif_node_t *node)
-{
-	sif_attr_t *attr;
-
-	attr = calloc(1, sizeof(sif_attr_t));
-	if (attr == NULL)
-		return NULL;
-
-	attr->node = node;
-	return attr;
-}
-
-/** Delete SIF attribute.
- *
- * Delete a SIF attribute that has been already unlinked from is node.
- *
- * @param attr Attribute
- */
-static void sif_attr_delete(sif_attr_t *attr)
-{
-	if (attr == NULL)
-		return;
-
-	assert(!odlink_used(&attr->lattrs));
-
-	if (attr->aname != NULL)
-		free(attr->aname);
-	if (attr->avalue != NULL)
-		free(attr->avalue);
-
-	free(attr);
-}
-
-/** Create SIF document.
- *
- * @param rdoc Place to store pointer to new document.
- *
- * @return EOK on success or error code
- */
-errno_t sif_new(sif_doc_t **rdoc)
-{
-	sif_doc_t *doc;
-	sif_node_t *root = NULL;
-	errno_t rc;
-
-	doc = calloc(1, sizeof(sif_doc_t));
-	if (doc == NULL)
-		return ENOMEM;
-
-	root = sif_node_new(NULL);
-	if (root == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	root->ntype = str_dup("sif");
-	if (root->ntype == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	doc->root = root;
-
-	*rdoc = doc;
-	return EOK;
-error:
-	sif_node_delete(root);
-	free(doc);
-	return rc;
-}
-
-/** Load SIF document.
- *
- * @param fname File name
- * @param rdoc Place to store pointer to new document.
- *
- * @return EOK on success or error code
- */
-errno_t sif_load(const char *fname, sif_doc_t **rdoc)
-{
-	sif_doc_t *doc;
-	sif_node_t *root = NULL;
-	errno_t rc;
-	bool endtag;
-	FILE *f = NULL;
-
-	doc = calloc(1, sizeof(sif_doc_t));
-	if (doc == NULL)
-		return ENOMEM;
-
-	doc->fname = str_dup(fname);
-	if (doc->fname == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	f = fopen(fname, "r");
-	if (f == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = sif_import_node(NULL, f, &root, &endtag);
-	if (rc != EOK || endtag == true)
-		goto error;
-
-	if (str_cmp(root->ntype, "sif") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	fclose(f);
-	doc->root = root;
-	*rdoc = doc;
-	return EOK;
-error:
-	sif_node_delete(root);
-	free(doc);
-	if (f != NULL)
-		fclose(f);
-	return rc;
-}
-
-/** Delete SIF document.
- *
- * @param doc SIF document
- * @return EOK on success or error code
- */
-void sif_delete(sif_doc_t *doc)
-{
-	sif_node_delete(doc->root);
-	free(doc);
-}
-
-/** Return root node.
- *
- * @param doc SIF document
- */
-sif_node_t *sif_get_root(sif_doc_t *doc)
-{
-	return doc->root;
-}
-
-/** Get first child of a node.
- *
- * @param parent Parent node
- * @return First child node or @c NULL if @a parent has no children
- */
-sif_node_t *sif_node_first_child(sif_node_t *parent)
-{
-	link_t *link;
-
-	link = list_first(&parent->children);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, sif_node_t, lparent);
-}
-
-/** Get next child of a node.
- *
- * @param current Current node
- * @return Next child (i.e. next sibling of @a current)
- */
-sif_node_t *sif_node_next_child(sif_node_t *current)
-{
-	link_t *link;
-
-	link = list_next(&current->lparent, &current->parent->children);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, sif_node_t, lparent);
-}
-
-/** Get node type.
- *
- * @param node SIF node
- * @return Pointer to string, valid until next modification.
- */
-const char *sif_node_get_type(sif_node_t *node)
-{
-	return node->ntype;
-}
-
-/** Get node attribute.
- *
- * @param node SIF node
- * @param aname Attribute name
- *
- * @return Attribute value or @c NULL if attribute is not set
- */
-const char *sif_node_get_attr(sif_node_t *node, const char *aname)
-{
-	odlink_t *link;
-	sif_attr_t *attr;
-
-	link = odict_find_eq(&node->attrs, (void *)aname, NULL);
-	if (link == NULL)
-		return NULL;
-
-	attr = odict_get_instance(link, sif_attr_t, lattrs);
-	return attr->avalue;
-}
-
-/** Save SIF document to file.
- * *
- * @param doc SIF document
- * @param fname File name
- * @return EOK on success or error code
- */
-errno_t sif_save(sif_doc_t *doc, const char *fname)
-{
-	FILE *f = NULL;
-	errno_t rc;
-
-	f = fopen(fname, "w");
-	if (f == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = sif_export_node(doc->root, f);
-	if (rc != EOK)
-		goto error;
-
-	if (fflush(f) == EOF) {
-		rc = EIO;
-		goto error;
-	}
-
-	fclose(f);
-	return EOK;
-error:
-	if (f != NULL)
-		fclose(f);
-	return rc;
-}
-
-/** Prepend new child.
- *
- * Create a new child and prepend it at the beginning of children list of
- * @a parent.
- *
- * @param parent Parent node
- * @param ctype Child type
- * @param rchild Place to store pointer to new child
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-errno_t sif_node_prepend_child(sif_node_t *parent, const char *ctype,
-    sif_node_t **rchild)
-{
-	sif_node_t *child;
-
-	child = sif_node_new(parent);
-	if (child == NULL)
-		return ENOMEM;
-
-	child->ntype = str_dup(ctype);
-	if (child->ntype == NULL) {
-		sif_node_delete(child);
-		return ENOMEM;
-	}
-
-	list_prepend(&child->lparent, &parent->children);
-
-	*rchild = child;
-	return EOK;
-}
-
-/** Append new child.
- *
- * Create a new child and append it at the end of children list of @a parent.
- *
- * @param parent Parent node
- * @param ctype Child type
- * @param rchild Place to store pointer to new child
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-errno_t sif_node_append_child(sif_node_t *parent, const char *ctype,
-    sif_node_t **rchild)
-{
-	sif_node_t *child;
-
-	child = sif_node_new(parent);
-	if (child == NULL)
-		return ENOMEM;
-
-	child->ntype = str_dup(ctype);
-	if (child->ntype == NULL) {
-		sif_node_delete(child);
-		return ENOMEM;
-	}
-
-	list_append(&child->lparent, &parent->children);
-
-	*rchild = child;
-	return EOK;
-}
-
-/** Insert new child before existing child.
- *
- * Create a new child and insert it before an existing child.
- *
- * @param sibling Sibling before which to insert
- * @param ctype Child type
- * @param rchild Place to store pointer to new child
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-errno_t sif_node_insert_before(sif_node_t *sibling, const char *ctype,
-    sif_node_t **rchild)
-{
-	sif_node_t *child;
-
-	child = sif_node_new(sibling->parent);
-	if (child == NULL)
-		return ENOMEM;
-
-	child->ntype = str_dup(ctype);
-	if (child->ntype == NULL) {
-		sif_node_delete(child);
-		return ENOMEM;
-	}
-
-	list_insert_before(&child->lparent, &sibling->lparent);
-
-	*rchild = child;
-	return EOK;
-}
-
-/** Insert new child after existing child.
- *
- * Create a new child and insert it after an existing child.
- *
- * @param sibling Sibling after which to insert
- * @param ctype Child type
- * @param rchild Place to store pointer to new child
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-errno_t sif_node_insert_after(sif_node_t *sibling, const char *ctype,
-    sif_node_t **rchild)
-{
-	sif_node_t *child;
-
-	child = sif_node_new(sibling->parent);
-	if (child == NULL)
-		return ENOMEM;
-
-	child->ntype = str_dup(ctype);
-	if (child->ntype == NULL) {
-		sif_node_delete(child);
-		return ENOMEM;
-	}
-
-	list_insert_after(&child->lparent, &sibling->lparent);
-
-	*rchild = child;
-	return EOK;
-}
-
-/** Destroy SIF node.
- *
- * @param node Node to destroy
- */
-void sif_node_destroy(sif_node_t *node)
-{
-	list_remove(&node->lparent);
-	sif_node_delete(node);
-}
-
-/** Set node attribute.
- *
- * @param node SIF node
- * @param aname Attribute name
- * @param value Attribute value
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t sif_node_set_attr(sif_node_t *node, const char *aname,
-    const char *avalue)
-{
-	odlink_t *link;
-	sif_attr_t *attr;
-	char *cvalue;
-
-	link = odict_find_eq(&node->attrs, (void *)aname, NULL);
-
-	if (link != NULL) {
-		attr = odict_get_instance(link, sif_attr_t, lattrs);
-		cvalue = str_dup(avalue);
-		if (cvalue == NULL)
-			return ENOMEM;
-
-		free(attr->avalue);
-		attr->avalue = cvalue;
-	} else {
-		attr = sif_attr_new(node);
-		if (attr == NULL)
-			return ENOMEM;
-
-		attr->aname = str_dup(aname);
-		if (attr->aname == NULL) {
-			sif_attr_delete(attr);
-			return ENOMEM;
-		}
-
-		attr->avalue = str_dup(avalue);
-		if (attr->avalue == NULL) {
-			sif_attr_delete(attr);
-			return ENOMEM;
-		}
-
-		odict_insert(&attr->lattrs, &node->attrs, NULL);
-	}
-
-	return EOK;
-}
-
-/** Unset node attribute.
- *
- * @param node Node
- * @param aname Attribute name
- */
-void sif_node_unset_attr(sif_node_t *node, const char *aname)
-{
-	odlink_t *link;
-	sif_attr_t *attr;
-
-	link = odict_find_eq(&node->attrs, (void *)aname, NULL);
-	if (link == NULL)
-		return;
-
-	attr = odict_get_instance(link, sif_attr_t, lattrs);
-	odict_remove(link);
-	sif_attr_delete(attr);
-}
-
-/** Export node name to file.
- *
- * Export node name to file.
- *
- * @param str String
- * @param f File
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_export_name(const char *str, FILE *f)
-{
-	if (fputs(str, f) == EOF)
-		return EIO;
-
-	return EOK;
-}
-
-/** Export string to file.
- *
- * Export string to file (the string is double-quoted and escaped).
- *
- * @param str String
- * @param f File
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_export_string(const char *str, FILE *f)
-{
-	const char *cp;
-
-	if (fputc('"', f) == EOF)
-		return EIO;
-
-	cp = str;
-	while (*cp != '\0') {
-		if (*cp == '<') {
-			if (fputs("&lt;", f) == EOF)
-				return EIO;
-		} else if (*cp == '"') {
-			if (fputs("&quot;", f) == EOF)
-				return EIO;
-		} else {
-			if (fputc(*cp, f) == EOF)
-				return EIO;
-		}
-
-		++cp;
-	}
-
-	if (fputc('"', f) == EOF)
-		return EIO;
-
-	return EOK;
-}
-
-/** Read characters from file, make sure they match the specified sequence.
- *
- * @param f File
- * @param chars Expected sequence of characters to be read
- *
- * @return EOK on success, EIO on I/O error or mismatch
- */
-static errno_t sif_get_verify_chars(FILE *f, const char *chars)
-{
-	const char *cp;
-	char c;
-
-	cp = chars;
-	while (*cp != '\0') {
-		c = fgetc(f);
-		if (c != *cp)
-			return EIO;
-		++cp;
-	}
-
-	return EOK;
-}
-
-/** Import name from file.
- * *
- * @param f File
- * @param rstr Place to store pointer to newly allocated string
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_import_name(FILE *f, char **rstr)
-{
-	char *str;
-	char *nstr;
-	size_t str_size;
-	size_t sidx;
-	int c;
-	errno_t rc;
-
-	str_size = 1;
-	sidx = 0;
-	str = malloc(str_size + 1);
-	if (str == NULL)
-		return ENOMEM;
-
-	c = fgetc(f);
-	if (!sif_is_name_start_char(c)) {
-		rc = EIO;
-		goto error;
-	}
-
-	while (true) {
-		if (sidx >= str_size) {
-			str_size *= 2;
-			nstr = realloc(str, str_size + 1);
-			if (nstr == NULL) {
-				rc = ENOMEM;
-				goto error;
-			}
-
-			str = nstr;
-		}
-
-		str[sidx++] = c;
-
-		c = fgetc(f);
-		if (!sif_is_name_char(c))
-			break;
-	}
-
-	ungetc(c, f);
-
-	str[sidx] = '\0';
-	*rstr = str;
-	return EOK;
-error:
-	free(str);
-	return rc;
-}
-
-/** Import string from file.
- *
- * Import string from file (the string in the file must be
- * properly quoted and escaped).
- *
- * @param f File
- * @param rstr Place to store pointer to newly allocated string
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_import_string(FILE *f, char **rstr)
-{
-	char *str;
-	char *nstr;
-	size_t str_size;
-	size_t sidx;
-	int c;
-	errno_t rc;
-
-	str_size = 1;
-	sidx = 0;
-	str = malloc(str_size + 1);
-	if (str == NULL)
-		return ENOMEM;
-
-	c = fgetc(f);
-	if (c != '"') {
-		rc = EIO;
-		goto error;
-	}
-
-	while (true) {
-		c = fgetc(f);
-		if (c == EOF) {
-			rc = EIO;
-			goto error;
-		}
-
-		if (c == '"')
-			break;
-
-		if (c == '&') {
-			c = fgetc(f);
-			if (c == EOF) {
-				rc = EIO;
-				goto error;
-			}
-
-			if (c == 'q') {
-				rc = sif_get_verify_chars(f, "uot;");
-				if (rc != EOK)
-					goto error;
-			} else if (c == 'l') {
-				rc = sif_get_verify_chars(f, "t;");
-				if (rc != EOK)
-					goto error;
-			} else {
-				rc = EIO;
-				goto error;
-			}
-		}
-
-		if (sidx >= str_size) {
-			str_size *= 2;
-			nstr = realloc(str, str_size + 1);
-			if (nstr == NULL) {
-				rc = ENOMEM;
-				goto error;
-			}
-
-			str = nstr;
-		}
-
-		str[sidx++] = c;
-	}
-
-	str[sidx] = '\0';
-	*rstr = str;
-	return EOK;
-error:
-	free(str);
-	return rc;
-}
-
-/** Import SIF attribute from file.
- *
- * @param node Node under which attribute shou
- * @param f File
- * @param rattr Place to store pointer to imported SIF attribute
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_import_attr(sif_node_t *node, FILE *f, sif_attr_t **rattr)
-{
-	errno_t rc;
-	char *aname = NULL;
-	char *avalue = NULL;
-	sif_attr_t *attr;
-	int c;
-
-	rc = sif_import_name(f, &aname);
-	if (rc != EOK)
-		goto error;
-
-	c = fgetc(f);
-	if (c != '=') {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = sif_import_string(f, &avalue);
-	if (rc != EOK)
-		goto error;
-
-	attr = sif_attr_new(node);
-	if (attr == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	attr->aname = aname;
-	attr->avalue = avalue;
-
-	*rattr = attr;
-	return EOK;
-error:
-	if (aname != NULL)
-		free(aname);
-	if (avalue != NULL)
-		free(avalue);
-	return rc;
-}
-
-/** Export SIF attribute to file.
- *
- * @param attr SIF attribute
- * @param f File
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_export_attr(sif_attr_t *attr, FILE *f)
-{
-	errno_t rc;
-
-	rc = sif_export_name(attr->aname, f);
-	if (rc != EOK)
-		return rc;
-
-	if (fputc('=', f) == EOF)
-		return EIO;
-
-	rc = sif_export_string(attr->avalue, f);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Export SIF node to file.
- *
- * @param node SIF node
- * @param f File
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_export_node(sif_node_t *node, FILE *f)
-{
-	errno_t rc;
-	sif_attr_t *attr;
-	sif_node_t *child;
-
-	if (fputc('<', f) == EOF)
-		return EIO;
-
-	rc = sif_export_name(node->ntype, f);
-	if (rc != EOK)
-		return rc;
-
-	/* Attributes */
-
-	attr = sif_node_first_attr(node);
-	while (attr != NULL) {
-		if (fputc(' ', f) == EOF)
-			return EIO;
-
-		rc = sif_export_attr(attr, f);
-		if (rc != EOK)
-			return rc;
-
-		attr = sif_node_next_attr(attr);
-	}
-
-	if (fputs(">\n", f) == EOF)
-		return EIO;
-
-	/* Child nodes */
-
-	child = sif_node_first_child(node);
-	while (child != NULL) {
-		rc = sif_export_node(child, f);
-		if (rc != EOK)
-			return rc;
-
-		child = sif_node_next_child(child);
-	}
-
-	if (fputs("</", f) == EOF)
-		return EIO;
-
-	rc = sif_export_name(node->ntype, f);
-	if (rc != EOK)
-		return rc;
-
-	if (fputs(">\n", f) == EOF)
-		return EIO;
-
-	return EOK;
-}
-
-/** Import SIF node from file.
- *
- * @param parent Parent node
- * @param f File
- * @param rnode Place to store pointer to imported node
- * @param rendtag Place to store @c true iff end tag is encountered
- * @return EOK on success, EIO on I/O error
- */
-static errno_t sif_import_node(sif_node_t *parent, FILE *f, sif_node_t **rnode,
-    bool *rendtag)
-{
-	errno_t rc;
-	sif_node_t *node = NULL;
-	sif_node_t *child;
-	sif_attr_t *attr = NULL;
-	bool endtag;
-	bool cendtag;
-	char *ntype;
-	int c;
-
-	node = sif_node_new(parent);
-	if (node == NULL)
-		return ENOMEM;
-
-	c = fgetc(f);
-	while (isspace(c))
-		c = fgetc(f);
-
-	if (c != '<') {
-		rc = EIO;
-		goto error;
-	}
-
-	c = fgetc(f);
-	if (c == '/') {
-		endtag = true;
-	} else {
-		endtag = false;
-		ungetc(c, f);
-	}
-
-	rc = sif_import_name(f, &ntype);
-	if (rc != EOK)
-		goto error;
-
-	node->ntype = ntype;
-
-	/* Attributes */
-
-	c = fgetc(f);
-	if (c == EOF) {
-		rc = EIO;
-		goto error;
-	}
-
-	while (c != '>') {
-		/* End tags cannot have attributes */
-		if (endtag) {
-			rc = EIO;
-			goto error;
-		}
-
-		while (isspace(c))
-			c = fgetc(f);
-		ungetc(c, f);
-
-		rc = sif_import_attr(node, f, &attr);
-		if (rc != EOK)
-			goto error;
-
-		odict_insert(&attr->lattrs, &node->attrs, NULL);
-
-		c = fgetc(f);
-		if (c == EOF) {
-			rc = EIO;
-			goto error;
-		}
-	}
-
-	/* Child nodes */
-
-	if (!endtag) {
-		while (true) {
-			rc = sif_import_node(node, f, &child, &cendtag);
-			if (rc != EOK)
-				goto error;
-
-			if (cendtag) {
-				sif_node_delete(child);
-				break;
-			}
-
-			list_append(&child->lparent, &node->children);
-		}
-	}
-
-	*rnode = node;
-	*rendtag = endtag;
-	return EOK;
-error:
-	sif_node_delete(node);
-	return rc;
-}
-
-/** Get first attribute or a node.
- *
- * @param node SIF node
- * @return First attribute or @c NULL if there is none
- */
-static sif_attr_t *sif_node_first_attr(sif_node_t *node)
-{
-	odlink_t *link;
-
-	link = odict_first(&node->attrs);
-	if (link == NULL)
-		return NULL;
-
-	return odict_get_instance(link, sif_attr_t, lattrs);
-}
-
-/** Get next attribute or a node.
- *
- * @param cur Current attribute
- * @return Next attribute or @c NULL if there is none
- */
-static sif_attr_t *sif_node_next_attr(sif_attr_t *cur)
-{
-	odlink_t *link;
-
-	link = odict_next(&cur->lattrs, &cur->node->attrs);
-	if (link == NULL)
-		return NULL;
-
-	return odict_get_instance(link, sif_attr_t, lattrs);
-}
-
-/** Get key callback for ordered dictionary of node attributes.
- *
- * @param link Ordered dictionary link of attribute
- * @return Pointer to attribute name
- */
-static void *sif_attr_getkey(odlink_t *link)
-{
-	return (void *)odict_get_instance(link, sif_attr_t, lattrs)->aname;
-}
-
-/** Comparison callback for  ordered dictionary of node attributes.
- *
- * @param a Name of first attribute
- * @param b Name of second attribute
- * @return Less than zero, zero or greater than zero, if a < b, a == b, a > b,
- *         respectively.
- */
-static int sif_attr_cmp(void *a, void *b)
-{
-	char *ca, *cb;
-
-	ca = (char *)a;
-	cb = (char *)b;
-
-	return str_cmp(ca, cb);
-}
-
-/** @}
- */
Index: pace/lib/sif/test/main.c
===================================================================
--- uspace/lib/sif/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(sif);
-
-PCUT_MAIN();
Index: pace/lib/sif/test/sif.c
===================================================================
--- uspace/lib/sif/test/sif.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,591 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <str.h>
-#include "../include/sif.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(sif);
-#if 0
-/** Test sif_new and sif_delete. */
-PCUT_TEST(sif_create)
-{
-	sif_doc_t *doc;
-	errno_t rc;
-
-	rc = sif_new(&doc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sif_delete(doc);
-}
-
-/** Test sif_load. */
-PCUT_TEST(sif_load)
-{
-	sif_sess_t *sess;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_open(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_get_root. */
-PCUT_TEST(sif_get_root)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-	PCUT_ASSERT_NOT_NULL(root);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(sif_node_get_type(root), "sif"));
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_prepend_child. */
-PCUT_TEST(sif_node_prepend_child)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *ca;
-	sif_node_t *cb;
-	sif_node_t *c1;
-	sif_node_t *c2;
-	sif_node_t *c3;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_prepend_child(trans, root, "a", &ca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_prepend_child(trans, root, "b", &cb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c1 = sif_node_first_child(root);
-	PCUT_ASSERT_TRUE(c1 == cb);
-
-	c2 = sif_node_next_child(c1);
-	PCUT_ASSERT_TRUE(c2 == ca);
-
-	c3 = sif_node_next_child(c2);
-	PCUT_ASSERT_TRUE(c3 == NULL);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_append_child. */
-PCUT_TEST(sif_node_append_child)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *ca;
-	sif_node_t *cb;
-	sif_node_t *c1;
-	sif_node_t *c2;
-	sif_node_t *c3;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "a", &ca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "b", &cb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c1 = sif_node_first_child(root);
-	PCUT_ASSERT_TRUE(c1 == ca);
-
-	c2 = sif_node_next_child(c1);
-	PCUT_ASSERT_TRUE(c2 == cb);
-
-	c3 = sif_node_next_child(c2);
-	PCUT_ASSERT_TRUE(c3 == NULL);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_insert_before. */
-PCUT_TEST(sif_node_insert_before)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *ca;
-	sif_node_t *cb;
-	sif_node_t *cc;
-	sif_node_t *c1;
-	sif_node_t *c2;
-	sif_node_t *c3;
-	sif_node_t *c4;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "a", &ca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "c", &cc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_insert_before(trans, cc, "b", &cb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c1 = sif_node_first_child(root);
-	PCUT_ASSERT_TRUE(c1 == ca);
-
-	c2 = sif_node_next_child(c1);
-	PCUT_ASSERT_TRUE(c2 == cb);
-
-	c3 = sif_node_next_child(c2);
-	PCUT_ASSERT_TRUE(c3 == cc);
-
-	c4 = sif_node_next_child(c3);
-	PCUT_ASSERT_TRUE(c4 == NULL);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_insert_after. */
-PCUT_TEST(sif_node_insert_after)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *ca;
-	sif_node_t *cb;
-	sif_node_t *cc;
-	sif_node_t *c1;
-	sif_node_t *c2;
-	sif_node_t *c3;
-	sif_node_t *c4;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "a", &ca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "c", &cc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_insert_after(trans, ca, "b", &cb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c1 = sif_node_first_child(root);
-	PCUT_ASSERT_TRUE(c1 == ca);
-
-	c2 = sif_node_next_child(c1);
-	PCUT_ASSERT_TRUE(c2 == cb);
-
-	c3 = sif_node_next_child(c2);
-	PCUT_ASSERT_TRUE(c3 == cc);
-
-	c4 = sif_node_next_child(c3);
-	PCUT_ASSERT_TRUE(c4 == NULL);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_destroy. */
-PCUT_TEST(sif_node_destroy)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *ca;
-	sif_node_t *cb;
-	sif_node_t *cc;
-	sif_node_t *c1;
-	sif_node_t *c2;
-	sif_node_t *c3;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "a", &ca);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "b", &cb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "c", &cc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sif_node_destroy(trans, cb);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c1 = sif_node_first_child(root);
-	PCUT_ASSERT_TRUE(c1 == ca);
-
-	c2 = sif_node_next_child(c1);
-	PCUT_ASSERT_TRUE(c2 == cc);
-
-	c3 = sif_node_next_child(c2);
-	PCUT_ASSERT_TRUE(c3 == NULL);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_set_attr. */
-PCUT_TEST(sif_node_set_attr)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *node;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-	const char *aval;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "node", &node);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_set_attr(trans, node, "a", "?");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_set_attr(trans, node, "a", "X");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_set_attr(trans, node, "b", "Y");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	aval = sif_node_get_attr(node, "a");
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(aval, "X"));
-
-	aval = sif_node_get_attr(node, "b");
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(aval, "Y"));
-
-	aval = sif_node_get_attr(node, "c");
-	PCUT_ASSERT_NULL((void *) aval); // XXX PCUT_ASSERT_NULL does not accept const pointer
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test sif_node_unset_attr. */
-PCUT_TEST(sif_node_unset_attr)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *node;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-	const char *aval;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "node", &node);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_set_attr(trans, node, "a", "X");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	aval = sif_node_get_attr(node, "a");
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(aval, "X"));
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sif_node_unset_attr(trans, node, "a");
-	sif_node_unset_attr(trans, node, "b");
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	aval = sif_node_get_attr(node, "a");
-	PCUT_ASSERT_NULL((void *) aval); // XXX PCUT_ASSERT_NULL does not accept const pointer
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-
-/** Test persistence of nodes and attributes. */
-PCUT_TEST(sif_persist)
-{
-	sif_sess_t *sess;
-	sif_node_t *root;
-	sif_node_t *node;
-	sif_trans_t *trans;
-	errno_t rc;
-	int rv;
-	char *fname;
-	char *p;
-	const char *aval;
-
-	fname = calloc(L_tmpnam, 1);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_TRUE(p == fname);
-
-	rc = sif_create(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	rc = sif_trans_begin(sess, &trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_append_child(trans, root, "node", &node);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_node_set_attr(trans, node, "a", "X");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_trans_end(trans);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now reopen the repository */
-
-	rc = sif_open(fname, &sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	root = sif_get_root(sess);
-
-	node = sif_node_first_child(root);
-	PCUT_ASSERT_NOT_NULL(node);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(sif_node_get_type(node), "node"));
-
-	aval = sif_node_get_attr(node, "a");
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(aval, "X"));
-
-	rc = sif_close(sess);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-}
-#endif
-PCUT_EXPORT(sif);
Index: pace/lib/system/doc/doxygroups.h
===================================================================
--- uspace/lib/system/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libsystem libsystem
- * @ingroup libs
- */
Index: pace/lib/system/include/ipc/system.h
===================================================================
--- uspace/lib/system/include/ipc/system.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control service interface
- */
-
-#ifndef _LIBSYSTEM_IPC_SYSTEM_H_
-#define _LIBSYSTEM_IPC_SYSTEM_H_
-
-#include <ipc/common.h>
-
-typedef enum {
-	SYSTEM_SHUTDOWN_COMPLETE = IPC_FIRST_USER_METHOD,
-	SYSTEM_SHUTDOWN_FAILED
-} system_event_t;
-
-typedef enum {
-	SYSTEM_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	SYSTEM_POWEROFF,
-	SYSTEM_RESTART
-} system_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/system/include/system.h
===================================================================
--- uspace/lib/system/include/system.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control service interface
- */
-
-#ifndef _LIBSYSTEM_SYSTEM_H_
-#define _LIBSYSTEM_SYSTEM_H_
-
-#include <errno.h>
-#include "types/system.h"
-
-#define SYSTEM_DEFAULT "system"
-
-extern errno_t system_open(const char *, system_cb_t *, void *, system_t **);
-extern void system_close(system_t *);
-extern errno_t system_poweroff(system_t *);
-extern errno_t system_restart(system_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/system/include/system_srv.h
===================================================================
--- uspace/lib/system/include/system_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control protocol server stub
- */
-
-#ifndef _LIBSYSTEM_SYSTEM_SRV_H_
-#define _LIBSYSTEM_SYSTEM_SRV_H_
-
-#include <async.h>
-#include <errno.h>
-
-typedef struct system_ops system_ops_t;
-
-/** System server structure (per client session) */
-typedef struct {
-	async_sess_t *client_sess;
-	system_ops_t *ops;
-	void *arg;
-} system_srv_t;
-
-struct system_ops {
-	errno_t (*poweroff)(void *);
-	errno_t (*restart)(void *);
-};
-
-extern void system_conn(ipc_call_t *, system_srv_t *);
-extern void system_srv_initialize(system_srv_t *);
-extern void system_srv_shutdown_complete(system_srv_t *);
-extern void system_srv_shutdown_failed(system_srv_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/system/include/types/system.h
===================================================================
--- uspace/lib/system/include/types/system.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control service interface
- */
-
-#ifndef _LIBSYSTEM_TYPES_SYSTEM_H_
-#define _LIBSYSTEM_TYPES_SYSTEM_H_
-
-/** System control service callbacks */
-typedef struct {
-	/** Shutdown completed successfully */
-	void (*shutdown_complete)(void *);
-	/** Shutdown failed */
-	void (*shutdown_failed)(void *);
-} system_cb_t;
-
-struct system;
-typedef struct system system_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/system/meson.build
===================================================================
--- uspace/lib/system/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-    'src/system.c',
-    'src/system_srv.c'
-)
-
-test_src = files(
-	'test/main.c',
-	'test/system.c'
-)
Index: pace/lib/system/private/system.h
===================================================================
--- uspace/lib/system/private/system.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control service interface
- */
-
-#ifndef _LIBSYSTEM_PRIVATE_SYSTEM_H_
-#define _LIBSYSTEM_PRIVATE_SYSTEM_H_
-
-#include <fibril_synch.h>
-#include <stdbool.h>
-
-/** System control service session */
-struct system {
-	/** Session with system control service */
-	async_sess_t *sess;
-	/** Callbacks */
-	system_cb_t *cb;
-	/** Argument to callback functions */
-	void *cb_arg;
-	/** Synchronize access to system object */
-	fibril_mutex_t lock;
-	/** @c true if callback handler terminated */
-	bool cb_done;
-	/** Signalled when cb_done or ev_pending is changed */
-	fibril_condvar_t cv;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/system/src/system.c
===================================================================
--- uspace/lib/system/src/system.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/** @file System control service interface
- */
-
-#include <async.h>
-#include <assert.h>
-#include <system.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <ipc/system.h>
-#include <loc.h>
-#include <stdlib.h>
-#include "../private/system.h"
-
-static errno_t system_callback_create(system_t *);
-static void system_cb_conn(ipc_call_t *, void *);
-
-/** Open system control service.
- *
- * @param svcname Service name
- * @param cb Pointer to callback structure
- * @param arg Argument passed to callback functions
- * @param rsystem Place to store pointer to system control service object.
- *
- * @return EOK on success or an error code
- */
-errno_t system_open(const char *svcname, system_cb_t *cb, void *arg,
-    system_t **rsystem)
-{
-	service_id_t system_svc;
-	async_sess_t *sess;
-	system_t *system;
-	errno_t rc;
-
-	system = calloc(1, sizeof(system_t));
-	if (system == NULL)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&system->lock);
-	fibril_condvar_initialize(&system->cv);
-
-	rc = loc_service_get_id(svcname, &system_svc, IPC_FLAG_BLOCKING);
-	if (rc != EOK)
-		goto error;
-
-	sess = loc_service_connect(system_svc, INTERFACE_SYSTEM,
-	    IPC_FLAG_BLOCKING);
-	if (sess == NULL)
-		goto error;
-
-	system->sess = sess;
-	system->cb = cb;
-	system->cb_arg = arg;
-
-	rc = system_callback_create(system);
-	if (rc != EOK) {
-		async_hangup(sess);
-		goto error;
-	}
-
-	*rsystem = system;
-	return EOK;
-error:
-	free(system);
-	return rc;
-}
-
-/** Close system control service.
- *
- * @param system System control service
- */
-void system_close(system_t *system)
-{
-	fibril_mutex_lock(&system->lock);
-	async_hangup(system->sess);
-	system->sess = NULL;
-
-	/* Wait for callback handler to terminate */
-
-	while (!system->cb_done)
-		fibril_condvar_wait(&system->cv, &system->lock);
-	fibril_mutex_unlock(&system->lock);
-
-	free(system);
-}
-
-/** Create callback connection from system control service.
- *
- * @param system System control service
- * @return EOK on success or an error code
- */
-static errno_t system_callback_create(system_t *system)
-{
-	async_exch_t *exch = async_exchange_begin(system->sess);
-
-	aid_t req = async_send_0(exch, SYSTEM_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_SYSTEM_CB, 0, 0,
-	    system_cb_conn, system, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Shut down and power the system off.
- *
- * This function is asynchronous. It returns immediately with success
- * if the system started shutting down. Once shutdown is completed,
- * the @c shutdown_complete callback is executed. If the shutdown fails,
- * the @c shutdown_fail callback is executed.
- *
- * @param system System control service
- * @return EOK on succes or an error code
- */
-errno_t system_poweroff(system_t *system)
-{
-	async_exch_t *exch = async_exchange_begin(system->sess);
-	errno_t rc = async_req_0_0(exch, SYSTEM_POWEROFF);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** Shut down and restart the system.
- *
- * This function is asynchronous. It returns immediately with success
- * if the system started shutting down. Once shutdown is completed,
- * the @c shutdown_complete callback is executed. If the shutdown fails,
- * the @c shutdown_fail callback is executed.
- *
- * @param system System control service
- * @return EOK on succes or an error code
- */
-errno_t system_restart(system_t *system)
-{
-	async_exch_t *exch = async_exchange_begin(system->sess);
-	errno_t rc = async_req_0_0(exch, SYSTEM_RESTART);
-	async_exchange_end(exch);
-
-	return rc;
-}
-
-/** System shutdown completed.
- *
- * @param system System control service
- * @param icall Call data
- */
-static void system_shutdown_complete(system_t *system, ipc_call_t *icall)
-{
-	if (system->cb != NULL && system->cb->shutdown_complete != NULL)
-		system->cb->shutdown_complete(system->cb_arg);
-
-	async_answer_0(icall, EOK);
-}
-
-/** System shutdown failed.
- *
- * @param system System control service
- * @param icall Call data
- */
-static void system_shutdown_failed(system_t *system, ipc_call_t *icall)
-{
-	if (system->cb != NULL && system->cb->shutdown_complete != NULL)
-		system->cb->shutdown_failed(system->cb_arg);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Callback connection handler.
- *
- * @param icall Connect call data
- * @param arg   Argument, system_t *
- */
-static void system_cb_conn(ipc_call_t *icall, void *arg)
-{
-	system_t *system = (system_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case SYSTEM_SHUTDOWN_COMPLETE:
-			system_shutdown_complete(system, &call);
-			break;
-		case SYSTEM_SHUTDOWN_FAILED:
-			system_shutdown_failed(system, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&system->lock);
-	system->cb_done = true;
-	fibril_mutex_unlock(&system->lock);
-	fibril_condvar_broadcast(&system->cv);
-}
-
-/** @}
- */
Index: pace/lib/system/src/system_srv.c
===================================================================
--- uspace/lib/system/src/system_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libsystem
- * @{
- */
-/**
- * @file
- * @brief System control protocol server stub
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <ipc/system.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <system_srv.h>
-
-static void system_callback_create_srv(system_srv_t *srv, ipc_call_t *call)
-{
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	srv->client_sess = sess;
-	async_answer_0(call, EOK);
-}
-
-static void system_poweroff_srv(system_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-
-	if (srv->ops->poweroff == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->poweroff(srv->arg);
-	async_answer_0(icall, rc);
-}
-
-static void system_restart_srv(system_srv_t *srv, ipc_call_t *icall)
-{
-	errno_t rc;
-
-	if (srv->ops->restart == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->restart(srv->arg);
-	async_answer_0(icall, rc);
-}
-
-void system_conn(ipc_call_t *icall, system_srv_t *srv)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case SYSTEM_CALLBACK_CREATE:
-			system_callback_create_srv(srv, &call);
-			break;
-		case SYSTEM_POWEROFF:
-			system_poweroff_srv(srv, &call);
-			break;
-		case SYSTEM_RESTART:
-			system_restart_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	/* Hang up callback session */
-	if (srv->client_sess != NULL) {
-		async_hangup(srv->client_sess);
-		srv->client_sess = NULL;
-	}
-}
-
-/** Initialize system server structure
- *
- * @param srv System server structure to initialize
- */
-void system_srv_initialize(system_srv_t *srv)
-{
-	memset(srv, 0, sizeof(*srv));
-}
-
-/** Send 'shutdown complete' event to client.
- *
- * @param srv System server structure
- */
-void system_srv_shutdown_complete(system_srv_t *srv)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(srv->client_sess);
-	async_msg_0(exch, SYSTEM_SHUTDOWN_COMPLETE);
-	async_exchange_end(exch);
-}
-
-/** Send 'shutdown failed' event to client.
- *
- * @param srv System server structure
- */
-void system_srv_shutdown_failed(system_srv_t *srv)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(srv->client_sess);
-	async_msg_0(exch, SYSTEM_SHUTDOWN_FAILED);
-	async_exchange_end(exch);
-}
-
-/** @}
- */
Index: pace/lib/system/test/main.c
===================================================================
--- uspace/lib/system/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(system);
-
-PCUT_MAIN();
Index: pace/lib/system/test/system.c
===================================================================
--- uspace/lib/system/test/system.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,401 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include <system.h>
-#include <system_srv.h>
-#include "../private/system.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(system);
-
-static const char *test_system_server = "test-system";
-static const char *test_system_svc = "test/system";
-
-void test_system_conn(ipc_call_t *, void *);
-
-static errno_t test_poweroff(void *);
-static errno_t test_restart(void *);
-
-static void test_sys_shutdown_complete(void *);
-static void test_sys_shutdown_failed(void *);
-
-static system_ops_t test_system_srv_ops = {
-	.poweroff = test_poweroff,
-	.restart = test_restart
-};
-
-system_cb_t test_system_cb = {
-	.shutdown_complete = test_sys_shutdown_complete,
-	.shutdown_failed = test_sys_shutdown_failed
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-
-	bool poweroff_called;
-	bool restart_called;
-	bool shutdown_complete_called;
-	bool shutdown_failed_called;
-
-	fibril_condvar_t event_cv;
-	fibril_mutex_t event_lock;
-	system_srv_t *srv;
-} test_response_t;
-
-/** system_open(), system_close() work for valid system control service */
-PCUT_TEST(open_close)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, NULL, NULL, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-
-	system_close(system);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** system_poweroff() with server returning error response works */
-PCUT_TEST(poweroff_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, NULL, NULL, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-
-	resp.rc = ENOMEM;
-	resp.poweroff_called = false;
-
-	rc = system_poweroff(system);
-	PCUT_ASSERT_TRUE(resp.poweroff_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	system_close(system);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** system_poweroff() with server returning success response works */
-PCUT_TEST(poweroff_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, NULL, NULL, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-
-	resp.rc = EOK;
-	resp.poweroff_called = false;
-
-	rc = system_poweroff(system);
-	PCUT_ASSERT_TRUE(resp.poweroff_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	system_close(system);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** system_restart() with server returning error response works */
-PCUT_TEST(restart_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, NULL, NULL, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-
-	resp.rc = ENOMEM;
-	resp.restart_called = false;
-
-	rc = system_restart(system);
-	PCUT_ASSERT_TRUE(resp.restart_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	system_close(system);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** system_restart() with server returning success response works */
-PCUT_TEST(restart_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, NULL, NULL, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-
-	resp.rc = EOK;
-	resp.restart_called = false;
-
-	rc = system_restart(system);
-	PCUT_ASSERT_TRUE(resp.restart_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	system_close(system);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** 'Shutdown complete' event is delivered from server to client callback
- * function.
- */
-PCUT_TEST(shutdown_complete)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, &test_system_cb, &resp, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.shutdown_complete_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	system_srv_shutdown_complete(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.shutdown_complete_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	system_close(system);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** 'Shutdown failed' event is delivered from server to client callback
- * function.
- */
-PCUT_TEST(shutdown_failed)
-{
-	errno_t rc;
-	service_id_t sid;
-	system_t *system = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_system_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_system_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_system_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = system_open(test_system_svc, &test_system_cb, &resp, &system);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(system);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.shutdown_failed_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	system_srv_shutdown_failed(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.shutdown_failed_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	system_close(system);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Test system control service connection. */
-void test_system_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *)arg;
-	system_srv_t srv;
-
-	/* Set up protocol structure */
-	system_srv_initialize(&srv);
-	srv.ops = &test_system_srv_ops;
-	srv.arg = arg;
-	resp->srv = &srv;
-
-	/* Handle connection */
-	system_conn(icall, &srv);
-
-	resp->srv = NULL;
-}
-
-/** Test system poweroff.
- *
- * @param arg Argument (test_response_t *)
- */
-static errno_t test_poweroff(void *arg)
-{
-	test_response_t *resp = (test_response_t *)arg;
-
-	resp->poweroff_called = true;
-	return resp->rc;
-}
-
-/** Test system restart.
- *
- * @param arg Argument (test_response_t *)
- */
-static errno_t test_restart(void *arg)
-{
-	test_response_t *resp = (test_response_t *)arg;
-
-	resp->restart_called = true;
-	return resp->rc;
-}
-
-/** Test system shutdown complete.
- *
- * @param arg Argument (test_response_t *)
- */
-static void test_sys_shutdown_complete(void *arg)
-{
-	test_response_t *resp = (test_response_t *)arg;
-
-	resp->shutdown_complete_called = true;
-	fibril_condvar_signal(&resp->event_cv);
-}
-
-/** Test system shutdown failed.
- *
- * @param arg Argument (test_response_t *)
- */
-static void test_sys_shutdown_failed(void *arg)
-{
-	test_response_t *resp = (test_response_t *)arg;
-
-	resp->shutdown_failed_called = true;
-}
-
-PCUT_EXPORT(system);
Index: pace/lib/tbarcfg/doc/doxygroups.h
===================================================================
--- uspace/lib/tbarcfg/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libtbarcfg libtbarcfg
- * @ingroup libs
- */
Index: pace/lib/tbarcfg/include/ipc/tbarcfg.h
===================================================================
--- uspace/lib/tbarcfg/include/ipc/tbarcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libtbarcfg
- * @{
- */
-/** @file
- */
-
-#ifndef LIBTBARCFG_IPC_TBARCFG_H
-#define LIBTBARCFG_IPC_TBARCFG_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	TBARCFG_NOTIFY_NOTIFY = IPC_FIRST_USER_METHOD
-} tbarcfg_notify_request_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/tbarcfg/include/tbarcfg/tbarcfg.h
===================================================================
--- uspace/lib/tbarcfg/include/tbarcfg/tbarcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libtbarcfg
- * @{
- */
-/**
- * @file Start menu
- */
-
-#ifndef _TBARCFG_TBARCFG_H
-#define _TBARCFG_TBARCFG_H
-
-#include <errno.h>
-#include <sif.h>
-#include <stdbool.h>
-#include <types/tbarcfg/tbarcfg.h>
-
-#define TBARCFG_NOTIFY_DEFAULT "tbarcfg-notif"
-
-extern errno_t tbarcfg_create(const char *, tbarcfg_t **);
-extern errno_t tbarcfg_open(const char *, tbarcfg_t **);
-extern void tbarcfg_close(tbarcfg_t *);
-extern errno_t tbarcfg_sync(tbarcfg_t *);
-extern smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *);
-extern smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *);
-extern smenu_entry_t *tbarcfg_smenu_last(tbarcfg_t *);
-extern smenu_entry_t *tbarcfg_smenu_prev(smenu_entry_t *);
-extern const char *smenu_entry_get_caption(smenu_entry_t *);
-extern const char *smenu_entry_get_cmd(smenu_entry_t *);
-extern bool smenu_entry_get_terminal(smenu_entry_t *);
-extern bool smenu_entry_get_separator(smenu_entry_t *);
-extern errno_t smenu_entry_set_caption(smenu_entry_t *, const char *);
-extern errno_t smenu_entry_set_cmd(smenu_entry_t *, const char *);
-extern void smenu_entry_set_terminal(smenu_entry_t *, bool);
-extern errno_t smenu_entry_create(tbarcfg_t *, const char *, const char *,
-    bool, smenu_entry_t **);
-extern errno_t smenu_entry_sep_create(tbarcfg_t *, smenu_entry_t **);
-extern void smenu_entry_destroy(smenu_entry_t *);
-extern void smenu_entry_move_up(smenu_entry_t *);
-extern void smenu_entry_move_down(smenu_entry_t *);
-extern errno_t tbarcfg_listener_create(const char *, void (*)(void *),
-    void *, tbarcfg_listener_t **);
-extern void tbarcfg_listener_destroy(tbarcfg_listener_t *);
-extern errno_t tbarcfg_notify(const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/tbarcfg/include/types/tbarcfg/tbarcfg.h
===================================================================
--- uspace/lib/tbarcfg/include/types/tbarcfg/tbarcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libtbarcfg
- * @{
- */
-/**
- * @file Start menu
- */
-
-#ifndef _TBARCFG_TYPES_TBARCFG_H
-#define _TBARCFG_TYPES_TBARCFG_H
-
-struct tbarcfg;
-typedef struct tbarcfg tbarcfg_t;
-
-struct smenu_entry;
-typedef struct smenu_entry smenu_entry_t;
-
-struct tbarcfg_listener;
-typedef struct tbarcfg_listener tbarcfg_listener_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/tbarcfg/meson.build
===================================================================
--- uspace/lib/tbarcfg/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'sif' ]
-src = files(
-	'src/tbarcfg.c',
-)
-
-test_src = files(
-	'test/main.c',
-	'test/tbarcfg.c',
-)
Index: pace/lib/tbarcfg/private/tbarcfg.h
===================================================================
--- uspace/lib/tbarcfg/private/tbarcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libtbarcfg
- * @{
- */
-/**
- * @file Taskbar configuration
- *
- */
-
-#ifndef _TBARCFG_PRIVATE_TBARCFG_H
-#define _TBARCFG_PRIVATE_TBARCFG_H
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <types/tbarcfg/tbarcfg.h>
-
-/** Taskbar configuration */
-struct tbarcfg {
-	/** Configuration file path */
-	char *cfgpath;
-	/** List of start menu entries (smenu_entry_t) */
-	list_t entries;
-};
-
-/** Start menu entry */
-struct smenu_entry {
-	/** Containing start menu */
-	struct tbarcfg *smenu;
-	/** Link to @c smenu->entries */
-	link_t lentries;
-	/** Is this a separator entry */
-	bool separator;
-	/** Entry caption (with accelerator markup) */
-	char *caption;
-	/** Command to run */
-	char *cmd;
-	/** Start in terminal */
-	bool terminal;
-};
-
-/** Taskbar configuration listener */
-typedef struct tbarcfg_listener {
-	/** Notification callback */
-	void (*cb)(void *);
-	/** Callback argument */
-	void *arg;
-} tbarcfg_listener_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/tbarcfg/src/tbarcfg.c
===================================================================
--- uspace/lib/tbarcfg/src/tbarcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,797 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libtbarcfg
- * @{
- */
-/**
- * @file Taskbar configuration
- */
-
-#include <async.h>
-#include <errno.h>
-#include <sif.h>
-#include <ipc/tbarcfg.h>
-#include <loc.h>
-#include <task.h>
-#include <tbarcfg/tbarcfg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../private/tbarcfg.h"
-
-static void tbarcfg_notify_conn(ipc_call_t *, void *);
-static errno_t smenu_entry_save(smenu_entry_t *, sif_node_t *);
-
-/** Create taskbar configuration.
- *
- * @param repopath Pathname of the new menu repository
- * @param rtbcfg Place to store pointer to taskbar configuration
- * @return EOK on success or an error code
- */
-errno_t tbarcfg_create(const char *repopath, tbarcfg_t **rtbcfg)
-{
-	tbarcfg_t *tbcfg;
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *nentries;
-	errno_t rc;
-
-	tbcfg = calloc(1, sizeof(tbarcfg_t));
-	if (tbcfg == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	list_initialize(&tbcfg->entries);
-	tbcfg->cfgpath = str_dup(repopath);
-	if (tbcfg->cfgpath == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-
-	rc = sif_node_append_child(rnode, "entries", &nentries);
-	if (rc != EOK)
-		goto error;
-
-	(void)nentries;
-
-	rc = sif_save(doc, repopath);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-
-	*rtbcfg = tbcfg;
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	if (tbcfg != NULL && tbcfg->cfgpath != NULL)
-		free(tbcfg->cfgpath);
-	if (tbcfg != NULL)
-		free(tbcfg);
-	return rc;
-}
-
-/** Open taskbar configuration.
- *
- * @param repopath Pathname of the menu repository
- * @param rtbcfg Place to store pointer to taskbar configuration
- * @return EOK on success or an error code
- */
-errno_t tbarcfg_open(const char *repopath, tbarcfg_t **rtbcfg)
-{
-	tbarcfg_t *tbcfg;
-	sif_doc_t *doc = NULL;
-	sif_node_t *nentries;
-	sif_node_t *rnode;
-	sif_node_t *nentry;
-	const char *ntype;
-	const char *separator;
-	const char *caption;
-	const char *cmd;
-	const char *terminal = NULL;
-	errno_t rc;
-
-	tbcfg = calloc(1, sizeof(tbarcfg_t));
-	if (tbcfg == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	list_initialize(&tbcfg->entries);
-	tbcfg->cfgpath = str_dup(repopath);
-	if (tbcfg->cfgpath == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = sif_load(repopath, &doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	nentries = sif_node_first_child(rnode);
-	ntype = sif_node_get_type(nentries);
-	if (str_cmp(ntype, "entries") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	nentry = sif_node_first_child(nentries);
-	while (nentry != NULL) {
-		ntype = sif_node_get_type(nentry);
-		if (str_cmp(ntype, "entry") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		separator = sif_node_get_attr(nentry, "separator");
-		if (separator != NULL && str_cmp(separator, "y") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		if (separator == NULL) {
-			caption = sif_node_get_attr(nentry, "caption");
-			if (caption == NULL) {
-				rc = EIO;
-				goto error;
-			}
-
-			cmd = sif_node_get_attr(nentry, "cmd");
-			if (cmd == NULL) {
-				rc = EIO;
-				goto error;
-			}
-
-			terminal = sif_node_get_attr(nentry, "terminal");
-			if (terminal == NULL)
-				terminal = "n";
-
-			rc = smenu_entry_create(tbcfg, caption, cmd,
-			    str_cmp(terminal, "y") == 0, NULL);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rc = smenu_entry_sep_create(tbcfg, NULL);
-			if (rc != EOK)
-				goto error;
-		}
-
-		nentry = sif_node_next_child(nentry);
-	}
-
-	sif_delete(doc);
-	*rtbcfg = tbcfg;
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	if (tbcfg != NULL && tbcfg->cfgpath != NULL)
-		free(tbcfg->cfgpath);
-	if (tbcfg != NULL)
-		free(tbcfg);
-	return rc;
-}
-
-/** Close taskbar configuration.
- *
- * @param tbcfg Start menu
- */
-void tbarcfg_close(tbarcfg_t *tbcfg)
-{
-	smenu_entry_t *entry;
-
-	entry = tbarcfg_smenu_first(tbcfg);
-	while (entry != NULL) {
-		smenu_entry_destroy(entry);
-		entry = tbarcfg_smenu_first(tbcfg);
-	}
-
-	free(tbcfg->cfgpath);
-	free(tbcfg);
-}
-
-/** Synchronize taskbar configuration to config file.
- *
- * @param repopath Pathname of the menu repository
- * @param rtbcfg Place to store pointer to taskbar configuration
- * @return EOK on success or an error code
- */
-errno_t tbarcfg_sync(tbarcfg_t *tbcfg)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *nentries;
-	sif_node_t *rnode;
-	smenu_entry_t *entry;
-	errno_t rc;
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-
-	rc = sif_node_append_child(rnode, "entries", &nentries);
-	if (rc != EOK)
-		goto error;
-
-	entry = tbarcfg_smenu_first(tbcfg);
-	while (entry != NULL) {
-		rc = smenu_entry_save(entry, nentries);
-		if (rc != EOK)
-			goto error;
-
-		entry = tbarcfg_smenu_next(entry);
-	}
-
-	rc = sif_save(doc, tbcfg->cfgpath);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	if (tbcfg != NULL && tbcfg->cfgpath != NULL)
-		free(tbcfg->cfgpath);
-	if (tbcfg != NULL)
-		free(tbcfg);
-	return rc;
-}
-
-/** Get first start menu entry.
- *
- * @param tbcfg Taskbar configuration
- * @return First entry or @c NULL if the menu is empty
- */
-smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *tbcfg)
-{
-	link_t *link;
-
-	link = list_first(&tbcfg->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, smenu_entry_t, lentries);
-}
-
-/** Get next start menu entry.
- *
- * @param cur Current entry
- * @return Next entry or @c NULL if @a cur is the last entry
- */
-smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lentries, &cur->smenu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, smenu_entry_t, lentries);
-}
-
-/** Get last start menu entry.
- *
- * @param tbcfg Taskbar configuration
- * @return Previous entry or @c NULL if the menu is empty
- */
-smenu_entry_t *tbarcfg_smenu_last(tbarcfg_t *tbcfg)
-{
-	link_t *link;
-
-	link = list_last(&tbcfg->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, smenu_entry_t, lentries);
-}
-
-/** Get previous start menu entry.
- *
- * @param cur Current entry
- * @return Previous entry or @c NULL if @a cur is the last entry
- */
-smenu_entry_t *tbarcfg_smenu_prev(smenu_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->lentries, &cur->smenu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, smenu_entry_t, lentries);
-}
-
-/** Get start menu entry caption.
- *
- * @param entry Start menu entry
- * @return Caption (with accelerator markup)
- */
-const char *smenu_entry_get_caption(smenu_entry_t *entry)
-{
-	assert(!entry->separator);
-	return entry->caption;
-}
-
-/** Get start menu entry command.
- *
- * @param entry Start menu entry
- * @return Command to run
- */
-const char *smenu_entry_get_cmd(smenu_entry_t *entry)
-{
-	assert(!entry->separator);
-	return entry->cmd;
-}
-
-/** Get start menu entry start in terminal flag.
- *
- * @param entry Start menu entry
- * @return Start in terminal flag
- */
-bool smenu_entry_get_terminal(smenu_entry_t *entry)
-{
-	assert(!entry->separator);
-	return entry->terminal;
-}
-
-/** Get start menu entry separator flag.
- *
- * @param entry Start menu entry
- * @return Separator flag
- */
-bool smenu_entry_get_separator(smenu_entry_t *entry)
-{
-	return entry->separator;
-}
-
-/** Set start menu entry caption.
- *
- * Note: To make the change visible to others and persistent,
- * you must call @c tbarcfg_sync()
- *
- * @param entry Start menu entry
- * @param caption New caption
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t smenu_entry_set_caption(smenu_entry_t *entry, const char *caption)
-{
-	char *dcap;
-
-	assert(!entry->separator);
-
-	dcap = str_dup(caption);
-	if (dcap == NULL)
-		return ENOMEM;
-
-	free(entry->caption);
-	entry->caption = dcap;
-	return EOK;
-}
-
-/** Set start menu entry command.
- *
- * Note: To make the change visible to others and persistent,
- * you must call @c tbarcfg_sync()
- *
- * @param entry Start menu entry
- * @param cmd New command
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t smenu_entry_set_cmd(smenu_entry_t *entry, const char *cmd)
-{
-	char *dcmd;
-
-	assert(!entry->separator);
-
-	dcmd = str_dup(cmd);
-	if (dcmd == NULL)
-		return ENOMEM;
-
-	free(entry->cmd);
-	entry->cmd = dcmd;
-	return EOK;
-}
-
-/** Set start menu entry start in terminal flag.
- *
- * Note: To make the change visible to others and persistent,
- * you must call @c tbarcfg_sync()
- *
- * @param entry Start menu entry
- * @param terminal Start in terminal flag
- */
-void smenu_entry_set_terminal(smenu_entry_t *entry, bool terminal)
-{
-	assert(!entry->separator);
-	entry->terminal = terminal;
-}
-
-/** Save start menu entry using transaction.
- *
- * @param entry Start menu entry
- * @param nentries Entries node
- */
-static errno_t smenu_entry_save(smenu_entry_t *entry, sif_node_t *nentries)
-{
-	sif_node_t *nentry = NULL;
-	errno_t rc;
-
-	rc = sif_node_append_child(nentries, "entry", &nentry);
-	if (rc != EOK)
-		goto error;
-
-	if (entry->separator) {
-		rc = sif_node_set_attr(nentry, "separator", "y");
-		if (rc != EOK)
-			goto error;
-	} else {
-		rc = sif_node_set_attr(nentry, "cmd", entry->cmd);
-		if (rc != EOK)
-			goto error;
-
-		rc = sif_node_set_attr(nentry, "caption",
-		    entry->caption);
-		if (rc != EOK)
-			goto error;
-
-		rc = sif_node_set_attr(nentry, "terminal",
-		    entry->terminal ? "y" : "n");
-		if (rc != EOK)
-			goto error;
-	}
-
-	return EOK;
-error:
-	if (nentry != NULL)
-		sif_node_destroy(nentry);
-	return rc;
-}
-
-/** Create new start menu entry and append it to the start menu (internal).
- *
- * This only creates the entry in memory, but does not update the repository.
- *
- * @param smenu Start menu
- * @param caption Caption
- * @param cmd Command to run
- * @param terminal Start in terminal
- * @param rentry Place to store pointer to new entry or @c NULL
- */
-errno_t smenu_entry_create(tbarcfg_t *smenu, const char *caption,
-    const char *cmd, bool terminal, smenu_entry_t **rentry)
-{
-	smenu_entry_t *entry;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(smenu_entry_t));
-	if (entry == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->caption = str_dup(caption);
-	if (entry->caption == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->cmd = str_dup(cmd);
-	if (entry->cmd == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->terminal = terminal;
-
-	entry->smenu = smenu;
-	list_append(&entry->lentries, &smenu->entries);
-	if (rentry != NULL)
-		*rentry = entry;
-	return EOK;
-error:
-	if (entry != NULL) {
-		if (entry->caption != NULL)
-			free(entry->caption);
-		if (entry->cmd != NULL)
-			free(entry->cmd);
-		free(entry);
-	}
-
-	return rc;
-}
-
-/** Create new start menu separator entry and append it to the start menu
- * (internal).
- *
- * This only creates the entry in memory, but does not update the repository.
- *
- * @param smenu Start menu
- * @param rentry Place to store pointer to new entry or @c NULL
- */
-errno_t smenu_entry_sep_create(tbarcfg_t *smenu, smenu_entry_t **rentry)
-{
-	smenu_entry_t *entry;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(smenu_entry_t));
-	if (entry == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	entry->separator = true;
-
-	entry->smenu = smenu;
-	list_append(&entry->lentries, &smenu->entries);
-	if (rentry != NULL)
-		*rentry = entry;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Destroy start menu entry.
- *
- * This only deletes the entry from, but does not update the
- * repository.
- *
- * @param entry Start menu entry
- */
-void smenu_entry_destroy(smenu_entry_t *entry)
-{
-	list_remove(&entry->lentries);
-	if (entry->caption != NULL)
-		free(entry->caption);
-	if (entry->cmd != NULL)
-		free(entry->cmd);
-	free(entry);
-}
-
-/** Move start menu entry up.
- *
- * @param entry Start menu entry
- */
-void smenu_entry_move_up(smenu_entry_t *entry)
-{
-	smenu_entry_t *prev;
-
-	prev = tbarcfg_smenu_prev(entry);
-	if (prev == NULL) {
-		/* Entry is already at first position, nothing to do. */
-		return;
-	}
-
-	list_remove(&entry->lentries);
-	list_insert_before(&entry->lentries, &prev->lentries);
-}
-
-/** Move start menu entry down.
- *
- * @param entry Start menu entry
- */
-void smenu_entry_move_down(smenu_entry_t *entry)
-{
-	smenu_entry_t *next;
-
-	next = tbarcfg_smenu_next(entry);
-	if (next == NULL) {
-		/* Entry is already at last position, nothing to do. */
-		return;
-	}
-
-	list_remove(&entry->lentries);
-	list_insert_after(&entry->lentries, &next->lentries);
-}
-
-/** Create taskbar configuration listener.
- *
- * Listens for taskbar configuration change notifications.
- *
- * @param nchan Notification channel (TBARCFG_NOTIFY_DEFAULT)
- * @param rlst Place to store pointer to new listener
- * @return EOK on success or an error code
- */
-errno_t tbarcfg_listener_create(const char *nchan, void (*cb)(void *),
-    void *arg, tbarcfg_listener_t **rlst)
-{
-	tbarcfg_listener_t *lst;
-	service_id_t svcid = 0;
-	loc_srv_t *srv = NULL;
-	task_id_t taskid;
-	char *svcname = NULL;
-	category_id_t catid;
-	port_id_t port;
-	int rv;
-	errno_t rc;
-
-	lst = calloc(1, sizeof(tbarcfg_listener_t));
-	if (lst == NULL)
-		return ENOMEM;
-
-	lst->cb = cb;
-	lst->arg = arg;
-
-	rc = async_create_port(INTERFACE_TBARCFG_NOTIFY,
-	    tbarcfg_notify_conn, (void *)lst, &port);
-	if (rc != EOK)
-		goto error;
-
-	rc = loc_server_register("tbarcfg-listener", &srv);
-	if (rc != EOK)
-		goto error;
-
-	taskid = task_get_id();
-
-	rv = asprintf(&svcname, "tbarcfg/%u", (unsigned)taskid);
-	if (rv < 0) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = loc_service_register(srv, svcname, &svcid);
-	if (rc != EOK)
-		goto error;
-
-	rc = loc_category_get_id(nchan, &catid, 0);
-	if (rc != EOK)
-		goto error;
-
-	rc = loc_service_add_to_cat(srv, svcid, catid);
-	if (rc != EOK)
-		goto error;
-
-	*rlst = lst;
-	return EOK;
-error:
-	if (svcid != 0)
-		loc_service_unregister(srv, svcid);
-	if (srv != NULL)
-		loc_server_unregister(srv);
-	if (svcname != NULL)
-		free(svcname);
-	return rc;
-}
-
-/** Destroy taskbar configuration listener.
- *
- * @param lst Listener
- */
-void tbarcfg_listener_destroy(tbarcfg_listener_t *lst)
-{
-	free(lst);
-}
-
-/** Send taskbar configuration notification to a particular service ID.
- *
- * @param svcid Service ID
- * @return EOK on success or an error code
- */
-static errno_t tbarcfg_notify_svc(service_id_t svcid)
-{
-	async_sess_t *sess;
-	async_exch_t *exch;
-	errno_t rc;
-
-	sess = loc_service_connect(svcid, INTERFACE_TBARCFG_NOTIFY, 0);
-	if (sess == NULL)
-		return EIO;
-
-	exch = async_exchange_begin(sess);
-	rc = async_req_0_0(exch, TBARCFG_NOTIFY_NOTIFY);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_hangup(sess);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-	async_hangup(sess);
-	return EOK;
-}
-
-/** Send taskbar configuration change notification.
- *
- * @param nchan Notification channel (TBARCFG_NOTIFY_DEFAULT)
- */
-errno_t tbarcfg_notify(const char *nchan)
-{
-	errno_t rc;
-	category_id_t catid;
-	service_id_t *svcs = NULL;
-	size_t count, i;
-
-	rc = loc_category_get_id(nchan, &catid, 0);
-	if (rc != EOK)
-		return rc;
-
-	rc = loc_category_get_svcs(catid, &svcs, &count);
-	if (rc != EOK)
-		return rc;
-
-	for (i = 0; i < count; i++) {
-		rc = tbarcfg_notify_svc(svcs[i]);
-		if (rc != EOK)
-			goto error;
-	}
-
-	free(svcs);
-	return EOK;
-error:
-	free(svcs);
-	return rc;
-}
-
-/** Taskbar configuration connection handler.
- *
- * @param icall Initial call
- * @param arg Argument (tbarcfg_listener_t *)
- */
-static void tbarcfg_notify_conn(ipc_call_t *icall, void *arg)
-{
-	tbarcfg_listener_t *lst = (tbarcfg_listener_t *)arg;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case TBARCFG_NOTIFY_NOTIFY:
-			lst->cb(lst->arg);
-			async_answer_0(&call, EOK);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/tbarcfg/test/main.c
===================================================================
--- uspace/lib/tbarcfg/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(tbarcfg);
-
-PCUT_MAIN();
Index: pace/lib/tbarcfg/test/tbarcfg.c
===================================================================
--- uspace/lib/tbarcfg/test/tbarcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,590 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <tbarcfg/tbarcfg.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tbarcfg);
-
-typedef struct {
-	bool notified;
-} tbarcfg_test_resp_t;
-
-static void test_cb(void *);
-
-/** Creating, opening and closing taskbar configuration */
-PCUT_TEST(create_open_close)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Create new repository */
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tbarcfg_sync(tbcfg);
-	tbarcfg_close(tbcfg);
-
-	/* Re-open the repository */
-
-	rc = tbarcfg_open(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Iterating over start menu entries */
-PCUT_TEST(first_next)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e1 = NULL, *e2 = NULL;
-	smenu_entry_t *e;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e1);
-
-	rc = smenu_entry_create(tbcfg, "B", "b", false, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e2);
-
-	/* Create entry without getting a pointer to it */
-	rc = smenu_entry_create(tbcfg, "C", "c", false, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e1, e);
-	e = tbarcfg_smenu_next(e);
-	PCUT_ASSERT_EQUALS(e2, e);
-	e = tbarcfg_smenu_next(e);
-	PCUT_ASSERT_NOT_NULL(e);
-	e = tbarcfg_smenu_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Iterating over start menu entries backwards */
-PCUT_TEST(last_prev)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e1 = NULL, *e2 = NULL;
-	smenu_entry_t *e;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e1);
-
-	rc = smenu_entry_create(tbcfg, "B", "b", false, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e2);
-
-	e = tbarcfg_smenu_last(tbcfg);
-	PCUT_ASSERT_EQUALS(e2, e);
-	e = tbarcfg_smenu_prev(e);
-	PCUT_ASSERT_EQUALS(e1, e);
-	e = tbarcfg_smenu_prev(e);
-	PCUT_ASSERT_NULL(e);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Separator entry */
-PCUT_TEST(separator)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	const char *caption;
-	const char *cmd;
-	smenu_entry_t *e1 = NULL, *e2 = NULL;
-	smenu_entry_t *e;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e1);
-
-	rc = smenu_entry_sep_create(tbcfg, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e2);
-
-	PCUT_ASSERT_FALSE(smenu_entry_get_separator(e1));
-	PCUT_ASSERT_TRUE(smenu_entry_get_separator(e2));
-
-	tbarcfg_sync(tbcfg);
-	tbarcfg_close(tbcfg);
-
-	/* Re-open repository */
-
-	rc = tbarcfg_open(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_NOT_NULL(e);
-
-	/* Check that new values of properties have persisted */
-	PCUT_ASSERT_FALSE(smenu_entry_get_separator(e));
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-
-	e = tbarcfg_smenu_next(e);
-
-	/* Check that entry is still a separator */
-	PCUT_ASSERT_TRUE(smenu_entry_get_separator(e));
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Getting menu entry properties */
-PCUT_TEST(get_caption_cmd_term)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e;
-	const char *caption;
-	const char *cmd;
-	bool terminal;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-	terminal = smenu_entry_get_terminal(e);
-	PCUT_ASSERT_FALSE(terminal);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Setting menu entry properties */
-PCUT_TEST(set_caption_cmd_term)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e;
-	const char *caption;
-	const char *cmd;
-	bool terminal;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-	terminal = smenu_entry_get_terminal(e);
-	PCUT_ASSERT_FALSE(terminal);
-
-	/* Set properties */
-	rc = smenu_entry_set_caption(e, "B");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = smenu_entry_set_cmd(e, "b");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	smenu_entry_set_terminal(e, true);
-
-	rc = tbarcfg_sync(tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check that properties have been set */
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("B", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("b", cmd);
-	terminal = smenu_entry_get_terminal(e);
-	PCUT_ASSERT_TRUE(terminal);
-
-	tbarcfg_sync(tbcfg);
-	tbarcfg_close(tbcfg);
-
-	/* Re-open repository */
-
-	rc = tbarcfg_open(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_NOT_NULL(e);
-
-	/* Check that new values of properties have persisted */
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("B", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("b", cmd);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Create start menu entry */
-PCUT_TEST(entry_create)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e;
-	const char *caption;
-	const char *cmd;
-	bool terminal;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e);
-
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-	terminal = smenu_entry_get_terminal(e);
-	PCUT_ASSERT_FALSE(terminal);
-
-	smenu_entry_destroy(e);
-
-	rc = smenu_entry_create(tbcfg, "B", "b", true, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e);
-
-	caption = smenu_entry_get_caption(e);
-	PCUT_ASSERT_STR_EQUALS("B", caption);
-	cmd = smenu_entry_get_cmd(e);
-	PCUT_ASSERT_STR_EQUALS("b", cmd);
-	terminal = smenu_entry_get_terminal(e);
-	PCUT_ASSERT_TRUE(terminal);
-
-	smenu_entry_destroy(e);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Destroy start menu entry */
-PCUT_TEST(entry_destroy)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e, *f;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e, f);
-
-	smenu_entry_destroy(e);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_NULL(f);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Move start menu entry up */
-PCUT_TEST(entry_move_up)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e1, *e2, *e3;
-	smenu_entry_t *f;
-	const char *caption;
-	const char *cmd;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "B", "b", false, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "C", "c", false, &e3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e1, f);
-
-	/* Moving the first entry up should have no effect */
-
-	smenu_entry_move_up(e1);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e1, f);
-
-	/* Moving the second entry up should move it to first position */
-
-	smenu_entry_move_up(e2);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e2, f);
-
-	/* Moving the last entry up should move it to second position */
-
-	smenu_entry_move_up(e3);
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_EQUALS(e2, f);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_EQUALS(e3, f);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_EQUALS(e1, f);
-
-	tbarcfg_sync(tbcfg);
-	tbarcfg_close(tbcfg);
-
-	/* Re-open repository */
-
-	rc = tbarcfg_open(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check that new order of entries persisted */
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("B", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("b", cmd);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("C", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("c", cmd);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Move start menu entry down */
-PCUT_TEST(entry_move_down)
-{
-	errno_t rc;
-	tbarcfg_t *tbcfg;
-	char fname[L_tmpnam], *p;
-	smenu_entry_t *e1, *e2, *e3;
-	smenu_entry_t *f;
-	const char *caption;
-	const char *cmd;
-
-	p = tmpnam(fname);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	rc = tbarcfg_create(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "A", "a", false, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "B", "b", false, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = smenu_entry_create(tbcfg, "C", "c", false, &e3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	f = tbarcfg_smenu_last(tbcfg);
-	PCUT_ASSERT_EQUALS(e3, f);
-
-	/* Moving the last entry down should have no effect */
-
-	smenu_entry_move_down(e3);
-
-	f = tbarcfg_smenu_last(tbcfg);
-	PCUT_ASSERT_EQUALS(e3, f);
-
-	/* Moving the second entry down should move it to last position */
-
-	smenu_entry_move_down(e2);
-
-	f = tbarcfg_smenu_last(tbcfg);
-	PCUT_ASSERT_EQUALS(e2, f);
-
-	/* Moving the first entry down should move it to second position */
-
-	smenu_entry_move_down(e1);
-
-	f = tbarcfg_smenu_last(tbcfg);
-	PCUT_ASSERT_EQUALS(e2, f);
-
-	f = tbarcfg_smenu_prev(f);
-	PCUT_ASSERT_EQUALS(e1, f);
-
-	f = tbarcfg_smenu_prev(f);
-	PCUT_ASSERT_EQUALS(e3, f);
-
-	tbarcfg_sync(tbcfg);
-	tbarcfg_close(tbcfg);
-
-	/* Re-open repository */
-
-	rc = tbarcfg_open(fname, &tbcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check that new order of entries persisted */
-
-	f = tbarcfg_smenu_first(tbcfg);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("C", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("c", cmd);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("A", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("a", cmd);
-
-	f = tbarcfg_smenu_next(f);
-	PCUT_ASSERT_NOT_NULL(f);
-
-	caption = smenu_entry_get_caption(f);
-	PCUT_ASSERT_STR_EQUALS("B", caption);
-	cmd = smenu_entry_get_cmd(f);
-	PCUT_ASSERT_STR_EQUALS("b", cmd);
-
-	tbarcfg_close(tbcfg);
-	remove(fname);
-}
-
-/** Notifications can be delivered from tbarcfg_notify() to a listener. */
-PCUT_TEST(notify)
-{
-	errno_t rc;
-	tbarcfg_listener_t *lst;
-	tbarcfg_test_resp_t test_resp;
-
-	test_resp.notified = false;
-
-	printf("create listener resp=%p\n", (void *)&test_resp);
-	rc = tbarcfg_listener_create(TBARCFG_NOTIFY_DEFAULT,
-	    test_cb, &test_resp, &lst);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(test_resp.notified);
-	tbarcfg_listener_destroy(lst);
-}
-
-static void test_cb(void *arg)
-{
-	tbarcfg_test_resp_t *resp = (tbarcfg_test_resp_t *)arg;
-
-	printf("test_cb: executing resp=%p\n", (void *)resp);
-	resp->notified = true;
-}
-
-PCUT_EXPORT(tbarcfg);
Index: pace/lib/termui/include/termui.h
===================================================================
--- uspace/lib/termui/include/termui.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2024 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef USPACE_LIB_TERMUI_TERMUI_H_
-#define USPACE_LIB_TERMUI_TERMUI_H_
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define GLYPH_IDX_
-#define GLYPH_IDX_ENDL 0xffffffu
-
-struct termui;
-typedef struct termui termui_t;
-
-/* RGB555 color representation. See termui_color_from/to_rgb() */
-typedef uint16_t termui_color_t;
-#define TERMUI_COLOR_DEFAULT 0
-
-typedef struct {
-	unsigned italic : 1;
-	unsigned bold : 1;
-	unsigned underline : 1;
-	unsigned blink : 1;
-	unsigned strike : 1;
-	unsigned inverted : 1;
-	unsigned cursor : 1;
-	/*
-	 * Padding cells for wide characters.
-	 * Placed at the end of rows where a wide character should have gone
-	 * but didn't fit, and after wide characters to mark out the full space
-	 * taken.
-	 */
-	unsigned padding : 1;
-	// This is enough range for full Unicode coverage several times over.
-	// The library is almost completely oblivious to the meaning of glyph index,
-	// with the sole exception that zero is assumed to mean no glyph/empty cell.
-	// User application can utilize the extended range to, for example:
-	//  - support multiple fonts / fallback fonts
-	//  - support select combining character sequences that don't
-	//    have equivalent precomposed characters in Unicode
-	//  - support additional graphical features that aren't included in
-	//    this structure
-	// Empty cells are initialized to all zeros.
-	unsigned glyph_idx : 24;
-	termui_color_t fgcolor;
-	termui_color_t bgcolor;
-} termui_cell_t;
-
-/** Update callback for viewport contents. The updated region is always limited
- * to a single row. One row can be updated by multiple invocations.
- * @param userdata
- * @param col   First column of the updated region.
- * @param row   Viewport row of the updated region.
- * @param cell  Updated cell data array.
- * @param len   Length of the updated region.
- */
-typedef void (*termui_update_cb_t)(void *userdata, int col, int row, const termui_cell_t *cell, int len);
-
-/** Scrolling callback.
- * The entire viewport was shifted by the given number of rows.
- * For example, when a new line is added at the bottom of a full screen,
- * this is called with delta = +1.
- * The recipient must call termui_force_viewport_update() for previously
- * off-screen rows manually (allowing this callback to be implemented
- * the same as refresh).
- *
- * @param userdata
- * @param delta  Number of rows. Positive when viewport content moved up.
- */
-typedef void (*termui_scroll_cb_t)(void *userdata, int delta);
-
-/** Refresh callback. Instructs user to re-render the entire screen.
- *
- * @param userdata
- */
-typedef void (*termui_refresh_cb_t)(void *userdata);
-
-termui_t *termui_create(int cols, int rows, size_t history_lines);
-void termui_destroy(termui_t *termui);
-
-errno_t termui_resize(termui_t *termui, int cols, int rows, size_t history_lines);
-
-void termui_set_scroll_cb(termui_t *termui, termui_scroll_cb_t cb, void *userdata);
-void termui_set_update_cb(termui_t *termui, termui_update_cb_t cb, void *userdata);
-void termui_set_refresh_cb(termui_t *termui, termui_refresh_cb_t cb, void *userdata);
-
-void termui_put_lf(termui_t *termui);
-void termui_put_cr(termui_t *termui);
-void termui_put_crlf(termui_t *termui);
-void termui_put_tab(termui_t *termui);
-void termui_put_backspace(termui_t *termui);
-void termui_put_glyph(termui_t *termui, uint32_t glyph, int width);
-void termui_clear_screen(termui_t *termui);
-void termui_wipe_screen(termui_t *termui, int first_row);
-
-void termui_set_style(termui_t *termui, termui_cell_t style);
-void termui_set_pos(termui_t *termui, int col, int row);
-void termui_get_pos(const termui_t *termui, int *col, int *row);
-int termui_get_cols(const termui_t *termui);
-int termui_get_rows(const termui_t *termui);
-
-bool termui_get_cursor_visibility(const termui_t *termui);
-void termui_set_cursor_visibility(termui_t *termui, bool visible);
-termui_cell_t *termui_get_active_row(termui_t *termui, int row);
-void termui_history_scroll(termui_t *termui, int delta);
-void termui_force_viewport_update(const termui_t *termui, int first_row, int rows);
-bool termui_scrollback_is_active(const termui_t *termui);
-
-termui_color_t termui_color_from_rgb(uint8_t r, uint8_t g, uint8_t b);
-void termui_color_to_rgb(termui_color_t c, uint8_t *r, uint8_t *g, uint8_t *b);
-
-#endif /* USPACE_LIB_TERMUI_TERMUI_H_ */
Index: pace/lib/termui/meson.build
===================================================================
--- uspace/lib/termui/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2024 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('src/termui.c', 'src/history.c')
Index: pace/lib/termui/src/history.c
===================================================================
--- uspace/lib/termui/src/history.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,728 +1,0 @@
-/*
- * Copyright (c) 2024 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "history.h"
-
-#include <assert.h>
-#include <limits.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define BLANK_CELLS_LEN 64
-static const termui_cell_t _blank_cells[BLANK_CELLS_LEN];
-
-static bool _lines_empty(struct line_buffer *lines)
-{
-	return lines->head == lines->tail;
-}
-
-static void _line_idx_inc(const struct line_buffer *lines, size_t *idx)
-{
-	if (*idx == lines->buf_len - 1)
-		*idx = 0;
-	else
-		(*idx)++;
-}
-
-static void _line_idx_dec(const struct line_buffer *lines, size_t *idx)
-{
-	if (*idx == 0)
-		*idx = lines->buf_len - 1;
-	else
-		(*idx)--;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-static void _cell_buffer_shrink(struct cell_buffer *cells)
-{
-	assert(cells->max_len > 0);
-	assert(cells->buf_len > cells->max_len);
-
-	size_t new_len = max(cells->max_len, cells->head_top);
-
-	termui_cell_t *new_buf = reallocarray(cells->buf,
-	    new_len, sizeof(termui_cell_t));
-
-	if (new_buf) {
-		cells->buf = new_buf;
-		cells->buf_len = new_len;
-	}
-}
-
-static void _line_buffer_shrink(struct line_buffer *lines)
-{
-	assert(lines->max_len > 0);
-	assert(lines->buf_len > lines->max_len);
-	assert(lines->head <= lines->tail);
-
-	size_t new_len = max(lines->max_len, lines->tail + 1);
-
-	struct history_line *new_buf = reallocarray(lines->buf,
-	    new_len, sizeof(struct history_line));
-
-	if (new_buf) {
-		lines->buf = new_buf;
-		lines->buf_len = new_len;
-	}
-}
-
-static void _evict_cells(struct cell_buffer *cells, size_t idx, size_t len)
-{
-	assert(idx == cells->head_offset);
-	assert(len <= cells->head_top);
-	assert(idx <= cells->head_top - len);
-
-	cells->head_offset += len;
-
-	if (cells->head_offset >= cells->head_top) {
-
-		cells->head_offset = 0;
-		cells->head_top = cells->tail_top;
-		cells->tail_top = 0;
-
-		if (cells->buf_len > cells->max_len)
-			_cell_buffer_shrink(cells);
-	}
-}
-
-static bool _index_valid(const struct history *history, size_t idx)
-{
-	const struct line_buffer *lines = &history->lines;
-
-	if (lines->head <= lines->tail)
-		return idx >= lines->head && idx < lines->tail;
-	else
-		return (idx >= lines->head && idx < lines->buf_len) ||
-		    (idx < lines->tail);
-}
-
-#define _history_check(history) do { \
-	assert(history->lines.head < history->lines.buf_len); \
-	assert(history->lines.tail < history->lines.buf_len); \
-	assert(history->cells.tail_top <= history->cells.head_offset); \
-	assert(history->cells.head_offset <= history->cells.head_top); \
-	assert(history->cells.head_top <= history->cells.buf_len); \
-	assert(_index_valid(history, history->viewport_top) || history->viewport_top == history->lines.tail); \
-	if (history->append) assert(!_lines_empty(&history->lines)); \
-} while (false)
-
-static void _evict_oldest_line(struct history *history)
-{
-	struct line_buffer *lines = &history->lines;
-	struct cell_buffer *cells = &history->cells;
-
-	_history_check(history);
-
-	bool head = (history->viewport_top == lines->head);
-
-	struct history_line line = lines->buf[lines->head];
-	_line_idx_inc(lines, &lines->head);
-
-	if (lines->head == lines->tail) {
-		lines->head = 0;
-		lines->tail = 0;
-		history->viewport_top = 0;
-		history->append = false;
-		history->row_delta = 0;
-	}
-
-	if (head) {
-		history->viewport_top = lines->head;
-		history->row_delta = 0;
-	}
-
-	_history_check(history);
-
-	if (lines->head == 0 && lines->buf_len > lines->max_len)
-		_line_buffer_shrink(lines);
-
-	_history_check(history);
-
-	_evict_cells(cells, line.idx, line.len);
-
-	_history_check(history);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-static void _cell_buffer_try_extend(struct cell_buffer *cells, size_t len)
-{
-	static const size_t MIN_EXTEND_LEN = 128;
-
-	if (cells->buf_len >= cells->max_len)
-		return;
-
-	if (cells->tail_top > 0 && len <= cells->buf_len - cells->tail_top) {
-		/*
-		 * Don't extend when we will have enough space, since head is gonna get
-		 * wiped either way (we don't move already existing lines).
-		 * This only matters when allocation has failed previously.
-		 */
-		return;
-	}
-
-	/* Specify a minimum initial allocation size. */
-	len = max(len, MIN_EXTEND_LEN);
-
-	/* Try to roughly double the buffer size. */
-	len = max(len, cells->buf_len);
-
-	/* Limit the new size to max_len. */
-	len = min(len, cells->max_len - cells->head_top);
-
-	size_t new_len =
-	    min(cells->head_top + len, SIZE_MAX / sizeof(termui_cell_t));
-
-	assert(new_len > cells->buf_len);
-	assert(new_len <= cells->max_len);
-
-	termui_cell_t *new_buf =
-	    realloc(cells->buf, new_len * sizeof(termui_cell_t));
-	if (!new_buf) {
-		fprintf(stderr, "termui: Out of memory for scrollback\n");
-		return;
-	}
-
-	cells->buf = new_buf;
-	cells->buf_len = new_len;
-}
-
-static void _line_buffer_try_extend(struct line_buffer *lines)
-{
-	static const size_t MIN_EXTEND_LEN = 128;
-
-	if (lines->buf_len >= lines->max_len)
-		return;
-
-	if (lines->tail < lines->head)
-		return;
-
-	/* Specify a minimum initial allocation size. */
-	size_t len = MIN_EXTEND_LEN;
-
-	/* Try to roughly double the buffer size. */
-	len = max(len, lines->buf_len);
-
-	/* Limit the new size to max_len. */
-	len = min(len, lines->max_len - lines->buf_len);
-
-	size_t new_len = min(lines->buf_len + len, SIZE_MAX - sizeof(struct history_line));
-
-	assert(new_len >= lines->buf_len);
-	assert(new_len <= lines->max_len);
-
-	if (new_len == lines->buf_len)
-		return;
-
-	struct history_line *new_buf =
-	    realloc(lines->buf, new_len * sizeof(struct history_line));
-	if (!new_buf) {
-		fprintf(stderr, "termui: Out of memory for scrollback\n");
-		return;
-	}
-
-	lines->buf = new_buf;
-	lines->buf_len = new_len;
-}
-
-static bool _cell_buffer_fits_line(const struct cell_buffer *cells, size_t len)
-{
-	if (cells->tail_top > 0) {
-		return len <= cells->head_offset - cells->tail_top;
-	} else {
-		return len <= cells->buf_len - cells->head_top || len <= cells->head_offset;
-	}
-}
-
-static struct history_line *_current_line(struct line_buffer *lines)
-{
-	assert(!_lines_empty(lines));
-	return &lines->buf[(lines->tail ? lines->tail : lines->buf_len) - 1];
-}
-
-static void _alloc_line(struct history *history)
-{
-	struct line_buffer *lines = &history->lines;
-
-	size_t idx = 0;
-	if (!_lines_empty(lines))
-		idx = _current_line(lines)->idx + _current_line(lines)->len;
-
-	if (lines->buf_len == 0) {
-		/* Initial allocation. */
-		_line_buffer_try_extend(lines);
-
-		if (lines->buf_len == 0) {
-			fprintf(stderr, "termui: Could not allocate initial scrollback buffer\n");
-			return;
-		}
-	}
-
-	assert(lines->tail < lines->buf_len);
-
-	bool viewport_inactive = (history->viewport_top == lines->tail);
-
-	lines->tail++;
-
-	if (lines->tail >= lines->buf_len)
-		_line_buffer_try_extend(lines);
-
-	if (lines->tail >= lines->buf_len)
-		lines->tail = 0;
-
-	if (lines->tail == lines->head)
-		_evict_oldest_line(history);
-
-	assert(lines->tail != lines->head);
-
-	if (viewport_inactive)
-		history->viewport_top = lines->tail;
-
-	_current_line(lines)->idx = idx;
-	_current_line(lines)->len = 0;
-
-	history->append = true;
-
-	_history_check(history);
-}
-
-/** Allocate a line of cells in the cell buffer.
- * @return Index of first allocated cell in the buffer.
- */
-static size_t _alloc_cells(struct cell_buffer *cells, size_t len)
-{
-	assert(_cell_buffer_fits_line(cells, len));
-
-	size_t idx;
-
-	if (cells->tail_top == 0 && cells->buf_len - cells->head_top >= len) {
-		idx = cells->head_top;
-		cells->head_top += len;
-		assert(cells->head_top <= cells->buf_len);
-	} else {
-		idx = cells->tail_top;
-		cells->tail_top += len;
-		assert(cells->tail_top <= cells->head_offset);
-	}
-
-	return idx;
-}
-
-static termui_cell_t *_history_append(struct history *history, size_t len)
-{
-	struct line_buffer *lines = &history->lines;
-	struct cell_buffer *cells = &history->cells;
-
-	/*
-	 * Ideally, buffer gets reallocated to its maximum size
-	 * before we start recycling it.
-	 */
-	if (!_cell_buffer_fits_line(cells, len))
-		_cell_buffer_try_extend(cells, len);
-
-	if (len > cells->buf_len) {
-		/*
-		 * This can only happen if allocation fails early on,
-		 * since len is normally limited to row width.
-		 */
-		return NULL;
-	}
-
-	/* Recycle old lines to make space in the buffer. */
-	while (!_cell_buffer_fits_line(cells, len)) {
-		assert(!_lines_empty(lines));
-		_evict_oldest_line(history);
-	}
-
-	/* Allocate cells for the line. */
-	size_t idx = _alloc_cells(cells, len);
-
-	/* Allocate the line, if necessary. */
-	if (!history->append || _lines_empty(lines)) {
-		_alloc_line(history);
-
-		if (_lines_empty(lines)) {
-			/* Initial allocation failed. */
-			return NULL;
-		}
-	}
-
-	struct history_line *line = _current_line(lines);
-
-	assert(idx == line->idx + line->len || idx == 0);
-
-	/* Deal with crossing the buffer's edge. */
-	if (idx != line->idx + line->len) {
-		if (line->len > 0) {
-			/* Breaks off an incomplete line at the end of buffer. */
-			_alloc_line(history);
-			line = _current_line(lines);
-		}
-
-		line->idx = 0;
-	}
-
-	line->len += len;
-
-	return &cells->buf[idx];
-}
-
-/**
- * @param history
- * @return True if the top row of the viewport is a scrollback row.
- */
-bool _scrollback_active(const struct history *history)
-{
-	if (history->viewport_top == history->lines.tail)
-		return false;
-
-	assert(_index_valid(history, history->viewport_top));
-	return true;
-}
-
-static size_t _history_line_rows(const struct history *history, size_t idx)
-{
-	assert(_index_valid(history, idx));
-
-	struct history_line line = history->lines.buf[idx];
-
-	if (line.len == 0)
-		return 1;
-
-	return (line.len - 1) / history->cols + 1;
-}
-
-static int _history_scroll_down(struct history *history, int requested)
-{
-	assert(requested > 0);
-
-	size_t delta = requested;
-
-	/* Skip first line. */
-
-	if (history->row_delta > 0) {
-		size_t rows = _history_line_rows(history, history->viewport_top);
-		assert(rows > history->row_delta);
-
-		if (delta < rows - history->row_delta) {
-			history->row_delta += delta;
-			_history_check(history);
-			return requested;
-		}
-
-		delta -= rows - history->row_delta;
-		history->row_delta = 0;
-
-		_line_idx_inc(&history->lines, &history->viewport_top);
-	}
-
-	/* Skip as many lines as necessary. */
-
-	while (_scrollback_active(history)) {
-		size_t rows = _history_line_rows(history, history->viewport_top);
-
-		if (delta < rows) {
-			/* Found the right line. */
-			history->row_delta = delta;
-			_history_check(history);
-			return requested;
-		}
-
-		delta -= rows;
-
-		_line_idx_inc(&history->lines, &history->viewport_top);
-	}
-
-	/* Scrolled past the end of history. */
-	_history_check(history);
-	return requested - delta;
-}
-
-static int _history_scroll_up(struct history *history, int requested)
-{
-	assert(requested < 0);
-
-	/* Prevent overflow. */
-	if (history->row_delta > INT_MAX) {
-		history->row_delta += requested;
-		_history_check(history);
-		return requested;
-	}
-
-	int delta = requested + (int) history->row_delta;
-	history->row_delta = 0;
-
-	while (delta < 0 && history->viewport_top != history->lines.head) {
-		_line_idx_dec(&history->lines, &history->viewport_top);
-
-		size_t rows = _history_line_rows(history, history->viewport_top);
-
-		if (rows > INT_MAX) {
-			history->row_delta = rows + delta;
-			_history_check(history);
-			return requested;
-		}
-
-		delta += (int) rows;
-	}
-
-	_history_check(history);
-
-	if (delta < 0)
-		return requested - delta;
-
-	assert(delta >= 0);
-	history->row_delta = (size_t) delta;
-	return requested;
-}
-
-static int _history_scroll_to_top(struct history *history)
-{
-	history->viewport_top = history->lines.head;
-	history->row_delta = 0;
-	_history_check(history);
-	return INT_MIN;
-}
-
-static int _history_scroll_to_bottom(struct history *history)
-{
-	history->viewport_top = history->lines.tail;
-	_history_check(history);
-	return INT_MAX;
-}
-
-/** Scroll the viewport by the given number of rows.
- *
- * @param history
- * @param delta  How many rows to scroll. Negative delta scrolls upward.
- * @return  How many rows have actually been scrolled before top/bottom.
- */
-int _history_scroll(struct history *history, int delta)
-{
-	if (delta == INT_MIN)
-		return _history_scroll_to_top(history);
-	if (delta == INT_MAX)
-		return _history_scroll_to_bottom(history);
-	if (delta > 0)
-		return _history_scroll_down(history, delta);
-	if (delta < 0)
-		return _history_scroll_up(history, delta);
-
-	return 0;
-}
-
-/** Sets new width for the viewport, recalculating current position so that the
- * top viewport row remains in place, and returning a piece of the last history
- * line if the top active screen row is a continuation of it.
- *
- * @param history
- * @param new_cols       New column width of the viewport.
- * @param[out] recouped  Number of cells returned to active screen.
- * @return  Pointer to the cell data for returned cells.
- */
-const termui_cell_t *_history_reflow(struct history *history, size_t new_cols, size_t *recouped)
-{
-	history->row_delta = (history->row_delta * history->cols) / new_cols;
-	history->cols = new_cols;
-
-	if (!history->append) {
-		*recouped = 0;
-		return NULL;
-	}
-
-	/* Return the part of last line that's not aligned at row boundary. */
-	assert(!_lines_empty(&history->lines));
-
-	size_t last_idx = history->lines.tail;
-	_line_idx_dec(&history->lines, &last_idx);
-
-	struct history_line *last = &history->lines.buf[last_idx];
-	*recouped = last->len % new_cols;
-
-	if (last->idx + last->len == history->cells.head_top) {
-		history->cells.head_top -= *recouped;
-	} else {
-		assert(last->idx + last->len == history->cells.tail_top);
-		history->cells.tail_top -= *recouped;
-	}
-
-	last->len -= *recouped;
-	if (last->len == 0 && last->idx == 0) {
-		assert(history->cells.tail_top == 0);
-		last->idx = history->cells.head_top;
-	}
-
-	return &history->cells.buf[last->idx + last->len];
-}
-
-/** Counts the number of scrollback rows present in the viewport.
- *
- * @param history
- * @param max  Number of viewport rows.
- * @return Count.
- */
-int _history_viewport_rows(const struct history *history, size_t max)
-{
-	if (!_scrollback_active(history))
-		return 0;
-
-	size_t current = history->viewport_top;
-	size_t rows = _history_line_rows(history, current) - history->row_delta;
-	_line_idx_inc(&history->lines, &current);
-
-	while (rows < max && current != history->lines.tail) {
-		rows += _history_line_rows(history, current);
-		_line_idx_inc(&history->lines, &current);
-	}
-
-	return (rows > max) ? max : rows;
-}
-
-static void _update_blank(int col, int row, int len, termui_update_cb_t cb, void *udata)
-{
-	while (len > BLANK_CELLS_LEN) {
-		cb(udata, col, row, _blank_cells, BLANK_CELLS_LEN);
-		col += BLANK_CELLS_LEN;
-		len -= BLANK_CELLS_LEN;
-	}
-
-	if (len > 0)
-		cb(udata, col, row, _blank_cells, len);
-}
-
-static void _adjust_row_delta(const struct history *history, size_t *line_idx, size_t *delta)
-{
-	while (*line_idx != history->lines.tail) {
-		size_t rows = _history_line_rows(history, *line_idx);
-		if (*delta < rows)
-			return;
-
-		*delta -= rows;
-		_line_idx_inc(&history->lines, line_idx);
-	}
-}
-
-/** Run update callback for a range of visible scrollback srows.
- *
- * @param history
- * @param row    First viewport row we want to update.
- * @param count  Number of viewport rows we want to update.
- * @param cb     Callback to call for every row.
- * @param udata  Callback userdata.
- * @return  Actual number of rows updated (may be less than count if
- *     the rest of rows are from the active screen).
- */
-int _history_iter_rows(const struct history *history, int row, int count, termui_update_cb_t cb, void *udata)
-{
-	assert(history->row_delta <= SIZE_MAX - row);
-
-	size_t current_line = history->viewport_top;
-	size_t delta = history->row_delta + (size_t) row;
-	/* Get to the first row to be returned. */
-	_adjust_row_delta(history, &current_line, &delta);
-
-	int initial_count = count;
-
-	while (count > 0 && current_line != history->lines.tail) {
-		/* Process each line. */
-		assert(_index_valid(history, current_line));
-
-		struct history_line line = history->lines.buf[current_line];
-		assert(line.len <= history->cells.buf_len);
-		assert(line.idx <= history->cells.buf_len - line.len);
-
-		if (line.len == 0) {
-			/* Special case for empty line. */
-			_update_blank(0, row, history->cols, cb, udata);
-			row++;
-			count--;
-			_line_idx_inc(&history->lines, &current_line);
-			continue;
-		}
-
-		const termui_cell_t *cells = &history->cells.buf[line.idx];
-		size_t line_offset = delta * history->cols;
-		assert(line_offset < line.len);
-		delta = 0;
-
-		/* Callback for each full row. */
-		while (count > 0 && line_offset + history->cols <= line.len) {
-			assert(line.idx + line_offset <= history->cells.buf_len - history->cols);
-			cb(udata, 0, row, &cells[line_offset], history->cols);
-
-			line_offset += history->cols;
-			row++;
-			count--;
-		}
-
-		if (count > 0 && line_offset < line.len) {
-			/* Callback for the last (incomplete) row. */
-
-			cb(udata, 0, row, &cells[line_offset], line.len - line_offset);
-
-			size_t col = line.len - line_offset;
-			assert(col < history->cols);
-
-			/* Callbacks for the blank section in the last row. */
-			_update_blank(col, row, history->cols - col, cb, udata);
-
-			row++;
-			count--;
-		}
-
-		_line_idx_inc(&history->lines, &current_line);
-	}
-
-	return initial_count - count;
-}
-
-/** Append a row from active screen to scrollback history.
- *
- * @param history
- * @param b     Pointer to the row in active screen buffer.
- * @param last  False if the row was overflowed, meaning the next row will be
- *              appended to the same history line as this row.
- */
-void _history_append_row(struct history *history, const termui_cell_t *b, bool last)
-{
-	size_t len = history->cols;
-
-	/* Reduce multiple trailing empty cells to just one. */
-	if (last) {
-		while (len > 1 && _cell_is_empty(b[len - 1]) && _cell_is_empty(b[len - 2]))
-			len--;
-	}
-
-	memcpy(_history_append(history, len), b, sizeof(termui_cell_t) * len);
-
-	if (last)
-		history->append = false;
-}
Index: pace/lib/termui/src/history.h
===================================================================
--- uspace/lib/termui/src/history.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2024 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <termui.h>
-#include <stdbool.h>
-
-#define INTERNAL __attribute__((visibility("internal")))
-
-static bool _cell_is_empty(const termui_cell_t cell)
-{
-	return cell.glyph_idx == 0 && cell.bgcolor == 0 && cell.fgcolor == 0 &&
-	    cell.padding == 0;
-}
-
-struct cell_buffer {
-	termui_cell_t *buf;
-
-	size_t head_offset;
-	size_t head_top;
-
-	/* Tail offset is implicitly zero. */
-	size_t tail_top;
-
-	size_t buf_len;
-	size_t max_len;
-};
-
-struct history_line {
-	size_t idx;
-	size_t len;
-};
-
-struct line_buffer {
-	struct history_line *buf;
-
-	size_t head;
-	size_t tail;
-
-	size_t buf_len;
-	size_t max_len;
-};
-
-struct history {
-	size_t viewport_top;
-	size_t row_delta;
-
-	size_t cols;
-
-	struct cell_buffer cells;
-	struct line_buffer lines;
-
-	bool append;
-};
-
-INTERNAL bool _scrollback_active(const struct history *history);
-INTERNAL void _history_append_row(struct history *history, const termui_cell_t *b, bool last);
-INTERNAL int _history_viewport_rows(const struct history *history, size_t max);
-INTERNAL int _history_iter_rows(const struct history *history, int row, int count, termui_update_cb_t cb, void *udata);
-INTERNAL int _history_scroll(struct history *history, int delta);
-INTERNAL const termui_cell_t *_history_reflow(struct history *history, size_t new_cols, size_t *recouped);
Index: pace/lib/termui/src/termui.c
===================================================================
--- uspace/lib/termui/src/termui.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,731 +1,0 @@
-/*
- * Copyright (c) 2024 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <termui.h>
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "history.h"
-
-struct termui {
-	int cols;
-	int rows;
-
-	int col;
-	int row;
-
-	bool cursor_visible;
-
-	// How much of the screen is in use. Relevant for clrscr.
-	int used_rows;
-
-	// Row index of the first screen row in the circular screen buffer.
-	int first_row;
-	// rows * cols circular buffer of the current virtual screen contents.
-	// Does not necessarily correspond to the currently visible text,
-	// if scrollback is active.
-	termui_cell_t *screen;
-	// Set to one if the corresponding row has overflowed into the next row.
-	uint8_t *overflow_flags;
-
-	/* Used to remove extra newline when CRLF is placed exactly on row boundary. */
-	bool overflow;
-
-	struct history history;
-
-	termui_cell_t style;
-	termui_cell_t default_cell;
-
-	termui_scroll_cb_t scroll_cb;
-	termui_update_cb_t update_cb;
-	termui_refresh_cb_t refresh_cb;
-	void *scroll_udata;
-	void *update_udata;
-	void *refresh_udata;
-};
-
-static int _real_row(const termui_t *termui, int row)
-{
-	row += termui->first_row;
-	if (row >= termui->rows)
-		row -= termui->rows;
-
-	return row;
-}
-
-#define _screen_cell(termui, col, row) \
-	((termui)->screen[(termui)->cols * _real_row((termui), (row)) + (col)])
-
-#define _current_cell(termui) \
-	_screen_cell((termui), (termui)->col, (termui)->row)
-
-#define _overflow_flag(termui, row) \
-	((termui)->overflow_flags[_real_row((termui), (row))])
-
-/** Sets current cell style/color.
- */
-void termui_set_style(termui_t *termui, termui_cell_t style)
-{
-	termui->style = style;
-}
-
-static void _termui_evict_row(termui_t *termui)
-{
-	if (termui->used_rows <= 0)
-		return;
-
-	bool last = !_overflow_flag(termui, 0);
-
-	for (int col = 0; col < termui->cols; col++)
-		_screen_cell(termui, col, 0).cursor = 0;
-
-	/* Append first row of the screen to history. */
-	_history_append_row(&termui->history, &_screen_cell(termui, 0, 0), last);
-
-	_overflow_flag(termui, 0) = false;
-
-	/* Clear the row we moved to history. */
-	for (int col = 0; col < termui->cols; col++)
-		_screen_cell(termui, col, 0) = termui->default_cell;
-
-	termui->used_rows--;
-
-	termui->row--;
-	if (termui->row < 0) {
-		termui->row = 0;
-		termui->col = 0;
-	}
-
-	termui->first_row++;
-	if (termui->first_row >= termui->rows)
-		termui->first_row -= termui->rows;
-
-	assert(termui->first_row < termui->rows);
-}
-
-/**
- * Get active screen row. This always points to the primary output buffer,
- * unaffected by viewport shifting. Can be used for modifying the screen
- * directly. For displaying viewport, use termui_force_viewport_update().
- */
-termui_cell_t *termui_get_active_row(termui_t *termui, int row)
-{
-	assert(row >= 0);
-	assert(row < termui->rows);
-
-	return &_screen_cell(termui, 0, row);
-}
-
-static void _update_active_cells(termui_t *termui, int col, int row, int cells)
-{
-	int viewport_rows = _history_viewport_rows(&termui->history, termui->rows);
-	int active_rows_shown = termui->rows - viewport_rows;
-
-	/* Send update if the cells are visible in viewport. */
-	if (termui->update_cb && active_rows_shown > row)
-		termui->update_cb(termui->update_udata, col, row + viewport_rows, &_screen_cell(termui, col, row), cells);
-}
-
-static void _update_current_cell(termui_t *termui)
-{
-	_update_active_cells(termui, termui->col, termui->row, 1);
-}
-
-static void _cursor_off(termui_t *termui)
-{
-	if (termui->cursor_visible) {
-		_current_cell(termui).cursor = 0;
-		_update_current_cell(termui);
-	}
-}
-
-static void _cursor_on(termui_t *termui)
-{
-	if (termui->cursor_visible) {
-		_current_cell(termui).cursor = 1;
-		_update_current_cell(termui);
-	}
-}
-
-static void _advance_line(termui_t *termui)
-{
-	if (termui->row + 1 >= termui->rows) {
-		size_t old_top = termui->history.viewport_top;
-
-		_termui_evict_row(termui);
-
-		if (old_top != termui->history.viewport_top && termui->refresh_cb)
-			termui->refresh_cb(termui->refresh_udata);
-
-		if (termui->scroll_cb && !_scrollback_active(&termui->history))
-			termui->scroll_cb(termui->scroll_udata, 1);
-	}
-
-	if (termui->rows > 1)
-		termui->row++;
-
-	if (termui->row >= termui->used_rows)
-		termui->used_rows = termui->row + 1;
-
-	assert(termui->row < termui->rows);
-}
-
-void termui_put_lf(termui_t *termui)
-{
-	_cursor_off(termui);
-	termui->overflow = false;
-	_advance_line(termui);
-	_cursor_on(termui);
-}
-
-void termui_put_cr(termui_t *termui)
-{
-	_cursor_off(termui);
-
-	/* CR right after overflow from previous row. */
-	if (termui->overflow && termui->row > 0) {
-		termui->row--;
-		_overflow_flag(termui, termui->row) = 0;
-	}
-
-	termui->overflow = false;
-
-	// Set position to start of current line.
-	termui->col = 0;
-
-	_cursor_on(termui);
-}
-
-/* Combined CR & LF to cut down on cursor update callbacks. */
-void termui_put_crlf(termui_t *termui)
-{
-	_cursor_off(termui);
-
-	/* CR right after overflow from previous row. */
-	if (termui->overflow && termui->row > 0) {
-		termui->row--;
-		_overflow_flag(termui, termui->row) = 0;
-	}
-
-	termui->overflow = false;
-
-	// Set position to start of next row.
-	_advance_line(termui);
-	termui->col = 0;
-
-	_cursor_on(termui);
-}
-
-void termui_put_tab(termui_t *termui)
-{
-	_cursor_off(termui);
-
-	termui->overflow = false;
-
-	int new_col = (termui->col / 8 + 1) * 8;
-	if (new_col >= termui->cols)
-		new_col = termui->cols - 1;
-	termui->col = new_col;
-
-	_cursor_on(termui);
-}
-
-void termui_put_backspace(termui_t *termui)
-{
-	_cursor_off(termui);
-
-	termui->overflow = false;
-
-	if (termui->col == 0) {
-		if (termui->row > 0 && _overflow_flag(termui, termui->row - 1)) {
-			termui->row--;
-			termui->col = termui->cols - 1;
-			_overflow_flag(termui, termui->row) = false;
-		}
-	} else {
-		termui->col--;
-	}
-
-	_cursor_on(termui);
-}
-
-/**
- * Put glyph at current position, and advance column by width, overflowing into
- * next row and scrolling the active screen if necessary.
- *
- * If width > 1, the function makes sure the glyph isn't split by end of row.
- * The following (width - 1) cells are filled with padding cells,
- * and it's the user's responsibility to render this correctly.
- */
-void termui_put_glyph(termui_t *termui, uint32_t glyph_idx, int width)
-{
-	if (termui->row >= termui->used_rows)
-		termui->used_rows = termui->row + 1;
-
-	termui_cell_t padding_cell = termui->style;
-	padding_cell.padding = 1;
-	termui_cell_t cell = termui->style;
-	cell.glyph_idx = glyph_idx;
-
-	// FIXME: handle wide glyphs in history correctly after resize
-
-	if (termui->col + width > termui->cols) {
-		/* Have to go to next row first. */
-		int blanks = termui->cols - termui->col;
-		for (int i = 0; i < blanks; i++)
-			_screen_cell(termui, termui->col + i, termui->row) = padding_cell;
-
-		_update_active_cells(termui, termui->col, termui->row, blanks);
-
-		_overflow_flag(termui, termui->row) = 1;
-		_advance_line(termui);
-		termui->col = 0;
-	}
-
-	_current_cell(termui) = cell;
-	termui->col++;
-
-	for (int i = 1; i < width; i++) {
-		_current_cell(termui) = padding_cell;
-		termui->col++;
-	}
-
-	if (termui->col < termui->cols) {
-		/* The changed cells are all adjacent. */
-		if (termui->cursor_visible)
-			_current_cell(termui).cursor = 1;
-		_update_active_cells(termui, termui->col - width, termui->row, width + 1);
-		termui->overflow = false;
-	} else {
-		/* Update the written cells and then update cursor on next row. */
-		_update_active_cells(termui, termui->col - width, termui->row, width);
-
-		_overflow_flag(termui, termui->row) = 1;
-		_advance_line(termui);
-		termui->col = 0;
-		termui->overflow = true;
-
-		_cursor_on(termui);
-	}
-}
-
-termui_color_t termui_color_from_rgb(uint8_t r, uint8_t g, uint8_t b)
-{
-	r = r >> 3;
-	g = g >> 3;
-	b = b >> 3;
-
-	return 0x8000 | r << 10 | g << 5 | b;
-}
-
-void termui_color_to_rgb(const termui_color_t c, uint8_t *r, uint8_t *g, uint8_t *b)
-{
-	assert((c & 0x8000) != 0);
-
-	/* 15b encoding, bit 15 is set to reserve lower half for other uses. */
-
-	int bb = c & 0x1f;
-	int gg = (c >> 5) & 0x1f;
-	int rr = (c >> 10) & 0x1f;
-
-	/*
-	 * 3 extra low order bits are filled from high-order bits to get the full
-	 * range instead of topping out at 0xf8.
-	 */
-	*r = (rr << 3) | (rr >> 2);
-	*g = (gg << 3) | (gg >> 2);
-	*b = (bb << 3) | (bb >> 2);
-
-	assert(termui_color_from_rgb(*r, *g, *b) == c);
-}
-
-/** Get terminal width.
- */
-int termui_get_cols(const termui_t *termui)
-{
-	return termui->cols;
-}
-
-/** Get terminal height.
- */
-int termui_get_rows(const termui_t *termui)
-{
-	return termui->rows;
-}
-
-/** Get cursor position
- */
-void termui_get_pos(const termui_t *termui, int *col, int *row)
-{
-	*col = termui->col;
-	*row = termui->row;
-}
-
-/** Set cursor position.
- */
-void termui_set_pos(termui_t *termui, int col, int row)
-{
-	if (col < 0)
-		col = 0;
-
-	if (col >= termui->cols)
-		col = termui->cols - 1;
-
-	if (row < 0)
-		row = 0;
-
-	if (row >= termui->rows)
-		row = termui->rows - 1;
-
-	_cursor_off(termui);
-
-	termui->col = col;
-	termui->row = row;
-
-	_cursor_on(termui);
-}
-
-/** Clear screen by scrolling out all text currently on screen.
- * Sets position to (0, 0).
- */
-void termui_clear_screen(termui_t *termui)
-{
-	_cursor_off(termui);
-	termui_put_crlf(termui);
-
-	int unused_rows = termui->rows - termui->used_rows;
-
-	while (termui->used_rows > 0)
-		_termui_evict_row(termui);
-
-	/* Clear out potential garbage left by direct screen access. */
-	for (int row = 0; row < unused_rows; row++) {
-		for (int col = 0; col < termui->cols; col++) {
-			_screen_cell(termui, col, row) = termui->default_cell;
-		}
-	}
-
-	termui->row = 0;
-	termui->col = 0;
-
-	_cursor_on(termui);
-
-	if (termui->refresh_cb)
-		termui->refresh_cb(termui->refresh_udata);
-}
-
-/** Erase all text starting at the given row.
- * Erased text is not appended to history.
- * If cursor was in the erased section, it's set to the beginning of it.
- */
-void termui_wipe_screen(termui_t *termui, int first_row)
-{
-	if (first_row >= termui->rows)
-		return;
-
-	if (first_row < 0)
-		first_row = 0;
-
-	for (int row = first_row; row < termui->rows; row++) {
-		for (int col = 0; col < termui->cols; col++)
-			_screen_cell(termui, col, row) = termui->default_cell;
-
-		_overflow_flag(termui, row) = false;
-		_update_active_cells(termui, 0, row, termui->cols);
-	}
-
-	if (termui->used_rows > first_row)
-		termui->used_rows = first_row;
-
-	if (termui->row >= first_row) {
-		termui->row = first_row;
-		termui->col = 0;
-		_cursor_on(termui);
-	}
-}
-
-void termui_set_scroll_cb(termui_t *termui, termui_scroll_cb_t cb, void *userdata)
-{
-	termui->scroll_cb = cb;
-	termui->scroll_udata = userdata;
-}
-
-void termui_set_update_cb(termui_t *termui, termui_update_cb_t cb, void *userdata)
-{
-	termui->update_cb = cb;
-	termui->update_udata = userdata;
-}
-
-void termui_set_refresh_cb(termui_t *termui, termui_refresh_cb_t cb, void *userdata)
-{
-	termui->refresh_cb = cb;
-	termui->refresh_udata = userdata;
-}
-
-/** Makes update callbacks for all indicated viewport rows.
- * Useful when refreshing the screens or handling a scroll callback.
- */
-void termui_force_viewport_update(const termui_t *termui, int first_row, int rows)
-{
-	assert(first_row >= 0);
-	assert(rows >= 0);
-	assert(first_row + rows <= termui->rows);
-
-	if (!termui->update_cb)
-		return;
-
-	int sb_rows = _history_viewport_rows(&termui->history, termui->rows);
-	int updated = _history_iter_rows(&termui->history, first_row, rows, termui->update_cb, termui->update_udata);
-
-	first_row += updated;
-	rows -= updated;
-
-	assert(sb_rows <= first_row);
-
-	for (int row = first_row; row < first_row + rows; row++) {
-		termui->update_cb(termui->update_udata, 0, row, &_screen_cell(termui, 0, row - sb_rows), termui->cols);
-	}
-}
-
-bool termui_scrollback_is_active(const termui_t *termui)
-{
-	return _scrollback_active(&termui->history);
-}
-
-termui_t *termui_create(int cols, int rows, size_t history_lines)
-{
-	/* Prevent numerical overflows. */
-	if (cols < 2 || rows < 1 || INT_MAX / cols < rows)
-		return NULL;
-
-	int cells = cols * rows;
-
-	termui_t *termui = calloc(1, sizeof(termui_t));
-	if (!termui)
-		return NULL;
-
-	termui->cols = cols;
-	termui->rows = rows;
-	termui->history.lines.max_len = history_lines;
-	if (history_lines > SIZE_MAX / cols)
-		termui->history.cells.max_len = SIZE_MAX;
-	else
-		termui->history.cells.max_len = history_lines * cols;
-	termui->history.cols = cols;
-
-	termui->screen = calloc(cells, sizeof(termui->screen[0]));
-	if (!termui->screen) {
-		free(termui);
-		return NULL;
-	}
-
-	termui->overflow_flags = calloc(rows, sizeof(termui->overflow_flags[0]));
-	if (!termui->overflow_flags) {
-		free(termui->screen);
-		free(termui);
-		return NULL;
-	}
-
-	return termui;
-}
-
-void termui_destroy(termui_t *termui)
-{
-	free(termui->screen);
-	free(termui);
-}
-
-/** Scrolls the viewport.
- * Negative delta scrolls towards older rows, positive towards newer.
- * Scroll callback is called with the actual number of rows scrolled.
- * No callback is called for rows previously off-screen.
- *
- * @param termui
- * @param delta  Number of rows to scroll.
- */
-void termui_history_scroll(termui_t *termui, int delta)
-{
-	int scrolled = _history_scroll(&termui->history, delta);
-
-	if (scrolled != 0 && termui->scroll_cb)
-		termui->scroll_cb(termui->scroll_udata, scrolled);
-}
-
-void termui_set_cursor_visibility(termui_t *termui, bool visible)
-{
-	if (termui->cursor_visible == visible)
-		return;
-
-	termui->cursor_visible = visible;
-
-	_current_cell(termui).cursor = visible;
-	_update_current_cell(termui);
-}
-
-bool termui_get_cursor_visibility(const termui_t *termui)
-{
-	return termui->cursor_visible;
-}
-
-static void _termui_put_cells(termui_t *termui, const termui_cell_t *cells, int n)
-{
-	while (n > 0) {
-		_current_cell(termui) = cells[0];
-		cells++;
-		n--;
-
-		termui->col++;
-
-		if (termui->col == termui->cols) {
-			_overflow_flag(termui, termui->row) = 1;
-			_advance_line(termui);
-			termui->col = 0;
-			termui->overflow = true;
-		} else {
-			termui->overflow = false;
-		}
-	}
-
-	if (termui->row >= termui->used_rows)
-		termui->used_rows = termui->row + 1;
-}
-
-/** Resize active screen and scrollback depth.
- */
-errno_t termui_resize(termui_t *termui, int cols, int rows, size_t history_lines)
-{
-	/* Prevent numerical overflows. */
-	if (cols < 2 || rows < 1 || INT_MAX / cols < rows)
-		return ERANGE;
-
-	int cells = cols * rows;
-
-	termui_cell_t *new_screen = calloc(cells, sizeof(new_screen[0]));
-	if (!new_screen)
-		return ENOMEM;
-
-	uint8_t *new_flags = calloc(rows, sizeof(new_flags[0]));
-	if (!new_flags) {
-		free(new_screen);
-		return ENOMEM;
-	}
-
-	termui_t old_termui = *termui;
-
-	termui->rows = rows;
-	termui->cols = cols;
-	termui->row = 0;
-	termui->col = 0;
-	termui->used_rows = 0;
-	termui->first_row = 0;
-	termui->screen = new_screen;
-	termui->overflow_flags = new_flags;
-	termui->overflow = false;
-
-	bool cursor_visible = termui->cursor_visible;
-	termui->cursor_visible = false;
-
-	termui->history.lines.max_len = history_lines;
-
-	if (history_lines > SIZE_MAX / cols)
-		termui->history.cells.max_len = SIZE_MAX;
-	else
-		termui->history.cells.max_len = history_lines * cols;
-
-	/* Temporarily remove callbacks. */
-	termui->scroll_cb = NULL;
-	termui->update_cb = NULL;
-	termui->refresh_cb = NULL;
-
-	size_t recouped;
-	const termui_cell_t *c = _history_reflow(&termui->history, cols, &recouped);
-
-	/* Return piece of the incomplete line in scrollback back to active screen. */
-	if (recouped > 0)
-		_termui_put_cells(termui, c, recouped);
-
-	/* Mark cursor position. */
-	_current_cell(&old_termui).cursor = 1;
-
-	/* Write the contents of old screen into the new one. */
-	for (int row = 0; row < old_termui.used_rows; row++) {
-		int real_row_offset = _real_row(&old_termui, row) * old_termui.cols;
-
-		if (_overflow_flag(&old_termui, row)) {
-			_termui_put_cells(termui, &old_termui.screen[real_row_offset], old_termui.cols);
-		} else {
-			/* Trim trailing blanks. */
-			int len = old_termui.cols;
-			while (len > 0 && _cell_is_empty(old_termui.screen[real_row_offset + len - 1]))
-				len--;
-
-			_termui_put_cells(termui, &old_termui.screen[real_row_offset], len);
-
-			/* Mark cursor at the end of row, if any. */
-			if (len < old_termui.cols)
-				_current_cell(termui).cursor = old_termui.screen[real_row_offset + len].cursor;
-
-			if (row < old_termui.used_rows - 1)
-				termui_put_crlf(termui);
-		}
-	}
-
-	/* Find cursor */
-	int new_col = 0;
-	int new_row = 0;
-	for (int col = 0; col < termui->cols; col++) {
-		for (int row = 0; row < termui->rows; row++) {
-			if (_screen_cell(termui, col, row).cursor) {
-				_screen_cell(termui, col, row).cursor = 0;
-				new_col = col;
-				new_row = row;
-			}
-		}
-	}
-
-	free(old_termui.screen);
-	free(old_termui.overflow_flags);
-
-	termui->col = new_col;
-	termui->row = new_row;
-
-	termui->cursor_visible = cursor_visible;
-	_cursor_on(termui);
-
-	termui->scroll_cb = old_termui.scroll_cb;
-	termui->update_cb = old_termui.update_cb;
-	termui->refresh_cb = old_termui.refresh_cb;
-
-	if (termui->refresh_cb)
-		termui->refresh_cb(termui->refresh_udata);
-
-	return EOK;
-}
Index: pace/lib/trackmod/doc/doxygroups.h
===================================================================
--- uspace/lib/trackmod/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup trackmod libtrackmod
- * @ingroup libs
- */
Index: pace/lib/trackmod/meson.build
===================================================================
--- uspace/lib/trackmod/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2014 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'protracker.c',
-	'trackmod.c',
-	'xm.c',
-)
Index: pace/lib/trackmod/protracker.c
===================================================================
--- uspace/lib/trackmod/protracker.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,387 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Protracker module (.mod).
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <mem.h>
-
-#include "byteorder.h"
-#include "protracker.h"
-#include "trackmod.h"
-#include "types/protracker.h"
-
-/** Sample tag decoding table entry */
-typedef struct {
-	/** Tag */
-	const char *tag;
-	/** Number of channels */
-	unsigned channels;
-} smptag_desc_t;
-
-/** Sample tag decoding table */
-static smptag_desc_t smp_tags[] = {
-	{ .tag = "M.K.", .channels = 4 },
-	{ .tag = "M!K!", .channels = 4 },
-	{ .tag = "2CHN", .channels = 2 },
-	{ .tag = "6CHN", .channels = 6 },
-	{ .tag = "8CHN", .channels = 8 },
-	{ .tag = "10CH", .channels = 10 },
-	{ .tag = "12CH", .channels = 12 },
-	{ .tag = "14CH", .channels = 14 },
-	{ .tag = "16CH", .channels = 16 },
-	{ .tag = "18CH", .channels = 18 },
-	{ .tag = "20CH", .channels = 20 },
-	{ .tag = "22CH", .channels = 22 },
-	{ .tag = "24CH", .channels = 24 },
-	{ .tag = "26CH", .channels = 26 },
-	{ .tag = "28CH", .channels = 28 },
-	{ .tag = "30CH", .channels = 30 },
-	{ .tag = "32CH", .channels = 32 },
-};
-
-/** Decode sample tag.
- *
- * @param tag      Tag
- * @param channels Place to store number or channels.
- * @return         EOK on success, EINVAL if tag is not recognized.
- */
-static errno_t smp_tag_decode(uint8_t *tag, size_t *channels)
-{
-	size_t nentries = sizeof(smp_tags) / sizeof(smptag_desc_t);
-	size_t i;
-
-	for (i = 0; i < nentries; i++) {
-		if (memcmp(tag, smp_tags[i].tag, 4) == 0) {
-			*channels = smp_tags[i].channels;
-			return EOK;
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Get number of patterns stored in file.
- *
- * @param olist Order list
- * @return      Number of patterns in file
- */
-static size_t order_list_get_npatterns(protracker_order_list_t *olist)
-{
-	size_t i;
-	size_t max_pat;
-
-	max_pat = 0;
-	for (i = 0; i < protracker_olist_len; i++) {
-		if (olist->order_list[i] > max_pat)
-			max_pat = olist->order_list[i];
-	}
-
-	return 1 + max_pat;
-}
-
-/** Decode pattern cell.
- *
- * @param pattern Pattern
- * @param row     Row number
- * @param channel Channel number
- * @param cell    Place to store decoded cell
- */
-static void protracker_decode_cell(uint32_t cdata, trackmod_cell_t *cell)
-{
-	uint32_t code;
-
-	code = uint32_t_be2host(cdata);
-	cell->period = (code >> (4 * 4)) & 0xfff;
-	cell->instr = (((code >> (7 * 4)) & 0xf) << 4) |
-	    ((code >> (3 * 4)) & 0xf);
-	cell->effect = code & 0xfff;
-}
-
-/** Load Protracker patterns.
- *
- * @param f      File to read from
- * @param module Module being loaded to
- * @return       EOK on success, ENOMEM if out of memory, EIO on I/O error.
- */
-static errno_t protracker_load_patterns(FILE *f, trackmod_module_t *module)
-{
-	size_t cells;
-	size_t i, j;
-	errno_t rc;
-	size_t nread;
-	uint32_t *buf = NULL;
-
-	cells = module->channels * protracker_pattern_rows;
-	buf = calloc(cells, sizeof(uint32_t));
-
-	if (buf == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < module->patterns; i++) {
-		module->pattern[i].rows = protracker_pattern_rows;
-		module->pattern[i].channels = module->channels;
-		module->pattern[i].data = calloc(cells, sizeof(trackmod_cell_t));
-		if (module->pattern[i].data == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		nread = fread(buf, sizeof(uint32_t), cells, f);
-		if (nread != cells) {
-			printf("Error reading pattern.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		/* Decode cells */
-		for (j = 0; j < cells; j++) {
-			protracker_decode_cell(buf[j],
-			    &module->pattern[i].data[j]);
-		}
-	}
-
-	free(buf);
-	return EOK;
-error:
-	free(buf);
-	return rc;
-}
-
-/** Load protracker samples.
- *
- * @param f      File being read from
- * @param sample Sample header
- * @param module Module being loaded to
- * @return       EOk on success, ENOMEM if out of memory, EIO on I/O error.
- */
-static errno_t protracker_load_samples(FILE *f, protracker_smp_t *smp,
-    trackmod_module_t *module)
-{
-	errno_t rc;
-	size_t i;
-	uint8_t ftval;
-	size_t nread;
-	trackmod_sample_t *sample;
-
-	for (i = 0; i < module->instrs; i++) {
-		module->instr[i].samples = 1;
-		module->instr[i].sample = calloc(1, sizeof(trackmod_sample_t));
-		if (module->instr[i].sample == NULL) {
-			printf("Error allocating sample.\n");
-			rc = ENOMEM;
-			goto error;
-		}
-
-		sample = &module->instr[i].sample[0];
-		sample->length =
-		    uint16_t_be2host(smp[i].length) * 2;
-		sample->bytes_smp = 1;
-		sample->data = calloc(1, sample->length);
-		if (sample->data == NULL) {
-			printf("Error allocating sample.\n");
-			rc = ENOMEM;
-			goto error;
-		}
-
-		nread = fread(sample->data, 1, sample->length, f);
-		if (nread != sample->length) {
-			printf("Error reading sample.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		sample->def_vol = smp[i].def_vol;
-
-		sample->loop_start =
-		    uint16_t_be2host(smp[i].loop_start) * 2;
-		sample->loop_len =
-		    uint16_t_be2host(smp[i].loop_len) * 2;
-		if (sample->loop_len <= 2)
-			sample->loop_type = tl_no_loop;
-		else
-			sample->loop_type = tl_forward_loop;
-
-		/* Finetune is a 4-bit signed value. */
-		ftval = smp[i].finetune & 0x0f;
-		sample->finetune =
-		    (ftval & 0x8) ? (ftval & 0x7) - 8 : ftval;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Load protracker module.
- *
- * @param fname   File name
- * @param rmodule Place to store pointer to newly loaded module.
- * @return        EOK on success, ENONEM if out of memory, EIO on I/O error
- *                or if any error is found in the format of the file.
- */
-errno_t trackmod_protracker_load(char *fname, trackmod_module_t **rmodule)
-{
-	FILE *f = NULL;
-	trackmod_module_t *module = NULL;
-	protracker_31smp_t mod31;
-	protracker_15smp_t mod15;
-	protracker_order_list_t *order_list;
-	protracker_smp_t *sample;
-	size_t samples;
-	size_t channels;
-	size_t patterns;
-	size_t i;
-	size_t nread;
-	errno_t rc;
-
-	f = fopen(fname, "rb");
-	if (f == NULL) {
-		printf("Error opening file.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	nread = fread(&mod31, 1, sizeof(protracker_31smp_t), f);
-	if (nread < sizeof(protracker_15smp_t)) {
-		printf("File too small.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	if (nread == sizeof(protracker_31smp_t)) {
-		/* Could be 31-sample variant */
-		rc = smp_tag_decode(mod31.sample_tag, &channels);
-		if (rc != EOK) {
-			samples = 15;
-			channels = 4;
-		} else {
-			samples = 31;
-		}
-	} else {
-		samples = 15;
-		channels = 4;
-	}
-
-	if (samples == 15) {
-		memcpy(&mod15, &mod31, sizeof(protracker_15smp_t));
-
-		if (fseek(f, sizeof(protracker_15smp_t), SEEK_SET) < 0) {
-			printf("Error seeking.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		order_list = &mod15.order_list;
-		sample = mod15.sample;
-	} else {
-		order_list = &mod31.order_list;
-		sample = mod31.sample;
-	}
-
-	patterns = order_list_get_npatterns(order_list);
-
-	module = trackmod_module_new();
-	if (module == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	module->channels = channels;
-
-	module->instrs = samples;
-	module->instr = calloc(samples, sizeof(trackmod_instr_t));
-	if (module->instr == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	module->patterns = patterns;
-	module->pattern = calloc(patterns, sizeof(trackmod_pattern_t));
-	if (module->pattern == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Order list */
-	module->ord_list_len = order_list->order_list_len;
-	module->ord_list = calloc(module->ord_list_len, sizeof(size_t));
-	if (module->ord_list == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < order_list->order_list_len; i++) {
-		module->ord_list[i] = order_list->order_list[i];
-	}
-
-	/* The 'mark' byte may or may not contain a valid restart position */
-	if (order_list->mark < order_list->order_list_len) {
-		module->restart_pos = order_list->mark;
-	}
-
-	/* Load patterns */
-	rc = protracker_load_patterns(f, module);
-	if (rc != EOK)
-		goto error;
-
-	/* Load samples */
-	rc = protracker_load_samples(f, sample, module);
-	if (rc != EOK)
-		goto error;
-
-	(void) fclose(f);
-
-	module->def_bpm = protracker_def_bpm;
-	module->def_tpr = protracker_def_tpr;
-
-	*rmodule = module;
-	return EOK;
-error:
-	if (module != NULL)
-		trackmod_module_destroy(module);
-	if (f != NULL)
-		(void) fclose(f);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/trackmod/protracker.h
===================================================================
--- uspace/lib/trackmod/protracker.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Protracker module (.mod).
- */
-
-#ifndef PROTRACKER_H
-#define PROTRACKER_H
-
-#include "types/trackmod.h"
-
-extern errno_t trackmod_protracker_load(char *, trackmod_module_t **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/trackmod/trackmod.c
===================================================================
--- uspace/lib/trackmod/trackmod.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1003 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Tracker module handling library.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "macros.h"
-#include "protracker.h"
-#include "trackmod.h"
-#include "xm.h"
-
-/** Tunables */
-enum {
-	amp_factor = 16
-};
-
-/** Standard definitions set in stone */
-enum {
-	/** Base sample clock */
-	base_clock = 8363 * 428,
-	/** Maximum sample volume */
-	vol_max = 64,
-	/** Minimum period */
-	period_min = 113,
-	/** Maxium period */
-	period_max = 856
-};
-
-/** Table for finetune computation.
- *
- * Finetune is a number ft in [-8 .. 7]. The pitch should be adjusted by
- * ft/8 semitones. To adjust pitch by 1/8 semitone down we can mutiply the
- * period by 2^(1/12/8) =. 1.0072, one semitone up: 2^-(1/12/8) =. 0.9928,
- * to adjust by ft/8 semitones, multiply by 2^(-ft/12/8).
- *
- * finetune_factor[ft] := 10000 * 2^(-ft/12/8)
- * res_period = clip(period * fineture_factor[ft+8] / 10000)
- */
-static unsigned finetune_factor[16] = {
-	10595, 10518, 10443, 10368, 10293, 10219, 10145, 10072,
-	10000,  9928,  9857,  9786,  9715,  9645,  9576,  9507
-};
-
-static unsigned period_table[12 * 8] = {
-	907, 900, 894, 887, 881, 875, 868, 862, 856, 850, 844, 838,
-	832, 826, 820, 814, 808, 802, 796, 791, 785, 779, 774, 768,
-	762, 757, 752, 746, 741, 736, 730, 725, 720, 715, 709, 704,
-	699, 694, 689, 684, 678, 675, 670, 665, 660, 655, 651, 646,
-	640, 636, 632, 628, 623, 619, 614, 610, 604, 601, 597, 592,
-	588, 584, 580, 575, 570, 567, 563, 559, 555, 551, 547, 543,
-	538, 535, 532, 528, 524, 520, 516, 513, 508, 505, 502, 498,
-	494, 491, 487, 484, 480, 477, 474, 470, 467, 463, 460, 457
-};
-
-static size_t trackmod_get_next_ord_idx(trackmod_modplay_t *);
-
-/** Destroy sample.
- *
- * @param sample Sample
- */
-static void trackmod_sample_destroy(trackmod_sample_t *sample)
-{
-	free(sample->data);
-}
-
-/** Destroy instrument.
- *
- * @param instr Intrument
- */
-static void trackmod_instr_destroy(trackmod_instr_t *instr)
-{
-	size_t i;
-
-	for (i = 0; i < instr->samples; i++)
-		trackmod_sample_destroy(&instr->sample[i]);
-}
-
-/** Destroy pattern.
- *
- * @param pattern Pattern
- */
-static void trackmod_pattern_destroy(trackmod_pattern_t *pattern)
-{
-	free(pattern->data);
-}
-
-/** Create new empty module structure.
- *
- * @return New module
- */
-trackmod_module_t *trackmod_module_new(void)
-{
-	return calloc(1, sizeof(trackmod_module_t));
-}
-
-/** Destroy module.
- *
- * @param module Module
- */
-void trackmod_module_destroy(trackmod_module_t *module)
-{
-	size_t i;
-
-	/* Destroy samples */
-	if (module->instr != NULL) {
-		for (i = 0; i < module->instrs; i++)
-			trackmod_instr_destroy(&module->instr[i]);
-		free(module->instr);
-	}
-
-	/* Destroy patterns */
-	if (module->pattern != NULL) {
-		for (i = 0; i < module->patterns; i++)
-			trackmod_pattern_destroy(&module->pattern[i]);
-		free(module->pattern);
-	}
-
-	free(module->ord_list);
-	free(module);
-}
-
-errno_t trackmod_module_load(char *fname, trackmod_module_t **rmodule)
-{
-	errno_t rc;
-
-	rc = trackmod_xm_load(fname, rmodule);
-	if (rc == EOK)
-		return EOK;
-
-	rc = trackmod_protracker_load(fname, rmodule);
-	return rc;
-}
-
-/** Return current pattern.
- *
- * @param modplay Module playback
- * @return        Pattern
- */
-static trackmod_pattern_t *trackmod_cur_pattern(trackmod_modplay_t *modplay)
-{
-	unsigned pat_idx;
-
-	pat_idx = modplay->module->ord_list[modplay->ord_idx];
-	return &modplay->module->pattern[pat_idx];
-}
-
-/** Decode pattern cell.
- *
- * @param pattern Pattern
- * @param row     Row number
- * @param channel Channel number
- * @param cell    Place to store decoded cell
- */
-static void trackmod_pattern_get_cell(trackmod_pattern_t *pattern,
-    size_t row, size_t channel, trackmod_cell_t *cell)
-{
-	*cell = pattern->data[row * pattern->channels + channel];
-}
-
-/** Compute floor(a / b), and the remainder.
- *
- * Unlike standard integer division this rounds towars negative infinity,
- * not towards zero.
- *
- * @param a Dividend
- * @param b Divisor
- * @param quot Place to store 'quotient' (floor (a/b))
- * @param rem Place to store 'remainder' (a - floor(a/b) * b)
- */
-static void divmod_floor(int a, int b, int *quot, int *rem)
-{
-	if (b < 0) {
-		a = -a;
-		b = -b;
-	}
-
-	if (a >= 0) {
-		*quot = a / b;
-		*rem = a % b;
-	} else {
-		*quot = -(-a + (b - 1)) / b;
-		*rem = a - (*quot * b);
-	}
-}
-
-/** Process note (period)
- *
- * @param modplay Module playback
- * @param i       Channel number
- * @param cell    Cell
- */
-static void trackmod_process_note(trackmod_modplay_t *modplay, size_t i,
-    trackmod_cell_t *cell)
-{
-	trackmod_chan_t *chan = &modplay->chan[i];
-	int period;
-	int pitch;
-	int octave;
-	int opitch;
-
-	if (chan->sample == NULL)
-		return;
-
-	if (cell->period == 0) {
-		pitch = 8 * (cell->note + chan->sample->rel_note) +
-		    chan->sample->finetune;
-		divmod_floor(pitch, 8 * 12, &octave, &opitch);
-
-		if (octave >= 0)
-			period = period_table[opitch] * 8 / (1 << octave);
-		else
-			period = period_table[opitch] * 8 * (1 << (-octave));
-	} else {
-		period = cell->period;
-		period = period *
-		    finetune_factor[chan->sample->finetune + 8] / 10000;
-		if (period > period_max)
-			period = period_max;
-		if (period < period_min)
-			period = period_min;
-	}
-
-	chan->period_new = period;
-}
-
-/** Process instrument number (this is what triggers the note playback)
- *
- * @param modplay Module playback
- * @param i       Channel number
- * @param cell    Cell
- */
-static void trackmod_process_instr(trackmod_modplay_t *modplay, size_t i,
-    trackmod_cell_t *cell)
-{
-	trackmod_chan_t *chan = &modplay->chan[i];
-	trackmod_instr_t *instr;
-	size_t iidx;
-	size_t sidx;
-
-	if (cell->instr == 0)
-		return;
-
-	iidx = (cell->instr - 1) % modplay->module->instrs;
-	instr = &modplay->module->instr[iidx];
-	sidx = instr->key_smp[cell->note] % instr->samples;
-	chan->sample = &instr->sample[sidx];
-	chan->smp_pos = 0;
-	chan->lsmp = 0;
-
-	chan->volume = modplay->chan[i].sample->def_vol;
-}
-
-/** Process keyoff note
- *
- * @param modplay Module playback
- * @param i       Channel number
- * @param cell    Cell
- */
-static void trackmod_process_keyoff_note(trackmod_modplay_t *modplay, size_t i)
-{
-	trackmod_chan_t *chan = &modplay->chan[i];
-
-	chan->sample = NULL;
-	chan->period = 0;
-	chan->smp_pos = 0;
-	chan->lsmp = 0;
-}
-
-/** Process Set volume effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_set_volume(trackmod_modplay_t *modplay, size_t chan,
-    uint8_t param)
-{
-	modplay->chan[chan].volume = param % (vol_max + 1);
-}
-
-/** Process Pattern break effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_pattern_break(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	size_t next_idx;
-	trackmod_pattern_t *next_pat;
-	unsigned row;
-
-	/* Strangely the parameter is BCD */
-	row = (param >> 4) * 10 + (param & 0xf);
-
-	next_idx = trackmod_get_next_ord_idx(modplay);
-	next_pat = &modplay->module->pattern[next_idx];
-
-	modplay->pat_break = true;
-	modplay->pat_break_row = row % next_pat->rows;
-}
-
-/** Process Set speed effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_set_speed(trackmod_modplay_t *modplay, size_t chan,
-    uint8_t param)
-{
-	if (param > 0 && param < 32)
-		modplay->tpr = param;
-	else if (param > 0)
-		modplay->bpm = param;
-}
-
-/** Process Fine volume slide down effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_fine_vol_slide_down(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	int nv;
-
-	nv = modplay->chan[chan].volume - param;
-	if (nv < 0)
-		nv = 0;
-	modplay->chan[chan].volume = nv;
-}
-
-/** Process Fine volume slide up effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_fine_vol_slide_up(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	int nv;
-
-	nv = modplay->chan[chan].volume + param;
-	if (nv > vol_max)
-		nv = vol_max;
-	modplay->chan[chan].volume = nv;
-}
-
-/** Process Volume slide effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_vol_slide(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	if ((param & 0xf0) != 0)
-		modplay->chan[chan].vol_slide = param >> 4;
-	else
-		modplay->chan[chan].vol_slide = -(int)(param & 0xf);
-}
-
-/** Process Volume slide down effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_vol_slide_down(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param4)
-{
-	modplay->chan[chan].vol_slide = -(int)param4;
-}
-
-/** Process Volume slide up effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_vol_slide_up(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param4)
-{
-	modplay->chan[chan].vol_slide = param4;
-}
-
-/** Process Fine portamento down effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_fine_porta_down(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	int np;
-
-	np = modplay->chan[chan].period + param;
-	if (np > period_max)
-		np = period_max;
-	modplay->chan[chan].period = np;
-}
-
-/** Process Fine portamento up effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_fine_porta_up(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	int np;
-
-	np = modplay->chan[chan].period - param;
-	if (np < period_min)
-		np = period_min;
-	modplay->chan[chan].period = np;
-}
-
-/** Process Portamento down effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_porta_down(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	modplay->chan[chan].portamento = -(int)param;
-}
-
-/** Process Portamento up effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_porta_up(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	modplay->chan[chan].portamento = param;
-}
-
-/** Process Tone portamento effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param param   Effect parameter
- */
-static void trackmod_effect_tone_porta(trackmod_modplay_t *modplay,
-    size_t chan, uint8_t param)
-{
-	/* Set up tone portamento effect */
-	modplay->chan[chan].portamento = param;
-	if (modplay->chan[chan].period_new != 0)
-		modplay->chan[chan].period_tgt = modplay->chan[chan].period_new;
-
-	/* Prevent going directly to new period */
-	modplay->chan[chan].period_new = 0;
-}
-
-/** Process volume column.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param cell    Cell
- */
-static void trackmod_process_volume(trackmod_modplay_t *modplay, size_t chan,
-    trackmod_cell_t *cell)
-{
-	uint8_t param4;
-
-	if (cell->volume >= 0x10 && cell->volume <= 0x10 + vol_max)
-		trackmod_effect_set_volume(modplay, chan, cell->volume - 0x10);
-
-	param4 = cell->volume & 0xf;
-
-	switch (cell->volume & 0xf0) {
-	case 0x60:
-		trackmod_effect_vol_slide_down(modplay, chan, param4);
-		break;
-	case 0x70:
-		trackmod_effect_vol_slide_up(modplay, chan, param4);
-		break;
-	case 0x80:
-		trackmod_effect_fine_vol_slide_down(modplay, chan, param4);
-		break;
-	case 0x90:
-		trackmod_effect_fine_vol_slide_up(modplay, chan, param4);
-		break;
-	case 0xf0:
-		trackmod_effect_tone_porta(modplay, chan, param4 << 4);
-		break;
-	default:
-		break;
-	}
-}
-
-/** Process effect.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param cell    Cell
- */
-static void trackmod_process_effect(trackmod_modplay_t *modplay, size_t chan,
-    trackmod_cell_t *cell)
-{
-	uint8_t param8;
-	uint8_t param4;
-
-	param8 = cell->effect & 0xff;
-
-	switch (cell->effect & 0xf00) {
-	case 0x100:
-		trackmod_effect_porta_up(modplay, chan, param8);
-		break;
-	case 0x200:
-		trackmod_effect_porta_down(modplay, chan, param8);
-		break;
-	case 0x300:
-		trackmod_effect_tone_porta(modplay, chan, param8);
-		break;
-	case 0xa00:
-		trackmod_effect_vol_slide(modplay, chan, param8);
-		break;
-	case 0xc00:
-		trackmod_effect_set_volume(modplay, chan, param8);
-		break;
-	case 0xd00:
-		trackmod_effect_pattern_break(modplay, chan, param8);
-		break;
-	case 0xf00:
-		trackmod_effect_set_speed(modplay, chan, param8);
-		break;
-	default:
-		break;
-	}
-
-	param4 = cell->effect & 0xf;
-
-	switch (cell->effect & 0xff0) {
-	case 0xe10:
-		trackmod_effect_fine_porta_up(modplay, chan, param4);
-		break;
-	case 0xe20:
-		trackmod_effect_fine_porta_down(modplay, chan, param4);
-		break;
-	case 0xea0:
-		trackmod_effect_fine_vol_slide_up(modplay, chan, param4);
-		break;
-	case 0xeb0:
-		trackmod_effect_fine_vol_slide_down(modplay, chan, param4);
-		break;
-	}
-}
-
-/** Process pattern cell.
- *
- * @param modplay Module playback
- * @param chan    Channel number
- * @param cell    Cell
- */
-static void trackmod_process_cell(trackmod_modplay_t *modplay, size_t chan,
-    trackmod_cell_t *cell)
-{
-	modplay->chan[chan].period_new = 0;
-
-	trackmod_process_instr(modplay, chan, cell);
-
-	if (cell->period != 0 || (cell->note != 0 && cell->note != keyoff_note)) {
-		trackmod_process_note(modplay, chan, cell);
-	} else if (cell->note == keyoff_note && cell->instr == 0) {
-		trackmod_process_keyoff_note(modplay, chan);
-	}
-
-	trackmod_process_volume(modplay, chan, cell);
-	trackmod_process_effect(modplay, chan, cell);
-
-	if (modplay->chan[chan].period_new != 0)
-		modplay->chan[chan].period = modplay->chan[chan].period_new;
-}
-
-/** Process pattern row.
- *
- * @param modplay Module playback
- */
-static void trackmod_process_row(trackmod_modplay_t *modplay)
-{
-	trackmod_pattern_t *pattern;
-	trackmod_cell_t cell;
-	size_t i;
-
-	pattern = trackmod_cur_pattern(modplay);
-
-	if (modplay->debug)
-		printf("%02zx: ", modplay->row);
-
-	for (i = 0; i < modplay->module->channels; i++) {
-		trackmod_pattern_get_cell(pattern, modplay->row, i, &cell);
-
-		if (modplay->debug) {
-			printf("%4d %02x %02x %03x |", cell.period ?
-			    cell.period : cell.note, cell.instr,
-			    cell.volume, cell.effect);
-		}
-
-		trackmod_process_cell(modplay, i, &cell);
-	}
-
-	if (modplay->debug)
-		printf("\n");
-}
-
-/** Get next order list index.
- *
- * @param modplay Module playback
- * @return        Next order list index
- */
-static size_t trackmod_get_next_ord_idx(trackmod_modplay_t *modplay)
-{
-	size_t ord_idx;
-
-	ord_idx = modplay->ord_idx + 1;
-	if (ord_idx >= modplay->module->ord_list_len)
-		ord_idx = modplay->module->restart_pos;
-
-	return ord_idx;
-}
-
-/** Advance to next pattern.
- *
- * @param modplay Module playback
- */
-static void trackmod_next_pattern(trackmod_modplay_t *modplay)
-{
-	if (modplay->debug)
-		printf("Next pattern\n");
-
-	modplay->row = 0;
-	modplay->ord_idx = trackmod_get_next_ord_idx(modplay);
-
-	/* If we are doing a pattern break */
-	if (modplay->pat_break) {
-		modplay->row = modplay->pat_break_row;
-		modplay->pat_break = false;
-	}
-}
-
-/** Clear effects at end of row. */
-static void trackmod_clear_effects(trackmod_modplay_t *modplay)
-{
-	size_t i;
-
-	for (i = 0; i < modplay->module->channels; i++) {
-		modplay->chan[i].vol_slide = 0;
-		modplay->chan[i].portamento = 0;
-	}
-}
-
-/** Process effects at beginning of tick. */
-static void trackmod_process_tick(trackmod_modplay_t *modplay)
-{
-	trackmod_chan_t *chan;
-	size_t i;
-	int nv;
-	int np;
-
-	for (i = 0; i < modplay->module->channels; i++) {
-		chan = &modplay->chan[i];
-
-		/* Volume slides */
-		nv = (int)chan->volume + chan->vol_slide;
-		if (nv < 0)
-			nv = 0;
-		if (nv > vol_max)
-			nv = vol_max;
-
-		chan->volume = nv;
-
-		/* Portamentos */
-		if (chan->period_tgt == 0) {
-			/* Up or down portamento */
-			np = (int)chan->period - chan->portamento;
-		} else {
-			/* Tone portamento */
-			if (chan->period_tgt < chan->period)
-				np = max((int)chan->period_tgt, (int)chan->period - chan->portamento);
-			else
-				np = min((int)chan->period_tgt, (int)chan->period + chan->portamento);
-		}
-
-#if 0
-		/* XXX */
-		if (np < period_min)
-			np = period_min;
-		if (np > period_max)
-			np = period_max;
-#endif
-		modplay->chan[i].period = np;
-	}
-}
-
-/** Advance to next row.
- *
- * @param modplay Module playback
- */
-static void trackmod_next_row(trackmod_modplay_t *modplay)
-{
-	trackmod_pattern_t *pattern;
-
-	/* Clear effect state at end of row */
-	trackmod_clear_effects(modplay);
-
-	pattern = trackmod_cur_pattern(modplay);
-
-	modplay->tick = 0;
-	++modplay->row;
-	if (modplay->row >= pattern->rows || modplay->pat_break)
-		trackmod_next_pattern(modplay);
-
-	trackmod_process_tick(modplay);
-	trackmod_process_row(modplay);
-}
-
-/** Advance to next tick.
- *
- * @param modplay Module playback
- */
-static void trackmod_next_tick(trackmod_modplay_t *modplay)
-{
-	modplay->smp = 0;
-	++modplay->tick;
-	if (modplay->tick >= modplay->tpr)
-		trackmod_next_row(modplay);
-	else
-		trackmod_process_tick(modplay);
-}
-
-/** Create module playback object.
- *
- * @param module   Module
- * @param smp_freq Sampling frequency
- * @param rmodplay Place to store pointer to module playback object
- */
-errno_t trackmod_modplay_create(trackmod_module_t *module,
-    unsigned smp_freq, trackmod_modplay_t **rmodplay)
-{
-	trackmod_modplay_t *modplay = NULL;
-
-	modplay = calloc(1, sizeof(trackmod_modplay_t));
-	if (modplay == NULL)
-		goto error;
-
-	modplay->module = module;
-	modplay->smp_freq = smp_freq;
-	modplay->frame_size = sizeof(int16_t);
-	modplay->ord_idx = 0;
-	modplay->row = 0;
-	modplay->tick = 0;
-	modplay->smp = 0;
-
-	modplay->tpr = module->def_tpr;
-	modplay->bpm = module->def_bpm;
-
-	modplay->chan = calloc(module->channels,
-	    sizeof(trackmod_chan_t));
-	if (modplay->chan == NULL)
-		goto error;
-
-	trackmod_process_tick(modplay);
-	trackmod_process_row(modplay);
-
-	*rmodplay = modplay;
-	return EOK;
-error:
-	if (modplay != NULL)
-		free(modplay->chan);
-	free(modplay);
-	return ENOMEM;
-}
-
-/** Destroy module playback object.
- *
- * @param modplay Module playback
- */
-void trackmod_modplay_destroy(trackmod_modplay_t *modplay)
-{
-	free(modplay->chan);
-	free(modplay);
-}
-
-/** Get number of samples per tick.
- *
- * @param modplay Module playback
- * @return        Number of samples per tick
- */
-static size_t samples_per_tick(trackmod_modplay_t *modplay)
-{
-	return modplay->smp_freq * 10 / 4 / modplay->bpm;
-}
-
-/** Get number of samples remaining in current tick.
- *
- * @param modplay Module playback
- * @return        Number of remaining samples in tick
- */
-static size_t samples_remain_tick(trackmod_modplay_t *modplay)
-{
-	/* XXX Integer samples per tick is a simplification */
-	return samples_per_tick(modplay) - modplay->smp;
-}
-
-/** Get sample frame.
- *
- * Get frame at the specified sample position.
- *
- * @param sample Sample
- * @param pos	 Position (frame index)
- * @return	 Frame value
- */
-int trackmod_sample_get_frame(trackmod_sample_t *sample, size_t pos)
-{
-	int8_t *i8p;
-	int16_t *i16p;
-
-	if (sample->bytes_smp == 1) {
-		i8p = (int8_t *)sample->data;
-		return i8p[pos];
-	} else {
-		/* chan->sample->bytes_smp == 2 */
-		i16p = (int16_t *)sample->data;
-		return i16p[pos] / 256; /* XXX Retain full precision */
-	}
-}
-
-/** Advance sample position to next frame.
- *
- * @param chan Channel playback
- */
-static void chan_smp_next_frame(trackmod_chan_t *chan)
-{
-	chan->lsmp = trackmod_sample_get_frame(chan->sample, chan->smp_pos);
-	++chan->smp_pos;
-
-	switch (chan->sample->loop_type) {
-	case tl_pingpong_loop:
-		/** XXX Pingpong loop */
-	case tl_no_loop:
-		/* No loop */
-		if (chan->smp_pos >= chan->sample->length) {
-			chan->sample = NULL;
-			chan->smp_pos = 0;
-		}
-		break;
-	case tl_forward_loop:
-		/** Forward loop */
-		if (chan->smp_pos >= chan->sample->loop_start +
-		    chan->sample->loop_len) {
-			chan->smp_pos = chan->sample->loop_start;
-		}
-	}
-}
-
-/** Render next sample on channel.
- *
- * @param modplay Module playback
- * @param cidx    Channel number
- * @return        Sample value
- */
-static int trackmod_chan_next_sample(trackmod_modplay_t *modplay,
-    size_t cidx)
-{
-	int sl, sn;
-	int period, clk;
-	int s;
-
-	trackmod_chan_t *chan = &modplay->chan[cidx];
-
-	if (chan->sample == NULL || chan->period == 0)
-		return 0;
-
-	/*
-	 * Linear interpolation. Note this is slightly simplified:
-	 * We ignore the half-sample offset and the boundary condition
-	 * at the end of the sample (we should extend with zero).
-	 */
-	sl = (int)chan->lsmp * amp_factor * chan->volume / vol_max;
-	sn = (int)trackmod_sample_get_frame(chan->sample, chan->smp_pos) *
-	    amp_factor * chan->volume / vol_max;
-
-	period = (int)chan->period;
-	clk = (int)chan->smp_clk;
-
-	s = (sl * (period - clk) + sn * clk) / period;
-
-	chan->smp_clk += base_clock / modplay->smp_freq;
-	while (chan->sample != NULL && chan->smp_clk >= chan->period) {
-		chan->smp_clk -= chan->period;
-		chan_smp_next_frame(chan);
-	}
-
-	return s;
-}
-
-/** Render a segment of samples contained entirely within a tick.
- *
- * @param modplay Module playback
- * @param buffer  Buffer for storing audio data
- * @param bufsize Size of @a buffer in bytes
- */
-static void get_samples_within_tick(trackmod_modplay_t *modplay,
-    void *buffer, size_t bufsize)
-{
-	size_t nsamples;
-	size_t smpidx;
-	size_t chan;
-	int s;
-
-	nsamples = bufsize / modplay->frame_size;
-
-	for (smpidx = 0; smpidx < nsamples; smpidx++) {
-		s = 0;
-		for (chan = 0; chan < modplay->module->channels; chan++) {
-			s += trackmod_chan_next_sample(modplay, chan);
-		}
-
-		((int16_t *)buffer)[smpidx] = s;
-	}
-
-	modplay->smp += nsamples;
-}
-
-/** Render a segment of samples.
- *
- * @param modplay Module playback
- * @param buffer  Buffer for storing audio data
- * @param bufsize Size of @a buffer in bytes
- */
-void trackmod_modplay_get_samples(trackmod_modplay_t *modplay,
-    void *buffer, size_t bufsize)
-{
-	size_t nsamples;
-	size_t rsmp;
-	size_t now;
-
-	nsamples = bufsize / modplay->frame_size;
-	while (nsamples > 0) {
-		rsmp = samples_remain_tick(modplay);
-		if (rsmp == 0)
-			trackmod_next_tick(modplay);
-
-		rsmp = samples_remain_tick(modplay);
-		now = min(rsmp, nsamples);
-
-		get_samples_within_tick(modplay, buffer,
-		    now * modplay->frame_size);
-		nsamples -= now;
-		buffer += now * modplay->frame_size;
-	}
-}
-
-/** @}
- */
Index: pace/lib/trackmod/trackmod.h
===================================================================
--- uspace/lib/trackmod/trackmod.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Tracker module handling library.
- */
-
-#ifndef TRACKMOD_H
-#define TRACKMOD_H
-
-#include "types/trackmod.h"
-
-extern trackmod_module_t *trackmod_module_new(void);
-extern errno_t trackmod_module_load(char *, trackmod_module_t **);
-extern void trackmod_module_destroy(trackmod_module_t *);
-extern errno_t trackmod_modplay_create(trackmod_module_t *, unsigned,
-    trackmod_modplay_t **);
-extern void trackmod_modplay_destroy(trackmod_modplay_t *);
-extern void trackmod_modplay_get_samples(trackmod_modplay_t *, void *, size_t);
-extern int trackmod_sample_get_frame(trackmod_sample_t *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/trackmod/types/protracker.h
===================================================================
--- uspace/lib/trackmod/types/protracker.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Protracker module (.mod) types.
- */
-
-#ifndef TYPES_PROTRACKER_H
-#define TYPES_PROTRACKER_H
-
-#include <stdint.h>
-
-enum {
-	/** Module name size */
-	protracker_mod_name_size = 20,
-	/** Sample name size */
-	protracker_smp_name_size = 22,
-	/** Order list max length */
-	protracker_olist_len = 128,
-	/** Number of rows in a pattern */
-	protracker_pattern_rows = 64,
-	/** Default TPR */
-	protracker_def_tpr = 6,
-	/** Default BPM */
-	protracker_def_bpm = 125
-};
-
-/** Protracker initial header. */
-typedef struct {
-	/** Module name */
-	uint8_t name[protracker_mod_name_size];
-} protracker_hdr_t;
-
-/** Protracker sample header. */
-typedef struct {
-	/** Sample name, padded with zeros */
-	uint8_t name[protracker_smp_name_size];
-	/** Sample length in words */
-	uint16_t length;
-	/** Finetune value */
-	uint8_t finetune;
-	/** Default volume */
-	uint8_t def_vol;
-	/** Loop start in words */
-	uint16_t loop_start;
-	/** Loop length in words */
-	uint16_t loop_len;
-} protracker_smp_t;
-
-/** Protracker order list. */
-typedef struct {
-	/** Number of used entries */
-	uint8_t order_list_len;
-	uint8_t mark;
-	/** Order list */
-	uint8_t order_list[protracker_olist_len];
-} protracker_order_list_t;
-
-/** Protracker 15-sample variant headers. */
-typedef struct {
-	/** Initial header */
-	protracker_hdr_t hdr;
-	/** Sample headers. */
-	protracker_smp_t sample[15];
-	/** Order list. */
-	protracker_order_list_t order_list;
-} protracker_15smp_t;
-
-/** Protracker 31-sample variant headers. */
-typedef struct {
-	/** Initial header */
-	protracker_hdr_t hdr;
-	/** Sample headers. */
-	protracker_smp_t sample[31];
-	/** Order list. */
-	protracker_order_list_t order_list;
-	/** Sample tag. */
-	uint8_t sample_tag[4];
-} protracker_31smp_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/trackmod/types/trackmod.h
===================================================================
--- uspace/lib/trackmod/types/trackmod.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Tracker module handling library types.
- */
-
-#ifndef TYPES_TRACKMOD_H
-#define TYPES_TRACKMOD_H
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-enum {
-	max_key = 96,
-	keyoff_note = 97
-};
-
-typedef enum {
-	/** No loop */
-	tl_no_loop,
-	/** Forward loop */
-	tl_forward_loop,
-	/** Pingpong loop */
-	tl_pingpong_loop
-} trackmod_looptype_t;
-
-/** Sample */
-typedef struct {
-	/** Length in frames */
-	size_t length;
-	/** Bytes per sample */
-	size_t bytes_smp;
-	/** Sample data */
-	void *data;
-	/** Loop type */
-	trackmod_looptype_t loop_type;
-	/** Loop start position in frames */
-	size_t loop_start;
-	/** Loop length in frames (> 0) */
-	size_t loop_len;
-	/** Default volume (0..63) */
-	uint8_t def_vol;
-	/** Relative note */
-	int rel_note;
-	/** Finetune value (-8..7) in 1/8 semitones */
-	int finetune;
-} trackmod_sample_t;
-
-/** Instrument */
-typedef struct {
-	/** Number of samples */
-	size_t samples;
-	/** Samples */
-	trackmod_sample_t *sample;
-	/** Sample index for each key */
-	int key_smp[max_key];
-} trackmod_instr_t;
-
-/** Pattern cell */
-typedef struct {
-	/** Note */
-	unsigned note;
-	/** Sample period */
-	unsigned period;
-	/** Instrument number */
-	unsigned instr;
-	/** Volume */
-	uint8_t volume;
-	/** Effect */
-	uint16_t effect;
-} trackmod_cell_t;
-
-/** Pattern */
-typedef struct {
-	/** Number of rows */
-	size_t rows;
-	/** Number of channels */
-	size_t channels;
-	/** Pattern data */
-	trackmod_cell_t *data;
-} trackmod_pattern_t;
-
-/** Module. */
-typedef struct {
-	/** Number of channels */
-	size_t channels;
-	/** Number of samples */
-	size_t instrs;
-	/** Instruments */
-	trackmod_instr_t *instr;
-	/** Number of patterns */
-	size_t patterns;
-	/** Patterns */
-	trackmod_pattern_t *pattern;
-	/** Order list length */
-	size_t ord_list_len;
-	/** Order list */
-	size_t *ord_list;
-	/** Restart pos */
-	size_t restart_pos;
-	/** Default BPM */
-	unsigned def_bpm;
-	/** Default TPR */
-	unsigned def_tpr;
-} trackmod_module_t;
-
-/** Channel playback */
-typedef struct {
-	trackmod_sample_t *sample;
-	/** Value of sample before current position */
-	int8_t lsmp;
-	/** Sample position (in frames) */
-	size_t smp_pos;
-	/** Sample position (clock ticks within frame) */
-	size_t smp_clk;
-	/** Current period */
-	unsigned period;
-	/** Period after note was processed, zero if no note */
-	unsigned period_new;
-	/** Volume */
-	uint8_t volume;
-	/** Volume slide amount */
-	int vol_slide;
-	/** Portamento amount (positive for tone and up portamento,
-	 * negative for down portamento.
-	 */
-	int portamento;
-	/** Tone portamento target period. */
-	unsigned period_tgt;
-} trackmod_chan_t;
-
-/** Module playback. */
-typedef struct {
-	/** Module */
-	trackmod_module_t *module;
-	/** Sampling frequency */
-	unsigned smp_freq;
-	/** Frame size (bytes per sample * channels) */
-	size_t frame_size;
-
-	/** Current position, order list index */
-	size_t ord_idx;
-	/** Current position, row within pattern */
-	size_t row;
-	/** Current position, tick within row */
-	unsigned tick;
-	/** Current position, sample within tick */
-	unsigned smp;
-
-	/** Channel playback state */
-	trackmod_chan_t *chan;
-
-	/** BPM (beats per minute) */
-	unsigned bpm;
-	/** TPR (ticks per row) */
-	unsigned tpr;
-
-	/** If true, break from pattern at end of current row */
-	bool pat_break;
-	/** If @c pat_break is true, row number where to jump in next pattern */
-	size_t pat_break_row;
-	/** Debug mode, print messages to stdout. */
-	bool debug;
-} trackmod_modplay_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/trackmod/types/xm.h
===================================================================
--- uspace/lib/trackmod/types/xm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Extended Module (.xm) types.
- */
-
-#ifndef TYPES_XM_H
-#define TYPES_XM_H
-
-#include <stdint.h>
-
-enum {
-	/** ID text (signature) */
-	xm_id_text_size = 17,
-	/** Module name size */
-	xm_mod_name_size = 20,
-	/** Tracker name size */
-	xm_tracker_name_size = 20,
-	/** Pattern order table size */
-	xm_pat_ord_table_size = 256,
-	/** Instrument name size */
-	xm_instr_name_size = 22,
-	/** Sample number for all notes table size */
-	xm_smp_note_size = 96,
-	/** Max number of volume envelope points */
-	xm_vol_env_points = 48,
-	/** Max number of panning envelope points */
-	xm_pan_env_points = 48,
-	/** Sample name size */
-	xm_smp_name_size = 22,
-	/** Keyoff note number */
-	xm_keyoff_note = 97
-};
-
-/** XM file header */
-typedef struct {
-	uint8_t id_text[xm_id_text_size];
-	/** Module name */
-	uint8_t name[xm_mod_name_size];
-	/** Text EOF mark */
-	uint8_t text_break;
-	/** Tracker name */
-	uint8_t tracker_name[xm_tracker_name_size];
-	/** File format version */
-	uint16_t version;
-	/** Header size */
-	uint32_t hdr_size;
-	/** Song length (in pattern order table) */
-	uint16_t song_len;
-	/** Restart position */
-	uint16_t restart_pos;
-	/** Number of channels */
-	uint16_t channels;
-	/** Number of patterns */
-	uint16_t patterns;
-	/** Number of intstruments */
-	uint16_t instruments;
-	/** Flags */
-	uint16_t flags;
-	/** Default tempo */
-	uint16_t def_tempo;
-	/** Default BPM */
-	uint16_t def_bpm;
-	uint8_t pat_ord_table[xm_pat_ord_table_size];
-} __attribute__((packed)) xm_hdr_t;
-
-typedef enum {
-	/** 1 = Linear frequency table, 0 = Amiga freq. table */
-	xmf_lftable = 0
-} xm_flags_bits_t;
-
-/** XM pattern header */
-typedef struct {
-	/** Pattern header size */
-	uint32_t hdr_size;
-	/** Packing type */
-	uint8_t pack_type;
-	/** Number of rows */
-	uint16_t rows;
-	/** Packed pattern data size */
-	uint16_t data_size;
-} __attribute__((packed)) xm_pattern_t;
-
-/** XM instrument header. */
-typedef struct {
-	/** Instrument size */
-	uint32_t size;
-	/** Instrument name */
-	uint8_t name[xm_instr_name_size];
-	/** Instrument type */
-	uint8_t instr_type;
-	/** Number of samples in instrument */
-	uint16_t samples;
-} __attribute__((packed)) xm_instr_t;
-
-/** XM additional instrument header if number of samples > 0 */
-typedef struct {
-	/** Sample header size */
-	uint32_t smp_hdr_size;
-	/** Sample number for all notes */
-	uint8_t smp_note[xm_smp_note_size];
-	/** Points for volume envelope */
-	uint8_t vol_point[xm_vol_env_points];
-	/** Points for panning envelope */
-	uint8_t pan_point[xm_pan_env_points];
-	/** Number of volume points */
-	uint8_t vol_points;
-	/** Number of panning points */
-	uint8_t pan_points;
-	/** Volume sustating point */
-	uint8_t vol_sustain;
-	/** Volume loop start point */
-	uint8_t vol_loop_start;
-	/** Volume loop end point */
-	uint8_t vol_loop_end;
-	/** Panning sustating point */
-	uint8_t pan_sustain;
-	/** Panning loop start point */
-	uint8_t pan_loop_start;
-	/** Panning loop end point */
-	uint8_t pan_loop_end;
-	/** Volume type */
-	uint8_t vol_type;
-	/** Panning type */
-	uint8_t pan_type;
-	/** Vibrato type */
-	uint8_t vibrato_type;
-	/** Vibrato sweep */
-	uint8_t vibrato_sweep;
-	/** Vibrato depth */
-	uint8_t vibrato_depth;
-	/** Vibrato rate */
-	uint8_t vibrato_rate;
-	/** Volume fadeout */
-	uint16_t vol_fadeout;
-	/** Reserved */
-	uint16_t res241;
-} __attribute__((packed)) xm_instr_ext_t;
-
-/** XM sample header */
-typedef struct {
-	/** Sample length */
-	uint32_t length;
-	/** Loop start */
-	uint32_t loop_start;
-	/** Loop length */
-	uint32_t loop_len;
-	/** Volume */
-	uint8_t volume;
-	/** Finetune */
-	int8_t finetune;
-	/** Sample type */
-	uint8_t smp_type;
-	/** Panning */
-	uint8_t panning;
-	/** Relative note number */
-	int8_t rel_note;
-	/** Reserved */
-	uint8_t res17;
-	/** Sample name */
-	uint8_t name[xm_smp_name_size];
-} __attribute__((packed)) xm_smp_t;
-
-/** XM sample type bits */
-typedef enum {
-	/** 16-bit sample data */
-	xmst_16_bit = 4,
-	/** Loop type (H) */
-	xmst_loop_type_h = 1,
-	/** Loop type (L) */
-	xmst_loop_type_l = 0
-} xm_smp_type_bits_t;
-
-/** Sample loop type */
-typedef enum {
-	/** No loop */
-	xmsl_no_loop = 0,
-	/** Forward loop */
-	xmsl_forward_loop = 1,
-	/** Ping-pong loop */
-	xmsl_pingpong_loop = 2
-} xm_smp_loop_type;
-
-#endif
-
-/** @}
- */
Index: pace/lib/trackmod/xm.c
===================================================================
--- uspace/lib/trackmod/xm.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,500 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Extended Module (.xm).
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <types/common.h>
-
-#include "byteorder.h"
-#include "xm.h"
-#include "trackmod.h"
-#include "types/xm.h"
-
-static char xm_id_text[] = "Extended Module: ";
-
-/** Load XM order list
- *
- * @param xm_hdr XM header
- * @param module Module
- * @return EOK on success, EIO on format error, ENOMEM if out of memory.
- */
-static errno_t trackmod_xm_load_order_list(xm_hdr_t *xm_hdr, trackmod_module_t *module)
-{
-	errno_t rc;
-	size_t i;
-
-	/* Order list */
-	module->ord_list_len = uint16_t_le2host(xm_hdr->song_len);
-	if (module->ord_list_len > xm_pat_ord_table_size) {
-		/* Invalid song length */
-		rc = EIO;
-		goto error;
-	}
-
-	module->ord_list = calloc(module->ord_list_len, sizeof(size_t));
-	if (module->ord_list == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < module->ord_list_len; i++) {
-		module->ord_list[i] = xm_hdr->pat_ord_table[i];
-	}
-
-	module->restart_pos = uint16_t_le2host(xm_hdr->restart_pos);
-	if (module->restart_pos >= module->ord_list_len) {
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Decode XM pattern.
- *
- * @param data    Packed pattern data
- * @param pattern Pattern to load to
- * @return	  EOK on success, EINVAL if there is error in the coded data.
- */
-static errno_t trackmod_xm_decode_pattern(uint8_t *data, size_t dsize,
-    trackmod_pattern_t *pattern)
-{
-	size_t cells;
-	size_t i;
-	size_t si;
-	uint8_t mask;
-
-	cells = pattern->rows * pattern->channels;
-	si = 0;
-
-	for (i = 0; i < cells; i++) {
-		if (si >= dsize)
-			return EINVAL;
-
-		if ((data[si] & 0x80) != 0) {
-			mask = data[si++] & 0x1f;
-		} else {
-			mask = 0x1f;
-		}
-
-		/* Note */
-		if ((mask & 0x1) != 0) {
-			if (si >= dsize)
-				return EINVAL;
-			pattern->data[i].note = data[si++] & 0x7f;
-		}
-
-		/* Instrument */
-		if ((mask & 0x2) != 0) {
-			if (si >= dsize)
-				return EINVAL;
-			pattern->data[i].instr = data[si++];
-		}
-
-		/* Volume */
-		if ((mask & 0x4) != 0) {
-			if (si >= dsize)
-				return EINVAL;
-			pattern->data[i].volume = data[si++];
-		}
-
-		/* Effect type */
-		if ((mask & 0x8) != 0) {
-			if (si >= dsize)
-				return EINVAL;
-			pattern->data[i].effect = (unsigned)data[si++] << 8;
-		}
-
-		/* Effect parameter */
-		if ((mask & 0x10) != 0) {
-			if (si >= dsize)
-				return EINVAL;
-			pattern->data[i].effect |= data[si++];
-		}
-	}
-
-	/* Note: Ignoring any extra data */
-
-	return EOK;
-}
-
-/** Load XM patterns
- *
- * @param file File
- * @param module Module
- * @return EOK on success, EIO on format error, ENOMEM if out of memory.
- */
-static errno_t trackmod_xm_load_patterns(FILE *f, trackmod_module_t *module)
-{
-	size_t i;
-	size_t hdr_size;
-	uint8_t pack_type;
-	size_t rows;
-	size_t data_size;
-	ssize_t nread;
-	xm_pattern_t pattern;
-	uint8_t *buf = NULL;
-	long seek_amount;
-	errno_t rc;
-	int ret;
-
-	module->pattern = calloc(module->patterns, sizeof(trackmod_pattern_t));
-	if (module->pattern == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	for (i = 0; i < module->patterns; i++) {
-		ret = fread(&pattern, 1, sizeof(xm_pattern_t), f);
-		if (ret != sizeof(xm_pattern_t)) {
-			rc = EIO;
-			goto error;
-		}
-
-		hdr_size = (size_t)uint32_t_le2host(pattern.hdr_size);
-		pack_type = pattern.pack_type;
-		rows = uint16_t_le2host(pattern.rows);
-		data_size = uint16_t_le2host(pattern.data_size);
-
-		if (pack_type != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		/* Jump to end of pattern header */
-		seek_amount = (long)hdr_size - (long)sizeof(xm_pattern_t);
-		if (fseek(f, seek_amount, SEEK_CUR) < 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		module->pattern[i].rows = rows;
-		module->pattern[i].channels = module->channels;
-		module->pattern[i].data = calloc(rows * module->channels,
-		    sizeof(trackmod_cell_t));
-
-		if (module->pattern[i].data == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		buf = calloc(1, data_size);
-		if (buf == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		nread = fread(buf, 1, data_size, f);
-		if (nread != (ssize_t)data_size) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = trackmod_xm_decode_pattern(buf, data_size,
-		    &module->pattern[i]);
-		if (rc != EOK)
-			goto error;
-
-		free(buf);
-		buf = NULL;
-	}
-
-	return EOK;
-error:
-	free(buf);
-	return rc;
-}
-
-/** Decode XM sample data.
- *
- * XM sample data is delta-encoded. Undo the delta encoding and convert
- * byte order.
- */
-static void trackmod_xm_decode_sample_data(trackmod_sample_t *sample)
-{
-	size_t i;
-	int8_t *i8p;
-	int16_t *i16p;
-	int8_t cur8;
-	int16_t cur16;
-
-	if (sample->bytes_smp == 1) {
-		cur8 = 0;
-		i8p = (int8_t *)sample->data;
-
-		for (i = 0; i < sample->length; i++) {
-			cur8 = cur8 + i8p[i];
-			i8p[i] = cur8;
-		}
-	} else {
-		cur16 = 0;
-		i16p = (int16_t *)sample->data;
-
-		for (i = 0; i < sample->length; i++) {
-			cur16 = cur16 + (int16_t)uint16_t_le2host(i16p[i]);
-			i16p[i] = cur16;
-		}
-	}
-}
-
-/** Load XM instruments
- *
- * @param file File
- * @param module Module
- * @return EOK on success, EIO on format error, ENOMEM if out of memory.
- */
-static errno_t trackmod_xm_load_instruments(xm_hdr_t *xm_hdr, FILE *f,
-    trackmod_module_t *module)
-{
-	size_t i, j;
-	xm_instr_t instr;
-	xm_instr_ext_t instrx;
-	xm_smp_t smp;
-	size_t samples;
-	size_t instr_size;
-	size_t smp_size;
-	size_t smp_hdr_size = 0;  /* GCC false alarm on uninitialized */
-	ssize_t nread;
-	uint8_t ltype;
-	trackmod_sample_t *sample;
-	void *smp_data;
-	long pos;
-	errno_t rc;
-	int ret;
-
-	module->instrs = uint16_t_le2host(xm_hdr->instruments);
-	module->instr = calloc(module->instrs, sizeof(trackmod_instr_t));
-	if (module->instr == NULL)
-		return ENOMEM;
-
-	for (i = 0; i < module->instrs; i++) {
-		pos = ftell(f);
-		ret = fread(&instr, 1, sizeof(xm_instr_t), f);
-		if (ret != sizeof(xm_instr_t)) {
-			rc = EIO;
-			goto error;
-		}
-
-		samples = uint16_t_le2host(instr.samples);
-		instr_size = (size_t)uint32_t_le2host(instr.size);
-
-		if (samples > 0) {
-			ret = fread(&instrx, 1, sizeof(xm_instr_ext_t), f);
-			if (ret != sizeof(xm_instr_ext_t)) {
-				rc = EIO;
-				goto error;
-			}
-
-			smp_hdr_size = uint32_t_le2host(instrx.smp_hdr_size);
-
-			for (j = 0; j < xm_smp_note_size; j++) {
-				module->instr[i].key_smp[j] =
-				    instrx.smp_note[j];
-			}
-
-			module->instr[i].samples = samples;
-			module->instr[i].sample = calloc(samples,
-			    sizeof(trackmod_sample_t));
-			if (module->instr[i].sample == NULL) {
-				rc = ENOMEM;
-				goto error;
-			}
-		}
-
-		if (fseek(f, pos + instr_size, SEEK_SET) < 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		for (j = 0; j < samples; j++) {
-			sample = &module->instr[i].sample[j];
-			pos = ftell(f);
-
-			ret = fread(&smp, 1, sizeof(xm_smp_t), f);
-			if (ret != sizeof(xm_smp_t)) {
-				rc = EIO;
-				goto error;
-			}
-
-			smp_size = (size_t)uint32_t_le2host(smp.length);
-
-			smp_data = calloc(smp_size, 1);
-			if (smp_data == NULL) {
-				rc = ENOMEM;
-				goto error;
-			}
-
-			if (fseek(f, pos + smp_hdr_size, SEEK_SET) < 0) {
-				rc = EIO;
-				goto error;
-			}
-
-			nread = fread(smp_data, 1, smp_size, f);
-			if (nread != (ssize_t)smp_size) {
-				rc = EIO;
-				goto error;
-			}
-
-			if (smp.smp_type & (1 << xmst_16_bit)) {
-				sample->bytes_smp = 2;
-			} else {
-				sample->bytes_smp = 1;
-			}
-
-			sample->data = smp_data;
-			sample->length = smp_size / sample->bytes_smp;
-
-			ltype = smp.smp_type & 0x3;
-			switch (ltype) {
-			case xmsl_no_loop:
-				sample->loop_type = tl_no_loop;
-				break;
-			case xmsl_forward_loop:
-				sample->loop_type = tl_forward_loop;
-				break;
-			case xmsl_pingpong_loop:
-				sample->loop_type = tl_pingpong_loop;
-				break;
-			default:
-				rc = EIO;
-				goto error;
-			}
-
-			sample->loop_start =
-			    uint32_t_le2host(smp.loop_start) / sample->bytes_smp;
-			sample->loop_len =
-			    uint32_t_le2host(smp.loop_len) / sample->bytes_smp;
-			sample->def_vol = 0x40;
-			sample->rel_note = smp.rel_note;
-			sample->finetune = smp.finetune / 2;
-
-			trackmod_xm_decode_sample_data(sample);
-		}
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Load extended module.
- *
- * @param fname   File name
- * @param rmodule Place to store pointer to newly loaded module.
- * @return        EOK on success, ENONEM if out of memory, EIO on I/O error
- *                or if any error is found in the format of the file.
- */
-errno_t trackmod_xm_load(char *fname, trackmod_module_t **rmodule)
-{
-	FILE *f = NULL;
-	trackmod_module_t *module = NULL;
-	xm_hdr_t xm_hdr;
-	size_t nread;
-	size_t hdr_size;
-	errno_t rc;
-
-	f = fopen(fname, "rb");
-	if (f == NULL) {
-		printf("Error opening file.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	nread = fread(&xm_hdr, 1, sizeof(xm_hdr_t), f);
-	if (nread < sizeof(xm_hdr_t)) {
-		printf("File too small.\n");
-		rc = EIO;
-		goto error;
-	}
-
-	if (memcmp(xm_hdr.id_text, xm_id_text, xm_id_text_size) != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	module = trackmod_module_new();
-	if (module == NULL) {
-		printf("Out of memory.\n");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	module->channels = uint16_t_le2host(xm_hdr.channels);
-	module->patterns = uint16_t_le2host(xm_hdr.patterns);
-	module->ord_list_len = uint16_t_le2host(xm_hdr.song_len);
-
-	hdr_size = (size_t)uint32_t_le2host(xm_hdr.hdr_size) +
-	    offsetof(xm_hdr_t, hdr_size);
-
-	module->def_bpm = uint16_t_le2host(xm_hdr.def_bpm);
-	module->def_tpr = uint16_t_le2host(xm_hdr.def_tempo);
-
-	/* Jump to end of file header */
-	if (fseek(f, hdr_size, SEEK_SET) < 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = trackmod_xm_load_order_list(&xm_hdr, module);
-	if (rc != EOK)
-		goto error;
-
-	rc = trackmod_xm_load_patterns(f, module);
-	if (rc != EOK)
-		goto error;
-
-	rc = trackmod_xm_load_instruments(&xm_hdr, f, module);
-	if (rc != EOK)
-		goto error;
-
-	(void) fclose(f);
-
-	*rmodule = module;
-	return EOK;
-error:
-	if (module != NULL)
-		trackmod_module_destroy(module);
-	if (f != NULL)
-		(void) fclose(f);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/trackmod/xm.h
===================================================================
--- uspace/lib/trackmod/xm.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2014 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup trackmod
- * @{
- */
-/**
- * @file Extended Module (.xm).
- */
-
-#ifndef XM_H
-#define XM_H
-
-#include "types/trackmod.h"
-
-extern errno_t trackmod_xm_load(char *, trackmod_module_t **);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/doc/doxygroups.h
===================================================================
--- uspace/lib/ui/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libui libui
- * @ingroup libs
- */
Index: pace/lib/ui/include/types/ui/checkbox.h
===================================================================
--- uspace/lib/ui/include/types/ui/checkbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Check box
- */
-
-#ifndef _UI_TYPES_CHECKBOX_H
-#define _UI_TYPES_CHECKBOX_H
-
-#include <stdbool.h>
-
-struct ui_checkbox;
-typedef struct ui_checkbox ui_checkbox_t;
-
-/** Check box callbacks */
-typedef struct ui_checkbox_cb {
-	void (*switched)(ui_checkbox_t *, void *, bool);
-} ui_checkbox_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/clickmatic.h
===================================================================
--- uspace/lib/ui/include/types/ui/clickmatic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clickmatic
- */
-
-#ifndef _UI_TYPES_CLICKMATIC_H
-#define _UI_TYPES_CLICKMATIC_H
-
-struct ui_clickmatic;
-typedef struct ui_clickmatic ui_clickmatic_t;
-
-/** Clickmatic callbacks */
-typedef struct ui_clickmatic_cb {
-	void (*clicked)(ui_clickmatic_t *, void *);
-} ui_clickmatic_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/clock.h
===================================================================
--- uspace/lib/ui/include/types/ui/clock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2024
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clock widget types
- */
-
-#ifndef _UI_TYPES_CLOCK_H
-#define _UI_TYPES_CLOCK_H
-
-#include <gfx/coord.h>
-#include <types/ui/control.h>
-#include <types/ui/resource.h>
-
-struct ui_clock {
-	/** Base control */
-	struct ui_control *control;
-	/** UI resource */
-	ui_resource_t *res;
-	/** Clock rectangle */
-	gfx_rect_t rect;
-	/** Current hour */
-	int hour;
-	/** Current minute */
-	int minute;
-	/** Current second */
-	int second;
-};
-
-typedef struct ui_clock ui_clock_t;
-
-#endif
-
-/** @}
- */ 
Index: pace/lib/ui/include/types/ui/control.h
===================================================================
--- uspace/lib/ui/include/types/ui/control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI control
- */
-
-#ifndef _UI_TYPES_CONTROL_H
-#define _UI_TYPES_CONTROL_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/event.h>
-
-struct ui_control;
-typedef struct ui_control ui_control_t;
-
-/** UI control ops */
-typedef struct ui_control_ops {
-	/** Destroy control */
-	void (*destroy)(void *);
-	/** Paint */
-	errno_t (*paint)(void *);
-	/** Keyboard event */
-	ui_evclaim_t (*kbd_event)(void *, kbd_event_t *);
-	/** Position event */
-	ui_evclaim_t (*pos_event)(void *, pos_event_t *);
-	/** Unfocus */
-	void (*unfocus)(void *, unsigned);
-} ui_control_ops_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/cursor.h
===================================================================
--- uspace/lib/ui/include/types/ui/cursor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBUI_TYPES_CURSOR_H_
-#define _LIBUI_TYPES_CURSOR_H_
-
-/** Stock cursor types */
-typedef enum {
-	/** Standard arrow */
-	ui_curs_arrow,
-	/** Double arrow pointing up and down */
-	ui_curs_size_ud,
-	/** Double arrow pointing left and right */
-	ui_curs_size_lr,
-	/** Double arrow pointing up-left and down-right */
-	ui_curs_size_uldr,
-	/** Double arrow pointing up-right nad down-left */
-	ui_curs_size_urdl,
-	/** I-beam (suggests editable text) */
-	ui_curs_ibeam
-} ui_stock_cursor_t;
-
-enum {
-	/** Number of stock cursor types */
-	ui_curs_limit = ui_curs_size_urdl + 1
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/entry.h
===================================================================
--- uspace/lib/ui/include/types/ui/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Text entry
- */
-
-#ifndef _UI_TYPES_ENTRY_H
-#define _UI_TYPES_ENTRY_H
-
-struct ui_entry;
-typedef struct ui_entry ui_entry_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/event.h
===================================================================
--- uspace/lib/ui/include/types/ui/event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Event
- */
-
-#ifndef _UI_TYPES_EVENT_H
-#define _UI_TYPES_EVENT_H
-
-/** Event claim.
- *
- * This type is returned by an event processing function to signal whether
- * it ruled that the event is destined for it or not
- */
-typedef enum {
-	/** Event claimed */
-	ui_claimed,
-	/** Event not claimed */
-	ui_unclaimed
-} ui_evclaim_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/filedialog.h
===================================================================
--- uspace/lib/ui/include/types/ui/filedialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File dialog
- */
-
-#ifndef _UI_TYPES_FILEDIALOG_H
-#define _UI_TYPES_FILEDIALOG_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/wdecor.h>
-
-struct ui_file_dialog;
-typedef struct ui_file_dialog ui_file_dialog_t;
-
-/** File dialog parameters */
-typedef struct {
-	/** Window caption */
-	const char *caption;
-	/** Initial file name */
-	const char *ifname;
-} ui_file_dialog_params_t;
-
-/** File dialog callback */
-typedef struct ui_file_dialog_cb {
-	/** OK button was pressed */
-	void (*bok)(ui_file_dialog_t *, void *, const char *);
-	/** Cancel button was pressed */
-	void (*bcancel)(ui_file_dialog_t *, void *);
-	/** Window closure requested (e.g. via close button) */
-	void (*close)(ui_file_dialog_t *, void *);
-} ui_file_dialog_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/filelist.h
===================================================================
--- uspace/lib/ui/include/types/ui/filelist.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File list
- */
-
-#ifndef _UI_TYPES_FILELIST_H
-#define _UI_TYPES_FILELIST_H
-
-#include <loc.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-struct ui_file_list;
-typedef struct ui_file_list ui_file_list_t;
-
-struct ui_file_list_entry;
-typedef struct ui_file_list_entry ui_file_list_entry_t;
-
-/** File list entry attributes */
-typedef struct ui_file_list_entry_attr {
-	/** File name */
-	const char *name;
-	/** File size */
-	uint64_t size;
-	/** @c true iff entry is a directory */
-	bool isdir;
-	/** Service number for service special entries */
-	service_id_t svc;
-} ui_file_list_entry_attr_t;
-
-/** File list callbacks */
-typedef struct ui_file_list_cb {
-	/** Request file list activation */
-	void (*activate_req)(ui_file_list_t *, void *);
-	/** File was selected */
-	void (*selected)(ui_file_list_t *, void *, const char *);
-} ui_file_list_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/fixed.h
===================================================================
--- uspace/lib/ui/include/types/ui/fixed.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Fixed layout
- */
-
-#ifndef _UI_TYPES_FIXED_H
-#define _UI_TYPES_FIXED_H
-
-struct ui_fixed;
-typedef struct ui_fixed ui_fixed_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/image.h
===================================================================
--- uspace/lib/ui/include/types/ui/image.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Image
- */
-
-#ifndef _UI_TYPES_IMAGE_H
-#define _UI_TYPES_IMAGE_H
-
-struct ui_image;
-typedef struct ui_image ui_image_t;
-
-/** UI image flags */
-typedef enum {
-	/** Draw a frame around the image */
-	ui_imgf_frame = 0x1
-} ui_image_flags_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/label.h
===================================================================
--- uspace/lib/ui/include/types/ui/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Label
- */
-
-#ifndef _UI_TYPES_LABEL_H
-#define _UI_TYPES_LABEL_H
-
-struct ui_label;
-typedef struct ui_label ui_label_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/list.h
===================================================================
--- uspace/lib/ui/include/types/ui/list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file List control
- */
-
-#ifndef _UI_TYPES_LIST_H
-#define _UI_TYPES_LIST_H
-
-#include <gfx/color.h>
-
-struct ui_list;
-typedef struct ui_list ui_list_t;
-
-struct ui_list_entry;
-typedef struct ui_list_entry ui_list_entry_t;
-
-/** List entry attributes */
-typedef struct ui_list_entry_attr {
-	/** Entry caption */
-	const char *caption;
-	/** User argument */
-	void *arg;
-	/** Entry color or @c NULL to use default color */
-	gfx_color_t *color;
-	/** Entry background color or @c NULL to use default color */
-	gfx_color_t *bgcolor;
-} ui_list_entry_attr_t;
-
-/** List callbacks */
-typedef struct ui_list_cb {
-	/** Request list activation */
-	void (*activate_req)(ui_list_t *, void *);
-	/** Entry was selected */
-	void (*selected)(ui_list_entry_t *, void *);
-	/** Compare two entries (for sorting) */
-	int (*compare)(ui_list_entry_t *, ui_list_entry_t *);
-} ui_list_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/menu.h
===================================================================
--- uspace/lib/ui/include/types/ui/menu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu
- */
-
-#ifndef _UI_TYPES_MENU_H
-#define _UI_TYPES_MENU_H
-
-#include <types/common.h>
-
-struct ui_menu;
-typedef struct ui_menu ui_menu_t;
-
-/** Menu callbacks */
-typedef struct ui_menu_cb {
-	/** Left arrow pressed */
-	void (*left)(ui_menu_t *, void *, sysarg_t);
-	/** Right arrow pressed */
-	void (*right)(ui_menu_t *, void *, sysarg_t);
-	/** Request menu closure */
-	void (*close_req)(ui_menu_t *, void *);
-	/** Accelerator key pressed */
-	void (*press_accel)(ui_menu_t *, void *, char32_t, sysarg_t);
-} ui_menu_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/menubar.h
===================================================================
--- uspace/lib/ui/include/types/ui/menubar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu bar
- */
-
-#ifndef _UI_TYPES_MENUBAR_H
-#define _UI_TYPES_MENUBAR_H
-
-struct ui_menu_bar;
-typedef struct ui_menu_bar ui_menu_bar_t;
-
-/** Menu bar callbacks */
-typedef struct ui_menu_bar_cb {
-	/** Activated */
-	void (*activate)(ui_menu_bar_t *, void *);
-	/** Deactivated */
-	void (*deactivate)(ui_menu_bar_t *, void *);
-} ui_menu_bar_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/menudd.h
===================================================================
--- uspace/lib/ui/include/types/ui/menudd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu
- */
-
-#ifndef _UI_TYPES_MENUDD_H
-#define _UI_TYPES_MENUDD_H
-
-struct ui_menu_dd;
-typedef struct ui_menu_dd ui_menu_dd_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/menuentry.h
===================================================================
--- uspace/lib/ui/include/types/ui/menuentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu entry
- */
-
-#ifndef _UI_TYPES_MENUENTRY_H
-#define _UI_TYPES_MENUENTRY_H
-
-struct ui_menu_entry;
-typedef struct ui_menu_entry ui_menu_entry_t;
-
-/** Menu entry callback */
-typedef void (*ui_menu_entry_cb_t)(ui_menu_entry_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/msgdialog.h
===================================================================
--- uspace/lib/ui/include/types/ui/msgdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Message Dialog
- */
-
-#ifndef _UI_TYPES_MSGDIALOG_H
-#define _UI_TYPES_MSGDIALOG_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/wdecor.h>
-
-struct ui_msg_dialog;
-typedef struct ui_msg_dialog ui_msg_dialog_t;
-
-enum {
-	/** Maximum number of buttons in message dialog. */
-	ui_msg_dialog_maxbtn = 2
-};
-
-/** Which choices the user can select from. */
-typedef enum {
-	/** OK (the default) */
-	umdc_ok,
-	/** OK, Cancel */
-	umdc_ok_cancel
-} ui_msg_dialog_choice_t;
-
-/** Message dialog flags */
-typedef enum {
-	/** Topmost window */
-	umdf_topmost = 0x1,
-	/** Place to the center of the screen */
-	umdf_center = 0x2
-} ui_msg_dialog_flags_t;
-
-/** Message dialog parameters */
-typedef struct {
-	/** Window caption */
-	const char *caption;
-	/** Message text */
-	const char *text;
-	/** The choice that the user is given */
-	ui_msg_dialog_choice_t choice;
-	/** Flags */
-	ui_msg_dialog_flags_t flags;
-} ui_msg_dialog_params_t;
-
-/** Message dialog callback */
-typedef struct ui_msg_dialog_cb {
-	/** Dialog button was pressed */
-	void (*button)(ui_msg_dialog_t *, void *, unsigned);
-	/** Window closure requested (e.g. via close button) */
-	void (*close)(ui_msg_dialog_t *, void *);
-} ui_msg_dialog_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/paint.h
===================================================================
--- uspace/lib/ui/include/types/ui/paint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Painting routines
- */
-
-#ifndef _UI_TYPES_PAINT_H
-#define _UI_TYPES_PAINT_H
-
-#include <gfx/color.h>
-#include <gfx/font.h>
-
-/** Filled circle parts */
-typedef enum {
-	/** Upper-left half */
-	ui_fcircle_upleft = 0x1,
-	/** Lower-right half */
-	ui_fcircle_lowright = 0x2,
-	/** Entire circle */
-	ui_fcircle_entire =
-	    ui_fcircle_upleft |
-	    ui_fcircle_lowright
-} ui_fcircle_part_t;
-
-/** Box characters for a particular box style.
- *
- * The first coordinate selects top, center, bottom,
- * the second coordinate selects left, center, right.
- * The top/bottom, left/right characters correpsond to corners,
- * the characters with one center coordinate correspond to edges:
- *
- *    0   1   2
- * 0 '+' '-' '+'
- * 1 ' |' ' ' '|'
- * 2 '+' '-' '+'
- *
- */
-typedef struct {
-	const char *c[3][3];
-} ui_box_chars_t;
-
-/** Horizontal brace characters for a particular box style. */
-typedef struct {
-	const char *start;
-	const char *middle;
-	const char *end;
-} ui_brace_chars_t;
-
-/** Box style */
-typedef enum {
-	/** Single box */
-	ui_box_single,
-	/** Double box */
-	ui_box_double
-} ui_box_style_t;
-
-/** UI text formatting */
-typedef struct {
-	/** Text font */
-	gfx_font_t *font;
-	/** Standard color */
-	gfx_color_t *color;
-	/** Highlight color */
-	gfx_color_t *hgl_color;
-	/** Horizontal alignment */
-	gfx_halign_t halign;
-	/** Width available for the text */
-	gfx_coord_t width;
-	/** Vertical alignment */
-	gfx_valign_t valign;
-} ui_text_fmt_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/pbutton.h
===================================================================
--- uspace/lib/ui/include/types/ui/pbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Push button
- */
-
-#ifndef _UI_TYPES_PBUTTON_H
-#define _UI_TYPES_PBUTTON_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-
-struct ui_pbutton;
-typedef struct ui_pbutton ui_pbutton_t;
-
-/** UI push button flags */
-typedef enum {
-	/** Do not depress the button in text mode */
-	ui_pbf_no_text_depress = 0x1
-} ui_pbutton_flags_t;
-
-/** Push button callbacks */
-typedef struct ui_pbutton_cb {
-	void (*clicked)(ui_pbutton_t *, void *);
-	void (*down)(ui_pbutton_t *, void *);
-	void (*up)(ui_pbutton_t *, void *);
-} ui_pbutton_cb_t;
-
-/** Push button decoration ops */
-typedef struct ui_pbutton_decor_ops {
-	errno_t (*paint)(ui_pbutton_t *, void *, gfx_coord2_t *);
-} ui_pbutton_decor_ops_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/popup.h
===================================================================
--- uspace/lib/ui/include/types/ui/popup.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Popup window
- */
-
-#ifndef _UI_TYPES_POPUP_H
-#define _UI_TYPES_POPUP_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/common.h>
-
-struct ui_popup;
-typedef struct ui_popup ui_popup_t;
-
-/** Popup window parameters */
-typedef struct {
-	/** Popup rectangle */
-	gfx_rect_t rect;
-	/** Placement rectangle close to which popup should be placed */
-	gfx_rect_t place;
-	/** Input device ID associated with the popup's seat */
-	sysarg_t idev_id;
-} ui_popup_params_t;
-
-/** Popup callbacks */
-typedef struct ui_popup_cb {
-	void (*close)(ui_popup_t *, void *);
-	void (*kbd)(ui_popup_t *, void *, kbd_event_t *);
-	errno_t (*paint)(ui_popup_t *, void *);
-	void (*pos)(ui_popup_t *, void *, pos_event_t *);
-} ui_popup_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/promptdialog.h
===================================================================
--- uspace/lib/ui/include/types/ui/promptdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Prompt dialog
- */
-
-#ifndef _UI_TYPES_PROMPTDIALOG_H
-#define _UI_TYPES_PROMPTDIALOG_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/wdecor.h>
-
-struct ui_prompt_dialog;
-typedef struct ui_prompt_dialog ui_prompt_dialog_t;
-
-/** Prompt dialog parameters */
-typedef struct {
-	/** Window caption */
-	const char *caption;
-	/** Prompt text */
-	const char *prompt;
-	/** Initial entry text */
-	const char *itext;
-} ui_prompt_dialog_params_t;
-
-/** Prompt dialog callback */
-typedef struct ui_prompt_dialog_cb {
-	/** OK button was pressed */
-	void (*bok)(ui_prompt_dialog_t *, void *, const char *);
-	/** Cancel button was pressed */
-	void (*bcancel)(ui_prompt_dialog_t *, void *);
-	/** Window closure requested (e.g. via close button) */
-	void (*close)(ui_prompt_dialog_t *, void *);
-} ui_prompt_dialog_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/rbutton.h
===================================================================
--- uspace/lib/ui/include/types/ui/rbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Radio button
- */
-
-#ifndef _UI_TYPES_RBUTTON_H
-#define _UI_TYPES_RBUTTON_H
-
-struct ui_rbutton_group;
-typedef struct ui_rbutton_group ui_rbutton_group_t;
-
-struct ui_rbutton;
-typedef struct ui_rbutton ui_rbutton_t;
-
-/** Radio button callbacks */
-typedef struct ui_rbutton_group_cb {
-	void (*selected)(ui_rbutton_group_t *, void *, void *);
-} ui_rbutton_group_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/resource.h
===================================================================
--- uspace/lib/ui/include/types/ui/resource.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file User interface resources
- */
-
-#ifndef _UI_TYPES_RESOURCE_H
-#define _UI_TYPES_RESOURCE_H
-
-struct ui_resource;
-typedef struct ui_resource ui_resource_t;
-
-typedef void (*ui_expose_cb_t)(void *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/scrollbar.h
===================================================================
--- uspace/lib/ui/include/types/ui/scrollbar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Scrollbar
- */
-
-#ifndef _UI_TYPES_SCROLLBAR_H
-#define _UI_TYPES_SCROLLBAR_H
-
-#include <gfx/coord.h>
-
-struct ui_scrollbar;
-typedef struct ui_scrollbar ui_scrollbar_t;
-
-/** Scrollbar direction */
-typedef enum {
-	/** Horizontal */
-	ui_sbd_horiz,
-	/** Vertical */
-	ui_sbd_vert
-} ui_scrollbar_dir_t;
-
-/** Scrollbar callbacks */
-typedef struct ui_scrollbar_cb {
-	void (*up)(ui_scrollbar_t *, void *);
-	void (*down)(ui_scrollbar_t *, void *);
-	void (*page_up)(ui_scrollbar_t *, void *);
-	void (*page_down)(ui_scrollbar_t *, void *);
-	void (*moved)(ui_scrollbar_t *, void *, gfx_coord_t);
-} ui_scrollbar_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/selectdialog.h
===================================================================
--- uspace/lib/ui/include/types/ui/selectdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Select dialog
- */
-
-#ifndef _UI_TYPES_SELECTDIALOG_H
-#define _UI_TYPES_SELECTDIALOG_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-
-struct ui_select_dialog;
-typedef struct ui_select_dialog ui_select_dialog_t;
-
-/** Select dialog flags */
-typedef enum {
-	/** Topmost window */
-	usdf_topmost = 0x1,
-	/** Place to the center of the screen */
-	usdf_center = 0x2
-} ui_select_dialog_flags_t;
-
-/** Select dialog parameters */
-typedef struct {
-	/** Window caption */
-	const char *caption;
-	/** Prompt text */
-	const char *prompt;
-	/** Flags */
-	ui_select_dialog_flags_t flags;
-} ui_select_dialog_params_t;
-
-/** Select dialog callback */
-typedef struct ui_select_dialog_cb {
-	/** OK button was pressed */
-	void (*bok)(ui_select_dialog_t *, void *, void *);
-	/** Cancel button was pressed */
-	void (*bcancel)(ui_select_dialog_t *, void *);
-	/** Window closure requested (e.g. via close button) */
-	void (*close)(ui_select_dialog_t *, void *);
-} ui_select_dialog_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/slider.h
===================================================================
--- uspace/lib/ui/include/types/ui/slider.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Slider
- */
-
-#ifndef _UI_TYPES_SLIDER_H
-#define _UI_TYPES_SLIDER_H
-
-#include <gfx/coord.h>
-
-struct ui_slider;
-typedef struct ui_slider ui_slider_t;
-
-/** Slider callbacks */
-typedef struct ui_slider_cb {
-	void (*moved)(ui_slider_t *, void *, gfx_coord_t);
-} ui_slider_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/tab.h
===================================================================
--- uspace/lib/ui/include/types/ui/tab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab
- */
-
-#ifndef _UI_TYPES_TAB_H
-#define _UI_TYPES_TAB_H
-
-struct ui_menu;
-typedef struct ui_tab ui_tab_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/tabset.h
===================================================================
--- uspace/lib/ui/include/types/ui/tabset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu bar
- */
-
-#ifndef _UI_TYPES_TABSET_H
-#define _UI_TYPES_TABSET_H
-
-struct ui_tab_set;
-typedef struct ui_tab_set ui_tab_set_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/testctl.h
===================================================================
--- uspace/lib/ui/include/types/ui/testctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Label
- */
-
-#ifndef _UI_TYPES_TESTCTL_H
-#define _UI_TYPES_TESTCTL_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/ui/event.h>
-
-struct ui_test_ctl;
-typedef struct ui_test_ctl ui_test_ctl_t;
-
-/** Test control response */
-typedef struct {
-	/** Claim to return */
-	ui_evclaim_t claim;
-	/** Result code to return */
-	errno_t rc;
-
-	/** @c true iff destroy was called */
-	bool destroy;
-
-	/** @c true iff paint was called */
-	bool paint;
-
-	/** @c true iff kbd_event was called */
-	bool kbd;
-	/** Keyboard event that was sent */
-	kbd_event_t kevent;
-
-	/** @c true iff pos_event was called */
-	bool pos;
-	/** Position event that was sent */
-	pos_event_t pevent;
-
-	/** @c true iff unfocus was called */
-	bool unfocus;
-	/** Number of remaining foci that was sent */
-	unsigned unfocus_nfocus;
-} ui_tc_resp_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/ui.h
===================================================================
--- uspace/lib/ui/include/types/ui/ui.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file User interface
- */
-
-#ifndef _UI_TYPES_UI_H
-#define _UI_TYPES_UI_H
-
-#include <gfx/coord.h>
-
-struct ui;
-typedef struct ui ui_t;
-
-/** Use the default display service (argument to ui_create()) */
-#define UI_DISPLAY_DEFAULT "disp@"
-/** Use the default console service (argument to ui_create()) */
-#define UI_CONSOLE_DEFAULT "cons@"
-/** Use any available service (argument to ui_create()) */
-#define UI_ANY_DEFAULT "@"
-/** Use dummy output (argument to ui_create()) */
-#define UI_DISPLAY_NULL "null@"
-
-/** Window system */
-typedef enum {
-	/** Unknown */
-	ui_ws_unknown,
-	/** Display service */
-	ui_ws_display,
-	/** Console */
-	ui_ws_console,
-	/** Any non-dummy output backend */
-	ui_ws_any,
-	/** Dummy output */
-	ui_ws_null
-} ui_winsys_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/wdecor.h
===================================================================
--- uspace/lib/ui/include/types/ui/wdecor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window decoration
- */
-
-#ifndef _UI_TYPES_WDECOR_H
-#define _UI_TYPES_WDECOR_H
-
-#include <gfx/coord.h>
-#include <types/common.h>
-#include <types/ui/cursor.h>
-
-struct ui_wdecor;
-typedef struct ui_wdecor ui_wdecor_t;
-
-/** Window decoration style */
-typedef enum {
-	/** No style bits */
-	ui_wds_none = 0x0,
-	/** Window has a frame */
-	ui_wds_frame = 0x1,
-	/** Window has a title bar */
-	ui_wds_titlebar = 0x2,
-	/** Window has a system menu handle */
-	ui_wds_sysmenu_hdl = 0x4,
-	/** Window has a minimize button */
-	ui_wds_minimize_btn = 0x8,
-	/** Window has a maximize button */
-	ui_wds_maximize_btn = 0x10,
-	/** Window has a close button */
-	ui_wds_close_btn = 0x20,
-	/** Window is resizable */
-	ui_wds_resizable = 0x40,
-	/** Window is decorated (default decoration) */
-	ui_wds_decorated = ui_wds_frame | ui_wds_titlebar | ui_wds_sysmenu_hdl |
-	    ui_wds_minimize_btn | ui_wds_close_btn
-} ui_wdecor_style_t;
-
-/** Window resize type */
-typedef enum {
-	ui_wr_none = 0,
-
-	ui_wr_top = 0x1,
-	ui_wr_left = 0x2,
-	ui_wr_bottom = 0x4,
-	ui_wr_right = 0x8,
-
-	ui_wr_top_left = ui_wr_top | ui_wr_left,
-	ui_wr_bottom_left = ui_wr_bottom | ui_wr_left,
-	ui_wr_bottom_right = ui_wr_bottom | ui_wr_right,
-	ui_wr_top_right = ui_wr_top | ui_wr_right
-} ui_wdecor_rsztype_t;
-
-/** Window decoration callbacks */
-typedef struct ui_wdecor_cb {
-	void (*sysmenu_open)(ui_wdecor_t *, void *, sysarg_t);
-	void (*sysmenu_left)(ui_wdecor_t *, void *, sysarg_t);
-	void (*sysmenu_right)(ui_wdecor_t *, void *, sysarg_t);
-	void (*sysmenu_accel)(ui_wdecor_t *, void *, char32_t, sysarg_t);
-	void (*minimize)(ui_wdecor_t *, void *);
-	void (*maximize)(ui_wdecor_t *, void *);
-	void (*unmaximize)(ui_wdecor_t *, void *);
-	void (*close)(ui_wdecor_t *, void *);
-	void (*move)(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
-	void (*resize)(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
-	    gfx_coord2_t *, sysarg_t);
-	void (*set_cursor)(ui_wdecor_t *, void *, ui_stock_cursor_t);
-} ui_wdecor_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/types/ui/window.h
===================================================================
--- uspace/lib/ui/include/types/ui/window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window
- */
-
-#ifndef _UI_TYPES_WINDOW_H
-#define _UI_TYPES_WINDOW_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/common.h>
-#include <types/ui/wdecor.h>
-
-struct ui_window;
-typedef struct ui_window ui_window_t;
-
-/** Window placement hint */
-typedef enum {
-	/** Use default (automatic) placement */
-	ui_wnd_place_default = 0,
-	/** Place window to the top-left corner of the screen */
-	ui_wnd_place_top_left,
-	/** Place window to the top-right corner of the screen */
-	ui_wnd_place_top_right,
-	/** Place window to the bottom-left corner of the screen */
-	ui_wnd_place_bottom_left,
-	/** Place window to the bottom-right corner of the screen */
-	ui_wnd_place_bottom_right,
-	/** Place window to the center of the screen */
-	ui_wnd_place_center,
-	/** Place window accross the entire screen */
-	ui_wnd_place_full_screen,
-	/** Place window as a popup window adjacent to rectangle */
-	ui_wnd_place_popup
-} ui_wnd_placement_t;
-
-/** Window flags */
-typedef enum {
-	/** Popup window */
-	ui_wndf_popup = 0x1,
-	/** Window does not receive focus */
-	ui_wndf_nofocus = 0x2,
-	/** Topmost window */
-	ui_wndf_topmost = 0x4,
-	/** Special system window */
-	ui_wndf_system = 0x8,
-	/** Maximized windows should avoid this window */
-	ui_wndf_avoid = 0x10
-} ui_wnd_flags_t;
-
-/** Window parameters */
-typedef struct {
-	/** Window rectangle */
-	gfx_rect_t rect;
-	/** Minimum size to which window can be resized */
-	gfx_coord2_t min_size;
-	/** Window caption */
-	const char *caption;
-	/** Window decoration style */
-	ui_wdecor_style_t style;
-	/** Window placement */
-	ui_wnd_placement_t placement;
-	/** Window flags */
-	ui_wnd_flags_t flags;
-	/** Parent rectangle for popup windows */
-	gfx_rect_t prect;
-	/** Input device associated with the window's seat */
-	sysarg_t idev_id;
-} ui_wnd_params_t;
-
-/** Window callbacks */
-typedef struct ui_window_cb {
-	void (*sysmenu)(ui_window_t *, void *, sysarg_t);
-	void (*minimize)(ui_window_t *, void *);
-	void (*maximize)(ui_window_t *, void *);
-	void (*unmaximize)(ui_window_t *, void *);
-	void (*resize)(ui_window_t *, void *);
-	void (*close)(ui_window_t *, void *);
-	void (*focus)(ui_window_t *, void *, unsigned);
-	void (*kbd)(ui_window_t *, void *, kbd_event_t *);
-	errno_t (*paint)(ui_window_t *, void *);
-	void (*pos)(ui_window_t *, void *, pos_event_t *);
-	void (*unfocus)(ui_window_t *, void *, unsigned);
-} ui_window_cb_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/accel.h
===================================================================
--- uspace/lib/ui/include/ui/accel.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Accelerator processing
- */
-
-#ifndef _UI_ACCEL_H
-#define _UI_ACCEL_H
-
-#include <errno.h>
-#include <uchar.h>
-
-extern errno_t ui_accel_process(const char *, char **, char **);
-extern char32_t ui_accel_get(const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/checkbox.h
===================================================================
--- uspace/lib/ui/include/ui/checkbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Check box
- */
-
-#ifndef _UI_CHECKBOX_H
-#define _UI_CHECKBOX_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <types/ui/checkbox.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-#include <stdbool.h>
-
-extern errno_t ui_checkbox_create(ui_resource_t *, const char *,
-    ui_checkbox_t **);
-extern void ui_checkbox_destroy(ui_checkbox_t *);
-extern ui_control_t *ui_checkbox_ctl(ui_checkbox_t *);
-extern void ui_checkbox_set_cb(ui_checkbox_t *, ui_checkbox_cb_t *, void *);
-extern void ui_checkbox_set_rect(ui_checkbox_t *, gfx_rect_t *);
-extern bool ui_checkbox_get_checked(ui_checkbox_t *);
-extern void ui_checkbox_set_checked(ui_checkbox_t *, bool);
-extern errno_t ui_checkbox_paint(ui_checkbox_t *);
-extern void ui_checkbox_press(ui_checkbox_t *);
-extern void ui_checkbox_release(ui_checkbox_t *);
-extern void ui_checkbox_enter(ui_checkbox_t *);
-extern void ui_checkbox_leave(ui_checkbox_t *);
-extern void ui_checkbox_switched(ui_checkbox_t *);
-extern ui_evclaim_t ui_checkbox_pos_event(ui_checkbox_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/clickmatic.h
===================================================================
--- uspace/lib/ui/include/ui/clickmatic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clickmatic
- */
-
-#ifndef _UI_CLICKMATIC_H
-#define _UI_CLICKMATIC_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <types/ui/clickmatic.h>
-#include <types/ui/ui.h>
-
-extern errno_t ui_clickmatic_create(ui_t *, ui_clickmatic_t **);
-extern void ui_clickmatic_set_cb(ui_clickmatic_t *, ui_clickmatic_cb_t *,
-    void *);
-extern void ui_clickmatic_destroy(ui_clickmatic_t *);
-extern void ui_clickmatic_press(ui_clickmatic_t *);
-extern void ui_clickmatic_release(ui_clickmatic_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/clock.h
===================================================================
--- uspace/lib/ui/include/ui/clock.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2024
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clock widget
- */
-
-#ifndef _UI_CLOCK_H
-#define _UI_CLOCK_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <types/ui/clock.h>
-#include <types/ui/control.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_clock_create(ui_resource_t *, ui_clock_t **);
-extern void ui_clock_destroy(ui_clock_t *);
-extern ui_control_t *ui_clock_ctl(ui_clock_t *);
-extern void ui_clock_set_rect(ui_clock_t *, gfx_rect_t *);
-extern errno_t ui_clock_paint(ui_clock_t *);
-extern void ui_clock_update_time(ui_clock_t *);
-
-#endif
-
-/** @}
- */ 
Index: pace/lib/ui/include/ui/control.h
===================================================================
--- uspace/lib/ui/include/ui/control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI control
- */
-
-#ifndef _UI_CONTROL_H
-#define _UI_CONTROL_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-
-extern errno_t ui_control_new(ui_control_ops_t *, void *, ui_control_t **);
-extern void ui_control_delete(ui_control_t *);
-extern void ui_control_destroy(ui_control_t *);
-extern errno_t ui_control_paint(ui_control_t *);
-extern ui_evclaim_t ui_control_kbd_event(ui_control_t *, kbd_event_t *);
-extern ui_evclaim_t ui_control_pos_event(ui_control_t *, pos_event_t *);
-extern void ui_control_unfocus(ui_control_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/entry.h
===================================================================
--- uspace/lib/ui/include/ui/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Text entry
- */
-
-#ifndef _UI_ENTRY_H
-#define _UI_ENTRY_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <gfx/text.h>
-#include <types/ui/control.h>
-#include <types/ui/entry.h>
-#include <types/ui/window.h>
-
-extern errno_t ui_entry_create(ui_window_t *, const char *,
-    ui_entry_t **);
-extern void ui_entry_destroy(ui_entry_t *);
-extern ui_control_t *ui_entry_ctl(ui_entry_t *);
-extern void ui_entry_set_rect(ui_entry_t *, gfx_rect_t *);
-extern void ui_entry_set_halign(ui_entry_t *, gfx_halign_t);
-extern void ui_entry_set_read_only(ui_entry_t *, bool);
-extern errno_t ui_entry_set_text(ui_entry_t *, const char *);
-extern const char *ui_entry_get_text(ui_entry_t *);
-extern errno_t ui_entry_paint(ui_entry_t *);
-extern errno_t ui_entry_insert_str(ui_entry_t *, const char *);
-extern void ui_entry_activate(ui_entry_t *);
-extern void ui_entry_deactivate(ui_entry_t *);
-extern void ui_entry_backspace(ui_entry_t *);
-extern void ui_entry_delete(ui_entry_t *);
-extern void ui_entry_copy(ui_entry_t *);
-extern void ui_entry_cut(ui_entry_t *);
-extern void ui_entry_paste(ui_entry_t *);
-extern void ui_entry_seek_start(ui_entry_t *, bool);
-extern void ui_entry_seek_end(ui_entry_t *, bool);
-extern void ui_entry_seek_prev_char(ui_entry_t *, bool);
-extern void ui_entry_seek_next_char(ui_entry_t *, bool);
-extern ui_evclaim_t ui_entry_kbd_event(ui_entry_t *, kbd_event_t *);
-extern ui_evclaim_t ui_entry_pos_event(ui_entry_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/filedialog.h
===================================================================
--- uspace/lib/ui/include/ui/filedialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File dialog
- */
-
-#ifndef _UI_FILEDIALOG_H
-#define _UI_FILEDIALOG_H
-
-#include <errno.h>
-#include <types/ui/filedialog.h>
-#include <types/ui/ui.h>
-
-extern void ui_file_dialog_params_init(ui_file_dialog_params_t *);
-extern errno_t ui_file_dialog_create(ui_t *, ui_file_dialog_params_t *,
-    ui_file_dialog_t **);
-extern void ui_file_dialog_set_cb(ui_file_dialog_t *, ui_file_dialog_cb_t *,
-    void *);
-extern void ui_file_dialog_destroy(ui_file_dialog_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/filelist.h
===================================================================
--- uspace/lib/ui/include/ui/filelist.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File list
- */
-
-#ifndef _UI_FILELIST_H
-#define _UI_FILELIST_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <ui/control.h>
-#include <ui/window.h>
-#include <stdbool.h>
-#include <types/ui/filelist.h>
-
-extern errno_t ui_file_list_create(ui_window_t *, bool, ui_file_list_t **);
-extern void ui_file_list_destroy(ui_file_list_t *);
-extern ui_control_t *ui_file_list_ctl(ui_file_list_t *);
-extern void ui_file_list_set_cb(ui_file_list_t *, ui_file_list_cb_t *, void *);
-extern void ui_file_list_set_rect(ui_file_list_t *, gfx_rect_t *);
-extern errno_t ui_file_list_read_dir(ui_file_list_t *, const char *);
-extern errno_t ui_file_list_activate(ui_file_list_t *);
-extern void ui_file_list_deactivate(ui_file_list_t *);
-extern errno_t ui_file_list_open(ui_file_list_t *, ui_file_list_entry_t *);
-extern ui_file_list_entry_t *ui_file_list_get_cursor(ui_file_list_t *);
-extern void ui_file_list_entry_get_attr(ui_file_list_entry_t *,
-    ui_file_list_entry_attr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/fixed.h
===================================================================
--- uspace/lib/ui/include/ui/fixed.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Fixed layout
- */
-
-#ifndef _UI_FIXED_H
-#define _UI_FIXED_H
-
-#include <errno.h>
-#include <io/pos_event.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/fixed.h>
-
-extern errno_t ui_fixed_create(ui_fixed_t **);
-extern void ui_fixed_destroy(ui_fixed_t *);
-extern ui_control_t *ui_fixed_ctl(ui_fixed_t *);
-extern errno_t ui_fixed_add(ui_fixed_t *, ui_control_t *);
-extern void ui_fixed_remove(ui_fixed_t *, ui_control_t *);
-extern errno_t ui_fixed_paint(ui_fixed_t *);
-extern ui_evclaim_t ui_fixed_kbd_event(ui_fixed_t *, kbd_event_t *);
-extern ui_evclaim_t ui_fixed_pos_event(ui_fixed_t *, pos_event_t *);
-extern void ui_fixed_unfocus(ui_fixed_t *, unsigned);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/image.h
===================================================================
--- uspace/lib/ui/include/ui/image.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Image
- */
-
-#ifndef _UI_IMAGE_H
-#define _UI_IMAGE_H
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-#include <types/ui/control.h>
-#include <types/ui/image.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_image_create(ui_resource_t *, gfx_bitmap_t *, gfx_rect_t *,
-    ui_image_t **);
-extern void ui_image_destroy(ui_image_t *);
-extern ui_control_t *ui_image_ctl(ui_image_t *);
-extern void ui_image_set_bmp(ui_image_t *, gfx_bitmap_t *, gfx_rect_t *);
-extern void ui_image_set_rect(ui_image_t *, gfx_rect_t *);
-extern void ui_image_set_flags(ui_image_t *, ui_image_flags_t);
-extern errno_t ui_image_paint(ui_image_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/label.h
===================================================================
--- uspace/lib/ui/include/ui/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Label
- */
-
-#ifndef _UI_LABEL_H
-#define _UI_LABEL_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <gfx/text.h>
-#include <types/ui/control.h>
-#include <types/ui/label.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_label_create(ui_resource_t *, const char *,
-    ui_label_t **);
-extern void ui_label_destroy(ui_label_t *);
-extern ui_control_t *ui_label_ctl(ui_label_t *);
-extern void ui_label_set_rect(ui_label_t *, gfx_rect_t *);
-extern void ui_label_set_halign(ui_label_t *, gfx_halign_t);
-extern void ui_label_set_valign(ui_label_t *, gfx_valign_t);
-extern errno_t ui_label_set_text(ui_label_t *, const char *);
-extern errno_t ui_label_paint(ui_label_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/list.h
===================================================================
--- uspace/lib/ui/include/ui/list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file List
- */
-
-#ifndef _UI_LIST_H
-#define _UI_LIST_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <ui/control.h>
-#include <ui/window.h>
-#include <stdbool.h>
-#include <types/ui/list.h>
-
-extern errno_t ui_list_create(ui_window_t *, bool, ui_list_t **);
-extern void ui_list_destroy(ui_list_t *);
-extern ui_control_t *ui_list_ctl(ui_list_t *);
-extern void ui_list_set_cb(ui_list_t *, ui_list_cb_t *, void *);
-extern void *ui_list_get_cb_arg(ui_list_t *);
-extern void ui_list_set_rect(ui_list_t *, gfx_rect_t *);
-extern errno_t ui_list_activate(ui_list_t *);
-extern void ui_list_deactivate(ui_list_t *);
-extern ui_list_entry_t *ui_list_get_cursor(ui_list_t *);
-extern void ui_list_set_cursor(ui_list_t *, ui_list_entry_t *);
-extern void ui_list_entry_attr_init(ui_list_entry_attr_t *);
-extern errno_t ui_list_entry_append(ui_list_t *,
-    ui_list_entry_attr_t *, ui_list_entry_t **);
-extern void ui_list_entry_move_up(ui_list_entry_t *);
-extern void ui_list_entry_move_down(ui_list_entry_t *);
-extern void ui_list_entry_delete(ui_list_entry_t *);
-extern void *ui_list_entry_get_arg(ui_list_entry_t *);
-extern ui_list_t *ui_list_entry_get_list(ui_list_entry_t *);
-extern errno_t ui_list_entry_set_caption(ui_list_entry_t *, const char *);
-extern size_t ui_list_entries_cnt(ui_list_t *);
-extern errno_t ui_list_sort(ui_list_t *);
-extern void ui_list_cursor_center(ui_list_t *, ui_list_entry_t *);
-extern ui_list_entry_t *ui_list_first(ui_list_t *);
-extern ui_list_entry_t *ui_list_last(ui_list_t *);
-extern ui_list_entry_t *ui_list_next(ui_list_entry_t *);
-extern ui_list_entry_t *ui_list_prev(ui_list_entry_t *);
-extern bool ui_list_is_active(ui_list_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/menu.h
===================================================================
--- uspace/lib/ui/include/ui/menu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu
- */
-
-#ifndef _UI_MENU_H
-#define _UI_MENU_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/event.h>
-#include <types/ui/menu.h>
-#include <types/ui/menubar.h>
-#include <types/ui/window.h>
-#include <uchar.h>
-
-extern errno_t ui_menu_create(ui_window_t *, ui_menu_t **);
-extern void ui_menu_destroy(ui_menu_t *);
-extern void ui_menu_set_cb(ui_menu_t *, ui_menu_cb_t *, void *);
-extern errno_t ui_menu_open(ui_menu_t *, gfx_rect_t *, sysarg_t);
-extern void ui_menu_close(ui_menu_t *);
-extern bool ui_menu_is_open(ui_menu_t *);
-extern errno_t ui_menu_paint(ui_menu_t *, gfx_coord2_t *);
-extern ui_evclaim_t ui_menu_kbd_event(ui_menu_t *, kbd_event_t *);
-extern ui_evclaim_t ui_menu_pos_event(ui_menu_t *, gfx_coord2_t *,
-    pos_event_t *);
-extern sysarg_t ui_menu_get_idev_id(ui_menu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/menubar.h
===================================================================
--- uspace/lib/ui/include/ui/menubar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu bar
- */
-
-#ifndef _UI_MENUBAR_H
-#define _UI_MENUBAR_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <types/common.h>
-#include <types/ui/menubar.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-#include <types/ui/ui.h>
-#include <types/ui/window.h>
-#include <uchar.h>
-
-extern errno_t ui_menu_bar_create(ui_t *, ui_window_t *,
-    ui_menu_bar_t **);
-extern void ui_menu_bar_destroy(ui_menu_bar_t *);
-extern void ui_menu_bar_set_cb(ui_menu_bar_t *, ui_menu_bar_cb_t *, void *);
-extern ui_control_t *ui_menu_bar_ctl(ui_menu_bar_t *);
-extern void ui_menu_bar_set_rect(ui_menu_bar_t *, gfx_rect_t *);
-extern errno_t ui_menu_bar_paint(ui_menu_bar_t *);
-extern ui_evclaim_t ui_menu_bar_kbd_event(ui_menu_bar_t *, kbd_event_t *);
-extern ui_evclaim_t ui_menu_bar_pos_event(ui_menu_bar_t *, pos_event_t *);
-extern void ui_menu_bar_press_accel(ui_menu_bar_t *, char32_t, sysarg_t);
-extern void ui_menu_bar_unfocus(ui_menu_bar_t *);
-extern void ui_menu_bar_activate(ui_menu_bar_t *);
-extern void ui_menu_bar_deactivate(ui_menu_bar_t *);
-extern void ui_menu_bar_select_first(ui_menu_bar_t *, bool, sysarg_t);
-extern void ui_menu_bar_select_last(ui_menu_bar_t *, bool, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/menudd.h
===================================================================
--- uspace/lib/ui/include/ui/menudd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu drop-down
- */
-
-#ifndef _UI_MENUDD_H
-#define _UI_MENUDD_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/menu.h>
-#include <types/ui/menudd.h>
-#include <types/ui/menubar.h>
-#include <types/ui/event.h>
-#include <uchar.h>
-
-extern errno_t ui_menu_dd_create(ui_menu_bar_t *, const char *, ui_menu_dd_t **,
-    ui_menu_t **);
-extern void ui_menu_dd_destroy(ui_menu_dd_t *);
-extern ui_menu_dd_t *ui_menu_dd_first(ui_menu_bar_t *);
-extern ui_menu_dd_t *ui_menu_dd_next(ui_menu_dd_t *);
-extern ui_menu_dd_t *ui_menu_dd_last(ui_menu_bar_t *);
-extern ui_menu_dd_t *ui_menu_dd_prev(ui_menu_dd_t *);
-extern const char *ui_menu_dd_caption(ui_menu_dd_t *);
-extern void ui_menu_dd_get_rect(ui_menu_dd_t *, gfx_coord2_t *, gfx_rect_t *);
-extern char32_t ui_menu_dd_get_accel(ui_menu_dd_t *);
-extern errno_t ui_menu_dd_open(ui_menu_dd_t *, gfx_rect_t *, sysarg_t);
-extern void ui_menu_dd_close(ui_menu_dd_t *);
-extern bool ui_menu_dd_is_open(ui_menu_dd_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/menuentry.h
===================================================================
--- uspace/lib/ui/include/ui/menuentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu entry
- */
-
-#ifndef _UI_MENUENTRY_H
-#define _UI_MENUENTRY_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/ui/menu.h>
-#include <types/ui/menuentry.h>
-#include <types/ui/event.h>
-
-extern errno_t ui_menu_entry_create(ui_menu_t *, const char *, const char *,
-    ui_menu_entry_t **);
-extern errno_t ui_menu_entry_sep_create(ui_menu_t *, ui_menu_entry_t **);
-extern void ui_menu_entry_destroy(ui_menu_entry_t *);
-extern void ui_menu_entry_set_cb(ui_menu_entry_t *, ui_menu_entry_cb_t,
-    void *);
-extern void ui_menu_entry_set_disabled(ui_menu_entry_t *, bool);
-extern bool ui_menu_entry_is_disabled(ui_menu_entry_t *);
-extern ui_menu_entry_t *ui_menu_entry_first(ui_menu_t *);
-extern ui_menu_entry_t *ui_menu_entry_last(ui_menu_t *);
-extern ui_menu_entry_t *ui_menu_entry_next(ui_menu_entry_t *);
-extern ui_menu_entry_t *ui_menu_entry_prev(ui_menu_entry_t *);
-extern gfx_coord_t ui_menu_entry_calc_width(ui_menu_t *,
-    gfx_coord_t, gfx_coord_t);
-extern void ui_menu_entry_column_widths(ui_menu_entry_t *,
-    gfx_coord_t *, gfx_coord_t *);
-extern gfx_coord_t ui_menu_entry_height(ui_menu_entry_t *);
-extern char32_t ui_menu_entry_get_accel(ui_menu_entry_t *);
-extern errno_t ui_menu_entry_paint(ui_menu_entry_t *, gfx_coord2_t *);
-extern bool ui_menu_entry_selectable(ui_menu_entry_t *);
-extern void ui_menu_entry_press(ui_menu_entry_t *, gfx_coord2_t *);
-extern void ui_menu_entry_release(ui_menu_entry_t *);
-extern void ui_menu_entry_enter(ui_menu_entry_t *, gfx_coord2_t *);
-extern void ui_menu_entry_leave(ui_menu_entry_t *, gfx_coord2_t *);
-extern void ui_menu_entry_activate(ui_menu_entry_t *);
-extern ui_evclaim_t ui_menu_entry_pos_event(ui_menu_entry_t *, gfx_coord2_t *,
-    pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/msgdialog.h
===================================================================
--- uspace/lib/ui/include/ui/msgdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Message dialog
- */
-
-#ifndef _UI_MSGDIALOG_H
-#define _UI_MSGDIALOG_H
-
-#include <errno.h>
-#include <types/ui/msgdialog.h>
-#include <types/ui/ui.h>
-
-extern void ui_msg_dialog_params_init(ui_msg_dialog_params_t *);
-extern errno_t ui_msg_dialog_create(ui_t *, ui_msg_dialog_params_t *,
-    ui_msg_dialog_t **);
-extern void ui_msg_dialog_set_cb(ui_msg_dialog_t *, ui_msg_dialog_cb_t *,
-    void *);
-extern void ui_msg_dialog_destroy(ui_msg_dialog_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/paint.h
===================================================================
--- uspace/lib/ui/include/ui/paint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Painting routines
- */
-
-#ifndef _UI_PAINT_H
-#define _UI_PAINT_H
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <types/ui/paint.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_paint_bevel(gfx_context_t *, gfx_rect_t *, gfx_color_t *,
-    gfx_color_t *, gfx_coord_t, gfx_rect_t *);
-extern void ui_paint_get_bevel_inside(gfx_context_t *, gfx_rect_t *,
-    gfx_coord_t, gfx_rect_t *);
-extern errno_t ui_paint_inset_frame(ui_resource_t *, gfx_rect_t *,
-    gfx_rect_t *);
-extern void ui_paint_get_inset_frame_inside(ui_resource_t *, gfx_rect_t *,
-    gfx_rect_t *);
-extern errno_t ui_paint_outset_frame(ui_resource_t *, gfx_rect_t *,
-    gfx_rect_t *);
-extern errno_t ui_paint_filled_circle(gfx_context_t *, gfx_coord2_t *,
-    gfx_coord_t, ui_fcircle_part_t);
-extern errno_t ui_paint_up_triangle(gfx_context_t *, gfx_coord2_t *,
-    gfx_coord_t);
-extern errno_t ui_paint_down_triangle(gfx_context_t *, gfx_coord2_t *,
-    gfx_coord_t);
-extern errno_t ui_paint_left_triangle(gfx_context_t *, gfx_coord2_t *,
-    gfx_coord_t);
-extern errno_t ui_paint_right_triangle(gfx_context_t *, gfx_coord2_t *,
-    gfx_coord_t);
-extern errno_t ui_paint_cross(gfx_context_t *, gfx_coord2_t *, gfx_coord_t,
-    gfx_coord_t, gfx_coord_t);
-extern errno_t ui_paint_minicon(ui_resource_t *, gfx_coord2_t *, gfx_coord_t,
-    gfx_coord_t);
-extern errno_t ui_paint_maxicon(ui_resource_t *, gfx_coord2_t *, gfx_coord_t,
-    gfx_coord_t);
-extern errno_t ui_paint_unmaxicon(ui_resource_t *, gfx_coord2_t *, gfx_coord_t,
-    gfx_coord_t, gfx_coord_t, gfx_coord_t);
-extern errno_t ui_paint_text_box_custom(ui_resource_t *, gfx_rect_t *,
-    ui_box_chars_t *, gfx_color_t *);
-extern errno_t ui_paint_text_box(ui_resource_t *, gfx_rect_t *,
-    ui_box_style_t, gfx_color_t *);
-extern errno_t ui_paint_text_hbrace(ui_resource_t *, gfx_rect_t *,
-    ui_box_style_t, gfx_color_t *);
-extern errno_t ui_paint_text_rect(ui_resource_t *, gfx_rect_t *, gfx_color_t *,
-    const char *);
-extern void ui_text_fmt_init(ui_text_fmt_t *);
-extern gfx_coord_t ui_text_width(gfx_font_t *, const char *);
-extern errno_t ui_paint_text(gfx_coord2_t *, ui_text_fmt_t *, const char *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/pbutton.h
===================================================================
--- uspace/lib/ui/include/ui/pbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Push button
- */
-
-#ifndef _UI_PBUTTON_H
-#define _UI_PBUTTON_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/pbutton.h>
-#include <types/ui/resource.h>
-#include <stdbool.h>
-
-extern errno_t ui_pbutton_create(ui_resource_t *, const char *,
-    ui_pbutton_t **);
-extern void ui_pbutton_destroy(ui_pbutton_t *);
-extern ui_control_t *ui_pbutton_ctl(ui_pbutton_t *);
-extern void ui_pbutton_set_cb(ui_pbutton_t *, ui_pbutton_cb_t *, void *);
-extern void ui_pbutton_set_decor_ops(ui_pbutton_t *, ui_pbutton_decor_ops_t *,
-    void *);
-extern void ui_pbutton_set_flags(ui_pbutton_t *, ui_pbutton_flags_t);
-extern void ui_pbutton_set_rect(ui_pbutton_t *, gfx_rect_t *);
-extern void ui_pbutton_set_default(ui_pbutton_t *, bool);
-extern bool ui_pbutton_get_light(ui_pbutton_t *);
-extern void ui_pbutton_set_light(ui_pbutton_t *, bool);
-extern errno_t ui_pbutton_set_caption(ui_pbutton_t *, const char *);
-extern errno_t ui_pbutton_paint(ui_pbutton_t *);
-extern void ui_pbutton_press(ui_pbutton_t *);
-extern void ui_pbutton_release(ui_pbutton_t *);
-extern void ui_pbutton_enter(ui_pbutton_t *);
-extern void ui_pbutton_leave(ui_pbutton_t *);
-extern void ui_pbutton_clicked(ui_pbutton_t *);
-extern void ui_pbutton_down(ui_pbutton_t *);
-extern void ui_pbutton_up(ui_pbutton_t *);
-extern ui_evclaim_t ui_pbutton_pos_event(ui_pbutton_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/popup.h
===================================================================
--- uspace/lib/ui/include/ui/popup.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Popup window
- */
-
-#ifndef _UI_POPUP_H
-#define _UI_POPUP_H
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <types/ui/control.h>
-#include <types/ui/ui.h>
-#include <types/ui/popup.h>
-#include <types/ui/resource.h>
-#include <types/ui/window.h>
-
-extern void ui_popup_params_init(ui_popup_params_t *);
-extern errno_t ui_popup_create(ui_t *, ui_window_t *, ui_popup_params_t *,
-    ui_popup_t **);
-extern void ui_popup_set_cb(ui_popup_t *, ui_popup_cb_t *, void *);
-extern void ui_popup_destroy(ui_popup_t *);
-extern void ui_popup_add(ui_popup_t *, ui_control_t *);
-extern void ui_popup_remove(ui_popup_t *, ui_control_t *);
-extern ui_resource_t *ui_popup_get_res(ui_popup_t *);
-extern gfx_context_t *ui_popup_get_gc(ui_popup_t *);
-extern sysarg_t ui_popup_get_idev_id(ui_popup_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/promptdialog.h
===================================================================
--- uspace/lib/ui/include/ui/promptdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Prompt dialog
- */
-
-#ifndef _UI_PROMPTDIALOG_H
-#define _UI_PROMPTDIALOG_H
-
-#include <errno.h>
-#include <types/ui/promptdialog.h>
-#include <types/ui/ui.h>
-
-extern void ui_prompt_dialog_params_init(ui_prompt_dialog_params_t *);
-extern errno_t ui_prompt_dialog_create(ui_t *, ui_prompt_dialog_params_t *,
-    ui_prompt_dialog_t **);
-extern void ui_prompt_dialog_set_cb(ui_prompt_dialog_t *, ui_prompt_dialog_cb_t *,
-    void *);
-extern void ui_prompt_dialog_destroy(ui_prompt_dialog_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/rbutton.h
===================================================================
--- uspace/lib/ui/include/ui/rbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Radio button
- */
-
-#ifndef _UI_RBUTTON_H
-#define _UI_RBUTTON_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <types/ui/rbutton.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-#include <stdbool.h>
-
-extern errno_t ui_rbutton_group_create(ui_resource_t *,
-    ui_rbutton_group_t **);
-extern void ui_rbutton_group_destroy(ui_rbutton_group_t *);
-extern errno_t ui_rbutton_create(ui_rbutton_group_t *, const char *, void *,
-    ui_rbutton_t **);
-extern void ui_rbutton_destroy(ui_rbutton_t *);
-extern ui_control_t *ui_rbutton_ctl(ui_rbutton_t *);
-extern void ui_rbutton_group_set_cb(ui_rbutton_group_t *, ui_rbutton_group_cb_t *,
-    void *);
-extern void ui_rbutton_set_rect(ui_rbutton_t *, gfx_rect_t *);
-extern errno_t ui_rbutton_paint(ui_rbutton_t *);
-extern void ui_rbutton_press(ui_rbutton_t *);
-extern void ui_rbutton_release(ui_rbutton_t *);
-extern void ui_rbutton_enter(ui_rbutton_t *);
-extern void ui_rbutton_leave(ui_rbutton_t *);
-extern void ui_rbutton_select(ui_rbutton_t *);
-extern void ui_rbutton_selected(ui_rbutton_t *);
-extern ui_evclaim_t ui_rbutton_pos_event(ui_rbutton_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/resource.h
===================================================================
--- uspace/lib/ui/include/ui/resource.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI resources
- */
-
-#ifndef _UI_RESOURCE_H
-#define _UI_RESOURCE_H
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <stdbool.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_resource_create(gfx_context_t *, bool, ui_resource_t **);
-extern void ui_resource_destroy(ui_resource_t *);
-extern void ui_resource_set_expose_cb(ui_resource_t *, ui_expose_cb_t,
-    void *);
-extern void ui_resource_expose(ui_resource_t *);
-extern gfx_font_t *ui_resource_get_font(ui_resource_t *);
-extern bool ui_resource_is_textmode(ui_resource_t *);
-extern gfx_color_t *ui_resource_get_wnd_face_color(ui_resource_t *);
-extern gfx_color_t *ui_resource_get_wnd_text_color(ui_resource_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/scrollbar.h
===================================================================
--- uspace/lib/ui/include/ui/scrollbar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Scrollbar
- */
-
-#ifndef _UI_SCROLLBAR_H
-#define _UI_SCROLLBAR_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/scrollbar.h>
-#include <types/ui/ui.h>
-#include <types/ui/window.h>
-
-extern errno_t ui_scrollbar_create(ui_t *, ui_window_t *, ui_scrollbar_dir_t,
-    ui_scrollbar_t **);
-extern void ui_scrollbar_destroy(ui_scrollbar_t *);
-extern ui_control_t *ui_scrollbar_ctl(ui_scrollbar_t *);
-extern void ui_scrollbar_set_cb(ui_scrollbar_t *, ui_scrollbar_cb_t *, void *);
-extern void ui_scrollbar_set_rect(ui_scrollbar_t *, gfx_rect_t *);
-extern errno_t ui_scrollbar_paint(ui_scrollbar_t *);
-extern gfx_coord_t ui_scrollbar_trough_length(ui_scrollbar_t *);
-extern gfx_coord_t ui_scrollbar_move_length(ui_scrollbar_t *);
-extern gfx_coord_t ui_scrollbar_get_pos(ui_scrollbar_t *);
-extern void ui_scrollbar_set_thumb_length(ui_scrollbar_t *, gfx_coord_t);
-extern void ui_scrollbar_set_pos(ui_scrollbar_t *, gfx_coord_t);
-extern void ui_scrollbar_thumb_press(ui_scrollbar_t *, gfx_coord2_t *);
-extern void ui_scrollbar_upper_trough_press(ui_scrollbar_t *);
-extern void ui_scrollbar_lower_trough_press(ui_scrollbar_t *);
-extern void ui_scrollbar_release(ui_scrollbar_t *, gfx_coord2_t *);
-extern void ui_scrollbar_update(ui_scrollbar_t *, gfx_coord2_t *);
-extern void ui_scrollbar_troughs_update(ui_scrollbar_t *, gfx_coord2_t *);
-extern void ui_scrollbar_up(ui_scrollbar_t *);
-extern void ui_scrollbar_down(ui_scrollbar_t *);
-extern void ui_scrollbar_page_up(ui_scrollbar_t *);
-extern void ui_scrollbar_page_down(ui_scrollbar_t *);
-extern void ui_scrollbar_moved(ui_scrollbar_t *, gfx_coord_t);
-extern ui_evclaim_t ui_scrollbar_pos_event(ui_scrollbar_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/selectdialog.h
===================================================================
--- uspace/lib/ui/include/ui/selectdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Select dialog
- */
-
-#ifndef _UI_SELECTDIALOG_H
-#define _UI_SELECTDIALOG_H
-
-#include <errno.h>
-#include <types/ui/list.h>
-#include <types/ui/selectdialog.h>
-#include <types/ui/ui.h>
-
-extern void ui_select_dialog_params_init(ui_select_dialog_params_t *);
-extern errno_t ui_select_dialog_create(ui_t *, ui_select_dialog_params_t *,
-    ui_select_dialog_t **);
-extern void ui_select_dialog_set_cb(ui_select_dialog_t *, ui_select_dialog_cb_t *,
-    void *);
-extern void ui_select_dialog_destroy(ui_select_dialog_t *);
-extern errno_t ui_select_dialog_append(ui_select_dialog_t *,
-    ui_list_entry_attr_t *);
-extern errno_t ui_select_dialog_paint(ui_select_dialog_t *);
-extern ui_list_t *ui_select_dialog_list(ui_select_dialog_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/slider.h
===================================================================
--- uspace/lib/ui/include/ui/slider.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Slider
- */
-
-#ifndef _UI_SLIDER_H
-#define _UI_SLIDER_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-#include <types/ui/slider.h>
-
-extern errno_t ui_slider_create(ui_resource_t *, ui_slider_t **);
-extern void ui_slider_destroy(ui_slider_t *);
-extern ui_control_t *ui_slider_ctl(ui_slider_t *);
-extern void ui_slider_set_cb(ui_slider_t *, ui_slider_cb_t *, void *);
-extern void ui_slider_set_rect(ui_slider_t *, gfx_rect_t *);
-extern errno_t ui_slider_paint(ui_slider_t *);
-extern errno_t ui_slider_btn_clear(ui_slider_t *);
-extern gfx_coord_t ui_slider_length(ui_slider_t *);
-extern void ui_slider_press(ui_slider_t *, gfx_coord2_t *);
-extern void ui_slider_release(ui_slider_t *, gfx_coord2_t *);
-extern void ui_slider_update(ui_slider_t *, gfx_coord2_t *);
-extern void ui_slider_moved(ui_slider_t *, gfx_coord_t);
-extern ui_evclaim_t ui_slider_pos_event(ui_slider_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/tab.h
===================================================================
--- uspace/lib/ui/include/ui/tab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab
- */
-
-#ifndef _UI_TAB_H
-#define _UI_TAB_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/control.h>
-#include <types/ui/tab.h>
-#include <types/ui/tabset.h>
-#include <types/ui/event.h>
-#include <uchar.h>
-
-extern errno_t ui_tab_create(ui_tab_set_t *, const char *, ui_tab_t **);
-extern void ui_tab_destroy(ui_tab_t *);
-extern ui_tab_t *ui_tab_first(ui_tab_set_t *);
-extern ui_tab_t *ui_tab_next(ui_tab_t *);
-extern ui_tab_t *ui_tab_last(ui_tab_set_t *);
-extern ui_tab_t *ui_tab_prev(ui_tab_t *);
-extern bool ui_tab_is_selected(ui_tab_t *);
-extern void ui_tab_add(ui_tab_t *, ui_control_t *);
-extern void ui_tab_remove(ui_tab_t *, ui_control_t *);
-extern errno_t ui_tab_paint(ui_tab_t *);
-extern ui_evclaim_t ui_tab_kbd_event(ui_tab_t *, kbd_event_t *);
-extern ui_evclaim_t ui_tab_pos_event(ui_tab_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/tabset.h
===================================================================
--- uspace/lib/ui/include/ui/tabset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab set
- */
-
-#ifndef _UI_TABSET_H
-#define _UI_TABSET_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/ui/tabset.h>
-#include <types/ui/control.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-
-extern errno_t ui_tab_set_create(ui_resource_t *, ui_tab_set_t **);
-extern void ui_tab_set_destroy(ui_tab_set_t *);
-extern ui_control_t *ui_tab_set_ctl(ui_tab_set_t *);
-extern void ui_tab_set_set_rect(ui_tab_set_t *, gfx_rect_t *);
-extern errno_t ui_tab_set_paint(ui_tab_set_t *);
-extern ui_evclaim_t ui_tab_set_kbd_event(ui_tab_set_t *, kbd_event_t *);
-extern ui_evclaim_t ui_tab_set_pos_event(ui_tab_set_t *, pos_event_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/testctl.h
===================================================================
--- uspace/lib/ui/include/ui/testctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Test control
- */
-
-#ifndef _UI_TESTCTL_H
-#define _UI_TESTCTL_H
-
-#include <errno.h>
-#include <types/ui/control.h>
-#include <types/ui/testctl.h>
-
-extern errno_t ui_test_ctl_create(ui_tc_resp_t *, ui_test_ctl_t **);
-extern void ui_test_ctl_destroy(ui_test_ctl_t *);
-extern ui_control_t *ui_test_ctl_ctl(ui_test_ctl_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/ui.h
===================================================================
--- uspace/lib/ui/include/ui/ui.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file User interface
- */
-
-#ifndef _UI_UI_H
-#define _UI_UI_H
-
-#include <display.h>
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/console.h>
-#include <stdbool.h>
-#include <types/ui/clickmatic.h>
-#include <types/ui/ui.h>
-
-extern errno_t ui_create(const char *, ui_t **);
-extern errno_t ui_create_cons(console_ctrl_t *, ui_t **);
-extern errno_t ui_create_disp(display_t *, ui_t **);
-extern void ui_destroy(ui_t *);
-extern void ui_quit(ui_t *);
-extern void ui_run(ui_t *);
-extern errno_t ui_paint(ui_t *);
-extern bool ui_is_textmode(ui_t *);
-extern bool ui_is_fullscreen(ui_t *);
-extern errno_t ui_get_rect(ui_t *, gfx_rect_t *);
-extern errno_t ui_suspend(ui_t *);
-extern errno_t ui_resume(ui_t *);
-extern bool ui_is_suspended(ui_t *);
-extern void ui_lock(ui_t *);
-extern void ui_unlock(ui_t *);
-extern ui_clickmatic_t *ui_get_clickmatic(ui_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/wdecor.h
===================================================================
--- uspace/lib/ui/include/ui/wdecor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window decoration
- */
-
-#ifndef _UI_WDECOR_H
-#define _UI_WDECOR_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/ui/event.h>
-#include <types/ui/resource.h>
-#include <types/ui/ui.h>
-#include <types/ui/wdecor.h>
-
-extern errno_t ui_wdecor_create(ui_resource_t *, const char *,
-    ui_wdecor_style_t, ui_wdecor_t **);
-extern void ui_wdecor_destroy(ui_wdecor_t *);
-extern void ui_wdecor_set_cb(ui_wdecor_t *, ui_wdecor_cb_t *, void *);
-extern void ui_wdecor_set_rect(ui_wdecor_t *, gfx_rect_t *);
-extern void ui_wdecor_set_active(ui_wdecor_t *, bool);
-extern void ui_wdecor_set_maximized(ui_wdecor_t *, bool);
-extern errno_t ui_wdecor_set_caption(ui_wdecor_t *, const char *);
-extern void ui_wdecor_sysmenu_hdl_set_active(ui_wdecor_t *, bool);
-extern errno_t ui_wdecor_paint(ui_wdecor_t *);
-extern ui_evclaim_t ui_wdecor_kbd_event(ui_wdecor_t *, kbd_event_t *);
-extern ui_evclaim_t ui_wdecor_pos_event(ui_wdecor_t *, pos_event_t *);
-extern void ui_wdecor_rect_from_app(ui_t *, ui_wdecor_style_t, gfx_rect_t *,
-    gfx_rect_t *);
-extern void ui_wdecor_app_from_rect(ui_wdecor_style_t, gfx_rect_t *,
-    gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/include/ui/window.h
===================================================================
--- uspace/lib/ui/include/ui/window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window
- */
-
-#ifndef _UI_WINDOW_H
-#define _UI_WINDOW_H
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <types/common.h>
-#include <types/ui/control.h>
-#include <types/ui/ui.h>
-#include <types/ui/resource.h>
-#include <types/ui/window.h>
-
-extern void ui_wnd_params_init(ui_wnd_params_t *);
-extern errno_t ui_window_create(ui_t *, ui_wnd_params_t *,
-    ui_window_t **);
-extern void ui_window_set_cb(ui_window_t *, ui_window_cb_t *, void *);
-extern errno_t ui_window_set_caption(ui_window_t *, const char *);
-extern void ui_window_destroy(ui_window_t *);
-extern void ui_window_add(ui_window_t *, ui_control_t *);
-extern void ui_window_remove(ui_window_t *, ui_control_t *);
-extern ui_window_t *ui_window_get_active(ui_t *);
-extern errno_t ui_window_resize(ui_window_t *, gfx_rect_t *);
-extern ui_t *ui_window_get_ui(ui_window_t *);
-extern ui_resource_t *ui_window_get_res(ui_window_t *);
-extern gfx_context_t *ui_window_get_gc(ui_window_t *);
-extern errno_t ui_window_get_pos(ui_window_t *, gfx_coord2_t *);
-extern errno_t ui_window_get_app_gc(ui_window_t *, gfx_context_t **);
-extern void ui_window_get_app_rect(ui_window_t *, gfx_rect_t *);
-extern void ui_window_set_ctl_cursor(ui_window_t *, ui_stock_cursor_t);
-extern errno_t ui_window_paint(ui_window_t *);
-extern errno_t ui_window_def_sysmenu(ui_window_t *, sysarg_t);
-extern errno_t ui_window_def_minimize(ui_window_t *);
-extern errno_t ui_window_def_maximize(ui_window_t *);
-extern errno_t ui_window_def_unmaximize(ui_window_t *);
-extern ui_evclaim_t ui_window_def_kbd(ui_window_t *, kbd_event_t *);
-extern errno_t ui_window_def_paint(ui_window_t *);
-extern void ui_window_def_pos(ui_window_t *, pos_event_t *);
-extern void ui_window_def_unfocus(ui_window_t *, unsigned);
-extern void ui_window_def_resize(ui_window_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/meson.build
===================================================================
--- uspace/lib/ui/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'gfx', 'gfxfont', 'memgfx', 'display', 'congfx', 'clipboard' ]
-src = files(
-	'src/accel.c',
-	'src/checkbox.c',
-	'src/clickmatic.c',
-	'src/control.c',
-	'src/dummygc.c',
-	'src/entry.c',
-	'src/filedialog.c',
-	'src/filelist.c',
-	'src/fixed.c',
-	'src/image.c',
-	'src/label.c',
-	'src/list.c',
-	'src/menu.c',
-	'src/menubar.c',
-	'src/menudd.c',
-	'src/menuentry.c',
-	'src/msgdialog.c',
-	'src/paint.c',
-	'src/pbutton.c',
-	'src/popup.c',
-	'src/promptdialog.c',
-	'src/rbutton.c',
-	'src/resource.c',
-	'src/scrollbar.c',
-	'src/selectdialog.c',
-	'src/slider.c',
-	'src/tab.c',
-	'src/tabset.c',
-	'src/testctl.c',
-	'src/ui.c',
-	'src/wdecor.c',
-	'src/window.c',
-)
-
-test_src = files(
-	'test/accel.c',
-	'test/checkbox.c',
-	'test/clickmatic.c',
-	'test/control.c',
-	'test/entry.c',
-	'test/filedialog.c',
-	'test/filelist.c',
-	'test/fixed.c',
-	'test/image.c',
-	'test/label.c',
-	'test/list.c',
-	'test/main.c',
-	'test/menu.c',
-	'test/menubar.c',
-	'test/menudd.c',
-	'test/menuentry.c',
-	'test/msgdialog.c',
-	'test/paint.c',
-	'test/pbutton.c',
-	'test/popup.c',
-	'test/promptdialog.c',
-	'test/rbutton.c',
-	'test/resource.c',
-	'test/scrollbar.c',
-	'test/selectdialog.c',
-	'test/slider.c',
-	'test/tab.c',
-	'test/tabset.c',
-	'test/testctl.c',
-	'test/ui.c',
-	'test/wdecor.c',
-	'test/window.c',
-)
Index: pace/lib/ui/private/checkbox.h
===================================================================
--- uspace/lib/ui/private/checkbox.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Check box structure
- *
- */
-
-#ifndef _UI_PRIVATE_CHECKBOX_H
-#define _UI_PRIVATE_CHECKBOX_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-
-/** Actual structure of check box.
- *
- * This is private to libui.
- */
-struct ui_checkbox {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI resource */
-	struct ui_resource *res;
-	/** Callbacks */
-	struct ui_checkbox_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Check box rectangle */
-	gfx_rect_t rect;
-	/** Caption */
-	const char *caption;
-	/** Check box is checked */
-	bool checked;
-	/** Check box is currently held down */
-	bool held;
-	/** Pointer is currently inside */
-	bool inside;
-};
-
-extern errno_t ui_checkbox_paint_gfx(ui_checkbox_t *);
-extern errno_t ui_checkbox_paint_text(ui_checkbox_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/clickmatic.h
===================================================================
--- uspace/lib/ui/private/clickmatic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clickmatic structure
- *
- */
-
-#ifndef _UI_PRIVATE_CLICKMATIC_H
-#define _UI_PRIVATE_CLICKMATIC_H
-
-#include <fibril_synch.h>
-#include <gfx/coord.h>
-
-/** Actual structure of clickmatic.
- *
- * This is private to libui.
- */
-struct ui_clickmatic {
-	/** Containing user interface */
-	struct ui *ui;
-	/** Callbacks */
-	struct ui_clickmatic_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Click position */
-	gfx_coord2_t pos;
-	/** Timer */
-	fibril_timer_t *timer;
-};
-
-extern void ui_clickmatic_clicked(ui_clickmatic_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/control.h
===================================================================
--- uspace/lib/ui/private/control.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI control structure
- *
- */
-
-#ifndef _UI_PRIVATE_CONTROL_H
-#define _UI_PRIVATE_CONTROL_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-
-/** Actual structure of UI control.
- *
- * UI control is the abstract base class to all UI controls (e.g. push button,
- * label). This is private to libui.
- */
-struct ui_control {
-	/** Pointer to layout element structure this control is attached to
-	 * or @c NULL if the control is not attached to a layout
-	 */
-	void *elemp;
-	/** Ops */
-	struct ui_control_ops *ops;
-	/** Extended data */
-	void *ext;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/dummygc.h
===================================================================
--- uspace/lib/ui/private/dummygc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Dummy graphic context
- *
- */
-
-#ifndef _UI_PRIVATE_DUMMYGC_H
-#define _UI_PRIVATE_DUMMYGC_H
-
-#include <gfx/context.h>
-
-/** Dummy graphic context */
-typedef struct {
-	gfx_context_t *gc;
-	bool bm_created;
-	bool bm_destroyed;
-	gfx_bitmap_params_t bm_params;
-	void *bm_pixels;
-	gfx_rect_t bm_srect;
-	gfx_coord2_t bm_offs;
-	bool bm_rendered;
-	bool bm_got_alloc;
-} dummy_gc_t;
-
-/** Dummy GC bitmap */
-typedef struct {
-	dummy_gc_t *dgc;
-	gfx_bitmap_alloc_t alloc;
-	bool myalloc;
-} dummygc_bitmap_t;
-
-/** Dummy GC ops */
-extern gfx_context_ops_t dummygc_ops;
-
-extern errno_t dummygc_create(dummy_gc_t **);
-extern void dummygc_destroy(dummy_gc_t *);
-extern gfx_context_t *dummygc_get_ctx(dummy_gc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/entry.h
===================================================================
--- uspace/lib/ui/private/entry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Text entry structure
- *
- */
-
-#ifndef _UI_PRIVATE_ENTRY_H
-#define _UI_PRIVATE_ENTRY_H
-
-#include <gfx/coord.h>
-#include <gfx/text.h>
-#include <stdbool.h>
-
-/** Actual structure of text entry.
- *
- * This is private to libui.
- */
-struct ui_entry {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI window */
-	struct ui_window *window;
-	/** Entry rectangle */
-	gfx_rect_t rect;
-	/** Horizontal alignment */
-	gfx_halign_t halign;
-	/** Text entry is read-only */
-	bool read_only;
-	/** Text */
-	char *text;
-	/** Current scroll position (in pixels) */
-	gfx_coord_t scroll_pos;
-	/** Cursor position in the text (offset in bytes) */
-	unsigned pos;
-	/** Selection start position in text (offset in bytes) */
-	unsigned sel_start;
-	/** Pointer is currently inside */
-	bool pointer_inside;
-	/** Entry is activated */
-	bool active;
-	/** Button is held down */
-	bool held;
-	/** Left shift is held down */
-	bool lshift_held;
-	/** Right shift is held down */
-	bool rshift_held;
-};
-
-/** Text entry geometry.
- *
- * Computed geometry of text entry elements.
- */
-typedef struct {
-	/** Interior rectangle */
-	gfx_rect_t interior_rect;
-	/** Text rectangle */
-	gfx_rect_t text_rect;
-	/** Text anchor position */
-	gfx_coord2_t text_pos;
-	/** Text anchor X coordinate */
-	gfx_coord_t anchor_x;
-} ui_entry_geom_t;
-
-extern ui_evclaim_t ui_entry_key_press_ctrl(ui_entry_t *, kbd_event_t *);
-extern ui_evclaim_t ui_entry_key_press_shift(ui_entry_t *, kbd_event_t *);
-extern ui_evclaim_t ui_entry_key_press_unmod(ui_entry_t *, kbd_event_t *);
-extern void ui_entry_get_geom(ui_entry_t *, ui_entry_geom_t *);
-extern size_t ui_entry_find_pos(ui_entry_t *, gfx_coord2_t *);
-extern void ui_entry_delete_sel(ui_entry_t *);
-extern void ui_entry_scroll_update(ui_entry_t *, bool);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/filedialog.h
===================================================================
--- uspace/lib/ui/private/filedialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File dialog structure
- *
- */
-
-#ifndef _UI_PRIVATE_FILEDIALOG_H
-#define _UI_PRIVATE_FILEDIALOG_H
-
-/** Actual structure of file dialog.
- *
- * This is private to libui.
- */
-struct ui_file_dialog {
-	/** Dialog window */
-	struct ui_window *window;
-	/** File name entry */
-	struct ui_entry *ename;
-	/** File list */
-	struct ui_file_list *flist;
-	/** OK button */
-	struct ui_pbutton *bok;
-	/** Cancel button */
-	struct ui_pbutton *bcancel;
-	/** File dialog callbacks */
-	struct ui_file_dialog_cb *cb;
-	/** Callback argument */
-	void *arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/filelist.h
===================================================================
--- uspace/lib/ui/private/filelist.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File list
- */
-
-#ifndef _UI_PRIVATE_FILELIST_H
-#define _UI_PRIVATE_FILELIST_H
-
-#include <gfx/color.h>
-#include <ipc/loc.h>
-#include <ui/list.h>
-#include <ui/window.h>
-#include <stdint.h>
-#include <types/ui/filelist.h>
-
-/** File list entry */
-struct ui_file_list_entry {
-	/** Containing file list */
-	struct ui_file_list *flist;
-	/** List entry */
-	ui_list_entry_t *entry;
-	/** File name */
-	char *name;
-	/** File size */
-	uint64_t size;
-	/** @c true iff entry is a directory */
-	bool isdir;
-	/** Service number for service special entries */
-	service_id_t svc;
-};
-
-/** File list.
- *
- * Allows browsing files and directories.
- */
-typedef struct ui_file_list {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	struct ui_window *window;
-
-	/** UI list */
-	ui_list_t *list;
-
-	/** Callbacks */
-	struct ui_file_list_cb *cb;
-
-	/** Callback argument */
-	void *cb_arg;
-
-	/** Directory-type entry color */
-	gfx_color_t *dir_color;
-
-	/** Service-type entry color */
-	gfx_color_t *svc_color;
-
-	/** Directory */
-	char *dir;
-} ui_file_list_t;
-
-extern bool ui_file_list_is_active(ui_file_list_t *);
-extern void ui_file_list_entry_destroy(ui_file_list_entry_t *);
-extern void ui_file_list_clear_entries(ui_file_list_t *);
-extern errno_t ui_file_list_sort(ui_file_list_t *);
-extern int ui_file_list_entry_ptr_cmp(const void *, const void *);
-extern void ui_file_list_entry_attr_init(ui_file_list_entry_attr_t *);
-extern errno_t ui_file_list_entry_append(ui_file_list_t *,
-    ui_file_list_entry_attr_t *);
-extern ui_file_list_entry_t *ui_file_list_first(ui_file_list_t *);
-extern ui_file_list_entry_t *ui_file_list_last(ui_file_list_t *);
-extern ui_file_list_entry_t *ui_file_list_next(ui_file_list_entry_t *);
-extern ui_file_list_entry_t *ui_file_list_prev(ui_file_list_entry_t *);
-extern errno_t ui_file_list_open_dir(ui_file_list_t *, ui_file_list_entry_t *);
-extern errno_t ui_file_list_open_file(ui_file_list_t *, ui_file_list_entry_t *);
-extern void ui_file_list_activate_req(ui_file_list_t *);
-extern void ui_file_list_selected(ui_file_list_t *, const char *);
-extern errno_t ui_file_list_paint(ui_file_list_t *);
-extern int ui_file_list_list_compare(ui_list_entry_t *, ui_list_entry_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/fixed.h
===================================================================
--- uspace/lib/ui/private/fixed.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Fixed layout structure
- *
- */
-
-#ifndef _UI_PRIVATE_FIXED_H
-#define _UI_PRIVATE_FIXED_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/ui/fixed.h>
-
-/** Actual structure of fixed layout.
- *
- * This is private to libui.
- */
-struct ui_fixed {
-	/** Base control object */
-	struct ui_control *control;
-	/** Layout elements (ui_fixed_elem_t) */
-	list_t elem;
-};
-
-/** Fixed layout element. */
-typedef struct {
-	/** Containing fixed layout */
-	struct ui_fixed *fixed;
-	/** Link to @c fixed->elem list */
-	link_t lelems;
-	/** Control */
-	ui_control_t *control;
-} ui_fixed_elem_t;
-
-extern ui_fixed_elem_t *ui_fixed_first(ui_fixed_t *f);
-extern ui_fixed_elem_t *ui_fixed_next(ui_fixed_elem_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/image.h
===================================================================
--- uspace/lib/ui/private/image.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Image structure
- *
- */
-
-#ifndef _UI_PRIVATE_IMAGE_H
-#define _UI_PRIVATE_IMAGE_H
-
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-
-/** Actual structure of image.
- *
- * This is private to libui.
- */
-struct ui_image {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI resource */
-	struct ui_resource *res;
-	/** Image rectangle */
-	gfx_rect_t rect;
-	/** Flags */
-	ui_image_flags_t flags;
-	/** Bitmap */
-	gfx_bitmap_t *bitmap;
-	/** Bitmap rectangle */
-	gfx_rect_t brect;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/label.h
===================================================================
--- uspace/lib/ui/private/label.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Label structure
- *
- */
-
-#ifndef _UI_PRIVATE_LABEL_H
-#define _UI_PRIVATE_LABEL_H
-
-#include <gfx/coord.h>
-#include <gfx/text.h>
-
-/** Actual structure of label.
- *
- * This is private to libui.
- */
-struct ui_label {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI resource */
-	struct ui_resource *res;
-	/** Label rectangle */
-	gfx_rect_t rect;
-	/** Horizontal alignment */
-	gfx_halign_t halign;
-	/** Vertical alignment */
-	gfx_valign_t valign;
-	/** Text */
-	char *text;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/list.h
===================================================================
--- uspace/lib/ui/private/list.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI list
- */
-
-#ifndef _UI_PRIVATE_LIST_H
-#define _UI_PRIVATE_LIST_H
-
-#include <adt/list.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <ipc/loc.h>
-#include <ui/window.h>
-#include <stdint.h>
-#include <types/ui/list.h>
-
-/** List entry */
-struct ui_list_entry {
-	/** Containing list */
-	struct ui_list *list;
-	/** Link to @c flist->entries */
-	link_t lentries;
-	/** Entry caption */
-	char *caption;
-	/** User argument */
-	void *arg;
-	/** Custom color or @c NULL to use default color */
-	gfx_color_t *color;
-	/** Custom background color or @c NULL to use default color */
-	gfx_color_t *bgcolor;
-};
-
-/** UI list.
- *
- * Displays a scrollable list of entries.
- */
-typedef struct ui_list {
-	/** Base control object */
-	struct ui_control *control;
-
-	/** Containing window */
-	ui_window_t *window;
-
-	/** Callbacks */
-	struct ui_list_cb *cb;
-
-	/** Callback argument */
-	void *cb_arg;
-
-	/** List rectangle */
-	gfx_rect_t rect;
-
-	/** Scrollbar */
-	struct ui_scrollbar *scrollbar;
-
-	/** List entries (list of ui_list_entry_t) */
-	list_t entries;
-
-	/** Number of entries */
-	size_t entries_cnt;
-
-	/** First entry of current page */
-	ui_list_entry_t *page;
-
-	/** Index of first entry of current page */
-	size_t page_idx;
-
-	/** Cursor position */
-	ui_list_entry_t *cursor;
-
-	/** Index of entry under cursor */
-	size_t cursor_idx;
-
-	/** @c true iff the list is active */
-	bool active;
-} ui_list_t;
-
-extern gfx_coord_t ui_list_entry_height(ui_list_t *);
-extern errno_t ui_list_entry_paint(ui_list_entry_t *, size_t);
-extern errno_t ui_list_paint(ui_list_t *);
-extern ui_evclaim_t ui_list_kbd_event(ui_list_t *, kbd_event_t *);
-extern ui_evclaim_t ui_list_pos_event(ui_list_t *, pos_event_t *);
-extern unsigned ui_list_page_size(ui_list_t *);
-extern void ui_list_inside_rect(ui_list_t *, gfx_rect_t *);
-extern void ui_list_scrollbar_rect(ui_list_t *, gfx_rect_t *);
-extern gfx_coord_t ui_list_scrollbar_pos(ui_list_t *);
-extern void ui_list_scrollbar_update(ui_list_t *);
-extern void ui_list_clear_entries(ui_list_t *);
-extern ui_list_entry_t *ui_list_page_nth_entry(ui_list_t *,
-    size_t, size_t *);
-extern void ui_list_cursor_move(ui_list_t *, ui_list_entry_t *,
-    size_t);
-extern void ui_list_cursor_up(ui_list_t *);
-extern void ui_list_cursor_down(ui_list_t *);
-extern void ui_list_cursor_top(ui_list_t *);
-extern void ui_list_cursor_bottom(ui_list_t *);
-extern void ui_list_page_up(ui_list_t *);
-extern void ui_list_page_down(ui_list_t *);
-extern void ui_list_scroll_up(ui_list_t *);
-extern void ui_list_scroll_down(ui_list_t *);
-extern void ui_list_scroll_page_up(ui_list_t *);
-extern void ui_list_scroll_page_down(ui_list_t *);
-extern void ui_list_scroll_pos(ui_list_t *, size_t);
-extern void ui_list_activate_req(ui_list_t *);
-extern void ui_list_selected(ui_list_entry_t *);
-extern int ui_list_entry_ptr_cmp(const void *, const void *);
-extern size_t ui_list_entry_get_idx(ui_list_entry_t *);
-extern void ui_list_entry_destroy(ui_list_entry_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/menu.h
===================================================================
--- uspace/lib/ui/private/menu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,101 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu structure
- *
- */
-
-#ifndef _UI_PRIVATE_MENU_H
-#define _UI_PRIVATE_MENU_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/menu.h>
-#include <types/ui/resource.h>
-
-/** Actual structure of menu.
- *
- * This is private to libui.
- */
-struct ui_menu {
-	/** Parent window */
-	struct ui_window *parent;
-	/** Caption */
-	char *caption;
-	/** Popup window or @c NULL if menu is not currently open */
-	struct ui_popup *popup;
-	/** Selected menu entry or @c NULL */
-	struct ui_menu_entry *selected;
-	/** Maximum caption width */
-	gfx_coord_t max_caption_w;
-	/** Maximum shortcut width */
-	gfx_coord_t max_shortcut_w;
-	/** Total entry height */
-	gfx_coord_t total_h;
-	/** Menu entries (ui_menu_entry_t) */
-	list_t entries;
-	/** Callbacks */
-	struct ui_menu_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** ID of device that activated entry */
-	sysarg_t idev_id;
-};
-
-/** Menu geometry.
- *
- * Computed rectangles of menu elements.
- */
-typedef struct {
-	/** Outer rectangle */
-	gfx_rect_t outer_rect;
-	/** Entries rectangle */
-	gfx_rect_t entries_rect;
-} ui_menu_geom_t;
-
-extern void ui_menu_get_geom(ui_menu_t *, gfx_coord2_t *, ui_menu_geom_t *);
-extern ui_resource_t *ui_menu_get_res(ui_menu_t *);
-extern errno_t ui_menu_paint_bg_gfx(ui_menu_t *, gfx_coord2_t *);
-extern errno_t ui_menu_paint_bg_text(ui_menu_t *, gfx_coord2_t *);
-extern void ui_menu_up(ui_menu_t *);
-extern void ui_menu_down(ui_menu_t *);
-extern void ui_menu_left(ui_menu_t *, sysarg_t);
-extern void ui_menu_right(ui_menu_t *, sysarg_t);
-extern void ui_menu_close_req(ui_menu_t *);
-extern void ui_menu_press_accel(ui_menu_t *, char32_t, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/menubar.h
===================================================================
--- uspace/lib/ui/private/menubar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,83 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu bar structure
- *
- */
-
-#ifndef _UI_PRIVATE_MENUBAR_H
-#define _UI_PRIVATE_MENUBAR_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/menubar.h>
-#include <types/ui/menudd.h>
-
-/** Actual structure of menu bar.
- *
- * This is private to libui.
- */
-struct ui_menu_bar {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI */
-	struct ui *ui;
-	/** UI window containing menu bar */
-	struct ui_window *window;
-	/** Menu bar rectangle */
-	gfx_rect_t rect;
-	/** Menu bar is active */
-	bool active;
-	/** Selected menu drop-down or @c NULL */
-	struct ui_menu_dd *selected;
-	/** List of menu drop-downs (ui_menu_dd_t) */
-	list_t menudds;
-	/** Callbacks */
-	struct ui_menu_bar_cb *cb;
-	/** Callback argument */
-	void *arg;
-};
-
-extern void ui_menu_bar_select(ui_menu_bar_t *, ui_menu_dd_t *, bool, sysarg_t);
-extern void ui_menu_bar_select_sysmenu(ui_menu_bar_t *, bool, sysarg_t);
-extern void ui_menu_bar_left(ui_menu_bar_t *, sysarg_t);
-extern void ui_menu_bar_right(ui_menu_bar_t *, sysarg_t);
-extern ui_evclaim_t ui_menu_bar_key_press_unmod(ui_menu_bar_t *, kbd_event_t *);
-extern void ui_menu_bar_entry_rect(ui_menu_bar_t *, ui_menu_dd_t *,
-    gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/menudd.h
===================================================================
--- uspace/lib/ui/private/menudd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu drop-down structure
- *
- */
-
-#ifndef _UI_PRIVATE_MENUDD_H
-#define _UI_PRIVATE_MENUDD_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/ui/menudd.h>
-#include <types/ui/resource.h>
-
-/** Actual structure of menu drop-down.
- *
- * This is private to libui.
- */
-struct ui_menu_dd {
-	/** Containing menu bar */
-	struct ui_menu_bar *mbar;
-	/** Link to @c bar->menudds */
-	link_t lmenudds;
-	/** Caption */
-	char *caption;
-	/** Popup window or @c NULL if drop-down is not currently open */
-	struct ui_popup *popup;
-	/** Actual menu */
-	struct ui_menu *menu;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/menuentry.h
===================================================================
--- uspace/lib/ui/private/menuentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu entry structure
- *
- */
-
-#ifndef _UI_PRIVATE_MENUENTRY_H
-#define _UI_PRIVATE_MENUENTRY_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <types/ui/menuentry.h>
-
-/** Actual structure of menu entry.
- *
- * This is private to libui.
- */
-struct ui_menu_entry {
-	/** Containing menu */
-	struct ui_menu *menu;
-	/** Link to @c menu->entries */
-	link_t lentries;
-	/** Callbacks */
-	ui_menu_entry_cb_t cb;
-	/** This entry is disabled */
-	bool disabled;
-	/** This entry is a separator entry */
-	bool separator;
-	/** Menu entry is currently held down */
-	bool held;
-	/** Pointer is currently inside */
-	bool inside;
-	/** Callback argument */
-	void *arg;
-	/** Caption */
-	char *caption;
-	/** Shortcut key(s) */
-	char *shortcut;
-};
-
-/** Menu entry geometry.
- *
- * Computed positions of menu entry elements.
- */
-typedef struct {
-	/** Outer rectangle */
-	gfx_rect_t outer_rect;
-	/** Caption position */
-	gfx_coord2_t caption_pos;
-	/** Shortcut position */
-	gfx_coord2_t shortcut_pos;
-} ui_menu_entry_geom_t;
-
-extern void ui_menu_entry_get_geom(ui_menu_entry_t *, gfx_coord2_t *,
-    ui_menu_entry_geom_t *);
-extern void ui_menu_entry_cb(ui_menu_entry_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/msgdialog.h
===================================================================
--- uspace/lib/ui/private/msgdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Message dialog structure
- *
- */
-
-#ifndef _UI_PRIVATE_MSGDIALOG_H
-#define _UI_PRIVATE_MSGDIALOG_H
-
-#include <types/ui/msgdialog.h>
-#include <ui/pbutton.h>
-#include <ui/window.h>
-
-/** Actual structure of message dialog.
- *
- * This is private to libui.
- */
-struct ui_msg_dialog {
-	/** Dialog window */
-	struct ui_window *window;
-	/** Buttons */
-	struct ui_pbutton *btn[ui_msg_dialog_maxbtn];
-	/** Message dialog callbacks */
-	struct ui_msg_dialog_cb *cb;
-	/** Callback argument */
-	void *arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/pbutton.h
===================================================================
--- uspace/lib/ui/private/pbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Push button structure
- *
- */
-
-#ifndef _UI_PRIVATE_PBUTTON_H
-#define _UI_PRIVATE_PBUTTON_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/ui/pbutton.h>
-
-/** Actual structure of push button.
- *
- * This is private to libui.
- */
-struct ui_pbutton {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI resource */
-	struct ui_resource *res;
-	/** Callbacks */
-	struct ui_pbutton_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Custom decoration ops or @c NULL */
-	struct ui_pbutton_decor_ops *decor_ops;
-	/** Decoration argument */
-	void *decor_arg;
-	/** Push button rectangle */
-	gfx_rect_t rect;
-	/** Caption */
-	char *caption;
-	/** Button is selected as default */
-	bool isdefault;
-	/** Button light is on */
-	bool light;
-	/** Button is currently held down */
-	bool held;
-	/** Pointer is currently inside */
-	bool inside;
-	/** Push button flags */
-	ui_pbutton_flags_t flags;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/popup.h
===================================================================
--- uspace/lib/ui/private/popup.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Popup structure
- *
- */
-
-#ifndef _UI_PRIVATE_POPUP_H
-#define _UI_PRIVATE_POPUP_H
-
-#include <gfx/coord.h>
-#include <types/ui/window.h>
-
-/** Actual structure of popup window.
- *
- * This is private to libui.
- */
-struct ui_popup {
-	/** Containing user interface */
-	struct ui *ui;
-	/** Callbacks */
-	struct ui_popup_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Parent window */
-	struct ui_window *parent;
-	/** Window */
-	struct ui_window *window;
-	/** Placement rectangle */
-	gfx_rect_t place;
-	/** ID of device that sent input event */
-	sysarg_t idev_id;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/promptdialog.h
===================================================================
--- uspace/lib/ui/private/promptdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Prompt dialog structure
- *
- */
-
-#ifndef _UI_PRIVATE_PROMPTDIALOG_H
-#define _UI_PRIVATE_PROMPTDIALOG_H
-
-/** Actual structure of prompt dialog.
- *
- * This is private to libui.
- */
-struct ui_prompt_dialog {
-	/** Dialog window */
-	struct ui_window *window;
-	/** Text entry */
-	struct ui_entry *ename;
-	/** OK button */
-	struct ui_pbutton *bok;
-	/** Cancel button */
-	struct ui_pbutton *bcancel;
-	/** Prompt dialog callbacks */
-	struct ui_prompt_dialog_cb *cb;
-	/** Callback argument */
-	void *arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/rbutton.h
===================================================================
--- uspace/lib/ui/private/rbutton.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Radio button structure
- *
- */
-
-#ifndef _UI_PRIVATE_RBUTTON_H
-#define _UI_PRIVATE_RBUTTON_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-
-/** Actual structure of radio button group.
- *
- * This is private to libui.
- */
-struct ui_rbutton_group {
-	/** UI resource */
-	struct ui_resource *res;
-	/** Callbacks */
-	struct ui_rbutton_group_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Selected button */
-	struct ui_rbutton *selected;
-};
-
-/** Actual structure of radio button.
- *
- * This is private to libui.
- */
-struct ui_rbutton {
-	/** Base control object */
-	struct ui_control *control;
-	/** Containing radio button group */
-	struct ui_rbutton_group *group;
-	/** Callback argument */
-	void *arg;
-	/** Radio button rectangle */
-	gfx_rect_t rect;
-	/** Caption */
-	const char *caption;
-	/** Radio button is currently held down */
-	bool held;
-	/** Pointer is currently inside */
-	bool inside;
-};
-
-extern errno_t ui_rbutton_paint_gfx(ui_rbutton_t *);
-extern errno_t ui_rbutton_paint_text(ui_rbutton_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/resource.h
===================================================================
--- uspace/lib/ui/private/resource.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Resource structure
- *
- */
-
-#ifndef _UI_PRIVATE_RESOURCE_H
-#define _UI_PRIVATE_RESOURCE_H
-
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/typeface.h>
-#include <stdbool.h>
-#include <types/ui/resource.h>
-
-/** Actual structure of UI resources.
- *
- * Contains resources common accross the entire UI. This is private to libui.
- */
-struct ui_resource {
-	/** Graphic context */
-	gfx_context_t *gc;
-	/** Typeface */
-	gfx_typeface_t *tface;
-	/** Font */
-	gfx_font_t *font;
-	/** Text mode */
-	bool textmode;
-
-	/** UI background color */
-	gfx_color_t *ui_bg_color;
-
-	/** Button frame color */
-	gfx_color_t *btn_frame_color;
-	/** Button face color */
-	gfx_color_t *btn_face_color;
-	/** Lit button face color */
-	gfx_color_t *btn_face_lit_color;
-	/** Button text color */
-	gfx_color_t *btn_text_color;
-	/** Button highlight color */
-	gfx_color_t *btn_highlight_color;
-	/** Button shadow color */
-	gfx_color_t *btn_shadow_color;
-
-	/** Window face color */
-	gfx_color_t *wnd_face_color;
-	/** Window text color */
-	gfx_color_t *wnd_text_color;
-	/** Disabled text color */
-	gfx_color_t *wnd_dis_text_color;
-	/** Window text highlight color */
-	gfx_color_t *wnd_text_hgl_color;
-	/** Window selected text color */
-	gfx_color_t *wnd_sel_text_color;
-	/** Window selected text highlight color */
-	gfx_color_t *wnd_sel_text_hgl_color;
-	/** Window selected text background color */
-	gfx_color_t *wnd_sel_text_bg_color;
-	/** Window frame hightlight color */
-	gfx_color_t *wnd_frame_hi_color;
-	/** Window frame shadow color */
-	gfx_color_t *wnd_frame_sh_color;
-	/** Window highlight color */
-	gfx_color_t *wnd_highlight_color;
-	/** Window shadow color */
-	gfx_color_t *wnd_shadow_color;
-
-	/** Active titlebar background color */
-	gfx_color_t *tbar_act_bg_color;
-	/** Active titlebar text color */
-	gfx_color_t *tbar_act_text_color;
-	/** Inactive titlebar background color */
-	gfx_color_t *tbar_inact_bg_color;
-	/** Inactive titlebar text color */
-	gfx_color_t *tbar_inact_text_color;
-
-	/** Entry (text entry, checkbox, radio button) foreground color */
-	gfx_color_t *entry_fg_color;
-	/** Entry (text entry, checkbox, raido button) background color */
-	gfx_color_t *entry_bg_color;
-	/** Entry (text entry, checkbox, raido button) active background color */
-	gfx_color_t *entry_act_bg_color;
-	/** Entry selected text foreground color */
-	gfx_color_t *entry_sel_text_fg_color;
-	/** Entry selected text background color */
-	gfx_color_t *entry_sel_text_bg_color;
-
-	/** Scrollbar trough color */
-	gfx_color_t *sbar_trough_color;
-	/** Scrollbar active trough color */
-	gfx_color_t *sbar_act_trough_color;
-
-	/** Expose callback or @c NULL */
-	ui_expose_cb_t expose_cb;
-	/** Expose callback argument */
-	void *expose_arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/scrollbar.h
===================================================================
--- uspace/lib/ui/private/scrollbar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Scrollbar structure
- *
- */
-
-#ifndef _UI_PRIVATE_SCROLLBAR_H
-#define _UI_PRIVATE_SCROLLBAR_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/ui/scrollbar.h>
-
-/** Actual structure of scrollbar.
- *
- * This is private to libui.
- */
-struct ui_scrollbar {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI */
-	struct ui *ui;
-	/** UI window containing scrollbar */
-	struct ui_window *window;
-	/** Callbacks */
-	struct ui_scrollbar_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Scrollbar rectangle */
-	gfx_rect_t rect;
-	/** Scrollbar direction */
-	ui_scrollbar_dir_t dir;
-	/** Thumb length */
-	gfx_coord_t thumb_len;
-	/** Up button */
-	struct ui_pbutton *up_btn;
-	/** Down button */
-	struct ui_pbutton *down_btn;
-	/** Thumb is currently held down */
-	bool thumb_held;
-	/** Upper trough is currently held down */
-	bool upper_trough_held;
-	/** Pointer is inside upper trough */
-	bool upper_trough_inside;
-	/** Lower trough is currently held down */
-	bool lower_trough_held;
-	/** Pointer is inside lower trough */
-	bool lower_trough_inside;
-	/** Position where thumb was pressed */
-	gfx_coord2_t press_pos;
-	/** Last thumb position */
-	gfx_coord_t last_pos;
-	/** Thumb position */
-	gfx_coord_t pos;
-	/** Last cursor position (when trough is held) */
-	gfx_coord2_t last_curs_pos;
-};
-
-/** Scrollbar geometry.
- *
- * Computed rectangles of scrollbar elements.
- */
-typedef struct {
-	/** Up button rectangle */
-	gfx_rect_t up_btn_rect;
-	/** Trough rectangle */
-	gfx_rect_t trough_rect;
-	/** Upper trough rectangle */
-	gfx_rect_t upper_trough_rect;
-	/** Thumb rectangle */
-	gfx_rect_t thumb_rect;
-	/** Lower trough rectangle */
-	gfx_rect_t lower_trough_rect;
-	/** Down button rectangle */
-	gfx_rect_t down_btn_rect;
-} ui_scrollbar_geom_t;
-
-extern errno_t ui_scrollbar_paint_gfx(ui_scrollbar_t *);
-extern errno_t ui_scrollbar_paint_text(ui_scrollbar_t *);
-extern void ui_scrollbar_get_geom(ui_scrollbar_t *, ui_scrollbar_geom_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/selectdialog.h
===================================================================
--- uspace/lib/ui/private/selectdialog.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Select dialog structure
- *
- */
-
-#ifndef _UI_PRIVATE_SELECTDIALOG_H
-#define _UI_PRIVATE_SELECTDIALOG_H
-
-/** Actual structure of select dialog.
- *
- * This is private to libui.
- */
-struct ui_select_dialog {
-	/** Dialog window */
-	struct ui_window *window;
-	/** List */
-	struct ui_list *list;
-	/** OK button */
-	struct ui_pbutton *bok;
-	/** Cancel button */
-	struct ui_pbutton *bcancel;
-	/** Select dialog callbacks */
-	struct ui_select_dialog_cb *cb;
-	/** Callback argument */
-	void *arg;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/slider.h
===================================================================
--- uspace/lib/ui/private/slider.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Slider structure
- *
- */
-
-#ifndef _UI_PRIVATE_SLIDER_H
-#define _UI_PRIVATE_SLIDER_H
-
-#include <gfx/coord.h>
-#include <stdbool.h>
-
-/** Actual structure of slider.
- *
- * This is private to libui.
- */
-struct ui_slider {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI resource */
-	struct ui_resource *res;
-	/** Callbacks */
-	struct ui_slider_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Slider rectangle */
-	gfx_rect_t rect;
-	/** Slider is currently held down */
-	bool held;
-	/** Position where button was pressed */
-	gfx_coord2_t press_pos;
-	/** Last slider position */
-	gfx_coord_t last_pos;
-	/** Slider position */
-	gfx_coord_t pos;
-};
-
-extern errno_t ui_slider_paint_gfx(ui_slider_t *);
-extern errno_t ui_slider_paint_text(ui_slider_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/tab.h
===================================================================
--- uspace/lib/ui/private/tab.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab structure
- *
- */
-
-#ifndef _UI_PRIVATE_TAB_H
-#define _UI_PRIVATE_TAB_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/ui/tab.h>
-#include <types/ui/resource.h>
-
-/** Actual structure of tab.
- *
- * This is private to libui.
- */
-struct ui_tab {
-	/** Containing tab set */
-	struct ui_tab_set *tabset;
-	/** Link to @c tabset->tabs */
-	link_t ltabs;
-	/** Caption */
-	char *caption;
-	/** X offset of the handle */
-	gfx_coord_t xoff;
-	/** Tab content */
-	struct ui_control *content;
-};
-
-/** Tab geometry.
- *
- * Computed rectangles of tab elements.
- */
-typedef struct {
-	/** Tab handle */
-	gfx_rect_t handle;
-	/** Tab handle area including pull-up area */
-	gfx_rect_t handle_area;
-	/** Tab body */
-	gfx_rect_t body;
-	/** Text position */
-	gfx_coord2_t text_pos;
-} ui_tab_geom_t;
-
-extern gfx_coord_t ui_tab_handle_width(ui_tab_t *);
-extern gfx_coord_t ui_tab_handle_height(ui_tab_t *);
-extern void ui_tab_get_geom(ui_tab_t *, ui_tab_geom_t *);
-extern errno_t ui_tab_paint_handle_frame(gfx_context_t *, gfx_rect_t *,
-    gfx_coord_t, gfx_color_t *, gfx_color_t *, bool, gfx_rect_t *);
-extern errno_t ui_tab_paint_body_frame(ui_tab_t *);
-extern errno_t ui_tab_paint_frame(ui_tab_t *);
-extern ui_resource_t *ui_tab_get_res(ui_tab_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/tabset.h
===================================================================
--- uspace/lib/ui/private/tabset.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab set structure
- *
- */
-
-#ifndef _UI_PRIVATE_TABSET_H
-#define _UI_PRIVATE_TABSET_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/tab.h>
-#include <types/ui/tabset.h>
-
-/** Actual structure of tab set.
- *
- * This is private to libui.
- */
-struct ui_tab_set {
-	/** Base control object */
-	struct ui_control *control;
-	/** UI reource */
-	struct ui_resource *res;
-	/** Tab set rectangle */
-	gfx_rect_t rect;
-	/** Selected tab */
-	struct ui_tab *selected;
-	/** List of tabs (ui_tab_t) */
-	list_t tabs;
-};
-
-extern void ui_tab_set_select(ui_tab_set_t *, ui_tab_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/testctl.h
===================================================================
--- uspace/lib/ui/private/testctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Test control
- *
- */
-
-#ifndef _UI_PRIVATE_TESTCTL_H
-#define _UI_PRIVATE_TESTCTL_H
-
-#include <types/ui/testctl.h>
-
-/** Actual structure of test control.
- *
- * This is private to libui.
- */
-struct ui_test_ctl {
-	/** Base control object */
-	struct ui_control *control;
-	/** Test response structure */
-	ui_tc_resp_t *resp;
-};
-
-extern ui_control_ops_t ui_test_ctl_ops;
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/testgc.h
===================================================================
--- uspace/lib/ui/private/testgc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * Copyright (c) 2025 Jiří Zárevúcky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-typedef struct {
-	bool bm_created;
-	bool bm_destroyed;
-	gfx_bitmap_params_t bm_params;
-	void *bm_pixels;
-	gfx_rect_t bm_srect;
-	gfx_coord2_t bm_offs;
-	bool bm_rendered;
-	bool bm_got_alloc;
-} test_gc_t;
-
-typedef struct {
-	test_gc_t *tgc;
-	gfx_bitmap_alloc_t alloc;
-	bool myalloc;
-} testgc_bitmap_t;
-
-static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	(void) arg;
-	(void) rect;
-	return EOK;
-}
-
-static errno_t testgc_set_color(void *arg, gfx_color_t *color)
-{
-	(void) arg;
-	(void) color;
-	return EOK;
-}
-
-static errno_t testgc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	(void) arg;
-	(void) rect;
-	return EOK;
-}
-
-static errno_t testgc_update(void *arg)
-{
-	(void) arg;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-	testgc_bitmap_t *tbm;
-
-	tbm = calloc(1, sizeof(testgc_bitmap_t));
-	if (tbm == NULL)
-		return ENOMEM;
-
-	if (alloc == NULL) {
-		tbm->alloc.pitch = (params->rect.p1.x - params->rect.p0.x) *
-		    sizeof(uint32_t);
-		tbm->alloc.off0 = 0;
-		tbm->alloc.pixels = calloc(
-		    (params->rect.p1.x - params->rect.p0.x) *
-		    (params->rect.p1.y - params->rect.p0.y),
-		    sizeof(uint32_t));
-		tbm->myalloc = true;
-		if (tbm->alloc.pixels == NULL) {
-			free(tbm);
-			return ENOMEM;
-		}
-	} else {
-		tbm->alloc = *alloc;
-	}
-
-	tbm->tgc = tgc;
-	tgc->bm_created = true;
-	tgc->bm_params = *params;
-	tgc->bm_pixels = tbm->alloc.pixels;
-	*rbm = (void *)tbm;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_destroy(void *bm)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	if (tbm->myalloc)
-		free(tbm->alloc.pixels);
-	tbm->tgc->bm_destroyed = true;
-	free(tbm);
-	return EOK;
-}
-
-static errno_t testgc_bitmap_render(void *bm, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	tbm->tgc->bm_rendered = true;
-	tbm->tgc->bm_srect = *srect;
-	tbm->tgc->bm_offs = *offs;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	*alloc = tbm->alloc;
-	tbm->tgc->bm_got_alloc = true;
-	return EOK;
-}
-
-static gfx_context_ops_t ops = {
-	.set_clip_rect = testgc_set_clip_rect,
-	.set_color = testgc_set_color,
-	.fill_rect = testgc_fill_rect,
-	.update = testgc_update,
-	.bitmap_create = testgc_bitmap_create,
-	.bitmap_destroy = testgc_bitmap_destroy,
-	.bitmap_render = testgc_bitmap_render,
-	.bitmap_get_alloc = testgc_bitmap_get_alloc
-};
Index: pace/lib/ui/private/ui.h
===================================================================
--- uspace/lib/ui/private/ui.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file User interface
- *
- */
-
-#ifndef _UI_PRIVATE_UI_H
-#define _UI_PRIVATE_UI_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-#include <display.h>
-#include <fibril_synch.h>
-#include <io/console.h>
-#include <stdbool.h>
-#include <types/common.h>
-
-/** Actual structure of user interface.
- *
- * This is private to libui.
- */
-struct ui {
-	/** Console */
-	console_ctrl_t *console;
-	/** Console GC */
-	struct console_gc *cgc;
-	/** Display */
-	display_t *display;
-	/** UI rectangle (only used in fullscreen mode) */
-	gfx_rect_t rect;
-	/** Output owned by UI, clean up when destroying UI */
-	bool myoutput;
-	/** @c true iff UI is suspended */
-	bool suspended;
-	/** @c true if terminating */
-	bool quit;
-	/** Windows (in stacking order, ui_window_t) */
-	list_t windows;
-	/** UI lock */
-	fibril_mutex_t lock;
-	/** Clickmatic */
-	struct ui_clickmatic *clickmatic;
-	/** Default input device ID used to determine new window's seat */
-	sysarg_t idev_id;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/wdecor.h
===================================================================
--- uspace/lib/ui/private/wdecor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window decoration structure
- *
- */
-
-#ifndef _UI_PRIVATE_WDECOR_H
-#define _UI_PRIVATE_WDECOR_H
-
-#include <gfx/coord.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/common.h>
-#include <types/ui/cursor.h>
-#include <types/ui/wdecor.h>
-
-/** Actual structure of push button.
- *
- * This is private to libui.
- */
-struct ui_wdecor {
-	/** UI resource */
-	struct ui_resource *res;
-	/** Callbacks */
-	struct ui_wdecor_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Window decoration rectangle */
-	gfx_rect_t rect;
-	/** Style */
-	ui_wdecor_style_t style;
-	/** Caption */
-	char *caption;
-	/** Window is active */
-	bool active;
-	/** Window is maximized */
-	bool maximized;
-	/** System menu handle is active */
-	bool sysmenu_hdl_active;
-	/** Minimize button */
-	struct ui_pbutton *btn_min;
-	/** Maximize button */
-	struct ui_pbutton *btn_max;
-	/** Close button */
-	struct ui_pbutton *btn_close;
-};
-
-/** Window decoration geometry.
- *
- * Computed rectangles of window decoration elements.
- */
-typedef struct {
-	/** Interior rectangle */
-	gfx_rect_t interior_rect;
-	/** Title bar rectangle */
-	gfx_rect_t title_bar_rect;
-	/** System menu handle rectangle */
-	gfx_rect_t sysmenu_hdl_rect;
-	/** Window caption rectangle */
-	gfx_rect_t caption_rect;
-	/** Minimize button rectangle */
-	gfx_rect_t btn_min_rect;
-	/** Maximize button rectangle */
-	gfx_rect_t btn_max_rect;
-	/** Close button rectangle */
-	gfx_rect_t btn_close_rect;
-	/** Application area rectangle */
-	gfx_rect_t app_area_rect;
-} ui_wdecor_geom_t;
-
-extern void ui_wdecor_sysmenu_open(ui_wdecor_t *, sysarg_t);
-extern void ui_wdecor_sysmenu_left(ui_wdecor_t *, sysarg_t);
-extern void ui_wdecor_sysmenu_right(ui_wdecor_t *, sysarg_t);
-extern void ui_wdecor_sysmenu_accel(ui_wdecor_t *, char32_t, sysarg_t);
-extern void ui_wdecor_minimize(ui_wdecor_t *);
-extern void ui_wdecor_maximize(ui_wdecor_t *);
-extern void ui_wdecor_unmaximize(ui_wdecor_t *);
-extern void ui_wdecor_close(ui_wdecor_t *);
-extern void ui_wdecor_move(ui_wdecor_t *, gfx_coord2_t *, sysarg_t);
-extern void ui_wdecor_resize(ui_wdecor_t *, ui_wdecor_rsztype_t,
-    gfx_coord2_t *, sysarg_t);
-extern void ui_wdecor_set_cursor(ui_wdecor_t *, ui_stock_cursor_t);
-extern void ui_wdecor_get_geom(ui_wdecor_t *, ui_wdecor_geom_t *);
-extern errno_t ui_wdecor_sysmenu_hdl_paint_gfx(ui_wdecor_t *, gfx_rect_t *);
-extern errno_t ui_wdecor_sysmenu_hdl_paint_text(ui_wdecor_t *, gfx_rect_t *);
-extern errno_t ui_wdecor_sysmenu_hdl_paint(ui_wdecor_t *, gfx_rect_t *);
-extern void ui_wdecor_frame_pos_event(ui_wdecor_t *, pos_event_t *);
-extern ui_wdecor_rsztype_t ui_wdecor_get_rsztype(ui_wdecor_t *,
-    gfx_coord2_t *);
-extern ui_stock_cursor_t ui_wdecor_cursor_from_rsztype(ui_wdecor_rsztype_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/private/window.h
===================================================================
--- uspace/lib/ui/private/window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window structure
- *
- */
-
-#ifndef _UI_PRIVATE_WINDOW_H
-#define _UI_PRIVATE_WINDOW_H
-
-#include <adt/list.h>
-#include <errno.h>
-#include <congfx/console.h>
-#include <display.h>
-#include <gfx/context.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <memgfx/memgc.h>
-#include <memgfx/xlategc.h>
-#include <types/common.h>
-#include <types/ui/cursor.h>
-#include <types/ui/window.h>
-
-/** Actual structure of window.
- *
- * This is private to libui.
- */
-struct ui_window {
-	/** Containing user interface */
-	struct ui *ui;
-	/** Link to @c ui->windows */
-	link_t lwindows;
-	/** Callbacks */
-	struct ui_window_cb *cb;
-	/** Callback argument */
-	void *arg;
-	/** Display window */
-	display_window_t *dwindow;
-	/** Window GC */
-	gfx_context_t *gc;
-	/** Window bitmap (if client-side rendering) */
-	gfx_bitmap_t *bmp;
-	/** Window memory GC (if client-side rendering) */
-	mem_gc_t *mgc;
-	/** Translating GC (if full screen & server-side rendering) */
-	xlate_gc_t *xgc;
-	/** Real window GC (if client-side rendering) */
-	gfx_context_t *realgc;
-	/** Window rectangle */
-	gfx_rect_t rect;
-	/** Normal window rectangle (when not maximized) */
-	gfx_rect_t normal_rect;
-	/** Display position (if fullscreen mode) */
-	gfx_coord2_t dpos;
-	/** Application area bitmap */
-	gfx_bitmap_t *app_bmp;
-	/** Application area memory GC */
-	mem_gc_t *app_mgc;
-	/** Application area GC */
-	gfx_context_t *app_gc;
-	/** Dirty rectangle */
-	gfx_rect_t dirty_rect;
-	/** UI resource. Ideally this would be in ui_t. */
-	struct ui_resource *res;
-	/** Window decoration */
-	struct ui_wdecor *wdecor;
-	/** System menu */
-	struct ui_menu *sysmenu;
-	/** System menu restore entry */
-	struct ui_menu_entry *sysmenu_restore;
-	/** System menu minimize entry */
-	struct ui_menu_entry *sysmenu_minimize;
-	/** System menu maximize entry */
-	struct ui_menu_entry *sysmenu_maximize;
-	/** Menu bar */
-	struct ui_menu_bar *mbar;
-	/** Top-level control in the application area */
-	struct ui_control *control;
-	/** Current cursor */
-	ui_stock_cursor_t cursor;
-	/** Window placement */
-	ui_wnd_placement_t placement;
-};
-
-/** Size change operation */
-typedef enum {
-	/** Resize window */
-	ui_wsc_resize,
-	/** Maximize window */
-	ui_wsc_maximize,
-	/** Unmaximize window */
-	ui_wsc_unmaximize
-} ui_wnd_sc_op_t;
-
-extern display_stock_cursor_t wnd_dcursor_from_cursor(ui_stock_cursor_t);
-extern void ui_window_send_sysmenu(ui_window_t *, sysarg_t);
-extern void ui_window_send_minimize(ui_window_t *);
-extern void ui_window_send_maximize(ui_window_t *);
-extern void ui_window_send_unmaximize(ui_window_t *);
-extern void ui_window_send_close(ui_window_t *);
-extern void ui_window_send_focus(ui_window_t *, unsigned);
-extern void ui_window_send_kbd(ui_window_t *, kbd_event_t *);
-extern errno_t ui_window_send_paint(ui_window_t *);
-extern void ui_window_send_pos(ui_window_t *, pos_event_t *);
-extern void ui_window_send_unfocus(ui_window_t *, unsigned);
-extern void ui_window_send_resize(ui_window_t *);
-extern errno_t ui_window_size_change(ui_window_t *, gfx_rect_t *,
-    ui_wnd_sc_op_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/ui/src/accel.c
===================================================================
--- uspace/lib/ui/src/accel.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Accelerator processing
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/accel.h>
-
-/** Process text with accelerator markup.
- *
- * Parse text with tilde markup into a list of strings. @a *rbuf is set
- * to point to a newly allocated buffer containing consecutive null-terminated
- * strings.
- *
- * Each part between two '~' becomes one string. '~~' is translated into
- * a literal '~' character. @a *endptr is set to point to the first character
- * beyond the end of the list.
- *
- * @param str String with tilde markup
- * @param rbuf Place to store pointer to newly allocated buffer.
- * @param endptr Place to store end pointer (just after last character)
- * @return EOK on success or an error code
- */
-errno_t ui_accel_process(const char *str, char **rbuf, char **endptr)
-{
-	const char *sp;
-	char *dp;
-	char *buf;
-
-	buf = malloc(str_size(str) + 1);
-	if (buf == NULL)
-		return ENOMEM;
-
-	/* Break down string into list of (non)highlighted parts */
-	sp = str;
-	dp = buf;
-	while (*sp != '\0') {
-		if (*sp == '~') {
-			if (sp[1] == '~') {
-				sp += 2;
-				*dp++ = '~';
-			} else {
-				++sp;
-				*dp++ = '\0';
-			}
-		} else {
-			*dp++ = *sp++;
-		}
-	}
-
-	*dp++ = '\0';
-	*rbuf = buf;
-	*endptr = dp;
-
-	return EOK;
-}
-
-/** Get accelerator character from marked-up string.
- *
- * @param str String with '~' accelerator markup
- *
- * @return Accelerator character (lowercase) or the null character if
- *         the menu has no accelerator.
- */
-char32_t ui_accel_get(const char *str)
-{
-	const char *sp = str;
-	size_t off;
-
-	while (*sp != '\0') {
-		if (*sp == '~') {
-			if (sp[1] == '~') {
-				++sp;
-			} else {
-				/* Found the accelerator */
-				++sp;
-				break;
-			}
-		}
-
-		++sp;
-	}
-
-	if (*sp == '\0') {
-		/* No accelerator */
-		return '\0';
-	}
-
-	/* Decode accelerator character */
-	off = 0;
-
-	/*
-	 * NOTE: tolower is unlike to actually convert to lowercase
-	 * in case of non-ASCII characters
-	 */
-	return tolower(str_decode(sp, &off, STR_NO_LIMIT));
-}
-
-/** @}
- */
Index: pace/lib/ui/src/checkbox.c
===================================================================
--- uspace/lib/ui/src/checkbox.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,468 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Check box
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/checkbox.h>
-#include "../private/checkbox.h"
-#include "../private/resource.h"
-
-enum {
-	checkbox_box_w = 16,
-	checkbox_box_h = 16,
-	checkbox_label_margin = 8,
-	checkbox_cross_n = 5,
-	checkbox_cross_w = 2,
-	checkbox_cross_h = 2
-};
-
-static void ui_checkbox_ctl_destroy(void *);
-static errno_t ui_checkbox_ctl_paint(void *);
-static ui_evclaim_t ui_checkbox_ctl_pos_event(void *, pos_event_t *);
-
-/** Check box control ops */
-ui_control_ops_t ui_checkbox_ops = {
-	.destroy = ui_checkbox_ctl_destroy,
-	.paint = ui_checkbox_ctl_paint,
-	.pos_event = ui_checkbox_ctl_pos_event
-};
-
-/** Create new check box.
- *
- * @param resource UI resource
- * @param caption Caption
- * @param rcheckbox Place to store pointer to new check box
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_checkbox_create(ui_resource_t *resource, const char *caption,
-    ui_checkbox_t **rcheckbox)
-{
-	ui_checkbox_t *checkbox;
-	errno_t rc;
-
-	checkbox = calloc(1, sizeof(ui_checkbox_t));
-	if (checkbox == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_checkbox_ops, (void *) checkbox,
-	    &checkbox->control);
-	if (rc != EOK) {
-		free(checkbox);
-		return rc;
-	}
-
-	checkbox->caption = str_dup(caption);
-	if (checkbox->caption == NULL) {
-		ui_control_delete(checkbox->control);
-		free(checkbox);
-		return ENOMEM;
-	}
-
-	checkbox->res = resource;
-	*rcheckbox = checkbox;
-	return EOK;
-}
-
-/** Destroy check box.
- *
- * @param checkbox Check box or @c NULL
- */
-void ui_checkbox_destroy(ui_checkbox_t *checkbox)
-{
-	if (checkbox == NULL)
-		return;
-
-	ui_control_delete(checkbox->control);
-	free(checkbox);
-}
-
-/** Get base control from check box.
- *
- * @param checkbox Check box
- * @return Control
- */
-ui_control_t *ui_checkbox_ctl(ui_checkbox_t *checkbox)
-{
-	return checkbox->control;
-}
-
-/** Set check box callbacks.
- *
- * @param checkbox Check box
- * @param cb Check box callbacks
- * @param arg Callback argument
- */
-void ui_checkbox_set_cb(ui_checkbox_t *checkbox, ui_checkbox_cb_t *cb, void *arg)
-{
-	checkbox->cb = cb;
-	checkbox->arg = arg;
-}
-
-/** Set check box rectangle.
- *
- * @param checkbox Check box
- * @param rect New check box rectangle
- */
-void ui_checkbox_set_rect(ui_checkbox_t *checkbox, gfx_rect_t *rect)
-{
-	checkbox->rect = *rect;
-}
-
-/** Return if check box is checked.
- *
- * @param checkbox Check box
- * @return @c true iff check box is checked
- */
-bool ui_checkbox_get_checked(ui_checkbox_t *checkbox)
-{
-	return checkbox->checked;
-}
-
-/** Set check box checked state.
- *
- * @param checkbox Check box
- * @param checked @c true iff checkbox should be checked
- */
-void ui_checkbox_set_checked(ui_checkbox_t *checkbox, bool checked)
-{
-	checkbox->checked = checked;
-}
-
-/** Paint check box in graphics mode.
- *
- * @param checkbox Check box
- * @return EOK on success or an error code
- */
-errno_t ui_checkbox_paint_gfx(ui_checkbox_t *checkbox)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t box_rect;
-	gfx_rect_t box_inside;
-	gfx_coord2_t box_center;
-	bool depressed;
-	errno_t rc;
-
-	box_rect.p0 = checkbox->rect.p0;
-	box_rect.p1.x = box_rect.p0.x + checkbox_box_w;
-	box_rect.p1.y = box_rect.p0.y + checkbox_box_h;
-
-	/* Paint checkbox frame */
-
-	rc = ui_paint_inset_frame(checkbox->res, &box_rect, &box_inside);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint checkbox interior */
-
-	depressed = checkbox->held && checkbox->inside;
-
-	rc = gfx_set_color(checkbox->res->gc, depressed ?
-	    checkbox->res->entry_act_bg_color :
-	    checkbox->res->entry_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(checkbox->res->gc, &box_inside);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint cross mark */
-
-	if (checkbox->checked) {
-		rc = gfx_set_color(checkbox->res->gc,
-		    checkbox->res->entry_fg_color);
-		if (rc != EOK)
-			goto error;
-
-		box_center.x = (box_inside.p0.x + box_inside.p1.x) / 2 - 1;
-		box_center.y = (box_inside.p0.y + box_inside.p1.y) / 2 - 1;
-
-		rc = ui_paint_cross(checkbox->res->gc, &box_center,
-		    checkbox_cross_n, checkbox_cross_w, checkbox_cross_h);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Paint checkbox label */
-
-	pos.x = box_rect.p1.x + checkbox_label_margin;
-	pos.y = (box_rect.p0.y + box_rect.p1.y) / 2;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = checkbox->res->font;
-	fmt.color = checkbox->res->wnd_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_center;
-
-	rc = gfx_puttext(&pos, &fmt, checkbox->caption);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(checkbox->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint check box in text mode.
- *
- * @param checkbox Check box
- * @return EOK on success or an error code
- */
-errno_t ui_checkbox_paint_text(ui_checkbox_t *checkbox)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	bool depressed;
-	errno_t rc;
-
-	/* Paint checkbox */
-
-	depressed = checkbox->held && checkbox->inside;
-
-	pos.x = checkbox->rect.p0.x;
-	pos.y = checkbox->rect.p0.y;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = checkbox->res->font;
-	fmt.color = depressed ? checkbox->res->entry_act_bg_color :
-	    checkbox->res->wnd_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	rc = gfx_puttext(&pos, &fmt, checkbox->checked ? "[X]" : "[ ]");
-	if (rc != EOK)
-		goto error;
-
-	/* Paint checkbox label */
-
-	pos.x += 4;
-	fmt.color = checkbox->res->wnd_text_color;
-
-	rc = gfx_puttext(&pos, &fmt, checkbox->caption);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(checkbox->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint check box.
- *
- * @param checkbox Check box
- * @return EOK on success or an error code
- */
-errno_t ui_checkbox_paint(ui_checkbox_t *checkbox)
-{
-	if (checkbox->res->textmode)
-		return ui_checkbox_paint_text(checkbox);
-	else
-		return ui_checkbox_paint_gfx(checkbox);
-}
-
-/** Press down button.
- *
- * @param checkbox Check box
- */
-void ui_checkbox_press(ui_checkbox_t *checkbox)
-{
-	if (checkbox->held)
-		return;
-
-	checkbox->inside = true;
-	checkbox->held = true;
-	(void) ui_checkbox_paint(checkbox);
-}
-
-/** Release button.
- *
- * @param checkbox Check box
- */
-void ui_checkbox_release(ui_checkbox_t *checkbox)
-{
-	if (!checkbox->held)
-		return;
-
-	checkbox->held = false;
-
-	if (checkbox->inside) {
-		/* Toggle check box state */
-		checkbox->checked = !checkbox->checked;
-
-		/* Repaint and notify */
-		(void) ui_checkbox_paint(checkbox);
-		ui_checkbox_switched(checkbox);
-	}
-}
-
-/** Pointer entered button.
- *
- * @param checkbox Check box
- */
-void ui_checkbox_enter(ui_checkbox_t *checkbox)
-{
-	if (checkbox->inside)
-		return;
-
-	checkbox->inside = true;
-	if (checkbox->held)
-		(void) ui_checkbox_paint(checkbox);
-}
-
-/** Pointer left button.
- *
- * @param checkbox Check box
- */
-void ui_checkbox_leave(ui_checkbox_t *checkbox)
-{
-	if (!checkbox->inside)
-		return;
-
-	checkbox->inside = false;
-	if (checkbox->held)
-		(void) ui_checkbox_paint(checkbox);
-}
-
-/** Button was switched.
- *
- * @param checkbox Check box
- */
-void ui_checkbox_switched(ui_checkbox_t *checkbox)
-{
-	if (checkbox->cb != NULL && checkbox->cb->switched != NULL) {
-		checkbox->cb->switched(checkbox, checkbox->arg,
-		    checkbox->checked);
-	}
-}
-
-/** Handle check box position event.
- *
- * @param checkbox Check box
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_checkbox_pos_event(ui_checkbox_t *checkbox, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	bool inside;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	inside = gfx_pix_inside_rect(&pos, &checkbox->rect);
-
-	switch (event->type) {
-	case POS_PRESS:
-		if (inside) {
-			ui_checkbox_press(checkbox);
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (checkbox->held) {
-			ui_checkbox_release(checkbox);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		if (inside && !checkbox->inside) {
-			ui_checkbox_enter(checkbox);
-			return ui_claimed;
-		} else if (!inside && checkbox->inside) {
-			ui_checkbox_leave(checkbox);
-		}
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Destroy check box control.
- *
- * @param arg Argument (ui_checkbox_t *)
- */
-void ui_checkbox_ctl_destroy(void *arg)
-{
-	ui_checkbox_t *checkbox = (ui_checkbox_t *) arg;
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** Paint check box control.
- *
- * @param arg Argument (ui_checkbox_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_checkbox_ctl_paint(void *arg)
-{
-	ui_checkbox_t *checkbox = (ui_checkbox_t *) arg;
-
-	return ui_checkbox_paint(checkbox);
-}
-
-/** Handle check box control position event.
- *
- * @param arg Argument (ui_checkbox_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_checkbox_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_checkbox_t *checkbox = (ui_checkbox_t *) arg;
-
-	return ui_checkbox_pos_event(checkbox, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/clickmatic.c
===================================================================
--- uspace/lib/ui/src/clickmatic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,163 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Clickmatic.
- *
- * Clickmatic is used to periodically generate events in particular cases
- * when a mouse button is held down, such as when holding the button or
- * trough of a scrollbar.
- */
-
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <ui/clickmatic.h>
-#include <ui/ui.h>
-#include "../private/clickmatic.h"
-
-enum {
-	/** Initial clickmatic delay in MS */
-	clickmatic_delay_ms = 500,
-	/** Clickmatic repeat rate in clicks per second */
-	clickmatic_rate = 10
-};
-
-static void ui_clickmatic_timer_fun(void *);
-
-/** Create clickmatic.
- *
- * @param ui UI
- * @param rclickmatic Place to store pointer to new clickmatic
- * @return EOK on success or an error code
- */
-errno_t ui_clickmatic_create(ui_t *ui, ui_clickmatic_t **rclickmatic)
-{
-	ui_clickmatic_t *clickmatic;
-
-	clickmatic = calloc(1, sizeof(ui_clickmatic_t));
-	if (clickmatic == NULL)
-		return ENOMEM;
-
-	clickmatic->ui = ui;
-	clickmatic->timer = fibril_timer_create(NULL);
-	if (clickmatic->timer == NULL) {
-		free(clickmatic);
-		return ENOMEM;
-	}
-
-	*rclickmatic = clickmatic;
-	return EOK;
-}
-
-/** Set clickmatick callbacks.
- *
- * @param clickmatic Clickmatic
- * @param cb Callbacks
- * @param arg Argument to callbacks
- */
-void ui_clickmatic_set_cb(ui_clickmatic_t *clickmatic, ui_clickmatic_cb_t *cb,
-    void *arg)
-{
-	clickmatic->cb = cb;
-	clickmatic->arg = arg;
-}
-
-/** Destroy clickmatic.
- *
- * @param clickmatic Clickmatic or @c NULL
- */
-void ui_clickmatic_destroy(ui_clickmatic_t *clickmatic)
-{
-	if (clickmatic == NULL)
-		return;
-
-	fibril_timer_destroy(clickmatic->timer);
-	free(clickmatic);
-}
-
-/** Activate clickmatic.
- *
- * This generates one click event, then starts repeating after delay.
- *
- * @param clickmatic Clickmatic
- */
-void ui_clickmatic_press(ui_clickmatic_t *clickmatic)
-{
-	ui_clickmatic_clicked(clickmatic);
-
-	fibril_timer_set(clickmatic->timer, 1000 * clickmatic_delay_ms,
-	    ui_clickmatic_timer_fun, (void *)clickmatic);
-}
-
-/** Deactivate clickmatic.
- *
- * Stops generating events.
- *
- * @param clickmatic Clickmatic
- */
-void ui_clickmatic_release(ui_clickmatic_t *clickmatic)
-{
-	(void) fibril_timer_clear(clickmatic->timer);
-}
-
-/** Clickmatic clicked event.
- *
- * @param clickmatic Clickmatic
- */
-void ui_clickmatic_clicked(ui_clickmatic_t *clickmatic)
-{
-	if (clickmatic->cb != NULL && clickmatic->cb->clicked != NULL)
-		clickmatic->cb->clicked(clickmatic, clickmatic->arg);
-}
-
-/** Clickmatic timer function.
- *
- * @param arg Argument (ui_clickmatic_t *)
- */
-static void ui_clickmatic_timer_fun(void *arg)
-{
-	ui_clickmatic_t *clickmatic = (ui_clickmatic_t *)arg;
-
-	/*
-	 * Because we are operating in a different fibril, we must lock
-	 * the UI to ensure mutual exclusion with normal UI events
-	 */
-
-	ui_lock(clickmatic->ui);
-	ui_clickmatic_clicked(clickmatic);
-	ui_unlock(clickmatic->ui);
-
-	fibril_timer_set(clickmatic->timer, 1000000 / clickmatic_rate,
-	    ui_clickmatic_timer_fun, (void *)clickmatic);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/clock.c
===================================================================
--- uspace/lib/ui/src/clock.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,259 +1,0 @@
-/*
- * Copyright (c) 2024
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <math.h>
-#include <stdlib.h>
-#include <time.h>
-#include <ui/clock.h>
-#include <ui/paint.h>
-#include <ui/resource.h>
-
-#define CLOCK_HAND_WIDTH 2
-#define CLOCK_HOUR_HAND_LENGTH 0.6
-#define CLOCK_MINUTE_HAND_LENGTH 0.8
-#define CLOCK_SECOND_HAND_LENGTH 0.9
-
-static void ui_clock_ctl_destroy(void *);
-static errno_t ui_clock_ctl_paint(void *);
-
-/** Clock control ops */
-ui_control_ops_t ui_clock_ops = {
-	.destroy = ui_clock_ctl_destroy,
-	.paint = ui_clock_ctl_paint
-};
-
-/** Create clock widget.
- *
- * @param resource UI resource
- * @param rclock Place to store pointer to new clock
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_clock_create(ui_resource_t *resource, ui_clock_t **rclock)
-{
-	ui_clock_t *clock;
-	errno_t rc;
-
-	clock = calloc(1, sizeof(ui_clock_t));
-	if (clock == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_clock_ops, (void *) clock, &clock->control);
-	if (rc != EOK) {
-		free(clock);
-		return rc;
-	}
-
-	clock->res = resource;
-	*rclock = clock;
-	return EOK;
-}
-
-/** Destroy clock widget.
- *
- * @param clock Clock widget or @c NULL
- */
-void ui_clock_destroy(ui_clock_t *clock)
-{
-	if (clock == NULL)
-		return;
-
-	ui_control_delete(clock->control);
-	free(clock);
-}
-
-/** Get base control from clock.
- *
- * @param clock Clock
- * @return Control
- */
-ui_control_t *ui_clock_ctl(ui_clock_t *clock)
-{
-	return clock->control;
-}
-
-/** Set clock rectangle.
- *
- * @param clock Clock
- * @param rect New clock rectangle
- */
-void ui_clock_set_rect(ui_clock_t *clock, gfx_rect_t *rect)
-{
-	clock->rect = *rect;
-}
-
-/** Draw clock hand.
- *
- * @param gc Graphic context
- * @param center Center point
- * @param angle Angle in radians
- * @param length Length as fraction of radius
- * @param width Width of hand
- * @param color Color to use
- * @return EOK on success or an error code
- */
-static errno_t ui_clock_draw_hand(gfx_context_t *gc, gfx_coord2_t *center,
-    double angle, double length, gfx_coord_t width, gfx_color_t *color)
-{
-	gfx_coord_t radius;
-	gfx_coord2_t end;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	/* Calculate radius as minimum of width/height */
-	radius = min(clock->rect.p1.x - clock->rect.p0.x,
-	    clock->rect.p1.y - clock->rect.p0.y) / 2;
-
-	/* Calculate end point */
-	end.x = center->x + (gfx_coord_t)(radius * length * sin(angle));
-	end.y = center->y - (gfx_coord_t)(radius * length * cos(angle));
-
-	/* Draw hand as a rectangle */
-	rect.p0.x = center->x - width/2;
-	rect.p0.y = center->y - width/2;
-	rect.p1.x = end.x + width/2;
-	rect.p1.y = end.y + width/2;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK)
-		return rc;
-
-	return gfx_fill_rect(gc, &rect);
-}
-
-/** Paint clock.
- *
- * @param clock Clock
- * @return EOK on success or an error code
- */
-errno_t ui_clock_paint(ui_clock_t *clock)
-{
-	gfx_coord2_t center;
-	gfx_coord_t radius;
-	double hour_angle, min_angle, sec_angle;
-	errno_t rc;
-
-	/* Calculate center and radius */
-	center.x = (clock->rect.p0.x + clock->rect.p1.x) / 2;
-	center.y = (clock->rect.p0.y + clock->rect.p1.y) / 2;
-	radius = min(clock->rect.p1.x - clock->rect.p0.x,
-	    clock->rect.p1.y - clock->rect.p0.y) / 2;
-
-	/* Paint clock face */
-	rc = gfx_set_color(clock->res->gc, clock->res->wnd_face_color);
-	if (rc != EOK)
-		return rc;
-
-	rc = ui_paint_filled_circle(clock->res->gc, &center, radius,
-	    ui_fcircle_entire);
-	if (rc != EOK)
-		return rc;
-
-	/* Paint clock frame */
-	rc = ui_paint_outset_frame(clock->res, &clock->rect, NULL);
-	if (rc != EOK)
-		return rc;
-
-	/* Calculate hand angles */
-	hour_angle = (clock->hour % 12 + clock->minute / 60.0) * M_PI / 6;
-	min_angle = clock->minute * M_PI / 30;
-	sec_angle = clock->second * M_PI / 30;
-
-	/* Draw hour hand */
-	rc = ui_clock_draw_hand(clock->res->gc, &center, hour_angle,
-	    CLOCK_HOUR_HAND_LENGTH, CLOCK_HAND_WIDTH * 2,
-	    clock->res->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	/* Draw minute hand */
-	rc = ui_clock_draw_hand(clock->res->gc, &center, min_angle,
-	    CLOCK_MINUTE_HAND_LENGTH, CLOCK_HAND_WIDTH,
-	    clock->res->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	/* Draw second hand */
-	rc = ui_clock_draw_hand(clock->res->gc, &center, sec_angle,
-	    CLOCK_SECOND_HAND_LENGTH, CLOCK_HAND_WIDTH,
-	    clock->res->wnd_highlight_color);
-	if (rc != EOK)
-		return rc;
-
-	return gfx_update(clock->res->gc);
-}
-
-/** Update clock time.
- *
- * @param clock Clock
- */
-void ui_clock_update_time(ui_clock_t *clock)
-{
-	time_t now;
-	struct tm *tm;
-
-	time(&now);
-	tm = localtime(&now);
-
-	clock->hour = tm->tm_hour;
-	clock->minute = tm->tm_min;
-	clock->second = tm->tm_sec;
-}
-
-/** Destroy clock control.
- *
- * @param arg Argument (ui_clock_t *)
- */
-static void ui_clock_ctl_destroy(void *arg)
-{
-	ui_clock_t *clock = (ui_clock_t *) arg;
-
-	ui_clock_destroy(clock);
-}
-
-/** Paint clock control.
- *
- * @param arg Argument (ui_clock_t *)
- * @return EOK on success or an error code
- */
-static errno_t ui_clock_ctl_paint(void *arg)
-{
-	ui_clock_t *clock = (ui_clock_t *) arg;
-
-	return ui_clock_paint(clock);
-}
-
-/** @}
- */ 
Index: pace/lib/ui/src/control.c
===================================================================
--- uspace/lib/ui/src/control.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI control
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <ui/control.h>
-#include "../private/control.h"
-
-/** Allocate new UI control.
- *
- * @param ops Control ops
- * @param ext Control extended data
- * @param rcontrol Place to store pointer to new control
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_control_new(ui_control_ops_t *ops, void *ext,
-    ui_control_t **rcontrol)
-{
-	ui_control_t *control;
-
-	control = calloc(1, sizeof(ui_control_t));
-	if (control == NULL)
-		return ENOMEM;
-
-	control->ops = ops;
-	control->ext = ext;
-	*rcontrol = control;
-	return EOK;
-}
-
-/** Delete UI control.
- *
- * Deletes the base control (not the extended data).
- *
- * @param control UI control or @c NULL
- */
-void ui_control_delete(ui_control_t *control)
-{
-	if (control == NULL)
-		return;
-
-	free(control);
-}
-
-/** Destroy UI control.
- *
- * Run the virtual control destructor (destroy complete control including
- * extended data).
- *
- * @param control Control or @c NULL
- */
-void ui_control_destroy(ui_control_t *control)
-{
-	if (control == NULL)
-		return;
-
-	return control->ops->destroy(control->ext);
-}
-
-/** Deliver keyboard event to UI control.
- *
- * @param control Control
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_control_kbd_event(ui_control_t *control, kbd_event_t *event)
-{
-	if (control->ops->kbd_event != NULL)
-		return control->ops->kbd_event(control->ext, event);
-	else
-		return ui_unclaimed;
-}
-
-/** Paint UI control.
- *
- * @param control Control
- * @return EOK on success or an error code
- */
-errno_t ui_control_paint(ui_control_t *control)
-{
-	return control->ops->paint(control->ext);
-}
-
-/** Deliver position event to UI control.
- *
- * @param control Control
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_control_pos_event(ui_control_t *control, pos_event_t *event)
-{
-	return control->ops->pos_event(control->ext, event);
-}
-
-/** Inform UI control that window has been unfocused.
- *
- * @param control Control
- * @param nfocus Number of remaining foci
- */
-void ui_control_unfocus(ui_control_t *control, unsigned nfocus)
-{
-	if (control->ops->unfocus != NULL)
-		control->ops->unfocus(control->ext, nfocus);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/dummygc.c
===================================================================
--- uspace/lib/ui/src/dummygc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Dummy graphic context
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include "../private/dummygc.h"
-
-static errno_t dummygc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t dummygc_set_color(void *, gfx_color_t *);
-static errno_t dummygc_fill_rect(void *, gfx_rect_t *);
-static errno_t dummygc_update(void *);
-static errno_t dummygc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t dummygc_bitmap_destroy(void *);
-static errno_t dummygc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t dummygc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-/** Dummy GC operations */
-gfx_context_ops_t dummygc_ops = {
-	.set_clip_rect = dummygc_set_clip_rect,
-	.set_color = dummygc_set_color,
-	.fill_rect = dummygc_fill_rect,
-	.update = dummygc_update,
-	.bitmap_create = dummygc_bitmap_create,
-	.bitmap_destroy = dummygc_bitmap_destroy,
-	.bitmap_render = dummygc_bitmap_render,
-	.bitmap_get_alloc = dummygc_bitmap_get_alloc
-};
-
-/** Create dummy GC.
- *
- * @param rdgc Place to store pointer to new dummy GC
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t dummygc_create(dummy_gc_t **rdgc)
-{
-	dummy_gc_t *dgc;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	dgc = calloc(1, sizeof(dummy_gc_t));
-	if (dgc == NULL)
-		return ENOMEM;
-
-	rc = gfx_context_new(&dummygc_ops, dgc, &gc);
-	if (rc != EOK) {
-		free(dgc);
-		return rc;
-	}
-
-	dgc->gc = gc;
-	*rdgc = dgc;
-	return EOK;
-}
-
-/** Destroy dummy GC.
- *
- * @param dgc Dummy GC
- */
-void dummygc_destroy(dummy_gc_t *dgc)
-{
-	gfx_context_delete(dgc->gc);
-	free(dgc);
-}
-
-/** Get generic graphic context from dummy GC.
- *
- * @param dgc Dummy GC
- * @return Graphic context
- */
-gfx_context_t *dummygc_get_ctx(dummy_gc_t *dgc)
-{
-	return dgc->gc;
-}
-
-/** Set clipping rectangle on dummy GC
- *
- * @param arg Argument (dummy_gc_t)
- * @param rect Rectangle
- * @return EOK on success or an error code
- */
-static errno_t dummygc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	(void) arg;
-	(void) rect;
-	return EOK;
-}
-
-/** Set color on dummy GC
- *
- * @param arg Argument (dummy_gc_t)
- * @param color Color
- * @return EOK on success or an error code
- */
-static errno_t dummygc_set_color(void *arg, gfx_color_t *color)
-{
-	(void) arg;
-	(void) color;
-	return EOK;
-}
-
-/** Fill rectangle on dummy GC
- *
- * @param arg Argument (dummy_gc_t)
- * @param rect Rectangle
- * @return EOK on success or an error code
- */
-static errno_t dummygc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	(void) arg;
-	(void) rect;
-	return EOK;
-}
-
-/** Update dummy GC
- *
- * @param arg Argument (dummy_gc_t)
- * @return EOK on success or an error code
- */
-static errno_t dummygc_update(void *arg)
-{
-	(void) arg;
-	return EOK;
-}
-
-/** Create bitmap on dummy GC
- *
- * @param arg Argument (dummy_gc_t)
- * @param params Bitmap parameters
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-static errno_t dummygc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	dummy_gc_t *dgc = (dummy_gc_t *) arg;
-	dummygc_bitmap_t *tbm;
-
-	tbm = calloc(1, sizeof(dummygc_bitmap_t));
-	if (tbm == NULL)
-		return ENOMEM;
-
-	if (alloc == NULL) {
-		tbm->alloc.pitch = (params->rect.p1.x - params->rect.p0.x) *
-		    sizeof(uint32_t);
-		tbm->alloc.off0 = 0;
-		tbm->alloc.pixels = calloc(
-		    (params->rect.p1.x - params->rect.p0.x) *
-		    (params->rect.p1.y - params->rect.p0.y),
-		    sizeof(uint32_t));
-		tbm->myalloc = true;
-		if (tbm->alloc.pixels == NULL) {
-			free(tbm);
-			return ENOMEM;
-		}
-	} else {
-		tbm->alloc = *alloc;
-	}
-
-	tbm->dgc = dgc;
-	dgc->bm_created = true;
-	dgc->bm_params = *params;
-	dgc->bm_pixels = tbm->alloc.pixels;
-	*rbm = (void *)tbm;
-	return EOK;
-}
-
-/** Destroy bitmap on dummy GC
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t dummygc_bitmap_destroy(void *bm)
-{
-	dummygc_bitmap_t *tbm = (dummygc_bitmap_t *)bm;
-	if (tbm->myalloc)
-		free(tbm->alloc.pixels);
-	tbm->dgc->bm_destroyed = true;
-	free(tbm);
-	return EOK;
-}
-
-/** Render bitmap on dummy GC
- *
- * @param bm Bitmap
- * @param srect Source rectangle or @c NULL
- * @param offs Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t dummygc_bitmap_render(void *bm, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	dummygc_bitmap_t *tbm = (dummygc_bitmap_t *)bm;
-
-	tbm->dgc->bm_rendered = true;
-
-	tbm->dgc->bm_srect.p0.x = 0;
-	tbm->dgc->bm_srect.p0.y = 0;
-	tbm->dgc->bm_srect.p1.x = 0;
-	tbm->dgc->bm_srect.p1.y = 0;
-
-	tbm->dgc->bm_offs.x = 0;
-	tbm->dgc->bm_offs.y = 0;
-
-	if (srect != NULL)
-		tbm->dgc->bm_srect = *srect;
-
-	if (offs != NULL)
-		tbm->dgc->bm_offs = *offs;
-
-	return EOK;
-}
-
-/** Get bitmap allocation info on dummy GC
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t dummygc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	dummygc_bitmap_t *tbm = (dummygc_bitmap_t *)bm;
-	*alloc = tbm->alloc;
-	tbm->dgc->bm_got_alloc = true;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/entry.c
===================================================================
--- uspace/lib/ui/src/entry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1126 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Text entry.
- *
- * Currentry text entry is always read-only. It differs from label mostly
- * by its looks.
- */
-
-#include <clipboard.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/entry.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/entry.h"
-#include "../private/resource.h"
-
-static void ui_entry_ctl_destroy(void *);
-static errno_t ui_entry_ctl_paint(void *);
-static ui_evclaim_t ui_entry_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_entry_ctl_pos_event(void *, pos_event_t *);
-
-enum {
-	ui_entry_hpad = 4,
-	ui_entry_vpad = 4,
-	ui_entry_hpad_text = 1,
-	ui_entry_vpad_text = 0,
-	ui_entry_cursor_overshoot = 1,
-	ui_entry_cursor_width = 2,
-	ui_entry_sel_hpad = 0,
-	ui_entry_sel_vpad = 2,
-	/** Additional amount to scroll to the left after revealing cursor */
-	ui_entry_left_scroll_margin = 30
-};
-
-/** Text entry control ops */
-ui_control_ops_t ui_entry_ops = {
-	.destroy = ui_entry_ctl_destroy,
-	.paint = ui_entry_ctl_paint,
-	.kbd_event = ui_entry_ctl_kbd_event,
-	.pos_event = ui_entry_ctl_pos_event
-};
-
-/** Create new text entry.
- *
- * @param window UI window
- * @param text Text
- * @param rentry Place to store pointer to new text entry
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_entry_create(ui_window_t *window, const char *text,
-    ui_entry_t **rentry)
-{
-	ui_entry_t *entry;
-	errno_t rc;
-
-	entry = calloc(1, sizeof(ui_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_entry_ops, (void *) entry, &entry->control);
-	if (rc != EOK) {
-		free(entry);
-		return rc;
-	}
-
-	entry->text = str_dup(text);
-	if (entry->text == NULL) {
-		ui_control_delete(entry->control);
-		free(entry);
-		return ENOMEM;
-	}
-
-	entry->window = window;
-	entry->halign = gfx_halign_left;
-	*rentry = entry;
-
-	return EOK;
-}
-
-/** Destroy text entry.
- *
- * @param entry Text entry or @c NULL
- */
-void ui_entry_destroy(ui_entry_t *entry)
-{
-	if (entry == NULL)
-		return;
-
-	ui_control_delete(entry->control);
-	free(entry);
-}
-
-/** Get base control from text entry.
- *
- * @param entry Text entry
- * @return Control
- */
-ui_control_t *ui_entry_ctl(ui_entry_t *entry)
-{
-	return entry->control;
-}
-
-/** Set text entry rectangle.
- *
- * @param entry Text entry
- * @param rect New text entry rectangle
- */
-void ui_entry_set_rect(ui_entry_t *entry, gfx_rect_t *rect)
-{
-	entry->rect = *rect;
-}
-
-/** Set text entry horizontal text alignment.
- *
- * @param entry Text entry
- * @param halign Horizontal alignment
- */
-void ui_entry_set_halign(ui_entry_t *entry, gfx_halign_t halign)
-{
-	entry->halign = halign;
-	ui_entry_scroll_update(entry, true);
-	ui_entry_paint(entry);
-}
-
-/** Set text entry read-only flag.
- *
- * @param entry Text entry
- * @param read_only True iff entry is to be read-only.
- */
-void ui_entry_set_read_only(ui_entry_t *entry, bool read_only)
-{
-	entry->read_only = read_only;
-}
-
-/** Set entry text.
- *
- * @param entry Text entry
- * @param text New entry text
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_entry_set_text(ui_entry_t *entry, const char *text)
-{
-	char *tcopy;
-
-	tcopy = str_dup(text);
-	if (tcopy == NULL)
-		return ENOMEM;
-
-	free(entry->text);
-	entry->text = tcopy;
-	entry->pos = str_size(text);
-	entry->sel_start = entry->pos;
-
-	ui_entry_scroll_update(entry, false);
-	ui_entry_paint(entry);
-
-	return EOK;
-}
-
-/** Get entry text.
- *
- * @return Pointer to entry text.
- */
-const char *ui_entry_get_text(ui_entry_t *entry)
-{
-	return entry->text;
-}
-
-/** Paint cursor.
- *
- * @param entry Text entry
- * @param pos Cursor position (top-left corner of next character)
- * @return EOK on success or an error code
- */
-static errno_t ui_entry_paint_cursor(ui_entry_t *entry, gfx_coord2_t *pos)
-{
-	ui_resource_t *res;
-	gfx_rect_t rect;
-	gfx_font_metrics_t metrics;
-	errno_t rc;
-
-	res = ui_window_get_res(entry->window);
-
-	if (res->textmode) {
-		rc = gfx_cursor_set_pos(res->gc, pos);
-		return rc;
-	}
-
-	gfx_font_get_metrics(res->font, &metrics);
-
-	rect.p0.x = pos->x;
-	rect.p0.y = pos->y - ui_entry_cursor_overshoot;
-	rect.p1.x = pos->x + ui_entry_cursor_width;
-	rect.p1.y = pos->y + metrics.ascent + metrics.descent + 1 +
-	    ui_entry_cursor_overshoot;
-
-	rc = gfx_set_color(res->gc, res->entry_fg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Return width of text before cursor.
- *
- * @param entry Text entry
- * @return Widht of text before cursor
- */
-static gfx_coord_t ui_entry_lwidth(ui_entry_t *entry)
-{
-	ui_resource_t *res;
-	uint8_t tmp;
-	gfx_coord_t width;
-
-	res = ui_window_get_res(entry->window);
-
-	tmp = entry->text[entry->pos];
-
-	entry->text[entry->pos] = '\0';
-	width = gfx_text_width(res->font, entry->text);
-	entry->text[entry->pos] = tmp;
-
-	return width;
-}
-
-/** Paint text entry.
- *
- * @param entry Text entry
- * @return EOK on success or an error code
- */
-errno_t ui_entry_paint(ui_entry_t *entry)
-{
-	ui_resource_t *res;
-	ui_entry_geom_t geom;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	gfx_text_fmt_t cfmt;
-	gfx_coord2_t cpos;
-	gfx_rect_t inside;
-	unsigned off1, off2;
-	gfx_rect_t sel;
-	char c;
-	errno_t rc;
-
-	res = ui_window_get_res(entry->window);
-
-	ui_entry_get_geom(entry, &geom);
-
-	if (res->textmode == false) {
-		/* Paint inset frame */
-		rc = ui_paint_inset_frame(res, &entry->rect, &inside);
-		if (rc != EOK)
-			goto error;
-	} else {
-		inside = entry->rect;
-	}
-
-	/* Paint entry background */
-
-	rc = gfx_set_color(res->gc, res->entry_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &inside);
-	if (rc != EOK)
-		goto error;
-
-	pos = geom.text_pos;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = res->font;
-	fmt.color = res->entry_fg_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	rc = gfx_set_clip_rect(res->gc, &inside);
-	if (rc != EOK)
-		goto error;
-
-	off1 = min(entry->pos, entry->sel_start);
-	off2 = max(entry->pos, entry->sel_start);
-
-	/* Render initial segment before start of selection */
-	c = entry->text[off1];
-	entry->text[off1] = '\0';
-
-	rc = gfx_puttext(&pos, &fmt, entry->text);
-	if (rc != EOK) {
-		(void) gfx_set_clip_rect(res->gc, NULL);
-		goto error;
-	}
-
-	gfx_text_cont(&pos, &fmt, entry->text, &cpos, &cfmt);
-	entry->text[off1] = c;
-
-	/* Render selected text */
-
-	if (off1 != off2) {
-		c = entry->text[off2];
-		entry->text[off2] = '\0';
-		cfmt.color = res->entry_sel_text_fg_color;
-
-		gfx_text_rect(&cpos, &cfmt, entry->text + off1, &sel);
-		sel.p0.x -= ui_entry_sel_hpad;
-		sel.p0.y -= ui_entry_sel_vpad;
-		sel.p1.x += ui_entry_sel_hpad;
-		sel.p1.y += ui_entry_sel_vpad;
-
-		rc = gfx_set_color(res->gc, res->entry_sel_text_bg_color);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_fill_rect(res->gc, &sel);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_puttext(&cpos, &cfmt, entry->text + off1);
-		if (rc != EOK) {
-			(void) gfx_set_clip_rect(res->gc, NULL);
-			goto error;
-		}
-
-		gfx_text_cont(&cpos, &cfmt, entry->text + off1, &cpos, &cfmt);
-
-		entry->text[off2] = c;
-	}
-
-	/* Render trailing, non-selected text */
-	cfmt.color = res->entry_fg_color;
-
-	rc = gfx_puttext(&cpos, &cfmt, entry->text + off2);
-	if (rc != EOK) {
-		(void) gfx_set_clip_rect(res->gc, NULL);
-		goto error;
-	}
-
-	if (entry->active) {
-		/* Cursor */
-		pos.x += ui_entry_lwidth(entry);
-
-		rc = ui_entry_paint_cursor(entry, &pos);
-		if (rc != EOK) {
-			(void) gfx_set_clip_rect(res->gc, NULL);
-			goto error;
-		}
-	}
-
-	rc = gfx_set_clip_rect(res->gc, NULL);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Find position in text entry.
- *
- * @param entry Text entry
- * @param fpos Position for which we need to find text offset
- * @return Corresponding byte offset in entry text
- */
-size_t ui_entry_find_pos(ui_entry_t *entry, gfx_coord2_t *fpos)
-{
-	ui_resource_t *res;
-	ui_entry_geom_t geom;
-	gfx_text_fmt_t fmt;
-
-	res = ui_window_get_res(entry->window);
-
-	ui_entry_get_geom(entry, &geom);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = res->font;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	return gfx_text_find_pos(&geom.text_pos, &fmt, entry->text, fpos);
-}
-
-/** Destroy text entry control.
- *
- * @param arg Argument (ui_entry_t *)
- */
-void ui_entry_ctl_destroy(void *arg)
-{
-	ui_entry_t *entry = (ui_entry_t *) arg;
-
-	ui_entry_destroy(entry);
-}
-
-/** Paint text entry control.
- *
- * @param arg Argument (ui_entry_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_entry_ctl_paint(void *arg)
-{
-	ui_entry_t *entry = (ui_entry_t *) arg;
-
-	return ui_entry_paint(entry);
-}
-
-/** Delete selected text.
- *
- * @param entry Text entry
- */
-void ui_entry_delete_sel(ui_entry_t *entry)
-{
-	size_t off1;
-	size_t off2;
-
-	off1 = min(entry->sel_start, entry->pos);
-	off2 = max(entry->sel_start, entry->pos);
-
-	memmove(entry->text + off1, entry->text + off2,
-	    str_size(entry->text + off2) + 1);
-
-	entry->pos = off1;
-	entry->sel_start = off1;
-	ui_entry_scroll_update(entry, false);
-	ui_entry_paint(entry);
-}
-
-/** Insert string at cursor position.
- *
- * @param entry Text entry
- * @param str String
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_entry_insert_str(ui_entry_t *entry, const char *str)
-{
-	uint8_t tmp;
-	char *ltext = NULL;
-	char *newtext;
-	char *oldtext;
-	int rc;
-
-	/* Do we have a selection? */
-	if (entry->sel_start != entry->pos)
-		ui_entry_delete_sel(entry);
-
-	tmp = entry->text[entry->pos];
-	entry->text[entry->pos] = '\0';
-	ltext = str_dup(entry->text);
-	if (ltext == NULL)
-		return ENOMEM;
-
-	entry->text[entry->pos] = tmp;
-
-	rc = asprintf(&newtext, "%s%s%s", ltext, str, entry->text + entry->pos);
-	if (rc < 0) {
-		free(ltext);
-		return ENOMEM;
-	}
-
-	oldtext = entry->text;
-	entry->text = newtext;
-	entry->pos += str_size(str);
-	free(oldtext);
-	free(ltext);
-
-	entry->sel_start = entry->pos;
-	ui_entry_scroll_update(entry, false);
-	ui_entry_paint(entry);
-
-	return EOK;
-}
-
-/** Delete character before cursor.
- *
- * @param entry Text entry
- */
-void ui_entry_backspace(ui_entry_t *entry)
-{
-	size_t off;
-
-	/* Do we have a selection? */
-	if (entry->sel_start != entry->pos) {
-		ui_entry_delete_sel(entry);
-		return;
-	}
-
-	if (entry->pos == 0)
-		return;
-
-	/* Find offset where character before cursor starts */
-	off = entry->pos;
-	(void) str_decode_reverse(entry->text, &off,
-	    str_size(entry->text));
-
-	memmove(entry->text + off, entry->text + entry->pos,
-	    str_size(entry->text + entry->pos) + 1);
-	entry->pos = off;
-	entry->sel_start = off;
-
-	ui_entry_scroll_update(entry, false);
-	ui_entry_paint(entry);
-}
-
-/** Delete character after cursor.
- *
- * @param entry Text entry
- */
-void ui_entry_delete(ui_entry_t *entry)
-{
-	size_t off;
-
-	/* Do we have a selection? */
-	if (entry->sel_start != entry->pos) {
-		ui_entry_delete_sel(entry);
-		return;
-	}
-
-	/* Find offset where character after cursor ends */
-	off = entry->pos;
-	(void) str_decode(entry->text, &off,
-	    str_size(entry->text));
-
-	memmove(entry->text + entry->pos, entry->text + off,
-	    str_size(entry->text + off) + 1);
-
-	ui_entry_scroll_update(entry, false);
-	ui_entry_paint(entry);
-}
-
-/** Copy selected text to clipboard.
- *
- * @param entry Text entry
- */
-void ui_entry_copy(ui_entry_t *entry)
-{
-	unsigned off1;
-	unsigned off2;
-	char c;
-
-	off1 = min(entry->pos, entry->sel_start);
-	off2 = max(entry->pos, entry->sel_start);
-
-	c = entry->text[off2];
-	entry->text[off2] = '\0';
-
-	(void) clipboard_put_str(entry->text + off1);
-
-	entry->text[off2] = c;
-}
-
-/** Cut selected text to clipboard.
- *
- * @param entry Text entry
- */
-void ui_entry_cut(ui_entry_t *entry)
-{
-	ui_entry_copy(entry);
-	ui_entry_delete_sel(entry);
-}
-
-/** Paste text from clipboard.
- *
- * @param entry Text entry
- */
-void ui_entry_paste(ui_entry_t *entry)
-{
-	char *str;
-	errno_t rc;
-
-	rc = clipboard_get_str(&str);
-	if (rc != EOK)
-		return;
-
-	ui_entry_insert_str(entry, str);
-	free(str);
-}
-
-/** Handle text entry key press without modifiers.
- *
- * @param entry Text entry
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_entry_key_press_unmod(ui_entry_t *entry, kbd_event_t *event)
-{
-	assert(event->type == KEY_PRESS);
-
-	switch (event->key) {
-	case KC_BACKSPACE:
-		ui_entry_backspace(entry);
-		break;
-
-	case KC_DELETE:
-		ui_entry_delete(entry);
-		break;
-
-	case KC_ESCAPE:
-		ui_entry_deactivate(entry);
-		break;
-
-	case KC_HOME:
-		ui_entry_seek_start(entry, false);
-		break;
-
-	case KC_END:
-		ui_entry_seek_end(entry, false);
-		break;
-
-	case KC_LEFT:
-		ui_entry_seek_prev_char(entry, false);
-		break;
-
-	case KC_RIGHT:
-		ui_entry_seek_next_char(entry, false);
-		break;
-
-	default:
-		break;
-	}
-	return ui_claimed;
-}
-
-/** Handle text entry key press with shift modifier.
- *
- * @param entry Text entry
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_entry_key_press_shift(ui_entry_t *entry, kbd_event_t *event)
-{
-	assert(event->type == KEY_PRESS);
-
-	switch (event->key) {
-	case KC_HOME:
-		ui_entry_seek_start(entry, true);
-		break;
-
-	case KC_END:
-		ui_entry_seek_end(entry, true);
-		break;
-
-	case KC_LEFT:
-		ui_entry_seek_prev_char(entry, true);
-		break;
-
-	case KC_RIGHT:
-		ui_entry_seek_next_char(entry, true);
-		break;
-
-	default:
-		break;
-	}
-
-	return ui_claimed;
-}
-
-/** Handle text entry key press with control modifier.
- *
- * @param entry Text entry
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_entry_key_press_ctrl(ui_entry_t *entry, kbd_event_t *event)
-{
-	assert(event->type == KEY_PRESS);
-
-	switch (event->key) {
-	case KC_C:
-		ui_entry_copy(entry);
-		break;
-	case KC_V:
-		ui_entry_paste(entry);
-		break;
-	case KC_X:
-		ui_entry_cut(entry);
-		break;
-	default:
-		break;
-	}
-
-	return ui_claimed;
-}
-
-/** Handle text entry keyboard event.
- *
- * @param entry Text entry
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_entry_kbd_event(ui_entry_t *entry, kbd_event_t *event)
-{
-	char buf[STR_BOUNDS(1) + 1];
-	size_t off;
-	errno_t rc;
-
-	if (!entry->active)
-		return ui_unclaimed;
-
-	/*
-	 * Need to keep track if any shift is held for the case
-	 * of selecting by shift-click. This could be simplified
-	 * if position events were decorated with modifier
-	 * state.
-	 */
-
-	if (event->type == KEY_PRESS && event->key == KC_LSHIFT)
-		entry->lshift_held = true;
-	if (event->type == KEY_RELEASE && event->key == KC_LSHIFT)
-		entry->lshift_held = false;
-	if (event->type == KEY_PRESS && event->key == KC_RSHIFT)
-		entry->rshift_held = true;
-	if (event->type == KEY_RELEASE && event->key == KC_RSHIFT)
-		entry->rshift_held = false;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_ALT)) == 0 && event->c >= ' ') {
-		off = 0;
-		rc = chr_encode(event->c, buf, &off, sizeof(buf));
-		if (rc == EOK) {
-			buf[off] = '\0';
-			(void) ui_entry_insert_str(entry, buf);
-		}
-	}
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0)
-		return ui_entry_key_press_unmod(entry, event);
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & KM_SHIFT) != 0 &&
-	    (event->mods & (KM_CTRL | KM_ALT)) == 0)
-		return ui_entry_key_press_shift(entry, event);
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & KM_CTRL) != 0 &&
-	    (event->mods & (KM_ALT | KM_SHIFT)) == 0)
-		return ui_entry_key_press_ctrl(entry, event);
-
-	return ui_claimed;
-}
-
-/** Handle text entry position event.
- *
- * @param entry Text entry
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_entry_pos_event(ui_entry_t *entry, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-
-	if (entry->read_only)
-		return ui_unclaimed;
-
-	if (event->type == POS_UPDATE) {
-		pos.x = event->hpos;
-		pos.y = event->vpos;
-
-		/* Change cursor shape when pointer is entering/leaving */
-		if (gfx_pix_inside_rect(&pos, &entry->rect)) {
-			if (!entry->pointer_inside) {
-				ui_window_set_ctl_cursor(entry->window,
-				    ui_curs_ibeam);
-				entry->pointer_inside = true;
-			}
-		} else {
-			if (entry->pointer_inside) {
-				ui_window_set_ctl_cursor(entry->window,
-				    ui_curs_arrow);
-				entry->pointer_inside = false;
-			}
-		}
-
-		if (entry->held) {
-			/*
-			 * Selecting using mouse drag: Change pos,
-			 * keep sel_start
-			 */
-			entry->pos = ui_entry_find_pos(entry, &pos);
-			ui_entry_paint(entry);
-		}
-	}
-
-	if (event->type == POS_PRESS) {
-		pos.x = event->hpos;
-		pos.y = event->vpos;
-
-		if (gfx_pix_inside_rect(&pos, &entry->rect)) {
-			/* Clicked inside - activate, set position */
-			entry->held = true;
-			entry->pos = ui_entry_find_pos(entry, &pos);
-
-			/* Clear selection if no shift key is held */
-			if (!entry->lshift_held && !entry->rshift_held)
-				entry->sel_start = entry->pos;
-
-			if (entry->active)
-				ui_entry_paint(entry);
-			else
-				ui_entry_activate(entry);
-
-			return ui_claimed;
-		} else {
-			/* Clicked outside - deactivate */
-			ui_entry_deactivate(entry);
-		}
-	}
-
-	if (event->type == POS_RELEASE) {
-		entry->held = false;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle text entry control keyboard event.
- *
- * @param arg Argument (ui_entry_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-static ui_evclaim_t ui_entry_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_entry_t *entry = (ui_entry_t *) arg;
-
-	return ui_entry_kbd_event(entry, event);
-}
-
-/** Handle text entry control position event.
- *
- * @param arg Argument (ui_entry_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-static ui_evclaim_t ui_entry_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_entry_t *entry = (ui_entry_t *) arg;
-
-	return ui_entry_pos_event(entry, event);
-}
-
-/** Get text entry geometry.
- *
- * @param entry Text entry
- * @param geom Structure to fill in with computed geometry
- */
-void ui_entry_get_geom(ui_entry_t *entry, ui_entry_geom_t *geom)
-{
-	gfx_coord_t hpad;
-	gfx_coord_t vpad;
-	ui_resource_t *res;
-
-	res = ui_window_get_res(entry->window);
-
-	if (res->textmode) {
-		hpad = ui_entry_hpad_text;
-		vpad = ui_entry_vpad_text;
-	} else {
-		hpad = ui_entry_hpad;
-		vpad = ui_entry_vpad;
-	}
-
-	if (res->textmode == false) {
-		ui_paint_get_inset_frame_inside(res, &entry->rect,
-		    &geom->interior_rect);
-	} else {
-		geom->interior_rect = entry->rect;
-	}
-
-	geom->text_rect.p0.x = geom->interior_rect.p0.x + hpad;
-	geom->text_rect.p0.y = geom->interior_rect.p0.y + vpad;
-	geom->text_rect.p1.x = geom->interior_rect.p1.x - hpad;
-	geom->text_rect.p1.y = geom->interior_rect.p1.y - vpad;
-
-	geom->text_pos.x = geom->interior_rect.p0.x + hpad +
-	    entry->scroll_pos;
-	geom->text_pos.y = geom->interior_rect.p0.y + vpad;
-
-	switch (entry->halign) {
-	case gfx_halign_left:
-	case gfx_halign_justify:
-		geom->anchor_x = geom->text_rect.p0.x;
-		break;
-	case gfx_halign_center:
-		geom->anchor_x = (geom->text_rect.p0.x +
-		    geom->text_rect.p1.x) / 2;
-		break;
-	case gfx_halign_right:
-		geom->anchor_x = geom->text_rect.p1.x;
-		break;
-	}
-}
-
-/** Activate text entry.
- *
- * @param entry Text entry
- */
-void ui_entry_activate(ui_entry_t *entry)
-{
-	ui_resource_t *res;
-
-	res = ui_window_get_res(entry->window);
-
-	if (entry->active)
-		return;
-
-	entry->active = true;
-	(void) ui_entry_paint(entry);
-
-	if (res->textmode)
-		gfx_cursor_set_visible(res->gc, true);
-}
-
-/** Move text cursor to the beginning of text.
- *
- * @param entry Text entry
- * @param shift @c true iff shift key is pressed
- */
-void ui_entry_seek_start(ui_entry_t *entry, bool shift)
-{
-	entry->pos = 0;
-
-	if (!shift)
-		entry->sel_start = entry->pos;
-
-	ui_entry_scroll_update(entry, false);
-	(void) ui_entry_paint(entry);
-}
-
-/** Move text cursor to the end of text.
- *
- * @param entry Text entry
- * @param shift @c true iff shift key is pressed
- */
-void ui_entry_seek_end(ui_entry_t *entry, bool shift)
-{
-	entry->pos = str_size(entry->text);
-
-	if (!shift)
-		entry->sel_start = entry->pos;
-
-	ui_entry_scroll_update(entry, false);
-	(void) ui_entry_paint(entry);
-}
-
-/** Move text cursor one character backward.
- *
- * @param entry Text entry
- * @param shift @c true iff shift key is pressed
- */
-void ui_entry_seek_prev_char(ui_entry_t *entry, bool shift)
-{
-	size_t off;
-
-	off = entry->pos;
-	(void) str_decode_reverse(entry->text, &off,
-	    str_size(entry->text));
-	entry->pos = off;
-
-	if (!shift)
-		entry->sel_start = entry->pos;
-
-	ui_entry_scroll_update(entry, false);
-	(void) ui_entry_paint(entry);
-}
-
-/** Move text cursor one character forward.
- *
- * @param entry Text entry
- * @param shift @c true iff shift key is pressed
- */
-void ui_entry_seek_next_char(ui_entry_t *entry, bool shift)
-{
-	size_t off;
-
-	off = entry->pos;
-	(void) str_decode(entry->text, &off,
-	    str_size(entry->text));
-	entry->pos = off;
-
-	if (!shift)
-		entry->sel_start = entry->pos;
-
-	ui_entry_scroll_update(entry, false);
-	(void) ui_entry_paint(entry);
-}
-
-/** Deactivate text entry.
- *
- * @param entry Text entry
- */
-void ui_entry_deactivate(ui_entry_t *entry)
-{
-	ui_resource_t *res;
-
-	res = ui_window_get_res(entry->window);
-
-	if (!entry->active)
-		return;
-
-	entry->active = false;
-	entry->sel_start = entry->pos;
-	(void) ui_entry_paint(entry);
-
-	if (res->textmode)
-		gfx_cursor_set_visible(res->gc, false);
-}
-
-/** Update text entry scroll position.
- *
- * @param entry Text entry
- * @param realign @c true iff we should left-align short text.
- *                This should be only used when changing text alignment,
- *                because left-aligned text entries should not realign
- *                the text to the left side under normal circumstances.
- */
-void ui_entry_scroll_update(ui_entry_t *entry, bool realign)
-{
-	ui_entry_geom_t geom;
-	gfx_coord_t x;
-	gfx_coord_t width;
-	gfx_coord2_t tpos;
-	gfx_coord2_t anchor;
-	gfx_text_fmt_t fmt;
-	ui_resource_t *res;
-
-	res = ui_window_get_res(entry->window);
-
-	ui_entry_get_geom(entry, &geom);
-
-	/* Compute position where cursor is currently displayed at */
-	x = geom.text_pos.x + ui_entry_lwidth(entry);
-
-	/* Is cursor off to the left? */
-	if (x < geom.text_rect.p0.x) {
-		/*
-		 * Scroll to make cursor visible and put some space between it
-		 * and the left edge of the text rectangle.
-		 */
-		entry->scroll_pos += geom.text_rect.p0.x - x +
-		    ui_entry_left_scroll_margin;
-
-		/*
-		 * We don't want to scroll further than what's needed
-		 * to reveal the beginning of the text.
-		 */
-		if (entry->scroll_pos > 0)
-			entry->scroll_pos = 0;
-	}
-
-	/*
-	 * Is cursor off to the right? Note that the width of the cursor
-	 * is deliberately not taken into account (i.e. we only care
-	 * about the left edge of the cursor).
-	 */
-	if (x > geom.text_rect.p1.x)
-		entry->scroll_pos -= x - geom.text_rect.p1.x;
-
-	width = gfx_text_width(res->font, entry->text);
-
-	if (width < geom.text_rect.p1.x - geom.text_rect.p0.x &&
-	    (realign || entry->halign != gfx_halign_left)) {
-		/* Text fits inside entry, so we need to align it */
-		anchor.x = geom.anchor_x;
-		anchor.y = 0;
-		gfx_text_fmt_init(&fmt);
-		fmt.font = res->font;
-		fmt.halign = entry->halign;
-		gfx_text_start_pos(&anchor, &fmt, entry->text, &tpos);
-		entry->scroll_pos = tpos.x - geom.text_rect.p0.x;
-	} else if (geom.text_pos.x + width < geom.text_rect.p1.x &&
-	    entry->halign != gfx_halign_left) {
-		/* Text is long, unused space on the right */
-		entry->scroll_pos += geom.text_rect.p1.x -
-		    geom.text_pos.x - width;
-	}
-}
-
-/** @}
- */
Index: pace/lib/ui/src/filedialog.c
===================================================================
--- uspace/lib/ui/src/filedialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,477 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file File dialog
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <ui/entry.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/filedialog.h>
-#include <ui/filelist.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/filedialog.h"
-
-static void ui_file_dialog_wnd_close(ui_window_t *, void *);
-static void ui_file_dialog_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-ui_window_cb_t ui_file_dialog_wnd_cb = {
-	.close = ui_file_dialog_wnd_close,
-	.kbd = ui_file_dialog_wnd_kbd
-};
-
-static void ui_file_dialog_flist_activate_req(ui_file_list_t *, void *);
-static void ui_file_dialog_flist_selected(ui_file_list_t *, void *,
-    const char *);
-
-ui_file_list_cb_t ui_file_dialog_flist_cb = {
-	.activate_req = ui_file_dialog_flist_activate_req,
-	.selected = ui_file_dialog_flist_selected
-};
-
-static void ui_file_dialog_bok_clicked(ui_pbutton_t *, void *);
-static void ui_file_dialog_bcancel_clicked(ui_pbutton_t *, void *);
-
-ui_pbutton_cb_t ui_file_dialog_bok_cb = {
-	.clicked = ui_file_dialog_bok_clicked
-};
-
-ui_pbutton_cb_t ui_file_dialog_bcancel_cb = {
-	.clicked = ui_file_dialog_bcancel_clicked
-};
-
-/** Initialize file dialog parameters structure.
- *
- * File dialog parameters structure must always be initialized using
- * this function first.
- *
- * @param params File dialog parameters structure
- */
-void ui_file_dialog_params_init(ui_file_dialog_params_t *params)
-{
-	memset(params, 0, sizeof(ui_file_dialog_params_t));
-	params->ifname = "";
-}
-
-/** Create new file dialog.
- *
- * @param ui User interface
- * @param params File dialog parameters
- * @param rdialog Place to store pointer to new dialog
- * @return EOK on success or an error code
- */
-errno_t ui_file_dialog_create(ui_t *ui, ui_file_dialog_params_t *params,
-    ui_file_dialog_t **rdialog)
-{
-	errno_t rc;
-	ui_file_dialog_t *dialog;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t wparams;
-	ui_fixed_t *fixed = NULL;
-	ui_label_t *label = NULL;
-	ui_entry_t *entry = NULL;
-	ui_file_list_t *flist = NULL;
-	ui_pbutton_t *bok = NULL;
-	ui_pbutton_t *bcancel = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-
-	dialog = calloc(1, sizeof(ui_file_dialog_t));
-	if (dialog == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = params->caption;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 40;
-		wparams.rect.p1.y = 20;
-	} else {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 300;
-		wparams.rect.p1.y = 335;
-	}
-
-	rc = ui_window_create(ui, &wparams, &window);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_set_cb(window, &ui_file_dialog_wnd_cb, dialog);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_label_create(ui_res, "File Name:", &label);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 2;
-		rect.p1.x = 17;
-		rect.p1.y = 3;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 35;
-		rect.p1.x = 190;
-		rect.p1.y = 50;
-	}
-
-	ui_label_set_rect(label, &rect);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(label));
-	if (rc != EOK)
-		goto error;
-
-	label = NULL;
-
-	rc = ui_entry_create(window, params->ifname, &entry);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 3;
-		rect.p1.x = 37;
-		rect.p1.y = 4;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 55;
-		rect.p1.x = 290;
-		rect.p1.y = 80;
-	}
-
-	ui_entry_set_rect(entry, &rect);
-
-	rc = ui_fixed_add(fixed, ui_entry_ctl(entry));
-	if (rc != EOK)
-		goto error;
-
-	ui_entry_activate(entry);
-
-	/* Select all */
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_end(entry, true);
-
-	dialog->ename = entry;
-	entry = NULL;
-
-	/* Files label */
-	rc = ui_label_create(ui_res, "Files:", &label);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 5;
-		rect.p1.x = 17;
-		rect.p1.y = 6;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 90;
-		rect.p1.x = 190;
-		rect.p1.y = 105;
-	}
-
-	ui_label_set_rect(label, &rect);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(label));
-	if (rc != EOK)
-		goto error;
-
-	label = NULL;
-
-	/* File list */
-
-	rc = ui_file_list_create(window, false, &flist);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 6;
-		rect.p1.x = 37;
-		rect.p1.y = 16;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 110;
-		rect.p1.x = 290;
-		rect.p1.y = 280;
-	}
-
-	ui_file_list_set_rect(flist, &rect);
-	ui_file_list_set_cb(flist, &ui_file_dialog_flist_cb, dialog);
-
-	rc = ui_fixed_add(fixed, ui_file_list_ctl(flist));
-	if (rc != EOK)
-		goto error;
-
-	dialog->flist = flist;
-	flist = NULL;
-
-	rc = ui_file_list_read_dir(dialog->flist, ".");
-	if (rc != EOK)
-		goto error;
-
-	/* OK button */
-
-	rc = ui_pbutton_create(ui_res, "OK", &bok);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bok, &ui_file_dialog_bok_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 10;
-		rect.p0.y = 17;
-		rect.p1.x = 20;
-		rect.p1.y = 18;
-	} else {
-		rect.p0.x = 55;
-		rect.p0.y = 290;
-		rect.p1.x = 145;
-		rect.p1.y = 318;
-	}
-
-	ui_pbutton_set_rect(bok, &rect);
-
-	ui_pbutton_set_default(bok, true);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bok));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bok = bok;
-	bok = NULL;
-
-	/* Cancel button */
-
-	rc = ui_pbutton_create(ui_res, "Cancel", &bcancel);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bcancel, &ui_file_dialog_bcancel_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 22;
-		rect.p0.y = 17;
-		rect.p1.x = 32;
-		rect.p1.y = 18;
-	} else {
-		rect.p0.x = 155;
-		rect.p0.y = 290;
-		rect.p1.x = 245;
-		rect.p1.y = 318;
-	}
-
-	ui_pbutton_set_rect(bcancel, &rect);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bcancel));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bcancel = bcancel;
-	bcancel = NULL;
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK)
-		goto error;
-
-	dialog->window = window;
-	*rdialog = dialog;
-	return EOK;
-error:
-	if (entry != NULL)
-		ui_entry_destroy(entry);
-	if (flist != NULL)
-		ui_file_list_destroy(flist);
-	if (bok != NULL)
-		ui_pbutton_destroy(bok);
-	if (bcancel != NULL)
-		ui_pbutton_destroy(bcancel);
-	if (label != NULL)
-		ui_label_destroy(label);
-	if (fixed != NULL)
-		ui_fixed_destroy(fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (dialog != NULL)
-		free(dialog);
-	return rc;
-}
-
-/** Destroy file dialog.
- *
- * @param dialog File dialog or @c NULL
- */
-void ui_file_dialog_destroy(ui_file_dialog_t *dialog)
-{
-	if (dialog == NULL)
-		return;
-
-	ui_window_destroy(dialog->window);
-	free(dialog);
-}
-
-/** Set mesage dialog callback.
- *
- * @param dialog File dialog
- * @param cb File dialog callbacks
- * @param arg Callback argument
- */
-void ui_file_dialog_set_cb(ui_file_dialog_t *dialog, ui_file_dialog_cb_t *cb,
-    void *arg)
-{
-	dialog->cb = cb;
-	dialog->arg = arg;
-}
-
-/** File dialog window close handler.
- *
- * @param window Window
- * @param arg Argument (ui_file_dialog_t *)
- */
-static void ui_file_dialog_wnd_close(ui_window_t *window, void *arg)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->close != NULL)
-		dialog->cb->close(dialog, dialog->arg);
-}
-
-/** File dialog window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (ui_file_dialog_t *)
- * @param event Keyboard event
- */
-static void ui_file_dialog_wnd_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-	const char *fname;
-	ui_evclaim_t claim;
-
-	claim = ui_window_def_kbd(window, event);
-	if (claim == ui_claimed)
-		return;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_SHIFT | KM_ALT)) == 0) {
-		if (event->key == KC_ENTER) {
-			/* Confirm */
-			if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-				fname = ui_entry_get_text(dialog->ename);
-				dialog->cb->bok(dialog, dialog->arg, fname);
-				return;
-			}
-		} else if (event->key == KC_ESCAPE) {
-			/* Cancel */
-			if (dialog->cb != NULL && dialog->cb->bcancel != NULL) {
-				dialog->cb->bcancel(dialog, dialog->arg);
-				return;
-			}
-		}
-	}
-}
-
-static void ui_file_dialog_flist_activate_req(ui_file_list_t *flist, void *arg)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-
-	ui_file_list_activate(dialog->flist);
-	ui_entry_deactivate(dialog->ename);
-}
-
-static void ui_file_dialog_flist_selected(ui_file_list_t *flist, void *arg,
-    const char *fname)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-
-	dialog->cb->bok(dialog, dialog->arg, fname);
-}
-
-/** File dialog OK button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_file_dialog_t *)
- */
-static void ui_file_dialog_bok_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-	const char *fname;
-
-	if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-		fname = ui_entry_get_text(dialog->ename);
-		dialog->cb->bok(dialog, dialog->arg, fname);
-	}
-}
-
-/** File dialog cancel button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_file_dialog_t *)
- */
-static void ui_file_dialog_bcancel_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_file_dialog_t *dialog = (ui_file_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->bcancel != NULL)
-		dialog->cb->bcancel(dialog, dialog->arg);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/filelist.c
===================================================================
--- uspace/lib/ui/src/filelist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,735 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/** @file File list control.
- *
- * Displays a file listing.
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/filelist.h>
-#include <ui/list.h>
-#include <ui/resource.h>
-#include <vfs/vfs.h>
-#include <qsort.h>
-#include "../private/filelist.h"
-#include "../private/list.h"
-#include "../private/resource.h"
-
-static void ui_file_list_ctl_destroy(void *);
-static errno_t ui_file_list_ctl_paint(void *);
-static ui_evclaim_t ui_file_list_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_file_list_ctl_pos_event(void *, pos_event_t *);
-
-/** List control ops */
-ui_control_ops_t ui_file_list_ctl_ops = {
-	.destroy = ui_file_list_ctl_destroy,
-	.paint = ui_file_list_ctl_paint,
-	.kbd_event = ui_file_list_ctl_kbd_event,
-	.pos_event = ui_file_list_ctl_pos_event
-};
-
-static void ui_file_list_list_activate_req(ui_list_t *, void *);
-static void ui_file_list_list_selected(ui_list_entry_t *, void *);
-
-/** List callbacks */
-ui_list_cb_t ui_file_list_list_cb = {
-	.activate_req = ui_file_list_list_activate_req,
-	.selected = ui_file_list_list_selected,
-	.compare = ui_file_list_list_compare,
-};
-
-/** Create file list.
- *
- * @param window Containing window
- * @param active @c true iff file list should be active
- * @param rflist Place to store pointer to new file list
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_create(ui_window_t *window, bool active,
-    ui_file_list_t **rflist)
-{
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	flist = calloc(1, sizeof(ui_file_list_t));
-	if (flist == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_file_list_ctl_ops, (void *)flist,
-	    &flist->control);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x0f, &flist->dir_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x0a, &flist->svc_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_list_create(window, active, &flist->list);
-	if (rc != EOK)
-		goto error;
-
-	ui_list_set_cb(flist->list, &ui_file_list_list_cb, (void *)flist);
-
-	flist->window = window;
-	*rflist = flist;
-	return EOK;
-error:
-	ui_control_delete(flist->control);
-	if (flist->dir_color != NULL)
-		gfx_color_delete(flist->dir_color);
-	if (flist->svc_color != NULL)
-		gfx_color_delete(flist->svc_color);
-	free(flist);
-	return rc;
-}
-
-/** Destroy file list.
- *
- * @param flist File list
- */
-void ui_file_list_destroy(ui_file_list_t *flist)
-{
-	ui_file_list_clear_entries(flist);
-	ui_list_destroy(flist->list);
-	ui_control_delete(flist->control);
-	free(flist);
-}
-
-/** Set file list callbacks.
- *
- * @param flist File list
- * @param cb Callbacks
- * @param arg Argument to callback functions
- */
-void ui_file_list_set_cb(ui_file_list_t *flist, ui_file_list_cb_t *cb, void *arg)
-{
-	flist->cb = cb;
-	flist->cb_arg = arg;
-}
-
-/** Get base control for file list.
- *
- * @param flist File list
- * @return Base UI control
- */
-ui_control_t *ui_file_list_ctl(ui_file_list_t *flist)
-{
-	return flist->control;
-}
-
-/** Set file list rectangle.
- *
- * @param flist File list
- * @param rect Rectangle
- */
-void ui_file_list_set_rect(ui_file_list_t *flist, gfx_rect_t *rect)
-{
-	ui_list_set_rect(flist->list, rect);
-}
-
-/** Determine if file list is active.
- *
- * @param flist File list
- * @return @c true iff file list is active
- */
-bool ui_file_list_is_active(ui_file_list_t *flist)
-{
-	return ui_list_is_active(flist->list);
-}
-
-/** Activate file list.
- *
- * @param flist File list
- *
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_activate(ui_file_list_t *flist)
-{
-	errno_t rc;
-
-	if (flist->dir != NULL) {
-		rc = vfs_cwd_set(flist->dir);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return ui_list_activate(flist->list);
-}
-
-/** Deactivate file list.
- *
- * @param flist File list
- */
-void ui_file_list_deactivate(ui_file_list_t *flist)
-{
-	ui_list_deactivate(flist->list);
-}
-
-/** Initialize file list entry attributes.
- *
- * @param attr Attributes
- */
-void ui_file_list_entry_attr_init(ui_file_list_entry_attr_t *attr)
-{
-	memset(attr, 0, sizeof(*attr));
-}
-
-/** Append new file list entry.
- *
- * @param flist File list
- * @param attr Entry attributes
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_entry_append(ui_file_list_t *flist, ui_file_list_entry_attr_t *attr)
-{
-	ui_file_list_entry_t *entry;
-	ui_list_entry_attr_t lattr;
-	ui_list_entry_t *lentry;
-	ui_resource_t *res;
-	char *caption;
-	errno_t rc;
-	int rv;
-
-	res = ui_window_get_res(flist->window);
-
-	entry = calloc(1, sizeof(ui_file_list_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->flist = flist;
-	entry->name = str_dup(attr->name);
-	if (entry->name == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	entry->size = attr->size;
-	entry->isdir = attr->isdir;
-	entry->svc = attr->svc;
-
-	if (attr->isdir && !res->textmode) {
-		rv = asprintf(&caption, "[%s]", attr->name);
-		if (rv < 0)
-			caption = NULL;
-	} else {
-		caption = str_dup(attr->name);
-	}
-
-	if (caption == NULL) {
-		free(entry->name);
-		free(entry);
-		return ENOMEM;
-	}
-
-	lattr.caption = caption;
-	lattr.arg = (void *)entry;
-	lattr.color = NULL;
-	lattr.bgcolor = NULL;
-
-	if (res->textmode) {
-		if (attr->isdir) {
-			lattr.color = flist->dir_color;
-			lattr.bgcolor = flist->dir_color;
-		} else if (attr->svc != 0) {
-			lattr.color = flist->svc_color;
-			lattr.bgcolor = flist->svc_color;
-		}
-	}
-
-	rc = ui_list_entry_append(flist->list, &lattr, &lentry);
-	if (rc != EOK) {
-		free(caption);
-		free(entry->name);
-		free(entry);
-		return rc;
-	}
-
-	free(caption);
-	entry->entry = lentry;
-	return EOK;
-}
-
-/** Delete file list entry.
- *
- * @param entry File list entry
- */
-void ui_file_list_entry_destroy(ui_file_list_entry_t *entry)
-{
-	ui_list_entry_destroy(entry->entry);
-	free(entry->name);
-	free(entry);
-}
-
-/** Clear file list entry list.
- *
- * @param flist File list
- */
-void ui_file_list_clear_entries(ui_file_list_t *flist)
-{
-	ui_file_list_entry_t *entry;
-
-	entry = ui_file_list_first(flist);
-	while (entry != NULL) {
-		ui_file_list_entry_destroy(entry);
-		entry = ui_file_list_first(flist);
-	}
-}
-
-/** Read directory into file list entry list.
- *
- * @param flist File list
- * @param dirname Directory path
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_read_dir(ui_file_list_t *flist, const char *dirname)
-{
-	DIR *dir;
-	struct dirent *dirent;
-	vfs_stat_t finfo;
-	char newdir[256];
-	char *ndir = NULL;
-	ui_file_list_entry_attr_t attr;
-	ui_file_list_entry_t *cur;
-	ui_file_list_entry_t *next;
-	char *olddn;
-	errno_t rc;
-
-	rc = vfs_cwd_set(dirname);
-	if (rc != EOK)
-		return rc;
-
-	rc = vfs_cwd_get(newdir, sizeof(newdir));
-	if (rc != EOK)
-		return rc;
-
-	ndir = str_dup(newdir);
-	if (ndir == NULL)
-		return ENOMEM;
-
-	dir = opendir(".");
-	if (dir == NULL) {
-		rc = errno;
-		goto error;
-	}
-
-	if (str_cmp(ndir, "/") != 0) {
-		/* Need to add a synthetic up-dir entry */
-		ui_file_list_entry_attr_init(&attr);
-		attr.name = "..";
-		attr.isdir = true;
-
-		rc = ui_file_list_entry_append(flist, &attr);
-		if (rc != EOK)
-			goto error;
-	}
-
-	dirent = readdir(dir);
-	while (dirent != NULL) {
-		rc = vfs_stat_path(dirent->d_name, &finfo);
-		if (rc != EOK) {
-			/* Possibly a stale entry */
-			dirent = readdir(dir);
-			continue;
-		}
-
-		ui_file_list_entry_attr_init(&attr);
-		attr.name = dirent->d_name;
-		attr.size = finfo.size;
-		attr.isdir = finfo.is_directory;
-		attr.svc = finfo.service;
-
-		rc = ui_file_list_entry_append(flist, &attr);
-		if (rc != EOK)
-			goto error;
-
-		dirent = readdir(dir);
-	}
-
-	closedir(dir);
-
-	rc = ui_file_list_sort(flist);
-	if (rc != EOK)
-		goto error;
-
-	/* Moving up? */
-	if (str_cmp(dirname, "..") == 0) {
-		/* Get the last component of old path */
-		olddn = str_rchr(flist->dir, '/');
-		if (olddn != NULL && *olddn != '\0') {
-			/* Find corresponding entry */
-			++olddn;
-			cur = ui_file_list_first(flist);
-			next = ui_file_list_next(cur);
-			while (next != NULL && str_cmp(next->name, olddn) <= 0 &&
-			    next->isdir) {
-				cur = next;
-				next = ui_file_list_next(cur);
-			}
-
-			/* Center on the entry */
-			ui_list_cursor_center(flist->list, cur->entry);
-		}
-	}
-
-	free(flist->dir);
-	flist->dir = ndir;
-
-	return EOK;
-error:
-	(void) vfs_cwd_set(flist->dir);
-	if (ndir != NULL)
-		free(ndir);
-	if (dir != NULL)
-		closedir(dir);
-	return rc;
-}
-
-/** Sort file list entries.
- *
- * @param flist File list
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_file_list_sort(ui_file_list_t *flist)
-{
-	return ui_list_sort(flist->list);
-}
-
-/** Compare two list entries within file list entries.
- *
- * @param ea First UI list entry
- * @param eb Second UI list entry
- * @return <0, =0, >=0 if a < b, a == b, a > b, resp.
- */
-int ui_file_list_list_compare(ui_list_entry_t *ea, ui_list_entry_t *eb)
-{
-	ui_file_list_entry_t *a;
-	ui_file_list_entry_t *b;
-	int dcmp;
-
-	a = (ui_file_list_entry_t *)ui_list_entry_get_arg(ea);
-	b = (ui_file_list_entry_t *)ui_list_entry_get_arg(eb);
-
-	/* Sort directories first */
-	dcmp = b->isdir - a->isdir;
-	if (dcmp != 0)
-		return dcmp;
-
-	return str_cmp(a->name, b->name);
-}
-
-/** Return first file list entry.
- *
- * @param flist File list
- * @return First file list entry or @c NULL if there are no entries
- */
-ui_file_list_entry_t *ui_file_list_first(ui_file_list_t *flist)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_first(flist->list);
-	if (lentry == NULL)
-		return NULL;
-
-	return (ui_file_list_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Return last file list entry.
- *
- * @param flist File list
- * @return Last file list entry or @c NULL if there are no entries
- */
-ui_file_list_entry_t *ui_file_list_last(ui_file_list_t *flist)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_last(flist->list);
-	if (lentry == NULL)
-		return NULL;
-
-	return (ui_file_list_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Return next file list entry.
- *
- * @param cur Current entry
- * @return Next entry or @c NULL if @a cur is the last entry
- */
-ui_file_list_entry_t *ui_file_list_next(ui_file_list_entry_t *cur)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_next(cur->entry);
-	if (lentry == NULL)
-		return NULL;
-
-	return (ui_file_list_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Return previous file list entry.
- *
- * @param cur Current entry
- * @return Previous entry or @c NULL if @a cur is the first entry
- */
-ui_file_list_entry_t *ui_file_list_prev(ui_file_list_entry_t *cur)
-{
-	ui_list_entry_t *lentry;
-
-	lentry = ui_list_prev(cur->entry);
-	if (lentry == NULL)
-		return NULL;
-
-	return (ui_file_list_entry_t *)ui_list_entry_get_arg(lentry);
-}
-
-/** Get entry under cursor.
- *
- * @param flist File list
- * @return Current cursor
- */
-ui_file_list_entry_t *ui_file_list_get_cursor(ui_file_list_t *flist)
-{
-	ui_list_entry_t *entry;
-
-	entry = ui_list_get_cursor(flist->list);
-	if (entry == NULL)
-		return NULL;
-
-	return (ui_file_list_entry_t *)ui_list_entry_get_arg(entry);
-}
-
-/** Get file list entry attributes.
- *
- * @param entry File list entry
- * @return Current cursor
- */
-void ui_file_list_entry_get_attr(ui_file_list_entry_t *entry,
-    ui_file_list_entry_attr_t *attr)
-{
-	attr->name = entry->name;
-	attr->size = entry->size;
-	attr->isdir = entry->isdir;
-	attr->svc = entry->svc;
-}
-
-/** Open file list entry.
- *
- * Perform Open action on a file list entry (e.g. switch to a subdirectory).
- *
- * @param flist File list
- * @param entry File list entry
- *
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_open(ui_file_list_t *flist, ui_file_list_entry_t *entry)
-{
-	if (entry->isdir)
-		return ui_file_list_open_dir(flist, entry);
-	else if (entry->svc == 0)
-		return ui_file_list_open_file(flist, entry);
-	else
-		return EOK;
-}
-
-/** Open file list directory entry.
- *
- * Perform Open action on a directory entry (i.e. switch to the directory).
- *
- * @param flist File list
- * @param entry File list entry (which is a directory)
- *
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_open_dir(ui_file_list_t *flist,
-    ui_file_list_entry_t *entry)
-{
-	char *dirname;
-	errno_t rc;
-
-	assert(entry->isdir);
-
-	/*
-	 * Need to copy out name before we free the entry below
-	 * via ui_file_list_clear_entries().
-	 */
-	dirname = str_dup(entry->name);
-	if (dirname == NULL)
-		return ENOMEM;
-
-	ui_file_list_clear_entries(flist);
-
-	rc = ui_file_list_read_dir(flist, dirname);
-	if (rc != EOK) {
-		free(dirname);
-		return rc;
-	}
-
-	free(dirname);
-
-	rc = ui_file_list_paint(flist);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Open file list file entry.
- *
- * Perform Open action on a file entry (i.e. try running it).
- *
- * @param flist File list
- * @param entry File list entry (which is a file)
- *
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_open_file(ui_file_list_t *flist,
-    ui_file_list_entry_t *entry)
-{
-	ui_file_list_selected(flist, entry->name);
-	return EOK;
-}
-
-/** Request file list activation.
- *
- * Call back to request file list activation.
- *
- * @param flist File list
- */
-void ui_file_list_activate_req(ui_file_list_t *flist)
-{
-	if (flist->cb != NULL && flist->cb->activate_req != NULL)
-		flist->cb->activate_req(flist, flist->cb_arg);
-}
-
-/** Call back when a file is selected.
- *
- * @param flist File list
- * @param fname File name
- */
-void ui_file_list_selected(ui_file_list_t *flist, const char *fname)
-{
-	if (flist->cb != NULL && flist->cb->selected != NULL)
-		flist->cb->selected(flist, flist->cb_arg, fname);
-}
-
-/** Paint file list.
- *
- * @param flist File list
- * @return EOK on success or an error code.
- */
-errno_t ui_file_list_paint(ui_file_list_t *flist)
-{
-	return ui_control_paint(ui_list_ctl(flist->list));
-}
-
-/** Destroy file list control.
- *
- * @param arg Argument (ui_list_t *)
- */
-void ui_file_list_ctl_destroy(void *arg)
-{
-	ui_file_list_t *flist = (ui_file_list_t *) arg;
-
-	ui_file_list_destroy(flist);
-}
-
-/** Paint file list control.
- *
- * @param arg Argument (ui_file_list_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_file_list_ctl_paint(void *arg)
-{
-	ui_file_list_t *flist = (ui_file_list_t *) arg;
-
-	return ui_file_list_paint(flist);
-}
-
-/** Handle file list control keyboard event.
- *
- * @param arg Argument (ui_file_list_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_file_list_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_file_list_t *flist = (ui_file_list_t *) arg;
-
-	return ui_control_kbd_event(ui_list_ctl(flist->list), event);
-}
-
-/** Handle file list control position event.
- *
- * @param arg Argument (ui_file_list_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_file_list_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_file_list_t *flist = (ui_file_list_t *) arg;
-
-	return ui_control_pos_event(ui_list_ctl(flist->list), event);
-}
-
-/** Activate request callback handler for UI list within file list.
- *
- * @param list UI list
- * @param arg Argument (File list)
- */
-static void ui_file_list_list_activate_req(ui_list_t *list, void *arg)
-{
-	ui_file_list_t *flist = (ui_file_list_t *)arg;
-
-	ui_file_list_activate_req(flist);
-}
-
-/** Entry selected callback handler for UI list within file list.
- *
- * @param entr Activated UI list entry
- * @param arg Argument (File list entry)
- */
-static void ui_file_list_list_selected(ui_list_entry_t *entry, void *arg)
-{
-	ui_file_list_entry_t *fentry = (void *)arg;
-
-	(void) ui_file_list_open(fentry->flist, fentry);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/fixed.c
===================================================================
--- uspace/lib/ui/src/fixed.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,340 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Fixed layout
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <errno.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <ui/control.h>
-#include <ui/fixed.h>
-#include "../private/control.h"
-#include "../private/fixed.h"
-
-static void ui_fixed_ctl_destroy(void *);
-static errno_t ui_fixed_ctl_paint(void *);
-static ui_evclaim_t ui_fixed_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_fixed_ctl_pos_event(void *, pos_event_t *);
-static void ui_fixed_ctl_unfocus(void *, unsigned);
-
-/** Push button control ops */
-ui_control_ops_t ui_fixed_ops = {
-	.destroy = ui_fixed_ctl_destroy,
-	.paint = ui_fixed_ctl_paint,
-	.kbd_event = ui_fixed_ctl_kbd_event,
-	.pos_event = ui_fixed_ctl_pos_event,
-	.unfocus = ui_fixed_ctl_unfocus
-};
-
-/** Create new fixed layout.
- *
- * @param rfixed Place to store pointer to new fixed layout
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_fixed_create(ui_fixed_t **rfixed)
-{
-	ui_fixed_t *fixed;
-	errno_t rc;
-
-	fixed = calloc(1, sizeof(ui_fixed_t));
-	if (fixed == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_fixed_ops, (void *) fixed, &fixed->control);
-	if (rc != EOK) {
-		free(fixed);
-		return rc;
-	}
-
-	list_initialize(&fixed->elem);
-	*rfixed = fixed;
-	return EOK;
-}
-
-/** Destroy fixed layout.
- *
- * @param fixed Fixed layout or @c NULL
- */
-void ui_fixed_destroy(ui_fixed_t *fixed)
-{
-	ui_fixed_elem_t *elem;
-	ui_control_t *control;
-
-	if (fixed == NULL)
-		return;
-
-	elem = ui_fixed_first(fixed);
-	while (elem != NULL) {
-		control = elem->control;
-		ui_fixed_remove(fixed, control);
-		ui_control_destroy(control);
-
-		elem = ui_fixed_first(fixed);
-	}
-
-	ui_control_delete(fixed->control);
-	free(fixed);
-}
-
-/** Get base control from fixed layout.
- *
- * @param fixed Fixed layout
- * @return Control
- */
-ui_control_t *ui_fixed_ctl(ui_fixed_t *fixed)
-{
-	return fixed->control;
-}
-
-/** Add control to fixed layout.
- *
- * @param fixed Fixed layout
- * @param control Control
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_fixed_add(ui_fixed_t *fixed, ui_control_t *control)
-{
-	ui_fixed_elem_t *elem;
-
-	elem = calloc(1, sizeof(ui_fixed_elem_t));
-	if (elem == NULL)
-		return ENOMEM;
-
-	elem->fixed = fixed;
-	elem->control = control;
-	control->elemp = (void *) elem;
-	list_append(&elem->lelems, &fixed->elem);
-
-	return EOK;
-}
-
-/** Remove control from fixed layout.
- *
- * @param fixed Fixed layout
- * @param control Control
- */
-void ui_fixed_remove(ui_fixed_t *fixed, ui_control_t *control)
-{
-	ui_fixed_elem_t *elem;
-
-	elem = (ui_fixed_elem_t *) control->elemp;
-	assert(elem->fixed == fixed);
-
-	list_remove(&elem->lelems);
-	control->elemp = NULL;
-
-	free(elem);
-}
-
-/** Get first element of fixed layout.
- *
- * @param fixed Fixed layout
- * @return First element or @c NULL
- */
-ui_fixed_elem_t *ui_fixed_first(ui_fixed_t *fixed)
-{
-	link_t *link;
-
-	link = list_first(&fixed->elem);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_fixed_elem_t, lelems);
-}
-
-/** Get next element of fixed layout.
- *
- * @param cur Current element
- * @return Next element or @c NULL
- */
-ui_fixed_elem_t *ui_fixed_next(ui_fixed_elem_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lelems, &cur->fixed->elem);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_fixed_elem_t, lelems);
-}
-
-/** Paint fixed layout.
- *
- * @param fixed Fixed layout
- * @return EOK on success or an error code
- */
-errno_t ui_fixed_paint(ui_fixed_t *fixed)
-{
-	ui_fixed_elem_t *elem;
-	errno_t rc;
-
-	elem = ui_fixed_first(fixed);
-	while (elem != NULL) {
-		rc = ui_control_paint(elem->control);
-		if (rc != EOK)
-			return rc;
-
-		elem = ui_fixed_next(elem);
-	}
-
-	return EOK;
-}
-
-/** Handle fixed layout keyboard event.
- *
- * @param fixed Fixed layout
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_fixed_kbd_event(ui_fixed_t *fixed, kbd_event_t *event)
-{
-	ui_fixed_elem_t *elem;
-	ui_evclaim_t claimed;
-
-	elem = ui_fixed_first(fixed);
-	while (elem != NULL) {
-		claimed = ui_control_kbd_event(elem->control, event);
-		if (claimed == ui_claimed)
-			return ui_claimed;
-
-		elem = ui_fixed_next(elem);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle fixed layout position event.
- *
- * @param fixed Fixed layout
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_fixed_pos_event(ui_fixed_t *fixed, pos_event_t *event)
-{
-	ui_fixed_elem_t *elem;
-	ui_evclaim_t claimed;
-
-	elem = ui_fixed_first(fixed);
-	while (elem != NULL) {
-		claimed = ui_control_pos_event(elem->control, event);
-		if (claimed == ui_claimed)
-			return ui_claimed;
-
-		elem = ui_fixed_next(elem);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle fixed layout window unfocus notification.
- *
- * @param fixed Fixed layout
- * @param nfocus Number of remaining foci
- */
-void ui_fixed_unfocus(ui_fixed_t *fixed, unsigned nfocus)
-{
-	ui_fixed_elem_t *elem;
-
-	elem = ui_fixed_first(fixed);
-	while (elem != NULL) {
-		ui_control_unfocus(elem->control, nfocus);
-
-		elem = ui_fixed_next(elem);
-	}
-}
-
-/** Destroy fixed layout control.
- *
- * @param arg Argument (ui_fixed_t *)
- */
-void ui_fixed_ctl_destroy(void *arg)
-{
-	ui_fixed_t *fixed = (ui_fixed_t *) arg;
-
-	ui_fixed_destroy(fixed);
-}
-
-/** Paint fixed layout control.
- *
- * @param arg Argument (ui_fixed_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_fixed_ctl_paint(void *arg)
-{
-	ui_fixed_t *fixed = (ui_fixed_t *) arg;
-
-	return ui_fixed_paint(fixed);
-}
-
-/** Handle fixed layout control keyboard event.
- *
- * @param arg Argument (ui_fixed_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_fixed_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_fixed_t *fixed = (ui_fixed_t *) arg;
-
-	return ui_fixed_kbd_event(fixed, event);
-}
-
-/** Handle fixed layout control position event.
- *
- * @param arg Argument (ui_fixed_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_fixed_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_fixed_t *fixed = (ui_fixed_t *) arg;
-
-	return ui_fixed_pos_event(fixed, event);
-}
-
-/** Handle fixed layout control window unfocus notification.
- *
- * @param arg Argument (ui_fixed_t *)
- * @param nfocus Number of remaining foci
- */
-void ui_fixed_ctl_unfocus(void *arg, unsigned nfocus)
-{
-	ui_fixed_t *fixed = (ui_fixed_t *) arg;
-
-	ui_fixed_unfocus(fixed, nfocus);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/image.c
===================================================================
--- uspace/lib/ui/src/image.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,242 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Image
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/image.h>
-#include "../private/image.h"
-#include "../private/resource.h"
-#include "../private/ui.h"
-
-static void ui_image_ctl_destroy(void *);
-static errno_t ui_image_ctl_paint(void *);
-static ui_evclaim_t ui_image_ctl_pos_event(void *, pos_event_t *);
-
-/** Image control ops */
-ui_control_ops_t ui_image_ops = {
-	.destroy = ui_image_ctl_destroy,
-	.paint = ui_image_ctl_paint,
-	.pos_event = ui_image_ctl_pos_event
-};
-
-/** Create new image.
- *
- * @param resource UI resource
- * @param bitmap Bitmap
- * @param brect Bitmap rectangle
- * @param rimage Place to store pointer to new image
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_image_create(ui_resource_t *resource, gfx_bitmap_t *bitmap,
-    gfx_rect_t *brect, ui_image_t **rimage)
-{
-	ui_image_t *image;
-	errno_t rc;
-
-	image = calloc(1, sizeof(ui_image_t));
-	if (image == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_image_ops, (void *) image, &image->control);
-	if (rc != EOK) {
-		free(image);
-		return rc;
-	}
-
-	image->bitmap = bitmap;
-	image->brect = *brect;
-	image->res = resource;
-	*rimage = image;
-	return EOK;
-}
-
-/** Destroy image.
- *
- * @param image Image or @c NULL
- */
-void ui_image_destroy(ui_image_t *image)
-{
-	if (image == NULL)
-		return;
-
-	ui_control_delete(image->control);
-	if (image->bitmap != NULL)
-		gfx_bitmap_destroy(image->bitmap);
-	free(image);
-}
-
-/** Get base control from image.
- *
- * @param image Image
- * @return Control
- */
-ui_control_t *ui_image_ctl(ui_image_t *image)
-{
-	return image->control;
-}
-
-/** Set image rectangle.
- *
- * @param image Image
- * @param rect New image rectangle
- */
-void ui_image_set_rect(ui_image_t *image, gfx_rect_t *rect)
-{
-	image->rect = *rect;
-}
-
-/** Set image flags.
- *
- * @param image Image
- * @param flags Flags
- */
-void ui_image_set_flags(ui_image_t *image, ui_image_flags_t flags)
-{
-	image->flags = flags;
-}
-
-/** Paint image.
- *
- * @param image Image
- * @return EOK on success or an error code
- */
-errno_t ui_image_paint(ui_image_t *image)
-{
-	gfx_rect_t irect;
-	gfx_rect_t srect;
-	gfx_coord2_t offs;
-	errno_t rc;
-
-	if ((image->flags & ui_imgf_frame) != 0) {
-		rc = ui_paint_bevel(image->res->gc, &image->rect,
-		    image->res->btn_frame_color, image->res->btn_frame_color,
-		    1, NULL);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (image->bitmap == NULL)
-		return EOK;
-
-	irect = image->rect;
-	if ((image->flags & ui_imgf_frame) != 0) {
-		irect.p0.x++;
-		irect.p0.y++;
-		irect.p1.x--;
-		irect.p1.y--;
-	}
-
-	/*
-	 * UI image position does not depend on bitmap rectangle p0, so
-	 * we need to subtract it.
-	 */
-	offs.x = irect.p0.x - image->brect.p0.x;
-	offs.y = irect.p0.y - image->brect.p0.y;
-
-	/*
-	 * Translate image rectangle back to bitmap coordinate space.
-	 * Thus the bitmap will be clipped to the image rectangle.
-	 */
-	gfx_rect_rtranslate(&offs, &irect, &srect);
-	rc = gfx_bitmap_render(image->bitmap, &srect, &offs);
-	if (rc != EOK)
-		return rc;
-
-	return gfx_update(image->res->gc);
-}
-
-/** Change image bitmap.
- *
- * Note that the caller must have saved the pointer to the previous bitmap
- * in the image, because this causes it to be unlinked from the image and
- * not destroyed (the ownership is transferred back to the caller).
- *
- * @param image Image
- * @param bitmap New bitmap (ownership transferred to image) or @c NULL
- * @param brect New bitmap rectangle
- */
-void ui_image_set_bmp(ui_image_t *image, gfx_bitmap_t *bitmap,
-    gfx_rect_t *brect)
-{
-	image->bitmap = bitmap;
-	image->brect = *brect;
-}
-
-/** Destroy image control.
- *
- * @param arg Argument (ui_image_t *)
- */
-void ui_image_ctl_destroy(void *arg)
-{
-	ui_image_t *image = (ui_image_t *) arg;
-
-	ui_image_destroy(image);
-}
-
-/** Paint image control.
- *
- * @param arg Argument (ui_image_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_image_ctl_paint(void *arg)
-{
-	ui_image_t *image = (ui_image_t *) arg;
-
-	return ui_image_paint(image);
-}
-
-/** Handle image control position event.
- *
- * @param arg Argument (ui_image_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_image_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_image_t *image = (ui_image_t *) arg;
-
-	(void) image;
-	return ui_unclaimed;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/label.c
===================================================================
--- uspace/lib/ui/src/label.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,273 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Label
- */
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/label.h>
-#include "../private/label.h"
-#include "../private/resource.h"
-
-static void ui_label_ctl_destroy(void *);
-static errno_t ui_label_ctl_paint(void *);
-static ui_evclaim_t ui_label_ctl_pos_event(void *, pos_event_t *);
-
-/** Label control ops */
-ui_control_ops_t ui_label_ops = {
-	.destroy = ui_label_ctl_destroy,
-	.paint = ui_label_ctl_paint,
-	.pos_event = ui_label_ctl_pos_event
-};
-
-/** Create new label.
- *
- * @param resource UI resource
- * @param text Text
- * @param rlabel Place to store pointer to new label
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_label_create(ui_resource_t *resource, const char *text,
-    ui_label_t **rlabel)
-{
-	ui_label_t *label;
-	errno_t rc;
-
-	label = calloc(1, sizeof(ui_label_t));
-	if (label == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_label_ops, (void *) label, &label->control);
-	if (rc != EOK) {
-		free(label);
-		return rc;
-	}
-
-	label->text = str_dup(text);
-	if (label->text == NULL) {
-		ui_control_delete(label->control);
-		free(label);
-		return ENOMEM;
-	}
-
-	label->res = resource;
-	label->halign = gfx_halign_left;
-	*rlabel = label;
-	return EOK;
-}
-
-/** Destroy label.
- *
- * @param label Label or @c NULL
- */
-void ui_label_destroy(ui_label_t *label)
-{
-	if (label == NULL)
-		return;
-
-	ui_control_delete(label->control);
-	free(label);
-}
-
-/** Get base control from label.
- *
- * @param label Label
- * @return Control
- */
-ui_control_t *ui_label_ctl(ui_label_t *label)
-{
-	return label->control;
-}
-
-/** Set label rectangle.
- *
- * @param label Label
- * @param rect New label rectangle
- */
-void ui_label_set_rect(ui_label_t *label, gfx_rect_t *rect)
-{
-	label->rect = *rect;
-}
-
-/** Set label horizontal text alignment.
- *
- * @param label Label
- * @param halign Horizontal alignment
- */
-void ui_label_set_halign(ui_label_t *label, gfx_halign_t halign)
-{
-	label->halign = halign;
-}
-
-/** Set label vertical text alignment.
- *
- * @param label Label
- * @param valign Vertical alignment
- */
-void ui_label_set_valign(ui_label_t *label, gfx_valign_t valign)
-{
-	label->valign = valign;
-}
-
-/** Set label text.
- *
- * @param label Label
- * @param text New label text
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_label_set_text(ui_label_t *label, const char *text)
-{
-	char *tcopy;
-
-	tcopy = str_dup(text);
-	if (tcopy == NULL)
-		return ENOMEM;
-
-	free(label->text);
-	label->text = tcopy;
-
-	return EOK;
-}
-
-/** Paint label.
- *
- * @param label Label
- * @return EOK on success or an error code
- */
-errno_t ui_label_paint(ui_label_t *label)
-{
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	/* Paint label background */
-
-	rc = gfx_set_color(label->res->gc, label->res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(label->res->gc, &label->rect);
-	if (rc != EOK)
-		goto error;
-
-	switch (label->halign) {
-	case gfx_halign_left:
-	case gfx_halign_justify:
-		pos.x = label->rect.p0.x;
-		break;
-	case gfx_halign_center:
-		pos.x = (label->rect.p0.x + label->rect.p1.x) / 2;
-		break;
-	case gfx_halign_right:
-		pos.x = label->rect.p1.x;
-		break;
-	}
-
-	switch (label->valign) {
-	case gfx_valign_top:
-		pos.y = label->rect.p0.y;
-		break;
-	case gfx_valign_center:
-		pos.y = (label->rect.p0.y + label->rect.p1.y) / 2;
-		break;
-	case gfx_valign_bottom:
-		pos.y = label->rect.p1.y;
-		break;
-	case gfx_valign_baseline:
-		return EINVAL;
-	}
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = label->res->font;
-	fmt.color = label->res->wnd_text_color;
-	fmt.halign = label->halign;
-	fmt.valign = label->valign;
-
-	rc = gfx_puttext(&pos, &fmt, label->text);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(label->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Destroy label control.
- *
- * @param arg Argument (ui_label_t *)
- */
-void ui_label_ctl_destroy(void *arg)
-{
-	ui_label_t *label = (ui_label_t *) arg;
-
-	ui_label_destroy(label);
-}
-
-/** Paint label control.
- *
- * @param arg Argument (ui_label_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_label_ctl_paint(void *arg)
-{
-	ui_label_t *label = (ui_label_t *) arg;
-
-	return ui_label_paint(label);
-}
-
-/** Handle label control position event.
- *
- * @param arg Argument (ui_label_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_label_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_label_t *label = (ui_label_t *) arg;
-
-	(void) label;
-	return ui_unclaimed;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/list.c
===================================================================
--- uspace/lib/ui/src/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1655 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/** @file List.
- *
- * Simple list control.
- */
-
-#include <errno.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/list.h>
-#include <ui/paint.h>
-#include <ui/resource.h>
-#include <ui/scrollbar.h>
-#include "../private/list.h"
-#include "../private/resource.h"
-
-static void ui_list_ctl_destroy(void *);
-static errno_t ui_list_ctl_paint(void *);
-static ui_evclaim_t ui_list_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_list_ctl_pos_event(void *, pos_event_t *);
-
-/** List control ops */
-ui_control_ops_t ui_list_ctl_ops = {
-	.destroy = ui_list_ctl_destroy,
-	.paint = ui_list_ctl_paint,
-	.kbd_event = ui_list_ctl_kbd_event,
-	.pos_event = ui_list_ctl_pos_event
-};
-
-enum {
-	list_entry_hpad = 2,
-	list_entry_vpad = 2,
-	list_entry_hpad_text = 1,
-	list_entry_vpad_text = 0,
-};
-
-static void ui_list_scrollbar_up(ui_scrollbar_t *, void *);
-static void ui_list_scrollbar_down(ui_scrollbar_t *, void *);
-static void ui_list_scrollbar_page_up(ui_scrollbar_t *, void *);
-static void ui_list_scrollbar_page_down(ui_scrollbar_t *, void *);
-static void ui_list_scrollbar_moved(ui_scrollbar_t *, void *, gfx_coord_t);
-
-/** List scrollbar callbacks */
-static ui_scrollbar_cb_t ui_list_scrollbar_cb = {
-	.up = ui_list_scrollbar_up,
-	.down = ui_list_scrollbar_down,
-	.page_up = ui_list_scrollbar_page_up,
-	.page_down = ui_list_scrollbar_page_down,
-	.moved = ui_list_scrollbar_moved
-};
-
-/** Create UI list.
- *
- * @param window Containing window
- * @param active @c true iff list should be active
- * @param rlist Place to store pointer to new list
- * @return EOK on success or an error code
- */
-errno_t ui_list_create(ui_window_t *window, bool active,
-    ui_list_t **rlist)
-{
-	ui_list_t *list;
-	errno_t rc;
-
-	list = calloc(1, sizeof(ui_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_list_ctl_ops, (void *)list,
-	    &list->control);
-	if (rc != EOK) {
-		free(list);
-		return rc;
-	}
-
-	rc = ui_scrollbar_create(ui_window_get_ui(window), window,
-	    ui_sbd_vert, &list->scrollbar);
-	if (rc != EOK)
-		goto error;
-
-	ui_scrollbar_set_cb(list->scrollbar, &ui_list_scrollbar_cb,
-	    (void *) list);
-
-	list->window = window;
-	list_initialize(&list->entries);
-	list->entries_cnt = 0;
-	list->active = active;
-
-	*rlist = list;
-	return EOK;
-error:
-	ui_control_delete(list->control);
-	free(list);
-	return rc;
-}
-
-/** Destroy UI list.
- *
- * @param list UI list
- */
-void ui_list_destroy(ui_list_t *list)
-{
-	ui_list_clear_entries(list);
-	ui_control_delete(list->control);
-	free(list);
-}
-
-/** Set UI list callbacks.
- *
- * @param list UI list
- * @param cb Callbacks
- * @param arg Argument to callback functions
- */
-void ui_list_set_cb(ui_list_t *list, ui_list_cb_t *cb, void *arg)
-{
-	list->cb = cb;
-	list->cb_arg = arg;
-}
-
-/** Get UI list callback argument.
- *
- * @param list UI list
- * @return Callback argument
- */
-void *ui_list_get_cb_arg(ui_list_t *list)
-{
-	return list->cb_arg;
-}
-
-/** Get height of list entry.
- *
- * @param list UI list
- * @return Entry height in pixels
- */
-gfx_coord_t ui_list_entry_height(ui_list_t *list)
-{
-	ui_resource_t *res;
-	gfx_font_metrics_t metrics;
-	gfx_coord_t height;
-	gfx_coord_t vpad;
-
-	res = ui_window_get_res(list->window);
-
-	if (res->textmode) {
-		vpad = list_entry_vpad_text;
-	} else {
-		vpad = list_entry_vpad;
-	}
-
-	/* Normal menu entry */
-	gfx_font_get_metrics(res->font, &metrics);
-	height = metrics.ascent + metrics.descent + 1;
-
-	return height + 2 * vpad;
-}
-
-/** Paint list entry.
- *
- * @param entry List entry
- * @param entry_idx Entry index (within list of entries)
- * @return EOK on success or an error code
- */
-errno_t ui_list_entry_paint(ui_list_entry_t *entry, size_t entry_idx)
-{
-	ui_list_t *list = entry->list;
-	gfx_context_t *gc = ui_window_get_gc(list->window);
-	ui_resource_t *res = ui_window_get_res(list->window);
-	gfx_font_t *font = ui_resource_get_font(res);
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	gfx_rect_t lrect;
-	gfx_rect_t crect;
-	gfx_color_t *bgcolor;
-	gfx_coord_t hpad, vpad;
-	gfx_coord_t line_height;
-	size_t rows;
-	errno_t rc;
-
-	line_height = ui_list_entry_height(list);
-	ui_list_inside_rect(entry->list, &lrect);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = font;
-	rows = ui_list_page_size(list) + 1;
-
-	/* Do not display entry outside of current page */
-	if (entry_idx < list->page_idx ||
-	    entry_idx >= list->page_idx + rows)
-		return EOK;
-
-	if (res->textmode) {
-		hpad = list_entry_hpad_text;
-		vpad = list_entry_vpad_text;
-	} else {
-		hpad = list_entry_hpad;
-		vpad = list_entry_vpad;
-	}
-
-	pos.x = lrect.p0.x;
-	pos.y = lrect.p0.y + line_height * (entry_idx - list->page_idx);
-
-	if (entry == list->cursor && list->active) {
-		fmt.color = res->entry_sel_text_fg_color;
-		bgcolor = res->entry_sel_text_bg_color;
-	} else {
-		if (entry->color != NULL)
-			fmt.color = entry->color;
-		else
-			fmt.color = res->entry_fg_color;
-
-		if (entry->bgcolor != NULL)
-			bgcolor = entry->bgcolor;
-		else
-			bgcolor = res->entry_bg_color;
-	}
-
-	/* Draw entry background */
-	rect.p0 = pos;
-	rect.p1.x = lrect.p1.x;
-	rect.p1.y = rect.p0.y + line_height;
-
-	/* Clip to list interior */
-	gfx_rect_clip(&rect, &lrect, &crect);
-
-	rc = gfx_set_color(gc, bgcolor);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(gc, &crect);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Make sure caption does not overflow the entry rectangle.
-	 *
-	 * XXX We probably want to measure the text width, and,
-	 * if it's too long, use gfx_text_find_pos() to find where
-	 * it should be cut off (and append some sort of overflow
-	 * marker.
-	 */
-	rc = gfx_set_clip_rect(gc, &crect);
-	if (rc != EOK)
-		return rc;
-
-	pos.x += hpad;
-	pos.y += vpad;
-
-	rc = gfx_puttext(&pos, &fmt, entry->caption);
-	if (rc != EOK) {
-		(void) gfx_set_clip_rect(gc, NULL);
-		return rc;
-	}
-
-	return gfx_set_clip_rect(gc, NULL);
-}
-
-/** Paint UI list.
- *
- * @param list UI list
- */
-errno_t ui_list_paint(ui_list_t *list)
-{
-	gfx_context_t *gc = ui_window_get_gc(list->window);
-	ui_resource_t *res = ui_window_get_res(list->window);
-	ui_list_entry_t *entry;
-	int i, lines;
-	errno_t rc;
-
-	rc = gfx_set_color(gc, res->entry_bg_color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(gc, &list->rect);
-	if (rc != EOK)
-		return rc;
-
-	if (!res->textmode) {
-		rc = ui_paint_inset_frame(res, &list->rect, NULL);
-		if (rc != EOK)
-			return rc;
-	}
-
-	lines = ui_list_page_size(list) + 1;
-	i = 0;
-
-	entry = list->page;
-	while (entry != NULL && i < lines) {
-		rc = ui_list_entry_paint(entry, list->page_idx + i);
-		if (rc != EOK)
-			return rc;
-
-		++i;
-		entry = ui_list_next(entry);
-	}
-
-	rc = ui_scrollbar_paint(list->scrollbar);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_update(gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Handle list keyboard event.
- *
- * @param list UI list
- * @param event Keyboard event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t ui_list_kbd_event(ui_list_t *list, kbd_event_t *event)
-{
-	if (!list->active)
-		return ui_unclaimed;
-
-	if (event->type == KEY_PRESS) {
-		if ((event->mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) {
-			switch (event->key) {
-			case KC_UP:
-				ui_list_cursor_up(list);
-				break;
-			case KC_DOWN:
-				ui_list_cursor_down(list);
-				break;
-			case KC_HOME:
-				ui_list_cursor_top(list);
-				break;
-			case KC_END:
-				ui_list_cursor_bottom(list);
-				break;
-			case KC_PAGE_UP:
-				ui_list_page_up(list);
-				break;
-			case KC_PAGE_DOWN:
-				ui_list_page_down(list);
-				break;
-			case KC_ENTER:
-				ui_list_selected(list->cursor);
-				break;
-			default:
-				break;
-			}
-		}
-	}
-
-	return ui_claimed;
-}
-
-/** Handle UI list position event.
- *
- * @param list UI list
- * @param event Position event
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t ui_list_pos_event(ui_list_t *list, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	gfx_rect_t irect;
-	ui_list_entry_t *entry;
-	gfx_coord_t line_height;
-	size_t entry_idx;
-	ui_evclaim_t claim;
-	int n;
-
-	claim = ui_scrollbar_pos_event(list->scrollbar, event);
-	if (claim == ui_claimed)
-		return ui_claimed;
-
-	line_height = ui_list_entry_height(list);
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	if (!gfx_pix_inside_rect(&pos, &list->rect))
-		return ui_unclaimed;
-
-	if (event->type == POS_PRESS || event->type == POS_DCLICK) {
-		ui_list_inside_rect(list, &irect);
-
-		/* Did we click on one of the entries? */
-		if (gfx_pix_inside_rect(&pos, &irect)) {
-			/* Index within page */
-			n = (pos.y - irect.p0.y) / line_height;
-
-			/* Entry and its index within entire listing */
-			entry = ui_list_page_nth_entry(list, n, &entry_idx);
-			if (entry == NULL)
-				return ui_claimed;
-
-			if (event->type == POS_PRESS) {
-				/* Move to the entry found */
-				ui_list_cursor_move(list, entry, entry_idx);
-			} else {
-				/* event->type == POS_DCLICK */
-				ui_list_selected(entry);
-			}
-		} else {
-			/* It's in the border. */
-			if (event->type == POS_PRESS) {
-				/* Top or bottom half? */
-				if (pos.y >= (irect.p0.y + irect.p1.y) / 2)
-					ui_list_page_down(list);
-				else
-					ui_list_page_up(list);
-			}
-		}
-	}
-
-	if (!list->active && event->type == POS_PRESS)
-		ui_list_activate_req(list);
-
-	return ui_claimed;
-}
-
-/** Get base control for UI list.
- *
- * @param list UI list
- * @return Base UI control
- */
-ui_control_t *ui_list_ctl(ui_list_t *list)
-{
-	return list->control;
-}
-
-/** Set UI list rectangle.
- *
- * @param list UI list
- * @param rect Rectangle
- */
-void ui_list_set_rect(ui_list_t *list, gfx_rect_t *rect)
-{
-	gfx_rect_t srect;
-
-	list->rect = *rect;
-
-	ui_list_scrollbar_rect(list, &srect);
-	ui_scrollbar_set_rect(list->scrollbar, &srect);
-}
-
-/** Get UI list page size.
- *
- * @param list UI list
- * @return Number of entries that fit in list at the same time.
- */
-unsigned ui_list_page_size(ui_list_t *list)
-{
-	gfx_coord_t line_height;
-	gfx_rect_t irect;
-
-	line_height = ui_list_entry_height(list);
-	ui_list_inside_rect(list, &irect);
-	return (irect.p1.y - irect.p0.y) / line_height;
-}
-
-/** Get UI list interior rectangle.
- *
- * @param list UI list
- * @param irect Place to store interior rectangle
- */
-void ui_list_inside_rect(ui_list_t *list, gfx_rect_t *irect)
-{
-	ui_resource_t *res = ui_window_get_res(list->window);
-	gfx_rect_t rect;
-	gfx_coord_t width;
-
-	if (res->textmode) {
-		rect = list->rect;
-	} else {
-		ui_paint_get_inset_frame_inside(res, &list->rect, &rect);
-	}
-
-	if (res->textmode) {
-		width = 1;
-	} else {
-		width = 23;
-	}
-
-	irect->p0 = rect.p0;
-	irect->p1.x = rect.p1.x - width;
-	irect->p1.y = rect.p1.y;
-}
-
-/** Get UI list scrollbar rectangle.
- *
- * @param list UI list
- * @param irect Place to store interior rectangle
- */
-void ui_list_scrollbar_rect(ui_list_t *list, gfx_rect_t *srect)
-{
-	ui_resource_t *res = ui_window_get_res(list->window);
-	gfx_rect_t rect;
-	gfx_coord_t width;
-
-	if (res->textmode) {
-		rect = list->rect;
-	} else {
-		ui_paint_get_inset_frame_inside(res, &list->rect, &rect);
-	}
-
-	if (res->textmode) {
-		width = 1;
-	} else {
-		width = 23;
-	}
-
-	srect->p0.x = rect.p1.x - width;
-	srect->p0.y = rect.p0.y;
-	srect->p1 = rect.p1;
-}
-
-/** Compute new position for UI list scrollbar thumb.
- *
- * @param list UI list
- * @return New position
- */
-gfx_coord_t ui_list_scrollbar_pos(ui_list_t *list)
-{
-	size_t entries;
-	size_t pglen;
-	size_t sbar_len;
-
-	entries = list_count(&list->entries);
-	pglen = ui_list_page_size(list);
-	sbar_len = ui_scrollbar_move_length(list->scrollbar);
-
-	if (entries > pglen)
-		return sbar_len * list->page_idx / (entries - pglen);
-	else
-		return 0;
-}
-
-/** Update UI list scrollbar position.
- *
- * @param list UI list
- */
-void ui_list_scrollbar_update(ui_list_t *list)
-{
-	ui_scrollbar_set_pos(list->scrollbar,
-	    ui_list_scrollbar_pos(list));
-}
-
-/** Determine if UI list is active.
- *
- * @param list UI list
- * @return @c true iff UI list is active
- */
-bool ui_list_is_active(ui_list_t *list)
-{
-	return list->active;
-}
-
-/** Activate UI list.
- *
- * @param list UI list
- *
- * @return EOK on success or an error code
- */
-errno_t ui_list_activate(ui_list_t *list)
-{
-	list->active = true;
-	(void) ui_list_paint(list);
-	return EOK;
-}
-
-/** Deactivate UI list.
- *
- * @param list UI list
- */
-void ui_list_deactivate(ui_list_t *list)
-{
-	list->active = false;
-	(void) ui_list_paint(list);
-}
-
-/** Initialize UI list entry attributes.
- *
- * @param attr Attributes
- */
-void ui_list_entry_attr_init(ui_list_entry_attr_t *attr)
-{
-	memset(attr, 0, sizeof(*attr));
-}
-
-/** Destroy UI list control.
- *
- * @param arg Argument (ui_list_t *)
- */
-void ui_list_ctl_destroy(void *arg)
-{
-	ui_list_t *list = (ui_list_t *) arg;
-
-	ui_list_destroy(list);
-}
-
-/** Paint UI list control.
- *
- * @param arg Argument (ui_list_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_list_ctl_paint(void *arg)
-{
-	ui_list_t *list = (ui_list_t *) arg;
-
-	return ui_list_paint(list);
-}
-
-/** Handle UI list control keyboard event.
- *
- * @param arg Argument (ui_list_t *)
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_list_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_list_t *list = (ui_list_t *) arg;
-
-	return ui_list_kbd_event(list, event);
-}
-
-/** Handle UI list control position event.
- *
- * @param arg Argument (ui_list_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_list_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_list_t *list = (ui_list_t *) arg;
-
-	return ui_list_pos_event(list, event);
-}
-
-/** Append new UI list entry.
- *
- * @param list UI list
- * @param attr Entry attributes
- * @param rentry Place to store pointer to new entry or @c NULL if not
- *               interested
- * @return EOK on success or an error code
- */
-errno_t ui_list_entry_append(ui_list_t *list, ui_list_entry_attr_t *attr,
-    ui_list_entry_t **rentry)
-{
-	ui_list_entry_t *entry;
-
-	entry = calloc(1, sizeof(ui_list_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	entry->list = list;
-	entry->caption = str_dup(attr->caption);
-	if (entry->caption == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	entry->arg = attr->arg;
-	entry->color = attr->color;
-	entry->bgcolor = attr->bgcolor;
-	link_initialize(&entry->lentries);
-	list_append(&entry->lentries, &list->entries);
-
-	if (list->entries_cnt == 0) {
-		/* Adding first entry - need to set the cursor */
-		list->cursor = entry;
-		list->cursor_idx = 0;
-		list->page = entry;
-		list->page_idx = 0;
-	}
-
-	++list->entries_cnt;
-
-	if (rentry != NULL)
-		*rentry = entry;
-	return EOK;
-}
-
-/** Move UI list entry one position up.
- *
- * @parm entry UI list entry
- */
-void ui_list_entry_move_up(ui_list_entry_t *entry)
-{
-	ui_list_t *list = entry->list;
-	ui_list_entry_t *prev;
-
-	prev = ui_list_prev(entry);
-	if (prev == NULL) {
-		/* Entry is already on first position, nothing to do. */
-		return;
-	}
-
-	list_remove(&entry->lentries);
-	list_insert_before(&entry->lentries, &prev->lentries);
-
-	/* Make sure page stays on the same position/idx as it was before */
-	if (list->page == entry) {
-		list->page = prev;
-	} else if (list->page == prev) {
-		list->page = entry;
-	}
-
-	/*
-	 * Return cursor to the same position/idx as it was before,
-	 * but then move it using ui_list_cursor_move() to the new
-	 * position (this ensures scrolling when needed).
-	 */
-	if (list->cursor == entry) {
-		list->cursor = prev;
-		ui_list_cursor_move(list, entry, list->cursor_idx - 1);
-	} else if (list->cursor == prev) {
-		list->cursor = entry;
-		ui_list_cursor_move(list, prev, list->cursor_idx + 1);
-	}
-}
-
-/** Move UI list entry one position down.
- *
- * @parm entry UI list entry
- */
-void ui_list_entry_move_down(ui_list_entry_t *entry)
-{
-	ui_list_t *list = entry->list;
-	ui_list_entry_t *next;
-
-	next = ui_list_next(entry);
-	if (next == NULL) {
-		/* Entry is already on last position, nothing to do. */
-		return;
-	}
-
-	list_remove(&entry->lentries);
-	list_insert_after(&entry->lentries, &next->lentries);
-
-	/* Make sure page stays on the same position/idx as it was before */
-	if (list->page == entry) {
-		list->page = next;
-	} else if (list->page == next) {
-		list->page = entry;
-	}
-
-	/*
-	 * Return cursor to the same position/idx as it was before,
-	 * but then move it using ui_list_cursor_move() to the new
-	 * position (this ensures scrolling when needed).
-	 */
-	if (list->cursor == entry) {
-		list->cursor = next;
-		ui_list_cursor_move(list, entry, list->cursor_idx + 1);
-	} else if (list->cursor == next) {
-		list->cursor = entry;
-		ui_list_cursor_move(list, next, list->cursor_idx - 1);
-	}
-}
-
-/** Destroy UI list entry.
- *
- * This is the quick way, but does not update cursor or page position.
- *
- * @param entry UI list entry
- */
-void ui_list_entry_destroy(ui_list_entry_t *entry)
-{
-	if (entry->list->cursor == entry)
-		entry->list->cursor = NULL;
-	if (entry->list->page == entry)
-		entry->list->page = NULL;
-
-	list_remove(&entry->lentries);
-	--entry->list->entries_cnt;
-	free((char *) entry->caption);
-	free(entry);
-}
-
-/** Delete UI list entry.
- *
- * If required, update cursor and page position and repaint.
- *
- * @param entry UI list entry
- */
-void ui_list_entry_delete(ui_list_entry_t *entry)
-{
-	ui_list_t *list = entry->list;
-
-	/* Try to make sure entry does not disappear under cursor or page */
-	if (entry->list->cursor == entry)
-		ui_list_cursor_up(entry->list);
-	if (entry->list->cursor == entry)
-		ui_list_cursor_down(entry->list);
-	if (entry->list->page == entry)
-		ui_list_scroll_up(entry->list);
-	if (entry->list->page == entry)
-		ui_list_scroll_down(entry->list);
-
-	ui_list_entry_destroy(entry);
-
-	/*
-	 * But it could still happen if there are not enough entries.
-	 * In that case just move page and/or cursor to the first
-	 * entry.
-	 */
-	if (list->page == NULL) {
-		list->page = ui_list_first(list);
-		list->page_idx = 0;
-	} else {
-		/*
-		 * Entry index might have changed if earlier entry
-		 * was deleted.
-		 */
-		list->page_idx = ui_list_entry_get_idx(list->page);
-	}
-
-	if (list->cursor == NULL) {
-		list->cursor = ui_list_first(list);
-		list->cursor_idx = 0;
-	} else {
-		/*
-		 * Entry index might have changed if earlier entry
-		 * was deleted.
-		 */
-		list->cursor_idx = ui_list_entry_get_idx(list->cursor);
-	}
-}
-
-/** Get entry argument.
- *
- * @param entry UI list entry
- * @return User argument
- */
-void *ui_list_entry_get_arg(ui_list_entry_t *entry)
-{
-	return entry->arg;
-}
-
-/** Get containing list.
- *
- * @param entry UI list entry
- * @return Containing list
- */
-ui_list_t *ui_list_entry_get_list(ui_list_entry_t *entry)
-{
-	return entry->list;
-}
-
-/** Change list entry caption.
- *
- * @param entry UI list entry
- * @param caption New caption
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_list_entry_set_caption(ui_list_entry_t *entry, const char *caption)
-{
-	char *dcaption;
-
-	dcaption = str_dup(caption);
-	if (dcaption == NULL)
-		return ENOMEM;
-
-	free(entry->caption);
-	entry->caption = dcaption;
-
-	(void)ui_list_entry_paint(entry, ui_list_entry_get_idx(entry));
-	return EOK;
-}
-
-/** Clear UI list entry list.
- *
- * @param list UI list
- */
-void ui_list_clear_entries(ui_list_t *list)
-{
-	ui_list_entry_t *entry;
-
-	entry = ui_list_first(list);
-	while (entry != NULL) {
-		ui_list_entry_destroy(entry);
-		entry = ui_list_first(list);
-	}
-}
-
-/** Get number of UI list entries.
- *
- * @param list UI list
- * @return Number of entries
- */
-size_t ui_list_entries_cnt(ui_list_t *list)
-{
-	return list->entries_cnt;
-}
-
-/** Return first UI list entry.
- *
- * @param list UI list
- * @return First UI list entry or @c NULL if there are no entries
- */
-ui_list_entry_t *ui_list_first(ui_list_t *list)
-{
-	link_t *link;
-
-	link = list_first(&list->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_list_entry_t, lentries);
-}
-
-/** Return last UI list entry.
- *
- * @param list UI list
- * @return Last UI list entry or @c NULL if there are no entries
- */
-ui_list_entry_t *ui_list_last(ui_list_t *list)
-{
-	link_t *link;
-
-	link = list_last(&list->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_list_entry_t, lentries);
-}
-
-/** Return next UI list entry.
- *
- * @param cur Current entry
- * @return Next entry or @c NULL if @a cur is the last entry
- */
-ui_list_entry_t *ui_list_next(ui_list_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lentries, &cur->list->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_list_entry_t, lentries);
-}
-
-/** Return previous UI list entry.
- *
- * @param cur Current entry
- * @return Previous entry or @c NULL if @a cur is the first entry
- */
-ui_list_entry_t *ui_list_prev(ui_list_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->lentries, &cur->list->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_list_entry_t, lentries);
-}
-
-/** Find the n-th entry of the current UI list page.
- *
- * @param list UI list
- * @param n Which entry to get (starting from 0)
- * @param ridx Place to store index (within listing) of the entry
- * @return n-th entry of the page
- */
-ui_list_entry_t *ui_list_page_nth_entry(ui_list_t *list,
-    size_t n, size_t *ridx)
-{
-	ui_list_entry_t *entry;
-	size_t i;
-	size_t idx;
-
-	assert(n <= ui_list_page_size(list));
-
-	entry = list->page;
-	if (entry == NULL)
-		return NULL;
-
-	idx = list->page_idx;
-	for (i = 0; i < n; i++) {
-		entry = ui_list_next(entry);
-		if (entry == NULL)
-			return NULL;
-
-		++idx;
-	}
-
-	*ridx = idx;
-	return entry;
-}
-
-/** Get entry under cursor.
- *
- * @param list UI list
- * @return Current cursor
- */
-ui_list_entry_t *ui_list_get_cursor(ui_list_t *list)
-{
-	return list->cursor;
-}
-
-/** Set new cursor position.
- *
- * O(N) in list size, use with caution.
- *
- * @param list UI list
- * @param entry New cursor position
- */
-void ui_list_set_cursor(ui_list_t *list, ui_list_entry_t *entry)
-{
-	size_t idx;
-
-	idx = ui_list_entry_get_idx(entry);
-	ui_list_cursor_move(list, entry, idx);
-}
-
-/** Move cursor to a new position, possibly scrolling.
- *
- * @param list UI list
- * @param entry New entry under cursor
- * @param entry_idx Index of new entry under cursor
- */
-void ui_list_cursor_move(ui_list_t *list,
-    ui_list_entry_t *entry, size_t entry_idx)
-{
-	gfx_context_t *gc = ui_window_get_gc(list->window);
-	ui_list_entry_t *old_cursor;
-	size_t old_idx;
-	size_t rows;
-	ui_list_entry_t *e;
-	size_t i;
-
-	rows = ui_list_page_size(list);
-
-	old_cursor = list->cursor;
-	old_idx = list->cursor_idx;
-
-	list->cursor = entry;
-	list->cursor_idx = entry_idx;
-
-	if (entry_idx >= list->page_idx &&
-	    entry_idx < list->page_idx + rows) {
-		/*
-		 * If cursor is still on the current page, we're not
-		 * scrolling. Just unpaint old cursor and paint new
-		 * cursor.
-		 */
-		ui_list_entry_paint(old_cursor, old_idx);
-		ui_list_entry_paint(list->cursor, list->cursor_idx);
-
-		(void) gfx_update(gc);
-	} else {
-		/*
-		 * Need to scroll and update all rows.
-		 */
-
-		/* Scrolling up */
-		if (entry_idx < list->page_idx) {
-			list->page = entry;
-			list->page_idx = entry_idx;
-		}
-
-		/* Scrolling down */
-		if (entry_idx >= list->page_idx + rows) {
-			if (entry_idx >= rows) {
-				list->page_idx = entry_idx - rows + 1;
-				/* Find first page entry (go back rows - 1) */
-				e = entry;
-				for (i = 0; i + 1 < rows; i++) {
-					e = ui_list_prev(e);
-				}
-
-				/* Should be valid */
-				assert(e != NULL);
-				list->page = e;
-			} else {
-				list->page = ui_list_first(list);
-				list->page_idx = 0;
-			}
-		}
-
-		ui_list_scrollbar_update(list);
-		(void) ui_list_paint(list);
-	}
-}
-
-/** Move cursor one entry up.
- *
- * @param list UI list
- */
-void ui_list_cursor_up(ui_list_t *list)
-{
-	ui_list_entry_t *prev;
-	size_t prev_idx;
-
-	prev = ui_list_prev(list->cursor);
-	prev_idx = list->cursor_idx - 1;
-	if (prev != NULL)
-		ui_list_cursor_move(list, prev, prev_idx);
-}
-
-/** Move cursor one entry down.
- *
- * @param list UI list
- */
-void ui_list_cursor_down(ui_list_t *list)
-{
-	ui_list_entry_t *next;
-	size_t next_idx;
-
-	next = ui_list_next(list->cursor);
-	next_idx = list->cursor_idx + 1;
-	if (next != NULL)
-		ui_list_cursor_move(list, next, next_idx);
-}
-
-/** Move cursor to top.
- *
- * @param list UI list
- */
-void ui_list_cursor_top(ui_list_t *list)
-{
-	ui_list_cursor_move(list, ui_list_first(list), 0);
-}
-
-/** Move cursor to bottom.
- *
- * @param list UI list
- */
-void ui_list_cursor_bottom(ui_list_t *list)
-{
-	ui_list_cursor_move(list, ui_list_last(list),
-	    list->entries_cnt - 1);
-}
-
-/** Move cursor one page up.
- *
- * @param list UI list
- */
-void ui_list_page_up(ui_list_t *list)
-{
-	gfx_context_t *gc = ui_window_get_gc(list->window);
-	ui_list_entry_t *old_page;
-	ui_list_entry_t *old_cursor;
-	size_t old_idx;
-	size_t rows;
-	ui_list_entry_t *entry;
-	size_t i;
-
-	rows = ui_list_page_size(list);
-
-	old_page = list->page;
-	old_cursor = list->cursor;
-	old_idx = list->cursor_idx;
-
-	/* Move page by rows entries up (if possible) */
-	for (i = 0; i < rows; i++) {
-		entry = ui_list_prev(list->page);
-		if (entry != NULL) {
-			list->page = entry;
-			--list->page_idx;
-		}
-	}
-
-	/* Move cursor by rows entries up (if possible) */
-
-	for (i = 0; i < rows; i++) {
-		entry = ui_list_prev(list->cursor);
-		if (entry != NULL) {
-			list->cursor = entry;
-			--list->cursor_idx;
-		}
-	}
-
-	if (list->page != old_page) {
-		/* We have scrolled. Need to repaint all entries */
-		ui_list_scrollbar_update(list);
-		(void) ui_list_paint(list);
-	} else if (list->cursor != old_cursor) {
-		/* No scrolling, but cursor has moved */
-		ui_list_entry_paint(old_cursor, old_idx);
-		ui_list_entry_paint(list->cursor, list->cursor_idx);
-
-		(void) gfx_update(gc);
-	}
-}
-
-/** Move cursor one page down.
- *
- * @param list UI list
- */
-void ui_list_page_down(ui_list_t *list)
-{
-	gfx_context_t *gc = ui_window_get_gc(list->window);
-	ui_list_entry_t *old_page;
-	ui_list_entry_t *old_cursor;
-	size_t old_idx;
-	size_t max_idx;
-	size_t rows;
-	ui_list_entry_t *entry;
-	size_t i;
-
-	rows = ui_list_page_size(list);
-
-	old_page = list->page;
-	old_cursor = list->cursor;
-	old_idx = list->cursor_idx;
-
-	if (list->entries_cnt > rows)
-		max_idx = list->entries_cnt - rows;
-	else
-		max_idx = 0;
-
-	/* Move page by rows entries down (if possible) */
-	for (i = 0; i < rows; i++) {
-		entry = ui_list_next(list->page);
-		/* Do not scroll that results in a short page */
-		if (entry != NULL && list->page_idx < max_idx) {
-			list->page = entry;
-			++list->page_idx;
-		}
-	}
-
-	/* Move cursor by rows entries down (if possible) */
-
-	for (i = 0; i < rows; i++) {
-		entry = ui_list_next(list->cursor);
-		if (entry != NULL) {
-			list->cursor = entry;
-			++list->cursor_idx;
-		}
-	}
-
-	if (list->page != old_page) {
-		/* We have scrolled. Need to repaint all entries */
-		ui_list_scrollbar_update(list);
-		(void) ui_list_paint(list);
-	} else if (list->cursor != old_cursor) {
-		/* No scrolling, but cursor has moved */
-		ui_list_entry_paint(old_cursor, old_idx);
-		ui_list_entry_paint(list->cursor, list->cursor_idx);
-
-		(void) gfx_update(gc);
-	}
-}
-
-/** Scroll one entry up.
- *
- * @param list UI list
- */
-void ui_list_scroll_up(ui_list_t *list)
-{
-	ui_list_entry_t *prev;
-
-	if (list->page == NULL)
-		return;
-
-	prev = ui_list_prev(list->page);
-	if (prev == NULL)
-		return;
-
-	list->page = prev;
-	assert(list->page_idx > 0);
-	--list->page_idx;
-
-	ui_list_scrollbar_update(list);
-	(void) ui_list_paint(list);
-}
-
-/** Scroll one entry down.
- *
- * @param list UI list
- */
-void ui_list_scroll_down(ui_list_t *list)
-{
-	ui_list_entry_t *next;
-	ui_list_entry_t *pgend;
-	size_t i;
-	size_t rows;
-
-	if (list->page == NULL)
-		return;
-
-	next = ui_list_next(list->page);
-	if (next == NULL)
-		return;
-
-	rows = ui_list_page_size(list);
-
-	/* Find last page entry */
-	pgend = list->page;
-	for (i = 0; i < rows && pgend != NULL; i++) {
-		pgend = ui_list_next(pgend);
-	}
-
-	/* Scroll down by one entry, if the page remains full */
-	if (pgend != NULL) {
-		list->page = next;
-		++list->page_idx;
-	}
-
-	ui_list_scrollbar_update(list);
-	(void) ui_list_paint(list);
-}
-
-/** Scroll one page up.
- *
- * @param list UI list
- */
-void ui_list_scroll_page_up(ui_list_t *list)
-{
-	ui_list_entry_t *prev;
-	size_t i;
-	size_t rows;
-
-	prev = ui_list_prev(list->page);
-	if (prev == NULL)
-		return;
-
-	rows = ui_list_page_size(list);
-
-	for (i = 0; i < rows && prev != NULL; i++) {
-		list->page = prev;
-		assert(list->page_idx > 0);
-		--list->page_idx;
-		prev = ui_list_prev(prev);
-	}
-
-	ui_list_scrollbar_update(list);
-	(void) ui_list_paint(list);
-}
-
-/** Scroll one page down.
- *
- * @param list UI list
- */
-void ui_list_scroll_page_down(ui_list_t *list)
-{
-	ui_list_entry_t *next;
-	ui_list_entry_t *pgend;
-	size_t i;
-	size_t rows;
-
-	next = ui_list_next(list->page);
-	if (next == NULL)
-		return;
-
-	rows = ui_list_page_size(list);
-
-	/* Find last page entry */
-	pgend = list->page;
-	for (i = 0; i < rows && pgend != NULL; i++) {
-		pgend = ui_list_next(pgend);
-	}
-
-	/* Scroll by up to 'rows' entries, keeping the page full */
-	for (i = 0; i < rows && pgend != NULL; i++) {
-		list->page = next;
-		++list->page_idx;
-		next = ui_list_next(next);
-		pgend = ui_list_next(pgend);
-	}
-
-	ui_list_scrollbar_update(list);
-	(void) ui_list_paint(list);
-}
-
-/** Scroll to a specific entry
- *
- * @param list UI list
- * @param page_idx New index of first entry on the page
- */
-void ui_list_scroll_pos(ui_list_t *list, size_t page_idx)
-{
-	ui_list_entry_t *entry;
-	size_t i;
-
-	entry = ui_list_first(list);
-	for (i = 0; i < page_idx; i++) {
-		entry = ui_list_next(entry);
-		assert(entry != NULL);
-	}
-
-	list->page = entry;
-	list->page_idx = page_idx;
-
-	(void) ui_list_paint(list);
-}
-
-/** Request UI list activation.
- *
- * Call back to request UI list activation.
- *
- * @param list UI list
- */
-void ui_list_activate_req(ui_list_t *list)
-{
-	if (list->cb != NULL && list->cb->activate_req != NULL) {
-		list->cb->activate_req(list, list->cb_arg);
-	} else {
-		/*
-		 * If there is no callback for activation request,
-		 * just activate the list.
-		 */
-		ui_list_activate(list);
-	}
-}
-
-/** Sort list entries.
- *
- * @param list UI list
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_list_sort(ui_list_t *list)
-{
-	ui_list_entry_t **emap;
-	ui_list_entry_t *entry;
-	size_t i;
-
-	/* Create an array to hold pointer to each entry */
-	emap = calloc(list->entries_cnt, sizeof(ui_list_entry_t *));
-	if (emap == NULL)
-		return ENOMEM;
-
-	/* Write entry pointers to array */
-	entry = ui_list_first(list);
-	i = 0;
-	while (entry != NULL) {
-		assert(i < list->entries_cnt);
-		emap[i++] = entry;
-		entry = ui_list_next(entry);
-	}
-
-	/* Sort the array of pointers */
-	qsort(emap, list->entries_cnt, sizeof(ui_list_entry_t *),
-	    ui_list_entry_ptr_cmp);
-
-	/* Unlink entries from entry list */
-	entry = ui_list_first(list);
-	while (entry != NULL) {
-		list_remove(&entry->lentries);
-		entry = ui_list_first(list);
-	}
-
-	/* Add entries back to entry list sorted */
-	for (i = 0; i < list->entries_cnt; i++)
-		list_append(&emap[i]->lentries, &list->entries);
-
-	free(emap);
-
-	list->page = ui_list_first(list);
-	list->page_idx = 0;
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	return EOK;
-}
-
-/** Determine list entry index.
- *
- * @param entry List entry
- * @return List entry index
- */
-size_t ui_list_entry_get_idx(ui_list_entry_t *entry)
-{
-	ui_list_entry_t *ep;
-	size_t idx;
-
-	idx = 0;
-	ep = ui_list_prev(entry);
-	while (ep != NULL) {
-		++idx;
-		ep = ui_list_prev(ep);
-	}
-
-	return idx;
-}
-
-/** Center list cursor on entry.
- *
- * @param list UI list
- * @param entry Entry
- */
-void ui_list_cursor_center(ui_list_t *list, ui_list_entry_t *entry)
-{
-	ui_list_entry_t *prev;
-	size_t idx;
-	size_t max_idx;
-	size_t pg_size;
-	size_t i;
-
-	idx = ui_list_entry_get_idx(entry);
-	list->cursor = entry;
-	list->cursor_idx = idx;
-
-	/* Move page so that cursor is in the center */
-	list->page = list->cursor;
-	list->page_idx = list->cursor_idx;
-
-	pg_size = ui_list_page_size(list);
-
-	for (i = 0; i < pg_size / 2; i++) {
-		prev = ui_list_prev(list->page);
-		if (prev == NULL)
-			break;
-
-		list->page = prev;
-		--list->page_idx;
-	}
-
-	/* Make sure page is not beyond the end if possible */
-	if (list->entries_cnt > pg_size)
-		max_idx = list->entries_cnt - pg_size;
-	else
-		max_idx = 0;
-
-	while (list->page_idx > 0 && list->page_idx > max_idx) {
-		prev = ui_list_prev(list->page);
-		if (prev == NULL)
-			break;
-
-		list->page = prev;
-		--list->page_idx;
-	}
-}
-
-/** Call back when an entry is selected.
- *
- * @param entry UI list entry
- * @param fname File name
- */
-void ui_list_selected(ui_list_entry_t *entry)
-{
-	if (entry->list->cb != NULL && entry->list->cb->selected != NULL)
-		entry->list->cb->selected(entry, entry->arg);
-}
-
-/** UI list scrollbar up button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (ui_list_t *)
- */
-static void ui_list_scrollbar_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	ui_list_t *list = (ui_list_t *)arg;
-	ui_list_scroll_up(list);
-}
-
-/** UI list scrollbar down button pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (ui_list_t *)
- */
-static void ui_list_scrollbar_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	ui_list_t *list = (ui_list_t *)arg;
-	ui_list_scroll_down(list);
-}
-
-/** UI list scrollbar page up pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (ui_list_t *)
- */
-static void ui_list_scrollbar_page_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	ui_list_t *list = (ui_list_t *)arg;
-	ui_list_scroll_page_up(list);
-}
-
-/** UI list scrollbar page down pressed.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (ui_list_t *)
- */
-static void ui_list_scrollbar_page_down(ui_scrollbar_t *scrollbar,
-    void *arg)
-{
-	ui_list_t *list = (ui_list_t *)arg;
-	ui_list_scroll_page_down(list);
-}
-
-/** UI list scrollbar moved.
- *
- * @param scrollbar Scrollbar
- * @param arg Argument (ui_list_t *)
- */
-static void ui_list_scrollbar_moved(ui_scrollbar_t *scrollbar, void *arg,
-    gfx_coord_t pos)
-{
-	ui_list_t *list = (ui_list_t *)arg;
-	size_t entries;
-	size_t pglen;
-	size_t sbar_len;
-	size_t pgstart;
-
-	entries = list_count(&list->entries);
-	pglen = ui_list_page_size(list);
-	sbar_len = ui_scrollbar_move_length(list->scrollbar);
-
-	if (entries > pglen)
-		pgstart = (entries - pglen) * pos / (sbar_len - 1);
-	else
-		pgstart = 0;
-
-	ui_list_scroll_pos(list, pgstart);
-}
-
-/** Compare two list entries indirectly referenced by pointers.
- *
- * @param pa Pointer to pointer to first entry
- * @param pb Pointer to pointer to second entry
- * @return <0, =0, >=0 if pa < b, pa == pb, pa > pb, resp.
- */
-int ui_list_entry_ptr_cmp(const void *pa, const void *pb)
-{
-	ui_list_entry_t *a = *(ui_list_entry_t **)pa;
-	ui_list_entry_t *b = *(ui_list_entry_t **)pb;
-
-	return a->list->cb->compare(a, b);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/menu.c
===================================================================
--- uspace/lib/ui/src/menu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,657 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu
- */
-
-#include <adt/list.h>
-#include <ctype.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <uchar.h>
-#include <ui/ui.h>
-#include <ui/accel.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/popup.h>
-#include <ui/menu.h>
-#include <ui/menuentry.h>
-#include <ui/resource.h>
-#include <ui/window.h>
-#include "../private/menu.h"
-#include "../private/resource.h"
-
-enum {
-	menu_frame_w = 4,
-	menu_frame_h = 4,
-	menu_frame_w_text = 2,
-	menu_frame_h_text = 1,
-	menu_frame_h_margin_text = 1
-};
-
-static void ui_menu_popup_close(ui_popup_t *, void *);
-static void ui_menu_popup_kbd(ui_popup_t *, void *, kbd_event_t *);
-static void ui_menu_popup_pos(ui_popup_t *, void *, pos_event_t *);
-static void ui_menu_key_press_unmod(ui_menu_t *, kbd_event_t *);
-
-static ui_popup_cb_t ui_menu_popup_cb = {
-	.close = ui_menu_popup_close,
-	.kbd = ui_menu_popup_kbd,
-	.pos = ui_menu_popup_pos
-};
-
-/** Create new menu.
- *
- * @param parent Parent window
- * @param mbar Menu bar
- * @param rmenu Place to store pointer to new menu
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_menu_create(ui_window_t *parent, ui_menu_t **rmenu)
-{
-	ui_menu_t *menu;
-
-	menu = calloc(1, sizeof(ui_menu_t));
-	if (menu == NULL)
-		return ENOMEM;
-
-	menu->parent = parent;
-	list_initialize(&menu->entries);
-
-	*rmenu = menu;
-	return EOK;
-}
-
-/** Destroy menu.
- *
- * @param menu Menu or @c NULL
- */
-void ui_menu_destroy(ui_menu_t *menu)
-{
-	ui_menu_entry_t *mentry;
-
-	if (menu == NULL)
-		return;
-
-	/* Destroy entries */
-	mentry = ui_menu_entry_first(menu);
-	while (mentry != NULL) {
-		ui_menu_entry_destroy(mentry);
-		mentry = ui_menu_entry_first(menu);
-	}
-
-	free(menu->caption);
-	free(menu);
-}
-
-/** Set menu callbacks.
- *
- * @param menu Menu
- * @param cb Callbacks
- * @param arg Callback argument
- */
-void ui_menu_set_cb(ui_menu_t *menu, ui_menu_cb_t *cb, void *arg)
-{
-	menu->cb = cb;
-	menu->arg = arg;
-}
-
-/** Get menu geometry.
- *
- * @param menu Menu
- * @param spos Starting position
- * @param geom Structure to fill in with computed geometry
- */
-void ui_menu_get_geom(ui_menu_t *menu, gfx_coord2_t *spos,
-    ui_menu_geom_t *geom)
-{
-	gfx_coord2_t edim;
-	gfx_coord_t frame_w;
-	gfx_coord_t frame_h;
-	ui_resource_t *res;
-
-	res = ui_window_get_res(menu->parent);
-
-	if (res->textmode) {
-		frame_w = menu_frame_w_text;
-		frame_h = menu_frame_h_text;
-	} else {
-		frame_w = menu_frame_w;
-		frame_h = menu_frame_h;
-	}
-
-	edim.x = ui_menu_entry_calc_width(menu, menu->max_caption_w,
-	    menu->max_shortcut_w);
-	edim.y = menu->total_h;
-
-	geom->outer_rect.p0 = *spos;
-	geom->outer_rect.p1.x = spos->x + edim.x + 2 * frame_w;
-	geom->outer_rect.p1.y = spos->y + edim.y + 2 * frame_h;
-
-	geom->entries_rect.p0.x = spos->x + frame_w;
-	geom->entries_rect.p0.y = spos->y + frame_h;
-	geom->entries_rect.p1.x = geom->entries_rect.p0.x + edim.x;
-	geom->entries_rect.p1.y = geom->entries_rect.p0.x + edim.y;
-}
-
-/** Get UI resource from menu.
- *
- * @param menu Menu
- * @return UI resource
- */
-ui_resource_t *ui_menu_get_res(ui_menu_t *menu)
-{
-	return ui_popup_get_res(menu->popup);
-}
-
-/** Open menu.
- *
- * @param menu Menu
- * @param prect Parent rectangle around which the menu should be placed
- * @param idev_id Input device associated with the menu's seat
- */
-errno_t ui_menu_open(ui_menu_t *menu, gfx_rect_t *prect, sysarg_t idev_id)
-{
-	ui_popup_t *popup = NULL;
-	ui_popup_params_t params;
-	ui_menu_geom_t geom;
-	gfx_coord2_t mpos;
-	errno_t rc;
-
-	/* Select first entry */
-	menu->selected = ui_menu_entry_first(menu);
-
-	/* Determine menu dimensions */
-
-	mpos.x = 0;
-	mpos.y = 0;
-	ui_menu_get_geom(menu, &mpos, &geom);
-
-	ui_popup_params_init(&params);
-	params.rect = geom.outer_rect;
-	params.place = *prect;
-	params.idev_id = idev_id;
-
-	rc = ui_popup_create(ui_window_get_ui(menu->parent), menu->parent,
-	    &params, &popup);
-	if (rc != EOK)
-		return rc;
-
-	menu->popup = popup;
-	ui_popup_set_cb(popup, &ui_menu_popup_cb, menu);
-
-	return ui_menu_paint(menu, &mpos);
-}
-
-/** Close menu.
- *
- * @param menu Menu
- */
-void ui_menu_close(ui_menu_t *menu)
-{
-	ui_popup_destroy(menu->popup);
-	menu->popup = NULL;
-}
-
-/** Determine if menu is open.
- *
- * @param menu Menu
- * @return @c true iff menu is open
- */
-bool ui_menu_is_open(ui_menu_t *menu)
-{
-	return menu->popup != NULL;
-}
-
-/** Paint menu.
- *
- * @param menu Menu
- * @param spos Starting position (top-left corner)
- * @return EOK on success or an error code
- */
-errno_t ui_menu_paint_bg_gfx(ui_menu_t *menu, gfx_coord2_t *spos)
-{
-	ui_resource_t *res;
-	ui_menu_geom_t geom;
-	gfx_rect_t bg_rect;
-	errno_t rc;
-
-	res = ui_menu_get_res(menu);
-	ui_menu_get_geom(menu, spos, &geom);
-
-	/* Paint menu frame */
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_outset_frame(res, &geom.outer_rect, &bg_rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint menu background */
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &bg_rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint menu.
- *
- * @param menu Menu
- * @param spos Starting position (top-left corner)
- * @return EOK on success or an error code
- */
-errno_t ui_menu_paint_bg_text(ui_menu_t *menu, gfx_coord2_t *spos)
-{
-	ui_resource_t *res;
-	ui_menu_geom_t geom;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	res = ui_menu_get_res(menu);
-	ui_menu_get_geom(menu, spos, &geom);
-
-	/* Paint menu background */
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &geom.outer_rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint menu box */
-
-	rect = geom.outer_rect;
-	rect.p0.x += menu_frame_h_margin_text;
-	rect.p1.x -= menu_frame_h_margin_text;
-
-	rc = ui_paint_text_box(res, &rect, ui_box_single, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint menu.
- *
- * @param menu Menu
- * @param spos Starting position (top-left corner)
- * @return EOK on success or an error code
- */
-errno_t ui_menu_paint(ui_menu_t *menu, gfx_coord2_t *spos)
-{
-	ui_resource_t *res;
-	gfx_coord2_t pos;
-	ui_menu_entry_t *mentry;
-	ui_menu_geom_t geom;
-	errno_t rc;
-
-	res = ui_menu_get_res(menu);
-	ui_menu_get_geom(menu, spos, &geom);
-
-	/* Paint menu frame and background */
-	if (res->textmode)
-		rc = ui_menu_paint_bg_text(menu, spos);
-	else
-		rc = ui_menu_paint_bg_gfx(menu, spos);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint entries */
-	pos = geom.entries_rect.p0;
-
-	mentry = ui_menu_entry_first(menu);
-	while (mentry != NULL) {
-		rc = ui_menu_entry_paint(mentry, &pos);
-		if (rc != EOK)
-			goto error;
-
-		pos.y += ui_menu_entry_height(mentry);
-		mentry = ui_menu_entry_next(mentry);
-	}
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Handle position event in menu.
- *
- * @param menu Menu
- * @param spos Starting position (top-left corner)
- * @param event Position event
- * @return ui_claimed iff the event was claimed
- */
-ui_evclaim_t ui_menu_pos_event(ui_menu_t *menu, gfx_coord2_t *spos,
-    pos_event_t *event)
-{
-	ui_menu_geom_t geom;
-	ui_menu_entry_t *mentry;
-	gfx_coord2_t pos;
-	gfx_coord2_t epos;
-	ui_evclaim_t claimed;
-
-	ui_menu_get_geom(menu, spos, &geom);
-	epos.x = event->hpos;
-	epos.y = event->vpos;
-
-	pos = geom.entries_rect.p0;
-
-	mentry = ui_menu_entry_first(menu);
-	while (mentry != NULL) {
-		claimed = ui_menu_entry_pos_event(mentry, &pos, event);
-		if (claimed == ui_claimed)
-			return ui_claimed;
-
-		pos.y += ui_menu_entry_height(mentry);
-		mentry = ui_menu_entry_next(mentry);
-	}
-
-	/* Event inside menu? */
-	if (gfx_pix_inside_rect(&epos, &geom.outer_rect)) {
-		/* Claim event */
-		return ui_claimed;
-	} else {
-		/* Press outside menu - close it */
-		if (event->type == POS_PRESS)
-			ui_menu_close_req(menu);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle keyboard event in menu.
- *
- * @param menu Menu
- * @param event Keyboard event
- * @return ui_claimed iff the event was claimed
- */
-ui_evclaim_t ui_menu_kbd_event(ui_menu_t *menu, kbd_event_t *event)
-{
-	if (event->type == KEY_PRESS && (event->mods &
-	    (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) {
-		ui_menu_key_press_unmod(menu, event);
-	}
-
-	if (event->type == KEY_PRESS && (event->mods & KM_ALT) != 0 &&
-	    (event->mods & (KM_CTRL | KM_SHIFT)) == 0 && event->c != '\0')
-		ui_menu_press_accel(menu, event->c, event->kbd_id);
-
-	return ui_claimed;
-}
-
-/** Move one entry up.
- *
- * Non-selectable entries are skipped. If we are already at the top,
- * we wrap around.
- *
- * @param menu Menu
- */
-void ui_menu_up(ui_menu_t *menu)
-{
-	gfx_coord2_t mpos;
-	ui_menu_entry_t *nentry;
-
-	if (menu->selected == NULL)
-		return;
-
-	nentry = ui_menu_entry_prev(menu->selected);
-	if (nentry == NULL)
-		nentry = ui_menu_entry_last(menu);
-
-	/* Need to find a selectable entry */
-	while (!ui_menu_entry_selectable(nentry)) {
-		nentry = ui_menu_entry_prev(nentry);
-		if (nentry == NULL)
-			nentry = ui_menu_entry_last(menu);
-
-		/* Went completely around and found nothing? */
-		if (nentry == menu->selected)
-			return;
-	}
-
-	menu->selected = nentry;
-
-	mpos.x = 0;
-	mpos.y = 0;
-	(void) ui_menu_paint(menu, &mpos);
-}
-
-/** Move one entry down.
- *
- * Non-selectable entries are skipped. If we are already at the bottom,
- * we wrap around.
- *
- * @param menu Menu
- */
-void ui_menu_down(ui_menu_t *menu)
-{
-	gfx_coord2_t mpos;
-	ui_menu_entry_t *nentry;
-
-	if (menu->selected == NULL)
-		return;
-
-	nentry = ui_menu_entry_next(menu->selected);
-	if (nentry == NULL)
-		nentry = ui_menu_entry_first(menu);
-
-	/* Need to find a selectable entry */
-	while (!ui_menu_entry_selectable(nentry)) {
-		nentry = ui_menu_entry_next(nentry);
-		if (nentry == NULL)
-			nentry = ui_menu_entry_first(menu);
-
-		/* Went completely around and found nothing? */
-		if (nentry == menu->selected)
-			return;
-	}
-
-	menu->selected = nentry;
-
-	mpos.x = 0;
-	mpos.y = 0;
-	(void) ui_menu_paint(menu, &mpos);
-}
-
-/** Handle key press without modifiers in menu popup window.
- *
- * @param menu Menu
- * @param event Keyboard event
- */
-static void ui_menu_key_press_unmod(ui_menu_t *menu, kbd_event_t *event)
-{
-	ui_menu_entry_t *mentry;
-	char32_t c;
-
-	switch (event->key) {
-	case KC_ESCAPE:
-		ui_menu_close_req(menu);
-		break;
-	case KC_LEFT:
-		ui_menu_left(menu, event->kbd_id);
-		break;
-	case KC_RIGHT:
-		ui_menu_right(menu, event->kbd_id);
-		break;
-	case KC_UP:
-		ui_menu_up(menu);
-		break;
-	case KC_DOWN:
-		ui_menu_down(menu);
-		break;
-	case KC_ENTER:
-		if (menu->selected != NULL &&
-		    !ui_menu_entry_is_disabled(menu->selected))
-			ui_menu_entry_activate(menu->selected);
-		break;
-	default:
-		if (event->c != '\0') {
-			mentry = ui_menu_entry_first(menu);
-			while (mentry != NULL) {
-				c = ui_menu_entry_get_accel(mentry);
-				if (c == (char32_t)tolower(event->c) &&
-				    !ui_menu_entry_is_disabled(mentry)) {
-					ui_menu_entry_activate(mentry);
-					break;
-				}
-				mentry = ui_menu_entry_next(mentry);
-			}
-		}
-		break;
-	}
-}
-
-/** Handle close event in menu popup window.
- *
- * @param popup Menu popup window
- * @param arg Argument (ui_menu_t *)
- */
-static void ui_menu_popup_close(ui_popup_t *popup, void *arg)
-{
-	ui_menu_t *menu = (ui_menu_t *)arg;
-
-	/* Forward close request to caller */
-	ui_menu_close_req(menu);
-}
-
-/** Handle keyboard event in menu popup window.
- *
- * @param popup Menu popup window
- * @param arg Argument (ui_menu_t *)
- * @param event Keyboard event
- */
-static void ui_menu_popup_kbd(ui_popup_t *popup, void *arg, kbd_event_t *event)
-{
-	ui_menu_t *menu = (ui_menu_t *)arg;
-
-	menu->idev_id = ui_popup_get_idev_id(menu->popup);
-	ui_menu_kbd_event(menu, event);
-}
-
-/** Handle position event in menu popup window.
- *
- * @param popup Menu popup window
- * @param arg Argument (ui_menu_t *)
- * @param event Position event
- */
-static void ui_menu_popup_pos(ui_popup_t *popup, void *arg, pos_event_t *event)
-{
-	ui_menu_t *menu = (ui_menu_t *)arg;
-	gfx_coord2_t spos;
-
-	menu->idev_id = ui_popup_get_idev_id(menu->popup);
-
-	spos.x = 0;
-	spos.y = 0;
-	ui_menu_pos_event(menu, &spos, event);
-}
-
-/** Send menu left event.
- *
- * @param menu Menu
- * @param idev_id Input device ID
- */
-void ui_menu_left(ui_menu_t *menu, sysarg_t idev_id)
-{
-	if (menu->cb != NULL && menu->cb->left != NULL)
-		menu->cb->left(menu, menu->arg, idev_id);
-}
-
-/** Send menu right event.
- *
- * @param menu Menu
- * @param idev_id Input device ID
- */
-void ui_menu_right(ui_menu_t *menu, sysarg_t idev_id)
-{
-	if (menu->cb != NULL && menu->cb->right != NULL)
-		menu->cb->right(menu, menu->arg, idev_id);
-}
-
-/** Send menu close request event.
- *
- * @param menu Menu
- */
-void ui_menu_close_req(ui_menu_t *menu)
-{
-	if (menu->cb != NULL && menu->cb->close_req != NULL)
-		menu->cb->close_req(menu, menu->arg);
-}
-
-/** Send menu accelerator key press event.
- *
- * @param menu Menu
- * @param c Character
- * @param kbd_id Keyboard ID
- */
-void ui_menu_press_accel(ui_menu_t *menu, char32_t c, sysarg_t kbd_id)
-{
-	if (menu->cb != NULL && menu->cb->press_accel != NULL)
-		menu->cb->press_accel(menu, menu->arg, c, kbd_id);
-}
-
-/** Get ID of last device that input event.
- *
- * @param menu Menu
- * @return Input device ID
- */
-sysarg_t ui_menu_get_idev_id(ui_menu_t *menu)
-{
-	return menu->idev_id;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/menubar.c
===================================================================
--- uspace/lib/ui/src/menubar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,743 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu bar
- */
-
-#include <adt/list.h>
-#include <ctype.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include "../private/menubar.h"
-#include "../private/resource.h"
-#include "../private/wdecor.h"
-#include "../private/window.h"
-
-enum {
-	menubar_hpad = 4,
-	menubar_vpad = 4,
-	menubar_hpad_text = 1,
-	menubar_vpad_text = 0
-};
-
-static void ui_menu_bar_ctl_destroy(void *);
-static errno_t ui_menu_bar_ctl_paint(void *);
-static ui_evclaim_t ui_menu_bar_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_menu_bar_ctl_pos_event(void *, pos_event_t *);
-static void ui_menu_bar_activate_ev(ui_menu_bar_t *);
-static void ui_menu_bar_deactivate_ev(ui_menu_bar_t *);
-
-/** Menu bar control ops */
-ui_control_ops_t ui_menu_bar_ops = {
-	.destroy = ui_menu_bar_ctl_destroy,
-	.paint = ui_menu_bar_ctl_paint,
-	.kbd_event = ui_menu_bar_ctl_kbd_event,
-	.pos_event = ui_menu_bar_ctl_pos_event
-};
-
-/** Create new menu bar.
- *
- * @param ui UI
- * @param window Window that will contain the menu bar
- * @param rmbar Place to store pointer to new menu bar
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_menu_bar_create(ui_t *ui, ui_window_t *window, ui_menu_bar_t **rmbar)
-{
-	ui_menu_bar_t *mbar;
-	errno_t rc;
-
-	mbar = calloc(1, sizeof(ui_menu_bar_t));
-	if (mbar == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_menu_bar_ops, (void *) mbar, &mbar->control);
-	if (rc != EOK) {
-		free(mbar);
-		return rc;
-	}
-
-	mbar->ui = ui;
-	mbar->window = window;
-	list_initialize(&mbar->menudds);
-
-	if (window->mbar == NULL)
-		window->mbar = mbar;
-
-	*rmbar = mbar;
-	return EOK;
-}
-
-/** Destroy menu bar
- *
- * @param mbar Menu bar or @c NULL
- */
-void ui_menu_bar_destroy(ui_menu_bar_t *mbar)
-{
-	ui_menu_dd_t *mdd;
-
-	if (mbar == NULL)
-		return;
-
-	if (mbar->window->mbar == mbar)
-		mbar->window->mbar = NULL;
-
-	/* Destroy menu drop-downs */
-	mdd = ui_menu_dd_first(mbar);
-	while (mdd != NULL) {
-		ui_menu_dd_destroy(mdd);
-		mdd = ui_menu_dd_first(mbar);
-	}
-
-	ui_control_delete(mbar->control);
-	free(mbar);
-}
-
-/** Set menu bar callbacks.
- *
- * @param mbar Menu bar
- * @param cb Callbacks
- * @param arg Callback argument
- */
-void ui_menu_bar_set_cb(ui_menu_bar_t *mbar, ui_menu_bar_cb_t *cb, void *arg)
-{
-	mbar->cb = cb;
-	mbar->arg = arg;
-}
-
-/** Get base control from menu bar.
- *
- * @param mbar Menu bar
- * @return Control
- */
-ui_control_t *ui_menu_bar_ctl(ui_menu_bar_t *mbar)
-{
-	return mbar->control;
-}
-
-/** Set menu bar rectangle.
- *
- * @param mbar Menu bar
- * @param rect New menu bar rectangle
- */
-void ui_menu_bar_set_rect(ui_menu_bar_t *mbar, gfx_rect_t *rect)
-{
-	mbar->rect = *rect;
-}
-
-/** Paint menu bar.
- *
- * @param mbar Menu bar
- * @return EOK on success or an error code
- */
-errno_t ui_menu_bar_paint(ui_menu_bar_t *mbar)
-{
-	ui_resource_t *res;
-	ui_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	gfx_coord2_t tpos;
-	gfx_rect_t rect;
-	gfx_color_t *bg_color;
-	ui_menu_dd_t *mdd;
-	const char *caption;
-	gfx_coord_t width;
-	gfx_coord_t hpad;
-	gfx_coord_t vpad;
-	errno_t rc;
-
-	res = ui_window_get_res(mbar->window);
-
-	/* Paint menu bar background */
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &mbar->rect);
-	if (rc != EOK)
-		goto error;
-
-	if (res->textmode) {
-		hpad = menubar_hpad_text;
-		vpad = menubar_vpad_text;
-	} else {
-		hpad = menubar_hpad;
-		vpad = menubar_vpad;
-	}
-
-	pos = mbar->rect.p0;
-
-	ui_text_fmt_init(&fmt);
-	fmt.font = res->font;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	mdd = ui_menu_dd_first(mbar);
-	while (mdd != NULL) {
-		caption = ui_menu_dd_caption(mdd);
-		width = ui_text_width(res->font, caption) + 2 * hpad;
-		tpos.x = pos.x + hpad;
-		tpos.y = pos.y + vpad;
-
-		rect.p0 = pos;
-		rect.p1.x = rect.p0.x + width;
-		rect.p1.y = mbar->rect.p1.y;
-
-		if (mdd == mbar->selected) {
-			fmt.color = res->wnd_sel_text_color;
-			fmt.hgl_color = res->wnd_sel_text_hgl_color;
-			bg_color = res->wnd_sel_text_bg_color;
-		} else {
-			fmt.color = res->wnd_text_color;
-			fmt.hgl_color = res->wnd_text_hgl_color;
-			bg_color = res->wnd_face_color;
-		}
-
-		rc = gfx_set_color(res->gc, bg_color);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_fill_rect(res->gc, &rect);
-		if (rc != EOK)
-			goto error;
-
-		rc = ui_paint_text(&tpos, &fmt, caption);
-		if (rc != EOK)
-			goto error;
-
-		pos.x += width;
-		mdd = ui_menu_dd_next(mdd);
-	}
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Select or deselect menu from menu bar.
- *
- * Select @a menu. If @a menu is @c NULL or it is already selected,
- * then select none.
- *
- * @param mbar Menu bar
- * @param mdd Menu drop-down to select (or deselect if selected) or @c NULL
- * @param openup Open menu even if not currently open
- * @param idev_id Input device ID associated with the selecting seat
- */
-void ui_menu_bar_select(ui_menu_bar_t *mbar, ui_menu_dd_t *mdd, bool openup,
-    sysarg_t idev_id)
-{
-	ui_menu_dd_t *old_mdd;
-	gfx_rect_t rect;
-	bool was_open;
-
-	old_mdd = mbar->selected;
-
-	mbar->selected = mdd;
-
-	/* Close previously open menu drop-down */
-	if (old_mdd != NULL && ui_menu_dd_is_open(old_mdd)) {
-		was_open = true;
-		(void) ui_menu_dd_close(old_mdd);
-	} else {
-		was_open = false;
-	}
-
-	(void) ui_menu_bar_paint(mbar);
-
-	if (mbar->selected != NULL) {
-		ui_menu_bar_entry_rect(mbar, mbar->selected, &rect);
-		if (openup || was_open) {
-			/*
-			 * Open the newly selected menu drop-down if either
-			 * the old menu drop-down was open or @a openup was
-			 * specified.
-			 */
-			(void) ui_menu_dd_open(mbar->selected, &rect, idev_id);
-		}
-
-		if (!mbar->active)
-			ui_menu_bar_activate_ev(mbar);
-		mbar->active = true;
-	} else {
-		if (mbar->active)
-			ui_menu_bar_deactivate_ev(mbar);
-		mbar->active = false;
-	}
-}
-
-/** Select first drop-down.
- *
- * @param mbar Menu bar
- * @param openup @c true to open drop-down if it was not open
- * @param idev_id Input device ID
- */
-void ui_menu_bar_select_first(ui_menu_bar_t *mbar, bool openup,
-    sysarg_t idev_id)
-{
-	ui_menu_dd_t *mdd;
-
-	mdd = ui_menu_dd_first(mbar);
-	ui_menu_bar_select(mbar, mdd, openup, idev_id);
-}
-
-/** Select last drop-down.
- *
- * @param mbar Menu bar
- * @param openup @c true to open drop-down if it was not open
- * @param idev_id Input device ID
- */
-void ui_menu_bar_select_last(ui_menu_bar_t *mbar, bool openup,
-    sysarg_t idev_id)
-{
-	ui_menu_dd_t *mdd;
-
-	mdd = ui_menu_dd_last(mbar);
-	ui_menu_bar_select(mbar, mdd, openup, idev_id);
-}
-
-/** Select system menu.
- *
- * @param mbar Menu bar
- * @param openup @c true to open drop-down if it was not open
- * @param idev_id Input device ID
- */
-void ui_menu_bar_select_sysmenu(ui_menu_bar_t *mbar, bool openup,
-    sysarg_t idev_id)
-{
-	ui_wdecor_sysmenu_hdl_set_active(mbar->window->wdecor, true);
-
-	if (openup)
-		ui_window_send_sysmenu(mbar->window, idev_id);
-}
-
-/** Move one entry left.
- *
- * If the selected menu is open, the newly selected menu will be open
- * as well. If we are already at the first entry, we wrap around.
- *
- * @param mbar Menu bar
- * @param idev_id Input device ID
- */
-void ui_menu_bar_left(ui_menu_bar_t *mbar, sysarg_t idev_id)
-{
-	ui_menu_dd_t *nmdd;
-	bool sel_sysmenu = false;
-	bool was_open;
-
-	if (mbar->selected == NULL)
-		return;
-
-	nmdd = ui_menu_dd_prev(mbar->selected);
-	if (nmdd == NULL) {
-		if ((mbar->window->wdecor->style & ui_wds_sysmenu_hdl) != 0) {
-			sel_sysmenu = true;
-		} else {
-			nmdd = ui_menu_dd_last(mbar);
-		}
-	}
-
-	was_open = mbar->selected != NULL &&
-	    ui_menu_dd_is_open(mbar->selected);
-
-	if (nmdd != mbar->selected)
-		ui_menu_bar_select(mbar, nmdd, false, idev_id);
-
-	/*
-	 * Only open sysmenu *after* closing the previous menu, avoid
-	 * having multiple popup windows at the same time.
-	 */
-	if (sel_sysmenu)
-		ui_menu_bar_select_sysmenu(mbar, was_open, idev_id);
-}
-
-/** Move one entry right.
- *
- * If the selected menu is open, the newly selected menu will be open
- * as well. If we are already at the last entry, we wrap around.
- *
- * @param mbar Menu bar
- * @param idev_id Input device ID
- */
-void ui_menu_bar_right(ui_menu_bar_t *mbar, sysarg_t idev_id)
-{
-	ui_menu_dd_t *nmdd;
-	bool sel_sysmenu = false;
-	bool was_open;
-
-	if (mbar->selected == NULL)
-		return;
-
-	nmdd = ui_menu_dd_next(mbar->selected);
-	if (nmdd == NULL) {
-		if ((mbar->window->wdecor->style & ui_wds_sysmenu_hdl) != 0) {
-			sel_sysmenu = true;
-		} else {
-			nmdd = ui_menu_dd_first(mbar);
-		}
-	}
-
-	was_open = mbar->selected != NULL &&
-	    ui_menu_dd_is_open(mbar->selected);
-
-	if (nmdd != mbar->selected)
-		ui_menu_bar_select(mbar, nmdd, false, idev_id);
-
-	/*
-	 * Only open sysmenu *after* closing the previous menu, avoid
-	 * having multiple popup windows at the same time.
-	 */
-	if (sel_sysmenu)
-		ui_menu_bar_select_sysmenu(mbar, was_open, idev_id);
-}
-
-/** Handle menu bar key press without modifiers.
- *
- * @param mbar Menu bar
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_bar_key_press_unmod(ui_menu_bar_t *mbar, kbd_event_t *event)
-{
-	gfx_rect_t rect;
-
-	if (event->key == KC_F10) {
-		ui_menu_bar_activate(mbar);
-		return ui_claimed;
-	}
-
-	if (!mbar->active)
-		return ui_unclaimed;
-
-	if (event->key == KC_ESCAPE) {
-		ui_menu_bar_deactivate(mbar);
-		return ui_claimed;
-	}
-
-	if (event->key == KC_LEFT)
-		ui_menu_bar_left(mbar, event->kbd_id);
-
-	if (event->key == KC_RIGHT)
-		ui_menu_bar_right(mbar, event->kbd_id);
-
-	if (event->key == KC_ENTER || event->key == KC_DOWN) {
-		if (mbar->selected != NULL &&
-		    !ui_menu_dd_is_open(mbar->selected)) {
-			ui_menu_bar_entry_rect(mbar, mbar->selected,
-			    &rect);
-			ui_menu_dd_open(mbar->selected, &rect, event->kbd_id);
-		}
-
-		return ui_claimed;
-	}
-
-	if (event->c != '\0' && !ui_menu_dd_is_open(mbar->selected)) {
-		/* Check if it is an accelerator. */
-		ui_menu_bar_press_accel(mbar, event->c, event->kbd_id);
-	}
-
-	return ui_claimed;
-}
-
-/** Handle menu bar keyboard event.
- *
- * @param mbar Menu bar
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_bar_kbd_event(ui_menu_bar_t *mbar, kbd_event_t *event)
-{
-	if ((event->mods & KM_ALT) != 0 &&
-	    (event->mods & (KM_CTRL | KM_SHIFT)) == 0 && event->c != '\0') {
-		/* Check if it is an accelerator. */
-		ui_menu_bar_press_accel(mbar, event->c, event->kbd_id);
-	}
-
-	if (event->type == KEY_PRESS && (event->mods &
-	    (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) {
-		return ui_menu_bar_key_press_unmod(mbar, event);
-	}
-
-	if (mbar->active)
-		return ui_claimed;
-
-	return ui_unclaimed;
-}
-
-/** Accelerator key press.
- *
- * If @a c matches an accelerator key, open the respective menu.
- *
- * @param mbar Menu bar
- * @param c Character
- * @param kbd_id Keyboard ID
- */
-void ui_menu_bar_press_accel(ui_menu_bar_t *mbar, char32_t c, sysarg_t kbd_id)
-{
-	ui_menu_dd_t *mdd;
-	char32_t maccel;
-
-	mdd = ui_menu_dd_first(mbar);
-	while (mdd != NULL) {
-		maccel = ui_menu_dd_get_accel(mdd);
-		if ((char32_t)tolower(c) == maccel) {
-			ui_menu_bar_select(mbar, mdd, true, kbd_id);
-			return;
-		}
-
-		mdd = ui_menu_dd_next(mdd);
-	}
-}
-
-/** Handle menu bar position event.
- *
- * @param mbar Menu bar
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_bar_pos_event(ui_menu_bar_t *mbar, pos_event_t *event)
-{
-	ui_resource_t *res;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_menu_dd_t *mdd;
-	const char *caption;
-	gfx_coord_t width;
-	gfx_coord_t hpad;
-	gfx_coord2_t ppos;
-	sysarg_t pos_id;
-
-	res = ui_window_get_res(mbar->window);
-
-	ppos.x = event->hpos;
-	ppos.y = event->vpos;
-
-	if (res->textmode) {
-		hpad = menubar_hpad_text;
-	} else {
-		hpad = menubar_hpad;
-	}
-
-	pos = mbar->rect.p0;
-	pos_id = event->pos_id;
-
-	mdd = ui_menu_dd_first(mbar);
-	while (mdd != NULL) {
-		caption = ui_menu_dd_caption(mdd);
-		width = ui_text_width(res->font, caption) + 2 * hpad;
-
-		rect.p0 = pos;
-		rect.p1.x = rect.p0.x + width;
-		rect.p1.y = mbar->rect.p1.y;
-
-		/* Check if press is inside menu bar entry */
-		if (event->type == POS_PRESS &&
-		    gfx_pix_inside_rect(&ppos, &rect)) {
-			mbar->active = true;
-
-			/* Open the menu, if not already open. */
-			if (mdd != mbar->selected)
-				ui_menu_bar_select(mbar, mdd, true, pos_id);
-
-			return ui_claimed;
-		}
-
-		pos.x += width;
-		mdd = ui_menu_dd_next(mdd);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle menu bar position event.
- *
- * @param mbar Menu bar
- * @param mdd Menu drop-down whose entry's rectangle is to be returned
- * @param rrect Place to store entry rectangle
- */
-void ui_menu_bar_entry_rect(ui_menu_bar_t *mbar, ui_menu_dd_t *mdd,
-    gfx_rect_t *rrect)
-{
-	ui_resource_t *res;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_menu_dd_t *cur;
-	const char *caption;
-	gfx_coord_t width;
-	gfx_coord_t hpad;
-
-	res = ui_window_get_res(mbar->window);
-
-	if (res->textmode) {
-		hpad = menubar_hpad_text;
-	} else {
-		hpad = menubar_hpad;
-	}
-
-	pos = mbar->rect.p0;
-
-	cur = ui_menu_dd_first(mbar);
-	while (cur != NULL) {
-		caption = ui_menu_dd_caption(cur);
-		width = ui_text_width(res->font, caption) + 2 * hpad;
-
-		rect.p0 = pos;
-		rect.p1.x = rect.p0.x + width;
-		rect.p1.y = mbar->rect.p1.y;
-
-		if (cur == mdd) {
-			*rrect = rect;
-			return;
-		}
-
-		pos.x += width;
-		cur = ui_menu_dd_next(cur);
-	}
-
-	/* We should never get here */
-	assert(false);
-}
-
-/** Activate menu bar.
- *
- * @param mbar Menu bar
- */
-void ui_menu_bar_activate(ui_menu_bar_t *mbar)
-{
-	if (mbar->active)
-		return;
-
-	mbar->active = true;
-	if (mbar->selected == NULL)
-		mbar->selected = ui_menu_dd_first(mbar);
-
-	(void) ui_menu_bar_paint(mbar);
-	ui_menu_bar_activate_ev(mbar);
-}
-
-/** Deactivate menu bar.
- *
- * @param mbar Menu bar
- */
-void ui_menu_bar_deactivate(ui_menu_bar_t *mbar)
-{
-	ui_menu_bar_select(mbar, NULL, false, 0);
-	ui_menu_bar_deactivate_ev(mbar);
-}
-
-/** Destroy menu bar control.
- *
- * @param arg Argument (ui_menu_bar_t *)
- */
-void ui_menu_bar_ctl_destroy(void *arg)
-{
-	ui_menu_bar_t *mbar = (ui_menu_bar_t *) arg;
-
-	ui_menu_bar_destroy(mbar);
-}
-
-/** Paint menu bar control.
- *
- * @param arg Argument (ui_menu_bar_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_menu_bar_ctl_paint(void *arg)
-{
-	ui_menu_bar_t *mbar = (ui_menu_bar_t *) arg;
-
-	return ui_menu_bar_paint(mbar);
-}
-
-/** Handle menu bar control keyboard event.
- *
- * @param arg Argument (ui_menu_bar_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_bar_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_menu_bar_t *mbar = (ui_menu_bar_t *) arg;
-
-	return ui_menu_bar_kbd_event(mbar, event);
-}
-
-/** Handle menu bar control position event.
- *
- * @param arg Argument (ui_menu_bar_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_bar_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_menu_bar_t *mbar = (ui_menu_bar_t *) arg;
-
-	return ui_menu_bar_pos_event(mbar, event);
-}
-
-/** Send menu bar activate event.
- *
- * @param mbar Menu bar
- */
-static void ui_menu_bar_activate_ev(ui_menu_bar_t *mbar)
-{
-	if (mbar->cb != NULL && mbar->cb->activate != NULL)
-		mbar->cb->activate(mbar, mbar->arg);
-}
-
-/** Send menu bar deactivate event.
- *
- * @param mbar Menu bar
- */
-static void ui_menu_bar_deactivate_ev(ui_menu_bar_t *mbar)
-{
-	if (mbar->cb != NULL && mbar->cb->deactivate != NULL)
-		mbar->cb->deactivate(mbar, mbar->arg);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/menudd.c
===================================================================
--- uspace/lib/ui/src/menudd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu drop-down
- *
- * One of the drop-down menus of a menu bar. This class takes the generic
- * ui_menu and ties it to the menu bar.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/accel.h>
-#include <ui/menu.h>
-#include <ui/menudd.h>
-#include <ui/menubar.h>
-#include <ui/resource.h>
-#include "../private/menubar.h"
-#include "../private/menudd.h"
-
-static void ui_menu_dd_left(ui_menu_t *, void *, sysarg_t);
-static void ui_menu_dd_right(ui_menu_t *, void *, sysarg_t);
-static void ui_menu_dd_close_req(ui_menu_t *, void *);
-static void ui_menu_dd_press_accel(ui_menu_t *, void *, char32_t, sysarg_t);
-
-static ui_menu_cb_t ui_menu_dd_menu_cb = {
-	.left = ui_menu_dd_left,
-	.right = ui_menu_dd_right,
-	.close_req = ui_menu_dd_close_req,
-	.press_accel = ui_menu_dd_press_accel
-};
-
-/** Create new menu drop-down.
- *
- * @param mbar Menu bar
- * @param caption Caption
- * @param rmdd Place to store pointer to new menu drop-down or @c NULL
- * @param rmenu Place to store pointer to new menu or @c NULL
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_menu_dd_create(ui_menu_bar_t *mbar, const char *caption,
-    ui_menu_dd_t **rmdd, ui_menu_t **rmenu)
-{
-	errno_t rc;
-	ui_menu_dd_t *mdd;
-
-	mdd = calloc(1, sizeof(ui_menu_dd_t));
-	if (mdd == NULL)
-		return ENOMEM;
-
-	mdd->caption = str_dup(caption);
-	if (mdd->caption == NULL) {
-		free(mdd);
-		return ENOMEM;
-	}
-
-	/* Create menu */
-	rc = ui_menu_create(mbar->window, &mdd->menu);
-	if (rc != EOK) {
-		free(mdd->caption);
-		free(mdd);
-		return rc;
-	}
-
-	mdd->mbar = mbar;
-	list_append(&mdd->lmenudds, &mbar->menudds);
-
-	ui_menu_set_cb(mdd->menu, &ui_menu_dd_menu_cb, (void *)mdd);
-
-	if (rmdd != NULL)
-		*rmdd = mdd;
-	if (rmenu != NULL)
-		*rmenu = mdd->menu;
-	return EOK;
-}
-
-/** Destroy menu drop-down.
- *
- * @param menu Menu or @c NULL
- */
-void ui_menu_dd_destroy(ui_menu_dd_t *mdd)
-{
-	if (mdd == NULL)
-		return;
-
-	/* Destroy menu */
-	ui_menu_destroy(mdd->menu);
-
-	list_remove(&mdd->lmenudds);
-	free(mdd->caption);
-	free(mdd);
-}
-
-/** Get first menu drop-down in menu bar.
- *
- * @param mbar Menu bar
- * @return First menu or @c NULL if there is none
- */
-ui_menu_dd_t *ui_menu_dd_first(ui_menu_bar_t *mbar)
-{
-	link_t *link;
-
-	link = list_first(&mbar->menudds);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_dd_t, lmenudds);
-}
-
-/** Get next menu drop-down in menu bar.
- *
- * @param cur Current menu drop-down
- * @return Next menu drop-down or @c NULL if @a cur is the last one
- */
-ui_menu_dd_t *ui_menu_dd_next(ui_menu_dd_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lmenudds, &cur->mbar->menudds);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_dd_t, lmenudds);
-}
-
-/** Get last menu drop-down in menu bar.
- *
- * @param mbar Menu bar
- * @return Last menu drop-down or @c NULL if there is none
- */
-ui_menu_dd_t *ui_menu_dd_last(ui_menu_bar_t *mbar)
-{
-	link_t *link;
-
-	link = list_last(&mbar->menudds);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_dd_t, lmenudds);
-}
-
-/** Get previous menu drop-down in menu bar.
- *
- * @param cur Current menu drop-down
- * @return Previous menu drop-down or @c NULL if @a cur is the fist one
- */
-ui_menu_dd_t *ui_menu_dd_prev(ui_menu_dd_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->lmenudds, &cur->mbar->menudds);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_dd_t, lmenudds);
-}
-
-/** Get menu drop-down caption.
- *
- * @param mdd Menu drop-down
- * @return Caption (owned by @a menu)
- */
-const char *ui_menu_dd_caption(ui_menu_dd_t *mdd)
-{
-	return mdd->caption;
-}
-
-/** Get menu drop-down accelerator character.
- *
- * @param mdd Menu drop-down
- * @return Accelerator character (lowercase) or the null character if
- *         the menu has no accelerator.
- */
-char32_t ui_menu_dd_get_accel(ui_menu_dd_t *mdd)
-{
-	return ui_accel_get(mdd->caption);
-}
-
-/** Open menu drop-down.
- *
- * @param mdd Menu drop-down
- * @param prect Parent rectangle around which the drop-down should be placed
- * @param idev_id Input device associated with the drop-down's seat
- */
-errno_t ui_menu_dd_open(ui_menu_dd_t *mdd, gfx_rect_t *prect, sysarg_t idev_id)
-{
-	return ui_menu_open(mdd->menu, prect, idev_id);
-}
-
-/** Close menu drop-down.
- *
- * @param mdd Menu drop-down
- */
-void ui_menu_dd_close(ui_menu_dd_t *mdd)
-{
-	ui_menu_close(mdd->menu);
-}
-
-/** Determine if menu drop-down is open.
- *
- * @param mdd Menu drop-down
- * @return @c true iff menu drop-down is open
- */
-bool ui_menu_dd_is_open(ui_menu_dd_t *mdd)
-{
-	return ui_menu_is_open(mdd->menu);
-}
-
-/** Handle menu left event.
- *
- * @param menu Menu
- * @param arg Argument (ui_menu_dd_t *)
- * @param idev_id Input device ID
- */
-static void ui_menu_dd_left(ui_menu_t *menu, void *arg, sysarg_t idev_id)
-{
-	ui_menu_dd_t *mdd = (ui_menu_dd_t *)arg;
-
-	(void)menu;
-
-	ui_menu_bar_left(mdd->mbar, idev_id);
-}
-
-/** Handle menu right event.
- *
- * @param menu Menu
- * @param arg Argument (ui_menu_dd_t *)
- * @param idev_id Input device ID
- */
-static void ui_menu_dd_right(ui_menu_t *menu, void *arg, sysarg_t idev_id)
-{
-	ui_menu_dd_t *mdd = (ui_menu_dd_t *)arg;
-
-	(void)menu;
-
-	ui_menu_bar_right(mdd->mbar, idev_id);
-}
-
-/** Handle menu close request.
- *
- * @param menu Menu
- * @param arg Argument (ui_menu_dd_t *)
- */
-static void ui_menu_dd_close_req(ui_menu_t *menu, void *arg)
-{
-	ui_menu_dd_t *mdd = (ui_menu_dd_t *)arg;
-
-	(void)menu;
-	ui_menu_bar_deactivate(mdd->mbar);
-}
-
-/** Handle menu accelerator key press event.
- *
- * @param menu Menu
- * @param arg Argument (ui_menu_dd_t *)
- * @param c Character
- * @param kbd_id Keyboard ID
- */
-static void ui_menu_dd_press_accel(ui_menu_t *menu, void *arg, char32_t c,
-    sysarg_t kbd_id)
-{
-	ui_menu_dd_t *mdd = (ui_menu_dd_t *)arg;
-
-	(void)menu;
-	ui_menu_bar_press_accel(mdd->mbar, c, kbd_id);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/menuentry.c
===================================================================
--- uspace/lib/ui/src/menuentry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,651 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Menu entry
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/accel.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/menubar.h>
-#include <ui/menuentry.h>
-#include <ui/window.h>
-#include "../private/menubar.h"
-#include "../private/menuentry.h"
-#include "../private/menu.h"
-#include "../private/resource.h"
-
-enum {
-	menu_entry_hpad = 4,
-	menu_entry_vpad = 4,
-	menu_entry_column_pad = 8,
-	menu_entry_sep_height = 2,
-	menu_entry_hpad_text = 1,
-	menu_entry_vpad_text = 0,
-	menu_entry_column_pad_text = 2,
-	menu_entry_sep_height_text = 1
-};
-
-/** Create new menu entry.
- *
- * @param menu Menu
- * @param caption Caption
- * @param shortcut Shotcut key(s) or empty string
- * @param rmentry Place to store pointer to new menu entry
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_menu_entry_create(ui_menu_t *menu, const char *caption,
-    const char *shortcut, ui_menu_entry_t **rmentry)
-{
-	ui_menu_entry_t *mentry;
-	gfx_coord_t caption_w;
-	gfx_coord_t shortcut_w;
-
-	mentry = calloc(1, sizeof(ui_menu_entry_t));
-	if (mentry == NULL)
-		return ENOMEM;
-
-	mentry->caption = str_dup(caption);
-	if (mentry->caption == NULL) {
-		free(mentry);
-		return ENOMEM;
-	}
-
-	mentry->shortcut = str_dup(shortcut);
-	if (mentry->caption == NULL) {
-		free(mentry->caption);
-		free(mentry);
-		return ENOMEM;
-	}
-
-	mentry->menu = menu;
-	list_append(&mentry->lentries, &menu->entries);
-
-	/* Update accumulated menu entry dimensions */
-	ui_menu_entry_column_widths(mentry, &caption_w, &shortcut_w);
-	if (caption_w > menu->max_caption_w)
-		menu->max_caption_w = caption_w;
-	if (shortcut_w > menu->max_shortcut_w)
-		menu->max_shortcut_w = shortcut_w;
-	menu->total_h += ui_menu_entry_height(mentry);
-
-	*rmentry = mentry;
-	return EOK;
-}
-
-/** Create new separator menu entry.
- *
- * @param menu Menu
- * @param rmentry Place to store pointer to new menu entry
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_menu_entry_sep_create(ui_menu_t *menu, ui_menu_entry_t **rmentry)
-{
-	ui_menu_entry_t *mentry;
-	errno_t rc;
-
-	rc = ui_menu_entry_create(menu, "", "", &mentry);
-	if (rc != EOK)
-		return rc;
-
-	/* Need to adjust menu height when changing to separator */
-	menu->total_h -= ui_menu_entry_height(mentry);
-	mentry->separator = true;
-	menu->total_h += ui_menu_entry_height(mentry);
-
-	*rmentry = mentry;
-	return EOK;
-}
-
-/** Destroy menu entry.
- *
- * @param mentry Menu entry or @c NULL
- */
-void ui_menu_entry_destroy(ui_menu_entry_t *mentry)
-{
-	if (mentry == NULL)
-		return;
-
-	mentry->menu->total_h -= ui_menu_entry_height(mentry);
-	/* NOTE: max_caption_w/max_shortcut_w not updated (speed) */
-
-	list_remove(&mentry->lentries);
-
-	/*
-	 * If we emptied the menu, reset accumulated dims so they
-	 * can be correctly calculated when (if) the menu is
-	 * re-populated.
-	 */
-	if (list_empty(&mentry->menu->entries)) {
-		mentry->menu->total_h = 0;
-		mentry->menu->max_caption_w = 0;
-		mentry->menu->max_shortcut_w = 0;
-	}
-
-	free(mentry->caption);
-	free(mentry);
-}
-
-/** Set menu entry callback.
- *
- * @param mentry Menu entry
- * @param cb Menu entry callback
- * @param arg Callback argument
- */
-void ui_menu_entry_set_cb(ui_menu_entry_t *mentry, ui_menu_entry_cb_t cb,
-    void *arg)
-{
-	mentry->cb = cb;
-	mentry->arg = arg;
-}
-
-/** Set menu entry disabled flag.
- *
- * @param mentry Menu entry
- * @param disabled @c true iff entry is to be disabled, @c false otherwise
- */
-void ui_menu_entry_set_disabled(ui_menu_entry_t *mentry, bool disabled)
-{
-	mentry->disabled = disabled;
-}
-
-/** Get menu entry disabled flag.
- *
- * @param mentry Menu entry
- * @return disabled @c true iff entry is disabled, @c false otherwise
- */
-bool ui_menu_entry_is_disabled(ui_menu_entry_t *mentry)
-{
-	return mentry->disabled;
-}
-
-/** Get first menu entry in menu.
- *
- * @param menu Menu
- * @return First menu entry or @c NULL if there is none
- */
-ui_menu_entry_t *ui_menu_entry_first(ui_menu_t *menu)
-{
-	link_t *link;
-
-	link = list_first(&menu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_entry_t, lentries);
-}
-
-/** Get last menu entry in menu.
- *
- * @param menu Menu
- * @return Last menu entry or @c NULL if there is none
- */
-ui_menu_entry_t *ui_menu_entry_last(ui_menu_t *menu)
-{
-	link_t *link;
-
-	link = list_last(&menu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_entry_t, lentries);
-}
-
-/** Get next menu entry in menu.
- *
- * @param cur Current menu entry
- * @return Next menu entry or @c NULL if @a cur is the last one
- */
-ui_menu_entry_t *ui_menu_entry_next(ui_menu_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lentries, &cur->menu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_entry_t, lentries);
-}
-
-/** Get previous menu entry in menu.
- *
- * @param cur Current menu entry
- * @return Next menu entry or @c NULL if @a cur is the last one
- */
-ui_menu_entry_t *ui_menu_entry_prev(ui_menu_entry_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->lentries, &cur->menu->entries);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_menu_entry_t, lentries);
-}
-
-/** Get width of menu entry.
- *
- * @param mentry Menu entry
- * @param caption_w Place to store caption width
- * @param shortcut_w Place to store shortcut width
- */
-void ui_menu_entry_column_widths(ui_menu_entry_t *mentry,
-    gfx_coord_t *caption_w, gfx_coord_t *shortcut_w)
-{
-	ui_resource_t *res;
-
-	/*
-	 * This needs to work even if the menu is not open, so we cannot
-	 * use the menu's resource, which is only created after the menu
-	 * is open (and its window is created). Use the parent window's
-	 * resource instead.
-	 */
-	res = ui_window_get_res(mentry->menu->parent);
-
-	*caption_w = ui_text_width(res->font, mentry->caption);
-	*shortcut_w = ui_text_width(res->font, mentry->shortcut);
-}
-
-/** Compute width of menu entry.
- *
- * @param menu Menu
- * @param caption_w Widht of caption text
- * @param shortcut_w Width of shortcut text
- * @return Width in pixels
- */
-gfx_coord_t ui_menu_entry_calc_width(ui_menu_t *menu, gfx_coord_t caption_w,
-    gfx_coord_t shortcut_w)
-{
-	ui_resource_t *res;
-	gfx_coord_t hpad;
-	gfx_coord_t width;
-
-	/*
-	 * This needs to work even if the menu is not open, so we cannot
-	 * use the menu's resource, which is only created after the menu
-	 * is open (and its window is created). Use the parent window's
-	 * resource instead.
-	 */
-	res = ui_window_get_res(menu->parent);
-
-	if (res->textmode)
-		hpad = menu_entry_hpad_text;
-	else
-		hpad = menu_entry_hpad;
-
-	width = caption_w + 2 * hpad;
-
-	if (shortcut_w != 0) {
-		if (res->textmode)
-			width += menu_entry_column_pad_text;
-		else
-			width += menu_entry_column_pad;
-
-		width += shortcut_w;
-	}
-
-	return width;
-}
-
-/** Get height of menu entry.
- *
- * @param mentry Menu entry
- * @return Width in pixels
- */
-gfx_coord_t ui_menu_entry_height(ui_menu_entry_t *mentry)
-{
-	ui_resource_t *res;
-	gfx_font_metrics_t metrics;
-	gfx_coord_t height;
-	gfx_coord_t vpad;
-
-	/*
-	 * This needs to work even if the menu is not open, so we cannot
-	 * use the menu's resource, which is only created after the menu
-	 * is open (and its window is created). Use the parent window's
-	 * resource instead.
-	 */
-	res = ui_window_get_res(mentry->menu->parent);
-
-	if (res->textmode) {
-		vpad = menu_entry_vpad_text;
-	} else {
-		vpad = menu_entry_vpad;
-	}
-
-	if (mentry->separator) {
-		/* Separator menu entry */
-		if (res->textmode)
-			height = menu_entry_sep_height_text;
-		else
-			height = menu_entry_sep_height;
-	} else {
-		/* Normal menu entry */
-		gfx_font_get_metrics(res->font, &metrics);
-		height = metrics.ascent + metrics.descent + 1;
-	}
-
-	return height + 2 * vpad;
-}
-
-/** Get menu entry accelerator character.
- *
- * @param mentry Menu entry
- * @return Accelerator character (lowercase) or the null character if
- *         the menu entry has no accelerator.
- */
-char32_t ui_menu_entry_get_accel(ui_menu_entry_t *mentry)
-{
-	return ui_accel_get(mentry->caption);
-}
-
-/** Paint menu entry.
- *
- * @param mentry Menu entry
- * @param pos Position where to paint entry
- * @return EOK on success or an error code
- */
-errno_t ui_menu_entry_paint(ui_menu_entry_t *mentry, gfx_coord2_t *pos)
-{
-	ui_resource_t *res;
-	ui_text_fmt_t fmt;
-	gfx_color_t *bg_color;
-	ui_menu_entry_geom_t geom;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	res = ui_menu_get_res(mentry->menu);
-
-	ui_menu_entry_get_geom(mentry, pos, &geom);
-
-	ui_text_fmt_init(&fmt);
-	fmt.font = res->font;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	if ((mentry->held && mentry->inside) ||
-	    mentry == mentry->menu->selected) {
-		fmt.color = res->wnd_sel_text_color;
-		fmt.hgl_color = res->wnd_sel_text_hgl_color;
-		bg_color = res->wnd_sel_text_bg_color;
-	} else if (mentry->disabled) {
-		fmt.color = res->wnd_dis_text_color;
-		fmt.hgl_color = res->wnd_dis_text_color;
-		bg_color = res->wnd_face_color;
-	} else {
-		fmt.color = res->wnd_text_color;
-		fmt.hgl_color = res->wnd_text_hgl_color;
-		bg_color = res->wnd_face_color;
-	}
-
-	rc = gfx_set_color(res->gc, bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &geom.outer_rect);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_text(&geom.caption_pos, &fmt, mentry->caption);
-	if (rc != EOK)
-		goto error;
-
-	fmt.halign = gfx_halign_right;
-
-	rc = ui_paint_text(&geom.shortcut_pos, &fmt, mentry->shortcut);
-	if (rc != EOK)
-		goto error;
-
-	if (mentry->separator) {
-		if (res->textmode) {
-			rect = geom.outer_rect;
-			rect.p0.x -= 1;
-			rect.p1.x += 1;
-
-			rc = ui_paint_text_hbrace(res, &rect, ui_box_single,
-			    res->wnd_face_color);
-			if (rc != EOK)
-				goto error;
-		} else {
-			rect.p0 = geom.caption_pos;
-			rect.p1.x = geom.shortcut_pos.x;
-			rect.p1.y = rect.p0.y + 2;
-			rc = ui_paint_bevel(res->gc, &rect, res->wnd_shadow_color,
-			    res->wnd_highlight_color, 1, NULL);
-			if (rc != EOK)
-				goto error;
-		}
-	}
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Determine if entry is selectable.
- *
- * @return @c true iff entry is selectable
- */
-bool ui_menu_entry_selectable(ui_menu_entry_t *mentry)
-{
-	return !mentry->separator;
-}
-
-/** Handle button press in menu entry.
- *
- * @param mentry Menu entry
- * @param pos Menu entry position
- */
-void ui_menu_entry_press(ui_menu_entry_t *mentry, gfx_coord2_t *pos)
-{
-	if (mentry->held)
-		return;
-
-	if (mentry->separator || mentry->disabled)
-		return;
-
-	mentry->inside = true;
-	mentry->held = true;
-	ui_menu_entry_paint(mentry, pos);
-}
-
-/** Handle button release in menu entry.
- *
- * @param mentry Menu entry
- */
-void ui_menu_entry_release(ui_menu_entry_t *mentry)
-{
-	if (!mentry->held)
-		return;
-
-	mentry->held = false;
-
-	if (mentry->inside)
-		ui_menu_entry_activate(mentry);
-}
-
-/** Activate menu entry.
- *
- * @param mentry Menu entry
- */
-void ui_menu_entry_activate(ui_menu_entry_t *mentry)
-{
-	/* Close menu */
-	ui_menu_close_req(mentry->menu);
-
-	/* Call back */
-	ui_menu_entry_cb(mentry);
-}
-
-/** Call menu entry callback.
- *
- * @param mentry Menu entry
- */
-void ui_menu_entry_cb(ui_menu_entry_t *mentry)
-{
-	if (mentry->cb != NULL)
-		mentry->cb(mentry, mentry->arg);
-}
-
-/** Pointer entered menu entry.
- *
- * @param mentry Menu entry
- * @param pos Menu entry position
- */
-void ui_menu_entry_enter(ui_menu_entry_t *mentry, gfx_coord2_t *pos)
-{
-	if (mentry->inside)
-		return;
-
-	mentry->inside = true;
-	if (mentry->held)
-		(void) ui_menu_entry_paint(mentry, pos);
-}
-
-/** Pointer left menu entry.
- *
- * @param mentry Menu entry
- * @param pos Menu entry position
- */
-void ui_menu_entry_leave(ui_menu_entry_t *mentry, gfx_coord2_t *pos)
-{
-	if (!mentry->inside)
-		return;
-
-	mentry->inside = false;
-	if (mentry->held)
-		(void) ui_menu_entry_paint(mentry, pos);
-}
-
-/** Handle menu entry position event.
- *
- * @param mentry Menu entry
- * @param pos Menu entry position (top-left corner)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_menu_entry_pos_event(ui_menu_entry_t *mentry,
-    gfx_coord2_t *pos, pos_event_t *event)
-{
-	ui_menu_entry_geom_t geom;
-	gfx_coord2_t ppos;
-	bool inside;
-
-	ppos.x = event->hpos;
-	ppos.y = event->vpos;
-
-	ui_menu_entry_get_geom(mentry, pos, &geom);
-	inside = gfx_pix_inside_rect(&ppos, &geom.outer_rect);
-
-	switch (event->type) {
-	case POS_PRESS:
-		if (inside) {
-			ui_menu_entry_press(mentry, pos);
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (mentry->held) {
-			ui_menu_entry_release(mentry);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		if (inside && !mentry->inside) {
-			ui_menu_entry_enter(mentry, pos);
-			return ui_claimed;
-		} else if (!inside && mentry->inside) {
-			ui_menu_entry_leave(mentry, pos);
-		}
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Get menu entry geometry.
- *
- * @param mentry Menu entry
- * @param spos Entry position
- * @param geom Structure to fill in with computed geometry
- */
-void ui_menu_entry_get_geom(ui_menu_entry_t *mentry, gfx_coord2_t *pos,
-    ui_menu_entry_geom_t *geom)
-{
-	ui_resource_t *res;
-	gfx_coord_t hpad;
-	gfx_coord_t vpad;
-	gfx_coord_t width;
-
-	res = ui_menu_get_res(mentry->menu);
-
-	if (res->textmode) {
-		hpad = menu_entry_hpad_text;
-		vpad = menu_entry_vpad_text;
-	} else {
-		hpad = menu_entry_hpad;
-		vpad = menu_entry_vpad;
-	}
-
-	/* Compute total width of menu entry */
-	width = ui_menu_entry_calc_width(mentry->menu,
-	    mentry->menu->max_caption_w, mentry->menu->max_shortcut_w);
-
-	geom->outer_rect.p0 = *pos;
-	geom->outer_rect.p1.x = geom->outer_rect.p0.x + width;
-	geom->outer_rect.p1.y = geom->outer_rect.p0.y +
-	    ui_menu_entry_height(mentry);
-
-	geom->caption_pos.x = pos->x + hpad;
-	geom->caption_pos.y = pos->y + vpad;
-
-	geom->shortcut_pos.x = geom->outer_rect.p1.x - hpad;
-	geom->shortcut_pos.y = pos->y + vpad;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/msgdialog.c
===================================================================
--- uspace/lib/ui/src/msgdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,343 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Message dialog
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/msgdialog.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/msgdialog.h"
-
-static void ui_msg_dialog_wnd_close(ui_window_t *, void *);
-static void ui_msg_dialog_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-ui_window_cb_t ui_msg_dialog_wnd_cb = {
-	.close = ui_msg_dialog_wnd_close,
-	.kbd = ui_msg_dialog_wnd_kbd
-};
-
-static void ui_msg_dialog_btn_clicked(ui_pbutton_t *, void *);
-
-ui_pbutton_cb_t ui_msg_dialog_btn_cb = {
-	.clicked = ui_msg_dialog_btn_clicked
-};
-
-static const char *ui_msg_dialog_captions[][ui_msg_dialog_maxbtn + 1] = {
-	[umdc_ok] = { "OK", NULL },
-	[umdc_ok_cancel] = { "OK", "Cancel", NULL }
-};
-
-/** Initialize message dialog parameters structure.
- *
- * Message dialog parameters structure must always be initialized using
- * this function first.
- *
- * @param params Message dialog parameters structure
- */
-void ui_msg_dialog_params_init(ui_msg_dialog_params_t *params)
-{
-	memset(params, 0, sizeof(ui_msg_dialog_params_t));
-}
-
-/** Create new message dialog.
- *
- * @param ui User interface
- * @param params Message dialog parameters
- * @param rdialog Place to store pointer to new dialog
- * @return EOK on success or an error code
- */
-errno_t ui_msg_dialog_create(ui_t *ui, ui_msg_dialog_params_t *params,
-    ui_msg_dialog_t **rdialog)
-{
-	errno_t rc;
-	ui_msg_dialog_t *dialog;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t wparams;
-	ui_fixed_t *fixed = NULL;
-	ui_label_t *label = NULL;
-	ui_pbutton_t *btn[ui_msg_dialog_maxbtn];
-	const char **cp;
-	unsigned i, nb;
-	gfx_rect_t rect;
-	gfx_coord_t bw, bpad, btnsw, bp0x;
-	ui_resource_t *ui_res;
-
-	for (i = 0; i < ui_msg_dialog_maxbtn; i++)
-		btn[i] = NULL;
-
-	dialog = calloc(1, sizeof(ui_msg_dialog_t));
-	if (dialog == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = params->caption;
-	if ((params->flags & umdf_topmost) != 0)
-		wparams.flags |= wndf_topmost;
-	if ((params->flags & umdf_center) != 0)
-		wparams.placement = ui_wnd_place_center;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 60;
-		wparams.rect.p1.y = 7;
-	} else {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 440;
-		wparams.rect.p1.y = 110;
-	}
-
-	rc = ui_window_create(ui, &wparams, &window);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_set_cb(window, &ui_msg_dialog_wnd_cb, dialog);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_label_create(ui_res, params->text, &label);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 2;
-		rect.p1.x = 57;
-		rect.p1.y = 3;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 35;
-		rect.p1.x = 430;
-		rect.p1.y = 50;
-	}
-
-	ui_label_set_rect(label, &rect);
-	ui_label_set_halign(label, gfx_halign_center);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(label));
-	if (rc != EOK)
-		goto error;
-
-	label = NULL;
-
-	i = 0;
-	assert(params->choice == umdc_ok || params->choice == umdc_ok_cancel);
-	cp = ui_msg_dialog_captions[params->choice];
-
-	while (*cp != NULL) {
-		rc = ui_pbutton_create(ui_res, *cp, &btn[i]);
-		if (rc != EOK)
-			goto error;
-
-		ui_pbutton_set_cb(btn[i], &ui_msg_dialog_btn_cb, dialog);
-		++cp;
-		++i;
-	}
-
-	nb = i;
-
-	if (ui_is_textmode(ui)) {
-		bw = 12;
-		bpad = 2;
-	} else {
-		bw = 90;
-		bpad = 10;
-	}
-
-	btnsw = (nb - 1) * (bw + bpad) + bw;
-	bp0x = (wparams.rect.p0.x + wparams.rect.p1.x - btnsw) / 2;
-
-	for (i = 0; i < nb; i++) {
-		/* FIXME: Auto layout */
-		if (ui_is_textmode(ui)) {
-			rect.p0.x = bp0x + i * (bw + bpad);
-			rect.p0.y = 4;
-			rect.p1.x = bp0x + bw + i * (bw + bpad);
-			rect.p1.y = 5;
-		} else {
-			rect.p0.x = bp0x + i * (bw + bpad);
-			rect.p0.y = 60;
-			rect.p1.x = bp0x + bw + i * (bw + bpad);
-			rect.p1.y = 88;
-		}
-
-		ui_pbutton_set_rect(btn[i], &rect);
-
-		rc = ui_fixed_add(fixed, ui_pbutton_ctl(btn[i]));
-		if (rc != EOK)
-			goto error;
-	}
-
-	ui_pbutton_set_default(btn[0], true);
-
-	for (i = 0; i < ui_msg_dialog_maxbtn; i++) {
-		dialog->btn[i] = btn[i];
-		btn[i] = NULL;
-	}
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK)
-		goto error;
-
-	dialog->window = window;
-	*rdialog = dialog;
-	return EOK;
-error:
-	for (i = 0; i < ui_msg_dialog_maxbtn; i++) {
-		if (btn[i] != NULL)
-			ui_pbutton_destroy(btn[i]);
-	}
-	if (label != NULL)
-		ui_label_destroy(label);
-	if (fixed != NULL)
-		ui_fixed_destroy(fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (dialog != NULL)
-		free(dialog);
-	return rc;
-}
-
-/** Destroy message dialog.
- *
- * @param dialog Message dialog or @c NULL
- */
-void ui_msg_dialog_destroy(ui_msg_dialog_t *dialog)
-{
-	if (dialog == NULL)
-		return;
-
-	ui_window_destroy(dialog->window);
-	free(dialog);
-}
-
-/** Set mesage dialog callback.
- *
- * @param dialog Message dialog
- * @param cb Message dialog callbacks
- * @param arg Callback argument
- */
-void ui_msg_dialog_set_cb(ui_msg_dialog_t *dialog, ui_msg_dialog_cb_t *cb,
-    void *arg)
-{
-	dialog->cb = cb;
-	dialog->arg = arg;
-}
-
-/** Message dialog window close handler.
- *
- * @param window Window
- * @param arg Argument (ui_msg_dialog_t *)
- */
-static void ui_msg_dialog_wnd_close(ui_window_t *window, void *arg)
-{
-	ui_msg_dialog_t *dialog = (ui_msg_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->close != NULL)
-		dialog->cb->close(dialog, dialog->arg);
-}
-
-/** Message dialog window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (ui_msg_dialog_t *)
- * @param event Keyboard event
- */
-static void ui_msg_dialog_wnd_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	ui_msg_dialog_t *dialog = (ui_msg_dialog_t *) arg;
-	ui_evclaim_t claim;
-
-	claim = ui_window_def_kbd(window, event);
-	if (claim == ui_claimed)
-		return;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_SHIFT | KM_ALT)) == 0) {
-		if (event->key == KC_ENTER) {
-			/* OK / default button */
-			if (dialog->cb != NULL && dialog->cb->button != NULL) {
-				dialog->cb->button(dialog, dialog->arg, 0);
-				return;
-			}
-		} else if (event->key == KC_ESCAPE) {
-			/* Cancel */
-			if (dialog->cb != NULL && dialog->cb->close != NULL) {
-				dialog->cb->close(dialog, dialog->arg);
-				return;
-			}
-		}
-	}
-
-}
-
-/** Message dialog button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_msg_dialog_t *)
- */
-static void ui_msg_dialog_btn_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_msg_dialog_t *dialog = (ui_msg_dialog_t *) arg;
-	unsigned i;
-
-	if (dialog->cb != NULL && dialog->cb->button != NULL) {
-		for (i = 0; i < ui_msg_dialog_maxbtn; i++) {
-			if (dialog->btn[i] == pbutton)
-				dialog->cb->button(dialog, dialog->arg, i);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/lib/ui/src/paint.c
===================================================================
--- uspace/lib/ui/src/paint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1003 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Painting routines
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <ui/accel.h>
-#include <ui/paint.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../private/resource.h"
-
-/** Single box characters */
-static ui_box_chars_t single_box_chars = {
-	{
-		{ "\u250c", "\u2500", "\u2510" },
-		{ "\u2502", " ",      "\u2502" },
-		{ "\u2514", "\u2500", "\u2518" }
-	}
-};
-
-/** Double box characters */
-static ui_box_chars_t double_box_chars = {
-	{
-		{ "\u2554", "\u2550", "\u2557" },
-		{ "\u2551", " ",      "\u2551" },
-		{ "\u255a", "\u2550", "\u255d" }
-	}
-};
-
-/** Single horizontal brace characters */
-static ui_brace_chars_t single_hbrace_chars = {
-	.start = "\u251c",
-	.middle = "\u2500",
-	.end = "\u2524"
-};
-
-/** Double horizontal brace characters */
-static ui_brace_chars_t double_hbrace_chars = {
-	.start = "\u2560",
-	.middle = "\u2550",
-	.end = "\u2563"
-};
-
-/** Paint bevel.
- *
- * @param gc Graphic context
- * @param rect Rectangle to paint into
- * @param tlcolor Top-left color
- * @param brcolor Bottom-right color
- * @param thickness Bevel thickness in pixels
- * @param inside Place to store rectangle of the interior or @c NULL
- * @return EOK on success or an error code
- */
-errno_t ui_paint_bevel(gfx_context_t *gc, gfx_rect_t *rect,
-    gfx_color_t *tlcolor, gfx_color_t *brcolor, gfx_coord_t thickness,
-    gfx_rect_t *inside)
-{
-	gfx_rect_t frect;
-	gfx_coord_t i;
-	errno_t rc;
-
-	/* Top left */
-
-	rc = gfx_set_color(gc, tlcolor);
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < thickness; i++) {
-		frect.p0.x = rect->p0.x + i;
-		frect.p0.y = rect->p0.y + i;
-		frect.p1.x = rect->p1.x - i - 1;
-		frect.p1.y = rect->p0.y + i + 1;
-		rc = gfx_fill_rect(gc, &frect);
-		if (rc != EOK)
-			goto error;
-
-		frect.p0.x = rect->p0.x + i;
-		frect.p0.y = rect->p0.y + i + 1;
-		frect.p1.x = rect->p0.x + i + 1;
-		frect.p1.y = rect->p1.y - i - 1;
-		rc = gfx_fill_rect(gc, &frect);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Bottom right */
-
-	rc = gfx_set_color(gc, brcolor);
-	if (rc != EOK)
-		goto error;
-
-	for (i = 0; i < thickness; i++) {
-		frect.p0.x = rect->p0.x + i;
-		frect.p0.y = rect->p1.y - i - 1;
-		frect.p1.x = rect->p1.x - i - 1;
-		frect.p1.y = rect->p1.y - i;
-		rc = gfx_fill_rect(gc, &frect);
-		if (rc != EOK)
-			goto error;
-
-		frect.p0.x = rect->p1.x - i - 1;
-		frect.p0.y = rect->p0.y + i;
-		frect.p1.x = rect->p1.x - i;
-		frect.p1.y = rect->p1.y - i;
-		rc = gfx_fill_rect(gc, &frect);
-		if (rc != EOK)
-			goto error;
-	}
-
-	if (inside != NULL)
-		ui_paint_get_bevel_inside(gc, rect, thickness, inside);
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Get bevel interior rectangle.
- *
- * Get the bevel interior rectangle without painting it.
- *
- * @param gc Graphic context
- * @param rect Rectangle to paint into
- * @param thickness Bevel thickness in pixels
- * @param inside Place to store rectangle of the interior
- */
-void ui_paint_get_bevel_inside(gfx_context_t *gc, gfx_rect_t *rect,
-    gfx_coord_t thickness, gfx_rect_t *inside)
-{
-	inside->p0.x = rect->p0.x + thickness;
-	inside->p0.y = rect->p0.y + thickness;
-	inside->p1.x = rect->p1.x - thickness;
-	inside->p1.y = rect->p1.y - thickness;
-}
-
-/** Paint inset frame.
- *
- * @param resource UI resource
- * @param rect Rectangle to paint onto
- * @param inside Place to store inside rectangle or @c NULL
- * @return EOK on success or an error code
- */
-errno_t ui_paint_inset_frame(ui_resource_t *resource, gfx_rect_t *rect,
-    gfx_rect_t *inside)
-{
-	gfx_rect_t frame;
-	errno_t rc;
-
-	rc = ui_paint_bevel(resource->gc, rect,
-	    resource->wnd_shadow_color, resource->wnd_highlight_color,
-	    1, &frame);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_bevel(resource->gc, &frame,
-	    resource->wnd_frame_sh_color, resource->wnd_frame_hi_color,
-	    1, inside);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Get inset frame interior rectangle.
- *
- * This allows one to get the interior rectangle without actually painting
- * the inset frame.
- *
- * @param resource UI resource
- * @param rect Rectangle to paint onto
- * @param inside Place to store inside rectangle or @c NULL
- */
-void ui_paint_get_inset_frame_inside(ui_resource_t *resource, gfx_rect_t *rect,
-    gfx_rect_t *inside)
-{
-	ui_paint_get_bevel_inside(resource->gc, rect, 2, inside);
-}
-
-/** Paint outset frame.
- *
- * @param resource UI resource
- * @param rect Rectangle to paint onto
- * @param inside Place to store inside rectangle or @c NULL
- * @return EOK on success or an error code
- */
-errno_t ui_paint_outset_frame(ui_resource_t *resource, gfx_rect_t *rect,
-    gfx_rect_t *inside)
-{
-	gfx_rect_t frame;
-	errno_t rc;
-
-	rc = ui_paint_bevel(resource->gc, rect,
-	    resource->wnd_frame_hi_color, resource->wnd_frame_sh_color,
-	    1, &frame);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_bevel(resource->gc, &frame,
-	    resource->wnd_highlight_color, resource->wnd_shadow_color,
-	    1, inside);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint filled circle vertical scanline.
- *
- * @param gc Graphic context
- * @param center Coordinates of the center of the circle
- * @param x X-coordinate of the scanline
- * @param y0 Lowest Y coordinate of the scanline (inclusive)
- * @param y1 Highest Y coordinate of the scanline (inclusive)
- * @param part Which part(s) of cicle to paint
- * @return EOK on success or an error code
- */
-static errno_t ui_paint_fcircle_line(gfx_context_t *gc, gfx_coord2_t *center,
-    gfx_coord_t x, gfx_coord_t y0, gfx_coord_t y1, ui_fcircle_part_t part)
-{
-	gfx_rect_t rect;
-	gfx_rect_t trect;
-
-	rect.p0.x = x;
-	rect.p0.y = y0;
-	rect.p1.x = x + 1;
-	rect.p1.y = y1;
-
-	/* Clip to upper-left/lower-right half of circle, if required */
-
-	if ((part & ui_fcircle_upleft) == 0) {
-		if (rect.p0.y < -rect.p1.x)
-			rect.p0.y = -rect.p1.x;
-	}
-
-	if ((part & ui_fcircle_lowright) == 0) {
-		if (rect.p1.y > -rect.p1.x)
-			rect.p1.y = -rect.p1.x;
-	}
-
-	/* If coordinates are reversed, there is nothing to do */
-	if (rect.p1.y <= rect.p0.y)
-		return EOK;
-
-	gfx_rect_translate(center, &rect, &trect);
-
-	return gfx_fill_rect(gc, &trect);
-}
-
-/** Paint filled circle scanlines corresponding to octant point.
- *
- * Fills the four vertical scanlines lying between the eight reflections
- * of a circle point.
- *
- * @param gc Graphic context
- * @param center Coordinates of the center
- * @param r Radius in pixels
- * @param part Which part(s) of cicle to paint
- * @return EOK on success or an error code
- */
-static int ui_paint_fcircle_point(gfx_context_t *gc, gfx_coord2_t *center,
-    gfx_coord2_t *p, ui_fcircle_part_t part)
-{
-	errno_t rc;
-
-	rc = ui_paint_fcircle_line(gc, center, +p->x, -p->y, p->y + 1, part);
-	if (rc != EOK)
-		return rc;
-	rc = ui_paint_fcircle_line(gc, center, -p->x, -p->y, p->y + 1, part);
-	if (rc != EOK)
-		return rc;
-	rc = ui_paint_fcircle_line(gc, center, +p->y, -p->x, p->x + 1, part);
-	if (rc != EOK)
-		return rc;
-	rc = ui_paint_fcircle_line(gc, center, -p->y, -p->x, p->x + 1, part);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint a filled circle.
- *
- * @param gc Graphic context
- * @param center Coordinates of the center
- * @param r Radius in pixels
- * @param part Which part(s) of cicle to paint
- * @return EOK on success or an error code
- */
-errno_t ui_paint_filled_circle(gfx_context_t *gc, gfx_coord2_t *center,
-    gfx_coord_t r, ui_fcircle_part_t part)
-{
-	gfx_coord2_t p;
-	gfx_coord_t f;
-	errno_t rc;
-
-	/* Run through one octant using circle midpoint algorithm */
-
-	p.x = r;
-	p.y = 0;
-	f = 1 - r;
-
-	rc = ui_paint_fcircle_point(gc, center, &p, part);
-	if (rc != EOK)
-		return rc;
-
-	while (p.x > p.y) {
-		if (f < 0) {
-			f = f + 2 * p.y + 3;
-		} else {
-			f = f + 2 * (p.y - p.x) + 5;
-			--p.x;
-		}
-		++p.y;
-
-		rc = ui_paint_fcircle_point(gc, center, &p, part);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint upward pointing triangle.
- *
- * @param gc Graphic context
- * @param pos Center position
- * @param n Length of triangle side
- * @return EOK on success or an error code
- */
-errno_t ui_paint_up_triangle(gfx_context_t *gc, gfx_coord2_t *pos,
-    gfx_coord_t n)
-{
-	gfx_coord_t i;
-	errno_t rc;
-	gfx_rect_t rect;
-
-	for (i = 0; i < n; i++) {
-		rect.p0.x = pos->x - i;
-		rect.p0.y = pos->y - n / 2 + i;
-		rect.p1.x = pos->x + i + 1;
-		rect.p1.y = pos->y - n / 2 + i + 1;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint downward pointing triangle.
- *
- * @param gc Graphic context
- * @param pos Center position
- * @param n Length of triangle side
- * @return EOK on success or an error code
- */
-errno_t ui_paint_down_triangle(gfx_context_t *gc, gfx_coord2_t *pos,
-    gfx_coord_t n)
-{
-	gfx_coord_t i;
-	errno_t rc;
-	gfx_rect_t rect;
-
-	for (i = 0; i < n; i++) {
-		rect.p0.x = pos->x - i;
-		rect.p0.y = pos->y + n / 2 - i;
-		rect.p1.x = pos->x + i + 1;
-		rect.p1.y = pos->y + n / 2 - i + 1;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint left pointing triangle.
- *
- * @param gc Graphic context
- * @param pos Center position
- * @param n Length of triangle side
- * @return EOK on success or an error code
- */
-errno_t ui_paint_left_triangle(gfx_context_t *gc, gfx_coord2_t *pos,
-    gfx_coord_t n)
-{
-	gfx_coord_t i;
-	errno_t rc;
-	gfx_rect_t rect;
-
-	for (i = 0; i < n; i++) {
-		rect.p0.x = pos->x - n / 2 + i;
-		rect.p0.y = pos->y - i;
-		rect.p1.x = pos->x - n / 2 + i + 1;
-		rect.p1.y = pos->y + i + 1;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint right pointing triangle.
- *
- * @param gc Graphic context
- * @param pos Center position
- * @param n Length of triangle side
- * @return EOK on success or an error code
- */
-errno_t ui_paint_right_triangle(gfx_context_t *gc, gfx_coord2_t *pos,
-    gfx_coord_t n)
-{
-	gfx_coord_t i;
-	errno_t rc;
-	gfx_rect_t rect;
-
-	for (i = 0; i < n; i++) {
-		rect.p0.x = pos->x + n / 2 - i;
-		rect.p0.y = pos->y - i;
-		rect.p1.x = pos->x + n / 2 - i + 1;
-		rect.p1.y = pos->y + i + 1;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint diagonal cross (X).
- *
- * @param gc Graphic context
- * @param pos Center position
- * @param n Length of each leg
- * @param w Pen width
- * @param h Pen height
- * @return EOK on success or an error code
- */
-errno_t ui_paint_cross(gfx_context_t *gc, gfx_coord2_t *pos,
-    gfx_coord_t n, gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_coord_t i;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rect.p0.x = pos->x;
-	rect.p0.y = pos->y;
-	rect.p1.x = pos->x + w;
-	rect.p1.y = pos->y + h;
-	rc = gfx_fill_rect(gc, &rect);
-	if (rc != EOK)
-		return rc;
-
-	for (i = 1; i < n; i++) {
-		rect.p0.x = pos->x - i;
-		rect.p0.y = pos->y - i;
-		rect.p1.x = pos->x - i + w;
-		rect.p1.y = pos->y - i + h;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-
-		rect.p0.x = pos->x - i;
-		rect.p0.y = pos->y + i;
-		rect.p1.x = pos->x - i + w;
-		rect.p1.y = pos->y + i + h;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-
-		rect.p0.x = pos->x + i;
-		rect.p0.y = pos->y - i;
-		rect.p1.x = pos->x + i + w;
-		rect.p1.y = pos->y - i + h;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-
-		rect.p0.x = pos->x + i;
-		rect.p0.y = pos->y + i;
-		rect.p1.x = pos->x + i + w;
-		rect.p1.y = pos->y + i + h;
-		rc = gfx_fill_rect(gc, &rect);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Paint minimize icon.
- *
- * @param resource UI resource
- * @param pos Center position
- * @param w Icon width
- * @param h Icon height
- * @return EOK on success or an error code
- */
-errno_t ui_paint_minicon(ui_resource_t *resource, gfx_coord2_t *pos,
-    gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = gfx_set_color(resource->gc, resource->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	rect.p0.x = pos->x - w / 2;
-	rect.p0.y = pos->y + h / 2 - 2;
-	rect.p1.x = rect.p0.x + w;
-	rect.p1.y = rect.p0.y + 2;
-	rc = gfx_fill_rect(resource->gc, &rect);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint maximize icon.
- *
- * @param resource UI resource
- * @param pos Center position
- * @param w Icon width
- * @param h Icon height
- * @return EOK on success or an error code
- */
-errno_t ui_paint_maxicon(ui_resource_t *resource, gfx_coord2_t *pos,
-    gfx_coord_t w, gfx_coord_t h)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = gfx_set_color(resource->gc, resource->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	rect.p0.x = pos->x - w / 2;
-	rect.p0.y = pos->y - h / 2;
-	rect.p1.x = rect.p0.x + w;
-	rect.p1.y = rect.p0.y + h;
-	rc = gfx_fill_rect(resource->gc, &rect);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_set_color(resource->gc, resource->btn_face_color);
-	if (rc != EOK)
-		return rc;
-
-	rect.p0.x += 1;
-	rect.p0.y += 2;
-	rect.p1.x -= 1;
-	rect.p1.y -= 1;
-	rc = gfx_fill_rect(resource->gc, &rect);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint unmaximize icon.
- *
- * Unmaximize icon consists of two overlapping window icons.
- *
- * @param resource UI resource
- * @param pos Center position
- * @param w Window icon width
- * @param h Window icon height
- * @param dw Horizontal distance between window icon centers
- * @param dh Vertical distance between window icon centers
- * @return EOK on success or an error code
- */
-errno_t ui_paint_unmaxicon(ui_resource_t *resource, gfx_coord2_t *pos,
-    gfx_coord_t w, gfx_coord_t h, gfx_coord_t dw, gfx_coord_t dh)
-{
-	gfx_coord2_t p;
-	errno_t rc;
-
-	p.x = pos->x + dw / 2;
-	p.y = pos->y - dh / 2;
-	rc = ui_paint_maxicon(resource, &p, w, h);
-	if (rc != EOK)
-		return rc;
-
-	p.x = pos->x - dw / 2;
-	p.y = pos->y + dh / 2;
-	rc = ui_paint_maxicon(resource, &p, w, h);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint a custom text box.
- *
- * Paint a text box using user-provided box chars.
- *
- * @param resource UI resource
- * @param rect Rectangle inside which to paint the box
- * @param style Box style
- * @param boxc Box characters
- * @param color Color
- * @return EOK on success or an error code
- */
-errno_t ui_paint_text_box_custom(ui_resource_t *resource, gfx_rect_t *rect,
-    ui_box_chars_t *boxc, gfx_color_t *color)
-{
-	errno_t rc;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t srect;
-	gfx_coord2_t pos;
-	gfx_coord2_t dim;
-	size_t bufsz;
-	size_t off;
-	int i;
-	gfx_coord_t y;
-	char *str = NULL;
-
-	gfx_rect_points_sort(rect, &srect);
-	gfx_rect_dims(&srect, &dim);
-
-	/* Is rectangle large enough to hold box? */
-	if (dim.x < 2 || dim.y < 2)
-		return EOK;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = resource->font;
-	fmt.color = color;
-
-	bufsz = str_size(boxc->c[0][0]) +
-	    str_size(boxc->c[0][1]) * (dim.x - 2) +
-	    str_size(boxc->c[0][2]) + 1;
-
-	str = malloc(bufsz);
-	if (str == NULL)
-		return ENOMEM;
-
-	/* Top edge and corners */
-
-	str_cpy(str, bufsz, boxc->c[0][0]);
-	off = str_size(boxc->c[0][0]);
-
-	for (i = 1; i < dim.x - 1; i++) {
-		str_cpy(str + off, bufsz - off, boxc->c[0][1]);
-		off += str_size(boxc->c[0][1]);
-	}
-
-	str_cpy(str + off, bufsz - off, boxc->c[0][2]);
-	off += str_size(boxc->c[0][2]);
-	str[off] = '\0';
-
-	pos = rect->p0;
-	rc = gfx_puttext(&pos, &fmt, str);
-	if (rc != EOK)
-		goto error;
-
-	/* Vertical edges */
-	for (y = rect->p0.y + 1; y < rect->p1.y - 1; y++) {
-		pos.y = y;
-
-		pos.x = rect->p0.x;
-		rc = gfx_puttext(&pos, &fmt, boxc->c[1][0]);
-		if (rc != EOK)
-			goto error;
-
-		pos.x = rect->p1.x - 1;
-		rc = gfx_puttext(&pos, &fmt, boxc->c[1][2]);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Bottom edge and corners */
-
-	str_cpy(str, bufsz, boxc->c[2][0]);
-	off = str_size(boxc->c[2][0]);
-
-	for (i = 1; i < dim.x - 1; i++) {
-		str_cpy(str + off, bufsz - off, boxc->c[2][1]);
-		off += str_size(boxc->c[2][1]);
-	}
-
-	str_cpy(str + off, bufsz - off, boxc->c[2][2]);
-	off += str_size(boxc->c[2][2]);
-	str[off] = '\0';
-
-	pos.x = rect->p0.x;
-	pos.y = rect->p1.y - 1;
-	rc = gfx_puttext(&pos, &fmt, str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	return EOK;
-error:
-	if (str != NULL)
-		free(str);
-	return rc;
-}
-
-/** Paint a text box.
- *
- * Paint a text box with the specified style.
- *
- * @param resource UI resource
- * @param rect Rectangle inside which to paint the box
- * @param style Box style
- * @param color Color
- * @return EOK on success or an error code
- */
-errno_t ui_paint_text_box(ui_resource_t *resource, gfx_rect_t *rect,
-    ui_box_style_t style, gfx_color_t *color)
-{
-	ui_box_chars_t *boxc = NULL;
-
-	switch (style) {
-	case ui_box_single:
-		boxc = &single_box_chars;
-		break;
-	case ui_box_double:
-		boxc = &double_box_chars;
-		break;
-	}
-
-	if (boxc == NULL)
-		return EINVAL;
-
-	return ui_paint_text_box_custom(resource, rect, boxc, color);
-}
-
-/** Paint a text horizontal brace.
- *
- * @param resource UI resource
- * @param rect Rectangle inside which to paint the brace (height should
- *             be 1).
- * @param style Box style
- * @param color Color
- * @return EOK on success or an error code
- */
-errno_t ui_paint_text_hbrace(ui_resource_t *resource, gfx_rect_t *rect,
-    ui_box_style_t style, gfx_color_t *color)
-{
-	errno_t rc;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t srect;
-	gfx_coord2_t pos;
-	gfx_coord2_t dim;
-	size_t bufsz;
-	size_t off;
-	int i;
-	char *str = NULL;
-	ui_brace_chars_t *hbc = NULL;
-
-	gfx_rect_points_sort(rect, &srect);
-	gfx_rect_dims(&srect, &dim);
-
-	/* Is rectangle large enough to hold brace? */
-	if (dim.x < 2 || dim.y < 1)
-		return EOK;
-
-	switch (style) {
-	case ui_box_single:
-		hbc = &single_hbrace_chars;
-		break;
-	case ui_box_double:
-		hbc = &double_hbrace_chars;
-		break;
-	}
-
-	if (hbc == NULL)
-		return EINVAL;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = resource->font;
-	fmt.color = color;
-
-	bufsz = str_size(hbc->start) +
-	    str_size(hbc->middle) * (dim.x - 2) +
-	    str_size(hbc->end) + 1;
-
-	str = malloc(bufsz);
-	if (str == NULL)
-		return ENOMEM;
-
-	str_cpy(str, bufsz, hbc->start);
-	off = str_size(hbc->start);
-
-	for (i = 1; i < dim.x - 1; i++) {
-		str_cpy(str + off, bufsz - off, hbc->middle);
-		off += str_size(hbc->middle);
-	}
-
-	str_cpy(str + off, bufsz - off, hbc->end);
-	off += str_size(hbc->end);
-	str[off] = '\0';
-
-	pos = rect->p0;
-	rc = gfx_puttext(&pos, &fmt, str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	return EOK;
-error:
-	if (str != NULL)
-		free(str);
-	return rc;
-}
-
-/** Fill rectangle with text character.
- *
- * @param resource UI resource
- * @param rect Rectangle
- * @param color Color
- * @param gchar Character to fill with
- * @return EOK on success or an error code
- */
-errno_t ui_paint_text_rect(ui_resource_t *resource, gfx_rect_t *rect,
-    gfx_color_t *color, const char *gchar)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t srect;
-	gfx_coord_t w, i;
-	char *buf;
-	size_t gcharsz;
-	errno_t rc;
-
-	gfx_rect_points_sort(rect, &srect);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = resource->font;
-	fmt.color = color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	w = srect.p1.x - srect.p0.x;
-	if (w == 0)
-		return EOK;
-
-	gcharsz = str_size(gchar);
-
-	buf = malloc(w * gcharsz + 1);
-	if (buf == NULL)
-		return ENOMEM;
-
-	for (i = 0; i < w; i++)
-		str_cpy(buf + i * gcharsz, (w - i) * gcharsz + 1, gchar);
-	buf[w * gcharsz] = '\0';
-
-	pos.x = srect.p0.x;
-	for (pos.y = srect.p0.y; pos.y < srect.p1.y; pos.y++) {
-		rc = gfx_puttext(&pos, &fmt, buf);
-		if (rc != EOK)
-			goto error;
-	}
-
-	free(buf);
-	return EOK;
-error:
-	free(buf);
-	return rc;
-}
-
-/** Initialize UI text formatting structure.
- *
- * UI text formatting structure must always be initialized using this function
- * first.
- *
- * @param fmt UI text formatting structure
- */
-void ui_text_fmt_init(ui_text_fmt_t *fmt)
-{
-	memset(fmt, 0, sizeof(ui_text_fmt_t));
-}
-
-/** Compute UI text width.
- *
- * @param font Font
- * @param str String
- * @return Text width
- */
-gfx_coord_t ui_text_width(gfx_font_t *font, const char *str)
-{
-	gfx_coord_t w;
-	gfx_coord_t tw;
-	const char *sp;
-
-	/* Text including tildes */
-	w = gfx_text_width(font, str);
-	tw = gfx_text_width(font, "~");
-
-	/* Subtract width of singular tildes */
-	sp = str;
-	while (*sp != '\0') {
-		if (*sp == '~' && sp[1] != '~')
-			w -= tw;
-		++sp;
-	}
-
-	return w;
-}
-
-/** Paint text (with highlighting markup).
- *
- * Paint some text with highlighted sections enclosed with tilde characters
- * ('~'). A literal tilde can be printed with "~~". Text can be highlighted
- * with an underline or different color, based on display capabilities.
- *
- * @param pos Anchor position
- * @param fmt Text formatting
- * @param str String containing '~' markup
- *
- * @return EOK on success or an error code
- */
-errno_t ui_paint_text(gfx_coord2_t *pos, ui_text_fmt_t *fmt, const char *str)
-{
-	gfx_coord2_t tpos;
-	gfx_text_fmt_t tfmt;
-	char *buf;
-	char *endptr;
-	const char *sp;
-	errno_t rc;
-
-	/* Break down string into list of (non)highlighted parts */
-	rc = ui_accel_process(str, &buf, &endptr);
-	if (rc != EOK)
-		return rc;
-
-	gfx_text_fmt_init(&tfmt);
-	tfmt.font = fmt->font;
-	tfmt.color = fmt->color;
-	tfmt.halign = fmt->halign;
-	tfmt.width = fmt->width;
-	tfmt.valign = fmt->valign;
-	tfmt.underline = false;
-
-	tpos = *pos;
-	sp = buf;
-	while (sp != endptr) {
-		/* Print the current string */
-		rc = gfx_puttext(&tpos, &tfmt, sp);
-		if (rc != EOK)
-			goto error;
-
-		gfx_text_cont(&tpos, &tfmt, sp, &tpos, &tfmt);
-		tfmt.underline = !tfmt.underline;
-		tfmt.color = tfmt.underline ? fmt->hgl_color : fmt->color;
-
-		/* Skip to the next string */
-		while (*sp != '\0')
-			++sp;
-		++sp;
-	}
-
-	free(buf);
-	return EOK;
-error:
-	free(buf);
-	return rc;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/pbutton.c
===================================================================
--- uspace/lib/ui/src/pbutton.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,683 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Push button
- *
- * Push button either uses text as decoration, or it can use a caller-provided
- * function to paint the decoration.
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/pbutton.h>
-#include "../private/pbutton.h"
-#include "../private/resource.h"
-
-/** Caption movement when button is pressed down */
-enum {
-	ui_pb_press_dx = 1,
-	ui_pb_press_dy = 1,
-	ui_pb_pad_x = 2,
-	ui_pb_pad_x_text = 1
-};
-
-static void ui_pbutton_ctl_destroy(void *);
-static errno_t ui_pbutton_ctl_paint(void *);
-static ui_evclaim_t ui_pbutton_ctl_pos_event(void *, pos_event_t *);
-
-/** Push button control ops */
-ui_control_ops_t ui_pbutton_ops = {
-	.destroy = ui_pbutton_ctl_destroy,
-	.paint = ui_pbutton_ctl_paint,
-	.pos_event = ui_pbutton_ctl_pos_event
-};
-
-/** Create new push button.
- *
- * @param resource UI resource
- * @param caption Caption
- * @param rpbutton Place to store pointer to new push button
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_pbutton_create(ui_resource_t *resource, const char *caption,
-    ui_pbutton_t **rpbutton)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	pbutton = calloc(1, sizeof(ui_pbutton_t));
-	if (pbutton == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_pbutton_ops, (void *) pbutton,
-	    &pbutton->control);
-	if (rc != EOK) {
-		free(pbutton);
-		return rc;
-	}
-
-	pbutton->caption = str_dup(caption);
-	if (pbutton->caption == NULL) {
-		ui_control_delete(pbutton->control);
-		free(pbutton);
-		return ENOMEM;
-	}
-
-	pbutton->res = resource;
-	*rpbutton = pbutton;
-	return EOK;
-}
-
-/** Destroy push button.
- *
- * @param pbutton Push button or @c NULL
- */
-void ui_pbutton_destroy(ui_pbutton_t *pbutton)
-{
-	if (pbutton == NULL)
-		return;
-
-	ui_control_delete(pbutton->control);
-	free(pbutton->caption);
-	free(pbutton);
-}
-
-/** Get base control from push button.
- *
- * @param pbutton Push button
- * @return Control
- */
-ui_control_t *ui_pbutton_ctl(ui_pbutton_t *pbutton)
-{
-	return pbutton->control;
-}
-
-/** Set push button callbacks.
- *
- * @param pbutton Push button
- * @param cb Push button callbacks
- * @param arg Callback argument
- */
-void ui_pbutton_set_cb(ui_pbutton_t *pbutton, ui_pbutton_cb_t *cb, void *arg)
-{
-	pbutton->cb = cb;
-	pbutton->arg = arg;
-}
-
-/** Set push button decoration ops.
- *
- * @param pbutton Push button
- * @param ops Push button decoration callbacks
- * @param arg Decoration ops argument
- */
-void ui_pbutton_set_decor_ops(ui_pbutton_t *pbutton,
-    ui_pbutton_decor_ops_t *ops, void *arg)
-{
-	pbutton->decor_ops = ops;
-	pbutton->decor_arg = arg;
-}
-
-/** Set push button flag.s
- *
- * @param pbutton Push button
- * @param flags Flags
- */
-void ui_pbutton_set_flags(ui_pbutton_t *pbutton, ui_pbutton_flags_t flags)
-{
-	pbutton->flags = flags;
-}
-
-/** Set button rectangle.
- *
- * @param pbutton Button
- * @param rect New button rectangle
- */
-void ui_pbutton_set_rect(ui_pbutton_t *pbutton, gfx_rect_t *rect)
-{
-	pbutton->rect = *rect;
-}
-
-/** Set default flag.
- *
- * Default button is the one activated by Enter key, it is marked
- * by thicker frame.
- *
- * @param pbutton Button
- * @param isdefault @c true iff button is default
- */
-void ui_pbutton_set_default(ui_pbutton_t *pbutton, bool isdefault)
-{
-	pbutton->isdefault = isdefault;
-}
-
-/** Get button light status.
- *
- * @param pbutton Button
- * @return @c true iff light is on
- */
-bool ui_pbutton_get_light(ui_pbutton_t *pbutton)
-{
-	return pbutton->light;
-}
-
-/** Turn button light on or off.
- *
- * @param pbutton Button
- * @param light @c true iff button should be lit
- */
-void ui_pbutton_set_light(ui_pbutton_t *pbutton, bool light)
-{
-	pbutton->light = light;
-}
-
-/** Set push button caption.
- *
- * @param pbutton Button
- * @param caption New caption
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_pbutton_set_caption(ui_pbutton_t *pbutton, const char *caption)
-{
-	char *dcaption;
-
-	dcaption = str_dup(caption);
-	if (dcaption == NULL)
-		return ENOMEM;
-
-	free(pbutton->caption);
-	pbutton->caption = dcaption;
-	return EOK;
-}
-
-/** Paint outer button frame.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_frame(ui_pbutton_t *pbutton)
-{
-	gfx_rect_t rect;
-	gfx_coord_t thickness;
-	errno_t rc;
-
-	thickness = pbutton->isdefault ? 2 : 1;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_frame_color);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pbutton->rect.p0.x + 1;
-	rect.p0.y = pbutton->rect.p0.y;
-	rect.p1.x = pbutton->rect.p1.x - 1;
-	rect.p1.y = pbutton->rect.p0.y + thickness;
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pbutton->rect.p0.x + 1;
-	rect.p0.y = pbutton->rect.p1.y - thickness;
-	rect.p1.x = pbutton->rect.p1.x - 1;
-	rect.p1.y = pbutton->rect.p1.y;
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pbutton->rect.p0.x;
-	rect.p0.y = pbutton->rect.p0.y + 1;
-	rect.p1.x = pbutton->rect.p0.x + thickness;
-	rect.p1.y = pbutton->rect.p1.y - 1;
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pbutton->rect.p1.x - thickness;
-	rect.p0.y = pbutton->rect.p0.y + 1;
-	rect.p1.x = pbutton->rect.p1.x;
-	rect.p1.y = pbutton->rect.p1.y - 1;
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint outset button bevel.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_outset(ui_pbutton_t *pbutton,
-    gfx_rect_t *rect)
-{
-	return ui_paint_bevel(pbutton->res->gc, rect,
-	    pbutton->res->btn_highlight_color,
-	    pbutton->res->btn_shadow_color, 2, NULL);
-}
-
-/** Paint inset button bevel.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_inset(ui_pbutton_t *pbutton,
-    gfx_rect_t *rect)
-{
-	return ui_paint_bevel(pbutton->res->gc, rect,
-	    pbutton->res->btn_shadow_color,
-	    pbutton->res->btn_face_color, 2, NULL);
-}
-
-/** Paint button text shadow.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_text_shadow(ui_pbutton_t *pbutton)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rect.p0.x = pbutton->rect.p0.x + 1;
-	rect.p0.y = pbutton->rect.p0.y + 1;
-	rect.p1.x = pbutton->rect.p1.x;
-	rect.p1.y = pbutton->rect.p1.y;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint push button in graphic mode.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_gfx(ui_pbutton_t *pbutton)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t rect;
-	gfx_rect_t irect;
-	gfx_coord_t thickness;
-	gfx_color_t *color;
-	bool depressed;
-	errno_t rc;
-
-	thickness = pbutton->isdefault ? 2 : 1;
-	depressed = pbutton->held && pbutton->inside;
-
-	rect.p0.x = pbutton->rect.p0.x + thickness;
-	rect.p0.y = pbutton->rect.p0.y + thickness;
-	rect.p1.x = pbutton->rect.p1.x - thickness;
-	rect.p1.y = pbutton->rect.p1.y - thickness;
-
-	color = pbutton->light ? pbutton->res->btn_face_lit_color :
-	    pbutton->res->btn_face_color;
-
-	rc = gfx_set_color(pbutton->res->gc, color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Center of button rectangle */
-	pos.x = (rect.p0.x + rect.p1.x) / 2;
-	pos.y = (rect.p0.y + rect.p1.y) / 2;
-
-	if (depressed) {
-		pos.x += ui_pb_press_dx;
-		pos.y += ui_pb_press_dy;
-	}
-
-	if (pbutton->decor_ops != NULL && pbutton->decor_ops->paint != NULL) {
-		/* Custom decoration */
-		rc = pbutton->decor_ops->paint(pbutton, pbutton->decor_arg,
-		    &pos);
-		if (rc != EOK)
-			goto error;
-	} else {
-		/* Text decoration */
-		ui_paint_get_inset_frame_inside(pbutton->res, &rect, &irect);
-		gfx_text_fmt_init(&fmt);
-		fmt.font = pbutton->res->font;
-		fmt.color = pbutton->res->btn_text_color;
-		fmt.halign = gfx_halign_center;
-		fmt.valign = gfx_valign_center;
-		fmt.abbreviate = true;
-		fmt.width = irect.p1.x - irect.p0.x - 2 * ui_pb_pad_x;
-
-		rc = gfx_puttext(&pos, &fmt, pbutton->caption);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = ui_pbutton_paint_frame(pbutton);
-	if (rc != EOK)
-		goto error;
-
-	if (depressed) {
-		rc = ui_pbutton_paint_inset(pbutton, &rect);
-		if (rc != EOK)
-			goto error;
-	} else {
-		rc = ui_pbutton_paint_outset(pbutton, &rect);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = gfx_update(pbutton->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint push button in text mode.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-static errno_t ui_pbutton_paint_text(ui_pbutton_t *pbutton)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	gfx_rect_t rect;
-	bool depressed;
-	errno_t rc;
-
-	if ((pbutton->flags & ui_pbf_no_text_depress) == 0)
-		depressed = pbutton->held && pbutton->inside;
-	else
-		depressed = false;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(pbutton->res->gc, &pbutton->rect);
-	if (rc != EOK)
-		goto error;
-
-	rect.p0.x = pbutton->rect.p0.x + (depressed ? 1 : 0);
-	rect.p0.y = pbutton->rect.p0.y;
-	rect.p1.x = pbutton->rect.p1.x - 1 + (depressed ? 1 : 0);
-	rect.p1.y = pbutton->rect.p0.y + 1;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(pbutton->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Center of button rectangle */
-	pos.x = (rect.p0.x + rect.p1.x) / 2;
-	pos.y = (rect.p0.y + rect.p1.y) / 2;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = pbutton->res->font;
-	fmt.color = pbutton->res->btn_text_color;
-	fmt.halign = gfx_halign_center;
-	fmt.valign = gfx_valign_center;
-	fmt.abbreviate = true;
-	fmt.width = rect.p1.x - rect.p0.x - 2 * ui_pb_pad_x_text;
-	if (fmt.width < 1)
-		fmt.width = 1;
-
-	rc = gfx_puttext(&pos, &fmt, pbutton->caption);
-	if (rc != EOK)
-		goto error;
-
-	if (!depressed) {
-		rc = ui_pbutton_paint_text_shadow(pbutton);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = gfx_update(pbutton->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint push button.
- *
- * @param pbutton Push button
- * @return EOK on success or an error code
- */
-errno_t ui_pbutton_paint(ui_pbutton_t *pbutton)
-{
-	if (pbutton->res->textmode)
-		return ui_pbutton_paint_text(pbutton);
-	else
-		return ui_pbutton_paint_gfx(pbutton);
-}
-
-/** Press down button.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_press(ui_pbutton_t *pbutton)
-{
-	if (pbutton->held)
-		return;
-
-	pbutton->inside = true;
-	pbutton->held = true;
-	(void) ui_pbutton_paint(pbutton);
-	ui_pbutton_down(pbutton);
-}
-
-/** Release button.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_release(ui_pbutton_t *pbutton)
-{
-	if (!pbutton->held)
-		return;
-
-	pbutton->held = false;
-	ui_pbutton_up(pbutton);
-
-	if (pbutton->inside) {
-		(void) ui_pbutton_paint(pbutton);
-		ui_pbutton_clicked(pbutton);
-	}
-}
-
-/** Pointer entered button.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_enter(ui_pbutton_t *pbutton)
-{
-	if (pbutton->inside)
-		return;
-
-	pbutton->inside = true;
-	if (pbutton->held)
-		(void) ui_pbutton_paint(pbutton);
-}
-
-/** Pointer left button.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_leave(ui_pbutton_t *pbutton)
-{
-	if (!pbutton->inside)
-		return;
-
-	pbutton->inside = false;
-	if (pbutton->held)
-		(void) ui_pbutton_paint(pbutton);
-}
-
-/** Send button clicked event.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_clicked(ui_pbutton_t *pbutton)
-{
-	if (pbutton->cb != NULL && pbutton->cb->clicked != NULL)
-		pbutton->cb->clicked(pbutton, pbutton->arg);
-}
-
-/** Send button down event.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_down(ui_pbutton_t *pbutton)
-{
-	if (pbutton->cb != NULL && pbutton->cb->down != NULL)
-		pbutton->cb->down(pbutton, pbutton->arg);
-}
-
-/** Send button up event.
- *
- * @param pbutton Push button
- */
-void ui_pbutton_up(ui_pbutton_t *pbutton)
-{
-	if (pbutton->cb != NULL && pbutton->cb->up != NULL)
-		pbutton->cb->up(pbutton, pbutton->arg);
-}
-
-/** Handle push button position event.
- *
- * @param pbutton Push button
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_pbutton_pos_event(ui_pbutton_t *pbutton, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	bool inside;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	inside = gfx_pix_inside_rect(&pos, &pbutton->rect);
-
-	switch (event->type) {
-	case POS_PRESS:
-		if (inside) {
-			ui_pbutton_press(pbutton);
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (pbutton->held) {
-			ui_pbutton_release(pbutton);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		if (inside && !pbutton->inside) {
-			ui_pbutton_enter(pbutton);
-			return ui_claimed;
-		} else if (!inside && pbutton->inside) {
-			ui_pbutton_leave(pbutton);
-		}
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Destroy push button control.
- *
- * @param arg Argument (ui_pbutton_t *)
- */
-void ui_pbutton_ctl_destroy(void *arg)
-{
-	ui_pbutton_t *pbutton = (ui_pbutton_t *) arg;
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Paint push button control.
- *
- * @param arg Argument (ui_pbutton_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_pbutton_ctl_paint(void *arg)
-{
-	ui_pbutton_t *pbutton = (ui_pbutton_t *) arg;
-
-	return ui_pbutton_paint(pbutton);
-}
-
-/** Handle push button control position event.
- *
- * @param arg Argument (ui_pbutton_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_pbutton_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_pbutton_t *pbutton = (ui_pbutton_t *) arg;
-
-	return ui_pbutton_pos_event(pbutton, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/popup.c
===================================================================
--- uspace/lib/ui/src/popup.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,252 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Popup window
- */
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <ui/control.h>
-#include <ui/popup.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/popup.h"
-
-static void ui_popup_window_close(ui_window_t *, void *);
-static void ui_popup_window_kbd(ui_window_t *, void *, kbd_event_t *);
-static void ui_popup_window_pos(ui_window_t *, void *, pos_event_t *);
-
-static ui_window_cb_t ui_popup_window_cb = {
-	.close = ui_popup_window_close,
-	.kbd = ui_popup_window_kbd,
-	.pos = ui_popup_window_pos
-};
-
-/** Initialize popup parameters structure.
- *
- * Popup parameters structure must always be initialized using this function
- * first.
- *
- * @param params Popup parameters structure
- */
-void ui_popup_params_init(ui_popup_params_t *params)
-{
-	memset(params, 0, sizeof(ui_popup_params_t));
-}
-
-/** Create new popup window.
- *
- * @param ui User interface
- * @param parent Parent window
- * @param params Popup parameters
- * @param rpopup Place to store pointer to new popup window
- * @return EOK on success or an error code
- */
-errno_t ui_popup_create(ui_t *ui, ui_window_t *parent,
-    ui_popup_params_t *params, ui_popup_t **rpopup)
-{
-	ui_popup_t *popup;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t wparams;
-	gfx_coord2_t parent_pos;
-	errno_t rc;
-
-	popup = calloc(1, sizeof(ui_popup_t));
-	if (popup == NULL)
-		return ENOMEM;
-
-	rc = ui_window_get_pos(parent, &parent_pos);
-	if (rc != EOK)
-		goto error;
-
-	ui_wnd_params_init(&wparams);
-	wparams.rect = params->rect;
-	wparams.caption = "";
-	wparams.style &= ~ui_wds_decorated;
-	wparams.placement = ui_wnd_place_popup;
-	wparams.flags |= ui_wndf_popup | ui_wndf_topmost;
-	wparams.idev_id = params->idev_id;
-
-	/* Compute position of parent rectangle relative to the screen */
-	gfx_rect_translate(&parent_pos, &params->place, &wparams.prect);
-
-	rc = ui_window_create(ui, &wparams, &window);
-	if (rc != EOK)
-		goto error;
-
-	popup->ui = ui;
-	popup->parent = parent;
-	popup->window = window;
-
-	ui_window_set_cb(window, &ui_popup_window_cb, popup);
-
-	*rpopup = popup;
-	return EOK;
-error:
-	free(popup);
-	return rc;
-}
-
-/** Destroy popup window.
- *
- * @param popup Popup window or @c NULL
- */
-void ui_popup_destroy(ui_popup_t *popup)
-{
-	if (popup == NULL)
-		return;
-
-	ui_window_destroy(popup->window);
-	free(popup);
-}
-
-/** Add control to popup window.
- *
- * Only one control can be added to a popup window. If more than one control
- * is added, the results are undefined.
- *
- * @param popup Popup window
- * @param control Control
- * @return EOK on success, ENOMEM if out of memory
- */
-void ui_popup_add(ui_popup_t *popup, ui_control_t *control)
-{
-	ui_window_add(popup->window, control);
-}
-
-/** Remove control from popup window.
- *
- * @param popup Popup window
- * @param control Control
- */
-void ui_popup_remove(ui_popup_t *popup, ui_control_t *control)
-{
-	ui_window_remove(popup->window, control);
-}
-
-/** Set popup window callbacks.
- *
- * @param popup Popup window
- * @param cb Popup window callbacks
- * @param arg Callback argument
- */
-void ui_popup_set_cb(ui_popup_t *popup, ui_popup_cb_t *cb, void *arg)
-{
-	popup->cb = cb;
-	popup->arg = arg;
-}
-
-/** Get UI resource from popup window.
- *
- * @param window Window
- * @return UI resource
- */
-ui_resource_t *ui_popup_get_res(ui_popup_t *popup)
-{
-	return ui_window_get_res(popup->window);
-}
-
-/** Get popup window GC.
- *
- * @param popup Popup window
- * @return GC (relative to popup window)
- */
-gfx_context_t *ui_popup_get_gc(ui_popup_t *popup)
-{
-	return ui_window_get_gc(popup->window);
-}
-
-/** Get ID of device that sent the last position event.
- *
- * @param popup Popup window
- * @return Input device ID
- */
-sysarg_t ui_popup_get_idev_id(ui_popup_t *popup)
-{
-	return popup->idev_id;
-}
-
-/** Handle close event in popup window.
- *
- * @param window Window
- * @param arg Argument (ui_popup_t *)
- */
-static void ui_popup_window_close(ui_window_t *window, void *arg)
-{
-	ui_popup_t *popup = (ui_popup_t *)arg;
-
-	if (popup->cb != NULL && popup->cb->close != NULL)
-		popup->cb->close(popup, popup->arg);
-}
-
-/** Handle keyboard event in popup window.
- *
- * @param window Window
- * @param arg Argument (ui_popup_t *)
- * @param event Keyboard event
- */
-static void ui_popup_window_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	ui_popup_t *popup = (ui_popup_t *)arg;
-
-	/* Remember ID of device that sent the last event */
-	popup->idev_id = event->kbd_id;
-
-	if (popup->cb != NULL && popup->cb->kbd != NULL)
-		popup->cb->kbd(popup, popup->arg, event);
-}
-
-/** Handle position event in popup window.
- *
- * @param window Window
- * @param arg Argument (ui_popup_t *)
- * @param event Position event
- */
-static void ui_popup_window_pos(ui_window_t *window, void *arg,
-    pos_event_t *event)
-{
-	ui_popup_t *popup = (ui_popup_t *)arg;
-
-	/* Remember ID of device that sent the last event */
-	popup->idev_id = event->pos_id;
-
-	if (popup->cb != NULL && popup->cb->pos != NULL)
-		popup->cb->pos(popup, popup->arg, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/promptdialog.c
===================================================================
--- uspace/lib/ui/src/promptdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,382 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Prompt dialog
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <ui/entry.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/promptdialog.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/promptdialog.h"
-
-static void ui_prompt_dialog_wnd_close(ui_window_t *, void *);
-static void ui_prompt_dialog_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-ui_window_cb_t ui_prompt_dialog_wnd_cb = {
-	.close = ui_prompt_dialog_wnd_close,
-	.kbd = ui_prompt_dialog_wnd_kbd
-};
-
-static void ui_prompt_dialog_bok_clicked(ui_pbutton_t *, void *);
-static void ui_prompt_dialog_bcancel_clicked(ui_pbutton_t *, void *);
-
-ui_pbutton_cb_t ui_prompt_dialog_bok_cb = {
-	.clicked = ui_prompt_dialog_bok_clicked
-};
-
-ui_pbutton_cb_t ui_prompt_dialog_bcancel_cb = {
-	.clicked = ui_prompt_dialog_bcancel_clicked
-};
-
-/** Initialize prompt dialog parameters structure.
- *
- * Prompt dialog parameters structure must always be initialized using
- * this function first.
- *
- * @param params Prompt dialog parameters structure
- */
-void ui_prompt_dialog_params_init(ui_prompt_dialog_params_t *params)
-{
-	memset(params, 0, sizeof(ui_prompt_dialog_params_t));
-	params->itext = "";
-}
-
-/** Create new prompt dialog.
- *
- * @param ui User interface
- * @param params Prompt dialog parameters
- * @param rdialog Place to store pointer to new dialog
- * @return EOK on success or an error code
- */
-errno_t ui_prompt_dialog_create(ui_t *ui, ui_prompt_dialog_params_t *params,
-    ui_prompt_dialog_t **rdialog)
-{
-	errno_t rc;
-	ui_prompt_dialog_t *dialog;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t wparams;
-	ui_fixed_t *fixed = NULL;
-	ui_label_t *label = NULL;
-	ui_entry_t *entry = NULL;
-	ui_pbutton_t *bok = NULL;
-	ui_pbutton_t *bcancel = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-
-	dialog = calloc(1, sizeof(ui_prompt_dialog_t));
-	if (dialog == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = params->caption;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 40;
-		wparams.rect.p1.y = 9;
-	} else {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 300;
-		wparams.rect.p1.y = 135;
-	}
-
-	rc = ui_window_create(ui, &wparams, &window);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_set_cb(window, &ui_prompt_dialog_wnd_cb, dialog);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_label_create(ui_res, params->prompt, &label);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 2;
-		rect.p1.x = 17;
-		rect.p1.y = 3;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 35;
-		rect.p1.x = 190;
-		rect.p1.y = 50;
-	}
-
-	ui_label_set_rect(label, &rect);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(label));
-	if (rc != EOK)
-		goto error;
-
-	label = NULL;
-
-	rc = ui_entry_create(window, params->itext, &entry);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 4;
-		rect.p1.x = 37;
-		rect.p1.y = 5;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 55;
-		rect.p1.x = 290;
-		rect.p1.y = 80;
-	}
-
-	ui_entry_set_rect(entry, &rect);
-
-	rc = ui_fixed_add(fixed, ui_entry_ctl(entry));
-	if (rc != EOK)
-		goto error;
-
-	ui_entry_activate(entry);
-
-	/* Select all */
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_end(entry, true);
-
-	dialog->ename = entry;
-	entry = NULL;
-
-	rc = ui_pbutton_create(ui_res, "OK", &bok);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bok, &ui_prompt_dialog_bok_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 10;
-		rect.p0.y = 6;
-		rect.p1.x = 20;
-		rect.p1.y = 7;
-	} else {
-		rect.p0.x = 55;
-		rect.p0.y = 90;
-		rect.p1.x = 145;
-		rect.p1.y = 118;
-	}
-
-	ui_pbutton_set_rect(bok, &rect);
-
-	ui_pbutton_set_default(bok, true);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bok));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bok = bok;
-	bok = NULL;
-
-	rc = ui_pbutton_create(ui_res, "Cancel", &bcancel);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bcancel, &ui_prompt_dialog_bcancel_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 22;
-		rect.p0.y = 6;
-		rect.p1.x = 32;
-		rect.p1.y = 7;
-	} else {
-		rect.p0.x = 155;
-		rect.p0.y = 90;
-		rect.p1.x = 245;
-		rect.p1.y = 118;
-	}
-
-	ui_pbutton_set_rect(bcancel, &rect);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bcancel));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bcancel = bcancel;
-	bcancel = NULL;
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK)
-		goto error;
-
-	dialog->window = window;
-	*rdialog = dialog;
-	return EOK;
-error:
-	if (entry != NULL)
-		ui_entry_destroy(entry);
-	if (bok != NULL)
-		ui_pbutton_destroy(bok);
-	if (bcancel != NULL)
-		ui_pbutton_destroy(bcancel);
-	if (label != NULL)
-		ui_label_destroy(label);
-	if (fixed != NULL)
-		ui_fixed_destroy(fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (dialog != NULL)
-		free(dialog);
-	return rc;
-}
-
-/** Destroy prompt dialog.
- *
- * @param dialog Prompt dialog or @c NULL
- */
-void ui_prompt_dialog_destroy(ui_prompt_dialog_t *dialog)
-{
-	if (dialog == NULL)
-		return;
-
-	ui_window_destroy(dialog->window);
-	free(dialog);
-}
-
-/** Set mesage dialog callback.
- *
- * @param dialog Prompt dialog
- * @param cb Prompt dialog callbacks
- * @param arg Callback argument
- */
-void ui_prompt_dialog_set_cb(ui_prompt_dialog_t *dialog, ui_prompt_dialog_cb_t *cb,
-    void *arg)
-{
-	dialog->cb = cb;
-	dialog->arg = arg;
-}
-
-/** Prompt dialog window close handler.
- *
- * @param window Window
- * @param arg Argument (ui_prompt_dialog_t *)
- */
-static void ui_prompt_dialog_wnd_close(ui_window_t *window, void *arg)
-{
-	ui_prompt_dialog_t *dialog = (ui_prompt_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->close != NULL)
-		dialog->cb->close(dialog, dialog->arg);
-}
-
-/** Prompt dialog window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (ui_prompt_dialog_t *)
- * @param event Keyboard event
- */
-static void ui_prompt_dialog_wnd_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	ui_prompt_dialog_t *dialog = (ui_prompt_dialog_t *) arg;
-	const char *text;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_SHIFT | KM_ALT)) == 0) {
-		if (event->key == KC_ENTER) {
-			/* Confirm */
-			if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-				text = ui_entry_get_text(dialog->ename);
-				dialog->cb->bok(dialog, dialog->arg, text);
-				return;
-			}
-		} else if (event->key == KC_ESCAPE) {
-			/* Cancel */
-			if (dialog->cb != NULL && dialog->cb->bcancel != NULL) {
-				dialog->cb->bcancel(dialog, dialog->arg);
-				return;
-			}
-		}
-	}
-
-	ui_window_def_kbd(window, event);
-}
-
-/** Prompt dialog OK button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_prompt_dialog_t *)
- */
-static void ui_prompt_dialog_bok_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_prompt_dialog_t *dialog = (ui_prompt_dialog_t *) arg;
-	const char *text;
-
-	if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-		text = ui_entry_get_text(dialog->ename);
-		dialog->cb->bok(dialog, dialog->arg, text);
-	}
-}
-
-/** Prompt dialog cancel button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_prompt_dialog_t *)
- */
-static void ui_prompt_dialog_bcancel_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_prompt_dialog_t *dialog = (ui_prompt_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->bcancel != NULL)
-		dialog->cb->bcancel(dialog, dialog->arg);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/rbutton.c
===================================================================
--- uspace/lib/ui/src/rbutton.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,536 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Radio button
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/rbutton.h>
-#include "../private/rbutton.h"
-#include "../private/resource.h"
-
-enum {
-	rbutton_oframe_r = 7,
-	rbutton_iframe_r = 6,
-	rbutton_interior_r = 5,
-	rbutton_indicator_r = 3,
-	rbutton_label_margin = 8
-};
-
-static void ui_rbutton_ctl_destroy(void *);
-static errno_t ui_rbutton_ctl_paint(void *);
-static ui_evclaim_t ui_rbutton_ctl_pos_event(void *, pos_event_t *);
-
-/** Radio button control ops */
-ui_control_ops_t ui_rbutton_ops = {
-	.destroy = ui_rbutton_ctl_destroy,
-	.paint = ui_rbutton_ctl_paint,
-	.pos_event = ui_rbutton_ctl_pos_event
-};
-
-/** Create new radio button group.
- *
- * @param res UI resource
- * @param rgroup Place to store pointer to new radio button group
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_rbutton_group_create(ui_resource_t *res, ui_rbutton_group_t **rgroup)
-{
-	ui_rbutton_group_t *group;
-
-	group = calloc(1, sizeof(ui_rbutton_group_t));
-	if (group == NULL)
-		return ENOMEM;
-
-	group->res = res;
-	*rgroup = group;
-	return EOK;
-}
-
-/** Destroy radio button group.
- *
- * @param group Radio button group or @c NULL
- */
-void ui_rbutton_group_destroy(ui_rbutton_group_t *group)
-{
-	if (group == NULL)
-		return;
-
-	free(group);
-}
-
-/** Create new radio button.
- *
- * @param group Radio button group
- * @param caption Caption
- * @param arg Callback argument
- * @param rrbutton Place to store pointer to new radio button
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_rbutton_create(ui_rbutton_group_t *group, const char *caption,
-    void *arg, ui_rbutton_t **rrbutton)
-{
-	ui_rbutton_t *rbutton;
-	errno_t rc;
-
-	rbutton = calloc(1, sizeof(ui_rbutton_t));
-	if (rbutton == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_rbutton_ops, (void *) rbutton,
-	    &rbutton->control);
-	if (rc != EOK) {
-		free(rbutton);
-		return rc;
-	}
-
-	rbutton->caption = str_dup(caption);
-	if (rbutton->caption == NULL) {
-		ui_control_delete(rbutton->control);
-		free(rbutton);
-		return ENOMEM;
-	}
-
-	rbutton->group = group;
-	rbutton->arg = arg;
-
-	if (group->selected == NULL)
-		group->selected = rbutton;
-
-	*rrbutton = rbutton;
-	return EOK;
-}
-
-/** Destroy radio button.
- *
- * @param rbutton Radio button or @c NULL
- */
-void ui_rbutton_destroy(ui_rbutton_t *rbutton)
-{
-	if (rbutton == NULL)
-		return;
-
-	ui_control_delete(rbutton->control);
-	free(rbutton);
-}
-
-/** Get base control from radio button.
- *
- * @param rbutton Radio button
- * @return Control
- */
-ui_control_t *ui_rbutton_ctl(ui_rbutton_t *rbutton)
-{
-	return rbutton->control;
-}
-
-/** Set radio button group callbacks.
- *
- * @param group Radio button group
- * @param cb Radio button group callbacks
- * @param arg Callback argument
- */
-void ui_rbutton_group_set_cb(ui_rbutton_group_t *group,
-    ui_rbutton_group_cb_t *cb, void *arg)
-{
-	group->cb = cb;
-	group->arg = arg;
-}
-
-/** Set button rectangle.
- *
- * @param rbutton Button
- * @param rect New button rectangle
- */
-void ui_rbutton_set_rect(ui_rbutton_t *rbutton, gfx_rect_t *rect)
-{
-	rbutton->rect = *rect;
-}
-
-/** Paint radio button in graphics mode.
- *
- * @param rbutton Radio button
- * @return EOK on success or an error code
- */
-errno_t ui_rbutton_paint_gfx(ui_rbutton_t *rbutton)
-{
-	gfx_coord2_t pos;
-	gfx_coord2_t center;
-	gfx_text_fmt_t fmt;
-	bool depressed;
-	errno_t rc;
-
-	center.x = rbutton->rect.p0.x + rbutton_oframe_r;
-	center.y = rbutton->rect.p0.y + rbutton_oframe_r;
-
-	/* Paint radio button frame */
-
-	rc = gfx_set_color(rbutton->group->res->gc,
-	    rbutton->group->res->wnd_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_filled_circle(rbutton->group->res->gc,
-	    &center, rbutton_oframe_r, ui_fcircle_upleft);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(rbutton->group->res->gc,
-	    rbutton->group->res->wnd_highlight_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_filled_circle(rbutton->group->res->gc,
-	    &center, rbutton_oframe_r, ui_fcircle_lowright);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(rbutton->group->res->gc,
-	    rbutton->group->res->wnd_frame_sh_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_filled_circle(rbutton->group->res->gc,
-	    &center, rbutton_iframe_r, ui_fcircle_upleft);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(rbutton->group->res->gc,
-	    rbutton->group->res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_filled_circle(rbutton->group->res->gc,
-	    &center, rbutton_iframe_r, ui_fcircle_lowright);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint radio button interior */
-	depressed = rbutton->held && rbutton->inside;
-
-	rc = gfx_set_color(rbutton->group->res->gc, depressed ?
-	    rbutton->group->res->entry_act_bg_color :
-	    rbutton->group->res->entry_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_paint_filled_circle(rbutton->group->res->gc,
-	    &center, rbutton_interior_r, ui_fcircle_entire);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint active mark */
-
-	if (rbutton->group->selected == rbutton) {
-		rc = gfx_set_color(rbutton->group->res->gc,
-		    rbutton->group->res->entry_fg_color);
-		if (rc != EOK)
-			goto error;
-
-		rc = ui_paint_filled_circle(rbutton->group->res->gc,
-		    &center, rbutton_indicator_r, ui_fcircle_entire);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Paint rbutton label */
-
-	pos.x = center.x + rbutton_oframe_r + rbutton_label_margin;
-	pos.y = center.y;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = rbutton->group->res->font;
-	fmt.color = rbutton->group->res->wnd_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_center;
-
-	rc = gfx_puttext(&pos, &fmt, rbutton->caption);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(rbutton->group->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint radio button in text mode.
- *
- * @param rbutton Radio button
- * @return EOK on success or an error code
- */
-errno_t ui_rbutton_paint_text(ui_rbutton_t *rbutton)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	bool depressed;
-	errno_t rc;
-
-	/* Paint radio button */
-
-	depressed = rbutton->held && rbutton->inside;
-
-	pos.x = rbutton->rect.p0.x;
-	pos.y = rbutton->rect.p0.y;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = rbutton->group->res->font;
-	fmt.color = depressed ? rbutton->group->res->entry_act_bg_color :
-	    rbutton->group->res->wnd_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	rc = gfx_puttext(&pos, &fmt, rbutton->group->selected == rbutton ?
-	    "(\u2022)" : "( )");
-	if (rc != EOK)
-		goto error;
-
-	/* Paint radio button label */
-
-	pos.x += 4;
-
-	fmt.color = rbutton->group->res->wnd_text_color;
-
-	rc = gfx_puttext(&pos, &fmt, rbutton->caption);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(rbutton->group->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint radio button.
- *
- * @param rbutton Radio button
- * @return EOK on success or an error code
- */
-errno_t ui_rbutton_paint(ui_rbutton_t *rbutton)
-{
-	if (rbutton->group->res->textmode)
-		return ui_rbutton_paint_text(rbutton);
-	else
-		return ui_rbutton_paint_gfx(rbutton);
-}
-
-/** Press down button.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_press(ui_rbutton_t *rbutton)
-{
-	if (rbutton->held)
-		return;
-
-	rbutton->inside = true;
-	rbutton->held = true;
-	(void) ui_rbutton_paint(rbutton);
-}
-
-/** Release button.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_release(ui_rbutton_t *rbutton)
-{
-	if (!rbutton->held)
-		return;
-
-	rbutton->held = false;
-
-	if (rbutton->inside) {
-		/* Activate radio button */
-		ui_rbutton_select(rbutton);
-	}
-}
-
-/** Pointer entered button.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_enter(ui_rbutton_t *rbutton)
-{
-	if (rbutton->inside)
-		return;
-
-	rbutton->inside = true;
-	if (rbutton->held)
-		(void) ui_rbutton_paint(rbutton);
-}
-
-/** Pointer left button.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_leave(ui_rbutton_t *rbutton)
-{
-	if (!rbutton->inside)
-		return;
-
-	rbutton->inside = false;
-	if (rbutton->held)
-		(void) ui_rbutton_paint(rbutton);
-}
-
-/** Select radio button.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_select(ui_rbutton_t *rbutton)
-{
-	ui_rbutton_t *old_selected;
-
-	old_selected = rbutton->group->selected;
-
-	if (old_selected != rbutton) {
-		rbutton->group->selected = rbutton;
-		ui_rbutton_paint(old_selected);
-	}
-
-	/* Repaint and notify */
-	(void) ui_rbutton_paint(rbutton);
-
-	if (old_selected != rbutton)
-		ui_rbutton_selected(rbutton);
-}
-
-/** Notify that button was selected.
- *
- * @param rbutton Radio button
- */
-void ui_rbutton_selected(ui_rbutton_t *rbutton)
-{
-	ui_rbutton_group_t *group = rbutton->group;
-
-	if (group->cb != NULL && group->cb->selected != NULL) {
-		group->cb->selected(group, group->arg, rbutton->arg);
-	}
-}
-
-/** Handle radio button position event.
- *
- * @param rbutton Radio button
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_rbutton_pos_event(ui_rbutton_t *rbutton, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	bool inside;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	inside = gfx_pix_inside_rect(&pos, &rbutton->rect);
-
-	switch (event->type) {
-	case POS_PRESS:
-		if (inside) {
-			ui_rbutton_press(rbutton);
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (rbutton->held) {
-			ui_rbutton_release(rbutton);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		if (inside && !rbutton->inside) {
-			ui_rbutton_enter(rbutton);
-			return ui_claimed;
-		} else if (!inside && rbutton->inside) {
-			ui_rbutton_leave(rbutton);
-		}
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Destroy radio button control.
- *
- * @param arg Argument (ui_rbutton_t *)
- */
-void ui_rbutton_ctl_destroy(void *arg)
-{
-	ui_rbutton_t *rbutton = (ui_rbutton_t *) arg;
-
-	ui_rbutton_destroy(rbutton);
-}
-
-/** Paint radio button control.
- *
- * @param arg Argument (ui_rbutton_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_rbutton_ctl_paint(void *arg)
-{
-	ui_rbutton_t *rbutton = (ui_rbutton_t *) arg;
-
-	return ui_rbutton_paint(rbutton);
-}
-
-/** Handle radio button control position event.
- *
- * @param arg Argument (ui_rbutton_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_rbutton_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_rbutton_t *rbutton = (ui_rbutton_t *) arg;
-
-	return ui_rbutton_pos_event(rbutton, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/resource.c
===================================================================
--- uspace/lib/ui/src/resource.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,744 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file UI resources
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/font.h>
-#include <gfx/render.h>
-#include <gfx/typeface.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/resource.h>
-#include "../private/resource.h"
-
-static const char *ui_typeface_path = "/data/font/helena.tpf";
-
-/** Create new UI resource in graphics mode.
- *
- * @param gc Graphic context
- * @param rresource Place to store pointer to new UI resource
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t ui_resource_create_gfx(gfx_context_t *gc,
-    ui_resource_t **rresource)
-{
-	ui_resource_t *resource;
-	gfx_typeface_t *tface = NULL;
-	gfx_font_t *font = NULL;
-	gfx_font_info_t *finfo;
-	gfx_color_t *btn_frame_color = NULL;
-	gfx_color_t *btn_face_color = NULL;
-	gfx_color_t *btn_face_lit_color = NULL;
-	gfx_color_t *btn_text_color = NULL;
-	gfx_color_t *btn_highlight_color = NULL;
-	gfx_color_t *btn_shadow_color = NULL;
-	gfx_color_t *wnd_face_color = NULL;
-	gfx_color_t *wnd_text_color = NULL;
-	gfx_color_t *wnd_dis_text_color = NULL;
-	gfx_color_t *wnd_text_hgl_color = NULL;
-	gfx_color_t *wnd_sel_text_color = NULL;
-	gfx_color_t *wnd_sel_text_hgl_color = NULL;
-	gfx_color_t *wnd_sel_text_bg_color = NULL;
-	gfx_color_t *wnd_frame_hi_color = NULL;
-	gfx_color_t *wnd_frame_sh_color = NULL;
-	gfx_color_t *wnd_highlight_color = NULL;
-	gfx_color_t *wnd_shadow_color = NULL;
-	gfx_color_t *tbar_act_bg_color = NULL;
-	gfx_color_t *tbar_inact_bg_color = NULL;
-	gfx_color_t *tbar_act_text_color = NULL;
-	gfx_color_t *tbar_inact_text_color = NULL;
-	gfx_color_t *entry_fg_color = NULL;
-	gfx_color_t *entry_bg_color = NULL;
-	gfx_color_t *entry_act_bg_color = NULL;
-	gfx_color_t *entry_sel_text_fg_color = NULL;
-	gfx_color_t *entry_sel_text_bg_color = NULL;
-	gfx_color_t *sbar_trough_color = NULL;
-	gfx_color_t *sbar_act_trough_color = NULL;
-	errno_t rc;
-
-	resource = calloc(1, sizeof(ui_resource_t));
-	if (resource == NULL)
-		return ENOMEM;
-
-	rc = gfx_typeface_open(gc, ui_typeface_path, &tface);
-	if (rc != EOK)
-		goto error;
-
-	finfo = gfx_typeface_first_font(tface);
-	if (finfo == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = gfx_font_open(finfo, &font);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &btn_frame_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xc8c8, 0xc8c8, 0xc8c8, &btn_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xe8e8, 0xe8e8, 0xe8e8, &btn_face_lit_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &btn_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-	    &btn_highlight_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x8888, 0x8888, 0x8888, &btn_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xc8c8, 0xc8c8, 0xc8c8, &wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &wnd_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x9696, 0x9696, 0x9696, &wnd_dis_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &wnd_text_hgl_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &wnd_sel_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-	    &wnd_sel_text_hgl_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x5858, 0x6a6a, 0xc4c4,
-	    &wnd_sel_text_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x8888, 0x8888, 0x8888, &wnd_frame_hi_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x4444, 0x4444, 0x4444, &wnd_frame_sh_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-	    &wnd_highlight_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x8888, 0x8888, 0x8888, &wnd_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x5858, 0x6a6a, 0xc4c4, &tbar_act_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-	    &tbar_act_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xdddd, 0xdddd, 0xdddd,
-	    &tbar_inact_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x5858, 0x5858, 0x5858,
-	    &tbar_inact_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0, &entry_fg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &entry_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xc8c8, 0xc8c8, 0xc8c8, &entry_act_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
-	    &entry_sel_text_fg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0, 0, 0xffff, &entry_sel_text_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0xe4e4, 0xe4e4, 0xe4e4,
-	    &sbar_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_rgb_i16(0x5858, 0x5858, 0x5858,
-	    &sbar_act_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	resource->gc = gc;
-	resource->tface = tface;
-	resource->font = font;
-	resource->textmode = false;
-
-	resource->btn_frame_color = btn_frame_color;
-	resource->btn_face_color = btn_face_color;
-	resource->btn_face_lit_color = btn_face_lit_color;
-	resource->btn_text_color = btn_text_color;
-	resource->btn_highlight_color = btn_highlight_color;
-	resource->btn_shadow_color = btn_shadow_color;
-
-	resource->wnd_face_color = wnd_face_color;
-	resource->wnd_text_color = wnd_text_color;
-	resource->wnd_dis_text_color = wnd_dis_text_color;
-	resource->wnd_text_hgl_color = wnd_text_hgl_color;
-	resource->wnd_sel_text_color = wnd_sel_text_color;
-	resource->wnd_sel_text_hgl_color = wnd_sel_text_hgl_color;
-	resource->wnd_sel_text_bg_color = wnd_sel_text_bg_color;
-	resource->wnd_frame_hi_color = wnd_frame_hi_color;
-	resource->wnd_frame_sh_color = wnd_frame_sh_color;
-	resource->wnd_highlight_color = wnd_highlight_color;
-	resource->wnd_shadow_color = wnd_shadow_color;
-
-	resource->tbar_act_bg_color = tbar_act_bg_color;
-	resource->tbar_act_text_color = tbar_act_text_color;
-	resource->tbar_inact_bg_color = tbar_inact_bg_color;
-	resource->tbar_inact_text_color = tbar_inact_text_color;
-
-	resource->entry_fg_color = entry_fg_color;
-	resource->entry_bg_color = entry_bg_color;
-	resource->entry_act_bg_color = entry_act_bg_color;
-	resource->entry_sel_text_fg_color = entry_sel_text_fg_color;
-	resource->entry_sel_text_bg_color = entry_sel_text_bg_color;
-
-	resource->sbar_trough_color = sbar_trough_color;
-	resource->sbar_act_trough_color = sbar_act_trough_color;
-
-	*rresource = resource;
-	return EOK;
-error:
-	if (btn_frame_color != NULL)
-		gfx_color_delete(btn_frame_color);
-	if (btn_face_color != NULL)
-		gfx_color_delete(btn_face_color);
-	if (btn_face_lit_color != NULL)
-		gfx_color_delete(btn_face_lit_color);
-	if (btn_text_color != NULL)
-		gfx_color_delete(btn_text_color);
-	if (btn_highlight_color != NULL)
-		gfx_color_delete(btn_highlight_color);
-	if (btn_shadow_color != NULL)
-		gfx_color_delete(btn_shadow_color);
-
-	if (wnd_face_color != NULL)
-		gfx_color_delete(wnd_face_color);
-	if (wnd_text_color != NULL)
-		gfx_color_delete(wnd_text_color);
-	if (wnd_dis_text_color != NULL)
-		gfx_color_delete(wnd_dis_text_color);
-	if (wnd_text_hgl_color != NULL)
-		gfx_color_delete(wnd_text_hgl_color);
-	if (wnd_sel_text_color != NULL)
-		gfx_color_delete(wnd_sel_text_color);
-	if (wnd_sel_text_hgl_color != NULL)
-		gfx_color_delete(wnd_sel_text_hgl_color);
-	if (wnd_sel_text_bg_color != NULL)
-		gfx_color_delete(wnd_sel_text_bg_color);
-	if (wnd_frame_hi_color != NULL)
-		gfx_color_delete(wnd_frame_hi_color);
-	if (wnd_frame_sh_color != NULL)
-		gfx_color_delete(wnd_frame_sh_color);
-	if (wnd_highlight_color != NULL)
-		gfx_color_delete(wnd_highlight_color);
-	if (wnd_shadow_color != NULL)
-		gfx_color_delete(wnd_shadow_color);
-
-	if (tbar_act_bg_color != NULL)
-		gfx_color_delete(tbar_act_bg_color);
-	if (tbar_act_text_color != NULL)
-		gfx_color_delete(tbar_act_text_color);
-	if (tbar_inact_bg_color != NULL)
-		gfx_color_delete(tbar_inact_bg_color);
-	if (tbar_inact_text_color != NULL)
-		gfx_color_delete(tbar_inact_text_color);
-
-	if (entry_fg_color != NULL)
-		gfx_color_delete(entry_fg_color);
-	if (entry_bg_color != NULL)
-		gfx_color_delete(entry_bg_color);
-	if (entry_sel_text_fg_color != NULL)
-		gfx_color_delete(entry_sel_text_fg_color);
-	if (entry_sel_text_bg_color != NULL)
-		gfx_color_delete(entry_sel_text_bg_color);
-	if (entry_act_bg_color != NULL)
-		gfx_color_delete(entry_act_bg_color);
-
-	if (sbar_trough_color != NULL)
-		gfx_color_delete(sbar_trough_color);
-	if (sbar_act_trough_color != NULL)
-		gfx_color_delete(sbar_act_trough_color);
-
-	if (tface != NULL)
-		gfx_typeface_destroy(tface);
-	free(resource);
-	return rc;
-}
-
-/** Create new UI resource in text mode.
- *
- * @param gc Graphic context
- * @param rresource Place to store pointer to new UI resource
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t ui_resource_create_text(gfx_context_t *gc,
-    ui_resource_t **rresource)
-{
-	ui_resource_t *resource;
-	gfx_typeface_t *tface = NULL;
-	gfx_font_t *font = NULL;
-	gfx_color_t *btn_frame_color = NULL;
-	gfx_color_t *btn_face_color = NULL;
-	gfx_color_t *btn_face_lit_color = NULL;
-	gfx_color_t *btn_text_color = NULL;
-	gfx_color_t *btn_highlight_color = NULL;
-	gfx_color_t *btn_shadow_color = NULL;
-	gfx_color_t *wnd_face_color = NULL;
-	gfx_color_t *wnd_text_color = NULL;
-	gfx_color_t *wnd_dis_text_color = NULL;
-	gfx_color_t *wnd_text_hgl_color = NULL;
-	gfx_color_t *wnd_sel_text_color = NULL;
-	gfx_color_t *wnd_sel_text_hgl_color = NULL;
-	gfx_color_t *wnd_sel_text_bg_color = NULL;
-	gfx_color_t *wnd_frame_hi_color = NULL;
-	gfx_color_t *wnd_frame_sh_color = NULL;
-	gfx_color_t *wnd_highlight_color = NULL;
-	gfx_color_t *wnd_shadow_color = NULL;
-	gfx_color_t *tbar_act_bg_color = NULL;
-	gfx_color_t *tbar_inact_bg_color = NULL;
-	gfx_color_t *tbar_act_text_color = NULL;
-	gfx_color_t *tbar_inact_text_color = NULL;
-	gfx_color_t *entry_fg_color = NULL;
-	gfx_color_t *entry_bg_color = NULL;
-	gfx_color_t *entry_sel_text_fg_color = NULL;
-	gfx_color_t *entry_sel_text_bg_color = NULL;
-	gfx_color_t *entry_act_bg_color = NULL;
-	gfx_color_t *sbar_trough_color = NULL;
-	gfx_color_t *sbar_act_trough_color = NULL;
-	errno_t rc;
-
-	resource = calloc(1, sizeof(ui_resource_t));
-	if (resource == NULL)
-		return ENOMEM;
-
-	/* Create dummy font for text mode */
-	rc = gfx_typeface_create(gc, &tface);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_font_create_textmode(tface, &font);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &btn_frame_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x20, &btn_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x30, &btn_face_lit_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x20, &btn_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x20, &btn_highlight_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x01, &btn_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &wnd_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x78, &wnd_dis_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x74, &wnd_text_hgl_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &wnd_sel_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x04, &wnd_sel_text_hgl_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &wnd_sel_text_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &wnd_frame_hi_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x01, &wnd_frame_sh_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &wnd_highlight_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x01, &wnd_shadow_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &tbar_act_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x70, &tbar_act_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &tbar_inact_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &tbar_inact_text_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &entry_fg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &entry_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x1e, &entry_sel_text_fg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x1e, &entry_sel_text_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x37, &entry_act_bg_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &sbar_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_color_new_ega(0x07, &sbar_act_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	resource->gc = gc;
-	resource->tface = tface;
-	resource->font = font;
-	resource->textmode = true;
-
-	resource->btn_frame_color = btn_frame_color;
-	resource->btn_face_color = btn_face_color;
-	resource->btn_face_lit_color = btn_face_lit_color;
-	resource->btn_text_color = btn_text_color;
-	resource->btn_highlight_color = btn_highlight_color;
-	resource->btn_shadow_color = btn_shadow_color;
-
-	resource->wnd_face_color = wnd_face_color;
-	resource->wnd_text_color = wnd_text_color;
-	resource->wnd_dis_text_color = wnd_dis_text_color;
-	resource->wnd_text_hgl_color = wnd_text_hgl_color;
-	resource->wnd_sel_text_color = wnd_sel_text_color;
-	resource->wnd_sel_text_hgl_color = wnd_sel_text_hgl_color;
-	resource->wnd_sel_text_bg_color = wnd_sel_text_bg_color;
-	resource->wnd_frame_hi_color = wnd_frame_hi_color;
-	resource->wnd_frame_sh_color = wnd_frame_sh_color;
-	resource->wnd_highlight_color = wnd_highlight_color;
-	resource->wnd_shadow_color = wnd_shadow_color;
-
-	resource->tbar_act_bg_color = tbar_act_bg_color;
-	resource->tbar_act_text_color = tbar_act_text_color;
-	resource->tbar_inact_bg_color = tbar_inact_bg_color;
-	resource->tbar_inact_text_color = tbar_inact_text_color;
-
-	resource->entry_fg_color = entry_fg_color;
-	resource->entry_bg_color = entry_bg_color;
-	resource->entry_act_bg_color = entry_act_bg_color;
-	resource->entry_sel_text_fg_color = entry_sel_text_fg_color;
-	resource->entry_sel_text_bg_color = entry_sel_text_bg_color;
-
-	resource->sbar_trough_color = sbar_trough_color;
-	resource->sbar_act_trough_color = sbar_act_trough_color;
-
-	*rresource = resource;
-	return EOK;
-error:
-	if (btn_frame_color != NULL)
-		gfx_color_delete(btn_frame_color);
-	if (btn_face_color != NULL)
-		gfx_color_delete(btn_face_color);
-	if (btn_face_lit_color != NULL)
-		gfx_color_delete(btn_face_lit_color);
-	if (btn_text_color != NULL)
-		gfx_color_delete(btn_text_color);
-	if (btn_highlight_color != NULL)
-		gfx_color_delete(btn_highlight_color);
-	if (btn_shadow_color != NULL)
-		gfx_color_delete(btn_shadow_color);
-
-	if (wnd_face_color != NULL)
-		gfx_color_delete(wnd_face_color);
-	if (wnd_text_color != NULL)
-		gfx_color_delete(wnd_text_color);
-	if (wnd_dis_text_color != NULL)
-		gfx_color_delete(wnd_dis_text_color);
-	if (wnd_text_hgl_color != NULL)
-		gfx_color_delete(wnd_text_hgl_color);
-	if (wnd_sel_text_color != NULL)
-		gfx_color_delete(wnd_sel_text_color);
-	if (wnd_sel_text_hgl_color != NULL)
-		gfx_color_delete(wnd_sel_text_hgl_color);
-	if (wnd_sel_text_bg_color != NULL)
-		gfx_color_delete(wnd_sel_text_bg_color);
-	if (wnd_frame_hi_color != NULL)
-		gfx_color_delete(wnd_frame_hi_color);
-	if (wnd_frame_sh_color != NULL)
-		gfx_color_delete(wnd_frame_sh_color);
-	if (wnd_highlight_color != NULL)
-		gfx_color_delete(wnd_highlight_color);
-	if (wnd_shadow_color != NULL)
-		gfx_color_delete(wnd_shadow_color);
-
-	if (tbar_act_bg_color != NULL)
-		gfx_color_delete(tbar_act_bg_color);
-	if (tbar_act_text_color != NULL)
-		gfx_color_delete(tbar_act_text_color);
-	if (tbar_inact_bg_color != NULL)
-		gfx_color_delete(tbar_inact_bg_color);
-	if (tbar_inact_text_color != NULL)
-		gfx_color_delete(tbar_inact_text_color);
-
-	if (entry_fg_color != NULL)
-		gfx_color_delete(entry_fg_color);
-	if (entry_bg_color != NULL)
-		gfx_color_delete(entry_bg_color);
-	if (entry_act_bg_color != NULL)
-		gfx_color_delete(entry_act_bg_color);
-	if (entry_sel_text_fg_color != NULL)
-		gfx_color_delete(entry_sel_text_fg_color);
-	if (entry_sel_text_bg_color != NULL)
-		gfx_color_delete(entry_sel_text_bg_color);
-	if (sbar_trough_color != NULL)
-		gfx_color_delete(sbar_trough_color);
-	if (sbar_act_trough_color != NULL)
-		gfx_color_delete(sbar_act_trough_color);
-
-	if (tface != NULL)
-		gfx_typeface_destroy(tface);
-	free(resource);
-	return rc;
-}
-
-/** Create new UI resource.
- *
- * @param gc Graphic context
- * @param textmode @c true if running in text mode
- * @param rresource Place to store pointer to new UI resource
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_resource_create(gfx_context_t *gc, bool textmode,
-    ui_resource_t **rresource)
-{
-	if (textmode)
-		return ui_resource_create_text(gc, rresource);
-	else
-		return ui_resource_create_gfx(gc, rresource);
-}
-
-/** Destroy UI resource.
- *
- * @param resource UI resource or @c NULL
- */
-void ui_resource_destroy(ui_resource_t *resource)
-{
-	if (resource == NULL)
-		return;
-
-	gfx_color_delete(resource->btn_frame_color);
-	gfx_color_delete(resource->btn_face_color);
-	gfx_color_delete(resource->btn_face_lit_color);
-	gfx_color_delete(resource->btn_text_color);
-	gfx_color_delete(resource->btn_highlight_color);
-	gfx_color_delete(resource->btn_shadow_color);
-
-	gfx_color_delete(resource->wnd_face_color);
-	gfx_color_delete(resource->wnd_text_color);
-	gfx_color_delete(resource->wnd_dis_text_color);
-	gfx_color_delete(resource->wnd_sel_text_color);
-	gfx_color_delete(resource->wnd_sel_text_bg_color);
-	gfx_color_delete(resource->wnd_frame_hi_color);
-	gfx_color_delete(resource->wnd_frame_sh_color);
-	gfx_color_delete(resource->wnd_highlight_color);
-	gfx_color_delete(resource->wnd_shadow_color);
-
-	gfx_color_delete(resource->tbar_act_bg_color);
-	gfx_color_delete(resource->tbar_act_text_color);
-	gfx_color_delete(resource->tbar_inact_bg_color);
-	gfx_color_delete(resource->tbar_inact_text_color);
-
-	gfx_color_delete(resource->entry_fg_color);
-	gfx_color_delete(resource->entry_bg_color);
-	gfx_color_delete(resource->entry_act_bg_color);
-	gfx_color_delete(resource->entry_sel_text_fg_color);
-	gfx_color_delete(resource->entry_sel_text_bg_color);
-
-	gfx_color_delete(resource->sbar_trough_color);
-	gfx_color_delete(resource->sbar_act_trough_color);
-
-	gfx_font_close(resource->font);
-	gfx_typeface_destroy(resource->tface);
-	free(resource);
-}
-
-/** Set UI resource expose callback.
- *
- * @param resource Resource
- * @param cb Callback
- * @param arg Callback argument
- */
-void ui_resource_set_expose_cb(ui_resource_t *resource,
-    ui_expose_cb_t cb, void *arg)
-{
-	resource->expose_cb = cb;
-	resource->expose_arg = arg;
-}
-
-/** Force UI repaint after an area has been exposed.
- *
- * This is called when a popup disappears, which could have exposed some
- * other UI elements. It causes complete repaint of the UI.
- *
- * NOTE Ideally we could specify the exposed rectangle and then limit
- * the repaint to just that. That would, however, require means of
- * actually clipping the repaint operation.
- */
-void ui_resource_expose(ui_resource_t *resource)
-{
-	if (resource->expose_cb != NULL)
-		resource->expose_cb(resource->expose_arg);
-}
-
-/** Get the UI font.
- *
- * @param resource UI resource
- * @return UI font
- */
-gfx_font_t *ui_resource_get_font(ui_resource_t *resource)
-{
-	return resource->font;
-}
-
-/** Determine if resource is textmode.
- *
- * @param resource UI resource
- * @return @c true iff resource is textmode
- */
-bool ui_resource_is_textmode(ui_resource_t *resource)
-{
-	return resource->textmode;
-}
-
-/** Get the UI window face color.
- *
- * @param resource UI resource
- * @return UI window face color
- */
-gfx_color_t *ui_resource_get_wnd_face_color(ui_resource_t *resource)
-{
-	return resource->wnd_face_color;
-}
-
-/** Get the UI window text color.
- *
- * @param resource UI resource
- * @return UI window text color
- */
-gfx_color_t *ui_resource_get_wnd_text_color(ui_resource_t *resource)
-{
-	return resource->wnd_text_color;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/scrollbar.c
===================================================================
--- uspace/lib/ui/src/scrollbar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1147 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Scrollbar
- *
- * Anatomy of a horizontal scrollbar:
- *
- *        Upper             Lower
- *       trough            trough
- *  +---+------+--------+---------+---+
- *  | < |      |   |||  |         | > |
- *  +---+------+--------+---------+---+
- *   Up           Thumb           Down
- * button                        button
- *
- *     +-------- Trough --------+
- *
- * Scrollbar uses the same terminology whether it is running in horizontal
- * or vertical mode, in horizontal mode up means left, down means right
- * (i.e. lower and higher coordinates, respectively).
- *
- * The thumb can be dragged to a specific position, resulting in a move
- * event. The up/down buttons generate up/down events. Pressing a mouse
- * button on the upper/lower trough generates page up / page down events.
- *
- * Pressing and holding down mouse button on up / down button or upper /
- * lower trough will auto-scroll (using clickmatic).
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/clickmatic.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/pbutton.h>
-#include <ui/scrollbar.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/pbutton.h"
-#include "../private/resource.h"
-#include "../private/scrollbar.h"
-
-enum {
-	/** Scrollbar button width */
-	ui_scrollbar_btn_len = 21,
-	/** Scrollbar button width in text mode */
-	ui_scrollbar_btn_len_text = 1,
-	/** Scrollbar thumb frame thickness */
-	ui_scrollbar_thumb_frame_thickness = 1,
-	/** Scrollbar thumb bevel width */
-	ui_scrollbar_thumb_bevel_width = 2,
-	/** Scrollbar default thumb length */
-	ui_scrollbar_def_thumb_len = 21,
-	/** Scrollbar default thumb length in text mode */
-	ui_scrollbar_def_thumb_len_text = 1,
-	/** Scrollbar minimum thumb length */
-	ui_scrollbar_min_thumb_len = 10,
-	/** Scrollbar minimum thumb length in text mode */
-	ui_scrollbar_min_thumb_len_text = 1,
-};
-
-static void ui_scrollbar_up_btn_down(ui_pbutton_t *, void *);
-static void ui_scrollbar_up_btn_up(ui_pbutton_t *, void *);
-static errno_t ui_scrollbar_up_btn_decor_paint(ui_pbutton_t *, void *,
-    gfx_coord2_t *);
-static errno_t ui_scrollbar_down_btn_decor_paint(ui_pbutton_t *, void *,
-    gfx_coord2_t *);
-static void ui_scrollbar_down_btn_down(ui_pbutton_t *, void *);
-static void ui_scrollbar_down_btn_up(ui_pbutton_t *, void *);
-static void ui_scrollbar_ctl_destroy(void *);
-static errno_t ui_scrollbar_ctl_paint(void *);
-static ui_evclaim_t ui_scrollbar_ctl_pos_event(void *, pos_event_t *);
-
-static ui_pbutton_cb_t ui_scrollbar_up_btn_cb = {
-	.down = ui_scrollbar_up_btn_down,
-	.up = ui_scrollbar_up_btn_up
-};
-
-static ui_pbutton_decor_ops_t ui_scrollbar_up_btn_decor_ops = {
-	.paint = ui_scrollbar_up_btn_decor_paint
-};
-
-static ui_pbutton_cb_t ui_scrollbar_down_btn_cb = {
-	.down = ui_scrollbar_down_btn_down,
-	.up = ui_scrollbar_down_btn_up
-};
-
-static ui_pbutton_decor_ops_t ui_scrollbar_down_btn_decor_ops = {
-	.paint = ui_scrollbar_down_btn_decor_paint
-};
-
-/** Scrollbar control ops */
-static ui_control_ops_t ui_scrollbar_ops = {
-	.destroy = ui_scrollbar_ctl_destroy,
-	.paint = ui_scrollbar_ctl_paint,
-	.pos_event = ui_scrollbar_ctl_pos_event
-};
-
-static void ui_scrollbar_cm_up(ui_clickmatic_t *, void *);
-static void ui_scrollbar_cm_down(ui_clickmatic_t *, void *);
-static void ui_scrollbar_cm_page_up(ui_clickmatic_t *, void *);
-static void ui_scrollbar_cm_page_down(ui_clickmatic_t *, void *);
-
-/** Scrollbar clickmatic up callbacks */
-ui_clickmatic_cb_t ui_scrollbar_clickmatic_up_cb = {
-	.clicked = ui_scrollbar_cm_up
-};
-
-/** Scrollbar clickmatic down callbacks */
-ui_clickmatic_cb_t ui_scrollbar_clickmatic_down_cb = {
-	.clicked = ui_scrollbar_cm_down
-};
-
-/** Scrollbar clickmatic page up callbacks */
-ui_clickmatic_cb_t ui_scrollbar_clickmatic_page_up_cb = {
-	.clicked = ui_scrollbar_cm_page_up
-};
-
-/** Scrollbar clickmatic page down callbacks */
-ui_clickmatic_cb_t ui_scrollbar_clickmatic_page_down_cb = {
-	.clicked = ui_scrollbar_cm_page_down
-};
-
-/** Create new scrollbar.
- *
- * @param ui UI
- * @param window Window containing scrollbar
- * @param dir Scrollbar direction
- * @param rscrollbar Place to store pointer to new scrollbar
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_scrollbar_create(ui_t *ui, ui_window_t *window,
-    ui_scrollbar_dir_t dir, ui_scrollbar_t **rscrollbar)
-{
-	ui_scrollbar_t *scrollbar;
-	ui_resource_t *resource;
-	const char *up_text;
-	const char *down_text;
-	errno_t rc;
-
-	resource = ui_window_get_res(window);
-
-	scrollbar = calloc(1, sizeof(ui_scrollbar_t));
-	if (scrollbar == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_scrollbar_ops, (void *) scrollbar,
-	    &scrollbar->control);
-	if (rc != EOK) {
-		free(scrollbar);
-		return rc;
-	}
-
-	if (dir == ui_sbd_horiz) {
-		up_text = resource->textmode ? "\u25c4" : "<";
-		down_text = resource->textmode ? "\u25ba" : ">";
-	} else {
-		up_text = resource->textmode ? "\u25b2" : "^";
-		down_text = resource->textmode ? "\u25bc" : "v";
-	}
-
-	rc = ui_pbutton_create(resource, up_text, &scrollbar->up_btn);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(scrollbar->up_btn, &ui_scrollbar_up_btn_cb,
-	    scrollbar);
-
-	ui_pbutton_set_decor_ops(scrollbar->up_btn,
-	    &ui_scrollbar_up_btn_decor_ops, (void *) scrollbar);
-
-	ui_pbutton_set_flags(scrollbar->up_btn, ui_pbf_no_text_depress);
-
-	rc = ui_pbutton_create(resource, down_text, &scrollbar->down_btn);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(scrollbar->down_btn, &ui_scrollbar_down_btn_cb,
-	    (void *) scrollbar);
-
-	ui_pbutton_set_decor_ops(scrollbar->down_btn,
-	    &ui_scrollbar_down_btn_decor_ops, (void *) scrollbar);
-
-	ui_pbutton_set_flags(scrollbar->down_btn, ui_pbf_no_text_depress);
-
-	scrollbar->thumb_len = resource->textmode ?
-	    ui_scrollbar_def_thumb_len_text :
-	    ui_scrollbar_def_thumb_len;
-
-	scrollbar->ui = ui;
-	scrollbar->window = window;
-	scrollbar->dir = dir;
-	*rscrollbar = scrollbar;
-	return EOK;
-error:
-	ui_scrollbar_destroy(scrollbar);
-	return rc;
-}
-
-/** Destroy scrollbar.
- *
- * @param scrollbar Scrollbar or @c NULL
- */
-void ui_scrollbar_destroy(ui_scrollbar_t *scrollbar)
-{
-	if (scrollbar == NULL)
-		return;
-
-	ui_pbutton_destroy(scrollbar->up_btn);
-	ui_pbutton_destroy(scrollbar->down_btn);
-	ui_control_delete(scrollbar->control);
-	free(scrollbar);
-}
-
-/** Get base control from scrollbar.
- *
- * @param scrollbar Scrollbar
- * @return Control
- */
-ui_control_t *ui_scrollbar_ctl(ui_scrollbar_t *scrollbar)
-{
-	return scrollbar->control;
-}
-
-/** Set scrollbar callbacks.
- *
- * @param scrollbar Scrollbar
- * @param cb Scrollbar callbacks
- * @param arg Callback argument
- */
-void ui_scrollbar_set_cb(ui_scrollbar_t *scrollbar, ui_scrollbar_cb_t *cb, void *arg)
-{
-	scrollbar->cb = cb;
-	scrollbar->arg = arg;
-}
-
-/** Set scrollbar rectangle.
- *
- * @param scrollbar Scrollbar
- * @param rect New scrollbar rectangle
- */
-void ui_scrollbar_set_rect(ui_scrollbar_t *scrollbar, gfx_rect_t *rect)
-{
-	ui_scrollbar_geom_t geom;
-
-	scrollbar->rect = *rect;
-
-	ui_scrollbar_get_geom(scrollbar, &geom);
-	ui_pbutton_set_rect(scrollbar->up_btn, &geom.up_btn_rect);
-	ui_pbutton_set_rect(scrollbar->down_btn, &geom.down_btn_rect);
-}
-
-/** Paint outer thumb frame.
- *
- * @param scrollbar Scrollbar
- * @return EOK on success or an error code
- */
-static errno_t ui_scrollbar_paint_thumb_frame(ui_resource_t *res, gfx_rect_t *rect,
-    gfx_coord_t thickness, gfx_rect_t *inside)
-{
-	gfx_rect_t drect;
-	errno_t rc;
-
-	rc = gfx_set_color(res->gc, res->btn_frame_color);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x + 1;
-	drect.p0.y = rect->p0.y;
-	drect.p1.x = rect->p1.x - 1;
-	drect.p1.y = rect->p0.y + thickness;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x + 1;
-	drect.p0.y = rect->p1.y - thickness;
-	drect.p1.x = rect->p1.x - 1;
-	drect.p1.y = rect->p1.y;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x;
-	drect.p0.y = rect->p0.y + 1;
-	drect.p1.x = rect->p0.x + thickness;
-	drect.p1.y = rect->p1.y - 1;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p1.x - thickness;
-	drect.p0.y = rect->p0.y + 1;
-	drect.p1.x = rect->p1.x;
-	drect.p1.y = rect->p1.y - 1;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	if (inside != NULL) {
-		inside->p0.x = rect->p0.x + thickness;
-		inside->p0.y = rect->p0.y + thickness;
-		inside->p1.x = rect->p1.x - thickness;
-		inside->p1.y = rect->p1.y - thickness;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint outset scrollbar bevel.
- *
- * @param scrollbar Scrollbar
- * @return EOK on success or an error code
- */
-static errno_t ui_scrollbar_paint_outset(ui_scrollbar_t *scrollbar,
-    gfx_rect_t *rect, gfx_rect_t *inside)
-{
-	ui_resource_t *resource = ui_window_get_res(scrollbar->window);
-
-	return ui_paint_bevel(resource->gc, rect,
-	    resource->btn_highlight_color,
-	    resource->btn_shadow_color, ui_scrollbar_thumb_bevel_width, inside);
-}
-
-/** Determine scrollbar trough length.
- *
- * Return the size of the space within which the thumb can move
- * (without subtracting the length of the thumb).
- *
- * @param scrollbar Scrollbar
- * @return Scrollbar trough length in pixels
- */
-gfx_coord_t ui_scrollbar_trough_length(ui_scrollbar_t *scrollbar)
-{
-	ui_resource_t *resource;
-	gfx_coord2_t dims;
-	gfx_coord_t len;
-	gfx_coord_t sblen;
-
-	resource = ui_window_get_res(scrollbar->window);
-
-	gfx_rect_dims(&scrollbar->rect, &dims);
-	sblen = scrollbar->dir == ui_sbd_horiz ?
-	    dims.x : dims.y;
-
-	len = resource->textmode ? ui_scrollbar_btn_len_text :
-	    ui_scrollbar_btn_len;
-
-	return sblen - 2 * len;
-}
-
-/** Determine scrollbar move length.
- *
- * Return the maximum distance the thumb can move.
- *
- * @param scrollbar Scrollbar
- * @return Scrollbar move length in pixels
- */
-gfx_coord_t ui_scrollbar_move_length(ui_scrollbar_t *scrollbar)
-{
-	return ui_scrollbar_trough_length(scrollbar) -
-	    scrollbar->thumb_len;
-}
-
-/** Set scrollbar thumb length.
- *
- * @param scrollbar Scrollbar
- * @param len Thumb length in pixels
- */
-void ui_scrollbar_set_thumb_length(ui_scrollbar_t *scrollbar, gfx_coord_t len)
-{
-	ui_resource_t *resource;
-	gfx_coord_t min_len;
-	gfx_coord_t max_len;
-
-	resource = ui_window_get_res(scrollbar->window);
-
-	min_len = resource->textmode ?
-	    ui_scrollbar_min_thumb_len_text :
-	    ui_scrollbar_min_thumb_len;
-
-	max_len = ui_scrollbar_trough_length(scrollbar);
-	if (len < min_len)
-		len = min_len;
-	if (len > max_len)
-		len = max_len;
-
-	if (len != scrollbar->thumb_len) {
-		scrollbar->thumb_len = len;
-		(void) ui_scrollbar_paint(scrollbar);
-	}
-}
-
-/** Get scrollbar thumb position.
- *
- * @param scrollbar Scrollbar
- * @return Scrollbar thumb position in pixels
- */
-gfx_coord_t ui_scrollbar_get_pos(ui_scrollbar_t *scrollbar)
-{
-	return scrollbar->pos;
-}
-
-/** Set scrollbar thumb position.
- *
- * The position is clipped to the allowed range.
- *
- * @param scrollbar Scrollbar
- * @parap pos       Scrollbar thumb position in pixels
- */
-void ui_scrollbar_set_pos(ui_scrollbar_t *scrollbar, gfx_coord_t pos)
-{
-	gfx_coord_t length;
-
-	length = ui_scrollbar_move_length(scrollbar);
-	if (pos < 0)
-		pos = 0;
-	if (pos > length)
-		pos = length;
-
-	if (pos != scrollbar->pos) {
-		scrollbar->pos = pos;
-		(void) ui_scrollbar_paint(scrollbar);
-		ui_scrollbar_troughs_update(scrollbar,
-		    &scrollbar->last_curs_pos);
-	}
-}
-
-/** Paint scrollbar in graphics mode.
- *
- * @param scrollbar Scrollbar
- * @return EOK on success or an error code
- */
-errno_t ui_scrollbar_paint_gfx(ui_scrollbar_t *scrollbar)
-{
-	ui_resource_t *resource;
-	ui_scrollbar_geom_t geom;
-	gfx_rect_t brect;
-	gfx_rect_t irect;
-	errno_t rc;
-
-	resource = ui_window_get_res(scrollbar->window);
-
-	ui_scrollbar_get_geom(scrollbar, &geom);
-
-	/* Paint scrollbar frame */
-
-	rc = ui_paint_inset_frame(resource, &scrollbar->rect, NULL);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint scrollbar upper trough */
-	rc = gfx_set_color(resource->gc,
-	    scrollbar->upper_trough_held && scrollbar->upper_trough_inside ?
-	    resource->sbar_act_trough_color :
-	    resource->sbar_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(resource->gc, &geom.upper_trough_rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint scrollbar lower trough */
-
-	rc = gfx_set_color(resource->gc,
-	    scrollbar->lower_trough_held && scrollbar->lower_trough_inside ?
-	    resource->sbar_act_trough_color :
-	    resource->sbar_trough_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(resource->gc, &geom.lower_trough_rect);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint scrollbar thumb */
-	rc = ui_scrollbar_paint_thumb_frame(resource, &geom.thumb_rect,
-	    ui_scrollbar_thumb_frame_thickness, &brect);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_scrollbar_paint_outset(scrollbar, &brect, &irect);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(resource->gc, resource->btn_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(resource->gc, &irect);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_pbutton_paint(scrollbar->up_btn);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_pbutton_paint(scrollbar->down_btn);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(resource->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint scrollbar in text mode.
- *
- * @param scrollbar Scrollbar
- * @return EOK on success or an error code
- */
-errno_t ui_scrollbar_paint_text(ui_scrollbar_t *scrollbar)
-{
-	ui_resource_t *resource;
-	ui_scrollbar_geom_t geom;
-	errno_t rc;
-
-	resource = ui_window_get_res(scrollbar->window);
-	ui_scrollbar_get_geom(scrollbar, &geom);
-
-	/* Paint scrollbar trough */
-
-	rc = ui_paint_text_rect(resource, &geom.trough_rect,
-	    resource->sbar_trough_color, "\u2592");
-	if (rc != EOK)
-		goto error;
-
-	/* Paint scrollbar thumb */
-
-	rc = ui_paint_text_rect(resource, &geom.thumb_rect,
-	    resource->sbar_trough_color, "\u25a0");
-	if (rc != EOK)
-		goto error;
-
-	/* Paint buttons */
-
-	rc = ui_pbutton_paint(scrollbar->up_btn);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_pbutton_paint(scrollbar->down_btn);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(resource->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint scrollbar.
- *
- * @param scrollbar Scrollbar
- * @return EOK on success or an error code
- */
-errno_t ui_scrollbar_paint(ui_scrollbar_t *scrollbar)
-{
-	ui_resource_t *resource = ui_window_get_res(scrollbar->window);
-
-	if (resource->textmode) {
-		return ui_scrollbar_paint_text(scrollbar);
-	} else {
-		return ui_scrollbar_paint_gfx(scrollbar);
-	}
-}
-
-/** Get scrollbar geometry.
- *
- * @param scrollbar Scrollbar
- * @param geom Structure to fill in with computed geometry
- */
-void ui_scrollbar_get_geom(ui_scrollbar_t *scrollbar, ui_scrollbar_geom_t *geom)
-{
-	ui_resource_t *resource;
-	gfx_coord_t btn_len;
-	gfx_rect_t orect;
-	gfx_rect_t irect;
-
-	resource = ui_window_get_res(scrollbar->window);
-
-	if (resource->textmode) {
-		btn_len = ui_scrollbar_btn_len_text;
-	} else {
-		btn_len = ui_scrollbar_btn_len;
-	}
-
-	if (resource->textmode) {
-		irect = scrollbar->rect;
-		orect = scrollbar->rect;
-	} else {
-		ui_paint_get_inset_frame_inside(resource,
-		    &scrollbar->rect, &irect);
-		ui_paint_get_bevel_inside(resource->gc,
-		    &scrollbar->rect, 1, &orect);
-	}
-
-	if (scrollbar->dir == ui_sbd_horiz) {
-		/* Up button */
-		geom->up_btn_rect.p0.x = orect.p0.x;
-		geom->up_btn_rect.p0.y = orect.p0.y;
-		geom->up_btn_rect.p1.x = orect.p0.x + btn_len;
-		geom->up_btn_rect.p1.y = orect.p1.y;
-
-		/* Trough */
-		geom->trough_rect.p0.x = geom->up_btn_rect.p1.x;
-		geom->trough_rect.p0.y = irect.p0.y;
-		geom->trough_rect.p1.x = orect.p1.x - btn_len;
-		geom->trough_rect.p1.y = irect.p1.y;
-
-		/* Thumb */
-		geom->thumb_rect.p0.x = geom->up_btn_rect.p1.x +
-		    scrollbar->pos;
-		geom->thumb_rect.p0.y = orect.p0.y;
-		geom->thumb_rect.p1.x = geom->thumb_rect.p0.x +
-		    scrollbar->thumb_len;
-		geom->thumb_rect.p1.y = orect.p1.y;
-
-		/* Upper trough */
-		geom->upper_trough_rect.p0 = geom->trough_rect.p0;
-		geom->upper_trough_rect.p1.x = geom->thumb_rect.p0.x;
-		geom->upper_trough_rect.p1.y = geom->trough_rect.p1.y;
-
-		/* Lower trough */
-		geom->lower_trough_rect.p0.x = geom->thumb_rect.p1.x;
-		geom->lower_trough_rect.p0.y = geom->trough_rect.p0.y;
-		geom->lower_trough_rect.p1 = geom->trough_rect.p1;
-
-		/* Down button */
-		geom->down_btn_rect.p0.x = geom->trough_rect.p1.x;
-		geom->down_btn_rect.p0.y = orect.p0.y;
-		geom->down_btn_rect.p1.x = orect.p1.x;
-		geom->down_btn_rect.p1.y = orect.p1.y;
-	} else {
-		/* Up button */
-		geom->up_btn_rect.p0.x = orect.p0.x;
-		geom->up_btn_rect.p0.y = orect.p0.y;
-		geom->up_btn_rect.p1.x = orect.p1.x;
-		geom->up_btn_rect.p1.y = orect.p0.y + btn_len;
-
-		/* Trough */
-		geom->trough_rect.p0.x = irect.p0.x;
-		geom->trough_rect.p0.y = geom->up_btn_rect.p1.y;
-		geom->trough_rect.p1.x = irect.p1.x;
-		geom->trough_rect.p1.y = orect.p1.y - btn_len;
-
-		/* Thumb */
-		geom->thumb_rect.p0.x = orect.p0.x;
-		geom->thumb_rect.p0.y = geom->up_btn_rect.p1.y +
-		    scrollbar->pos;
-		geom->thumb_rect.p1.x = orect.p1.x;
-		geom->thumb_rect.p1.y = geom->thumb_rect.p0.y +
-		    scrollbar->thumb_len;
-
-		/* Upper trough */
-		geom->upper_trough_rect.p0 = geom->trough_rect.p0;
-		geom->upper_trough_rect.p1.x = geom->trough_rect.p1.x;
-		geom->upper_trough_rect.p1.y = geom->thumb_rect.p0.y;
-
-		/* Lower trough */
-		geom->lower_trough_rect.p0.x = geom->trough_rect.p0.x;
-		geom->lower_trough_rect.p0.y = geom->thumb_rect.p1.y;
-		geom->lower_trough_rect.p1 = geom->trough_rect.p1;
-
-		/* Down button */
-		geom->down_btn_rect.p0.x = orect.p0.x;
-		geom->down_btn_rect.p0.y = geom->trough_rect.p1.y;
-		geom->down_btn_rect.p1.x = orect.p1.x;
-		geom->down_btn_rect.p1.y = orect.p1.y;
-	}
-}
-
-/** Press down scrollbar thumb.
- *
- * @param scrollbar Scrollbar
- * @param pos Pointer position
- */
-void ui_scrollbar_thumb_press(ui_scrollbar_t *scrollbar, gfx_coord2_t *pos)
-{
-	if (scrollbar->thumb_held)
-		return;
-
-	scrollbar->thumb_held = true;
-	scrollbar->press_pos = *pos;
-	scrollbar->last_pos = scrollbar->pos;
-
-	(void) ui_scrollbar_paint(scrollbar);
-}
-
-/** Press down scrollbar upper trough.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_upper_trough_press(ui_scrollbar_t *scrollbar)
-{
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	scrollbar->upper_trough_held = true;
-	scrollbar->upper_trough_inside = true;
-
-	ui_clickmatic_set_cb(clickmatic, &ui_scrollbar_clickmatic_page_up_cb,
-	    (void *) scrollbar);
-	ui_clickmatic_press(clickmatic);
-}
-
-/** Press down scrollbar lower trough.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_lower_trough_press(ui_scrollbar_t *scrollbar)
-{
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	scrollbar->lower_trough_held = true;
-	scrollbar->lower_trough_inside = true;
-
-	ui_clickmatic_set_cb(clickmatic, &ui_scrollbar_clickmatic_page_down_cb,
-	    (void *) scrollbar);
-	ui_clickmatic_press(clickmatic);
-}
-
-/** Release scrollbar.
- *
- * @param scrollbar Scrollbar
- * @param pos Pointer position
- */
-void ui_scrollbar_release(ui_scrollbar_t *scrollbar, gfx_coord2_t *pos)
-{
-	ui_clickmatic_t *clickmatic;
-
-	if (scrollbar->thumb_held) {
-		ui_scrollbar_update(scrollbar, pos);
-		scrollbar->thumb_held = false;
-	}
-
-	if (scrollbar->upper_trough_held || scrollbar->lower_trough_held) {
-		clickmatic = ui_get_clickmatic(scrollbar->ui);
-		ui_clickmatic_release(clickmatic);
-		ui_clickmatic_set_cb(clickmatic, NULL, NULL);
-
-		scrollbar->upper_trough_held = false;
-		scrollbar->lower_trough_held = false;
-		(void) ui_scrollbar_paint(scrollbar);
-	}
-}
-
-/** Update state of scrollbar throuhgs.
- *
- * Update state of scrollbar troughs after mouse cursor or thumb has moved.
- *
- * @param scrollbar Scrollbar
- * @param pos Mouse cursor position
- */
-void ui_scrollbar_troughs_update(ui_scrollbar_t *scrollbar, gfx_coord2_t *pos)
-{
-	ui_scrollbar_geom_t geom;
-	bool inside_up;
-	bool inside_down;
-
-	ui_scrollbar_get_geom(scrollbar, &geom);
-
-	inside_up = gfx_pix_inside_rect(pos, &geom.upper_trough_rect);
-	inside_down = gfx_pix_inside_rect(pos, &geom.lower_trough_rect);
-
-	if (inside_up && !scrollbar->upper_trough_inside) {
-		scrollbar->upper_trough_inside = true;
-		(void) ui_scrollbar_paint(scrollbar);
-	} else if (!inside_up && scrollbar->upper_trough_inside) {
-		scrollbar->upper_trough_inside = false;
-		(void) ui_scrollbar_paint(scrollbar);
-	}
-
-	if (inside_down && !scrollbar->lower_trough_inside) {
-		scrollbar->lower_trough_inside = true;
-		(void) ui_scrollbar_paint(scrollbar);
-	} else if (!inside_down && scrollbar->lower_trough_inside) {
-		scrollbar->lower_trough_inside = false;
-		(void) ui_scrollbar_paint(scrollbar);
-	}
-}
-
-/** Scrollbar handler for pointer movement.
- *
- * @param scrollbar Scrollbar
- * @param pos New pointer position
- */
-void ui_scrollbar_update(ui_scrollbar_t *scrollbar, gfx_coord2_t *pos)
-{
-	gfx_coord_t spos;
-
-	if (scrollbar->thumb_held) {
-		if (scrollbar->dir == ui_sbd_horiz)
-			spos = scrollbar->last_pos + pos->x - scrollbar->press_pos.x;
-		else
-			spos = scrollbar->last_pos + pos->y - scrollbar->press_pos.y;
-
-		ui_scrollbar_set_pos(scrollbar, spos);
-		ui_scrollbar_moved(scrollbar, scrollbar->pos);
-	}
-
-	ui_scrollbar_troughs_update(scrollbar, pos);
-}
-
-/** Scrollbar up button was pressed.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_up(ui_scrollbar_t *scrollbar)
-{
-	if (scrollbar->cb != NULL && scrollbar->cb->up != NULL)
-		scrollbar->cb->up(scrollbar, scrollbar->arg);
-}
-
-/** Scrollbar down button was pressed.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_down(ui_scrollbar_t *scrollbar)
-{
-	if (scrollbar->cb != NULL && scrollbar->cb->down != NULL)
-		scrollbar->cb->down(scrollbar, scrollbar->arg);
-}
-
-/** Scrollbar upper trough was pressed.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_page_up(ui_scrollbar_t *scrollbar)
-{
-	if (scrollbar->cb != NULL && scrollbar->cb->page_up != NULL)
-		scrollbar->cb->page_up(scrollbar, scrollbar->arg);
-}
-
-/** Scrollbar lower trough was pressed.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_page_down(ui_scrollbar_t *scrollbar)
-{
-	if (scrollbar->cb != NULL && scrollbar->cb->page_down != NULL)
-		scrollbar->cb->page_down(scrollbar, scrollbar->arg);
-}
-
-/** Scrollbar was moved.
- *
- * @param scrollbar Scrollbar
- */
-void ui_scrollbar_moved(ui_scrollbar_t *scrollbar, gfx_coord_t pos)
-{
-	if (scrollbar->cb != NULL && scrollbar->cb->moved != NULL)
-		scrollbar->cb->moved(scrollbar, scrollbar->arg, pos);
-}
-
-/** Handle scrollbar position event.
- *
- * @param scrollbar Scrollbar
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_scrollbar_pos_event(ui_scrollbar_t *scrollbar, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	ui_evclaim_t claimed;
-	ui_scrollbar_geom_t geom;
-
-	ui_scrollbar_get_geom(scrollbar, &geom);
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	claimed = ui_pbutton_pos_event(scrollbar->up_btn, event);
-	if (claimed == ui_claimed)
-		return ui_claimed;
-
-	claimed = ui_pbutton_pos_event(scrollbar->down_btn, event);
-	if (claimed == ui_claimed)
-		return ui_claimed;
-
-	switch (event->type) {
-	case POS_PRESS:
-		if (gfx_pix_inside_rect(&pos, &geom.thumb_rect)) {
-			ui_scrollbar_thumb_press(scrollbar, &pos);
-			return ui_claimed;
-		}
-		if (gfx_pix_inside_rect(&pos, &geom.upper_trough_rect)) {
-			ui_scrollbar_upper_trough_press(scrollbar);
-			return ui_claimed;
-		}
-		if (gfx_pix_inside_rect(&pos, &geom.lower_trough_rect)) {
-			ui_scrollbar_lower_trough_press(scrollbar);
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (scrollbar->thumb_held || scrollbar->upper_trough_held ||
-		    scrollbar->lower_trough_held) {
-			ui_scrollbar_release(scrollbar, &pos);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		ui_scrollbar_update(scrollbar, &pos);
-		scrollbar->last_curs_pos = pos;
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Scrollbar up button pressed.
- *
- * @param pbutton Up button
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_up_btn_down(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	ui_clickmatic_set_cb(clickmatic, &ui_scrollbar_clickmatic_up_cb,
-	    (void *) scrollbar);
-	ui_clickmatic_press(clickmatic);
-}
-
-/** Scrollbar up button released.
- *
- * @param pbutton Up button
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_up_btn_up(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	ui_clickmatic_release(clickmatic);
-	ui_clickmatic_set_cb(clickmatic, NULL, NULL);
-}
-
-/** Paint up button decoration.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_scrollbar_t *)
- * @param pos Center position
- */
-static errno_t ui_scrollbar_up_btn_decor_paint(ui_pbutton_t *pbutton,
-    void *arg, gfx_coord2_t *pos)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	errno_t rc;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	if (scrollbar->dir == ui_sbd_horiz)
-		return ui_paint_left_triangle(pbutton->res->gc, pos, 5);
-	else
-		return ui_paint_up_triangle(pbutton->res->gc, pos, 5);
-}
-
-/** Paint down button decoration.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_scrollbar_t *)
- * @param pos Center position
- */
-static errno_t ui_scrollbar_down_btn_decor_paint(ui_pbutton_t *pbutton,
-    void *arg, gfx_coord2_t *pos)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	errno_t rc;
-
-	rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	if (scrollbar->dir == ui_sbd_horiz)
-		return ui_paint_right_triangle(pbutton->res->gc, pos, 5);
-	else
-		return ui_paint_down_triangle(pbutton->res->gc, pos, 5);
-}
-
-/** Scrollbar down button pressed.
- *
- * @param pbutton Down button
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_down_btn_down(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	ui_clickmatic_set_cb(clickmatic, &ui_scrollbar_clickmatic_down_cb,
-	    (void *) scrollbar);
-	ui_clickmatic_press(clickmatic);
-}
-
-/** Scrollbar down button released.
- *
- * @param pbutton Down button
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_down_btn_up(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-	ui_clickmatic_t *clickmatic = ui_get_clickmatic(scrollbar->ui);
-
-	ui_clickmatic_release(clickmatic);
-	ui_clickmatic_set_cb(clickmatic, NULL, NULL);
-}
-
-/** Destroy scrollbar control.
- *
- * @param arg Argument (ui_scrollbar_t *)
- */
-void ui_scrollbar_ctl_destroy(void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *) arg;
-
-	ui_scrollbar_destroy(scrollbar);
-}
-
-/** Paint scrollbar control.
- *
- * @param arg Argument (ui_scrollbar_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_scrollbar_ctl_paint(void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *) arg;
-
-	return ui_scrollbar_paint(scrollbar);
-}
-
-/** Handle scrollbar control position event.
- *
- * @param arg Argument (ui_scrollbar_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_scrollbar_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-
-	return ui_scrollbar_pos_event(scrollbar, event);
-}
-
-/** Scrollbar clickmatic up button click event.
- *
- * @param clickmatic Clickmatic
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_cm_up(ui_clickmatic_t *clickmatic, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-
-	if (scrollbar->up_btn->inside)
-		ui_scrollbar_up(scrollbar);
-}
-
-/** Scrollbar clickmatic down button click event.
- *
- * @param clickmatic Clickmatic
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_cm_down(ui_clickmatic_t *clickmatic, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-
-	if (scrollbar->down_btn->inside)
-		ui_scrollbar_down(scrollbar);
-}
-
-/** Scrollbar clickmatic upper trough click event.
- *
- * @param clickmatic Clickmatic
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_cm_page_up(ui_clickmatic_t *clickmatic, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-
-	if (scrollbar->upper_trough_inside)
-		ui_scrollbar_page_up(scrollbar);
-}
-
-/** Scrollbar clickmatic lower trough click event.
- *
- * @param clickmatic Clickmatic
- * @param arg Argument (ui_scrollbar_t *)
- */
-static void ui_scrollbar_cm_page_down(ui_clickmatic_t *clickmatic, void *arg)
-{
-	ui_scrollbar_t *scrollbar = (ui_scrollbar_t *)arg;
-
-	if (scrollbar->lower_trough_inside)
-		ui_scrollbar_page_down(scrollbar);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/selectdialog.c
===================================================================
--- uspace/lib/ui/src/selectdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,447 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Select dialog
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <ui/fixed.h>
-#include <ui/label.h>
-#include <ui/list.h>
-#include <ui/selectdialog.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/selectdialog.h"
-
-static void ui_select_dialog_wnd_close(ui_window_t *, void *);
-static void ui_select_dialog_wnd_kbd(ui_window_t *, void *, kbd_event_t *);
-
-ui_window_cb_t ui_select_dialog_wnd_cb = {
-	.close = ui_select_dialog_wnd_close,
-	.kbd = ui_select_dialog_wnd_kbd
-};
-
-static void ui_select_dialog_bok_clicked(ui_pbutton_t *, void *);
-static void ui_select_dialog_bcancel_clicked(ui_pbutton_t *, void *);
-
-ui_pbutton_cb_t ui_select_dialog_bok_cb = {
-	.clicked = ui_select_dialog_bok_clicked
-};
-
-ui_pbutton_cb_t ui_select_dialog_bcancel_cb = {
-	.clicked = ui_select_dialog_bcancel_clicked
-};
-
-static void ui_select_dialog_list_selected(ui_list_entry_t *, void *);
-
-ui_list_cb_t ui_select_dialog_list_cb = {
-	.selected = ui_select_dialog_list_selected
-};
-
-/** Initialize select dialog parameters structure.
- *
- * Select dialog parameters structure must always be initialized using
- * this function first.
- *
- * @param params Select dialog parameters structure
- */
-void ui_select_dialog_params_init(ui_select_dialog_params_t *params)
-{
-	memset(params, 0, sizeof(ui_select_dialog_params_t));
-}
-
-/** Create new select dialog.
- *
- * @param ui User interface
- * @param params Select dialog parameters
- * @param rdialog Place to store pointer to new dialog
- * @return EOK on success or an error code
- */
-errno_t ui_select_dialog_create(ui_t *ui, ui_select_dialog_params_t *params,
-    ui_select_dialog_t **rdialog)
-{
-	errno_t rc;
-	ui_select_dialog_t *dialog;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t wparams;
-	ui_fixed_t *fixed = NULL;
-	ui_label_t *label = NULL;
-	ui_list_t *list = NULL;
-	ui_pbutton_t *bok = NULL;
-	ui_pbutton_t *bcancel = NULL;
-	gfx_rect_t rect;
-	ui_resource_t *ui_res;
-
-	dialog = calloc(1, sizeof(ui_select_dialog_t));
-	if (dialog == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = params->caption;
-
-	if ((params->flags & usdf_topmost) != 0)
-		wparams.flags |= wndf_topmost;
-	if ((params->flags & usdf_center) != 0)
-		wparams.placement = ui_wnd_place_center;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 55;
-		wparams.rect.p1.y = 19;
-	} else {
-		wparams.rect.p0.x = 0;
-		wparams.rect.p0.y = 0;
-		wparams.rect.p1.x = 450;
-		wparams.rect.p1.y = 235;
-	}
-
-	rc = ui_window_create(ui, &wparams, &window);
-	if (rc != EOK)
-		goto error;
-
-	ui_window_set_cb(window, &ui_select_dialog_wnd_cb, dialog);
-
-	ui_res = ui_window_get_res(window);
-
-	rc = ui_fixed_create(&fixed);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_label_create(ui_res, params->prompt, &label);
-	if (rc != EOK)
-		goto error;
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 2;
-		rect.p1.x = 17;
-		rect.p1.y = 3;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 35;
-		rect.p1.x = 190;
-		rect.p1.y = 50;
-	}
-
-	ui_label_set_rect(label, &rect);
-
-	rc = ui_fixed_add(fixed, ui_label_ctl(label));
-	if (rc != EOK)
-		goto error;
-
-	label = NULL;
-
-	rc = ui_list_create(window, true, &list);
-	if (rc != EOK)
-		goto error;
-
-	ui_list_set_cb(list, &ui_select_dialog_list_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 3;
-		rect.p0.y = 4;
-		rect.p1.x = 52;
-		rect.p1.y = 15;
-	} else {
-		rect.p0.x = 10;
-		rect.p0.y = 55;
-		rect.p1.x = 440;
-		rect.p1.y = 180;
-	}
-
-	ui_list_set_rect(list, &rect);
-
-	rc = ui_fixed_add(fixed, ui_list_ctl(list));
-	if (rc != EOK)
-		goto error;
-
-	dialog->list = list;
-	list = NULL;
-
-	rc = ui_pbutton_create(ui_res, "OK", &bok);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bok, &ui_select_dialog_bok_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 16;
-		rect.p0.y = 16;
-		rect.p1.x = 26;
-		rect.p1.y = 17;
-	} else {
-		rect.p0.x = 130;
-		rect.p0.y = 190;
-		rect.p1.x = 220;
-		rect.p1.y = 218;
-	}
-
-	ui_pbutton_set_rect(bok, &rect);
-
-	ui_pbutton_set_default(bok, true);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bok));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bok = bok;
-	bok = NULL;
-
-	rc = ui_pbutton_create(ui_res, "Cancel", &bcancel);
-	if (rc != EOK)
-		goto error;
-
-	ui_pbutton_set_cb(bcancel, &ui_select_dialog_bcancel_cb, dialog);
-
-	/* FIXME: Auto layout */
-	if (ui_is_textmode(ui)) {
-		rect.p0.x = 28;
-		rect.p0.y = 16;
-		rect.p1.x = 38;
-		rect.p1.y = 17;
-	} else {
-		rect.p0.x = 230;
-		rect.p0.y = 190;
-		rect.p1.x = 320;
-		rect.p1.y = 218;
-	}
-
-	ui_pbutton_set_rect(bcancel, &rect);
-
-	rc = ui_fixed_add(fixed, ui_pbutton_ctl(bcancel));
-	if (rc != EOK)
-		goto error;
-
-	dialog->bcancel = bcancel;
-	bcancel = NULL;
-
-	ui_window_add(window, ui_fixed_ctl(fixed));
-	fixed = NULL;
-
-	rc = ui_window_paint(window);
-	if (rc != EOK)
-		goto error;
-
-	dialog->window = window;
-	*rdialog = dialog;
-	return EOK;
-error:
-	if (list != NULL)
-		ui_list_destroy(list);
-	if (bok != NULL)
-		ui_pbutton_destroy(bok);
-	if (bcancel != NULL)
-		ui_pbutton_destroy(bcancel);
-	if (label != NULL)
-		ui_label_destroy(label);
-	if (fixed != NULL)
-		ui_fixed_destroy(fixed);
-	if (window != NULL)
-		ui_window_destroy(window);
-	if (dialog != NULL)
-		free(dialog);
-	return rc;
-}
-
-/** Destroy select dialog.
- *
- * @param dialog Select dialog or @c NULL
- */
-void ui_select_dialog_destroy(ui_select_dialog_t *dialog)
-{
-	if (dialog == NULL)
-		return;
-
-	ui_window_destroy(dialog->window);
-	free(dialog);
-}
-
-/** Set mesage dialog callback.
- *
- * @param dialog Select dialog
- * @param cb Select dialog callbacks
- * @param arg Callback argument
- */
-void ui_select_dialog_set_cb(ui_select_dialog_t *dialog, ui_select_dialog_cb_t *cb,
-    void *arg)
-{
-	dialog->cb = cb;
-	dialog->arg = arg;
-}
-
-/** Append new entry to select dialog.
- *
- * @param dialog Select dialog
- * @param attr List entry attributes
- * @return EOK on success or an error code
- */
-errno_t ui_select_dialog_append(ui_select_dialog_t *dialog,
-    ui_list_entry_attr_t *attr)
-{
-	return ui_list_entry_append(dialog->list, attr, NULL);
-}
-
-/** Paint select dialog.
- *
- * This needs to be called after appending entries.
- *
- * @param dialog Select dialog
- * @return EOK on success or an error code
- */
-errno_t ui_select_dialog_paint(ui_select_dialog_t *dialog)
-{
-	return ui_window_paint(dialog->window);
-}
-
-/** Get the entry list from select dialog.
- *
- * @param dialog Select dialog
- * @return UI list
- */
-ui_list_t *ui_select_dialog_list(ui_select_dialog_t *dialog)
-{
-	return dialog->list;
-}
-
-/** Select dialog window close handler.
- *
- * @param window Window
- * @param arg Argument (ui_select_dialog_t *)
- */
-static void ui_select_dialog_wnd_close(ui_window_t *window, void *arg)
-{
-	ui_select_dialog_t *dialog = (ui_select_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->close != NULL)
-		dialog->cb->close(dialog, dialog->arg);
-}
-
-/** Select dialog window keyboard event handler.
- *
- * @param window Window
- * @param arg Argument (ui_select_dialog_t *)
- * @param event Keyboard event
- */
-static void ui_select_dialog_wnd_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	ui_select_dialog_t *dialog = (ui_select_dialog_t *) arg;
-	ui_list_entry_t *entry;
-	void *earg;
-
-	if (event->type == KEY_PRESS &&
-	    (event->mods & (KM_CTRL | KM_SHIFT | KM_ALT)) == 0) {
-		if (event->key == KC_ENTER) {
-			/* Confirm */
-			if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-				entry = ui_list_get_cursor(dialog->list);
-				earg = ui_list_entry_get_arg(entry);
-				dialog->cb->bok(dialog, dialog->arg, earg);
-				return;
-			}
-		} else if (event->key == KC_ESCAPE) {
-			/* Cancel */
-			if (dialog->cb != NULL && dialog->cb->bcancel != NULL) {
-				dialog->cb->bcancel(dialog, dialog->arg);
-				return;
-			}
-		}
-	}
-
-	ui_window_def_kbd(window, event);
-}
-
-/** Select dialog OK button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_select_dialog_t *)
- */
-static void ui_select_dialog_bok_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_select_dialog_t *dialog = (ui_select_dialog_t *) arg;
-	ui_list_entry_t *entry;
-	void *earg;
-
-	if (dialog->cb != NULL && dialog->cb->bok != NULL) {
-		entry = ui_list_get_cursor(dialog->list);
-		if (entry != NULL)
-			earg = ui_list_entry_get_arg(entry);
-		else
-			earg = NULL;
-
-		dialog->cb->bok(dialog, dialog->arg, earg);
-	}
-}
-
-/** Select dialog cancel button click handler.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_select_dialog_t *)
- */
-static void ui_select_dialog_bcancel_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_select_dialog_t *dialog = (ui_select_dialog_t *) arg;
-
-	if (dialog->cb != NULL && dialog->cb->bcancel != NULL)
-		dialog->cb->bcancel(dialog, dialog->arg);
-}
-
-/** Select dialog list entry selection handler.
- *
- * @param entry UI list entry
- * @param arg Entry argument
- */
-static void ui_select_dialog_list_selected(ui_list_entry_t *entry, void *arg)
-{
-	ui_list_t *list;
-	ui_select_dialog_t *dialog;
-
-	list = ui_list_entry_get_list(entry);
-	dialog = (ui_select_dialog_t *)ui_list_get_cb_arg(list);
-
-	if (dialog->cb != NULL && dialog->cb->bok != NULL)
-		dialog->cb->bok(dialog, dialog->arg, arg);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/slider.c
===================================================================
--- uspace/lib/ui/src/slider.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,574 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Slider
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/slider.h>
-#include "../private/resource.h"
-#include "../private/slider.h"
-
-/*
- * The kind reader will appreciate that slider button dimensions 23:15
- * are chosen such that, after subtracting the frame width (2 times 1),
- * we get 21:13, which is a good approximation of the golden ratio.
- */
-enum {
-	/** Slider button width */
-	ui_slider_btn_w = 15,
-	/** Slider button height */
-	ui_slider_btn_h = 23,
-	/** Slider button width in text mode */
-	ui_slider_btn_w_text = 3,
-	/** Slider button height in text mode */
-	ui_slider_btn_h_text = 1,
-	/** Slider button frame thickness */
-	ui_slider_btn_frame_thickness = 1,
-	/** Slider button bevel width */
-	ui_slider_btn_bevel_width = 2,
-	/** Slider groove width (total) */
-	ui_slider_groove_width = 4,
-	/** Amount by which slider groove bevel extendeds on each side
-	 * beyond nominal groove length.
-	 */
-	ui_slider_groove_margin = 2
-};
-
-static void ui_slider_ctl_destroy(void *);
-static errno_t ui_slider_ctl_paint(void *);
-static ui_evclaim_t ui_slider_ctl_pos_event(void *, pos_event_t *);
-
-/** Slider control ops */
-ui_control_ops_t ui_slider_ops = {
-	.destroy = ui_slider_ctl_destroy,
-	.paint = ui_slider_ctl_paint,
-	.pos_event = ui_slider_ctl_pos_event
-};
-
-/** Create new slider.
- *
- * @param resource UI resource
- * @param rslider Place to store pointer to new slider
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_slider_create(ui_resource_t *resource, ui_slider_t **rslider)
-{
-	ui_slider_t *slider;
-	errno_t rc;
-
-	slider = calloc(1, sizeof(ui_slider_t));
-	if (slider == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_slider_ops, (void *) slider,
-	    &slider->control);
-	if (rc != EOK) {
-		free(slider);
-		return rc;
-	}
-
-	slider->res = resource;
-	*rslider = slider;
-	return EOK;
-}
-
-/** Destroy slider.
- *
- * @param slider Slider or @c NULL
- */
-void ui_slider_destroy(ui_slider_t *slider)
-{
-	if (slider == NULL)
-		return;
-
-	ui_control_delete(slider->control);
-	free(slider);
-}
-
-/** Get base control from slider.
- *
- * @param slider Slider
- * @return Control
- */
-ui_control_t *ui_slider_ctl(ui_slider_t *slider)
-{
-	return slider->control;
-}
-
-/** Set slider callbacks.
- *
- * @param slider Slider
- * @param cb Slider callbacks
- * @param arg Callback argument
- */
-void ui_slider_set_cb(ui_slider_t *slider, ui_slider_cb_t *cb, void *arg)
-{
-	slider->cb = cb;
-	slider->arg = arg;
-}
-
-/** Set slider rectangle.
- *
- * @param slider Slider
- * @param rect New slider rectangle
- */
-void ui_slider_set_rect(ui_slider_t *slider, gfx_rect_t *rect)
-{
-	slider->rect = *rect;
-}
-
-/** Paint outer slider frame.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-static errno_t ui_slider_paint_frame(ui_resource_t *res, gfx_rect_t *rect,
-    gfx_coord_t thickness, gfx_rect_t *inside)
-{
-	gfx_rect_t drect;
-	errno_t rc;
-
-	rc = gfx_set_color(res->gc, res->btn_frame_color);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x + 1;
-	drect.p0.y = rect->p0.y;
-	drect.p1.x = rect->p1.x - 1;
-	drect.p1.y = rect->p0.y + thickness;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x + 1;
-	drect.p0.y = rect->p1.y - thickness;
-	drect.p1.x = rect->p1.x - 1;
-	drect.p1.y = rect->p1.y;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p0.x;
-	drect.p0.y = rect->p0.y + 1;
-	drect.p1.x = rect->p0.x + thickness;
-	drect.p1.y = rect->p1.y - 1;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	drect.p0.x = rect->p1.x - thickness;
-	drect.p0.y = rect->p0.y + 1;
-	drect.p1.x = rect->p1.x;
-	drect.p1.y = rect->p1.y - 1;
-	rc = gfx_fill_rect(res->gc, &drect);
-	if (rc != EOK)
-		goto error;
-
-	if (inside != NULL) {
-		inside->p0.x = rect->p0.x + thickness;
-		inside->p0.y = rect->p0.y + thickness;
-		inside->p1.x = rect->p1.x - thickness;
-		inside->p1.y = rect->p1.y - thickness;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint outset slider bevel.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-static errno_t ui_slider_paint_outset(ui_slider_t *slider,
-    gfx_rect_t *rect, gfx_rect_t *inside)
-{
-	return ui_paint_bevel(slider->res->gc, rect,
-	    slider->res->btn_highlight_color,
-	    slider->res->btn_shadow_color, ui_slider_btn_bevel_width, inside);
-}
-
-/** Determine slider button rectagle.
- *
- * @param slider Slider
- */
-static void ui_slider_btn_rect(ui_slider_t *slider, gfx_rect_t *rect)
-{
-	gfx_coord2_t pos;
-
-	pos.x = slider->rect.p0.x + slider->pos;
-	pos.y = slider->rect.p0.y;
-
-	rect->p0.x = pos.x;
-	rect->p0.y = pos.y;
-
-	if (slider->res->textmode) {
-		rect->p1.x = pos.x + ui_slider_btn_w_text;
-		rect->p1.y = pos.y + ui_slider_btn_h_text;
-	} else {
-		rect->p1.x = pos.x + ui_slider_btn_w;
-		rect->p1.y = pos.y + ui_slider_btn_h;
-	}
-}
-
-/** Determine slider length.
- *
- * @param slider Slider
- * @return Slider length in pixels
- */
-gfx_coord_t ui_slider_length(ui_slider_t *slider)
-{
-	gfx_coord2_t dims;
-	gfx_coord_t w;
-
-	gfx_rect_dims(&slider->rect, &dims);
-	w = slider->res->textmode ? ui_slider_btn_w_text :
-	    ui_slider_btn_w;
-	return dims.x - w;
-}
-
-/** Paint slider in graphics mode.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-errno_t ui_slider_paint_gfx(ui_slider_t *slider)
-{
-	gfx_coord2_t pos;
-	gfx_coord_t length;
-	gfx_rect_t rect;
-	gfx_rect_t brect;
-	gfx_rect_t irect;
-	errno_t rc;
-
-	/* Paint slider groove */
-
-	pos = slider->rect.p0;
-	length = ui_slider_length(slider);
-
-	rect.p0.x = pos.x + ui_slider_btn_w / 2 - ui_slider_groove_margin;
-	rect.p0.y = pos.y + ui_slider_btn_h / 2 - ui_slider_groove_width / 2;
-	rect.p1.x = pos.x + ui_slider_btn_w / 2 + length +
-	    ui_slider_groove_margin;
-	rect.p1.y = pos.y + ui_slider_btn_h / 2 + ui_slider_groove_width / 2;
-
-	rc = ui_paint_inset_frame(slider->res, &rect, NULL);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint slider button */
-
-	ui_slider_btn_rect(slider, &rect);
-
-	rc = ui_slider_paint_frame(slider->res, &rect,
-	    ui_slider_btn_frame_thickness, &brect);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_slider_paint_outset(slider, &brect, &irect);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(slider->res->gc, slider->res->btn_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(slider->res->gc, &irect);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(slider->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint slider in text mode.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-errno_t ui_slider_paint_text(ui_slider_t *slider)
-{
-	gfx_coord2_t pos;
-	gfx_text_fmt_t fmt;
-	gfx_coord_t w, i;
-	char *buf;
-	const char *gchar;
-	size_t gcharsz;
-	errno_t rc;
-
-	/* Paint slider groove */
-
-	pos = slider->rect.p0;
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = slider->res->font;
-	fmt.color = slider->res->wnd_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	w = slider->rect.p1.x - slider->rect.p0.x;
-	gchar = "\u2550";
-	gcharsz = str_size(gchar);
-
-	buf = malloc(w * gcharsz + 1);
-	if (buf == NULL)
-		return ENOMEM;
-
-	for (i = 0; i < w; i++)
-		str_cpy(buf + i * gcharsz, (w - i) * gcharsz + 1, gchar);
-	buf[w * gcharsz] = '\0';
-
-	rc = gfx_puttext(&pos, &fmt, buf);
-	free(buf);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint slider button */
-
-	pos.x += slider->pos;
-
-	rc = gfx_puttext(&pos, &fmt, "[O]");
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_update(slider->res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint slider.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-errno_t ui_slider_paint(ui_slider_t *slider)
-{
-	if (slider->res->textmode)
-		return ui_slider_paint_text(slider);
-	else
-		return ui_slider_paint_gfx(slider);
-}
-
-/** Clear slider button.
- *
- * @param slider Slider
- * @return EOK on success or an error code
- */
-errno_t ui_slider_btn_clear(ui_slider_t *slider)
-{
-	gfx_rect_t rect;
-	errno_t rc;
-
-	/* No need to clear button in text mode */
-	if (slider->res->textmode)
-		return EOK;
-
-	ui_slider_btn_rect(slider, &rect);
-
-	rc = gfx_set_color(slider->res->gc, slider->res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(slider->res->gc, &rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Press down slider.
- *
- * @param slider Slider
- * @param pos Pointer position
- */
-void ui_slider_press(ui_slider_t *slider, gfx_coord2_t *pos)
-{
-	if (slider->held)
-		return;
-
-	slider->held = true;
-	slider->press_pos = *pos;
-	slider->last_pos = slider->pos;
-
-	(void) ui_slider_paint(slider);
-}
-
-/** Release slider.
- *
- * @param slider Slider
- * @param pos Pointer position
- */
-void ui_slider_release(ui_slider_t *slider, gfx_coord2_t *pos)
-{
-	if (!slider->held)
-		return;
-
-	ui_slider_update(slider, pos);
-	slider->held = false;
-}
-
-/** Pointer moved.
- *
- * @param slider Slider
- * @param pos New pointer position
- */
-void ui_slider_update(ui_slider_t *slider, gfx_coord2_t *pos)
-{
-	gfx_coord_t spos;
-	gfx_coord_t length;
-
-	if (slider->held) {
-		spos = slider->last_pos + pos->x - slider->press_pos.x;
-		length = ui_slider_length(slider);
-		if (spos < 0)
-			spos = 0;
-		if (spos > length)
-			spos = length;
-
-		if (spos != slider->pos) {
-			(void) ui_slider_btn_clear(slider);
-			slider->pos = spos;
-			(void) ui_slider_paint(slider);
-			ui_slider_moved(slider, spos);
-		}
-	}
-}
-
-/** Slider was moved.
- *
- * @param slider Slider
- */
-void ui_slider_moved(ui_slider_t *slider, gfx_coord_t pos)
-{
-	if (slider->cb != NULL && slider->cb->moved != NULL)
-		slider->cb->moved(slider, slider->arg, pos);
-}
-
-/** Handle slider position event.
- *
- * @param slider Slider
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_slider_pos_event(ui_slider_t *slider, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-
-	switch (event->type) {
-	case POS_PRESS:
-		ui_slider_btn_rect(slider, &rect);
-		if (gfx_pix_inside_rect(&pos, &rect)) {
-			ui_slider_press(slider, &pos);
-			slider->press_pos = pos;
-			return ui_claimed;
-		}
-		break;
-	case POS_RELEASE:
-		if (slider->held) {
-			ui_slider_release(slider, &pos);
-			return ui_claimed;
-		}
-		break;
-	case POS_UPDATE:
-		ui_slider_update(slider, &pos);
-		break;
-	case POS_DCLICK:
-		break;
-	}
-
-	return ui_unclaimed;
-}
-
-/** Destroy slider control.
- *
- * @param arg Argument (ui_slider_t *)
- */
-void ui_slider_ctl_destroy(void *arg)
-{
-	ui_slider_t *slider = (ui_slider_t *) arg;
-
-	ui_slider_destroy(slider);
-}
-
-/** Paint slider control.
- *
- * @param arg Argument (ui_slider_t *)
- * @return EOK on success or an error code
- */
-errno_t ui_slider_ctl_paint(void *arg)
-{
-	ui_slider_t *slider = (ui_slider_t *) arg;
-
-	return ui_slider_paint(slider);
-}
-
-/** Handle slider control position event.
- *
- * @param arg Argument (ui_slider_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_slider_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_slider_t *slider = (ui_slider_t *) arg;
-
-	return ui_slider_pos_event(slider, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/tab.c
===================================================================
--- uspace/lib/ui/src/tab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,671 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <uchar.h>
-#include <ui/control.h>
-#include <ui/paint.h>
-#include <ui/popup.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/resource.h>
-#include <ui/window.h>
-#include "../private/control.h"
-#include "../private/tab.h"
-#include "../private/tabset.h"
-#include "../private/resource.h"
-
-enum {
-	/** Horizontal margin before first tab handle */
-	tab_start_hmargin = 6,
-	/** Horizontal margin before first tab handle in text mode */
-	tab_start_hmargin_text = 1,
-	/** Tab handle horizontal internal padding */
-	tab_handle_hpad = 6,
-	/** Tab handle top internal padding */
-	tab_handle_top_pad = 5,
-	/** Tab handle bottom internal padding */
-	tab_handle_bottom_pad = 5,
-	/** Tab handle horizontal internal padding in text mode */
-	tab_handle_hpad_text = 1,
-	/** Tab handle top internal padding in text mode */
-	tab_handle_top_pad_text = 0,
-	/** Tab handle bototm internal padding in text mode */
-	tab_handle_bottom_pad_text = 1,
-	/** Tab handle chamfer */
-	tab_handle_chamfer = 3,
-	/** Number of pixels to pull active handle up by */
-	tab_handle_pullup = 2,
-	/** Tab frame horizontal thickness */
-	tab_frame_w = 2,
-	/** Tab frame vertical thickness */
-	tab_frame_h = 2,
-	/** Tab frame horizontal thickness in text mode */
-	tab_frame_w_text = 1,
-	/** Tab frame horizontal thickness in text mode */
-	tab_frame_h_text = 1
-};
-
-/** Selected tab handle box characters */
-static ui_box_chars_t sel_tab_box_chars = {
-	{
-		{ "\u250c", "\u2500", "\u2510" },
-		{ "\u2502", " ",      "\u2502" },
-		{ "\u2518", " ",      "\u2514" }
-	}
-};
-
-/** Not selected tab handle box characters */
-static ui_box_chars_t unsel_tab_box_chars = {
-	{
-		{ "\u250c", "\u2500", "\u2510" },
-		{ "\u2502", " ",      "\u2502" },
-		{ "\u2534", "\u2500", "\u2534" }
-	}
-};
-
-/** Create new tab.
- *
- * @param tabset Tab set
- * @param caption Caption
- * @param rtab Place to store pointer to new tab
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_tab_create(ui_tab_set_t *tabset, const char *caption,
-    ui_tab_t **rtab)
-{
-	ui_tab_t *tab;
-	ui_tab_t *prev;
-
-	tab = calloc(1, sizeof(ui_tab_t));
-	if (tab == NULL)
-		return ENOMEM;
-
-	tab->caption = str_dup(caption);
-	if (tab->caption == NULL) {
-		free(tab);
-		return ENOMEM;
-	}
-
-	prev = ui_tab_last(tabset);
-	if (prev != NULL)
-		tab->xoff = prev->xoff + ui_tab_handle_width(prev);
-	else
-		tab->xoff = tabset->res->textmode ?
-		    tab_start_hmargin_text : tab_start_hmargin;
-
-	tab->tabset = tabset;
-	list_append(&tab->ltabs, &tabset->tabs);
-
-	/* This is the first tab. Select it. */
-	if (tabset->selected == NULL)
-		tabset->selected = tab;
-
-	*rtab = tab;
-	return EOK;
-}
-
-/** Destroy tab.
- *
- * @param tab Tab or @c NULL
- */
-void ui_tab_destroy(ui_tab_t *tab)
-{
-	if (tab == NULL)
-		return;
-
-	/* Destroy content */
-	ui_control_destroy(tab->content);
-
-	list_remove(&tab->ltabs);
-	free(tab->caption);
-	free(tab);
-}
-
-/** Get first tab in tab bar.
- *
- * @param tabset Tab set
- * @return First tab or @c NULL if there is none
- */
-ui_tab_t *ui_tab_first(ui_tab_set_t *tabset)
-{
-	link_t *link;
-
-	link = list_first(&tabset->tabs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_tab_t, ltabs);
-}
-
-/** Get next tab in tab bar.
- *
- * @param cur Current tab
- * @return Next tab or @c NULL if @a cur is the last one
- */
-ui_tab_t *ui_tab_next(ui_tab_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->ltabs, &cur->tabset->tabs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_tab_t, ltabs);
-}
-
-/** Get last tab in tab bar.
- *
- * @param tabset Tab set
- * @return Last tab or @c NULL if there is none
- */
-ui_tab_t *ui_tab_last(ui_tab_set_t *tabset)
-{
-	link_t *link;
-
-	link = list_last(&tabset->tabs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_tab_t, ltabs);
-}
-
-/** Get previous tab in tab bar.
- *
- * @param cur Current tab
- * @return Previous tab or @c NULL if @a cur is the fist one
- */
-ui_tab_t *ui_tab_prev(ui_tab_t *cur)
-{
-	link_t *link;
-
-	link = list_prev(&cur->ltabs, &cur->tabset->tabs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_tab_t, ltabs);
-}
-
-/** Determine if tab is selected.
- *
- * @param tab Tab
- * @return @c true iff tab is selected
- */
-bool ui_tab_is_selected(ui_tab_t *tab)
-{
-	return tab->tabset->selected == tab;
-}
-
-/** Add control to tab.
- *
- * Only one control can be added to a window. If more than one control
- * is added, the results are undefined.
- *
- * @param tab Tab
- * @param control Control
- */
-void ui_tab_add(ui_tab_t *tab, ui_control_t *control)
-{
-	assert(tab->content == NULL);
-
-	tab->content = control;
-	control->elemp = (void *) tab;
-}
-
-/** Remove control from tab.
- *
- * @param tab Tab
- * @param control Control
- */
-void ui_tab_remove(ui_tab_t *tab, ui_control_t *control)
-{
-	assert(tab->content == control);
-	assert((ui_tab_t *) control->elemp == tab);
-
-	tab->content = NULL;
-	control->elemp = NULL;
-}
-
-/** Get tab handle width.
- *
- * @param tab Tab
- * @return Handle width in pixels
- */
-gfx_coord_t ui_tab_handle_width(ui_tab_t *tab)
-{
-	ui_resource_t *res;
-	gfx_coord_t frame_w;
-	gfx_coord_t handle_hpad;
-	gfx_coord_t text_w;
-
-	res = tab->tabset->res;
-	if (!res->textmode) {
-		frame_w = tab_frame_w;
-		handle_hpad = tab_handle_hpad;
-	} else {
-		frame_w = tab_frame_w_text;
-		handle_hpad = tab_handle_hpad_text;
-	}
-
-	text_w = ui_text_width(tab->tabset->res->font, tab->caption);
-	return 2 * frame_w + 2 * handle_hpad + text_w;
-}
-
-/** Get tab handle height.
- *
- * @param tab Tab
- * @return Handle height in pixels
- */
-gfx_coord_t ui_tab_handle_height(ui_tab_t *tab)
-{
-	gfx_coord_t frame_h;
-	gfx_coord_t handle_top_pad;
-	gfx_coord_t handle_bottom_pad;
-	gfx_font_metrics_t metrics;
-	ui_resource_t *res;
-
-	res = tab->tabset->res;
-	gfx_font_get_metrics(tab->tabset->res->font, &metrics);
-
-	if (!res->textmode) {
-		frame_h = tab_frame_h;
-		handle_top_pad = tab_handle_top_pad;
-		handle_bottom_pad = tab_handle_bottom_pad;
-	} else {
-		frame_h = tab_frame_h_text;
-		handle_top_pad = tab_handle_top_pad_text;
-		handle_bottom_pad = tab_handle_bottom_pad_text;
-	}
-
-	return frame_h + handle_top_pad + metrics.ascent +
-	    metrics.descent + 1 + handle_bottom_pad;
-}
-
-/** Get tab geometry.
- *
- * @param tab Tab
- * @param geom Structure to fill in with computed geometry
- */
-void ui_tab_get_geom(ui_tab_t *tab, ui_tab_geom_t *geom)
-{
-	gfx_coord_t handle_w;
-	gfx_coord_t handle_h;
-	gfx_coord_t pullup;
-	gfx_coord_t frame_w;
-	gfx_coord_t frame_h;
-	gfx_coord_t handle_hpad;
-	gfx_coord_t handle_top_pad;
-	ui_resource_t *res;
-
-	res = tab->tabset->res;
-
-	handle_w = ui_tab_handle_width(tab);
-	handle_h = ui_tab_handle_height(tab);
-	pullup = res->textmode ? 0 : tab_handle_pullup;
-
-	if (!res->textmode) {
-		frame_w = tab_frame_w;
-		frame_h = tab_frame_h;
-		handle_hpad = tab_handle_hpad;
-		handle_top_pad = tab_handle_top_pad;
-	} else {
-		frame_w = tab_frame_w_text;
-		frame_h = tab_frame_h_text;
-		handle_hpad = tab_handle_hpad_text;
-		handle_top_pad = tab_handle_top_pad_text;
-	}
-
-	/* Entire handle area */
-	geom->handle_area.p0.x = tab->tabset->rect.p0.x + tab->xoff;
-	geom->handle_area.p0.y = tab->tabset->rect.p0.y;
-	geom->handle_area.p1.x = geom->handle_area.p0.x + handle_w;
-	geom->handle_area.p1.y = geom->handle_area.p0.y + handle_h + pullup;
-
-	geom->handle = geom->handle_area;
-
-	/* If handle is selected */
-	if (!ui_tab_is_selected(tab)) {
-		/* Push top of handle down a bit */
-		geom->handle.p0.y += pullup;
-		/* Do not paint background over tab body frame */
-		geom->handle_area.p1.y -= pullup;
-	}
-
-	/* Caption text position */
-	geom->text_pos.x = geom->handle.p0.x + frame_w + handle_hpad;
-	geom->text_pos.y = geom->handle.p0.y + frame_h + handle_top_pad;
-
-	/* Tab body */
-	geom->body.p0.x = tab->tabset->rect.p0.x;
-	geom->body.p0.y = tab->tabset->rect.p0.y + handle_h - frame_h +
-	    pullup;
-	geom->body.p1 = tab->tabset->rect.p1;
-}
-
-/** Get UI resource from tab.
- *
- * @param tab Tab
- * @return UI resource
- */
-ui_resource_t *ui_tab_get_res(ui_tab_t *tab)
-{
-	return tab->tabset->res;
-}
-
-/** Paint tab handle frame.
- *
- * @param gc Graphic context
- * @param rect Rectangle
- * @param chamfer Chamfer
- * @param hi_color Highlight color
- * @param sh_color Shadow color
- * @param selected Tab is selected
- * @param irect Place to store interior rectangle
- * @return EOK on success or an error code
- */
-errno_t ui_tab_paint_handle_frame(gfx_context_t *gc, gfx_rect_t *rect,
-    gfx_coord_t chamfer, gfx_color_t *hi_color, gfx_color_t *sh_color,
-    bool selected, gfx_rect_t *irect)
-{
-	gfx_rect_t r;
-	gfx_coord_t i;
-	errno_t rc;
-
-	rc = gfx_set_color(gc, hi_color);
-	if (rc != EOK)
-		goto error;
-
-	/* Left side */
-	r.p0.x = rect->p0.x;
-	r.p0.y = rect->p0.y + chamfer;
-	r.p1.x = rect->p0.x + 1;
-	r.p1.y = rect->p1.y - 2;
-	rc = gfx_fill_rect(gc, &r);
-	if (rc != EOK)
-		goto error;
-
-	/* Top-left chamfer */
-	for (i = 1; i < chamfer; i++) {
-		r.p0.x = rect->p0.x + i;
-		r.p0.y = rect->p0.y + chamfer - i;
-		r.p1.x = r.p0.x + 1;
-		r.p1.y = r.p0.y + 1;
-		rc = gfx_fill_rect(gc, &r);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Top side */
-	r.p0.x = rect->p0.x + chamfer;
-	r.p0.y = rect->p0.y;
-	r.p1.x = rect->p1.x - chamfer;
-	r.p1.y = rect->p0.y + 1;
-	rc = gfx_fill_rect(gc, &r);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_set_color(gc, sh_color);
-	if (rc != EOK)
-		goto error;
-
-	/* Top-right chamfer */
-	for (i = 1; i < chamfer; i++) {
-		r.p0.x = rect->p1.x - 1 - i;
-		r.p0.y = rect->p0.y + chamfer - i;
-		r.p1.x = r.p0.x + 1;
-		r.p1.y = r.p0.y + 1;
-		rc = gfx_fill_rect(gc, &r);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* Right side */
-	r.p0.x = rect->p1.x - 1;
-	r.p0.y = rect->p0.y + chamfer;
-	r.p1.x = rect->p1.x;
-	r.p1.y = rect->p1.y - 2;
-	rc = gfx_fill_rect(gc, &r);
-	if (rc != EOK)
-		goto error;
-
-	irect->p0.x = rect->p0.x + 1;
-	irect->p0.y = rect->p0.y + 1;
-	irect->p1.x = rect->p1.x - 1;
-	irect->p1.y = rect->p1.y;
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint tab body frame.
- *
- * @param tab Tab
- * @return EOK on success or an error code
- */
-errno_t ui_tab_paint_body_frame(ui_tab_t *tab)
-{
-	gfx_rect_t bg_rect;
-	ui_tab_geom_t geom;
-	ui_resource_t *res;
-	errno_t rc;
-
-	res = ui_tab_get_res(tab);
-	ui_tab_get_geom(tab, &geom);
-
-	if (!res->textmode) {
-		rc = ui_paint_outset_frame(res, &geom.body, &bg_rect);
-		if (rc != EOK)
-			goto error;
-	} else {
-		rc = ui_paint_text_box(res, &geom.body, ui_box_single,
-		    res->wnd_face_color);
-		if (rc != EOK)
-			goto error;
-
-		bg_rect.p0.x = geom.body.p0.x + 1;
-		bg_rect.p0.y = geom.body.p0.y + 1;
-		bg_rect.p1.x = geom.body.p1.x - 1;
-		bg_rect.p1.y = geom.body.p1.y - 1;
-	}
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &bg_rect);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint tab frame.
- *
- * @param tab Tab
- * @return EOK on success or an error code
- */
-errno_t ui_tab_paint_frame(ui_tab_t *tab)
-{
-	gfx_rect_t r0;
-	ui_tab_geom_t geom;
-	ui_resource_t *res;
-	errno_t rc;
-
-	res = ui_tab_get_res(tab);
-	ui_tab_get_geom(tab, &geom);
-
-	/* Paint handle background */
-
-	rc = gfx_set_color(res->gc, res->wnd_face_color);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_fill_rect(res->gc, &geom.handle_area);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint handle frame */
-	if (!res->textmode) {
-		rc = ui_tab_paint_handle_frame(res->gc, &geom.handle,
-		    tab_handle_chamfer, res->wnd_frame_hi_color, res->wnd_frame_sh_color,
-		    ui_tab_is_selected(tab), &r0);
-		if (rc != EOK)
-			goto error;
-
-		rc = ui_tab_paint_handle_frame(res->gc, &r0, tab_handle_chamfer - 1,
-		    res->wnd_highlight_color, res->wnd_shadow_color,
-		    ui_tab_is_selected(tab), &r0);
-		if (rc != EOK)
-			goto error;
-	} else {
-		rc = ui_paint_text_box_custom(res, &geom.handle,
-		    ui_tab_is_selected(tab) ? &sel_tab_box_chars :
-		    &unsel_tab_box_chars, res->wnd_face_color);
-		if (rc != EOK)
-			goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Paint tab.
- *
- * @param tab Tab
- * @return EOK on success or an error code
- */
-errno_t ui_tab_paint(ui_tab_t *tab)
-{
-	gfx_text_fmt_t fmt;
-	ui_tab_geom_t geom;
-	ui_resource_t *res;
-	errno_t rc;
-
-	res = ui_tab_get_res(tab);
-	ui_tab_get_geom(tab, &geom);
-
-	rc = ui_tab_paint_frame(tab);
-	if (rc != EOK)
-		goto error;
-
-	/* Paint caption */
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = res->font;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-	fmt.color = res->wnd_text_color;
-
-	rc = gfx_puttext(&geom.text_pos, &fmt, tab->caption);
-	if (rc != EOK)
-		goto error;
-
-	if (tab->content != NULL && ui_tab_is_selected(tab)) {
-		/* Paint content */
-		rc = ui_control_paint(tab->content);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Handle position event in tab.
- *
- * @param tab Tab
- * @param event Position event
- * @return ui_claimed iff the event was claimed
- */
-ui_evclaim_t ui_tab_pos_event(ui_tab_t *tab, pos_event_t *event)
-{
-	ui_tab_geom_t geom;
-	gfx_coord2_t epos;
-
-	ui_tab_get_geom(tab, &geom);
-	epos.x = event->hpos;
-	epos.y = event->vpos;
-
-	/* Event inside tab handle? */
-	if (gfx_pix_inside_rect(&epos, &geom.handle)) {
-		/* Select tab? */
-		if (event->type == POS_PRESS && event->btn_num == 1 &&
-		    !ui_tab_is_selected(tab))
-			ui_tab_set_select(tab->tabset, tab);
-
-		/* Claim event */
-		return ui_claimed;
-	}
-
-	/* Deliver event to content control, if any */
-	if (ui_tab_is_selected(tab) && tab->content != NULL)
-		return ui_control_pos_event(tab->content, event);
-
-	return ui_unclaimed;
-}
-
-/** Handle keyboard event in tab.
- *
- * @param tab Tab
- * @param event Keyboard event
- * @return ui_claimed iff the event was claimed
- */
-ui_evclaim_t ui_tab_kbd_event(ui_tab_t *tab, kbd_event_t *event)
-{
-	/* Deliver event to content control, if any */
-	if (ui_tab_is_selected(tab) && tab->content != NULL)
-		return ui_control_kbd_event(tab->content, event);
-
-	return ui_unclaimed;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/tabset.c
===================================================================
--- uspace/lib/ui/src/tabset.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,278 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Tab set
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <gfx/render.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <ui/control.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/window.h>
-#include "../private/tab.h"
-#include "../private/tabset.h"
-#include "../private/resource.h"
-
-static void ui_tab_set_ctl_destroy(void *);
-static errno_t ui_tab_set_ctl_paint(void *);
-static ui_evclaim_t ui_tab_set_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t ui_tab_set_ctl_pos_event(void *, pos_event_t *);
-
-/** Tab set control ops */
-ui_control_ops_t ui_tab_set_ops = {
-	.destroy = ui_tab_set_ctl_destroy,
-	.paint = ui_tab_set_ctl_paint,
-	.kbd_event = ui_tab_set_ctl_kbd_event,
-	.pos_event = ui_tab_set_ctl_pos_event
-};
-
-/** Create new tab set.
- *
- * @param res UI resource
- * @param rtabset Place to store pointer to new tab set
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_tab_set_create(ui_resource_t *res, ui_tab_set_t **rtabset)
-{
-	ui_tab_set_t *tabset;
-	errno_t rc;
-
-	tabset = calloc(1, sizeof(ui_tab_set_t));
-	if (tabset == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_tab_set_ops, (void *) tabset, &tabset->control);
-	if (rc != EOK) {
-		free(tabset);
-		return rc;
-	}
-
-	tabset->res = res;
-	list_initialize(&tabset->tabs);
-	*rtabset = tabset;
-	return EOK;
-}
-
-/** Destroy tab set
- *
- * @param tabset Tab set or @c NULL
- */
-void ui_tab_set_destroy(ui_tab_set_t *tabset)
-{
-	ui_tab_t *tab;
-
-	if (tabset == NULL)
-		return;
-
-	/* Destroy tabs */
-	tab = ui_tab_first(tabset);
-	while (tab != NULL) {
-		ui_tab_destroy(tab);
-		tab = ui_tab_first(tabset);
-	}
-
-	ui_control_delete(tabset->control);
-	free(tabset);
-}
-
-/** Get base control from tab set.
- *
- * @param tabset Tab set
- * @return Control
- */
-ui_control_t *ui_tab_set_ctl(ui_tab_set_t *tabset)
-{
-	return tabset->control;
-}
-
-/** Set tab set rectangle.
- *
- * @param tabset Tab set
- * @param rect New tab set rectangle
- */
-void ui_tab_set_set_rect(ui_tab_set_t *tabset, gfx_rect_t *rect)
-{
-	tabset->rect = *rect;
-}
-
-/** Paint tab set.
- *
- * @param tabset Tab set
- * @return EOK on success or an error code
- */
-errno_t ui_tab_set_paint(ui_tab_set_t *tabset)
-{
-	ui_resource_t *res;
-	ui_tab_t *tab;
-	errno_t rc;
-
-	res = tabset->res;
-
-	if (tabset->selected != NULL) {
-		rc = ui_tab_paint_body_frame(tabset->selected);
-		if (rc != EOK)
-			goto error;
-	}
-
-	tab = ui_tab_first(tabset);
-	while (tab != NULL) {
-		rc = ui_tab_paint(tab);
-		if (rc != EOK)
-			return rc;
-
-		tab = ui_tab_next(tab);
-	}
-
-	rc = gfx_update(res->gc);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Select or deselect tab from tab set.
- *
- * Select @a tab. If @a tab is @c NULL or it is already selected,
- * then select none.
- *
- * @param tabset Tab set
- * @param tab Tab to select (or deselect if selected) or @c NULL
- */
-void ui_tab_set_select(ui_tab_set_t *tabset, ui_tab_t *tab)
-{
-	tabset->selected = tab;
-	(void) ui_tab_set_paint(tabset);
-}
-
-/** Handle tab set keyboard event.
- *
- * @param tabset Tab set
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_tab_set_kbd_event(ui_tab_set_t *tabset, kbd_event_t *event)
-{
-	ui_tab_t *tab;
-	ui_evclaim_t claim;
-
-	tab = ui_tab_first(tabset);
-	while (tab != NULL) {
-		claim = ui_tab_kbd_event(tab, event);
-		if (claim == ui_claimed)
-			return ui_claimed;
-
-		tab = ui_tab_next(tab);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle tab set position event.
- *
- * @param tabset Tab set
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-ui_evclaim_t ui_tab_set_pos_event(ui_tab_set_t *tabset, pos_event_t *event)
-{
-	ui_tab_t *tab;
-	ui_evclaim_t claim;
-
-	tab = ui_tab_first(tabset);
-	while (tab != NULL) {
-		claim = ui_tab_pos_event(tab, event);
-		if (claim == ui_claimed)
-			return ui_claimed;
-
-		tab = ui_tab_next(tab);
-	}
-
-	return ui_unclaimed;
-}
-
-/** Destroy tab set control.
- *
- * @param arg Argument (ui_tab_set_t *)
- */
-static void ui_tab_set_ctl_destroy(void *arg)
-{
-	ui_tab_set_t *tabset = (ui_tab_set_t *) arg;
-
-	ui_tab_set_destroy(tabset);
-}
-
-/** Paint tab set control.
- *
- * @param arg Argument (ui_tab_set_t *)
- * @return EOK on success or an error code
- */
-static errno_t ui_tab_set_ctl_paint(void *arg)
-{
-	ui_tab_set_t *tabset = (ui_tab_set_t *) arg;
-
-	return ui_tab_set_paint(tabset);
-}
-
-/** Handle tab set control keyboard event.
- *
- * @param arg Argument (ui_tab_set_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-static ui_evclaim_t ui_tab_set_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_tab_set_t *tabset = (ui_tab_set_t *) arg;
-
-	return ui_tab_set_kbd_event(tabset, event);
-}
-
-/** Handle tab set control position event.
- *
- * @param arg Argument (ui_tab_set_t *)
- * @param pos_event Position event
- * @return @c ui_claimed iff the event is claimed
- */
-static ui_evclaim_t ui_tab_set_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_tab_set_t *tabset = (ui_tab_set_t *) arg;
-
-	return ui_tab_set_pos_event(tabset, event);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/testctl.c
===================================================================
--- uspace/lib/ui/src/testctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,159 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Test control
- *
- * Test control allows to read the arguments of and inject the responses
- * to all control methods.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/testctl.h>
-#include "../private/testctl.h"
-
-static void test_ctl_destroy(void *);
-static errno_t test_ctl_paint(void *);
-static ui_evclaim_t test_ctl_kbd_event(void *, kbd_event_t *);
-static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
-static void test_ctl_unfocus(void *, unsigned);
-
-ui_control_ops_t ui_test_ctl_ops = {
-	.destroy = test_ctl_destroy,
-	.paint = test_ctl_paint,
-	.kbd_event = test_ctl_kbd_event,
-	.pos_event = test_ctl_pos_event,
-	.unfocus = test_ctl_unfocus
-};
-
-static void test_ctl_destroy(void *arg)
-{
-	ui_test_ctl_t *testctl = (ui_test_ctl_t *)arg;
-	ui_tc_resp_t *resp = testctl->resp;
-
-	resp->destroy = true;
-	ui_test_ctl_destroy(testctl);
-}
-
-static errno_t test_ctl_paint(void *arg)
-{
-	ui_test_ctl_t *testctl = (ui_test_ctl_t *)arg;
-	ui_tc_resp_t *resp = testctl->resp;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static ui_evclaim_t test_ctl_kbd_event(void *arg, kbd_event_t *event)
-{
-	ui_test_ctl_t *testctl = (ui_test_ctl_t *)arg;
-	ui_tc_resp_t *resp = testctl->resp;
-
-	resp->kbd = true;
-	resp->kevent = *event;
-
-	return resp->claim;
-}
-
-static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	ui_test_ctl_t *testctl = (ui_test_ctl_t *)arg;
-	ui_tc_resp_t *resp = testctl->resp;
-
-	resp->pos = true;
-	resp->pevent = *event;
-
-	return resp->claim;
-}
-
-static void test_ctl_unfocus(void *arg, unsigned nfocus)
-{
-	ui_test_ctl_t *testctl = (ui_test_ctl_t *)arg;
-	ui_tc_resp_t *resp = testctl->resp;
-
-	resp->unfocus = true;
-	resp->unfocus_nfocus = nfocus;
-}
-
-/** Create new test control.
- *
- * @param resp Response structure
- * @param rtest Place to store pointer to new test control
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_test_ctl_create(ui_tc_resp_t *resp, ui_test_ctl_t **rtest)
-{
-	ui_test_ctl_t *test;
-	errno_t rc;
-
-	test = calloc(1, sizeof(ui_test_ctl_t));
-	if (test == NULL)
-		return ENOMEM;
-
-	rc = ui_control_new(&ui_test_ctl_ops, (void *)test, &test->control);
-	if (rc != EOK) {
-		free(test);
-		return rc;
-	}
-
-	test->resp = resp;
-	*rtest = test;
-	return EOK;
-}
-
-/** Destroy test control.
- *
- * @param test Test control or @c NULL
- */
-void ui_test_ctl_destroy(ui_test_ctl_t *test)
-{
-	if (test == NULL)
-		return;
-
-	ui_control_delete(test->control);
-	free(test);
-}
-
-/** Get base control from test control.
- *
- * @param test Test control
- * @return Control
- */
-ui_control_t *ui_test_ctl_ctl(ui_test_ctl_t *test)
-{
-	return test->control;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/ui.c
===================================================================
--- uspace/lib/ui/src/ui.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,671 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file User interface
- */
-
-#include <adt/list.h>
-#include <ctype.h>
-#include <display.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <gfx/color.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <io/console.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-#include <types/common.h>
-#include <ui/clickmatic.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include "../private/wdecor.h"
-#include "../private/window.h"
-#include "../private/ui.h"
-
-/** Parse output specification.
- *
- * Output specification has the form <proto>@<service> where proto is
- * eiher 'disp' for display service, 'cons' for console, 'null'
- * for dummy output. Service is a location ID service name (e.g. hid/display).
- *
- * @param ospec Output specification
- * @param ws Place to store window system type (protocol)
- * @param osvc Place to store pointer to output service name
- * @param ridev_id Place to store input device ID
- * @return EOK on success, EINVAL if syntax is invalid, ENOMEM if out of
- *         memory
- */
-static errno_t ui_ospec_parse(const char *ospec, ui_winsys_t *ws,
-    char **osvc, sysarg_t *ridev_id)
-{
-	const char *cp;
-	const char *qm;
-	const char *endptr;
-	uint64_t idev_id;
-	errno_t rc;
-
-	*ridev_id = 0;
-
-	cp = ospec;
-	while (isalpha(*cp))
-		++cp;
-
-	/* Window system / protocol */
-	if (*cp == '@') {
-		if (str_lcmp(ospec, "disp@", str_length("disp@")) == 0) {
-			*ws = ui_ws_display;
-		} else if (str_lcmp(ospec, "cons@", str_length("cons@")) == 0) {
-			*ws = ui_ws_console;
-		} else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) {
-			*ws = ui_ws_null;
-		} else if (str_lcmp(ospec, "@", str_length("@")) == 0) {
-			*ws = ui_ws_any;
-		} else {
-			*ws = ui_ws_unknown;
-		}
-
-		++cp;
-	} else {
-		*ws = ui_ws_display;
-	}
-
-	/* Output service is the part before question mark */
-	qm = str_chr(cp, '?');
-	if (qm != NULL) {
-		*osvc = str_ndup(cp, qm - cp);
-	} else {
-		/* No question mark */
-		*osvc = str_dup(cp);
-	}
-
-	if (*osvc == NULL)
-		return ENOMEM;
-
-	if (qm != NULL) {
-		/* The part after the question mark */
-		cp = qm + 1;
-
-		/* Input device ID parameter */
-		if (str_lcmp(cp, "idev=", str_length("idev=")) == 0) {
-			cp += str_length("idev=");
-
-			rc = str_uint64_t(cp, &endptr, 10, false, &idev_id);
-			if (rc != EOK)
-				goto error;
-
-			*ridev_id = idev_id;
-			cp = endptr;
-		}
-	}
-
-	if (*cp != '\0') {
-		rc = EINVAL;
-		goto error;
-	}
-
-	return EOK;
-error:
-	free(*osvc);
-	*osvc = NULL;
-	return rc;
-}
-
-/** Create new user interface.
- *
- * @param ospec Output specification or @c UI_DISPLAY_DEFAULT to use
- *              the default display service, UI_CONSOLE_DEFAULT to use
- *		the default console service, UI_DISPLAY_NULL to use
- *		dummy output.
- * @param rui Place to store pointer to new UI
- * @return EOK on success or an error code
- */
-errno_t ui_create(const char *ospec, ui_t **rui)
-{
-	errno_t rc;
-	display_t *display;
-	console_ctrl_t *console;
-	console_gc_t *cgc;
-	ui_winsys_t ws;
-	char *osvc;
-	sysarg_t cols;
-	sysarg_t rows;
-	sysarg_t idev_id;
-	ui_t *ui;
-
-	rc = ui_ospec_parse(ospec, &ws, &osvc, &idev_id);
-	if (rc != EOK)
-		return rc;
-
-	if (ws == ui_ws_display || ws == ui_ws_any) {
-		rc = display_open((str_cmp(osvc, "") != 0) ? osvc :
-		    DISPLAY_DEFAULT, &display);
-		if (rc != EOK)
-			goto disp_fail;
-
-		rc = ui_create_disp(display, &ui);
-		if (rc != EOK) {
-			display_close(display);
-			goto disp_fail;
-		}
-
-		free(osvc);
-		ui->myoutput = true;
-		ui->idev_id = idev_id;
-		*rui = ui;
-		return EOK;
-	}
-
-disp_fail:
-	if (ws == ui_ws_console || ws == ui_ws_any) {
-		console = console_init(stdin, stdout);
-		if (console == NULL)
-			goto cons_fail;
-
-		rc = console_get_size(console, &cols, &rows);
-		if (rc != EOK) {
-			console_done(console);
-			goto cons_fail;
-		}
-
-		console_cursor_visibility(console, false);
-
-		/* ws == ui_ws_console */
-		rc = ui_create_cons(console, &ui);
-		if (rc != EOK) {
-			console_done(console);
-			goto cons_fail;
-		}
-
-		rc = console_gc_create(console, NULL, &cgc);
-		if (rc != EOK) {
-			ui_destroy(ui);
-			console_done(console);
-			goto cons_fail;
-		}
-
-		free(osvc);
-
-		ui->cgc = cgc;
-		ui->rect.p0.x = 0;
-		ui->rect.p0.y = 0;
-		ui->rect.p1.x = cols;
-		ui->rect.p1.y = rows;
-
-		(void) ui_paint(ui);
-		ui->myoutput = true;
-		*rui = ui;
-		return EOK;
-	}
-
-cons_fail:
-	if (ws == ui_ws_null) {
-		free(osvc);
-		rc = ui_create_disp(NULL, &ui);
-		if (rc != EOK)
-			return rc;
-
-		ui->myoutput = true;
-		*rui = ui;
-		return EOK;
-	}
-
-	free(osvc);
-	return EINVAL;
-}
-
-/** Create new user interface using console service.
- *
- * @param rui Place to store pointer to new UI
- * @return EOK on success or an error code
- */
-errno_t ui_create_cons(console_ctrl_t *console, ui_t **rui)
-{
-	ui_t *ui;
-	errno_t rc;
-
-	ui = calloc(1, sizeof(ui_t));
-	if (ui == NULL)
-		return ENOMEM;
-
-	rc = ui_clickmatic_create(ui, &ui->clickmatic);
-	if (rc != EOK) {
-		free(ui);
-		return rc;
-	}
-
-	ui->console = console;
-	list_initialize(&ui->windows);
-	fibril_mutex_initialize(&ui->lock);
-	*rui = ui;
-	return EOK;
-}
-
-/** Create new user interface using display service.
- *
- * @param disp Display
- * @param rui Place to store pointer to new UI
- * @return EOK on success or an error code
- */
-errno_t ui_create_disp(display_t *disp, ui_t **rui)
-{
-	ui_t *ui;
-	errno_t rc;
-
-	ui = calloc(1, sizeof(ui_t));
-	if (ui == NULL)
-		return ENOMEM;
-
-	rc = ui_clickmatic_create(ui, &ui->clickmatic);
-	if (rc != EOK) {
-		free(ui);
-		return rc;
-	}
-
-	ui->display = disp;
-	list_initialize(&ui->windows);
-	fibril_mutex_initialize(&ui->lock);
-	*rui = ui;
-	return EOK;
-}
-
-/** Destroy user interface.
- *
- * @param ui User interface or @c NULL
- */
-void ui_destroy(ui_t *ui)
-{
-	if (ui == NULL)
-		return;
-
-	if (ui->myoutput) {
-		if (ui->cgc != NULL)
-			console_gc_delete(ui->cgc);
-		if (ui->console != NULL) {
-			console_cursor_visibility(ui->console, true);
-			console_done(ui->console);
-		}
-		if (ui->display != NULL)
-			display_close(ui->display);
-	}
-
-	free(ui);
-}
-
-static void ui_cons_event_process(ui_t *ui, cons_event_t *event)
-{
-	ui_window_t *awnd;
-	ui_evclaim_t claim;
-	pos_event_t pos;
-
-	awnd = ui_window_get_active(ui);
-	if (awnd == NULL)
-		return;
-
-	switch (event->type) {
-	case CEV_KEY:
-		ui_lock(ui);
-		ui_window_send_kbd(awnd, &event->ev.key);
-		ui_unlock(ui);
-		break;
-	case CEV_POS:
-		pos = event->ev.pos;
-		/* Translate event to window-relative coordinates */
-		pos.hpos -= awnd->dpos.x;
-		pos.vpos -= awnd->dpos.y;
-
-		claim = ui_wdecor_pos_event(awnd->wdecor, &pos);
-		/* Note: If event is claimed, awnd might not be valid anymore */
-		if (claim == ui_unclaimed) {
-			ui_lock(ui);
-			ui_window_send_pos(awnd, &pos);
-			ui_unlock(ui);
-		}
-
-		break;
-	case CEV_RESIZE:
-		ui_lock(ui);
-		ui_window_send_resize(awnd);
-		ui_unlock(ui);
-		break;
-	}
-}
-
-/** Execute user interface.
- *
- * Return task exit code of zero and block unitl the application starts
- * the termination process by calling ui_quit(@a ui).
- *
- * @param ui User interface
- */
-void ui_run(ui_t *ui)
-{
-	cons_event_t event;
-	usec_t timeout;
-	errno_t rc;
-
-	/* Only return command prompt if we are running in a separate window */
-	if (ui->display != NULL)
-		task_retval(0);
-
-	while (!ui->quit) {
-		if (ui->console != NULL) {
-			timeout = 100000;
-			rc = console_get_event_timeout(ui->console,
-			    &event, &timeout);
-
-			/* Do we actually have an event? */
-			if (rc == EOK) {
-				ui_cons_event_process(ui, &event);
-			} else if (rc != ETIMEOUT) {
-				/* Error, quit */
-				break;
-			}
-		} else {
-			fibril_usleep(100000);
-		}
-	}
-}
-
-/** Repaint UI (only used in fullscreen mode).
- *
- * This is used when an area is exposed in fullscreen mode.
- *
- * @param ui UI
- * @return @c EOK on success or an error code
- */
-errno_t ui_paint(ui_t *ui)
-{
-	errno_t rc;
-	gfx_context_t *gc;
-	ui_window_t *awnd;
-	gfx_color_t *color = NULL;
-
-	/* In case of null output */
-	if (ui->cgc == NULL)
-		return EOK;
-
-	gc = console_gc_get_ctx(ui->cgc);
-
-	rc = gfx_color_new_ega(0x11, &color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_set_color(gc, color);
-	if (rc != EOK) {
-		gfx_color_delete(color);
-		return rc;
-	}
-
-	rc = gfx_fill_rect(gc, &ui->rect);
-	if (rc != EOK) {
-		gfx_color_delete(color);
-		return rc;
-	}
-
-	gfx_color_delete(color);
-
-	/* XXX Should repaint all windows */
-	awnd = ui_window_get_active(ui);
-	if (awnd == NULL)
-		return EOK;
-
-	rc = ui_wdecor_paint(awnd->wdecor);
-	if (rc != EOK)
-		return rc;
-
-	return ui_window_paint(awnd);
-}
-
-/** Free up console for other users.
- *
- * Release console resources for another application (that the current
- * task is starting). After the other application finishes, resume
- * operation with ui_resume(). No calls to UI must happen inbetween
- * and no events must be processed (i.e. the calling function must not
- * return control to UI.
- *
- * @param ui UI
- * @return EOK on success or an error code
- */
-errno_t ui_suspend(ui_t *ui)
-{
-	errno_t rc;
-
-	assert(!ui->suspended);
-
-	if (ui->cgc == NULL) {
-		ui->suspended = true;
-		return EOK;
-	}
-
-	(void) console_set_caption(ui->console, "");
-	rc = console_gc_suspend(ui->cgc);
-	if (rc != EOK)
-		return rc;
-
-	ui->suspended = true;
-	return EOK;
-}
-
-/** Resume suspended UI.
- *
- * Reclaim console resources (after child application has finished running)
- * and restore UI operation previously suspended by calling ui_suspend().
- *
- * @param ui UI
- * @return EOK on success or an error code
- */
-errno_t ui_resume(ui_t *ui)
-{
-	errno_t rc;
-	ui_window_t *awnd;
-	sysarg_t col;
-	sysarg_t row;
-	cons_event_t ev;
-
-	assert(ui->suspended);
-
-	if (ui->cgc == NULL) {
-		ui->suspended = false;
-		return EOK;
-	}
-
-	rc = console_get_pos(ui->console, &col, &row);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Here's a little heuristic to help determine if we need
-	 * to pause before returning to the UI. If we are in the
-	 * top-left corner, chances are the screen is empty and
-	 * there is no need to pause.
-	 */
-	if (col != 0 || row != 0) {
-		printf("Press any key or button to continue...\n");
-
-		while (true) {
-			rc = console_get_event(ui->console, &ev);
-			if (rc != EOK)
-				return EIO;
-
-			if (ev.type == CEV_KEY && ev.ev.key.type == KEY_PRESS)
-				break;
-
-			if (ev.type == CEV_POS && ev.ev.pos.type == POS_PRESS)
-				break;
-		}
-	}
-
-	rc = console_gc_resume(ui->cgc);
-	if (rc != EOK)
-		return rc;
-
-	ui->suspended = false;
-
-	awnd = ui_window_get_active(ui);
-	if (awnd != NULL)
-		(void) console_set_caption(ui->console, awnd->wdecor->caption);
-
-	rc = gfx_cursor_set_visible(console_gc_get_ctx(ui->cgc), false);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Determine if UI is suspended.
- *
- * @param ui UI
- * @return @c true iff UI is suspended
- */
-bool ui_is_suspended(ui_t *ui)
-{
-	return ui->suspended;
-}
-
-/** Lock UI.
- *
- * Block UI from calling window callbacks. @c ui_lock() and @c ui_unlock()
- * must be used when accessing UI resources from a fibril (as opposed to
- * from a window callback).
- *
- * @param ui UI
- */
-void ui_lock(ui_t *ui)
-{
-	if (ui->display != NULL)
-		display_lock(ui->display);
-	fibril_mutex_lock(&ui->lock);
-}
-
-/** Unlock UI.
- *
- * Allow UI to call window callbacks. @c ui_lock() and @c ui_unlock()
- * must be used when accessing window resources from a fibril (as opposed to
- * from a window callback).
- *
- * @param ui UI
- */
-void ui_unlock(ui_t *ui)
-{
-	fibril_mutex_unlock(&ui->lock);
-	if (ui->display != NULL)
-		display_unlock(ui->display);
-}
-
-/** Terminate user interface.
- *
- * Calling this function causes the user interface to terminate
- * (i.e. exit from ui_run()). This would be typically called from
- * an event handler.
- *
- * @param ui User interface
- */
-void ui_quit(ui_t *ui)
-{
-	ui->quit = true;
-}
-
-/** Determine if we are running in text mode.
- *
- * @param ui User interface
- * @return @c true iff we are running in text mode
- */
-bool ui_is_textmode(ui_t *ui)
-{
-	/*
-	 * XXX Currently console is always text and display is always
-	 * graphics, but this need not always be true.
-	 */
-	return (ui->console != NULL);
-}
-
-/** Determine if we are emulating windows.
- *
- * @param ui User interface
- * @return @c true iff we are running in text mode
- */
-bool ui_is_fullscreen(ui_t *ui)
-{
-	return (ui->display == NULL);
-}
-
-/** Get UI screen rectangle.
- *
- * @param ui User interface
- * @param rect Place to store bounding rectangle
- */
-errno_t ui_get_rect(ui_t *ui, gfx_rect_t *rect)
-{
-	display_info_t info;
-	sysarg_t cols, rows;
-	errno_t rc;
-
-	if (ui->display != NULL) {
-		rc = display_get_info(ui->display, &info);
-		if (rc != EOK)
-			return rc;
-
-		*rect = info.rect;
-	} else if (ui->console != NULL) {
-		rc = console_get_size(ui->console, &cols, &rows);
-		if (rc != EOK)
-			return rc;
-
-		rect->p0.x = 0;
-		rect->p0.y = 0;
-		rect->p1.x = cols;
-		rect->p1.y = rows;
-	} else {
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/** Get clickmatic from UI.
- *
- * @pararm ui UI
- * @return Clickmatic
- */
-ui_clickmatic_t *ui_get_clickmatic(ui_t *ui)
-{
-	return ui->clickmatic;
-}
-
-/** @}
- */
Index: pace/lib/ui/src/wdecor.c
===================================================================
--- uspace/lib/ui/src/wdecor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1281 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window decoration
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <gfx/text.h>
-#include <io/pos_event.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ui/paint.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include "../private/resource.h"
-#include "../private/wdecor.h"
-
-static void ui_wdecor_btn_min_clicked(ui_pbutton_t *, void *);
-static errno_t ui_wdecor_btn_min_paint(ui_pbutton_t *, void *,
-    gfx_coord2_t *);
-
-static void ui_wdecor_btn_max_clicked(ui_pbutton_t *, void *);
-static errno_t ui_wdecor_btn_max_paint(ui_pbutton_t *, void *,
-    gfx_coord2_t *);
-
-static void ui_wdecor_btn_close_clicked(ui_pbutton_t *, void *);
-static errno_t ui_wdecor_btn_close_paint(ui_pbutton_t *, void *,
-    gfx_coord2_t *);
-
-static ui_pbutton_cb_t ui_wdecor_btn_min_cb = {
-	.clicked = ui_wdecor_btn_min_clicked
-};
-
-static ui_pbutton_decor_ops_t ui_wdecor_btn_min_decor_ops = {
-	.paint = ui_wdecor_btn_min_paint
-};
-
-static ui_pbutton_cb_t ui_wdecor_btn_max_cb = {
-	.clicked = ui_wdecor_btn_max_clicked
-};
-
-static ui_pbutton_decor_ops_t ui_wdecor_btn_max_decor_ops = {
-	.paint = ui_wdecor_btn_max_paint
-};
-
-static ui_pbutton_cb_t ui_wdecor_btn_close_cb = {
-	.clicked = ui_wdecor_btn_close_clicked
-};
-
-static ui_pbutton_decor_ops_t ui_wdecor_btn_close_decor_ops = {
-	.paint = ui_wdecor_btn_close_paint
-};
-
-enum {
-	/** Width of corner drag area */
-	wdecor_corner_w = 24,
-	/** Height of corner drag area */
-	wdecor_corner_h = 24,
-	/** Window resizing edge witdth */
-	wdecor_edge_w = 4,
-	/** Window resizing edge height */
-	wdecor_edge_h = 4,
-	/** Window resizing edge witdth */
-	wdecor_edge_w_text = 1,
-	/** Window resizing edge height */
-	wdecor_edge_h_text = 1,
-	/** Title bar height */
-	wdecor_tbar_h = 22,
-	/** Window width */
-	wdecor_frame_w = 4,
-	/** Window frame width in text mode */
-	wdecor_frame_w_text = 1,
-	/** Window caption horizontal margin */
-	wdecor_cap_hmargin = 4,
-	/** Window caption horizontal margin in text mode */
-	wdecor_cap_hmargin_text = 1,
-	/** System menu handle width */
-	wdecor_sysmenu_hdl_w = 20,
-	/** System menu handle height */
-	wdecor_sysmenu_hdl_h = 20,
-	/** System menu handle width in text mode */
-	wdecor_sysmenu_hdl_w_text = 3,
-	/** System menu handle height in text mode */
-	wdecor_sysmenu_hdl_h_text = 1,
-	/** Close button cross leg length */
-	wdecor_close_cross_n = 5,
-	/** Close button cross pen width */
-	wdecor_close_cross_w = 2,
-	/** Close button cross pen height */
-	wdecor_close_cross_h = 1,
-	/** Minimize icon width */
-	wdecor_min_w = 10,
-	/** Minimize icon height */
-	wdecor_min_h = 10,
-	/** Maximize icon width */
-	wdecor_max_w = 10,
-	/** Maximize icon height */
-	wdecor_max_h = 10,
-	/** Unmaximize icon window width */
-	wdecor_unmax_w = 8,
-	/** Unmaximize icon window height */
-	wdecor_unmax_h = 8,
-	/** Unmaximize icon window horizontal distance */
-	wdecor_unmax_dw = 4,
-	/** Unmaximize icon window vertical distance */
-	wdecor_unmax_dh = 4
-};
-
-/** Create new window decoration.
- *
- * @param resource UI resource
- * @param caption Window caption
- * @param style Style
- * @param rwdecor Place to store pointer to new window decoration
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ui_wdecor_create(ui_resource_t *resource, const char *caption,
-    ui_wdecor_style_t style, ui_wdecor_t **rwdecor)
-{
-	ui_wdecor_t *wdecor;
-	errno_t rc;
-
-	wdecor = calloc(1, sizeof(ui_wdecor_t));
-	if (wdecor == NULL)
-		return ENOMEM;
-
-	wdecor->caption = str_dup(caption);
-	if (wdecor->caption == NULL) {
-		free(wdecor);
-		return ENOMEM;
-	}
-
-	if ((style & ui_wds_minimize_btn) != 0) {
-		rc = ui_pbutton_create(resource, "_", &wdecor->btn_min);
-		if (rc != EOK) {
-			ui_wdecor_destroy(wdecor);
-			return rc;
-		}
-
-		ui_pbutton_set_cb(wdecor->btn_min, &ui_wdecor_btn_min_cb,
-		    (void *)wdecor);
-
-		ui_pbutton_set_decor_ops(wdecor->btn_min,
-		    &ui_wdecor_btn_min_decor_ops, (void *)wdecor);
-	}
-
-	if ((style & ui_wds_maximize_btn) != 0) {
-		rc = ui_pbutton_create(resource, "^", &wdecor->btn_max);
-		if (rc != EOK) {
-			ui_wdecor_destroy(wdecor);
-			return rc;
-		}
-
-		ui_pbutton_set_cb(wdecor->btn_max, &ui_wdecor_btn_max_cb,
-		    (void *)wdecor);
-
-		ui_pbutton_set_decor_ops(wdecor->btn_max,
-		    &ui_wdecor_btn_max_decor_ops, (void *)wdecor);
-	}
-
-	if ((style & ui_wds_close_btn) != 0) {
-		rc = ui_pbutton_create(resource, "X", &wdecor->btn_close);
-		if (rc != EOK) {
-			ui_wdecor_destroy(wdecor);
-			return rc;
-		}
-
-		ui_pbutton_set_cb(wdecor->btn_close, &ui_wdecor_btn_close_cb,
-		    (void *)wdecor);
-
-		ui_pbutton_set_decor_ops(wdecor->btn_close,
-		    &ui_wdecor_btn_close_decor_ops, (void *)wdecor);
-	}
-
-	wdecor->res = resource;
-	wdecor->active = true;
-	wdecor->style = style;
-	*rwdecor = wdecor;
-	return EOK;
-}
-
-/** Destroy window decoration.
- *
- * @param wdecor Window decoration or @c NULL
- */
-void ui_wdecor_destroy(ui_wdecor_t *wdecor)
-{
-	if (wdecor == NULL)
-		return;
-
-	ui_pbutton_destroy(wdecor->btn_min);
-	ui_pbutton_destroy(wdecor->btn_max);
-	ui_pbutton_destroy(wdecor->btn_close);
-	free(wdecor->caption);
-	free(wdecor);
-}
-
-/** Set window decoration callbacks.
- *
- * @param wdecor Window decoration
- * @param cb Window decoration callbacks
- * @param arg Callback argument
- */
-void ui_wdecor_set_cb(ui_wdecor_t *wdecor, ui_wdecor_cb_t *cb, void *arg)
-{
-	wdecor->cb = cb;
-	wdecor->arg = arg;
-}
-
-/** Set window decoration rectangle.
- *
- * @param wdecor Window decoration
- * @param rect New window decoration rectangle
- */
-void ui_wdecor_set_rect(ui_wdecor_t *wdecor, gfx_rect_t *rect)
-{
-	ui_wdecor_geom_t geom;
-
-	wdecor->rect = *rect;
-
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	if (wdecor->btn_min != NULL)
-		ui_pbutton_set_rect(wdecor->btn_min, &geom.btn_min_rect);
-	if (wdecor->btn_max != NULL)
-		ui_pbutton_set_rect(wdecor->btn_max, &geom.btn_max_rect);
-	if (wdecor->btn_close != NULL)
-		ui_pbutton_set_rect(wdecor->btn_close, &geom.btn_close_rect);
-}
-
-/** Set active flag.
- *
- * Active window is the one receiving keyboard events.
- *
- * @param wdecor Window decoration
- * @param active @c true iff window is active
- */
-void ui_wdecor_set_active(ui_wdecor_t *wdecor, bool active)
-{
-	wdecor->active = active;
-}
-
-/** Set maximized flag.
- *
- * Active window is the one receiving keyboard events.
- *
- * @param wdecor Window decoration
- * @param maximized @c true iff window is maximized
- */
-void ui_wdecor_set_maximized(ui_wdecor_t *wdecor, bool maximized)
-{
-	wdecor->maximized = maximized;
-}
-
-/** Change caption.
- *
- * @param wdecor Window decoration
- * @param caption New caption
- *
- * @return EOK on success or an error code
- */
-errno_t ui_wdecor_set_caption(ui_wdecor_t *wdecor, const char *caption)
-{
-	char *cdup;
-
-	cdup = str_dup(caption);
-	if (cdup == NULL)
-		return ENOMEM;
-
-	free(wdecor->caption);
-	wdecor->caption = cdup;
-
-	ui_wdecor_paint(wdecor);
-	return EOK;
-}
-
-/** Paint system menu handle in graphics mode.
- *
- * @param wdecor Window decoration
- * @param rect System menu handle rectangle
- * @return EOK on success or an error code
- */
-errno_t ui_wdecor_sysmenu_hdl_paint_gfx(ui_wdecor_t *wdecor, gfx_rect_t *rect)
-{
-	errno_t rc;
-	gfx_rect_t mrect;
-	gfx_rect_t inside;
-	gfx_coord2_t center;
-
-	rc = gfx_set_color(wdecor->res->gc, wdecor->sysmenu_hdl_active ?
-	    wdecor->res->btn_shadow_color : wdecor->res->btn_face_color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(wdecor->res->gc, rect);
-	if (rc != EOK)
-		return rc;
-
-	center.x = (rect->p0.x + rect->p1.x) / 2;
-	center.y = (rect->p0.y + rect->p1.y) / 2;
-	mrect.p0.x = center.x - 7;
-	mrect.p0.y = center.y - 1;
-	mrect.p1.x = center.x + 7;
-	mrect.p1.y = center.y + 1 + 1;
-
-	/* XXX Not really a bevel, just a frame */
-	rc = ui_paint_bevel(wdecor->res->gc, &mrect,
-	    wdecor->res->btn_text_color, wdecor->res->btn_text_color, 1,
-	    &inside);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_set_color(wdecor->res->gc, wdecor->res->btn_highlight_color);
-	if (rc != EOK)
-		return rc;
-
-	rc = gfx_fill_rect(wdecor->res->gc, &inside);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint system menu handle in text mode.
- *
- * @param wdecor Window decoration
- * @param rect System menu handle rectangle
- * @return EOK on success or an error code
- */
-errno_t ui_wdecor_sysmenu_hdl_paint_text(ui_wdecor_t *wdecor, gfx_rect_t *rect)
-{
-	errno_t rc;
-	gfx_text_fmt_t fmt;
-
-	rc = gfx_set_color(wdecor->res->gc, wdecor->sysmenu_hdl_active ?
-	    wdecor->res->btn_shadow_color : wdecor->res->btn_face_color);
-
-	gfx_text_fmt_init(&fmt);
-	fmt.font = wdecor->res->font;
-	fmt.color = wdecor->sysmenu_hdl_active ?
-	    wdecor->res->wnd_sel_text_color :
-	    wdecor->res->tbar_act_text_color;
-	fmt.halign = gfx_halign_left;
-	fmt.valign = gfx_valign_top;
-
-	rc = gfx_puttext(&rect->p0, &fmt, "[\u2261]");
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Paint system menu handle.
- *
- * @param wdecor Window decoration
- * @param rect System menu handle rectangle
- * @return EOK on success or an error code
- */
-errno_t ui_wdecor_sysmenu_hdl_paint(ui_wdecor_t *wdecor, gfx_rect_t *rect)
-{
-	errno_t rc;
-
-	if (wdecor->res->textmode)
-		rc = ui_wdecor_sysmenu_hdl_paint_text(wdecor, rect);
-	else
-		rc = ui_wdecor_sysmenu_hdl_paint_gfx(wdecor, rect);
-
-	return rc;
-}
-
-/** Set system menu handle active flag.
- *
- * @param wdecor Window decoration
- * @param active @c true iff handle should be active
- */
-void ui_wdecor_sysmenu_hdl_set_active(ui_wdecor_t *wdecor, bool active)
-{
-	ui_wdecor_geom_t geom;
-
-	wdecor->sysmenu_hdl_active = active;
-
-	ui_wdecor_get_geom(wdecor, &geom);
-	(void) ui_wdecor_sysmenu_hdl_paint(wdecor, &geom.sysmenu_hdl_rect);
-	(void) gfx_update(wdecor->res->gc);
-}
-
-/** Paint window decoration.
- *
- * @param wdecor Window decoration
- * @return EOK on success or an error code
- */
-errno_t ui_wdecor_paint(ui_wdecor_t *wdecor)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	gfx_rect_t trect;
-	gfx_rect_t text_rect;
-	gfx_text_fmt_t fmt;
-	gfx_coord2_t pos;
-	ui_wdecor_geom_t geom;
-
-	rect = wdecor->rect;
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	if ((wdecor->style & ui_wds_frame) != 0) {
-
-		if (wdecor->res->textmode != false) {
-			rc = ui_paint_text_box(wdecor->res, &rect,
-			    ui_box_double, wdecor->res->wnd_face_color);
-			if (rc != EOK)
-				return rc;
-		} else {
-			rc = ui_paint_outset_frame(wdecor->res, &rect,
-			    &rect);
-			if (rc != EOK)
-				return rc;
-
-			rc = ui_paint_bevel(wdecor->res->gc, &rect,
-			    wdecor->res->wnd_face_color,
-			    wdecor->res->wnd_face_color, 2, &rect);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	if ((wdecor->style & ui_wds_titlebar) != 0) {
-		trect = geom.title_bar_rect;
-
-		if (wdecor->res->textmode == false) {
-			rc = ui_paint_bevel(wdecor->res->gc, &trect,
-			    wdecor->res->wnd_shadow_color,
-			    wdecor->res->wnd_highlight_color, 1, &trect);
-			if (rc != EOK)
-				return rc;
-
-			rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
-			    wdecor->res->tbar_act_bg_color :
-			    wdecor->res->tbar_inact_bg_color);
-			if (rc != EOK)
-				return rc;
-
-			rc = gfx_fill_rect(wdecor->res->gc, &trect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		gfx_text_fmt_init(&fmt);
-		fmt.font = wdecor->res->font;
-		fmt.color = wdecor->active ?
-		    wdecor->res->tbar_act_text_color :
-		    wdecor->res->tbar_inact_text_color;
-		fmt.halign = gfx_halign_center;
-		fmt.valign = gfx_valign_center;
-		fmt.abbreviate = true;
-		fmt.width = geom.caption_rect.p1.x -
-		    geom.caption_rect.p0.x;
-
-		pos.x = (geom.caption_rect.p0.x + geom.caption_rect.p1.x) / 2;
-		pos.y = (geom.caption_rect.p0.y + geom.caption_rect.p1.y) / 2;
-
-		if (wdecor->res->textmode) {
-			/* Make space around caption text */
-			gfx_text_rect(&pos, &fmt, wdecor->caption, &text_rect);
-
-			/* Only make space if caption is non-empty */
-			if (text_rect.p0.x < text_rect.p1.x) {
-				text_rect.p0.x -= 1;
-				text_rect.p1.x += 1;
-			}
-
-			rc = gfx_set_color(wdecor->res->gc, wdecor->active ?
-			    wdecor->res->tbar_act_bg_color :
-			    wdecor->res->tbar_inact_bg_color);
-			if (rc != EOK)
-				return rc;
-
-			rc = gfx_fill_rect(wdecor->res->gc, &text_rect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		rc = gfx_puttext(&pos, &fmt, wdecor->caption);
-		if (rc != EOK)
-			return rc;
-
-		if ((wdecor->style & ui_wds_sysmenu_hdl) != 0) {
-			rc = ui_wdecor_sysmenu_hdl_paint(wdecor,
-			    &geom.sysmenu_hdl_rect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		if (wdecor->btn_min != NULL) {
-			rc = ui_pbutton_paint(wdecor->btn_min);
-			if (rc != EOK)
-				return rc;
-		}
-
-		if (wdecor->btn_max != NULL) {
-			rc = ui_pbutton_paint(wdecor->btn_max);
-			if (rc != EOK)
-				return rc;
-		}
-
-		if (wdecor->btn_close != NULL) {
-			rc = ui_pbutton_paint(wdecor->btn_close);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	rc = gfx_update(wdecor->res->gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Send decoration sysmenu open event.
- *
- * @param wdecor Window decoration
- * @param idev_id Input device ID
- */
-void ui_wdecor_sysmenu_open(ui_wdecor_t *wdecor, sysarg_t idev_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->sysmenu_open != NULL)
-		wdecor->cb->sysmenu_open(wdecor, wdecor->arg, idev_id);
-}
-
-/** Send decoration sysmenu left event.
- *
- * @param wdecor Window decoration
- * @param idev_id Input device ID
- */
-void ui_wdecor_sysmenu_left(ui_wdecor_t *wdecor, sysarg_t idev_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->sysmenu_left != NULL)
-		wdecor->cb->sysmenu_left(wdecor, wdecor->arg, idev_id);
-}
-
-/** Send decoration sysmenu right event.
- *
- * @param wdecor Window decoration
- * @param idev_id Input device ID
- */
-void ui_wdecor_sysmenu_right(ui_wdecor_t *wdecor, sysarg_t idev_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->sysmenu_right != NULL)
-		wdecor->cb->sysmenu_right(wdecor, wdecor->arg, idev_id);
-}
-
-/** Send decoration sysmenu accelerator event.
- *
- * @param wdecor Window decoration
- * @param c Accelerator character
- * @param idev_id Input device ID
- */
-void ui_wdecor_sysmenu_accel(ui_wdecor_t *wdecor, char32_t c, sysarg_t idev_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->sysmenu_right != NULL)
-		wdecor->cb->sysmenu_accel(wdecor, wdecor->arg, c, idev_id);
-}
-
-/** Send decoration minimize event.
- *
- * @param wdecor Window decoration
- */
-void ui_wdecor_minimize(ui_wdecor_t *wdecor)
-{
-	if (wdecor->cb != NULL && wdecor->cb->minimize != NULL)
-		wdecor->cb->minimize(wdecor, wdecor->arg);
-}
-
-/** Send decoration maximize event.
- *
- * @param wdecor Window decoration
- */
-void ui_wdecor_maximize(ui_wdecor_t *wdecor)
-{
-	if (wdecor->cb != NULL && wdecor->cb->maximize != NULL)
-		wdecor->cb->maximize(wdecor, wdecor->arg);
-}
-
-/** Send decoration unmaximize event.
- *
- * @param wdecor Window decoration
- */
-void ui_wdecor_unmaximize(ui_wdecor_t *wdecor)
-{
-	if (wdecor->cb != NULL && wdecor->cb->unmaximize != NULL)
-		wdecor->cb->unmaximize(wdecor, wdecor->arg);
-}
-
-/** Send decoration close event.
- *
- * @param wdecor Window decoration
- */
-void ui_wdecor_close(ui_wdecor_t *wdecor)
-{
-	if (wdecor->cb != NULL && wdecor->cb->close != NULL)
-		wdecor->cb->close(wdecor, wdecor->arg);
-}
-
-/** Send decoration move event.
- *
- * @param wdecor Window decoration
- * @param pos Position where the title bar was pressed
- * @param pos_id Positioning device ID
- */
-void ui_wdecor_move(ui_wdecor_t *wdecor, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->move != NULL)
-		wdecor->cb->move(wdecor, wdecor->arg, pos, pos_id);
-}
-
-/** Send decoration resize event.
- *
- * @param wdecor Window decoration
- * @param rsztype Resize type
- * @param pos Position where the button was pressed
- * @param pos_id Positioning device ID
- */
-void ui_wdecor_resize(ui_wdecor_t *wdecor, ui_wdecor_rsztype_t rsztype,
-    gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	if (wdecor->cb != NULL && wdecor->cb->resize != NULL)
-		wdecor->cb->resize(wdecor, wdecor->arg, rsztype, pos, pos_id);
-}
-
-/** Send cursor change event.
- *
- * @param wdecor Window decoration
- * @param cursor Cursor
- */
-void ui_wdecor_set_cursor(ui_wdecor_t *wdecor, ui_stock_cursor_t cursor)
-{
-	if (wdecor->cb != NULL && wdecor->cb->set_cursor != NULL)
-		wdecor->cb->set_cursor(wdecor, wdecor->arg, cursor);
-}
-
-/** Get window decoration geometry.
- *
- * @param wdecor Window decoration
- * @param geom Structure to fill in with computed geometry
- */
-void ui_wdecor_get_geom(ui_wdecor_t *wdecor, ui_wdecor_geom_t *geom)
-{
-	gfx_coord_t frame_w;
-	gfx_coord_t btn_x;
-	gfx_coord_t btn_y;
-	gfx_coord_t cap_hmargin;
-	gfx_coord_t cap_x;
-	gfx_coord_t hdl_x_off;
-	gfx_coord_t hdl_y_off;
-	gfx_coord_t hdl_w;
-	gfx_coord_t hdl_h;
-
-	/* Does window have a frame? */
-	if ((wdecor->style & ui_wds_frame) != 0) {
-		frame_w = wdecor->res->textmode ?
-		    wdecor_frame_w_text : wdecor_frame_w;
-
-		geom->interior_rect.p0.x = wdecor->rect.p0.x + frame_w;
-		geom->interior_rect.p0.y = wdecor->rect.p0.y + frame_w;
-		geom->interior_rect.p1.x = wdecor->rect.p1.x - frame_w;
-		geom->interior_rect.p1.y = wdecor->rect.p1.y - frame_w;
-	} else {
-		geom->interior_rect = wdecor->rect;
-	}
-
-	/* Does window have a title bar? */
-	if ((wdecor->style & ui_wds_titlebar) != 0) {
-		if (wdecor->res->textmode) {
-			geom->title_bar_rect.p0 = wdecor->rect.p0;
-			geom->title_bar_rect.p1.x = wdecor->rect.p1.x;
-			geom->title_bar_rect.p1.y = wdecor->rect.p0.y + 1;
-
-			btn_x = geom->title_bar_rect.p1.x - 1;
-			btn_y = geom->title_bar_rect.p0.y;
-		} else {
-			geom->title_bar_rect.p0 = geom->interior_rect.p0;
-			geom->title_bar_rect.p1.x = geom->interior_rect.p1.x;
-			geom->title_bar_rect.p1.y = geom->interior_rect.p0.y +
-			    wdecor_tbar_h;
-
-			btn_x = geom->title_bar_rect.p1.x - 1;
-			btn_y = geom->title_bar_rect.p0.y + 1;
-		}
-
-		geom->app_area_rect.p0.x = geom->interior_rect.p0.x;
-		geom->app_area_rect.p0.y = geom->title_bar_rect.p1.y;
-		geom->app_area_rect.p1 = geom->interior_rect.p1;
-
-	} else {
-		geom->title_bar_rect.p0.x = 0;
-		geom->title_bar_rect.p0.y = 0;
-		geom->title_bar_rect.p1.x = 0;
-		geom->title_bar_rect.p1.y = 0;
-
-		geom->app_area_rect = geom->interior_rect;
-		btn_x = 0;
-		btn_y = 0;
-	}
-
-	/* Does window have a sysmenu handle? */
-	if ((wdecor->style & ui_wds_sysmenu_hdl) != 0) {
-		if (wdecor->res->textmode) {
-			hdl_x_off = 2;
-			hdl_y_off = 0;
-			hdl_w = wdecor_sysmenu_hdl_w_text;
-			hdl_h = wdecor_sysmenu_hdl_h_text;
-		} else {
-			hdl_x_off = 1;
-			hdl_y_off = 1;
-			hdl_w = wdecor_sysmenu_hdl_w;
-			hdl_h = wdecor_sysmenu_hdl_h;
-		}
-
-		geom->sysmenu_hdl_rect.p0.x = geom->title_bar_rect.p0.x +
-		    hdl_x_off;
-		geom->sysmenu_hdl_rect.p0.y = geom->title_bar_rect.p0.y +
-		    hdl_y_off;
-		geom->sysmenu_hdl_rect.p1.x = geom->sysmenu_hdl_rect.p0.x +
-		    hdl_w;
-		geom->sysmenu_hdl_rect.p1.y = geom->sysmenu_hdl_rect.p0.y +
-		    hdl_h;
-		cap_x = hdl_w;
-	} else {
-		geom->sysmenu_hdl_rect.p0.x = 0;
-		geom->sysmenu_hdl_rect.p0.y = 0;
-		geom->sysmenu_hdl_rect.p1.x = 0;
-		geom->sysmenu_hdl_rect.p1.y = 0;
-		cap_x = 0;
-	}
-
-	/* Does window have a close button? */
-	if ((wdecor->style & ui_wds_close_btn) != 0) {
-		if (wdecor->res->textmode == false) {
-			geom->btn_close_rect.p0.x = btn_x - 20;
-			geom->btn_close_rect.p0.y = btn_y;
-			geom->btn_close_rect.p1.x = btn_x;
-			geom->btn_close_rect.p1.y = btn_y + 20;
-
-			btn_x -= 20;
-		} else {
-			geom->btn_close_rect.p0.x = btn_x - 3;
-			geom->btn_close_rect.p0.y = btn_y;
-			geom->btn_close_rect.p1.x = btn_x;
-			geom->btn_close_rect.p1.y = btn_y + 1;
-
-			btn_x -= 3;
-		}
-	} else {
-		geom->btn_close_rect.p0.x = 0;
-		geom->btn_close_rect.p0.y = 0;
-		geom->btn_close_rect.p1.x = 0;
-		geom->btn_close_rect.p1.y = 0;
-	}
-
-	/* Does window have a (un)maximize button? */
-	if ((wdecor->style & ui_wds_maximize_btn) != 0) {
-		if (wdecor->res->textmode == false) {
-			geom->btn_max_rect.p0.x = btn_x - 20;
-			geom->btn_max_rect.p0.y = btn_y;
-			geom->btn_max_rect.p1.x = btn_x;
-			geom->btn_max_rect.p1.y = btn_y + 20;
-
-			btn_x -= 20;
-		} else {
-			geom->btn_max_rect.p0.x = btn_x - 3;
-			geom->btn_max_rect.p0.y = btn_y;
-			geom->btn_max_rect.p1.x = btn_x;
-			geom->btn_max_rect.p1.y = btn_y + 1;
-
-			btn_x -= 3;
-		}
-	} else {
-		geom->btn_max_rect.p0.x = 0;
-		geom->btn_max_rect.p0.y = 0;
-		geom->btn_max_rect.p1.x = 0;
-		geom->btn_max_rect.p1.y = 0;
-	}
-
-	/* Does window have a minimize button? */
-	if ((wdecor->style & ui_wds_minimize_btn) != 0) {
-		if (wdecor->res->textmode == false) {
-			geom->btn_min_rect.p0.x = btn_x - 20;
-			geom->btn_min_rect.p0.y = btn_y;
-			geom->btn_min_rect.p1.x = btn_x;
-			geom->btn_min_rect.p1.y = btn_y + 20;
-
-			btn_x -= 20;
-		} else {
-			geom->btn_min_rect.p0.x = btn_x - 3;
-			geom->btn_min_rect.p0.y = btn_y;
-			geom->btn_min_rect.p1.x = btn_x;
-			geom->btn_min_rect.p1.y = btn_y + 1;
-
-			btn_x -= 3;
-		}
-	} else {
-		geom->btn_min_rect.p0.x = 0;
-		geom->btn_min_rect.p0.y = 0;
-		geom->btn_min_rect.p1.x = 0;
-		geom->btn_min_rect.p1.y = 0;
-	}
-
-	if ((wdecor->style & ui_wds_titlebar) != 0) {
-		if (wdecor->res->textmode == false)
-			cap_hmargin = wdecor_cap_hmargin;
-		else
-			cap_hmargin = wdecor_cap_hmargin_text;
-
-		geom->caption_rect.p0.x = geom->title_bar_rect.p0.x +
-		    cap_hmargin + cap_x;
-		geom->caption_rect.p0.y = geom->title_bar_rect.p0.y;
-		geom->caption_rect.p1.x = btn_x - cap_hmargin;
-		geom->caption_rect.p1.y = geom->title_bar_rect.p1.y;
-	} else {
-		geom->caption_rect.p0.x = 0;
-		geom->caption_rect.p0.y = 0;
-		geom->caption_rect.p1.x = 0;
-		geom->caption_rect.p1.y = 0;
-	}
-}
-
-/** Get outer rectangle from application area rectangle.
- *
- * Note that this needs to work just based on a UI, without having an actual
- * window decoration, since we need it in order to create the window
- * and its decoration.
- *
- * @param ui UI
- * @param style Decoration style
- * @param app Application area rectangle
- * @param rect Place to store (outer) window decoration rectangle
- */
-void ui_wdecor_rect_from_app(ui_t *ui, ui_wdecor_style_t style,
-    gfx_rect_t *app, gfx_rect_t *rect)
-{
-	bool textmode;
-	gfx_coord_t edge_w, edge_h;
-	*rect = *app;
-
-	textmode = ui_is_textmode(ui);
-	if (textmode) {
-		edge_w = wdecor_edge_w_text;
-		edge_h = wdecor_edge_h_text;
-	} else {
-		edge_w = wdecor_edge_w;
-		edge_h = wdecor_edge_h;
-	}
-
-	if ((style & ui_wds_frame) != 0) {
-		rect->p0.x -= edge_w;
-		rect->p0.y -= edge_h;
-		rect->p1.x += edge_w;
-		rect->p1.y += edge_h;
-	}
-
-	if ((style & ui_wds_titlebar) != 0 && !textmode)
-		rect->p0.y -= wdecor_tbar_h;
-}
-
-/** Application area rectangle from window rectangle.
- *
- * Note that this needs to work just based on a UI, without having an actual
- * window decoration, since we need it in process of resizing the window,
- * before it is actually resized.
- *
- * @param style Decoration style
- * @param rect Window decoration rectangle
- * @param app Place to store application area rectangle
- */
-void ui_wdecor_app_from_rect(ui_wdecor_style_t style, gfx_rect_t *rect,
-    gfx_rect_t *app)
-{
-	*app = *rect;
-
-	if ((style & ui_wds_frame) != 0) {
-		app->p0.x += wdecor_edge_w;
-		app->p0.y += wdecor_edge_h;
-		app->p1.x -= wdecor_edge_w;
-		app->p1.y -= wdecor_edge_h;
-	}
-
-	if ((style & ui_wds_titlebar) != 0)
-		app->p0.y += 22;
-}
-
-/** Get resize type for pointer at the specified position.
- *
- * @param wdecor Window decoration
- * @param pos Pointer position
- * @return Resize type
- */
-ui_wdecor_rsztype_t ui_wdecor_get_rsztype(ui_wdecor_t *wdecor,
-    gfx_coord2_t *pos)
-{
-	bool eleft, eright;
-	bool etop, ebottom;
-	bool edge;
-	bool cleft, cright;
-	bool ctop, cbottom;
-
-	/* Window not resizable? */
-	if ((wdecor->style & ui_wds_resizable) == 0)
-		return ui_wr_none;
-
-	/* Window is maximized? */
-	if (wdecor->maximized)
-		return ui_wr_none;
-
-	/* Position not inside window? */
-	if (!gfx_pix_inside_rect(pos, &wdecor->rect))
-		return ui_wr_none;
-
-	/* Position is within edge width from the outside */
-	eleft = (pos->x < wdecor->rect.p0.x + wdecor_edge_w);
-	eright = (pos->x >= wdecor->rect.p1.x - wdecor_edge_w);
-	etop = (pos->y < wdecor->rect.p0.y + wdecor_edge_h);
-	ebottom = (pos->y >= wdecor->rect.p1.y - wdecor_edge_h);
-
-	/* Position is on one of the four edges */
-	edge = eleft || eright || etop || ebottom;
-
-	/* Position is within resize-corner distance from the outside */
-	cleft = (pos->x < wdecor->rect.p0.x + wdecor_corner_w);
-	cright = (pos->x >= wdecor->rect.p1.x - wdecor_corner_w);
-	ctop = (pos->y < wdecor->rect.p0.y + wdecor_corner_h);
-	cbottom = (pos->y >= wdecor->rect.p1.y - wdecor_corner_h);
-
-	/* Top-left corner */
-	if (edge && cleft && ctop)
-		return ui_wr_top_left;
-
-	/* Top-right corner */
-	if (edge && cright && ctop)
-		return ui_wr_top_right;
-
-	/* Bottom-left corner */
-	if (edge && cleft && cbottom)
-		return ui_wr_bottom_left;
-
-	/* Bottom-right corner */
-	if (edge && cright && cbottom)
-		return ui_wr_bottom_right;
-
-	/* Left edge */
-	if (eleft)
-		return ui_wr_left;
-
-	/* Right edge */
-	if (eright)
-		return ui_wr_right;
-
-	/* Top edge */
-	if (etop)
-		return ui_wr_top;
-
-	/* Bottom edge */
-	if (ebottom)
-		return ui_wr_bottom;
-
-	return ui_wr_none;
-}
-
-/** Get stock cursor to use for the specified window resize type.
- *
- * The resize type must be valid, otherwise behavior is undefined.
- *
- * @param rsztype Resize type
- * @return Cursor to use for this resize type
- */
-ui_stock_cursor_t ui_wdecor_cursor_from_rsztype(ui_wdecor_rsztype_t rsztype)
-{
-	switch (rsztype) {
-	case ui_wr_none:
-		return ui_curs_arrow;
-
-	case ui_wr_top:
-	case ui_wr_bottom:
-		return ui_curs_size_ud;
-
-	case ui_wr_left:
-	case ui_wr_right:
-		return ui_curs_size_lr;
-
-	case ui_wr_top_left:
-	case ui_wr_bottom_right:
-		return ui_curs_size_uldr;
-
-	case ui_wr_top_right:
-	case ui_wr_bottom_left:
-		return ui_curs_size_urdl;
-
-	default:
-		assert(false);
-		return ui_curs_arrow;
-	}
-}
-
-/** Handle window decoration keyboard event.
- *
- * @param wdecor Window decoration
- * @param kbd_event Keyboard event
- * @return @c ui_claimed iff event was claimed
- */
-ui_evclaim_t ui_wdecor_kbd_event(ui_wdecor_t *wdecor, kbd_event_t *event)
-{
-	if (event->type == KEY_PRESS && (event->mods & (KM_CTRL | KM_ALT |
-	    KM_SHIFT)) == 0) {
-		if (event->key == KC_F10) {
-			ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-			ui_wdecor_sysmenu_open(wdecor, event->kbd_id);
-			return ui_claimed;
-		}
-	}
-
-	/* System menu handle events (if active) */
-	if (event->type == KEY_PRESS && (event->mods & (KM_CTRL | KM_ALT |
-	    KM_SHIFT)) == 0 && wdecor->sysmenu_hdl_active) {
-		switch (event->key) {
-		case KC_ESCAPE:
-			ui_wdecor_sysmenu_hdl_set_active(wdecor, false);
-			return ui_claimed;
-		case KC_LEFT:
-			ui_wdecor_sysmenu_left(wdecor, event->kbd_id);
-			return ui_claimed;
-		case KC_RIGHT:
-			ui_wdecor_sysmenu_right(wdecor, event->kbd_id);
-			return ui_claimed;
-		case KC_DOWN:
-			ui_wdecor_sysmenu_open(wdecor, event->kbd_id);
-			return ui_claimed;
-		default:
-			break;
-		}
-
-		if (event->c != '\0') {
-			/* Could be an accelerator key */
-			ui_wdecor_sysmenu_accel(wdecor, event->c,
-			    event->kbd_id);
-		}
-	}
-
-	return ui_unclaimed;
-}
-
-/** Handle window frame position event.
- *
- * @param wdecor Window decoration
- * @param pos_event Position event
- */
-void ui_wdecor_frame_pos_event(ui_wdecor_t *wdecor, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	ui_wdecor_rsztype_t rsztype;
-	ui_stock_cursor_t cursor;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	pos_id = event->pos_id;
-
-	/* Set appropriate resizing cursor, or set arrow cursor */
-
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	cursor = ui_wdecor_cursor_from_rsztype(rsztype);
-
-	ui_wdecor_set_cursor(wdecor, cursor);
-
-	/* Press on window border? */
-	if (rsztype != ui_wr_none && event->type == POS_PRESS)
-		ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
-}
-
-/** Handle window decoration position event.
- *
- * @param wdecor Window decoration
- * @param pos_event Position event
- * @return @c ui_claimed iff event was claimed
- */
-ui_evclaim_t ui_wdecor_pos_event(ui_wdecor_t *wdecor, pos_event_t *event)
-{
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	ui_wdecor_geom_t geom;
-	ui_evclaim_t claim;
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	pos_id = event->pos_id;
-
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	if ((wdecor->style & ui_wds_titlebar) != 0 &&
-	    (wdecor->style & ui_wds_sysmenu_hdl) != 0) {
-		if (event->type == POS_PRESS &&
-		    gfx_pix_inside_rect(&pos, &geom.sysmenu_hdl_rect)) {
-			ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-			ui_wdecor_sysmenu_open(wdecor, event->pos_id);
-			return ui_claimed;
-		}
-	}
-
-	if (wdecor->btn_min != NULL) {
-		claim = ui_pbutton_pos_event(wdecor->btn_min, event);
-		if (claim == ui_claimed)
-			return ui_claimed;
-	}
-
-	if (wdecor->btn_max != NULL) {
-		claim = ui_pbutton_pos_event(wdecor->btn_max, event);
-		if (claim == ui_claimed)
-			return ui_claimed;
-	}
-
-	if (wdecor->btn_close != NULL) {
-		claim = ui_pbutton_pos_event(wdecor->btn_close, event);
-		if (claim == ui_claimed)
-			return ui_claimed;
-	}
-
-	ui_wdecor_frame_pos_event(wdecor, event);
-
-	if ((wdecor->style & ui_wds_titlebar) != 0 && !wdecor->maximized) {
-		if (event->type == POS_PRESS &&
-		    gfx_pix_inside_rect(&pos, &geom.title_bar_rect)) {
-			ui_wdecor_move(wdecor, &pos, pos_id);
-			return ui_claimed;
-		}
-	}
-
-	return ui_unclaimed;
-}
-
-/** Window decoration minimize button was clicked.
- *
- * @param pbutton Minimize button
- * @param arg Argument (ui_wdecor_t)
- */
-static void ui_wdecor_btn_min_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *) arg;
-
-	(void) pbutton;
-
-	ui_wdecor_minimize(wdecor);
-}
-
-/** Window decoration (un)maximize button was clicked.
- *
- * @param pbutton (Un)maximize button
- * @param arg Argument (ui_wdecor_t)
- */
-static void ui_wdecor_btn_max_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *) arg;
-
-	(void) pbutton;
-
-	if (wdecor->maximized)
-		ui_wdecor_unmaximize(wdecor);
-	else
-		ui_wdecor_maximize(wdecor);
-}
-
-/** Paint minimize button decoration.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_wdecor_t *)
- * @param pos Center position
- */
-static errno_t ui_wdecor_btn_min_paint(ui_pbutton_t *pbutton,
-    void *arg, gfx_coord2_t *pos)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *)arg;
-	errno_t rc;
-
-	rc = ui_paint_minicon(wdecor->res, pos, wdecor_min_w,
-	    wdecor_min_h);
-
-	return rc;
-}
-
-/** Paint (un)maximize button decoration.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_wdecor_t *)
- * @param pos Center position
- */
-static errno_t ui_wdecor_btn_max_paint(ui_pbutton_t *pbutton,
-    void *arg, gfx_coord2_t *pos)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *)arg;
-	errno_t rc;
-
-	if (wdecor->maximized) {
-		rc = ui_paint_unmaxicon(wdecor->res, pos, wdecor_unmax_w,
-		    wdecor_unmax_h, wdecor_unmax_dw, wdecor_unmax_dh);
-	} else {
-		rc = ui_paint_maxicon(wdecor->res, pos, wdecor_max_w,
-		    wdecor_max_h);
-	}
-
-	return rc;
-}
-
-/** Window decoration close button was clicked.
- *
- * @param pbutton Close button
- * @param arg Argument (ui_wdecor_t)
- */
-static void ui_wdecor_btn_close_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *) arg;
-
-	(void) pbutton;
-	ui_wdecor_close(wdecor);
-}
-
-/** Paint close button decoration.
- *
- * @param pbutton Push button
- * @param arg Argument (ui_wdecor_t *)
- * @param pos Center position
- */
-static errno_t ui_wdecor_btn_close_paint(ui_pbutton_t *pbutton,
-    void *arg, gfx_coord2_t *pos)
-{
-	ui_wdecor_t *wdecor = (ui_wdecor_t *)arg;
-	gfx_coord2_t p;
-	errno_t rc;
-
-	rc = gfx_set_color(wdecor->res->gc, wdecor->res->btn_text_color);
-	if (rc != EOK)
-		return rc;
-
-	p.x = pos->x - 1;
-	p.y = pos->y - 1;
-	return ui_paint_cross(wdecor->res->gc, &p, wdecor_close_cross_n,
-	    wdecor_close_cross_w, wdecor_close_cross_h);
-}
-
-/** @}
- */
Index: pace/lib/ui/src/window.c
===================================================================
--- uspace/lib/ui/src/window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1839 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libui
- * @{
- */
-/**
- * @file Window
- */
-
-#include <congfx/console.h>
-#include <display.h>
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/cursor.h>
-#include <gfx/render.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <mem.h>
-#include <memgfx/memgc.h>
-#include <stdlib.h>
-#include <ui/control.h>
-#include <ui/menubar.h>
-#include <ui/menu.h>
-#include <ui/menuentry.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include <ui/window.h>
-#include "../private/control.h"
-#include "../private/dummygc.h"
-#include "../private/resource.h"
-#include "../private/ui.h"
-#include "../private/wdecor.h"
-#include "../private/window.h"
-
-static void dwnd_close_event(void *);
-static void dwnd_focus_event(void *, unsigned);
-static void dwnd_kbd_event(void *, kbd_event_t *);
-static void dwnd_pos_event(void *, pos_event_t *);
-static void dwnd_resize_event(void *, gfx_rect_t *);
-static void dwnd_unfocus_event(void *, unsigned);
-
-static display_wnd_cb_t dwnd_cb = {
-	.close_event = dwnd_close_event,
-	.focus_event = dwnd_focus_event,
-	.kbd_event = dwnd_kbd_event,
-	.pos_event = dwnd_pos_event,
-	.resize_event = dwnd_resize_event,
-	.unfocus_event = dwnd_unfocus_event
-};
-
-static void wd_sysmenu_open(ui_wdecor_t *, void *, sysarg_t);
-static void wd_sysmenu_left(ui_wdecor_t *, void *, sysarg_t);
-static void wd_sysmenu_right(ui_wdecor_t *, void *, sysarg_t);
-static void wd_sysmenu_accel(ui_wdecor_t *, void *, char32_t, sysarg_t);
-static void wd_minimize(ui_wdecor_t *, void *);
-static void wd_maximize(ui_wdecor_t *, void *);
-static void wd_unmaximize(ui_wdecor_t *, void *);
-static void wd_close(ui_wdecor_t *, void *);
-static void wd_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
-static void wd_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
-    gfx_coord2_t *, sysarg_t);
-static void wd_set_cursor(ui_wdecor_t *, void *, ui_stock_cursor_t);
-
-static ui_wdecor_cb_t wdecor_cb = {
-	.sysmenu_open = wd_sysmenu_open,
-	.sysmenu_left = wd_sysmenu_left,
-	.sysmenu_right = wd_sysmenu_right,
-	.sysmenu_accel = wd_sysmenu_accel,
-	.minimize = wd_minimize,
-	.maximize = wd_maximize,
-	.unmaximize = wd_unmaximize,
-	.close = wd_close,
-	.move = wd_move,
-	.resize = wd_resize,
-	.set_cursor = wd_set_cursor
-};
-
-static void wnd_sysmenu_left(ui_menu_t *, void *, sysarg_t);
-static void wnd_sysmenu_right(ui_menu_t *, void *, sysarg_t);
-static void wnd_sysmenu_close_req(ui_menu_t *, void *);
-static void wnd_sysmenu_press_accel(ui_menu_t *, void *, char32_t, sysarg_t);
-
-static ui_menu_cb_t wnd_sysmenu_cb = {
-	.left = wnd_sysmenu_left,
-	.right = wnd_sysmenu_right,
-	.close_req = wnd_sysmenu_close_req,
-	.press_accel = wnd_sysmenu_press_accel
-};
-
-static void wnd_sysmenu_erestore(ui_menu_entry_t *, void *);
-static void wnd_sysmenu_eminimize(ui_menu_entry_t *, void *);
-static void wnd_sysmenu_emaximize(ui_menu_entry_t *, void *);
-static void wnd_sysmenu_eclose(ui_menu_entry_t *, void *);
-
-static void ui_window_invalidate(void *, gfx_rect_t *);
-static void ui_window_update(void *);
-static errno_t ui_window_cursor_get_pos(void *, gfx_coord2_t *);
-static errno_t ui_window_cursor_set_pos(void *, gfx_coord2_t *);
-static errno_t ui_window_cursor_set_visible(void *, bool);
-
-/** Window memory GC callbacks */
-static mem_gc_cb_t ui_window_mem_gc_cb = {
-	.invalidate = ui_window_invalidate,
-	.update = ui_window_update,
-	.cursor_get_pos = ui_window_cursor_get_pos,
-	.cursor_set_pos = ui_window_cursor_set_pos,
-	.cursor_set_visible = ui_window_cursor_set_visible
-};
-
-static void ui_window_app_invalidate(void *, gfx_rect_t *);
-static void ui_window_app_update(void *);
-
-/** Application area memory GC callbacks */
-static mem_gc_cb_t ui_window_app_mem_gc_cb = {
-	.invalidate = ui_window_app_invalidate,
-	.update = ui_window_app_update
-};
-
-static void ui_window_expose_cb(void *);
-
-/** Initialize window parameters structure.
- *
- * Window parameters structure must always be initialized using this function
- * first. By default, the window will be decorated. To get a non-decorated
- * window, one needs to clear ui_wds_decorated
- * (e.g. params->style &= ~ui_wds_decorated).
- *
- * @param params Window parameters structure
- */
-void ui_wnd_params_init(ui_wnd_params_t *params)
-{
-	memset(params, 0, sizeof(ui_wnd_params_t));
-
-	/* Make window decorated by default. */
-	params->style = ui_wds_decorated;
-}
-
-/** Compute where window should be placed on the screen.
- *
- * This only applies to windows that do not use default placement or
- * if we are running in full-screen mode.
- *
- * @param window Window
- * @param drect Display rectangle
- * @param params Window parameters
- * @param pos Place to store position of top-left corner
- */
-static void ui_window_place(ui_window_t *window, gfx_rect_t *drect,
-    ui_wnd_params_t *params, gfx_coord2_t *pos)
-{
-	gfx_coord2_t dims;
-	gfx_coord2_t below_pos;
-	gfx_rect_t below_rect;
-
-	assert(params->placement != ui_wnd_place_default ||
-	    ui_is_fullscreen(window->ui));
-
-	pos->x = 0;
-	pos->y = 0;
-
-	switch (params->placement) {
-	case ui_wnd_place_default:
-	case ui_wnd_place_center:
-		assert(params->placement != ui_wnd_place_default ||
-		    ui_is_fullscreen(window->ui));
-		/* Center window */
-		gfx_rect_dims(&params->rect, &dims);
-		pos->x = (drect->p0.x + drect->p1.x) / 2 - dims.x / 2;
-		pos->y = (drect->p0.y + drect->p1.y) / 2 - dims.y / 2;
-		break;
-	case ui_wnd_place_top_left:
-	case ui_wnd_place_full_screen:
-		pos->x = drect->p0.x - params->rect.p0.x;
-		pos->y = drect->p0.y - params->rect.p0.y;
-		break;
-	case ui_wnd_place_top_right:
-		pos->x = drect->p1.x - params->rect.p1.x;
-		pos->y = drect->p0.y - params->rect.p0.y;
-		break;
-	case ui_wnd_place_bottom_left:
-		pos->x = drect->p0.x - params->rect.p0.x;
-		pos->y = drect->p1.y - params->rect.p1.y;
-		break;
-	case ui_wnd_place_bottom_right:
-		pos->x = drect->p1.x - params->rect.p1.x;
-		pos->y = drect->p1.y - params->rect.p1.y;
-		break;
-	case ui_wnd_place_popup:
-		/* Compute rectangle when placed below */
-		below_pos.x = params->prect.p0.x;
-		below_pos.y = params->prect.p1.y;
-		gfx_rect_translate(&below_pos, &params->rect, &below_rect);
-
-		/* Does below_rect fit within the display? */
-		if (gfx_rect_is_inside(&below_rect, drect)) {
-			/* Place popup window below parent rectangle */
-			pos->x = params->prect.p0.x - params->rect.p0.x;
-			pos->y = params->prect.p1.y - params->rect.p0.y;
-		} else {
-			/* Place popup window above parent rectangle */
-			pos->x = params->prect.p0.x;
-			pos->y = params->prect.p0.y -
-			    (params->rect.p1.y - params->rect.p0.y);
-		}
-		break;
-	}
-}
-
-/** Create window's system menu.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-static errno_t ui_window_sysmenu_create(ui_window_t *window)
-{
-	errno_t rc;
-	ui_menu_entry_t *mrestore;
-	ui_menu_entry_t *mmin;
-	ui_menu_entry_t *mmax;
-	ui_menu_entry_t *msep;
-	ui_menu_entry_t *mclose;
-
-	rc = ui_menu_create(window, &window->sysmenu);
-	if (rc != EOK)
-		goto error;
-
-	ui_menu_set_cb(window->sysmenu, &wnd_sysmenu_cb, (void *)window);
-
-	rc = ui_menu_entry_create(window->sysmenu, "~R~estore",
-	    "", &mrestore);
-	if (rc != EOK)
-		goto error;
-
-	if (!window->wdecor->maximized)
-		ui_menu_entry_set_disabled(mrestore, true);
-
-	ui_menu_entry_set_cb(mrestore, wnd_sysmenu_erestore, (void *)window);
-
-	rc = ui_menu_entry_create(window->sysmenu, "Mi~n~imize",
-	    "", &mmin);
-	if (rc != EOK)
-		goto error;
-
-	if ((window->wdecor->style & ui_wds_minimize_btn) == 0)
-		ui_menu_entry_set_disabled(mmin, true);
-
-	ui_menu_entry_set_cb(mmin, wnd_sysmenu_eminimize, (void *)window);
-
-	rc = ui_menu_entry_create(window->sysmenu, "Ma~x~imize",
-	    "", &mmax);
-	if (rc != EOK)
-		goto error;
-
-	if ((window->wdecor->style & ui_wds_maximize_btn) == 0 ||
-	    window->wdecor->maximized)
-		ui_menu_entry_set_disabled(mmax, true);
-
-	ui_menu_entry_set_cb(mmax, wnd_sysmenu_emaximize, (void *)window);
-
-	rc = ui_menu_entry_sep_create(window->sysmenu, &msep);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_menu_entry_create(window->sysmenu, "~C~lose", "Alt-F4",
-	    &mclose);
-	if (rc != EOK)
-		goto error;
-
-	if ((window->wdecor->style & ui_wds_close_btn) == 0)
-		ui_menu_entry_set_disabled(mclose, true);
-
-	ui_menu_entry_set_cb(mclose, wnd_sysmenu_eclose, (void *)window);
-
-	window->sysmenu_restore = mrestore;
-	window->sysmenu_minimize = mmin;
-	window->sysmenu_maximize = mmax;
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Create new window.
- *
- * @param ui User interface
- * @param params Window parameters
- * @param rwindow Place to store pointer to new window
- * @return EOK on success or an error code
- */
-errno_t ui_window_create(ui_t *ui, ui_wnd_params_t *params,
-    ui_window_t **rwindow)
-{
-	ui_window_t *window;
-	ui_window_t *pwindow = NULL;
-	display_info_t info;
-	gfx_coord2_t scr_dims;
-	display_wnd_params_t dparams;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *res = NULL;
-	ui_wdecor_t *wdecor = NULL;
-	dummy_gc_t *dgc = NULL;
-	gfx_bitmap_params_t bparams;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bmp = NULL;
-	gfx_coord2_t off;
-	mem_gc_t *memgc = NULL;
-	xlate_gc_t *xgc = NULL;
-	errno_t rc;
-
-	window = calloc(1, sizeof(ui_window_t));
-	if (window == NULL)
-		return ENOMEM;
-
-	window->ui = ui;
-
-	display_wnd_params_init(&dparams);
-	dparams.rect = params->rect;
-	dparams.caption = params->caption;
-	dparams.min_size = params->min_size;
-
-	/*
-	 * If idev_id is not specified, use the UI default (probably
-	 * obtained from display specification. This creates the
-	 * main window in the seat specified on the command line.
-	 */
-	if (params->idev_id != 0)
-		dparams.idev_id = params->idev_id;
-	else
-		dparams.idev_id = ui->idev_id;
-
-	if ((params->flags & ui_wndf_popup) != 0)
-		dparams.flags |= wndf_popup;
-	if ((params->flags & ui_wndf_nofocus) != 0)
-		dparams.flags |= wndf_nofocus;
-	if ((params->flags & ui_wndf_topmost) != 0)
-		dparams.flags |= wndf_topmost;
-	if ((params->flags & ui_wndf_system) != 0)
-		dparams.flags |= wndf_system;
-	if ((params->flags & ui_wndf_avoid) != 0)
-		dparams.flags |= wndf_avoid;
-
-	if (ui->display != NULL) {
-		if (params->placement != ui_wnd_place_default) {
-			rc = display_get_info(ui->display, &info);
-			if (rc != EOK)
-				goto error;
-		}
-
-		if (params->placement == ui_wnd_place_full_screen) {
-			/* Make window the size of the screen */
-			gfx_rect_dims(&info.rect, &scr_dims);
-			gfx_coord2_add(&dparams.rect.p0, &scr_dims,
-			    &dparams.rect.p1);
-		}
-
-		if (params->placement != ui_wnd_place_default) {
-			/* Set initial display window position */
-			ui_window_place(window, &info.rect, params,
-			    &dparams.pos);
-
-			dparams.flags |= wndf_setpos;
-		}
-
-		rc = display_window_create(ui->display, &dparams, &dwnd_cb,
-		    (void *) window, &window->dwindow);
-		if (rc != EOK)
-			goto error;
-
-		rc = display_window_get_gc(window->dwindow, &gc);
-		if (rc != EOK)
-			goto error;
-	} else if (ui->console != NULL) {
-		gc = console_gc_get_ctx(ui->cgc);
-
-		if (params->placement == ui_wnd_place_full_screen) {
-			/* Make window the size of the screen */
-			gfx_rect_dims(&ui->rect, &scr_dims);
-			gfx_coord2_add(&dparams.rect.p0, &scr_dims,
-			    &dparams.rect.p1);
-			(void) console_set_caption(ui->console,
-			    params->caption);
-		}
-	} else {
-		/* Needed for unit tests */
-		rc = dummygc_create(&dgc);
-		if (rc != EOK)
-			goto error;
-
-		gc = dummygc_get_ctx(dgc);
-	}
-
-#ifdef CONFIG_UI_CS_RENDER
-	/* Create window bitmap */
-	gfx_bitmap_params_init(&bparams);
-#ifndef CONFIG_WIN_DOUBLE_BUF
-	/* Console does not support direct output */
-	if (ui->display != NULL)
-		bparams.flags |= bmpf_direct_output;
-#endif
-
-	/* Move rectangle so that top-left corner is 0,0 */
-	gfx_rect_rtranslate(&dparams.rect.p0, &dparams.rect, &bparams.rect);
-
-	rc = gfx_bitmap_create(gc, &bparams, NULL, &bmp);
-	if (rc != EOK)
-		goto error;
-
-	/* Create memory GC */
-	rc = gfx_bitmap_get_alloc(bmp, &alloc);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(window->app_bmp);
-		return rc;
-	}
-
-	rc = mem_gc_create(&bparams.rect, &alloc, &ui_window_mem_gc_cb,
-	    (void *) window, &memgc);
-	if (rc != EOK) {
-		gfx_bitmap_destroy(window->app_bmp);
-		return rc;
-	}
-
-	window->bmp = bmp;
-	window->mgc = memgc;
-	window->gc = mem_gc_get_ctx(memgc);
-	window->realgc = gc;
-	(void) off;
-#else
-	/* Server-side rendering */
-
-	/* Full-screen mode? */
-	if (ui->display == NULL) {
-		/* Create translating GC to translate window contents */
-		off.x = 0;
-		off.y = 0;
-		rc = xlate_gc_create(&off, gc, &xgc);
-		if (rc != EOK)
-			goto error;
-
-		window->xgc = xgc;
-		window->gc = xlate_gc_get_ctx(xgc);
-		window->realgc = gc;
-	} else {
-		window->gc = gc;
-	}
-
-	(void) ui_window_mem_gc_cb;
-	(void) alloc;
-	(void) bparams;
-#endif
-	if (ui->display == NULL) {
-		ui_window_place(window, &ui->rect, params, &window->dpos);
-
-		if (window->xgc != NULL)
-			xlate_gc_set_off(window->xgc, &window->dpos);
-	}
-
-	rc = ui_resource_create(window->gc, ui_is_textmode(ui), &res);
-	if (rc != EOK)
-		goto error;
-
-	rc = ui_wdecor_create(res, params->caption, params->style, &wdecor);
-	if (rc != EOK)
-		goto error;
-
-	ui_wdecor_set_rect(wdecor, &dparams.rect);
-	ui_wdecor_set_cb(wdecor, &wdecor_cb, (void *) window);
-	ui_wdecor_paint(wdecor);
-
-	ui_resource_set_expose_cb(res, ui_window_expose_cb, (void *) window);
-
-	window->rect = dparams.rect;
-	window->res = res;
-	window->wdecor = wdecor;
-	window->cursor = ui_curs_arrow;
-	window->placement = params->placement;
-
-	rc = ui_window_sysmenu_create(window);
-	if (rc != EOK)
-		goto error;
-
-	*rwindow = window;
-
-	if (ui_is_fullscreen(ui))
-		pwindow = ui_window_get_active(ui);
-
-	list_append(&window->lwindows, &ui->windows);
-
-	if (ui_is_fullscreen(ui)) {
-		/* Send unfocus event to previously active window */
-		if (pwindow != NULL)
-			ui_window_send_unfocus(pwindow, 0);
-	}
-
-	return EOK;
-error:
-	if (wdecor != NULL)
-		ui_wdecor_destroy(wdecor);
-	if (res != NULL)
-		ui_resource_destroy(res);
-	if (memgc != NULL)
-		mem_gc_delete(memgc);
-	if (xgc != NULL)
-		xlate_gc_delete(xgc);
-	if (bmp != NULL)
-		gfx_bitmap_destroy(bmp);
-	if (dgc != NULL)
-		dummygc_destroy(dgc);
-	free(window);
-	return rc;
-}
-
-/** Destroy window.
- *
- * @param window Window or @c NULL
- */
-void ui_window_destroy(ui_window_t *window)
-{
-	ui_t *ui;
-	ui_window_t *nwindow;
-
-	if (window == NULL)
-		return;
-
-	ui = window->ui;
-
-	list_remove(&window->lwindows);
-	ui_control_destroy(window->control);
-	ui_menu_destroy(window->sysmenu);
-	ui_wdecor_destroy(window->wdecor);
-	ui_resource_destroy(window->res);
-	if (window->app_mgc != NULL)
-		mem_gc_delete(window->app_mgc);
-	if (window->app_bmp != NULL)
-		gfx_bitmap_destroy(window->app_bmp);
-	if (window->mgc != NULL) {
-		mem_gc_delete(window->mgc);
-		window->gc = NULL;
-	}
-	if (window->bmp != NULL)
-		gfx_bitmap_destroy(window->bmp);
-	if (window->dwindow != NULL)
-		display_window_destroy(window->dwindow);
-
-	/* Need to repaint if windows are emulated */
-	if (ui_is_fullscreen(ui)) {
-		ui_paint(ui);
-		/* Send focus event to newly active window */
-		nwindow = ui_window_get_active(ui);
-		if (nwindow != NULL)
-			ui_window_send_focus(nwindow, 0);
-	}
-
-	if (ui->console != NULL &&
-	    window->placement == ui_wnd_place_full_screen) {
-		(void) console_set_caption(ui->console, "");
-	}
-
-	free(window);
-}
-
-/** Add control to window.
- *
- * Only one control can be added to a window. If more than one control
- * is added, the results are undefined.
- *
- * @param window Window
- * @param control Control
- */
-void ui_window_add(ui_window_t *window, ui_control_t *control)
-{
-	assert(window->control == NULL);
-
-	window->control = control;
-	control->elemp = (void *) window;
-}
-
-/** Remove control from window.
- *
- * @param window Window
- * @param control Control
- */
-void ui_window_remove(ui_window_t *window, ui_control_t *control)
-{
-	assert(window->control == control);
-	assert((ui_window_t *) control->elemp == window);
-
-	window->control = NULL;
-	control->elemp = NULL;
-}
-
-/** Get active window (only valid in fullscreen mode).
- *
- * @param ui User interface
- * @return Active window
- */
-ui_window_t *ui_window_get_active(ui_t *ui)
-{
-	link_t *link;
-
-	link = list_last(&ui->windows);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ui_window_t, lwindows);
-}
-
-/** Resize or (un)maximize window.
- *
- * @param window Window
- * @param rect Rectangle
- * @param scop Size change operation
- *
- * @return EOK on success or an error code
- */
-errno_t ui_window_size_change(ui_window_t *window, gfx_rect_t *rect,
-    ui_wnd_sc_op_t scop)
-{
-	gfx_coord2_t offs;
-	gfx_rect_t nrect;
-	gfx_rect_t arect;
-	gfx_bitmap_t *app_bmp = NULL;
-	gfx_bitmap_t *win_bmp = NULL;
-	gfx_bitmap_params_t app_params;
-	gfx_bitmap_params_t win_params;
-	gfx_bitmap_alloc_t app_alloc;
-	gfx_bitmap_alloc_t win_alloc;
-	errno_t rc;
-
-	/*
-	 * Move rect so that p0=0,0 - keep window's coordinate system origin
-	 * locked to top-left corner of the window.
-	 */
-	offs = rect->p0;
-	gfx_rect_rtranslate(&offs, rect, &nrect);
-
-	/* mgc != NULL iff client-side rendering */
-	if (window->mgc != NULL) {
-#ifdef CONFIG_WIN_DOUBLE_BUF
-		/*
-		 * Create new window bitmap in advance. If direct mapping,
-		 * will need do it after resizing the window.
-		 */
-		assert(window->bmp != NULL);
-		gfx_bitmap_params_init(&win_params);
-		win_params.rect = nrect;
-
-		rc = gfx_bitmap_create(window->realgc, &win_params, NULL,
-		    &win_bmp);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_bitmap_get_alloc(win_bmp, &win_alloc);
-		if (rc != EOK)
-			goto error;
-#endif
-	}
-
-	/* Application area GC? */
-	if (window->app_gc != NULL) {
-		/* Resize application bitmap */
-		assert(window->app_bmp != NULL);
-
-		gfx_bitmap_params_init(&app_params);
-
-		/*
-		 * The bitmap will have the same dimensions as the
-		 * application rectangle, but start at 0,0.
-		 */
-		ui_wdecor_app_from_rect(window->wdecor->style, &nrect, &arect);
-		gfx_rect_rtranslate(&arect.p0, &arect, &app_params.rect);
-
-		rc = gfx_bitmap_create(window->gc, &app_params, NULL,
-		    &app_bmp);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_bitmap_get_alloc(app_bmp, &app_alloc);
-		if (rc != EOK)
-			goto error;
-	}
-
-	/* dwindow can be NULL in case of unit tests or fullscreen mode */
-	if (window->dwindow != NULL) {
-		switch (scop) {
-		case ui_wsc_resize:
-			rc = display_window_resize(window->dwindow, &offs,
-			    &nrect);
-			if (rc != EOK)
-				goto error;
-			break;
-		case ui_wsc_maximize:
-			rc = display_window_maximize(window->dwindow);
-			if (rc != EOK)
-				goto error;
-			break;
-		case ui_wsc_unmaximize:
-			rc = display_window_unmaximize(window->dwindow);
-			if (rc != EOK)
-				goto error;
-			break;
-		}
-	}
-
-	/* Client side rendering? */
-	if (window->mgc != NULL) {
-#ifndef CONFIG_WIN_DOUBLE_BUF
-		/* Window is resized, now we can map the window bitmap again */
-		gfx_bitmap_params_init(&win_params);
-		win_params.flags |= bmpf_direct_output;
-		win_params.rect = nrect;
-
-		rc = gfx_bitmap_create(window->realgc, &win_params, NULL,
-		    &win_bmp);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_bitmap_get_alloc(win_bmp, &win_alloc);
-		if (rc != EOK)
-			goto error;
-#endif
-		mem_gc_retarget(window->mgc, &win_params.rect, &win_alloc);
-
-		gfx_bitmap_destroy(window->bmp);
-		window->bmp = win_bmp;
-	}
-
-	window->rect = nrect;
-	ui_wdecor_set_rect(window->wdecor, &nrect);
-	ui_wdecor_paint(window->wdecor);
-	gfx_update(window->gc);
-
-	/* Application area GC? */
-	if (window->app_gc != NULL) {
-		mem_gc_retarget(window->app_mgc, &app_params.rect, &app_alloc);
-
-		gfx_bitmap_destroy(window->app_bmp);
-		window->app_bmp = app_bmp;
-	}
-
-	return EOK;
-error:
-	if (app_bmp != NULL)
-		gfx_bitmap_destroy(app_bmp);
-	if (win_bmp != NULL)
-		gfx_bitmap_destroy(win_bmp);
-	return rc;
-}
-
-/** Resize/move window.
- *
- * Resize window to the dimensions of @a rect. If @a rect.p0 is not 0,0,
- * the top-left corner of the window will move on the screen accordingly.
- *
- * @param window Window
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-errno_t ui_window_resize(ui_window_t *window, gfx_rect_t *rect)
-{
-	return ui_window_size_change(window, rect, ui_wsc_resize);
-}
-
-/** Set window callbacks.
- *
- * @param window Window
- * @param cb Window callbacks
- * @param arg Callback argument
- */
-void ui_window_set_cb(ui_window_t *window, ui_window_cb_t *cb, void *arg)
-{
-	window->cb = cb;
-	window->arg = arg;
-}
-
-/** Change window caption.
- *
- * @param window Window
- * @param caption New caption
- *
- * @return EOK on success or an error code
- */
-errno_t ui_window_set_caption(ui_window_t *window, const char *caption)
-{
-	errno_t rc;
-
-	/* Set console caption if fullscreen window on console */
-	if (window->ui->console != NULL && window->placement ==
-	    ui_wnd_place_full_screen) {
-		rc = console_set_caption(window->ui->console, caption);
-		if (rc != EOK)
-			return rc;
-	}
-
-	/* Set display window caption if running on display service */
-	if (window->dwindow != NULL) {
-		rc = display_window_set_caption(window->dwindow, caption);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return ui_wdecor_set_caption(window->wdecor, caption);
-}
-
-/** Get window's containing UI.
- *
- * @param window Window
- * @return Containing UI
- */
-ui_t *ui_window_get_ui(ui_window_t *window)
-{
-	return window->ui;
-}
-
-/** Get UI resource from window.
- *
- * @param window Window
- * @return UI resource
- */
-ui_resource_t *ui_window_get_res(ui_window_t *window)
-{
-	return window->res;
-}
-
-/** Get window GC.
- *
- * @param window Window
- * @return GC (relative to window)
- */
-gfx_context_t *ui_window_get_gc(ui_window_t *window)
-{
-	return window->gc;
-}
-
-/** Get window position.
- *
- * @param window Window
- * @param pos Place to store position
- * @return EOK on success or an error code
- */
-errno_t ui_window_get_pos(ui_window_t *window, gfx_coord2_t *pos)
-{
-	errno_t rc;
-
-	if (window->dwindow != NULL) {
-		rc = display_window_get_pos(window->dwindow, pos);
-		if (rc != EOK)
-			return rc;
-	} else {
-		*pos = window->dpos;
-	}
-
-	return EOK;
-}
-
-/** Get window application area GC
- *
- * @param window Window
- * @param rgc Place to store GC (relative to application area)
- * @return EOK on success or an error code
- */
-errno_t ui_window_get_app_gc(ui_window_t *window, gfx_context_t **rgc)
-{
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t rect;
-	mem_gc_t *memgc;
-	errno_t rc;
-
-	if (window->app_gc == NULL) {
-		assert(window->app_bmp == NULL);
-
-		gfx_bitmap_params_init(&params);
-
-		/*
-		 * The bitmap will have the same dimensions as the
-		 * application rectangle, but start at 0,0.
-		 */
-		ui_window_get_app_rect(window, &rect);
-		gfx_rect_rtranslate(&rect.p0, &rect, &params.rect);
-
-		rc = gfx_bitmap_create(window->gc, &params, NULL,
-		    &window->app_bmp);
-		if (rc != EOK)
-			return rc;
-
-		rc = gfx_bitmap_get_alloc(window->app_bmp, &alloc);
-		if (rc != EOK) {
-			gfx_bitmap_destroy(window->app_bmp);
-			return rc;
-		}
-
-		rc = mem_gc_create(&params.rect, &alloc,
-		    &ui_window_app_mem_gc_cb, (void *) window, &memgc);
-		if (rc != EOK) {
-			gfx_bitmap_destroy(window->app_bmp);
-			return rc;
-		}
-
-		window->app_mgc = memgc;
-		window->app_gc = mem_gc_get_ctx(memgc);
-	}
-
-	*rgc = window->app_gc;
-	return EOK;
-}
-
-/** Get window application rectangle
- *
- * @param window Window
- * @param rect Place to store application rectangle
- */
-void ui_window_get_app_rect(ui_window_t *window, gfx_rect_t *rect)
-{
-	ui_wdecor_geom_t geom;
-
-	ui_wdecor_get_geom(window->wdecor, &geom);
-	*rect = geom.app_area_rect;
-}
-
-/** Set cursor when pointer is hovering over a control.
- *
- * @param window Window
- * @param cursor Cursor
- */
-void ui_window_set_ctl_cursor(ui_window_t *window, ui_stock_cursor_t cursor)
-{
-	display_stock_cursor_t dcursor;
-
-	dcursor = wnd_dcursor_from_cursor(cursor);
-
-	if (window->dwindow != NULL)
-		(void) display_window_set_cursor(window->dwindow, dcursor);
-}
-
-/** Paint window
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t ui_window_paint(ui_window_t *window)
-{
-	return ui_window_send_paint(window);
-}
-
-/** Handle window close event. */
-static void dwnd_close_event(void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-
-	fibril_mutex_lock(&ui->lock);
-	ui_window_send_close(window);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Handle window focus event. */
-static void dwnd_focus_event(void *arg, unsigned nfocus)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-
-	fibril_mutex_lock(&ui->lock);
-	(void)nfocus;
-
-	if (window->wdecor != NULL) {
-		ui_wdecor_set_active(window->wdecor, true);
-		ui_wdecor_paint(window->wdecor);
-	}
-
-	ui_window_send_focus(window, nfocus);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Handle window keyboard event */
-static void dwnd_kbd_event(void *arg, kbd_event_t *kbd_event)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-
-	fibril_mutex_lock(&ui->lock);
-	ui_window_send_kbd(window, kbd_event);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Handle window position event */
-static void dwnd_pos_event(void *arg, pos_event_t *event)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-	ui_evclaim_t claim;
-
-	/* Make sure we don't process events until fully initialized */
-	if (window->wdecor == NULL)
-		return;
-
-	fibril_mutex_lock(&ui->lock);
-
-	claim = ui_wdecor_pos_event(window->wdecor, event);
-	if (claim == ui_claimed) {
-		fibril_mutex_unlock(&ui->lock);
-		return;
-	}
-
-	ui_window_send_pos(window, event);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Handle window resize event */
-static void dwnd_resize_event(void *arg, gfx_rect_t *rect)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-
-	/* Make sure we don't process events until fully initialized */
-	if (window->wdecor == NULL)
-		return;
-
-	if ((window->wdecor->style & ui_wds_resizable) == 0)
-		return;
-
-	fibril_mutex_lock(&ui->lock);
-	(void) ui_window_resize(window, rect);
-	ui_window_send_resize(window);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Handle window unfocus event. */
-static void dwnd_unfocus_event(void *arg, unsigned nfocus)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	ui_t *ui = window->ui;
-
-	fibril_mutex_lock(&ui->lock);
-
-	if (window->wdecor != NULL && nfocus == 0) {
-		ui_wdecor_set_active(window->wdecor, false);
-		ui_wdecor_paint(window->wdecor);
-	}
-
-	ui_window_send_unfocus(window, nfocus);
-	fibril_mutex_unlock(&ui->lock);
-}
-
-/** Window decoration requested opening of system menu.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param idev_id Input device ID
- */
-static void wd_sysmenu_open(ui_wdecor_t *wdecor, void *arg, sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_send_sysmenu(window, idev_id);
-}
-
-/** Window decoration requested moving left from system menu handle.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param idev_id Input device ID
- */
-static void wd_sysmenu_left(ui_wdecor_t *wdecor, void *arg, sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (window->mbar != NULL) {
-		ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-		ui_menu_close(window->sysmenu);
-		ui_menu_bar_select_last(window->mbar, false, idev_id);
-	}
-}
-
-/** Window decoration requested moving right from system menu handle.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param idev_id Input device ID
- */
-static void wd_sysmenu_right(ui_wdecor_t *wdecor, void *arg, sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (window->mbar != NULL) {
-		ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-		ui_menu_close(window->sysmenu);
-		ui_menu_bar_select_first(window->mbar, false, idev_id);
-	}
-}
-
-/** Window decoration detected accelerator press from system menu handle.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param c Accelerator key
- * @param idev_id Input device ID
- */
-static void wd_sysmenu_accel(ui_wdecor_t *wdecor, void *arg, char32_t c,
-    sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (window->mbar != NULL) {
-		ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-		ui_menu_close(window->sysmenu);
-		ui_menu_bar_press_accel(window->mbar, c, idev_id);
-	}
-}
-
-/** Window decoration requested window minimization.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- */
-static void wd_minimize(ui_wdecor_t *wdecor, void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_send_minimize(window);
-}
-
-/** Window decoration requested window maximization.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- */
-static void wd_maximize(ui_wdecor_t *wdecor, void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_send_maximize(window);
-}
-
-/** Window decoration requested window unmaximization.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- */
-static void wd_unmaximize(ui_wdecor_t *wdecor, void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_send_unmaximize(window);
-}
-
-/** Window decoration requested window closure.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- */
-static void wd_close(ui_wdecor_t *wdecor, void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_send_close(window);
-}
-
-/** Window decoration requested window move.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param pos Position where the title bar was pressed
- * @param pos_id Positioning device ID
- */
-static void wd_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos,
-    sysarg_t pos_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (window->dwindow != NULL)
-		(void) display_window_move_req(window->dwindow, pos, pos_id);
-}
-
-/** Window decoration requested window resize.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param rsztype Resize type
- * @param pos Position where the button was pressed
- * @param pos_id Positioning device ID
- */
-static void wd_resize(ui_wdecor_t *wdecor, void *arg,
-    ui_wdecor_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (window->dwindow != NULL) {
-		(void) display_window_resize_req(window->dwindow,
-		    (display_wnd_rsztype_t) rsztype, // Same constants in the enums
-		    pos, pos_id);
-	}
-}
-
-/** Get display stock cursor from UI stock cursor.
- *
- * @param cursor UI stock cursor
- * @return Display stock cursor
- */
-display_stock_cursor_t wnd_dcursor_from_cursor(ui_stock_cursor_t cursor)
-{
-	display_stock_cursor_t dcursor;
-
-	dcursor = dcurs_arrow;
-
-	switch (cursor) {
-	case ui_curs_arrow:
-		dcursor = dcurs_arrow;
-		break;
-	case ui_curs_size_ud:
-		dcursor = dcurs_size_ud;
-		break;
-	case ui_curs_size_lr:
-		dcursor = dcurs_size_lr;
-		break;
-	case ui_curs_size_uldr:
-		dcursor = dcurs_size_uldr;
-		break;
-	case ui_curs_size_urdl:
-		dcursor = dcurs_size_urdl;
-		break;
-	case ui_curs_ibeam:
-		dcursor = dcurs_ibeam;
-		break;
-	}
-
-	return dcursor;
-}
-
-/** Window decoration requested changing cursor.
- *
- * @param wdecor Window decoration
- * @param arg Argument (window)
- * @param cursor Cursor to set
- */
-static void wd_set_cursor(ui_wdecor_t *wdecor, void *arg,
-    ui_stock_cursor_t cursor)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	display_stock_cursor_t dcursor;
-
-	if (cursor == window->cursor)
-		return;
-
-	dcursor = wnd_dcursor_from_cursor(cursor);
-
-	if (window->dwindow != NULL)
-		(void) display_window_set_cursor(window->dwindow, dcursor);
-
-	window->cursor = cursor;
-}
-
-/** Send window sysmenu event.
- *
- * @param window Window
- * @parma idev_id Input device ID
- */
-void ui_window_send_sysmenu(ui_window_t *window, sysarg_t idev_id)
-{
-	if (window->cb != NULL && window->cb->sysmenu != NULL)
-		window->cb->sysmenu(window, window->arg, idev_id);
-	else
-		ui_window_def_sysmenu(window, idev_id);
-}
-
-/** Send window minimize event.
- *
- * @param window Window
- */
-void ui_window_send_minimize(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->minimize != NULL)
-		window->cb->minimize(window, window->arg);
-	else
-		ui_window_def_minimize(window);
-}
-
-/** Send window maximize event.
- *
- * @param window Window
- */
-void ui_window_send_maximize(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->maximize != NULL)
-		window->cb->maximize(window, window->arg);
-	else
-		ui_window_def_maximize(window);
-}
-
-/** Send window unmaximize event.
- *
- * @param window Window
- */
-void ui_window_send_unmaximize(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->unmaximize != NULL)
-		window->cb->unmaximize(window, window->arg);
-	else
-		ui_window_def_unmaximize(window);
-}
-
-/** Send window close event.
- *
- * @param window Window
- */
-void ui_window_send_close(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->close != NULL)
-		window->cb->close(window, window->arg);
-}
-
-/** Send window focus event.
- *
- * @param window Window
- * @param nfocus New number of foci
- */
-void ui_window_send_focus(ui_window_t *window, unsigned nfocus)
-{
-	if (window->cb != NULL && window->cb->focus != NULL)
-		window->cb->focus(window, window->arg, nfocus);
-}
-
-/** Send window keyboard event.
- *
- * @param window Window
- */
-void ui_window_send_kbd(ui_window_t *window, kbd_event_t *kbd)
-{
-	if (window->cb != NULL && window->cb->kbd != NULL)
-		window->cb->kbd(window, window->arg, kbd);
-	else
-		ui_window_def_kbd(window, kbd);
-}
-
-/** Send window paint event.
- *
- * @param window Window
- */
-errno_t ui_window_send_paint(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->paint != NULL)
-		return window->cb->paint(window, window->arg);
-	else
-		return ui_window_def_paint(window);
-}
-
-/** Send window position event.
- *
- * @param window Window
- */
-void ui_window_send_pos(ui_window_t *window, pos_event_t *pos)
-{
-	if (window->cb != NULL && window->cb->pos != NULL)
-		window->cb->pos(window, window->arg, pos);
-	else
-		ui_window_def_pos(window, pos);
-}
-
-/** Send window unfocus event.
- *
- * @param window Window
- * @param nfocus Number of remaining foci
- */
-void ui_window_send_unfocus(ui_window_t *window, unsigned nfocus)
-{
-	if (window->cb != NULL && window->cb->unfocus != NULL)
-		window->cb->unfocus(window, window->arg, nfocus);
-	else
-		return ui_window_def_unfocus(window, nfocus);
-}
-
-/** Send window resize event.
- *
- * @param window Window
- */
-void ui_window_send_resize(ui_window_t *window)
-{
-	if (window->cb != NULL && window->cb->resize != NULL)
-		window->cb->resize(window, window->arg);
-	else
-		return ui_window_def_resize(window);
-}
-
-/** Default window sysmenu routine.
- *
- * @param window Window
- * @param idev_id Input device ID
- * @return EOK on success or an error code
- */
-errno_t ui_window_def_sysmenu(ui_window_t *window, sysarg_t idev_id)
-{
-	errno_t rc;
-	ui_wdecor_geom_t geom;
-
-	if (ui_menu_is_open(window->sysmenu)) {
-		ui_menu_close(window->sysmenu);
-	} else {
-		ui_wdecor_get_geom(window->wdecor, &geom);
-
-		rc = ui_menu_open(window->sysmenu, &geom.title_bar_rect,
-		    idev_id);
-		if (rc != EOK)
-			goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Default window minimize routine.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t ui_window_def_minimize(ui_window_t *window)
-{
-	errno_t rc;
-
-	if (window->dwindow != NULL) {
-		rc = display_window_minimize(window->dwindow);
-		if (rc != EOK)
-			goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Default window maximize routine.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t ui_window_def_maximize(ui_window_t *window)
-{
-	errno_t rc;
-	gfx_rect_t old_rect;
-	gfx_rect_t rect;
-
-	old_rect = window->rect;
-
-	if (window->dwindow != NULL) {
-		rc = display_window_get_max_rect(window->dwindow, &rect);
-		if (rc != EOK)
-			return rc;
-	} else {
-		rect = window->ui->rect;
-	}
-
-	ui_wdecor_set_maximized(window->wdecor, true);
-	ui_menu_entry_set_disabled(window->sysmenu_restore, false);
-	ui_menu_entry_set_disabled(window->sysmenu_maximize, true);
-
-	rc = ui_window_size_change(window, &rect, ui_wsc_maximize);
-	if (rc != EOK) {
-		ui_wdecor_set_maximized(window->wdecor, false);
-		return rc;
-	}
-
-	window->normal_rect = old_rect;
-	(void) ui_window_paint(window);
-	return EOK;
-}
-
-/** Default window unmaximize routine.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t ui_window_def_unmaximize(ui_window_t *window)
-{
-	errno_t rc;
-
-	ui_wdecor_set_maximized(window->wdecor, false);
-	ui_menu_entry_set_disabled(window->sysmenu_restore, true);
-	ui_menu_entry_set_disabled(window->sysmenu_maximize, false);
-
-	rc = ui_window_size_change(window, &window->normal_rect,
-	    ui_wsc_unmaximize);
-	if (rc != EOK) {
-		ui_wdecor_set_maximized(window->wdecor, true);
-		printf("ui_window_size_change->error\n");
-		return rc;
-	}
-
-	(void) ui_window_paint(window);
-	return EOK;
-}
-
-/** Default window keyboard event routine.
- *
- * @param window Window
- * @return ui_claimed iff event was claimed
- */
-ui_evclaim_t ui_window_def_kbd(ui_window_t *window, kbd_event_t *kbd)
-{
-	ui_evclaim_t claim;
-
-	if (window->control != NULL)
-		claim = ui_control_kbd_event(window->control, kbd);
-	else
-		claim = ui_unclaimed;
-
-	if (claim == ui_unclaimed)
-		return ui_wdecor_kbd_event(window->wdecor, kbd);
-
-	return ui_unclaimed;
-}
-
-/** Default window paint routine.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-errno_t ui_window_def_paint(ui_window_t *window)
-{
-	gfx_rect_t app_rect;
-	errno_t rc;
-
-	rc = gfx_set_color(window->gc, window->res->wnd_face_color);
-	if (rc != EOK)
-		return rc;
-
-	ui_window_get_app_rect(window, &app_rect);
-
-	rc = gfx_fill_rect(window->gc, &app_rect);
-	if (rc != EOK)
-		return rc;
-
-	if (window->control != NULL)
-		return ui_control_paint(window->control);
-
-	rc = gfx_update(window->res->gc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Default window position event routine.
- *
- * @param window Window
- */
-void ui_window_def_pos(ui_window_t *window, pos_event_t *pos)
-{
-	if (window->control != NULL)
-		ui_control_pos_event(window->control, pos);
-}
-
-/** Default window unfocus routine.
- *
- * @param window Window
- * @param nfocus Number of remaining foci
- * @return EOK on success or an error code
- */
-void ui_window_def_unfocus(ui_window_t *window, unsigned nfocus)
-{
-	if (window->control != NULL)
-		ui_control_unfocus(window->control, nfocus);
-}
-
-/** Default window resize routine.
- *
- * @param window Window
- * @return EOK on success or an error code
- */
-void ui_window_def_resize(ui_window_t *window)
-{
-	ui_window_paint(window);
-}
-
-/** Handle system menu left event.
- *
- * @param sysmenu System menu
- * @param arg Argument (ui_window_t *)
- * @param idev_id Input device ID
- */
-static void wnd_sysmenu_left(ui_menu_t *sysmenu, void *arg, sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	if (window->mbar != NULL) {
-		ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-		ui_menu_close(sysmenu);
-		ui_menu_bar_select_last(window->mbar, true, idev_id);
-	}
-}
-
-/** Handle system menu right event.
- *
- * @param sysmenu System menu
- * @param arg Argument (ui_window_t *)
- * @param idev_id Input device ID
- */
-static void wnd_sysmenu_right(ui_menu_t *sysmenu, void *arg, sysarg_t idev_id)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	if (window->mbar != NULL) {
-		ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-		ui_menu_close(sysmenu);
-		ui_menu_bar_select_first(window->mbar, true, idev_id);
-	}
-}
-
-/** Handle system menu close request event.
- *
- * @param sysmenu System menu
- * @param arg Argument (ui_window_t *)
- * @param idev_id Input device ID
- */
-static void wnd_sysmenu_close_req(ui_menu_t *sysmenu, void *arg)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);
-	ui_menu_close(sysmenu);
-}
-
-/** Handle system menu Restore entry activation.
- *
- * @param mentry Menu entry
- * @param arg Argument (ui_window_t *)
- */
-static void wnd_sysmenu_erestore(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	ui_window_send_unmaximize(window);
-}
-
-/** Handle system menu Minimize entry activation.
- *
- * @param mentry Menu entry
- * @param arg Argument (ui_window_t *)
- */
-static void wnd_sysmenu_eminimize(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	ui_window_send_minimize(window);
-}
-
-/** Handle system menu Maximize entry activation.
- *
- * @param mentry Menu entry
- * @param arg Argument (ui_window_t *)
- */
-static void wnd_sysmenu_emaximize(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	ui_window_send_maximize(window);
-}
-
-/** Handle system menu Close entry activation.
- *
- * @param mentry Menu entry
- * @param arg Argument (ui_window_t *)
- */
-static void wnd_sysmenu_eclose(ui_menu_entry_t *mentry, void *arg)
-{
-	ui_window_t *window = (ui_window_t *)arg;
-
-	ui_window_send_close(window);
-}
-
-/** Handle system menu press accelerator key event.
- *
- * @param sysmenu System menu
- * @param arg Argument (ui_window_t *)
- * @param idev_id Input device ID
- */
-static void wnd_sysmenu_press_accel(ui_menu_t *sysmenu, void *arg,
-    char32_t c, sysarg_t idev_id)
-{
-	(void)sysmenu;
-	(void)arg;
-	(void)c;
-	(void)idev_id;
-}
-
-/** Window invalidate callback
- *
- * @param arg Argument (ui_window_t *)
- * @param rect Rectangle to update
- */
-static void ui_window_invalidate(void *arg, gfx_rect_t *rect)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	gfx_rect_t env;
-
-	gfx_rect_envelope(&window->dirty_rect, rect, &env);
-	window->dirty_rect = env;
-}
-
-/** Window update callback
- *
- * @param arg Argument (ui_window_t *)
- */
-static void ui_window_update(void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	if (!gfx_rect_is_empty(&window->dirty_rect)) {
-		(void) gfx_bitmap_render(window->bmp, &window->dirty_rect,
-		    &window->dpos);
-	}
-
-	window->dirty_rect.p0.x = 0;
-	window->dirty_rect.p0.y = 0;
-	window->dirty_rect.p1.x = 0;
-	window->dirty_rect.p1.y = 0;
-}
-
-/** Window cursor get position callback
- *
- * @param arg Argument (ui_window_t *)
- * @param pos Place to store position
- */
-static errno_t ui_window_cursor_get_pos(void *arg, gfx_coord2_t *pos)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	gfx_coord2_t cpos;
-	errno_t rc;
-
-	rc = gfx_cursor_get_pos(window->realgc, &cpos);
-	if (rc != EOK)
-		return rc;
-
-	pos->x = cpos.x - window->dpos.x;
-	pos->y = cpos.y - window->dpos.y;
-	return EOK;
-}
-
-/** Window cursor set position callback
- *
- * @param arg Argument (ui_window_t *)
- * @param pos New position
- */
-static errno_t ui_window_cursor_set_pos(void *arg, gfx_coord2_t *pos)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	gfx_coord2_t cpos;
-
-	cpos.x = pos->x + window->dpos.x;
-	cpos.y = pos->y + window->dpos.y;
-
-	return gfx_cursor_set_pos(window->realgc, &cpos);
-}
-
-/** Window cursor set visibility callback
- *
- * @param arg Argument (ui_window_t *)
- * @param visible @c true iff cursor is to be made visible
- */
-static errno_t ui_window_cursor_set_visible(void *arg, bool visible)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	return gfx_cursor_set_visible(window->realgc, visible);
-}
-
-/** Application area invalidate callback
- *
- * @param arg Argument (ui_window_t *)
- * @param rect Rectangle to update
- */
-static void ui_window_app_invalidate(void *arg, gfx_rect_t *rect)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-	gfx_rect_t arect;
-
-	ui_window_get_app_rect(window, &arect);
-
-	/* Render bitmap rectangle inside the application area */
-	(void) gfx_bitmap_render(window->app_bmp, rect, &arect.p0);
-	/*
-	 * TODO Update applications to call gfx_update(), then
-	 * we can defer update to ui_window_app_update().
-	 */
-	(void) gfx_update(window->res->gc);
-}
-
-/** Application area update callback
- *
- * @param arg Argument (ui_window_t *)
- */
-static void ui_window_app_update(void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	/*
-	 * Not used since display is updated immediately
-	 * in ui_window_app_invalidate
-	 */
-	(void) window;
-}
-
-/** Window expose callback. */
-static void ui_window_expose_cb(void *arg)
-{
-	ui_window_t *window = (ui_window_t *) arg;
-
-	ui_window_paint(window);
-}
-
-/** @}
- */
Index: pace/lib/ui/test/accel.c
===================================================================
--- uspace/lib/ui/test/accel.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTvvhhzccgggrERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdlib.h>
-#include <str.h>
-#include <uchar.h>
-#include <ui/accel.h>
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(accel);
-
-/** ui_accel_process() */
-PCUT_TEST(process)
-{
-	errno_t rc;
-	char *buf;
-	char *endptr;
-	char *bp1;
-	char *bp2;
-
-	/* Cases where one string is produced */
-
-	rc = ui_accel_process("", &buf, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("", buf);
-	PCUT_ASSERT_EQUALS(buf + 1, endptr);
-	free(buf);
-
-	rc = ui_accel_process("Hello", &buf, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("Hello", buf);
-	PCUT_ASSERT_EQUALS(buf + str_size("Hello") + 1, endptr);
-	free(buf);
-
-	rc = ui_accel_process("~~Hello~~", &buf, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("~Hello~", buf);
-	PCUT_ASSERT_EQUALS(buf + str_size("~Hello~") + 1, endptr);
-	free(buf);
-
-	/* Three strings are produced (the first is empty) */
-
-	rc = ui_accel_process("~H~ello", &buf, &endptr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("", buf);
-
-	bp1 = buf + str_size(buf) + 1;
-	PCUT_ASSERT_STR_EQUALS("H", bp1);
-
-	bp2 = bp1 + str_size(bp1) + 1;
-	PCUT_ASSERT_STR_EQUALS("ello", bp2);
-
-	PCUT_ASSERT_EQUALS(bp2 + str_size("ello") + 1, endptr);
-	free(buf);
-}
-
-/** ui_accel_get() */
-PCUT_TEST(get)
-{
-	char32_t a;
-
-	a = ui_accel_get("");
-	PCUT_ASSERT_EQUALS('\0', a);
-
-	a = ui_accel_get("Hello");
-	PCUT_ASSERT_EQUALS('\0', a);
-
-	a = ui_accel_get("~~");
-	PCUT_ASSERT_EQUALS('\0', a);
-
-	a = ui_accel_get("~~Hello~~");
-	PCUT_ASSERT_EQUALS('\0', a);
-
-	a = ui_accel_get("~H~ello");
-	PCUT_ASSERT_EQUALS('h', a);
-
-	a = ui_accel_get("H~e~llo");
-	PCUT_ASSERT_EQUALS('e', a);
-}
-
-PCUT_EXPORT(accel);
Index: pace/lib/ui/test/checkbox.c
===================================================================
--- uspace/lib/ui/test/checkbox.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,522 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/checkbox.h>
-#include <ui/resource.h>
-#include "../private/checkbox.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(checkbox);
-
-static void test_checkbox_switched(ui_checkbox_t *, void *, bool);
-
-static ui_checkbox_cb_t test_checkbox_cb = {
-	.switched = test_checkbox_switched
-};
-
-static ui_checkbox_cb_t dummy_checkbox_cb = {
-};
-
-typedef struct {
-	bool switched;
-} test_cb_resp_t;
-
-/** Create and destroy check box */
-PCUT_TEST(create_destroy)
-{
-	ui_checkbox_t *checkbox = NULL;
-	errno_t rc;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(checkbox);
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** ui_checkbox_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_checkbox_destroy(NULL);
-}
-
-/** ui_checkbox_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_checkbox_t *checkbox;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_checkbox_ctl(checkbox);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set check box rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_checkbox_t *checkbox;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_checkbox_set_rect(checkbox, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, checkbox->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, checkbox->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, checkbox->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, checkbox->rect.p1.y);
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** Get check box checked returns internal field */
-PCUT_TEST(get_checked)
-{
-	ui_checkbox_t *checkbox;
-	errno_t rc;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	checkbox->checked = false;
-	PCUT_ASSERT_FALSE(ui_checkbox_get_checked(checkbox));
-	checkbox->checked = true;
-	PCUT_ASSERT_TRUE(ui_checkbox_get_checked(checkbox));
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** Set check box checked sets internal field */
-PCUT_TEST(set_checked)
-{
-	ui_checkbox_t *checkbox;
-	errno_t rc;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_checkbox_set_checked(checkbox, true);
-	PCUT_ASSERT_TRUE(checkbox->checked);
-	ui_checkbox_set_checked(checkbox, false);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** Paint check box in graphics mode */
-PCUT_TEST(paint_gfx)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_checkbox_paint_gfx(checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint check box in text mode */
-PCUT_TEST(paint_text)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_checkbox_paint_text(checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_checkbox_switched() */
-PCUT_TEST(switched)
-{
-	errno_t rc;
-	ui_checkbox_t *checkbox;
-	test_cb_resp_t resp;
-
-	rc = ui_checkbox_create(NULL, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Switched with no callbacks set */
-	ui_checkbox_switched(checkbox);
-
-	/* Switched with callback not implementing switched */
-	ui_checkbox_set_cb(checkbox, &dummy_checkbox_cb, NULL);
-	ui_checkbox_switched(checkbox);
-
-	/* Switched with real callback set */
-	resp.switched = false;
-	ui_checkbox_set_cb(checkbox, &test_checkbox_cb, &resp);
-	ui_checkbox_switched(checkbox);
-	PCUT_ASSERT_TRUE(resp.switched);
-
-	ui_checkbox_destroy(checkbox);
-}
-
-/** Press and release check box */
-PCUT_TEST(press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	resp.switched = false;
-	ui_checkbox_set_cb(checkbox, &test_checkbox_cb, &resp);
-
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	ui_checkbox_press(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_release(checkbox);
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_TRUE(resp.switched);
-	PCUT_ASSERT_TRUE(checkbox->checked);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave and release check box */
-PCUT_TEST(press_leave_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.switched = false;
-	ui_checkbox_set_cb(checkbox, &test_checkbox_cb, &resp);
-
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	ui_checkbox_press(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_leave(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_release(checkbox);
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave, enter and release check box */
-PCUT_TEST(press_leave_enter_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	resp.switched = false;
-	ui_checkbox_set_cb(checkbox, &test_checkbox_cb, &resp);
-
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	ui_checkbox_press(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_leave(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_enter(checkbox);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_FALSE(resp.switched);
-	PCUT_ASSERT_FALSE(checkbox->checked);
-
-	ui_checkbox_release(checkbox);
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-	PCUT_ASSERT_TRUE(resp.switched);
-	PCUT_ASSERT_TRUE(checkbox->checked);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */
-PCUT_TEST(pos_event_press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(checkbox->held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_checkbox_set_rect(checkbox, &rect);
-
-	/* Press outside is not claimed and does nothing */
-	event.type = POS_PRESS;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	/* Press inside is claimed and depresses check box */
-	event.type = POS_PRESS;
-	event.hpos = 10;
-	event.vpos = 20;
-	claim = ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_TRUE(checkbox->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases check box */
-	event.type = POS_RELEASE;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_FALSE(checkbox->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_UPDATE to enter/leave */
-PCUT_TEST(pos_event_enter_leave)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_checkbox_t *checkbox;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_checkbox_create(resource, "Hello", &checkbox);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_checkbox_set_rect(checkbox, &rect);
-
-	/* Moving outside does nothing */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	/* Moving inside sets inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 10;
-	event.vpos = 20;
-	ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_TRUE(checkbox->inside);
-
-	/* Moving outside clears inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_checkbox_pos_event(checkbox, &event);
-	PCUT_ASSERT_FALSE(checkbox->inside);
-
-	ui_checkbox_destroy(checkbox);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_checkbox_switched(ui_checkbox_t *checkbox, void *arg,
-    bool checked)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->switched = true;
-}
-
-PCUT_EXPORT(checkbox);
Index: pace/lib/ui/test/clickmatic.c
===================================================================
--- uspace/lib/ui/test/clickmatic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,135 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <ui/clickmatic.h>
-#include <ui/ui.h>
-#include "../private/clickmatic.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(clickmatic);
-
-static void test_clicked(ui_clickmatic_t *, void *);
-
-static ui_clickmatic_cb_t test_cb = {
-	.clicked = test_clicked
-};
-
-typedef struct {
-	int clicked_cnt;
-} test_resp_t;
-
-/** Create and destroy clickmatic */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_clickmatic_t *clickmatic = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_clickmatic_create(ui, &clickmatic);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(clickmatic);
-
-	ui_clickmatic_destroy(clickmatic);
-	ui_destroy(ui);
-}
-
-/** ui_clickmatic_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_clickmatic_destroy(NULL);
-}
-
-/** ui_clickmatic_set_cb() sets internal fields */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui = NULL;
-	ui_clickmatic_t *clickmatic = NULL;
-	test_resp_t test_resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_clickmatic_create(ui, &clickmatic);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(clickmatic);
-
-	ui_clickmatic_set_cb(clickmatic, &test_cb, (void *)&test_resp);
-	PCUT_ASSERT_EQUALS(&test_cb, clickmatic->cb);
-	PCUT_ASSERT_EQUALS((void *)&test_resp, clickmatic->arg);
-
-	ui_clickmatic_destroy(clickmatic);
-	ui_destroy(ui);
-}
-
-/** Pressing and releasing clickmatic generates one event */
-PCUT_TEST(press_release)
-{
-	ui_t *ui = NULL;
-	ui_clickmatic_t *clickmatic = NULL;
-	test_resp_t test_resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_clickmatic_create(ui, &clickmatic);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(clickmatic);
-
-	test_resp.clicked_cnt = 0;
-
-	ui_clickmatic_set_cb(clickmatic, &test_cb, (void *)&test_resp);
-	PCUT_ASSERT_EQUALS(&test_cb, clickmatic->cb);
-	PCUT_ASSERT_EQUALS((void *)&test_resp, clickmatic->arg);
-
-	PCUT_ASSERT_INT_EQUALS(0, test_resp.clicked_cnt);
-
-	ui_clickmatic_press(clickmatic);
-	ui_clickmatic_release(clickmatic);
-
-	PCUT_ASSERT_INT_EQUALS(1, test_resp.clicked_cnt);
-
-	ui_clickmatic_destroy(clickmatic);
-	ui_destroy(ui);
-}
-
-static void test_clicked(ui_clickmatic_t *clickmatic, void *arg)
-{
-	test_resp_t *test_resp = (test_resp_t *)arg;
-
-	++test_resp->clicked_cnt;
-}
-
-PCUT_EXPORT(clickmatic);
Index: pace/lib/ui/test/control.c
===================================================================
--- uspace/lib/ui/test/control.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,193 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTvvhhzccgggrERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <mem.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <pcut/pcut.h>
-#include <ui/control.h>
-#include <ui/testctl.h>
-#include <stdbool.h>
-#include <types/ui/event.h>
-#include "../private/testctl.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(control);
-
-/** Allocate and deallocate control */
-PCUT_TEST(new_delete)
-{
-	ui_control_t *control = NULL;
-	errno_t rc;
-
-	rc = ui_control_new(&ui_test_ctl_ops, NULL, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_delete(control);
-}
-
-/** ui_control_delete() can take NULL argument (no-op) */
-PCUT_TEST(delete_null)
-{
-	ui_control_delete(NULL);
-}
-
-/** Test sending destroy request to control */
-PCUT_TEST(destroy)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	resp.rc = EOK;
-	resp.destroy = false;
-
-	ui_control_destroy(ui_test_ctl_ctl(testctl));
-	PCUT_ASSERT_TRUE(resp.destroy);
-}
-
-/** Test sending paint request to control */
-PCUT_TEST(paint)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	resp.rc = EOK;
-	resp.paint = false;
-
-	rc = ui_control_paint(ui_test_ctl_ctl(testctl));
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	resp.rc = EINVAL;
-	resp.paint = false;
-
-	rc = ui_control_paint(ui_test_ctl_ctl(testctl));
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	ui_test_ctl_destroy(testctl);
-}
-
-/** Test sending keyboard event to control */
-PCUT_TEST(kbd_event)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	kbd_event_t event;
-	ui_evclaim_t claim;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	resp.claim = ui_claimed;
-	resp.kbd = false;
-	event.type = KEY_PRESS;
-	event.key = KC_2;
-	event.mods = KM_LSHIFT;
-	event.c = '@';
-
-	claim = ui_control_kbd_event(ui_test_ctl_ctl(testctl), &event);
-	PCUT_ASSERT_EQUALS(resp.claim, claim);
-	PCUT_ASSERT_TRUE(resp.kbd);
-	PCUT_ASSERT_EQUALS(resp.kevent.type, event.type);
-	PCUT_ASSERT_INT_EQUALS(resp.kevent.key, event.key);
-	PCUT_ASSERT_INT_EQUALS(resp.kevent.mods, event.mods);
-	PCUT_ASSERT_INT_EQUALS(resp.kevent.c, event.c);
-
-	ui_test_ctl_destroy(testctl);
-}
-
-/** Test sending position event to control */
-PCUT_TEST(pos_event)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	pos_event_t event;
-	ui_evclaim_t claim;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	resp.claim = ui_claimed;
-	resp.pos = false;
-	event.pos_id = 1;
-	event.type = POS_PRESS;
-	event.btn_num = 2;
-	event.hpos = 3;
-	event.vpos = 4;
-
-	claim = ui_control_pos_event(ui_test_ctl_ctl(testctl), &event);
-	PCUT_ASSERT_EQUALS(resp.claim, claim);
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.pos_id, event.pos_id);
-	PCUT_ASSERT_EQUALS(resp.pevent.type, event.type);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.btn_num, event.btn_num);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.hpos, event.hpos);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.vpos, event.vpos);
-
-	ui_test_ctl_destroy(testctl);
-}
-
-/** Test sending unfocus to control */
-PCUT_TEST(unfocus)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	resp.unfocus = false;
-
-	ui_control_unfocus(ui_test_ctl_ctl(testctl), 42);
-	PCUT_ASSERT_TRUE(resp.unfocus);
-	PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus);
-
-	ui_test_ctl_destroy(testctl);
-}
-
-PCUT_EXPORT(control);
Index: pace/lib/ui/test/entry.c
===================================================================
--- uspace/lib/ui/test/entry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,823 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <clipboard.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/entry.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/entry.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(entry);
-
-/** Create and destroy text entry */
-PCUT_TEST(create_destroy)
-{
-	ui_entry_t *entry = NULL;
-	errno_t rc;
-
-	rc = ui_entry_create(NULL, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	ui_entry_destroy(entry);
-}
-
-/** ui_entry_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_entry_destroy(NULL);
-}
-
-/** ui_entry_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_entry_t *entry;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_entry_create(NULL, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_entry_ctl(entry);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set text entry rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_entry_t *entry;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_entry_create(NULL, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_entry_set_rect(entry, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, entry->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, entry->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, entry->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, entry->rect.p1.y);
-
-	ui_entry_destroy(entry);
-}
-
-/** Set entry text horizontal alignment sets internal field */
-PCUT_TEST(set_halign)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_set_halign(entry, gfx_halign_left);
-	PCUT_ASSERT_EQUALS(gfx_halign_left, entry->halign);
-	ui_entry_set_halign(entry, gfx_halign_center);
-	PCUT_ASSERT_EQUALS(gfx_halign_center, entry->halign);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Set entry read only flag sets internal field */
-PCUT_TEST(set_read_only)
-{
-	ui_entry_t *entry;
-	errno_t rc;
-
-	rc = ui_entry_create(NULL, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_set_read_only(entry, true);
-	PCUT_ASSERT_TRUE(entry->read_only);
-	ui_entry_set_read_only(entry, false);
-	PCUT_ASSERT_FALSE(entry->read_only);
-
-	ui_entry_destroy(entry);
-}
-
-/** Set text entry rectangle sets internal field */
-PCUT_TEST(set_text)
-{
-	ui_entry_t *entry;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_entry_create(NULL, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_entry_set_rect(entry, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, entry->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, entry->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, entry->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, entry->rect.p1.y);
-
-	ui_entry_destroy(entry);
-}
-
-/** Paint text entry */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "Hello", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_entry_paint(entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_delete_sel() deletes selected text */
-PCUT_TEST(delete_sel)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDEF", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCDEF", entry->text);
-
-	ui_entry_activate(entry);
-
-	/* Select all but first and last character */
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	ui_entry_delete_sel(entry);
-
-	PCUT_ASSERT_STR_EQUALS("AF", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_insert_str() inserts string at cursor. */
-PCUT_TEST(insert_str)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "A", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("A", entry->text);
-
-	ui_entry_activate(entry);
-	ui_entry_seek_end(entry, false);
-
-	rc = ui_entry_insert_str(entry, "B");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("AB", entry->text);
-
-	rc = ui_entry_insert_str(entry, "EF");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABEF", entry->text);
-
-	entry->pos = 2;
-	entry->sel_start = 2;
-	rc = ui_entry_insert_str(entry, "CD");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCDEF", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_insert_str() deletes selection before inserting string */
-PCUT_TEST(insert_str_with_sel)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDE", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCDE", entry->text);
-
-	/* Select all but the first and last character */
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	rc = ui_entry_insert_str(entry, "123");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("A123E", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_backspace() deletes character before cursor. */
-PCUT_TEST(backspace)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCD", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);
-	entry->pos = 3;
-	entry->sel_start = 3;
-
-	ui_entry_backspace(entry);
-	PCUT_ASSERT_STR_EQUALS("ABD", entry->text);
-
-	ui_entry_backspace(entry);
-	PCUT_ASSERT_STR_EQUALS("AD", entry->text);
-
-	ui_entry_backspace(entry);
-	PCUT_ASSERT_STR_EQUALS("D", entry->text);
-
-	ui_entry_backspace(entry);
-	PCUT_ASSERT_STR_EQUALS("D", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_backspace() with selected text deletes selection. */
-PCUT_TEST(backspace_with_sel)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDE", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCDE", entry->text);
-
-	/* Select all but the first and last character */
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	ui_entry_backspace(entry);
-
-	PCUT_ASSERT_STR_EQUALS("AE", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_delete() deletes character after cursor. */
-PCUT_TEST(delete)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCD", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);
-	entry->pos = 1;
-	entry->sel_start = 1;
-
-	ui_entry_delete(entry);
-	PCUT_ASSERT_STR_EQUALS("ACD", entry->text);
-
-	ui_entry_delete(entry);
-	PCUT_ASSERT_STR_EQUALS("AD", entry->text);
-
-	ui_entry_delete(entry);
-	PCUT_ASSERT_STR_EQUALS("A", entry->text);
-
-	ui_entry_delete(entry);
-	PCUT_ASSERT_STR_EQUALS("A", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_delete() with selected text deletes selection. */
-PCUT_TEST(delete_with_sel)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDE", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCDE", entry->text);
-
-	/* Select all but the first and last character */
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	ui_entry_delete(entry);
-
-	PCUT_ASSERT_STR_EQUALS("AE", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_copy() copies selected text to clipboard. */
-PCUT_TEST(copy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-	char *str;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDEF", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	// FIXME: This is not safe unless we could create a private
-	// test clipboard
-
-	ui_entry_copy(entry);
-	rc = clipboard_get_str(&str);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("BCDE", str);
-	PCUT_ASSERT_STR_EQUALS("ABCDEF", entry->text);
-	free(str);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_cut() cuts selected text to clipboard. */
-PCUT_TEST(cut)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-	char *str;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDEF", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-	ui_entry_seek_end(entry, true);
-	ui_entry_seek_prev_char(entry, true);
-
-	// FIXME: This is not safe unless we could create a private
-	// test clipboard
-
-	ui_entry_cut(entry);
-	rc = clipboard_get_str(&str);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("BCDE", str);
-	PCUT_ASSERT_STR_EQUALS("AF", entry->text);
-	free(str);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_paste() pastes text from clipboard. */
-PCUT_TEST(paste)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "AB", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_activate(entry);
-	ui_entry_seek_start(entry, false);
-	ui_entry_seek_next_char(entry, false);
-
-	// FIXME: This is not safe unless we could create a private
-	// test clipboard
-
-	rc = clipboard_put_str("123");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_paste(entry);
-	PCUT_ASSERT_STR_EQUALS("A123B", entry->text);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_seek_start() moves cursor to beginning of text */
-PCUT_TEST(seek_start)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCDEF", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_entry_activate(entry);
-
-	entry->pos = 2;
-	entry->sel_start = 2;
-
-	ui_entry_seek_start(entry, true);
-	PCUT_ASSERT_INT_EQUALS(0, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(2, entry->sel_start);
-
-	ui_entry_seek_start(entry, false);
-	PCUT_ASSERT_INT_EQUALS(0, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(0, entry->sel_start);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_seek_end() moves cursor to the end of text */
-PCUT_TEST(seek_end)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCD", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);
-	entry->pos = 2;
-	entry->sel_start = 2;
-
-	ui_entry_seek_end(entry, true);
-	PCUT_ASSERT_INT_EQUALS(4, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(2, entry->sel_start);
-	ui_entry_seek_end(entry, false);
-	PCUT_ASSERT_INT_EQUALS(4, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(4, entry->sel_start);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_seek_prev_char() moves cursor to the previous character */
-PCUT_TEST(seek_prev_char)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCD", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);
-	entry->pos = 3;
-	entry->sel_start = 3;
-
-	ui_entry_seek_prev_char(entry, true);
-	PCUT_ASSERT_INT_EQUALS(2, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(3, entry->sel_start);
-
-	ui_entry_seek_prev_char(entry, false);
-	PCUT_ASSERT_INT_EQUALS(1, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(1, entry->sel_start);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_seek_prev_char() moves cursor to the next character */
-PCUT_TEST(seek_next_char)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABCD", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("ABCD", entry->text);
-	entry->pos = 1;
-	entry->sel_start = 1;
-
-	ui_entry_seek_next_char(entry, true);
-	PCUT_ASSERT_INT_EQUALS(2, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(1, entry->sel_start);
-	ui_entry_seek_next_char(entry, false);
-	PCUT_ASSERT_INT_EQUALS(3, entry->pos);
-	PCUT_ASSERT_INT_EQUALS(3, entry->sel_start);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_entry_activate() / ui_entry_deactivate() */
-PCUT_TEST(activate_deactivate)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_entry_t *entry;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_entry_create(window, "ABC", &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(entry->active);
-
-	ui_entry_activate(entry);
-	PCUT_ASSERT_TRUE(entry->active);
-
-	ui_entry_deactivate(entry);
-	PCUT_ASSERT_FALSE(entry->active);
-
-	ui_entry_destroy(entry);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(entry);
Index: pace/lib/ui/test/filedialog.c
===================================================================
--- uspace/lib/ui/test/filedialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/filedialog.h>
-#include "../private/filedialog.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(file_dialog);
-
-static void test_dialog_bok(ui_file_dialog_t *, void *, const char *);
-static void test_dialog_bcancel(ui_file_dialog_t *, void *);
-static void test_dialog_close(ui_file_dialog_t *, void *);
-
-static ui_file_dialog_cb_t test_file_dialog_cb = {
-	.bok = test_dialog_bok,
-	.bcancel = test_dialog_bcancel,
-	.close = test_dialog_close
-};
-
-static ui_file_dialog_cb_t dummy_file_dialog_cb = {
-};
-
-typedef struct {
-	bool bok;
-	const char *fname;
-	bool bcancel;
-	bool close;
-} test_cb_resp_t;
-
-/** Create and destroy file dialog */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_file_dialog_params_t params;
-	ui_file_dialog_t *dialog = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_file_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	ui_file_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_file_dialog_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_file_dialog_destroy(NULL);
-}
-
-/** Button click invokes callback set via ui_file_dialog_set_cb() */
-PCUT_TEST(button_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_file_dialog_params_t params;
-	ui_file_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_file_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* OK button callback with no callbacks set */
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with callback not implemented */
-	ui_file_dialog_set_cb(dialog, &dummy_file_dialog_cb, NULL);
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with real callback set */
-	resp.bok = false;
-	ui_file_dialog_set_cb(dialog, &test_file_dialog_cb, &resp);
-	ui_pbutton_clicked(dialog->bok);
-	PCUT_ASSERT_TRUE(resp.bok);
-
-	ui_file_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Sending window close request invokes callback set via
- * ui_file_dialog_set_cb()
- */
-PCUT_TEST(close_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_file_dialog_params_t params;
-	ui_file_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_file_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Button callback with no callbacks set */
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with unfocus callback not implemented */
-	ui_file_dialog_set_cb(dialog, &dummy_file_dialog_cb, NULL);
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with real callback set */
-	resp.close = false;
-	ui_file_dialog_set_cb(dialog, &test_file_dialog_cb, &resp);
-	ui_window_send_close(dialog->window);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_file_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-static void test_dialog_bok(ui_file_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bok = true;
-}
-
-static void test_dialog_bcancel(ui_file_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bcancel = true;
-}
-
-static void test_dialog_close(ui_file_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-PCUT_EXPORT(file_dialog);
Index: pace/lib/ui/test/filelist.c
===================================================================
--- uspace/lib/ui/test/filelist.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1223 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <ui/ui.h>
-#include <ui/filelist.h>
-#include <ui/scrollbar.h>
-#include <vfs/vfs.h>
-#include "../private/filelist.h"
-#include "../private/list.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(file_list);
-
-/** Test response */
-typedef struct {
-	bool activate_req;
-	ui_file_list_t *activate_req_file_list;
-
-	bool selected;
-	ui_file_list_t *selected_file_list;
-	const char *selected_fname;
-} test_resp_t;
-
-static void test_file_list_activate_req(ui_file_list_t *, void *);
-static void test_file_list_selected(ui_file_list_t *, void *, const char *);
-
-static ui_file_list_cb_t test_cb = {
-	.activate_req = test_file_list_activate_req,
-	.selected = test_file_list_selected
-};
-
-/** Create and destroy file list. */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_set_cb() sets callback */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_set_cb(flist, &test_cb, &resp);
-	PCUT_ASSERT_EQUALS(&test_cb, flist->cb);
-	PCUT_ASSERT_EQUALS(&resp, flist->cb_arg);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_file_list_paint() */
-PCUT_TEST(paint)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_paint(flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_ctl() returns a valid UI control */
-PCUT_TEST(ctl)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_file_list_ctl(flist);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_set_rect() sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_file_list_set_rect(flist, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, flist->list->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, flist->list->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, flist->list->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, flist->list->rect.p1.y);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_is_active() returns file list activity state */
-PCUT_TEST(is_active)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(ui_file_list_is_active(flist));
-	ui_file_list_destroy(flist);
-
-	rc = ui_file_list_create(window, false, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(ui_file_list_is_active(flist));
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_activate() activates file list */
-PCUT_TEST(activate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, false, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(ui_file_list_is_active(flist));
-	rc = ui_file_list_activate(flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(ui_file_list_is_active(flist));
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_deactivate() deactivates file list */
-PCUT_TEST(deactivate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(ui_file_list_is_active(flist));
-	ui_file_list_deactivate(flist);
-	PCUT_ASSERT_FALSE(ui_file_list_is_active(flist));
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_entry_append() appends new entry */
-PCUT_TEST(entry_append)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, ui_list_entries_cnt(flist->list));
-
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(flist->list));
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_entry_destroy() destroys entry */
-PCUT_TEST(entry_destroy)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(flist->list));
-
-	entry = ui_file_list_first(flist);
-	ui_file_list_entry_destroy(entry);
-
-	PCUT_ASSERT_INT_EQUALS(1, ui_list_entries_cnt(flist->list));
-
-	entry = ui_file_list_first(flist);
-	ui_file_list_entry_destroy(entry);
-
-	PCUT_ASSERT_INT_EQUALS(0, ui_list_entries_cnt(flist->list));
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_clear_entries() removes all entries from file list */
-PCUT_TEST(clear_entries)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "a";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(flist->list));
-
-	ui_file_list_clear_entries(flist);
-	PCUT_ASSERT_INT_EQUALS(0, ui_list_entries_cnt(flist->list));
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_read_dir() reads the contents of a directory */
-PCUT_TEST(read_dir)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	char buf[L_tmpnam];
-	char *fname;
-	char *p;
-	errno_t rc;
-	FILE *f;
-	int rv;
-
-	/* Create name for temporary directory */
-	p = tmpnam(buf);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Create temporary directory */
-	rc = vfs_link_path(p, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = asprintf(&fname, "%s/%s", p, "a");
-	PCUT_ASSERT_TRUE(rv >= 0);
-
-	f = fopen(fname, "wb");
-	PCUT_ASSERT_NOT_NULL(f);
-
-	rv = fprintf(f, "X");
-	PCUT_ASSERT_TRUE(rv >= 0);
-
-	rv = fclose(f);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_read_dir(flist, p);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(flist->list));
-
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("..", entry->name);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	ui_file_list_destroy(flist);
-
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rv = remove(p);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	free(fname);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** When moving to parent directory from a subdir, we seek to the
- * coresponding entry
- */
-PCUT_TEST(read_dir_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	char buf[L_tmpnam];
-	char *subdir_a;
-	char *subdir_b;
-	char *subdir_c;
-	char *p;
-	errno_t rc;
-	int rv;
-
-	/* Create name for temporary directory */
-	p = tmpnam(buf);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Create temporary directory */
-	rc = vfs_link_path(p, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create some subdirectories */
-
-	rv = asprintf(&subdir_a, "%s/%s", p, "a");
-	PCUT_ASSERT_TRUE(rv >= 0);
-	rc = vfs_link_path(subdir_a, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = asprintf(&subdir_b, "%s/%s", p, "b");
-	PCUT_ASSERT_TRUE(rv >= 0);
-	rc = vfs_link_path(subdir_b, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = asprintf(&subdir_c, "%s/%s", p, "c");
-	PCUT_ASSERT_TRUE(rv >= 0);
-	rc = vfs_link_path(subdir_c, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Start in subdirectory "b" */
-	rc = ui_file_list_read_dir(flist, subdir_b);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now go up (into p) */
-
-	rc = ui_file_list_read_dir(flist, "..");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_NOT_NULL(ui_file_list_get_cursor(flist));
-	PCUT_ASSERT_STR_EQUALS("b", ui_file_list_get_cursor(flist)->name);
-
-	ui_file_list_destroy(flist);
-
-	rv = remove(subdir_a);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rv = remove(subdir_b);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rv = remove(subdir_c);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rv = remove(p);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	free(subdir_a);
-	free(subdir_b);
-	free(subdir_c);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_sort() sorts file list entries */
-PCUT_TEST(sort)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	attr.name = "b";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "c";
-	attr.size = 3;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "a";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_sort(flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(2, entry->size);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_STR_EQUALS("b", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_STR_EQUALS("c", entry->name);
-	PCUT_ASSERT_INT_EQUALS(3, entry->size);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_list_compare compares two file list entries */
-PCUT_TEST(list_compare)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *a, *b;
-	ui_file_list_entry_attr_t attr;
-	int rel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	attr.name = "a";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.name = "b";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	a = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(a);
-	b = ui_file_list_next(a);
-	PCUT_ASSERT_NOT_NULL(b);
-
-	/* a < b */
-	rel = ui_file_list_list_compare(a->entry, b->entry);
-	PCUT_ASSERT_TRUE(rel < 0);
-
-	/* b > a */
-	rel = ui_file_list_list_compare(b->entry, a->entry);
-	PCUT_ASSERT_TRUE(rel > 0);
-
-	/* a == a */
-	rel = ui_file_list_list_compare(a->entry, a->entry);
-	PCUT_ASSERT_INT_EQUALS(0, rel);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_entry_attr_init() initializes file list attribute structure */
-PCUT_TEST(entry_attr_init)
-{
-	ui_file_list_entry_attr_t attr;
-
-	ui_file_list_entry_attr_init(&attr);
-	PCUT_ASSERT_NULL(attr.name);
-	PCUT_ASSERT_INT_EQUALS(0, attr.size);
-	PCUT_ASSERT_EQUALS(false, attr.isdir);
-	PCUT_ASSERT_INT_EQUALS(0, attr.svc);
-}
-
-/** ui_file_list_first() returns valid entry or @c NULL as appropriate */
-PCUT_TEST(first)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add one entry */
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting it */
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	/* Add another entry */
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* We should still get the first entry */
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_last() returns valid entry or @c NULL as appropriate */
-PCUT_TEST(last)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	entry = ui_file_list_last(flist);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add one entry */
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting it */
-	entry = ui_file_list_last(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	/* Add another entry */
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* We should get new entry now */
-	entry = ui_file_list_last(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	attr.name = "b";
-	attr.size = 2;
-	PCUT_ASSERT_STR_EQUALS("b", entry->name);
-	PCUT_ASSERT_INT_EQUALS(2, entry->size);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_next() returns the next entry or @c NULL as appropriate */
-PCUT_TEST(next)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	/* Add one entry */
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting its successor */
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add another entry */
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try getting the successor of first entry again */
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("b", entry->name);
-	PCUT_ASSERT_INT_EQUALS(2, entry->size);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_prev() returns the previous entry or @c NULL as appropriate */
-PCUT_TEST(prev)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	/* Add one entry */
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting its predecessor */
-	entry = ui_file_list_last(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_file_list_prev(entry);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add another entry */
-	attr.name = "b";
-	attr.size = 2;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try getting the predecessor of the new entry */
-	entry = ui_file_list_last(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_file_list_prev(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_INT_EQUALS(1, entry->size);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_open_dir() opens a directory entry */
-PCUT_TEST(open_dir)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_t *entry;
-	char buf[L_tmpnam];
-	char *sdname;
-	char *p;
-	errno_t rc;
-	int rv;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create name for temporary directory */
-	p = tmpnam(buf);
-	PCUT_ASSERT_NOT_NULL(p);
-
-	/* Create temporary directory */
-	rc = vfs_link_path(p, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rv = asprintf(&sdname, "%s/%s", p, "a");
-	PCUT_ASSERT_TRUE(rv >= 0);
-
-	/* Create sub-directory */
-	rc = vfs_link_path(sdname, KIND_DIRECTORY, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_read_dir(flist, p);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS(p, flist->dir);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(flist->list));
-
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("..", entry->name);
-
-	entry = ui_file_list_next(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->name);
-	PCUT_ASSERT_TRUE(entry->isdir);
-
-	rc = ui_file_list_open_dir(flist, entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS(sdname, flist->dir);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-
-	rv = remove(sdname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	rv = remove(p);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-
-	free(sdname);
-}
-
-/** ui_file_list_open_file() runs selected callback */
-PCUT_TEST(open_file)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_attr_t attr;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_set_cb(flist, &test_cb, &resp);
-
-	attr.name = "hello.txt";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.selected = false;
-	resp.selected_file_list = NULL;
-	resp.selected_fname = NULL;
-
-	ui_file_list_open_file(flist, ui_file_list_first(flist));
-	PCUT_ASSERT_TRUE(resp.selected);
-	PCUT_ASSERT_EQUALS(flist, resp.selected_file_list);
-	PCUT_ASSERT_STR_EQUALS("hello.txt", resp.selected_fname);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_activate_req() sends activation request */
-PCUT_TEST(activate_req)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_set_cb(flist, &test_cb, &resp);
-
-	resp.activate_req = false;
-	resp.activate_req_file_list = NULL;
-
-	ui_file_list_activate_req(flist);
-	PCUT_ASSERT_TRUE(resp.activate_req);
-	PCUT_ASSERT_EQUALS(flist, resp.activate_req_file_list);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_selected() runs selected callback */
-PCUT_TEST(selected)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_set_cb(flist, &test_cb, &resp);
-
-	resp.selected = false;
-	resp.selected_file_list = NULL;
-	resp.selected_fname = NULL;
-
-	ui_file_list_selected(flist, "hello.txt");
-	PCUT_ASSERT_TRUE(resp.selected);
-	PCUT_ASSERT_EQUALS(flist, resp.selected_file_list);
-	PCUT_ASSERT_STR_EQUALS("hello.txt", resp.selected_fname);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_file_list_get_cursor() returns the current cursor position */
-PCUT_TEST(get_cursor)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_file_list_t *flist;
-	ui_file_list_entry_attr_t attr;
-	ui_file_list_entry_t *entry;
-	ui_file_list_entry_t *cursor;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_file_list_create(window, true, &flist);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_file_list_entry_attr_init(&attr);
-
-	/* Append entry */
-	attr.name = "a";
-	attr.size = 1;
-	rc = ui_file_list_entry_append(flist, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = ui_file_list_first(flist);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	/* Cursor should be at the only entry */
-	cursor = ui_file_list_get_cursor(flist);
-	PCUT_ASSERT_EQUALS(entry, cursor);
-
-	ui_file_list_destroy(flist);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_file_list_activate_req(ui_file_list_t *flist, void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->activate_req = true;
-	resp->activate_req_file_list = flist;
-}
-
-static void test_file_list_selected(ui_file_list_t *flist, void *arg,
-    const char *fname)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->selected = true;
-	resp->selected_file_list = flist;
-	resp->selected_fname = fname;
-}
-
-PCUT_EXPORT(file_list);
Index: pace/lib/ui/test/fixed.c
===================================================================
--- uspace/lib/ui/test/fixed.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,297 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <stddef.h>
-#include <ui/control.h>
-#include <ui/fixed.h>
-#include "../private/fixed.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(fixed);
-
-static void test_ctl_destroy(void *);
-static errno_t test_ctl_paint(void *);
-static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
-static void test_ctl_unfocus(void *, unsigned);
-
-static ui_control_ops_t test_ctl_ops = {
-	.destroy = test_ctl_destroy,
-	.paint = test_ctl_paint,
-	.pos_event = test_ctl_pos_event,
-	.unfocus = test_ctl_unfocus
-};
-
-/** Test response */
-typedef struct {
-	/** Claim to return */
-	ui_evclaim_t claim;
-	/** Result code to return */
-	errno_t rc;
-	/** @c true iff destroy was called */
-	bool destroy;
-	/** @c true iff paint was called */
-	bool paint;
-	/** @c true iff pos_event was called */
-	bool pos;
-	/** Position event that was sent */
-	pos_event_t pevent;
-	/** @c true iff unfocus was called */
-	bool unfocus;
-	/** Number of remaining foci */
-	unsigned unfocus_nfocus;
-} test_resp_t;
-
-/** Create and destroy button */
-PCUT_TEST(create_destroy)
-{
-	ui_fixed_t *fixed = NULL;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(fixed);
-
-	ui_fixed_destroy(fixed);
-}
-
-/** ui_fixed_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_fixed_destroy(NULL);
-}
-
-/** ui_fixed_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_fixed_t *fixed;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_fixed_ctl(fixed);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** ui_fixed_add() / ui_fixed_remove() adds/removes control */
-PCUT_TEST(add_remove)
-{
-	ui_fixed_t *fixed = NULL;
-	ui_control_t *control;
-	ui_fixed_elem_t *e;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = ui_fixed_first(fixed);
-	PCUT_ASSERT_NULL(e);
-
-	rc = ui_control_new(NULL, NULL, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_fixed_add(fixed, control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = ui_fixed_first(fixed);
-	PCUT_ASSERT_NOT_NULL(e);
-	PCUT_ASSERT_EQUALS(control, e->control);
-	e = ui_fixed_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	ui_fixed_remove(fixed, control);
-
-	e = ui_fixed_first(fixed);
-	PCUT_ASSERT_NULL(e);
-
-	ui_fixed_destroy(fixed);
-	ui_control_delete(control);
-}
-
-/** ui_fixed_destroy() delivers destroy request to control */
-PCUT_TEST(destroy)
-{
-	ui_fixed_t *fixed = NULL;
-	ui_control_t *control;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, (void *) &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_fixed_add(fixed, control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.destroy = false;
-
-	ui_fixed_destroy(fixed);
-	PCUT_ASSERT_TRUE(resp.destroy);
-}
-
-/** ui_fixed_paint() delivers paint request to control */
-PCUT_TEST(paint)
-{
-	ui_fixed_t *fixed = NULL;
-	ui_control_t *control;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, (void *) &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_fixed_add(fixed, control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.paint = false;
-	resp.rc = EOK;
-
-	rc = ui_fixed_paint(fixed);
-	PCUT_ASSERT_EQUALS(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	resp.paint = false;
-	resp.rc = EINVAL;
-
-	rc = ui_fixed_paint(fixed);
-	PCUT_ASSERT_EQUALS(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	ui_fixed_destroy(fixed);
-}
-
-/** ui_fixed_pos_event() delivers position event to control */
-PCUT_TEST(pos_event)
-{
-	ui_fixed_t *fixed = NULL;
-	ui_control_t *control;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, (void *) &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_fixed_add(fixed, control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.claim = ui_claimed;
-	resp.pos = false;
-	event.pos_id = 1;
-	event.type = POS_PRESS;
-	event.btn_num = 2;
-	event.hpos = 3;
-	event.vpos = 4;
-
-	claim = ui_fixed_pos_event(fixed, &event);
-	PCUT_ASSERT_EQUALS(resp.claim, claim);
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.pos_id, event.pos_id);
-	PCUT_ASSERT_EQUALS(resp.pevent.type, event.type);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.btn_num, event.btn_num);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.hpos, event.hpos);
-	PCUT_ASSERT_INT_EQUALS(resp.pevent.vpos, event.vpos);
-
-	ui_fixed_destroy(fixed);
-}
-
-/** ui_fixed_unfocus() delivers unfocus notification to control */
-PCUT_TEST(unfocus)
-{
-	ui_fixed_t *fixed = NULL;
-	ui_control_t *control;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_fixed_create(&fixed);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, (void *) &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_fixed_add(fixed, control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.unfocus = false;
-
-	ui_fixed_unfocus(fixed, 42);
-	PCUT_ASSERT_TRUE(resp.unfocus);
-	PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus);
-
-	ui_fixed_destroy(fixed);
-}
-
-static void test_ctl_destroy(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->destroy = true;
-}
-
-static errno_t test_ctl_paint(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->pos = true;
-	resp->pevent = *event;
-
-	return resp->claim;
-}
-
-static void test_ctl_unfocus(void *arg, unsigned nfocus)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->unfocus = true;
-	resp->unfocus_nfocus = nfocus;
-}
-
-PCUT_EXPORT(fixed);
Index: pace/lib/ui/test/image.c
===================================================================
--- uspace/lib/ui/test/image.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,238 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/image.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include "../private/dummygc.h"
-#include "../private/image.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(image);
-
-/** Create and destroy image */
-PCUT_TEST(create_destroy)
-{
-	ui_image_t *image = NULL;
-	gfx_rect_t brect;
-	errno_t rc;
-
-	rc = ui_image_create(NULL, NULL, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	ui_image_destroy(image);
-}
-
-/** ui_image_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_image_destroy(NULL);
-}
-
-/** ui_image_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_image_t *image = NULL;
-	ui_control_t *control;
-	gfx_rect_t brect;
-	errno_t rc;
-
-	rc = ui_image_create(NULL, NULL, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	control = ui_image_ctl(image);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set image rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	errno_t rc;
-	dummy_gc_t *dgc;
-	gfx_context_t *gc;
-	ui_resource_t *resource = NULL;
-	ui_image_t *image = NULL;
-	gfx_rect_t brect;
-	gfx_rect_t rect;
-
-	rc = dummygc_create(&dgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = dummygc_get_ctx(dgc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_image_create(resource, NULL, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_image_set_rect(image, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, image->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, image->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, image->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, image->rect.p1.y);
-
-	ui_image_destroy(image);
-	ui_resource_destroy(resource);
-	dummygc_destroy(dgc);
-}
-
-/** Set image flags sets internal field */
-PCUT_TEST(set_flags)
-{
-	ui_image_t *image = NULL;
-	gfx_rect_t brect;
-	errno_t rc;
-
-	rc = ui_image_create(NULL, NULL, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	PCUT_ASSERT_INT_EQUALS(0, image->flags);
-
-	ui_image_set_flags(image, ui_imgf_frame);
-	PCUT_ASSERT_INT_EQUALS(ui_imgf_frame, image->flags);
-
-	ui_image_destroy(image);
-}
-
-/** Set image bitmap */
-PCUT_TEST(set_bmp)
-{
-	ui_image_t *image = NULL;
-	gfx_rect_t brect;
-	gfx_rect_t rect;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_params_t params;
-	dummy_gc_t *dgc;
-	gfx_context_t *gc;
-	ui_resource_t *resource = NULL;
-	errno_t rc;
-
-	rc = dummygc_create(&dgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = dummygc_get_ctx(dgc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_image_create(resource, NULL, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_image_set_rect(image, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, image->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, image->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, image->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, image->rect.p1.y);
-
-	gfx_bitmap_params_init(&params);
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_image_set_bmp(image, bitmap, &brect);
-	PCUT_ASSERT_EQUALS(bitmap, image->bitmap);
-
-	rc = ui_image_paint(image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_image_destroy(image);
-	ui_resource_destroy(resource);
-	dummygc_destroy(dgc);
-}
-
-/** Paint image */
-PCUT_TEST(paint)
-{
-	dummy_gc_t *dgc;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	ui_resource_t *resource = NULL;
-	ui_image_t *image = NULL;
-	gfx_rect_t brect;
-	errno_t rc;
-
-	rc = dummygc_create(&dgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = dummygc_get_ctx(dgc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	gfx_bitmap_params_init(&params);
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_image_create(resource, bitmap, &brect, &image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(image);
-
-	rc = ui_image_paint(image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Check that we can paint image after setting bitmap to NULL */
-
-	ui_image_set_bmp(image, NULL, &brect);
-
-	rc = ui_image_paint(image);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_image_destroy(image);
-	ui_resource_destroy(resource);
-	dummygc_destroy(dgc);
-}
-
-PCUT_EXPORT(image);
Index: pace/lib/ui/test/label.c
===================================================================
--- uspace/lib/ui/test/label.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/label.h>
-#include <ui/resource.h>
-#include "../private/label.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(label);
-
-typedef struct {
-	bool clicked;
-} test_cb_resp_t;
-
-/** Create and destroy label */
-PCUT_TEST(create_destroy)
-{
-	ui_label_t *label = NULL;
-	errno_t rc;
-
-	rc = ui_label_create(NULL, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(label);
-
-	ui_label_destroy(label);
-}
-
-/** ui_label_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_label_destroy(NULL);
-}
-
-/** ui_label_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_label_t *label;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_label_create(NULL, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_label_ctl(label);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set label rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_label_t *label;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_label_create(NULL, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_label_set_rect(label, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, label->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, label->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, label->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, label->rect.p1.y);
-
-	ui_label_destroy(label);
-}
-
-/** Set label text horizontal alignment sets internal field */
-PCUT_TEST(set_halign)
-{
-	ui_label_t *label;
-	errno_t rc;
-
-	rc = ui_label_create(NULL, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_label_set_halign(label, gfx_halign_left);
-	PCUT_ASSERT_EQUALS(gfx_halign_left, label->halign);
-	ui_label_set_halign(label, gfx_halign_center);
-	PCUT_ASSERT_EQUALS(gfx_halign_center, label->halign);
-
-	ui_label_destroy(label);
-}
-
-/** Set label rectangle sets internal field */
-PCUT_TEST(set_text)
-{
-	ui_label_t *label;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_label_create(NULL, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_label_set_rect(label, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, label->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, label->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, label->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, label->rect.p1.y);
-
-	ui_label_destroy(label);
-}
-
-/** Paint label */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_label_t *label;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_label_create(resource, "Hello", &label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_label_paint(label);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_label_destroy(label);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(label);
Index: pace/lib/ui/test/list.c
===================================================================
--- uspace/lib/ui/test/list.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3087 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <str.h>
-#include <ui/ui.h>
-#include <ui/list.h>
-#include <ui/scrollbar.h>
-#include <vfs/vfs.h>
-#include "../private/list.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(list);
-
-/** Test response */
-typedef struct {
-	bool activate_req;
-	ui_list_t *activate_req_list;
-
-	bool selected;
-	ui_list_entry_t *selected_entry;
-} test_resp_t;
-
-static void test_list_activate_req(ui_list_t *, void *);
-static void test_list_selected(ui_list_entry_t *, void *);
-static int test_list_compare(ui_list_entry_t *, ui_list_entry_t *);
-
-static ui_list_cb_t test_cb = {
-	.activate_req = test_list_activate_req,
-	.selected = test_list_selected,
-	.compare = test_list_compare
-};
-
-/** Create and destroy file list. */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_set_cb() sets callback */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-	PCUT_ASSERT_EQUALS(&test_cb, list->cb);
-	PCUT_ASSERT_EQUALS(&resp, list->cb_arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_get_cb_arg() returns the callback argument */
-PCUT_TEST(get_cb_arg)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-	test_resp_t resp;
-	void *arg;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-	arg = ui_list_get_cb_arg(list);
-	PCUT_ASSERT_EQUALS((void *)&resp, arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_height() gives the correct height */
-PCUT_TEST(entry_height)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-	gfx_coord_t height;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Font height is 13, padding: 2 (top) + 2 (bottom) */
-	height = ui_list_entry_height(list);
-	PCUT_ASSERT_INT_EQUALS(17, height);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_list_entry_paint() */
-PCUT_TEST(entry_paint)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "a";
-	attr.arg = (void *)1;
-
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_entry_paint(ui_list_first(list), 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_list_paint() */
-PCUT_TEST(paint)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_paint(list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_ctl() returns a valid UI control */
-PCUT_TEST(ctl)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_list_ctl(list);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_list_kbd_event() */
-PCUT_TEST(kbd_event)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_evclaim_t claimed;
-	kbd_event_t event;
-	errno_t rc;
-
-	/* Active list should claim events */
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ESCAPE;
-	event.mods = 0;
-	event.c = '\0';
-
-	claimed = ui_list_kbd_event(list, &event);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	ui_list_destroy(list);
-
-	/* Inactive list should not claim events */
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, false, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ESCAPE;
-	event.mods = 0;
-	event.c = '\0';
-
-	claimed = ui_list_kbd_event(list, &event);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claimed);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_list_pos_event() */
-PCUT_TEST(pos_event)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_evclaim_t claimed;
-	pos_event_t event;
-	gfx_rect_t rect;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 50;
-	rect.p1.y = 220;
-
-	ui_list_set_rect(list, &rect);
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = ui_list_first(list);
-	list->page_idx = 0;
-
-	event.pos_id = 0;
-	event.type = POS_PRESS;
-	event.btn_num = 1;
-
-	/* Clicking on the middle entry should select it */
-	event.hpos = 20;
-	event.vpos = 40;
-
-	claimed = ui_list_pos_event(list, &event);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	PCUT_ASSERT_NOT_NULL(list->cursor);
-	PCUT_ASSERT_STR_EQUALS("b", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->cursor->arg);
-
-	/* Clicking on the top edge should do a page-up */
-	event.hpos = 20;
-	event.vpos = 20;
-	claimed = ui_list_pos_event(list, &event);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	PCUT_ASSERT_NOT_NULL(list->cursor);
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_set_rect() sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_list_set_rect(list, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, list->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, list->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, list->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, list->rect.p1.y);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_page_size() returns correct size */
-PCUT_TEST(page_size)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 50;
-	rect.p1.y = 220;
-
-	ui_list_set_rect(list, &rect);
-
-	/* NOTE If page size changes, we have problems elsewhere in the tests */
-	PCUT_ASSERT_INT_EQUALS(11, ui_list_page_size(list));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_inside_rect() gives correct interior rectangle */
-PCUT_TEST(inside_rect)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	gfx_rect_t rect;
-	gfx_rect_t irect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 50;
-	rect.p1.y = 220;
-
-	ui_list_set_rect(list, &rect);
-
-	ui_list_inside_rect(list, &irect);
-	PCUT_ASSERT_INT_EQUALS(10 + 2, irect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20 + 2, irect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(50 - 2 - 23, irect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(220 - 2, irect.p1.y);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scrollbar_rect() gives correct scrollbar rectangle */
-PCUT_TEST(scrollbar_rect)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	gfx_rect_t rect;
-	gfx_rect_t srect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 50;
-	rect.p1.y = 220;
-
-	ui_list_set_rect(list, &rect);
-
-	ui_list_scrollbar_rect(list, &srect);
-	PCUT_ASSERT_INT_EQUALS(50 - 2 - 23, srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20 + 2, srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(50 - 2, srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(220 - 2, srect.p1.y);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scrollbar_update() updates scrollbar position */
-PCUT_TEST(scrollbar_update)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	gfx_rect_t rect;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	gfx_coord_t pos;
-	gfx_coord_t move_len;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 50;
-	rect.p1.y = 38;
-
-	ui_list_set_rect(list, &rect);
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = ui_list_next(ui_list_first(list));
-
-	list->cursor = entry;
-	list->cursor_idx = 1;
-	list->page = entry;
-	list->page_idx = 1;
-
-	ui_list_scrollbar_update(list);
-
-	/* Now scrollbar thumb should be all the way down */
-	move_len = ui_scrollbar_move_length(list->scrollbar);
-	pos = ui_scrollbar_get_pos(list->scrollbar);
-	PCUT_ASSERT_INT_EQUALS(move_len, pos);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_is_active() returns list activity state */
-PCUT_TEST(is_active)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(ui_list_is_active(list));
-	ui_list_destroy(list);
-
-	rc = ui_list_create(window, false, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(ui_list_is_active(list));
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_activate() activates list */
-PCUT_TEST(activate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, false, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(ui_list_is_active(list));
-	rc = ui_list_activate(list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(ui_list_is_active(list));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_deactivate() deactivates list */
-PCUT_TEST(deactivate)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(ui_list_is_active(list));
-	ui_list_deactivate(list);
-	PCUT_ASSERT_FALSE(ui_list_is_active(list));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_get_cursor() returns the current cursor position */
-PCUT_TEST(get_cursor)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	ui_list_entry_t *cursor;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	entry = NULL;
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	/* Cursor should be at the only entry */
-	cursor = ui_list_get_cursor(list);
-	PCUT_ASSERT_EQUALS(entry, cursor);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_set_cursor() sets list cursor position */
-PCUT_TEST(set_cursor)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *e1;
-	ui_list_entry_t *e2;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e1);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(e2);
-
-	/* Append entry */
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor should be at the first entry */
-	PCUT_ASSERT_EQUALS(e1, list->cursor);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-
-	/* Set cursor to the second entry */
-	ui_list_set_cursor(list, e2);
-	PCUT_ASSERT_EQUALS(e2, list->cursor);
-	PCUT_ASSERT_INT_EQUALS(1, list->cursor_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_attr_init() initializes entry attribute structure */
-PCUT_TEST(entry_attr_init)
-{
-	ui_list_entry_attr_t attr;
-
-	ui_list_entry_attr_init(&attr);
-	PCUT_ASSERT_NULL(attr.caption);
-	PCUT_ASSERT_NULL(attr.arg);
-	PCUT_ASSERT_NULL(attr.color);
-	PCUT_ASSERT_NULL(attr.bgcolor);
-}
-
-/** ui_list_entry_append() appends new entry */
-PCUT_TEST(entry_append)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry without retrieving pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, list_count(&list->entries));
-
-	/* Append entry and get pointer to it */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	entry = NULL;
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_EQUALS(attr.arg, entry->arg);
-
-	PCUT_ASSERT_INT_EQUALS(2, list_count(&list->entries));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_move_up() moves entry up */
-PCUT_TEST(entry_move_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *e1, *e2, *e3;
-	ui_list_entry_t *e;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Create entries */
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, &e3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	/* Moving first entry up should have no effect */
-	ui_list_entry_move_up(e1);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e2, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e3, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	/* Move second entry up */
-	ui_list_entry_move_up(e2);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e2, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e3, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_move_down() moves entry down */
-PCUT_TEST(entry_move_down)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *e1, *e2, *e3;
-	ui_list_entry_t *e;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Create entries */
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, &e1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, &e2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, &e3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	/* Moving last entry down should have no effect */
-	ui_list_entry_move_down(e3);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e2, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e3, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	/* Move second-to-last entry down */
-	ui_list_entry_move_down(e2);
-
-	e = ui_list_first(list);
-	PCUT_ASSERT_EQUALS(e1, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e3, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_EQUALS(e2, e);
-
-	e = ui_list_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_delete() deletes entry */
-PCUT_TEST(entry_delete)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, list_count(&list->entries));
-
-	entry = ui_list_first(list);
-	ui_list_entry_delete(entry);
-
-	PCUT_ASSERT_INT_EQUALS(1, list_count(&list->entries));
-
-	entry = ui_list_first(list);
-	ui_list_entry_delete(entry);
-
-	PCUT_ASSERT_INT_EQUALS(0, list_count(&list->entries));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_get_arg() gets entry argument */
-PCUT_TEST(entry_get_arg)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	void *arg;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	entry = NULL;
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	arg = ui_list_entry_get_arg(entry);
-	PCUT_ASSERT_EQUALS(attr.arg, arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_get_list() returns the containing list */
-PCUT_TEST(entry_get_list)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_t *elist;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	entry = NULL;
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	/* Get the containing list */
-	elist = ui_list_entry_get_list(entry);
-	PCUT_ASSERT_EQUALS(list, elist);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_set_caption() sets entry captino */
-PCUT_TEST(entry_set_caption)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry and get pointer to it */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	entry = NULL;
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	/* Change caption */
-	rc = ui_list_entry_set_caption(entry, "b");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_STR_EQUALS("b", entry->caption);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entries_cnt() returns the number of entries */
-PCUT_TEST(entries_cnt)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(0, ui_list_entries_cnt(list));
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Append entry */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, ui_list_entries_cnt(list));
-
-	/* Append another entry */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_entries_cnt(list));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_sort() sorts UI list entries */
-PCUT_TEST(sort)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "b";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "a";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_sort(list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = ui_list_first(list);
-	PCUT_ASSERT_STR_EQUALS("a", entry->caption);
-	PCUT_ASSERT_EQUALS((void *)2, entry->arg);
-
-	entry = ui_list_next(entry);
-	PCUT_ASSERT_STR_EQUALS("b", entry->caption);
-	PCUT_ASSERT_EQUALS((void *)1, entry->arg);
-
-	entry = ui_list_next(entry);
-	PCUT_ASSERT_STR_EQUALS("c", entry->caption);
-	PCUT_ASSERT_EQUALS((void *)3, entry->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_center()...XXX */
-PCUT_TEST(cursor_center)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *a, *b, *c, *d, *e;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 50;
-	rect.p1.y = 80;
-
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(3, ui_list_page_size(list));
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, &a);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, &b);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* We only have two entries, but three fit onto the page */
-	ui_list_cursor_center(list, b);
-	PCUT_ASSERT_EQUALS(b, list->cursor);
-	/* Page should start at the beginning */
-	PCUT_ASSERT_EQUALS(a, list->page);
-	PCUT_ASSERT_EQUALS(0, list->page_idx);
-
-	/* Add more entries */
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, &c);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, &d);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, &e);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_cursor_center(list, c);
-	PCUT_ASSERT_EQUALS(c, list->cursor);
-	/*
-	 * We have enough entries, c should be in the middle of the three
-	 * entries on the page, i.e., page should start on 'b'.
-	 */
-	PCUT_ASSERT_EQUALS(b, list->page);
-	PCUT_ASSERT_EQUALS(1, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_clear_entries() removes all entries from list */
-PCUT_TEST(clear_entries)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "a";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, list_count(&list->entries));
-
-	ui_list_clear_entries(list);
-	PCUT_ASSERT_INT_EQUALS(0, list_count(&list->entries));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_first() returns valid entry or @c NULL as appropriate */
-PCUT_TEST(first)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	entry = ui_list_first(list);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add one entry */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting it */
-	entry = ui_list_first(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)entry->arg);
-
-	/* Add another entry */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* We should still get the first entry */
-	entry = ui_list_first(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)entry->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_last() returns valid entry or @c NULL as appropriate */
-PCUT_TEST(last)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	entry = ui_list_last(list);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add one entry */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting it */
-	entry = ui_list_last(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)entry->arg);
-
-	/* Add another entry */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* We should get new entry now */
-	entry = ui_list_last(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	PCUT_ASSERT_STR_EQUALS("b", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)entry->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_next() returns the next entry or @c NULL as appropriate */
-PCUT_TEST(next)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Add one entry */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting its successor */
-	entry = ui_list_first(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_list_next(entry);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add another entry */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try getting the successor of first entry again */
-	entry = ui_list_first(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_list_next(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("b", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)entry->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_prev() returns the previous entry or @c NULL as appropriate */
-PCUT_TEST(prev)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Add one entry */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Now try getting its predecessor */
-	entry = ui_list_last(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_list_prev(entry);
-	PCUT_ASSERT_NULL(entry);
-
-	/* Add another entry */
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Try getting the predecessor of the new entry */
-	entry = ui_list_last(list);
-	PCUT_ASSERT_NOT_NULL(entry);
-
-	entry = ui_list_prev(entry);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("a", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)entry->arg);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_page_nth_entry() .. */
-PCUT_TEST(page_nth_entry)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *entry;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	size_t idx;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_entry_attr_init(&attr);
-
-	/* Add some entries */
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	list->page = ui_list_next(ui_list_first(list));
-	list->page_idx = 1;
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 100;
-	rect.p1.y = 100;
-	ui_list_set_rect(list, &rect);
-
-	entry = ui_list_page_nth_entry(list, 0, &idx);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("b", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(1, idx);
-
-	entry = ui_list_page_nth_entry(list, 1, &idx);
-	PCUT_ASSERT_NOT_NULL(entry);
-	PCUT_ASSERT_STR_EQUALS("c", entry->caption);
-	PCUT_ASSERT_INT_EQUALS(2, idx);
-
-	entry = ui_list_page_nth_entry(list, 2, &idx);
-	PCUT_ASSERT_NULL(entry);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_move() moves cursor and scrolls */
-PCUT_TEST(cursor_move)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry and page start to the next-to-last entry */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 2;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 1;
-
-	/* Move cursor one entry up */
-	ui_list_cursor_move(list, ui_list_prev(list->cursor),
-	    list->cursor_idx - 1);
-
-	/* Cursor and page start should now both be at the second entry */
-	PCUT_ASSERT_STR_EQUALS("b", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Move cursor to the first entry. This should scroll up. */
-	ui_list_cursor_move(list, ui_list_first(list), 0);
-
-	/* Cursor and page start should now both be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Move cursor to the last entry. */
-	ui_list_cursor_move(list, ui_list_last(list), 2);
-
-	/* Cursor should be on the last entry and page on the next to last */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_up() moves cursor one entry up */
-PCUT_TEST(cursor_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry and page start to the next-to-last entry */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 2;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 1;
-
-	/* Move cursor one entry up */
-	ui_list_cursor_up(list);
-
-	/* Cursor and page start should now both be at the second entry */
-	PCUT_ASSERT_STR_EQUALS("b", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Move cursor one entry up. This should scroll up. */
-	ui_list_cursor_up(list);
-
-	/* Cursor and page start should now both be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Moving further up should do nothing (we are at the top). */
-	ui_list_cursor_up(list);
-
-	/* Cursor and page start should still be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_down() moves cursor one entry down */
-PCUT_TEST(cursor_down)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page start to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = list->cursor;
-	list->page_idx = 0;
-
-	/* Move cursor one entry down */
-	ui_list_cursor_down(list);
-
-	/* Cursor should now be at the second entry, page stays the same */
-	PCUT_ASSERT_STR_EQUALS("b", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(ui_list_first(list), list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Move cursor one entry down. This should scroll down. */
-	ui_list_cursor_down(list);
-
-	/* Cursor should now be at the third and page at the second entry. */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Moving further down should do nothing (we are at the bottom). */
-	ui_list_cursor_down(list);
-
-	/* Cursor should still be at the third and page at the second entry. */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_top() moves cursor to the first entry */
-PCUT_TEST(cursor_top)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry and page start to the next-to-last entry */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 2;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 1;
-
-	/* Move cursor to the top. This should scroll up. */
-	ui_list_cursor_top(list);
-
-	/* Cursor and page start should now both be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_cursor_bottom() moves cursor to the last entry */
-PCUT_TEST(cursor_bottom)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page start to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = list->cursor;
-	list->page_idx = 0;
-
-	/* Move cursor to the bottom. This should scroll down. */
-	ui_list_cursor_bottom(list);
-
-	/* Cursor should now be at the third and page at the second entry. */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_page_up() moves one page up */
-PCUT_TEST(page_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add five entries (2 full pages, one partial) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry and page start to the next-to-last entry */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 4;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 3;
-
-	/* Move one page up */
-	ui_list_page_up(list);
-
-	/* Page should now start at second entry and cursor at third */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Move one page up again. */
-	ui_list_page_up(list);
-
-	/* Cursor and page start should now both be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Moving further up should do nothing (we are at the top). */
-	ui_list_page_up(list);
-
-	/* Cursor and page start should still be at the first entry */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_EQUALS(list->cursor, list->page);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_page_up() moves one page down */
-PCUT_TEST(page_down)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add five entries (2 full pages, one partial) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = list->cursor;
-	list->page_idx = 0;
-
-	/* Move one page down */
-	ui_list_page_down(list);
-
-	/* Page and cursor should point to the third entry */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("c", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->page_idx);
-
-	/* Move one page down again. */
-	ui_list_page_down(list);
-
-	/* Cursor should point to last and page to next-to-last entry */
-	PCUT_ASSERT_STR_EQUALS("e", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(5, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(4, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("d", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(4, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(3, list->page_idx);
-
-	/* Moving further down should do nothing (we are at the bottom). */
-	ui_list_page_down(list);
-
-	/* Cursor should still point to last and page to next-to-last entry */
-	PCUT_ASSERT_STR_EQUALS("e", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(5, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(4, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("d", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(4, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(3, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scroll_up() scrolls up by one row */
-PCUT_TEST(scroll_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry, page to the second */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 2;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 1;
-
-	/* Scroll one entry up */
-	ui_list_scroll_up(list);
-
-	/* Page should start on the first entry, cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("a", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Try scrolling one more entry up */
-	ui_list_scroll_up(list);
-
-	/* We were at the beginning, so nothing should have changed  */
-	PCUT_ASSERT_STR_EQUALS("c", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("a", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scroll_down() scrolls down by one row */
-PCUT_TEST(scroll_down)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add tree entries (more than page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page start to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = list->cursor;
-	list->page_idx = 0;
-
-	/* Scroll one entry down */
-	ui_list_scroll_down(list);
-
-	/* Page should start on the second entry, cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Try scrolling one more entry down */
-	ui_list_scroll_down(list);
-
-	/* We were at the end, so nothing should have changed  */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scroll_page_up() scrolls up by one page */
-PCUT_TEST(scroll_page_up)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add five entries (more than twice the page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor to the last entry, page to the second last */
-	list->cursor = ui_list_last(list);
-	list->cursor_idx = 4;
-	list->page = ui_list_prev(list->cursor);
-	list->page_idx = 3;
-
-	/* Scroll one page up */
-	ui_list_scroll_page_up(list);
-
-	/* Page should start on 'b', cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("e", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(5, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(4, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Page up again */
-	ui_list_scroll_page_up(list);
-
-	/* Page should now be at the beginning, cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("e", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(5, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(4, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("a", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	/* Page up again */
-	ui_list_scroll_page_up(list);
-
-	/* We were at the beginning, nothing should have changed */
-	PCUT_ASSERT_STR_EQUALS("e", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(5, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(4, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("a", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scroll_page_up() scrolls down by one page */
-PCUT_TEST(scroll_page_down)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add five entries (more than twice the page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = ui_list_first(list);
-	list->page_idx = 0;
-
-	/* Scroll one page down */
-	ui_list_scroll_page_down(list);
-
-	/* Page should start on 'c', cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("c", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(3, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(2, list->page_idx);
-
-	/* Page down again */
-	ui_list_scroll_page_down(list);
-
-	/* Page should now start at 'd', cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("d", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(4, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(3, list->page_idx);
-
-	/* Page down again */
-	ui_list_scroll_page_down(list);
-
-	/* We were at the end, nothing should have changed */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("d", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(4, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(3, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_scroll_pos() scrolls to a particular entry */
-PCUT_TEST(scroll_pos)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 10;
-	rect.p1.y = 38; /* Assuming this makes page size 2 */
-	ui_list_set_rect(list, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(2, ui_list_page_size(list));
-
-	/* Add five entries (more than twice the page size, which is 2) */
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "c";
-	attr.arg = (void *)3;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "d";
-	attr.arg = (void *)4;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "e";
-	attr.arg = (void *)5;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Cursor and page to the first entry */
-	list->cursor = ui_list_first(list);
-	list->cursor_idx = 0;
-	list->page = ui_list_first(list);
-	list->page_idx = 0;
-
-	/* Scroll to entry 1 (one down) */
-	ui_list_scroll_pos(list, 1);
-
-	/* Page should start on 'b', cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("b", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(2, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(1, list->page_idx);
-
-	/* Scroll to entry 3 (i.e. the end) */
-	ui_list_scroll_pos(list, 3);
-
-	/* Page should now start at 'd', cursor unchanged */
-	PCUT_ASSERT_STR_EQUALS("a", list->cursor->caption);
-	PCUT_ASSERT_INT_EQUALS(1, (intptr_t)list->cursor->arg);
-	PCUT_ASSERT_INT_EQUALS(0, list->cursor_idx);
-	PCUT_ASSERT_STR_EQUALS("d", list->page->caption);
-	PCUT_ASSERT_INT_EQUALS(4, (intptr_t)list->page->arg);
-	PCUT_ASSERT_INT_EQUALS(3, list->page_idx);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_activate_req() sends activation request */
-PCUT_TEST(activate_req)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	resp.activate_req = false;
-	resp.activate_req_list = NULL;
-
-	ui_list_activate_req(list);
-	PCUT_ASSERT_TRUE(resp.activate_req);
-	PCUT_ASSERT_EQUALS(list, resp.activate_req_list);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_selected() runs selected callback */
-PCUT_TEST(selected)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-	ui_list_entry_t *entry;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Hello";
-	attr.arg = &resp;
-
-	rc = ui_list_entry_append(list, &attr, &entry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.selected = false;
-	resp.selected_entry = NULL;
-
-	ui_list_selected(entry);
-	PCUT_ASSERT_TRUE(resp.selected);
-	PCUT_ASSERT_EQUALS(entry, resp.selected_entry);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_ptr_cmp compares two indirectly referenced entries */
-PCUT_TEST(entry_ptr_cmp)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *a, *b;
-	ui_list_entry_attr_t attr;
-	test_resp_t resp;
-	int rel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	a = ui_list_first(list);
-	PCUT_ASSERT_NOT_NULL(a);
-	b = ui_list_next(a);
-	PCUT_ASSERT_NOT_NULL(b);
-
-	/* a < b */
-	rel = ui_list_entry_ptr_cmp(&a, &b);
-	PCUT_ASSERT_TRUE(rel < 0);
-
-	/* b > a */
-	rel = ui_list_entry_ptr_cmp(&b, &a);
-	PCUT_ASSERT_TRUE(rel > 0);
-
-	/* a == a */
-	rel = ui_list_entry_ptr_cmp(&a, &a);
-	PCUT_ASSERT_INT_EQUALS(0, rel);
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_list_entry_get_idx() returns entry index */
-PCUT_TEST(entry_get_idx)
-{
-	ui_t *ui;
-	ui_window_t *window;
-	ui_wnd_params_t params;
-	ui_list_t *list;
-	ui_list_entry_t *a, *b;
-	ui_list_entry_attr_t attr;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Test";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_list_create(window, true, &list);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_list_set_cb(list, &test_cb, &resp);
-
-	ui_list_entry_attr_init(&attr);
-
-	attr.caption = "a";
-	attr.arg = (void *)2;
-	rc = ui_list_entry_append(list, &attr, &a);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	attr.caption = "b";
-	attr.arg = (void *)1;
-	rc = ui_list_entry_append(list, &attr, &b);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(0, ui_list_entry_get_idx(a));
-	PCUT_ASSERT_INT_EQUALS(1, ui_list_entry_get_idx(b));
-
-	ui_list_destroy(list);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_list_activate_req(ui_list_t *list, void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->activate_req = true;
-	resp->activate_req_list = list;
-}
-
-static void test_list_selected(ui_list_entry_t *entry, void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->selected = true;
-	resp->selected_entry = entry;
-}
-
-static int test_list_compare(ui_list_entry_t *a, ui_list_entry_t *b)
-{
-	return str_cmp(a->caption, b->caption);
-}
-
-PCUT_EXPORT(list);
Index: pace/lib/ui/test/main.c
===================================================================
--- uspace/lib/ui/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(accel);
-PCUT_IMPORT(control);
-PCUT_IMPORT(checkbox);
-PCUT_IMPORT(clickmatic);
-PCUT_IMPORT(entry);
-PCUT_IMPORT(file_dialog);
-PCUT_IMPORT(file_list);
-PCUT_IMPORT(fixed);
-PCUT_IMPORT(image);
-PCUT_IMPORT(label);
-PCUT_IMPORT(list);
-PCUT_IMPORT(menu);
-PCUT_IMPORT(menubar);
-PCUT_IMPORT(menudd);
-PCUT_IMPORT(menuentry);
-PCUT_IMPORT(msg_dialog);
-PCUT_IMPORT(paint);
-PCUT_IMPORT(pbutton);
-PCUT_IMPORT(popup);
-PCUT_IMPORT(rbutton);
-PCUT_IMPORT(resource);
-PCUT_IMPORT(scrollbar);
-PCUT_IMPORT(select_dialog);
-PCUT_IMPORT(slider);
-PCUT_IMPORT(tab);
-PCUT_IMPORT(tabset);
-PCUT_IMPORT(testctl);
-PCUT_IMPORT(ui);
-PCUT_IMPORT(wdecor);
-PCUT_IMPORT(window);
-
-PCUT_MAIN();
Index: pace/lib/ui/test/menu.c
===================================================================
--- uspace/lib/ui/test/menu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,842 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menuentry.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/menu.h"
-#include "../private/menubar.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(menu);
-
-typedef struct {
-	bool left_called;
-	bool right_called;
-	bool close_req_called;
-	bool press_accel_called;
-	ui_menu_t *menu;
-	sysarg_t idev_id;
-	char32_t c;
-} test_resp_t;
-
-static void testmenu_left(ui_menu_t *, void *, sysarg_t);
-static void testmenu_right(ui_menu_t *, void *, sysarg_t);
-static void testmenu_close_req(ui_menu_t *, void *);
-static void testmenu_press_accel(ui_menu_t *, void *, char32_t, sysarg_t);
-
-ui_menu_cb_t testmenu_cb = {
-	.left = testmenu_left,
-	.right = testmenu_right,
-	.close_req = testmenu_close_req,
-	.press_accel = testmenu_press_accel
-};
-
-ui_menu_cb_t dummy_cb = {
-};
-
-/** Create and destroy menu */
-PCUT_TEST(create_destroy)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_destroy(menu);
-}
-
-/** ui_menu_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_menu_destroy(NULL);
-}
-
-/** ui_menu_set_cb() sets the internal fields */
-PCUT_TEST(set_cb)
-{
-	ui_menu_t *menu = NULL;
-	ui_menu_cb_t cb;
-	int obj;
-	errno_t rc;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_set_cb(menu, &cb, (void *)&obj);
-	PCUT_ASSERT_EQUALS(&cb, menu->cb);
-	PCUT_ASSERT_EQUALS((void *)&obj, menu->arg);
-
-	ui_menu_destroy(menu);
-}
-
-/** Computing menu geometry */
-PCUT_TEST(get_geom)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	ui_menu_geom_t geom;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	pos.x = 0;
-	pos.y = 0;
-	ui_menu_get_geom(menu, &pos, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.outer_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.outer_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(16, geom.outer_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(8, geom.outer_rect.p1.y);
-	PCUT_ASSERT_INT_EQUALS(4, geom.entries_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(4, geom.entries_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(12, geom.entries_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(4, geom.entries_rect.p1.y);
-
-	ui_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_get_res() gets the menu's resource */
-PCUT_TEST(get_res)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	ui_resource_t *res;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* The menu must be open first */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	res = ui_menu_get_res(menu);
-	PCUT_ASSERT_NOT_NULL(res);
-
-	ui_menu_destroy(menu);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Open and close menu with ui_menu_open() / ui_menu_close() */
-PCUT_TEST(open_close)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Open and close */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_close(menu);
-
-	ui_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_is_open() correctly returns menu state */
-PCUT_TEST(is_open)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	bool open;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	open = ui_menu_is_open(menu);
-	PCUT_ASSERT_FALSE(open);
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	open = ui_menu_is_open(menu);
-	PCUT_ASSERT_TRUE(open);
-
-	ui_menu_close(menu);
-
-	open = ui_menu_is_open(menu);
-	PCUT_ASSERT_FALSE(open);
-
-	ui_menu_destroy(menu);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint background in graphics mode */
-PCUT_TEST(paint_bg_gfx)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to paint it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	rc = ui_menu_paint_bg_gfx(menu, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint background in text mode */
-PCUT_TEST(paint_bg_text)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to paint it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	rc = ui_menu_paint_bg_text(menu, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint menu */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to paint it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	rc = ui_menu_paint(menu, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_pos_event() inside menu is claimed */
-PCUT_TEST(pos_event_inside)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	ui_evclaim_t claimed;
-	gfx_coord2_t pos;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	pos.x = 0;
-	pos.y = 0;
-	event.type = POS_PRESS;
-	event.hpos = 0;
-	event.vpos = 0;
-	claimed = ui_menu_pos_event(menu, &pos, &event);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_up() with empty menu does nothing */
-PCUT_TEST(up_empty)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to move around it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_up(menu);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_up() moves one entry up, skips separators, wraps around */
-PCUT_TEST(up)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry1 = NULL;
-	ui_menu_entry_t *mentry2 = NULL;
-	ui_menu_entry_t *mentry3 = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry1);
-
-	rc = ui_menu_entry_sep_create(menu, &mentry2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry2);
-
-	rc = ui_menu_entry_create(menu, "Bar", "F2", &mentry3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry3);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to move around it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* When menu is open, the first entry is selected */
-	PCUT_ASSERT_EQUALS(mentry1, menu->selected);
-
-	ui_menu_up(menu);
-
-	/* Now we've wrapped around to the last entry */
-	PCUT_ASSERT_EQUALS(mentry3, menu->selected);
-
-	ui_menu_up(menu);
-
-	/* mentry2 is a separator and was skipped */
-	PCUT_ASSERT_EQUALS(mentry1, menu->selected);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_down() with empty menu does nothing */
-PCUT_TEST(down_empty)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to move around it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_down(menu);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_down() moves one entry down, skips separators, wraps around */
-PCUT_TEST(down)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry1 = NULL;
-	ui_menu_entry_t *mentry2 = NULL;
-	ui_menu_entry_t *mentry3 = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_create(window, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry1);
-
-	rc = ui_menu_entry_sep_create(menu, &mentry2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry2);
-
-	rc = ui_menu_entry_create(menu, "Bar", "F2", &mentry3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry3);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Menu needs to be open to be able to move around it */
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* When menu is open, the first entry is selected */
-	PCUT_ASSERT_EQUALS(mentry1, menu->selected);
-
-	ui_menu_down(menu);
-
-	/* mentry2 is a separator and was skipped */
-	PCUT_ASSERT_EQUALS(mentry3, menu->selected);
-
-	ui_menu_up(menu);
-
-	/* Now we've wrapped around to the first entry */
-	PCUT_ASSERT_EQUALS(mentry1, menu->selected);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Sending an unhandled event does nothing. */
-PCUT_TEST(send_unhandled)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-	sysarg_t idev_id;
-	char32_t c;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	/* Send events without setting callback */
-	c = 'A';
-	idev_id = 42;
-	ui_menu_left(menu, idev_id);
-	ui_menu_right(menu, idev_id);
-	ui_menu_close_req(menu);
-	ui_menu_press_accel(menu, c, idev_id);
-
-	/* Set dummy callback structure */
-	ui_menu_set_cb(menu, &dummy_cb, NULL);
-
-	/* Send unhandled events */
-	ui_menu_left(menu, idev_id);
-	ui_menu_right(menu, idev_id);
-	ui_menu_close_req(menu);
-	ui_menu_press_accel(menu, c, idev_id);
-
-	ui_menu_destroy(menu);
-}
-
-/** ui_menu_left() sends left event */
-PCUT_TEST(left)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-	test_resp_t resp;
-	sysarg_t idev_id;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_set_cb(menu, &testmenu_cb, (void *)&resp);
-
-	memset(&resp, 0, sizeof(resp));
-	PCUT_ASSERT_FALSE(resp.left_called);
-
-	idev_id = 42;
-	ui_menu_left(menu, idev_id);
-
-	PCUT_ASSERT_TRUE(resp.left_called);
-	PCUT_ASSERT_EQUALS(menu, resp.menu);
-	PCUT_ASSERT_INT_EQUALS(idev_id, resp.idev_id);
-
-	ui_menu_destroy(menu);
-}
-
-/** ui_menu_right() sends right event */
-PCUT_TEST(right)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-	test_resp_t resp;
-	sysarg_t idev_id;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_set_cb(menu, &testmenu_cb, (void *)&resp);
-
-	memset(&resp, 0, sizeof(resp));
-	PCUT_ASSERT_FALSE(resp.right_called);
-
-	idev_id = 42;
-	ui_menu_right(menu, idev_id);
-
-	PCUT_ASSERT_TRUE(resp.right_called);
-	PCUT_ASSERT_EQUALS(menu, resp.menu);
-	PCUT_ASSERT_INT_EQUALS(idev_id, resp.idev_id);
-
-	ui_menu_destroy(menu);
-}
-
-/** ui_menu_close_req() sends close_req event */
-PCUT_TEST(close_req)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-	test_resp_t resp;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_set_cb(menu, &testmenu_cb, (void *)&resp);
-
-	memset(&resp, 0, sizeof(resp));
-	PCUT_ASSERT_FALSE(resp.close_req_called);
-
-	ui_menu_close_req(menu);
-
-	PCUT_ASSERT_TRUE(resp.close_req_called);
-	PCUT_ASSERT_EQUALS(menu, resp.menu);
-
-	ui_menu_destroy(menu);
-}
-
-/** ui_menu_press_accel() sends press_accel event */
-PCUT_TEST(press_accel)
-{
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-	test_resp_t resp;
-	char32_t c;
-	sysarg_t idev_id;
-
-	rc = ui_menu_create(NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	ui_menu_set_cb(menu, &testmenu_cb, (void *)&resp);
-
-	memset(&resp, 0, sizeof(resp));
-	PCUT_ASSERT_FALSE(resp.press_accel_called);
-
-	c = 'A';
-	idev_id = 42;
-	ui_menu_press_accel(menu, c, idev_id);
-
-	PCUT_ASSERT_TRUE(resp.press_accel_called);
-	PCUT_ASSERT_EQUALS(menu, resp.menu);
-	PCUT_ASSERT_EQUALS(c, resp.c);
-	PCUT_ASSERT_INT_EQUALS(idev_id, resp.idev_id);
-
-	ui_menu_destroy(menu);
-}
-
-/** Test menu left callback */
-static void testmenu_left(ui_menu_t *menu, void *arg, sysarg_t idev_id)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->left_called = true;
-	resp->menu = menu;
-	resp->idev_id = idev_id;
-}
-
-/** Test menu right callback */
-static void testmenu_right(ui_menu_t *menu, void *arg, sysarg_t idev_id)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->right_called = true;
-	resp->menu = menu;
-	resp->idev_id = idev_id;
-}
-
-/** Test menu close callback */
-static void testmenu_close_req(ui_menu_t *menu, void *arg)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->close_req_called = true;
-	resp->menu = menu;
-}
-
-/** Test menu press accel callback */
-static void testmenu_press_accel(ui_menu_t *menu, void *arg,
-    char32_t c, sysarg_t kbd_id)
-{
-	test_resp_t *resp = (test_resp_t *)arg;
-
-	resp->press_accel_called = true;
-	resp->menu = menu;
-	resp->c = c;
-	resp->idev_id = kbd_id;
-}
-
-PCUT_EXPORT(menu);
Index: pace/lib/ui/test/menubar.c
===================================================================
--- uspace/lib/ui/test/menubar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,502 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/menubar.h"
-#include "../private/wdecor.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(menubar);
-
-/** Create and destroy menu bar */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_menu_bar_destroy(NULL);
-}
-
-/** ui_menu_bar_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	control = ui_menu_bar_ctl(mbar);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Set menu bar rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	gfx_rect_t rect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_menu_bar_set_rect(mbar, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, mbar->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, mbar->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, mbar->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, mbar->rect.p1.y);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint menu bar */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_bar_paint(mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Deliver menu bar keyboard event */
-PCUT_TEST(kbd_event)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_evclaim_t claimed;
-	kbd_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 50;
-	rect.p1.y = 25;
-	ui_menu_bar_set_rect(mbar, &rect);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	event.type = KEY_PRESS;
-	event.key = KC_F10;
-	event.mods = 0;
-	claimed = ui_menu_bar_kbd_event(mbar, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_press_accel() opens the corresponding menu */
-PCUT_TEST(press_accel)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 50;
-	rect.p1.y = 25;
-	ui_menu_bar_set_rect(mbar, &rect);
-
-	rc = ui_menu_dd_create(mbar, "~T~est", &mdd, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	PCUT_ASSERT_FALSE(ui_menu_dd_is_open(mdd));
-
-	ui_menu_bar_press_accel(mbar, 't', 0);
-
-	PCUT_ASSERT_TRUE(ui_menu_dd_is_open(mdd));
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press event on menu bar entry selects menu */
-PCUT_TEST(pos_event_select)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	ui_evclaim_t claimed;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 50;
-	rect.p1.y = 25;
-	ui_menu_bar_set_rect(mbar, &rect);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	event.type = POS_PRESS;
-	event.hpos = 4;
-	event.vpos = 4;
-	claimed = ui_menu_bar_pos_event(mbar, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	/* Clicking the menu bar entry should select menu drop-down */
-	PCUT_ASSERT_EQUALS(mdd, mbar->selected);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Calling ui_menu_bar_select() with another menu selects it */
-PCUT_TEST(select_different)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd1 = NULL;
-	ui_menu_dd_t *mdd2 = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd1, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd1);
-
-	rc = ui_menu_dd_create(mbar, "Test 2", &mdd2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd2);
-
-	ui_menu_bar_select(mbar, mdd1, true, 0);
-	PCUT_ASSERT_EQUALS(mdd1, mbar->selected);
-
-	/* Selecting different menu should select it */
-	ui_menu_bar_select(mbar, mdd2, true, 0);
-	PCUT_ASSERT_EQUALS(mdd2, mbar->selected);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_select_first/last() selects first/last drop-down */
-PCUT_TEST(select_first_last)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd1 = NULL;
-	ui_menu_dd_t *mdd2 = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd1, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd1);
-
-	rc = ui_menu_dd_create(mbar, "Test 2", &mdd2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd2);
-
-	ui_menu_bar_select_first(mbar, true, 0);
-	PCUT_ASSERT_EQUALS(mdd1, mbar->selected);
-
-	ui_menu_bar_select_last(mbar, true, 0);
-	PCUT_ASSERT_EQUALS(mdd2, mbar->selected);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_select_sysmenu() activates system menu */
-PCUT_TEST(select_sysmenu)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd1 = NULL;
-	ui_menu_dd_t *mdd2 = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd1, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd1);
-
-	rc = ui_menu_dd_create(mbar, "Test 2", &mdd2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd2);
-
-	ui_menu_bar_select_sysmenu(mbar, false, 0);
-	PCUT_ASSERT_TRUE(window->wdecor->sysmenu_hdl_active);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_activate() activates/deactivates menu bar */
-PCUT_TEST(activate_deactivate)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-
-	ui_menu_bar_activate(mbar);
-	PCUT_ASSERT_EQUALS(mdd, mbar->selected);
-
-	ui_menu_bar_deactivate(mbar);
-	PCUT_ASSERT_NULL(mbar->selected);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(menubar);
Index: pace/lib/ui/test/menudd.c
===================================================================
--- uspace/lib/ui/test/menudd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,367 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/menudd.h>
-#include <ui/menubar.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/menu.h"
-#include "../private/menubar.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(menudd);
-
-/** Create and destroy menu drop-down */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	ui_menu_t *menu = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	/*
-	 * Normally we don't need to destroy a menu drop-down explicitly,
-	 * it will be destroyed along with menu bar, but here we'll test
-	 * destroying it explicitly.
-	 */
-	ui_menu_dd_destroy(mdd);
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_dd_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_menu_dd_destroy(NULL);
-}
-
-/** ui_menu_dd_first() / ui_menu_dd_next() iterate over menu drop-downs */
-PCUT_TEST(first_next)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd1 = NULL;
-	ui_menu_dd_t *mdd2 = NULL;
-	ui_menu_dd_t *m;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd1, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd1);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd2);
-
-	m = ui_menu_dd_first(mbar);
-	PCUT_ASSERT_EQUALS(mdd1, m);
-
-	m = ui_menu_dd_next(m);
-	PCUT_ASSERT_EQUALS(mdd2, m);
-
-	m = ui_menu_dd_next(m);
-	PCUT_ASSERT_NULL(m);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_dd_last() / ui_menu_dd_prev() iterate over menu drop-downs
- * in reverse.
- */
-PCUT_TEST(last_prev)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd1 = NULL;
-	ui_menu_dd_t *mdd2 = NULL;
-	ui_menu_dd_t *m;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd1, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd1);
-
-	rc = ui_menu_dd_create(mbar, "Test 1", &mdd2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd2);
-
-	m = ui_menu_dd_last(mbar);
-	PCUT_ASSERT_EQUALS(mdd2, m);
-
-	m = ui_menu_dd_prev(m);
-	PCUT_ASSERT_EQUALS(mdd1, m);
-
-	m = ui_menu_dd_prev(m);
-	PCUT_ASSERT_NULL(m);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_dd_caption() returns the drop down's caption */
-PCUT_TEST(caption)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	const char *caption;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-
-	caption = ui_menu_dd_caption(mdd);
-	PCUT_ASSERT_NOT_NULL(caption);
-
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp(caption, "Test"));
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_dd_get_accel() returns the accelerator character */
-PCUT_TEST(get_accel)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	char32_t accel;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "~T~est", &mdd, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-
-	accel = ui_menu_dd_get_accel(mdd);
-	printf("accel='%c' (%d)\n", (char)accel, (int)accel);
-	PCUT_ASSERT_EQUALS((char32_t)'t', accel);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Open and close menu drop-down with ui_menu_dd_open() / ui_menu_dd_close() */
-PCUT_TEST(open_close)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	/* Open and close */
-	rc = ui_menu_dd_open(mdd, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_dd_close(mdd);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_dd_is_open() correctly returns menu drop-down state */
-PCUT_TEST(is_open)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_dd_t *mdd = NULL;
-	gfx_rect_t prect;
-	bool open;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", &mdd, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mdd);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	open = ui_menu_dd_is_open(mdd);
-	PCUT_ASSERT_FALSE(open);
-
-	rc = ui_menu_dd_open(mdd, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	open = ui_menu_dd_is_open(mdd);
-	PCUT_ASSERT_TRUE(open);
-
-	ui_menu_dd_close(mdd);
-
-	open = ui_menu_dd_is_open(mdd);
-	PCUT_ASSERT_FALSE(open);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(menudd);
Index: pace/lib/ui/test/menuentry.c
===================================================================
--- uspace/lib/ui/test/menuentry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,962 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/menu.h>
-#include <ui/menubar.h>
-#include <ui/menudd.h>
-#include <ui/menuentry.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/menuentry.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(menuentry);
-
-typedef struct {
-	bool activated;
-} test_resp_t;
-
-static void test_entry_cb(ui_menu_entry_t *, void *);
-
-/** Create and destroy menu entry */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	/* Just for sake of test. Menu entry is destroyed along with menu */
-	ui_menu_entry_destroy(mentry);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Create and destroy separator menu entry */
-PCUT_TEST(create_sep_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_sep_create(menu, &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	/* Just for sake of test. Menu entry is destroyed along with menu */
-	ui_menu_entry_destroy(mentry);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_bar_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_menu_bar_destroy(NULL);
-}
-
-/** ui_menu_entry_set_cb() .. */
-PCUT_TEST(set_cb)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_set_cb(mentry, test_entry_cb, &resp);
-
-	resp.activated = false;
-	ui_menu_entry_cb(mentry);
-	PCUT_ASSERT_TRUE(resp.activated);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_entry_first() / ui_menu_entry_next() iterate over entries */
-PCUT_TEST(first_next)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *entry1 = NULL;
-	ui_menu_entry_t *entry2 = NULL;
-	ui_menu_entry_t *e;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &entry1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry1);
-
-	rc = ui_menu_entry_create(menu, "Bar", "F2", &entry2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry2);
-
-	e = ui_menu_entry_first(menu);
-	PCUT_ASSERT_EQUALS(entry1, e);
-
-	e = ui_menu_entry_next(e);
-	PCUT_ASSERT_EQUALS(entry2, e);
-
-	e = ui_menu_entry_next(e);
-	PCUT_ASSERT_NULL(e);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_entry_last() / ui_menu_entry_prev() iterate over entries in reverse */
-PCUT_TEST(last_prev)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *entry1 = NULL;
-	ui_menu_entry_t *entry2 = NULL;
-	ui_menu_entry_t *e;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &entry1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry1);
-
-	rc = ui_menu_entry_create(menu, "Bar", "F2", &entry2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(entry2);
-
-	e = ui_menu_entry_last(menu);
-	PCUT_ASSERT_EQUALS(entry2, e);
-
-	e = ui_menu_entry_prev(e);
-	PCUT_ASSERT_EQUALS(entry1, e);
-
-	e = ui_menu_entry_prev(e);
-	PCUT_ASSERT_NULL(e);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_entry_column_widths() / ui_menu_entry_height() */
-PCUT_TEST(widths_height)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord_t caption_w;
-	gfx_coord_t shortcut_w;
-	gfx_coord_t width;
-	gfx_coord_t height;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_column_widths(mentry, &caption_w, &shortcut_w);
-	PCUT_ASSERT_INT_EQUALS(11, caption_w);
-	PCUT_ASSERT_INT_EQUALS(10, shortcut_w);
-
-	width = ui_menu_entry_calc_width(menu, caption_w, shortcut_w);
-	PCUT_ASSERT_INT_EQUALS(4 + 11 + 8 + 10 + 4, width);
-
-	height = ui_menu_entry_height(mentry);
-	PCUT_ASSERT_INT_EQUALS(13 + 8, height);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint menu entry */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	rc = ui_menu_entry_paint(mentry, &pos);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_entry_selectable() returns correct value based on entry type */
-PCUT_TEST(selectable)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	/* Selectable entry */
-
-	rc = ui_menu_entry_create(menu, "Foo", "F1", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	PCUT_ASSERT_TRUE(ui_menu_entry_selectable(mentry));
-
-	ui_menu_entry_destroy(mentry);
-
-	/* Non-selectable separator entry */
-
-	rc = ui_menu_entry_sep_create(menu, &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	PCUT_ASSERT_FALSE(ui_menu_entry_selectable(mentry));
-
-	ui_menu_entry_destroy(mentry);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press and release activates menu entry */
-PCUT_TEST(press_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_set_cb(mentry, test_entry_cb, &resp);
-	resp.activated = false;
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	ui_menu_entry_press(mentry, &pos);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_release(mentry);
-	PCUT_ASSERT_FALSE(mentry->held);
-	PCUT_ASSERT_TRUE(resp.activated);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press, leave and release does not activate entry */
-PCUT_TEST(press_leave_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_set_cb(mentry, test_entry_cb, &resp);
-	resp.activated = false;
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	ui_menu_entry_press(mentry, &pos);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_leave(mentry, &pos);
-	PCUT_ASSERT_FALSE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_release(mentry);
-	PCUT_ASSERT_FALSE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press, leave, enter and release activates menu entry */
-PCUT_TEST(press_leave_enter_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_set_cb(mentry, test_entry_cb, &resp);
-	resp.activated = false;
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	ui_menu_entry_press(mentry, &pos);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_leave(mentry, &pos);
-	PCUT_ASSERT_FALSE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_enter(mentry, &pos);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-	PCUT_ASSERT_FALSE(resp.activated);
-
-	ui_menu_entry_release(mentry);
-	PCUT_ASSERT_FALSE(mentry->held);
-	PCUT_ASSERT_TRUE(resp.activated);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_menu_entry_activate() activates menu entry */
-PCUT_TEST(activate)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_rect_t prect;
-	test_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	ui_menu_entry_set_cb(mentry, test_entry_cb, &resp);
-	resp.activated = false;
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(resp.activated);
-	ui_menu_entry_activate(mentry);
-
-	ui_menu_entry_release(mentry);
-	PCUT_ASSERT_TRUE(resp.activated);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press event inside menu entry */
-PCUT_TEST(pos_press_inside)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-
-	event.type = POS_PRESS;
-	event.hpos = 4;
-	event.vpos = 4;
-
-	ui_menu_entry_pos_event(mentry, &pos, &event);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press event outside menu entry */
-PCUT_TEST(pos_press_outside)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-
-	event.type = POS_PRESS;
-	event.hpos = 40;
-	event.vpos = 20;
-
-	ui_menu_entry_pos_event(mentry, &pos, &event);
-	PCUT_ASSERT_FALSE(mentry->inside);
-	PCUT_ASSERT_FALSE(mentry->held);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Position event moving out of menu entry */
-PCUT_TEST(pos_move_out)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 0;
-	pos.y = 0;
-	ui_menu_entry_press(mentry, &pos);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-
-	event.type = POS_UPDATE;
-	event.hpos = 40;
-	event.vpos = 20;
-
-	ui_menu_entry_pos_event(mentry, &pos, &event);
-	PCUT_ASSERT_FALSE(mentry->inside);
-	PCUT_ASSERT_TRUE(mentry->held);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Position event moving inside menu entry */
-PCUT_TEST(pos_move_in)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_menu_bar_t *mbar = NULL;
-	ui_menu_t *menu = NULL;
-	ui_menu_entry_t *mentry = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t prect;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_menu_bar_create(ui, window, &mbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mbar);
-
-	rc = ui_menu_dd_create(mbar, "Test", NULL, &menu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(menu);
-
-	rc = ui_menu_entry_create(menu, "X", "Y", &mentry);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(mentry);
-
-	prect.p0.x = 0;
-	prect.p0.y = 0;
-	prect.p1.x = 0;
-	prect.p1.y = 0;
-
-	rc = ui_menu_open(menu, &prect, 0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = POS_UPDATE;
-	event.hpos = 4;
-	event.vpos = 4;
-
-	pos.x = 0;
-	pos.y = 0;
-
-	ui_menu_entry_pos_event(mentry, &pos, &event);
-	PCUT_ASSERT_TRUE(mentry->inside);
-	PCUT_ASSERT_FALSE(mentry->held);
-
-	ui_menu_bar_destroy(mbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_entry_cb(ui_menu_entry_t *mentry, void *arg)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->activated = true;
-}
-
-PCUT_EXPORT(menuentry);
Index: pace/lib/ui/test/msgdialog.c
===================================================================
--- uspace/lib/ui/test/msgdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/msgdialog.h>
-#include "../private/msgdialog.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(msg_dialog);
-
-static void test_dialog_button(ui_msg_dialog_t *, void *, unsigned);
-static void test_dialog_close(ui_msg_dialog_t *, void *);
-
-static ui_msg_dialog_cb_t test_msg_dialog_cb = {
-	.button = test_dialog_button,
-	.close = test_dialog_close
-};
-
-static ui_msg_dialog_cb_t dummy_msg_dialog_cb = {
-};
-
-typedef struct {
-	bool button;
-	unsigned bnum;
-	bool close;
-} test_cb_resp_t;
-
-/** Create and destroy message dialog */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Message";
-	params.text = "Hello";
-
-	rc = ui_msg_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	ui_msg_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_msg_dialog_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_msg_dialog_destroy(NULL);
-}
-
-/** Button click invokes callback set via ui_msg_dialog_set_cb() */
-PCUT_TEST(button_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog = NULL;
-	unsigned i;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Message";
-	params.text = "Hello";
-	params.choice = umdc_ok_cancel;
-
-	rc = ui_msg_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Button callback with no callbacks set */
-	ui_pbutton_clicked(dialog->btn[0]);
-
-	/* Button callback with callback not implemented */
-	ui_msg_dialog_set_cb(dialog, &dummy_msg_dialog_cb, NULL);
-	ui_pbutton_clicked(dialog->btn[0]);
-
-	for (i = 0; i < 2; i++) {
-		/* Button callback with real callback set */
-		resp.button = false;
-		resp.bnum = 123;
-		ui_msg_dialog_set_cb(dialog, &test_msg_dialog_cb, &resp);
-		ui_pbutton_clicked(dialog->btn[i]);
-		PCUT_ASSERT_TRUE(resp.button);
-		PCUT_ASSERT_INT_EQUALS(i, resp.bnum);
-	}
-
-	ui_msg_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Sending window close request invokes callback set via
- * ui_msg_dialog_set_cb()
- */
-PCUT_TEST(close_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_msg_dialog_params_t params;
-	ui_msg_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_msg_dialog_params_init(&params);
-	params.caption = "Message";
-	params.text = "Hello";
-
-	rc = ui_msg_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Button callback with no callbacks set */
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with unfocus callback not implemented */
-	ui_msg_dialog_set_cb(dialog, &dummy_msg_dialog_cb, NULL);
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with real callback set */
-	resp.close = false;
-	ui_msg_dialog_set_cb(dialog, &test_msg_dialog_cb, &resp);
-	ui_window_send_close(dialog->window);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_msg_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-static void test_dialog_button(ui_msg_dialog_t *dialog, void *arg,
-    unsigned bnum)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->button = true;
-	resp->bnum = bnum;
-}
-
-static void test_dialog_close(ui_msg_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-PCUT_EXPORT(msg_dialog);
Index: pace/lib/ui/test/paint.c
===================================================================
--- uspace/lib/ui/test/paint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,558 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/paint.h>
-#include <ui/resource.h>
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(paint);
-
-/** Test box characters */
-static ui_box_chars_t test_box_chars = {
-	{
-		{ "A", "B", "C" },
-		{ "D", " ", "E" },
-		{ "F", "G", "H" }
-	}
-};
-
-/** Paint bevel */
-PCUT_TEST(bevel)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-	gfx_color_t *color1;
-	gfx_color_t *color2;
-	gfx_rect_t inside;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(4, 5, 6, &color2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint bevel with NULL 'inside' output parameter */
-	rc = ui_paint_bevel(gc, &rect, color1, color2, 2, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Paint bevel with valid 'inside' output parameter */
-	rc = ui_paint_bevel(gc, &rect, color1, color2, 2, &inside);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color2);
-	gfx_color_delete(color1);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Get bevel inside */
-PCUT_TEST(get_bevel_inside)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-	gfx_rect_t inside;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	ui_paint_get_bevel_inside(gc, &rect, 2, &inside);
-	PCUT_ASSERT_INT_EQUALS(12, inside.p0.x);
-	PCUT_ASSERT_INT_EQUALS(22, inside.p0.y);
-	PCUT_ASSERT_INT_EQUALS(28, inside.p1.x);
-	PCUT_ASSERT_INT_EQUALS(38, inside.p1.y);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint inset frame */
-PCUT_TEST(inset_frame)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-	gfx_rect_t inside;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint inset frame with NULL 'inside' output parameter */
-	rc = ui_paint_inset_frame(resource, &rect, NULL);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Paint inset frame with valid 'inside' output parameter */
-	rc = ui_paint_inset_frame(resource, &rect, &inside);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Get inset frame inside */
-PCUT_TEST(get_inset_frame_inside)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-	gfx_rect_t inside;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	ui_paint_get_inset_frame_inside(resource, &rect, &inside);
-	PCUT_ASSERT_INT_EQUALS(12, inside.p0.x);
-	PCUT_ASSERT_INT_EQUALS(22, inside.p0.y);
-	PCUT_ASSERT_INT_EQUALS(28, inside.p1.x);
-	PCUT_ASSERT_INT_EQUALS(38, inside.p1.y);
-
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint filled circle */
-PCUT_TEST(filled_circle)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	/* Paint filled circle / upper-left half */
-	rc = ui_paint_filled_circle(gc, &center, 10, ui_fcircle_upleft);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Paint filled circle / lower-right half */
-	rc = ui_paint_filled_circle(gc, &center, 10, ui_fcircle_lowright);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Paint entire filled circle */
-	rc = ui_paint_filled_circle(gc, &center, 10, ui_fcircle_entire);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint up pointing triangle */
-PCUT_TEST(up_triangle)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_up_triangle(gc, &center, 5);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint down pointing triangle */
-PCUT_TEST(down_triangle)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_down_triangle(gc, &center, 5);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint left pointing triangle */
-PCUT_TEST(left_triangle)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_left_triangle(gc, &center, 5);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint right pointing triangle */
-PCUT_TEST(right_triangle)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_right_triangle(gc, &center, 5);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint diagonal cross (X) */
-PCUT_TEST(cross)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_cross(gc, &center, 5, 1, 2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint mimimize icon */
-PCUT_TEST(minicon)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_minicon(resource, &center, 8, 6);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint maximize icon */
-PCUT_TEST(maxicon)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_maxicon(resource, &center, 8, 6);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint unmaximize icon */
-PCUT_TEST(unmaxicon)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	test_gc_t tgc;
-	gfx_coord2_t center;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	center.x = 0;
-	center.y = 0;
-
-	rc = ui_paint_unmaxicon(resource, &center, 8, 8, 3, 3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint text box */
-PCUT_TEST(text_box)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint text box */
-	rc = ui_paint_text_box(resource, &rect, ui_box_single, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color);
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint custom text box */
-PCUT_TEST(text_box_custom)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint text box */
-	rc = ui_paint_text_box_custom(resource, &rect, &test_box_chars, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color);
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint text horizontal brace */
-PCUT_TEST(text_hbrace)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint text horizontal brace */
-	rc = ui_paint_text_hbrace(resource, &rect, ui_box_single,
-	    color);
-
-	gfx_color_delete(color);
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint text rectangle */
-PCUT_TEST(text_rect)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color = NULL;
-	test_gc_t tgc;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = gfx_color_new_rgb_i16(1, 2, 3, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-
-	/* Paint text box */
-	rc = ui_paint_text_rect(resource, &rect, color, "A");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color);
-	ui_resource_destroy(resource);
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_EXPORT(paint);
Index: pace/lib/ui/test/pbutton.c
===================================================================
--- uspace/lib/ui/test/pbutton.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,611 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include "../private/pbutton.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(pbutton);
-
-static void test_pbutton_clicked(ui_pbutton_t *, void *);
-static void test_pbutton_down(ui_pbutton_t *, void *);
-static void test_pbutton_up(ui_pbutton_t *, void *);
-
-static ui_pbutton_cb_t test_pbutton_cb = {
-	.clicked = test_pbutton_clicked,
-	.down = test_pbutton_down,
-	.up = test_pbutton_up
-};
-
-static ui_pbutton_cb_t dummy_pbutton_cb = {
-};
-
-typedef struct {
-	bool clicked;
-	bool down;
-	bool up;
-} test_cb_resp_t;
-
-/** Create and destroy button */
-PCUT_TEST(create_destroy)
-{
-	ui_pbutton_t *pbutton = NULL;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(pbutton);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** ui_pbutton_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_pbutton_destroy(NULL);
-}
-
-/** ui_pbutton_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_pbutton_t *pbutton;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_pbutton_ctl(pbutton);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set flags sets internal field */
-PCUT_TEST(set_flags)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_pbutton_set_flags(pbutton, ui_pbf_no_text_depress);
-	PCUT_ASSERT_INT_EQUALS(ui_pbf_no_text_depress, pbutton->flags);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Set button rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_pbutton_t *pbutton;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_pbutton_set_rect(pbutton, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, pbutton->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, pbutton->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, pbutton->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, pbutton->rect.p1.y);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Set default flag sets internal field */
-PCUT_TEST(set_default)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_pbutton_set_default(pbutton, true);
-	PCUT_ASSERT_TRUE(pbutton->isdefault);
-
-	ui_pbutton_set_default(pbutton, false);
-	PCUT_ASSERT_FALSE(pbutton->isdefault);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Get light gets internal field */
-PCUT_TEST(get_light)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pbutton->light = true;
-	PCUT_ASSERT_TRUE(ui_pbutton_get_light(pbutton));
-
-	pbutton->light = false;
-	PCUT_ASSERT_FALSE(ui_pbutton_get_light(pbutton));
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Set light sets internal field */
-PCUT_TEST(set_light)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_pbutton_set_light(pbutton, true);
-	PCUT_ASSERT_TRUE(pbutton->light);
-
-	ui_pbutton_set_light(pbutton, false);
-	PCUT_ASSERT_FALSE(pbutton->light);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Set caption sets internal field */
-PCUT_TEST(set_caption)
-{
-	ui_pbutton_t *pbutton;
-	errno_t rc;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("Hello", pbutton->caption);
-
-	rc = ui_pbutton_set_caption(pbutton, "World");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_STR_EQUALS("World", pbutton->caption);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Paint button */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_pbutton_paint(pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_pbutton_clicked() */
-PCUT_TEST(clicked)
-{
-	errno_t rc;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Clicked with no callbacks set */
-	ui_pbutton_clicked(pbutton);
-
-	/* Clicked with callback not implementing clicked */
-	ui_pbutton_set_cb(pbutton, &dummy_pbutton_cb, NULL);
-	ui_pbutton_clicked(pbutton);
-
-	/* Clicked with real callback set */
-	resp.clicked = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-	ui_pbutton_clicked(pbutton);
-	PCUT_ASSERT_TRUE(resp.clicked);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Test ui_pbutton_down() */
-PCUT_TEST(down)
-{
-	errno_t rc;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Down with no callbacks set */
-	ui_pbutton_clicked(pbutton);
-
-	/* Down with callback not implementing down */
-	ui_pbutton_set_cb(pbutton, &dummy_pbutton_cb, NULL);
-	ui_pbutton_down(pbutton);
-
-	/* Down with real callback set */
-	resp.down = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-	ui_pbutton_down(pbutton);
-	PCUT_ASSERT_TRUE(resp.down);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Test ui_pbutton_up() */
-PCUT_TEST(up)
-{
-	errno_t rc;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	rc = ui_pbutton_create(NULL, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Up with no callbacks set */
-	ui_pbutton_clicked(pbutton);
-
-	/* Up with callback not implementing up */
-	ui_pbutton_set_cb(pbutton, &dummy_pbutton_cb, NULL);
-	ui_pbutton_up(pbutton);
-
-	/* Up with real callback set */
-	resp.up = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-	ui_pbutton_up(pbutton);
-	PCUT_ASSERT_TRUE(resp.up);
-
-	ui_pbutton_destroy(pbutton);
-}
-
-/** Press and release button */
-PCUT_TEST(press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.clicked = false;
-	resp.down = false;
-	resp.up = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	ui_pbutton_press(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_TRUE(resp.down);
-	PCUT_ASSERT_FALSE(resp.up);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_release(pbutton);
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_TRUE(resp.up);
-	PCUT_ASSERT_TRUE(resp.clicked);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave and release button */
-PCUT_TEST(press_leave_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.clicked = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	ui_pbutton_press(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_leave(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_release(pbutton);
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave, enter and release button */
-PCUT_TEST(press_leave_enter_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.clicked = false;
-	ui_pbutton_set_cb(pbutton, &test_pbutton_cb, &resp);
-
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	ui_pbutton_press(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_leave(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_enter(pbutton);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_FALSE(resp.clicked);
-
-	ui_pbutton_release(pbutton);
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-	PCUT_ASSERT_TRUE(resp.clicked);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */
-PCUT_TEST(pos_event_press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(pbutton->held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_pbutton_set_rect(pbutton, &rect);
-
-	/* Press outside is not claimed and does nothing */
-	event.type = POS_PRESS;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	/* Press inside is claimed and depresses button */
-	event.type = POS_PRESS;
-	event.hpos = 10;
-	event.vpos = 20;
-	claim = ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_TRUE(pbutton->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases button */
-	event.type = POS_RELEASE;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_FALSE(pbutton->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_UPDATE to enter/leave */
-PCUT_TEST(pos_event_enter_leave)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_pbutton_t *pbutton;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_pbutton_create(resource, "Hello", &pbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_pbutton_set_rect(pbutton, &rect);
-
-	/* Moving outside does nothing */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	/* Moving inside sets inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 10;
-	event.vpos = 20;
-	ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_TRUE(pbutton->inside);
-
-	/* Moving outside clears inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_pbutton_pos_event(pbutton, &event);
-	PCUT_ASSERT_FALSE(pbutton->inside);
-
-	ui_pbutton_destroy(pbutton);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_pbutton_clicked(ui_pbutton_t *pbutton, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->clicked = true;
-}
-
-static void test_pbutton_down(ui_pbutton_t *pbutton, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->down = true;
-}
-
-static void test_pbutton_up(ui_pbutton_t *pbutton, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->up = true;
-}
-
-PCUT_EXPORT(pbutton);
Index: pace/lib/ui/test/popup.c
===================================================================
--- uspace/lib/ui/test/popup.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,352 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <gfx/render.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/popup.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/popup.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(popup);
-
-static void test_popup_close(ui_popup_t *, void *);
-static void test_popup_kbd(ui_popup_t *, void *, kbd_event_t *);
-static errno_t test_popup_paint(ui_popup_t *, void *);
-static void test_popup_pos(ui_popup_t *, void *, pos_event_t *);
-
-static ui_popup_cb_t test_popup_cb = {
-	.close = test_popup_close,
-	.kbd = test_popup_kbd,
-	.paint = test_popup_paint,
-	.pos = test_popup_pos,
-};
-
-static ui_popup_cb_t dummy_popup_cb = {
-};
-
-static errno_t test_ctl_paint(void *);
-static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
-static void test_ctl_unfocus(void *, unsigned);
-
-static ui_control_ops_t test_ctl_ops = {
-	.paint = test_ctl_paint,
-	.pos_event = test_ctl_pos_event,
-	.unfocus = test_ctl_unfocus
-};
-
-typedef struct {
-	errno_t rc;
-	bool close;
-	bool focus;
-	bool kbd;
-	kbd_event_t kbd_event;
-	bool paint;
-	bool pos;
-	pos_event_t pos_event;
-	bool unfocus;
-} test_cb_resp_t;
-
-typedef struct {
-	errno_t rc;
-	ui_evclaim_t claim;
-	bool paint;
-	bool pos;
-	pos_event_t pos_event;
-	bool unfocus;
-	unsigned unfocus_nfocus;
-} test_ctl_resp_t;
-
-/** Create and destroy popup window */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t wparams;
-	ui_window_t *window = NULL;
-	ui_popup_params_t params;
-	ui_popup_t *popup = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = "Hello";
-
-	rc = ui_window_create(ui, &wparams, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_popup_params_init(&params);
-
-	rc = ui_popup_create(ui, window, &params, &popup);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(popup);
-
-	ui_popup_destroy(popup);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_popup_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_popup_destroy(NULL);
-}
-
-/** ui_popup_add()/ui_popup_remove() ... */
-PCUT_TEST(add_remove)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t wparams;
-	ui_window_t *window = NULL;
-	ui_popup_params_t params;
-	ui_popup_t *popup = NULL;
-	ui_control_t *control = NULL;
-	test_ctl_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = "Hello";
-
-	rc = ui_window_create(ui, &wparams, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_popup_params_init(&params);
-
-	rc = ui_popup_create(ui, window, &params, &popup);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(popup);
-
-	rc = ui_control_new(&test_ctl_ops, &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Control not called since it hasn't been added yet */
-	resp.rc = ENOMEM;
-	resp.paint = false;
-	rc = ui_window_def_paint(popup->window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(resp.paint);
-
-	ui_popup_add(popup, control);
-
-	/* Now paint request should be delivered to control */
-	resp.rc = EOK;
-	resp.paint = false;
-	rc = ui_window_def_paint(popup->window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	ui_popup_remove(popup, control);
-
-	/*
-	 * After having removed the control the request should no longer
-	 * be delivered to it.
-	 */
-	resp.rc = ENOMEM;
-	resp.paint = false;
-	rc = ui_window_def_paint(popup->window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(resp.paint);
-
-	ui_popup_destroy(popup);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_popup_get_res/gc() return valid objects */
-PCUT_TEST(get_res_gc)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t wparams;
-	ui_window_t *window = NULL;
-	ui_popup_params_t params;
-	ui_popup_t *popup = NULL;
-	ui_resource_t *res;
-	gfx_context_t *gc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = "Hello";
-
-	rc = ui_window_create(ui, &wparams, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_popup_params_init(&params);
-
-	rc = ui_popup_create(ui, window, &params, &popup);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(popup);
-
-	res = ui_popup_get_res(popup);
-	PCUT_ASSERT_NOT_NULL(res);
-
-	gc = ui_popup_get_gc(popup);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	ui_popup_destroy(popup);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test position event callback set via ui_popup_set_cb() */
-PCUT_TEST(send_pos)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t wparams;
-	ui_window_t *window = NULL;
-	ui_popup_params_t params;
-	ui_popup_t *popup = NULL;
-	pos_event_t pos_event;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&wparams);
-	wparams.caption = "Hello";
-
-	rc = ui_window_create(ui, &wparams, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_popup_params_init(&params);
-
-	rc = ui_popup_create(ui, window, &params, &popup);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(popup);
-
-	pos_event.pos_id = 1;
-	pos_event.type = POS_PRESS;
-	pos_event.btn_num = 2;
-	pos_event.hpos = 3;
-	pos_event.vpos = 4;
-
-	/* Pos callback with no callbacks set */
-	ui_window_send_pos(popup->window, &pos_event);
-
-	/* Pos callback with pos callback not implemented */
-	ui_popup_set_cb(popup, &dummy_popup_cb, NULL);
-	ui_window_send_pos(popup->window, &pos_event);
-
-	/* Pos callback with real callback set */
-	resp.pos = false;
-	ui_popup_set_cb(popup, &test_popup_cb, &resp);
-	ui_window_send_pos(popup->window, &pos_event);
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_INT_EQUALS(pos_event.pos_id, resp.pos_event.pos_id);
-	PCUT_ASSERT_EQUALS(pos_event.type, resp.pos_event.type);
-	PCUT_ASSERT_INT_EQUALS(pos_event.btn_num, resp.pos_event.btn_num);
-	PCUT_ASSERT_INT_EQUALS(pos_event.hpos, resp.pos_event.hpos);
-	PCUT_ASSERT_INT_EQUALS(pos_event.vpos, resp.pos_event.vpos);
-
-	ui_popup_destroy(popup);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_popup_close(ui_popup_t *popup, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-static void test_popup_kbd(ui_popup_t *popup, void *arg,
-    kbd_event_t *event)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->kbd = true;
-	resp->kbd_event = *event;
-}
-
-static errno_t test_popup_paint(ui_popup_t *popup, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static void test_popup_pos(ui_popup_t *popup, void *arg,
-    pos_event_t *event)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->pos = true;
-	resp->pos_event = *event;
-}
-
-static errno_t test_ctl_paint(void *arg)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->pos = true;
-	resp->pos_event = *event;
-
-	return resp->claim;
-}
-
-static void test_ctl_unfocus(void *arg, unsigned nfocus)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->unfocus = true;
-	resp->unfocus_nfocus = nfocus;
-}
-
-PCUT_EXPORT(popup);
Index: pace/lib/ui/test/promptdialog.c
===================================================================
--- uspace/lib/ui/test/promptdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,185 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/promptdialog.h>
-#include "../private/promptdialog.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(prompt_dialog);
-
-static void test_dialog_bok(ui_prompt_dialog_t *, void *, const char *);
-static void test_dialog_bcancel(ui_prompt_dialog_t *, void *);
-static void test_dialog_close(ui_prompt_dialog_t *, void *);
-
-static ui_prompt_dialog_cb_t test_prompt_dialog_cb = {
-	.bok = test_dialog_bok,
-	.bcancel = test_dialog_bcancel,
-	.close = test_dialog_close
-};
-
-static ui_prompt_dialog_cb_t dummy_prompt_dialog_cb = {
-};
-
-typedef struct {
-	bool bok;
-	const char *fname;
-	bool bcancel;
-	bool close;
-} test_cb_resp_t;
-
-/** Create and destroy prompt dialog */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_prompt_dialog_params_t params;
-	ui_prompt_dialog_t *dialog = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_prompt_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_prompt_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	ui_prompt_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_prompt_dialog_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_prompt_dialog_destroy(NULL);
-}
-
-/** Button click invokes callback set via ui_prompt_dialog_set_cb() */
-PCUT_TEST(button_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_prompt_dialog_params_t params;
-	ui_prompt_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_prompt_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_prompt_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* OK button callback with no callbacks set */
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with callback not implemented */
-	ui_prompt_dialog_set_cb(dialog, &dummy_prompt_dialog_cb, NULL);
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with real callback set */
-	resp.bok = false;
-	ui_prompt_dialog_set_cb(dialog, &test_prompt_dialog_cb, &resp);
-	ui_pbutton_clicked(dialog->bok);
-	PCUT_ASSERT_TRUE(resp.bok);
-
-	ui_prompt_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Sending window close request invokes callback set via
- * ui_prompt_dialog_set_cb()
- */
-PCUT_TEST(close_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_prompt_dialog_params_t params;
-	ui_prompt_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_prompt_dialog_params_init(&params);
-	params.caption = "Open";
-
-	rc = ui_prompt_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Button callback with no callbacks set */
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with unfocus callback not implemented */
-	ui_prompt_dialog_set_cb(dialog, &dummy_prompt_dialog_cb, NULL);
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with real callback set */
-	resp.close = false;
-	ui_prompt_dialog_set_cb(dialog, &test_prompt_dialog_cb, &resp);
-	ui_window_send_close(dialog->window);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_prompt_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-static void test_dialog_bok(ui_prompt_dialog_t *dialog, void *arg,
-    const char *fname)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bok = true;
-}
-
-static void test_dialog_bcancel(ui_prompt_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bcancel = true;
-}
-
-static void test_dialog_close(ui_prompt_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-PCUT_EXPORT(prompt_dialog);
Index: pace/lib/ui/test/rbutton.c
===================================================================
--- uspace/lib/ui/test/rbutton.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,565 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/rbutton.h>
-#include <ui/resource.h>
-#include "../private/rbutton.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(rbutton);
-
-static void test_rbutton_select(ui_rbutton_group_t *, void *, void *);
-
-static ui_rbutton_group_cb_t test_rbutton_group_cb = {
-	.selected = test_rbutton_select
-};
-
-static ui_rbutton_group_cb_t dummy_rbutton_group_cb = {
-};
-
-typedef struct {
-	bool selected;
-} test_cb_resp_t;
-
-/** Create and destroy radio button */
-PCUT_TEST(create_destroy)
-{
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton = NULL;
-	errno_t rc;
-
-	rc = ui_rbutton_group_create(NULL, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(rbutton);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-}
-
-/** ui_rbutton_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_rbutton_destroy(NULL);
-}
-
-/** ui_rbutton_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_rbutton_group_create(NULL, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_rbutton_ctl(rbutton);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-	ui_rbutton_group_destroy(group);
-}
-
-/** Set radio button rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_rbutton_group_create(NULL, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_rbutton_set_rect(rbutton, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, rbutton->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, rbutton->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, rbutton->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, rbutton->rect.p1.y);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-}
-
-/** Paint radio button in graphics mode */
-PCUT_TEST(paint_gfx)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_rbutton_group_t *group = NULL;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_t *rbutton;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_paint_gfx(rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint radio button in text mode */
-PCUT_TEST(paint_text)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_rbutton_group_t *group = NULL;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_t *rbutton;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_paint_text(rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_rbutton_selected() */
-PCUT_TEST(selected)
-{
-	errno_t rc;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton;
-	test_cb_resp_t resp;
-
-	rc = ui_rbutton_group_create(NULL, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Selected with no callbacks set */
-	ui_rbutton_selected(rbutton);
-
-	/* Selected with callback not implementing selected */
-	ui_rbutton_group_set_cb(group, &dummy_rbutton_group_cb, NULL);
-	ui_rbutton_selected(rbutton);
-
-	/* Selected with real callback set */
-	resp.selected = false;
-	ui_rbutton_group_set_cb(group, &test_rbutton_group_cb, &resp);
-	ui_rbutton_selected(rbutton);
-	PCUT_ASSERT_TRUE(resp.selected);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-}
-
-/** Press and release radio button */
-PCUT_TEST(press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton1;
-	ui_rbutton_t *rbutton2;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NULL(group->selected);
-
-	rc = ui_rbutton_create(group, "One", NULL, &rbutton1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	rc = ui_rbutton_create(group, "Two", NULL, &rbutton2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	resp.selected = false;
-	ui_rbutton_group_set_cb(group, &test_rbutton_group_cb, &resp);
-
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-
-	ui_rbutton_press(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_release(rbutton2);
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_TRUE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton2);
-
-	ui_rbutton_destroy(rbutton1);
-	ui_rbutton_destroy(rbutton2);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave and release radio button */
-PCUT_TEST(press_leave_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton1;
-	ui_rbutton_t *rbutton2;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NULL(group->selected);
-
-	rc = ui_rbutton_create(group, "One", NULL, &rbutton1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	rc = ui_rbutton_create(group, "Two", NULL, &rbutton2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	resp.selected = false;
-	ui_rbutton_group_set_cb(group, &test_rbutton_group_cb, &resp);
-
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-
-	ui_rbutton_press(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_leave(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_release(rbutton2);
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_destroy(rbutton1);
-	ui_rbutton_destroy(rbutton2);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, leave, enter and release radio button */
-PCUT_TEST(press_leave_enter_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton1;
-	ui_rbutton_t *rbutton2;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NULL(group->selected);
-
-	rc = ui_rbutton_create(group, "One", NULL, &rbutton1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	rc = ui_rbutton_create(group, "Two", NULL, &rbutton2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	resp.selected = false;
-	ui_rbutton_group_set_cb(group, &test_rbutton_group_cb, &resp);
-
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-
-	ui_rbutton_press(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_leave(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_FALSE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_enter(rbutton2);
-	PCUT_ASSERT_TRUE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_FALSE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton1);
-
-	ui_rbutton_release(rbutton2);
-	PCUT_ASSERT_FALSE(rbutton2->held);
-	PCUT_ASSERT_TRUE(rbutton2->inside);
-	PCUT_ASSERT_TRUE(resp.selected);
-	PCUT_ASSERT_EQUALS(group->selected, rbutton2);
-
-	ui_rbutton_destroy(rbutton1);
-	ui_rbutton_destroy(rbutton2);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */
-PCUT_TEST(pos_event_press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(rbutton->held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_rbutton_set_rect(rbutton, &rect);
-
-	/* Press outside is not claimed and does nothing */
-	event.type = POS_PRESS;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_FALSE(rbutton->held);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	/* Press inside is claimed and depresses radio button */
-	event.type = POS_PRESS;
-	event.hpos = 10;
-	event.vpos = 20;
-	claim = ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_TRUE(rbutton->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases radio button */
-	event.type = POS_RELEASE;
-	event.hpos = 9;
-	event.vpos = 20;
-	claim = ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_FALSE(rbutton->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_UPDATE to enter/leave */
-PCUT_TEST(pos_event_enter_leave)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_rbutton_group_t *group = NULL;
-	ui_rbutton_t *rbutton;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_rbutton_group_create(resource, &group);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_rbutton_create(group, "Hello", NULL, &rbutton);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(rbutton->inside);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_rbutton_set_rect(rbutton, &rect);
-
-	/* Moving outside does nothing */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_FALSE(rbutton->inside);
-
-	/* Moving inside sets inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 10;
-	event.vpos = 20;
-	ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_TRUE(rbutton->inside);
-
-	/* Moving outside clears inside flag */
-	event.type = POS_UPDATE;
-	event.hpos = 9;
-	event.vpos = 20;
-	ui_rbutton_pos_event(rbutton, &event);
-	PCUT_ASSERT_FALSE(rbutton->inside);
-
-	ui_rbutton_destroy(rbutton);
-	ui_rbutton_group_destroy(group);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_rbutton_select(ui_rbutton_group_t *group, void *arg,
-    void *barg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->selected = true;
-}
-
-PCUT_EXPORT(rbutton);
Index: pace/lib/ui/test/resource.c
===================================================================
--- uspace/lib/ui/test/resource.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/resource.h>
-#include "../private/resource.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(resource);
-
-static void test_expose(void *);
-
-typedef struct {
-	bool expose;
-} test_resp_t;
-
-/** Create and destroy UI resource */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	PCUT_ASSERT_NOT_NULL(resource->tface);
-	PCUT_ASSERT_NOT_NULL(resource->font);
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_resource_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_resource_destroy(NULL);
-}
-
-/** ui_resource_set_expose_cb() / ui_resource_expose() */
-PCUT_TEST(set_expose_cb_expose)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	test_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	ui_resource_set_expose_cb(resource, test_expose, &resp);
-
-	resp.expose = false;
-	ui_resource_expose(resource);
-	PCUT_ASSERT_TRUE(resp.expose);
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_resource_get_font() returns the font */
-PCUT_TEST(get_font)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	gfx_font_t *font;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	font = ui_resource_get_font(resource);
-	PCUT_ASSERT_EQUALS(resource->font, font);
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_resource_is_textmode() returns the textmode flag */
-PCUT_TEST(is_textmode)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	/* To make sure let's test both true and false case */
-	resource->textmode = true;
-	PCUT_ASSERT_TRUE(ui_resource_is_textmode(resource));
-	resource->textmode = false;
-	PCUT_ASSERT_FALSE(ui_resource_is_textmode(resource));
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_resource_get_wnd_face_color() returns window face color */
-PCUT_TEST(get_wnd_face_color)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	color = ui_resource_get_wnd_face_color(resource);
-	PCUT_ASSERT_EQUALS(resource->wnd_face_color, color);
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_resource_get_wnd_text_color() returns window text color */
-PCUT_TEST(get_wnd_text_color)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	gfx_color_t *color;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	color = ui_resource_get_wnd_text_color(resource);
-	PCUT_ASSERT_EQUALS(resource->wnd_text_color, color);
-
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_expose(void *arg)
-{
-	test_resp_t *resp = (test_resp_t *) arg;
-
-	resp->expose = true;
-}
-
-PCUT_EXPORT(resource);
Index: pace/lib/ui/test/scrollbar.c
===================================================================
--- uspace/lib/ui/test/scrollbar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1277 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/scrollbar.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/pbutton.h"
-#include "../private/scrollbar.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(scrollbar);
-
-static void test_scrollbar_up(ui_scrollbar_t *, void *);
-static void test_scrollbar_down(ui_scrollbar_t *, void *);
-static void test_scrollbar_page_up(ui_scrollbar_t *, void *);
-static void test_scrollbar_page_down(ui_scrollbar_t *, void *);
-static void test_scrollbar_moved(ui_scrollbar_t *, void *, gfx_coord_t);
-
-static ui_scrollbar_cb_t test_scrollbar_cb = {
-	.up = test_scrollbar_up,
-	.down = test_scrollbar_down,
-	.page_up = test_scrollbar_page_up,
-	.page_down = test_scrollbar_page_down,
-	.moved = test_scrollbar_moved
-};
-
-static ui_scrollbar_cb_t dummy_scrollbar_cb = {
-};
-
-typedef struct {
-	bool up;
-	bool down;
-	bool page_up;
-	bool page_down;
-	bool moved;
-	gfx_coord_t pos;
-} test_cb_resp_t;
-
-/** Create and destroy scrollbar */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(scrollbar);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_scrollbar_destroy(NULL);
-}
-
-/** ui_scrollbar_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar = NULL;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(scrollbar);
-
-	control = ui_scrollbar_ctl(scrollbar);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Set scrollbar rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar = NULL;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(scrollbar);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_scrollbar_set_rect(scrollbar, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, scrollbar->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, scrollbar->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, scrollbar->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, scrollbar->rect.p1.y);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint scrollbar in graphics mode */
-PCUT_TEST(paint_gfx)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_scrollbar_paint_gfx(scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint scrollbar in text mode */
-PCUT_TEST(paint_text_horiz)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 1;
-	rect.p1.x = 10;
-	rect.p1.y = 2;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	rc = ui_scrollbar_paint_text(scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_get_geom() returns scrollbar geometry */
-PCUT_TEST(get_geom)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_scrollbar_geom_t geom;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	ui_scrollbar_get_geom(scrollbar, &geom);
-	PCUT_ASSERT_INT_EQUALS(11, geom.up_btn_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, geom.up_btn_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(99, geom.down_btn_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(29, geom.down_btn_rect.p1.y);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_trough_length() gives correct scrollbar trough length */
-PCUT_TEST(trough_length)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_coord_t length;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	length = ui_scrollbar_trough_length(scrollbar);
-
-	/* Total length minus buttons */
-	PCUT_ASSERT_INT_EQUALS(110 - 10 - 2 * 21, length);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_move_length() gives correct scrollbar move length */
-PCUT_TEST(move_length)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_coord_t length;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	length = ui_scrollbar_move_length(scrollbar);
-
-	/* Total length minus buttons minus default thumb length */
-	PCUT_ASSERT_INT_EQUALS(110 - 10 - 2 * 21 - 21, length);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_get_pos() returns scrollbar position */
-PCUT_TEST(get_pos)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_coord_t pos;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	scrollbar->pos = 42;
-	pos = ui_scrollbar_get_pos(scrollbar);
-	PCUT_ASSERT_INT_EQUALS(42, pos);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_set_thumb_length() sets thumb length */
-PCUT_TEST(set_thumb_length)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	ui_scrollbar_set_thumb_length(scrollbar, 42);
-	PCUT_ASSERT_INT_EQUALS(42, scrollbar->thumb_len);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_set_pos() sets thumb position */
-PCUT_TEST(set_pos)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	gfx_coord_t pos;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	ui_scrollbar_set_pos(scrollbar, -1);
-	pos = ui_scrollbar_get_pos(scrollbar);
-	/* The value is clipped to the minimum possible position (0) */
-	PCUT_ASSERT_INT_EQUALS(0, pos);
-
-	ui_scrollbar_set_pos(scrollbar, 12);
-	pos = ui_scrollbar_get_pos(scrollbar);
-	/* The value is set to the requested value */
-	PCUT_ASSERT_INT_EQUALS(12, pos);
-
-	ui_scrollbar_set_pos(scrollbar, 42);
-	pos = ui_scrollbar_get_pos(scrollbar);
-	/* The value is clipped to the maximum possible position (37) */
-	PCUT_ASSERT_INT_EQUALS(37, pos);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press and release scrollbar thumb */
-PCUT_TEST(thumb_press_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	resp.moved = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_scrollbar_thumb_press(scrollbar, &pos);
-	PCUT_ASSERT_TRUE(scrollbar->thumb_held);
-	PCUT_ASSERT_FALSE(resp.moved);
-
-	pos.x = 21;
-	pos.y = 32;
-
-	ui_scrollbar_release(scrollbar, &pos);
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(10, scrollbar->pos);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press, update and release scrollbar */
-PCUT_TEST(thumb_press_update_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	resp.moved = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_scrollbar_thumb_press(scrollbar, &pos);
-	PCUT_ASSERT_TRUE(scrollbar->thumb_held);
-	PCUT_ASSERT_FALSE(resp.moved);
-
-	pos.x = 21;
-	pos.y = 32;
-
-	ui_scrollbar_update(scrollbar, &pos);
-	PCUT_ASSERT_TRUE(scrollbar->thumb_held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(10, scrollbar->pos);
-
-	pos.x = 31;
-	pos.y = 42;
-
-	ui_scrollbar_release(scrollbar, &pos);
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(20, scrollbar->pos);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press and release upper trough */
-PCUT_TEST(upper_trough_press_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	resp.page_up = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-
-	PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
-
-	ui_scrollbar_upper_trough_press(scrollbar);
-	PCUT_ASSERT_TRUE(scrollbar->upper_trough_held);
-	PCUT_ASSERT_TRUE(resp.page_up);
-
-	/* Position does not matter here */
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_scrollbar_release(scrollbar, &pos);
-	PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press and release lower trough */
-PCUT_TEST(lower_trough_press_release)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	resp.page_down = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-
-	PCUT_ASSERT_FALSE(scrollbar->lower_trough_held);
-
-	ui_scrollbar_lower_trough_press(scrollbar);
-	PCUT_ASSERT_TRUE(scrollbar->lower_trough_held);
-	PCUT_ASSERT_TRUE(resp.page_down);
-
-	/* Position does not matter here */
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_scrollbar_release(scrollbar, &pos);
-	PCUT_ASSERT_FALSE(scrollbar->lower_trough_held);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Updating state of troughs when cursor or thumb moves */
-PCUT_TEST(troughs_update)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_scrollbar_t *scrollbar;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	PCUT_ASSERT_FALSE(scrollbar->lower_trough_inside);
-
-	pos.x = 60;
-	pos.y = 22;
-
-	ui_scrollbar_troughs_update(scrollbar, &pos);
-	PCUT_ASSERT_TRUE(scrollbar->lower_trough_inside);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_up() delivers up event */
-PCUT_TEST(up)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Up with no callbacks set */
-	ui_scrollbar_up(scrollbar);
-
-	/* Up with callback not implementing up */
-	ui_scrollbar_set_cb(scrollbar, &dummy_scrollbar_cb, NULL);
-	ui_scrollbar_up(scrollbar);
-
-	/* Up with real callback set */
-	resp.up = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-	ui_scrollbar_up(scrollbar);
-	PCUT_ASSERT_TRUE(resp.up);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_down() delivers down event */
-PCUT_TEST(down)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Down with no callbacks set */
-	ui_scrollbar_down(scrollbar);
-
-	/* Down with callback not implementing down */
-	ui_scrollbar_set_cb(scrollbar, &dummy_scrollbar_cb, NULL);
-	ui_scrollbar_down(scrollbar);
-
-	/* Down with real callback set */
-	resp.down = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-	ui_scrollbar_down(scrollbar);
-	PCUT_ASSERT_TRUE(resp.down);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_page_up() delivers page up event */
-PCUT_TEST(page_up)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Page up with no callbacks set */
-	ui_scrollbar_page_up(scrollbar);
-
-	/* Pge up with callback not implementing page up */
-	ui_scrollbar_set_cb(scrollbar, &dummy_scrollbar_cb, NULL);
-	ui_scrollbar_page_up(scrollbar);
-
-	/* Page up with real callback set */
-	resp.page_up = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-	ui_scrollbar_page_up(scrollbar);
-	PCUT_ASSERT_TRUE(resp.page_up);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_page_down() delivers page down event */
-PCUT_TEST(page_down)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Page down with no callbacks set */
-	ui_scrollbar_page_down(scrollbar);
-
-	/* Page down with callback not implementing page down */
-	ui_scrollbar_set_cb(scrollbar, &dummy_scrollbar_cb, NULL);
-	ui_scrollbar_page_down(scrollbar);
-
-	/* Page down with real callback set */
-	resp.page_down = false;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-	ui_scrollbar_page_down(scrollbar);
-	PCUT_ASSERT_TRUE(resp.page_down);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_moved() delivers moved event */
-PCUT_TEST(moved)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Moved with no callbacks set */
-	ui_scrollbar_moved(scrollbar, 42);
-
-	/* Moved with callback not implementing moved */
-	ui_scrollbar_set_cb(scrollbar, &dummy_scrollbar_cb, NULL);
-	ui_scrollbar_moved(scrollbar, 42);
-
-	/* Moved with real callback set */
-	resp.moved = false;
-	resp.pos = 0;
-	ui_scrollbar_set_cb(scrollbar, &test_scrollbar_cb, &resp);
-	ui_scrollbar_moved(scrollbar, 42);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(42, resp.pos);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_pos_event() detects thumb press/release */
-PCUT_TEST(pos_event_press_release_thumb)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 20;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	/* Press outside is not claimed and does nothing */
-	event.type = POS_PRESS;
-	event.hpos = 1;
-	event.vpos = 2;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	/* Press inside thumb is claimed and depresses it */
-	event.type = POS_PRESS;
-	event.hpos = 50;
-	event.vpos = 20;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_TRUE(scrollbar->thumb_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases thumb */
-	event.type = POS_RELEASE;
-	event.hpos = 41;
-	event.vpos = 32;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_pos_event() detects up button press/release */
-PCUT_TEST(pos_event_press_release_up_btn)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 20;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	/* Press inside up button is claimed and depresses it */
-	event.type = POS_PRESS;
-	event.hpos = 30;
-	event.vpos = 20;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_TRUE(scrollbar->up_btn->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_pos_event() detects upper trough press/release */
-PCUT_TEST(pos_event_press_release_upper_trough)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
-
-	rect.p0.x = 20;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	/* Need to move thumb so that upper trough can be accessed */
-	ui_scrollbar_set_pos(scrollbar, 42);
-
-	/* Press inside upper trough is claimed and depresses it */
-	event.type = POS_PRESS;
-	event.hpos = 50;
-	event.vpos = 20;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_TRUE(scrollbar->upper_trough_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases upper trough */
-	event.type = POS_RELEASE;
-	event.hpos = 41;
-	event.vpos = 32;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_pos_event() detects lower trough press/release */
-PCUT_TEST(pos_event_press_release_lower_trough)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->upper_trough_held);
-
-	rect.p0.x = 20;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	/* Press inside lower trough is claimed and depresses it */
-	event.type = POS_PRESS;
-	event.hpos = 70;
-	event.vpos = 20;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_TRUE(scrollbar->lower_trough_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases upper trough */
-	event.type = POS_RELEASE;
-	event.hpos = 41;
-	event.vpos = 32;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_FALSE(scrollbar->lower_trough_held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_scrollbar_pos_event() detects down button press/release */
-PCUT_TEST(pos_event_press_relese_down_btn)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_scrollbar_t *scrollbar;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_scrollbar_create(ui, window, ui_sbd_horiz, &scrollbar);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(scrollbar->thumb_held);
-
-	rect.p0.x = 20;
-	rect.p0.y = 10;
-	rect.p1.x = 100;
-	rect.p1.y = 30;
-	ui_scrollbar_set_rect(scrollbar, &rect);
-
-	/* Press inside down button is claimed and depresses it */
-	event.type = POS_PRESS;
-	event.hpos = 90;
-	event.vpos = 20;
-	claim = ui_scrollbar_pos_event(scrollbar, &event);
-	PCUT_ASSERT_TRUE(scrollbar->down_btn->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_scrollbar_destroy(scrollbar);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_scrollbar_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->up = true;
-}
-
-static void test_scrollbar_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->down = true;
-}
-
-static void test_scrollbar_page_up(ui_scrollbar_t *scrollbar, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->page_up = true;
-}
-
-static void test_scrollbar_page_down(ui_scrollbar_t *scrollbar, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->page_down = true;
-}
-
-static void test_scrollbar_moved(ui_scrollbar_t *scrollbar, void *arg, gfx_coord_t pos)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->moved = true;
-	resp->pos = pos;
-}
-
-PCUT_EXPORT(scrollbar);
Index: pace/lib/ui/test/selectdialog.c
===================================================================
--- uspace/lib/ui/test/selectdialog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,372 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/list.h>
-#include <ui/pbutton.h>
-#include <ui/ui.h>
-#include <ui/selectdialog.h>
-#include "../private/list.h"
-#include "../private/selectdialog.h"
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(select_dialog);
-
-static void test_dialog_bok(ui_select_dialog_t *, void *, void *);
-static void test_dialog_bcancel(ui_select_dialog_t *, void *);
-static void test_dialog_close(ui_select_dialog_t *, void *);
-
-static ui_select_dialog_cb_t test_select_dialog_cb = {
-	.bok = test_dialog_bok,
-	.bcancel = test_dialog_bcancel,
-	.close = test_dialog_close
-};
-
-static ui_select_dialog_cb_t dummy_select_dialog_cb = {
-};
-
-typedef struct {
-	bool bok;
-	const char *fname;
-	bool bcancel;
-	bool close;
-} test_cb_resp_t;
-
-/** Create and destroy select dialog */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_select_dialog_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_select_dialog_destroy(NULL);
-}
-
-/** Clicking OK invokes callback set via ui_select_dialog_set_cb() */
-PCUT_TEST(bok_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* OK button callback with no callbacks set */
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with callback not implemented */
-	ui_select_dialog_set_cb(dialog, &dummy_select_dialog_cb, NULL);
-	ui_pbutton_clicked(dialog->bok);
-
-	/* OK button callback with real callback set */
-	resp.bok = false;
-	ui_select_dialog_set_cb(dialog, &test_select_dialog_cb, &resp);
-	ui_pbutton_clicked(dialog->bok);
-	PCUT_ASSERT_TRUE(resp.bok);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Clicking Cancel invokes callback set via ui_select_dialog_set_cb() */
-PCUT_TEST(bcancel_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Cancel button callback with no callbacks set */
-	ui_pbutton_clicked(dialog->bcancel);
-
-	/* Cancel button callback with callback not implemented */
-	ui_select_dialog_set_cb(dialog, &dummy_select_dialog_cb, NULL);
-	ui_pbutton_clicked(dialog->bcancel);
-
-	/* OK button callback with real callback set */
-	resp.bcancel = false;
-	ui_select_dialog_set_cb(dialog, &test_select_dialog_cb, &resp);
-	ui_pbutton_clicked(dialog->bcancel);
-	PCUT_ASSERT_TRUE(resp.bcancel);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Selecting a list entry invokes bok callback set via ui_select_dialog_set_cb() */
-PCUT_TEST(lselect_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_list_entry_t *entry;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	ui_list_entry_attr_t attr;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Need an entry to select */
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Entry";
-	rc = ui_select_dialog_append(dialog, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	entry = ui_list_first(dialog->list);
-
-	/* Select entry with no callbacks set */
-	ui_list_selected(entry);
-
-	/* Select entry with callback not implemented */
-	ui_select_dialog_set_cb(dialog, &dummy_select_dialog_cb, NULL);
-	ui_list_selected(entry);
-
-	/* Select entry with real callback set */
-	resp.bok = false;
-	ui_select_dialog_set_cb(dialog, &test_select_dialog_cb, &resp);
-	ui_list_selected(entry);
-	PCUT_ASSERT_TRUE(resp.bok);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** Sending window close request invokes callback set via
- * ui_select_dialog_set_cb()
- */
-PCUT_TEST(close_cb)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	/* Button callback with no callbacks set */
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with unfocus callback not implemented */
-	ui_select_dialog_set_cb(dialog, &dummy_select_dialog_cb, NULL);
-	ui_window_send_close(dialog->window);
-
-	/* Button callback with real callback set */
-	resp.close = false;
-	ui_select_dialog_set_cb(dialog, &test_select_dialog_cb, &resp);
-	ui_window_send_close(dialog->window);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_select_dialog_append() appends entries TBD */
-PCUT_TEST(append)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	ui_list_entry_attr_t attr;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	PCUT_ASSERT_INT_EQUALS(0, dialog->list->entries_cnt);
-
-	/* Add one entry */
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Entry";
-	rc = ui_select_dialog_append(dialog, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, dialog->list->entries_cnt);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_select_dialog_paint() succeeds */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	rc = ui_select_dialog_paint(dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-/** ui_select_dialog_list() returns the UI list */
-PCUT_TEST(list)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_select_dialog_params_t params;
-	ui_select_dialog_t *dialog = NULL;
-	ui_list_t *list;
-	ui_list_entry_attr_t attr;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_select_dialog_params_init(&params);
-	params.caption = "Select one";
-	params.prompt = "Please select";
-
-	rc = ui_select_dialog_create(ui, &params, &dialog);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(dialog);
-
-	list = ui_select_dialog_list(dialog);
-	PCUT_ASSERT_NOT_NULL(list);
-
-	PCUT_ASSERT_INT_EQUALS(0, ui_list_entries_cnt(list));
-
-	/* Add one entry */
-	ui_list_entry_attr_init(&attr);
-	attr.caption = "Entry";
-	rc = ui_select_dialog_append(dialog, &attr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(1, ui_list_entries_cnt(list));
-
-	ui_select_dialog_destroy(dialog);
-	ui_destroy(ui);
-}
-
-static void test_dialog_bok(ui_select_dialog_t *dialog, void *arg,
-    void *earg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bok = true;
-}
-
-static void test_dialog_bcancel(ui_select_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->bcancel = true;
-}
-
-static void test_dialog_close(ui_select_dialog_t *dialog, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-PCUT_EXPORT(select_dialog);
Index: pace/lib/ui/test/slider.c
===================================================================
--- uspace/lib/ui/test/slider.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,435 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/slider.h>
-#include <ui/resource.h>
-#include "../private/slider.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(slider);
-
-static void test_slider_moved(ui_slider_t *, void *, gfx_coord_t);
-
-static ui_slider_cb_t test_slider_cb = {
-	.moved = test_slider_moved
-};
-
-static ui_slider_cb_t dummy_slider_cb = {
-};
-
-typedef struct {
-	bool moved;
-	gfx_coord_t pos;
-} test_cb_resp_t;
-
-/** Create and destroy slider */
-PCUT_TEST(create_destroy)
-{
-	ui_slider_t *slider = NULL;
-	errno_t rc;
-
-	rc = ui_slider_create(NULL, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(slider);
-
-	ui_slider_destroy(slider);
-}
-
-/** ui_slider_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_slider_destroy(NULL);
-}
-
-/** ui_slider_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_slider_t *slider;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_slider_create(NULL, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_slider_ctl(slider);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set slider rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	ui_slider_t *slider;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_slider_create(NULL, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_slider_set_rect(slider, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, slider->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, slider->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, slider->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, slider->rect.p1.y);
-
-	ui_slider_destroy(slider);
-}
-
-/** Paint slider in graphics mode */
-PCUT_TEST(paint_gfx)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_slider_t *slider;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_slider_paint_gfx(slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint slider in text mode */
-PCUT_TEST(paint_text)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_slider_t *slider;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_slider_paint_text(slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_slider_moved() */
-PCUT_TEST(moved)
-{
-	errno_t rc;
-	ui_slider_t *slider;
-	test_cb_resp_t resp;
-
-	rc = ui_slider_create(NULL, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Moved with no callbacks set */
-	ui_slider_moved(slider, 42);
-
-	/* Moved with callback not implementing moved */
-	ui_slider_set_cb(slider, &dummy_slider_cb, NULL);
-	ui_slider_moved(slider, 42);
-
-	/* Moved with real callback set */
-	resp.moved = false;
-	resp.pos = 0;
-	ui_slider_set_cb(slider, &test_slider_cb, &resp);
-	ui_slider_moved(slider, 42);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(42, resp.pos);
-
-	ui_slider_destroy(slider);
-}
-
-/** Press and release slider */
-PCUT_TEST(press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_slider_t *slider;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_slider_set_rect(slider, &rect);
-
-	resp.moved = false;
-	ui_slider_set_cb(slider, &test_slider_cb, &resp);
-
-	PCUT_ASSERT_FALSE(slider->held);
-
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_slider_press(slider, &pos);
-	PCUT_ASSERT_TRUE(slider->held);
-	PCUT_ASSERT_FALSE(resp.moved);
-
-	pos.x = 21;
-	pos.y = 32;
-
-	ui_slider_release(slider, &pos);
-	PCUT_ASSERT_FALSE(slider->held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(10, slider->pos);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Press, update and release slider */
-PCUT_TEST(press_uodate_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	gfx_coord2_t pos;
-	gfx_rect_t rect;
-	ui_slider_t *slider;
-	test_cb_resp_t resp;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_slider_set_rect(slider, &rect);
-
-	resp.moved = false;
-	ui_slider_set_cb(slider, &test_slider_cb, &resp);
-
-	PCUT_ASSERT_FALSE(slider->held);
-
-	pos.x = 11;
-	pos.y = 22;
-
-	ui_slider_press(slider, &pos);
-	PCUT_ASSERT_TRUE(slider->held);
-	PCUT_ASSERT_FALSE(resp.moved);
-
-	pos.x = 21;
-	pos.y = 32;
-
-	ui_slider_update(slider, &pos);
-	PCUT_ASSERT_TRUE(slider->held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(10, slider->pos);
-
-	pos.x = 31;
-	pos.y = 42;
-
-	ui_slider_release(slider, &pos);
-	PCUT_ASSERT_FALSE(slider->held);
-	PCUT_ASSERT_TRUE(resp.moved);
-	PCUT_ASSERT_INT_EQUALS(20, slider->pos);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_pos_event() correctly translates POS_PRESS/POS_RELEASE */
-PCUT_TEST(pos_event_press_release)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_slider_t *slider;
-	ui_evclaim_t claim;
-	pos_event_t event;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(slider->held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	ui_slider_set_rect(slider, &rect);
-
-	/* Press outside is not claimed and does nothing */
-	event.type = POS_PRESS;
-	event.hpos = 1;
-	event.vpos = 2;
-	claim = ui_slider_pos_event(slider, &event);
-	PCUT_ASSERT_FALSE(slider->held);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claim);
-
-	/* Press inside is claimed and depresses slider */
-	event.type = POS_PRESS;
-	event.hpos = 11;
-	event.vpos = 22;
-	claim = ui_slider_pos_event(slider, &event);
-	PCUT_ASSERT_TRUE(slider->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	/* Release outside (or anywhere) is claimed and relases slider */
-	event.type = POS_RELEASE;
-	event.hpos = 41;
-	event.vpos = 32;
-	claim = ui_slider_pos_event(slider, &event);
-	PCUT_ASSERT_FALSE(slider->held);
-	PCUT_ASSERT_EQUALS(ui_claimed, claim);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_slider_length() correctly determines slider length */
-PCUT_TEST(length)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_slider_t *slider;
-	gfx_coord_t length;
-	gfx_rect_t rect;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_slider_create(resource, &slider);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(slider->held);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 110;
-	rect.p1.y = 120;
-	ui_slider_set_rect(slider, &rect);
-
-	length = ui_slider_length(slider);
-	PCUT_ASSERT_INT_EQUALS(110 - 10 - 15, length);
-
-	ui_slider_destroy(slider);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_slider_moved(ui_slider_t *slider, void *arg, gfx_coord_t pos)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->moved = true;
-	resp->pos = pos;
-}
-
-PCUT_EXPORT(slider);
Index: pace/lib/ui/test/tab.c
===================================================================
--- uspace/lib/ui/test/tab.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,844 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <str.h>
-#include <ui/control.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/testctl.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/resource.h"
-#include "../private/tab.h"
-#include "../private/tabset.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tab);
-
-/** Create and destroy tab */
-PCUT_TEST(create_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	/*
-	 * Normally we don't need to destroy a tab explicitly, it will
-	 * be destroyed along with tab bar, but here we'll test destroying
-	 * it explicitly.
-	 */
-	ui_tab_destroy(tab);
-	ui_tab_set_destroy(tabset);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Destroy tab implicitly by destroying the tab set */
-PCUT_TEST(implicit_destroy)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	/* Let the tab be destroyed as part of destroying tab set */
-	ui_tab_set_destroy(tabset);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_tab_destroy(NULL);
-}
-
-/** ui_tab_first() / ui_tab_next() iterate over tabs */
-PCUT_TEST(first_next)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab1 = NULL;
-	ui_tab_t *tab2 = NULL;
-	ui_tab_t *t;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test 1", &tab1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab1);
-
-	rc = ui_tab_create(tabset, "Test 2", &tab2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab2);
-
-	t = ui_tab_first(tabset);
-	PCUT_ASSERT_EQUALS(tab1, t);
-
-	t = ui_tab_next(t);
-	PCUT_ASSERT_EQUALS(tab2, t);
-
-	t = ui_tab_next(t);
-	PCUT_ASSERT_NULL(t);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_last() / ui_tab_prev() iterate over tabs in reverse */
-PCUT_TEST(last_prev)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab1 = NULL;
-	ui_tab_t *tab2 = NULL;
-	ui_tab_t *t;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test 1", &tab1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab1);
-
-	rc = ui_tab_create(tabset, "Test 2", &tab2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab2);
-
-	t = ui_tab_last(tabset);
-	PCUT_ASSERT_EQUALS(tab2, t);
-
-	t = ui_tab_prev(t);
-	PCUT_ASSERT_EQUALS(tab1, t);
-
-	t = ui_tab_prev(t);
-	PCUT_ASSERT_NULL(t);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_is_selected() correctly returns tab state */
-PCUT_TEST(is_selected)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab1 = NULL;
-	ui_tab_t *tab2 = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test 1", &tab1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* The first added tab should be automatically selected */
-	PCUT_ASSERT_TRUE(ui_tab_is_selected(tab1));
-
-	rc = ui_tab_create(tabset, "Test 2", &tab2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* After adding a second tab the first should still be selected */
-	PCUT_ASSERT_TRUE(ui_tab_is_selected(tab1));
-	PCUT_ASSERT_FALSE(ui_tab_is_selected(tab2));
-
-	/* Select second tab */
-	ui_tab_set_select(tabset, tab2);
-
-	/* Now the second tab should be selected */
-	PCUT_ASSERT_FALSE(ui_tab_is_selected(tab1));
-	PCUT_ASSERT_TRUE(ui_tab_is_selected(tab2));
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_add() adds control to tab */
-PCUT_TEST(add)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add test control to tab */
-	ui_tab_add(tab, ui_test_ctl_ctl(testctl));
-
-	resp.destroy = false;
-
-	ui_tab_set_destroy(tabset);
-
-	/* Destroying the tab should have destroyed the control as well */
-	PCUT_ASSERT_TRUE(resp.destroy);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_remove() removes control to tab */
-PCUT_TEST(remove)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Add test control to tab */
-	ui_tab_add(tab, ui_test_ctl_ctl(testctl));
-
-	/* Rmove control from tab */
-	ui_tab_remove(tab, ui_test_ctl_ctl(testctl));
-
-	resp.destroy = false;
-
-	ui_tab_set_destroy(tabset);
-
-	/* Destroying the tab should NOT have destroyed the control */
-	PCUT_ASSERT_FALSE(resp.destroy);
-
-	ui_test_ctl_destroy(testctl);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint tab */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_tab_paint(tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_kbd_event() delivers keyboard event */
-PCUT_TEST(kbd_event)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	ui_evclaim_t claimed;
-	kbd_event_t event;
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	/* Without anytabs, event should be unclaimed */
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	claimed = ui_tab_set_kbd_event(tabset, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claimed);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Set up response */
-	ui_tab_add(tab, ui_test_ctl_ctl(testctl));
-	resp.claim = ui_claimed;
-	resp.kbd = false;
-
-	/* Send keyboard event */
-	event.type = KEY_PRESS;
-	event.key = KC_F10;
-	event.mods = 0;
-	claimed = ui_tab_kbd_event(tab, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	/* Make sure event was delivered */
-	PCUT_ASSERT_TRUE(resp.kbd);
-	PCUT_ASSERT_EQUALS(event.type, resp.kevent.type);
-	PCUT_ASSERT_EQUALS(event.key, resp.kevent.key);
-	PCUT_ASSERT_EQUALS(event.mods, resp.kevent.mods);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_pos_event() delivers position event */
-PCUT_TEST(pos_event)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	gfx_rect_t rect;
-	ui_tab_t *tab = NULL;
-	ui_evclaim_t claimed;
-	pos_event_t event;
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rect.p0.x = 0;
-	rect.p0.y = 0;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-	ui_tab_set_set_rect(tabset, &rect);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Set up response */
-	ui_tab_add(tab, ui_test_ctl_ctl(testctl));
-	resp.claim = ui_claimed;
-	resp.pos = false;
-
-	/* Send position event */
-	event.type = POS_PRESS;
-	event.hpos = 10;
-	event.vpos = 40;
-	claimed = ui_tab_pos_event(tab, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	/* Make sure event was delivered */
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_EQUALS(event.type, resp.pevent.type);
-	PCUT_ASSERT_EQUALS(event.hpos, resp.pevent.hpos);
-	PCUT_ASSERT_EQUALS(event.vpos, resp.pevent.vpos);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_handle_width() and ui_tab_handle_height() return dimensions */
-PCUT_TEST(handle_width_height)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	gfx_coord_t w, h;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	w = ui_tab_handle_width(tab);
-	h = ui_tab_handle_height(tab);
-
-	PCUT_ASSERT_INT_EQUALS(50, w);
-	PCUT_ASSERT_INT_EQUALS(25, h);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Computing tab geometry */
-PCUT_TEST(get_geom)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	ui_tab_geom_t geom;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rect.p0.x = 1000;
-	rect.p0.y = 2000;
-	rect.p1.x = 1100;
-	rect.p1.y = 2200;
-	ui_tab_set_set_rect(tabset, &rect);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	ui_tab_get_geom(tab, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(1006, geom.handle.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2000, geom.handle.p0.y);
-	PCUT_ASSERT_INT_EQUALS(1056, geom.handle.p1.x);
-	PCUT_ASSERT_INT_EQUALS(2027, geom.handle.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(1006, geom.handle_area.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2000, geom.handle_area.p0.y);
-	PCUT_ASSERT_INT_EQUALS(1056, geom.handle_area.p1.x);
-	PCUT_ASSERT_INT_EQUALS(2027, geom.handle_area.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(1000, geom.body.p0.x);
-	PCUT_ASSERT_INT_EQUALS(2025, geom.body.p0.y);
-	PCUT_ASSERT_INT_EQUALS(1100, geom.body.p1.x);
-	PCUT_ASSERT_INT_EQUALS(2200, geom.body.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(1014, geom.text_pos.x);
-	PCUT_ASSERT_INT_EQUALS(2007, geom.text_pos.y);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_patint_handle_frame() */
-PCUT_TEST(paint_handle_frame)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-	gfx_rect_t irect;
-	gfx_coord_t chamfer;
-	gfx_color_t *hi_color;
-	gfx_color_t *sh_color;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-	gc = ui_window_get_gc(window);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	chamfer = 4;
-
-	hi_color = res->wnd_highlight_color;
-	sh_color = res->wnd_shadow_color;
-
-	rc = ui_tab_paint_handle_frame(gc, &rect, chamfer, hi_color, sh_color,
-	    true, &irect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_tab_paint_handle_frame(gc, &rect, chamfer, hi_color, sh_color,
-	    false, &irect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_paint_body_frame() */
-PCUT_TEST(paint_body_frame)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_tab_paint_body_frame(tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_paint_frame() */
-PCUT_TEST(paint_frame)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_tab_paint_frame(tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_get_res() returns the resource */
-PCUT_TEST(get_res)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	PCUT_ASSERT_EQUALS(res, ui_tab_get_res(tab));
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(tab);
Index: pace/lib/ui/test/tabset.c
===================================================================
--- uspace/lib/ui/test/tabset.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,346 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/tab.h>
-#include <ui/tabset.h>
-#include <ui/testctl.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/tabset.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tabset);
-
-/** Create and destroy tab set */
-PCUT_TEST(create_destroy)
-{
-	ui_tab_set_t *tabset = NULL;
-	errno_t rc;
-
-	rc = ui_tab_set_create(NULL, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	ui_tab_set_destroy(tabset);
-}
-
-/** ui_tab_set_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_tab_set_destroy(NULL);
-}
-
-/** ui_tab_set_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_tab_set_t *tabset = NULL;
-	ui_control_t *control;
-	errno_t rc;
-
-	rc = ui_tab_set_create(NULL, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	control = ui_tab_set_ctl(tabset);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-/** Set tab set rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	gfx_rect_t rect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_tab_set_set_rect(tabset, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tabset->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tabset->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tabset->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tabset->rect.p1.y);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Paint tab set */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_set_paint(tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Deliver tab set keyboard event */
-PCUT_TEST(kbd_event)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab = NULL;
-	ui_evclaim_t claimed;
-	kbd_event_t event;
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	/* Without anytabs, event should be unclaimed */
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	claimed = ui_tab_set_kbd_event(tabset, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claimed);
-
-	rc = ui_tab_create(tabset, "Test", &tab);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tab);
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Set up response */
-	ui_tab_add(tab, ui_test_ctl_ctl(testctl));
-	resp.claim = ui_claimed;
-	resp.kbd = false;
-
-	/* Send keyboard event */
-	event.type = KEY_PRESS;
-	event.key = KC_F10;
-	event.mods = 0;
-	claimed = ui_tab_set_kbd_event(tabset, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	/* Make sure event was delivered */
-	PCUT_ASSERT_TRUE(resp.kbd);
-	PCUT_ASSERT_EQUALS(event.type, resp.kevent.type);
-	PCUT_ASSERT_EQUALS(event.key, resp.kevent.key);
-	PCUT_ASSERT_EQUALS(event.mods, resp.kevent.mods);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Press event on tab handle selects tab */
-PCUT_TEST(pos_event_select)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab1 = NULL;
-	ui_tab_t *tab2 = NULL;
-	ui_evclaim_t claimed;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	/* Without any tabs, event should be unclaimed */
-	event.type = POS_PRESS;
-	event.hpos = 80;
-	event.vpos = 4;
-	event.btn_num = 1;
-	claimed = ui_tab_set_pos_event(tabset, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_unclaimed, claimed);
-
-	rc = ui_tab_create(tabset, "Test 1", &tab1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* The first added tab should be automatically selected */
-	PCUT_ASSERT_EQUALS(tab1, tabset->selected);
-
-	rc = ui_tab_create(tabset, "Test 2", &tab2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* After adding a second tab the first should still be selected */
-	PCUT_ASSERT_EQUALS(tab1, tabset->selected);
-
-	event.type = POS_PRESS;
-	event.hpos = 80;
-	event.vpos = 4;
-	event.btn_num = 1;
-	claimed = ui_tab_set_pos_event(tabset, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(ui_claimed, claimed);
-
-	/* Clicking the second tab handle should select tab2 */
-	PCUT_ASSERT_EQUALS(tab2, tabset->selected);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_tab_set_select() selects tab */
-PCUT_TEST(select)
-{
-	ui_t *ui = NULL;
-	ui_window_t *window = NULL;
-	ui_wnd_params_t params;
-	ui_resource_t *res;
-	ui_tab_set_t *tabset = NULL;
-	ui_tab_t *tab1 = NULL;
-	ui_tab_t *tab2 = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-
-	rc = ui_tab_set_create(res, &tabset);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(tabset);
-
-	rc = ui_tab_create(tabset, "Test 1", &tab1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* The first added tab should be automatically selected */
-	PCUT_ASSERT_EQUALS(tab1, tabset->selected);
-
-	rc = ui_tab_create(tabset, "Test 2", &tab2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* After adding a second tab the first should still be selected */
-	PCUT_ASSERT_EQUALS(tab1, tabset->selected);
-
-	/* Select second tab */
-	ui_tab_set_select(tabset, tab2);
-
-	/* Now the second tab should be selected */
-	PCUT_ASSERT_EQUALS(tab2, tabset->selected);
-
-	ui_tab_set_destroy(tabset);
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(tabset);
Index: pace/lib/ui/test/testctl.c
===================================================================
--- uspace/lib/ui/test/testctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <ui/control.h>
-#include <ui/testctl.h>
-#include "../private/testctl.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(testctl);
-
-/** Create and destroy test control */
-PCUT_TEST(create_destroy)
-{
-	ui_test_ctl_t *testctl = NULL;
-	ui_tc_resp_t resp;
-	errno_t rc;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(testctl);
-
-	ui_test_ctl_destroy(testctl);
-}
-
-/** ui_test_ctl_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_test_ctl_destroy(NULL);
-}
-
-/** ui_test_ctl_ctl() returns control that has a working virtual destructor */
-PCUT_TEST(ctl)
-{
-	ui_control_t *control;
-	ui_test_ctl_t *testctl;
-	errno_t rc;
-	ui_tc_resp_t resp;
-
-	rc = ui_test_ctl_create(&resp, &testctl);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	control = ui_test_ctl_ctl(testctl);
-	PCUT_ASSERT_NOT_NULL(control);
-
-	ui_control_destroy(control);
-}
-
-PCUT_EXPORT(testctl);
Index: pace/lib/ui/test/ui.c
===================================================================
--- uspace/lib/ui/test/ui.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <ui/ui.h>
-#include "../private/ui.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ui);
-
-/** Create and destroy UI with display */
-PCUT_TEST(create_disp_destroy)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-	PCUT_ASSERT_NULL(ui->display);
-
-	ui_destroy(ui);
-}
-
-/** Create and destroy UI with console */
-PCUT_TEST(create_cons_destroy)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_cons(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-	PCUT_ASSERT_NULL(ui->console);
-
-	ui_destroy(ui);
-}
-
-/** ui_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_destroy(NULL);
-}
-
-/** ui_suspend() / ui_resume() do nothing if we don't have a console,
- * ui_is_suspended() returns suspend status
- */
-PCUT_TEST(suspend_resume)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	PCUT_ASSERT_FALSE(ui_is_suspended(ui));
-
-	rc = ui_suspend(ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(ui_is_suspended(ui));
-
-	rc = ui_resume(ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(ui_is_suspended(ui));
-
-	ui_destroy(ui);
-}
-
-/** ui_run() / ui_quit() */
-PCUT_TEST(run_quit)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	/* Set exit flag */
-	ui_quit(ui);
-
-	/* ui_run() should return immediately */
-	ui_run(ui);
-
-	ui_destroy(ui);
-}
-
-/** ui_paint() */
-PCUT_TEST(paint)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_cons(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	/* In absence of windows ui_paint() should just return EOK */
-	rc = ui_paint(ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_destroy(ui);
-}
-
-/** ui_is_textmode() */
-PCUT_TEST(is_textmode)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp((display_t *)(-1), &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	PCUT_ASSERT_FALSE(ui_is_textmode(ui));
-
-	ui_destroy(ui);
-
-	rc = ui_create_cons((console_ctrl_t *)(-1), &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	PCUT_ASSERT_TRUE(ui_is_textmode(ui));
-
-	ui_destroy(ui);
-}
-
-/** ui_is_fullscreen() */
-PCUT_TEST(is_fullscreen)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp((display_t *)(-1), &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	PCUT_ASSERT_FALSE(ui_is_fullscreen(ui));
-
-	ui_destroy(ui);
-
-	rc = ui_create_cons((console_ctrl_t *)(-1), &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	PCUT_ASSERT_TRUE(ui_is_fullscreen(ui));
-
-	ui_destroy(ui);
-}
-
-/** ui_is_get_rect() */
-PCUT_TEST(get_rect)
-{
-	ui_t *ui = NULL;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	/* This won't work without a display service */
-	rc = ui_get_rect(ui, &rect);
-	PCUT_ASSERT_ERRNO_VAL(ENOTSUP, rc);
-
-	ui_destroy(ui);
-}
-
-/** ui_lock(), ui_unlock() */
-PCUT_TEST(lock_unlock)
-{
-	ui_t *ui = NULL;
-	errno_t rc;
-
-	rc = ui_create_disp((display_t *)(-1), &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(ui);
-
-	ui_lock(ui);
-	ui_unlock(ui);
-
-	ui_destroy(ui);
-}
-
-PCUT_EXPORT(ui);
Index: pace/lib/ui/test/wdecor.c
===================================================================
--- uspace/lib/ui/test/wdecor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1627 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/pbutton.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/wdecor.h>
-#include "../private/wdecor.h"
-#include "../private/testgc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(wdecor);
-
-static void test_wdecor_sysmenu_open(ui_wdecor_t *, void *, sysarg_t);
-static void test_wdecor_sysmenu_left(ui_wdecor_t *, void *, sysarg_t);
-static void test_wdecor_sysmenu_right(ui_wdecor_t *, void *, sysarg_t);
-static void test_wdecor_sysmenu_accel(ui_wdecor_t *, void *, char32_t,
-    sysarg_t);
-static void test_wdecor_minimize(ui_wdecor_t *, void *);
-static void test_wdecor_maximize(ui_wdecor_t *, void *);
-static void test_wdecor_unmaximize(ui_wdecor_t *, void *);
-static void test_wdecor_close(ui_wdecor_t *, void *);
-static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *, sysarg_t);
-static void test_wdecor_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
-    gfx_coord2_t *, sysarg_t);
-static void test_wdecor_set_cursor(ui_wdecor_t *, void *, ui_stock_cursor_t);
-
-static ui_wdecor_cb_t test_wdecor_cb = {
-	.sysmenu_open = test_wdecor_sysmenu_open,
-	.sysmenu_left = test_wdecor_sysmenu_left,
-	.sysmenu_right = test_wdecor_sysmenu_right,
-	.sysmenu_accel = test_wdecor_sysmenu_accel,
-	.minimize = test_wdecor_minimize,
-	.maximize = test_wdecor_maximize,
-	.unmaximize = test_wdecor_unmaximize,
-	.close = test_wdecor_close,
-	.move = test_wdecor_move,
-	.resize = test_wdecor_resize,
-	.set_cursor = test_wdecor_set_cursor
-};
-
-static ui_wdecor_cb_t dummy_wdecor_cb = {
-};
-
-typedef struct {
-	bool sysmenu_open;
-	bool sysmenu_left;
-	bool sysmenu_right;
-	bool sysmenu_accel;
-	bool minimize;
-	bool maximize;
-	bool unmaximize;
-	bool close;
-	bool move;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	sysarg_t idev_id;
-	char32_t accel;
-	bool resize;
-	ui_wdecor_rsztype_t rsztype;
-	bool set_cursor;
-	ui_stock_cursor_t cursor;
-} test_cb_resp_t;
-
-/** Create and destroy window decoration */
-PCUT_TEST(create_destroy)
-{
-	ui_wdecor_t *wdecor = NULL;
-	errno_t rc;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wdecor);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** ui_wdecor_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_wdecor_destroy(NULL);
-}
-
-/** Set window decoration rectangle sets internal field */
-PCUT_TEST(set_rect)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, wdecor->rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, wdecor->rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, wdecor->rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, wdecor->rect.p1.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set window decoration active sets internal field */
-PCUT_TEST(set_active)
-{
-	ui_wdecor_t *wdecor;
-	errno_t rc;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(wdecor->active);
-
-	ui_wdecor_set_active(wdecor, false);
-	PCUT_ASSERT_FALSE(wdecor->active);
-
-	ui_wdecor_set_active(wdecor, true);
-	PCUT_ASSERT_TRUE(wdecor->active);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Set window decoration maximized sets internal field */
-PCUT_TEST(set_maximized)
-{
-	ui_wdecor_t *wdecor;
-	errno_t rc;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(wdecor->active);
-
-	ui_wdecor_set_maximized(wdecor, false);
-	PCUT_ASSERT_FALSE(wdecor->maximized);
-
-	ui_wdecor_set_maximized(wdecor, true);
-	PCUT_ASSERT_TRUE(wdecor->maximized);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Setting system menu handle as active/inactive */
-PCUT_TEST(sysmenu_hdl_set_active)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_FALSE(wdecor->sysmenu_hdl_active);
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-	PCUT_ASSERT_TRUE(wdecor->sysmenu_hdl_active);
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, false);
-	PCUT_ASSERT_FALSE(wdecor->sysmenu_hdl_active);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint system menu handle */
-PCUT_TEST(sysmenu_hdl_paint)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	ui_wdecor_geom_t geom;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wdecor_get_geom(wdecor, &geom);
-	rc = ui_wdecor_sysmenu_hdl_paint(wdecor, &geom.sysmenu_hdl_rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Paint window decoration */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_wdecor_paint(wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_wdecor_sysmenu_open() */
-PCUT_TEST(sysmenu_open)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Sysmenu open callback with no callbacks set */
-	ui_wdecor_sysmenu_open(wdecor, 42);
-
-	/* Sysmenu open callback with sysmenu callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_sysmenu_open(wdecor, 42);
-
-	/* Sysmenu open callback with real callback set */
-	resp.sysmenu_open = false;
-	resp.idev_id = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_sysmenu_open(wdecor, 42);
-	PCUT_ASSERT_TRUE(resp.sysmenu_open);
-	PCUT_ASSERT_INT_EQUALS(42, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_sysmenu_left() */
-PCUT_TEST(sysmenu_left)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Sysmenu left callback with no callbacks set */
-	ui_wdecor_sysmenu_left(wdecor, 42);
-
-	/* Sysmenu left callback with sysmenu callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_sysmenu_left(wdecor, 42);
-
-	/* Sysmenu left callback with real callback set */
-	resp.sysmenu_left = false;
-	resp.idev_id = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_sysmenu_left(wdecor, 42);
-	PCUT_ASSERT_TRUE(resp.sysmenu_left);
-	PCUT_ASSERT_INT_EQUALS(42, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_sysmenu_right() */
-PCUT_TEST(sysmenu_right)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Sysmenu right callback with no callbacks set */
-	ui_wdecor_sysmenu_right(wdecor, 42);
-
-	/* Sysmenu right callback with sysmenu callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_sysmenu_right(wdecor, 42);
-
-	/* Sysmenu right callback with real callback set */
-	resp.sysmenu_right = false;
-	resp.idev_id = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_sysmenu_right(wdecor, 42);
-	PCUT_ASSERT_TRUE(resp.sysmenu_right);
-	PCUT_ASSERT_INT_EQUALS(42, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_sysmenu_accel() */
-PCUT_TEST(sysmenu_accel)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Sysmenu accelerator callback with no callbacks set */
-	ui_wdecor_sysmenu_accel(wdecor, 'a', 42);
-
-	/* Sysmenu accelerator callback with sysmenu callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_sysmenu_accel(wdecor, 'a', 42);
-
-	/* Sysmenu accelerator callback with real callback set */
-	resp.sysmenu_accel = false;
-	resp.idev_id = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_sysmenu_accel(wdecor, 'a', 42);
-	PCUT_ASSERT_TRUE(resp.sysmenu_accel);
-	PCUT_ASSERT_INT_EQUALS('a', resp.accel);
-	PCUT_ASSERT_INT_EQUALS(42, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_minimize() */
-PCUT_TEST(minimize)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Minimize callback with no callbacks set */
-	ui_wdecor_minimize(wdecor);
-
-	/* Minimize callback with minimize callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_minimize(wdecor);
-
-	/* Minimize callback with real callback set */
-	resp.minimize = false;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_minimize(wdecor);
-	PCUT_ASSERT_TRUE(resp.minimize);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_maximize() */
-PCUT_TEST(maximize)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Maximize callback with no callbacks set */
-	ui_wdecor_maximize(wdecor);
-
-	/* Maxmimize callback with maximize callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_maximize(wdecor);
-
-	/* Maximize callback with real callback set */
-	resp.maximize = false;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_maximize(wdecor);
-	PCUT_ASSERT_TRUE(resp.maximize);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_unmaximize() */
-PCUT_TEST(unmaximize)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Unmaximize callback with no callbacks set */
-	ui_wdecor_unmaximize(wdecor);
-
-	/* Unmaximize callback with unmaximize callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_unmaximize(wdecor);
-
-	/* Unmaximize callback with real callback set */
-	resp.unmaximize = false;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_unmaximize(wdecor);
-	PCUT_ASSERT_TRUE(resp.unmaximize);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_close() */
-PCUT_TEST(close)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Close callback with no callbacks set */
-	ui_wdecor_close(wdecor);
-
-	/* Close callback with close callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_close(wdecor);
-
-	/* Close callback with real callback set */
-	resp.close = false;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_close(wdecor);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_move() */
-PCUT_TEST(move)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos.x = 3;
-	pos.y = 4;
-	pos_id = 5;
-
-	/* Move callback with no callbacks set */
-	ui_wdecor_move(wdecor, &pos, pos_id);
-
-	/* Move callback with move callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_move(wdecor, &pos, pos_id);
-
-	/* Move callback with real callback set */
-	resp.move = false;
-	resp.pos.x = 0;
-	resp.pos.y = 0;
-	resp.pos_id = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_move(wdecor, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.move);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.pos_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_resize() */
-PCUT_TEST(resize)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-	ui_wdecor_rsztype_t rsztype;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rsztype = ui_wr_bottom;
-	pos.x = 3;
-	pos.y = 4;
-	pos_id = 5;
-
-	/* Resize callback with no callbacks set */
-	ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
-
-	/* Resize callback with move callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
-
-	/* Resize callback with real callback set */
-	resp.resize = false;
-	resp.rsztype = ui_wr_none;
-	resp.pos.x = 0;
-	resp.pos.y = 0;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_resize(wdecor, rsztype, &pos, pos_id);
-	PCUT_ASSERT_TRUE(resp.resize);
-	PCUT_ASSERT_INT_EQUALS(rsztype, resp.rsztype);
-	PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, resp.pos_id);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Test ui_wdecor_set_cursor() */
-PCUT_TEST(set_cursor)
-{
-	errno_t rc;
-	ui_wdecor_t *wdecor;
-	test_cb_resp_t resp;
-	ui_stock_cursor_t cursor;
-
-	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	cursor = ui_curs_size_uldr;
-
-	/* Set cursor callback with no callbacks set */
-	ui_wdecor_set_cursor(wdecor, cursor);
-
-	/* Set cursor callback with move callback not implemented */
-	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
-	ui_wdecor_set_cursor(wdecor, cursor);
-
-	/* Set cursor callback with real callback set */
-	resp.set_cursor = false;
-	resp.cursor = ui_curs_arrow;
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-	ui_wdecor_set_cursor(wdecor, cursor);
-	PCUT_ASSERT_TRUE(resp.set_cursor);
-	PCUT_ASSERT_INT_EQUALS(cursor, resp.cursor);
-
-	ui_wdecor_destroy(wdecor);
-}
-
-/** Clicking the close button generates close callback */
-PCUT_TEST(close_btn_clicked)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	test_cb_resp_t resp;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	resp.close = false;
-
-	ui_pbutton_clicked(wdecor->btn_close);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Button press on title bar generates move callback */
-PCUT_TEST(pos_event_move)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	pos_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	resp.move = false;
-	resp.pos.x = 0;
-	resp.pos.y = 0;
-
-	event.type = POS_PRESS;
-	event.hpos = 50;
-	event.vpos = 25;
-	ui_wdecor_pos_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.move);
-	PCUT_ASSERT_INT_EQUALS(event.hpos, resp.pos.x);
-	PCUT_ASSERT_INT_EQUALS(event.vpos, resp.pos.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Pressing F10 generates sysmenu event.
- *
- * Note that in a window with menu bar the menu bar would claim F10
- * so it would never be delivered to window decoration.
- */
-PCUT_TEST(kbd_f10_sysmenu)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	kbd_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	resp.sysmenu_open = false;
-
-	event.type = KEY_PRESS;
-	event.mods = 0;
-	event.key = KC_F10;
-	event.kbd_id = 42;
-	ui_wdecor_kbd_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.sysmenu_open);
-	PCUT_ASSERT_INT_EQUALS(event.kbd_id, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Down key with active sysmenu handle generates sysmenu open event */
-PCUT_TEST(kbd_down_sysmenu)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	kbd_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-
-	resp.sysmenu_open = false;
-
-	event.type = KEY_PRESS;
-	event.mods = 0;
-	event.key = KC_DOWN;
-	event.kbd_id = 42;
-	ui_wdecor_kbd_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.sysmenu_open);
-	PCUT_ASSERT_INT_EQUALS(event.kbd_id, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Left key with active sysmenu handle generates sysmenu left event */
-PCUT_TEST(kbd_left_sysmenu)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	kbd_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-
-	resp.sysmenu_left = false;
-
-	event.type = KEY_PRESS;
-	event.mods = 0;
-	event.key = KC_LEFT;
-	event.kbd_id = 42;
-	ui_wdecor_kbd_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.sysmenu_left);
-	PCUT_ASSERT_INT_EQUALS(event.kbd_id, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Right key with active sysmenu handle generates sysmenu right event */
-PCUT_TEST(kbd_right_sysmenu)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	kbd_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-
-	resp.sysmenu_right = false;
-
-	event.type = KEY_PRESS;
-	event.mods = 0;
-	event.key = KC_RIGHT;
-	event.kbd_id = 42;
-	ui_wdecor_kbd_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.sysmenu_right);
-	PCUT_ASSERT_INT_EQUALS(event.kbd_id, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Character key with active sysmenu handle generates sysmenu accel event */
-PCUT_TEST(kbd_accel_sysmenu)
-{
-	errno_t rc;
-	gfx_rect_t rect;
-	kbd_event_t event;
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	test_cb_resp_t resp;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, (void *) &resp);
-
-	ui_wdecor_sysmenu_hdl_set_active(wdecor, true);
-
-	resp.sysmenu_accel = false;
-
-	event.type = KEY_PRESS;
-	event.mods = 0;
-	event.key = KC_A;
-	event.c = 'a';
-	event.kbd_id = 42;
-	ui_wdecor_kbd_event(wdecor, &event);
-
-	PCUT_ASSERT_TRUE(resp.sysmenu_accel);
-	PCUT_ASSERT_INT_EQUALS(event.c, resp.accel);
-	PCUT_ASSERT_INT_EQUALS(event.kbd_id, resp.idev_id);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_wdecor_get_geom() with ui_wds_none produces the correct geometry */
-PCUT_TEST(get_geom_none)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	ui_wdecor_geom_t geom;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(10, geom.interior_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, geom.interior_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(100, geom.interior_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(200, geom.interior_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(10, geom.app_area_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, geom.app_area_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(100, geom.app_area_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(200, geom.app_area_rect.p1.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_wdecor_get_geom() with ui_wds_frame produces the correct geometry */
-PCUT_TEST(get_geom_frame)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	ui_wdecor_geom_t geom;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_frame, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.interior_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.interior_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.interior_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.interior_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.title_bar_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.caption_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.app_area_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.app_area_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.app_area_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.app_area_rect.p1.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_wdecor_get_geom() with ui_wds_frame | ui_wds_titlebar */
-PCUT_TEST(get_geom_frame_titlebar)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	ui_wdecor_geom_t geom;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_frame | ui_wds_titlebar,
-	    &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.interior_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.interior_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.interior_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.interior_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.title_bar_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.title_bar_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.title_bar_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.title_bar_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.sysmenu_hdl_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(18, geom.caption_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.caption_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(91, geom.caption_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.caption_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_min_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_close_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.app_area_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.app_area_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.app_area_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.app_area_rect.p1.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_wdecor_get_geom() with ui_wds_decorated produces the correct geometry */
-PCUT_TEST(get_geom_decorated)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	ui_wdecor_geom_t geom;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_decorated, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	ui_wdecor_get_geom(wdecor, &geom);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.interior_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.interior_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.interior_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.interior_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.title_bar_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.title_bar_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.title_bar_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.title_bar_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(15, geom.sysmenu_hdl_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(25, geom.sysmenu_hdl_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(35, geom.sysmenu_hdl_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(45, geom.sysmenu_hdl_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(38, geom.caption_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(24, geom.caption_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(51, geom.caption_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.caption_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(55, geom.btn_min_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(25, geom.btn_min_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(75, geom.btn_min_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(45, geom.btn_min_rect.p1.y);
-
-	/* Maximize button is not in ui_wds_decorated */
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(0, geom.btn_max_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(75, geom.btn_close_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(25, geom.btn_close_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(95, geom.btn_close_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(45, geom.btn_close_rect.p1.y);
-
-	PCUT_ASSERT_INT_EQUALS(14, geom.app_area_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(46, geom.app_area_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, geom.app_area_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, geom.app_area_rect.p1.y);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** ui_wdecor_rect_from_app() correctly converts application to window rect */
-PCUT_TEST(rect_from_app)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	gfx_rect_t arect;
-	gfx_rect_t rect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	arect.p0.x = 14;
-	arect.p0.y = 46;
-	arect.p1.x = 96;
-	arect.p1.y = 196;
-
-	ui_wdecor_rect_from_app(ui, ui_wds_none, &arect, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(14, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(46, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(96, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(196, rect.p1.y);
-
-	ui_wdecor_rect_from_app(ui, ui_wds_frame, &arect, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(42, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(100, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
-
-	ui_wdecor_rect_from_app(ui, ui_wds_decorated, &arect, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(10, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(100, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
-
-	ui_destroy(ui);
-}
-
-/** Test ui_wdecor_get_rsztype() */
-PCUT_TEST(get_rsztype)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	ui_wdecor_rsztype_t rsztype;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_resizable, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	/* Outside of the window */
-	pos.x = 0;
-	pos.y = -1;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
-
-	/* Middle of the window */
-	pos.x = 50;
-	pos.y = 100;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
-
-	/* Top-left corner, but not on edge */
-	pos.x = 20;
-	pos.y = 30;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
-
-	/* Top-left corner on top edge */
-	pos.x = 20;
-	pos.y = 20;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_top_left, rsztype);
-
-	/* Top-left corner on left edge */
-	pos.x = 10;
-	pos.y = 30;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_top_left, rsztype);
-
-	/* Top-right corner on top edge */
-	pos.x = 90;
-	pos.y = 20;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_top_right, rsztype);
-
-	/* Top-right corner on right edge */
-	pos.x = 99;
-	pos.y = 30;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_top_right, rsztype);
-
-	/* Top edge */
-	pos.x = 50;
-	pos.y = 20;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_top, rsztype);
-
-	/* Bottom edge */
-	pos.x = 50;
-	pos.y = 199;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_bottom, rsztype);
-
-	/* Left edge */
-	pos.x = 10;
-	pos.y = 100;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_left, rsztype);
-
-	/* Right edge */
-	pos.x = 99;
-	pos.y = 100;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_right, rsztype);
-
-	ui_wdecor_destroy(wdecor);
-
-	/* Non-resizable window */
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-
-	pos.x = 10;
-	pos.y = 20;
-	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
-	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test ui_wdecor_cursor_from_rsztype() */
-PCUT_TEST(cursor_from_rsztype)
-{
-	PCUT_ASSERT_EQUALS(ui_curs_arrow,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_none));
-	PCUT_ASSERT_EQUALS(ui_curs_size_ud,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_top));
-	PCUT_ASSERT_EQUALS(ui_curs_size_ud,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom));
-	PCUT_ASSERT_EQUALS(ui_curs_size_lr,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_left));
-	PCUT_ASSERT_EQUALS(ui_curs_size_lr,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_right));
-	PCUT_ASSERT_EQUALS(ui_curs_size_uldr,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_top_left));
-	PCUT_ASSERT_EQUALS(ui_curs_size_uldr,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom_right));
-	PCUT_ASSERT_EQUALS(ui_curs_size_urdl,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_top_right));
-	PCUT_ASSERT_EQUALS(ui_curs_size_urdl,
-	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom_left));
-}
-
-/** Test ui_wdecor_frame_pos_event() */
-PCUT_TEST(frame_pos_event)
-{
-	gfx_context_t *gc = NULL;
-	test_gc_t tgc;
-	ui_resource_t *resource = NULL;
-	ui_wdecor_t *wdecor;
-	gfx_rect_t rect;
-	test_cb_resp_t resp;
-	pos_event_t event;
-	errno_t rc;
-
-	memset(&tgc, 0, sizeof(tgc));
-	rc = gfx_context_new(&ops, &tgc, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_resource_create(gc, false, &resource);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(resource);
-
-	rc = ui_wdecor_create(resource, "Hello", ui_wds_resizable, &wdecor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 100;
-	rect.p1.y = 200;
-
-	ui_wdecor_set_rect(wdecor, &rect);
-	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
-
-	/* Release on window border should do nothing */
-	resp.resize = false;
-	event.type = POS_RELEASE;
-	event.hpos = 10;
-	event.vpos = 10;
-	ui_wdecor_frame_pos_event(wdecor, &event);
-	PCUT_ASSERT_FALSE(resp.resize);
-
-	/* Press in the middle of the window should do nothing */
-	resp.resize = false;
-	event.type = POS_PRESS;
-	event.hpos = 50;
-	event.vpos = 100;
-	ui_wdecor_frame_pos_event(wdecor, &event);
-	PCUT_ASSERT_FALSE(resp.resize);
-
-	/* Press on window border should cause resize to be called */
-	resp.resize = false;
-	event.type = POS_PRESS;
-	event.hpos = 10;
-	event.vpos = 20;
-	ui_wdecor_frame_pos_event(wdecor, &event);
-	PCUT_ASSERT_TRUE(resp.resize);
-
-	ui_wdecor_destroy(wdecor);
-	ui_resource_destroy(resource);
-
-	rc = gfx_context_delete(gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static void test_wdecor_sysmenu_open(ui_wdecor_t *wdecor, void *arg,
-    sysarg_t idev_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->sysmenu_open = true;
-	resp->idev_id = idev_id;
-}
-
-static void test_wdecor_sysmenu_left(ui_wdecor_t *wdecor, void *arg,
-    sysarg_t idev_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->sysmenu_left = true;
-	resp->idev_id = idev_id;
-}
-
-static void test_wdecor_sysmenu_right(ui_wdecor_t *wdecor, void *arg,
-    sysarg_t idev_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->sysmenu_right = true;
-	resp->idev_id = idev_id;
-}
-
-static void test_wdecor_sysmenu_accel(ui_wdecor_t *wdecor, void *arg,
-    char32_t accel, sysarg_t idev_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->sysmenu_accel = true;
-	resp->accel = accel;
-	resp->idev_id = idev_id;
-}
-
-static void test_wdecor_minimize(ui_wdecor_t *wdecor, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->minimize = true;
-}
-
-static void test_wdecor_maximize(ui_wdecor_t *wdecor, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->maximize = true;
-}
-
-static void test_wdecor_unmaximize(ui_wdecor_t *wdecor, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->unmaximize = true;
-}
-
-static void test_wdecor_close(ui_wdecor_t *wdecor, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-static void test_wdecor_move(ui_wdecor_t *wdecor, void *arg, gfx_coord2_t *pos,
-    sysarg_t pos_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->move = true;
-	resp->pos = *pos;
-	resp->pos_id = pos_id;
-}
-
-static void test_wdecor_resize(ui_wdecor_t *wdecor, void *arg,
-    ui_wdecor_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->resize = true;
-	resp->rsztype = rsztype;
-	resp->pos = *pos;
-	resp->pos_id = pos_id;
-}
-
-static void test_wdecor_set_cursor(ui_wdecor_t *wdecor, void *arg,
-    ui_stock_cursor_t cursor)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->set_cursor = true;
-	resp->cursor = cursor;
-}
-
-PCUT_EXPORT(wdecor);
Index: pace/lib/ui/test/window.c
===================================================================
--- uspace/lib/ui/test/window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1088 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <gfx/render.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdbool.h>
-#include <ui/control.h>
-#include <ui/resource.h>
-#include <ui/ui.h>
-#include <ui/window.h>
-#include "../private/window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(window);
-
-static void test_window_sysmenu(ui_window_t *, void *, sysarg_t);
-static void test_window_minimize(ui_window_t *, void *);
-static void test_window_maximize(ui_window_t *, void *);
-static void test_window_unmaximize(ui_window_t *, void *);
-static void test_window_close(ui_window_t *, void *);
-static void test_window_focus(ui_window_t *, void *, unsigned);
-static void test_window_kbd(ui_window_t *, void *, kbd_event_t *);
-static errno_t test_window_paint(ui_window_t *, void *);
-static void test_window_pos(ui_window_t *, void *, pos_event_t *);
-static void test_window_unfocus(ui_window_t *, void *, unsigned);
-static void test_window_resize(ui_window_t *, void *);
-
-static ui_window_cb_t test_window_cb = {
-	.sysmenu = test_window_sysmenu,
-	.minimize = test_window_minimize,
-	.maximize = test_window_maximize,
-	.unmaximize = test_window_unmaximize,
-	.close = test_window_close,
-	.focus = test_window_focus,
-	.kbd = test_window_kbd,
-	.paint = test_window_paint,
-	.pos = test_window_pos,
-	.unfocus = test_window_unfocus,
-	.resize = test_window_resize
-};
-
-static ui_window_cb_t dummy_window_cb = {
-};
-
-static errno_t test_ctl_paint(void *);
-static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
-static void test_ctl_unfocus(void *, unsigned);
-
-static ui_control_ops_t test_ctl_ops = {
-	.paint = test_ctl_paint,
-	.pos_event = test_ctl_pos_event,
-	.unfocus = test_ctl_unfocus
-};
-
-typedef struct {
-	errno_t rc;
-	bool sysmenu;
-	sysarg_t sysmenu_idev_id;
-	bool minimize;
-	bool maximize;
-	bool unmaximize;
-	bool close;
-	bool focus;
-	unsigned focus_nfocus;
-	bool kbd;
-	kbd_event_t kbd_event;
-	bool paint;
-	bool pos;
-	pos_event_t pos_event;
-	bool unfocus;
-	unsigned unfocus_nfocus;
-	bool resize;
-} test_cb_resp_t;
-
-typedef struct {
-	errno_t rc;
-	ui_evclaim_t claim;
-	bool paint;
-	bool pos;
-	pos_event_t pos_event;
-	bool unfocus;
-	unsigned unfocus_nfocus;
-} test_ctl_resp_t;
-
-/** Create and destroy window */
-PCUT_TEST(create_destroy)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_destroy() can take NULL argument (no-op) */
-PCUT_TEST(destroy_null)
-{
-	ui_window_destroy(NULL);
-}
-
-/** ui_window_add()/ui_window_remove() ... */
-PCUT_TEST(add_remove)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_control_t *control = NULL;
-	test_ctl_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_control_new(&test_ctl_ops, &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Control not called since it hasn't been added yet */
-	resp.rc = ENOMEM;
-	resp.paint = false;
-	rc = ui_window_def_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(resp.paint);
-
-	ui_window_add(window, control);
-
-	/* Now paint request should be delivered to control */
-	resp.rc = EOK;
-	resp.paint = false;
-	rc = ui_window_def_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	ui_window_remove(window, control);
-
-	/*
-	 * After having removed the control the request should no longer
-	 * be delivered to it.
-	 */
-	resp.rc = ENOMEM;
-	resp.paint = false;
-	rc = ui_window_def_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_FALSE(resp.paint);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_get_active */
-PCUT_TEST(get_active)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window1 = NULL;
-	ui_window_t *window2 = NULL;
-	ui_window_t *awnd;
-
-	rc = ui_create_cons(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	awnd = ui_window_get_active(ui);
-	PCUT_ASSERT_NULL(awnd);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window1);
-
-	awnd = ui_window_get_active(ui);
-	PCUT_ASSERT_EQUALS(window1, awnd);
-
-	rc = ui_window_create(ui, &params, &window2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window2);
-
-	awnd = ui_window_get_active(ui);
-	PCUT_ASSERT_EQUALS(window2, awnd);
-
-	ui_window_destroy(window2);
-
-	awnd = ui_window_get_active(ui);
-	PCUT_ASSERT_EQUALS(window1, awnd);
-
-	ui_window_destroy(window1);
-
-	awnd = ui_window_get_active(ui);
-	PCUT_ASSERT_NULL(awnd);
-
-	ui_destroy(ui);
-}
-
-/** ui_window_resize */
-PCUT_TEST(resize)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	gfx_rect_t nrect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 1;
-	params.rect.p1.y = 1;
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	nrect.p0.x = -1;
-	nrect.p0.y = -1;
-	nrect.p1.x = 2;
-	nrect.p1.y = 2;
-	rc = ui_window_resize(window, &nrect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_get_ui() returns containing UI */
-PCUT_TEST(get_ui)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_t *rui;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rui = ui_window_get_ui(window);
-	PCUT_ASSERT_EQUALS(ui, rui);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_get_res/gc/rect() return valid objects */
-PCUT_TEST(get_res_gc_rect)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_resource_t *res;
-	gfx_context_t *gc;
-	gfx_rect_t rect;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	res = ui_window_get_res(window);
-	PCUT_ASSERT_NOT_NULL(res);
-
-	gc = ui_window_get_gc(window);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	ui_window_get_app_rect(window, &rect);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_set_ctl_cursor() */
-PCUT_TEST(set_ctl_cursor)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_window_set_ctl_cursor(window, ui_curs_ibeam);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_get_app_gc() return valid GC */
-PCUT_TEST(get_app_gc)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	gfx_context_t *gc;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p0.x = 100;
-	params.rect.p0.y = 100;
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_window_get_app_gc(window, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	rc = gfx_fill_rect(gc, &params.rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_window_paint() */
-PCUT_TEST(paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	ui_window_paint(window);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** Test ui_window_def_paint() */
-PCUT_TEST(def_paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_control_t *control = NULL;
-	test_ctl_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	rc = ui_control_new(&test_ctl_ops, &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_add(window, control);
-
-	resp.rc = EOK;
-	resp.paint = false;
-	rc = ui_window_def_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	resp.rc = ENOMEM;
-	resp.paint = false;
-	rc = ui_window_def_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	/* Need to remove first because we didn't implement the destructor */
-	ui_window_remove(window, control);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_def_pos() delivers position event to control in window */
-PCUT_TEST(def_pos)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_control_t *control = NULL;
-	test_ctl_resp_t resp;
-	pos_event_t event;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_add(window, control);
-
-	event.pos_id = 1;
-	event.type = POS_PRESS;
-	event.btn_num = 2;
-	event.hpos = 3;
-	event.vpos = 4;
-
-	resp.pos = false;
-	resp.claim = ui_claimed;
-
-	ui_window_def_pos(window, &event);
-
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_INT_EQUALS(event.pos_id, resp.pos_event.pos_id);
-	PCUT_ASSERT_INT_EQUALS(event.type, resp.pos_event.type);
-	PCUT_ASSERT_INT_EQUALS(event.btn_num, resp.pos_event.btn_num);
-	PCUT_ASSERT_INT_EQUALS(event.hpos, resp.pos_event.hpos);
-	PCUT_ASSERT_INT_EQUALS(event.vpos, resp.pos_event.vpos);
-
-	/* Need to remove first because we didn't implement the destructor */
-	ui_window_remove(window, control);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_def_unfocus() delivers unfocus event to control in window */
-PCUT_TEST(def_unfocus)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	ui_control_t *control = NULL;
-	test_ctl_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ui_control_new(&test_ctl_ops, &resp, &control);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_add(window, control);
-
-	resp.unfocus = false;
-
-	ui_window_def_unfocus(window, 42);
-	PCUT_ASSERT_TRUE(resp.unfocus);
-	PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus);
-
-	/* Need to remove first because we didn't implement the destructor */
-	ui_window_remove(window, control);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_sysmenu() calls sysmenu callback set via ui_window_set_cb() */
-PCUT_TEST(send_sysmenu)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Sysmenu callback with no callbacks set */
-	ui_window_send_sysmenu(window, 42);
-
-	/* Sysmenu callback with sysmenu callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_sysmenu(window, 42);
-
-	/* Sysmenu callback with real callback set */
-	resp.sysmenu = false;
-	resp.sysmenu_idev_id = 0;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_sysmenu(window, 42);
-	PCUT_ASSERT_TRUE(resp.sysmenu);
-	PCUT_ASSERT_INT_EQUALS(42, resp.sysmenu_idev_id);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_minimize() calls minimize callback set via ui_window_set_cb() */
-PCUT_TEST(send_minimize)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Minimize callback with no callbacks set */
-	ui_window_send_minimize(window);
-
-	/* Minimize callback with minimize callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_minimize(window);
-
-	/* Minimize callback with real callback set */
-	resp.minimize = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_minimize(window);
-	PCUT_ASSERT_TRUE(resp.minimize);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_maximize() calls maximize callback set via ui_window_set_cb() */
-PCUT_TEST(send_maximize)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Maximize callback with no callbacks set */
-	ui_window_send_maximize(window);
-
-	/* Maximize callback with maximize callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_maximize(window);
-
-	/* Maximize callback with real callback set */
-	resp.maximize = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_maximize(window);
-	PCUT_ASSERT_TRUE(resp.maximize);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_unmaximize() calls unmaximize callback set via ui_window_set_cb() */
-PCUT_TEST(send_unmaximize)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Unmaximize callback with no callbacks set */
-	ui_window_send_unmaximize(window);
-
-	/* Unmaximize callback with unmaximize callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_unmaximize(window);
-
-	/* Unmaximize callback with real callback set */
-	resp.unmaximize = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_unmaximize(window);
-	PCUT_ASSERT_TRUE(resp.unmaximize);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_close() calls close callback set via ui_window_set_cb() */
-PCUT_TEST(send_close)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Close callback with no callbacks set */
-	ui_window_send_close(window);
-
-	/* Close callback with close callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_close(window);
-
-	/* Close callback with real callback set */
-	resp.close = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_close(window);
-	PCUT_ASSERT_TRUE(resp.close);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_focus() calls focus callback set via ui_window_set_cb() */
-PCUT_TEST(send_focus)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Focus callback with no callbacks set */
-	ui_window_send_focus(window, 42);
-
-	/* Focus callback with focus callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_focus(window, 42);
-
-	/* Focus callback with real callback set */
-	resp.focus = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_focus(window, 42);
-	PCUT_ASSERT_TRUE(resp.focus);
-	PCUT_ASSERT_INT_EQUALS(42, resp.focus_nfocus);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_kbd() calls kbd callback set via ui_window_set_cb() */
-PCUT_TEST(send_kbd)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	kbd_event_t kbd_event;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	kbd_event.type = KEY_PRESS;
-	kbd_event.key = KC_X;
-	kbd_event.mods = 0;
-	kbd_event.c = 'x';
-
-	/* Kbd callback with no callbacks set */
-	ui_window_send_kbd(window, &kbd_event);
-
-	/* Kbd callback with kbd callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_kbd(window, &kbd_event);
-
-	/* Kbd callback with real callback set */
-	resp.kbd = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_kbd(window, &kbd_event);
-	PCUT_ASSERT_TRUE(resp.kbd);
-	PCUT_ASSERT_EQUALS(kbd_event.type, resp.kbd_event.type);
-	PCUT_ASSERT_INT_EQUALS(kbd_event.key, resp.kbd_event.key);
-	PCUT_ASSERT_INT_EQUALS(kbd_event.mods, resp.kbd_event.mods);
-	PCUT_ASSERT_INT_EQUALS(kbd_event.c, resp.kbd_event.c);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_paint() calls paint callback set via ui_window_set_cb() */
-PCUT_TEST(send_paint)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Paint callback with no callbacks set */
-	ui_window_send_paint(window);
-
-	/* Paint callback with paint callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_paint(window);
-
-	/* Paint callback with real callback set */
-	resp.paint = false;
-	resp.rc = EOK;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	rc = ui_window_send_paint(window);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-	PCUT_ASSERT_TRUE(resp.paint);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_pos() calls pos callback set via ui_window_set_cb() */
-PCUT_TEST(send_pos)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	pos_event_t pos_event;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	pos_event.pos_id = 1;
-	pos_event.type = POS_PRESS;
-	pos_event.btn_num = 2;
-	pos_event.hpos = 3;
-	pos_event.vpos = 4;
-
-	/* Pos callback with no callbacks set */
-	ui_window_send_pos(window, &pos_event);
-
-	/* Pos callback with pos callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_pos(window, &pos_event);
-
-	/* Pos callback with real callback set */
-	resp.pos = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_pos(window, &pos_event);
-	PCUT_ASSERT_TRUE(resp.pos);
-	PCUT_ASSERT_INT_EQUALS(pos_event.pos_id, resp.pos_event.pos_id);
-	PCUT_ASSERT_EQUALS(pos_event.type, resp.pos_event.type);
-	PCUT_ASSERT_INT_EQUALS(pos_event.btn_num, resp.pos_event.btn_num);
-	PCUT_ASSERT_INT_EQUALS(pos_event.hpos, resp.pos_event.hpos);
-	PCUT_ASSERT_INT_EQUALS(pos_event.vpos, resp.pos_event.vpos);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_unfocus() calls unfocus callback set via ui_window_set_cb() */
-PCUT_TEST(send_unfocus)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Unfocus callback with no callbacks set */
-	ui_window_send_unfocus(window, 42);
-
-	/* Unfocus callback with unfocus callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_unfocus(window, 42);
-
-	/* Unfocus callback with real callback set */
-	resp.close = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_unfocus(window, 42);
-	PCUT_ASSERT_TRUE(resp.unfocus);
-	PCUT_ASSERT_INT_EQUALS(42, resp.unfocus_nfocus);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-/** ui_window_send_resize() calls resize callback set via ui_window_set_cb() */
-PCUT_TEST(send_resize)
-{
-	errno_t rc;
-	ui_t *ui = NULL;
-	ui_wnd_params_t params;
-	ui_window_t *window = NULL;
-	test_cb_resp_t resp;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_wnd_params_init(&params);
-	params.caption = "Hello";
-
-	rc = ui_window_create(ui, &params, &window);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(window);
-
-	/* Resize callback with no callbacks set */
-	ui_window_send_resize(window);
-
-	/* Resize callback with resize callback not implemented */
-	ui_window_set_cb(window, &dummy_window_cb, NULL);
-	ui_window_send_resize(window);
-
-	/* Resize callback with real callback set */
-	resp.close = false;
-	ui_window_set_cb(window, &test_window_cb, &resp);
-	ui_window_send_resize(window);
-	PCUT_ASSERT_TRUE(resp.resize);
-
-	ui_window_destroy(window);
-	ui_destroy(ui);
-}
-
-static void test_window_sysmenu(ui_window_t *window, void *arg, sysarg_t idev_id)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->sysmenu = true;
-	resp->sysmenu_idev_id = idev_id;
-}
-
-static void test_window_minimize(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->minimize = true;
-}
-
-static void test_window_maximize(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->maximize = true;
-}
-
-static void test_window_unmaximize(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->unmaximize = true;
-}
-
-static void test_window_close(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->close = true;
-}
-
-static void test_window_focus(ui_window_t *window, void *arg, unsigned nfocus)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->focus = true;
-	resp->focus_nfocus = nfocus;
-}
-
-static void test_window_kbd(ui_window_t *window, void *arg,
-    kbd_event_t *event)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->kbd = true;
-	resp->kbd_event = *event;
-}
-
-static errno_t test_window_paint(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static void test_window_pos(ui_window_t *window, void *arg,
-    pos_event_t *event)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->pos = true;
-	resp->pos_event = *event;
-}
-
-static void test_window_unfocus(ui_window_t *window, void *arg, unsigned nfocus)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->unfocus = true;
-	resp->unfocus_nfocus = nfocus;
-}
-
-static void test_window_resize(ui_window_t *window, void *arg)
-{
-	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
-
-	resp->resize = true;
-}
-
-static errno_t test_ctl_paint(void *arg)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->paint = true;
-	return resp->rc;
-}
-
-static ui_evclaim_t test_ctl_pos_event(void *arg, pos_event_t *event)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->pos = true;
-	resp->pos_event = *event;
-
-	return resp->claim;
-}
-
-static void test_ctl_unfocus(void *arg, unsigned nfocus)
-{
-	test_ctl_resp_t *resp = (test_ctl_resp_t *) arg;
-
-	resp->unfocus = true;
-	resp->unfocus_nfocus = nfocus;
-}
-
-PCUT_EXPORT(window);
Index: pace/lib/untar/doc/doxygroups.h
===================================================================
--- uspace/lib/untar/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libuntar libuntar
- * @ingroup libs
- */
Index: pace/lib/untar/meson.build
===================================================================
--- uspace/lib/untar/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,29 +1,0 @@
-#
-# Copyright (c) 2018 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('tar.c', 'untar.c')
Index: pace/lib/untar/private/tar.h
===================================================================
--- uspace/lib/untar/private/tar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libuntar
- * @{
- */
-/** @file
- */
-
-#ifndef TAR_H_
-#define TAR_H_
-
-#define TAR_BLOCK_SIZE 512
-
-typedef struct tar_header_raw {
-	char filename[100];
-	char permissions[8];
-	char owner[8];
-	char group[8];
-	char size[12];
-	char modification_time[12];
-	char checksum[8];
-	char type;
-	char name[100];
-	char ustar_magic[6];
-	char ustar_version[2];
-	char ustar_owner_name[32];
-	char ustar_group_name[32];
-	char ustar_device_major[8];
-	char ustar_device_minor[8];
-	char ustar_prefix[155];
-	char ignored[12];
-} tar_header_raw_t;
-
-typedef enum tar_type {
-	TAR_TYPE_UNKNOWN,
-	TAR_TYPE_NORMAL,
-	TAR_TYPE_DIRECTORY
-} tar_type_t;
-
-typedef struct tar_header {
-	char filename[100];
-	size_t size;
-	tar_type_t type;
-} tar_header_t;
-
-extern errno_t tar_header_parse(tar_header_t *, const tar_header_raw_t *);
-extern tar_type_t tar_type_parse(const char);
-extern const char *tar_type_str(tar_type_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/untar/tar.c
===================================================================
--- uspace/lib/untar/tar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,91 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libuntar
- * @{
- */
-/** @file
- */
-
-#include <str.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <errno.h>
-#include <assert.h>
-#include "private/tar.h"
-
-tar_type_t tar_type_parse(const char type)
-{
-	switch (type) {
-	case '0':
-	case 0:
-		return TAR_TYPE_NORMAL;
-	case '5':
-		return TAR_TYPE_DIRECTORY;
-	default:
-		return TAR_TYPE_UNKNOWN;
-	}
-}
-
-const char *tar_type_str(tar_type_t type)
-{
-	switch (type) {
-	case TAR_TYPE_UNKNOWN:
-		return "unknown";
-	case TAR_TYPE_NORMAL:
-		return "normal";
-	case TAR_TYPE_DIRECTORY:
-		return "directory";
-	default:
-		assert(false && "unexpected tar_type_t enum value");
-		return "?";
-	}
-}
-
-errno_t tar_header_parse(tar_header_t *parsed, const tar_header_raw_t *raw)
-{
-	if (str_length(raw->filename) == 0) {
-		return EEMPTY;
-	}
-
-	size_t size;
-	errno_t rc = str_size_t(raw->size, NULL, 8, true, &size);
-	if (rc != EOK) {
-		return rc;
-	}
-	parsed->size = size;
-
-	str_cpy(parsed->filename, 100, raw->filename);
-
-	parsed->type = tar_type_parse(raw->type);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/untar/untar.c
===================================================================
--- uspace/lib/untar/untar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,194 +1,0 @@
-/*
- * Copyright (c) 2013 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libuntar
- * @{
- */
-/** @file
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-#include "private/tar.h"
-#include "untar.h"
-
-static size_t get_block_count(size_t bytes)
-{
-	return (bytes + TAR_BLOCK_SIZE - 1) / TAR_BLOCK_SIZE;
-}
-
-static int tar_open(tar_file_t *tar)
-{
-	return tar->open(tar);
-}
-
-static void tar_close(tar_file_t *tar)
-{
-	tar->close(tar);
-}
-
-static size_t tar_read(tar_file_t *tar, void *data, size_t size)
-{
-	return tar->read(tar, data, size);
-}
-
-static void tar_report(tar_file_t *tar, const char *fmt, ...)
-{
-	va_list args;
-	va_start(args, fmt);
-
-	tar->vreport(tar, fmt, args);
-
-	va_end(args);
-}
-
-static errno_t tar_skip_blocks(tar_file_t *tar, size_t valid_data_size)
-{
-	size_t blocks_to_read = get_block_count(valid_data_size);
-
-	while (blocks_to_read > 0) {
-		uint8_t block[TAR_BLOCK_SIZE];
-		size_t actually_read = tar_read(tar, block, TAR_BLOCK_SIZE);
-		if (actually_read != TAR_BLOCK_SIZE)
-			return errno;
-
-		blocks_to_read--;
-	}
-
-	return EOK;
-}
-
-static errno_t tar_handle_normal_file(tar_file_t *tar,
-    const tar_header_t *header)
-{
-	// FIXME: create the directory first
-
-	FILE *file = fopen(header->filename, "wb");
-	if (file == NULL) {
-		tar_report(tar, "Failed to create %s: %s.\n", header->filename,
-		    str_error(errno));
-		return errno;
-	}
-
-	errno_t rc = EOK;
-	size_t bytes_remaining = header->size;
-	size_t blocks = get_block_count(bytes_remaining);
-
-	while (blocks > 0) {
-		uint8_t block[TAR_BLOCK_SIZE];
-		size_t actually_read = tar_read(tar, block, TAR_BLOCK_SIZE);
-		if (actually_read != TAR_BLOCK_SIZE) {
-			rc = errno;
-			tar_report(tar, "Failed to read block for %s: %s.\n",
-			    header->filename, str_error(rc));
-			break;
-		}
-
-		size_t to_write = TAR_BLOCK_SIZE;
-		if (bytes_remaining < TAR_BLOCK_SIZE)
-			to_write = bytes_remaining;
-
-		size_t actually_written = fwrite(block, 1, to_write, file);
-		if (actually_written != to_write) {
-			rc = errno;
-			tar_report(tar, "Failed to write to %s: %s.\n",
-			    header->filename, str_error(rc));
-			break;
-		}
-
-		blocks--;
-		bytes_remaining -= TAR_BLOCK_SIZE;
-	}
-
-	fclose(file);
-	return rc;
-}
-
-static errno_t tar_handle_directory(tar_file_t *tar, const tar_header_t *header)
-{
-	errno_t rc = vfs_link_path(header->filename, KIND_DIRECTORY, NULL);
-	if (rc != EOK) {
-		if (rc != EEXIST) {
-			tar_report(tar, "Failed to create directory %s: %s.\n",
-			    header->filename, str_error(rc));
-			return rc;
-		}
-	}
-
-	return tar_skip_blocks(tar, header->size);
-}
-
-int untar(tar_file_t *tar)
-{
-	int rc = tar_open(tar);
-	if (rc != EOK) {
-		tar_report(tar, "Failed to open: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	while (true) {
-		tar_header_raw_t header_raw;
-		size_t header_ok = tar_read(tar, &header_raw, sizeof(header_raw));
-		if (header_ok != sizeof(header_raw))
-			break;
-
-		tar_header_t header;
-		errno_t rc = tar_header_parse(&header, &header_raw);
-		if (rc == EEMPTY)
-			continue;
-
-		if (rc != EOK) {
-			tar_report(tar, "Failed parsing TAR header: %s.\n", str_error(rc));
-			break;
-		}
-
-		switch (header.type) {
-		case TAR_TYPE_DIRECTORY:
-			rc = tar_handle_directory(tar, &header);
-			break;
-		case TAR_TYPE_NORMAL:
-			rc = tar_handle_normal_file(tar, &header);
-			break;
-		default:
-			rc = tar_skip_blocks(tar, header.size);
-			break;
-		}
-
-		if (rc != EOK)
-			break;
-	}
-
-	tar_close(tar);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/lib/untar/untar.h
===================================================================
--- uspace/lib/untar/untar.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2018 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libuntar
- * @{
- */
-/** @file
- */
-
-#ifndef UNTAR_H_
-#define UNTAR_H_
-
-#include <stdlib.h>
-#include <stdarg.h>
-
-typedef struct tar_file {
-	void *data;
-
-	int (*open)(struct tar_file *);
-	void (*close)(struct tar_file *);
-
-	size_t (*read)(struct tar_file *, void *, size_t);
-	void (*vreport)(struct tar_file *, const char *, va_list);
-} tar_file_t;
-
-extern int untar(tar_file_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/uri/doc/doxygroups.h
===================================================================
--- uspace/lib/uri/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup uri liburi
- * @ingroup libs
- */
Index: pace/lib/uri/internal/ctype.h
===================================================================
--- uspace/lib/uri/internal/ctype.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uri
- * @{
- */
-/**
- * @file
- */
-
-#ifndef URI_CTYPE_H_
-#define URI_CTYPE_H_
-
-static inline bool is_unreserved(char c)
-{
-	return isalpha(c) || isdigit(c) ||
-	    c == '-' || c == '.' || c == '_' || c == '~';
-}
-
-static inline bool is_hexdig(char c)
-{
-	return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
-	    (c >= 'A' && c <= 'F');
-}
-
-static inline bool is_subdelim(char c)
-{
-	switch (c) {
-	case '!':
-	case '$':
-	case '&':
-	case '\'':
-	case '(':
-	case ')':
-	case '*':
-	case '+':
-	case ',':
-	case ';':
-	case '=':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_gendelim(char c)
-{
-	switch (c) {
-	case ':':
-	case '/':
-	case '?':
-	case '#':
-	case '[':
-	case ']':
-	case '@':
-		return true;
-	default:
-		return false;
-	}
-}
-
-static inline bool is_reserved(char c)
-{
-	return is_gendelim(c) || is_subdelim(c);
-}
-
-#endif
-
-/** @}
- */
Index: pace/lib/uri/meson.build
===================================================================
--- uspace/lib/uri/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('uri.c')
-
-test_src = files(
-	'test/main.c',
-	'test/parser.c',
-)
Index: pace/lib/uri/test/main.c
===================================================================
--- uspace/lib/uri/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(uri_parse);
-
-PCUT_MAIN();
Index: pace/lib/uri/test/parser.c
===================================================================
--- uspace/lib/uri/test/parser.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,141 +1,0 @@
-/*
- * Copyright (c) 2014 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../uri.h"
-
-typedef struct {
-	const char *scheme;
-	const char *user_info;
-	const char *user_credential;
-	const char *host;
-	const char *port;
-	const char *path;
-	const char *query;
-	const char *fragment;
-} const_uri_t;
-
-static const_uri_t expected_uri;
-static uri_t *parsed_uri;
-
-/*
- * In the following macros we assume that the expected and the parsed
- * URI are in the global variables declared above.
- */
-
-#define CHECK(item) \
-	PCUT_ASSERT_STR_EQUALS_OR_NULL(expected_uri.item, parsed_uri->item)
-
-#define PARSE_AND_CHECK(the_uri) \
-	do { \
-		parsed_uri = uri_parse(the_uri); \
-		PCUT_ASSERT_NOT_NULL(parsed_uri); \
-		PCUT_ASSERT_INT_EQUALS(0, !uri_validate(parsed_uri)); \
-		CHECK(scheme); \
-		CHECK(user_info); \
-		CHECK(user_credential); \
-		CHECK(host); \
-		CHECK(port); \
-		CHECK(path); \
-		CHECK(query); \
-		CHECK(fragment); \
-	} while (0)
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(uri_parse);
-
-PCUT_TEST_BEFORE
-{
-	parsed_uri = NULL;
-	expected_uri.scheme = NULL;
-	expected_uri.user_info = NULL;
-	expected_uri.user_credential = NULL;
-	expected_uri.host = NULL;
-	expected_uri.port = NULL;
-	expected_uri.path = "";
-	expected_uri.query = NULL;
-	expected_uri.fragment = NULL;
-}
-
-PCUT_TEST_AFTER
-{
-	if (parsed_uri != NULL) {
-		uri_destroy(parsed_uri);
-		parsed_uri = NULL;
-	}
-}
-
-PCUT_TEST(only_hostname)
-{
-	expected_uri.scheme = "http";
-	expected_uri.host = "localhost";
-
-	PARSE_AND_CHECK("http://localhost");
-}
-
-PCUT_TEST(hostname_with_user)
-{
-	expected_uri.scheme = "http";
-	expected_uri.host = "localhost";
-	expected_uri.user_info = "user";
-
-	PARSE_AND_CHECK("http://user@localhost");
-}
-
-PCUT_TEST(hostname_with_user_and_password)
-{
-	expected_uri.scheme = "https";
-	expected_uri.host = "localhost";
-	expected_uri.user_info = "user";
-	expected_uri.user_credential = "password";
-
-	PARSE_AND_CHECK("https://user:password@localhost");
-}
-
-PCUT_TEST(path_specification)
-{
-	expected_uri.scheme = "http";
-	expected_uri.host = "localhost";
-	expected_uri.path = "/alpha";
-
-	PARSE_AND_CHECK("http://localhost/alpha");
-}
-
-PCUT_TEST(with_fragment)
-{
-	expected_uri.scheme = "http";
-	expected_uri.host = "localhost";
-	expected_uri.path = "/alpha";
-	expected_uri.fragment = "fragment-name";
-
-	PARSE_AND_CHECK("http://localhost/alpha#fragment-name");
-}
-
-PCUT_EXPORT(uri_parse);
Index: pace/lib/uri/uri.c
===================================================================
--- uspace/lib/uri/uri.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,279 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uri
- * @{
- */
-/**
- * @file
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include "uri.h"
-#include "internal/ctype.h"
-
-static char *cut_str(const char *start, const char *end)
-{
-	size_t size = end - start;
-	return str_ndup(start, size);
-}
-
-uri_t *uri_parse(const char *str)
-{
-	uri_t *uri = malloc(sizeof(uri_t));
-	if (uri == NULL)
-		return NULL;
-	memset(uri, 0, sizeof(uri_t));
-
-	/* scheme ":" */
-	const char *scheme = str;
-	while (*str != 0 && *str != ':')
-		str++;
-	if (*str == 0) {
-		uri_destroy(uri);
-		return NULL;
-	}
-	uri->scheme = cut_str(scheme, str);
-
-	/* skip the colon */
-	str++;
-
-	if (*str == '/' && str[1] == '/') {
-		/* "//" [user-info [":" user-credential] "@"] host [":" port] */
-		str++;
-		str++;
-		const char *authority_start = str;
-
-		char *host_or_user_info = NULL;
-		char *port_or_user_credential = NULL;
-
-		while (*str != 0 && *str != '?' && *str != '#' && *str != '@' &&
-		    *str != ':' && *str != '/')
-			str++;
-
-		host_or_user_info = cut_str(authority_start, str);
-		if (*str == ':') {
-			str++;
-			const char *second_part = str;
-			while (*str != 0 && *str != '?' && *str != '#' &&
-			    *str != '@' && *str != '/')
-				str++;
-			port_or_user_credential = cut_str(second_part, str);
-		}
-
-		if (*str == '@') {
-			uri->user_info = host_or_user_info;
-			uri->user_credential = port_or_user_credential;
-
-			str++;
-			const char *host_start = str;
-			while (*str != 0 && *str != '?' && *str != '#' &&
-			    *str != ':' && *str != '/')
-				str++;
-			uri->host = cut_str(host_start, str);
-
-			if (*str == ':') {
-				str++;
-				const char *port_start = str;
-				while (*str != 0 && *str != '?' && *str != '#' && *str != '/')
-					str++;
-				uri->port = cut_str(port_start, str);
-			}
-		} else {
-			uri->host = host_or_user_info;
-			uri->port = port_or_user_credential;
-		}
-	}
-
-	const char *path_start = str;
-	while (*str != 0 && *str != '?' && *str != '#')
-		str++;
-	uri->path = cut_str(path_start, str);
-
-	if (*str == '?') {
-		str++;
-		const char *query_start = str;
-		while (*str != 0 && *str != '#')
-			str++;
-		uri->query = cut_str(query_start, str);
-	}
-
-	if (*str == '#') {
-		str++;
-		const char *fragment_start = str;
-		while (*str != 0)
-			str++;
-		uri->fragment = cut_str(fragment_start, str);
-	}
-
-	assert(*str == 0);
-	return uri;
-}
-
-/** Parse the URI scheme
- *
- * @param endptr The position of the first character after the scheme
- *               is stored there.
- * @return EOK on success
- */
-errno_t uri_scheme_parse(const char *str, const char **endptr)
-{
-	if (*str == 0) {
-		*endptr = str;
-		return ELIMIT;
-	}
-
-	if (!isalpha(*str)) {
-		*endptr = str;
-		return EINVAL;
-	}
-
-	while (isalpha(*str) || isdigit(*str) ||
-	    *str == '+' || *str == '-' || *str == '.') {
-		str++;
-	}
-
-	*endptr = str;
-	return EOK;
-}
-
-/** Determine if the URI scheme is valid
- *
- */
-bool uri_scheme_validate(const char *str)
-{
-	const char *endptr = NULL;
-	if (uri_scheme_parse(str, &endptr) != EOK)
-		return false;
-	return *endptr == 0;
-}
-
-errno_t uri_percent_parse(const char *str, const char **endptr,
-    uint8_t *decoded)
-{
-	*endptr = str;
-	if (str[0] == 0 || str[1] == 0 || str[2] == 0)
-		return ELIMIT;
-
-	if (str[0] != '%' || !is_hexdig(str[1]) || !is_hexdig(str[2]))
-		return EINVAL;
-
-	if (decoded != NULL) {
-		errno_t rc = str_uint8_t(str + 1, NULL, 16, true, decoded);
-		if (rc != EOK)
-			return rc;
-	}
-
-	*endptr = str + 3;
-	return EOK;
-}
-
-errno_t uri_user_info_parse(const char *str, const char **endptr)
-{
-	while (*str != 0) {
-		while (is_unreserved(*str) || is_subdelim(*str) || *str == ':')
-			str++;
-		if (*str == 0)
-			break;
-		errno_t rc = uri_percent_parse(str, &str, NULL);
-		if (rc != EOK) {
-			*endptr = str;
-			return rc;
-		}
-	}
-
-	*endptr = str;
-	return EOK;
-}
-
-bool uri_user_info_validate(const char *str)
-{
-	const char *endptr = NULL;
-	if (uri_user_info_parse(str, &endptr) != EOK)
-		return false;
-	return *endptr == 0;
-}
-
-errno_t uri_port_parse(const char *str, const char **endptr)
-{
-	if (*str == 0)
-		return ELIMIT;
-	if (!isdigit(*str))
-		return EINVAL;
-	while (isdigit(*str))
-		str++;
-	*endptr = str;
-	return EOK;
-}
-
-bool uri_port_validate(const char *str)
-{
-	const char *endptr = NULL;
-	if (uri_port_parse(str, &endptr) != EOK)
-		return false;
-	return *endptr == 0;
-}
-
-bool uri_validate(uri_t *uri)
-{
-	if (uri->scheme && !uri_scheme_validate(uri->scheme))
-		return false;
-
-	if (uri->user_info && !uri_user_info_validate(uri->user_info))
-		return false;
-
-	if (uri->user_credential && !uri_user_info_validate(uri->user_credential))
-		return false;
-
-	if (uri->port && !uri_port_validate(uri->port))
-		return false;
-
-	return true;
-}
-
-void uri_destroy(uri_t *uri)
-{
-	free(uri->scheme);
-	free(uri->user_info);
-	free(uri->user_credential);
-	free(uri->host);
-	free(uri->port);
-	free(uri->path);
-	free(uri->query);
-	free(uri->fragment);
-	free(uri);
-}
-
-/** @}
- */
Index: pace/lib/uri/uri.h
===================================================================
--- uspace/lib/uri/uri.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uri
- * @{
- */
-/**
- * @file
- */
-
-#ifndef URI_URI_H_
-#define URI_URI_H_
-
-typedef struct {
-	char *scheme;
-	char *user_info;
-	char *user_credential;
-	char *host;
-	char *port;
-	char *path;
-	char *query;
-	char *fragment;
-} uri_t;
-
-extern uri_t *uri_parse(const char *);
-extern errno_t uri_scheme_parse(const char *, const char **);
-extern bool uri_scheme_validate(const char *);
-extern errno_t uri_percent_parse(const char *, const char **, uint8_t *);
-extern errno_t uri_user_info_parse(const char *, const char **);
-extern bool uri_user_info_validate(const char *);
-extern errno_t uri_port_parse(const char *, const char **);
-extern bool uri_port_validate(const char *);
-extern bool uri_validate(uri_t *);
-extern void uri_destroy(uri_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/usb/include/usb/classes/classes.h
===================================================================
--- uspace/lib/usb/include/usb/classes/classes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * USB device classes (generic constants and functions).
- */
-#ifndef LIBUSB_CLASSES_H_
-#define LIBUSB_CLASSES_H_
-
-/** USB device class. */
-typedef enum {
-	USB_CLASS_USE_INTERFACE = 0x00,
-	USB_CLASS_AUDIO = 0x01,
-	USB_CLASS_COMMUNICATIONS_CDC_CONTROL = 0x02,
-	USB_CLASS_HID = 0x03,
-	USB_CLASS_PHYSICAL = 0x05,
-	USB_CLASS_IMAGE = 0x06,
-	USB_CLASS_PRINTER = 0x07,
-	USB_CLASS_MASS_STORAGE = 0x08,
-	USB_CLASS_HUB = 0x09,
-	USB_CLASS_CDC_DATA = 0x0A,
-	USB_CLASS_SMART_CARD = 0x0B,
-	USB_CLASS_CONTENT_SECURITY = 0x0D,
-	USB_CLASS_VIDEO = 0x0E,
-	USB_CLASS_PERSONAL_HEALTHCARE = 0x0F,
-	USB_CLASS_DIAGNOSTIC = 0xDC,
-	USB_CLASS_WIRELESS_CONTROLLER = 0xE0,
-	USB_CLASS_MISCELLANEOUS = 0xEF,
-	USB_CLASS_APPLICATION_SPECIFIC = 0xFE,
-	USB_CLASS_VENDOR_SPECIFIC = 0xFF,
-	/* USB_CLASS_ = 0x, */
-} usb_class_t;
-
-const char *usb_str_class(usb_class_t);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/classes/hub.h
===================================================================
--- uspace/lib/usb/include/usb/classes/hub.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- * Copyright (c) 2010 Matus Dekanek
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB hub related structures.
- */
-#ifndef LIBUSB_CLASS_HUB_H_
-#define LIBUSB_CLASS_HUB_H_
-
-#include <stdint.h>
-
-/** Hub class feature selector.
- * @warning The constants are not unique (feature selectors are used
- * for hub and port).
- */
-typedef enum {
-	USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
-	USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
-	USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
-	USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
-	USB_HUB_FEATURE_PORT_CONNECTION = 0,
-	USB2_HUB_FEATURE_PORT_ENABLE = 1,
-	USB2_HUB_FEATURE_PORT_SUSPEND = 2,
-	USB_HUB_FEATURE_PORT_OVER_CURRENT = 3,
-	USB_HUB_FEATURE_PORT_RESET = 4,
-	USB3_HUB_FEATURE_PORT_LINK_STATE = 5,
-	USB_HUB_FEATURE_PORT_POWER = 8,
-	USB2_HUB_FEATURE_PORT_LOW_SPEED = 9,
-	USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
-	USB2_HUB_FEATURE_C_PORT_ENABLE = 17,
-	USB2_HUB_FEATURE_C_PORT_SUSPEND = 18,
-	USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
-	USB_HUB_FEATURE_C_PORT_RESET = 20,
-	USB2_HUB_FEATURE_PORT_TEST = 21,
-	USB2_HUB_FEATURE_PORT_INDICATOR = 22,
-	USB3_HUB_FEATURE_C_PORT_LINK_STATE = 25,
-	USB3_HUB_FEATURE_BH_PORT_RESET = 28,
-	USB3_HUB_FEATURE_C_BH_PORT_RESET = 29,
-	/* USB_HUB_FEATURE_ = , */
-} usb_hub_class_feature_t;
-
-/**
- * Dword holding port status and changes flags.
- *
- * For more information refer to tables 11-15 and 11-16 in
- * "Universal Serial Bus Specification Revision 1.1" pages 274 and 277
- * (290 and 293 in pdf)
- *
- * Beware that definition of bits changed between USB 2 and 3,
- * so some fields are prefixed with USB2 or USB3 instead.
- */
-typedef uint32_t usb_port_status_t;
-
-#define USB_HUB_PORT_STATUS_BIT(bit)  (uint32_usb2host(1 << (bit)))
-#define USB_HUB_PORT_STATUS_CONNECTION		USB_HUB_PORT_STATUS_BIT(0)
-#define USB_HUB_PORT_STATUS_ENABLE		USB_HUB_PORT_STATUS_BIT(1)
-#define USB2_HUB_PORT_STATUS_SUSPEND		USB_HUB_PORT_STATUS_BIT(2)
-#define USB_HUB_PORT_STATUS_OC			USB_HUB_PORT_STATUS_BIT(3)
-#define USB_HUB_PORT_STATUS_RESET		USB_HUB_PORT_STATUS_BIT(4)
-
-#define USB2_HUB_PORT_STATUS_POWER		USB_HUB_PORT_STATUS_BIT(8)
-#define USB2_HUB_PORT_STATUS_LOW_SPEED		USB_HUB_PORT_STATUS_BIT(9)
-#define USB3_HUB_PORT_STATUS_POWER		USB_HUB_PORT_STATUS_BIT(9)
-#define USB2_HUB_PORT_STATUS_HIGH_SPEED		USB_HUB_PORT_STATUS_BIT(10)
-#define USB2_HUB_PORT_STATUS_TEST		USB_HUB_PORT_STATUS_BIT(11)
-#define USB2_HUB_PORT_STATUS_INDICATOR		USB_HUB_PORT_STATUS_BIT(12)
-
-#define USB_HUB_PORT_STATUS_C_CONNECTION	USB_HUB_PORT_STATUS_BIT(16)
-#define USB2_HUB_PORT_STATUS_C_ENABLE		USB_HUB_PORT_STATUS_BIT(17)
-#define USB2_HUB_PORT_STATUS_C_SUSPEND		USB_HUB_PORT_STATUS_BIT(18)
-#define USB_HUB_PORT_STATUS_C_OC		USB_HUB_PORT_STATUS_BIT(19)
-#define USB_HUB_PORT_STATUS_C_RESET		USB_HUB_PORT_STATUS_BIT(20)
-#define USB3_HUB_PORT_STATUS_C_BH_RESET		USB_HUB_PORT_STATUS_BIT(21)
-#define USB3_HUB_PORT_STATUS_C_LINK_STATE	USB_HUB_PORT_STATUS_BIT(22)
-#define USB3_HUB_PORT_STATUS_C_CONFIG_ERROR	USB_HUB_PORT_STATUS_BIT(23)
-
-/** Header of standard hub descriptor without the "variadic" part. */
-typedef struct {
-	/** Descriptor length. */
-	uint8_t length;
-
-	/** Descriptor type (0x29 or 0x2a for superspeed hub). */
-	uint8_t descriptor_type;
-
-	/** Number of downstream ports. */
-	uint8_t port_count;
-
-	/** Characteristics bitmask.
-	 *
-	 *  D1..D0: Logical Power Switching Mode
-	 *  00: Ganged power switching (all ports power at
-	 *  once)
-	 *  01: Individual port power switching
-	 *  1X: Reserved. Used only on 1.0 compliant hubs
-	 *  that implement no power switching.
-	 *  D2: Identifies a Compound Device
-	 *  0: Hub is not part of a compound device
-	 *  1: Hub is part of a compound device
-	 *  D4..D3: Over-current Protection Mode
-	 *  00: Global Over-current Protection. The hub
-	 *  reports over-current as a summation of all
-	 *  ports current draw, without a breakdown of
-	 *  individual port over-current status.
-	 *  01: Individual Port Over-current Protection. The
-	 *  hub reports over-current on a per-port basis.
-	 *  Each port has an over-current indicator.
-	 *  1X: No Over-current Protection. This option is
-	 *  allowed only for bus-powered hubs that do not
-	 *  implement over-current protection.
-	 *  D6..D5: TT think time
-	 *  00: At most 8 FS bit times
-	 *  01: At most 16 FS bit times
-	 *  10: At most 24 FS bit times
-	 *  11: At most 32 FS bit times
-	 *  D7: Port indicators
-	 *  0: Not supported
-	 *  1: Supported
-	 *  D15...D8: Reserved
-	 */
-	uint8_t characteristics;
-
-	/** Unused part of characteristics field */
-	uint8_t characteristics_reserved;
-
-	/** Time from power-on to stabilization of current on the port.
-	 *
-	 *  Time (in 2ms intervals) from the time the power-on
-	 *  sequence begins on a port until power is good on that
-	 *  port. The USB System Software uses this value to
-	 *  determine how long to wait before accessing a
-	 *  powered-on port.
-	 */
-	uint8_t power_good_time;
-	/** Maximum current requirements in mA.
-	 *
-	 *  Maximum current requirements of the Hub Controller
-	 *  electronics in mA.
-	 */
-	uint8_t max_current;
-} __attribute__((packed)) usb_hub_descriptor_header_t;
-
-/*
- * USB hub characteristics
- */
-#define HUB_CHAR_POWER_PER_PORT_FLAG    (1 << 0)
-#define HUB_CHAR_NO_POWER_SWITCH_FLAG   (1 << 1)
-#define HUB_CHAR_COMPOUND_DEVICE        (1 << 2)
-#define HUB_CHAR_OC_PER_PORT_FLAG       (1 << 3)
-#define HUB_CHAR_NO_OC_FLAG             (1 << 4)
-
-/* These are invalid for superspeed hub */
-#define HUB_CHAR_TT_THINK_16            (1 << 5)
-#define HUB_CHAR_TT_THINK_8             (1 << 6)
-#define HUB_CHAR_INDICATORS_FLAG        (1 << 7)
-
-/** One bit for the device and one bit for every port */
-#define STATUS_BYTES(ports) ((1 + ports + 7) / 8)
-
-/**
- * @brief usb hub specific request types.
- */
-typedef enum {
-	/** This request resets a value reported in the hub status. */
-	USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE = 0x20,
-	/** This request resets a value reported in the port status. */
-	USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE = 0x23,
-	/**
-	 * This is an optional per-port diagnostic request that returns the bus
-	 * state value, as sampled at the last EOF2 point.
-	 */
-	USB_HUB_REQ_TYPE_GET_STATE = 0xA3,
-	/** This request returns the hub descriptor. */
-	USB_HUB_REQ_TYPE_GET_DESCRIPTOR = 0xA0,
-	/**
-	 * This request returns the current hub status and the states that have
-	 * changed since the previous acknowledgment.
-	 */
-	USB_HUB_REQ_TYPE_GET_HUB_STATUS = 0xA0,
-	/**
-	 * This request returns the current port status and the current value of the
-	 * port status change bits.
-	 */
-	USB_HUB_REQ_TYPE_GET_PORT_STATUS = 0xA3,
-	/** This request overwrites the hub descriptor. */
-	USB_HUB_REQ_TYPE_SET_DESCRIPTOR = 0x20,
-	/** This request sets a value reported in the hub status. */
-	USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20,
-	/**
-	 * This request sets the value that the hub uses to determine the index
-	 * into the Route String Index for the hub.
-	 */
-	USB_HUB_REQ_TYPE_SET_HUB_DEPTH = 0x20,
-	/** This request sets a value reported in the port status. */
-	USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23,
-} usb_hub_bm_request_type_t;
-
-/**
- * @brief hub class request codes
- */
-typedef enum {
-	USB_HUB_REQUEST_GET_STATUS = 0,
-	USB_HUB_REQUEST_CLEAR_FEATURE = 1,
-	/** USB 1.0 only */
-	USB_HUB_REQUEST_GET_STATE = 2,
-	USB_HUB_REQUEST_SET_FEATURE = 3,
-	USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
-	USB_HUB_REQUEST_SET_DESCRIPTOR = 7,
-	USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8,
-	USB_HUB_REQUEST_RESET_TT = 9,
-	USB_HUB_GET_TT_STATE = 10,
-	USB_HUB_STOP_TT = 11,
-	/** USB 3+ only */
-	USB_HUB_REQUEST_SET_HUB_DEPTH = 12,
-} usb_hub_request_t;
-
-/**
- * Maximum size of usb hub descriptor in bytes
- */
-/* 7 (basic size) + 2*32 (port bitmasks) */
-#define USB_HUB_MAX_DESCRIPTOR_SIZE  (7 + 2 * 32)
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/classes/massstor.h
===================================================================
--- uspace/lib/usb/include/usb/classes/massstor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * USB mass storage related functions and constants.
- */
-#ifndef LIBUSB_CLASS_MASSSTOR_H_
-#define LIBUSB_CLASS_MASSSTOR_H_
-
-/** USB mass storage subclasses. */
-typedef enum {
-	USB_MASSSTOR_SUBCLASS_RBC = 0x01,
-	/** Also known as MMC-5. */
-	USB_MASSSTOR_SUBCLASS_ATAPI = 0x02,
-	USB_MASSSTOR_SUBCLASS_UFI = 0x04,
-	USB_MASSSTOR_SUBCLASS_SCSI = 0x06,
-	USB_MASSSTOR_SUBCLASS_LSDFS = 0x07,
-	USB_MASSSTOR_SUBCLASS_IEEE1667 = 0x08,
-	USB_MASSSTOR_SUBCLASS_VENDOR = 0xFF
-} usb_massstor_subclass_t;
-
-/** USB mass storage interface protocols. */
-typedef enum {
-	/** CBI transport with command completion interrupt. */
-	USB_MASSSTOR_PROTOCOL_CBI_CC = 0x00,
-	/** CBI transport with no command completion interrupt. */
-	USB_MASSSTOR_PROTOCOL_CBI = 0x01,
-	/** Bulk only transport. */
-	USB_MASSSTOR_PROTOCOL_BBB = 0x50,
-	/** USB attached SCSI. */
-	USB_MASSSTOR_PROTOCOL_UAS = 0x62,
-	USB_MASSSTOR_PROTOCOL_VENDOR = 0xFF
-} usb_massstor_protocol_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/debug.h
===================================================================
--- uspace/lib/usb/include/usb/debug.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2010-2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Debugging related functions.
- */
-#ifndef LIBUSB_DEBUG_H_
-#define LIBUSB_DEBUG_H_
-#include <stdio.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <io/log.h>
-
-void usb_dump_standard_descriptor(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-
-#define USB_LOG_LEVEL_FATAL LVL_FATAL
-#define USB_LOG_LEVEL_ERROR LVL_ERROR
-#define USB_LOG_LEVEL_WARNING LVL_WARN
-#define USB_LOG_LEVEL_INFO LVL_NOTE
-#define USB_LOG_LEVEL_DEBUG LVL_DEBUG
-#define USB_LOG_LEVEL_DEBUG2 LVL_DEBUG2
-
-#define usb_log_printf(level, format, ...) \
-	log_msg(LOG_DEFAULT, level, format, ##__VA_ARGS__)
-
-/** Log fatal error. */
-#define usb_log_fatal(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_FATAL, format, ##__VA_ARGS__)
-
-/** Log normal (recoverable) error. */
-#define usb_log_error(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_ERROR, format, ##__VA_ARGS__)
-
-/** Log warning. */
-#define usb_log_warning(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_WARNING, format, ##__VA_ARGS__)
-
-/** Log informational message. */
-#define usb_log_info(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_INFO, format, ##__VA_ARGS__)
-
-/** Log debugging message. */
-#define usb_log_debug(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_DEBUG, format, ##__VA_ARGS__)
-
-/** Log verbose debugging message. */
-#define usb_log_debug2(format, ...) \
-	usb_log_printf(USB_LOG_LEVEL_DEBUG2, format, ##__VA_ARGS__)
-
-const char *usb_debug_str_buffer(const uint8_t *, size_t, size_t);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/descriptor.h
===================================================================
--- uspace/lib/usb/include/usb/descriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,304 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2018 Michal Staruch, Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Standard USB descriptors.
- */
-#ifndef LIBUSB_DESCRIPTOR_H_
-#define LIBUSB_DESCRIPTOR_H_
-
-#include <stdint.h>
-
-/** Descriptor type. */
-typedef enum {
-	USB_DESCTYPE_DEVICE = 1,
-	USB_DESCTYPE_CONFIGURATION = 2,
-	USB_DESCTYPE_STRING = 3,
-	USB_DESCTYPE_INTERFACE = 4,
-	USB_DESCTYPE_ENDPOINT = 5,
-	/* New in USB 2.0 */
-	USB_DESCTYPE_DEVICE_QUALIFIER = 6,
-	USB_DESCTYPE_OTHER_SPEED_CONFIGURATION = 7,
-	USB_DESCTYPE_INTERFACE_POWER = 8,
-	/* USB 3.0 types */
-	USB_DESCTYPE_OTG = 9,
-	USB_DESCTYPE_DEBUG = 0xa,
-	USB_DESCTYPE_IFACE_ASSOC = 0xb,
-	USB_DESCTYPE_BOS = 0xf,
-	USB_DESCTYPE_DEVICE_CAP = 0x10,
-	/* Class specific */
-	USB_DESCTYPE_HID = 0x21,
-	USB_DESCTYPE_HID_REPORT = 0x22,
-	USB_DESCTYPE_HID_PHYSICAL = 0x23,
-	USB_DESCTYPE_HUB = 0x29,
-	USB_DESCTYPE_SSPEED_HUB = 0x2a,
-	USB_DESCTYPE_SSPEED_EP_COMPANION = 0x30
-	/* USB_DESCTYPE_ = */
-} usb_descriptor_type_t;
-
-/** Standard USB device descriptor.
- */
-typedef struct {
-	/** Size of this descriptor in bytes. */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_DEVICE). */
-	uint8_t descriptor_type;
-	/** USB specification release number.
-	 * The number shall be coded as binary-coded decimal (BCD).
-	 */
-	uint16_t usb_spec_version;
-	/** Device class. */
-	uint8_t device_class;
-	/** Device sub-class. */
-	uint8_t device_subclass;
-	/** Device protocol. */
-	uint8_t device_protocol;
-	/** Maximum packet size for endpoint zero.
-	 * Valid values are only 8, 16, 32, 64).
-	 */
-	uint8_t max_packet_size;
-	/** Vendor ID. */
-	uint16_t vendor_id;
-	/** Product ID. */
-	uint16_t product_id;
-	/** Device release number (in BCD). */
-	uint16_t device_version;
-	/** Manufacturer descriptor index. */
-	uint8_t str_manufacturer;
-	/** Product descriptor index. */
-	uint8_t str_product;
-	/** Device serial number descriptor index. */
-	uint8_t str_serial_number;
-	/** Number of possible configurations. */
-	uint8_t configuration_count;
-} __attribute__((packed)) usb_standard_device_descriptor_t;
-
-/** USB device qualifier decriptor is basically a cut down version of the device
- * descriptor with values that would be valid if the device operated on the
- * other speed (HIGH vs. FULL)
- */
-typedef struct {
-	/** Size of this descriptor in bytes */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_DEVICE_QUALIFIER) */
-	uint8_t descriptor_type;
-	/** USB specification release number.
-	 * The number shall be coded as binary-coded decimal (BCD).
-	 */
-	uint16_t usb_spec_version;
-	/** Device class. */
-	uint8_t device_class;
-	/** Device sub-class. */
-	uint8_t device_subclass;
-	/** Device protocol. */
-	uint8_t device_protocol;
-	/** Maximum packet size for endpoint zero.
-	 * Valid values are only 8, 16, 32, 64).
-	 */
-	uint8_t max_packet_size;
-	/** Number of possible configurations. */
-	uint8_t configuration_count;
-	uint8_t reserved;
-} __attribute__((packed)) usb_standard_device_qualifier_descriptor_t;
-
-/** Standard USB configuration descriptor.
- */
-typedef struct {
-	/** Size of this descriptor in bytes. */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_CONFIGURATION). */
-	uint8_t descriptor_type;
-	/** Total length of all data of this configuration.
-	 * This includes the combined length of all descriptors
-	 * (configuration, interface, endpoint, class-specific and
-	 * vendor-specific) valid for this configuration.
-	 */
-	uint16_t total_length;
-	/** Number of possible interfaces under this configuration. */
-	uint8_t interface_count;
-	/** Configuration value used when setting this configuration. */
-	uint8_t configuration_number;
-	/** String descriptor describing this configuration. */
-	uint8_t str_configuration;
-	/** Attribute bitmap. */
-	uint8_t attributes;
-	/** Maximum power consumption from the USB under this configuration.
-	 * Expressed in 2mA unit (e.g. 50 ~ 100mA).
-	 */
-	uint8_t max_power;
-} __attribute__((packed)) usb_standard_configuration_descriptor_t;
-
-/** USB Other Speed Configuration descriptor shows values that would change
- * in the configuration descriptor if the device operated at its other
- * possible speed (HIGH vs. FULL)
- */
-typedef usb_standard_configuration_descriptor_t
-    usb_other_speed_configuration_descriptor_t;
-
-/** Standard USB interface descriptor.
- */
-typedef struct {
-	/** Size of this descriptor in bytes. */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_INTERFACE). */
-	uint8_t descriptor_type;
-	/** Number of interface.
-	 * Zero-based index into array of interfaces for current configuration.
-	 */
-	uint8_t interface_number;
-	/** Alternate setting for value in interface_number. */
-	uint8_t alternate_setting;
-	/** Number of endpoints used by this interface.
-	 * This number must exclude usage of endpoint zero
-	 * (default control pipe).
-	 */
-	uint8_t endpoint_count;
-	/** Class code. */
-	uint8_t interface_class;
-	/** Subclass code. */
-	uint8_t interface_subclass;
-	/** Protocol code. */
-	uint8_t interface_protocol;
-	/** String descriptor describing this interface. */
-	uint8_t str_interface;
-} __attribute__((packed)) usb_standard_interface_descriptor_t;
-
-/** Standard USB endpoint descriptor.
- */
-typedef struct {
-	/** Size of this descriptor in bytes. */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_ENDPOINT). */
-	uint8_t descriptor_type;
-	/** Endpoint address together with data flow direction. */
-	uint8_t endpoint_address;
-#define USB_ED_GET_EP(ed)	((ed).endpoint_address & 0xf)
-#define USB_ED_GET_DIR(ed)	(!(((ed).endpoint_address >> 7) & 0x1))
-
-	/** Endpoint attributes.
-	 * Includes transfer type (usb_transfer_type_t).
-	 */
-	uint8_t attributes;
-#define USB_ED_GET_TRANSFER_TYPE(ed)	((ed).attributes & 0x3)
-	/** Maximum packet size.
-	 * Lower 10 bits represent the actuall size
-	 * Bits 11,12 specify addtional transfer opportunitities for
-	 * HS INT and ISO transfers.
-	 */
-	uint16_t max_packet_size;
-#define USB_ED_GET_MPS(ed) \
-	(uint16_usb2host((ed).max_packet_size) & 0x7ff)
-#define USB_ED_GET_ADD_OPPS(ed) \
-	((uint16_usb2host((ed).max_packet_size) >> 11) & 0x3)
-	/** Polling interval. Different semantics for various (speed, type)
-	 * pairs.
-	 */
-	uint8_t poll_interval;
-} __attribute__((packed)) usb_standard_endpoint_descriptor_t;
-
-/** Superspeed USB endpoint companion descriptor.
- * See USB 3 specification, section 9.6.7.
- */
-typedef struct {
-	/** Size of this descriptor in bytes */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_SSPEED_EP_COMPANION). */
-	uint8_t descriptor_type;
-	/** The maximum number of packets the endpoint can send
-	 * or receive as part of a burst. Valid values are from 0 to 15.
-	 * The endpoint can only burst max_burst + 1 packets at a time.
-	 */
-	uint8_t max_burst;
-	/** Valid only for bulk and isochronous endpoints.
-	 * For bulk endpoints, this field contains the amount of streams
-	 * supported by the endpoint.
-	 * For isochronous endpoints, this field contains maximum
-	 * number of packets supported within a service interval.
-	 * Warning: the values returned by macros may not make any sense
-	 * for specific endpoint types.
-	 */
-	uint8_t attributes;
-#define USB_SSC_MAX_STREAMS(sscd) ((sscd).attributes & 0x1f)
-#define USB_SSC_MULT(sscd) ((sscd).attributes & 0x3)
-	/** The total number of bytes this endpoint will transfer
-	 * every service interval (SI).
-	 * This field is only valid for periodic endpoints.
-	 */
-	uint16_t bytes_per_interval;
-} __attribute__((packed)) usb_superspeed_endpoint_companion_descriptor_t;
-
-/** Part of standard USB HID descriptor specifying one class descriptor.
- *
- * (See HID Specification, p.22)
- */
-typedef struct {
-	/** Type of class-specific descriptor (Report or Physical). */
-	uint8_t type;
-	/** Length of class-specific descriptor in bytes. */
-	uint16_t length;
-} __attribute__((packed)) usb_standard_hid_class_descriptor_info_t;
-
-/** Standard USB HID descriptor.
- *
- * (See HID Specification, p.22)
- *
- * It is actually only the "header" of the descriptor, it does not contain
- * the last two mandatory fields (type and length of the first class-specific
- * descriptor).
- */
-typedef struct {
-	/** Total size of this descriptor in bytes.
-	 *
-	 * This includes all class-specific descriptor info - type + length
-	 * for each descriptor.
-	 */
-	uint8_t length;
-	/** Descriptor type (USB_DESCTYPE_HID). */
-	uint8_t descriptor_type;
-	/** HID Class Specification release. */
-	uint16_t spec_release;
-	/** Country code of localized hardware. */
-	uint8_t country_code;
-	/** Total number of class-specific (i.e. Report and Physical)
-	 * descriptors.
-	 *
-	 * @note There is always only one Report descriptor.
-	 */
-	uint8_t class_desc_count;
-	/** First mandatory class descriptor (Report) info. */
-	usb_standard_hid_class_descriptor_info_t report_desc_info;
-} __attribute__((packed)) usb_standard_hid_descriptor_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/dev.h
===================================================================
--- uspace/lib/usb/include/usb/dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-
-/** @file
- * Common USB types and functions.
- */
-
-#ifndef LIBUSB_DEV_H_
-#define LIBUSB_DEV_H_
-
-#include <devman.h>
-
-extern errno_t usb_resolve_device_handle(const char *, devman_handle_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/dma_buffer.h
===================================================================
--- uspace/lib/usb/include/usb/dma_buffer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB host controller library: DMA buffer helpers
- *
- * Simplifies handling of buffers accessible to hardware. Defines properties of
- * such buffer, which can be communicated through IPC to allow higher layers to
- * allocate a buffer that is ready to be passed to HW right away (after being
- * shared through IPC).
- *
- * Currently, it is possible to allocate either completely contiguous buffers
- * (with dma_map_anonymous) or arbitrary memory (with as_area_create). Shall the
- * kernel be updated, this is a subject of major optimization of memory usage.
- * The other way to do it without the kernel is building an userspace IO vector
- * in a similar way how QEMU does it.
- *
- * The structures themselves are defined in usbhc_iface, because they need to be
- * passed through IPC.
- */
-#ifndef LIB_USB_DMA_BUFFER
-#define LIB_USB_DMA_BUFFER
-
-#include <as.h>
-#include <bitops.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <usbhc_iface.h>
-
-/**
- * The DMA policy describes properties of the buffer. It is used in two
- * different contexts. Either it represents requirements, which shall be
- * satisfied to avoid copying the buffer to a more strict one. Or, it is the
- * actual property of the buffer, which can be more strict than requested. It
- * always holds that more bits set means more restrictive policy, and that by
- * computing a bitwise OR one gets the restriction that holds for both.
- *
- * The high bits of a DMA policy represent a physical contiguity. If bit i is
- * set, it means that chunks of a size 2^(i+1) are contiguous in memory. It
- * shall never happen that bit i > j is set when j is not.
- *
- * The previous applies for i >= PAGE_WIDTH. Lower bits are used as bit flags.
- */
-#define DMA_POLICY_FLAGS_MASK		(PAGE_SIZE - 1)
-#define DMA_POLICY_CHUNK_SIZE_MASK	(~DMA_POLICY_FLAGS_MASK)
-
-#define DMA_POLICY_4GiB	(1<<0)		/**< Must use only 32-bit addresses */
-
-#define DMA_POLICY_STRICT		(-1UL)
-#define DMA_POLICY_DEFAULT		DMA_POLICY_STRICT
-
-extern dma_policy_t dma_policy_create(unsigned, size_t);
-
-/**
- * Get mask which defines bits of offset in chunk.
- */
-static inline size_t dma_policy_chunk_mask(const dma_policy_t policy)
-{
-	return policy | DMA_POLICY_FLAGS_MASK;
-}
-
-extern errno_t dma_buffer_alloc(dma_buffer_t *db, size_t size);
-extern errno_t dma_buffer_alloc_policy(dma_buffer_t *, size_t, dma_policy_t);
-extern void dma_buffer_free(dma_buffer_t *);
-
-extern uintptr_t dma_buffer_phys(const dma_buffer_t *, const void *);
-
-static inline uintptr_t dma_buffer_phys_base(const dma_buffer_t *db)
-{
-	return dma_buffer_phys(db, db->virt);
-}
-
-extern errno_t dma_buffer_lock(dma_buffer_t *, void *, size_t);
-extern void dma_buffer_unlock(dma_buffer_t *, size_t);
-
-extern void dma_buffer_acquire(dma_buffer_t *);
-extern void dma_buffer_release(dma_buffer_t *);
-
-static inline bool dma_buffer_is_set(const dma_buffer_t *db)
-{
-	return !!db->virt;
-}
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/port.h
===================================================================
--- uspace/lib/usb/include/usb/port.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * An USB hub port state machine.
- *
- * This helper structure solves a repeated problem in USB world: management of
- * USB ports. A port is an object which receives events (connect, disconnect,
- * reset) which are to be handled in an asynchronous way. The tricky part is
- * that response to events has to wait for different events - the most notable
- * being USB 2 port requiring port reset to be enabled. This problem is solved
- * by launching separate fibril for taking the port up.
- *
- * This subsystem abstracts the rather complicated state machine, and offers
- * a simple interface to announce events and leave the fibril management on the
- * library.
- */
-
-#ifndef LIB_USB_PORT_H
-#define LIB_USB_PORT_H
-
-#include <fibril_synch.h>
-#include <usb/usb.h>
-#include <errno.h>
-
-typedef enum {
-	PORT_DISABLED,	/* No device connected. Fibril not running. */
-	PORT_ENUMERATED,/* Device enumerated. Fibril finished succesfully. */
-	PORT_CONNECTING,/* A connected event received, fibril running. */
-	PORT_DISCONNECTING,/* A disconnected event received, fibril running. */
-	PORT_ERROR,	/* An error "in-progress". Fibril still running. */
-} usb_port_state_t;
-
-typedef struct usb_port {
-	/** Guarding all fields. Is locked in the connected op. */
-	fibril_mutex_t guard;
-	/** Current state of the port */
-	usb_port_state_t state;
-	/** CV signalled on fibril exit. */
-	fibril_condvar_t finished_cv;
-	/** CV signalled on enabled event. */
-	fibril_condvar_t enabled_cv;
-} usb_port_t;
-
-/**
- * Callback to run the enumeration routine.
- * Called in separate fibril with guard locked.
- */
-typedef int (*usb_port_enumerate_t)(usb_port_t *);
-
-/**
- * Callback to run the enumeration routine. Called in the caller fibril,
- */
-typedef void (*usb_port_remove_t)(usb_port_t *);
-
-/* Following methods are intended to be called "from outside". */
-void usb_port_init(usb_port_t *);
-int usb_port_connected(usb_port_t *, usb_port_enumerate_t);
-void usb_port_enabled(usb_port_t *);
-void usb_port_disabled(usb_port_t *, usb_port_remove_t);
-void usb_port_fini(usb_port_t *);
-
-/* And these are to be called from the connected handler. */
-int usb_port_condvar_wait_timeout(usb_port_t *port, fibril_condvar_t *, usec_t);
-
-/**
- * Wait for the enabled event to come.
- *
- * @return Error code:
- *	EINTR if the device was disconnected in the meantime.
- *	ETIMEOUT if the enabled event didn't come in 2 seconds
- */
-static inline int usb_port_wait_for_enabled(usb_port_t *port)
-{
-	return usb_port_condvar_wait_timeout(port, &port->enabled_cv, 2000000);
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/request.h
===================================================================
--- uspace/lib/usb/include/usb/request.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Standard USB request format.
- */
-#ifndef LIBUSB_REQUEST_H_
-#define LIBUSB_REQUEST_H_
-
-#include <stdint.h>
-#include <assert.h>
-
-/** Standard device request. */
-typedef enum {
-	USB_DEVREQ_GET_STATUS = 0,
-	USB_DEVREQ_CLEAR_FEATURE = 1,
-	USB_DEVREQ_SET_FEATURE = 3,
-	USB_DEVREQ_SET_ADDRESS = 5,
-	USB_DEVREQ_GET_DESCRIPTOR = 6,
-	USB_DEVREQ_SET_DESCRIPTOR = 7,
-	USB_DEVREQ_GET_CONFIGURATION = 8,
-	USB_DEVREQ_SET_CONFIGURATION = 9,
-	USB_DEVREQ_GET_INTERFACE = 10,
-	USB_DEVREQ_SET_INTERFACE = 11,
-	USB_DEVREQ_SYNCH_FRAME = 12,
-	USB_DEVREQ_LAST_STD
-} usb_stddevreq_t;
-
-/** Standard device features */
-typedef enum {
-	USB_FEATURE_ENDPOINT_HALT = 0,
-	USB_FEATURE_DEVICE_REMOTE_WAKEUP = 1,
-	USB_FEATURE_TEST_MODE = 2
-} usb_std_feature_t;
-
-/** USB device status - device is self powered (opposed to bus powered). */
-#define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0))
-
-/** USB device status - remote wake-up signaling is enabled. */
-#define USB_DEVICE_STATUS_REMOTE_WAKEUP ((uint16_t)(1 << 1))
-
-/** USB endpoint status - endpoint is halted (stalled). */
-#define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))
-
-/** Size of the USB setup packet */
-#define USB_SETUP_PACKET_SIZE 8
-
-#define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7)
-#define SETUP_REQUEST_TYPE_HOST_TO_DEVICE (0 << 7)
-#define SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(rt) ((rt) & (1 << 7))
-#define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3)
-#define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f)
-#define SETUP_REQUEST_TO_HOST(type, recipient) \
-    (uint8_t)((1 << 7) | ((type & 0x3) << 5) | (recipient & 0x1f))
-#define SETUP_REQUEST_TO_DEVICE(type, recipient) \
-    (uint8_t)(((type & 0x3) << 5) | (recipient & 0x1f))
-
-/** Device request setup packet.
- * The setup packet describes the request.
- */
-typedef union {
-	struct __attribute__((packed)) {
-		/** Request type.
-		 * The type combines transfer direction, request type and
-		 * intended recipient.
-		 */
-		uint8_t request_type;
-
-		/** Request identification. */
-		uint8_t request;
-		/** Main parameter to the request. */
-		union __attribute__((packed)) {
-			uint16_t value;
-			/* FIXME: add #ifdefs according to host endianness */
-			struct __attribute__((packed)) {
-				uint8_t value_low;
-				uint8_t value_high;
-			};
-		};
-		/** Auxiliary parameter to the request.
-		 * Typically, it is offset to something.
-		 */
-		uint16_t index;
-		/** Length of extra data. */
-		uint16_t length;
-	};
-	uint64_t raw;
-} __attribute__((packed)) usb_device_request_setup_packet_t;
-
-static_assert(sizeof(usb_device_request_setup_packet_t) == USB_SETUP_PACKET_SIZE, "");
-
-#define GET_DEVICE_DESC(size) \
-{ \
-	.request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST \
-	    | (USB_REQUEST_TYPE_STANDARD << 5) \
-	    | USB_REQUEST_RECIPIENT_DEVICE, \
-	.request = USB_DEVREQ_GET_DESCRIPTOR, \
-	.value = uint16_host2usb(USB_DESCTYPE_DEVICE << 8), \
-	.index = uint16_host2usb(0), \
-	.length = uint16_host2usb(size), \
-};
-
-#define SET_ADDRESS(address) \
-{ \
-	.request_type = SETUP_REQUEST_TYPE_HOST_TO_DEVICE \
-	    | (USB_REQUEST_TYPE_STANDARD << 5) \
-	    | USB_REQUEST_RECIPIENT_DEVICE, \
-	.request = USB_DEVREQ_SET_ADDRESS, \
-	.value = uint16_host2usb(address), \
-	.index = uint16_host2usb(0), \
-	.length = uint16_host2usb(0), \
-};
-
-#define CTRL_PIPE_MIN_PACKET_SIZE 8
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/include/usb/usb.h
===================================================================
--- uspace/lib/usb/include/usb/usb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Common USB types and functions.
- */
-#ifndef LIBUSB_USB_H_
-#define LIBUSB_USB_H_
-
-#include <byteorder.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <types/common.h>
-#include <usbhc_iface.h>
-
-/** Convert 16bit value from native (host) endianness to USB endianness. */
-#define uint16_host2usb(n) host2uint16_t_le((n))
-
-/** Convert 32bit value from native (host) endianness to USB endianness. */
-#define uint32_host2usb(n) host2uint32_t_le((n))
-
-/** Convert 16bit value from USB endianness into native (host) one. */
-#define uint16_usb2host(n) uint16_t_le2host((n))
-
-/** Convert 32bit value from USB endianness into native (host) one. */
-#define uint32_usb2host(n) uint32_t_le2host((n))
-
-const char *usb_str_transfer_type(usb_transfer_type_t);
-const char *usb_str_transfer_type_short(usb_transfer_type_t);
-
-const char *usb_str_direction(usb_direction_t);
-
-static inline bool usb_speed_is_11(const usb_speed_t s)
-{
-	return (s == USB_SPEED_FULL) || (s == USB_SPEED_LOW);
-}
-
-static inline bool usb_speed_is_valid(const usb_speed_t s)
-{
-	return (s >= USB_SPEED_LOW) && (s < USB_SPEED_MAX);
-}
-
-const char *usb_str_speed(usb_speed_t);
-
-/** USB request type target. */
-typedef enum {
-	USB_REQUEST_TYPE_STANDARD = 0,
-	USB_REQUEST_TYPE_CLASS = 1,
-	USB_REQUEST_TYPE_VENDOR = 2
-} usb_request_type_t;
-
-/** USB request recipient. */
-typedef enum {
-	USB_REQUEST_RECIPIENT_DEVICE = 0,
-	USB_REQUEST_RECIPIENT_INTERFACE = 1,
-	USB_REQUEST_RECIPIENT_ENDPOINT = 2,
-	USB_REQUEST_RECIPIENT_OTHER = 3
-} usb_request_recipient_t;
-
-/** Default USB address. */
-#define USB_ADDRESS_DEFAULT 0
-
-/** Maximum address number in USB 1.1. */
-#define USB11_ADDRESS_MAX 127
-#define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1)
-
-/** Check USB address for allowed values.
- *
- * @param ep USB address.
- *
- * @return True, if value is wihtin limits, false otherwise.
- *
- */
-static inline bool usb_address_is_valid(usb_address_t a)
-{
-	return a <= USB11_ADDRESS_MAX;
-}
-
-/** Default control endpoint */
-#define USB_ENDPOINT_DEFAULT_CONTROL 0
-
-/** Maximum endpoint number in USB */
-#define USB_ENDPOINT_MAX 16
-
-/** There might be two directions for every endpoint number (except 0) */
-#define USB_ENDPOINT_COUNT (2 * USB_ENDPOINT_MAX)
-
-/** Check USB endpoint for allowed values.
- *
- * @param ep USB endpoint number.
- *
- * @return True, if value is wihtin limits, false otherwise.
- *
- */
-static inline bool usb_endpoint_is_valid(usb_endpoint_t ep)
-{
-	return ep < USB_ENDPOINT_MAX;
-}
-
-/**
- * Check USB target for allowed values (address, endpoint, stream).
- *
- * @param target.
- * @return True, if values are wihtin limits, false otherwise.
- */
-static inline bool usb_target_is_valid(const usb_target_t *target)
-{
-	return usb_address_is_valid(target->address) &&
-	    usb_endpoint_is_valid(target->endpoint);
-
-	// A 16-bit Stream ID is always valid.
-}
-
-/** Compare USB targets (addresses and endpoints).
- *
- * @param a First target.
- * @param b Second target.
- * @return Whether @p a and @p b points to the same pipe on the same device.
- */
-static inline bool usb_target_same(usb_target_t a, usb_target_t b)
-{
-	return (a.address == b.address) && (a.endpoint == b.endpoint);
-}
-
-/** USB packet identifier. */
-typedef enum {
-#define _MAKE_PID_NIBBLE(tag, type) \
-	((uint8_t)(((tag) << 2) | (type)))
-#define _MAKE_PID(tag, type) \
-	( \
-	    _MAKE_PID_NIBBLE(tag, type) \
-	    | (((~_MAKE_PID_NIBBLE(tag, type)) & 0xf) << 4) \
-	)
-	USB_PID_OUT = _MAKE_PID(0, 1),
-	USB_PID_IN = _MAKE_PID(2, 1),
-	USB_PID_SOF = _MAKE_PID(1, 1),
-	USB_PID_SETUP = _MAKE_PID(3, 1),
-
-	USB_PID_DATA0 = _MAKE_PID(0, 3),
-	USB_PID_DATA1 = _MAKE_PID(2, 3),
-
-	USB_PID_ACK = _MAKE_PID(0, 2),
-	USB_PID_NAK = _MAKE_PID(2, 2),
-	USB_PID_STALL = _MAKE_PID(3, 2),
-
-	USB_PID_PRE = _MAKE_PID(3, 0),
-	/* USB_PID_ = _MAKE_PID( ,), */
-#undef _MAKE_PID
-#undef _MAKE_PID_NIBBLE
-} usb_packet_id;
-
-/** Category for USB host controllers. */
-#define USB_HC_CATEGORY "usbhc"
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usb/meson.build
===================================================================
--- uspace/lib/usb/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files(
-	'src/class.c',
-	'src/dev.c',
-	'src/debug.c',
-	'src/dma_buffer.c',
-	'src/dump.c',
-	'src/port.c',
-	'src/usb.c',
-)
Index: pace/lib/usb/src/class.c
===================================================================
--- uspace/lib/usb/src/class.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,90 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief Class related functions.
- */
-#include <usb/classes/classes.h>
-
-/** Tell string representation of USB class.
- *
- * @param cls Class code.
- * @return String representation.
- */
-const char *usb_str_class(usb_class_t cls)
-{
-	switch (cls) {
-	case USB_CLASS_USE_INTERFACE:
-		return "use-interface";
-	case USB_CLASS_AUDIO:
-		return "audio";
-	case USB_CLASS_COMMUNICATIONS_CDC_CONTROL:
-		return "communications";
-	case USB_CLASS_HID:
-		return "HID";
-	case USB_CLASS_PHYSICAL:
-		return "physical";
-	case USB_CLASS_IMAGE:
-		return "image";
-	case USB_CLASS_PRINTER:
-		return "printer";
-	case USB_CLASS_MASS_STORAGE:
-		return "mass-storage";
-	case USB_CLASS_HUB:
-		return "hub";
-	case USB_CLASS_CDC_DATA:
-		return "CDC";
-	case USB_CLASS_SMART_CARD:
-		return "smart-card";
-	case USB_CLASS_CONTENT_SECURITY:
-		return "security";
-	case USB_CLASS_VIDEO:
-		return "video";
-	case USB_CLASS_PERSONAL_HEALTHCARE:
-		return "healthcare";
-	case USB_CLASS_DIAGNOSTIC:
-		return "diagnostic";
-	case USB_CLASS_WIRELESS_CONTROLLER:
-		return "wireless";
-	case USB_CLASS_MISCELLANEOUS:
-		return "misc";
-	case USB_CLASS_APPLICATION_SPECIFIC:
-		return "application";
-	case USB_CLASS_VENDOR_SPECIFIC:
-		return "vendor-specific";
-	default:
-		return "unknown";
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/usb/src/debug.c
===================================================================
--- uspace/lib/usb/src/debug.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2010-2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Debugging and logging support.
- */
-#include <fibril_synch.h>
-#include <ddf/log.h>
-#include <usb/debug.h>
-#include <str.h>
-
-#define REMAINDER_STR_FMT " (%zu)..."
-/* string + terminator + number width (enough for 4GB) */
-#define REMAINDER_STR_LEN (5 + 1 + 10)
-
-/** How many bytes to group together. */
-#define BUFFER_DUMP_GROUP_SIZE 4
-
-/** Size of the string for buffer dumps. */
-#define BUFFER_DUMP_LEN 240 /* Ought to be enough for everybody ;-). */
-
-/** Fibril local storage for the dumped buffer. */
-static fibril_local char buffer_dump[2][BUFFER_DUMP_LEN];
-/** Fibril local storage for buffer switching. */
-static fibril_local int buffer_dump_index = 0;
-
-/** Dump buffer into string.
- *
- * The function dumps given buffer into hexadecimal format and stores it
- * in a static fibril local string.
- * That means that you do not have to deallocate the string (actually, you
- * can not do that) and you do not have to guard it against concurrent
- * calls to it.
- * The only limitation is that each second call rewrites the buffer again
- * (internally, two buffer are used in cyclic manner).
- * Thus, it is necessary to copy the buffer elsewhere (that includes printing
- * to screen or writing to file).
- * Since this function is expected to be used for debugging prints only,
- * that is not a big limitation.
- *
- * @warning You cannot use this function more than twice in the same printf
- * (see detailed explanation).
- *
- * @param buffer Buffer to be printed (can be NULL).
- * @param size Size of the buffer in bytes (can be zero).
- * @param dumped_size How many bytes to actually dump (zero means all).
- * @return Dumped buffer as a static (but fibril local) string.
- */
-const char *usb_debug_str_buffer(const uint8_t *buffer, size_t size,
-    size_t dumped_size)
-{
-	/*
-	 * Remove previous string.
-	 */
-	memset(buffer_dump[buffer_dump_index], 0, BUFFER_DUMP_LEN);
-
-	/* Do the actual dump. */
-	ddf_dump_buffer(buffer_dump[buffer_dump_index], BUFFER_DUMP_LEN,
-	    buffer, 1, size, dumped_size);
-
-	/* Next time, use the other buffer. */
-	buffer_dump_index = 1 - buffer_dump_index;
-
-	/* Need to take the old one due to previous line. */
-	return buffer_dump[1 - buffer_dump_index];
-}
-
-/**
- * @}
- */
Index: pace/lib/usb/src/dev.c
===================================================================
--- uspace/lib/usb/src/dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <usb/dev.h>
-#include <errno.h>
-#include <usb_iface.h>
-#include <str.h>
-#include <stdio.h>
-
-/** Resolve handle and address of USB device from its path.
- *
- * This is a wrapper working on best effort principle.
- * If the resolving fails, if will not give much details about what
- * is wrong.
- * Typically, error from this function would be reported to the user
- * as "bad device specification" or "device does not exist".
- *
- * The path can be specified in following format:
- *  - devman path (e.g. /hw/pci0/.../usb01_a5
- *  - bus number and device address (e.g. 5.1)
- *  - bus number, device address and device function (e.g. 2.1/HID0/keyboard)
- *
- * @param[in] dev_path Path to the device.
- * @param[out] out_hc_handle Where to store handle of a parent host controller.
- * @param[out] out_dev_addr Where to store device (USB) address.
- * @param[out] out_dev_handle Where to store device handle.
- * @return Error code.
- */
-errno_t usb_resolve_device_handle(const char *dev_path, devman_handle_t *dev_handle)
-{
-	if (dev_path == NULL || dev_handle == NULL) {
-		return EBADMEM;
-	}
-
-	/* First, try to get the device handle. */
-	errno_t rc = devman_fun_get_handle(dev_path, dev_handle, 0);
-
-	/* Next, try parsing dev_handle from the provided string */
-	if (rc != EOK) {
-		*dev_handle = strtoul(dev_path, NULL, 10);
-		//FIXME: check errno
-		rc = EOK;
-	}
-	return rc;
-}
Index: pace/lib/usb/src/dma_buffer.c
===================================================================
--- uspace/lib/usb/src/dma_buffer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,246 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusb
- * @{
- */
-/** @file
- */
-
-#include <align.h>
-#include <as.h>
-#include <ddi.h>
-#include <stddef.h>
-
-#include "usb/dma_buffer.h"
-
-dma_policy_t dma_policy_create(unsigned flags, size_t chunk_size)
-{
-	assert((chunk_size & (chunk_size - 1)) == 0); /* Check if power of 2 */
-	assert(chunk_size >= PAGE_SIZE || chunk_size == 0);
-
-	return ((chunk_size - 1) & DMA_POLICY_CHUNK_SIZE_MASK) |
-	    (flags & DMA_POLICY_FLAGS_MASK);
-}
-
-/**
- * As the driver is typically using only a few buffers at once, we cache the
- * physical mapping to avoid calling the kernel unnecessarily often. This cache
- * is global for a task.
- *
- * TODO: "few" is currently limited to one.
- */
-static struct {
-	const void *last;
-	uintptr_t phys;
-} phys_mapping_cache = { 0 };
-
-static void cache_insert(const void *v, uintptr_t p)
-{
-	phys_mapping_cache.last = v;
-	phys_mapping_cache.phys = p;
-}
-
-static void cache_evict(const void *v)
-{
-	if (phys_mapping_cache.last == v)
-		phys_mapping_cache.last = NULL;
-}
-
-static bool cache_find(const void *v, uintptr_t *p)
-{
-	*p = phys_mapping_cache.phys;
-	return phys_mapping_cache.last == v;
-}
-
-/**
- * Allocate a DMA buffer.
- *
- * @param[in] db dma_buffer_t structure to fill
- * @param[in] size Size of the required memory space
- * @param[in] policy dma_policy_t flags to guide the allocation
- * @return Error code.
- */
-errno_t dma_buffer_alloc_policy(dma_buffer_t *db, size_t size, dma_policy_t policy)
-{
-	assert(db);
-
-	const size_t real_size = ALIGN_UP(size, PAGE_SIZE);
-	const bool need_4gib = !!(policy & DMA_POLICY_4GiB);
-
-	const uintptr_t flags = need_4gib ? DMAMEM_4GiB : 0;
-
-	uintptr_t phys;
-	void *address = AS_AREA_ANY;
-
-	const int err = dmamem_map_anonymous(real_size,
-	    flags, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &phys, &address);
-	if (err)
-		return err;
-
-	/* Access the pages to force mapping */
-	volatile char *buf = address;
-	for (size_t i = 0; i < size; i += PAGE_SIZE)
-		buf[i] = 0xff;
-
-	db->virt = address;
-	db->policy = dma_policy_create(policy, 0);
-	cache_insert(db->virt, phys);
-
-	return EOK;
-}
-
-/**
- * Allocate a DMA buffer using the default policy.
- *
- * @param[in] db dma_buffer_t structure to fill
- * @param[in] size Size of the required memory space
- * @return Error code.
- */
-errno_t dma_buffer_alloc(dma_buffer_t *db, size_t size)
-{
-	return dma_buffer_alloc_policy(db, size, DMA_POLICY_DEFAULT);
-}
-
-/**
- * Free a DMA buffer.
- *
- * @param[in] db dma_buffer_t structure buffer of which will be freed
- */
-void dma_buffer_free(dma_buffer_t *db)
-{
-	if (db->virt) {
-		dmamem_unmap_anonymous(db->virt);
-		db->virt = NULL;
-		db->policy = 0;
-	}
-}
-
-/**
- * Convert a pointer inside a buffer to physical address.
- *
- * @param[in] db Buffer at which virt is pointing
- * @param[in] virt Pointer somewhere inside db
- */
-uintptr_t dma_buffer_phys(const dma_buffer_t *db, const void *virt)
-{
-	const size_t chunk_mask = dma_policy_chunk_mask(db->policy);
-	const uintptr_t offset = (virt - db->virt) & chunk_mask;
-	const void *chunk_base = virt - offset;
-
-	uintptr_t phys;
-
-	if (!cache_find(chunk_base, &phys)) {
-		if (as_get_physical_mapping(chunk_base, &phys))
-			return 0;
-		cache_insert(chunk_base, phys);
-	}
-
-	return phys + offset;
-}
-
-static bool dma_buffer_is_4gib(dma_buffer_t *db, size_t size)
-{
-	if (sizeof(uintptr_t) <= 32)
-		return true;
-
-	const size_t chunk_size = dma_policy_chunk_mask(db->policy) + 1;
-	const size_t chunks = chunk_size ? 1 : size / chunk_size;
-
-	for (size_t c = 0; c < chunks; c++) {
-		const void *addr = db->virt + (c * chunk_size);
-		const uintptr_t phys = dma_buffer_phys(db, addr);
-
-		if ((phys & DMAMEM_4GiB) != 0)
-			return false;
-	}
-
-	return true;
-}
-
-/**
- * Lock an arbitrary buffer for DMA operations, creating a DMA buffer.
- *
- * FIXME: To handle page-unaligned buffers, we need to calculate the base
- *        address and lock the whole first page. But as the operation is not yet
- *        implemented in the kernel, it doesn't matter.
- */
-errno_t dma_buffer_lock(dma_buffer_t *db, void *virt, size_t size)
-{
-	assert(virt);
-
-	uintptr_t phys;
-
-	const errno_t err = dmamem_map(virt, size, 0, 0, &phys);
-	if (err)
-		return err;
-
-	db->virt = virt;
-	db->policy = dma_policy_create(0, PAGE_SIZE);
-	cache_insert(virt, phys);
-
-	unsigned flags = -1U;
-	if (!dma_buffer_is_4gib(db, size))
-		flags &= ~DMA_POLICY_4GiB;
-	db->policy = dma_policy_create(flags, PAGE_SIZE);
-
-	return EOK;
-}
-
-/**
- * Unlock a buffer for DMA operations.
- */
-void dma_buffer_unlock(dma_buffer_t *db, size_t size)
-{
-	if (db->virt) {
-		dmamem_unmap(db->virt, size);
-		db->virt = NULL;
-		db->policy = 0;
-	}
-}
-
-/**
- * Must be called when the buffer is received over IPC. Clears potentially
- * leftover value from different buffer mapped to the same virtual address.
- */
-void dma_buffer_acquire(dma_buffer_t *db)
-{
-	cache_evict(db->virt);
-}
-
-/**
- * Counterpart of acquire.
- */
-void dma_buffer_release(dma_buffer_t *db)
-{
-	cache_evict(db->virt);
-}
-
-/**
- * @}
- */
Index: pace/lib/usb/src/dump.c
===================================================================
--- uspace/lib/usb/src/dump.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,358 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Descriptor dumping.
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/classes/classes.h>
-#include <usb/classes/hub.h>
-#include <usb/usb.h>
-
-/** Mapping between descriptor id and dumping function. */
-typedef struct {
-	/** Descriptor id. */
-	int id;
-	/** Dumping function. */
-	void (*dump)(FILE *, const char *, const char *,
-	    const uint8_t *, size_t);
-} descriptor_dump_t;
-
-static void usb_dump_descriptor_device(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_configuration(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_interface(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_string(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_endpoint(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_superspeed_endpoint_companion(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_hid(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_hub(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-static void usb_dump_descriptor_generic(FILE *, const char *, const char *,
-    const uint8_t *, size_t);
-
-/** Descriptor dumpers mapping. */
-static descriptor_dump_t descriptor_dumpers[] = {
-	{ USB_DESCTYPE_DEVICE, usb_dump_descriptor_device },
-	{ USB_DESCTYPE_CONFIGURATION, usb_dump_descriptor_configuration },
-	{ USB_DESCTYPE_STRING, usb_dump_descriptor_string },
-	{ USB_DESCTYPE_INTERFACE, usb_dump_descriptor_interface },
-	{ USB_DESCTYPE_ENDPOINT, usb_dump_descriptor_endpoint },
-	{ USB_DESCTYPE_SSPEED_EP_COMPANION, usb_dump_descriptor_superspeed_endpoint_companion },
-	{ USB_DESCTYPE_HID, usb_dump_descriptor_hid },
-	{ USB_DESCTYPE_HUB, usb_dump_descriptor_hub },
-	{ -1, usb_dump_descriptor_generic },
-	{ -1, NULL }
-};
-
-/** Dumps standard USB descriptor.
- * The @p line_suffix must contain the newline <code>\\n</code> character.
- * When @p line_suffix or @p line_prefix is NULL, they are substitued with
- * default values
- * (<code> - </code> for prefix and line termination for suffix).
- *
- * @param output Output file stream to dump descriptor to.
- * @param line_prefix Prefix for each line of output.
- * @param line_suffix Suffix of each line of output.
- * @param descriptor Actual descriptor.
- * @param descriptor_length Descriptor size.
- */
-void usb_dump_standard_descriptor(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	if (descriptor_length < 2) {
-		return;
-	}
-	int type = descriptor[1];
-
-	descriptor_dump_t *dumper = descriptor_dumpers;
-	while (dumper->dump != NULL) {
-		if ((dumper->id == type) || (dumper->id < 0)) {
-			dumper->dump(output, line_prefix, line_suffix,
-			    descriptor, descriptor_length);
-			return;
-		}
-		dumper++;
-	}
-}
-
-/** Prints single line of USB descriptor dump.
- * @warning This macro abuses heavily the naming conventions used
- * by all dumping functions (i.e. names for output file stream (@c output) and
- * line prefix and suffix (@c line_prefix and @c line_suffix respectively))-
- *
- * @param fmt Formatting string.
- */
-#define PRINTLINE(fmt, ...) \
-	fprintf(output, "%s" fmt "%s", \
-	    line_prefix ? line_prefix : " - ", \
-	    __VA_ARGS__, \
-	    line_suffix ? line_suffix : "\n")
-
-#define BCD_INT(a) (((unsigned int)(a)) / 256)
-#define BCD_FRAC(a) (((unsigned int)(a)) % 256)
-
-#define BCD_FMT "%x.%x"
-#define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a))
-
-static void usb_dump_descriptor_device(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_standard_device_descriptor_t *d =
-	    (usb_standard_device_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	PRINTLINE("bLength = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type);
-	PRINTLINE("bcdUSB = %d (" BCD_FMT ")", d->usb_spec_version,
-	    BCD_ARGS(d->usb_spec_version));
-	PRINTLINE("bDeviceClass = 0x%02x", d->device_class);
-	PRINTLINE("bDeviceSubClass = 0x%02x", d->device_subclass);
-	PRINTLINE("bDeviceProtocol = 0x%02x", d->device_protocol);
-	PRINTLINE("bMaxPacketSize0 = %d", d->max_packet_size);
-	PRINTLINE("idVendor = 0x%04x", d->vendor_id);
-	PRINTLINE("idProduct = 0x%04x", d->product_id);
-	PRINTLINE("bcdDevice = %d", d->device_version);
-	PRINTLINE("iManufacturer = %d", d->str_manufacturer);
-	PRINTLINE("iProduct = %d", d->str_product);
-	PRINTLINE("iSerialNumber = %d", d->str_serial_number);
-	PRINTLINE("bNumConfigurations = %d", d->configuration_count);
-}
-
-static void usb_dump_descriptor_configuration(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_standard_configuration_descriptor_t *d =
-	    (usb_standard_configuration_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	bool self_powered = d->attributes & 64;
-	bool remote_wakeup = d->attributes & 32;
-
-	PRINTLINE("bLength = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type);
-	PRINTLINE("wTotalLength = %d", d->total_length);
-	PRINTLINE("bNumInterfaces = %d", d->interface_count);
-	PRINTLINE("bConfigurationValue = %d", d->configuration_number);
-	PRINTLINE("iConfiguration = %d", d->str_configuration);
-	PRINTLINE("bmAttributes = %d [%s%s%s]", d->attributes,
-	    self_powered ? "self-powered" : "",
-	    (self_powered & remote_wakeup) ? ", " : "",
-	    remote_wakeup ? "remote-wakeup" : "");
-	PRINTLINE("MaxPower = %d (%dmA)", d->max_power,
-	    2 * d->max_power);
-}
-
-static void usb_dump_descriptor_interface(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_standard_interface_descriptor_t *d =
-	    (usb_standard_interface_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	PRINTLINE("bLength = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type);
-	PRINTLINE("bInterfaceNumber = %d", d->interface_number);
-	PRINTLINE("bAlternateSetting = %d", d->alternate_setting);
-	PRINTLINE("bNumEndpoints = %d", d->endpoint_count);
-	PRINTLINE("bInterfaceClass = %s", d->interface_class == 0 ?
-	    "reserved (0)" : usb_str_class(d->interface_class));
-	PRINTLINE("bInterfaceSubClass = %d", d->interface_subclass);
-	PRINTLINE("bInterfaceProtocol = %d", d->interface_protocol);
-	PRINTLINE("iInterface = %d", d->str_interface);
-}
-
-static void usb_dump_descriptor_string(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-}
-
-static void usb_dump_descriptor_endpoint(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_standard_endpoint_descriptor_t *d =
-	    (usb_standard_endpoint_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	int endpoint = d->endpoint_address & 15;
-	usb_direction_t direction = d->endpoint_address & 128 ?
-	    USB_DIRECTION_IN : USB_DIRECTION_OUT;
-	usb_transfer_type_t transfer_type = d->attributes & 3;
-
-	PRINTLINE("bLength = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02X", d->descriptor_type);
-	PRINTLINE("bEndpointAddress = 0x%02X [%d, %s]",
-	    d->endpoint_address, endpoint,
-	    direction == USB_DIRECTION_IN ? "in" : "out");
-	PRINTLINE("bmAttributes = %d [%s]", d->attributes,
-	    usb_str_transfer_type(transfer_type));
-	PRINTLINE("wMaxPacketSize = %d", d->max_packet_size);
-	PRINTLINE("bInterval = %dms", d->poll_interval);
-}
-
-static void usb_dump_descriptor_superspeed_endpoint_companion(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_superspeed_endpoint_companion_descriptor_t *d =
-	    (usb_superspeed_endpoint_companion_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	PRINTLINE("bLength = %u", d->length);
-	PRINTLINE("bDescriptorType = 0x%02X", d->descriptor_type);
-	PRINTLINE("bMaxBurst = %u", d->max_burst);
-	PRINTLINE("bmAttributes = %d", d->attributes);
-	PRINTLINE("wBytesPerInterval = %u", d->bytes_per_interval);
-}
-
-static void usb_dump_descriptor_hid(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_standard_hid_descriptor_t *d =
-	    (usb_standard_hid_descriptor_t *) descriptor;
-	if (descriptor_length < sizeof(*d)) {
-		return;
-	}
-
-	PRINTLINE("bLength = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type);
-	PRINTLINE("bcdHID = %d (" BCD_FMT ")", d->spec_release,
-	    BCD_ARGS(d->spec_release));
-	PRINTLINE("bCountryCode = %d", d->country_code);
-	PRINTLINE("bNumDescriptors = %d", d->class_desc_count);
-	PRINTLINE("bDescriptorType = %d", d->report_desc_info.type);
-	PRINTLINE("wDescriptorLength = %d", d->report_desc_info.length);
-
-	/* Print info about report descriptors. */
-	size_t i;
-	size_t count = (descriptor_length - sizeof(*d)) /
-	    sizeof(usb_standard_hid_class_descriptor_info_t);
-	usb_standard_hid_class_descriptor_info_t *d2 =
-	    (usb_standard_hid_class_descriptor_info_t *)
-	    (descriptor + sizeof(*d));
-	for (i = 0; i < count; i++, d2++) {
-		PRINTLINE("bDescriptorType = %d", d2->type);
-		PRINTLINE("wDescriptorLength = %d", d2->length);
-	}
-}
-
-static void usb_dump_descriptor_hub(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	usb_hub_descriptor_header_t *d =
-	    (usb_hub_descriptor_header_t *) descriptor;
-	if (descriptor_length < sizeof(d))
-		return;
-
-	PRINTLINE("bDescLength: = %d", d->length);
-	PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type);
-	PRINTLINE("bNbrPorts = %d", d->port_count);
-	PRINTLINE("bHubCharacteristics = 0x%02x%02x (%s;%s%s)",
-	    d->characteristics_reserved, d->characteristics,
-	    (d->characteristics & HUB_CHAR_NO_POWER_SWITCH_FLAG) ?
-	    "No Power Switching" :
-	    ((d->characteristics & HUB_CHAR_POWER_PER_PORT_FLAG) ?
-	    "Per-Port Switching" : "Ganged Power Switching"),
-	    (d->characteristics & HUB_CHAR_COMPOUND_DEVICE) ?
-	    "Compound Device;" : "",
-	    (d->characteristics & HUB_CHAR_NO_OC_FLAG) ?
-	    "No OC Protection" :
-	    ((d->characteristics & HUB_CHAR_OC_PER_PORT_FLAG) ?
-	    "Individual Port OC Protection" :
-	    "Global OC Protection"));
-	PRINTLINE("bPwrOn2PwrGood = %d (%d ms)",
-	    d->power_good_time, d->power_good_time * 2);
-	PRINTLINE("bHubContrCurrent = %d (%d mA)",
-	    d->max_current, d->max_current);
-	const size_t port_bytes = (descriptor_length - sizeof(*d)) / 2;
-	const uint8_t *removable_mask = descriptor + sizeof(*d);
-	const uint8_t *powered_mask = descriptor + sizeof(*d) + port_bytes;
-
-	if (port_bytes == 0 ||
-	    port_bytes > (((d->port_count / (unsigned)8) + 1) * 2)) {
-		PRINTLINE("::CORRUPTED DESCRIPTOR:: (%zu bytes remain)",
-		    port_bytes * 2);
-	}
-
-	fprintf(output, "%sDeviceRemovable = 0x",
-	    line_prefix ? line_prefix : " - ");
-	for (unsigned i = port_bytes; i > 0; --i)
-		fprintf(output, "%02x", removable_mask[i - 1]);
-	fprintf(output, " (0b1 - Device non-removable)%s",
-	    line_suffix ? line_suffix : "\n");
-
-	fprintf(output, "%sPortPwrCtrlMask = 0x",
-	    line_prefix ? line_prefix : " - ");
-	for (unsigned i = port_bytes; i > 0; --i)
-		fprintf(output, "%02x", powered_mask[i - 1]);
-	fprintf(output, " (Legacy - All should be 0b1)%s",
-	    line_suffix ? line_suffix : "\n");
-}
-
-static void usb_dump_descriptor_generic(FILE *output,
-    const char *line_prefix, const char *line_suffix,
-    const uint8_t *descriptor, size_t descriptor_length)
-{
-	/* TODO */
-}
-
-/**
- * @}
- */
Index: pace/lib/usb/src/port.c
===================================================================
--- uspace/lib/usb/src/port.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * An USB hub port state machine.
- *
- * This helper structure solves a repeated problem in USB world: management of
- * USB ports. A port is an object which receives events (connect, disconnect,
- * reset) which are to be handled in an asynchronous way. The tricky part is
- * that response to events has to wait for different events - the most notable
- * being USB 2 port requiring port reset to be enabled. This problem is solved
- * by launching separate fibril for taking the port up.
- *
- * This subsystem abstracts the rather complicated state machine, and offers
- * a simple interface to announce events and leave the fibril management on the
- * library.
- */
-
-#include <stdlib.h>
-#include <fibril.h>
-#include <assert.h>
-#include <usb/debug.h>
-
-#include <usb/port.h>
-
-void usb_port_init(usb_port_t *port)
-{
-	fibril_mutex_initialize(&port->guard);
-	fibril_condvar_initialize(&port->finished_cv);
-	fibril_condvar_initialize(&port->enabled_cv);
-}
-
-struct enumerate_worker_args {
-	usb_port_t *port;
-	usb_port_enumerate_t handler;
-};
-
-static int enumerate_worker(void *arg)
-{
-	struct enumerate_worker_args *const args = arg;
-	usb_port_t *port = args->port;
-	usb_port_enumerate_t handler = args->handler;
-	free(args);
-
-	fibril_mutex_lock(&port->guard);
-
-	if (port->state == PORT_ERROR) {
-		/*
-		 * The device was removed faster than this fibril acquired the
-		 * mutex.
-		 */
-		port->state = PORT_DISABLED;
-		goto out;
-	}
-
-	assert(port->state == PORT_CONNECTING);
-
-	port->state = handler(port) ? PORT_DISABLED : PORT_ENUMERATED;
-
-out:
-	fibril_condvar_broadcast(&port->finished_cv);
-	fibril_mutex_unlock(&port->guard);
-	return EOK; // This is a fibril worker. No one will read the value.
-}
-
-int usb_port_connected(usb_port_t *port, usb_port_enumerate_t handler)
-{
-	assert(port);
-	int ret = ENOMEM;
-
-	fibril_mutex_lock(&port->guard);
-
-	if (port->state != PORT_DISABLED) {
-		usb_log_warning("a connected event come for port that is not disabled.");
-		ret = EINVAL;
-		goto out;
-	}
-
-	struct enumerate_worker_args *args = malloc(sizeof(*args));
-	if (!args)
-		goto out;
-
-	fid_t fibril = fibril_create(&enumerate_worker, args);
-	if (!fibril) {
-		free(args);
-		goto out;
-	}
-
-	args->port = port;
-	args->handler = handler;
-
-	port->state = PORT_CONNECTING;
-	fibril_add_ready(fibril);
-out:
-	fibril_mutex_unlock(&port->guard);
-	return ret;
-}
-
-void usb_port_enabled(usb_port_t *port)
-{
-	assert(port);
-
-	fibril_mutex_lock(&port->guard);
-	fibril_condvar_broadcast(&port->enabled_cv);
-	fibril_mutex_unlock(&port->guard);
-}
-
-struct remove_worker_args {
-	usb_port_t *port;
-	usb_port_remove_t handler;
-};
-
-static int remove_worker(void *arg)
-{
-	struct remove_worker_args *const args = arg;
-	usb_port_t *port = args->port;
-	usb_port_remove_t handler = args->handler;
-	free(args);
-
-	fibril_mutex_lock(&port->guard);
-	assert(port->state == PORT_DISCONNECTING);
-
-	handler(port);
-
-	port->state = PORT_DISABLED;
-	fibril_condvar_broadcast(&port->finished_cv);
-	fibril_mutex_unlock(&port->guard);
-	return EOK;
-}
-
-static void fork_remove_worker(usb_port_t *port, usb_port_remove_t handler)
-{
-	struct remove_worker_args *args = malloc(sizeof(*args));
-	if (!args)
-		return;
-
-	fid_t fibril = fibril_create(&remove_worker, args);
-	if (!fibril) {
-		free(args);
-		return;
-	}
-
-	args->port = port;
-	args->handler = handler;
-
-	port->state = PORT_DISCONNECTING;
-	fibril_add_ready(fibril);
-}
-
-void usb_port_disabled(usb_port_t *port, usb_port_remove_t handler)
-{
-	assert(port);
-	fibril_mutex_lock(&port->guard);
-
-	switch (port->state) {
-	case PORT_ENUMERATED:
-		fork_remove_worker(port, handler);
-		break;
-
-	case PORT_CONNECTING:
-		port->state = PORT_ERROR;
-		fibril_condvar_broadcast(&port->enabled_cv);
-		/* fallthrough */
-	case PORT_ERROR:
-		fibril_condvar_wait(&port->finished_cv, &port->guard);
-		/* fallthrough */
-	case PORT_DISCONNECTING:
-	case PORT_DISABLED:
-		break;
-	}
-
-	fibril_mutex_unlock(&port->guard);
-}
-
-void usb_port_fini(usb_port_t *port)
-{
-	assert(port);
-
-	fibril_mutex_lock(&port->guard);
-	switch (port->state) {
-	case PORT_ENUMERATED:
-		/*
-		 * We shall inform the HC that the device is gone.
-		 * However, we can't wait for it, because if the device is hub,
-		 * it would have to use the same IPC handling fibril as we do.
-		 * But we cannot even defer it to another fibril, because then
-		 * the HC would assume our driver didn't cleanup properly, and
-		 * will remove those devices by himself.
-		 *
-		 * So the solutions seems to be to behave like a bad driver and
-		 * leave the work for HC.
-		 */
-		port->state = PORT_DISABLED;
-		/* fallthrough */
-	case PORT_DISABLED:
-		break;
-
-	case PORT_CONNECTING:
-		/* We first have to stop the fibril in progress. */
-		port->state = PORT_ERROR;
-		fibril_condvar_broadcast(&port->enabled_cv);
-		/* fallthrough */
-	case PORT_ERROR:
-	case PORT_DISCONNECTING:
-		fibril_condvar_wait(&port->finished_cv, &port->guard);
-		break;
-	}
-	fibril_mutex_unlock(&port->guard);
-}
-
-int usb_port_condvar_wait_timeout(usb_port_t *port, fibril_condvar_t *cv,
-    usec_t timeout)
-{
-	assert(port);
-	assert(port->state == PORT_CONNECTING);
-	assert(fibril_mutex_is_locked(&port->guard));
-
-	if (fibril_condvar_wait_timeout(cv, &port->guard, timeout))
-		return ETIMEOUT;
-
-	return port->state == PORT_CONNECTING ? EOK : EINTR;
-}
-
-/**
- * @}
- */
Index: pace/lib/usb/src/usb.c
===================================================================
--- uspace/lib/usb/src/usb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Common USB functions.
- */
-#include <usb/usb.h>
-#include <usb/request.h>
-
-#include <assert.h>
-#include <byteorder.h>
-#include <macros.h>
-
-static const char *str_speed[] = {
-	[USB_SPEED_LOW] = "low",
-	[USB_SPEED_FULL] = "full",
-	[USB_SPEED_HIGH] = "high",
-	[USB_SPEED_SUPER] = "super",
-};
-
-static const char *str_transfer_type[] = {
-	[USB_TRANSFER_CONTROL] = "control",
-	[USB_TRANSFER_ISOCHRONOUS] = "isochronous",
-	[USB_TRANSFER_BULK] = "bulk",
-	[USB_TRANSFER_INTERRUPT] = "interrupt",
-};
-
-static const char *str_transfer_type_short[] = {
-	[USB_TRANSFER_CONTROL] = "ctrl",
-	[USB_TRANSFER_ISOCHRONOUS] = "iso",
-	[USB_TRANSFER_BULK] = "bulk",
-	[USB_TRANSFER_INTERRUPT] = "intr",
-};
-
-static const char *str_direction[] = {
-	[USB_DIRECTION_IN] = "in",
-	[USB_DIRECTION_OUT] = "out",
-	[USB_DIRECTION_BOTH] = "both",
-};
-
-/** String representation for USB transfer type.
- *
- * @param t Transfer type.
- * @return Transfer type as a string (in English).
- */
-const char *usb_str_transfer_type(usb_transfer_type_t t)
-{
-	if ((size_t)t >= ARRAY_SIZE(str_transfer_type)) {
-		return "invalid";
-	}
-	return str_transfer_type[t];
-}
-
-/** String representation for USB transfer type (short version).
- *
- * @param t Transfer type.
- * @return Transfer type as a short string for debugging messages.
- */
-const char *usb_str_transfer_type_short(usb_transfer_type_t t)
-{
-	if ((size_t)t >= ARRAY_SIZE(str_transfer_type_short)) {
-		return "invl";
-	}
-	return str_transfer_type_short[t];
-}
-
-/** String representation of USB direction.
- *
- * @param d The direction.
- * @return Direction as a string (in English).
- */
-const char *usb_str_direction(usb_direction_t d)
-{
-	if (d >= ARRAY_SIZE(str_direction)) {
-		return "invalid";
-	}
-	return str_direction[d];
-}
-
-/** String representation of USB speed.
- *
- * @param s The speed.
- * @return USB speed as a string (in English).
- */
-const char *usb_str_speed(usb_speed_t s)
-{
-	if (s >= ARRAY_SIZE(str_speed)) {
-		return "invalid";
-	}
-	return str_speed[s];
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/alternate_ifaces.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/alternate_ifaces.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework.
- */
-
-#ifndef LIBUSBDEV_ALTERNATE_IFACES_H_
-#define LIBUSBDEV_ALTERNATE_IFACES_H_
-
-#include <errno.h>
-#include <usb/descriptor.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Wrapper for data related to alternate interface setting.
- * The pointers will typically point inside configuration descriptor and
- * thus you shall not deallocate them.
- */
-typedef struct {
-	/** Interface descriptor. */
-	const usb_standard_interface_descriptor_t *interface;
-	/** Pointer to start of descriptor tree bound with this interface. */
-	const uint8_t *nested_descriptors;
-	/** Size of data pointed by nested_descriptors in bytes. */
-	size_t nested_descriptors_size;
-} usb_alternate_interface_descriptors_t;
-
-/** Alternate interface settings. */
-typedef struct {
-	/** Array of alternate interfaces descriptions. */
-	usb_alternate_interface_descriptors_t *alternatives;
-	/** Size of @c alternatives array. */
-	size_t alternative_count;
-	/** Index of currently selected one. */
-	size_t current;
-} usb_alternate_interfaces_t;
-
-size_t usb_interface_count_alternates(const uint8_t *, size_t, uint8_t);
-errno_t usb_alternate_interfaces_init(usb_alternate_interfaces_t *,
-    const uint8_t *, size_t, int);
-void usb_alternate_interfaces_deinit(usb_alternate_interfaces_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/device.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/device.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework.
- */
-
-#ifndef LIBUSBDEV_DEVICE_H_
-#define LIBUSBDEV_DEVICE_H_
-
-#include <ddf/driver.h>
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb/dev/alternate_ifaces.h>
-#include <usb/dev/pipes.h>
-#include <usbhc_iface.h>
-
-#include <assert.h>
-#include <async.h>
-
-/** Some useful descriptors for USB device. */
-typedef struct {
-	/** Standard device descriptor. */
-	usb_standard_device_descriptor_t device;
-	/** Full configuration descriptor of current configuration. */
-	void *full_config;
-	size_t full_config_size;
-} usb_device_descriptors_t;
-
-typedef struct usb_device usb_device_t;
-
-/* DDF parts */
-errno_t usb_device_create_ddf(ddf_dev_t *,
-    const usb_endpoint_description_t **, const char **);
-void usb_device_destroy_ddf(ddf_dev_t *);
-
-static inline usb_device_t *usb_device_get(ddf_dev_t *dev)
-{
-	assert(dev);
-	return ddf_dev_data_get(dev);
-}
-
-usb_device_t *usb_device_create(devman_handle_t);
-void usb_device_destroy(usb_device_t *);
-
-const char *usb_device_get_name(usb_device_t *);
-ddf_fun_t *usb_device_ddf_fun_create(usb_device_t *, fun_type_t, const char *);
-
-async_exch_t *usb_device_bus_exchange_begin(usb_device_t *);
-void usb_device_bus_exchange_end(async_exch_t *);
-
-errno_t usb_device_select_interface(usb_device_t *, uint8_t,
-    const usb_endpoint_description_t **);
-
-errno_t usb_device_create_pipes(usb_device_t *usb_dev,
-    const usb_endpoint_description_t **endpoints);
-void usb_device_destroy_pipes(usb_device_t *);
-
-usb_pipe_t *usb_device_get_default_pipe(usb_device_t *);
-usb_endpoint_mapping_t *usb_device_get_mapped_ep_desc(usb_device_t *,
-    const usb_endpoint_description_t *);
-int usb_device_unmap_ep(usb_endpoint_mapping_t *);
-
-usb_address_t usb_device_get_address(const usb_device_t *);
-unsigned usb_device_get_depth(const usb_device_t *);
-usb_speed_t usb_device_get_speed(const usb_device_t *);
-int usb_device_get_iface_number(const usb_device_t *);
-devman_handle_t usb_device_get_devman_handle(const usb_device_t *);
-
-const usb_device_descriptors_t *usb_device_descriptors(usb_device_t *);
-
-const usb_alternate_interfaces_t *usb_device_get_alternative_ifaces(
-    usb_device_t *);
-
-void *usb_device_data_alloc(usb_device_t *, size_t);
-void *usb_device_data_get(usb_device_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/dp.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/dp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB descriptor parser.
- */
-#ifndef LIBUSBDEV_DP_H_
-#define LIBUSBDEV_DP_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-/** USB descriptors nesting.
- * The nesting describes the logical tree USB descriptors form
- * (e.g. that endpoint descriptor belongs to interface or that
- * interface belongs to configuration).
- *
- * See usb_descriptor_type_t for descriptor constants.
- */
-typedef struct {
-	/** Child descriptor id. */
-	int child;
-	/** Parent descriptor id. */
-	int parent;
-} usb_dp_descriptor_nesting_t;
-
-extern const usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[];
-
-/** Descriptor parser structure. */
-typedef struct {
-	/** Used descriptor nesting. */
-	const usb_dp_descriptor_nesting_t *nesting;
-} usb_dp_parser_t;
-
-/** Descriptor parser data. */
-typedef struct {
-	/** Data to be parsed. */
-	const uint8_t *data;
-	/** Size of input data in bytes. */
-	size_t size;
-	/** Custom argument. */
-	void *arg;
-} usb_dp_parser_data_t;
-
-typedef void (*walk_callback_t)(const uint8_t *, size_t, void *);
-
-const uint8_t *usb_dp_get_nested_descriptor(const usb_dp_parser_t *,
-    const usb_dp_parser_data_t *, const uint8_t *);
-const uint8_t *usb_dp_get_sibling_descriptor(const usb_dp_parser_t *,
-    const usb_dp_parser_data_t *, const uint8_t *, const uint8_t *);
-
-void usb_dp_walk_simple(const uint8_t *, size_t,
-    const usb_dp_descriptor_nesting_t *, walk_callback_t, void *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/driver.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework.
- */
-
-#ifndef LIBUSBDEV_DRIVER_H_
-#define LIBUSBDEV_DRIVER_H_
-
-#include <usb/dev/device.h>
-#include <usb/dev/pipes.h>
-
-/** USB driver ops. */
-typedef struct {
-	/** Callback when a new device was added to the system. */
-	errno_t (*device_add)(usb_device_t *);
-	/** Callback when a device is about to be removed from the system. */
-	errno_t (*device_remove)(usb_device_t *);
-	/** Callback when a device was removed from the system. */
-	errno_t (*device_gone)(usb_device_t *);
-	/** Callback asking the driver to online a specific function. */
-	errno_t (*function_online)(ddf_fun_t *);
-	/** Callback asking the driver to offline a specific function. */
-	errno_t (*function_offline)(ddf_fun_t *);
-} usb_driver_ops_t;
-
-/** USB driver structure. */
-typedef struct {
-	/** Driver name.
-	 * This name is copied to the generic driver name and must be exactly
-	 * the same as the directory name where the driver executable resides.
-	 */
-	const char *name;
-	/** Expected endpoints description.
-	 * This description shall exclude default control endpoint (pipe zero)
-	 * and must be NULL terminated.
-	 * When only control endpoint is expected, you may set NULL directly
-	 * without creating one item array containing NULL.
-	 *
-	 * When the driver expect single interrupt in endpoint,
-	 * the initialization may look like this:
-	 *
-	 * @code
-	 * static usb_endpoint_description_t poll_endpoint_description = {
-	 * 	.transfer_type = USB_TRANSFER_INTERRUPT,
-	 * 	.direction = USB_DIRECTION_IN,
-	 * 	.interface_class = USB_CLASS_HUB,
-	 * 	.interface_subclass = 0,
-	 * 	.interface_protocol = 0,
-	 * 	.flags = 0
-	 * };
-	 *
-	 * static usb_endpoint_description_t *hub_endpoints[] = {
-	 * 	&poll_endpoint_description,
-	 * 	NULL
-	 * };
-	 *
-	 * static usb_driver_t hub_driver = {
-	 * 	.endpoints = hub_endpoints,
-	 * 	...
-	 * };
-	 * @endcode
-	 */
-	const usb_endpoint_description_t **endpoints;
-	/** Driver ops. */
-	const usb_driver_ops_t *ops;
-} usb_driver_t;
-
-int usb_driver_main(const usb_driver_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/pipes.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/pipes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB pipes representation.
- */
-#ifndef LIBUSBDEV_PIPES_H_
-#define LIBUSBDEV_PIPES_H_
-
-#include <usb/usb.h>
-#include <usb/descriptor.h>
-#include <usb_iface.h>
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define CTRL_PIPE_MIN_PACKET_SIZE 8
-
-/** Abstraction of a logical connection to USB device endpoint.
- * It contains some vital information about the pipe.
- * This endpoint must be bound with existing usb_device_connection_t
- * (i.e. the wire to send data over).
- */
-typedef struct {
-	/** Pipe description received from HC */
-	usb_pipe_desc_t desc;
-
-	/** Whether to automatically reset halt on the endpoint.
-	 * Valid only for control endpoint zero.
-	 */
-	bool auto_reset_halt;
-	/** The connection used for sending the data. */
-	usb_dev_session_t *bus_session;
-} usb_pipe_t;
-
-/** Description of endpoint characteristics. */
-typedef struct {
-	/** Transfer type (e.g. control or interrupt). */
-	usb_transfer_type_t transfer_type;
-	/** Transfer direction (to or from a device). */
-	usb_direction_t direction;
-	/** Interface class this endpoint belongs to (-1 for any). */
-	int interface_class;
-	/** Interface subclass this endpoint belongs to (-1 for any). */
-	int interface_subclass;
-	/** Interface protocol this endpoint belongs to (-1 for any). */
-	int interface_protocol;
-	/** Extra endpoint flags. */
-	unsigned int flags;
-} usb_endpoint_description_t;
-
-/** Mapping of endpoint pipes and endpoint descriptions. */
-typedef struct {
-	/** Endpoint pipe. */
-	usb_pipe_t pipe;
-	/** Endpoint description. */
-	const usb_endpoint_description_t *description;
-	/** Interface number the endpoint must belong to (-1 for any). */
-	int interface_no;
-	/** Alternate interface setting to choose. */
-	int interface_setting;
-	/** Found descriptor fitting the description. */
-	const usb_standard_endpoint_descriptor_t *descriptor;
-	/** Relevant superspeed companion descriptor. */
-	const usb_superspeed_endpoint_companion_descriptor_t
-	    *companion_descriptor;
-	/** Interface descriptor the endpoint belongs to. */
-	const usb_standard_interface_descriptor_t *interface;
-	/** Whether the endpoint was actually found. */
-	bool present;
-} usb_endpoint_mapping_t;
-
-errno_t usb_pipe_initialize(usb_pipe_t *, usb_dev_session_t *);
-errno_t usb_pipe_initialize_default_control(usb_pipe_t *, usb_dev_session_t *);
-
-errno_t usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *,
-    size_t, const uint8_t *, size_t, usb_dev_session_t *);
-
-errno_t usb_pipe_register(usb_pipe_t *,
-    const usb_standard_endpoint_descriptor_t *,
-    const usb_superspeed_endpoint_companion_descriptor_t *);
-errno_t usb_pipe_unregister(usb_pipe_t *);
-
-errno_t usb_pipe_read(usb_pipe_t *, void *, size_t, size_t *);
-errno_t usb_pipe_write(usb_pipe_t *, const void *, size_t);
-
-errno_t usb_pipe_read_dma(usb_pipe_t *, void *, void *, size_t, size_t *);
-errno_t usb_pipe_write_dma(usb_pipe_t *, void *, void *, size_t);
-
-errno_t usb_pipe_control_read(usb_pipe_t *, const void *, size_t,
-    void *, size_t, size_t *);
-errno_t usb_pipe_control_write(usb_pipe_t *, const void *, size_t,
-    const void *, size_t);
-
-void *usb_pipe_alloc_buffer(usb_pipe_t *, size_t);
-void usb_pipe_free_buffer(usb_pipe_t *, void *);
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/poll.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/poll.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device polling functions.
- */
-#ifndef LIBUSBDEV_POLL_H_
-#define LIBUSBDEV_POLL_H_
-
-#include <usb/usb.h>
-#include <usb/dev/device.h>
-#include <usb/dev/pipes.h>
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fibril_synch.h>
-
-/** USB automated polling. */
-typedef struct usb_polling {
-	/** Mandatory parameters - user is expected to configure these. */
-
-	/** USB device to poll. */
-	usb_device_t *device;
-
-	/** Device enpoint mapping to use for polling. */
-	usb_endpoint_mapping_t *ep_mapping;
-
-	/** Size of the recieved data. */
-	size_t request_size;
-
-	/**
-	 * Data buffer of at least `request_size`. User is responsible for its
-	 * allocation.
-	 */
-	uint8_t *buffer;
-
-	/** Callback when data arrives.
-	 *
-	 * @param dev Device that was polled.
-	 * @param data Data buffer (in USB endianness).
-	 * @param data_size Size of the @p data buffer in bytes.
-	 * @param arg Custom argument.
-	 * @return Whether to continue in polling.
-	 */
-	bool (*on_data)(usb_device_t *dev, uint8_t *data, size_t data_size,
-	    void *arg);
-
-	/**
-	 * Optional parameters - user can customize them, but they are
-	 * defaulted to  some reasonable values.
-	 */
-
-	/** Level of debugging messages from auto polling.
-	 * 0 - nothing (default)
-	 * 1 - inform about errors and polling start/end
-	 * 2 - also dump every retrieved buffer
-	 */
-	int debug;
-
-	/**
-	 * Maximum number of consecutive errors before polling termination
-	 * (default 3).
-	 */
-	size_t max_failures;
-
-	/** Delay between poll requests in milliseconds.
-	 * By default, value from endpoint descriptor used.
-	 */
-	int delay;
-
-	/** Whether to automatically try to clear the HALT feature after
-	 * the endpoint stalls (true by default).
-	 */
-	bool auto_clear_halt;
-
-	/** Argument to pass to callbacks (default NULL). */
-	void *arg;
-
-	/** Callback when polling is terminated.
-	 *
-	 * @param dev Device where the polling was terminated.
-	 * @param due_to_errors Whether polling stopped due to several failures.
-	 * @param arg Custom argument.
-	 */
-	void (*on_polling_end)(usb_device_t *dev, bool due_to_errors,
-	    void *arg);
-
-	/** Callback when error occurs.
-	 *
-	 * @param dev Device where error occurred.
-	 * @param err_code Error code (as returned from usb_pipe_read).
-	 * @param arg Custom argument.
-	 * @return Whether to continue in polling.
-	 */
-	bool (*on_error)(usb_device_t *dev, errno_t err_code, void *arg);
-
-	/**
-	 * Internal parameters - user is not expected to set them. Messing with
-	 * them can result in unexpected behavior if you do not know what you
-	 * are doing.
-	 */
-
-	/** Fibril used for polling. */
-	fid_t fibril;
-
-	/** True if polling is currently in operation. */
-	volatile bool running;
-
-	/** True if polling should terminate as soon as possible. */
-	volatile bool joining;
-
-	/** Synchronization primitives for joining polling end. */
-	fibril_mutex_t guard;
-	fibril_condvar_t cv;
-} usb_polling_t;
-
-errno_t usb_polling_init(usb_polling_t *);
-void usb_polling_fini(usb_polling_t *);
-
-errno_t usb_polling_start(usb_polling_t *);
-errno_t usb_polling_join(usb_polling_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/recognise.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/recognise.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device recognition.
- */
-
-#ifndef LIBUSBDEV_RECOGNISE_H_
-#define LIBUSBDEV_RECOGNISE_H_
-
-#include <usb/descriptor.h>
-#include <usb/dev/pipes.h>
-
-#include <devman.h>
-
-extern errno_t usb_device_create_match_ids_from_device_descriptor(
-    const usb_standard_device_descriptor_t *, match_id_list_t *);
-
-extern errno_t usb_device_create_match_ids_from_interface(
-    const usb_standard_device_descriptor_t *,
-    const usb_standard_interface_descriptor_t *, match_id_list_t *);
-
-extern errno_t usb_device_create_match_ids(usb_pipe_t *, match_id_list_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbdev/include/usb/dev/request.h
===================================================================
--- uspace/lib/usbdev/include/usb/dev/request.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * Standard USB requests.
- */
-#ifndef LIBUSBDEV_REQUEST_H_
-#define LIBUSBDEV_REQUEST_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <l18n/langs.h>
-#include <usb/usb.h>
-#include <usb/dev/pipes.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-
-errno_t usb_control_request_set(usb_pipe_t *,
-    usb_request_type_t, usb_request_recipient_t, uint8_t,
-    uint16_t, uint16_t, const void *, size_t);
-
-errno_t usb_control_request_get(usb_pipe_t *,
-    usb_request_type_t, usb_request_recipient_t, uint8_t,
-    uint16_t, uint16_t, void *, size_t, size_t *);
-
-errno_t usb_request_get_status(usb_pipe_t *, usb_request_recipient_t,
-    uint16_t, uint16_t *);
-errno_t usb_request_clear_feature(usb_pipe_t *, usb_request_type_t,
-    usb_request_recipient_t, uint16_t, uint16_t);
-errno_t usb_request_set_feature(usb_pipe_t *, usb_request_type_t,
-    usb_request_recipient_t, uint16_t, uint16_t);
-errno_t usb_request_get_descriptor(usb_pipe_t *, usb_request_type_t,
-    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void *, size_t,
-    size_t *);
-errno_t usb_request_get_descriptor_alloc(usb_pipe_t *, usb_request_type_t,
-    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, void **, size_t *);
-errno_t usb_request_get_device_descriptor(usb_pipe_t *,
-    usb_standard_device_descriptor_t *);
-errno_t usb_request_get_bare_configuration_descriptor(usb_pipe_t *, int,
-    usb_standard_configuration_descriptor_t *);
-errno_t usb_request_get_full_configuration_descriptor(usb_pipe_t *, int,
-    void *, size_t, size_t *);
-errno_t usb_request_get_full_configuration_descriptor_alloc(usb_pipe_t *,
-    int, void **, size_t *);
-errno_t usb_request_set_descriptor(usb_pipe_t *, usb_request_type_t,
-    usb_request_recipient_t, uint8_t, uint8_t, uint16_t, const void *, size_t);
-
-errno_t usb_request_get_configuration(usb_pipe_t *, uint8_t *);
-errno_t usb_request_set_configuration(usb_pipe_t *, uint8_t);
-
-errno_t usb_request_get_interface(usb_pipe_t *, uint8_t, uint8_t *);
-errno_t usb_request_set_interface(usb_pipe_t *, uint8_t, uint8_t);
-
-errno_t usb_request_get_supported_languages(usb_pipe_t *,
-    l18_win_locales_t **, size_t *);
-errno_t usb_request_get_string(usb_pipe_t *, size_t, l18_win_locales_t,
-    char **);
-
-errno_t usb_pipe_clear_halt(usb_pipe_t *, usb_pipe_t *);
-errno_t usb_request_get_endpoint_status(usb_pipe_t *, usb_pipe_t *, uint16_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbdev/meson.build
===================================================================
--- uspace/lib/usbdev/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usb' , 'drv' ]
-src = files(
-	'src/altiface.c',
-	'src/driver.c',
-	'src/devdrv.c',
-	'src/devpoll.c',
-	'src/dp.c',
-	'src/pipes.c',
-	'src/pipesinit.c',
-	'src/recognise.c',
-	'src/request.c',
-)
Index: pace/lib/usbdev/src/altiface.c
===================================================================
--- uspace/lib/usbdev/src/altiface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * Handling alternate interface settings.
- */
-
-#include <usb/dev/alternate_ifaces.h>
-#include <usb/dev/dp.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stddef.h>
-
-/** Count number of alternate settings of a interface.
- *
- * @param config_descr Full configuration descriptor.
- * @param config_descr_size Size of @p config_descr in bytes.
- * @param interface_no Interface number.
- * @return Number of alternate interfaces for @p interface_no interface.
- */
-size_t usb_interface_count_alternates(const uint8_t *config_descr,
-    size_t config_descr_size, uint8_t interface_no)
-{
-	assert(config_descr != NULL);
-	assert(config_descr_size > 0);
-
-	const usb_dp_parser_t dp_parser = {
-		.nesting = usb_dp_standard_descriptor_nesting
-	};
-	const usb_dp_parser_data_t dp_data = {
-		.data = config_descr,
-		.size = config_descr_size,
-		.arg = NULL
-	};
-
-	size_t alternate_count = 0;
-
-	const void *iface_ptr =
-	    usb_dp_get_nested_descriptor(&dp_parser, &dp_data, config_descr);
-	while (iface_ptr != NULL) {
-		const usb_standard_interface_descriptor_t *iface = iface_ptr;
-		if (iface->descriptor_type == USB_DESCTYPE_INTERFACE &&
-		    iface->interface_number == interface_no) {
-			++alternate_count;
-		}
-		iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
-		    config_descr, iface_ptr);
-	}
-
-	return alternate_count;
-}
-
-/** Initialize alternate interface representation structure.
- *
- * @param[in] alternates Pointer to allocated structure.
- * @param[in] config_descr Configuration descriptor.
- * @param[in] config_descr_size Size of configuration descriptor.
- * @param[in] interface_number Interface number.
- * @return Error code.
- */
-errno_t usb_alternate_interfaces_init(usb_alternate_interfaces_t *alternates,
-    const uint8_t *config_descr, size_t config_descr_size, int interface_number)
-{
-	assert(alternates != NULL);
-	assert(config_descr != NULL);
-	assert(config_descr_size > 0);
-
-	alternates->alternatives = NULL;
-	alternates->alternative_count = 0;
-	alternates->current = 0;
-
-	/* No interfaces. */
-	if (interface_number < 0) {
-		return EOK;
-	}
-
-	const size_t alt_count = usb_interface_count_alternates(config_descr,
-	    config_descr_size, interface_number);
-
-	if (alt_count == 0) {
-		return ENOENT;
-	}
-
-	usb_alternate_interface_descriptors_t *alts = calloc(alt_count,
-	    sizeof(usb_alternate_interface_descriptors_t));
-	if (alts == NULL) {
-		return ENOMEM;
-	}
-
-	const usb_dp_parser_t dp_parser = {
-		.nesting = usb_dp_standard_descriptor_nesting
-	};
-	const usb_dp_parser_data_t dp_data = {
-		.data = config_descr,
-		.size = config_descr_size,
-		.arg = NULL
-	};
-
-	const void *iface_ptr =
-	    usb_dp_get_nested_descriptor(&dp_parser, &dp_data, dp_data.data);
-
-	usb_alternate_interface_descriptors_t *iterator = alts;
-	for (; iface_ptr != NULL && iterator < &alts[alt_count]; ++iterator) {
-		const usb_standard_interface_descriptor_t *iface = iface_ptr;
-
-		if ((iface->descriptor_type != USB_DESCTYPE_INTERFACE) ||
-		    (iface->interface_number != interface_number)) {
-			/*
-			 * This is not a valid alternate interface descriptor
-			 * for interface with number == interface_number.
-			 */
-			iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser,
-			    &dp_data, dp_data.data, iface_ptr);
-			continue;
-		}
-
-		iterator->interface = iface;
-		iterator->nested_descriptors = iface_ptr + sizeof(*iface);
-
-		/* Find next interface to count size of nested descriptors. */
-		iface_ptr = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
-		    dp_data.data, iface_ptr);
-
-		const uint8_t *next = (iface_ptr == NULL) ?
-		    dp_data.data + dp_data.size : iface_ptr;
-
-		iterator->nested_descriptors_size =
-		    next - iterator->nested_descriptors;
-	}
-
-	alternates->alternatives = alts;
-	alternates->alternative_count = alt_count;
-
-	return EOK;
-}
-
-/** Clean initialized structure.
- * @param instance structure do deinitialize.
- */
-void usb_alternate_interfaces_deinit(usb_alternate_interfaces_t *instance)
-{
-	if (!instance)
-		return;
-	free(instance->alternatives);
-	instance->alternatives = NULL;
-}
-/**
- * @}
- */
Index: pace/lib/usbdev/src/devdrv.c
===================================================================
--- uspace/lib/usbdev/src/devdrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,633 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework.
- */
-
-#include <usb_iface.h>
-#include <usb/dev/alternate_ifaces.h>
-#include <usb/dev/device.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/request.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/usb.h>
-
-#include <assert.h>
-#include <async.h>
-#include <devman.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdlib.h>
-
-#include <ddf/driver.h>
-
-/** USB device structure. */
-struct usb_device {
-	/** Connection to device on USB bus */
-	usb_dev_session_t *bus_session;
-
-	/** devman handle */
-	devman_handle_t handle;
-
-	/** The default control pipe. */
-	usb_pipe_t ctrl_pipe;
-
-	/** Other endpoint pipes.
-	 *
-	 * This is an array of other endpoint pipes in the same order as
-	 * in usb_driver_t.
-	 */
-	usb_endpoint_mapping_t *pipes;
-
-	/** Number of other endpoint pipes. */
-	size_t pipes_count;
-
-	/** USB address of this device */
-	usb_address_t address;
-
-	/** Depth in the USB hub hiearchy */
-	unsigned depth;
-
-	/** USB speed of this device */
-	usb_speed_t speed;
-
-	/** Current interface.
-	 *
-	 * Usually, drivers operate on single interface only.
-	 * This item contains the value of the interface or -1 for any.
-	 */
-	int interface_no;
-
-	/** Alternative interfaces. */
-	usb_alternate_interfaces_t alternate_interfaces;
-
-	/** Some useful descriptors for USB device. */
-	usb_device_descriptors_t descriptors;
-
-	/** Generic DDF device backing this one. DO NOT TOUCH! */
-	ddf_dev_t *ddf_dev;
-
-	/** Custom driver data.
-	 *
-	 * Do not use the entry in generic device, that is already used
-	 * by the framework.
-	 */
-	void *driver_data;
-};
-
-/** Count number of pipes the driver expects.
- *
- * @param drv USB driver.
- * @return Number of pipes (excluding default control pipe).
- */
-static inline size_t count_pipes(const usb_endpoint_description_t **endpoints)
-{
-	size_t count = 0;
-	while (endpoints != NULL && endpoints[count] != NULL)
-		++count;
-	return count;
-}
-
-/** Change interface setting of a device.
- * This function selects new alternate setting of an interface by issuing
- * proper USB command to the device and also creates new USB pipes
- * under @c dev->pipes.
- *
- * @warning This function is intended for drivers working at interface level.
- * For drivers controlling the whole device, you need to change interface
- * manually using usb_request_set_interface() and creating new pipes
- * with usb_pipe_initialize_from_configuration().
- *
- * @warning This is a wrapper function that does several operations that
- * can fail and that cannot be rollbacked easily. That means that a failure
- * during the SET_INTERFACE request would result in having a device with
- * no pipes at all (except the default control one). That is because the old
- * pipes needs to be unregistered at HC first and the new ones could not
- * be created.
- *
- * @param dev USB device.
- * @param alternate_setting Alternate setting to choose.
- * @param endpoints New endpoint descriptions.
- * @return Error code.
- */
-errno_t usb_device_select_interface(usb_device_t *usb_dev,
-    uint8_t alternate_setting, const usb_endpoint_description_t **endpoints)
-{
-	assert(usb_dev);
-
-	if (usb_dev->interface_no < 0) {
-		return EINVAL;
-	}
-
-	/* Change the interface itself. */
-	errno_t rc = usb_request_set_interface(&usb_dev->ctrl_pipe,
-	    usb_dev->interface_no, alternate_setting);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Change current alternative */
-	usb_dev->alternate_interfaces.current = alternate_setting;
-
-	/* Destroy existing pipes. */
-	usb_device_destroy_pipes(usb_dev);
-
-	/* Create new pipes. */
-	rc = usb_device_create_pipes(usb_dev, endpoints);
-
-	return rc;
-}
-
-/** Retrieve basic descriptors from the device.
- *
- * @param[in] ctrl_pipe Control endpoint pipe.
- * @param[out] descriptors Where to store the descriptors.
- * @return Error code.
- */
-static errno_t usb_device_retrieve_descriptors(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	assert(usb_dev->descriptors.full_config == NULL);
-
-	/* Get the device descriptor. */
-	errno_t rc = usb_request_get_device_descriptor(&usb_dev->ctrl_pipe,
-	    &usb_dev->descriptors.device);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Get the full configuration descriptor. */
-	rc = usb_request_get_full_configuration_descriptor_alloc(
-	    &usb_dev->ctrl_pipe, 0,
-	    &usb_dev->descriptors.full_config,
-	    &usb_dev->descriptors.full_config_size);
-
-	return rc;
-}
-
-/** Cleanup structure initialized via usb_device_retrieve_descriptors.
- *
- * @param[in] descriptors Where to store the descriptors.
- */
-static void usb_device_release_descriptors(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	free(usb_dev->descriptors.full_config);
-	usb_dev->descriptors.full_config = NULL;
-	usb_dev->descriptors.full_config_size = 0;
-}
-
-/** Create pipes for a device.
- *
- * This is more or less a wrapper that does following actions:
- * - allocate and initialize pipes
- * - map endpoints to the pipes based on the descriptions
- * - registers endpoints with the host controller
- *
- * @param[in] endpoints Endpoints description, NULL terminated.
- * @param[in] config_descr Configuration descriptor of active configuration.
- * @param[in] config_descr_size Size of @p config_descr in bytes.
- * @param[in] interface_no Interface to map from.
- * @param[in] interface_setting Interface setting (default is usually 0).
- * @param[out] pipes_ptr Where to store array of created pipes
- *	(not NULL terminated).
- * @param[out] pipes_count_ptr Where to store number of pipes
- *	(set to NULL if you wish to ignore the count).
- * @return Error code.
- */
-errno_t usb_device_create_pipes(usb_device_t *usb_dev,
-    const usb_endpoint_description_t **endpoints)
-{
-	assert(usb_dev);
-	assert(usb_dev->descriptors.full_config);
-	assert(usb_dev->pipes == NULL);
-	assert(usb_dev->pipes_count == 0);
-
-	size_t pipe_count = count_pipes(endpoints);
-	if (pipe_count == 0) {
-		return EOK;
-	}
-
-	usb_endpoint_mapping_t *pipes =
-	    calloc(pipe_count, sizeof(usb_endpoint_mapping_t));
-	if (pipes == NULL) {
-		return ENOMEM;
-	}
-
-	/* Now initialize. */
-	for (size_t i = 0; i < pipe_count; i++) {
-		pipes[i].description = endpoints[i];
-		pipes[i].interface_no = usb_dev->interface_no;
-		pipes[i].interface_setting =
-		    usb_dev->alternate_interfaces.current;
-	}
-
-	/* Find the mapping from configuration descriptor. */
-	errno_t rc = usb_pipe_initialize_from_configuration(pipes, pipe_count,
-	    usb_dev->descriptors.full_config,
-	    usb_dev->descriptors.full_config_size,
-	    usb_dev->bus_session);
-	if (rc != EOK) {
-		free(pipes);
-		return rc;
-	}
-
-	/* Register created pipes. */
-	unsigned pipes_registered = 0;
-	for (size_t i = 0; i < pipe_count; i++) {
-		if (pipes[i].present) {
-			rc = usb_pipe_register(&pipes[i].pipe, pipes[i].descriptor, pipes[i].companion_descriptor);
-			if (rc != EOK) {
-				goto rollback_unregister_endpoints;
-			}
-		}
-		pipes_registered++;
-	}
-
-	usb_dev->pipes = pipes;
-	usb_dev->pipes_count = pipe_count;
-
-	return EOK;
-
-	/*
-	 * Jump here if something went wrong after endpoints have
-	 * been registered.
-	 * This is also the target when the registration of
-	 * endpoints fails.
-	 */
-rollback_unregister_endpoints:
-	for (size_t i = 0; i < pipes_registered; i++) {
-		if (pipes[i].present) {
-			usb_pipe_unregister(&pipes[i].pipe);
-		}
-	}
-
-	free(pipes);
-	return rc;
-}
-
-/** Destroy pipes previously created by usb_device_create_pipes.
- *
- * @param[in] usb_dev USB device.
- *
- */
-void usb_device_destroy_pipes(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	assert(usb_dev->pipes || usb_dev->pipes_count == 0);
-
-	/* Destroy the pipes. */
-	int rc;
-	for (size_t i = 0; i < usb_dev->pipes_count; ++i) {
-		usb_log_debug2("Unregistering pipe %zu: %spresent.",
-		    i, usb_dev->pipes[i].present ? "" : "not ");
-
-		rc = usb_device_unmap_ep(usb_dev->pipes + i);
-		if (rc != EOK && rc != ENOENT)
-			usb_log_warning("Unregistering pipe %zu failed: %s", i, str_error(rc));
-	}
-
-	free(usb_dev->pipes);
-	usb_dev->pipes = NULL;
-	usb_dev->pipes_count = 0;
-}
-
-usb_pipe_t *usb_device_get_default_pipe(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return &usb_dev->ctrl_pipe;
-}
-
-usb_endpoint_mapping_t *usb_device_get_mapped_ep_desc(usb_device_t *usb_dev,
-    const usb_endpoint_description_t *desc)
-{
-	assert(usb_dev);
-	for (unsigned i = 0; i < usb_dev->pipes_count; ++i) {
-		if (usb_dev->pipes[i].description == desc)
-			return &usb_dev->pipes[i];
-	}
-	return NULL;
-}
-
-int usb_device_unmap_ep(usb_endpoint_mapping_t *epm)
-{
-	assert(epm);
-
-	if (!epm->present)
-		return ENOENT;
-
-	const int rc = usb_pipe_unregister(&epm->pipe);
-	if (rc != EOK)
-		return rc;
-
-	epm->present = false;
-	return EOK;
-}
-
-usb_address_t usb_device_get_address(const usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->depth;
-}
-
-unsigned usb_device_get_depth(const usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->depth;
-}
-
-usb_speed_t usb_device_get_speed(const usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->speed;
-}
-
-int usb_device_get_iface_number(const usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->interface_no;
-}
-
-devman_handle_t usb_device_get_devman_handle(const usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->handle;
-}
-
-const usb_device_descriptors_t *usb_device_descriptors(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return &usb_dev->descriptors;
-}
-
-const usb_alternate_interfaces_t *usb_device_get_alternative_ifaces(
-    usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return &usb_dev->alternate_interfaces;
-}
-
-/** Clean instance of a USB device.
- *
- * @param dev Device to be de-initialized.
- *
- * Does not free/destroy supplied pointer.
- */
-static void usb_device_fini(usb_device_t *usb_dev)
-{
-	if (usb_dev) {
-		/* Destroy existing pipes. */
-		usb_device_destroy_pipes(usb_dev);
-		/* Ignore errors and hope for the best. */
-		usb_alternate_interfaces_deinit(&usb_dev->alternate_interfaces);
-		usb_device_release_descriptors(usb_dev);
-		free(usb_dev->driver_data);
-		usb_dev->driver_data = NULL;
-		usb_dev_disconnect(usb_dev->bus_session);
-		usb_dev->bus_session = NULL;
-	}
-}
-
-/** Initialize new instance of USB device.
- *
- * @param[in] usb_dev Pointer to the new device.
- * @param[in] ddf_dev Generic DDF device backing the USB one.
- * @param[in] endpoints NULL terminated array of endpoints (NULL for none).
- * @param[out] errstr_ptr Where to store description of context
- *	(in case error occurs).
- * @return Error code.
- */
-static errno_t usb_device_init(usb_device_t *usb_dev, ddf_dev_t *ddf_dev,
-    const usb_endpoint_description_t **endpoints, const char **errstr_ptr)
-{
-	assert(usb_dev != NULL);
-	assert(errstr_ptr);
-
-	*errstr_ptr = NULL;
-
-	usb_dev->ddf_dev = ddf_dev;
-	usb_dev->driver_data = NULL;
-	usb_dev->descriptors.full_config = NULL;
-	usb_dev->descriptors.full_config_size = 0;
-	usb_dev->pipes_count = 0;
-	usb_dev->pipes = NULL;
-
-	usb_dev->bus_session = usb_dev_connect(usb_dev->handle);
-
-	if (!usb_dev->bus_session) {
-		*errstr_ptr = "device bus session create";
-		return ENOMEM;
-	}
-
-	/*
-	 * This pipe was registered by the hub driver,
-	 * during device initialization.
-	 */
-	errno_t rc = usb_pipe_initialize_default_control(&usb_dev->ctrl_pipe, usb_dev->bus_session);
-	if (rc != EOK) {
-		usb_dev_disconnect(usb_dev->bus_session);
-		*errstr_ptr = "default control pipe initialization";
-		return rc;
-	}
-
-	/* Retrieve standard descriptors. */
-	rc = usb_device_retrieve_descriptors(usb_dev);
-	if (rc != EOK) {
-		*errstr_ptr = "descriptor retrieval";
-		usb_dev_disconnect(usb_dev->bus_session);
-		return rc;
-	}
-
-	/*
-	 * Create alternate interfaces. We will silently ignore failure.
-	 * We might either control one interface or an entire device,
-	 * it makes no sense to speak about alternate interfaces when
-	 * controlling a device.
-	 */
-	usb_alternate_interfaces_init(&usb_dev->alternate_interfaces,
-	    usb_dev->descriptors.full_config,
-	    usb_dev->descriptors.full_config_size, usb_dev->interface_no);
-
-	if (endpoints) {
-		/* Create and register other pipes than default control (EP 0) */
-		rc = usb_device_create_pipes(usb_dev, endpoints);
-		if (rc != EOK) {
-			usb_device_fini(usb_dev);
-			*errstr_ptr = "pipes initialization";
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-static errno_t usb_device_get_info(async_sess_t *sess, usb_device_t *dev)
-{
-	assert(dev);
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return EPARTY;
-
-	usb_device_desc_t dev_desc;
-	const errno_t ret = usb_get_my_description(exch, &dev_desc);
-
-	if (ret == EOK) {
-		dev->address = dev_desc.address;
-		dev->depth = dev_desc.depth;
-		dev->speed = dev_desc.speed;
-		dev->handle = dev_desc.handle;
-		dev->interface_no = dev_desc.iface;
-	}
-
-	async_exchange_end(exch);
-	return ret;
-}
-
-errno_t usb_device_create_ddf(ddf_dev_t *ddf_dev,
-    const usb_endpoint_description_t **desc, const char **err)
-{
-	assert(ddf_dev);
-	assert(err);
-
-	async_sess_t *sess = ddf_dev_parent_sess_get(ddf_dev);
-	if (sess == NULL)
-		return ENOMEM;
-
-	usb_device_t *usb_dev =
-	    ddf_dev_data_alloc(ddf_dev, sizeof(usb_device_t));
-	if (usb_dev == NULL) {
-		*err = "DDF data alloc";
-		return ENOMEM;
-	}
-
-	const errno_t ret = usb_device_get_info(sess, usb_dev);
-	if (ret != EOK)
-		return ret;
-
-	return usb_device_init(usb_dev, ddf_dev, desc, err);
-}
-
-void usb_device_destroy_ddf(ddf_dev_t *ddf_dev)
-{
-	assert(ddf_dev);
-	usb_device_t *usb_dev = ddf_dev_data_get(ddf_dev);
-	assert(usb_dev);
-	usb_device_fini(usb_dev);
-	return;
-}
-
-usb_device_t *usb_device_create(devman_handle_t handle)
-{
-	usb_device_t *usb_dev = malloc(sizeof(usb_device_t));
-	if (!usb_dev)
-		return NULL;
-
-	async_sess_t *sess = devman_device_connect(handle, IPC_FLAG_BLOCKING);
-	errno_t ret = usb_device_get_info(sess, usb_dev);
-	if (sess)
-		async_hangup(sess);
-	if (ret != EOK) {
-		free(usb_dev);
-		return NULL;
-	}
-
-	const char *dummy = NULL;
-	ret = usb_device_init(usb_dev, NULL, NULL, &dummy);
-	if (ret != EOK) {
-		free(usb_dev);
-		usb_dev = NULL;
-	}
-	return usb_dev;
-}
-
-void usb_device_destroy(usb_device_t *usb_dev)
-{
-	if (usb_dev) {
-		usb_device_fini(usb_dev);
-		free(usb_dev);
-	}
-}
-
-const char *usb_device_get_name(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	if (usb_dev->ddf_dev)
-		return ddf_dev_get_name(usb_dev->ddf_dev);
-	return NULL;
-}
-
-ddf_fun_t *usb_device_ddf_fun_create(usb_device_t *usb_dev, fun_type_t ftype,
-    const char *name)
-{
-	assert(usb_dev);
-	if (usb_dev->ddf_dev)
-		return ddf_fun_create(usb_dev->ddf_dev, ftype, name);
-	return NULL;
-}
-
-async_exch_t *usb_device_bus_exchange_begin(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return async_exchange_begin(usb_dev->bus_session);
-}
-
-void usb_device_bus_exchange_end(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Allocate driver specific data.
- * @param usb_dev usb_device structure.
- * @param size requested data size.
- * @return Pointer to the newly allocated space, NULL on failure.
- */
-void *usb_device_data_alloc(usb_device_t *usb_dev, size_t size)
-{
-	assert(usb_dev);
-	assert(usb_dev->driver_data == NULL);
-	return usb_dev->driver_data = calloc(1, size);
-
-}
-
-void *usb_device_data_get(usb_device_t *usb_dev)
-{
-	assert(usb_dev);
-	return usb_dev->driver_data;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/devpoll.c
===================================================================
--- uspace/lib/usbdev/src/devpoll.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2017 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework - automatic interrupt polling.
- */
-
-#include <usb/dev/device.h>
-#include <usb/dev/pipes.h>
-#include <usb/dev/poll.h>
-#include <usb/dev/request.h>
-#include <usb/classes/classes.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/usb.h>
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Initialize the polling data structure, its internals and configuration
- *  with default values.
- *
- * @param polling Valid polling data structure.
- * @return Error code.
- * @retval EOK Polling data structure is ready to be used.
- */
-int usb_polling_init(usb_polling_t *polling)
-{
-	if (!polling)
-		return EBADMEM;
-
-	/* Zero out everything */
-	memset(polling, 0, sizeof(usb_polling_t));
-
-	/* Internal initializers. */
-	fibril_mutex_initialize(&polling->guard);
-	fibril_condvar_initialize(&polling->cv);
-
-	/* Default configuration. */
-	polling->auto_clear_halt = true;
-	polling->delay = -1;
-	polling->max_failures = 3;
-
-	return EOK;
-}
-
-/** Destroy the polling data structure.
- *  This function does nothing but a safety check whether the polling
- *  was joined successfully.
- *
- * @param polling Polling data structure.
- */
-void usb_polling_fini(usb_polling_t *polling)
-{
-	/* Nothing done at the moment. */
-	assert(polling);
-	assert(!polling->running);
-}
-
-/** Polling fibril.
- *
- * @param arg Pointer to usb_polling_t.
- * @return Always EOK.
- */
-static errno_t polling_fibril(void *arg)
-{
-	assert(arg);
-	usb_polling_t *polling = arg;
-
-	fibril_mutex_lock(&polling->guard);
-	polling->running = true;
-	fibril_mutex_unlock(&polling->guard);
-
-	usb_pipe_t *pipe = &polling->ep_mapping->pipe;
-
-	if (polling->debug > 0) {
-		const usb_endpoint_mapping_t *mapping =
-		    polling->ep_mapping;
-		usb_log_debug("Poll (%p): started polling of `%s' - "
-		    "interface %d (%s,%d,%d), %zuB/%zu.\n",
-		    polling, usb_device_get_name(polling->device),
-		    (int) mapping->interface->interface_number,
-		    usb_str_class(mapping->interface->interface_class),
-		    (int) mapping->interface->interface_subclass,
-		    (int) mapping->interface->interface_protocol,
-		    polling->request_size, pipe->desc.max_transfer_size);
-	}
-
-	size_t failed_attempts = 0;
-	while (failed_attempts <= polling->max_failures) {
-		size_t actual_size;
-		const errno_t rc = usb_pipe_read(pipe, polling->buffer,
-		    polling->request_size, &actual_size);
-
-		if (rc == EOK) {
-			if (polling->debug > 1) {
-				usb_log_debug(
-				    "Poll%p: received: '%s' (%zuB).\n",
-				    polling,
-				    usb_debug_str_buffer(polling->buffer,
-				    actual_size, 16),
-				    actual_size);
-			}
-		} else {
-			usb_log_debug(
-			    "Poll%p: polling failed: %s.\n",
-			    polling, str_error(rc));
-		}
-
-		/* If the pipe stalled, we can try to reset the stall. */
-		if (rc == ESTALL && polling->auto_clear_halt) {
-			/*
-			 * We ignore error here as this is usually a futile
-			 * attempt anyway.
-			 */
-			usb_pipe_clear_halt(
-			    usb_device_get_default_pipe(polling->device), pipe);
-		}
-
-		if (rc != EOK) {
-			++failed_attempts;
-			const bool carry_on = !polling->on_error ? true :
-			    polling->on_error(polling->device, rc, polling->arg);
-
-			if (!carry_on || polling->joining) {
-				/* This is user requested abort, erases failures. */
-				failed_attempts = 0;
-				break;
-			}
-			continue;
-		}
-
-		/* We have the data, execute the callback now. */
-		assert(polling->on_data);
-		const bool carry_on = polling->on_data(polling->device,
-		    polling->buffer, actual_size, polling->arg);
-
-		if (!carry_on) {
-			/* This is user requested abort, erases failures. */
-			failed_attempts = 0;
-			break;
-		}
-
-		/* Reset as something might be only a temporary problem. */
-		failed_attempts = 0;
-
-		/* Take a rest before next request. */
-
-		// FIXME TODO: This is broken, the time is in ms not us.
-		// but first we need to fix drivers to actually stop using this,
-		// since polling delay should be implemented in HC schedule
-		fibril_usleep(polling->delay);
-	}
-
-	const bool failed = failed_attempts > 0;
-
-	if (polling->on_polling_end)
-		polling->on_polling_end(polling->device, failed, polling->arg);
-
-	if (polling->debug > 0) {
-		if (failed) {
-			usb_log_error("Polling of device `%s' terminated: "
-			    "recurring failures.\n",
-			    usb_device_get_name(polling->device));
-		} else {
-			usb_log_debug("Polling of device `%s' terminated: "
-			    "driver request.\n",
-			    usb_device_get_name(polling->device));
-		}
-	}
-
-	fibril_mutex_lock(&polling->guard);
-	polling->running = false;
-	fibril_mutex_unlock(&polling->guard);
-
-	/* Notify joiners, if any. */
-	fibril_condvar_broadcast(&polling->cv);
-	return EOK;
-}
-
-/** Start automatic device polling over interrupt in pipe.
- *
- * The polling settings is copied thus it is okay to destroy the structure
- * after this function returns.
- *
- * @warning There is no guarantee when the request to the device
- * will be sent for the first time (it is possible that this
- * first request would be executed prior to return from this function).
- *
- * @param polling Polling data structure.
- * @return Error code.
- * @retval EOK New fibril polling the device was already started.
- */
-errno_t usb_polling_start(usb_polling_t *polling)
-{
-	if (!polling || !polling->device || !polling->ep_mapping || !polling->on_data)
-		return EBADMEM;
-
-	if (!polling->request_size)
-		return EINVAL;
-
-	if (!polling->ep_mapping || (polling->ep_mapping->pipe.desc.transfer_type != USB_TRANSFER_INTERRUPT) ||
-	    (polling->ep_mapping->pipe.desc.direction != USB_DIRECTION_IN))
-		return EINVAL;
-
-	/* Negative value means use descriptor provided value. */
-	if (polling->delay < 0)
-		polling->delay = polling->ep_mapping->descriptor->poll_interval;
-
-	polling->fibril = fibril_create(polling_fibril, polling);
-	if (!polling->fibril)
-		return ENOMEM;
-
-	fibril_add_ready(polling->fibril);
-
-	/* Fibril launched. That fibril will free the allocated data. */
-	return EOK;
-}
-
-/** Close the polling pipe permanently and synchronously wait
- *  until the automatic polling fibril terminates.
- *
- *  It is safe to deallocate the polling data structure (and its
- *  data buffer) only after a successful call to this function.
- *
- *  @warning Call to this function will trigger execution of the
- *  on_error() callback with EINTR error code.
- *
- *  @parram polling Polling data structure.
- *  @return Error code.
- *  @retval EOK Polling fibril has been successfully terminated.
- */
-errno_t usb_polling_join(usb_polling_t *polling)
-{
-	errno_t rc;
-	if (!polling)
-		return EBADMEM;
-
-	/* Check if the fibril already terminated. */
-	if (!polling->running)
-		return EOK;
-
-	/* Set the flag */
-	polling->joining = true;
-
-	/* Unregister the pipe. */
-	rc = usb_device_unmap_ep(polling->ep_mapping);
-	if (rc != EOK && rc != ENOENT && rc != EHANGUP)
-		return rc;
-
-	/* Wait for the fibril to terminate. */
-	fibril_mutex_lock(&polling->guard);
-	while (polling->running)
-		fibril_condvar_wait(&polling->cv, &polling->guard);
-	fibril_mutex_unlock(&polling->guard);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/dp.c
===================================================================
--- uspace/lib/usbdev/src/dp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,335 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/**
- * @file
- * USB descriptor parser (implementation).
- *
- * The descriptor parser is a generic parser for structure, where individual
- * items are stored in single buffer and each item begins with length followed
- * by type. These types are organized into tree hierarchy.
- *
- * The parser is able of only two actions: find first child and find next
- * sibling.
- */
-#include <usb/dev/dp.h>
-#include <usb/descriptor.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define NESTING(parentname, childname) \
-	{ \
-		.child = USB_DESCTYPE_##childname, \
-		.parent = USB_DESCTYPE_##parentname, \
-	}
-#define LAST_NESTING { -1, -1 }
-
-/** Nesting of standard USB descriptors. */
-const usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[] = {
-	NESTING(CONFIGURATION, INTERFACE),
-	NESTING(INTERFACE, ENDPOINT),
-	NESTING(ENDPOINT, SSPEED_EP_COMPANION),
-	NESTING(INTERFACE, HUB),
-	NESTING(INTERFACE, HID),
-	NESTING(HID, HID_REPORT),
-	LAST_NESTING
-};
-
-#undef NESTING
-#undef LAST_NESTING
-
-/** Tells whether pointer points inside descriptor data.
- *
- * @param data Parser data.
- * @param ptr Pointer to be verified.
- * @return Whether @p ptr points inside <code>data->data</code> field.
- */
-static bool is_valid_descriptor_pointer(const usb_dp_parser_data_t *data,
-    const uint8_t *ptr)
-{
-	if (ptr == NULL) {
-		return false;
-	}
-
-	if (ptr < data->data) {
-		return false;
-	}
-
-	if ((size_t)(ptr - data->data) >= data->size) {
-		return false;
-	}
-
-	return true;
-}
-
-/** Get next descriptor regardless of the nesting.
- *
- * @param data Parser data.
- * @param current Pointer to current descriptor.
- * @return Pointer to start of next descriptor.
- * @retval NULL Invalid input or no next descriptor.
- */
-static const uint8_t *get_next_descriptor(const usb_dp_parser_data_t *data,
-    const uint8_t *current)
-{
-	assert(is_valid_descriptor_pointer(data, current));
-
-	const uint8_t current_length = *current;
-	const uint8_t *next = current + current_length;
-
-	if (!is_valid_descriptor_pointer(data, next)) {
-		return NULL;
-	}
-
-	return next;
-}
-
-/** Get descriptor type.
- *
- * @see usb_descriptor_type_t
- *
- * @param data Parser data.
- * @param start Pointer to start of the descriptor.
- * @return Descriptor type.
- * @retval -1 Invalid input.
- */
-static int get_descriptor_type(const usb_dp_parser_data_t *data,
-    const uint8_t *start)
-{
-	if (start == NULL) {
-		return -1;
-	}
-
-	start++;
-	if (!is_valid_descriptor_pointer(data, start)) {
-		return -1;
-	} else {
-		return (int) (*start);
-	}
-}
-
-/** Tells whether descriptors could be nested.
- *
- * @param parser Parser.
- * @param child Child descriptor type.
- * @param parent Parent descriptor type.
- * @return Whether @p child could be child of @p parent.
- */
-static bool is_nested_descriptor_type(const usb_dp_parser_t *parser,
-    int child, int parent)
-{
-	const usb_dp_descriptor_nesting_t *nesting = parser->nesting;
-	while ((nesting->child > 0) && (nesting->parent > 0)) {
-		if ((nesting->child == child) && (nesting->parent == parent)) {
-			return true;
-		}
-		nesting++;
-	}
-	return false;
-}
-
-/** Tells whether descriptors could be nested.
- *
- * @param parser Parser.
- * @param data Parser data.
- * @param child Pointer to child descriptor.
- * @param parent Pointer to parent descriptor.
- * @return Whether @p child could be child of @p parent.
- */
-static bool is_nested_descriptor(const usb_dp_parser_t *parser,
-    const usb_dp_parser_data_t *data, const uint8_t *child, const uint8_t *parent)
-{
-	return is_nested_descriptor_type(parser,
-	    get_descriptor_type(data, child),
-	    get_descriptor_type(data, parent));
-}
-
-/** Find first nested descriptor of given parent.
- *
- * @param parser Parser.
- * @param data Parser data.
- * @param parent Pointer to the beginning of parent descriptor.
- * @return Pointer to the beginning of the first nested (child) descriptor.
- * @retval NULL No child descriptor found.
- * @retval NULL Invalid input.
- */
-const uint8_t *usb_dp_get_nested_descriptor(const usb_dp_parser_t *parser,
-    const usb_dp_parser_data_t *data, const uint8_t *parent)
-{
-	if (!is_valid_descriptor_pointer(data, parent)) {
-		return NULL;
-	}
-
-	const uint8_t *next = get_next_descriptor(data, parent);
-	if (next == NULL) {
-		return NULL;
-	}
-
-	if (is_nested_descriptor(parser, data, next, parent)) {
-		return next;
-	} else {
-		return NULL;
-	}
-}
-
-/** Skip all nested descriptors.
- *
- * @param parser Parser.
- * @param data Parser data.
- * @param parent Pointer to the beginning of parent descriptor.
- * @return Pointer to first non-child descriptor.
- * @retval NULL No next descriptor.
- * @retval NULL Invalid input.
- */
-static const uint8_t *skip_nested_descriptors(const usb_dp_parser_t *parser,
-    const usb_dp_parser_data_t *data, const uint8_t *parent)
-{
-	const uint8_t *child =
-	    usb_dp_get_nested_descriptor(parser, data, parent);
-	if (child == NULL) {
-		return get_next_descriptor(data, parent);
-	}
-	const uint8_t *next_child =
-	    skip_nested_descriptors(parser, data, child);
-	while (is_nested_descriptor(parser, data, next_child, parent)) {
-		next_child = skip_nested_descriptors(parser, data, next_child);
-	}
-
-	return next_child;
-}
-
-/** Get sibling descriptor.
- *
- * @param parser Parser.
- * @param data Parser data.
- * @param parent Pointer to common parent descriptor.
- * @param sibling Left sibling.
- * @return Pointer to first right sibling of @p sibling.
- * @retval NULL No sibling exist.
- * @retval NULL Invalid input.
- */
-const uint8_t *usb_dp_get_sibling_descriptor(
-    const usb_dp_parser_t *parser, const usb_dp_parser_data_t *data,
-    const uint8_t *parent, const uint8_t *sibling)
-{
-	if (!is_valid_descriptor_pointer(data, parent) ||
-	    !is_valid_descriptor_pointer(data, sibling)) {
-		return NULL;
-	}
-
-	const uint8_t *possible_sibling =
-	    skip_nested_descriptors(parser, data, sibling);
-	if (possible_sibling == NULL) {
-		return NULL;
-	}
-
-	int parent_type = get_descriptor_type(data, parent);
-	int possible_sibling_type = get_descriptor_type(data, possible_sibling);
-	if (is_nested_descriptor_type(parser,
-	    possible_sibling_type, parent_type)) {
-		return possible_sibling;
-	} else {
-		return NULL;
-	}
-}
-
-/** Browser of the descriptor tree.
- *
- * @see usb_dp_walk_simple
- *
- * @param parser Descriptor parser.
- * @param data Data for descriptor parser.
- * @param root Pointer to current root of the tree.
- * @param depth Current nesting depth.
- * @param callback Callback for each found descriptor.
- * @param arg Custom (user) argument.
- */
-static void usb_dp_browse_simple_internal(const usb_dp_parser_t *parser,
-    const usb_dp_parser_data_t *data, const uint8_t *root, size_t depth,
-    void (*callback)(const uint8_t *, size_t, void *), void *arg)
-{
-	if (root == NULL) {
-		return;
-	}
-	callback(root, depth, arg);
-	const uint8_t *child = usb_dp_get_nested_descriptor(parser, data, root);
-	do {
-		usb_dp_browse_simple_internal(parser, data, child, depth + 1,
-		    callback, arg);
-		child = usb_dp_get_sibling_descriptor(parser, data,
-		    root, child);
-	} while (child != NULL);
-}
-
-/** Browse flatten descriptor tree.
- *
- * The callback is called with following arguments: pointer to the start
- * of the descriptor (somewhere inside @p descriptors), depth of the nesting
- * (starting from 0 for the first descriptor) and the custom argument.
- * Note that the size of the descriptor is not passed because it can
- * be read from the first byte of the descriptor.
- *
- * @param descriptors Descriptor data.
- * @param descriptors_size Size of descriptor data (in bytes).
- * @param descriptor_nesting Possible descriptor nesting.
- * @param callback Callback for each found descriptor.
- * @param arg Custom (user) argument.
- */
-void usb_dp_walk_simple(const uint8_t *descriptors, size_t descriptors_size,
-    const usb_dp_descriptor_nesting_t *descriptor_nesting,
-    walk_callback_t callback, void *arg)
-{
-	if ((descriptors == NULL) || (descriptors_size == 0) ||
-	    (descriptor_nesting == NULL) || (callback == NULL)) {
-		return;
-	}
-
-	const usb_dp_parser_data_t data = {
-		.data = descriptors,
-		.size = descriptors_size,
-		.arg = NULL
-	};
-
-	const usb_dp_parser_t parser = {
-		.nesting = descriptor_nesting
-	};
-
-	usb_dp_browse_simple_internal(&parser, &data, descriptors,
-	    0, callback, arg);
-}
-
-/** @}
- */
Index: pace/lib/usbdev/src/driver.c
===================================================================
--- uspace/lib/usbdev/src/driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,186 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB device driver framework.
- */
-
-#include <usb/dev/driver.h>
-#include <usb/dev/device.h>
-#include <usb/debug.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <str_error.h>
-#include <ddf/driver.h>
-
-static const usb_driver_t *driver = NULL;
-
-/** Callback when a new device is supposed to be controlled by this driver.
- *
- * This callback is a wrapper for USB specific version of @c device_add.
- *
- * @param gen_dev Device structure as prepared by DDF.
- * @return Error code.
- */
-static errno_t generic_device_add(ddf_dev_t *gen_dev)
-{
-	assert(driver);
-	assert(driver->ops);
-	assert(driver->ops->device_add);
-
-	/* Initialize generic USB driver data. */
-	const char *err_msg = NULL;
-	errno_t rc = usb_device_create_ddf(gen_dev, driver->endpoints, &err_msg);
-	if (rc != EOK) {
-		usb_log_error("USB device `%s' init failed (%s): %s.",
-		    ddf_dev_get_name(gen_dev), err_msg, str_error(rc));
-		return rc;
-	}
-
-	/* Start USB driver specific initialization. */
-	rc = driver->ops->device_add(ddf_dev_data_get(gen_dev));
-	if (rc != EOK)
-		usb_device_destroy_ddf(gen_dev);
-	return rc;
-}
-
-/** Callback when a device is supposed to be removed from the system.
- *
- * This callback is a wrapper for USB specific version of @c device_remove.
- *
- * @param gen_dev Device structure as prepared by DDF.
- * @return Error code.
- */
-static errno_t generic_device_remove(ddf_dev_t *gen_dev)
-{
-	assert(driver);
-	assert(driver->ops);
-	if (driver->ops->device_remove == NULL)
-		return ENOTSUP;
-
-	/* Just tell the driver to stop whatever it is doing */
-	usb_device_t *usb_dev = ddf_dev_data_get(gen_dev);
-	const errno_t ret = driver->ops->device_remove(usb_dev);
-	if (ret != EOK)
-		return ret;
-
-	usb_device_destroy_ddf(gen_dev);
-	return EOK;
-}
-
-/** Callback when a device was removed from the system.
- *
- * This callback is a wrapper for USB specific version of @c device_gone.
- *
- * @param gen_dev Device structure as prepared by DDF.
- * @return Error code.
- */
-static errno_t generic_device_gone(ddf_dev_t *gen_dev)
-{
-	assert(driver);
-	assert(driver->ops);
-	if (driver->ops->device_gone == NULL)
-		return ENOTSUP;
-	usb_device_t *usb_dev = ddf_dev_data_get(gen_dev);
-	const errno_t ret = driver->ops->device_gone(usb_dev);
-	if (ret == EOK)
-		usb_device_destroy_ddf(gen_dev);
-
-	return ret;
-}
-
-/** Callback when the driver is asked to online a specific function.
- *
- * This callback is a wrapper for USB specific version of @c fun_online.
- *
- * @param gen_dev Device function structure as prepared by DDF.
- * @return Error code.
- */
-static int generic_function_online(ddf_fun_t *fun)
-{
-	assert(driver);
-	assert(driver->ops);
-	if (driver->ops->function_online == NULL)
-		return ENOTSUP;
-	return driver->ops->function_online(fun);
-}
-
-/** Callback when the driver is asked to offline a specific function.
- *
- * This callback is a wrapper for USB specific version of @c fun_offline.
- *
- * @param gen_dev Device function structure as prepared by DDF.
- * @return Error code.
- */
-static int generic_function_offline(ddf_fun_t *fun)
-{
-	assert(driver);
-	assert(driver->ops);
-	if (driver->ops->function_offline == NULL)
-		return ENOTSUP;
-	return driver->ops->function_offline(fun);
-}
-
-static driver_ops_t generic_driver_ops = {
-	.dev_add = generic_device_add,
-	.dev_remove = generic_device_remove,
-	.dev_gone = generic_device_gone,
-	.fun_online = generic_function_online,
-	.fun_offline = generic_function_offline,
-};
-static driver_t generic_driver = {
-	.driver_ops = &generic_driver_ops
-};
-
-/** Main routine of USB device driver.
- *
- * Under normal conditions, this function never returns.
- *
- * @param drv USB device driver structure.
- * @return Task exit status.
- */
-int usb_driver_main(const usb_driver_t *drv)
-{
-	assert(drv != NULL);
-
-	/* Prepare the generic driver. */
-	generic_driver.name = drv->name;
-
-	driver = drv;
-
-	return ddf_driver_main(&generic_driver);
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/pipes.c
===================================================================
--- uspace/lib/usbdev/src/pipes.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,462 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * USB endpoint pipes functions.
- */
-#include <usb/dev/pipes.h>
-#include <usb/dev/request.h>
-#include <usb/usb.h>
-#include <usb/dma_buffer.h>
-
-#include <assert.h>
-#include <bitops.h>
-#include <async.h>
-#include <as.h>
-#include <errno.h>
-#include <mem.h>
-
-/** Try to clear endpoint halt of default control pipe.
- *
- * @param pipe Pipe for control endpoint zero.
- */
-static void clear_self_endpoint_halt(usb_pipe_t *pipe)
-{
-	assert(pipe != NULL);
-
-	if (!pipe->auto_reset_halt || (pipe->desc.endpoint_no != 0)) {
-		return;
-	}
-
-	/* Prevent infinite recursion. */
-	pipe->auto_reset_halt = false;
-	usb_pipe_clear_halt(pipe, pipe);
-	pipe->auto_reset_halt = true;
-}
-
-/* Helper structure to avoid passing loads of arguments through */
-typedef struct {
-	usb_pipe_t *pipe;
-	usb_direction_t dir;
-	bool is_control;	// Only for checking purposes
-
-	usbhc_iface_transfer_request_t req;
-
-	size_t transferred_size;
-} transfer_t;
-
-/**
- * Issue a transfer in a separate exchange.
- */
-static errno_t transfer_common(transfer_t *t)
-{
-	if (!t->pipe)
-		return EBADMEM;
-
-	/* Only control writes make sense without buffer */
-	if ((t->dir != USB_DIRECTION_OUT || !t->is_control) && t->req.size == 0)
-		return EINVAL;
-
-	/* Nonzero size requires buffer */
-	if (!dma_buffer_is_set(&t->req.buffer) && t->req.size != 0)
-		return EINVAL;
-
-	/* Check expected direction */
-	if (t->pipe->desc.direction != USB_DIRECTION_BOTH &&
-	    t->pipe->desc.direction != t->dir)
-		return EBADF;
-
-	/* Check expected transfer type */
-	if ((t->pipe->desc.transfer_type == USB_TRANSFER_CONTROL) != t->is_control)
-		return EBADF;
-
-	async_exch_t *exch = async_exchange_begin(t->pipe->bus_session);
-	if (!exch)
-		return ENOMEM;
-
-	t->req.dir = t->dir;
-	t->req.endpoint = t->pipe->desc.endpoint_no;
-
-	const errno_t rc = usbhc_transfer(exch, &t->req, &t->transferred_size);
-
-	async_exchange_end(exch);
-
-	if (rc == ESTALL)
-		clear_self_endpoint_halt(t->pipe);
-
-	return rc;
-}
-
-/**
- * Setup the transfer request inside transfer according to dma buffer provided.
- *
- * TODO: The buffer could have been allocated as a more strict one. Currently,
- * we assume that the policy is just the requested one.
- */
-static void setup_dma_buffer(transfer_t *t, void *base, void *ptr, size_t size)
-{
-	t->req.buffer.virt = base;
-	t->req.buffer.policy = t->pipe->desc.transfer_buffer_policy;
-	t->req.offset = ptr - base;
-	t->req.size = size;
-}
-
-/**
- * Compatibility wrapper for reads/writes without preallocated buffer.
- */
-static errno_t transfer_wrap_dma(transfer_t *t, void *buf, size_t size)
-{
-	if (size == 0) {
-		setup_dma_buffer(t, NULL, NULL, 0);
-		return transfer_common(t);
-	}
-
-	void *dma_buf = usb_pipe_alloc_buffer(t->pipe, size);
-	setup_dma_buffer(t, dma_buf, dma_buf, size);
-
-	if (t->dir == USB_DIRECTION_OUT)
-		memcpy(dma_buf, buf, size);
-
-	const errno_t err = transfer_common(t);
-
-	if (!err && t->dir == USB_DIRECTION_IN)
-		memcpy(buf, dma_buf, t->transferred_size);
-
-	usb_pipe_free_buffer(t->pipe, dma_buf);
-	return err;
-}
-
-static errno_t prepare_control(transfer_t *t, const void *setup, size_t setup_size)
-{
-	if ((setup == NULL) || (setup_size != 8))
-		return EINVAL;
-
-	memcpy(&t->req.setup, setup, 8);
-	return EOK;
-}
-
-/** Request a control read transfer on an endpoint pipe.
- *
- * This function encapsulates all three stages of a control transfer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] setup_buffer Buffer with the setup packet.
- * @param[in] setup_buffer_size Size of the setup packet (in bytes).
- * @param[out] data_buffer Buffer for incoming data.
- * @param[in] data_buffer_size Size of the buffer for incoming data (in bytes).
- * @param[out] data_transferred_size Number of bytes that were actually
- *                                  transferred during the DATA stage.
- * @return Error code.
- */
-errno_t usb_pipe_control_read(usb_pipe_t *pipe,
-    const void *setup_buffer, size_t setup_buffer_size,
-    void *buffer, size_t buffer_size, size_t *transferred_size)
-{
-	errno_t err;
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_IN,
-		.is_control = true,
-	};
-
-	if ((err = prepare_control(&transfer, setup_buffer, setup_buffer_size)))
-		return err;
-
-	if ((err = transfer_wrap_dma(&transfer, buffer, buffer_size)))
-		return err;
-
-	if (transferred_size)
-		*transferred_size = transfer.transferred_size;
-
-	return EOK;
-}
-
-/** Request a control write transfer on an endpoint pipe.
- *
- * This function encapsulates all three stages of a control transfer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] setup_buffer Buffer with the setup packet.
- * @param[in] setup_buffer_size Size of the setup packet (in bytes).
- * @param[in] data_buffer Buffer with data to be sent.
- * @param[in] data_buffer_size Size of the buffer with outgoing data (in bytes).
- * @return Error code.
- */
-errno_t usb_pipe_control_write(usb_pipe_t *pipe,
-    const void *setup_buffer, size_t setup_buffer_size,
-    const void *buffer, size_t buffer_size)
-{
-	assert(pipe);
-	errno_t err;
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_OUT,
-		.is_control = true,
-	};
-
-	if ((err = prepare_control(&transfer, setup_buffer, setup_buffer_size)))
-		return err;
-
-	return transfer_wrap_dma(&transfer, (void *) buffer, buffer_size);
-}
-
-/**
- * Allocate a buffer for data transmission, that satisfies the constraints
- * imposed by the host controller.
- *
- * @param[in] pipe Pipe for which the buffer is allocated
- * @param[in] size Size of the required buffer
- */
-void *usb_pipe_alloc_buffer(usb_pipe_t *pipe, size_t size)
-{
-	dma_buffer_t buf;
-	if (dma_buffer_alloc_policy(&buf, size, pipe->desc.transfer_buffer_policy))
-		return NULL;
-
-	return buf.virt;
-}
-
-void usb_pipe_free_buffer(usb_pipe_t *pipe, void *buffer)
-{
-	dma_buffer_t buf;
-	buf.virt = buffer;
-	dma_buffer_free(&buf);
-}
-
-/** Request a read (in) transfer on an endpoint pipe.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[out] buffer Buffer where to store the data.
- * @param[in] size Size of the buffer (in bytes).
- * @param[out] size_transferred Number of bytes that were actually transferred.
- * @return Error code.
- */
-errno_t usb_pipe_read(usb_pipe_t *pipe,
-    void *buffer, size_t size, size_t *size_transferred)
-{
-	assert(pipe);
-	errno_t err;
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_IN,
-	};
-
-	if ((err = transfer_wrap_dma(&transfer, buffer, size)))
-		return err;
-
-	if (size_transferred)
-		*size_transferred = transfer.transferred_size;
-
-	return EOK;
-}
-
-/** Request a write (out) transfer on an endpoint pipe.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] buffer Buffer with data to transfer.
- * @param[in] size Size of the buffer (in bytes).
- * @return Error code.
- */
-errno_t usb_pipe_write(usb_pipe_t *pipe, const void *buffer, size_t size)
-{
-	assert(pipe);
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_OUT,
-	};
-
-	return transfer_wrap_dma(&transfer, (void *) buffer, size);
-}
-
-/**
- * Request a read (in) transfer on an endpoint pipe, declaring that buffer
- * is pointing to a memory area previously allocated by usb_pipe_alloc_buffer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] buffer Buffer, previously allocated with usb_pipe_alloc_buffer.
- * @param[in] size Size of the buffer (in bytes).
- * @param[out] size_transferred Number of bytes that were actually transferred.
- * @return Error code.
- */
-errno_t usb_pipe_read_dma(usb_pipe_t *pipe, void *base, void *ptr, size_t size,
-    size_t *size_transferred)
-{
-	assert(pipe);
-	errno_t err;
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_IN,
-	};
-
-	setup_dma_buffer(&transfer, base, ptr, size);
-
-	if ((err = transfer_common(&transfer)))
-		return err;
-
-	if (size_transferred)
-		*size_transferred = transfer.transferred_size;
-
-	return EOK;
-}
-
-/**
- * Request a write (out) transfer on an endpoint pipe, declaring that buffer
- * is pointing to a memory area previously allocated by usb_pipe_alloc_buffer.
- *
- * @param[in] pipe Pipe used for the transfer.
- * @param[in] buffer Buffer, previously allocated with usb_pipe_alloc_buffer.
- * @param[in] size Size of the buffer (in bytes).
- * @return Error code.
- */
-errno_t usb_pipe_write_dma(usb_pipe_t *pipe, void *base, void *ptr, size_t size)
-{
-	assert(pipe);
-	transfer_t transfer = {
-		.pipe = pipe,
-		.dir = USB_DIRECTION_OUT,
-	};
-
-	setup_dma_buffer(&transfer, base, ptr, size);
-
-	return transfer_common(&transfer);
-}
-
-/** Initialize USB endpoint pipe.
- *
- * @param pipe Endpoint pipe to be initialized.
- * @param bus_session Endpoint pipe to be initialized.
- * @return Error code.
- */
-errno_t usb_pipe_initialize(usb_pipe_t *pipe, usb_dev_session_t *bus_session)
-{
-	assert(pipe);
-
-	pipe->auto_reset_halt = false;
-	pipe->bus_session = bus_session;
-
-	return EOK;
-}
-
-static const usb_pipe_desc_t default_control_pipe = {
-	.endpoint_no = 0,
-	.transfer_type = USB_TRANSFER_CONTROL,
-	.direction = USB_DIRECTION_BOTH,
-	.max_transfer_size = CTRL_PIPE_MIN_PACKET_SIZE,
-	.transfer_buffer_policy = DMA_POLICY_STRICT,
-};
-
-/** Initialize USB default control pipe.
- *
- * This one is special because it must not be registered, it is registered
- * automatically.
- *
- * @param pipe Endpoint pipe to be initialized.
- * @param bus_session Endpoint pipe to be initialized.
- * @return Error code.
- */
-errno_t usb_pipe_initialize_default_control(usb_pipe_t *pipe,
-    usb_dev_session_t *bus_session)
-{
-	const errno_t ret = usb_pipe_initialize(pipe, bus_session);
-	if (ret)
-		return ret;
-
-	pipe->desc = default_control_pipe;
-	pipe->auto_reset_halt = true;
-
-	return EOK;
-}
-
-/** Register endpoint with the host controller.
- *
- * @param pipe Pipe to be registered.
- * @param ep_desc Matched endpoint descriptor
- * @param comp_desc Matched superspeed companion descriptro, if any
- * @return Error code.
- */
-errno_t usb_pipe_register(usb_pipe_t *pipe,
-    const usb_standard_endpoint_descriptor_t *ep_desc,
-    const usb_superspeed_endpoint_companion_descriptor_t *comp_desc)
-{
-	assert(pipe);
-	assert(pipe->bus_session);
-	assert(ep_desc);
-
-	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
-	if (!exch)
-		return ENOMEM;
-
-	usb_endpoint_descriptors_t descriptors = { 0 };
-
-#define COPY(field) descriptors.endpoint.field = ep_desc->field
-	COPY(endpoint_address);
-	COPY(attributes);
-	COPY(max_packet_size);
-	COPY(poll_interval);
-#undef COPY
-
-#define COPY(field) descriptors.companion.field = comp_desc->field
-	if (comp_desc) {
-		COPY(max_burst);
-		COPY(attributes);
-		COPY(bytes_per_interval);
-	}
-#undef COPY
-
-	const errno_t ret = usbhc_register_endpoint(exch,
-	    &pipe->desc, &descriptors);
-	async_exchange_end(exch);
-	return ret;
-}
-
-/** Revert endpoint registration with the host controller.
- *
- * @param pipe Pipe to be unregistered.
- * @return Error code.
- */
-errno_t usb_pipe_unregister(usb_pipe_t *pipe)
-{
-	assert(pipe);
-	assert(pipe->bus_session);
-	async_exch_t *exch = async_exchange_begin(pipe->bus_session);
-	if (!exch)
-		return ENOMEM;
-
-	const errno_t ret = usbhc_unregister_endpoint(exch, &pipe->desc);
-
-	async_exchange_end(exch);
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/pipesinit.c
===================================================================
--- uspace/lib/usbdev/src/pipesinit.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,345 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * Non trivial initialization of endpoint pipes.
- *
- */
-#include <usb/dev/pipes.h>
-#include <usb/dev/dp.h>
-#include <usb/dev/request.h>
-#include <usb/usb.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-
-#include <assert.h>
-#include <errno.h>
-
-#define DEV_DESCR_MAX_PACKET_SIZE_OFFSET 7
-
-#define NESTING(parentname, childname) \
-	{ \
-		.child = USB_DESCTYPE_##childname, \
-		.parent = USB_DESCTYPE_##parentname, \
-	}
-#define LAST_NESTING { -1, -1 }
-
-/** Nesting pairs of standard descriptors. */
-static const usb_dp_descriptor_nesting_t descriptor_nesting[] = {
-	NESTING(CONFIGURATION, INTERFACE),
-	NESTING(INTERFACE, ENDPOINT),
-	NESTING(INTERFACE, HUB),
-	NESTING(INTERFACE, HID),
-	NESTING(HID, HID_REPORT),
-	NESTING(ENDPOINT, SSPEED_EP_COMPANION),
-	LAST_NESTING
-};
-
-/** Tells whether given descriptor is of endpoint type.
- *
- * @param descriptor Descriptor in question.
- * @return Whether the given descriptor is endpoint descriptor.
- */
-static inline bool is_endpoint_descriptor(const uint8_t *descriptor)
-{
-	return descriptor[1] == USB_DESCTYPE_ENDPOINT;
-}
-
-/** Tells whether given descriptor is of superspeed companion type.
- *
- * @param descriptor Descriptor in question.
- * @return Whether the given descriptor is superspeed companion descriptor.
- */
-static inline bool is_superspeed_companion_descriptor(const uint8_t *descriptor)
-{
-	return descriptor[1] == USB_DESCTYPE_SSPEED_EP_COMPANION;
-}
-
-/** Tells whether found endpoint corresponds to endpoint described by user.
- *
- * @param wanted Endpoint description as entered by driver author.
- * @param found Endpoint description obtained from endpoint descriptor.
- * @return Whether the @p found descriptor fits the @p wanted descriptor.
- */
-static bool endpoint_fits_description(const usb_endpoint_description_t *wanted,
-    const usb_endpoint_description_t *found)
-{
-#define _SAME(fieldname) ((wanted->fieldname) == (found->fieldname))
-
-	if (!_SAME(direction)) {
-		return false;
-	}
-
-	if (!_SAME(transfer_type)) {
-		return false;
-	}
-
-	if ((wanted->interface_class >= 0) && !_SAME(interface_class)) {
-		return false;
-	}
-
-	if ((wanted->interface_subclass >= 0) && !_SAME(interface_subclass)) {
-		return false;
-	}
-
-	if ((wanted->interface_protocol >= 0) && !_SAME(interface_protocol)) {
-		return false;
-	}
-
-#undef _SAME
-
-	return true;
-}
-
-/** Find endpoint mapping for a found endpoint.
- *
- * @param mapping Endpoint mapping list.
- * @param mapping_count Number of endpoint mappings in @p mapping.
- * @param found_endpoint Description of found endpoint.
- * @param interface_number Number of currently processed interface.
- * @return Endpoint mapping corresponding to @p found_endpoint.
- * @retval NULL No corresponding endpoint found.
- */
-static usb_endpoint_mapping_t *find_endpoint_mapping(
-    usb_endpoint_mapping_t *mapping, size_t mapping_count,
-    const usb_endpoint_description_t *found_endpoint,
-    int interface_number, int interface_setting)
-{
-	while (mapping_count > 0) {
-		bool interface_number_fits = (mapping->interface_no < 0) ||
-		    (mapping->interface_no == interface_number);
-
-		bool interface_setting_fits = (mapping->interface_setting < 0) ||
-		    (mapping->interface_setting == interface_setting);
-
-		bool endpoint_descriptions_fits = endpoint_fits_description(
-		    mapping->description, found_endpoint);
-
-		if (interface_number_fits &&
-		    interface_setting_fits &&
-		    endpoint_descriptions_fits &&
-		    !mapping->present) {
-			return mapping;
-		}
-
-		mapping++;
-		mapping_count--;
-	}
-
-	return NULL;
-}
-
-/** Process endpoint descriptor.
- *
- * @param mapping Endpoint mapping list.
- * @param mapping_count Number of endpoint mappings in @p mapping.
- * @param interface Interface descriptor under which belongs the @p endpoint.
- * @param endpoint Endpoint descriptor.
- * @param companion Superspeed companion descriptor.
- * @return Error code.
- */
-static errno_t process_endpoint(
-    usb_endpoint_mapping_t *mapping, size_t mapping_count,
-    usb_standard_interface_descriptor_t *interface,
-    usb_standard_endpoint_descriptor_t *endpoint_desc,
-    usb_superspeed_endpoint_companion_descriptor_t *companion_desc,
-    usb_dev_session_t *bus_session)
-{
-
-	/*
-	 * Get endpoint characteristics.
-	 */
-	const usb_endpoint_description_t description = {
-		.transfer_type = USB_ED_GET_TRANSFER_TYPE(*endpoint_desc),
-		.direction = USB_ED_GET_DIR(*endpoint_desc),
-
-		/* Get interface characteristics. */
-		.interface_class = interface->interface_class,
-		.interface_subclass = interface->interface_subclass,
-		.interface_protocol = interface->interface_protocol,
-	};
-
-	/*
-	 * Find the most fitting mapping and initialize the pipe.
-	 */
-	usb_endpoint_mapping_t *ep_mapping = find_endpoint_mapping(mapping,
-	    mapping_count, &description,
-	    interface->interface_number, interface->alternate_setting);
-	if (ep_mapping == NULL) {
-		return ENOENT;
-	}
-
-	if (ep_mapping->present) {
-		return EEXIST;
-	}
-
-	errno_t err = usb_pipe_initialize(&ep_mapping->pipe, bus_session);
-	if (err)
-		return err;
-
-	ep_mapping->present = true;
-	ep_mapping->descriptor = endpoint_desc;
-	ep_mapping->companion_descriptor = companion_desc;
-	ep_mapping->interface = interface;
-
-	return EOK;
-}
-
-/** Process whole USB interface.
- *
- * @param mapping Endpoint mapping list.
- * @param mapping_count Number of endpoint mappings in @p mapping.
- * @param parser Descriptor parser.
- * @param parser_data Descriptor parser data.
- * @param interface_descriptor Interface descriptor.
- * @return Error code.
- */
-static errno_t process_interface(
-    usb_endpoint_mapping_t *mapping, size_t mapping_count,
-    const usb_dp_parser_t *parser, const usb_dp_parser_data_t *parser_data,
-    const uint8_t *interface_descriptor, usb_dev_session_t *bus_session)
-{
-	const uint8_t *descriptor = usb_dp_get_nested_descriptor(parser,
-	    parser_data, interface_descriptor);
-
-	if (descriptor == NULL) {
-		return ENOENT;
-	}
-
-	do {
-		if (is_endpoint_descriptor(descriptor)) {
-			/* Check if companion descriptor is present too, it should immediatelly follow. */
-			const uint8_t *companion_desc = usb_dp_get_nested_descriptor(parser,
-			    parser_data, descriptor);
-			if (companion_desc && !is_superspeed_companion_descriptor(companion_desc)) {
-				/* Not what we wanted, don't pass it further. */
-				companion_desc = NULL;
-			}
-
-			(void) process_endpoint(mapping, mapping_count,
-			    (usb_standard_interface_descriptor_t *)
-			    interface_descriptor,
-			    (usb_standard_endpoint_descriptor_t *)
-			    descriptor,
-			    (usb_superspeed_endpoint_companion_descriptor_t *)
-			    companion_desc,
-			    bus_session);
-		}
-
-		descriptor = usb_dp_get_sibling_descriptor(parser, parser_data,
-		    interface_descriptor, descriptor);
-	} while (descriptor != NULL);
-
-	return EOK;
-}
-
-/** Initialize endpoint pipes from configuration descriptor.
- *
- * The mapping array is expected to conform to following rules:
- * - @c pipe must be uninitialized pipe
- * - @c description must point to prepared endpoint description
- * - @c descriptor does not need to be initialized (will be overwritten)
- * - @c interface does not need to be initialized (will be overwritten)
- * - @c present does not need to be initialized (will be overwritten)
- *
- * After processing the configuration descriptor, the mapping is updated
- * in the following fashion:
- * - @c present will be set to @c true when the endpoint was found in the
- *   configuration
- * - @c descriptor will point inside the configuration descriptor to endpoint
- *   corresponding to given description (or NULL for not found descriptor)
- * - @c interface will point inside the configuration descriptor to interface
- *   descriptor the endpoint @c descriptor belongs to (or NULL for not found
- *   descriptor)
- * - @c pipe will be initialized when found, otherwise left untouched
- * - @c description will be untouched under all circumstances
- *
- * @param mapping Endpoint mapping list.
- * @param mapping_count Number of endpoint mappings in @p mapping.
- * @param configuration_descriptor Full configuration descriptor (is expected
- *	to be in USB endianness: i.e. as-is after being retrieved from
- *	the device).
- * @param configuration_descriptor_size Size of @p configuration_descriptor
- *	in bytes.
- * @param connection Connection backing the endpoint pipes.
- * @return Error code.
- */
-errno_t usb_pipe_initialize_from_configuration(
-    usb_endpoint_mapping_t *mapping, size_t mapping_count,
-    const uint8_t *config_descriptor, size_t config_descriptor_size,
-    usb_dev_session_t *bus_session)
-{
-	if (config_descriptor == NULL)
-		return EBADMEM;
-
-	if (config_descriptor_size <
-	    sizeof(usb_standard_configuration_descriptor_t)) {
-		return ERANGE;
-	}
-
-	/* Go through the mapping and set all endpoints to not present. */
-	for (size_t i = 0; i < mapping_count; i++) {
-		mapping[i].present = false;
-		mapping[i].descriptor = NULL;
-		mapping[i].interface = NULL;
-	}
-
-	/* Prepare the descriptor parser. */
-	const usb_dp_parser_t dp_parser = {
-		.nesting = descriptor_nesting
-	};
-	const usb_dp_parser_data_t dp_data = {
-		.data = config_descriptor,
-		.size = config_descriptor_size,
-	};
-
-	/*
-	 * Iterate through all interfaces.
-	 */
-	const uint8_t *interface = usb_dp_get_nested_descriptor(&dp_parser,
-	    &dp_data, config_descriptor);
-	if (interface == NULL) {
-		return ENOENT;
-	}
-	do {
-		(void) process_interface(mapping, mapping_count,
-		    &dp_parser, &dp_data, interface, bus_session);
-		interface = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
-		    config_descriptor, interface);
-	} while (interface != NULL);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/recognise.c
===================================================================
--- uspace/lib/usbdev/src/recognise.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,291 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * Functions for recognition of attached devices.
- */
-
-#include <usb/dev/pipes.h>
-#include <usb/dev/recognise.h>
-#include <usb/dev/request.h>
-#include <usb/classes/classes.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-/** Get integer part from BCD coded number. */
-#define BCD_INT(a) (((unsigned int)(a)) / 256)
-/** Get fraction part from BCD coded number (as an integer, no less). */
-#define BCD_FRAC(a) (((unsigned int)(a)) % 256)
-
-/** Format for BCD coded number to be used in printf. */
-#define BCD_FMT "%x.%x"
-/** Arguments to printf for BCD coded number. */
-#define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a))
-
-/** Add formatted match id.
- *
- * @param matches List of match ids where to add to.
- * @param score Score of the match.
- * @param format Printf-like format
- * @return Error code.
- */
-static errno_t usb_add_match_id(match_id_list_t *matches, int score,
-    char *match_str)
-{
-	assert(matches);
-
-	match_id_t *match_id = create_match_id();
-	if (match_id == NULL) {
-		return ENOMEM;
-	}
-
-	match_id->id = match_str;
-	match_id->score = score;
-	add_match_id(matches, match_id);
-
-	return EOK;
-}
-
-/** Add match id to list or return with error code.
- *
- * @param match_ids List of match ids.
- * @param score Match id score.
- * @param format Format of the matching string
- * @param ... Arguments for the format.
- */
-#define ADD_MATCHID_OR_RETURN(match_ids, score, format, ...) \
-	do { \
-		char *str = NULL; \
-		int __rc = asprintf(&str, format, ##__VA_ARGS__); \
-		if (__rc >= 0) { \
-			errno_t __rc = usb_add_match_id((match_ids), (score), str); \
-			if (__rc != EOK) { \
-				free(str); \
-				return __rc; \
-			} \
-		} else { \
-			return ENOMEM; \
-		} \
-	} while (0)
-
-/** Create device match ids based on its interface.
- *
- * @param[in] desc_device Device descriptor.
- * @param[in] desc_interface Interface descriptor.
- * @param[out] matches Initialized list of match ids.
- * @return Error code (the two mentioned are not the only ones).
- * @retval EINVAL Invalid input parameters (expects non NULL pointers).
- * @retval ENOENT Device class is not "use interface".
- */
-errno_t usb_device_create_match_ids_from_interface(
-    const usb_standard_device_descriptor_t *desc_device,
-    const usb_standard_interface_descriptor_t *desc_interface,
-    match_id_list_t *matches)
-{
-	if (desc_interface == NULL || matches == NULL) {
-		return EINVAL;
-	}
-
-	if (desc_interface->interface_class == USB_CLASS_USE_INTERFACE) {
-		return ENOENT;
-	}
-
-	const char *classname = usb_str_class(desc_interface->interface_class);
-	assert(classname != NULL);
-
-#define IFACE_PROTOCOL_FMT "interface&class=%s&subclass=0x%02x&protocol=0x%02x"
-#define IFACE_PROTOCOL_ARGS classname, desc_interface->interface_subclass, \
-    desc_interface->interface_protocol
-
-#define IFACE_SUBCLASS_FMT "interface&class=%s&subclass=0x%02x"
-#define IFACE_SUBCLASS_ARGS classname, desc_interface->interface_subclass
-
-#define IFACE_CLASS_FMT "interface&class=%s"
-#define IFACE_CLASS_ARGS classname
-
-#define VENDOR_RELEASE_FMT "vendor=0x%04x&product=0x%04x&release=" BCD_FMT
-#define VENDOR_RELEASE_ARGS desc_device->vendor_id, desc_device->product_id, \
-    BCD_ARGS(desc_device->device_version)
-
-#define VENDOR_PRODUCT_FMT "vendor=0x%04x&product=0x%04x"
-#define VENDOR_PRODUCT_ARGS desc_device->vendor_id, desc_device->product_id
-
-#define VENDOR_ONLY_FMT "vendor=0x%04x"
-#define VENDOR_ONLY_ARGS desc_device->vendor_id
-
-	/*
-	 * If the vendor is specified, create match ids with vendor with
-	 * higher score.
-	 * Then the same ones without the vendor part.
-	 */
-	if ((desc_device != NULL) && (desc_device->vendor_id != 0)) {
-		/* First, interface matches with device release number. */
-		ADD_MATCHID_OR_RETURN(matches, 250,
-		    "usb&" VENDOR_RELEASE_FMT "&" IFACE_PROTOCOL_FMT,
-		    VENDOR_RELEASE_ARGS, IFACE_PROTOCOL_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 240,
-		    "usb&" VENDOR_RELEASE_FMT "&" IFACE_SUBCLASS_FMT,
-		    VENDOR_RELEASE_ARGS, IFACE_SUBCLASS_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 230,
-		    "usb&" VENDOR_RELEASE_FMT "&" IFACE_CLASS_FMT,
-		    VENDOR_RELEASE_ARGS, IFACE_CLASS_ARGS);
-
-		/* Next, interface matches without release number. */
-		ADD_MATCHID_OR_RETURN(matches, 220,
-		    "usb&" VENDOR_PRODUCT_FMT "&" IFACE_PROTOCOL_FMT,
-		    VENDOR_PRODUCT_ARGS, IFACE_PROTOCOL_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 210,
-		    "usb&" VENDOR_PRODUCT_FMT "&" IFACE_SUBCLASS_FMT,
-		    VENDOR_PRODUCT_ARGS, IFACE_SUBCLASS_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 200,
-		    "usb&" VENDOR_PRODUCT_FMT "&" IFACE_CLASS_FMT,
-		    VENDOR_PRODUCT_ARGS, IFACE_CLASS_ARGS);
-
-		/* Finally, interface matches with only vendor. */
-		ADD_MATCHID_OR_RETURN(matches, 190,
-		    "usb&" VENDOR_ONLY_FMT "&" IFACE_PROTOCOL_FMT,
-		    VENDOR_ONLY_ARGS, IFACE_PROTOCOL_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 180,
-		    "usb&" VENDOR_ONLY_FMT "&" IFACE_SUBCLASS_FMT,
-		    VENDOR_ONLY_ARGS, IFACE_SUBCLASS_ARGS);
-		ADD_MATCHID_OR_RETURN(matches, 170,
-		    "usb&" VENDOR_ONLY_FMT "&" IFACE_CLASS_FMT,
-		    VENDOR_ONLY_ARGS, IFACE_CLASS_ARGS);
-	}
-
-	/* Now, the same but without any vendor specification. */
-	ADD_MATCHID_OR_RETURN(matches, 160,
-	    "usb&" IFACE_PROTOCOL_FMT,
-	    IFACE_PROTOCOL_ARGS);
-	ADD_MATCHID_OR_RETURN(matches, 150,
-	    "usb&" IFACE_SUBCLASS_FMT,
-	    IFACE_SUBCLASS_ARGS);
-	ADD_MATCHID_OR_RETURN(matches, 140,
-	    "usb&" IFACE_CLASS_FMT,
-	    IFACE_CLASS_ARGS);
-
-#undef IFACE_PROTOCOL_FMT
-#undef IFACE_PROTOCOL_ARGS
-#undef IFACE_SUBCLASS_FMT
-#undef IFACE_SUBCLASS_ARGS
-#undef IFACE_CLASS_FMT
-#undef IFACE_CLASS_ARGS
-#undef VENDOR_RELEASE_FMT
-#undef VENDOR_RELEASE_ARGS
-#undef VENDOR_PRODUCT_FMT
-#undef VENDOR_PRODUCT_ARGS
-#undef VENDOR_ONLY_FMT
-#undef VENDOR_ONLY_ARGS
-
-	/* As a last resort, try fallback driver. */
-	ADD_MATCHID_OR_RETURN(matches, 10, "usb&interface&fallback");
-
-	return EOK;
-}
-
-/** Create DDF match ids from USB device descriptor.
- *
- * @param matches List of match ids to extend.
- * @param device_descriptor Device descriptor returned by given device.
- * @return Error code.
- */
-errno_t usb_device_create_match_ids_from_device_descriptor(
-    const usb_standard_device_descriptor_t *device_descriptor,
-    match_id_list_t *matches)
-{
-	/*
-	 * Unless the vendor id is 0, the pair idVendor-idProduct
-	 * quite uniquely describes the device.
-	 */
-	if (device_descriptor->vendor_id != 0) {
-		/* First, with release number. */
-		ADD_MATCHID_OR_RETURN(matches, 100,
-		    "usb&vendor=0x%04x&product=0x%04x&release=" BCD_FMT,
-		    (int) device_descriptor->vendor_id,
-		    (int) device_descriptor->product_id,
-		    BCD_ARGS(device_descriptor->device_version));
-
-		/* Next, without release number. */
-		ADD_MATCHID_OR_RETURN(matches, 90,
-		    "usb&vendor=0x%04x&product=0x%04x",
-		    (int) device_descriptor->vendor_id,
-		    (int) device_descriptor->product_id);
-	}
-
-	/* Class match id */
-	ADD_MATCHID_OR_RETURN(matches, 50, "usb&class=%s",
-	    usb_str_class(device_descriptor->device_class));
-
-	/* As a last resort, try fallback driver. */
-	ADD_MATCHID_OR_RETURN(matches, 10, "usb&fallback");
-
-	return EOK;
-}
-
-/** Create match ids describing attached device.
- *
- * @warning The list of match ids @p matches may change even when
- * function exits with error.
- *
- * @param ctrl_pipe Control pipe to given device (session must be already
- *	started).
- * @param matches Initialized list of match ids.
- * @return Error code.
- */
-errno_t usb_device_create_match_ids(usb_pipe_t *ctrl_pipe,
-    match_id_list_t *matches)
-{
-	assert(ctrl_pipe);
-	errno_t rc;
-	/*
-	 * Retrieve device descriptor and add matches from it.
-	 */
-	usb_standard_device_descriptor_t device_descriptor;
-
-	rc = usb_request_get_device_descriptor(ctrl_pipe, &device_descriptor);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	rc = usb_device_create_match_ids_from_device_descriptor(
-	    &device_descriptor, matches);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbdev/src/request.c
===================================================================
--- uspace/lib/usbdev/src/request.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,879 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbdev
- * @{
- */
-/** @file
- * Standard USB requests (implementation).
- */
-#include <usb/dev/request.h>
-#include <usb/request.h>
-#include <usb/usb.h>
-
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-
-#define MAX_DATA_LENGTH ((size_t)(0xFFFF))
-
-static_assert(sizeof(usb_device_request_setup_packet_t) == 8, "");
-
-/** Generic wrapper for SET requests using standard control request format.
- *
- * @see usb_pipe_control_write
- *
- * @param pipe         Pipe used for the communication.
- * @param request_type Request type (standard/class/vendor).
- * @param recipient    Request recipient (e.g. device or endpoint).
- * @param request      Actual request (e.g. GET_DESCRIPTOR).
- * @param value        Value of @c wValue field of setup packet
- *                     (must be in USB endianness).
- * @param index        Value of @c wIndex field of setup packet
- *                     (must be in USB endianness).
- * @param data         Data to be sent during DATA stage
- *                     (expected to be in USB endianness).
- * @param data_size     Size of the @p data buffer (in native endianness).
- *
- * @return Error code.
- * @retval EBADMEM @p pipe is NULL.
- * @retval EBADMEM @p data is NULL and @p data_size is not zero.
- * @retval ERANGE Data buffer too large.
- *
- */
-errno_t usb_control_request_set(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint8_t request, uint16_t value, uint16_t index,
-    const void *data, size_t data_size)
-{
-	if (pipe == NULL) {
-		return EBADMEM;
-	}
-
-	if (data_size > MAX_DATA_LENGTH) {
-		return ERANGE;
-	}
-
-	if ((data_size > 0) && (data == NULL)) {
-		return EBADMEM;
-	}
-
-	/*
-	 * TODO: check that @p request_type and @p recipient are
-	 * within ranges.
-	 */
-
-	const usb_device_request_setup_packet_t setup_packet = {
-		.request_type = (request_type << 5) | recipient,
-		.request = request,
-		.value = value,
-		.index = index,
-		.length = (uint16_t) data_size,
-	};
-
-	return usb_pipe_control_write(pipe,
-	    &setup_packet, sizeof(setup_packet), data, data_size);
-}
-
-/** Generic wrapper for GET requests using standard control request format.
- *
- * @see usb_pipe_control_read
- *
- * @param pipe             Pipe used for the communication.
- * @param request_type     Request type (standard/class/vendor).
- * @param recipient        Request recipient (e.g. device or endpoint).
- * @param request          Actual request (e.g. GET_DESCRIPTOR).
- * @param value            Value of @c wValue field of setup packet
- *                         (must be in USB endianness).
- * @param index            Value of @c wIndex field of setup packet
- *                         (must be in USB endianness).
- * @param data             Buffer where to store data accepted during
- *                         the DATA stage (they will come in USB endianness).
- * @param data_size        Size of the @p data buffer
- *                         (in native endianness).
- * @param actual_data_size Actual size of transferred data
- *                         (in native endianness).
- *
- * @return Error code.
- * @retval EBADMEM @p pipe is NULL.
- * @retval EBADMEM @p data is NULL and @p data_size is not zero.
- * @retval ERANGE Data buffer too large.
- *
- */
-errno_t usb_control_request_get(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint8_t request, uint16_t value, uint16_t index,
-    void *data, size_t data_size, size_t *actual_data_size)
-{
-	if (pipe == NULL) {
-		return EBADMEM;
-	}
-
-	if (data_size > MAX_DATA_LENGTH) {
-		return ERANGE;
-	}
-
-	if ((data_size > 0) && (data == NULL)) {
-		return EBADMEM;
-	}
-
-	/*
-	 * TODO: check that @p request_type and @p recipient are
-	 * within ranges.
-	 */
-
-	const usb_device_request_setup_packet_t setup_packet = {
-		.request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST |
-		    (request_type << 5) | recipient,
-		.request = request,
-		.value = uint16_host2usb(value),
-		.index = uint16_host2usb(index),
-		.length = uint16_host2usb(data_size),
-	};
-
-	return usb_pipe_control_read(pipe, &setup_packet, sizeof(setup_packet),
-	    data, data_size, actual_data_size);
-}
-
-/** Retrieve status of a USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] index Recipient index (in native endianness).
- * @param[in] recipient Recipient of the GET_STATUS request.
- * @param[out] status Recipient status (in native endianness).
- * @return Error code.
- */
-errno_t usb_request_get_status(usb_pipe_t *pipe,
-    usb_request_recipient_t recipient, uint16_t index,
-    uint16_t *status)
-{
-	if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) {
-		return EINVAL;
-	}
-
-	if (status == NULL) {
-		return EBADMEM;
-	}
-
-	uint16_t status_usb_endianess;
-	size_t data_transferred_size;
-	errno_t rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD,
-	    recipient, USB_DEVREQ_GET_STATUS, 0, uint16_host2usb(index),
-	    &status_usb_endianess, 2, &data_transferred_size);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (data_transferred_size != 2) {
-		return ELIMIT;
-	}
-
-	*status = uint16_usb2host(status_usb_endianess);
-
-	return EOK;
-}
-
-/** Clear or disable specific device feature.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] recipient Recipient of the CLEAR_FEATURE request.
- * @param[in] feature_selector Feature selector (in native endianness).
- * @param[in] index Recipient index (in native endianness).
- * @return Error code.
- */
-errno_t usb_request_clear_feature(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint16_t feature_selector, uint16_t index)
-{
-	if (request_type == USB_REQUEST_TYPE_STANDARD) {
-		if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) {
-			return EINVAL;
-		}
-	}
-
-	return usb_control_request_set(pipe,
-	    request_type, recipient, USB_DEVREQ_CLEAR_FEATURE,
-	    uint16_host2usb(feature_selector), uint16_host2usb(index), NULL, 0);
-}
-
-/** Set or enable specific device feature.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] recipient Recipient of the SET_FEATURE request.
- * @param[in] feature_selector Feature selector (in native endianness).
- * @param[in] index Recipient index (in native endianness).
- * @return Error code.
- */
-errno_t usb_request_set_feature(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint16_t feature_selector, uint16_t index)
-{
-	if (request_type == USB_REQUEST_TYPE_STANDARD) {
-		if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) {
-			return EINVAL;
-		}
-	}
-
-	return usb_control_request_set(pipe,
-	    request_type, recipient, USB_DEVREQ_SET_FEATURE,
-	    uint16_host2usb(feature_selector), uint16_host2usb(index), NULL, 0);
-}
-
-/** Retrieve USB descriptor of a USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] recipient Request recipient (device/interface/endpoint).
- * @param[in] descriptor_type Descriptor type (device/configuration/HID/...).
- * @param[in] descriptor_index Descriptor index.
- * @param[in] language Language index.
- * @param[out] buffer Buffer where to store the retrieved descriptor.
- * @param[in] size Size of the @p buffer.
- * @param[out] actual_size Number of bytes actually transferred.
- * @return Error code.
- */
-errno_t usb_request_get_descriptor(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint8_t descriptor_type, uint8_t descriptor_index,
-    uint16_t language,
-    void *buffer, size_t size, size_t *actual_size)
-{
-	if (buffer == NULL) {
-		return EBADMEM;
-	}
-	if (size == 0) {
-		return EINVAL;
-	}
-
-	/*
-	 * The wValue field specifies the descriptor type in the high byte
-	 * and the descriptor index in the low byte. USB 1.1 spec p. 189
-	 */
-	const uint16_t wValue = descriptor_index | (descriptor_type << 8);
-
-	return usb_control_request_get(pipe,
-	    request_type, recipient,
-	    USB_DEVREQ_GET_DESCRIPTOR,
-	    wValue, language,
-	    buffer, size, actual_size);
-}
-
-/** Retrieve USB descriptor, allocate space for it.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] recipient Request recipient (device/interface/endpoint).
- * @param[in] descriptor_type Descriptor type (device/configuration/HID/...).
- * @param[in] descriptor_index Descriptor index.
- * @param[in] language Language index.
- * @param[out] buffer_ptr Where to store pointer to allocated buffer.
- * @param[out] buffer_size Where to store the size of the descriptor.
- * @return
- */
-errno_t usb_request_get_descriptor_alloc(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint8_t descriptor_type, uint8_t descriptor_index,
-    uint16_t language,
-    void **buffer_ptr, size_t *buffer_size)
-{
-	if (buffer_ptr == NULL) {
-		return EBADMEM;
-	}
-
-	errno_t rc;
-
-	/*
-	 * Get only first byte to retrieve descriptor length.
-	 */
-	uint8_t tmp_buffer;
-	size_t bytes_transferred;
-	rc = usb_request_get_descriptor(pipe, request_type, recipient,
-	    descriptor_type, descriptor_index, language,
-	    &tmp_buffer, sizeof(tmp_buffer), &bytes_transferred);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (bytes_transferred != 1) {
-		return ELIMIT;
-	}
-
-	const size_t size = tmp_buffer;
-	if (size == 0) {
-		return ELIMIT;
-	}
-
-	/*
-	 * Allocate buffer and get the descriptor again.
-	 */
-	void *buffer = malloc(size);
-	if (buffer == NULL) {
-		return ENOMEM;
-	}
-
-	rc = usb_request_get_descriptor(pipe, request_type, recipient,
-	    descriptor_type, descriptor_index, language,
-	    buffer, size, &bytes_transferred);
-	if (rc != EOK) {
-		free(buffer);
-		return rc;
-	}
-	if (bytes_transferred != size) {
-		free(buffer);
-		return ELIMIT;
-	}
-
-	*buffer_ptr = buffer;
-	if (buffer_size != NULL) {
-		*buffer_size = size;
-	}
-
-	return EOK;
-}
-
-/** Retrieve standard device descriptor of a USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[out] descriptor Storage for the device descriptor.
- * @return Error code.
- */
-errno_t usb_request_get_device_descriptor(usb_pipe_t *pipe,
-    usb_standard_device_descriptor_t *descriptor)
-{
-	if (descriptor == NULL) {
-		return EBADMEM;
-	}
-
-	size_t actually_transferred = 0;
-	usb_standard_device_descriptor_t descriptor_tmp;
-	errno_t rc = usb_request_get_descriptor(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DESCTYPE_DEVICE, 0, 0, &descriptor_tmp, sizeof(descriptor_tmp),
-	    &actually_transferred);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Verify that all data has been transferred. */
-	if (actually_transferred < sizeof(descriptor_tmp)) {
-		return ELIMIT;
-	}
-
-	/* Everything is okay, copy the descriptor. */
-	memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp));
-
-	return EOK;
-}
-
-/** Retrieve configuration descriptor of a USB device.
- *
- * The function does not retrieve additional data binded with configuration
- * descriptor (such as its interface and endpoint descriptors) - use
- * usb_request_get_full_configuration_descriptor() instead.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] index Descriptor index.
- * @param[out] descriptor Storage for the device descriptor.
- * @return Error code.
- */
-errno_t usb_request_get_bare_configuration_descriptor(usb_pipe_t *pipe,
-    int index, usb_standard_configuration_descriptor_t *descriptor)
-{
-	if (descriptor == NULL) {
-		return EBADMEM;
-	}
-
-	if ((index < 0) || (index > 0xFF)) {
-		return ERANGE;
-	}
-
-	size_t actually_transferred = 0;
-	usb_standard_configuration_descriptor_t descriptor_tmp;
-	const errno_t rc = usb_request_get_descriptor(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DESCTYPE_CONFIGURATION, index, 0,
-	    &descriptor_tmp, sizeof(descriptor_tmp),
-	    &actually_transferred);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	/* Verify that all data has been transferred. */
-	if (actually_transferred < sizeof(descriptor_tmp)) {
-		return ELIMIT;
-	}
-
-	/* Everything is okay, copy the descriptor. */
-	memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp));
-	return EOK;
-}
-
-/** Retrieve full configuration descriptor of a USB device.
- *
- * @warning The @p buffer might be touched (i.e. its contents changed)
- * even when error occurs.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] index Descriptor index.
- * @param[out] descriptor Storage for the device descriptor.
- * @param[in] descriptor_size Size of @p descriptor buffer.
- * @param[out] actual_size Number of bytes actually transferred.
- * @return Error code.
- */
-errno_t usb_request_get_full_configuration_descriptor(usb_pipe_t *pipe,
-    int index, void *descriptor, size_t descriptor_size, size_t *actual_size)
-{
-	if ((index < 0) || (index > 0xFF)) {
-		return ERANGE;
-	}
-
-	return usb_request_get_descriptor(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DESCTYPE_CONFIGURATION, index, 0,
-	    descriptor, descriptor_size, actual_size);
-}
-
-/** Retrieve full configuration descriptor, allocate space for it.
- *
- * The function takes care that full configuration descriptor is returned
- * (i.e. the function will fail when less data then descriptor.totalLength
- * is returned).
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] index Configuration index.
- * @param[out] descriptor_ptr Where to store pointer to allocated buffer.
- * @param[out] descriptor_size Where to store the size of the descriptor.
- * @return Error code.
- */
-errno_t usb_request_get_full_configuration_descriptor_alloc(
-    usb_pipe_t *pipe, int index,
-    void **descriptor_ptr, size_t *descriptor_size)
-{
-	errno_t rc;
-
-	if (descriptor_ptr == NULL) {
-		return EBADMEM;
-	}
-
-	usb_standard_configuration_descriptor_t bare_config;
-	rc = usb_request_get_bare_configuration_descriptor(pipe, index,
-	    &bare_config);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (bare_config.descriptor_type != USB_DESCTYPE_CONFIGURATION) {
-		return ENOENT;
-	}
-
-	const size_t total_length = uint16_usb2host(bare_config.total_length);
-	if (total_length < sizeof(bare_config)) {
-		return ELIMIT;
-	}
-
-	void *buffer = malloc(total_length);
-	if (buffer == NULL) {
-		return ENOMEM;
-	}
-
-	size_t transferred = 0;
-	rc = usb_request_get_full_configuration_descriptor(pipe, index,
-	    buffer, total_length, &transferred);
-	if (rc != EOK) {
-		free(buffer);
-		return rc;
-	}
-
-	if (transferred != total_length) {
-		free(buffer);
-		return ELIMIT;
-	}
-
-	/* Everything looks okay, copy the pointers. */
-
-	*descriptor_ptr = buffer;
-
-	if (descriptor_size != NULL) {
-		*descriptor_size = total_length;
-	}
-
-	return EOK;
-}
-
-/** Update existing or add new USB descriptor to a USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] request_type Request type (standard/class/vendor).
- * @param[in] recipient Request recipient (device/interface/endpoint).
- * @param[in] descriptor_type Descriptor type (device/configuration/HID/...).
- * @param[in] descriptor_index Descriptor index.
- * @param[in] language Language index (in native endianness).
- * @param[in] buffer Buffer with the new descriptor (in USB endianness).
- * @param[in] size Size of the @p buffer in bytes (in native endianness).
- * @return Error code.
- */
-errno_t usb_request_set_descriptor(usb_pipe_t *pipe,
-    usb_request_type_t request_type, usb_request_recipient_t recipient,
-    uint8_t descriptor_type, uint8_t descriptor_index,
-    uint16_t language, const void *buffer, size_t size)
-{
-	if (buffer == NULL) {
-		return EBADMEM;
-	}
-	if (size == 0) {
-		return EINVAL;
-	}
-
-	/* FIXME: proper endianness. */
-	uint16_t wValue = descriptor_index | (descriptor_type << 8);
-
-	return usb_control_request_set(pipe,
-	    request_type, recipient, USB_DEVREQ_SET_DESCRIPTOR,
-	    wValue, language, buffer, size);
-}
-
-/** Get current configuration value of USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[out] configuration_value Current configuration value.
- * @return Error code.
- */
-errno_t usb_request_get_configuration(usb_pipe_t *pipe,
-    uint8_t *configuration_value)
-{
-	uint8_t value;
-	size_t actual_size;
-
-	const errno_t rc = usb_control_request_get(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_GET_CONFIGURATION, 0, 0, &value, 1, &actual_size);
-
-	if (rc != EOK) {
-		return rc;
-	}
-	if (actual_size != 1) {
-		return ELIMIT;
-	}
-
-	if (configuration_value != NULL) {
-		*configuration_value = value;
-	}
-
-	return EOK;
-}
-
-/** Set configuration of USB device.
- *
- * @param pipe Control endpoint pipe (session must be already started).
- * @param configuration_value New configuration value.
- * @return Error code.
- */
-errno_t usb_request_set_configuration(usb_pipe_t *pipe,
-    uint8_t configuration_value)
-{
-	const uint16_t config_value =
-	    uint16_host2usb((uint16_t) configuration_value);
-
-	return usb_control_request_set(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DEVREQ_SET_CONFIGURATION, config_value, 0,
-	    NULL, 0);
-}
-
-/** Get selected alternate setting for USB interface.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] interface_index Interface index.
- * @param[out] alternate_setting Alternate setting for the interface.
- * @return Error code.
- */
-errno_t usb_request_get_interface(usb_pipe_t *pipe,
-    uint8_t interface_index, uint8_t *alternate_setting)
-{
-	uint8_t value;
-	size_t actual_size;
-
-	const errno_t rc = usb_control_request_get(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DEVREQ_GET_INTERFACE,
-	    0, uint16_host2usb((uint16_t) interface_index),
-	    &value, sizeof(value), &actual_size);
-
-	if (rc != EOK) {
-		return rc;
-	}
-	if (actual_size != 1) {
-		return ELIMIT;
-	}
-
-	if (alternate_setting != NULL) {
-		*alternate_setting = value;
-	}
-
-	return EOK;
-}
-
-/** Select alternate setting for USB interface.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] interface_index Interface index.
- * @param[in] alternate_setting Alternate setting to select.
- * @return Error code.
- */
-errno_t usb_request_set_interface(usb_pipe_t *pipe,
-    uint8_t interface_index, uint8_t alternate_setting)
-{
-	return usb_control_request_set(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DEVREQ_SET_INTERFACE,
-	    uint16_host2usb((uint16_t) alternate_setting),
-	    uint16_host2usb((uint16_t) interface_index),
-	    NULL, 0);
-}
-
-/** Get list of supported languages by USB device.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[out] languages_ptr Where to store pointer to allocated array of
- *	supported languages.
- * @param[out] languages_count Number of supported languages.
- * @return Error code.
- */
-errno_t usb_request_get_supported_languages(usb_pipe_t *pipe,
-    l18_win_locales_t **languages_ptr, size_t *languages_count)
-{
-	if (languages_ptr == NULL || languages_count == NULL) {
-		return EBADMEM;
-	}
-
-	uint8_t *string_descriptor = NULL;
-	size_t string_descriptor_size = 0;
-	const errno_t rc = usb_request_get_descriptor_alloc(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DESCTYPE_STRING, 0, 0,
-	    (void **) &string_descriptor, &string_descriptor_size);
-	if (rc != EOK) {
-		return rc;
-	}
-	if (string_descriptor_size <= 2) {
-		free(string_descriptor);
-		return EEMPTY;
-	}
-	/* Subtract first 2 bytes (length and descriptor type). */
-	string_descriptor_size -= 2;
-
-	/* Odd number of bytes - descriptor is broken? */
-	if ((string_descriptor_size % 2) != 0) {
-		/* FIXME: shall we return with error or silently ignore? */
-		free(string_descriptor);
-		return ESTALL;
-	}
-
-	const size_t langs_count = string_descriptor_size / 2;
-	l18_win_locales_t *langs =
-	    calloc(langs_count, sizeof(l18_win_locales_t));
-	if (langs == NULL) {
-		free(string_descriptor);
-		return ENOMEM;
-	}
-
-	for (size_t i = 0; i < langs_count; i++) {
-		/* Language code from the descriptor is in USB endianness. */
-		/* FIXME: is this really correct? */
-		const uint16_t lang_code =
-		    (string_descriptor[2 + 2 * i + 1] << 8) +
-		    string_descriptor[2 + 2 * i];
-		langs[i] = uint16_usb2host(lang_code);
-	}
-
-	free(string_descriptor);
-
-	*languages_ptr = langs;
-	*languages_count = langs_count;
-
-	return EOK;
-}
-
-/** Get string (descriptor) from USB device.
- *
- * The string is returned in native encoding of the operating system.
- * For HelenOS, that is UTF-8.
- *
- * @param[in] pipe Control endpoint pipe (session must be already started).
- * @param[in] index String index (in native endianness),
- *	first index has number 1 (index from descriptors can be used directly).
- * @param[in] lang String language (in native endianness).
- * @param[out] string_ptr Where to store allocated string in native encoding.
- * @return Error code.
- */
-errno_t usb_request_get_string(usb_pipe_t *pipe,
-    size_t index, l18_win_locales_t lang, char **string_ptr)
-{
-	if (string_ptr == NULL) {
-		return EBADMEM;
-	}
-	/*
-	 * Index is actually one byte value and zero index is used
-	 * to retrieve list of supported languages.
-	 */
-	if ((index < 1) || (index > 0xFF)) {
-		return ERANGE;
-	}
-	/* Language is actually two byte value. */
-	if (lang > L18N_WIN_LOCALE_MAX) {
-		return ERANGE;
-	}
-
-	errno_t rc;
-
-	/* Prepare dynamically allocated variables. */
-	uint8_t *string = NULL;
-	char32_t *string_chars = NULL;
-
-	/* Get the actual descriptor. */
-	size_t string_size;
-	rc = usb_request_get_descriptor_alloc(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
-	    USB_DESCTYPE_STRING, index, uint16_host2usb(lang),
-	    (void **) &string, &string_size);
-	if (rc != EOK) {
-		goto leave;
-	}
-
-	if (string_size <= 2) {
-		rc =  EEMPTY;
-		goto leave;
-	}
-	/* Subtract first 2 bytes (length and descriptor type). */
-	string_size -= 2;
-
-	/* Odd number of bytes - descriptor is broken? */
-	if ((string_size % 2) != 0) {
-		/* FIXME: shall we return with error or silently ignore? */
-		rc = ESTALL;
-		goto leave;
-	}
-
-	const size_t string_char_count = string_size / 2;
-	string_chars = malloc(sizeof(char32_t) * (string_char_count + 1));
-	if (string_chars == NULL) {
-		rc = ENOMEM;
-		goto leave;
-	}
-
-	/*
-	 * Build a wide string.
-	 * And do not forget to set NULL terminator (string descriptors
-	 * do not have them).
-	 */
-	for (size_t i = 0; i < string_char_count; i++) {
-		const uint16_t uni_char = (string[2 + 2 * i + 1] << 8) +
-		    string[2 + 2 * i];
-		string_chars[i] = uni_char;
-	}
-	string_chars[string_char_count] = 0;
-
-	/* Convert to normal string. */
-	char *str = wstr_to_astr(string_chars);
-	if (str == NULL) {
-		rc = ENOMEM;
-		goto leave;
-	}
-
-	*string_ptr = str;
-	rc = EOK;
-
-leave:
-	free(string);
-	free(string_chars);
-
-	return rc;
-}
-
-/** Clear halt bit of an endpoint pipe (after pipe stall).
- *
- * @param pipe Control pipe.
- * @param ep_index Endpoint index (in native endianness).
- * @return Error code.
- */
-static errno_t usb_request_clear_endpoint_halt(usb_pipe_t *pipe, uint16_t ep_index)
-{
-	return usb_request_clear_feature(pipe,
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_ENDPOINT,
-	    uint16_host2usb(USB_FEATURE_ENDPOINT_HALT),
-	    uint16_host2usb(ep_index));
-}
-
-/** Clear halt bit of an endpoint pipe (after pipe stall).
- *
- * @param ctrl_pipe Control pipe.
- * @param target_pipe Which pipe is halted and shall be cleared.
- * @return Error code.
- */
-errno_t usb_pipe_clear_halt(usb_pipe_t *ctrl_pipe, usb_pipe_t *target_pipe)
-{
-	if ((ctrl_pipe == NULL) || (target_pipe == NULL)) {
-		return EINVAL;
-	}
-
-	uint16_t index = target_pipe->desc.endpoint_no;
-	index |= (target_pipe->desc.direction == USB_DIRECTION_IN) << 7;
-	return usb_request_clear_endpoint_halt(ctrl_pipe, index);
-}
-
-/** Get endpoint status.
- *
- * @param[in] ctrl_pipe Control pipe.
- * @param[in] pipe Of which pipe the status shall be received.
- * @param[out] status Where to store pipe status (in native endianness).
- * @return Error code.
- */
-errno_t usb_request_get_endpoint_status(usb_pipe_t *ctrl_pipe, usb_pipe_t *pipe,
-    uint16_t *status)
-{
-	uint16_t status_tmp;
-	uint16_t pipe_index = (uint16_t) pipe->desc.endpoint_no;
-	errno_t rc = usb_request_get_status(ctrl_pipe,
-	    USB_REQUEST_RECIPIENT_ENDPOINT, uint16_host2usb(pipe_index),
-	    &status_tmp);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if (status != NULL) {
-		*status = uint16_usb2host(status_tmp);
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hid.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hid.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * @brief USB HID device related types.
- */
-#ifndef LIBUSBHID_HID_H_
-#define LIBUSBHID_HID_H_
-
-#include <usb/usb.h>
-#include <usb/hid/hidparser.h>
-#include <usb/descriptor.h>
-
-/** USB/HID device requests. */
-typedef enum {
-	USB_HIDREQ_GET_REPORT = 1,
-	USB_HIDREQ_GET_IDLE = 2,
-	USB_HIDREQ_GET_PROTOCOL = 3,
-	/* Values 4 to 8 are reserved. */
-	USB_HIDREQ_SET_REPORT = 9,
-	USB_HIDREQ_SET_IDLE = 10,
-	USB_HIDREQ_SET_PROTOCOL = 11
-} usb_hid_request_t;
-
-typedef enum {
-	USB_HID_PROTOCOL_BOOT = 0,
-	USB_HID_PROTOCOL_REPORT = 1
-} usb_hid_protocol_t;
-
-/** USB/HID subclass constants. */
-typedef enum {
-	USB_HID_SUBCLASS_NONE = 0,
-	USB_HID_SUBCLASS_BOOT = 1
-} usb_hid_subclass_t;
-
-/** USB/HID interface protocols. */
-typedef enum {
-	USB_HID_PROTOCOL_NONE = 0,
-	USB_HID_PROTOCOL_KEYBOARD = 1,
-	USB_HID_PROTOCOL_MOUSE = 2
-} usb_hid_iface_protocol_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hid_report_items.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hid_report_items.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,344 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * @brief USB HID Report descriptor item tags.
- */
-#ifndef LIBUSB_HID_REPORT_ITEMS_H_
-#define LIBUSB_HID_REPORT_ITEMS_H_
-
-#include <stdint.h>
-
-/*
- * Item prefix
- */
-
-/** Returns size of item data in bytes */
-#define USB_HID_ITEM_SIZE(data) 	((uint8_t)(data & 0x3))
-
-/** Returns item tag */
-#define USB_HID_ITEM_TAG(data) 		((uint8_t)((data & 0xF0) >> 4))
-
-/** Returns class of item tag */
-#define USB_HID_ITEM_TAG_CLASS(data)	((uint8_t)((data & 0xC) >> 2))
-
-/** Returns if the item is the short item or long item. Long items are not
- * supported.
- */
-#define USB_HID_ITEM_IS_LONG(data)	(data == 0xFE)
-
-/*
- * Extended usage macros
- */
-
-/** Recognizes if the given usage is extended (contains also usage page).  */
-#define USB_HID_IS_EXTENDED_USAGE(usage)	((usage & 0xFFFF0000) != 0)
-
-/** Cuts usage page of the extended usage. */
-#define USB_HID_EXTENDED_USAGE_PAGE(usage)	((usage & 0xFFFF0000) >> 16)
-
-/** Cuts usage of the extended usage */
-#define USB_HID_EXTENDED_USAGE(usage)		(usage & 0xFFFF)
-
-/*
- * Input/Output/Feature Item flags
- */
-/**
- * Indicates whether the item is data (0) or a constant (1) value. Data
- * indicates the item is defining report fields that contain modifiable device
- * data. Constant indicates the item is a static read-only field in a report
- * and cannot be modified (written) by the host.
- */
-#define USB_HID_ITEM_FLAG_CONSTANT(flags) 	((flags & 0x1) == 0x1)
-
-/**
- * Indicates whether the item creates variable (1) or array (0) data fields in
- * reports.
- */
-#define USB_HID_ITEM_FLAG_VARIABLE(flags) 	((flags & 0x2) == 0x2)
-
-/**
- * Indicates whether the data is absolute (0) (based on a fixed origin) or
- * relative (1) (indicating the change in value from the last report). Mouse
- * devices usually provide relative data, while tablets usually provide
- * absolute data.
- */
-#define USB_HID_ITEM_FLAG_RELATIVE(flags) 	((flags & 0x4) == 0x4)
-
-/** Indicates whether the data “rolls over” when reaching either the extreme
- * high or low value. For example, a dial that can spin freely 360 degrees
- * might output values from 0 to 10. If Wrap is indicated, the next value
- * reported after passing the 10 position in the increasing direction would be
- * 0.
- */
-#define USB_HID_ITEM_FLAG_WRAP(flags)		((flags & 0x8) == 0x8)
-
-/**
- * Indicates whether the raw data from the device has been processed in some
- * way, and no longer represents a linear relationship between what is
- * measured and the data that is reported.
- */
-#define USB_HID_ITEM_FLAG_LINEAR(flags)		((flags & 0x10) == 0x10)
-
-/**
- * Indicates whether the control has a preferred state to which it will return
- * when the user is not physically interacting with the control. Push buttons
- * (as opposed to toggle buttons) and self- centering joysticks are examples.
- */
-#define USB_HID_ITEM_FLAG_PREFERRED(flags)	((flags & 0x20) == 0x20)
-
-/**
- * Indicates whether the control has a state in which it is not sending
- * meaningful data. One possible use of the null state is for controls that
- * require the user to physically interact with the control in order for it to
- * report useful data.
- */
-#define USB_HID_ITEM_FLAG_POSITION(flags)	((flags & 0x40) == 0x40)
-
-/**
- * Indicates whether the Feature or Output control's value should be changed
- * by the host or not.  Volatile output can change with or without host
- * interaction. To avoid synchronization problems, volatile controls should be
- * relative whenever possible.
- */
-#define USB_HID_ITEM_FLAG_VOLATILE(flags)	((flags & 0x80) == 0x80)
-
-/**
- * Indicates that the control emits a fixed-size stream of bytes. The contents
- * of the data field are determined by the application. The contents of the
- * buffer are not interpreted as a single numeric quantity. Report data
- * defined by a Buffered Bytes item must be aligned on an 8-bit boundary.
- */
-#define USB_HID_ITEM_FLAG_BUFFERED(flags)	((flags & 0x100) == 0x100)
-
-/* MAIN ITEMS */
-
-/**
- * Main items are used to either define or group certain types of data fields
- * within a Report descriptor.
- */
-#define USB_HID_TAG_CLASS_MAIN			0x0
-
-/**
- * An Input item describes information about the data provided by one or more
- * physical controls. An application can use this information to interpret the
- * data provided by the device. All data fields defined in a single item share
- * an identical data format.
- */
-#define USB_HID_REPORT_TAG_INPUT		0x8
-
-/**
- * The Output item is used to define an output data field in a report. This
- * item is similar to an Input item except it describes data sent to the
- * device—for example, LED states.
- */
-#define USB_HID_REPORT_TAG_OUTPUT		0x9
-
-/**
- * Feature items describe device configuration information that can be sent to
- * the device.
- */
-#define USB_HID_REPORT_TAG_FEATURE		0xB
-
-/**
- * A Collection item identifies a relationship between two or more data
- * (Input, Output, or Feature.)
- */
-#define USB_HID_REPORT_TAG_COLLECTION		0xA
-
-/**
- * While the Collection item opens a collection of data, the End Collection
- * item closes a collection.
- */
-#define USB_HID_REPORT_TAG_END_COLLECTION	0xC
-
-/* GLOBAL ITEMS */
-
-/**
- * Global items describe rather than define data from a control.
- */
-#define USB_HID_TAG_CLASS_GLOBAL		0x1
-
-/**
- * Unsigned integer specifying the current Usage Page. Since a usage are 32
- * bit values, Usage Page items can be used to conserve space in a report
- * descriptor by setting the high order 16 bits of a subsequent usages. Any
- * usage that follows which is defines 16 bits or less is interpreted as a
- * Usage ID and concatenated with the Usage Page to form a 32 bit Usage.
- */
-#define USB_HID_REPORT_TAG_USAGE_PAGE		0x0
-
-/**
- * Extent value in logical units. This is the minimum value that a variable
- * or array item will report. For example, a mouse reporting x position values
- * from 0 to 128 would have a Logical Minimum of 0 and a Logical Maximum of
- * 128.
- */
-#define USB_HID_REPORT_TAG_LOGICAL_MINIMUM	0x1
-
-/**
- * Extent value in logical units. This is the maximum value that a variable
- * or array item will report.
- */
-#define USB_HID_REPORT_TAG_LOGICAL_MAXIMUM	0x2
-
-/**
- * Minimum value for the physical extent of a variable item. This represents
- * the Logical Minimum with units applied to it.
- */
-#define USB_HID_REPORT_TAG_PHYSICAL_MINIMUM 	0x3
-
-/**
- * Maximum value for the physical extent of a variable item.
- */
-#define USB_HID_REPORT_TAG_PHYSICAL_MAXIMUM 	0x4
-
-/**
- * Value of the unit exponent in base 10. See the table later in this section
- * for more information.
- */
-#define USB_HID_REPORT_TAG_UNIT_EXPONENT	0x5
-
-/**
- * Unit values.
- */
-#define USB_HID_REPORT_TAG_UNIT			0x6
-
-/**
- * Unsigned integer specifying the size of the report fields in bits. This
- * allows the parser to build an item map for the report handler to use.
- */
-#define USB_HID_REPORT_TAG_REPORT_SIZE		0x7
-
-/**
- * Unsigned value that specifies the Report ID. If a Report ID tag is used
- * anywhere in Report descriptor, all data reports for the device are preceded
- * by a single byte ID field. All items succeeding the first Report ID tag but
- * preceding a second Report ID tag are included in a report prefixed by a
- * 1-byte ID. All items succeeding the second but preceding a third Report ID
- * tag are included in a second report prefixed by a second ID, and so on.
- */
-#define USB_HID_REPORT_TAG_REPORT_ID		0x8
-
-/**
- * Unsigned integer specifying the number of data fields for the item;
- * determines how many fields are included in the report for this particular
- * item (and consequently how many bits are added to the report).
- */
-#define USB_HID_REPORT_TAG_REPORT_COUNT		0x9
-
-/**
- * Places a copy of the global item state table on the stack.
- */
-#define USB_HID_REPORT_TAG_PUSH			0xA
-
-/**
- * Replaces the item state table with the top structure from the stack.
- */
-#define USB_HID_REPORT_TAG_POP			0xB
-
-/* LOCAL ITEMS */
-
-/**
- * Local item tags define characteristics of controls. These items do not
- * carry over to the next Main item. If a Main item defines more than one
- * control, it may be preceded by several similar Local item tags. For
- * example, an Input item may have several Usage tags associated with it, one
- * for each control.
- */
-#define USB_HID_TAG_CLASS_LOCAL			0x2
-
-/**
- * Usage index for an item usage; represents a suggested usage for the item or
- * collection. In the case where an item represents multiple controls, a Usage
- * tag may suggest a usage for every variable or element in an array.
- */
-#define USB_HID_REPORT_TAG_USAGE		0x0
-
-/**
- * Defines the starting usage associated with an array or bitmap.
- */
-#define USB_HID_REPORT_TAG_USAGE_MINIMUM	0x1
-
-/**
- * Defines the ending usage associated with an array or bitmap.
- */
-#define USB_HID_REPORT_TAG_USAGE_MAXIMUM	0x2
-
-/**
- * Determines the body part used for a control. Index points to a designator
- * in the Physical descriptor.
- */
-#define USB_HID_REPORT_TAG_DESIGNATOR_INDEX	0x3
-
-/**
- * Defines the index of the starting designator associated with an array or
- * bitmap.
- */
-#define USB_HID_REPORT_TAG_DESIGNATOR_MINIMUM	0x4
-
-/**
- * Defines the index of the ending designator associated with an array or
- * bitmap.
- */
-#define USB_HID_REPORT_TAG_DESIGNATOR_MAXIMUM	0x5
-
-/**
- * String index for a String descriptor; allows a string to be associated with
- * a particular item or control.
- */
-#define USB_HID_REPORT_TAG_STRING_INDEX		0x7
-
-/**
- * Specifies the first string index when assigning a group of sequential
- * strings to controls in an array or bitmap.
- */
-#define USB_HID_REPORT_TAG_STRING_MINIMUM	0x8
-
-/**
- * Specifies the last string index when assigning a group of sequential
- * strings to controls in an array or bitmap.
- */
-#define USB_HID_REPORT_TAG_STRING_MAXIMUM	0x9
-
-/**
- * Defines the beginning or end of a set of local items (1 = open set, 0 =
- * close set).
- *
- * Usages other than the first (most preferred) usage defined are not
- * accessible by system software.
- */
-#define USB_HID_REPORT_TAG_DELIMITER		0xA
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hiddescriptor.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hiddescriptor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * USB HID report descriptor and report data parser
- */
-#ifndef LIBUSB_HIDDESCRIPTOR_H_
-#define LIBUSB_HIDDESCRIPTOR_H_
-
-#include <errno.h>
-#include <stdint.h>
-#include <adt/list.h>
-#include <usb/hid/hid_report_items.h>
-#include <usb/hid/hidpath.h>
-#include <usb/hid/hidtypes.h>
-
-errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report,
-    const uint8_t *data, size_t size);
-
-void usb_hid_descriptor_print(usb_hid_report_t *report);
-
-errno_t usb_hid_report_init(usb_hid_report_t *report);
-
-void usb_hid_report_deinit(usb_hid_report_t *report);
-
-errno_t usb_hid_report_append_fields(usb_hid_report_t *report,
-    usb_hid_report_item_t *report_item);
-
-usb_hid_report_description_t *usb_hid_report_find_description(
-    const usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
-
-int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
-
-int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
-
-int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
-
-int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path);
-
-void usb_hid_descriptor_print_list(list_t *list);
-
-void usb_hid_report_reset_local_items(usb_hid_report_item_t *report_item);
-
-usb_hid_report_item_t *usb_hid_report_item_clone(
-    const usb_hid_report_item_t *item);
-
-uint32_t usb_hid_report_tag_data_uint32(const uint8_t *data, size_t size);
-
-usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t *report,
-    usb_hid_report_path_t *cmp_path);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hidparser.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidparser.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * USB HID report descriptor and report data parser
- */
-#ifndef LIBUSBHID_HIDPARSER_H_
-#define LIBUSBHID_HIDPARSER_H_
-
-#include <stdint.h>
-#include <adt/list.h>
-#include <usb/hid/hid_report_items.h>
-#include <usb/hid/hidpath.h>
-#include <usb/hid/hidtypes.h>
-#include <usb/hid/hiddescriptor.h>
-
-/*
- * Input report parser functions
- */
-errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,
-    size_t size, uint8_t *report_id);
-
-/*
- * Output report parser functions
- */
-uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size,
-    uint8_t report_id);
-
-void usb_hid_report_output_free(uint8_t *output);
-
-size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
-
-size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type);
-
-errno_t usb_hid_report_output_translate(usb_hid_report_t *report,
-    uint8_t report_id, uint8_t *buffer, size_t size);
-
-/*
- * Report descriptor structure observing functions
- */
-usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report,
-    usb_hid_report_field_t *field, usb_hid_report_path_t *path,
-    int flags, usb_hid_report_type_t type);
-
-uint8_t usb_hid_get_next_report_id(usb_hid_report_t *report,
-    uint8_t report_id, usb_hid_report_type_t type);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hidpath.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidpath.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,138 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * USB HID report descriptor and report data parser
- */
-#ifndef LIBUSB_HIDPATH_H_
-#define LIBUSB_HIDPATH_H_
-
-#include <errno.h>
-#include <usb/hid/hidparser.h>
-#include <stdint.h>
-#include <adt/list.h>
-
-/*
- * Flags of usage paths comparison modes.
- *
- */
-/** Wanted usage path must be exactly the same as the searched one.  This
- * option cannot be combined with the others.
- */
-#define USB_HID_PATH_COMPARE_STRICT		0
-
-/**
- * Wanted usage path must be the suffix in the searched one.
- */
-#define USB_HID_PATH_COMPARE_END		1
-
-/**
- * Only usage page are compared along the usage path.  This option can be
- * combined with others.
- */
-#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY	2
-
-/**
- * Searched usage page must be prefix of the other one.
- */
-#define USB_HID_PATH_COMPARE_BEGIN		4
-
-/**
- * Searched couple of usage page and usage can be anywhere in usage path.
- * This option is deprecated.
- */
-#define USB_HID_PATH_COMPARE_ANYWHERE		8
-
-/**
- * Item of usage path structure. Last item of linked list describes one item
- * in report, the others describe superior Collection tags. Usage and Usage
- * page of report item can be changed due to data in report.
- */
-typedef struct {
-	/** Usage page of report item. Zero when usage page can be changed. */
-	uint32_t usage_page;
-	/** Usage of report item. Zero when usage can be changed. */
-	uint32_t usage;
-
-	/** Attribute of Collection tag in report descriptor */
-	uint8_t flags;
-
-	/** Link to usb_hid_report_path_t.items list */
-	link_t rpath_items_link;
-} usb_hid_report_usage_path_t;
-
-/**
- * USB HID usage path structure.
- */
-typedef struct {
-	/** Length of usage path */
-	int depth;
-
-	/** Report id. Zero is reserved and means that report id is not used.
-	 */
-	uint8_t report_id;
-
-	/** Link to usb_hid_report_path_t.collection_paths list. */
-	link_t cpath_link;
-
-	/** List of usage path items. */
-	list_t items;	/* of usb_hid_report_usage_path_t */
-} usb_hid_report_path_t;
-
-usb_hid_report_path_t *usb_hid_report_path(void);
-
-void usb_hid_report_path_free(usb_hid_report_path_t *path);
-
-errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,
-    uint8_t report_id);
-
-errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,
-    int32_t usage_page, int32_t usage);
-
-void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path);
-
-void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path);
-
-void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path,
-    int32_t tag, int32_t data);
-
-int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path,
-    usb_hid_report_path_t *path, int flags);
-
-usb_hid_report_path_t *usb_hid_report_path_clone(
-    usb_hid_report_path_t *usage_path);
-
-void usb_hid_print_usage_path(usb_hid_report_path_t *path);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hidreport.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidreport.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * USB HID report parser initialization from descriptors.
- */
-
-#ifndef LIBUSBHID_HIDREPORT_H_
-#define LIBUSBHID_HIDREPORT_H_
-
-#include <usb/dev/driver.h>
-#include <usb/hid/hidparser.h>
-
-/**
- * Retrieves the Report descriptor from the USB device and initializes the
- * report parser.
- *
- * \param[in] dev USB device representing a HID device.
- * \param[in/out] parser HID Report parser.
- * \param[out] report_desc Place to save report descriptor into.
- * \param[out] report_size
- *
- * \retval EOK if successful.
- * \retval EINVAL if one of the parameters is not given (is NULL).
- * \retval ENOENT if there are some descriptors missing.
- * \retval ENOMEM if an error with allocation occured.
- * \retval EINVAL if the Report descriptor's size does not match the size
- *         from the interface descriptor.
- * \return Other value inherited from function usb_pipe_start_session(),
- *         usb_pipe_end_session() or usb_request_get_descriptor().
- */
-errno_t usb_hid_process_report_descriptor(usb_device_t *dev,
-    usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size);
-
-#endif /* LIBUSB_HIDREPORT_H_ */
-
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/hidtypes.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/hidtypes.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,311 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusb
- * @{
- */
-/** @file
- * Basic data structures for USB HID Report descriptor and report parser.
- */
-#ifndef LIBUSB_HIDTYPES_H_
-#define LIBUSB_HIDTYPES_H_
-
-#include <stdint.h>
-#include <adt/list.h>
-
-/**
- * Maximum amount of specified usages for one report item
- */
-#define USB_HID_MAX_USAGES	0xffff
-
-/**
- * Converts integer from unsigned two's complement format format to signed
- * one.
- *
- * @param x Number to convert
- * @param size Length of the unsigned number in bites
- * @return signed int
- */
-#define USB_HID_UINT32_TO_INT32(x, size)	\
-	((((x) & (1 << ((size) - 1))) != 0) ?   \
-	 -(~((x) - 1) & ((1 << size) - 1)) : (x))
-
-/**
- * Convert integer from signed format to unsigned. If number is negative the
- * two's complement format is used.
- *
- * @param x Number to convert
- * @param size Length of result number in bites
- * @return unsigned int
- */
-#define USB_HID_INT32_TO_UINT32(x, size)	\
-	(((x) < 0 ) ? ((1 << (size)) + (x)) : (x))
-
-/**
- * Enum of report types
- */
-typedef enum {
-	/** Input report. Data are sent from device to system */
-	USB_HID_REPORT_TYPE_INPUT = 1,
-
-	/** Output report. Data are sent from system to device */
-	USB_HID_REPORT_TYPE_OUTPUT = 2,
-
-	/** Feature report. Describes device configuration information that
-	 * can be sent to the device
-	 */
-	USB_HID_REPORT_TYPE_FEATURE = 3
-} usb_hid_report_type_t;
-
-/**
- * Description of all reports described in one report descriptor.
- */
-typedef struct {
-	/** Count of available reports. */
-	int report_count;
-
-	/** List of description of reports. */
-	list_t reports; /* of usb_hid_report_description_t */
-
-	/** List of all used usage/collection paths. */
-	list_t collection_paths;
-
-	/** Length of list of usage paths. */
-	int collection_paths_count;
-
-	/** Flag whether report ids are used. */
-	int use_report_ids;
-
-	/** Report id of last parsed report. */
-	uint8_t last_report_id;
-
-} usb_hid_report_t;
-
-/**
- * Description of one concrete report
- */
-typedef struct {
-	/** Report id. Zero when no report id is used. */
-	uint8_t report_id;
-
-	/** Type of report */
-	usb_hid_report_type_t type;
-
-	/** Bit length of the report */
-	size_t bit_length;
-
-	/** Number of items in report */
-	size_t item_length;
-
-	/** List of report items in report */
-	list_t report_items;
-
-	/** Link to usb_hid_report_t.reports list. */
-	link_t reports_link;
-} usb_hid_report_description_t;
-
-/**
- * Description of one field/item in report
- */
-typedef struct {
-	/** Bit offset of the field */
-	int offset;
-
-	/** Bit size of the field */
-	size_t size;
-
-	/** Usage page. Zero when usage page can be changed. */
-	uint16_t usage_page;
-
-	/** Usage. Zero when usage can be changed. */
-	uint16_t usage;
-
-	/** Item's attributes */
-	uint8_t item_flags;
-
-	/** Usage/Collection path of the field. */
-	usb_hid_report_path_t *collection_path;
-
-	/**
-	 * The lowest valid logical value (value with the device operates)
-	 */
-	int32_t logical_minimum;
-
-	/**
-	 * The greatest valid logical value
-	 */
-	int32_t logical_maximum;
-
-	/**
-	 * The lowest valid physical value (value with the system operates)
-	 */
-	int32_t physical_minimum;
-
-	/** The greatest valid physical value */
-	int32_t physical_maximum;
-
-	/** The lowest valid usage index */
-	int32_t usage_minimum;
-
-	/** The greatest valid usage index */
-	int32_t usage_maximum;
-
-	/** Unit of the value */
-	uint32_t unit;
-
-	/** Unit exponent */
-	uint32_t unit_exponent;
-
-	/** Array of possible usages */
-	uint32_t *usages;
-
-	/** Size of the array of usages */
-	size_t usages_count;
-
-	/** Parsed value */
-	int32_t value;
-
-	/** Link to usb_hid_report_description_t.report_items list */
-	link_t ritems_link;
-} usb_hid_report_field_t;
-
-/**
- * State table for report descriptor parsing
- */
-typedef struct {
-	/** report id */
-	int32_t id;
-
-	/** Extended usage page */
-	uint16_t extended_usage_page;
-
-	/** Array of usages specified for this item */
-	uint32_t usages[USB_HID_MAX_USAGES];
-
-	/** Length of usages array */
-	int usages_count;
-
-	/** Usage page */
-	uint32_t usage_page;
-
-	/** Minimum valid usage index */
-	int32_t usage_minimum;
-
-	/** Maximum valid usage index */
-	int32_t usage_maximum;
-
-	/** Minimum valid logical value */
-	int32_t logical_minimum;
-
-	/** Maximum valid logical value */
-	int32_t logical_maximum;
-
-	/** Length of the items in bits */
-	int32_t size;
-
-	/** Count of items */
-	int32_t count;
-
-	/**  Bit offset of the item in report */
-	size_t offset;
-
-	/** Unit exponent */
-	int32_t unit_exponent;
-	/** Unit of the value */
-	int32_t unit;
-
-	/** String index */
-	uint32_t string_index;
-
-	/** Minimum valid string index */
-	uint32_t string_minimum;
-
-	/** Maximum valid string index */
-	uint32_t string_maximum;
-
-	/** The designator index */
-	uint32_t designator_index;
-
-	/** Minimum valid designator value */
-	uint32_t designator_minimum;
-
-	/** Maximum valid designator value */
-	uint32_t designator_maximum;
-
-	/** Minimal valid physical value */
-	int32_t physical_minimum;
-
-	/** Maximal valid physical value */
-	int32_t physical_maximum;
-
-	/** Items attributes */
-	uint8_t item_flags;
-
-	/** Report type */
-	usb_hid_report_type_t type;
-
-	/** current collection path */
-	usb_hid_report_path_t *usage_path;
-
-	/** Unused */
-	link_t link;
-
-	int in_delimiter;
-} usb_hid_report_item_t;
-
-/**
- * Enum of the keyboard modifiers
- */
-typedef enum {
-	USB_HID_MOD_LCTRL = 0x01,
-	USB_HID_MOD_LSHIFT = 0x02,
-	USB_HID_MOD_LALT = 0x04,
-	USB_HID_MOD_LGUI = 0x08,
-	USB_HID_MOD_RCTRL = 0x10,
-	USB_HID_MOD_RSHIFT = 0x20,
-	USB_HID_MOD_RALT = 0x40,
-	USB_HID_MOD_RGUI = 0x80,
-	USB_HID_MOD_COUNT = 8
-} usb_hid_modifiers_t;
-
-static const usb_hid_modifiers_t
-    usb_hid_modifiers_consts[USB_HID_MOD_COUNT] = {
-	USB_HID_MOD_LCTRL,
-	USB_HID_MOD_LSHIFT,
-	USB_HID_MOD_LALT,
-	USB_HID_MOD_LGUI,
-	USB_HID_MOD_RCTRL,
-	USB_HID_MOD_RSHIFT,
-	USB_HID_MOD_RALT,
-	USB_HID_MOD_RGUI
-};
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/request.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/request.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * HID class-specific requests.
- */
-
-#ifndef USB_KBD_HIDREQ_H_
-#define USB_KBD_HIDREQ_H_
-
-#include <stdint.h>
-
-#include <usb/hid/hid.h>
-#include <usb/dev/pipes.h>
-
-errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size);
-
-errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_protocol_t protocol);
-
-errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration);
-
-errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size,
-    size_t *actual_size);
-
-errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_protocol_t *protocol);
-
-errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t *duration);
-
-#endif /* USB_KBD_HIDREQ_H_ */
-
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/usages/consumer.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/usages/consumer.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * USB multimedia key usage to string mapping.
- */
-
-#ifndef LIBUSBHID_CONSUMER_H_
-#define LIBUSBHID_CONSUMER_H_
-
-const char *usbhid_multimedia_usage_to_str(unsigned usage);
-
-#endif /* LIBUSBHID_CONSUMER_H_ */
-
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/usages/core.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/usages/core.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * @brief USB HID Usage Tables.
- */
-#ifndef LIBUSBHID_HIDUT_H_
-#define LIBUSBHID_HIDUT_H_
-
-/** USB/HID Usage Pages. */
-typedef enum {
-	USB_HIDUT_PAGE_GENERIC_DESKTOP = 1,
-	USB_HIDUT_PAGE_SIMULATION = 2,
-	USB_HIDUT_PAGE_VR = 3,
-	USB_HIDUT_PAGE_SPORT = 4,
-	USB_HIDUT_PAGE_GAME = 5,
-	USB_HIDUT_PAGE_GENERIC_DEVICE = 6,
-	USB_HIDUT_PAGE_KEYBOARD = 7,
-	USB_HIDUT_PAGE_LED = 8,
-	USB_HIDUT_PAGE_BUTTON = 9,
-	USB_HIDUT_PAGE_ORDINAL = 0x0a,
-	USB_HIDUT_PAGE_TELEPHONY_DEVICE = 0x0b,
-	USB_HIDUT_PAGE_CONSUMER = 0x0c
-} usb_hidut_usage_page_t;
-
-/** Usages for Generic Desktop Page. */
-typedef enum {
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_POINTER = 1,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_MOUSE = 2,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_JOYSTICK = 4,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_GAMEPAD = 5,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYBOARD = 6,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_KEYPAD = 7,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_X = 0x30,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_Y = 0x31,
-	USB_HIDUT_USAGE_GENERIC_DESKTOP_WHEEL = 0x38
-	/* USB_HIDUT_USAGE_GENERIC_DESKTOP_ = , */
-
-} usb_hidut_usage_generic_desktop_t;
-
-typedef enum {
-	USB_HIDUT_USAGE_CONSUMER_CONSUMER_CONTROL = 1
-} usb_hidut_usage_consumer_t;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/usages/kbdgen.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/usages/kbdgen.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * @brief USB HID key codes.
- *
- * This is not a typical header as by default it is equal to empty file.
- * However, by cleverly defining the USB_HIDUT_KBD_KEY you can use it
- * to generate conversion tables etc.
- *
- * For example, this creates enum for known keys:
- * @code
- * #define USB_HIDUT_KBD_KEY(name, usage_id, l, lc, l1, l2) \
- *     USB_KBD_KEY_##name = usage_id,
- *
- * typedef enum {
- *         #include <usb/hidutkbd.h>
- * } usb_key_code_t;
- * @endcode
- *
- * Maybe, it might be better that you would place such enums into separate
- * files and create them as separate step before compiling to allow tools
- * such as Doxygen get the definitions right.
- *
- * @warning This file does not include guard to prevent multiple inclusions
- * into a single file.
- */
-
-#ifndef USB_HIDUT_KBD_KEY
-/** Declare keyboard key.
- * @param name Key name (identifier).
- * @param usage_id Key code (see Keyboard/Keypad Page (0x07) in HUT1.12.
- * @param letter Corresponding character (0 if not applicable).
- * @param letter_caps Corresponding character with Caps on.
- * @param letter_mod1 Corresponding character with modifier #1 on.
- * @param letter_mod2 Corresponding character with modifier #2 on.
- */
-#define USB_HIDUT_KBD_KEY(name, usage_id, letter, letter_caps, letter_mod1, letter_mod2)
-
-#endif
-
-#define __NONPRINT(name, usage_id) \
-	USB_HIDUT_KBD_KEY(name, usage_id, 0, 0, 0, 0)
-
-/* US alphabet letters */
-USB_HIDUT_KBD_KEY(A, 0x04, 'a', 'A', 0, 0);
-USB_HIDUT_KBD_KEY(B, 0x05, 'b', 'B', 0, 0);
-USB_HIDUT_KBD_KEY(C, 0x06, 'c', 'C', 0, 0);
-USB_HIDUT_KBD_KEY(D, 0x07, 'd', 'D', 0, 0);
-USB_HIDUT_KBD_KEY(E, 0x08, 'e', 'E', 0, 0);
-USB_HIDUT_KBD_KEY(F, 0x09, 'f', 'F', 0, 0);
-USB_HIDUT_KBD_KEY(G, 0x0A, 'g', 'G', 0, 0);
-USB_HIDUT_KBD_KEY(H, 0x0B, 'h', 'H', 0, 0);
-USB_HIDUT_KBD_KEY(I, 0x0C, 'i', 'I', 0, 0);
-USB_HIDUT_KBD_KEY(J, 0x0D, 'j', 'J', 0, 0);
-USB_HIDUT_KBD_KEY(K, 0x0E, 'k', 'K', 0, 0);
-USB_HIDUT_KBD_KEY(L, 0x0F, 'l', 'L', 0, 0);
-USB_HIDUT_KBD_KEY(M, 0x10, 'm', 'M', 0, 0);
-USB_HIDUT_KBD_KEY(N, 0x11, 'n', 'N', 0, 0);
-USB_HIDUT_KBD_KEY(O, 0x12, 'o', 'O', 0, 0);
-USB_HIDUT_KBD_KEY(P, 0x13, 'p', 'P', 0, 0);
-USB_HIDUT_KBD_KEY(Q, 0x14, 'q', 'Q', 0, 0);
-USB_HIDUT_KBD_KEY(R, 0x15, 'r', 'R', 0, 0);
-USB_HIDUT_KBD_KEY(S, 0x16, 's', 'S', 0, 0);
-USB_HIDUT_KBD_KEY(T, 0x17, 't', 'T', 0, 0);
-USB_HIDUT_KBD_KEY(U, 0x18, 'u', 'U', 0, 0);
-USB_HIDUT_KBD_KEY(V, 0x19, 'v', 'V', 0, 0);
-USB_HIDUT_KBD_KEY(W, 0x1A, 'w', 'W', 0, 0);
-USB_HIDUT_KBD_KEY(X, 0x1B, 'x', 'X', 0, 0);
-USB_HIDUT_KBD_KEY(Y, 0x1C, 'y', 'Y', 0, 0);
-USB_HIDUT_KBD_KEY(Z, 0x1D, 'z', 'Z', 0, 0);
-
-/* Keyboard digits */
-USB_HIDUT_KBD_KEY(1, 0x1E, '1', '!', 0, 0);
-USB_HIDUT_KBD_KEY(2, 0x1F, '2', '@', 0, 0);
-USB_HIDUT_KBD_KEY(3, 0x20, '3', '#', 0, 0);
-USB_HIDUT_KBD_KEY(4, 0x21, '4', '$', 0, 0);
-USB_HIDUT_KBD_KEY(5, 0x22, '5', '%', 0, 0);
-USB_HIDUT_KBD_KEY(6, 0x23, '6', '^', 0, 0);
-USB_HIDUT_KBD_KEY(7, 0x24, '7', '&', 0, 0);
-USB_HIDUT_KBD_KEY(8, 0x25, '8', '*', 0, 0);
-USB_HIDUT_KBD_KEY(9, 0x26, '9', '(', 0, 0);
-USB_HIDUT_KBD_KEY(0, 0x27, '0', ')', 0, 0);
-
-/* More-or-less typewriter command keys */
-USB_HIDUT_KBD_KEY(ENTER, 0x28, '\n', 0, 0, 0);
-USB_HIDUT_KBD_KEY(ESCAPE, 0x29, 0, 0, 0, 0);
-USB_HIDUT_KBD_KEY(BACKSPACE, 0x2A, '\b', 0, 0, 0);
-USB_HIDUT_KBD_KEY(TAB, 0x2B, '\t', 0, 0, 0);
-USB_HIDUT_KBD_KEY(SPACE, 0x2C, ' ', 0, 0, 0);
-
-/* Special (printable) characters */
-USB_HIDUT_KBD_KEY(DASH, 0x2D, '-', '_', 0, 0);
-USB_HIDUT_KBD_KEY(EQUALS, 0x2E, '=', '+', 0, 0);
-USB_HIDUT_KBD_KEY(LEFT_BRACKET, 0x2F, '[', '{', 0, 0);
-USB_HIDUT_KBD_KEY(RIGHT_BRACKET, 0x30, ']', '}', 0, 0);
-USB_HIDUT_KBD_KEY(BACKSLASH, 0x31, '\\', '|', 0, 0);
-USB_HIDUT_KBD_KEY(HASH, 0x32, '#', '~', 0, 0);
-USB_HIDUT_KBD_KEY(SEMICOLON, 0x33, ';', ':', 0, 0);
-USB_HIDUT_KBD_KEY(APOSTROPHE, 0x34, '\'', '"', 0, 0);
-USB_HIDUT_KBD_KEY(GRAVE_ACCENT, 0x35, '`', '~', 0, 0);
-USB_HIDUT_KBD_KEY(COMMA, 0x36, ',', '<', 0, 0);
-USB_HIDUT_KBD_KEY(PERIOD, 0x37, '.', '>', 0, 0);
-USB_HIDUT_KBD_KEY(SLASH, 0x38, '/', '?', 0, 0);
-
-USB_HIDUT_KBD_KEY(CAPS_LOCK, 0x39, 0, 0, 0, 0);
-
-/* Function keys */
-__NONPRINT(F1, 0x3A);
-__NONPRINT(F2, 0x3B);
-__NONPRINT(F3, 0x3C);
-__NONPRINT(F4, 0x3D);
-__NONPRINT(F5, 0x3E);
-__NONPRINT(F6, 0x3F);
-__NONPRINT(F7, 0x40);
-__NONPRINT(F8, 0x41);
-__NONPRINT(F9, 0x42);
-__NONPRINT(F10, 0x43);
-__NONPRINT(F11, 0x44);
-__NONPRINT(F12, 0x45);
-
-/* Cursor movement keys & co. */
-__NONPRINT(PRINT_SCREEN, 0x46);
-__NONPRINT(SCROLL_LOCK, 0x47);
-__NONPRINT(PAUSE, 0x48);
-__NONPRINT(INSERT, 0x49);
-__NONPRINT(HOME, 0x4A);
-__NONPRINT(PAGE_UP, 0x4B);
-__NONPRINT(DELETE, 0x4C);
-__NONPRINT(END, 0x4D);
-__NONPRINT(PAGE_DOWN, 0x4E);
-__NONPRINT(RIGHT_ARROW, 0x4F);
-__NONPRINT(LEFT_ARROW, 0x50);
-__NONPRINT(DOWN_ARROW, 0x51);
-__NONPRINT(UP_ARROW, 0x52);
-
-/* USB_HIDUT_KBD_KEY(, 0x, '', '', 0, 0) */
-
-#undef __NONPRINT
-
-/**
- * @}
- */
Index: pace/lib/usbhid/include/usb/hid/usages/led.h
===================================================================
--- uspace/lib/usbhid/include/usb/hid/usages/led.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2010 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * @brief USB HID Usage Tables - LED page.
- */
-#ifndef LIBUSBHID_UTLED_H_
-#define LIBUSBHID_UTLED_H_
-
-typedef enum {
-	USB_HID_LED_UNDEFINED = 0,
-	USB_HID_LED_NUM_LOCK,
-	USB_HID_LED_CAPS_LOCK,
-	USB_HID_LED_SCROLL_LOCK,
-	USB_HID_LED_COMPOSE,
-	USB_HID_LED_KANA,
-	USB_HID_LED_POWER,
-	USB_HID_LED_SHIFT,
-	USB_HID_LED_DND,
-	USB_HID_LED_MUTE,
-	USB_HID_LED_TONE_ENABLE,
-	USB_HID_LED_HIGH_CUT_FILTER,
-	USB_HID_LED_LOW_CUT_FILTER,
-	USB_HID_LED_EQ_ENABLE,
-	USB_HID_LED_SOUND_FIELD_ON,
-	USB_HID_LED_SURROUND_ON,
-	USB_HID_LED_REPEAT,
-	USB_HID_LED_STEREO,
-	USB_HID_LED_SAMPLING_RATE_DETECT,
-	USB_HID_LED_SPINNING,
-	USB_HID_LED_CAV,
-	USB_HID_LED_CLV,
-	USB_HID_LED_RECORDING_FORMAT_DETECT,
-	USB_HID_LED_OFF_HOOK,
-	USB_HID_LED_RING,
-	USB_HID_LED_MESSAGE_WAITING,
-	USB_HID_LED_DATA_MODE,
-	USB_HID_LED_BATTERY_OPERATION,
-	USB_HID_LED_BATTERY_OK,
-	USB_HID_LED_BATTERY_LOW,
-	USB_HID_LED_SPEAKER,
-	USB_HID_LED_HEAD_SET,
-	USB_HID_LED_HOLD,
-	USB_HID_LED_MICRO,
-	USB_HID_LED_COVERAGE,
-	USB_HID_LED_NIGHT_MODE,
-	USB_HID_LED_SEND_CALLS,
-	USB_HID_LED_CALL_PICKUP,
-	USB_HID_LED_CONFERENCE,
-	USB_HID_LED_STAND_BY,
-	USB_HID_LED_CAMERA_ON,
-	USB_HID_LED_CAMERA_OFF,
-	USB_HID_LED_ON_LINE,
-	USB_HID_LED_OFF_LINE,
-	USB_HID_LED_BUSY,
-	USB_HID_LED_READY,
-	USB_HID_LED_PAPER_OUT,
-	USB_HID_LED_PAPER_JAM,
-	USB_HID_LED_REMOTE,
-	USB_HID_LED_FORWARD,
-	USB_HID_LED_REVERSE,
-	USB_HID_LED_STOP,
-	USB_HID_LED_REWIND,
-	USB_HID_LED_FAST_FORWARD,
-	USB_HID_LED_PLAY,
-	USB_HID_LED_PAUSE,
-	USB_HID_LED_RECORD,
-	USB_HID_LED_ERROR,
-	USB_HID_LED_USAGE_SELECTED_IND,
-	USB_HID_LED_USAGE_IN_USE_IND,
-	USB_HID_LED_USAGE_MULTI_MODE_IND,
-	USB_HID_LED_IND_ON,
-	USB_HID_LED_IND_FLASH,
-	USB_HID_LED_IND_SLOW_BLINK,
-	USB_HID_LED_IND_FAST_BLINK,
-	USB_HID_LED_IND_OFF,
-	USB_HID_LED_FLASH_ON_TIME,
-	USB_HID_LED_SLOW_BLINK_ON_TIME,
-	USB_HID_LED_SLOW_BLINK_OFF_TIME,
-	USB_HID_LED_FAST_BLINK_ON_TIME,
-	USB_HID_LED_FAST_BLINK_OFF_TIME,
-	USB_HID_LED_USAGE_IND_COLOR,
-	USB_HID_LED_IND_RED,
-	USB_HID_LED_IND_GREEN,
-	USB_HID_LED_IND_AMBER,
-	USB_HID_LED_GENERIC_IND,
-	USB_HID_LED_SYSTEM_SUSPEND,
-	USB_HID_LED_EXTERNAL_POWER
-} usb_hid_usage_led_t;
-
-#endif /* LIBUSB_UTLED_H_ */
-/**
- * @}
- */
Index: pace/lib/usbhid/meson.build
===================================================================
--- uspace/lib/usbhid/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usb' , 'usbdev' , 'drv' ]
-src = files(
-	'src/hiddescriptor.c',
-	'src/hidparser.c',
-	'src/hidpath.c',
-	'src/hidreport.c',
-	'src/consumer.c',
-	'src/hidreq.c',
-)
Index: pace/lib/usbhid/src/consumer.c
===================================================================
--- uspace/lib/usbhid/src/consumer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,732 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * UUSB multimedia key usage, to string mapping.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <usb/hid/usages/consumer.h>
-
-static const char *usbhid_consumer_usage_str[] = {
-	[0x01] = "Consumer Control",
-	[0x02] = "Numeric Key Pad",
-	[0x03] = "Programmable Buttons",
-	[0x04] = "Microphone",
-	[0x05] = "Headphone",
-	[0x06] = "Graphic Equalizer",
-	[0x07] = "Reserved",
-	[0x08] = "Reserved",
-	[0x09] = "Reserved",
-	[0x0a] = "Reserved",
-	[0x0b] = "Reserved",
-	[0x0c] = "Reserved",
-	[0x0d] = "Reserved",
-	[0x0e] = "Reserved",
-	[0x0f] = "Reserved",
-	[0x10] = "Reserved",
-	[0x11] = "Reserved",
-	[0x12] = "Reserved",
-	[0x13] = "Reserved",
-	[0x14] = "Reserved",
-	[0x15] = "Reserved",
-	[0x16] = "Reserved",
-	[0x17] = "Reserved",
-	[0x18] = "Reserved",
-	[0x19] = "Reserved",
-	[0x1a] = "Reserved",
-	[0x1b] = "Reserved",
-	[0x1c] = "Reserved",
-	[0x1d] = "Reserved",
-	[0x1e] = "Reserved",
-	[0x1f] = "Reserved",
-	[0x20] = "+10",
-	[0x21] = "+100",
-	[0x22] = "AM/PM",
-	[0x23] = "Reserved",
-	[0x24] = "Reserved",
-	[0x25] = "Reserved",
-	[0x26] = "Reserved",
-	[0x27] = "Reserved",
-	[0x28] = "Reserved",
-	[0x29] = "Reserved",
-	[0x2a] = "Reserved",
-	[0x2b] = "Reserved",
-	[0x2c] = "Reserved",
-	[0x2d] = "Reserved",
-	[0x2e] = "Reserved",
-	[0x2f] = "Reserved",
-	[0x30] = "Reserved",
-	[0x31] = "Reserved",
-	[0x32] = "Reserved",
-	[0x33] = "Reserved",
-	[0x34] = "Reserved",
-	[0x35] = "Reserved",
-	[0x36] = "Reserved",
-	[0x37] = "Reserved",
-	[0x38] = "Reserved",
-	[0x39] = "Reserved",
-	[0x3a] = "Reserved",
-	[0x3b] = "Reserved",
-	[0x3c] = "Reserved",
-	[0x3d] = "Reserved",
-	[0x3e] = "Reserved",
-	[0x3f] = "Reserved",
-	[0x40] = "Menu",
-	[0x41] = "Menu Pick",
-	[0x42] = "Menu Up",
-	[0x43] = "Menu Down",
-	[0x44] = "Menu Left",
-	[0x45] = "Menu Right",
-	[0x46] = "Menu Escape",
-	[0x47] = "Menu Value Increase",
-	[0x48] = "Menu Value Decrease",
-	[0x49] = "Reserved",
-	[0x4a] = "Reserved",
-	[0x4b] = "Reserved",
-	[0x4c] = "Reserved",
-	[0x4d] = "Reserved",
-	[0x4e] = "Reserved",
-	[0x4f] = "Reserved",
-	[0x50] = "Reserved",
-	[0x51] = "Reserved",
-	[0x52] = "Reserved",
-	[0x53] = "Reserved",
-	[0x54] = "Reserved",
-	[0x55] = "Reserved",
-	[0x56] = "Reserved",
-	[0x57] = "Reserved",
-	[0x58] = "Reserved",
-	[0x59] = "Reserved",
-	[0x5a] = "Reserved",
-	[0x5b] = "Reserved",
-	[0x5c] = "Reserved",
-	[0x5d] = "Reserved",
-	[0x5e] = "Reserved",
-	[0x5f] = "Reserved",
-	[0x60] = "Data On Screen",
-	[0x61] = "Closed Caption",
-	[0x62] = "Closed Caption Select",
-	[0x63] = "VCR/TV",
-	[0x64] = "Broadcast Mode",
-	[0x65] = "Snapshot",
-	[0x66] = "Still",
-	[0x67] = "Reserved",
-	[0x68] = "Reserved",
-	[0x69] = "Reserved",
-	[0x6a] = "Reserved",
-	[0x6b] = "Reserved",
-	[0x6c] = "Reserved",
-	[0x6d] = "Reserved",
-	[0x6e] = "Reserved",
-	[0x6f] = "Reserved",
-	[0x70] = "Reserved",
-	[0x71] = "Reserved",
-	[0x72] = "Reserved",
-	[0x73] = "Reserved",
-	[0x74] = "Reserved",
-	[0x75] = "Reserved",
-	[0x76] = "Reserved",
-	[0x77] = "Reserved",
-	[0x78] = "Reserved",
-	[0x79] = "Reserved",
-	[0x7a] = "Reserved",
-	[0x7b] = "Reserved",
-	[0x7c] = "Reserved",
-	[0x7d] = "Reserved",
-	[0x7e] = "Reserved",
-	[0x7f] = "Reserved",
-	[0x80] = "Selection",
-	[0x81] = "Assign Selection",
-	[0x82] = "Mode Step",
-	[0x83] = "Recall Last",
-	[0x84] = "Enter Channel",
-	[0x85] = "Order Movie",
-	[0x86] = "Channel",
-	[0x87] = "Media Selection",
-	[0x88] = "Media Select Computer",
-	[0x89] = "Media Select TV",
-	[0x8a] = "Media Select WWW",
-	[0x8b] = "Media Select DVD",
-	[0x8c] = "Media Select Telephone",
-	[0x8d] = "Media Select Program Guide",
-	[0x8e] = "Media Select Video Phone",
-	[0x8f] = "Media Select Games",
-	[0x90] = "Media Select Messages",
-	[0x91] = "Media Select CD",
-	[0x92] = "Media Select VCR",
-	[0x93] = "Media Select Tuner",
-	[0x94] = "Quit",
-	[0x95] = "Help",
-	[0x96] = "Media Select Tape",
-	[0x97] = "Media Select Cable",
-	[0x98] = "Media Select Satellite",
-	[0x99] = "Media Select Security",
-	[0x9a] = "Media Select Home",
-	[0x9b] = "Media Select Call",
-	[0x9c] = "Channel Increment",
-	[0x9d] = "Channel Decrement",
-	[0x9e] = "Media Select SAP",
-	[0x9f] = "Reserved",
-	[0xa0] = "VCR Plus",
-	[0xa1] = "Once",
-	[0xa2] = "Daily",
-	[0xa3] = "Weekly",
-	[0xa4] = "Monthly",
-	[0xa5] = "Reserved",
-	[0xa6] = "Reserved",
-	[0xa7] = "Reserved",
-	[0xa8] = "Reserved",
-	[0xa9] = "Reserved",
-	[0xaa] = "Reserved",
-	[0xab] = "Reserved",
-	[0xac] = "Reserved",
-	[0xad] = "Reserved",
-	[0xae] = "Reserved",
-	[0xaf] = "Reserved",
-	[0xb0] = "Play",
-	[0xb1] = "Pause",
-	[0xb2] = "Record",
-	[0xb3] = "Fast Forward",
-	[0xb4] = "Rewind",
-	[0xb5] = "Scan Next Track",
-	[0xb6] = "Scan Previous Trac",
-	[0xb7] = "Stop",
-	[0xb8] = "Eject",
-	[0xb9] = "Random Play",
-	[0xba] = "Select Disc",
-	[0xbb] = "Enter Disc",
-	[0xbc] = "Repeat",
-	[0xbd] = "Tracking",
-	[0xbe] = "Track Normal",
-	[0xbf] = "Slow Tracking",
-	[0xc0] = "Frame Forward",
-	[0xc1] = "Frame Back",
-	[0xc2] = "Mark",
-	[0xc3] = "Clear Mark",
-	[0xc4] = "Repeat From Mark",
-	[0xc5] = "Return to Mark",
-	[0xc6] = "Search Mark Forward",
-	[0xc7] = "Search Mark Backwards",
-	[0xc8] = "Counter Reset",
-	[0xc9] = "Show Counter",
-	[0xca] = "Tracking Increment",
-	[0xcb] = "Tracking Decrement",
-	[0xcc] = "Stop/Eject",
-	[0xcd] = "Play/Pause",
-	[0xce] = "Play/Skip",
-	[0xcf] = "Reserved",
-	[0xd0] = "Reserved",
-	[0xd1] = "Reserved",
-	[0xd2] = "Reserved",
-	[0xd3] = "Reserved",
-	[0xd4] = "Reserved",
-	[0xd5] = "Reserved",
-	[0xd6] = "Reserved",
-	[0xd7] = "Reserved",
-	[0xd8] = "Reserved",
-	[0xd9] = "Reserved",
-	[0xda] = "Reserved",
-	[0xdb] = "Reserved",
-	[0xdc] = "Reserved",
-	[0xdd] = "Reserved",
-	[0xde] = "Reserved",
-	[0xdf] = "Reserved",
-	[0xe0] = "Volume",
-	[0xe1] = "Balance",
-	[0xe2] = "Mute",
-	[0xe3] = "Bass",
-	[0xe4] = "Treble",
-	[0xe5] = "Bass Boost",
-	[0xe6] = "Surround Mode",
-	[0xe7] = "Loudness",
-	[0xe8] = "MPX",
-	[0xe9] = "Volume Increment",
-	[0xea] = "Volume Decrement",
-	[0xeb] = "Reserved",
-	[0xec] = "Reserved",
-	[0xed] = "Reserved",
-	[0xee] = "Reserved",
-	[0xef] = "Reserved",
-	[0xf0] = "Speed Select",
-	[0xf1] = "Playback Speed",
-	[0xf2] = "Standard Play",
-	[0xf3] = "Long Play",
-	[0xf4] = "Extended Play",
-	[0xf5] = "Slow",
-	[0xf6] = "Reserved",
-	[0xf7] = "Reserved",
-	[0xf8] = "Reserved",
-	[0xf9] = "Reserved",
-	[0xfa] = "Reserved",
-	[0xfb] = "Reserved",
-	[0xfc] = "Reserved",
-	[0xfd] = "Reserved",
-	[0xfe] = "Reserved",
-	[0xff] = "Reserved",
-	[0x100] = "Fan Enable",
-	[0x101] = "Fan Speed",
-	[0x102] = "Light Enable",
-	[0x103] = "Light Illumination Level",
-	[0x104] = "Climate Control Enable",
-	[0x105] = "Room Temperature",
-	[0x106] = "Security Enable",
-	[0x107] = "Fire Alarm",
-	[0x108] = "Police Alarm",
-	[0x109] = "Proximity",
-	[0x10a] = "Motion",
-	[0x10b] = "Duress Alarm",
-	[0x10c] = "Holdup Alarm",
-	[0x10d] = "Medical Alarm",
-	[0x10e] = "Reserved",
-	[0x10f] = "Reserved",
-	[0x110] = "Reserved",
-	[0x111] = "Reserved",
-	[0x112] = "Reserved",
-	[0x113] = "Reserved",
-	[0x114] = "Reserved",
-	[0x115] = "Reserved",
-	[0x116] = "Reserved",
-	[0x117] = "Reserved",
-	[0x118] = "Reserved",
-	[0x119] = "Reserved",
-	[0x11a] = "Reserved",
-	[0x11b] = "Reserved",
-	[0x11c] = "Reserved",
-	[0x11d] = "Reserved",
-	[0x11e] = "Reserved",
-	[0x11f] = "Reserved",
-	[0x120] = "Reserved",
-	[0x121] = "Reserved",
-	[0x122] = "Reserved",
-	[0x123] = "Reserved",
-	[0x124] = "Reserved",
-	[0x125] = "Reserved",
-	[0x126] = "Reserved",
-	[0x127] = "Reserved",
-	[0x128] = "Reserved",
-	[0x129] = "Reserved",
-	[0x12a] = "Reserved",
-	[0x12b] = "Reserved",
-	[0x12c] = "Reserved",
-	[0x12d] = "Reserved",
-	[0x12e] = "Reserved",
-	[0x12f] = "Reserved",
-	[0x130] = "Reserved",
-	[0x131] = "Reserved",
-	[0x132] = "Reserved",
-	[0x133] = "Reserved",
-	[0x134] = "Reserved",
-	[0x135] = "Reserved",
-	[0x136] = "Reserved",
-	[0x137] = "Reserved",
-	[0x138] = "Reserved",
-	[0x139] = "Reserved",
-	[0x13a] = "Reserved",
-	[0x13b] = "Reserved",
-	[0x13c] = "Reserved",
-	[0x13d] = "Reserved",
-	[0x13e] = "Reserved",
-	[0x13f] = "Reserved",
-	[0x140] = "Reserved",
-	[0x141] = "Reserved",
-	[0x142] = "Reserved",
-	[0x143] = "Reserved",
-	[0x144] = "Reserved",
-	[0x145] = "Reserved",
-	[0x146] = "Reserved",
-	[0x147] = "Reserved",
-	[0x148] = "Reserved",
-	[0x149] = "Reserved",
-	[0x14a] = "Reserved",
-	[0x14b] = "Reserved",
-	[0x14c] = "Reserved",
-	[0x14d] = "Reserved",
-	[0x14e] = "Reserved",
-	[0x14f] = "Reserved",
-	[0x150] = "Balance Right",
-	[0x151] = "Balance Left",
-	[0x152] = "Bass Increment",
-	[0x153] = "Bass Decrement",
-	[0x154] = "Treble Increment",
-	[0x155] = "Treble Decrement",
-	[0x156] = "Reserved",
-	[0x157] = "Reserved",
-	[0x158] = "Reserved",
-	[0x159] = "Reserved",
-	[0x15a] = "Reserved",
-	[0x15b] = "Reserved",
-	[0x15c] = "Reserved",
-	[0x15d] = "Reserved",
-	[0x15e] = "Reserved",
-	[0x15f] = "Reserved",
-	[0x160] = "Speaker System",
-	[0x161] = "Channel Left",
-	[0x162] = "Channel Right",
-	[0x163] = "Channel Center",
-	[0x164] = "Channel Front",
-	[0x165] = "Channel Center Front",
-	[0x166] = "Channel Side",
-	[0x167] = "Channel Surround",
-	[0x168] = "Channel Low Frequency Enhancement",
-	[0x169] = "Channel Top",
-	[0x16a] = "Channel Unknown",
-	[0x16b] = "Reserved",
-	[0x16c] = "Reserved",
-	[0x16d] = "Reserved",
-	[0x16e] = "Reserved",
-	[0x16f] = "Reserved",
-	[0x170] = "Sub-channel",
-	[0x171] = "Sub-channel Increment",
-	[0x172] = "Sub-channel Decrement",
-	[0x173] = "Alternate Audio Increment",
-	[0x174] = "Alternate Audio Decrement",
-	[0x175] = "Reserved",
-	[0x176] = "Reserved",
-	[0x177] = "Reserved",
-	[0x178] = "Reserved",
-	[0x179] = "Reserved",
-	[0x17a] = "Reserved",
-	[0x17b] = "Reserved",
-	[0x17c] = "Reserved",
-	[0x17d] = "Reserved",
-	[0x17e] = "Reserved",
-	[0x17f] = "Reserved",
-	[0x180] = "Application Launch Buttons",
-	[0x181] = "AL Launch Buttion Configuration Tool",
-	[0x182] = "AL Programmable Button Configuration",
-	[0x183] = "AL Consumer Control Configuration",
-	[0x184] = "AL Word Processor",
-	[0x185] = "AL Text Editor",
-	[0x186] = "AL Spreadsheet",
-	[0x187] = "AL Graphics Editor",
-	[0x188] = "AL Presentation App",
-	[0x189] = "AL Database App",
-	[0x18a] = "AL Email Reader",
-	[0x18b] = "AL Newsreader",
-	[0x18c] = "AL Voicemail",
-	[0x18d] = "AL Contacts/Address Book",
-	[0x18e] = "AL Calendar/Schedule",
-	[0x18f] = "AL Task/Project Manager",
-	[0x190] = "AL Log/Journal/Timecard",
-	[0x191] = "AL Checkbook/Finance",
-	[0x192] = "AL Calculator",
-	[0x193] = "AL A/V Capture/Playback",
-	[0x194] = "AL Local Machine Browser",
-	[0x195] = "AL LAN/WAN Browser",
-	[0x196] = "AL Internet Browser",
-	[0x197] = "AL Remote Networking/ISP Connect",
-	[0x198] = "AL Network Conference",
-	[0x199] = "AL Network Chat",
-	[0x19a] = "AL Telephony/Dialer",
-	[0x19b] = "AL Logon",
-	[0x19c] = "AL Logoff",
-	[0x19d] = "AL Logon/Logoff",
-	[0x19e] = "AL Terminal Lock/Screensaver",
-	[0x19f] = "AL Control Panel",
-	[0x1a0] = "AL Command Line Processor/Run",
-	[0x1a1] = "AL Process/Task Manager",
-	[0x1a2] = "AL Select Task/Application",
-	[0x1a3] = "AL Next Task/Application",
-	[0x1a4] = "AL Previous Task/Application",
-	[0x1a5] = "AL Preemptive Halt Task/Application",
-	[0x1a6] = "AL Integrated Help Center",
-	[0x1a7] = "AL Documents",
-	[0x1a8] = "AL Thesaurus",
-	[0x1a9] = "AL Dictionary",
-	[0x1aa] = "AL Desktop",
-	[0x1ab] = "AL Spell Check",
-	[0x1ac] = "AL Grammar Check",
-	[0x1ad] = "AL Wireless Status",
-	[0x1ae] = "AL Keyboard Layout",
-	[0x1af] = "AL Virus Protection",
-	[0x1b0] = "AL Encryption",
-	[0x1b1] = "AL Screen Saver",
-	[0x1b2] = "AL Alarms",
-	[0x1b3] = "AL Clock",
-	[0x1b4] = "AL File Browser",
-	[0x1b5] = "AL Power Status",
-	[0x1b6] = "AL Image Browser",
-	[0x1b7] = "AL Audio Browser",
-	[0x1b8] = "AL Movie Browser",
-	[0x1b9] = "AL Digital Rights Manager",
-	[0x1ba] = "AL Digital Wallet",
-	[0x1bb] = "Reserved",
-	[0x1bc] = "AL Instant Messaging",
-	[0x1bd] = "AL OEM Features Tips/Tutorial Browser",
-	[0x1be] = "AL OEM Help",
-	[0x1bf] = "AL Online Community",
-	[0x1c0] = "AL Entertainment Content Browser",
-	[0x1c1] = "AL Online Shopping Browser",
-	[0x1c2] = "AL SmartCard Information/Help",
-	[0x1c3] = "AL Market Monitor/Finance Browser",
-	[0x1c4] = "AL Customized Corporate News Browser",
-	[0x1c5] = "AL Online Activity Browser",
-	[0x1c6] = "AL Research/Search Browser",
-	[0x1c7] = "AL Audio Player",
-	[0x1c8] = "Reserved",
-	[0x1c9] = "Reserved",
-	[0x1ca] = "Reserved",
-	[0x1cb] = "Reserved",
-	[0x1cc] = "Reserved",
-	[0x1cd] = "Reserved",
-	[0x1ce] = "Reserved",
-	[0x1cf] = "Reserved",
-	[0x1d0] = "Reserved",
-	[0x1d1] = "Reserved",
-	[0x1d2] = "Reserved",
-	[0x1d3] = "Reserved",
-	[0x1d4] = "Reserved",
-	[0x1d5] = "Reserved",
-	[0x1d6] = "Reserved",
-	[0x1d7] = "Reserved",
-	[0x1d8] = "Reserved",
-	[0x1d9] = "Reserved",
-	[0x1da] = "Reserved",
-	[0x1db] = "Reserved",
-	[0x1dc] = "Reserved",
-	[0x1dd] = "Reserved",
-	[0x1de] = "Reserved",
-	[0x1df] = "Reserved",
-	[0x1e0] = "Reserved",
-	[0x1e1] = "Reserved",
-	[0x1e2] = "Reserved",
-	[0x1e3] = "Reserved",
-	[0x1e4] = "Reserved",
-	[0x1e5] = "Reserved",
-	[0x1e6] = "Reserved",
-	[0x1e7] = "Reserved",
-	[0x1e8] = "Reserved",
-	[0x1e9] = "Reserved",
-	[0x1ea] = "Reserved",
-	[0x1eb] = "Reserved",
-	[0x1ec] = "Reserved",
-	[0x1ed] = "Reserved",
-	[0x1ee] = "Reserved",
-	[0x1ef] = "Reserved",
-	[0x1f0] = "Reserved",
-	[0x1f1] = "Reserved",
-	[0x1f2] = "Reserved",
-	[0x1f3] = "Reserved",
-	[0x1f4] = "Reserved",
-	[0x1f5] = "Reserved",
-	[0x1f6] = "Reserved",
-	[0x1f7] = "Reserved",
-	[0x1f8] = "Reserved",
-	[0x1f9] = "Reserved",
-	[0x1fa] = "Reserved",
-	[0x1fb] = "Reserved",
-	[0x1fc] = "Reserved",
-	[0x1fd] = "Reserved",
-	[0x1fe] = "Reserved",
-	[0x1ff] = "Reserved",
-	[0x200] = "Generic GUI Application Controls",
-	[0x201] = "AC New",
-	[0x202] = "AC Open",
-	[0x203] = "AC Close",
-	[0x204] = "AC Exit",
-	[0x205] = "AC Maximize",
-	[0x206] = "AC Minimize",
-	[0x207] = "AC Save",
-	[0x208] = "AC Print",
-	[0x209] = "AC Properties",
-	[0x20a] = "",
-	[0x20b] = "",
-	[0x20c] = "",
-	[0x20d] = "",
-	[0x20e] = "",
-	[0x20f] = "",
-	[0x210] = "",
-	[0x211] = "",
-	[0x212] = "",
-	[0x213] = "",
-	[0x214] = "",
-	[0x215] = "",
-	[0x216] = "",
-	[0x217] = "",
-	[0x218] = "",
-	[0x219] = "",
-	[0x21a] = "AC Undo",
-	[0x21b] = "AC Copy",
-	[0x21c] = "AC Cut",
-	[0x21d] = "AC Paste",
-	[0x21e] = "AC Select All",
-	[0x21f] = "AC Find",
-	[0x220] = "AC Find and Replace",
-	[0x221] = "AC Search",
-	[0x222] = "AC Go To",
-	[0x223] = "AC Home",
-	[0x224] = "AC Back",
-	[0x225] = "AC Forward",
-	[0x226] = "AC Stop",
-	[0x227] = "AC Refresh",
-	[0x228] = "AC Previous Link",
-	[0x229] = "AC Next Link",
-	[0x22a] = "AC Bookmarks",
-	[0x22b] = "AC History",
-	[0x22c] = "AC Subscriptions",
-	[0x22d] = "AC Zoom In",
-	[0x22e] = "AC Zoom Out",
-	[0x22f] = "AC Zoom",
-	[0x230] = "AC Full Screen View",
-	[0x231] = "AC Normal View",
-	[0x232] = "AC View Toggle",
-	[0x233] = "AC Scroll Up",
-	[0x234] = "AC Scroll Down",
-	[0x235] = "AC Scroll",
-	[0x236] = "AC Pan Left",
-	[0x237] = "AC Pan Right",
-	[0x238] = "AC Pan",
-	[0x239] = "AC New Window",
-	[0x23a] = "AC Tile Horizontally",
-	[0x23b] = "AC Tile Vertically",
-	[0x23c] = "AC Format",
-	[0x23d] = "AC Edit",
-	[0x23e] = "AC Bold",
-	[0x23f] = "AC Italics",
-	[0x240] = "AC Undeline",
-	[0x241] = "AC Strikethrough",
-	[0x242] = "AC Subscript",
-	[0x243] = "AC Superscript",
-	[0x244] = "AC All Caps",
-	[0x245] = "AC Rotate",
-	[0x246] = "AC Resize",
-	[0x247] = "AC Flip Horizontal",
-	[0x248] = "AC Flip Vertical",
-	[0x249] = "AC Mirror Horizontal",
-	[0x24a] = "AC Mirror Vertical",
-	[0x24b] = "AC Font Select",
-	[0x24c] = "AC Font Color",
-	[0x24d] = "AC Font Size",
-	[0x24e] = "AC Justify Left",
-	[0x24f] = "AC Justify Center H",
-	[0x250] = "AC Justify Right",
-	[0x251] = "AC Justify Block H",
-	[0x252] = "AC Justify Top",
-	[0x253] = "AC Justify Center V",
-	[0x254] = "AC Justify Bottom",
-	[0x255] = "AC Justify Block V",
-	[0x256] = "AC Indent Decrease",
-	[0x257] = "AC Indent Increase",
-	[0x258] = "AC Numbered List",
-	[0x259] = "AC Restart Numbering",
-	[0x25a] = "AC Bulleted List",
-	[0x25b] = "AC Promote",
-	[0x25c] = "AC Demote",
-	[0x25d] = "AC Yes",
-	[0x25e] = "AC No",
-	[0x25f] = "AC Cancel",
-	[0x260] = "AC Catalog",
-	[0x261] = "AC Buy/Checkout",
-	[0x262] = "AC Add to Cart",
-	[0x263] = "AC Expand",
-	[0x264] = "AC Expand All",
-	[0x265] = "AC Collapse",
-	[0x266] = "AC Collapse All",
-	[0x267] = "AC Print Preview",
-	[0x268] = "AC Paste Special",
-	[0x269] = "AC Insert Mode",
-	[0x26a] = "AC Delete",
-	[0x26b] = "AC Lock",
-	[0x26c] = "AC Unlock",
-	[0x26d] = "AC Protect",
-	[0x26e] = "AC Unprotect",
-	[0x26f] = "AC Attach Comment",
-	[0x270] = "AC Delete Comment",
-	[0x271] = "AC View Comment",
-	[0x272] = "AC Select Word",
-	[0x273] = "AC Select Sentence",
-	[0x274] = "AC Select Paragraph",
-	[0x275] = "AC Select Column",
-	[0x276] = "AC Select Row",
-	[0x277] = "AC Select Table",
-	[0x278] = "AC Select Object",
-	[0x279] = "AC Redo/Repeat",
-	[0x27a] = "AC Sort",
-	[0x27b] = "AC Sort Ascending",
-	[0x27c] = "AC Sort Descending",
-	[0x27d] = "AC Filter",
-	[0x27e] = "AC Set Clock",
-	[0x27f] = "AC View Clock",
-	[0x280] = "AC Select Time Zone",
-	[0x281] = "AC Edit Time Zones",
-	[0x282] = "AC Set Alarm",
-	[0x283] = "AC Clear Alarm",
-	[0x284] = "AC Snooze Alarm",
-	[0x285] = "AC Reset Alarm",
-	[0x286] = "AC Synchronize",
-	[0x287] = "AC Send/Receive",
-	[0x288] = "AC Send To",
-	[0x289] = "AC Reply",
-	[0x28a] = "AC Reply All",
-	[0x28b] = "AC Forward Msg",
-	[0x28c] = "AC Send",
-	[0x28d] = "AC Attach File",
-	[0x28e] = "AC Upload",
-	[0x28f] = "AC Download (Save Target As)",
-	[0x290] = "AC Set Borders",
-	[0x291] = "AC Insert Row",
-	[0x292] = "AC Insert Column",
-	[0x293] = "AC Insert File",
-	[0x294] = "AC Insert Picture",
-	[0x295] = "AC Insert Object",
-	[0x296] = "AC Insert Symbol",
-	[0x297] = "AC Save and Close",
-	[0x298] = "AC Rename",
-	[0x299] = "AC Merge",
-	[0x29a] = "AC Split",
-	[0x29b] = "AC Distrubute Horizontally",
-	[0x29c] = "AC Distrubute Vertically"
-};
-
-/**
- * Translates USB HID Usages from the Consumer Page into their string
- * representation.
- *
- * @param usage USB HID Consumer Page Usage number.
- *
- * @retval HelenOS key code corresponding to the given USB Consumer Page Usage.
- */
-const char *usbhid_multimedia_usage_to_str(unsigned usage)
-{
-	static const size_t map_length =
-	    sizeof(usbhid_consumer_usage_str) / sizeof(char *);
-
-	if (usage >= map_length)
-		return "Unknown usage";
-
-	return usbhid_consumer_usage_str[usage];
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/src/hiddescriptor.c
===================================================================
--- uspace/lib/usbhid/src/hiddescriptor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,975 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * HID report descriptor and report data parser implementation.
- */
-#include <usb/hid/hidparser.h>
-#include <errno.h>
-#include <stdio.h>
-#include <mem.h>
-#include <usb/debug.h>
-#include <assert.h>
-#include <stdlib.h>
-
-/*
- * Constants defining current parsing mode for correct parsing of the set of
- * local tags (usage) enclosed in delimter tags.
- */
-/**
- * Second delimiter tag was read. The set of local items (usage) ended.
- */
-#define OUTSIDE_DELIMITER_SET	0
-
-/**
- * First delimiter tag was read. The set of local items (usage) started.
- */
-#define START_DELIMITER_SET	1
-
-/**
- * Parser is in the set of local items.
- */
-#define INSIDE_DELIMITER_SET	2
-
-/** The new report item flag. Used to determine when the item is completly
- * configured and should be added to the report structure
- */
-#define USB_HID_NEW_REPORT_ITEM 1
-
-/** No special action after the report descriptor tag is processed should be
- * done
- */
-#define USB_HID_NO_ACTION	2
-
-#define USB_HID_RESET_OFFSET	3
-
-#define USB_HID_INVALID                 -98
-/** Unknown tag was founded in report descriptor data */
-#define USB_HID_UNKNOWN_TAG		-99
-
-/**
- * Checks if given collection path is already present in report structure and
- * inserts it if not.
- *
- * @param report Report structure
- * @param cmp_path The collection path
- * @return Pointer to the result collection path in report structure.
- * @retval NULL If some error occurs
- */
-usb_hid_report_path_t *usb_hid_report_path_try_insert(usb_hid_report_t *report,
-    usb_hid_report_path_t *cmp_path)
-{
-	link_t *path_it = report->collection_paths.head.next;
-	usb_hid_report_path_t *path = NULL;
-
-	if ((report == NULL) || (cmp_path == NULL)) {
-		return NULL;
-	}
-
-	while (path_it != &report->collection_paths.head) {
-		path = list_get_instance(path_it, usb_hid_report_path_t,
-		    cpath_link);
-
-		if (usb_hid_report_compare_usage_path(path, cmp_path,
-		    USB_HID_PATH_COMPARE_STRICT) == 0) {
-			break;
-		}
-		path_it = path_it->next;
-	}
-	if (path_it == &report->collection_paths.head) {
-		path = usb_hid_report_path_clone(cmp_path);
-		if (path == NULL) {
-			return NULL;
-		}
-		list_append(&path->cpath_link, &report->collection_paths);
-		report->collection_paths_count++;
-
-		return path;
-	} else {
-		return list_get_instance(path_it, usb_hid_report_path_t,
-		    cpath_link);
-	}
-}
-
-/**
- * Initialize the report descriptor parser structure
- *
- * @param parser Report descriptor parser structure
- * @return Error code
- * @retval EINVAL If no report structure was given
- * @retval EOK If report structure was successfully initialized
- */
-errno_t usb_hid_report_init(usb_hid_report_t *report)
-{
-	if (report == NULL) {
-		return EINVAL;
-	}
-
-	memset(report, 0, sizeof(usb_hid_report_t));
-	list_initialize(&report->reports);
-	list_initialize(&report->collection_paths);
-
-	report->use_report_ids = 0;
-	return EOK;
-}
-
-/**
- *
- *
- * @param report Report structure in which the new report items should be
- * 		 stored
- * @param report_item Current report descriptor's parsing state table
- * @return Error code
- * @retval EOK If all fields were successfully append to report
- * @retval EINVAL If invalid parameters (NULL) was given
- * @retval ENOMEM If there is no memmory to store new report description
- *
- */
-errno_t usb_hid_report_append_fields(usb_hid_report_t *report,
-    usb_hid_report_item_t *report_item)
-{
-
-	usb_hid_report_field_t *field;
-	int i;
-
-	uint32_t *usages;
-	int usages_used = 0;
-
-	if ((report == NULL) || (report_item == NULL)) {
-		return EINVAL;
-	}
-
-	if (report_item->usages_count > 0) {
-		usages = malloc(sizeof(uint32_t) * report_item->usages_count);
-		memcpy(usages, report_item->usages, sizeof(int32_t) *
-		    report_item->usages_count);
-	} else {
-		usages = NULL;
-	}
-
-	usb_hid_report_path_t *path = report_item->usage_path;
-	for (i = 0; i < report_item->count; i++) {
-
-		field = malloc(sizeof(usb_hid_report_field_t));
-		if (field == NULL) {
-			return ENOMEM;
-		}
-
-		memset(field, 0, sizeof(usb_hid_report_field_t));
-		link_initialize(&field->ritems_link);
-
-		/* fill the attributes */
-		field->logical_minimum = report_item->logical_minimum;
-		field->logical_maximum = report_item->logical_maximum;
-		field->physical_minimum = report_item->physical_minimum;
-		field->physical_maximum = report_item->physical_maximum;
-
-		if (USB_HID_ITEM_FLAG_VARIABLE(report_item->item_flags) == 0) {
-			/*
-			 * Store usage array. The Correct Usage Page and Usage is
-			 * depending on data in report and will be filled later
-			 */
-			field->usage = 0;
-			field->usage_page = 0; //report_item->usage_page;
-
-			field->usages_count = report_item->usages_count;
-			field->usages = usages;
-			usages_used = 1;
-		} else {
-
-			/* Fill the correct Usage and Usage Page */
-			int32_t usage;
-			if (i < report_item->usages_count) {
-				usage = report_item->usages[i];
-			} else {
-				usage = report_item->usages[report_item->usages_count - 1];
-			}
-
-			if (USB_HID_IS_EXTENDED_USAGE(usage)) {
-				field->usage = USB_HID_EXTENDED_USAGE(usage);
-				field->usage_page =
-				    USB_HID_EXTENDED_USAGE_PAGE(usage);
-			} else {
-				// should not occur
-				field->usage = usage;
-				field->usage_page = report_item->usage_page;
-			}
-		}
-
-		usb_hid_report_set_last_item(path, USB_HID_TAG_CLASS_GLOBAL,
-		    field->usage_page);
-		usb_hid_report_set_last_item(path, USB_HID_TAG_CLASS_LOCAL,
-		    field->usage);
-
-		field->collection_path =
-		    usb_hid_report_path_try_insert(report, path);
-
-		field->size = report_item->size;
-
-		field->offset = report_item->offset + (i * report_item->size);
-
-		if (report->use_report_ids != 0) {
-			field->offset += 8;
-			report->use_report_ids = 1;
-		}
-
-		field->item_flags = report_item->item_flags;
-
-		/* find the right report list */
-		usb_hid_report_description_t *report_des;
-		report_des = usb_hid_report_find_description(report,
-		    report_item->id, report_item->type);
-
-		if (report_des == NULL) {
-			report_des = malloc(
-			    sizeof(usb_hid_report_description_t));
-			if (report_des == NULL) {
-				return ENOMEM;
-			}
-
-			memset(report_des, 0,
-			    sizeof(usb_hid_report_description_t));
-
-			report_des->type = report_item->type;
-			report_des->report_id = report_item->id;
-			if (report_des->report_id != 0) {
-				/* set up the bit length by report_id field */
-				report_des->bit_length = 8;
-			}
-
-			link_initialize (&report_des->reports_link);
-			list_initialize (&report_des->report_items);
-
-			list_append(&report_des->reports_link, &report->reports);
-			report->report_count++;
-		}
-
-		/* append this field to the end of founded report list */
-		list_append(&field->ritems_link, &report_des->report_items);
-
-		/* update the sizes */
-		report_des->bit_length += field->size;
-		report_des->item_length++;
-
-	}
-
-	// free only when not used!!!
-	if (usages && usages_used == 0) {
-		free(usages);
-	}
-
-	return EOK;
-}
-
-/**
- * Finds description of report with given report_id and of given type in
- * opaque report structure.
- *
- * @param report Opaque structure containing the parsed report descriptor
- * @param report_id ReportId of report we are searching
- * @param type Type of report we are searching
- * @return Pointer to the particular report description
- * @retval NULL If no description is founded
- */
-usb_hid_report_description_t *usb_hid_report_find_description(
-    const usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type)
-{
-
-	if (report == NULL) {
-		return NULL;
-	}
-
-	list_foreach(report->reports, reports_link,
-	    usb_hid_report_description_t, report_des) {
-		// if report id not set, return the first of the type
-		if (((report_des->report_id == report_id) || (report_id == 0)) &&
-		    (report_des->type == type)) {
-			return report_des;
-		}
-	}
-
-	return NULL;
-}
-
-/** Parse HID report descriptor.
- *
- * @param parser Opaque HID report parser structure.
- * @param data Data describing the report.
- * @return Error code.
- * @retval ENOMEM If no more memmory is available
- * @retval EINVAL If invalid data are founded
- * @retval EOK If report descriptor is successfully parsed
- */
-errno_t usb_hid_parse_report_descriptor(usb_hid_report_t *report,
-    const uint8_t *data, size_t size)
-{
-	size_t i = 0;
-	uint8_t tag = 0;
-	uint8_t item_size = 0;
-	int class = 0;
-	int ret;
-	usb_hid_report_item_t *report_item = 0;
-	usb_hid_report_item_t *new_report_item;
-	usb_hid_report_path_t *usage_path;
-
-	size_t offset_input = 0;
-	size_t offset_output = 0;
-	size_t offset_feature = 0;
-
-	link_t *item_link;
-
-	list_t stack;
-	list_initialize(&stack);
-
-	/* parser structure initialization */
-	if (usb_hid_report_init(report) != EOK) {
-		return EINVAL;
-	}
-
-	/* report item initialization */
-	if (!(report_item = malloc(sizeof(usb_hid_report_item_t)))) {
-		return ENOMEM;
-	}
-	memset(report_item, 0, sizeof(usb_hid_report_item_t));
-	link_initialize(&(report_item->link));
-
-	/* usage path context initialization */
-	if (!(usage_path = usb_hid_report_path())) {
-		free(report_item);
-		return ENOMEM;
-	}
-	usb_hid_report_path_append_item(usage_path, 0, 0);
-
-	while (i < size) {
-		if (!USB_HID_ITEM_IS_LONG(data[i])) {
-
-			if ((i + USB_HID_ITEM_SIZE(data[i])) >= size) {
-				return EINVAL;
-			}
-
-			tag = USB_HID_ITEM_TAG(data[i]);
-			item_size = USB_HID_ITEM_SIZE(data[i]);
-			class = USB_HID_ITEM_TAG_CLASS(data[i]);
-
-			ret = usb_hid_report_parse_tag(tag, class, data + i + 1,
-			    item_size, report_item, usage_path);
-
-			switch (ret) {
-			case USB_HID_NEW_REPORT_ITEM:
-				/*
-				 * store report item to report and create the
-				 * new one store current collection path
-				 */
-				report_item->usage_path = usage_path;
-
-				usb_hid_report_path_set_report_id(
-				    report_item->usage_path, report_item->id);
-
-				if (report_item->id != 0) {
-					report->use_report_ids = 1;
-				}
-
-				switch (tag) {
-				case USB_HID_REPORT_TAG_INPUT:
-					report_item->type =
-					    USB_HID_REPORT_TYPE_INPUT;
-
-					report_item->offset = offset_input;
-					offset_input += report_item->count *
-					    report_item->size;
-					break;
-
-				case USB_HID_REPORT_TAG_OUTPUT:
-					report_item->type =
-					    USB_HID_REPORT_TYPE_OUTPUT;
-
-					report_item->offset = offset_output;
-					offset_output += report_item->count *
-					    report_item->size;
-					break;
-
-				case USB_HID_REPORT_TAG_FEATURE:
-					report_item->type =
-					    USB_HID_REPORT_TYPE_FEATURE;
-
-					report_item->offset = offset_feature;
-					offset_feature += report_item->count *
-					    report_item->size;
-					break;
-
-				default:
-					usb_log_debug2(
-					    "\tjump over - tag %X\n", tag);
-					break;
-				}
-
-				/*
-				 * append new fields to the report structure
-				 */
-				usb_hid_report_append_fields(report,
-				    report_item);
-
-				/* reset local items */
-				usb_hid_report_reset_local_items (report_item);
-				break;
-
-			case USB_HID_RESET_OFFSET:
-				offset_input = 0;
-				offset_output = 0;
-				offset_feature = 0;
-				usb_hid_report_path_set_report_id (usage_path,
-				    report_item->id);
-				break;
-
-			case USB_HID_REPORT_TAG_PUSH:
-				// push current state to stack
-				new_report_item = usb_hid_report_item_clone(
-				    report_item);
-
-				usb_hid_report_path_t *tmp_path =
-				    usb_hid_report_path_clone(usage_path);
-
-				new_report_item->usage_path = tmp_path;
-
-				list_prepend (&new_report_item->link, &stack);
-				break;
-			case USB_HID_REPORT_TAG_POP:
-				// restore current state from stack
-				item_link = list_first(&stack);
-				if (item_link == NULL) {
-					return EINVAL;
-				}
-				free(report_item);
-
-				report_item = list_get_instance(item_link,
-				    usb_hid_report_item_t, link);
-
-				usb_hid_report_usage_path_t *tmp_usage_path;
-				tmp_usage_path = list_get_instance(
-				    report_item->usage_path->cpath_link.prev,
-				    usb_hid_report_usage_path_t, rpath_items_link);
-
-				usb_hid_report_set_last_item(usage_path,
-				    USB_HID_TAG_CLASS_GLOBAL, tmp_usage_path->usage_page);
-
-				usb_hid_report_set_last_item(usage_path,
-				    USB_HID_TAG_CLASS_LOCAL, tmp_usage_path->usage);
-
-				usb_hid_report_path_free(report_item->usage_path);
-				list_remove (item_link);
-
-				break;
-
-			default:
-				// nothing special to do
-				break;
-			}
-
-			/* jump over the processed block */
-			i += 1 + USB_HID_ITEM_SIZE(data[i]);
-		} else {
-			// TBD
-			i += 3 + USB_HID_ITEM_SIZE(data[i + 1]);
-		}
-
-	}
-
-	return EOK;
-}
-
-/**
- * Parse one tag of the report descriptor
- *
- * @param Tag to parse
- * @param Report descriptor buffer
- * @param Size of data belongs to this tag
- * @param Current report item structe
- * @return Code of action to be done next
- */
-int usb_hid_report_parse_tag(uint8_t tag, uint8_t class, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path)
-{
-
-	int ret;
-
-	switch (class) {
-	case USB_HID_TAG_CLASS_MAIN:
-
-		if ((ret = usb_hid_report_parse_main_tag(tag, data, item_size,
-		    report_item, usage_path)) == 0) {
-
-			return USB_HID_NEW_REPORT_ITEM;
-		} else {
-			return ret;
-		}
-		break;
-
-	case USB_HID_TAG_CLASS_GLOBAL:
-		return usb_hid_report_parse_global_tag(tag, data, item_size,
-		    report_item, usage_path);
-		break;
-
-	case USB_HID_TAG_CLASS_LOCAL:
-		return usb_hid_report_parse_local_tag(tag, data, item_size,
-		    report_item, usage_path);
-		break;
-
-	default:
-		return USB_HID_NO_ACTION;
-	}
-}
-
-/**
- * Parse main tags of report descriptor
- *
- * @param Tag identifier
- * @param Data buffer
- * @param Length of data buffer
- * @param Current state table
- * @return 0 or USB_HID_ code
- */
-
-int usb_hid_report_parse_main_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path)
-{
-	usb_hid_report_usage_path_t *path_item;
-
-	switch (tag) {
-	case USB_HID_REPORT_TAG_INPUT:
-	case USB_HID_REPORT_TAG_OUTPUT:
-	case USB_HID_REPORT_TAG_FEATURE:
-		report_item->item_flags = *data;
-		return 0;
-		break;
-
-	case USB_HID_REPORT_TAG_COLLECTION:
-
-		/* store collection atributes */
-		path_item = list_get_instance(list_first(&usage_path->items),
-		    usb_hid_report_usage_path_t, rpath_items_link);
-		path_item->flags = *data;
-
-		/* set last item */
-		usb_hid_report_set_last_item(usage_path,
-		    USB_HID_TAG_CLASS_GLOBAL,
-		    USB_HID_EXTENDED_USAGE_PAGE(report_item->usages[report_item->usages_count - 1]));
-
-		usb_hid_report_set_last_item(usage_path,
-		    USB_HID_TAG_CLASS_LOCAL,
-		    USB_HID_EXTENDED_USAGE(report_item->usages[report_item->usages_count - 1]));
-
-		/*
-		 * append the new one which will be set by common usage/usage
-		 * page
-		 */
-		usb_hid_report_path_append_item(usage_path,
-		    report_item->usage_page,
-		    report_item->usages[report_item->usages_count - 1]);
-
-		usb_hid_report_reset_local_items (report_item);
-		return USB_HID_NO_ACTION;
-		break;
-
-	case USB_HID_REPORT_TAG_END_COLLECTION:
-		usb_hid_report_remove_last_item(usage_path);
-		return USB_HID_NO_ACTION;
-		break;
-
-	default:
-		return USB_HID_NO_ACTION;
-	}
-
-	return 0;
-}
-
-/**
- * Parse global tags of report descriptor
- *
- * @param Tag identifier
- * @param Data buffer
- * @param Length of data buffer
- * @param Current state table
- * @return 0 or USB_HID_ code
- */
-int usb_hid_report_parse_global_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path)
-{
-
-	switch (tag) {
-	case USB_HID_REPORT_TAG_USAGE_PAGE:
-		report_item->usage_page =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_LOGICAL_MINIMUM:
-		report_item->logical_minimum = USB_HID_UINT32_TO_INT32(
-		    usb_hid_report_tag_data_uint32(data, item_size),
-		    item_size * 8);
-		break;
-
-	case USB_HID_REPORT_TAG_LOGICAL_MAXIMUM:
-		report_item->logical_maximum = USB_HID_UINT32_TO_INT32(
-		    usb_hid_report_tag_data_uint32(data, item_size),
-		    item_size * 8);
-		break;
-
-	case USB_HID_REPORT_TAG_PHYSICAL_MINIMUM:
-		report_item->physical_minimum = USB_HID_UINT32_TO_INT32(
-		    usb_hid_report_tag_data_uint32(data, item_size),
-		    item_size * 8);
-		break;
-
-	case USB_HID_REPORT_TAG_PHYSICAL_MAXIMUM:
-		report_item->physical_maximum = USB_HID_UINT32_TO_INT32(
-		    usb_hid_report_tag_data_uint32(data, item_size),
-		    item_size * 8);
-		break;
-
-	case USB_HID_REPORT_TAG_UNIT_EXPONENT:
-		report_item->unit_exponent = usb_hid_report_tag_data_uint32(
-		    data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_UNIT:
-		report_item->unit = usb_hid_report_tag_data_uint32(
-		    data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_REPORT_SIZE:
-		report_item->size = usb_hid_report_tag_data_uint32(
-		    data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_REPORT_COUNT:
-		report_item->count = usb_hid_report_tag_data_uint32(
-		    data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_REPORT_ID:
-		report_item->id = usb_hid_report_tag_data_uint32(data,
-		    item_size);
-		return USB_HID_RESET_OFFSET;
-		break;
-
-	case USB_HID_REPORT_TAG_PUSH:
-	case USB_HID_REPORT_TAG_POP:
-		/*
-		 * stack operations are done in top level parsing
-		 * function
-		 */
-		return tag;
-		break;
-
-	default:
-		return USB_HID_NO_ACTION;
-	}
-
-	return 0;
-}
-
-/**
- * Parse local tags of report descriptor
- *
- * @param Tag identifier
- * @param Data buffer
- * @param Length of data buffer
- * @param Current state table
- * @return 0 or USB_HID_ code
- */
-int usb_hid_report_parse_local_tag(uint8_t tag, const uint8_t *data,
-    size_t item_size, usb_hid_report_item_t *report_item,
-    usb_hid_report_path_t *usage_path)
-{
-	int32_t extended_usage;
-
-	switch (tag) {
-	case USB_HID_REPORT_TAG_USAGE:
-		switch (report_item->in_delimiter) {
-		case INSIDE_DELIMITER_SET:
-			/*
-			 * Nothing to do.
-			 * We catch only the first one
-			 */
-			break;
-
-		case START_DELIMITER_SET:
-			report_item->in_delimiter = INSIDE_DELIMITER_SET;
-			/* Fallthrough */
-		case OUTSIDE_DELIMITER_SET:
-			extended_usage = ((report_item->usage_page) << 16);
-			extended_usage +=
-			    usb_hid_report_tag_data_uint32(data, item_size);
-
-			report_item->usages[report_item->usages_count] =
-			    extended_usage;
-
-			report_item->usages_count++;
-			break;
-		}
-		break;
-
-	case USB_HID_REPORT_TAG_USAGE_MINIMUM:
-		if (item_size == 3) {
-			/* Usage extended usages */
-			report_item->extended_usage_page =
-			    USB_HID_EXTENDED_USAGE_PAGE(
-			    usb_hid_report_tag_data_uint32(data, item_size));
-
-			report_item->usage_minimum =
-			    USB_HID_EXTENDED_USAGE(
-			    usb_hid_report_tag_data_uint32(data, item_size));
-		} else {
-			report_item->usage_minimum =
-			    usb_hid_report_tag_data_uint32(data, item_size);
-		}
-		break;
-
-	case USB_HID_REPORT_TAG_USAGE_MAXIMUM:
-		if (item_size == 3) {
-			if (report_item->extended_usage_page !=
-			    USB_HID_EXTENDED_USAGE_PAGE(
-			    usb_hid_report_tag_data_uint32(data, item_size))) {
-				return USB_HID_INVALID;
-			}
-
-			/* Usage extended usages */
-			report_item->extended_usage_page =
-			    USB_HID_EXTENDED_USAGE_PAGE(
-			    usb_hid_report_tag_data_uint32(data, item_size));
-
-			report_item->usage_maximum =
-			    USB_HID_EXTENDED_USAGE(
-			    usb_hid_report_tag_data_uint32(data, item_size));
-		} else {
-			report_item->usage_maximum =
-			    usb_hid_report_tag_data_uint32(data, item_size);
-		}
-
-		/* Put the records into the usages array */
-		for (int32_t i = report_item->usage_minimum;
-		    i <= report_item->usage_maximum; i++) {
-
-			if (report_item->extended_usage_page) {
-				report_item->usages[report_item->usages_count++] =
-				    (report_item->extended_usage_page << 16) + i;
-			} else {
-				report_item->usages[report_item->usages_count++] =
-				    (report_item->usage_page << 16) + i;
-			}
-		}
-		report_item->extended_usage_page = 0;
-
-		break;
-
-	case USB_HID_REPORT_TAG_DESIGNATOR_INDEX:
-		report_item->designator_index =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_DESIGNATOR_MINIMUM:
-		report_item->designator_minimum =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_DESIGNATOR_MAXIMUM:
-		report_item->designator_maximum =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_STRING_INDEX:
-		report_item->string_index =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_STRING_MINIMUM:
-		report_item->string_minimum =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_STRING_MAXIMUM:
-		report_item->string_maximum =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	case USB_HID_REPORT_TAG_DELIMITER:
-		report_item->in_delimiter =
-		    usb_hid_report_tag_data_uint32(data, item_size);
-		break;
-
-	default:
-		return USB_HID_NO_ACTION;
-	}
-
-	return 0;
-}
-
-/**
- * Converts raw data to uint32 (thats the maximum length of short item data)
- *
- * @param Data buffer
- * @param Size of buffer
- * @return Converted int32 number
- */
-uint32_t usb_hid_report_tag_data_uint32(const uint8_t *data, size_t size)
-{
-	unsigned int i;
-	uint32_t result;
-
-	result = 0;
-	for (i = 0; i < size; i++) {
-		result = (result | (data[i]) << (i * 8));
-	}
-
-	return result;
-}
-
-/**
- * Prints content of given list of report items.
- *
- * @param List of report items (usb_hid_report_item_t)
- * @return void
- */
-void usb_hid_descriptor_print_list(list_t *list)
-{
-	if (list == NULL || list_empty(list)) {
-		usb_log_debug("\tempty");
-		return;
-	}
-
-	list_foreach(*list, ritems_link, usb_hid_report_field_t,
-	    report_item) {
-		usb_log_debug("\t\tOFFSET: %u", report_item->offset);
-		usb_log_debug("\t\tSIZE: %zu", report_item->size);
-		usb_log_debug("\t\tLOGMIN: %d",
-		    report_item->logical_minimum);
-		usb_log_debug("\t\tLOGMAX: %d",
-		    report_item->logical_maximum);
-		usb_log_debug("\t\tPHYMIN: %d",
-		    report_item->physical_minimum);
-		usb_log_debug("\t\tPHYMAX: %d",
-		    report_item->physical_maximum);
-		usb_log_debug("\t\ttUSAGEMIN: %X",
-		    report_item->usage_minimum);
-		usb_log_debug("\t\tUSAGEMAX: %X",
-		    report_item->usage_maximum);
-		usb_log_debug("\t\tUSAGES COUNT: %zu",
-		    report_item->usages_count);
-
-		usb_log_debug("\t\tVALUE: %X", report_item->value);
-		usb_log_debug("\t\ttUSAGE: %X", report_item->usage);
-		usb_log_debug("\t\tUSAGE PAGE: %X", report_item->usage_page);
-
-		usb_hid_print_usage_path(report_item->collection_path);
-	}
-}
-
-/**
- * Prints content of given report descriptor in human readable format.
- *
- * @param parser Parsed descriptor to print
- * @return void
- */
-void usb_hid_descriptor_print(usb_hid_report_t *report)
-{
-	if (report == NULL)
-		return;
-
-	list_foreach(report->reports, reports_link,
-	    usb_hid_report_description_t, report_des) {
-		usb_log_debug("Report ID: %d", report_des->report_id);
-		usb_log_debug("\tType: %d", report_des->type);
-		usb_log_debug("\tLength: %zu", report_des->bit_length);
-		usb_log_debug("\tB Size: %zu",
-		    usb_hid_report_byte_size(report,
-		    report_des->report_id,
-		    report_des->type));
-		usb_log_debug("\tItems: %zu", report_des->item_length);
-
-		usb_hid_descriptor_print_list(&report_des->report_items);
-	}
-}
-
-/** Frees the HID report descriptor parser structure
- *
- * @param parser Opaque HID report parser structure
- * @return void
- */
-void usb_hid_report_deinit(usb_hid_report_t *report)
-{
-	if (report == NULL) {
-		return;
-	}
-
-	// free collection paths
-	link_t *path_link;
-	usb_hid_report_path_t *path;
-	while (!list_empty(&report->collection_paths)) {
-		path_link = list_first(&report->collection_paths);
-		path = list_get_instance(path_link,
-		    usb_hid_report_path_t, cpath_link);
-
-		list_remove(path_link);
-		usb_hid_report_path_free(path);
-	}
-
-	// free report items
-	usb_hid_report_description_t *report_des;
-	usb_hid_report_field_t *field;
-	while (!list_empty(&report->reports)) {
-		report_des = list_get_instance(list_first(&report->reports),
-		    usb_hid_report_description_t, reports_link);
-
-		list_remove(&report_des->reports_link);
-
-		while (!list_empty(&report_des->report_items)) {
-			field = list_get_instance(
-			    list_first(&report_des->report_items),
-			    usb_hid_report_field_t, ritems_link);
-
-			list_remove(&field->ritems_link);
-
-			free(field);
-		}
-
-		free(report_des);
-	}
-
-	return;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/src/hidparser.c
===================================================================
--- uspace/lib/usbhid/src/hidparser.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,599 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * USB HID report data parser implementation.
- */
-#include <usb/hid/hidparser.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <mem.h>
-#include <usb/debug.h>
-#include <assert.h>
-#include <bitops.h>
-#include <macros.h>
-
-/*
- * Data translation private functions
- */
-uint32_t usb_hid_report_tag_data_uint32(const uint8_t *data, size_t size);
-
-int usb_hid_translate_data(usb_hid_report_field_t *item, const uint8_t *data);
-
-uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item,
-    int32_t value);
-
-static int usb_pow(int a, int b)
-{
-	switch (b) {
-	case 0:
-		return 1;
-		break;
-	case 1:
-		return a;
-		break;
-	default:
-		return a * usb_pow(a, b - 1);
-		break;
-	}
-}
-
-/** Returns size of report of specified report id and type in items
- *
- * @param parser Opaque report parser structure
- * @param report_id
- * @param type
- * @return Number of items in specified report
- */
-size_t usb_hid_report_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type)
-{
-	usb_hid_report_description_t *report_des;
-
-	if (report == NULL) {
-		return 0;
-	}
-
-	report_des = usb_hid_report_find_description(report, report_id, type);
-	if (report_des == NULL) {
-		return 0;
-	} else {
-		return report_des->item_length;
-	}
-}
-
-/** Returns size of report of specified report id and type in bytes
- *
- * @param parser Opaque report parser structure
- * @param report_id
- * @param type
- * @return Number of items in specified report
- */
-size_t usb_hid_report_byte_size(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type)
-{
-	usb_hid_report_description_t *report_des;
-
-	if (report == NULL) {
-		return 0;
-	}
-
-	report_des = usb_hid_report_find_description(report, report_id, type);
-	if (report_des == NULL) {
-		return 0;
-	} else {
-		return ((report_des->bit_length + 7) / 8);
-	}
-}
-
-/** Parse and act upon a HID report.
- *
- * @see usb_hid_parse_report_descriptor
- *
- * @param parser Opaque HID report parser structure.
- * @param data Data for the report.
- * @return Error code.
- */
-errno_t usb_hid_parse_report(const usb_hid_report_t *report, const uint8_t *data,
-    size_t size, uint8_t *report_id)
-{
-	usb_hid_report_description_t *report_des;
-	usb_hid_report_type_t type = USB_HID_REPORT_TYPE_INPUT;
-
-	if (report == NULL) {
-		return EINVAL;
-	}
-
-	if (report->use_report_ids != 0) {
-		*report_id = data[0];
-	} else {
-		*report_id = 0;
-	}
-
-	report_des = usb_hid_report_find_description(report, *report_id,
-	    type);
-
-	if (report_des == NULL) {
-		return EINVAL;
-	}
-
-	/* read data */
-	list_foreach(report_des->report_items, ritems_link,
-	    usb_hid_report_field_t, item) {
-
-		if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags) == 0) {
-
-			if (USB_HID_ITEM_FLAG_VARIABLE(item->item_flags) == 0) {
-				/* array */
-				item->value =
-				    usb_hid_translate_data(item, data);
-
-				item->usage = USB_HID_EXTENDED_USAGE(
-				    item->usages[item->value -
-				    item->physical_minimum]);
-
-				item->usage_page =
-				    USB_HID_EXTENDED_USAGE_PAGE(
-				    item->usages[item->value -
-				    item->physical_minimum]);
-
-				usb_hid_report_set_last_item(
-				    item->collection_path,
-				    USB_HID_TAG_CLASS_GLOBAL,
-				    item->usage_page);
-
-				usb_hid_report_set_last_item(
-				    item->collection_path,
-				    USB_HID_TAG_CLASS_LOCAL, item->usage);
-			} else {
-				/* variable item */
-				item->value = usb_hid_translate_data(item,
-				    data);
-			}
-		}
-	}
-
-	return EOK;
-}
-
-/**
- * Translate data from the report as specified in report descriptor item
- *
- * @param item Report descriptor item with definition of translation
- * @param data Data to translate
- * @return Translated data
- */
-int usb_hid_translate_data(usb_hid_report_field_t *item, const uint8_t *data)
-{
-	/* now only short tags are allowed */
-	if (item->size > 32) {
-		return 0;
-	}
-
-	if ((item->physical_minimum == 0) && (item->physical_maximum == 0)) {
-		item->physical_minimum = item->logical_minimum;
-		item->physical_maximum = item->logical_maximum;
-	}
-
-	int resolution;
-	if (item->physical_maximum == item->physical_minimum) {
-		resolution = 1;
-	} else {
-		resolution = (item->logical_maximum - item->logical_minimum) /
-		    ((item->physical_maximum - item->physical_minimum) *
-		    (usb_pow(10, (item->unit_exponent))));
-	}
-
-	int32_t value = 0;
-
-	/* First, skip all bytes we don't care */
-	data += item->offset / 8;
-
-	int bits = item->size;
-	int taken = 0;
-
-	/* Than we take the higher bits from the LSB */
-	const unsigned bit_offset = item->offset % 8;
-	const int lsb_bits = min((unsigned)bits, 8 - bit_offset);
-
-	value |= (*data >> bit_offset) & BIT_RRANGE(uint8_t, lsb_bits);
-	bits -= lsb_bits;
-	taken += lsb_bits;
-	data++;
-
-	/* Then there may be bytes, which we take as a whole. */
-	while (bits > 8) {
-		value |= *data << taken;
-		taken += 8;
-		bits -= 8;
-		data++;
-	}
-
-	/* And, finally, lower bits from HSB. */
-	if (bits > 0) {
-		value |= (*data & BIT_RRANGE(uint8_t, bits)) << taken;
-	}
-
-	if ((item->logical_minimum < 0) || (item->logical_maximum < 0)) {
-		value = USB_HID_UINT32_TO_INT32(value, item->size);
-	}
-
-	return (int) (((value - item->logical_minimum) / resolution) +
-	    item->physical_minimum);
-}
-
-/* OUTPUT API */
-
-/**
- * Allocates output report buffer for output report
- *
- * @param parser Report parsed structure
- * @param size Size of returned buffer
- * @param report_id Report id of created output report
- * @return Returns allocated output buffer for specified output
- */
-uint8_t *usb_hid_report_output(usb_hid_report_t *report, size_t *size,
-    uint8_t report_id)
-{
-	if (report == NULL) {
-		*size = 0;
-		return NULL;
-	}
-
-	usb_hid_report_description_t *report_des = NULL;
-
-	list_foreach(report->reports, reports_link,
-	    usb_hid_report_description_t, rdes) {
-		if ((rdes->report_id == report_id) &&
-		    (rdes->type == USB_HID_REPORT_TYPE_OUTPUT)) {
-			report_des = rdes;
-			break;
-		}
-	}
-
-	if (report_des == NULL) {
-		*size = 0;
-		return NULL;
-	} else {
-		*size = (report_des->bit_length + (8 - 1)) / 8;
-		uint8_t *ret = malloc((*size) * sizeof(uint8_t));
-		memset(ret, 0, (*size) * sizeof(uint8_t));
-		return ret;
-	}
-}
-
-/** Frees output report buffer
- *
- * @param output Output report buffer
- * @return void
- */
-void usb_hid_report_output_free(uint8_t *output)
-{
-	if (output != NULL) {
-		free(output);
-	}
-}
-
-/** Makes the output report buffer for data given in the report structure
- *
- * @param parser Opaque report parser structure
- * @param path Usage path specifing which parts of output will be set
- * @param flags Usage path structure comparison flags
- * @param buffer Output buffer
- * @param size Size of output buffer
- * @return Error code
- */
-errno_t usb_hid_report_output_translate(usb_hid_report_t *report,
-    uint8_t report_id, uint8_t *buffer, size_t size)
-{
-	int32_t value = 0;
-	int offset;
-	int length;
-	int32_t tmp_value;
-
-	if (report == NULL) {
-		return EINVAL;
-	}
-
-	if (report->use_report_ids != 0) {
-		buffer[0] = report_id;
-	}
-
-	usb_hid_report_description_t *report_des;
-	report_des = usb_hid_report_find_description(report, report_id,
-	    USB_HID_REPORT_TYPE_OUTPUT);
-
-	if (report_des == NULL) {
-		return EINVAL;
-	}
-
-	list_foreach(report_des->report_items, ritems_link,
-	    usb_hid_report_field_t, report_item) {
-		value = usb_hid_translate_data_reverse(report_item,
-		    report_item->value);
-
-		offset = report_des->bit_length - report_item->offset - 1;
-		length = report_item->size;
-
-		usb_log_debug("\ttranslated value: %x", value);
-
-		if ((offset / 8) == ((offset + length - 1) / 8)) {
-			if (((size_t) (offset / 8) >= size) ||
-			    ((size_t) (offset + length - 1) / 8) >= size) {
-				break; // TODO ErrorCode
-			}
-			size_t shift = 8 - offset % 8 - length;
-			value = value << shift;
-			value = value & (((1 << length) - 1) << shift);
-
-			uint8_t mask = 0;
-			mask = 0xff - (((1 << length) - 1) << shift);
-			buffer[offset / 8] = (buffer[offset / 8] & mask) |
-			    value;
-		} else {
-			int i = 0;
-			uint8_t mask = 0;
-			for (i = (offset / 8);
-			    i <= ((offset + length - 1) / 8); i++) {
-				if (i == (offset / 8)) {
-					tmp_value = value;
-					tmp_value = tmp_value &
-					    ((1 << (8 - (offset % 8))) - 1);
-
-					tmp_value = tmp_value << (offset % 8);
-
-					mask = ~(((1 << (8 - (offset % 8))) - 1) << (offset % 8));
-
-					buffer[i] = (buffer[i] & mask) |
-					    tmp_value;
-				} else if (i == ((offset + length - 1) / 8)) {
-
-					value = value >> (length -
-					    ((offset + length) % 8));
-
-					value = value & ((1 << (length -
-					    ((offset + length) % 8))) - 1);
-
-					mask = (1 << (length -
-					    ((offset + length) % 8))) - 1;
-
-					buffer[i] = (buffer[i] & mask) | value;
-				} else {
-					buffer[i] = value & (0xff << i);
-				}
-			}
-		}
-
-		/* reset value */
-		report_item->value = 0;
-	}
-
-	return EOK;
-}
-
-/**
- * Translate given data for putting them into the outoput report
- * @param item Report item structure
- * @param value Value to translate
- * @return ranslated value
- */
-uint32_t usb_hid_translate_data_reverse(usb_hid_report_field_t *item,
-    int value)
-{
-	int ret = 0;
-	int resolution;
-
-	if (USB_HID_ITEM_FLAG_CONSTANT(item->item_flags)) {
-		return item->logical_minimum;
-	}
-
-	if ((item->physical_minimum == 0) && (item->physical_maximum == 0)) {
-		item->physical_minimum = item->logical_minimum;
-		item->physical_maximum = item->logical_maximum;
-	}
-
-	/* variable item */
-	if (item->physical_maximum == item->physical_minimum) {
-		resolution = 1;
-	} else {
-		resolution = (item->logical_maximum - item->logical_minimum) /
-		    ((item->physical_maximum - item->physical_minimum) *
-		    (usb_pow(10, (item->unit_exponent))));
-	}
-
-	ret = ((value - item->physical_minimum) * resolution) +
-	    item->logical_minimum;
-
-	usb_log_debug("\tvalue(%x), resolution(%x), phymin(%x) logmin(%x), "
-	    "ret(%x)\n", value, resolution, item->physical_minimum,
-	    item->logical_minimum, ret);
-
-	if ((item->logical_minimum < 0) || (item->logical_maximum < 0)) {
-		return USB_HID_INT32_TO_UINT32(ret, item->size);
-	}
-
-	return (int32_t) 0 + ret;
-}
-
-/**
- * Clones given state table
- *
- * @param item State table to clone
- * @return Pointer to the cloned item
- */
-usb_hid_report_item_t *usb_hid_report_item_clone(
-    const usb_hid_report_item_t *item)
-{
-	usb_hid_report_item_t *new_report_item;
-
-	if (!(new_report_item = malloc(sizeof(usb_hid_report_item_t)))) {
-		return NULL;
-	}
-	memcpy(new_report_item, item, sizeof(usb_hid_report_item_t));
-	link_initialize(&(new_report_item->link));
-
-	return new_report_item;
-}
-
-/**
- * Function for sequence walking through the report. Returns next field in the
- * report or the first one when no field is given.
- *
- * @param report Searched report structure
- * @param field Current field. If NULL is given, the first one in the report
- * is returned. Otherwise the next one i nthe list is returned.
- * @param path Usage path specifying which fields wa are interested in.
- * @param flags Flags defining mode of usage paths comparison
- * @param type Type of report we search.
- * @retval NULL if no field is founded
- * @retval Pointer to the founded report structure when founded
- */
-usb_hid_report_field_t *usb_hid_report_get_sibling(usb_hid_report_t *report,
-    usb_hid_report_field_t *field, usb_hid_report_path_t *path, int flags,
-    usb_hid_report_type_t type)
-{
-	usb_hid_report_description_t *report_des =
-	    usb_hid_report_find_description(report, path->report_id, type);
-
-	link_t *field_it;
-
-	if (report_des == NULL) {
-		return NULL;
-	}
-
-	if (field == NULL) {
-		field_it = report_des->report_items.head.next;
-	} else {
-		field_it = field->ritems_link.next;
-	}
-
-	while (field_it != &report_des->report_items.head) {
-		field = list_get_instance(field_it, usb_hid_report_field_t,
-		    ritems_link);
-
-		if (USB_HID_ITEM_FLAG_CONSTANT(field->item_flags) == 0) {
-			usb_hid_report_path_append_item(field->collection_path,
-			    field->usage_page, field->usage);
-
-			if (usb_hid_report_compare_usage_path(
-			    field->collection_path, path, flags) == 0) {
-				usb_hid_report_remove_last_item(
-				    field->collection_path);
-				return field;
-			}
-			usb_hid_report_remove_last_item(field->collection_path);
-		}
-		field_it = field_it->next;
-	}
-
-	return NULL;
-}
-
-/**
- * Returns next report_id of report of specified type. If zero is given than
- * first report_id of specified type is returned (0 is not legal value for
- * repotr_id)
- *
- * @param report_id Current report_id, 0 if there is no current report_id
- * @param type Type of searched report
- * @param report Report structure inwhich we search
- * @retval 0 if report structure is null or there is no specified report
- * @retval report_id otherwise
- */
-uint8_t usb_hid_get_next_report_id(usb_hid_report_t *report, uint8_t report_id,
-    usb_hid_report_type_t type)
-{
-	if (report == NULL) {
-		return 0;
-	}
-
-	usb_hid_report_description_t *report_des;
-	link_t *report_it;
-
-	if (report_id > 0) {
-		report_des = usb_hid_report_find_description(report, report_id,
-		    type);
-		if (report_des == NULL) {
-			return 0;
-		} else {
-			report_it = report_des->reports_link.next;
-		}
-	} else {
-		report_it = report->reports.head.next;
-	}
-
-	while (report_it != &report->reports.head) {
-		report_des = list_get_instance(report_it,
-		    usb_hid_report_description_t, reports_link);
-
-		if (report_des->type == type) {
-			return report_des->report_id;
-		}
-
-		report_it = report_it->next;
-	}
-
-	return 0;
-}
-
-/**
- * Reset all local items in given state table
- *
- * @param report_item State table containing current state of report
- * descriptor parsing
- *
- * @return void
- */
-void usb_hid_report_reset_local_items(usb_hid_report_item_t *report_item)
-{
-	if (report_item == NULL) {
-		return;
-	}
-
-	report_item->usages_count = 0;
-	memset(report_item->usages, 0, sizeof(report_item->usages));
-
-	report_item->extended_usage_page = 0;
-	report_item->usage_minimum = 0;
-	report_item->usage_maximum = 0;
-	report_item->designator_index = 0;
-	report_item->designator_minimum = 0;
-	report_item->designator_maximum = 0;
-	report_item->string_index = 0;
-	report_item->string_minimum = 0;
-	report_item->string_maximum = 0;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/src/hidpath.c
===================================================================
--- uspace/lib/usbhid/src/hidpath.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,428 +1,0 @@
-/*
- * Copyright (c) 2011 Matej Klonfar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/** @file
- * HID report descriptor and report data parser implementation.
- */
-#include <usb/hid/hidparser.h>
-#include <errno.h>
-#include <stdio.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <usb/debug.h>
-#include <assert.h>
-
-/**
- * Compares two usages if they are same or not or one of the usages is not
- * set.
- *
- * @param usage1
- * @param usage2
- * @return boolean
- */
-#define USB_HID_SAME_USAGE(usage1, usage2)		\
-	((usage1 == usage2) || (usage1 == 0) || (usage2 == 0))
-
-/**
- * Compares two usage pages if they are same or not or one of them is not set.
- *
- * @param page1
- * @param page2
- * @return boolean
- */
-#define USB_HID_SAME_USAGE_PAGE(page1, page2)	\
-	((page1 == page2) || (page1 == 0) || (page2 == 0))
-
-/**
- * Appends one item (couple of usage_path and usage) into the usage path
- * structure
- *
- * @param usage_path Usage path structure
- * @param usage_page Usage page constant
- * @param usage Usage constant
- * @return Error code
- */
-errno_t usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,
-    int32_t usage_page, int32_t usage)
-{
-	usb_hid_report_usage_path_t *item =
-	    malloc(sizeof(usb_hid_report_usage_path_t));
-
-	if (item == NULL) {
-		return ENOMEM;
-	}
-	link_initialize(&item->rpath_items_link);
-
-	item->usage = usage;
-	item->usage_page = usage_page;
-	item->flags = 0;
-
-	list_append (&item->rpath_items_link, &usage_path->items);
-	usage_path->depth++;
-	return EOK;
-}
-
-/**
- * Removes last item from the usage path structure
- * @param usage_path
- * @return void
- */
-void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path)
-{
-	link_t *item_link;
-	usb_hid_report_usage_path_t *item;
-
-	if (!list_empty(&usage_path->items)) {
-		item_link = list_last(&usage_path->items);
-		item = list_get_instance(item_link,
-		    usb_hid_report_usage_path_t, rpath_items_link);
-		list_remove(item_link);
-		usage_path->depth--;
-		free(item);
-	}
-}
-
-/**
- * Nulls last item of the usage path structure.
- *
- * @param usage_path
- * @return void
- */
-void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path)
-{
-	usb_hid_report_usage_path_t *item;
-
-	if (!list_empty(&usage_path->items)) {
-		item = list_get_instance(list_last(&usage_path->items),
-		    usb_hid_report_usage_path_t, rpath_items_link);
-
-		memset(item, 0, sizeof(usb_hid_report_usage_path_t));
-	}
-}
-
-/**
- * Modifies last item of usage path structure by given usage page or usage
- *
- * @param usage_path Opaque usage path structure
- * @param tag Class of currently processed tag (Usage page tag falls into Global
- * class but Usage tag into the Local)
- * @param data Value of the processed tag
- * @return void
- */
-void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path,
-    int32_t tag, int32_t data)
-{
-	usb_hid_report_usage_path_t *item;
-
-	if (!list_empty(&usage_path->items)) {
-		item = list_get_instance(list_last(&usage_path->items),
-		    usb_hid_report_usage_path_t, rpath_items_link);
-
-		switch (tag) {
-		case USB_HID_TAG_CLASS_GLOBAL:
-			item->usage_page = data;
-			break;
-		case USB_HID_TAG_CLASS_LOCAL:
-			item->usage = data;
-			break;
-		}
-	}
-}
-
-void usb_hid_print_usage_path(usb_hid_report_path_t *path)
-{
-	usb_log_debug("USAGE_PATH FOR RId(%d):", path->report_id);
-	usb_log_debug("\tLENGTH: %d", path->depth);
-
-	list_foreach(path->items, rpath_items_link,
-	    usb_hid_report_usage_path_t, path_item) {
-
-		usb_log_debug("\tUSAGE_PAGE: %X", path_item->usage_page);
-		usb_log_debug("\tUSAGE: %X", path_item->usage);
-		usb_log_debug("\tFLAGS: %d", path_item->flags);
-	}
-}
-
-/** Compare two usage paths structures
- *
- * @param report_path Usage path structure to compare with @path
- * @param path        Usage patrh structure to compare
- * @param flags       Flags determining the mode of comparison
- *
- * @return 0 if both paths are identical, non zero number otherwise
- *
- */
-int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path,
-    usb_hid_report_path_t *path, int flags)
-{
-	usb_hid_report_usage_path_t *report_item;
-	usb_hid_report_usage_path_t *path_item;
-
-	link_t *report_link;
-	link_t *path_link;
-
-	int only_page;
-
-	if (report_path->report_id != path->report_id) {
-		if (path->report_id != 0) {
-			return 1;
-		}
-	}
-
-	// Empty path match all others
-	if (path->depth == 0) {
-		return 0;
-	}
-
-	if ((only_page = flags & USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY) != 0) {
-		flags -= USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY;
-	}
-
-	switch (flags) {
-	case USB_HID_PATH_COMPARE_ANYWHERE:
-		/*
-		 * Path is somewhere in report_path
-		 */
-		if (path->depth != 1) {
-			return 1;
-		}
-
-		path_link = list_first(&path->items);
-		path_item = list_get_instance(path_link,
-		    usb_hid_report_usage_path_t, rpath_items_link);
-
-		list_foreach(report_path->items, rpath_items_link,
-		    usb_hid_report_usage_path_t, report_item) {
-			if (USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
-			    path_item->usage_page)) {
-
-				if (only_page == 0) {
-					if (USB_HID_SAME_USAGE(report_item->usage,
-					    path_item->usage))
-						return 0;
-				} else {
-					return 0;
-				}
-			}
-		}
-
-		return 1;
-
-	case USB_HID_PATH_COMPARE_STRICT:
-		/*
-		 * The paths must be identical
-		 */
-		if (report_path->depth != path->depth) {
-			return 1;
-		}
-		/* Fallthrough */
-
-	case USB_HID_PATH_COMPARE_BEGIN:
-		/*
-		 * Path is prefix of the report_path
-		 */
-		report_link = report_path->items.head.next;
-		path_link = path->items.head.next;
-
-		while ((report_link != &report_path->items.head) &&
-		    (path_link != &path->items.head)) {
-
-			report_item = list_get_instance(report_link,
-			    usb_hid_report_usage_path_t, rpath_items_link);
-
-			path_item = list_get_instance(path_link,
-			    usb_hid_report_usage_path_t, rpath_items_link);
-
-			if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
-			    path_item->usage_page) || ((only_page == 0) &&
-			    !USB_HID_SAME_USAGE(report_item->usage,
-			    path_item->usage))) {
-				return 1;
-			} else {
-				report_link = report_link->next;
-				path_link = path_link->next;
-			}
-		}
-
-		if ((((flags & USB_HID_PATH_COMPARE_BEGIN) != 0) &&
-		    (path_link == &path->items.head)) ||
-		    ((report_link == &report_path->items.head) &&
-		    (path_link == &path->items.head))) {
-			return 0;
-		} else {
-			return 1;
-		}
-		break;
-
-	case USB_HID_PATH_COMPARE_END:
-		/*
-		 * Path is suffix of report_path
-		 */
-		report_link = report_path->items.head.prev;
-		path_link = path->items.head.prev;
-
-		if (list_empty(&path->items)) {
-			return 0;
-		}
-
-		while ((report_link != &report_path->items.head) &&
-		    (path_link != &path->items.head)) {
-			report_item = list_get_instance(report_link,
-			    usb_hid_report_usage_path_t, rpath_items_link);
-
-			path_item = list_get_instance(path_link,
-			    usb_hid_report_usage_path_t, rpath_items_link);
-
-			if (!USB_HID_SAME_USAGE_PAGE(report_item->usage_page,
-			    path_item->usage_page) || ((only_page == 0) &&
-			    !USB_HID_SAME_USAGE(report_item->usage,
-			    path_item->usage))) {
-				return 1;
-			} else {
-				report_link = report_link->prev;
-				path_link = path_link->prev;
-			}
-		}
-
-		if (path_link == &path->items.head) {
-			return 0;
-		} else {
-			return 1;
-		}
-		break;
-
-	default:
-		return -1;
-	}
-}
-
-/**
- * Allocates and initializes new usage path structure.
- *
- * @return Initialized usage path structure
- */
-usb_hid_report_path_t *usb_hid_report_path(void)
-{
-	usb_hid_report_path_t *path;
-	path = malloc(sizeof(usb_hid_report_path_t));
-	if (path == NULL) {
-		return NULL;
-	} else {
-		path->depth = 0;
-		path->report_id = 0;
-		link_initialize(&path->cpath_link);
-		list_initialize(&path->items);
-		return path;
-	}
-}
-
-/**
- * Releases given usage path structure.
- *
- * @param path usage path structure to release
- * @return void
- */
-void usb_hid_report_path_free(usb_hid_report_path_t *path)
-{
-	if (path == NULL)
-		return;
-	while (!list_empty(&path->items)) {
-		usb_hid_report_remove_last_item(path);
-	}
-
-	assert_link_not_used(&path->cpath_link);
-	free(path);
-}
-
-/**
- * Clone content of given usage path to the new one
- *
- * @param usage_path Usage path structure to clone
- * @return New copy of given usage path structure
- */
-usb_hid_report_path_t *usb_hid_report_path_clone(
-    usb_hid_report_path_t *usage_path)
-{
-	usb_hid_report_usage_path_t *new_path_item;
-	usb_hid_report_path_t *new_usage_path = usb_hid_report_path ();
-
-	if (new_usage_path == NULL) {
-		return NULL;
-	}
-
-	new_usage_path->report_id = usage_path->report_id;
-
-	if (list_empty(&usage_path->items)) {
-		return new_usage_path;
-	}
-
-	list_foreach(usage_path->items, rpath_items_link,
-	    usb_hid_report_usage_path_t, path_item) {
-
-		new_path_item = malloc(sizeof(usb_hid_report_usage_path_t));
-		if (new_path_item == NULL) {
-			return NULL;
-		}
-
-		link_initialize(&new_path_item->rpath_items_link);
-		new_path_item->usage_page = path_item->usage_page;
-		new_path_item->usage = path_item->usage;
-		new_path_item->flags = path_item->flags;
-
-		list_append(&new_path_item->rpath_items_link,
-		    &new_usage_path->items);
-		new_usage_path->depth++;
-	}
-
-	return new_usage_path;
-}
-
-/**
- * Sets report id in usage path structure
- *
- * @param path Usage path structure
- * @param report_id Report id to set
- * @return Error code
- */
-errno_t usb_hid_report_path_set_report_id(usb_hid_report_path_t *path,
-    uint8_t report_id)
-{
-	if (path == NULL) {
-		return EINVAL;
-	}
-
-	path->report_id = report_id;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/src/hidreport.c
===================================================================
--- uspace/lib/usbhid/src/hidreport.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,202 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhid
- * @{
- */
-/**
- * @file
- * USB HID keyboard device structure and API.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <str_error.h>
-
-#include <usb/debug.h>
-#include <usb/hid/hidparser.h>
-#include <usb/dev/dp.h>
-#include <usb/dev/driver.h>
-#include <usb/dev/pipes.h>
-#include <usb/hid/hid.h>
-#include <usb/descriptor.h>
-#include <usb/dev/request.h>
-
-#include <usb/hid/hidreport.h>
-
-static errno_t usb_hid_get_report_descriptor(usb_device_t *dev,
-    uint8_t **report_desc, size_t *size)
-{
-	assert(report_desc != NULL);
-	assert(size != NULL);
-
-	usb_dp_parser_t parser =  {
-		.nesting = usb_dp_standard_descriptor_nesting
-	};
-
-	usb_dp_parser_data_t parser_data = {
-		.data = usb_device_descriptors(dev)->full_config,
-		.size = usb_device_descriptors(dev)->full_config_size,
-		.arg = NULL
-	};
-
-	/*
-	 * First nested descriptor of the configuration descriptor.
-	 */
-	const uint8_t *d =
-	    usb_dp_get_nested_descriptor(&parser, &parser_data,
-	    usb_device_descriptors(dev)->full_config);
-
-	/*
-	 * Find the interface descriptor corresponding to our interface number.
-	 */
-	int i = 0;
-	while (d != NULL && i < usb_device_get_iface_number(dev)) {
-		d = usb_dp_get_sibling_descriptor(&parser, &parser_data,
-		    usb_device_descriptors(dev)->full_config, d);
-		++i;
-	}
-
-	if (d == NULL) {
-		usb_log_error("The %d. interface descriptor not found!",
-		    usb_device_get_iface_number(dev));
-		return ENOENT;
-	}
-
-	/*
-	 * First nested descriptor of the interface descriptor.
-	 */
-	const uint8_t *iface_desc = d;
-	d = usb_dp_get_nested_descriptor(&parser, &parser_data, iface_desc);
-
-	/*
-	 * Search through siblings until the HID descriptor is found.
-	 */
-	while (d != NULL && *(d + 1) != USB_DESCTYPE_HID) {
-		d = usb_dp_get_sibling_descriptor(&parser, &parser_data,
-		    iface_desc, d);
-	}
-
-	if (d == NULL) {
-		usb_log_fatal("No HID descriptor found!");
-		return ENOENT;
-	}
-
-	if (*d != sizeof(usb_standard_hid_descriptor_t)) {
-		usb_log_error("HID descriptor has wrong size (%u, expected %zu"
-		    ")\n", *d, sizeof(usb_standard_hid_descriptor_t));
-		return EINVAL;
-	}
-
-	usb_standard_hid_descriptor_t *hid_desc =
-	    (usb_standard_hid_descriptor_t *)d;
-
-	uint16_t length = uint16_usb2host(hid_desc->report_desc_info.length);
-	size_t actual_size = 0;
-
-	/*
-	 * Allocate space for the report descriptor.
-	 */
-	*report_desc = (uint8_t *)malloc(length);
-	if (*report_desc == NULL) {
-		usb_log_error("Failed to allocate space for Report descriptor."
-		    "\n");
-		return ENOMEM;
-	}
-
-	usb_log_debug("Getting Report descriptor, expected size: %u", length);
-
-	/*
-	 * Get the descriptor from the device.
-	 */
-	errno_t rc = usb_request_get_descriptor(usb_device_get_default_pipe(dev),
-	    USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_DESCTYPE_HID_REPORT, 0, usb_device_get_iface_number(dev),
-	    *report_desc, length, &actual_size);
-
-	if (rc != EOK) {
-		free(*report_desc);
-		*report_desc = NULL;
-		return rc;
-	}
-
-	if (actual_size != length) {
-		free(*report_desc);
-		*report_desc = NULL;
-		usb_log_error("Report descriptor has wrong size (%zu, expected "
-		    "%u)\n", actual_size, length);
-		return EINVAL;
-	}
-
-	*size = length;
-
-	usb_log_debug("Done.");
-
-	return EOK;
-}
-
-errno_t usb_hid_process_report_descriptor(usb_device_t *dev,
-    usb_hid_report_t *report, uint8_t **report_desc, size_t *report_size)
-{
-	if (dev == NULL || report == NULL) {
-		usb_log_error("Failed to process Report descriptor: wrong "
-		    "parameters given.\n");
-		return EINVAL;
-	}
-
-	errno_t rc = usb_hid_get_report_descriptor(dev, report_desc, report_size);
-
-	if (rc != EOK) {
-		usb_log_error("Problem with getting Report descriptor: %s.",
-		    str_error(rc));
-		if (*report_desc != NULL) {
-			free(*report_desc);
-			*report_desc = NULL;
-		}
-		return rc;
-	}
-
-	assert(*report_desc != NULL);
-
-	rc = usb_hid_parse_report_descriptor(report, *report_desc, *report_size);
-	if (rc != EOK) {
-		usb_log_error("Problem parsing Report descriptor: %s.",
-		    str_error(rc));
-		free(*report_desc);
-		*report_desc = NULL;
-		return rc;
-	}
-
-	usb_hid_descriptor_print(report);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhid/src/hidreq.c
===================================================================
--- uspace/lib/usbhid/src/hidreq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,372 +1,0 @@
-/*
- * Copyright (c) 2011 Lubos Slovak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbhid
- * @{
- */
-/** @file
- * HID class-specific requests.
- */
-
-#include <stdint.h>
-#include <errno.h>
-#include <str_error.h>
-
-#include <usb/hid/hid.h>
-#include <usb/debug.h>
-#include <usb/dev/request.h>
-#include <usb/dev/pipes.h>
-
-#include <usb/hid/request.h>
-
-/**
- * Send Set Report request to the HID device.
- *
- * @param hid_dev HID device to send the request to.
- * @param type Type of the report.
- * @param buffer Report data.
- * @param buf_size Report data size (in bytes).
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from function usb_control_request_set().
- */
-errno_t usbhid_req_set_report(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	uint16_t value = 0;
-	value |= (type << 8);
-
-	usb_log_debug("Sending Set Report request to the device.");
-
-	rc = usb_control_request_set(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_SET_REPORT, value, iface_no, buffer, buf_size);
-
-	if (rc != EOK) {
-		usb_log_error("Error sending Set Report request to the "
-		    "device: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * Send Set Protocol request to the HID device.
- *
- * @param hid_dev HID device to send the request to.
- * @param protocol Protocol to set.
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from function usb_control_request_set().
- */
-errno_t usbhid_req_set_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_protocol_t protocol)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	usb_log_debug("Sending Set Protocol request to the device ("
-	    "protocol: %d, iface: %d).\n", protocol, iface_no);
-
-	rc = usb_control_request_set(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_SET_PROTOCOL, protocol, iface_no, NULL, 0);
-
-	if (rc != EOK) {
-		usb_log_warning("Error sending Set Protocol request to the "
-		    "device: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * Send Set Idle request to the HID device.
- *
- * @param hid_dev HID device to send the request to.
- * @param duration Duration value (is multiplicated by 4 by the device to
- *                 get real duration in miliseconds).
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from function usb_control_request_set().
- */
-errno_t usbhid_req_set_idle(usb_pipe_t *ctrl_pipe, int iface_no, uint8_t duration)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	usb_log_debug("Sending Set Idle request to the device ("
-	    "duration: %u, iface: %d).\n", duration, iface_no);
-
-	uint16_t value = duration << 8;
-
-	rc = usb_control_request_set(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_SET_IDLE, value, iface_no, NULL, 0);
-
-	if (rc != EOK) {
-		usb_log_warning("Device did not accept Set Idle request: "
-		    "%s.\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * Send Get Report request to the HID device.
- *
- * @param[in] hid_dev HID device to send the request to.
- * @param[in] type Type of the report.
- * @param[in][out] buffer Buffer for the report data.
- * @param[in] buf_size Size of the buffer (in bytes).
- * @param[out] actual_size Actual size of report received from the device
- *                         (in bytes).
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from function usb_control_request_set().
- */
-errno_t usbhid_req_get_report(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_report_type_t type, uint8_t *buffer, size_t buf_size,
-    size_t *actual_size)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	uint16_t value = 0;
-	value |= (type << 8);
-
-	usb_log_debug("Sending Get Report request to the device.");
-
-	rc = usb_control_request_get(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_GET_REPORT, value, iface_no, buffer, buf_size,
-	    actual_size);
-
-	if (rc != EOK) {
-		usb_log_warning("Error sending Get Report request to the device: "
-		    "%s.\n", str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-/**
- * Send Get Protocol request to the HID device.
- *
- * @param[in] hid_dev HID device to send the request to.
- * @param[out] protocol Current protocol of the device.
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from function usb_control_request_set().
- */
-errno_t usbhid_req_get_protocol(usb_pipe_t *ctrl_pipe, int iface_no,
-    usb_hid_protocol_t *protocol)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	usb_log_debug("Sending Get Protocol request to the device ("
-	    "iface: %d).\n", iface_no);
-
-	uint8_t buffer[1];
-	size_t actual_size = 0;
-
-	rc = usb_control_request_get(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_GET_PROTOCOL, 0, iface_no, buffer, 1, &actual_size);
-
-	if (rc != EOK) {
-		usb_log_warning("Error sending Get Protocol request to the "
-		    "device: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	if (actual_size != 1) {
-		usb_log_warning("Wrong data size: %zu, expected: 1.",
-		    actual_size);
-		return ELIMIT;
-	}
-
-	*protocol = buffer[0];
-
-	return EOK;
-}
-
-/**
- * Send Get Idle request to the HID device.
- *
- * @param[in] hid_dev HID device to send the request to.
- * @param[out] duration Duration value (multiplicate by 4 to get real duration
- *                      in miliseconds).
- *
- * @retval EOK if successful.
- * @retval EINVAL if no HID device is given.
- * @return Other value inherited from one of functions
- *         usb_pipe_start_session(), usb_pipe_end_session(),
- *         usb_control_request_set().
- */
-errno_t usbhid_req_get_idle(usb_pipe_t *ctrl_pipe, int iface_no,
-    uint8_t *duration)
-{
-	if (ctrl_pipe == NULL) {
-		usb_log_warning("usbhid_req_set_report(): no pipe given.");
-		return EINVAL;
-	}
-
-	if (iface_no < 0) {
-		usb_log_warning("usbhid_req_set_report(): no interface given."
-		    "\n");
-		return EINVAL;
-	}
-
-	/*
-	 * No need for checking other parameters, as they are checked in
-	 * the called function (usb_control_request_set()).
-	 */
-
-	errno_t rc;
-
-	usb_log_debug("Sending Get Idle request to the device ("
-	    "iface: %d).\n", iface_no);
-
-	uint16_t value = 0;
-	uint8_t buffer[1];
-	size_t actual_size = 0;
-
-	rc = usb_control_request_get(ctrl_pipe,
-	    USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_INTERFACE,
-	    USB_HIDREQ_GET_IDLE, value, iface_no, buffer, 1,
-	    &actual_size);
-
-	if (rc != EOK) {
-		usb_log_warning("Error sending Get Idle request to the device: "
-		    "%s.\n", str_error(rc));
-		return rc;
-	}
-
-	if (actual_size != 1) {
-		usb_log_warning("Wrong data size: %zu, expected: 1.",
-		    actual_size);
-		return ELIMIT;
-	}
-
-	*duration = buffer[0];
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/bandwidth.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/bandwidth.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * Bandwidth calculation functions. Shared among uhci, ohci and ehci drivers.
- */
-
-#ifndef LIBUSBHOST_HOST_BANDWIDTH_H
-#define LIBUSBHOST_HOST_BANDWIDTH_H
-
-#include <usb/usb.h>
-
-#include <stddef.h>
-
-typedef struct endpoint endpoint_t;
-
-typedef size_t (*endpoint_count_bw_t)(endpoint_t *);
-
-typedef struct {
-	size_t available_bandwidth;
-	endpoint_count_bw_t count_bw;
-} bandwidth_accounting_t;
-
-extern const bandwidth_accounting_t bandwidth_accounting_usb11;
-extern const bandwidth_accounting_t bandwidth_accounting_usb2;
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/bus.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/bus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- * Virtual base for usb bus implementations.
- *
- * The purpose of this structure is to keep information about connected devices
- * and endpoints, manage available bandwidth and the toggle bit flipping.
- *
- * The generic implementation is provided for USB 1 and 2 in usb2_bus.c. Some
- * details in [OUE]HCI are solved through overriding some functions. XHCI does
- * not need the bookkeeping functionality, because addresses are managed by HC
- * itself.
- */
-#ifndef LIBUSBHOST_HOST_BUS_H
-#define LIBUSBHOST_HOST_BUS_H
-
-#include <assert.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <usb/host/hcd.h>
-#include <usb/request.h>
-#include <usb/usb.h>
-#include <usbhc_iface.h>
-
-typedef struct hcd hcd_t;
-typedef struct endpoint endpoint_t;
-typedef struct bus bus_t;
-typedef struct ddf_fun ddf_fun_t;
-typedef struct usb_transfer_batch usb_transfer_batch_t;
-
-typedef struct device {
-	/* Device tree keeping */
-	link_t link;
-	list_t devices;
-	fibril_mutex_t guard;
-
-	/* Associated DDF function, if any */
-	ddf_fun_t *fun;
-
-	/* Invalid for the roothub device */
-	unsigned port;
-
-	/** Hub under which this device is connected */
-	struct device *hub;
-
-	/** USB Tier of the device */
-	uint8_t tier;
-
-	/* Transaction translator */
-	struct {
-		device_t *dev;
-		unsigned port;
-	} tt;
-
-	/* The following are not set by the library */
-	usb_speed_t speed;
-	usb_address_t address;
-	endpoint_t *endpoints [USB_ENDPOINT_COUNT];
-
-	/* Managing bus */
-	bus_t *bus;
-
-	/** True if the device can add new endpoints and schedule transfers. */
-	volatile bool online;
-
-	/* This structure is meant to be extended by overriding. */
-} device_t;
-
-typedef struct bus_ops bus_ops_t;
-
-/**
- * Operations structure serving as an interface of hc driver for the library
- * (and the rest of the system).
- */
-struct bus_ops {
-	/* Global operations on the bus */
-	void (*interrupt)(bus_t *, uint32_t);
-	int (*status)(bus_t *, uint32_t *);
-
-	/* Operations on device */
-	int (*device_enumerate)(device_t *);
-	void (*device_gone)(device_t *);
-	int (*device_online)(device_t *);			/**< Optional */
-	void (*device_offline)(device_t *);			/**< Optional */
-	endpoint_t *(*endpoint_create)(device_t *,
-	    const usb_endpoint_descriptors_t *);
-
-	/* Operations on endpoint */
-	int (*endpoint_register)(endpoint_t *);
-	void (*endpoint_unregister)(endpoint_t *);
-	void (*endpoint_destroy)(endpoint_t *);			/**< Optional */
-	usb_transfer_batch_t *(*batch_create)(endpoint_t *);	/**< Optional */
-
-	/* Operations on batch */
-	int (*batch_schedule)(usb_transfer_batch_t *);
-	void (*batch_destroy)(usb_transfer_batch_t *);		/**< Optional */
-};
-
-/** Endpoint management structure */
-typedef struct bus {
-	/* Synchronization of ops */
-	fibril_mutex_t guard;
-
-	/* Size of the device_t extended structure */
-	size_t device_size;
-
-	/* Do not call directly, ops are synchronized. */
-	const bus_ops_t *ops;
-
-	/* Reserving default address */
-	device_t *default_address_owner;
-	fibril_condvar_t default_address_cv;
-
-	/* This structure is meant to be extended by overriding. */
-} bus_t;
-
-void bus_init(bus_t *, size_t);
-int bus_device_init(device_t *, bus_t *);
-
-int bus_device_set_default_name(device_t *);
-
-int bus_device_enumerate(device_t *);
-void bus_device_gone(device_t *);
-
-int bus_device_online(device_t *);
-int bus_device_offline(device_t *);
-
-/**
- * A proforma to USB transfer batch. As opposed to transfer batch, which is
- * supposed to be a dynamic structrure, this one is static and descriptive only.
- * Its fields are copied to the final batch.
- */
-typedef struct transfer_request {
-	usb_target_t target;
-	usb_direction_t dir;
-
-	dma_buffer_t buffer;
-	size_t offset, size;
-	uint64_t setup;
-
-	usbhc_iface_transfer_callback_t on_complete;
-	void *arg;
-
-	const char *name;
-} transfer_request_t;
-
-int bus_issue_transfer(device_t *, const transfer_request_t *);
-
-errno_t bus_device_send_batch_sync(device_t *, usb_target_t,
-    usb_direction_t direction, char *, size_t, uint64_t,
-    const char *, size_t *);
-
-int bus_endpoint_add(device_t *, const usb_endpoint_descriptors_t *, endpoint_t **);
-endpoint_t *bus_find_endpoint(device_t *, usb_endpoint_t, usb_direction_t);
-int bus_endpoint_remove(endpoint_t *);
-
-int bus_reserve_default_address(bus_t *, device_t *);
-void bus_release_default_address(bus_t *, device_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/ddf_helpers.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/ddf_helpers.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- */
-
-#ifndef LIBUSBHOST_HOST_DDF_HELPERS_H
-#define LIBUSBHOST_HOST_DDF_HELPERS_H
-
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <usb/usb.h>
-
-#include <usb/host/hcd.h>
-#include <usb/descriptor.h>
-
-extern errno_t hcd_ddf_setup_hc(ddf_dev_t *, size_t);
-extern void hcd_ddf_clean_hc(hc_device_t *);
-
-extern device_t *hcd_ddf_fun_create(hc_device_t *, usb_speed_t);
-extern void hcd_ddf_fun_destroy(device_t *);
-
-extern errno_t hcd_ddf_setup_match_ids(device_t *,
-    usb_standard_device_descriptor_t *);
-
-extern errno_t hcd_ddf_enable_interrupt(hc_device_t *, int);
-extern errno_t hcd_ddf_get_registers(hc_device_t *, hw_res_list_parsed_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/endpoint.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/endpoint.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * Endpoint structure is tightly coupled to the bus. The bus controls the
- * life-cycle of endpoint. In order to keep endpoints lightweight, operations
- * on endpoints are part of the bus structure.
- *
- */
-#ifndef LIBUSBHOST_HOST_ENDPOINT_H
-#define LIBUSBHOST_HOST_ENDPOINT_H
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-#include <refcount.h>
-#include <stdbool.h>
-#include <time.h>
-#include <usb/usb.h>
-#include <usb/host/bus.h>
-#include <usbhc_iface.h>
-
-typedef struct bus bus_t;
-typedef struct device device_t;
-typedef struct transfer_request transfer_request_t;
-typedef struct usb_transfer_batch usb_transfer_batch_t;
-
-/**
- * Host controller side endpoint structure.
- *
- * This structure, though reference-counted, is very fragile. It is responsible
- * for synchronizing transfer batch scheduling and completion.
- *
- * To avoid situations, in which two locks must be obtained to schedule/finish
- * a transfer, the endpoint inherits a lock from the outside. Because the
- * concrete instance of mutex can be unknown at the time of initialization,
- * the HC shall pass the right lock at the time of onlining the endpoint.
- *
- * The fields used for scheduling (online, active_batch) are to be used only
- * under that guard and by functions designed for this purpose. The driver can
- * also completely avoid using this mechanism, in which case it is on its own in
- * question of transfer aborting.
- *
- * Relevant information can be found in the documentation of HelenOS xHCI
- * project.
- */
-typedef struct endpoint {
-	/** USB device */
-	device_t *device;
-	/** Reference count. */
-	atomic_refcount_t refcnt;
-
-	/** An inherited guard */
-	fibril_mutex_t *guard;
-	/** Whether it's allowed to schedule on this endpoint */
-	bool online;
-	/** The currently active transfer batch. */
-	usb_transfer_batch_t *active_batch;
-	/** Signals change of active status. */
-	fibril_condvar_t avail;
-
-	/** Endpoint number */
-	usb_endpoint_t endpoint;
-	/** Communication direction. */
-	usb_direction_t direction;
-	/** USB transfer type. */
-	usb_transfer_type_t transfer_type;
-	/** Maximum size of one packet */
-	size_t max_packet_size;
-
-	/** Maximum size of one transfer */
-	size_t max_transfer_size;
-
-	/* Policies for transfer buffers */
-	/** A hint for optimal performance. */
-	dma_policy_t transfer_buffer_policy;
-	/** Enforced by the library. */
-	dma_policy_t required_transfer_buffer_policy;
-
-	/**
-	 * Number of packets that can be sent in one service interval
-	 * (not necessarily uframe, despite its name)
-	 */
-	unsigned packets_per_uframe;
-
-	/* This structure is meant to be extended by overriding. */
-} endpoint_t;
-
-extern void endpoint_init(endpoint_t *, device_t *,
-    const usb_endpoint_descriptors_t *);
-
-extern void endpoint_add_ref(endpoint_t *);
-extern void endpoint_del_ref(endpoint_t *);
-
-extern void endpoint_set_online(endpoint_t *, fibril_mutex_t *);
-extern void endpoint_set_offline_locked(endpoint_t *);
-
-extern void endpoint_wait_timeout_locked(endpoint_t *ep, usec_t);
-extern int endpoint_activate_locked(endpoint_t *, usb_transfer_batch_t *);
-extern void endpoint_deactivate_locked(endpoint_t *);
-
-int endpoint_send_batch(endpoint_t *, const transfer_request_t *);
-
-static inline bus_t *endpoint_get_bus(endpoint_t *ep)
-{
-	device_t *const device = ep->device;
-	return device ? device->bus : NULL;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/hcd.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/hcd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- */
-
-#ifndef LIBUSBHOST_HOST_HCD_H
-#define LIBUSBHOST_HOST_HCD_H
-
-#include <fibril.h>
-#include <ddf/driver.h>
-#include <usb/request.h>
-
-typedef struct hw_resource_list_parsed hw_res_list_parsed_t;
-typedef struct bus bus_t;
-typedef struct device device_t;
-
-/*
- * Treat this header as read-only in driver code.
- * It could be opaque, but why to complicate matters.
- */
-typedef struct hc_device {
-	/* Bus instance */
-	bus_t *bus;
-
-	/* Managed DDF device */
-	ddf_dev_t *ddf_dev;
-
-	/* Control function */
-	ddf_fun_t *ctl_fun;
-
-	/* IRQ capability handle of the subscribed IRQ code */
-	cap_irq_handle_t irq_handle;
-
-	/** Interrupt replacement fibril */
-	fid_t polling_fibril;
-
-	/* This structure is meant to be extended by driver code. */
-} hc_device_t;
-
-typedef struct hc_driver {
-	const char *name;
-
-	/** Size of the device data to be allocated, and passed as the
-	 * hc_device_t.
-	 */
-	size_t hc_device_size;
-
-	/** Initialize device structures. */
-	int (*hc_add)(hc_device_t *, const hw_res_list_parsed_t *);
-
-	/** Generate IRQ code to handle interrupts. */
-	int (*irq_code_gen)(irq_code_t *, hc_device_t *,
-	    const hw_res_list_parsed_t *, int *);
-
-	/** Claim device from BIOS. */
-	int (*claim)(hc_device_t *);
-
-	/** Start the host controller. */
-	int (*start)(hc_device_t *);
-
-	/** Setup the virtual roothub. */
-	int (*setup_root_hub)(hc_device_t *);
-
-	/** Stop the host controller (after start has been called) */
-	int (*stop)(hc_device_t *);
-
-	/** HC was asked to be removed (after hc_add has been called) */
-	int (*hc_remove)(hc_device_t *);
-
-	/** HC is gone. */
-	int (*hc_gone)(hc_device_t *);
-
-	/** Quiesce HC. */
-	int (*hc_quiesce)(hc_device_t *);
-} hc_driver_t;
-
-/* Drivers should call this before leaving hc_add */
-static inline void hc_device_setup(hc_device_t *hcd, bus_t *bus)
-{
-	hcd->bus = bus;
-}
-
-static inline hc_device_t *dev_to_hcd(ddf_dev_t *dev)
-{
-	return ddf_dev_data_get(dev);
-}
-
-extern errno_t hc_driver_main(const hc_driver_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/usb2_bus.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/usb2_bus.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * Bus implementation common for OHCI, UHCI and EHCI.
- */
-#ifndef LIBUSBHOST_HOST_USB2_BUS_H
-#define LIBUSBHOST_HOST_USB2_BUS_H
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <usb/usb.h>
-
-#include <usb/host/bus.h>
-#include <usb/host/bandwidth.h>
-
-typedef struct usb2_bus usb2_bus_t;
-typedef struct endpoint endpoint_t;
-
-/** Endpoint and bandwidth management structure */
-typedef struct usb2_bus_helper {
-	/** Map of occupied addresses */
-	bool address_occupied [USB_ADDRESS_COUNT];
-	/** The last reserved address */
-	usb_address_t last_address;
-
-	/** Size of the bandwidth pool */
-	size_t free_bw;
-
-	/* Configured bandwidth accounting */
-	const bandwidth_accounting_t *bw_accounting;
-} usb2_bus_helper_t;
-
-extern void usb2_bus_helper_init(usb2_bus_helper_t *,
-    const bandwidth_accounting_t *);
-
-extern int usb2_bus_device_enumerate(usb2_bus_helper_t *, device_t *);
-extern void usb2_bus_device_gone(usb2_bus_helper_t *, device_t *);
-
-extern int usb2_bus_endpoint_register(usb2_bus_helper_t *, endpoint_t *);
-extern void usb2_bus_endpoint_unregister(usb2_bus_helper_t *, endpoint_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/usb_transfer_batch.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- * USB transfer transaction structures.
- */
-
-#ifndef LIBUSBHOST_HOST_USB_TRANSFER_BATCH_H
-#define LIBUSBHOST_HOST_USB_TRANSFER_BATCH_H
-
-#include <errno.h>
-#include <refcount.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <usb/dma_buffer.h>
-#include <usb/request.h>
-#include <usb/usb.h>
-#include <usbhc_iface.h>
-
-#include <usb/host/hcd.h>
-#include <usb/host/endpoint.h>
-#include <usb/host/bus.h>
-
-typedef struct endpoint endpoint_t;
-typedef struct bus bus_t;
-
-/** Structure stores additional data needed for communication with EP */
-typedef struct usb_transfer_batch {
-	/** Target for communication */
-	usb_target_t target;
-	/** Direction of the transfer */
-	usb_direction_t dir;
-
-	/** Endpoint used for communication */
-	endpoint_t *ep;
-
-	/** Place to store SETUP data needed by control transfers */
-	union {
-		char buffer [USB_SETUP_PACKET_SIZE];
-		usb_device_request_setup_packet_t packet;
-		uint64_t packed;
-	} setup;
-
-	/** DMA buffer with enforced policy */
-	dma_buffer_t dma_buffer;
-	/** Size of memory buffer */
-	size_t offset, size;
-
-	/**
-	 * In case a bounce buffer is allocated, the original buffer must to be
-	 * stored to be filled after the IN transaction is finished.
-	 */
-	char *original_buffer;
-	bool is_bounced;
-
-	/** Indicates success/failure of the communication */
-	errno_t error;
-	/** Actually used portion of the buffer */
-	size_t transferred_size;
-
-	/** Function called on completion */
-	usbhc_iface_transfer_callback_t on_complete;
-	/** Arbitrary data for the handler */
-	void *on_complete_data;
-} usb_transfer_batch_t;
-
-/**
- * Printf formatting string for dumping usb_transfer_batch_t.
- *  [address:endpoint speed transfer_type-direction buffer_sizeB/max_packet_size]
- */
-#define USB_TRANSFER_BATCH_FMT "[%d:%d %s %s-%s %zuB/%zu]"
-
-/** Printf arguments for dumping usb_transfer_batch_t.
- * @param batch USB transfer batch to be dumped.
- */
-#define USB_TRANSFER_BATCH_ARGS(batch) \
-	((batch).ep->device->address), ((batch).ep->endpoint), \
-	usb_str_speed((batch).ep->device->speed), \
-	usb_str_transfer_type_short((batch).ep->transfer_type), \
-	usb_str_direction((batch).dir), \
-	(batch).size, (batch).ep->max_packet_size
-
-/** Wrapper for bus operation. */
-usb_transfer_batch_t *usb_transfer_batch_create(endpoint_t *);
-
-/** Batch initializer. */
-void usb_transfer_batch_init(usb_transfer_batch_t *, endpoint_t *);
-
-/** Buffer handling */
-bool usb_transfer_batch_bounce_required(usb_transfer_batch_t *);
-errno_t usb_transfer_batch_bounce(usb_transfer_batch_t *);
-
-/** Batch finalization. */
-void usb_transfer_batch_finish(usb_transfer_batch_t *);
-
-/** To be called from outside only when the transfer is not going to be finished
- * (i.o.w. until successfuly scheduling)
- */
-void usb_transfer_batch_destroy(usb_transfer_batch_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/utility.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/utility.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief USB host controller library: Utility functions.
- *
- * A mix of various functions that makes life of USB HC driver developers
- * easier.
- */
-#ifndef LIB_USBHOST_UTILITY
-#define LIB_USBHOST_UTILITY
-
-#include <usb/host/bus.h>
-#include <usb/host/usb_transfer_batch.h>
-#include <usb/descriptor.h>
-#include <usb/classes/hub.h>
-#include <usb/request.h>
-
-typedef void (*endpoint_reset_toggle_t)(endpoint_t *);
-
-uint16_t hc_get_ep0_initial_mps(usb_speed_t);
-int hc_get_ep0_max_packet_size(uint16_t *, device_t *);
-void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t);
-int hc_setup_virtual_root_hub(hc_device_t *, usb_speed_t);
-int hc_get_device_desc(device_t *, usb_standard_device_descriptor_t *);
-int hc_get_hub_desc(device_t *, usb_hub_descriptor_header_t *);
-int hc_device_explore(device_t *);
-
-/** Joinable fibril */
-
-typedef int (*fibril_worker_t)(void *);
-typedef struct joinable_fibril joinable_fibril_t;
-
-joinable_fibril_t *joinable_fibril_create(fibril_worker_t, void *);
-void joinable_fibril_start(joinable_fibril_t *);
-void joinable_fibril_join(joinable_fibril_t *);
-void joinable_fibril_destroy(joinable_fibril_t *);
-errno_t joinable_fibril_recreate(joinable_fibril_t *);
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhost/include/usb/host/utils/malloc32.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/utils/malloc32.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup drvusbehci
- * @{
- */
-/** @file
- * @brief EHCI driver
- */
-#ifndef DRV_EHCI_UTILS_MALLOC32_H
-#define DRV_EHCI_UTILS_MALLOC32_H
-
-#include <align.h>
-#include <as.h>
-#include <ddi.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * Generic TDs and EDs require 16byte alignment,
- * Isochronous TD require 32byte alignment,
- * buffers do not have to be aligned.
- */
-#define EHCI_ALIGN   32
-
-#define EHCI_REQUIRED_PAGE_SIZE   4096
-
-/** Get physical address translation
- *
- * @param[in] addr Virtual address to translate
- * @return Physical address if exists, NULL otherwise.
- */
-static inline uintptr_t addr_to_phys(const void *addr)
-{
-	uintptr_t result;
-	errno_t ret = as_get_physical_mapping(addr, &result);
-
-	if (ret != EOK)
-		return 0;
-
-	return result;
-}
-
-/** Physical mallocator simulator
- *
- * @param[in] size Size of the required memory space
- * @return Address of the aligned and big enough memory place, NULL on failure.
- */
-static inline void *malloc32(size_t size)
-{
-	uintptr_t phys;
-	void *address = AS_AREA_ANY;
-	size_t real_size = ALIGN_UP(size, PAGE_SIZE);
-
-	const errno_t ret = dmamem_map_anonymous(real_size,
-	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
-	    &address);
-
-	if (ret == EOK) {
-		/*
-		 * Poison, accessing it should be enough to make sure
-		 * the location is mapped, but poison works better
-		 */
-		memset(address, 0x5, real_size);
-		return address;
-	}
-	return NULL;
-}
-
-/** Physical mallocator simulator
- *
- * @param[in] addr Address of the place allocated by malloc32
- */
-static inline void free32(void *addr)
-{
-	dmamem_unmap_anonymous(addr);
-}
-
-/** Create 4KB page mapping
- *
- * @return Address of the mapped page, NULL on failure.
- */
-static inline void *get_page()
-{
-	return malloc32(PAGE_SIZE);
-}
-
-static inline void return_page(void *page)
-{
-	free32(page);
-}
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbhost/meson.build
===================================================================
--- uspace/lib/usbhost/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'usb' , 'drv' ]
-private_includes += include_directories('include/usb/host')
-src = files(
-	'src/ddf_helpers.c',
-	'src/endpoint.c',
-	'src/hcd.c',
-	'src/bus.c',
-	'src/usb2_bus.c',
-	'src/bandwidth.c',
-	'src/utility.c',
-	'src/usb_transfer_batch.c',
-)
Index: pace/lib/usbhost/src/bandwidth.c
===================================================================
--- uspace/lib/usbhost/src/bandwidth.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * Bandwidth calculation functions. Shared among uhci, ohci and ehci drivers.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include "endpoint.h"
-#include "bus.h"
-
-#include "bandwidth.h"
-
-/** Bytes per second in FULL SPEED */
-#define BANDWIDTH_TOTAL_USB11 (12000000 / 8)
-/** 90% of total bandwidth is available for periodic transfers */
-#define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 * 9) / 10)
-
-/**
- * Calculate bandwidth that needs to be reserved for communication with EP.
- * Calculation follows USB 1.1 specification.
- *
- * @param ep An endpoint for which the bandwidth is to be counted
- */
-static size_t bandwidth_count_usb11(endpoint_t *ep)
-{
-	assert(ep);
-	assert(ep->device);
-
-	const usb_transfer_type_t type = ep->transfer_type;
-
-	/* We care about bandwidth only for interrupt and isochronous. */
-	if ((type != USB_TRANSFER_INTERRUPT) &&
-	    (type != USB_TRANSFER_ISOCHRONOUS)) {
-		return 0;
-	}
-
-	const size_t max_packet_size = ep->max_packet_size;
-	const size_t packet_count = ep->packets_per_uframe;
-
-	/*
-	 * TODO: It may be that ISO and INT transfers use only one packet per
-	 * transaction, but I did not find text in USB spec to confirm this
-	 */
-	/* NOTE: All data packets will be considered to be max_packet_size */
-	switch (ep->device->speed) {
-	case USB_SPEED_LOW:
-		assert(type == USB_TRANSFER_INTERRUPT);
-		/*
-		 * Protocol overhead 13B
-		 * (3 SYNC bytes, 3 PID bytes, 2 Endpoint + CRC bytes, 2
-		 * CRC bytes, and a 3-byte interpacket delay)
-		 * see USB spec page 45-46.
-		 */
-		/* Speed penalty 8: low speed is 8-times slower */
-		return packet_count * (13 + max_packet_size) * 8;
-	case USB_SPEED_FULL:
-		/*
-		 * Interrupt transfer overhead see above
-		 * or page 45 of USB spec
-		 */
-		if (type == USB_TRANSFER_INTERRUPT)
-			return packet_count * (13 + max_packet_size);
-
-		assert(type == USB_TRANSFER_ISOCHRONOUS);
-		/*
-		 * Protocol overhead 9B
-		 * (2 SYNC bytes, 2 PID bytes, 2 Endpoint + CRC bytes, 2 CRC
-		 * bytes, and a 1-byte interpacket delay)
-		 * see USB spec page 42
-		 */
-		return packet_count * (9 + max_packet_size);
-	default:
-		return 0;
-	}
-}
-
-const bandwidth_accounting_t bandwidth_accounting_usb11 = {
-	.available_bandwidth = BANDWIDTH_AVAILABLE_USB11,
-	.count_bw = &bandwidth_count_usb11,
-};
-
-/** Number of nanoseconds in one microframe */
-#define BANDWIDTH_TOTAL_USB2 (125000)
-/** 90% of total bandwidth is available for periodic transfers */
-#define BANDWIDTH_AVAILABLE_USB2  ((BANDWIDTH_TOTAL_USB2 * 9) / 10)
-
-/**
- * Calculate bandwidth that needs to be reserved for communication with EP.
- * Calculation follows USB 2.0 specification, chapter 5.11.3.
- *
- * FIXME: Interrupt transfers shall be probably divided by their polling interval.
- *
- * @param ep An endpoint for which the bandwidth is to be counted
- * @return Number of nanoseconds transaction with @c size bytes payload will
- *         take.
- */
-static size_t bandwidth_count_usb2(endpoint_t *ep)
-{
-	assert(ep);
-	assert(ep->device);
-
-	const usb_transfer_type_t type = ep->transfer_type;
-
-	/* We care about bandwidth only for interrupt and isochronous. */
-	if ((type != USB_TRANSFER_INTERRUPT) &&
-	    (type != USB_TRANSFER_ISOCHRONOUS)) {
-		return 0;
-	}
-
-	// FIXME: Come up with some upper bound for these (in ns).
-	const size_t host_delay = 0;
-	const size_t hub_ls_setup = 0;
-
-	// Approx. Floor(3.167 + BitStuffTime(Data_bc))
-	const size_t base_time = (ep->max_transfer_size * 8 + 19) / 6;
-
-	switch (ep->device->speed) {
-	case USB_SPEED_LOW:
-		if (ep->direction == USB_DIRECTION_IN)
-			return 64060 + (2 * hub_ls_setup) +
-			    (677 * base_time) + host_delay;
-		else
-			return 64107 + (2 * hub_ls_setup) +
-			    (667 * base_time) + host_delay;
-
-	case USB_SPEED_FULL:
-		if (ep->transfer_type == USB_TRANSFER_INTERRUPT)
-			return 9107 + 84 * base_time + host_delay;
-
-		if (ep->direction == USB_DIRECTION_IN)
-			return 7268 + 84 * base_time + host_delay;
-		else
-			return 6265 + 84 * base_time + host_delay;
-
-	case USB_SPEED_HIGH:
-		if (ep->transfer_type == USB_TRANSFER_INTERRUPT)
-			return (3648 + 25 * base_time + 11) / 12 + host_delay;
-		else
-			return (5280 + 25 * base_time + 11) / 12 + host_delay;
-
-	default:
-		return 0;
-	}
-}
-
-const bandwidth_accounting_t bandwidth_accounting_usb2 = {
-	.available_bandwidth = BANDWIDTH_AVAILABLE_USB2,
-	.count_bw = &bandwidth_count_usb2,
-};
Index: pace/lib/usbhost/src/bus.c
===================================================================
--- uspace/lib/usbhost/src/bus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,690 +1,0 @@
-/*
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * The Bus is a structure that serves as an interface of the HC driver
- * implementation for the usbhost library. Every HC driver that uses libusbhost
- * must use a bus_t (or its child), fill it with bus_ops and present it to the
- * library. The library then handles the DDF interface and translates it to the
- * bus callbacks.
- */
-
-#include <ddf/driver.h>
-#include <errno.h>
-#include <mem.h>
-#include <macros.h>
-#include <stdio.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/dma_buffer.h>
-
-#include "endpoint.h"
-#include "bus.h"
-
-/**
- * Initializes the base bus structure.
- */
-void bus_init(bus_t *bus, size_t device_size)
-{
-	assert(bus);
-	assert(device_size >= sizeof(device_t));
-	memset(bus, 0, sizeof(bus_t));
-
-	fibril_mutex_initialize(&bus->guard);
-	bus->device_size = device_size;
-}
-
-/**
- * Initialize the device_t structure belonging to a bus.
- */
-int bus_device_init(device_t *dev, bus_t *bus)
-{
-	assert(bus);
-
-	memset(dev, 0, sizeof(*dev));
-
-	dev->bus = bus;
-
-	link_initialize(&dev->link);
-	list_initialize(&dev->devices);
-	fibril_mutex_initialize(&dev->guard);
-
-	return EOK;
-}
-
-/**
- * Create a name of the ddf function node.
- */
-int bus_device_set_default_name(device_t *dev)
-{
-	assert(dev);
-	assert(dev->fun);
-
-	char buf[12] = { 0 }; /* usbxyz-ss */
-	snprintf(buf, sizeof(buf), "usb%u-%cs",
-	    dev->address, usb_str_speed(dev->speed)[0]);
-
-	return ddf_fun_set_name(dev->fun, buf);
-}
-
-/**
- * Setup devices Transaction Translation.
- *
- * This applies for Low/Full speed devices under High speed hub only. Other
- * devices just inherit TT from the hub.
- *
- * Roothub must be handled specially.
- */
-static void device_setup_tt(device_t *dev)
-{
-	if (!dev->hub)
-		return;
-
-	if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
-		/* For LS devices under HS hub */
-		dev->tt.dev = dev->hub;
-		dev->tt.port = dev->port;
-	} else {
-		/* Inherit hub's TT */
-		dev->tt = dev->hub->tt;
-	}
-}
-
-/**
- * Invoke the device_enumerate bus operation.
- *
- * There's no need to synchronize here, because no one knows the device yet.
- */
-int bus_device_enumerate(device_t *dev)
-{
-	assert(dev);
-
-	if (!dev->bus->ops->device_enumerate)
-		return ENOTSUP;
-
-	if (dev->online)
-		return EINVAL;
-
-	device_setup_tt(dev);
-
-	const int r = dev->bus->ops->device_enumerate(dev);
-	if (r)
-		return r;
-
-	dev->online = true;
-
-	if (dev->hub) {
-		fibril_mutex_lock(&dev->hub->guard);
-		list_append(&dev->link, &dev->hub->devices);
-		fibril_mutex_unlock(&dev->hub->guard);
-	}
-
-	return EOK;
-}
-
-/**
- * Clean endpoints and children that could have been left behind after
- * asking the driver of device to offline/remove a device.
- *
- * Note that EP0's lifetime is shared with the device, and as such is not
- * touched.
- */
-static void device_clean_ep_children(device_t *dev, const char *op)
-{
-	assert(fibril_mutex_is_locked(&dev->guard));
-
-	/* Unregister endpoints left behind. */
-	for (usb_endpoint_t i = 1; i < USB_ENDPOINT_MAX; ++i) {
-		if (!dev->endpoints[i])
-			continue;
-
-		usb_log_warning("USB device '%s' driver left endpoint %u registered after %s.",
-		    ddf_fun_get_name(dev->fun), i, op);
-
-		endpoint_t *const ep = dev->endpoints[i];
-		endpoint_add_ref(ep);
-
-		fibril_mutex_unlock(&dev->guard);
-		const int err = bus_endpoint_remove(ep);
-		if (err)
-			usb_log_warning("Endpoint %u cannot be removed. "
-			    "Some deffered cleanup was faster?", ep->endpoint);
-
-		endpoint_del_ref(ep);
-		fibril_mutex_lock(&dev->guard);
-	}
-
-	for (usb_endpoint_t i = 1; i < USB_ENDPOINT_MAX; ++i)
-		assert(dev->endpoints[i] == NULL);
-
-	/* Remove also orphaned children. */
-	while (!list_empty(&dev->devices)) {
-		device_t *const child = list_get_instance(list_first(&dev->devices), device_t, link);
-
-		/*
-		 * This is not an error condition, as devices cannot remove
-		 * their children devices while they are removed, because for
-		 * DDF, they are siblings.
-		 */
-		usb_log_debug("USB device '%s' driver left device '%s' behind after %s.",
-		    ddf_fun_get_name(dev->fun), ddf_fun_get_name(child->fun), op);
-
-		/*
-		 * The child node won't disappear, because its parent's driver
-		 * is already dead. And the child will need the guard to remove
-		 * itself from the list.
-		 */
-		fibril_mutex_unlock(&dev->guard);
-		bus_device_gone(child);
-		fibril_mutex_lock(&dev->guard);
-	}
-	assert(list_empty(&dev->devices));
-}
-
-/**
- * Resolve a USB device that is gone.
- */
-void bus_device_gone(device_t *dev)
-{
-	assert(dev);
-	assert(dev->fun != NULL);
-
-	const bus_ops_t *ops = dev->bus->ops;
-
-	/* First, block new transfers and operations. */
-	fibril_mutex_lock(&dev->guard);
-	dev->online = false;
-
-	/* Unbinding will need guard unlocked. */
-	fibril_mutex_unlock(&dev->guard);
-
-	/* Remove our device from our hub's children. */
-	if (dev->hub) {
-		fibril_mutex_lock(&dev->hub->guard);
-		list_remove(&dev->link);
-		fibril_mutex_unlock(&dev->hub->guard);
-	}
-
-	/*
-	 * Unbind the DDF function. That will result in dev_gone called in
-	 * driver, which shall destroy its pipes and remove its children.
-	 */
-	const int err = ddf_fun_unbind(dev->fun);
-	if (err) {
-		usb_log_error("Failed to unbind USB device '%s': %s",
-		    ddf_fun_get_name(dev->fun), str_error(err));
-		return;
-	}
-
-	/* Remove what driver left behind */
-	fibril_mutex_lock(&dev->guard);
-	device_clean_ep_children(dev, "removing");
-
-	/* Tell the HC to release its resources. */
-	if (ops->device_gone)
-		ops->device_gone(dev);
-
-	/* Check whether the driver didn't forgot EP0 */
-	if (dev->endpoints[0]) {
-		if (ops->endpoint_unregister)
-			ops->endpoint_unregister(dev->endpoints[0]);
-		/* Release the EP0 bus reference */
-		endpoint_del_ref(dev->endpoints[0]);
-	}
-
-	/* Destroy the function, freeing also the device, unlocking mutex. */
-	ddf_fun_destroy(dev->fun);
-}
-
-/**
- * The user wants this device back online.
- */
-int bus_device_online(device_t *dev)
-{
-	int rc;
-	assert(dev);
-
-	fibril_mutex_lock(&dev->guard);
-	if (dev->online) {
-		rc = EINVAL;
-		goto err_lock;
-	}
-
-	/* First, tell the HC driver. */
-	const bus_ops_t *ops = dev->bus->ops;
-	if (ops->device_online && (rc = ops->device_online(dev))) {
-		usb_log_warning("Host controller failed to make device '%s' online: %s",
-		    ddf_fun_get_name(dev->fun), str_error(rc));
-		goto err_lock;
-	}
-
-	/* Allow creation of new endpoints and communication with the device. */
-	dev->online = true;
-
-	/* Onlining will need the guard */
-	fibril_mutex_unlock(&dev->guard);
-
-	if ((rc = ddf_fun_online(dev->fun))) {
-		usb_log_warning("Failed to take device '%s' online: %s",
-		    ddf_fun_get_name(dev->fun), str_error(rc));
-		goto err;
-	}
-
-	usb_log_info("USB Device '%s' is now online.", ddf_fun_get_name(dev->fun));
-	return EOK;
-
-err_lock:
-	fibril_mutex_unlock(&dev->guard);
-err:
-	return rc;
-}
-
-/**
- * The user requested to take this device offline.
- */
-int bus_device_offline(device_t *dev)
-{
-	int rc;
-	assert(dev);
-
-	/* Make sure we're the one who offlines this device */
-	if (!dev->online) {
-		rc = ENOENT;
-		goto err;
-	}
-
-	/*
-	 * XXX: If the device is removed/offlined just now, this can fail on
-	 * assertion. We most probably need some kind of enum status field to
-	 * make the synchronization work.
-	 */
-
-	/* Tear down all drivers working with the device. */
-	if ((rc = ddf_fun_offline(dev->fun))) {
-		goto err;
-	}
-
-	fibril_mutex_lock(&dev->guard);
-	dev->online = false;
-	device_clean_ep_children(dev, "offlining");
-
-	/* Tell also the HC driver. */
-	const bus_ops_t *ops = dev->bus->ops;
-	if (ops->device_offline)
-		ops->device_offline(dev);
-
-	fibril_mutex_unlock(&dev->guard);
-	usb_log_info("USB Device '%s' is now offline.", ddf_fun_get_name(dev->fun));
-	return EOK;
-
-err:
-	return rc;
-}
-
-/**
- * Calculate an index to the endpoint array.
- * For the default control endpoint 0, it must return 0.
- * For different arguments, the result is stable but not defined.
- */
-static size_t bus_endpoint_index(usb_endpoint_t ep, usb_direction_t dir)
-{
-	return 2 * ep + (dir == USB_DIRECTION_OUT);
-}
-
-/**
- * Create and register new endpoint to the bus.
- *
- * @param[in] device The device of which the endpoint shall be created
- * @param[in] desc Endpoint descriptors as reported by the device
- * @param[out] out_ep The resulting new endpoint reference, if any. Can be NULL.
- */
-int bus_endpoint_add(device_t *device, const usb_endpoint_descriptors_t *desc, endpoint_t **out_ep)
-{
-	int err = EINVAL;
-	assert(device);
-
-	bus_t *bus = device->bus;
-
-	if (!bus->ops->endpoint_register)
-		return ENOTSUP;
-
-	endpoint_t *ep;
-	if (bus->ops->endpoint_create) {
-		ep = bus->ops->endpoint_create(device, desc);
-		if (!ep)
-			return ENOMEM;
-	} else {
-		ep = calloc(1, sizeof(endpoint_t));
-		if (!ep)
-			return ENOMEM;
-		endpoint_init(ep, device, desc);
-	}
-
-	assert((ep->required_transfer_buffer_policy & ~ep->transfer_buffer_policy) == 0);
-
-	const size_t idx = bus_endpoint_index(ep->endpoint, ep->direction);
-	if (idx >= ARRAY_SIZE(device->endpoints)) {
-		usb_log_warning("Invalid endpoint description (ep no %u out of "
-		    "bounds)", ep->endpoint);
-		goto drop;
-	}
-
-	if (ep->max_transfer_size == 0) {
-		usb_log_warning("Invalid endpoint description (mps %zu, "
-		    "%u packets)", ep->max_packet_size, ep->packets_per_uframe);
-		goto drop;
-	}
-
-	usb_log_debug("Register endpoint %d:%d %s-%s %zuB.",
-	    device->address, ep->endpoint,
-	    usb_str_transfer_type(ep->transfer_type),
-	    usb_str_direction(ep->direction),
-	    ep->max_transfer_size);
-
-	fibril_mutex_lock(&device->guard);
-	if (!device->online && ep->endpoint != 0) {
-		err = EAGAIN;
-	} else if (device->endpoints[idx] != NULL) {
-		err = EEXIST;
-	} else {
-		err = bus->ops->endpoint_register(ep);
-		if (!err)
-			device->endpoints[idx] = ep;
-	}
-	fibril_mutex_unlock(&device->guard);
-	if (err)
-		goto drop;
-
-	if (out_ep) {
-		/* Exporting reference */
-		endpoint_add_ref(ep);
-		*out_ep = ep;
-	}
-
-	return EOK;
-drop:
-	endpoint_del_ref(ep);
-	return err;
-}
-
-/**
- * Search for an endpoint. Returns a reference.
- */
-endpoint_t *bus_find_endpoint(device_t *device, usb_endpoint_t endpoint,
-    usb_direction_t dir)
-{
-	assert(device);
-
-	const size_t idx = bus_endpoint_index(endpoint, dir);
-	const size_t ctrl_idx = bus_endpoint_index(endpoint, USB_DIRECTION_BOTH);
-
-	endpoint_t *ep = NULL;
-
-	fibril_mutex_lock(&device->guard);
-	if (idx < ARRAY_SIZE(device->endpoints))
-		ep = device->endpoints[idx];
-	/*
-	 * If the endpoint was not found, it's still possible it is a control
-	 * endpoint having direction BOTH.
-	 */
-	if (!ep && ctrl_idx < ARRAY_SIZE(device->endpoints)) {
-		ep = device->endpoints[ctrl_idx];
-		if (ep && ep->transfer_type != USB_TRANSFER_CONTROL)
-			ep = NULL;
-	}
-	if (ep) {
-		/* Exporting reference */
-		endpoint_add_ref(ep);
-	}
-	fibril_mutex_unlock(&device->guard);
-	return ep;
-}
-
-/**
- * Remove an endpoint from the device.
- */
-int bus_endpoint_remove(endpoint_t *ep)
-{
-	assert(ep);
-	assert(ep->device);
-
-	device_t *device = ep->device;
-	if (!device)
-		return ENOENT;
-
-	bus_t *bus = device->bus;
-
-	if (!bus->ops->endpoint_unregister)
-		return ENOTSUP;
-
-	usb_log_debug("Unregister endpoint %d:%d %s-%s %zuB.",
-	    device->address, ep->endpoint,
-	    usb_str_transfer_type(ep->transfer_type),
-	    usb_str_direction(ep->direction),
-	    ep->max_transfer_size);
-
-	const size_t idx = bus_endpoint_index(ep->endpoint, ep->direction);
-
-	if (idx >= ARRAY_SIZE(device->endpoints))
-		return EINVAL;
-
-	fibril_mutex_lock(&device->guard);
-
-	/* Check whether the endpoint is registered */
-	if (device->endpoints[idx] != ep) {
-		fibril_mutex_unlock(&device->guard);
-		return EINVAL;
-	}
-
-	bus->ops->endpoint_unregister(ep);
-	device->endpoints[idx] = NULL;
-	fibril_mutex_unlock(&device->guard);
-
-	/* Bus reference */
-	endpoint_del_ref(ep);
-
-	return EOK;
-}
-
-/**
- * Reserve the default address on the bus for the specified device (hub).
- */
-int bus_reserve_default_address(bus_t *bus, device_t *dev)
-{
-	assert(bus);
-
-	int err;
-	fibril_mutex_lock(&bus->guard);
-	if (bus->default_address_owner != NULL) {
-		err = (bus->default_address_owner == dev) ? EINVAL : EAGAIN;
-	} else {
-		bus->default_address_owner = dev;
-		err = EOK;
-	}
-	fibril_mutex_unlock(&bus->guard);
-	return err;
-}
-
-/**
- * Release the default address.
- */
-void bus_release_default_address(bus_t *bus, device_t *dev)
-{
-	assert(bus);
-
-	fibril_mutex_lock(&bus->guard);
-	if (bus->default_address_owner != dev) {
-		usb_log_error("Device %d tried to release default address, "
-		    "which is not reserved for it.", dev->address);
-	} else {
-		bus->default_address_owner = NULL;
-	}
-	fibril_mutex_unlock(&bus->guard);
-}
-
-/**
- * Assert some conditions on transfer request. As the request is an entity of
- * HC driver only, we can force these conditions harder. Invalid values from
- * devices shall be caught on DDF interface already.
- */
-static void check_request(const transfer_request_t *request)
-{
-	assert(usb_target_is_valid(&request->target));
-	assert(request->dir != USB_DIRECTION_BOTH);
-	/* Non-zero offset => size is non-zero */
-	assert(request->offset == 0 || request->size != 0);
-	/* Non-zero size => buffer is set */
-	assert(request->size == 0 || dma_buffer_is_set(&request->buffer));
-	/* Non-null arg => callback is set */
-	assert(request->arg == NULL || request->on_complete != NULL);
-	assert(request->name);
-}
-
-/**
- * Initiate a transfer with given device.
- *
- * @return Error code.
- */
-int bus_issue_transfer(device_t *device, const transfer_request_t *request)
-{
-	assert(device);
-	assert(request);
-
-	check_request(request);
-	assert(device->address == request->target.address);
-
-	/* Temporary reference */
-	endpoint_t *ep = bus_find_endpoint(device, request->target.endpoint, request->dir);
-	if (ep == NULL) {
-		usb_log_error("Endpoint(%d:%d) not registered for %s.",
-		    device->address, request->target.endpoint, request->name);
-		return ENOENT;
-	}
-
-	assert(ep->device == device);
-
-	const int err = endpoint_send_batch(ep, request);
-
-	/* Temporary reference */
-	endpoint_del_ref(ep);
-
-	return err;
-}
-
-/**
- * A structure to pass data from the completion callback to the caller.
- */
-typedef struct {
-	fibril_mutex_t done_mtx;
-	fibril_condvar_t done_cv;
-	bool done;
-
-	size_t transferred_size;
-	int error;
-} sync_data_t;
-
-/**
- * Callback for finishing the transfer. Wake the issuing thread.
- */
-static int sync_transfer_complete(void *arg, int error, size_t transferred_size)
-{
-	sync_data_t *d = arg;
-	assert(d);
-	d->transferred_size = transferred_size;
-	d->error = error;
-	fibril_mutex_lock(&d->done_mtx);
-	d->done = true;
-	fibril_condvar_broadcast(&d->done_cv);
-	fibril_mutex_unlock(&d->done_mtx);
-	return EOK;
-}
-
-/**
- * Issue a transfer on the bus, wait for the result.
- *
- * @param device Device for which to send the batch
- * @param target The target of the transfer.
- * @param direction A direction of the transfer.
- * @param data A pointer to the data buffer.
- * @param size Size of the data buffer.
- * @param setup_data Data to use in the setup stage (Control communication type)
- * @param name Communication identifier (for nicer output).
- */
-errno_t bus_device_send_batch_sync(device_t *device, usb_target_t target,
-    usb_direction_t direction, char *data, size_t size, uint64_t setup_data,
-    const char *name, size_t *transferred_size)
-{
-	int err;
-	sync_data_t sd = { .done = false };
-	fibril_mutex_initialize(&sd.done_mtx);
-	fibril_condvar_initialize(&sd.done_cv);
-
-	transfer_request_t request = {
-		.target = target,
-		.dir = direction,
-		.offset = ((uintptr_t) data) % PAGE_SIZE,
-		.size = size,
-		.setup = setup_data,
-		.on_complete = sync_transfer_complete,
-		.arg = &sd,
-		.name = name,
-	};
-
-	if (data &&
-	    (err = dma_buffer_lock(&request.buffer, data - request.offset, size)))
-		return err;
-
-	if ((err = bus_issue_transfer(device, &request))) {
-		dma_buffer_unlock(&request.buffer, size);
-		return err;
-	}
-
-	/*
-	 * Note: There are requests that are completed synchronously. It is not
-	 *       therefore possible to just lock the mutex before and wait.
-	 */
-	fibril_mutex_lock(&sd.done_mtx);
-	while (!sd.done)
-		fibril_condvar_wait(&sd.done_cv, &sd.done_mtx);
-	fibril_mutex_unlock(&sd.done_mtx);
-
-	dma_buffer_unlock(&request.buffer, size);
-
-	if (transferred_size)
-		*transferred_size = sd.transferred_size;
-
-	return sd.error;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/ddf_helpers.c
===================================================================
--- uspace/lib/usbhost/src/ddf_helpers.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,529 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- * Helpers to work with the DDF interface.
- */
-
-#include <adt/list.h>
-#include <assert.h>
-#include <async.h>
-#include <ddf/driver.h>
-#include <ddf/interrupt.h>
-#include <device/hw_res_parsed.h>
-#include <errno.h>
-#include <str_error.h>
-#include <usb/classes/classes.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/usb.h>
-#include <usb/dma_buffer.h>
-#include <usb_iface.h>
-#include <usbhc_iface.h>
-
-#include "bus.h"
-#include "endpoint.h"
-
-#include "ddf_helpers.h"
-
-/**
- * DDF usbhc_iface callback. Passes the endpoint descriptors, fills the pipe
- * descriptor according to the contents of the endpoint.
- *
- * @param[in] fun DDF function of the device in question.
- * @param[out] pipe_desc The pipe descriptor to be filled.
- * @param[in] endpoint_desc Endpoint descriptors from the device.
- * @return Error code.
- */
-static errno_t register_endpoint(ddf_fun_t *fun, usb_pipe_desc_t *pipe_desc,
-    const usb_endpoint_descriptors_t *ep_desc)
-{
-	assert(fun);
-	hc_device_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(hcd);
-	assert(hcd->bus);
-	assert(dev);
-
-	endpoint_t *ep;
-	const int err = bus_endpoint_add(dev, ep_desc, &ep);
-	if (err)
-		return err;
-
-	if (pipe_desc) {
-		pipe_desc->endpoint_no = ep->endpoint;
-		pipe_desc->direction = ep->direction;
-		pipe_desc->transfer_type = ep->transfer_type;
-		pipe_desc->max_transfer_size = ep->max_transfer_size;
-		pipe_desc->transfer_buffer_policy = ep->transfer_buffer_policy;
-	}
-	endpoint_del_ref(ep);
-
-	return EOK;
-}
-
-/**
- * DDF usbhc_iface callback. Unregister endpoint that makes the other end of
- * the pipe described.
- *
- * @param fun DDF function of the device in question.
- * @param pipe_desc Pipe description.
- * @return Error code.
- */
-static errno_t unregister_endpoint(ddf_fun_t *fun, const usb_pipe_desc_t *pipe_desc)
-{
-	assert(fun);
-	hc_device_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(hcd);
-	assert(hcd->bus);
-	assert(dev);
-
-	endpoint_t *ep = bus_find_endpoint(dev, pipe_desc->endpoint_no, pipe_desc->direction);
-	if (!ep)
-		return ENOENT;
-
-	const errno_t err = bus_endpoint_remove(ep);
-
-	endpoint_del_ref(ep);
-	return err;
-}
-
-/**
- * DDF usbhc_iface callback. Calls the respective bus operation directly.
- *
- * @param fun DDF function of the device (hub) requesting the address.
- */
-static errno_t default_address_reservation(ddf_fun_t *fun, bool reserve)
-{
-	assert(fun);
-	hc_device_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(hcd);
-	assert(hcd->bus);
-	assert(dev);
-
-	usb_log_debug("Device %d %s default address", dev->address, reserve ? "requested" : "releasing");
-	if (reserve) {
-		return bus_reserve_default_address(hcd->bus, dev);
-	} else {
-		bus_release_default_address(hcd->bus, dev);
-		return EOK;
-	}
-}
-
-/**
- * DDF usbhc_iface callback. Calls the bus operation directly.
- *
- * @param fun DDF function of the device (hub) requesting the address.
- * @param speed USB speed of the new device
- */
-static errno_t device_enumerate(ddf_fun_t *fun, unsigned port, usb_speed_t speed)
-{
-	assert(fun);
-	ddf_dev_t *hc = ddf_fun_get_dev(fun);
-	assert(hc);
-	hc_device_t *hcd = dev_to_hcd(hc);
-	assert(hcd);
-	device_t *hub = ddf_fun_data_get(fun);
-	assert(hub);
-
-	errno_t err;
-
-	if (!usb_speed_is_valid(speed))
-		return EINVAL;
-
-	usb_log_debug("Hub %d reported a new %s speed device on port: %u",
-	    hub->address, usb_str_speed(speed), port);
-
-	device_t *dev = hcd_ddf_fun_create(hcd, speed);
-	if (!dev) {
-		usb_log_error("Failed to create USB device function.");
-		return ENOMEM;
-	}
-
-	dev->hub = hub;
-	dev->tier = hub->tier + 1;
-	dev->port = port;
-	dev->speed = speed;
-
-	if ((err = bus_device_enumerate(dev))) {
-		usb_log_error("Failed to initialize USB dev memory structures.");
-		goto err_usb_dev;
-	}
-
-	/*
-	 * If the driver didn't name the dev when enumerating,
-	 * do it in some generic way.
-	 */
-	if (!ddf_fun_get_name(dev->fun)) {
-		bus_device_set_default_name(dev);
-	}
-
-	if ((err = ddf_fun_bind(dev->fun))) {
-		usb_log_error("Device(%d): Failed to register: %s.", dev->address, str_error(err));
-		goto err_usb_dev;
-	}
-
-	return EOK;
-
-err_usb_dev:
-	hcd_ddf_fun_destroy(dev);
-	return err;
-}
-
-static errno_t device_remove(ddf_fun_t *fun, unsigned port)
-{
-	assert(fun);
-	device_t *hub = ddf_fun_data_get(fun);
-	assert(hub);
-	usb_log_debug("Hub `%s' reported removal of device on port %u",
-	    ddf_fun_get_name(fun), port);
-
-	device_t *victim = NULL;
-
-	fibril_mutex_lock(&hub->guard);
-	list_foreach(hub->devices, link, device_t, it) {
-		if (it->port == port) {
-			victim = it;
-			break;
-		}
-	}
-	fibril_mutex_unlock(&hub->guard);
-
-	if (!victim) {
-		usb_log_warning("Hub '%s' tried to remove non-existent"
-		    " device.", ddf_fun_get_name(fun));
-		return ENOENT;
-	}
-
-	assert(victim->fun);
-	assert(victim->port == port);
-	assert(victim->hub == hub);
-
-	bus_device_gone(victim);
-	return EOK;
-}
-
-/**
- * Gets description of the device that is calling.
- *
- * @param[in] fun Device function.
- * @param[out] desc Device descriptor to be filled.
- * @return Error code.
- */
-static errno_t get_device_description(ddf_fun_t *fun, usb_device_desc_t *desc)
-{
-	assert(fun);
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(dev);
-
-	if (!desc)
-		return EOK;
-
-	*desc = (usb_device_desc_t) {
-		.address = dev->address,
-		.depth = dev->tier,
-		.speed = dev->speed,
-		.handle = ddf_fun_get_handle(fun),
-		.iface = -1,
-	};
-	return EOK;
-}
-
-/**
- * Transfer issuing interface function.
- *
- * @param fun DDF function.
- * @param target Communication target.
- * @param dir Communication direction.
- * @param setup_data Data to use in setup stage (control transfers).
- * @param data Pointer to data buffer.
- * @param size Size of the data buffer.
- * @param callback Function to call on communication end.
- * @param arg Argument passed to the callback function.
- * @return Error code.
- */
-static errno_t transfer(ddf_fun_t *fun,
-    const usbhc_iface_transfer_request_t *ifreq,
-    usbhc_iface_transfer_callback_t callback, void *arg)
-{
-	assert(fun);
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(dev);
-
-	const usb_target_t target = {
-		{
-			.address = dev->address,
-			.endpoint = ifreq->endpoint,
-			.stream = ifreq->stream,
-		}
-	};
-
-	if (!usb_target_is_valid(&target))
-		return EINVAL;
-
-	if (ifreq->offset > 0 && ifreq->size == 0)
-		return EINVAL;
-
-	if (ifreq->size > 0 && !dma_buffer_is_set(&ifreq->buffer))
-		return EBADMEM;
-
-	if (!callback && arg)
-		return EBADMEM;
-
-	const transfer_request_t request = {
-		.target = target,
-		.dir = ifreq->dir,
-		.buffer = ifreq->buffer,
-		.offset = ifreq->offset,
-		.size = ifreq->size,
-		.setup = ifreq->setup,
-		.on_complete = callback,
-		.arg = arg,
-		.name = (ifreq->dir == USB_DIRECTION_IN) ? "READ" : "WRITE",
-	};
-
-	return bus_issue_transfer(dev, &request);
-}
-
-/** USB device interface */
-static usb_iface_t usb_iface = {
-	.get_my_description = get_device_description,
-};
-
-/** USB host controller interface */
-static usbhc_iface_t usbhc_iface = {
-	.default_address_reservation = default_address_reservation,
-
-	.device_enumerate = device_enumerate,
-	.device_remove = device_remove,
-
-	.register_endpoint = register_endpoint,
-	.unregister_endpoint = unregister_endpoint,
-
-	.transfer = transfer,
-};
-
-/** Standard USB device interface) */
-static ddf_dev_ops_t usb_ops = {
-	.interfaces[USB_DEV_IFACE] = &usb_iface,
-	.interfaces[USBHC_DEV_IFACE] = &usbhc_iface,
-};
-
-/* DDF HELPERS */
-
-#define ADD_MATCHID_OR_RETURN(list, sc, str, ...) \
-do { \
-	match_id_t *mid = malloc(sizeof(match_id_t)); \
-	if (!mid) { \
-		clean_match_ids(list); \
-		return ENOMEM; \
-	} \
-	char *id = NULL; \
-	int ret = asprintf(&id, str, ##__VA_ARGS__); \
-	if (ret < 0) { \
-		clean_match_ids(list); \
-		free(mid); \
-		return ENOMEM; \
-	} \
-	mid->score = sc; \
-	mid->id = id; \
-	add_match_id(list, mid); \
-} while (0)
-
-/* This is a copy of lib/usbdev/src/recognise.c */
-static errno_t create_match_ids(match_id_list_t *l,
-    usb_standard_device_descriptor_t *d)
-{
-	assert(l);
-	assert(d);
-
-	if (d->vendor_id != 0) {
-		/* First, with release number. */
-		ADD_MATCHID_OR_RETURN(l, 100,
-		    "usb&vendor=%#06x&product=%#06x&release=%x.%x",
-		    d->vendor_id, d->product_id, (d->device_version >> 8),
-		    (d->device_version & 0xff));
-
-		/* Next, without release number. */
-		ADD_MATCHID_OR_RETURN(l, 90, "usb&vendor=%#06x&product=%#06x",
-		    d->vendor_id, d->product_id);
-	}
-
-	/* Class match id */
-	ADD_MATCHID_OR_RETURN(l, 50, "usb&class=%s",
-	    usb_str_class(d->device_class));
-
-	/* As a last resort, try fallback driver. */
-	ADD_MATCHID_OR_RETURN(l, 10, "usb&fallback");
-
-	return EOK;
-}
-
-device_t *hcd_ddf_fun_create(hc_device_t *hc, usb_speed_t speed)
-{
-	/* Create DDF function for the new device */
-	ddf_fun_t *fun = ddf_fun_create(hc->ddf_dev, fun_inner, NULL);
-	if (!fun)
-		return NULL;
-
-	ddf_fun_set_ops(fun, &usb_ops);
-
-	/* Create USB device node for the new device */
-	device_t *dev = ddf_fun_data_alloc(fun, hc->bus->device_size);
-	if (!dev) {
-		ddf_fun_destroy(fun);
-		return NULL;
-	}
-
-	bus_device_init(dev, hc->bus);
-	dev->fun = fun;
-	dev->speed = speed;
-	return dev;
-}
-
-void hcd_ddf_fun_destroy(device_t *dev)
-{
-	assert(dev);
-	assert(dev->fun);
-	ddf_fun_destroy(dev->fun);
-}
-
-errno_t hcd_ddf_setup_match_ids(device_t *device, usb_standard_device_descriptor_t *desc)
-{
-	errno_t err;
-	match_id_list_t mids;
-
-	init_match_ids(&mids);
-
-	/* Create match ids from the device descriptor */
-	usb_log_debug("Device(%d): Creating match IDs.", device->address);
-	if ((err = create_match_ids(&mids, desc))) {
-		return err;
-	}
-
-	list_foreach(mids.ids, link, const match_id_t, mid) {
-		ddf_fun_add_match_id(device->fun, mid->id, mid->score);
-	}
-
-	return EOK;
-}
-
-/** Initialize hc structures.
- *
- * @param[in] device DDF instance of the device to use.
- * @param[in] max_speed Maximum supported USB speed.
- * @param[in] bw available bandwidth.
- * @param[in] bw_count Function to compute required ep bandwidth.
- *
- * @return Error code.
- * This function does all the ddf work for hc driver.
- */
-errno_t hcd_ddf_setup_hc(ddf_dev_t *device, size_t size)
-{
-	assert(device);
-
-	hc_device_t *instance = ddf_dev_data_alloc(device, size);
-	if (instance == NULL) {
-		usb_log_error("Failed to allocate HCD ddf structure.");
-		return ENOMEM;
-	}
-	instance->ddf_dev = device;
-
-	errno_t ret = ENOMEM;
-	instance->ctl_fun = ddf_fun_create(device, fun_exposed, "ctl");
-	if (!instance->ctl_fun) {
-		usb_log_error("Failed to create HCD ddf fun.");
-		goto err_destroy_fun;
-	}
-
-	ret = ddf_fun_bind(instance->ctl_fun);
-	if (ret != EOK) {
-		usb_log_error("Failed to bind ctl_fun: %s.", str_error(ret));
-		goto err_destroy_fun;
-	}
-
-	ret = ddf_fun_add_to_category(instance->ctl_fun, USB_HC_CATEGORY);
-	if (ret != EOK) {
-		usb_log_error("Failed to add fun to category: %s.",
-		    str_error(ret));
-		ddf_fun_unbind(instance->ctl_fun);
-		goto err_destroy_fun;
-	}
-
-	/* HC should be ok at this point (except it can't do anything) */
-	return EOK;
-
-err_destroy_fun:
-	ddf_fun_destroy(instance->ctl_fun);
-	instance->ctl_fun = NULL;
-	return ret;
-}
-
-void hcd_ddf_clean_hc(hc_device_t *hcd)
-{
-	if (ddf_fun_unbind(hcd->ctl_fun) == EOK)
-		ddf_fun_destroy(hcd->ctl_fun);
-}
-
-/** Call the parent driver with a request to enable interrupt
- *
- * @param[in] device Device asking for interrupts
- * @param[in] inum Interrupt number
- * @return Error code.
- */
-errno_t hcd_ddf_enable_interrupt(hc_device_t *hcd, int inum)
-{
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(hcd->ddf_dev);
-	if (parent_sess == NULL)
-		return EIO;
-
-	return hw_res_enable_interrupt(parent_sess, inum);
-}
-
-errno_t hcd_ddf_get_registers(hc_device_t *hcd, hw_res_list_parsed_t *hw_res)
-{
-	async_sess_t *parent_sess = ddf_dev_parent_sess_get(hcd->ddf_dev);
-	if (parent_sess == NULL)
-		return EIO;
-
-	hw_res_list_parsed_init(hw_res);
-	const errno_t ret = hw_res_get_list_parsed(parent_sess, hw_res, 0);
-	if (ret != EOK)
-		hw_res_list_parsed_clean(hw_res);
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/endpoint.c
===================================================================
--- uspace/lib/usbhost/src/endpoint.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,292 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- * @brief UHCI host controller driver structure
- */
-
-#include <assert.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/host/hcd.h>
-#include <usb/host/utility.h>
-
-#include "usb_transfer_batch.h"
-#include "bus.h"
-
-#include "endpoint.h"
-
-/**
- * Initialize provided endpoint structure.
- */
-void endpoint_init(endpoint_t *ep, device_t *dev, const usb_endpoint_descriptors_t *desc)
-{
-	memset(ep, 0, sizeof(endpoint_t));
-
-	assert(dev);
-	ep->device = dev;
-
-	refcount_init(&ep->refcnt);
-	fibril_condvar_initialize(&ep->avail);
-
-	ep->endpoint = USB_ED_GET_EP(desc->endpoint);
-	ep->direction = USB_ED_GET_DIR(desc->endpoint);
-	ep->transfer_type = USB_ED_GET_TRANSFER_TYPE(desc->endpoint);
-	ep->max_packet_size = USB_ED_GET_MPS(desc->endpoint);
-	ep->packets_per_uframe = USB_ED_GET_ADD_OPPS(desc->endpoint) + 1;
-
-	/** Direction both is our construct never present in descriptors */
-	if (ep->transfer_type == USB_TRANSFER_CONTROL)
-		ep->direction = USB_DIRECTION_BOTH;
-
-	ep->max_transfer_size = ep->max_packet_size * ep->packets_per_uframe;
-	ep->transfer_buffer_policy = DMA_POLICY_STRICT;
-	ep->required_transfer_buffer_policy = DMA_POLICY_STRICT;
-}
-
-/**
- * Get the bus endpoint belongs to.
- */
-static inline const bus_ops_t *get_bus_ops(endpoint_t *ep)
-{
-	return ep->device->bus->ops;
-}
-
-/**
- * Increase the reference count on endpoint.
- */
-void endpoint_add_ref(endpoint_t *ep)
-{
-	refcount_up(&ep->refcnt);
-}
-
-/**
- * Call the desctruction callback. Default behavior is to free the memory directly.
- */
-static inline void endpoint_destroy(endpoint_t *ep)
-{
-	const bus_ops_t *ops = get_bus_ops(ep);
-	if (ops->endpoint_destroy) {
-		ops->endpoint_destroy(ep);
-	} else {
-		assert(ep->active_batch == NULL);
-
-		/* Assume mostly the eps will be allocated by malloc. */
-		free(ep);
-	}
-}
-
-/**
- * Decrease the reference count.
- */
-void endpoint_del_ref(endpoint_t *ep)
-{
-	if (refcount_down(&ep->refcnt))
-		endpoint_destroy(ep);
-}
-
-/**
- * Mark the endpoint as online. Supply a guard to be used for this endpoint
- * synchronization.
- */
-void endpoint_set_online(endpoint_t *ep, fibril_mutex_t *guard)
-{
-	ep->guard = guard;
-	ep->online = true;
-}
-
-/**
- * Mark the endpoint as offline. All other fibrils waiting to activate this
- * endpoint will be interrupted.
- */
-void endpoint_set_offline_locked(endpoint_t *ep)
-{
-	assert(ep);
-	assert(fibril_mutex_is_locked(ep->guard));
-
-	ep->online = false;
-	fibril_condvar_broadcast(&ep->avail);
-}
-
-/**
- * Wait until a transfer finishes. Can be used even when the endpoint is
- * offline (and is interrupted by the endpoint going offline).
- */
-void endpoint_wait_timeout_locked(endpoint_t *ep, usec_t timeout)
-{
-	assert(ep);
-	assert(fibril_mutex_is_locked(ep->guard));
-
-	if (ep->active_batch == NULL)
-		return;
-
-	fibril_condvar_wait_timeout(&ep->avail, ep->guard, timeout);
-}
-
-/**
- * Mark the endpoint as active and block access for further fibrils. If the
- * endpoint is already active, it will block on ep->avail condvar.
- *
- * Call only under endpoint guard. After you activate the endpoint and release
- * the guard, you must assume that particular transfer is already
- * finished/aborted.
- *
- * Activation and deactivation is not done by the library to maximize
- * performance. The HC might want to prepare some memory buffers prior to
- * interfering with other world.
- *
- * @param batch Transfer batch this endpoint is blocked by.
- */
-int endpoint_activate_locked(endpoint_t *ep, usb_transfer_batch_t *batch)
-{
-	assert(ep);
-	assert(batch);
-	assert(batch->ep == ep);
-	assert(ep->guard);
-	assert(fibril_mutex_is_locked(ep->guard));
-
-	while (ep->online && ep->active_batch != NULL)
-		fibril_condvar_wait(&ep->avail, ep->guard);
-
-	if (!ep->online)
-		return EINTR;
-
-	assert(ep->active_batch == NULL);
-	ep->active_batch = batch;
-	return EOK;
-}
-
-/**
- * Mark the endpoint as inactive and allow access for further fibrils.
- */
-void endpoint_deactivate_locked(endpoint_t *ep)
-{
-	assert(ep);
-	assert(fibril_mutex_is_locked(ep->guard));
-
-	ep->active_batch = NULL;
-	fibril_condvar_signal(&ep->avail);
-}
-
-/**
- * Initiate a transfer on an endpoint. Creates a transfer batch, checks the
- * bandwidth requirements and schedules the batch.
- *
- * @param endpoint Endpoint for which to send the batch
- */
-errno_t endpoint_send_batch(endpoint_t *ep, const transfer_request_t *req)
-{
-	assert(ep);
-	assert(req);
-
-	if (ep->transfer_type == USB_TRANSFER_CONTROL) {
-		usb_log_debug("%s %d:%d %zu/%zuB, setup %#016" PRIx64, req->name,
-		    req->target.address, req->target.endpoint,
-		    req->size, ep->max_packet_size,
-		    req->setup);
-	} else {
-		usb_log_debug("%s %d:%d %zu/%zuB", req->name,
-		    req->target.address, req->target.endpoint,
-		    req->size, ep->max_packet_size);
-	}
-
-	device_t *const device = ep->device;
-	if (!device) {
-		usb_log_warning("Endpoint detached");
-		return EAGAIN;
-	}
-
-	const bus_ops_t *ops = device->bus->ops;
-	if (!ops->batch_schedule) {
-		usb_log_error("HCD does not implement scheduler.");
-		return ENOTSUP;
-	}
-
-	size_t size = req->size;
-	/*
-	 * Limit transfers with reserved bandwidth to the amount reserved.
-	 * OUT transfers are rejected, IN can be just trimmed in advance.
-	 */
-	if (size > ep->max_transfer_size &&
-	    (ep->transfer_type == USB_TRANSFER_INTERRUPT ||
-	    ep->transfer_type == USB_TRANSFER_ISOCHRONOUS)) {
-		if (req->dir == USB_DIRECTION_OUT)
-			return ENOSPC;
-		else
-			size = ep->max_transfer_size;
-	}
-
-	/* Offline devices don't schedule transfers other than on EP0. */
-	if (!device->online && ep->endpoint > 0)
-		return EAGAIN;
-
-	usb_transfer_batch_t *batch = usb_transfer_batch_create(ep);
-	if (!batch) {
-		usb_log_error("Failed to create transfer batch.");
-		return ENOMEM;
-	}
-
-	batch->target = req->target;
-	batch->setup.packed = req->setup;
-	batch->dir = req->dir;
-	batch->size = size;
-	batch->offset = req->offset;
-	batch->dma_buffer = req->buffer;
-
-	dma_buffer_acquire(&batch->dma_buffer);
-
-	if (batch->offset != 0) {
-		usb_log_debug("A transfer with nonzero offset requested.");
-		usb_transfer_batch_bounce(batch);
-	}
-
-	if (usb_transfer_batch_bounce_required(batch))
-		usb_transfer_batch_bounce(batch);
-
-	batch->on_complete = req->on_complete;
-	batch->on_complete_data = req->arg;
-
-	const int ret = ops->batch_schedule(batch);
-	if (ret != EOK) {
-		usb_log_warning("Batch %p failed to schedule: %s", batch, str_error(ret));
-		usb_transfer_batch_destroy(batch);
-	}
-
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/hcd.c
===================================================================
--- uspace/lib/usbhost/src/hcd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,398 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * Host controller driver framework. Encapsulates DDF device of HC to an
- * hc_device_t, which is passed to driver implementing hc_driver_t.
- */
-
-#include <assert.h>
-#include <async.h>
-#include <ddf/interrupt.h>
-#include <errno.h>
-#include <macros.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-#include <usb_iface.h>
-
-#include "bus.h"
-#include "ddf_helpers.h"
-#include "endpoint.h"
-#include "usb_transfer_batch.h"
-
-#include "hcd.h"
-
-int hc_dev_add(ddf_dev_t *);
-int hc_dev_remove(ddf_dev_t *);
-int hc_dev_gone(ddf_dev_t *);
-int hc_dev_quiesce(ddf_dev_t *);
-int hc_fun_online(ddf_fun_t *);
-int hc_fun_offline(ddf_fun_t *);
-
-static driver_ops_t hc_driver_ops = {
-	.dev_add = hc_dev_add,
-	.dev_remove = hc_dev_remove,
-	.dev_gone = hc_dev_gone,
-	.dev_quiesce = hc_dev_quiesce,
-	.fun_online = hc_fun_online,
-	.fun_offline = hc_fun_offline,
-};
-
-static const hc_driver_t *hc_driver;
-
-/**
- * The main HC driver routine.
- */
-int hc_driver_main(const hc_driver_t *driver)
-{
-	driver_t ddf_driver = {
-		.name = driver->name,
-		.driver_ops = &hc_driver_ops,
-	};
-
-	/* Remember ops to call. */
-	hc_driver = driver;
-
-	return ddf_driver_main(&ddf_driver);
-}
-
-/**
- * IRQ handling callback. Call the bus operation.
- *
- * Currently, there is a bus ops lookup to find the interrupt handler. So far,
- * the mechanism is too flexible, as it allows different instances of HC to
- * have different IRQ handlers, disallowing us to optimize the lookup here.
- * TODO: Make the bus mechanism less flexible in irq handling and remove the
- * lookup.
- *
- * @param call Interrupt notification
- * @param arg Argument (hc_device_t *)
- */
-static void irq_handler(ipc_call_t *call, void *arg)
-{
-	hc_device_t *hcd = (hc_device_t *)arg;
-
-	const uint32_t status = ipc_get_arg1(call);
-	hcd->bus->ops->interrupt(hcd->bus, status);
-}
-
-/**
- * Worker for the HW interrupt replacement fibril.
- */
-static errno_t interrupt_polling(void *arg)
-{
-	bus_t *bus = arg;
-	assert(bus);
-
-	if (!bus->ops->interrupt || !bus->ops->status)
-		return ENOTSUP;
-
-	uint32_t status = 0;
-	while (bus->ops->status(bus, &status) == EOK) {
-		bus->ops->interrupt(bus, status);
-		status = 0;
-		/*
-		 * We should wait 1 frame - 1ms here, but this polling is a
-		 * lame crutch anyway so don't hog the system. 10ms is still
-		 * good enough for emergency mode
-		 */
-		fibril_usleep(10000);
-	}
-	return EOK;
-}
-
-/**
- * Clean the IRQ code bottom-half.
- */
-static inline void irq_code_clean(irq_code_t *code)
-{
-	if (code) {
-		free(code->ranges);
-		free(code->cmds);
-		code->ranges = NULL;
-		code->cmds = NULL;
-		code->rangecount = 0;
-		code->cmdcount = 0;
-	}
-}
-
-/**
- * Register an interrupt handler. If there is a callback to setup the bottom half,
- * invoke it and register it. Register for notifications.
- *
- * If this method fails, a polling fibril is started instead.
- *
- * @param[in]  hcd         Host controller device.
- * @param[in]  hw_res      Resources to be used.
- * @param[out] irq_handle  Storage for the returned IRQ handle
- *
- * @return Error code.
- */
-static errno_t hcd_ddf_setup_interrupts(hc_device_t *hcd,
-    const hw_res_list_parsed_t *hw_res, cap_irq_handle_t *irq_handle)
-{
-	assert(hcd);
-	irq_code_t irq_code = { 0 };
-
-	if (!hc_driver->irq_code_gen)
-		return ENOTSUP;
-
-	int irq;
-	errno_t ret;
-	ret = hc_driver->irq_code_gen(&irq_code, hcd, hw_res, &irq);
-	if (ret != EOK) {
-		usb_log_error("Failed to generate IRQ code: %s.",
-		    str_error(ret));
-		return ret;
-	}
-
-	/* Register handler to avoid interrupt lockup */
-	cap_irq_handle_t ihandle;
-	ret = register_interrupt_handler(hcd->ddf_dev, irq, irq_handler,
-	    (void *)hcd, &irq_code, &ihandle);
-	irq_code_clean(&irq_code);
-	if (ret != EOK) {
-		usb_log_error("Failed to register interrupt handler: %s.",
-		    str_error(ret));
-		return ret;
-	}
-
-	/* Enable interrupts */
-	ret = hcd_ddf_enable_interrupt(hcd, irq);
-	if (ret != EOK) {
-		usb_log_error("Failed to enable interrupts: %s.",
-		    str_error(ret));
-		unregister_interrupt_handler(hcd->ddf_dev, ihandle);
-		return ret;
-	}
-
-	*irq_handle = ihandle;
-	return EOK;
-}
-
-/**
- * Initialize HC in memory of the driver.
- *
- * This function does all the preparatory work for hc and rh drivers:
- *  - gets device's hw resources
- *  - attempts to enable interrupts
- *  - registers interrupt handler
- *  - calls driver specific initialization
- *  - registers root hub
- *
- * @param device DDF instance of the device to use
- * @return Error code
- */
-errno_t hc_dev_add(ddf_dev_t *device)
-{
-	errno_t ret = EOK;
-	assert(device);
-
-	if (!hc_driver->hc_add) {
-		usb_log_error("Driver '%s' does not support adding devices.",
-		    hc_driver->name);
-		return ENOTSUP;
-	}
-
-	ret = hcd_ddf_setup_hc(device, hc_driver->hc_device_size);
-	if (ret != EOK) {
-		usb_log_error("Failed to setup HC device.");
-		return ret;
-	}
-
-	hc_device_t *hcd = dev_to_hcd(device);
-
-	hw_res_list_parsed_t hw_res;
-	ret = hcd_ddf_get_registers(hcd, &hw_res);
-	if (ret != EOK) {
-		usb_log_error("Failed to get register memory addresses "
-		    "for `%s': %s.", ddf_dev_get_name(device),
-		    str_error(ret));
-		goto err_hcd;
-	}
-
-	ret = hc_driver->hc_add(hcd, &hw_res);
-	if (ret != EOK) {
-		usb_log_error("Failed to init HCD.");
-		goto err_hw_res;
-	}
-
-	assert(hcd->bus);
-
-	/* Setup interrupts  */
-	hcd->irq_handle = CAP_NIL;
-	errno_t irqerr = hcd_ddf_setup_interrupts(hcd, &hw_res,
-	    &hcd->irq_handle);
-	if (irqerr == EOK) {
-		usb_log_debug("Hw interrupts enabled.");
-	}
-
-	/* Claim the device from BIOS */
-	if (hc_driver->claim)
-		ret = hc_driver->claim(hcd);
-	if (ret != EOK) {
-		usb_log_error("Failed to claim `%s' for `%s': %s",
-		    ddf_dev_get_name(device), hc_driver->name, str_error(ret));
-		goto err_irq;
-	}
-
-	/* Start hw */
-	if (hc_driver->start)
-		ret = hc_driver->start(hcd);
-	if (ret != EOK) {
-		usb_log_error("Failed to start HCD: %s.", str_error(ret));
-		goto err_irq;
-	}
-
-	const bus_ops_t *ops = hcd->bus->ops;
-
-	/* Need working irq replacement to setup root hub */
-	if (irqerr != EOK && ops->status) {
-		hcd->polling_fibril = fibril_create(interrupt_polling, hcd->bus);
-		if (!hcd->polling_fibril) {
-			usb_log_error("Failed to create polling fibril");
-			ret = ENOMEM;
-			goto err_started;
-		}
-		fibril_add_ready(hcd->polling_fibril);
-		usb_log_warning("Failed to enable interrupts: %s."
-		    " Falling back to polling.", str_error(irqerr));
-	}
-
-	/*
-	 * Creating root hub registers a new USB device so HC
-	 * needs to be ready at this time.
-	 */
-	if (hc_driver->setup_root_hub)
-		ret = hc_driver->setup_root_hub(hcd);
-	if (ret != EOK) {
-		usb_log_error("Failed to setup HC root hub: %s.",
-		    str_error(ret));
-		goto err_polling;
-	}
-
-	usb_log_info("Controlling new `%s' device `%s'.",
-	    hc_driver->name, ddf_dev_get_name(device));
-	return EOK;
-
-err_polling:
-	// TODO: Stop the polling fibril (refactor the interrupt_polling func)
-	//
-err_started:
-	if (hc_driver->stop)
-		hc_driver->stop(hcd);
-err_irq:
-	unregister_interrupt_handler(device, hcd->irq_handle);
-	if (hc_driver->hc_remove)
-		hc_driver->hc_remove(hcd);
-err_hw_res:
-	hw_res_list_parsed_clean(&hw_res);
-err_hcd:
-	hcd_ddf_clean_hc(hcd);
-	return ret;
-}
-
-errno_t hc_dev_remove(ddf_dev_t *dev)
-{
-	errno_t err;
-	hc_device_t *hcd = dev_to_hcd(dev);
-
-	if (hc_driver->stop)
-		if ((err = hc_driver->stop(hcd)))
-			return err;
-
-	unregister_interrupt_handler(dev, hcd->irq_handle);
-
-	if (hc_driver->hc_remove)
-		if ((err = hc_driver->hc_remove(hcd)))
-			return err;
-
-	hcd_ddf_clean_hc(hcd);
-
-	// TODO probably not complete
-
-	return EOK;
-}
-
-errno_t hc_dev_gone(ddf_dev_t *dev)
-{
-	errno_t err = ENOTSUP;
-	hc_device_t *hcd = dev_to_hcd(dev);
-
-	if (hc_driver->hc_gone)
-		err = hc_driver->hc_gone(hcd);
-
-	hcd_ddf_clean_hc(hcd);
-
-	return err;
-}
-
-errno_t hc_dev_quiesce(ddf_dev_t *dev)
-{
-	errno_t err = ENOTSUP;
-	hc_device_t *hcd = dev_to_hcd(dev);
-
-	if (hc_driver->hc_quiesce)
-		err = hc_driver->hc_quiesce(hcd);
-
-	return err;
-}
-
-errno_t hc_fun_online(ddf_fun_t *fun)
-{
-	assert(fun);
-
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(dev);
-
-	usb_log_info("Device(%d): Requested to be brought online.", dev->address);
-	return bus_device_online(dev);
-}
-
-int hc_fun_offline(ddf_fun_t *fun)
-{
-	assert(fun);
-
-	device_t *dev = ddf_fun_data_get(fun);
-	assert(dev);
-
-	usb_log_info("Device(%d): Requested to be taken offline.", dev->address);
-	return bus_device_offline(dev);
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/usb2_bus.c
===================================================================
--- uspace/lib/usbhost/src/usb2_bus.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- *
- * A bus_t implementation for USB 2 and lower. Implements USB 2 enumeration and
- * configurable bandwidth counting.
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-#include <usb/host/utility.h>
-#include <usb/usb.h>
-
-#include "endpoint.h"
-#include "ddf_helpers.h"
-
-#include "usb2_bus.h"
-
-/**
- * Request a new address. A free address is found and marked as occupied.
- *
- * There's no need to synchronize this method, because it is called only with
- * default address reserved.
- *
- * @param bus usb_device_manager
- * @param addr Pointer to requested address value, place to store new address
- */
-static int request_address(usb2_bus_helper_t *helper, usb_address_t *addr)
-{
-	// Find a free address
-	usb_address_t new_address = helper->last_address;
-	do {
-		new_address = (new_address + 1) % USB_ADDRESS_COUNT;
-		if (new_address == USB_ADDRESS_DEFAULT)
-			new_address = 1;
-		if (new_address == helper->last_address)
-			return ENOSPC;
-	} while (helper->address_occupied[new_address]);
-	helper->last_address = new_address;
-
-	*addr = new_address;
-	helper->address_occupied[*addr] = true;
-
-	return EOK;
-}
-
-/**
- * Mark address as free.
- */
-static void release_address(usb2_bus_helper_t *helper, usb_address_t address)
-{
-	helper->address_occupied[address] = false;
-}
-
-static const usb_target_t usb2_default_target = {
-	{
-		.address = USB_ADDRESS_DEFAULT,
-		.endpoint = 0,
-	}
-};
-
-/**
- * Transition the device to the addressed state.
- *
- * Reserve address, configure the control EP, issue a SET_ADDRESS command.
- * Configure the device with the new address,
- */
-static int address_device(usb2_bus_helper_t *helper, device_t *dev)
-{
-	int err;
-
-	/* The default address is currently reserved for this device */
-	dev->address = USB_ADDRESS_DEFAULT;
-
-	/** Reserve address early, we want pretty log messages */
-	usb_address_t address = USB_ADDRESS_DEFAULT;
-	if ((err = request_address(helper, &address))) {
-		usb_log_error("Failed to reserve new address: %s.",
-		    str_error(err));
-		return err;
-	}
-	usb_log_debug("Device(%d): Reserved new address.", address);
-
-	/* Add default pipe on default address */
-	usb_log_debug("Device(%d): Adding default target (0:0)", address);
-
-	usb_endpoint_descriptors_t ep0_desc = {
-		.endpoint.max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE,
-	};
-
-	/* Temporary reference */
-	endpoint_t *default_ep;
-	err = bus_endpoint_add(dev, &ep0_desc, &default_ep);
-	if (err != EOK) {
-		usb_log_error("Device(%d): Failed to add default target: %s.",
-		    address, str_error(err));
-		goto err_address;
-	}
-
-	if ((err = hc_get_ep0_max_packet_size(&ep0_desc.endpoint.max_packet_size, dev)))
-		goto err_address;
-
-	/* Set new address */
-	const usb_device_request_setup_packet_t set_address = SET_ADDRESS(address);
-
-	usb_log_debug("Device(%d): Setting USB address.", address);
-	err = bus_device_send_batch_sync(dev, usb2_default_target, USB_DIRECTION_OUT,
-	    NULL, 0, set_address.raw, "set address", NULL);
-	if (err) {
-		usb_log_error("Device(%d): Failed to set new address: %s.",
-		    address, str_error(err));
-		goto err_default_control_ep;
-	}
-
-	/* We need to remove ep before we change the address */
-	if ((err = bus_endpoint_remove(default_ep))) {
-		usb_log_error("Device(%d): Failed to unregister default target: %s", address, str_error(err));
-		goto err_address;
-	}
-
-	/* Temporary reference */
-	endpoint_del_ref(default_ep);
-
-	dev->address = address;
-
-	/* Register EP on the new address */
-	usb_log_debug("Device(%d): Registering control EP.", address);
-	err = bus_endpoint_add(dev, &ep0_desc, NULL);
-	if (err != EOK) {
-		usb_log_error("Device(%d): Failed to register EP0: %s",
-		    address, str_error(err));
-		goto err_address;
-	}
-
-	return EOK;
-
-err_default_control_ep:
-	bus_endpoint_remove(default_ep);
-	/* Temporary reference */
-	endpoint_del_ref(default_ep);
-err_address:
-	release_address(helper, address);
-	return err;
-}
-
-/**
- * Enumerate a USB device. Move it to the addressed state, then explore it
- * to create a DDF function node with proper characteristics.
- */
-int usb2_bus_device_enumerate(usb2_bus_helper_t *helper, device_t *dev)
-{
-	int err;
-	usb_log_debug("Found new %s speed USB device.", usb_str_speed(dev->speed));
-
-	/* Assign an address to the device */
-	if ((err = address_device(helper, dev))) {
-		usb_log_error("Failed to setup address of the new device: %s", str_error(err));
-		return err;
-	}
-
-	/* Read the device descriptor, derive the match ids */
-	if ((err = hc_device_explore(dev))) {
-		usb_log_error("Device(%d): Failed to explore device: %s", dev->address, str_error(err));
-		release_address(helper, dev->address);
-		return err;
-	}
-
-	return EOK;
-}
-
-void usb2_bus_device_gone(usb2_bus_helper_t *helper, device_t *dev)
-{
-	release_address(helper, dev->address);
-}
-
-/**
- * Register an endpoint to the bus. Reserves bandwidth.
- */
-int usb2_bus_endpoint_register(usb2_bus_helper_t *helper, endpoint_t *ep)
-{
-	assert(ep);
-	assert(fibril_mutex_is_locked(&ep->device->guard));
-
-	size_t bw = helper->bw_accounting->count_bw(ep);
-
-	/* Check for available bandwidth */
-	if (bw > helper->free_bw)
-		return ENOSPC;
-
-	helper->free_bw -= bw;
-
-	return EOK;
-}
-
-/**
- * Release bandwidth reserved by the given endpoint.
- */
-void usb2_bus_endpoint_unregister(usb2_bus_helper_t *helper, endpoint_t *ep)
-{
-	assert(helper);
-	assert(ep);
-
-	helper->free_bw += helper->bw_accounting->count_bw(ep);
-}
-
-/**
- * Initialize to default state.
- *
- * @param helper usb_bus_helper structure, non-null.
- * @param bw_accounting a structure defining bandwidth accounting
- */
-void usb2_bus_helper_init(usb2_bus_helper_t *helper, const bandwidth_accounting_t *bw_accounting)
-{
-	assert(helper);
-	assert(bw_accounting);
-
-	helper->bw_accounting = bw_accounting;
-	helper->free_bw = bw_accounting->available_bandwidth;
-
-	/*
-	 * The first address allocated is for the roothub. This way, its
-	 * address will be 127, and the first connected USB device will have
-	 * address 1.
-	 */
-	helper->last_address = USB_ADDRESS_COUNT - 2;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/usb_transfer_batch.c
===================================================================
--- uspace/lib/usbhost/src/usb_transfer_batch.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2011 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup libusbhost
- * @{
- */
-/** @file
- * USB transfer transaction structures (implementation).
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <usb/debug.h>
-
-#include "endpoint.h"
-#include "bus.h"
-
-#include "usb_transfer_batch.h"
-
-/**
- * Create a batch on a given endpoint.
- *
- * If the bus callback is not defined, it just creates a default batch.
- */
-usb_transfer_batch_t *usb_transfer_batch_create(endpoint_t *ep)
-{
-	assert(ep);
-
-	bus_t *bus = endpoint_get_bus(ep);
-
-	if (!bus->ops->batch_create) {
-		usb_transfer_batch_t *batch = calloc(1, sizeof(usb_transfer_batch_t));
-		if (!batch)
-			return NULL;
-		usb_transfer_batch_init(batch, ep);
-		return batch;
-	}
-
-	return bus->ops->batch_create(ep);
-}
-
-/**
- * Initialize given batch structure.
- */
-void usb_transfer_batch_init(usb_transfer_batch_t *batch, endpoint_t *ep)
-{
-	assert(ep);
-	/* Batch reference */
-	endpoint_add_ref(ep);
-	batch->ep = ep;
-}
-
-/**
- * Destroy the batch. If there's no bus callback, just free it.
- */
-void usb_transfer_batch_destroy(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-	assert(batch->ep);
-
-	bus_t *bus = endpoint_get_bus(batch->ep);
-	endpoint_t *ep = batch->ep;
-
-	if (bus->ops) {
-		usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " destroying.",
-		    batch, USB_TRANSFER_BATCH_ARGS(*batch));
-		bus->ops->batch_destroy(batch);
-	} else {
-		usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " disposing.",
-		    batch, USB_TRANSFER_BATCH_ARGS(*batch));
-		free(batch);
-	}
-
-	/* Batch reference */
-	endpoint_del_ref(ep);
-}
-
-bool usb_transfer_batch_bounce_required(usb_transfer_batch_t *batch)
-{
-	if (!batch->size)
-		return false;
-
-	unsigned flags = batch->dma_buffer.policy & DMA_POLICY_FLAGS_MASK;
-	unsigned required_flags =
-	    batch->ep->required_transfer_buffer_policy & DMA_POLICY_FLAGS_MASK;
-
-	if (required_flags & ~flags)
-		return true;
-
-	size_t chunk_mask = dma_policy_chunk_mask(batch->dma_buffer.policy);
-	size_t required_chunk_mask =
-	    dma_policy_chunk_mask(batch->ep->required_transfer_buffer_policy);
-
-	/* If the chunks are at least as large as required, we're good */
-	if ((required_chunk_mask & ~chunk_mask) == 0)
-		return false;
-
-	size_t start_chunk = batch->offset & ~chunk_mask;
-	size_t end_chunk = (batch->offset + batch->size - 1) & ~chunk_mask;
-
-	/* The requested area crosses a chunk boundary */
-	if (start_chunk != end_chunk)
-		return true;
-
-	return false;
-}
-
-errno_t usb_transfer_batch_bounce(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-	assert(!batch->is_bounced);
-
-	dma_buffer_release(&batch->dma_buffer);
-
-	batch->original_buffer = batch->dma_buffer.virt + batch->offset;
-
-	usb_log_debug("Batch(%p): Buffer cannot be used directly, "
-	    "falling back to bounce buffer!", batch);
-
-	const errno_t err = dma_buffer_alloc_policy(&batch->dma_buffer,
-	    batch->size, batch->ep->transfer_buffer_policy);
-	if (err)
-		return err;
-
-	/* Copy the data out */
-	if (batch->dir == USB_DIRECTION_OUT)
-		memcpy(batch->dma_buffer.virt,
-		    batch->original_buffer,
-		    batch->size);
-
-	batch->is_bounced = true;
-	batch->offset = 0;
-
-	return err;
-}
-
-/**
- * Finish a transfer batch: call handler, destroy batch, release endpoint.
- *
- * Call only after the batch have been scheduled && completed!
- */
-void usb_transfer_batch_finish(usb_transfer_batch_t *batch)
-{
-	assert(batch);
-	assert(batch->ep);
-
-	usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " finishing.",
-	    batch, USB_TRANSFER_BATCH_ARGS(*batch));
-
-	if (batch->error == EOK && batch->size > 0) {
-		if (batch->is_bounced) {
-			/* We we're forced to use bounce buffer, copy it back */
-			if (batch->dir == USB_DIRECTION_IN)
-				memcpy(batch->original_buffer,
-				    batch->dma_buffer.virt,
-				    batch->transferred_size);
-
-			dma_buffer_free(&batch->dma_buffer);
-		} else {
-			dma_buffer_release(&batch->dma_buffer);
-		}
-	}
-
-	if (batch->on_complete) {
-		const int err = batch->on_complete(batch->on_complete_data, batch->error, batch->transferred_size);
-		if (err)
-			usb_log_warning("Batch %p failed to complete: %s",
-			    batch, str_error(err));
-	}
-
-	usb_transfer_batch_destroy(batch);
-}
-
-/**
- * @}
- */
Index: pace/lib/usbhost/src/utility.c
===================================================================
--- uspace/lib/usbhost/src/utility.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,393 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * Copyright (c) 2018 Ondrej Hlavaty, Jan Hrach
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**  @addtogroup libusbhost
- * @{
- */
-/** @file
- */
-
-#include <macros.h>
-#include <str_error.h>
-#include <usb/debug.h>
-#include <usb/descriptor.h>
-#include <usb/request.h>
-
-#include "ddf_helpers.h"
-#include "utility.h"
-
-/**
- * Get initial max packet size for the control endpoint 0.
- *
- * For LS, HS, and SS devices this value is final and fixed.
- * For FS devices, the default value of 8 is returned. The caller needs
- * to fetch the first 8B of the device descriptor later in the initialization
- * process and determine whether it should be increased.
- *
- * @return Max packet size for EP 0 (in bytes)
- */
-uint16_t hc_get_ep0_initial_mps(usb_speed_t speed)
-{
-	static const uint16_t mps_fixed [] = {
-		[USB_SPEED_LOW] = 8,
-		[USB_SPEED_HIGH] = 64,
-		[USB_SPEED_SUPER] = 512,
-	};
-
-	if (speed < ARRAY_SIZE(mps_fixed) && mps_fixed[speed] != 0) {
-		return mps_fixed[speed];
-	}
-	return 8; // USB_SPEED_FULL default
-}
-
-/**
- * Get max packet size for the control endpoint 0.
- *
- * For LS, HS, and SS devices the corresponding fixed value is obtained.
- * For FS devices the first 8B of the device descriptor are fetched to
- * determine it.
- *
- * @return Max packet size for EP 0 (in bytes)
- */
-int hc_get_ep0_max_packet_size(uint16_t *mps, device_t *dev)
-{
-	assert(mps);
-
-	*mps = hc_get_ep0_initial_mps(dev->speed);
-	if (dev->speed != USB_SPEED_FULL) {
-		return EOK;
-	}
-
-	const usb_target_t control_ep = {
-		{
-			.address = dev->address,
-			.endpoint = 0,
-		}
-	};
-
-	usb_standard_device_descriptor_t desc = { 0 };
-	const usb_device_request_setup_packet_t get_device_desc_8 =
-	    GET_DEVICE_DESC(CTRL_PIPE_MIN_PACKET_SIZE);
-
-	usb_log_debug("Requesting first 8B of device descriptor to determine MPS.");
-	size_t got;
-	const errno_t err = bus_device_send_batch_sync(dev, control_ep,
-	    USB_DIRECTION_IN, (char *) &desc, CTRL_PIPE_MIN_PACKET_SIZE,
-	    *(uint64_t *)&get_device_desc_8,
-	    "read first 8 bytes of dev descriptor", &got);
-
-	if (got != CTRL_PIPE_MIN_PACKET_SIZE) {
-		usb_log_error("Failed to get 8B of dev descr: %s.", str_error(err));
-		return err;
-	}
-
-	if (desc.descriptor_type != USB_DESCTYPE_DEVICE) {
-		usb_log_error("The device responded with wrong device descriptor.");
-		return EIO;
-	}
-
-	uint16_t version = uint16_usb2host(desc.usb_spec_version);
-	if (version < 0x0300) {
-		/* USB 2 and below have MPS raw in the field */
-		*mps = desc.max_packet_size;
-	} else {
-		/* USB 3 have MPS as an 2-based exponent */
-		*mps = (1 << desc.max_packet_size);
-	}
-	return EOK;
-}
-
-int hc_get_device_desc(device_t *device, usb_standard_device_descriptor_t *desc)
-{
-	const usb_target_t control_ep = {
-		{
-			.address = device->address,
-			.endpoint = 0,
-		}
-	};
-
-	/* Get std device descriptor */
-	const usb_device_request_setup_packet_t get_device_desc =
-	    GET_DEVICE_DESC(sizeof(*desc));
-
-	usb_log_debug("Device(%d): Requesting full device descriptor.",
-	    device->address);
-	size_t got;
-	errno_t err = bus_device_send_batch_sync(device, control_ep,
-	    USB_DIRECTION_IN, (char *) desc, sizeof(*desc),
-	    *(uint64_t *)&get_device_desc, "read device descriptor", &got);
-
-	if (!err && got != sizeof(*desc))
-		err = EOVERFLOW;
-
-	return err;
-}
-
-int hc_get_hub_desc(device_t *device, usb_hub_descriptor_header_t *desc)
-{
-	const usb_target_t control_ep = {
-		{
-			.address = device->address,
-			.endpoint = 0,
-		}
-	};
-
-	const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER ?
-	    USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB;
-
-	const usb_device_request_setup_packet_t get_hub_desc = {
-		.request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST |
-		    (USB_REQUEST_TYPE_CLASS << 5) |
-		    USB_REQUEST_RECIPIENT_DEVICE,
-		.request = USB_DEVREQ_GET_DESCRIPTOR,
-		.value = uint16_host2usb(type << 8),
-		.length = sizeof(*desc),
-	};
-
-	usb_log_debug("Device(%d): Requesting hub descriptor.",
-	    device->address);
-
-	size_t got;
-	errno_t err = bus_device_send_batch_sync(device, control_ep,
-	    USB_DIRECTION_IN, (char *) desc, sizeof(*desc),
-	    *(uint64_t *)&get_hub_desc, "get hub descriptor", &got);
-
-	if (!err && got != sizeof(*desc))
-		err = EOVERFLOW;
-
-	return err;
-}
-
-int hc_device_explore(device_t *device)
-{
-	int err;
-	usb_standard_device_descriptor_t desc = { 0 };
-
-	if ((err = hc_get_device_desc(device, &desc))) {
-		usb_log_error("Device(%d): Failed to get dev descriptor: %s",
-		    device->address, str_error(err));
-		return err;
-	}
-
-	if ((err = hcd_ddf_setup_match_ids(device, &desc))) {
-		usb_log_error("Device(%d): Failed to setup match ids: %s", device->address, str_error(err));
-		return err;
-	}
-
-	return EOK;
-}
-
-/** Announce root hub to the DDF
- *
- * @param[in] device Host controller ddf device
- * @return Error code
- */
-int hc_setup_virtual_root_hub(hc_device_t *hcd, usb_speed_t rh_speed)
-{
-	int err;
-
-	assert(hcd);
-
-	device_t *dev = hcd_ddf_fun_create(hcd, rh_speed);
-	if (!dev) {
-		usb_log_error("Failed to create function for the root hub.");
-		return ENOMEM;
-	}
-
-	ddf_fun_set_name(dev->fun, "roothub");
-
-	/* Assign an address to the device */
-	if ((err = bus_device_enumerate(dev))) {
-		usb_log_error("Failed to enumerate roothub device: %s", str_error(err));
-		goto err_usb_dev;
-	}
-
-	if ((err = ddf_fun_bind(dev->fun))) {
-		usb_log_error("Failed to register roothub: %s.", str_error(err));
-		goto err_enumerated;
-	}
-
-	return EOK;
-
-err_enumerated:
-	bus_device_gone(dev);
-err_usb_dev:
-	hcd_ddf_fun_destroy(dev);
-	return err;
-}
-
-/**
- * Check setup packet data for signs of toggle reset.
- *
- * @param[in] batch USB batch
- * @param[in] reset_cb Callback to reset an endpoint
- */
-void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t reset_cb)
-{
-	if (batch->ep->transfer_type != USB_TRANSFER_CONTROL ||
-	    batch->dir != USB_DIRECTION_OUT)
-		return;
-
-	const usb_device_request_setup_packet_t *request = &batch->setup.packet;
-	device_t *const dev = batch->ep->device;
-
-	switch (request->request) {
-		/* Clear Feature ENPOINT_STALL */
-	case USB_DEVREQ_CLEAR_FEATURE: /* resets only cleared ep */
-		/* 0x2 ( HOST to device | STANDART | TO ENPOINT) */
-		if ((request->request_type == 0x2) &&
-		    (request->value == USB_FEATURE_ENDPOINT_HALT)) {
-			const uint16_t index = uint16_usb2host(request->index);
-			const usb_endpoint_t ep_num = index & 0xf;
-			const usb_direction_t dir = (index >> 7) ? USB_DIRECTION_IN : USB_DIRECTION_OUT;
-
-			endpoint_t *ep = bus_find_endpoint(dev, ep_num, dir);
-			if (ep) {
-				reset_cb(ep);
-				endpoint_del_ref(ep);
-			} else {
-				usb_log_warning("Device(%u): Resetting unregistered endpoint %u %s.", dev->address, ep_num, usb_str_direction(dir));
-			}
-		}
-		break;
-	case USB_DEVREQ_SET_CONFIGURATION:
-	case USB_DEVREQ_SET_INTERFACE:
-		/*
-		 * Recipient must be device, this resets all endpoints,
-		 * In fact there should be no endpoints but EP 0 registered
-		 * as different interfaces use different endpoints,
-		 * unless you're changing configuration or alternative
-		 * interface of an already setup device.
-		 */
-		if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST))
-			for (usb_endpoint_t i = 0; i < 2 * USB_ENDPOINT_MAX; ++i)
-				if (dev->endpoints[i])
-					reset_cb(dev->endpoints[i]);
-		break;
-	default:
-		break;
-	}
-}
-
-typedef struct joinable_fibril {
-	fid_t fid;
-	void *arg;
-	fibril_worker_t worker;
-
-	bool running;
-	fibril_mutex_t guard;
-	fibril_condvar_t dead_cv;
-} joinable_fibril_t;
-
-static int joinable_fibril_worker(void *arg)
-{
-	joinable_fibril_t *jf = arg;
-
-	jf->worker(jf->arg);
-
-	fibril_mutex_lock(&jf->guard);
-	jf->running = false;
-	fibril_mutex_unlock(&jf->guard);
-	fibril_condvar_broadcast(&jf->dead_cv);
-	return 0;
-}
-
-/**
- * Create a fibril that is joinable. Similar to fibril_create.
- */
-joinable_fibril_t *joinable_fibril_create(fibril_worker_t worker, void *arg)
-{
-	joinable_fibril_t *jf = calloc(1, sizeof(joinable_fibril_t));
-	if (!jf)
-		return NULL;
-
-	jf->worker = worker;
-	jf->arg = arg;
-	fibril_mutex_initialize(&jf->guard);
-	fibril_condvar_initialize(&jf->dead_cv);
-
-	if (joinable_fibril_recreate(jf)) {
-		free(jf);
-		return NULL;
-	}
-
-	return jf;
-}
-
-/**
- * Start a joinable fibril. Similar to fibril_add_ready.
- */
-void joinable_fibril_start(joinable_fibril_t *jf)
-{
-	assert(jf);
-	assert(!jf->running);
-
-	jf->running = true;
-	fibril_add_ready(jf->fid);
-}
-
-/**
- * Join a joinable fibril. Not similar to anything, obviously.
- */
-void joinable_fibril_join(joinable_fibril_t *jf)
-{
-	assert(jf);
-
-	fibril_mutex_lock(&jf->guard);
-	while (jf->running)
-		fibril_condvar_wait(&jf->dead_cv, &jf->guard);
-	fibril_mutex_unlock(&jf->guard);
-
-	jf->fid = 0;
-}
-
-/**
- * Reinitialize a joinable fibril.
- */
-errno_t joinable_fibril_recreate(joinable_fibril_t *jf)
-{
-	assert(!jf->fid);
-
-	jf->fid = fibril_create(joinable_fibril_worker, jf);
-	return jf->fid ? EOK : ENOMEM;
-}
-
-/**
- * Regular fibrils clean after themselves, joinable fibrils cannot.
- */
-void joinable_fibril_destroy(joinable_fibril_t *jf)
-{
-	if (jf) {
-		joinable_fibril_join(jf);
-		free(jf);
-	}
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/include/usbvirt/device.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/device.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Virtual USB device.
- */
-
-#ifndef LIBUSBVIRT_DEVICE_H_
-#define LIBUSBVIRT_DEVICE_H_
-
-#include <usb/usb.h>
-#include <usb/dev/request.h>
-#include <async.h>
-#include <errno.h>
-
-/** Maximum number of endpoints supported by virtual USB. */
-#define USBVIRT_ENDPOINT_MAX 16
-
-typedef struct usbvirt_device usbvirt_device_t;
-
-/** Callback for data to device (OUT transaction).
- *
- * @param dev Virtual device to which the transaction belongs.
- * @param endpoint Target endpoint number.
- * @param transfer_type Transfer type.
- * @param buffer Data buffer.
- * @param buffer_size Size of the buffer in bytes.
- * @return Error code.
- */
-typedef errno_t (*usbvirt_on_data_to_device_t)(usbvirt_device_t *dev,
-    usb_endpoint_t endpoint, usb_transfer_type_t transfer_type,
-    const void *buffer, size_t buffer_size);
-
-/** Callback for data from device (IN transaction).
- *
- * @param dev Virtual device to which the transaction belongs.
- * @param endpoint Target endpoint number.
- * @param transfer_type Transfer type.
- * @param buffer Data buffer to write answer to.
- * @param buffer_size Size of the buffer in bytes.
- * @param act_buffer_size Write here how many bytes were actually written.
- * @return Error code.
- */
-typedef errno_t (*usbvirt_on_data_from_device_t)(usbvirt_device_t *dev,
-    usb_endpoint_t endpoint, usb_transfer_type_t transfer_type,
-    void *buffer, size_t buffer_size, size_t *act_buffer_size);
-
-/** Callback for control transfer on endpoint zero.
- *
- * Notice that size of the data buffer is expected to be read from the
- * setup packet.
- *
- * @param dev Virtual device to which the transaction belongs.
- * @param setup_packet Standard setup packet.
- * @param data Data (might be NULL).
- * @param act_data_size Size of returned data in bytes.
- * @return Error code.
- */
-typedef errno_t (*usbvirt_on_control_t)(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_data_size);
-
-/** Create a class request to get data from device
- *
- * @param rec Request recipient.
- * @param req Request code.
- */
-#define CLASS_REQ_IN(rec, req) \
-	.request_type = SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_CLASS, rec), \
-	.request = req
-
-/** Create a class request to send data to device
- *
- * @param rec Request recipient.
- * @param req Request code.
- */
-#define CLASS_REQ_OUT(rec, req) \
-	.request_type = SETUP_REQUEST_TO_DEVICE(USB_REQUEST_TYPE_CLASS, rec), \
-	.request = req
-
-/** Create a standard request to get data from device
- *
- * @param rec Request recipient.
- * @param req Request code.
- */
-#define STD_REQ_IN(rec, req) \
-	.request_type = SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_STANDARD, rec), \
-	.request = req
-
-/** Create a standard request to send data to device
- *
- * @param rec Request recipient.
- * @param req Request code.
- */
-#define STD_REQ_OUT(rec, req) \
-	.request_type = SETUP_REQUEST_TO_DEVICE(USB_REQUEST_TYPE_STANDARD, rec), \
-	.request = req
-
-/** Callback for control request on a virtual USB device.
- *
- * See usbvirt_control_reply_helper() for simple way of answering
- * control read requests.
- */
-typedef struct {
-	/* Request type. See usb/request.h */
-	uint8_t request_type;
-	/** Actual request code. */
-	uint8_t request;
-	/** Request handler name for debugging purposes. */
-	const char *name;
-	/** Callback to be executed on matching request. */
-	usbvirt_on_control_t callback;
-} usbvirt_control_request_handler_t;
-
-/** Extra configuration data for GET_CONFIGURATION request. */
-typedef struct {
-	/** Actual data. */
-	const uint8_t *data;
-	/** Data length. */
-	size_t length;
-} usbvirt_device_configuration_extras_t;
-
-/** Single device configuration. */
-typedef struct {
-	/** Standard configuration descriptor. */
-	usb_standard_configuration_descriptor_t *descriptor;
-	/** Array of extra data. */
-	usbvirt_device_configuration_extras_t *extra;
-	/** Length of @c extra array. */
-	size_t extra_count;
-} usbvirt_device_configuration_t;
-
-/** Standard USB descriptors for virtual device. */
-typedef struct {
-	/** Standard device descriptor.
-	 * There is always only one such descriptor for the device.
-	 */
-	const usb_standard_device_descriptor_t *device;
-
-	/** Configurations. */
-	usbvirt_device_configuration_t *configuration;
-	/** Number of configurations. */
-	size_t configuration_count;
-} usbvirt_descriptors_t;
-
-/** Possible states of virtual USB device.
- * Notice that these are not 1:1 mappings to those in USB specification.
- */
-typedef enum {
-	/** Default state, device listens at default address. */
-	USBVIRT_STATE_DEFAULT,
-	/** Device has non-default address assigned. */
-	USBVIRT_STATE_ADDRESS,
-	/** Device is configured. */
-	USBVIRT_STATE_CONFIGURED
-} usbvirt_device_state_t;
-
-/** Ops structure for virtual USB device. */
-typedef struct {
-	/** Callbacks for data to device.
-	 * Index zero is ignored.
-	 */
-	usbvirt_on_data_to_device_t data_out[USBVIRT_ENDPOINT_MAX];
-	/** Callbacks for data from device.
-	 * Index zero is ignored.
-	 */
-	usbvirt_on_data_from_device_t data_in[USBVIRT_ENDPOINT_MAX];
-	/** Array of control handlers.
-	 * Last handler is expected to have the @c callback field set to NULL
-	 */
-	const usbvirt_control_request_handler_t *control;
-	/** Callback when device changes state.
-	 *
-	 * The value of @c state attribute of @p dev device is not
-	 * defined during call of this function.
-	 *
-	 * @param dev The virtual USB device.
-	 * @param old_state Old device state.
-	 * @param new_state New device state.
-	 */
-	void (*state_changed)(usbvirt_device_t *dev,
-	    usbvirt_device_state_t old_state, usbvirt_device_state_t new_state);
-} usbvirt_device_ops_t;
-
-/** Virtual USB device. */
-struct usbvirt_device {
-	/** Device does not require USB bus power */
-	bool self_powered;
-	/** Device is allowed to signal remote wakeup */
-	bool remote_wakeup;
-	/** Name for debugging purposes. */
-	const char *name;
-	/** Custom device data. */
-	void *device_data;
-	/** Device ops. */
-	usbvirt_device_ops_t *ops;
-	/** Device descriptors. */
-	const usbvirt_descriptors_t *descriptors;
-	/** Current device address.
-	 * You shall treat this field as read only in your code.
-	 */
-	usb_address_t address;
-	/** Current device state.
-	 * You shall treat this field as read only in your code.
-	 */
-	usbvirt_device_state_t state;
-	/** Session to the host controller.
-	 * You shall treat this field as read only in your code.
-	 */
-	async_sess_t *vhc_sess;
-};
-
-extern errno_t req_nop(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size);
-
-extern errno_t usbvirt_device_plug(usbvirt_device_t *, const char *);
-extern void usbvirt_device_unplug(usbvirt_device_t *);
-
-extern void usbvirt_control_reply_helper(
-    const usb_device_request_setup_packet_t *, uint8_t *, size_t *,
-    const void *, size_t);
-
-extern errno_t usbvirt_control_write(usbvirt_device_t *, const void *, size_t,
-    void *, size_t);
-extern errno_t usbvirt_control_read(usbvirt_device_t *, const void *, size_t,
-    void *, size_t, size_t *);
-extern errno_t usbvirt_data_out(usbvirt_device_t *, usb_transfer_type_t,
-    usb_endpoint_t, const void *, size_t);
-extern errno_t usbvirt_data_in(usbvirt_device_t *, usb_transfer_type_t,
-    usb_endpoint_t, void *, size_t, size_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/include/usbvirt/ipc.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/ipc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * IPC wrappers for virtual USB.
- */
-
-#ifndef LIBUSBVIRT_IPC_H_
-#define LIBUSBVIRT_IPC_H_
-
-#include <ipc/common.h>
-#include <usb/usb.h>
-#include <stdbool.h>
-#include <usbvirt/device.h>
-#include <async.h>
-
-/** IPC methods communication between host controller and virtual device. */
-typedef enum {
-	IPC_M_USBVIRT_GET_NAME = IPC_FIRST_USER_METHOD + 80,
-	IPC_M_USBVIRT_CONTROL_READ,
-	IPC_M_USBVIRT_CONTROL_WRITE,
-	IPC_M_USBVIRT_INTERRUPT_IN,
-	IPC_M_USBVIRT_INTERRUPT_OUT,
-	IPC_M_USBVIRT_BULK_IN,
-	IPC_M_USBVIRT_BULK_OUT
-} usbvirt_hc_to_device_method_t;
-
-extern errno_t usbvirt_ipc_send_control_read(async_sess_t *, void *, size_t,
-    void *, size_t, size_t *);
-extern errno_t usbvirt_ipc_send_control_write(async_sess_t *, void *, size_t,
-    void *, size_t);
-extern errno_t usbvirt_ipc_send_data_in(async_sess_t *, usb_endpoint_t,
-    usb_transfer_type_t, void *, size_t, size_t *);
-extern errno_t usbvirt_ipc_send_data_out(async_sess_t *, usb_endpoint_t,
-    usb_transfer_type_t, void *, size_t);
-
-extern bool usbvirt_is_usbvirt_method(sysarg_t);
-extern bool usbvirt_ipc_handle_call(usbvirt_device_t *, ipc_call_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/include/usbvirt/virthub_base.h
===================================================================
--- uspace/lib/usbvirt/include/usbvirt/virthub_base.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Virtual USB device.
- */
-
-#ifndef LIBUSBVIRT_VIRTHUB_BASE_H_
-#define LIBUSBVIRT_VIRTHUB_BASE_H_
-
-#include <usbvirt/device.h>
-#include <usb/classes/hub.h>
-
-enum {
-	VIRTHUB_EXTR_DESC = 3,
-};
-
-typedef struct {
-	usb_standard_configuration_descriptor_t config_descriptor;
-	usb_standard_endpoint_descriptor_t endpoint_descriptor;
-	usbvirt_device_configuration_extras_t extra[VIRTHUB_EXTR_DESC];
-	usbvirt_device_configuration_t configuration;
-	usbvirt_descriptors_t descriptors;
-	usbvirt_device_t device;
-	void *data;
-} virthub_base_t;
-
-void *virthub_get_data(usbvirt_device_t *dev);
-
-errno_t virthub_base_init(virthub_base_t *instance,
-    const char *name, usbvirt_device_ops_t *ops, void *data,
-    const usb_standard_device_descriptor_t *device_desc,
-    const usb_hub_descriptor_header_t *hub_desc, usb_endpoint_t ep);
-
-usb_address_t virthub_base_get_address(virthub_base_t *instance);
-
-errno_t virthub_base_request(virthub_base_t *instance, usb_target_t target,
-    usb_direction_t dir, const usb_device_request_setup_packet_t *setup,
-    void *buffer, size_t buffer_size, size_t *real_size);
-
-errno_t virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size);
-errno_t virthub_base_get_null_status(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size);
-
-#endif
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/meson.build
===================================================================
--- uspace/lib/usbvirt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2011 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' , 'usb' , 'usbdev' ]
-private_includes += include_directories('include/usbvirt')
-src = files(
-	'src/ctrltransfer.c',
-	'src/device.c',
-	'src/ipc_dev.c',
-	'src/ipc_hc.c',
-	'src/stdreq.c',
-	'src/transfer.c',
-	'src/virthub_base.c',
-	'src/virthub_descriptors.c',
-)
Index: pace/lib/usbvirt/src/ctrltransfer.c
===================================================================
--- uspace/lib/usbvirt/src/ctrltransfer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Control transfer handling.
- */
-#include "private.h"
-#include <usb/dev/request.h>
-#include <usb/debug.h>
-#include <assert.h>
-#include <errno.h>
-
-/** Find and execute control transfer handler for virtual USB device.
- *
- * @param dev Target virtual device.
- * @param control_handlers Array of control request handlers.
- * @param setup Setup packet.
- * @param data Extra data.
- * @param data_sent_size Size of extra data in bytes.
- * @return Error code.
- * @retval EFORWARD No suitable handler found.
- */
-errno_t process_control_transfer(usbvirt_device_t *dev,
-    const usbvirt_control_request_handler_t *control_handlers,
-    const usb_device_request_setup_packet_t *setup,
-    uint8_t *data, size_t *data_sent_size)
-{
-	assert(dev);
-	assert(setup);
-
-	if (control_handlers == NULL) {
-		return EFORWARD;
-	}
-
-	const usbvirt_control_request_handler_t *handler = control_handlers;
-	for (; handler->callback != NULL; ++handler) {
-		if (handler->request != setup->request ||
-		    handler->request_type != setup->request_type) {
-			continue;
-		}
-
-		usb_log_debug("Control transfer: %s(%s)", handler->name,
-		    usb_debug_str_buffer((uint8_t *) setup, sizeof(*setup), 0));
-		errno_t rc = handler->callback(dev, setup, data, data_sent_size);
-		if (rc != EFORWARD) {
-			return rc;
-		}
-
-	}
-
-	return EFORWARD;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/device.c
===================================================================
--- uspace/lib/usbvirt/src/device.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Virtual USB device main routines.
- */
-
-#include <errno.h>
-#include <str.h>
-#include <stdio.h>
-#include <assert.h>
-#include <async.h>
-#include <devman.h>
-#include <usbvirt/device.h>
-#include <usbvirt/ipc.h>
-
-#include <usb/debug.h>
-
-/** Current device. */
-static usbvirt_device_t *DEV = NULL;
-
-/** Main IPC call handling from virtual host controller.
- *
- * @param icall Initial incoming call
- * @param arg   Local argument
- *
- */
-static void callback_connection(ipc_call_t *icall, void *arg)
-{
-	assert(DEV != NULL);
-
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		bool processed = usbvirt_ipc_handle_call(DEV, &call);
-		if (!processed) {
-			if (!ipc_get_imethod(&call)) {
-				async_answer_0(&call, EOK);
-				return;
-			} else
-				async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-/** Connect the device to the virtual host controller.
- *
- * @param dev The virtual device to be (virtually) plugged in.
- * @param vhc_path Devman path to the virtual host controller.
- * @return Error code.
- */
-errno_t usbvirt_device_plug(usbvirt_device_t *dev, const char *vhc_path)
-{
-	if (DEV != NULL)
-		return ELIMIT;
-
-	devman_handle_t handle;
-	errno_t rc = devman_fun_get_handle(vhc_path, &handle, 0);
-	if (rc != EOK)
-		return rc;
-
-	async_sess_t *hcd_sess =
-	    devman_device_connect(handle, 0);
-	if (!hcd_sess)
-		return ENOMEM;
-
-	DEV = dev;
-	dev->vhc_sess = hcd_sess;
-
-	async_exch_t *exch = async_exchange_begin(hcd_sess);
-
-	port_id_t port;
-	rc = async_create_callback_port(exch, INTERFACE_USBVIRT_CB, 0, 0,
-	    callback_connection, NULL, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		DEV = NULL;
-
-	return rc;
-}
-
-/** Disconnect the device from virtual host controller.
- *
- * @param dev Device to be disconnected.
- */
-void usbvirt_device_unplug(usbvirt_device_t *dev)
-{
-	async_hangup(dev->vhc_sess);
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/ipc_dev.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,296 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * IPC wrappers, device side.
- */
-#include <errno.h>
-#include <str.h>
-#include <stdio.h>
-#include <assert.h>
-#include <async.h>
-#include <usbvirt/device.h>
-#include <usbvirt/ipc.h>
-#include <usb/debug.h>
-
-/** Handle VHC request for device name.
- *
- * @param dev   Target virtual device.
- * @param icall The call with the request.
- *
- */
-static void ipc_get_name(usbvirt_device_t *dev, ipc_call_t *icall)
-{
-	if (dev->name == NULL) {
-		async_answer_0(icall, ENOENT);
-	}
-
-	size_t size = str_size(dev->name);
-
-	ipc_call_t call;
-	size_t accepted_size;
-	if (!async_data_read_receive(&call, &accepted_size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (accepted_size > size) {
-		accepted_size = size;
-	}
-	async_data_read_finalize(&call, dev->name, accepted_size);
-
-	async_answer_1(icall, EOK, accepted_size);
-}
-
-/** Handle VHC request for control read from the device.
- *
- * @param dev   Target virtual device.
- * @param icall The call with the request.
- *
- */
-static void ipc_control_read(usbvirt_device_t *dev, ipc_call_t *icall)
-{
-	errno_t rc;
-
-	void *setup_packet = NULL;
-	size_t setup_packet_len = 0;
-	size_t data_len = 0;
-
-	rc = async_data_write_accept(&setup_packet, false,
-	    1, 1024, 0, &setup_packet_len);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t data;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(&data, EPARTY);
-		async_answer_0(icall, EPARTY);
-		free(setup_packet);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, EPARTY);
-		async_answer_0(icall, ENOMEM);
-		free(setup_packet);
-		return;
-	}
-
-	size_t actual_len;
-	rc = usbvirt_control_read(dev, setup_packet, setup_packet_len,
-	    buffer, data_len, &actual_len);
-
-	if (rc != EOK) {
-		async_answer_0(&data, rc);
-		async_answer_0(icall, rc);
-		free(setup_packet);
-		free(buffer);
-		return;
-	}
-
-	async_data_read_finalize(&data, buffer, actual_len);
-	async_answer_0(icall, EOK);
-
-	free(setup_packet);
-	free(buffer);
-}
-
-/** Handle VHC request for control write to the device.
- *
- * @param dev   Target virtual device.
- * @param icall The call with the request.
- *
- */
-static void ipc_control_write(usbvirt_device_t *dev, ipc_call_t *icall)
-{
-	size_t data_buffer_len = ipc_get_arg1(icall);
-	errno_t rc;
-
-	void *setup_packet = NULL;
-	void *data_buffer = NULL;
-	size_t setup_packet_len = 0;
-
-	rc = async_data_write_accept(&setup_packet, false,
-	    1, 0, 0, &setup_packet_len);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (data_buffer_len > 0) {
-		rc = async_data_write_accept(&data_buffer, false,
-		    1, 0, 0, &data_buffer_len);
-		if (rc != EOK) {
-			async_answer_0(icall, rc);
-			free(setup_packet);
-			return;
-		}
-	}
-
-	rc = usbvirt_control_write(dev, setup_packet, setup_packet_len,
-	    data_buffer, data_buffer_len);
-
-	async_answer_0(icall, rc);
-
-	free(setup_packet);
-	if (data_buffer != NULL) {
-		free(data_buffer);
-	}
-}
-
-/** Handle VHC request for data read from the device (in transfer).
- *
- * @param dev   Target virtual device.
- * @param icall The call with the request.
- *
- */
-static void ipc_data_in(usbvirt_device_t *dev,
-    usb_transfer_type_t transfer_type, ipc_call_t *icall)
-{
-	usb_endpoint_t endpoint = ipc_get_arg1(icall);
-
-	errno_t rc;
-
-	size_t data_len = 0;
-	ipc_call_t data;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(&data, EPARTY);
-		async_answer_0(icall, EPARTY);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, EPARTY);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	size_t actual_len;
-	rc = usbvirt_data_in(dev, transfer_type, endpoint,
-	    buffer, data_len, &actual_len);
-
-	if (rc != EOK) {
-		async_answer_0(&data, rc);
-		async_answer_0(icall, rc);
-		free(buffer);
-		return;
-	}
-
-	async_data_read_finalize(&data, buffer, actual_len);
-	async_answer_0(icall, EOK);
-
-	free(buffer);
-}
-
-/** Handle VHC request for data write to the device (out transfer).
- *
- * @param dev   Target virtual device.
- * @param icall The call with the request.
- *
- */
-static void ipc_data_out(usbvirt_device_t *dev,
-    usb_transfer_type_t transfer_type, ipc_call_t *icall)
-{
-	usb_endpoint_t endpoint = ipc_get_arg1(icall);
-
-	void *data_buffer = NULL;
-	size_t data_buffer_size = 0;
-
-	errno_t rc = async_data_write_accept(&data_buffer, false,
-	    1, 0, 0, &data_buffer_size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = usbvirt_data_out(dev, transfer_type, endpoint,
-	    data_buffer, data_buffer_size);
-
-	async_answer_0(icall, rc);
-
-	free(data_buffer);
-}
-
-/** Handle incoming IPC call for virtual USB device.
- *
- * @param dev  Target USB device.
- * @param call Incoming call.
- *
- * @return Whether the call was handled.
- *
- */
-bool usbvirt_ipc_handle_call(usbvirt_device_t *dev, ipc_call_t *call)
-{
-	switch (ipc_get_imethod(call)) {
-	case IPC_M_USBVIRT_GET_NAME:
-		ipc_get_name(dev, call);
-		break;
-
-	case IPC_M_USBVIRT_CONTROL_READ:
-		ipc_control_read(dev, call);
-		break;
-
-	case IPC_M_USBVIRT_CONTROL_WRITE:
-		ipc_control_write(dev, call);
-		break;
-
-	case IPC_M_USBVIRT_INTERRUPT_IN:
-		ipc_data_in(dev, USB_TRANSFER_INTERRUPT, call);
-		break;
-
-	case IPC_M_USBVIRT_BULK_IN:
-		ipc_data_in(dev, USB_TRANSFER_BULK, call);
-		break;
-
-	case IPC_M_USBVIRT_INTERRUPT_OUT:
-		ipc_data_out(dev, USB_TRANSFER_INTERRUPT, call);
-		break;
-
-	case IPC_M_USBVIRT_BULK_OUT:
-		ipc_data_out(dev, USB_TRANSFER_BULK, call);
-		break;
-
-	default:
-		return false;
-	}
-
-	return true;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/ipc_hc.c
===================================================================
--- uspace/lib/usbvirt/src/ipc_hc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,318 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * IPC wrappers, host controller side.
- */
-#include <errno.h>
-#include <str.h>
-#include <stdio.h>
-#include <assert.h>
-#include <async.h>
-#include <usbvirt/device.h>
-#include <usbvirt/ipc.h>
-#include <usb/debug.h>
-
-/** Send control read transfer to virtual USB device.
- *
- * @param sess Session to the virtual device.
- * @param ep Target endpoint number.
- * @param setup_buffer Setup buffer.
- * @param setup_buffer_size Setup buffer size in bytes.
- * @param data_buffer Data buffer (DATA stage of control transfer).
- * @param data_buffer_size Size of data buffer in bytes.
- * @param data_transferred_size Number of actually transferred bytes.
- *
- * @return Error code.
- *
- */
-errno_t usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer,
-    size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size,
-    size_t *data_transferred_size)
-{
-	if (!sess)
-		return EINVAL;
-
-	if ((setup_buffer == NULL) || (setup_buffer_size == 0))
-		return EINVAL;
-
-	if ((data_buffer == NULL) || (data_buffer_size == 0))
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t opening_request = async_send_0(exch, IPC_M_USBVIRT_CONTROL_READ,
-	    NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	errno_t rc = async_data_write_start(exch, setup_buffer,
-	    setup_buffer_size);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(opening_request);
-		return rc;
-	}
-
-	ipc_call_t data_request_call;
-	aid_t data_request = async_data_read(exch, data_buffer,
-	    data_buffer_size, &data_request_call);
-
-	async_exchange_end(exch);
-
-	if (data_request == 0) {
-		async_forget(opening_request);
-		return ENOMEM;
-	}
-
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
-	async_wait_for(data_request, &data_request_rc);
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (data_request_rc != EOK) {
-		/* Prefer the return code of the opening request. */
-		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
-		else
-			return (errno_t) data_request_rc;
-	}
-
-	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
-
-	if (data_transferred_size != NULL)
-		*data_transferred_size = ipc_get_arg2(&data_request_call);
-
-	return EOK;
-}
-
-/** Send control write transfer to virtual USB device.
- *
- * @param sess Session to the virtual device.
- * @param ep Target endpoint number.
- * @param setup_buffer Setup buffer.
- * @param setup_buffer_size Setup buffer size in bytes.
- * @param data_buffer Data buffer (DATA stage of control transfer).
- * @param data_buffer_size Size of data buffer in bytes.
- *
- * @return Error code.
- *
- */
-errno_t usbvirt_ipc_send_control_write(async_sess_t *sess, void *setup_buffer,
-    size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size)
-{
-	if (!sess)
-		return EINVAL;
-
-	if ((setup_buffer == NULL) || (setup_buffer_size == 0))
-		return EINVAL;
-
-	if ((data_buffer_size > 0) && (data_buffer == NULL))
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t opening_request = async_send_1(exch, IPC_M_USBVIRT_CONTROL_WRITE,
-	    data_buffer_size, NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	errno_t rc = async_data_write_start(exch, setup_buffer,
-	    setup_buffer_size);
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(opening_request);
-		return rc;
-	}
-
-	if (data_buffer_size > 0) {
-		rc = async_data_write_start(exch, data_buffer,
-		    data_buffer_size);
-		if (rc != EOK) {
-			async_exchange_end(exch);
-			async_forget(opening_request);
-			return rc;
-		}
-	}
-
-	async_exchange_end(exch);
-
-	errno_t opening_request_rc;
-	async_wait_for(opening_request, &opening_request_rc);
-
-	return (errno_t) opening_request_rc;
-}
-
-/** Request data transfer from virtual USB device.
- *
- * @param sess Session to the virtual device.
- * @param ep Target endpoint number.
- * @param tr_type Transfer type (interrupt or bulk).
- * @param data Data buffer.
- * @param data_size Size of the data buffer in bytes.
- * @param act_size Number of actually returned bytes.
- *
- * @return Error code.
- *
- */
-errno_t usbvirt_ipc_send_data_in(async_sess_t *sess, usb_endpoint_t ep,
-    usb_transfer_type_t tr_type, void *data, size_t data_size, size_t *act_size)
-{
-	if (!sess)
-		return EINVAL;
-
-	usbvirt_hc_to_device_method_t method;
-
-	switch (tr_type) {
-	case USB_TRANSFER_INTERRUPT:
-		method = IPC_M_USBVIRT_INTERRUPT_IN;
-		break;
-	case USB_TRANSFER_BULK:
-		method = IPC_M_USBVIRT_BULK_IN;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	if ((ep <= 0) || (ep >= USBVIRT_ENDPOINT_MAX))
-		return EINVAL;
-
-	if ((data == NULL) || (data_size == 0))
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t opening_request = async_send_2(exch, method, ep, tr_type, NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	ipc_call_t data_request_call;
-	aid_t data_request = async_data_read(exch, data, data_size,
-	    &data_request_call);
-
-	async_exchange_end(exch);
-
-	if (data_request == 0) {
-		async_forget(opening_request);
-		return ENOMEM;
-	}
-
-	errno_t data_request_rc;
-	errno_t opening_request_rc;
-	async_wait_for(data_request, &data_request_rc);
-	async_wait_for(opening_request, &opening_request_rc);
-
-	if (data_request_rc != EOK) {
-		/* Prefer the return code of the opening request. */
-		if (opening_request_rc != EOK)
-			return (errno_t) opening_request_rc;
-		else
-			return (errno_t) data_request_rc;
-	}
-
-	if (opening_request_rc != EOK)
-		return (errno_t) opening_request_rc;
-
-	if (act_size != NULL)
-		*act_size = ipc_get_arg2(&data_request_call);
-
-	return EOK;
-}
-
-/** Send data to virtual USB device.
- *
- * @param sess Session to the virtual device.
- * @param ep Target endpoint number.
- * @param tr_type Transfer type (interrupt or bulk).
- * @param data Data buffer.
- * @param data_size Size of the data buffer in bytes.
- *
- * @return Error code.
- *
- */
-errno_t usbvirt_ipc_send_data_out(async_sess_t *sess, usb_endpoint_t ep,
-    usb_transfer_type_t tr_type, void *data, size_t data_size)
-{
-	if (!sess)
-		return EINVAL;
-
-	usbvirt_hc_to_device_method_t method;
-
-	switch (tr_type) {
-	case USB_TRANSFER_INTERRUPT:
-		method = IPC_M_USBVIRT_INTERRUPT_OUT;
-		break;
-	case USB_TRANSFER_BULK:
-		method = IPC_M_USBVIRT_BULK_OUT;
-		break;
-	default:
-		return EINVAL;
-	}
-
-	if ((ep <= 0) || (ep >= USBVIRT_ENDPOINT_MAX))
-		return EINVAL;
-
-	if ((data == NULL) || (data_size == 0))
-		return EINVAL;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-
-	aid_t opening_request = async_send_1(exch, method, ep, NULL);
-	if (opening_request == 0) {
-		async_exchange_end(exch);
-		return ENOMEM;
-	}
-
-	errno_t rc = async_data_write_start(exch, data, data_size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(opening_request);
-		return rc;
-	}
-
-	errno_t opening_request_rc;
-	async_wait_for(opening_request, &opening_request_rc);
-
-	return (errno_t) opening_request_rc;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/private.h
===================================================================
--- uspace/lib/usbvirt/src/private.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Private definitions.
- */
-#ifndef USBVIRT_PRIVATE_H_
-#define USBVIRT_PRIVATE_H_
-
-#include <usbvirt/device.h>
-
-errno_t process_control_transfer(usbvirt_device_t *,
-    const usbvirt_control_request_handler_t *,
-    const usb_device_request_setup_packet_t *,
-    uint8_t *, size_t *);
-
-extern usbvirt_control_request_handler_t library_handlers[];
-
-#endif
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/stdreq.c
===================================================================
--- uspace/lib/usbvirt/src/stdreq.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,258 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Standard control request handlers.
- */
-#include "private.h"
-#include <usb/dev/request.h>
-#include <assert.h>
-#include <errno.h>
-
-/** Helper for replying to control read transfer from virtual USB device.
- *
- * This function takes care of copying data to answer buffer taking care
- * of buffer sizes properly.
- *
- * @param setup_packet The setup packet.
- * @param data Data buffer to write to.
- * @param act_size Where to write actual size of returned data.
- * @param actual_data Data to be returned.
- * @param actual_data_size Size of answer data (@p actual_data) in bytes.
- */
-void usbvirt_control_reply_helper(const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size,
-    const void *actual_data, size_t actual_data_size)
-{
-	size_t expected_size = setup_packet->length;
-	if (expected_size < actual_data_size) {
-		actual_data_size = expected_size;
-	}
-
-	memcpy(data, actual_data, actual_data_size);
-
-	if (act_size != NULL) {
-		*act_size = actual_data_size;
-	}
-}
-
-/** NOP handler */
-errno_t req_nop(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet,
-    uint8_t *data, size_t *act_size)
-{
-	return EOK;
-}
-
-/** GET_DESCRIPTOR handler. */
-static errno_t req_get_descriptor(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
-{
-	uint8_t type = setup_packet->value_high;
-	uint8_t index = setup_packet->value_low;
-
-	/*
-	 * Standard device descriptor.
-	 */
-	if ((type == USB_DESCTYPE_DEVICE) && (index == 0)) {
-		if (device->descriptors && device->descriptors->device) {
-			usbvirt_control_reply_helper(setup_packet, data, act_size,
-			    device->descriptors->device,
-			    device->descriptors->device->length);
-			return EOK;
-		} else {
-			return EFORWARD;
-		}
-	}
-
-	/*
-	 * Configuration descriptor together with interface, endpoint and
-	 * class-specific descriptors.
-	 */
-	if (type == USB_DESCTYPE_CONFIGURATION) {
-		if (!device->descriptors) {
-			return EFORWARD;
-		}
-		if (index >= device->descriptors->configuration_count) {
-			return EFORWARD;
-		}
-		/* Copy the data. */
-		const usbvirt_device_configuration_t *config =
-		    &device->descriptors->configuration[index];
-		uint8_t *all_data = malloc(config->descriptor->total_length);
-		if (all_data == NULL) {
-			return ENOMEM;
-		}
-
-		uint8_t *ptr = all_data;
-		memcpy(ptr, config->descriptor, config->descriptor->length);
-		ptr += config->descriptor->length;
-		size_t i;
-		for (i = 0; i < config->extra_count; i++) {
-			const usbvirt_device_configuration_extras_t *extra =
-			    &config->extra[i];
-			memcpy(ptr, extra->data, extra->length);
-			ptr += extra->length;
-		}
-
-		usbvirt_control_reply_helper(setup_packet, data, act_size,
-		    all_data, config->descriptor->total_length);
-
-		free(all_data);
-
-		return EOK;
-	}
-
-	return EFORWARD;
-}
-
-static errno_t req_set_address(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
-{
-	uint16_t new_address = setup_packet->value;
-	uint16_t zero1 = setup_packet->index;
-	uint16_t zero2 = setup_packet->length;
-
-	if ((zero1 != 0) || (zero2 != 0)) {
-		return EINVAL;
-	}
-
-	if (new_address > 127) {
-		return EINVAL;
-	}
-
-	device->address = new_address;
-
-	return EOK;
-}
-
-static errno_t req_set_configuration(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
-{
-	uint16_t configuration_value = setup_packet->value;
-	uint16_t zero1 = setup_packet->index;
-	uint16_t zero2 = setup_packet->length;
-
-	if ((zero1 != 0) || (zero2 != 0)) {
-		return EINVAL;
-	}
-
-	/*
-	 * Configuration value is 1 byte information.
-	 */
-	if (configuration_value > 255) {
-		return EINVAL;
-	}
-
-	/*
-	 * Do nothing when in default state. According to specification,
-	 * this is not specified.
-	 */
-	if (device->state == USBVIRT_STATE_DEFAULT) {
-		return EOK;
-	}
-
-	usbvirt_device_state_t new_state;
-	if (configuration_value == 0) {
-		new_state = USBVIRT_STATE_ADDRESS;
-	} else {
-		// FIXME: check that this configuration exists
-		new_state = USBVIRT_STATE_CONFIGURED;
-	}
-
-	if (device->ops && device->ops->state_changed) {
-		device->ops->state_changed(device, device->state, new_state);
-	}
-	device->state = new_state;
-
-	return EOK;
-}
-
-static errno_t req_get_dev_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
-{
-	if (setup_packet->length != 2)
-		return ESTALL;
-	data[0] = (device->self_powered ? 1 : 0) | (device->remote_wakeup ? 2 : 0);
-	data[1] = 0;
-	*act_size = 2;
-	return EOK;
-}
-static errno_t req_get_iface_ep_status(usbvirt_device_t *device,
-    const usb_device_request_setup_packet_t *setup_packet, uint8_t *data, size_t *act_size)
-{
-	if (setup_packet->length != 2)
-		return ESTALL;
-	data[0] = 0;
-	data[1] = 0;
-	*act_size = 2;
-	return EOK;
-}
-
-/** Standard request handlers. */
-usbvirt_control_request_handler_t library_handlers[] = {
-	{
-		STD_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_SET_ADDRESS),
-		.name = "SetAddress",
-		.callback = req_set_address
-	},
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
-		.name = "GetStdDescriptor",
-		.callback = req_get_descriptor
-	},
-	{
-		STD_REQ_OUT(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_SET_CONFIGURATION),
-		.name = "SetConfiguration",
-		.callback = req_set_configuration
-	},
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_STATUS),
-		.name = "GetDeviceStatus",
-		.callback = req_get_dev_status,
-	},
-	{
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_INTERFACE, USB_DEVREQ_GET_STATUS),
-		.name = "GetInterfaceStatus",
-		.callback = req_get_iface_ep_status,
-	},
-	{
-		/* virtual EPs by default cannot be stalled */
-		STD_REQ_IN(USB_REQUEST_RECIPIENT_ENDPOINT, USB_DEVREQ_GET_STATUS),
-		.name = "GetEndpointStatus",
-		.callback = req_get_iface_ep_status,
-	},
-	{ .callback = NULL }
-};
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/transfer.c
===================================================================
--- uspace/lib/usbvirt/src/transfer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Transfer handling.
- */
-#include <usbvirt/device.h>
-#include <usb/debug.h>
-#include <errno.h>
-#include <assert.h>
-#include "private.h"
-
-/** Process a control transfer to the virtual USB device.
- *
- * @param dev Target device.
- * @param setup Setup packet data.
- * @param setup_size Size of setup packet.
- * @param data Extra data (DATA stage).
- * @param data_size Size of extra data in bytes.
- * @param data_size_sent Number of actually send bytes during the transfer
- *	(only used for READ transfers).
- * @return Error code.
- */
-static errno_t usbvirt_control_transfer(usbvirt_device_t *dev,
-    const void *setup, size_t setup_size,
-    void *data, size_t data_size, size_t *data_size_sent)
-{
-	assert(dev);
-	assert(dev->ops);
-
-	if (setup_size != sizeof(usb_device_request_setup_packet_t)) {
-		return ESTALL;
-	}
-	const usb_device_request_setup_packet_t *setup_packet = setup;
-	if (data_size != setup_packet->length) {
-		return ESTALL;
-	}
-
-	errno_t rc;
-
-	/* Run user handler first. */
-	rc = process_control_transfer(dev, dev->ops->control,
-	    setup_packet, data, data_size_sent);
-	if (rc != EFORWARD) {
-		return rc;
-	}
-
-	/* Run the library handlers afterwards. */
-	rc = process_control_transfer(dev, library_handlers,
-	    setup_packet, data, data_size_sent);
-
-	if (rc == EFORWARD) {
-		usb_log_warning("Control transfer {%s (%s)} not handled.",
-		    usb_debug_str_buffer(setup, setup_size, 10),
-		    setup_packet->request_type & 0x80 ?
-		    "IN" : usb_debug_str_buffer(data, data_size, 10));
-		rc = EBADCHECKSUM;
-	}
-
-	return rc;
-}
-
-/** Issue a control write transfer to virtual USB device.
- *
- * @see usbvirt_control_transfer
- *
- * @param dev Target virtual device.
- * @param setup Setup data.
- * @param setup_size Size of setup packet.
- * @param data Extra data (DATA stage).
- * @param data_size Size of extra data buffer in bytes.
- * @return Error code.
- */
-errno_t usbvirt_control_write(usbvirt_device_t *dev, const void *setup,
-    size_t setup_size, void *data, size_t data_size)
-{
-	return usbvirt_control_transfer(dev, setup, setup_size,
-	    data, data_size, NULL);
-}
-
-/** Issue a control read transfer to virtual USB device.
- *
- * @see usbvirt_control_transfer
- *
- * @param dev Target virtual device.
- * @param setup Setup data.
- * @param setup_size Size of setup packet.
- * @param data Extra data (DATA stage).
- * @param data_size Size of extra data buffer in bytes.
- * @param data_size_sent Number of actually send bytes during the transfer.
- * @return Error code.
- */
-errno_t usbvirt_control_read(usbvirt_device_t *dev,
-    const void *setup, size_t setup_size,
-    void *data, size_t data_size, size_t *data_size_sent)
-{
-	return usbvirt_control_transfer(dev, setup, setup_size,
-	    data, data_size, data_size_sent);
-}
-
-/** Send data to virtual USB device.
- *
- * @param dev Target virtual device.
- * @param transf_type Transfer type (interrupt, bulk).
- * @param endpoint Endpoint number.
- * @param data Data sent from the driver to the device.
- * @param data_size Size of the @p data buffer in bytes.
- * @return Error code.
- */
-errno_t usbvirt_data_out(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
-    usb_endpoint_t endpoint, const void *data, size_t data_size)
-{
-	if ((endpoint <= 0) || (endpoint >= USBVIRT_ENDPOINT_MAX)) {
-		return ERANGE;
-	}
-	if ((dev->ops == NULL) || (dev->ops->data_out[endpoint] == NULL)) {
-		return ENOTSUP;
-	}
-
-	errno_t rc = dev->ops->data_out[endpoint](dev, endpoint, transf_type,
-	    data, data_size);
-
-	return rc;
-}
-
-/** Request data from virtual USB device.
- *
- * @param dev Target virtual device.
- * @param transf_type Transfer type (interrupt, bulk).
- * @param endpoint Endpoint number.
- * @param data Where to stored data the device returns to the driver.
- * @param data_size Size of the @p data buffer in bytes.
- * @param data_size_sent Number of actually written bytes.
- * @return Error code.
- */
-errno_t usbvirt_data_in(usbvirt_device_t *dev, usb_transfer_type_t transf_type,
-    usb_endpoint_t endpoint, void *data, size_t data_size, size_t *data_size_sent)
-{
-	if ((endpoint <= 0) || (endpoint >= USBVIRT_ENDPOINT_MAX)) {
-		return ERANGE;
-	}
-	if ((dev->ops == NULL) || (dev->ops->data_in[endpoint] == NULL)) {
-		return ENOTSUP;
-	}
-
-	size_t data_size_sent_tmp;
-	errno_t rc = dev->ops->data_in[endpoint](dev, endpoint, transf_type,
-	    data, data_size, &data_size_sent_tmp);
-
-	if (rc != EOK) {
-		return rc;
-	}
-
-	if (data_size_sent != NULL) {
-		*data_size_sent = data_size_sent_tmp;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/virthub_base.c
===================================================================
--- uspace/lib/usbvirt/src/virthub_base.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Virtual USB device main routines.
- */
-
-#include <assert.h>
-#include <macros.h>
-#include <str.h>
-#include <usb/classes/hub.h>
-
-#include "virthub_base.h"
-
-extern const usb_standard_device_descriptor_t virthub_device_descriptor;
-extern const usb_standard_configuration_descriptor_t virthub_configuration_descriptor_without_hub_size;
-extern const usb_standard_endpoint_descriptor_t virthub_endpoint_descriptor;
-extern const usbvirt_device_configuration_extras_t virthub_interface_descriptor_ex;
-
-void *virthub_get_data(usbvirt_device_t *dev)
-{
-	assert(dev);
-	virthub_base_t *base = dev->device_data;
-	assert(base);
-	return base->data;
-}
-
-errno_t virthub_base_init(virthub_base_t *instance, const char *name,
-    usbvirt_device_ops_t *ops, void *data,
-    const usb_standard_device_descriptor_t *device_desc,
-    const usb_hub_descriptor_header_t *hub_desc, usb_endpoint_t ep)
-{
-	assert(instance);
-	assert(hub_desc);
-	assert(name);
-
-	if (!usb_endpoint_is_valid(ep) || (ep == USB_ENDPOINT_DEFAULT_CONTROL))
-		return EINVAL;
-
-	instance->config_descriptor =
-	    virthub_configuration_descriptor_without_hub_size;
-	instance->config_descriptor.total_length += hub_desc->length;
-
-	instance->endpoint_descriptor = virthub_endpoint_descriptor;
-	instance->endpoint_descriptor.endpoint_address = 128 | ep;
-	instance->endpoint_descriptor.max_packet_size =
-	    STATUS_BYTES(hub_desc->port_count);
-
-	instance->descriptors.device =
-	    device_desc ? device_desc : &virthub_device_descriptor;
-	instance->descriptors.configuration = &instance->configuration;
-	instance->descriptors.configuration_count = 1;
-
-	instance->configuration.descriptor = &instance->config_descriptor;
-	instance->configuration.extra = instance->extra;
-	instance->configuration.extra_count = ARRAY_SIZE(instance->extra);
-
-	instance->extra[0] = virthub_interface_descriptor_ex;
-	instance->extra[1].data = (void *)hub_desc;
-	instance->extra[1].length = hub_desc->length;
-	instance->extra[2].data = (void *)&instance->endpoint_descriptor;
-	instance->extra[2].length = sizeof(instance->endpoint_descriptor);
-
-	instance->device.ops = ops;
-	instance->device.descriptors = &instance->descriptors;
-	instance->device.device_data = instance;
-	instance->device.address = 0;
-	instance->data = data;
-	instance->device.name = str_dup(name);
-
-	if (!instance->device.name)
-		return ENOMEM;
-
-	return EOK;
-}
-
-usb_address_t virthub_base_get_address(virthub_base_t *instance)
-{
-	assert(instance);
-	return instance->device.address;
-}
-
-errno_t virthub_base_request(virthub_base_t *instance, usb_target_t target,
-    usb_direction_t dir, const usb_device_request_setup_packet_t *setup,
-    void *buffer, size_t buffer_size, size_t *real_size)
-{
-	assert(instance);
-	assert(real_size);
-	assert(setup);
-
-	if (target.address != virthub_base_get_address(instance))
-		return ENOENT;
-
-	switch (dir) {
-	case USB_DIRECTION_IN:
-		if (target.endpoint == 0) {
-			return usbvirt_control_read(&instance->device,
-			    setup, sizeof(*setup), buffer, buffer_size,
-			    real_size);
-		} else {
-			return usbvirt_data_in(&instance->device,
-			    USB_TRANSFER_INTERRUPT, target.endpoint,
-			    buffer, buffer_size, real_size);
-		}
-	case USB_DIRECTION_OUT:
-		if (target.endpoint == 0) {
-			return usbvirt_control_write(&instance->device,
-			    setup, sizeof(*setup), buffer, buffer_size);
-		}
-		/* fall through */
-	default:
-		return ENOTSUP;
-
-	}
-}
-
-errno_t virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	assert(dev);
-	virthub_base_t *instance = dev->device_data;
-	assert(instance);
-	if (request->value_high == USB_DESCTYPE_HUB) {
-		usbvirt_control_reply_helper(request, data, act_size,
-		    instance->extra[1].data, instance->extra[1].length);
-		return EOK;
-	}
-	/* Let the framework handle all the rest. */
-	return EFORWARD;
-}
-
-errno_t virthub_base_get_null_status(usbvirt_device_t *dev,
-    const usb_device_request_setup_packet_t *request, uint8_t *data,
-    size_t *act_size)
-{
-	uint32_t zero = 0;
-	if (request->length != sizeof(zero))
-		return ESTALL;
-	usbvirt_control_reply_helper(request, data, act_size,
-	    &zero, sizeof(zero));
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/lib/usbvirt/src/virthub_descriptors.c
===================================================================
--- uspace/lib/usbvirt/src/virthub_descriptors.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libusbvirt
- * @{
- */
-/** @file
- * Virtual USB device main routines.
- */
-
-#include <usb/classes/classes.h>
-#include <usb/classes/hub.h>
-#include <usb/descriptor.h>
-#include <usb/usb.h>
-#include <usbvirt/device.h>
-
-#include "virthub_base.h"
-
-#define HUB_CONFIGURATION_ID   1
-
-/** Standard device descriptor. */
-const usb_standard_device_descriptor_t virthub_device_descriptor = {
-	.length = sizeof(usb_standard_device_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_DEVICE,
-	.usb_spec_version = 0x110,
-	.device_class = USB_CLASS_HUB,
-	.device_subclass = 0,
-	.device_protocol = 0,
-	.max_packet_size = 64,
-	.configuration_count = 1
-};
-
-/** Standard interface descriptor. */
-const usb_standard_interface_descriptor_t virthub_interface_descriptor = {
-	.length = sizeof(usb_standard_interface_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_INTERFACE,
-	.interface_number = 0,
-	.alternate_setting = 0,
-	.endpoint_count = 1,
-	.interface_class = USB_CLASS_HUB,
-	.interface_subclass = 0,
-	.interface_protocol = 0,
-	.str_interface = 0
-};
-
-/** Endpoint descriptor. */
-const usb_standard_endpoint_descriptor_t virthub_endpoint_descriptor = {
-	.length = sizeof(usb_standard_endpoint_descriptor_t),
-	.descriptor_type = USB_DESCTYPE_ENDPOINT,
-	.endpoint_address = 1 | 128,
-	.attributes = USB_TRANSFER_INTERRUPT,
-	.max_packet_size = 8,
-	.poll_interval = 0xFF,
-};
-
-/** Standard configuration descriptor. */
-const usb_standard_configuration_descriptor_t virthub_configuration_descriptor_without_hub_size = {
-	.length = sizeof(virthub_configuration_descriptor_without_hub_size),
-	.descriptor_type = USB_DESCTYPE_CONFIGURATION,
-	.total_length =
-	    sizeof(virthub_configuration_descriptor_without_hub_size) +
-	    sizeof(virthub_interface_descriptor) +
-	    sizeof(virthub_endpoint_descriptor),
-	.interface_count = 1,
-	.configuration_number = HUB_CONFIGURATION_ID,
-	.str_configuration = 0,
-	.attributes = 0, /* We are self-powered device */
-	.max_power = 0,
-};
-
-const usbvirt_device_configuration_extras_t virthub_interface_descriptor_ex = {
-	.data = (uint8_t *) &virthub_interface_descriptor,
-	.length = sizeof(virthub_interface_descriptor),
-};
-
-/**
- * @}
- */
Index: pace/lib/virtio/meson.build
===================================================================
--- uspace/lib/virtio/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2018 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('virtio.c', 'virtio-pci.c')
Index: pace/lib/virtio/virtio-pci.c
===================================================================
--- uspace/lib/virtio/virtio-pci.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,294 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file VIRTIO support
- */
-
-#include "virtio-pci.h"
-
-#include <ddf/driver.h>
-#include <ddf/log.h>
-#include <pci_dev_iface.h>
-
-static bool check_bar(virtio_dev_t *vdev, uint8_t bar, uint32_t offset,
-    uint32_t length)
-{
-	/* We must ignore the capability if bar is greater than 5 */
-	if (bar >= PCI_BAR_COUNT)
-		return false;
-
-	/* This is not a mapped BAR */
-	if (!vdev->bar[bar].mapped)
-		return false;
-
-	uintptr_t start = (uintptr_t) vdev->bar[bar].mapped_base;
-	if (start + offset < start)
-		return false;
-	if (start + offset > start + vdev->bar[bar].mapped_size)
-		return false;
-	if (start + offset + length < start + offset)
-		return false;
-	if (start + offset + length > start + vdev->bar[bar].mapped_size)
-		return false;
-
-	return true;
-}
-
-static void virtio_pci_common_cfg(virtio_dev_t *vdev, uint8_t bar,
-    uint32_t offset, uint32_t length)
-{
-	if (vdev->common_cfg)
-		return;
-
-	if (!check_bar(vdev, bar, offset, length))
-		return;
-
-	vdev->common_cfg = vdev->bar[bar].mapped_base + offset;
-
-	ddf_msg(LVL_NOTE, "common_cfg=%p", vdev->common_cfg);
-}
-
-static void virtio_pci_notify_cfg(virtio_dev_t *vdev, uint8_t bar,
-    uint32_t offset, uint32_t length, uint32_t multiplier)
-{
-	if (vdev->notify_base)
-		return;
-
-	if (!check_bar(vdev, bar, offset, length))
-		return;
-
-	vdev->notify_base = vdev->bar[bar].mapped_base + offset;
-	vdev->notify_off_multiplier = multiplier;
-
-	ddf_msg(LVL_NOTE, "notify_base=%p, off_multiplier=%u",
-	    vdev->notify_base, vdev->notify_off_multiplier);
-}
-
-static void virtio_pci_isr_cfg(virtio_dev_t *vdev, uint8_t bar, uint32_t offset,
-    uint32_t length)
-{
-	if (vdev->isr)
-		return;
-
-	if (!check_bar(vdev, bar, offset, length))
-		return;
-
-	vdev->isr = vdev->bar[bar].mapped_base + offset;
-	vdev->isr_phys = vdev->bar[bar].phys_base + offset;
-
-	ddf_msg(LVL_NOTE, "isr=%p (phys=%#" PRIxn ")", vdev->isr,
-	    vdev->isr_phys);
-}
-
-static void virtio_pci_device_cfg(virtio_dev_t *vdev, uint8_t bar,
-    uint32_t offset, uint32_t length)
-{
-	if (vdev->device_cfg)
-		return;
-
-	if (!check_bar(vdev, bar, offset, length))
-		return;
-
-	vdev->device_cfg = vdev->bar[bar].mapped_base + offset;
-
-	ddf_msg(LVL_NOTE, "device_cfg=%p", vdev->device_cfg);
-}
-
-static errno_t enable_resources(async_sess_t *pci_sess, virtio_dev_t *vdev)
-{
-	pio_window_t pio_window;
-	errno_t rc = pio_window_get(pci_sess, &pio_window);
-	if (rc != EOK)
-		return rc;
-
-	hw_resource_list_t hw_res;
-	rc = hw_res_get_resource_list(pci_sess, &hw_res);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Enable resources and reconstruct the mapping between BAR and resource
-	 * indices. We are going to need this later when the VIRTIO PCI
-	 * capabilities refer to specific BARs.
-	 *
-	 * XXX: The mapping should probably be provided by the PCI driver
-	 *      itself.
-	 */
-	for (unsigned i = 0, j = 0; i < PCI_BAR_COUNT && j < hw_res.count;
-	    i++) {
-		/* Detect and skip unused BARs */
-		uint32_t bar;
-		rc = pci_config_space_read_32(pci_sess,
-		    PCI_BAR0 + i * sizeof(uint32_t), &bar);
-		if (rc != EOK)
-			return rc;
-		if (!bar)
-			continue;
-
-		hw_resource_t *res = &hw_res.resources[j];
-		rc = pio_enable_resource(&pio_window, res,
-		    &vdev->bar[i].mapped_base, &vdev->bar[i].phys_base,
-		    &vdev->bar[i].mapped_size);
-		if (rc == EOK)
-			vdev->bar[i].mapped = true;
-		j++;
-	}
-
-	return rc;
-}
-
-static errno_t disable_resources(virtio_dev_t *vdev)
-{
-	for (unsigned i = 0; i < PCI_BAR_COUNT; i++) {
-		if (vdev->bar[i].mapped) {
-			errno_t rc = pio_disable(vdev->bar[i].mapped_base,
-			    vdev->bar[i].mapped_size);
-			if (rc != EOK)
-				return rc;
-			vdev->bar[i].mapped = false;
-		}
-	}
-
-	return EOK;
-}
-
-errno_t virtio_pci_dev_initialize(ddf_dev_t *dev, virtio_dev_t *vdev)
-{
-	memset(vdev, 0, sizeof(virtio_dev_t));
-
-	async_sess_t *pci_sess = ddf_dev_parent_sess_get(dev);
-	if (!pci_sess)
-		return ENOENT;
-
-	errno_t rc = enable_resources(pci_sess, vdev);
-	if (rc != EOK)
-		goto error;
-
-	/*
-	 * Find the VIRTIO PCI Capabilities
-	 */
-	uint8_t c;
-	uint8_t cap_vndr;
-	for (rc = pci_config_space_cap_first(pci_sess, &c, &cap_vndr);
-	    (rc == EOK) && c;
-	    rc = pci_config_space_cap_next(pci_sess, &c, &cap_vndr)) {
-		if (cap_vndr != PCI_CAP_VENDORSPECID)
-			continue;
-
-		uint8_t cap_len;
-		rc = pci_config_space_read_8(pci_sess,
-		    VIRTIO_PCI_CAP_CAP_LEN(c), &cap_len);
-		if (rc != EOK)
-			goto error;
-
-		if (cap_len < VIRTIO_PCI_CAP_END(0)) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		uint8_t cfg_type;
-		rc = pci_config_space_read_8(pci_sess,
-		    VIRTIO_PCI_CAP_CFG_TYPE(c), &cfg_type);
-		if (rc != EOK)
-			goto error;
-
-		uint8_t bar;
-		rc = pci_config_space_read_8(pci_sess, VIRTIO_PCI_CAP_BAR(c),
-		    &bar);
-		if (rc != EOK)
-			goto error;
-
-		uint32_t offset;
-		rc = pci_config_space_read_32(pci_sess,
-		    VIRTIO_PCI_CAP_OFFSET(c), &offset);
-		if (rc != EOK)
-			goto error;
-
-		uint32_t length;
-		rc = pci_config_space_read_32(pci_sess,
-		    VIRTIO_PCI_CAP_LENGTH(c), &length);
-		if (rc != EOK)
-			goto error;
-
-		uint32_t multiplier;
-		switch (cfg_type) {
-		case VIRTIO_PCI_CAP_COMMON_CFG:
-			virtio_pci_common_cfg(vdev, bar, offset, length);
-			break;
-		case VIRTIO_PCI_CAP_NOTIFY_CFG:
-			if (cap_len < VIRTIO_PCI_CAP_END(sizeof(uint32_t))) {
-				rc = EINVAL;
-				goto error;
-			}
-			rc = pci_config_space_read_32(pci_sess,
-			    VIRTIO_PCI_CAP_END(c), &multiplier);
-			if (rc != EOK)
-				goto error;
-			virtio_pci_notify_cfg(vdev, bar, offset, length,
-			    multiplier);
-			break;
-		case VIRTIO_PCI_CAP_ISR_CFG:
-			virtio_pci_isr_cfg(vdev, bar, offset, length);
-			break;
-		case VIRTIO_PCI_CAP_DEVICE_CFG:
-			virtio_pci_device_cfg(vdev, bar, offset, length);
-			break;
-		case VIRTIO_PCI_CAP_PCI_CFG:
-			break;
-		default:
-			break;
-		}
-	}
-
-	/* Check that the configuration is complete */
-	if (!vdev->common_cfg || !vdev->notify_base || !vdev->isr ||
-	    !vdev->device_cfg) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	return rc;
-
-error:
-	(void) disable_resources(vdev);
-	return rc;
-}
-
-errno_t virtio_pci_dev_cleanup(virtio_dev_t *vdev)
-{
-	if (vdev->queues) {
-		for (unsigned i = 0;
-		    i < pio_read_le16(&vdev->common_cfg->num_queues); i++)
-			virtio_virtq_teardown(vdev, i);
-		free(vdev->queues);
-	}
-	return disable_resources(vdev);
-}
-
-/** @}
- */
Index: pace/lib/virtio/virtio-pci.h
===================================================================
--- uspace/lib/virtio/virtio-pci.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file VIRTIO PCI definitions
- */
-
-#ifndef _VIRTIO_PCI_H_
-#define _VIRTIO_PCI_H_
-
-#include <ddf/driver.h>
-#include <pci_dev_iface.h>
-#include <ddi.h>
-#include <fibril_synch.h>
-
-#define VIRTIO_PCI_CAP_CAP_LEN(c)	((c) + 2)
-#define VIRTIO_PCI_CAP_CFG_TYPE(c)	((c) + 3)
-#define VIRTIO_PCI_CAP_BAR(c)		((c) + 4)
-#define VIRTIO_PCI_CAP_OFFSET(c)	((c) + 8)
-#define VIRTIO_PCI_CAP_LENGTH(c)	((c) + 12)
-#define VIRTIO_PCI_CAP_END(c)		((c) + 16)
-
-#define VIRTIO_PCI_CAP_COMMON_CFG	1
-#define VIRTIO_PCI_CAP_NOTIFY_CFG	2
-#define VIRTIO_PCI_CAP_ISR_CFG		3
-#define VIRTIO_PCI_CAP_DEVICE_CFG	4
-#define VIRTIO_PCI_CAP_PCI_CFG		5
-
-#define VIRTIO_DEV_STATUS_RESET			0
-#define VIRTIO_DEV_STATUS_ACKNOWLEDGE		1
-#define VIRTIO_DEV_STATUS_DRIVER		2
-#define VIRTIO_DEV_STATUS_DRIVER_OK		4
-#define VIRTIO_DEV_STATUS_FEATURES_OK		8
-#define VIRTIO_DEV_STATUS_DEVICE_NEEDS_RESET	64
-#define VIRTIO_DEV_STATUS_FAILED		128
-
-#define VIRTIO_FEATURES_0_31	0
-#define VIRTIO_FEATURES_32_63	1
-
-#define VIRTIO_F_VERSION_1	1
-
-/** Common configuration structure layout according to VIRTIO version 1.0 */
-typedef struct virtio_pci_common_cfg {
-	ioport32_t device_feature_select;
-	const ioport32_t device_feature;
-	ioport32_t driver_feature_select;
-	ioport32_t driver_feature;
-	ioport16_t msix_config;
-	const ioport16_t num_queues;
-	ioport8_t device_status;
-	const ioport8_t config_generation;
-	ioport16_t queue_select;
-	ioport16_t queue_size;
-	ioport16_t queue_msix_vector;
-	ioport16_t queue_enable;
-	const ioport16_t queue_notif_off;
-	ioport64_t queue_desc;
-	ioport64_t queue_avail;
-	ioport64_t queue_used;
-} virtio_pci_common_cfg_t;
-
-/** The buffer continues in the next descriptor */
-#define VIRTQ_DESC_F_NEXT	1
-/** Device write-only buffer */
-#define VIRTQ_DESC_F_WRITE	2
-/** Buffer contains a list of buffer descriptors */
-#define VIRTQ_DESC_F_INDIRECT	4
-
-/** Virtqueue Descriptor structure as per VIRTIO version 1.0 */
-typedef struct virtq_desc {
-	ioport64_t addr;	/**< Buffer physical address */
-	ioport32_t len;		/**< Buffer length */
-	ioport16_t flags;	/**< Buffer flags */
-	ioport16_t next;	/**< Continuation descriptor */
-} virtq_desc_t;
-
-#define VIRTQ_AVAIL_F_NO_INTERRUPT	1
-
-/** Virtqueue Available Ring as per VIRTIO version 1.0 */
-typedef struct virtq_avail {
-	ioport16_t flags;
-	ioport16_t idx;
-	ioport16_t ring[];
-	/*
-	 * We do not define the optional used_event member here in order to be
-	 * able to define ring as a variable-length array.
-	 */
-} virtq_avail_t;
-
-typedef struct virtq_used_elem {
-	ioport32_t id;
-	ioport32_t len;
-} virtq_used_elem_t;
-
-#define VIRTQ_USED_F_NO_NOTIFY	1
-
-/** Virtqueue Used Ring as per VIRTIO version 1.0 */
-typedef struct virtq_used {
-	ioport16_t flags;
-	ioport16_t idx;
-	virtq_used_elem_t ring[];
-	/*
-	 * We do not define the optional avail_event member here in order to be
-	 * able to define ring as a variable-length array.
-	 */
-} virtq_used_t;
-
-typedef struct {
-	void *virt;
-	uintptr_t phys;
-	size_t size;
-
-	/** Mutex protecting access to this virtqueue */
-	fibril_mutex_t lock;
-
-	/**
-	 * Size of the queue which determines the number of descriptors and
-	 * DMA buffers.
-	 */
-	size_t queue_size;
-
-	/** Virtual address of queue size virtq descriptors */
-	virtq_desc_t *desc;
-	/** Virtual address of the available ring */
-	virtq_avail_t *avail;
-	/** Virtual address of the used ring */
-	virtq_used_t *used;
-	uint16_t used_last_idx;
-
-	/** Address of the queue's notification register */
-	ioport16_t *notify;
-} virtq_t;
-
-/** VIRTIO-device specific data associated with the NIC framework nic_t */
-typedef struct {
-	struct {
-		bool mapped;
-		uintptr_t phys_base;
-		void *mapped_base;
-		size_t mapped_size;
-	} bar[PCI_BAR_COUNT];
-
-	/** Commong configuration structure */
-	virtio_pci_common_cfg_t *common_cfg;
-
-	/** Notification base address */
-	void *notify_base;
-	/** Notification offset multiplier */
-	uint32_t notify_off_multiplier;
-
-	/** INT#x interrupt ISR register */
-	ioport8_t *isr;
-	uintptr_t isr_phys;
-
-	/** Device-specific configuration */
-	void *device_cfg;
-
-	/** Virtqueues */
-	virtq_t *queues;
-} virtio_dev_t;
-
-extern errno_t virtio_setup_dma_bufs(unsigned int, size_t, bool, void *[],
-    uintptr_t []);
-extern void virtio_teardown_dma_bufs(void *[]);
-
-extern void virtio_virtq_desc_set(virtio_dev_t *vdev, uint16_t, uint16_t,
-    uint64_t, uint32_t, uint16_t, uint16_t);
-extern uint16_t virtio_virtq_desc_get_next(virtio_dev_t *vdev, uint16_t,
-    uint16_t);
-
-extern void virtio_create_desc_free_list(virtio_dev_t *, uint16_t, uint16_t,
-    uint16_t *);
-extern uint16_t virtio_alloc_desc(virtio_dev_t *, uint16_t, uint16_t *);
-extern void virtio_free_desc(virtio_dev_t *, uint16_t, uint16_t *, uint16_t);
-
-extern void virtio_virtq_produce_available(virtio_dev_t *, uint16_t, uint16_t);
-extern bool virtio_virtq_consume_used(virtio_dev_t *, uint16_t, uint16_t *,
-    uint32_t *);
-
-extern errno_t virtio_virtq_setup(virtio_dev_t *, uint16_t, uint16_t);
-extern void virtio_virtq_teardown(virtio_dev_t *, uint16_t);
-
-extern errno_t virtio_device_setup_start(virtio_dev_t *, uint32_t);
-extern void virtio_device_setup_fail(virtio_dev_t *);
-extern void virtio_device_setup_finalize(virtio_dev_t *);
-
-extern errno_t virtio_pci_dev_initialize(ddf_dev_t *, virtio_dev_t *);
-extern errno_t virtio_pci_dev_cleanup(virtio_dev_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/virtio/virtio.c
===================================================================
--- uspace/lib/virtio/virtio.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/*
- * Copyright (c) 2018 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @file VIRTIO support
- */
-
-#include "virtio-pci.h"
-
-#include <as.h>
-#include <align.h>
-#include <macros.h>
-#include <stdalign.h>
-
-#include <ddf/log.h>
-#include <barrier.h>
-
-/** Allocate DMA buffers
- *
- * @param buffers[in]  Number of buffers to allocate.
- * @param size[in]     Size of each buffer.
- * @param write[in]    True if the buffers are writable by the driver, false
- *                     otherwise.
- * @param buf[out]     Output array holding virtual addresses of the allocated
- *                     buffers.
- * @param buf_p[out]   Output array holding physical addresses of the allocated
- *                     buffers.
- *
- * The buffers can be deallocated by virtio_teardown_dma_bufs().
- *
- * @return  EOK on success or error code.
- */
-errno_t virtio_setup_dma_bufs(unsigned int buffers, size_t size,
-    bool write, void *buf[], uintptr_t buf_p[])
-{
-	/*
-	 * Allocate all buffers at once in one large chunk.
-	 */
-	void *virt = AS_AREA_ANY;
-	uintptr_t phys;
-	errno_t rc = dmamem_map_anonymous(buffers * size, 0,
-	    write ? AS_AREA_WRITE | AS_AREA_READ : AS_AREA_READ, 0, &phys,
-	    &virt);
-	if (rc != EOK)
-		return rc;
-
-	ddf_msg(LVL_NOTE, "DMA buffers: %p-%p", virt, virt + buffers * size);
-
-	/*
-	 * Calculate addresses of the individual buffers for easy access.
-	 */
-	for (unsigned i = 0; i < buffers; i++) {
-		buf[i] = virt + i * size;
-		buf_p[i] = phys + i * size;
-	}
-
-	return EOK;
-}
-
-/** Deallocate DMA buffers
- *
- * @param buf[in]  Array holding the virtual addresses of the DMA buffers
- *                 previously allocated by virtio_setup_dma_bufs().
- */
-void virtio_teardown_dma_bufs(void *buf[])
-{
-	if (buf[0]) {
-		dmamem_unmap_anonymous(buf[0]);
-		buf[0] = NULL;
-	}
-}
-
-void virtio_virtq_desc_set(virtio_dev_t *vdev, uint16_t num, uint16_t descno,
-    uint64_t addr, uint32_t len, uint16_t flags, uint16_t next)
-{
-	virtq_desc_t *d = &vdev->queues[num].desc[descno];
-	pio_write_le64(&d->addr, addr);
-	pio_write_le32(&d->len, len);
-	pio_write_le16(&d->flags, flags);
-	pio_write_le16(&d->next, next);
-}
-
-uint16_t virtio_virtq_desc_get_next(virtio_dev_t *vdev, uint16_t num,
-    uint16_t descno)
-{
-	virtq_desc_t *d = &vdev->queues[num].desc[descno];
-	if (!(pio_read_le16(&d->flags) & VIRTQ_DESC_F_NEXT))
-		return (uint16_t) -1U;
-	return pio_read_le16(&d->next);
-}
-
-/** Create free descriptor list from the unused VIRTIO descriptors
- *
- * @param vdev[in]   VIRTIO device for which the free list will be created.
- * @param num[in]    Index of the virtqueue for which the free list will be
- *                   created.
- * @param size[in]   Number of descriptors on the free list. The free list will
- *                   contain descriptors starting from 0 to \a size - 1.
- * @param head[out]  Variable that will hold the VIRTIO descriptor at the head
- *                   of the free list.
- */
-void virtio_create_desc_free_list(virtio_dev_t *vdev, uint16_t num,
-    uint16_t size, uint16_t *head)
-{
-	for (unsigned i = 0; i < size; i++) {
-		virtio_virtq_desc_set(vdev, num, i, 0, 0,
-		    VIRTQ_DESC_F_NEXT, (i + 1 == size) ? 0xffffu : i + 1);
-	}
-	*head = 0;
-}
-
-/** Allocate a descriptor from the free list
- *
- * @param vdev[in]      VIRTIO device with the free list.
- * @param num[in]       Index of the virtqueue with free list.
- * @param head[in,out]  Head of the free list.
- *
- * @return  Allocated descriptor or 0xFFFF if the list is empty.
- */
-uint16_t virtio_alloc_desc(virtio_dev_t *vdev, uint16_t num, uint16_t *head)
-{
-	virtq_t *q = &vdev->queues[num];
-	fibril_mutex_lock(&q->lock);
-	uint16_t descno = *head;
-	if (descno != (uint16_t) -1U)
-		*head = virtio_virtq_desc_get_next(vdev, num, descno);
-	fibril_mutex_unlock(&q->lock);
-	return descno;
-}
-
-/** Free a descriptor into the free list
- *
- * @param vdev[in]      VIRTIO device with the free list.
- * @param num[in]       Index of the virtqueue with free list.
- * @param head[in,out]  Head of the free list.
- * @param descno[in]    The freed descriptor.
- */
-void virtio_free_desc(virtio_dev_t *vdev, uint16_t num, uint16_t *head,
-    uint16_t descno)
-{
-	virtq_t *q = &vdev->queues[num];
-	fibril_mutex_lock(&q->lock);
-	virtio_virtq_desc_set(vdev, num, descno, 0, 0, VIRTQ_DESC_F_NEXT,
-	    *head);
-	*head = descno;
-	fibril_mutex_unlock(&q->lock);
-}
-
-void virtio_virtq_produce_available(virtio_dev_t *vdev, uint16_t num,
-    uint16_t descno)
-{
-	virtq_t *q = &vdev->queues[num];
-
-	fibril_mutex_lock(&q->lock);
-	uint16_t idx = pio_read_le16(&q->avail->idx);
-	pio_write_le16(&q->avail->ring[idx % q->queue_size], descno);
-	write_barrier();
-	pio_write_le16(&q->avail->idx, idx + 1);
-	write_barrier();
-	pio_write_le16(q->notify, num);
-	fibril_mutex_unlock(&q->lock);
-}
-
-bool virtio_virtq_consume_used(virtio_dev_t *vdev, uint16_t num,
-    uint16_t *descno, uint32_t *len)
-{
-	virtq_t *q = &vdev->queues[num];
-
-	fibril_mutex_lock(&q->lock);
-	uint16_t last_idx = q->used_last_idx % q->queue_size;
-	if (last_idx == (pio_read_le16(&q->used->idx) % q->queue_size)) {
-		fibril_mutex_unlock(&q->lock);
-		return false;
-	}
-
-	*descno = (uint16_t) pio_read_le32(&q->used->ring[last_idx].id);
-	*len = pio_read_le32(&q->used->ring[last_idx].len);
-
-	q->used_last_idx++;
-	fibril_mutex_unlock(&q->lock);
-
-	return true;
-}
-
-errno_t virtio_virtq_setup(virtio_dev_t *vdev, uint16_t num, uint16_t size)
-{
-	virtq_t *q = &vdev->queues[num];
-	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
-
-	/* Program the queue of our interest */
-	pio_write_le16(&cfg->queue_select, num);
-
-	/* Trim the size of the queue as needed */
-	if (size > pio_read_16(&cfg->queue_size)) {
-		ddf_msg(LVL_ERROR, "Virtq %u: not enough descriptors", num);
-		return ENOMEM;
-	}
-	pio_write_le16(&cfg->queue_size, size);
-	ddf_msg(LVL_NOTE, "Virtq %u: %u descriptors", num, (unsigned) size);
-
-	size_t avail_offset = 0;
-	size_t used_offset = 0;
-
-	/*
-	 * Compute the size of the needed DMA memory and also the offsets of
-	 * the individual components
-	 */
-	size_t mem_size = sizeof(virtq_desc_t[size]);
-	mem_size = ALIGN_UP(mem_size, alignof(virtq_avail_t));
-	avail_offset = mem_size;
-	mem_size += sizeof(virtq_avail_t) + sizeof(ioport16_t[size]) +
-	    sizeof(ioport16_t);
-	mem_size = ALIGN_UP(mem_size, alignof(virtq_used_t));
-	used_offset = mem_size;
-	mem_size += sizeof(virtq_used_t) + sizeof(virtq_used_elem_t[size]) +
-	    sizeof(ioport16_t);
-
-	/*
-	 * Allocate DMA memory for the virtqueues
-	 */
-	q->virt = AS_AREA_ANY;
-	errno_t rc = dmamem_map_anonymous(mem_size, 0,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &q->phys, &q->virt);
-	if (rc != EOK) {
-		q->virt = NULL;
-		return rc;
-	}
-
-	fibril_mutex_initialize(&q->lock);
-
-	q->size = mem_size;
-	q->queue_size = size;
-	q->desc = q->virt;
-	q->avail = q->virt + avail_offset;
-	q->used = q->virt + used_offset;
-	q->used_last_idx = 0;
-
-	memset(q->virt, 0, q->size);
-
-	/*
-	 * Write the configured addresses to device's common config
-	 */
-	pio_write_le64(&cfg->queue_desc, q->phys);
-	pio_write_le64(&cfg->queue_avail, q->phys + avail_offset);
-	pio_write_le64(&cfg->queue_used, q->phys + used_offset);
-
-	ddf_msg(LVL_NOTE, "DMA memory for virtq %d: virt=%p, phys=%p, size=%zu",
-	    num, q->virt, (void *) q->phys, q->size);
-
-	/* Determine virtq's notification address */
-	q->notify = vdev->notify_base +
-	    pio_read_le16(&cfg->queue_notif_off) * vdev->notify_off_multiplier;
-
-	ddf_msg(LVL_NOTE, "notification register: %p", q->notify);
-
-	/* Enable the queue */
-	pio_write_le16(&cfg->queue_enable, 1);
-	ddf_msg(LVL_NOTE, "virtq %d set", num);
-
-	return rc;
-}
-
-void virtio_virtq_teardown(virtio_dev_t *vdev, uint16_t num)
-{
-	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
-
-	/* Disable the queue */
-	pio_write_le16(&cfg->queue_enable, 0);
-
-	virtq_t *q = &vdev->queues[num];
-	if (q->size)
-		dmamem_unmap_anonymous(q->virt);
-}
-
-/**
- * Perform device initialization as described in section 3.1.1 of the
- * specification, steps 1 - 6.
- */
-errno_t virtio_device_setup_start(virtio_dev_t *vdev, uint32_t features)
-{
-	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
-
-	/* 1. Reset the device */
-	uint8_t status = VIRTIO_DEV_STATUS_RESET;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 2. Acknowledge we found the device */
-	status |= VIRTIO_DEV_STATUS_ACKNOWLEDGE;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 3. We know how to drive the device */
-	status |= VIRTIO_DEV_STATUS_DRIVER;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 4. Read the offered feature flags */
-	pio_write_le32(&cfg->device_feature_select, VIRTIO_FEATURES_0_31);
-	uint32_t device_features = pio_read_le32(&cfg->device_feature);
-
-	uint32_t reserved_features = VIRTIO_F_VERSION_1;
-	pio_write_le32(&cfg->device_feature_select, VIRTIO_FEATURES_32_63);
-	uint32_t device_reserved_features = pio_read_le32(&cfg->device_feature);
-
-	ddf_msg(LVL_NOTE, "offered features %x, reserved features %x",
-	    device_features, device_reserved_features);
-
-	if (features != (features & device_features))
-		return ENOTSUP;
-	features &= device_features;
-
-	if (reserved_features != (reserved_features & device_reserved_features))
-		return ENOTSUP;
-	reserved_features &= device_reserved_features;
-
-	/* 4. Write the accepted feature flags */
-	pio_write_le32(&cfg->driver_feature_select, VIRTIO_FEATURES_0_31);
-	pio_write_le32(&cfg->driver_feature, features);
-	pio_write_le32(&cfg->driver_feature_select, VIRTIO_FEATURES_32_63);
-	pio_write_le32(&cfg->driver_feature, reserved_features);
-
-	ddf_msg(LVL_NOTE, "accepted features %x, reserved features %x",
-	    features, reserved_features);
-
-	/* 5. Set FEATURES_OK */
-	status |= VIRTIO_DEV_STATUS_FEATURES_OK;
-	pio_write_8(&cfg->device_status, status);
-
-	/* 6. Test if the device supports our feature subset */
-	status = pio_read_8(&cfg->device_status);
-	if (!(status & VIRTIO_DEV_STATUS_FEATURES_OK))
-		return ENOTSUP;
-
-	return EOK;
-}
-
-/**
- * Perform device initialization as described in section 3.1.1 of the
- * specification, step 8 (go live).
- */
-void virtio_device_setup_finalize(virtio_dev_t *vdev)
-{
-	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
-
-	/* 8. Go live */
-	uint8_t status = pio_read_8(&cfg->device_status);
-	pio_write_8(&cfg->device_status, status | VIRTIO_DEV_STATUS_DRIVER_OK);
-}
-
-void virtio_device_setup_fail(virtio_dev_t *vdev)
-{
-	virtio_pci_common_cfg_t *cfg = vdev->common_cfg;
-
-	uint8_t status = pio_read_8(&cfg->device_status);
-	pio_write_8(&cfg->device_status, status | VIRTIO_DEV_STATUS_FAILED);
-}
-
-/** @}
- */
Index: pace/lib/vt/include/vt/vt100.h
===================================================================
--- uspace/lib/vt/include/vt/vt100.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libvt
- * @{
- */
-
-#ifndef LIBVT_VT100_H_
-#define LIBVT_VT100_H_
-
-#include <io/charfield.h>
-#include <io/keycode.h>
-#include <io/pos_event.h>
-#include <ipc/common.h>
-#include <uchar.h>
-
-/** Buffer size when creating actual VT100 commands.
- *
- * This is absurdly large but since we accept numbers via sysarg_t,
- * we make it big enough for the largest value to be on the safe side
- * (and to silence compiler too).
- *
- * TODO: find out if VT100 has some hard limits or perhaps simply cut-out
- * values larger than 16 bits or something.
- */
-#define MAX_CONTROL 64
-
-typedef enum {
-	CI_BLACK   = 0,
-	CI_RED     = 1,
-	CI_GREEN   = 2,
-	CI_BROWN   = 3,
-	CI_BLUE    = 4,
-	CI_MAGENTA = 5,
-	CI_CYAN    = 6,
-	CI_WHITE   = 7
-} sgr_color_index_t;
-
-typedef enum {
-	SGR_RESET       = 0,
-	SGR_BOLD        = 1,
-	SGR_UNDERLINE   = 4,
-	SGR_BLINK       = 5,
-	SGR_REVERSE     = 7,
-	SGR_FGCOLOR     = 30,
-	SGR_BGCOLOR     = 40
-} sgr_command_t;
-
-typedef struct {
-	void (*putuchar)(void *, char32_t);
-	void (*control_puts)(void *, const char *);
-	void (*flush)(void *);
-	void (*key)(void *, keymod_t, keycode_t, char);
-	void (*pos_event)(void *, pos_event_t *);
-} vt100_cb_t;
-
-/** VT100 decoding state */
-typedef enum {
-	/** Base state */
-	vts_base,
-	/** Prefix 1b */
-	vts_1b,
-	/** Prefix 1b 4f */
-	vts_1b4f,
-	/** Prefix 1b 5b */
-	vts_1b5b,
-	/** Prefix 1b 5b 31 */
-	vts_1b5b31,
-	/** Prefix 1b 5b 31 35 */
-	vts_1b5b3135,
-	/** Prefix 1b 5b 31 37 */
-	vts_1b5b3137,
-	/** Prefix 1b 5b 31 38 */
-	vts_1b5b3138,
-	/** Prefix 1b 5b 31 39 */
-	vts_1b5b3139,
-	/** Prefix 1b 5b 31 3b */
-	vts_1b5b313b,
-	/** Prefix 1b 5b 31 3b 32 */
-	vts_1b5b313b32,
-	/** Prefix 1b 5b 31 3b 33 */
-	vts_1b5b313b33,
-	/** Prefix 1b 5b 32 */
-	vts_1b5b32,
-	/** Prefix 1b 5b 32 30 */
-	vts_1b5b3230,
-	/** Prefix 1b 5b 32 31 */
-	vts_1b5b3231,
-	/** Prefix 1b 5b 32 33 */
-	vts_1b5b3233,
-	/** Prefix 1b 5b 32 34 */
-	vts_1b5b3234,
-	/** Prefix 1b 5b 32 35 */
-	vts_1b5b3235,
-	/** Prefix 1b 5b 32 38 */
-	vts_1b5b3238,
-	/** Prefix 1b 5b 35 */
-	vts_1b5b35,
-	/** Prefix 1b 5b 33 */
-	vts_1b5b33,
-	/** Prefix 1b 5b 36 */
-	vts_1b5b36,
-	/** Prefix 1b 5b 3c - mouse report */
-	vts_1b5b3c
-} vt100_state_t;
-
-enum {
-	INNUM_MAX = 3
-};
-
-/** VT100 instance */
-typedef struct {
-	/** Number of columns */
-	sysarg_t cols;
-	/** Number of rows */
-	sysarg_t rows;
-
-	/** Current column */
-	sysarg_t cur_col;
-	/** Current row */
-	sysarg_t cur_row;
-	/** Current attributes */
-	char_attrs_t cur_attrs;
-
-	/** Enable RGB color */
-	bool enable_rgb;
-
-	/** Callback functions */
-	vt100_cb_t *cb;
-	/** Argument to callback functions */
-	void *arg;
-
-	/** Input decoding state */
-	vt100_state_t state;
-	/** Decoded numeric parameters */
-	uint16_t innum[INNUM_MAX];
-	/** Index of current numeric parameter */
-	unsigned inncnt;
-} vt100_t;
-
-extern sgr_color_index_t color_map[];
-
-extern vt100_t *vt100_create(void *, sysarg_t, sysarg_t,
-    vt100_cb_t *);
-extern void vt100_resize(vt100_t *, sysarg_t, sysarg_t);
-extern void vt100_destroy(vt100_t *);
-
-extern errno_t vt100_yield(vt100_t *);
-extern errno_t vt100_claim(vt100_t *);
-extern void vt100_get_dimensions(vt100_t *, sysarg_t *, sysarg_t *);
-
-extern void vt100_cls(vt100_t *);
-extern void vt100_set_pos(vt100_t *, sysarg_t, sysarg_t);
-extern void vt100_goto(vt100_t *, sysarg_t, sysarg_t);
-extern void vt100_sgr(vt100_t *, unsigned int);
-extern void vt100_set_sgr(vt100_t *, char_attrs_t);
-extern void vt100_set_attr(vt100_t *, char_attrs_t);
-extern void vt100_cursor_visibility(vt100_t *, bool);
-extern void vt100_set_button_reporting(vt100_t *, bool);
-extern void vt100_set_title(vt100_t *, const char *);
-extern void vt100_putuchar(vt100_t *, char32_t);
-extern void vt100_flush(vt100_t *);
-
-extern void vt100_rcvd_char(vt100_t *, char);
-
-#endif
-
-/** @}
- */
Index: pace/lib/vt/meson.build
===================================================================
--- uspace/lib/vt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input', 'output' ]
-src = files(
-	'src/vt100.c'
-)
Index: pace/lib/vt/src/vt100.c
===================================================================
--- uspace/lib/vt/src/vt100.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1579 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libvt
- * @{
- */
-
-#include <ctype.h>
-#include <errno.h>
-#include <io/color.h>
-#include <io/keycode.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <vt/vt100.h>
-
-/** Map console colors to VT100 color indices */
-sgr_color_index_t color_map[] = {
-	[COLOR_BLACK]   = CI_BLACK,
-	[COLOR_BLUE]    = CI_BLUE,
-	[COLOR_GREEN]   = CI_GREEN,
-	[COLOR_CYAN]    = CI_CYAN,
-	[COLOR_RED]     = CI_RED,
-	[COLOR_MAGENTA] = CI_MAGENTA,
-	[COLOR_YELLOW]  = CI_BROWN,
-	[COLOR_WHITE]   = CI_WHITE
-};
-
-/** Clear screen.
- *
- * @param vt VT instance
- */
-void vt100_cls(vt100_t *vt)
-{
-	vt->cb->control_puts(vt->arg, "\033[2J");
-}
-
-/** ECMA-48 Set Graphics Rendition.
- *
- * @param vt VT instance
- * @param mode SGR mode number
- */
-void vt100_sgr(vt100_t *vt, unsigned int mode)
-{
-	char control[MAX_CONTROL];
-
-	snprintf(control, MAX_CONTROL, "\033[%um", mode);
-	vt->cb->control_puts(vt->arg, control);
-}
-
-/** Set Graphics Rendition with 5 arguments.
- *
- * @param vt VT instance
- * @param a1 First argument
- * @param a2 Second argument
- * @param a3 Third argument
- * @param a4 Fourth argument
- * @param a5 Fifth argument
- */
-static void vt100_sgr5(vt100_t *vt, unsigned a1, unsigned a2,
-    unsigned a3, unsigned a4, unsigned a5)
-{
-	char control[MAX_CONTROL];
-
-	snprintf(control, MAX_CONTROL, "\033[%u;%u;%u;%u;%um",
-	    a1, a2, a3, a4, a5);
-	vt->cb->control_puts(vt->arg, control);
-}
-
-/** Set cussor position.
- *
- * @param vt VT instance
- * @param col Column (starting from 0)
- * @param row Row (starting from 0)
- */
-void vt100_set_pos(vt100_t *vt, sysarg_t col, sysarg_t row)
-{
-	char control[MAX_CONTROL];
-
-	snprintf(control, MAX_CONTROL, "\033[%" PRIun ";%" PRIun "f",
-	    row + 1, col + 1);
-	vt->cb->control_puts(vt->arg, control);
-}
-
-/** Set graphics rendition based on attributes,
- *
- * @param vt VT instance
- * @param attrs Character attributes
- */
-void vt100_set_sgr(vt100_t *vt, char_attrs_t attrs)
-{
-	unsigned color;
-
-	switch (attrs.type) {
-	case CHAR_ATTR_STYLE:
-		switch (attrs.val.style) {
-		case STYLE_NORMAL:
-			vt100_sgr(vt, SGR_RESET);
-			vt100_sgr(vt, SGR_BGCOLOR + CI_WHITE);
-			vt100_sgr(vt, SGR_FGCOLOR + CI_BLACK);
-			break;
-		case STYLE_EMPHASIS:
-			vt100_sgr(vt, SGR_RESET);
-			vt100_sgr(vt, SGR_BGCOLOR + CI_WHITE);
-			vt100_sgr(vt, SGR_FGCOLOR + CI_RED);
-			vt100_sgr(vt, SGR_BOLD);
-			break;
-		case STYLE_INVERTED:
-			vt100_sgr(vt, SGR_RESET);
-			vt100_sgr(vt, SGR_BGCOLOR + CI_BLACK);
-			vt100_sgr(vt, SGR_FGCOLOR + CI_WHITE);
-			break;
-		case STYLE_SELECTED:
-			vt100_sgr(vt, SGR_RESET);
-			vt100_sgr(vt, SGR_BGCOLOR + CI_RED);
-			vt100_sgr(vt, SGR_FGCOLOR + CI_WHITE);
-			break;
-		}
-		break;
-	case CHAR_ATTR_INDEX:
-		vt100_sgr(vt, SGR_RESET);
-		vt100_sgr(vt, SGR_BGCOLOR + color_map[attrs.val.index.bgcolor & 7]);
-		vt100_sgr(vt, SGR_FGCOLOR + color_map[attrs.val.index.fgcolor & 7]);
-
-		if (attrs.val.index.attr & CATTR_BRIGHT)
-			vt100_sgr(vt, SGR_BOLD);
-
-		break;
-	case CHAR_ATTR_RGB:
-		if (vt->enable_rgb == true) {
-			vt100_sgr5(vt, 48, 2, RED(attrs.val.rgb.bgcolor),
-			    GREEN(attrs.val.rgb.bgcolor),
-			    BLUE(attrs.val.rgb.bgcolor));
-			vt100_sgr5(vt, 38, 2, RED(attrs.val.rgb.fgcolor),
-			    GREEN(attrs.val.rgb.fgcolor),
-			    BLUE(attrs.val.rgb.fgcolor));
-		} else {
-			vt100_sgr(vt, SGR_RESET);
-			color =
-			    ((RED(attrs.val.rgb.fgcolor) >= 0x80) ? COLOR_RED : 0) |
-			    ((GREEN(attrs.val.rgb.fgcolor) >= 0x80) ? COLOR_GREEN : 0) |
-			    ((BLUE(attrs.val.rgb.fgcolor) >= 0x80) ? COLOR_BLUE : 0);
-			vt100_sgr(vt, SGR_FGCOLOR + color_map[color]);
-			color =
-			    ((RED(attrs.val.rgb.bgcolor) >= 0x80) ? COLOR_RED : 0) |
-			    ((GREEN(attrs.val.rgb.bgcolor) >= 0x80) ? COLOR_GREEN : 0) |
-			    ((BLUE(attrs.val.rgb.bgcolor) >= 0x80) ? COLOR_BLUE : 0);
-			vt100_sgr(vt, SGR_BGCOLOR + color_map[color]);
-		}
-		break;
-	}
-}
-
-/** Create VT instance.
- *
- * @param arg Argument passed to callback functions
- * @param cols Number of columns
- * @param rows Number of rows
- * @param cb Callback functions
- *
- * @return Pointer to new VT instance on success, NULL on failure.
- */
-vt100_t *vt100_create(void *arg, sysarg_t cols, sysarg_t rows, vt100_cb_t *cb)
-{
-	vt100_t *vt = malloc(sizeof(vt100_t));
-	if (vt == NULL)
-		return NULL;
-
-	vt->cb = cb;
-	vt->arg = arg;
-
-	vt->cols = cols;
-	vt->rows = rows;
-
-	vt->cur_col = (sysarg_t) -1;
-	vt->cur_row = (sysarg_t) -1;
-
-	vt->cur_attrs.type = -1;
-	vt->cur_attrs.val.style = -1;
-
-	vt->state = vts_base;
-	vt->inncnt = 0;
-
-	return vt;
-}
-
-/** Resize VT instance.
- *
- * @param vt VT instance
- * @param cols New number of columns
- * @param rows New number of rows
- */
-void vt100_resize(vt100_t *vt, sysarg_t cols, sysarg_t rows)
-{
-	vt->cols = cols;
-	vt->rows = rows;
-
-	if (vt->cur_col > cols - 1)
-		vt->cur_col = cols - 1;
-	if (vt->cur_row > rows - 1)
-		vt->cur_row = rows - 1;
-}
-
-/** Destroy VT instance.
- *
- * @param vt VT instance
- */
-void vt100_destroy(vt100_t *vt)
-{
-	free(vt);
-}
-
-/** Get VT size.
- *
- * @param vt VT instance
- * @param cols Place to store number of columns
- * @param rows Place to store number of rows
- */
-void vt100_get_dimensions(vt100_t *vt, sysarg_t *cols,
-    sysarg_t *rows)
-{
-	*cols = vt->cols;
-	*rows = vt->rows;
-}
-
-/** Temporarily yield VT to other users.
- *
- * @param vt VT instance
- * @return EOK on success or an error code
- */
-errno_t vt100_yield(vt100_t *vt)
-{
-	return EOK;
-}
-
-/** Reclaim VT.
- *
- * @param vt VT instance
- * @return EOK on success or an error code
- */
-errno_t vt100_claim(vt100_t *vt)
-{
-	return EOK;
-}
-
-/** Go to specified position, if needed.
- *
- * @param vt VT instance
- * @param col Column (starting from 0)
- * @param row Row (starting from 0)
- */
-void vt100_goto(vt100_t *vt, sysarg_t col, sysarg_t row)
-{
-	if ((col >= vt->cols) || (row >= vt->rows))
-		return;
-
-	if ((col != vt->cur_col) || (row != vt->cur_row)) {
-		vt100_set_pos(vt, col, row);
-		vt->cur_col = col;
-		vt->cur_row = row;
-	}
-}
-
-/** Set character attributes, if needed.
- *
- * @param vt VT instance
- * @param attrs Attributes
- */
-void vt100_set_attr(vt100_t *vt, char_attrs_t attrs)
-{
-	if (!attrs_same(vt->cur_attrs, attrs)) {
-		vt100_set_sgr(vt, attrs);
-		vt->cur_attrs = attrs;
-	}
-}
-
-/** Set cursor visibility.
- *
- * @param vt VT instance
- * @param @c true to make cursor visible, @c false to make it invisible
- */
-void vt100_cursor_visibility(vt100_t *vt, bool visible)
-{
-	if (visible)
-		vt->cb->control_puts(vt->arg, "\033[?25h");
-	else
-		vt->cb->control_puts(vt->arg, "\033[?25l");
-}
-
-/** Set mouse button press/release reporting.
- *
- * @param vt VT instance
- * @param @c true to enable button press/release reporting
- */
-void vt100_set_button_reporting(vt100_t *vt, bool enable)
-{
-	if (enable) {
-		/* Enable button tracking */
-		vt->cb->control_puts(vt->arg, "\033[?1000h");
-		/* Enable SGR encoding of mouse reports */
-		vt->cb->control_puts(vt->arg, "\033[?1006h");
-	} else {
-		/* Disable button tracking */
-		vt->cb->control_puts(vt->arg, "\033[?1000l");
-		/* Disable SGR encoding of mouse reports */
-		vt->cb->control_puts(vt->arg, "\033[?1006l");
-	}
-}
-
-/** Set terminal title.
- *
- * @param vt VT instance
- * @param title Terminal title
- */
-void vt100_set_title(vt100_t *vt, const char *title)
-{
-	vt->cb->control_puts(vt->arg, "\033]0;");
-	vt->cb->control_puts(vt->arg, title);
-	vt->cb->control_puts(vt->arg, "\a");
-}
-
-/** Print Unicode character.
- *
- * @param vt VT instance
- * @parma ch Unicode character
- */
-void vt100_putuchar(vt100_t *vt, char32_t ch)
-{
-	vt->cb->putuchar(vt->arg, ch == 0 ? ' ' : ch);
-	vt->cur_col++;
-
-	if (vt->cur_col >= vt->cols) {
-		vt->cur_row += vt->cur_col / vt->cols;
-		vt->cur_col %= vt->cols;
-	}
-}
-
-/** Flush VT.
- *
- * @param vt VT instance
- */
-void vt100_flush(vt100_t *vt)
-{
-	vt->cb->flush(vt->arg);
-}
-
-/** Recognize a key.
- *
- * Generate a key callback and reset decoder state.
- *
- * @param vt VT instance
- * @param mods Key modifiers
- * @param key Key code
- * @param c Character
- */
-static void vt100_key(vt100_t *vt, keymod_t mods, keycode_t key, char c)
-{
-	vt->cb->key(vt->arg, mods, key, c);
-	vt->state = vts_base;
-}
-
-/** Generate position event callback.
- * *
- * @param vt VT instance
- * @param ev Position event
- */
-static void vt100_pos_event(vt100_t *vt, pos_event_t *ev)
-{
-	vt->cb->pos_event(vt->arg, ev);
-}
-
-/** Clear number decoder state.
- *
- * @param vt VT instance
- */
-static void vt100_clear_innum(vt100_t *vt)
-{
-	unsigned i;
-
-	vt->inncnt = 0;
-	for (i = 0; i < INNUM_MAX; i++)
-		vt->innum[i] = 0;
-}
-
-/** Process input character with prefix 1b.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x1b:
-		vt100_key(vt, 0, KC_ESCAPE, c);
-		break;
-	case 0x60:
-		vt100_key(vt, KM_ALT, KC_BACKTICK, c);
-		break;
-
-	case 0x31:
-		vt100_key(vt, KM_ALT, KC_1, c);
-		break;
-	case 0x32:
-		vt100_key(vt, KM_ALT, KC_2, c);
-		break;
-	case 0x33:
-		vt100_key(vt, KM_ALT, KC_3, c);
-		break;
-	case 0x34:
-		vt100_key(vt, KM_ALT, KC_4, c);
-		break;
-	case 0x35:
-		vt100_key(vt, KM_ALT, KC_5, c);
-		break;
-	case 0x36:
-		vt100_key(vt, KM_ALT, KC_6, c);
-		break;
-	case 0x37:
-		vt100_key(vt, KM_ALT, KC_7, c);
-		break;
-	case 0x38:
-		vt100_key(vt, KM_ALT, KC_8, c);
-		break;
-	case 0x39:
-		vt100_key(vt, KM_ALT, KC_9, c);
-		break;
-	case 0x30:
-		vt100_key(vt, KM_ALT, KC_0, c);
-		break;
-
-	case 0x2d:
-		vt100_key(vt, KM_ALT, KC_MINUS, c);
-		break;
-	case 0x3d:
-		vt100_key(vt, KM_ALT, KC_EQUALS, c);
-		break;
-
-	case 0x71:
-		vt100_key(vt, KM_ALT, KC_Q, c);
-		break;
-	case 0x77:
-		vt100_key(vt, KM_ALT, KC_W, c);
-		break;
-	case 0x65:
-		vt100_key(vt, KM_ALT, KC_E, c);
-		break;
-	case 0x72:
-		vt100_key(vt, KM_ALT, KC_R, c);
-		break;
-	case 0x74:
-		vt100_key(vt, KM_ALT, KC_T, c);
-		break;
-	case 0x79:
-		vt100_key(vt, KM_ALT, KC_Y, c);
-		break;
-	case 0x75:
-		vt100_key(vt, KM_ALT, KC_U, c);
-		break;
-	case 0x69:
-		vt100_key(vt, KM_ALT, KC_I, c);
-		break;
-	case 0x6f:
-		vt100_key(vt, KM_ALT, KC_O, c);
-		break;
-	case 0x70:
-		vt100_key(vt, KM_ALT, KC_P, c);
-		break;
-
-		/* 0x1b, 0x5b is used by other keys/sequences */
-
-	case 0x5d:
-		vt100_key(vt, KM_ALT, KC_RBRACKET, c);
-		break;
-
-	case 0x61:
-		vt100_key(vt, KM_ALT, KC_A, c);
-		break;
-	case 0x73:
-		vt100_key(vt, KM_ALT, KC_S, c);
-		break;
-	case 0x64:
-		vt100_key(vt, KM_ALT, KC_D, c);
-		break;
-	case 0x66:
-		vt100_key(vt, KM_ALT, KC_F, c);
-		break;
-	case 0x67:
-		vt100_key(vt, KM_ALT, KC_G, c);
-		break;
-	case 0x68:
-		vt100_key(vt, KM_ALT, KC_H, c);
-		break;
-	case 0x6a:
-		vt100_key(vt, KM_ALT, KC_J, c);
-		break;
-	case 0x6b:
-		vt100_key(vt, KM_ALT, KC_K, c);
-		break;
-	case 0x6c:
-		vt100_key(vt, KM_ALT, KC_L, c);
-		break;
-
-	case 0x3b:
-		vt100_key(vt, KM_ALT, KC_SEMICOLON, c);
-		break;
-	case 0x27:
-		vt100_key(vt, KM_ALT, KC_QUOTE, c);
-		break;
-	case 0x5c:
-		vt100_key(vt, KM_ALT, KC_BACKSLASH, c);
-		break;
-
-	case 0x7a:
-		vt100_key(vt, KM_ALT, KC_Z, c);
-		break;
-	case 0x78:
-		vt100_key(vt, KM_ALT, KC_X, c);
-		break;
-	case 0x63:
-		vt100_key(vt, KM_ALT, KC_C, c);
-		break;
-	case 0x76:
-		vt100_key(vt, KM_ALT, KC_V, c);
-		break;
-	case 0x62:
-		vt100_key(vt, KM_ALT, KC_B, c);
-		break;
-	case 0x6e:
-		vt100_key(vt, KM_ALT, KC_N, c);
-		break;
-	case 0x6d:
-		vt100_key(vt, KM_ALT, KC_M, c);
-		break;
-
-	case 0x2c:
-		vt100_key(vt, KM_ALT, KC_COMMA, c);
-		break;
-	case 0x2e:
-		vt100_key(vt, KM_ALT, KC_PERIOD, c);
-		break;
-	case 0x2f:
-		vt100_key(vt, KM_ALT, KC_SLASH, c);
-		break;
-
-	case 0x4f:
-		vt->state = vts_1b4f;
-		break;
-	case 0x5b:
-		vt->state = vts_1b5b;
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 4f.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b4f(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x50:
-		vt100_key(vt, 0, KC_F1, 0);
-		break;
-	case 0x51:
-		vt100_key(vt, 0, KC_F2, 0);
-		break;
-	case 0x52:
-		vt100_key(vt, 0, KC_F3, 0);
-		break;
-	case 0x53:
-		vt100_key(vt, 0, KC_F4, 0);
-		break;
-	case 0x48:
-		vt100_key(vt, 0, KC_HOME, 0);
-		break;
-	case 0x46:
-		vt100_key(vt, 0, KC_END, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x31:
-		vt->state = vts_1b5b31;
-		break;
-	case 0x32:
-		vt->state = vts_1b5b32;
-		break;
-	case 0x35:
-		vt->state = vts_1b5b35;
-		break;
-	case 0x33:
-		vt->state = vts_1b5b33;
-		break;
-	case 0x36:
-		vt->state = vts_1b5b36;
-		break;
-	case 0x3c:
-		vt->state = vts_1b5b3c;
-		break;
-	case 0x41:
-		vt100_key(vt, 0, KC_UP, 0);
-		break;
-	case 0x44:
-		vt100_key(vt, 0, KC_LEFT, 0);
-		break;
-	case 0x42:
-		vt100_key(vt, 0, KC_DOWN, 0);
-		break;
-	case 0x43:
-		vt100_key(vt, 0, KC_RIGHT, 0);
-		break;
-	case 0x48:
-		vt100_key(vt, 0, KC_HOME, 0);
-		break;
-	case 0x46:
-		vt100_key(vt, 0, KC_END, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b31(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x35:
-		vt->state = vts_1b5b3135;
-		break;
-	case 0x37:
-		vt->state = vts_1b5b3137;
-		break;
-	case 0x38:
-		vt->state = vts_1b5b3138;
-		break;
-	case 0x39:
-		vt->state = vts_1b5b3139;
-		break;
-	case 0x3b:
-		vt->state = vts_1b5b313b;
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 35.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3135(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F5, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 37.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3137(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F6, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 38.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3138(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F7, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 39.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3139(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F8, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 3b.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b313b(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x32:
-		vt->state = vts_1b5b313b32;
-		break;
-	case 0x33:
-		vt->state = vts_1b5b313b33;
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 3b 32.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b313b32(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x41:
-		vt100_key(vt, KM_SHIFT, KC_UP, 0);
-		break;
-	case 0x44:
-		vt100_key(vt, KM_SHIFT, KC_LEFT, 0);
-		break;
-	case 0x42:
-		vt100_key(vt, KM_SHIFT, KC_DOWN, 0);
-		break;
-	case 0x43:
-		vt100_key(vt, KM_SHIFT, KC_RIGHT, 0);
-		break;
-	case 0x48:
-		vt100_key(vt, KM_SHIFT, KC_HOME, 0);
-		break;
-	case 0x46:
-		vt100_key(vt, KM_SHIFT, KC_END, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 31 3b 33.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b313b33(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x41:
-		vt100_key(vt, KM_ALT, KC_UP, 0);
-		break;
-	case 0x44:
-		vt100_key(vt, KM_ALT, KC_LEFT, 0);
-		break;
-	case 0x42:
-		vt100_key(vt, KM_ALT, KC_DOWN, 0);
-		break;
-	case 0x43:
-		vt100_key(vt, KM_ALT, KC_RIGHT, 0);
-		break;
-	case 0x48:
-		vt100_key(vt, KM_ALT, KC_HOME, 0);
-		break;
-	case 0x46:
-		vt100_key(vt, KM_ALT, KC_END, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b32(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x30:
-		vt->state = vts_1b5b3230;
-		break;
-	case 0x31:
-		vt->state = vts_1b5b3231;
-		break;
-	case 0x33:
-		vt->state = vts_1b5b3233;
-		break;
-	case 0x34:
-		vt->state = vts_1b5b3234;
-		break;
-	case 0x35:
-		vt->state = vts_1b5b3235;
-		break;
-	case 0x38:
-		vt->state = vts_1b5b3238;
-		break;
-	case 0x7e:
-		vt100_key(vt, 0, KC_INSERT, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 30.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3230(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F9, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 31.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3231(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F10, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 33.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3233(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F11, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 34.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3234(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_F12, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 35.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3235(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_PRTSCR, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 32 38.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3238(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_PAUSE, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 35.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b35(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_PAGE_UP, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 33.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b33(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_DELETE, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 36.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b36(vt100_t *vt, char c)
-{
-	switch (c) {
-	case 0x7e:
-		vt100_key(vt, 0, KC_PAGE_DOWN, 0);
-		break;
-	default:
-		vt->state = vts_base;
-		break;
-	}
-}
-
-/** Process input character with prefix 1b 5b 3c - mouse report.
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_1b5b3c(vt100_t *vt, char c)
-{
-	pos_event_t ev;
-
-	if (isdigit(c)) {
-		/* Decode next base-10 digit */
-		vt->innum[vt->inncnt] = vt->innum[vt->inncnt] * 10 + (c - '0');
-	} else if (c == ';') {
-		/* Move to next parameter */
-		if (vt->inncnt >= INNUM_MAX - 1) {
-			vt->state = vts_base;
-			vt100_clear_innum(vt);
-			return;
-		}
-		++vt->inncnt;
-	} else {
-		switch (c) {
-		case 'M':
-		case 'm':
-			/* Button press / release */
-			ev.pos_id = 0;
-			ev.type = (c == 'M') ? POS_PRESS : POS_RELEASE;
-
-			/*
-			 * VT reports button 0 = left button,
-			 * 1 = middle, 2 = right.
-			 * pos_event needs 1 = left, 2 = right, 3 = middle,...
-			 * so right and middle need to be reversed.
-			 */
-			switch (vt->innum[0]) {
-			case 1:
-				ev.btn_num = 3;
-				break;
-			case 2:
-				ev.btn_num = 2;
-				break;
-			default:
-				ev.btn_num = 1 + vt->innum[0];
-				break;
-			}
-			ev.hpos = vt->innum[1] - 1;
-			ev.vpos = vt->innum[2] - 1;
-			vt100_pos_event(vt, &ev);
-			break;
-		}
-		vt100_clear_innum(vt);
-		vt->state = vts_base;
-	}
-}
-
-/** Process input character (base state, no prefix).
- *
- * @param vt VT instance
- * @param c Input character
- */
-static void vt100_rcvd_base(vt100_t *vt, char c)
-{
-	switch (c) {
-		/*
-		 * Not shifted
-		 */
-	case 0x60:
-		vt100_key(vt, 0, KC_BACKTICK, c);
-		break;
-
-	case 0x31:
-		vt100_key(vt, 0, KC_1, c);
-		break;
-	case 0x32:
-		vt100_key(vt, 0, KC_2, c);
-		break;
-	case 0x33:
-		vt100_key(vt, 0, KC_3, c);
-		break;
-	case 0x34:
-		vt100_key(vt, 0, KC_4, c);
-		break;
-	case 0x35:
-		vt100_key(vt, 0, KC_5, c);
-		break;
-	case 0x36:
-		vt100_key(vt, 0, KC_6, c);
-		break;
-	case 0x37:
-		vt100_key(vt, 0, KC_7, c);
-		break;
-	case 0x38:
-		vt100_key(vt, 0, KC_8, c);
-		break;
-	case 0x39:
-		vt100_key(vt, 0, KC_9, c);
-		break;
-	case 0x30:
-		vt100_key(vt, 0, KC_0, c);
-		break;
-	case 0x2d:
-		vt100_key(vt, 0, KC_MINUS, c);
-		break;
-	case 0x3d:
-		vt100_key(vt, 0, KC_EQUALS, c);
-		break;
-
-	case 0x08:
-		vt100_key(vt, 0, KC_BACKSPACE, c);
-		break;
-
-	case 0x09:
-		vt100_key(vt, 0, KC_TAB, c);
-		break;
-
-	case 0x71:
-		vt100_key(vt, 0, KC_Q, c);
-		break;
-	case 0x77:
-		vt100_key(vt, 0, KC_W, c);
-		break;
-	case 0x65:
-		vt100_key(vt, 0, KC_E, c);
-		break;
-	case 0x72:
-		vt100_key(vt, 0, KC_R, c);
-		break;
-	case 0x74:
-		vt100_key(vt, 0, KC_T, c);
-		break;
-	case 0x79:
-		vt100_key(vt, 0, KC_Y, c);
-		break;
-	case 0x75:
-		vt100_key(vt, 0, KC_U, c);
-		break;
-	case 0x69:
-		vt100_key(vt, 0, KC_I, c);
-		break;
-	case 0x6f:
-		vt100_key(vt, 0, KC_O, c);
-		break;
-	case 0x70:
-		vt100_key(vt, 0, KC_P, c);
-		break;
-
-	case 0x5b:
-		vt100_key(vt, 0, KC_LBRACKET, c);
-		break;
-	case 0x5d:
-		vt100_key(vt, 0, KC_RBRACKET, c);
-		break;
-
-	case 0x61:
-		vt100_key(vt, 0, KC_A, c);
-		break;
-	case 0x73:
-		vt100_key(vt, 0, KC_S, c);
-		break;
-	case 0x64:
-		vt100_key(vt, 0, KC_D, c);
-		break;
-	case 0x66:
-		vt100_key(vt, 0, KC_F, c);
-		break;
-	case 0x67:
-		vt100_key(vt, 0, KC_G, c);
-		break;
-	case 0x68:
-		vt100_key(vt, 0, KC_H, c);
-		break;
-	case 0x6a:
-		vt100_key(vt, 0, KC_J, c);
-		break;
-	case 0x6b:
-		vt100_key(vt, 0, KC_K, c);
-		break;
-	case 0x6c:
-		vt100_key(vt, 0, KC_L, c);
-		break;
-
-	case 0x3b:
-		vt100_key(vt, 0, KC_SEMICOLON, c);
-		break;
-	case 0x27:
-		vt100_key(vt, 0, KC_QUOTE, c);
-		break;
-	case 0x5c:
-		vt100_key(vt, 0, KC_BACKSLASH, c);
-		break;
-
-	case 0x7a:
-		vt100_key(vt, 0, KC_Z, c);
-		break;
-	case 0x78:
-		vt100_key(vt, 0, KC_X, c);
-		break;
-	case 0x63:
-		vt100_key(vt, 0, KC_C, c);
-		break;
-	case 0x76:
-		vt100_key(vt, 0, KC_V, c);
-		break;
-	case 0x62:
-		vt100_key(vt, 0, KC_B, c);
-		break;
-	case 0x6e:
-		vt100_key(vt, 0, KC_N, c);
-		break;
-	case 0x6d:
-		vt100_key(vt, 0, KC_M, c);
-		break;
-
-	case 0x2c:
-		vt100_key(vt, 0, KC_COMMA, c);
-		break;
-	case 0x2e:
-		vt100_key(vt, 0, KC_PERIOD, c);
-		break;
-	case 0x2f:
-		vt100_key(vt, 0, KC_SLASH, c);
-		break;
-
-		/*
-		 * Shifted
-		 */
-	case 0x7e:
-		vt100_key(vt, KM_SHIFT, KC_BACKTICK, c);
-		break;
-
-	case 0x21:
-		vt100_key(vt, KM_SHIFT, KC_1, c);
-		break;
-	case 0x40:
-		vt100_key(vt, KM_SHIFT, KC_2, c);
-		break;
-	case 0x23:
-		vt100_key(vt, KM_SHIFT, KC_3, c);
-		break;
-	case 0x24:
-		vt100_key(vt, KM_SHIFT, KC_4, c);
-		break;
-	case 0x25:
-		vt100_key(vt, KM_SHIFT, KC_5, c);
-		break;
-	case 0x5e:
-		vt100_key(vt, KM_SHIFT, KC_6, c);
-		break;
-	case 0x26:
-		vt100_key(vt, KM_SHIFT, KC_7, c);
-		break;
-	case 0x2a:
-		vt100_key(vt, KM_SHIFT, KC_8, c);
-		break;
-	case 0x28:
-		vt100_key(vt, KM_SHIFT, KC_9, c);
-		break;
-	case 0x29:
-		vt100_key(vt, KM_SHIFT, KC_0, c);
-		break;
-	case 0x5f:
-		vt100_key(vt, KM_SHIFT, KC_MINUS, c);
-		break;
-	case 0x2b:
-		vt100_key(vt, KM_SHIFT, KC_EQUALS, c);
-		break;
-
-	case 0x51:
-		vt100_key(vt, KM_SHIFT, KC_Q, c);
-		break;
-	case 0x57:
-		vt100_key(vt, KM_SHIFT, KC_W, c);
-		break;
-	case 0x45:
-		vt100_key(vt, KM_SHIFT, KC_E, c);
-		break;
-	case 0x52:
-		vt100_key(vt, KM_SHIFT, KC_R, c);
-		break;
-	case 0x54:
-		vt100_key(vt, KM_SHIFT, KC_T, c);
-		break;
-	case 0x59:
-		vt100_key(vt, KM_SHIFT, KC_Y, c);
-		break;
-	case 0x55:
-		vt100_key(vt, KM_SHIFT, KC_U, c);
-		break;
-	case 0x49:
-		vt100_key(vt, KM_SHIFT, KC_I, c);
-		break;
-	case 0x4f:
-		vt100_key(vt, KM_SHIFT, KC_O, c);
-		break;
-	case 0x50:
-		vt100_key(vt, KM_SHIFT, KC_P, c);
-		break;
-
-	case 0x7b:
-		vt100_key(vt, KM_SHIFT, KC_LBRACKET, c);
-		break;
-	case 0x7d:
-		vt100_key(vt, KM_SHIFT, KC_RBRACKET, c);
-		break;
-
-	case 0x41:
-		vt100_key(vt, KM_SHIFT, KC_A, c);
-		break;
-	case 0x53:
-		vt100_key(vt, KM_SHIFT, KC_S, c);
-		break;
-	case 0x44:
-		vt100_key(vt, KM_SHIFT, KC_D, c);
-		break;
-	case 0x46:
-		vt100_key(vt, KM_SHIFT, KC_F, c);
-		break;
-	case 0x47:
-		vt100_key(vt, KM_SHIFT, KC_G, c);
-		break;
-	case 0x48:
-		vt100_key(vt, KM_SHIFT, KC_H, c);
-		break;
-	case 0x4a:
-		vt100_key(vt, KM_SHIFT, KC_J, c);
-		break;
-	case 0x4b:
-		vt100_key(vt, KM_SHIFT, KC_K, c);
-		break;
-	case 0x4c:
-		vt100_key(vt, KM_SHIFT, KC_L, c);
-		break;
-
-	case 0x3a:
-		vt100_key(vt, KM_SHIFT, KC_SEMICOLON, c);
-		break;
-	case 0x22:
-		vt100_key(vt, KM_SHIFT, KC_QUOTE, c);
-		break;
-	case 0x7c:
-		vt100_key(vt, KM_SHIFT, KC_BACKSLASH, c);
-		break;
-
-	case 0x5a:
-		vt100_key(vt, KM_SHIFT, KC_Z, c);
-		break;
-	case 0x58:
-		vt100_key(vt, KM_SHIFT, KC_X, c);
-		break;
-	case 0x43:
-		vt100_key(vt, KM_SHIFT, KC_C, c);
-		break;
-	case 0x56:
-		vt100_key(vt, KM_SHIFT, KC_V, c);
-		break;
-	case 0x42:
-		vt100_key(vt, KM_SHIFT, KC_B, c);
-		break;
-	case 0x4e:
-		vt100_key(vt, KM_SHIFT, KC_N, c);
-		break;
-	case 0x4d:
-		vt100_key(vt, KM_SHIFT, KC_M, c);
-		break;
-
-	case 0x3c:
-		vt100_key(vt, KM_SHIFT, KC_COMMA, c);
-		break;
-	case 0x3e:
-		vt100_key(vt, KM_SHIFT, KC_PERIOD, c);
-		break;
-	case 0x3f:
-		vt100_key(vt, KM_SHIFT, KC_SLASH, c);
-		break;
-
-		/*
-		 * ...
-		 */
-	case 0x20:
-		vt100_key(vt, 0, KC_SPACE, c);
-		break;
-	case 0x0a:
-		vt100_key(vt, 0, KC_ENTER, '\n');
-		break;
-	case 0x0d:
-		vt100_key(vt, 0, KC_ENTER, '\n');
-		break;
-
-		/*
-		 * Ctrl + key
-		 */
-	case 0x11:
-		vt100_key(vt, KM_CTRL, KC_Q, c);
-		break;
-	case 0x17:
-		vt100_key(vt, KM_CTRL, KC_W, c);
-		break;
-	case 0x05:
-		vt100_key(vt, KM_CTRL, KC_E, c);
-		break;
-	case 0x12:
-		vt100_key(vt, KM_CTRL, KC_R, c);
-		break;
-	case 0x14:
-		vt100_key(vt, KM_CTRL, KC_T, c);
-		break;
-	case 0x19:
-		vt100_key(vt, KM_CTRL, KC_Y, c);
-		break;
-	case 0x15:
-		vt100_key(vt, KM_CTRL, KC_U, c);
-		break;
-	case 0x0f:
-		vt100_key(vt, KM_CTRL, KC_O, c);
-		break;
-	case 0x10:
-		vt100_key(vt, KM_CTRL, KC_P, c);
-		break;
-
-	case 0x01:
-		vt100_key(vt, KM_CTRL, KC_A, c);
-		break;
-	case 0x13:
-		vt100_key(vt, KM_CTRL, KC_S, c);
-		break;
-	case 0x04:
-		vt100_key(vt, KM_CTRL, KC_D, c);
-		break;
-	case 0x06:
-		vt100_key(vt, KM_CTRL, KC_F, c);
-		break;
-	case 0x07:
-		vt100_key(vt, KM_CTRL, KC_G, c);
-		break;
-	case 0x0b:
-		vt100_key(vt, KM_CTRL, KC_K, c);
-		break;
-	case 0x0c:
-		vt100_key(vt, KM_CTRL, KC_L, c);
-		break;
-
-	case 0x1a:
-		vt100_key(vt, KM_CTRL, KC_Z, c);
-		break;
-	case 0x18:
-		vt100_key(vt, KM_CTRL, KC_X, c);
-		break;
-	case 0x03:
-		vt100_key(vt, KM_CTRL, KC_C, c);
-		break;
-	case 0x16:
-		vt100_key(vt, KM_CTRL, KC_V, c);
-		break;
-	case 0x02:
-		vt100_key(vt, KM_CTRL, KC_B, c);
-		break;
-	case 0x0e:
-		vt100_key(vt, KM_CTRL, KC_N, c);
-		break;
-
-	case 0x7f:
-		vt100_key(vt, 0, KC_BACKSPACE, '\b');
-		break;
-
-	case 0x1b:
-		vt->state = vts_1b;
-		break;
-	}
-}
-
-void vt100_rcvd_char(vt100_t *vt, char c)
-{
-	switch (vt->state) {
-	case vts_base:
-		vt100_rcvd_base(vt, c);
-		break;
-	case vts_1b:
-		vt100_rcvd_1b(vt, c);
-		break;
-	case vts_1b4f:
-		vt100_rcvd_1b4f(vt, c);
-		break;
-	case vts_1b5b:
-		vt100_rcvd_1b5b(vt, c);
-		break;
-	case vts_1b5b31:
-		vt100_rcvd_1b5b31(vt, c);
-		break;
-	case vts_1b5b3135:
-		vt100_rcvd_1b5b3135(vt, c);
-		break;
-	case vts_1b5b3137:
-		vt100_rcvd_1b5b3137(vt, c);
-		break;
-	case vts_1b5b3138:
-		vt100_rcvd_1b5b3138(vt, c);
-		break;
-	case vts_1b5b3139:
-		vt100_rcvd_1b5b3139(vt, c);
-		break;
-	case vts_1b5b313b:
-		vt100_rcvd_1b5b313b(vt, c);
-		break;
-	case vts_1b5b313b32:
-		vt100_rcvd_1b5b313b32(vt, c);
-		break;
-	case vts_1b5b313b33:
-		vt100_rcvd_1b5b313b33(vt, c);
-		break;
-	case vts_1b5b32:
-		vt100_rcvd_1b5b32(vt, c);
-		break;
-	case vts_1b5b3230:
-		vt100_rcvd_1b5b3230(vt, c);
-		break;
-	case vts_1b5b3231:
-		vt100_rcvd_1b5b3231(vt, c);
-		break;
-	case vts_1b5b3233:
-		vt100_rcvd_1b5b3233(vt, c);
-		break;
-	case vts_1b5b3234:
-		vt100_rcvd_1b5b3234(vt, c);
-		break;
-	case vts_1b5b3235:
-		vt100_rcvd_1b5b3235(vt, c);
-		break;
-	case vts_1b5b3238:
-		vt100_rcvd_1b5b3238(vt, c);
-		break;
-	case vts_1b5b35:
-		vt100_rcvd_1b5b35(vt, c);
-		break;
-	case vts_1b5b33:
-		vt100_rcvd_1b5b33(vt, c);
-		break;
-	case vts_1b5b36:
-		vt100_rcvd_1b5b36(vt, c);
-		break;
-	case vts_1b5b3c:
-		vt100_rcvd_1b5b3c(vt, c);
-		break;
-	}
-}
-
-/** @}
- */
Index: pace/lib/wndmgt/doc/doxygroups.h
===================================================================
--- uspace/lib/wndmgt/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup libwndmgt libwndmgt
- * @ingroup libs
- */
Index: pace/lib/wndmgt/include/ipc/wndmgt.h
===================================================================
--- uspace/lib/wndmgt/include/ipc/wndmgt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/** @file
- */
-
-#ifndef LIBWNDMGT_IPC_WNDMGT_H
-#define LIBWNDMGT_IPC_WNDMGT_H
-
-#include <ipc/common.h>
-
-typedef enum {
-	WNDMGT_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
-	WNDMGT_GET_WINDOW_LIST,
-	WNDMGT_GET_WINDOW_INFO,
-	WNDMGT_ACTIVATE_WINDOW,
-	WNDMGT_CLOSE_WINDOW,
-	WNDMGT_GET_EVENT,
-} wndmgt_request_t;
-
-typedef enum {
-	WNDMGT_EV_PENDING = IPC_FIRST_USER_METHOD
-} wndmgt_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/wndmgt/include/types/wndmgt.h
===================================================================
--- uspace/lib/wndmgt/include/types/wndmgt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBWNDMGT_TYPES_WNDMGT_H_
-#define _LIBWNDMGT_TYPES_WNDMGT_H_
-
-#include <ipc/services.h>
-#include <types/common.h>
-
-/** Use the default window management service (argument to wndmgt_open() */
-#define WNDMGT_DEFAULT SERVICE_NAME_WNDMGT
-
-struct wndmgt;
-
-/** Window management session */
-typedef struct wndmgt wndmgt_t;
-
-/** Window management callbacks */
-typedef struct {
-	/** Window added */
-	void (*window_added)(void *, sysarg_t);
-	/** Window removed */
-	void (*window_removed)(void *, sysarg_t);
-	/** Window changed */
-	void (*window_changed)(void *, sysarg_t);
-} wndmgt_cb_t;
-
-/** Window management event type */
-typedef enum {
-	/** Window added */
-	wmev_window_added,
-	/** Window removed */
-	wmev_window_removed,
-	/** Window changed */
-	wmev_window_changed
-} wndmgt_ev_type_t;
-
-/** Window management event */
-typedef struct {
-	/** Event type */
-	wndmgt_ev_type_t etype;
-	/** Window ID */
-	sysarg_t wnd_id;
-} wndmgt_ev_t;
-
-/** Window list */
-typedef struct {
-	/** Number of windows */
-	size_t nwindows;
-	/** ID for each window */
-	sysarg_t *windows;
-} wndmgt_window_list_t;
-
-/** Window information */
-typedef struct {
-	/** Window caption */
-	char *caption;
-	/** Window flags */
-	unsigned flags;
-	/** Number of foci on this window */
-	unsigned nfocus;
-} wndmgt_window_info_t;
-
-#endif
-
-/** @}
- */
Index: pace/lib/wndmgt/include/wndmgt.h
===================================================================
--- uspace/lib/wndmgt/include/wndmgt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBWNDMGT_WNDMGT_H_
-#define _LIBWNDMGT_WNDMGT_H_
-
-#include <errno.h>
-#include <types/common.h>
-#include "types/wndmgt.h"
-
-extern errno_t wndmgt_open(const char *, wndmgt_cb_t *, void *, wndmgt_t **);
-extern void wndmgt_close(wndmgt_t *);
-extern errno_t wndmgt_get_window_list(wndmgt_t *, wndmgt_window_list_t **);
-extern void wndmgt_free_window_list(wndmgt_window_list_t *);
-extern errno_t wndmgt_get_window_info(wndmgt_t *, sysarg_t,
-    wndmgt_window_info_t **);
-extern void wndmgt_free_window_info(wndmgt_window_info_t *);
-extern errno_t wndmgt_activate_window(wndmgt_t *, sysarg_t, sysarg_t);
-extern errno_t wndmgt_close_window(wndmgt_t *, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/lib/wndmgt/include/wndmgt_srv.h
===================================================================
--- uspace/lib/wndmgt/include/wndmgt_srv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBWNDMGT_WNDMGT_SRV_H_
-#define _LIBWNDMGT_WNDMGT_SRV_H_
-
-#include <async.h>
-#include <errno.h>
-#include "types/wndmgt.h"
-
-typedef struct wndmgt_ops wndmgt_ops_t;
-
-/** Window management server structure (per client session) */
-typedef struct {
-	async_sess_t *client_sess;
-	wndmgt_ops_t *ops;
-	void *arg;
-} wndmgt_srv_t;
-
-struct wndmgt_ops {
-	errno_t (*get_window_list)(void *, wndmgt_window_list_t **);
-	errno_t (*get_window_info)(void *, sysarg_t, wndmgt_window_info_t **);
-	errno_t (*activate_window)(void *, sysarg_t, sysarg_t);
-	errno_t (*close_window)(void *, sysarg_t);
-	errno_t (*get_event)(void *, wndmgt_ev_t *);
-};
-
-extern void wndmgt_conn(ipc_call_t *, wndmgt_srv_t *);
-extern void wndmgt_srv_initialize(wndmgt_srv_t *);
-extern void wndmgt_srv_ev_pending(wndmgt_srv_t *);
-
-#endif
-
-/** @}
- */
Index: pace/lib/wndmgt/meson.build
===================================================================
--- uspace/lib/wndmgt/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2022 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'src/wndmgt.c',
-	'src/wndmgt_srv.c',
-)
-
-test_src = files(
-	'test/main.c',
-	'test/wndmgt.c',
-)
Index: pace/lib/wndmgt/private/wndmgt.h
===================================================================
--- uspace/lib/wndmgt/private/wndmgt.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/** @file
- */
-
-#ifndef _LIBWNDMGT_PRIVATE_WNDMGT_H_
-#define _LIBWNDMGT_PRIVATE_WNDMGT_H_
-
-#include <async.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-
-/** Window management session structure */
-struct wndmgt {
-	/** Session with window management service */
-	async_sess_t *sess;
-	/** Callbacks */
-	wndmgt_cb_t *cb;
-	/** Calback argument */
-	void *cb_arg;
-	/** Synchronize access to window management object */
-	fibril_mutex_t lock;
-	/** @c true if callback handler terminated */
-	bool cb_done;
-	/** Signalled when cb_done or ev_pending is changed */
-	fibril_condvar_t cv;
-};
-
-#endif
-
-/** @}
- */
Index: pace/lib/wndmgt/src/wndmgt.c
===================================================================
--- uspace/lib/wndmgt/src/wndmgt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,445 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/**
- * @file
- * @brief Window management protocol client
- */
-
-#include <async.h>
-#include <wndmgt.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <ipc/wndmgt.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "../private/wndmgt.h"
-
-static errno_t wndmgt_callback_create(wndmgt_t *);
-static void wndmgt_cb_conn(ipc_call_t *, void *);
-
-/** Open window management service.
- *
- * @param wmname Window management service name or @c NULL to use default
- * @param cb Window management callbacks
- * @param cb_arg Callback argument
- * @param rwndmgt Place to store pointer to window management session
- * @return EOK on success or an error code
- */
-errno_t wndmgt_open(const char *wmname, wndmgt_cb_t *cb, void *cb_arg,
-    wndmgt_t **rwndmgt)
-{
-	service_id_t wndmgt_svc;
-	wndmgt_t *wndmgt;
-	errno_t rc;
-
-	wndmgt = calloc(1, sizeof(wndmgt_t));
-	if (wndmgt == NULL)
-		return ENOMEM;
-
-	wndmgt->cb = cb;
-	wndmgt->cb_arg = cb_arg;
-
-	fibril_mutex_initialize(&wndmgt->lock);
-	fibril_condvar_initialize(&wndmgt->cv);
-
-	if (wmname == NULL)
-		wmname = SERVICE_NAME_WNDMGT;
-
-	rc = loc_service_get_id(wmname, &wndmgt_svc, 0);
-	if (rc != EOK) {
-		free(wndmgt);
-		return ENOENT;
-	}
-
-	wndmgt->sess = loc_service_connect(wndmgt_svc, INTERFACE_WNDMGT,
-	    0);
-	if (wndmgt->sess == NULL) {
-		free(wndmgt);
-		return ENOENT;
-	}
-
-	rc = wndmgt_callback_create(wndmgt);
-	if (rc != EOK) {
-		async_hangup(wndmgt->sess);
-		free(wndmgt);
-		return EIO;
-	}
-
-	*rwndmgt = wndmgt;
-	return EOK;
-}
-
-/** Create callback connection from window management service.
- *
- * @param wndmgt Window management
- * @return EOK on success or an error code
- */
-static errno_t wndmgt_callback_create(wndmgt_t *wndmgt)
-{
-	async_exch_t *exch = async_exchange_begin(wndmgt->sess);
-
-	aid_t req = async_send_0(exch, WNDMGT_CALLBACK_CREATE, NULL);
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_WNDMGT_CB, 0, 0,
-	    wndmgt_cb_conn, wndmgt, &port);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-/** Close window management service.
- *
- * @param wndmgt Window management
- */
-void wndmgt_close(wndmgt_t *wndmgt)
-{
-	fibril_mutex_lock(&wndmgt->lock);
-	async_hangup(wndmgt->sess);
-	wndmgt->sess = NULL;
-
-	/* Wait for callback handler to terminate */
-
-	while (!wndmgt->cb_done)
-		fibril_condvar_wait(&wndmgt->cv, &wndmgt->lock);
-	fibril_mutex_unlock(&wndmgt->lock);
-
-	free(wndmgt);
-}
-
-/** Get window list.
- *
- * @param wndmgt Window management
- * @param rlist Place to store pointer to new window list structure
- * @return EOK on success or an error code
- */
-errno_t wndmgt_get_window_list(wndmgt_t *wndmgt, wndmgt_window_list_t **rlist)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	wndmgt_window_list_t *list;
-	sysarg_t nwindows;
-	sysarg_t *windows;
-	errno_t rc;
-
-	exch = async_exchange_begin(wndmgt->sess);
-	req = async_send_0(exch, WNDMGT_GET_WINDOW_LIST, &answer);
-
-	/* Receive window list length */
-	rc = async_data_read_start(exch, &nwindows, sizeof (nwindows));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(req, &rc);
-		return rc;
-	}
-
-	windows = calloc(nwindows, sizeof(sysarg_t));
-	if (windows == NULL) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	/* Receive window list */
-	rc = async_data_read_start(exch, windows, nwindows * sizeof (sysarg_t));
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	list = calloc(1, sizeof(wndmgt_window_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	list->nwindows = nwindows;
-	list->windows = windows;
-	*rlist = list;
-	return EOK;
-}
-
-/** Free window list.
- *
- * @param list Window management list
- */
-void wndmgt_free_window_list(wndmgt_window_list_t *list)
-{
-	free(list->windows);
-	free(list);
-}
-
-/** Get window information.
- *
- * @param wndmgt Window management
- * @param wnd_id Window ID
- * @param rinfo Place to store pointer to new window information structure
- * @return EOK on success or an error code
- */
-errno_t wndmgt_get_window_info(wndmgt_t *wndmgt, sysarg_t wnd_id,
-    wndmgt_window_info_t **rinfo)
-{
-	async_exch_t *exch;
-	aid_t req;
-	ipc_call_t answer;
-	wndmgt_window_info_t *info;
-	sysarg_t capsize;
-	char *caption;
-	errno_t rc;
-
-	exch = async_exchange_begin(wndmgt->sess);
-	req = async_send_1(exch, WNDMGT_GET_WINDOW_INFO, wnd_id, &answer);
-
-	/* Receive caption size */
-	rc = async_data_read_start(exch, &capsize, sizeof (capsize));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_wait_for(req, &rc);
-		return rc;
-	}
-
-	caption = calloc(capsize + 1, sizeof(char));
-	if (caption == NULL) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return ENOMEM;
-	}
-
-	/* Receive caption */
-	rc = async_data_read_start(exch, caption, capsize);
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	/* Null-terminate the string */
-	caption[capsize] = '\0';
-
-	info = calloc(1, sizeof(wndmgt_window_info_t));
-	if (info == NULL)
-		return ENOMEM;
-
-	info->caption = caption;
-	info->flags = ipc_get_arg1(&answer);
-	info->nfocus = ipc_get_arg2(&answer);
-	*rinfo = info;
-	return EOK;
-}
-
-/** Free window information.
- *
- * @param info Window management information
- */
-void wndmgt_free_window_info(wndmgt_window_info_t *info)
-{
-	free(info->caption);
-	free(info);
-}
-
-/** Activate window.
- *
- * @param wndmgt Window management session
- * @param dev_id ID of input device belonging to seat whose
- *               focus is to be switched
- * @param wnd_id Window ID
- * @return EOK on success or an error code
- */
-errno_t wndmgt_activate_window(wndmgt_t *wndmgt, sysarg_t dev_id,
-    sysarg_t wnd_id)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(wndmgt->sess);
-	rc = async_req_2_0(exch, WNDMGT_ACTIVATE_WINDOW, dev_id,
-	    wnd_id);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Close window.
- *
- * @param wndmgt Window management
- * @param wnd_id Window ID
- * @return EOK on success or an error code
- */
-errno_t wndmgt_close_window(wndmgt_t *wndmgt, sysarg_t wnd_id)
-{
-	async_exch_t *exch;
-	errno_t rc;
-
-	exch = async_exchange_begin(wndmgt->sess);
-	rc = async_req_1_0(exch, WNDMGT_CLOSE_WINDOW, wnd_id);
-
-	async_exchange_end(exch);
-	return rc;
-}
-
-/** Get window management event.
- *
- * @param wndmgt Window management
- * @param event Place to store event
- * @return EOK on success or an error code
- */
-static errno_t wndmgt_get_event(wndmgt_t *wndmgt, wndmgt_ev_t *event)
-{
-	async_exch_t *exch;
-	ipc_call_t answer;
-	aid_t req;
-	errno_t rc;
-
-	exch = async_exchange_begin(wndmgt->sess);
-	req = async_send_0(exch, WNDMGT_GET_EVENT, &answer);
-	rc = async_data_read_start(exch, event, sizeof(*event));
-	async_exchange_end(exch);
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	async_wait_for(req, &rc);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Window management events are pending.
- *
- * @param wndmgt Window management
- * @param icall Call data
- */
-static void wndmgt_ev_pending(wndmgt_t *wndmgt, ipc_call_t *icall)
-{
-	errno_t rc;
-	wndmgt_ev_t event;
-
-	while (true) {
-		fibril_mutex_lock(&wndmgt->lock);
-
-		if (wndmgt->sess != NULL)
-			rc = wndmgt_get_event(wndmgt, &event);
-		else
-			rc = ENOENT;
-
-		fibril_mutex_unlock(&wndmgt->lock);
-
-		if (rc != EOK)
-			break;
-
-		switch (event.etype) {
-		case wmev_window_added:
-			if (wndmgt->cb != NULL &&
-			    wndmgt->cb->window_added != NULL) {
-				wndmgt->cb->window_added(wndmgt->cb_arg,
-				    event.wnd_id);
-			}
-			break;
-		case wmev_window_removed:
-			if (wndmgt->cb != NULL &&
-			    wndmgt->cb->window_removed != NULL) {
-				wndmgt->cb->window_removed(wndmgt->cb_arg,
-				    event.wnd_id);
-			}
-			break;
-		case wmev_window_changed:
-			if (wndmgt->cb != NULL &&
-			    wndmgt->cb->window_changed != NULL) {
-				wndmgt->cb->window_changed(wndmgt->cb_arg,
-				    event.wnd_id);
-			}
-			break;
-		}
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-/** Callback connection handler.
- *
- * @param icall Connect call data
- * @param arg   Argument, wndmgt_t *
- */
-static void wndmgt_cb_conn(ipc_call_t *icall, void *arg)
-{
-	wndmgt_t *wndmgt = (wndmgt_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			/* Hangup */
-			async_answer_0(&call, EOK);
-			goto out;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case WNDMGT_EV_PENDING:
-			wndmgt_ev_pending(wndmgt, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-out:
-	fibril_mutex_lock(&wndmgt->lock);
-	wndmgt->cb_done = true;
-	fibril_mutex_unlock(&wndmgt->lock);
-	fibril_condvar_broadcast(&wndmgt->cv);
-}
-
-/** @}
- */
Index: pace/lib/wndmgt/src/wndmgt_srv.c
===================================================================
--- uspace/lib/wndmgt/src/wndmgt_srv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,352 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libwndmgt
- * @{
- */
-/**
- * @file
- * @brief Window management protocol server stub
- */
-
-#include <wndmgt_srv.h>
-#include <errno.h>
-#include <io/log.h>
-#include <ipc/wndmgt.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <str.h>
-#include <wndmgt.h>
-#include "../private/wndmgt.h"
-
-static void wndmgt_callback_create_srv(wndmgt_srv_t *srv, ipc_call_t *call)
-{
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	srv->client_sess = sess;
-	async_answer_0(call, EOK);
-}
-
-static void wndmgt_get_window_list_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	wndmgt_window_list_t *list = NULL;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_window_list == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_window_list(srv->arg, &list);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send list size */
-
-	if (!async_data_read_receive(&call, &size)) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(list->nwindows)) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &list->nwindows, size);
-	if (rc != EOK) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send window list */
-
-	if (!async_data_read_receive(&call, &size)) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != list->nwindows * sizeof(sysarg_t)) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, list->windows, size);
-	if (rc != EOK) {
-		wndmgt_free_window_list(list);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	wndmgt_free_window_list(list);
-}
-
-static void wndmgt_get_window_info_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	ipc_call_t call;
-	wndmgt_window_info_t *info = NULL;
-	size_t capsize;
-	size_t size;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->get_window_info == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_window_info(srv->arg, wnd_id, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send caption size */
-
-	if (!async_data_read_receive(&call, &size)) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(size_t)) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	capsize = str_size(info->caption);
-
-	rc = async_data_read_finalize(&call, &capsize, size);
-	if (rc != EOK) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Send caption */
-
-	if (!async_data_read_receive(&call, &size)) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != capsize) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, info->caption, size);
-	if (rc != EOK) {
-		wndmgt_free_window_info(info);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_2(icall, EOK, info->flags, info->nfocus);
-	wndmgt_free_window_info(info);
-}
-
-static void wndmgt_activate_window_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t dev_id;
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	dev_id = ipc_get_arg1(icall);
-	wnd_id = ipc_get_arg2(icall);
-
-	if (srv->ops->activate_window == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->activate_window(srv->arg, dev_id, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void wndmgt_close_window_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
-{
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	wnd_id = ipc_get_arg1(icall);
-
-	if (srv->ops->close_window == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->close_window(srv->arg, wnd_id);
-	async_answer_0(icall, rc);
-}
-
-static void wndmgt_get_event_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
-{
-	wndmgt_ev_t event;
-	ipc_call_t call;
-	size_t size;
-	errno_t rc;
-
-	if (srv->ops->get_event == NULL) {
-		async_answer_0(icall, ENOTSUP);
-		return;
-	}
-
-	rc = srv->ops->get_event(srv->arg, &event);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Transfer event data */
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(event)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &event, sizeof(event));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-void wndmgt_conn(ipc_call_t *icall, wndmgt_srv_t *srv)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case WNDMGT_CALLBACK_CREATE:
-			wndmgt_callback_create_srv(srv, &call);
-			break;
-		case WNDMGT_GET_WINDOW_LIST:
-			wndmgt_get_window_list_srv(srv, &call);
-			break;
-		case WNDMGT_GET_WINDOW_INFO:
-			wndmgt_get_window_info_srv(srv, &call);
-			break;
-		case WNDMGT_ACTIVATE_WINDOW:
-			wndmgt_activate_window_srv(srv, &call);
-			break;
-		case WNDMGT_CLOSE_WINDOW:
-			wndmgt_close_window_srv(srv, &call);
-			break;
-		case WNDMGT_GET_EVENT:
-			wndmgt_get_event_srv(srv, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-
-	/* Hang up callback session */
-	if (srv->client_sess != NULL) {
-		async_hangup(srv->client_sess);
-		srv->client_sess = NULL;
-	}
-}
-
-/** Initialize window management server structure
- *
- * @param srv Window management server structure to initialize
- */
-void wndmgt_srv_initialize(wndmgt_srv_t *srv)
-{
-	memset(srv, 0, sizeof(*srv));
-}
-
-/** Send 'pending' event to client.
- *
- * @param srv Window management server structure
- */
-void wndmgt_srv_ev_pending(wndmgt_srv_t *srv)
-{
-	async_exch_t *exch;
-
-	exch = async_exchange_begin(srv->client_sess);
-	async_msg_0(exch, WNDMGT_EV_PENDING);
-	async_exchange_end(exch);
-}
-
-/** @}
- */
Index: pace/lib/wndmgt/test/main.c
===================================================================
--- uspace/lib/wndmgt/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(wndmgt);
-
-PCUT_MAIN();
Index: pace/lib/wndmgt/test/wndmgt.c
===================================================================
--- uspace/lib/wndmgt/test/wndmgt.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,737 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <wndmgt.h>
-#include <wndmgt_srv.h>
-#include <fibril_synch.h>
-#include <loc.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../private/wndmgt.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(wndmgt);
-
-static const char *test_wndmgt_server = "test-wndmgt";
-static const char *test_wndmgt_svc = "test/wndmgt";
-
-static void test_wndmgt_conn(ipc_call_t *, void *);
-
-static errno_t test_get_window_list(void *, wndmgt_window_list_t **);
-static errno_t test_get_window_info(void *, sysarg_t, wndmgt_window_info_t **);
-static errno_t test_activate_window(void *, sysarg_t, sysarg_t);
-static errno_t test_close_window(void *, sysarg_t);
-static errno_t test_get_event(void *, wndmgt_ev_t *);
-
-static void test_window_added(void *, sysarg_t);
-static void test_window_removed(void *, sysarg_t);
-static void test_window_changed(void *, sysarg_t);
-
-static wndmgt_ops_t test_wndmgt_srv_ops = {
-	.get_window_list = test_get_window_list,
-	.get_window_info = test_get_window_info,
-	.activate_window = test_activate_window,
-	.close_window = test_close_window,
-	.get_event = test_get_event
-};
-
-static wndmgt_cb_t test_wndmgt_cb = {
-	.window_added = test_window_added,
-	.window_removed = test_window_removed,
-	.window_changed = test_window_changed
-};
-
-/** Describes to the server how to respond to our request and pass tracking
- * data back to the client.
- */
-typedef struct {
-	errno_t rc;
-	sysarg_t wnd_id;
-	wndmgt_ev_t event;
-	wndmgt_ev_t revent;
-	int event_cnt;
-
-	bool get_window_list_called;
-	wndmgt_window_list_t *get_window_list_rlist;
-
-	bool get_window_info_called;
-	sysarg_t get_window_info_wnd_id;
-	wndmgt_window_info_t *get_window_info_rinfo;
-
-	bool activate_window_called;
-	sysarg_t activate_window_seat_id;
-	sysarg_t activate_window_wnd_id;
-
-	bool close_window_called;
-	sysarg_t close_window_wnd_id;
-
-	bool get_event_called;
-
-	bool window_added_called;
-	sysarg_t window_added_wnd_id;
-
-	bool window_removed_called;
-	sysarg_t window_removed_wnd_id;
-
-	bool window_changed_called;
-	sysarg_t window_changed_wnd_id;
-
-	fibril_condvar_t event_cv;
-	fibril_mutex_t event_lock;
-	wndmgt_srv_t *srv;
-} test_response_t;
-
-/** wndmgt_open(), wndmgt_close() work for valid window management service */
-PCUT_TEST(open_close)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_get_window_list() with server returning error response works */
-PCUT_TEST(get_window_list_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	wndmgt_window_list_t *list;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	resp.rc = ENOMEM;
-	resp.get_window_list_called = false;
-
-	rc = wndmgt_get_window_list(wndmgt, &list);
-	PCUT_ASSERT_TRUE(resp.get_window_list_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_get_window_list() with server returning success response works */
-PCUT_TEST(get_window_list_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	wndmgt_window_list_t *list;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	resp.rc = EOK;
-	resp.get_window_list_called = false;
-	resp.get_window_list_rlist = calloc(1, sizeof(wndmgt_window_list_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_window_list_rlist);
-	resp.get_window_list_rlist->nwindows = 2;
-	resp.get_window_list_rlist->windows = calloc(2, sizeof(sysarg_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_window_list_rlist->windows);
-	resp.get_window_list_rlist->windows[0] = 42;
-	resp.get_window_list_rlist->windows[1] = 43;
-
-	rc = wndmgt_get_window_list(wndmgt, &list);
-	PCUT_ASSERT_TRUE(resp.get_window_list_called);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_INT_EQUALS(2, list->nwindows);
-	PCUT_ASSERT_INT_EQUALS(42, list->windows[0]);
-	PCUT_ASSERT_INT_EQUALS(43, list->windows[1]);
-
-	wndmgt_free_window_list(list);
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_get_window_infp() with server returning error response works */
-PCUT_TEST(get_window_info_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t wnd_id;
-	wndmgt_window_info_t *info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	resp.rc = ENOMEM;
-	resp.get_window_info_called = false;
-	wnd_id = 1;
-
-	rc = wndmgt_get_window_info(wndmgt, wnd_id, &info);
-	PCUT_ASSERT_TRUE(resp.get_window_info_called);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.get_window_info_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_get_window_info() with server returning success response works */
-PCUT_TEST(get_window_info_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t wnd_id;
-	wndmgt_window_info_t *info;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	resp.rc = EOK;
-	resp.get_window_info_called = false;
-	resp.get_window_info_rinfo = calloc(1, sizeof(wndmgt_window_info_t));
-	PCUT_ASSERT_NOT_NULL(resp.get_window_info_rinfo);
-	resp.get_window_info_rinfo->caption = str_dup("Hello");
-	resp.get_window_info_rinfo->flags = 42;
-	resp.get_window_info_rinfo->nfocus = 123;
-	PCUT_ASSERT_NOT_NULL(resp.get_window_info_rinfo->caption);
-	wnd_id = 1;
-
-	rc = wndmgt_get_window_info(wndmgt, wnd_id, &info);
-	PCUT_ASSERT_TRUE(resp.get_window_info_called);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.get_window_info_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	PCUT_ASSERT_STR_EQUALS("Hello", info->caption);
-	PCUT_ASSERT_INT_EQUALS(42, info->flags);
-	PCUT_ASSERT_INT_EQUALS(123, info->nfocus);
-
-	wndmgt_free_window_info(info);
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_activate_window() with server returning error response works */
-PCUT_TEST(activate_window_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t seat_id;
-	sysarg_t wnd_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	seat_id = 13;
-	wnd_id = 42;
-	resp.rc = ENOMEM;
-	resp.activate_window_called = false;
-
-	rc = wndmgt_activate_window(wndmgt, seat_id, wnd_id);
-	PCUT_ASSERT_TRUE(resp.activate_window_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.activate_window_seat_id);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.activate_window_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_activate_window() with server returning success response works */
-PCUT_TEST(activate_window_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t seat_id;
-	sysarg_t wnd_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	seat_id = 13;
-	wnd_id = 42;
-	resp.rc = EOK;
-	resp.activate_window_called = false;
-
-	rc = wndmgt_activate_window(wndmgt, seat_id, wnd_id);
-	PCUT_ASSERT_TRUE(resp.activate_window_called);
-	PCUT_ASSERT_INT_EQUALS(seat_id, resp.activate_window_seat_id);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.activate_window_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_close_window() with server returning error response works */
-PCUT_TEST(close_window_failure)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t wnd_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	wnd_id = 42;
-	resp.rc = ENOMEM;
-	resp.close_window_called = false;
-
-	rc = wndmgt_close_window(wndmgt, wnd_id);
-	PCUT_ASSERT_TRUE(resp.close_window_called);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.close_window_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** wndmgt_close_window() with server returning success response works */
-PCUT_TEST(close_window_success)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	sysarg_t wnd_id;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, NULL, NULL, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-
-	wnd_id = 42;
-	resp.rc = EOK;
-	resp.close_window_called = false;
-
-	rc = wndmgt_close_window(wndmgt, wnd_id);
-	PCUT_ASSERT_TRUE(resp.close_window_called);
-	PCUT_ASSERT_INT_EQUALS(wnd_id, resp.close_window_wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(resp.rc, rc);
-
-	wndmgt_close(wndmgt);
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Window added event can be delivered from server to client callback function */
-PCUT_TEST(window_added_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, &test_wndmgt_cb, &resp, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wmev_window_added;
-	resp.event.wnd_id = 42;
-	resp.window_added_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	wndmgt_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.window_added_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	wndmgt_close(wndmgt);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Window removed event can be delivered from server to client callback function */
-PCUT_TEST(window_removed_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, &test_wndmgt_cb, &resp, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wmev_window_removed;
-	resp.event.wnd_id = 42;
-	resp.window_removed_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	wndmgt_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.window_removed_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	wndmgt_close(wndmgt);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Window changed event can be delivered from server to client callback function */
-PCUT_TEST(window_changed_deliver)
-{
-	errno_t rc;
-	service_id_t sid;
-	wndmgt_t *wndmgt = NULL;
-	test_response_t resp;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(test_wndmgt_conn, &resp);
-
-	// FIXME This causes this test to be non-reentrant!
-	rc = loc_server_register(test_wndmgt_server, &srv);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = loc_service_register(srv, test_wndmgt_svc, &sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = wndmgt_open(test_wndmgt_svc, &test_wndmgt_cb, &resp, &wndmgt);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_NOT_NULL(wndmgt);
-	PCUT_ASSERT_NOT_NULL(resp.srv);
-
-	resp.event_cnt = 1;
-	resp.event.etype = wmev_window_changed;
-	resp.event.wnd_id = 42;
-	resp.window_changed_called = false;
-	fibril_mutex_initialize(&resp.event_lock);
-	fibril_condvar_initialize(&resp.event_cv);
-	wndmgt_srv_ev_pending(resp.srv);
-
-	/* Wait for the event handler to be called. */
-	fibril_mutex_lock(&resp.event_lock);
-	while (!resp.window_changed_called) {
-		fibril_condvar_wait(&resp.event_cv, &resp.event_lock);
-	}
-	fibril_mutex_unlock(&resp.event_lock);
-
-	/* Verify that the event was delivered correctly */
-	PCUT_ASSERT_INT_EQUALS(resp.event.etype,
-	    resp.revent.etype);
-
-	wndmgt_close(wndmgt);
-
-	rc = loc_service_unregister(srv, sid);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	loc_server_unregister(srv);
-}
-
-/** Test window management service connection. */
-static void test_wndmgt_conn(ipc_call_t *icall, void *arg)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	wndmgt_srv_t srv;
-
-	/* Set up protocol structure */
-	wndmgt_srv_initialize(&srv);
-	srv.ops = &test_wndmgt_srv_ops;
-	srv.arg = arg;
-	resp->srv = &srv;
-
-	/* Handle connection */
-	wndmgt_conn(icall, &srv);
-
-	resp->srv = NULL;
-}
-
-static void test_window_added(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wmev_window_added;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->window_added_called = true;
-	resp->window_added_wnd_id = wnd_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_window_removed(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wmev_window_removed;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->window_removed_called = true;
-	resp->window_removed_wnd_id = wnd_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static void test_window_changed(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->revent.etype = wmev_window_changed;
-
-	fibril_mutex_lock(&resp->event_lock);
-	resp->window_changed_called = true;
-	resp->window_changed_wnd_id = wnd_id;
-	fibril_condvar_broadcast(&resp->event_cv);
-	fibril_mutex_unlock(&resp->event_lock);
-}
-
-static errno_t test_get_window_list(void *arg, wndmgt_window_list_t **rlist)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_window_list_called = true;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rlist = resp->get_window_list_rlist;
-	return EOK;
-}
-
-static errno_t test_get_window_info(void *arg, sysarg_t wnd_id,
-    wndmgt_window_info_t **rinfo)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_window_info_called = true;
-	resp->get_window_info_wnd_id = wnd_id;
-
-	if (resp->rc != EOK)
-		return resp->rc;
-
-	*rinfo = resp->get_window_info_rinfo;
-	return EOK;
-}
-
-static errno_t test_activate_window(void *arg, sysarg_t seat_id,
-    sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->activate_window_called = true;
-	resp->activate_window_seat_id = seat_id;
-	resp->activate_window_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_close_window(void *arg, sysarg_t wnd_id)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->close_window_called = true;
-	resp->close_window_wnd_id = wnd_id;
-	return resp->rc;
-}
-
-static errno_t test_get_event(void *arg, wndmgt_ev_t *event)
-{
-	test_response_t *resp = (test_response_t *) arg;
-
-	resp->get_event_called = true;
-	if (resp->event_cnt > 0) {
-		--resp->event_cnt;
-		*event = resp->event;
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-PCUT_EXPORT(wndmgt);
Index: pace/meson.build
===================================================================
--- uspace/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-# FIXME: somehow disabling link map makes tools/mkext4.py crash
-link_map = true
-disassemble = CONFIG_LINE_DEBUG
-install_nonessential_data = not CONFIG_BAREBONE
-# TODO: Allow installing debug files.
-# This is currently disabled due to boot image size restrictions.
-install_debug_files = false
-
-subdir('lib')
-subdir('app')
-subdir('srv')
-subdir('drv')
-
-dirs = []
-
-foreach app : apps
-	dirs += {
-		'subdir': join_paths('app', app),
-		'installdir': 'app',
-	}
-endforeach
-
-foreach srv : srvs
-	_dirname = run_command(dirname, srv, check: true).stdout().strip()
-
-	dirs += {
-		'subdir': join_paths('srv', srv),
-		'installdir': _dirname == '.' ? 'srv' : ('srv' / _dirname),
-	}
-endforeach
-
-if CONFIG_BAREBONE
-	drv_list = rd_essential_drv
-else
-	drv_list = rd_drv
-endif
-
-foreach drv : drvs
-	_basename = run_command(basename, drv, check: true).stdout().strip()
-	_dirname = run_command(dirname, drv, check: true).stdout().strip()
-
-	dirs += {
-		'subdir': 'drv' / drv,
-		'installdir': 'drv' / _basename,
-	}
-
-	# Install driver metadata.
-	if drv_list.contains('drv' / drv)
-		_src = meson.current_source_dir() / 'drv' / drv / _basename + '.ma'
-		_dstdir = 'drv' / _basename
-		install_files += [[ _dstdir, _src, _basename + '.ma' ]]
-		install_deps += files(_src)
-	endif
-endforeach
-
-bin_targets = []
-
-foreach appdirs : dirs
-	src = []
-	test_src = []
-	includes = []
-	deps = []
-	c_args = []
-	link_args = []
-	language = 'c'
-	installed_data = []
-	platform_specific = false
-
-	subdir(appdirs.get('subdir'))
-
-	dir = appdirs.get('subdir')
-	installdir = appdirs.get('installdir')
-
-	is_drv = (dir.split('/')[0] == 'drv')
-
-	if is_drv
-		# Drivers are installed based on rd_[essential_]drv list
-		install = drv_list.contains(dir)
-	else
-		#
-		# Servers and applications are installed all (unless
-		# platform-specific) or based on rd_essential in case
-		# of barebone build or platform-specific
-		#
-		install = (not CONFIG_BAREBONE and not platform_specific) \
-		    or rd_essential.contains(dir)
-	endif
-
-	if install
-		# Install data files, if any.
-		foreach _f : installed_data
-			_dstdir = _f.get('dir')
-			_src = meson.current_source_dir() / dir / _f.get('name')
-			install_files += [[ _dstdir, _src, _f.get('name') ]]
-			install_deps += files(_src)
-		endforeach
-	endif
-
-	# basename/dirname will be is useful later.
-	_basename = run_command(basename, dir, check: true).stdout().strip()
-	_dirname = run_command(dirname, dir, check: true).stdout().strip()
-
-	# Extra linker flags
-
-	# TODO: only strip after disassembly
-	if CONFIG_STRIP_BINARIES
-		link_args += [ '-s' ]
-	endif
-
-	# Init binaries need to always be linked statically.
-	static_build = (not CONFIG_USE_SHARED_LIBS) or rd_init.contains(dir)
-
-	# Add the corresponding standard libraries to dependencies.
-
-	deps += [ 'c' ]
-
-	if language == 'cpp'
-		deps += 'cpp'
-	endif
-
-	# Binaries in the 'drv' subdirectory link libdrv by default.
-
-
-	if is_drv
-		deps += [ 'drv' ]
-	endif
-
-	# Convert strings to dependency objects
-
-	_deps = []
-	foreach s : deps
-		_deps += get_variable('lib' + s).get(static_build ? 'static' : 'any')
-	endforeach
-
-	# Build executable
-
-	if src.length() > 0
-		bin_targets += {
-			'src': src,
-			'dirname': _dirname,
-			'basename': _basename,
-			'install': install,
-			'install_dir': installdir,
-			'includes': includes,
-			'dependencies': _deps,
-			'c_args': c_args,
-			'link_args': link_args + (static_build ? [ '-static' ] : []),
-			'init': rd_init.contains(dir),
-		}
-	endif
-
-	# Build test executable, if any
-
-	if test_src.length() > 0
-		bin_targets += {
-			'src': test_src,
-			'dirname': _dirname,
-			'basename': 'test-' + installdir.underscorify() + (is_drv ? '' : ('_' + _basename)),
-			'install': install and CONFIG_PCUT_TESTS,
-			'install_dir': 'test',
-			'includes': includes,
-			'dependencies': [ _deps, libpcut.get('any') ],
-			'c_args': c_args,
-			'link_args': link_args,
-			'init': false,
-		}
-	endif
-endforeach
-
-foreach tst : bin_targets
-	_ldargs = tst.get('link_args')
-	_src = tst.get('src')
-
-	_install = tst.get('install')
-	_install_dir = tst.get('install_dir')
-	_basename = tst.get('basename')
-	_full_install_path = _install_dir / _basename
-	_build_name = _full_install_path.underscorify()
-	_full_build_name = meson.current_build_dir() / _build_name
-	_is_init = tst.get('init')
-
-	if link_map
-		# We want linker to generate link map for debugging.
-		_ldargs += [ '-Wl,-Map,' + _full_build_name + '.map' ]
-	endif
-
-	_bin = executable(_build_name, _src,
-		include_directories: tst.get('includes'),
-		dependencies: tst.get('dependencies'),
-		link_whole: libstartfiles,
-		c_args: arch_uspace_c_args + tst.get('c_args'),
-		cpp_args: arch_uspace_c_args + tst.get('c_args'),
-		link_args: arch_uspace_c_args + arch_uspace_link_args + _ldargs,
-		implicit_include_directories: true,
-		build_by_default: true,
-	)
-
-	if _is_init
-		rd_init_binaries += [[ _bin, _full_install_path ]]
-	endif
-
-	if disassemble
-		_disasm = custom_target(_build_name + '.disasm',
-			command: [ objdump, '-S', '@INPUT@' ],
-			input: _bin,
-			output: _build_name + '.disasm',
-			capture: true,
-			build_by_default: true,
-		)
-	endif
-
-	if _install
-		# Due to certain quirks of our build, executables need to be built with a different name than what they are installed with.
-		# Meson doesn't support renaming installed files (at least not as of mid-2019) so we do it manually.
-
-		install_files += [[ _install_dir, _full_build_name, _basename ]]
-		install_deps += [ _bin ]
-
-		if install_debug_files
-			if disassemble
-				install_files += [[ 'debug' / _install_dir, _full_build_name + '.disasm', _basename + '.disasm' ]]
-				install_deps += [ _disasm ]
-			endif
-			if link_map
-				install_files += [[ 'debug' / _install_dir, _full_build_name + '.map', _basename + '.map' ]]
-			endif
-		endif
-	endif
-endforeach
Index: pace/srv/audio/hound/audio_data.c
===================================================================
--- uspace/srv/audio/hound/audio_data.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,309 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#include <macros.h>
-#include <stdlib.h>
-
-#include "audio_data.h"
-#include "log.h"
-
-/**
- * Create reference counted buffer out of ordinary data buffer.
- * @param data audio buffer. The memory passed will be freed eventually.
- * @param size Size of the @p data buffer.
- * @param format audio data format.
- * @return pointer to valid audio data structure, NULL on failure.
- */
-audio_data_t *audio_data_create(void *data, size_t size,
-    pcm_format_t format)
-{
-	audio_data_t *adata = malloc(sizeof(audio_data_t) + size);
-	if (adata) {
-		unsigned overflow = size % pcm_format_frame_size(&format);
-		if (overflow)
-			log_warning("Data not a multiple of frame size, "
-			    "clipping.");
-		adata->data = data;
-		adata->size = size - overflow;
-		adata->format = format;
-		refcount_init(&adata->refcount);
-	}
-	return adata;
-}
-
-/**
- * Get a new reference to the audio data buffer.
- * @param adata The audio data buffer.
- */
-void audio_data_addref(audio_data_t *adata)
-{
-	assert(adata);
-	refcount_up(&adata->refcount);
-}
-
-/**
- * Release a reference to the audio data buffer.
- * @param adata The audio data buffer.
- */
-void audio_data_unref(audio_data_t *adata)
-{
-	assert(adata);
-	if (refcount_down(&adata->refcount)) {
-		free(adata->data);
-		free(adata);
-	}
-}
-
-/* Data link helpers */
-
-/** Audio data buffer list helper structure. */
-typedef struct {
-	link_t link;
-	audio_data_t *adata;
-	size_t position;
-} audio_data_link_t;
-
-/** List instance helper function.
- * @param l link
- * @return valid pointer to data link structure, NULL on failure.
- */
-static inline audio_data_link_t *audio_data_link_list_instance(link_t *l)
-{
-	return l ? list_get_instance(l, audio_data_link_t, link) : NULL;
-}
-
-/**
- * Create a new audio data link.
- * @param adata Audio data to store.
- * @return Valid pointer to a new audio data link structure, NULL on failure.
- */
-static audio_data_link_t *audio_data_link_create(audio_data_t *adata)
-{
-	assert(adata);
-	audio_data_link_t *link = malloc(sizeof(audio_data_link_t));
-	if (link) {
-		audio_data_addref(adata);
-		link->adata = adata;
-		link->position = 0;
-	}
-	return link;
-}
-
-/**
- * Destroy audio data link.
- * @param link The link to destroy.
- *
- * Releases data reference.
- */
-static void audio_data_link_destroy(audio_data_link_t *link)
-{
-	assert(link);
-	assert(!link_in_use(&link->link));
-	audio_data_unref(link->adata);
-	free(link);
-}
-
-/**
- * Data link buffer start helper function.
- * @param alink audio data link
- * @return pointer to the beginning of data buffer.
- */
-static inline const void *audio_data_link_start(audio_data_link_t *alink)
-{
-	assert(alink);
-	assert(alink->adata);
-	return alink->adata->data + alink->position;
-}
-
-/**
- * Data link remaining size getter.
- * @param alink audio data link
- * @return Remaining size of valid data in the buffer.
- */
-static inline size_t audio_data_link_remain_size(audio_data_link_t *alink)
-{
-	assert(alink);
-	assert(alink->adata);
-	assert(alink->position <= alink->adata->size);
-	return alink->adata->size - alink->position;
-}
-
-/**
- * Data link remaining frames getter.
- * @param alink audio data link
- * @return Number of remaining frames in the buffer.
- */
-static inline size_t audio_data_link_available_frames(audio_data_link_t *alink)
-{
-	assert(alink);
-	assert(alink->adata);
-	return pcm_format_size_to_frames(audio_data_link_remain_size(alink),
-	    &alink->adata->format);
-}
-
-/* Audio Pipe */
-
-/**
- * Initialize audio pipe structure.
- * @param pipe The pipe structure to initialize.
- */
-void audio_pipe_init(audio_pipe_t *pipe)
-{
-	assert(pipe);
-	list_initialize(&pipe->list);
-	fibril_mutex_initialize(&pipe->guard);
-	pipe->frames = 0;
-	pipe->bytes = 0;
-}
-
-/**
- * Destroy all data in a pipe.
- * @param pipe The audio pipe to clean.
- */
-void audio_pipe_fini(audio_pipe_t *pipe)
-{
-	assert(pipe);
-	while (!list_empty(&pipe->list)) {
-		audio_data_t *adata = audio_pipe_pop(pipe);
-		audio_data_unref(adata);
-	}
-}
-
-/**
- * Add new audio data to a pipe.
- * @param pipe The target pipe.
- * @param data The data.
- * @return Error code.
- */
-errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
-{
-	assert(pipe);
-	assert(data);
-	audio_data_link_t *alink = audio_data_link_create(data);
-	if (!alink)
-		return ENOMEM;
-
-	fibril_mutex_lock(&pipe->guard);
-	list_append(&alink->link, &pipe->list);
-	pipe->bytes += audio_data_link_remain_size(alink);
-	pipe->frames += audio_data_link_available_frames(alink);
-	fibril_mutex_unlock(&pipe->guard);
-	return EOK;
-}
-
-/**
- * Retrieve data form a audio pipe.
- * @param pipe THe target pipe.
- * @return Valid pointer to audio data, NULL if the pipe was empty.
- */
-audio_data_t *audio_pipe_pop(audio_pipe_t *pipe)
-{
-	assert(pipe);
-	fibril_mutex_lock(&pipe->guard);
-	audio_data_t *adata = NULL;
-	link_t *l = list_first(&pipe->list);
-	if (l) {
-		audio_data_link_t *alink = audio_data_link_list_instance(l);
-		list_remove(&alink->link);
-		pipe->bytes -= audio_data_link_remain_size(alink);
-		pipe->frames -= audio_data_link_available_frames(alink);
-		adata = alink->adata;
-		audio_data_addref(adata);
-		audio_data_link_destroy(alink);
-	}
-	fibril_mutex_unlock(&pipe->guard);
-	return adata;
-}
-
-/**
- * Use data store in a pipe and mix it into the provided buffer.
- * @param pipe The piep that should provide data.
- * @param data Target buffer.
- * @param size Target buffer size.
- * @param format Target data format.
- * @return Size of the target buffer used.
- */
-size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
-    size_t size, const pcm_format_t *f)
-{
-	assert(pipe);
-
-	const size_t dst_frame_size = pcm_format_frame_size(f);
-	size_t needed_frames = pcm_format_size_to_frames(size, f);
-	size_t copied_size = 0;
-
-	fibril_mutex_lock(&pipe->guard);
-	while (needed_frames > 0 && !list_empty(&pipe->list)) {
-		/* Get first audio chunk */
-		link_t *l = list_first(&pipe->list);
-		audio_data_link_t *alink = audio_data_link_list_instance(l);
-
-		/* Get audio chunk metadata */
-		const size_t src_frame_size =
-		    pcm_format_frame_size(&alink->adata->format);
-		const size_t available_frames =
-		    audio_data_link_available_frames(alink);
-		const size_t copy_frames = min(available_frames, needed_frames);
-		const size_t dst_copy_size = copy_frames * dst_frame_size;
-		const size_t src_copy_size = copy_frames * src_frame_size;
-
-		assert(src_copy_size <= audio_data_link_remain_size(alink));
-
-		/* Copy audio data */
-		pcm_format_convert_and_mix(data, dst_copy_size,
-		    audio_data_link_start(alink), src_copy_size,
-		    &alink->adata->format, f);
-
-		/* Update values */
-		needed_frames -= copy_frames;
-		copied_size += dst_copy_size;
-		data += dst_copy_size;
-		alink->position += src_copy_size;
-		pipe->bytes -= src_copy_size;
-		pipe->frames -= copy_frames;
-		if (audio_data_link_remain_size(alink) == 0) {
-			list_remove(&alink->link);
-			audio_data_link_destroy(alink);
-		} else {
-			assert(needed_frames == 0);
-		}
-	}
-	fibril_mutex_unlock(&pipe->guard);
-	return copied_size;
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_data.h
===================================================================
--- uspace/srv/audio/hound/audio_data.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef AUDIO_DATA_H_
-#define AUDIO_DATA_H_
-
-#include <adt/list.h>
-#include <refcount.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <pcm/format.h>
-
-/** Reference counted audio buffer */
-typedef struct {
-	/** Audio data */
-	void *data;
-	/** Size of the buffer pointer to by data */
-	size_t size;
-	/** Format of the audio data */
-	pcm_format_t format;
-	/** Reference counter */
-	atomic_refcount_t refcount;
-} audio_data_t;
-
-/** Audio data pipe structure */
-typedef struct {
-	/** List of audio data buffers */
-	list_t list;
-	/** Total size of all buffers */
-	size_t bytes;
-	/** Total frames stored in all buffers */
-	size_t frames;
-	/** List access synchronization */
-	fibril_mutex_t guard;
-} audio_pipe_t;
-
-audio_data_t *audio_data_create(void *data, size_t size,
-    pcm_format_t format);
-void audio_data_addref(audio_data_t *adata);
-void audio_data_unref(audio_data_t *adata);
-
-void audio_pipe_init(audio_pipe_t *pipe);
-void audio_pipe_fini(audio_pipe_t *pipe);
-
-errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data);
-audio_data_t *audio_pipe_pop(audio_pipe_t *pipe);
-
-size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *buffer, size_t size,
-    const pcm_format_t *f);
-
-/**
- * Total bytes getter.
- * @param pipe The audio pipe.
- * @return Total size of buffer stored in the pipe.
- */
-static inline size_t audio_pipe_bytes(audio_pipe_t *pipe)
-{
-	assert(pipe);
-	return pipe->bytes;
-}
-
-/**
- * Total bytes getter.
- * @param pipe The audio pipe.
- * @return Total number of frames stored in the pipe.
- */
-static inline size_t audio_pipe_frames(audio_pipe_t *pipe)
-{
-	assert(pipe);
-	return pipe->frames;
-}
-
-/**
- * Push data form buffer directly to pipe.
- * @param pipe The target pipe.
- * @param data audio buffer.
- * @param size size of the @p data buffer
- * @param f format of the audio data.
- * @return Error code.
- *
- * Reference counted buffer is created automatically.
- */
-static inline errno_t audio_pipe_push_data(audio_pipe_t *pipe,
-    void *data, size_t size, pcm_format_t f)
-{
-	audio_data_t *adata = audio_data_create(data, size, f);
-	if (adata) {
-		const errno_t ret = audio_pipe_push(pipe, adata);
-		audio_data_unref(adata);
-		return ret;
-	}
-	return ENOMEM;
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_device.c
===================================================================
--- uspace/srv/audio/hound/audio_device.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup audio
- * @brief HelenOS sound server.
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <loc.h>
-#include <stdbool.h>
-#include <str.h>
-#include <str_error.h>
-#include <as.h>
-
-#include "audio_device.h"
-#include "log.h"
-
-/* hardwired to provide ~21ms per fragment */
-#define BUFFER_PARTS   16
-
-static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new);
-static errno_t device_source_connection_callback(audio_source_t *source, bool new);
-static void device_event_callback(ipc_call_t *icall, void *arg);
-static errno_t device_check_format(audio_sink_t *sink);
-static errno_t get_buffer(audio_device_t *dev);
-static errno_t release_buffer(audio_device_t *dev);
-static void advance_buffer(audio_device_t *dev, size_t size);
-static inline bool is_running(audio_device_t *dev)
-{
-	assert(dev);
-	/* we release buffer on stop so this should be enough */
-	return dev->buffer.base != NULL;
-}
-
-/**
- * Initialize audio device structure.
- * @param dev The structure to initialize.
- * @param id Location service id of the device driver.
- * @param name Name of the device.
- * @return Error code.
- */
-errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name)
-{
-	assert(dev);
-	link_initialize(&dev->link);
-	dev->id = id;
-	dev->name = str_dup(name);
-	dev->sess = audio_pcm_open_service(id);
-	if (!dev->sess) {
-		log_debug("Failed to connect to device \"%s\"", name);
-		return ENOMEM;
-	}
-
-	audio_sink_init(&dev->sink, name, dev, device_sink_connection_callback,
-	    device_check_format, NULL, &AUDIO_FORMAT_ANY);
-	audio_source_init(&dev->source, name, dev,
-	    device_source_connection_callback, NULL, &AUDIO_FORMAT_ANY);
-
-	/* Init buffer members */
-	dev->buffer.base = NULL;
-	dev->buffer.position = NULL;
-	dev->buffer.size = 0;
-	dev->buffer.fragment_size = 0;
-
-	log_verbose("Initialized device (%p) '%s' with id %" PRIun ".",
-	    dev, dev->name, dev->id);
-
-	return EOK;
-}
-
-/**
- * Restore resource cplaimed during initialization.
- * @param dev The device to release.
- *
- * NOT IMPLEMENTED
- */
-void audio_device_fini(audio_device_t *dev)
-{
-	//TODO implement;
-}
-
-/**
- * Get device provided audio source.
- * @param dev Th device.
- * @return pointer to aa audio source structure, NULL if the device is not
- *         capable of capturing audio.
- */
-audio_source_t *audio_device_get_source(audio_device_t *dev)
-{
-	assert(dev);
-	sysarg_t val;
-	errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val);
-	if (rc == EOK && val)
-		return &dev->source;
-	return NULL;
-}
-
-/**
- * Get device provided audio sink.
- * @param dev Th device.
- * @return pointer to aa audio source structure, NULL if the device is not
- *         capable of audio playback.
- */
-audio_sink_t *audio_device_get_sink(audio_device_t *dev)
-{
-	assert(dev);
-	sysarg_t val;
-	errno_t rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val);
-	if (rc == EOK && val)
-		return &dev->sink;
-	return NULL;
-}
-
-/**
- * Handle connection addition and removal.
- * @param sink audio sink that is connected or disconnected.
- * @param new True of a connection was added, false otherwise.
- * @return Error code.
- *
- * Starts playback on first connection. Stops playback when there are no
- * connections.
- */
-static errno_t device_sink_connection_callback(audio_sink_t *sink, bool new)
-{
-	assert(sink);
-	audio_device_t *dev = sink->private_data;
-	if (new && list_count(&sink->connections) == 1) {
-		log_verbose("First connection on device sink '%s'", sink->name);
-
-		errno_t ret = get_buffer(dev);
-		if (ret != EOK) {
-			log_error("Failed to get device buffer: %s",
-			    str_error(ret));
-			return ret;
-		}
-		audio_pcm_register_event_callback(dev->sess,
-		    device_event_callback, dev);
-
-		/*
-		 * Fill the buffer first. Fill the first two fragments,
-		 * so that we stay one fragment ahead
-		 */
-		pcm_format_silence(dev->buffer.base, dev->buffer.size,
-		    &dev->sink.format);
-		//TODO add underrun detection.
-		const size_t size = dev->buffer.fragment_size * 2;
-		/* We never cross the end of the buffer here */
-		audio_sink_mix_inputs(&dev->sink, dev->buffer.position, size);
-		advance_buffer(dev, size);
-
-		const unsigned frames = dev->buffer.fragment_size /
-		    pcm_format_frame_size(&dev->sink.format);
-		log_verbose("Fragment frame count %u", frames);
-		ret = audio_pcm_start_playback_fragment(dev->sess, frames,
-		    dev->sink.format.channels, dev->sink.format.sampling_rate,
-		    dev->sink.format.sample_format);
-		if (ret != EOK) {
-			log_error("Failed to start playback: %s",
-			    str_error(ret));
-			release_buffer(dev);
-			return ret;
-		}
-	}
-	if (list_count(&sink->connections) == 0) {
-		assert(!new);
-		log_verbose("Removed last connection on device sink '%s'",
-		    sink->name);
-		errno_t ret = audio_pcm_stop_playback(dev->sess);
-		if (ret != EOK) {
-			log_error("Failed to stop playback: %s",
-			    str_error(ret));
-			return ret;
-		}
-	}
-	return EOK;
-}
-
-/**
- * Handle connection addition and removal.
- * @param source audio source that is connected or disconnected.
- * @param new True of a connection was added, false otherwise.
- * @return Error code.
- *
- * Starts capture on first connection. Stops capture when there are no
- * connections.
- */
-static errno_t device_source_connection_callback(audio_source_t *source, bool new)
-{
-	assert(source);
-	audio_device_t *dev = source->private_data;
-	if (new && list_count(&source->connections) == 1) {
-		errno_t ret = get_buffer(dev);
-		if (ret != EOK) {
-			log_error("Failed to get device buffer: %s",
-			    str_error(ret));
-			return ret;
-		}
-
-		//TODO set and test format
-
-		const unsigned frames = dev->buffer.fragment_size /
-		    pcm_format_frame_size(&dev->sink.format);
-		ret = audio_pcm_start_capture_fragment(dev->sess, frames,
-		    dev->source.format.channels,
-		    dev->source.format.sampling_rate,
-		    dev->source.format.sample_format);
-		if (ret != EOK) {
-			log_error("Failed to start recording: %s",
-			    str_error(ret));
-			release_buffer(dev);
-			return ret;
-		}
-	}
-	if (list_count(&source->connections) == 0) { /* Disconnected */
-		assert(!new);
-		errno_t ret = audio_pcm_stop_capture_immediate(dev->sess);
-		if (ret != EOK) {
-			log_error("Failed to start recording: %s",
-			    str_error(ret));
-			return ret;
-		}
-	}
-
-	return EOK;
-}
-
-/** Audio device event handler.
- *
- * @param icall Initial call structure.
- * @param arg   (unused)
- *
- */
-static void device_event_callback(ipc_call_t *icall, void *arg)
-{
-	struct timespec time1;
-	errno_t ret;
-
-	audio_device_t *dev = arg;
-	assert(dev);
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		async_answer_0(&call, EOK);
-
-		switch (ipc_get_imethod(&call)) {
-		case PCM_EVENT_FRAMES_PLAYED:
-			getuptime(&time1);
-			//TODO add underrun detection.
-			/* We never cross the end of the buffer here */
-			audio_sink_mix_inputs(&dev->sink, dev->buffer.position,
-			    dev->buffer.fragment_size);
-			advance_buffer(dev, dev->buffer.fragment_size);
-			struct timespec time2;
-			getuptime(&time2);
-			log_verbose("Time to mix sources: %lld\n",
-			    NSEC2USEC(ts_sub_diff(&time2, &time1)));
-			break;
-		case PCM_EVENT_CAPTURE_TERMINATED:
-			log_verbose("Capture terminated");
-			dev->source.format = AUDIO_FORMAT_ANY;
-			ret = release_buffer(dev);
-			if (ret != EOK) {
-				log_error("Failed to release buffer: %s",
-				    str_error(ret));
-			}
-			audio_pcm_unregister_event_callback(dev->sess);
-			break;
-		case PCM_EVENT_PLAYBACK_TERMINATED:
-			log_verbose("Playback Terminated");
-			dev->sink.format = AUDIO_FORMAT_ANY;
-			ret = release_buffer(dev);
-			if (ret != EOK) {
-				log_error("Failed to release buffer: %s",
-				    str_error(ret));
-			}
-			audio_pcm_unregister_event_callback(dev->sess);
-			break;
-		case PCM_EVENT_FRAMES_CAPTURED:
-			ret = audio_source_push_data(&dev->source,
-			    dev->buffer.position, dev->buffer.fragment_size);
-			advance_buffer(dev, dev->buffer.fragment_size);
-			if (ret != EOK)
-				log_warning("Failed to push recorded data");
-			break;
-		case 0:
-			log_info("Device event callback hangup");
-			return;
-		}
-	}
-}
-
-/**
- * Test format against hardware limits.
- * @param sink audio playback device.
- * @return Error code.
- */
-static errno_t device_check_format(audio_sink_t *sink)
-{
-	assert(sink);
-	audio_device_t *dev = sink->private_data;
-	assert(dev);
-	/* Check whether we are running */
-	if (is_running(dev))
-		return EBUSY;
-	log_verbose("Checking format on sink %s", sink->name);
-	return audio_pcm_test_format(dev->sess, &sink->format.channels,
-	    &sink->format.sampling_rate, &sink->format.sample_format);
-}
-
-/**
- * Get access to device buffer.
- * @param dev Audio device.
- * @return Error code.
- */
-static errno_t get_buffer(audio_device_t *dev)
-{
-	assert(dev);
-	if (!dev->sess) {
-		log_debug("No connection to device");
-		return EIO;
-	}
-	if (dev->buffer.base) {
-		log_debug("We already have a buffer");
-		return EBUSY;
-	}
-
-	/* Ask for largest buffer possible */
-	size_t preferred_size = 0;
-
-	const errno_t ret = audio_pcm_get_buffer(dev->sess, &dev->buffer.base,
-	    &preferred_size);
-	if (ret == EOK) {
-		dev->buffer.size = preferred_size;
-		dev->buffer.fragment_size = dev->buffer.size / BUFFER_PARTS;
-		dev->buffer.position = dev->buffer.base;
-	}
-	return ret;
-
-}
-
-/**
- * Surrender access to device buffer.
- * @param dev Audio device.
- * @return Error code.
- */
-static errno_t release_buffer(audio_device_t *dev)
-{
-	assert(dev);
-	assert(dev->buffer.base);
-
-	const errno_t ret = audio_pcm_release_buffer(dev->sess);
-	if (ret == EOK) {
-		as_area_destroy(dev->buffer.base);
-		dev->buffer.base = NULL;
-		dev->buffer.size = 0;
-		dev->buffer.position = NULL;
-	} else {
-		log_warning("Failed to release buffer: %s", str_error(ret));
-	}
-	return ret;
-}
-
-/**
- * Move buffer position pointer.
- * @param dev Audio device.
- * @param size number of bytes to move forward
- */
-static void advance_buffer(audio_device_t *dev, size_t size)
-{
-	assert(dev);
-	assert(dev->buffer.position >= dev->buffer.base);
-	assert(dev->buffer.position < (dev->buffer.base + dev->buffer.size));
-	dev->buffer.position += size;
-	if (dev->buffer.position == (dev->buffer.base + dev->buffer.size))
-		dev->buffer.position = dev->buffer.base;
-}
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_device.h
===================================================================
--- uspace/srv/audio/hound/audio_device.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,89 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef AUDIO_DEVICE_H_
-#define AUDIO_DEVICE_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <errno.h>
-#include <ipc/loc.h>
-#include <audio_pcm_iface.h>
-
-#include "audio_source.h"
-#include "audio_sink.h"
-
-/** Audio device structure. */
-typedef struct {
-	/** Link in hound's device list */
-	link_t link;
-	/** Location service id of the audio driver */
-	service_id_t id;
-	/** IPC session to the device driver. */
-	audio_pcm_sess_t *sess;
-	/** Device name */
-	char *name;
-	/** Device buffer */
-	struct {
-		void *base;
-		size_t size;
-		void *position;
-		size_t fragment_size;
-	} buffer;
-	/** Capture device abstraction. */
-	audio_source_t source;
-	/** Playback device abstraction. */
-	audio_sink_t sink;
-} audio_device_t;
-
-/** Linked list instance helper */
-static inline audio_device_t *audio_device_list_instance(link_t *l)
-{
-	return l ? list_get_instance(l, audio_device_t, link) : NULL;
-}
-
-errno_t audio_device_init(audio_device_t *dev, service_id_t id, const char *name);
-void audio_device_fini(audio_device_t *dev);
-audio_source_t *audio_device_get_source(audio_device_t *dev);
-audio_sink_t *audio_device_get_sink(audio_device_t *dev);
-errno_t audio_device_recorded_data(audio_device_t *dev, void **base, size_t *size);
-errno_t audio_device_available_buffer(audio_device_t *dev, void **base, size_t *size);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_sink.c
===================================================================
--- uspace/srv/audio/hound/audio_sink.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-
-#include "audio_sink.h"
-#include "connection.h"
-#include "log.h"
-
-/**
- * Initialize audio sink structure.
- * @param sink The structure to initialize.
- * @param name string identifier
- * @param private_data backend data
- * @param connection_change connect/disconnect callback
- * @param check_format format testing callback
- * @param data_available trigger data prcoessing
- * @param f sink format
- * @return Error code.
- */
-errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
-    errno_t (*connection_change)(audio_sink_t *, bool),
-    errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *),
-    const pcm_format_t *f)
-{
-	assert(sink);
-	if (!name)
-		return EINVAL;
-	link_initialize(&sink->link);
-	fibril_mutex_initialize(&sink->lock);
-	list_initialize(&sink->connections);
-	sink->name = str_dup(name);
-	if (!sink->name)
-		return ENOMEM;
-	sink->private_data = private_data;
-	sink->format = *f;
-	sink->connection_change = connection_change;
-	sink->check_format = check_format;
-	sink->data_available = data_available;
-	log_verbose("Initialized sink (%p) '%s'", sink, sink->name);
-	return EOK;
-}
-
-/**
- * Release resources claimed by initialization.
- * @param sink the structure to release.
- */
-void audio_sink_fini(audio_sink_t *sink)
-{
-	assert(sink);
-	assert(list_empty(&sink->connections));
-	assert(!sink->private_data);
-	free(sink->name);
-	sink->name = NULL;
-}
-
-/**
- * Set audio sink format and check with backend,
- * @param sink The target sink isntance.
- * @param format Th new format.
- * @return Error code.
- */
-errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format)
-{
-	assert(sink);
-	assert(format);
-	if (!pcm_format_is_any(&sink->format)) {
-		log_debug("Sink %s already has a format", sink->name);
-		return EEXIST;
-	}
-	const pcm_format_t old_format = sink->format;
-
-	if (pcm_format_is_any(format)) {
-		log_verbose("Setting DEFAULT format for sink %s", sink->name);
-		sink->format = AUDIO_FORMAT_DEFAULT;
-	} else {
-		sink->format = *format;
-	}
-	if (sink->check_format) {
-		const errno_t ret = sink->check_format(sink);
-		if (ret != EOK && ret != ELIMIT) {
-			log_debug("Format check failed on sink %s", sink->name);
-			sink->format = old_format;
-			return ret;
-		}
-	}
-	log_verbose("Set format for sink %s: %u channel(s), %uHz, %s",
-	    sink->name, format->channels, format->sampling_rate,
-	    pcm_sample_format_str(format->sample_format));
-	return EOK;
-}
-
-/**
- * Pull data from all connections and add the mix to the destination.
- * @param sink The sink to mix data.
- * @param dest Destination buffer.
- * @param size size of the @p dest buffer.
- * @return Error code.
- */
-void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size)
-{
-	assert(sink);
-	assert(dest);
-
-	pcm_format_silence(dest, size, &sink->format);
-	fibril_mutex_lock(&sink->lock);
-	list_foreach(sink->connections, sink_link, connection_t, conn) {
-		const errno_t ret = connection_add_source_data(
-		    conn, dest, size, sink->format);
-		if (ret != EOK) {
-			log_warning("Failed to mix source %s: %s",
-			    connection_source_name(conn), str_error(ret));
-		}
-	}
-	fibril_mutex_unlock(&sink->lock);
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_sink.h
===================================================================
--- uspace/srv/audio/hound/audio_sink.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,94 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef AUDIO_SINK_H_
-#define AUDIO_SINK_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <stdbool.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <pcm/format.h>
-
-#include "audio_source.h"
-
-typedef struct audio_sink audio_sink_t;
-
-/** Audio sink abstraction structure */
-struct audio_sink {
-	/** Link in hound's sink list */
-	link_t link;
-	/** Protect sink including list of connections */
-	fibril_mutex_t lock;
-	/** List of all related connections */
-	list_t connections;
-	/** Sink's name */
-	char *name;
-	/** Consumes data in this format */
-	pcm_format_t format;
-	/** Backend data */
-	void *private_data;
-	/** Connect/disconnect callback */
-	errno_t (*connection_change)(audio_sink_t *, bool);
-	/** Backend callback to check data */
-	errno_t (*check_format)(audio_sink_t *);
-	/** new data notifier */
-	errno_t (*data_available)(audio_sink_t *);
-};
-
-/**
- * List instance helper.
- * @param l link
- * @return pointer to a sink structure, NULL on failure.
- */
-static inline audio_sink_t *audio_sink_list_instance(link_t *l)
-{
-	return l ? list_get_instance(l, audio_sink_t, link) : NULL;
-}
-
-errno_t audio_sink_init(audio_sink_t *sink, const char *name, void *private_data,
-    errno_t (*connection_change)(audio_sink_t *, bool),
-    errno_t (*check_format)(audio_sink_t *), errno_t (*data_available)(audio_sink_t *),
-    const pcm_format_t *f);
-
-void audio_sink_fini(audio_sink_t *sink);
-errno_t audio_sink_set_format(audio_sink_t *sink, const pcm_format_t *format);
-void audio_sink_mix_inputs(audio_sink_t *sink, void *dest, size_t size);
-
-#endif
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_source.c
===================================================================
--- uspace/srv/audio/hound/audio_source.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,121 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-
-#include "audio_data.h"
-#include "audio_source.h"
-#include "audio_sink.h"
-#include "connection.h"
-#include "log.h"
-
-/**
- * Initialize audio source strcture.
- * @param source The structure to initialize.
- * @param name String identifier of the audio source.
- * @param data Backend data.
- * @param connection_change Connect/disconnect callback.
- * @param update_available_data Data request callback.
- * @return Error code.
- */
-errno_t audio_source_init(audio_source_t *source, const char *name, void *data,
-    errno_t (*connection_change)(audio_source_t *, bool new),
-    errno_t (*update_available_data)(audio_source_t *, size_t),
-    const pcm_format_t *f)
-{
-	assert(source);
-	if (!name || !f) {
-		log_debug("Incorrect parameters.");
-		return EINVAL;
-	}
-	link_initialize(&source->link);
-	list_initialize(&source->connections);
-	source->name = str_dup(name);
-	if (!source->name)
-		return ENOMEM;
-	source->private_data = data;
-	source->connection_change = connection_change;
-	source->update_available_data = update_available_data;
-	source->format = *f;
-	log_verbose("Initialized source (%p) '%s'", source, source->name);
-	return EOK;
-}
-
-/**
- * Release resources claimed by initialization.
- * @param source The structure to cleanup.
- */
-void audio_source_fini(audio_source_t *source)
-{
-	assert(source);
-	free(source->name);
-	source->name = NULL;
-}
-/**
- * Push data to all connections.
- * @param source The source of the data.
- * @param dest Destination buffer.
- * @param size size of the @p dest buffer.
- * @return Error code.
- */
-errno_t audio_source_push_data(audio_source_t *source, void *data,
-    size_t size)
-{
-	assert(source);
-	assert(data);
-
-	audio_data_t *adata = audio_data_create(data, size, source->format);
-	if (!adata)
-		return ENOMEM;
-
-	list_foreach(source->connections, source_link, connection_t, conn) {
-		const errno_t ret = connection_push_data(conn, adata);
-		if (ret != EOK) {
-			log_warning("Failed push data to %s: %s",
-			    connection_sink_name(conn), str_error(ret));
-		}
-	}
-	audio_data_unref(adata);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/audio_source.h
===================================================================
--- uspace/srv/audio/hound/audio_source.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef AUDIO_SOURCE_H_
-#define AUDIO_SOURCE_H_
-
-#include <adt/list.h>
-#include <pcm/format.h>
-
-typedef struct audio_source audio_source_t;
-
-/** Audio data source abstraction structure */
-struct audio_source {
-	/** Link in hound's sources list */
-	link_t link;
-	/** List of connections */
-	list_t connections;
-	/** String identifier */
-	char *name;
-	/** audio data format */
-	pcm_format_t format;
-	/** backend data */
-	void *private_data;
-	/** Callback for connection and disconnection */
-	errno_t (*connection_change)(audio_source_t *source, bool added);
-	/** Ask backend for more data */
-	errno_t (*update_available_data)(audio_source_t *source, size_t size);
-};
-
-/**
- * List instance helper.
- * @param l link
- * @return pointer to a source structure, NULL on failure.
- */
-static inline audio_source_t *audio_source_list_instance(link_t *l)
-{
-	return l ? list_get_instance(l, audio_source_t, link) : NULL;
-}
-
-errno_t audio_source_init(audio_source_t *source, const char *name, void *data,
-    errno_t (*connection_change)(audio_source_t *, bool),
-    errno_t (*update_available_data)(audio_source_t *, size_t),
-    const pcm_format_t *f);
-void audio_source_fini(audio_source_t *source);
-errno_t audio_source_push_data(audio_source_t *source, void *data,
-    size_t size);
-static inline const pcm_format_t *audio_source_format(const audio_source_t *s)
-{
-	assert(s);
-	return &s->format;
-}
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/connection.c
===================================================================
--- uspace/srv/audio/hound/connection.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <stdlib.h>
-
-#include "log.h"
-#include "connection.h"
-
-/**
- * Create connection between source and sink.
- * @param source Valid source structure.
- * @param sink Valid sink structure.
- * @return pointer to a valid connection structure, NULL on failure.
- *
- * Reports new connection to both the source and sink.
- */
-connection_t *connection_create(audio_source_t *source, audio_sink_t *sink)
-{
-	assert(source);
-	assert(sink);
-	connection_t *conn = malloc(sizeof(connection_t));
-	if (conn) {
-		audio_pipe_init(&conn->fifo);
-		link_initialize(&conn->source_link);
-		link_initialize(&conn->sink_link);
-		link_initialize(&conn->hound_link);
-		conn->sink = sink;
-		conn->source = source;
-		list_append(&conn->source_link, &source->connections);
-		fibril_mutex_lock(&sink->lock);
-		list_append(&conn->sink_link, &sink->connections);
-		fibril_mutex_unlock(&sink->lock);
-		audio_sink_set_format(sink, audio_source_format(source));
-		if (source->connection_change)
-			source->connection_change(source, true);
-		if (sink->connection_change)
-			sink->connection_change(sink, true);
-		log_debug("CONNECTED: %s -> %s", source->name, sink->name);
-	}
-	return conn;
-}
-
-/**
- * Destroy existing connection
- * @param connection The connection to destroy.
- *
- * Disconnects from both the source and the sink.
- */
-void connection_destroy(connection_t *connection)
-{
-	assert(connection);
-	assert(!link_in_use(&connection->hound_link));
-	list_remove(&connection->source_link);
-	fibril_mutex_lock(&connection->sink->lock);
-	list_remove(&connection->sink_link);
-	fibril_mutex_unlock(&connection->sink->lock);
-	if (connection->sink && connection->sink->connection_change)
-		connection->sink->connection_change(connection->sink, false);
-	if (connection->source && connection->source->connection_change)
-		connection->source->connection_change(connection->source, false);
-	audio_pipe_fini(&connection->fifo);
-	log_debug("DISCONNECTED: %s -> %s",
-	    connection->source->name, connection->sink->name);
-	free(connection);
-}
-
-/**
- * Update and mix data provided by the source.
- * @param connection the connection to add.
- * @param data Destination audio buffer.
- * @param size size of the destination audio buffer.
- * @param format format of the destination audio buffer.
- */
-errno_t connection_add_source_data(connection_t *connection, void *data,
-    size_t size, pcm_format_t format)
-{
-	assert(connection);
-	if (!data)
-		return EBADMEM;
-	const size_t needed_frames = pcm_format_size_to_frames(size, &format);
-	if (needed_frames > audio_pipe_frames(&connection->fifo) &&
-	    connection->source->update_available_data) {
-		log_debug("Asking source to provide more data");
-		connection->source->update_available_data(
-		    connection->source, size);
-	}
-	log_verbose("Data available after update: %zu",
-	    audio_pipe_bytes(&connection->fifo));
-	size_t ret =
-	    audio_pipe_mix_data(&connection->fifo, data, size, &format);
-	if (ret != size)
-		log_warning("Connection failed to provide enough data %zd/%zu",
-		    ret, size);
-	return EOK;
-}
-/**
- * Add new data to the connection buffer.
- * @param connection Target conneciton.
- * @aparam adata Reference counted audio data buffer.
- * @return Error code.
- */
-errno_t connection_push_data(connection_t *connection,
-    audio_data_t *adata)
-{
-	assert(connection);
-	assert(adata);
-	const errno_t ret = audio_pipe_push(&connection->fifo, adata);
-	if (ret == EOK && connection->sink->data_available)
-		connection->sink->data_available(connection->sink);
-	return ret;
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/connection.h
===================================================================
--- uspace/srv/audio/hound/connection.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,122 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef CONNECTION_H_
-#define CONNECTION_H_
-
-#include <assert.h>
-#include <adt/list.h>
-#include <pcm/format.h>
-
-#include "audio_data.h"
-#include "audio_source.h"
-#include "audio_sink.h"
-
-/** Source->sink connection structure */
-typedef struct {
-	/** Source's connections link */
-	link_t source_link;
-	/** Sink's connections link */
-	link_t sink_link;
-	/** Hound's connections link */
-	link_t hound_link;
-	/** audio data pipe */
-	audio_pipe_t fifo;
-	/** Target sink */
-	audio_sink_t *sink;
-	/** Target source */
-	audio_source_t *source;
-} connection_t;
-
-/**
- * List instance helper.
- * @param l link
- * @return pointer to a connection structure, NULL on failure.
- */
-static inline connection_t *connection_from_source_list(link_t *l)
-{
-	return l ? list_get_instance(l, connection_t, source_link) : NULL;
-}
-
-/**
- * List instance helper.
- * @param l link
- * @return pointer to a connection structure, NULL on failure.
- */
-static inline connection_t *connection_from_hound_list(link_t *l)
-{
-	return l ? list_get_instance(l, connection_t, hound_link) : NULL;
-}
-
-connection_t *connection_create(audio_source_t *source, audio_sink_t *sink);
-void connection_destroy(connection_t *connection);
-
-errno_t connection_add_source_data(connection_t *connection, void *data,
-    size_t size, pcm_format_t format);
-
-errno_t connection_push_data(connection_t *connection, audio_data_t *adata);
-
-/**
- * Source name getter.
- * @param connection Connection to the source.
- * @param valid string identifier, "no source" or "unnamed source" on failure.
- */
-static inline const char *connection_source_name(connection_t *connection)
-{
-	assert(connection);
-	if (connection->source && connection->source->name)
-		return connection->source->name;
-	// TODO assert?
-	return connection->source ? "unnamed source" : "no source";
-}
-
-/**
- * Sink name getter.
- * @param connection Connection to the sink.
- * @param valid string identifier, "no source" or "unnamed source" on failure.
- */
-static inline const char *connection_sink_name(connection_t *connection)
-{
-	assert(connection);
-	if (connection->sink && connection->sink->name)
-		return connection->sink->name;
-	// TODO assert?
-	return connection->source ? "unnamed sink" : "no sink";
-}
-
-#endif
-/**
- * @}
- */
Index: pace/srv/audio/hound/doc/doxygroups.h
===================================================================
--- uspace/srv/audio/hound/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup audio hound
- * @ingroup srvs
- * @brief HelenOS sound server
- */
Index: pace/srv/audio/hound/hound.c
===================================================================
--- uspace/srv/audio/hound/hound.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,601 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup audio
- * @brief HelenOS sound server.
- * @{
- */
-/** @file
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include "hound.h"
-#include "audio_device.h"
-#include "audio_sink.h"
-#include "audio_source.h"
-#include "connection.h"
-#include "log.h"
-#include "errno.h"
-#include "str_error.h"
-
-/**
- * Search devices by name.
- * @param name String identifier.
- * @return Pointer to the found device, NULL on failure.
- */
-static audio_device_t *find_device_by_name(list_t *list, const char *name)
-{
-	assert(list);
-	assert(name);
-
-	list_foreach(*list, link, audio_device_t, dev) {
-		if (str_cmp(name, dev->name) == 0) {
-			log_debug("device with name '%s' is in the list",
-			    name);
-			return dev;
-		}
-	}
-
-	return NULL;
-}
-
-/**
- * Search sources by name.
- * @param name String identifier.
- * @return Pointer to the found source, NULL on failure.
- */
-static audio_source_t *find_source_by_name(list_t *list, const char *name)
-{
-	assert(list);
-	assert(name);
-
-	list_foreach(*list, link, audio_source_t, dev) {
-		if (str_cmp(name, dev->name) == 0) {
-			log_debug("source with name '%s' is in the list",
-			    name);
-			return dev;
-		}
-	}
-
-	return NULL;
-}
-
-/**
- * Search sinks by name.
- * @param name String identifier.
- * @return Pointer to the found sink, NULL on failure.
- */
-static audio_sink_t *find_sink_by_name(list_t *list, const char *name)
-{
-	assert(list);
-	assert(name);
-
-	list_foreach(*list, link, audio_sink_t, dev) {
-		if (str_cmp(name, dev->name) == 0) {
-			log_debug("sink with name '%s' is in the list",
-			    name);
-			return dev;
-		}
-	}
-
-	return NULL;
-}
-
-static errno_t hound_disconnect_internal(hound_t *hound, const char *source_name, const char *sink_name);
-
-/**
- * Remove provided sink.
- * @param hound The hound structure.
- * @param sink Target sink to remove.
- *
- * This function has to be called with the list_guard lock held.
- */
-static void hound_remove_sink_internal(hound_t *hound, audio_sink_t *sink)
-{
-	assert(hound);
-	assert(sink);
-	assert(fibril_mutex_is_locked(&hound->list_guard));
-	log_verbose("Removing sink '%s'.", sink->name);
-	fibril_mutex_lock(&sink->lock);
-	if (!list_empty(&sink->connections))
-		log_warning("Removing sink '%s' while still connected.", sink->name);
-	while (!list_empty(&sink->connections)) {
-		connection_t *conn = list_get_instance(
-		    list_first(&sink->connections), connection_t, sink_link);
-		list_remove(&conn->hound_link);
-		connection_destroy(conn);
-	}
-	list_remove(&sink->link);
-	fibril_mutex_unlock(&sink->lock);
-}
-
-/**
- * Remove provided source.
- * @param hound The hound structure.
- * @param sink Target source to remove.
- *
- * This function has to be called with the guard lock held.
- */
-static void hound_remove_source_internal(hound_t *hound, audio_source_t *source)
-{
-	assert(fibril_mutex_is_locked(&hound->list_guard));
-	log_verbose("Removing source '%s'.", source->name);
-	if (!list_empty(&source->connections))
-		log_warning("Removing source '%s' while still connected.", source->name);
-	while (!list_empty(&source->connections)) {
-		connection_t *conn = list_get_instance(
-		    list_first(&source->connections), connection_t, source_link);
-		list_remove(&conn->hound_link);
-		connection_destroy(conn);
-	}
-	list_remove(&source->link);
-}
-
-/**
- * Initialize hound structure.
- * @param hound The structure to initialize.
- * @return Error code.
- */
-errno_t hound_init(hound_t *hound)
-{
-	assert(hound);
-	fibril_mutex_initialize(&hound->list_guard);
-	list_initialize(&hound->devices);
-	list_initialize(&hound->contexts);
-	list_initialize(&hound->sources);
-	list_initialize(&hound->sinks);
-	list_initialize(&hound->connections);
-	return EOK;
-}
-
-/**
- * Add a new application context.
- * @param hound Hound structure.
- * @param ctx Context to add.
- * @return Error code.
- */
-errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx)
-{
-	log_info("Trying to add context %p", ctx);
-	assert(hound);
-	if (!ctx)
-		return EINVAL;
-	fibril_mutex_lock(&hound->list_guard);
-	list_append(&ctx->link, &hound->contexts);
-	fibril_mutex_unlock(&hound->list_guard);
-	errno_t ret = EOK;
-	if (ret == EOK && ctx->source)
-		ret = hound_add_source(hound, ctx->source);
-	if (ret == EOK && ctx->sink)
-		ret = hound_add_sink(hound, ctx->sink);
-	if (ret != EOK) {
-		fibril_mutex_lock(&hound->list_guard);
-		list_remove(&ctx->link);
-		fibril_mutex_unlock(&hound->list_guard);
-	}
-	return ret;
-}
-
-/**
- * Remove existing application context.
- * @param hound Hound structure.
- * @param ctx Context to remove.
- * @return Error code.
- */
-errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx)
-{
-	assert(hound);
-	if (!ctx)
-		return EINVAL;
-	if (!list_empty(&ctx->streams))
-		return EBUSY;
-	fibril_mutex_lock(&hound->list_guard);
-	list_remove(&ctx->link);
-	if (ctx->source)
-		hound_remove_source_internal(hound, ctx->source);
-	if (ctx->sink)
-		hound_remove_sink_internal(hound, ctx->sink);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * Search registered contexts for the matching id.
- * @param hound The hound structure.
- * @param id Requested id.
- * @return Pointer to the found structure, NULL on failure.
- */
-hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id)
-{
-	assert(hound);
-
-	fibril_mutex_lock(&hound->list_guard);
-	hound_ctx_t *res = NULL;
-	list_foreach(hound->contexts, link, hound_ctx_t, ctx) {
-		if (hound_ctx_get_id(ctx) == id) {
-			res = ctx;
-			break;
-		}
-	}
-	fibril_mutex_unlock(&hound->list_guard);
-	return res;
-}
-
-/**
- * Add a new device.
- * @param hound The hound structure.
- * @param id Locations service id representing the device driver.
- * @param name String identifier.
- * @return Error code.
- */
-errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name)
-{
-	log_verbose("Adding device \"%s\", service: %zu", name, id);
-
-	assert(hound);
-	if (!name || !id) {
-		log_debug("Incorrect parameters.");
-		return EINVAL;
-	}
-
-	list_foreach(hound->devices, link, audio_device_t, dev) {
-		if (dev->id == id) {
-			log_debug("Device with id %zu is already present", id);
-			return EEXIST;
-		}
-	}
-
-	audio_device_t *dev = find_device_by_name(&hound->devices, name);
-	if (dev) {
-		log_debug("Device with name %s is already present", name);
-		return EEXIST;
-	}
-
-	dev = malloc(sizeof(audio_device_t));
-	if (!dev) {
-		log_debug("Failed to malloc device structure.");
-		return ENOMEM;
-	}
-
-	const errno_t ret = audio_device_init(dev, id, name);
-	if (ret != EOK) {
-		log_debug("Failed to initialize new audio device: %s",
-		    str_error(ret));
-		free(dev);
-		return ret;
-	}
-
-	list_append(&dev->link, &hound->devices);
-	log_info("Added new device: '%s'", dev->name);
-
-	audio_source_t *source = audio_device_get_source(dev);
-	if (source) {
-		const errno_t ret = hound_add_source(hound, source);
-		if (ret != EOK) {
-			log_debug("Failed to add device source: %s",
-			    str_error(ret));
-			audio_device_fini(dev);
-			return ret;
-		}
-		log_verbose("Added source: '%s'.", source->name);
-	}
-
-	audio_sink_t *sink = audio_device_get_sink(dev);
-	if (sink) {
-		const errno_t ret = hound_add_sink(hound, sink);
-		if (ret != EOK) {
-			log_debug("Failed to add device sink: %s",
-			    str_error(ret));
-			audio_device_fini(dev);
-			return ret;
-		}
-		log_verbose("Added sink: '%s'.", sink->name);
-	}
-
-	if (!source && !sink)
-		log_warning("Neither sink nor source on device '%s'.", name);
-
-	return ret;
-}
-
-/**
- * Register a new source.
- * @param hound The hound structure.
- * @param source A new source to add.
- * @return Error code.
- */
-errno_t hound_add_source(hound_t *hound, audio_source_t *source)
-{
-	assert(hound);
-	if (!source || !source->name || str_cmp(source->name, "default") == 0) {
-		log_debug("Invalid source specified.");
-		return EINVAL;
-	}
-	fibril_mutex_lock(&hound->list_guard);
-	if (find_source_by_name(&hound->sources, source->name)) {
-		log_debug("Source by that name already exists");
-		fibril_mutex_unlock(&hound->list_guard);
-		return EEXIST;
-	}
-	list_append(&source->link, &hound->sources);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * Register a new sink.
- * @param hound The hound structure.
- * @param sink A new sink to add.
- * @return Error code.
- */
-errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink)
-{
-	assert(hound);
-	if (!sink || !sink->name || str_cmp(sink->name, "default") == 0) {
-		log_debug("Invalid source specified.");
-		return EINVAL;
-	}
-	fibril_mutex_lock(&hound->list_guard);
-	if (find_sink_by_name(&hound->sinks, sink->name)) {
-		log_debug("Sink by that name already exists");
-		fibril_mutex_unlock(&hound->list_guard);
-		return EEXIST;
-	}
-	list_append(&sink->link, &hound->sinks);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * Remove a registered source.
- * @param hound The hound structure.
- * @param source A registered source to remove.
- * @return Error code.
- */
-errno_t hound_remove_source(hound_t *hound, audio_source_t *source)
-{
-	assert(hound);
-	if (!source)
-		return EINVAL;
-	fibril_mutex_lock(&hound->list_guard);
-	hound_remove_source_internal(hound, source);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * Remove a registered sink.
- * @param hound The hound structure.
- * @param sink A registered sink to remove.
- * @return Error code.
- */
-errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink)
-{
-	assert(hound);
-	if (!sink)
-		return EINVAL;
-	fibril_mutex_lock(&hound->list_guard);
-	hound_remove_sink_internal(hound, sink);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * List all registered sources.
- * @param[in] hound The hound structure.
- * @param[out] list List of the string identifiers.
- * @param[out] size Number of identifiers int he @p list.
- * @return Error code.
- */
-errno_t hound_list_sources(hound_t *hound, char ***list, size_t *size)
-{
-	assert(hound);
-	if (!list || !size)
-		return EINVAL;
-
-	fibril_mutex_lock(&hound->list_guard);
-	const unsigned long count = list_count(&hound->sources);
-	if (count == 0) {
-		*list = NULL;
-		*size = 0;
-		fibril_mutex_unlock(&hound->list_guard);
-		return EOK;
-	}
-	char **names = calloc(count, sizeof(char *));
-	errno_t ret = names ? EOK : ENOMEM;
-	for (unsigned long i = 0; i < count && ret == EOK; ++i) {
-		link_t *slink = list_nth(&hound->sources, i);
-		audio_source_t *source = audio_source_list_instance(slink);
-		names[i] = str_dup(source->name);
-		if (names[i])
-			ret = ENOMEM;
-	}
-	if (ret == EOK) {
-		*size = count;
-		*list = names;
-	} else {
-		for (size_t i = 0; i < count; ++i)
-			free(names[i]);
-		free(names);
-	}
-	fibril_mutex_unlock(&hound->list_guard);
-	return ret;
-}
-
-/**
- * List all registered sinks.
- * @param[in] hound The hound structure.
- * @param[out] list List of the string identifiers.
- * @param[out] size Number of identifiers int he @p list.
- * @return Error code.
- */
-errno_t hound_list_sinks(hound_t *hound, char ***list, size_t *size)
-{
-	assert(hound);
-	if (!list || !size)
-		return EINVAL;
-
-	fibril_mutex_lock(&hound->list_guard);
-	const size_t count = list_count(&hound->sinks);
-	if (count == 0) {
-		*list = NULL;
-		*size = 0;
-		fibril_mutex_unlock(&hound->list_guard);
-		return EOK;
-	}
-	char **names = calloc(count, sizeof(char *));
-	errno_t ret = names ? EOK : ENOMEM;
-	for (size_t i = 0; i < count && ret == EOK; ++i) {
-		link_t *slink = list_nth(&hound->sinks, i);
-		audio_sink_t *sink = audio_sink_list_instance(slink);
-		names[i] = str_dup(sink->name);
-		if (!names[i])
-			ret = ENOMEM;
-	}
-	if (ret == EOK) {
-		*size = count;
-		*list = names;
-	} else {
-		for (size_t i = 0; i < count; ++i)
-			free(names[i]);
-		free(names);
-	}
-	fibril_mutex_unlock(&hound->list_guard);
-	return ret;
-}
-
-/**
- * List all connections
- * @param[in] hound The hound structure.
- * @param[out] sources List of the source string identifiers.
- * @param[out] sinks List of the sinks string identifiers.
- * @param[out] size Number of identifiers int he @p list.
- * @return Error code.
- *
- * Lists include duplicit name entries. The order of entries is important,
- * identifiers with the same index are connected.
- */
-errno_t hound_list_connections(hound_t *hound, const char ***sources,
-    const char ***sinks, size_t *size)
-{
-	fibril_mutex_lock(&hound->list_guard);
-	fibril_mutex_unlock(&hound->list_guard);
-	return ENOTSUP;
-}
-
-/**
- * Create and register a new connection.
- * @param hound The hound structure.
- * @param source_name Source's string id.
- * @param sink_name Sink's string id.
- * @return Error code.
- */
-errno_t hound_connect(hound_t *hound, const char *source_name, const char *sink_name)
-{
-	assert(hound);
-	log_verbose("Connecting '%s' to '%s'.", source_name, sink_name);
-	fibril_mutex_lock(&hound->list_guard);
-
-	audio_source_t *source =
-	    audio_source_list_instance(list_first(&hound->sources));
-	if (str_cmp(source_name, "default") != 0)
-		source = find_source_by_name(&hound->sources, source_name);
-
-	audio_sink_t *sink =
-	    audio_sink_list_instance(list_first(&hound->sinks));
-	if (str_cmp(sink_name, "default") != 0)
-		sink = find_sink_by_name(&hound->sinks, sink_name);
-
-	if (!source || !sink) {
-		fibril_mutex_unlock(&hound->list_guard);
-		log_debug("Source (%p), or sink (%p) not found", source, sink);
-		return ENOENT;
-	}
-	connection_t *conn = connection_create(source, sink);
-	if (!conn) {
-		fibril_mutex_unlock(&hound->list_guard);
-		log_debug("Failed to create connection");
-		return ENOMEM;
-	}
-	list_append(&conn->hound_link, &hound->connections);
-	fibril_mutex_unlock(&hound->list_guard);
-	return EOK;
-}
-
-/**
- * Find and destroy connection between source and sink.
- * @param hound The hound structure.
- * @param source_name Source's string id.
- * @param sink_name Sink's string id.
- * @return Error code.
- */
-errno_t hound_disconnect(hound_t *hound, const char *source_name, const char *sink_name)
-{
-	assert(hound);
-	fibril_mutex_lock(&hound->list_guard);
-	const errno_t ret = hound_disconnect_internal(hound, source_name, sink_name);
-	fibril_mutex_unlock(&hound->list_guard);
-	return ret;
-}
-
-/**
- * Internal disconnect helper.
- * @param hound The hound structure.
- * @param source_name Source's string id.
- * @param sink_name Sink's string id.
- * @return Error code.
- *
- * This function has to be called with the list_guard lock held.
- */
-static errno_t hound_disconnect_internal(hound_t *hound, const char *source_name,
-    const char *sink_name)
-{
-	assert(hound);
-	assert(fibril_mutex_is_locked(&hound->list_guard));
-	log_debug("Disconnecting '%s' to '%s'.", source_name, sink_name);
-
-	list_foreach_safe(hound->connections, it, next) {
-		connection_t *conn = connection_from_hound_list(it);
-		if (str_cmp(connection_source_name(conn), source_name) == 0 ||
-		    str_cmp(connection_sink_name(conn), sink_name) == 0) {
-			log_debug("Removing %s -> %s", connection_source_name(conn),
-			    connection_sink_name(conn));
-			list_remove(it);
-			connection_destroy(conn);
-		}
-	}
-
-	return EOK;
-}
-/**
- * @}
- */
Index: pace/srv/audio/hound/hound.h
===================================================================
--- uspace/srv/audio/hound/hound.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef HOUND_H_
-#define HOUND_H_
-
-#include <async.h>
-#include <adt/list.h>
-#include <ipc/loc.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <pcm/format.h>
-#include <hound/protocol.h>
-
-#include "hound_ctx.h"
-#include "audio_source.h"
-#include "audio_sink.h"
-
-/** The main Hound structure */
-typedef struct {
-	/** List access guard */
-	fibril_mutex_t list_guard;
-	/** enumerated devices */
-	list_t devices;
-	/** registered contexts */
-	list_t contexts;
-	/** Provided sources */
-	list_t sources;
-	/** Provided sinks */
-	list_t sinks;
-	/** Existing connections. */
-	list_t connections;
-} hound_t;
-
-errno_t hound_init(hound_t *hound);
-errno_t hound_add_ctx(hound_t *hound, hound_ctx_t *ctx);
-errno_t hound_remove_ctx(hound_t *hound, hound_ctx_t *ctx);
-hound_ctx_t *hound_get_ctx_by_id(hound_t *hound, hound_context_id_t id);
-
-errno_t hound_add_device(hound_t *hound, service_id_t id, const char *name);
-errno_t hound_add_source(hound_t *hound, audio_source_t *source);
-errno_t hound_add_sink(hound_t *hound, audio_sink_t *sink);
-errno_t hound_list_sources(hound_t *hound, char ***list, size_t *size);
-errno_t hound_list_sinks(hound_t *hound, char ***list, size_t *size);
-errno_t hound_list_connections(hound_t *hound, const char ***sources,
-    const char ***sinks, size_t *size);
-errno_t hound_remove_source(hound_t *hound, audio_source_t *source);
-errno_t hound_remove_sink(hound_t *hound, audio_sink_t *sink);
-errno_t hound_connect(hound_t *hound, const char *source_name, const char *sink_name);
-errno_t hound_disconnect(hound_t *hound, const char *source_name, const char *sink_name);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/hound_ctx.c
===================================================================
--- uspace/srv/audio/hound/hound_ctx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,476 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup audio
- * @brief HelenOS sound server.
- * @{
- */
-/** @file
- */
-
-#include <macros.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str_error.h>
-
-#include "hound_ctx.h"
-#include "audio_data.h"
-#include "connection.h"
-#include "log.h"
-
-static errno_t update_data(audio_source_t *source, size_t size);
-static errno_t new_data(audio_sink_t *sink);
-
-/**
- * Allocate and initialize hound context structure.
- * @param name String identifier.
- * @return Pointer to a new context structure, NULL on failure
- *
- * Creates record context structure.
- */
-hound_ctx_t *hound_record_ctx_get(const char *name)
-{
-	hound_ctx_t *ctx = malloc(sizeof(hound_ctx_t));
-	if (ctx) {
-		link_initialize(&ctx->link);
-		list_initialize(&ctx->streams);
-		fibril_mutex_initialize(&ctx->guard);
-		ctx->source = NULL;
-		ctx->sink = malloc(sizeof(audio_sink_t));
-		if (!ctx->sink) {
-			free(ctx);
-			return NULL;
-		}
-		const errno_t ret = audio_sink_init(ctx->sink, name, ctx, NULL,
-		    NULL, new_data, &AUDIO_FORMAT_DEFAULT);
-		if (ret != EOK) {
-			free(ctx->sink);
-			free(ctx);
-			return NULL;
-		}
-	}
-	return ctx;
-}
-
-/**
- * Allocate and initialize hound context structure.
- * @param name String identifier.
- * @return Pointer to a new context structure, NULL on failure
- *
- * Creates record context structure.
- */
-hound_ctx_t *hound_playback_ctx_get(const char *name)
-{
-	hound_ctx_t *ctx = malloc(sizeof(hound_ctx_t));
-	if (ctx) {
-		link_initialize(&ctx->link);
-		list_initialize(&ctx->streams);
-		fibril_mutex_initialize(&ctx->guard);
-		ctx->sink = NULL;
-		ctx->source = malloc(sizeof(audio_source_t));
-		if (!ctx->source) {
-			free(ctx);
-			return NULL;
-		}
-		const errno_t ret = audio_source_init(ctx->source, name, ctx, NULL,
-		    update_data, &AUDIO_FORMAT_DEFAULT);
-		if (ret != EOK) {
-			free(ctx->source);
-			free(ctx);
-			return NULL;
-		}
-	}
-	return ctx;
-}
-
-/**
- * Destroy existing context structure.
- * @param ctx hound cotnext to destroy.
- */
-void hound_ctx_destroy(hound_ctx_t *ctx)
-{
-	assert(ctx);
-	assert(!link_in_use(&ctx->link));
-	assert(list_empty(&ctx->streams));
-	if (ctx->source)
-		audio_source_fini(ctx->source);
-	if (ctx->sink)
-		audio_sink_fini(ctx->sink);
-	free(ctx->source);
-	free(ctx->sink);
-	free(ctx);
-}
-
-/**
- * Retrieve associated context id.
- * @param ctx hound context.
- * @return context id of the context.
- */
-hound_context_id_t hound_ctx_get_id(hound_ctx_t *ctx)
-{
-	assert(ctx);
-	return (hound_context_id_t)ctx;
-}
-
-/**
- * Query playback/record status of a hound context.
- * @param ctx Hound context.
- * @return True if ctx  is a recording context.
- */
-bool hound_ctx_is_record(hound_ctx_t *ctx)
-{
-	assert(ctx);
-	return ctx->source == NULL;
-}
-
-/*
- * STREAMS
- */
-
-/** Hound stream structure. */
-typedef struct hound_ctx_stream {
-	/** Hound context streams link */
-	link_t link;
-	/** Audio data pipe */
-	audio_pipe_t fifo;
-	/** Parent context */
-	hound_ctx_t *ctx;
-	/** Stream data format */
-	pcm_format_t format;
-	/** Stream modifiers */
-	int flags;
-	/** Maximum allowed buffer size */
-	size_t allowed_size;
-	/** Fifo access synchronization */
-	fibril_mutex_t guard;
-	/** buffer status change condition */
-	fibril_condvar_t change;
-} hound_ctx_stream_t;
-
-/**
- * New stream append helper.
- * @param ctx hound context.
- * @param stream A new stream.
- */
-static inline void stream_append(hound_ctx_t *ctx, hound_ctx_stream_t *stream)
-{
-	assert(ctx);
-	assert(stream);
-	fibril_mutex_lock(&ctx->guard);
-	list_append(&stream->link, &ctx->streams);
-	if (list_count(&ctx->streams) == 1) {
-		if (ctx->source && list_count(&ctx->source->connections) == 0)
-			ctx->source->format = stream->format;
-	}
-	fibril_mutex_unlock(&ctx->guard);
-}
-
-/**
- * Push new data to stream, do not block.
- * @param stream The target stream.
- * @param adata The new data.
- * @return Error code.
- */
-static errno_t stream_push_data(hound_ctx_stream_t *stream, audio_data_t *adata)
-{
-	assert(stream);
-	assert(adata);
-
-	if (stream->allowed_size && adata->size > stream->allowed_size)
-		return EINVAL;
-
-	fibril_mutex_lock(&stream->guard);
-	if (stream->allowed_size &&
-	    (audio_pipe_bytes(&stream->fifo) + adata->size >
-	    stream->allowed_size)) {
-		fibril_mutex_unlock(&stream->guard);
-		return EOVERFLOW;
-
-	}
-
-	const errno_t ret = audio_pipe_push(&stream->fifo, adata);
-	fibril_mutex_unlock(&stream->guard);
-	if (ret == EOK)
-		fibril_condvar_signal(&stream->change);
-	return ret;
-}
-
-/**
- * Old stream remove helper.
- * @param ctx hound context.
- * @param stream An old stream.
- */
-static inline void stream_remove(hound_ctx_t *ctx, hound_ctx_stream_t *stream)
-{
-	assert(ctx);
-	assert(stream);
-	fibril_mutex_lock(&ctx->guard);
-	list_remove(&stream->link);
-	fibril_mutex_unlock(&ctx->guard);
-}
-
-/**
- * Create new stream.
- * @param ctx Assocaited hound context.
- * @param flags Stream modidfiers.
- * @param format PCM data format.
- * @param buffer_size Maximum allowed buffer size.
- * @return Pointer to a new stream structure, NULL on failure.
- */
-hound_ctx_stream_t *hound_ctx_create_stream(hound_ctx_t *ctx, int flags,
-    pcm_format_t format, size_t buffer_size)
-{
-	assert(ctx);
-	hound_ctx_stream_t *stream = malloc(sizeof(hound_ctx_stream_t));
-	if (stream) {
-		audio_pipe_init(&stream->fifo);
-		link_initialize(&stream->link);
-		fibril_mutex_initialize(&stream->guard);
-		fibril_condvar_initialize(&stream->change);
-		stream->ctx = ctx;
-		stream->flags = flags;
-		stream->format = format;
-		stream->allowed_size = buffer_size;
-		stream_append(ctx, stream);
-		log_verbose("CTX: %p added stream; flags:%#x ch: %u r:%u f:%s",
-		    ctx, flags, format.channels, format.sampling_rate,
-		    pcm_sample_format_str(format.sample_format));
-	}
-	return stream;
-}
-
-/**
- * Destroy existing stream structure.
- * @param stream The stream to destroy.
- *
- * The function will print warning if there are data in the buffer.
- */
-void hound_ctx_destroy_stream(hound_ctx_stream_t *stream)
-{
-	if (stream) {
-		stream_remove(stream->ctx, stream);
-		if (audio_pipe_bytes(&stream->fifo))
-			log_warning("Destroying stream with non empty buffer");
-		log_verbose("CTX: %p remove stream (%zu/%zu); "
-		    "flags:%#x ch: %u r:%u f:%s",
-		    stream->ctx, audio_pipe_bytes(&stream->fifo),
-		    stream->allowed_size, stream->flags,
-		    stream->format.channels, stream->format.sampling_rate,
-		    pcm_sample_format_str(stream->format.sample_format));
-		audio_pipe_fini(&stream->fifo);
-		free(stream);
-	}
-}
-
-/**
- * Write new data to a stream.
- * @param stream The destination stream.
- * @param data audio data buffer.
- * @param size size of the @p data buffer.
- * @return Error code.
- */
-errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, void *data,
-    size_t size)
-{
-	assert(stream);
-
-	if (stream->allowed_size && size > stream->allowed_size)
-		return EINVAL;
-
-	fibril_mutex_lock(&stream->guard);
-	while (stream->allowed_size &&
-	    (audio_pipe_bytes(&stream->fifo) + size > stream->allowed_size)) {
-		fibril_condvar_wait(&stream->change, &stream->guard);
-
-	}
-
-	const errno_t ret =
-	    audio_pipe_push_data(&stream->fifo, data, size, stream->format);
-	fibril_mutex_unlock(&stream->guard);
-	if (ret == EOK)
-		fibril_condvar_signal(&stream->change);
-	return ret;
-}
-
-/**
- * Read data from a buffer.
- * @param stream The source buffer.
- * @param data Destination data buffer.
- * @param size Size of the @p data buffer.
- * @return Error code.
- */
-errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *data, size_t size)
-{
-	assert(stream);
-
-	if (stream->allowed_size && size > stream->allowed_size)
-		return EINVAL;
-
-	fibril_mutex_lock(&stream->guard);
-	while (audio_pipe_bytes(&stream->fifo) < size) {
-		fibril_condvar_wait(&stream->change, &stream->guard);
-	}
-
-	pcm_format_silence(data, size, &stream->format);
-	const size_t ret =
-	    audio_pipe_mix_data(&stream->fifo, data, size, &stream->format);
-	fibril_mutex_unlock(&stream->guard);
-	if (ret > 0) {
-		fibril_condvar_signal(&stream->change);
-		return EOK;
-	}
-	return EEMPTY;
-}
-
-/**
- * Add (mix) stream data to the destination buffer.
- * @param stream The source stream.
- * @param data Destination audio buffer.
- * @param size Size of the @p data buffer.
- * @param format Destination data format.
- * @return Size of the destination buffer touch with stream's data.
- */
-size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
-    size_t size, const pcm_format_t *f)
-{
-	assert(stream);
-	fibril_mutex_lock(&stream->guard);
-	const size_t ret = audio_pipe_mix_data(&stream->fifo, data, size, f);
-	fibril_condvar_signal(&stream->change);
-	fibril_mutex_unlock(&stream->guard);
-	return ret;
-}
-
-/**
- * Block until the stream's buffer is empty.
- * @param stream Target stream.
- */
-void hound_ctx_stream_drain(hound_ctx_stream_t *stream)
-{
-	assert(stream);
-	log_debug("Draining stream");
-	fibril_mutex_lock(&stream->guard);
-	while (audio_pipe_bytes(&stream->fifo))
-		fibril_condvar_wait(&stream->change, &stream->guard);
-	fibril_mutex_unlock(&stream->guard);
-}
-
-/**
- * Update context data.
- * @param source Source abstraction.
- * @param size Required size in source's format.
- * @return error code.
- *
- * Mixes data from all streams and pushes it to all connections.
- */
-errno_t update_data(audio_source_t *source, size_t size)
-{
-	assert(source);
-	assert(source->private_data);
-	hound_ctx_t *ctx = source->private_data;
-	void *buffer = malloc(size);
-	if (!buffer)
-		return ENOMEM;
-	audio_data_t *adata = audio_data_create(buffer, size, source->format);
-	if (!adata) {
-		free(buffer);
-		return ENOMEM;
-	}
-	log_verbose("CTX: %p: Mixing %zu streams", ctx,
-	    list_count(&ctx->streams));
-	pcm_format_silence(buffer, size, &source->format);
-	fibril_mutex_lock(&ctx->guard);
-	list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
-		ssize_t copied = hound_ctx_stream_add_self(
-		    stream, buffer, size, &source->format);
-		if (copied != (ssize_t)size)
-			log_warning("Not enough data in stream buffer");
-	}
-	log_verbose("CTX: %p. Pushing audio to %zu connections", ctx,
-	    list_count(&source->connections));
-	list_foreach(source->connections, source_link, connection_t, conn) {
-		connection_push_data(conn, adata);
-	}
-	/* all connections should now have their refs */
-	audio_data_unref(adata);
-	fibril_mutex_unlock(&ctx->guard);
-	return EOK;
-}
-
-errno_t new_data(audio_sink_t *sink)
-{
-	assert(sink);
-	assert(sink->private_data);
-	hound_ctx_t *ctx = sink->private_data;
-
-	fibril_mutex_lock(&ctx->guard);
-
-	/* count available data */
-	size_t available_frames = -1;  /* this is ugly.... */
-	list_foreach(sink->connections, source_link, connection_t, conn) {
-		available_frames = min(available_frames,
-		    audio_pipe_frames(&conn->fifo));
-	}
-
-	const size_t bsize =
-	    available_frames * pcm_format_frame_size(&sink->format);
-	void *buffer = malloc(bsize);
-	if (!buffer) {
-		fibril_mutex_unlock(&ctx->guard);
-		return ENOMEM;
-	}
-	audio_data_t *adata = audio_data_create(buffer, bsize, sink->format);
-	if (!adata) {
-		fibril_mutex_unlock(&ctx->guard);
-		free(buffer);
-		return ENOMEM;
-	}
-
-	/* mix data */
-	pcm_format_silence(buffer, bsize, &sink->format);
-	list_foreach(sink->connections, source_link, connection_t, conn) {
-		/* This should not trigger data update on the source */
-		connection_add_source_data(
-		    conn, buffer, bsize, sink->format);
-	}
-	/* push to all streams */
-	list_foreach(ctx->streams, link, hound_ctx_stream_t, stream) {
-		const errno_t ret = stream_push_data(stream, adata);
-		if (ret != EOK)
-			log_error("Failed to push data to stream: %s",
-			    str_error(ret));
-	}
-	audio_data_unref(adata);
-	fibril_mutex_unlock(&ctx->guard);
-	return ENOTSUP;
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/hound_ctx.h
===================================================================
--- uspace/srv/audio/hound/hound_ctx.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef HOUND_CTX_H_
-#define HOUND_CTX_H_
-
-#include <adt/list.h>
-#include <hound/protocol.h>
-#include <fibril_synch.h>
-
-#include "audio_source.h"
-#include "audio_sink.h"
-
-/** Application context structure */
-typedef struct {
-	/** Hound's contexts link */
-	link_t link;
-	/** List of streams */
-	list_t streams;
-	/** Provided audio source abstraction */
-	audio_source_t *source;
-	/** Provided audio sink abstraction */
-	audio_sink_t *sink;
-	/** List access synchronization */
-	fibril_mutex_t guard;
-} hound_ctx_t;
-
-typedef struct hound_ctx_stream hound_ctx_stream_t;
-
-hound_ctx_t *hound_record_ctx_get(const char *name);
-hound_ctx_t *hound_playback_ctx_get(const char *name);
-void hound_ctx_destroy(hound_ctx_t *context);
-
-hound_context_id_t hound_ctx_get_id(hound_ctx_t *ctx);
-bool hound_ctx_is_record(hound_ctx_t *ctx);
-
-hound_ctx_stream_t *hound_ctx_create_stream(hound_ctx_t *ctx, int flags,
-    pcm_format_t format, size_t buffer_size);
-void hound_ctx_destroy_stream(hound_ctx_stream_t *stream);
-
-errno_t hound_ctx_stream_write(hound_ctx_stream_t *stream, void *buffer,
-    size_t size);
-errno_t hound_ctx_stream_read(hound_ctx_stream_t *stream, void *buffer, size_t size);
-size_t hound_ctx_stream_add_self(hound_ctx_stream_t *stream, void *data,
-    size_t size, const pcm_format_t *f);
-void hound_ctx_stream_drain(hound_ctx_stream_t *stream);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/iface.c
===================================================================
--- uspace/srv/audio/hound/iface.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/*
- * Copyright (c) 2013 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup audio
- * @brief HelenOS sound server.
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <hound/protocol.h>
-#include <inttypes.h>
-
-#include "hound.h"
-#include "hound_ctx.h"
-#include "log.h"
-
-static errno_t iface_add_context(void *server, hound_context_id_t *id,
-    const char *name, bool record)
-{
-	assert(server);
-	assert(id);
-	assert(name);
-
-	hound_ctx_t *ctx = record ? hound_record_ctx_get(name) :
-	    hound_playback_ctx_get(name);
-	if (!ctx)
-		return ENOMEM;
-
-	const errno_t ret = hound_add_ctx(server, ctx);
-	if (ret != EOK)
-		hound_ctx_destroy(ctx);
-	else
-		*id = hound_ctx_get_id(ctx);
-	return ret;
-}
-
-static errno_t iface_rem_context(void *server, hound_context_id_t id)
-{
-	assert(server);
-	hound_ctx_t *ctx = hound_get_ctx_by_id(server, id);
-	if (!ctx)
-		return EINVAL;
-	const errno_t ret = hound_remove_ctx(server, ctx);
-	if (ret == EOK) {
-		hound_ctx_destroy(ctx);
-		log_info("%s: %p, %p", __FUNCTION__, server, id);
-	}
-	return ret;
-}
-
-static bool iface_is_record_context(void *server, hound_context_id_t id)
-{
-	assert(server);
-	hound_ctx_t *ctx = hound_get_ctx_by_id(server, id);
-	if (!ctx)
-		return false;
-	return hound_ctx_is_record(ctx);
-}
-
-static errno_t iface_get_list(void *server, char ***list, size_t *size,
-    const char *connection, int flags)
-{
-	log_info("%s: %p, %zu, %s, %#x\n", __FUNCTION__, server, *size,
-	    connection, flags);
-	if ((flags & (HOUND_SINK_DEVS | HOUND_SINK_APPS)) != 0)
-		return hound_list_sinks(server, list, size);
-	if ((flags & (HOUND_SOURCE_DEVS | HOUND_SOURCE_APPS)) != 0)
-		return hound_list_sources(server, list, size);
-	return ENOTSUP;
-}
-
-static errno_t iface_connect(void *server, const char *source, const char *sink)
-{
-	log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
-	return hound_connect(server, source, sink);
-}
-
-static errno_t iface_disconnect(void *server, const char *source, const char *sink)
-{
-	log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
-	return hound_disconnect(server, source, sink);
-}
-
-static errno_t iface_add_stream(void *server, hound_context_id_t id, int flags,
-    pcm_format_t format, size_t size, void **data)
-{
-	assert(data);
-	assert(server);
-
-	log_verbose("%s: %p, %p %x ch:%u r:%u f:%s", __FUNCTION__, server, id,
-	    flags, format.channels, format.sampling_rate,
-	    pcm_sample_format_str(format.sample_format));
-	hound_ctx_t *ctx = hound_get_ctx_by_id(server, id);
-	if (!ctx)
-		return ENOENT;
-	hound_ctx_stream_t *stream =
-	    hound_ctx_create_stream(ctx, flags, format, size);
-	if (!stream)
-		return ENOMEM;
-	*data = stream;
-	return EOK;
-}
-
-static errno_t iface_rem_stream(void *server, void *stream)
-{
-	hound_ctx_destroy_stream(stream);
-	return EOK;
-}
-
-static errno_t iface_drain_stream(void *stream)
-{
-	hound_ctx_stream_drain(stream);
-	return EOK;
-}
-
-static errno_t iface_stream_data_read(void *stream, void *buffer, size_t size)
-{
-	return hound_ctx_stream_read(stream, buffer, size);
-}
-
-static errno_t iface_stream_data_write(void *stream, void *buffer, size_t size)
-{
-	return hound_ctx_stream_write(stream, buffer, size);
-}
-
-hound_server_iface_t hound_iface = {
-	.add_context = iface_add_context,
-	.rem_context = iface_rem_context,
-	.is_record_context = iface_is_record_context,
-	.get_list = iface_get_list,
-	.connect = iface_connect,
-	.disconnect = iface_disconnect,
-	.add_stream = iface_add_stream,
-	.rem_stream = iface_rem_stream,
-	.drain_stream = iface_drain_stream,
-	.stream_data_write = iface_stream_data_write,
-	.stream_data_read = iface_stream_data_read,
-	.server = NULL,
-};
Index: pace/srv/audio/hound/log.h
===================================================================
--- uspace/srv/audio/hound/log.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup audio
- * @brief HelenOS sound server
- * @{
- */
-/** @file
- */
-
-#ifndef LOG_H_
-#define LOG_H_
-
-#include <io/log.h>
-
-#ifndef NAME
-#define NAME "NONAME"
-#endif
-
-#include <stdio.h>
-
-#define log_fatal(...) log_msg(LOG_DEFAULT, LVL_FATAL, ##__VA_ARGS__);
-#define log_error(...) log_msg(LOG_DEFAULT, LVL_ERROR, ##__VA_ARGS__);
-#define log_warning(...) log_msg(LOG_DEFAULT, LVL_WARN, ##__VA_ARGS__);
-#define log_info(...) log_msg(LOG_DEFAULT, LVL_NOTE, ##__VA_ARGS__);
-#define log_debug(...) log_msg(LOG_DEFAULT, LVL_DEBUG, ##__VA_ARGS__);
-#define log_verbose(...) log_msg(LOG_DEFAULT, LVL_DEBUG2, ##__VA_ARGS__);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/main.c
===================================================================
--- uspace/srv/audio/hound/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2012 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup audio
- * @brief HelenOS sound server.
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <hound/server.h>
-#include <hound/protocol.h>
-#include <task.h>
-
-#include "hound.h"
-
-#define NAMESPACE "audio"
-#define NAME "hound"
-#define CATEGORY "audio-pcm"
-
-#include "log.h"
-
-extern hound_server_iface_t hound_iface;
-
-static hound_t hound;
-
-static errno_t device_callback(service_id_t id, const char *name)
-{
-	return hound_add_device(&hound, id, name);
-}
-
-static void scan_for_devices(void *arg)
-{
-	hound_server_devices_iterate(device_callback);
-}
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS sound service\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	errno_t ret = hound_init(&hound);
-	if (ret != EOK) {
-		log_fatal("Failed to initialize hound structure: %s",
-		    str_error(ret));
-		return -ret;
-	}
-
-	hound_iface.server = &hound;
-	hound_service_set_server_iface(&hound_iface);
-	async_set_fallback_port_handler(hound_connection_handler, NULL);
-
-	service_id_t id = 0;
-	ret = hound_server_register(NAME, &id);
-	if (ret != EOK) {
-		log_fatal("Failed to register server: %s", str_error(ret));
-		return -ret;
-	}
-
-	ret = hound_server_set_device_change_callback(scan_for_devices, NULL);
-	if (ret != EOK) {
-		log_fatal("Failed to register for device changes: %s",
-		    str_error(ret));
-		hound_server_unregister(id);
-		return -ret;
-	}
-	log_info("Running with service id %" PRIun, id);
-
-	scan_for_devices(NULL);
-	task_retval(0);
-	async_manager();
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/audio/hound/meson.build
===================================================================
--- uspace/srv/audio/hound/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2012 Jan Vesely
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv', 'hound', 'pcm' ]
-c_args += '-DNAME="hound"'
-src = files(
-	'audio_data.c',
-	'audio_device.c',
-	'audio_sink.c',
-	'audio_source.c',
-	'connection.c',
-	'hound.c',
-	'hound_ctx.c',
-	'iface.c',
-	'main.c',
-)
Index: pace/srv/bd/file_bd/doc/doxygroups.h
===================================================================
--- uspace/srv/bd/file_bd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup file_bd file_bd
- * @brief File-backed block device driver
- * @ingroup srvs
- */
Index: pace/srv/bd/file_bd/file_bd.c
===================================================================
--- uspace/srv/bd/file_bd/file_bd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,336 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup file_bd
- * @{
- */
-
-/**
- * @file
- * @brief File-backed block device driver
- *
- * Allows accessing a file as a block device. Useful for, e.g., mounting
- * a disk image.
- */
-
-#include <stdio.h>
-#include <async.h>
-#include <as.h>
-#include <bd_srv.h>
-#include <fibril_synch.h>
-#include <loc.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <task.h>
-#include <macros.h>
-#include <str.h>
-
-#define NAME "file_bd"
-
-#define DEFAULT_BLOCK_SIZE 512
-
-static size_t block_size;
-static aoff64_t num_blocks;
-static FILE *img;
-static loc_srv_t *srv;
-
-static service_id_t service_id;
-static bd_srvs_t bd_srvs;
-static fibril_mutex_t dev_lock;
-
-static void print_usage(void);
-static errno_t file_bd_init(const char *fname);
-static void file_bd_connection(ipc_call_t *icall, void *);
-
-static errno_t file_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t file_bd_close(bd_srv_t *);
-static errno_t file_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t file_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t file_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t file_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-static bd_ops_t file_bd_ops = {
-	.open = file_bd_open,
-	.close = file_bd_close,
-	.read_blocks = file_bd_read_blocks,
-	.write_blocks = file_bd_write_blocks,
-	.get_block_size = file_bd_get_block_size,
-	.get_num_blocks = file_bd_get_num_blocks
-};
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	char *image_name;
-	char *device_name;
-	category_id_t disk_cat;
-
-	printf(NAME ": File-backed block device driver\n");
-
-	block_size = DEFAULT_BLOCK_SIZE;
-
-	++argv;
-	--argc;
-	while (*argv != NULL && (*argv)[0] == '-') {
-		/* Option */
-		if (str_cmp(*argv, "-b") == 0) {
-			if (argc < 2) {
-				printf("Argument missing.\n");
-				print_usage();
-				return -1;
-			}
-
-			rc = str_size_t(argv[1], NULL, 10, true, &block_size);
-			if (rc != EOK || block_size == 0) {
-				printf("Invalid block size '%s'.\n", argv[1]);
-				print_usage();
-				return -1;
-			}
-			++argv;
-			--argc;
-		} else {
-			printf("Invalid option '%s'.\n", *argv);
-			print_usage();
-			return -1;
-		}
-		++argv;
-		--argc;
-	}
-
-	if (argc < 2) {
-		printf("Missing arguments.\n");
-		print_usage();
-		return -1;
-	}
-
-	image_name = argv[0];
-	device_name = argv[1];
-
-	if (file_bd_init(image_name) != EOK)
-		return -1;
-
-	rc = loc_service_register(srv, device_name, &service_id);
-	if (rc != EOK) {
-		printf("%s: Unable to register device '%s': %s.\n",
-		    NAME, device_name, str_error(rc));
-		return rc;
-	}
-
-	rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed resolving category 'disk': %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = loc_service_add_to_cat(srv, service_id, disk_cat);
-	if (rc != EOK) {
-		printf("%s: Failed adding %s to category: %s",
-		    NAME, device_name, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-static void print_usage(void)
-{
-	printf("Usage: " NAME " [-b <block_size>] <image_file> <device_name>\n");
-}
-
-static errno_t file_bd_init(const char *fname)
-{
-	bd_srvs_init(&bd_srvs);
-	bd_srvs.ops = &file_bd_ops;
-
-	async_set_fallback_port_handler(file_bd_connection, NULL);
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register driver.\n", NAME);
-		return rc;
-	}
-
-	img = fopen(fname, "rb+");
-	if (img == NULL) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	if (fseek(img, 0, SEEK_END) != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	off64_t img_size = ftell(img);
-	if (img_size < 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	num_blocks = img_size / block_size;
-
-	fibril_mutex_initialize(&dev_lock);
-
-	return EOK;
-error:
-	if (img != NULL) {
-		fclose(img);
-		img = NULL;
-	}
-
-	if (srv != NULL) {
-		loc_server_unregister(srv);
-		srv = NULL;
-	}
-
-	return rc;
-}
-
-static void file_bd_connection(ipc_call_t *icall, void *arg)
-{
-	bd_conn(icall, &bd_srvs);
-}
-
-/** Open device. */
-static errno_t file_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Close device. */
-static errno_t file_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read blocks from the device. */
-static errno_t file_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	size_t n_rd;
-
-	if (size < cnt * block_size)
-		return EINVAL;
-
-	/* Check whether access is within device address bounds. */
-	if (ba + cnt > num_blocks) {
-		printf(NAME ": Accessed blocks %" PRIuOFF64 "-%" PRIuOFF64 ", while "
-		    "max block number is %" PRIuOFF64 ".\n", ba, ba + cnt - 1,
-		    num_blocks - 1);
-		return ELIMIT;
-	}
-
-	fibril_mutex_lock(&dev_lock);
-
-	clearerr(img);
-	if (fseek(img, ba * block_size, SEEK_SET) < 0) {
-		fibril_mutex_unlock(&dev_lock);
-		return EIO;
-	}
-
-	n_rd = fread(buf, block_size, cnt, img);
-
-	if (ferror(img)) {
-		fibril_mutex_unlock(&dev_lock);
-		return EIO;	/* Read error */
-	}
-
-	fibril_mutex_unlock(&dev_lock);
-
-	if (n_rd < cnt)
-		return EINVAL;	/* Read beyond end of device */
-
-	return EOK;
-}
-
-/** Write blocks to the device. */
-static errno_t file_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	size_t n_wr;
-
-	if (size < cnt * block_size)
-		return EINVAL;
-
-	/* Check whether access is within device address bounds. */
-	if (ba + cnt > num_blocks) {
-		printf(NAME ": Accessed blocks %" PRIuOFF64 "-%" PRIuOFF64 ", while "
-		    "max block number is %" PRIuOFF64 ".\n", ba, ba + cnt - 1,
-		    num_blocks - 1);
-		return ELIMIT;
-	}
-
-	fibril_mutex_lock(&dev_lock);
-
-	clearerr(img);
-	if (fseek(img, ba * block_size, SEEK_SET) < 0) {
-		fibril_mutex_unlock(&dev_lock);
-		return EIO;
-	}
-
-	n_wr = fwrite(buf, block_size, cnt, img);
-
-	if (ferror(img) || n_wr < cnt) {
-		fibril_mutex_unlock(&dev_lock);
-		return EIO;	/* Write error */
-	}
-
-	if (fflush(img) != 0) {
-		fibril_mutex_unlock(&dev_lock);
-		return EIO;
-	}
-
-	fibril_mutex_unlock(&dev_lock);
-
-	return EOK;
-}
-
-/** Get device block size. */
-static errno_t file_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	*rsize = block_size;
-	return EOK;
-}
-
-/** Get number of blocks on device. */
-static errno_t file_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	*rnb = num_blocks;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/bd/file_bd/meson.build
===================================================================
--- uspace/srv/bd/file_bd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('file_bd.c')
Index: pace/srv/bd/rd/doc/doxygroups.h
===================================================================
--- uspace/srv/bd/rd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup rd rd
- * @ingroup srvs
- * @brief RAM disk server
- */
Index: pace/srv/bd/rd/meson.build
===================================================================
--- uspace/srv/bd/rd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('rd.c')
Index: pace/srv/bd/rd/rd.c
===================================================================
--- uspace/srv/bd/rd/rd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,230 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2007 Michal Konopa
- * Copyright (c) 2007 Martin Jelen
- * Copyright (c) 2007 Peter Majer
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup rd
- * @{
- */
-
-/**
- * @file rd.c
- * @brief Initial RAM disk for HelenOS.
- */
-
-#include <ipc/services.h>
-#include <ipc/ns.h>
-#include <sysinfo.h>
-#include <as.h>
-#include <bd_srv.h>
-#include <ddi.h>
-#include <align.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <str_error.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-#include <loc.h>
-#include <macros.h>
-#include <inttypes.h>
-
-#define NAME  "rd"
-
-/** Pointer to the ramdisk's image */
-static void *rd_addr = AS_AREA_ANY;
-
-/** Size of the ramdisk */
-static size_t rd_size;
-
-/** Block size */
-static const size_t block_size = 512;
-
-static errno_t rd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t rd_close(bd_srv_t *);
-static errno_t rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t rd_get_block_size(bd_srv_t *, size_t *);
-static errno_t rd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-/** This rwlock protects the ramdisk's data.
- *
- * If we were to serve multiple requests (read + write or several writes)
- * concurrently (i.e. from two or more threads), each read and write needs to
- * be protected by this rwlock.
- *
- */
-static fibril_rwlock_t rd_lock;
-
-static bd_ops_t rd_bd_ops = {
-	.open = rd_open,
-	.close = rd_close,
-	.read_blocks = rd_read_blocks,
-	.write_blocks = rd_write_blocks,
-	.get_block_size = rd_get_block_size,
-	.get_num_blocks = rd_get_num_blocks
-};
-
-static bd_srvs_t bd_srvs;
-static loc_srv_t *srv;
-
-static void rd_client_conn(ipc_call_t *icall, void *arg)
-{
-	bd_conn(icall, &bd_srvs);
-}
-
-/** Open device. */
-static errno_t rd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Close device. */
-static errno_t rd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read blocks from the device. */
-static errno_t rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	if ((ba + cnt) * block_size > rd_size) {
-		/* Reading past the end of the device. */
-		return ELIMIT;
-	}
-
-	fibril_rwlock_read_lock(&rd_lock);
-	memcpy(buf, rd_addr + ba * block_size, min(block_size * cnt, size));
-	fibril_rwlock_read_unlock(&rd_lock);
-
-	return EOK;
-}
-
-/** Write blocks to the device. */
-static errno_t rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	if ((ba + cnt) * block_size > rd_size) {
-		/* Writing past the end of the device. */
-		return ELIMIT;
-	}
-
-	fibril_rwlock_write_lock(&rd_lock);
-	memcpy(rd_addr + ba * block_size, buf, min(block_size * cnt, size));
-	fibril_rwlock_write_unlock(&rd_lock);
-
-	return EOK;
-}
-
-/** Prepare the ramdisk image for operation. */
-static bool rd_init(void)
-{
-	sysarg_t size;
-	errno_t ret = sysinfo_get_value("rd.size", &size);
-	if ((ret != EOK) || (size == 0)) {
-		printf("%s: No RAM disk found\n", NAME);
-		return false;
-	}
-
-	sysarg_t addr_phys;
-	ret = sysinfo_get_value("rd.address.physical", &addr_phys);
-	if ((ret != EOK) || (addr_phys == 0)) {
-		printf("%s: Invalid RAM disk physical address\n", NAME);
-		return false;
-	}
-
-	rd_size = ALIGN_UP(size, block_size);
-	unsigned int flags =
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
-
-	ret = physmem_map(addr_phys,
-	    ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags, &rd_addr);
-	if (ret != EOK) {
-		printf("%s: Error mapping RAM disk\n", NAME);
-		return false;
-	}
-
-	printf("%s: Found RAM disk at %p, %" PRIun " bytes\n", NAME,
-	    (void *) addr_phys, size);
-
-	bd_srvs_init(&bd_srvs);
-	bd_srvs.ops = &rd_bd_ops;
-
-	async_set_fallback_port_handler(rd_client_conn, NULL);
-	ret = loc_server_register(NAME, &srv);
-	if (ret != EOK) {
-		printf("%s: Unable to register driver: %s\n", NAME, str_error(ret));
-		return false;
-	}
-
-	service_id_t service_id;
-	ret = loc_service_register(srv, "bd/initrd", &service_id);
-	if (ret != EOK) {
-		printf("%s: Unable to register device service\n", NAME);
-		return false;
-	}
-
-	fibril_rwlock_initialize(&rd_lock);
-
-	return true;
-}
-
-/** Get device block size. */
-static errno_t rd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	*rsize = block_size;
-	return EOK;
-}
-
-/** Get number of blocks on device. */
-static errno_t rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	*rnb = rd_size / block_size;
-	return EOK;
-}
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS RAM disk server\n", NAME);
-
-	if (!rd_init())
-		return -1;
-
-	printf("%s: Accepting connections\n", NAME);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/bd/sata_bd/doc/doxygroups.h
===================================================================
--- uspace/srv/bd/sata_bd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup sata_bd sata_bd
- * @brief SATA disk driver
- * @ingroup drvs
- */
Index: pace/srv/bd/sata_bd/meson.build
===================================================================
--- uspace/srv/bd/sata_bd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2012 Petr Jerman
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('sata_bd.c')
Index: pace/srv/bd/sata_bd/sata_bd.c
===================================================================
--- uspace/srv/bd/sata_bd/sata_bd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,298 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sata_bd
- * @{
- */
-
-/**
- * @file
- * @brief SATA disk driver
- *
- */
-
-#include <stddef.h>
-#include <bd_srv.h>
-#include <devman.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <str.h>
-#include <loc.h>
-#include <macros.h>
-#include <task.h>
-
-#include <ahci_iface.h>
-#include "sata_bd.h"
-
-#define NAME       "sata_bd"
-#define NAMESPACE  "bd"
-
-/** Maximum number of disks handled */
-#define MAXDISKS  256
-
-static loc_srv_t *srv;
-static sata_bd_dev_t disk[MAXDISKS];
-static int disk_count;
-
-static errno_t sata_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t sata_bd_close(bd_srv_t *);
-static errno_t sata_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t sata_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
-static errno_t sata_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t sata_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-
-static bd_ops_t sata_bd_ops = {
-	.open = sata_bd_open,
-	.close = sata_bd_close,
-	.read_blocks = sata_bd_read_blocks,
-	.write_blocks = sata_bd_write_blocks,
-	.get_block_size = sata_bd_get_block_size,
-	.get_num_blocks = sata_bd_get_num_blocks
-};
-
-static sata_bd_dev_t *bd_srv_sata(bd_srv_t *bd)
-{
-	return (sata_bd_dev_t *) bd->srvs->sarg;
-}
-
-/** Find SATA devices in device tree.
- *
- *  @param Device manager handle describing container for searching.
- *
- *  @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t scan_device_tree(devman_handle_t funh)
-{
-	devman_handle_t devh;
-	devman_handle_t *cfuns;
-	size_t count, i;
-	errno_t rc;
-
-	/* If device is SATA, add device to the disk array. */
-	disk[disk_count].sess = ahci_get_sess(funh, &disk[disk_count].dev_name);
-	if (disk[disk_count].sess != NULL) {
-
-		ahci_get_sata_device_name(disk[disk_count].sess,
-		    SATA_DEV_NAME_LENGTH, disk[disk_count].sata_dev_name);
-
-		ahci_get_block_size(disk[disk_count].sess,
-		    &disk[disk_count].block_size);
-
-		ahci_get_num_blocks(disk[disk_count].sess, &disk[disk_count].blocks);
-
-		bd_srvs_init(&disk[disk_count].bds);
-		disk[disk_count].bds.ops = &sata_bd_ops;
-		disk[disk_count].bds.sarg = &disk[disk_count];
-
-		printf("Device %s - %s , blocks: %lu, block_size: %lu\n",
-		    disk[disk_count].dev_name, disk[disk_count].sata_dev_name,
-		    (long unsigned int) disk[disk_count].blocks,
-		    (long unsigned int) disk[disk_count].block_size);
-
-		++disk_count;
-	}
-
-	/* search children */
-	rc = devman_fun_get_child(funh, &devh);
-	if (rc == ENOENT)
-		return EOK;
-
-	if (rc != EOK) {
-		printf(NAME ": Failed getting child device for function %s.\n", "xxx");
-		return rc;
-	}
-
-	rc = devman_dev_get_functions(devh, &cfuns, &count);
-	if (rc != EOK) {
-		printf(NAME ": Failed getting list of functions for device %s.\n",
-		    "xxx");
-		return rc;
-	}
-
-	for (i = 0; i < count; i++)
-		scan_device_tree(cfuns[i]);
-
-	free(cfuns);
-	return EOK;
-}
-
-/** Find sata devices in device tree from root.
- *
- *  @return EOK if succeed, error code otherwise.
- *
- */
-static errno_t get_sata_disks(void)
-{
-	devman_handle_t root_fun;
-	errno_t rc;
-
-	disk_count = 0;
-
-	rc = devman_fun_get_handle("/", &root_fun, 0);
-	if (rc != EOK) {
-		printf(NAME ": Error resolving root function.\n");
-		return EIO;
-	}
-
-	scan_device_tree(root_fun);
-
-	return EOK;
-}
-
-/** Block device connection handler. */
-static void sata_bd_connection(ipc_call_t *icall, void *arg)
-{
-	service_id_t dsid;
-	int disk_id, i;
-
-	/* Get the device service ID. */
-	dsid = ipc_get_arg2(icall);
-
-	/* Determine which disk device is the client connecting to. */
-	disk_id = -1;
-	for (i = 0; i < MAXDISKS; i++)
-		if (disk[i].service_id == dsid)
-			disk_id = i;
-
-	if (disk_id < 0) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	bd_conn(icall, &disk[disk_id].bds);
-}
-
-/** Open device. */
-static errno_t sata_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Close device. */
-static errno_t sata_bd_close(bd_srv_t *bd)
-{
-	return EOK;
-}
-
-/** Read blocks from partition. */
-static errno_t sata_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
-    size_t size)
-{
-	sata_bd_dev_t *sbd = bd_srv_sata(bd);
-
-	if (size < cnt * sbd->block_size)
-		return EINVAL;
-
-	return ahci_read_blocks(sbd->sess, ba, cnt, buf);
-}
-
-/** Write blocks to partition. */
-static errno_t sata_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	sata_bd_dev_t *sbd = bd_srv_sata(bd);
-
-	if (size < cnt * sbd->block_size)
-		return EINVAL;
-
-	return ahci_write_blocks(sbd->sess, ba, cnt, (void *)buf);
-}
-
-/** Get device block size. */
-static errno_t sata_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	sata_bd_dev_t *sbd = bd_srv_sata(bd);
-
-	*rsize = sbd->block_size;
-	return EOK;
-}
-
-/** Get number of blocks on device. */
-static errno_t sata_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	sata_bd_dev_t *sbd = bd_srv_sata(bd);
-
-	*rnb = sbd->blocks;
-	return EOK;
-}
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	category_id_t disk_cat;
-
-	async_set_fallback_port_handler(sata_bd_connection, NULL);
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf(NAME ": Unable to register driver: %s.\n", str_error(rc));
-		return rc;
-	}
-
-	rc = get_sata_disks();
-	if (rc != EOK) {
-		// TODO: log the error
-		return rc;
-	}
-
-	rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed resolving category 'disk': %s.\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	for (int i = 0; i < disk_count; i++) {
-		char name[1024];
-		snprintf(name, 1024, "%s/%s", NAMESPACE, disk[i].dev_name);
-		rc = loc_service_register(srv, name, &disk[i].service_id);
-		if (rc != EOK) {
-			printf(NAME ": Unable to register device %s: %s\n", name, str_error(rc));
-			return rc;
-		}
-
-		rc = loc_service_add_to_cat(srv, disk[i].service_id, disk_cat);
-		if (rc != EOK) {
-			printf("%s: Failed adding %s to category: %s.",
-			    NAME, disk[i].dev_name, str_error(rc));
-			return rc;
-		}
-	}
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/bd/sata_bd/sata_bd.h
===================================================================
--- uspace/srv/bd/sata_bd/sata_bd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2012 Petr Jerman
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup sata_bd
- * @{
- */
-/** @file SATA block device driver definitions.
- */
-
-#ifndef __SATA_BD_H__
-#define __SATA_BD_H__
-
-#define SATA_DEV_NAME_LENGTH 256
-
-#include <async.h>
-#include <bd_srv.h>
-#include <loc.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** SATA Block Device. */
-typedef struct {
-	/** Device name in device tree. */
-	char *dev_name;
-	/** SATA Device name. */
-	char sata_dev_name[SATA_DEV_NAME_LENGTH];
-	/** Session to device methods. */
-	async_sess_t *sess;
-	/** Loc service id. */
-	service_id_t service_id;
-	/** Number of blocks. */
-	uint64_t blocks;
-	/** Size of block. */
-	size_t block_size;
-	/** Block device server structure */
-	bd_srvs_t bds;
-} sata_bd_dev_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/bd/vbd/disk.c
===================================================================
--- uspace/srv/bd/vbd/disk.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1293 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vbd
- * @{
- */
-/**
- * @file
- */
-
-#include <adt/list.h>
-#include <bd.h>
-#include <bd_srv.h>
-#include <block.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <label/empty.h>
-#include <label/label.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include <vbd.h>
-
-#include "disk.h"
-#include "types/vbd.h"
-
-loc_srv_t *vbds_srv;
-
-static fibril_mutex_t vbds_disks_lock;
-static list_t vbds_disks; /* of vbds_disk_t */
-static fibril_mutex_t vbds_parts_lock;
-static list_t vbds_parts; /* of vbds_part_t */
-
-static category_id_t part_cid;
-
-static errno_t vbds_disk_parts_add(vbds_disk_t *, label_t *);
-static errno_t vbds_disk_parts_remove(vbds_disk_t *, vbds_rem_flag_t);
-
-static errno_t vbds_bd_open(bd_srvs_t *, bd_srv_t *);
-static errno_t vbds_bd_close(bd_srv_t *);
-static errno_t vbds_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
-static errno_t vbds_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
-static errno_t vbds_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *,
-    size_t);
-static errno_t vbds_bd_get_block_size(bd_srv_t *, size_t *);
-static errno_t vbds_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
-static errno_t vbds_bd_eject(bd_srv_t *);
-
-static errno_t vbds_bsa_translate(vbds_part_t *, aoff64_t, size_t, aoff64_t *);
-
-static errno_t vbds_part_svc_register(vbds_part_t *);
-static errno_t vbds_part_svc_unregister(vbds_part_t *);
-static errno_t vbds_part_indices_update(vbds_disk_t *);
-
-static vbd_part_id_t vbds_part_id = 1;
-
-static errno_t vbds_label_get_bsize(void *, size_t *);
-static errno_t vbds_label_get_nblocks(void *, aoff64_t *);
-static errno_t vbds_label_read(void *, aoff64_t, size_t, void *);
-static errno_t vbds_label_write(void *, aoff64_t, size_t, const void *);
-
-/** Block device operations provided by VBD */
-static bd_ops_t vbds_bd_ops = {
-	.open = vbds_bd_open,
-	.close = vbds_bd_close,
-	.read_blocks = vbds_bd_read_blocks,
-	.sync_cache = vbds_bd_sync_cache,
-	.write_blocks = vbds_bd_write_blocks,
-	.get_block_size = vbds_bd_get_block_size,
-	.get_num_blocks = vbds_bd_get_num_blocks,
-	.eject = vbds_bd_eject
-};
-
-/** Provide disk access to liblabel */
-static label_bd_ops_t vbds_label_bd_ops = {
-	.get_bsize = vbds_label_get_bsize,
-	.get_nblocks = vbds_label_get_nblocks,
-	.read = vbds_label_read,
-	.write = vbds_label_write
-};
-
-static vbds_part_t *bd_srv_part(bd_srv_t *bd)
-{
-	return (vbds_part_t *)bd->srvs->sarg;
-}
-
-static vbds_disk_t *vbds_disk_first(void)
-{
-	link_t *link;
-
-	link = list_first(&vbds_disks);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, vbds_disk_t, ldisks);
-}
-
-static vbds_disk_t *vbds_disk_next(vbds_disk_t *disk)
-{
-	link_t *link;
-
-	if (disk == NULL)
-		return NULL;
-
-	link = list_next(&disk->ldisks, &vbds_disks);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, vbds_disk_t, ldisks);
-}
-
-errno_t vbds_disks_init(void)
-{
-	errno_t rc;
-
-	fibril_mutex_initialize(&vbds_disks_lock);
-	list_initialize(&vbds_disks);
-	fibril_mutex_initialize(&vbds_parts_lock);
-	list_initialize(&vbds_parts);
-
-	rc = loc_category_get_id("partition", &part_cid, 0);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error looking up partition "
-		    "category.");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/** Check for new/removed disk devices */
-static errno_t vbds_disks_check_new(void)
-{
-	bool already_known;
-	category_id_t disk_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	vbds_disk_t *cur, *next;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disks_check_new()");
-
-	fibril_mutex_lock(&vbds_disks_lock);
-
-	rc = loc_category_get_id("disk", &disk_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'disk'.");
-		fibril_mutex_unlock(&vbds_disks_lock);
-		return ENOENT;
-	}
-
-	rc = loc_category_get_svcs(disk_cat, &svcs, &count);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of disk "
-		    "devices.");
-		fibril_mutex_unlock(&vbds_disks_lock);
-		return EIO;
-	}
-
-	list_foreach(vbds_disks, ldisks, vbds_disk_t, disk)
-		disk->present = false;
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
-			if (disk->svc_id == svcs[i]) {
-				already_known = true;
-				disk->present = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			log_msg(LOG_DEFAULT, LVL_NOTE, "Found disk '%lu'",
-			    (unsigned long) svcs[i]);
-			rc = vbds_disk_add(svcs[i]);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Could not add "
-				    "disk.");
-			}
-		} else {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Disk %lu already known",
-			    (unsigned long) svcs[i]);
-		}
-	}
-
-	cur = vbds_disk_first();
-	while (cur != NULL) {
-		next = vbds_disk_next(cur);
-		if (!cur->present) {
-			log_msg(LOG_DEFAULT, LVL_NOTE, "Disk '%lu' is gone",
-			    (unsigned long) cur->svc_id);
-			rc = vbds_disk_remove(cur->svc_id);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Could not "
-				    "remove disk.");
-			}
-		}
-
-		cur = next;
-	}
-
-	fibril_mutex_unlock(&vbds_disks_lock);
-	return EOK;
-}
-
-static errno_t vbds_disk_by_svcid(service_id_t sid, vbds_disk_t **rdisk)
-{
-	list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
-		if (disk->svc_id == sid) {
-			*rdisk = disk;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-static void vbds_part_add_ref(vbds_part_t *part)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_part_add_ref");
-	refcount_up(&part->refcnt);
-}
-
-static void vbds_part_del_ref(vbds_part_t *part)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_part_del_ref");
-	if (refcount_down(&part->refcnt)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, " - free part");
-		free(part);
-	}
-}
-
-static errno_t vbds_part_by_pid(vbds_part_id_t partid, vbds_part_t **rpart)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_pid(%zu)", partid);
-
-	fibril_mutex_lock(&vbds_parts_lock);
-
-	list_foreach(vbds_parts, lparts, vbds_part_t, part) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%zu == %zu ?", part->pid, partid);
-		if (part->pid == partid) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Found match.");
-			vbds_part_add_ref(part);
-			fibril_mutex_unlock(&vbds_parts_lock);
-			*rpart = part;
-			return EOK;
-		}
-	}
-
-	fibril_mutex_unlock(&vbds_parts_lock);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "No match.");
-	return ENOENT;
-}
-
-static errno_t vbds_part_by_svcid(service_id_t svcid, vbds_part_t **rpart)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_by_svcid(%zu)", svcid);
-
-	fibril_mutex_lock(&vbds_parts_lock);
-
-	list_foreach(vbds_parts, lparts, vbds_part_t, part) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%zu == %zu ?", part->svc_id, svcid);
-		if (part->svc_id == svcid) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Found match.");
-			vbds_part_add_ref(part);
-			fibril_mutex_unlock(&vbds_parts_lock);
-			*rpart = part;
-			return EOK;
-		}
-	}
-
-	fibril_mutex_unlock(&vbds_parts_lock);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "No match.");
-	return ENOENT;
-}
-
-/** Add partition to our inventory based on liblabel partition structure */
-static errno_t vbds_part_add(vbds_disk_t *disk, label_part_t *lpart,
-    vbds_part_t **rpart)
-{
-	vbds_part_t *part;
-	service_id_t psid = 0;
-	label_part_info_t lpinfo;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_add(%s, %p)",
-	    disk->svc_name, lpart);
-
-	label_part_get_info(lpart, &lpinfo);
-
-	part = calloc(1, sizeof(vbds_part_t));
-	if (part == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-		return ENOMEM;
-	}
-
-	fibril_rwlock_initialize(&part->lock);
-
-	part->lpart = lpart;
-	part->disk = disk;
-	part->pid = ++vbds_part_id;
-	part->svc_id = psid;
-	part->block0 = lpinfo.block0;
-	part->nblocks = lpinfo.nblocks;
-	refcount_init(&part->refcnt);
-
-	bd_srvs_init(&part->bds);
-	part->bds.ops = &vbds_bd_ops;
-	part->bds.sarg = part;
-
-	if (lpinfo.pkind != lpk_extended) {
-		rc = vbds_part_svc_register(part);
-		if (rc != EOK) {
-			free(part);
-			return EIO;
-		}
-	}
-
-	list_append(&part->ldisk, &disk->parts);
-	fibril_mutex_lock(&vbds_parts_lock);
-	list_append(&part->lparts, &vbds_parts);
-	fibril_mutex_unlock(&vbds_parts_lock);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_add -> %p", part);
-
-	if (rpart != NULL)
-		*rpart = part;
-	return EOK;
-}
-
-/** Remove partition from our inventory leaving only the underlying liblabel
- * partition structure.
- *
- * @param part   Partition
- * @param flag   If set to @c vrf_force, force removal even if partition is in use
- * @param rlpart Place to store pointer to liblabel partition
- *
- */
-static errno_t vbds_part_remove(vbds_part_t *part, vbds_rem_flag_t flag,
-    label_part_t **rlpart)
-{
-	label_part_t *lpart;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_remove(%p)", part);
-
-	fibril_rwlock_write_lock(&part->lock);
-	lpart = part->lpart;
-
-	if ((flag & vrf_force) == 0 && part->open_cnt > 0) {
-		fibril_rwlock_write_unlock(&part->lock);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "part->open_cnt = %d",
-		    part->open_cnt);
-		return EBUSY;
-	}
-
-	if (part->svc_id != 0) {
-		rc = vbds_part_svc_unregister(part);
-		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&part->lock);
-			return EIO;
-		}
-	}
-
-	list_remove(&part->ldisk);
-	fibril_mutex_lock(&vbds_parts_lock);
-	list_remove(&part->lparts);
-	fibril_mutex_unlock(&vbds_parts_lock);
-
-	vbds_part_del_ref(part);
-	part->lpart = NULL;
-	fibril_rwlock_write_unlock(&part->lock);
-
-	if (rlpart != NULL)
-		*rlpart = lpart;
-	return EOK;
-}
-
-/** Remove all disk partitions from our inventory leaving only the underlying
- * liblabel partition structures.
- */
-static errno_t vbds_disk_parts_add(vbds_disk_t *disk, label_t *label)
-{
-	label_part_t *part;
-	errno_t rc;
-
-	part = label_part_first(label);
-	while (part != NULL) {
-		rc = vbds_part_add(disk, part, NULL);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding partition "
-			    "(disk %s)", disk->svc_name);
-			return rc;
-		}
-
-		part = label_part_next(part);
-	}
-
-	return EOK;
-}
-
-/** Remove all disk partitions from our inventory leaving only the underlying
- * liblabel partition structures.
- */
-static errno_t vbds_disk_parts_remove(vbds_disk_t *disk, vbds_rem_flag_t flag)
-{
-	link_t *link;
-	vbds_part_t *part;
-	errno_t rc;
-
-	link = list_first(&disk->parts);
-	while (link != NULL) {
-		part = list_get_instance(link, vbds_part_t, ldisk);
-		rc = vbds_part_remove(part, flag, NULL);
-		if (rc != EOK)
-			return rc;
-
-		link = list_first(&disk->parts);
-	}
-
-	return EOK;
-}
-
-static void vbds_disk_cat_change_cb(void *arg)
-{
-	(void) vbds_disks_check_new();
-}
-
-errno_t vbds_disk_discovery_start(void)
-{
-	errno_t rc;
-
-	rc = loc_register_cat_change_cb(vbds_disk_cat_change_cb, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
-		    "for disk discovery: %s.", str_error(rc));
-		return rc;
-	}
-
-	return vbds_disks_check_new();
-}
-
-errno_t vbds_disk_add(service_id_t sid)
-{
-	label_t *label = NULL;
-	label_bd_t lbd;
-	vbds_disk_t *disk = NULL;
-	bool block_inited = false;
-	size_t block_size;
-	aoff64_t nblocks;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_add(%zu)", sid);
-
-	/* Check for duplicates */
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc == EOK)
-		return EEXIST;
-
-	disk = calloc(1, sizeof(vbds_disk_t));
-	if (disk == NULL)
-		return ENOMEM;
-
-	/* Must be set before calling label_open */
-	disk->svc_id = sid;
-
-	rc = loc_service_get_name(sid, &disk->svc_name);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting disk service name.");
-		rc = EIO;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "block_init(%zu)", sid);
-	rc = block_init(sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed opening block device %s.",
-		    disk->svc_name);
-		rc = EIO;
-		goto error;
-	}
-
-	rc = block_get_bsize(sid, &block_size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting block size of %s.",
-		    disk->svc_name);
-		rc = EIO;
-		goto error;
-	}
-
-	rc = block_get_nblocks(sid, &nblocks);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting number of "
-		    "blocks of %s.", disk->svc_name);
-		rc = EIO;
-		goto error;
-	}
-
-	block_inited = true;
-
-	lbd.ops = &vbds_label_bd_ops;
-	lbd.arg = (void *) disk;
-
-	rc = label_open(&lbd, &label);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to open label in disk %s.",
-		    disk->svc_name);
-		rc = EIO;
-		goto error;
-	}
-
-	disk->label = label;
-	disk->block_size = block_size;
-	disk->nblocks = nblocks;
-	disk->present = true;
-
-	list_initialize(&disk->parts);
-	list_append(&disk->ldisks, &vbds_disks);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Recognized disk label. Adding partitions.");
-
-	(void) vbds_disk_parts_add(disk, label);
-	return EOK;
-error:
-	label_close(label);
-	if (block_inited) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "block_fini(%zu)", sid);
-		block_fini(sid);
-	}
-	if (disk != NULL)
-		free(disk->svc_name);
-	free(disk);
-	return rc;
-}
-
-errno_t vbds_disk_remove(service_id_t sid)
-{
-	vbds_disk_t *disk;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_remove(%zu)", sid);
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK)
-		return rc;
-
-	rc = vbds_disk_parts_remove(disk, vrf_force);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed removing disk.");
-		return rc;
-	}
-
-	list_remove(&disk->ldisks);
-	label_close(disk->label);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "block_fini(%zu)", sid);
-	block_fini(sid);
-	free(disk->svc_name);
-	free(disk);
-	return EOK;
-}
-
-/** Get list of disks as array of service IDs. */
-errno_t vbds_disk_get_ids(service_id_t *id_buf, size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	fibril_mutex_lock(&vbds_disks_lock);
-
-	buf_cnt = buf_size / sizeof(service_id_t);
-
-	act_cnt = list_count(&vbds_disks);
-	*act_size = act_cnt * sizeof(service_id_t);
-
-	if (buf_size % sizeof(service_id_t) != 0) {
-		fibril_mutex_unlock(&vbds_disks_lock);
-		return EINVAL;
-	}
-
-	size_t pos = 0;
-	list_foreach(vbds_disks, ldisks, vbds_disk_t, disk) {
-		if (pos < buf_cnt)
-			id_buf[pos] = disk->svc_id;
-		pos++;
-	}
-
-	fibril_mutex_unlock(&vbds_disks_lock);
-	return EOK;
-}
-
-errno_t vbds_disk_info(service_id_t sid, vbd_disk_info_t *info)
-{
-	vbds_disk_t *disk;
-	label_info_t linfo;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info(%zu)", sid);
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK)
-		return rc;
-
-	rc = label_get_info(disk->label, &linfo);
-	if (rc != EOK)
-		return rc;
-
-	info->ltype = linfo.ltype;
-	info->flags = linfo.flags;
-	info->ablock0 = linfo.ablock0;
-	info->anblocks = linfo.anblocks;
-	info->block_size = disk->block_size;
-	info->nblocks = disk->nblocks;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info - block_size=%zu",
-	    info->block_size);
-	return EOK;
-}
-
-errno_t vbds_get_parts(service_id_t sid, service_id_t *id_buf, size_t buf_size,
-    size_t *act_size)
-{
-	vbds_disk_t *disk;
-	size_t act_cnt;
-	size_t buf_cnt;
-	errno_t rc;
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK)
-		return rc;
-
-	buf_cnt = buf_size / sizeof(service_id_t);
-
-	act_cnt = list_count(&disk->parts);
-	*act_size = act_cnt * sizeof(service_id_t);
-
-	if (buf_size % sizeof(service_id_t) != 0)
-		return EINVAL;
-
-	size_t pos = 0;
-	list_foreach(disk->parts, ldisk, vbds_part_t, part) {
-		if (pos < buf_cnt)
-			id_buf[pos] = part->pid;
-		pos++;
-	}
-
-	return EOK;
-}
-
-errno_t vbds_label_create(service_id_t sid, label_type_t ltype)
-{
-	label_t *label;
-	label_bd_t lbd;
-	label_info_t linfo;
-	vbds_disk_t *disk;
-	errno_t rc, rc2;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu)", sid);
-
-	/* Find disk */
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu) - label_close", sid);
-
-	/* Verify that current label is a dummy label */
-	rc = label_get_info(disk->label, &linfo);
-	if (rc != EOK)
-		return rc;
-
-	if (linfo.ltype != lt_none) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Label already exists.");
-		return EEXIST;
-	}
-
-	/* Close dummy label first */
-	rc = vbds_disk_parts_remove(disk, vrf_none);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed removing disk.");
-		return rc;
-	}
-
-	label_close(disk->label);
-	disk->label = NULL;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu) - label_create", sid);
-
-	lbd.ops = &vbds_label_bd_ops;
-	lbd.arg = (void *) disk;
-
-	rc = label_create(&lbd, ltype, &label);
-	if (rc != EOK)
-		goto error;
-
-	(void) vbds_disk_parts_add(disk, label);
-	disk->label = label;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu) - success", sid);
-	return EOK;
-error:
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create(%zu) - failure", sid);
-	if (disk->label == NULL) {
-		lbd.ops = &vbds_label_bd_ops;
-		lbd.arg = (void *) disk;
-
-		rc2 = label_open(&lbd, &label);
-		if (rc2 != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to open label in disk %s.",
-			    disk->svc_name);
-			return rc2;
-		}
-
-		disk->label = label;
-		(void) vbds_disk_parts_add(disk, label);
-	}
-
-	return rc;
-}
-
-errno_t vbds_label_delete(service_id_t sid)
-{
-	vbds_disk_t *disk;
-	label_t *label;
-	label_bd_t lbd;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete(%zu)", sid);
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK)
-		return rc;
-
-	rc = vbds_disk_parts_remove(disk, vrf_none);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed deleting label.");
-		return rc;
-	}
-
-	rc = label_destroy(disk->label);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed deleting label.");
-		return rc;
-	}
-
-	disk->label = NULL;
-
-	lbd.ops = &vbds_label_bd_ops;
-	lbd.arg = (void *) disk;
-
-	rc = label_open(&lbd, &label);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to open label in disk %s.",
-		    disk->svc_name);
-		return EIO;
-	}
-
-	(void) vbds_disk_parts_add(disk, label);
-	disk->label = label;
-	return EOK;
-}
-
-errno_t vbds_part_get_info(vbds_part_id_t partid, vbd_part_info_t *pinfo)
-{
-	vbds_part_t *part;
-	label_part_info_t lpinfo;
-	errno_t rc;
-
-	rc = vbds_part_by_pid(partid, &part);
-	if (rc != EOK)
-		return rc;
-
-	fibril_rwlock_read_lock(&part->lock);
-	if (part->lpart == NULL) {
-		fibril_rwlock_read_unlock(&part->lock);
-		return ENOENT;
-	}
-
-	label_part_get_info(part->lpart, &lpinfo);
-
-	pinfo->index = lpinfo.index;
-	pinfo->pkind = lpinfo.pkind;
-	pinfo->block0 = lpinfo.block0;
-	pinfo->nblocks = lpinfo.nblocks;
-	pinfo->svc_id = part->svc_id;
-	vbds_part_del_ref(part);
-	fibril_rwlock_read_unlock(&part->lock);
-
-	return EOK;
-}
-
-errno_t vbds_part_create(service_id_t sid, vbd_part_spec_t *pspec,
-    vbds_part_id_t *rpart)
-{
-	vbds_disk_t *disk;
-	vbds_part_t *part;
-	label_part_spec_t lpspec;
-	label_part_t *lpart;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create(%zu)", sid);
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Disk %zu not found",
-		    sid);
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_crate(%zu): "
-	    "index=%d block0=%" PRIu64 " nblocks=%" PRIu64
-	    " hdr_blocks=%" PRIu64 " pkind=%d",
-	    sid, pspec->index, pspec->block0, pspec->nblocks, pspec->hdr_blocks,
-	    pspec->pkind);
-
-	label_pspec_init(&lpspec);
-	lpspec.index = pspec->index;
-	lpspec.block0 = pspec->block0;
-	lpspec.nblocks = pspec->nblocks;
-	lpspec.hdr_blocks = pspec->hdr_blocks;
-	lpspec.pkind = pspec->pkind;
-	lpspec.ptype = pspec->ptype;
-
-	rc = label_part_create(disk->label, &lpspec, &lpart);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating partition.");
-		goto error;
-	}
-
-	rc = label_part_empty(lpart);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error emptying partition.");
-		goto error;
-	}
-
-	rc = vbds_part_indices_update(disk);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error updating partition indices");
-		goto error;
-	}
-
-	rc = vbds_part_add(disk, lpart, &part);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed while creating "
-		    "partition.");
-		rc = label_part_destroy(lpart);
-		if (rc != EOK)
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "Cannot roll back partition creation.");
-		rc = EIO;
-		goto error;
-	}
-
-	if (rpart != NULL)
-		*rpart = part->pid;
-	return EOK;
-error:
-	return rc;
-}
-
-errno_t vbds_part_delete(vbds_part_id_t partid)
-{
-	vbds_part_t *part;
-	vbds_disk_t *disk;
-	label_part_t *lpart;
-	errno_t rc;
-
-	rc = vbds_part_by_pid(partid, &part);
-	if (rc != EOK)
-		return rc;
-
-	disk = part->disk;
-
-	rc = vbds_part_remove(part, vrf_none, &lpart);
-	if (rc != EOK)
-		return rc;
-
-	rc = label_part_destroy(lpart);
-	vbds_part_del_ref(part);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed deleting partition");
-
-		/* Try rolling back */
-		rc = vbds_part_add(disk, lpart, NULL);
-		if (rc != EOK)
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed rolling back.");
-
-		return EIO;
-	}
-
-	rc = vbds_part_indices_update(disk);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error updating partition indices");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-errno_t vbds_suggest_ptype(service_id_t sid, label_pcnt_t pcnt,
-    label_ptype_t *ptype)
-{
-	vbds_disk_t *disk;
-	errno_t rc;
-
-	rc = vbds_disk_by_svcid(sid, &disk);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Disk %zu not found",
-		    sid);
-		goto error;
-	}
-
-	rc = label_suggest_ptype(disk->label, pcnt, ptype);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "label_suggest_ptype() failed");
-		goto error;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-static errno_t vbds_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_open()");
-	fibril_rwlock_write_lock(&part->lock);
-	part->open_cnt++;
-	fibril_rwlock_write_unlock(&part->lock);
-	return EOK;
-}
-
-static errno_t vbds_bd_close(bd_srv_t *bd)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_close()");
-
-	/* Grabbing writer lock also forces all I/O to complete */
-
-	fibril_rwlock_write_lock(&part->lock);
-	part->open_cnt--;
-	fibril_rwlock_write_unlock(&part->lock);
-	return EOK;
-}
-
-static errno_t vbds_bd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    void *buf, size_t size)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-	aoff64_t gba;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_read_blocks()");
-	fibril_rwlock_read_lock(&part->lock);
-
-	if (cnt * part->disk->block_size < size) {
-		fibril_rwlock_read_unlock(&part->lock);
-		return EINVAL;
-	}
-
-	if (vbds_bsa_translate(part, ba, cnt, &gba) != EOK) {
-		fibril_rwlock_read_unlock(&part->lock);
-		return ELIMIT;
-	}
-
-	rc = block_read_direct(part->disk->svc_id, gba, cnt, buf);
-	fibril_rwlock_read_unlock(&part->lock);
-
-	return rc;
-}
-
-static errno_t vbds_bd_sync_cache(bd_srv_t *bd, aoff64_t ba, size_t cnt)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-	aoff64_t gba;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_sync_cache()");
-	fibril_rwlock_read_lock(&part->lock);
-
-	/* XXX Allow full-disk sync? */
-	if (ba != 0 || cnt != 0) {
-		if (vbds_bsa_translate(part, ba, cnt, &gba) != EOK) {
-			fibril_rwlock_read_unlock(&part->lock);
-			return ELIMIT;
-		}
-	} else {
-		gba = 0;
-	}
-
-	rc = block_sync_cache(part->disk->svc_id, gba, cnt);
-	fibril_rwlock_read_unlock(&part->lock);
-	return rc;
-}
-
-static errno_t vbds_bd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
-    const void *buf, size_t size)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-	aoff64_t gba;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_write_blocks()");
-	fibril_rwlock_read_lock(&part->lock);
-
-	if (cnt * part->disk->block_size < size) {
-		fibril_rwlock_read_unlock(&part->lock);
-		return EINVAL;
-	}
-
-	if (vbds_bsa_translate(part, ba, cnt, &gba) != EOK) {
-		fibril_rwlock_read_unlock(&part->lock);
-		return ELIMIT;
-	}
-
-	rc = block_write_direct(part->disk->svc_id, gba, cnt, buf);
-	fibril_rwlock_read_unlock(&part->lock);
-	return rc;
-}
-
-static errno_t vbds_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_get_block_size()");
-
-	fibril_rwlock_read_lock(&part->lock);
-	*rsize = part->disk->block_size;
-	fibril_rwlock_read_unlock(&part->lock);
-
-	return EOK;
-}
-
-static errno_t vbds_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "vbds_bd_get_num_blocks()");
-
-	fibril_rwlock_read_lock(&part->lock);
-	*rnb = part->nblocks;
-	fibril_rwlock_read_unlock(&part->lock);
-
-	return EOK;
-}
-
-static errno_t vbds_bd_eject(bd_srv_t *bd)
-{
-	vbds_part_t *part = bd_srv_part(bd);
-	async_sess_t *sess;
-	bd_t *bdc;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_eject()");
-
-	fibril_rwlock_read_lock(&part->lock);
-
-	sess = loc_service_connect(part->disk->svc_id, INTERFACE_BLOCK, 0);
-	if (sess == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN,
-		    "vbds_bd_eject() - failed connect");
-		fibril_rwlock_read_unlock(&part->lock);
-		return EIO;
-	}
-
-	rc = bd_open(sess, &bdc);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN,
-		    "vbds_bd_eject() - failed open");
-		async_hangup(sess);
-		fibril_rwlock_read_unlock(&part->lock);
-		return EIO;
-	}
-
-	rc = bd_eject(bdc);
-
-	bd_close(bdc);
-	async_hangup(sess);
-
-	fibril_rwlock_read_unlock(&part->lock);
-	return rc;
-}
-
-void vbds_bd_conn(ipc_call_t *icall, void *arg)
-{
-	vbds_part_t *part;
-	errno_t rc;
-	service_id_t svcid;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_conn()");
-
-	svcid = ipc_get_arg2(icall);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_conn() - svcid=%zu", svcid);
-
-	rc = vbds_part_by_svcid(svcid, &part);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vbd_bd_conn() - partition "
-		    "not found.");
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_bd_conn() - call bd_conn");
-	bd_conn(icall, &part->bds);
-	vbds_part_del_ref(part);
-}
-
-/** Translate block segment address with range checking. */
-static errno_t vbds_bsa_translate(vbds_part_t *part, aoff64_t ba, size_t cnt,
-    aoff64_t *gba)
-{
-	if (ba + cnt > part->nblocks)
-		return ELIMIT;
-
-	*gba = part->block0 + ba;
-	return EOK;
-}
-
-/** Register service for partition */
-static errno_t vbds_part_svc_register(vbds_part_t *part)
-{
-	char *name;
-	service_id_t psid;
-	int idx;
-	errno_t rc;
-
-	idx = part->lpart->index;
-
-	if (asprintf(&name, "%sp%u", part->disk->svc_name, idx) < 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-		return ENOMEM;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loc_service_register('%s')",
-	    name);
-	rc = loc_service_register(vbds_srv, name, &psid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering "
-		    "service %s: %s.", name, str_error(rc));
-		free(name);
-		free(part);
-		return EIO;
-	}
-
-	rc = loc_service_add_to_cat(vbds_srv, psid, part_cid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failled adding partition "
-		    "service %s to partition category.", name);
-		free(name);
-		free(part);
-
-		rc = loc_service_unregister(vbds_srv, psid);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error unregistering "
-			    "service. Rollback failed.");
-		}
-		return EIO;
-	}
-
-	free(name);
-	part->svc_id = psid;
-	part->reg_idx = idx;
-	return EOK;
-}
-
-/** Unregister service for partition */
-static errno_t vbds_part_svc_unregister(vbds_part_t *part)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_svc_unregister("
-	    "disk->svc_name='%s', id=%zu)", part->disk->svc_name, part->svc_id);
-
-	rc = loc_service_unregister(vbds_srv, part->svc_id);
-	if (rc != EOK)
-		return EIO;
-
-	part->svc_id = 0;
-	part->reg_idx = 0;
-	return EOK;
-}
-
-/** Update service names for any partition whose index has changed. */
-static errno_t vbds_part_indices_update(vbds_disk_t *disk)
-{
-	label_part_info_t lpinfo;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_indices_update()");
-
-	fibril_mutex_lock(&vbds_parts_lock);
-
-	/* First unregister services for partitions whose index has changed */
-	list_foreach(disk->parts, ldisk, vbds_part_t, part) {
-		fibril_rwlock_write_lock(&part->lock);
-		if (part->svc_id != 0 && part->lpart->index != part->reg_idx) {
-			rc = vbds_part_svc_unregister(part);
-			if (rc != EOK) {
-				fibril_rwlock_write_unlock(&part->lock);
-				fibril_mutex_unlock(&vbds_parts_lock);
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-				    "un-registering partition.");
-				return EIO;
-			}
-		}
-
-		fibril_rwlock_write_unlock(&part->lock);
-	}
-
-	/* Now re-register those services under the new indices */
-	list_foreach(disk->parts, ldisk, vbds_part_t, part) {
-		fibril_rwlock_write_lock(&part->lock);
-		label_part_get_info(part->lpart, &lpinfo);
-		if (part->svc_id == 0 && lpinfo.pkind != lpk_extended) {
-			rc = vbds_part_svc_register(part);
-			if (rc != EOK) {
-				fibril_rwlock_write_unlock(&part->lock);
-				fibril_mutex_unlock(&vbds_parts_lock);
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Error "
-				    "re-registering partition.");
-				return EIO;
-			}
-		}
-
-		fibril_rwlock_write_unlock(&part->lock);
-	}
-
-	fibril_mutex_unlock(&vbds_parts_lock);
-
-	return EOK;
-}
-
-/** Get block size wrapper for liblabel */
-static errno_t vbds_label_get_bsize(void *arg, size_t *bsize)
-{
-	vbds_disk_t *disk = (vbds_disk_t *)arg;
-	return block_get_bsize(disk->svc_id, bsize);
-}
-
-/** Get number of blocks wrapper for liblabel */
-static errno_t vbds_label_get_nblocks(void *arg, aoff64_t *nblocks)
-{
-	vbds_disk_t *disk = (vbds_disk_t *)arg;
-	return block_get_nblocks(disk->svc_id, nblocks);
-}
-
-/** Read blocks wrapper for liblabel */
-static errno_t vbds_label_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
-{
-	vbds_disk_t *disk = (vbds_disk_t *)arg;
-	return block_read_direct(disk->svc_id, ba, cnt, buf);
-}
-
-/** Write blocks wrapper for liblabel */
-static errno_t vbds_label_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
-{
-	vbds_disk_t *disk = (vbds_disk_t *)arg;
-	return block_write_direct(disk->svc_id, ba, cnt, data);
-}
-
-/** @}
- */
Index: pace/srv/bd/vbd/disk.h
===================================================================
--- uspace/srv/bd/vbd/disk.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,64 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vbd
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef DISK_H_
-#define DISK_H_
-
-#include <loc.h>
-#include "types/vbd.h"
-#include <vbd.h>
-
-extern errno_t vbds_disks_init(void);
-extern errno_t vbds_disk_discovery_start(void);
-extern errno_t vbds_disk_add(service_id_t);
-extern errno_t vbds_disk_remove(service_id_t);
-extern errno_t vbds_disk_get_ids(service_id_t *, size_t, size_t *);
-extern errno_t vbds_disk_info(service_id_t, vbd_disk_info_t *);
-extern errno_t vbds_get_parts(service_id_t, service_id_t *, size_t, size_t *);
-extern errno_t vbds_label_create(service_id_t, label_type_t);
-extern errno_t vbds_label_delete(service_id_t);
-extern errno_t vbds_part_get_info(vbds_part_id_t, vbd_part_info_t *);
-extern errno_t vbds_part_create(service_id_t, vbd_part_spec_t *, vbds_part_id_t *);
-extern errno_t vbds_part_delete(vbds_part_id_t);
-extern errno_t vbds_suggest_ptype(service_id_t, label_pcnt_t, label_ptype_t *);
-extern void vbds_bd_conn(ipc_call_t *, void *);
-
-extern loc_srv_t *vbds_srv;
-
-#endif
-
-/** @}
- */
Index: pace/srv/bd/vbd/doc/doxygroups.h
===================================================================
--- uspace/srv/bd/vbd/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup vbd vbd
- * @ingroup srvs
- * @brief Virtual block device service
- */
Index: pace/srv/bd/vbd/meson.build
===================================================================
--- uspace/srv/bd/vbd/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2015 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'label', 'block' ]
-src = files('disk.c', 'vbd.c')
Index: pace/srv/bd/vbd/types/vbd.h
===================================================================
--- uspace/srv/bd/vbd/types/vbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2016 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vbd
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef TYPES_VBDS_H_
-#define TYPES_VBDS_H_
-
-#include <adt/list.h>
-#include <bd_srv.h>
-#include <label/label.h>
-#include <loc.h>
-#include <refcount.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <types/label.h>
-
-typedef sysarg_t vbds_part_id_t;
-
-typedef enum {
-	/** No flags */
-	vrf_none = 0,
-	/** Force removal */
-	vrf_force = 0x1
-} vbds_rem_flag_t;
-
-/** Partition */
-typedef struct {
-	/** Reader held during I/O */
-	fibril_rwlock_t lock;
-	/** Disk this partition belongs to */
-	struct vbds_disk *disk;
-	/** Link to vbds_disk_t.parts */
-	link_t ldisk;
-	/** Link to vbds_parts */
-	link_t lparts;
-	/** Partition ID */
-	vbds_part_id_t pid;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Index under which partition is registered */
-	int reg_idx;
-	/** Label partition */
-	label_part_t *lpart;
-	/** Block device service */
-	bd_srvs_t bds;
-	/** Number of times the device is open */
-	int open_cnt;
-	/** Address of first block */
-	aoff64_t block0;
-	/** Number of blocks */
-	aoff64_t nblocks;
-	/** Reference count */
-	atomic_refcount_t refcnt;
-} vbds_part_t;
-
-/** Disk */
-typedef struct vbds_disk {
-	/** Link to vbds_disks */
-	link_t ldisks;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Disk service name */
-	char *svc_name;
-	/** Label */
-	label_t *label;
-	/** Partitions */
-	list_t parts; /* of vbds_part_t */
-	/** Block size */
-	size_t block_size;
-	/** Total number of blocks */
-	aoff64_t nblocks;
-	/** Used to mark disks still present during re-discovery */
-	bool present;
-} vbds_disk_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/bd/vbd/vbd.c
===================================================================
--- uspace/srv/bd/vbd/vbd.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,451 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vbd
- * @{
- */
-/**
- * @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <ipc/services.h>
-#include <ipc/vbd.h>
-#include <label/label.h>
-#include <loc.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include <vbd.h>
-
-#include "disk.h"
-#include "types/vbd.h"
-
-#define NAME  "vbd"
-
-static void vbds_client_conn(ipc_call_t *, void *);
-
-static service_id_t ctl_sid;
-
-static errno_t vbds_init(void)
-{
-	errno_t rc;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_init()");
-
-	rc = vbds_disks_init();
-	if (rc != EOK)
-		return rc;
-
-	async_set_fallback_port_handler(vbds_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &vbds_srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	rc = loc_service_register(vbds_srv, SERVICE_NAME_VBD, &ctl_sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	rc = vbds_disk_discovery_start();
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static void vbds_get_disks_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	service_id_t *id_buf = (service_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = vbds_disk_get_ids(id_buf, size, &act_size);
-	if (rc != EOK) {
-		free(id_buf);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void vbds_disk_info_srv(ipc_call_t *icall)
-{
-	service_id_t disk_sid;
-	vbd_disk_info_t dinfo;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_disk_info_srv()");
-
-	disk_sid = ipc_get_arg1(icall);
-	rc = vbds_disk_info(disk_sid, &dinfo);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(vbd_disk_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &dinfo,
-	    min(size, sizeof(dinfo)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void vbds_label_create_srv(ipc_call_t *icall)
-{
-	service_id_t disk_sid;
-	label_type_t ltype;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_create_srv()");
-
-	disk_sid = ipc_get_arg1(icall);
-	ltype = ipc_get_arg2(icall);
-	rc = vbds_label_create(disk_sid, ltype);
-	async_answer_0(icall, rc);
-}
-
-static void vbds_label_delete_srv(ipc_call_t *icall)
-{
-	service_id_t disk_sid;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_delete_srv()");
-
-	disk_sid = ipc_get_arg1(icall);
-	rc = vbds_label_delete(disk_sid);
-	async_answer_0(icall, rc);
-}
-
-static void vbds_label_get_parts_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	service_id_t sid;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_label_get_parts_srv()");
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	sid = ipc_get_arg1(icall);
-
-	category_id_t *id_buf = (category_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = vbds_get_parts(sid, id_buf, size, &act_size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void vbds_part_get_info_srv(ipc_call_t *icall)
-{
-	vbds_part_id_t part;
-	vbd_part_info_t pinfo;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_get_info_srv()");
-
-	part = ipc_get_arg1(icall);
-	rc = vbds_part_get_info(part, &pinfo);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(vbd_part_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &pinfo,
-	    min(size, sizeof(pinfo)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void vbds_part_create_srv(ipc_call_t *icall)
-{
-	service_id_t disk_sid;
-	vbd_part_spec_t pspec;
-	vbds_part_id_t part;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_create_srv()");
-
-	disk_sid = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(vbd_part_spec_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &pspec, sizeof(vbd_part_spec_t));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = vbds_part_create(disk_sid, &pspec, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_1(icall, rc, (sysarg_t)part);
-}
-
-static void vbds_part_delete_srv(ipc_call_t *icall)
-{
-	vbds_part_id_t part;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_part_delete_srv()");
-
-	part = ipc_get_arg1(icall);
-	rc = vbds_part_delete(part);
-	async_answer_0(icall, rc);
-}
-
-static void vbds_suggest_ptype_srv(ipc_call_t *icall)
-{
-	service_id_t disk_sid;
-	label_ptype_t ptype;
-	label_pcnt_t pcnt;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_suggest_ptype_srv()");
-
-	disk_sid = ipc_get_arg1(icall);
-	pcnt = ipc_get_arg2(icall);
-
-	rc = vbds_suggest_ptype(disk_sid, pcnt, &ptype);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(label_ptype_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &ptype, sizeof(label_ptype_t));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void vbds_ctl_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_client_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case VBD_GET_DISKS:
-			vbds_get_disks_srv(&call);
-			break;
-		case VBD_DISK_INFO:
-			vbds_disk_info_srv(&call);
-			break;
-		case VBD_LABEL_CREATE:
-			vbds_label_create_srv(&call);
-			break;
-		case VBD_LABEL_DELETE:
-			vbds_label_delete_srv(&call);
-			break;
-		case VBD_LABEL_GET_PARTS:
-			vbds_label_get_parts_srv(&call);
-			break;
-		case VBD_PART_GET_INFO:
-			vbds_part_get_info_srv(&call);
-			break;
-		case VBD_PART_CREATE:
-			vbds_part_create_srv(&call);
-			break;
-		case VBD_PART_DELETE:
-			vbds_part_delete_srv(&call);
-			break;
-		case VBD_SUGGEST_PTYPE:
-			vbds_suggest_ptype_srv(&call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-static void vbds_client_conn(ipc_call_t *icall, void *arg)
-{
-	service_id_t sid;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vbds_client_conn()");
-
-	sid = (service_id_t) ipc_get_arg2(icall);
-
-	if (sid == ctl_sid)
-		vbds_ctl_conn(icall, arg);
-	else
-		vbds_bd_conn(icall, arg);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("%s: Virtual Block Device service\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = vbds_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/clipboard/clip.h
===================================================================
--- uspace/srv/clipboard/clip.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CLIP_MAIN_H_
-#define CLIP_MAIN_H_
-
-#endif
Index: pace/srv/clipboard/clipboard.c
===================================================================
--- uspace/srv/clipboard/clipboard.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <fibril_synch.h>
-#include <ipc/services.h>
-#include <ipc/clipboard.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <task.h>
-
-#define NAME  "clipboard"
-
-static char *clip_data = NULL;
-static size_t clip_size = 0;
-static clipboard_tag_t clip_tag = CLIPBOARD_TAG_NONE;
-static FIBRIL_MUTEX_INITIALIZE(clip_mtx);
-static service_id_t svc_id;
-
-static void clip_put_data(ipc_call_t *req)
-{
-	char *data;
-	errno_t rc;
-	size_t size;
-
-	switch (ipc_get_arg1(req)) {
-	case CLIPBOARD_TAG_NONE:
-		fibril_mutex_lock(&clip_mtx);
-
-		if (clip_data)
-			free(clip_data);
-
-		clip_data = NULL;
-		clip_size = 0;
-		clip_tag = CLIPBOARD_TAG_NONE;
-
-		fibril_mutex_unlock(&clip_mtx);
-		async_answer_0(req, EOK);
-		break;
-	case CLIPBOARD_TAG_DATA:
-		rc = async_data_write_accept((void **) &data, false, 0, 0, 0, &size);
-		if (rc != EOK) {
-			async_answer_0(req, rc);
-			break;
-		}
-
-		fibril_mutex_lock(&clip_mtx);
-
-		if (clip_data)
-			free(clip_data);
-
-		clip_data = data;
-		clip_size = size;
-		clip_tag = CLIPBOARD_TAG_DATA;
-
-		fibril_mutex_unlock(&clip_mtx);
-		async_answer_0(req, EOK);
-		break;
-	default:
-		async_answer_0(req, EINVAL);
-	}
-}
-
-static void clip_get_data(ipc_call_t *req)
-{
-	fibril_mutex_lock(&clip_mtx);
-
-	ipc_call_t call;
-	size_t size;
-
-	/* Check for clipboard data tag compatibility */
-	switch (ipc_get_arg1(req)) {
-	case CLIPBOARD_TAG_DATA:
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EINVAL);
-			async_answer_0(req, EINVAL);
-			break;
-		}
-
-		if (clip_tag != CLIPBOARD_TAG_DATA) {
-			/* So far we only understand binary data */
-			async_answer_0(&call, EOVERFLOW);
-			async_answer_0(req, EOVERFLOW);
-			break;
-		}
-
-		if (clip_size != size) {
-			/* The client expects different size of data */
-			async_answer_0(&call, EOVERFLOW);
-			async_answer_0(req, EOVERFLOW);
-			break;
-		}
-
-		errno_t retval = async_data_read_finalize(&call, clip_data, size);
-		if (retval != EOK) {
-			async_answer_0(req, retval);
-			break;
-		}
-
-		async_answer_0(req, EOK);
-		break;
-	default:
-		/*
-		 * Sorry, we don't know how to get unknown or NONE
-		 * data from the clipbard
-		 */
-		async_answer_0(req, EINVAL);
-		break;
-	}
-
-	fibril_mutex_unlock(&clip_mtx);
-}
-
-static void clip_content(ipc_call_t *req)
-{
-	fibril_mutex_lock(&clip_mtx);
-
-	size_t size = clip_size;
-	clipboard_tag_t tag = clip_tag;
-
-	fibril_mutex_unlock(&clip_mtx);
-	async_answer_2(req, EOK, (sysarg_t) size, (sysarg_t) tag);
-}
-
-static void clip_connection(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case CLIPBOARD_PUT_DATA:
-			clip_put_data(&call);
-			break;
-		case CLIPBOARD_GET_DATA:
-			clip_get_data(&call);
-			break;
-		case CLIPBOARD_CONTENT:
-			clip_content(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOENT);
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	loc_srv_t *srv;
-
-	printf("%s: HelenOS clipboard service\n", NAME);
-	async_set_fallback_port_handler(clip_connection, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Failed registering server: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_CLIPBOARD, &svc_id);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-
-		printf("%s: Failed registering service : %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
Index: pace/srv/clipboard/meson.build
===================================================================
--- uspace/srv/clipboard/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'clipboard' ]
-src = files('clipboard.c')
Index: pace/srv/devman/client_conn.c
===================================================================
--- uspace/srv/devman/client_conn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,864 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup devman
- * @{
- */
-
-/** @file
- */
-
-#include <inttypes.h>
-#include <assert.h>
-#include <ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <ipc/devman.h>
-
-#include "client_conn.h"
-#include "dev.h"
-#include "devman.h"
-#include "driver.h"
-#include "fun.h"
-#include "loc.h"
-#include "main.h"
-
-/** Find handle for the device instance identified by the device's path in the
- * device tree.
- */
-static void devman_function_get_handle(ipc_call_t *icall)
-{
-	char *pathname;
-	devman_handle_t handle;
-
-	errno_t rc = async_data_write_accept((void **) &pathname, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fun_node_t *fun = find_fun_node_by_path(&device_tree, pathname);
-
-	free(pathname);
-
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-	handle = fun->handle;
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	/* Delete reference created above by find_fun_node_by_path() */
-	fun_del_ref(fun);
-
-	async_answer_1(icall, EOK, handle);
-}
-
-/** Get device match ID. */
-static void devman_fun_get_match_id(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-	size_t index = ipc_get_arg2(icall);
-	void *buffer = NULL;
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		fun_del_ref(fun);
-		return;
-	}
-
-	buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		fun_del_ref(fun);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED)
-		goto error;
-
-	link_t *link = list_nth(&fun->match_ids.ids, index);
-	if (link == NULL)
-		goto error;
-
-	match_id_t *mid = list_get_instance(link, match_id_t, link);
-
-	size_t sent_length = str_size(mid->id);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, mid->id, sent_length);
-	async_answer_1(icall, EOK, mid->score);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-	free(buffer);
-
-	return;
-error:
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	free(buffer);
-
-	async_answer_0(&data, ENOENT);
-	async_answer_0(icall, ENOENT);
-	fun_del_ref(fun);
-}
-
-/** Get device name. */
-static void devman_fun_get_name(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		fun_del_ref(fun);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		fun_del_ref(fun);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		free(buffer);
-
-		async_answer_0(&data, ENOENT);
-		async_answer_0(icall, ENOENT);
-		fun_del_ref(fun);
-		return;
-	}
-
-	size_t sent_length = str_size(fun->name);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, fun->name, sent_length);
-	async_answer_0(icall, EOK);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-	free(buffer);
-}
-
-/** Get function driver name. */
-static void devman_fun_get_driver_name(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		fun_del_ref(fun);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		fun_del_ref(fun);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		free(buffer);
-
-		async_answer_0(&data, ENOENT);
-		async_answer_0(icall, ENOENT);
-		fun_del_ref(fun);
-		return;
-	}
-
-	/* Check whether function has a driver */
-	if (fun->child == NULL || fun->child->drv == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		free(buffer);
-
-		async_answer_0(&data, EINVAL);
-		async_answer_0(icall, EINVAL);
-		fun_del_ref(fun);
-		return;
-	}
-
-	size_t sent_length = str_size(fun->child->drv->name);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, fun->child->drv->name,
-	    sent_length);
-	async_answer_0(icall, EOK);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-	free(buffer);
-}
-
-/** Get device path. */
-static void devman_fun_get_path(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		fun_del_ref(fun);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		fun_del_ref(fun);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		free(buffer);
-
-		async_answer_0(&data, ENOENT);
-		async_answer_0(icall, ENOENT);
-		fun_del_ref(fun);
-		return;
-	}
-
-	size_t sent_length = str_size(fun->pathname);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, fun->pathname, sent_length);
-	async_answer_0(icall, EOK);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-	free(buffer);
-}
-
-/** Get handle for parent function of a device. */
-static void devman_dev_get_parent(ipc_call_t *icall)
-{
-	dev_node_t *dev;
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	dev = find_dev_node_no_lock(&device_tree, ipc_get_arg1(icall));
-	if (dev == NULL || dev->state == DEVICE_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (dev->pfun == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	async_answer_1(icall, EOK, dev->pfun->handle);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-}
-
-static void devman_dev_get_functions(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	dev_node_t *dev = find_dev_node_no_lock(&device_tree,
-	    ipc_get_arg1(icall));
-	if (dev == NULL || dev->state == DEVICE_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size);
-	if (hdl_buf == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = dev_get_functions(&device_tree, dev, hdl_buf, size, &act_size);
-	if (rc != EOK) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	errno_t retval = async_data_read_finalize(&call, hdl_buf, size);
-	free(hdl_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-/** Get handle for child device of a function. */
-static void devman_fun_get_child(ipc_call_t *icall)
-{
-	fun_node_t *fun;
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	fun = find_fun_node_no_lock(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL || fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (fun->child == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	async_answer_1(icall, EOK, fun->child->handle);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-}
-
-/** Online function.
- *
- * Send a request to online a function to the responsible driver.
- * The driver may offline other functions if necessary (i.e. if the state
- * of this function is linked to state of another function somehow).
- */
-static void devman_fun_online(ipc_call_t *icall)
-{
-	fun_node_t *fun;
-	errno_t rc;
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = driver_fun_online(&device_tree, fun);
-	fun_del_ref(fun);
-
-	async_answer_0(icall, rc);
-}
-
-/** Offline function.
- *
- * Send a request to offline a function to the responsible driver. As
- * a result the subtree rooted at that function should be cleanly
- * detatched. The driver may offline other functions if necessary
- * (i.e. if the state of this function is linked to state of another
- * function somehow).
- */
-static void devman_fun_offline(ipc_call_t *icall)
-{
-	fun_node_t *fun;
-	errno_t rc;
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = driver_fun_offline(&device_tree, fun);
-	fun_del_ref(fun);
-
-	async_answer_0(icall, rc);
-}
-
-/** Quiesce function.
- *
- * Send a request to quiesce a function to the responsible driver.
- */
-static void devman_fun_quiesce(ipc_call_t *icall)
-{
-	fun_node_t *fun;
-	dev_node_t *child;
-	errno_t rc;
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	child = fun->child;
-	dev_add_ref(child);
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	rc = driver_dev_quiesce(&device_tree, child);
-	fun_del_ref(fun);
-
-	async_answer_0(icall, rc);
-}
-
-/** Find handle for the function instance identified by its service ID. */
-static void devman_fun_sid_to_handle(ipc_call_t *icall)
-{
-	fun_node_t *fun;
-
-	fun = find_loc_tree_function(&device_tree, ipc_get_arg1(icall));
-
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	async_answer_1(icall, EOK, fun->handle);
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-}
-
-/** Get list of all registered drivers. */
-static void devman_get_drivers(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size);
-	if (hdl_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = driver_get_list(&drivers_list, hdl_buf, size, &act_size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, hdl_buf, size);
-	free(hdl_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void devman_driver_get_devices(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	driver_t *drv = driver_find(&drivers_list, ipc_get_arg1(icall));
-	if (drv == NULL) {
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	devman_handle_t *hdl_buf = (devman_handle_t *) malloc(size);
-	if (hdl_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = driver_get_devices(drv, hdl_buf, size, &act_size);
-	if (rc != EOK) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, hdl_buf, size);
-	free(hdl_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-/** Find driver by name. */
-static void devman_driver_get_handle(ipc_call_t *icall)
-{
-	char *drvname;
-
-	errno_t rc = async_data_write_accept((void **) &drvname, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	driver_t *driver = driver_find_by_name(&drivers_list, drvname);
-
-	free(drvname);
-
-	if (driver == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	async_answer_1(icall, EOK, driver->handle);
-}
-
-/** Get driver match ID. */
-static void devman_driver_get_match_id(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-	size_t index = ipc_get_arg2(icall);
-
-	driver_t *drv = driver_find(&drivers_list, handle);
-	if (drv == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	link_t *link = list_nth(&drv->match_ids.ids, index);
-	if (link == NULL) {
-		fibril_mutex_unlock(&drv->driver_mutex);
-		free(buffer);
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	match_id_t *mid = list_get_instance(link, match_id_t, link);
-
-	size_t sent_length = str_size(mid->id);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, mid->id, sent_length);
-	async_answer_1(icall, EOK, mid->score);
-
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	free(buffer);
-}
-
-/** Get driver name. */
-static void devman_driver_get_name(ipc_call_t *icall)
-{
-	devman_handle_t handle = ipc_get_arg1(icall);
-
-	driver_t *drv = driver_find(&drivers_list, handle);
-	if (drv == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	ipc_call_t data;
-	size_t data_len;
-	if (!async_data_read_receive(&data, &data_len)) {
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	void *buffer = malloc(data_len);
-	if (buffer == NULL) {
-		async_answer_0(&data, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	fibril_mutex_lock(&drv->driver_mutex);
-
-	size_t sent_length = str_size(drv->name);
-	if (sent_length > data_len) {
-		sent_length = data_len;
-	}
-
-	async_data_read_finalize(&data, drv->name, sent_length);
-	async_answer_0(icall, EOK);
-
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	free(buffer);
-}
-
-/** Get driver state. */
-static void devman_driver_get_state(ipc_call_t *icall)
-{
-	driver_t *drv;
-
-	drv = driver_find(&drivers_list, ipc_get_arg1(icall));
-	if (drv == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	async_answer_1(icall, EOK, (sysarg_t) drv->state);
-}
-
-/** Forcibly load a driver. */
-static void devman_driver_load(ipc_call_t *icall)
-{
-	driver_t *drv;
-	errno_t rc;
-
-	drv = driver_find(&drivers_list, ipc_get_arg1(icall));
-	if (drv == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	rc = start_driver(drv) ? EOK : EIO;
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	async_answer_0(icall, rc);
-}
-
-/** Unload a driver by user request. */
-static void devman_driver_unload(ipc_call_t *icall)
-{
-	driver_t *drv;
-	errno_t rc;
-
-	drv = driver_find(&drivers_list, ipc_get_arg1(icall));
-	if (drv == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	rc = stop_driver(drv);
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	async_answer_0(icall, rc);
-}
-
-/** Function for handling connections from a client to the device manager. */
-void devman_connection_client(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection. */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case DEVMAN_DEVICE_GET_HANDLE:
-			devman_function_get_handle(&call);
-			break;
-		case DEVMAN_DEV_GET_PARENT:
-			devman_dev_get_parent(&call);
-			break;
-		case DEVMAN_DEV_GET_FUNCTIONS:
-			devman_dev_get_functions(&call);
-			break;
-		case DEVMAN_FUN_GET_CHILD:
-			devman_fun_get_child(&call);
-			break;
-		case DEVMAN_FUN_GET_MATCH_ID:
-			devman_fun_get_match_id(&call);
-			break;
-		case DEVMAN_FUN_GET_NAME:
-			devman_fun_get_name(&call);
-			break;
-		case DEVMAN_FUN_GET_DRIVER_NAME:
-			devman_fun_get_driver_name(&call);
-			break;
-		case DEVMAN_FUN_GET_PATH:
-			devman_fun_get_path(&call);
-			break;
-		case DEVMAN_FUN_ONLINE:
-			devman_fun_online(&call);
-			break;
-		case DEVMAN_FUN_OFFLINE:
-			devman_fun_offline(&call);
-			break;
-		case DEVMAN_FUN_QUIESCE:
-			devman_fun_quiesce(&call);
-			break;
-		case DEVMAN_FUN_SID_TO_HANDLE:
-			devman_fun_sid_to_handle(&call);
-			break;
-		case DEVMAN_GET_DRIVERS:
-			devman_get_drivers(&call);
-			break;
-		case DEVMAN_DRIVER_GET_DEVICES:
-			devman_driver_get_devices(&call);
-			break;
-		case DEVMAN_DRIVER_GET_HANDLE:
-			devman_driver_get_handle(&call);
-			break;
-		case DEVMAN_DRIVER_GET_MATCH_ID:
-			devman_driver_get_match_id(&call);
-			break;
-		case DEVMAN_DRIVER_GET_NAME:
-			devman_driver_get_name(&call);
-			break;
-		case DEVMAN_DRIVER_GET_STATE:
-			devman_driver_get_state(&call);
-			break;
-		case DEVMAN_DRIVER_LOAD:
-			devman_driver_load(&call);
-			break;
-		case DEVMAN_DRIVER_UNLOAD:
-			devman_driver_unload(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOENT);
-		}
-	}
-}
-
-/** @}
- */
Index: pace/srv/devman/client_conn.h
===================================================================
--- uspace/srv/devman/client_conn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef CLIENT_CONN_H_
-#define CLIENT_CONN_H_
-
-#include "devman.h"
-
-extern void devman_connection_client(ipc_call_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/dev.c
===================================================================
--- uspace/srv/devman/dev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,173 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <errno.h>
-
-#include "dev.h"
-#include "devman.h"
-
-/** Create a new device node.
- *
- * @return		A device node structure.
- */
-dev_node_t *create_dev_node(void)
-{
-	dev_node_t *dev;
-
-	dev = calloc(1, sizeof(dev_node_t));
-	if (dev == NULL)
-		return NULL;
-
-	refcount_init(&dev->refcnt);
-	list_initialize(&dev->functions);
-	fibril_mutex_initialize(&dev->state_lock);
-	fibril_condvar_initialize(&dev->state_cv);
-	link_initialize(&dev->driver_devices);
-
-	return dev;
-}
-
-/** Delete a device node.
- *
- * @param node		The device node structure.
- */
-void delete_dev_node(dev_node_t *dev)
-{
-	assert(list_empty(&dev->functions));
-	assert(dev->pfun == NULL);
-	assert(dev->drv == NULL);
-
-	free(dev);
-}
-
-/** Increase device node reference count.
- *
- * @param dev	Device node
- */
-void dev_add_ref(dev_node_t *dev)
-{
-	refcount_up(&dev->refcnt);
-}
-
-/** Decrease device node reference count.
- *
- * When the count drops to zero the device node is freed.
- *
- * @param dev	Device node
- */
-void dev_del_ref(dev_node_t *dev)
-{
-	if (refcount_down(&dev->refcnt))
-		delete_dev_node(dev);
-}
-
-/** Wait until the device node enters stable state.
- *
- * @param dev Device node
- */
-void dev_wait_stable(dev_node_t *dev)
-{
-	fibril_mutex_lock(&dev->state_lock);
-	while (dev->state == DEVICE_ATTACHING)
-		fibril_condvar_wait(&dev->state_cv, &dev->state_lock);
-	fibril_mutex_unlock(&dev->state_lock);
-}
-
-/** Find the device node structure of the device witch has the specified handle.
- *
- * @param tree		The device tree where we look for the device node.
- * @param handle	The handle of the device.
- * @return		The device node.
- */
-dev_node_t *find_dev_node_no_lock(dev_tree_t *tree, devman_handle_t handle)
-{
-	assert(fibril_rwlock_is_locked(&tree->rwlock));
-
-	ht_link_t *link = hash_table_find(&tree->devman_devices, &handle);
-	if (link == NULL)
-		return NULL;
-
-	return hash_table_get_inst(link, dev_node_t, devman_dev);
-}
-
-/** Find the device node structure of the device witch has the specified handle.
- *
- * @param tree		The device tree where we look for the device node.
- * @param handle	The handle of the device.
- * @return		The device node.
- */
-dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle)
-{
-	dev_node_t *dev = NULL;
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	dev = find_dev_node_no_lock(tree, handle);
-	if (dev != NULL)
-		dev_add_ref(dev);
-
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	return dev;
-}
-
-/** Get list of device functions. */
-errno_t dev_get_functions(dev_tree_t *tree, dev_node_t *dev,
-    devman_handle_t *hdl_buf, size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	assert(fibril_rwlock_is_locked(&tree->rwlock));
-
-	buf_cnt = buf_size / sizeof(devman_handle_t);
-
-	act_cnt = list_count(&dev->functions);
-	*act_size = act_cnt * sizeof(devman_handle_t);
-
-	if (buf_size % sizeof(devman_handle_t) != 0)
-		return EINVAL;
-
-	size_t pos = 0;
-	list_foreach(dev->functions, dev_functions, fun_node_t, fun) {
-		if (pos < buf_cnt) {
-			hdl_buf[pos] = fun->handle;
-		}
-
-		pos++;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/devman/dev.h
===================================================================
--- uspace/srv/devman/dev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DEV_H_
-#define DEV_H_
-
-#include "devman.h"
-
-extern dev_node_t *create_dev_node(void);
-extern void delete_dev_node(dev_node_t *node);
-extern void dev_add_ref(dev_node_t *);
-extern void dev_del_ref(dev_node_t *);
-extern void dev_wait_stable(dev_node_t *);
-
-extern dev_node_t *find_dev_node_no_lock(dev_tree_t *tree,
-    devman_handle_t handle);
-extern dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle);
-extern errno_t dev_get_functions(dev_tree_t *tree, dev_node_t *, devman_handle_t *,
-    size_t, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,233 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DEVMAN_H_
-#define DEVMAN_H_
-
-#include <stdbool.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <ipc/devman.h>
-#include <ipc/loc.h>
-#include <fibril_synch.h>
-#include <refcount.h>
-#include <async.h>
-
-#include "util.h"
-
-#define NAME "devman"
-
-#define LOC_DEVICE_NAMESPACE "devices"
-#define LOC_SEPARATOR '\\'
-
-struct dev_node;
-typedef struct dev_node dev_node_t;
-
-struct fun_node;
-typedef struct fun_node fun_node_t;
-
-typedef struct {
-	fibril_mutex_t mutex;
-	struct driver *driver;
-} client_t;
-
-/** Representation of device driver. */
-typedef struct driver {
-	/** Pointers to previous and next drivers in a linked list. */
-	link_t drivers;
-	/** Handle */
-	devman_handle_t handle;
-
-	/**
-	 * Specifies whether the driver has been started and wheter is running
-	 * and prepared to receive requests.
-	 */
-	driver_state_t state;
-
-	/** Session asociated with this driver. */
-	async_sess_t *sess;
-	/** Name of the device driver. */
-	char *name;
-	/** Path to the driver's binary. */
-	char *binary_path;
-	/** List of device ids for device-to-driver matching. */
-	match_id_list_t match_ids;
-	/** List of devices controlled by this driver. */
-	list_t devices;
-
-	/**
-	 * Fibril mutex for this driver - driver state, list of devices, session.
-	 */
-	fibril_mutex_t driver_mutex;
-} driver_t;
-
-/** The list of drivers. */
-typedef struct driver_list {
-	/** List of drivers */
-	list_t drivers;
-	/** Fibril mutex for list of drivers. */
-	fibril_mutex_t drivers_mutex;
-	/** Next free handle */
-	devman_handle_t next_handle;
-} driver_list_t;
-
-/** Device state */
-typedef enum {
-	DEVICE_NOT_INITIALIZED = 0,
-	DEVICE_ATTACHING,
-	DEVICE_USABLE,
-	DEVICE_NOT_PRESENT,
-	DEVICE_INVALID,
-	/** Device node has been removed from the tree */
-	DEVICE_REMOVED
-} device_state_t;
-
-/** Device node in the device tree. */
-struct dev_node {
-	/** Reference count */
-	atomic_refcount_t refcnt;
-
-	/** The global unique identifier of the device. */
-	devman_handle_t handle;
-
-	/** (Parent) function the device is attached to. */
-	fun_node_t *pfun;
-
-	/** List of device functions. */
-	list_t functions;
-	/** Driver of this device. */
-	driver_t *drv;
-	/** The state of the device. */
-	device_state_t state;
-	/** Protect device state field */
-	fibril_mutex_t state_lock;
-	/** Signalled when device state changes */
-	fibril_condvar_t state_cv;
-	/** Link to list of devices owned by driver (driver_t.devices) */
-	link_t driver_devices;
-
-	/**
-	 * Used by the hash table of devices indexed by devman device handles.
-	 */
-	ht_link_t devman_dev;
-
-	/**
-	 * Whether this device was already passed to the driver.
-	 */
-	bool passed_to_driver;
-};
-
-/** Function state */
-typedef enum {
-	FUN_INIT = 0,
-	FUN_OFF_LINE,
-	FUN_ON_LINE,
-	/** Function node has been removed from the tree */
-	FUN_REMOVED
-} fun_state_t;
-
-/** Function node in the device tree. */
-struct fun_node {
-	/** Reference count */
-	atomic_refcount_t refcnt;
-	/** State */
-	fun_state_t state;
-	/** Locked while performing reconfiguration operations */
-	fibril_mutex_t busy_lock;
-
-	/** The global unique identifier of the function */
-	devman_handle_t handle;
-	/** Name of the function, assigned by the device driver */
-	char *name;
-	/** Function type */
-	fun_type_t ftype;
-
-	/** Full path and name of the device in device hierarchy */
-	char *pathname;
-
-	/** Device which this function belongs to */
-	dev_node_t *dev;
-
-	/** Link to list of functions in the device (ddf_dev_t.functions) */
-	link_t dev_functions;
-
-	/** Child device node (if any attached). */
-	dev_node_t *child;
-	/** List of device ids for device-to-driver matching. */
-	match_id_list_t match_ids;
-
-	/** Service ID if the device function is registered with loc. */
-	service_id_t service_id;
-
-	/**
-	 * Used by the hash table of functions indexed by devman device handles.
-	 */
-	ht_link_t devman_fun;
-
-	/**
-	 * Used by the hash table of functions indexed by service IDs.
-	 */
-	ht_link_t loc_fun;
-};
-
-/** Represents device tree. */
-typedef struct dev_tree {
-	/** Root device node. */
-	fun_node_t *root_node;
-
-	/**
-	 * The next available handle - handles are assigned in a sequential
-	 * manner.
-	 */
-	devman_handle_t current_handle;
-
-	/** Synchronize access to the device tree. */
-	fibril_rwlock_t rwlock;
-
-	/** Hash table of all devices indexed by devman handles. */
-	hash_table_t devman_devices;
-
-	/** Hash table of all devices indexed by devman handles. */
-	hash_table_t devman_functions;
-
-	/**
-	 * Hash table of services registered with location service, indexed by
-	 * service IDs.
-	 */
-	hash_table_t loc_functions;
-} dev_tree_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/devtree.c
===================================================================
--- uspace/srv/devman/devtree.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,329 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <io/log.h>
-
-#include "dev.h"
-#include "devtree.h"
-#include "devman.h"
-#include "driver.h"
-#include "fun.h"
-
-/* hash table operations */
-
-static inline size_t handle_key_hash(const void *key)
-{
-	const devman_handle_t *handle = key;
-	return *handle;
-}
-
-static size_t devman_devices_hash(const ht_link_t *item)
-{
-	dev_node_t *dev = hash_table_get_inst(item, dev_node_t, devman_dev);
-	return handle_key_hash(&dev->handle);
-}
-
-static size_t devman_functions_hash(const ht_link_t *item)
-{
-	fun_node_t *fun = hash_table_get_inst(item, fun_node_t, devman_fun);
-	return handle_key_hash(&fun->handle);
-}
-
-static bool devman_devices_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const devman_handle_t *handle = key;
-	dev_node_t *dev = hash_table_get_inst(item, dev_node_t, devman_dev);
-	return dev->handle == *handle;
-}
-
-static bool devman_functions_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const devman_handle_t *handle = key;
-	fun_node_t *fun = hash_table_get_inst(item, fun_node_t, devman_fun);
-	return fun->handle == *handle;
-}
-
-static inline size_t service_id_key_hash(const void *key)
-{
-	const service_id_t *service_id = key;
-	return *service_id;
-}
-
-static size_t loc_functions_hash(const ht_link_t *item)
-{
-	fun_node_t *fun = hash_table_get_inst(item, fun_node_t, loc_fun);
-	return service_id_key_hash(&fun->service_id);
-}
-
-static bool loc_functions_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const service_id_t *service_id = key;
-	fun_node_t *fun = hash_table_get_inst(item, fun_node_t, loc_fun);
-	return fun->service_id == *service_id;
-}
-
-static const hash_table_ops_t devman_devices_ops = {
-	.hash = devman_devices_hash,
-	.key_hash = handle_key_hash,
-	.key_equal = devman_devices_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static const hash_table_ops_t devman_functions_ops = {
-	.hash = devman_functions_hash,
-	.key_hash = handle_key_hash,
-	.key_equal = devman_functions_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static const hash_table_ops_t loc_devices_ops = {
-	.hash = loc_functions_hash,
-	.key_hash = service_id_key_hash,
-	.key_equal = loc_functions_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-/** Create root device and function node in the device tree.
- *
- * @param tree	The device tree.
- * @return	True on success, false otherwise.
- */
-bool create_root_nodes(dev_tree_t *tree)
-{
-	fun_node_t *fun;
-	dev_node_t *dev;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "create_root_nodes()");
-
-	fibril_rwlock_write_lock(&tree->rwlock);
-
-	/*
-	 * Create root function. This is a pseudo function to which
-	 * the root device node is attached. It allows us to match
-	 * the root device driver in a standard manner, i.e. against
-	 * the parent function.
-	 */
-
-	fun = create_fun_node();
-	if (fun == NULL) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		return false;
-	}
-
-	if (!insert_fun_node(tree, fun, str_dup(""), NULL)) {
-		fun_del_ref(fun);	/* fun is destroyed */
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		return false;
-	}
-
-	match_id_t *id = create_match_id();
-	id->id = str_dup("root");
-	id->score = 100;
-	add_match_id(&fun->match_ids, id);
-	tree->root_node = fun;
-
-	/*
-	 * Create root device node.
-	 */
-	dev = create_dev_node();
-	if (dev == NULL) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		return false;
-	}
-
-	insert_dev_node(tree, dev, fun);
-
-	fibril_rwlock_write_unlock(&tree->rwlock);
-
-	return dev != NULL;
-}
-
-/** Initialize the device tree.
- *
- * Create root device node of the tree and assign driver to it.
- *
- * @param tree		The device tree.
- * @param drivers_list	the list of available drivers.
- * @return		True on success, false otherwise.
- */
-bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "init_device_tree()");
-
-	tree->current_handle = 0;
-
-	hash_table_create(&tree->devman_devices, 0, 0, &devman_devices_ops);
-	hash_table_create(&tree->devman_functions, 0, 0, &devman_functions_ops);
-	hash_table_create(&tree->loc_functions, 0, 0, &loc_devices_ops);
-
-	fibril_rwlock_initialize(&tree->rwlock);
-
-	/* Create root function and root device and add them to the device tree. */
-	if (!create_root_nodes(tree))
-		return false;
-
-	/* Find suitable driver and start it. */
-	dev_node_t *rdev = tree->root_node->child;
-	dev_add_ref(rdev);
-	bool rc = assign_driver(rdev, drivers_list, tree);
-	dev_del_ref(rdev);
-
-	return rc;
-}
-
-/** Insert new device into device tree.
- *
- * @param tree		The device tree.
- * @param dev		The newly added device node.
- * @param pfun		The parent function node.
- *
- * @return		True on success, false otherwise (insufficient resources
- *			etc.).
- */
-bool insert_dev_node(dev_tree_t *tree, dev_node_t *dev, fun_node_t *pfun)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "insert_dev_node(dev=%p, pfun=%p [\"%s\"])",
-	    dev, pfun, pfun->pathname);
-
-	/* Add the node to the handle-to-node map. */
-	dev->handle = ++tree->current_handle;
-	hash_table_insert(&tree->devman_devices, &dev->devman_dev);
-
-	/* Add the node to the list of its parent's children. */
-	dev->pfun = pfun;
-	pfun->child = dev;
-
-	return true;
-}
-
-/** Remove device from device tree.
- *
- * @param tree		Device tree
- * @param dev		Device node
- */
-void remove_dev_node(dev_tree_t *tree, dev_node_t *dev)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "remove_dev_node(dev=%p)", dev);
-
-	/* Remove node from the handle-to-node map. */
-	hash_table_remove(&tree->devman_devices, &dev->handle);
-
-	/* Unlink from parent function. */
-	dev->pfun->child = NULL;
-	dev->pfun = NULL;
-
-	dev->state = DEVICE_REMOVED;
-}
-
-/** Insert new function into device tree.
- *
- * @param tree		The device tree.
- * @param fun		The newly added function node.
- * @param fun_name	The name of the newly added function.
- * @param dev		Owning device node.
- *
- * @return		True on success, false otherwise (insufficient resources
- *			etc.).
- */
-bool insert_fun_node(dev_tree_t *tree, fun_node_t *fun, char *fun_name,
-    dev_node_t *dev)
-{
-	fun_node_t *pfun;
-
-	assert(fun_name != NULL);
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	/*
-	 * The root function is a special case, it does not belong to any
-	 * device so for the root function dev == NULL.
-	 */
-	pfun = (dev != NULL) ? dev->pfun : NULL;
-
-	fun->name = fun_name;
-	if (!set_fun_path(tree, fun, pfun)) {
-		return false;
-	}
-
-	/* Add the node to the handle-to-node map. */
-	fun->handle = ++tree->current_handle;
-	hash_table_insert(&tree->devman_functions, &fun->devman_fun);
-
-	/* Add the node to the list of its parent's children. */
-	fun->dev = dev;
-	if (dev != NULL)
-		list_append(&fun->dev_functions, &dev->functions);
-
-	return true;
-}
-
-/** Remove function from device tree.
- *
- * @param tree		Device tree
- * @param node		Function node to remove
- */
-void remove_fun_node(dev_tree_t *tree, fun_node_t *fun)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	/* Remove the node from the handle-to-node map. */
-	hash_table_remove(&tree->devman_functions, &fun->handle);
-
-	/* Remove the node from the list of its parent's children. */
-	if (fun->dev != NULL)
-		list_remove(&fun->dev_functions);
-
-	fun->dev = NULL;
-	fun->state = FUN_REMOVED;
-}
-
-/** Wait for device tree to stabilize.
- *
- * Blocks until the entire device tree had a chance to finish attaching
- * all devices.
- *
- * @param tree Device tree
- */
-void dev_tree_wait_stable(dev_tree_t *tree)
-{
-	dev_wait_stable(tree->root_node->child);
-}
-
-/** @}
- */
Index: pace/srv/devman/devtree.h
===================================================================
--- uspace/srv/devman/devtree.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DEVTREE_H_
-#define DEVTREE_H_
-
-#include <stdbool.h>
-
-#include "devman.h"
-
-extern bool init_device_tree(dev_tree_t *, driver_list_t *);
-extern bool create_root_nodes(dev_tree_t *);
-extern bool insert_dev_node(dev_tree_t *, dev_node_t *, fun_node_t *);
-extern void remove_dev_node(dev_tree_t *, dev_node_t *);
-extern bool insert_fun_node(dev_tree_t *, fun_node_t *, char *, dev_node_t *);
-extern void remove_fun_node(dev_tree_t *, fun_node_t *);
-extern void dev_tree_wait_stable(dev_tree_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/doc/doxygroups.h
===================================================================
--- uspace/srv/devman/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup devman devman
- * @ingroup srvs
- * @brief Device manager
- */
Index: pace/srv/devman/driver.c
===================================================================
--- uspace/srv/devman/driver.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,924 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <dirent.h>
-#include <errno.h>
-#include <io/log.h>
-#include <vfs/vfs.h>
-#include <loc.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <task.h>
-
-#include "dev.h"
-#include "devman.h"
-#include "driver.h"
-#include "fun.h"
-#include "match.h"
-#include "main.h"
-
-static errno_t driver_reassign_fibril(void *);
-
-/**
- * Initialize the list of device driver's.
- *
- * @param drv_list the list of device driver's.
- *
- */
-void init_driver_list(driver_list_t *drv_list)
-{
-	assert(drv_list != NULL);
-
-	list_initialize(&drv_list->drivers);
-	fibril_mutex_initialize(&drv_list->drivers_mutex);
-	drv_list->next_handle = 1;
-}
-
-/** Allocate and initialize a new driver structure.
- *
- * @return	Driver structure.
- */
-driver_t *create_driver(void)
-{
-	driver_t *res = malloc(sizeof(driver_t));
-	if (res != NULL)
-		init_driver(res);
-	return res;
-}
-
-/** Add a driver to the list of drivers.
- *
- * @param drivers_list	List of drivers.
- * @param drv		Driver structure.
- */
-void add_driver(driver_list_t *drivers_list, driver_t *drv)
-{
-	fibril_mutex_lock(&drivers_list->drivers_mutex);
-	list_append(&drv->drivers, &drivers_list->drivers);
-	drv->handle = drivers_list->next_handle++;
-	fibril_mutex_unlock(&drivers_list->drivers_mutex);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' was added to the list of available "
-	    "drivers.", drv->name);
-}
-
-/**
- * Get information about a driver.
- *
- * Each driver has its own directory in the base directory.
- * The name of the driver's directory is the same as the name of the driver.
- * The driver's directory contains driver's binary (named as the driver without
- * extension) and the configuration file with match ids for device-to-driver
- *  matching (named as the driver with a special extension).
- *
- * This function searches for the driver's directory and containing
- * configuration files. If all the files needed are found, they are parsed and
- * the information about the driver is stored in the driver's structure.
- *
- * @param base_path	The base directory, in which we look for driver's
- *			subdirectory.
- * @param name		The name of the driver.
- * @param drv		The driver structure to fill information in.
- *
- * @return		True on success, false otherwise.
- */
-bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
-	    base_path, name);
-
-	assert(base_path != NULL && name != NULL && drv != NULL);
-
-	bool suc = false;
-	char *match_path = NULL;
-	size_t name_size = 0;
-
-	/* Read the list of match ids from the driver's configuration file. */
-	match_path = get_abs_path(base_path, name, MATCH_EXT);
-	if (match_path == NULL)
-		goto cleanup;
-
-	if (!read_match_ids(match_path, &drv->match_ids))
-		goto cleanup;
-
-	/* Allocate and fill driver's name. */
-	name_size = str_size(name) + 1;
-	drv->name = malloc(name_size);
-	if (drv->name == NULL)
-		goto cleanup;
-	str_cpy(drv->name, name_size, name);
-
-	/* Initialize path with driver's binary. */
-	drv->binary_path = get_abs_path(base_path, name, "");
-	if (drv->binary_path == NULL)
-		goto cleanup;
-
-	/* Check whether the driver's binary exists. */
-	vfs_stat_t s;
-	if (vfs_stat_path(drv->binary_path, &s) != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Driver not found at path `%s'.",
-		    drv->binary_path);
-		goto cleanup;
-	}
-
-	suc = true;
-
-cleanup:
-	if (!suc) {
-		free(drv->binary_path);
-		free(drv->name);
-		/* Set the driver structure to the default state. */
-		init_driver(drv);
-	}
-
-	free(match_path);
-
-	return suc;
-}
-
-/** Lookup drivers in the directory.
- *
- * @param drivers_list	The list of available drivers.
- * @param dir_path	The path to the directory where we search for drivers.
- * @return		Number of drivers which were found.
- */
-int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
-
-	int drv_cnt = 0;
-	DIR *dir = NULL;
-	struct dirent *diren;
-
-	dir = opendir(dir_path);
-
-	if (dir != NULL) {
-		driver_t *drv = create_driver();
-		while ((diren = readdir(dir))) {
-			if (get_driver_info(dir_path, diren->d_name, drv)) {
-				add_driver(drivers_list, drv);
-				drv_cnt++;
-				drv = create_driver();
-			}
-		}
-		delete_driver(drv);
-		closedir(dir);
-	}
-
-	return drv_cnt;
-}
-
-/** Lookup the next best matching driver for a device.
- *
- * A match between a device and a driver is found if one of the driver's match
- * ids match one of the device's match ids. The score of the match is the
- * product of the driver's and device's score associated with the matching id.
- * The best matching driver for a device is the driver with the highest score
- * of the match between the device and the driver.
- *
- * If a driver is already assigned to the device (node->drv != NULL),
- * we look for the next best driver. That is either the next driver with the
- * same score in the list of drivers, or a driver with the next best score
- * (greater than zero).
- *
- * @param drivers_list	The list of drivers, where we look for the driver
- *			suitable for handling the device.
- * @param node		The device node structure of the device.
- * @return		The best matching driver or NULL if no matching driver
- *			is found.
- */
-driver_t *find_best_match_driver(driver_list_t *drivers_list, dev_node_t *node)
-{
-	driver_t *best_drv = NULL;
-	int best_score = 0, score = 0;
-	int cur_score;
-	link_t *link;
-
-	fibril_mutex_lock(&drivers_list->drivers_mutex);
-
-	if (node->drv != NULL) {
-		cur_score = get_match_score(node->drv, node);
-
-		link = list_next(&node->drv->drivers, &drivers_list->drivers);
-
-		/*
-		 * Find next driver with score equal to the current.
-		 */
-		while (link != NULL) {
-			driver_t *drv = list_get_instance(link, driver_t,
-			    drivers);
-			score = get_match_score(drv, node);
-			if (score == cur_score) {
-				/* Found it */
-				fibril_mutex_unlock(&drivers_list->drivers_mutex);
-				return drv;
-			}
-
-			link = list_next(link, &drivers_list->drivers);
-		}
-
-		/* There is no driver with the same score */
-	} else {
-		cur_score = INT_MAX;
-	}
-
-	/*
-	 * Find driver with the next best score
-	 */
-	list_foreach(drivers_list->drivers, drivers, driver_t, drv) {
-		score = get_match_score(drv, node);
-		if (score > best_score && score < cur_score) {
-			best_score = score;
-			best_drv = drv;
-		}
-	}
-
-	fibril_mutex_unlock(&drivers_list->drivers_mutex);
-	return best_drv;
-}
-
-/** Assign a driver to a device.
- *
- * @param tree		Device tree
- * @param node		The device's node in the device tree.
- * @param drv		The driver.
- */
-void attach_driver(dev_tree_t *tree, dev_node_t *dev, driver_t *drv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
-	    dev->pfun->pathname, drv->name);
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	fibril_rwlock_write_lock(&tree->rwlock);
-
-	dev->drv = drv;
-	dev->passed_to_driver = false;
-	fibril_mutex_lock(&dev->state_lock);
-	dev->state = DEVICE_ATTACHING;
-	fibril_mutex_unlock(&dev->state_lock);
-	fibril_condvar_broadcast(&dev->state_cv);
-	list_append(&dev->driver_devices, &drv->devices);
-
-	fibril_rwlock_write_unlock(&tree->rwlock);
-	fibril_mutex_unlock(&drv->driver_mutex);
-}
-
-/** Detach driver from device.
- *
- * @param tree		Device tree
- * @param node		The device's node in the device tree.
- * @param drv		The driver.
- */
-void detach_driver(dev_tree_t *tree, dev_node_t *dev)
-{
-	driver_t *drv = dev->drv;
-
-	assert(drv != NULL);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
-	    dev->pfun->pathname, drv->name);
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	fibril_rwlock_write_lock(&tree->rwlock);
-
-	dev->drv = NULL;
-	list_remove(&dev->driver_devices);
-
-	fibril_rwlock_write_unlock(&tree->rwlock);
-	fibril_mutex_unlock(&drv->driver_mutex);
-}
-
-/** Start a driver
- *
- * @param drv		The driver's structure.
- * @return		True if the driver's task is successfully spawned, false
- *			otherwise.
- */
-bool start_driver(driver_t *drv)
-{
-	errno_t rc;
-
-	assert(fibril_mutex_is_locked(&drv->driver_mutex));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
-
-	rc = task_spawnl(NULL, NULL, drv->binary_path, drv->binary_path, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Spawning driver `%s' (%s) failed: %s.",
-		    drv->name, drv->binary_path, str_error(rc));
-		return false;
-	}
-
-	drv->state = DRIVER_STARTING;
-	return true;
-}
-
-/** Stop a driver
- *
- * @param drv		The driver's structure.
- * @return		True if the driver's task is successfully spawned, false
- *			otherwise.
- */
-errno_t stop_driver(driver_t *drv)
-{
-	async_exch_t *exch;
-	errno_t retval;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "stop_driver(drv=\"%s\")", drv->name);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_0_0(exch, DRIVER_STOP);
-	loc_exchange_end(exch);
-
-	if (retval != EOK)
-		return retval;
-
-	drv->state = DRIVER_NOT_STARTED;
-	async_hangup(drv->sess);
-	drv->sess = NULL;
-	return EOK;
-}
-
-/** Find device driver by handle.
- *
- * @param drv_list	The list of device drivers
- * @param handle	Driver handle
- * @return		The device driver, if it is in the list,
- *			NULL otherwise.
- */
-driver_t *driver_find(driver_list_t *drv_list, devman_handle_t handle)
-{
-	driver_t *res = NULL;
-
-	fibril_mutex_lock(&drv_list->drivers_mutex);
-
-	list_foreach(drv_list->drivers, drivers, driver_t, drv) {
-		if (drv->handle == handle) {
-			res = drv;
-			break;
-		}
-	}
-
-	fibril_mutex_unlock(&drv_list->drivers_mutex);
-
-	return res;
-}
-
-/** Find device driver by name.
- *
- * @param drv_list	The list of device drivers.
- * @param drv_name	The name of the device driver which is searched.
- * @return		The device driver of the specified name, if it is in the
- *			list, NULL otherwise.
- */
-driver_t *driver_find_by_name(driver_list_t *drv_list, const char *drv_name)
-{
-	driver_t *res = NULL;
-
-	fibril_mutex_lock(&drv_list->drivers_mutex);
-
-	list_foreach(drv_list->drivers, drivers, driver_t, drv) {
-		if (str_cmp(drv->name, drv_name) == 0) {
-			res = drv;
-			break;
-		}
-	}
-
-	fibril_mutex_unlock(&drv_list->drivers_mutex);
-
-	return res;
-}
-
-/** Notify driver about the devices to which it was assigned.
- *
- * @param driver	The driver to which the devices are passed.
- */
-static void pass_devices_to_driver(driver_t *driver, dev_tree_t *tree)
-{
-	dev_node_t *dev;
-	link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
-	    driver->name);
-
-	fibril_mutex_lock(&driver->driver_mutex);
-
-	/*
-	 * Go through devices list as long as there is some device
-	 * that has not been passed to the driver.
-	 */
-	link = driver->devices.head.next;
-	while (link != &driver->devices.head) {
-		dev = list_get_instance(link, dev_node_t, driver_devices);
-		fibril_rwlock_write_lock(&tree->rwlock);
-
-		if (dev->passed_to_driver) {
-			fibril_rwlock_write_unlock(&tree->rwlock);
-			link = link->next;
-			continue;
-		}
-
-		dev_add_ref(dev);
-
-		/*
-		 * Unlock to avoid deadlock when adding device
-		 * handled by itself.
-		 */
-		fibril_mutex_unlock(&driver->driver_mutex);
-		fibril_rwlock_write_unlock(&tree->rwlock);
-
-		add_device(driver, dev, tree);
-
-		/* Device probe failed, need to try next best driver */
-		if (dev->state == DEVICE_NOT_PRESENT) {
-			fibril_mutex_lock(&driver->driver_mutex);
-			list_remove(&dev->driver_devices);
-			fibril_mutex_unlock(&driver->driver_mutex);
-			/* Give an extra reference to driver_reassign_fibril */
-			dev_add_ref(dev);
-			fid_t fid = fibril_create(driver_reassign_fibril, dev);
-			if (fid == 0) {
-				log_msg(LOG_DEFAULT, LVL_ERROR,
-				    "Error creating fibril to assign driver.");
-				dev_del_ref(dev);
-			}
-			fibril_add_ready(fid);
-		}
-
-		dev_del_ref(dev);
-
-		/*
-		 * Lock again as we will work with driver's
-		 * structure.
-		 */
-		fibril_mutex_lock(&driver->driver_mutex);
-
-		/*
-		 * Restart the cycle to go through all devices again.
-		 */
-		link = driver->devices.head.next;
-	}
-
-	/*
-	 * Once we passed all devices to the driver, we need to mark the
-	 * driver as running.
-	 * It is vital to do it here and inside critical section.
-	 *
-	 * If we would change the state earlier, other devices added to
-	 * the driver would be added to the device list and started
-	 * immediately and possibly started here as well.
-	 */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
-	driver->state = DRIVER_RUNNING;
-
-	fibril_mutex_unlock(&driver->driver_mutex);
-}
-
-/** Finish the initialization of a driver after it has succesfully started
- * and after it has registered itself by the device manager.
- *
- * Pass devices formerly matched to the driver to the driver and remember the
- * driver is running and fully functional now.
- *
- * @param driver	The driver which registered itself as running by the
- *			device manager.
- */
-void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
-	    driver->name);
-
-	/*
-	 * Pass devices which have been already assigned to the driver to the
-	 * driver.
-	 */
-	pass_devices_to_driver(driver, tree);
-}
-
-/** Initialize device driver structure.
- *
- * @param drv		The device driver structure.
- */
-void init_driver(driver_t *drv)
-{
-	assert(drv != NULL);
-
-	memset(drv, 0, sizeof(driver_t));
-	list_initialize(&drv->match_ids.ids);
-	list_initialize(&drv->devices);
-	fibril_mutex_initialize(&drv->driver_mutex);
-	drv->sess = NULL;
-}
-
-/** Device driver structure clean-up.
- *
- * @param drv		The device driver structure.
- */
-void clean_driver(driver_t *drv)
-{
-	assert(drv != NULL);
-
-	free(drv->name);
-	free(drv->binary_path);
-
-	clean_match_ids(&drv->match_ids);
-
-	init_driver(drv);
-}
-
-/** Delete device driver structure.
- *
- * @param drv		The device driver structure.
- */
-void delete_driver(driver_t *drv)
-{
-	assert(drv != NULL);
-
-	clean_driver(drv);
-	free(drv);
-}
-
-/** Find suitable driver for a device and assign the driver to it.
- *
- * @param node		The device node of the device in the device tree.
- * @param drivers_list	The list of available drivers.
- * @return		True if the suitable driver is found and
- *			successfully assigned to the device, false otherwise.
- */
-bool assign_driver(dev_node_t *dev, driver_list_t *drivers_list,
-    dev_tree_t *tree)
-{
-	driver_t *drv;
-
-	assert(dev != NULL);
-	assert(drivers_list != NULL);
-	assert(tree != NULL);
-
-	/*
-	 * Find the next best driver for this device.
-	 */
-again:
-	drv = find_best_match_driver(drivers_list, dev);
-	if (drv == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "No driver found for device `%s'.",
-		    dev->pfun->pathname);
-		return false;
-	}
-
-	/* Attach the driver to the device. */
-	attach_driver(tree, dev, drv);
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	if (drv->state == DRIVER_NOT_STARTED) {
-		/* Start the driver. */
-		start_driver(drv);
-	}
-	bool is_running = drv->state == DRIVER_RUNNING;
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	/* Notify the driver about the new device. */
-	if (is_running) {
-		add_device(drv, dev, tree);
-
-		/* If the device probe failed, need to try next available driver */
-		if (dev->state == DEVICE_NOT_PRESENT)
-			goto again;
-	}
-
-	fibril_mutex_lock(&drv->driver_mutex);
-	fibril_mutex_unlock(&drv->driver_mutex);
-
-	fibril_rwlock_write_lock(&tree->rwlock);
-	if (dev->pfun != NULL) {
-		dev->pfun->state = FUN_ON_LINE;
-	}
-	fibril_rwlock_write_unlock(&tree->rwlock);
-	return true;
-}
-
-/** Pass a device to running driver.
- *
- * @param drv		The driver's structure.
- * @param node		The device's node in the device tree.
- */
-void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
-{
-	link_t *link;
-	fun_node_t *fun;
-
-	/*
-	 * We do not expect to have driver's mutex locked as we do not
-	 * access any structures that would affect driver_t.
-	 */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
-	    drv->name, dev->pfun->name);
-
-	/* Send the device to the driver. */
-	devman_handle_t parent_handle;
-	if (dev->pfun) {
-		parent_handle = dev->pfun->handle;
-	} else {
-		parent_handle = 0;
-	}
-
-	async_exch_t *exch = async_exchange_begin(drv->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, DRIVER_DEV_ADD, dev->handle,
-	    parent_handle, &answer);
-
-	/* Send the device name to the driver. */
-	errno_t rc = async_data_write_start(exch, dev->pfun->name,
-	    str_size(dev->pfun->name) + 1);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-	} else {
-		/* Wait for answer from the driver. */
-		async_wait_for(req, &rc);
-	}
-
-	if (rc == EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Device was added. Wait for "
-		    "child functions' devices to stabilize.");
-		fibril_rwlock_read_lock(&tree->rwlock);
-		link = list_first(&dev->functions);
-		while (link != NULL) {
-			fun = list_get_instance(link, fun_node_t,
-			    dev_functions);
-
-			if (fun->child != NULL) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG2, "Wait for "
-				    "child device %p.", (void *)fun->child);
-				fun_add_ref(fun);
-				fibril_rwlock_read_unlock(&tree->rwlock);
-				dev_wait_stable(fun->child);
-				fibril_rwlock_read_lock(&tree->rwlock);
-				fun_del_ref(fun);
-			}
-
-			link = list_next(link, &dev->functions);
-		}
-
-		fibril_rwlock_read_unlock(&tree->rwlock);
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "Finished waiting for children.");
-	}
-
-	fibril_mutex_lock(&dev->state_lock);
-
-	switch (rc) {
-	case EOK:
-		dev->state = DEVICE_USABLE;
-		break;
-	case ENOENT:
-		dev->state = DEVICE_NOT_PRESENT;
-		break;
-	default:
-		dev->state = DEVICE_INVALID;
-		break;
-	}
-
-	fibril_mutex_unlock(&dev->state_lock);
-	fibril_condvar_broadcast(&dev->state_cv);
-
-	dev->passed_to_driver = true;
-}
-
-errno_t driver_dev_remove(dev_tree_t *tree, dev_node_t *dev)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	driver_t *drv;
-	devman_handle_t handle;
-
-	assert(dev != NULL);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_remove(%p)", dev);
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	drv = dev->drv;
-	handle = dev->handle;
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_1_0(exch, DRIVER_DEV_REMOVE, handle);
-	async_exchange_end(exch);
-
-	return retval;
-}
-
-errno_t driver_dev_quiesce(dev_tree_t *tree, dev_node_t *dev)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	driver_t *drv;
-	devman_handle_t handle;
-
-	assert(dev != NULL);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_quiesce(%p)", dev);
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	drv = dev->drv;
-	handle = dev->handle;
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_1_0(exch, DRIVER_DEV_QUIESCE, handle);
-	async_exchange_end(exch);
-
-	return retval;
-}
-
-errno_t driver_dev_gone(dev_tree_t *tree, dev_node_t *dev)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	driver_t *drv;
-	devman_handle_t handle;
-
-	assert(dev != NULL);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_gone(%p)", dev);
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	drv = dev->drv;
-	handle = dev->handle;
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_1_0(exch, DRIVER_DEV_GONE, handle);
-	async_exchange_end(exch);
-
-	return retval;
-}
-
-errno_t driver_fun_online(dev_tree_t *tree, fun_node_t *fun)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	driver_t *drv;
-	devman_handle_t handle;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_online(%p)", fun);
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-
-	if (fun->dev == NULL) {
-		/* XXX root function? */
-		fibril_rwlock_read_unlock(&tree->rwlock);
-		return EINVAL;
-	}
-
-	drv = fun->dev->drv;
-	handle = fun->handle;
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_1_0(exch, DRIVER_FUN_ONLINE, handle);
-	loc_exchange_end(exch);
-
-	return retval;
-}
-
-errno_t driver_fun_offline(dev_tree_t *tree, fun_node_t *fun)
-{
-	async_exch_t *exch;
-	errno_t retval;
-	driver_t *drv;
-	devman_handle_t handle;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_offline(%p)", fun);
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	if (fun->dev == NULL) {
-		/* XXX root function? */
-		fibril_rwlock_read_unlock(&tree->rwlock);
-		return EINVAL;
-	}
-
-	drv = fun->dev->drv;
-	handle = fun->handle;
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	exch = async_exchange_begin(drv->sess);
-	retval = async_req_1_0(exch, DRIVER_FUN_OFFLINE, handle);
-	loc_exchange_end(exch);
-
-	return retval;
-
-}
-
-/** Get list of registered drivers. */
-errno_t driver_get_list(driver_list_t *driver_list, devman_handle_t *hdl_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	fibril_mutex_lock(&driver_list->drivers_mutex);
-
-	buf_cnt = buf_size / sizeof(devman_handle_t);
-
-	act_cnt = list_count(&driver_list->drivers);
-	*act_size = act_cnt * sizeof(devman_handle_t);
-
-	if (buf_size % sizeof(devman_handle_t) != 0) {
-		fibril_mutex_unlock(&driver_list->drivers_mutex);
-		return EINVAL;
-	}
-
-	size_t pos = 0;
-	list_foreach(driver_list->drivers, drivers, driver_t, drv) {
-		if (pos < buf_cnt) {
-			hdl_buf[pos] = drv->handle;
-		}
-
-		pos++;
-	}
-
-	fibril_mutex_unlock(&driver_list->drivers_mutex);
-	return EOK;
-}
-
-/** Get list of device functions. */
-errno_t driver_get_devices(driver_t *driver, devman_handle_t *hdl_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	fibril_mutex_lock(&driver->driver_mutex);
-
-	buf_cnt = buf_size / sizeof(devman_handle_t);
-
-	act_cnt = list_count(&driver->devices);
-	*act_size = act_cnt * sizeof(devman_handle_t);
-
-	if (buf_size % sizeof(devman_handle_t) != 0) {
-		fibril_mutex_unlock(&driver->driver_mutex);
-		return EINVAL;
-	}
-
-	size_t pos = 0;
-	list_foreach(driver->devices, driver_devices, dev_node_t, dev) {
-		if (pos < buf_cnt) {
-			hdl_buf[pos] = dev->handle;
-		}
-
-		pos++;
-	}
-
-	fibril_mutex_unlock(&driver->driver_mutex);
-	return EOK;
-}
-
-/** Try to find next available driver in a separate fibril.
- *
- * @param arg Device node (dev_node_t)
- */
-static errno_t driver_reassign_fibril(void *arg)
-{
-	dev_node_t *dev_node = (dev_node_t *) arg;
-	assign_driver(dev_node, &drivers_list, &device_tree);
-
-	/* Delete one reference we got from the caller. */
-	dev_del_ref(dev_node);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/devman/driver.h
===================================================================
--- uspace/srv/devman/driver.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DRIVER_H_
-#define DRIVER_H_
-
-#include <stdbool.h>
-#include "devman.h"
-
-extern void init_driver_list(driver_list_t *);
-extern driver_t *create_driver(void);
-extern bool get_driver_info(const char *, const char *, driver_t *);
-extern int lookup_available_drivers(driver_list_t *, const char *);
-
-extern driver_t *find_best_match_driver(driver_list_t *, dev_node_t *);
-extern bool assign_driver(dev_node_t *, driver_list_t *, dev_tree_t *);
-
-extern void add_driver(driver_list_t *, driver_t *);
-extern void attach_driver(dev_tree_t *, dev_node_t *, driver_t *);
-extern void detach_driver(dev_tree_t *, dev_node_t *);
-extern bool start_driver(driver_t *);
-extern errno_t stop_driver(driver_t *);
-extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
-extern errno_t driver_dev_remove(dev_tree_t *, dev_node_t *);
-extern errno_t driver_dev_quiesce(dev_tree_t *, dev_node_t *);
-extern errno_t driver_dev_gone(dev_tree_t *, dev_node_t *);
-extern errno_t driver_fun_online(dev_tree_t *, fun_node_t *);
-extern errno_t driver_fun_offline(dev_tree_t *, fun_node_t *);
-
-extern driver_t *driver_find(driver_list_t *, devman_handle_t);
-extern driver_t *driver_find_by_name(driver_list_t *, const char *);
-extern void initialize_running_driver(driver_t *, dev_tree_t *);
-
-extern void init_driver(driver_t *);
-extern void clean_driver(driver_t *);
-extern void delete_driver(driver_t *);
-extern errno_t driver_get_list(driver_list_t *, devman_handle_t *, size_t, size_t *);
-extern errno_t driver_get_devices(driver_t *, devman_handle_t *, size_t, size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/drv_conn.c
===================================================================
--- uspace/srv/devman/drv_conn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,734 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup devman
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <io/log.h>
-#include <ipc/devman.h>
-#include <loc.h>
-
-#include "client_conn.h"
-#include "dev.h"
-#include "devman.h"
-#include "devtree.h"
-#include "driver.h"
-#include "drv_conn.h"
-#include "fun.h"
-#include "loc.h"
-#include "main.h"
-
-static errno_t init_running_drv(void *drv);
-
-/** Register running driver. */
-static driver_t *devman_driver_register(ipc_call_t *call)
-{
-	driver_t *driver = NULL;
-	char *drv_name = NULL;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_driver_register");
-
-	/* Get driver name. */
-	errno_t rc = async_data_write_accept((void **) &drv_name, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return NULL;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "The `%s' driver is trying to register.",
-	    drv_name);
-
-	/* Find driver structure. */
-	driver = driver_find_by_name(&drivers_list, drv_name);
-	if (driver == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "No driver named `%s' was found.", drv_name);
-		free(drv_name);
-		drv_name = NULL;
-		async_answer_0(call, ENOENT);
-		return NULL;
-	}
-
-	free(drv_name);
-	drv_name = NULL;
-
-	fibril_mutex_lock(&driver->driver_mutex);
-
-	if (driver->sess) {
-		/* We already have a connection to the driver. */
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Driver '%s' already started.\n",
-		    driver->name);
-		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(call, EEXIST);
-		return NULL;
-	}
-
-	switch (driver->state) {
-	case DRIVER_NOT_STARTED:
-		/* Somebody started the driver manually. */
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Driver '%s' started manually.\n",
-		    driver->name);
-		driver->state = DRIVER_STARTING;
-		break;
-	case DRIVER_STARTING:
-		/* The expected case */
-		break;
-	case DRIVER_RUNNING:
-		/* Should not happen since we do not have a connected session */
-		assert(false);
-	}
-
-	/* Create connection to the driver. */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Creating connection to the `%s' driver.",
-	    driver->name);
-	driver->sess = async_callback_receive(EXCHANGE_PARALLEL);
-	if (!driver->sess) {
-		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(call, ENOTSUP);
-		return NULL;
-	}
-	/* FIXME: Work around problem with callback sessions */
-	async_sess_args_set(driver->sess, INTERFACE_DDF_DEVMAN, 0, 0);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE,
-	    "The `%s' driver was successfully registered as running.",
-	    driver->name);
-
-	/*
-	 * Initialize the driver as running (e.g. pass assigned devices to it)
-	 * in a separate fibril; the separate fibril is used to enable the
-	 * driver to use devman service during the driver's initialization.
-	 */
-	fid_t fid = fibril_create(init_running_drv, driver);
-	if (fid == 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to create initialization fibril "
-		    "for driver `%s'.", driver->name);
-		fibril_mutex_unlock(&driver->driver_mutex);
-		async_answer_0(call, ENOMEM);
-		return NULL;
-	}
-
-	fibril_add_ready(fid);
-	fibril_mutex_unlock(&driver->driver_mutex);
-
-	async_answer_0(call, EOK);
-	return driver;
-}
-
-/** Receive device match ID from the device's parent driver and add it to the
- * list of devices match ids.
- *
- * @param match_ids	The list of the device's match ids.
- * @return		Zero on success, error code otherwise.
- */
-static errno_t devman_receive_match_id(match_id_list_t *match_ids)
-{
-	match_id_t *match_id = create_match_id();
-	ipc_call_t call;
-	errno_t rc = 0;
-
-	async_get_call(&call);
-	if (DEVMAN_ADD_MATCH_ID != ipc_get_imethod(&call)) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Invalid protocol when trying to receive match id.");
-		async_answer_0(&call, EINVAL);
-		delete_match_id(match_id);
-		return EINVAL;
-	}
-
-	if (match_id == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate match id.");
-		async_answer_0(&call, ENOMEM);
-		return ENOMEM;
-	}
-
-	async_answer_0(&call, EOK);
-
-	match_id->score = ipc_get_arg1(&call);
-
-	char *match_id_str;
-	rc = async_data_write_accept((void **) &match_id_str, true, 0, 0, 0, 0);
-	match_id->id = match_id_str;
-	if (rc != EOK) {
-		delete_match_id(match_id);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to receive match id string: %s.",
-		    str_error(rc));
-		return rc;
-	}
-
-	list_append(&match_id->link, &match_ids->ids);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Received match id `%s', score %d.",
-	    match_id->id, match_id->score);
-	return rc;
-}
-
-/** Receive device match IDs from the device's parent driver and add them to the
- * list of devices match ids.
- *
- * @param match_count	The number of device's match ids to be received.
- * @param match_ids	The list of the device's match ids.
- * @return		Zero on success, error code otherwise.
- */
-static errno_t devman_receive_match_ids(sysarg_t match_count,
-    match_id_list_t *match_ids)
-{
-	errno_t ret = EOK;
-	size_t i;
-
-	for (i = 0; i < match_count; i++) {
-		if (EOK != (ret = devman_receive_match_id(match_ids)))
-			return ret;
-	}
-	return ret;
-}
-
-/** Handle function registration.
- *
- * Child devices are registered by their parent's device driver.
- */
-static void devman_add_function(ipc_call_t *call)
-{
-	fun_type_t ftype = (fun_type_t) ipc_get_arg1(call);
-	devman_handle_t dev_handle = ipc_get_arg2(call);
-	sysarg_t match_count = ipc_get_arg3(call);
-	dev_tree_t *tree = &device_tree;
-
-	dev_node_t *pdev = find_dev_node(&device_tree, dev_handle);
-	if (pdev == NULL) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	if (ftype != fun_inner && ftype != fun_exposed) {
-		/* Unknown function type */
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Unknown function type %d provided by driver.",
-		    (int) ftype);
-
-		dev_del_ref(pdev);
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	char *fun_name = NULL;
-	errno_t rc = async_data_write_accept((void **) &fun_name, true, 0, 0, 0, 0);
-	if (rc != EOK) {
-		dev_del_ref(pdev);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	fibril_rwlock_write_lock(&tree->rwlock);
-
-	/* Check device state */
-	if (pdev->state == DEVICE_REMOVED) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		dev_del_ref(pdev);
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	/* Check that function with same name is not there already. */
-	fun_node_t *tfun = find_fun_node_in_device(tree, pdev, fun_name);
-	if (tfun) {
-		fun_del_ref(tfun);	/* drop the new unwanted reference */
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		dev_del_ref(pdev);
-		async_answer_0(call, EEXIST);
-		printf(NAME ": Warning, driver tried to register `%s' twice.\n",
-		    fun_name);
-		free(fun_name);
-		return;
-	}
-
-	fun_node_t *fun = create_fun_node();
-	/*
-	 * Hold a temporary reference while we work with fun. The reference from
-	 * create_fun_node() moves to the device tree.
-	 */
-	fun_add_ref(fun);
-	fun->ftype = ftype;
-
-	/*
-	 * We can lock the function here even when holding the tree because
-	 * we know it cannot be held by anyone else yet.
-	 */
-	fun_busy_lock(fun);
-
-	if (!insert_fun_node(&device_tree, fun, fun_name, pdev)) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		dev_del_ref(pdev);
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		fun_del_ref(fun);	/* fun is destroyed */
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	fibril_rwlock_write_unlock(&tree->rwlock);
-	dev_del_ref(pdev);
-
-	devman_receive_match_ids(match_count, &fun->match_ids);
-
-	rc = fun_online(fun);
-	if (rc != EOK) {
-		/* XXX Set some failed state? */
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	fun_busy_unlock(fun);
-	fun_del_ref(fun);
-
-	/* Return device handle to parent's driver. */
-	async_answer_1(call, EOK, fun->handle);
-}
-
-static void devman_add_function_to_cat(ipc_call_t *call)
-{
-	devman_handle_t handle = ipc_get_arg1(call);
-	category_id_t cat_id;
-	errno_t rc;
-
-	/* Get category name. */
-	char *cat_name;
-	rc = async_data_write_accept((void **) &cat_name, true,
-	    0, 0, 0, 0);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return;
-	}
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	rc = loc_category_get_id(cat_name, &cat_id, IPC_FLAG_BLOCKING);
-	if (rc == EOK)
-		rc = loc_service_add_to_cat(devman_srv, fun->service_id, cat_id);
-	if (rc == EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Function `%s' added to category `%s'.",
-		    fun->pathname, cat_name);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding function `%s' to category "
-		    "`%s'.", fun->pathname, cat_name);
-	}
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-	fun_del_ref(fun);
-
-	async_answer_0(call, rc);
-}
-
-/** Online function by driver request.
- *
- */
-static void devman_drv_fun_online(ipc_call_t *icall, driver_t *drv)
-{
-	fun_node_t *fun;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_drv_fun_online()");
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fun_busy_lock(fun);
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-	if (fun->dev == NULL || fun->dev->drv != drv) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	rc = fun_online(fun);
-	if (rc != EOK) {
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fun_busy_unlock(fun);
-	fun_del_ref(fun);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Offline function by driver request.
- *
- */
-static void devman_drv_fun_offline(ipc_call_t *icall, driver_t *drv)
-{
-	fun_node_t *fun;
-	errno_t rc;
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fun_busy_lock(fun);
-
-	fibril_rwlock_write_lock(&device_tree.rwlock);
-	if (fun->dev == NULL || fun->dev->drv != drv) {
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-	fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-	rc = fun_offline(fun);
-	if (rc != EOK) {
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fun_busy_unlock(fun);
-	fun_del_ref(fun);
-	async_answer_0(icall, EOK);
-}
-
-/** Quiesce function by driver request.
- *
- */
-static void devman_drv_fun_quiesce(ipc_call_t *icall, driver_t *drv)
-{
-	fun_node_t *fun;
-	errno_t rc;
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fun_busy_lock(fun);
-
-	fibril_rwlock_write_lock(&device_tree.rwlock);
-	if (fun->dev == NULL || fun->dev->drv != drv) {
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-	fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-	rc = fun_quiesce(fun);
-	if (rc != EOK) {
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fun_busy_unlock(fun);
-	fun_del_ref(fun);
-	async_answer_0(icall, EOK);
-}
-
-/** Wait for function to become stable.
- *
- */
-static void devman_drv_fun_wait_stable(ipc_call_t *icall, driver_t *drv)
-{
-	fun_node_t *fun;
-	dev_node_t *dev;
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
-	if (fun == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (fun->child == NULL) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		fun_del_ref(fun);
-		async_answer_0(icall, EOK);
-		return;
-	}
-
-	dev = fun->child;
-	dev_add_ref(dev);
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	dev_wait_stable(dev);
-	dev_del_ref(dev);
-
-	async_answer_0(icall, EOK);
-}
-
-/** Remove function. */
-static void devman_remove_function(ipc_call_t *call)
-{
-	devman_handle_t fun_handle = ipc_get_arg1(call);
-	dev_tree_t *tree = &device_tree;
-	errno_t rc;
-
-	fun_node_t *fun = find_fun_node(&device_tree, fun_handle);
-	if (fun == NULL) {
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	fun_busy_lock(fun);
-
-	fibril_rwlock_write_lock(&tree->rwlock);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_remove_function(fun='%s')", fun->pathname);
-
-	/* Check function state */
-	if (fun->state == FUN_REMOVED) {
-		fibril_rwlock_write_unlock(&tree->rwlock);
-		fun_busy_unlock(fun);
-		fun_del_ref(fun);
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	if (fun->ftype == fun_inner) {
-		/* This is a surprise removal. Handle possible descendants */
-		if (fun->child != NULL) {
-			dev_node_t *dev = fun->child;
-			device_state_t dev_state;
-			errno_t gone_rc;
-
-			dev_add_ref(dev);
-			dev_state = dev->state;
-
-			fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-			/* If device is owned by driver, inform driver it is gone. */
-			if (dev_state == DEVICE_USABLE)
-				gone_rc = driver_dev_gone(&device_tree, dev);
-			else
-				gone_rc = EOK;
-
-			fibril_rwlock_read_lock(&device_tree.rwlock);
-
-			/* Verify that driver succeeded and removed all functions */
-			if (gone_rc != EOK || !list_empty(&dev->functions)) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Driver did not remove "
-				    "functions for device that is gone. "
-				    "Device node is now defunct.");
-
-				/*
-				 * Not much we can do but mark the device
-				 * node as having invalid state. This
-				 * is a driver bug.
-				 */
-				dev->state = DEVICE_INVALID;
-				fibril_rwlock_read_unlock(&device_tree.rwlock);
-				dev_del_ref(dev);
-				if (gone_rc == EOK)
-					gone_rc = ENOTSUP;
-				fun_busy_unlock(fun);
-				fun_del_ref(fun);
-				async_answer_0(call, gone_rc);
-				return;
-			}
-
-			driver_t *driver = dev->drv;
-			fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-			if (driver)
-				detach_driver(&device_tree, dev);
-
-			fibril_rwlock_write_lock(&device_tree.rwlock);
-			remove_dev_node(&device_tree, dev);
-
-			/* Delete ref created when node was inserted */
-			dev_del_ref(dev);
-			/* Delete ref created by dev_add_ref(dev) above */
-			dev_del_ref(dev);
-		}
-	} else {
-		if (fun->service_id != 0) {
-			/* Unregister from location service */
-			rc = loc_unregister_tree_function(fun, &device_tree);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unregistering tree "
-				    "service.");
-				fibril_rwlock_write_unlock(&tree->rwlock);
-				fun_busy_unlock(fun);
-				fun_del_ref(fun);
-				async_answer_0(call, EIO);
-				return;
-			}
-		}
-	}
-
-	remove_fun_node(&device_tree, fun);
-	fibril_rwlock_write_unlock(&tree->rwlock);
-	fun_busy_unlock(fun);
-
-	/* Delete ref added when inserting function into tree */
-	fun_del_ref(fun);
-	/* Delete ref added above when looking up function */
-	fun_del_ref(fun);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_remove_function() succeeded.");
-	async_answer_0(call, EOK);
-}
-
-/** Initialize driver which has registered itself as running and ready.
- *
- * The initialization is done in a separate fibril to avoid deadlocks (if the
- * driver needed to be served by devman during the driver's initialization).
- */
-static errno_t init_running_drv(void *drv)
-{
-	driver_t *driver = (driver_t *) drv;
-
-	initialize_running_driver(driver, &device_tree);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "The `%s` driver was successfully initialized.",
-	    driver->name);
-	return 0;
-}
-
-/** Function for handling connections from a driver to the device manager. */
-void devman_connection_driver(ipc_call_t *icall, void *arg)
-{
-	client_t *client;
-	driver_t *driver = NULL;
-
-	/* Accept the connection. */
-	async_accept_0(icall);
-
-	client = async_get_client_data();
-	if (client == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate client data.");
-		return;
-	}
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		if (ipc_get_imethod(&call) != DEVMAN_DRIVER_REGISTER) {
-			fibril_mutex_lock(&client->mutex);
-			driver = client->driver;
-			fibril_mutex_unlock(&client->mutex);
-			if (driver == NULL) {
-				/* First call must be to DEVMAN_DRIVER_REGISTER */
-				async_answer_0(&call, ENOTSUP);
-				continue;
-			}
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case DEVMAN_DRIVER_REGISTER:
-			fibril_mutex_lock(&client->mutex);
-			if (client->driver != NULL) {
-				fibril_mutex_unlock(&client->mutex);
-				async_answer_0(&call, EINVAL);
-				continue;
-			}
-			client->driver = devman_driver_register(&call);
-			fibril_mutex_unlock(&client->mutex);
-			break;
-		case DEVMAN_ADD_FUNCTION:
-			devman_add_function(&call);
-			break;
-		case DEVMAN_ADD_DEVICE_TO_CATEGORY:
-			devman_add_function_to_cat(&call);
-			break;
-		case DEVMAN_DRV_FUN_ONLINE:
-			devman_drv_fun_online(&call, driver);
-			break;
-		case DEVMAN_DRV_FUN_OFFLINE:
-			devman_drv_fun_offline(&call, driver);
-			break;
-		case DEVMAN_DRV_FUN_QUIESCE:
-			devman_drv_fun_quiesce(&call, driver);
-			break;
-		case DEVMAN_DRV_FUN_WAIT_STABLE:
-			devman_drv_fun_wait_stable(&call, driver);
-			break;
-		case DEVMAN_REMOVE_FUNCTION:
-			devman_remove_function(&call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-}
-
-/** @}
- */
Index: pace/srv/devman/drv_conn.h
===================================================================
--- uspace/srv/devman/drv_conn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DRV_CONN_H_
-#define DRV_CONN_H_
-
-#include <async.h>
-#include "devman.h"
-
-extern void devman_connection_driver(ipc_call_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/fun.c
===================================================================
--- uspace/srv/devman/fun.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,489 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <loc.h>
-
-#include "dev.h"
-#include "devman.h"
-#include "devtree.h"
-#include "driver.h"
-#include "fun.h"
-#include "main.h"
-#include "loc.h"
-
-static fun_node_t *find_node_child(dev_tree_t *, fun_node_t *, const char *);
-
-/* Function nodes */
-
-/** Create a new function node.
- *
- * @return		A function node structure.
- */
-fun_node_t *create_fun_node(void)
-{
-	fun_node_t *fun;
-
-	fun = calloc(1, sizeof(fun_node_t));
-	if (fun == NULL)
-		return NULL;
-
-	fun->state = FUN_INIT;
-	refcount_init(&fun->refcnt);
-	fibril_mutex_initialize(&fun->busy_lock);
-	link_initialize(&fun->dev_functions);
-	list_initialize(&fun->match_ids.ids);
-
-	return fun;
-}
-
-/** Delete a function node.
- *
- * @param fun		The device node structure.
- */
-void delete_fun_node(fun_node_t *fun)
-{
-	assert(fun->dev == NULL);
-	assert(fun->child == NULL);
-
-	clean_match_ids(&fun->match_ids);
-	free(fun->name);
-	free(fun->pathname);
-	free(fun);
-}
-
-/** Increase function node reference count.
- *
- * @param fun	Function node
- */
-void fun_add_ref(fun_node_t *fun)
-{
-	refcount_up(&fun->refcnt);
-}
-
-/** Decrease function node reference count.
- *
- * When the count drops to zero the function node is freed.
- *
- * @param fun	Function node
- */
-void fun_del_ref(fun_node_t *fun)
-{
-	if (refcount_down(&fun->refcnt))
-		delete_fun_node(fun);
-}
-
-/** Make function busy for reconfiguration operations. */
-void fun_busy_lock(fun_node_t *fun)
-{
-	fibril_mutex_lock(&fun->busy_lock);
-}
-
-/** Mark end of reconfiguration operation. */
-void fun_busy_unlock(fun_node_t *fun)
-{
-	fibril_mutex_unlock(&fun->busy_lock);
-}
-
-/** Find the function node with the specified handle.
- *
- * @param tree		The device tree where we look for the device node.
- * @param handle	The handle of the function.
- * @return		The function node.
- */
-fun_node_t *find_fun_node_no_lock(dev_tree_t *tree, devman_handle_t handle)
-{
-	fun_node_t *fun;
-
-	assert(fibril_rwlock_is_locked(&tree->rwlock));
-
-	ht_link_t *link = hash_table_find(&tree->devman_functions, &handle);
-	if (link == NULL)
-		return NULL;
-
-	fun = hash_table_get_inst(link, fun_node_t, devman_fun);
-
-	return fun;
-}
-
-/** Find the function node with the specified handle.
- *
- * @param tree		The device tree where we look for the device node.
- * @param handle	The handle of the function.
- * @return		The function node.
- */
-fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle)
-{
-	fun_node_t *fun = NULL;
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-
-	fun = find_fun_node_no_lock(tree, handle);
-	if (fun != NULL)
-		fun_add_ref(fun);
-
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	return fun;
-}
-
-/** Create and set device's full path in device tree.
- *
- * @param tree		Device tree
- * @param node		The device's device node.
- * @param parent	The parent device node.
- * @return		True on success, false otherwise (insufficient
- *			resources etc.).
- */
-bool set_fun_path(dev_tree_t *tree, fun_node_t *fun, fun_node_t *parent)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-	assert(fun->name != NULL);
-
-	size_t pathsize = (str_size(fun->name) + 1);
-	if (parent != NULL)
-		pathsize += str_size(parent->pathname) + 1;
-
-	fun->pathname = (char *) malloc(pathsize);
-	if (fun->pathname == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to allocate device path.");
-		return false;
-	}
-
-	if (parent != NULL) {
-		str_cpy(fun->pathname, pathsize, parent->pathname);
-		str_append(fun->pathname, pathsize, "/");
-		str_append(fun->pathname, pathsize, fun->name);
-	} else {
-		str_cpy(fun->pathname, pathsize, fun->name);
-	}
-
-	return true;
-}
-
-/** Find function node with a specified path in the device tree.
- *
- * @param path		The path of the function node in the device tree.
- * @param tree		The device tree.
- * @return		The function node if it is present in the tree, NULL
- *			otherwise.
- */
-fun_node_t *find_fun_node_by_path(dev_tree_t *tree, char *path)
-{
-	assert(path != NULL);
-
-	bool is_absolute = path[0] == '/';
-	if (!is_absolute) {
-		return NULL;
-	}
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-
-	fun_node_t *fun = tree->root_node;
-	fun_add_ref(fun);
-	/*
-	 * Relative path to the function from its parent (but with '/' at the
-	 * beginning)
-	 */
-	char *rel_path = path;
-	char *next_path_elem = NULL;
-	bool cont = (rel_path[1] != '\0');
-
-	while (cont && fun != NULL) {
-		next_path_elem  = get_path_elem_end(rel_path + 1);
-		if (next_path_elem[0] == '/') {
-			cont = true;
-			next_path_elem[0] = 0;
-		} else {
-			cont = false;
-		}
-
-		fun_node_t *cfun = find_node_child(tree, fun, rel_path + 1);
-		fun_del_ref(fun);
-		fun = cfun;
-
-		if (cont) {
-			/* Restore the original path. */
-			next_path_elem[0] = '/';
-		}
-		rel_path = next_path_elem;
-	}
-
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	return fun;
-}
-
-/** Find function with a specified name belonging to given device.
- *
- * Device tree rwlock should be held at least for reading.
- *
- * @param tree Device tree
- * @param dev Device the function belongs to.
- * @param name Function name (not path).
- * @return Function node.
- * @retval NULL No function with given name.
- */
-fun_node_t *find_fun_node_in_device(dev_tree_t *tree, dev_node_t *dev,
-    const char *name)
-{
-	assert(name != NULL);
-	assert(fibril_rwlock_is_locked(&tree->rwlock));
-
-	list_foreach(dev->functions, dev_functions, fun_node_t, fun) {
-		if (str_cmp(name, fun->name) == 0) {
-			fun_add_ref(fun);
-			return fun;
-		}
-	}
-
-	return NULL;
-}
-
-/** Find child function node with a specified name.
- *
- * Device tree rwlock should be held at least for reading.
- *
- * @param tree		Device tree
- * @param parent	The parent function node.
- * @param name		The name of the child function.
- * @return		The child function node.
- */
-static fun_node_t *find_node_child(dev_tree_t *tree, fun_node_t *pfun,
-    const char *name)
-{
-	return find_fun_node_in_device(tree, pfun->child, name);
-}
-
-static errno_t assign_driver_fibril(void *arg)
-{
-	dev_node_t *dev_node = (dev_node_t *) arg;
-	assign_driver(dev_node, &drivers_list, &device_tree);
-
-	/* Delete one reference we got from the caller. */
-	dev_del_ref(dev_node);
-	return EOK;
-}
-
-errno_t fun_online(fun_node_t *fun)
-{
-	dev_node_t *dev;
-
-	fibril_rwlock_write_lock(&device_tree.rwlock);
-
-	if (fun->state == FUN_ON_LINE) {
-		fibril_rwlock_write_unlock(&device_tree.rwlock);
-		log_msg(LOG_DEFAULT, LVL_WARN, "Function %s is already on line.",
-		    fun->pathname);
-		return EOK;
-	}
-
-	if (fun->ftype == fun_inner) {
-		dev = create_dev_node();
-		if (dev == NULL) {
-			fibril_rwlock_write_unlock(&device_tree.rwlock);
-			return ENOMEM;
-		}
-
-		insert_dev_node(&device_tree, dev, fun);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_add_function(fun=\"%s\")", fun->pathname);
-
-	if (fun->ftype == fun_inner) {
-		dev = fun->child;
-		assert(dev != NULL);
-
-		/* Give one reference over to assign_driver_fibril(). */
-		dev_add_ref(dev);
-
-		/*
-		 * Try to find a suitable driver and assign it to the device.  We do
-		 * not want to block the current fibril that is used for processing
-		 * incoming calls: we will launch a separate fibril to handle the
-		 * driver assigning. That is because assign_driver can actually include
-		 * task spawning which could take some time.
-		 */
-		fid_t assign_fibril = fibril_create(assign_driver_fibril, dev);
-		if (assign_fibril == 0) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to create fibril for "
-			    "assigning driver.");
-			/* XXX Cleanup */
-			fibril_rwlock_write_unlock(&device_tree.rwlock);
-			return ENOMEM;
-		}
-		fibril_add_ready(assign_fibril);
-	} else
-		loc_register_tree_function(fun, &device_tree);
-
-	fun->state = FUN_ON_LINE;
-	fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-	return EOK;
-}
-
-errno_t fun_offline(fun_node_t *fun)
-{
-	errno_t rc;
-
-	fibril_rwlock_write_lock(&device_tree.rwlock);
-
-	if (fun->state == FUN_OFF_LINE) {
-		fibril_rwlock_write_unlock(&device_tree.rwlock);
-		log_msg(LOG_DEFAULT, LVL_WARN, "Function %s is already off line.",
-		    fun->pathname);
-		return EOK;
-	}
-
-	if (fun->ftype == fun_inner) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Offlining inner function %s.",
-		    fun->pathname);
-
-		if (fun->child != NULL) {
-			dev_node_t *dev = fun->child;
-			device_state_t dev_state;
-
-			dev_add_ref(dev);
-			dev_state = dev->state;
-
-			fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-			/* If device is owned by driver, ask driver to give it up. */
-			if (dev_state == DEVICE_USABLE) {
-				rc = driver_dev_remove(&device_tree, dev);
-				if (rc != EOK) {
-					dev_del_ref(dev);
-					return ENOTSUP;
-				}
-			}
-
-			/* Verify that driver removed all functions */
-			fibril_rwlock_read_lock(&device_tree.rwlock);
-			if (!list_empty(&dev->functions)) {
-				fibril_rwlock_read_unlock(&device_tree.rwlock);
-				dev_del_ref(dev);
-				return EIO;
-			}
-
-			driver_t *driver = dev->drv;
-			fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-			if (driver)
-				detach_driver(&device_tree, dev);
-
-			fibril_rwlock_write_lock(&device_tree.rwlock);
-			remove_dev_node(&device_tree, dev);
-
-			/* Delete ref created when node was inserted */
-			dev_del_ref(dev);
-			/* Delete ref created by dev_add_ref(dev) above */
-			dev_del_ref(dev);
-		}
-	} else {
-		/* Unregister from location service */
-		rc = loc_unregister_tree_function(fun, &device_tree);
-		if (rc != EOK) {
-			fibril_rwlock_write_unlock(&device_tree.rwlock);
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unregistering tree service.");
-			return EIO;
-		}
-
-		fun->service_id = 0;
-	}
-
-	fun->state = FUN_OFF_LINE;
-	fibril_rwlock_write_unlock(&device_tree.rwlock);
-
-	return EOK;
-}
-
-errno_t fun_quiesce(fun_node_t *fun)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "fun_quiesce(%s)", fun->pathname);
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	if (fun->state == FUN_OFF_LINE) {
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Function %s is off line.",
-		    fun->pathname);
-		return EOK;
-	}
-
-	if (fun->ftype != fun_inner) {
-		/* Nothing to do */
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Nothing to do for external "
-		    "function %s\n", fun->pathname);
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		return EOK;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Quiescing inner function %s.",
-	    fun->pathname);
-
-	if (fun->child == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Function %s child is NULL.",
-		    fun->pathname);
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		return EOK;
-	}
-
-	dev_node_t *dev = fun->child;
-	device_state_t dev_state;
-
-	dev_add_ref(dev);
-	dev_state = dev->state;
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	/* If device is owned by driver, ask driver to quiesce it. */
-	if (dev_state == DEVICE_USABLE) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Call driver_dev_quiesce() "
-		    "for %s.", fun->pathname);
-		rc = driver_dev_quiesce(&device_tree, dev);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "driver_dev_quiesce() -> %d", (int)rc);
-			dev_del_ref(dev);
-			return ENOTSUP;
-		}
-	}
-
-	dev_del_ref(dev);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/devman/fun.h
===================================================================
--- uspace/srv/devman/fun.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef FUN_H_
-#define FUN_H_
-
-#include "devman.h"
-
-extern fun_node_t *create_fun_node(void);
-extern void delete_fun_node(fun_node_t *);
-extern void fun_add_ref(fun_node_t *);
-extern void fun_del_ref(fun_node_t *);
-extern void fun_busy_lock(fun_node_t *);
-extern void fun_busy_unlock(fun_node_t *);
-extern fun_node_t *find_fun_node_no_lock(dev_tree_t *, devman_handle_t);
-extern fun_node_t *find_fun_node(dev_tree_t *, devman_handle_t);
-extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *);
-extern fun_node_t *find_fun_node_in_device(dev_tree_t *tree, dev_node_t *,
-    const char *);
-extern bool set_fun_path(dev_tree_t *, fun_node_t *, fun_node_t *);
-extern errno_t fun_online(fun_node_t *);
-extern errno_t fun_offline(fun_node_t *);
-extern errno_t fun_quiesce(fun_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/loc.c
===================================================================
--- uspace/srv/devman/loc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <loc.h>
-#include <stdio.h>
-
-#include "devman.h"
-#include "fun.h"
-#include "loc.h"
-#include "main.h"
-
-/** Create loc path and name for the function. */
-void loc_register_tree_function(fun_node_t *fun, dev_tree_t *tree)
-{
-	char *loc_pathname = NULL;
-	char *loc_name = NULL;
-
-	assert(fibril_rwlock_is_locked(&tree->rwlock));
-
-	asprintf(&loc_name, "%s", fun->pathname);
-	if (loc_name == NULL)
-		return;
-
-	replace_char(loc_name, '/', LOC_SEPARATOR);
-
-	asprintf(&loc_pathname, "%s/%s", LOC_DEVICE_NAMESPACE,
-	    loc_name);
-	if (loc_pathname == NULL) {
-		free(loc_name);
-		return;
-	}
-
-	loc_service_register(devman_srv, loc_pathname, &fun->service_id);
-
-	tree_add_loc_function(tree, fun);
-
-	free(loc_name);
-	free(loc_pathname);
-}
-
-errno_t loc_unregister_tree_function(fun_node_t *fun, dev_tree_t *tree)
-{
-	errno_t rc = loc_service_unregister(devman_srv, fun->service_id);
-	tree_rem_loc_function(tree, fun);
-	return rc;
-}
-
-fun_node_t *find_loc_tree_function(dev_tree_t *tree, service_id_t service_id)
-{
-	fun_node_t *fun = NULL;
-
-	fibril_rwlock_read_lock(&tree->rwlock);
-	ht_link_t *link = hash_table_find(&tree->loc_functions, &service_id);
-	if (link != NULL) {
-		fun = hash_table_get_inst(link, fun_node_t, loc_fun);
-		fun_add_ref(fun);
-	}
-	fibril_rwlock_read_unlock(&tree->rwlock);
-
-	return fun;
-}
-
-void tree_add_loc_function(dev_tree_t *tree, fun_node_t *fun)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	hash_table_insert(&tree->loc_functions, &fun->loc_fun);
-}
-
-void tree_rem_loc_function(dev_tree_t *tree, fun_node_t *fun)
-{
-	assert(fibril_rwlock_is_write_locked(&tree->rwlock));
-
-	hash_table_remove(&tree->loc_functions, &fun->service_id);
-}
-
-/** @}
- */
Index: pace/srv/devman/loc.h
===================================================================
--- uspace/srv/devman/loc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef LOC_H_
-#define LOC_H_
-
-#include <ipc/loc.h>
-#include "devman.h"
-
-extern void loc_register_tree_function(fun_node_t *, dev_tree_t *);
-extern errno_t loc_unregister_tree_function(fun_node_t *, dev_tree_t *);
-extern fun_node_t *find_loc_tree_function(dev_tree_t *, service_id_t);
-extern void tree_add_loc_function(dev_tree_t *, fun_node_t *);
-extern void tree_rem_loc_function(dev_tree_t *, fun_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,382 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup devman
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <io/log.h>
-#include <ipc/devman.h>
-#include <loc.h>
-
-#include "client_conn.h"
-#include "dev.h"
-#include "devman.h"
-#include "devtree.h"
-#include "drv_conn.h"
-#include "driver.h"
-#include "fun.h"
-#include "loc.h"
-
-#define DRIVER_DEFAULT_STORE  "/drv"
-
-driver_list_t drivers_list;
-dev_tree_t device_tree;
-loc_srv_t *devman_srv;
-
-static void devman_connection_device(ipc_call_t *icall, void *arg)
-{
-	devman_handle_t handle = ipc_get_arg2(icall);
-	dev_node_t *dev = NULL;
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		dev = find_dev_node(&device_tree, handle);
-	} else {
-		fibril_rwlock_read_lock(&device_tree.rwlock);
-
-		dev = fun->dev;
-		if (dev != NULL)
-			dev_add_ref(dev);
-
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-	}
-
-	/*
-	 * For a valid function to connect to we need a device. The root
-	 * function, for example, has no device and cannot be connected to.
-	 * This means @c dev needs to be valid regardless whether we are
-	 * connecting to a device or to a function.
-	 */
-	if (dev == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
-		    "function with handle %" PRIun " was found.", handle);
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	if (fun == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, NAME ": devman_forward error - cannot "
-		    "connect to handle %" PRIun ", refers to a device.",
-		    handle);
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Connect to the specified function */
-	driver_t *driver = dev->drv;
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	if (driver == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - "
-		    "the device %" PRIun " is not in usable state.", handle);
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	if (!driver->sess) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Could not forward to driver `%s'.", driver->name);
-		async_answer_0(icall, EINVAL);
-		goto cleanup;
-	}
-
-	if (fun != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "Forwarding request for `%s' function to driver `%s'.",
-		    fun->pathname, driver->name);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "Forwarding request for `%s' device to driver `%s'.",
-		    dev->pfun->pathname, driver->name);
-	}
-
-	async_exch_t *exch = async_exchange_begin(driver->sess);
-	async_forward_1(icall, exch, INTERFACE_DDF_CLIENT, handle, IPC_FF_NONE);
-	async_exchange_end(exch);
-
-cleanup:
-	if (dev != NULL)
-		dev_del_ref(dev);
-
-	if (fun != NULL)
-		fun_del_ref(fun);
-}
-
-static void devman_connection_parent(ipc_call_t *icall, void *arg)
-{
-	devman_handle_t handle = ipc_get_arg2(icall);
-	dev_node_t *dev = NULL;
-
-	fun_node_t *fun = find_fun_node(&device_tree, handle);
-	if (fun == NULL) {
-		dev = find_dev_node(&device_tree, handle);
-	} else {
-		fibril_rwlock_read_lock(&device_tree.rwlock);
-
-		dev = fun->dev;
-		if (dev != NULL)
-			dev_add_ref(dev);
-
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-	}
-
-	/*
-	 * For a valid function to connect to we need a device. The root
-	 * function, for example, has no device and cannot be connected to.
-	 * This means @c dev needs to be valid regardless whether we are
-	 * connecting to a device or to a function.
-	 */
-	if (dev == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding failed - no device or "
-		    "function with handle %" PRIun " was found.", handle);
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	driver_t *driver = NULL;
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	/* Connect to parent function of a device (or device function). */
-	if (dev->pfun->dev != NULL)
-		driver = dev->pfun->dev->drv;
-
-	devman_handle_t fun_handle = dev->pfun->handle;
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	if (driver == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "IPC forwarding refused - "
-		    "the device %" PRIun " is not in usable state.", handle);
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	if (!driver->sess) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Could not forward to driver `%s'.", driver->name);
-		async_answer_0(icall, EINVAL);
-		goto cleanup;
-	}
-
-	if (fun != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "Forwarding request for `%s' function to driver `%s'.",
-		    fun->pathname, driver->name);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "Forwarding request for `%s' device to driver `%s'.",
-		    dev->pfun->pathname, driver->name);
-	}
-
-	async_exch_t *exch = async_exchange_begin(driver->sess);
-	async_forward_1(icall, exch, INTERFACE_DDF_DRIVER, fun_handle, IPC_FF_NONE);
-	async_exchange_end(exch);
-
-cleanup:
-	if (dev != NULL)
-		dev_del_ref(dev);
-
-	if (fun != NULL)
-		fun_del_ref(fun);
-}
-
-static void devman_forward(ipc_call_t *icall, void *arg)
-{
-	iface_t iface = ipc_get_arg1(icall);
-	service_id_t service_id = ipc_get_arg2(icall);
-
-	fun_node_t *fun = find_loc_tree_function(&device_tree, service_id);
-
-	fibril_rwlock_read_lock(&device_tree.rwlock);
-
-	if ((fun == NULL) || (fun->dev == NULL) || (fun->dev->drv == NULL)) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "devman_forward(): function "
-		    "not found.\n");
-		fibril_rwlock_read_unlock(&device_tree.rwlock);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	dev_node_t *dev = fun->dev;
-	driver_t *driver = dev->drv;
-	devman_handle_t handle = fun->handle;
-
-	fibril_rwlock_read_unlock(&device_tree.rwlock);
-
-	async_exch_t *exch = async_exchange_begin(driver->sess);
-	async_forward_1(icall, exch, iface, handle, IPC_FF_NONE);
-	async_exchange_end(exch);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "Forwarding service request for `%s' function to driver `%s'.",
-	    fun->pathname, driver->name);
-
-	fun_del_ref(fun);
-}
-
-static void *devman_client_data_create(void)
-{
-	client_t *client;
-
-	client = calloc(1, sizeof(client_t));
-	if (client == NULL)
-		return NULL;
-
-	fibril_mutex_initialize(&client->mutex);
-	return client;
-}
-
-static void devman_client_data_destroy(void *data)
-{
-	free(data);
-}
-
-/** Initialize device manager internal structures. */
-static bool devman_init(void)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_init - looking for available drivers.");
-
-	/* Initialize list of available drivers. */
-	init_driver_list(&drivers_list);
-	if (lookup_available_drivers(&drivers_list,
-	    DRIVER_DEFAULT_STORE) == 0) {
-		log_msg(LOG_DEFAULT, LVL_FATAL, "No drivers found.");
-		return false;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_init - list of drivers has been initialized.");
-
-	/* Create root device node. */
-	if (!init_device_tree(&device_tree, &drivers_list)) {
-		log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to initialize device tree.");
-		return false;
-	}
-
-	/*
-	 * Caution: As the device manager is not a real loc
-	 * driver (it uses a completely different IPC protocol
-	 * than an ordinary loc driver), forwarding a connection
-	 * from client to the devman by location service will
-	 * not work.
-	 */
-	rc = loc_server_register(NAME, &devman_srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_FATAL, "Error registering devman server.");
-		return false;
-	}
-
-	return true;
-}
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS Device Manager\n", NAME);
-
-	errno_t rc = log_init(NAME);
-	if (rc != EOK) {
-		printf("%s: Error initializing logging subsystem: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	/* Set handlers for incoming connections. */
-	async_set_client_data_constructor(devman_client_data_create);
-	async_set_client_data_destructor(devman_client_data_destroy);
-
-	async_set_fallback_port_handler(devman_forward, NULL);
-
-	if (!devman_init()) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error while initializing service.");
-		return -1;
-	}
-
-	/* Register device manager at naming service. */
-	rc = service_register(SERVICE_DEVMAN, INTERFACE_DDF_DRIVER,
-	    devman_connection_driver, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering driver port: %s", str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_DEVMAN, INTERFACE_DDF_CLIENT,
-	    devman_connection_client, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering client port: %s", str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_DEVMAN, INTERFACE_DEVMAN_DEVICE,
-	    devman_connection_device, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering device port: %s", str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_DEVMAN, INTERFACE_DEVMAN_PARENT,
-	    devman_connection_parent, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering parent port: %s", str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections.\n", NAME);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Wait for device tree to stabilize.");
-	dev_tree_wait_stable(&device_tree);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Device tree stable.");
-	task_retval(0);
-	async_manager();
-
-	/* Never reached. */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/devman/main.h
===================================================================
--- uspace/srv/devman/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef MAIN_H_
-#define MAIN_H_
-
-#include <loc.h>
-#include "devman.h"
-
-extern driver_list_t drivers_list;
-extern dev_tree_t device_tree;
-extern loc_srv_t *devman_srv;
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/match.c
===================================================================
--- uspace/srv/devman/match.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,253 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <str.h>
-#include <str_error.h>
-#include <stddef.h>
-#include <vfs/vfs.h>
-
-#include "devman.h"
-#include "match.h"
-
-#define COMMENT	'#'
-
-/** Compute compound score of driver and device.
- *
- * @param driver Match id of the driver.
- * @param device Match id of the device.
- * @return Compound score.
- * @retval 0 No match at all.
- */
-static int compute_match_score(match_id_t *driver, match_id_t *device)
-{
-	if (str_cmp(driver->id, device->id) == 0) {
-		/*
-		 * The strings match, return the product of their scores.
-		 */
-		return driver->score * device->score;
-	} else {
-		/*
-		 * Different strings, return zero.
-		 */
-		return 0;
-	}
-}
-
-int get_match_score(driver_t *drv, dev_node_t *dev)
-{
-	link_t *drv_head = &drv->match_ids.ids.head;
-	link_t *dev_head = &dev->pfun->match_ids.ids.head;
-
-	if (list_empty(&drv->match_ids.ids) ||
-	    list_empty(&dev->pfun->match_ids.ids)) {
-		return 0;
-	}
-
-	/*
-	 * Go through all pairs, return the highest score obtained.
-	 */
-	int highest_score = 0;
-
-	link_t *drv_link = drv->match_ids.ids.head.next;
-	while (drv_link != drv_head) {
-		link_t *dev_link = dev_head->next;
-		while (dev_link != dev_head) {
-			match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link);
-			match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link);
-
-			int score = compute_match_score(drv_id, dev_id);
-			if (score > highest_score) {
-				highest_score = score;
-			}
-
-			dev_link = dev_link->next;
-		}
-
-		drv_link = drv_link->next;
-	}
-
-	return highest_score;
-}
-
-/** Read match id at the specified position of a string and set the position in
- * the string to the first character following the id.
- *
- * @param buf		The position in the input string.
- * @return		The match id.
- */
-char *read_match_id(char **buf)
-{
-	char *res = NULL;
-	size_t len = get_nonspace_len(*buf);
-
-	if (len > 0) {
-		res = malloc(len + 1);
-		if (res != NULL) {
-			str_ncpy(res, len + 1, *buf, len);
-			*buf += len;
-		}
-	}
-
-	return res;
-}
-
-/**
- * Read match ids and associated match scores from a string.
- *
- * Each match score in the string is followed by its match id.
- * The match ids and match scores are separated by whitespaces.
- * Neither match ids nor match scores can contain whitespaces.
- *
- * @param buf		The string from which the match ids are read.
- * @param ids		The list of match ids into which the match ids and
- *			scores are added.
- * @return		True if at least one match id and associated match score
- *			was successfully read, false otherwise.
- */
-bool parse_match_ids(char *buf, match_id_list_t *ids)
-{
-	int score = 0;
-	char *id = NULL;
-	int ids_read = 0;
-
-	while (true) {
-		/* skip spaces */
-		if (!skip_spaces(&buf))
-			break;
-
-		if (*buf == COMMENT) {
-			skip_line(&buf);
-			continue;
-		}
-
-		/* read score */
-		score = strtoul(buf, &buf, 10);
-
-		/* skip spaces */
-		if (!skip_spaces(&buf))
-			break;
-
-		/* read id */
-		id = read_match_id(&buf);
-		if (NULL == id)
-			break;
-
-		/* create new match_id structure */
-		match_id_t *mid = create_match_id();
-		mid->id = id;
-		mid->score = score;
-
-		/* add it to the list */
-		add_match_id(ids, mid);
-
-		ids_read++;
-	}
-
-	return ids_read > 0;
-}
-
-/**
- * Read match ids and associated match scores from a file.
- *
- * Each match score in the file is followed by its match id.
- * The match ids and match scores are separated by whitespaces.
- * Neither match ids nor match scores can contain whitespaces.
- *
- * @param buf		The path to the file from which the match ids are read.
- * @param ids		The list of match ids into which the match ids and
- *			scores are added.
- * @return		True if at least one match id and associated match score
- *			was successfully read, false otherwise.
- */
-bool read_match_ids(const char *conf_path, match_id_list_t *ids)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "read_match_ids(conf_path=\"%s\")", conf_path);
-
-	bool suc = false;
-	char *buf = NULL;
-	bool opened = false;
-	int fd;
-	size_t len = 0;
-	vfs_stat_t st;
-
-	errno_t rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
-		    conf_path, str_error(rc));
-		goto cleanup;
-	}
-	opened = true;
-
-	rc = vfs_stat(fd, &st);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to fstat %d: %s.", fd,
-		    str_error(rc));
-		goto cleanup;
-	}
-	len = st.size;
-	if (len == 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Configuration file '%s' is empty.",
-		    conf_path);
-		goto cleanup;
-	}
-
-	buf = malloc(len + 1);
-	if (buf == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed when parsing file "
-		    "'%s'.", conf_path);
-		goto cleanup;
-	}
-
-	size_t read_bytes;
-	rc = vfs_read(fd, (aoff64_t []) { 0 }, buf, len, &read_bytes);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to read file '%s': %s.", conf_path,
-		    str_error(rc));
-		goto cleanup;
-	}
-	buf[read_bytes] = 0;
-
-	suc = parse_match_ids(buf, ids);
-
-cleanup:
-	free(buf);
-
-	if (opened)
-		vfs_put(fd);
-
-	return suc;
-}
-
-/** @}
- */
Index: pace/srv/devman/match.h
===================================================================
--- uspace/srv/devman/match.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef MATCH_H_
-#define MATCH_H_
-
-#include <stdbool.h>
-
-#include "devman.h"
-
-#define MATCH_EXT ".ma"
-
-extern int get_match_score(driver_t *, dev_node_t *);
-extern bool parse_match_ids(char *, match_id_list_t *);
-extern bool read_match_ids(const char *, match_id_list_t *);
-extern char *read_match_id(char **);
-extern char *read_id(const char **);
-
-#endif
-
-/** @}
- */
Index: pace/srv/devman/meson.build
===================================================================
--- uspace/srv/devman/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files(
-	'client_conn.c',
-	'dev.c',
-	'devtree.c',
-	'drv_conn.c',
-	'driver.c',
-	'loc.c',
-	'fun.c',
-	'main.c',
-	'match.c',
-	'util.c',
-)
Index: pace/srv/devman/util.c
===================================================================
--- uspace/srv/devman/util.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,103 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#include <stdlib.h>
-#include <str.h>
-
-#include "util.h"
-
-char *get_abs_path(const char *base_path, const char *name, const char *ext)
-{
-	char *res;
-	int base_len = str_size(base_path);
-	int size = base_len + 2 * str_size(name) + str_size(ext) + 3;
-
-	res = malloc(size);
-
-	if (res) {
-		str_cpy(res, size, base_path);
-		if (base_path[base_len - 1] != '/')
-			str_append(res, size, "/");
-		str_append(res, size, name);
-		str_append(res, size, "/");
-		str_append(res, size, name);
-		if (ext[0] != '.')
-			str_append(res, size, ".");
-		str_append(res, size, ext);
-	}
-
-	return res;
-}
-
-char *get_path_elem_end(char *path)
-{
-	while (*path != '\0' && *path != '/')
-		path++;
-	return path;
-}
-
-bool skip_spaces(char **buf)
-{
-	while (isspace(**buf))
-		(*buf)++;
-	return *buf != 0;
-}
-
-void skip_line(char **buf)
-{
-	while (**buf && **buf != '\n')
-		(*buf)++;
-}
-
-size_t get_nonspace_len(const char *str)
-{
-	size_t len = 0;
-
-	while (*str != '\0' && !isspace(*str)) {
-		len++;
-		str++;
-	}
-
-	return len;
-}
-
-void replace_char(char *str, char orig, char repl)
-{
-	while (*str) {
-		if (*str == orig)
-			*str = repl;
-		str++;
-	}
-}
-
-/** @}
- */
Index: pace/srv/devman/util.h
===================================================================
--- uspace/srv/devman/util.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2010 Lenka Trochtova
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup devman
- * @{
- */
-
-#ifndef DEVMAN_UTIL_H_
-#define DEVMAN_UTIL_H_
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <str.h>
-
-extern char *get_abs_path(const char *, const char *, const char *);
-extern char *get_path_elem_end(char *);
-
-extern bool skip_spaces(char **);
-extern void skip_line(char **);
-extern size_t get_nonspace_len(const char *);
-extern void replace_char(char *, char, char);
-
-#endif
-
-/** @}
- */
Index: pace/srv/fs/cdfs/cdfs.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2010 Jiri Kavalik
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cdfs
- * @{
- */
-
-/**
- * @file cdfs.c
- * @brief File system driver for ISO9660 file system.
- */
-
-#include <ipc/services.h>
-#include <ns.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <libfs.h>
-#include <str.h>
-#include "cdfs.h"
-#include "cdfs_ops.h"
-
-#define NAME  "cdfs"
-
-static vfs_info_t cdfs_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS cdfs file system server\n", NAME);
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			cdfs_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf(NAME " Unrecognized parameters");
-			return -1;
-		}
-	}
-
-	if (!cdfs_init()) {
-		printf("%s: failed to initialize cdfs\n", NAME);
-		return -1;
-	}
-
-	errno_t rc;
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
-		return -1;
-	}
-
-	rc = fs_register(vfs_sess, &cdfs_vfs_info, &cdfs_ops,
-	    &cdfs_libfs_ops);
-	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/cdfs/cdfs.h
===================================================================
--- uspace/srv/fs/cdfs/cdfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cdfs
- * @{
- */
-
-#ifndef CDFS_CDFS_H_
-#define CDFS_CDFS_H_
-
-#include <libfs.h>
-
-extern vfs_out_ops_t cdfs_ops;
-extern libfs_ops_t cdfs_libfs_ops;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/cdfs/cdfs_endian.h
===================================================================
--- uspace/srv/fs/cdfs/cdfs_endian.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cdfs
- * @{
- */
-
-#ifndef CDFS_CDFS_ENDIAN_H_
-#define CDFS_CDFS_ENDIAN_H_
-
-#include <stdint.h>
-
-#if !(defined(__BE__) ^ defined(__LE__))
-#error The architecture must be either big-endian or little-endian.
-#endif
-
-typedef struct {
-	uint16_t le;
-	uint16_t be;
-} __attribute__((packed)) uint16_t_lb;
-
-typedef struct {
-	uint32_t le;
-	uint32_t be;
-} __attribute__((packed)) uint32_t_lb;
-
-static inline uint16_t uint16_lb(uint16_t_lb val)
-{
-#ifdef __LE__
-	return val.le;
-#endif
-
-#ifdef __BE__
-	return val.be;
-#endif
-}
-
-static inline uint32_t uint32_lb(uint32_t_lb val)
-{
-#ifdef __LE__
-	return val.le;
-#endif
-
-#ifdef __BE__
-	return val.be;
-#endif
-}
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/cdfs/cdfs_ops.c
===================================================================
--- uspace/srv/fs/cdfs/cdfs_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1449 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cdfs
- * @{
- */
-
-/**
- * @file cdfs_ops.c
- * @brief Implementation of VFS operations for the cdfs file system
- *        server.
- */
-
-#include "cdfs_ops.h"
-#include <stdbool.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <mem.h>
-#include <loc.h>
-#include <libfs.h>
-#include <errno.h>
-#include <block.h>
-#include <scsi/mmc.h>
-#include <stdlib.h>
-#include <str.h>
-#include <byteorder.h>
-#include <macros.h>
-#include <unaligned.h>
-
-#include "cdfs.h"
-#include "cdfs_endian.h"
-
-/** Standard CD-ROM block size */
-#define BLOCK_SIZE  2048
-
-#define NODE_CACHE_SIZE 200
-
-/** All root nodes have index 0 */
-#define CDFS_SOME_ROOT  0
-
-#define CDFS_NODE(node)  ((node) ? (cdfs_node_t *)(node)->data : NULL)
-#define FS_NODE(node)    ((node) ? (node)->fs_node : NULL)
-
-#define CDFS_STANDARD_IDENT  "CD001"
-
-enum {
-	CDFS_NAME_CURDIR = '\x00',
-	CDFS_NAME_PARENTDIR = '\x01'
-};
-
-typedef enum {
-	VOL_DESC_BOOT = 0,
-	VOL_DESC_PRIMARY = 1,
-	VOL_DESC_SUPPLEMENTARY = 2,
-	VOL_DESC_VOL_PARTITION = 3,
-	VOL_DESC_SET_TERMINATOR = 255
-} vol_desc_type_t;
-
-typedef struct {
-	uint8_t system_ident[32];
-	uint8_t ident[32];
-} __attribute__((packed)) cdfs_vol_desc_boot_t;
-
-typedef struct {
-	uint8_t year[4];
-	uint8_t mon[2];
-	uint8_t day[2];
-
-	uint8_t hour[2];
-	uint8_t min[2];
-	uint8_t sec[2];
-	uint8_t msec[2];
-
-	uint8_t offset;
-} __attribute__((packed)) cdfs_datetime_t;
-
-typedef struct {
-	uint8_t year;  /**< Since 1900 */
-	uint8_t mon;
-	uint8_t day;
-
-	uint8_t hour;
-	uint8_t min;
-	uint8_t sec;
-
-	uint8_t offset;
-} __attribute__((packed)) cdfs_timestamp_t;
-
-typedef enum {
-	DIR_FLAG_DIRECTORY = 2
-} cdfs_dir_flag_t;
-
-/** Directory record */
-typedef struct {
-	uint8_t length;
-	uint8_t ea_length;
-
-	uint32_t_lb lba;
-	uint32_t_lb size;
-
-	cdfs_timestamp_t timestamp;
-	uint8_t flags;
-	uint8_t unit_size;
-	uint8_t gap_size;
-	uint16_t_lb sequence_nr;
-
-	uint8_t name_length;
-	uint8_t name[];
-} __attribute__((packed)) cdfs_dir_t;
-
-/** Directory record for the root directory */
-typedef struct {
-	uint8_t length;
-	uint8_t ea_length;
-
-	uint32_t_lb lba;
-	uint32_t_lb size;
-
-	cdfs_timestamp_t timestamp;
-	uint8_t flags;
-	uint8_t unit_size;
-	uint8_t gap_size;
-	uint16_t_lb sequence_nr;
-
-	uint8_t name_length;
-	uint8_t name[1];
-} __attribute__((packed)) cdfs_root_dir_t;
-
-typedef struct {
-	uint8_t flags; /* reserved in primary */
-
-	uint8_t system_ident[32];
-	uint8_t ident[32];
-
-	uint64_t res1;
-	uint32_t_lb lba_size;
-
-	uint8_t esc_seq[32]; /* reserved in primary */
-	uint16_t_lb set_size;
-	uint16_t_lb sequence_nr;
-
-	uint16_t_lb block_size;
-	uint32_t_lb path_table_size;
-
-	uint32_t path_table_lsb;
-	uint32_t opt_path_table_lsb;
-	uint32_t path_table_msb;
-	uint32_t opt_path_table_msb;
-
-	cdfs_root_dir_t root_dir;
-	uint8_t pad0;
-
-	uint8_t set_ident[128];
-	uint8_t publisher_ident[128];
-	uint8_t preparer_ident[128];
-	uint8_t app_ident[128];
-
-	uint8_t copyright_file_ident[37];
-	uint8_t abstract_file_ident[37];
-	uint8_t biblio_file_ident[37];
-
-	cdfs_datetime_t creation;
-	cdfs_datetime_t modification;
-	cdfs_datetime_t expiration;
-	cdfs_datetime_t effective;
-
-	uint8_t fs_version;
-} __attribute__((packed)) cdfs_vol_desc_prisec_t;
-
-typedef struct {
-	uint8_t type;
-	uint8_t standard_ident[5];
-	uint8_t version;
-	union {
-		cdfs_vol_desc_boot_t boot;
-		cdfs_vol_desc_prisec_t prisec;
-	} data;
-} __attribute__((packed)) cdfs_vol_desc_t;
-
-typedef enum {
-	/** ASCII character set / encoding (base ISO 9660) */
-	enc_ascii,
-	/** UCS-2 character set / encoding (Joliet) */
-	enc_ucs2
-} cdfs_enc_t;
-
-typedef enum {
-	CDFS_NONE,
-	CDFS_FILE,
-	CDFS_DIRECTORY
-} cdfs_dentry_type_t;
-
-typedef struct {
-	link_t link;       /**< Siblings list link */
-	fs_index_t index;  /**< Node index */
-	char *name;        /**< Dentry name */
-} cdfs_dentry_t;
-
-typedef uint32_t cdfs_lba_t;
-
-typedef struct {
-	link_t link;		  /**< Link to list of all instances */
-	service_id_t service_id;  /**< Service ID of block device */
-	cdfs_enc_t enc;		  /**< Filesystem string encoding */
-	char *vol_ident;	  /**< Volume identifier */
-} cdfs_t;
-
-typedef struct {
-	fs_node_t *fs_node;       /**< FS node */
-	fs_index_t index;         /**< Node index */
-	cdfs_t *fs;		  /**< File system */
-
-	ht_link_t nh_link;        /**< Nodes hash table link */
-	cdfs_dentry_type_t type;  /**< Dentry type */
-
-	unsigned int lnkcnt;      /**< Link count */
-	uint32_t size;            /**< File size if type is CDFS_FILE */
-
-	list_t cs_list;           /**< Child's siblings list */
-	cdfs_lba_t lba;           /**< LBA of data on disk */
-	bool processed;           /**< If all children have been read */
-	unsigned int opened;      /**< Opened count */
-} cdfs_node_t;
-
-/** String encoding */
-enum {
-	/** ASCII - standard ISO 9660 */
-	ucs2_esc_seq_no = 3,
-	/** USC-2 - Joliet */
-	ucs2_esc_seq_len = 3
-};
-
-/** Joliet SVD UCS-2 escape sequences */
-static uint8_t ucs2_esc_seq[ucs2_esc_seq_no][ucs2_esc_seq_len] = {
-	{ 0x25, 0x2f, 0x40 },
-	{ 0x25, 0x2f, 0x43 },
-	{ 0x25, 0x2f, 0x45 }
-};
-
-/** List of all instances */
-static LIST_INITIALIZE(cdfs_instances);
-
-/** Shared index of nodes */
-static fs_index_t cdfs_index = 1;
-
-/** Number of currently cached nodes */
-static size_t nodes_cached = 0;
-
-/** Hash table of all cdfs nodes */
-static hash_table_t nodes;
-
-/*
- * Hash table support functions.
- */
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} ht_key_t;
-
-static size_t nodes_key_hash(const void *k)
-{
-	const ht_key_t *key = k;
-	return hash_combine(key->service_id, key->index);
-}
-
-static size_t nodes_hash(const ht_link_t *item)
-{
-	cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
-	return hash_combine(node->fs->service_id, node->index);
-}
-
-static bool nodes_key_equal(const void *k, size_t hash, const ht_link_t *item)
-{
-	cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
-	const ht_key_t *key = k;
-
-	return key->service_id == node->fs->service_id && key->index == node->index;
-}
-
-static void nodes_remove_callback(ht_link_t *item)
-{
-	cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
-
-	if (node->type == CDFS_DIRECTORY) {
-		link_t *link;
-		while ((link = list_first(&node->cs_list)) != NULL) {
-			cdfs_dentry_t *dentry = list_get_instance(link, cdfs_dentry_t, link);
-			list_remove(&dentry->link);
-			free(dentry);
-		}
-	}
-
-	free(node->fs_node);
-	free(node);
-}
-
-/** Nodes hash table operations */
-static const hash_table_ops_t nodes_ops = {
-	.hash = nodes_hash,
-	.key_hash = nodes_key_hash,
-	.key_equal = nodes_key_equal,
-	.equal = NULL,
-	.remove_callback = nodes_remove_callback
-};
-
-static errno_t cdfs_node_get(fs_node_t **rfn, service_id_t service_id,
-    fs_index_t index)
-{
-	ht_key_t key = {
-		.index = index,
-		.service_id = service_id
-	};
-
-	ht_link_t *link = hash_table_find(&nodes, &key);
-	if (link) {
-		cdfs_node_t *node =
-		    hash_table_get_inst(link, cdfs_node_t, nh_link);
-
-		*rfn = FS_NODE(node);
-	} else
-		*rfn = NULL;
-
-	return EOK;
-}
-
-static errno_t cdfs_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return cdfs_node_get(rfn, service_id, CDFS_SOME_ROOT);
-}
-
-static void cdfs_node_initialize(cdfs_node_t *node)
-{
-	node->fs_node = NULL;
-	node->index = 0;
-	node->fs = NULL;
-	node->type = CDFS_NONE;
-	node->lnkcnt = 0;
-	node->size = 0;
-	node->lba = 0;
-	node->processed = false;
-	node->opened = 0;
-
-	list_initialize(&node->cs_list);
-}
-
-static errno_t create_node(fs_node_t **rfn, cdfs_t *fs, int lflag,
-    fs_index_t index)
-{
-	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
-
-	cdfs_node_t *node = malloc(sizeof(cdfs_node_t));
-	if (!node)
-		return ENOMEM;
-
-	cdfs_node_initialize(node);
-
-	node->fs_node = malloc(sizeof(fs_node_t));
-	if (!node->fs_node) {
-		free(node);
-		return ENOMEM;
-	}
-
-	fs_node_initialize(node->fs_node);
-	node->fs_node->data = node;
-
-	fs_node_t *rootfn;
-	errno_t rc = cdfs_root_get(&rootfn, fs->service_id);
-
-	assert(rc == EOK);
-
-	if (!rootfn)
-		node->index = CDFS_SOME_ROOT;
-	else
-		node->index = index;
-
-	node->fs = fs;
-
-	if (lflag & L_DIRECTORY)
-		node->type = CDFS_DIRECTORY;
-	else
-		node->type = CDFS_FILE;
-
-	/* Insert the new node into the nodes hash table. */
-	hash_table_insert(&nodes, &node->nh_link);
-
-	*rfn = FS_NODE(node);
-	nodes_cached++;
-
-	return EOK;
-}
-
-static errno_t link_node(fs_node_t *pfn, fs_node_t *fn, const char *name)
-{
-	cdfs_node_t *parent = CDFS_NODE(pfn);
-	cdfs_node_t *node = CDFS_NODE(fn);
-
-	assert(parent->type == CDFS_DIRECTORY);
-
-	/* Check for duplicate entries */
-	list_foreach(parent->cs_list, link, cdfs_dentry_t, dentry) {
-		if (str_cmp(dentry->name, name) == 0)
-			return EEXIST;
-	}
-
-	/* Allocate and initialize the dentry */
-	cdfs_dentry_t *dentry = malloc(sizeof(cdfs_dentry_t));
-	if (!dentry)
-		return ENOMEM;
-
-	/* Populate and link the new dentry */
-	dentry->name = str_dup(name);
-	if (dentry->name == NULL) {
-		free(dentry);
-		return ENOMEM;
-	}
-
-	link_initialize(&dentry->link);
-	dentry->index = node->index;
-
-	node->lnkcnt++;
-	list_append(&dentry->link, &parent->cs_list);
-
-	return EOK;
-}
-
-/** Decode CDFS string.
- *
- * @param data	Pointer to string data
- * @param dsize	Size of data in bytes
- * @param enc	String encoding
- * @return	Decoded string
- */
-static char *cdfs_decode_str(void *data, size_t dsize, cdfs_enc_t enc)
-{
-	errno_t rc;
-	char *str;
-	uint16_t *buf;
-
-	switch (enc) {
-	case enc_ascii:
-		str = malloc(dsize + 1);
-		if (str == NULL)
-			return NULL;
-		memcpy(str, data, dsize);
-		str[dsize] = '\0';
-		break;
-	case enc_ucs2:
-		buf = calloc(dsize + 2, 1);
-		if (buf == NULL)
-			return NULL;
-
-		size_t i;
-		for (i = 0; i < dsize / sizeof(uint16_t); i++) {
-			buf[i] = uint16_t_be2host(
-			    ((unaligned_uint16_t *)data)[i]);
-		}
-
-		size_t dstr_size = dsize / sizeof(uint16_t) * 4 + 1;
-		str = malloc(dstr_size);
-		if (str == NULL)
-			return NULL;
-
-		rc = utf16_to_str(str, dstr_size, buf);
-		free(buf);
-
-		if (rc != EOK)
-			return NULL;
-		break;
-	default:
-		assert(false);
-		str = NULL;
-	}
-
-	return str;
-}
-
-/** Decode file name.
- *
- * @param data	File name buffer
- * @param dsize	Fine name buffer size
- * @param enc   Encoding
- * @param dtype	Directory entry type
- * @return	Decoded file name (allocated string)
- */
-static char *cdfs_decode_name(void *data, size_t dsize, cdfs_enc_t enc,
-    cdfs_dentry_type_t dtype)
-{
-	char *name;
-	char *dot;
-	char *scolon;
-
-	name = cdfs_decode_str(data, dsize, enc);
-	if (name == NULL)
-		return NULL;
-
-	if (dtype == CDFS_DIRECTORY)
-		return name;
-
-	dot = str_chr(name, '.');
-
-	if (dot != NULL) {
-		scolon = str_chr(dot, ';');
-		if (scolon != NULL) {
-			/* Trim version part */
-			*scolon = '\0';
-		}
-
-		/* If the extension is an empty string, trim the dot separator. */
-		if (dot[1] == '\0')
-			*dot = '\0';
-	}
-
-	return name;
-}
-
-/** Decode volume identifier.
- *
- * @param data	Volume identifier buffer
- * @param dsize	Volume identifier buffer size
- * @param enc   Encoding
- * @return	Decoded volume identifier (allocated string)
- */
-static char *cdfs_decode_vol_ident(void *data, size_t dsize, cdfs_enc_t enc)
-{
-	char *ident;
-	size_t i;
-
-	ident = cdfs_decode_str(data, dsize, enc);
-	if (ident == NULL)
-		return NULL;
-
-	/* Trim trailing spaces */
-	i = str_size(ident);
-	while (i > 0 && ident[i - 1] == ' ')
-		--i;
-	ident[i] = '\0';
-
-	return ident;
-}
-
-static errno_t cdfs_readdir(cdfs_t *fs, fs_node_t *fs_node)
-{
-	cdfs_node_t *node = CDFS_NODE(fs_node);
-	assert(node);
-
-	if (node->processed)
-		return EOK;
-
-	uint32_t blocks = node->size / BLOCK_SIZE;
-	if ((node->size % BLOCK_SIZE) != 0)
-		blocks++;
-
-	for (uint32_t i = 0; i < blocks; i++) {
-		block_t *block;
-		errno_t rc = block_get(&block, fs->service_id, node->lba + i, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		cdfs_dir_t *dir;
-
-		for (size_t offset = 0; offset < BLOCK_SIZE;
-		    offset += dir->length) {
-			dir = (cdfs_dir_t *) (block->data + offset);
-			if (dir->length == 0)
-				break;
-			if (offset + dir->length > BLOCK_SIZE) {
-				/* XXX Incorrect FS structure */
-				break;
-			}
-
-			cdfs_dentry_type_t dentry_type;
-			if (dir->flags & DIR_FLAG_DIRECTORY)
-				dentry_type = CDFS_DIRECTORY;
-			else
-				dentry_type = CDFS_FILE;
-
-			/* Skip special entries */
-
-			if (dir->name_length == 1 &&
-			    dir->name[0] == CDFS_NAME_CURDIR)
-				continue;
-			if (dir->name_length == 1 &&
-			    dir->name[0] == CDFS_NAME_PARENTDIR)
-				continue;
-
-			// FIXME: hack - indexing by dentry byte offset on disc
-
-			fs_node_t *fn;
-			errno_t rc = create_node(&fn, fs, dentry_type,
-			    (node->lba + i) * BLOCK_SIZE + offset);
-			if (rc != EOK)
-				return rc;
-
-			assert(fn != NULL);
-
-			cdfs_node_t *cur = CDFS_NODE(fn);
-			cur->lba = uint32_lb(dir->lba);
-			cur->size = uint32_lb(dir->size);
-
-			char *name = cdfs_decode_name(dir->name,
-			    dir->name_length, node->fs->enc, dentry_type);
-			if (name == NULL)
-				return EIO;
-
-			// FIXME: check return value
-
-			link_node(fs_node, fn, name);
-			free(name);
-
-			if (dentry_type == CDFS_FILE)
-				cur->processed = true;
-		}
-
-		block_put(block);
-	}
-
-	node->processed = true;
-	return EOK;
-}
-
-static fs_node_t *get_uncached_node(cdfs_t *fs, fs_index_t index)
-{
-	cdfs_lba_t lba = index / BLOCK_SIZE;
-	size_t offset = index % BLOCK_SIZE;
-
-	block_t *block;
-	errno_t rc = block_get(&block, fs->service_id, lba, BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return NULL;
-
-	cdfs_dir_t *dir = (cdfs_dir_t *) (block->data + offset);
-
-	cdfs_dentry_type_t dentry_type;
-	if (dir->flags & DIR_FLAG_DIRECTORY)
-		dentry_type = CDFS_DIRECTORY;
-	else
-		dentry_type = CDFS_FILE;
-
-	fs_node_t *fn;
-	rc = create_node(&fn, fs, dentry_type, index);
-	if ((rc != EOK) || (fn == NULL))
-		return NULL;
-
-	cdfs_node_t *node = CDFS_NODE(fn);
-	node->lba = uint32_lb(dir->lba);
-	node->size = uint32_lb(dir->size);
-	node->lnkcnt = 1;
-
-	if (dentry_type == CDFS_FILE)
-		node->processed = true;
-
-	block_put(block);
-	return fn;
-}
-
-static fs_node_t *get_cached_node(cdfs_t *fs, fs_index_t index)
-{
-	ht_key_t key = {
-		.index = index,
-		.service_id = fs->service_id
-	};
-
-	ht_link_t *link = hash_table_find(&nodes, &key);
-	if (link) {
-		cdfs_node_t *node =
-		    hash_table_get_inst(link, cdfs_node_t, nh_link);
-		return FS_NODE(node);
-	}
-
-	return get_uncached_node(fs, index);
-}
-
-static errno_t cdfs_match(fs_node_t **fn, fs_node_t *pfn, const char *component)
-{
-	cdfs_node_t *parent = CDFS_NODE(pfn);
-
-	if (!parent->processed) {
-		errno_t rc = cdfs_readdir(parent->fs, pfn);
-		if (rc != EOK)
-			return rc;
-	}
-
-	list_foreach(parent->cs_list, link, cdfs_dentry_t, dentry) {
-		if (str_cmp(dentry->name, component) == 0) {
-			*fn = get_cached_node(parent->fs, dentry->index);
-			return EOK;
-		}
-	}
-
-	*fn = NULL;
-	return EOK;
-}
-
-static errno_t cdfs_node_open(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-
-	if (!node->processed)
-		cdfs_readdir(node->fs, fn);
-
-	node->opened++;
-	return EOK;
-}
-
-static errno_t cdfs_node_put(fs_node_t *fn)
-{
-	/* Nothing to do */
-	return EOK;
-}
-
-static errno_t cdfs_create_node(fs_node_t **fn, service_id_t service_id, int lflag)
-{
-	/* Read-only */
-	return ENOTSUP;
-}
-
-static errno_t cdfs_destroy_node(fs_node_t *fn)
-{
-	/* Read-only */
-	return ENOTSUP;
-}
-
-static errno_t cdfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	/* Read-only */
-	return ENOTSUP;
-}
-
-static errno_t cdfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	/* Read-only */
-	return ENOTSUP;
-}
-
-static errno_t cdfs_has_children(bool *has_children, fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-
-	if ((node->type == CDFS_DIRECTORY) && (!node->processed))
-		cdfs_readdir(node->fs, fn);
-
-	*has_children = !list_empty(&node->cs_list);
-	return EOK;
-}
-
-static fs_index_t cdfs_index_get(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-	return node->index;
-}
-
-static aoff64_t cdfs_size_get(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-	return node->size;
-}
-
-static unsigned int cdfs_lnkcnt_get(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-	return node->lnkcnt;
-}
-
-static bool cdfs_is_directory(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-	return (node->type == CDFS_DIRECTORY);
-}
-
-static bool cdfs_is_file(fs_node_t *fn)
-{
-	cdfs_node_t *node = CDFS_NODE(fn);
-	return (node->type == CDFS_FILE);
-}
-
-static service_id_t cdfs_service_get(fs_node_t *fn)
-{
-	return 0;
-}
-
-static errno_t cdfs_size_block(service_id_t service_id, uint32_t *size)
-{
-	*size = BLOCK_SIZE;
-
-	return EOK;
-}
-
-static errno_t cdfs_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	*count = 0;
-
-	return EOK;
-}
-
-static errno_t cdfs_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	*count = 0;
-
-	return EOK;
-}
-
-libfs_ops_t cdfs_libfs_ops = {
-	.root_get = cdfs_root_get,
-	.match = cdfs_match,
-	.node_get = cdfs_node_get,
-	.node_open = cdfs_node_open,
-	.node_put = cdfs_node_put,
-	.create = cdfs_create_node,
-	.destroy = cdfs_destroy_node,
-	.link = cdfs_link_node,
-	.unlink = cdfs_unlink_node,
-	.has_children = cdfs_has_children,
-	.index_get = cdfs_index_get,
-	.size_get = cdfs_size_get,
-	.lnkcnt_get = cdfs_lnkcnt_get,
-	.is_directory = cdfs_is_directory,
-	.is_file = cdfs_is_file,
-	.service_get = cdfs_service_get,
-	.size_block = cdfs_size_block,
-	.total_block_count = cdfs_total_block_count,
-	.free_block_count = cdfs_free_block_count
-};
-
-/** Verify that escape sequence corresonds to one of the allowed encoding
- * escape sequences allowed for Joliet.
- */
-static errno_t cdfs_verify_joliet_esc_seq(uint8_t *seq)
-{
-	size_t i, j, k;
-	bool match;
-
-	i = 0;
-	while (i + ucs2_esc_seq_len <= 32) {
-		if (seq[i] == 0)
-			break;
-
-		for (j = 0; j < ucs2_esc_seq_no; j++) {
-			match = true;
-			for (k = 0; k < ucs2_esc_seq_len; k++)
-				if (seq[i + k] != ucs2_esc_seq[j][k])
-					match = false;
-			if (match) {
-				break;
-			}
-		}
-
-		if (!match)
-			return EINVAL;
-
-		i += ucs2_esc_seq_len;
-	}
-
-	while (i < 32) {
-		if (seq[i] != 0)
-			return EINVAL;
-		++i;
-	}
-
-	return EOK;
-}
-
-/** Find Joliet supplementary volume descriptor.
- *
- * @param sid		Block device service ID
- * @param altroot	First filesystem block
- * @param rlba		Place to store LBA of root dir
- * @param rsize		Place to store size of root dir
- * @param vol_ident	Place to store pointer to volume identifier
- * @return 		EOK if found, ENOENT if not
- */
-static errno_t cdfs_find_joliet_svd(service_id_t sid, cdfs_lba_t altroot,
-    uint32_t *rlba, uint32_t *rsize, char **vol_ident)
-{
-	cdfs_lba_t bi;
-
-	for (bi = altroot + 17; ; bi++) {
-		block_t *block;
-		errno_t rc = block_get(&block, sid, bi, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			break;
-
-		cdfs_vol_desc_t *vol_desc = (cdfs_vol_desc_t *) block->data;
-
-		if (vol_desc->type == VOL_DESC_SET_TERMINATOR) {
-			block_put(block);
-			break;
-		}
-
-		if ((vol_desc->type != VOL_DESC_SUPPLEMENTARY) ||
-		    (memcmp(vol_desc->standard_ident, CDFS_STANDARD_IDENT, 5) != 0) ||
-		    (vol_desc->version != 1)) {
-			block_put(block);
-			continue;
-		}
-
-		uint16_t set_size = uint16_lb(vol_desc->data.prisec.set_size);
-		if (set_size > 1) {
-			/*
-			 * Technically, we don't support multi-disc sets.
-			 * But one can encounter erroneously mastered
-			 * images in the wild and it might actually work
-			 * for the first disc in the set.
-			 */
-		}
-
-		uint16_t sequence_nr = uint16_lb(vol_desc->data.prisec.sequence_nr);
-		if (sequence_nr != 1) {
-			/*
-			 * We only support the first disc
-			 * in multi-disc sets.
-			 */
-			block_put(block);
-			continue;
-		}
-
-		uint16_t block_size = uint16_lb(vol_desc->data.prisec.block_size);
-		if (block_size != BLOCK_SIZE) {
-			block_put(block);
-			continue;
-		}
-
-		rc = cdfs_verify_joliet_esc_seq(vol_desc->data.prisec.esc_seq);
-		if (rc != EOK)
-			continue;
-		*rlba = uint32_lb(vol_desc->data.prisec.root_dir.lba);
-		*rsize = uint32_lb(vol_desc->data.prisec.root_dir.size);
-
-		*vol_ident = cdfs_decode_vol_ident(vol_desc->data.prisec.ident,
-		    32, enc_ucs2);
-
-		block_put(block);
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-/** Read the volume descriptors. */
-static errno_t iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot,
-    uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc, char **vol_ident)
-{
-	/* First 16 blocks of isofs are empty */
-	block_t *block;
-	errno_t rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	cdfs_vol_desc_t *vol_desc = (cdfs_vol_desc_t *) block->data;
-
-	/*
-	 * Test for primary volume descriptor
-	 * and standard compliance.
-	 */
-	if ((vol_desc->type != VOL_DESC_PRIMARY) ||
-	    (memcmp(vol_desc->standard_ident, CDFS_STANDARD_IDENT, 5) != 0) ||
-	    (vol_desc->version != 1)) {
-		block_put(block);
-		return ENOTSUP;
-	}
-
-	uint16_t set_size = uint16_lb(vol_desc->data.prisec.set_size);
-	if (set_size > 1) {
-		/*
-		 * Technically, we don't support multi-disc sets.
-		 * But one can encounter erroneously mastered
-		 * images in the wild and it might actually work
-		 * for the first disc in the set.
-		 */
-	}
-
-	uint16_t sequence_nr = uint16_lb(vol_desc->data.prisec.sequence_nr);
-	if (sequence_nr != 1) {
-		/*
-		 * We only support the first disc
-		 * in multi-disc sets.
-		 */
-		block_put(block);
-		return ENOTSUP;
-	}
-
-	uint16_t block_size = uint16_lb(vol_desc->data.prisec.block_size);
-	if (block_size != BLOCK_SIZE) {
-		block_put(block);
-		return ENOTSUP;
-	}
-
-	// TODO: implement path table support
-
-	/* Search for Joliet SVD */
-
-	uint32_t jrlba;
-	uint32_t jrsize;
-
-	rc = cdfs_find_joliet_svd(sid, altroot, &jrlba, &jrsize, vol_ident);
-	if (rc == EOK) {
-		/* Found */
-		*rlba = jrlba;
-		*rsize = jrsize;
-		*enc = enc_ucs2;
-	} else {
-		*rlba = uint32_lb(vol_desc->data.prisec.root_dir.lba);
-		*rsize = uint32_lb(vol_desc->data.prisec.root_dir.size);
-		*enc = enc_ascii;
-		*vol_ident = cdfs_decode_vol_ident(vol_desc->data.prisec.ident,
-		    32, enc_ascii);
-	}
-
-	block_put(block);
-	return EOK;
-}
-
-static errno_t iso_readfs(cdfs_t *fs, fs_node_t *rfn,
-    cdfs_lba_t altroot)
-{
-	cdfs_node_t *node = CDFS_NODE(rfn);
-
-	errno_t rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba,
-	    &node->size, &fs->enc, &fs->vol_ident);
-	if (rc != EOK)
-		return rc;
-
-	return cdfs_readdir(fs, rfn);
-}
-
-/*
- * Mount a session with session start offset
- *
- */
-static cdfs_t *cdfs_fs_create(service_id_t sid, cdfs_lba_t altroot)
-{
-	cdfs_t *fs = NULL;
-	fs_node_t *rfn = NULL;
-
-	fs = calloc(1, sizeof(cdfs_t));
-	if (fs == NULL)
-		goto error;
-
-	fs->service_id = sid;
-
-	/* Create root node */
-	errno_t rc = create_node(&rfn, fs, L_DIRECTORY, cdfs_index++);
-
-	if ((rc != EOK) || (!rfn))
-		goto error;
-
-	/* FS root is not linked */
-	CDFS_NODE(rfn)->lnkcnt = 0;
-	CDFS_NODE(rfn)->lba = 0;
-	CDFS_NODE(rfn)->processed = false;
-
-	/* Check if there is cdfs in given session */
-	if (iso_readfs(fs, rfn, altroot) != EOK)
-		goto error;
-
-	list_append(&fs->link, &cdfs_instances);
-	return fs;
-error:
-	// XXX destroy node
-	free(fs);
-	return NULL;
-}
-
-static errno_t cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	char *vol_ident;
-
-	/* Initialize the block layer */
-	errno_t rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	cdfs_lba_t altroot = 0;
-
-	/*
-	 * Read TOC multisession information and get the start address
-	 * of the first track in the last session
-	 */
-	scsi_toc_multisess_data_t toc;
-
-	rc = block_read_toc(service_id, 1, &toc, sizeof(toc));
-	if (rc == EOK && (uint16_t_be2host(toc.toc_len) == 10))
-		altroot = uint32_t_be2host(toc.ftrack_lsess.start_addr);
-
-	/* Initialize the block cache */
-	rc = block_cache_init(service_id, BLOCK_SIZE, 0, CACHE_MODE_WT);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Check if this device is not already mounted */
-	fs_node_t *rootfn;
-	rc = cdfs_root_get(&rootfn, service_id);
-	if ((rc == EOK) && (rootfn)) {
-		cdfs_node_put(rootfn);
-		block_cache_fini(service_id);
-		block_fini(service_id);
-		return EOK;
-	}
-
-	/* Read volume descriptors */
-	uint32_t rlba;
-	uint32_t rsize;
-	cdfs_enc_t enc;
-	rc = iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc,
-	    &vol_ident);
-	if (rc != EOK) {
-		block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	str_cpy(info->label, FS_LABEL_MAXLEN + 1, vol_ident);
-	free(vol_ident);
-
-	block_cache_fini(service_id);
-	block_fini(service_id);
-	return EOK;
-}
-
-static errno_t cdfs_mounted(service_id_t service_id, const char *opts,
-    fs_index_t *index, aoff64_t *size)
-{
-	/* Initialize the block layer */
-	errno_t rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	cdfs_lba_t altroot = 0;
-
-	if (str_lcmp(opts, "altroot=", 8) == 0) {
-		/* User-defined alternative root on a multi-session disk */
-		if (str_uint32_t(opts + 8, NULL, 0, false, &altroot) != EOK)
-			altroot = 0;
-	} else {
-		/*
-		 * Read TOC multisession information and get the start address
-		 * of the first track in the last session
-		 */
-		scsi_toc_multisess_data_t toc;
-
-		rc = block_read_toc(service_id, 1, &toc, sizeof(toc));
-		if (rc == EOK && (uint16_t_be2host(toc.toc_len) == 10))
-			altroot = uint32_t_be2host(toc.ftrack_lsess.start_addr);
-	}
-
-	/* Initialize the block cache */
-	rc = block_cache_init(service_id, BLOCK_SIZE, 0, CACHE_MODE_WT);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Check if this device is not already mounted */
-	fs_node_t *rootfn;
-	rc = cdfs_root_get(&rootfn, service_id);
-	if ((rc == EOK) && (rootfn)) {
-		cdfs_node_put(rootfn);
-		block_cache_fini(service_id);
-		block_fini(service_id);
-
-		return EEXIST;
-	}
-
-	/* Create cdfs instance */
-	if (cdfs_fs_create(service_id, altroot) == NULL) {
-		block_cache_fini(service_id);
-		block_fini(service_id);
-
-		return ENOMEM;
-	}
-
-	rc = cdfs_root_get(&rootfn, service_id);
-	assert(rc == EOK);
-
-	cdfs_node_t *root = CDFS_NODE(rootfn);
-	*index = root->index;
-	*size = root->size;
-
-	return EOK;
-}
-
-static bool rm_service_id_nodes(ht_link_t *item, void *arg)
-{
-	service_id_t service_id = *(service_id_t *)arg;
-	cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
-
-	if (node->fs->service_id == service_id) {
-		hash_table_remove_item(&nodes, &node->nh_link);
-	}
-
-	return true;
-}
-
-static void cdfs_fs_destroy(cdfs_t *fs)
-{
-	list_remove(&fs->link);
-	hash_table_apply(&nodes, rm_service_id_nodes, &fs->service_id);
-	block_cache_fini(fs->service_id);
-	block_fini(fs->service_id);
-	free(fs->vol_ident);
-	free(fs);
-}
-
-static cdfs_t *cdfs_find_by_sid(service_id_t service_id)
-{
-	list_foreach(cdfs_instances, link, cdfs_t, fs) {
-		if (fs->service_id == service_id)
-			return fs;
-	}
-
-	return NULL;
-}
-
-static errno_t cdfs_unmounted(service_id_t service_id)
-{
-	cdfs_t *fs;
-
-	fs = cdfs_find_by_sid(service_id);
-	if (fs == NULL)
-		return ENOENT;
-
-	cdfs_fs_destroy(fs);
-	return EOK;
-}
-
-static errno_t cdfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	ht_key_t key = {
-		.index = index,
-		.service_id = service_id
-	};
-
-	ht_link_t *link = hash_table_find(&nodes, &key);
-	if (link == NULL)
-		return ENOENT;
-
-	cdfs_node_t *node =
-	    hash_table_get_inst(link, cdfs_node_t, nh_link);
-
-	if (!node->processed) {
-		errno_t rc = cdfs_readdir(node->fs, FS_NODE(node));
-		if (rc != EOK)
-			return rc;
-	}
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_read_receive(&call, &len)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	if (node->type == CDFS_FILE) {
-		if (pos >= node->size) {
-			*rbytes = 0;
-			async_data_read_finalize(&call, NULL, 0);
-		} else {
-			cdfs_lba_t lba = pos / BLOCK_SIZE;
-			size_t offset = pos % BLOCK_SIZE;
-
-			*rbytes = min(len, BLOCK_SIZE - offset);
-			*rbytes = min(*rbytes, node->size - pos);
-
-			block_t *block;
-			errno_t rc = block_get(&block, service_id, node->lba + lba,
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				async_answer_0(&call, rc);
-				return rc;
-			}
-
-			async_data_read_finalize(&call, block->data + offset,
-			    *rbytes);
-			rc = block_put(block);
-			if (rc != EOK)
-				return rc;
-		}
-	} else {
-		link_t *link = list_nth(&node->cs_list, pos);
-		if (link == NULL) {
-			async_answer_0(&call, ENOENT);
-			return ENOENT;
-		}
-
-		cdfs_dentry_t *dentry =
-		    list_get_instance(link, cdfs_dentry_t, link);
-
-		*rbytes = 1;
-		async_data_read_finalize(&call, dentry->name,
-		    str_size(dentry->name) + 1);
-	}
-
-	return EOK;
-}
-
-static errno_t cdfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	/*
-	 * As cdfs is a read-only filesystem,
-	 * the operation is not supported.
-	 */
-
-	return ENOTSUP;
-}
-
-static errno_t cdfs_truncate(service_id_t service_id, fs_index_t index,
-    aoff64_t size)
-{
-	/*
-	 * As cdfs is a read-only filesystem,
-	 * the operation is not supported.
-	 */
-
-	return ENOTSUP;
-}
-
-static bool cache_remove_closed(ht_link_t *item, void *arg)
-{
-	size_t *premove_cnt = (size_t *)arg;
-
-	/* Some nodes were requested to be removed from the cache. */
-	if (0 < *premove_cnt) {
-		cdfs_node_t *node = hash_table_get_inst(item, cdfs_node_t, nh_link);
-
-		if (!node->opened) {
-			hash_table_remove_item(&nodes, item);
-
-			--nodes_cached;
-			--*premove_cnt;
-		}
-	}
-
-	/* Only continue if more nodes were requested to be removed. */
-	return 0 < *premove_cnt;
-}
-
-static void cleanup_cache(service_id_t service_id)
-{
-	if (nodes_cached > NODE_CACHE_SIZE) {
-		size_t remove_cnt = nodes_cached - NODE_CACHE_SIZE;
-
-		if (0 < remove_cnt)
-			hash_table_apply(&nodes, cache_remove_closed, &remove_cnt);
-	}
-}
-
-static errno_t cdfs_close(service_id_t service_id, fs_index_t index)
-{
-	/* Root node is always in memory */
-	if (index == 0)
-		return EOK;
-
-	ht_key_t key = {
-		.index = index,
-		.service_id = service_id
-	};
-
-	ht_link_t *link = hash_table_find(&nodes, &key);
-	if (link == 0)
-		return ENOENT;
-
-	cdfs_node_t *node =
-	    hash_table_get_inst(link, cdfs_node_t, nh_link);
-
-	assert(node->opened > 0);
-
-	node->opened--;
-	cleanup_cache(service_id);
-
-	return EOK;
-}
-
-static errno_t cdfs_destroy(service_id_t service_id, fs_index_t index)
-{
-	/*
-	 * As cdfs is a read-only filesystem,
-	 * the operation is not supported.
-	 */
-
-	return ENOTSUP;
-}
-
-static errno_t cdfs_sync(service_id_t service_id, fs_index_t index)
-{
-	/*
-	 * As cdfs is a read-only filesystem,
-	 * the sync operation is a no-op.
-	 */
-
-	return EOK;
-}
-
-vfs_out_ops_t cdfs_ops = {
-	.fsprobe = cdfs_fsprobe,
-	.mounted = cdfs_mounted,
-	.unmounted = cdfs_unmounted,
-	.read = cdfs_read,
-	.write = cdfs_write,
-	.truncate = cdfs_truncate,
-	.close = cdfs_close,
-	.destroy = cdfs_destroy,
-	.sync = cdfs_sync
-};
-
-/** Initialize the cdfs server
- *
- */
-bool cdfs_init(void)
-{
-	if (!hash_table_create(&nodes, 0, 0, &nodes_ops))
-		return false;
-
-	return true;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/cdfs/cdfs_ops.h
===================================================================
--- uspace/srv/fs/cdfs/cdfs_ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup cdfs
- * @{
- */
-
-#ifndef CDFS_CDFS_OPS_H_
-#define CDFS_CDFS_OPS_H_
-
-#include <stdbool.h>
-
-extern bool cdfs_init(void);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/cdfs/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/cdfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup cdfs cdfs
- * @ingroup srvs
- * @brief File system driver for ISO9660 file system
- */
Index: pace/srv/fs/cdfs/meson.build
===================================================================
--- uspace/srv/fs/cdfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Kavalik
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs', 'scsi' ]
-src = files('cdfs.c', 'cdfs_ops.c')
Index: pace/srv/fs/exfat/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/exfat/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup exfat exfat
- * @ingroup srvs
- * @brief exFAT file system driver
- */
Index: pace/srv/fs/exfat/exfat.c
===================================================================
--- uspace/srv/fs/exfat/exfat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat.c
- * @brief	exFAT file system driver for HelenOS.
- */
-
-#include "exfat.h"
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include <stdio.h>
-#include <libfs.h>
-#include <str.h>
-#include "../../vfs/vfs.h"
-
-#define NAME	"exfat"
-
-vfs_info_t exfat_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char **argv)
-{
-	printf(NAME ": HelenOS exFAT file system server\n");
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			exfat_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf(NAME " Unrecognized parameters");
-			return -1;
-		}
-	}
-
-	errno_t rc = exfat_idx_init();
-	if (rc != EOK)
-		goto err;
-
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
-		return -1;
-	}
-
-	rc = fs_register(vfs_sess, &exfat_vfs_info, &exfat_ops, &exfat_libfs_ops);
-	if (rc != EOK) {
-		exfat_idx_fini();
-		goto err;
-	}
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-
-	/* not reached */
-	return 0;
-
-err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat.h
===================================================================
--- uspace/srv/fs/exfat/exfat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-#ifndef EXFAT_EXFAT_H_
-#define EXFAT_EXFAT_H_
-
-#include "exfat_fat.h"
-#include <fibril_synch.h>
-#include <libfs.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include "../../vfs/vfs.h"
-
-#ifndef dprintf
-#define dprintf(...)	printf(__VA_ARGS__)
-#endif
-
-#define BS_BLOCK		0
-#define BS_SIZE			512
-
-#define BPS(bs)			((uint32_t) (1 << (bs->bytes_per_sector)))
-#define SPC(bs)			((uint32_t) (1 << (bs->sec_per_cluster)))
-#define BPC(bs)			((uint32_t) (BPS(bs) * SPC(bs)))
-#define VOL_FS(bs)		uint64_t_le2host(bs->volume_start)
-#define VOL_CNT(bs)		uint64_t_le2host(bs->volume_count)
-#define FAT_FS(bs)		uint32_t_le2host(bs->fat_sector_start)
-#define FAT_CNT(bs)		uint32_t_le2host(bs->fat_sector_count)
-#define DATA_FS(bs)		uint32_t_le2host(bs->data_start_sector)
-#define DATA_CNT(bs)		uint32_t_le2host(bs->data_clusters)
-#define ROOT_FC(bs)		uint32_t_le2host(bs->rootdir_cluster)
-#define VOL_FLAGS(bs)		uint16_t_le2host(bs->volume_flags)
-
-#define EXFAT_NODE(node)	((node) ? (exfat_node_t *) (node)->data : NULL)
-#define FS_NODE(node)	((node) ? (node)->bp : NULL)
-#define DPS(bs) (BPS((bs)) / sizeof(exfat_dentry_t))
-
-typedef struct exfat_bs {
-	uint8_t jump[3];				/* 0x00 jmp and nop instructions */
-	uint8_t oem_name[8];			/* 0x03 "EXFAT   " */
-	uint8_t	__reserved[53];			/* 0x0B always 0 */
-	uint64_t volume_start;			/* 0x40 partition first sector */
-	uint64_t volume_count;			/* 0x48 partition sectors count */
-	uint32_t fat_sector_start;		/* 0x50 FAT first sector */
-	uint32_t fat_sector_count;		/* 0x54 FAT sectors count */
-	uint32_t data_start_sector;		/* 0x58 Data region first cluster sector */
-	uint32_t data_clusters;			/* 0x5C total clusters count */
-	uint32_t rootdir_cluster;		/* 0x60 first cluster of the root dir */
-	uint32_t volume_serial;			/* 0x64 volume serial number */
-	struct {						/* 0x68 FS version */
-		uint8_t minor;
-		uint8_t major;
-	} __attribute__((packed)) version;
-	uint16_t volume_flags;			/* 0x6A volume state flags */
-	uint8_t bytes_per_sector;		/* 0x6C sector size as (1 << n) */
-	uint8_t sec_per_cluster;		/* 0x6D sectors per cluster as (1 << n) */
-	uint8_t fat_count;				/* 0x6E always 1 */
-	uint8_t drive_no;				/* 0x6F always 0x80 */
-	uint8_t allocated_percent;		/* 0x70 percentage of allocated space */
-	uint8_t _reserved2[7];			/* 0x71 reserved */
-	uint8_t bootcode[390];			/* Boot code */
-	uint16_t signature;				/* the value of 0xAA55 */
-} __attribute__((__packed__)) exfat_bs_t;
-
-typedef enum {
-	EXFAT_UNKNOW,
-	EXFAT_DIRECTORY,
-	EXFAT_FILE,
-	EXFAT_BITMAP,
-	EXFAT_UCTABLE
-} exfat_node_type_t;
-
-struct exfat_node;
-struct exfat_idx_t;
-
-typedef struct {
-	/** Used indices (position) hash table link. */
-	ht_link_t		uph_link;
-	/** Used indices (index) hash table link. */
-	ht_link_t		uih_link;
-
-	fibril_mutex_t	lock;
-	service_id_t	service_id;
-	fs_index_t	index;
-
-	/* Does parent node fragmented or not? */
-	bool parent_fragmented;
-	/**
-	 * Parent node's first cluster.
-	 * Zero is used if this node is not linked, in which case nodep must
-	 * contain a pointer to the in-core node structure.
-	 * One is used when the parent is the root directory.
-	 */
-	exfat_cluster_t	pfc;
-	/** Directory entry index within the parent node. */
-	unsigned	pdi;
-	/** Pointer to in-core node instance. */
-	struct exfat_node	*nodep;
-} exfat_idx_t;
-
-/** exFAT in-core node. */
-typedef struct exfat_node {
-	/** Back pointer to the FS node. */
-	fs_node_t		*bp;
-
-	fibril_mutex_t		lock;
-	exfat_node_type_t	type;
-	exfat_idx_t			*idx;
-	/**
-	 *  Node's first cluster.
-	 *  Zero is used for zero-length nodes.
-	 *  One is used to mark root directory.
-	 */
-	exfat_cluster_t		firstc;
-	/** exFAT in-core node free list link. */
-	link_t			ffn_link;
-	aoff64_t		size;
-	unsigned		lnkcnt;
-	unsigned		refcnt;
-	bool			dirty;
-	/* Should we do walk-on-FAT or not */
-	bool			fragmented;
-
-	/*
-	 * Cache of the node's last and "current" cluster to avoid some
-	 * unnecessary FAT walks.
-	 */
-	/* Node's last cluster in FAT. */
-	bool		lastc_cached_valid;
-	exfat_cluster_t	lastc_cached_value;
-	/* Node's "current" cluster, i.e. where the last I/O took place. */
-	bool		currc_cached_valid;
-	aoff64_t	currc_cached_bn;
-	exfat_cluster_t	currc_cached_value;
-} exfat_node_t;
-
-extern vfs_out_ops_t exfat_ops;
-extern libfs_ops_t exfat_libfs_ops;
-
-extern errno_t exfat_idx_get_new(exfat_idx_t **, service_id_t);
-extern exfat_idx_t *exfat_idx_get_by_pos(service_id_t, exfat_cluster_t, unsigned);
-extern exfat_idx_t *exfat_idx_get_by_index(service_id_t, fs_index_t);
-extern void exfat_idx_destroy(exfat_idx_t *);
-extern void exfat_idx_hashin(exfat_idx_t *);
-extern void exfat_idx_hashout(exfat_idx_t *);
-
-extern errno_t exfat_idx_init(void);
-extern void exfat_idx_fini(void);
-extern errno_t exfat_idx_init_by_service_id(service_id_t);
-extern void exfat_idx_fini_by_service_id(service_id_t);
-
-extern errno_t exfat_node_expand(service_id_t, exfat_node_t *, exfat_cluster_t);
-extern errno_t exfat_node_put(fs_node_t *);
-extern errno_t exfat_bitmap_get(fs_node_t **, service_id_t);
-extern errno_t exfat_uctable_get(fs_node_t **, service_id_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_bitmap.c
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,267 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_bitmap.c
- * @brief	Functions that manipulate the Bitmap Table.
- */
-
-#include "exfat_bitmap.h"
-#include "../../vfs/vfs.h"
-#include <libfs.h>
-#include <block.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <align.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <mem.h>
-
-errno_t exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t clst)
-{
-	fs_node_t *fn;
-	block_t *b = NULL;
-	exfat_node_t *bitmapp;
-	uint8_t *bitmap;
-	errno_t rc;
-	bool alloc;
-
-	clst -= EXFAT_CLST_FIRST;
-
-	rc = exfat_bitmap_get(&fn, service_id);
-	if (rc != EOK)
-		return rc;
-	bitmapp = EXFAT_NODE(fn);
-
-	aoff64_t offset = clst / 8;
-	rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-	bitmap = (uint8_t *)b->data;
-	alloc = bitmap[offset % BPS(bs)] & (1 << (clst % 8));
-
-	rc = block_put(b);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-	rc = exfat_node_put(fn);
-	if (rc != EOK)
-		return rc;
-
-	if (alloc)
-		return ENOENT;
-
-	return EOK;
-}
-
-errno_t exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t clst)
-{
-	fs_node_t *fn;
-	block_t *b = NULL;
-	exfat_node_t *bitmapp;
-	uint8_t *bitmap;
-	errno_t rc;
-
-	clst -= EXFAT_CLST_FIRST;
-
-	rc = exfat_bitmap_get(&fn, service_id);
-	if (rc != EOK)
-		return rc;
-	bitmapp = EXFAT_NODE(fn);
-
-	aoff64_t offset = clst / 8;
-	rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-	bitmap = (uint8_t *)b->data;
-	bitmap[offset % BPS(bs)] |= (1 << (clst % 8));
-
-	b->dirty = true;
-	rc = block_put(b);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-
-	return exfat_node_put(fn);
-}
-
-errno_t exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t clst)
-{
-	fs_node_t *fn;
-	block_t *b = NULL;
-	exfat_node_t *bitmapp;
-	uint8_t *bitmap;
-	errno_t rc;
-
-	clst -= EXFAT_CLST_FIRST;
-
-	rc = exfat_bitmap_get(&fn, service_id);
-	if (rc != EOK)
-		return rc;
-	bitmapp = EXFAT_NODE(fn);
-
-	aoff64_t offset = clst / 8;
-	rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs),
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-	bitmap = (uint8_t *)b->data;
-	bitmap[offset % BPS(bs)] &= ~(1 << (clst % 8));
-
-	b->dirty = true;
-	rc = block_put(b);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-
-	return exfat_node_put(fn);
-}
-
-errno_t exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t firstc, exfat_cluster_t count)
-{
-	errno_t rc;
-	exfat_cluster_t clst;
-	clst = firstc;
-
-	while (clst < firstc + count) {
-		rc = exfat_bitmap_set_cluster(bs, service_id, clst);
-		if (rc != EOK) {
-			if (clst - firstc > 0)
-				(void) exfat_bitmap_clear_clusters(bs, service_id,
-				    firstc, clst - firstc);
-			return rc;
-		}
-		clst++;
-	}
-	return EOK;
-}
-
-errno_t exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t firstc, exfat_cluster_t count)
-{
-	errno_t rc;
-	exfat_cluster_t clst;
-	clst = firstc;
-
-	while (clst < firstc + count) {
-		rc = exfat_bitmap_clear_cluster(bs, service_id, clst);
-		if (rc != EOK)
-			return rc;
-		clst++;
-	}
-	return EOK;
-}
-
-errno_t exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t *firstc, exfat_cluster_t count)
-{
-	exfat_cluster_t startc, endc;
-	startc = EXFAT_CLST_FIRST;
-
-	while (startc < DATA_CNT(bs) + 2) {
-		endc = startc;
-		while (exfat_bitmap_is_free(bs, service_id, endc) == EOK) {
-			if ((endc - startc) + 1 == count) {
-				*firstc = startc;
-				return exfat_bitmap_set_clusters(bs, service_id, startc, count);
-			} else
-				endc++;
-		}
-		startc = endc + 1;
-	}
-	return ENOSPC;
-}
-
-errno_t exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
-    exfat_cluster_t count)
-{
-	if (nodep->firstc == 0) {
-		return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id,
-		    &nodep->firstc, count);
-	} else {
-		exfat_cluster_t lastc, clst;
-		lastc = nodep->firstc + ROUND_UP(nodep->size, BPC(bs)) / BPC(bs) - 1;
-
-		clst = lastc + 1;
-		while (exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {
-			if (clst - lastc == count) {
-				return exfat_bitmap_set_clusters(bs, nodep->idx->service_id,
-				    lastc + 1, count);
-			} else
-				clst++;
-		}
-		return ENOSPC;
-	}
-}
-
-errno_t exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,
-    exfat_cluster_t count)
-{
-	exfat_cluster_t lastc;
-	lastc = nodep->firstc + ROUND_UP(nodep->size, BPC(bs)) / BPC(bs) - 1;
-	lastc -= count;
-
-	return exfat_bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);
-}
-
-errno_t exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)
-{
-	errno_t rc;
-	exfat_cluster_t lastc, clst;
-	service_id_t service_id = nodep->idx->service_id;
-	lastc = nodep->firstc + ROUND_UP(nodep->size, BPC(bs)) / BPC(bs) - 1;
-
-	for (clst = nodep->firstc; clst < lastc; clst++) {
-		rc = exfat_set_cluster(bs, service_id, clst, clst + 1);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return exfat_set_cluster(bs, service_id, lastc, EXFAT_CLST_EOF);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_bitmap.h
===================================================================
--- uspace/srv/fs/exfat/exfat_bitmap.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-#ifndef EXFAT_EXFAT_BITMAP_H_
-#define EXFAT_EXFAT_BITMAP_H_
-
-#include <stdint.h>
-#include "exfat.h"
-#include "exfat_fat.h"
-
-/* forward declarations */
-struct exfat_node;
-struct exfat_bs;
-
-extern errno_t exfat_bitmap_alloc_clusters(struct exfat_bs *, service_id_t,
-    exfat_cluster_t *, exfat_cluster_t);
-extern errno_t exfat_bitmap_append_clusters(struct exfat_bs *, struct exfat_node *,
-    exfat_cluster_t);
-extern errno_t exfat_bitmap_free_clusters(struct exfat_bs *, struct exfat_node *,
-    exfat_cluster_t);
-extern errno_t exfat_bitmap_replicate_clusters(struct exfat_bs *, struct exfat_node *);
-
-extern errno_t exfat_bitmap_is_free(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_clear_cluster(struct exfat_bs *, service_id_t,
-    exfat_cluster_t);
-
-extern errno_t exfat_bitmap_set_clusters(struct exfat_bs *, service_id_t,
-    exfat_cluster_t, exfat_cluster_t);
-extern errno_t exfat_bitmap_clear_clusters(struct exfat_bs *, service_id_t,
-    exfat_cluster_t, exfat_cluster_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_dentry.c
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_dentry.c
- * @brief	Functions that work with exFAT directory entries.
- */
-
-#include "exfat_dentry.h"
-#include <ctype.h>
-#include <str.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <assert.h>
-
-exfat_dentry_clsf_t exfat_classify_dentry(const exfat_dentry_t *d)
-{
-	switch (d->type) {
-	case EXFAT_TYPE_VOLLABEL:
-		return EXFAT_DENTRY_VOLLABEL;
-	case EXFAT_TYPE_BITMAP:
-		return EXFAT_DENTRY_BITMAP;
-	case EXFAT_TYPE_UCTABLE:
-		return EXFAT_DENTRY_UCTABLE;
-	case EXFAT_TYPE_GUID:
-		return EXFAT_DENTRY_GUID;
-	case EXFAT_TYPE_FILE:
-		return EXFAT_DENTRY_FILE;
-	case EXFAT_TYPE_STREAM:
-		return EXFAT_DENTRY_STREAM;
-	case EXFAT_TYPE_NAME:
-		return EXFAT_DENTRY_NAME;
-	case EXFAT_TYPE_UNUSED:
-		return EXFAT_DENTRY_LAST;
-	default:
-		if (d->type & EXFAT_TYPE_USED)
-			return EXFAT_DENTRY_SKIP;
-		else
-			return EXFAT_DENTRY_FREE;
-	}
-}
-
-uint16_t exfat_name_hash(const uint16_t *name, const uint16_t *uctable, size_t chars)
-{
-	uint16_t hash = 0;
-	uint16_t ch;
-	while (*name) {
-		if (*name < chars)
-			ch = uint16_t_le2host(uctable[*name]);
-		else
-			ch = *name;
-		name++;
-
-		hash = ((hash << 15) | (hash >> 1)) + (ch & 0xff);
-		hash = ((hash << 15) | (hash >> 1)) + (ch >> 8);
-	}
-
-	return hash;
-}
-
-void exfat_dentry_get_name(const exfat_name_dentry_t *name, size_t size, uint16_t *dst, size_t *offset)
-{
-	size_t i = 0;
-	while (i < EXFAT_NAME_PART_LEN && *offset < size) {
-		dst[*offset] = uint16_t_le2host(name->name[i]);
-		i++;
-		(*offset)++;
-	}
-	dst[*offset] = '\0';
-}
-
-void exfat_dentry_get_vollabel(const exfat_vollabel_dentry_t *vollabel,
-    size_t size, uint16_t *dst)
-{
-	size_t i = 0;
-	while (i < EXFAT_VOLLABEL_LEN && i < vollabel->size && i < size) {
-		dst[i] = uint16_t_le2host(vollabel->label[i]);
-		i++;
-	}
-	dst[i] = '\0';
-}
-
-bool exfat_valid_char(char32_t ch)
-{
-	if (ch >= 0x01 && ch <= 0x1F)
-		return false;
-
-	switch (ch) {
-	case '/':
-	case '\\':
-	case '?':
-	case '|':
-	case '>':
-	case '<':
-	case '"':
-	case '*':
-	case ':':
-		return false;
-	default:
-		return true;
-	}
-}
-
-bool exfat_valid_name(const char *name)
-{
-	size_t off = 0;
-	char32_t ch;
-
-	while ((ch = str_decode(name, &off, STR_NO_LIMIT)) != 0) {
-		if (!exfat_valid_char(ch))
-			return false;
-	}
-	return true;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_dentry.h
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,168 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-#ifndef EXFAT_EXFAT_DENTRY_H_
-#define EXFAT_EXFAT_DENTRY_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <uchar.h>
-
-#define EXFAT_FILENAME_LEN	255
-#define EXFAT_NAME_PART_LEN	15
-#define EXFAT_VOLLABEL_LEN	11
-
-#define EXFAT_TYPE_UNUSED	0x00
-#define EXFAT_TYPE_USED		0x80
-#define EXFAT_TYPE_VOLLABEL	0x83
-#define EXFAT_TYPE_BITMAP	0x81
-#define EXFAT_TYPE_UCTABLE	0x82
-#define EXFAT_TYPE_GUID		0xA0
-#define EXFAT_TYPE_FILE		0x85
-#define EXFAT_TYPE_STREAM	0xC0
-#define EXFAT_TYPE_NAME		0xC1
-
-#define EXFAT_ATTR_RDONLY	0x01
-#define EXFAT_ATTR_HIDDEN	0x02
-#define EXFAT_ATTR_SYSTEM	0x04
-#define EXFAT_ATTR_SUBDIR	0x10
-#define EXFAT_ATTR_ARCHIVE	0x20
-
-/* All dentry structs should have 31 byte size */
-typedef struct {
-	uint8_t 	size;
-	uint16_t 	label[11];
-	uint8_t 	_reserved[8];
-} __attribute__((packed)) exfat_vollabel_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint8_t 	_reserved[18];
-	uint32_t 	firstc;
-	uint64_t 	size;
-} __attribute__((packed)) exfat_bitmap_dentry_t;
-
-typedef struct {
-	uint8_t 	_reserved1[3];
-	uint32_t 	checksum;
-	uint8_t 	_reserved2[12];
-	uint32_t 	firstc;
-	uint64_t 	size;
-} __attribute__((packed)) exfat_uctable_dentry_t;
-
-typedef struct {
-	uint8_t 	count; /* Always zero */
-	uint16_t 	checksum;
-	uint16_t 	flags;
-	uint8_t 	guid[16];
-	uint8_t 	_reserved[10];
-} __attribute__((packed)) exfat_guid_dentry_t;
-
-typedef struct {
-	uint8_t 	count;
-	uint16_t 	checksum;
-	uint16_t 	attr;
-	uint8_t 	_reserved1[2];
-	uint32_t 	ctime;
-	uint32_t 	mtime;
-	uint32_t 	atime;
-	uint8_t 	ctime_fine;
-	uint8_t 	mtime_fine;
-	uint8_t 	ctime_tz;
-	uint8_t 	mtime_tz;
-	uint8_t 	atime_tz;
-	uint8_t 	_reserved2[7];
-} __attribute__((packed)) exfat_file_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint8_t 	_reserved1[1];
-	uint8_t 	name_size;
-	uint16_t 	hash;
-	uint8_t 	_reserved2[2];
-	uint64_t 	valid_data_size;
-	uint8_t 	_reserved3[4];
-	uint32_t 	firstc;
-	uint64_t 	data_size;
-} __attribute__((packed)) exfat_stream_dentry_t;
-
-typedef struct {
-	uint8_t 	flags;
-	uint16_t 	name[EXFAT_NAME_PART_LEN];
-} __attribute__((packed)) exfat_name_dentry_t;
-
-typedef struct {
-	uint8_t type;
-	union {
-		exfat_vollabel_dentry_t	vollabel;
-		exfat_bitmap_dentry_t 	bitmap;
-		exfat_uctable_dentry_t 	uctable;
-		exfat_guid_dentry_t 	guid;
-		exfat_file_dentry_t 	file;
-		exfat_stream_dentry_t 	stream;
-		exfat_name_dentry_t 	name;
-	};
-} __attribute__((packed)) exfat_dentry_t;
-
-typedef enum {
-	EXFAT_DENTRY_SKIP,
-	EXFAT_DENTRY_LAST,
-	EXFAT_DENTRY_FREE,
-	EXFAT_DENTRY_VOLLABEL,
-	EXFAT_DENTRY_BITMAP,
-	EXFAT_DENTRY_UCTABLE,
-	EXFAT_DENTRY_GUID,
-	EXFAT_DENTRY_FILE,
-	EXFAT_DENTRY_STREAM,
-	EXFAT_DENTRY_NAME
-} exfat_dentry_clsf_t;
-
-extern exfat_dentry_clsf_t exfat_classify_dentry(const exfat_dentry_t *);
-
-extern uint16_t exfat_name_hash(const uint16_t *, const uint16_t *, size_t);
-
-extern void exfat_dentry_get_name(const exfat_name_dentry_t *, size_t,
-    uint16_t *, size_t *);
-extern void exfat_dentry_get_vollabel(const exfat_vollabel_dentry_t *, size_t,
-    uint16_t *);
-
-extern bool exfat_valid_char(char32_t);
-extern bool exfat_valid_name(const char *);
-
-extern size_t exfat_utf16_length(const uint16_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_directory.c
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,560 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_directory.c
- * @brief	Functions that work with FAT directory.
- */
-
-#include "exfat.h"
-#include "exfat_directory.h"
-#include "exfat_fat.h"
-#include <block.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include <align.h>
-
-void exfat_directory_init(exfat_directory_t *di)
-{
-	di->b = NULL;
-	di->nodep = NULL;
-	di->bs = NULL;
-	di->blocks = 0;
-	di->pos = 0;
-	di->bnum = 0;
-	di->last = false;
-	di->fragmented = false;
-	di->firstc = 0;
-}
-
-errno_t exfat_directory_open(exfat_node_t *nodep, exfat_directory_t *di)
-{
-	exfat_directory_init(di);
-	di->nodep = nodep;
-	if (di->nodep->type != EXFAT_DIRECTORY)
-		return EINVAL;
-	di->service_id = nodep->idx->service_id;
-	di->fragmented = nodep->fragmented;
-	di->firstc = nodep->firstc;
-
-	di->bs = block_bb_get(di->service_id);
-	di->blocks = ROUND_UP(nodep->size, BPS(di->bs)) / BPS(di->bs);
-	return EOK;
-}
-
-errno_t exfat_directory_open_parent(exfat_directory_t *di,
-    service_id_t service_id, exfat_cluster_t firstc, bool fragmented)
-{
-	exfat_directory_init(di);
-	di->service_id = service_id;
-	di->fragmented = fragmented;
-	di->firstc = firstc;
-	di->bs = block_bb_get(service_id);
-	di->blocks = 0;
-	return EOK;
-}
-
-errno_t exfat_directory_close(exfat_directory_t *di)
-{
-	errno_t rc = EOK;
-
-	if (di->b) {
-		rc = block_put(di->b);
-		di->b = NULL;
-	}
-
-	return rc;
-}
-
-static errno_t exfat_directory_block_load(exfat_directory_t *di)
-{
-	uint32_t i;
-	errno_t rc = EOK;
-
-	i = (di->pos * sizeof(exfat_dentry_t)) / BPS(di->bs);
-	if (di->nodep && (i >= di->blocks))
-		return ENOENT;
-
-	if (di->b && di->bnum != i) {
-		rc = block_put(di->b);
-		di->b = NULL;
-		if (rc != EOK)
-			return rc;
-	}
-	if (!di->b) {
-		if (di->nodep) {
-			rc = exfat_block_get(&di->b, di->bs, di->nodep, i,
-			    BLOCK_FLAGS_NONE);
-		} else {
-			rc = exfat_block_get_by_clst(&di->b, di->bs,
-			    di->service_id, di->fragmented, di->firstc, NULL, i,
-			    BLOCK_FLAGS_NONE);
-		}
-		if (rc != EOK) {
-			di->b = NULL;
-			return rc;
-		}
-		di->bnum = i;
-	}
-	return rc;
-}
-
-errno_t exfat_directory_next(exfat_directory_t *di)
-{
-	errno_t rc;
-
-	di->pos += 1;
-	rc = exfat_directory_block_load(di);
-	if (rc != EOK)
-		di->pos -= 1;
-
-	return rc;
-}
-
-errno_t exfat_directory_prev(exfat_directory_t *di)
-{
-	errno_t rc = EOK;
-
-	if (di->pos > 0) {
-		di->pos -= 1;
-		rc = exfat_directory_block_load(di);
-	} else
-		return ENOENT;
-
-	if (rc != EOK)
-		di->pos += 1;
-
-	return rc;
-}
-
-errno_t exfat_directory_seek(exfat_directory_t *di, aoff64_t pos)
-{
-	aoff64_t _pos = di->pos;
-	errno_t rc;
-
-	di->pos = pos;
-	rc = exfat_directory_block_load(di);
-	if (rc != EOK)
-		di->pos = _pos;
-
-	return rc;
-}
-
-errno_t exfat_directory_get(exfat_directory_t *di, exfat_dentry_t **d)
-{
-	errno_t rc;
-
-	rc = exfat_directory_block_load(di);
-	if (rc == EOK) {
-		aoff64_t o = di->pos % (BPS(di->bs) / sizeof(exfat_dentry_t));
-		*d = ((exfat_dentry_t *)di->b->data) + o;
-	}
-
-	return rc;
-}
-
-errno_t exfat_directory_find(exfat_directory_t *di, exfat_dentry_clsf_t type,
-    exfat_dentry_t **d)
-{
-	do {
-		if (exfat_directory_get(di, d) == EOK) {
-			if (exfat_classify_dentry(*d) == type)
-				return EOK;
-		} else
-			return ENOENT;
-	} while (exfat_directory_next(di) == EOK);
-
-	return ENOENT;
-}
-
-errno_t
-exfat_directory_find_continue(exfat_directory_t *di, exfat_dentry_clsf_t type,
-    exfat_dentry_t **d)
-{
-	errno_t rc;
-	rc = exfat_directory_next(di);
-	if (rc != EOK)
-		return rc;
-	return exfat_directory_find(di, type, d);
-}
-
-errno_t exfat_directory_read_file(exfat_directory_t *di, char *name, size_t size,
-    exfat_file_dentry_t *df, exfat_stream_dentry_t *ds)
-{
-	uint16_t wname[EXFAT_FILENAME_LEN + 1];
-	exfat_dentry_t *d = NULL;
-	errno_t rc;
-	int i;
-	size_t offset = 0;
-	aoff64_t start_pos = 0;
-
-	rc = exfat_directory_find(di, EXFAT_DENTRY_FILE, &d);
-	if (rc != EOK)
-		return rc;
-	start_pos = di->pos;
-	*df = d->file;
-
-	rc = exfat_directory_next(di);
-	if (rc != EOK)
-		return rc;
-	rc = exfat_directory_get(di, &d);
-	if (rc != EOK)
-		return rc;
-	if (exfat_classify_dentry(d) != EXFAT_DENTRY_STREAM)
-		return ENOENT;
-	*ds  = d->stream;
-
-	if (ds->name_size > size)
-		return EOVERFLOW;
-
-	for (i = 0; i < df->count - 1; i++) {
-		rc = exfat_directory_next(di);
-		if (rc != EOK)
-			return rc;
-		rc = exfat_directory_get(di, &d);
-		if (rc != EOK)
-			return rc;
-		if (exfat_classify_dentry(d) != EXFAT_DENTRY_NAME)
-			return ENOENT;
-		exfat_dentry_get_name(&d->name, ds->name_size, wname, &offset);
-	}
-	rc = utf16_to_str(name, size, wname);
-	if (rc != EOK)
-		return rc;
-
-	exfat_directory_seek(di, start_pos);
-	return EOK;
-}
-
-errno_t exfat_directory_read_vollabel(exfat_directory_t *di, char *label,
-    size_t size)
-{
-	uint16_t wlabel[EXFAT_VOLLABEL_LEN + 1];
-	exfat_dentry_t *d = NULL;
-	errno_t rc;
-	aoff64_t start_pos = 0;
-
-	start_pos = di->pos;
-
-	rc = exfat_directory_seek(di, 0);
-	if (rc != EOK)
-		return rc;
-
-	rc = exfat_directory_find(di, EXFAT_DENTRY_VOLLABEL, &d);
-	if (rc != EOK)
-		return rc;
-
-	exfat_dentry_get_vollabel(&d->vollabel, EXFAT_VOLLABEL_LEN, wlabel);
-
-	rc = utf16_to_str(label, size, wlabel);
-	if (rc != EOK)
-		return rc;
-
-	exfat_directory_seek(di, start_pos);
-	return EOK;
-}
-
-static uint16_t exfat_directory_set_checksum(const uint8_t *bytes, size_t count)
-{
-	uint16_t checksum = 0;
-	size_t idx;
-
-	for (idx = 0; idx < count; idx++) {
-		if (idx == 2 || idx == 3)
-			continue;
-		checksum = ((checksum << 15) | (checksum >> 1)) +
-		    (uint16_t)bytes[idx];
-	}
-	return checksum;
-}
-
-errno_t exfat_directory_sync_file(exfat_directory_t *di, exfat_file_dentry_t *df,
-    exfat_stream_dentry_t *ds)
-{
-	errno_t rc;
-	int i, count;
-	exfat_dentry_t *array = NULL, *de;
-	aoff64_t pos = di->pos;
-
-	rc = exfat_directory_get(di, &de);
-	if (rc != EOK)
-		return rc;
-	count = de->file.count + 1;
-	array = (exfat_dentry_t *) malloc(count * sizeof(exfat_dentry_t));
-	if (!array)
-		return ENOMEM;
-	for (i = 0; i < count; i++) {
-		rc = exfat_directory_get(di, &de);
-		if (rc != EOK) {
-			free(array);
-			return rc;
-		}
-		array[i] = *de;
-		rc = exfat_directory_next(di);
-		if (rc != EOK) {
-			free(array);
-			return rc;
-		}
-	}
-	rc = exfat_directory_seek(di, pos);
-	if (rc != EOK) {
-		free(array);
-		return rc;
-	}
-
-	/* Sync */
-	array[0].file.attr = host2uint16_t_le(df->attr);
-	array[1].stream.firstc = host2uint32_t_le(ds->firstc);
-	array[1].stream.flags = ds->flags;
-	array[1].stream.valid_data_size = host2uint64_t_le(ds->valid_data_size);
-	array[1].stream.data_size = host2uint64_t_le(ds->data_size);
-	array[0].file.checksum =
-	    host2uint16_t_le(exfat_directory_set_checksum((uint8_t *)array,
-	    count * sizeof(exfat_dentry_t)));
-
-	/* Store */
-	for (i = 0; i < count; i++) {
-		rc = exfat_directory_get(di, &de);
-		if (rc != EOK) {
-			free(array);
-			return rc;
-		}
-		*de = array[i];
-		di->b->dirty = true;
-		rc = exfat_directory_next(di);
-		if (rc != EOK) {
-			free(array);
-			return rc;
-		}
-	}
-	free(array);
-
-	return EOK;
-}
-
-errno_t exfat_directory_write_file(exfat_directory_t *di, const char *name)
-{
-	fs_node_t *fn;
-	exfat_node_t *uctablep;
-	uint16_t *uctable;
-	exfat_dentry_t df, ds, *de;
-	uint16_t wname[EXFAT_FILENAME_LEN + 1];
-	errno_t rc;
-	int i;
-	size_t uctable_chars, j;
-	aoff64_t pos;
-
-	rc = str_to_utf16(wname, EXFAT_FILENAME_LEN, name);
-	if (rc != EOK)
-		return rc;
-	rc = exfat_uctable_get(&fn, di->service_id);
-	if (rc != EOK)
-		return rc;
-	uctablep = EXFAT_NODE(fn);
-
-	uctable_chars = ALIGN_DOWN(uctablep->size,
-	    sizeof(uint16_t)) / sizeof(uint16_t);
-	uctable = (uint16_t *) malloc(uctable_chars * sizeof(uint16_t));
-	rc = exfat_read_uctable(di->bs, uctablep, (uint8_t *)uctable);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		free(uctable);
-		return rc;
-	}
-
-	/* Fill stream entry */
-	ds.type = EXFAT_TYPE_STREAM;
-	ds.stream.flags = 0;
-	ds.stream.valid_data_size = 0;
-	ds.stream.data_size = 0;
-	ds.stream.name_size = utf16_wsize(wname);
-	ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable,
-	    uctable_chars));
-
-	/* Fill file entry */
-	df.type = EXFAT_TYPE_FILE;
-	df.file.attr = 0;
-	df.file.count = ROUND_UP(ds.stream.name_size, EXFAT_NAME_PART_LEN) /
-	    EXFAT_NAME_PART_LEN + 1;
-	df.file.checksum = 0;
-
-	free(uctable);
-	rc = exfat_node_put(fn);
-	if (rc != EOK)
-		return rc;
-
-	/* Looking for set of free entries */
-	rc = exfat_directory_lookup_free(di, df.file.count + 1);
-	if (rc != EOK)
-		return rc;
-	pos = di->pos;
-
-	/* Write file entry */
-	rc = exfat_directory_get(di, &de);
-	if (rc != EOK)
-		return rc;
-	*de = df;
-	di->b->dirty = true;
-	rc = exfat_directory_next(di);
-	if (rc != EOK)
-		return rc;
-
-	/* Write stream entry */
-	rc = exfat_directory_get(di, &de);
-	if (rc != EOK)
-		return rc;
-	*de = ds;
-	di->b->dirty = true;
-
-	/* Write file name */
-	size_t chars = EXFAT_NAME_PART_LEN;
-	uint16_t *sname = wname;
-
-	for (i = 0; i < ds.stream.name_size; i++)
-		wname[i] = host2uint16_t_le(wname[i]);
-
-	for (i = 0; i < df.file.count - 1; i++) {
-		rc = exfat_directory_next(di);
-		if (rc != EOK)
-			return rc;
-
-		if (i == df.file.count - 2) {
-			chars = ds.stream.name_size -
-			    EXFAT_NAME_PART_LEN * (df.file.count - 2);
-		}
-
-		rc = exfat_directory_get(di, &de);
-		if (rc != EOK)
-			return rc;
-		de->type = EXFAT_TYPE_NAME;
-		/* test */
-		for (j = 0; j < chars; j++) {
-			de->name.name[j] = *sname;
-			sname++;
-		}
-
-		di->b->dirty = true;
-	}
-
-	return exfat_directory_seek(di, pos);
-}
-
-errno_t exfat_directory_erase_file(exfat_directory_t *di, aoff64_t pos)
-{
-	errno_t rc;
-	int count;
-	exfat_dentry_t *de;
-
-	di->pos = pos;
-
-	rc = exfat_directory_get(di, &de);
-	if (rc != EOK)
-		return rc;
-	count = de->file.count + 1;
-
-	while (count) {
-		rc = exfat_directory_get(di, &de);
-		if (rc != EOK)
-			return rc;
-		de->type &= ~EXFAT_TYPE_USED;
-		di->b->dirty = true;
-
-		rc = exfat_directory_next(di);
-		if (rc != EOK)
-			return rc;
-		count--;
-	}
-	return EOK;
-}
-
-errno_t exfat_directory_expand(exfat_directory_t *di)
-{
-	errno_t rc;
-
-	if (!di->nodep)
-		return ENOSPC;
-
-	rc = exfat_node_expand(di->nodep->idx->service_id, di->nodep, 1);
-	if (rc != EOK)
-		return rc;
-
-	di->fragmented = di->nodep->fragmented;
-	di->nodep->size += BPC(di->bs);
-	di->nodep->dirty = true;		/* need to sync node */
-	di->blocks = di->nodep->size / BPS(di->bs);
-
-	return EOK;
-}
-
-errno_t exfat_directory_lookup_free(exfat_directory_t *di, size_t count)
-{
-	errno_t rc;
-	exfat_dentry_t *d;
-	size_t found;
-	aoff64_t pos;
-
-	rc = exfat_directory_seek(di, 0);
-	if (rc != EOK)
-		return rc;
-
-	do {
-		found = 0;
-		pos = 0;
-		do {
-			if (exfat_directory_get(di, &d) == EOK) {
-				switch (exfat_classify_dentry(d)) {
-				case EXFAT_DENTRY_LAST:
-				case EXFAT_DENTRY_FREE:
-					if (found == 0)
-						pos = di->pos;
-					found++;
-					if (found == count) {
-						exfat_directory_seek(di, pos);
-						return EOK;
-					}
-					break;
-				default:
-					found = 0;
-					break;
-				}
-			}
-		} while (exfat_directory_next(di) == EOK);
-	} while (exfat_directory_expand(di) == EOK);
-	return ENOSPC;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_directory.h
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-#ifndef EXFAT_EXFAT_DIRECTORY_H_
-#define EXFAT_EXFAT_DIRECTORY_H_
-
-#include <stdint.h>
-#include "exfat.h"
-#include "exfat_fat.h"
-#include "exfat_dentry.h"
-
-typedef struct {
-	/* Directory data */
-	exfat_bs_t *bs;
-	exfat_node_t *nodep;
-	service_id_t service_id;
-	uint32_t blocks;
-	uint32_t bnum;
-	aoff64_t pos;
-	block_t *b;
-	bool last;
-	bool fragmented;
-	exfat_cluster_t firstc;
-} exfat_directory_t;
-
-extern void exfat_directory_init(exfat_directory_t *);
-extern errno_t exfat_directory_open(exfat_node_t *, exfat_directory_t *);
-extern errno_t exfat_directory_open_parent(exfat_directory_t *, service_id_t,
-    exfat_cluster_t, bool);
-extern errno_t exfat_directory_close(exfat_directory_t *);
-
-extern errno_t exfat_directory_next(exfat_directory_t *);
-extern errno_t exfat_directory_prev(exfat_directory_t *);
-extern errno_t exfat_directory_seek(exfat_directory_t *, aoff64_t);
-extern errno_t exfat_directory_get(exfat_directory_t *, exfat_dentry_t **);
-extern errno_t exfat_directory_find(exfat_directory_t *, exfat_dentry_clsf_t,
-    exfat_dentry_t **);
-extern errno_t exfat_directory_find_continue(exfat_directory_t *,
-    exfat_dentry_clsf_t, exfat_dentry_t **);
-
-extern errno_t exfat_directory_read_file(exfat_directory_t *, char *, size_t,
-    exfat_file_dentry_t *, exfat_stream_dentry_t *);
-extern errno_t exfat_directory_read_vollabel(exfat_directory_t *, char *, size_t);
-extern errno_t exfat_directory_sync_file(exfat_directory_t *, exfat_file_dentry_t *,
-    exfat_stream_dentry_t *);
-extern errno_t exfat_directory_write_file(exfat_directory_t *, const char *);
-extern errno_t exfat_directory_erase_file(exfat_directory_t *, aoff64_t);
-
-extern errno_t exfat_directory_expand(exfat_directory_t *);
-extern errno_t exfat_directory_lookup_free(exfat_directory_t *, size_t);
-extern errno_t exfat_directory_print(exfat_directory_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_fat.c
===================================================================
--- uspace/srv/fs/exfat/exfat_fat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,560 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_fat.c
- * @brief	Functions that manipulate the File Allocation Table.
- */
-
-#include "exfat_fat.h"
-#include "exfat_bitmap.h"
-#include "exfat.h"
-#include "../../vfs/vfs.h"
-#include <libfs.h>
-#include <block.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <align.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-
-/**
- * The fat_alloc_lock mutex protects all copies of the File Allocation Table
- * during allocation of clusters. The lock does not have to be held durring
- * deallocation of clusters.
- */
-static FIBRIL_MUTEX_INITIALIZE(exfat_alloc_lock);
-
-/** Walk the cluster chain.
- *
- * @param bs		Buffer holding the boot sector for the file.
- * @param service_id	Service ID of the device with the file.
- * @param firstc	First cluster to start the walk with.
- * @param lastc		If non-NULL, output argument hodling the last cluster
- *			number visited.
- * @param numc		If non-NULL, output argument holding the number of
- *			clusters seen during the walk.
- * @param max_clusters	Maximum number of clusters to visit.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_cluster_walk(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t firstc, exfat_cluster_t *lastc, uint32_t *numc,
-    uint32_t max_clusters)
-{
-	uint32_t clusters = 0;
-	exfat_cluster_t clst = firstc;
-	errno_t rc;
-
-	if (firstc < EXFAT_CLST_FIRST) {
-		/* No space allocated to the file. */
-		if (lastc)
-			*lastc = firstc;
-		if (numc)
-			*numc = 0;
-		return EOK;
-	}
-
-	while (clst != EXFAT_CLST_EOF && clusters < max_clusters) {
-		assert(clst >= EXFAT_CLST_FIRST);
-		if (lastc)
-			*lastc = clst;	/* remember the last cluster number */
-
-		rc = exfat_get_cluster(bs, service_id, clst, &clst);
-		if (rc != EOK)
-			return rc;
-
-		assert(clst != EXFAT_CLST_BAD);
-		clusters++;
-	}
-
-	if (lastc && clst != EXFAT_CLST_EOF)
-		*lastc = clst;
-	if (numc)
-		*numc = clusters;
-
-	return EOK;
-}
-
-/** Read block from file located on a exFAT file system.
- *
- * @param block		Pointer to a block pointer for storing result.
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		FAT node.
- * @param bn		Block number.
- * @param flags		Flags passed to libblock.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_block_get(block_t **block, exfat_bs_t *bs, exfat_node_t *nodep,
-    aoff64_t bn, int flags)
-{
-	exfat_cluster_t firstc = nodep->firstc;
-	exfat_cluster_t currc = 0;
-	aoff64_t relbn = bn;
-	errno_t rc;
-
-	if (!nodep->size)
-		return ELIMIT;
-
-	if (nodep->fragmented) {
-		if (((((nodep->size - 1) / BPS(bs)) / SPC(bs)) == bn / SPC(bs)) &&
-		    nodep->lastc_cached_valid) {
-			/*
-			 * This is a request to read a block within the last cluster
-			 * when fortunately we have the last cluster number cached.
-			 */
-			return block_get(block, nodep->idx->service_id, DATA_FS(bs) +
-			    (nodep->lastc_cached_value - EXFAT_CLST_FIRST) * SPC(bs) +
-			    (bn % SPC(bs)), flags);
-		}
-
-		if (nodep->currc_cached_valid && bn >= nodep->currc_cached_bn) {
-			/*
-			 * We can start with the cluster cached by the previous call to
-			 * fat_block_get().
-			 */
-			firstc = nodep->currc_cached_value;
-			relbn -= (nodep->currc_cached_bn / SPC(bs)) * SPC(bs);
-		}
-	}
-
-	rc = exfat_block_get_by_clst(block, bs, nodep->idx->service_id,
-	    nodep->fragmented, firstc, &currc, relbn, flags);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Update the "current" cluster cache.
-	 */
-	nodep->currc_cached_valid = true;
-	nodep->currc_cached_bn = bn;
-	nodep->currc_cached_value = currc;
-
-	return rc;
-}
-
-/** Read block from file located on a exFAT file system.
- *
- * @param block		Pointer to a block pointer for storing result.
- * @param bs		Buffer holding the boot sector of the file system.
- * @param service_id	Service ID of the file system.
- * @param fcl		First cluster used by the file. Can be zero if the file
- *			is empty.
- * @param clp		If not NULL, address where the cluster containing bn
- *			will be stored.
- *			stored
- * @param bn		Block number.
- * @param flags		Flags passed to libblock.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_block_get_by_clst(block_t **block, exfat_bs_t *bs,
-    service_id_t service_id, bool fragmented, exfat_cluster_t fcl,
-    exfat_cluster_t *clp, aoff64_t bn, int flags)
-{
-	uint32_t clusters;
-	uint32_t max_clusters;
-	exfat_cluster_t c = EXFAT_CLST_FIRST;
-	errno_t rc;
-
-	if (fcl < EXFAT_CLST_FIRST || fcl > DATA_CNT(bs) + 2)
-		return ELIMIT;
-
-	if (!fragmented) {
-		rc = block_get(block, service_id, DATA_FS(bs) +
-		    (fcl - EXFAT_CLST_FIRST) * SPC(bs) + bn, flags);
-	} else {
-		max_clusters = bn / SPC(bs);
-		rc = exfat_cluster_walk(bs, service_id, fcl, &c, &clusters, max_clusters);
-		if (rc != EOK)
-			return rc;
-		assert(clusters == max_clusters);
-
-		rc = block_get(block, service_id, DATA_FS(bs) +
-		    (c - EXFAT_CLST_FIRST) * SPC(bs) + (bn % SPC(bs)), flags);
-
-		if (clp)
-			*clp = c;
-	}
-
-	return rc;
-}
-
-/** Get cluster from the FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which to get.
- * @param value		Output argument holding the value of the cluster.
- *
- * @return		EOK or an error code.
- */
-errno_t
-exfat_get_cluster(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t clst, exfat_cluster_t *value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = clst * sizeof(exfat_cluster_t);
-
-	rc = block_get(&b, service_id, FAT_FS(bs) + offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	*value = uint32_t_le2host(*(uint32_t *)(b->data + offset % BPS(bs)));
-
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Set cluster in FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which is to be set.
- * @param value		Value to set the cluster with.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_set_cluster(exfat_bs_t *bs, service_id_t service_id,
-    exfat_cluster_t clst, exfat_cluster_t value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = clst * sizeof(exfat_cluster_t);
-
-	rc = block_get(&b, service_id, FAT_FS(bs) + offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	*(uint32_t *)(b->data + offset % BPS(bs)) = host2uint32_t_le(value);
-
-	b->dirty = true;	/* need to sync block */
-	rc = block_put(b);
-	return rc;
-}
-
-/** Allocate clusters in FAT.
- *
- * This function will attempt to allocate the requested number of clusters in
- * the FAT.  The FAT will be altered so that the allocated
- * clusters form an independent chain (i.e. a chain which does not belong to any
- * file yet).
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param service_id	Service ID of the file system.
- * @param nclsts	Number of clusters to allocate.
- * @param mcl		Output parameter where the first cluster in the chain
- *			will be returned.
- * @param lcl		Output parameter where the last cluster in the chain
- *			will be returned.
- *
- * @return		EOK on success, an error code otherwise.
- */
-errno_t
-exfat_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, unsigned nclsts,
-    exfat_cluster_t *mcl, exfat_cluster_t *lcl)
-{
-	exfat_cluster_t *lifo;    /* stack for storing free cluster numbers */
-	unsigned found = 0;     /* top of the free cluster number stack */
-	exfat_cluster_t clst;
-	errno_t rc = EOK;
-
-	lifo = (exfat_cluster_t *) malloc(nclsts * sizeof(exfat_cluster_t));
-	if (!lifo)
-		return ENOMEM;
-
-	fibril_mutex_lock(&exfat_alloc_lock);
-	for (clst = EXFAT_CLST_FIRST; clst < DATA_CNT(bs) + 2 && found < nclsts;
-	    clst++) {
-		/* Need to rewrite because of multiple exfat_bitmap_get calls */
-		if (exfat_bitmap_is_free(bs, service_id, clst) == EOK) {
-			/*
-			 * The cluster is free. Put it into our stack
-			 * of found clusters and mark it as non-free.
-			 */
-			lifo[found] = clst;
-			rc = exfat_set_cluster(bs, service_id, clst,
-			    (found == 0) ?  EXFAT_CLST_EOF : lifo[found - 1]);
-			if (rc != EOK)
-				goto exit_error;
-			found++;
-			rc = exfat_bitmap_set_cluster(bs, service_id, clst);
-			if (rc != EOK)
-				goto exit_error;
-
-		}
-	}
-
-	if (rc == EOK && found == nclsts) {
-		*mcl = lifo[found - 1];
-		*lcl = lifo[0];
-		free(lifo);
-		fibril_mutex_unlock(&exfat_alloc_lock);
-		return EOK;
-	}
-
-	rc = ENOSPC;
-
-exit_error:
-
-	/* If something wrong - free the clusters */
-	while (found--) {
-		(void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]);
-		(void) exfat_set_cluster(bs, service_id, lifo[found], 0);
-	}
-
-	free(lifo);
-	fibril_mutex_unlock(&exfat_alloc_lock);
-	return rc;
-}
-
-/** Free clusters forming a cluster chain in FAT.
- *
- * @param bs		Buffer hodling the boot sector of the file system.
- * @param service_id	Service ID of the file system.
- * @param firstc	First cluster in the chain which is to be freed.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_free_clusters(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t firstc)
-{
-	exfat_cluster_t nextc;
-	errno_t rc;
-
-	/* Mark all clusters in the chain as free */
-	while (firstc != EXFAT_CLST_EOF) {
-		assert(firstc >= EXFAT_CLST_FIRST && firstc < EXFAT_CLST_BAD);
-		rc = exfat_get_cluster(bs, service_id, firstc, &nextc);
-		if (rc != EOK)
-			return rc;
-		rc = exfat_set_cluster(bs, service_id, firstc, 0);
-		if (rc != EOK)
-			return rc;
-		rc = exfat_bitmap_clear_cluster(bs, service_id, firstc);
-		if (rc != EOK)
-			return rc;
-		firstc = nextc;
-	}
-
-	return EOK;
-}
-
-/** Append a cluster chain to the last file cluster in FAT.
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		Node representing the file.
- * @param mcl		First cluster of the cluster chain to append.
- * @param lcl		Last cluster of the cluster chain to append.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-exfat_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t mcl,
-    exfat_cluster_t lcl)
-{
-	service_id_t service_id = nodep->idx->service_id;
-	exfat_cluster_t lastc = 0;
-	errno_t rc;
-
-	if (nodep->firstc == 0) {
-		/* No clusters allocated to the node yet. */
-		nodep->firstc = mcl;
-		nodep->dirty = true;	/* need to sync node */
-	} else {
-		if (nodep->lastc_cached_valid) {
-			lastc = nodep->lastc_cached_value;
-			nodep->lastc_cached_valid = false;
-		} else {
-			rc = exfat_cluster_walk(bs, service_id, nodep->firstc,
-			    &lastc, NULL, (uint16_t) -1);
-			if (rc != EOK)
-				return rc;
-		}
-
-		rc = exfat_set_cluster(bs, nodep->idx->service_id, lastc, mcl);
-		if (rc != EOK)
-			return rc;
-	}
-
-	nodep->lastc_cached_valid = true;
-	nodep->lastc_cached_value = lcl;
-
-	return EOK;
-}
-
-/** Chop off node clusters in FAT.
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		FAT node where the chopping will take place.
- * @param lcl		Last cluster which will remain in the node. If this
- *			argument is FAT_CLST_RES0, then all clusters will
- *			be chopped off.
- *
- * @return		EOK on success or an error code.
- */
-errno_t exfat_chop_clusters(exfat_bs_t *bs, exfat_node_t *nodep, exfat_cluster_t lcl)
-{
-	errno_t rc;
-	service_id_t service_id = nodep->idx->service_id;
-
-	/*
-	 * Invalidate cached cluster numbers.
-	 */
-	nodep->lastc_cached_valid = false;
-	if (nodep->currc_cached_value != lcl)
-		nodep->currc_cached_valid = false;
-
-	if (lcl == 0) {
-		/* The node will have zero size and no clusters allocated. */
-		rc = exfat_free_clusters(bs, service_id, nodep->firstc);
-		if (rc != EOK)
-			return rc;
-		nodep->firstc = 0;
-		nodep->dirty = true;		/* need to sync node */
-	} else {
-		exfat_cluster_t nextc;
-
-		rc = exfat_get_cluster(bs, service_id, lcl, &nextc);
-		if (rc != EOK)
-			return rc;
-
-		/* Terminate the cluster chain */
-		rc = exfat_set_cluster(bs, service_id, lcl, EXFAT_CLST_EOF);
-		if (rc != EOK)
-			return rc;
-
-		/* Free all following clusters. */
-		rc = exfat_free_clusters(bs, service_id, nextc);
-		if (rc != EOK)
-			return rc;
-	}
-
-	/*
-	 * Update and re-enable the last cluster cache.
-	 */
-	nodep->lastc_cached_valid = true;
-	nodep->lastc_cached_value = lcl;
-
-	return EOK;
-}
-
-errno_t
-exfat_zero_cluster(exfat_bs_t *bs, service_id_t service_id, exfat_cluster_t c)
-{
-	size_t i;
-	block_t *b;
-	errno_t rc;
-
-	for (i = 0; i < SPC(bs); i++) {
-		rc = exfat_block_get_by_clst(&b, bs, service_id, false, c, NULL,
-		    i, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-		memset(b->data, 0, BPS(bs));
-		b->dirty = true;
-		rc = block_put(b);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-errno_t
-exfat_read_uctable(exfat_bs_t *bs, exfat_node_t *nodep, uint8_t *uctable)
-{
-	size_t i, blocks, count;
-	block_t *b;
-	errno_t rc;
-	blocks = ROUND_UP(nodep->size, BPS(bs)) / BPS(bs);
-	count = BPS(bs);
-
-	for (i = 0; i < blocks; i++) {
-		rc = exfat_block_get(&b, bs, nodep, i, BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-		if (i == blocks - 1)
-			count = nodep->size - i * BPS(bs);
-		memcpy(uctable, b->data, count);
-		uctable += count;
-		rc = block_put(b);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Perform basic sanity checks on the file system.
- *
- * Verify if values of boot sector fields are sane. Also verify media
- * descriptor. This is used to rule out cases when a device obviously
- * does not contain a exfat file system.
- */
-errno_t exfat_sanity_check(exfat_bs_t *bs)
-{
-	if (str_cmp((char const *)bs->oem_name, "EXFAT   "))
-		return ENOTSUP;
-	else if (uint16_t_le2host(bs->signature) != 0xAA55)
-		return ENOTSUP;
-	else if (uint32_t_le2host(bs->fat_sector_count) == 0)
-		return ENOTSUP;
-	else if (uint32_t_le2host(bs->data_clusters) == 0)
-		return ENOTSUP;
-	else if (bs->fat_count != 1)
-		return ENOTSUP;
-	else if ((bs->bytes_per_sector + bs->sec_per_cluster) > 25) {
-		/* exFAT does not support cluster size > 32 Mb */
-		return ENOTSUP;
-	}
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_fat.h
===================================================================
--- uspace/srv/fs/exfat/exfat_fat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-#ifndef EXFAT_FAT_FAT_H_
-#define EXFAT_FAT_FAT_H_
-
-#include "../../vfs/vfs.h"
-#include <stdint.h>
-#include <block.h>
-
-#define EXFAT_ROOT_IDX		0
-#define EXFAT_BITMAP_IDX	1
-#define EXFAT_UCTABLE_IDX	2
-
-#define EXFAT_ROOT_PAR	0
-#define EXFAT_ROOT_POS	0
-
-#define EXFAT_CLST_FIRST	0x00000002
-#define EXFAT_CLST_LAST		0xfffffff6
-#define EXFAT_CLST_BAD		0xfffffff7
-#define EXFAT_CLST_EOF		0xffffffff
-
-/* forward declarations */
-struct block;
-struct exfat_node;
-struct exfat_bs;
-
-typedef uint32_t exfat_cluster_t;
-
-#define exfat_clusters_get(numc, bs, sid, fc) \
-    exfat_cluster_walk((bs), (sid), (fc), NULL, (numc), (uint32_t) -1)
-
-extern errno_t exfat_cluster_walk(struct exfat_bs *, service_id_t,
-    exfat_cluster_t, exfat_cluster_t *, uint32_t *, uint32_t);
-extern errno_t exfat_block_get(block_t **, struct exfat_bs *, struct exfat_node *,
-    aoff64_t, int);
-extern errno_t exfat_block_get_by_clst(block_t **, struct exfat_bs *, service_id_t,
-    bool, exfat_cluster_t, exfat_cluster_t *, aoff64_t, int);
-
-extern errno_t exfat_get_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
-    exfat_cluster_t *);
-extern errno_t exfat_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t,
-    exfat_cluster_t);
-extern errno_t exfat_sanity_check(struct exfat_bs *);
-
-extern errno_t exfat_append_clusters(struct exfat_bs *, struct exfat_node *,
-    exfat_cluster_t, exfat_cluster_t);
-extern errno_t exfat_chop_clusters(struct exfat_bs *, struct exfat_node *,
-    exfat_cluster_t);
-extern errno_t exfat_alloc_clusters(struct exfat_bs *, service_id_t, unsigned,
-    exfat_cluster_t *, exfat_cluster_t *);
-extern errno_t exfat_free_clusters(struct exfat_bs *, service_id_t, exfat_cluster_t);
-extern errno_t exfat_zero_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t);
-
-extern errno_t exfat_read_uctable(struct exfat_bs *, struct exfat_node *,
-    uint8_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_idx.c
===================================================================
--- uspace/srv/fs/exfat/exfat_idx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,564 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_idx.c
- * @brief	Layer for translating exFAT entities to VFS node indices.
- */
-
-#include "exfat.h"
-#include <errno.h>
-#include <str.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-
-/** Each instance of this type describes one interval of freed VFS indices. */
-typedef struct {
-	link_t		link;
-	fs_index_t	first;
-	fs_index_t	last;
-} freed_t;
-
-/**
- * Each instance of this type describes state of all VFS indices that
- * are currently unused.
- */
-typedef struct {
-	link_t link;
-	service_id_t service_id;
-
-	/** Next unassigned index. */
-	fs_index_t next;
-	/** Number of remaining unassigned indices. */
-	uint64_t remaining;
-
-	/** Sorted list of intervals of freed indices. */
-	list_t freed_list;
-} unused_t;
-
-/** Mutex protecting the list of unused structures. */
-static FIBRIL_MUTEX_INITIALIZE(unused_lock);
-
-/** List of unused structures. */
-static LIST_INITIALIZE(unused_list);
-
-static void unused_initialize(unused_t *u, service_id_t service_id)
-{
-	link_initialize(&u->link);
-	u->service_id = service_id;
-	u->next = 0;
-	u->remaining = ((uint64_t)((fs_index_t)-1)) + 1;
-	list_initialize(&u->freed_list);
-}
-
-static unused_t *unused_find(service_id_t service_id, bool lock)
-{
-	if (lock)
-		fibril_mutex_lock(&unused_lock);
-
-	list_foreach(unused_list, link, unused_t, u) {
-		if (u->service_id == service_id)
-			return u;
-	}
-
-	if (lock)
-		fibril_mutex_unlock(&unused_lock);
-	return NULL;
-}
-
-/** Mutex protecting the up_hash and ui_hash. */
-static FIBRIL_MUTEX_INITIALIZE(used_lock);
-
-/**
- * Global hash table of all used exfat_idx_t structures.
- * The index structures are hashed by the service_id, parent node's first
- * cluster and index within the parent directory.
- */
-static hash_table_t up_hash;
-
-typedef struct {
-	service_id_t service_id;
-	exfat_cluster_t pfc;
-	unsigned pdi;
-} pos_key_t;
-
-static inline size_t pos_key_hash(const void *key)
-{
-	const pos_key_t *pos = key;
-
-	size_t hash = 0;
-	hash = hash_combine(pos->pfc, pos->pdi);
-	return hash_combine(hash, pos->service_id);
-}
-
-static size_t pos_hash(const ht_link_t *item)
-{
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link);
-
-	pos_key_t pkey = {
-		.service_id = fidx->service_id,
-		.pfc = fidx->pfc,
-		.pdi = fidx->pdi,
-	};
-
-	return pos_key_hash(&pkey);
-}
-
-static bool pos_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const pos_key_t *pos = key;
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link);
-
-	return pos->service_id == fidx->service_id &&
-	    pos->pdi == fidx->pdi &&
-	    pos->pfc == fidx->pfc;
-}
-
-static const hash_table_ops_t uph_ops = {
-	.hash = pos_hash,
-	.key_hash = pos_key_hash,
-	.key_equal = pos_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL,
-};
-
-/**
- * Global hash table of all used fat_idx_t structures.
- * The index structures are hashed by the service_id and index.
- */
-static hash_table_t ui_hash;
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} idx_key_t;
-
-static size_t idx_key_hash(const void *key_arg)
-{
-	const idx_key_t *key = key_arg;
-	return hash_combine(key->service_id, key->index);
-}
-
-static size_t idx_hash(const ht_link_t *item)
-{
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link);
-	return hash_combine(fidx->service_id, fidx->index);
-}
-
-static bool idx_key_equal(const void *key_arg, size_t hash,
-    const ht_link_t *item)
-{
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link);
-	const idx_key_t *key = key_arg;
-
-	return key->index == fidx->index && key->service_id == fidx->service_id;
-}
-
-static void idx_remove_callback(ht_link_t *item)
-{
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link);
-
-	free(fidx);
-}
-
-static const hash_table_ops_t uih_ops = {
-	.hash = idx_hash,
-	.key_hash = idx_key_hash,
-	.key_equal = idx_key_equal,
-	.equal = NULL,
-	.remove_callback = idx_remove_callback,
-};
-
-/** Allocate a VFS index which is not currently in use. */
-static bool exfat_index_alloc(service_id_t service_id, fs_index_t *index)
-{
-	unused_t *u;
-
-	assert(index);
-	u = unused_find(service_id, true);
-	if (!u)
-		return false;
-
-	if (list_empty(&u->freed_list)) {
-		if (u->remaining) {
-			/*
-			 * There are no freed indices, allocate one directly
-			 * from the counter.
-			 */
-			*index = u->next++;
-			--u->remaining;
-			fibril_mutex_unlock(&unused_lock);
-			return true;
-		}
-	} else {
-		/* There are some freed indices which we can reuse. */
-		freed_t *f = list_get_instance(list_first(&u->freed_list),
-		    freed_t, link);
-		*index = f->first;
-		if (f->first++ == f->last) {
-			/* Destroy the interval. */
-			list_remove(&f->link);
-			free(f);
-		}
-		fibril_mutex_unlock(&unused_lock);
-		return true;
-	}
-	/*
-	 * We ran out of indices, which is extremely unlikely with FAT16, but
-	 * theoretically still possible (e.g. too many open unlinked nodes or
-	 * too many zero-sized nodes).
-	 */
-	fibril_mutex_unlock(&unused_lock);
-	return false;
-}
-
-/** If possible, coalesce two intervals of freed indices. */
-static void try_coalesce_intervals(link_t *l, link_t *r, link_t *cur)
-{
-	freed_t *fl = list_get_instance(l, freed_t, link);
-	freed_t *fr = list_get_instance(r, freed_t, link);
-
-	if (fl->last + 1 == fr->first) {
-		if (cur == l) {
-			fl->last = fr->last;
-			list_remove(r);
-			free(r);
-		} else {
-			fr->first = fl->first;
-			list_remove(l);
-			free(l);
-		}
-	}
-}
-
-/** Free a VFS index, which is no longer in use. */
-static void exfat_index_free(service_id_t service_id, fs_index_t index)
-{
-	unused_t *u;
-
-	u = unused_find(service_id, true);
-	assert(u);
-
-	if (u->next == index + 1) {
-		/* The index can be returned directly to the counter. */
-		u->next--;
-		u->remaining++;
-	} else {
-		/*
-		 * The index must be returned either to an existing freed
-		 * interval or a new interval must be created.
-		 */
-		link_t *lnk;
-		freed_t *n;
-		for (lnk = u->freed_list.head.next; lnk != &u->freed_list.head;
-		    lnk = lnk->next) {
-			freed_t *f = list_get_instance(lnk, freed_t, link);
-			if (f->first == index + 1) {
-				f->first--;
-				if (lnk->prev != &u->freed_list.head)
-					try_coalesce_intervals(lnk->prev, lnk,
-					    lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-			if (f->last == index - 1) {
-				f->last++;
-				if (lnk->next != &u->freed_list.head)
-					try_coalesce_intervals(lnk, lnk->next,
-					    lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-			if (index > f->first) {
-				n = malloc(sizeof(freed_t));
-				/* TODO: sleep until allocation succeeds */
-				assert(n);
-				link_initialize(&n->link);
-				n->first = index;
-				n->last = index;
-				list_insert_before(&n->link, lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-
-		}
-		/* The index will form the last interval. */
-		n = malloc(sizeof(freed_t));
-		/* TODO: sleep until allocation succeeds */
-		assert(n);
-		link_initialize(&n->link);
-		n->first = index;
-		n->last = index;
-		list_append(&n->link, &u->freed_list);
-	}
-	fibril_mutex_unlock(&unused_lock);
-}
-
-static errno_t exfat_idx_create(exfat_idx_t **fidxp, service_id_t service_id)
-{
-	exfat_idx_t *fidx;
-
-	fidx = (exfat_idx_t *) malloc(sizeof(exfat_idx_t));
-	if (!fidx)
-		return ENOMEM;
-	if (!exfat_index_alloc(service_id, &fidx->index)) {
-		free(fidx);
-		return ENOSPC;
-	}
-
-	fibril_mutex_initialize(&fidx->lock);
-	fidx->service_id = service_id;
-	fidx->pfc = 0;	/* no parent yet */
-	fidx->pdi = 0;
-	fidx->nodep = NULL;
-
-	*fidxp = fidx;
-	return EOK;
-}
-
-errno_t exfat_idx_get_new(exfat_idx_t **fidxp, service_id_t service_id)
-{
-	exfat_idx_t *fidx;
-	errno_t rc;
-
-	fibril_mutex_lock(&used_lock);
-	rc = exfat_idx_create(&fidx, service_id);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&used_lock);
-		return rc;
-	}
-
-	hash_table_insert(&ui_hash, &fidx->uih_link);
-	fibril_mutex_lock(&fidx->lock);
-	fibril_mutex_unlock(&used_lock);
-
-	*fidxp = fidx;
-	return EOK;
-}
-
-exfat_idx_t *
-exfat_idx_get_by_pos(service_id_t service_id, exfat_cluster_t pfc, unsigned pdi)
-{
-	exfat_idx_t *fidx;
-
-	pos_key_t pos_key = {
-		.service_id = service_id,
-		.pfc = pfc,
-		.pdi = pdi,
-	};
-
-	fibril_mutex_lock(&used_lock);
-	ht_link_t *l = hash_table_find(&up_hash, &pos_key);
-	if (l) {
-		fidx = hash_table_get_inst(l, exfat_idx_t, uph_link);
-	} else {
-		errno_t rc;
-
-		rc = exfat_idx_create(&fidx, service_id);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&used_lock);
-			return NULL;
-		}
-
-		fidx->pfc = pfc;
-		fidx->pdi = pdi;
-
-		hash_table_insert(&up_hash, &fidx->uph_link);
-		hash_table_insert(&ui_hash, &fidx->uih_link);
-	}
-	fibril_mutex_lock(&fidx->lock);
-	fibril_mutex_unlock(&used_lock);
-
-	return fidx;
-}
-
-void exfat_idx_hashin(exfat_idx_t *idx)
-{
-	fibril_mutex_lock(&used_lock);
-	hash_table_insert(&up_hash, &idx->uph_link);
-	fibril_mutex_unlock(&used_lock);
-}
-
-void exfat_idx_hashout(exfat_idx_t *idx)
-{
-	fibril_mutex_lock(&used_lock);
-	hash_table_remove_item(&up_hash, &idx->uph_link);
-	fibril_mutex_unlock(&used_lock);
-}
-
-exfat_idx_t *
-exfat_idx_get_by_index(service_id_t service_id, fs_index_t index)
-{
-	exfat_idx_t *fidx = NULL;
-
-	idx_key_t idx_key = {
-		.service_id = service_id,
-		.index = index,
-	};
-
-	fibril_mutex_lock(&used_lock);
-	ht_link_t *l = hash_table_find(&ui_hash, &idx_key);
-	if (l) {
-		fidx = hash_table_get_inst(l, exfat_idx_t, uih_link);
-		fibril_mutex_lock(&fidx->lock);
-	}
-	fibril_mutex_unlock(&used_lock);
-
-	return fidx;
-}
-
-/** Destroy the index structure.
- *
- * @param idx		The index structure to be destroyed.
- */
-void exfat_idx_destroy(exfat_idx_t *idx)
-{
-	idx_key_t idx_key = {
-		.service_id = idx->service_id,
-		.index = idx->index,
-	};
-
-	/* TODO: assert(idx->pfc == FAT_CLST_RES0); */
-	assert(idx->pfc == 0);
-
-	fibril_mutex_lock(&used_lock);
-	/*
-	 * Since we can only free unlinked nodes, the index structure is not
-	 * present in the position hash (uph). We therefore hash it out from
-	 * the index hash only.
-	 */
-	hash_table_remove(&ui_hash, &idx_key);
-	fibril_mutex_unlock(&used_lock);
-	/* Release the VFS index. */
-	exfat_index_free(idx_key.service_id, idx_key.index);
-	/* The index structure itself is freed in idx_remove_callback(). */
-}
-
-errno_t exfat_idx_init(void)
-{
-	if (!hash_table_create(&up_hash, 0, 0, &uph_ops))
-		return ENOMEM;
-	if (!hash_table_create(&ui_hash, 0, 0, &uih_ops)) {
-		hash_table_destroy(&up_hash);
-		return ENOMEM;
-	}
-	return EOK;
-}
-
-void exfat_idx_fini(void)
-{
-	/* We assume the hash tables are empty. */
-	assert(hash_table_empty(&up_hash) && hash_table_empty(&ui_hash));
-	hash_table_destroy(&up_hash);
-	hash_table_destroy(&ui_hash);
-}
-
-errno_t exfat_idx_init_by_service_id(service_id_t service_id)
-{
-	unused_t *u;
-	errno_t rc = EOK;
-
-	u = (unused_t *) malloc(sizeof(unused_t));
-	if (!u)
-		return ENOMEM;
-	unused_initialize(u, service_id);
-	fibril_mutex_lock(&unused_lock);
-	if (!unused_find(service_id, false)) {
-		list_append(&u->link, &unused_list);
-	} else {
-		free(u);
-		rc = EEXIST;
-	}
-	fibril_mutex_unlock(&unused_lock);
-	return rc;
-}
-
-static bool rm_pos_service_id(ht_link_t *item, void *arg)
-{
-	service_id_t service_id = *(service_id_t *)arg;
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uph_link);
-
-	if (fidx->service_id == service_id) {
-		hash_table_remove_item(&up_hash, item);
-	}
-
-	return true;
-}
-
-static bool rm_idx_service_id(ht_link_t *item, void *arg)
-{
-	service_id_t service_id = *(service_id_t *)arg;
-	exfat_idx_t *fidx = hash_table_get_inst(item, exfat_idx_t, uih_link);
-
-	if (fidx->service_id == service_id) {
-		hash_table_remove_item(&ui_hash, item);
-	}
-
-	return true;
-}
-
-void exfat_idx_fini_by_service_id(service_id_t service_id)
-{
-	/*
-	 * Remove this instance's index structure from up_hash and ui_hash.
-	 * Process up_hash first and ui_hash second because the index structure
-	 * is actually removed in idx_remove_callback().
-	 */
-	fibril_mutex_lock(&used_lock);
-	hash_table_apply(&up_hash, rm_pos_service_id, &service_id);
-	hash_table_apply(&ui_hash, rm_idx_service_id, &service_id);
-	fibril_mutex_unlock(&used_lock);
-
-	/*
-	 * Free the unused and freed structures for this instance.
-	 */
-	unused_t *u = unused_find(service_id, true);
-	assert(u);
-	list_remove(&u->link);
-	fibril_mutex_unlock(&unused_lock);
-
-	while (!list_empty(&u->freed_list)) {
-		freed_t *f;
-		f = list_get_instance(list_first(&u->freed_list), freed_t, link);
-		list_remove(&f->link);
-		free(f);
-	}
-	free(u);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/exfat_ops.c
===================================================================
--- uspace/srv/fs/exfat/exfat_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1630 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup exfat
- * @{
- */
-
-/**
- * @file	exfat_ops.c
- * @brief	Implementation of VFS operations for the exFAT file system
- *		server.
- */
-
-#include "exfat.h"
-#include "exfat_fat.h"
-#include "exfat_dentry.h"
-#include "exfat_directory.h"
-#include "exfat_bitmap.h"
-#include "../../vfs/vfs.h"
-#include <libfs.h>
-#include <block.h>
-#include <ipc/services.h>
-#include <ipc/loc.h>
-#include <macros.h>
-#include <async.h>
-#include <errno.h>
-#include <str.h>
-#include <byteorder.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <align.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-/** Mutex protecting the list of cached free FAT nodes. */
-static FIBRIL_MUTEX_INITIALIZE(ffn_mutex);
-
-/** List of cached free FAT nodes. */
-static LIST_INITIALIZE(ffn_list);
-
-/*
- * Forward declarations of FAT libfs operations.
- */
-
-static void exfat_fsinfo(exfat_bs_t *, service_id_t);
-static errno_t exfat_root_get(fs_node_t **, service_id_t);
-static errno_t exfat_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t exfat_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t exfat_node_open(fs_node_t *);
-/* static errno_t exfat_node_put(fs_node_t *); */
-static errno_t exfat_create_node(fs_node_t **, service_id_t, int);
-static errno_t exfat_destroy_node(fs_node_t *);
-static errno_t exfat_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t exfat_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t exfat_has_children(bool *, fs_node_t *);
-static fs_index_t exfat_index_get(fs_node_t *);
-static aoff64_t exfat_size_get(fs_node_t *);
-static unsigned exfat_lnkcnt_get(fs_node_t *);
-static bool exfat_is_directory(fs_node_t *);
-static bool exfat_is_file(fs_node_t *node);
-static service_id_t exfat_service_get(fs_node_t *node);
-static errno_t exfat_size_block(service_id_t, uint32_t *);
-static errno_t exfat_total_block_count(service_id_t, uint64_t *);
-static errno_t exfat_free_block_count(service_id_t, uint64_t *);
-
-/*
- * Helper functions.
- */
-static void exfat_node_initialize(exfat_node_t *node)
-{
-	fibril_mutex_initialize(&node->lock);
-	node->bp = NULL;
-	node->idx = NULL;
-	node->type = EXFAT_UNKNOW;
-	link_initialize(&node->ffn_link);
-	node->size = 0;
-	node->lnkcnt = 0;
-	node->refcnt = 0;
-	node->dirty = false;
-	node->fragmented = false;
-	node->lastc_cached_valid = false;
-	node->lastc_cached_value = 0;
-	node->currc_cached_valid = false;
-	node->currc_cached_bn = 0;
-	node->currc_cached_value = 0;
-}
-
-static errno_t exfat_node_sync(exfat_node_t *node)
-{
-	errno_t rc;
-	exfat_directory_t di;
-	exfat_file_dentry_t df;
-	exfat_stream_dentry_t ds;
-
-	if (!(node->type == EXFAT_DIRECTORY || node->type == EXFAT_FILE))
-		return EOK;
-
-	if (node->type == EXFAT_DIRECTORY)
-		df.attr = EXFAT_ATTR_SUBDIR;
-	else
-		df.attr = 0;
-
-	ds.firstc = node->firstc;
-	if (node->size == 0 && node->firstc == 0) {
-		ds.flags = 0;
-	} else {
-		ds.flags = 1;
-		ds.flags |= (!node->fragmented << 1);
-	}
-	ds.valid_data_size = node->size;
-	ds.data_size = node->size;
-
-	exfat_directory_open_parent(&di, node->idx->service_id, node->idx->pfc,
-	    node->idx->parent_fragmented);
-	rc = exfat_directory_seek(&di, node->idx->pdi);
-	if (rc != EOK) {
-		(void) exfat_directory_close(&di);
-		return rc;
-	}
-
-	rc = exfat_directory_sync_file(&di, &df, &ds);
-	if (rc != EOK) {
-		(void) exfat_directory_close(&di);
-		return rc;
-	}
-	return exfat_directory_close(&di);
-}
-
-static errno_t exfat_node_fini_by_service_id(service_id_t service_id)
-{
-	errno_t rc;
-
-	/*
-	 * We are called from fat_unmounted() and assume that there are already
-	 * no nodes belonging to this instance with non-zero refcount. Therefore
-	 * it is sufficient to clean up only the FAT free node list.
-	 */
-
-restart:
-	fibril_mutex_lock(&ffn_mutex);
-	list_foreach(ffn_list, ffn_link, exfat_node_t, nodep) {
-		if (!fibril_mutex_trylock(&nodep->lock)) {
-			fibril_mutex_unlock(&ffn_mutex);
-			goto restart;
-		}
-		if (!fibril_mutex_trylock(&nodep->idx->lock)) {
-			fibril_mutex_unlock(&nodep->lock);
-			fibril_mutex_unlock(&ffn_mutex);
-			goto restart;
-		}
-		if (nodep->idx->service_id != service_id) {
-			fibril_mutex_unlock(&nodep->idx->lock);
-			fibril_mutex_unlock(&nodep->lock);
-			continue;
-		}
-
-		list_remove(&nodep->ffn_link);
-		fibril_mutex_unlock(&ffn_mutex);
-
-		/*
-		 * We can unlock the node and its index structure because we are
-		 * the last player on this playground and VFS is preventing new
-		 * players from entering.
-		 */
-		fibril_mutex_unlock(&nodep->idx->lock);
-		fibril_mutex_unlock(&nodep->lock);
-
-		if (nodep->dirty) {
-			rc = exfat_node_sync(nodep);
-			if (rc != EOK)
-				return rc;
-		}
-		nodep->idx->nodep = NULL;
-		free(nodep->bp);
-		free(nodep);
-
-		/* Need to restart because we changed the ffn_list. */
-		goto restart;
-	}
-	fibril_mutex_unlock(&ffn_mutex);
-
-	return EOK;
-}
-
-static errno_t exfat_node_get_new(exfat_node_t **nodepp)
-{
-	fs_node_t *fn;
-	exfat_node_t *nodep;
-	errno_t rc;
-
-	fibril_mutex_lock(&ffn_mutex);
-	if (!list_empty(&ffn_list)) {
-		/* Try to use a cached free node structure. */
-		exfat_idx_t *idxp_tmp;
-		nodep = list_get_instance(list_first(&ffn_list), exfat_node_t,
-		    ffn_link);
-		if (!fibril_mutex_trylock(&nodep->lock))
-			goto skip_cache;
-		idxp_tmp = nodep->idx;
-		if (!fibril_mutex_trylock(&idxp_tmp->lock)) {
-			fibril_mutex_unlock(&nodep->lock);
-			goto skip_cache;
-		}
-		list_remove(&nodep->ffn_link);
-		fibril_mutex_unlock(&ffn_mutex);
-		if (nodep->dirty) {
-			rc = exfat_node_sync(nodep);
-			if (rc != EOK) {
-				idxp_tmp->nodep = NULL;
-				fibril_mutex_unlock(&nodep->lock);
-				fibril_mutex_unlock(&idxp_tmp->lock);
-				free(nodep->bp);
-				free(nodep);
-				return rc;
-			}
-		}
-		idxp_tmp->nodep = NULL;
-		fibril_mutex_unlock(&nodep->lock);
-		fibril_mutex_unlock(&idxp_tmp->lock);
-		fn = FS_NODE(nodep);
-	} else {
-	skip_cache:
-		/* Try to allocate a new node structure. */
-		fibril_mutex_unlock(&ffn_mutex);
-		fn = (fs_node_t *)malloc(sizeof(fs_node_t));
-		if (!fn)
-			return ENOMEM;
-		nodep = (exfat_node_t *)malloc(sizeof(exfat_node_t));
-		if (!nodep) {
-			free(fn);
-			return ENOMEM;
-		}
-	}
-	exfat_node_initialize(nodep);
-	fs_node_initialize(fn);
-	fn->data = nodep;
-	nodep->bp = fn;
-
-	*nodepp = nodep;
-	return EOK;
-}
-
-static errno_t exfat_node_get_new_by_pos(exfat_node_t **nodepp,
-    service_id_t service_id, exfat_cluster_t pfc, unsigned pdi)
-{
-	exfat_idx_t *idxp = exfat_idx_get_by_pos(service_id, pfc, pdi);
-	if (!idxp)
-		return ENOMEM;
-	if (exfat_node_get_new(nodepp) != EOK)
-		return ENOMEM;
-	(*nodepp)->idx = idxp;
-	idxp->nodep = *nodepp;
-	return EOK;
-}
-
-/** Internal version of exfat_node_get().
- *
- * @param idxp		Locked index structure.
- */
-static errno_t exfat_node_get_core(exfat_node_t **nodepp, exfat_idx_t *idxp)
-{
-	exfat_dentry_t *d;
-	exfat_node_t *nodep = NULL;
-	exfat_directory_t di;
-	errno_t rc;
-
-	if (idxp->nodep) {
-		/*
-		 * We are lucky.
-		 * The node is already instantiated in memory.
-		 */
-		fibril_mutex_lock(&idxp->nodep->lock);
-		if (!idxp->nodep->refcnt++) {
-			fibril_mutex_lock(&ffn_mutex);
-			list_remove(&idxp->nodep->ffn_link);
-			fibril_mutex_unlock(&ffn_mutex);
-		}
-		fibril_mutex_unlock(&idxp->nodep->lock);
-		*nodepp = idxp->nodep;
-		return EOK;
-	}
-
-	/*
-	 * We must instantiate the node from the file system.
-	 */
-
-	assert(idxp->pfc);
-
-	rc = exfat_node_get_new(&nodep);
-	if (rc != EOK)
-		return rc;
-
-	exfat_directory_open_parent(&di, idxp->service_id, idxp->pfc,
-	    idxp->parent_fragmented);
-	rc = exfat_directory_seek(&di, idxp->pdi);
-	if (rc != EOK) {
-		(void) exfat_directory_close(&di);
-		(void) exfat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-	rc = exfat_directory_get(&di, &d);
-	if (rc != EOK) {
-		(void) exfat_directory_close(&di);
-		(void) exfat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-
-	switch (exfat_classify_dentry(d)) {
-	case EXFAT_DENTRY_FILE:
-		nodep->type =
-		    (uint16_t_le2host(d->file.attr) & EXFAT_ATTR_SUBDIR) ?
-		    EXFAT_DIRECTORY : EXFAT_FILE;
-		rc = exfat_directory_next(&di);
-		if (rc != EOK) {
-			(void) exfat_directory_close(&di);
-			(void) exfat_node_put(FS_NODE(nodep));
-			return rc;
-		}
-		rc = exfat_directory_get(&di, &d);
-		if (rc != EOK) {
-			(void) exfat_directory_close(&di);
-			(void) exfat_node_put(FS_NODE(nodep));
-			return rc;
-		}
-		nodep->firstc = uint32_t_le2host(d->stream.firstc);
-		nodep->size = uint64_t_le2host(d->stream.data_size);
-		nodep->fragmented = (d->stream.flags & 0x02) == 0;
-		break;
-	case EXFAT_DENTRY_BITMAP:
-		nodep->type = EXFAT_BITMAP;
-		nodep->firstc = uint32_t_le2host(d->bitmap.firstc);
-		nodep->size = uint64_t_le2host(d->bitmap.size);
-		nodep->fragmented = true;
-		break;
-	case EXFAT_DENTRY_UCTABLE:
-		nodep->type = EXFAT_UCTABLE;
-		nodep->firstc = uint32_t_le2host(d->uctable.firstc);
-		nodep->size = uint64_t_le2host(d->uctable.size);
-		nodep->fragmented = true;
-		break;
-	default:
-	case EXFAT_DENTRY_SKIP:
-	case EXFAT_DENTRY_LAST:
-	case EXFAT_DENTRY_FREE:
-	case EXFAT_DENTRY_VOLLABEL:
-	case EXFAT_DENTRY_GUID:
-	case EXFAT_DENTRY_STREAM:
-	case EXFAT_DENTRY_NAME:
-		(void) exfat_directory_close(&di);
-		(void) exfat_node_put(FS_NODE(nodep));
-		return ENOENT;
-	}
-
-	nodep->lnkcnt = 1;
-	nodep->refcnt = 1;
-
-	rc = exfat_directory_close(&di);
-	if (rc != EOK) {
-		(void) exfat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-
-	/* Link the idx structure with the node structure. */
-	nodep->idx = idxp;
-	idxp->nodep = nodep;
-
-	*nodepp = nodep;
-	return EOK;
-}
-
-errno_t exfat_node_expand(service_id_t service_id, exfat_node_t *nodep,
-    exfat_cluster_t clusters)
-{
-	exfat_bs_t *bs;
-	errno_t rc;
-	bs = block_bb_get(service_id);
-
-	if (!nodep->fragmented) {
-		rc = exfat_bitmap_append_clusters(bs, nodep, clusters);
-		if (rc != ENOSPC)
-			return rc;
-		if (rc == ENOSPC) {
-			nodep->fragmented = true;
-			nodep->dirty = true;		/* need to sync node */
-			rc = exfat_bitmap_replicate_clusters(bs, nodep);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	/* If we cant linear expand the node, we should use FAT instead */
-	exfat_cluster_t mcl, lcl;
-
-	/* create an independent chain of nclsts clusters in all FATs */
-	rc = exfat_alloc_clusters(bs, service_id, clusters, &mcl, &lcl);
-	if (rc != EOK)
-		return rc;
-	rc = exfat_zero_cluster(bs, service_id, mcl);
-	if (rc != EOK) {
-		(void) exfat_free_clusters(bs, service_id, mcl);
-		return rc;
-	}
-	/*
-	 * Append the cluster chain starting in mcl to the end of the
-	 * node's cluster chain.
-	 */
-	rc = exfat_append_clusters(bs, nodep, mcl, lcl);
-	if (rc != EOK) {
-		(void) exfat_free_clusters(bs, service_id, mcl);
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t exfat_node_shrink(service_id_t service_id, exfat_node_t *nodep,
-    aoff64_t size)
-{
-	exfat_bs_t *bs;
-	errno_t rc;
-	bs = block_bb_get(service_id);
-
-	if (!nodep->fragmented) {
-		exfat_cluster_t clsts, prev_clsts, new_clsts;
-		prev_clsts = ROUND_UP(nodep->size, BPC(bs)) / BPC(bs);
-		new_clsts =  ROUND_UP(size, BPC(bs)) / BPC(bs);
-
-		assert(new_clsts < prev_clsts);
-
-		clsts = prev_clsts - new_clsts;
-		rc = exfat_bitmap_free_clusters(bs, nodep, clsts);
-		if (rc != EOK)
-			return rc;
-	} else {
-		/*
-		 * The node will be shrunk, clusters will be deallocated.
-		 */
-		if (size == 0) {
-			rc = exfat_chop_clusters(bs, nodep, 0);
-			if (rc != EOK)
-				return rc;
-		} else {
-			exfat_cluster_t lastc;
-			rc = exfat_cluster_walk(bs, service_id, nodep->firstc,
-			    &lastc, NULL, (size - 1) / BPC(bs));
-			if (rc != EOK)
-				return rc;
-			rc = exfat_chop_clusters(bs, nodep, lastc);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	nodep->size = size;
-	nodep->dirty = true;		/* need to sync node */
-	return EOK;
-}
-
-/*
- * EXFAT libfs operations.
- */
-
-errno_t exfat_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return exfat_node_get(rfn, service_id, EXFAT_ROOT_IDX);
-}
-
-errno_t exfat_bitmap_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return exfat_node_get(rfn, service_id, EXFAT_BITMAP_IDX);
-}
-
-errno_t exfat_uctable_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return exfat_node_get(rfn, service_id, EXFAT_UCTABLE_IDX);
-}
-
-errno_t exfat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	exfat_node_t *parentp = EXFAT_NODE(pfn);
-	char name[EXFAT_FILENAME_LEN + 1];
-	exfat_file_dentry_t df;
-	exfat_stream_dentry_t ds;
-	service_id_t service_id;
-	errno_t rc;
-
-	fibril_mutex_lock(&parentp->idx->lock);
-	service_id = parentp->idx->service_id;
-	fibril_mutex_unlock(&parentp->idx->lock);
-
-	exfat_directory_t di;
-	rc = exfat_directory_open(parentp, &di);
-	if (rc != EOK)
-		return rc;
-
-	while (exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN, &df,
-	    &ds) == EOK) {
-		if (str_casecmp(name, component) == 0) {
-			/* hit */
-			exfat_node_t *nodep;
-			aoff64_t o = di.pos %
-			    (BPS(di.bs) / sizeof(exfat_dentry_t));
-			exfat_idx_t *idx = exfat_idx_get_by_pos(service_id,
-			    parentp->firstc, di.bnum * DPS(di.bs) + o);
-			if (!idx) {
-				/*
-				 * Can happen if memory is low or if we
-				 * run out of 32-bit indices.
-				 */
-				rc = exfat_directory_close(&di);
-				return (rc == EOK) ? ENOMEM : rc;
-			}
-			rc = exfat_node_get_core(&nodep, idx);
-			fibril_mutex_unlock(&idx->lock);
-			if (rc != EOK) {
-				(void) exfat_directory_close(&di);
-				return rc;
-			}
-			*rfn = FS_NODE(nodep);
-			rc = exfat_directory_close(&di);
-			if (rc != EOK)
-				(void) exfat_node_put(*rfn);
-			return rc;
-		} else {
-			rc = exfat_directory_next(&di);
-			if (rc != EOK)
-				break;
-		}
-	}
-	(void) exfat_directory_close(&di);
-	*rfn = NULL;
-	return EOK;
-}
-
-/** Instantiate a exFAT in-core node. */
-errno_t exfat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
-{
-	exfat_node_t *nodep;
-	exfat_idx_t *idxp;
-	errno_t rc;
-
-	idxp = exfat_idx_get_by_index(service_id, index);
-	if (!idxp) {
-		*rfn = NULL;
-		return EOK;
-	}
-	/* idxp->lock held */
-	rc = exfat_node_get_core(&nodep, idxp);
-	fibril_mutex_unlock(&idxp->lock);
-	if (rc == EOK)
-		*rfn = FS_NODE(nodep);
-	return rc;
-}
-
-errno_t exfat_node_open(fs_node_t *fn)
-{
-	/*
-	 * Opening a file is stateless, nothing
-	 * to be done here.
-	 */
-	return EOK;
-}
-
-errno_t exfat_node_put(fs_node_t *fn)
-{
-	if (fn == NULL)
-		return EOK;
-
-	exfat_node_t *nodep = EXFAT_NODE(fn);
-	bool destroy = false;
-
-	fibril_mutex_lock(&nodep->lock);
-	if (!--nodep->refcnt) {
-		if (nodep->idx) {
-			fibril_mutex_lock(&ffn_mutex);
-			list_append(&nodep->ffn_link, &ffn_list);
-			fibril_mutex_unlock(&ffn_mutex);
-		} else {
-			/*
-			 * The node does not have any index structure associated
-			 * with itself. This can only mean that we are releasing
-			 * the node after a failed attempt to allocate the index
-			 * structure for it.
-			 */
-			destroy = true;
-		}
-	}
-	fibril_mutex_unlock(&nodep->lock);
-	if (destroy) {
-		free(nodep->bp);
-		free(nodep);
-	}
-	return EOK;
-}
-
-errno_t exfat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	exfat_idx_t *idxp;
-	exfat_node_t *nodep;
-	exfat_bs_t *bs;
-	errno_t rc;
-
-	bs = block_bb_get(service_id);
-	rc = exfat_node_get_new(&nodep);
-	if (rc != EOK)
-		return rc;
-
-	rc = exfat_idx_get_new(&idxp, service_id);
-	if (rc != EOK) {
-		(void) exfat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-
-	nodep->firstc = 0;
-	nodep->size = 0;
-	nodep->fragmented = false;
-	nodep->lnkcnt = 0;	/* not linked anywhere */
-	nodep->refcnt = 1;
-	nodep->dirty = true;
-
-	nodep->idx = idxp;
-	idxp->nodep = nodep;
-	fibril_mutex_unlock(&idxp->lock);
-
-	if (flags & L_DIRECTORY) {
-		nodep->type = EXFAT_DIRECTORY;
-		rc = exfat_node_expand(service_id, nodep, 1);
-		if (rc != EOK) {
-			(void) exfat_node_put(FS_NODE(nodep));
-			return rc;
-		}
-
-		rc = exfat_zero_cluster(bs, service_id, nodep->firstc);
-		if (rc != EOK) {
-			(void) exfat_node_put(FS_NODE(nodep));
-			return rc;
-		}
-
-		nodep->size = BPC(bs);
-	} else {
-		nodep->type = EXFAT_FILE;
-	}
-
-	*rfn = FS_NODE(nodep);
-	return EOK;
-}
-
-errno_t exfat_destroy_node(fs_node_t *fn)
-{
-	exfat_node_t *nodep = EXFAT_NODE(fn);
-	exfat_bs_t *bs;
-	bool has_children;
-	errno_t rc;
-
-	/*
-	 * The node is not reachable from the file system. This means that the
-	 * link count should be zero and that the index structure cannot be
-	 * found in the position hash. Obviously, we don't need to lock the node
-	 * nor its index structure.
-	 */
-	assert(nodep->lnkcnt == 0);
-
-	/*
-	 * The node may not have any children.
-	 */
-	rc = exfat_has_children(&has_children, fn);
-	if (rc != EOK)
-		return rc;
-	assert(!has_children);
-
-	bs = block_bb_get(nodep->idx->service_id);
-	if (nodep->firstc != 0) {
-		assert(nodep->size);
-		/* Free all clusters allocated to the node. */
-		if (nodep->fragmented)
-			rc = exfat_free_clusters(bs, nodep->idx->service_id,
-			    nodep->firstc);
-		else
-			rc = exfat_bitmap_free_clusters(bs, nodep,
-			    ROUND_UP(nodep->size, BPC(bs)) / BPC(bs));
-	}
-
-	exfat_idx_destroy(nodep->idx);
-	free(nodep->bp);
-	free(nodep);
-	return rc;
-}
-
-errno_t exfat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	exfat_node_t *parentp = EXFAT_NODE(pfn);
-	exfat_node_t *childp = EXFAT_NODE(cfn);
-	exfat_directory_t di;
-	errno_t rc;
-
-	fibril_mutex_lock(&childp->lock);
-	if (childp->lnkcnt == 1) {
-		/*
-		 * We don't support multiple hard links.
-		 */
-		fibril_mutex_unlock(&childp->lock);
-		return EMLINK;
-	}
-	assert(childp->lnkcnt == 0);
-	fibril_mutex_unlock(&childp->lock);
-
-	if (!exfat_valid_name(name))
-		return ENOTSUP;
-
-	fibril_mutex_lock(&parentp->idx->lock);
-	rc = exfat_directory_open(parentp, &di);
-	if (rc != EOK)
-		return rc;
-	/*
-	 * At this point we only establish the link between the parent and the
-	 * child.  The dentry, except of the name and the extension, will remain
-	 * uninitialized until the corresponding node is synced. Thus the valid
-	 * dentry data is kept in the child node structure.
-	 */
-	rc = exfat_directory_write_file(&di, name);
-	if (rc != EOK) {
-		(void) exfat_directory_close(&di);
-		fibril_mutex_unlock(&parentp->idx->lock);
-		return rc;
-	}
-	rc = exfat_directory_close(&di);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&parentp->idx->lock);
-		return rc;
-	}
-
-	fibril_mutex_unlock(&parentp->idx->lock);
-	fibril_mutex_lock(&childp->idx->lock);
-
-	childp->idx->pfc = parentp->firstc;
-	childp->idx->parent_fragmented = parentp->fragmented;
-	childp->idx->pdi = di.pos;
-	fibril_mutex_unlock(&childp->idx->lock);
-
-	fibril_mutex_lock(&childp->lock);
-	childp->lnkcnt = 1;
-	childp->dirty = true;		/* need to sync node */
-	fibril_mutex_unlock(&childp->lock);
-
-	/*
-	 * Hash in the index structure into the position hash.
-	 */
-	exfat_idx_hashin(childp->idx);
-
-	return EOK;
-
-}
-
-errno_t exfat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	exfat_node_t *parentp = EXFAT_NODE(pfn);
-	exfat_node_t *childp = EXFAT_NODE(cfn);
-	bool has_children;
-	errno_t rc;
-
-	if (!parentp)
-		return EBUSY;
-
-	rc = exfat_has_children(&has_children, cfn);
-	if (rc != EOK)
-		return rc;
-	if (has_children)
-		return ENOTEMPTY;
-
-	fibril_mutex_lock(&parentp->lock);
-	fibril_mutex_lock(&childp->lock);
-	assert(childp->lnkcnt == 1);
-	fibril_mutex_lock(&childp->idx->lock);
-
-	exfat_directory_t di;
-	rc = exfat_directory_open(parentp, &di);
-	if (rc != EOK)
-		goto error;
-	rc = exfat_directory_erase_file(&di, childp->idx->pdi);
-	if (rc != EOK)
-		goto error;
-	rc = exfat_directory_close(&di);
-	if (rc != EOK)
-		goto error;
-
-	/* remove the index structure from the position hash */
-	exfat_idx_hashout(childp->idx);
-	/* clear position information */
-	childp->idx->pfc = 0;
-	childp->idx->pdi = 0;
-	fibril_mutex_unlock(&childp->idx->lock);
-	childp->lnkcnt = 0;
-	childp->refcnt++;	/* keep the node in memory until destroyed */
-	childp->dirty = true;
-	fibril_mutex_unlock(&childp->lock);
-	fibril_mutex_unlock(&parentp->lock);
-
-	return EOK;
-
-error:
-	(void) exfat_directory_close(&di);
-	fibril_mutex_unlock(&childp->idx->lock);
-	fibril_mutex_unlock(&childp->lock);
-	fibril_mutex_unlock(&parentp->lock);
-	return rc;
-
-}
-
-errno_t exfat_has_children(bool *has_children, fs_node_t *fn)
-{
-	exfat_directory_t di;
-	exfat_dentry_t *d;
-	exfat_node_t *nodep = EXFAT_NODE(fn);
-	errno_t rc;
-
-	*has_children = false;
-
-	if (nodep->type != EXFAT_DIRECTORY)
-		return EOK;
-
-	fibril_mutex_lock(&nodep->idx->lock);
-
-	rc = exfat_directory_open(nodep, &di);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&nodep->idx->lock);
-		return rc;
-	}
-
-	do {
-		rc = exfat_directory_get(&di, &d);
-		if (rc != EOK) {
-			(void) exfat_directory_close(&di);
-			fibril_mutex_unlock(&nodep->idx->lock);
-			return rc;
-		}
-		switch (exfat_classify_dentry(d)) {
-		case EXFAT_DENTRY_SKIP:
-		case EXFAT_DENTRY_FREE:
-			continue;
-		case EXFAT_DENTRY_LAST:
-			*has_children = false;
-			goto exit;
-		default:
-			*has_children = true;
-			goto exit;
-		}
-	} while (exfat_directory_next(&di) == EOK);
-
-exit:
-	rc = exfat_directory_close(&di);
-	fibril_mutex_unlock(&nodep->idx->lock);
-	return rc;
-}
-
-fs_index_t exfat_index_get(fs_node_t *fn)
-{
-	return EXFAT_NODE(fn)->idx->index;
-}
-
-aoff64_t exfat_size_get(fs_node_t *fn)
-{
-	return EXFAT_NODE(fn)->size;
-}
-
-unsigned exfat_lnkcnt_get(fs_node_t *fn)
-{
-	return EXFAT_NODE(fn)->lnkcnt;
-}
-
-bool exfat_is_directory(fs_node_t *fn)
-{
-	return EXFAT_NODE(fn)->type == EXFAT_DIRECTORY;
-}
-
-bool exfat_is_file(fs_node_t *fn)
-{
-	return EXFAT_NODE(fn)->type == EXFAT_FILE;
-}
-
-service_id_t exfat_service_get(fs_node_t *node)
-{
-	return 0;
-}
-
-errno_t exfat_size_block(service_id_t service_id, uint32_t *size)
-{
-	exfat_bs_t *bs;
-	bs = block_bb_get(service_id);
-	*size = BPC(bs);
-
-	return EOK;
-}
-
-errno_t exfat_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	exfat_bs_t *bs;
-	bs = block_bb_get(service_id);
-	*count = DATA_CNT(bs);
-
-	return EOK;
-}
-
-errno_t exfat_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	fs_node_t *node = NULL;
-	exfat_node_t *bmap_node;
-	exfat_bs_t *bs;
-	uint64_t free_block_count = 0;
-	uint64_t block_count;
-	unsigned sector;
-	errno_t rc;
-
-	rc = exfat_total_block_count(service_id, &block_count);
-	if (rc != EOK)
-		goto exit;
-
-	bs = block_bb_get(service_id);
-	rc = exfat_bitmap_get(&node, service_id);
-	if (rc != EOK)
-		goto exit;
-
-	bmap_node = (exfat_node_t *) node->data;
-
-	unsigned const bmap_sectors = ROUND_UP(bmap_node->size, BPS(bs)) /
-	    BPS(bs);
-
-	for (sector = 0; sector < bmap_sectors; ++sector) {
-
-		block_t *block;
-		uint8_t *bitmap;
-		unsigned bit;
-
-		rc = exfat_block_get(&block, bs, bmap_node, sector,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			free_block_count = 0;
-			goto exit;
-		}
-
-		bitmap = (uint8_t *) block->data;
-
-		for (bit = 0; bit < BPS(bs) * 8 && block_count > 0;
-		    ++bit, --block_count) {
-			if (!(bitmap[bit / 8] & (1 << (bit % 8))))
-				++free_block_count;
-		}
-
-		block_put(block);
-
-		if (block_count == 0) {
-			/* Reached the end of the bitmap */
-			goto exit;
-		}
-	}
-
-exit:
-	exfat_node_put(node);
-	*count = free_block_count;
-	return rc;
-}
-
-/** libfs operations */
-libfs_ops_t exfat_libfs_ops = {
-	.root_get = exfat_root_get,
-	.match = exfat_match,
-	.node_get = exfat_node_get,
-	.node_open = exfat_node_open,
-	.node_put = exfat_node_put,
-	.create = exfat_create_node,
-	.destroy = exfat_destroy_node,
-	.link = exfat_link,
-	.unlink = exfat_unlink,
-	.has_children = exfat_has_children,
-	.index_get = exfat_index_get,
-	.size_get = exfat_size_get,
-	.lnkcnt_get = exfat_lnkcnt_get,
-	.is_directory = exfat_is_directory,
-	.is_file = exfat_is_file,
-	.service_get = exfat_service_get,
-	.size_block = exfat_size_block,
-	.total_block_count = exfat_total_block_count,
-	.free_block_count = exfat_free_block_count
-};
-
-static errno_t exfat_fs_open(service_id_t service_id, enum cache_mode cmode,
-    fs_node_t **rrfn, exfat_idx_t **rridxp, vfs_fs_probe_info_t *info)
-{
-	errno_t rc;
-	exfat_node_t *rootp = NULL, *bitmapp = NULL, *uctablep = NULL;
-	exfat_bs_t *bs;
-
-	/* initialize libblock */
-	rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	/* prepare the boot block */
-	rc = block_bb_read(service_id, BS_BLOCK);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* get the buffer with the boot sector */
-	bs = block_bb_get(service_id);
-
-	/* Do some simple sanity checks on the file system. */
-	rc = exfat_sanity_check(bs);
-	if (rc != EOK) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Initialize the block cache */
-	rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	rc = exfat_idx_init_by_service_id(service_id);
-	if (rc != EOK) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Initialize the root node. */
-	rc = exfat_node_get_new_by_pos(&rootp, service_id, EXFAT_ROOT_PAR,
-	    EXFAT_ROOT_POS);
-	if (rc != EOK) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-	assert(rootp->idx->index == EXFAT_ROOT_IDX);
-
-	rootp->type = EXFAT_DIRECTORY;
-	rootp->firstc = ROOT_FC(bs);
-	rootp->fragmented = true;
-	rootp->refcnt = 1;
-	rootp->lnkcnt = 0;	/* FS root is not linked */
-
-	uint32_t clusters;
-	rc = exfat_clusters_get(&clusters, bs, service_id, rootp->firstc);
-	if (rc != EOK) {
-		free(rootp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOTSUP;
-	}
-	rootp->size = BPS(bs) * SPC(bs) * clusters;
-	fibril_mutex_unlock(&rootp->idx->lock);
-
-	/* Open root directory and looking for Bitmap and UC-Table */
-	exfat_directory_t di;
-	exfat_dentry_t *de;
-	rc = exfat_directory_open(rootp, &di);
-	if (rc != EOK) {
-		free(rootp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOTSUP;
-	}
-
-	/* Initialize the bitmap node. */
-	rc = exfat_directory_find(&di, EXFAT_DENTRY_BITMAP, &de);
-	if (rc != EOK) {
-		free(rootp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOTSUP;
-	}
-
-	rc = exfat_node_get_new_by_pos(&bitmapp, service_id, rootp->firstc,
-	    di.pos);
-	if (rc != EOK) {
-		free(rootp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-	assert(bitmapp->idx->index == EXFAT_BITMAP_IDX);
-	fibril_mutex_unlock(&bitmapp->idx->lock);
-
-	bitmapp->type = EXFAT_BITMAP;
-	bitmapp->firstc = uint32_t_le2host(de->bitmap.firstc);
-	bitmapp->fragmented = true;
-	bitmapp->idx->parent_fragmented = true;
-	bitmapp->refcnt = 1;
-	bitmapp->lnkcnt = 0;
-	bitmapp->size = uint64_t_le2host(de->bitmap.size);
-
-	/* Initialize the uctable node. */
-	rc = exfat_directory_seek(&di, 0);
-	if (rc != EOK) {
-		free(rootp);
-		free(bitmapp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOTSUP;
-	}
-
-	rc = exfat_directory_find(&di, EXFAT_DENTRY_UCTABLE, &de);
-	if (rc != EOK) {
-		free(rootp);
-		free(bitmapp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOTSUP;
-	}
-
-	rc = exfat_node_get_new_by_pos(&uctablep, service_id, rootp->firstc,
-	    di.pos);
-	if (rc != EOK) {
-		free(rootp);
-		free(bitmapp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-	assert(uctablep->idx->index == EXFAT_UCTABLE_IDX);
-	fibril_mutex_unlock(&uctablep->idx->lock);
-
-	uctablep->type = EXFAT_UCTABLE;
-	uctablep->firstc = uint32_t_le2host(de->uctable.firstc);
-	uctablep->fragmented = true;
-	uctablep->idx->parent_fragmented = true;
-	uctablep->refcnt = 1;
-	uctablep->lnkcnt = 0;
-	uctablep->size = uint64_t_le2host(de->uctable.size);
-
-	if (info != NULL) {
-		/* Read volume label. */
-		rc = exfat_directory_read_vollabel(&di, info->label,
-		    FS_LABEL_MAXLEN + 1);
-		if (rc != EOK) {
-			free(rootp);
-			free(bitmapp);
-			free(uctablep);
-			(void) block_cache_fini(service_id);
-			block_fini(service_id);
-			exfat_idx_fini_by_service_id(service_id);
-			return ENOTSUP;
-		}
-	}
-
-	rc = exfat_directory_close(&di);
-	if (rc != EOK) {
-		free(rootp);
-		free(bitmapp);
-		free(uctablep);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		exfat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-
-	if (0)
-		exfat_fsinfo(bs, service_id);
-
-	*rrfn = FS_NODE(rootp);
-	*rridxp = rootp->idx;
-
-	if (info != NULL) {
-#if 0
-		str_cpy(info->label, FS_LABEL_MAXLEN + 1, label);
-#endif
-	}
-
-	return EOK;
-}
-
-static void exfat_fs_close(service_id_t service_id, fs_node_t *rfn)
-{
-	/*
-	 * Put the root node and force it to the FAT free node list.
-	 */
-	(void) exfat_node_put(rfn);
-	(void) exfat_node_put(rfn);
-
-	/*
-	 * Perform cleanup of the node structures, index structures and
-	 * associated data. Write back this file system's dirty blocks and
-	 * stop using libblock for this instance.
-	 */
-	(void) exfat_node_fini_by_service_id(service_id);
-	exfat_idx_fini_by_service_id(service_id);
-	(void) block_cache_fini(service_id);
-	block_fini(service_id);
-}
-
-/*
- * VFS_OUT operations.
- */
-
-/* Print debug info */
-static void exfat_fsinfo(exfat_bs_t *bs, service_id_t service_id)
-{
-	printf("exFAT file system mounted\n");
-	printf("Version: %d.%d\n", bs->version.major, bs->version.minor);
-	printf("Volume serial: %d\n", uint32_t_le2host(bs->volume_serial));
-	printf("Volume first sector: %" PRId64 "\n", VOL_FS(bs));
-	printf("Volume sectors: %" PRId64 "\n", VOL_CNT(bs));
-	printf("FAT first sector: %d\n", FAT_FS(bs));
-	printf("FAT sectors: %d\n", FAT_CNT(bs));
-	printf("Data first sector: %d\n", DATA_FS(bs));
-	printf("Data sectors: %d\n", DATA_CNT(bs));
-	printf("Root dir first cluster: %d\n", ROOT_FC(bs));
-	printf("Bytes per sector: %d\n", BPS(bs));
-	printf("Sectors per cluster: %d\n", SPC(bs));
-	printf("KBytes per cluster: %d\n", SPC(bs) * BPS(bs) / 1024);
-
-	int i, rc;
-	exfat_cluster_t clst;
-	for (i = 0; i <= 7; i++) {
-		rc = exfat_get_cluster(bs, service_id, i, &clst);
-		if (rc != EOK)
-			return;
-		printf("Clst %d: %x", i, clst);
-		if (i >= 2) {
-			printf(", Bitmap: %d\n", exfat_bitmap_is_free(bs,
-			    service_id, i) != EOK);
-		} else {
-			printf("\n");
-		}
-	}
-}
-
-static errno_t exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	errno_t rc;
-	exfat_idx_t *ridxp;
-	fs_node_t *rfn;
-
-	rc = exfat_fs_open(service_id, CACHE_MODE_WT, &rfn, &ridxp, info);
-	if (rc != EOK)
-		return rc;
-
-	exfat_fs_close(service_id, rfn);
-	return EOK;
-}
-
-static errno_t
-exfat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
-    aoff64_t *size)
-{
-	errno_t rc;
-	enum cache_mode cmode;
-	exfat_idx_t *ridxp;
-	fs_node_t *rfn;
-
-	/* Check for option enabling write through. */
-	if (str_cmp(opts, "wtcache") == 0)
-		cmode = CACHE_MODE_WT;
-	else
-		cmode = CACHE_MODE_WB;
-
-	rc = exfat_fs_open(service_id, cmode, &rfn, &ridxp, NULL);
-	if (rc != EOK)
-		return rc;
-
-	*index = ridxp->index;
-	*size = EXFAT_NODE(rfn)->size;
-
-	return EOK;
-}
-
-static errno_t exfat_unmounted(service_id_t service_id)
-{
-	fs_node_t *rfn;
-	errno_t rc;
-
-	rc = exfat_root_get(&rfn, service_id);
-	if (rc != EOK)
-		return rc;
-
-	exfat_fs_close(service_id, rfn);
-	return EOK;
-}
-
-static errno_t
-exfat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	fs_node_t *fn;
-	exfat_node_t *nodep;
-	exfat_bs_t *bs;
-	size_t bytes = 0;
-	block_t *b;
-	errno_t rc;
-
-	rc = exfat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = EXFAT_NODE(fn);
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_read_receive(&call, &len)) {
-		exfat_node_put(fn);
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	bs = block_bb_get(service_id);
-
-	if (nodep->type == EXFAT_FILE) {
-		/*
-		 * Our strategy for regular file reads is to read one block at
-		 * most and make use of the possibility to return less data than
-		 * requested. This keeps the code very simple.
-		 */
-		if (pos >= nodep->size) {
-			/* reading beyond the EOF */
-			bytes = 0;
-			(void) async_data_read_finalize(&call, NULL, 0);
-		} else {
-			bytes = min(len, BPS(bs) - pos % BPS(bs));
-			bytes = min(bytes, nodep->size - pos);
-			rc = exfat_block_get(&b, bs, nodep, pos / BPS(bs),
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				exfat_node_put(fn);
-				async_answer_0(&call, rc);
-				return rc;
-			}
-			(void) async_data_read_finalize(&call,
-			    b->data + pos % BPS(bs), bytes);
-			rc = block_put(b);
-			if (rc != EOK) {
-				exfat_node_put(fn);
-				return rc;
-			}
-		}
-	} else {
-		if (nodep->type != EXFAT_DIRECTORY) {
-			async_answer_0(&call, ENOTSUP);
-			return ENOTSUP;
-		}
-
-		aoff64_t spos = pos;
-		char name[EXFAT_FILENAME_LEN + 1];
-		exfat_file_dentry_t df;
-		exfat_stream_dentry_t ds;
-
-		assert(nodep->size % BPS(bs) == 0);
-		assert(BPS(bs) % sizeof(exfat_dentry_t) == 0);
-
-		exfat_directory_t di;
-		rc = exfat_directory_open(nodep, &di);
-		if (rc != EOK)
-			goto err;
-
-		rc = exfat_directory_seek(&di, pos);
-		if (rc != EOK) {
-			(void) exfat_directory_close(&di);
-			goto err;
-		}
-
-		rc = exfat_directory_read_file(&di, name, EXFAT_FILENAME_LEN,
-		    &df, &ds);
-		if (rc == EOK)
-			goto hit;
-		else if (rc == ENOENT)
-			goto miss;
-
-		(void) exfat_directory_close(&di);
-
-	err:
-		(void) exfat_node_put(fn);
-		async_answer_0(&call, rc);
-		return rc;
-
-	miss:
-		rc = exfat_directory_close(&di);
-		if (rc != EOK)
-			goto err;
-		rc = exfat_node_put(fn);
-		async_answer_0(&call, rc != EOK ? rc : ENOENT);
-		*rbytes = 0;
-		return rc != EOK ? rc : ENOENT;
-
-	hit:
-		pos = di.pos;
-		rc = exfat_directory_close(&di);
-		if (rc != EOK)
-			goto err;
-		(void) async_data_read_finalize(&call, name,
-		    str_size(name) + 1);
-		bytes = (pos - spos) + 1;
-	}
-
-	rc = exfat_node_put(fn);
-	*rbytes = bytes;
-	return rc;
-}
-
-static errno_t exfat_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t exfat_sync(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	errno_t rc = exfat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	exfat_node_t *nodep = EXFAT_NODE(fn);
-
-	nodep->dirty = true;
-	rc = exfat_node_sync(nodep);
-
-	exfat_node_put(fn);
-	return rc;
-}
-
-static errno_t
-exfat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	fs_node_t *fn;
-	exfat_node_t *nodep;
-	exfat_bs_t *bs;
-	size_t bytes;
-	block_t *b;
-	aoff64_t boundary;
-	int flags = BLOCK_FLAGS_NONE;
-	errno_t rc;
-
-	rc = exfat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = EXFAT_NODE(fn);
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_write_receive(&call, &len)) {
-		(void) exfat_node_put(fn);
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	bs = block_bb_get(service_id);
-
-	/*
-	 * In all scenarios, we will attempt to write out only one block worth
-	 * of data at maximum. There might be some more efficient approaches,
-	 * but this one greatly simplifies fat_write(). Note that we can afford
-	 * to do this because the client must be ready to handle the return
-	 * value signalizing a smaller number of bytes written.
-	 */
-	bytes = min(len, BPS(bs) - pos % BPS(bs));
-	if (bytes == BPS(bs))
-		flags |= BLOCK_FLAGS_NOREAD;
-
-	boundary = ROUND_UP(nodep->size, BPC(bs));
-	if (pos >= boundary) {
-		unsigned nclsts;
-		nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs);
-		rc = exfat_node_expand(service_id, nodep, nclsts);
-		if (rc != EOK) {
-			/* could not expand node */
-			(void) exfat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-	}
-
-	if (pos + bytes > nodep->size) {
-		nodep->size = pos + bytes;
-		nodep->dirty = true;	/* need to sync node */
-	}
-
-	/*
-	 * This is the easier case - we are either overwriting already
-	 * existing contents or writing behind the EOF, but still within
-	 * the limits of the last cluster. The node size may grow to the
-	 * next block size boundary.
-	 */
-	rc = exfat_block_get(&b, bs, nodep, pos / BPS(bs), flags);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		async_answer_0(&call, rc);
-		return rc;
-	}
-
-	(void) async_data_write_finalize(&call,
-	    b->data + pos % BPS(bs), bytes);
-	b->dirty = true;		/* need to sync block */
-	rc = block_put(b);
-	if (rc != EOK) {
-		(void) exfat_node_put(fn);
-		return rc;
-	}
-
-	*wbytes = bytes;
-	*nsize = nodep->size;
-	rc = exfat_node_put(fn);
-	return rc;
-}
-
-static errno_t
-exfat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
-{
-	fs_node_t *fn;
-	exfat_node_t *nodep;
-	exfat_bs_t *bs;
-	errno_t rc;
-
-	rc = exfat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = EXFAT_NODE(fn);
-
-	bs = block_bb_get(service_id);
-
-	if (nodep->size == size) {
-		rc = EOK;
-	} else if (nodep->size < size) {
-		/*
-		 * The standard says we have the freedom to grow the node.
-		 * For now, we simply return an error.
-		 */
-		rc = EINVAL;
-	} else if (ROUND_UP(nodep->size, BPC(bs)) == ROUND_UP(size, BPC(bs))) {
-		/*
-		 * The node will be shrunk, but no clusters will be deallocated.
-		 */
-		nodep->size = size;
-		nodep->dirty = true;		/* need to sync node */
-		rc = EOK;
-	} else {
-		rc = exfat_node_shrink(service_id, nodep, size);
-	}
-
-	errno_t rc2 = exfat_node_put(fn);
-	if (rc == EOK && rc2 != EOK)
-		rc = rc2;
-
-	return rc;
-}
-
-static errno_t exfat_destroy(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	exfat_node_t *nodep;
-	errno_t rc;
-
-	rc = exfat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	nodep = EXFAT_NODE(fn);
-	/*
-	 * We should have exactly two references. One for the above
-	 * call to fat_node_get() and one from fat_unlink().
-	 */
-	assert(nodep->refcnt == 2);
-
-	rc = exfat_destroy_node(fn);
-	return rc;
-}
-
-vfs_out_ops_t exfat_ops = {
-	.fsprobe = exfat_fsprobe,
-	.mounted = exfat_mounted,
-	.unmounted = exfat_unmounted,
-	.read = exfat_read,
-	.write = exfat_write,
-	.truncate = exfat_truncate,
-	.close = exfat_close,
-	.destroy = exfat_destroy,
-	.sync = exfat_sync,
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/exfat/meson.build
===================================================================
--- uspace/srv/fs/exfat/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs' ]
-src = files(
-	'exfat.c',
-	'exfat_fat.c',
-	'exfat_bitmap.c',
-	'exfat_ops.c',
-	'exfat_idx.c',
-	'exfat_dentry.c',
-	'exfat_directory.c',
-)
Index: pace/srv/fs/ext4fs/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/ext4fs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ext4fs ext4fs
- * @ingroup srvs
- * @brief Ext4 file system driver
- */
Index: pace/srv/fs/ext4fs/ext4fs.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * Copyright (c) 2012 Frantisek Princ
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ext4fs
- * @{
- */
-/**
- * @file  ext4fs.c
- * @brief Ext4 file system driver for HelenOS.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <libfs.h>
-#include <ns.h>
-#include <stdio.h>
-#include <task.h>
-#include <ipc/services.h>
-#include <str.h>
-#include <str_error.h>
-#include "ext4/ops.h"
-#include "../../vfs/vfs.h"
-
-#define NAME  "ext4fs"
-
-vfs_info_t ext4fs_vfs_info = {
-	.name = NAME,
-	.instance = 0
-};
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS ext4 file system server\n", NAME);
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			ext4fs_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf("%s: Unrecognized parameters\n", NAME);
-			return 1;
-		}
-	}
-
-	errno_t rc;
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf("%s: Failed to connect to VFS: %s\n", NAME, str_error(rc));
-		return 2;
-	}
-
-	rc = ext4_global_init();
-	if (rc != EOK) {
-		printf("%s: Global initialization failed: %s\n", NAME,
-		    str_error(rc));
-		return rc;
-	}
-
-	rc = fs_register(vfs_sess, &ext4fs_vfs_info, &ext4_ops,
-	    &ext4_libfs_ops);
-	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME,
-		    str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/ext4fs/meson.build
===================================================================
--- uspace/srv/fs/ext4fs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2012 Frantisek Princ
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ext4', 'block', 'fs', 'crypto' ]
-src = files('ext4fs.c')
Index: pace/srv/fs/fat/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/fat/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup fat fat
- * @ingroup srvs
- * @brief FAT file system driver
- */
Index: pace/srv/fs/fat/fat.c
===================================================================
--- uspace/srv/fs/fat/fat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat.c
- * @brief	FAT file system driver for HelenOS.
- */
-
-#include "fat.h"
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include <stdio.h>
-#include <libfs.h>
-#include <str.h>
-#include "../../vfs/vfs.h"
-
-#define NAME	"fat"
-
-vfs_info_t fat_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char **argv)
-{
-	printf(NAME ": HelenOS FAT file system server\n");
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			fat_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf(NAME " Unrecognized parameters");
-			return -1;
-		}
-	}
-
-	errno_t rc = fat_idx_init();
-	if (rc != EOK)
-		goto err;
-
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
-		return -1;
-	}
-
-	rc = fs_register(vfs_sess, &fat_vfs_info, &fat_ops, &fat_libfs_ops);
-	if (rc != EOK) {
-		fat_idx_fini();
-		goto err;
-	}
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-
-err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,281 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-#ifndef FAT_FAT_H_
-#define FAT_FAT_H_
-
-#include "fat_fat.h"
-#include <fibril_synch.h>
-#include <libfs.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <macros.h>
-#include "../../vfs/vfs.h"
-
-#ifndef dprintf
-#define dprintf(...)	printf(__VA_ARGS__)
-#endif
-
-/*
- * Convenience macros for accessing some frequently used boot sector members.
- */
-#define BPS(bs)		uint16_t_le2host((bs)->bps)
-#define SPC(bs)		(bs)->spc
-#define RSCNT(bs)	uint16_t_le2host((bs)->rscnt)
-#define FATCNT(bs)	(bs)->fatcnt
-
-#define SF(bs)		(uint16_t_le2host((bs)->sec_per_fat) ? \
-    uint16_t_le2host((bs)->sec_per_fat) : \
-    uint32_t_le2host(bs->fat32.sectors_per_fat))
-
-#define RDE(bs)		uint16_t_le2host((bs)->root_ent_max)
-
-#define TS(bs)		(uint16_t_le2host((bs)->totsec16) ? \
-    uint16_t_le2host((bs)->totsec16) : \
-    uint32_t_le2host(bs->totsec32))
-
-#define BS_BLOCK	0
-#define BS_SIZE		512
-
-typedef struct fat_bs {
-	/** Jump instruction */
-	uint8_t		ji[3];
-	uint8_t		oem_name[8];
-
-	/* BIOS Parameter Block */
-
-	/** Bytes per sector */
-	uint16_t	bps;
-	/** Sectors per cluster */
-	uint8_t		spc;
-	/** Reserved sector count */
-	uint16_t	rscnt;
-	/** Number of FATs */
-	uint8_t		fatcnt;
-	/** Maximum number of root directory entries */
-	uint16_t	root_ent_max;
-	/** Total sectors. 16-bit version */
-	uint16_t	totsec16;
-	/** Media descriptor */
-	uint8_t		mdesc;
-	/** Sectors per FAT12/FAT16 */
-	uint16_t	sec_per_fat;
-	/** Sectors per track */
-	uint16_t	sec_per_track;
-	/** Number of heads */
-	uint16_t	headcnt;
-	/** Hidden sectors */
-	uint32_t	hidden_sec;
-	/** Total sectors. 32-bit version */
-	uint32_t	totsec32;
-
-	union {
-		struct {
-			/* FAT12/FAT16 only: Extended BIOS Parameter Block */
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[448];
-			/** Boot sector signature. */
-			uint16_t	signature;
-		} __attribute__((packed));
-		struct {
-			/* FAT32 only */
-			/** Sectors per FAT. */
-			uint32_t	sectors_per_fat;
-			/** FAT flags. */
-			uint16_t	flags;
-			/** Version. */
-			uint16_t	version;
-			/** Cluster number of root directory. */
-			uint32_t	root_cluster;
-			/** Sector number of file system information sector. */
-			uint16_t	fsinfo_sec;
-			/** Sector number of boot sector copy. */
-			uint16_t	bscopy_sec;
-			uint8_t		reserved1[12];
-			/** Physical drive number. */
-			uint8_t		pdn;
-			uint8_t		reserved2;
-			/** Extended boot signature. */
-			uint8_t		ebs;
-			/** Serial number. */
-			uint32_t	id;
-			/** Volume label. */
-			uint8_t		label[11];
-			/** FAT type. */
-			uint8_t		type[8];
-			/** Boot code. */
-			uint8_t		boot_code[420];
-			/** Signature. */
-			uint16_t	signature;
-		} __attribute__((packed)) fat32;
-	};
-} __attribute__((packed)) fat_bs_t;
-
-#define FAT32_FSINFO_SIG1	"RRaA"
-#define FAT32_FSINFO_SIG2	"rrAa"
-#define FAT32_FSINFO_SIG3	"\x00\x00\x55\xaa"
-
-typedef struct {
-	uint8_t	sig1[4];
-	uint8_t res1[480];
-	uint8_t sig2[4];
-	uint32_t free_clusters;
-	uint32_t last_allocated_cluster;
-	uint8_t res2[12];
-	uint8_t sig3[4];
-} __attribute__((packed)) fat32_fsinfo_t;
-
-typedef enum {
-	FAT_INVALID,
-	FAT_DIRECTORY,
-	FAT_FILE
-} fat_node_type_t;
-
-struct fat_node;
-
-/** FAT index structure.
- *
- * This structure exists to help us to overcome certain limitations of the FAT
- * file system design.  The problem with FAT is that it is hard to find
- * an entity which could represent a VFS index.  There are two candidates:
- *
- * a) number of the node's first cluster
- * b) the pair of the parent directory's first cluster and the dentry index
- *    within the parent directory
- *
- * We need VFS indices to be:
- * A) unique
- * B) stable in time, at least until the next mount
- *
- * Unfortunately a) does not meet the A) criterion because zero-length files
- * will have the first cluster field cleared.  And b) does not meet the B)
- * criterion because unlink() and rename() will both free up the original
- * dentry, which contains all the essential info about the file.
- *
- * Therefore, a completely opaque indices are used and the FAT server maintains
- * a mapping between them and otherwise nice b) variant.  On rename(), the VFS
- * index stays unaltered, while the internal FAT "physical tree address"
- * changes.  The unlink case is also handled this way thanks to an in-core node
- * pointer embedded in the index structure.
- */
-typedef struct {
-	/** Used indices (position) hash table link. */
-	ht_link_t		uph_link;
-	/** Used indices (index) hash table link. */
-	ht_link_t		uih_link;
-
-	fibril_mutex_t	lock;
-	service_id_t	service_id;
-	fs_index_t	index;
-	/**
-	 * Parent node's first cluster.
-	 * Zero is used if this node is not linked, in which case nodep must
-	 * contain a pointer to the in-core node structure.
-	 * One is used when the parent is the root directory.
-	 */
-	fat_cluster_t	pfc;
-	/** Directory entry index within the parent node. */
-	unsigned	pdi;
-	/** Pointer to in-core node instance. */
-	struct fat_node	*nodep;
-} fat_idx_t;
-
-/** FAT in-core node. */
-typedef struct fat_node {
-	/** Back pointer to the FS node. */
-	fs_node_t		*bp;
-
-	fibril_mutex_t		lock;
-	fat_node_type_t		type;
-	fat_idx_t		*idx;
-	/**
-	 *  Node's first cluster.
-	 *  Zero is used for zero-length nodes.
-	 *  One is used to mark root directory.
-	 */
-	fat_cluster_t		firstc;
-	/** FAT in-core node free list link. */
-	link_t			ffn_link;
-	aoff64_t		size;
-	unsigned		lnkcnt;
-	unsigned		refcnt;
-	bool			dirty;
-
-	/*
-	 * Cache of the node's last and "current" cluster to avoid some
-	 * unnecessary FAT walks.
-	 */
-	/* Node's last cluster in FAT. */
-	bool		lastc_cached_valid;
-	fat_cluster_t	lastc_cached_value;
-	/* Node's "current" cluster, i.e. where the last I/O took place. */
-	bool		currc_cached_valid;
-	aoff64_t	currc_cached_bn;
-	fat_cluster_t	currc_cached_value;
-} fat_node_t;
-
-typedef struct {
-	bool lfn_enabled;
-} fat_instance_t;
-
-extern vfs_out_ops_t fat_ops;
-extern libfs_ops_t fat_libfs_ops;
-
-extern errno_t fat_idx_get_new(fat_idx_t **, service_id_t);
-extern fat_idx_t *fat_idx_get_by_pos(service_id_t, fat_cluster_t, unsigned);
-extern fat_idx_t *fat_idx_get_by_index(service_id_t, fs_index_t);
-extern void fat_idx_destroy(fat_idx_t *);
-extern void fat_idx_hashin(fat_idx_t *);
-extern void fat_idx_hashout(fat_idx_t *);
-
-extern errno_t fat_idx_init(void);
-extern void fat_idx_fini(void);
-extern errno_t fat_idx_init_by_service_id(service_id_t);
-extern void fat_idx_fini_by_service_id(service_id_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_dentry.c
===================================================================
--- uspace/srv/fs/fat/fat_dentry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,431 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat_dentry.c
- * @brief	Functions that work with FAT directory entries.
- */
-
-#include "fat_dentry.h"
-#include <ctype.h>
-#include <str.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/** Compare path component with the name read from the dentry.
- *
- * This function compares the path component with the name read from the dentry.
- * The comparison is case insensitive and tolerates a mismatch on the trailing
- * dot character at the end of the name (i.e. when there is a dot, but no
- * extension).
- *
- * @param name		Node name read from the dentry.
- * @param component	Path component.
- *
- * @return		Zero on match, non-zero otherwise.
- */
-int fat_dentry_namecmp(char *name, const char *component)
-{
-	int rc;
-	size_t size;
-
-	if (!(rc = str_casecmp(name, component)))
-		return rc;
-	if (!str_chr(name, '.')) {
-		/*
-		 * There is no '.' in the name, so we know that there is enough
-		 * space for appending an extra '.' to name.
-		 */
-		size = str_size(name);
-		name[size] = '.';
-		name[size + 1] = '\0';
-		rc = str_casecmp(name, component);
-	}
-	return rc;
-}
-
-void fat_dentry_name_get(const fat_dentry_t *d, char *buf)
-{
-	unsigned int i;
-
-	for (i = 0; i < FAT_NAME_LEN; i++) {
-		if (d->name[i] == FAT_PAD)
-			break;
-
-		if (d->name[i] == FAT_DENTRY_E5_ESC)
-			*buf++ = 0xe5;
-		else {
-			if (d->lcase & FAT_LCASE_LOWER_NAME)
-				*buf++ = tolower(d->name[i]);
-			else
-				*buf++ = d->name[i];
-		}
-	}
-
-	if (d->ext[0] != FAT_PAD)
-		*buf++ = '.';
-
-	for (i = 0; i < FAT_EXT_LEN; i++) {
-		if (d->ext[i] == FAT_PAD) {
-			*buf = '\0';
-			return;
-		}
-
-		if (d->ext[i] == FAT_DENTRY_E5_ESC)
-			*buf++ = 0xe5;
-		else {
-			if (d->lcase & FAT_LCASE_LOWER_EXT)
-				*buf++ = tolower(d->ext[i]);
-			else
-				*buf++ = d->ext[i];
-		}
-	}
-
-	*buf = '\0';
-}
-
-void fat_dentry_name_set(fat_dentry_t *d, const char *name)
-{
-	unsigned int i;
-	const char fake_ext[] = "   ";
-	bool lower_name = true;
-	bool lower_ext = true;
-
-	for (i = 0; i < FAT_NAME_LEN; i++) {
-		switch ((uint8_t) *name) {
-		case 0xe5:
-			d->name[i] = FAT_DENTRY_E5_ESC;
-			name++;
-			break;
-		case '\0':
-		case '.':
-			d->name[i] = FAT_PAD;
-			break;
-		default:
-			if (isalpha(*name)) {
-				if (!islower(*name))
-					lower_name = false;
-			}
-
-			d->name[i] = toupper(*name++);
-			break;
-		}
-	}
-
-	if (*name++ != '.')
-		name = fake_ext;
-
-	for (i = 0; i < FAT_EXT_LEN; i++) {
-		switch ((uint8_t) *name) {
-		case 0xe5:
-			d->ext[i] = FAT_DENTRY_E5_ESC;
-			name++;
-			break;
-		case '\0':
-			d->ext[i] = FAT_PAD;
-			break;
-		default:
-			if (isalpha(*name)) {
-				if (!islower(*name))
-					lower_ext = false;
-			}
-
-			d->ext[i] = toupper(*name++);
-			break;
-		}
-	}
-
-	if (lower_name)
-		d->lcase |= FAT_LCASE_LOWER_NAME;
-	else
-		d->lcase &= ~FAT_LCASE_LOWER_NAME;
-
-	if (lower_ext)
-		d->lcase |= FAT_LCASE_LOWER_EXT;
-	else
-		d->lcase &= ~FAT_LCASE_LOWER_EXT;
-}
-
-void fat_dentry_vollabel_get(const fat_dentry_t *d, char *buf)
-{
-	unsigned int i;
-
-	for (i = 0; i < FAT_NAME_LEN; i++) {
-		if (d->name[i] == FAT_PAD)
-			break;
-
-		if (d->name[i] == FAT_DENTRY_E5_ESC)
-			*buf++ = 0xe5;
-		else
-			*buf++ = d->name[i];
-	}
-
-	for (i = 0; i < FAT_EXT_LEN; i++) {
-		if (d->ext[i] == FAT_PAD) {
-			*buf = '\0';
-			return;
-		}
-
-		if (d->ext[i] == FAT_DENTRY_E5_ESC)
-			*buf++ = 0xe5;
-		else
-			*buf++ = d->ext[i];
-	}
-
-	*buf = '\0';
-}
-
-fat_dentry_clsf_t fat_classify_dentry(const fat_dentry_t *d)
-{
-	if (d->attr == FAT_ATTR_LFN) {
-		/* long name entry */
-		if (FAT_LFN_ORDER(d) & FAT_LFN_ERASED)
-			return FAT_DENTRY_FREE;
-		else
-			return FAT_DENTRY_LFN;
-	}
-	if (d->attr & FAT_ATTR_VOLLABEL) {
-		/* volume label entry */
-		return FAT_DENTRY_VOLLABEL;
-	}
-	if (d->name[0] == FAT_DENTRY_ERASED) {
-		/* not-currently-used entry */
-		return FAT_DENTRY_FREE;
-	}
-	if (d->name[0] == FAT_DENTRY_UNUSED) {
-		/* never used entry */
-		return FAT_DENTRY_LAST;
-	}
-	if (d->name[0] == FAT_DENTRY_DOT) {
-		/*
-		 * Most likely '.' or '..'.
-		 * It cannot occur in a regular file name.
-		 */
-		return FAT_DENTRY_SKIP;
-	}
-	return FAT_DENTRY_VALID;
-}
-
-/** Compute checksum of Node name.
- *
- * Returns an unsigned byte checksum computed on an unsigned byte
- * array. The array must be 11 bytes long and is assumed to contain
- * a name stored in the format of a MS-DOS directory entry.
- *
- * @param name		Node name read from the dentry.
- *
- * @return		An 8-bit unsigned checksum of the name.
- */
-uint8_t fat_dentry_chksum(uint8_t *name)
-{
-	uint8_t i, sum = 0;
-
-	for (i = 0; i < (FAT_NAME_LEN + FAT_EXT_LEN); i++)
-		sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + name[i];
-
-	return sum;
-}
-
-/** Get number of bytes in a string with size limit.
- *
- * @param str  NULL-terminated (or not) string. The pointer comes from a packed
- *             structure and as such is expected to be unaligned.
- * @param size Maximum number of bytes to consider.
- *
- * @return Number of bytes in string (without 0 and ff).
- *
- */
-size_t fat_lfn_str_nlength(const unaligned_uint16_t *str, size_t size)
-{
-	size_t offset = 0;
-
-	while (offset < size) {
-		if (str[offset] == 0 || str[offset] == FAT_LFN_PAD)
-			break;
-		offset++;
-	}
-	return offset;
-}
-
-/** Get number of bytes in a FAT long entry occuped by characters.
- *
- * @param d FAT long entry.
- *
- * @return Number of bytes.
- *
- */
-size_t fat_lfn_size(const fat_dentry_t *d)
-{
-	size_t size = 0;
-
-	size += fat_lfn_str_nlength(FAT_LFN_PART1(d), FAT_LFN_PART1_SIZE);
-	size += fat_lfn_str_nlength(FAT_LFN_PART2(d), FAT_LFN_PART2_SIZE);
-	size += fat_lfn_str_nlength(FAT_LFN_PART3(d), FAT_LFN_PART3_SIZE);
-
-	return size;
-}
-
-size_t fat_lfn_get_entry(const fat_dentry_t *d, uint16_t *dst, size_t *offset)
-{
-	int i;
-	for (i = FAT_LFN_PART3_SIZE - 1; i >= 0 && *offset > 0; i--) {
-		if (d->lfn.part3[i] == 0 || d->lfn.part3[i] == FAT_LFN_PAD)
-			continue;
-		(*offset)--;
-		dst[(*offset)] = uint16_t_le2host(d->lfn.part3[i]);
-	}
-	for (i = FAT_LFN_PART2_SIZE - 1; i >= 0 && *offset > 0; i--) {
-		if (d->lfn.part2[i] == 0 || d->lfn.part2[i] == FAT_LFN_PAD)
-			continue;
-		(*offset)--;
-		dst[(*offset)] = uint16_t_le2host(d->lfn.part2[i]);
-	}
-	for (i = FAT_LFN_PART1_SIZE - 1; i >= 0 && *offset > 0; i--) {
-		if (d->lfn.part1[i] == 0 || d->lfn.part1[i] == FAT_LFN_PAD)
-			continue;
-		(*offset)--;
-		dst[(*offset)] = uint16_t_le2host(d->lfn.part1[i]);
-	}
-	return *offset;
-}
-
-size_t fat_lfn_set_entry(const uint16_t *src, size_t *offset, size_t size,
-    fat_dentry_t *d)
-{
-	size_t idx;
-	for (idx = 0; idx < FAT_LFN_PART1_SIZE; idx++) {
-		if (*offset < size) {
-			d->lfn.part1[idx] = host2uint16_t_le(src[*offset]);
-			(*offset)++;
-		} else
-			d->lfn.part1[idx] = FAT_LFN_PAD;
-	}
-	for (idx = 0; idx < FAT_LFN_PART2_SIZE; idx++) {
-		if (*offset < size) {
-			d->lfn.part2[idx] = host2uint16_t_le(src[*offset]);
-			(*offset)++;
-		} else
-			d->lfn.part2[idx] = FAT_LFN_PAD;
-	}
-	for (idx = 0; idx < FAT_LFN_PART3_SIZE; idx++) {
-		if (*offset < size) {
-			d->lfn.part3[idx] = host2uint16_t_le(src[*offset]);
-			(*offset)++;
-		} else
-			d->lfn.part3[idx] = FAT_LFN_PAD;
-	}
-
-	if (src[*offset] == 0)
-		offset++;
-	FAT_LFN_ATTR(d) = FAT_ATTR_LFN;
-	d->lfn.type = 0;
-	d->lfn.firstc_lo = 0;
-
-	return *offset;
-}
-
-void str_to_ascii(char *dst, const char *src, size_t count, uint8_t pad)
-{
-	char32_t ch;
-	size_t off = 0;
-	size_t i = 0;
-
-	while (i < count) {
-		if ((ch = str_decode(src, &off, STR_NO_LIMIT)) != 0) {
-			if (ascii_check(ch) && IS_D_CHAR(ch))
-				*dst = toupper(ch);
-			else
-				*dst = pad;
-		} else
-			break;
-
-		dst++;
-		i++;
-	}
-	*dst = '\0';
-}
-
-bool fat_valid_name(const char *name)
-{
-	char32_t ch;
-	size_t offset = 0;
-	bool result = true;
-
-	while ((ch = str_decode(name, &offset, STR_NO_LIMIT)) != 0) {
-		if (str_chr(FAT_STOP_CHARS, ch) != NULL) {
-			result = false;
-			break;
-		}
-	}
-	return result;
-}
-
-bool fat_valid_short_name(const char *name)
-{
-	unsigned int i;
-	unsigned int dot = 0;
-	bool dot_found = false;
-
-	for (i = 0; name[i]; i++) {
-		if (name[i] == '.') {
-			if (dot_found) {
-				return false;
-			} else {
-				dot_found = true;
-				dot = i;
-			}
-		} else {
-			if (!IS_D_CHAR(name[i]))
-				return false;
-		}
-	}
-
-	if (dot_found) {
-		if (dot > FAT_NAME_LEN)
-			return false;
-		if (i - dot > FAT_EXT_LEN + 1)
-			return false;
-	} else {
-		if (i > FAT_NAME_LEN)
-			return false;
-	}
-
-	return true;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_dentry.h
===================================================================
--- uspace/srv/fs/fat/fat_dentry.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-#ifndef FAT_FAT_DENTRY_H_
-#define FAT_FAT_DENTRY_H_
-
-#include <ctype.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <unaligned.h>
-
-#define IS_D_CHAR(ch) (isalnum(ch) || ch == '_')
-#define FAT_STOP_CHARS "*?/\\\n\t|'"
-
-#define FAT_NAME_LEN		8
-#define FAT_EXT_LEN		3
-#define FAT_VOLLABEL_LEN	11
-
-#define FAT_NAME_DOT		".       "
-#define FAT_NAME_DOT_DOT	"..      "
-#define FAT_EXT_PAD		"   "
-
-#define FAT_ATTR_RDONLY   0x01
-#define FAT_ATTR_HIDDEN   0x02
-#define FAT_ATTR_SYSTEM   0x04
-#define FAT_ATTR_VOLLABEL 0x08
-#define FAT_ATTR_SUBDIR   0x10
-#define FAT_ATTR_ARCHIVE  0x20
-#define FAT_ATTR_LFN \
-    (FAT_ATTR_RDONLY | FAT_ATTR_HIDDEN | FAT_ATTR_SYSTEM | FAT_ATTR_VOLLABEL)
-
-#define FAT_LCASE_LOWER_NAME	0x08
-#define FAT_LCASE_LOWER_EXT	0x10
-
-#define FAT_PAD			' '
-#define FAT_LFN_PAD	0xffff
-#define FAT_SFN_CHAR '_'
-
-#define FAT_DENTRY_UNUSED	0x00
-#define FAT_DENTRY_E5_ESC	0x05
-#define FAT_DENTRY_DOT		0x2e
-#define FAT_DENTRY_ERASED	0xe5
-#define FAT_LFN_LAST		0x40
-#define FAT_LFN_ERASED		0x80
-
-#define FAT_LFN_ORDER(d) ((d)->lfn.order)
-#define FAT_IS_LFN(d) \
-    ((FAT_LFN_ORDER((d)) & FAT_LFN_LAST) == FAT_LFN_LAST)
-#define FAT_LFN_COUNT(d) \
-    (FAT_LFN_ORDER((d)) ^ FAT_LFN_LAST)
-#define FAT_LFN_PART1(d) ((d)->lfn.part1)
-#define FAT_LFN_PART2(d) ((d)->lfn.part2)
-#define FAT_LFN_PART3(d) ((d)->lfn.part3)
-#define FAT_LFN_ATTR(d) ((d)->lfn.attr)
-#define FAT_LFN_CHKSUM(d) ((d)->lfn.check_sum)
-
-#define FAT_LFN_NAME_LEN    260                           /* characters */
-#define FAT_LFN_NAME_SIZE   STR_BOUNDS(FAT_LFN_NAME_LEN)  /* bytes */
-#define FAT_LFN_MAX_COUNT   20
-#define FAT_LFN_PART1_SIZE  5
-#define FAT_LFN_PART2_SIZE  6
-#define FAT_LFN_PART3_SIZE  2
-#define FAT_LFN_ENTRY_SIZE \
-    (FAT_LFN_PART1_SIZE + FAT_LFN_PART2_SIZE + FAT_LFN_PART3_SIZE)
-
-typedef enum {
-	FAT_DENTRY_SKIP,
-	FAT_DENTRY_LAST,
-	FAT_DENTRY_FREE,
-	FAT_DENTRY_VALID,
-	FAT_DENTRY_LFN,
-	FAT_DENTRY_VOLLABEL
-} fat_dentry_clsf_t;
-
-typedef union {
-	struct {
-		uint8_t		name[8];
-		uint8_t		ext[3];
-		uint8_t		attr;
-		uint8_t		lcase;
-		uint8_t		ctime_fine;
-		uint16_t	ctime;
-		uint16_t	cdate;
-		uint16_t	adate;
-		union {
-			uint16_t	eaidx;		/* FAT12/FAT16 */
-			uint16_t	firstc_hi;	/* FAT32 */
-		} __attribute__((packed));
-		uint16_t	mtime;
-		uint16_t	mdate;
-		union {
-			uint16_t	firstc;		/* FAT12/FAT16 */
-			uint16_t	firstc_lo;	/* FAT32 */
-		} __attribute__((packed));
-		uint32_t	size;
-	} __attribute__((packed));
-	struct {
-		uint8_t		order;
-		uint16_t	part1[FAT_LFN_PART1_SIZE];
-		uint8_t		attr;
-		uint8_t		type;
-		uint8_t		check_sum;
-		uint16_t	part2[FAT_LFN_PART2_SIZE];
-		uint16_t	firstc_lo; /* MUST be 0 */
-		uint16_t	part3[FAT_LFN_PART3_SIZE];
-	} __attribute__((packed)) lfn;
-} __attribute__((packed)) fat_dentry_t;
-
-extern int fat_dentry_namecmp(char *, const char *);
-extern void fat_dentry_name_get(const fat_dentry_t *, char *);
-extern void fat_dentry_name_set(fat_dentry_t *, const char *);
-extern void fat_dentry_vollabel_get(const fat_dentry_t *, char *);
-extern fat_dentry_clsf_t fat_classify_dentry(const fat_dentry_t *);
-extern uint8_t fat_dentry_chksum(uint8_t *);
-
-extern size_t fat_lfn_str_nlength(const unaligned_uint16_t *, size_t);
-extern size_t fat_lfn_size(const fat_dentry_t *);
-extern size_t fat_lfn_get_entry(const fat_dentry_t *, uint16_t *, size_t *);
-extern size_t fat_lfn_set_entry(const uint16_t *, size_t *, size_t,
-    fat_dentry_t *);
-
-extern void str_to_ascii(char *, const char *, size_t, uint8_t);
-
-extern bool fat_valid_name(const char *);
-extern bool fat_valid_short_name(const char *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_directory.c
===================================================================
--- uspace/srv/fs/fat/fat_directory.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,566 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat_directory.c
- * @brief	Functions that work with FAT directory.
- */
-
-#include "fat_directory.h"
-#include "fat_fat.h"
-#include <block.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <mem.h>
-#include <str.h>
-#include <align.h>
-#include <stdio.h>
-
-errno_t fat_directory_open(fat_node_t *nodep, fat_directory_t *di)
-{
-	di->b = NULL;
-	di->nodep = nodep;
-	if (di->nodep->type != FAT_DIRECTORY)
-		return EINVAL;
-
-	di->bs = block_bb_get(di->nodep->idx->service_id);
-	di->blocks = ROUND_UP(nodep->size, BPS(di->bs)) / BPS(di->bs);
-	di->pos = 0;
-	di->bnum = 0;
-	di->last = false;
-
-	return EOK;
-}
-
-errno_t fat_directory_close(fat_directory_t *di)
-{
-	errno_t rc = EOK;
-
-	if (di->b)
-		rc = block_put(di->b);
-
-	return rc;
-}
-
-static errno_t fat_directory_block_load(fat_directory_t *di)
-{
-	uint32_t i;
-	errno_t rc;
-
-	i = (di->pos * sizeof(fat_dentry_t)) / BPS(di->bs);
-	if (i < di->blocks) {
-		if (di->b && di->bnum != i) {
-			block_put(di->b);
-			di->b = NULL;
-		}
-		if (!di->b) {
-			rc = fat_block_get(&di->b, di->bs, di->nodep, i,
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				di->b = NULL;
-				return rc;
-			}
-			di->bnum = i;
-		}
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-errno_t fat_directory_next(fat_directory_t *di)
-{
-	errno_t rc;
-
-	di->pos += 1;
-	rc = fat_directory_block_load(di);
-	if (rc != EOK)
-		di->pos -= 1;
-
-	return rc;
-}
-
-errno_t fat_directory_prev(fat_directory_t *di)
-{
-	errno_t rc = EOK;
-
-	if (di->pos > 0) {
-		di->pos -= 1;
-		rc = fat_directory_block_load(di);
-	} else
-		return ENOENT;
-
-	if (rc != EOK)
-		di->pos += 1;
-
-	return rc;
-}
-
-errno_t fat_directory_seek(fat_directory_t *di, aoff64_t pos)
-{
-	aoff64_t _pos = di->pos;
-	errno_t rc;
-
-	di->pos = pos;
-	rc = fat_directory_block_load(di);
-	if (rc != EOK)
-		di->pos = _pos;
-
-	return rc;
-}
-
-errno_t fat_directory_get(fat_directory_t *di, fat_dentry_t **d)
-{
-	errno_t rc;
-
-	rc = fat_directory_block_load(di);
-	if (rc == EOK) {
-		aoff64_t o = di->pos % (BPS(di->bs) / sizeof(fat_dentry_t));
-		*d = ((fat_dentry_t *)di->b->data) + o;
-	}
-
-	return rc;
-}
-
-errno_t fat_directory_read(fat_directory_t *di, char *name, fat_dentry_t **de)
-{
-	fat_dentry_t *d = NULL;
-	uint16_t wname[FAT_LFN_NAME_LEN];
-	size_t lfn_offset, lfn_size;
-	bool long_entry = false;
-	int long_entry_count = 0;
-	uint8_t checksum = 0;
-	errno_t rc;
-
-	void *data;
-	fat_instance_t *instance;
-
-	rc = fs_instance_get(di->nodep->idx->service_id, &data);
-	assert(rc == EOK);
-	instance = (fat_instance_t *) data;
-
-	do {
-		rc = fat_directory_get(di, &d);
-		if (rc != EOK)
-			return rc;
-
-		switch (fat_classify_dentry(d)) {
-		case FAT_DENTRY_LAST:
-			long_entry_count = 0;
-			long_entry = false;
-			return ENOENT;
-		case FAT_DENTRY_LFN:
-			if (long_entry) {
-				/* We found long entry */
-				long_entry_count--;
-				if ((FAT_LFN_ORDER(d) == long_entry_count) &&
-				    (checksum == FAT_LFN_CHKSUM(d))) {
-					/* Right order! */
-					fat_lfn_get_entry(d, wname,
-					    &lfn_offset);
-				} else {
-					/*
-					 * Something wrong with order.
-					 * Skip this long entries set.
-					 */
-					long_entry_count = 0;
-					long_entry = false;
-				}
-			} else if (FAT_IS_LFN(d) && instance->lfn_enabled) {
-				/* We found Last long entry! */
-				if (FAT_LFN_COUNT(d) <= FAT_LFN_MAX_COUNT) {
-					long_entry = true;
-					long_entry_count = FAT_LFN_COUNT(d);
-					lfn_size = (FAT_LFN_ENTRY_SIZE *
-					    (FAT_LFN_COUNT(d) - 1)) +
-					    fat_lfn_size(d);
-					lfn_offset = lfn_size;
-					fat_lfn_get_entry(d, wname,
-					    &lfn_offset);
-					checksum = FAT_LFN_CHKSUM(d);
-				}
-			}
-			break;
-		case FAT_DENTRY_VALID:
-			if (long_entry &&
-			    (checksum == fat_dentry_chksum(d->name))) {
-				wname[lfn_size] = '\0';
-				if (utf16_to_str(name, FAT_LFN_NAME_SIZE,
-				    wname) != EOK)
-					fat_dentry_name_get(d, name);
-			} else
-				fat_dentry_name_get(d, name);
-
-			*de = d;
-			return EOK;
-		case FAT_DENTRY_SKIP:
-		case FAT_DENTRY_FREE:
-		case FAT_DENTRY_VOLLABEL:
-		default:
-			long_entry_count = 0;
-			long_entry = false;
-			break;
-		}
-	} while (fat_directory_next(di) == EOK);
-
-	return ENOENT;
-}
-
-errno_t fat_directory_erase(fat_directory_t *di)
-{
-	errno_t rc;
-	fat_dentry_t *d;
-	bool flag = false;
-	uint8_t checksum;
-
-	rc = fat_directory_get(di, &d);
-	if (rc != EOK)
-		return rc;
-	checksum = fat_dentry_chksum(d->name);
-
-	d->name[0] = FAT_DENTRY_ERASED;
-	di->b->dirty = true;
-
-	while (!flag && fat_directory_prev(di) == EOK) {
-		if (fat_directory_get(di, &d) == EOK &&
-		    fat_classify_dentry(d) == FAT_DENTRY_LFN &&
-		    checksum == FAT_LFN_CHKSUM(d)) {
-			if (FAT_IS_LFN(d))
-				flag = true;
-			memset(d, 0, sizeof(fat_dentry_t));
-			d->name[0] = FAT_DENTRY_ERASED;
-			di->b->dirty = true;
-		} else
-			break;
-	}
-
-	return EOK;
-}
-
-errno_t fat_directory_write(fat_directory_t *di, const char *name, fat_dentry_t *de)
-{
-	errno_t rc;
-	void *data;
-	fat_instance_t *instance;
-
-	rc = fs_instance_get(di->nodep->idx->service_id, &data);
-	assert(rc == EOK);
-	instance = (fat_instance_t *) data;
-
-	if (fat_valid_short_name(name)) {
-		/*
-		 * NAME could be directly stored in dentry without creating
-		 * LFN.
-		 */
-		fat_dentry_name_set(de, name);
-		if (fat_directory_is_sfn_exist(di, de))
-			return EEXIST;
-		rc = fat_directory_lookup_free(di, 1);
-		if (rc != EOK)
-			return rc;
-		rc = fat_directory_write_dentry(di, de);
-		return rc;
-	} else if (instance->lfn_enabled && fat_valid_name(name)) {
-		/* We should create long entries to store name */
-		int long_entry_count;
-		uint8_t checksum;
-		uint16_t wname[FAT_LFN_NAME_LEN];
-		size_t lfn_size, lfn_offset;
-
-		rc = str_to_utf16(wname, FAT_LFN_NAME_LEN, name);
-		if (rc != EOK)
-			return rc;
-
-		lfn_size = utf16_wsize(wname);
-		long_entry_count = lfn_size / FAT_LFN_ENTRY_SIZE;
-		if (lfn_size % FAT_LFN_ENTRY_SIZE)
-			long_entry_count++;
-		rc = fat_directory_lookup_free(di, long_entry_count + 1);
-		if (rc != EOK)
-			return rc;
-		aoff64_t start_pos = di->pos;
-
-		/* Write Short entry */
-		rc = fat_directory_create_sfn(di, de, name);
-		if (rc != EOK)
-			return rc;
-		checksum = fat_dentry_chksum(de->name);
-
-		rc = fat_directory_seek(di, start_pos + long_entry_count);
-		if (rc != EOK)
-			return rc;
-		rc = fat_directory_write_dentry(di, de);
-		if (rc != EOK)
-			return rc;
-
-		/* Write Long entry by parts */
-		lfn_offset = 0;
-		fat_dentry_t *d;
-		size_t idx = 0;
-		do {
-			rc = fat_directory_prev(di);
-			if (rc != EOK)
-				return rc;
-			rc = fat_directory_get(di, &d);
-			if (rc != EOK)
-				return rc;
-			fat_lfn_set_entry(wname, &lfn_offset, lfn_size + 1, d);
-			FAT_LFN_CHKSUM(d) = checksum;
-			FAT_LFN_ORDER(d) = ++idx;
-			di->b->dirty = true;
-		} while (lfn_offset < lfn_size);
-		FAT_LFN_ORDER(d) |= FAT_LFN_LAST;
-
-		rc = fat_directory_seek(di, start_pos + long_entry_count);
-		return rc;
-	}
-
-	return ENOTSUP;
-}
-
-errno_t fat_directory_create_sfn(fat_directory_t *di, fat_dentry_t *de,
-    const char *lname)
-{
-	char name[FAT_NAME_LEN + 1];
-	char ext[FAT_EXT_LEN + 1];
-	char number[FAT_NAME_LEN + 1];
-	memset(name, FAT_PAD, FAT_NAME_LEN);
-	memset(ext, FAT_PAD, FAT_EXT_LEN);
-	memset(number, FAT_PAD, FAT_NAME_LEN);
-
-	size_t name_len = str_size(lname);
-	char *pdot = str_rchr(lname, '.');
-	ext[FAT_EXT_LEN] = '\0';
-	if (pdot) {
-		pdot++;
-		str_to_ascii(ext, pdot, FAT_EXT_LEN, FAT_SFN_CHAR);
-		name_len = (pdot - lname - 1);
-	}
-	if (name_len > FAT_NAME_LEN)
-		name_len = FAT_NAME_LEN;
-	str_to_ascii(name, lname, name_len, FAT_SFN_CHAR);
-
-	unsigned idx;
-	for (idx = 1; idx <= FAT_MAX_SFN; idx++) {
-		snprintf(number, sizeof(number), "%u", idx);
-
-		/* Fill de->name with FAT_PAD */
-		memset(de->name, FAT_PAD, FAT_NAME_LEN + FAT_EXT_LEN);
-		/* Copy ext */
-		memcpy(de->ext, ext, str_size(ext));
-		/* Copy name */
-		memcpy(de->name, name, str_size(name));
-
-		/* Copy number */
-		size_t offset;
-		if (str_size(name) + str_size(number) + 1 > FAT_NAME_LEN)
-			offset = FAT_NAME_LEN - str_size(number) - 1;
-		else
-			offset = str_size(name);
-		de->name[offset] = '~';
-		offset++;
-		memcpy(de->name + offset, number, str_size(number));
-
-		if (!fat_directory_is_sfn_exist(di, de))
-			return EOK;
-	}
-
-	return ERANGE;
-}
-
-errno_t fat_directory_write_dentry(fat_directory_t *di, fat_dentry_t *de)
-{
-	fat_dentry_t *d;
-	errno_t rc;
-
-	rc = fat_directory_get(di, &d);
-	if (rc != EOK)
-		return rc;
-	memcpy(d, de, sizeof(fat_dentry_t));
-	di->b->dirty = true;
-
-	return EOK;
-}
-
-errno_t fat_directory_expand(fat_directory_t *di)
-{
-	errno_t rc;
-	fat_cluster_t mcl, lcl;
-
-	if (!FAT_IS_FAT32(di->bs) && di->nodep->firstc == FAT_CLST_ROOT) {
-		/* Can't grow the root directory on FAT12/16. */
-		return ENOSPC;
-	}
-	rc = fat_alloc_clusters(di->bs, di->nodep->idx->service_id, 1, &mcl,
-	    &lcl);
-	if (rc != EOK)
-		return rc;
-	rc = fat_zero_cluster(di->bs, di->nodep->idx->service_id, mcl);
-	if (rc != EOK) {
-		(void) fat_free_clusters(di->bs, di->nodep->idx->service_id,
-		    mcl);
-		return rc;
-	}
-	rc = fat_append_clusters(di->bs, di->nodep, mcl, lcl);
-	if (rc != EOK) {
-		(void) fat_free_clusters(di->bs, di->nodep->idx->service_id,
-		    mcl);
-		return rc;
-	}
-	di->nodep->size += BPS(di->bs) * SPC(di->bs);
-	di->nodep->dirty = true;		/* need to sync node */
-	di->blocks = di->nodep->size / BPS(di->bs);
-
-	return EOK;
-}
-
-errno_t fat_directory_lookup_free(fat_directory_t *di, size_t count)
-{
-	fat_dentry_t *d;
-	size_t found;
-	aoff64_t pos;
-	errno_t rc;
-
-	do {
-		found = 0;
-		pos = 0;
-		fat_directory_seek(di, 0);
-		do {
-			rc = fat_directory_get(di, &d);
-			if (rc != EOK)
-				return rc;
-
-			switch (fat_classify_dentry(d)) {
-			case FAT_DENTRY_LAST:
-			case FAT_DENTRY_FREE:
-				if (found == 0)
-					pos = di->pos;
-				found++;
-				if (found == count) {
-					fat_directory_seek(di, pos);
-					return EOK;
-				}
-				break;
-			case FAT_DENTRY_VALID:
-			case FAT_DENTRY_LFN:
-			case FAT_DENTRY_SKIP:
-			case FAT_DENTRY_VOLLABEL:
-			default:
-				found = 0;
-				break;
-			}
-		} while (fat_directory_next(di) == EOK);
-	} while (fat_directory_expand(di) == EOK);
-
-	return ENOSPC;
-}
-
-errno_t fat_directory_lookup_name(fat_directory_t *di, const char *name,
-    fat_dentry_t **de)
-{
-	char entry[FAT_LFN_NAME_SIZE];
-
-	fat_directory_seek(di, 0);
-	while (fat_directory_read(di, entry, de) == EOK) {
-		if (fat_dentry_namecmp(entry, name) == 0) {
-			return EOK;
-		} else {
-			if (fat_directory_next(di) != EOK)
-				break;
-		}
-	}
-
-	return ENOENT;
-}
-
-bool fat_directory_is_sfn_exist(fat_directory_t *di, fat_dentry_t *de)
-{
-	fat_dentry_t *d;
-	errno_t rc;
-
-	fat_directory_seek(di, 0);
-	do {
-		rc = fat_directory_get(di, &d);
-		if (rc != EOK)
-			return false;
-
-		switch (fat_classify_dentry(d)) {
-		case FAT_DENTRY_LAST:
-			return false;
-		case FAT_DENTRY_VALID:
-			if (memcmp(de->name, d->name,
-			    FAT_NAME_LEN + FAT_EXT_LEN) == 0)
-				return true;
-			break;
-		default:
-		case FAT_DENTRY_LFN:
-		case FAT_DENTRY_SKIP:
-		case FAT_DENTRY_VOLLABEL:
-		case FAT_DENTRY_FREE:
-			break;
-		}
-	} while (fat_directory_next(di) == EOK);
-
-	return false;
-}
-
-/** Find volume label entry in a directory.
- *
- * @return EOK on success, ENOENT if not found, EIO on I/O error
- */
-errno_t fat_directory_vollabel_get(fat_directory_t *di, char *label)
-{
-	fat_dentry_t *d;
-	errno_t rc;
-
-	fat_directory_seek(di, 0);
-	do {
-		rc = fat_directory_get(di, &d);
-		if (rc != EOK)
-			return EIO;
-
-		switch (fat_classify_dentry(d)) {
-		case FAT_DENTRY_VOLLABEL:
-			fat_dentry_vollabel_get(d, label);
-			return EOK;
-		default:
-			break;
-		}
-	} while (fat_directory_next(di) == EOK);
-
-	/* Not found */
-	return ENOENT;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_directory.h
===================================================================
--- uspace/srv/fs/fat/fat_directory.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,79 +1,0 @@
-/*
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-#ifndef FAT_FAT_DIRECTORY_H_
-#define FAT_FAT_DIRECTORY_H_
-
-#include <stdint.h>
-#include "fat.h"
-#include "fat_dentry.h"
-
-#define FAT_MAX_SFN 9999
-
-typedef struct {
-	/* Directory data */
-	fat_bs_t *bs;
-	fat_node_t *nodep;
-	uint32_t blocks;
-	uint32_t bnum;
-	aoff64_t pos;
-	block_t *b;
-	bool last;
-} fat_directory_t;
-
-extern errno_t fat_directory_open(fat_node_t *, fat_directory_t *);
-extern errno_t fat_directory_close(fat_directory_t *);
-
-extern errno_t fat_directory_next(fat_directory_t *);
-extern errno_t fat_directory_prev(fat_directory_t *);
-extern errno_t fat_directory_seek(fat_directory_t *, aoff64_t);
-extern errno_t fat_directory_get(fat_directory_t *, fat_dentry_t **);
-
-extern errno_t fat_directory_read(fat_directory_t *, char *, fat_dentry_t **);
-extern errno_t fat_directory_write(fat_directory_t *, const char *, fat_dentry_t *);
-extern errno_t fat_directory_erase(fat_directory_t *);
-extern errno_t fat_directory_lookup_name(fat_directory_t *, const char *,
-    fat_dentry_t **);
-extern bool fat_directory_is_sfn_exist(fat_directory_t *, fat_dentry_t *);
-
-extern errno_t fat_directory_lookup_free(fat_directory_t *, size_t);
-extern errno_t fat_directory_write_dentry(fat_directory_t *, fat_dentry_t *);
-extern errno_t fat_directory_create_sfn(fat_directory_t *, fat_dentry_t *,
-    const char *);
-extern errno_t fat_directory_expand(fat_directory_t *);
-extern errno_t fat_directory_vollabel_get(fat_directory_t *, char *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_fat.c
===================================================================
--- uspace/srv/fs/fat/fat_fat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,977 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat_fat.c
- * @brief	Functions that manipulate the File Allocation Tables.
- */
-
-#include "fat_fat.h"
-#include "fat_dentry.h"
-#include "fat.h"
-#include "../../vfs/vfs.h"
-#include <libfs.h>
-#include <block.h>
-#include <errno.h>
-#include <byteorder.h>
-#include <align.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#define IS_ODD(number)	(number & 0x1)
-
-/**
- * The fat_alloc_lock mutex protects all copies of the File Allocation Table
- * during allocation of clusters. The lock does not have to be held durring
- * deallocation of clusters.
- */
-static FIBRIL_MUTEX_INITIALIZE(fat_alloc_lock);
-
-/** Walk the cluster chain.
- *
- * @param bs		Buffer holding the boot sector for the file.
- * @param service_id	Service ID of the device with the file.
- * @param firstc	First cluster to start the walk with.
- * @param lastc		If non-NULL, output argument hodling the last cluster
- *			number visited.
- * @param numc		If non-NULL, output argument holding the number of
- *			clusters seen during the walk.
- * @param max_clusters	Maximum number of clusters to visit.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-fat_cluster_walk(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc,
-    fat_cluster_t *lastc, uint32_t *numc, uint32_t max_clusters)
-{
-	uint32_t clusters = 0;
-	fat_cluster_t clst = firstc, clst_last1 = FAT_CLST_LAST1(bs);
-	fat_cluster_t clst_bad = FAT_CLST_BAD(bs);
-	errno_t rc;
-
-	if (firstc == FAT_CLST_RES0) {
-		/* No space allocated to the file. */
-		if (lastc)
-			*lastc = firstc;
-		if (numc)
-			*numc = 0;
-		return EOK;
-	}
-
-	while (clst < clst_last1 && clusters < max_clusters) {
-		assert(clst >= FAT_CLST_FIRST);
-		if (lastc)
-			*lastc = clst;	/* remember the last cluster number */
-
-		/* read FAT1 */
-		rc = fat_get_cluster(bs, service_id, FAT1, clst, &clst);
-		if (rc != EOK)
-			return rc;
-
-		assert(clst != clst_bad);
-		clusters++;
-	}
-
-	if (lastc && clst < clst_last1)
-		*lastc = clst;
-	if (numc)
-		*numc = clusters;
-
-	return EOK;
-}
-
-/** Read block from file located on a FAT file system.
- *
- * @param block		Pointer to a block pointer for storing result.
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		FAT node.
- * @param bn		Block number.
- * @param flags		Flags passed to libblock.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-fat_block_get(block_t **block, struct fat_bs *bs, fat_node_t *nodep,
-    aoff64_t bn, int flags)
-{
-	fat_cluster_t firstc = nodep->firstc;
-	fat_cluster_t currc = 0;
-	aoff64_t relbn = bn;
-	errno_t rc;
-
-	if (!nodep->size)
-		return ELIMIT;
-
-	if (!FAT_IS_FAT32(bs) && nodep->firstc == FAT_CLST_ROOT)
-		goto fall_through;
-
-	if (((((nodep->size - 1) / BPS(bs)) / SPC(bs)) == bn / SPC(bs)) &&
-	    nodep->lastc_cached_valid) {
-		/*
-		 * This is a request to read a block within the last cluster
-		 * when fortunately we have the last cluster number cached.
-		 */
-		return block_get(block, nodep->idx->service_id,
-		    CLBN2PBN(bs, nodep->lastc_cached_value, bn), flags);
-	}
-
-	if (nodep->currc_cached_valid && bn >= nodep->currc_cached_bn) {
-		/*
-		 * We can start with the cluster cached by the previous call to
-		 * fat_block_get().
-		 */
-		firstc = nodep->currc_cached_value;
-		relbn -= (nodep->currc_cached_bn / SPC(bs)) * SPC(bs);
-	}
-
-fall_through:
-	rc = _fat_block_get(block, bs, nodep->idx->service_id, firstc,
-	    &currc, relbn, flags);
-	if (rc != EOK)
-		return rc;
-
-	/*
-	 * Update the "current" cluster cache.
-	 */
-	nodep->currc_cached_valid = true;
-	nodep->currc_cached_bn = bn;
-	nodep->currc_cached_value = currc;
-
-	return rc;
-}
-
-/** Read block from file located on a FAT file system.
- *
- * @param block		Pointer to a block pointer for storing result.
- * @param bs		Buffer holding the boot sector of the file system.
- * @param service_id	Service ID handle of the file system.
- * @param fcl		First cluster used by the file. Can be zero if the file
- *			is empty.
- * @param clp		If not NULL, address where the cluster containing bn
- *			will be stored.
- *			stored
- * @param bn		Block number.
- * @param flags		Flags passed to libblock.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-_fat_block_get(block_t **block, fat_bs_t *bs, service_id_t service_id,
-    fat_cluster_t fcl, fat_cluster_t *clp, aoff64_t bn, int flags)
-{
-	uint32_t clusters;
-	uint32_t max_clusters;
-	fat_cluster_t c = 0;
-	errno_t rc;
-
-	/*
-	 * This function can only operate on non-zero length files.
-	 */
-	if (fcl == FAT_CLST_RES0)
-		return ELIMIT;
-
-	if (!FAT_IS_FAT32(bs) && fcl == FAT_CLST_ROOT) {
-		/* root directory special case */
-		assert(bn < RDS(bs));
-		rc = block_get(block, service_id,
-		    RSCNT(bs) + FATCNT(bs) * SF(bs) + bn, flags);
-		return rc;
-	}
-
-	max_clusters = bn / SPC(bs);
-	rc = fat_cluster_walk(bs, service_id, fcl, &c, &clusters, max_clusters);
-	if (rc != EOK)
-		return rc;
-	assert(clusters == max_clusters);
-
-	rc = block_get(block, service_id, CLBN2PBN(bs, c, bn), flags);
-
-	if (clp)
-		*clp = c;
-
-	return rc;
-}
-
-/** Fill the gap between EOF and a new file position.
- *
- * @param bs		Buffer holding the boot sector for nodep.
- * @param nodep		FAT node with the gap.
- * @param mcl		First cluster in an independent cluster chain that will
- *			be later appended to the end of the node's own cluster
- *			chain. If pos is still in the last allocated cluster,
- *			this argument is ignored.
- * @param pos		Position in the last node block.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-fat_fill_gap(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl, aoff64_t pos)
-{
-	block_t *b;
-	aoff64_t o, boundary;
-	errno_t rc;
-
-	boundary = ROUND_UP(nodep->size, BPS(bs) * SPC(bs));
-
-	/* zero out already allocated space */
-	for (o = nodep->size; o < pos && o < boundary;
-	    o = ALIGN_DOWN(o + BPS(bs), BPS(bs))) {
-		int flags = (o % BPS(bs) == 0) ?
-		    BLOCK_FLAGS_NOREAD : BLOCK_FLAGS_NONE;
-		rc = fat_block_get(&b, bs, nodep, o / BPS(bs), flags);
-		if (rc != EOK)
-			return rc;
-		memset(b->data + o % BPS(bs), 0, BPS(bs) - o % BPS(bs));
-		b->dirty = true;		/* need to sync node */
-		rc = block_put(b);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (o >= pos)
-		return EOK;
-
-	/* zero out the initial part of the new cluster chain */
-	for (o = boundary; o < pos; o += BPS(bs)) {
-		rc = _fat_block_get(&b, bs, nodep->idx->service_id, mcl,
-		    NULL, (o - boundary) / BPS(bs), BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-		memset(b->data, 0, min(BPS(bs), pos - o));
-		b->dirty = true;		/* need to sync node */
-		rc = block_put(b);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Get cluster from the first FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which to get.
- * @param value		Output argument holding the value of the cluster.
- *
- * @return		EOK or an error code.
- */
-static errno_t
-fat_get_cluster_fat12(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t *value)
-{
-	block_t *b, *b1;
-	uint16_t byte1, byte2;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = (clst + clst / 2);
-	if (offset / BPS(bs) >= SF(bs))
-		return ERANGE;
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	byte1 = ((uint8_t *) b->data)[offset % BPS(bs)];
-	/* This cluster access spans a sector boundary. Check only for FAT12 */
-	if ((offset % BPS(bs)) + 1 == BPS(bs)) {
-		/* Is this the last sector of FAT? */
-		if (offset / BPS(bs) < SF(bs)) {
-			/* No, read the next sector */
-			rc = block_get(&b1, service_id, 1 + RSCNT(bs) +
-			    SF(bs) * fatno + offset / BPS(bs),
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				block_put(b);
-				return rc;
-			}
-			/*
-			 * Combining value with last byte of current sector and
-			 * first byte of next sector
-			 */
-			byte2 = ((uint8_t *) b1->data)[0];
-
-			rc = block_put(b1);
-			if (rc != EOK) {
-				block_put(b);
-				return rc;
-			}
-		} else {
-			/* Yes. This is the last sector of FAT */
-			block_put(b);
-			return ERANGE;
-		}
-	} else
-		byte2 = ((uint8_t *) b->data)[(offset % BPS(bs)) + 1];
-
-	*value = (byte1 | (byte2 << 8));
-	if (IS_ODD(clst))
-		*value = (*value) >> 4;
-	else
-		*value = (*value) & FAT12_MASK;
-
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Get cluster from the first FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which to get.
- * @param value		Output argument holding the value of the cluster.
- *
- * @return		EOK or an error code.
- */
-static errno_t
-fat_get_cluster_fat16(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t *value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = (clst * FAT16_CLST_SIZE);
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	*value = uint16_t_le2host(*(uint16_t *)(b->data + offset % BPS(bs)));
-
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Get cluster from the first FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which to get.
- * @param value		Output argument holding the value of the cluster.
- *
- * @return		EOK or an error code.
- */
-static errno_t
-fat_get_cluster_fat32(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t *value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = (clst * FAT32_CLST_SIZE);
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	*value = uint32_t_le2host(*(uint32_t *)(b->data + offset % BPS(bs))) &
-	    FAT32_MASK;
-
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Get cluster from the first FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param clst		Cluster which to get.
- * @param value		Output argument holding the value of the cluster.
- *
- * @return		EOK or an error code.
- */
-errno_t
-fat_get_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t *value)
-{
-	errno_t rc;
-
-	assert(fatno < FATCNT(bs));
-
-	if (FAT_IS_FAT12(bs))
-		rc = fat_get_cluster_fat12(bs, service_id, fatno, clst, value);
-	else if (FAT_IS_FAT16(bs))
-		rc = fat_get_cluster_fat16(bs, service_id, fatno, clst, value);
-	else
-		rc = fat_get_cluster_fat32(bs, service_id, fatno, clst, value);
-
-	return rc;
-}
-
-/** Set cluster in one instance of FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param fatno		Number of the FAT instance where to make the change.
- * @param clst		Cluster which is to be set.
- * @param value		Value to set the cluster with.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t
-fat_set_cluster_fat12(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t value)
-{
-	block_t *b, *b1 = NULL;
-	aoff64_t offset;
-	uint16_t byte1, byte2;
-	errno_t rc;
-
-	offset = (clst + clst / 2);
-	if (offset / BPS(bs) >= SF(bs))
-		return ERANGE;
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	byte1 = ((uint8_t *) b->data)[offset % BPS(bs)];
-	bool border = false;
-	/* This cluster access spans a sector boundary. */
-	if ((offset % BPS(bs)) + 1 == BPS(bs)) {
-		/* Is it the last sector of FAT? */
-		if (offset / BPS(bs) < SF(bs)) {
-			/* No, read the next sector */
-			rc = block_get(&b1, service_id, 1 + RSCNT(bs) +
-			    SF(bs) * fatno + offset / BPS(bs),
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				block_put(b);
-				return rc;
-			}
-			/*
-			 * Combining value with last byte of current sector and
-			 * first byte of next sector
-			 */
-			byte2 = ((uint8_t *) b1->data)[0];
-			border = true;
-		} else {
-			/* Yes. This is the last sector of FAT */
-			block_put(b);
-			return ERANGE;
-		}
-	} else
-		byte2 = ((uint8_t *) b->data)[(offset % BPS(bs)) + 1];
-
-	if (IS_ODD(clst)) {
-		byte1 &= 0x0f;
-		byte2 = 0;
-		value = (value << 4);
-	} else {
-		byte1 = 0;
-		byte2 &= 0xf0;
-		value &= FAT12_MASK;
-	}
-
-	byte1 = byte1 | (value & 0xff);
-	byte2 = byte2 | (value >> 8);
-
-	((uint8_t *) b->data)[(offset % BPS(bs))] = byte1;
-	if (border) {
-		((uint8_t *) b1->data)[0] = byte2;
-
-		b1->dirty = true;
-		rc = block_put(b1);
-		if (rc != EOK) {
-			block_put(b);
-			return rc;
-		}
-	} else
-		((uint8_t *) b->data)[(offset % BPS(bs)) + 1] = byte2;
-
-	b->dirty = true;	/* need to sync block */
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Set cluster in one instance of FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param fatno		Number of the FAT instance where to make the change.
- * @param clst		Cluster which is to be set.
- * @param value		Value to set the cluster with.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t
-fat_set_cluster_fat16(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-
-	offset = (clst * FAT16_CLST_SIZE);
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	*(uint16_t *)(b->data + offset % BPS(bs)) = host2uint16_t_le(value);
-
-	b->dirty = true;	/* need to sync block */
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Set cluster in one instance of FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Service ID for the file system.
- * @param fatno		Number of the FAT instance where to make the change.
- * @param clst		Cluster which is to be set.
- * @param value		Value to set the cluster with.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t
-fat_set_cluster_fat32(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t value)
-{
-	block_t *b;
-	aoff64_t offset;
-	errno_t rc;
-	fat_cluster_t temp;
-
-	offset = (clst * FAT32_CLST_SIZE);
-
-	rc = block_get(&b, service_id, RSCNT(bs) + SF(bs) * fatno +
-	    offset / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	temp = uint32_t_le2host(*(uint32_t *)(b->data + offset % BPS(bs)));
-	temp &= 0xf0000000;
-	temp |= (value & FAT32_MASK);
-	*(uint32_t *)(b->data + offset % BPS(bs)) = host2uint32_t_le(temp);
-
-	b->dirty = true;	/* need to sync block */
-	rc = block_put(b);
-
-	return rc;
-}
-
-/** Set cluster in one instance of FAT.
- *
- * @param bs		Buffer holding the boot sector for the file system.
- * @param service_id	Device service ID for the file system.
- * @param fatno		Number of the FAT instance where to make the change.
- * @param clst		Cluster which is to be set.
- * @param value		Value to set the cluster with.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-fat_set_cluster(fat_bs_t *bs, service_id_t service_id, unsigned fatno,
-    fat_cluster_t clst, fat_cluster_t value)
-{
-	errno_t rc;
-
-	assert(fatno < FATCNT(bs));
-
-	if (FAT_IS_FAT12(bs))
-		rc = fat_set_cluster_fat12(bs, service_id, fatno, clst, value);
-	else if (FAT_IS_FAT16(bs))
-		rc = fat_set_cluster_fat16(bs, service_id, fatno, clst, value);
-	else
-		rc = fat_set_cluster_fat32(bs, service_id, fatno, clst, value);
-
-	return rc;
-}
-
-/** Replay the allocatoin of clusters in all shadow instances of FAT.
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param service_id	Service ID of the file system.
- * @param lifo		Chain of allocated clusters.
- * @param nclsts	Number of clusters in the lifo chain.
- *
- * @return		EOK on success or an error code.
- */
-errno_t fat_alloc_shadow_clusters(fat_bs_t *bs, service_id_t service_id,
-    fat_cluster_t *lifo, unsigned nclsts)
-{
-	uint8_t fatno;
-	unsigned c;
-	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc;
-
-	for (fatno = FAT1 + 1; fatno < FATCNT(bs); fatno++) {
-		for (c = 0; c < nclsts; c++) {
-			rc = fat_set_cluster(bs, service_id, fatno, lifo[c],
-			    c == 0 ? clst_last1 : lifo[c - 1]);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	return EOK;
-}
-
-/** Allocate clusters in all copies of FAT.
- *
- * This function will attempt to allocate the requested number of clusters in
- * all instances of the FAT.  The FAT will be altered so that the allocated
- * clusters form an independent chain (i.e. a chain which does not belong to any
- * file yet).
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param service_id	Device service ID of the file system.
- * @param nclsts	Number of clusters to allocate.
- * @param mcl		Output parameter where the first cluster in the chain
- *			will be returned.
- * @param lcl		Output parameter where the last cluster in the chain
- *			will be returned.
- *
- * @return		EOK on success, an error code otherwise.
- */
-errno_t
-fat_alloc_clusters(fat_bs_t *bs, service_id_t service_id, unsigned nclsts,
-    fat_cluster_t *mcl, fat_cluster_t *lcl)
-{
-	fat_cluster_t *lifo;    /* stack for storing free cluster numbers */
-	unsigned found = 0;     /* top of the free cluster number stack */
-	fat_cluster_t clst;
-	fat_cluster_t value = 0;
-	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc = EOK;
-
-	lifo = (fat_cluster_t *) malloc(nclsts * sizeof(fat_cluster_t));
-	if (!lifo)
-		return ENOMEM;
-
-	/*
-	 * Search FAT1 for unused clusters.
-	 */
-	fibril_mutex_lock(&fat_alloc_lock);
-	for (clst = FAT_CLST_FIRST; clst < CC(bs) + 2 && found < nclsts;
-	    clst++) {
-		rc = fat_get_cluster(bs, service_id, FAT1, clst, &value);
-		if (rc != EOK)
-			break;
-
-		if (value == FAT_CLST_RES0) {
-			/*
-			 * The cluster is free. Put it into our stack
-			 * of found clusters and mark it as non-free.
-			 */
-			lifo[found] = clst;
-			rc = fat_set_cluster(bs, service_id, FAT1, clst,
-			    (found == 0) ?  clst_last1 : lifo[found - 1]);
-			if (rc != EOK)
-				break;
-
-			found++;
-		}
-	}
-
-	if (rc == EOK && found == nclsts) {
-		rc = fat_alloc_shadow_clusters(bs, service_id, lifo, nclsts);
-		if (rc == EOK) {
-			*mcl = lifo[found - 1];
-			*lcl = lifo[0];
-			free(lifo);
-			fibril_mutex_unlock(&fat_alloc_lock);
-			return EOK;
-		}
-	}
-
-	/* If something wrong - free the clusters */
-	while (found--) {
-		(void) fat_set_cluster(bs, service_id, FAT1, lifo[found],
-		    FAT_CLST_RES0);
-	}
-
-	free(lifo);
-	fibril_mutex_unlock(&fat_alloc_lock);
-
-	return ENOSPC;
-}
-
-/** Free clusters forming a cluster chain in all copies of FAT.
- *
- * @param bs		Buffer hodling the boot sector of the file system.
- * @param service_id	Device service ID of the file system.
- * @param firstc	First cluster in the chain which is to be freed.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-fat_free_clusters(fat_bs_t *bs, service_id_t service_id, fat_cluster_t firstc)
-{
-	unsigned fatno;
-	fat_cluster_t nextc = 0;
-	fat_cluster_t clst_bad = FAT_CLST_BAD(bs);
-	errno_t rc;
-
-	/* Mark all clusters in the chain as free in all copies of FAT. */
-	while (firstc < FAT_CLST_LAST1(bs)) {
-		assert(firstc >= FAT_CLST_FIRST && firstc < clst_bad);
-
-		rc = fat_get_cluster(bs, service_id, FAT1, firstc, &nextc);
-		if (rc != EOK)
-			return rc;
-
-		for (fatno = FAT1; fatno < FATCNT(bs); fatno++) {
-			rc = fat_set_cluster(bs, service_id, fatno, firstc,
-			    FAT_CLST_RES0);
-			if (rc != EOK)
-				return rc;
-		}
-
-		firstc = nextc;
-	}
-
-	return EOK;
-}
-
-/** Append a cluster chain to the last file cluster in all FATs.
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		Node representing the file.
- * @param mcl		First cluster of the cluster chain to append.
- * @param lcl		Last cluster of the cluster chain to append.
- *
- * @return		EOK on success or an error code.
- */
-errno_t fat_append_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t mcl,
-    fat_cluster_t lcl)
-{
-	service_id_t service_id = nodep->idx->service_id;
-	fat_cluster_t lastc = 0;
-	uint8_t fatno;
-	errno_t rc;
-
-	if (nodep->firstc == FAT_CLST_RES0) {
-		/* No clusters allocated to the node yet. */
-		nodep->firstc = mcl;
-		nodep->dirty = true;	/* need to sync node */
-	} else {
-		if (nodep->lastc_cached_valid) {
-			lastc = nodep->lastc_cached_value;
-			nodep->lastc_cached_valid = false;
-		} else {
-			rc = fat_cluster_walk(bs, service_id, nodep->firstc,
-			    &lastc, NULL, (uint32_t) -1);
-			if (rc != EOK)
-				return rc;
-		}
-
-		for (fatno = FAT1; fatno < FATCNT(bs); fatno++) {
-			rc = fat_set_cluster(bs, nodep->idx->service_id,
-			    fatno, lastc, mcl);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	nodep->lastc_cached_valid = true;
-	nodep->lastc_cached_value = lcl;
-
-	return EOK;
-}
-
-/** Chop off node clusters in all copies of FAT.
- *
- * @param bs		Buffer holding the boot sector of the file system.
- * @param nodep		FAT node where the chopping will take place.
- * @param lcl		Last cluster which will remain in the node. If this
- *			argument is FAT_CLST_RES0, then all clusters will
- *			be chopped off.
- *
- * @return		EOK on success or an error code.
- */
-errno_t fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lcl)
-{
-	fat_cluster_t clst_last1 = FAT_CLST_LAST1(bs);
-	errno_t rc;
-	service_id_t service_id = nodep->idx->service_id;
-
-	/*
-	 * Invalidate cached cluster numbers.
-	 */
-	nodep->lastc_cached_valid = false;
-	if (nodep->currc_cached_value != lcl)
-		nodep->currc_cached_valid = false;
-
-	if (lcl == FAT_CLST_RES0) {
-		/* The node will have zero size and no clusters allocated. */
-		rc = fat_free_clusters(bs, service_id, nodep->firstc);
-		if (rc != EOK)
-			return rc;
-		nodep->firstc = FAT_CLST_RES0;
-		nodep->dirty = true;		/* need to sync node */
-	} else {
-		fat_cluster_t nextc;
-		unsigned fatno;
-
-		rc = fat_get_cluster(bs, service_id, FAT1, lcl, &nextc);
-		if (rc != EOK)
-			return rc;
-
-		/* Terminate the cluster chain in all copies of FAT. */
-		for (fatno = FAT1; fatno < FATCNT(bs); fatno++) {
-			rc = fat_set_cluster(bs, service_id, fatno, lcl,
-			    clst_last1);
-			if (rc != EOK)
-				return rc;
-		}
-
-		/* Free all following clusters. */
-		rc = fat_free_clusters(bs, service_id, nextc);
-		if (rc != EOK)
-			return rc;
-	}
-
-	/*
-	 * Update and re-enable the last cluster cache.
-	 */
-	nodep->lastc_cached_valid = true;
-	nodep->lastc_cached_value = lcl;
-
-	return EOK;
-}
-
-errno_t
-fat_zero_cluster(struct fat_bs *bs, service_id_t service_id, fat_cluster_t c)
-{
-	int i;
-	block_t *b;
-	errno_t rc;
-
-	for (i = 0; i < SPC(bs); i++) {
-		rc = _fat_block_get(&b, bs, service_id, c, NULL, i,
-		    BLOCK_FLAGS_NOREAD);
-		if (rc != EOK)
-			return rc;
-		memset(b->data, 0, BPS(bs));
-		b->dirty = true;
-		rc = block_put(b);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Perform basic sanity checks on the file system.
- *
- * Verify if values of boot sector fields are sane. Also verify media
- * descriptor. This is used to rule out cases when a device obviously
- * does not contain a fat file system.
- */
-errno_t fat_sanity_check(fat_bs_t *bs, service_id_t service_id)
-{
-	fat_cluster_t e0 = 0;
-	fat_cluster_t e1 = 0;
-	unsigned fat_no;
-	errno_t rc;
-
-	/* Check number of FATs. */
-	if (FATCNT(bs) == 0)
-		return ENOTSUP;
-
-	/* Check total number of sectors. */
-	if (TS(bs) == 0)
-		return ENOTSUP;
-
-	if (bs->totsec16 != 0 && bs->totsec32 != 0 &&
-	    bs->totsec16 != bs->totsec32)
-		return ENOTSUP;
-
-	/* Check media descriptor. Must be between 0xf0 and 0xff. */
-	if ((bs->mdesc & 0xf0) != 0xf0)
-		return ENOTSUP;
-
-	/* Check number of sectors per FAT. */
-	if (SF(bs) == 0)
-		return ENOTSUP;
-
-	/*
-	 * Check that the root directory entries take up whole blocks.
-	 * This check is rather strict, but it allows us to treat the root
-	 * directory and non-root directories uniformly in some places.
-	 * It can be removed provided that functions such as fat_read() are
-	 * sanitized to support file systems with this property.
-	 */
-	if (!FAT_IS_FAT32(bs) &&
-	    (RDE(bs) * sizeof(fat_dentry_t)) % BPS(bs) != 0)
-		return ENOTSUP;
-
-	/* Check signature of each FAT. */
-	for (fat_no = 0; fat_no < FATCNT(bs); fat_no++) {
-		rc = fat_get_cluster(bs, service_id, fat_no, 0, &e0);
-		if (rc != EOK)
-			return EIO;
-
-		rc = fat_get_cluster(bs, service_id, fat_no, 1, &e1);
-		if (rc != EOK)
-			return EIO;
-
-		/*
-		 * Check that first byte of FAT contains the media descriptor.
-		 */
-		if ((e0 & 0xff) != bs->mdesc)
-			return ENOTSUP;
-
-		/*
-		 * Check that remaining bits of the first two entries are
-		 * set to one.
-		 */
-		if (!FAT_IS_FAT12(bs) &&
-		    ((e0 >> 8) != ((fat_cluster_t) FAT_MASK(bs) >> 8) || e1 != FAT_MASK(bs)))
-			return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_fat.h
===================================================================
--- uspace/srv/fs/fat/fat_fat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-#ifndef FAT_FAT_FAT_H_
-#define FAT_FAT_FAT_H_
-
-#include "../../vfs/vfs.h"
-#include <stdint.h>
-#include <block.h>
-
-#define FAT1		0
-
-#define FAT_CLST_RES0	  0
-#define FAT_CLST_RES1	  1
-#define FAT_CLST_FIRST	  2
-
-#define FAT32_CLST_BAD    0x0ffffff7
-#define FAT32_CLST_LAST1  0x0ffffff8
-#define FAT32_CLST_LAST8  0x0fffffff
-
-#define FAT12_MASK        0x0fff
-#define FAT16_MASK        0xffff
-#define FAT32_MASK        0x0fffffff
-
-#define FAT12_CLST_MAX    4085
-#define FAT16_CLST_MAX    65525
-
-/* Size in bytes for cluster value of FAT */
-#define FAT12_CLST_SIZE   2
-#define FAT16_CLST_SIZE   2
-#define FAT32_CLST_SIZE   4
-
-/* internally used to mark root directory's parent */
-#define FAT_CLST_ROOTPAR	FAT_CLST_RES0
-/* internally used to mark root directory */
-#define FAT_CLST_ROOT		FAT_CLST_RES1
-
-/*
- * Convenience macros for computing some frequently used values from the
- * primitive boot sector members.
- */
-#define RDS(bs)	  ((sizeof(fat_dentry_t) * RDE((bs))) / BPS((bs))) + \
-		   (((sizeof(fat_dentry_t) * RDE((bs))) % BPS((bs))) != 0)
-#define SSA(bs)	  (RSCNT((bs)) + FATCNT((bs)) * SF((bs)) + RDS(bs))
-#define DS(bs)	  (TS(bs) - SSA(bs))
-#define CC(bs)	  (DS(bs) / SPC(bs))
-
-#define CLBN2PBN(bs, cl, bn) \
-	(SSA((bs)) + ((cl) - FAT_CLST_FIRST) * SPC((bs)) + (bn) % SPC((bs)))
-
-#define FAT_IS_FAT12(bs)	(CC(bs) < FAT12_CLST_MAX)
-#define FAT_IS_FAT16(bs) \
-    ((CC(bs) >= FAT12_CLST_MAX) && (CC(bs) < FAT16_CLST_MAX))
-#define FAT_IS_FAT32(bs)	(CC(bs) >= FAT16_CLST_MAX)
-
-#define FAT_CLST_SIZE(bs) \
-    (FAT_IS_FAT32(bs) ? FAT32_CLST_SIZE : FAT16_CLST_SIZE)
-
-#define FAT_MASK(bs) \
-    (FAT_IS_FAT12(bs) ? FAT12_MASK : \
-    (FAT_IS_FAT32(bs) ? FAT32_MASK : FAT16_MASK))
-
-#define FAT_CLST_LAST1(bs)      (FAT32_CLST_LAST1 & FAT_MASK((bs)))
-#define FAT_CLST_LAST8(bs)      (FAT32_CLST_LAST8 & FAT_MASK((bs)))
-#define FAT_CLST_BAD(bs)        (FAT32_CLST_BAD & FAT_MASK((bs)))
-
-#define FAT_ROOT_CLST(bs) \
-    (FAT_IS_FAT32(bs) ? uint32_t_le2host(bs->fat32.root_cluster) : \
-    FAT_CLST_ROOT)
-
-/* forward declarations */
-struct block;
-struct fat_node;
-struct fat_bs;
-
-typedef uint32_t fat_cluster_t;
-
-#define fat_clusters_get(numc, bs, sid, fc) \
-    fat_cluster_walk((bs), (sid), (fc), NULL, (numc), (uint32_t) -1)
-extern errno_t fat_cluster_walk(struct fat_bs *, service_id_t, fat_cluster_t,
-    fat_cluster_t *, uint32_t *, uint32_t);
-
-extern errno_t fat_block_get(block_t **, struct fat_bs *, struct fat_node *,
-    aoff64_t, int);
-extern errno_t _fat_block_get(block_t **, struct fat_bs *, service_id_t,
-    fat_cluster_t, fat_cluster_t *, aoff64_t, int);
-
-extern errno_t fat_append_clusters(struct fat_bs *, struct fat_node *,
-    fat_cluster_t, fat_cluster_t);
-extern errno_t fat_chop_clusters(struct fat_bs *, struct fat_node *,
-    fat_cluster_t);
-extern errno_t fat_alloc_clusters(struct fat_bs *, service_id_t, unsigned,
-    fat_cluster_t *, fat_cluster_t *);
-extern errno_t fat_free_clusters(struct fat_bs *, service_id_t, fat_cluster_t);
-extern errno_t fat_alloc_shadow_clusters(struct fat_bs *, service_id_t,
-    fat_cluster_t *, unsigned);
-extern errno_t fat_get_cluster(struct fat_bs *, service_id_t, unsigned,
-    fat_cluster_t, fat_cluster_t *);
-extern errno_t fat_set_cluster(struct fat_bs *, service_id_t, unsigned,
-    fat_cluster_t, fat_cluster_t);
-extern errno_t fat_fill_gap(struct fat_bs *, struct fat_node *, fat_cluster_t,
-    aoff64_t);
-extern errno_t fat_zero_cluster(struct fat_bs *, service_id_t, fat_cluster_t);
-extern errno_t fat_sanity_check(struct fat_bs *, service_id_t);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,563 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat_idx.c
- * @brief	Layer for translating FAT entities to VFS node indices.
- */
-
-#include "fat.h"
-#include <errno.h>
-#include <str.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-
-/** Each instance of this type describes one interval of freed VFS indices. */
-typedef struct {
-	link_t		link;
-	fs_index_t	first;
-	fs_index_t	last;
-} freed_t;
-
-/**
- * Each instance of this type describes state of all VFS indices that
- * are currently unused.
- */
-typedef struct {
-	link_t link;
-	service_id_t service_id;
-
-	/** Next unassigned index. */
-	fs_index_t next;
-	/** Number of remaining unassigned indices. */
-	uint64_t remaining;
-
-	/** Sorted list of intervals of freed indices. */
-	list_t freed_list;
-} unused_t;
-
-/** Mutex protecting the list of unused structures. */
-static FIBRIL_MUTEX_INITIALIZE(unused_lock);
-
-/** List of unused structures. */
-static LIST_INITIALIZE(unused_list);
-
-static void unused_initialize(unused_t *u, service_id_t service_id)
-{
-	link_initialize(&u->link);
-	u->service_id = service_id;
-	u->next = 0;
-	u->remaining = ((uint64_t)((fs_index_t)-1)) + 1;
-	list_initialize(&u->freed_list);
-}
-
-static unused_t *unused_find(service_id_t service_id, bool lock)
-{
-	if (lock)
-		fibril_mutex_lock(&unused_lock);
-
-	list_foreach(unused_list, link, unused_t, u) {
-		if (u->service_id == service_id)
-			return u;
-	}
-
-	if (lock)
-		fibril_mutex_unlock(&unused_lock);
-	return NULL;
-}
-
-/** Mutex protecting the up_hash and ui_hash. */
-static FIBRIL_MUTEX_INITIALIZE(used_lock);
-
-/**
- * Global hash table of all used fat_idx_t structures.
- * The index structures are hashed by the service_id, parent node's first
- * cluster and index within the parent directory.
- */
-static hash_table_t up_hash;
-
-typedef struct {
-	service_id_t service_id;
-	fat_cluster_t pfc;
-	unsigned pdi;
-} pos_key_t;
-
-static inline size_t pos_key_hash(const void *key)
-{
-	const pos_key_t *pos = key;
-
-	size_t hash = 0;
-	hash = hash_combine(pos->pfc, pos->pdi);
-	return hash_combine(hash, pos->service_id);
-}
-
-static size_t pos_hash(const ht_link_t *item)
-{
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
-
-	pos_key_t pkey = {
-		.service_id = fidx->service_id,
-		.pfc = fidx->pfc,
-		.pdi = fidx->pdi,
-	};
-
-	return pos_key_hash(&pkey);
-}
-
-static bool pos_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const pos_key_t *pos = key;
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
-
-	return pos->service_id == fidx->service_id &&
-	    pos->pdi == fidx->pdi &&
-	    pos->pfc == fidx->pfc;
-}
-
-static const hash_table_ops_t uph_ops = {
-	.hash = pos_hash,
-	.key_hash = pos_key_hash,
-	.key_equal = pos_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL,
-};
-
-/**
- * Global hash table of all used fat_idx_t structures.
- * The index structures are hashed by the service_id and index.
- */
-static hash_table_t ui_hash;
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} idx_key_t;
-
-static size_t idx_key_hash(const void *key_arg)
-{
-	const idx_key_t *key = key_arg;
-	return hash_combine(key->service_id, key->index);
-}
-
-static size_t idx_hash(const ht_link_t *item)
-{
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
-	return hash_combine(fidx->service_id, fidx->index);
-}
-
-static bool idx_key_equal(const void *key_arg, size_t hash,
-    const ht_link_t *item)
-{
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
-	const idx_key_t *key = key_arg;
-
-	return key->index == fidx->index && key->service_id == fidx->service_id;
-}
-
-static void idx_remove_callback(ht_link_t *item)
-{
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
-
-	free(fidx);
-}
-
-static const hash_table_ops_t uih_ops = {
-	.hash = idx_hash,
-	.key_hash = idx_key_hash,
-	.key_equal = idx_key_equal,
-	.equal = NULL,
-	.remove_callback = idx_remove_callback,
-};
-
-/** Allocate a VFS index which is not currently in use. */
-static bool fat_index_alloc(service_id_t service_id, fs_index_t *index)
-{
-	unused_t *u;
-
-	assert(index);
-	u = unused_find(service_id, true);
-	if (!u)
-		return false;
-
-	if (list_empty(&u->freed_list)) {
-		if (u->remaining) {
-			/*
-			 * There are no freed indices, allocate one directly
-			 * from the counter.
-			 */
-			*index = u->next++;
-			--u->remaining;
-			fibril_mutex_unlock(&unused_lock);
-			return true;
-		}
-	} else {
-		/* There are some freed indices which we can reuse. */
-		freed_t *f = list_get_instance(list_first(&u->freed_list),
-		    freed_t, link);
-		*index = f->first;
-		if (f->first++ == f->last) {
-			/* Destroy the interval. */
-			list_remove(&f->link);
-			free(f);
-		}
-		fibril_mutex_unlock(&unused_lock);
-		return true;
-	}
-	/*
-	 * We ran out of indices, which is extremely unlikely with FAT16, but
-	 * theoretically still possible (e.g. too many open unlinked nodes or
-	 * too many zero-sized nodes).
-	 */
-	fibril_mutex_unlock(&unused_lock);
-	return false;
-}
-
-/** If possible, coalesce two intervals of freed indices. */
-static void try_coalesce_intervals(link_t *l, link_t *r, link_t *cur)
-{
-	freed_t *fl = list_get_instance(l, freed_t, link);
-	freed_t *fr = list_get_instance(r, freed_t, link);
-
-	if (fl->last + 1 == fr->first) {
-		if (cur == l) {
-			fl->last = fr->last;
-			list_remove(r);
-			free(r);
-		} else {
-			fr->first = fl->first;
-			list_remove(l);
-			free(l);
-		}
-	}
-}
-
-/** Free a VFS index, which is no longer in use. */
-static void fat_index_free(service_id_t service_id, fs_index_t index)
-{
-	unused_t *u;
-
-	u = unused_find(service_id, true);
-	assert(u);
-
-	if (u->next == index + 1) {
-		/* The index can be returned directly to the counter. */
-		u->next--;
-		u->remaining++;
-	} else {
-		/*
-		 * The index must be returned either to an existing freed
-		 * interval or a new interval must be created.
-		 */
-		link_t *lnk;
-		freed_t *n;
-		for (lnk = u->freed_list.head.next; lnk != &u->freed_list.head;
-		    lnk = lnk->next) {
-			freed_t *f = list_get_instance(lnk, freed_t, link);
-			if (f->first == index + 1) {
-				f->first--;
-				if (lnk->prev != &u->freed_list.head)
-					try_coalesce_intervals(lnk->prev, lnk,
-					    lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-			if (f->last == index - 1) {
-				f->last++;
-				if (lnk->next != &u->freed_list.head)
-					try_coalesce_intervals(lnk, lnk->next,
-					    lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-			if (index > f->first) {
-				n = malloc(sizeof(freed_t));
-				/* TODO: sleep until allocation succeeds */
-				assert(n);
-				link_initialize(&n->link);
-				n->first = index;
-				n->last = index;
-				list_insert_before(&n->link, lnk);
-				fibril_mutex_unlock(&unused_lock);
-				return;
-			}
-
-		}
-		/* The index will form the last interval. */
-		n = malloc(sizeof(freed_t));
-		/* TODO: sleep until allocation succeeds */
-		assert(n);
-		link_initialize(&n->link);
-		n->first = index;
-		n->last = index;
-		list_append(&n->link, &u->freed_list);
-	}
-	fibril_mutex_unlock(&unused_lock);
-}
-
-static errno_t fat_idx_create(fat_idx_t **fidxp, service_id_t service_id)
-{
-	fat_idx_t *fidx;
-
-	fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t));
-	if (!fidx)
-		return ENOMEM;
-	if (!fat_index_alloc(service_id, &fidx->index)) {
-		free(fidx);
-		return ENOSPC;
-	}
-
-	fibril_mutex_initialize(&fidx->lock);
-	fidx->service_id = service_id;
-	fidx->pfc = FAT_CLST_RES0;	/* no parent yet */
-	fidx->pdi = 0;
-	fidx->nodep = NULL;
-
-	*fidxp = fidx;
-	return EOK;
-}
-
-errno_t fat_idx_get_new(fat_idx_t **fidxp, service_id_t service_id)
-{
-	fat_idx_t *fidx;
-	errno_t rc;
-
-	fibril_mutex_lock(&used_lock);
-	rc = fat_idx_create(&fidx, service_id);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&used_lock);
-		return rc;
-	}
-
-	hash_table_insert(&ui_hash, &fidx->uih_link);
-	fibril_mutex_lock(&fidx->lock);
-	fibril_mutex_unlock(&used_lock);
-
-	*fidxp = fidx;
-	return EOK;
-}
-
-fat_idx_t *
-fat_idx_get_by_pos(service_id_t service_id, fat_cluster_t pfc, unsigned pdi)
-{
-	fat_idx_t *fidx;
-
-	pos_key_t pos_key = {
-		.service_id = service_id,
-		.pfc = pfc,
-		.pdi = pdi,
-	};
-
-	fibril_mutex_lock(&used_lock);
-	ht_link_t *l = hash_table_find(&up_hash, &pos_key);
-	if (l) {
-		fidx = hash_table_get_inst(l, fat_idx_t, uph_link);
-	} else {
-		errno_t rc;
-
-		rc = fat_idx_create(&fidx, service_id);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&used_lock);
-			return NULL;
-		}
-
-		fidx->pfc = pfc;
-		fidx->pdi = pdi;
-
-		hash_table_insert(&up_hash, &fidx->uph_link);
-		hash_table_insert(&ui_hash, &fidx->uih_link);
-	}
-	fibril_mutex_lock(&fidx->lock);
-	fibril_mutex_unlock(&used_lock);
-
-	return fidx;
-}
-
-void fat_idx_hashin(fat_idx_t *idx)
-{
-	fibril_mutex_lock(&used_lock);
-	hash_table_insert(&up_hash, &idx->uph_link);
-	fibril_mutex_unlock(&used_lock);
-}
-
-void fat_idx_hashout(fat_idx_t *idx)
-{
-	fibril_mutex_lock(&used_lock);
-	hash_table_remove_item(&up_hash, &idx->uph_link);
-	fibril_mutex_unlock(&used_lock);
-}
-
-fat_idx_t *
-fat_idx_get_by_index(service_id_t service_id, fs_index_t index)
-{
-	fat_idx_t *fidx = NULL;
-
-	idx_key_t idx_key = {
-		.service_id = service_id,
-		.index = index,
-	};
-
-	fibril_mutex_lock(&used_lock);
-	ht_link_t *l = hash_table_find(&ui_hash, &idx_key);
-	if (l) {
-		fidx = hash_table_get_inst(l, fat_idx_t, uih_link);
-		fibril_mutex_lock(&fidx->lock);
-	}
-	fibril_mutex_unlock(&used_lock);
-
-	return fidx;
-}
-
-/** Destroy the index structure.
- *
- * @param idx		The index structure to be destroyed.
- */
-void fat_idx_destroy(fat_idx_t *idx)
-{
-	idx_key_t idx_key = {
-		.service_id = idx->service_id,
-		.index = idx->index,
-	};
-
-	assert(idx->pfc == FAT_CLST_RES0);
-
-	fibril_mutex_lock(&used_lock);
-	/*
-	 * Since we can only free unlinked nodes, the index structure is not
-	 * present in the position hash (uph). We therefore hash it out from
-	 * the index hash only.
-	 */
-	hash_table_remove(&ui_hash, &idx_key);
-	fibril_mutex_unlock(&used_lock);
-	/* Release the VFS index. */
-	fat_index_free(idx_key.service_id, idx_key.index);
-	/* The index structure itself is freed in idx_remove_callback(). */
-}
-
-errno_t fat_idx_init(void)
-{
-	if (!hash_table_create(&up_hash, 0, 0, &uph_ops))
-		return ENOMEM;
-	if (!hash_table_create(&ui_hash, 0, 0, &uih_ops)) {
-		hash_table_destroy(&up_hash);
-		return ENOMEM;
-	}
-	return EOK;
-}
-
-void fat_idx_fini(void)
-{
-	/* We assume the hash tables are empty. */
-	assert(hash_table_empty(&up_hash) && hash_table_empty(&ui_hash));
-	hash_table_destroy(&up_hash);
-	hash_table_destroy(&ui_hash);
-}
-
-errno_t fat_idx_init_by_service_id(service_id_t service_id)
-{
-	unused_t *u;
-	errno_t rc = EOK;
-
-	u = (unused_t *) malloc(sizeof(unused_t));
-	if (!u)
-		return ENOMEM;
-	unused_initialize(u, service_id);
-	fibril_mutex_lock(&unused_lock);
-	if (!unused_find(service_id, false)) {
-		list_append(&u->link, &unused_list);
-	} else {
-		free(u);
-		rc = EEXIST;
-	}
-	fibril_mutex_unlock(&unused_lock);
-	return rc;
-}
-
-static bool rm_pos_service_id(ht_link_t *item, void *arg)
-{
-	service_id_t service_id = *(service_id_t *)arg;
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uph_link);
-
-	if (fidx->service_id == service_id) {
-		hash_table_remove_item(&up_hash, item);
-	}
-
-	return true;
-}
-
-static bool rm_idx_service_id(ht_link_t *item, void *arg)
-{
-	service_id_t service_id = *(service_id_t *)arg;
-	fat_idx_t *fidx = hash_table_get_inst(item, fat_idx_t, uih_link);
-
-	if (fidx->service_id == service_id) {
-		hash_table_remove_item(&ui_hash, item);
-	}
-
-	return true;
-}
-
-void fat_idx_fini_by_service_id(service_id_t service_id)
-{
-	/*
-	 * Remove this instance's index structure from up_hash and ui_hash.
-	 * Process up_hash first and ui_hash second because the index structure
-	 * is actually removed in idx_remove_callback().
-	 */
-	fibril_mutex_lock(&used_lock);
-	hash_table_apply(&up_hash, rm_pos_service_id, &service_id);
-	hash_table_apply(&ui_hash, rm_idx_service_id, &service_id);
-	fibril_mutex_unlock(&used_lock);
-
-	/*
-	 * Free the unused and freed structures for this instance.
-	 */
-	unused_t *u = unused_find(service_id, true);
-	assert(u);
-	list_remove(&u->link);
-	fibril_mutex_unlock(&unused_lock);
-
-	while (!list_empty(&u->freed_list)) {
-		freed_t *f;
-		f = list_get_instance(list_first(&u->freed_list), freed_t, link);
-		list_remove(&f->link);
-		free(f);
-	}
-	free(u);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1576 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Oleg Romanenko
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup fat
- * @{
- */
-
-/**
- * @file	fat_ops.c
- * @brief	Implementation of VFS operations for the FAT file system server.
- */
-
-#include "fat.h"
-#include "fat_dentry.h"
-#include "fat_fat.h"
-#include "fat_directory.h"
-#include "../../vfs/vfs.h"
-#include <libfs.h>
-#include <block.h>
-#include <ipc/services.h>
-#include <ipc/loc.h>
-#include <macros.h>
-#include <async.h>
-#include <errno.h>
-#include <str.h>
-#include <byteorder.h>
-#include <adt/hash_table.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <align.h>
-#include <stdlib.h>
-
-#define FAT_NODE(node)	((node) ? (fat_node_t *) (node)->data : NULL)
-#define FS_NODE(node)	((node) ? (node)->bp : NULL)
-
-#define DPS(bs)		(BPS((bs)) / sizeof(fat_dentry_t))
-#define BPC(bs)		(BPS((bs)) * SPC((bs)))
-
-/** Mutex protecting the list of cached free FAT nodes. */
-static FIBRIL_MUTEX_INITIALIZE(ffn_mutex);
-
-/** List of cached free FAT nodes. */
-static LIST_INITIALIZE(ffn_list);
-
-/*
- * Forward declarations of FAT libfs operations.
- */
-static errno_t fat_root_get(fs_node_t **, service_id_t);
-static errno_t fat_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t fat_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t fat_node_open(fs_node_t *);
-static errno_t fat_node_put(fs_node_t *);
-static errno_t fat_create_node(fs_node_t **, service_id_t, int);
-static errno_t fat_destroy_node(fs_node_t *);
-static errno_t fat_link(fs_node_t *, fs_node_t *, const char *);
-static errno_t fat_unlink(fs_node_t *, fs_node_t *, const char *);
-static errno_t fat_has_children(bool *, fs_node_t *);
-static fs_index_t fat_index_get(fs_node_t *);
-static aoff64_t fat_size_get(fs_node_t *);
-static unsigned fat_lnkcnt_get(fs_node_t *);
-static bool fat_is_directory(fs_node_t *);
-static bool fat_is_file(fs_node_t *node);
-static service_id_t fat_service_get(fs_node_t *node);
-static errno_t fat_size_block(service_id_t, uint32_t *);
-static errno_t fat_total_block_count(service_id_t, uint64_t *);
-static errno_t fat_free_block_count(service_id_t, uint64_t *);
-
-/*
- * Helper functions.
- */
-static void fat_node_initialize(fat_node_t *node)
-{
-	fibril_mutex_initialize(&node->lock);
-	node->bp = NULL;
-	node->idx = NULL;
-	node->type = 0;
-	link_initialize(&node->ffn_link);
-	node->size = 0;
-	node->lnkcnt = 0;
-	node->refcnt = 0;
-	node->dirty = false;
-	node->lastc_cached_valid = false;
-	node->lastc_cached_value = 0;
-	node->currc_cached_valid = false;
-	node->currc_cached_bn = 0;
-	node->currc_cached_value = 0;
-}
-
-static errno_t fat_node_sync(fat_node_t *node)
-{
-	block_t *b;
-	fat_bs_t *bs;
-	fat_dentry_t *d;
-	errno_t rc;
-
-	assert(node->dirty);
-
-	bs = block_bb_get(node->idx->service_id);
-
-	/* Read the block that contains the dentry of interest. */
-	rc = _fat_block_get(&b, bs, node->idx->service_id, node->idx->pfc,
-	    NULL, (node->idx->pdi * sizeof(fat_dentry_t)) / BPS(bs),
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	d = ((fat_dentry_t *)b->data) + (node->idx->pdi % DPS(bs));
-
-	d->firstc = host2uint16_t_le(node->firstc);
-	if (node->type == FAT_FILE) {
-		d->size = host2uint32_t_le(node->size);
-	} else if (node->type == FAT_DIRECTORY) {
-		d->attr = FAT_ATTR_SUBDIR;
-	}
-
-	/* TODO: update other fields? (e.g time fields) */
-
-	b->dirty = true;		/* need to sync block */
-	rc = block_put(b);
-	return rc;
-}
-
-static errno_t fat_node_fini_by_service_id(service_id_t service_id)
-{
-	errno_t rc;
-
-	/*
-	 * We are called from fat_unmounted() and assume that there are already
-	 * no nodes belonging to this instance with non-zero refcount. Therefore
-	 * it is sufficient to clean up only the FAT free node list.
-	 */
-
-restart:
-	fibril_mutex_lock(&ffn_mutex);
-	list_foreach(ffn_list, ffn_link, fat_node_t, nodep) {
-		if (!fibril_mutex_trylock(&nodep->lock)) {
-			fibril_mutex_unlock(&ffn_mutex);
-			goto restart;
-		}
-		if (!fibril_mutex_trylock(&nodep->idx->lock)) {
-			fibril_mutex_unlock(&nodep->lock);
-			fibril_mutex_unlock(&ffn_mutex);
-			goto restart;
-		}
-		if (nodep->idx->service_id != service_id) {
-			fibril_mutex_unlock(&nodep->idx->lock);
-			fibril_mutex_unlock(&nodep->lock);
-			continue;
-		}
-
-		list_remove(&nodep->ffn_link);
-		fibril_mutex_unlock(&ffn_mutex);
-
-		/*
-		 * We can unlock the node and its index structure because we are
-		 * the last player on this playground and VFS is preventing new
-		 * players from entering.
-		 */
-		fibril_mutex_unlock(&nodep->idx->lock);
-		fibril_mutex_unlock(&nodep->lock);
-
-		if (nodep->dirty) {
-			rc = fat_node_sync(nodep);
-			if (rc != EOK)
-				return rc;
-		}
-		nodep->idx->nodep = NULL;
-		free(nodep->bp);
-		free(nodep);
-
-		/* Need to restart because we changed ffn_list. */
-		goto restart;
-	}
-	fibril_mutex_unlock(&ffn_mutex);
-
-	return EOK;
-}
-
-static errno_t fat_node_get_new(fat_node_t **nodepp)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	errno_t rc;
-
-	fibril_mutex_lock(&ffn_mutex);
-	if (!list_empty(&ffn_list)) {
-		/* Try to use a cached free node structure. */
-		fat_idx_t *idxp_tmp;
-		nodep = list_get_instance(list_first(&ffn_list), fat_node_t,
-		    ffn_link);
-		if (!fibril_mutex_trylock(&nodep->lock))
-			goto skip_cache;
-		idxp_tmp = nodep->idx;
-		if (!fibril_mutex_trylock(&idxp_tmp->lock)) {
-			fibril_mutex_unlock(&nodep->lock);
-			goto skip_cache;
-		}
-		list_remove(&nodep->ffn_link);
-		fibril_mutex_unlock(&ffn_mutex);
-		if (nodep->dirty) {
-			rc = fat_node_sync(nodep);
-			if (rc != EOK) {
-				idxp_tmp->nodep = NULL;
-				fibril_mutex_unlock(&nodep->lock);
-				fibril_mutex_unlock(&idxp_tmp->lock);
-				free(nodep->bp);
-				free(nodep);
-				return rc;
-			}
-		}
-		idxp_tmp->nodep = NULL;
-		fibril_mutex_unlock(&nodep->lock);
-		fibril_mutex_unlock(&idxp_tmp->lock);
-		fn = FS_NODE(nodep);
-	} else {
-	skip_cache:
-		/* Try to allocate a new node structure. */
-		fibril_mutex_unlock(&ffn_mutex);
-		fn = (fs_node_t *)malloc(sizeof(fs_node_t));
-		if (!fn)
-			return ENOMEM;
-		nodep = (fat_node_t *)malloc(sizeof(fat_node_t));
-		if (!nodep) {
-			free(fn);
-			return ENOMEM;
-		}
-	}
-	fat_node_initialize(nodep);
-	fs_node_initialize(fn);
-	fn->data = nodep;
-	nodep->bp = fn;
-
-	*nodepp = nodep;
-	return EOK;
-}
-
-/** Internal version of fat_node_get().
- *
- * @param idxp		Locked index structure.
- */
-static errno_t fat_node_get_core(fat_node_t **nodepp, fat_idx_t *idxp)
-{
-	block_t *b;
-	fat_bs_t *bs;
-	fat_dentry_t *d;
-	fat_node_t *nodep = NULL;
-	errno_t rc;
-
-	if (idxp->nodep) {
-		/*
-		 * We are lucky.
-		 * The node is already instantiated in memory.
-		 */
-		fibril_mutex_lock(&idxp->nodep->lock);
-		if (!idxp->nodep->refcnt++) {
-			fibril_mutex_lock(&ffn_mutex);
-			list_remove(&idxp->nodep->ffn_link);
-			fibril_mutex_unlock(&ffn_mutex);
-		}
-		fibril_mutex_unlock(&idxp->nodep->lock);
-		*nodepp = idxp->nodep;
-		return EOK;
-	}
-
-	/*
-	 * We must instantiate the node from the file system.
-	 */
-
-	assert(idxp->pfc);
-
-	rc = fat_node_get_new(&nodep);
-	if (rc != EOK)
-		return rc;
-
-	bs = block_bb_get(idxp->service_id);
-
-	/* Read the block that contains the dentry of interest. */
-	rc = _fat_block_get(&b, bs, idxp->service_id, idxp->pfc, NULL,
-	    (idxp->pdi * sizeof(fat_dentry_t)) / BPS(bs), BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		(void) fat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-
-	d = ((fat_dentry_t *)b->data) + (idxp->pdi % DPS(bs));
-	if (FAT_IS_FAT32(bs)) {
-		nodep->firstc = uint16_t_le2host(d->firstc_lo) |
-		    (uint16_t_le2host(d->firstc_hi) << 16);
-	} else
-		nodep->firstc = uint16_t_le2host(d->firstc);
-
-	if (d->attr & FAT_ATTR_SUBDIR) {
-		/*
-		 * The only directory which does not have this bit set is the
-		 * root directory itself. The root directory node is handled
-		 * and initialized elsewhere.
-		 */
-		nodep->type = FAT_DIRECTORY;
-
-		/*
-		 * Unfortunately, the 'size' field of the FAT dentry is not
-		 * defined for the directory entry type. We must determine the
-		 * size of the directory by walking the FAT.
-		 */
-		uint32_t clusters;
-		rc = fat_clusters_get(&clusters, bs, idxp->service_id,
-		    nodep->firstc);
-		if (rc != EOK) {
-			(void) block_put(b);
-			(void) fat_node_put(FS_NODE(nodep));
-			return rc;
-		}
-		nodep->size = BPS(bs) * SPC(bs) * clusters;
-	} else {
-		nodep->type = FAT_FILE;
-		nodep->size = uint32_t_le2host(d->size);
-	}
-
-	nodep->lnkcnt = 1;
-	nodep->refcnt = 1;
-
-	rc = block_put(b);
-	if (rc != EOK) {
-		(void) fat_node_put(FS_NODE(nodep));
-		return rc;
-	}
-
-	/* Link the idx structure with the node structure. */
-	nodep->idx = idxp;
-	idxp->nodep = nodep;
-
-	*nodepp = nodep;
-	return EOK;
-}
-
-/*
- * FAT libfs operations.
- */
-
-errno_t fat_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return fat_node_get(rfn, service_id, 0);
-}
-
-errno_t fat_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	fat_node_t *parentp = FAT_NODE(pfn);
-	char name[FAT_LFN_NAME_SIZE];
-	fat_dentry_t *d;
-	service_id_t service_id;
-	errno_t rc;
-
-	fibril_mutex_lock(&parentp->idx->lock);
-	service_id = parentp->idx->service_id;
-	fibril_mutex_unlock(&parentp->idx->lock);
-
-	fat_directory_t di;
-	rc = fat_directory_open(parentp, &di);
-	if (rc != EOK)
-		return rc;
-
-	while (fat_directory_read(&di, name, &d) == EOK) {
-		if (fat_dentry_namecmp(name, component) == 0) {
-			/* hit */
-			fat_node_t *nodep;
-			aoff64_t o = di.pos %
-			    (BPS(di.bs) / sizeof(fat_dentry_t));
-			fat_idx_t *idx = fat_idx_get_by_pos(service_id,
-			    parentp->firstc, di.bnum * DPS(di.bs) + o);
-			if (!idx) {
-				/*
-				 * Can happen if memory is low or if we
-				 * run out of 32-bit indices.
-				 */
-				rc = fat_directory_close(&di);
-				return (rc == EOK) ? ENOMEM : rc;
-			}
-			rc = fat_node_get_core(&nodep, idx);
-			fibril_mutex_unlock(&idx->lock);
-			if (rc != EOK) {
-				(void) fat_directory_close(&di);
-				return rc;
-			}
-			*rfn = FS_NODE(nodep);
-			rc = fat_directory_close(&di);
-			if (rc != EOK)
-				(void) fat_node_put(*rfn);
-			return rc;
-		} else {
-			rc = fat_directory_next(&di);
-			if (rc != EOK)
-				break;
-		}
-	}
-	(void) fat_directory_close(&di);
-	*rfn = NULL;
-	return EOK;
-}
-
-/** Instantiate a FAT in-core node. */
-errno_t fat_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
-{
-	fat_node_t *nodep;
-	fat_idx_t *idxp;
-	errno_t rc;
-
-	idxp = fat_idx_get_by_index(service_id, index);
-	if (!idxp) {
-		*rfn = NULL;
-		return EOK;
-	}
-	/* idxp->lock held */
-	rc = fat_node_get_core(&nodep, idxp);
-	fibril_mutex_unlock(&idxp->lock);
-	if (rc == EOK)
-		*rfn = FS_NODE(nodep);
-	return rc;
-}
-
-errno_t fat_node_open(fs_node_t *fn)
-{
-	/*
-	 * Opening a file is stateless, nothing
-	 * to be done here.
-	 */
-	return EOK;
-}
-
-errno_t fat_node_put(fs_node_t *fn)
-{
-	fat_node_t *nodep = FAT_NODE(fn);
-	bool destroy = false;
-
-	fibril_mutex_lock(&nodep->lock);
-	if (!--nodep->refcnt) {
-		if (nodep->idx) {
-			fibril_mutex_lock(&ffn_mutex);
-			list_append(&nodep->ffn_link, &ffn_list);
-			fibril_mutex_unlock(&ffn_mutex);
-		} else {
-			/*
-			 * The node does not have any index structure associated
-			 * with itself. This can only mean that we are releasing
-			 * the node after a failed attempt to allocate the index
-			 * structure for it.
-			 */
-			destroy = true;
-		}
-	}
-	fibril_mutex_unlock(&nodep->lock);
-	if (destroy) {
-		free(nodep->bp);
-		free(nodep);
-	}
-	return EOK;
-}
-
-errno_t fat_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	fat_idx_t *idxp;
-	fat_node_t *nodep;
-	fat_bs_t *bs;
-	fat_cluster_t mcl, lcl;
-	errno_t rc;
-
-	bs = block_bb_get(service_id);
-	if (flags & L_DIRECTORY) {
-		/* allocate a cluster */
-		rc = fat_alloc_clusters(bs, service_id, 1, &mcl, &lcl);
-		if (rc != EOK)
-			return rc;
-		/* populate the new cluster with unused dentries */
-		rc = fat_zero_cluster(bs, service_id, mcl);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = fat_node_get_new(&nodep);
-	if (rc != EOK)
-		goto error;
-	rc = fat_idx_get_new(&idxp, service_id);
-	if (rc != EOK) {
-		(void) fat_node_put(FS_NODE(nodep));
-		goto error;
-	}
-	/* idxp->lock held */
-	if (flags & L_DIRECTORY) {
-		nodep->type = FAT_DIRECTORY;
-		nodep->firstc = mcl;
-		nodep->size = BPS(bs) * SPC(bs);
-	} else {
-		nodep->type = FAT_FILE;
-		nodep->firstc = FAT_CLST_RES0;
-		nodep->size = 0;
-	}
-	nodep->lnkcnt = 0;	/* not linked anywhere */
-	nodep->refcnt = 1;
-	nodep->dirty = true;
-
-	nodep->idx = idxp;
-	idxp->nodep = nodep;
-
-	fibril_mutex_unlock(&idxp->lock);
-	*rfn = FS_NODE(nodep);
-	return EOK;
-
-error:
-	if (flags & L_DIRECTORY)
-		(void) fat_free_clusters(bs, service_id, mcl);
-	return rc;
-}
-
-errno_t fat_destroy_node(fs_node_t *fn)
-{
-	fat_node_t *nodep = FAT_NODE(fn);
-	fat_bs_t *bs;
-	bool has_children;
-	errno_t rc;
-
-	/*
-	 * The node is not reachable from the file system. This means that the
-	 * link count should be zero and that the index structure cannot be
-	 * found in the position hash. Obviously, we don't need to lock the node
-	 * nor its index structure.
-	 */
-	assert(nodep->lnkcnt == 0);
-
-	/*
-	 * The node may not have any children.
-	 */
-	rc = fat_has_children(&has_children, fn);
-	if (rc != EOK)
-		return rc;
-	assert(!has_children);
-
-	bs = block_bb_get(nodep->idx->service_id);
-	if (nodep->firstc != FAT_CLST_RES0) {
-		assert(nodep->size);
-		/* Free all clusters allocated to the node. */
-		rc = fat_free_clusters(bs, nodep->idx->service_id,
-		    nodep->firstc);
-	}
-
-	fat_idx_destroy(nodep->idx);
-	free(nodep->bp);
-	free(nodep);
-	return rc;
-}
-
-errno_t fat_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	fat_node_t *parentp = FAT_NODE(pfn);
-	fat_node_t *childp = FAT_NODE(cfn);
-	fat_dentry_t *d;
-	fat_bs_t *bs;
-	block_t *b;
-	fat_directory_t di;
-	fat_dentry_t de;
-	errno_t rc;
-
-	fibril_mutex_lock(&childp->lock);
-	if (childp->lnkcnt == 1) {
-		/*
-		 * On FAT, we don't support multiple hard links.
-		 */
-		fibril_mutex_unlock(&childp->lock);
-		return EMLINK;
-	}
-	assert(childp->lnkcnt == 0);
-	fibril_mutex_unlock(&childp->lock);
-
-	if (!fat_valid_name(name))
-		return ENOTSUP;
-
-	fibril_mutex_lock(&parentp->idx->lock);
-	bs = block_bb_get(parentp->idx->service_id);
-	rc = fat_directory_open(parentp, &di);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&parentp->idx->lock);
-		return rc;
-	}
-
-	/*
-	 * At this point we only establish the link between the parent and the
-	 * child.  The dentry, except of the name and the extension, will remain
-	 * uninitialized until the corresponding node is synced. Thus the valid
-	 * dentry data is kept in the child node structure.
-	 */
-	memset(&de, 0, sizeof(fat_dentry_t));
-
-	rc = fat_directory_write(&di, name, &de);
-	if (rc != EOK) {
-		(void) fat_directory_close(&di);
-		fibril_mutex_unlock(&parentp->idx->lock);
-		return rc;
-	}
-	rc = fat_directory_close(&di);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&parentp->idx->lock);
-		return rc;
-	}
-
-	fibril_mutex_unlock(&parentp->idx->lock);
-
-	fibril_mutex_lock(&childp->idx->lock);
-
-	if (childp->type == FAT_DIRECTORY) {
-		/*
-		 * If possible, create the Sub-directory Identifier Entry and
-		 * the Sub-directory Parent Pointer Entry (i.e. "." and "..").
-		 * These entries are not mandatory according to Standard
-		 * ECMA-107 and HelenOS VFS does not use them anyway, so this is
-		 * rather a sign of our good will.
-		 */
-		rc = fat_block_get(&b, bs, childp, 0, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			/*
-			 * Rather than returning an error, simply skip the
-			 * creation of these two entries.
-			 */
-			goto skip_dots;
-		}
-		d = (fat_dentry_t *) b->data;
-		if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) ||
-		    (memcmp(d->name, FAT_NAME_DOT, FAT_NAME_LEN)) == 0) {
-			memset(d, 0, sizeof(fat_dentry_t));
-			memcpy(d->name, FAT_NAME_DOT, FAT_NAME_LEN);
-			memcpy(d->ext, FAT_EXT_PAD, FAT_EXT_LEN);
-			d->attr = FAT_ATTR_SUBDIR;
-			d->firstc = host2uint16_t_le(childp->firstc);
-			/* TODO: initialize also the date/time members. */
-		}
-		d++;
-		if ((fat_classify_dentry(d) == FAT_DENTRY_LAST) ||
-		    (memcmp(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN) == 0)) {
-			memset(d, 0, sizeof(fat_dentry_t));
-			memcpy(d->name, FAT_NAME_DOT_DOT, FAT_NAME_LEN);
-			memcpy(d->ext, FAT_EXT_PAD, FAT_EXT_LEN);
-			d->attr = FAT_ATTR_SUBDIR;
-			d->firstc = (parentp->firstc == FAT_ROOT_CLST(bs)) ?
-			    host2uint16_t_le(FAT_CLST_ROOTPAR) :
-			    host2uint16_t_le(parentp->firstc);
-			/* TODO: initialize also the date/time members. */
-		}
-		b->dirty = true;		/* need to sync block */
-		/*
-		 * Ignore the return value as we would have fallen through on error
-		 * anyway.
-		 */
-		(void) block_put(b);
-	}
-skip_dots:
-
-	childp->idx->pfc = parentp->firstc;
-	childp->idx->pdi = di.pos;	/* di.pos holds absolute position of SFN entry */
-	fibril_mutex_unlock(&childp->idx->lock);
-
-	fibril_mutex_lock(&childp->lock);
-	childp->lnkcnt = 1;
-	childp->dirty = true;		/* need to sync node */
-	fibril_mutex_unlock(&childp->lock);
-
-	/*
-	 * Hash in the index structure into the position hash.
-	 */
-	fat_idx_hashin(childp->idx);
-
-	return EOK;
-}
-
-errno_t fat_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	fat_node_t *parentp = FAT_NODE(pfn);
-	fat_node_t *childp = FAT_NODE(cfn);
-	bool has_children;
-	errno_t rc;
-
-	if (!parentp)
-		return EBUSY;
-
-	rc = fat_has_children(&has_children, cfn);
-	if (rc != EOK)
-		return rc;
-	if (has_children)
-		return ENOTEMPTY;
-
-	fibril_mutex_lock(&parentp->lock);
-	fibril_mutex_lock(&childp->lock);
-	assert(childp->lnkcnt == 1);
-	fibril_mutex_lock(&childp->idx->lock);
-
-	fat_directory_t di;
-	rc = fat_directory_open(parentp, &di);
-	if (rc != EOK)
-		goto error;
-	rc = fat_directory_seek(&di, childp->idx->pdi);
-	if (rc != EOK)
-		goto error;
-	rc = fat_directory_erase(&di);
-	if (rc != EOK)
-		goto error;
-	rc = fat_directory_close(&di);
-	if (rc != EOK)
-		goto error;
-
-	/* remove the index structure from the position hash */
-	fat_idx_hashout(childp->idx);
-	/* clear position information */
-	childp->idx->pfc = FAT_CLST_RES0;
-	childp->idx->pdi = 0;
-	fibril_mutex_unlock(&childp->idx->lock);
-	childp->lnkcnt = 0;
-	childp->refcnt++;	/* keep the node in memory until destroyed */
-	childp->dirty = true;
-	fibril_mutex_unlock(&childp->lock);
-	fibril_mutex_unlock(&parentp->lock);
-
-	return EOK;
-
-error:
-	(void) fat_directory_close(&di);
-	fibril_mutex_unlock(&childp->idx->lock);
-	fibril_mutex_unlock(&childp->lock);
-	fibril_mutex_unlock(&parentp->lock);
-	return rc;
-}
-
-errno_t fat_has_children(bool *has_children, fs_node_t *fn)
-{
-	fat_bs_t *bs;
-	fat_node_t *nodep = FAT_NODE(fn);
-	unsigned blocks;
-	block_t *b;
-	unsigned i, j;
-	errno_t rc;
-
-	if (nodep->type != FAT_DIRECTORY) {
-		*has_children = false;
-		return EOK;
-	}
-
-	fibril_mutex_lock(&nodep->idx->lock);
-	bs = block_bb_get(nodep->idx->service_id);
-
-	blocks = nodep->size / BPS(bs);
-
-	for (i = 0; i < blocks; i++) {
-		fat_dentry_t *d;
-
-		rc = fat_block_get(&b, bs, nodep, i, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&nodep->idx->lock);
-			return rc;
-		}
-		for (j = 0; j < DPS(bs); j++) {
-			d = ((fat_dentry_t *)b->data) + j;
-			switch (fat_classify_dentry(d)) {
-			case FAT_DENTRY_SKIP:
-			case FAT_DENTRY_FREE:
-			case FAT_DENTRY_VOLLABEL:
-				continue;
-			case FAT_DENTRY_LAST:
-				rc = block_put(b);
-				fibril_mutex_unlock(&nodep->idx->lock);
-				*has_children = false;
-				return rc;
-			default:
-			case FAT_DENTRY_VALID:
-				rc = block_put(b);
-				fibril_mutex_unlock(&nodep->idx->lock);
-				*has_children = true;
-				return rc;
-			}
-		}
-		rc = block_put(b);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&nodep->idx->lock);
-			return rc;
-		}
-	}
-
-	fibril_mutex_unlock(&nodep->idx->lock);
-	*has_children = false;
-	return EOK;
-}
-
-fs_index_t fat_index_get(fs_node_t *fn)
-{
-	return FAT_NODE(fn)->idx->index;
-}
-
-aoff64_t fat_size_get(fs_node_t *fn)
-{
-	return FAT_NODE(fn)->size;
-}
-
-unsigned fat_lnkcnt_get(fs_node_t *fn)
-{
-	return FAT_NODE(fn)->lnkcnt;
-}
-
-bool fat_is_directory(fs_node_t *fn)
-{
-	return FAT_NODE(fn)->type == FAT_DIRECTORY;
-}
-
-bool fat_is_file(fs_node_t *fn)
-{
-	return FAT_NODE(fn)->type == FAT_FILE;
-}
-
-service_id_t fat_service_get(fs_node_t *fn)
-{
-	return 0;
-}
-
-errno_t fat_size_block(service_id_t service_id, uint32_t *size)
-{
-	fat_bs_t *bs;
-
-	bs = block_bb_get(service_id);
-	*size = BPC(bs);
-
-	return EOK;
-}
-
-errno_t fat_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	fat_bs_t *bs;
-
-	bs = block_bb_get(service_id);
-	*count = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
-
-	return EOK;
-}
-
-errno_t fat_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	fat_bs_t *bs;
-	fat_cluster_t e0;
-	uint64_t block_count;
-	errno_t rc;
-	uint32_t cluster_no, clusters;
-
-	block_count = 0;
-	bs = block_bb_get(service_id);
-	clusters = (SPC(bs)) ? TS(bs) / SPC(bs) : 0;
-	for (cluster_no = 0; cluster_no < clusters; cluster_no++) {
-		rc = fat_get_cluster(bs, service_id, FAT1, cluster_no, &e0);
-		if (rc != EOK)
-			return EIO;
-
-		if (e0 == FAT_CLST_RES0)
-			block_count++;
-	}
-	*count = block_count;
-
-	return EOK;
-}
-
-/** libfs operations */
-libfs_ops_t fat_libfs_ops = {
-	.root_get = fat_root_get,
-	.match = fat_match,
-	.node_get = fat_node_get,
-	.node_open = fat_node_open,
-	.node_put = fat_node_put,
-	.create = fat_create_node,
-	.destroy = fat_destroy_node,
-	.link = fat_link,
-	.unlink = fat_unlink,
-	.has_children = fat_has_children,
-	.index_get = fat_index_get,
-	.size_get = fat_size_get,
-	.lnkcnt_get = fat_lnkcnt_get,
-	.is_directory = fat_is_directory,
-	.is_file = fat_is_file,
-	.service_get = fat_service_get,
-	.size_block = fat_size_block,
-	.total_block_count = fat_total_block_count,
-	.free_block_count = fat_free_block_count
-};
-
-static errno_t fat_fs_open(service_id_t service_id, enum cache_mode cmode,
-    fs_node_t **rrfn, fat_idx_t **rridxp)
-{
-	fat_bs_t *bs;
-	errno_t rc;
-
-	/* initialize libblock */
-	rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	/* prepare the boot block */
-	rc = block_bb_read(service_id, BS_BLOCK);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* get the buffer with the boot sector */
-	bs = block_bb_get(service_id);
-
-	if (BPS(bs) != BS_SIZE) {
-		block_fini(service_id);
-		return ENOTSUP;
-	}
-
-	/* Initialize the block cache */
-	rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode);
-	if (rc != EOK) {
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Do some simple sanity checks on the file system. */
-	rc = fat_sanity_check(bs, service_id);
-	if (rc != EOK) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	rc = fat_idx_init_by_service_id(service_id);
-	if (rc != EOK) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Initialize the root node. */
-	fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t));
-	if (!rfn) {
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		fat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-
-	fs_node_initialize(rfn);
-	fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t));
-	if (!rootp) {
-		free(rfn);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		fat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-	fat_node_initialize(rootp);
-
-	fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0);
-	if (!ridxp) {
-		free(rfn);
-		free(rootp);
-		(void) block_cache_fini(service_id);
-		block_fini(service_id);
-		fat_idx_fini_by_service_id(service_id);
-		return ENOMEM;
-	}
-	assert(ridxp->index == 0);
-	/* ridxp->lock held */
-
-	rootp->type = FAT_DIRECTORY;
-	rootp->firstc = FAT_ROOT_CLST(bs);
-	rootp->refcnt = 1;
-	rootp->lnkcnt = 0;	/* FS root is not linked */
-
-	if (FAT_IS_FAT32(bs)) {
-		uint32_t clusters;
-		rc = fat_clusters_get(&clusters, bs, service_id, rootp->firstc);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&ridxp->lock);
-			free(rfn);
-			free(rootp);
-			(void) block_cache_fini(service_id);
-			block_fini(service_id);
-			fat_idx_fini_by_service_id(service_id);
-			return ENOTSUP;
-		}
-		rootp->size = BPS(bs) * SPC(bs) * clusters;
-	} else
-		rootp->size = RDE(bs) * sizeof(fat_dentry_t);
-
-	rootp->idx = ridxp;
-	ridxp->nodep = rootp;
-	rootp->bp = rfn;
-	rfn->data = rootp;
-
-	fibril_mutex_unlock(&ridxp->lock);
-
-	*rrfn = rfn;
-	*rridxp = ridxp;
-
-	return EOK;
-}
-
-static void fat_fs_close(service_id_t service_id, fs_node_t *rfn)
-{
-	free(rfn->data);
-	free(rfn);
-	(void) block_cache_fini(service_id);
-	block_fini(service_id);
-	fat_idx_fini_by_service_id(service_id);
-}
-
-/*
- * FAT VFS_OUT operations.
- */
-
-static errno_t fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	fat_idx_t *ridxp;
-	fs_node_t *rfn;
-	fat_node_t *nodep;
-	fat_directory_t di;
-	char label[FAT_VOLLABEL_LEN + 1];
-	errno_t rc;
-
-	rc = fat_fs_open(service_id, CACHE_MODE_WT, &rfn, &ridxp);
-	if (rc != EOK)
-		return rc;
-
-	nodep = FAT_NODE(rfn);
-
-	rc = fat_directory_open(nodep, &di);
-	if (rc != EOK) {
-		fat_fs_close(service_id, rfn);
-		return rc;
-	}
-
-	rc = fat_directory_vollabel_get(&di, label);
-	if (rc != EOK) {
-		if (rc != ENOENT) {
-			fat_fs_close(service_id, rfn);
-			return rc;
-		}
-
-		label[0] = '\0';
-	}
-
-	str_cpy(info->label, FS_LABEL_MAXLEN + 1, label);
-
-	fat_directory_close(&di);
-	fat_fs_close(service_id, rfn);
-
-	return EOK;
-}
-
-static errno_t
-fat_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
-    aoff64_t *size)
-{
-	enum cache_mode cmode = CACHE_MODE_WB;
-	fat_instance_t *instance;
-	fat_idx_t *ridxp;
-	fs_node_t *rfn;
-	errno_t rc;
-
-	instance = malloc(sizeof(fat_instance_t));
-	if (!instance)
-		return ENOMEM;
-	instance->lfn_enabled = true;
-
-	/* Parse mount options. */
-	char *mntopts = (char *) opts;
-	char *opt;
-	while ((opt = str_tok(mntopts, " ,", &mntopts)) != NULL) {
-		if (str_cmp(opt, "wtcache") == 0)
-			cmode = CACHE_MODE_WT;
-		else if (str_cmp(opt, "nolfn") == 0)
-			instance->lfn_enabled = false;
-	}
-
-	rc = fat_fs_open(service_id, cmode, &rfn, &ridxp);
-	if (rc != EOK) {
-		free(instance);
-		return rc;
-	}
-
-	fibril_mutex_lock(&ridxp->lock);
-
-	rc = fs_instance_create(service_id, instance);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&ridxp->lock);
-		fat_fs_close(service_id, rfn);
-		free(instance);
-		return rc;
-	}
-
-	fibril_mutex_unlock(&ridxp->lock);
-
-	*index = ridxp->index;
-	*size = FAT_NODE(rfn)->size;
-
-	return EOK;
-}
-
-static errno_t fat_update_fat32_fsinfo(service_id_t service_id)
-{
-	fat_bs_t *bs;
-	fat32_fsinfo_t *info;
-	block_t *b;
-	errno_t rc;
-
-	bs = block_bb_get(service_id);
-	assert(FAT_IS_FAT32(bs));
-
-	rc = block_get(&b, service_id, uint16_t_le2host(bs->fat32.fsinfo_sec),
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	info = (fat32_fsinfo_t *) b->data;
-
-	if (memcmp(info->sig1, FAT32_FSINFO_SIG1, sizeof(info->sig1)) != 0 ||
-	    memcmp(info->sig2, FAT32_FSINFO_SIG2, sizeof(info->sig2)) != 0 ||
-	    memcmp(info->sig3, FAT32_FSINFO_SIG3, sizeof(info->sig3)) != 0) {
-		(void) block_put(b);
-		return EINVAL;
-	}
-
-	/* For now, invalidate the counter. */
-	info->free_clusters = host2uint16_t_le(-1);
-
-	b->dirty = true;
-	return block_put(b);
-}
-
-static errno_t fat_unmounted(service_id_t service_id)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	fat_bs_t *bs;
-	errno_t rc;
-
-	bs = block_bb_get(service_id);
-
-	rc = fat_root_get(&fn, service_id);
-	if (rc != EOK)
-		return rc;
-	nodep = FAT_NODE(fn);
-
-	/*
-	 * We expect exactly two references on the root node. One for the
-	 * fat_root_get() above and one created in fat_mounted().
-	 */
-	if (nodep->refcnt != 2) {
-		(void) fat_node_put(fn);
-		return EBUSY;
-	}
-
-	if (FAT_IS_FAT32(bs)) {
-		/*
-		 * Attempt to update the FAT32 FS info.
-		 */
-		(void) fat_update_fat32_fsinfo(service_id);
-	}
-
-	/*
-	 * Put the root node and force it to the FAT free node list.
-	 */
-	(void) fat_node_put(fn);
-
-	/*
-	 * Perform cleanup of the node structures, index structures and
-	 * associated data. Write back this file system's dirty blocks and
-	 * stop using libblock for this instance.
-	 */
-	(void) fat_node_fini_by_service_id(service_id);
-	fat_fs_close(service_id, fn);
-
-	void *data;
-	if (fs_instance_get(service_id, &data) == EOK) {
-		fs_instance_destroy(service_id);
-		free(data);
-	}
-
-	return EOK;
-}
-
-static errno_t
-fat_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	fat_bs_t *bs;
-	size_t bytes;
-	block_t *b;
-	errno_t rc;
-
-	rc = fat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = FAT_NODE(fn);
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_read_receive(&call, &len)) {
-		fat_node_put(fn);
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	bs = block_bb_get(service_id);
-
-	if (nodep->type == FAT_FILE) {
-		/*
-		 * Our strategy for regular file reads is to read one block at
-		 * most and make use of the possibility to return less data than
-		 * requested. This keeps the code very simple.
-		 */
-		if (pos >= nodep->size) {
-			/* reading beyond the EOF */
-			bytes = 0;
-			(void) async_data_read_finalize(&call, NULL, 0);
-		} else {
-			bytes = min(len, BPS(bs) - pos % BPS(bs));
-			bytes = min(bytes, nodep->size - pos);
-			rc = fat_block_get(&b, bs, nodep, pos / BPS(bs),
-			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				fat_node_put(fn);
-				async_answer_0(&call, rc);
-				return rc;
-			}
-			(void) async_data_read_finalize(&call,
-			    b->data + pos % BPS(bs), bytes);
-			rc = block_put(b);
-			if (rc != EOK) {
-				fat_node_put(fn);
-				return rc;
-			}
-		}
-	} else {
-		aoff64_t spos = pos;
-		char name[FAT_LFN_NAME_SIZE];
-		fat_dentry_t *d;
-
-		assert(nodep->type == FAT_DIRECTORY);
-		assert(nodep->size % BPS(bs) == 0);
-		assert(BPS(bs) % sizeof(fat_dentry_t) == 0);
-
-		fat_directory_t di;
-		rc = fat_directory_open(nodep, &di);
-		if (rc != EOK)
-			goto err;
-		rc = fat_directory_seek(&di, pos);
-		if (rc != EOK) {
-			(void) fat_directory_close(&di);
-			goto err;
-		}
-
-		rc = fat_directory_read(&di, name, &d);
-		if (rc == EOK)
-			goto hit;
-		if (rc == ENOENT)
-			goto miss;
-
-	err:
-		(void) fat_node_put(fn);
-		async_answer_0(&call, rc);
-		return rc;
-
-	miss:
-		rc = fat_directory_close(&di);
-		if (rc != EOK)
-			goto err;
-		rc = fat_node_put(fn);
-		async_answer_0(&call, rc != EOK ? rc : ENOENT);
-		*rbytes = 0;
-		return rc != EOK ? rc : ENOENT;
-
-	hit:
-		pos = di.pos;
-		rc = fat_directory_close(&di);
-		if (rc != EOK)
-			goto err;
-		(void) async_data_read_finalize(&call, name,
-		    str_size(name) + 1);
-		bytes = (pos - spos) + 1;
-	}
-
-	rc = fat_node_put(fn);
-	*rbytes = bytes;
-	return rc;
-}
-
-static errno_t
-fat_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	fat_bs_t *bs;
-	size_t bytes;
-	block_t *b;
-	aoff64_t boundary;
-	int flags = BLOCK_FLAGS_NONE;
-	errno_t rc;
-
-	rc = fat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = FAT_NODE(fn);
-
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_write_receive(&call, &len)) {
-		(void) fat_node_put(fn);
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	bs = block_bb_get(service_id);
-
-	/*
-	 * In all scenarios, we will attempt to write out only one block worth
-	 * of data at maximum. There might be some more efficient approaches,
-	 * but this one greatly simplifies fat_write(). Note that we can afford
-	 * to do this because the client must be ready to handle the return
-	 * value signalizing a smaller number of bytes written.
-	 */
-	bytes = min(len, BPS(bs) - pos % BPS(bs));
-	if (bytes == BPS(bs))
-		flags |= BLOCK_FLAGS_NOREAD;
-
-	boundary = ROUND_UP(nodep->size, BPC(bs));
-	if (pos < boundary) {
-		/*
-		 * This is the easier case - we are either overwriting already
-		 * existing contents or writing behind the EOF, but still within
-		 * the limits of the last cluster. The node size may grow to the
-		 * next block size boundary.
-		 */
-		rc = fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos);
-		if (rc != EOK) {
-			(void) fat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-		rc = fat_block_get(&b, bs, nodep, pos / BPS(bs), flags);
-		if (rc != EOK) {
-			(void) fat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-		(void) async_data_write_finalize(&call,
-		    b->data + pos % BPS(bs), bytes);
-		b->dirty = true;		/* need to sync block */
-		rc = block_put(b);
-		if (rc != EOK) {
-			(void) fat_node_put(fn);
-			return rc;
-		}
-		if (pos + bytes > nodep->size) {
-			nodep->size = pos + bytes;
-			nodep->dirty = true;	/* need to sync node */
-		}
-		*wbytes = bytes;
-		*nsize = nodep->size;
-		rc = fat_node_put(fn);
-		return rc;
-	} else {
-		/*
-		 * This is the more difficult case. We must allocate new
-		 * clusters for the node and zero them out.
-		 */
-		unsigned nclsts;
-		fat_cluster_t mcl, lcl;
-
-		nclsts = (ROUND_UP(pos + bytes, BPC(bs)) - boundary) / BPC(bs);
-		/* create an independent chain of nclsts clusters in all FATs */
-		rc = fat_alloc_clusters(bs, service_id, nclsts, &mcl, &lcl);
-		if (rc != EOK) {
-			/* could not allocate a chain of nclsts clusters */
-			(void) fat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-		/* zero fill any gaps */
-		rc = fat_fill_gap(bs, nodep, mcl, pos);
-		if (rc != EOK) {
-			(void) fat_free_clusters(bs, service_id, mcl);
-			(void) fat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-		rc = _fat_block_get(&b, bs, service_id, lcl, NULL,
-		    (pos / BPS(bs)) % SPC(bs), flags);
-		if (rc != EOK) {
-			(void) fat_free_clusters(bs, service_id, mcl);
-			(void) fat_node_put(fn);
-			async_answer_0(&call, rc);
-			return rc;
-		}
-		(void) async_data_write_finalize(&call,
-		    b->data + pos % BPS(bs), bytes);
-		b->dirty = true;		/* need to sync block */
-		rc = block_put(b);
-		if (rc != EOK) {
-			(void) fat_free_clusters(bs, service_id, mcl);
-			(void) fat_node_put(fn);
-			return rc;
-		}
-		/*
-		 * Append the cluster chain starting in mcl to the end of the
-		 * node's cluster chain.
-		 */
-		rc = fat_append_clusters(bs, nodep, mcl, lcl);
-		if (rc != EOK) {
-			(void) fat_free_clusters(bs, service_id, mcl);
-			(void) fat_node_put(fn);
-			return rc;
-		}
-		*nsize = nodep->size = pos + bytes;
-		rc = fat_node_put(fn);
-		nodep->dirty = true;		/* need to sync node */
-		*wbytes = bytes;
-		return rc;
-	}
-}
-
-static errno_t
-fat_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	fat_bs_t *bs;
-	errno_t rc;
-
-	rc = fat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-	nodep = FAT_NODE(fn);
-
-	bs = block_bb_get(service_id);
-
-	if (nodep->size == size) {
-		rc = EOK;
-	} else if (nodep->size < size) {
-		/*
-		 * The standard says we have the freedom to grow the node.
-		 * For now, we simply return an error.
-		 */
-		rc = EINVAL;
-	} else if (ROUND_UP(nodep->size, BPC(bs)) == ROUND_UP(size, BPC(bs))) {
-		/*
-		 * The node will be shrunk, but no clusters will be deallocated.
-		 */
-		nodep->size = size;
-		nodep->dirty = true;		/* need to sync node */
-		rc = EOK;
-	} else {
-		/*
-		 * The node will be shrunk, clusters will be deallocated.
-		 */
-		if (size == 0) {
-			rc = fat_chop_clusters(bs, nodep, FAT_CLST_RES0);
-			if (rc != EOK)
-				goto out;
-		} else {
-			fat_cluster_t lastc;
-			rc = fat_cluster_walk(bs, service_id, nodep->firstc,
-			    &lastc, NULL, (size - 1) / BPC(bs));
-			if (rc != EOK)
-				goto out;
-			rc = fat_chop_clusters(bs, nodep, lastc);
-			if (rc != EOK)
-				goto out;
-		}
-		nodep->size = size;
-		nodep->dirty = true;		/* need to sync node */
-		rc = EOK;
-	}
-out:
-	fat_node_put(fn);
-	return rc;
-}
-
-static errno_t fat_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t fat_destroy(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	fat_node_t *nodep;
-	errno_t rc;
-
-	rc = fat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	nodep = FAT_NODE(fn);
-	/*
-	 * We should have exactly two references. One for the above
-	 * call to fat_node_get() and one from fat_unlink().
-	 */
-	assert(nodep->refcnt == 2);
-
-	rc = fat_destroy_node(fn);
-	return rc;
-}
-
-static errno_t fat_sync(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn;
-	errno_t rc = fat_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	fat_node_t *nodep = FAT_NODE(fn);
-
-	nodep->dirty = true;
-	rc = fat_node_sync(nodep);
-
-	fat_node_put(fn);
-	return rc;
-}
-
-vfs_out_ops_t fat_ops = {
-	.fsprobe = fat_fsprobe,
-	.mounted = fat_mounted,
-	.unmounted = fat_unmounted,
-	.read = fat_read,
-	.write = fat_write,
-	.truncate = fat_truncate,
-	.close = fat_close,
-	.destroy = fat_destroy,
-	.sync = fat_sync,
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/fat/meson.build
===================================================================
--- uspace/srv/fs/fat/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs' ]
-src = files(
-	'fat.c',
-	'fat_ops.c',
-	'fat_idx.c',
-	'fat_dentry.c',
-	'fat_directory.c',
-	'fat_fat.c',
-)
Index: pace/srv/fs/locfs/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/locfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup locfs locfs
- * @ingroup srvs
- * @brief Location-service file system
- */
Index: pace/srv/fs/locfs/locfs.c
===================================================================
--- uspace/srv/fs/locfs/locfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locfs
- * @{
- */
-
-/**
- * @file locfs.c
- * @brief Location-service file system.
- *
- * Every service registered with location service is represented as a file in this
- * file system.
- */
-
-#include <stdio.h>
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include <libfs.h>
-#include <str.h>
-#include "locfs.h"
-#include "locfs_ops.h"
-
-#define NAME  "locfs"
-
-static vfs_info_t locfs_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS Device Filesystem\n", NAME);
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			locfs_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf(NAME " Unrecognized parameters");
-			return -1;
-		}
-	}
-
-	if (!locfs_init()) {
-		printf("%s: failed to initialize locfs\n", NAME);
-		return -1;
-	}
-
-	errno_t rc;
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
-		return -1;
-	}
-
-	rc = fs_register(vfs_sess, &locfs_vfs_info, &locfs_ops,
-	    &locfs_libfs_ops);
-	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/locfs/locfs.h
===================================================================
--- uspace/srv/fs/locfs/locfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locfs
- * @{
- */
-
-#ifndef LOCFS_LOCFS_H_
-#define LOCFS_LOCFS_H_
-
-#include <libfs.h>
-
-extern vfs_out_ops_t locfs_ops;
-extern libfs_ops_t locfs_libfs_ops;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/locfs/locfs_ops.c
===================================================================
--- uspace/srv/fs/locfs/locfs_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,785 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locfs
- * @{
- */
-
-/**
- * @file locfs_ops.c
- * @brief Implementation of VFS operations for the locfs file system server.
- */
-
-#include <macros.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <libfs.h>
-#include <fibril_synch.h>
-#include <adt/hash_table.h>
-#include <ipc/loc.h>
-#include <assert.h>
-#include "locfs.h"
-#include "locfs_ops.h"
-
-typedef struct {
-	loc_object_type_t type;
-	service_id_t service_id;
-} locfs_node_t;
-
-/** Opened services structure */
-typedef struct {
-	service_id_t service_id;
-	async_sess_t *sess;       /**< If NULL, the structure is incomplete. */
-	size_t refcount;
-	ht_link_t link;
-	fibril_condvar_t cv;      /**< Broadcast when completed. */
-} service_t;
-
-/** Hash table of opened services */
-static hash_table_t services;
-
-/** Hash table mutex */
-static FIBRIL_MUTEX_INITIALIZE(services_mutex);
-
-/* Implementation of hash table interface for the nodes hash table. */
-
-static size_t services_key_hash(const void *key)
-{
-	const service_id_t *k = key;
-	return *k;
-}
-
-static size_t services_hash(const ht_link_t *item)
-{
-	service_t *dev = hash_table_get_inst(item, service_t, link);
-	return dev->service_id;
-}
-
-static bool services_key_equal(const void *key, size_t hash,
-    const ht_link_t *item)
-{
-	const service_id_t *k = key;
-	service_t *dev = hash_table_get_inst(item, service_t, link);
-	return (dev->service_id == *k);
-}
-
-static void services_remove_callback(ht_link_t *item)
-{
-	free(hash_table_get_inst(item, service_t, link));
-}
-
-static const hash_table_ops_t services_ops = {
-	.hash = services_hash,
-	.key_hash = services_key_hash,
-	.key_equal = services_key_equal,
-	.equal = NULL,
-	.remove_callback = services_remove_callback
-};
-
-static errno_t locfs_node_get_internal(fs_node_t **rfn, loc_object_type_t type,
-    service_id_t service_id)
-{
-	locfs_node_t *node = (locfs_node_t *) malloc(sizeof(locfs_node_t));
-	if (node == NULL) {
-		*rfn = NULL;
-		return ENOMEM;
-	}
-
-	*rfn = (fs_node_t *) malloc(sizeof(fs_node_t));
-	if (*rfn == NULL) {
-		free(node);
-		*rfn = NULL;
-		return ENOMEM;
-	}
-
-	fs_node_initialize(*rfn);
-	node->type = type;
-	node->service_id = service_id;
-
-	(*rfn)->data = node;
-	return EOK;
-}
-
-static errno_t locfs_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return locfs_node_get_internal(rfn, LOC_OBJECT_NONE, 0);
-}
-
-static errno_t locfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	locfs_node_t *node = (locfs_node_t *) pfn->data;
-	errno_t ret;
-
-	if (node->service_id == 0) {
-		/* Root directory */
-
-		loc_sdesc_t *nspaces;
-		size_t count = loc_get_namespaces(&nspaces);
-
-		if (count > 0) {
-			size_t pos;
-			for (pos = 0; pos < count; pos++) {
-				/* Ignore root namespace */
-				if (str_cmp(nspaces[pos].name, "") == 0)
-					continue;
-
-				if (str_cmp(nspaces[pos].name, component) == 0) {
-					ret = locfs_node_get_internal(rfn, LOC_OBJECT_NAMESPACE, nspaces[pos].id);
-					free(nspaces);
-					return ret;
-				}
-			}
-
-			free(nspaces);
-		}
-
-		/* Search root namespace */
-		service_id_t namespace;
-		loc_sdesc_t *svcs;
-		if (loc_namespace_get_id("", &namespace, 0) == EOK) {
-			count = loc_get_services(namespace, &svcs);
-
-			if (count > 0) {
-				size_t pos;
-				for (pos = 0; pos < count; pos++) {
-					if (str_cmp(svcs[pos].name, component) == 0) {
-						ret = locfs_node_get_internal(rfn, LOC_OBJECT_SERVICE, svcs[pos].id);
-						free(svcs);
-						return ret;
-					}
-				}
-
-				free(svcs);
-			}
-		}
-
-		*rfn = NULL;
-		return EOK;
-	}
-
-	if (node->type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-
-		loc_sdesc_t *svcs;
-		size_t count = loc_get_services(node->service_id, &svcs);
-		if (count > 0) {
-			size_t pos;
-			for (pos = 0; pos < count; pos++) {
-				if (str_cmp(svcs[pos].name, component) == 0) {
-					ret = locfs_node_get_internal(rfn, LOC_OBJECT_SERVICE, svcs[pos].id);
-					free(svcs);
-					return ret;
-				}
-			}
-
-			free(svcs);
-		}
-
-		*rfn = NULL;
-		return EOK;
-	}
-
-	*rfn = NULL;
-	return EOK;
-}
-
-static errno_t locfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
-{
-	return locfs_node_get_internal(rfn, loc_id_probe(index), index);
-}
-
-static errno_t locfs_node_open(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	if (node->service_id == 0) {
-		/* Root directory */
-		return EOK;
-	}
-
-	loc_object_type_t type = loc_id_probe(node->service_id);
-
-	if (type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-		return EOK;
-	}
-
-	if (type == LOC_OBJECT_SERVICE) {
-		/* Device node */
-
-		fibril_mutex_lock(&services_mutex);
-		ht_link_t *lnk;
-	restart:
-		lnk = hash_table_find(&services, &node->service_id);
-		if (lnk == NULL) {
-			service_t *dev = (service_t *) malloc(sizeof(service_t));
-			if (dev == NULL) {
-				fibril_mutex_unlock(&services_mutex);
-				return ENOMEM;
-			}
-
-			dev->service_id = node->service_id;
-
-			/* Mark as incomplete */
-			dev->sess = NULL;
-			dev->refcount = 1;
-			fibril_condvar_initialize(&dev->cv);
-
-			/*
-			 * Insert the incomplete device structure so that other
-			 * fibrils will not race with us when we drop the mutex
-			 * below.
-			 */
-			hash_table_insert(&services, &dev->link);
-
-			/*
-			 * Drop the mutex to allow recursive locfs requests.
-			 */
-			fibril_mutex_unlock(&services_mutex);
-
-			async_sess_t *sess = loc_service_connect(node->service_id,
-			    INTERFACE_FS, 0);
-
-			fibril_mutex_lock(&services_mutex);
-
-			/*
-			 * Notify possible waiters about this device structure
-			 * being completed (or destroyed).
-			 */
-			fibril_condvar_broadcast(&dev->cv);
-
-			if (!sess) {
-				/*
-				 * Connecting failed, need to remove the
-				 * entry and free the device structure.
-				 */
-				hash_table_remove(&services, &node->service_id);
-				fibril_mutex_unlock(&services_mutex);
-
-				return ENOENT;
-			}
-
-			/* Set the correct session. */
-			dev->sess = sess;
-		} else {
-			service_t *dev = hash_table_get_inst(lnk, service_t, link);
-
-			if (!dev->sess) {
-				/*
-				 * Wait until the device structure is completed
-				 * and start from the beginning as the device
-				 * structure might have entirely disappeared
-				 * while we were not holding the mutex in
-				 * fibril_condvar_wait().
-				 */
-				fibril_condvar_wait(&dev->cv, &services_mutex);
-				goto restart;
-			}
-
-			dev->refcount++;
-		}
-
-		fibril_mutex_unlock(&services_mutex);
-
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-static errno_t locfs_node_put(fs_node_t *fn)
-{
-	free(fn->data);
-	free(fn);
-	return EOK;
-}
-
-static errno_t locfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
-{
-	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
-
-	*rfn = NULL;
-	return ENOTSUP;
-}
-
-static errno_t locfs_destroy_node(fs_node_t *fn)
-{
-	return ENOTSUP;
-}
-
-static errno_t locfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	return ENOTSUP;
-}
-
-static errno_t locfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	return ENOTSUP;
-}
-
-static errno_t locfs_has_children(bool *has_children, fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	if (node->service_id == 0) {
-		size_t count = loc_count_namespaces();
-		if (count > 0) {
-			*has_children = true;
-			return EOK;
-		}
-
-		/* Root namespace */
-		service_id_t namespace;
-		if (loc_namespace_get_id("", &namespace, 0) == EOK) {
-			count = loc_count_services(namespace);
-			if (count > 0) {
-				*has_children = true;
-				return EOK;
-			}
-		}
-
-		*has_children = false;
-		return EOK;
-	}
-
-	if (node->type == LOC_OBJECT_NAMESPACE) {
-		size_t count = loc_count_services(node->service_id);
-		if (count > 0) {
-			*has_children = true;
-			return EOK;
-		}
-
-		*has_children = false;
-		return EOK;
-	}
-
-	*has_children = false;
-	return EOK;
-}
-
-static fs_index_t locfs_index_get(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-	return node->service_id;
-}
-
-static aoff64_t locfs_size_get(fs_node_t *fn)
-{
-	return 0;
-}
-
-static unsigned int locfs_lnkcnt_get(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	if (node->service_id == 0)
-		return 0;
-
-	return 1;
-}
-
-static bool locfs_is_directory(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	return ((node->type == LOC_OBJECT_NONE) || (node->type == LOC_OBJECT_NAMESPACE));
-}
-
-static bool locfs_is_file(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	return (node->type == LOC_OBJECT_SERVICE);
-}
-
-static service_id_t locfs_service_get(fs_node_t *fn)
-{
-	locfs_node_t *node = (locfs_node_t *) fn->data;
-
-	if (node->type == LOC_OBJECT_SERVICE)
-		return node->service_id;
-
-	return 0;
-}
-
-/** libfs operations */
-libfs_ops_t locfs_libfs_ops = {
-	.root_get = locfs_root_get,
-	.match = locfs_match,
-	.node_get = locfs_node_get,
-	.node_open = locfs_node_open,
-	.node_put = locfs_node_put,
-	.create = locfs_create_node,
-	.destroy = locfs_destroy_node,
-	.link = locfs_link_node,
-	.unlink = locfs_unlink_node,
-	.has_children = locfs_has_children,
-	.index_get = locfs_index_get,
-	.size_get = locfs_size_get,
-	.lnkcnt_get = locfs_lnkcnt_get,
-	.is_directory = locfs_is_directory,
-	.is_file = locfs_is_file,
-	.service_get = locfs_service_get
-};
-
-bool locfs_init(void)
-{
-	if (!hash_table_create(&services, 0,  0, &services_ops))
-		return false;
-
-	return true;
-}
-
-static errno_t locfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	return ENOTSUP;
-}
-
-static errno_t locfs_mounted(service_id_t service_id, const char *opts,
-    fs_index_t *index, aoff64_t *size)
-{
-	*index = 0;
-	*size = 0;
-	return EOK;
-}
-
-static errno_t locfs_unmounted(service_id_t service_id)
-{
-	return ENOTSUP;
-}
-
-static errno_t
-locfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	if (index == 0) {
-		ipc_call_t call;
-		size_t size;
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EINVAL);
-			return EINVAL;
-		}
-
-		loc_sdesc_t *desc;
-		size_t count = loc_get_namespaces(&desc);
-
-		/* Get rid of root namespace */
-		size_t i;
-		for (i = 0; i < count; i++) {
-			if (str_cmp(desc[i].name, "") == 0) {
-				if (pos >= i)
-					pos++;
-
-				break;
-			}
-		}
-
-		if (pos < count) {
-			async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
-			free(desc);
-			*rbytes = 1;
-			return EOK;
-		}
-
-		free(desc);
-		pos -= count;
-
-		/* Search root namespace */
-		service_id_t namespace;
-		if (loc_namespace_get_id("", &namespace, 0) == EOK) {
-			count = loc_get_services(namespace, &desc);
-
-			if (pos < count) {
-				async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
-				free(desc);
-				*rbytes = 1;
-				return EOK;
-			}
-
-			free(desc);
-		}
-
-		async_answer_0(&call, ENOENT);
-		return ENOENT;
-	}
-
-	loc_object_type_t type = loc_id_probe(index);
-
-	if (type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-		ipc_call_t call;
-		size_t size;
-		if (!async_data_read_receive(&call, &size)) {
-			async_answer_0(&call, EINVAL);
-			return EINVAL;
-		}
-
-		loc_sdesc_t *desc;
-		size_t count = loc_get_services(index, &desc);
-
-		if (pos < count) {
-			async_data_read_finalize(&call, desc[pos].name, str_size(desc[pos].name) + 1);
-			free(desc);
-			*rbytes = 1;
-			return EOK;
-		}
-
-		free(desc);
-		async_answer_0(&call, ENOENT);
-		return ENOENT;
-	}
-
-	if (type == LOC_OBJECT_SERVICE) {
-		/* Device node */
-
-		fibril_mutex_lock(&services_mutex);
-		service_id_t service_index = index;
-		ht_link_t *lnk = hash_table_find(&services, &service_index);
-		if (lnk == NULL) {
-			fibril_mutex_unlock(&services_mutex);
-			return ENOENT;
-		}
-
-		service_t *dev = hash_table_get_inst(lnk, service_t, link);
-		assert(dev->sess);
-
-		ipc_call_t call;
-		if (!async_data_read_receive(&call, NULL)) {
-			fibril_mutex_unlock(&services_mutex);
-			async_answer_0(&call, EINVAL);
-			return EINVAL;
-		}
-
-		/* Make a request at the driver */
-		async_exch_t *exch = async_exchange_begin(dev->sess);
-
-		ipc_call_t answer;
-		aid_t msg = async_send_4(exch, VFS_OUT_READ, service_id,
-		    index, LOWER32(pos), UPPER32(pos), &answer);
-
-		/* Forward the IPC_M_DATA_READ request to the driver */
-		async_forward_0(&call, exch, 0, IPC_FF_ROUTE_FROM_ME);
-
-		async_exchange_end(exch);
-
-		fibril_mutex_unlock(&services_mutex);
-
-		/* Wait for reply from the driver. */
-		errno_t rc;
-		async_wait_for(msg, &rc);
-
-		/* Do not propagate EHANGUP back to VFS. */
-		if ((errno_t) rc == EHANGUP)
-			rc = ENOTSUP;
-
-		*rbytes = ipc_get_arg1(&answer);
-		return rc;
-	}
-
-	return ENOENT;
-}
-
-static errno_t
-locfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	if (index == 0)
-		return ENOTSUP;
-
-	loc_object_type_t type = loc_id_probe(index);
-
-	if (type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-		return ENOTSUP;
-	}
-
-	if (type == LOC_OBJECT_SERVICE) {
-		/* Device node */
-
-		fibril_mutex_lock(&services_mutex);
-		service_id_t service_index = index;
-		ht_link_t *lnk = hash_table_find(&services, &service_index);
-		if (lnk == NULL) {
-			fibril_mutex_unlock(&services_mutex);
-			return ENOENT;
-		}
-
-		service_t *dev = hash_table_get_inst(lnk, service_t, link);
-		assert(dev->sess);
-
-		ipc_call_t call;
-		if (!async_data_write_receive(&call, NULL)) {
-			fibril_mutex_unlock(&services_mutex);
-			async_answer_0(&call, EINVAL);
-			return EINVAL;
-		}
-
-		/* Make a request at the driver */
-		async_exch_t *exch = async_exchange_begin(dev->sess);
-
-		ipc_call_t answer;
-		aid_t msg = async_send_4(exch, VFS_OUT_WRITE, service_id,
-		    index, LOWER32(pos), UPPER32(pos), &answer);
-
-		/* Forward the IPC_M_DATA_WRITE request to the driver */
-		async_forward_0(&call, exch, 0, IPC_FF_ROUTE_FROM_ME);
-
-		async_exchange_end(exch);
-
-		fibril_mutex_unlock(&services_mutex);
-
-		/* Wait for reply from the driver. */
-		errno_t rc;
-		async_wait_for(msg, &rc);
-
-		/* Do not propagate EHANGUP back to VFS. */
-		if ((errno_t) rc == EHANGUP)
-			rc = ENOTSUP;
-
-		*wbytes = ipc_get_arg1(&answer);
-		*nsize = 0;
-		return rc;
-	}
-
-	return ENOENT;
-}
-
-static errno_t
-locfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
-{
-	return ENOTSUP;
-}
-
-static errno_t locfs_close(service_id_t service_id, fs_index_t index)
-{
-	if (index == 0)
-		return EOK;
-
-	loc_object_type_t type = loc_id_probe(index);
-
-	if (type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-		return EOK;
-	}
-
-	if (type == LOC_OBJECT_SERVICE) {
-
-		fibril_mutex_lock(&services_mutex);
-		service_id_t service_index = index;
-		ht_link_t *lnk = hash_table_find(&services, &service_index);
-		if (lnk == NULL) {
-			fibril_mutex_unlock(&services_mutex);
-			return ENOENT;
-		}
-
-		service_t *dev = hash_table_get_inst(lnk, service_t, link);
-		assert(dev->sess);
-		dev->refcount--;
-
-		if (dev->refcount == 0) {
-			async_hangup(dev->sess);
-			service_id_t service_index = index;
-			hash_table_remove(&services, &service_index);
-		}
-
-		fibril_mutex_unlock(&services_mutex);
-
-		return EOK;
-	}
-
-	return ENOENT;
-}
-
-static errno_t locfs_sync(service_id_t service_id, fs_index_t index)
-{
-	if (index == 0)
-		return EOK;
-
-	loc_object_type_t type = loc_id_probe(index);
-
-	if (type == LOC_OBJECT_NAMESPACE) {
-		/* Namespace directory */
-		return EOK;
-	}
-
-	if (type == LOC_OBJECT_SERVICE) {
-
-		fibril_mutex_lock(&services_mutex);
-		service_id_t service_index = index;
-		ht_link_t *lnk = hash_table_find(&services, &service_index);
-		if (lnk == NULL) {
-			fibril_mutex_unlock(&services_mutex);
-			return ENOENT;
-		}
-
-		service_t *dev = hash_table_get_inst(lnk, service_t, link);
-		assert(dev->sess);
-
-		/* Make a request at the driver */
-		async_exch_t *exch = async_exchange_begin(dev->sess);
-
-		ipc_call_t answer;
-		aid_t msg = async_send_2(exch, VFS_OUT_SYNC, service_id,
-		    index, &answer);
-
-		async_exchange_end(exch);
-
-		fibril_mutex_unlock(&services_mutex);
-
-		/* Wait for reply from the driver */
-		errno_t rc;
-		async_wait_for(msg, &rc);
-
-		return rc;
-	}
-
-	return  ENOENT;
-}
-
-static errno_t locfs_destroy(service_id_t service_id, fs_index_t index)
-{
-	return ENOTSUP;
-}
-
-vfs_out_ops_t locfs_ops = {
-	.fsprobe = locfs_fsprobe,
-	.mounted = locfs_mounted,
-	.unmounted = locfs_unmounted,
-	.read = locfs_read,
-	.write = locfs_write,
-	.truncate = locfs_truncate,
-	.close = locfs_close,
-	.destroy = locfs_destroy,
-	.sync = locfs_sync,
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/locfs/locfs_ops.h
===================================================================
--- uspace/srv/fs/locfs/locfs_ops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locfs
- * @{
- */
-
-#ifndef LOCFS_LOCFS_OPS_H_
-#define LOCFS_LOCFS_OPS_H_
-
-#include <stdbool.h>
-
-extern bool locfs_init(void);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/locfs/meson.build
===================================================================
--- uspace/srv/fs/locfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'fs' ]
-src = files('locfs.c', 'locfs_ops.c')
Index: pace/srv/fs/mfs/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/mfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup mfs mfs
- * @ingroup srvs
- * @brief Minix file system driver
- */
Index: pace/srv/fs/mfs/meson.build
===================================================================
--- uspace/srv/fs/mfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs', 'minix' ]
-src = files(
-	'mfs.c',
-	'mfs_ops.c',
-	'mfs_inode.c',
-	'mfs_rw.c',
-	'mfs_dentry.c',
-	'mfs_balloc.c',
-	'mfs_utils.c',
-)
Index: pace/srv/fs/mfs/mfs.c
===================================================================
--- uspace/srv/fs/mfs/mfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-/**
- * @file	mfs.c
- * @brief	Minix file system driver for HelenOS.
- */
-
-#include <ipc/services.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include <stdio.h>
-#include <libfs.h>
-#include "mfs.h"
-
-vfs_info_t mfs_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS Minix file system server\n");
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			mfs_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf(NAME " Unrecognized parameters");
-			rc = EINVAL;
-			goto err;
-		}
-	}
-
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf(NAME ": failed to connect to VFS: %s\n", str_error(rc));
-		rc = errno;
-		goto err;
-	}
-
-	rc = mfs_global_init();
-	if (rc != EOK) {
-		printf(NAME ": Failed global initialization\n");
-		goto err;
-	}
-
-	rc = fs_register(vfs_sess, &mfs_vfs_info, &mfs_ops, &mfs_libfs_ops);
-	if (rc != EOK)
-		goto err;
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-	/* not reached */
-	return 0;
-
-err:
-	printf(NAME ": Failed to register file system: %s\n", str_error(rc));
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs.h
===================================================================
--- uspace/srv/fs/mfs/mfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#ifndef _MFS_H_
-#define _MFS_H_
-
-#include <minix.h>
-#include <macros.h>
-#include <block.h>
-#include <libfs.h>
-#include <adt/list.h>
-#include <mem.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <macros.h>
-#include "../../vfs/vfs.h"
-
-#define NAME		"mfs"
-
-/* #define DEBUG_MODE */
-
-#ifdef DEBUG_MODE
-#define mfsdebug(...)	printf(__VA_ARGS__)
-#else
-#define mfsdebug(...)
-#endif
-
-#define MFS_BMAP_START_BLOCK(sbi, bid) \
-    ((bid) == BMAP_ZONE ? 2 + (sbi)->ibmap_blocks : 2)
-
-#define MFS_BMAP_SIZE_BITS(sbi, bid) \
-    ((bid) == BMAP_ZONE ? (sbi)->nzones - (sbi)->firstdatazone - 1 : \
-    (sbi)->ninodes - 1)
-
-#define MFS_BMAP_SIZE_BLOCKS(sbi, bid) \
-    ((bid) == BMAP_ZONE ? (sbi)->zbmap_blocks : (sbi)->ibmap_blocks)
-
-typedef uint32_t bitchunk_t;
-
-typedef enum {
-	BMAP_ZONE,
-	BMAP_INODE
-} bmap_id_t;
-
-typedef enum {
-	MFS_VERSION_V1 = 1,
-	MFS_VERSION_V2,
-	MFS_VERSION_V3
-} mfs_version_t;
-
-/* Generic MinixFS superblock */
-struct mfs_sb_info {
-	uint32_t ninodes;
-	uint32_t nzones;
-	unsigned long ibmap_blocks;
-	unsigned long zbmap_blocks;
-	unsigned long firstdatazone;
-	int log2_zone_size;
-	int block_size;
-	uint32_t max_file_size;
-	uint16_t magic;
-	uint16_t state;
-
-	/* The following fields do not exist on disk but only in memory */
-	unsigned long itable_size;
-	mfs_version_t fs_version;
-	int ino_per_block;
-	size_t dirsize;
-	int itable_off;
-	unsigned max_name_len;
-	bool long_names;
-	bool native;
-	unsigned isearch;
-	unsigned zsearch;
-
-	/*
-	 * Indicates wether if the cached number of free zones
-	 * is to be considered valid or not.
-	 */
-	bool nfree_zones_valid;
-	/*
-	 * Cached number of free zones, used to avoid to scan
-	 * the whole bitmap every time the mfs_free_block_count()
-	 * is invoked.
-	 */
-	unsigned nfree_zones;
-};
-
-/* Generic MinixFS inode */
-struct mfs_ino_info {
-	uint16_t	i_mode;
-	uint16_t	i_nlinks;
-	int16_t		i_uid;
-	uint16_t	i_gid;
-	size_t		i_size;
-	int32_t		i_atime;
-	int32_t		i_mtime;
-	int32_t		i_ctime;
-	/* Block numbers for direct zones */
-	uint32_t	i_dzone[V2_NR_DIRECT_ZONES];
-	/* Block numbers for indirect zones */
-	uint32_t	i_izone[V2_NR_INDIRECT_ZONES];
-
-	/* The following fields do not exist on disk but only in memory */
-	bool dirty;
-	fs_index_t index;
-};
-
-/* Generic MFS directory entry */
-struct mfs_dentry_info {
-	uint32_t d_inum;
-	char d_name[MFS3_MAX_NAME_LEN + 1];
-
-	/* The following fields do not exist on disk but only in memory */
-
-	/* Index of the dentry in the list */
-	unsigned index;
-	/* Pointer to the node at witch the dentry belongs */
-	struct mfs_node *node;
-};
-
-struct mfs_instance {
-	service_id_t service_id;
-	struct mfs_sb_info *sbi;
-	unsigned open_nodes_cnt;
-};
-
-/* MinixFS node in core */
-struct mfs_node {
-	struct mfs_ino_info *ino_i;
-	struct mfs_instance *instance;
-	unsigned refcnt;
-	fs_node_t *fsnode;
-	ht_link_t link;
-};
-
-/* mfs_ops.c */
-extern vfs_out_ops_t mfs_ops;
-extern libfs_ops_t mfs_libfs_ops;
-
-extern errno_t
-mfs_global_init(void);
-
-/* mfs_inode.c */
-extern errno_t
-mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
-    fs_index_t index);
-
-extern errno_t
-mfs_put_inode(struct mfs_node *mnode);
-
-extern errno_t
-mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink);
-
-/* mfs_rw.c */
-extern errno_t
-mfs_read_map(uint32_t *b, const struct mfs_node *mnode, const uint32_t pos);
-
-extern errno_t
-mfs_write_map(struct mfs_node *mnode, uint32_t pos, uint32_t new_zone,
-    uint32_t *old_zone);
-
-extern errno_t
-mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size);
-
-/* mfs_dentry.c */
-extern errno_t
-mfs_read_dentry(struct mfs_node *mnode,
-    struct mfs_dentry_info *d_info, unsigned index);
-
-extern errno_t
-mfs_write_dentry(struct mfs_dentry_info *d_info);
-
-extern errno_t
-mfs_remove_dentry(struct mfs_node *mnode, const char *d_name);
-
-extern errno_t
-mfs_insert_dentry(struct mfs_node *mnode, const char *d_name, fs_index_t d_inum);
-
-/* mfs_balloc.c */
-extern errno_t
-mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum);
-
-extern errno_t
-mfs_free_inode(struct mfs_instance *inst, uint32_t inum);
-
-extern errno_t
-mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone);
-
-extern errno_t
-mfs_free_zone(struct mfs_instance *inst, uint32_t zone);
-
-extern errno_t
-mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones);
-
-extern errno_t
-mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes);
-
-/* mfs_utils.c */
-extern uint16_t
-conv16(bool native, uint16_t n);
-
-extern uint32_t
-conv32(bool native, uint32_t n);
-
-extern uint64_t
-conv64(bool native, uint64_t n);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_balloc.c
===================================================================
--- uspace/srv/fs/mfs/mfs_balloc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,408 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <stdlib.h>
-#include "mfs.h"
-
-static int
-find_free_bit_and_set(bitchunk_t *b, const int bsize,
-    const bool native, unsigned start_bit);
-
-static errno_t
-mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid);
-
-static errno_t
-mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid);
-
-static errno_t
-mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free);
-
-/**Allocate a new inode.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param inum		Pointer to a 32 bit number where the index of
- * 			the new inode will be saved.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_alloc_inode(struct mfs_instance *inst, uint32_t *inum)
-{
-	errno_t r = mfs_alloc_bit(inst, inum, BMAP_INODE);
-	return r;
-}
-
-/**Free an inode.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param inum		Number of the inode to free.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_free_inode(struct mfs_instance *inst, uint32_t inum)
-{
-	return mfs_free_bit(inst, inum, BMAP_INODE);
-}
-
-/**Allocate a new zone.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param zone		Pointer to a 32 bit number where the index
- * 			of the zone will be saved.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_alloc_zone(struct mfs_instance *inst, uint32_t *zone)
-{
-	errno_t r = mfs_alloc_bit(inst, zone, BMAP_ZONE);
-	if (r != EOK)
-		return r;
-
-	/* Update the cached number of free zones */
-	struct mfs_sb_info *sbi = inst->sbi;
-	if (sbi->nfree_zones_valid)
-		sbi->nfree_zones--;
-
-	*zone += inst->sbi->firstdatazone - 1;
-	return r;
-}
-
-/**Free a zone.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param zone		Index of the zone to free.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_free_zone(struct mfs_instance *inst, uint32_t zone)
-{
-	errno_t r;
-
-	zone -= inst->sbi->firstdatazone - 1;
-
-	r = mfs_free_bit(inst, zone, BMAP_ZONE);
-	if (r != EOK)
-		return r;
-
-	/* Update the cached number of free zones */
-	struct mfs_sb_info *sbi = inst->sbi;
-	if (sbi->nfree_zones_valid)
-		sbi->nfree_zones++;
-
-	return r;
-}
-
-/** Count the number of free zones
- *
- * @param inst          Pointer to the instance structure.
- * @param zones         Pointer to the memory location where the result
- *                      will be stored.
- *
- * @return              EOK on success or an error code.
- */
-errno_t
-mfs_count_free_zones(struct mfs_instance *inst, uint32_t *zones)
-{
-	return mfs_count_free_bits(inst, BMAP_ZONE, zones);
-}
-
-/** Count the number of free inodes
- *
- * @param inst          Pointer to the instance structure.
- * @param zones         Pointer to the memory location where the result
- *                      will be stored.
- *
- * @return              EOK on success or an error code.
- */
-
-errno_t
-mfs_count_free_inodes(struct mfs_instance *inst, uint32_t *inodes)
-{
-	return mfs_count_free_bits(inst, BMAP_INODE, inodes);
-}
-
-/** Count the number of free bits in a bitmap
- *
- * @param inst          Pointer to the instance structure.
- * @param bid           Type of the bitmap (inode or zone).
- * @param free          Pointer to the memory location where the result
- *                      will be stores.
- *
- * @return              EOK on success or an error code.
- */
-static errno_t
-mfs_count_free_bits(struct mfs_instance *inst, bmap_id_t bid, uint32_t *free)
-{
-	errno_t r;
-	unsigned start_block;
-	unsigned long nblocks;
-	unsigned long nbits;
-	unsigned long block;
-	unsigned long free_bits = 0;
-	bitchunk_t chunk;
-	size_t const bitchunk_bits = sizeof(bitchunk_t) * 8;
-	block_t *b;
-	struct mfs_sb_info *sbi = inst->sbi;
-
-	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
-	nblocks = MFS_BMAP_SIZE_BLOCKS(sbi, bid);
-	nbits = MFS_BMAP_SIZE_BITS(sbi, bid);
-
-	for (block = 0; block < nblocks; ++block) {
-		r = block_get(&b, inst->service_id, block + start_block,
-		    BLOCK_FLAGS_NONE);
-		if (r != EOK)
-			return r;
-
-		size_t i;
-		bitchunk_t *data = (bitchunk_t *) b->data;
-
-		/*
-		 * Read the bitmap block, chunk per chunk,
-		 * counting the zero bits.
-		 */
-		for (i = 0; i < sbi->block_size / sizeof(bitchunk_t); ++i) {
-			chunk = conv32(sbi->native, data[i]);
-
-			size_t bit;
-			for (bit = 0; bit < bitchunk_bits && nbits > 0;
-			    ++bit, --nbits) {
-				if (!(chunk & (1 << bit)))
-					free_bits++;
-			}
-
-			if (nbits == 0)
-				break;
-		}
-
-		r = block_put(b);
-		if (r != EOK)
-			return r;
-	}
-
-	*free = free_bits;
-	assert(nbits == 0);
-
-	return EOK;
-}
-
-/**Clear a bit in a bitmap.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param idx		Index of the bit to clear.
- * @param bid		BMAP_ZONE if operating on the zone's bitmap,
- * 			BMAP_INODE if operating on the inode's bitmap.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t
-mfs_free_bit(struct mfs_instance *inst, uint32_t idx, bmap_id_t bid)
-{
-	struct mfs_sb_info *sbi;
-	errno_t r;
-	unsigned start_block;
-	unsigned *search;
-	block_t *b;
-
-	sbi = inst->sbi;
-
-	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
-
-	if (bid == BMAP_ZONE) {
-		search = &sbi->zsearch;
-		if (idx > sbi->nzones) {
-			printf(NAME ": Error! Trying to free beyond the "
-			    "bitmap max size\n");
-			return EIO;
-		}
-	} else {
-		/* bid == BMAP_INODE */
-		search = &sbi->isearch;
-		if (idx > sbi->ninodes) {
-			printf(NAME ": Error! Trying to free beyond the "
-			    "bitmap max size\n");
-			return EIO;
-		}
-	}
-
-	/* Compute the bitmap block */
-	uint32_t block = idx / (sbi->block_size * 8) + start_block;
-
-	r = block_get(&b, inst->service_id, block, BLOCK_FLAGS_NONE);
-	if (r != EOK)
-		goto out_err;
-
-	/* Compute the bit index in the block */
-	idx %= (sbi->block_size * 8);
-	bitchunk_t *ptr = b->data;
-	bitchunk_t chunk;
-	const size_t chunk_bits = sizeof(bitchunk_t) * 8;
-
-	chunk = conv32(sbi->native, ptr[idx / chunk_bits]);
-	chunk &= ~(1 << (idx % chunk_bits));
-	ptr[idx / chunk_bits] = conv32(sbi->native, chunk);
-
-	b->dirty = true;
-	r = block_put(b);
-
-	if (*search > idx)
-		*search = idx;
-
-out_err:
-	return r;
-}
-
-/**Search a free bit in a bitmap and mark it as used.
- *
- * @param inst		Pointer to the filesystem instance.
- * @param idx		Pointer of a 32 bit number where the index
- * 			of the found bit will be stored.
- * @param bid		BMAP_ZONE if operating on the zone's bitmap,
- * 			BMAP_INODE if operating on the inode's bitmap.
- *
- * @return		EOK on success or an error code.
- */
-static errno_t
-mfs_alloc_bit(struct mfs_instance *inst, uint32_t *idx, bmap_id_t bid)
-{
-	struct mfs_sb_info *sbi;
-	uint32_t limit;
-	unsigned long nblocks;
-	unsigned *search, i, start_block;
-	unsigned bits_per_block;
-	errno_t r;
-	int freebit;
-
-	sbi = inst->sbi;
-
-	start_block = MFS_BMAP_START_BLOCK(sbi, bid);
-	limit = MFS_BMAP_SIZE_BITS(sbi, bid);
-	nblocks = MFS_BMAP_SIZE_BLOCKS(sbi, bid);
-
-	if (bid == BMAP_ZONE) {
-		search = &sbi->zsearch;
-	} else {
-		/* bid == BMAP_INODE */
-		search = &sbi->isearch;
-	}
-	bits_per_block = sbi->block_size * 8;
-
-	block_t *b;
-
-retry:
-
-	for (i = *search / bits_per_block; i < nblocks; ++i) {
-		r = block_get(&b, inst->service_id, i + start_block,
-		    BLOCK_FLAGS_NONE);
-
-		if (r != EOK)
-			goto out;
-
-		unsigned tmp = *search % bits_per_block;
-
-		freebit = find_free_bit_and_set(b->data, sbi->block_size,
-		    sbi->native, tmp);
-		if (freebit == -1) {
-			/* No free bit in this block */
-			r = block_put(b);
-			if (r != EOK)
-				goto out;
-			continue;
-		}
-
-		/* Free bit found in this block, compute the real index */
-		*idx = freebit + bits_per_block * i;
-		if (*idx > limit) {
-			/* Index is beyond the limit, it is invalid */
-			r = block_put(b);
-			if (r != EOK)
-				goto out;
-			break;
-		}
-
-		*search = *idx;
-		b->dirty = true;
-		r = block_put(b);
-		goto out;
-	}
-
-	if (*search > 0) {
-		/* Repeat the search from the first bitmap block */
-		*search = 0;
-		goto retry;
-	}
-
-	/* Free bit not found, return error */
-	return ENOSPC;
-
-out:
-	return r;
-}
-
-static int
-find_free_bit_and_set(bitchunk_t *b, const int bsize,
-    const bool native, unsigned start_bit)
-{
-	int r = -1;
-	unsigned i, j;
-	bitchunk_t chunk;
-	const size_t chunk_bits = sizeof(bitchunk_t) * 8;
-
-	for (i = start_bit / chunk_bits;
-	    i < bsize / sizeof(bitchunk_t); ++i) {
-
-		if (!(~b[i])) {
-			/* No free bit in this chunk */
-			continue;
-		}
-
-		chunk = conv32(native, b[i]);
-
-		for (j = 0; j < chunk_bits; ++j) {
-			if (!(chunk & (1 << j))) {
-				r = i * chunk_bits + j;
-				chunk |= 1 << j;
-				b[i] = conv32(native, chunk);
-				goto found;
-			}
-		}
-	}
-found:
-	return r;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_dentry.c
===================================================================
--- uspace/srv/fs/mfs/mfs_dentry.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,268 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <str.h>
-#include "mfs.h"
-
-/**Read a directory entry from disk.
- *
- * @param mnode		Pointer to the directory node.
- * @param d_info	Pointer to a directory entry structure where
- *			the dentry info will be stored.
- * @param index		index of the dentry in the list.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_read_dentry(struct mfs_node *mnode,
-    struct mfs_dentry_info *d_info, unsigned index)
-{
-	const struct mfs_instance *inst = mnode->instance;
-	const struct mfs_sb_info *sbi = inst->sbi;
-	const bool longnames = sbi->long_names;
-	uint32_t block;
-	block_t *b;
-
-	errno_t r = mfs_read_map(&block, mnode, index * sbi->dirsize);
-	if (r != EOK)
-		goto out_err;
-
-	if (block == 0) {
-		/* End of the dentries list */
-		r = EOK;
-		goto out_err;
-	}
-
-	r = block_get(&b, inst->service_id, block, BLOCK_FLAGS_NONE);
-	if (r != EOK)
-		goto out_err;
-
-	unsigned dentries_per_zone = sbi->block_size / sbi->dirsize;
-	unsigned dentry_off = index % dentries_per_zone;
-
-	if (sbi->fs_version == MFS_VERSION_V3) {
-		struct mfs3_dentry *d3;
-
-		d3 = b->data + (dentry_off * MFS3_DIRSIZE);
-
-		d_info->d_inum = conv32(sbi->native, d3->d_inum);
-		memcpy(d_info->d_name, d3->d_name, MFS3_MAX_NAME_LEN);
-		d_info->d_name[MFS3_MAX_NAME_LEN] = 0;
-	} else {
-		const int namelen = longnames ? MFS_L_MAX_NAME_LEN :
-		    MFS_MAX_NAME_LEN;
-
-		struct mfs_dentry *d;
-
-		d = b->data + dentry_off * (longnames ? MFSL_DIRSIZE :
-		    MFS_DIRSIZE);
-		d_info->d_inum = conv16(sbi->native, d->d_inum);
-		memcpy(d_info->d_name, d->d_name, namelen);
-		d_info->d_name[namelen] = 0;
-	}
-
-	r = block_put(b);
-
-	d_info->index = index;
-	d_info->node = mnode;
-
-out_err:
-	return r;
-}
-
-/**Write a directory entry on disk.
- *
- * @param d_info The directory entry to write to disk.
- *
- * @return	 EOK on success or an error code.
- */
-errno_t
-mfs_write_dentry(struct mfs_dentry_info *d_info)
-{
-	struct mfs_node *mnode = d_info->node;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	const unsigned d_off_bytes = d_info->index * sbi->dirsize;
-	const unsigned dirs_per_block = sbi->block_size / sbi->dirsize;
-	block_t *b;
-	uint32_t block;
-	errno_t r;
-
-	r = mfs_read_map(&block, mnode, d_off_bytes);
-	if (r != EOK)
-		goto out;
-
-	r = block_get(&b, mnode->instance->service_id, block, BLOCK_FLAGS_NONE);
-	if (r != EOK)
-		goto out;
-
-	const size_t name_len = sbi->max_name_len;
-	uint8_t *ptr = b->data;
-	ptr += (d_info->index % dirs_per_block) * sbi->dirsize;
-
-	if (sbi->fs_version == MFS_VERSION_V3) {
-		struct mfs3_dentry *dentry;
-		dentry = (struct mfs3_dentry *) ptr;
-
-		dentry->d_inum = conv32(sbi->native, d_info->d_inum);
-		memcpy(dentry->d_name, d_info->d_name, name_len);
-	} else {
-		struct mfs_dentry *dentry;
-		dentry = (struct mfs_dentry *) ptr;
-
-		dentry->d_inum = conv16(sbi->native, d_info->d_inum);
-		memcpy(dentry->d_name, d_info->d_name, name_len);
-	}
-
-	b->dirty = true;
-	r = block_put(b);
-
-out:
-	return r;
-}
-
-/**Remove a directory entry from a directory.
- *
- * @param mnode		Pointer to the directory node.
- * @param d_name	Name of the directory entry to delete.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_remove_dentry(struct mfs_node *mnode, const char *d_name)
-{
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	struct mfs_dentry_info d_info;
-	errno_t r;
-
-	const size_t name_len = str_size(d_name);
-
-	if (name_len > sbi->max_name_len)
-		return ENAMETOOLONG;
-
-	/* Search the directory entry to be removed */
-	unsigned i;
-	for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) {
-		r = mfs_read_dentry(mnode, &d_info, i);
-		if (r != EOK)
-			return r;
-
-		const size_t d_name_len = str_size(d_info.d_name);
-
-		if (name_len == d_name_len &&
-		    memcmp(d_info.d_name, d_name, name_len) == 0) {
-
-			d_info.d_inum = 0;
-			r = mfs_write_dentry(&d_info);
-			return r;
-		}
-	}
-
-	return ENOENT;
-}
-
-/**Insert a new directory entry in a existing directory.
- *
- * @param mnode		Pointer to the directory node.
- * @param d_name	Name of the new directory entry.
- * @param d_inum	index of the inode that will be pointed by the new dentry.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_insert_dentry(struct mfs_node *mnode, const char *d_name,
-    fs_index_t d_inum)
-{
-	errno_t r;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	struct mfs_dentry_info d_info;
-	bool empty_dentry_found = false;
-
-	const size_t name_len = str_size(d_name);
-
-	if (name_len > sbi->max_name_len)
-		return ENAMETOOLONG;
-
-	/* Search for an empty dentry */
-	unsigned i;
-	for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) {
-		r = mfs_read_dentry(mnode, &d_info, i);
-		if (r != EOK)
-			return r;
-
-		if (d_info.d_inum == 0) {
-			/* This entry is not used */
-			empty_dentry_found = true;
-			break;
-		}
-	}
-
-	if (!empty_dentry_found) {
-		uint32_t b, pos;
-		pos = mnode->ino_i->i_size;
-		r = mfs_read_map(&b, mnode, pos);
-		if (r != EOK)
-			goto out;
-
-		if (b == 0) {
-			/* Increase the inode size */
-
-			uint32_t dummy;
-			r = mfs_alloc_zone(mnode->instance, &b);
-			if (r != EOK)
-				goto out;
-			r = mfs_write_map(mnode, pos, b, &dummy);
-			if (r != EOK) {
-				mfs_free_zone(mnode->instance, b);
-				goto out;
-			}
-		}
-
-		mnode->ino_i->i_size += sbi->dirsize;
-		mnode->ino_i->dirty = true;
-
-		d_info.index = i;
-		d_info.node = mnode;
-	}
-
-	d_info.d_inum = d_inum;
-	memcpy(d_info.d_name, d_name, name_len);
-	if (name_len < sbi->max_name_len)
-		d_info.d_name[name_len] = 0;
-
-	r = mfs_write_dentry(&d_info);
-out:
-	return r;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_inode.c
===================================================================
--- uspace/srv/fs/mfs/mfs_inode.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <stdlib.h>
-#include "mfs.h"
-
-static errno_t
-mfs_write_inode_raw(struct mfs_node *mnode);
-
-static errno_t
-mfs2_write_inode_raw(struct mfs_node *mnode);
-
-static errno_t
-mfs_read_inode_raw(const struct mfs_instance *instance,
-    struct mfs_ino_info **ino_ptr, uint16_t inum);
-
-static errno_t
-mfs2_read_inode_raw(const struct mfs_instance *instance,
-    struct mfs_ino_info **ino_ptr, uint32_t inum);
-
-/**Read a MINIX inode from disk
- *
- * @param inst		Pointer to the filesystem instance.
- * @param ino_i		Pointer to the generic MINIX inode
- * 			where the inode content will be stored.
- * @param index		index of the inode to read.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_get_inode(struct mfs_instance *inst, struct mfs_ino_info **ino_i,
-    fs_index_t index)
-{
-	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
-
-	if (sbi->fs_version == MFS_VERSION_V1) {
-		/* Read a MFS V1 inode */
-		r = mfs_read_inode_raw(inst, ino_i, index);
-	} else {
-		/* Read a MFS V2/V3 inode */
-		r = mfs2_read_inode_raw(inst, ino_i, index);
-	}
-
-	return r;
-}
-
-static errno_t
-mfs_read_inode_raw(const struct mfs_instance *instance,
-    struct mfs_ino_info **ino_ptr, uint16_t inum)
-{
-	struct mfs_inode *ino;
-	struct mfs_ino_info *ino_i = NULL;
-	struct mfs_sb_info *sbi;
-	block_t *b;
-	int i;
-	errno_t r;
-
-	sbi = instance->sbi;
-
-	/* inode 0 does not exist */
-	inum -= 1;
-
-	const int ino_off = inum % sbi->ino_per_block;
-
-	ino_i = malloc(sizeof(*ino_i));
-
-	if (!ino_i) {
-		r = ENOMEM;
-		goto out_err;
-	}
-
-	const int itable_off = sbi->itable_off;
-
-	r = block_get(&b, instance->service_id,
-	    itable_off + inum / sbi->ino_per_block,
-	    BLOCK_FLAGS_NONE);
-
-	if (r != EOK)
-		goto out_err;
-
-	ino = b->data + ino_off * sizeof(struct mfs_inode);
-
-	ino_i->i_mode = conv16(sbi->native, ino->i_mode);
-	ino_i->i_uid = conv16(sbi->native, ino->i_uid);
-	ino_i->i_size = conv32(sbi->native, ino->i_size);
-	ino_i->i_mtime = conv32(sbi->native, ino->i_mtime);
-	ino_i->i_nlinks = ino->i_nlinks;
-
-	for (i = 0; i < V1_NR_DIRECT_ZONES; ++i)
-		ino_i->i_dzone[i] = conv16(sbi->native, ino->i_dzone[i]);
-
-	for (i = 0; i < V1_NR_INDIRECT_ZONES; ++i)
-		ino_i->i_izone[i] = conv16(sbi->native, ino->i_izone[i]);
-
-	r = block_put(b);
-	ino_i->dirty = false;
-	*ino_ptr = ino_i;
-
-	return r;
-
-out_err:
-	if (ino_i)
-		free(ino_i);
-	return EOK;
-}
-
-static errno_t
-mfs2_read_inode_raw(const struct mfs_instance *instance,
-    struct mfs_ino_info **ino_ptr, uint32_t inum)
-{
-	struct mfs2_inode *ino;
-	struct mfs_ino_info *ino_i = NULL;
-	struct mfs_sb_info *sbi;
-	block_t *b;
-	int i;
-	errno_t r;
-
-	ino_i = malloc(sizeof(*ino_i));
-
-	if (!ino_i) {
-		r = ENOMEM;
-		goto out_err;
-	}
-
-	sbi = instance->sbi;
-
-	/* inode 0 does not exist */
-	inum -= 1;
-
-	const int itable_off = sbi->itable_off;
-	const int ino_off = inum % sbi->ino_per_block;
-
-	r = block_get(&b, instance->service_id,
-	    itable_off + inum / sbi->ino_per_block,
-	    BLOCK_FLAGS_NONE);
-
-	if (r != EOK)
-		goto out_err;
-
-	ino = b->data + ino_off * sizeof(struct mfs2_inode);
-
-	ino_i->i_mode = conv16(sbi->native, ino->i_mode);
-	ino_i->i_nlinks = conv16(sbi->native, ino->i_nlinks);
-	ino_i->i_uid = conv16(sbi->native, ino->i_uid);
-	ino_i->i_gid = conv16(sbi->native, ino->i_gid);
-	ino_i->i_size = conv32(sbi->native, ino->i_size);
-	ino_i->i_atime = conv32(sbi->native, ino->i_atime);
-	ino_i->i_mtime = conv32(sbi->native, ino->i_mtime);
-	ino_i->i_ctime = conv32(sbi->native, ino->i_ctime);
-
-	for (i = 0; i < V2_NR_DIRECT_ZONES; ++i)
-		ino_i->i_dzone[i] = conv32(sbi->native, ino->i_dzone[i]);
-
-	for (i = 0; i < V2_NR_INDIRECT_ZONES; ++i)
-		ino_i->i_izone[i] = conv32(sbi->native, ino->i_izone[i]);
-
-	r = block_put(b);
-	ino_i->dirty = false;
-	*ino_ptr = ino_i;
-
-	return r;
-
-out_err:
-	if (ino_i)
-		free(ino_i);
-	return EOK;
-}
-
-/**Write a MINIX inode on disk (if marked as dirty)
- *
- * @param mnode		Pointer to the generic MINIX inode in memory.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_put_inode(struct mfs_node *mnode)
-{
-	errno_t rc = EOK;
-
-	if (!mnode->ino_i->dirty)
-		goto out;
-
-	struct mfs_instance *inst = mnode->instance;
-	struct mfs_sb_info *sbi = inst->sbi;
-
-	if (sbi->fs_version == MFS_VERSION_V1)
-		rc = mfs_write_inode_raw(mnode);
-	else
-		rc = mfs2_write_inode_raw(mnode);
-
-out:
-	return rc;
-}
-
-static errno_t
-mfs_write_inode_raw(struct mfs_node *mnode)
-{
-	int i;
-	errno_t r;
-	block_t *b;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-
-	const uint32_t inum = ino_i->index - 1;
-	const int itable_off = sbi->itable_off;
-	const int ino_off = inum % sbi->ino_per_block;
-	const bool native = sbi->native;
-
-	r = block_get(&b, mnode->instance->service_id,
-	    itable_off + inum / sbi->ino_per_block,
-	    BLOCK_FLAGS_NONE);
-
-	if (r != EOK)
-		goto out;
-
-	struct mfs_inode *ino = b->data;
-	ino += ino_off;
-
-	ino->i_mode = conv16(native, ino_i->i_mode);
-	ino->i_uid = conv16(native, ino_i->i_uid);
-	ino->i_gid = ino_i->i_gid;
-	ino->i_nlinks = ino_i->i_nlinks;
-	ino->i_size = conv32(native, ino_i->i_size);
-	ino->i_mtime = conv32(native, ino_i->i_mtime);
-
-	for (i = 0; i < V1_NR_DIRECT_ZONES; ++i)
-		ino->i_dzone[i] = conv16(native, ino_i->i_dzone[i]);
-	for (i = 0; i < V1_NR_INDIRECT_ZONES; ++i)
-		ino->i_izone[i] = conv16(native, ino_i->i_izone[i]);
-
-	b->dirty = true;
-	r = block_put(b);
-
-	ino_i->dirty = false;
-out:
-	return r;
-}
-
-static errno_t
-mfs2_write_inode_raw(struct mfs_node *mnode)
-{
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	block_t *b;
-	int i;
-	errno_t r;
-
-	const uint32_t inum = ino_i->index - 1;
-	const int itable_off = sbi->itable_off;
-	const int ino_off = inum % sbi->ino_per_block;
-	const bool native = sbi->native;
-
-	r = block_get(&b, mnode->instance->service_id,
-	    itable_off + inum / sbi->ino_per_block,
-	    BLOCK_FLAGS_NONE);
-
-	if (r != EOK)
-		goto out;
-
-	struct mfs2_inode *ino2 = b->data;
-	ino2 += ino_off;
-
-	ino2->i_mode = conv16(native, ino_i->i_mode);
-	ino2->i_nlinks = conv16(native, ino_i->i_nlinks);
-	ino2->i_uid = conv16(native, ino_i->i_uid);
-	ino2->i_gid = conv16(native, ino_i->i_gid);
-	ino2->i_size = conv32(native, ino_i->i_size);
-	ino2->i_atime = conv32(native, ino_i->i_atime);
-	ino2->i_mtime = conv32(native, ino_i->i_mtime);
-	ino2->i_ctime = conv32(native, ino_i->i_ctime);
-
-	for (i = 0; i < V2_NR_DIRECT_ZONES; ++i)
-		ino2->i_dzone[i] = conv32(native, ino_i->i_dzone[i]);
-
-	for (i = 0; i < V2_NR_INDIRECT_ZONES; ++i)
-		ino2->i_izone[i] = conv32(native, ino_i->i_izone[i]);
-
-	b->dirty = true;
-	r = block_put(b);
-	ino_i->dirty = false;
-
-out:
-	return r;
-}
-
-/**Reduce the inode size of a given number of bytes
- *
- * @param mnode		Pointer to the generic MINIX inode in memory.
- * @param size_shrink	Number of bytes that will be subtracted to the inode.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_inode_shrink(struct mfs_node *mnode, size_t size_shrink)
-{
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	const size_t bs = sbi->block_size;
-	errno_t r;
-
-	if (size_shrink == 0) {
-		/* Nothing to be done */
-		return EOK;
-	}
-
-	const size_t old_size = ino_i->i_size;
-	const size_t new_size = ino_i->i_size - size_shrink;
-
-	assert(size_shrink <= old_size);
-
-	ino_i->dirty = true;
-
-	/* Compute the number of zones to free */
-	unsigned zones_to_free;
-
-	size_t diff = old_size - new_size;
-	zones_to_free = diff / bs;
-
-	if (diff % bs != 0)
-		zones_to_free++;
-
-	uint32_t pos = old_size - 1;
-	unsigned i;
-	for (i = 0; i < zones_to_free; ++i, pos -= bs) {
-		uint32_t old_zone;
-
-		r = mfs_write_map(mnode, pos, 0, &old_zone);
-		if (r != EOK)
-			goto exit_error;
-
-		ino_i->i_size -= bs;
-
-		if (old_zone == 0)
-			continue; /* Sparse block */
-
-		r = mfs_free_zone(mnode->instance, old_zone);
-		if (r != EOK)
-			goto exit_error;
-	}
-
-	ino_i->i_size = new_size;
-
-	return mfs_prune_ind_zones(mnode, new_size);
-
-exit_error:
-	return r;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_ops.c
===================================================================
--- uspace/srv/fs/mfs/mfs_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1274 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <stdlib.h>
-#include <fibril_synch.h>
-#include <align.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <str.h>
-#include "mfs.h"
-
-static bool check_magic_number(uint16_t magic, bool *native,
-    mfs_version_t *version, bool *longfilenames);
-static errno_t mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,
-    fs_index_t index);
-static errno_t mfs_node_put(fs_node_t *fsnode);
-static errno_t mfs_node_open(fs_node_t *fsnode);
-static fs_index_t mfs_index_get(fs_node_t *fsnode);
-static unsigned mfs_lnkcnt_get(fs_node_t *fsnode);
-static bool mfs_is_directory(fs_node_t *fsnode);
-static bool mfs_is_file(fs_node_t *fsnode);
-static errno_t mfs_has_children(bool *has_children, fs_node_t *fsnode);
-static errno_t mfs_root_get(fs_node_t **rfn, service_id_t service_id);
-static service_id_t mfs_service_get(fs_node_t *fsnode);
-static aoff64_t mfs_size_get(fs_node_t *node);
-static errno_t mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component);
-static errno_t mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags);
-static errno_t mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name);
-static errno_t mfs_unlink(fs_node_t *, fs_node_t *, const char *name);
-static errno_t mfs_destroy_node(fs_node_t *fn);
-static errno_t mfs_node_get(fs_node_t **rfn, service_id_t service_id,
-    fs_index_t index);
-static errno_t mfs_instance_get(service_id_t service_id,
-    struct mfs_instance **instance);
-static errno_t mfs_check_sanity(struct mfs_sb_info *sbi);
-static bool is_power_of_two(uint32_t n);
-static errno_t mfs_size_block(service_id_t service_id, uint32_t *size);
-static errno_t mfs_total_block_count(service_id_t service_id, uint64_t *count);
-static errno_t mfs_free_block_count(service_id_t service_id, uint64_t *count);
-
-static hash_table_t open_nodes;
-static FIBRIL_MUTEX_INITIALIZE(open_nodes_lock);
-
-libfs_ops_t mfs_libfs_ops = {
-	.size_get = mfs_size_get,
-	.root_get = mfs_root_get,
-	.service_get = mfs_service_get,
-	.is_directory = mfs_is_directory,
-	.is_file = mfs_is_file,
-	.node_get = mfs_node_get,
-	.node_put = mfs_node_put,
-	.node_open = mfs_node_open,
-	.index_get = mfs_index_get,
-	.match = mfs_match,
-	.create = mfs_create_node,
-	.link = mfs_link,
-	.unlink = mfs_unlink,
-	.destroy = mfs_destroy_node,
-	.has_children = mfs_has_children,
-	.lnkcnt_get = mfs_lnkcnt_get,
-	.size_block = mfs_size_block,
-	.total_block_count = mfs_total_block_count,
-	.free_block_count = mfs_free_block_count
-};
-
-/* Hash table interface for open nodes hash table */
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} node_key_t;
-
-static size_t
-open_nodes_key_hash(const void *key)
-{
-	const node_key_t *node_key = key;
-	return hash_combine(node_key->service_id, node_key->index);
-}
-
-static size_t
-open_nodes_hash(const ht_link_t *item)
-{
-	struct mfs_node *m = hash_table_get_inst(item, struct mfs_node, link);
-	return hash_combine(m->instance->service_id, m->ino_i->index);
-}
-
-static bool
-open_nodes_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const node_key_t *node_key = key;
-	struct mfs_node *mnode = hash_table_get_inst(item, struct mfs_node, link);
-
-	return node_key->service_id == mnode->instance->service_id &&
-	    node_key->index == mnode->ino_i->index;
-}
-
-static const hash_table_ops_t open_nodes_ops = {
-	.hash = open_nodes_hash,
-	.key_hash = open_nodes_key_hash,
-	.key_equal = open_nodes_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL,
-};
-
-errno_t
-mfs_global_init(void)
-{
-	if (!hash_table_create(&open_nodes, 0, 0, &open_nodes_ops)) {
-		return ENOMEM;
-	}
-	return EOK;
-}
-
-/** Read the superblock.
- */
-static errno_t mfs_read_sb(service_id_t service_id, struct mfs_sb_info **rsbi)
-{
-	struct mfs_superblock *sb = NULL;
-	struct mfs3_superblock *sb3 = NULL;
-	struct mfs_sb_info *sbi;
-	size_t bsize;
-	bool native, longnames;
-	mfs_version_t version;
-	uint16_t magic;
-	errno_t rc;
-
-	/* Allocate space for generic MFS superblock */
-	sbi = malloc(sizeof(*sbi));
-	if (!sbi) {
-		rc = ENOMEM;
-		goto out_error;
-	}
-
-	sb = malloc(MFS_SUPERBLOCK_SIZE);
-	if (!sb) {
-		rc = ENOMEM;
-		goto out_error;
-	}
-
-	rc = block_get_bsize(service_id, &bsize);
-	if (rc != EOK) {
-		rc = EIO;
-		goto out_error;
-	}
-
-	/* We don't support other block size than 512 */
-	if (bsize != 512) {
-		rc = ENOTSUP;
-		goto out_error;
-	}
-
-	/* Read the superblock */
-	rc = block_read_direct(service_id, MFS_SUPERBLOCK << 1, 2, sb);
-	if (rc != EOK)
-		goto out_error;
-
-	sb3 = (struct mfs3_superblock *) sb;
-
-	if (check_magic_number(sb->s_magic, &native, &version, &longnames)) {
-		/* This is a V1 or V2 Minix filesystem */
-		magic = sb->s_magic;
-	} else if (check_magic_number(sb3->s_magic, &native,
-	    &version, &longnames)) {
-		/* This is a V3 Minix filesystem */
-		magic = sb3->s_magic;
-	} else {
-		/* Not recognized */
-		mfsdebug("magic number not recognized\n");
-		rc = ENOTSUP;
-		goto out_error;
-	}
-
-	mfsdebug("magic number recognized = %04x\n", magic);
-
-	/* Fill superblock info structure */
-
-	sbi->fs_version = version;
-	sbi->long_names = longnames;
-	sbi->native = native;
-	sbi->magic = magic;
-	sbi->isearch = 0;
-	sbi->zsearch = 0;
-	sbi->nfree_zones_valid = false;
-	sbi->nfree_zones = 0;
-
-	if (version == MFS_VERSION_V3) {
-		sbi->ninodes = conv32(native, sb3->s_ninodes);
-		sbi->ibmap_blocks = conv16(native, sb3->s_ibmap_blocks);
-		sbi->zbmap_blocks = conv16(native, sb3->s_zbmap_blocks);
-		sbi->firstdatazone = conv16(native, sb3->s_first_data_zone);
-		sbi->log2_zone_size = conv16(native, sb3->s_log2_zone_size);
-		sbi->max_file_size = conv32(native, sb3->s_max_file_size);
-		sbi->nzones = conv32(native, sb3->s_nzones);
-		sbi->block_size = conv16(native, sb3->s_block_size);
-		sbi->ino_per_block = V3_INODES_PER_BLOCK(sbi->block_size);
-		sbi->dirsize = MFS3_DIRSIZE;
-		sbi->max_name_len = MFS3_MAX_NAME_LEN;
-	} else {
-		sbi->ninodes = conv16(native, sb->s_ninodes);
-		sbi->ibmap_blocks = conv16(native, sb->s_ibmap_blocks);
-		sbi->zbmap_blocks = conv16(native, sb->s_zbmap_blocks);
-		sbi->firstdatazone = conv16(native, sb->s_first_data_zone);
-		sbi->log2_zone_size = conv16(native, sb->s_log2_zone_size);
-		sbi->max_file_size = conv32(native, sb->s_max_file_size);
-		sbi->block_size = MFS_BLOCKSIZE;
-		if (version == MFS_VERSION_V2) {
-			sbi->nzones = conv32(native, sb->s_nzones2);
-			sbi->ino_per_block = V2_INODES_PER_BLOCK;
-		} else {
-			sbi->nzones = conv16(native, sb->s_nzones);
-			sbi->ino_per_block = V1_INODES_PER_BLOCK;
-		}
-		sbi->dirsize = longnames ? MFSL_DIRSIZE : MFS_DIRSIZE;
-		sbi->max_name_len = longnames ? MFS_L_MAX_NAME_LEN :
-		    MFS_MAX_NAME_LEN;
-	}
-
-	if (sbi->log2_zone_size != 0) {
-		/*
-		 * In MFS, file space is allocated per zones.
-		 * Zones are a collection of consecutive blocks on disk.
-		 *
-		 * The current MFS implementation supports only filesystems
-		 * where the size of a zone is equal to the
-		 * size of a block.
-		 */
-		rc = ENOTSUP;
-		goto out_error;
-	}
-
-	sbi->itable_off = 2 + sbi->ibmap_blocks + sbi->zbmap_blocks;
-	if ((rc = mfs_check_sanity(sbi)) != EOK) {
-		fprintf(stderr, "Filesystem corrupted, invalid superblock");
-		goto out_error;
-	}
-
-	mfsdebug("read superblock successful\n");
-
-	free(sb);
-	*rsbi = sbi;
-	return EOK;
-
-out_error:
-	if (sb)
-		free(sb);
-	if (sbi)
-		free(sbi);
-	return rc;
-}
-
-static errno_t mfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	struct mfs_sb_info *sbi = NULL;
-	errno_t rc;
-
-	/* Initialize libblock */
-	rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	/* Read the superblock */
-	rc = mfs_read_sb(service_id, &sbi);
-	block_fini(service_id);
-
-	return rc;
-}
-
-static errno_t
-mfs_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
-    aoff64_t *size)
-{
-	enum cache_mode cmode;
-	struct mfs_sb_info *sbi = NULL;
-	struct mfs_instance *instance = NULL;
-	errno_t rc;
-
-	/* Check for option enabling write through. */
-	if (str_cmp(opts, "wtcache") == 0)
-		cmode = CACHE_MODE_WT;
-	else
-		cmode = CACHE_MODE_WB;
-
-	/* Initialize libblock */
-	rc = block_init(service_id);
-	if (rc != EOK)
-		return rc;
-
-	/* Allocate space for filesystem instance */
-	instance = malloc(sizeof(*instance));
-	if (!instance) {
-		rc = ENOMEM;
-		goto out_error;
-	}
-
-	/* Read the superblock */
-	rc = mfs_read_sb(service_id, &sbi);
-	if (rc != EOK)
-		goto out_error;
-
-	rc = block_cache_init(service_id, sbi->block_size, 0, cmode);
-	if (rc != EOK) {
-		mfsdebug("block cache initialization failed\n");
-		rc = EINVAL;
-		goto out_error;
-	}
-
-	/* Initialize the instance structure and remember it */
-	instance->service_id = service_id;
-	instance->sbi = sbi;
-	instance->open_nodes_cnt = 0;
-	rc = fs_instance_create(service_id, instance);
-	if (rc != EOK) {
-		block_cache_fini(service_id);
-		mfsdebug("fs instance creation failed\n");
-		goto out_error;
-	}
-
-	mfsdebug("mount successful\n");
-
-	fs_node_t *fn;
-	mfs_node_get(&fn, service_id, MFS_ROOT_INO);
-
-	struct mfs_node *mroot = fn->data;
-
-	*index = mroot->ino_i->index;
-	*size = mroot->ino_i->i_size;
-
-	return mfs_node_put(fn);
-
-out_error:
-	block_fini(service_id);
-	if (sbi)
-		free(sbi);
-	if (instance)
-		free(instance);
-	return rc;
-}
-
-static errno_t
-mfs_unmounted(service_id_t service_id)
-{
-	struct mfs_instance *inst;
-
-	mfsdebug("%s()\n", __FUNCTION__);
-
-	errno_t r = mfs_instance_get(service_id, &inst);
-	if (r != EOK)
-		return r;
-
-	if (inst->open_nodes_cnt != 0)
-		return EBUSY;
-
-	(void) block_cache_fini(service_id);
-	block_fini(service_id);
-
-	/* Remove and destroy the instance */
-	(void) fs_instance_destroy(service_id);
-	free(inst->sbi);
-	free(inst);
-	return EOK;
-}
-
-service_id_t
-mfs_service_get(fs_node_t *fsnode)
-{
-	return 0;
-}
-
-static errno_t
-mfs_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	errno_t r;
-	struct mfs_instance *inst;
-	struct mfs_node *mnode;
-	fs_node_t *fsnode;
-	uint32_t inum;
-
-	r = mfs_instance_get(service_id, &inst);
-	if (r != EOK)
-		return r;
-
-	/* Alloc a new inode */
-	r = mfs_alloc_inode(inst, &inum);
-	if (r != EOK)
-		return r;
-
-	struct mfs_ino_info *ino_i;
-
-	ino_i = malloc(sizeof(*ino_i));
-	if (!ino_i) {
-		r = ENOMEM;
-		goto out_err;
-	}
-
-	mnode = malloc(sizeof(*mnode));
-	if (!mnode) {
-		r = ENOMEM;
-		goto out_err_1;
-	}
-
-	fsnode = malloc(sizeof(fs_node_t));
-	if (!fsnode) {
-		r = ENOMEM;
-		goto out_err_2;
-	}
-
-	if (flags & L_DIRECTORY) {
-		ino_i->i_mode = S_IFDIR;
-		ino_i->i_nlinks = 1; /* This accounts for the '.' dentry */
-	} else {
-		ino_i->i_mode = S_IFREG;
-		ino_i->i_nlinks = 0;
-	}
-
-	ino_i->i_uid = 0;
-	ino_i->i_gid = 0;
-	ino_i->i_size = 0;
-	ino_i->i_atime = 0;
-	ino_i->i_mtime = 0;
-	ino_i->i_ctime = 0;
-
-	memset(ino_i->i_dzone, 0, sizeof(uint32_t) * V2_NR_DIRECT_ZONES);
-	memset(ino_i->i_izone, 0, sizeof(uint32_t) * V2_NR_INDIRECT_ZONES);
-
-	mfsdebug("new node idx = %d\n", (int) inum);
-
-	ino_i->index = inum;
-	ino_i->dirty = true;
-	mnode->ino_i = ino_i;
-	mnode->instance = inst;
-	mnode->refcnt = 1;
-
-	fibril_mutex_lock(&open_nodes_lock);
-	hash_table_insert(&open_nodes, &mnode->link);
-	fibril_mutex_unlock(&open_nodes_lock);
-	inst->open_nodes_cnt++;
-
-	mnode->ino_i->dirty = true;
-
-	fs_node_initialize(fsnode);
-	fsnode->data = mnode;
-	mnode->fsnode = fsnode;
-	*rfn = fsnode;
-
-	return EOK;
-
-out_err_2:
-	free(mnode);
-out_err_1:
-	free(ino_i);
-out_err:
-	mfs_free_inode(inst, inum);
-	return r;
-}
-
-static errno_t
-mfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	struct mfs_node *mnode = pfn->data;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	struct mfs_dentry_info d_info;
-	errno_t r;
-
-	if (!S_ISDIR(ino_i->i_mode))
-		return ENOTDIR;
-
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	const size_t comp_size = str_size(component);
-
-	unsigned i;
-	for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) {
-		r = mfs_read_dentry(mnode, &d_info, i);
-		if (r != EOK)
-			return r;
-
-		if (!d_info.d_inum) {
-			/* This entry is not used */
-			continue;
-		}
-
-		const size_t dentry_name_size = str_size(d_info.d_name);
-
-		if (comp_size == dentry_name_size &&
-		    memcmp(component, d_info.d_name, dentry_name_size) == 0) {
-			/* Hit! */
-			mfs_node_core_get(rfn, mnode->instance,
-			    d_info.d_inum);
-			goto found;
-		}
-	}
-	*rfn = NULL;
-found:
-	return EOK;
-}
-
-static aoff64_t
-mfs_size_get(fs_node_t *node)
-{
-	const struct mfs_node *mnode = node->data;
-	return mnode->ino_i->i_size;
-}
-
-static errno_t
-mfs_node_get(fs_node_t **rfn, service_id_t service_id,
-    fs_index_t index)
-{
-	errno_t rc;
-	struct mfs_instance *instance;
-
-	rc = mfs_instance_get(service_id, &instance);
-	if (rc != EOK)
-		return rc;
-
-	return mfs_node_core_get(rfn, instance, index);
-}
-
-static errno_t
-mfs_node_put(fs_node_t *fsnode)
-{
-	errno_t rc = EOK;
-	struct mfs_node *mnode = fsnode->data;
-
-	fibril_mutex_lock(&open_nodes_lock);
-
-	assert(mnode->refcnt > 0);
-	mnode->refcnt--;
-	if (mnode->refcnt == 0) {
-		hash_table_remove_item(&open_nodes, &mnode->link);
-		assert(mnode->instance->open_nodes_cnt > 0);
-		mnode->instance->open_nodes_cnt--;
-		rc = mfs_put_inode(mnode);
-		free(mnode->ino_i);
-		free(mnode);
-		free(fsnode);
-	}
-
-	fibril_mutex_unlock(&open_nodes_lock);
-	return rc;
-}
-
-static errno_t
-mfs_node_open(fs_node_t *fsnode)
-{
-	/*
-	 * Opening a file is stateless, nothing
-	 * to be done here.
-	 */
-	return EOK;
-}
-
-static fs_index_t
-mfs_index_get(fs_node_t *fsnode)
-{
-	struct mfs_node *mnode = fsnode->data;
-	return mnode->ino_i->index;
-}
-
-static unsigned
-mfs_lnkcnt_get(fs_node_t *fsnode)
-{
-	struct mfs_node *mnode = fsnode->data;
-
-	mfsdebug("%s() %d\n", __FUNCTION__, mnode->ino_i->i_nlinks);
-
-	if (S_ISDIR(mnode->ino_i->i_mode)) {
-		if (mnode->ino_i->i_nlinks > 1)
-			return 1;
-		else
-			return 0;
-	} else
-		return mnode->ino_i->i_nlinks;
-}
-
-static errno_t
-mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst,
-    fs_index_t index)
-{
-	fs_node_t *node = NULL;
-	struct mfs_node *mnode = NULL;
-	errno_t rc;
-
-	fibril_mutex_lock(&open_nodes_lock);
-
-	/* Check if the node is not already open */
-	node_key_t key = {
-		.service_id = inst->service_id,
-		.index = index
-	};
-
-	ht_link_t *already_open = hash_table_find(&open_nodes, &key);
-
-	if (already_open) {
-		mnode = hash_table_get_inst(already_open, struct mfs_node, link);
-
-		*rfn = mnode->fsnode;
-		mnode->refcnt++;
-
-		fibril_mutex_unlock(&open_nodes_lock);
-		return EOK;
-	}
-
-	node = malloc(sizeof(fs_node_t));
-	if (!node) {
-		rc = ENOMEM;
-		goto out_err;
-	}
-
-	fs_node_initialize(node);
-
-	mnode = malloc(sizeof(*mnode));
-	if (!mnode) {
-		rc = ENOMEM;
-		goto out_err;
-	}
-
-	struct mfs_ino_info *ino_i;
-
-	rc = mfs_get_inode(inst, &ino_i, index);
-	if (rc != EOK)
-		goto out_err;
-
-	ino_i->index = index;
-	mnode->ino_i = ino_i;
-	mnode->refcnt = 1;
-
-	mnode->instance = inst;
-	node->data = mnode;
-	mnode->fsnode = node;
-	*rfn = node;
-
-	hash_table_insert(&open_nodes, &mnode->link);
-	inst->open_nodes_cnt++;
-
-	fibril_mutex_unlock(&open_nodes_lock);
-
-	return EOK;
-
-out_err:
-	if (node)
-		free(node);
-	if (mnode)
-		free(mnode);
-	fibril_mutex_unlock(&open_nodes_lock);
-	return rc;
-}
-
-static bool
-mfs_is_directory(fs_node_t *fsnode)
-{
-	const struct mfs_node *node = fsnode->data;
-	return S_ISDIR(node->ino_i->i_mode);
-}
-
-static bool
-mfs_is_file(fs_node_t *fsnode)
-{
-	struct mfs_node *node = fsnode->data;
-	return S_ISREG(node->ino_i->i_mode);
-}
-
-static errno_t
-mfs_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	errno_t rc = mfs_node_get(rfn, service_id, MFS_ROOT_INO);
-	return rc;
-}
-
-static errno_t
-mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	struct mfs_node *parent = pfn->data;
-	struct mfs_node *child = cfn->data;
-	struct mfs_sb_info *sbi = parent->instance->sbi;
-	bool destroy_dentry = false;
-
-	if (str_size(name) > sbi->max_name_len)
-		return ENAMETOOLONG;
-
-	errno_t r = mfs_insert_dentry(parent, name, child->ino_i->index);
-	if (r != EOK)
-		return r;
-
-	if (S_ISDIR(child->ino_i->i_mode)) {
-		if (child->ino_i->i_nlinks != 1) {
-			/* It's not possible to hardlink directories in MFS */
-			destroy_dentry = true;
-			r = EMLINK;
-			goto exit;
-		}
-		r = mfs_insert_dentry(child, ".", child->ino_i->index);
-		if (r != EOK) {
-			destroy_dentry = true;
-			goto exit;
-		}
-
-		r = mfs_insert_dentry(child, "..", parent->ino_i->index);
-		if (r != EOK) {
-			mfs_remove_dentry(child, ".");
-			destroy_dentry = true;
-			goto exit;
-		}
-
-		parent->ino_i->i_nlinks++;
-		parent->ino_i->dirty = true;
-	}
-
-exit:
-	if (destroy_dentry) {
-		errno_t r2 = mfs_remove_dentry(parent, name);
-		if (r2 != EOK)
-			r = r2;
-	} else {
-		child->ino_i->i_nlinks++;
-		child->ino_i->dirty = true;
-	}
-	return r;
-}
-
-static errno_t
-mfs_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	struct mfs_node *parent = pfn->data;
-	struct mfs_node *child = cfn->data;
-	bool has_children;
-	errno_t r;
-
-	if (!parent)
-		return EBUSY;
-
-	r = mfs_has_children(&has_children, cfn);
-	if (r != EOK)
-		return r;
-
-	if (has_children)
-		return ENOTEMPTY;
-
-	r = mfs_remove_dentry(parent, name);
-	if (r != EOK)
-		return r;
-
-	struct mfs_ino_info *chino = child->ino_i;
-
-	assert(chino->i_nlinks >= 1);
-	chino->i_nlinks--;
-	mfsdebug("Links: %d\n", chino->i_nlinks);
-
-	if (chino->i_nlinks <= 1 && S_ISDIR(chino->i_mode)) {
-		/*
-		 * The child directory will be destroyed, decrease the
-		 * parent hard links counter.
-		 */
-		parent->ino_i->i_nlinks--;
-		parent->ino_i->dirty = true;
-	}
-
-	chino->dirty = true;
-
-	return r;
-}
-
-static errno_t
-mfs_has_children(bool *has_children, fs_node_t *fsnode)
-{
-	struct mfs_node *mnode = fsnode->data;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	errno_t r;
-
-	*has_children = false;
-
-	if (!S_ISDIR(mnode->ino_i->i_mode))
-		goto out;
-
-	struct mfs_dentry_info d_info;
-
-	/* The first two dentries are always . and .. */
-	unsigned i;
-	for (i = 2; i < mnode->ino_i->i_size / sbi->dirsize; ++i) {
-		r = mfs_read_dentry(mnode, &d_info, i);
-		if (r != EOK)
-			return r;
-
-		if (d_info.d_inum) {
-			/* A valid entry has been found */
-			*has_children = true;
-			break;
-		}
-	}
-out:
-
-	return EOK;
-}
-
-static errno_t
-mfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	errno_t rc;
-	errno_t tmp;
-	fs_node_t *fn = NULL;
-
-	rc = mfs_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	struct mfs_node *mnode;
-	struct mfs_ino_info *ino_i;
-	size_t len, bytes = 0;
-	ipc_call_t call;
-
-	mnode = fn->data;
-	ino_i = mnode->ino_i;
-
-	if (!async_data_read_receive(&call, &len)) {
-		rc = EINVAL;
-		goto out_error;
-	}
-
-	if (S_ISDIR(ino_i->i_mode)) {
-		aoff64_t spos = pos;
-		struct mfs_dentry_info d_info;
-		struct mfs_sb_info *sbi = mnode->instance->sbi;
-
-		if (pos < 2) {
-			/* Skip the first two dentries ('.' and '..') */
-			pos = 2;
-		}
-
-		for (; pos < mnode->ino_i->i_size / sbi->dirsize; ++pos) {
-			rc = mfs_read_dentry(mnode, &d_info, pos);
-			if (rc != EOK)
-				goto out_error;
-
-			if (d_info.d_inum) {
-				/* Dentry found! */
-				goto found;
-			}
-		}
-
-		rc = mfs_node_put(fn);
-		async_answer_0(&call, rc != EOK ? rc : ENOENT);
-		return rc;
-	found:
-		async_data_read_finalize(&call, d_info.d_name,
-		    str_size(d_info.d_name) + 1);
-		bytes = ((pos - spos) + 1);
-	} else {
-		struct mfs_sb_info *sbi = mnode->instance->sbi;
-
-		if (pos >= (size_t) ino_i->i_size) {
-			/* Trying to read beyond the end of file */
-			bytes = 0;
-			(void) async_data_read_finalize(&call, NULL, 0);
-			goto out_success;
-		}
-
-		bytes = min(len, sbi->block_size - pos % sbi->block_size);
-		bytes = min(bytes, ino_i->i_size - pos);
-
-		uint32_t zone;
-		block_t *b;
-
-		rc = mfs_read_map(&zone, mnode, pos);
-		if (rc != EOK)
-			goto out_error;
-
-		if (zone == 0) {
-			/* sparse file */
-			uint8_t *buf = malloc(sbi->block_size);
-			if (!buf) {
-				rc = ENOMEM;
-				goto out_error;
-			}
-			memset(buf, 0, sizeof(sbi->block_size));
-			async_data_read_finalize(&call,
-			    buf + pos % sbi->block_size, bytes);
-			free(buf);
-			goto out_success;
-		}
-
-		rc = block_get(&b, service_id, zone, BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			goto out_error;
-
-		async_data_read_finalize(&call, b->data +
-		    pos % sbi->block_size, bytes);
-
-		rc = block_put(b);
-		if (rc != EOK) {
-			mfs_node_put(fn);
-			return rc;
-		}
-	}
-out_success:
-	rc = mfs_node_put(fn);
-	*rbytes = bytes;
-	return rc;
-out_error:
-	tmp = mfs_node_put(fn);
-	async_answer_0(&call, tmp != EOK ? tmp : rc);
-	return tmp != EOK ? tmp : rc;
-}
-
-static errno_t
-mfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	fs_node_t *fn;
-	errno_t r;
-	int flags = BLOCK_FLAGS_NONE;
-
-	r = mfs_node_get(&fn, service_id, index);
-	if (r != EOK)
-		return r;
-	if (!fn)
-		return ENOENT;
-
-	ipc_call_t call;
-	size_t len;
-
-	if (!async_data_write_receive(&call, &len)) {
-		r = EINVAL;
-		goto out_err;
-	}
-
-	struct mfs_node *mnode = fn->data;
-	struct mfs_sb_info *sbi = mnode->instance->sbi;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	const size_t bs = sbi->block_size;
-	size_t bytes = min(len, bs - (pos % bs));
-	uint32_t block;
-
-	if (bytes == bs)
-		flags = BLOCK_FLAGS_NOREAD;
-
-	r = mfs_read_map(&block, mnode, pos);
-	if (r != EOK)
-		goto out_err;
-
-	if (block == 0) {
-		uint32_t dummy;
-
-		r = mfs_alloc_zone(mnode->instance, &block);
-		if (r != EOK)
-			goto out_err;
-
-		r = mfs_write_map(mnode, pos, block, &dummy);
-		if (r != EOK) {
-			mfs_free_zone(mnode->instance, block);
-			goto out_err;
-		}
-
-		flags = BLOCK_FLAGS_NOREAD;
-	}
-
-	block_t *b;
-	r = block_get(&b, service_id, block, flags);
-	if (r != EOK)
-		goto out_err;
-
-	if (flags == BLOCK_FLAGS_NOREAD)
-		memset(b->data, 0, sbi->block_size);
-
-	async_data_write_finalize(&call, b->data + (pos % bs), bytes);
-	b->dirty = true;
-
-	r = block_put(b);
-	if (r != EOK) {
-		mfs_node_put(fn);
-		return r;
-	}
-
-	if (pos + bytes > ino_i->i_size) {
-		ino_i->i_size = pos + bytes;
-		ino_i->dirty = true;
-	}
-	r = mfs_node_put(fn);
-	*nsize = ino_i->i_size;
-	*wbytes = bytes;
-	return r;
-
-out_err:
-	mfs_node_put(fn);
-	async_answer_0(&call, r);
-	return r;
-}
-
-static errno_t
-mfs_destroy(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn = NULL;
-	errno_t r;
-
-	r = mfs_node_get(&fn, service_id, index);
-	if (r != EOK)
-		return r;
-	if (!fn)
-		return ENOENT;
-
-	/* Destroy the inode */
-	return mfs_destroy_node(fn);
-}
-
-static errno_t
-mfs_destroy_node(fs_node_t *fn)
-{
-	struct mfs_node *mnode = fn->data;
-	bool has_children;
-	errno_t r;
-
-	mfsdebug("mfs_destroy_node %d\n", mnode->ino_i->index);
-
-	r = mfs_has_children(&has_children, fn);
-	if (r != EOK)
-		goto out;
-
-	assert(!has_children);
-
-	/* Free the entire inode content */
-	r = mfs_inode_shrink(mnode, mnode->ino_i->i_size);
-	if (r != EOK)
-		goto out;
-
-	/* Mark the inode as free in the bitmap */
-	r = mfs_free_inode(mnode->instance, mnode->ino_i->index);
-
-out:
-	mfs_node_put(fn);
-	return r;
-}
-
-static errno_t
-mfs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size)
-{
-	fs_node_t *fn;
-	errno_t r;
-
-	r = mfs_node_get(&fn, service_id, index);
-	if (r != EOK)
-		return r;
-	if (!fn)
-		return r;
-
-	struct mfs_node *mnode = fn->data;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-
-	if (ino_i->i_size == size)
-		r = EOK;
-	else
-		r = mfs_inode_shrink(mnode, ino_i->i_size - size);
-
-	mfs_node_put(fn);
-	return r;
-}
-
-static errno_t
-mfs_instance_get(service_id_t service_id, struct mfs_instance **instance)
-{
-	void *data;
-	errno_t rc;
-
-	rc = fs_instance_get(service_id, &data);
-	if (rc == EOK)
-		*instance = (struct mfs_instance *) data;
-	else {
-		mfsdebug("instance not found\n");
-	}
-
-	return rc;
-}
-
-static bool
-check_magic_number(uint16_t magic, bool *native,
-    mfs_version_t *version, bool *longfilenames)
-{
-	bool rc = true;
-	*longfilenames = false;
-
-	if (magic == MFS_MAGIC_V1 || magic == MFS_MAGIC_V1R) {
-		*native = magic == MFS_MAGIC_V1;
-		*version = MFS_VERSION_V1;
-	} else if (magic == MFS_MAGIC_V1L || magic == MFS_MAGIC_V1LR) {
-		*native = magic == MFS_MAGIC_V1L;
-		*version = MFS_VERSION_V1;
-		*longfilenames = true;
-	} else if (magic == MFS_MAGIC_V2 || magic == MFS_MAGIC_V2R) {
-		*native = magic == MFS_MAGIC_V2;
-		*version = MFS_VERSION_V2;
-	} else if (magic == MFS_MAGIC_V2L || magic == MFS_MAGIC_V2LR) {
-		*native = magic == MFS_MAGIC_V2L;
-		*version = MFS_VERSION_V2;
-		*longfilenames = true;
-	} else if (magic == MFS_MAGIC_V3 || magic == MFS_MAGIC_V3R) {
-		*native = magic == MFS_MAGIC_V3;
-		*version = MFS_VERSION_V3;
-	} else
-		rc = false;
-
-	return rc;
-}
-
-/** Filesystem sanity check
- *
- * @param Pointer to the MFS superblock.
- *
- * @return EOK on success, ENOTSUP otherwise.
- */
-static errno_t
-mfs_check_sanity(struct mfs_sb_info *sbi)
-{
-	if (!is_power_of_two(sbi->block_size) ||
-	    sbi->block_size < MFS_MIN_BLOCKSIZE ||
-	    sbi->block_size > MFS_MAX_BLOCKSIZE)
-		return ENOTSUP;
-	else if (sbi->ibmap_blocks == 0 || sbi->zbmap_blocks == 0)
-		return ENOTSUP;
-	else if (sbi->ninodes == 0 || sbi->nzones == 0)
-		return ENOTSUP;
-	else if (sbi->firstdatazone == 0)
-		return ENOTSUP;
-
-	return EOK;
-}
-
-static errno_t
-mfs_close(service_id_t service_id, fs_index_t index)
-{
-	return 0;
-}
-
-static errno_t
-mfs_sync(service_id_t service_id, fs_index_t index)
-{
-	fs_node_t *fn = NULL;
-	errno_t rc = mfs_node_get(&fn, service_id, index);
-	if (rc != EOK)
-		return rc;
-	if (!fn)
-		return ENOENT;
-
-	struct mfs_node *mnode = fn->data;
-	mnode->ino_i->dirty = true;
-
-	return mfs_node_put(fn);
-}
-
-/** Check if a given number is a power of two.
- *
- * @param n	The number to check.
- *
- * @return	true if it is a power of two, false otherwise.
- */
-static bool
-is_power_of_two(uint32_t n)
-{
-	if (n == 0)
-		return false;
-
-	return (n & (n - 1)) == 0;
-}
-
-static errno_t
-mfs_size_block(service_id_t service_id, uint32_t *size)
-{
-	struct mfs_instance *inst;
-	errno_t rc;
-
-	rc = mfs_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	if (NULL == inst)
-		return ENOENT;
-
-	*size = inst->sbi->block_size;
-
-	return EOK;
-}
-
-static errno_t
-mfs_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	struct mfs_instance *inst;
-	errno_t rc;
-
-	rc = mfs_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	if (NULL == inst)
-		return ENOENT;
-
-	*count = (uint64_t) MFS_BMAP_SIZE_BITS(inst->sbi, BMAP_ZONE);
-
-	return EOK;
-}
-
-static errno_t
-mfs_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	uint32_t block_free;
-
-	struct mfs_instance *inst;
-	errno_t rc = mfs_instance_get(service_id, &inst);
-	if (rc != EOK)
-		return rc;
-
-	struct mfs_sb_info *sbi = inst->sbi;
-
-	if (!sbi->nfree_zones_valid) {
-		/*
-		 * The cached number of free zones is not valid,
-		 * we need to scan the bitmap to retrieve the
-		 * current value.
-		 */
-
-		rc = mfs_count_free_zones(inst, &block_free);
-		if (rc != EOK)
-			return rc;
-
-		sbi->nfree_zones = block_free;
-		sbi->nfree_zones_valid = true;
-	}
-
-	*count = sbi->nfree_zones;
-
-	return rc;
-}
-
-vfs_out_ops_t mfs_ops = {
-	.fsprobe = mfs_fsprobe,
-	.mounted = mfs_mounted,
-	.unmounted = mfs_unmounted,
-	.read = mfs_read,
-	.write = mfs_write,
-	.truncate = mfs_truncate,
-	.close = mfs_close,
-	.destroy = mfs_destroy,
-	.sync = mfs_sync,
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_rw.c
===================================================================
--- uspace/srv/fs/mfs/mfs_rw.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,408 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <align.h>
-#include "mfs.h"
-
-static errno_t
-rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
-    bool write_mode, uint32_t w_block);
-
-static errno_t
-reset_zone_content(struct mfs_instance *inst, uint32_t zone);
-
-static errno_t
-alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone);
-
-static errno_t
-read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone);
-
-static errno_t
-write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone);
-
-/**Given the position in the file expressed in
- * bytes, this function returns the on-disk block
- * relative to that position.
- *
- * @param b	Pointer to a 32bit number where the block number will be stored
- * @param mnode	Pointer to a generic MINIX inode in memory.
- * @param pos	Position in file.
- *
- * @return	EOK on success or an error code.
- */
-errno_t
-mfs_read_map(uint32_t *b, const struct mfs_node *mnode, uint32_t pos)
-{
-	errno_t r;
-	const struct mfs_sb_info *sbi = mnode->instance->sbi;
-	const int block_size = sbi->block_size;
-
-	/* Compute relative block number in file */
-	int rblock = pos / block_size;
-
-	if (ROUND_UP(mnode->ino_i->i_size, sbi->block_size) < pos) {
-		/* Trying to read beyond the end of file */
-		r = EOK;
-		*b = 0;
-		goto out;
-	}
-
-	r = rw_map_ondisk(b, mnode, rblock, false, 0);
-out:
-	return r;
-}
-
-errno_t
-mfs_write_map(struct mfs_node *mnode, const uint32_t pos, uint32_t new_zone,
-    uint32_t *old_zone)
-{
-	const struct mfs_sb_info *sbi = mnode->instance->sbi;
-
-	if (pos >= sbi->max_file_size) {
-		/* Can't write beyond the maximum file size */
-		return EINVAL;
-	}
-
-	/* Compute the relative block number in file */
-	int rblock = pos / sbi->block_size;
-
-	return rw_map_ondisk(old_zone, mnode, rblock, true, new_zone);
-}
-
-static errno_t
-rw_map_ondisk(uint32_t *b, const struct mfs_node *mnode, int rblock,
-    bool write_mode, uint32_t w_block)
-{
-	int nr_direct;
-	int ptrs_per_block;
-	uint32_t *ind_zone = NULL, *ind2_zone = NULL;
-	errno_t r = EOK;
-
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	struct mfs_instance *inst = mnode->instance;
-	struct mfs_sb_info *sbi = inst->sbi;
-
-	const mfs_version_t fs_version = sbi->fs_version;
-	const bool deleting = write_mode && (w_block == 0);
-
-	if (fs_version == MFS_VERSION_V1) {
-		nr_direct = V1_NR_DIRECT_ZONES;
-		ptrs_per_block = MFS_BLOCKSIZE / sizeof(uint16_t);
-	} else {
-		nr_direct = V2_NR_DIRECT_ZONES;
-		ptrs_per_block = sbi->block_size / sizeof(uint32_t);
-	}
-
-	/* Check if the wanted block is in the direct zones */
-	if (rblock < nr_direct) {
-		*b = ino_i->i_dzone[rblock];
-		if (write_mode) {
-			ino_i->i_dzone[rblock] = w_block;
-			ino_i->dirty = true;
-		}
-		goto out;
-	}
-
-	rblock -= nr_direct;
-
-	if (rblock < ptrs_per_block) {
-		/* The wanted block is in the single indirect zone chain */
-		if (ino_i->i_izone[0] == 0) {
-			if (write_mode && !deleting) {
-				uint32_t zone;
-				r = alloc_zone_and_clear(inst, &zone);
-				if (r != EOK)
-					goto out;
-
-				ino_i->i_izone[0] = zone;
-				ino_i->dirty = true;
-			} else {
-				/* Sparse block */
-				*b = 0;
-				goto out;
-			}
-		}
-
-		r = read_ind_zone(inst, ino_i->i_izone[0], &ind_zone);
-		if (r != EOK)
-			goto out;
-
-		*b = ind_zone[rblock];
-		if (write_mode) {
-			ind_zone[rblock] = w_block;
-			write_ind_zone(inst, ino_i->i_izone[0], ind_zone);
-		}
-
-		goto out;
-	}
-
-	rblock -= ptrs_per_block;
-
-	/* The wanted block is in the double indirect zone chain */
-
-	/* Read the first indirect zone of the chain */
-	if (ino_i->i_izone[1] == 0) {
-		if (write_mode && !deleting) {
-			uint32_t zone;
-			r = alloc_zone_and_clear(inst, &zone);
-			if (r != EOK)
-				goto out;
-
-			ino_i->i_izone[1] = zone;
-			ino_i->dirty = true;
-		} else {
-			/* Sparse block */
-			*b = 0;
-			goto out;
-		}
-	}
-
-	r = read_ind_zone(inst, ino_i->i_izone[1], &ind_zone);
-	if (r != EOK)
-		goto out;
-
-	/*
-	 * Compute the position of the second indirect
-	 * zone pointer in the chain.
-	 */
-	uint32_t ind2_off = rblock / ptrs_per_block;
-
-	/* read the second indirect zone of the chain */
-	if (ind_zone[ind2_off] == 0) {
-		if (write_mode && !deleting) {
-			uint32_t zone;
-			r = alloc_zone_and_clear(inst, &zone);
-			if (r != EOK)
-				goto out;
-
-			ind_zone[ind2_off] = zone;
-			write_ind_zone(inst, ino_i->i_izone[1], ind_zone);
-		} else {
-			/* Sparse block */
-			*b = 0;
-			goto out;
-		}
-	}
-
-	r = read_ind_zone(inst, ind_zone[ind2_off], &ind2_zone);
-	if (r != EOK)
-		goto out;
-
-	*b = ind2_zone[rblock - (ind2_off * ptrs_per_block)];
-	if (write_mode) {
-		ind2_zone[rblock - (ind2_off * ptrs_per_block)] = w_block;
-		write_ind_zone(inst, ind_zone[ind2_off], ind2_zone);
-	}
-
-out:
-	free(ind2_zone);
-	free(ind_zone);
-	return r;
-}
-
-/**Free unused indirect zones from a MINIX inode according to its new size.
- *
- * @param mnode		Pointer to a generic MINIX inode in memory.
- * @param new_size	The new size of the inode.
- *
- * @return		EOK on success or an error code.
- */
-errno_t
-mfs_prune_ind_zones(struct mfs_node *mnode, size_t new_size)
-{
-	struct mfs_instance *inst = mnode->instance;
-	struct mfs_sb_info *sbi = inst->sbi;
-	struct mfs_ino_info *ino_i = mnode->ino_i;
-	int nr_direct, ptrs_per_block, rblock;
-	errno_t r;
-	int i;
-
-	mfs_version_t fs_version = sbi->fs_version;
-
-	assert(new_size <= ino_i->i_size);
-
-	if (fs_version == MFS_VERSION_V1) {
-		nr_direct = V1_NR_DIRECT_ZONES;
-		ptrs_per_block = MFS_BLOCKSIZE / sizeof(uint16_t);
-	} else {
-		nr_direct = V2_NR_DIRECT_ZONES;
-		ptrs_per_block = sbi->block_size / sizeof(uint32_t);
-	}
-
-	rblock = new_size / sbi->block_size;
-
-	if (rblock < nr_direct) {
-		/* Free the single indirect zone */
-		if (ino_i->i_izone[0]) {
-			r = mfs_free_zone(inst, ino_i->i_izone[0]);
-			if (r != EOK)
-				return r;
-
-			ino_i->i_izone[0] = 0;
-			ino_i->dirty = true;
-		}
-	}
-
-	rblock -= nr_direct + ptrs_per_block;
-
-	int fzone_to_free = (rblock < 0 ? 0 : rblock) / ptrs_per_block;
-
-	if ((fzone_to_free % ptrs_per_block) != 0)
-		++fzone_to_free;
-
-	/* Free the entire double indirect zone */
-	uint32_t *dbl_zone;
-
-	if (ino_i->i_izone[1] == 0) {
-		/* Nothing to be done */
-		return EOK;
-	}
-
-	r = read_ind_zone(inst, ino_i->i_izone[1], &dbl_zone);
-	if (r != EOK)
-		return r;
-
-	for (i = fzone_to_free; i < ptrs_per_block; ++i) {
-		if (dbl_zone[i] == 0)
-			continue;
-
-		r = mfs_free_zone(inst, dbl_zone[i]);
-		if (r != EOK)
-			goto out;
-	}
-
-	if (fzone_to_free == 0) {
-		r = mfs_free_zone(inst, ino_i->i_izone[1]);
-		ino_i->i_izone[1] = 0;
-		ino_i->dirty = true;
-	}
-out:
-	free(dbl_zone);
-	return r;
-}
-
-static errno_t
-reset_zone_content(struct mfs_instance *inst, uint32_t zone)
-{
-	block_t *b;
-	errno_t r;
-
-	r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD);
-	if (r != EOK)
-		return r;
-
-	memset(b->data, 0, b->size);
-	b->dirty = true;
-
-	return block_put(b);
-}
-
-static errno_t
-alloc_zone_and_clear(struct mfs_instance *inst, uint32_t *zone)
-{
-	errno_t r;
-
-	r = mfs_alloc_zone(inst, zone);
-	if (r != EOK)
-		return r;
-
-	r = reset_zone_content(inst, *zone);
-	return r;
-}
-
-static errno_t
-read_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t **ind_zone)
-{
-	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
-	unsigned i;
-	block_t *b;
-	const int max_ind_zone_ptrs = (MFS_MAX_BLOCKSIZE / sizeof(uint16_t)) *
-	    sizeof(uint32_t);
-
-	*ind_zone = malloc(max_ind_zone_ptrs);
-	if (*ind_zone == NULL)
-		return ENOMEM;
-
-	r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NONE);
-	if (r != EOK) {
-		free(*ind_zone);
-		return r;
-	}
-
-	if (sbi->fs_version == MFS_VERSION_V1) {
-		uint16_t *src_ptr = b->data;
-
-		for (i = 0; i < sbi->block_size / sizeof(uint16_t); ++i)
-			(*ind_zone)[i] = conv16(sbi->native, src_ptr[i]);
-	} else {
-		uint32_t *src_ptr = b->data;
-
-		for (i = 0; i < sbi->block_size / sizeof(uint32_t); ++i)
-			(*ind_zone)[i] = conv32(sbi->native, src_ptr[i]);
-	}
-
-	return block_put(b);
-}
-
-static errno_t
-write_ind_zone(struct mfs_instance *inst, uint32_t zone, uint32_t *ind_zone)
-{
-	struct mfs_sb_info *sbi = inst->sbi;
-	errno_t r;
-	unsigned i;
-	block_t *b;
-
-	r = block_get(&b, inst->service_id, zone, BLOCK_FLAGS_NOREAD);
-	if (r != EOK)
-		return r;
-
-	if (sbi->fs_version == MFS_VERSION_V1) {
-		uint16_t *dest_ptr = b->data;
-
-		for (i = 0; i < sbi->block_size / sizeof(uint16_t); ++i)
-			dest_ptr[i] = conv16(sbi->native, ind_zone[i]);
-	} else {
-		uint32_t *dest_ptr = b->data;
-
-		for (i = 0; i < sbi->block_size / sizeof(uint32_t); ++i)
-			dest_ptr[i] = conv32(sbi->native, ind_zone[i]);
-
-	}
-	b->dirty = true;
-
-	return block_put(b);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/mfs/mfs_utils.c
===================================================================
--- uspace/srv/fs/mfs/mfs_utils.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2011 Maurizio Lombardi
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mfs
- * @{
- */
-
-#include <byteorder.h>
-#include "mfs.h"
-
-uint16_t
-conv16(bool native, uint16_t n)
-{
-	if (native)
-		return n;
-
-	return uint16_t_byteorder_swap(n);
-}
-
-uint32_t
-conv32(bool native, uint32_t n)
-{
-	if (native)
-		return n;
-
-	return uint32_t_byteorder_swap(n);
-}
-
-uint64_t
-conv64(bool native, uint64_t n)
-{
-	if (native)
-		return n;
-
-	return uint64_t_byteorder_swap(n);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/tmpfs/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/tmpfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup tmpfs tmpfs
- * @ingroup srvs
- * @brief File system driver for in-memory file system
- */
Index: pace/srv/fs/tmpfs/meson.build
===================================================================
--- uspace/srv/fs/tmpfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs' ]
-src = files(
-	'tmpfs.c',
-	'tmpfs_ops.c',
-)
Index: pace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmpfs
- * @{
- */
-
-/**
- * @file	tmpfs.c
- * @brief	File system driver for in-memory file system.
- *
- * Every instance of tmpfs exists purely in memory and has neither a disk layout
- * nor any permanent storage (e.g. disk blocks). With each system reboot, data
- * stored in a tmpfs file system is lost.
- */
-
-#include "tmpfs.h"
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <task.h>
-#include <libfs.h>
-#include <str.h>
-#include "../../vfs/vfs.h"
-
-#define NAME  "tmpfs"
-
-vfs_info_t tmpfs_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS TMPFS file system server\n", NAME);
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			tmpfs_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			printf("%s: Unrecognized parameters", NAME);
-			return -1;
-		}
-	}
-
-	if (!tmpfs_init()) {
-		printf("%s: Failed to initialize TMPFS\n", NAME);
-		return -1;
-	}
-
-	errno_t rc;
-	async_sess_t *vfs_sess = service_connect_blocking(SERVICE_VFS,
-	    INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		printf("%s: Unable to connect to VFS: %s\n", NAME, str_error(rc));
-		return -1;
-	}
-
-	rc = fs_register(vfs_sess, &tmpfs_vfs_info, &tmpfs_ops,
-	    &tmpfs_libfs_ops);
-	if (rc != EOK) {
-		printf("%s: Failed to register file system: %s\n", NAME,
-		    str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/tmpfs/tmpfs.h
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmpfs
- * @{
- */
-
-#ifndef TMPFS_TMPFS_H_
-#define TMPFS_TMPFS_H_
-
-#include <libfs.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include <adt/hash_table.h>
-
-#define TMPFS_NODE(node)	((node) ? (tmpfs_node_t *)(node)->data : NULL)
-#define FS_NODE(node)		((node) ? (node)->bp : NULL)
-
-typedef enum {
-	TMPFS_NONE,
-	TMPFS_FILE,
-	TMPFS_DIRECTORY
-} tmpfs_dentry_type_t;
-
-/* forward declaration */
-struct tmpfs_node;
-
-typedef struct tmpfs_dentry {
-	link_t link;		/**< Linkage for the list of siblings. */
-	struct tmpfs_node *node;/**< Back pointer to TMPFS node. */
-	char *name;		/**< Name of dentry. */
-} tmpfs_dentry_t;
-
-typedef struct tmpfs_node {
-	fs_node_t *bp;		/**< Back pointer to the FS node. */
-	fs_index_t index;	/**< TMPFS node index. */
-	service_id_t service_id;/**< Service ID of block device. */
-	ht_link_t nh_link;		/**< Nodes hash table link. */
-	tmpfs_dentry_type_t type;
-	unsigned lnkcnt;	/**< Link count. */
-	size_t size;		/**< File size if type is TMPFS_FILE. */
-	void *data;		/**< File content's if type is TMPFS_FILE. */
-	list_t cs_list;		/**< Child's siblings list. */
-} tmpfs_node_t;
-
-extern vfs_out_ops_t tmpfs_ops;
-extern libfs_ops_t tmpfs_libfs_ops;
-
-extern bool tmpfs_init(void);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,669 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tmpfs
- * @{
- */
-
-/**
- * @file	tmpfs_ops.c
- * @brief	Implementation of VFS operations for the TMPFS file system
- *		server.
- */
-
-#include "tmpfs.h"
-#include <macros.h>
-#include <stdint.h>
-#include <async.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stddef.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <as.h>
-#include <libfs.h>
-
-/** All root nodes have index 0. */
-#define TMPFS_SOME_ROOT  0
-
-/** Global counter for assigning node indices. Shared by all instances. */
-fs_index_t tmpfs_next_index = 1;
-
-/*
- * Implementation of the libfs interface.
- */
-
-/* Forward declarations of static functions. */
-static errno_t tmpfs_match(fs_node_t **, fs_node_t *, const char *);
-static errno_t tmpfs_node_get(fs_node_t **, service_id_t, fs_index_t);
-static errno_t tmpfs_node_open(fs_node_t *);
-static errno_t tmpfs_node_put(fs_node_t *);
-static errno_t tmpfs_create_node(fs_node_t **, service_id_t, int);
-static errno_t tmpfs_destroy_node(fs_node_t *);
-static errno_t tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
-static errno_t tmpfs_unlink_node(fs_node_t *, fs_node_t *, const char *);
-
-/* Implementation of helper functions. */
-static errno_t tmpfs_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	return tmpfs_node_get(rfn, service_id, TMPFS_SOME_ROOT);
-}
-
-static errno_t tmpfs_has_children(bool *has_children, fs_node_t *fn)
-{
-	*has_children = !list_empty(&TMPFS_NODE(fn)->cs_list);
-	return EOK;
-}
-
-static fs_index_t tmpfs_index_get(fs_node_t *fn)
-{
-	return TMPFS_NODE(fn)->index;
-}
-
-static aoff64_t tmpfs_size_get(fs_node_t *fn)
-{
-	return TMPFS_NODE(fn)->size;
-}
-
-static unsigned tmpfs_lnkcnt_get(fs_node_t *fn)
-{
-	return TMPFS_NODE(fn)->lnkcnt;
-}
-
-static bool tmpfs_is_directory(fs_node_t *fn)
-{
-	return TMPFS_NODE(fn)->type == TMPFS_DIRECTORY;
-}
-
-static bool tmpfs_is_file(fs_node_t *fn)
-{
-	return TMPFS_NODE(fn)->type == TMPFS_FILE;
-}
-
-static service_id_t tmpfs_service_get(fs_node_t *fn)
-{
-	return 0;
-}
-
-/** libfs operations */
-libfs_ops_t tmpfs_libfs_ops = {
-	.root_get = tmpfs_root_get,
-	.match = tmpfs_match,
-	.node_get = tmpfs_node_get,
-	.node_open = tmpfs_node_open,
-	.node_put = tmpfs_node_put,
-	.create = tmpfs_create_node,
-	.destroy = tmpfs_destroy_node,
-	.link = tmpfs_link_node,
-	.unlink = tmpfs_unlink_node,
-	.has_children = tmpfs_has_children,
-	.index_get = tmpfs_index_get,
-	.size_get = tmpfs_size_get,
-	.lnkcnt_get = tmpfs_lnkcnt_get,
-	.is_directory = tmpfs_is_directory,
-	.is_file = tmpfs_is_file,
-	.service_get = tmpfs_service_get
-};
-
-/** Hash table of all TMPFS nodes. */
-hash_table_t nodes;
-
-/*
- * Implementation of hash table interface for the nodes hash table.
- */
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} node_key_t;
-
-static size_t nodes_key_hash(const void *k)
-{
-	const node_key_t *key = k;
-	return hash_combine(key->service_id, key->index);
-}
-
-static size_t nodes_hash(const ht_link_t *item)
-{
-	tmpfs_node_t *nodep = hash_table_get_inst(item, tmpfs_node_t, nh_link);
-	return hash_combine(nodep->service_id, nodep->index);
-}
-
-static bool nodes_key_equal(const void *key_arg, size_t hash,
-    const ht_link_t *item)
-{
-	tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link);
-	const node_key_t *key = key_arg;
-
-	return key->service_id == node->service_id && key->index == node->index;
-}
-
-static void nodes_remove_callback(ht_link_t *item)
-{
-	tmpfs_node_t *nodep = hash_table_get_inst(item, tmpfs_node_t, nh_link);
-
-	while (!list_empty(&nodep->cs_list)) {
-		tmpfs_dentry_t *dentryp = list_get_instance(
-		    list_first(&nodep->cs_list), tmpfs_dentry_t, link);
-
-		assert(nodep->type == TMPFS_DIRECTORY);
-		list_remove(&dentryp->link);
-		free(dentryp);
-	}
-
-	if (nodep->data) {
-		assert(nodep->type == TMPFS_FILE);
-		free(nodep->data);
-	}
-	free(nodep->bp);
-	free(nodep);
-}
-
-/** TMPFS nodes hash table operations. */
-const hash_table_ops_t nodes_ops = {
-	.hash = nodes_hash,
-	.key_hash = nodes_key_hash,
-	.key_equal = nodes_key_equal,
-	.equal = NULL,
-	.remove_callback = nodes_remove_callback
-};
-
-static void tmpfs_node_initialize(tmpfs_node_t *nodep)
-{
-	nodep->bp = NULL;
-	nodep->index = 0;
-	nodep->service_id = 0;
-	nodep->type = TMPFS_NONE;
-	nodep->lnkcnt = 0;
-	nodep->size = 0;
-	nodep->data = NULL;
-	list_initialize(&nodep->cs_list);
-}
-
-static void tmpfs_dentry_initialize(tmpfs_dentry_t *dentryp)
-{
-	link_initialize(&dentryp->link);
-	dentryp->name = NULL;
-	dentryp->node = NULL;
-}
-
-bool tmpfs_init(void)
-{
-	if (!hash_table_create(&nodes, 0, 0, &nodes_ops))
-		return false;
-
-	return true;
-}
-
-static bool tmpfs_instance_init(service_id_t service_id)
-{
-	fs_node_t *rfn;
-	errno_t rc;
-
-	rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY);
-	if (rc != EOK || !rfn)
-		return false;
-	TMPFS_NODE(rfn)->lnkcnt = 0;	/* FS root is not linked */
-	return true;
-}
-
-static bool rm_service_id_nodes(ht_link_t *item, void *arg)
-{
-	service_id_t sid = *(service_id_t *)arg;
-	tmpfs_node_t *node = hash_table_get_inst(item, tmpfs_node_t, nh_link);
-
-	if (node->service_id == sid) {
-		hash_table_remove_item(&nodes, &node->nh_link);
-	}
-	return true;
-}
-
-static void tmpfs_instance_done(service_id_t service_id)
-{
-	hash_table_apply(&nodes, rm_service_id_nodes, &service_id);
-}
-
-errno_t tmpfs_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
-
-	list_foreach(parentp->cs_list, link, tmpfs_dentry_t, dentryp) {
-		if (!str_cmp(dentryp->name, component)) {
-			*rfn = FS_NODE(dentryp->node);
-			return EOK;
-		}
-	}
-
-	*rfn = NULL;
-	return EOK;
-}
-
-errno_t tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index)
-{
-	node_key_t key = {
-		.service_id = service_id,
-		.index = index
-	};
-
-	ht_link_t *lnk = hash_table_find(&nodes, &key);
-
-	if (lnk) {
-		tmpfs_node_t *nodep;
-		nodep = hash_table_get_inst(lnk, tmpfs_node_t, nh_link);
-		*rfn = FS_NODE(nodep);
-	} else {
-		*rfn = NULL;
-	}
-	return EOK;
-}
-
-errno_t tmpfs_node_open(fs_node_t *fn)
-{
-	/* nothing to do */
-	return EOK;
-}
-
-errno_t tmpfs_node_put(fs_node_t *fn)
-{
-	/* nothing to do */
-	return EOK;
-}
-
-errno_t tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag)
-{
-	fs_node_t *rootfn;
-	errno_t rc;
-
-	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
-
-	tmpfs_node_t *nodep = malloc(sizeof(tmpfs_node_t));
-	if (!nodep)
-		return ENOMEM;
-
-	tmpfs_node_initialize(nodep);
-	nodep->bp = malloc(sizeof(fs_node_t));
-	if (!nodep->bp) {
-		free(nodep);
-		return ENOMEM;
-	}
-
-	fs_node_initialize(nodep->bp);
-	nodep->bp->data = nodep;  /* Link the FS and TMPFS nodes */
-
-	rc = tmpfs_root_get(&rootfn, service_id);
-	assert(rc == EOK);
-	if (!rootfn)
-		nodep->index = TMPFS_SOME_ROOT;
-	else
-		nodep->index = tmpfs_next_index++;
-
-	nodep->service_id = service_id;
-	if (lflag & L_DIRECTORY)
-		nodep->type = TMPFS_DIRECTORY;
-	else
-		nodep->type = TMPFS_FILE;
-
-	/* Insert the new node into the nodes hash table. */
-	hash_table_insert(&nodes, &nodep->nh_link);
-	*rfn = FS_NODE(nodep);
-	return EOK;
-}
-
-errno_t tmpfs_destroy_node(fs_node_t *fn)
-{
-	tmpfs_node_t *nodep = TMPFS_NODE(fn);
-
-	assert(!nodep->lnkcnt);
-	assert(list_empty(&nodep->cs_list));
-
-	hash_table_remove_item(&nodes, &nodep->nh_link);
-
-	/*
-	 * The nodes_remove_callback() function takes care of the actual
-	 * resource deallocation.
-	 */
-	return EOK;
-}
-
-errno_t tmpfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
-	tmpfs_node_t *childp = TMPFS_NODE(cfn);
-	tmpfs_dentry_t *dentryp;
-
-	assert(parentp->type == TMPFS_DIRECTORY);
-
-	/* Check for duplicit entries. */
-	list_foreach(parentp->cs_list, link, tmpfs_dentry_t, dp) {
-		if (!str_cmp(dp->name, nm))
-			return EEXIST;
-	}
-
-	/* Allocate and initialize the dentry. */
-	dentryp = malloc(sizeof(tmpfs_dentry_t));
-	if (!dentryp)
-		return ENOMEM;
-	tmpfs_dentry_initialize(dentryp);
-
-	/* Populate and link the new dentry. */
-	size_t size = str_size(nm);
-	dentryp->name = malloc(size + 1);
-	if (!dentryp->name) {
-		free(dentryp);
-		return ENOMEM;
-	}
-	str_cpy(dentryp->name, size + 1, nm);
-	dentryp->node = childp;
-	childp->lnkcnt++;
-	list_append(&dentryp->link, &parentp->cs_list);
-
-	return EOK;
-}
-
-errno_t tmpfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	tmpfs_node_t *parentp = TMPFS_NODE(pfn);
-	tmpfs_node_t *childp = NULL;
-	tmpfs_dentry_t *dentryp;
-
-	if (!parentp)
-		return EBUSY;
-
-	list_foreach(parentp->cs_list, link, tmpfs_dentry_t, dp) {
-		if (!str_cmp(dp->name, nm)) {
-			dentryp = dp;
-			childp = dentryp->node;
-			assert(FS_NODE(childp) == cfn);
-			break;
-		}
-	}
-
-	if (!childp)
-		return ENOENT;
-
-	if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list))
-		return ENOTEMPTY;
-
-	list_remove(&dentryp->link);
-	free(dentryp);
-	childp->lnkcnt--;
-
-	return EOK;
-}
-
-/*
- * Implementation of the VFS_OUT interface.
- */
-
-static errno_t tmpfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	return ENOTSUP;
-}
-
-static errno_t
-tmpfs_mounted(service_id_t service_id, const char *opts, fs_index_t *index,
-    aoff64_t *size)
-{
-	fs_node_t *rootfn;
-	errno_t rc;
-
-	/* Check if this device is not already mounted. */
-	rc = tmpfs_root_get(&rootfn, service_id);
-	if ((rc == EOK) && (rootfn)) {
-		(void) tmpfs_node_put(rootfn);
-		return EEXIST;
-	}
-
-	/* Initialize TMPFS instance. */
-	if (!tmpfs_instance_init(service_id))
-		return ENOMEM;
-
-	rc = tmpfs_root_get(&rootfn, service_id);
-	assert(rc == EOK);
-	tmpfs_node_t *rootp = TMPFS_NODE(rootfn);
-
-	*index = rootp->index;
-	*size = rootp->size;
-
-	return EOK;
-}
-
-static errno_t tmpfs_unmounted(service_id_t service_id)
-{
-	tmpfs_instance_done(service_id);
-	return EOK;
-}
-
-static errno_t tmpfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	/*
-	 * Lookup the respective TMPFS node.
-	 */
-	node_key_t key = {
-		.service_id = service_id,
-		.index = index
-	};
-
-	ht_link_t *hlp = hash_table_find(&nodes, &key);
-	if (!hlp)
-		return ENOENT;
-
-	tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
-
-	/*
-	 * Receive the read request.
-	 */
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	size_t bytes;
-	if (nodep->type == TMPFS_FILE) {
-		bytes = min(nodep->size - pos, size);
-		(void) async_data_read_finalize(&call, nodep->data + pos,
-		    bytes);
-	} else {
-		tmpfs_dentry_t *dentryp;
-		link_t *lnk;
-
-		assert(nodep->type == TMPFS_DIRECTORY);
-
-		/*
-		 * Yes, we really use O(n) algorithm here.
-		 * If it bothers someone, it could be fixed by introducing a
-		 * hash table.
-		 */
-		lnk = list_nth(&nodep->cs_list, pos);
-
-		if (lnk == NULL) {
-			async_answer_0(&call, ENOENT);
-			return ENOENT;
-		}
-
-		dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
-
-		(void) async_data_read_finalize(&call, dentryp->name,
-		    str_size(dentryp->name) + 1);
-		bytes = 1;
-	}
-
-	*rbytes = bytes;
-	return EOK;
-}
-
-static errno_t
-tmpfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	/*
-	 * Lookup the respective TMPFS node.
-	 */
-	node_key_t key = {
-		.service_id = service_id,
-		.index = index
-	};
-
-	ht_link_t *hlp = hash_table_find(&nodes, &key);
-
-	if (!hlp)
-		return ENOENT;
-
-	tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
-
-	/*
-	 * Receive the write request.
-	 */
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		return EINVAL;
-	}
-
-	/*
-	 * Check whether the file needs to grow.
-	 */
-	if (pos + size <= nodep->size) {
-		/* The file size is not changing. */
-		(void) async_data_write_finalize(&call, nodep->data + pos,
-		    size);
-		goto out;
-	}
-	size_t delta = (pos + size) - nodep->size;
-	/*
-	 * At this point, we are deliberately extremely straightforward and
-	 * simply realloc the contents of the file on every write that grows the
-	 * file. In the end, the situation might not be as bad as it may look:
-	 * our heap allocator can save us and just grow the block whenever
-	 * possible.
-	 */
-	void *newdata = realloc(nodep->data, nodep->size + delta);
-	if (!newdata) {
-		async_answer_0(&call, ENOMEM);
-		size = 0;
-		goto out;
-	}
-	/* Clear any newly allocated memory in order to emulate gaps. */
-	memset(newdata + nodep->size, 0, delta);
-	nodep->size += delta;
-	nodep->data = newdata;
-	(void) async_data_write_finalize(&call, nodep->data + pos, size);
-
-out:
-	*wbytes = size;
-	*nsize = nodep->size;
-	return EOK;
-}
-
-static errno_t tmpfs_truncate(service_id_t service_id, fs_index_t index,
-    aoff64_t size)
-{
-	/*
-	 * Lookup the respective TMPFS node.
-	 */
-	node_key_t key = {
-		.service_id = service_id,
-		.index = index
-	};
-
-	ht_link_t *hlp = hash_table_find(&nodes, &key);
-	if (!hlp)
-		return ENOENT;
-	tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t, nh_link);
-
-	if (size == nodep->size)
-		return EOK;
-
-	if (size > SIZE_MAX)
-		return ENOMEM;
-
-	void *newdata = realloc(nodep->data, size);
-	if (!newdata && size)
-		return ENOMEM;
-
-	if (size > nodep->size) {
-		size_t delta = size - nodep->size;
-		memset(newdata + nodep->size, 0, delta);
-	}
-
-	nodep->size = size;
-	nodep->data = newdata;
-	return EOK;
-}
-
-static errno_t tmpfs_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t tmpfs_destroy(service_id_t service_id, fs_index_t index)
-{
-	node_key_t key = {
-		.service_id = service_id,
-		.index = index
-	};
-
-	ht_link_t *hlp = hash_table_find(&nodes, &key);
-	if (!hlp)
-		return ENOENT;
-	tmpfs_node_t *nodep = hash_table_get_inst(hlp, tmpfs_node_t,
-	    nh_link);
-	return tmpfs_destroy_node(FS_NODE(nodep));
-}
-
-static errno_t tmpfs_sync(service_id_t service_id, fs_index_t index)
-{
-	/*
-	 * TMPFS keeps its data structures always consistent,
-	 * thus the sync operation is a no-op.
-	 */
-	return EOK;
-}
-
-vfs_out_ops_t tmpfs_ops = {
-	.fsprobe = tmpfs_fsprobe,
-	.mounted = tmpfs_mounted,
-	.unmounted = tmpfs_unmounted,
-	.read = tmpfs_read,
-	.write = tmpfs_write,
-	.truncate = tmpfs_truncate,
-	.close = tmpfs_close,
-	.destroy = tmpfs_destroy,
-	.sync = tmpfs_sync,
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/doc/doxygroups.h
===================================================================
--- uspace/srv/fs/udf/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup udf udf
- * @ingroup srvs
- * @brief UDF 1.02 file system driver
- */
Index: pace/srv/fs/udf/meson.build
===================================================================
--- uspace/srv/fs/udf/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,40 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# Copyright (c) 2012 Julia Medvedeva
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'fs' ]
-src = files(
-	'udf.c',
-	'udf_volume.c',
-	'udf_ops.c',
-	'udf_osta.c',
-	'udf_cksum.c',
-	'udf_file.c',
-	'udf_idx.c',
-)
Index: pace/srv/fs/udf/udf.c
===================================================================
--- uspace/srv/fs/udf/udf.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2006 Martin Decky
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf.c
- * @brief UDF 1.02 file system driver for HelenOS.
- */
-
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-#include <libfs.h>
-#include <str.h>
-#include <io/log.h>
-#include "../../vfs/vfs.h"
-#include "udf.h"
-#include "udf_idx.h"
-
-#define NAME  "udf"
-
-vfs_info_t udf_vfs_info = {
-	.name = NAME,
-	.concurrent_read_write = false,
-	.write_retains_size = false,
-	.instance = 0,
-};
-
-int main(int argc, char *argv[])
-{
-	log_init(NAME);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "HelenOS UDF 1.02 file system server");
-
-	if (argc == 3) {
-		if (!str_cmp(argv[1], "--instance"))
-			udf_vfs_info.instance = strtol(argv[2], NULL, 10);
-		else {
-			log_msg(LOG_DEFAULT, LVL_FATAL, "Unrecognized parameters");
-			return 1;
-		}
-	}
-
-	errno_t rc;
-	async_sess_t *vfs_sess =
-	    service_connect_blocking(SERVICE_VFS, INTERFACE_VFS_DRIVER, 0, &rc);
-	if (!vfs_sess) {
-		log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to connect to VFS: %s",
-		    str_error(rc));
-		return 2;
-	}
-
-	rc = fs_register(vfs_sess, &udf_vfs_info, &udf_ops,
-	    &udf_libfs_ops);
-	if (rc != EOK)
-		goto err;
-
-	rc = udf_idx_init();
-	if (rc != EOK)
-		goto err;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Accepting connections");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-
-err:
-	log_msg(LOG_DEFAULT, LVL_FATAL, "Failed to register file system: %s", str_error(rc));
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf.h
===================================================================
--- uspace/srv/fs/udf/udf.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-
-#ifndef UDF_UDF_H_
-#define UDF_UDF_H_
-
-#include <fibril_synch.h>
-#include <libfs.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include "../../vfs/vfs.h"
-#include "udf_types.h"
-#include <adt/hash_table.h>
-
-#define UDF_NODE(node) \
-	((node) ? (udf_node_t *) (node)->data : NULL)
-
-#define FS_NODE(node) \
-	((node) ? (fs_node_t *) ((node)->fs_node) : NULL)
-
-#define BS_BLOCK     0
-#define DEFAULT_VOL  0
-
-#define NODE_DIR   0
-#define NODE_FILE  1
-
-#define MAX_FILE_NAME_LEN  512
-
-#define MIN_FID_LEN  38
-
-#define SPACE_TABLE   0
-#define SPACE_BITMAP  1
-
-typedef struct udf_partition {
-	/* Partition info */
-	uint16_t number;
-	uint32_t access_type;
-	uint32_t start;
-	uint32_t length;
-} udf_partition_t;
-
-typedef struct udf_lvolume {
-	udf_partition_t **partitions;
-	size_t partition_cnt;
-	uint32_t logical_block_size;
-	fs_index_t root_dir;
-} udf_lvolume_t;
-
-typedef struct {
-	service_id_t service_id;
-	size_t open_nodes_count;
-	udf_charspec_t charset;
-
-	uint32_t sector_size;
-	udf_lvolume_t *volumes;
-	udf_partition_t *partitions;
-	size_t partition_cnt;
-	udf_unallocated_space_descriptor_t *uasd;
-	uint64_t uaspace_start;
-	uint64_t uaspace_length;
-	uint8_t space_type;
-} udf_instance_t;
-
-typedef struct udf_allocator {
-	uint32_t length;
-	uint32_t position;
-} udf_allocator_t;
-
-typedef struct udf_node {
-	udf_instance_t *instance;
-	fs_node_t *fs_node;
-	fibril_mutex_t lock;
-
-	fs_index_t index;  /* FID logical block */
-	ht_link_t link;
-	size_t ref_cnt;
-	size_t link_cnt;
-
-	uint8_t type;  /* 1 - file, 0 - directory */
-	uint64_t data_size;
-	uint8_t *data;
-	udf_allocator_t *allocators;
-	size_t alloc_size;
-} udf_node_t;
-
-extern vfs_out_ops_t udf_ops;
-extern libfs_ops_t udf_libfs_ops;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_cksum.c
===================================================================
--- uspace/srv/fs/udf/udf_cksum.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_cksum.c
- * @brief Implementation of various checksum functions.
- */
-
-#include "udf_cksum.h"
-
-/** CRC 010041 */
-static uint16_t crc_table[256] = {
-	0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
-	0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
-	0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
-	0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
-	0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
-	0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
-	0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
-	0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
-	0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
-	0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
-	0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
-	0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
-	0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
-	0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
-	0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
-	0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
-	0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
-	0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
-	0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
-	0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
-	0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
-	0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
-	0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
-	0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
-	0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
-	0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
-	0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
-	0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
-	0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
-	0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
-	0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
-	0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
-};
-
-/** Unicode checksum
- *
- */
-uint16_t udf_unicode_cksum(uint16_t *buf, size_t len)
-{
-	uint16_t crc = 0;
-
-	while (len-- > 0) {
-		/*
-		 * Take high order byte first (corresponds to a big endian
-		 * byte stream).
-		 */
-		crc = crc_table[(crc >> 8 ^ (*buf >> 8)) & 0xff] ^ (crc << 8);
-		crc = crc_table[(crc >> 8 ^ (*buf++ & 0xff)) & 0xff] ^ (crc << 8);
-	}
-
-	return crc;
-}
-
-/** Calculate descriptor tag checksum
- *
- */
-uint8_t udf_tag_checksum(uint8_t *tag)
-{
-	uint8_t result = 0;
-
-	for (size_t i = 0; i < UDF_TAG_SIZE; i++) {
-		if (i == 4)
-			continue;
-
-		result = (result + tag[i]) % 256;
-	}
-
-	return result;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_cksum.h
===================================================================
--- uspace/srv/fs/udf/udf_cksum.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-
-#ifndef UDF_CKSUM_H_
-#define UDF_CKSUM_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#define UDF_TAG_SIZE  16
-
-extern uint16_t udf_unicode_cksum(uint16_t *, size_t);
-extern uint8_t udf_tag_checksum(uint8_t *);
-
-#endif /* UDF_CKSUM_H_ */
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_file.c
===================================================================
--- uspace/srv/fs/udf/udf_file.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,627 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_file.c
- * @brief Implementation of file operations. Reading and writing functions.
- */
-
-#include <block.h>
-#include <libfs.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <io/log.h>
-#include <mem.h>
-#include "udf.h"
-#include "udf_file.h"
-#include "udf_cksum.h"
-#include "udf_volume.h"
-
-/** Read extended allocator in allocation sequence
- *
- * @paran node     UDF node
- * @param icb_flag Type of allocators in sequence.
- *                 According to ECMA 167 4/14.8.8
- * @param pos      Position with which we read
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_read_extended_allocator(udf_node_t *node, uint16_t icb_flag,
-    uint32_t pos)
-{
-	block_t *block = NULL;
-	errno_t rc = block_get(&block, node->instance->service_id, pos,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	udf_ext_ad_t *exd = (udf_ext_ad_t *) block->data;
-	uint32_t start = node->instance->partitions[
-	    FLE16(exd->extent_location.partition_num)].start +
-	    FLE32(exd->extent_location.lblock_num);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "Extended allocator: start=%d, block_num=%d, len=%d", start,
-	    FLE32(exd->extent_location.lblock_num), FLE32(exd->info_length));
-
-	uint32_t len = FLE32(exd->info_length);
-	block_put(block);
-
-	return udf_read_allocation_sequence(node, NULL, icb_flag, start, len);
-}
-
-/** Read ICB sequence of allocators in (Extended) File entry descriptor
- *
- * @parem node     UDF node
- * @param af       (Extended) File entry descriptor
- * @param icb_flag Type of allocators in sequence.
- *                 According to ECMA 167 4/14.8.8
- * @param start_alloc Offset of the allocator
- * @param len         Length of sequence
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_allocation_sequence(udf_node_t *node, uint8_t *af,
-    uint16_t icb_flag, uint32_t start_alloc, uint32_t len)
-{
-	node->alloc_size = 0;
-
-	switch (icb_flag) {
-	case UDF_SHORT_AD:
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "ICB: sequence of allocation descriptors - icbflag = short_ad_t");
-
-		/*
-		 * Identify number of current partition. Virtual partition
-		 * could placed inside of physical partition. It means that same
-		 * sector could be inside of both partition physical and virtual.
-		 */
-		size_t pd_num = (size_t) -1;
-		size_t min_start = 0;
-
-		for (size_t i = 0; i < node->instance->partition_cnt; i++) {
-			if ((node->index >= node->instance->partitions[i].start) &&
-			    (node->index < node->instance->partitions[i].start +
-			    node->instance->partitions[i].length)) {
-				if (node->instance->partitions[i].start >= min_start) {
-					min_start = node->instance->partitions[i].start;
-					pd_num = i;
-				}
-			}
-		}
-
-		if (pd_num == (size_t) -1)
-			return ENOENT;
-
-		/*
-		 * According to doc, in this we should stop our loop if pass
-		 * all allocators. Count of items in sequence of allocators
-		 * cnt = len / sizeof(udf_long_ad_t)
-		 * But in case of Blu-Ray data len could be zero.
-		 * It means that we have only two conditions for stopping
-		 * which we check inside of loop.
-		 */
-
-		while (true) {
-			udf_short_ad_t *short_d =
-			    (udf_short_ad_t *) (af + start_alloc +
-			    node->alloc_size * sizeof(udf_short_ad_t));
-
-			if (FLE32(short_d->length) == 0)
-				break;
-
-			/*
-			 * ECMA 167 4/12 - next sequence of allocation descriptors
-			 * condition according to 167 4/14.6.8
-			 */
-			if (FLE32(short_d->length) >> 30 == 3) {
-				udf_read_extended_allocator(node, icb_flag,
-				    node->instance->partitions[pd_num].start +
-				    FLE32(short_d->position));
-				break;
-			}
-
-			node->allocators = realloc(node->allocators,
-			    (node->alloc_size + 1) * sizeof(udf_allocator_t));
-			node->allocators[node->alloc_size].length =
-			    EXT_LENGTH(FLE32(short_d->length));
-			node->allocators[node->alloc_size].position =
-			    node->instance->partitions[pd_num].start + FLE32(short_d->position);
-			node->alloc_size++;
-		}
-
-		node->allocators = realloc(node->allocators,
-		    node->alloc_size * sizeof(udf_allocator_t));
-		break;
-
-	case UDF_LONG_AD:
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "ICB: sequence of allocation descriptors - icbflag = long_ad_t");
-
-		while (true) {
-			udf_long_ad_t *long_d =
-			    (udf_long_ad_t *) (af + start_alloc +
-			    node->alloc_size * sizeof(udf_long_ad_t));
-
-			if (FLE32(long_d->length) == 0)
-				break;
-
-			uint32_t pos_long_ad = udf_long_ad_to_pos(node->instance, long_d);
-
-			/*
-			 * ECMA 167 4/12 - next sequence of allocation descriptors
-			 * condition according to 167 4/14.6.8
-			 */
-			if (FLE32(long_d->length) >> 30 == 3) {
-				udf_read_extended_allocator(node, icb_flag, pos_long_ad);
-				break;
-			}
-
-			node->allocators = realloc(node->allocators,
-			    (node->alloc_size + 1) * sizeof(udf_allocator_t));
-			node->allocators[node->alloc_size].length =
-			    EXT_LENGTH(FLE32(long_d->length));
-			node->allocators[node->alloc_size].position = pos_long_ad;
-
-			node->alloc_size++;
-		}
-
-		node->allocators = realloc(node->allocators,
-		    node->alloc_size * sizeof(udf_allocator_t));
-		break;
-
-	case UDF_EXTENDED_AD:
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "ICB: sequence of allocation descriptors - icbflag = extended_ad_t");
-		break;
-
-	case UDF_DATA_AD:
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "ICB: sequence of allocation descriptors - icbflag = 3, node contains data itself");
-
-		node->data = malloc(node->data_size);
-		if (!node->data)
-			return ENOMEM;
-
-		memcpy(node->data, (af + start_alloc), node->data_size);
-		node->alloc_size = 0;
-		break;
-	}
-
-	return EOK;
-}
-
-/** Read ICB sequence of descriptors
- *
- * Read sequence of descriptors (file entry descriptors or
- * extended file entry descriptors). Each descriptor contains
- * sequence of allocators.
- *
- * @param node    UDF node
- *
- * @return    EOK on success or an error code.
- */
-errno_t udf_read_icb(udf_node_t *node)
-{
-	while (true) {
-		fs_index_t pos = node->index;
-
-		block_t *block = NULL;
-		errno_t rc = block_get(&block, node->instance->service_id, pos,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK)
-			return rc;
-
-		udf_descriptor_tag_t *data = (udf_descriptor_tag_t *) block->data;
-		if (data->checksum != udf_tag_checksum((uint8_t *) data)) {
-			block_put(block);
-			return EINVAL;
-		}
-
-		/* One sector size descriptors */
-		switch (FLE16(data->id)) {
-		case UDF_FILE_ENTRY:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "ICB: File entry descriptor found");
-
-			udf_file_entry_descriptor_t *file =
-			    (udf_file_entry_descriptor_t *) block->data;
-			uint16_t icb_flag = FLE16(file->icbtag.flags) & UDF_ICBFLAG_MASK;
-			node->data_size = FLE64(file->info_length);
-			node->type = (file->icbtag.file_type == UDF_ICBTYPE_DIR) ? NODE_DIR : NODE_FILE;
-
-			rc = udf_read_allocation_sequence(node, (uint8_t *) file, icb_flag,
-			    FLE32(file->ea_length) + UDF_FE_OFFSET, FLE32(file->ad_length));
-			block_put(block);
-			return rc;
-
-		case UDF_EFILE_ENTRY:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "ICB: Extended file entry descriptor found");
-
-			udf_extended_file_entry_descriptor_t *efile =
-			    (udf_extended_file_entry_descriptor_t *) block->data;
-			icb_flag = FLE16(efile->icbtag.flags) & UDF_ICBFLAG_MASK;
-			node->data_size = FLE64(efile->info_length);
-			node->type = (efile->icbtag.file_type == UDF_ICBTYPE_DIR) ? NODE_DIR : NODE_FILE;
-
-			rc = udf_read_allocation_sequence(node, (uint8_t *) efile, icb_flag,
-			    FLE32(efile->ea_length) + UDF_EFE_OFFSET, FLE32(efile->ad_length));
-			block_put(block);
-			return rc;
-
-		case UDF_ICB_TERMINAL:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "ICB: Terminal entry descriptor found");
-			block_put(block);
-			return EOK;
-		}
-
-		pos++;
-
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Read data from disk - filling UDF node by allocators
- *
- * @param node UDF node
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_node_get_core(udf_node_t *node)
-{
-	node->link_cnt = 1;
-	return udf_read_icb(node);
-}
-
-/** Read directory entry if all FIDs is saved inside of descriptor
- *
- * @param fid  Returned value
- * @param node UDF node
- * @param pos  Number of FID which we need to find
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_get_fid_in_data(udf_file_identifier_descriptor_t **fid,
-    udf_node_t *node, aoff64_t pos)
-{
-	size_t fid_sum = 0;
-	size_t n = 0;
-
-	while (node->data_size - fid_sum >= MIN_FID_LEN) {
-		udf_descriptor_tag_t *desc =
-		    (udf_descriptor_tag_t *) (node->data + fid_sum);
-		if (desc->checksum != udf_tag_checksum((uint8_t *) desc)) {
-			if (fid_sum == 0)
-				return EINVAL;
-			else
-				return ENOENT;
-		}
-
-		*fid = (udf_file_identifier_descriptor_t *)
-		    (node->data + fid_sum);
-
-		/* According to ECMA 167 4/14.4.9 */
-		size_t padding = 4 * (((*fid)->length_file_id +
-		    FLE16((*fid)->length_iu) + 38 + 3) / 4) -
-		    ((*fid)->length_file_id + FLE16((*fid)->length_iu) + 38);
-		size_t size_fid = (*fid)->length_file_id +
-		    FLE16((*fid)->length_iu) + padding + 38;
-
-		fid_sum += size_fid;
-
-		/* aAcording to ECMA 167 4/8.6 */
-		if (((*fid)->length_file_id != 0) &&
-		    (((*fid)->file_characteristics & 4) == 0)) {
-			n++;
-
-			if (n == pos + 1)
-				return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Read directory entry
- *
- * @param fid   Returned value
- * @param block Returned value
- * @param node  UDF node
- * @param pos   Number of FID which we need to find
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid(udf_file_identifier_descriptor_t **fid, block_t **block,
-    udf_node_t *node, aoff64_t pos)
-{
-	if (node->data == NULL)
-		return udf_get_fid_in_allocator(fid, block, node, pos);
-
-	return udf_get_fid_in_data(fid, node, pos);
-}
-
-/** Read directory entry if all FIDS is saved in allocators.
- *
- * @param fid   Returned value
- * @param block Returned value
- * @param node  UDF node
- * @param pos   Number of FID which we need to find
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **fid,
-    block_t **block, udf_node_t *node, aoff64_t pos)
-{
-	void *buf = malloc(node->instance->sector_size);
-
-	// FIXME: Check for NULL return value
-
-	size_t j = 0;
-	size_t n = 0;
-	size_t len = 0;
-
-	while (j < node->alloc_size) {
-		size_t i = 0;
-		while (i * node->instance->sector_size < node->allocators[j].length) {
-			errno_t rc = block_get(block, node->instance->service_id,
-			    node->allocators[j].position + i, BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				// FIXME: Memory leak
-				return rc;
-			}
-
-			/*
-			 * Last item in allocator is a part of sector. We take
-			 * this fragment and join it to part of sector in next allocator.
-			 */
-			if ((node->allocators[j].length / node->instance->sector_size == i) &&
-			    (node->allocators[j].length - i * node->instance->sector_size <
-			    MIN_FID_LEN)) {
-				size_t len = node->allocators[j].length - i * node->instance->sector_size;
-				memcpy(buf, (*block)->data, len);
-				block_put(*block);
-				*block = NULL;
-				break;
-			}
-
-			rc = udf_get_fid_in_sector(fid, block, node, pos, &n, &buf, &len);
-			if (rc == EOK) {
-				// FIXME: Memory leak
-				return EOK;
-			}
-
-			if (rc == EINVAL) {
-				// FIXME: Memory leak
-				return ENOENT;
-			}
-
-			if (rc == ENOENT) {
-				if (block) {
-					rc = block_put(*block);
-					*block = NULL;
-
-					if (rc != EOK)
-						return rc;
-				}
-			}
-
-			i++;
-		}
-
-		j++;
-	}
-
-	if (buf)
-		free(buf);
-
-	return ENOENT;
-}
-
-/** Read FIDs in sector inside of current allocator
- *
- * @param fid   Returned value.
- * @param block Returned value
- * @param node  UDF node
- * @param pos   Number FID which we need to find
- * @param n     Count of FIDs which we already have passed
- * @param buf   Part of FID from last sector (current allocator or previous)
- * @param len   Length of buf
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_fid_in_sector(udf_file_identifier_descriptor_t **fid,
-    block_t **block, udf_node_t *node, aoff64_t pos, size_t *n, void **buf,
-    size_t *len)
-{
-	void *fidbuf = malloc(node->instance->sector_size);
-
-	// FIXME: Check for NULL return value
-
-	bool buf_flag;
-
-	if (*len > 0) {
-		memcpy(fidbuf, *buf, *len);
-		buf_flag = true;
-	} else
-		buf_flag = false;
-
-	size_t fid_sum = 0;
-	while (node->instance->sector_size - fid_sum > 0) {
-		if (node->instance->sector_size - fid_sum >= MIN_FID_LEN) {
-			void *fid_data;
-
-			if (buf_flag) {
-				memcpy((fidbuf + *len), (*block)->data,
-				    node->instance->sector_size - *len);
-				fid_data = fidbuf;
-			} else
-				fid_data = (*block)->data + fid_sum;
-
-			udf_descriptor_tag_t *desc =
-			    (udf_descriptor_tag_t *) fid_data;
-
-			if (desc->checksum != udf_tag_checksum((uint8_t *) desc)) {
-				if (fidbuf)
-					free(fidbuf);
-
-				if (*buf) {
-					free(*buf);
-					*buf = NULL;
-					*len = 0;
-				}
-
-				return EINVAL;
-			}
-
-			*fid = (udf_file_identifier_descriptor_t *) fid_data;
-
-			/* According to ECMA 167 4/14.4.9 */
-			size_t padding = 4 * (((*fid)->length_file_id +
-			    FLE16((*fid)->length_iu) + 38 + 3) / 4) -
-			    ((*fid)->length_file_id + FLE16((*fid)->length_iu) + 38);
-			size_t size_fid = (*fid)->length_file_id +
-			    FLE16((*fid)->length_iu) + padding + 38;
-			if (buf_flag)
-				fid_sum += size_fid - *len;
-			else
-				fid_sum += size_fid;
-
-			/* According to ECMA 167 4/8.6 */
-			if (((*fid)->length_file_id != 0) &&
-			    (((*fid)->file_characteristics & 4) == 0)) {
-				(*n)++;
-				if (*n == pos + 1) {
-					if (fidbuf)
-						free(fidbuf);
-
-					return EOK;
-				}
-			}
-
-			if (fidbuf) {
-				buf_flag = false;
-				free(fidbuf);
-				fidbuf = NULL;
-			}
-
-			if (*buf) {
-				free(*buf);
-				*buf = NULL;
-				*len = 0;
-			}
-		} else {
-			if (*buf)
-				free(*buf);
-
-			*len = node->instance->sector_size - fid_sum;
-			*buf = malloc(*len);
-			buf_flag = false;
-			memcpy(*buf, ((*block)->data + fid_sum), *len);
-
-			return ENOENT;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Read file if it is saved in allocators.
- *
- * @param read_len Returned value. Length file or part file which we could read.
- * @param call     IPC call
- * @param node     UDF node
- * @param pos      Position in file since we have to read.
- * @param len      Length of data for reading
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_file(size_t *read_len, ipc_call_t *call, udf_node_t *node,
-    aoff64_t pos, size_t len)
-{
-	size_t i = 0;
-	size_t l = 0;
-
-	while (i < node->alloc_size) {
-		if (pos >= l + node->allocators[i].length) {
-			l += node->allocators[i].length;
-			i++;
-		} else
-			break;
-	}
-
-	size_t sector_cnt = ALL_UP(l, node->instance->sector_size);
-	size_t sector_num = pos / node->instance->sector_size;
-
-	block_t *block = NULL;
-	errno_t rc = block_get(&block, node->instance->service_id,
-	    node->allocators[i].position + (sector_num - sector_cnt),
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return rc;
-	}
-
-	size_t sector_pos = pos % node->instance->sector_size;
-
-	if (sector_pos + len < node->instance->sector_size)
-		*read_len = len;
-	else
-		*read_len = node->instance->sector_size - sector_pos;
-
-	if (ALL_UP(node->allocators[i].length, node->instance->sector_size) ==
-	    sector_num - sector_cnt + 1) {
-		if (pos + len > node->allocators[i].length + l)
-			*read_len = node->allocators[i].length -
-			    (sector_num - sector_cnt) * node->instance->sector_size -
-			    sector_pos;
-		else
-			*read_len = len;
-	}
-
-	async_data_read_finalize(call, block->data + sector_pos, *read_len);
-	return block_put(block);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_file.h
===================================================================
--- uspace/srv/fs/udf/udf_file.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-
-#ifndef UDF_FILE_H_
-#define UDF_FILE_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <ipc/loc.h>
-#include <block.h>
-#include "udf_types.h"
-
-#define UDF_TAG_FILESET  256
-#define UDF_TAG_FILEID   257
-
-#define UDF_ICB_TERMINAL   260
-#define UDF_FILE_ENTRY     261
-#define UDF_UASPACE_ENTRY  263
-#define UDF_SPACE_BITMAP   264
-#define UDF_EFILE_ENTRY    266
-
-#define UDF_FE_OFFSET   176
-#define UDF_EFE_OFFSET  216
-#define UDF_SB_OFFSET   24
-
-/* ECMA 4/14.11 */
-#define UDF_UASE_OFFSET  40
-
-/* ECMA 167 4/14.6.8 */
-#define UDF_ICBFLAG_MASK  7
-
-/* ECMA 167 4/17 */
-#define UDF_ICBTYPE_UASE  1
-#define UDF_ICBTYPE_DIR   4
-
-/* ECMA 167 4/14.6.8 */
-#define UDF_SHORT_AD     0
-#define UDF_LONG_AD      1
-#define UDF_EXTENDED_AD  2
-
-/* File in allocation descriptor */
-#define UDF_DATA_AD  3
-
-/* File Set Descriptor (ECMA 167 4/14.1) */
-typedef struct udf_fileset_descriptor {
-	udf_descriptor_tag_t tag;
-	udf_timestamp_t recording_date_and_time;
-	uint16_t interchange_level;
-	uint16_t max_interchange_level;
-	uint32_t charset_list;
-	uint32_t max_charset_list;
-	uint32_t fileset_number;
-	uint32_t fileset_descriptor_number;
-	udf_charspec_t logical_volume_id_charset;
-	udf_dstring logical_volume_id[128];
-	udf_charspec_t fileset_charset;
-	udf_dstring fileset_id[32];
-	udf_dstring copyright_file_id[32];
-	udf_dstring abstract_file_id[32];
-	udf_long_ad_t root_dir_icb;
-	udf_regid_t domain_id;
-	udf_long_ad_t next_extent;
-	udf_long_ad_t system_stream_dir_icb;
-	uint8_t reserved[32];
-} __attribute__((packed)) udf_fileset_descriptor_t;
-
-/* File identifier descriptor format (ECMA 167 4/14.4) */
-typedef struct udf_file_identifier_descriptor {
-	udf_descriptor_tag_t tag;
-	uint16_t file_version_number;
-	uint8_t file_characteristics;
-	uint8_t length_file_id;
-	udf_long_ad_t icb;
-	uint16_t length_iu;
-	uint8_t implementation_use[0];
-	udf_dstring file_id[0];
-} __attribute__((packed)) udf_file_identifier_descriptor_t;
-
-/* ICB tag - Information Control Block  (ECMA 167 4/14.6) */
-typedef struct udf_icbtag {
-	uint32_t prior_recorder_nimber;
-	uint16_t strategy_type;
-	uint8_t strategy_parameter[2];
-	uint16_t max_number;
-	uint8_t reserved[1];
-	uint8_t file_type;
-	udf_lb_addr_t parent_icb;
-	uint16_t flags;
-} __attribute__((packed)) udf_icbtag_t;
-
-/* File Entry format (ECMA 167 4/14.9) */
-typedef struct udf_file_entry_descriptor {
-	udf_descriptor_tag_t tag;
-	udf_icbtag_t icbtag;
-	uint32_t uid;
-	uint32_t gid;
-	uint32_t permission;
-	uint16_t file_link_count;
-	uint8_t record_format;
-	uint8_t record_display_attributes;
-	uint32_t record_length;
-	uint64_t info_length;
-	uint64_t lblocks_recorded;
-	udf_timestamp_t access_data_and_time;
-	udf_timestamp_t mod_data_and_time;
-	udf_timestamp_t attribute_data_and_time;
-	uint32_t checkpoint;
-	udf_long_ad_t extended_attribute_icb;
-	udf_regid_t implementation_id;
-	uint64_t unique_id;
-	uint32_t ea_length;
-	uint32_t ad_length;
-	uint8_t extended_attributes [0];
-	uint8_t allocation_descriptors[0];
-} __attribute__((packed)) udf_file_entry_descriptor_t;
-
-/* Extended File Entry format (ECMA 167 4/14.17) */
-typedef struct udf_extended_file_entry_descriptor {
-	udf_descriptor_tag_t tag;
-	udf_icbtag_t icbtag;
-	uint32_t uid;
-	uint32_t gid;
-	uint32_t permission;
-	uint16_t file_link_count;
-	uint8_t record_format;
-	uint8_t record_display_attributes;
-	uint32_t record_length;
-	uint64_t info_length;
-	uint64_t object_size;
-	uint64_t lblocks_recorded;
-	udf_timestamp_t access_data_and_time;
-	udf_timestamp_t mod_data_and_time;
-	udf_timestamp_t creation_data_and_time;
-	udf_timestamp_t attribute_data_and_time;
-	uint32_t checkpoint;
-	udf_long_ad_t extended_attribute_icb;
-	udf_regid_t implementation_id;
-	uint64_t unique_id;
-	uint32_t ea_length;
-	uint32_t ad_length;
-	uint8_t extended_attributes [0];
-	uint8_t allocation_descriptors[0];
-} __attribute__((packed)) udf_extended_file_entry_descriptor_t;
-
-/* Terminal Entry Descriptor (ECMA 167 4/14.8) */
-typedef struct terminal_entry_descriptor {
-	udf_descriptor_tag_t tag;
-	udf_icbtag_t icbtag;
-} __attribute__((packed)) udf_terminal_entry_descriptor;
-
-/* Unallocated Space Entry format (ECMA 167 4/14.11) */
-typedef struct udf_unallocated_space_entry_descriptor {
-	udf_descriptor_tag_t tag;
-	udf_icbtag_t icbtag;
-	uint32_t ad_length;
-	uint8_t allocation_descriptors[0];
-} __attribute__((packed)) udf_unallocated_space_entry_descriptor_t;
-
-/* Space Bitmap Descriptor format (ECMA 167 4/14.12) */
-typedef struct udf_space_bitmap_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t bits_number;
-	uint32_t byts_number;
-	uint8_t bitmap[0];
-} __attribute__((packed)) udf_space_bitmap_descriptor_t;
-
-extern errno_t udf_node_get_core(udf_node_t *);
-extern errno_t udf_read_icb(udf_node_t *);
-extern errno_t udf_read_allocation_sequence(udf_node_t *, uint8_t *, uint16_t,
-    uint32_t, uint32_t);
-extern errno_t udf_read_file(size_t *, ipc_call_t *, udf_node_t *, aoff64_t,
-    size_t);
-extern errno_t udf_get_fid(udf_file_identifier_descriptor_t **, block_t **,
-    udf_node_t *, aoff64_t);
-extern errno_t udf_get_fid_in_allocator(udf_file_identifier_descriptor_t **,
-    block_t **, udf_node_t *, aoff64_t);
-extern errno_t udf_get_fid_in_sector(udf_file_identifier_descriptor_t **,
-    block_t **, udf_node_t *, aoff64_t, size_t *, void **, size_t *);
-
-#endif /* UDF_FILE_H_ */
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_idx.c
===================================================================
--- uspace/srv/fs/udf/udf_idx.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_idx.c
- * @brief Very simple UDF hashtable for nodes
- */
-
-#include <errno.h>
-#include <str.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <adt/list.h>
-#include <stdbool.h>
-#include "udf_idx.h"
-#include "udf.h"
-
-static FIBRIL_MUTEX_INITIALIZE(udf_idx_lock);
-
-static hash_table_t udf_idx;
-
-typedef struct {
-	service_id_t service_id;
-	fs_index_t index;
-} udf_ht_key_t;
-
-static size_t udf_idx_hash(const ht_link_t *item)
-{
-	udf_node_t *node = hash_table_get_inst(item, udf_node_t, link);
-	return hash_combine(node->instance->service_id, node->index);
-}
-
-static size_t udf_idx_key_hash(const void *k)
-{
-	const udf_ht_key_t *key = k;
-	return hash_combine(key->service_id, key->index);
-}
-
-static bool udf_idx_key_equal(const void *k, size_t hash, const ht_link_t *item)
-{
-	const udf_ht_key_t *key = k;
-	udf_node_t *node = hash_table_get_inst(item, udf_node_t, link);
-
-	return (key->service_id == node->instance->service_id) &&
-	    (key->index == node->index);
-}
-
-static const hash_table_ops_t udf_idx_ops = {
-	.hash = udf_idx_hash,
-	.key_hash = udf_idx_key_hash,
-	.key_equal = udf_idx_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-/** Initialization of hash table
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_init(void)
-{
-	if (!hash_table_create(&udf_idx, 0, 0, &udf_idx_ops))
-		return ENOMEM;
-
-	return EOK;
-}
-
-/** Delete hash table
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_fini(void)
-{
-	hash_table_destroy(&udf_idx);
-	return EOK;
-}
-
-/** Get node from hash table
- *
- * @param udfn     Returned value - UDF node
- * @param instance UDF instance
- * @param index    Absolute position of ICB (sector)
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_get(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
-{
-	fibril_mutex_lock(&udf_idx_lock);
-
-	udf_ht_key_t key = {
-		.service_id = instance->service_id,
-		.index = index
-	};
-
-	ht_link_t *already_open = hash_table_find(&udf_idx, &key);
-	if (already_open) {
-		udf_node_t *node = hash_table_get_inst(already_open,
-		    udf_node_t, link);
-		node->ref_cnt++;
-
-		*udfn = node;
-
-		fibril_mutex_unlock(&udf_idx_lock);
-		return EOK;
-	}
-
-	fibril_mutex_unlock(&udf_idx_lock);
-	return ENOENT;
-}
-
-/** Create new node in hash table
- *
- * @param udfn     Returned value - new UDF node
- * @param instance UDF instance
- * @param index    Absolute position of ICB (sector)
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_add(udf_node_t **udfn, udf_instance_t *instance, fs_index_t index)
-{
-	fibril_mutex_lock(&udf_idx_lock);
-
-	udf_node_t *udf_node = malloc(sizeof(udf_node_t));
-	if (udf_node == NULL) {
-		fibril_mutex_unlock(&udf_idx_lock);
-		return ENOMEM;
-	}
-
-	fs_node_t *fs_node = malloc(sizeof(fs_node_t));
-	if (fs_node == NULL) {
-		free(udf_node);
-		fibril_mutex_unlock(&udf_idx_lock);
-		return ENOMEM;
-	}
-
-	fs_node_initialize(fs_node);
-
-	udf_node->index = index;
-	udf_node->instance = instance;
-	udf_node->ref_cnt = 1;
-	udf_node->link_cnt = 0;
-	udf_node->fs_node = fs_node;
-	udf_node->data = NULL;
-	udf_node->allocators = NULL;
-
-	fibril_mutex_initialize(&udf_node->lock);
-	fs_node->data = udf_node;
-
-	hash_table_insert(&udf_idx, &udf_node->link);
-	instance->open_nodes_count++;
-
-	*udfn = udf_node;
-
-	fibril_mutex_unlock(&udf_idx_lock);
-	return EOK;
-}
-
-/** Delete node from hash table
- *
- * @param node UDF node
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_idx_del(udf_node_t *node)
-{
-	assert(node->ref_cnt == 0);
-
-	fibril_mutex_lock(&udf_idx_lock);
-
-	hash_table_remove_item(&udf_idx, &node->link);
-
-	assert(node->instance->open_nodes_count > 0);
-	node->instance->open_nodes_count--;
-
-	free(node->fs_node);
-	free(node);
-
-	fibril_mutex_unlock(&udf_idx_lock);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_idx.h
===================================================================
--- uspace/srv/fs/udf/udf_idx.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-
-#ifndef UDF_IDX_H_
-#define UDF_IDX_H_
-
-#include "udf.h"
-
-extern errno_t udf_idx_init(void);
-extern errno_t udf_idx_fini(void);
-extern errno_t udf_idx_get(udf_node_t **, udf_instance_t *, fs_index_t);
-extern errno_t udf_idx_add(udf_node_t **, udf_instance_t *, fs_index_t);
-extern errno_t udf_idx_del(udf_node_t *);
-
-#endif /* UDF_IDX_H_ */
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_ops.c
===================================================================
--- uspace/srv/fs/udf/udf_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,562 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Jakub Jermar
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_ops.c
- * @brief Implementation of VFS operations for the UDF file system
- *        server.
- */
-
-#include <libfs.h>
-#include <block.h>
-#include <ipc/services.h>
-#include <ipc/loc.h>
-#include <macros.h>
-#include <async.h>
-#include <errno.h>
-#include <str.h>
-#include <byteorder.h>
-#include <adt/hash_table.h>
-#include <adt/list.h>
-#include <assert.h>
-#include <fibril_synch.h>
-#include <align.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <io/log.h>
-#include "../../vfs/vfs.h"
-#include "udf.h"
-#include "udf_cksum.h"
-#include "udf_volume.h"
-#include "udf_idx.h"
-#include "udf_file.h"
-#include "udf_osta.h"
-
-/** List of cached free nodes. */
-static LIST_INITIALIZE(ffn_list);
-
-static errno_t udf_node_get(fs_node_t **rfn, service_id_t service_id,
-    fs_index_t index)
-{
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	udf_node_t *node;
-	rc = udf_idx_get(&node, instance, index);
-	if (rc != EOK) {
-		rc = udf_idx_add(&node, instance, index);
-		if (rc != EOK)
-			return rc;
-
-		rc = udf_node_get_core(node);
-		if (rc != EOK) {
-			udf_idx_del(node);
-			return rc;
-		}
-	}
-
-	*rfn = FS_NODE(node);
-	return EOK;
-}
-
-static errno_t udf_root_get(fs_node_t **rfn, service_id_t service_id)
-{
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	return udf_node_get(rfn, service_id,
-	    instance->volumes[DEFAULT_VOL].root_dir);
-}
-
-static service_id_t udf_service_get(fs_node_t *node)
-{
-	return 0;
-}
-
-static errno_t udf_match(fs_node_t **rfn, fs_node_t *pfn, const char *component)
-{
-	char *name = malloc(MAX_FILE_NAME_LEN + 1);
-	if (name == NULL)
-		return ENOMEM;
-
-	block_t *block = NULL;
-	udf_file_identifier_descriptor_t *fid = NULL;
-	size_t pos = 0;
-
-	while (udf_get_fid(&fid, &block, UDF_NODE(pfn), pos) == EOK) {
-		udf_long_ad_t long_ad = fid->icb;
-
-		udf_to_unix_name(name, MAX_FILE_NAME_LEN,
-		    (char *) fid->implementation_use + FLE16(fid->length_iu),
-		    fid->length_file_id, &UDF_NODE(pfn)->instance->charset);
-
-		if (str_casecmp(name, component) == 0) {
-			errno_t rc = udf_node_get(rfn, udf_service_get(pfn),
-			    udf_long_ad_to_pos(UDF_NODE(pfn)->instance, &long_ad));
-
-			if (block != NULL)
-				block_put(block);
-
-			free(name);
-			return rc;
-		}
-
-		if (block != NULL) {
-			errno_t rc = block_put(block);
-			if (rc != EOK)
-				return rc;
-		}
-
-		pos++;
-	}
-
-	free(name);
-	return ENOENT;
-}
-
-static errno_t udf_node_open(fs_node_t *fn)
-{
-	return EOK;
-}
-
-static errno_t udf_node_put(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (!node)
-		return EINVAL;
-
-	fibril_mutex_lock(&node->lock);
-	node->ref_cnt--;
-	fibril_mutex_unlock(&node->lock);
-
-	/* Delete node from hash table and memory */
-	if (!node->ref_cnt)
-		udf_idx_del(node);
-
-	return EOK;
-}
-
-static errno_t udf_create_node(fs_node_t **rfn, service_id_t service_id, int flags)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_destroy_node(fs_node_t *fn)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_link(fs_node_t *pfn, fs_node_t *cfn, const char *name)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_unlink(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_has_children(bool *has_children, fs_node_t *fn)
-{
-	*has_children = true;
-	return EOK;
-}
-
-static fs_index_t udf_index_get(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (node)
-		return node->index;
-
-	return 0;
-}
-
-static aoff64_t udf_size_get(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (node)
-		return node->data_size;
-
-	return 0;
-}
-
-static unsigned int udf_lnkcnt_get(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (node)
-		return node->link_cnt;
-
-	return 0;
-}
-
-static bool udf_is_directory(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (node)
-		return node->type == NODE_DIR;
-
-	return false;
-}
-
-static bool udf_is_file(fs_node_t *fn)
-{
-	udf_node_t *node = UDF_NODE(fn);
-	if (node)
-		return node->type == NODE_FILE;
-
-	return false;
-}
-
-static errno_t udf_size_block(service_id_t service_id, uint32_t *size)
-{
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	if (NULL == instance)
-		return ENOENT;
-
-	*size = instance->volumes[DEFAULT_VOL].logical_block_size;
-
-	return EOK;
-}
-
-static errno_t udf_total_block_count(service_id_t service_id, uint64_t *count)
-{
-	*count = 0;
-
-	return EOK;
-}
-
-static errno_t udf_free_block_count(service_id_t service_id, uint64_t *count)
-{
-	*count = 0;
-
-	return EOK;
-}
-
-libfs_ops_t udf_libfs_ops = {
-	.root_get = udf_root_get,
-	.match = udf_match,
-	.node_get = udf_node_get,
-	.node_open = udf_node_open,
-	.node_put = udf_node_put,
-	.create = udf_create_node,
-	.destroy = udf_destroy_node,
-	.link = udf_link,
-	.unlink = udf_unlink,
-	.has_children = udf_has_children,
-	.index_get = udf_index_get,
-	.size_get = udf_size_get,
-	.lnkcnt_get = udf_lnkcnt_get,
-	.is_directory = udf_is_directory,
-	.is_file = udf_is_file,
-	.service_get = udf_service_get,
-	.size_block = udf_size_block,
-	.total_block_count = udf_total_block_count,
-	.free_block_count = udf_free_block_count
-};
-
-static errno_t udf_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_mounted(service_id_t service_id, const char *opts,
-    fs_index_t *index, aoff64_t *size)
-{
-	enum cache_mode cmode;
-
-	/* Check for option enabling write through. */
-	if (str_cmp(opts, "wtcache") == 0)
-		cmode = CACHE_MODE_WT;
-	else
-		cmode = CACHE_MODE_WB;
-
-	udf_instance_t *instance = malloc(sizeof(udf_instance_t));
-	if (!instance)
-		return ENOMEM;
-
-	instance->sector_size = 0;
-
-	/* Check for block size. Will be enhanced later */
-	if (str_cmp(opts, "bs=512") == 0)
-		instance->sector_size = 512;
-	else if (str_cmp(opts, "bs=1024") == 0)
-		instance->sector_size = 1024;
-	else if (str_cmp(opts, "bs=2048") == 0)
-		instance->sector_size = 2048;
-
-	/* initialize block cache */
-	errno_t rc = block_init(service_id);
-	if (rc != EOK) {
-		free(instance);
-		return rc;
-	}
-
-	rc = fs_instance_create(service_id, instance);
-	if (rc != EOK) {
-		free(instance);
-		block_fini(service_id);
-		return rc;
-	}
-
-	instance->service_id = service_id;
-	instance->open_nodes_count = 0;
-
-	/* Check Volume Recognition Sequence */
-	rc = udf_volume_recongnition(service_id);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "VRS failed");
-		fs_instance_destroy(service_id);
-		free(instance);
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Search for Anchor Volume Descriptor */
-	udf_anchor_volume_descriptor_t avd;
-	rc = udf_get_anchor_volume_descriptor(service_id, &avd);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Anchor read failed");
-		fs_instance_destroy(service_id);
-		free(instance);
-		block_fini(service_id);
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "Volume: Anchor volume descriptor found. Sector size=%" PRIu32,
-	    instance->sector_size);
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "Anchor: main sequence [length=%" PRIu32 " (bytes), start=%"
-	    PRIu32 " (sector)]", avd.main_extent.length,
-	    avd.main_extent.location);
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "Anchor: reserve sequence [length=%" PRIu32 " (bytes), start=%"
-	    PRIu32 " (sector)]", avd.reserve_extent.length,
-	    avd.reserve_extent.location);
-
-	/* Initialize the block cache */
-	rc = block_cache_init(service_id, instance->sector_size, 0, cmode);
-	if (rc != EOK) {
-		fs_instance_destroy(service_id);
-		free(instance);
-		block_fini(service_id);
-		return rc;
-	}
-
-	/* Read Volume Descriptor Sequence */
-	rc = udf_read_volume_descriptor_sequence(service_id, avd.main_extent);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Volume Descriptor Sequence read failed");
-		fs_instance_destroy(service_id);
-		free(instance);
-		block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	fs_node_t *rfn;
-	rc = udf_node_get(&rfn, service_id, instance->volumes[DEFAULT_VOL].root_dir);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Can't create root node");
-		fs_instance_destroy(service_id);
-		free(instance);
-		block_cache_fini(service_id);
-		block_fini(service_id);
-		return rc;
-	}
-
-	udf_node_t *node = UDF_NODE(rfn);
-	*index = instance->volumes[DEFAULT_VOL].root_dir;
-	*size = node->data_size;
-
-	return EOK;
-}
-
-static errno_t udf_unmounted(service_id_t service_id)
-{
-	fs_node_t *fn;
-	errno_t rc = udf_root_get(&fn, service_id);
-	if (rc != EOK)
-		return rc;
-
-	udf_node_t *nodep = UDF_NODE(fn);
-	udf_instance_t *instance = nodep->instance;
-
-	/*
-	 * We expect exactly two references on the root node.
-	 * One for the udf_root_get() above and one created in
-	 * udf_mounted().
-	 */
-	if (nodep->ref_cnt != 2) {
-		udf_node_put(fn);
-		return EBUSY;
-	}
-
-	/*
-	 * Put the root node twice.
-	 */
-	udf_node_put(fn);
-	udf_node_put(fn);
-
-	fs_instance_destroy(service_id);
-	free(instance);
-	block_cache_fini(service_id);
-	block_fini(service_id);
-
-	return EOK;
-}
-
-static errno_t udf_read(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *rbytes)
-{
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	fs_node_t *rfn;
-	rc = udf_node_get(&rfn, service_id, index);
-	if (rc != EOK)
-		return rc;
-
-	udf_node_t *node = UDF_NODE(rfn);
-
-	ipc_call_t call;
-	size_t len = 0;
-	if (!async_data_read_receive(&call, &len)) {
-		async_answer_0(&call, EINVAL);
-		udf_node_put(rfn);
-		return EINVAL;
-	}
-
-	if (node->type == NODE_FILE) {
-		if (pos >= node->data_size) {
-			*rbytes = 0;
-			async_data_read_finalize(&call, NULL, 0);
-			udf_node_put(rfn);
-			return EOK;
-		}
-
-		size_t read_len = 0;
-		if (node->data == NULL)
-			rc = udf_read_file(&read_len, &call, node, pos, len);
-		else {
-			/* File in allocation descriptors area */
-			read_len = (len < node->data_size) ? len : node->data_size;
-			async_data_read_finalize(&call, node->data + pos, read_len);
-			rc = EOK;
-		}
-
-		*rbytes = read_len;
-		(void) udf_node_put(rfn);
-		return rc;
-	} else {
-		block_t *block = NULL;
-		udf_file_identifier_descriptor_t *fid = NULL;
-		if (udf_get_fid(&fid, &block, node, pos) == EOK) {
-			char *name = malloc(MAX_FILE_NAME_LEN + 1);
-
-			// FIXME: Check for NULL return value
-
-			udf_to_unix_name(name, MAX_FILE_NAME_LEN,
-			    (char *) fid->implementation_use + FLE16(fid->length_iu),
-			    fid->length_file_id, &node->instance->charset);
-
-			async_data_read_finalize(&call, name, str_size(name) + 1);
-			*rbytes = 1;
-			free(name);
-			udf_node_put(rfn);
-
-			if (block != NULL)
-				return block_put(block);
-
-			return EOK;
-		} else {
-			*rbytes = 0;
-			udf_node_put(rfn);
-			async_answer_0(&call, ENOENT);
-			return ENOENT;
-		}
-	}
-}
-
-static errno_t udf_close(service_id_t service_id, fs_index_t index)
-{
-	return EOK;
-}
-
-static errno_t udf_sync(service_id_t service_id, fs_index_t index)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_write(service_id_t service_id, fs_index_t index, aoff64_t pos,
-    size_t *wbytes, aoff64_t *nsize)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_truncate(service_id_t service_id, fs_index_t index,
-    aoff64_t size)
-{
-	return ENOTSUP;
-}
-
-static errno_t udf_destroy(service_id_t service_id, fs_index_t index)
-{
-	return ENOTSUP;
-}
-
-vfs_out_ops_t udf_ops = {
-	.fsprobe = udf_fsprobe,
-	.mounted = udf_mounted,
-	.unmounted = udf_unmounted,
-	.read = udf_read,
-	.write = udf_write,
-	.truncate = udf_truncate,
-	.close = udf_close,
-	.destroy = udf_destroy,
-	.sync = udf_sync
-};
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_osta.c
===================================================================
--- uspace/srv/fs/udf/udf_osta.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,301 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * OSTA compliant Unicode compression, uncompression routines,
- * file name translation routine for OS/2, Windows 95, Windows NT,
- * Macintosh and UNIX.
- * Copyright 1995 Micro Design International, Inc.
- * Written by Jason M. Rinn.
- * Micro Design International gives permission for the free use of the
- * following source code.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_osta.c
- * @brief OSTA compliant functions.
- */
-
-#include <stdlib.h>
-#include <str.h>
-#include <macros.h>
-#include <errno.h>
-#include "udf_osta.h"
-#include "udf_cksum.h"
-
-/** Illegal UNIX characters are NULL and slash.
- *
- */
-static bool legal_check(uint16_t ch)
-{
-	if ((ch == 0x0000) || (ch == 0x002F))
-		return false;
-
-	return true;
-}
-
-/** Convert OSTA CS0 compressed Unicode name to Unicode.
- *
- * The Unicode output will be in the byte order that the local compiler
- * uses for 16-bit values.
- *
- * NOTE: This routine only performs error checking on the comp_id.
- * It is up to the user to ensure that the Unicode buffer is large
- * enough, and that the compressed Unicode name is correct.
- *
- * @param[in]  number_of_bytes Number of bytes read from media
- * @param[in]  udf_compressed  Bytes read from media
- * @param[out] unicode         Uncompressed unicode characters
- * @param[in]  unicode_max_len Size of output array
- *
- * @return Number of Unicode characters which were uncompressed.
- *
- */
-static size_t udf_uncompress_unicode(size_t number_of_bytes,
-    uint8_t *udf_compressed, uint16_t *unicode, size_t unicode_max_len)
-{
-	/* Use udf_compressed to store current byte being read. */
-	uint8_t comp_id = udf_compressed[0];
-
-	/* First check for valid compID. */
-	if ((comp_id != 8) && (comp_id != 16))
-		return 0;
-
-	size_t unicode_idx = 0;
-	size_t byte_idx = 1;
-
-	/* Loop through all the bytes. */
-	while ((byte_idx < number_of_bytes) && (unicode_idx < unicode_max_len)) {
-		if (comp_id == 16) {
-			/*
-			 * Move the first byte to the high bits of the
-			 * Unicode char.
-			 */
-			unicode[unicode_idx] = udf_compressed[byte_idx++] << 8;
-		} else
-			unicode[unicode_idx] = 0;
-
-		if (byte_idx < number_of_bytes) {
-			/* Then the next byte to the low bits. */
-			unicode[unicode_idx] |= udf_compressed[byte_idx++];
-		}
-
-		unicode_idx++;
-	}
-
-	return unicode_idx;
-}
-
-/** Translate a long file name
- *
- * Translate a long file name to one using a MAXLEN and an illegal char set
- * in accord with the OSTA requirements. Assumes the name has already been
- * translated to Unicode.
- *
- * @param[out] new_name Translated name. Must be of length MAXLEN
- * @param[in]  udf_name Name from UDF volume
- * @param[in]  udf_len  Length of UDF Name
- *
- * @return Number of Unicode characters in translated name.
- *
- */
-size_t udf_translate_name(uint16_t *new_name, uint16_t *udf_name,
-    size_t udf_len)
-{
-	bool needs_crc = false;
-	bool has_ext = false;
-	size_t ext_idx = 0;
-	size_t new_idx = 0;
-	size_t new_ext_idx = 0;
-
-	for (size_t idx = 0; idx < udf_len; idx++) {
-		uint16_t current = udf_name[idx];
-
-		if ((!legal_check(current)) || (!ascii_check(current))) {
-			needs_crc = true;
-
-			/*
-			 * Replace Illegal and non-displayable chars with
-			 * underscore.
-			 */
-			current = ILLEGAL_CHAR_MARK;
-
-			/*
-			 * Skip any other illegal or non-displayable
-			 * characters.
-			 */
-			while ((idx + 1 < udf_len) &&
-			    (!legal_check(udf_name[idx + 1]) ||
-			    (!ascii_check(udf_name[idx + 1]))))
-				idx++;
-		}
-
-		/* Record position of extension, if one is found. */
-		if ((current == PERIOD) && ((udf_len - idx - 1) <= EXT_SIZE)) {
-			if (udf_len == idx + 1) {
-				/* A trailing period is NOT an extension. */
-				has_ext = false;
-			} else {
-				has_ext = true;
-				ext_idx = idx;
-				new_ext_idx = new_idx;
-			}
-		}
-
-		if (new_idx < MAXLEN)
-			new_name[new_idx++] = current;
-		else
-			needs_crc = true;
-	}
-
-	if (needs_crc) {
-		uint16_t ext[EXT_SIZE];
-		size_t local_ext_idx = 0;
-
-		if (has_ext) {
-			size_t max_filename_len;
-
-			/* Translate extension, and store it in ext. */
-			for (size_t idx = 0; (idx < EXT_SIZE) &&
-			    (ext_idx + idx + 1 < udf_len); idx++) {
-				uint16_t current = udf_name[ext_idx + idx + 1];
-
-				if ((!legal_check(current)) || (!ascii_check(current))) {
-					needs_crc = true;
-
-					/*
-					 * Replace Illegal and non-displayable
-					 * chars with underscore.
-					 */
-					current = ILLEGAL_CHAR_MARK;
-
-					/*
-					 * Skip any other illegal or
-					 * non-displayable characters.
-					 */
-					while ((idx + 1 < EXT_SIZE) &&
-					    ((!legal_check(udf_name[ext_idx + idx + 2])) ||
-					    (!ascii_check(udf_name[ext_idx + idx + 2]))))
-						idx++;
-				}
-
-				ext[local_ext_idx++] = current;
-			}
-
-			/*
-			 * Truncate filename to leave room for extension and
-			 * CRC.
-			 */
-			max_filename_len = ((MAXLEN - 5) - local_ext_idx - 1);
-			if (new_idx > max_filename_len)
-				new_idx = max_filename_len;
-			else
-				new_idx = new_ext_idx;
-		} else if (new_idx > MAXLEN - 5) {
-			/* If no extension, make sure to leave room for CRC. */
-			new_idx = MAXLEN - 5;
-		}
-
-		/* Add mark for CRC. */
-		new_name[new_idx++] = CRC_MARK;
-
-		/* Calculate CRC from original filename. */
-		uint16_t value_crc = udf_unicode_cksum(udf_name, udf_len);
-
-		/* Convert 16-bits of CRC to hex characters. */
-		const char hex_char[] = "0123456789ABCDEF";
-
-		new_name[new_idx++] = hex_char[(value_crc & 0xf000) >> 12];
-		new_name[new_idx++] = hex_char[(value_crc & 0x0f00) >> 8];
-		new_name[new_idx++] = hex_char[(value_crc & 0x00f0) >> 4];
-		new_name[new_idx++] = hex_char[(value_crc & 0x000f)];
-
-		/* Place a translated extension at end, if found. */
-		if (has_ext) {
-			new_name[new_idx++] = PERIOD;
-
-			for (size_t idx = 0; idx < local_ext_idx; idx++)
-				new_name[new_idx++] = ext[idx];
-		}
-	}
-
-	return new_idx;
-}
-
-/** Decode from dchar to utf8
- *
- * @param result     Returned value - utf8 string
- * @param result_len Length of output string
- * @param id         Input string
- * @param len        Length of input string
- * @param chsp       Decode method
- *
- */
-void udf_to_unix_name(char *result, size_t result_len, char *id, size_t len,
-    udf_charspec_t *chsp)
-{
-	const char *osta_id = "OSTA Compressed Unicode";
-	size_t ucode_chars, nice_uchars;
-
-	uint16_t *raw_name = malloc(MAX_BUF * sizeof(uint16_t));
-	uint16_t *unix_name = malloc(MAX_BUF * sizeof(uint16_t));
-
-	// FIXME: Check for malloc returning NULL
-
-	bool is_osta_typ0 = (chsp->type == 0) &&
-	    (str_cmp((char *) chsp->info, osta_id) == 0);
-
-	if (is_osta_typ0) {
-		*raw_name = 0;
-		*unix_name = 0;
-
-		ucode_chars =
-		    udf_uncompress_unicode(len, (uint8_t *) id, raw_name, MAX_BUF);
-		ucode_chars = min(ucode_chars, utf16_wsize(raw_name));
-		nice_uchars =
-		    udf_translate_name(unix_name, raw_name, ucode_chars);
-
-		/* Output UTF-8 */
-		unix_name[nice_uchars] = 0;
-		utf16_to_str(result, result_len, unix_name);
-	} else {
-		/* Assume 8 bit char length byte Latin-1 */
-		str_ncpy(result, result_len, (char *) (id + 1),
-		    str_size((char *) (id + 1)));
-	}
-
-	free(raw_name);
-	free(unix_name);
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_osta.h
===================================================================
--- uspace/srv/fs/udf/udf_osta.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * OSTA compliant Unicode compression, uncompression routines,
- * file name translation routine for OS/2, Windows 95, Windows NT,
- * Macintosh and UNIX.
- * Copyright 1995 Micro Design International, Inc.
- * Written by Jason M. Rinn.
- * Micro Design International gives permission for the free use of the
- * following source code.
- */
-
-#ifndef UDF_OSTA_H_
-#define UDF_OSTA_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include "udf_types.h"
-
-#define MAXLEN    255
-#define MAX_BUF   1024
-#define EXT_SIZE  5
-
-#define ILLEGAL_CHAR_MARK  0x005F
-#define CRC_MARK           0x0023
-#define PERIOD             0x002E
-
-extern size_t udf_translate_name(uint16_t *, uint16_t *, size_t);
-extern void udf_to_unix_name(char *, size_t, char *, size_t, udf_charspec_t *);
-
-#endif /* UDF_OSTA_H_ */
Index: pace/srv/fs/udf/udf_types.h
===================================================================
--- uspace/srv/fs/udf/udf_types.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_types.h
- * @brief UDF common types
- */
-
-#ifndef UDF_UDF_TYPES_H_
-#define UDF_UDF_TYPES_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <byteorder.h>
-
-#define GET_LE16(x)  x = uint16_t_le2host(x)
-#define GET_LE32(x)  x = uint32_t_le2host(x)
-
-#define FLE16(x)  uint16_t_le2host(x)
-#define FLE32(x)  uint32_t_le2host(x)
-#define FLE64(x)  uint64_t_le2host(x)
-
-#define ALL_UP(n, b)  ((n) / (b) + ((n) % (b) != 0))
-
-#define EXT_LENGTH(x)  (x & 0x3FFFFFFF)
-
-typedef uint8_t udf_dstring;
-
-/* Timestamp descriptor (ECMA 167 1/7.3) */
-typedef struct udf_timestamp {
-	uint16_t type_and_tz;
-	uint16_t year;
-	uint8_t month;
-	uint8_t day;
-	uint8_t hour;
-	uint8_t min;
-	uint8_t sec;
-	uint8_t centisec;
-	uint8_t h_of_mcsec;
-	uint8_t mcsec;
-} __attribute__((packed)) udf_timestamp_t;
-
-/* Universal descriptor tag (ECMA 167 3/7.2) */
-typedef struct udf_descriptor_tag {
-	uint16_t id;
-	uint16_t version;
-	uint8_t checksum;
-	uint8_t reserved;
-	uint16_t serial;
-	uint16_t descriptor_crc;
-	uint16_t descriptor_crc_length;
-	uint32_t location;
-} __attribute__((packed)) udf_descriptor_tag_t;
-
-/* Entity descriptor (ECMA 167 1/7.4) */
-typedef struct udf_regid {
-	uint8_t flags;
-	uint8_t id[23];
-	uint8_t id_suffix[8];
-} __attribute__((packed)) udf_regid_t;
-
-/* Character set specification (ECMA 167 1/7.2.1) */
-typedef struct udf_charspec {
-	uint8_t type;
-	uint8_t info[63];
-} __attribute__((packed)) udf_charspec_t;
-
-/* Recorded address (ECMA 167 4/7.1) */
-typedef struct udf_lb_addr {
-	uint32_t lblock_num;     /* Relative to start of the partition (from 0) */
-	uint16_t partition_num;  /* Relative to logical volume or not? */
-} __attribute__((packed)) udf_lb_addr_t;
-
-/* Long Allocation Descriptor (ECMA 167 4/14.14.2) */
-typedef struct udf_long_ad {
-	uint32_t length;
-	udf_lb_addr_t location;
-	uint8_t implementation_use[6];
-} __attribute__((packed)) udf_long_ad_t;
-
-/* Short Allocation Descriptor (ECMA 167 4/14.14.1) */
-typedef struct udf_short_ad {
-	uint32_t length;
-	uint32_t position;
-} __attribute__((packed)) udf_short_ad_t;
-
-/* Extended Allocation Descriptor (ECMA 167 4/14.14.3) */
-typedef struct udf_ext_ad {
-	uint32_t extent_length;
-	uint32_t recorded_length;
-	uint32_t info_length;
-	udf_lb_addr_t extent_location;
-	uint8_t implementation_use[2];
-} __attribute__((packed)) udf_ext_ad_t;
-
-/* Extent descriptor (ECMA 167 3/7.1) */
-typedef struct udf_extent {
-	uint32_t length;    /* Bytes */
-	uint32_t location;  /* Sectors */
-} __attribute__((packed)) udf_extent_t;
-
-/* Terminating Descriptor (ECMA 167 3/10.9) */
-typedef struct udf_terminating_descriptor {
-	udf_descriptor_tag_t tag;
-	uint8_t reserved[496];
-} __attribute__((packed)) udf_terminating_descriptor_t;
-
-/* Unallocated Space Descriptor (ECMA 167 3/10.8) */
-typedef struct udf_unallocated_space_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t sequence_number;
-	uint32_t allocation_descriptors_num;
-	udf_extent_t allocation_descriptors[0];
-} __attribute__((packed)) udf_unallocated_space_descriptor_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_volume.c
===================================================================
--- uspace/srv/fs/udf/udf_volume.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,856 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-/**
- * @file udf_volume.c
- * @brief Implementation of volume recognition operations.
- */
-
-#include <byteorder.h>
-#include <block.h>
-#include <libfs.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <mem.h>
-#include <inttypes.h>
-#include <io/log.h>
-#include "udf.h"
-#include "udf_volume.h"
-#include "udf_osta.h"
-#include "udf_cksum.h"
-#include "udf_file.h"
-
-/** Convert long_ad to absolute sector position
- *
- * Convert address sector concerning origin of partition to position
- * sector concerning origin of start of disk.
- *
- * @param instance UDF instance
- * @param long_ad  UDF long address
- *
- * @return Position of sector concerning origin of start of disk.
- *
- */
-fs_index_t udf_long_ad_to_pos(udf_instance_t *instance, udf_long_ad_t *long_ad)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Long_Ad to Pos: "
-	    "partition_num=%" PRIu16 ", partition_block=%" PRIu32,
-	    FLE16(long_ad->location.partition_num),
-	    FLE32(long_ad->location.lblock_num));
-
-	return instance->partitions[
-	    FLE16(long_ad->location.partition_num)].start +
-	    FLE32(long_ad->location.lblock_num);
-}
-
-/** Check type and version of VRS
- *
- * Not exactly clear which values could have type and version.
- *
- * @param service_id
- * @param addr       Position sector with Volume Descriptor
- * @param vd         Returned value - Volume Descriptor.
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_volume_recongnition_structure_test(service_id_t service_id,
-    aoff64_t addr, udf_vrs_descriptor_t *vd)
-{
-	return block_read_bytes_direct(service_id, addr,
-	    sizeof(udf_vrs_descriptor_t), vd);
-}
-
-/** Read Volume Recognition Sequence
- *
- * It is a first udf data which we read.
- * It stars from fixed address VRS_ADDR = 32768 (bytes)
- *
- * @param service_id
- *
- * @return    EOK on success or an error code.
- */
-errno_t udf_volume_recongnition(service_id_t service_id)
-{
-	aoff64_t addr = VRS_ADDR;
-	bool nsr_found = false;
-
-	udf_vrs_descriptor_t *vd = malloc(sizeof(udf_vrs_descriptor_t));
-	if (!vd)
-		return ENOMEM;
-
-	errno_t rc = udf_volume_recongnition_structure_test(service_id, addr, vd);
-	if (rc != EOK) {
-		free(vd);
-		return rc;
-	}
-
-	for (size_t i = 0; i < VRS_DEPTH; i++) {
-		addr += sizeof(udf_vrs_descriptor_t);
-
-		rc = udf_volume_recongnition_structure_test(service_id, addr, vd);
-		if (rc != EOK) {
-			free(vd);
-			return rc;
-		}
-
-		/*
-		 * UDF standard identifier. According to ECMA 167 2/9.1.2
-		 */
-		if ((str_lcmp(VRS_NSR2, (char *) vd->identifier, VRS_ID_LEN) == 0) ||
-		    (str_lcmp(VRS_NSR3, (char *) vd->identifier, VRS_ID_LEN) == 0)) {
-			nsr_found = true;
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "VRS: NSR found");
-			continue;
-		}
-
-		if (str_lcmp(VRS_END, (char *) vd->identifier, VRS_ID_LEN) == 0) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "VRS: end found");
-			break;
-		}
-	}
-
-	free(vd);
-
-	if (nsr_found)
-		return EOK;
-	else
-		return EINVAL;
-}
-
-/** Convert descriptor tag fields from little-endian to current byte order
- *
- */
-static void udf_prepare_tag(udf_descriptor_tag_t *tag)
-{
-	GET_LE16(tag->id);
-	GET_LE16(tag->version);
-	GET_LE16(tag->serial);
-	GET_LE16(tag->descriptor_crc);
-	GET_LE16(tag->descriptor_crc_length);
-	GET_LE32(tag->location);
-}
-
-/** Read AVD by using one of default sector size from array
- *
- * @param service_id
- * @param avd         Returned value - Anchor Volume Descriptor
- * @param sector_size Expected sector size
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_get_anchor_volume_descriptor_by_ssize(service_id_t service_id,
-    udf_anchor_volume_descriptor_t *avd, uint32_t sector_size)
-{
-	errno_t rc = block_read_bytes_direct(service_id,
-	    UDF_AVDP_SECTOR * sector_size,
-	    sizeof(udf_anchor_volume_descriptor_t), avd);
-	if (rc != EOK)
-		return rc;
-
-	if (avd->tag.checksum != udf_tag_checksum((uint8_t *) &avd->tag))
-		return EINVAL;
-
-	// TODO: Should be tested in big-endian mode
-	udf_prepare_tag(&avd->tag);
-
-	if (avd->tag.id != UDF_TAG_AVDP)
-		return EINVAL;
-
-	GET_LE32(avd->main_extent.length);
-	GET_LE32(avd->main_extent.location);
-	GET_LE32(avd->reserve_extent.length);
-	GET_LE32(avd->reserve_extent.location);
-
-	return EOK;
-}
-
-/** Identification of the sector size
- *
- * We try to read Anchor Volume Descriptor by using one item from
- * sequence of default values. If we could read avd, we found sector size.
- *
- * @param service_id
- * @param avd        Returned value - Anchor Volume Descriptor
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_get_anchor_volume_descriptor(service_id_t service_id,
-    udf_anchor_volume_descriptor_t *avd)
-{
-	uint32_t default_sector_size[] = { 512, 1024, 2048, 4096, 8192, 0 };
-
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	if (instance->sector_size) {
-		return udf_get_anchor_volume_descriptor_by_ssize(service_id, avd,
-		    instance->sector_size);
-	} else {
-		size_t i = 0;
-		while (default_sector_size[i] != 0) {
-			rc = udf_get_anchor_volume_descriptor_by_ssize(service_id, avd,
-			    default_sector_size[i]);
-			if (rc == EOK) {
-				instance->sector_size = default_sector_size[i];
-				return EOK;
-			}
-
-			i++;
-		}
-	}
-
-	return EINVAL;
-}
-
-/** Check on prevailing primary volume descriptor
- *
- * Some discs couldn't be rewritten and new information is identified
- * by descriptors with same data as one of already created descriptors.
- * We should find prevailing descriptor (descriptor with the highest number)
- * and delete old descriptor.
- *
- * @param pvd  Array of primary volumes descriptors
- * @param cnt  Count of items in array
- * @param desc Descriptor which could prevail over one
- *             of descriptors in array.
- *
- * @return True if desc prevails over some descriptor in array
- *
- */
-static bool udf_check_prevailing_pvd(udf_primary_volume_descriptor_t *pvd,
-    size_t cnt, udf_primary_volume_descriptor_t *desc)
-{
-	for (size_t i = 0; i < cnt; i++) {
-		/*
-		 * According to ECMA 167 3/8.4.3
-		 * PVD, each of which has same contents of the corresponding
-		 * Volume Identifier, Volume set identifier
-		 * and Descriptor char set field.
-		 */
-		if ((memcmp((uint8_t *) pvd[i].volume_id,
-		    (uint8_t *) desc->volume_id, 32) == 0) &&
-		    (memcmp((uint8_t *) pvd[i].volume_set_id,
-		    (uint8_t *) desc->volume_set_id, 128) == 0) &&
-		    (memcmp((uint8_t *) &pvd[i].descriptor_charset,
-		    (uint8_t *) &desc->descriptor_charset, 64) == 0) &&
-		    (FLE32(desc->sequence_number) > FLE32(pvd[i].sequence_number))) {
-			memcpy(&pvd[i], desc, sizeof(udf_primary_volume_descriptor_t));
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** Check on prevailing logic volume descriptor
- *
- * Some discs couldn't be rewritten and new information is identified
- * by descriptors with same data as one of already created descriptors.
- * We should find  prevailing descriptor (descriptor with the highest number)
- * and delete old descriptor.
- *
- * @param lvd  Array of logic volumes descriptors
- * @param cnt  Count of items in array
- * @param desc Descriptor which could prevail over one
- *             of descriptors in array.
- *
- * @return True if desc prevails over some descriptor in array
- *
- */
-static bool udf_check_prevailing_lvd(udf_logical_volume_descriptor_t *lvd,
-    size_t cnt, udf_logical_volume_descriptor_t *desc)
-{
-	for (size_t i = 0; i < cnt; i++) {
-		/*
-		 * According to ECMA 167 3/8.4.3
-		 * LVD, each of which has same contents of the corresponding
-		 * Logic Volume Identifier and Descriptor char set field.
-		 */
-		if ((memcmp((uint8_t *) lvd[i].logical_volume_id,
-		    (uint8_t *) desc->logical_volume_id, 128) == 0) &&
-		    (memcmp((uint8_t *) &lvd[i].charset,
-		    (uint8_t *) &desc->charset, 64) == 0) &&
-		    (FLE32(desc->sequence_number) > FLE32(lvd[i].sequence_number))) {
-			memcpy(&lvd[i], desc, sizeof(udf_logical_volume_descriptor_t));
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** Check on prevailing partition descriptor
- *
- * Some discs couldn't be rewritten and new information is identified
- * by descriptors with same data as one of already created descriptors.
- * We should find  prevailing descriptor (descriptor with the highest number)
- * and delete old descriptor.
- *
- * @param pvd  Array of partition descriptors
- * @param cnt  Count of items in array
- * @param desc Descriptor which could prevail over one
- *             of descriptors in array.
- *
- * @return True if desc prevails over some descriptor in array
- *
- */
-static bool udf_check_prevailing_pd(udf_partition_descriptor_t *pd, size_t cnt,
-    udf_partition_descriptor_t *desc)
-{
-	for (size_t i = 0; i < cnt; i++) {
-		/*
-		 * According to ECMA 167 3/8.4.3
-		 * Partition descriptors with identical Partition Number
-		 */
-		if ((FLE16(pd[i].number) == FLE16(desc->number)) &&
-		    (FLE32(desc->sequence_number) > FLE32(pd[i].sequence_number))) {
-			memcpy(&pd[i], desc, sizeof(udf_partition_descriptor_t));
-			return true;
-		}
-	}
-
-	return false;
-}
-
-/** Read information about virtual partition
- *
- * Fill start and length fields for partition. This function quite similar of
- * udf_read_icd. But in this we can meet only two descriptors and
- * we have to read only one allocator.
- *
- * @param instance UDF instance
- * @param pos      Position (Extended) File entry descriptor
- * @param id       Index of partition in instance::partitions array
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_read_virtual_partition(udf_instance_t *instance, uint32_t pos,
-    uint32_t id)
-{
-	block_t *block = NULL;
-	errno_t rc = block_get(&block, instance->service_id, pos,
-	    BLOCK_FLAGS_NONE);
-	if (rc != EOK)
-		return rc;
-
-	udf_descriptor_tag_t *desc = (udf_descriptor_tag_t *) (block->data);
-	if (desc->checksum != udf_tag_checksum((uint8_t *) desc)) {
-		block_put(block);
-		return EINVAL;
-	}
-
-	/*
-	 * We think that we have only one allocator. It is means that virtual
-	 * partition, like physical, isn't fragmented.
-	 * According to doc the type of allocator is short_ad.
-	 */
-	switch (FLE16(desc->id)) {
-	case UDF_FILE_ENTRY:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "ICB: File entry descriptor found");
-
-		udf_file_entry_descriptor_t *fed =
-		    (udf_file_entry_descriptor_t *) block->data;
-		uint32_t start_alloc = FLE32(fed->ea_length) + UDF_FE_OFFSET;
-		udf_short_ad_t *short_d =
-		    (udf_short_ad_t *) ((uint8_t *) fed + start_alloc);
-		instance->partitions[id].start = FLE32(short_d->position);
-		instance->partitions[id].length = FLE32(short_d->length);
-		break;
-
-	case UDF_EFILE_ENTRY:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "ICB: Extended file entry descriptor found");
-
-		udf_extended_file_entry_descriptor_t *efed =
-		    (udf_extended_file_entry_descriptor_t *) block->data;
-		start_alloc = FLE32(efed->ea_length) + UDF_EFE_OFFSET;
-		short_d = (udf_short_ad_t *) ((uint8_t *) efed + start_alloc);
-		instance->partitions[id].start = FLE32(short_d->position);
-		instance->partitions[id].length = FLE32(short_d->length);
-		break;
-	}
-
-	return block_put(block);
-}
-
-/** Search partition in array of partitions
- *
- * Used only in function udf_fill_volume_info
- *
- * @param pd     Array of partitions
- * @param pd_cnt Count items in array
- * @param id     Number partition (not index) which we want to find
- *
- * @return Index of partition or (size_t) -1 if we didn't find anything
- *
- */
-static size_t udf_find_partition(udf_partition_descriptor_t *pd, size_t pd_cnt,
-    size_t id)
-{
-	for (size_t i = 0; i < pd_cnt; i++) {
-		if (FLE16(pd[i].number) == id)
-			return i;
-	}
-
-	return (size_t) -1;
-}
-
-/** Fill instance structures by information about partitions and logic
- *
- * @param lvd      Array of logic volumes descriptors
- * @param lvd_cnt  Count of items in lvd array
- * @param pd       Array of partition descriptors
- * @param pd_cnt   Count of items in pd array
- * @param instance UDF instance
- *
- * @return EOK on success or an error code.
- *
- */
-static errno_t udf_fill_volume_info(udf_logical_volume_descriptor_t *lvd,
-    size_t lvd_cnt, udf_partition_descriptor_t *pd, size_t pd_cnt,
-    udf_instance_t *instance)
-{
-	instance->volumes = calloc(lvd_cnt, sizeof(udf_lvolume_t));
-	if (instance->volumes == NULL)
-		return ENOMEM;
-
-	instance->partitions = calloc(pd_cnt, sizeof(udf_partition_t));
-	if (instance->partitions == NULL) {
-		free(instance->volumes);
-		return ENOMEM;
-	}
-
-	instance->partition_cnt = pd_cnt;
-
-	/*
-	 * Fill information about logical volumes. We will save
-	 * information about all partitions placed inside each volumes.
-	 */
-
-	size_t vir_pd_cnt = 0;
-	for (size_t i = 0; i < lvd_cnt; i++) {
-		instance->volumes[i].partitions =
-		    calloc(FLE32(lvd[i].number_of_partitions_maps),
-		    sizeof(udf_partition_t *));
-		if (instance->volumes[i].partitions == NULL) {
-			// FIXME: Memory leak, cleanup code missing
-			return ENOMEM;
-		}
-
-		instance->volumes[i].partition_cnt = 0;
-		instance->volumes[i].logical_block_size =
-		    FLE32(lvd[i].logical_block_size);
-
-		/*
-		 * In theory we could have more than 1 logical volume. But now
-		 * for current work of driver we will think that it single and all
-		 * partitions from array pd belong to only first lvd
-		 */
-
-		uint8_t *idx = lvd[i].partition_map;
-		for (size_t j = 0; j < FLE32(lvd[i].number_of_partitions_maps);
-		    j++) {
-			udf_type1_partition_map_t *pm1 =
-			    (udf_type1_partition_map_t *) idx;
-
-			if (pm1->partition_map_type == 1) {
-				size_t pd_num = udf_find_partition(pd, pd_cnt,
-				    FLE16(pm1->partition_number));
-				if (pd_num == (size_t) -1) {
-					// FIXME: Memory leak, cleanup code missing
-					return ENOENT;
-				}
-
-				/*
-				 * Fill information about physical partitions. We will save all
-				 * partitions (physical and virtual) inside one array
-				 * instance::partitions
-				 */
-				instance->partitions[j].access_type =
-				    FLE32(pd[pd_num].access_type);
-				instance->partitions[j].length =
-				    FLE32(pd[pd_num].length);
-				instance->partitions[j].number =
-				    FLE16(pm1->partition_number);
-				instance->partitions[j].start =
-				    FLE32(pd[pd_num].starting_location);
-
-				instance->volumes[i].partitions[
-				    instance->volumes[i].partition_cnt] =
-				    &instance->partitions[j];
-
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume[%" PRIun "]: partition [type %u] "
-				    "found and filled", i, pm1->partition_map_type);
-
-				instance->volumes[i].partition_cnt++;
-				idx += pm1->partition_map_length;
-				continue;
-			}
-
-			udf_type2_partition_map_t *pm2 =
-			    (udf_type2_partition_map_t *) idx;
-
-			if (pm2->partition_map_type == 2) {
-				// TODO: check partition_ident for metadata_partition_map
-
-				udf_metadata_partition_map_t *metadata =
-				    (udf_metadata_partition_map_t *) idx;
-
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Metadata file location=%u",
-				    FLE32(metadata->metadata_fileloc));
-
-				vir_pd_cnt++;
-				instance->partitions = realloc(instance->partitions,
-				    (pd_cnt + vir_pd_cnt) * sizeof(udf_partition_t));
-				if (instance->partitions == NULL) {
-					// FIXME: Memory leak, cleanup code missing
-					return ENOMEM;
-				}
-
-				instance->partition_cnt++;
-
-				size_t pd_num = udf_find_partition(pd, pd_cnt,
-				    FLE16(metadata->partition_number));
-				if (pd_num == (size_t) -1) {
-					// FIXME: Memory leak, cleanup code missing
-					return ENOENT;
-				}
-
-				instance->partitions[j].number =
-				    FLE16(metadata->partition_number);
-				errno_t rc = udf_read_virtual_partition(instance,
-				    FLE32(metadata->metadata_fileloc) +
-				    FLE32(pd[pd_num].starting_location), j);
-				if (rc != EOK) {
-					// FIXME: Memory leak, cleanup code missing
-					return rc;
-				}
-
-				/* Virtual partition placed inside physical */
-				instance->partitions[j].start +=
-				    FLE32(pd[pd_num].starting_location);
-
-				instance->volumes[i].partitions[
-				    instance->volumes[i].partition_cnt] =
-				    &instance->partitions[j];
-
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Virtual partition: num=%d, start=%d",
-				    instance->partitions[j].number,
-				    instance->partitions[j].start);
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume[%" PRIun "]: partition [type %u] "
-				    "found and filled", i, pm2->partition_map_type);
-
-				instance->volumes[i].partition_cnt++;
-				idx += metadata->partition_map_length;
-				continue;
-			}
-
-			/* Not type 1 nor type 2 */
-			udf_general_type_t *pm = (udf_general_type_t *) idx;
-
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume[%" PRIun "]: partition [type %u] "
-			    "found and skipped", i, pm->partition_map_type);
-
-			idx += pm->partition_map_length;
-		}
-	}
-
-	return EOK;
-}
-
-/** Read volume descriptors sequence
- *
- * @param service_id
- * @param addr       UDF extent descriptor (ECMA 167 3/7.1)
- *
- * @return EOK on success or an error code.
- *
- */
-errno_t udf_read_volume_descriptor_sequence(service_id_t service_id,
-    udf_extent_t addr)
-{
-	udf_instance_t *instance;
-	errno_t rc = fs_instance_get(service_id, (void **) &instance);
-	if (rc != EOK)
-		return rc;
-
-	aoff64_t pos = addr.location;
-	aoff64_t end = pos + (addr.length / instance->sector_size) - 1;
-
-	if (pos == end)
-		return EINVAL;
-
-	size_t max_descriptors = ALL_UP(addr.length, instance->sector_size);
-
-	udf_primary_volume_descriptor_t *pvd = calloc(max_descriptors,
-	    sizeof(udf_primary_volume_descriptor_t));
-	if (pvd == NULL)
-		return ENOMEM;
-
-	udf_logical_volume_descriptor_t *lvd = calloc(max_descriptors,
-	    instance->sector_size);
-	if (lvd == NULL) {
-		free(pvd);
-		return ENOMEM;
-	}
-
-	udf_partition_descriptor_t *pd = calloc(max_descriptors,
-	    sizeof(udf_partition_descriptor_t));
-	if (pd == NULL) {
-		free(pvd);
-		free(lvd);
-		return ENOMEM;
-	}
-
-	size_t pvd_cnt = 0;
-	size_t lvd_cnt = 0;
-	size_t pd_cnt = 0;
-
-	while (pos <= end) {
-		block_t *block = NULL;
-		rc = block_get(&block, service_id, pos, BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			free(pvd);
-			free(lvd);
-			free(pd);
-			return rc;
-		}
-
-		udf_volume_descriptor_t *vol =
-		    (udf_volume_descriptor_t *) block->data;
-
-		switch (FLE16(vol->common.tag.id)) {
-			/*
-			 * One sector size descriptors
-			 */
-
-		case UDF_TAG_PVD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Primary volume descriptor found");
-
-			if (!udf_check_prevailing_pvd(pvd, pvd_cnt, &vol->volume)) {
-				memcpy(&pvd[pvd_cnt], &vol->volume,
-				    sizeof(udf_primary_volume_descriptor_t));
-				pvd_cnt++;
-			}
-
-			pos++;
-			break;
-
-		case UDF_TAG_VDP:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Volume descriptor pointer found");
-			pos++;
-			break;
-
-		case UDF_TAG_IUVD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG,
-			    "Volume: Implementation use volume descriptor found");
-			pos++;
-			break;
-
-		case UDF_TAG_PD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Partition descriptor found");
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition number: %u, contents: '%.6s', "
-			    "access type: %" PRIu32, FLE16(vol->partition.number),
-			    vol->partition.contents.id, FLE32(vol->partition.access_type));
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition start: %" PRIu32 " (sector), "
-			    "size: %" PRIu32 " (sectors)",
-			    FLE32(vol->partition.starting_location),
-			    FLE32(vol->partition.length));
-
-			if (!udf_check_prevailing_pd(pd, pd_cnt, &vol->partition)) {
-				memcpy(&pd[pd_cnt], &vol->partition,
-				    sizeof(udf_partition_descriptor_t));
-				pd_cnt++;
-			}
-
-			udf_partition_header_descriptor_t *phd =
-			    (udf_partition_header_descriptor_t *) vol->partition.contents_use;
-			if (FLE32(phd->unallocated_space_table.length)) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG,
-				    "space table: length=%" PRIu32 ", pos=%" PRIu32,
-				    FLE32(phd->unallocated_space_table.length),
-				    FLE32(phd->unallocated_space_table.position));
-
-				instance->space_type = SPACE_TABLE;
-				instance->uaspace_start =
-				    FLE32(vol->partition.starting_location) +
-				    FLE32(phd->unallocated_space_table.position);
-				instance->uaspace_length =
-				    FLE32(phd->unallocated_space_table.length);
-			}
-
-			if (FLE32(phd->unallocated_space_bitmap.length)) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG,
-				    "space bitmap: length=%" PRIu32 ", pos=%" PRIu32,
-				    FLE32(phd->unallocated_space_bitmap.length),
-				    FLE32(phd->unallocated_space_bitmap.position));
-
-				instance->space_type = SPACE_BITMAP;
-				instance->uaspace_start =
-				    FLE32(vol->partition.starting_location) +
-				    FLE32(phd->unallocated_space_bitmap.position);
-				instance->uaspace_length =
-				    FLE32(phd->unallocated_space_bitmap.length);
-			}
-
-			pos++;
-			break;
-
-			/*
-			 * Relative size descriptors
-			 */
-
-		case UDF_TAG_LVD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Logical volume descriptor found");
-
-			aoff64_t sct =
-			    ALL_UP((sizeof(udf_logical_volume_descriptor_t) +
-			    FLE32(vol->logical.map_table_length)),
-			    sizeof(udf_common_descriptor_t));
-			pos += sct;
-			char tmp[130];
-
-			udf_to_unix_name(tmp, 129,
-			    (char *) vol->logical.logical_volume_id, 128,
-			    &vol->logical.charset);
-
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Logical Volume ID: '%s', "
-			    "logical block size: %" PRIu32 " (bytes)", tmp,
-			    FLE32(vol->logical.logical_block_size));
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Map table size: %" PRIu32 " (bytes), "
-			    "number of partition maps: %" PRIu32,
-			    FLE32(vol->logical.map_table_length),
-			    FLE32(vol->logical.number_of_partitions_maps));
-
-			if (!udf_check_prevailing_lvd(lvd, lvd_cnt, &vol->logical)) {
-				memcpy(&lvd[lvd_cnt], &vol->logical,
-				    sizeof(udf_logical_volume_descriptor_t) +
-				    FLE32(vol->logical.map_table_length));
-				lvd_cnt++;
-			}
-
-			break;
-
-		case UDF_TAG_USD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Unallocated space descriptor found");
-
-			sct = ALL_UP((sizeof(udf_unallocated_space_descriptor_t) +
-			    FLE32(vol->unallocated.allocation_descriptors_num) *
-			    sizeof(udf_extent_t)), sizeof(udf_common_descriptor_t));
-			instance->uaspace_start = pos;
-			instance->uaspace_length = sct;
-			instance->uasd = (udf_unallocated_space_descriptor_t *)
-			    malloc(sct * instance->sector_size);
-			if (instance->uasd == NULL) {
-				// FIXME: Memory leak, cleanup missing
-				return ENOMEM;
-			}
-
-			memcpy(instance->uasd, block->data, instance->sector_size);
-			pos += sct;
-			break;
-
-		case UDF_TAG_LVID:
-			log_msg(LOG_DEFAULT, LVL_DEBUG,
-			    "Volume: Logical volume integrity descriptor found");
-
-			pos++;
-			break;
-
-		case UDF_TAG_TD:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Volume: Terminating descriptor found");
-
-			/* Found terminating descriptor. Exiting */
-			pos = end + 1;
-			break;
-
-		default:
-			pos++;
-		}
-
-		rc = block_put(block);
-		if (rc != EOK) {
-			free(pvd);
-			free(lvd);
-			free(pd);
-			return rc;
-		}
-	}
-
-	/* Fill the instance */
-	udf_fill_volume_info(lvd, lvd_cnt, pd, pd_cnt, instance);
-
-	for (size_t i = 0; i < lvd_cnt; i++) {
-		pos = udf_long_ad_to_pos(instance,
-		    (udf_long_ad_t *) &lvd[i].logical_volume_conents_use);
-
-		block_t *block = NULL;
-		rc = block_get(&block, instance->service_id, pos,
-		    BLOCK_FLAGS_NONE);
-		if (rc != EOK) {
-			// FIXME: Memory leak, cleanup missing
-			return rc;
-		}
-
-		udf_descriptor_tag_t *desc = block->data;
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "First tag ID=%" PRIu16, desc->id);
-
-		if (desc->checksum != udf_tag_checksum((uint8_t *) desc)) {
-			// FIXME: Memory leak, cleanup missing
-			return EINVAL;
-		}
-
-		udf_prepare_tag(desc);
-
-		udf_fileset_descriptor_t *fd = block->data;
-		memcpy((uint8_t *) &instance->charset,
-		    (uint8_t *) &fd->fileset_charset, sizeof(fd->fileset_charset));
-
-		instance->volumes[i].root_dir = udf_long_ad_to_pos(instance,
-		    &fd->root_dir_icb);
-	}
-
-	free(pvd);
-	free(lvd);
-	free(pd);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/fs/udf/udf_volume.h
===================================================================
--- uspace/srv/fs/udf/udf_volume.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2012 Julia Medvedeva
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udf
- * @{
- */
-
-#ifndef UDF_UDF_VOLUME_H_
-#define UDF_UDF_VOLUME_H_
-
-#include <stdint.h>
-#include <ipc/loc.h>
-#include "udf_types.h"
-
-/* Descriptor Tag Identifier (ECMA 167 3/7.2.1) */
-#define UDF_TAG_PVD   0x0001  /* Primary Volume Descriptor */
-#define UDF_TAG_AVDP  0x0002  /* Anchor Volume Descriptor */
-#define UDF_TAG_VDP   0x0003  /* Volume Descriptor Pointer */
-#define UDF_TAG_IUVD  0x0004  /* Implementation Use Volume Descriptor */
-#define UDF_TAG_PD    0x0005  /* Partition Descriptor */
-#define UDF_TAG_LVD   0x0006  /* Logical Volume Descriptor */
-#define UDF_TAG_USD   0x0007  /* Unallocated Space Descriptor */
-#define UDF_TAG_TD    0x0008  /* Terminating Descriptor */
-#define UDF_TAG_LVID  0x0009  /* Logical Volume Integrity Descriptor */
-
-/* Start address of Anchor Volume Descriptor */
-#define UDF_AVDP_SECTOR  256
-
-/* Volume Recognition Sequence params */
-#define VRS_ADDR     32768
-#define VRS_TYPE     0
-#define VRS_VERSION  1
-#define VRS_BEGIN    "BEA01"
-#define VRS_END      "TEA01"
-#define VRS_NSR2     "NSR02"
-#define VRS_NSR3     "NSR03"
-#define VRS_DEPTH    10
-#define VRS_ID_LEN   5
-
-/* Volume Structure Descriptor (ECMA 167 2/9.1) */
-typedef struct udf_vrs_descriptor {
-	uint8_t type;           /* Structure type */
-	uint8_t identifier[5];  /* Standart identifier */
-	uint8_t version;        /* Structure version */
-	uint8_t data[2041];     /* Structure data */
-} __attribute__((packed)) udf_vrs_descriptor_t;
-
-/* Anchor volume descriptor (ECMA 167 3/10.2) */
-typedef struct udf_anchor_volume_descriptor {
-	udf_descriptor_tag_t tag;     /* Descriptor tag */
-	udf_extent_t main_extent;     /* Main Volume Descriptor Sequence Extent */
-	udf_extent_t reserve_extent;  /* Reserve Volume Descriptor Sequence Extent */
-	uint8_t reserved[480];        /* Structure data */
-} __attribute__((packed)) udf_anchor_volume_descriptor_t;
-
-/* Common Volume Descriptor */
-typedef struct udf_common_descriptor {
-	udf_descriptor_tag_t tag;
-	uint8_t reserved[496];
-} __attribute__((packed)) udf_common_descriptor_t;
-
-/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
-typedef struct udf_volume_pointer_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t sequence_number;
-	udf_extent_t next_sequence;
-	uint8_t reserved[484];
-} __attribute__((packed)) udf_volume_pointer_descriptor_t;
-
-/* Primary Volume Descriptor (ECMA 167 3/10.1) */
-typedef struct udf_primary_volume_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t sequence_number;
-	uint32_t primary_volume_descriptor_num;
-	udf_dstring volume_id[32];
-	uint16_t max_sequence_number;
-	uint16_t interchange_level;
-	uint16_t max_interchange_level;
-	uint32_t charset_list;
-	uint32_t max_charset_list;
-	udf_dstring volume_set_id[128];
-	udf_charspec_t descriptor_charset;
-	udf_charspec_t explanatory_charset;
-	udf_extent_t volume_abstract;
-	udf_extent_t volume_copyright_notice;
-	udf_regid_t application_id;
-	udf_timestamp_t recording_data_and_time;
-	udf_regid_t implementation_id;
-	uint8_t implementation_use[64];
-	uint32_t predecessor_vds_location;
-	uint16_t flags;
-	uint8_t reserved[22];
-} __attribute__((packed)) udf_primary_volume_descriptor_t;
-
-/* Partition Descriptor (ECMA 167 3/10.5) */
-typedef struct udf_partition_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t sequence_number;
-	uint16_t flags;
-	uint16_t number;
-	udf_regid_t contents;
-	uint8_t contents_use[128];
-	uint32_t access_type;
-	uint32_t starting_location;
-	uint32_t length;
-	udf_regid_t implementation_id;
-	uint8_t implementation_use[128];
-	uint8_t reserved[156];
-} __attribute__((packed)) udf_partition_descriptor_t;
-
-/* Logical Volume Descriptor (ECMA 167 3/10.6) */
-typedef struct udf_logical_volume_descriptor {
-	udf_descriptor_tag_t tag;
-	uint32_t sequence_number;
-	udf_charspec_t charset;
-	udf_dstring logical_volume_id[128];
-	uint32_t logical_block_size;
-	udf_regid_t domain_id;
-	uint8_t logical_volume_conents_use[16];
-	uint32_t map_table_length;
-	uint32_t number_of_partitions_maps;
-	udf_regid_t implementation_id;
-	uint8_t implementation_use[128];
-	udf_extent_t integrity_sequence_extent;
-	uint8_t partition_map[0];
-} __attribute__((packed)) udf_logical_volume_descriptor_t;
-
-typedef struct udf_volume_descriptor {
-	union {
-		udf_common_descriptor_t common;
-		udf_terminating_descriptor_t terminating;
-		udf_volume_pointer_descriptor_t pointer;
-		udf_partition_descriptor_t partition;
-		udf_logical_volume_descriptor_t logical;
-		udf_unallocated_space_descriptor_t unallocated;
-		udf_primary_volume_descriptor_t volume;
-	};
-} __attribute__((packed)) udf_volume_descriptor_t;
-
-typedef struct udf_general_type {
-	uint8_t partition_map_type;
-	uint8_t partition_map_length;
-} __attribute__((packed)) udf_general_type_t;
-
-typedef struct udf_type1_partition_map {
-	uint8_t partition_map_type;
-	uint8_t partition_map_length;
-	uint16_t volume_sequence_number;
-	uint16_t partition_number;
-} __attribute__((packed)) udf_type1_partition_map_t;
-
-typedef struct udf_type2_partition_map {
-	uint8_t partition_map_type;
-	uint8_t partition_map_length;
-	uint8_t reserved1[2];
-	udf_regid_t partition_ident;
-	uint16_t volume_sequence_number;
-	uint16_t partition_number;
-} __attribute__((packed)) udf_type2_partition_map_t;
-
-/* Metadata Partition Map (UDF 2.4.0 2.2.10) */
-typedef struct udf_metadata_partition_map {
-	uint8_t partition_map_type;
-	uint8_t partition_map_length;
-	uint8_t reserved1[2];
-	udf_regid_t partition_ident;
-	uint16_t volume_sequence_number;
-	uint16_t partition_number;
-	uint32_t metadata_fileloc;
-	uint32_t metadata_mirror_fileloc;
-	uint32_t metadata_bitmap_fileloc;
-	uint32_t alloc_unit_size;
-	uint16_t align_unit_size;
-	uint8_t flags;
-	uint8_t reserved2[5];
-} __attribute__((packed)) udf_metadata_partition_map_t;
-
-/* Partition Header Descriptor (ECMA 167 4/14.3) */
-typedef struct udf_partition_header_descriptor {
-	udf_short_ad_t unallocated_space_table;
-	udf_short_ad_t unallocated_space_bitmap;
-	udf_short_ad_t partition_integrity_table;
-	udf_short_ad_t freed_space_table;
-	udf_short_ad_t freed_space_bitmap;
-	uint8_t reserved[88];
-} __attribute__((packed)) udf_partition_header_descriptor_t;
-
-extern errno_t udf_volume_recongnition(service_id_t);
-extern errno_t udf_get_anchor_volume_descriptor(service_id_t,
-    udf_anchor_volume_descriptor_t *);
-extern errno_t udf_read_volume_descriptor_sequence(service_id_t, udf_extent_t);
-extern fs_index_t udf_long_ad_to_pos(udf_instance_t *, udf_long_ad_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/console/console.c
===================================================================
--- uspace/srv/hid/console/console.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1005 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup console
- * @{
- */
-/** @file
- */
-
-#include <async.h>
-#include <stdio.h>
-#include <adt/prodcons.h>
-#include <io/console.h>
-#include <io/input.h>
-#include <ipc/vfs.h>
-#include <errno.h>
-#include <str_error.h>
-#include <loc.h>
-#include <io/con_srv.h>
-#include <io/kbd_event.h>
-#include <io/keycode.h>
-#include <io/chargrid.h>
-#include <io/output.h>
-#include <align.h>
-#include <as.h>
-#include <task.h>
-#include <fibril_synch.h>
-#include <stdatomic.h>
-#include <stdlib.h>
-#include <str.h>
-#include "console.h"
-
-#define NAME       "console"
-#define NAMESPACE  "term"
-
-#define UTF8_CHAR_BUFFER_SIZE  (STR_BOUNDS(1) + 1)
-
-typedef struct {
-	atomic_flag refcnt;      /**< Connection reference count */
-	prodcons_t input_pc;  /**< Incoming console events */
-
-	/**
-	 * Not yet sent bytes of last char event.
-	 */
-	char char_remains[UTF8_CHAR_BUFFER_SIZE];
-	size_t char_remains_len;  /**< Number of not yet sent bytes. */
-
-	fibril_mutex_t mtx;  /**< Lock protecting mutable fields */
-
-	size_t index;           /**< Console index */
-	service_id_t dsid;      /**< Service handle */
-
-	sysarg_t cols;         /**< Number of columns */
-	sysarg_t rows;         /**< Number of rows */
-	console_caps_t ccaps;  /**< Console capabilities */
-
-	sysarg_t ucols;		/**< Number of columns in user buffer */
-	sysarg_t urows;		/**< Number of rows in user buffer */
-	charfield_t *ubuf;	/**< User buffer */
-
-	chargrid_t *frontbuf;    /**< Front buffer */
-	frontbuf_handle_t fbid;  /**< Front buffer handle */
-	con_srvs_t srvs;         /**< Console service setup */
-} console_t;
-
-static loc_srv_t *console_srv;
-
-/** Input server proxy */
-static input_t *input;
-static bool active = false;
-
-/** Session to the output server */
-static async_sess_t *output_sess;
-
-/** Output dimensions */
-static sysarg_t cols;
-static sysarg_t rows;
-
-/** Mouse pointer X coordinate */
-static int pointer_x;
-/** Mouse pointer Y coordinate */
-static int pointer_y;
-/** Character under mouse cursor */
-static charfield_t pointer_bg;
-
-static int mouse_scale_x = 4;
-static int mouse_scale_y = 8;
-
-/** Array of data for virtual consoles */
-static console_t consoles[CONSOLE_COUNT];
-
-/** Mutex for console switching */
-static FIBRIL_MUTEX_INITIALIZE(switch_mtx);
-
-static console_t *active_console = &consoles[0];
-
-static errno_t input_ev_active(input_t *);
-static errno_t input_ev_deactive(input_t *);
-static errno_t input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
-    keymod_t, char32_t);
-static errno_t input_ev_move(input_t *, unsigned, int, int);
-static errno_t input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
-    unsigned, unsigned);
-static errno_t input_ev_button(input_t *, unsigned, int, int);
-static errno_t input_ev_dclick(input_t *, unsigned, int);
-
-static input_ev_ops_t input_ev_ops = {
-	.active = input_ev_active,
-	.deactive = input_ev_deactive,
-	.key = input_ev_key,
-	.move = input_ev_move,
-	.abs_move = input_ev_abs_move,
-	.button = input_ev_button,
-	.dclick = input_ev_dclick
-};
-
-static errno_t cons_open(con_srvs_t *, con_srv_t *);
-static errno_t cons_close(con_srv_t *);
-static errno_t cons_read(con_srv_t *, void *, size_t, size_t *);
-static errno_t cons_write(con_srv_t *, void *, size_t, size_t *);
-static void cons_sync(con_srv_t *);
-static void cons_clear(con_srv_t *);
-static void cons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t cons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t cons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t cons_get_color_cap(con_srv_t *, console_caps_t *);
-static void cons_set_style(con_srv_t *, console_style_t);
-static void cons_set_color(con_srv_t *, console_color_t, console_color_t,
-    console_color_attr_t);
-static void cons_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
-static void cons_set_cursor_visibility(con_srv_t *, bool);
-static errno_t cons_set_caption(con_srv_t *, const char *);
-static errno_t cons_get_event(con_srv_t *, cons_event_t *);
-static errno_t cons_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
-static void cons_unmap(con_srv_t *);
-static void cons_buf_update(con_srv_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-
-static con_ops_t con_ops = {
-	.open = cons_open,
-	.close = cons_close,
-	.read = cons_read,
-	.write = cons_write,
-	.sync = cons_sync,
-	.clear = cons_clear,
-	.set_pos = cons_set_pos,
-	.get_pos = cons_get_pos,
-	.get_size = cons_get_size,
-	.get_color_cap = cons_get_color_cap,
-	.set_style = cons_set_style,
-	.set_color = cons_set_color,
-	.set_rgb_color = cons_set_rgb_color,
-	.set_cursor_visibility = cons_set_cursor_visibility,
-	.set_caption = cons_set_caption,
-	.get_event = cons_get_event,
-	.map = cons_map,
-	.unmap = cons_unmap,
-	.update = cons_buf_update
-};
-
-static void pointer_draw(void);
-static void pointer_undraw(void);
-
-static console_t *srv_to_console(con_srv_t *srv)
-{
-	return srv->srvs->sarg;
-}
-
-static void cons_update(console_t *cons)
-{
-	fibril_mutex_lock(&switch_mtx);
-	fibril_mutex_lock(&cons->mtx);
-
-	if ((active) && (cons == active_console)) {
-		output_update(output_sess, cons->fbid);
-		output_cursor_update(output_sess, cons->fbid);
-	}
-
-	fibril_mutex_unlock(&cons->mtx);
-	fibril_mutex_unlock(&switch_mtx);
-}
-
-static void cons_update_cursor(console_t *cons)
-{
-	fibril_mutex_lock(&switch_mtx);
-	fibril_mutex_lock(&cons->mtx);
-
-	if ((active) && (cons == active_console))
-		output_cursor_update(output_sess, cons->fbid);
-
-	fibril_mutex_unlock(&cons->mtx);
-	fibril_mutex_unlock(&switch_mtx);
-}
-
-static void cons_damage(console_t *cons)
-{
-	fibril_mutex_lock(&switch_mtx);
-	fibril_mutex_lock(&cons->mtx);
-
-	if ((active) && (cons == active_console)) {
-		output_damage(output_sess, cons->fbid, 0, 0, cons->cols,
-		    cons->rows);
-		output_cursor_update(output_sess, cons->fbid);
-	}
-
-	fibril_mutex_unlock(&cons->mtx);
-	fibril_mutex_unlock(&switch_mtx);
-}
-
-static void cons_switch(unsigned int index)
-{
-	/*
-	 * The first undefined index is reserved
-	 * for switching to the kernel console.
-	 */
-	if (index == CONSOLE_COUNT) {
-		if (console_kcon())
-			active = false;
-
-		return;
-	}
-
-	if (index > CONSOLE_COUNT)
-		return;
-
-	console_t *cons = &consoles[index];
-
-	fibril_mutex_lock(&switch_mtx);
-	pointer_undraw();
-
-	if (cons == active_console) {
-		fibril_mutex_unlock(&switch_mtx);
-		return;
-	}
-
-	active_console = cons;
-
-	pointer_draw();
-	fibril_mutex_unlock(&switch_mtx);
-
-	cons_damage(cons);
-}
-
-/** Draw mouse pointer. */
-static void pointer_draw(void)
-{
-	charfield_t *ch;
-	int col, row;
-
-	/* Downscale coordinates to text resolution */
-	col = pointer_x / mouse_scale_x;
-	row = pointer_y / mouse_scale_y;
-
-	/* Make sure they are in range */
-	if (col < 0 || row < 0 || col >= (int)cols || row >= (int)rows)
-		return;
-
-	ch = chargrid_charfield_at(active_console->frontbuf, col, row);
-
-	/*
-	 * Store background attributes for undrawing the pointer.
-	 * This is necessary as styles cannot be inverted with
-	 * round trip (unlike RGB or INDEX)
-	 */
-	pointer_bg = *ch;
-
-	/* In general the color should be a one's complement of the background */
-	if (ch->attrs.type == CHAR_ATTR_INDEX) {
-		ch->attrs.val.index.bgcolor ^= 0xf;
-		ch->attrs.val.index.fgcolor ^= 0xf;
-	} else if (ch->attrs.type == CHAR_ATTR_RGB) {
-		ch->attrs.val.rgb.fgcolor ^= 0xffffff;
-		ch->attrs.val.rgb.bgcolor ^= 0xffffff;
-	} else if (ch->attrs.type == CHAR_ATTR_STYLE) {
-		/* Don't have a proper inverse for each style */
-		if (ch->attrs.val.style == STYLE_INVERTED)
-			ch->attrs.val.style = STYLE_NORMAL;
-		else
-			ch->attrs.val.style = STYLE_INVERTED;
-	}
-
-	/* Make sure the cell gets updated */
-	ch->flags |= CHAR_FLAG_DIRTY;
-}
-
-/** Undraw mouse pointer. */
-static void pointer_undraw(void)
-{
-	charfield_t *ch;
-	int col, row;
-
-	col = pointer_x / mouse_scale_x;
-	row = pointer_y / mouse_scale_y;
-	if (col < 0 || row < 0 || col >= (int)cols || row >= (int)rows)
-		return;
-
-	ch = chargrid_charfield_at(active_console->frontbuf, col, row);
-	*ch = pointer_bg;
-	ch->flags |= CHAR_FLAG_DIRTY;
-}
-
-/** Queue console event.
- *
- * @param cons Console
- * @param ev Console event
- */
-static void console_queue_cons_event(console_t *cons, cons_event_t *ev)
-{
-	/* Got key press/release event */
-	cons_qevent_t *event =
-	    (cons_qevent_t *) malloc(sizeof(cons_qevent_t));
-	if (event == NULL)
-		return;
-
-	event->ev = *ev;
-	link_initialize(&event->link);
-
-	prodcons_produce(&cons->input_pc, &event->link);
-}
-
-static errno_t input_ev_active(input_t *input)
-{
-	active = true;
-	output_claim(output_sess);
-	cons_damage(active_console);
-
-	return EOK;
-}
-
-static errno_t input_ev_deactive(input_t *input)
-{
-	active = false;
-	output_yield(output_sess);
-
-	return EOK;
-}
-
-static errno_t input_ev_key(input_t *input, unsigned kbd_id,
-    kbd_event_type_t type, keycode_t key, keymod_t mods, char32_t c)
-{
-	cons_event_t event;
-	bool alt;
-	bool shift;
-
-	alt = (mods & KM_ALT) != 0 && (mods & (KM_CTRL | KM_SHIFT)) == 0;
-	shift = (mods & KM_SHIFT) != 0 && (mods & (KM_CTRL | KM_ALT)) == 0;
-
-	/* Switch console on Alt+Fn or Shift+Fn */
-	if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) &&
-	    (alt || shift)) {
-		cons_switch(key - KC_F1);
-	} else {
-		/* Got key press/release event */
-		event.type = CEV_KEY;
-
-		(void)kbd_id;
-		event.ev.key.type = type;
-		event.ev.key.key = key;
-		event.ev.key.mods = mods;
-		event.ev.key.c = c;
-
-		console_queue_cons_event(active_console, &event);
-	}
-
-	return EOK;
-}
-
-/** Update pointer position.
- *
- * @param new_x New X coordinate (in pixels)
- * @param new_y New Y coordinate (in pixels)
- */
-static void pointer_update(int new_x, int new_y)
-{
-	bool upd_pointer;
-
-	/* Make sure coordinates are in range */
-
-	if (new_x < 0)
-		new_x = 0;
-	if (new_x >= (int)cols * mouse_scale_x)
-		new_x = cols * mouse_scale_x - 1;
-	if (new_y < 0)
-		new_y = 0;
-	if (new_y >= (int)rows * mouse_scale_y)
-		new_y = rows * mouse_scale_y - 1;
-
-	/* Determine if pointer moved to a different character cell */
-	upd_pointer = (new_x / mouse_scale_x != pointer_x / mouse_scale_x) ||
-	    (new_y / mouse_scale_y != pointer_y / mouse_scale_y);
-
-	if (upd_pointer)
-		pointer_undraw();
-
-	/* Store new pointer position */
-	pointer_x = new_x;
-	pointer_y = new_y;
-
-	if (upd_pointer) {
-		pointer_draw();
-		cons_update(active_console);
-	}
-}
-
-static errno_t input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
-{
-	(void) pos_id;
-	pointer_update(pointer_x + dx, pointer_y + dy);
-	return EOK;
-}
-
-static errno_t input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
-    unsigned y, unsigned max_x, unsigned max_y)
-{
-	(void)pos_id;
-	pointer_update(mouse_scale_x * cols * x / max_x, mouse_scale_y * rows * y / max_y);
-	return EOK;
-}
-
-static errno_t input_ev_button(input_t *input, unsigned pos_id, int bnum,
-    int bpress)
-{
-	cons_event_t event;
-
-	(void)pos_id;
-
-	event.type = CEV_POS;
-	event.ev.pos.type = bpress ? POS_PRESS : POS_RELEASE;
-	event.ev.pos.btn_num = bnum;
-	event.ev.pos.hpos = pointer_x / mouse_scale_x;
-	event.ev.pos.vpos = pointer_y / mouse_scale_y;
-
-	console_queue_cons_event(active_console, &event);
-	return EOK;
-}
-
-static errno_t input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
-{
-	cons_event_t event;
-
-	(void)pos_id;
-
-	event.type = CEV_POS;
-	event.ev.pos.type = POS_DCLICK;
-	event.ev.pos.btn_num = bnum;
-	event.ev.pos.hpos = pointer_x / mouse_scale_x;
-	event.ev.pos.vpos = pointer_y / mouse_scale_y;
-
-	console_queue_cons_event(active_console, &event);
-	return EOK;
-}
-
-/** Process a character from the client (TTY emulation). */
-static void cons_write_char(console_t *cons, char32_t ch)
-{
-	sysarg_t updated = 0;
-
-	fibril_mutex_lock(&cons->mtx);
-	pointer_undraw();
-
-	switch (ch) {
-	case '\n':
-		updated = chargrid_newline(cons->frontbuf);
-		break;
-	case '\r':
-		break;
-	case '\t':
-		updated = chargrid_tabstop(cons->frontbuf, 8);
-		break;
-	case '\b':
-		updated = chargrid_backspace(cons->frontbuf);
-		break;
-	default:
-		updated = chargrid_putuchar(cons->frontbuf, ch, true);
-	}
-
-	pointer_draw();
-	fibril_mutex_unlock(&cons->mtx);
-
-	if (updated > 1)
-		cons_update(cons);
-}
-
-static void cons_set_cursor_vis(console_t *cons, bool visible)
-{
-	fibril_mutex_lock(&cons->mtx);
-	pointer_undraw();
-	chargrid_set_cursor_visibility(cons->frontbuf, visible);
-	pointer_draw();
-	fibril_mutex_unlock(&cons->mtx);
-
-	cons_update_cursor(cons);
-}
-
-static errno_t cons_open(con_srvs_t *srvs, con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t cons_close(con_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t cons_read(con_srv_t *srv, void *buf, size_t size, size_t *nread)
-{
-	uint8_t *bbuf = buf;
-	console_t *cons = srv_to_console(srv);
-	size_t pos = 0;
-
-	/*
-	 * Read input from keyboard and copy it to the buffer.
-	 * We need to handle situation when wchar is split by 2 following
-	 * reads.
-	 */
-	while (pos < size) {
-		/* Copy to the buffer remaining characters. */
-		while ((pos < size) && (cons->char_remains_len > 0)) {
-			bbuf[pos] = cons->char_remains[0];
-			pos++;
-
-			/* Unshift the array. */
-			for (size_t i = 1; i < cons->char_remains_len; i++)
-				cons->char_remains[i - 1] = cons->char_remains[i];
-
-			cons->char_remains_len--;
-		}
-
-		/* Still not enough? Then get another key from the queue. */
-		if (pos < size) {
-			link_t *link = prodcons_consume(&cons->input_pc);
-			cons_qevent_t *qevent = list_get_instance(link,
-			    cons_qevent_t, link);
-			cons_event_t *event = &qevent->ev;
-
-			/* Accept key presses of printable chars only. */
-			if (event->type == CEV_KEY && event->ev.key.type == KEY_PRESS &&
-			    (event->ev.key.c != 0)) {
-				char32_t tmp[2] = { event->ev.key.c, 0 };
-				wstr_to_str(cons->char_remains, UTF8_CHAR_BUFFER_SIZE, tmp);
-				cons->char_remains_len = str_size(cons->char_remains);
-			}
-
-			free(qevent);
-		}
-	}
-
-	*nread = size;
-	return EOK;
-}
-
-static errno_t cons_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
-{
-	console_t *cons = srv_to_console(srv);
-
-	size_t off = 0;
-	while (off < size)
-		cons_write_char(cons, str_decode(data, &off, size));
-
-	*nwritten = size;
-	return EOK;
-}
-
-static void cons_sync(con_srv_t *srv)
-{
-	console_t *cons = srv_to_console(srv);
-
-	cons_update(cons);
-}
-
-static void cons_clear(con_srv_t *srv)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	pointer_undraw();
-	chargrid_clear(cons->frontbuf);
-	pointer_draw();
-	fibril_mutex_unlock(&cons->mtx);
-
-	cons_update(cons);
-}
-
-static void cons_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	pointer_undraw();
-	chargrid_set_cursor(cons->frontbuf, col, row);
-	pointer_draw();
-	fibril_mutex_unlock(&cons->mtx);
-
-	cons_update_cursor(cons);
-}
-
-static errno_t cons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	chargrid_get_cursor(cons->frontbuf, col, row);
-	fibril_mutex_unlock(&cons->mtx);
-
-	return EOK;
-}
-
-static errno_t cons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	*cols = cons->cols;
-	*rows = cons->rows;
-	fibril_mutex_unlock(&cons->mtx);
-
-	return EOK;
-}
-
-static errno_t cons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	*ccaps = cons->ccaps;
-	fibril_mutex_unlock(&cons->mtx);
-
-	return EOK;
-}
-
-static void cons_set_style(con_srv_t *srv, console_style_t style)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	chargrid_set_style(cons->frontbuf, style);
-	fibril_mutex_unlock(&cons->mtx);
-}
-
-static void cons_set_color(con_srv_t *srv, console_color_t bgcolor,
-    console_color_t fgcolor, console_color_attr_t attr)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	chargrid_set_color(cons->frontbuf, bgcolor, fgcolor, attr);
-	fibril_mutex_unlock(&cons->mtx);
-}
-
-static void cons_set_rgb_color(con_srv_t *srv, pixel_t bgcolor,
-    pixel_t fgcolor)
-{
-	console_t *cons = srv_to_console(srv);
-
-	fibril_mutex_lock(&cons->mtx);
-	chargrid_set_rgb_color(cons->frontbuf, bgcolor, fgcolor);
-	fibril_mutex_unlock(&cons->mtx);
-}
-
-static void cons_set_cursor_visibility(con_srv_t *srv, bool visible)
-{
-	console_t *cons = srv_to_console(srv);
-
-	cons_set_cursor_vis(cons, visible);
-}
-
-static errno_t cons_set_caption(con_srv_t *srv, const char *caption)
-{
-	console_t *cons = srv_to_console(srv);
-
-	(void) cons;
-	(void) caption;
-	return EOK;
-}
-
-static errno_t cons_get_event(con_srv_t *srv, cons_event_t *event)
-{
-	console_t *cons = srv_to_console(srv);
-	link_t *link = prodcons_consume(&cons->input_pc);
-	cons_qevent_t *qevent = list_get_instance(link, cons_qevent_t, link);
-
-	*event = qevent->ev;
-	free(qevent);
-	return EOK;
-}
-
-/** Create shared buffer for efficient rendering.
- *
- * @param srv Console server
- * @param cols Number of columns in buffer
- * @param rows Number of rows in buffer
- * @param rbuf Place to store pointer to new sharable buffer
- *
- * @return EOK on sucess or an error code
- */
-static errno_t cons_map(con_srv_t *srv, sysarg_t cols, sysarg_t rows,
-    charfield_t **rbuf)
-{
-	console_t *cons = srv_to_console(srv);
-	void *buf;
-
-	fibril_mutex_lock(&cons->mtx);
-
-	if (cons->ubuf != NULL) {
-		fibril_mutex_unlock(&cons->mtx);
-		return EBUSY;
-	}
-
-	buf = as_area_create(AS_AREA_ANY, cols * rows * sizeof(charfield_t),
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (buf == AS_MAP_FAILED) {
-		fibril_mutex_unlock(&cons->mtx);
-		return ENOMEM;
-	}
-
-	cons->ucols = cols;
-	cons->urows = rows;
-	cons->ubuf = buf;
-	fibril_mutex_unlock(&cons->mtx);
-
-	*rbuf = buf;
-	return EOK;
-}
-
-/** Delete shared buffer.
- *
- * @param srv Console server
- */
-static void cons_unmap(con_srv_t *srv)
-{
-	console_t *cons = srv_to_console(srv);
-	void *buf;
-
-	fibril_mutex_lock(&cons->mtx);
-
-	buf = cons->ubuf;
-	cons->ubuf = NULL;
-
-	if (buf != NULL)
-		as_area_destroy(buf);
-
-	fibril_mutex_unlock(&cons->mtx);
-}
-
-/** Update area of console from shared buffer.
- *
- * @param srv Console server
- * @param c0 Column coordinate of top-left corner (inclusive)
- * @param r0 Row coordinate of top-left corner (inclusive)
- * @param c1 Column coordinate of bottom-right corner (exclusive)
- * @param r1 Row coordinate of bottom-right corner (exclusive)
- */
-static void cons_buf_update(con_srv_t *srv, sysarg_t c0, sysarg_t r0,
-    sysarg_t c1, sysarg_t r1)
-{
-	console_t *cons = srv_to_console(srv);
-	charfield_t *ch;
-	sysarg_t col, row;
-
-	fibril_mutex_lock(&cons->mtx);
-
-	if (cons->ubuf == NULL) {
-		fibril_mutex_unlock(&cons->mtx);
-		return;
-	}
-
-	/* Make sure we have meaningful coordinates, within bounds */
-
-	if (c1 > cons->ucols)
-		c1 = cons->ucols;
-	if (c1 > cons->cols)
-		c1 = cons->cols;
-	if (c0 >= c1) {
-		fibril_mutex_unlock(&cons->mtx);
-		return;
-	}
-	if (r1 > cons->urows)
-		r1 = cons->urows;
-	if (r1 > cons->rows)
-		r1 = cons->rows;
-	if (r0 >= r1) {
-		fibril_mutex_unlock(&cons->mtx);
-		return;
-	}
-
-	/* Update front buffer from user buffer */
-
-	pointer_undraw();
-
-	for (row = r0; row < r1; row++) {
-		for (col = c0; col < c1; col++) {
-			ch = chargrid_charfield_at(cons->frontbuf, col, row);
-			*ch = cons->ubuf[row * cons->ucols + col];
-		}
-	}
-
-	pointer_draw();
-	fibril_mutex_unlock(&cons->mtx);
-
-	/* Update console */
-	cons_update(cons);
-}
-
-static void client_connection(ipc_call_t *icall, void *arg)
-{
-	console_t *cons = NULL;
-
-	for (size_t i = 0; i < CONSOLE_COUNT; i++) {
-		if (consoles[i].dsid == (service_id_t) ipc_get_arg2(icall)) {
-			cons = &consoles[i];
-			break;
-		}
-	}
-
-	if (cons == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (!atomic_flag_test_and_set(&cons->refcnt))
-		cons_set_cursor_vis(cons, true);
-
-	con_conn(icall, &cons->srvs);
-}
-
-static errno_t input_connect(const char *svc)
-{
-	async_sess_t *sess;
-	service_id_t dsid;
-
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
-	if (rc != EOK) {
-		printf("%s: Input service %s not found\n", NAME, svc);
-		return rc;
-	}
-
-	sess = loc_service_connect(dsid, INTERFACE_INPUT, 0);
-	if (sess == NULL) {
-		printf("%s: Unable to connect to input service %s\n", NAME,
-		    svc);
-		return EIO;
-	}
-
-	rc = input_open(sess, &input_ev_ops, NULL, &input);
-	if (rc != EOK) {
-		async_hangup(sess);
-		printf("%s: Unable to communicate with service %s (%s)\n",
-		    NAME, svc, str_error(rc));
-		return rc;
-	}
-
-	return EOK;
-}
-
-static async_sess_t *output_connect(const char *svc)
-{
-	async_sess_t *sess;
-	service_id_t dsid;
-
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
-	if (rc == EOK) {
-		sess = loc_service_connect(dsid, INTERFACE_OUTPUT, 0);
-		if (sess == NULL) {
-			printf("%s: Unable to connect to output service %s\n",
-			    NAME, svc);
-			return NULL;
-		}
-	} else
-		return NULL;
-
-	return sess;
-}
-
-static bool console_srv_init(char *input_svc, char *output_svc)
-{
-	/* Connect to input service */
-	errno_t rc = input_connect(input_svc);
-	if (rc != EOK)
-		return false;
-
-	/* Connect to output service */
-	output_sess = output_connect(output_svc);
-	if (output_sess == NULL)
-		return false;
-
-	/* Register server */
-	async_set_fallback_port_handler(client_connection, NULL);
-	rc = loc_server_register(NAME, &console_srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register server (%s)\n", NAME,
-		    str_error(rc));
-		return false;
-	}
-
-	output_get_dimensions(output_sess, &cols, &rows);
-	output_set_style(output_sess, STYLE_NORMAL);
-
-	console_caps_t ccaps;
-	output_get_caps(output_sess, &ccaps);
-
-	/*
-	 * Inititalize consoles only if there are
-	 * actually some output devices.
-	 */
-	if (ccaps != 0) {
-		for (size_t i = 0; i < CONSOLE_COUNT; i++) {
-			consoles[i].index = i;
-			atomic_flag_clear(&consoles[i].refcnt);
-			fibril_mutex_initialize(&consoles[i].mtx);
-			prodcons_initialize(&consoles[i].input_pc);
-			consoles[i].char_remains_len = 0;
-
-			consoles[i].cols = cols;
-			consoles[i].rows = rows;
-			consoles[i].ccaps = ccaps;
-			consoles[i].frontbuf =
-			    chargrid_create(cols, rows, CHARGRID_FLAG_SHARED);
-
-			if (consoles[i].frontbuf == NULL) {
-				printf("%s: Unable to allocate frontbuffer %zu\n", NAME, i);
-				return false;
-			}
-
-			consoles[i].fbid = output_frontbuf_create(output_sess,
-			    consoles[i].frontbuf);
-			if (consoles[i].fbid == 0) {
-				printf("%s: Unable to create frontbuffer %zu\n", NAME, i);
-				return false;
-			}
-
-			con_srvs_init(&consoles[i].srvs);
-			consoles[i].srvs.ops = &con_ops;
-			consoles[i].srvs.sarg = &consoles[i];
-
-			char vc[LOC_NAME_MAXLEN + 1];
-			snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i);
-
-			if (loc_service_register(console_srv, vc,
-			    &consoles[i].dsid) != EOK) {
-				printf("%s: Unable to register device %s\n", NAME, vc);
-				return false;
-			}
-		}
-
-		input_activate(input);
-		active = true;
-		cons_damage(active_console);
-	}
-
-	return true;
-}
-
-static void usage(char *name)
-{
-	printf("Usage: %s <input_dev> <output_dev>\n", name);
-}
-
-int main(int argc, char *argv[])
-{
-	if (argc < 3) {
-		usage(argv[0]);
-		return -1;
-	}
-
-	printf("%s: HelenOS Console service\n", NAME);
-
-	if (!console_srv_init(argv[1], argv[2]))
-		return -1;
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/hid/console/console.h
===================================================================
--- uspace/srv/hid/console/console.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup console
- * @{
- */
-/** @file
- */
-
-#ifndef CONSOLE_CONSOLE_H__
-#define CONSOLE_CONSOLE_H__
-
-#include <adt/prodcons.h>
-#include <io/cons_event.h>
-
-#define CONSOLE_COUNT   11
-
-/** Console event queue entry */
-typedef struct {
-	/** Link to list of events */
-	link_t link;
-	/** Console event */
-	cons_event_t ev;
-} cons_qevent_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/console/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/console/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup console console
- * @ingroup srvs
- * @brief Console service
- */
Index: pace/srv/hid/console/meson.build
===================================================================
--- uspace/srv/hid/console/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'console', 'input', 'output' ]
-src = files('console.c')
Index: pace/srv/hid/display/cfgclient.c
===================================================================
--- uspace/srv/hid/display/cfgclient.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server CFG client
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include "cfgclient.h"
-#include "display.h"
-#include "window.h"
-
-/** Create CFG client.
- *
- * @param display Parent display
- * @param cb CFG client callbacks
- * @param cb_arg Callback argument
- * @param rcfgclient Place to store pointer to new CFG client.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_cfgclient_create(ds_display_t *display, ds_cfgclient_cb_t *cb,
-    void *cb_arg, ds_cfgclient_t **rcfgclient)
-{
-	ds_cfgclient_t *cfgclient;
-
-	cfgclient = calloc(1, sizeof(ds_cfgclient_t));
-	if (cfgclient == NULL)
-		return ENOMEM;
-
-	list_initialize(&cfgclient->events);
-	cfgclient->cb = cb;
-	cfgclient->cb_arg = cb_arg;
-
-	ds_display_add_cfgclient(display, cfgclient);
-
-	*rcfgclient = cfgclient;
-	return EOK;
-}
-
-/** Destroy CFG client.
- *
- * @param cfgclient CFG client
- */
-void ds_cfgclient_destroy(ds_cfgclient_t *cfgclient)
-{
-	ds_cfgclient_purge_events(cfgclient);
-	ds_display_remove_cfgclient(cfgclient);
-	free(cfgclient);
-}
-
-/** Get next event from CFG client event queue.
- *
- * @param cfgclient CFG client
- * @param event Place to store event
- * @return EOK on success, ENOENT if event queue is empty
- */
-errno_t ds_cfgclient_get_event(ds_cfgclient_t *cfgclient, dispcfg_ev_t *event)
-{
-	link_t *link;
-	ds_cfgclient_ev_t *wevent;
-
-	link = list_first(&cfgclient->events);
-	if (link == NULL)
-		return ENOENT;
-
-	wevent = list_get_instance(link, ds_cfgclient_ev_t, levents);
-	list_remove(link);
-
-	*event = wevent->event;
-	free(wevent);
-	return EOK;
-}
-
-/** Purge events from CFG client event queue.
- *
- * @param client Client
- */
-void ds_cfgclient_purge_events(ds_cfgclient_t *cfgclient)
-{
-	link_t *cur;
-	link_t *next;
-	ds_cfgclient_ev_t *wevent;
-
-	cur = list_first(&cfgclient->events);
-	while (cur != NULL) {
-		next = list_next(cur, &cfgclient->events);
-		wevent = list_get_instance(cur, ds_cfgclient_ev_t, levents);
-
-		list_remove(cur);
-		free(wevent);
-		cur = next;
-	}
-}
-
-/** Post seat added event to the CFG client's message queue.
- *
- * @param cfgclient CFG client
- * @param seat_id Seat ID of the added seat
- *
- * @return EOK on success or an error code
- */
-errno_t ds_cfgclient_post_seat_added_event(ds_cfgclient_t *cfgclient,
-    sysarg_t seat_id)
-{
-	ds_cfgclient_ev_t *sevent;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "cfgclient_pos_seat_added_event "
-	    "cfgclient=%p seat_id=%zu\n", (void *)cfgclient, seat_id);
-
-	sevent = calloc(1, sizeof(ds_cfgclient_ev_t));
-	if (sevent == NULL)
-		return ENOMEM;
-
-	sevent->cfgclient = cfgclient;
-	sevent->event.etype = dcev_seat_added;
-	sevent->event.seat_id = seat_id;
-	list_append(&sevent->levents, &cfgclient->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (cfgclient->cb != NULL && cfgclient->cb->ev_pending != NULL)
-		cfgclient->cb->ev_pending(cfgclient->cb_arg);
-
-	return EOK;
-}
-
-/** Post seat removed event to the CFG client's message queue.
- *
- * @param cfgclient CFG client
- * @param seat_id Seat ID of the added seat
- *
- * @return EOK on success or an error code
- */
-errno_t ds_cfgclient_post_seat_removed_event(ds_cfgclient_t *cfgclient,
-    sysarg_t seat_id)
-{
-	ds_cfgclient_ev_t *sevent;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "cfgclient_pos_seat_removed_event "
-	    "cfgclient=%p seat_id=%zu\n", (void *)cfgclient, seat_id);
-
-	sevent = calloc(1, sizeof(ds_cfgclient_ev_t));
-	if (sevent == NULL)
-		return ENOMEM;
-
-	sevent->cfgclient = cfgclient;
-	sevent->event.etype = dcev_seat_removed;
-	sevent->event.seat_id = seat_id;
-	list_append(&sevent->levents, &cfgclient->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (cfgclient->cb != NULL && cfgclient->cb->ev_pending != NULL)
-		cfgclient->cb->ev_pending(cfgclient->cb_arg);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/cfgclient.h
===================================================================
--- uspace/srv/hid/display/cfgclient.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server CFG client
- */
-
-#ifndef CFGCLIENT_H
-#define CFGCLIENT_H
-
-#include <errno.h>
-#include <dispcfg.h>
-#include "types/display/display.h"
-#include "types/display/cfgclient.h"
-
-extern errno_t ds_cfgclient_create(ds_display_t *, ds_cfgclient_cb_t *, void *,
-    ds_cfgclient_t **);
-extern void ds_cfgclient_destroy(ds_cfgclient_t *);
-extern errno_t ds_cfgclient_get_event(ds_cfgclient_t *, dispcfg_ev_t *);
-extern errno_t ds_cfgclient_post_seat_added_event(ds_cfgclient_t *, sysarg_t);
-extern errno_t ds_cfgclient_post_seat_removed_event(ds_cfgclient_t *, sysarg_t);
-extern void ds_cfgclient_purge_events(ds_cfgclient_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/cfgops.c
===================================================================
--- uspace/srv/hid/display/cfgops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,379 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display configuration ops implementation
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include <str.h>
-#include <dispcfg_srv.h>
-#include "display.h"
-#include "idevcfg.h"
-#include "main.h"
-#include "seat.h"
-#include "cfgclient.h"
-
-static errno_t dispc_get_seat_list(void *, dispcfg_seat_list_t **);
-static errno_t dispc_get_seat_info(void *, sysarg_t, dispcfg_seat_info_t **);
-static errno_t dispc_seat_create(void *, const char *, sysarg_t *);
-static errno_t dispc_seat_delete(void *, sysarg_t);
-static errno_t dispc_dev_assign(void *, sysarg_t, sysarg_t);
-static errno_t dispc_dev_unassign(void *, sysarg_t);
-static errno_t dispc_get_asgn_dev_list(void *, sysarg_t, dispcfg_dev_list_t **);
-static errno_t dispc_get_event(void *, dispcfg_ev_t *);
-
-dispcfg_ops_t dispcfg_srv_ops = {
-	.get_seat_list = dispc_get_seat_list,
-	.get_seat_info = dispc_get_seat_info,
-	.seat_create = dispc_seat_create,
-	.seat_delete = dispc_seat_delete,
-	.dev_assign = dispc_dev_assign,
-	.dev_unassign = dispc_dev_unassign,
-	.get_asgn_dev_list = dispc_get_asgn_dev_list,
-	.get_event = dispc_get_event,
-};
-
-/** Get seat list.
- *
- * @param arg Argument (CFG client)
- * @param rlist Place to store pointer to new list
- * @return EOK on success or an error code
- */
-static errno_t dispc_get_seat_list(void *arg, dispcfg_seat_list_t **rlist)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	dispcfg_seat_list_t *list;
-	ds_seat_t *seat;
-	unsigned i;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_get_seat_list()");
-
-	list = calloc(1, sizeof(dispcfg_seat_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	ds_display_lock(cfgclient->display);
-
-	/* Count the number of seats */
-	list->nseats = 0;
-	seat = ds_display_first_seat(cfgclient->display);
-	while (seat != NULL) {
-		++list->nseats;
-		seat = ds_display_next_seat(seat);
-	}
-
-	/* Allocate array for seat IDs */
-	list->seats = calloc(list->nseats, sizeof(sysarg_t));
-	if (list->seats == NULL) {
-		ds_display_unlock(cfgclient->display);
-		free(list);
-		return ENOMEM;
-	}
-
-	/* Fill in seat IDs */
-	i = 0;
-	seat = ds_display_first_seat(cfgclient->display);
-	while (seat != NULL) {
-		list->seats[i++] = seat->id;
-		seat = ds_display_next_seat(seat);
-	}
-
-	ds_display_unlock(cfgclient->display);
-	*rlist = list;
-	return EOK;
-}
-
-/** Get seat information.
- *
- * @param arg Argument (CFG client)
- * @param seat_id Seat ID
- * @param rinfo Place to store pointer to new seat information structure
- * @return EOK on success or an error code
- */
-static errno_t dispc_get_seat_info(void *arg, sysarg_t seat_id,
-    dispcfg_seat_info_t **rinfo)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	ds_seat_t *seat;
-	dispcfg_seat_info_t *info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_get_seat_info()");
-
-	ds_display_lock(cfgclient->display);
-	seat = ds_display_find_seat(cfgclient->display, seat_id);
-	if (seat == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return ENOENT;
-	}
-
-	info = calloc(1, sizeof(dispcfg_seat_info_t));
-	if (info == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return ENOMEM;
-	}
-
-	(void)seat;
-	info->name = str_dup(seat->name);
-	if (info->name == NULL) {
-		ds_display_unlock(cfgclient->display);
-		free(info);
-		return ENOMEM;
-	}
-
-	ds_display_unlock(cfgclient->display);
-	*rinfo = info;
-	return EOK;
-}
-
-/** Create seat.
- *
- * @param arg Argument (CFG client)
- * @param name Seat name
- * @param rseat_id Place to store ID of the new seat
- * @return EOK on success or an error code
- */
-static errno_t dispc_seat_create(void *arg, const char *name,
-    sysarg_t *rseat_id)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	ds_seat_t *seat;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_seat_create()");
-
-	ds_display_lock(cfgclient->display);
-
-	rc = ds_seat_create(cfgclient->display, name, &seat);
-	if (rc != EOK) {
-		ds_display_unlock(cfgclient->display);
-		return rc;
-	}
-
-	(void) ds_display_paint(cfgclient->display, NULL);
-	(void) ds_display_save_cfg(cfgclient->display, cfg_file_path);
-	ds_display_unlock(cfgclient->display);
-
-	*rseat_id = seat->id;
-	return EOK;
-}
-
-/** Delete seat.
- *
- * @param arg Argument (CFG client)
- * @param seat_id Seat ID
- * @return EOK on success or an error code
- */
-static errno_t dispc_seat_delete(void *arg, sysarg_t seat_id)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	ds_seat_t *seat;
-	ds_seat_t *s;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_seat_delete()");
-
-	ds_display_lock(cfgclient->display);
-	seat = ds_display_find_seat(cfgclient->display, seat_id);
-	if (seat == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return ENOENT;
-	}
-
-	/* Verify we are not deleting the last seat */
-	s = ds_display_first_seat(cfgclient->display);
-	if (s == seat && ds_display_next_seat(s) == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return EBUSY;
-	}
-
-	ds_seat_destroy(seat);
-
-	(void) ds_display_paint(cfgclient->display, NULL);
-	(void) ds_display_save_cfg(cfgclient->display, cfg_file_path);
-	ds_display_unlock(cfgclient->display);
-
-	return EOK;
-}
-
-/** Assign device to seat.
- *
- * @param arg Argument (CFG client)
- * @param svc_id Device service ID
- * @param seat_id Seat ID
- * @return EOK on success or an error code
- */
-static errno_t dispc_dev_assign(void *arg, sysarg_t svc_id, sysarg_t seat_id)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	ds_seat_t *seat;
-	ds_idevcfg_t *idevcfg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_dev_assign()");
-
-	ds_display_lock(cfgclient->display);
-	seat = ds_display_find_seat(cfgclient->display, seat_id);
-	if (seat == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return ENOENT;
-	}
-
-	rc = ds_idevcfg_create(cfgclient->display, svc_id, seat, &idevcfg);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		ds_display_unlock(cfgclient->display);
-		return ENOMEM;
-	}
-
-	(void)idevcfg;
-
-	(void) ds_display_save_cfg(cfgclient->display, cfg_file_path);
-	ds_display_unlock(cfgclient->display);
-	return EOK;
-}
-
-/** Unassign device from any seat.
- *
- * @param arg Argument (CFG client)
- * @param svc_id Device service ID
- * @return EOK on success or an error code
- */
-static errno_t dispc_dev_unassign(void *arg, sysarg_t svc_id)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	ds_idevcfg_t *idevcfg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_dev_unassign()");
-
-	ds_display_lock(cfgclient->display);
-
-	idevcfg = ds_display_first_idevcfg(cfgclient->display);
-	while (idevcfg != NULL) {
-		if (idevcfg->svc_id == svc_id)
-			break;
-
-		idevcfg = ds_display_next_idevcfg(idevcfg);
-	}
-
-	if (idevcfg == NULL) {
-		ds_display_unlock(cfgclient->display);
-		return ENOENT;
-	}
-
-	ds_idevcfg_destroy(idevcfg);
-	(void) ds_display_save_cfg(cfgclient->display, cfg_file_path);
-	ds_display_unlock(cfgclient->display);
-	return EOK;
-}
-
-/** Get assigned device list.
- *
- * @param arg Argument (CFG client)
- * @param seat_id Seat ID
- * @param rlist Place to store pointer to new list
- * @return EOK on success or an error code
- */
-static errno_t dispc_get_asgn_dev_list(void *arg, sysarg_t seat_id,
-    dispcfg_dev_list_t **rlist)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	dispcfg_dev_list_t *list;
-	ds_seat_t *seat;
-	ds_idevcfg_t *idevcfg;
-	unsigned i;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_get_asgn_dev_list()");
-
-	list = calloc(1, sizeof(dispcfg_dev_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	ds_display_lock(cfgclient->display);
-
-	seat = ds_display_find_seat(cfgclient->display, seat_id);
-	if (seat == NULL) {
-		ds_display_unlock(cfgclient->display);
-		free(list);
-		return ENOENT;
-	}
-
-	/* Count the number of devices */
-	list->ndevs = 0;
-	idevcfg = ds_seat_first_idevcfg(seat);
-	while (idevcfg != NULL) {
-		++list->ndevs;
-		idevcfg = ds_display_next_idevcfg(idevcfg);
-	}
-
-	/* Allocate array for device IDs */
-	list->devs = calloc(list->ndevs, sizeof(sysarg_t));
-	if (list->devs == NULL) {
-		ds_display_unlock(cfgclient->display);
-		free(list);
-		return ENOMEM;
-	}
-
-	/* Fill in device IDs */
-	i = 0;
-	idevcfg = ds_seat_first_idevcfg(seat);
-	while (idevcfg != NULL) {
-		list->devs[i++] = idevcfg->svc_id;
-		idevcfg = ds_display_next_idevcfg(idevcfg);
-	}
-
-	ds_display_unlock(cfgclient->display);
-	*rlist = list;
-	return EOK;
-}
-
-/** Get display configuration event.
- *
- * @param arg Argument (CFG client)
- * @param ev Place to store event
- * @return EOK on success, ENOENT if there are no events
- */
-static errno_t dispc_get_event(void *arg, dispcfg_ev_t *ev)
-{
-	ds_cfgclient_t *cfgclient = (ds_cfgclient_t *)arg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispcfg_get_event()");
-
-	ds_display_lock(cfgclient->display);
-	rc = ds_cfgclient_get_event(cfgclient, ev);
-	ds_display_unlock(cfgclient->display);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/cfgops.h
===================================================================
--- uspace/srv/hid/display/cfgops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display configuration ops implementation
- */
-
-#ifndef CFGOPS_H
-#define CFGOPS_H
-
-#include <dispcfg_srv.h>
-
-extern dispcfg_ops_t dispcfg_srv_ops;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/client.c
===================================================================
--- uspace/srv/hid/display/client.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,405 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server client
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "client.h"
-#include "display.h"
-#include "seat.h"
-#include "window.h"
-
-/** Create client.
- *
- * @param display Parent display
- * @param cb Client callbacks
- * @param cb_arg Callback argument
- * @param rclient Place to store pointer to new client.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_client_create(ds_display_t *display, ds_client_cb_t *cb,
-    void *cb_arg, ds_client_t **rclient)
-{
-	ds_client_t *client;
-
-	client = calloc(1, sizeof(ds_client_t));
-	if (client == NULL)
-		return ENOMEM;
-
-	list_initialize(&client->windows);
-	list_initialize(&client->events);
-	client->cb = cb;
-	client->cb_arg = cb_arg;
-
-	ds_display_add_client(display, client);
-
-	*rclient = client;
-	return EOK;
-}
-
-/** Destroy client.
- *
- * @param client Client
- */
-void ds_client_destroy(ds_client_t *client)
-{
-	ds_window_t *window;
-
-	window = ds_client_first_window(client);
-	while (window != NULL) {
-		ds_window_destroy(window);
-		window = ds_client_first_window(client);
-	}
-
-	assert(list_empty(&client->windows));
-	ds_display_remove_client(client);
-	free(client);
-}
-
-/** Add window to client.
- *
- * @param client client
- * @param wnd Window
- */
-void ds_client_add_window(ds_client_t *client, ds_window_t *wnd)
-{
-	assert(wnd->client == NULL);
-	assert(!link_used(&wnd->lcwindows));
-
-	wnd->client = client;
-	wnd->id = client->display->next_wnd_id++;
-	list_append(&wnd->lcwindows, &client->windows);
-}
-
-/** Remove window from client.
- *
- * @param wnd Window
- */
-void ds_client_remove_window(ds_window_t *wnd)
-{
-	ds_seat_t *seat;
-
-	/* Make sure window is no longer focused in any seat */
-	seat = ds_display_first_seat(wnd->display);
-	while (seat != NULL) {
-		ds_seat_evac_wnd_refs(seat, wnd);
-		seat = ds_display_next_seat(seat);
-	}
-
-	/* Make sure no event in the queue is referencing the window */
-	ds_client_purge_window_events(wnd->client, wnd);
-
-	list_remove(&wnd->lcwindows);
-	wnd->client = NULL;
-}
-
-/** Find window by ID.
- *
- * @param client Client
- * @param id Window ID
- */
-ds_window_t *ds_client_find_window(ds_client_t *client, ds_wnd_id_t id)
-{
-	ds_window_t *wnd;
-
-	// TODO Make this faster
-	wnd = ds_client_first_window(client);
-	while (wnd != NULL) {
-		if (wnd->id == id)
-			return wnd;
-		wnd = ds_client_next_window(wnd);
-	}
-
-	return NULL;
-}
-
-/** Get first window in client.
- *
- * @param client Client
- * @return First window or @c NULL if there is none
- */
-ds_window_t *ds_client_first_window(ds_client_t *client)
-{
-	link_t *link = list_first(&client->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, lcwindows);
-}
-
-/** Get next window in client.
- *
- * @param wnd Current window
- * @return Next window or @c NULL if there is none
- */
-ds_window_t *ds_client_next_window(ds_window_t *wnd)
-{
-	link_t *link = list_next(&wnd->lcwindows, &wnd->client->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, lcwindows);
-}
-
-/** Get next event from client event queue.
- *
- * @param client Client
- * @param ewindow Place to store pointer to window receiving the event
- * @param event Place to store event
- * @return EOK on success, ENOENT if event queue is empty
- */
-errno_t ds_client_get_event(ds_client_t *client, ds_window_t **ewindow,
-    display_wnd_ev_t *event)
-{
-	link_t *link;
-	ds_window_ev_t *wevent;
-
-	link = list_first(&client->events);
-	if (link == NULL)
-		return ENOENT;
-
-	wevent = list_get_instance(link, ds_window_ev_t, levents);
-	list_remove(link);
-
-	*ewindow = wevent->window;
-	*event = wevent->event;
-	free(wevent);
-	return EOK;
-}
-
-/** Purge events from client event queue referring to a window.
- *
- * @param client Client
- * @param window Window
- */
-void ds_client_purge_window_events(ds_client_t *client,
-    ds_window_t *window)
-{
-	link_t *cur;
-	link_t *next;
-	ds_window_ev_t *wevent;
-
-	cur = list_first(&client->events);
-	while (cur != NULL) {
-		next = list_next(cur, &client->events);
-		wevent = list_get_instance(cur, ds_window_ev_t, levents);
-
-		if (wevent->window == window)
-			list_remove(cur);
-
-		cur = next;
-	}
-}
-
-/** Post close event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_close_event(ds_client_t *client, ds_window_t *ewindow)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_close;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (client->cb != NULL && client->cb->ev_pending != NULL)
-		client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** Post focus event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- * @param event Focus event data
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_focus_event(ds_client_t *client, ds_window_t *ewindow,
-    display_wnd_focus_ev_t *event)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_focus;
-	wevent->event.ev.focus = *event;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (client->cb != NULL && client->cb->ev_pending != NULL)
-		client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** Post keyboard event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- * @param event Event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_kbd_event(ds_client_t *client, ds_window_t *ewindow,
-    kbd_event_t *event)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_kbd;
-	wevent->event.ev.kbd = *event;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** Post position event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- * @param event Event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_pos_event(ds_client_t *client, ds_window_t *ewindow,
-    pos_event_t *event)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_pos;
-	wevent->event.ev.pos = *event;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (client->cb != NULL && client->cb->ev_pending != NULL)
-		client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** Post resize event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- * @param rect New window rectangle
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_resize_event(ds_client_t *client, ds_window_t *ewindow,
-    gfx_rect_t *rect)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_resize;
-	wevent->event.ev.resize.rect = *rect;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (client->cb != NULL && client->cb->ev_pending != NULL)
-		client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** Post unfocus event to the client's message queue.
- *
- * @param client Client
- * @param ewindow Window that the message is targetted to
- * @param event Unfocus event data
- *
- * @return EOK on success or an error code
- */
-errno_t ds_client_post_unfocus_event(ds_client_t *client, ds_window_t *ewindow,
-    display_wnd_unfocus_ev_t *event)
-{
-	ds_window_ev_t *wevent;
-
-	wevent = calloc(1, sizeof(ds_window_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->window = ewindow;
-	wevent->event.etype = wev_unfocus;
-	wevent->event.ev.unfocus = *event;
-	list_append(&wevent->levents, &client->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (client->cb != NULL && client->cb->ev_pending != NULL)
-		client->cb->ev_pending(client->cb_arg);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/client.h
===================================================================
--- uspace/srv/hid/display/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server client
- */
-
-#ifndef CLIENT_H
-#define CLIENT_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include "types/display/client.h"
-#include "types/display/display.h"
-
-extern errno_t ds_client_create(ds_display_t *, ds_client_cb_t *, void *,
-    ds_client_t **);
-extern void ds_client_destroy(ds_client_t *);
-extern void ds_client_add_window(ds_client_t *, ds_window_t *);
-extern void ds_client_remove_window(ds_window_t *);
-extern ds_window_t *ds_client_find_window(ds_client_t *, ds_wnd_id_t);
-extern ds_window_t *ds_client_first_window(ds_client_t *);
-extern ds_window_t *ds_client_next_window(ds_window_t *);
-extern errno_t ds_client_get_event(ds_client_t *, ds_window_t **,
-    display_wnd_ev_t *);
-extern void ds_client_purge_window_events(ds_client_t *, ds_window_t *);
-extern errno_t ds_client_post_close_event(ds_client_t *, ds_window_t *);
-extern errno_t ds_client_post_focus_event(ds_client_t *, ds_window_t *,
-    display_wnd_focus_ev_t *);
-extern errno_t ds_client_post_kbd_event(ds_client_t *, ds_window_t *,
-    kbd_event_t *);
-extern errno_t ds_client_post_pos_event(ds_client_t *, ds_window_t *,
-    pos_event_t *);
-extern errno_t ds_client_post_resize_event(ds_client_t *, ds_window_t *,
-    gfx_rect_t *);
-extern errno_t ds_client_post_unfocus_event(ds_client_t *, ds_window_t *,
-    display_wnd_unfocus_ev_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/clonegc.c
===================================================================
--- uspace/srv/hid/display/clonegc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Cloning graphics context
- *
- * This implements a graphics context that duplicates rendering to a number
- * of GCs.
- */
-
-#include <assert.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <stdlib.h>
-#include "clonegc.h"
-
-static errno_t ds_clonegc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t ds_clonegc_set_color(void *, gfx_color_t *);
-static errno_t ds_clonegc_fill_rect(void *, gfx_rect_t *);
-static errno_t ds_clonegc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t ds_clonegc_bitmap_destroy(void *);
-static errno_t ds_clonegc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t ds_clonegc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static ds_clonegc_output_t *ds_clonegc_first_output(ds_clonegc_t *);
-static ds_clonegc_output_t *ds_clonegc_next_output(ds_clonegc_output_t *);
-static ds_clonegc_bitmap_t *ds_clonegc_first_bitmap(ds_clonegc_t *);
-static ds_clonegc_bitmap_t *ds_clonegc_next_bitmap(ds_clonegc_bitmap_t *);
-static ds_clonegc_outbitmap_t *ds_clonegc_bitmap_first_obm(ds_clonegc_bitmap_t *);
-static ds_clonegc_outbitmap_t *ds_clonegc_bitmap_next_obm(ds_clonegc_outbitmap_t *);
-static errno_t ds_clonegc_outbitmap_create(ds_clonegc_output_t *,
-    ds_clonegc_bitmap_t *, gfx_bitmap_t *);
-static errno_t ds_clonegc_outbitmap_destroy(ds_clonegc_outbitmap_t *);
-static errno_t ds_clonegc_bitmap_add_output(ds_clonegc_bitmap_t *,
-    ds_clonegc_output_t *);
-
-gfx_context_ops_t ds_clonegc_ops = {
-	.set_clip_rect = ds_clonegc_set_clip_rect,
-	.set_color = ds_clonegc_set_color,
-	.fill_rect = ds_clonegc_fill_rect,
-	.bitmap_create = ds_clonegc_bitmap_create,
-	.bitmap_destroy = ds_clonegc_bitmap_destroy,
-	.bitmap_render = ds_clonegc_bitmap_render,
-	.bitmap_get_alloc = ds_clonegc_bitmap_get_alloc
-};
-
-/** Set clipping rectangle on clone GC.
- *
- * @param arg Clone GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	ds_clonegc_t *cgc = (ds_clonegc_t *)arg;
-	ds_clonegc_output_t *output;
-	errno_t rc;
-
-	output = ds_clonegc_first_output(cgc);
-	while (output != NULL) {
-		rc = gfx_set_clip_rect(output->gc, rect);
-		if (rc != EOK)
-			return rc;
-
-		output = ds_clonegc_next_output(output);
-	}
-
-	return EOK;
-}
-
-/** Set color on clone GC.
- *
- * Set drawing color on memory GC.
- *
- * @param arg Clone GC
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_set_color(void *arg, gfx_color_t *color)
-{
-	ds_clonegc_t *cgc = (ds_clonegc_t *)arg;
-	ds_clonegc_output_t *output;
-	errno_t rc;
-
-	output = ds_clonegc_first_output(cgc);
-	while (output != NULL) {
-		rc = gfx_set_color(output->gc, color);
-		if (rc != EOK)
-			return rc;
-
-		output = ds_clonegc_next_output(output);
-	}
-
-	return EOK;
-}
-
-/** Fill rectangle on clone GC.
- *
- * @param arg Clone GC
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	ds_clonegc_t *cgc = (ds_clonegc_t *)arg;
-	ds_clonegc_output_t *output;
-	errno_t rc;
-
-	output = ds_clonegc_first_output(cgc);
-	while (output != NULL) {
-		rc = gfx_fill_rect(output->gc, rect);
-		if (rc != EOK)
-			return rc;
-
-		output = ds_clonegc_next_output(output);
-	}
-
-	return EOK;
-}
-
-/** Create cloning GC.
- *
- * Create graphics context for copying rendering into several GCs.
- *
- * @param outgc Primary output GC
- * @param rgc Place to store pointer to new clone GC
- *
- * @return EOK on success or an error code
- */
-errno_t ds_clonegc_create(gfx_context_t *outgc, ds_clonegc_t **rgc)
-{
-	ds_clonegc_t *cgc = NULL;
-	gfx_context_t *gc = NULL;
-	errno_t rc;
-
-	cgc = calloc(1, sizeof(ds_clonegc_t));
-	if (cgc == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = gfx_context_new(&ds_clonegc_ops, cgc, &gc);
-	if (rc != EOK)
-		goto error;
-
-	cgc->gc = gc;
-	list_initialize(&cgc->outputs);
-	list_initialize(&cgc->bitmaps);
-
-	if (outgc != NULL) {
-		rc = ds_clonegc_add_output(cgc, outgc);
-		if (rc != EOK)
-			goto error;
-	}
-
-	*rgc = cgc;
-	return EOK;
-error:
-	if (cgc != NULL)
-		free(cgc);
-	if (gc != NULL)
-		gfx_context_delete(gc);
-	return rc;
-}
-
-/** Delete cloning GC.
- *
- * @param cgc Cloning GC
- */
-errno_t ds_clonegc_delete(ds_clonegc_t *cgc)
-{
-	errno_t rc;
-
-	rc = gfx_context_delete(cgc->gc);
-	if (rc != EOK)
-		return rc;
-
-	free(cgc);
-	return EOK;
-}
-
-/** Add new output to cloning GC.
- *
- * @param cgc Cloning GC
- * @param outgc New output GC
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_clonegc_add_output(ds_clonegc_t *cgc, gfx_context_t *outgc)
-{
-	ds_clonegc_output_t *output;
-	ds_clonegc_bitmap_t *cbm;
-	errno_t rc;
-
-	output = calloc(1, sizeof(ds_clonegc_output_t));
-	if (output == NULL)
-		return ENOMEM;
-
-	output->clonegc = cgc;
-	list_append(&output->loutputs, &cgc->outputs);
-	output->gc = outgc;
-	list_initialize(&output->obitmaps);
-
-	/* Extend each existing bitmap to the new output */
-	cbm = ds_clonegc_first_bitmap(cgc);
-	while (cbm != NULL) {
-		rc = ds_clonegc_bitmap_add_output(cbm, output);
-		if (rc != EOK)
-			goto error;
-
-		cbm = ds_clonegc_next_bitmap(cbm);
-	}
-
-	return EOK;
-error:
-	list_remove(&output->loutputs);
-	free(output);
-	return rc;
-}
-
-/** Get generic graphic context from clone GC.
- *
- * @param cgc Clone GC
- * @return Graphic context
- */
-gfx_context_t *ds_clonegc_get_ctx(ds_clonegc_t *cgc)
-{
-	return cgc->gc;
-}
-
-/** Create bitmap in clone GC.
- *
- * @param arg Clone GC
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t ds_clonegc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	ds_clonegc_t *cgc = (ds_clonegc_t *)arg;
-	ds_clonegc_bitmap_t *cbm = NULL;
-	ds_clonegc_output_t *output;
-	gfx_bitmap_t *bitmap;
-	errno_t rc;
-
-	cbm = calloc(1, sizeof(ds_clonegc_bitmap_t));
-	if (cbm == NULL)
-		return ENOMEM;
-
-	list_initialize(&cbm->obitmaps);
-	cbm->clonegc = cgc;
-	cbm->params = *params;
-
-	output = ds_clonegc_first_output(cgc);
-	assert(output != NULL);
-
-	/* Create the first output bitmap */
-
-	rc = gfx_bitmap_create(output->gc, params, alloc, &bitmap);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_bitmap_get_alloc(bitmap, &cbm->alloc);
-	if (rc != EOK)
-		goto error;
-
-	rc = ds_clonegc_outbitmap_create(output, cbm, bitmap);
-	if (rc != EOK)
-		goto error;
-
-	bitmap = NULL;
-
-	/* Create all other output bitmaps as copies */
-	output = ds_clonegc_next_output(output);
-	while (output != NULL) {
-		rc = ds_clonegc_bitmap_add_output(cbm, output);
-		if (rc != EOK)
-			goto error;
-
-		output = ds_clonegc_next_output(output);
-	}
-
-	list_append(&cbm->lbitmaps, &cgc->bitmaps);
-	*rbm = (void *)cbm;
-	return EOK;
-error:
-	if (bitmap != NULL)
-		gfx_bitmap_destroy(bitmap);
-	if (cbm != NULL)
-		ds_clonegc_bitmap_destroy(cbm);
-	return rc;
-}
-
-/** Destroy bitmap in memory GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_bitmap_destroy(void *bm)
-{
-	ds_clonegc_bitmap_t *cbm = (ds_clonegc_bitmap_t *)bm;
-	ds_clonegc_outbitmap_t *outbm;
-	errno_t rc;
-
-	outbm = ds_clonegc_bitmap_first_obm(cbm);
-	while (outbm != NULL) {
-		rc = ds_clonegc_outbitmap_destroy(outbm);
-		if (rc != EOK)
-			return rc;
-
-		outbm = ds_clonegc_bitmap_first_obm(cbm);
-	}
-
-	list_remove(&cbm->lbitmaps);
-	free(cbm);
-	return EOK;
-}
-
-/** Render bitmap in memory GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	ds_clonegc_bitmap_t *cbm = (ds_clonegc_bitmap_t *)bm;
-	ds_clonegc_outbitmap_t *outbm;
-	errno_t rc;
-
-	outbm = ds_clonegc_bitmap_first_obm(cbm);
-	while (outbm != NULL) {
-		rc = gfx_bitmap_render(outbm->obitmap, srect0, offs0);
-		if (rc != EOK)
-			return rc;
-
-		outbm = ds_clonegc_bitmap_next_obm(outbm);
-	}
-
-	return EOK;
-}
-
-/** Get allocation info for bitmap in memory GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	ds_clonegc_bitmap_t *cbm = (ds_clonegc_bitmap_t *)bm;
-
-	*alloc = cbm->alloc;
-	return EOK;
-}
-
-/** Get first clone GC output.
- *
- * @param cgc Clone GC
- * @return First output or @c NULL if there are none
- */
-static ds_clonegc_output_t *ds_clonegc_first_output(ds_clonegc_t *cgc)
-{
-	link_t *link;
-
-	link = list_first(&cgc->outputs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_output_t, loutputs);
-}
-
-/** Get next clone GC output.
- *
- * @param cur Current output
- * @return Next output or @c NULL if @a cur is the last
- */
-static ds_clonegc_output_t *ds_clonegc_next_output(ds_clonegc_output_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->loutputs, &cur->clonegc->outputs);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_output_t, loutputs);
-}
-
-/** Get first clone GC bitmap.
- *
- * @param cgc Clone GC
- * @return First bitmap or @c NULL if there are none
- */
-static ds_clonegc_bitmap_t *ds_clonegc_first_bitmap(ds_clonegc_t *cgc)
-{
-	link_t *link;
-
-	link = list_first(&cgc->bitmaps);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_bitmap_t, lbitmaps);
-}
-
-/** Get next clone GC bitmap.
- *
- * @param cur Current bitmap
- * @return Next bitmap or @c NULL if @a cur is the last
- */
-static ds_clonegc_bitmap_t *ds_clonegc_next_bitmap(ds_clonegc_bitmap_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lbitmaps, &cur->clonegc->bitmaps);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_bitmap_t, lbitmaps);
-}
-
-/** Get first output bitmap of a clone GC bitmap.
- *
- * @param cbm Clone GC bitmap
- * @return First output bitmap or @c NULL if there are none
- */
-static ds_clonegc_outbitmap_t *ds_clonegc_bitmap_first_obm(ds_clonegc_bitmap_t *cbm)
-{
-	link_t *link;
-
-	link = list_first(&cbm->obitmaps);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_outbitmap_t, lbbitmaps);
-}
-
-/** Get next output bitmap of a clone GC bitmap.
- *
- * @param cur Current output bitmap
- * @return Next output bitmap or @c NULL if @a cur is the last
- */
-static ds_clonegc_outbitmap_t *ds_clonegc_bitmap_next_obm(ds_clonegc_outbitmap_t *cur)
-{
-	link_t *link;
-
-	link = list_next(&cur->lbbitmaps, &cur->bitmap->obitmaps);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_clonegc_outbitmap_t, lbbitmaps);
-}
-
-/** Create clone GC output bitmap.
- *
- * Create a new entry in the output x bitmap matrix.
- *
- * @param output Clone GC output
- * @param cbm Clone GC bitmap
- * @param obitmap Output bitmap
- */
-static errno_t ds_clonegc_outbitmap_create(ds_clonegc_output_t *output,
-    ds_clonegc_bitmap_t *cbm, gfx_bitmap_t *obitmap)
-{
-	ds_clonegc_outbitmap_t *outbm;
-
-	outbm = calloc(1, sizeof(ds_clonegc_outbitmap_t));
-	if (outbm == NULL)
-		return ENOMEM;
-
-	outbm->output = output;
-	outbm->bitmap = cbm;
-	list_append(&outbm->lobitmaps, &output->obitmaps);
-	list_append(&outbm->lbbitmaps, &cbm->obitmaps);
-	outbm->obitmap = obitmap;
-
-	return EOK;
-}
-
-/** Destroy clone GC output bitmap.
- *
- * @param outbm Output bitmap
- * @return EOK on success or an error code
- */
-static errno_t ds_clonegc_outbitmap_destroy(ds_clonegc_outbitmap_t *outbm)
-{
-	errno_t rc;
-
-	rc = gfx_bitmap_destroy(outbm->obitmap);
-	if (rc != EOK)
-		return rc;
-
-	list_remove(&outbm->lobitmaps);
-	list_remove(&outbm->lbbitmaps);
-	free(outbm);
-	return EOK;
-}
-
-/** Extend clone GC bitmap to new output.
- *
- * @param cbm Clone GC bitmap
- * @param output Clone GC output
- */
-static errno_t ds_clonegc_bitmap_add_output(ds_clonegc_bitmap_t *cbm,
-    ds_clonegc_output_t *output)
-{
-	gfx_bitmap_t *obitmap = NULL;
-	errno_t rc;
-
-	rc = gfx_bitmap_create(output->gc, &cbm->params, &cbm->alloc, &obitmap);
-	if (rc != EOK)
-		goto error;
-
-	rc = ds_clonegc_outbitmap_create(output, cbm, obitmap);
-	if (rc != EOK)
-		goto error;
-
-	return EOK;
-error:
-	if (obitmap != NULL)
-		gfx_bitmap_destroy(obitmap);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/clonegc.h
===================================================================
--- uspace/srv/hid/display/clonegc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Cloning grapics context
- */
-
-#ifndef CLONEGC_H
-#define CLONEGC_H
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include "types/display/clonegc.h"
-
-extern gfx_context_ops_t ds_clonegc_ops;
-
-extern errno_t ds_clonegc_create(gfx_context_t *, ds_clonegc_t **);
-extern errno_t ds_clonegc_delete(ds_clonegc_t *);
-extern errno_t ds_clonegc_add_output(ds_clonegc_t *, gfx_context_t *);
-extern gfx_context_t *ds_clonegc_get_ctx(ds_clonegc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/cursimg.c
===================================================================
--- uspace/srv/hid/display/cursimg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server built-in cursor images
- */
-
-#include <types/display/cursor.h>
-#include "cursimg.h"
-
-static uint8_t arrow_img[] = {
-	1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
-	1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1,
-	1, 2, 2, 2, 1, 2, 2, 1, 0, 0, 0, 0, 0,
-	1, 2, 2, 1, 0, 1, 2, 2, 1, 0, 0, 0, 0,
-	1, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 0, 0,
-	1, 1, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
-	1, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0
-};
-
-static uint8_t size_ud_img[] = {
-	0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
-	0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
-	1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1,
-	0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
-	0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
-	0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 2, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
-};
-
-static uint8_t size_lr_img[] = {
-	0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 0, 0, 0,
-	0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
-	0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1,
-	0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
-	0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
-	0, 0, 0, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
-};
-
-static uint8_t size_uldr_img[] = {
-	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 1,
-	1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 1, 1,
-	1, 2, 1, 0, 1, 2, 2, 2, 2, 2, 1, 0, 1, 2, 1,
-	1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1,
-	1, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
-};
-
-static uint8_t size_urdl_img[] = {
-	0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-	0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1,
-	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 1,
-	1, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 1,
-	1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1,
-	1, 2, 1, 0, 1, 2, 2, 2, 2, 2, 1, 0, 1, 2, 1,
-	1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 1, 1,
-	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 1,
-	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
-	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
-	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
-};
-
-static uint8_t ibeam_img[] = {
-	0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,
-	1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1,
-	0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0,
-	0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0,
-	1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 1,
-	0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0
-};
-
-ds_cursimg_t ds_cursimg[dcurs_limit] = {
-	{
-		.rect = { 0, 0, 13, 21 },
-		.image = arrow_img
-	},
-	{
-		.rect = { -6, -10, 7, 11 },
-		.image = size_ud_img
-	},
-	{
-		.rect = { -10, -6, 11, 7 },
-		.image = size_lr_img
-	},
-	{
-		.rect = { -7, -7, 8, 8 },
-		.image = size_uldr_img
-	},
-	{
-		.rect = { -7, -7, 8, 8 },
-		.image = size_urdl_img
-	},
-	{
-		.rect = { -5, -9, 6, 10 },
-		.image = ibeam_img
-	}
-};
-
-/** @}
- */
Index: pace/srv/hid/display/cursimg.h
===================================================================
--- uspace/srv/hid/display/cursimg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server built-in cursor images
- */
-
-#ifndef CURSIMG_H
-#define CURSIMG_H
-
-#include "types/display/cursimg.h"
-
-extern ds_cursimg_t ds_cursimg[dcurs_limit];
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/cursor.c
===================================================================
--- uspace/srv/hid/display/cursor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server cursor
- */
-
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-#include <stdlib.h>
-#include "cursor.h"
-#include "display.h"
-
-/** Create cursor.
- *
- * @param disp Display
- * @param rect Rectangle bounding cursor graphic
- * @param image Cursor image (one entire byte per pixel)
- * @param rcursor Place to store pointer to new cursor.
- *
- * @return EOK on success or an error code
- */
-errno_t ds_cursor_create(ds_display_t *disp, gfx_rect_t *rect,
-    const uint8_t *image, ds_cursor_t **rcursor)
-{
-	ds_cursor_t *cursor = NULL;
-	errno_t rc;
-
-	cursor = calloc(1, sizeof(ds_cursor_t));
-	if (cursor == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	ds_display_add_cursor(disp, cursor);
-
-	cursor->rect = *rect;
-	cursor->image = image;
-	*rcursor = cursor;
-	return EOK;
-error:
-	return rc;
-}
-
-/** Destroy cusror.
- *
- * @param cursor Cursor
- */
-void ds_cursor_destroy(ds_cursor_t *cursor)
-{
-	list_remove(&cursor->ldisplay);
-
-	if (cursor->bitmap != NULL)
-		gfx_bitmap_destroy(cursor->bitmap);
-
-	free(cursor);
-}
-
-/** Paint cusor.
- *
- * @param cursor Cusor to paint
- * @param pos Position to paint at
- * @param clip Clipping rectangle or @c NULL
- * @return EOK on success or an error code
- */
-errno_t ds_cursor_paint(ds_cursor_t *cursor, gfx_coord2_t *pos,
-    gfx_rect_t *clip)
-{
-	gfx_context_t *dgc;
-	gfx_coord_t x, y;
-	gfx_bitmap_params_t bparams;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t dims;
-	gfx_rect_t sclip;
-	gfx_rect_t srect;
-	pixelmap_t pixelmap;
-	pixel_t pixel;
-	const uint8_t *pp;
-	errno_t rc;
-
-	dgc = ds_display_get_gc(cursor->display);
-	if (dgc == NULL)
-		return EOK;
-
-	gfx_bitmap_params_init(&bparams);
-	bparams.rect = cursor->rect;
-	bparams.flags = bmpf_color_key;
-	bparams.key_color = PIXEL(0, 0, 255, 255);
-
-	if (cursor->bitmap == NULL) {
-		rc = gfx_bitmap_create(dgc, &bparams, NULL, &cursor->bitmap);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_bitmap_get_alloc(cursor->bitmap, &alloc);
-		if (rc != EOK) {
-			gfx_bitmap_destroy(cursor->bitmap);
-			cursor->bitmap = NULL;
-			goto error;
-		}
-
-		gfx_rect_dims(&cursor->rect, &dims);
-		pixelmap.width = dims.x;
-		pixelmap.height = dims.y;
-		pixelmap.data = alloc.pixels;
-
-		pp = cursor->image;
-		for (y = 0; y < dims.y; y++) {
-			for (x = 0; x < dims.x; x++) {
-				switch (*pp) {
-				case 1:
-					pixel = PIXEL(0, 0, 0, 0);
-					break;
-				case 2:
-					pixel = PIXEL(0, 255, 255, 255);
-					break;
-				default:
-					pixel = PIXEL(0, 0, 255, 255);
-					break;
-				}
-
-				pixelmap_put_pixel(&pixelmap, x, y, pixel);
-				++pp;
-			}
-		}
-	}
-
-	/* Determine source rectangle */
-	if (clip == NULL) {
-		srect = cursor->rect;
-	} else {
-		gfx_rect_rtranslate(pos, clip, &sclip);
-		gfx_rect_clip(&cursor->rect, &sclip, &srect);
-	}
-
-	if (!gfx_rect_is_empty(&srect)) {
-		rc = gfx_bitmap_render(cursor->bitmap, &srect, pos);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Get rectangle covered by cursor when drawn at a specified position.
- *
- * @param cursor Cursor
- * @param pos Position where cursor is situated
- * @param rect Place to store rectangle covered by cursor
- */
-void ds_cursor_get_rect(ds_cursor_t *cursor, gfx_coord2_t *pos,
-    gfx_rect_t *drect)
-{
-	gfx_rect_translate(pos, &cursor->rect, drect);
-}
-
-/** @}
- */
Index: pace/srv/hid/display/cursor.h
===================================================================
--- uspace/srv/hid/display/cursor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server cursor
- */
-
-#ifndef CURSOR_H
-#define CURSOR_H
-
-#include <errno.h>
-#include <types/gfx/coord.h>
-#include <stdint.h>
-#include "types/display/display.h"
-#include "types/display/cursor.h"
-
-extern errno_t ds_cursor_create(ds_display_t *, gfx_rect_t *, const uint8_t *,
-    ds_cursor_t **);
-extern void ds_cursor_destroy(ds_cursor_t *);
-extern errno_t ds_cursor_paint(ds_cursor_t *, gfx_coord2_t *, gfx_rect_t *);
-extern void ds_cursor_get_rect(ds_cursor_t *, gfx_coord2_t *, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/ddev.c
===================================================================
--- uspace/srv/hid/display/ddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,165 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display device
- */
-
-#include <adt/list.h>
-#include <ddev.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include "display.h"
-#include "ddev.h"
-
-/** Create display device object.
- *
- * @param display Parent display
- * @param dd Display device
- * @param info Display device info
- * @param svc_id Display device service ID
- * @param svc_name Display device service name
- * @param gc Display device GC
- * @param rddev Place to store pointer to new display device.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_ddev_create(ds_display_t *display, ddev_t *dd,
-    ddev_info_t *info, char *svc_name, service_id_t svc_id,
-    gfx_context_t *gc, ds_ddev_t **rddev)
-{
-	ds_ddev_t *ddev;
-	errno_t rc;
-
-	ddev = calloc(1, sizeof(ds_ddev_t));
-	if (ddev == NULL)
-		return ENOMEM;
-
-	ddev->svc_name = svc_name;
-	ddev->svc_id = svc_id;
-	ddev->dd = dd;
-	ddev->gc = gc;
-	ddev->info = *info;
-
-	rc = ds_display_add_ddev(display, ddev);
-	if (rc != EOK) {
-		free(ddev);
-		return rc;
-	}
-
-	*rddev = ddev;
-	return EOK;
-}
-
-/** Open display device.
- *
- * @param display Parent display
- * @param svc_id Service ID
- * @param rddev Place to store pointer to new display device.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_ddev_open(ds_display_t *display, service_id_t svc_id,
-    ds_ddev_t **rddev)
-{
-	ds_ddev_t *ddev;
-	ddev_info_t info;
-	gfx_context_t *gc;
-	ddev_t *dd = NULL;
-	char *name = NULL;
-	errno_t rc;
-
-	rc = loc_service_get_name(svc_id, &name);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error resolving name of service %lu.",
-		    (unsigned long) svc_id);
-		return rc;
-	}
-
-	rc = ddev_open(name, &dd);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error opening display device '%s'.", name);
-		free(name);
-		return rc;
-	}
-
-	rc = ddev_get_info(dd, &info);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error getting information for display device '%s'.",
-		    name);
-		free(name);
-		ddev_close(dd);
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Device rectangle for '%s': "
-	    "%d,%d,%d,%d", name, info.rect.p0.x, info.rect.p0.y,
-	    info.rect.p1.x, info.rect.p1.y);
-
-	rc = ddev_get_gc(dd, &gc);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error getting device context for '%s'.", name);
-		ddev_close(dd);
-		free(name);
-		return rc;
-	}
-
-	rc = ds_ddev_create(display, dd, &info, name, svc_id, gc, &ddev);
-	if (rc != EOK) {
-		free(name);
-		ddev_close(dd);
-		gfx_context_delete(gc);
-		return rc;
-	}
-
-	rc = ds_display_paint(display, NULL);
-	if (rc != EOK)
-		return rc;
-
-	*rddev = ddev;
-	return EOK;
-}
-
-/** Destroy display device.
- *
- * @param ddev Display device
- */
-void ds_ddev_close(ds_ddev_t *ddev)
-{
-	ds_display_remove_ddev(ddev);
-	free(ddev);
-}
-
-/** @}
- */
Index: pace/srv/hid/display/ddev.h
===================================================================
--- uspace/srv/hid/display/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display device
- */
-
-#ifndef DDEV_H
-#define DDEV_H
-
-#include <errno.h>
-#include <loc.h>
-#include "types/display/ddev.h"
-#include "types/display/display.h"
-
-extern errno_t ds_ddev_create(ds_display_t *, ddev_t *, ddev_info_t *,
-    char *, service_id_t, gfx_context_t *, ds_ddev_t **);
-extern errno_t ds_ddev_open(ds_display_t *, service_id_t, ds_ddev_t **);
-extern void ds_ddev_close(ds_ddev_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/display.c
===================================================================
--- uspace/srv/hid/display/display.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1293 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display
- */
-
-#include <errno.h>
-#include <gfx/bitmap.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <io/log.h>
-#include <memgfx/memgc.h>
-#include <stdlib.h>
-#include <str.h>
-#include "client.h"
-#include "clonegc.h"
-#include "cursimg.h"
-#include "cursor.h"
-#include "display.h"
-#include "idevcfg.h"
-#include "seat.h"
-#include "window.h"
-#include "wmclient.h"
-
-static gfx_context_t *ds_display_get_unbuf_gc(ds_display_t *);
-static void ds_display_invalidate_cb(void *, gfx_rect_t *);
-static void ds_display_update_cb(void *);
-
-static mem_gc_cb_t ds_display_mem_gc_cb = {
-	.invalidate = ds_display_invalidate_cb,
-	.update = ds_display_update_cb
-};
-
-/** Create display.
- *
- * @param gc Graphics context for displaying output
- * @param flags Display flags
- * @param rdisp Place to store pointer to new display.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_display_create(gfx_context_t *gc, ds_display_flags_t flags,
-    ds_display_t **rdisp)
-{
-	ds_display_t *disp;
-	ds_cursor_t *cursor;
-	int i;
-	errno_t rc;
-
-	disp = calloc(1, sizeof(ds_display_t));
-	if (disp == NULL)
-		return ENOMEM;
-
-	rc = gfx_color_new_rgb_i16(0x8000, 0xc800, 0xffff, &disp->bg_color);
-	if (rc != EOK) {
-		free(disp);
-		return ENOMEM;
-	}
-
-	list_initialize(&disp->cursors);
-
-	for (i = 0; i < dcurs_limit; i++) {
-		rc = ds_cursor_create(disp, &ds_cursimg[i].rect,
-		    ds_cursimg[i].image, &cursor);
-		if (rc != EOK)
-			goto error;
-
-		disp->cursor[i] = cursor;
-	}
-
-	fibril_mutex_initialize(&disp->lock);
-	list_initialize(&disp->clients);
-	list_initialize(&disp->wmclients);
-	list_initialize(&disp->cfgclients);
-	disp->next_wnd_id = 1;
-	disp->next_seat_id = 1;
-	list_initialize(&disp->ddevs);
-	list_initialize(&disp->idevcfgs);
-	list_initialize(&disp->ievents);
-	fibril_condvar_initialize(&disp->ievent_cv);
-	list_initialize(&disp->seats);
-	list_initialize(&disp->windows);
-	disp->flags = flags;
-	*rdisp = disp;
-	return EOK;
-error:
-	ds_display_destroy(disp);
-	return rc;
-}
-
-/** Destroy display.
- *
- * @param disp Display
- */
-void ds_display_destroy(ds_display_t *disp)
-{
-	int i;
-
-	assert(list_empty(&disp->clients));
-	assert(list_empty(&disp->wmclients));
-	assert(list_empty(&disp->cfgclients));
-	assert(list_empty(&disp->seats));
-	assert(list_empty(&disp->ddevs));
-	assert(list_empty(&disp->idevcfgs));
-	assert(list_empty(&disp->ievents));
-	assert(list_empty(&disp->seats));
-	assert(list_empty(&disp->windows));
-
-	/* Destroy cursors */
-	for (i = 0; i < dcurs_limit; i++) {
-		ds_cursor_destroy(disp->cursor[i]);
-		disp->cursor[i] = NULL;
-	}
-
-	gfx_color_delete(disp->bg_color);
-	free(disp);
-}
-
-/** Load display configuration from SIF file.
- *
- * @param display Display
- * @param cfgpath Configuration file path
- *
- * @return EOK on success or an error code
- */
-errno_t ds_display_load_cfg(ds_display_t *display, const char *cfgpath)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *ndisplay;
-	sif_node_t *nseats;
-	sif_node_t *nseat;
-	ds_seat_t *seat;
-	sif_node_t *nidevcfgs;
-	sif_node_t *nidevcfg;
-	const char *ntype;
-	ds_idevcfg_t *idevcfg;
-	errno_t rc;
-
-	rc = sif_load(cfgpath, &doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	ndisplay = sif_node_first_child(rnode);
-	ntype = sif_node_get_type(ndisplay);
-	if (str_cmp(ntype, "display") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	nseats = sif_node_first_child(ndisplay);
-	ntype = sif_node_get_type(nseats);
-	if (str_cmp(ntype, "seats") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	/* Load individual seats */
-	nseat = sif_node_first_child(nseats);
-	while (nseat != NULL) {
-		ntype = sif_node_get_type(nseat);
-		if (str_cmp(ntype, "seat") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = ds_seat_load(display, nseat, &seat);
-		if (rc != EOK)
-			goto error;
-
-		(void)seat;
-		nseat = sif_node_next_child(nseat);
-	}
-
-	nidevcfgs = sif_node_next_child(nseats);
-	ntype = sif_node_get_type(nidevcfgs);
-	if (str_cmp(ntype, "idevcfgs") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	/* Load individual input device configuration entries */
-	nidevcfg = sif_node_first_child(nidevcfgs);
-	while (nidevcfg != NULL) {
-		ntype = sif_node_get_type(nidevcfg);
-		if (str_cmp(ntype, "idevcfg") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		/*
-		 * Load device configuration entry. If the device
-		 * is not currently connected (ENOENT), skip it.
-		 */
-		rc = ds_idevcfg_load(display, nidevcfg, &idevcfg);
-		if (rc != EOK && rc != ENOENT)
-			goto error;
-
-		(void)idevcfg;
-		nidevcfg = sif_node_next_child(nidevcfg);
-	}
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-
-	seat = ds_display_first_seat(display);
-	while (seat != NULL) {
-		ds_seat_destroy(seat);
-		seat = ds_display_first_seat(display);
-	}
-	return rc;
-}
-
-/** Save display configuration to SIF file.
- *
- * @param display Display
- * @param cfgpath Configuration file path
- *
- * @return EOK on success or an error code
- */
-errno_t ds_display_save_cfg(ds_display_t *display, const char *cfgpath)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *ndisplay;
-	sif_node_t *nseats;
-	sif_node_t *nseat;
-	ds_seat_t *seat;
-	sif_node_t *nidevcfgs;
-	sif_node_t *nidevcfg;
-	ds_idevcfg_t *idevcfg;
-	errno_t rc;
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	rc = sif_node_append_child(rnode, "display", &ndisplay);
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_node_append_child(ndisplay, "seats", &nseats);
-	if (rc != EOK)
-		goto error;
-
-	/* Save individual seats */
-	seat = ds_display_first_seat(display);
-	while (seat != NULL) {
-		rc = sif_node_append_child(nseats, "seat", &nseat);
-		if (rc != EOK)
-			goto error;
-
-		rc = ds_seat_save(seat, nseat);
-		if (rc != EOK)
-			goto error;
-
-		seat = ds_display_next_seat(seat);
-	}
-
-	rc = sif_node_append_child(ndisplay, "idevcfgs", &nidevcfgs);
-	if (rc != EOK)
-		goto error;
-
-	/* Save individual input device configuration entries */
-	idevcfg = ds_display_first_idevcfg(display);
-	while (idevcfg != NULL) {
-		rc = sif_node_append_child(nidevcfgs, "idevcfg", &nidevcfg);
-		if (rc != EOK)
-			goto error;
-
-		rc = ds_idevcfg_save(idevcfg, nidevcfg);
-		if (rc != EOK)
-			goto error;
-
-		idevcfg = ds_display_next_idevcfg(idevcfg);
-	}
-
-	rc = sif_save(doc, cfgpath);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	return rc;
-}
-
-/** Lock display.
- *
- * This should be called in any thread that wishes to access the display
- * or its child objects (e.g. windows).
- *
- * @param disp Display
- */
-void ds_display_lock(ds_display_t *disp)
-{
-	fibril_mutex_lock(&disp->lock);
-}
-
-/** Unlock display.
- *
- * @param disp Display
- */
-void ds_display_unlock(ds_display_t *disp)
-{
-	fibril_mutex_unlock(&disp->lock);
-}
-
-/** Get display information.
- *
- * @param disp Display
- */
-void ds_display_get_info(ds_display_t *disp, display_info_t *info)
-{
-	info->rect = disp->rect;
-}
-
-/** Add client to display.
- *
- * @param disp Display
- * @param client Client
- */
-void ds_display_add_client(ds_display_t *disp, ds_client_t *client)
-{
-	assert(client->display == NULL);
-	assert(!link_used(&client->lclients));
-
-	client->display = disp;
-	list_append(&client->lclients, &disp->clients);
-}
-
-/** Remove client from display.
- *
- * @param client Client
- */
-void ds_display_remove_client(ds_client_t *client)
-{
-	list_remove(&client->lclients);
-	client->display = NULL;
-}
-
-/** Get first client in display.
- *
- * @param disp Display
- * @return First client or @c NULL if there is none
- */
-ds_client_t *ds_display_first_client(ds_display_t *disp)
-{
-	link_t *link = list_first(&disp->clients);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_client_t, lclients);
-}
-
-/** Get next client in display.
- *
- * @param client Current client
- * @return Next client or @c NULL if there is none
- */
-ds_client_t *ds_display_next_client(ds_client_t *client)
-{
-	link_t *link = list_next(&client->lclients, &client->display->clients);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_client_t, lclients);
-}
-
-/** Add WM client to display.
- *
- * @param disp Display
- * @param wmclient WM client
- */
-void ds_display_add_wmclient(ds_display_t *disp, ds_wmclient_t *wmclient)
-{
-	assert(wmclient->display == NULL);
-	assert(!link_used(&wmclient->lwmclients));
-
-	wmclient->display = disp;
-	list_append(&wmclient->lwmclients, &disp->wmclients);
-}
-
-/** Remove WM client from display.
- *
- * @param wmclient WM client
- */
-void ds_display_remove_wmclient(ds_wmclient_t *wmclient)
-{
-	list_remove(&wmclient->lwmclients);
-	wmclient->display = NULL;
-}
-
-/** Add CFG client to display.
- *
- * @param disp Display
- * @param cfgclient CFG client
- */
-void ds_display_add_cfgclient(ds_display_t *disp, ds_cfgclient_t *cfgclient)
-{
-	assert(cfgclient->display == NULL);
-	assert(!link_used(&cfgclient->lcfgclients));
-
-	cfgclient->display = disp;
-	list_append(&cfgclient->lcfgclients, &disp->cfgclients);
-}
-
-/** Remove CFG client from display.
- *
- * @param cfgclient CFG client
- */
-void ds_display_remove_cfgclient(ds_cfgclient_t *cfgclient)
-{
-	list_remove(&cfgclient->lcfgclients);
-	cfgclient->display = NULL;
-}
-
-/** Get first WM client in display.
- *
- * @param disp Display
- * @return First WM client or @c NULL if there is none
- */
-ds_wmclient_t *ds_display_first_wmclient(ds_display_t *disp)
-{
-	link_t *link = list_first(&disp->wmclients);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_wmclient_t, lwmclients);
-}
-
-/** Get next WM client in display.
- *
- * @param wmclient Current WM client
- * @return Next WM client or @c NULL if there is none
- */
-ds_wmclient_t *ds_display_next_wmclient(ds_wmclient_t *wmclient)
-{
-	link_t *link = list_next(&wmclient->lwmclients,
-	    &wmclient->display->wmclients);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_wmclient_t, lwmclients);
-}
-
-/** Find window in all clients by ID.
- *
- * XXX This is just a hack needed to match GC connection to a window,
- * as we don't have a good safe way to pass the GC endpoint to our client
- * on demand.
- *
- * @param display Display
- * @param id Window ID
- */
-ds_window_t *ds_display_find_window(ds_display_t *display, ds_wnd_id_t id)
-{
-	ds_client_t *client;
-	ds_window_t *wnd;
-
-	client = ds_display_first_client(display);
-	while (client != NULL) {
-		wnd = ds_client_find_window(client, id);
-		if (wnd != NULL)
-			return wnd;
-
-		client = ds_display_next_client(client);
-	}
-
-	return NULL;
-}
-
-/** Find window by display position.
- *
- * @param display Display
- * @param pos Display position
- */
-ds_window_t *ds_display_window_by_pos(ds_display_t *display, gfx_coord2_t *pos)
-{
-	ds_window_t *wnd;
-	gfx_rect_t drect;
-
-	wnd = ds_display_first_window(display);
-	while (wnd != NULL) {
-		/* Window bounding rectangle on display */
-		gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
-
-		if (gfx_pix_inside_rect(pos, &drect) &&
-		    ds_window_is_visible(wnd))
-			return wnd;
-
-		wnd = ds_display_next_window(wnd);
-	}
-
-	return NULL;
-}
-
-/** Add window to window list.
- *
- * Topmost windows are enlisted before any other window. Non-topmost
- * windows are enlisted before any other non-topmost window.
- *
- * @param display Display
- * @param wnd Window
- */
-void ds_display_enlist_window(ds_display_t *display, ds_window_t *wnd)
-{
-	ds_window_t *w;
-
-	assert(wnd->display == display);
-	assert(!link_used(&wnd->ldwindows));
-
-	if ((wnd->flags & wndf_topmost) == 0) {
-		/* Find the first non-topmost window */
-		w = ds_display_first_window(display);
-		while (w != NULL && (w->flags & wndf_topmost) != 0)
-			w = ds_display_next_window(w);
-
-		if (w != NULL)
-			list_insert_before(&wnd->ldwindows, &w->ldwindows);
-		else
-			list_append(&wnd->ldwindows, &display->windows);
-	} else {
-		/* Insert at the beginning */
-		list_prepend(&wnd->ldwindows, &display->windows);
-	}
-
-}
-
-/** Add window to display.
- *
- * @param display Display
- * @param wnd Window
- */
-void ds_display_add_window(ds_display_t *display, ds_window_t *wnd)
-{
-	ds_wmclient_t *wmclient;
-
-	assert(wnd->display == NULL);
-	assert(!link_used(&wnd->ldwindows));
-
-	wnd->display = display;
-	ds_display_enlist_window(display, wnd);
-
-	/* Notify window managers about the new window */
-	wmclient = ds_display_first_wmclient(display);
-	while (wmclient != NULL) {
-		ds_wmclient_post_wnd_added_event(wmclient, wnd->id);
-		wmclient = ds_display_next_wmclient(wmclient);
-	}
-}
-
-/** Remove window from display.
- *
- * @param wnd Window
- */
-void ds_display_remove_window(ds_window_t *wnd)
-{
-	ds_wmclient_t *wmclient;
-	ds_display_t *display;
-
-	display = wnd->display;
-
-	list_remove(&wnd->ldwindows);
-	wnd->display = NULL;
-
-	/* Notify window managers about the removed window */
-	wmclient = ds_display_first_wmclient(display);
-	while (wmclient != NULL) {
-		ds_wmclient_post_wnd_removed_event(wmclient, wnd->id);
-		wmclient = ds_display_next_wmclient(wmclient);
-	}
-}
-
-/** Move window to top.
- *
- * @param display Display
- * @param wnd Window
- */
-void ds_display_window_to_top(ds_window_t *wnd)
-{
-	assert(wnd->display != NULL);
-	assert(link_used(&wnd->ldwindows));
-
-	list_remove(&wnd->ldwindows);
-	ds_display_enlist_window(wnd->display, wnd);
-}
-
-/** Get first window in display.
- *
- * @param display Display
- * @return First window or @c NULL if there is none
- */
-ds_window_t *ds_display_first_window(ds_display_t *display)
-{
-	link_t *link = list_first(&display->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, ldwindows);
-}
-
-/** Get last window in display.
- *
- * @param display Display
- * @return Last window or @c NULL if there is none
- */
-ds_window_t *ds_display_last_window(ds_display_t *display)
-{
-	link_t *link = list_last(&display->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, ldwindows);
-}
-
-/** Get next window in client.
- *
- * @param wnd Current window
- * @return Next window or @c NULL if there is none
- */
-ds_window_t *ds_display_next_window(ds_window_t *wnd)
-{
-	link_t *link = list_next(&wnd->ldwindows, &wnd->display->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, ldwindows);
-}
-
-/** Get previous window in client.
- *
- * @param wnd Current window
- * @return Previous window or @c NULL if there is none
- */
-ds_window_t *ds_display_prev_window(ds_window_t *wnd)
-{
-	link_t *link = list_prev(&wnd->ldwindows, &wnd->display->windows);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_window_t, ldwindows);
-}
-
-/** Post keyboard event to a display.
- *
- * The event is routed to the correct window by first determining the
- * seat the keyboard device belongs to and then the event is sent to the
- * window focused by that seat.
- *
- * @param display Display
- * @param event Event
- */
-errno_t ds_display_post_kbd_event(ds_display_t *display, kbd_event_t *event)
-{
-	ds_seat_t *seat;
-
-	/* Determine which seat the event belongs to */
-	seat = ds_display_seat_by_idev(display, event->kbd_id);
-	if (seat == NULL)
-		return EOK;
-
-	return ds_seat_post_kbd_event(seat, event);
-}
-
-/** Post position event to a display.
- *
- * @param display Display
- * @param event Event
- */
-errno_t ds_display_post_ptd_event(ds_display_t *display, ptd_event_t *event)
-{
-	ds_seat_t *seat;
-
-	/* Determine which seat the event belongs to */
-	seat = ds_display_seat_by_idev(display, event->pos_id);
-	if (seat == NULL)
-		return EOK;
-
-	return ds_seat_post_ptd_event(seat, event);
-}
-
-/** Add seat to display.
- *
- * @param disp Display
- * @param seat Seat
- */
-void ds_display_add_seat(ds_display_t *disp, ds_seat_t *seat)
-{
-	assert(seat->display == NULL);
-	assert(!link_used(&seat->lseats));
-
-	seat->display = disp;
-	seat->id = disp->next_seat_id++;
-	list_append(&seat->lseats, &disp->seats);
-}
-
-/** Remove seat from display.
- *
- * @param seat Seat
- */
-void ds_display_remove_seat(ds_seat_t *seat)
-{
-	list_remove(&seat->lseats);
-	seat->display = NULL;
-}
-
-/** Get first seat in display.
- *
- * @param disp Display
- * @return First seat or @c NULL if there is none
- */
-ds_seat_t *ds_display_first_seat(ds_display_t *disp)
-{
-	link_t *link = list_first(&disp->seats);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_seat_t, lseats);
-}
-
-/** Get next seat in display.
- *
- * @param seat Current seat
- * @return Next seat or @c NULL if there is none
- */
-ds_seat_t *ds_display_next_seat(ds_seat_t *seat)
-{
-	link_t *link = list_next(&seat->lseats, &seat->display->seats);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_seat_t, lseats);
-}
-
-/** Get default seat in display.
- *
- * @param disp Display
- * @return First seat or @c NULL if there is none
- */
-ds_seat_t *ds_display_default_seat(ds_display_t *disp)
-{
-	/* XXX Probably not the best solution */
-	return ds_display_first_seat(disp);
-}
-
-/** Find seat by ID.
- *
- * @param display Display
- * @param id Seat ID
- */
-ds_seat_t *ds_display_find_seat(ds_display_t *display, ds_seat_id_t id)
-{
-	ds_seat_t *seat;
-
-	seat = ds_display_first_seat(display);
-	while (seat != NULL) {
-		if (seat->id == id)
-			return seat;
-
-		seat = ds_display_next_seat(seat);
-	}
-
-	return NULL;
-}
-
-/** Get seat which owns the specified input device.
- *
- * @param disp Display
- * @param idev_id Input device ID
- * @return Seat which owns device with ID @a idev_id or @c NULL if not found
- */
-ds_seat_t *ds_display_seat_by_idev(ds_display_t *disp, ds_idev_id_t idev_id)
-{
-	ds_idevcfg_t *idevcfg;
-
-	/*
-	 * Find input device configuration entry that maps this input device
-	 * to a seat.
-	 */
-	idevcfg = ds_display_first_idevcfg(disp);
-	while (idevcfg != NULL) {
-		if (idevcfg->svc_id == idev_id)
-			return idevcfg->seat;
-
-		idevcfg = ds_display_next_idevcfg(idevcfg);
-	}
-
-	/* If none was found, return the default seat */
-	return ds_display_default_seat(disp);
-}
-
-/** Allocate back buffer for display.
- *
- * @param disp Display
- * @return EOK on success or if no back buffer is required, otherwise
- *         an error code.
- */
-static errno_t ds_display_alloc_backbuf(ds_display_t *disp)
-{
-	gfx_context_t *ugc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	/* Allocate backbuffer */
-	if ((disp->flags & df_disp_double_buf) == 0) {
-		/* Not double buffering. Nothing to do. */
-		return EOK;
-	}
-
-	ugc = ds_display_get_unbuf_gc(disp);
-
-	gfx_bitmap_params_init(&params);
-	params.rect = disp->rect;
-
-	rc = gfx_bitmap_create(ugc, &params, NULL,
-	    &disp->backbuf);
-	if (rc != EOK)
-		goto error;
-
-	rc = gfx_bitmap_get_alloc(disp->backbuf, &alloc);
-	if (rc != EOK)
-		goto error;
-
-	rc = mem_gc_create(&disp->rect, &alloc, &ds_display_mem_gc_cb,
-	    (void *) disp, &disp->bbgc);
-	if (rc != EOK)
-		goto error;
-
-	disp->dirty_rect.p0.x = 0;
-	disp->dirty_rect.p0.y = 0;
-	disp->dirty_rect.p1.x = 0;
-	disp->dirty_rect.p1.y = 0;
-
-	return EOK;
-error:
-	if (disp->backbuf != NULL) {
-		gfx_bitmap_destroy(disp->backbuf);
-		disp->backbuf = NULL;
-	}
-
-	return rc;
-}
-
-/** Add display device to display.
- *
- * @param disp Display
- * @param ddev Display device
- * @return EOK on success, or an error code
- */
-errno_t ds_display_add_ddev(ds_display_t *disp, ds_ddev_t *ddev)
-{
-	errno_t rc;
-	gfx_rect_t old_disp_rect;
-
-	assert(ddev->display == NULL);
-	assert(!link_used(&ddev->lddevs));
-
-	old_disp_rect = disp->rect;
-
-	ddev->display = disp;
-	list_append(&ddev->lddevs, &disp->ddevs);
-
-	/* First display device */
-	if (gfx_rect_is_empty(&disp->rect)) {
-		/* Set screen dimensions */
-		disp->rect = ddev->info.rect;
-
-		/* Create cloning GC */
-		rc = ds_clonegc_create(ddev->gc, &disp->fbgc);
-		if (rc != EOK)
-			goto error;
-
-		/* Allocate backbuffer */
-		rc = ds_display_alloc_backbuf(disp);
-		if (rc != EOK) {
-			ds_clonegc_delete(disp->fbgc);
-			disp->fbgc = NULL;
-			goto error;
-		}
-	} else {
-		/* Add new output device to cloning GC */
-		rc = ds_clonegc_add_output(disp->fbgc, ddev->gc);
-		if (rc != EOK)
-			goto error;
-	}
-
-	ds_display_update_max_rect(disp);
-
-	return EOK;
-error:
-	disp->rect = old_disp_rect;
-	list_remove(&ddev->lddevs);
-	return rc;
-}
-
-/** Remove display device from display.
- *
- * @param ddev Display device
- */
-void ds_display_remove_ddev(ds_ddev_t *ddev)
-{
-	list_remove(&ddev->lddevs);
-	ddev->display = NULL;
-}
-
-/** Get first display device in display.
- *
- * @param disp Display
- * @return First display device or @c NULL if there is none
- */
-ds_ddev_t *ds_display_first_ddev(ds_display_t *disp)
-{
-	link_t *link = list_first(&disp->ddevs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_ddev_t, lddevs);
-}
-
-/** Get next display device in display.
- *
- * @param ddev Current display device
- * @return Next display device or @c NULL if there is none
- */
-ds_ddev_t *ds_display_next_ddev(ds_ddev_t *ddev)
-{
-	link_t *link = list_next(&ddev->lddevs, &ddev->display->ddevs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_ddev_t, lddevs);
-}
-
-/** Add input device configuration entry to display.
- *
- * @param disp Display
- * @param idevcfg Input device configuration
- */
-void ds_display_add_idevcfg(ds_display_t *disp, ds_idevcfg_t *idevcfg)
-{
-	assert(idevcfg->display == NULL);
-	assert(!link_used(&idevcfg->ldispidcfgs));
-
-	idevcfg->display = disp;
-	list_append(&idevcfg->ldispidcfgs, &disp->idevcfgs);
-}
-
-/** Remove input device configuration entry from display.
- *
- * @param idevcfg Input device configuration entry
- */
-void ds_display_remove_idevcfg(ds_idevcfg_t *idevcfg)
-{
-	list_remove(&idevcfg->ldispidcfgs);
-	idevcfg->display = NULL;
-}
-
-/** Get first input device configuration entry in display.
- *
- * @param disp Display
- * @return First input device configuration entry or @c NULL if there is none
- */
-ds_idevcfg_t *ds_display_first_idevcfg(ds_display_t *disp)
-{
-	link_t *link = list_first(&disp->idevcfgs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_idevcfg_t, ldispidcfgs);
-}
-
-/** Get next input device configuration entry in display.
- *
- * @param idevcfg Current input device configuration entry
- * @return Next input device configuration entry or @c NULL if there is none
- */
-ds_idevcfg_t *ds_display_next_idevcfg(ds_idevcfg_t *idevcfg)
-{
-	link_t *link = list_next(&idevcfg->ldispidcfgs, &idevcfg->display->idevcfgs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_idevcfg_t, ldispidcfgs);
-}
-
-/** Add cursor to display.
- *
- * @param display Display
- * @param cursor Cursor
- */
-void ds_display_add_cursor(ds_display_t *display, ds_cursor_t *cursor)
-{
-	assert(cursor->display == NULL);
-	assert(!link_used(&cursor->ldisplay));
-
-	cursor->display = display;
-	list_prepend(&cursor->ldisplay, &display->cursors);
-}
-
-/** Remove cursor from display.
- *
- * @param cursor Cursor
- */
-void ds_display_remove_cursor(ds_cursor_t *cursor)
-{
-	list_remove(&cursor->ldisplay);
-	cursor->display = NULL;
-}
-
-/** Update display maximize rectangle.
- *
- * Recalculate the maximize rectangle (the rectangle used for maximized
- * windows).
- *
- * @param display Display
- */
-void ds_display_update_max_rect(ds_display_t *display)
-{
-	ds_window_t *wnd;
-	gfx_rect_t max_rect;
-	gfx_rect_t drect;
-
-	/* Start with the entire display */
-	max_rect = display->rect;
-
-	wnd = ds_display_first_window(display);
-	while (wnd != NULL) {
-		/* Should maximized windows avoid this window? */
-		if ((wnd->flags & wndf_avoid) != 0) {
-			/* Window bounding rectangle on display */
-			gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
-
-			/* Crop maximized rectangle */
-			ds_display_crop_max_rect(&drect, &max_rect);
-		}
-
-		wnd = ds_display_next_window(wnd);
-	}
-
-	/* Update the maximize rectangle */
-	display->max_rect = max_rect;
-}
-
-/** Crop maximize rectangle.
- *
- * Use the avoid rectangle @a arect to crop off maximization rectangle
- * @a mrect. If @a arect covers the top, bottom, left or right part
- * of @a mrect, it will be cropped off. Otherwise there will be
- * no effect.
- *
- * @param arect Avoid rectangle
- * @param mrect Maximize rectangle to be modified
- */
-void ds_display_crop_max_rect(gfx_rect_t *arect, gfx_rect_t *mrect)
-{
-	if (arect->p0.x == mrect->p0.x && arect->p0.y == mrect->p0.y &&
-	    arect->p1.x == mrect->p1.x) {
-		/* Cropp off top part */
-		mrect->p0.y = arect->p1.y;
-	} else if (arect->p0.x == mrect->p0.x && arect->p1.x == mrect->p1.x &&
-	    arect->p1.y == mrect->p1.y) {
-		/* Cropp off bottom part */
-		mrect->p1.y = arect->p0.y;
-	} else if (arect->p0.x == mrect->p0.x && arect->p0.y == mrect->p0.y &&
-	    arect->p1.y == mrect->p1.y) {
-		/* Cropp off left part */
-		mrect->p0.x = arect->p1.x;
-	} else if (arect->p0.y == mrect->p0.y && arect->p1.x == mrect->p1.x &&
-	    arect->p1.y == mrect->p1.y) {
-		/* Cropp off right part */
-		mrect->p1.x = arect->p0.x;
-	}
-}
-
-/** Get unbuffered GC.
- *
- * Get the display's (unbuffered) graphic context. If the display
- * is double-buffered, this returns GC of the front buffer. If the display
- * is unbuffered, this is the same as @c ds_display_get_gc().
- *
- * @param display Display
- * @return Unbuffered GC
- */
-static gfx_context_t *ds_display_get_unbuf_gc(ds_display_t *display)
-{
-	/* In case of unit tests */
-	if (display->fbgc == NULL)
-		return NULL;
-
-	return ds_clonegc_get_ctx(display->fbgc);
-}
-
-/** Get display GC.
- *
- * Get the graphic context used to paint the display. This is to be used
- * for all display server paint operations.
- *
- * @param display Display
- * @return Graphic context for painting to the display
- */
-gfx_context_t *ds_display_get_gc(ds_display_t *display)
-{
-	if ((display->flags & df_disp_double_buf) != 0)
-		return mem_gc_get_ctx(display->bbgc);
-	else
-		return ds_display_get_unbuf_gc(display);
-}
-
-/** Paint display background.
- *
- * @param display Display
- * @param rect Bounding rectangle or @c NULL to repaint entire display
- */
-errno_t ds_display_paint_bg(ds_display_t *disp, gfx_rect_t *rect)
-{
-	gfx_rect_t crect;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	if (rect != NULL)
-		gfx_rect_clip(&disp->rect, rect, &crect);
-	else
-		crect = disp->rect;
-
-	gc = ds_display_get_gc(disp);
-	if (gc == NULL)
-		return EOK;
-
-	rc = gfx_set_color(gc, disp->bg_color);
-	if (rc != EOK)
-		return rc;
-
-	return gfx_fill_rect(gc, &crect);
-}
-
-/** Update front buffer from back buffer.
- *
- * If the display is not double-buffered, no action is taken.
- *
- * @param disp Display
- * @return EOK on success, or an error code
- */
-static errno_t ds_display_update(ds_display_t *disp)
-{
-	errno_t rc;
-
-	if (disp->backbuf == NULL) {
-		/* Not double-buffered, nothing to do. */
-		return EOK;
-	}
-
-	rc = gfx_bitmap_render(disp->backbuf, &disp->dirty_rect, NULL);
-	if (rc != EOK)
-		return rc;
-
-	disp->dirty_rect.p0.x = 0;
-	disp->dirty_rect.p0.y = 0;
-	disp->dirty_rect.p1.x = 0;
-	disp->dirty_rect.p1.y = 0;
-
-	return EOK;
-}
-
-/** Paint display.
- *
- * @param display Display
- * @param rect Bounding rectangle or @c NULL to repaint entire display
- */
-errno_t ds_display_paint(ds_display_t *disp, gfx_rect_t *rect)
-{
-	errno_t rc;
-	ds_window_t *wnd;
-	ds_seat_t *seat;
-
-	/* Paint background */
-	rc = ds_display_paint_bg(disp, rect);
-	if (rc != EOK)
-		return rc;
-
-	/* Paint windows bottom to top */
-	wnd = ds_display_last_window(disp);
-	while (wnd != NULL) {
-		rc = ds_window_paint(wnd, rect);
-		if (rc != EOK)
-			return rc;
-
-		wnd = ds_display_prev_window(wnd);
-	}
-
-	/* Paint window previews for windows being resized or moved */
-	wnd = ds_display_last_window(disp);
-	while (wnd != NULL) {
-		rc = ds_window_paint_preview(wnd, rect);
-		if (rc != EOK)
-			return rc;
-
-		wnd = ds_display_prev_window(wnd);
-	}
-
-	/* Paint pointers */
-	seat = ds_display_first_seat(disp);
-	while (seat != NULL) {
-		rc = ds_seat_paint_pointer(seat, rect);
-		if (rc != EOK)
-			return rc;
-
-		seat = ds_display_next_seat(seat);
-	}
-
-	return ds_display_update(disp);
-}
-
-/** Display invalidate callback.
- *
- * Called by backbuffer memory GC when something is rendered into it.
- * Updates the display's dirty rectangle.
- *
- * @param arg Argument (display cast as void *)
- * @param rect Rectangle to update
- */
-static void ds_display_invalidate_cb(void *arg, gfx_rect_t *rect)
-{
-	ds_display_t *disp = (ds_display_t *) arg;
-	gfx_rect_t env;
-
-	gfx_rect_envelope(&disp->dirty_rect, rect, &env);
-	disp->dirty_rect = env;
-}
-
-/** Display update callback.
- *
- * @param arg Argument (display cast as void *)
- */
-static void ds_display_update_cb(void *arg)
-{
-	ds_display_t *disp = (ds_display_t *) arg;
-
-	(void) disp;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/display.h
===================================================================
--- uspace/srv/hid/display/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display
- */
-
-#ifndef DISPLAY_H
-#define DISPLAY_H
-
-#include <display/info.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include "types/display/cfgclient.h"
-#include "types/display/client.h"
-#include "types/display/cursor.h"
-#include "types/display/ddev.h"
-#include "types/display/display.h"
-#include "types/display/idev.h"
-#include "types/display/idevcfg.h"
-#include "types/display/ptd_event.h"
-#include "types/display/seat.h"
-#include "types/display/wmclient.h"
-
-extern errno_t ds_display_create(gfx_context_t *, ds_display_flags_t,
-    ds_display_t **);
-extern void ds_display_destroy(ds_display_t *);
-errno_t ds_display_load_cfg(ds_display_t *, const char *);
-errno_t ds_display_save_cfg(ds_display_t *, const char *);
-extern void ds_display_lock(ds_display_t *);
-extern void ds_display_unlock(ds_display_t *);
-extern void ds_display_get_info(ds_display_t *, display_info_t *);
-extern void ds_display_add_client(ds_display_t *, ds_client_t *);
-extern void ds_display_remove_client(ds_client_t *);
-extern ds_client_t *ds_display_first_client(ds_display_t *);
-extern ds_client_t *ds_display_next_client(ds_client_t *);
-extern void ds_display_add_wmclient(ds_display_t *, ds_wmclient_t *);
-extern void ds_display_remove_wmclient(ds_wmclient_t *);
-extern void ds_display_add_cfgclient(ds_display_t *, ds_cfgclient_t *);
-extern void ds_display_remove_cfgclient(ds_cfgclient_t *);
-extern ds_wmclient_t *ds_display_first_wmclient(ds_display_t *);
-extern ds_wmclient_t *ds_display_next_wmclient(ds_wmclient_t *);
-extern ds_window_t *ds_display_find_window(ds_display_t *, ds_wnd_id_t);
-extern ds_window_t *ds_display_window_by_pos(ds_display_t *, gfx_coord2_t *);
-extern void ds_display_enlist_window(ds_display_t *, ds_window_t *);
-extern void ds_display_add_window(ds_display_t *, ds_window_t *);
-extern void ds_display_remove_window(ds_window_t *);
-extern void ds_display_window_to_top(ds_window_t *);
-extern ds_window_t *ds_display_first_window(ds_display_t *);
-extern ds_window_t *ds_display_last_window(ds_display_t *);
-extern ds_window_t *ds_display_next_window(ds_window_t *);
-extern ds_window_t *ds_display_prev_window(ds_window_t *);
-extern errno_t ds_display_post_kbd_event(ds_display_t *, kbd_event_t *);
-extern errno_t ds_display_post_ptd_event(ds_display_t *, ptd_event_t *);
-extern void ds_display_add_seat(ds_display_t *, ds_seat_t *);
-extern void ds_display_remove_seat(ds_seat_t *);
-extern ds_seat_t *ds_display_first_seat(ds_display_t *);
-extern ds_seat_t *ds_display_next_seat(ds_seat_t *);
-extern ds_seat_t *ds_display_default_seat(ds_display_t *);
-extern ds_seat_t *ds_display_find_seat(ds_display_t *, ds_seat_id_t);
-extern ds_seat_t *ds_display_seat_by_idev(ds_display_t *, ds_idev_id_t);
-extern errno_t ds_display_add_ddev(ds_display_t *, ds_ddev_t *);
-extern void ds_display_remove_ddev(ds_ddev_t *);
-extern ds_ddev_t *ds_display_first_ddev(ds_display_t *);
-extern ds_ddev_t *ds_display_next_ddev(ds_ddev_t *);
-extern void ds_display_add_idevcfg(ds_display_t *, ds_idevcfg_t *);
-extern void ds_display_remove_idevcfg(ds_idevcfg_t *);
-extern ds_idevcfg_t *ds_display_first_idevcfg(ds_display_t *);
-extern ds_idevcfg_t *ds_display_next_idevcfg(ds_idevcfg_t *);
-extern void ds_display_add_cursor(ds_display_t *, ds_cursor_t *);
-extern void ds_display_remove_cursor(ds_cursor_t *);
-extern void ds_display_update_max_rect(ds_display_t *);
-extern void ds_display_crop_max_rect(gfx_rect_t *, gfx_rect_t *);
-extern gfx_context_t *ds_display_get_gc(ds_display_t *);
-extern errno_t ds_display_paint_bg(ds_display_t *, gfx_rect_t *);
-extern errno_t ds_display_paint(ds_display_t *, gfx_rect_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/display/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup display display
- * @ingroup srvs
- * @brief Display server
- */
Index: pace/srv/hid/display/dsops.c
===================================================================
--- uspace/srv/hid/display/dsops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,389 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display ops implementation
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/log.h>
-#include "client.h"
-#include "display.h"
-#include "dsops.h"
-#include "seat.h"
-#include "window.h"
-
-static errno_t disp_window_create(void *, display_wnd_params_t *, sysarg_t *);
-static errno_t disp_window_destroy(void *, sysarg_t);
-static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *,
-    sysarg_t);
-static errno_t disp_window_move(void *, sysarg_t, gfx_coord2_t *);
-static errno_t disp_window_get_pos(void *, sysarg_t, gfx_coord2_t *);
-static errno_t disp_window_get_max_rect(void *, sysarg_t, gfx_rect_t *);
-static errno_t disp_window_resize_req(void *, sysarg_t,
-    display_wnd_rsztype_t, gfx_coord2_t *, sysarg_t);
-static errno_t disp_window_resize(void *, sysarg_t, gfx_coord2_t *,
-    gfx_rect_t *);
-static errno_t disp_window_minimize(void *, sysarg_t);
-static errno_t disp_window_maximize(void *, sysarg_t);
-static errno_t disp_window_unmaximize(void *, sysarg_t);
-static errno_t disp_window_set_cursor(void *, sysarg_t, display_stock_cursor_t);
-static errno_t disp_window_set_caption(void *, sysarg_t, const char *);
-static errno_t disp_get_event(void *, sysarg_t *, display_wnd_ev_t *);
-static errno_t disp_get_info(void *, display_info_t *);
-
-display_ops_t display_srv_ops = {
-	.window_create = disp_window_create,
-	.window_destroy = disp_window_destroy,
-	.window_move_req = disp_window_move_req,
-	.window_move = disp_window_move,
-	.window_get_pos = disp_window_get_pos,
-	.window_get_max_rect = disp_window_get_max_rect,
-	.window_resize_req = disp_window_resize_req,
-	.window_resize = disp_window_resize,
-	.window_minimize = disp_window_minimize,
-	.window_maximize = disp_window_maximize,
-	.window_unmaximize = disp_window_unmaximize,
-	.window_set_cursor = disp_window_set_cursor,
-	.window_set_caption = disp_window_set_caption,
-	.get_event = disp_get_event,
-	.get_info = disp_get_info
-};
-
-static errno_t disp_window_create(void *arg, display_wnd_params_t *params,
-    sysarg_t *rwnd_id)
-{
-	errno_t rc;
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_create()");
-
-	ds_display_lock(client->display);
-
-	rc = ds_window_create(client, params, &wnd);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_create() - ds_window_create -> %d", rc);
-	if (rc != EOK) {
-		ds_display_unlock(client->display);
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_create() -> EOK, id=%zu",
-	    wnd->id);
-
-	ds_display_unlock(client->display);
-
-	*rwnd_id = wnd->id;
-	return EOK;
-}
-
-static errno_t disp_window_destroy(void *arg, sysarg_t wnd_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_destroy()");
-	ds_window_destroy(wnd);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_move_req(void *arg, sysarg_t wnd_id,
-    gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_move_req()");
-	ds_window_move_req(wnd, pos, pos_id);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_move(void *arg, sysarg_t wnd_id, gfx_coord2_t *pos)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_move()");
-	ds_window_move(wnd, pos);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_get_pos(void *arg, sysarg_t wnd_id,
-    gfx_coord2_t *pos)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_get_pos()");
-	ds_window_get_pos(wnd, pos);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_get_max_rect(void *arg, sysarg_t wnd_id,
-    gfx_rect_t *rect)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_get_max_rect()");
-	ds_window_get_max_rect(wnd, rect);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_resize_req(void *arg, sysarg_t wnd_id,
-    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-
-	if (!display_wndrsz_valid(rsztype))
-		return EINVAL;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_resize_req()");
-	ds_window_resize_req(wnd, rsztype, pos, pos_id);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_window_resize(void *arg, sysarg_t wnd_id,
-    gfx_coord2_t *offs, gfx_rect_t *nbound)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_resize()");
-	rc = ds_window_resize(wnd, offs, nbound);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_window_minimize(void *arg, sysarg_t wnd_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_maximize()");
-	rc = ds_window_minimize(wnd);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_window_maximize(void *arg, sysarg_t wnd_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_maximize()");
-	rc = ds_window_maximize(wnd);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_window_unmaximize(void *arg, sysarg_t wnd_id)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_unmaximize()");
-	rc = ds_window_unmaximize(wnd);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_window_set_cursor(void *arg, sysarg_t wnd_id,
-    display_stock_cursor_t cursor)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_set_cursor()");
-	rc = ds_window_set_cursor(wnd, cursor);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_window_set_caption(void *arg, sysarg_t wnd_id,
-    const char *caption)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	ds_display_lock(client->display);
-
-	wnd = ds_client_find_window(client, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(client->display);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_set_caption()");
-	rc = ds_window_set_caption(wnd, caption);
-	ds_display_unlock(client->display);
-	return rc;
-}
-
-static errno_t disp_get_event(void *arg, sysarg_t *wnd_id,
-    display_wnd_ev_t *event)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-	ds_window_t *wnd;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "disp_window_get_event()");
-
-	ds_display_lock(client->display);
-
-	rc = ds_client_get_event(client, &wnd, event);
-	if (rc != EOK) {
-		ds_display_unlock(client->display);
-		return rc;
-	}
-
-	*wnd_id = wnd->id;
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-static errno_t disp_get_info(void *arg, display_info_t *info)
-{
-	ds_client_t *client = (ds_client_t *) arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_get_info()");
-
-	ds_display_lock(client->display);
-	ds_display_get_info(client->display, info);
-	ds_display_unlock(client->display);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/dsops.h
===================================================================
--- uspace/srv/hid/display/dsops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display ops implementation
- */
-
-#ifndef DSOPS_H
-#define DSOPS_H
-
-#include <disp_srv.h>
-
-extern display_ops_t display_srv_ops;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/idevcfg.c
===================================================================
--- uspace/srv/hid/display/idevcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server input device configuration
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "display.h"
-#include "idevcfg.h"
-#include "seat.h"
-
-/** Create input device configuration entry.
- *
- * @param display Parent display
- * @param svc_id Device service ID
- * @param seat Seat to which device is assigned
- * @param ridevcfg Place to store pointer to new input device configuration
- *                 entry
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_idevcfg_create(ds_display_t *display, service_id_t svc_id,
-    ds_seat_t *seat, ds_idevcfg_t **ridevcfg)
-{
-	ds_idevcfg_t *idevcfg;
-
-	idevcfg = calloc(1, sizeof(ds_idevcfg_t));
-	if (idevcfg == NULL)
-		return ENOMEM;
-
-	idevcfg->svc_id = svc_id;
-	ds_seat_add_idevcfg(seat, idevcfg);
-
-	ds_display_add_idevcfg(display, idevcfg);
-	*ridevcfg = idevcfg;
-	return EOK;
-}
-
-/** Destroy input device configuration entry.
- *
- * @param ddev Display device
- */
-void ds_idevcfg_destroy(ds_idevcfg_t *idevcfg)
-{
-	ds_display_remove_idevcfg(idevcfg);
-	ds_seat_remove_idevcfg(idevcfg);
-	free(idevcfg);
-}
-
-/** Load input device configuration entry from SIF node.
- *
- * @param display Display
- * @param enode Entry node from which the entry should be loaded
- * @param ridevcfg Place to store pointer to the newly loaded input device
- *                 configuration entry
- *
- * @return EOK on success or an error code
- */
-errno_t ds_idevcfg_load(ds_display_t *display, sif_node_t *enode,
-    ds_idevcfg_t **ridevcfg)
-{
-	const char *svc_name;
-	const char *sseat_id;
-	char *endptr;
-	service_id_t svc_id;
-	unsigned long seat_id;
-	ds_seat_t *seat;
-	ds_idevcfg_t *idevcfg;
-	errno_t rc;
-
-	svc_name = sif_node_get_attr(enode, "svc-name");
-	if (svc_name == NULL)
-		return EIO;
-
-	sseat_id = sif_node_get_attr(enode, "seat-id");
-	if (sseat_id == NULL)
-		return EIO;
-
-	rc = loc_service_get_id(svc_name, &svc_id, 0);
-	if (rc != EOK)
-		return rc;
-
-	seat_id = strtoul(sseat_id, &endptr, 10);
-	if (*endptr != '\0')
-		return EIO;
-
-	seat = ds_display_find_seat(display, seat_id);
-	if (seat == NULL)
-		return EIO;
-
-	rc = ds_idevcfg_create(display, svc_id, seat, &idevcfg);
-	if (rc != EOK)
-		return rc;
-
-	(void)idevcfg;
-	return EOK;
-}
-
-/** Save input device configuration entry to SIF node.
- *
- * @param idevcfg Input device configuration entry
- * @param enode Entry node to which the entry should be saved
- *
- * @return EOK on success or an error code
- */
-errno_t ds_idevcfg_save(ds_idevcfg_t *idevcfg, sif_node_t *enode)
-{
-	char *svc_name;
-	char *sseat_id;
-	errno_t rc;
-	int rv;
-
-	rc = loc_service_get_name(idevcfg->svc_id, &svc_name);
-	if (rc != EOK)
-		return rc;
-
-	rc = sif_node_set_attr(enode, "svc-name", svc_name);
-	if (rc != EOK) {
-		free(svc_name);
-		return rc;
-	}
-
-	free(svc_name);
-
-	rv = asprintf(&sseat_id, "%lu", (unsigned long)idevcfg->seat->id);
-	if (rv < 0) {
-		rc = ENOMEM;
-		return rc;
-	}
-
-	rc = sif_node_set_attr(enode, "seat-id", sseat_id);
-	if (rc != EOK) {
-		free(sseat_id);
-		return rc;
-	}
-
-	free(sseat_id);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/idevcfg.h
===================================================================
--- uspace/srv/hid/display/idevcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server input device configuration
- */
-
-#ifndef IDEVCFG_H
-#define IDEVCFG_H
-
-#include <errno.h>
-#include <loc.h>
-#include <sif.h>
-#include "types/display/display.h"
-#include "types/display/idevcfg.h"
-#include "types/display/seat.h"
-
-extern errno_t ds_idevcfg_create(ds_display_t *, service_id_t, ds_seat_t *,
-    ds_idevcfg_t **);
-extern void ds_idevcfg_destroy(ds_idevcfg_t *);
-extern errno_t ds_idevcfg_load(ds_display_t *, sif_node_t *, ds_idevcfg_t **);
-extern errno_t ds_idevcfg_save(ds_idevcfg_t *, sif_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/ievent.c
===================================================================
--- uspace/srv/hid/display/ievent.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,214 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/** @file Input event queue
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/kbd_event.h>
-#include <stdlib.h>
-#include "display.h"
-#include "ievent.h"
-
-/** Post keyboard event to input event queue.
- *
- * @param disp Display
- * @param kbd Keyboard event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_ievent_post_kbd(ds_display_t *disp, kbd_event_t *kbd)
-{
-	ds_ievent_t *ievent;
-
-	ievent = calloc(1, sizeof(ds_ievent_t));
-	if (ievent == NULL)
-		return ENOMEM;
-
-	ievent->display = disp;
-	ievent->etype = det_kbd;
-	ievent->ev.kbd = *kbd;
-
-	list_append(&ievent->lievents, &disp->ievents);
-	fibril_condvar_signal(&disp->ievent_cv);
-
-	return EOK;
-}
-
-/** Post pointing device event to input event queue.
- *
- * @param disp Display
- * @param kbd Keyboard event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_ievent_post_ptd(ds_display_t *disp, ptd_event_t *ptd)
-{
-	ds_ievent_t *ievent;
-	ds_ievent_t *prev;
-	link_t *link;
-
-	ievent = calloc(1, sizeof(ds_ievent_t));
-	if (ievent == NULL)
-		return ENOMEM;
-
-	link = list_last(&disp->ievents);
-	if (link != NULL) {
-		prev = list_get_instance(link, ds_ievent_t, lievents);
-		if (prev->etype == det_ptd && prev->ev.ptd.pos_id ==
-		    ptd->pos_id) {
-			/*
-			 * Previous event is also a pointing device event
-			 * and it is from the same device.
-			 */
-			if (prev->ev.ptd.type == PTD_MOVE &&
-			    ptd->type == PTD_MOVE) {
-				/* Both events are relative move events */
-				gfx_coord2_add(&ptd->dmove, &prev->ev.ptd.dmove,
-				    &prev->ev.ptd.dmove);
-				return EOK;
-			} else if (prev->ev.ptd.type == PTD_ABS_MOVE &&
-			    ptd->type == PTD_ABS_MOVE) {
-				/* Both events are absolute move events */
-				prev->ev.ptd.apos = ptd->apos;
-				prev->ev.ptd.abounds = ptd->abounds;
-				return EOK;
-			}
-		}
-	}
-
-	ievent->display = disp;
-	ievent->etype = det_ptd;
-	ievent->ev.ptd = *ptd;
-
-	list_append(&ievent->lievents, &disp->ievents);
-	fibril_condvar_signal(&disp->ievent_cv);
-
-	return EOK;
-}
-
-/** Input event processing fibril.
- *
- * @param arg Argument (ds_display_t *)
- * @return EOK success
- */
-static errno_t ds_ievent_fibril(void *arg)
-{
-	ds_display_t *disp = (ds_display_t *)arg;
-	ds_ievent_t *ievent;
-	link_t *link;
-
-	fibril_mutex_lock(&disp->lock);
-
-	while (!disp->ievent_quit) {
-		while (list_empty(&disp->ievents))
-			fibril_condvar_wait(&disp->ievent_cv, &disp->lock);
-
-		link = list_first(&disp->ievents);
-		assert(link != NULL);
-		list_remove(link);
-		ievent = list_get_instance(link, ds_ievent_t, lievents);
-
-		switch (ievent->etype) {
-		case det_kbd:
-			(void)ds_display_post_kbd_event(disp, &ievent->ev.kbd);
-			break;
-		case det_ptd:
-			(void)ds_display_post_ptd_event(disp, &ievent->ev.ptd);
-			break;
-		}
-	}
-
-	/* Signal to ds_ievent_fini() that the event processing fibril quit */
-	disp->ievent_done = true;
-	fibril_condvar_signal(&disp->ievent_cv);
-	fibril_mutex_unlock(&disp->lock);
-
-	return EOK;
-}
-
-/** Initialize input event processing.
- *
- * @param disp Display
- * @return EOK on success or an error code
- */
-errno_t ds_ievent_init(ds_display_t *disp)
-{
-	assert(disp->ievent_fid == 0);
-
-	disp->ievent_fid = fibril_create(ds_ievent_fibril, (void *)disp);
-	if (disp->ievent_fid == 0)
-		return ENOMEM;
-
-	fibril_add_ready(disp->ievent_fid);
-	return EOK;
-}
-
-/** Deinitialize input event processing.
- *
- * @param disp Display
- */
-void ds_ievent_fini(ds_display_t *disp)
-{
-	ds_ievent_t *ievent;
-	link_t *link;
-
-	if (disp->ievent_fid == 0)
-		return;
-
-	/* Signal event processing fibril to quit. */
-	fibril_mutex_lock(&disp->lock);
-	disp->ievent_quit = true;
-	fibril_condvar_signal(&disp->ievent_cv);
-
-	/* Wait for event processing fibril to quit. */
-	while (!disp->ievent_done)
-		fibril_condvar_wait(&disp->ievent_cv, &disp->lock);
-
-	/* Remove all events from the queue. */
-	while (!list_empty(&disp->ievents)) {
-		link = list_first(&disp->ievents);
-		assert(link != NULL);
-		list_remove(link);
-		ievent = list_get_instance(link, ds_ievent_t, lievents);
-		free(ievent);
-	}
-
-	fibril_mutex_unlock(&disp->lock);
-
-	fibril_detach(disp->ievent_fid);
-	disp->ievent_fid = 0;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/ievent.h
===================================================================
--- uspace/srv/hid/display/ievent.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/** @file Input event queue
- */
-
-#ifndef IEVENT_H
-#define IEVENT_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include "types/display/display.h"
-#include "types/display/ievent.h"
-
-extern errno_t ds_ievent_post_kbd(ds_display_t *, kbd_event_t *);
-extern errno_t ds_ievent_post_ptd(ds_display_t *, ptd_event_t *);
-extern errno_t ds_ievent_init(ds_display_t *);
-extern void ds_ievent_fini(ds_display_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/input.c
===================================================================
--- uspace/srv/hid/display/input.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/** @file Input events
- */
-
-#include <errno.h>
-#include <inttypes.h>
-#include <io/input.h>
-#include <io/log.h>
-#include <loc.h>
-#include <str_error.h>
-#include "display.h"
-#include "ievent.h"
-#include "input.h"
-#include "main.h"
-
-static errno_t ds_input_ev_active(input_t *);
-static errno_t ds_input_ev_deactive(input_t *);
-static errno_t ds_input_ev_key(input_t *, unsigned, kbd_event_type_t, keycode_t,
-    keymod_t, char32_t);
-static errno_t ds_input_ev_move(input_t *, unsigned, int, int);
-static errno_t ds_input_ev_abs_move(input_t *, unsigned, unsigned, unsigned,
-    unsigned, unsigned);
-static errno_t ds_input_ev_button(input_t *, unsigned, int, int);
-static errno_t ds_input_ev_dclick(input_t *, unsigned, int);
-
-static input_ev_ops_t ds_input_ev_ops = {
-	.active = ds_input_ev_active,
-	.deactive = ds_input_ev_deactive,
-	.key = ds_input_ev_key,
-	.move = ds_input_ev_move,
-	.abs_move = ds_input_ev_abs_move,
-	.button = ds_input_ev_button,
-	.dclick = ds_input_ev_dclick
-};
-
-static errno_t ds_input_ev_active(input_t *input)
-{
-	return EOK;
-}
-
-static errno_t ds_input_ev_deactive(input_t *input)
-{
-	return EOK;
-}
-
-static errno_t ds_input_ev_key(input_t *input, unsigned kbd_id,
-    kbd_event_type_t type, keycode_t key, keymod_t mods, char32_t c)
-{
-	ds_display_t *disp = (ds_display_t *) input->user;
-	kbd_event_t event;
-	errno_t rc;
-
-	event.kbd_id = kbd_id;
-	event.type = type;
-	event.key = key;
-	event.mods = mods;
-	event.c = c;
-
-	ds_display_lock(disp);
-	rc = ds_ievent_post_kbd(disp, &event);
-	ds_display_unlock(disp);
-	return rc;
-}
-
-static errno_t ds_input_ev_move(input_t *input, unsigned pos_id, int dx, int dy)
-{
-	ds_display_t *disp = (ds_display_t *) input->user;
-	ptd_event_t event;
-	errno_t rc;
-
-	event.pos_id = pos_id;
-	event.type = PTD_MOVE;
-	event.dmove.x = dx;
-	event.dmove.y = dy;
-
-	ds_display_lock(disp);
-	rc = ds_ievent_post_ptd(disp, &event);
-	ds_display_unlock(disp);
-	return rc;
-}
-
-static errno_t ds_input_ev_abs_move(input_t *input, unsigned pos_id, unsigned x,
-    unsigned y, unsigned max_x, unsigned max_y)
-{
-	ds_display_t *disp = (ds_display_t *) input->user;
-	ptd_event_t event;
-	errno_t rc;
-
-	event.pos_id = pos_id;
-	event.type = PTD_ABS_MOVE;
-	event.apos.x = x;
-	event.apos.y = y;
-	event.abounds.p0.x = 0;
-	event.abounds.p0.y = 0;
-	event.abounds.p1.x = max_x + 1;
-	event.abounds.p1.y = max_y + 1;
-
-	ds_display_lock(disp);
-	rc = ds_ievent_post_ptd(disp, &event);
-	ds_display_unlock(disp);
-	return rc;
-}
-
-static errno_t ds_input_ev_button(input_t *input, unsigned pos_id, int bnum,
-    int bpress)
-{
-	ds_display_t *disp = (ds_display_t *) input->user;
-	ptd_event_t event;
-	errno_t rc;
-
-	event.pos_id = pos_id;
-	event.type = bpress ? PTD_PRESS : PTD_RELEASE;
-	event.btn_num = bnum;
-	event.dmove.x = 0;
-	event.dmove.y = 0;
-
-	ds_display_lock(disp);
-	rc = ds_ievent_post_ptd(disp, &event);
-	ds_display_unlock(disp);
-	return rc;
-}
-
-static errno_t ds_input_ev_dclick(input_t *input, unsigned pos_id, int bnum)
-{
-	ds_display_t *disp = (ds_display_t *) input->user;
-	ptd_event_t event;
-	errno_t rc;
-
-	event.pos_id = pos_id;
-	event.type = PTD_DCLICK;
-	event.btn_num = bnum;
-	event.dmove.x = 0;
-	event.dmove.y = 0;
-
-	ds_display_lock(disp);
-	rc = ds_ievent_post_ptd(disp, &event);
-	ds_display_unlock(disp);
-	return rc;
-}
-
-/** Open input service.
- *
- * @param display Display
- * @return EOK on success or an error code
- */
-errno_t ds_input_open(ds_display_t *display)
-{
-	async_sess_t *sess;
-	service_id_t dsid;
-	const char *svc = "hid/input";
-
-	errno_t rc = loc_service_get_id(svc, &dsid, 0);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Input service %s not found",
-		    svc);
-		return rc;
-	}
-
-	sess = loc_service_connect(dsid, INTERFACE_INPUT, 0);
-	if (sess == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Unable to connect to input service %s", svc);
-		return EIO;
-	}
-
-	rc = input_open(sess, &ds_input_ev_ops, (void *) display,
-	    &display->input);
-	if (rc != EOK) {
-		async_hangup(sess);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Unable to communicate with service %s (%s)",
-		    svc, str_error(rc));
-		return rc;
-	}
-
-	input_activate(display->input);
-	return EOK;
-}
-
-void ds_input_close(ds_display_t *display)
-{
-	input_close(display->input);
-	display->input = NULL;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/input.h
===================================================================
--- uspace/srv/hid/display/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/** @file Input events
- */
-
-#ifndef INPUT_H
-#define INPUT_H
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include "types/display/display.h"
-
-extern errno_t ds_input_open(ds_display_t *);
-extern void ds_input_close(ds_display_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/main.c
===================================================================
--- uspace/srv/hid/display/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,383 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistribution1s of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server main
- */
-
-#include <async.h>
-#include <disp_srv.h>
-#include <dispcfg_srv.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <ipc/services.h>
-#include <ipcgfx/server.h>
-#include <loc.h>
-#include <stdio.h>
-#include <task.h>
-#include <wndmgt_srv.h>
-#include "cfgclient.h"
-#include "cfgops.h"
-#include "client.h"
-#include "display.h"
-#include "dsops.h"
-#include "ievent.h"
-#include "input.h"
-#include "main.h"
-#include "output.h"
-#include "seat.h"
-#include "window.h"
-#include "wmclient.h"
-#include "wmops.h"
-
-const char *cfg_file_path = "/w/cfg/display.sif";
-
-static void display_client_conn(ipc_call_t *, void *);
-static void display_client_ev_pending(void *);
-static void display_wmclient_ev_pending(void *);
-static void display_cfgclient_ev_pending(void *);
-static void display_gc_conn(ipc_call_t *, void *);
-static void display_wndmgt_conn(ipc_call_t *, void *);
-static void display_dispcfg_conn(ipc_call_t *, void *);
-
-#ifdef CONFIG_DISP_DOUBLE_BUF
-/*
- * Double buffering is one way to provide flicker-free display.
- */
-static ds_display_flags_t disp_flags = df_disp_double_buf;
-#else
-/*
- * With double buffering disabled, wet screen flicker since front-to-back
- * rendering is not implemented.
- */
-static ds_display_flags_t disp_flags = df_none;
-#endif
-
-static ds_client_cb_t display_client_cb = {
-	.ev_pending = display_client_ev_pending
-};
-
-static ds_wmclient_cb_t display_wmclient_cb = {
-	.ev_pending = display_wmclient_ev_pending
-};
-
-static ds_cfgclient_cb_t display_cfgclient_cb = {
-	.ev_pending = display_cfgclient_ev_pending
-};
-
-static void display_client_ev_pending(void *arg)
-{
-	display_srv_t *srv = (display_srv_t *) arg;
-
-	display_srv_ev_pending(srv);
-}
-
-static void display_wmclient_ev_pending(void *arg)
-{
-	wndmgt_srv_t *srv = (wndmgt_srv_t *) arg;
-
-	wndmgt_srv_ev_pending(srv);
-}
-
-static void display_cfgclient_ev_pending(void *arg)
-{
-	dispcfg_srv_t *srv = (dispcfg_srv_t *) arg;
-
-	dispcfg_srv_ev_pending(srv);
-}
-
-/** Initialize display server */
-static errno_t display_srv_init(ds_output_t **routput)
-{
-	ds_display_t *disp = NULL;
-	ds_seat_t *seat = NULL;
-	ds_output_t *output = NULL;
-	gfx_context_t *gc = NULL;
-	port_id_t disp_port;
-	port_id_t gc_port;
-	port_id_t wm_port;
-	port_id_t dc_port;
-	loc_srv_t *srv = NULL;
-	service_id_t sid = 0;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "display_srv_init()");
-
-	rc = ds_display_create(NULL, disp_flags, &disp);
-	if (rc != EOK)
-		goto error;
-
-	rc = ds_display_load_cfg(disp, cfg_file_path);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE,
-		    "Starting with fresh configuration.");
-
-		/* Create first seat */
-		rc = ds_seat_create(disp, "Alice", &seat);
-		if (rc != EOK)
-			goto error;
-	}
-
-	rc = ds_output_create(&output);
-	if (rc != EOK)
-		goto error;
-
-	output->def_display = disp;
-	rc = ds_output_start_discovery(output);
-	if (rc != EOK)
-		goto error;
-
-	rc = ds_ievent_init(disp);
-	if (rc != EOK)
-		goto error;
-
-	rc = ds_input_open(disp);
-	if (rc != EOK)
-		goto error;
-
-	rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp,
-	    &disp_port);
-	if (rc != EOK)
-		goto error;
-
-	rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port);
-	if (rc != EOK)
-		goto error;
-
-	rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp,
-	    &wm_port);
-	if (rc != EOK)
-		goto error;
-
-	rc = async_create_port(INTERFACE_DISPCFG, display_dispcfg_conn, disp,
-	    &dc_port);
-	if (rc != EOK)
-		goto error;
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		rc = EEXIST;
-		goto error;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_DISPLAY, &sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		rc = EEXIST;
-		goto error;
-	}
-
-	*routput = output;
-	return EOK;
-error:
-	if (sid != 0)
-		loc_service_unregister(srv, sid);
-	if (srv != NULL)
-		loc_server_unregister(srv);
-	// XXX destroy disp_port
-	// XXX destroy gc_port
-	// XXX destroy wm_port
-	// XXX destroy dc_port
-#if 0
-	if (disp->input != NULL)
-		ds_input_close(disp);
-#endif
-	ds_ievent_fini(disp);
-	if (output != NULL)
-		ds_output_destroy(output);
-	if (gc != NULL)
-		gfx_context_delete(gc);
-	if (seat != NULL)
-		ds_seat_destroy(seat);
-	if (disp != NULL)
-		ds_display_destroy(disp);
-	return rc;
-}
-
-/** Handle client connection to display server */
-static void display_client_conn(ipc_call_t *icall, void *arg)
-{
-	display_srv_t srv;
-	sysarg_t svc_id;
-	ds_client_t *client = NULL;
-	ds_display_t *disp = (ds_display_t *) arg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "display_client_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.",
-	    ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall),
-	    ipc_get_arg4(icall));
-
-	svc_id = ipc_get_arg2(icall);
-
-	if (svc_id != 0) {
-		/* Create client object */
-		ds_display_lock(disp);
-		rc = ds_client_create(disp, &display_client_cb, &srv, &client);
-		ds_display_unlock(disp);
-		if (rc != EOK) {
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		/* Set up protocol structure */
-		display_srv_initialize(&srv);
-		srv.ops = &display_srv_ops;
-		srv.arg = client;
-
-		/* Handle connection */
-		display_conn(icall, &srv);
-
-		ds_display_lock(disp);
-		ds_client_destroy(client);
-		ds_display_unlock(disp);
-	}
-}
-
-/** Handle GC connection to display server */
-static void display_gc_conn(ipc_call_t *icall, void *arg)
-{
-	sysarg_t wnd_id;
-	ds_window_t *wnd;
-	ds_display_t *disp = (ds_display_t *) arg;
-	gfx_context_t *gc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "display_gc_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.",
-	    ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall),
-	    ipc_get_arg4(icall));
-
-	wnd_id = ipc_get_arg3(icall);
-
-	/* Window GC connection */
-
-	wnd = ds_display_find_window(disp, wnd_id);
-	if (wnd == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	/*
-	 * XXX We need a way to make sure that the connection does
-	 * not stay active after the window had been destroyed
-	 */
-	gc = ds_window_get_ctx(wnd);
-	gc_conn(icall, gc);
-}
-
-/** Handle window management connection to display server */
-static void display_wndmgt_conn(ipc_call_t *icall, void *arg)
-{
-	ds_display_t *disp = (ds_display_t *) arg;
-	errno_t rc;
-	wndmgt_srv_t srv;
-	ds_wmclient_t *wmclient = NULL;
-
-	/* Create WM client object */
-	ds_display_lock(disp);
-	rc = ds_wmclient_create(disp, &display_wmclient_cb, &srv, &wmclient);
-	ds_display_unlock(disp);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	/* Set up protocol structure */
-	wndmgt_srv_initialize(&srv);
-	srv.ops = &wndmgt_srv_ops;
-	srv.arg = wmclient;
-
-	/* Handle connection */
-	wndmgt_conn(icall, &srv);
-
-	ds_display_lock(disp);
-	ds_wmclient_destroy(wmclient);
-	ds_display_unlock(disp);
-}
-
-/** Handle configuration connection to display server */
-static void display_dispcfg_conn(ipc_call_t *icall, void *arg)
-{
-	ds_display_t *disp = (ds_display_t *) arg;
-	errno_t rc;
-	dispcfg_srv_t srv;
-	ds_cfgclient_t *cfgclient = NULL;
-
-	/* Create CFG client object */
-	ds_display_lock(disp);
-	rc = ds_cfgclient_create(disp, &display_cfgclient_cb, &srv, &cfgclient);
-	ds_display_unlock(disp);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	/* Set up protocol structure */
-	dispcfg_srv_initialize(&srv);
-	srv.ops = &dispcfg_srv_ops;
-	srv.arg = cfgclient;
-
-	/* Handle connection */
-	dispcfg_conn(icall, &srv);
-
-	ds_display_lock(disp);
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_unlock(disp);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	ds_output_t *output;
-
-	printf("%s: Display server\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = display_srv_init(&output);
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/main.h
===================================================================
--- uspace/srv/hid/display/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/** @file Display server main
- */
-
-#ifndef MAIN_H
-#define MAIN_H
-
-#define NAME "display"
-
-extern const char *cfg_file_path;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/meson.build
===================================================================
--- uspace/srv/hid/display/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,76 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ipcgfx', 'memgfx', 'display', 'ddev', 'dispcfg', 'wndmgt', 'input',
-    'sif' ]
-
-src = files(
-	'cfgclient.c',
-	'cfgops.c',
-	'client.c',
-	'clonegc.c',
-	'cursor.c',
-	'cursimg.c',
-	'ddev.c',
-	'display.c',
-	'dsops.c',
-	'idevcfg.c',
-	'ievent.c',
-	'input.c',
-	'main.c',
-	'output.c',
-	'seat.c',
-	'window.c',
-	'wmclient.c',
-	'wmops.c',
-)
-
-test_src = files(
-	'cfgclient.c',
-	'client.c',
-	'clonegc.c',
-	'cursimg.c',
-	'cursor.c',
-	'ddev.c',
-	'display.c',
-	'idevcfg.c',
-	'ievent.c',
-	'seat.c',
-	'window.c',
-	'wmclient.c',
-	'test/cfgclient.c',
-	'test/client.c',
-	'test/clonegc.c',
-	'test/cursor.c',
-	'test/display.c',
-	'test/ievent.c',
-	'test/main.c',
-	'test/seat.c',
-	'test/window.c',
-	'test/wmclient.c',
-)
Index: pace/srv/hid/display/output.c
===================================================================
--- uspace/srv/hid/display/output.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server output
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/kbd_event.h>
-#include <io/log.h>
-#include <io/pos_event.h>
-#include <loc.h>
-#include <stdlib.h>
-#include "ddev.h"
-#include "output.h"
-
-/** Check for new display devices.
- *
- * @param output Display server output
- */
-static errno_t ds_output_check_new_devs(ds_output_t *output)
-{
-	category_id_t ddev_cid;
-	service_id_t *svcs;
-	size_t count, i;
-	bool already_known;
-	ds_ddev_t *nddev;
-	errno_t rc;
-
-	assert(fibril_mutex_is_locked(&output->lock));
-
-	rc = loc_category_get_id("display-device", &ddev_cid,
-	    IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error looking up category 'display-device'.");
-		return EIO;
-	}
-
-	/*
-	 * Check for new dispay devices
-	 */
-	rc = loc_category_get_svcs(ddev_cid, &svcs, &count);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error getting list of display devices.");
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		/* Determine whether we already know this device. */
-		list_foreach(output->ddevs, loutdevs, ds_ddev_t, ddev) {
-			if (ddev->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			rc = ds_ddev_open(output->def_display, svcs[i], &nddev);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR,
-				    "Error adding display device.");
-				continue;
-			}
-
-			list_append(&nddev->loutdevs, &output->ddevs);
-
-			log_msg(LOG_DEFAULT, LVL_NOTE,
-			    "Added display device '%lu'",
-			    (unsigned long) svcs[i]);
-		}
-	}
-
-	free(svcs);
-
-	return EOK;
-}
-
-/** Display device category change callback.
- *
- * @param arg Display server output (cast to void *)
- */
-static void ds_ddev_change_cb(void *arg)
-{
-	ds_output_t *output = (ds_output_t *) arg;
-
-	fibril_mutex_lock(&output->lock);
-	(void) ds_output_check_new_devs(output);
-	fibril_mutex_unlock(&output->lock);
-}
-
-/** Create display server output.
- *
- * @param routput Place to store pointer to display server output object.
- * @return EOK on success or an error code
- */
-errno_t ds_output_create(ds_output_t **routput)
-{
-	ds_output_t *output;
-
-	output = calloc(1, sizeof(ds_output_t));
-	if (output == NULL)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&output->lock);
-	list_initialize(&output->ddevs);
-
-	*routput = output;
-	return EOK;
-}
-
-/** Start display device discovery.
- *
- * @param output Display server output
- * @return EOK on success or an error code
- */
-errno_t ds_output_start_discovery(ds_output_t *output)
-{
-	errno_t rc;
-
-	rc = loc_register_cat_change_cb(ds_ddev_change_cb, output);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed registering callback for device discovery.");
-		return rc;
-	}
-
-	fibril_mutex_lock(&output->lock);
-	rc = ds_output_check_new_devs(output);
-	fibril_mutex_unlock(&output->lock);
-
-	/* Fail if we did not open at least one device */
-	if (list_empty(&output->ddevs)) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "No output device found.");
-		return ENOENT;
-	}
-
-	return rc;
-}
-
-/** Destroy display server output.
- *
- * @param output Display server output
- */
-void ds_output_destroy(ds_output_t *output)
-{
-	free(output);
-}
-
-/** @}
- */
Index: pace/srv/hid/display/output.h
===================================================================
--- uspace/srv/hid/display/output.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server output
- */
-
-#ifndef OUTPUT_H
-#define OUTPUT_H
-
-#include <gfx/context.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include "types/display/output.h"
-
-extern errno_t ds_output_create(ds_output_t **);
-extern errno_t ds_output_start_discovery(ds_output_t *);
-extern void ds_output_destroy(ds_output_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/seat.c
===================================================================
--- uspace/srv/hid/display/seat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,699 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server seat
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/render.h>
-#include <sif.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "client.h"
-#include "cursor.h"
-#include "display.h"
-#include "idevcfg.h"
-#include "seat.h"
-#include "window.h"
-
-static void ds_seat_get_pointer_rect(ds_seat_t *, gfx_rect_t *);
-static errno_t ds_seat_repaint_pointer(ds_seat_t *, gfx_rect_t *);
-
-/** Create seat.
- *
- * @param display Parent display
- * @param name Seat name
- * @param rseat Place to store pointer to new seat.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_seat_create(ds_display_t *display, const char *name,
-    ds_seat_t **rseat)
-{
-	ds_seat_t *seat;
-	ds_seat_t *s0;
-
-	s0 = ds_display_first_seat(display);
-	while (s0 != NULL) {
-		if (str_cmp(s0->name, name) == 0)
-			return EEXIST;
-		s0 = ds_display_next_seat(s0);
-	}
-
-	seat = calloc(1, sizeof(ds_seat_t));
-	if (seat == NULL)
-		return ENOMEM;
-
-	seat->name = str_dup(name);
-	if (seat->name == NULL) {
-		free(seat);
-		return ENOMEM;
-	}
-
-	list_initialize(&seat->idevcfgs);
-
-	ds_display_add_seat(display, seat);
-	seat->pntpos.x = 0;
-	seat->pntpos.y = 0;
-
-	seat->client_cursor = display->cursor[dcurs_arrow];
-	seat->wm_cursor = NULL;
-	seat->focus = ds_display_first_window(display);
-
-	*rseat = seat;
-	return EOK;
-}
-
-/** Destroy seat.
- *
- * @param seat Seat
- */
-void ds_seat_destroy(ds_seat_t *seat)
-{
-	ds_idevcfg_t *idevcfg;
-
-	/* Remove all input device configuration entries pointing to this seat */
-	idevcfg = ds_seat_first_idevcfg(seat);
-	while (idevcfg != NULL) {
-		ds_idevcfg_destroy(idevcfg);
-		idevcfg = ds_seat_first_idevcfg(seat);
-	}
-
-	/* Remove this seat's focus */
-	if (seat->focus != NULL)
-		ds_window_post_unfocus_event(seat->focus);
-
-	ds_display_remove_seat(seat);
-
-	free(seat->name);
-	free(seat);
-}
-
-/** Load seat from SIF node.
- *
- * @param display Display
- * @param snode Seat node from which to load the seat
- * @param rseat Place to store pointer to the newly loaded seat
- *
- * @return EOK on success or an error code
- */
-errno_t ds_seat_load(ds_display_t *display, sif_node_t *snode,
-    ds_seat_t **rseat)
-{
-	const char *sid;
-	const char *name;
-	char *endptr;
-	unsigned long id;
-	errno_t rc;
-
-	sid = sif_node_get_attr(snode, "id");
-	if (sid == NULL)
-		return EIO;
-
-	name = sif_node_get_attr(snode, "name");
-	if (name == NULL)
-		return EIO;
-
-	id = strtoul(sid, &endptr, 10);
-	if (*endptr != '\0')
-		return EIO;
-
-	rc = ds_seat_create(display, name, rseat);
-	if (rc != EOK)
-		return EIO;
-
-	(*rseat)->id = id;
-	return EOK;
-}
-
-/** Save seat to SIF node.
- *
- * @param seat Seat
- * @param snode Seat node into which the seat should be saved
- *
- * @return EOK on success or an error code
- */
-errno_t ds_seat_save(ds_seat_t *seat, sif_node_t *snode)
-{
-	char *sid;
-	errno_t rc;
-	int rv;
-
-	rv = asprintf(&sid, "%lu", (unsigned long)seat->id);
-	if (rv < 0) {
-		rc = ENOMEM;
-		return rc;
-	}
-
-	rc = sif_node_set_attr(snode, "id", sid);
-	if (rc != EOK) {
-		free(sid);
-		return rc;
-	}
-
-	free(sid);
-
-	rc = sif_node_set_attr(snode, "name", seat->name);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Set seat focus to a window.
- *
- * @param seat Seat
- * @param wnd Window to focus
- */
-void ds_seat_set_focus(ds_seat_t *seat, ds_window_t *wnd)
-{
-	errno_t rc;
-
-	if (wnd == seat->focus) {
-		/* Focus is not changing */
-		return;
-	}
-
-	if (wnd != NULL) {
-		rc = ds_window_unminimize(wnd);
-		if (rc != EOK)
-			return;
-	}
-
-	if (seat->focus != NULL)
-		ds_window_post_unfocus_event(seat->focus);
-
-	seat->focus = wnd;
-
-	if (wnd != NULL) {
-		ds_window_post_focus_event(wnd);
-		ds_window_bring_to_top(wnd);
-	}
-
-	/* When focus changes, popup window should be closed */
-	ds_seat_set_popup(seat, NULL);
-}
-
-/** Set seat popup window.
- *
- * @param seat Seat
- * @param wnd Popup window
- */
-void ds_seat_set_popup(ds_seat_t *seat, ds_window_t *wnd)
-{
-	if (wnd == seat->popup)
-		return;
-
-	if (seat->popup != NULL) {
-		/* Window is no longer the popup window, send close request */
-		ds_client_post_close_event(seat->popup->client,
-		    seat->popup);
-	}
-
-	seat->popup = wnd;
-}
-
-/** Evacuate seat references to window.
- *
- * If seat's focus is @a wnd, it will be set to NULL.
- * If seat's popup window is @a wnd, it will be set to NULL.
- *
- * @param seat Seat
- * @param wnd Window to evacuate references from
- */
-void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd)
-{
-	if (seat->focus == wnd)
-		ds_seat_set_focus(seat, NULL);
-
-	if (seat->popup == wnd)
-		ds_seat_set_popup(seat, NULL);
-}
-
-/** Unfocus window.
- *
- * If seat's focus is @a wnd, it will be set to a different window
- * that is not minimized, preferably not a system window.
- *
- * @param seat Seat
- * @param wnd Window to remove focus from
- */
-void ds_seat_unfocus_wnd(ds_seat_t *seat, ds_window_t *wnd)
-{
-	ds_window_t *nwnd;
-
-	if (seat->focus != wnd)
-		return;
-
-	/* Find alternate window that is neither system nor minimized */
-	nwnd = ds_window_find_prev(wnd, ~(wndf_minimized | wndf_system));
-
-	if (nwnd == NULL) {
-		/* Find alternate window that is not minimized */
-		nwnd = ds_window_find_prev(wnd, ~wndf_minimized);
-	}
-
-	ds_seat_set_focus(seat, nwnd);
-}
-
-/** Switch focus to another window.
- *
- * @param seat Seat
- * @param wnd Window to evacuate focus from
- */
-void ds_seat_switch_focus(ds_seat_t *seat)
-{
-	ds_window_t *nwnd;
-
-	if (seat->focus != NULL) {
-		/* Find alternate window that is not a system window */
-		nwnd = ds_window_find_next(seat->focus, ~wndf_system);
-	} else {
-		/* Currently no focus. Focus topmost window. */
-		nwnd = ds_display_first_window(seat->display);
-	}
-
-	/* Only switch focus if there is another window */
-	if (nwnd != NULL)
-		ds_seat_set_focus(seat, nwnd);
-}
-
-/** Post keyboard event to the seat's focused window.
- *
- * @param seat Seat
- * @param event Event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_seat_post_kbd_event(ds_seat_t *seat, kbd_event_t *event)
-{
-	ds_window_t *dwindow;
-	bool alt_or_shift;
-
-	alt_or_shift = event->mods & (KM_SHIFT | KM_ALT);
-	if (event->type == KEY_PRESS && alt_or_shift && event->key == KC_TAB) {
-		/* On Alt-Tab or Shift-Tab, switch focus to next window */
-		ds_seat_switch_focus(seat);
-		return EOK;
-	}
-
-	dwindow = seat->popup;
-	if (dwindow == NULL)
-		dwindow = seat->focus;
-
-	if (dwindow == NULL)
-		return EOK;
-
-	return ds_window_post_kbd_event(dwindow, event);
-}
-
-/** Get current cursor used by seat.
- *
- * @param wmcurs WM curor
- * @param ccurs Client cursor
- * @return
- */
-static ds_cursor_t *ds_seat_compute_cursor(ds_cursor_t *wmcurs, ds_cursor_t *ccurs)
-{
-	if (wmcurs != NULL)
-		return wmcurs;
-
-	return ccurs;
-}
-
-/** Get current cursor used by seat.
- *
- * @param seat Seat
- * @return Current cursor
- */
-static ds_cursor_t *ds_seat_get_cursor(ds_seat_t *seat)
-{
-	return ds_seat_compute_cursor(seat->wm_cursor, seat->client_cursor);
-}
-
-/** Set client cursor.
- *
- * Set cursor selected by client. This may update the actual cursor
- * if WM is not overriding the cursor.
- *
- * @param seat Seat
- * @param cursor Client cursor
- */
-static void ds_seat_set_client_cursor(ds_seat_t *seat, ds_cursor_t *cursor)
-{
-	ds_cursor_t *old_cursor;
-	ds_cursor_t *new_cursor;
-	gfx_rect_t old_rect;
-
-	old_cursor = ds_seat_get_cursor(seat);
-	new_cursor = ds_seat_compute_cursor(seat->wm_cursor, cursor);
-
-	if (new_cursor != old_cursor) {
-		ds_seat_get_pointer_rect(seat, &old_rect);
-		seat->client_cursor = cursor;
-		ds_seat_repaint_pointer(seat, &old_rect);
-	} else {
-		seat->client_cursor = cursor;
-	}
-}
-
-/** Set WM cursor.
- *
- * Set cursor override for window management.
- *
- * @param seat Seat
- * @param cursor WM cursor override or @c NULL not to override the cursor
- */
-void ds_seat_set_wm_cursor(ds_seat_t *seat, ds_cursor_t *cursor)
-{
-	ds_cursor_t *old_cursor;
-	ds_cursor_t *new_cursor;
-	gfx_rect_t old_rect;
-
-	old_cursor = ds_seat_get_cursor(seat);
-	new_cursor = ds_seat_compute_cursor(cursor, seat->client_cursor);
-
-	if (new_cursor != old_cursor) {
-		ds_seat_get_pointer_rect(seat, &old_rect);
-		seat->wm_cursor = cursor;
-		ds_seat_repaint_pointer(seat, &old_rect);
-	} else {
-		seat->wm_cursor = cursor;
-	}
-}
-
-/** Get rectangle covered by pointer.
- *
- * @param seat Seat
- * @param rect Place to store rectangle
- */
-void ds_seat_get_pointer_rect(ds_seat_t *seat, gfx_rect_t *rect)
-{
-	ds_cursor_t *cursor;
-
-	cursor = ds_seat_get_cursor(seat);
-	ds_cursor_get_rect(cursor, &seat->pntpos, rect);
-}
-
-/** Repaint seat pointer
- *
- * Repaint the pointer after it has moved or changed. This is done by
- * repainting the area of the display previously (@a old_rect) and currently
- * covered by the pointer.
- *
- * @param seat Seat
- * @param old_rect Rectangle previously covered by pointer
- *
- * @return EOK on success or an error code
- */
-static errno_t ds_seat_repaint_pointer(ds_seat_t *seat, gfx_rect_t *old_rect)
-{
-	gfx_rect_t new_rect;
-	gfx_rect_t envelope;
-	errno_t rc;
-
-	ds_seat_get_pointer_rect(seat, &new_rect);
-
-	if (gfx_rect_is_incident(old_rect, &new_rect)) {
-		/* Rectangles do not intersect. Repaint them separately. */
-		rc = ds_display_paint(seat->display, &new_rect);
-		if (rc != EOK)
-			return rc;
-
-		rc = ds_display_paint(seat->display, old_rect);
-		if (rc != EOK)
-			return rc;
-	} else {
-		/*
-		 * Rectangles intersect. As an optimization, repaint them
-		 * in a single operation.
-		 */
-		gfx_rect_envelope(old_rect, &new_rect, &envelope);
-
-		rc = ds_display_paint(seat->display, &envelope);
-		if (rc != EOK)
-			return rc;
-	}
-
-	return EOK;
-}
-
-/** Post pointing device event to the seat
- *
- * Update pointer position and generate position event.
- *
- * @param seat Seat
- * @param event Event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_seat_post_ptd_event(ds_seat_t *seat, ptd_event_t *event)
-{
-	ds_display_t *disp = seat->display;
-	gfx_coord2_t npos;
-	gfx_rect_t old_rect;
-	ds_window_t *wnd;
-	pos_event_t pevent;
-	errno_t rc;
-
-	wnd = ds_display_window_by_pos(seat->display, &seat->pntpos);
-
-	/* Focus window on button press */
-	if (event->type == PTD_PRESS && event->btn_num == 1) {
-		if (wnd != NULL && (wnd->flags & wndf_popup) == 0 &&
-		    (wnd->flags & wndf_nofocus) == 0) {
-			ds_seat_set_focus(seat, wnd);
-		}
-	}
-
-	if (event->type == PTD_PRESS || event->type == PTD_RELEASE ||
-	    event->type == PTD_DCLICK) {
-		pevent.pos_id = event->pos_id;
-		switch (event->type) {
-		case PTD_PRESS:
-			pevent.type = POS_PRESS;
-			break;
-		case PTD_RELEASE:
-			pevent.type = POS_RELEASE;
-			break;
-		case PTD_DCLICK:
-			pevent.type = POS_DCLICK;
-			break;
-		default:
-			assert(false);
-		}
-
-		pevent.btn_num = event->btn_num;
-		pevent.hpos = seat->pntpos.x;
-		pevent.vpos = seat->pntpos.y;
-
-		rc = ds_seat_post_pos_event(seat, &pevent);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (event->type == PTD_MOVE) {
-		gfx_coord2_add(&seat->pntpos, &event->dmove, &npos);
-		gfx_coord2_clip(&npos, &disp->rect, &npos);
-
-		ds_seat_get_pointer_rect(seat, &old_rect);
-		seat->pntpos = npos;
-
-		pevent.pos_id = event->pos_id;
-		pevent.type = POS_UPDATE;
-		pevent.btn_num = 0;
-		pevent.hpos = seat->pntpos.x;
-		pevent.vpos = seat->pntpos.y;
-
-		rc = ds_seat_post_pos_event(seat, &pevent);
-		if (rc != EOK)
-			return rc;
-
-		ds_seat_repaint_pointer(seat, &old_rect);
-	}
-
-	if (event->type == PTD_ABS_MOVE) {
-		/*
-		 * Project input device area onto display area. Technically
-		 * we probably want to project onto the area of a particular
-		 * display device. The tricky part is figuring out which
-		 * display device the input device is associated with.
-		 */
-		gfx_coord2_project(&event->apos, &event->abounds,
-		    &disp->rect, &npos);
-
-		gfx_coord2_clip(&npos, &disp->rect, &npos);
-
-		ds_seat_get_pointer_rect(seat, &old_rect);
-		seat->pntpos = npos;
-
-		pevent.pos_id = event->pos_id;
-		pevent.type = POS_UPDATE;
-		pevent.btn_num = 0;
-		pevent.hpos = seat->pntpos.x;
-		pevent.vpos = seat->pntpos.y;
-
-		rc = ds_seat_post_pos_event(seat, &pevent);
-		if (rc != EOK)
-			return rc;
-
-		ds_seat_repaint_pointer(seat, &old_rect);
-	}
-
-	return EOK;
-}
-
-/** Post position event to seat.
- *
- * Deliver event to relevant windows.
- *
- * @param seat Seat
- * @param event Position event
- */
-errno_t ds_seat_post_pos_event(ds_seat_t *seat, pos_event_t *event)
-{
-	ds_window_t *pwindow;
-	ds_window_t *cwindow;
-	errno_t rc;
-
-	/* Window under pointer */
-	pwindow = ds_display_window_by_pos(seat->display, &seat->pntpos);
-
-	/* Current window: popup or focused */
-	cwindow = seat->popup;
-	if (cwindow == NULL)
-		cwindow = seat->focus;
-
-	/*
-	 * Deliver move and release event to current window if different
-	 * from pwindow
-	 */
-	if (event->type != POS_PRESS && cwindow != NULL &&
-	    cwindow != pwindow) {
-		rc = ds_window_post_pos_event(cwindow, event);
-		if (rc != EOK)
-			return rc;
-	}
-
-	if (pwindow != NULL) {
-		/* Moving over a window */
-		ds_seat_set_client_cursor(seat, pwindow->cursor);
-
-		rc = ds_window_post_pos_event(pwindow, event);
-		if (rc != EOK)
-			return rc;
-	} else {
-		/* Not over a window */
-		ds_seat_set_client_cursor(seat,
-		    seat->display->cursor[dcurs_arrow]);
-	}
-
-	/* Click outside popup window */
-	if (event->type == POS_PRESS && pwindow != seat->popup) {
-		/* Close popup window */
-		ds_seat_set_popup(seat, NULL);
-	}
-
-	return EOK;
-}
-
-/** Paint seat pointer.
- *
- * @param seat Seat whose pointer to paint
- * @param rect Clipping rectangle
- */
-errno_t ds_seat_paint_pointer(ds_seat_t *seat, gfx_rect_t *rect)
-{
-	ds_cursor_t *cursor;
-
-	cursor = ds_seat_get_cursor(seat);
-	return ds_cursor_paint(cursor, &seat->pntpos, rect);
-}
-
-/** Add input device configuration entry to seat.
- *
- * @param seat Seat
- * @param idevcfg Input device configuration
- */
-void ds_seat_add_idevcfg(ds_seat_t *seat, ds_idevcfg_t *idevcfg)
-{
-	assert(idevcfg->seat == NULL);
-	assert(!link_used(&idevcfg->lseatidcfgs));
-
-	idevcfg->seat = seat;
-	list_append(&idevcfg->lseatidcfgs, &seat->idevcfgs);
-}
-
-/** Remove input device configuration entry from seat.
- *
- * @param idevcfg Input device configuration entry
- */
-void ds_seat_remove_idevcfg(ds_idevcfg_t *idevcfg)
-{
-	list_remove(&idevcfg->lseatidcfgs);
-	idevcfg->seat = NULL;
-}
-
-/** Get first input device configuration entry in seat.
- *
- * @param disp Display
- * @return First input device configuration entry or @c NULL if there is none
- */
-ds_idevcfg_t *ds_seat_first_idevcfg(ds_seat_t *seat)
-{
-	link_t *link = list_first(&seat->idevcfgs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_idevcfg_t, lseatidcfgs);
-}
-
-/** Get next input device configuration entry in seat.
- *
- * @param idevcfg Current input device configuration entry
- * @return Next input device configuration entry or @c NULL if there is none
- */
-ds_idevcfg_t *ds_seat_next_idevcfg(ds_idevcfg_t *idevcfg)
-{
-	link_t *link = list_next(&idevcfg->lseatidcfgs, &idevcfg->seat->idevcfgs);
-
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, ds_idevcfg_t, lseatidcfgs);
-}
-
-/** @}
- */
Index: pace/srv/hid/display/seat.h
===================================================================
--- uspace/srv/hid/display/seat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server seat
- */
-
-#ifndef SEAT_H
-#define SEAT_H
-
-#include <errno.h>
-#include <gfx/coord.h>
-#include <io/kbd_event.h>
-#include <io/pos_event.h>
-#include <sif.h>
-#include "types/display/display.h"
-#include "types/display/seat.h"
-#include "types/display/ptd_event.h"
-#include "types/display/window.h"
-
-extern errno_t ds_seat_create(ds_display_t *, const char *, ds_seat_t **);
-extern void ds_seat_destroy(ds_seat_t *);
-extern errno_t ds_seat_load(ds_display_t *, sif_node_t *, ds_seat_t **);
-extern errno_t ds_seat_save(ds_seat_t *, sif_node_t *);
-extern void ds_seat_set_focus(ds_seat_t *, ds_window_t *);
-extern void ds_seat_set_popup(ds_seat_t *, ds_window_t *);
-extern void ds_seat_evac_wnd_refs(ds_seat_t *, ds_window_t *);
-extern void ds_seat_unfocus_wnd(ds_seat_t *, ds_window_t *);
-extern void ds_seat_switch_focus(ds_seat_t *);
-extern errno_t ds_seat_post_kbd_event(ds_seat_t *, kbd_event_t *);
-extern errno_t ds_seat_post_ptd_event(ds_seat_t *, ptd_event_t *);
-extern errno_t ds_seat_post_pos_event(ds_seat_t *, pos_event_t *);
-extern void ds_seat_set_wm_cursor(ds_seat_t *, ds_cursor_t *);
-extern errno_t ds_seat_paint_pointer(ds_seat_t *, gfx_rect_t *);
-extern void ds_seat_add_idevcfg(ds_seat_t *, ds_idevcfg_t *);
-extern void ds_seat_remove_idevcfg(ds_idevcfg_t *);
-extern ds_idevcfg_t *ds_seat_first_idevcfg(ds_seat_t *);
-extern ds_idevcfg_t *ds_seat_next_idevcfg(ds_idevcfg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/test/cfgclient.c
===================================================================
--- uspace/srv/hid/display/test/cfgclient.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../display.h"
-#include "../cfgclient.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(cfgclient);
-
-static void test_ds_dcev_pending(void *);
-
-static ds_cfgclient_cb_t test_ds_cfgclient_cb = {
-	.ev_pending = test_ds_dcev_pending
-};
-
-static void test_ds_dcev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-/** WM client creation and destruction. */
-PCUT_TEST(create_destroy)
-{
-	ds_display_t *disp;
-	ds_cfgclient_t *cfgclient;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cfgclient_create(disp, &test_ds_cfgclient_cb, NULL, &cfgclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cfgclient_get_event(), ds_cfgclient_post_seat_added_event(). */
-PCUT_TEST(client_get_post_seat_added_event)
-{
-	ds_display_t *disp;
-	ds_cfgclient_t *cfgclient;
-	dispcfg_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cfgclient_create(disp, &test_ds_cfgclient_cb, &called_cb,
-	    &cfgclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-	seat_id = 42;
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_cfgclient_post_seat_added_event(cfgclient, seat_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(seat_id, revent.seat_id);
-	PCUT_ASSERT_EQUALS(dcev_seat_added, revent.etype);
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cfgclient_get_event(), ds_cfgclient_post_seat_removed_event(). */
-PCUT_TEST(client_get_post_seat_removed_event)
-{
-	ds_display_t *disp;
-	ds_cfgclient_t *cfgclient;
-	dispcfg_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cfgclient_create(disp, &test_ds_cfgclient_cb, &called_cb,
-	    &cfgclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-	seat_id = 42;
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_cfgclient_post_seat_removed_event(cfgclient, seat_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(seat_id, revent.seat_id);
-	PCUT_ASSERT_EQUALS(dcev_seat_removed, revent.etype);
-
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cfgclient_purge_events() */
-PCUT_TEST(purge_events)
-{
-	ds_display_t *disp;
-	ds_cfgclient_t *cfgclient;
-	dispcfg_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t seat_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cfgclient_create(disp, &test_ds_cfgclient_cb, &called_cb,
-	    &cfgclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Post window added event */
-	seat_id = 42;
-	rc = ds_cfgclient_post_seat_added_event(cfgclient, seat_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Purge it */
-	ds_cfgclient_purge_events(cfgclient);
-
-	/* The queue should be empty now */
-	rc = ds_cfgclient_get_event(cfgclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_destroy(disp);
-}
-
-PCUT_EXPORT(cfgclient);
Index: pace/srv/hid/display/test/client.c
===================================================================
--- uspace/srv/hid/display/test/client.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,643 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../client.h"
-#include "../display.h"
-#include "../seat.h"
-#include "../window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(client);
-
-static void test_ds_ev_pending(void *);
-
-static ds_client_cb_t test_ds_client_cb = {
-	.ev_pending = test_ds_ev_pending
-};
-
-static void test_ds_ev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-/** Client creation and destruction. */
-PCUT_TEST(client_create_destroy)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_find_window().
- *
- * ds_client_add_window() and ds_client_remove_window() are indirectly
- * tested too as part of creating and destroying the window
- */
-PCUT_TEST(client_find_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd = ds_client_find_window(client, w0->id);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	wnd = ds_client_find_window(client, w1->id);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_client_find_window(client, 0);
-	PCUT_ASSERT_NULL(wnd);
-
-	wnd = ds_client_find_window(client, w1->id + 1);
-	PCUT_ASSERT_NULL(wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_first_window() / ds_client_next_window. */
-PCUT_TEST(client_first_next_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd = ds_client_first_window(client);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	wnd = ds_client_next_window(w0);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_client_next_window(w1);
-	PCUT_ASSERT_NULL(wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_close_event(). */
-PCUT_TEST(client_get_post_close_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_client_post_close_event(client, wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_close, revent.etype);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_focus_event(). */
-PCUT_TEST(client_get_post_focus_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	ds_window_t *rwindow;
-	display_wnd_focus_ev_t efocus;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	efocus.nfocus = 42;
-
-	rc = ds_client_post_focus_event(client, wnd, &efocus);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_focus, revent.etype);
-	PCUT_ASSERT_INT_EQUALS(efocus.nfocus, revent.ev.focus.nfocus);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_kbd_event(). */
-PCUT_TEST(client_get_post_kbd_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	kbd_event_t event;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	event.c = L'\0';
-
-	rc = ds_client_post_kbd_event(client, wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_kbd, revent.etype);
-	PCUT_ASSERT_EQUALS(event.type, revent.ev.kbd.type);
-	PCUT_ASSERT_EQUALS(event.key, revent.ev.kbd.key);
-	PCUT_ASSERT_EQUALS(event.mods, revent.ev.kbd.mods);
-	PCUT_ASSERT_EQUALS(event.c, revent.ev.kbd.c);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_pos_event(). */
-PCUT_TEST(client_get_post_pos_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	pos_event_t event;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	PCUT_ASSERT_FALSE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	event.type = POS_PRESS;
-	event.hpos = 1;
-	event.vpos = 2;
-
-	rc = ds_client_post_pos_event(client, wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_pos, revent.etype);
-	PCUT_ASSERT_EQUALS(event.type, revent.ev.pos.type);
-	PCUT_ASSERT_EQUALS(event.hpos, revent.ev.pos.hpos);
-	PCUT_ASSERT_EQUALS(event.vpos, revent.ev.pos.vpos);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_resize_event(). */
-PCUT_TEST(client_get_post_resize_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_rect_t rect;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	PCUT_ASSERT_FALSE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	rc = ds_client_post_resize_event(client, wnd, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_resize, revent.etype);
-	PCUT_ASSERT_EQUALS(rect.p0.x, revent.ev.resize.rect.p0.x);
-	PCUT_ASSERT_EQUALS(rect.p0.y, revent.ev.resize.rect.p0.y);
-	PCUT_ASSERT_EQUALS(rect.p1.x, revent.ev.resize.rect.p1.x);
-	PCUT_ASSERT_EQUALS(rect.p1.y, revent.ev.resize.rect.p1.y);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_get_event(), ds_client_post_unfocus_event(). */
-PCUT_TEST(client_get_post_unfocus_event)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	ds_window_t *rwindow;
-	display_wnd_unfocus_ev_t eunfocus;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	eunfocus.nfocus = 42;
-
-	rc = ds_client_post_unfocus_event(client, wnd, &eunfocus);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_unfocus, revent.etype);
-	PCUT_ASSERT_INT_EQUALS(eunfocus.nfocus, revent.ev.unfocus.nfocus);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_client_purge_window_events() */
-PCUT_TEST(client_purge_window_events)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = NULL;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	/* Purge it */
-	ds_client_purge_window_events(client, wnd);
-
-	/* The queue should be empty now */
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test client being destroyed while still having a window.
- *
- * This can happen if client forgets to destroy window or if the client
- * is disconnected (or terminated).
- */
-PCUT_TEST(client_leftover_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-PCUT_EXPORT(client);
Index: pace/srv/hid/display/test/clonegc.c
===================================================================
--- uspace/srv/hid/display/test/clonegc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,794 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/color.h>
-#include <gfx/render.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-
-#include "../clonegc.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(clonegc);
-
-static errno_t testgc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t testgc_set_color(void *, gfx_color_t *);
-static errno_t testgc_fill_rect(void *, gfx_rect_t *);
-static errno_t testgc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t testgc_bitmap_destroy(void *);
-static errno_t testgc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t testgc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static gfx_context_ops_t ops = {
-	.set_clip_rect = testgc_set_clip_rect,
-	.set_color = testgc_set_color,
-	.fill_rect = testgc_fill_rect,
-	.bitmap_create = testgc_bitmap_create,
-	.bitmap_destroy = testgc_bitmap_destroy,
-	.bitmap_render = testgc_bitmap_render,
-	.bitmap_get_alloc = testgc_bitmap_get_alloc
-};
-
-typedef struct {
-	/** Error code to return */
-	errno_t rc;
-
-	bool set_clip_rect_called;
-	gfx_rect_t *set_clip_rect_rect;
-
-	bool set_color_called;
-	gfx_color_t *set_color_color;
-
-	bool fill_rect_called;
-	gfx_rect_t *fill_rect_rect;
-
-	bool bm_created;
-	bool bm_destroyed;
-	gfx_bitmap_params_t bm_params;
-	void *bm_pixels;
-	gfx_rect_t bm_srect;
-	gfx_coord2_t bm_offs;
-	bool bm_rendered;
-	bool bm_got_alloc;
-} test_gc_t;
-
-typedef struct {
-	test_gc_t *tgc;
-	gfx_bitmap_alloc_t alloc;
-	bool myalloc;
-} testgc_bitmap_t;
-
-enum {
-	alloc_pitch = 42,
-	alloc_off0 = 33
-};
-
-/** Test creating and deleting clone GC */
-PCUT_TEST(create_delete)
-{
-	ds_clonegc_t *cgc;
-	errno_t rc;
-
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Set clipping rectangle with two output GCs */
-PCUT_TEST(set_clip_rect)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add two output GCs */
-
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	/* Set clipping rectangle returning error */
-
-	tgc1.set_clip_rect_called = false;
-	tgc2.set_clip_rect_called = false;
-	tgc1.rc = EINVAL;
-	tgc2.rc = EINVAL;
-
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.set_clip_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc1.set_clip_rect_rect);
-	PCUT_ASSERT_FALSE(tgc2.set_clip_rect_called);
-
-	/* Set clipping rectangle returning success for all outputs */
-	tgc1.set_clip_rect_called = false;
-	tgc2.set_clip_rect_called = false;
-	tgc1.rc = EOK;
-	tgc2.rc = EOK;
-
-	rc = gfx_set_clip_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.set_clip_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc1.set_clip_rect_rect);
-	PCUT_ASSERT_TRUE(tgc2.set_clip_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc2.set_clip_rect_rect);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test set color operation with two output GCs */
-PCUT_TEST(set_color)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_color_t *color;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add two output GCs */
-
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_color_new_rgb_i16(0xaaaa, 0xbbbb, 0xcccc, &color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Set color returning error */
-
-	tgc1.set_color_called = false;
-	tgc2.set_color_called = false;
-	tgc1.rc = EINVAL;
-	tgc2.rc = EINVAL;
-
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.set_color_called);
-	PCUT_ASSERT_EQUALS(color, tgc1.set_color_color);
-	PCUT_ASSERT_FALSE(tgc2.set_color_called);
-
-	/* Set color returning success for all outputs */
-	tgc1.set_color_called = false;
-	tgc2.set_color_called = false;
-	tgc1.rc = EOK;
-	tgc2.rc = EOK;
-
-	rc = gfx_set_color(gc, color);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.set_color_called);
-	PCUT_ASSERT_EQUALS(color, tgc1.set_color_color);
-	PCUT_ASSERT_TRUE(tgc2.set_color_called);
-	PCUT_ASSERT_EQUALS(color, tgc2.set_color_color);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gfx_color_delete(color);
-}
-
-/** Fill rectangle operation with two output GCs */
-PCUT_TEST(fill_rect)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add two output GCs */
-
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rect.p0.x = 1;
-	rect.p0.y = 2;
-	rect.p1.x = 3;
-	rect.p1.y = 4;
-
-	/* Fill rectangle returning error */
-
-	tgc1.fill_rect_called = false;
-	tgc2.fill_rect_called = false;
-	tgc1.rc = EINVAL;
-	tgc2.rc = EINVAL;
-
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.fill_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc1.fill_rect_rect);
-	PCUT_ASSERT_FALSE(tgc2.fill_rect_called);
-
-	/* Fill rectangle returning success for all outputs */
-	tgc1.fill_rect_called = false;
-	tgc2.fill_rect_called = false;
-	tgc1.rc = EOK;
-	tgc2.rc = EOK;
-
-	rc = gfx_fill_rect(gc, &rect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.fill_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc1.fill_rect_rect);
-	PCUT_ASSERT_TRUE(tgc2.fill_rect_called);
-	PCUT_ASSERT_EQUALS(&rect, tgc2.fill_rect_rect);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Operations on regular bitmap with two output GCs, callee allocation */
-PCUT_TEST(bitmap_twogc_callee_alloc)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add two output GCs */
-
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create bitmap with NULL allocation */
-	tgc1.bm_created = false;
-	tgc2.bm_created = false;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc1.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc1.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc1.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc1.bm_params.rect.p1.y);
-
-	PCUT_ASSERT_TRUE(tgc2.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc2.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc2.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc2.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc2.bm_params.rect.p1.y);
-
-	/* Get allocation */
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(alloc_pitch, alloc.pitch);
-	PCUT_ASSERT_EQUALS(tgc1.bm_pixels, alloc.pixels);
-	PCUT_ASSERT_EQUALS(tgc2.bm_pixels, alloc.pixels);
-
-	/* Render bitmap */
-	tgc1.bm_rendered = false;
-	tgc1.bm_rendered = false;
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	off.x = 50;
-	off.y = 60;
-	rc = gfx_bitmap_render(bitmap, &rect, &off);
-	PCUT_ASSERT_TRUE(tgc1.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc1.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc1.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc1.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc1.bm_srect.p1.y);
-	PCUT_ASSERT_TRUE(tgc2.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc2.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc2.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc2.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc2.bm_srect.p1.y);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Operations on regular bitmap with two output GCs, caller allocation */
-PCUT_TEST(bitmap_twogc_caller_alloc)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_alloc_t galloc;
-	void *pixels;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add two output GCs */
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create bitmap with caller allocation */
-	tgc1.bm_created = false;
-	tgc2.bm_created = false;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	pixels = calloc(2 * 2, sizeof(uint32_t));
-	PCUT_ASSERT_NOT_NULL(pixels);
-
-	alloc.pitch = 8;
-	alloc.off0 = 0;
-	alloc.pixels = pixels;
-
-	rc = gfx_bitmap_create(gc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc1.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc1.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc1.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc1.bm_params.rect.p1.y);
-
-	PCUT_ASSERT_TRUE(tgc2.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc2.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc2.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc2.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc2.bm_params.rect.p1.y);
-
-	/* Get allocation */
-	rc = gfx_bitmap_get_alloc(bitmap, &galloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(alloc.pitch, galloc.pitch);
-	PCUT_ASSERT_INT_EQUALS(alloc.off0, galloc.off0);
-	PCUT_ASSERT_EQUALS(alloc.pixels, galloc.pixels);
-	PCUT_ASSERT_EQUALS(tgc1.bm_pixels, galloc.pixels);
-	PCUT_ASSERT_EQUALS(tgc2.bm_pixels, galloc.pixels);
-
-	/* Render bitmap */
-	tgc1.bm_rendered = false;
-	tgc1.bm_rendered = false;
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	off.x = 50;
-	off.y = 60;
-	rc = gfx_bitmap_render(bitmap, &rect, &off);
-	PCUT_ASSERT_TRUE(tgc1.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc1.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc1.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc1.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc1.bm_srect.p1.y);
-	PCUT_ASSERT_TRUE(tgc2.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc2.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc2.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc2.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc2.bm_srect.p1.y);
-
-	free(pixels);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Create bitmap, then add second GC, callee allocation */
-PCUT_TEST(bitmap_addgc_callee_alloc)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add one output GC */
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create bitmap with NULL allocation */
-	tgc1.bm_created = false;
-	tgc2.bm_created = false;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc1.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc1.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc1.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc1.bm_params.rect.p1.y);
-
-	PCUT_ASSERT_FALSE(tgc2.bm_created);
-
-	/* Get allocation */
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(alloc_pitch, alloc.pitch);
-	PCUT_ASSERT_EQUALS(tgc1.bm_pixels, alloc.pixels);
-
-	/* Add second output GC */
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Render bitmap */
-	tgc1.bm_rendered = false;
-	tgc1.bm_rendered = false;
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	off.x = 50;
-	off.y = 60;
-	rc = gfx_bitmap_render(bitmap, &rect, &off);
-	PCUT_ASSERT_TRUE(tgc1.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc1.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc1.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc1.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc1.bm_srect.p1.y);
-	PCUT_ASSERT_TRUE(tgc2.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc2.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc2.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc2.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc2.bm_srect.p1.y);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Create bitmap, then add second GC, caller allocation */
-PCUT_TEST(bitmap_addgc_caller_alloc)
-{
-	ds_clonegc_t *cgc;
-	gfx_context_t *gc;
-	test_gc_t tgc1;
-	gfx_context_t *gc1;
-	test_gc_t tgc2;
-	gfx_context_t *gc2;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_t *bitmap;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_alloc_t galloc;
-	void *pixels;
-	gfx_rect_t rect;
-	gfx_coord2_t off;
-	errno_t rc;
-
-	/* Create clone GC */
-	rc = ds_clonegc_create(NULL, &cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_clonegc_get_ctx(cgc);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	/* Add one output GC */
-	rc = gfx_context_new(&ops, &tgc1, &gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Create bitmap with caller allocation */
-	tgc1.bm_created = false;
-	tgc2.bm_created = false;
-	gfx_bitmap_params_init(&params);
-	params.rect.p0.x = 1;
-	params.rect.p0.y = 2;
-	params.rect.p1.x = 3;
-	params.rect.p1.y = 4;
-
-	pixels = calloc(2 * 2, sizeof(uint32_t));
-	PCUT_ASSERT_NOT_NULL(pixels);
-
-	alloc.pitch = 8;
-	alloc.off0 = 0;
-	alloc.pixels = pixels;
-
-	rc = gfx_bitmap_create(gc, &params, &alloc, &bitmap);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(tgc1.bm_created);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, tgc1.bm_params.rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, tgc1.bm_params.rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, tgc1.bm_params.rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, tgc1.bm_params.rect.p1.y);
-
-	PCUT_ASSERT_FALSE(tgc2.bm_created);
-
-	/* Get allocation */
-	rc = gfx_bitmap_get_alloc(bitmap, &galloc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(alloc.pitch, galloc.pitch);
-	PCUT_ASSERT_INT_EQUALS(alloc.off0, galloc.off0);
-	PCUT_ASSERT_EQUALS(alloc.pixels, galloc.pixels);
-	PCUT_ASSERT_EQUALS(tgc1.bm_pixels, galloc.pixels);
-
-	/* Add second output GC */
-	rc = gfx_context_new(&ops, &tgc2, &gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_clonegc_add_output(cgc, gc2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Render bitmap */
-	tgc1.bm_rendered = false;
-	tgc1.bm_rendered = false;
-	rect.p0.x = 10;
-	rect.p0.y = 20;
-	rect.p1.x = 30;
-	rect.p1.y = 40;
-	off.x = 50;
-	off.y = 60;
-	rc = gfx_bitmap_render(bitmap, &rect, &off);
-	PCUT_ASSERT_TRUE(tgc1.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc1.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc1.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc1.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc1.bm_srect.p1.y);
-	PCUT_ASSERT_TRUE(tgc2.bm_rendered);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.x, tgc2.bm_srect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p0.y, tgc2.bm_srect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.x, tgc2.bm_srect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(rect.p1.y, tgc2.bm_srect.p1.y);
-
-	free(pixels);
-
-	rc = ds_clonegc_delete(cgc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-static errno_t testgc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->set_clip_rect_called = true;
-	tgc->set_clip_rect_rect = rect;
-
-	return tgc->rc;
-}
-
-static errno_t testgc_set_color(void *arg, gfx_color_t *color)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->set_color_called = true;
-	tgc->set_color_color = color;
-
-	return tgc->rc;
-}
-
-static errno_t testgc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-
-	tgc->fill_rect_called = true;
-	tgc->fill_rect_rect = rect;
-
-	return tgc->rc;
-}
-
-static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_gc_t *tgc = (test_gc_t *) arg;
-	testgc_bitmap_t *tbm;
-
-	tbm = calloc(1, sizeof(testgc_bitmap_t));
-	if (tbm == NULL)
-		return ENOMEM;
-
-	if (alloc == NULL) {
-		tbm->alloc.pitch = alloc_pitch;
-		tbm->alloc.off0 = alloc_off0;
-		tbm->alloc.pixels = calloc(1, 420);
-		tbm->myalloc = true;
-		if (tbm->alloc.pixels == NULL) {
-			free(tbm);
-			return ENOMEM;
-		}
-	} else {
-		tbm->alloc = *alloc;
-	}
-
-	tbm->tgc = tgc;
-	tgc->bm_created = true;
-	tgc->bm_params = *params;
-	tgc->bm_pixels = tbm->alloc.pixels;
-	*rbm = (void *)tbm;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_destroy(void *bm)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	if (tbm->myalloc)
-		free(tbm->alloc.pixels);
-	tbm->tgc->bm_destroyed = true;
-	free(tbm);
-	return EOK;
-}
-
-static errno_t testgc_bitmap_render(void *bm, gfx_rect_t *srect,
-    gfx_coord2_t *offs)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	tbm->tgc->bm_rendered = true;
-	tbm->tgc->bm_srect = *srect;
-	tbm->tgc->bm_offs = *offs;
-	return EOK;
-}
-
-static errno_t testgc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	testgc_bitmap_t *tbm = (testgc_bitmap_t *)bm;
-	*alloc = tbm->alloc;
-	tbm->tgc->bm_got_alloc = true;
-	return EOK;
-}
-
-PCUT_EXPORT(clonegc);
Index: pace/srv/hid/display/test/cursor.c
===================================================================
--- uspace/srv/hid/display/test/cursor.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,263 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <gfx/context.h>
-#include <stdbool.h>
-#include <pcut/pcut.h>
-
-#include "../cursor.h"
-#include "../cursimg.h"
-#include "../ddev.h"
-#include "../display.h"
-#include "../display.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(cursor);
-
-static errno_t dummy_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t dummy_bitmap_destroy(void *);
-static errno_t dummy_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t dummy_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static gfx_context_ops_t dummy_ops = {
-	.bitmap_create = dummy_bitmap_create,
-	.bitmap_destroy = dummy_bitmap_destroy,
-	.bitmap_render = dummy_bitmap_render,
-	.bitmap_get_alloc = dummy_bitmap_get_alloc
-};
-
-typedef struct {
-	bool render_called;
-} test_response_t;
-
-typedef struct {
-	test_response_t *resp;
-	gfx_bitmap_alloc_t alloc;
-} dummy_bitmap_t;
-
-/** Test ds_cursor_create(), ds_cursor_destroy(). */
-PCUT_TEST(cursor_create_destroy)
-{
-	ds_display_t *disp;
-	ds_cursor_t *cursor;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cursor_create(disp, &ds_cursimg[dcurs_arrow].rect,
-	    ds_cursimg[dcurs_arrow].image, &cursor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_cursor_destroy(cursor);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cursor_paint() renders the cursor. */
-PCUT_TEST(cursor_paint_render)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_cursor_t *cursor;
-	ds_ddev_t *ddev;
-	ddev_info_t ddinfo;
-	gfx_coord2_t pos;
-	test_response_t resp;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, &resp, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ddev_info_init(&ddinfo);
-
-	rc = ds_ddev_create(disp, NULL, &ddinfo, NULL, 0, gc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cursor_create(disp, &ds_cursimg[dcurs_arrow].rect,
-	    ds_cursimg[dcurs_arrow].image, &cursor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.render_called = false;
-
-	pos.x = 0;
-	pos.y = 0;
-	ds_cursor_paint(cursor, &pos, NULL);
-
-	PCUT_ASSERT_TRUE(resp.render_called);
-
-	ds_ddev_close(ddev);
-	ds_cursor_destroy(cursor);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cursor_paint() optimizes out rendering using clipping rectangle. */
-PCUT_TEST(cursor_paint_norender)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_cursor_t *cursor;
-	ds_ddev_t *ddev;
-	ddev_info_t ddinfo;
-	gfx_coord2_t pos;
-	gfx_rect_t clip;
-	test_response_t resp;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, &resp, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ddev_info_init(&ddinfo);
-
-	rc = ds_ddev_create(disp, NULL, &ddinfo, NULL, 0, gc, &ddev);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cursor_create(disp, &ds_cursimg[dcurs_arrow].rect,
-	    ds_cursimg[dcurs_arrow].image, &cursor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	resp.render_called = false;
-
-	/*
-	 * Clipping rectangle not intersecting the area where cursor is to
-	 * be rendered
-	 */
-	clip.p0.x = 100;
-	clip.p0.y = 100;
-	clip.p1.x = 150;
-	clip.p1.y = 150;
-
-	pos.x = 0;
-	pos.y = 0;
-	ds_cursor_paint(cursor, &pos, &clip);
-
-	/* Rendering should have been optimized out */
-	PCUT_ASSERT_FALSE(resp.render_called);
-
-	ds_ddev_close(ddev);
-	ds_cursor_destroy(cursor);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_cursor_get_rect() */
-PCUT_TEST(cursor_get_rect)
-{
-	ds_display_t *disp;
-	ds_cursor_t *cursor;
-	gfx_coord2_t pos1, pos2;
-	gfx_rect_t rect1, rect2;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cursor_create(disp, &ds_cursimg[dcurs_arrow].rect,
-	    ds_cursimg[dcurs_arrow].image, &cursor);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	pos1.x = 10;
-	pos1.y = 11;
-
-	pos2.x = 22;
-	pos2.y = 23;
-
-	ds_cursor_get_rect(cursor, &pos1, &rect1);
-	ds_cursor_get_rect(cursor, &pos2, &rect2);
-
-	PCUT_ASSERT_FALSE(gfx_rect_is_empty(&rect1));
-	PCUT_ASSERT_FALSE(gfx_rect_is_empty(&rect2));
-
-	PCUT_ASSERT_INT_EQUALS(pos2.x - pos1.x, rect2.p0.x - rect1.p0.x);
-	PCUT_ASSERT_INT_EQUALS(pos2.y - pos1.y, rect2.p0.y - rect1.p0.y);
-	PCUT_ASSERT_INT_EQUALS(pos2.x - pos1.x, rect2.p1.x - rect1.p1.x);
-	PCUT_ASSERT_INT_EQUALS(pos2.y - pos1.y, rect2.p1.y - rect1.p1.y);
-
-	ds_cursor_destroy(cursor);
-	ds_display_destroy(disp);
-}
-
-static errno_t dummy_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	test_response_t *resp = (test_response_t *) arg;
-	dummy_bitmap_t *bm;
-	gfx_coord2_t dims;
-
-	gfx_rect_dims(&params->rect, &dims);
-	bm = calloc(1, sizeof(dummy_bitmap_t));
-	if (bm == NULL)
-		return ENOMEM;
-
-	bm->resp = resp;
-	bm->alloc.pitch = dims.x * sizeof(uint32_t);
-	bm->alloc.off0 = 0;
-
-	bm->alloc.pixels = malloc(bm->alloc.pitch * dims.y * sizeof(uint32_t));
-	if (bm->alloc.pixels == NULL) {
-		free(bm);
-		return ENOMEM;
-	}
-
-	*rbm = (void *) bm;
-	return EOK;
-}
-
-static errno_t dummy_bitmap_destroy(void *arg)
-{
-	dummy_bitmap_t *bm = (dummy_bitmap_t *) arg;
-
-	free(bm);
-	return EOK;
-}
-
-static errno_t dummy_bitmap_render(void *arg, gfx_rect_t *rect,
-    gfx_coord2_t *dpos)
-{
-	dummy_bitmap_t *bm = (dummy_bitmap_t *) arg;
-
-	bm->resp->render_called = true;
-	return EOK;
-}
-
-static errno_t dummy_bitmap_get_alloc(void *arg, gfx_bitmap_alloc_t *alloc)
-{
-	dummy_bitmap_t *bm = (dummy_bitmap_t *) arg;
-
-	*alloc = bm->alloc;
-	return EOK;
-}
-
-PCUT_EXPORT(cursor);
Index: pace/srv/hid/display/test/display.c
===================================================================
--- uspace/srv/hid/display/test/display.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,826 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../cfgclient.h"
-#include "../client.h"
-#include "../display.h"
-#include "../idevcfg.h"
-#include "../seat.h"
-#include "../window.h"
-#include "../wmclient.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(display);
-
-static void test_ds_ev_pending(void *);
-
-static ds_client_cb_t test_ds_client_cb = {
-	.ev_pending = test_ds_ev_pending
-};
-
-static void test_ds_wmev_pending(void *);
-
-static ds_wmclient_cb_t test_ds_wmclient_cb = {
-	.ev_pending = test_ds_wmev_pending
-};
-
-static void test_ds_cfgev_pending(void *);
-
-static ds_cfgclient_cb_t test_ds_cfgclient_cb = {
-	.ev_pending = test_ds_cfgev_pending
-};
-
-static void test_ds_ev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-static void test_ds_wmev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-static void test_ds_cfgev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-/** Display creation and destruction. */
-PCUT_TEST(display_create_destroy)
-{
-	ds_display_t *disp;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_display_destroy(disp);
-}
-
-/** Basic client operation. */
-PCUT_TEST(display_client)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_client_t *c0, *c1;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c0 = ds_display_first_client(disp);
-	PCUT_ASSERT_EQUALS(c0, client);
-
-	c1 = ds_display_next_client(c0);
-	PCUT_ASSERT_NULL(c1);
-
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Basic WM client operation. */
-PCUT_TEST(display_wmclient)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	ds_wmclient_t *c0, *c1;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, NULL, &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	c0 = ds_display_first_wmclient(disp);
-	PCUT_ASSERT_EQUALS(c0, wmclient);
-
-	c1 = ds_display_next_wmclient(c0);
-	PCUT_ASSERT_NULL(c1);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-/** Basic CFG client operation. */
-PCUT_TEST(display_cfgclient)
-{
-	ds_display_t *disp;
-	ds_cfgclient_t *cfgclient;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_cfgclient_create(disp, &test_ds_cfgclient_cb, NULL, &cfgclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_cfgclient_destroy(cfgclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_find_window(). */
-PCUT_TEST(display_find_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd = ds_display_first_window(disp);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	wnd = ds_display_next_window(wnd);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_display_next_window(wnd);
-	PCUT_ASSERT_NULL(wnd);
-
-	wnd = ds_display_last_window(disp);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_display_prev_window(wnd);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	wnd = ds_display_prev_window(wnd);
-	PCUT_ASSERT_NULL(wnd);
-
-	wnd = ds_display_find_window(disp, w0->id);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	wnd = ds_display_find_window(disp, w1->id);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_display_find_window(disp, 0);
-	PCUT_ASSERT_NULL(wnd);
-
-	wnd = ds_display_find_window(disp, w0->id + 1);
-	PCUT_ASSERT_NULL(wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_enlist_window() */
-PCUT_TEST(display_enlist_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	ds_window_t *w3;
-	ds_window_t *w;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 100;
-
-	/* Regular windows */
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Topmost windows */
-
-	params.flags |= wndf_topmost;
-
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w3);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Delist w1 and w2 */
-	list_remove(&w1->ldwindows);
-	list_remove(&w2->ldwindows);
-
-	/* Enlist the windows back and check their order */
-	ds_display_enlist_window(disp, w1);
-	ds_display_enlist_window(disp, w2);
-
-	w = ds_display_first_window(disp);
-	PCUT_ASSERT_EQUALS(w2, w);
-	w = ds_display_next_window(w);
-	PCUT_ASSERT_EQUALS(w3, w);
-	w = ds_display_next_window(w);
-	PCUT_ASSERT_EQUALS(w1, w);
-	w = ds_display_next_window(w);
-	PCUT_ASSERT_EQUALS(w0, w);
-	w = ds_display_next_window(w);
-	PCUT_ASSERT_EQUALS(NULL, w);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_window_destroy(w2);
-	ds_window_destroy(w3);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_window_to_top() */
-PCUT_TEST(display_window_to_top)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 100;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w1, ds_display_first_window(disp));
-	ds_display_window_to_top(w0);
-	PCUT_ASSERT_EQUALS(w0, ds_display_first_window(disp));
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_window_by_pos(). */
-PCUT_TEST(display_window_by_pos)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t pos;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 100;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	w0->dpos.x = 10;
-	w0->dpos.y = 10;
-
-	w1->dpos.x = 400;
-	w1->dpos.y = 400;
-
-	pos.x = 10;
-	pos.y = 10;
-	wnd = ds_display_window_by_pos(disp, &pos);
-	PCUT_ASSERT_EQUALS(w0, wnd);
-
-	pos.x = 400;
-	pos.y = 400;
-	wnd = ds_display_window_by_pos(disp, &pos);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Basic idevcfg operation */
-PCUT_TEST(display_idevcfg)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_idevcfg_t *idevcfg;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_idevcfg_create(disp, 42, seat, &idevcfg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_idevcfg_destroy(idevcfg);
-
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** Basic seat operation. */
-PCUT_TEST(display_seat)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_seat_t *s0, *s1, *s2;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	s0 = ds_display_first_seat(disp);
-	PCUT_ASSERT_EQUALS(s0, seat);
-
-	s1 = ds_display_next_seat(s0);
-	PCUT_ASSERT_NULL(s1);
-
-	s2 = ds_display_find_seat(disp, seat->id);
-	PCUT_ASSERT_EQUALS(s2, seat);
-
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** ds_display_seat_by_idev() returns the correct seat. */
-PCUT_TEST(display_seat_by_idev)
-{
-	// XXX TODO
-}
-
-/** Test ds_display_post_kbd_event() delivers event to client callback.
- */
-PCUT_TEST(display_post_kbd_event)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_client_t *client;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	kbd_event_t event;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, wnd);
-
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	event.c = L'\0';
-
-	called_cb = false;
-
-	rc = ds_display_post_kbd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	ds_window_destroy(wnd);
-	ds_client_destroy(client);
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_post_kbd_event() with Alt-Tab switches focus.
- */
-PCUT_TEST(display_post_kbd_event_alt_tab)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_client_t *client;
-	ds_window_t *w0, *w1;
-	display_wnd_params_t params;
-	kbd_event_t event;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, w0);
-
-	event.type = KEY_PRESS;
-	event.key = KC_TAB;
-	event.mods = KM_ALT;
-	event.c = L'\0';
-
-	called_cb = false;
-
-	rc = ds_display_post_kbd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Got gocus/unfocus events */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	/* Next window should be focused */
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	called_cb = false;
-
-	rc = ds_display_post_kbd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Got gocus/unfocus events */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	/* Focus should be back to the first window */
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_client_destroy(client);
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_display_post_ptd_event() with click on window switches focus
- */
-PCUT_TEST(display_post_ptd_event_wnd_switch)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_client_t *client;
-	ds_window_t *w0, *w1;
-	display_wnd_params_t params;
-	ptd_event_t event;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * For PTD_MOVE to work we need to set display dimensions (as pointer
-	 * move is clipped to the display rectangle. Here we do it directly
-	 * instead of adding a display device.
-	 */
-	disp->rect.p0.x = 0;
-	disp->rect.p0.y = 0;
-	disp->rect.p1.x = 500;
-	disp->rect.p1.y = 500;
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	w0->dpos.x = 10;
-	w0->dpos.y = 10;
-
-	w1->dpos.x = 400;
-	w1->dpos.y = 400;
-
-	ds_seat_set_focus(seat, w0);
-
-	event.type = PTD_MOVE;
-	event.dmove.x = 400;
-	event.dmove.y = 400;
-	rc = ds_display_post_ptd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = PTD_PRESS;
-	event.btn_num = 1;
-	rc = ds_display_post_ptd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	event.type = PTD_RELEASE;
-	event.btn_num = 1;
-	rc = ds_display_post_ptd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = PTD_MOVE;
-	event.dmove.x = -400 + 10;
-	event.dmove.y = -400 + 10;
-	rc = ds_display_post_ptd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = PTD_PRESS;
-	event.btn_num = 1;
-	rc = ds_display_post_ptd_event(disp, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_client_destroy(client);
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** ds_display_update_max_rect() updates maximization rectangle */
-PCUT_TEST(display_update_max_rect)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_client_t *client;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * We need to set display dimensions Here we do it directly
-	 * instead of adding a display device.
-	 */
-	disp->rect.p0.x = 0;
-	disp->rect.p0.y = 0;
-	disp->rect.p1.x = 500;
-	disp->rect.p1.y = 500;
-
-	/* Set maximize rectangle as well */
-	disp->max_rect = disp->rect;
-
-	/* A panel-like window at the bottom */
-	display_wnd_params_init(&params);
-	params.flags |= wndf_setpos;
-	params.pos.x = 0;
-	params.pos.y = 450;
-	params.rect.p0.x = 0;
-	params.rect.p0.y = 0;
-	params.rect.p1.x = 500;
-	params.rect.p1.y = 50;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/*
-	 * At this point the maximize rect should be unaltered because
-	 * the avoid flag has not been set.
-	 */
-	PCUT_ASSERT_INT_EQUALS(0, disp->max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, disp->max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(500, disp->max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(500, disp->max_rect.p1.y);
-
-	wnd->flags |= wndf_avoid;
-
-	/* Update maximize rectangle */
-	ds_display_update_max_rect(disp);
-
-	/* Verify maximize rectangle */
-	PCUT_ASSERT_INT_EQUALS(0, disp->max_rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(0, disp->max_rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(500, disp->max_rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(450, disp->max_rect.p1.y);
-
-	ds_window_destroy(wnd);
-	ds_client_destroy(client);
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** Cropping maximization rectangle from the top */
-PCUT_TEST(display_crop_max_rect_top)
-{
-	gfx_rect_t arect;
-	gfx_rect_t mrect;
-
-	arect.p0.x = 10;
-	arect.p0.y = 20;
-	arect.p1.x = 30;
-	arect.p1.y = 5;
-
-	mrect.p0.x = 10;
-	mrect.p0.y = 20;
-	mrect.p1.x = 30;
-	mrect.p1.y = 40;
-
-	ds_display_crop_max_rect(&arect, &mrect);
-
-	PCUT_ASSERT_INT_EQUALS(10, mrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(5, mrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, mrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(40, mrect.p1.y);
-}
-
-/** Cropping maximization rectangle from the bottom */
-PCUT_TEST(display_crop_max_rect_bottom)
-{
-	gfx_rect_t arect;
-	gfx_rect_t mrect;
-
-	arect.p0.x = 10;
-	arect.p0.y = 35;
-	arect.p1.x = 30;
-	arect.p1.y = 40;
-
-	mrect.p0.x = 10;
-	mrect.p0.y = 20;
-	mrect.p1.x = 30;
-	mrect.p1.y = 40;
-
-	ds_display_crop_max_rect(&arect, &mrect);
-
-	PCUT_ASSERT_INT_EQUALS(10, mrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, mrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, mrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(35, mrect.p1.y);
-}
-
-/** Cropping maximization rectangle from the left */
-PCUT_TEST(display_crop_max_rect_left)
-{
-	gfx_rect_t arect;
-	gfx_rect_t mrect;
-
-	arect.p0.x = 10;
-	arect.p0.y = 20;
-	arect.p1.x = 15;
-	arect.p1.y = 40;
-
-	mrect.p0.x = 10;
-	mrect.p0.y = 20;
-	mrect.p1.x = 30;
-	mrect.p1.y = 40;
-
-	ds_display_crop_max_rect(&arect, &mrect);
-
-	PCUT_ASSERT_INT_EQUALS(15, mrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, mrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, mrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(40, mrect.p1.y);
-}
-
-/** Cropping maximization rectangle from the right */
-PCUT_TEST(display_crop_max_rect_right)
-{
-	gfx_rect_t arect;
-	gfx_rect_t mrect;
-
-	arect.p0.x = 25;
-	arect.p0.y = 20;
-	arect.p1.x = 30;
-	arect.p1.y = 40;
-
-	mrect.p0.x = 10;
-	mrect.p0.y = 20;
-	mrect.p1.x = 30;
-	mrect.p1.y = 40;
-
-	ds_display_crop_max_rect(&arect, &mrect);
-
-	PCUT_ASSERT_INT_EQUALS(10, mrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(20, mrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(25, mrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(40, mrect.p1.y);
-}
-
-PCUT_EXPORT(display);
Index: pace/srv/hid/display/test/ievent.c
===================================================================
--- uspace/srv/hid/display/test/ievent.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <io/kbd_event.h>
-#include <pcut/pcut.h>
-
-#include "../display.h"
-#include "../types/display/ptd_event.h"
-#include "../ievent.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ievent);
-
-/* Test ds_ievent_init() and ds_ievent_fini() */
-PCUT_TEST(ievent_init_fini)
-{
-	ds_display_t *disp;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_ievent_init(disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_ievent_fini(disp);
-	ds_display_destroy(disp);
-}
-
-/* Test ds_ievent_post_kbd() */
-PCUT_TEST(ievent_post_kbd)
-{
-	ds_display_t *disp;
-	kbd_event_t kbd;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_ievent_init(disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	kbd.kbd_id = 0;
-	kbd.type = KEY_PRESS;
-	kbd.key = KC_ENTER;
-	kbd.mods = 0;
-	kbd.c = '\0';
-
-	rc = ds_ievent_post_kbd(disp, &kbd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_ievent_fini(disp);
-	ds_display_destroy(disp);
-}
-
-/* Test ds_ievent_post_ptd() */
-PCUT_TEST(ievent_post_ptd)
-{
-	ds_display_t *disp;
-	ptd_event_t ptd;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_ievent_init(disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ptd.pos_id = 0;
-	ptd.type = PTD_MOVE;
-	ptd.dmove.x = 0;
-	ptd.dmove.y = 0;
-	ptd.apos.x = 0;
-	ptd.apos.y = 0;
-	ptd.abounds.p0.x = 0;
-	ptd.abounds.p0.y = 0;
-	ptd.abounds.p1.x = 0;
-	ptd.abounds.p1.y = 0;
-
-	rc = ds_ievent_post_ptd(disp, &ptd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_ievent_fini(disp);
-	ds_display_destroy(disp);
-}
-
-PCUT_EXPORT(ievent);
Index: pace/srv/hid/display/test/main.c
===================================================================
--- uspace/srv/hid/display/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(cfgclient);
-PCUT_IMPORT(client);
-PCUT_IMPORT(clonegc);
-PCUT_IMPORT(cursor);
-PCUT_IMPORT(display);
-PCUT_IMPORT(ievent);
-PCUT_IMPORT(seat);
-PCUT_IMPORT(window);
-PCUT_IMPORT(wmclient);
-
-PCUT_MAIN();
Index: pace/srv/hid/display/test/seat.c
===================================================================
--- uspace/srv/hid/display/test/seat.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,703 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../client.h"
-#include "../display.h"
-#include "../seat.h"
-#include "../window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(seat);
-
-static void test_ds_ev_pending(void *);
-
-static ds_client_cb_t test_ds_client_cb = {
-	.ev_pending = test_ds_ev_pending
-};
-
-static void test_ds_ev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-/** Set focus. */
-PCUT_TEST(set_focus)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, wnd);
-	PCUT_ASSERT_EQUALS(wnd, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Evacuate focus from window.
- *
- * After evacuating no window should be focused
- */
-PCUT_TEST(evac_focus_one_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, wnd);
-	PCUT_ASSERT_EQUALS(wnd, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	ds_seat_evac_wnd_refs(seat, wnd);
-	PCUT_ASSERT_NULL(seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Evacuate popup reference from window.
- *
- * After evacuating no window should be set as the popup
- */
-PCUT_TEST(evac_popup)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-	params.flags |= wndf_popup;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(wnd, seat->popup);
-
-	ds_seat_evac_wnd_refs(seat, wnd);
-	PCUT_ASSERT_NULL(seat->popup);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Unfocus window when three windows are available */
-PCUT_TEST(unfocus_wnd_three_windows)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* w0 is at the top, then w1, then w2 */
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_unfocus(w0);
-
-	/* The previous window, w1, should be focused now */
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Unfocus window when two windows and one system window are available */
-PCUT_TEST(unfocus_wnd_two_windows_one_sys)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	params.flags |= wndf_system;
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	params.flags &= ~wndf_system;
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_unfocus(w0);
-
-	/* The previous non-system window is w1, w2 should be skipped */
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Unfocus window when one window and one system window is available */
-PCUT_TEST(unfocus_wnd_one_window_one_sys)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	params.flags |= wndf_system;
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	params.flags &= ~wndf_system;
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_unfocus(w0);
-
-	/* Since no non-system window is available, w1 should be focused */
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Unfocus window when one window is available */
-PCUT_TEST(unfocus_wnd_one_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_unfocus(w0);
-
-	/* Since no other window is availabe, no window should be focused */
-	PCUT_ASSERT_EQUALS(NULL, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Switch focus when another window is available. */
-PCUT_TEST(switch_focus_two_windows)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, w1);
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	ds_seat_switch_focus(seat);
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Switch focus with just one existing window.
- *
- * After switching the focus should remain with the same window.
- */
-PCUT_TEST(switch_focus_one_window)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, wnd);
-	PCUT_ASSERT_EQUALS(wnd, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	ds_seat_switch_focus(seat);
-	PCUT_ASSERT_EQUALS(wnd, seat->focus);
-	PCUT_ASSERT_FALSE(called_cb);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_seat_post_kbd_event() with Alt-Tab switches focus */
-PCUT_TEST(post_kbd_event_alt_tab)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	display_wnd_params_t params;
-	bool called_cb = false;
-	kbd_event_t event;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, w1);
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	event.type = KEY_PRESS;
-	event.mods = KM_ALT;
-	event.key = KC_TAB;
-	rc = ds_seat_post_kbd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_seat_post_kbd_event() with regular key press delivers to client queue */
-PCUT_TEST(post_kbd_event_regular)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	kbd_event_t event;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_focus(seat, wnd);
-	PCUT_ASSERT_EQUALS(wnd, seat->focus);
-
-	PCUT_ASSERT_TRUE(called_cb);
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	called_cb = false;
-
-	event.type = KEY_PRESS;
-	event.key = KC_ENTER;
-	event.mods = 0;
-	event.c = L'\0';
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_seat_post_kbd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_kbd, revent.etype);
-	PCUT_ASSERT_EQUALS(event.type, revent.ev.kbd.type);
-	PCUT_ASSERT_EQUALS(event.key, revent.ev.kbd.key);
-	PCUT_ASSERT_EQUALS(event.mods, revent.ev.kbd.mods);
-	PCUT_ASSERT_EQUALS(event.c, revent.ev.kbd.c);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_seat_post_ptd_event() with click on window switches focus
- */
-PCUT_TEST(post_ptd_event_wnd_switch)
-{
-	ds_display_t *disp;
-	ds_seat_t *seat;
-	ds_client_t *client;
-	ds_window_t *w0, *w1;
-	display_wnd_params_t params;
-	ptd_event_t event;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Set up display size to allow the pointer a range of movement */
-	disp->rect.p1.x = 500;
-	disp->rect.p1.y = 500;
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	w0->dpos.x = 10;
-	w0->dpos.y = 10;
-
-	w1->dpos.x = 400;
-	w1->dpos.y = 400;
-
-	/* New window gets focused event */
-	PCUT_ASSERT_TRUE(called_cb);
-
-	called_cb = false;
-
-	ds_seat_set_focus(seat, w0);
-
-	event.type = PTD_MOVE;
-	event.dmove.x = 400;
-	event.dmove.y = 400;
-	rc = ds_seat_post_ptd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	event.type = PTD_PRESS;
-	event.btn_num = 1;
-	rc = ds_seat_post_ptd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	event.type = PTD_MOVE;
-	event.dmove.x = -400 + 10;
-	event.dmove.y = -400 + 10;
-	rc = ds_seat_post_ptd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	event.type = PTD_PRESS;
-	event.btn_num = 1;
-	rc = ds_seat_post_ptd_event(seat, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-	called_cb = false;
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_client_destroy(client);
-	ds_seat_destroy(seat);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_seat_post_pos_event() */
-PCUT_TEST(post_pos_event)
-{
-	// XXX
-}
-
-/** Set WM cursor */
-PCUT_TEST(set_wm_cursor)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	bool called_cb = false;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_seat_set_wm_cursor(seat, disp->cursor[dcurs_size_ud]);
-	ds_seat_set_wm_cursor(seat, NULL);
-
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-PCUT_EXPORT(seat);
Index: pace/srv/hid/display/test/window.c
===================================================================
--- uspace/srv/hid/display/test/window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1413 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <gfx/context.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <str.h>
-
-#include "../client.h"
-#include "../display.h"
-#include "../idevcfg.h"
-#include "../seat.h"
-#include "../window.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(window);
-
-static errno_t dummy_set_color(void *, gfx_color_t *);
-static errno_t dummy_fill_rect(void *, gfx_rect_t *);
-
-static gfx_context_ops_t dummy_ops = {
-	.set_color = dummy_set_color,
-	.fill_rect = dummy_fill_rect
-};
-
-/** Test creating and destroying window */
-PCUT_TEST(create_destroy)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_bring_to_top() brings window to top */
-PCUT_TEST(bring_to_top)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* w2 should be on the top */
-	PCUT_ASSERT_EQUALS(w2, ds_display_first_window(disp));
-
-	/* Bring w1 to top */
-	ds_window_bring_to_top(w1);
-
-	/* Now w1 should be on the top */
-	PCUT_ASSERT_EQUALS(w1, ds_display_first_window(disp));
-
-	ds_window_destroy(w1);
-	ds_window_destroy(w2);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_resize(). */
-PCUT_TEST(window_resize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t offs;
-	gfx_rect_t nrect;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->dpos.x = 100;
-	wnd->dpos.y = 100;
-
-	offs.x = -2;
-	offs.y = -3;
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = 12;
-	params.rect.p1.y = 13;
-	rc = ds_window_resize(wnd, &offs, &nrect);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(98, wnd->dpos.x);
-	PCUT_ASSERT_INT_EQUALS(97, wnd->dpos.y);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_get_pos(). */
-PCUT_TEST(get_pos)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t pos;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->dpos.x = 100;
-	wnd->dpos.y = 100;
-
-	ds_window_get_pos(wnd, &pos);
-
-	PCUT_ASSERT_INT_EQUALS(100, pos.x);
-	PCUT_ASSERT_INT_EQUALS(100, pos.y);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_get_max_rect(). */
-PCUT_TEST(get_max_rect)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_rect_t rect;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->dpos.x = 100;
-	wnd->dpos.y = 100;
-
-	ds_window_get_max_rect(wnd, &rect);
-
-	PCUT_ASSERT_INT_EQUALS(disp->rect.p0.x, rect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(disp->rect.p0.y, rect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(disp->rect.p1.x, rect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(disp->rect.p1.y, rect.p1.y);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_minimize(). */
-PCUT_TEST(window_minimize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_minimize(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(wndf_minimized, wnd->flags & wndf_minimized);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_unminimize(). */
-PCUT_TEST(window_unminimize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.flags |= wndf_minimized;
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_unminimize(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(0, wnd->flags & wndf_minimized);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_maximize(). */
-PCUT_TEST(window_maximize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->dpos.x = 100;
-	wnd->dpos.y = 100;
-
-	rc = ds_window_maximize(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(wndf_maximized, wnd->flags & wndf_maximized);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_unmaximize(). */
-PCUT_TEST(window_unmaximize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->dpos.x = 100;
-	wnd->dpos.y = 100;
-
-	rc = ds_window_maximize(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_unmaximize(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(0, wnd->flags & wndf_maximized);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_get_ctx(). */
-PCUT_TEST(window_get_ctx)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	gc = ds_window_get_ctx(wnd);
-	PCUT_ASSERT_NOT_NULL(gc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_is_visible() */
-PCUT_TEST(is_visible)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 10;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(ds_window_is_visible(wnd));
-
-	wnd->flags |= wndf_minimized;
-
-	PCUT_ASSERT_FALSE(ds_window_is_visible(wnd));
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_post_kbd_event() with Alt-F4 sends close event */
-PCUT_TEST(window_post_kbd_event_alt_f4)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	ds_window_t *rwindow;
-	display_wnd_ev_t revent;
-	display_wnd_params_t params;
-	kbd_event_t event;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* New window gets focused event */
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	event.type = KEY_PRESS;
-	event.mods = KM_ALT;
-	event.key = KC_F4;
-	rc = ds_window_post_kbd_event(wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd, rwindow);
-	PCUT_ASSERT_EQUALS(wev_close, revent.etype);
-
-	rc = ds_client_get_event(client, &rwindow, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_post_pos_event() */
-PCUT_TEST(window_post_pos_event)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	pos_event_t event;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_idle, wnd->state);
-
-	wnd->dpos.x = 10;
-	wnd->dpos.y = 10;
-
-	event.type = POS_PRESS;
-	event.btn_num = 2;
-	event.hpos = 10;
-	event.vpos = 10;
-	rc = ds_window_post_pos_event(wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_moving, wnd->state);
-
-	event.type = POS_UPDATE;
-	event.hpos = 11;
-	event.vpos = 12;
-	rc = ds_window_post_pos_event(wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_moving, wnd->state);
-	/* Window position does not update until after release */
-	PCUT_ASSERT_INT_EQUALS(10, wnd->dpos.x);
-	PCUT_ASSERT_INT_EQUALS(10, wnd->dpos.y);
-
-	event.type = POS_RELEASE;
-	event.hpos = 13;
-	event.vpos = 14;
-
-	rc = ds_window_post_pos_event(wnd, &event);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_idle, wnd->state);
-	PCUT_ASSERT_INT_EQUALS(13, wnd->dpos.x);
-	PCUT_ASSERT_INT_EQUALS(14, wnd->dpos.y);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_post_focus_event() */
-PCUT_TEST(window_post_focus_event)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_post_focus_event(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_post_unfocus_event() */
-PCUT_TEST(window_post_unfocus_event)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_post_focus_event(wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_move_req() */
-PCUT_TEST(window_move_req)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_idle, wnd->state);
-
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-	ds_window_move_req(wnd, &pos, pos_id);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_moving, wnd->state);
-	PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_resize_req() */
-PCUT_TEST(window_resize_req)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_idle, wnd->state);
-
-	pos.x = 42;
-	pos.y = 43;
-	pos_id = 44;
-	ds_window_resize_req(wnd, display_wr_top_right, &pos, pos_id);
-
-	PCUT_ASSERT_INT_EQUALS(dsw_resizing, wnd->state);
-	PCUT_ASSERT_INT_EQUALS(display_wr_top_right, wnd->rsztype);
-	PCUT_ASSERT_INT_EQUALS(pos.x, wnd->orig_pos.x);
-	PCUT_ASSERT_INT_EQUALS(pos.y, wnd->orig_pos.y);
-	PCUT_ASSERT_INT_EQUALS(pos_id, wnd->orig_pos_id);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-PCUT_TEST(window_calc_resize)
-{
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	gfx_coord2_t dresize;
-	gfx_coord2_t dresizen;
-	gfx_coord2_t dresizeb;
-	gfx_coord2_t dresizebn;
-	gfx_rect_t nrect;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = 10;
-	params.rect.p0.y = 11;
-	params.rect.p1.x = 30;
-	params.rect.p1.y = 31;
-	params.min_size.x = 2;
-	params.min_size.y = 3;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->state = dsw_resizing;
-
-	dresize.x = 5;
-	dresize.y = 6;
-
-	dresizen.x = -5;
-	dresizen.y = -6;
-
-	dresizeb.x = 50;
-	dresizeb.y = 60;
-
-	dresizebn.x = -50;
-	dresizebn.y = -60;
-
-	/* Resize top */
-	wnd->rsztype = display_wr_top;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	/* Resize top left */
-	wnd->rsztype = display_wr_top_left;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	/* Resize left */
-	wnd->rsztype = display_wr_left;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	/* Resize bottom left */
-	wnd->rsztype = display_wr_bottom_left;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(15, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(-40, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y);
-
-	/* Resize bottom */
-	wnd->rsztype = display_wr_bottom;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(30, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y);
-
-	/* Resize bottom right */
-	wnd->rsztype = display_wr_bottom_right;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(37, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(91, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(14, nrect.p1.y);
-
-	/* Resize right */
-	wnd->rsztype = display_wr_right;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(11, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	/* Resize top right */
-	wnd->rsztype = display_wr_top_right;
-
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(17, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(35, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizen, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(5, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(25, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizeb, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(28, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(80, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_calc_resize(wnd, &dresizebn, &nrect);
-	PCUT_ASSERT_INT_EQUALS(10, nrect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(-49, nrect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(12, nrect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(31, nrect.p1.y);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_set_cursor() */
-PCUT_TEST(window_set_cursor)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_arrow], wnd->cursor);
-
-	rc = ds_window_set_cursor(wnd, -1);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_arrow], wnd->cursor);
-
-	// Check that invalid cursors cannot be set: ignore enum conversions
-	// as we are out-of-bounds
-#pragma GCC diagnostic push
-#if defined(__GNUC__) && (__GNUC__ >= 10)
-#pragma GCC diagnostic ignored "-Wenum-conversion"
-#endif
-	rc = ds_window_set_cursor(wnd, dcurs_limit);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_arrow], wnd->cursor);
-
-	rc = ds_window_set_cursor(wnd, dcurs_limit + 1);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_arrow], wnd->cursor);
-#pragma GCC diagnostic pop
-
-	rc = ds_window_set_cursor(wnd, dcurs_size_lr);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_size_lr], wnd->cursor);
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_window_set_caption() */
-PCUT_TEST(window_set_caption)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(wnd->display->cursor[dcurs_arrow], wnd->cursor);
-
-	rc = ds_window_set_caption(wnd, "Hello");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_INT_EQUALS(0, str_cmp("Hello", wnd->caption));
-
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** ds_window_find_next() finds next window by flags */
-PCUT_TEST(window_find_next)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	w1->flags |= wndf_minimized;
-
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	w2->flags |= wndf_system;
-
-	wnd = ds_window_find_next(w0, wndf_minimized);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_window_find_next(w0, wndf_system);
-	PCUT_ASSERT_EQUALS(w2, wnd);
-
-	wnd = ds_window_find_next(w0, wndf_maximized);
-	PCUT_ASSERT_NULL(wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_window_destroy(w2);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** ds_window_find_prev() finds previous window by flags */
-PCUT_TEST(window_find_prev)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	ds_window_t *w2;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w2);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	w2->flags |= wndf_system;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	w1->flags |= wndf_minimized;
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd = ds_window_find_prev(w0, wndf_minimized);
-	PCUT_ASSERT_EQUALS(w1, wnd);
-
-	wnd = ds_window_find_prev(w0, wndf_system);
-	PCUT_ASSERT_EQUALS(w2, wnd);
-
-	wnd = ds_window_find_prev(w0, wndf_maximized);
-	PCUT_ASSERT_NULL(wnd);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_window_destroy(w2);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** ds_window_unfocus() switches to another window */
-PCUT_TEST(window_unfocus)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat;
-	ds_window_t *w0;
-	ds_window_t *w1;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &w1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_window_create(client, &params, &w0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_EQUALS(w0, seat->focus);
-
-	ds_window_unfocus(w0);
-
-	PCUT_ASSERT_EQUALS(w1, seat->focus);
-
-	ds_window_destroy(w0);
-	ds_window_destroy(w1);
-	ds_seat_destroy(seat);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-/** ds_window_orig_seat() correctly compares seats */
-PCUT_TEST(window_orig_seat)
-{
-	gfx_context_t *gc;
-	ds_display_t *disp;
-	ds_client_t *client;
-	ds_seat_t *seat0;
-	ds_seat_t *seat1;
-	sysarg_t devid0;
-	sysarg_t devid1;
-	ds_idevcfg_t *cfg0;
-	ds_idevcfg_t *cfg1;
-	ds_window_t *wnd;
-	display_wnd_params_t params;
-	errno_t rc;
-
-	rc = gfx_context_new(&dummy_ops, NULL, &gc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_display_create(gc, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_client_create(disp, NULL, NULL, &client);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Alice", &seat0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_seat_create(disp, "Bob", &seat1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	display_wnd_params_init(&params);
-	params.rect.p0.x = params.rect.p0.y = 0;
-	params.rect.p1.x = params.rect.p1.y = 1;
-
-	rc = ds_window_create(client, &params, &wnd);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	devid0 = 42;
-	devid1 = 43;
-
-	rc = ds_idevcfg_create(disp, devid0, seat0, &cfg0);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_idevcfg_create(disp, devid1, seat1, &cfg1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	wnd->state = dsw_moving;
-	wnd->orig_pos_id = devid0;
-
-	PCUT_ASSERT_TRUE(ds_window_orig_seat(wnd, devid0));
-	PCUT_ASSERT_FALSE(ds_window_orig_seat(wnd, devid1));
-
-	ds_idevcfg_destroy(cfg0);
-	ds_idevcfg_destroy(cfg1);
-	ds_window_destroy(wnd);
-	ds_seat_destroy(seat0);
-	ds_seat_destroy(seat1);
-	ds_client_destroy(client);
-	ds_display_destroy(disp);
-}
-
-static errno_t dummy_set_color(void *arg, gfx_color_t *color)
-{
-	return EOK;
-}
-
-static errno_t dummy_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	return EOK;
-}
-
-PCUT_EXPORT(window);
Index: pace/srv/hid/display/test/wmclient.c
===================================================================
--- uspace/srv/hid/display/test/wmclient.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,220 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <disp_srv.h>
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../display.h"
-#include "../wmclient.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(wmclient);
-
-static void test_ds_wmev_pending(void *);
-
-static ds_wmclient_cb_t test_ds_wmclient_cb = {
-	.ev_pending = test_ds_wmev_pending
-};
-
-static void test_ds_wmev_pending(void *arg)
-{
-	bool *called_cb = (bool *) arg;
-	*called_cb = true;
-}
-
-/** WM client creation and destruction. */
-PCUT_TEST(create_destroy)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, NULL, &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_wmclient_get_event(), ds_wmclient_post_wnd_added_event(). */
-PCUT_TEST(client_get_post_wnd_added_event)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	wndmgt_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, &called_cb,
-	    &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-	wnd_id = 42;
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_wmclient_post_wnd_added_event(wmclient, wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd_id, revent.wnd_id);
-	PCUT_ASSERT_EQUALS(wmev_window_added, revent.etype);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_wmclient_get_event(), ds_wmclient_post_wnd_removed_event(). */
-PCUT_TEST(client_get_post_wnd_removed_event)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	wndmgt_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, &called_cb,
-	    &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-	wnd_id = 42;
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_wmclient_post_wnd_removed_event(wmclient, wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd_id, revent.wnd_id);
-	PCUT_ASSERT_EQUALS(wmev_window_removed, revent.etype);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_wmclient_get_event(), ds_wmclient_post_wnd_changed_event(). */
-PCUT_TEST(client_get_post_wnd_changed_event)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	wndmgt_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, &called_cb,
-	    &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	called_cb = false;
-	wnd_id = 42;
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	rc = ds_wmclient_post_wnd_changed_event(wmclient, wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(called_cb);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(wnd_id, revent.wnd_id);
-	PCUT_ASSERT_EQUALS(wmev_window_changed, revent.etype);
-
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-/** Test ds_wmclient_purge_events() */
-PCUT_TEST(purge_events)
-{
-	ds_display_t *disp;
-	ds_wmclient_t *wmclient;
-	wndmgt_ev_t revent;
-	bool called_cb = NULL;
-	sysarg_t wnd_id;
-	errno_t rc;
-
-	rc = ds_display_create(NULL, df_none, &disp);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, &called_cb,
-	    &wmclient);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Post window added event */
-	wnd_id = 42;
-	rc = ds_wmclient_post_wnd_added_event(wmclient, wnd_id);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Purge it */
-	ds_wmclient_purge_events(wmclient);
-
-	/* The queue should be empty now */
-	rc = ds_wmclient_get_event(wmclient, &revent);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	ds_wmclient_destroy(wmclient);
-	ds_display_destroy(disp);
-}
-
-PCUT_EXPORT(wmclient);
Index: pace/srv/hid/display/types/display/cfgclient.h
===================================================================
--- uspace/srv/hid/display/types/display/cfgclient.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server CFG client type
- */
-
-#ifndef TYPES_DISPLAY_CFGCLIENT_H
-#define TYPES_DISPLAY_CFGCLIENT_H
-
-#include <adt/list.h>
-#include <dispcfg.h>
-
-/** Display server CFG client callbacks */
-typedef struct {
-	void (*ev_pending)(void *);
-} ds_cfgclient_cb_t;
-
-/** Display server WM client */
-typedef struct ds_cfgclient {
-	/** Parent display */
-	struct ds_display *display;
-	/** Callbacks */
-	ds_cfgclient_cb_t *cb;
-	/** Callback argument */
-	void *cb_arg;
-	/** Link to @c display->cfgclients */
-	link_t lcfgclients;
-	/** Event queue (of ds_window_ev_t) */
-	list_t events;
-} ds_cfgclient_t;
-
-/** WM client event queue entry */
-typedef struct {
-	/** Link to event queue */
-	link_t levents;
-	/** WM client to which the event is delivered */
-	ds_cfgclient_t *cfgclient;
-	/** Event */
-	dispcfg_ev_t event;
-} ds_cfgclient_ev_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/client.h
===================================================================
--- uspace/srv/hid/display/types/display/client.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server client type
- */
-
-#ifndef TYPES_DISPLAY_CLIENT_H
-#define TYPES_DISPLAY_CLIENT_H
-
-#include <adt/list.h>
-
-typedef sysarg_t ds_wnd_id_t;
-
-/** Display server client callbacks */
-typedef struct {
-	void (*ev_pending)(void *);
-} ds_client_cb_t;
-
-/** Display server client */
-typedef struct ds_client {
-	/** Parent display */
-	struct ds_display *display;
-	/** Callbacks */
-	ds_client_cb_t *cb;
-	/** Callback argument */
-	void *cb_arg;
-	/** Link to @c display->clients */
-	link_t lclients;
-	/** Windows (of ds_window_t) */
-	list_t windows;
-	/** Event queue (of ds_window_ev_t) */
-	list_t events;
-} ds_client_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/clonegc.h
===================================================================
--- uspace/srv/hid/display/types/display/clonegc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Cloning graphic context
- */
-
-#ifndef TYPES_DISPLAY_CLONEGC_H
-#define TYPES_DISPLAY_CLONEGC_H
-
-#include <adt/list.h>
-#include <gfx/context.h>
-
-/** Cloning graphic context.
- *
- * A graphic context that clones rendering to a number of GCs. We need
- * to clone every bitmap to every GC so we end up with a matrix-like
- * structure (made of linked lists).
- *
- * ds_clonegc_output_t x ds_clonegc_bitmap_t -> ds_clonegc_outbitmap_t.
- */
-typedef struct {
-	/** Graphic context */
-	gfx_context_t *gc;
-	/** Output GCs (of ds_clonegc_output_t) */
-	list_t outputs;
-	/** Bitmaps (of ds_clonegc_bitmap_t) */
-	list_t bitmaps;
-} ds_clonegc_t;
-
-/** Clone GC output */
-typedef struct {
-	/** Containing clone GC */
-	ds_clonegc_t *clonegc;
-	/** Link to @c clonegc->outputs */
-	link_t loutputs;
-	/** Output GC */
-	gfx_context_t *gc;
-	/** Output bitmaps (of ds_clonegc_outbitmap_t) */
-	list_t obitmaps;
-} ds_clonegc_output_t;
-
-/** Bitmap in cloning GC.
- *
- * Has a list of output bitmaps for all outputs.
- */
-typedef struct {
-	/** Containing clone GC */
-	ds_clonegc_t *clonegc;
-	/** Bitmap parameters */
-	gfx_bitmap_params_t params;
-	/** Bitmap allocation */
-	gfx_bitmap_alloc_t alloc;
-	/** Link to @c clonegc->bitmaps */
-	link_t lbitmaps;
-	/** Output bitmaps (of ds_clonegc_outbitmap_t) */
-	list_t obitmaps;
-} ds_clonegc_bitmap_t;
-
-/** Output bitmap in cloning GC.
- *
- * It is contained in two linked lists. The list of all output bitmaps for
- * a particular output and the list of all output bitmaps for a particular
- * bitmap.
- */
-typedef struct {
-	/** Containing output */
-	ds_clonegc_output_t *output;
-	/** Containing bitmap */
-	ds_clonegc_bitmap_t *bitmap;
-	/** Link to @c output->obitmaps */
-	link_t lobitmaps;
-	/** Linkt ot @c bitmap->obitmaps */
-	link_t lbbitmaps;
-	/** Output-specific bitmap */
-	gfx_bitmap_t *obitmap;
-} ds_clonegc_outbitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/cursimg.h
===================================================================
--- uspace/srv/hid/display/types/display/cursimg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server cursor image type
- */
-
-#ifndef TYPES_DISPLAY_CURSIMG_H
-#define TYPES_DISPLAY_CURSIMG_H
-
-#include <gfx/coord.h>
-#include <stdint.h>
-
-/** Bitmap in display server window GC */
-typedef struct {
-	gfx_rect_t rect;
-	/** Image, 0 = background, 1 = black, 2 = white */
-	const uint8_t *image;
-} ds_cursimg_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/cursor.h
===================================================================
--- uspace/srv/hid/display/types/display/cursor.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server cursor type
- */
-
-#ifndef TYPES_DISPLAY_CURSOR_H
-#define TYPES_DISPLAY_CURSOR_H
-
-#include <adt/list.h>
-#include <gfx/bitmap.h>
-#include <gfx/coord.h>
-
-/** Bitmap in display server window GC */
-typedef struct ds_cursor {
-	/** Containing display */
-	struct ds_display *display;
-	/** Link to list of all cursors in display */
-	link_t ldisplay;
-	/** Bitmap in the display device */
-	gfx_bitmap_t *bitmap;
-	/** Rectangle represented in the image */
-	gfx_rect_t rect;
-	/** Cursor image */
-	const uint8_t *image;
-} ds_cursor_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/ddev.h
===================================================================
--- uspace/srv/hid/display/types/display/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display device type
- */
-
-#ifndef TYPES_DISPLAY_DDEV_H
-#define TYPES_DISPLAY_DDEV_H
-
-#include <adt/list.h>
-#include <ddev.h>
-#include <gfx/context.h>
-#include <loc.h>
-
-/** Display server display device */
-typedef struct ds_ddev {
-	/** Parent display */
-	struct ds_display *display;
-	/** Link to display->ddevs */
-	link_t lddevs;
-	/** Link to output->ddevs */
-	link_t loutdevs;
-	/** Device GC */
-	gfx_context_t *gc;
-	/** Display device information */
-	ddev_info_t info;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Service name */
-	char *svc_name;
-	/** Underlying display device */
-	ddev_t *dd;
-} ds_ddev_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/display.h
===================================================================
--- uspace/srv/hid/display/types/display/display.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server display type
- */
-
-#ifndef TYPES_DISPLAY_DISPLAY_H
-#define TYPES_DISPLAY_DISPLAY_H
-
-#include <adt/list.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <io/input.h>
-#include <memgfx/memgc.h>
-#include <types/display/cursor.h>
-#include "cursor.h"
-#include "clonegc.h"
-#include "seat.h"
-#include "window.h"
-
-/** Display flags */
-typedef enum {
-	/** No flags enabled */
-	df_none = 0,
-	/** Use double buffer for display */
-	df_disp_double_buf = 0x1
-} ds_display_flags_t;
-
-/** Display server display */
-typedef struct ds_display {
-	/** Synchronize access to display */
-	fibril_mutex_t lock;
-	/** Clients (of ds_client_t) */
-	list_t clients;
-	/** WM clients (of ds_wmclient_t) */
-	list_t wmclients;
-	/** CFG clients (of ds_cfgclient_t) */
-	list_t cfgclients;
-
-	/** Next ID to assign to a window.
-	 *
-	 * XXX Window IDs need to be unique per display just because
-	 * we don't have a way to match GC connection to the proper
-	 * client. Really this should be in ds_client_t and the ID
-	 * space should be per client.
-	 */
-	ds_wnd_id_t next_wnd_id;
-	/** Next ID to assign to a seat */
-	ds_seat_id_t next_seat_id;
-	/** Input service */
-	input_t *input;
-
-	/** Seats (of ds_seat_t) */
-	list_t seats;
-
-	/** Windows (of ds_window_t) in stacking order */
-	list_t windows;
-
-	/** Display devices (of ds_ddev_t) */
-	list_t ddevs;
-
-	/** Input device configuration entries (of ds_idevcfg_t) */
-	list_t idevcfgs;
-
-	/** Queue of input events */
-	list_t ievents;
-
-	/** Input event processing fibril ID */
-	fid_t ievent_fid;
-	/** Input event condition variable */
-	fibril_condvar_t ievent_cv;
-	/** Signal input event fibril to quit */
-	bool ievent_quit;
-	/** Input event fibril terminated */
-	bool ievent_done;
-
-	/** Background color */
-	gfx_color_t *bg_color;
-
-	/** Stock cursors */
-	ds_cursor_t *cursor[dcurs_limit];
-
-	/** List of all cursors */
-	list_t cursors;
-
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-
-	/** Maximize rectangle */
-	gfx_rect_t max_rect;
-
-	/** Backbuffer bitmap or @c NULL if not double-buffering */
-	gfx_bitmap_t *backbuf;
-
-	/** Backbuffer GC or @c NULL if not double-buffering */
-	mem_gc_t *bbgc;
-
-	/** Frontbuffer (clone) GC */
-	ds_clonegc_t *fbgc;
-
-	/** Backbuffer dirty rectangle */
-	gfx_rect_t dirty_rect;
-
-	/** Display flags */
-	ds_display_flags_t flags;
-} ds_display_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/idev.h
===================================================================
--- uspace/srv/hid/display/types/display/idev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server input device type
- */
-
-#ifndef TYPES_DISPLAY_IDEV_H
-#define TYPES_DISPLAY_IDEV_H
-
-#include <types/common.h>
-
-typedef sysarg_t ds_idev_id_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/idevcfg.h
===================================================================
--- uspace/srv/hid/display/types/display/idevcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server input device configuration type
- */
-
-#ifndef TYPES_DISPLAY_IDEVCFG_H
-#define TYPES_DISPLAY_IDEVCFG_H
-
-#include <adt/list.h>
-#include <loc.h>
-
-/** Display server input device configuration */
-typedef struct ds_idevcfg {
-	/** Parent display */
-	struct ds_display *display;
-	/** Link to display->idevcfgs */
-	link_t ldispidcfgs;
-	/** Link to seat->idevcfgs */
-	link_t lseatidcfgs;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Seat to which this device is assigned */
-	struct ds_seat *seat;
-} ds_idevcfg_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/ievent.h
===================================================================
--- uspace/srv/hid/display/types/display/ievent.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server input event types
- */
-
-#ifndef TYPES_DISPLAY_IEVENT_H
-#define TYPES_DISPLAY_IEVENT_H
-
-#include <adt/list.h>
-#include <io/kbd_event.h>
-#include "ptd_event.h"
-
-/** Display server input event type */
-typedef enum {
-	/** Keyboard event */
-	det_kbd,
-	/** Pointing device event */
-	det_ptd
-} ds_ievent_type_t;
-
-/** Display server input event */
-typedef struct ds_ievent {
-	/** Parent display */
-	struct ds_display *display;
-	/** Link to display->ievents */
-	link_t lievents;
-	/** Input event type */
-	ds_ievent_type_t etype;
-	/** Event data */
-	union {
-		/** Keyboard event */
-		kbd_event_t kbd;
-		/** Pointing device ievent */
-		ptd_event_t ptd;
-	} ev;
-} ds_ievent_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/output.h
===================================================================
--- uspace/srv/hid/display/types/display/output.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server output
- */
-
-#ifndef TYPES_DISPLAY_OUTPUT_H
-#define TYPES_DISPLAY_OUTPUT_H
-
-#include <adt/list.h>
-#include <fibril_synch.h>
-
-/** Display server output */
-typedef struct ds_output {
-	/** Discovery lock */
-	fibril_mutex_t lock;
-	/** Display devices (of ds_ddev_t) */
-	list_t ddevs;
-	/** Display to which we will be adding discovered devices */
-	struct ds_display *def_display;
-} ds_output_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/ptd_event.h
===================================================================
--- uspace/srv/hid/display/types/display/ptd_event.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup libc
- * @{
- */
-/** @file
- */
-
-#ifndef TYPES_DISPLAY_PTD_EVENT_H
-#define TYPES_DISPLAY_PTD_EVENT_H
-
-#include <gfx/coord.h>
-
-typedef enum {
-	PTD_MOVE,
-	PTD_ABS_MOVE,
-	PTD_PRESS,
-	PTD_RELEASE,
-	PTD_DCLICK
-} ptd_event_type_t;
-
-/** Pointing device event */
-typedef struct {
-	/** Positioning device ID */
-	unsigned pos_id;
-	/** PTD event type */
-	ptd_event_type_t type;
-	/** Button number for PTD_PRESS or PTD_RELEASE */
-	int btn_num;
-	/** Relative move vector for PTD_MOVE */
-	gfx_coord2_t dmove;
-	/** Absolute position for PTD_ABS_MOVE */
-	gfx_coord2_t apos;
-	/** Absolute position bounds for PTD_ABS_MOVE */
-	gfx_rect_t abounds;
-} ptd_event_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/seat.h
===================================================================
--- uspace/srv/hid/display/types/display/seat.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server seat type
- */
-
-#ifndef TYPES_DISPLAY_SEAT_H
-#define TYPES_DISPLAY_SEAT_H
-
-#include <adt/list.h>
-#include <gfx/coord.h>
-
-typedef sysarg_t ds_seat_id_t;
-
-/** Display server seat */
-typedef struct ds_seat {
-	/** Containing display */
-	struct ds_display *display;
-	/** Link to display->seats */
-	link_t lseats;
-	/** Seat ID */
-	ds_seat_id_t id;
-	/** Seat name */
-	char *name;
-	/** Input device configurations mapping to this seat */
-	list_t idevcfgs;
-	/** Window this seat is focused on */
-	struct ds_window *focus;
-	/** This seat's popup window */
-	struct ds_window *popup;
-	/** Cursor selected by client */
-	struct ds_cursor *client_cursor;
-	/** Cursor override for window management or @c NULL */
-	struct ds_cursor *wm_cursor;
-	/** Pointer position */
-	gfx_coord2_t pntpos;
-} ds_seat_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/window.h
===================================================================
--- uspace/srv/hid/display/types/display/window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server window type
- */
-
-#ifndef TYPES_DISPLAY_WINDOW_H
-#define TYPES_DISPLAY_WINDOW_H
-
-#include <adt/list.h>
-#include <display/event.h>
-#include <display/wndparams.h>
-#include <display/wndresize.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <io/pixel.h>
-#include <io/pixelmap.h>
-#include <memgfx/memgc.h>
-
-typedef sysarg_t ds_wnd_id_t;
-
-/** Window state */
-typedef enum {
-	/** Idle */
-	dsw_idle,
-	/** Moving by mouse drag */
-	dsw_moving,
-	/** Resizing by mouse drag */
-	dsw_resizing
-} ds_window_state_t;
-
-/** Display server window */
-typedef struct ds_window {
-	/** Parent client */
-	struct ds_client *client;
-	/** Link to @c client->windows */
-	link_t lcwindows;
-	/** Containing display */
-	struct ds_display *display;
-	/** Link to @c display->windows */
-	link_t ldwindows;
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-	/** Display position */
-	gfx_coord2_t dpos;
-	/** Preview position (when moving) */
-	gfx_coord2_t preview_pos;
-	/** Preview rectangle (when resizing) */
-	gfx_rect_t preview_rect;
-	/** Minimum size */
-	gfx_coord2_t min_size;
-	/** Normal rectangle (when not maximized or minimized) */
-	gfx_rect_t normal_rect;
-	/** Normal display position (when not maximized or minimized) */
-	gfx_coord2_t normal_dpos;
-	/** Window ID */
-	ds_wnd_id_t id;
-	/** Memory GC */
-	mem_gc_t *mgc;
-	/** Graphic context */
-	gfx_context_t *gc;
-	/** Bitmap in the display device */
-	gfx_bitmap_t *bitmap;
-	/** Pixel map for accessing the window bitmap */
-	pixelmap_t pixelmap;
-	/** Current drawing color */
-	pixel_t color;
-	/** Cursor set by client */
-	struct ds_cursor *cursor;
-	/** Window flags */
-	display_wnd_flags_t flags;
-	/** State */
-	ds_window_state_t state;
-	/** Original position before started to move or resize the window */
-	gfx_coord2_t orig_pos;
-	/** Positioning device that started the move or resize */
-	sysarg_t orig_pos_id;
-	/** Window resize type (if state is dsw_resizing) */
-	display_wnd_rsztype_t rsztype;
-	/** Window caption */
-	char *caption;
-	/** Number of foci */
-	unsigned nfocus;
-} ds_window_t;
-
-/** Window event queue entry */
-typedef struct {
-	/** Link to event queue */
-	link_t levents;
-	/** Window to which the event is delivered */
-	ds_window_t *window;
-	/** Event */
-	display_wnd_ev_t event;
-} ds_window_ev_t;
-
-/** Bitmap in display server window GC */
-typedef struct {
-	/** Containing window */
-	ds_window_t *wnd;
-	/** Display bitmap */
-	gfx_bitmap_t *bitmap;
-	/** Bounding rectangle */
-	gfx_rect_t rect;
-	/** Bitmap flags */
-	gfx_bitmap_flags_t flags;
-	/** Key color */
-	pixel_t key_color;
-} ds_window_bitmap_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/types/display/wmclient.h
===================================================================
--- uspace/srv/hid/display/types/display/wmclient.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server WM client type
- */
-
-#ifndef TYPES_DISPLAY_WMCLIENT_H
-#define TYPES_DISPLAY_WMCLIENT_H
-
-#include <adt/list.h>
-#include <wndmgt.h>
-
-/** Display server WM client callbacks */
-typedef struct {
-	void (*ev_pending)(void *);
-} ds_wmclient_cb_t;
-
-/** Display server WM client */
-typedef struct ds_wmclient {
-	/** Parent display */
-	struct ds_display *display;
-	/** Callbacks */
-	ds_wmclient_cb_t *cb;
-	/** Callback argument */
-	void *cb_arg;
-	/** Link to @c display->wmclients */
-	link_t lwmclients;
-	/** Event queue (of ds_window_ev_t) */
-	list_t events;
-} ds_wmclient_t;
-
-/** WM client event queue entry */
-typedef struct {
-	/** Link to event queue */
-	link_t levents;
-	/** WM client to which the event is delivered */
-	ds_wmclient_t *wmclient;
-	/** Event */
-	wndmgt_ev_t event;
-} ds_wmclient_ev_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/window.c
===================================================================
--- uspace/srv/hid/display/window.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1241 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server window
- */
-
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <io/log.h>
-#include <io/pixelmap.h>
-#include <macros.h>
-#include <memgfx/memgc.h>
-#include <stdlib.h>
-#include <str.h>
-#include <wndmgt.h>
-#include "client.h"
-#include "display.h"
-#include "seat.h"
-#include "window.h"
-#include "wmclient.h"
-
-static void ds_window_invalidate_cb(void *, gfx_rect_t *);
-static void ds_window_update_cb(void *);
-static void ds_window_get_preview_rect(ds_window_t *, gfx_rect_t *);
-
-static mem_gc_cb_t ds_window_mem_gc_cb = {
-	.invalidate = ds_window_invalidate_cb,
-	.update = ds_window_update_cb
-};
-
-/** Create window.
- *
- * Create graphics context for rendering into a window.
- *
- * @param client Client owning the window
- * @param params Window parameters
- * @param rwnd Place to store pointer to new window.
- *
- * @return EOK on success or an error code
- */
-errno_t ds_window_create(ds_client_t *client, display_wnd_params_t *params,
-    ds_window_t **rwnd)
-{
-	ds_window_t *wnd = NULL;
-	ds_seat_t *seat;
-	gfx_context_t *dgc;
-	gfx_coord2_t dims;
-	gfx_bitmap_params_t bparams;
-	gfx_bitmap_alloc_t alloc;
-	errno_t rc;
-
-	wnd = calloc(1, sizeof(ds_window_t));
-	if (wnd == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Caption */
-	wnd->caption = str_dup(params->caption);
-	if (wnd->caption == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	wnd->flags = params->flags;
-
-	ds_client_add_window(client, wnd);
-	ds_display_add_window(client->display, wnd);
-
-	gfx_bitmap_params_init(&bparams);
-	bparams.rect = params->rect;
-
-	/* Allocate window bitmap */
-
-	dgc = ds_display_get_gc(wnd->display);
-	if (dgc != NULL) {
-		rc = gfx_bitmap_create(dgc, &bparams, NULL, &wnd->bitmap);
-		if (rc != EOK)
-			goto error;
-
-		rc = gfx_bitmap_get_alloc(wnd->bitmap, &alloc);
-		if (rc != EOK)
-			goto error;
-
-		gfx_rect_dims(&params->rect, &dims);
-		wnd->pixelmap.width = dims.x;
-		wnd->pixelmap.height = dims.y;
-		wnd->pixelmap.data = alloc.pixels;
-	} else {
-		/* This is just for unit tests */
-		gfx_rect_dims(&params->rect, &dims);
-		alloc.pitch = dims.x * sizeof(uint32_t);
-		alloc.off0 = 0;
-		alloc.pixels = calloc(1, alloc.pitch * dims.y);
-	}
-
-	rc = mem_gc_create(&params->rect, &alloc, &ds_window_mem_gc_cb,
-	    (void *)wnd, &wnd->mgc);
-	if (rc != EOK)
-		goto error;
-
-	wnd->rect = params->rect;
-	wnd->min_size = params->min_size;
-	wnd->gc = mem_gc_get_ctx(wnd->mgc);
-	wnd->cursor = wnd->display->cursor[dcurs_arrow];
-
-	if ((params->flags & wndf_setpos) != 0) {
-		/* Specific window position */
-		wnd->dpos = params->pos;
-	} else {
-		/* Automatic window placement */
-		wnd->dpos.x = ((wnd->id - 1) & 1) * 400;
-		wnd->dpos.y = ((wnd->id - 1) & 2) / 2 * 300;
-	}
-
-	/* Determine which seat should own the window */
-	if (params->idev_id != 0)
-		seat = ds_display_seat_by_idev(wnd->display, params->idev_id);
-	else
-		seat = ds_display_default_seat(wnd->display);
-
-	/* Is this a popup window? */
-	if ((params->flags & wndf_popup) != 0) {
-		ds_seat_set_popup(seat, wnd);
-	} else {
-		if ((params->flags & wndf_nofocus) == 0)
-			ds_seat_set_focus(seat, wnd);
-	}
-
-	/* Is this window a panel? */
-	if ((params->flags & wndf_avoid) != 0)
-		ds_display_update_max_rect(wnd->display);
-
-	(void) ds_display_paint(wnd->display, NULL);
-
-	*rwnd = wnd;
-	return EOK;
-error:
-	if (wnd != NULL) {
-		ds_client_remove_window(wnd);
-		ds_display_remove_window(wnd);
-		if (wnd->mgc != NULL)
-			mem_gc_delete(wnd->mgc);
-		if (wnd->bitmap != NULL)
-			gfx_bitmap_destroy(wnd->bitmap);
-		if (wnd->caption != NULL)
-			free(wnd->caption);
-		free(wnd);
-	}
-
-	return rc;
-}
-
-/** Destroy window.
- *
- * @param wnd Window
- */
-void ds_window_destroy(ds_window_t *wnd)
-{
-	ds_display_t *disp;
-
-	disp = wnd->display;
-
-	ds_window_unfocus(wnd);
-
-	ds_client_remove_window(wnd);
-	ds_display_remove_window(wnd);
-
-	if ((wnd->flags & wndf_avoid) != 0)
-		ds_display_update_max_rect(disp);
-
-	mem_gc_delete(wnd->mgc);
-
-	if (wnd->bitmap != NULL)
-		gfx_bitmap_destroy(wnd->bitmap);
-
-	free(wnd->caption);
-	free(wnd);
-
-	(void) ds_display_paint(disp, NULL);
-}
-
-/** Bring window to top.
- *
- * @param wnd Window
- */
-void ds_window_bring_to_top(ds_window_t *wnd)
-{
-	ds_display_window_to_top(wnd);
-	(void) ds_display_paint(wnd->display, NULL);
-}
-
-/** Get generic graphic context from window.
- *
- * @param wnd Window
- * @return Graphic context
- */
-gfx_context_t *ds_window_get_ctx(ds_window_t *wnd)
-{
-	return wnd->gc;
-}
-
-/** Determine if window is visible.
- *
- * @param wnd Window
- * @return @c true iff window is visible
- */
-bool ds_window_is_visible(ds_window_t *wnd)
-{
-	return (wnd->flags & wndf_minimized) == 0;
-}
-
-/** Paint a window using its backing bitmap.
- *
- * @param wnd Window to paint
- * @param rect Display rectangle to paint to
- * @return EOK on success or an error code
- */
-errno_t ds_window_paint(ds_window_t *wnd, gfx_rect_t *rect)
-{
-	gfx_rect_t srect;
-	gfx_rect_t *brect;
-	gfx_rect_t crect;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "ds_window_paint");
-
-	/* Skip painting the window if not visible */
-	if (!ds_window_is_visible(wnd))
-		return EOK;
-
-	if (rect != NULL) {
-		gfx_rect_rtranslate(&wnd->dpos, rect, &srect);
-
-		/* Determine if we have anything to do */
-		gfx_rect_clip(&srect, &wnd->rect, &crect);
-		if (gfx_rect_is_empty(&crect))
-			return EOK;
-
-		brect = &srect;
-	} else {
-		brect = NULL;
-	}
-
-	/* This can happen in unit tests */
-	if (wnd->bitmap == NULL)
-		return EOK;
-
-	return gfx_bitmap_render(wnd->bitmap, brect, &wnd->dpos);
-}
-
-/** Get the preview rectangle for a window.
- *
- * Get the preview rectangle if the window is being resized or moved.
- * If the window is not being resized or moved, return an empty rectangle.
- *
- * @param wnd Window
- * @param rect Place to store preview rectangle
- */
-static void ds_window_get_preview_rect(ds_window_t *wnd, gfx_rect_t *rect)
-{
-	switch (wnd->state) {
-	case dsw_idle:
-		break;
-	case dsw_moving:
-		gfx_rect_translate(&wnd->preview_pos, &wnd->rect, rect);
-		return;
-	case dsw_resizing:
-		gfx_rect_translate(&wnd->dpos, &wnd->preview_rect, rect);
-		return;
-	}
-
-	rect->p0.x = 0;
-	rect->p0.y = 0;
-	rect->p1.x = 0;
-	rect->p1.y = 0;
-}
-
-/** Paint window preview if the window is being moved or resized.
- *
- * If the window is not being resized or moved, take no action and return
- * success.
- *
- * @param wnd Window for which to paint preview
- * @param rect Clipping rectangle
- * @return EOK on success or an error code
- */
-errno_t ds_window_paint_preview(ds_window_t *wnd, gfx_rect_t *rect)
-{
-	errno_t rc;
-	gfx_color_t *color;
-	gfx_rect_t prect;
-	gfx_rect_t dr;
-	gfx_rect_t pr;
-	gfx_context_t *gc;
-
-	/*
-	 * Get preview rectangle. If the window is not being resized/moved,
-	 * we should get an empty rectangle.
-	 */
-	ds_window_get_preview_rect(wnd, &prect);
-	if (gfx_rect_is_empty(&prect)) {
-		/* There is nothing to paint */
-		return EOK;
-	}
-
-	rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
-	if (rc != EOK)
-		return rc;
-
-	gc = ds_display_get_gc(wnd->display);
-	if (gc != NULL) {
-		gfx_set_color(gc, color);
-
-		/*
-		 * TODO: Ideally we'd want XOR operation to make the preview
-		 * frame visible on any background. If we wanted to get really
-		 * fancy, we'd fill it with a pattern
-		 */
-
-		pr.p0.x = prect.p0.x;
-		pr.p0.y = prect.p0.y;
-		pr.p1.x = prect.p1.x;
-		pr.p1.y = prect.p0.y + 1;
-		gfx_rect_clip(&pr, rect, &dr);
-		gfx_fill_rect(gc, &dr);
-
-		pr.p0.x = prect.p0.x;
-		pr.p0.y = prect.p1.y - 1;
-		pr.p1.x = prect.p1.x;
-		pr.p1.y = prect.p1.y;
-		gfx_rect_clip(&pr, rect, &dr);
-		gfx_fill_rect(gc, &dr);
-
-		pr.p0.x = prect.p0.x;
-		pr.p0.y = prect.p0.y;
-		pr.p1.x = prect.p0.x + 1;
-		pr.p1.y = prect.p1.y;
-		gfx_rect_clip(&pr, rect, &dr);
-		gfx_fill_rect(gc, &dr);
-
-		pr.p0.x = prect.p1.x - 1;
-		pr.p0.y = prect.p0.y;
-		pr.p1.x = prect.p1.x;
-		pr.p1.y = prect.p1.y;
-		gfx_rect_clip(&pr, rect, &dr);
-		gfx_fill_rect(gc, &dr);
-
-	}
-
-	gfx_color_delete(color);
-	return EOK;
-}
-
-/** Repaint window preview when resizing or moving.
- *
- * Repaint the window preview wich was previously at rectangle @a old_rect.
- * The current preview rectangle is determined from window state. If
- * the window did not previously have a preview, @a old_rect should point
- * to an empty rectangle or be NULL. When window has finished
- * moving or resizing, the preview will be cleared.
- *
- * @param wnd Window for which to paint preview
- * @param rect Clipping rectangle
- * @return EOK on success or an error code
- */
-static errno_t ds_window_repaint_preview(ds_window_t *wnd, gfx_rect_t *old_rect)
-{
-	errno_t rc;
-	gfx_rect_t prect;
-	gfx_rect_t envelope;
-	bool oldr;
-	bool newr;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "ds_window_repaint_preview");
-
-	/*
-	 * Get current preview rectangle. If the window is not being resized/moved,
-	 * we should get an empty rectangle.
-	 */
-	ds_window_get_preview_rect(wnd, &prect);
-
-	oldr = (old_rect != NULL) && !gfx_rect_is_empty(old_rect);
-	newr = !gfx_rect_is_empty(&prect);
-
-	if (oldr && newr && gfx_rect_is_incident(old_rect, &prect)) {
-		/*
-		 * As an optimization, repaint both rectangles in a single
-		 * operation.
-		 */
-
-		gfx_rect_envelope(old_rect, &prect, &envelope);
-
-		rc = ds_display_paint(wnd->display, &envelope);
-		if (rc != EOK)
-			return rc;
-	} else {
-		/* Repaint each rectangle separately */
-		if (oldr) {
-			rc = ds_display_paint(wnd->display, old_rect);
-			if (rc != EOK)
-				return rc;
-		}
-
-		if (newr) {
-			rc = ds_display_paint(wnd->display, &prect);
-			if (rc != EOK)
-				return rc;
-		}
-	}
-
-	return EOK;
-}
-
-/** Start moving a window by mouse drag.
- *
- * @param wnd Window
- * @param pos Position where mouse button was pressed
- * @param pos_id Positioning device ID
- */
-static void ds_window_start_move(ds_window_t *wnd, gfx_coord2_t *pos,
-    sysarg_t pos_id)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_move (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	if (wnd->state != dsw_idle)
-		return;
-
-	wnd->orig_pos = *pos;
-	wnd->orig_pos_id = pos_id;
-	wnd->state = dsw_moving;
-	wnd->preview_pos = wnd->dpos;
-
-	(void) ds_window_repaint_preview(wnd, NULL);
-}
-
-/** Finish moving a window by mouse drag.
- *
- * @param wnd Window
- * @param pos Position where mouse button was released
- */
-static void ds_window_finish_move(ds_window_t *wnd, gfx_coord2_t *pos)
-{
-	gfx_coord2_t dmove;
-	gfx_coord2_t nwpos;
-	gfx_rect_t old_rect;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_finish_move (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	assert(wnd->state == dsw_moving);
-
-	gfx_coord2_subtract(pos, &wnd->orig_pos, &dmove);
-	gfx_coord2_add(&wnd->dpos, &dmove, &nwpos);
-
-	ds_window_get_preview_rect(wnd, &old_rect);
-
-	wnd->dpos = nwpos;
-	wnd->state = dsw_idle;
-	wnd->orig_pos_id = 0;
-
-	(void) ds_display_paint(wnd->display, NULL);
-}
-
-/** Update window position when moving by mouse drag.
- *
- * @param wnd Window
- * @param pos Current mouse position
- */
-static void ds_window_update_move(ds_window_t *wnd, gfx_coord2_t *pos)
-{
-	gfx_coord2_t dmove;
-	gfx_coord2_t nwpos;
-	gfx_rect_t old_rect;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "ds_window_update_move (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	assert(wnd->state == dsw_moving);
-
-	gfx_coord2_subtract(pos, &wnd->orig_pos, &dmove);
-	gfx_coord2_add(&wnd->dpos, &dmove, &nwpos);
-
-	ds_window_get_preview_rect(wnd, &old_rect);
-	wnd->preview_pos = nwpos;
-
-	(void) ds_window_repaint_preview(wnd, &old_rect);
-}
-
-/** Start resizing a window by mouse drag.
- *
- * @param wnd Window
- * @param rsztype Resize type (which part of window is being dragged)
- * @param pos Position where mouse button was pressed
- * @param pos_id Positioning device ID
- */
-static void ds_window_start_resize(ds_window_t *wnd,
-    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	ds_seat_t *seat;
-	display_stock_cursor_t ctype;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_resize (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	if (wnd->state != dsw_idle)
-		return;
-
-	/* Determine which seat started the resize */
-	seat = ds_display_seat_by_idev(wnd->display, pos_id);
-	if (seat == NULL)
-		return;
-
-	wnd->orig_pos = *pos;
-	wnd->orig_pos_id = pos_id;
-	wnd->state = dsw_resizing;
-	wnd->rsztype = rsztype;
-	wnd->preview_rect = wnd->rect;
-
-	ctype = display_cursor_from_wrsz(rsztype);
-	ds_seat_set_wm_cursor(seat, wnd->display->cursor[ctype]);
-
-	(void) ds_window_repaint_preview(wnd, NULL);
-}
-
-/** Finish resizing a window by mouse drag.
- *
- * @param wnd Window
- * @param pos Position where mouse button was released
- */
-static void ds_window_finish_resize(ds_window_t *wnd, gfx_coord2_t *pos)
-{
-	gfx_coord2_t dresize;
-	gfx_rect_t nrect;
-	ds_seat_t *seat;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_finish_resize (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	assert(wnd->state == dsw_resizing);
-	gfx_coord2_subtract(pos, &wnd->orig_pos, &dresize);
-
-	/* Compute new rectangle */
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-
-	wnd->state = dsw_idle;
-	ds_client_post_resize_event(wnd->client, wnd, &nrect);
-
-	/* Determine which seat started the resize */
-	seat = ds_display_seat_by_idev(wnd->display, wnd->orig_pos_id);
-	if (seat != NULL)
-		ds_seat_set_wm_cursor(seat, NULL);
-
-	wnd->orig_pos_id = 0;
-
-	(void) ds_display_paint(wnd->display, NULL);
-}
-
-/** Update window position when resizing by mouse drag.
- *
- * @param wnd Window
- * @param pos Current mouse position
- */
-static void ds_window_update_resize(ds_window_t *wnd, gfx_coord2_t *pos)
-{
-	gfx_coord2_t dresize;
-	gfx_rect_t nrect;
-	gfx_rect_t old_rect;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "ds_window_update_resize (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	assert(wnd->state == dsw_resizing);
-
-	gfx_coord2_subtract(pos, &wnd->orig_pos, &dresize);
-	ds_window_calc_resize(wnd, &dresize, &nrect);
-
-	ds_window_get_preview_rect(wnd, &old_rect);
-	wnd->preview_rect = nrect;
-	(void) ds_window_repaint_preview(wnd, &old_rect);
-}
-
-/** Post keyboard event to window.
- *
- * @param wnd Window
- * @param event Event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_window_post_kbd_event(ds_window_t *wnd, kbd_event_t *event)
-{
-	bool alt_or_shift;
-
-	alt_or_shift = event->mods & (KM_SHIFT | KM_ALT);
-
-	if (event->type == KEY_PRESS && alt_or_shift && event->key == KC_F4) {
-		/* On Alt-F4 or Shift-F4 send close event to the window */
-		ds_client_post_close_event(wnd->client, wnd);
-		return EOK;
-	}
-
-	return ds_client_post_kbd_event(wnd->client, wnd, event);
-}
-
-/** Post position event to window.
- *
- * @param wnd Window
- * @param event Position event
- *
- * @return EOK on success or an error code
- */
-errno_t ds_window_post_pos_event(ds_window_t *wnd, pos_event_t *event)
-{
-	pos_event_t tevent;
-	gfx_coord2_t pos;
-	sysarg_t pos_id;
-	gfx_rect_t drect;
-	bool inside;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2,
-	    "ds_window_post_pos_event type=%d pos=%d,%d", event->type,
-	    (int) event->hpos, (int) event->vpos);
-
-	pos.x = event->hpos;
-	pos.y = event->vpos;
-	pos_id = event->pos_id;
-	gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect);
-	inside = gfx_pix_inside_rect(&pos, &drect);
-
-	if (event->type == POS_PRESS && event->btn_num == 2 && inside &&
-	    (wnd->flags & wndf_maximized) == 0) {
-		ds_window_start_move(wnd, &pos, pos_id);
-		return EOK;
-	}
-
-	if (event->type == POS_RELEASE) {
-		/* Finish move/resize if they were started by the same seat */
-		if (wnd->state == dsw_moving &&
-		    ds_window_orig_seat(wnd, pos_id)) {
-			ds_window_finish_move(wnd, &pos);
-			return EOK;
-		}
-
-		if (wnd->state == dsw_resizing &&
-		    ds_window_orig_seat(wnd, pos_id)) {
-			ds_window_finish_resize(wnd, &pos);
-			return EOK;
-		}
-	}
-
-	if (event->type == POS_UPDATE) {
-		/* Update move/resize if they were started by the same seat */
-		if (wnd->state == dsw_moving &&
-		    ds_window_orig_seat(wnd, pos_id)) {
-			ds_window_update_move(wnd, &pos);
-			return EOK;
-		}
-
-		if (wnd->state == dsw_resizing &&
-		    ds_window_orig_seat(wnd, pos_id)) {
-			ds_window_update_resize(wnd, &pos);
-			return EOK;
-		}
-	}
-
-	/* Transform event coordinates to window-local */
-	tevent = *event;
-	tevent.hpos -= wnd->dpos.x;
-	tevent.vpos -= wnd->dpos.y;
-
-	return ds_client_post_pos_event(wnd->client, wnd, &tevent);
-}
-
-/** Post focus event to window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_post_focus_event(ds_window_t *wnd)
-{
-	display_wnd_focus_ev_t efocus;
-	errno_t rc;
-	ds_wmclient_t *wmclient;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_focus_event");
-
-	/* Increase focus counter */
-	++wnd->nfocus;
-	efocus.nfocus = wnd->nfocus;
-
-	rc = ds_client_post_focus_event(wnd->client, wnd, &efocus);
-	if (rc != EOK)
-		return rc;
-
-	/* Notify window managers about window information change */
-	wmclient = ds_display_first_wmclient(wnd->display);
-	while (wmclient != NULL) {
-		ds_wmclient_post_wnd_changed_event(wmclient, wnd->id);
-		wmclient = ds_display_next_wmclient(wmclient);
-	}
-
-	return EOK;
-}
-
-/** Post unfocus event to window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_post_unfocus_event(ds_window_t *wnd)
-{
-	display_wnd_unfocus_ev_t eunfocus;
-	errno_t rc;
-	ds_wmclient_t *wmclient;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_unfocus_event");
-
-	/* Decrease focus counter */
-	--wnd->nfocus;
-	eunfocus.nfocus = wnd->nfocus;
-
-	rc = ds_client_post_unfocus_event(wnd->client, wnd, &eunfocus);
-	if (rc != EOK)
-		return rc;
-
-	/* Notify window managers about window information change */
-	wmclient = ds_display_first_wmclient(wnd->display);
-	while (wmclient != NULL) {
-		ds_wmclient_post_wnd_changed_event(wmclient, wnd->id);
-		wmclient = ds_display_next_wmclient(wmclient);
-	}
-
-	return EOK;
-}
-
-/** Start moving a window, detected by client.
- *
- * @param wnd Window
- * @param pos Position where the pointer was when the move started
- *            relative to the window
- * @param pos_id Positioning device ID
- * @param event Button press event
- */
-void ds_window_move_req(ds_window_t *wnd, gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	gfx_coord2_t orig_pos;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_move_req (%d, %d)",
-	    (int) pos->x, (int) pos->y);
-
-	gfx_coord2_add(&wnd->dpos, pos, &orig_pos);
-	ds_window_start_move(wnd, &orig_pos, pos_id);
-}
-
-/** Move window.
- *
- * @param wnd Window
- */
-void ds_window_move(ds_window_t *wnd, gfx_coord2_t *dpos)
-{
-	wnd->dpos = *dpos;
-	(void) ds_display_paint(wnd->display, NULL);
-}
-
-/** Get window position.
- *
- * @param wnd Window
- */
-void ds_window_get_pos(ds_window_t *wnd, gfx_coord2_t *dpos)
-{
-	*dpos = wnd->dpos;
-}
-
-/** Get maximized window rectangle.
- *
- * @param wnd Window
- */
-void ds_window_get_max_rect(ds_window_t *wnd, gfx_rect_t *rect)
-{
-	*rect = wnd->display->max_rect;
-}
-
-/** Start resizing a window, detected by client.
- *
- * @param wnd Window
- * @param rsztype Resize type (which part of window is being dragged)
- * @param pos Position where the pointer was when the resize started
- *            relative to the window
- * @param pos_id Positioning device ID
- * @param event Button press event
- */
-void ds_window_resize_req(ds_window_t *wnd, display_wnd_rsztype_t rsztype,
-    gfx_coord2_t *pos, sysarg_t pos_id)
-{
-	gfx_coord2_t orig_pos;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_resize_req (%d, %d, %d, %d)",
-	    (int)rsztype, (int)pos->x, (int)pos->y, (int)pos_id);
-
-	gfx_coord2_add(&wnd->dpos, pos, &orig_pos);
-	ds_window_start_resize(wnd, rsztype, &orig_pos, pos_id);
-}
-
-/** Resize window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_resize(ds_window_t *wnd, gfx_coord2_t *offs,
-    gfx_rect_t *nrect)
-{
-	gfx_context_t *dgc;
-	gfx_bitmap_params_t bparams;
-	gfx_bitmap_t *nbitmap;
-	pixelmap_t npixelmap;
-	gfx_coord2_t dims;
-	gfx_bitmap_alloc_t alloc;
-	gfx_coord2_t ndpos;
-	errno_t rc;
-
-	dgc = ds_display_get_gc(wnd->display);
-	if (dgc != NULL) {
-		gfx_bitmap_params_init(&bparams);
-		bparams.rect = *nrect;
-
-		rc = gfx_bitmap_create(dgc, &bparams, NULL, &nbitmap);
-		if (rc != EOK)
-			return ENOMEM;
-
-		rc = gfx_bitmap_get_alloc(nbitmap, &alloc);
-		if (rc != EOK) {
-			gfx_bitmap_destroy(nbitmap);
-			return ENOMEM;
-		}
-
-		gfx_rect_dims(nrect, &dims);
-		npixelmap.width = dims.x;
-		npixelmap.height = dims.y;
-		npixelmap.data = alloc.pixels;
-
-		/* TODO: Transfer contents within overlap */
-
-		if (wnd->bitmap != NULL)
-			gfx_bitmap_destroy(wnd->bitmap);
-
-		wnd->bitmap = nbitmap;
-		wnd->pixelmap = npixelmap;
-
-		/* Point memory GC to the new bitmap */
-		mem_gc_retarget(wnd->mgc, nrect, &alloc);
-	}
-
-	gfx_coord2_add(&wnd->dpos, offs, &ndpos);
-
-	wnd->dpos = ndpos;
-	wnd->rect = *nrect;
-
-	if ((wnd->flags & wndf_avoid) != 0)
-		ds_display_update_max_rect(wnd->display);
-
-	(void) ds_display_paint(wnd->display, NULL);
-	return EOK;
-}
-
-/** Minimize window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_minimize(ds_window_t *wnd)
-{
-	/* If already minimized, do nothing and return success. */
-	if ((wnd->flags & wndf_minimized) != 0)
-		return EOK;
-
-	ds_window_unfocus(wnd);
-
-	wnd->flags |= wndf_minimized;
-	(void) ds_display_paint(wnd->display, NULL);
-	return EOK;
-}
-
-/** Unminimize window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_unminimize(ds_window_t *wnd)
-{
-	/* If not minimized, do nothing and return success. */
-	if ((wnd->flags & wndf_minimized) == 0)
-		return EOK;
-
-	wnd->flags &= ~wndf_minimized;
-	(void) ds_display_paint(wnd->display, NULL);
-	return EOK;
-}
-
-/** Maximize window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_maximize(ds_window_t *wnd)
-{
-	gfx_coord2_t old_dpos;
-	gfx_rect_t old_rect;
-	gfx_coord2_t offs;
-	gfx_rect_t max_rect;
-	gfx_rect_t nrect;
-	errno_t rc;
-
-	/* If already maximized, do nothing and return success. */
-	if ((wnd->flags & wndf_maximized) != 0)
-		return EOK;
-
-	/* Remember the old window rectangle and display position */
-	old_rect = wnd->rect;
-	old_dpos = wnd->dpos;
-
-	ds_window_get_max_rect(wnd, &max_rect);
-
-	/* Keep window contents on the same position on the screen */
-	offs.x = max_rect.p0.x - wnd->dpos.x;
-	offs.y = max_rect.p0.y - wnd->dpos.y;
-
-	/* Maximized window's coordinates will start at 0,0 */
-	gfx_rect_rtranslate(&max_rect.p0, &max_rect, &nrect);
-
-	rc = ds_window_resize(wnd, &offs, &nrect);
-	if (rc != EOK)
-		return rc;
-
-	/* Set window flags, remember normal rectangle */
-	wnd->flags |= wndf_maximized;
-	wnd->normal_rect = old_rect;
-	wnd->normal_dpos = old_dpos;
-
-	return EOK;
-}
-
-/** Unmaximize window.
- *
- * @param wnd Window
- * @return EOK on success or an error code
- */
-errno_t ds_window_unmaximize(ds_window_t *wnd)
-{
-	gfx_coord2_t offs;
-	errno_t rc;
-
-	/* If not maximized, do nothing and return success. */
-	if ((wnd->flags & wndf_maximized) == 0)
-		return EOK;
-
-	/* Keep window contents on the same position on the screen */
-	offs.x = wnd->normal_dpos.x - wnd->dpos.x;
-	offs.y = wnd->normal_dpos.y - wnd->dpos.y;
-
-	rc = ds_window_resize(wnd, &offs, &wnd->normal_rect);
-	if (rc != EOK)
-		return rc;
-
-	/* Clear maximized flag */
-	wnd->flags &= ~wndf_maximized;
-
-	return EOK;
-}
-
-/** Compute new window rectangle after resize operation.
- *
- * @param wnd Window which is being resized (in dsw_resizing state and thus
- *            has rsztype set)
- * @param dresize Amount by which to resize
- * @param nrect Place to store new rectangle
- */
-void ds_window_calc_resize(ds_window_t *wnd, gfx_coord2_t *dresize,
-    gfx_rect_t *nrect)
-{
-	if ((wnd->rsztype & display_wr_top) != 0) {
-		nrect->p0.y = min(wnd->rect.p0.y + dresize->y,
-		    wnd->rect.p1.y - wnd->min_size.y);
-	} else {
-		nrect->p0.y = wnd->rect.p0.y;
-	}
-
-	if ((wnd->rsztype & display_wr_left) != 0) {
-		nrect->p0.x = min(wnd->rect.p0.x + dresize->x,
-		    wnd->rect.p1.x - wnd->min_size.x);
-	} else {
-		nrect->p0.x = wnd->rect.p0.x;
-	}
-
-	if ((wnd->rsztype & display_wr_bottom) != 0) {
-		nrect->p1.y = max(wnd->rect.p1.y + dresize->y,
-		    wnd->rect.p0.y + wnd->min_size.y);
-	} else {
-		nrect->p1.y = wnd->rect.p1.y;
-	}
-
-	if ((wnd->rsztype & display_wr_right) != 0) {
-		nrect->p1.x = max(wnd->rect.p1.x + dresize->x,
-		    wnd->rect.p0.x + wnd->min_size.x);
-	} else {
-		nrect->p1.x = wnd->rect.p1.x;
-	}
-}
-
-/** Set window cursor.
- *
- * @param wnd Window
- * @param cursor New cursor
- * @return EOK on success, EINVAL if @a cursor is invalid
- */
-errno_t ds_window_set_cursor(ds_window_t *wnd, display_stock_cursor_t cursor)
-{
-	if (cursor >= dcurs_arrow &&
-	    cursor < (display_stock_cursor_t) dcurs_limit) {
-		wnd->cursor = wnd->display->cursor[cursor];
-		return EOK;
-	} else {
-		return EINVAL;
-	}
-}
-
-/** Set window caption.
- *
- * @param wnd Window
- * @param caption New caption
- *
- * @return EOK on success, EINVAL if @a cursor is invalid
- */
-errno_t ds_window_set_caption(ds_window_t *wnd, const char *caption)
-{
-	char *dcaption;
-	ds_wmclient_t *wmclient;
-
-	dcaption = str_dup(caption);
-	if (dcaption == NULL)
-		return ENOMEM;
-
-	free(wnd->caption);
-	wnd->caption = dcaption;
-
-	/* Notify window managers about window information change */
-	wmclient = ds_display_first_wmclient(wnd->display);
-	while (wmclient != NULL) {
-		ds_wmclient_post_wnd_changed_event(wmclient, wnd->id);
-		wmclient = ds_display_next_wmclient(wmclient);
-	}
-
-	return EOK;
-}
-
-/** Find alternate window with the allowed flags.
- *
- * An alternate window is a *different* window that is preferably previous
- * in the display order and only has the @a allowed flags.
- *
- * @param wnd Window
- * @param allowed_flags Bitmask of flags that the window is allowed to have
- *
- * @return Alternate window matching the criteria or @c NULL if there is none
- */
-ds_window_t *ds_window_find_prev(ds_window_t *wnd,
-    display_wnd_flags_t allowed_flags)
-{
-	ds_window_t *nwnd;
-
-	/* Try preceding windows in display order */
-	nwnd = ds_display_next_window(wnd);
-	while (nwnd != NULL && (nwnd->flags & ~allowed_flags) != 0) {
-		nwnd = ds_display_next_window(nwnd);
-	}
-
-	/* Do we already have a matching window? */
-	if (nwnd != NULL && (nwnd->flags & ~allowed_flags) == 0) {
-		return nwnd;
-	}
-
-	/* Try succeeding windows in display order */
-	nwnd = ds_display_first_window(wnd->display);
-	while (nwnd != NULL && nwnd != wnd &&
-	    (nwnd->flags & ~allowed_flags) != 0) {
-		nwnd = ds_display_next_window(nwnd);
-	}
-
-	if (nwnd == wnd)
-		return NULL;
-
-	return nwnd;
-}
-
-/** Find alternate window with the allowed flags.
- *
- * An alternate window is a *different* window that is preferably previous
- * in the display order and only has the @a allowed flags.
- *
- * @param wnd Window
- * @param allowed_flags Bitmask of flags that the window is allowed to have
- *
- * @return Alternate window matching the criteria or @c NULL if there is none
- */
-ds_window_t *ds_window_find_next(ds_window_t *wnd,
-    display_wnd_flags_t allowed_flags)
-{
-	ds_window_t *nwnd;
-
-	/* Try preceding windows in display order */
-	nwnd = ds_display_prev_window(wnd);
-	while (nwnd != NULL && (nwnd->flags & ~allowed_flags) != 0) {
-		nwnd = ds_display_prev_window(nwnd);
-	}
-
-	/* Do we already have a matching window? */
-	if (nwnd != NULL && (nwnd->flags & ~allowed_flags) == 0) {
-		return nwnd;
-	}
-
-	/* Try succeeding windows in display order */
-	nwnd = ds_display_last_window(wnd->display);
-	while (nwnd != NULL && nwnd != wnd &&
-	    (nwnd->flags & ~allowed_flags) != 0) {
-		nwnd = ds_display_prev_window(nwnd);
-	}
-
-	if (nwnd == wnd)
-		return NULL;
-
-	return nwnd;
-}
-
-/** Remove focus from window.
- *
- * Used to switch focus to another window when closing or minimizing window.
- *
- * @param wnd Window
- */
-void ds_window_unfocus(ds_window_t *wnd)
-{
-	ds_seat_t *seat;
-
-	/* Make sure window is no longer focused in any seat */
-	seat = ds_display_first_seat(wnd->display);
-	while (seat != NULL) {
-		ds_seat_unfocus_wnd(seat, wnd);
-		seat = ds_display_next_seat(seat);
-	}
-}
-
-/** Determine if input device belongs to the same seat as the original device.
- *
- * Compare the seat ownning @a idev_id with the seat owning @a wnd->orig_pos_id
- * (the device that started the window move or resize).
- *
- * This is used to make sure that, when two seats focus the same window,
- * only devices owned by the seat that started the resize or move can
- * affect it. Otherwise moving the other pointer(s) would disrupt the
- * resize or move operation.
- *
- * @param wnd Window (that is currently being resized or moved)
- * @param idev_id Input device ID
- * @return @c true iff idev_id is owned by the same seat as the input
- *         device that started the resize or move
- */
-bool ds_window_orig_seat(ds_window_t *wnd, sysarg_t idev_id)
-{
-	ds_seat_t *orig_seat;
-	ds_seat_t *seat;
-
-	/* Window must be in state such that wnd->orig_pos_id is valid */
-	assert(wnd->state == dsw_moving || wnd->state == dsw_resizing);
-
-	orig_seat = ds_display_seat_by_idev(wnd->display, wnd->orig_pos_id);
-	seat = ds_display_seat_by_idev(wnd->display, idev_id);
-
-	return seat == orig_seat;
-}
-
-/** Window memory GC invalidate callback.
- *
- * This is called by the window's memory GC when a rectangle is modified.
- */
-static void ds_window_invalidate_cb(void *arg, gfx_rect_t *rect)
-{
-	ds_window_t *wnd = (ds_window_t *)arg;
-	gfx_rect_t drect;
-
-	/* Repaint the corresponding part of the display */
-
-	gfx_rect_translate(&wnd->dpos, rect, &drect);
-	ds_display_lock(wnd->display);
-	(void) ds_display_paint(wnd->display, &drect);
-	ds_display_unlock(wnd->display);
-}
-
-/** Window memory GC update callback.
- *
- * This is called by the window's memory GC when it is to be updated.
- */
-static void ds_window_update_cb(void *arg)
-{
-	ds_window_t *wnd = (ds_window_t *)arg;
-
-	(void) wnd;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/window.h
===================================================================
--- uspace/srv/hid/display/window.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server window
- */
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <display/wndparams.h>
-#include <display/wndresize.h>
-#include <errno.h>
-#include <io/pos_event.h>
-#include <stdbool.h>
-#include <types/gfx/context.h>
-#include <types/gfx/coord.h>
-#include <types/gfx/ops/context.h>
-#include "types/display/cursor.h"
-#include "types/display/display.h"
-#include "types/display/window.h"
-
-extern gfx_context_ops_t window_gc_ops;
-
-extern errno_t ds_window_create(ds_client_t *, display_wnd_params_t *,
-    ds_window_t **);
-extern void ds_window_destroy(ds_window_t *);
-extern void ds_window_bring_to_top(ds_window_t *);
-extern gfx_context_t *ds_window_get_ctx(ds_window_t *);
-extern bool ds_window_is_visible(ds_window_t *);
-extern errno_t ds_window_paint(ds_window_t *, gfx_rect_t *);
-errno_t ds_window_paint_preview(ds_window_t *, gfx_rect_t *);
-extern errno_t ds_window_post_kbd_event(ds_window_t *, kbd_event_t *);
-extern errno_t ds_window_post_pos_event(ds_window_t *, pos_event_t *);
-extern errno_t ds_window_post_focus_event(ds_window_t *);
-extern errno_t ds_window_post_unfocus_event(ds_window_t *);
-extern void ds_window_move_req(ds_window_t *, gfx_coord2_t *, sysarg_t);
-extern void ds_window_move(ds_window_t *, gfx_coord2_t *);
-extern void ds_window_get_pos(ds_window_t *, gfx_coord2_t *);
-extern void ds_window_get_max_rect(ds_window_t *, gfx_rect_t *);
-extern void ds_window_resize_req(ds_window_t *, display_wnd_rsztype_t,
-    gfx_coord2_t *, sysarg_t);
-extern errno_t ds_window_resize(ds_window_t *, gfx_coord2_t *, gfx_rect_t *);
-extern errno_t ds_window_minimize(ds_window_t *);
-extern errno_t ds_window_unminimize(ds_window_t *);
-extern errno_t ds_window_maximize(ds_window_t *);
-extern errno_t ds_window_unmaximize(ds_window_t *);
-extern void ds_window_calc_resize(ds_window_t *, gfx_coord2_t *,
-    gfx_rect_t *);
-extern errno_t ds_window_set_cursor(ds_window_t *, display_stock_cursor_t);
-extern errno_t ds_window_set_caption(ds_window_t *, const char *);
-extern ds_window_t *ds_window_find_next(ds_window_t *, display_wnd_flags_t);
-extern ds_window_t *ds_window_find_prev(ds_window_t *, display_wnd_flags_t);
-extern void ds_window_unfocus(ds_window_t *);
-extern bool ds_window_orig_seat(ds_window_t *, sysarg_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/wmclient.c
===================================================================
--- uspace/srv/hid/display/wmclient.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,223 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server WM client
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include "display.h"
-#include "window.h"
-#include "wmclient.h"
-
-/** Create WM client.
- *
- * @param display Parent display
- * @param cb WM client callbacks
- * @param cb_arg Callback argument
- * @param rwmclient Place to store pointer to new WM client.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t ds_wmclient_create(ds_display_t *display, ds_wmclient_cb_t *cb,
-    void *cb_arg, ds_wmclient_t **rwmclient)
-{
-	ds_wmclient_t *wmclient;
-
-	wmclient = calloc(1, sizeof(ds_wmclient_t));
-	if (wmclient == NULL)
-		return ENOMEM;
-
-	list_initialize(&wmclient->events);
-	wmclient->cb = cb;
-	wmclient->cb_arg = cb_arg;
-
-	ds_display_add_wmclient(display, wmclient);
-
-	*rwmclient = wmclient;
-	return EOK;
-}
-
-/** Destroy WM client.
- *
- * @param wmclient WM client
- */
-void ds_wmclient_destroy(ds_wmclient_t *wmclient)
-{
-	ds_wmclient_purge_events(wmclient);
-	ds_display_remove_wmclient(wmclient);
-	free(wmclient);
-}
-
-/** Get next event from WM client event queue.
- *
- * @param wmclient WM client
- * @param event Place to store event
- * @return EOK on success, ENOENT if event queue is empty
- */
-errno_t ds_wmclient_get_event(ds_wmclient_t *wmclient, wndmgt_ev_t *event)
-{
-	link_t *link;
-	ds_wmclient_ev_t *wevent;
-
-	link = list_first(&wmclient->events);
-	if (link == NULL)
-		return ENOENT;
-
-	wevent = list_get_instance(link, ds_wmclient_ev_t, levents);
-	list_remove(link);
-
-	*event = wevent->event;
-	free(wevent);
-	return EOK;
-}
-
-/** Purge events from WM client event queue.
- *
- * @param client Client
- */
-void ds_wmclient_purge_events(ds_wmclient_t *wmclient)
-{
-	link_t *cur;
-	link_t *next;
-	ds_wmclient_ev_t *wevent;
-
-	cur = list_first(&wmclient->events);
-	while (cur != NULL) {
-		next = list_next(cur, &wmclient->events);
-		wevent = list_get_instance(cur, ds_wmclient_ev_t, levents);
-
-		list_remove(cur);
-		free(wevent);
-		cur = next;
-	}
-}
-
-/** Post window added event to the WM client's message queue.
- *
- * @param wmclient WM client
- * @param wnd_id Window ID of the added window
- *
- * @return EOK on success or an error code
- */
-errno_t ds_wmclient_post_wnd_added_event(ds_wmclient_t *wmclient,
-    sysarg_t wnd_id)
-{
-	ds_wmclient_ev_t *wevent;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "wmclient_pos_wnd_added_event "
-	    "wmclient=%p wnd_id=%zu\n", (void *)wmclient, wnd_id);
-
-	wevent = calloc(1, sizeof(ds_wmclient_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->wmclient = wmclient;
-	wevent->event.etype = wmev_window_added;
-	wevent->event.wnd_id = wnd_id;
-	list_append(&wevent->levents, &wmclient->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (wmclient->cb != NULL && wmclient->cb->ev_pending != NULL)
-		wmclient->cb->ev_pending(wmclient->cb_arg);
-
-	return EOK;
-}
-
-/** Post window removed event to the WM client's message queue.
- *
- * @param wmclient WM client
- * @param wnd_id Window ID of the added window
- *
- * @return EOK on success or an error code
- */
-errno_t ds_wmclient_post_wnd_removed_event(ds_wmclient_t *wmclient,
-    sysarg_t wnd_id)
-{
-	ds_wmclient_ev_t *wevent;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "wmclient_pos_wnd_removed_event "
-	    "wmclient=%p wnd_id=%zu\n", (void *)wmclient, wnd_id);
-
-	wevent = calloc(1, sizeof(ds_wmclient_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->wmclient = wmclient;
-	wevent->event.etype = wmev_window_removed;
-	wevent->event.wnd_id = wnd_id;
-	list_append(&wevent->levents, &wmclient->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (wmclient->cb != NULL && wmclient->cb->ev_pending != NULL)
-		wmclient->cb->ev_pending(wmclient->cb_arg);
-
-	return EOK;
-}
-
-/** Post window changed event to the WM client's message queue.
- *
- * @param wmclient WM client
- * @param wnd_id Window ID of the added window
- *
- * @return EOK on success or an error code
- */
-errno_t ds_wmclient_post_wnd_changed_event(ds_wmclient_t *wmclient,
-    sysarg_t wnd_id)
-{
-	ds_wmclient_ev_t *wevent;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "wmclient_pos_wnd_changed_event "
-	    "wmclient=%p wnd_id=%zu\n", (void *)wmclient, wnd_id);
-
-	wevent = calloc(1, sizeof(ds_wmclient_ev_t));
-	if (wevent == NULL)
-		return ENOMEM;
-
-	wevent->wmclient = wmclient;
-	wevent->event.etype = wmev_window_changed;
-	wevent->event.wnd_id = wnd_id;
-	list_append(&wevent->levents, &wmclient->events);
-
-	/* Notify the client */
-	// TODO Do not send more than once until client drains the queue
-	if (wmclient->cb != NULL && wmclient->cb->ev_pending != NULL)
-		wmclient->cb->ev_pending(wmclient->cb_arg);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/wmclient.h
===================================================================
--- uspace/srv/hid/display/wmclient.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Display server WM client
- */
-
-#ifndef WMCLIENT_H
-#define WMCLIENT_H
-
-#include <errno.h>
-#include <wndmgt.h>
-#include "types/display/display.h"
-#include "types/display/wmclient.h"
-
-extern errno_t ds_wmclient_create(ds_display_t *, ds_wmclient_cb_t *, void *,
-    ds_wmclient_t **);
-extern void ds_wmclient_destroy(ds_wmclient_t *);
-extern errno_t ds_wmclient_get_event(ds_wmclient_t *,  wndmgt_ev_t *);
-extern errno_t ds_wmclient_post_wnd_added_event(ds_wmclient_t *, sysarg_t);
-extern errno_t ds_wmclient_post_wnd_removed_event(ds_wmclient_t *, sysarg_t);
-extern errno_t ds_wmclient_post_wnd_changed_event(ds_wmclient_t *, sysarg_t);
-extern void ds_wmclient_purge_events(ds_wmclient_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/display/wmops.c
===================================================================
--- uspace/srv/hid/display/wmops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,225 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Window management ops implementation
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include <str.h>
-#include <wndmgt_srv.h>
-#include "display.h"
-#include "seat.h"
-#include "window.h"
-#include "wmclient.h"
-
-static errno_t dispwm_get_window_list(void *, wndmgt_window_list_t **);
-static errno_t dispwm_get_window_info(void *, sysarg_t, wndmgt_window_info_t **);
-static errno_t dispwm_activate_window(void *, sysarg_t, sysarg_t);
-static errno_t dispwm_close_window(void *, sysarg_t);
-static errno_t dispwm_get_event(void *, wndmgt_ev_t *);
-
-wndmgt_ops_t wndmgt_srv_ops = {
-	.get_window_list = dispwm_get_window_list,
-	.get_window_info = dispwm_get_window_info,
-	.activate_window = dispwm_activate_window,
-	.close_window = dispwm_close_window,
-	.get_event = dispwm_get_event,
-};
-
-/** Get window list.
- *
- * @param arg Argument (WM client)
- * @param rlist Place to store pointer to new list
- * @return EOK on success or an error code
- */
-static errno_t dispwm_get_window_list(void *arg, wndmgt_window_list_t **rlist)
-{
-	ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
-	wndmgt_window_list_t *list;
-	ds_window_t *wnd;
-	unsigned i;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_window_list()");
-
-	list = calloc(1, sizeof(wndmgt_window_list_t));
-	if (list == NULL)
-		return ENOMEM;
-
-	ds_display_lock(wmclient->display);
-
-	/* Count the number of windows */
-	list->nwindows = 0;
-	wnd = ds_display_first_window(wmclient->display);
-	while (wnd != NULL) {
-		++list->nwindows;
-		wnd = ds_display_next_window(wnd);
-	}
-
-	/* Allocate array for window IDs */
-	list->windows = calloc(list->nwindows, sizeof(sysarg_t));
-	if (list->windows == NULL) {
-		ds_display_unlock(wmclient->display);
-		free(list);
-		return ENOMEM;
-	}
-
-	/* Fill in window IDs */
-	i = 0;
-	wnd = ds_display_first_window(wmclient->display);
-	while (wnd != NULL) {
-		list->windows[i++] = wnd->id;
-		wnd = ds_display_next_window(wnd);
-	}
-
-	ds_display_unlock(wmclient->display);
-	*rlist = list;
-	return EOK;
-}
-
-/** Get window information.
- *
- * @param arg Argument (WM client)
- * @param wnd_id Window ID
- * @param rinfo Place to store pointer to new window information structure
- * @return EOK on success or an error code
- */
-static errno_t dispwm_get_window_info(void *arg, sysarg_t wnd_id,
-    wndmgt_window_info_t **rinfo)
-{
-	ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
-	ds_window_t *wnd;
-	wndmgt_window_info_t *info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_window_info()");
-
-	ds_display_lock(wmclient->display);
-	wnd = ds_display_find_window(wmclient->display, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(wmclient->display);
-		return ENOENT;
-	}
-
-	info = calloc(1, sizeof(wndmgt_window_info_t));
-	if (info == NULL) {
-		ds_display_unlock(wmclient->display);
-		return ENOMEM;
-	}
-
-	info->caption = str_dup(wnd->caption);
-	if (info->caption == NULL) {
-		ds_display_unlock(wmclient->display);
-		free(info);
-		return ENOMEM;
-	}
-
-	info->flags = wnd->flags;
-	info->nfocus = wnd->nfocus;
-
-	ds_display_unlock(wmclient->display);
-	*rinfo = info;
-	return EOK;
-}
-
-/** Activate window.
- *
- * @param arg Argument (WM client)
- * @param dev_id Input device ID
- * @param wnd_id Window ID
- * @return EOK on success or an error code
- */
-static errno_t dispwm_activate_window(void *arg, sysarg_t dev_id,
-    sysarg_t wnd_id)
-{
-	ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
-	ds_window_t *wnd;
-	ds_seat_t *seat;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_activate_window()");
-
-	ds_display_lock(wmclient->display);
-	wnd = ds_display_find_window(wmclient->display, wnd_id);
-	if (wnd == NULL) {
-		ds_display_unlock(wmclient->display);
-		return ENOENT;
-	}
-
-	/* Determine which seat's focus should be changed */
-	seat = ds_display_seat_by_idev(wnd->display, dev_id);
-	if (seat == NULL) {
-		ds_display_unlock(wmclient->display);
-		return ENOENT;
-	}
-
-	/* Switch focus */
-	ds_seat_set_focus(seat, wnd);
-
-	ds_display_unlock(wmclient->display);
-	return EOK;
-}
-
-/** Close window.
- *
- * @param arg Argument (WM client)
- * @param wnd_id Window ID
- * @return EOK on success or an error code
- */
-static errno_t dispwm_close_window(void *arg, sysarg_t wnd_id)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_close_window()");
-	(void)arg;
-	(void)wnd_id;
-	return EOK;
-}
-
-/** Get window management event.
- *
- * @param arg Argument (WM client)
- * @param ev Place to store event
- * @return EOK on success, ENOENT if there are no events
- */
-static errno_t dispwm_get_event(void *arg, wndmgt_ev_t *ev)
-{
-	ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_event()");
-
-	ds_display_lock(wmclient->display);
-	rc = ds_wmclient_get_event(wmclient, ev);
-	ds_display_unlock(wmclient->display);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/hid/display/wmops.h
===================================================================
--- uspace/srv/hid/display/wmops.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup display
- * @{
- */
-/**
- * @file Window management ops implementation
- */
-
-#ifndef WMOPS_H
-#define WMOPS_H
-
-#include <wndmgt_srv.h>
-
-extern wndmgt_ops_t wndmgt_srv_ops;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/input/ctl/kbdev.c
===================================================================
--- uspace/srv/hid/input/ctl/kbdev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,187 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kbd_ctl
- * @ingroup input
- * @{
- */
-/**
- * @file
- * @brief Keyboard device connector controller driver.
- */
-
-#include <async.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <ipc/kbdev.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <vfs/vfs_sess.h>
-#include "../gsp.h"
-#include "../input.h"
-#include "../kbd.h"
-#include "../kbd_ctl.h"
-#include "../kbd_port.h"
-
-static errno_t kbdev_ctl_init(kbd_dev_t *);
-static void kbdev_ctl_set_ind(kbd_dev_t *, unsigned int);
-
-static void kbdev_callback_conn(ipc_call_t *, void *arg);
-
-kbd_ctl_ops_t kbdev_ctl = {
-	.parse = NULL,
-	.init = kbdev_ctl_init,
-	.set_ind = kbdev_ctl_set_ind
-};
-
-/** Kbdev softstate */
-typedef struct {
-	/** Link to generic keyboard device */
-	kbd_dev_t *kbd_dev;
-
-	/** Session with kbdev device */
-	async_sess_t *sess;
-} kbdev_t;
-
-static kbdev_t *kbdev_new(kbd_dev_t *kdev)
-{
-	kbdev_t *kbdev = calloc(1, sizeof(kbdev_t));
-	if (kbdev == NULL)
-		return NULL;
-
-	kbdev->kbd_dev = kdev;
-
-	return kbdev;
-}
-
-static void kbdev_destroy(kbdev_t *kbdev)
-{
-	if (kbdev->sess != NULL)
-		async_hangup(kbdev->sess);
-
-	free(kbdev);
-}
-
-static errno_t kbdev_ctl_init(kbd_dev_t *kdev)
-{
-	async_sess_t *sess = loc_service_connect(kdev->svc_id,
-	    INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf("%s: Failed starting session with '%s.'\n", NAME,
-		    kdev->svc_name);
-		return ENOENT;
-	}
-
-	kbdev_t *kbdev = kbdev_new(kdev);
-	if (kbdev == NULL) {
-		printf("%s: Failed allocating device structure for '%s'.\n",
-		    NAME, kdev->svc_name);
-		async_hangup(sess);
-		return ENOMEM;
-	}
-
-	kbdev->sess = sess;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (exch == NULL) {
-		printf("%s: Failed starting exchange with '%s'.\n", NAME,
-		    kdev->svc_name);
-		kbdev_destroy(kbdev);
-		return ENOENT;
-	}
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_KBD_CB, 0, 0,
-	    kbdev_callback_conn, kbdev, &port);
-
-	if (rc != EOK) {
-		printf("%s: Failed creating callback connection from '%s'.\n",
-		    NAME, kdev->svc_name);
-		async_exchange_end(exch);
-		kbdev_destroy(kbdev);
-		return rc;
-	}
-
-	async_exchange_end(exch);
-
-	kdev->ctl_private = (void *) kbdev;
-	return 0;
-}
-
-static void kbdev_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
-{
-	async_sess_t *sess = ((kbdev_t *) kdev->ctl_private)->sess;
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (!exch)
-		return;
-
-	async_msg_1(exch, KBDEV_SET_IND, mods);
-	async_exchange_end(exch);
-}
-
-static void kbdev_callback_conn(ipc_call_t *icall, void *arg)
-{
-	kbdev_t *kbdev;
-	errno_t retval;
-	int type, key;
-
-	/* Kbdev device structure */
-	kbdev = arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			kbdev_destroy(kbdev);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case KBDEV_EVENT:
-			/* Got event from keyboard device */
-			retval = 0;
-			type = ipc_get_arg1(&call);
-			key = ipc_get_arg2(&call);
-			kbd_push_event(kbdev->kbd_dev, type, key);
-			break;
-		default:
-			retval = ENOTSUP;
-			break;
-		}
-
-		async_answer_0(&call, retval);
-	}
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/ctl/stty.c
===================================================================
--- uspace/srv/hid/input/ctl/stty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,354 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kbd_ctl
- * @ingroup input
- * @{
- */
-/**
- * @file
- * @brief Serial TTY-like keyboard controller driver.
- *
- * Keyboard emulation on a serial terminal.
- */
-
-#include <errno.h>
-#include <io/keycode.h>
-#include "../stroke.h"
-#include "../gsp.h"
-#include "../kbd.h"
-#include "../kbd_port.h"
-#include "../kbd_ctl.h"
-
-static void stty_ctl_parse(sysarg_t);
-static errno_t stty_ctl_init(kbd_dev_t *);
-static void stty_ctl_set_ind(kbd_dev_t *, unsigned int);
-
-kbd_ctl_ops_t stty_ctl = {
-	.parse = stty_ctl_parse,
-	.init = stty_ctl_init,
-	.set_ind = stty_ctl_set_ind
-};
-
-static kbd_dev_t *kbd_dev;
-
-/** Scancode parser */
-static gsp_t sp;
-
-/** Current parser state */
-static int ds;
-
-#include <stdio.h>
-
-/**
- * Sequnece definitions are primarily for Xterm. Additionally we define
- * sequences that are unique to Gnome terminal -- most are the same but
- * some differ.
- */
-static int seq_defs[] = {
-	/* Not shifted */
-
-	0,	KC_BACKTICK,	0x60, GSP_END,
-
-	0,	KC_1,		0x31, GSP_END,
-	0,	KC_2,		0x32, GSP_END,
-	0,	KC_3,		0x33, GSP_END,
-	0,	KC_4,		0x34, GSP_END,
-	0,	KC_5,		0x35, GSP_END,
-	0,	KC_6,		0x36, GSP_END,
-	0,	KC_7,		0x37, GSP_END,
-	0,	KC_8,		0x38, GSP_END,
-	0,	KC_9,		0x39, GSP_END,
-	0,	KC_0,		0x30, GSP_END,
-
-	0,	KC_MINUS,	0x2d, GSP_END,
-	0,	KC_EQUALS,	0x3d, GSP_END,
-
-	0,	KC_BACKSPACE,	0x08, GSP_END,
-
-	0,	KC_TAB,		0x09, GSP_END,
-
-	0,	KC_Q,		0x71, GSP_END,
-	0,	KC_W,		0x77, GSP_END,
-	0,	KC_E,		0x65, GSP_END,
-	0,	KC_R,		0x72, GSP_END,
-	0,	KC_T,		0x74, GSP_END,
-	0,	KC_Y,		0x79, GSP_END,
-	0,	KC_U,		0x75, GSP_END,
-	0,	KC_I,		0x69, GSP_END,
-	0,	KC_O,		0x6f, GSP_END,
-	0,	KC_P,		0x70, GSP_END,
-
-	0,	KC_LBRACKET,	0x5b, GSP_END,
-	0,	KC_RBRACKET,	0x5d, GSP_END,
-
-	0,	KC_A,		0x61, GSP_END,
-	0,	KC_S,		0x73, GSP_END,
-	0,	KC_D,		0x64, GSP_END,
-	0,	KC_F,		0x66, GSP_END,
-	0,	KC_G,		0x67, GSP_END,
-	0,	KC_H,		0x68, GSP_END,
-	0,	KC_J,		0x6a, GSP_END,
-	0,	KC_K,		0x6b, GSP_END,
-	0,	KC_L,		0x6c, GSP_END,
-
-	0,	KC_SEMICOLON,	0x3b, GSP_END,
-	0,	KC_QUOTE,	0x27, GSP_END,
-	0,	KC_BACKSLASH,	0x5c, GSP_END,
-
-	0,	KC_Z,		0x7a, GSP_END,
-	0,	KC_X,		0x78, GSP_END,
-	0,	KC_C,		0x63, GSP_END,
-	0,	KC_V,		0x76, GSP_END,
-	0,	KC_B,		0x62, GSP_END,
-	0,	KC_N,		0x6e, GSP_END,
-	0,	KC_M,		0x6d, GSP_END,
-
-	0,	KC_COMMA,	0x2c, GSP_END,
-	0,	KC_PERIOD,	0x2e, GSP_END,
-	0,	KC_SLASH,	0x2f, GSP_END,
-
-	/* Shifted */
-
-	KM_SHIFT,	KC_BACKTICK,	0x7e, GSP_END,
-
-	KM_SHIFT,	KC_1,		0x21, GSP_END,
-	KM_SHIFT,	KC_2,		0x40, GSP_END,
-	KM_SHIFT,	KC_3,		0x23, GSP_END,
-	KM_SHIFT,	KC_4,		0x24, GSP_END,
-	KM_SHIFT,	KC_5,		0x25, GSP_END,
-	KM_SHIFT,	KC_6,		0x5e, GSP_END,
-	KM_SHIFT,	KC_7,		0x26, GSP_END,
-	KM_SHIFT,	KC_8,		0x2a, GSP_END,
-	KM_SHIFT,	KC_9,		0x28, GSP_END,
-	KM_SHIFT,	KC_0,		0x29, GSP_END,
-
-	KM_SHIFT,	KC_MINUS,	0x5f, GSP_END,
-	KM_SHIFT,	KC_EQUALS,	0x2b, GSP_END,
-
-	KM_SHIFT,	KC_Q,		0x51, GSP_END,
-	KM_SHIFT,	KC_W,		0x57, GSP_END,
-	KM_SHIFT,	KC_E,		0x45, GSP_END,
-	KM_SHIFT,	KC_R,		0x52, GSP_END,
-	KM_SHIFT,	KC_T,		0x54, GSP_END,
-	KM_SHIFT,	KC_Y,		0x59, GSP_END,
-	KM_SHIFT,	KC_U,		0x55, GSP_END,
-	KM_SHIFT,	KC_I,		0x49, GSP_END,
-	KM_SHIFT,	KC_O,		0x4f, GSP_END,
-	KM_SHIFT,	KC_P,		0x50, GSP_END,
-
-	KM_SHIFT,	KC_LBRACKET,	0x7b, GSP_END,
-	KM_SHIFT,	KC_RBRACKET,	0x7d, GSP_END,
-
-	KM_SHIFT,	KC_A,		0x41, GSP_END,
-	KM_SHIFT,	KC_S,		0x53, GSP_END,
-	KM_SHIFT,	KC_D,		0x44, GSP_END,
-	KM_SHIFT,	KC_F,		0x46, GSP_END,
-	KM_SHIFT,	KC_G,		0x47, GSP_END,
-	KM_SHIFT,	KC_H,		0x48, GSP_END,
-	KM_SHIFT,	KC_J,		0x4a, GSP_END,
-	KM_SHIFT,	KC_K,		0x4b, GSP_END,
-	KM_SHIFT,	KC_L,		0x4c, GSP_END,
-
-	KM_SHIFT,	KC_SEMICOLON,	0x3a, GSP_END,
-	KM_SHIFT,	KC_QUOTE,	0x22, GSP_END,
-	KM_SHIFT,	KC_BACKSLASH,	0x7c, GSP_END,
-
-	KM_SHIFT,	KC_Z,		0x5a, GSP_END,
-	KM_SHIFT,	KC_X,		0x58, GSP_END,
-	KM_SHIFT,	KC_C,		0x43, GSP_END,
-	KM_SHIFT,	KC_V,		0x56, GSP_END,
-	KM_SHIFT,	KC_B,		0x42, GSP_END,
-	KM_SHIFT,	KC_N,		0x4e, GSP_END,
-	KM_SHIFT,	KC_M,		0x4d, GSP_END,
-
-	KM_SHIFT,	KC_COMMA,	0x3c, GSP_END,
-	KM_SHIFT,	KC_PERIOD,	0x3e, GSP_END,
-	KM_SHIFT,	KC_SLASH,	0x3f, GSP_END,
-
-	/* ... */
-
-	0,	KC_SPACE,	0x20, GSP_END,
-	0,	KC_ENTER,	0x0a, GSP_END,
-	0,	KC_ENTER,	0x0d, GSP_END,
-
-	0,	KC_ESCAPE,	0x1b, 0x1b, GSP_END,
-
-	0,	KC_F1,		0x1b, 0x4f, 0x50, GSP_END,
-	0,	KC_F2,		0x1b, 0x4f, 0x51, GSP_END,
-	0,	KC_F3,		0x1b, 0x4f, 0x52, GSP_END,
-	0,	KC_F4,		0x1b, 0x4f, 0x53, GSP_END,
-	0,	KC_F5,		0x1b, 0x5b, 0x31, 0x35, 0x7e, GSP_END,
-	0,	KC_F6,		0x1b, 0x5b, 0x31, 0x37, 0x7e, GSP_END,
-	0,	KC_F7,		0x1b, 0x5b, 0x31, 0x38, 0x7e, GSP_END,
-	0,	KC_F8,		0x1b, 0x5b, 0x31, 0x39, 0x7e, GSP_END,
-	0,	KC_F9,		0x1b, 0x5b, 0x32, 0x30, 0x7e, GSP_END,
-	0,	KC_F10,		0x1b, 0x5b, 0x32, 0x31, 0x7e, GSP_END,
-	0,	KC_F11,		0x1b, 0x5b, 0x32, 0x33, 0x7e, GSP_END,
-	0,	KC_F12,		0x1b, 0x5b, 0x32, 0x34, 0x7e, GSP_END,
-
-	0,	KC_PRTSCR,	0x1b, 0x5b, 0x32, 0x35, 0x7e, GSP_END,
-	0,	KC_PAUSE,	0x1b, 0x5b, 0x32, 0x38, 0x7e, GSP_END,
-
-	0,	KC_INSERT,	0x1b, 0x5b, 0x32, 0x7e, GSP_END,
-	0,	KC_HOME,	0x1b, 0x5b, 0x48, GSP_END,
-	0,	KC_PAGE_UP,	0x1b, 0x5b, 0x35, 0x7e, GSP_END,
-	0,	KC_DELETE,	0x1b, 0x5b, 0x33, 0x7e, GSP_END,
-	0,	KC_END,		0x1b, 0x5b, 0x46, GSP_END,
-	0,	KC_PAGE_DOWN,	0x1b, 0x5b, 0x36, 0x7e, GSP_END,
-
-	0,	KC_UP,		0x1b, 0x5b, 0x41, GSP_END,
-	0,	KC_LEFT,	0x1b, 0x5b, 0x44, GSP_END,
-	0,	KC_DOWN,	0x1b, 0x5b, 0x42, GSP_END,
-	0,	KC_RIGHT,	0x1b, 0x5b, 0x43, GSP_END,
-
-	/* Ctrl + key */
-
-	KM_CTRL, 	KC_Q,		0x11, GSP_END,
-	KM_CTRL, 	KC_W,		0x17, GSP_END,
-	KM_CTRL, 	KC_E,		0x05, GSP_END,
-	KM_CTRL, 	KC_R,		0x12, GSP_END,
-	KM_CTRL,	KC_T,		0x14, GSP_END,
-	KM_CTRL,	KC_Y,		0x19, GSP_END,
-	KM_CTRL,	KC_U,		0x15, GSP_END,
-	KM_CTRL,	KC_O,		0x0f, GSP_END,
-	KM_CTRL,	KC_P,		0x10, GSP_END,
-
-	KM_CTRL,	KC_A,		0x01, GSP_END,
-	KM_CTRL,	KC_S,		0x13, GSP_END,
-	KM_CTRL,	KC_D,		0x04, GSP_END,
-	KM_CTRL,	KC_F,		0x06, GSP_END,
-	KM_CTRL,	KC_G,		0x07, GSP_END,
-	KM_CTRL,	KC_K,		0x0b, GSP_END,
-	KM_CTRL,	KC_L,		0x0c, GSP_END,
-
-	KM_CTRL,	KC_Z,		0x1a, GSP_END,
-	KM_CTRL,	KC_X,		0x18, GSP_END,
-	KM_CTRL,	KC_C,		0x03, GSP_END,
-	KM_CTRL,	KC_V,		0x16, GSP_END,
-	KM_CTRL,	KC_B,		0x02, GSP_END,
-	KM_CTRL,	KC_N,		0x0e, GSP_END,
-
-	/* Alt + key */
-
-	KM_ALT,	KC_BACKTICK,	0x1b, 0x60, GSP_END,
-
-	KM_ALT,	KC_1,		0x1b, 0x31, GSP_END,
-	KM_ALT,	KC_2,		0x1b, 0x32, GSP_END,
-	KM_ALT,	KC_3,		0x1b, 0x33, GSP_END,
-	KM_ALT,	KC_4,		0x1b, 0x34, GSP_END,
-	KM_ALT,	KC_5,		0x1b, 0x35, GSP_END,
-	KM_ALT,	KC_6,		0x1b, 0x36, GSP_END,
-	KM_ALT,	KC_7,		0x1b, 0x37, GSP_END,
-	KM_ALT,	KC_8,		0x1b, 0x38, GSP_END,
-	KM_ALT,	KC_9,		0x1b, 0x39, GSP_END,
-	KM_ALT,	KC_0,		0x1b, 0x30, GSP_END,
-
-	KM_ALT,	KC_MINUS,	0x1b, 0x2d, GSP_END,
-	KM_ALT,	KC_EQUALS,	0x1b, 0x3d, GSP_END,
-
-	KM_ALT,	KC_Q,		0x1b, 0x71, GSP_END,
-	KM_ALT,	KC_W,		0x1b, 0x77, GSP_END,
-	KM_ALT,	KC_E,		0x1b, 0x65, GSP_END,
-	KM_ALT,	KC_R,		0x1b, 0x72, GSP_END,
-	KM_ALT,	KC_T,		0x1b, 0x74, GSP_END,
-	KM_ALT,	KC_Y,		0x1b, 0x79, GSP_END,
-	KM_ALT,	KC_U,		0x1b, 0x75, GSP_END,
-	KM_ALT,	KC_I,		0x1b, 0x69, GSP_END,
-	KM_ALT,	KC_O,		0x1b, 0x6f, GSP_END,
-	KM_ALT,	KC_P,		0x1b, 0x70, GSP_END,
-
-	/* 0x1b, 0x5b is used by other keys/sequences */
-	KM_ALT,	KC_RBRACKET,	0x1b, 0x5d, GSP_END,
-
-	KM_ALT,	KC_A,		0x1b, 0x61, GSP_END,
-	KM_ALT,	KC_S,		0x1b, 0x73, GSP_END,
-	KM_ALT,	KC_D,		0x1b, 0x64, GSP_END,
-	KM_ALT,	KC_F,		0x1b, 0x66, GSP_END,
-	KM_ALT,	KC_G,		0x1b, 0x67, GSP_END,
-	KM_ALT,	KC_H,		0x1b, 0x68, GSP_END,
-	KM_ALT,	KC_J,		0x1b, 0x6a, GSP_END,
-	KM_ALT,	KC_K,		0x1b, 0x6b, GSP_END,
-	KM_ALT,	KC_L,		0x1b, 0x6c, GSP_END,
-
-	KM_ALT,	KC_SEMICOLON,	0x1b, 0x3b, GSP_END,
-	KM_ALT,	KC_QUOTE,	0x1b, 0x27, GSP_END,
-	KM_ALT,	KC_BACKSLASH,	0x1b, 0x5c, GSP_END,
-
-	KM_ALT,	KC_Z,		0x1b, 0x7a, GSP_END,
-	KM_ALT,	KC_X,		0x1b, 0x78, GSP_END,
-	KM_ALT,	KC_C,		0x1b, 0x63, GSP_END,
-	KM_ALT,	KC_V,		0x1b, 0x76, GSP_END,
-	KM_ALT,	KC_B,		0x1b, 0x62, GSP_END,
-	KM_ALT,	KC_N,		0x1b, 0x6e, GSP_END,
-	KM_ALT,	KC_M,		0x1b, 0x6d, GSP_END,
-
-	KM_ALT,	KC_COMMA,	0x1b, 0x2c, GSP_END,
-	KM_ALT,	KC_PERIOD,	0x1b, 0x2e, GSP_END,
-	KM_ALT,	KC_SLASH,	0x1b, 0x2f, GSP_END,
-
-	/*
-	 * Sequences specific to Gnome terminal
-	 */
-	0,	KC_BACKSPACE,	0x7f, GSP_END, /* ASCII DEL */
-	0,	KC_HOME,	0x1b, 0x4f, 0x48, GSP_END,
-	0,	KC_END,		0x1b, 0x4f, 0x46, GSP_END,
-
-	0,	0
-};
-
-static errno_t stty_ctl_init(kbd_dev_t *kdev)
-{
-	kbd_dev = kdev;
-	ds = 0;
-
-	gsp_init(&sp);
-	if (gsp_insert_defs(&sp, seq_defs) < 0) {
-		return EINVAL;
-	}
-	return EOK;
-}
-
-static void stty_ctl_parse(sysarg_t scancode)
-{
-	unsigned mods, key;
-
-	ds = gsp_step(&sp, ds, scancode, &mods, &key);
-	if (key != 0) {
-		stroke_sim(kbd_dev, mods, key);
-	}
-}
-
-static void stty_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
-{
-	(void) mods;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/ctl/sun.c
===================================================================
--- uspace/srv/hid/input/ctl/sun.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,229 +1,0 @@
-/*
- * Copyright (c) 2006 Jakub Jermar
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kbd_ctl
- * @ingroup input
- * @{
- */
-/**
- * @file
- * @brief Sun keyboard controller driver.
- */
-
-#include <io/console.h>
-#include <io/keycode.h>
-#include "../kbd.h"
-#include "../kbd_port.h"
-#include "../kbd_ctl.h"
-
-static void sun_ctl_parse(sysarg_t);
-static errno_t sun_ctl_init(kbd_dev_t *);
-static void sun_ctl_set_ind(kbd_dev_t *, unsigned int);
-
-kbd_ctl_ops_t sun_ctl = {
-	.parse = sun_ctl_parse,
-	.init = sun_ctl_init,
-	.set_ind = sun_ctl_set_ind
-};
-
-static kbd_dev_t *kbd_dev;
-
-#define KBD_KEY_RELEASE		0x80
-#define KBD_ALL_KEYS_UP		0x7f
-
-static int scanmap_simple[];
-
-static errno_t sun_ctl_init(kbd_dev_t *kdev)
-{
-	kbd_dev = kdev;
-	return 0;
-}
-
-static void sun_ctl_parse(sysarg_t scancode)
-{
-	kbd_event_type_t type;
-	unsigned int key;
-
-	if (scancode >= 0x100)
-		return;
-
-	if (scancode == KBD_ALL_KEYS_UP)
-		return;
-
-	if (scancode & KBD_KEY_RELEASE) {
-		scancode &= ~KBD_KEY_RELEASE;
-		type = KEY_RELEASE;
-	} else {
-		type = KEY_PRESS;
-	}
-
-	key = scanmap_simple[scancode];
-	if (key != 0)
-		kbd_push_event(kbd_dev, type, key);
-}
-
-static void sun_ctl_set_ind(kbd_dev_t *kdev, unsigned mods)
-{
-	(void) mods;
-}
-
-/** Primary meaning of scancodes. */
-static int scanmap_simple[] = {
-	[0x00] = 0,
-	[0x01] = 0,
-	[0x02] = 0,
-	[0x03] = 0,
-	[0x04] = 0,
-	[0x05] = KC_F1,
-	[0x06] = KC_F2,
-	[0x07] = KC_F10,
-	[0x08] = KC_F3,
-	[0x09] = KC_F11,
-	[0x0a] = KC_F4,
-	[0x0b] = KC_F12,
-	[0x0c] = KC_F5,
-	[0x0d] = KC_RALT,
-	[0x0e] = KC_F6,
-	[0x0f] = 0,
-	[0x10] = KC_F7,
-	[0x11] = KC_F8,
-	[0x12] = KC_F9,
-	[0x13] = KC_LALT,
-	[0x14] = KC_UP,
-	[0x15] = KC_PAUSE,
-	[0x16] = KC_PRTSCR,
-	[0x17] = KC_SCROLL_LOCK,
-	[0x18] = KC_LEFT,
-	[0x19] = 0,
-	[0x1a] = 0,
-	[0x1b] = KC_DOWN,
-	[0x1c] = KC_RIGHT,
-	[0x1d] = KC_ESCAPE,
-	[0x1e] = KC_1,
-	[0x1f] = KC_2,
-	[0x20] = KC_3,
-	[0x21] = KC_4,
-	[0x22] = KC_5,
-	[0x23] = KC_6,
-	[0x24] = KC_7,
-	[0x25] = KC_8,
-	[0x26] = KC_9,
-	[0x27] = KC_0,
-	[0x28] = KC_MINUS,
-	[0x29] = KC_EQUALS,
-	[0x2a] = KC_BACKTICK,
-	[0x2b] = KC_BACKSPACE,
-	[0x2c] = KC_INSERT,
-	[0x2d] = 0,
-	[0x2e] = KC_NSLASH,
-	[0x2f] = KC_NTIMES,
-	[0x30] = 0,
-	[0x31] = 0,
-	[0x32] = KC_NPERIOD,
-	[0x33] = 0,
-	[0x34] = KC_HOME,
-	[0x35] = KC_TAB,
-	[0x36] = KC_Q,
-	[0x37] = KC_W,
-	[0x38] = KC_E,
-	[0x39] = KC_R,
-	[0x3a] = KC_T,
-	[0x3b] = KC_Y,
-	[0x3c] = KC_U,
-	[0x3d] = KC_I,
-	[0x3e] = KC_O,
-	[0x3f] = KC_P,
-	[0x40] = KC_LBRACKET,
-	[0x41] = KC_RBRACKET,
-	[0x42] = KC_DELETE,
-	[0x43] = 0,
-	[0x44] = KC_N7,
-	[0x45] = KC_N8,
-	[0x46] = KC_N9,
-	[0x47] = KC_NMINUS,
-	[0x48] = 0,
-	[0x49] = 0,
-	[0x4a] = KC_END,
-	[0x4b] = 0,
-	[0x4c] = KC_LCTRL,
-	[0x4d] = KC_A,
-	[0x4e] = KC_S,
-	[0x4f] = KC_D,
-	[0x50] = KC_F,
-	[0x51] = KC_G,
-	[0x52] = KC_H,
-	[0x53] = KC_J,
-	[0x54] = KC_K,
-	[0x55] = KC_L,
-	[0x56] = KC_SEMICOLON,
-	[0x57] = KC_QUOTE,
-	[0x58] = KC_BACKSLASH,
-	[0x59] = KC_ENTER,
-	[0x5a] = KC_NENTER,
-	[0x5b] = KC_N4,
-	[0x5c] = KC_N5,
-	[0x5d] = KC_N6,
-	[0x5e] = KC_N0,
-	[0x5f] = 0,
-	[0x60] = KC_PAGE_UP,
-	[0x61] = 0,
-	[0x62] = KC_NUM_LOCK,
-	[0x63] = KC_LSHIFT,
-	[0x64] = KC_Z,
-	[0x65] = KC_X,
-	[0x66] = KC_C,
-	[0x67] = KC_V,
-	[0x68] = KC_B,
-	[0x69] = KC_N,
-	[0x6a] = KC_M,
-	[0x6b] = KC_COMMA,
-	[0x6c] = KC_PERIOD,
-	[0x6d] = KC_SLASH,
-	[0x6e] = KC_RSHIFT,
-	[0x6f] = 0,
-	[0x70] = KC_N1,
-	[0x71] = KC_N2,
-	[0x72] = KC_N3,
-	[0x73] = 0,
-	[0x74] = 0,
-	[0x75] = 0,
-	[0x76] = 0,
-	[0x77] = KC_CAPS_LOCK,
-	[0x78] = 0,
-	[0x79] = KC_SPACE,
-	[0x7a] = 0,
-	[0x7b] = KC_PAGE_DOWN,
-	[0x7c] = 0,
-	[0x7d] = KC_NPLUS,
-	[0x7e] = 0,
-	[0x7f] = 0
-};
-
-/** @}
- */
Index: pace/srv/hid/input/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/input/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup input input
- * @ingroup srvs
- * @brief Input server
- */
Index: pace/srv/hid/input/gsp.c
===================================================================
--- uspace/srv/hid/input/gsp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,287 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup kbdgen generic
- * @ingroup  input
- * @{
- */
-/** @file
- * @brief Generic scancode parser.
- *
- * The scancode parser is a simple finite state machine. It is described
- * using sequences of input symbols (scancodes) and the corresponding output
- * value (mods, key pair). When the parser recognizes a sequence,
- * it outputs the value and restarts. If a transition is undefined,
- * the parser restarts, too.
- *
- * Apart from precise values, GSP_DEFAULT allows to catch general cases.
- * I.e. if we knew that after 0x1b 0x4f there always follow two more
- * scancodes, we can define (0x1b, 0x4f, GSP_DEFAULT, GSP_DEFAULT, GSP_END)
- * with null output. This will force the parser to read the entire sequence,
- * not leaving garbage on the input if it does not recognize the specific
- * sequence.
- */
-
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "gsp.h"
-
-/*
- * Transition function hash table operations.
- */
-typedef struct {
-	int old_state;
-	int input;
-} trans_key_t;
-
-static size_t trans_key_hash(const void *key)
-{
-	const trans_key_t *trans_key = key;
-	return hash_combine(trans_key->input, trans_key->old_state);
-}
-
-static size_t trans_hash(const ht_link_t *item)
-{
-	gsp_trans_t *t = hash_table_get_inst(item, gsp_trans_t, link);
-	return hash_combine(t->input, t->old_state);
-}
-
-static bool trans_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const trans_key_t *trans_key = key;
-	gsp_trans_t *t = hash_table_get_inst(item, gsp_trans_t, link);
-
-	return trans_key->input == t->input && trans_key->old_state == t->old_state;
-}
-
-static const hash_table_ops_t trans_ops = {
-	.hash = trans_hash,
-	.key_hash = trans_key_hash,
-	.key_equal = trans_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-static gsp_trans_t *trans_lookup(gsp_t *p, int state, int input);
-static void trans_insert(gsp_t *p, gsp_trans_t *t);
-static gsp_trans_t *trans_new(void);
-
-/** Initialize scancode parser. */
-void gsp_init(gsp_t *p)
-{
-	p->states = 1;
-	hash_table_create(&p->trans, 0, 0, &trans_ops);
-}
-
-/** Insert a series of definitions into the parser.
- *
- * @param p	The parser.
- * @param defs	Definition list. Each definition starts with two output values
- *		(mods, key) and continues with a sequence of input values
- *		terminated with GSP_END. The definition list is terminated
- *		with two zeroes (0, 0) for output values.
- */
-int gsp_insert_defs(gsp_t *p, const int *defs)
-{
-	unsigned mods, key;
-	const int *dp;
-	int rc;
-
-	dp = defs;
-
-	while (true) {
-		/* Read the output values. */
-		mods = *dp++;
-		key = *dp++;
-		if (key == 0)
-			break;
-
-		/* Insert one sequence. */
-		rc = gsp_insert_seq(p, dp, mods, key);
-		if (rc != 0)
-			return rc;
-
-		/* Skip to the next definition. */
-		while (*dp != GSP_END)
-			++dp;
-		++dp;
-	}
-
-	return 0;
-}
-
-/** Insert one sequence into the parser.
- *
- * @param p	The parser.
- * @param seq	Sequence of input values terminated with GSP_END.
- * @param mods	Corresponsing output value.
- * @param key	Corresponsing output value.
- */
-int gsp_insert_seq(gsp_t *p, const int *seq, unsigned mods, unsigned key)
-{
-	int state;
-	gsp_trans_t *t;
-
-	state = 0;
-	t = NULL;
-
-	/* Input sequence must be non-empty. */
-	if (*seq == GSP_END)
-		return -1;
-
-	while (*(seq + 1) != GSP_END) {
-		t = trans_lookup(p, state, *seq);
-		if (t == NULL) {
-			/* Create new state. */
-			t = trans_new();
-			t->old_state = state;
-			t->input = *seq;
-			t->new_state = p->states++;
-
-			t->out_mods = 0;
-			t->out_key = 0;
-
-			trans_insert(p, t);
-		}
-		state = t->new_state;
-		++seq;
-	}
-
-	/* Process the last transition. */
-	t = trans_lookup(p, state, *seq);
-	if (t != NULL) {
-		exit(1);
-		return -1;	/* Conflicting definition. */
-	}
-
-	t = trans_new();
-	t->old_state = state;
-	t->input = *seq;
-	t->new_state = 0;
-
-	t->out_mods = mods;
-	t->out_key = key;
-
-	trans_insert(p, t);
-
-	return 0;
-}
-
-/** Compute one parser step.
- *
- * Computes the next state and output values for a given state and input.
- * This handles everything including restarts and default branches.
- *
- * @param p		The parser.
- * @param state		Old state.
- * @param input		Input symbol (scancode).
- * @param mods		Output value (modifier).
- * @param key		Output value (key).
- * @return		New state.
- */
-int gsp_step(gsp_t *p, int state, int input, unsigned *mods, unsigned *key)
-{
-	gsp_trans_t *t;
-
-	t = trans_lookup(p, state, input);
-	if (t == NULL) {
-		t = trans_lookup(p, state, GSP_DEFAULT);
-	}
-
-	if (t == NULL) {
-		printf("gsp_step: not found, state=%d, input=0x%x\n",
-		    state, input);
-		*mods = 0;
-		*key = 0;
-		return 0;
-	}
-
-	*mods = t->out_mods;
-	*key = t->out_key;
-
-	return t->new_state;
-}
-
-/** Transition function lookup.
- *
- * Returns the value of the transition function for the given state
- * and input. Note that the transition must be specified precisely,
- * to obtain the default branch use input = GSP_DEFAULT.
- *
- * @param p		Parser.
- * @param state		Current state.
- * @param input		Input value.
- * @return		The transition or @c NULL if not defined.
- */
-static gsp_trans_t *trans_lookup(gsp_t *p, int state, int input)
-{
-	ht_link_t *item;
-
-	trans_key_t key = {
-		.input = input,
-		.old_state = state
-	};
-
-	item = hash_table_find(&p->trans, &key);
-	if (item == NULL)
-		return NULL;
-
-	return hash_table_get_inst(item, gsp_trans_t, link);
-}
-
-/** Define a new transition.
- *
- * @param p	The parser.
- * @param t	Transition with all fields defined.
- */
-static void trans_insert(gsp_t *p, gsp_trans_t *t)
-{
-	hash_table_insert(&p->trans, &t->link);
-}
-
-/** Allocate transition structure. */
-static gsp_trans_t *trans_new(void)
-{
-	gsp_trans_t *t;
-
-	t = malloc(sizeof(gsp_trans_t));
-	if (t == NULL) {
-		printf("Memory allocation failed.\n");
-		exit(1);
-	}
-
-	return t;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/gsp.h
===================================================================
--- uspace/srv/hid/input/gsp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @ingroup  input
- * @{
- */
-
-/** @file
- * @brief Generic scancode parser
- */
-
-#ifndef KBD_GSP_H_
-#define KBD_GSP_H_
-
-#include <adt/hash_table.h>
-
-enum {
-	GSP_END		= -1,	/**< Terminates a sequence. */
-	GSP_DEFAULT	= -2	/**< Wildcard, catches unhandled cases. */
-};
-
-/** Scancode parser description */
-typedef struct {
-	/** Transition table, (state, input) -> (state, output) */
-	hash_table_t trans;
-
-	/** Number of states */
-	int states;
-} gsp_t;
-
-/** Scancode parser transition. */
-typedef struct {
-	ht_link_t link;		/**< Link to hash table in @c gsp_t */
-
-	/* Preconditions */
-
-	int old_state;		/**< State before transition */
-	int input;		/**< Input symbol (scancode) */
-
-	/* Effects */
-
-	int new_state;		/**< State after transition */
-
-	/* Output emitted during transition */
-
-	unsigned out_mods;	/**< Modifier to emit */
-	unsigned out_key;	/**< Keycode to emit */
-} gsp_trans_t;
-
-extern void gsp_init(gsp_t *);
-extern int gsp_insert_defs(gsp_t *, const int *);
-extern int gsp_insert_seq(gsp_t *, const int *, unsigned, unsigned);
-extern int gsp_step(gsp_t *, int, int, unsigned *, unsigned *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/input.c
===================================================================
--- uspace/srv/hid/input/input.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,936 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2006 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup inputgen generic
- * @brief HelenOS input server.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#include <adt/fifo.h>
-#include <adt/list.h>
-#include <async.h>
-#include <config.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <io/chardev.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <ipc/services.h>
-#include <ipc/input.h>
-#include <loc.h>
-#include <ns.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-
-#include "input.h"
-#include "kbd.h"
-#include "kbd_port.h"
-#include "kbd_ctl.h"
-#include "layout.h"
-#include "mouse.h"
-#include "mouse_proto.h"
-#include "serial.h"
-
-#define NUM_LAYOUTS 5
-
-static layout_ops_t *layout[NUM_LAYOUTS] = {
-	&us_qwerty_ops,
-	&us_dvorak_ops,
-	&cz_ops,
-	&ar_ops,
-	&fr_azerty_ops
-};
-
-typedef struct {
-	/** Link into the list of clients */
-	link_t link;
-
-	/** Indicate whether the client is active */
-	bool active;
-
-	/** Client callback session */
-	async_sess_t *sess;
-} client_t;
-
-/** List of clients */
-static list_t clients;
-static client_t *active_client = NULL;
-
-/** Kernel override */
-static bool active = true;
-
-/** Serial console specified by the user */
-static char *serial_console;
-
-/** List of keyboard devices */
-static list_t kbd_devs;
-
-/** List of mouse devices */
-static list_t mouse_devs;
-
-/** List of serial devices */
-static list_t serial_devs;
-
-static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
-
-static void *client_data_create(void)
-{
-	client_t *client = (client_t *) calloc(1, sizeof(client_t));
-	if (client == NULL)
-		return NULL;
-
-	link_initialize(&client->link);
-	client->active = false;
-	client->sess = NULL;
-
-	list_append(&client->link, &clients);
-
-	return client;
-}
-
-static void client_data_destroy(void *data)
-{
-	client_t *client = (client_t *) data;
-
-	list_remove(&client->link);
-	free(client);
-}
-
-void kbd_push_data(kbd_dev_t *kdev, sysarg_t data)
-{
-	(*kdev->ctl_ops->parse)(data);
-}
-
-void mouse_push_data(mouse_dev_t *mdev, sysarg_t data)
-{
-	(*mdev->proto_ops->parse)(data);
-}
-
-void kbd_push_event(kbd_dev_t *kdev, int type, unsigned int key)
-{
-	kbd_event_t ev;
-	unsigned int mod_mask;
-
-	switch (key) {
-	case KC_LCTRL:
-		mod_mask = KM_LCTRL;
-		break;
-	case KC_RCTRL:
-		mod_mask = KM_RCTRL;
-		break;
-	case KC_LSHIFT:
-		mod_mask = KM_LSHIFT;
-		break;
-	case KC_RSHIFT:
-		mod_mask = KM_RSHIFT;
-		break;
-	case KC_LALT:
-		mod_mask = KM_LALT;
-		break;
-	case KC_RALT:
-		mod_mask = KM_RALT;
-		break;
-	default:
-		mod_mask = 0;
-	}
-
-	if (mod_mask != 0) {
-		if (type == KEY_PRESS)
-			kdev->mods = kdev->mods | mod_mask;
-		else
-			kdev->mods = kdev->mods & ~mod_mask;
-	}
-
-	switch (key) {
-	case KC_CAPS_LOCK:
-		mod_mask = KM_CAPS_LOCK;
-		break;
-	case KC_NUM_LOCK:
-		mod_mask = KM_NUM_LOCK;
-		break;
-	case KC_SCROLL_LOCK:
-		mod_mask = KM_SCROLL_LOCK;
-		break;
-	default:
-		mod_mask = 0;
-	}
-
-	if (mod_mask != 0) {
-		if (type == KEY_PRESS) {
-			/*
-			 * Only change lock state on transition from released
-			 * to pressed. This prevents autorepeat from messing
-			 * up the lock state.
-			 */
-			kdev->mods = kdev->mods ^ (mod_mask & ~kdev->lock_keys);
-			kdev->lock_keys = kdev->lock_keys | mod_mask;
-
-			/* Update keyboard lock indicator lights. */
-			(*kdev->ctl_ops->set_ind)(kdev, kdev->mods);
-		} else {
-			kdev->lock_keys = kdev->lock_keys & ~mod_mask;
-		}
-	}
-
-	// TODO: More elegant layout switching
-
-	if ((type == KEY_PRESS) && (kdev->mods & KM_LCTRL)) {
-		switch (key) {
-		case KC_F1:
-			layout_destroy(kdev->active_layout);
-			kdev->active_layout = layout_create(layout[0]);
-			break;
-		case KC_F2:
-			layout_destroy(kdev->active_layout);
-			kdev->active_layout = layout_create(layout[1]);
-			break;
-		case KC_F3:
-			layout_destroy(kdev->active_layout);
-			kdev->active_layout = layout_create(layout[2]);
-			break;
-		case KC_F4:
-			layout_destroy(kdev->active_layout);
-			kdev->active_layout = layout_create(layout[3]);
-			break;
-		case KC_F5:
-			layout_destroy(kdev->active_layout);
-			kdev->active_layout = layout_create(layout[4]);
-			break;
-		default: // default: is here to avoid compiler warning about unhandled cases
-			break;
-		}
-	}
-
-	if (type == KEY_PRESS) {
-		switch (key) {
-		case KC_F12:
-			console_kcon();
-			break;
-		}
-	}
-
-	ev.type = type;
-	ev.key = key;
-	ev.mods = kdev->mods;
-
-	ev.c = layout_parse_ev(kdev->active_layout, &ev);
-
-	list_foreach(clients, link, client_t, client) {
-		if (client->active) {
-			async_exch_t *exch = async_exchange_begin(client->sess);
-			async_msg_5(exch, INPUT_EVENT_KEY, kdev->svc_id,
-			    ev.type, ev.key, ev.mods, ev.c);
-			async_exchange_end(exch);
-		}
-	}
-}
-
-/** Mouse pointer has moved (relative mode). */
-void mouse_push_event_move(mouse_dev_t *mdev, int dx, int dy, int dz)
-{
-	list_foreach(clients, link, client_t, client) {
-		if (client->active) {
-			async_exch_t *exch = async_exchange_begin(client->sess);
-
-			if ((dx) || (dy))
-				async_msg_3(exch, INPUT_EVENT_MOVE,
-				    mdev->svc_id, dx, dy);
-
-			if (dz) {
-				// TODO: Implement proper wheel support
-				keycode_t code = dz > 0 ? KC_UP : KC_DOWN;
-
-				for (unsigned int i = 0; i < 3; i++)
-					async_msg_5(exch, INPUT_EVENT_KEY,
-					    0 /* XXX kbd_id */,
-					    KEY_PRESS, code, 0, 0);
-
-				async_msg_5(exch, INPUT_EVENT_KEY, KEY_RELEASE,
-				    0 /* XXX kbd_id */, code, 0, 0);
-			}
-
-			async_exchange_end(exch);
-		}
-	}
-}
-
-/** Mouse pointer has moved (absolute mode). */
-void mouse_push_event_abs_move(mouse_dev_t *mdev, unsigned int x, unsigned int y,
-    unsigned int max_x, unsigned int max_y)
-{
-	list_foreach(clients, link, client_t, client) {
-		if (client->active) {
-			if ((max_x) && (max_y)) {
-				async_exch_t *exch = async_exchange_begin(client->sess);
-				async_msg_5(exch, INPUT_EVENT_ABS_MOVE,
-				    mdev->svc_id, x, y, max_x, max_y);
-				async_exchange_end(exch);
-			}
-		}
-	}
-}
-
-/** Mouse button has been pressed. */
-void mouse_push_event_button(mouse_dev_t *mdev, int bnum, int press)
-{
-	list_foreach(clients, link, client_t, client) {
-		if (client->active) {
-			async_exch_t *exch = async_exchange_begin(client->sess);
-			async_msg_3(exch, INPUT_EVENT_BUTTON, mdev->svc_id,
-			    bnum, press);
-			async_exchange_end(exch);
-		}
-	}
-}
-
-/** Mouse button has been double-clicked. */
-void mouse_push_event_dclick(mouse_dev_t *mdev, int bnum)
-{
-	list_foreach(clients, link, client_t, client) {
-		if (client->active) {
-			async_exch_t *exch = async_exchange_begin(client->sess);
-			async_msg_2(exch, INPUT_EVENT_DCLICK, mdev->svc_id,
-			    bnum);
-			async_exchange_end(exch);
-		}
-	}
-}
-
-/** Arbitrate client activation */
-static void client_arbitration(void)
-{
-	/* Mutual exclusion of active clients */
-	list_foreach(clients, link, client_t, client)
-		client->active = ((active) && (client == active_client));
-
-	/* Notify clients about the arbitration */
-	list_foreach(clients, link, client_t, client) {
-		async_exch_t *exch = async_exchange_begin(client->sess);
-		async_msg_0(exch, client->active ?
-		    INPUT_EVENT_ACTIVE : INPUT_EVENT_DEACTIVE);
-		async_exchange_end(exch);
-	}
-}
-
-/** New client connection */
-static void client_connection(ipc_call_t *icall, void *arg)
-{
-	client_t *client = (client_t *) async_get_client_data();
-	if (client == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			if (client->sess != NULL) {
-				async_hangup(client->sess);
-				client->sess = NULL;
-			}
-
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		async_sess_t *sess =
-		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
-		if (sess != NULL) {
-			if (client->sess == NULL) {
-				client->sess = sess;
-				async_answer_0(&call, EOK);
-			} else
-				async_answer_0(&call, ELIMIT);
-		} else {
-			switch (ipc_get_imethod(&call)) {
-			case INPUT_ACTIVATE:
-				active_client = client;
-				client_arbitration();
-				async_answer_0(&call, EOK);
-				break;
-			default:
-				async_answer_0(&call, EINVAL);
-			}
-		}
-	}
-}
-
-static void kconsole_event_handler(ipc_call_t *call, void *arg)
-{
-	if (ipc_get_arg1(call)) {
-		/* Kernel console activated */
-		active = false;
-	} else {
-		/* Kernel console deactivated */
-		active = true;
-	}
-
-	client_arbitration();
-}
-
-static kbd_dev_t *kbd_dev_new(void)
-{
-	kbd_dev_t *kdev = calloc(1, sizeof(kbd_dev_t));
-	if (kdev == NULL) {
-		printf("%s: Error allocating keyboard device. "
-		    "Out of memory.\n", NAME);
-		return NULL;
-	}
-
-	link_initialize(&kdev->link);
-
-	kdev->mods = KM_NUM_LOCK;
-	kdev->lock_keys = 0;
-	kdev->active_layout = layout_create(layout[0]);
-
-	return kdev;
-}
-
-static mouse_dev_t *mouse_dev_new(void)
-{
-	mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t));
-	if (mdev == NULL) {
-		printf("%s: Error allocating mouse device. "
-		    "Out of memory.\n", NAME);
-		return NULL;
-	}
-
-	link_initialize(&mdev->link);
-
-	return mdev;
-}
-
-static serial_dev_t *serial_dev_new(void)
-{
-	serial_dev_t *sdev = calloc(1, sizeof(serial_dev_t));
-	if (sdev == NULL) {
-		printf("%s: Error allocating serial device. "
-		    "Out of memory.\n", NAME);
-		return NULL;
-	}
-
-	sdev->kdev = kbd_dev_new();
-	if (sdev->kdev == NULL) {
-		free(sdev);
-		return NULL;
-	}
-
-	link_initialize(&sdev->link);
-
-	return sdev;
-}
-
-/** Add new legacy keyboard device. */
-static void kbd_add_dev(kbd_port_ops_t *port, kbd_ctl_ops_t *ctl)
-{
-	kbd_dev_t *kdev = kbd_dev_new();
-	if (kdev == NULL)
-		return;
-
-	kdev->port_ops = port;
-	kdev->ctl_ops = ctl;
-	kdev->svc_id = 0;
-
-	/* Initialize port driver. */
-	if ((*kdev->port_ops->init)(kdev) != 0)
-		goto fail;
-
-	/* Initialize controller driver. */
-	if ((*kdev->ctl_ops->init)(kdev) != 0) {
-		/* XXX Uninit port */
-		goto fail;
-	}
-
-	list_append(&kdev->link, &kbd_devs);
-	return;
-
-fail:
-	free(kdev);
-}
-
-/** Add new kbdev device.
- *
- * @param service_id Service ID of the keyboard device
- *
- */
-static int kbd_add_kbdev(service_id_t service_id, kbd_dev_t **kdevp)
-{
-	kbd_dev_t *kdev = kbd_dev_new();
-	if (kdev == NULL)
-		return -1;
-
-	kdev->svc_id = service_id;
-	kdev->port_ops = NULL;
-	kdev->ctl_ops = &kbdev_ctl;
-
-	errno_t rc = loc_service_get_name(service_id, &kdev->svc_name);
-	if (rc != EOK) {
-		kdev->svc_name = NULL;
-		goto fail;
-	}
-
-	/* Initialize controller driver. */
-	if ((*kdev->ctl_ops->init)(kdev) != 0) {
-		goto fail;
-	}
-
-	list_append(&kdev->link, &kbd_devs);
-	*kdevp = kdev;
-	return 0;
-
-fail:
-	if (kdev->svc_name != NULL)
-		free(kdev->svc_name);
-	free(kdev);
-	return -1;
-}
-
-/** Add new mousedev device.
- *
- * @param service_id Service ID of the mouse device
- *
- */
-static int mouse_add_mousedev(service_id_t service_id, mouse_dev_t **mdevp)
-{
-	mouse_dev_t *mdev = mouse_dev_new();
-	if (mdev == NULL)
-		return -1;
-
-	mdev->svc_id = service_id;
-	mdev->port_ops = NULL;
-	mdev->proto_ops = &mousedev_proto;
-
-	errno_t rc = loc_service_get_name(service_id, &mdev->svc_name);
-	if (rc != EOK) {
-		mdev->svc_name = NULL;
-		goto fail;
-	}
-
-	/* Initialize controller driver. */
-	if ((*mdev->proto_ops->init)(mdev) != 0) {
-		goto fail;
-	}
-
-	list_append(&mdev->link, &mouse_devs);
-	*mdevp = mdev;
-	return 0;
-
-fail:
-	free(mdev);
-	return -1;
-}
-
-static errno_t serial_consumer(void *arg)
-{
-	serial_dev_t *sdev = (serial_dev_t *) arg;
-
-	while (true) {
-		uint8_t data;
-		size_t nread;
-
-		chardev_read(sdev->chardev, &data, sizeof(data), &nread,
-		    chardev_f_none);
-		/* XXX Handle error */
-		kbd_push_data(sdev->kdev, data);
-	}
-
-	return EOK;
-}
-
-/** Add new serial console device.
- *
- * @param service_id Service ID of the chardev device
- *
- */
-static int serial_add_srldev(service_id_t service_id, serial_dev_t **sdevp)
-{
-	bool match = false;
-	errno_t rc;
-
-	serial_dev_t *sdev = serial_dev_new();
-	if (sdev == NULL)
-		return -1;
-
-	sdev->kdev->svc_id = service_id;
-
-	rc = loc_service_get_name(service_id, &sdev->kdev->svc_name);
-	if (rc != EOK)
-		goto fail;
-
-	list_append(&sdev->link, &serial_devs);
-
-	/*
-	 * Is this the device the user wants to use as a serial console?
-	 */
-	match = (serial_console != NULL) &&
-	    !str_cmp(serial_console, sdev->kdev->svc_name);
-
-	if (match) {
-		sdev->kdev->ctl_ops = &stty_ctl;
-
-		/* Initialize controller driver. */
-		if ((*sdev->kdev->ctl_ops->init)(sdev->kdev) != 0) {
-			list_remove(&sdev->link);
-			goto fail;
-		}
-
-		sdev->sess = loc_service_connect(service_id, INTERFACE_DDF,
-		    IPC_FLAG_BLOCKING);
-
-		rc = chardev_open(sdev->sess, &sdev->chardev);
-		if (rc != EOK) {
-			async_hangup(sdev->sess);
-			sdev->sess = NULL;
-			list_remove(&sdev->link);
-			goto fail;
-		}
-
-		fid_t fid = fibril_create(serial_consumer, sdev);
-		fibril_add_ready(fid);
-	}
-
-	*sdevp = sdev;
-	return 0;
-
-fail:
-	if (sdev->kdev->svc_name != NULL)
-		free(sdev->kdev->svc_name);
-	free(sdev->kdev);
-	free(sdev);
-	return -1;
-}
-
-/** Add legacy drivers/devices. */
-static void kbd_add_legacy_devs(void)
-{
-	/*
-	 * Need to add these drivers based on config unless we can probe
-	 * them automatically.
-	 */
-#if defined(UARCH_arm32) && defined(MACHINE_gta02)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-#if defined(UARCH_ia64) && defined(MACHINE_ski)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-#if defined(MACHINE_msim)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-#if defined(UARCH_sparc64) && defined(PROCESSOR_sun4v)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-#if defined(UARCH_arm64) && defined(MACHINE_virt)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-#if defined(UARCH_arm64) && defined(MACHINE_hikey960)
-	kbd_add_dev(&chardev_port, &stty_ctl);
-#endif
-	/* Silence warning on abs32le about kbd_add_dev() being unused */
-	(void) kbd_add_dev;
-}
-
-static errno_t dev_check_new_kbdevs(void)
-{
-	category_id_t keyboard_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	bool already_known;
-	errno_t rc;
-
-	rc = loc_category_get_id("keyboard", &keyboard_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed resolving category 'keyboard'.\n", NAME);
-		return ENOENT;
-	}
-
-	/*
-	 * Check for new keyboard devices
-	 */
-	rc = loc_category_get_svcs(keyboard_cat, &svcs, &count);
-	if (rc != EOK) {
-		printf("%s: Failed getting list of keyboard devices.\n",
-		    NAME);
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		/* Determine whether we already know this device. */
-		list_foreach(kbd_devs, link, kbd_dev_t, kdev) {
-			if (kdev->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			kbd_dev_t *kdev;
-			if (kbd_add_kbdev(svcs[i], &kdev) == 0) {
-				printf("%s: Connected keyboard device '%s'\n",
-				    NAME, kdev->svc_name);
-			}
-		}
-	}
-
-	free(svcs);
-
-	/* XXX Handle device removal */
-
-	return EOK;
-}
-
-static errno_t dev_check_new_mousedevs(void)
-{
-	category_id_t mouse_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	bool already_known;
-	errno_t rc;
-
-	rc = loc_category_get_id("mouse", &mouse_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed resolving category 'mouse'.\n", NAME);
-		return ENOENT;
-	}
-
-	/*
-	 * Check for new mouse devices
-	 */
-	rc = loc_category_get_svcs(mouse_cat, &svcs, &count);
-	if (rc != EOK) {
-		printf("%s: Failed getting list of mouse devices.\n",
-		    NAME);
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		/* Determine whether we already know this device. */
-		list_foreach(mouse_devs, link, mouse_dev_t, mdev) {
-			if (mdev->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			mouse_dev_t *mdev;
-			if (mouse_add_mousedev(svcs[i], &mdev) == 0) {
-				printf("%s: Connected mouse device '%s'\n",
-				    NAME, mdev->svc_name);
-			}
-		}
-	}
-
-	free(svcs);
-
-	/* XXX Handle device removal */
-
-	return EOK;
-}
-
-static errno_t dev_check_new_serialdevs(void)
-{
-	category_id_t serial_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	bool already_known;
-	errno_t rc;
-
-	rc = loc_category_get_id("serial", &serial_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed resolving category 'serial'.\n", NAME);
-		return ENOENT;
-	}
-
-	/*
-	 * Check for new serial devices
-	 */
-	rc = loc_category_get_svcs(serial_cat, &svcs, &count);
-	if (rc != EOK) {
-		printf("%s: Failed getting list of serial devices.\n",
-		    NAME);
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		/* Determine whether we already know this device. */
-		list_foreach(serial_devs, link, serial_dev_t, sdev) {
-			if (sdev->kdev->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			serial_dev_t *sdev;
-			if (serial_add_srldev(svcs[i], &sdev) == 0) {
-				printf("%s: Connected serial device '%s'\n",
-				    NAME, sdev->kdev->svc_name);
-			}
-		}
-	}
-
-	free(svcs);
-
-	/* XXX Handle device removal */
-
-	return EOK;
-}
-
-static errno_t dev_check_new(void)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&discovery_lock);
-
-	if (!serial_console) {
-		rc = dev_check_new_kbdevs();
-		if (rc != EOK) {
-			fibril_mutex_unlock(&discovery_lock);
-			return rc;
-		}
-
-		rc = dev_check_new_mousedevs();
-		if (rc != EOK) {
-			fibril_mutex_unlock(&discovery_lock);
-			return rc;
-		}
-	} else {
-		rc = dev_check_new_serialdevs();
-		if (rc != EOK) {
-			fibril_mutex_unlock(&discovery_lock);
-			return rc;
-		}
-	}
-
-	fibril_mutex_unlock(&discovery_lock);
-
-	return EOK;
-}
-
-static void cat_change_cb(void *arg)
-{
-	dev_check_new();
-}
-
-/** Start listening for new devices. */
-static errno_t input_start_dev_discovery(void)
-{
-	errno_t rc = loc_register_cat_change_cb(cat_change_cb, NULL);
-	if (rc != EOK) {
-		printf("%s: Failed registering callback for device discovery: "
-		    "%s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	return dev_check_new();
-}
-
-static void usage(char *name)
-{
-	printf("Usage: %s <service_name>\n", name);
-}
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-	loc_srv_t *srv;
-
-	if (argc < 2) {
-		usage(argv[0]);
-		return 1;
-	}
-
-	printf("%s: HelenOS input service\n", NAME);
-
-	list_initialize(&clients);
-	list_initialize(&kbd_devs);
-	list_initialize(&mouse_devs);
-	list_initialize(&serial_devs);
-
-	serial_console = config_get_value("console");
-
-	/* Add legacy keyboard devices. */
-	kbd_add_legacy_devs();
-
-	/* Register driver */
-	async_set_client_data_constructor(client_data_create);
-	async_set_client_data_destructor(client_data_destroy);
-	async_set_fallback_port_handler(client_connection, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register server\n", NAME);
-		return rc;
-	}
-
-	service_id_t service_id;
-	rc = loc_service_register(srv, argv[1], &service_id);
-	if (rc != EOK) {
-		printf("%s: Unable to register service %s\n", NAME, argv[1]);
-		return rc;
-	}
-
-	/* Receive kernel notifications */
-	rc = async_event_subscribe(EVENT_KCONSOLE, kconsole_event_handler, NULL);
-	if (rc != EOK)
-		printf("%s: Failed to register kconsole notifications (%s)\n",
-		    NAME, str_error(rc));
-
-	/* Start looking for new input devices */
-	input_start_dev_discovery();
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached. */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/input.h
===================================================================
--- uspace/srv/hid/input/input.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief HelenOS input server.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef INPUT_H_
-#define INPUT_H_
-
-#include <stdbool.h>
-#include <async.h>
-
-#define NAME  "input"
-
-extern bool irc_service;
-extern async_sess_t *irc_sess;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/kbd.h
===================================================================
--- uspace/srv/hid/input/kbd.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * Copyright (c) 2006 Josef Cejka
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief HelenOS input server.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef KBD_KBD_H_
-#define KBD_KBD_H_
-
-#include <adt/list.h>
-#include <ipc/loc.h>
-
-struct kbd_port_ops;
-struct kbd_ctl_ops;
-struct layout;
-
-typedef struct kbd_dev {
-	/** Link to kbd_devs list */
-	link_t link;
-
-	/** Service ID (only for kbdev devices) */
-	service_id_t svc_id;
-
-	/** Device service name (only for kbdev devices) */
-	char *svc_name;
-
-	/** Port ops */
-	struct kbd_port_ops *port_ops;
-
-	/** Ctl ops */
-	struct kbd_ctl_ops *ctl_ops;
-
-	/** Controller-private data */
-	void *ctl_private;
-
-	/** Currently active modifiers. */
-	unsigned mods;
-
-	/** Currently pressed lock keys. We track these to tackle autorepeat. */
-	unsigned lock_keys;
-
-	/** Active keyboard layout */
-	struct layout *active_layout;
-} kbd_dev_t;
-
-extern void kbd_push_data(kbd_dev_t *, sysarg_t);
-extern void kbd_push_event(kbd_dev_t *, int, unsigned int);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/kbd_ctl.h
===================================================================
--- uspace/srv/hid/input/kbd_ctl.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Keyboard controller driver interface.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef KBD_CTL_H_
-#define KBD_CTL_H_
-
-#include "kbd_port.h"
-
-struct kbd_dev;
-
-typedef struct kbd_ctl_ops {
-	void (*parse)(sysarg_t);
-	errno_t (*init)(struct kbd_dev *);
-	void (*set_ind)(struct kbd_dev *, unsigned int);
-} kbd_ctl_ops_t;
-
-extern kbd_ctl_ops_t kbdev_ctl;
-extern kbd_ctl_ops_t stty_ctl;
-extern kbd_ctl_ops_t sun_ctl;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/kbd_port.h
===================================================================
--- uspace/srv/hid/input/kbd_port.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Keyboard port driver interface.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef KBD_PORT_H_
-#define KBD_PORT_H_
-
-#include <stdint.h>
-
-struct kbd_dev;
-
-typedef struct kbd_port_ops {
-	errno_t (*init)(struct kbd_dev *);
-	void (*write)(uint8_t);
-} kbd_port_ops_t;
-
-extern kbd_port_ops_t chardev_port;
-extern kbd_port_ops_t ns16550_port;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout.c
===================================================================
--- uspace/srv/hid/input/layout.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup inputgen generic
- * @brief Keyboard layouts
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include "input.h"
-#include "layout.h"
-
-/** Create a new layout instance. */
-layout_t *layout_create(layout_ops_t *ops)
-{
-	layout_t *layout;
-
-	layout = calloc(1, sizeof(layout_t));
-	if (layout == NULL) {
-		printf("%s: Out of memory.\n", NAME);
-		return NULL;
-	}
-
-	layout->ops = ops;
-	if ((*ops->create)(layout) != EOK) {
-		free(layout);
-		return NULL;
-	}
-
-	return layout;
-}
-
-/** Destroy layout instance. */
-void layout_destroy(layout_t *layout)
-{
-	(*layout->ops->destroy)(layout);
-	free(layout);
-}
-
-/** Parse keyboard event. */
-char32_t layout_parse_ev(layout_t *layout, kbd_event_t *ev)
-{
-	return (*layout->ops->parse_ev)(layout, ev);
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout.h
===================================================================
--- uspace/srv/hid/input/layout.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Keyboard layout interface.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef KBD_LAYOUT_H_
-#define KBD_LAYOUT_H_
-
-#include <io/console.h>
-
-/** Layout instance state */
-typedef struct layout {
-	/** Ops structure */
-	struct layout_ops *ops;
-
-	/* Layout-private data */
-	void *layout_priv;
-} layout_t;
-
-/** Layout ops */
-typedef struct layout_ops {
-	errno_t (*create)(layout_t *);
-	void (*destroy)(layout_t *);
-	char32_t (*parse_ev)(layout_t *, kbd_event_t *);
-} layout_ops_t;
-
-extern layout_ops_t us_qwerty_ops;
-extern layout_ops_t us_dvorak_ops;
-extern layout_ops_t cz_ops;
-extern layout_ops_t ar_ops;
-extern layout_ops_t fr_azerty_ops;
-
-extern layout_t *layout_create(layout_ops_t *);
-extern void layout_destroy(layout_t *);
-extern char32_t layout_parse_ev(layout_t *, kbd_event_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout/ar.c
===================================================================
--- uspace/srv/hid/input/layout/ar.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,240 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * Copyright (c) 2012 Mohammed Q. Hussain
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-
-/** @file
- * @brief Arabic keyboard layout (Based on US QWERTY layout's code)
- */
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include "../layout.h"
-#include "../kbd.h"
-
-static errno_t ar_create(layout_t *);
-static void ar_destroy(layout_t *);
-static char32_t ar_parse_ev(layout_t *, kbd_event_t *ev);
-
-layout_ops_t ar_ops = {
-	.create = ar_create,
-	.destroy = ar_destroy,
-	.parse_ev = ar_parse_ev
-};
-
-static char32_t map_not_shifted[] = {
-	[KC_BACKTICK] = L'ذ',
-
-	[KC_1] = '1',
-	[KC_2] = '2',
-	[KC_3] = '3',
-	[KC_4] = '4',
-	[KC_5] = '5',
-	[KC_6] = '6',
-	[KC_7] = '7',
-	[KC_8] = '8',
-	[KC_9] = '9',
-	[KC_0] = '0',
-
-	[KC_MINUS] = '-',
-	[KC_EQUALS] = '=',
-
-	[KC_LBRACKET] = L'ج',
-	[KC_RBRACKET] = L'د',
-
-	[KC_SEMICOLON] = L'ك',
-	[KC_QUOTE] = L'ط',
-	[KC_BACKSLASH] = '\\',
-
-	[KC_COMMA] = L'و',
-	[KC_PERIOD] = L'ز',
-	[KC_SLASH] = L'ظ',
-
-	[KC_Q] = L'ض',
-	[KC_W] = L'ص',
-	[KC_E] = L'ث',
-	[KC_R] = L'ق',
-	[KC_T] = L'ف',
-	[KC_Y] = L'غ',
-	[KC_U] = L'ع',
-	[KC_I] = L'ه',
-	[KC_O] = L'خ',
-	[KC_P] = L'ح',
-
-	[KC_A] = L'ش',
-	[KC_S] = L'س',
-	[KC_D] = L'ي',
-	[KC_F] = L'ب',
-	[KC_G] = L'ل',
-	[KC_H] = L'ا',
-	[KC_J] = L'ت',
-	[KC_K] = L'ن',
-	[KC_L] = L'م',
-
-	[KC_Z] = L'ئ',
-	[KC_X] = L'ء',
-	[KC_C] = L'ؤ',
-	[KC_V] = L'ر',
-	[KC_B] = L'ﻻ',
-	[KC_N] = L'ى',
-	[KC_M] = L'ة',
-};
-
-static char32_t map_shifted[] = {
-	[KC_BACKTICK] = L'ّ',
-
-	[KC_1] = '!',
-	[KC_2] = '@',
-	[KC_3] = '#',
-	[KC_4] = '$',
-	[KC_5] = '%',
-	[KC_6] = '^',
-	[KC_7] = '&',
-	[KC_8] = '*',
-	[KC_9] = ')',
-	[KC_0] = '(',
-
-	[KC_MINUS] = '_',
-	[KC_EQUALS] = '+',
-
-	[KC_LBRACKET] = '<',
-	[KC_RBRACKET] = '>',
-
-	[KC_SEMICOLON] = ':',
-	[KC_QUOTE] = '"',
-	[KC_BACKSLASH] = '|',
-
-	[KC_COMMA] = ',',
-	[KC_PERIOD] = '.',
-	[KC_SLASH] = L'؟',
-
-	[KC_Q] = L'َ',
-	[KC_W] = L'ً',
-	[KC_E] = L'ُ',
-	[KC_R] = L'ٌ',
-	[KC_T] = L'ﻹ',
-	[KC_Y] = L'إ',
-	[KC_U] = L'`',
-	[KC_I] = L'÷',
-	[KC_O] = L'×',
-	[KC_P] = L'؛',
-
-	[KC_A] = L'ِ',
-	[KC_S] = L'ٍ',
-	[KC_D] = L']',
-	[KC_F] = L'[',
-	[KC_G] = L'ﻷ',
-	[KC_H] = L'أ',
-	[KC_J] = L'ـ',
-	[KC_K] = L'،',
-	[KC_L] = L'/',
-
-	[KC_Z] = L'~',
-	[KC_X] = L'ْ',
-	[KC_C] = L'}',
-	[KC_V] = L'{',
-	[KC_B] = L'ﻵ',
-	[KC_N] = L'آ',
-	[KC_M] = L'\'',
-};
-
-static char32_t map_neutral[] = {
-	[KC_BACKSPACE] = '\b',
-	[KC_TAB] = '\t',
-	[KC_ENTER] = '\n',
-	[KC_SPACE] = ' ',
-
-	[KC_NSLASH] = '/',
-	[KC_NTIMES] = '*',
-	[KC_NMINUS] = '-',
-	[KC_NPLUS] = '+',
-	[KC_NENTER] = '\n'
-};
-
-static char32_t map_numeric[] = {
-	[KC_N7] = '7',
-	[KC_N8] = '8',
-	[KC_N9] = '9',
-	[KC_N4] = '4',
-	[KC_N5] = '5',
-	[KC_N6] = '6',
-	[KC_N1] = '1',
-	[KC_N2] = '2',
-	[KC_N3] = '3',
-
-	[KC_N0] = '0',
-	[KC_NPERIOD] = '.'
-};
-
-static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
-{
-	if (key >= map_length)
-		return 0;
-	return map[key];
-}
-
-static errno_t ar_create(layout_t *state)
-{
-	return EOK;
-}
-
-static void ar_destroy(layout_t *state)
-{
-}
-
-static char32_t ar_parse_ev(layout_t *state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_SHIFT) != 0)
-		c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_NUM_LOCK) != 0)
-		c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
-	else
-		c = 0;
-
-	return c;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout/cz.c
===================================================================
--- uspace/srv/hid/input/layout/cz.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,431 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-
-/** @file
- * @brief Czech QWERTZ layout
- */
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include "../input.h"
-#include "../layout.h"
-
-static errno_t cz_create(layout_t *);
-static void cz_destroy(layout_t *);
-static char32_t cz_parse_ev(layout_t *, kbd_event_t *ev);
-
-enum m_state {
-	ms_start,
-	ms_hacek,
-	ms_carka
-};
-
-typedef struct {
-	enum m_state mstate;
-} layout_cz_t;
-
-layout_ops_t cz_ops = {
-	.create = cz_create,
-	.destroy = cz_destroy,
-	.parse_ev = cz_parse_ev
-};
-
-static char32_t map_lcase[] = {
-	[KC_Q] = 'q',
-	[KC_W] = 'w',
-	[KC_E] = 'e',
-	[KC_R] = 'r',
-	[KC_T] = 't',
-	[KC_Y] = 'z',
-	[KC_U] = 'u',
-	[KC_I] = 'i',
-	[KC_O] = 'o',
-	[KC_P] = 'p',
-
-	[KC_A] = 'a',
-	[KC_S] = 's',
-	[KC_D] = 'd',
-	[KC_F] = 'f',
-	[KC_G] = 'g',
-	[KC_H] = 'h',
-	[KC_J] = 'j',
-	[KC_K] = 'k',
-	[KC_L] = 'l',
-
-	[KC_Z] = 'y',
-	[KC_X] = 'x',
-	[KC_C] = 'c',
-	[KC_V] = 'v',
-	[KC_B] = 'b',
-	[KC_N] = 'n',
-	[KC_M] = 'm',
-};
-
-static char32_t map_ucase[] = {
-	[KC_Q] = 'Q',
-	[KC_W] = 'W',
-	[KC_E] = 'E',
-	[KC_R] = 'R',
-	[KC_T] = 'T',
-	[KC_Y] = 'Z',
-	[KC_U] = 'U',
-	[KC_I] = 'I',
-	[KC_O] = 'O',
-	[KC_P] = 'P',
-
-	[KC_A] = 'A',
-	[KC_S] = 'S',
-	[KC_D] = 'D',
-	[KC_F] = 'F',
-	[KC_G] = 'G',
-	[KC_H] = 'H',
-	[KC_J] = 'J',
-	[KC_K] = 'K',
-	[KC_L] = 'L',
-
-	[KC_Z] = 'Y',
-	[KC_X] = 'X',
-	[KC_C] = 'C',
-	[KC_V] = 'V',
-	[KC_B] = 'B',
-	[KC_N] = 'N',
-	[KC_M] = 'M',
-};
-
-static char32_t map_not_shifted[] = {
-	[KC_BACKTICK] = ';',
-
-	[KC_1] = '+',
-
-	[KC_MINUS] = '=',
-
-	[KC_RBRACKET] = ')',
-
-	[KC_QUOTE] = L'§',
-
-	[KC_COMMA] = ',',
-	[KC_PERIOD] = '.',
-	[KC_SLASH] = '-',
-};
-
-static char32_t map_shifted[] = {
-	[KC_1] = '1',
-	[KC_2] = '2',
-	[KC_3] = '3',
-	[KC_4] = '4',
-	[KC_5] = '5',
-	[KC_6] = '6',
-	[KC_7] = '7',
-	[KC_8] = '8',
-	[KC_9] = '9',
-	[KC_0] = '0',
-
-	[KC_MINUS] = '%',
-
-	[KC_LBRACKET] = '/',
-	[KC_RBRACKET] = '(',
-
-	[KC_SEMICOLON] = '"',
-	[KC_QUOTE] = '!',
-	[KC_BACKSLASH] = '\'',
-
-	[KC_COMMA] = '?',
-	[KC_PERIOD] = ':',
-	[KC_SLASH] = '_',
-};
-
-static char32_t map_ns_nocaps[] = {
-	[KC_2] = L'ě',
-	[KC_3] = L'š',
-	[KC_4] = L'č',
-	[KC_5] = L'ř',
-	[KC_6] = L'ž',
-	[KC_7] = L'ý',
-	[KC_8] = L'á',
-	[KC_9] = L'í',
-	[KC_0] = L'é',
-
-	[KC_LBRACKET] = L'ú',
-	[KC_SEMICOLON] = L'ů'
-};
-
-static char32_t map_ns_caps[] = {
-	[KC_2] = L'Ě',
-	[KC_3] = L'Š',
-	[KC_4] = L'Č',
-	[KC_5] = L'Ř',
-	[KC_6] = L'Ž',
-	[KC_7] = L'Ý',
-	[KC_8] = L'Á',
-	[KC_9] = L'Í',
-	[KC_0] = L'É',
-
-	[KC_LBRACKET] = L'Ú',
-	[KC_SEMICOLON] = L'Ů'
-};
-
-static char32_t map_neutral[] = {
-	[KC_BACKSPACE] = '\b',
-	[KC_TAB] = '\t',
-	[KC_ENTER] = '\n',
-	[KC_SPACE] = ' ',
-
-	[KC_NSLASH] = '/',
-	[KC_NTIMES] = '*',
-	[KC_NMINUS] = '-',
-	[KC_NPLUS] = '+',
-	[KC_NENTER] = '\n'
-};
-
-static char32_t map_numeric[] = {
-	[KC_N7] = '7',
-	[KC_N8] = '8',
-	[KC_N9] = '9',
-	[KC_N4] = '4',
-	[KC_N5] = '5',
-	[KC_N6] = '6',
-	[KC_N1] = '1',
-	[KC_N2] = '2',
-	[KC_N3] = '3',
-
-	[KC_N0] = '0',
-	[KC_NPERIOD] = '.'
-};
-
-static char32_t map_hacek_lcase[] = {
-	[KC_E] = L'ě',
-	[KC_R] = L'ř',
-	[KC_T] = L'ť',
-	[KC_Y] = L'ž',
-	[KC_U] = L'ů',
-
-	[KC_S] = L'š',
-	[KC_D] = L'ď',
-
-	[KC_C] = L'č',
-	[KC_N] = L'ň'
-};
-
-static char32_t map_hacek_ucase[] = {
-	[KC_E] = L'Ě',
-	[KC_R] = L'Ř',
-	[KC_T] = L'Ť',
-	[KC_Y] = L'Ž',
-	[KC_U] = L'Ů',
-
-	[KC_S] = L'Š',
-	[KC_D] = L'Ď',
-
-	[KC_C] = L'Č',
-	[KC_N] = L'Ň'
-};
-
-static char32_t map_carka_lcase[] = {
-	[KC_E] = L'é',
-	[KC_U] = L'ú',
-	[KC_I] = L'í',
-	[KC_O] = L'ó',
-
-	[KC_A] = L'á',
-
-	[KC_Z] = L'ý',
-};
-
-static char32_t map_carka_ucase[] = {
-	[KC_E] = L'É',
-	[KC_U] = L'Ú',
-	[KC_I] = L'Í',
-	[KC_O] = L'Ó',
-
-	[KC_A] = L'Á',
-
-	[KC_Z] = L'Ý',
-};
-
-static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
-{
-	if (key >= map_length)
-		return 0;
-	return map[key];
-}
-
-static char32_t parse_ms_hacek(layout_cz_t *cz_state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	cz_state->mstate = ms_start;
-
-	/* Produce no characters when Ctrl or Alt is pressed. */
-	if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
-		return 0;
-
-	if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
-		c = translate(ev->key, map_hacek_ucase, sizeof(map_hacek_ucase) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_hacek_lcase, sizeof(map_hacek_lcase) / sizeof(char32_t));
-
-	return c;
-}
-
-static char32_t parse_ms_carka(layout_cz_t *cz_state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	cz_state->mstate = ms_start;
-
-	/* Produce no characters when Ctrl or Alt is pressed. */
-	if ((ev->mods & (KM_CTRL | KM_ALT)) != 0)
-		return 0;
-
-	if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
-		c = translate(ev->key, map_carka_ucase, sizeof(map_carka_ucase) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_carka_lcase, sizeof(map_carka_lcase) / sizeof(char32_t));
-
-	return c;
-}
-
-static char32_t parse_ms_start(layout_cz_t *cz_state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	if (ev->key == KC_EQUALS) {
-		if ((ev->mods & KM_SHIFT) != 0)
-			cz_state->mstate = ms_hacek;
-		else
-			cz_state->mstate = ms_carka;
-
-		return 0;
-	}
-
-	c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_SHIFT) == 0) {
-		if ((ev->mods & KM_CAPS_LOCK) != 0)
-			c = translate(ev->key, map_ns_caps, sizeof(map_ns_caps) / sizeof(char32_t));
-		else
-			c = translate(ev->key, map_ns_nocaps, sizeof(map_ns_nocaps) / sizeof(char32_t));
-
-		if (c != 0)
-			return c;
-	}
-
-	if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
-		c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_SHIFT) != 0)
-		c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_NUM_LOCK) != 0)
-		c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
-	else
-		c = 0;
-
-	return c;
-}
-
-static bool key_is_mod(unsigned key)
-{
-	switch (key) {
-	case KC_LSHIFT:
-	case KC_RSHIFT:
-	case KC_LALT:
-	case KC_RALT:
-	case KC_LCTRL:
-	case KC_RCTRL:
-		return true;
-	default:
-		return false;
-	}
-}
-
-static errno_t cz_create(layout_t *state)
-{
-	layout_cz_t *cz_state;
-
-	cz_state = malloc(sizeof(layout_cz_t));
-	if (cz_state == NULL) {
-		printf("%s: Out of memory.\n", NAME);
-		return ENOMEM;
-	}
-
-	cz_state->mstate = ms_start;
-	state->layout_priv = (void *) cz_state;
-
-	return EOK;
-}
-
-static void cz_destroy(layout_t *state)
-{
-	free(state->layout_priv);
-}
-
-static char32_t cz_parse_ev(layout_t *state, kbd_event_t *ev)
-{
-	layout_cz_t *cz_state = (layout_cz_t *) state->layout_priv;
-
-	if (ev->type != KEY_PRESS)
-		return 0;
-
-	if (key_is_mod(ev->key))
-		return 0;
-
-	switch (cz_state->mstate) {
-	case ms_start:
-		return parse_ms_start(cz_state, ev);
-	case ms_hacek:
-		return parse_ms_hacek(cz_state, ev);
-	case ms_carka:
-		return parse_ms_carka(cz_state, ev);
-	}
-
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout/fr_azerty.c
===================================================================
--- uspace/srv/hid/input/layout/fr_azerty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,255 +1,0 @@
-/*
- * Copyright (c) 2019 CHTCHEGLOV Ilia
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-
-/** @file
- * @brief French AZERTY layout
- */
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include "../layout.h"
-#include "../kbd.h"
-
-static errno_t fr_azerty_create (layout_t *);
-static void fr_azerty_destroy (layout_t *);
-static char32_t fr_azerty_parse_ev (layout_t *, kbd_event_t *);
-
-layout_ops_t fr_azerty_ops = {
-	.create = fr_azerty_create,
-	.destroy = fr_azerty_destroy,
-	.parse_ev = fr_azerty_parse_ev
-};
-
-static char32_t map_lcase[] = {
-	[KC_Q] = 'a',
-	[KC_W] = 'z',
-	[KC_E] = 'e',
-	[KC_R] = 'r',
-	[KC_T] = 't',
-	[KC_Y] = 'y',
-	[KC_U] = 'u',
-	[KC_I] = 'i',
-	[KC_O] = 'o',
-	[KC_P] = 'p',
-
-	[KC_A] = 'q',
-	[KC_S] = 's',
-	[KC_D] = 'd',
-	[KC_F] = 'f',
-	[KC_G] = 'g',
-	[KC_H] = 'h',
-	[KC_J] = 'j',
-	[KC_K] = 'k',
-	[KC_L] = 'l',
-
-	[KC_Z] = 'w',
-	[KC_X] = 'x',
-	[KC_C] = 'c',
-	[KC_V] = 'v',
-	[KC_B] = 'b',
-	[KC_N] = 'n',
-	[KC_M] = ',',
-};
-
-static char32_t map_ucase[] = {
-	[KC_Q] = 'A',
-	[KC_W] = 'Z',
-	[KC_E] = 'E',
-	[KC_R] = 'R',
-	[KC_T] = 'T',
-	[KC_Y] = 'Y',
-	[KC_U] = 'U',
-	[KC_I] = 'I',
-	[KC_O] = 'O',
-	[KC_P] = 'P',
-
-	[KC_A] = 'Q',
-	[KC_S] = 'S',
-	[KC_D] = 'D',
-	[KC_F] = 'F',
-	[KC_G] = 'G',
-	[KC_H] = 'H',
-	[KC_J] = 'J',
-	[KC_K] = 'K',
-	[KC_L] = 'L',
-
-	[KC_Z] = 'W',
-	[KC_X] = 'X',
-	[KC_C] = 'C',
-	[KC_V] = 'V',
-	[KC_B] = 'B',
-	[KC_N] = 'N',
-	[KC_2] = L'É',
-	[KC_7] = L'È',
-	[KC_9] = L'Ç',
-	[KC_0] = L'À',
-	[KC_M] = ','
-};
-
-static char32_t map_not_shifted[] = {
-	[KC_BACKTICK] = L'²',
-
-	[KC_1] = '&',
-	[KC_2] = L'é',
-	[KC_3] = '"',
-	[KC_4] = '\'',
-	[KC_5] = '(',
-	[KC_6] = '-',
-	[KC_7] = L'è',
-	[KC_8] = '_',
-	[KC_9] = L'ç',
-	[KC_0] = L'à',
-
-	[KC_MINUS] = ')',
-	[KC_EQUALS] = '=',
-
-	[KC_LBRACKET] = '^',
-	[KC_RBRACKET] = '$',
-
-	[KC_SEMICOLON] = 'm',
-	[KC_QUOTE] = L'ù',
-	[KC_BACKSLASH] = '*',
-
-	[KC_COMMA] = ';',
-	[KC_PERIOD] = ':',
-	[KC_SLASH] = '!',
-};
-
-static char32_t map_shifted[] = {
-	[KC_M] = '?',
-	[KC_BACKTICK] = '~',
-
-	[KC_1] = '1',
-	[KC_2] = '2',
-	[KC_3] = '3',
-	[KC_4] = '4',
-	[KC_5] = '5',
-	[KC_6] = '6',
-	[KC_7] = '7',
-	[KC_8] = '8',
-	[KC_9] = '9',
-	[KC_0] = '0',
-
-	[KC_MINUS] = L'°',
-	[KC_EQUALS] = '+',
-
-	[KC_LBRACKET] = L'¨',
-	[KC_RBRACKET] = L'£',
-
-	[KC_SEMICOLON] = 'M',
-	[KC_QUOTE] = '%',
-	[KC_BACKSLASH] = L'µ',
-
-	[KC_COMMA] = '.',
-	[KC_PERIOD] = '/',
-	[KC_SLASH] = '!',
-};
-
-static char32_t map_neutral[] = {
-	[KC_BACKSPACE] = '\b',
-	[KC_TAB] = '\t',
-	[KC_ENTER] = '\n',
-	[KC_SPACE] = ' ',
-
-	[KC_NSLASH] = '!',
-	[KC_NTIMES] = '*',
-	[KC_NMINUS] = '-',
-	[KC_NPLUS] = '+',
-	[KC_NENTER] = '\n'
-};
-
-static char32_t map_numeric[] = {
-	[KC_N7] = '7',
-	[KC_N8] = '8',
-	[KC_N9] = '9',
-	[KC_N4] = '4',
-	[KC_N5] = '5',
-	[KC_N6] = '6',
-	[KC_N1] = '1',
-	[KC_N2] = '2',
-	[KC_N3] = '3',
-
-	[KC_N0] = '0',
-	[KC_NPERIOD] = '.'
-};
-
-static char32_t translate (unsigned int key, char32_t *map, size_t map_len)
-{
-	if (key >= map_len)
-		return 0;
-	return map[key];
-}
-
-static errno_t fr_azerty_create (layout_t *s)
-{
-	return EOK;
-}
-
-static void fr_azerty_destroy (layout_t *s)
-{
-
-}
-
-static char32_t fr_azerty_parse_ev (layout_t *s, kbd_event_t *e)
-{
-	char32_t c = translate (e->key, map_neutral, sizeof (map_neutral) / sizeof (char32_t));
-	if (c)
-		return c;
-
-	if ((e->mods & KM_SHIFT))
-		c = translate (e->key, map_shifted, sizeof (map_shifted) / sizeof (char32_t));
-	else
-		c = translate (e->key, map_not_shifted, sizeof (map_not_shifted) / sizeof (char32_t));
-
-	if (c)
-		return c;
-
-	if (((e->mods & KM_SHIFT)) ^ ((e->mods & KM_CAPS_LOCK)))
-		c = translate (e->key, map_ucase, sizeof (map_ucase) / sizeof (char32_t));
-	else
-		c = translate (e->key, map_lcase, sizeof (map_lcase) / sizeof (char32_t));
-
-	if (c)
-		return c;
-
-	if ((e->mods & KM_NUM_LOCK))
-		c = translate (e->key, map_numeric, sizeof (map_numeric) / sizeof (char32_t));
-	else
-		c = 0;
-
-	return c;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout/us_dvorak.c
===================================================================
--- uspace/srv/hid/input/layout/us_dvorak.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-
-/** @file
- * @brief US Dvorak Simplified Keyboard layout
- */
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include "../layout.h"
-#include "../kbd.h"
-
-static errno_t us_dvorak_create(layout_t *);
-static void us_dvorak_destroy(layout_t *);
-static char32_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
-
-layout_ops_t us_dvorak_ops = {
-	.create = us_dvorak_create,
-	.destroy = us_dvorak_destroy,
-	.parse_ev = us_dvorak_parse_ev
-};
-
-static char32_t map_lcase[] = {
-	[KC_R] = 'p',
-	[KC_T] = 'y',
-	[KC_Y] = 'f',
-	[KC_U] = 'g',
-	[KC_I] = 'c',
-	[KC_O] = 'r',
-	[KC_P] = 'l',
-
-	[KC_A] = 'a',
-	[KC_S] = 'o',
-	[KC_D] = 'e',
-	[KC_F] = 'u',
-	[KC_G] = 'i',
-	[KC_H] = 'd',
-	[KC_J] = 'h',
-	[KC_K] = 't',
-	[KC_L] = 'n',
-
-	[KC_SEMICOLON] = 's',
-
-	[KC_X] = 'q',
-	[KC_C] = 'j',
-	[KC_V] = 'k',
-	[KC_B] = 'x',
-	[KC_N] = 'b',
-	[KC_M] = 'm',
-
-	[KC_COMMA] = 'w',
-	[KC_PERIOD] = 'v',
-	[KC_SLASH] = 'z',
-};
-
-static char32_t map_ucase[] = {
-	[KC_R] = 'P',
-	[KC_T] = 'Y',
-	[KC_Y] = 'F',
-	[KC_U] = 'G',
-	[KC_I] = 'C',
-	[KC_O] = 'R',
-	[KC_P] = 'L',
-
-	[KC_A] = 'A',
-	[KC_S] = 'O',
-	[KC_D] = 'E',
-	[KC_F] = 'U',
-	[KC_G] = 'I',
-	[KC_H] = 'D',
-	[KC_J] = 'H',
-	[KC_K] = 'T',
-	[KC_L] = 'N',
-
-	[KC_SEMICOLON] = 'S',
-
-	[KC_X] = 'Q',
-	[KC_C] = 'J',
-	[KC_V] = 'K',
-	[KC_B] = 'X',
-	[KC_N] = 'B',
-	[KC_M] = 'M',
-
-	[KC_COMMA] = 'W',
-	[KC_PERIOD] = 'V',
-	[KC_SLASH] = 'Z',
-};
-
-static char32_t map_not_shifted[] = {
-	[KC_BACKTICK] = '`',
-
-	[KC_1] = '1',
-	[KC_2] = '2',
-	[KC_3] = '3',
-	[KC_4] = '4',
-	[KC_5] = '5',
-	[KC_6] = '6',
-	[KC_7] = '7',
-	[KC_8] = '8',
-	[KC_9] = '9',
-	[KC_0] = '0',
-
-	[KC_MINUS] = '[',
-	[KC_EQUALS] = ']',
-
-	[KC_Q] = '\'',
-	[KC_W] = ',',
-	[KC_E] = '.',
-
-	[KC_LBRACKET] = '/',
-	[KC_RBRACKET] = '=',
-
-	[KC_QUOTE] = '-',
-	[KC_BACKSLASH] = '\\',
-
-	[KC_Z] = ';',
-};
-
-static char32_t map_shifted[] = {
-	[KC_BACKTICK] = '~',
-
-	[KC_1] = '!',
-	[KC_2] = '@',
-	[KC_3] = '#',
-	[KC_4] = '$',
-	[KC_5] = '%',
-	[KC_6] = '^',
-	[KC_7] = '&',
-	[KC_8] = '*',
-	[KC_9] = '(',
-	[KC_0] = ')',
-
-	[KC_MINUS] = '{',
-	[KC_EQUALS] = '}',
-
-	[KC_Q] = '"',
-	[KC_W] = '<',
-	[KC_E] = '>',
-
-	[KC_LBRACKET] = '?',
-	[KC_RBRACKET] = '+',
-
-	[KC_QUOTE] = '_',
-	[KC_BACKSLASH] = '|',
-
-	[KC_Z] = ':',
-};
-
-static char32_t map_neutral[] = {
-	[KC_BACKSPACE] = '\b',
-	[KC_TAB] = '\t',
-	[KC_ENTER] = '\n',
-	[KC_SPACE] = ' ',
-
-	[KC_NSLASH] = '/',
-	[KC_NTIMES] = '*',
-	[KC_NMINUS] = '-',
-	[KC_NPLUS] = '+',
-	[KC_NENTER] = '\n'
-};
-
-static char32_t map_numeric[] = {
-	[KC_N7] = '7',
-	[KC_N8] = '8',
-	[KC_N9] = '9',
-	[KC_N4] = '4',
-	[KC_N5] = '5',
-	[KC_N6] = '6',
-	[KC_N1] = '1',
-	[KC_N2] = '2',
-	[KC_N3] = '3',
-
-	[KC_N0] = '0',
-	[KC_NPERIOD] = '.'
-};
-
-static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
-{
-	if (key >= map_length)
-		return 0;
-	return map[key];
-}
-
-static errno_t us_dvorak_create(layout_t *state)
-{
-	return EOK;
-}
-
-static void us_dvorak_destroy(layout_t *state)
-{
-}
-
-static char32_t us_dvorak_parse_ev(layout_t *state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
-	if (c != 0)
-		return c;
-
-	if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
-		c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_SHIFT) != 0)
-		c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_NUM_LOCK) != 0)
-		c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
-	else
-		c = 0;
-
-	return c;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/layout/us_qwerty.c
===================================================================
--- uspace/srv/hid/input/layout/us_qwerty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,251 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-
-/** @file
- * @brief US QWERTY layout
- */
-
-#include <errno.h>
-#include <io/console.h>
-#include <io/keycode.h>
-#include "../layout.h"
-#include "../kbd.h"
-
-static errno_t us_qwerty_create(layout_t *);
-static void us_qwerty_destroy(layout_t *);
-static char32_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
-
-layout_ops_t us_qwerty_ops = {
-	.create = us_qwerty_create,
-	.destroy = us_qwerty_destroy,
-	.parse_ev = us_qwerty_parse_ev
-};
-
-static char32_t map_lcase[] = {
-	[KC_Q] = 'q',
-	[KC_W] = 'w',
-	[KC_E] = 'e',
-	[KC_R] = 'r',
-	[KC_T] = 't',
-	[KC_Y] = 'y',
-	[KC_U] = 'u',
-	[KC_I] = 'i',
-	[KC_O] = 'o',
-	[KC_P] = 'p',
-
-	[KC_A] = 'a',
-	[KC_S] = 's',
-	[KC_D] = 'd',
-	[KC_F] = 'f',
-	[KC_G] = 'g',
-	[KC_H] = 'h',
-	[KC_J] = 'j',
-	[KC_K] = 'k',
-	[KC_L] = 'l',
-
-	[KC_Z] = 'z',
-	[KC_X] = 'x',
-	[KC_C] = 'c',
-	[KC_V] = 'v',
-	[KC_B] = 'b',
-	[KC_N] = 'n',
-	[KC_M] = 'm',
-};
-
-static char32_t map_ucase[] = {
-	[KC_Q] = 'Q',
-	[KC_W] = 'W',
-	[KC_E] = 'E',
-	[KC_R] = 'R',
-	[KC_T] = 'T',
-	[KC_Y] = 'Y',
-	[KC_U] = 'U',
-	[KC_I] = 'I',
-	[KC_O] = 'O',
-	[KC_P] = 'P',
-
-	[KC_A] = 'A',
-	[KC_S] = 'S',
-	[KC_D] = 'D',
-	[KC_F] = 'F',
-	[KC_G] = 'G',
-	[KC_H] = 'H',
-	[KC_J] = 'J',
-	[KC_K] = 'K',
-	[KC_L] = 'L',
-
-	[KC_Z] = 'Z',
-	[KC_X] = 'X',
-	[KC_C] = 'C',
-	[KC_V] = 'V',
-	[KC_B] = 'B',
-	[KC_N] = 'N',
-	[KC_M] = 'M',
-};
-
-static char32_t map_not_shifted[] = {
-	[KC_BACKTICK] = '`',
-
-	[KC_1] = '1',
-	[KC_2] = '2',
-	[KC_3] = '3',
-	[KC_4] = '4',
-	[KC_5] = '5',
-	[KC_6] = '6',
-	[KC_7] = '7',
-	[KC_8] = '8',
-	[KC_9] = '9',
-	[KC_0] = '0',
-
-	[KC_MINUS] = '-',
-	[KC_EQUALS] = '=',
-
-	[KC_LBRACKET] = '[',
-	[KC_RBRACKET] = ']',
-
-	[KC_SEMICOLON] = ';',
-	[KC_QUOTE] = '\'',
-	[KC_BACKSLASH] = '\\',
-
-	[KC_COMMA] = ',',
-	[KC_PERIOD] = '.',
-	[KC_SLASH] = '/',
-};
-
-static char32_t map_shifted[] = {
-	[KC_BACKTICK] = '~',
-
-	[KC_1] = '!',
-	[KC_2] = '@',
-	[KC_3] = '#',
-	[KC_4] = '$',
-	[KC_5] = '%',
-	[KC_6] = '^',
-	[KC_7] = '&',
-	[KC_8] = '*',
-	[KC_9] = '(',
-	[KC_0] = ')',
-
-	[KC_MINUS] = '_',
-	[KC_EQUALS] = '+',
-
-	[KC_LBRACKET] = '{',
-	[KC_RBRACKET] = '}',
-
-	[KC_SEMICOLON] = ':',
-	[KC_QUOTE] = '"',
-	[KC_BACKSLASH] = '|',
-
-	[KC_COMMA] = '<',
-	[KC_PERIOD] = '>',
-	[KC_SLASH] = '?',
-};
-
-static char32_t map_neutral[] = {
-	[KC_BACKSPACE] = '\b',
-	[KC_TAB] = '\t',
-	[KC_ENTER] = '\n',
-	[KC_SPACE] = ' ',
-
-	[KC_NSLASH] = '/',
-	[KC_NTIMES] = '*',
-	[KC_NMINUS] = '-',
-	[KC_NPLUS] = '+',
-	[KC_NENTER] = '\n'
-};
-
-static char32_t map_numeric[] = {
-	[KC_N7] = '7',
-	[KC_N8] = '8',
-	[KC_N9] = '9',
-	[KC_N4] = '4',
-	[KC_N5] = '5',
-	[KC_N6] = '6',
-	[KC_N1] = '1',
-	[KC_N2] = '2',
-	[KC_N3] = '3',
-
-	[KC_N0] = '0',
-	[KC_NPERIOD] = '.'
-};
-
-static char32_t translate(unsigned int key, char32_t *map, size_t map_length)
-{
-	if (key >= map_length)
-		return 0;
-	return map[key];
-}
-
-static errno_t us_qwerty_create(layout_t *state)
-{
-	return EOK;
-}
-
-static void us_qwerty_destroy(layout_t *state)
-{
-}
-
-static char32_t us_qwerty_parse_ev(layout_t *state, kbd_event_t *ev)
-{
-	char32_t c;
-
-	c = translate(ev->key, map_neutral, sizeof(map_neutral) / sizeof(char32_t));
-	if (c != 0)
-		return c;
-
-	if (((ev->mods & KM_SHIFT) != 0) ^ ((ev->mods & KM_CAPS_LOCK) != 0))
-		c = translate(ev->key, map_ucase, sizeof(map_ucase) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_lcase, sizeof(map_lcase) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_SHIFT) != 0)
-		c = translate(ev->key, map_shifted, sizeof(map_shifted) / sizeof(char32_t));
-	else
-		c = translate(ev->key, map_not_shifted, sizeof(map_not_shifted) / sizeof(char32_t));
-
-	if (c != 0)
-		return c;
-
-	if ((ev->mods & KM_NUM_LOCK) != 0)
-		c = translate(ev->key, map_numeric, sizeof(map_numeric) / sizeof(char32_t));
-	else
-		c = 0;
-
-	return c;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/meson.build
===================================================================
--- uspace/srv/hid/input/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv', 'console', 'input' ]
-src = files(
-	'layout/cz.c',
-	'layout/fr_azerty.c',
-	'layout/us_qwerty.c',
-	'layout/us_dvorak.c',
-	'layout/ar.c',
-	'port/chardev.c',
-	'proto/mousedev.c',
-	'ctl/kbdev.c',
-	'ctl/stty.c',
-	'ctl/sun.c',
-	'gsp.c',
-	'input.c',
-	'layout.c',
-	'stroke.c',
-)
Index: pace/srv/hid/input/mouse.h
===================================================================
--- uspace/srv/hid/input/mouse.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Mouse device handling.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef MOUSE_H_
-#define MOUSE_H_
-
-#include <adt/list.h>
-#include <ipc/loc.h>
-
-struct mouse_port_ops;
-struct mouse_proto_ops;
-
-typedef struct mouse_dev {
-	/** Link to mouse_devs list */
-	link_t link;
-
-	/** Service ID (only for mousedev devices) */
-	service_id_t svc_id;
-
-	/** Device service name (only for mousedev devices) */
-	char *svc_name;
-
-	/** Port ops */
-	struct mouse_port_ops *port_ops;
-
-	/** Protocol ops */
-	struct mouse_proto_ops *proto_ops;
-} mouse_dev_t;
-
-extern void mouse_push_data(mouse_dev_t *, sysarg_t);
-extern void mouse_push_event_move(mouse_dev_t *, int, int, int);
-extern void mouse_push_event_abs_move(mouse_dev_t *, unsigned int, unsigned int,
-    unsigned int, unsigned int);
-extern void mouse_push_event_button(mouse_dev_t *, int, int);
-extern void mouse_push_event_dclick(mouse_dev_t *, int);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/mouse_port.h
===================================================================
--- uspace/srv/hid/input/mouse_port.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Mouse port driver interface.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef MOUSE_PORT_H_
-#define MOUSE_PORT_H_
-
-#include <stdint.h>
-
-struct mouse_dev;
-
-typedef struct mouse_port_ops {
-	errno_t (*init)(struct mouse_dev *);
-	void (*write)(uint8_t);
-} mouse_port_ops_t;
-
-extern mouse_port_ops_t chardev_mouse_port;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/mouse_proto.h
===================================================================
--- uspace/srv/hid/input/mouse_proto.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Mouse protocol driver interface.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef MOUSE_PROTO_H_
-#define MOUSE_PROTO_H_
-
-#include "mouse_port.h"
-
-struct mouse_dev;
-
-typedef struct mouse_proto_ops {
-	void (*parse)(sysarg_t);
-	errno_t (*init)(struct mouse_dev *);
-} mouse_proto_ops_t;
-
-extern mouse_proto_ops_t mousedev_proto;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/port/chardev.c
===================================================================
--- uspace/srv/hid/input/port/chardev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup kbd_port
- * @ingroup input
- * @{
- */
-/** @file
- * @brief Chardev keyboard port driver.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <fibril.h>
-#include <io/chardev.h>
-#include <loc.h>
-#include <stdio.h>
-#include "../input.h"
-#include "../kbd_port.h"
-#include "../kbd.h"
-
-static errno_t kbd_port_fibril(void *);
-
-static errno_t chardev_port_init(kbd_dev_t *);
-static void chardev_port_write(uint8_t);
-
-kbd_port_ops_t chardev_port = {
-	.init = chardev_port_init,
-	.write = chardev_port_write
-};
-
-static kbd_dev_t *kbd_dev;
-static async_sess_t *dev_sess;
-static chardev_t *chardev;
-
-/** List of devices to try connecting to. */
-static const char *in_devs[] = {
-	/** S3C24xx UART - Openmoko debug console */
-	"char/s3c24xx_uart",
-	/** Ski console, MSIM console, Sun4v console */
-	"devices/\\hw\\console\\a",
-	/** PL011 serial console */
-	"devices/\\hw\\uart\\a"
-};
-
-static const unsigned int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
-
-static errno_t chardev_port_init(kbd_dev_t *kdev)
-{
-	service_id_t service_id;
-	unsigned int i;
-	fid_t fid;
-	errno_t rc;
-
-	kbd_dev = kdev;
-again:
-	for (i = 0; i < num_devs; i++) {
-		rc = loc_service_get_id(in_devs[i], &service_id, 0);
-		if (rc == EOK)
-			break;
-	}
-
-	if (i >= num_devs) {
-		/* XXX This is just a hack. */
-		printf("%s: No input device found, sleep for retry.\n", NAME);
-		fibril_usleep(1000 * 1000);
-		goto again;
-	}
-
-	dev_sess = loc_service_connect(service_id, INTERFACE_DDF,
-	    IPC_FLAG_BLOCKING);
-	if (dev_sess == NULL) {
-		printf("%s: Failed connecting to device\n", NAME);
-		return ENOENT;
-	}
-
-	rc = chardev_open(dev_sess, &chardev);
-	if (rc != EOK) {
-		printf("%s: Failed opening character device\n", NAME);
-		async_hangup(dev_sess);
-		return ENOMEM;
-	}
-
-	fid = fibril_create(kbd_port_fibril, NULL);
-	if (fid == 0) {
-		printf("%s: Failed creating fibril\n", NAME);
-		chardev_close(chardev);
-		async_hangup(dev_sess);
-		return ENOMEM;
-	}
-
-	fibril_add_ready(fid);
-
-	printf("%s: Found input device '%s'\n", NAME, in_devs[i]);
-	return 0;
-}
-
-static void chardev_port_write(uint8_t data)
-{
-	errno_t rc;
-	size_t nwr;
-
-	rc = chardev_write(chardev, &data, sizeof(data), &nwr);
-	if (rc != EOK || nwr != sizeof(data)) {
-		printf("%s: Failed writing to character device\n", NAME);
-		return;
-	}
-}
-
-static errno_t kbd_port_fibril(void *arg)
-{
-	errno_t rc;
-	size_t nread;
-	uint8_t b;
-
-	while (true) {
-		rc = chardev_read(chardev, &b, sizeof(b), &nread,
-		    chardev_f_none);
-		if (rc != EOK || nread != sizeof(b)) {
-			printf("%s: Error reading data", NAME);
-			continue;
-		}
-
-		kbd_push_data(kbd_dev, b);
-	}
-
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/proto/mousedev.c
===================================================================
--- uspace/srv/hid/input/proto/mousedev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup mouse_proto
- * @ingroup input
- * @{
- */
-/**
- * @file
- * @brief Mouse device connector controller driver.
- */
-
-#include <stdio.h>
-#include <vfs/vfs_sess.h>
-#include <async.h>
-#include <errno.h>
-#include <ipc/mouseev.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <time.h>
-#include "../mouse.h"
-#include "../mouse_port.h"
-#include "../mouse_proto.h"
-#include "../input.h"
-
-enum {
-	/** Default double-click speed in milliseconds */
-	dclick_delay_ms = 500
-};
-
-/** Mousedev softstate */
-typedef struct {
-	/** Link to generic mouse device */
-	mouse_dev_t *mouse_dev;
-	/** Button number of last button pressed (or -1 if none) */
-	int press_bnum;
-	/** Time at which button was last pressed */
-	struct timespec press_time;
-} mousedev_t;
-
-static mousedev_t *mousedev_new(mouse_dev_t *mdev)
-{
-	mousedev_t *mousedev = calloc(1, sizeof(mousedev_t));
-	if (mousedev == NULL)
-		return NULL;
-
-	mousedev->mouse_dev = mdev;
-	mousedev->press_bnum = -1;
-
-	return mousedev;
-}
-
-static void mousedev_destroy(mousedev_t *mousedev)
-{
-	free(mousedev);
-}
-
-static void mousedev_press(mousedev_t *mousedev, int bnum)
-{
-	struct timespec now;
-	nsec_t ms_delay;
-
-	getuptime(&now);
-
-	/* Same button was pressed previously */
-	if (mousedev->press_bnum == bnum) {
-		/* Compute milliseconds since previous press */
-		ms_delay = ts_sub_diff(&now, &mousedev->press_time) / 1000000;
-
-		if (ms_delay <= dclick_delay_ms) {
-			mouse_push_event_dclick(mousedev->mouse_dev, bnum);
-			mousedev->press_bnum = -1;
-			return;
-		}
-	}
-
-	/* Record which button was last pressed and at what time */
-	mousedev->press_bnum = bnum;
-	mousedev->press_time = now;
-}
-
-static void mousedev_callback_conn(ipc_call_t *icall, void *arg)
-{
-	/* Mousedev device structure */
-	mousedev_t *mousedev = (mousedev_t *) arg;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			mousedev_destroy(mousedev);
-			return;
-		}
-
-		errno_t retval;
-
-		switch (ipc_get_imethod(&call)) {
-		case MOUSEEV_MOVE_EVENT:
-			mouse_push_event_move(mousedev->mouse_dev,
-			    ipc_get_arg1(&call), ipc_get_arg2(&call),
-			    ipc_get_arg3(&call));
-			retval = EOK;
-			break;
-		case MOUSEEV_ABS_MOVE_EVENT:
-			mouse_push_event_abs_move(mousedev->mouse_dev,
-			    ipc_get_arg1(&call), ipc_get_arg2(&call),
-			    ipc_get_arg3(&call), ipc_get_arg4(&call));
-			retval = EOK;
-			break;
-		case MOUSEEV_BUTTON_EVENT:
-			mouse_push_event_button(mousedev->mouse_dev,
-			    ipc_get_arg1(&call), ipc_get_arg2(&call));
-			if (ipc_get_arg2(&call) != 0)
-				mousedev_press(mousedev, ipc_get_arg1(&call));
-			retval = EOK;
-			break;
-		default:
-			retval = ENOTSUP;
-			break;
-		}
-
-		async_answer_0(&call, retval);
-	}
-}
-
-static errno_t mousedev_proto_init(mouse_dev_t *mdev)
-{
-	async_sess_t *sess = loc_service_connect(mdev->svc_id, INTERFACE_DDF, 0);
-	if (sess == NULL) {
-		printf("%s: Failed starting session with '%s'\n", NAME,
-		    mdev->svc_name);
-		return ENOENT;
-	}
-
-	mousedev_t *mousedev = mousedev_new(mdev);
-	if (mousedev == NULL) {
-		printf("%s: Failed allocating device structure for '%s'.\n",
-		    NAME, mdev->svc_name);
-		async_hangup(sess);
-		return ENOMEM;
-	}
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (exch == NULL) {
-		printf("%s: Failed starting exchange with '%s'.\n", NAME,
-		    mdev->svc_name);
-		mousedev_destroy(mousedev);
-		async_hangup(sess);
-		return ENOENT;
-	}
-
-	port_id_t port;
-	errno_t rc = async_create_callback_port(exch, INTERFACE_MOUSE_CB, 0, 0,
-	    mousedev_callback_conn, mousedev, &port);
-
-	async_exchange_end(exch);
-	async_hangup(sess);
-
-	if (rc != EOK) {
-		printf("%s: Failed creating callback connection from '%s'.\n",
-		    NAME, mdev->svc_name);
-		mousedev_destroy(mousedev);
-		return rc;
-	}
-
-	return EOK;
-}
-
-mouse_proto_ops_t mousedev_proto = {
-	.init = mousedev_proto_init
-};
-
-/**
- * @}
- */
Index: pace/srv/hid/input/serial.h
===================================================================
--- uspace/srv/hid/input/serial.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Serial device handling.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef SERIAL_H_
-#define SERIAL_H_
-
-#include <async.h>
-#include <io/chardev.h>
-#include "kbd.h"
-
-typedef struct serial_dev {
-	kbd_dev_t *kdev;
-	link_t link;
-	async_sess_t *sess;
-	chardev_t *chardev;
-} serial_dev_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/input/stroke.c
===================================================================
--- uspace/srv/hid/input/stroke.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup input
- * @{
- */
-/**
- * @file
- * @brief Stroke simulator.
- *
- * When simulating a keyboard using a serial TTY we need to convert the
- * recognized strokes (such as Shift-A) to sequences of key presses and
- * releases (such as 'press Shift, press A, release A, release Shift').
- *
- */
-
-#include <io/console.h>
-#include <io/keycode.h>
-#include "stroke.h"
-#include "kbd.h"
-
-/** Correspondence between modifers and the modifier keycodes. */
-static unsigned int mods_keys[][2] = {
-	{ KM_LALT, KC_LALT },
-	{ KM_LSHIFT, KC_LSHIFT },
-	{ KM_LCTRL, KC_LCTRL },
-	{ 0, 0 }
-};
-
-/** Simulate keystroke using sequences of key presses and releases. */
-void stroke_sim(kbd_dev_t *kdev, unsigned mod, unsigned key)
-{
-	int i;
-
-	/* Simulate modifier presses. */
-	i = 0;
-	while (mods_keys[i][0] != 0) {
-		if (mod & mods_keys[i][0]) {
-			kbd_push_event(kdev, KEY_PRESS, mods_keys[i][1]);
-		}
-		++i;
-	}
-
-	/* Simulate key press and release. */
-	if (key != 0) {
-		kbd_push_event(kdev, KEY_PRESS, key);
-		kbd_push_event(kdev, KEY_RELEASE, key);
-	}
-
-	/* Simulate modifier releases. */
-	i = 0;
-	while (mods_keys[i][0] != 0) {
-		if (mod & mods_keys[i][0]) {
-			kbd_push_event(kdev, KEY_RELEASE, mods_keys[i][1]);
-		}
-		++i;
-	}
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/input/stroke.h
===================================================================
--- uspace/srv/hid/input/stroke.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inputgen generic
- * @brief Generic scancode parser.
- * @ingroup input
- * @{
- */
-/** @file
- */
-
-#ifndef KBD_STROKE_H_
-#define KBD_STROKE_H_
-
-#include "kbd.h"
-
-extern void stroke_sim(kbd_dev_t *, unsigned, unsigned);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/isdv4_tablet/isdv4.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,424 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <fibril.h>
-#include <io/chardev.h>
-#include <mem.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "isdv4.h"
-
-#define BUF_SIZE 64
-
-#define START_OF_PACKET 128
-#define CONTROL_PACKET 64
-#define TOUCH_EVENT 16
-#define FINGER1 1
-#define FINGER2 2
-#define TIP 1
-#define BUTTON1 2
-#define BUTTON2 4
-#define PROXIMITY 32
-
-#define CMD_START '1'
-#define CMD_STOP '0'
-#define CMD_QUERY_STYLUS '*'
-#define CMD_QUERY_TOUCH '%'
-
-/** Packet consumer function
- *
- * @return true if reading of packets should continue
- */
-typedef bool (*packet_consumer_fn)(uint8_t *packet, size_t size,
-    isdv4_state_t *state);
-
-static void isdv4_event_init(isdv4_event_t *event)
-{
-	memset(event, 0, sizeof(isdv4_event_t));
-}
-
-/**
- * Parse event packet and emit events
- * @return true if reading of packets should continue
- */
-static bool parse_event(uint8_t *packet, size_t size, isdv4_state_t *state)
-{
-	if (size < 1)
-		return false;
-
-	bool control_packet = ((packet[0] & CONTROL_PACKET) > 0);
-	if (control_packet)
-		return true;
-
-	/* This is an event initiated by the device */
-	isdv4_event_t event;
-	isdv4_event_init(&event);
-
-	if (packet[0] & TOUCH_EVENT) {
-		if (size != 5)
-			return true;
-
-		/* This is a touch event */
-		bool finger1 = (packet[0] & FINGER1) > 0;
-		event.x = ((packet[1] & 127) << 7) | (packet[2] & 127);
-		event.y = ((packet[3] & 127) << 7) | (packet[4] & 127);
-		event.source = TOUCH;
-
-		if (!state->stylus_in_proximity) {
-			if (!finger1 && state->finger1_pressed) {
-				state->finger1_pressed = false;
-
-				event.type = RELEASE;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			} else if (finger1 && !state->finger1_pressed) {
-				state->finger1_pressed = true;
-
-				event.type = PRESS;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			} else {
-				event.type = MOVE;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			}
-		}
-	} else {
-		if (size != 9)
-			return true;
-
-		/* This is a stylus event */
-		bool tip = packet[0] & TIP;
-		bool button1 = packet[0] & BUTTON1;
-		bool button2 = packet[0] & BUTTON2;
-		bool proximity = packet[0] & PROXIMITY;
-		event.x = ((packet[1] & 127) << 7) | (packet[2] & 124) | ((packet[6] >> 5) & 3);
-		event.y = ((packet[3] & 127) << 7) | (packet[4] & 124) | ((packet[6] >> 3) & 3);
-		event.pressure = (packet[5] & 127) | ((packet[6] & 7) << 7);
-
-		if (proximity && !state->stylus_in_proximity) {
-			/* Stylus came into proximity */
-			state->stylus_in_proximity = true;
-			state->stylus_is_eraser = !tip && button2;
-			event.source = (state->stylus_is_eraser ? STYLUS_ERASER : STYLUS_TIP);
-			event.type = PROXIMITY_IN;
-			state->emit_event_fn(&event);
-		} else if (!proximity && state->stylus_in_proximity) {
-			/* Stylus came out of proximity */
-			state->stylus_in_proximity = false;
-			event.source = (state->stylus_is_eraser ? STYLUS_ERASER : STYLUS_TIP);
-			event.type = PROXIMITY_OUT;
-			state->emit_event_fn(&event);
-		} else {
-			/* Proximity state didn't change, but we need to check if it is still eraser */
-			if (state->stylus_is_eraser && !button2) {
-				event.type = PROXIMITY_OUT;
-				event.source = STYLUS_ERASER;
-				state->emit_event_fn(&event);
-				event.type = PROXIMITY_IN;
-				event.source = STYLUS_TIP;
-				state->emit_event_fn(&event);
-				state->stylus_is_eraser = false;
-			} else if (!state->stylus_is_eraser && !tip && button2) {
-				event.type = PROXIMITY_OUT;
-				event.source = STYLUS_TIP;
-				state->emit_event_fn(&event);
-				event.type = PROXIMITY_IN;
-				event.source = STYLUS_ERASER;
-				state->emit_event_fn(&event);
-				state->stylus_is_eraser = true;
-			}
-		}
-
-		if (!state->stylus_is_eraser) {
-			if (tip && !state->tip_pressed) {
-				state->tip_pressed = true;
-				event.type = PRESS;
-				event.source = STYLUS_TIP;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			} else if (!tip && state->tip_pressed) {
-				state->tip_pressed = false;
-				event.type = RELEASE;
-				event.source = STYLUS_TIP;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			}
-			if (button1 && !state->button1_pressed) {
-				state->button1_pressed = true;
-				event.type = PRESS;
-				event.source = STYLUS_TIP;
-				event.button = 2;
-				state->emit_event_fn(&event);
-			} else if (!button1 && state->button1_pressed) {
-				state->button1_pressed = false;
-				event.type = RELEASE;
-				event.source = STYLUS_TIP;
-				event.button = 2;
-				state->emit_event_fn(&event);
-			}
-			if (button2 && !state->button2_pressed) {
-				state->button2_pressed = true;
-				event.type = PRESS;
-				event.source = STYLUS_TIP;
-				event.button = 3;
-				state->emit_event_fn(&event);
-			} else if (!button2 && state->button2_pressed) {
-				state->button2_pressed = false;
-				event.type = RELEASE;
-				event.source = STYLUS_TIP;
-				event.button = 3;
-				state->emit_event_fn(&event);
-			}
-			event.type = MOVE;
-			event.source = STYLUS_TIP;
-			event.button = 0;
-			state->emit_event_fn(&event);
-		} else {
-			if (tip && !state->tip_pressed) {
-				state->tip_pressed = true;
-				event.type = PRESS;
-				event.source = STYLUS_ERASER;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			} else if (!tip && state->tip_pressed) {
-				state->tip_pressed = false;
-				event.type = RELEASE;
-				event.source = STYLUS_ERASER;
-				event.button = 1;
-				state->emit_event_fn(&event);
-			}
-			event.type = MOVE;
-			event.source = STYLUS_ERASER;
-			event.button = 0;
-			state->emit_event_fn(&event);
-		}
-	}
-
-	return true;
-}
-
-static bool parse_response_stylus(uint8_t *packet, size_t size,
-    isdv4_state_t *state)
-{
-	if (size < 1)
-		return false;
-
-	bool control_packet = ((packet[0] & CONTROL_PACKET) > 0);
-	if (!control_packet)
-		return true;
-
-	if (size != 11)
-		return false;
-
-	state->stylus_max_x = ((packet[1] & 127) << 7) | (packet[2] & 124) |
-	    ((packet[6] >> 5) & 3);
-	state->stylus_max_y = ((packet[3] & 127) << 7) | (packet[4] & 124) |
-	    ((packet[6] >> 3) & 3);
-	state->stylus_max_pressure = (packet[5] & 63) | ((packet[6] & 7) << 7);
-	state->stylus_max_xtilt = packet[8] & 127;
-	state->stylus_max_ytilt = packet[7] & 127;
-	state->stylus_tilt_supported = (state->stylus_max_xtilt &&
-	    state->stylus_max_ytilt);
-
-	return false;
-}
-
-static bool parse_response_touch(uint8_t *packet, size_t size,
-    isdv4_state_t *state)
-{
-	if (size < 1)
-		return false;
-
-	bool control_packet = ((packet[0] & CONTROL_PACKET) > 0);
-	if (!control_packet)
-		return true;
-
-	if (size != 11)
-		return false;
-
-	state->touch_type = (packet[0] & 63);
-
-	unsigned int touch_resolution = packet[1] & 127;
-	state->touch_max_x = ((packet[2] >> 5) & 3) | ((packet[3] & 127) << 7) |
-	    (packet[4] & 124);
-	state->touch_max_y = ((packet[2] >> 3) & 3) | ((packet[5] & 127) << 7) |
-	    (packet[6] & 124);
-
-	if (touch_resolution == 0)
-		touch_resolution = 10;
-
-	if (state->touch_max_x == 0 || state->touch_max_y == 0) {
-		state->touch_max_x = (1 << touch_resolution);
-		state->touch_max_y = (1 << touch_resolution);
-	}
-
-	return false;
-}
-
-static errno_t read_packets(isdv4_state_t *state, packet_consumer_fn consumer)
-{
-	bool reading = true;
-	while (reading) {
-		size_t nread;
-		errno_t rc;
-
-		rc = chardev_read(state->chardev, state->buf + state->buf_end,
-		    state->buf_size - state->buf_end, &nread, chardev_f_none);
-		if (rc != EOK && nread == 0)
-			return EIO;
-		state->buf_end += nread;
-
-		size_t i = 0;
-
-		/* Skip data until a start of packet is found */
-		while (i < state->buf_end && (state->buf[i] & START_OF_PACKET) == 0)
-			i++;
-
-		size_t start = i;
-		size_t end = i;
-		size_t processed_end = i;
-
-		/* Process packets one by one */
-		while (reading && i < state->buf_end) {
-			/* Determine the packet length */
-			size_t packet_remaining;
-			if (state->buf[i] & CONTROL_PACKET) {
-				packet_remaining = 11;
-			} else if (state->buf[i] & TOUCH_EVENT) {
-				packet_remaining = 5;
-			} else {
-				packet_remaining = 9;
-			}
-
-			/* Find the end of the packet */
-			i++; /* We need to skip the first byte with START_OF_PACKET set */
-			packet_remaining--;
-			while (packet_remaining > 0 && i < state->buf_end &&
-			    (state->buf[i] & START_OF_PACKET) == 0) {
-				i++;
-				packet_remaining--;
-			}
-			end = i;
-
-			/* If we have whole packet, process it */
-			if (end > start && packet_remaining == 0) {
-				reading = consumer(state->buf + start, end - start, state);
-				start = end;
-				processed_end = end;
-			}
-		}
-
-		if (processed_end == 0 && state->buf_end == state->buf_size) {
-			/* Packet too large, throw it away */
-			state->buf_end = 0;
-		}
-
-		/* Shift the buffer contents to the left */
-		size_t unprocessed_len = state->buf_end - processed_end;
-		memcpy(state->buf, state->buf + processed_end, unprocessed_len);
-		state->buf_end = unprocessed_len;
-	}
-	return EOK;
-}
-
-static bool write_command(chardev_t *chardev, uint8_t command)
-{
-	errno_t rc;
-	size_t nwr;
-
-	rc = chardev_write(chardev, &command, 1, &nwr);
-	return rc == EOK;
-}
-
-errno_t isdv4_init(isdv4_state_t *state, async_sess_t *sess,
-    isdv4_event_fn event_fn)
-{
-	chardev_t *chardev;
-	errno_t rc;
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK)
-		return rc;
-
-	memset(state, 0, sizeof(isdv4_state_t));
-
-	state->sess = sess;
-	state->chardev = chardev;
-
-	state->buf = malloc(BUF_SIZE);
-	if (state->buf == NULL) {
-		chardev_close(chardev);
-		return ENOMEM;
-	}
-
-	state->buf_size = BUF_SIZE;
-	state->emit_event_fn = event_fn;
-	return EOK;
-}
-
-errno_t isdv4_init_tablet(isdv4_state_t *state)
-{
-	if (!write_command(state->chardev, CMD_STOP))
-		return EIO;
-
-	fibril_usleep(250000); /* 250 ms */
-
-	// FIXME: Read all possible garbage before sending commands
-	if (!write_command(state->chardev, CMD_QUERY_STYLUS))
-		return EIO;
-
-	errno_t rc = read_packets(state, parse_response_stylus);
-	if (rc != EOK)
-		return rc;
-
-	if (!write_command(state->chardev, CMD_QUERY_TOUCH))
-		return EIO;
-
-	rc = read_packets(state, parse_response_touch);
-	if (rc != EOK)
-		return rc;
-
-	if (!write_command(state->chardev, CMD_START))
-		return EIO;
-
-	return EOK;
-}
-
-errno_t isdv4_read_events(isdv4_state_t *state)
-{
-	return read_packets(state, parse_event);
-}
-
-void isdv4_fini(isdv4_state_t *state)
-{
-	free(state->buf);
-}
Index: pace/srv/hid/isdv4_tablet/isdv4.h
===================================================================
--- uspace/srv/hid/isdv4_tablet/isdv4.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,104 +1,0 @@
-/*
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ISDV4_H_
-#define ISDV4_H_
-
-#include <async.h>
-#include <io/chardev.h>
-
-typedef struct isdv4_event isdv4_event_t;
-
-typedef void (*isdv4_event_fn)(const isdv4_event_t *);
-
-typedef struct {
-	/* Stylus information */
-	unsigned int stylus_max_x;
-	unsigned int stylus_max_y;
-	unsigned int stylus_max_pressure;
-	unsigned int stylus_max_xtilt;
-	unsigned int stylus_max_ytilt;
-	bool stylus_tilt_supported;
-
-	/* Touch information */
-	unsigned int touch_type;
-	unsigned int touch_max_x;
-	unsigned int touch_max_y;
-
-	/* Event state */
-	bool stylus_in_proximity;
-	bool stylus_is_eraser;
-	bool tip_pressed; /* Reported as stylus button 1 */
-	bool button1_pressed; /* Reported as stylus button 2 */
-	bool button2_pressed; /* Reported as stylus button 3 */
-	bool finger1_pressed; /* Reported as touch button 1 */
-
-	/** Session with the serial device */
-	async_sess_t *sess;
-	/** Character device */
-	chardev_t *chardev;
-
-	/* Receive buffer state */
-	uint8_t *buf;
-	size_t buf_size;
-	size_t buf_end;
-
-	/** Callbacks */
-	isdv4_event_fn emit_event_fn;
-} isdv4_state_t;
-
-typedef enum {
-	UNKNOWN,
-	PRESS,
-	RELEASE,
-	PROXIMITY_IN,
-	PROXIMITY_OUT,
-	MOVE
-} isdv4_event_type_t;
-
-typedef enum {
-	STYLUS_TIP,
-	STYLUS_ERASER,
-	TOUCH
-} isdv4_source_type_t;
-
-struct isdv4_event {
-	isdv4_event_type_t type;
-	isdv4_source_type_t source;
-	unsigned int x;
-	unsigned int y;
-	unsigned int pressure;
-	unsigned int button;
-};
-
-extern errno_t isdv4_init(isdv4_state_t *, async_sess_t *, isdv4_event_fn);
-extern errno_t isdv4_init_tablet(isdv4_state_t *);
-extern errno_t isdv4_read_events(isdv4_state_t *state);
-extern void isdv4_fini(isdv4_state_t *);
-
-#endif
Index: pace/srv/hid/isdv4_tablet/main.c
===================================================================
--- uspace/srv/hid/isdv4_tablet/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,357 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2012 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/serial.h>
-#include <ipc/mouseev.h>
-#include <loc.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <str.h>
-#include <task.h>
-
-#include "isdv4.h"
-
-#define NAME "isdv4_tablet"
-
-static async_sess_t *client_sess = NULL;
-static fibril_mutex_t client_mutex;
-static isdv4_state_t state;
-
-static void syntax_print(void)
-{
-	fprintf(stderr, "Usage: %s [--baud=<baud>] [--print-events] [device_service]\n", NAME);
-}
-
-static errno_t read_fibril(void *unused)
-{
-	errno_t rc = isdv4_read_events(&state);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed reading events");
-		return rc;
-	}
-
-	isdv4_fini(&state);
-	return EOK;
-}
-
-static void mouse_connection(ipc_call_t *icall, void *arg)
-{
-	async_accept_0(icall);
-
-	async_sess_t *sess =
-	    async_callback_receive(EXCHANGE_SERIALIZE);
-
-	fibril_mutex_lock(&client_mutex);
-
-	if (client_sess == NULL)
-		client_sess = sess;
-
-	fibril_mutex_unlock(&client_mutex);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		async_answer_0(&call, ENOTSUP);
-	}
-}
-
-static void emit_event(const isdv4_event_t *event)
-{
-	fibril_mutex_lock(&client_mutex);
-	async_sess_t *sess = client_sess;
-	fibril_mutex_unlock(&client_mutex);
-
-	if (!sess)
-		return;
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	if (exch) {
-		unsigned int max_x = state.stylus_max_x;
-		unsigned int max_y = state.stylus_max_y;
-		if (event->source == TOUCH) {
-			max_x = state.touch_max_x;
-			max_y = state.touch_max_y;
-		}
-		async_msg_4(exch, MOUSEEV_ABS_MOVE_EVENT, event->x, event->y,
-		    max_x, max_y);
-		if (event->type == PRESS || event->type == RELEASE) {
-			async_msg_2(exch, MOUSEEV_BUTTON_EVENT, event->button,
-			    event->type == PRESS);
-		}
-	}
-	async_exchange_end(exch);
-}
-
-static void print_and_emit_event(const isdv4_event_t *event)
-{
-	const char *type = NULL;
-	switch (event->type) {
-	case PRESS:
-		type = "PRESS";
-		break;
-	case RELEASE:
-		type = "RELEASE";
-		break;
-	case PROXIMITY_IN:
-		type = "PROXIMITY IN";
-		break;
-	case PROXIMITY_OUT:
-		type = "PROXIMITY OUT";
-		break;
-	case MOVE:
-		type = "MOVE";
-		break;
-	default:
-		type = "UNKNOWN";
-		break;
-	}
-
-	const char *source = NULL;
-	switch (event->source) {
-	case STYLUS_TIP:
-		source = "stylus tip";
-		break;
-	case STYLUS_ERASER:
-		source = "stylus eraser";
-		break;
-	case TOUCH:
-		source = "touch";
-		break;
-	}
-
-	printf("%s %s %u %u %u %u\n", type, source, event->x, event->y,
-	    event->pressure, event->button);
-
-	emit_event(event);
-}
-
-static const char *touch_type(unsigned int data_id)
-{
-	switch (data_id) {
-	case 0:
-		return "resistive+stylus";
-	case 1:
-		return "capacitive+stylus";
-	case 2:
-		return "resistive";
-	case 3:
-	case 4:
-		return "capacitive";
-	case 5:
-		return "penabled";
-	}
-	return "unknown";
-}
-
-int main(int argc, char **argv)
-{
-	sysarg_t baud = 38400;
-	service_id_t svc_id;
-	serial_t *serial;
-	char *serial_port_name = NULL;
-	loc_srv_t *srv;
-
-	int arg = 1;
-	errno_t rc;
-
-	isdv4_event_fn event_fn = emit_event;
-
-	if (argc > arg && str_test_prefix(argv[arg], "--baud=")) {
-		size_t arg_offset = str_lsize(argv[arg], 7);
-		char *arg_str = argv[arg] + arg_offset;
-		if (str_length(arg_str) == 0) {
-			fprintf(stderr, "--baud requires an argument\n");
-			syntax_print();
-			return 1;
-		}
-		char *endptr;
-		baud = strtol(arg_str, &endptr, 10);
-		if (*endptr != '\0') {
-			fprintf(stderr, "Invalid value for baud\n");
-			syntax_print();
-			return 1;
-		}
-		arg++;
-	}
-
-	if (argc > arg && str_cmp(argv[arg], "--print-events") == 0) {
-		event_fn = print_and_emit_event;
-		arg++;
-	}
-
-	if (argc > arg) {
-		serial_port_name = argv[arg];
-		rc = loc_service_get_id(serial_port_name, &svc_id, 0);
-		if (rc != EOK) {
-			fprintf(stderr, "Cannot find device service %s\n",
-			    argv[arg]);
-			return 1;
-		}
-		arg++;
-	} else {
-		category_id_t serial_cat_id;
-
-		rc = loc_category_get_id("serial", &serial_cat_id, 0);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed getting id of category "
-			    "'serial'\n");
-			return 1;
-		}
-
-		service_id_t *svc_ids;
-		size_t svc_count;
-
-		rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed getting list of services\n");
-			return 1;
-		}
-
-		if (svc_count == 0) {
-			fprintf(stderr, "No service in category 'serial'\n");
-			free(svc_ids);
-			return 1;
-		}
-
-		svc_id = svc_ids[0];
-
-		rc = loc_service_get_name(svc_id, &serial_port_name);
-		if (rc != EOK) {
-			fprintf(stderr, "Failed getting name of serial service\n");
-			return 1;
-		}
-
-		free(svc_ids);
-	}
-
-	if (argc > arg) {
-		fprintf(stderr, "Too many arguments\n");
-		syntax_print();
-		return 1;
-	}
-
-	fibril_mutex_initialize(&client_mutex);
-
-	printf(NAME ": Using serial port %s\n", serial_port_name);
-
-	async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF,
-	    IPC_FLAG_BLOCKING);
-	if (!sess) {
-		fprintf(stderr, "Failed connecting to service\n");
-		return 2;
-	}
-
-	rc = serial_open(sess, &serial);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed opening serial port\n");
-		return 2;
-	}
-
-	rc = serial_set_comm_props(serial, baud, SERIAL_NO_PARITY, 8, 1);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed setting serial properties\n");
-		return 2;
-	}
-
-	rc = isdv4_init(&state, sess, event_fn);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed initializing isdv4 state");
-		return 2;
-	}
-
-	rc = isdv4_init_tablet(&state);
-	if (rc != EOK) {
-		fprintf(stderr, "Failed initializing tablet");
-		return 2;
-	}
-
-	printf("Tablet information:\n");
-	printf(" Stylus: %ux%u pressure: %u tilt: ", state.stylus_max_x,
-	    state.stylus_max_y, state.stylus_max_pressure);
-	if (state.stylus_tilt_supported) {
-		printf("%ux%u\n", state.stylus_max_xtilt, state.stylus_max_ytilt);
-	} else {
-		printf("not supported\n");
-	}
-	printf(" Touch: %ux%u type: %s\n", state.touch_max_x, state.touch_max_y,
-	    touch_type(state.touch_type));
-
-	fid_t fibril = fibril_create(read_fibril, NULL);
-	/* From this on, state is to be used only by read_fibril */
-	fibril_add_ready(fibril);
-
-	async_set_fallback_port_handler(mouse_connection, NULL);
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register driver.\n", NAME);
-		return rc;
-	}
-
-	service_id_t service_id;
-	char *service_name;
-	rc = asprintf(&service_name, "mouse/isdv4-%" PRIun, svc_id);
-	if (rc < 0) {
-		printf(NAME ": Unable to create service name\n");
-		return rc;
-	}
-
-	rc = loc_service_register(srv, service_name, &service_id);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		printf(NAME ": Unable to register service %s.\n", service_name);
-		return rc;
-	}
-
-	category_id_t mouse_category;
-	rc = loc_category_get_id("mouse", &mouse_category, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf(NAME ": Unable to get mouse category id.\n");
-	} else {
-		rc = loc_service_add_to_cat(srv, service_id, mouse_category);
-		if (rc != EOK) {
-			printf(NAME ": Unable to add device to mouse category.\n");
-		}
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
Index: pace/srv/hid/isdv4_tablet/meson.build
===================================================================
--- uspace/srv/hid/isdv4_tablet/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2012 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv', 'input' ]
-src = files('main.c', 'isdv4.c')
Index: pace/srv/hid/output/ctl/serial.c
===================================================================
--- uspace/srv/hid/output/ctl/serial.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2008 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <io/chargrid.h>
-#include <vt/vt100.h>
-#include "../output.h"
-#include "serial.h"
-
-#define SERIAL_COLS  80
-#define SERIAL_ROWS  24
-
-static serial_putuchar_t serial_putuchar_fn;
-static serial_control_puts_t serial_control_puts_fn;
-static serial_flush_t serial_flush_fn;
-
-static void serial_vt_putuchar(void *, char32_t);
-static void serial_vt_control_puts(void *, const char *);
-static void serial_vt_flush(void *);
-
-static vt100_cb_t serial_vt_cb = {
-	.putuchar = serial_vt_putuchar,
-	.control_puts = serial_vt_control_puts,
-	.flush = serial_vt_flush
-};
-
-/** Draw the character at the specified position.
- *
- * @param state VT100 protocol state.
- * @param field Character field.
- * @param col   Horizontal screen position.
- * @param row   Vertical screen position.
- *
- */
-static void draw_char(vt100_t *state, charfield_t *field,
-    sysarg_t col, sysarg_t row)
-{
-	vt100_goto(state, col, row);
-	vt100_set_attr(state, field->attrs);
-	vt100_putuchar(state, field->ch);
-}
-
-static errno_t serial_yield(outdev_t *dev)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-
-	return vt100_yield(state);
-}
-
-static errno_t serial_claim(outdev_t *dev)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-
-	return vt100_claim(state);
-}
-
-static void serial_get_dimensions(outdev_t *dev, sysarg_t *cols,
-    sysarg_t *rows)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-
-	vt100_get_dimensions(state, cols, rows);
-}
-
-static console_caps_t serial_get_caps(outdev_t *dev)
-{
-	return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
-	    CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
-}
-
-static void serial_cursor_update(outdev_t *dev, sysarg_t prev_col,
-    sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-
-	vt100_goto(state, col, row);
-	vt100_cursor_visibility(state, visible);
-}
-
-static void serial_char_update(outdev_t *dev, sysarg_t col, sysarg_t row)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-	charfield_t *field =
-	    chargrid_charfield_at(dev->backbuf, col, row);
-
-	draw_char(state, field, col, row);
-}
-
-static void serial_flush(outdev_t *dev)
-{
-	vt100_t *state = (vt100_t *) dev->data;
-
-	vt100_flush(state);
-}
-
-static outdev_ops_t serial_ops = {
-	.yield = serial_yield,
-	.claim = serial_claim,
-	.get_dimensions = serial_get_dimensions,
-	.get_caps = serial_get_caps,
-	.cursor_update = serial_cursor_update,
-	.char_update = serial_char_update,
-	.flush = serial_flush
-};
-
-errno_t serial_init(serial_putuchar_t putuchar_fn,
-    serial_control_puts_t control_puts_fn, serial_flush_t flush_fn)
-{
-	char_attrs_t attrs;
-	vt100_t *vt100;
-
-	serial_putuchar_fn = putuchar_fn;
-	serial_control_puts_fn = control_puts_fn;
-	serial_flush_fn = flush_fn;
-
-	vt100 = vt100_create(NULL, SERIAL_COLS, SERIAL_ROWS, &serial_vt_cb);
-	if (vt100 == NULL)
-		return ENOMEM;
-	vt100->enable_rgb = true;
-
-	vt100_cursor_visibility(vt100, false);
-	attrs.type = CHAR_ATTR_STYLE;
-	attrs.val.style = STYLE_NORMAL;
-	vt100_set_attr(vt100, attrs);
-	vt100_cls(vt100);
-
-	outdev_t *dev = outdev_register(&serial_ops, vt100);
-	if (dev == NULL) {
-		vt100_destroy(vt100);
-		return ENOMEM;
-	}
-
-	return EOK;
-}
-
-static void serial_vt_putuchar(void *arg, char32_t c)
-{
-	(void)arg;
-	serial_putuchar_fn(c);
-}
-
-static void serial_vt_control_puts(void *arg, const char *str)
-{
-	(void)arg;
-	serial_control_puts_fn(str);
-}
-
-static void serial_vt_flush(void *arg)
-{
-	(void)arg;
-	serial_flush_fn();
-}
-
-/** @}
- */
Index: pace/srv/hid/output/ctl/serial.h
===================================================================
--- uspace/srv/hid/output/ctl/serial.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2008 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#ifndef OUTPUT_CTL_SERIAL_H_
-#define OUTPUT_CTL_SERIAL_H_
-
-#include <vt/vt100.h>
-
-typedef void (*serial_putuchar_t)(char32_t);
-typedef void (*serial_control_puts_t)(const char *);
-typedef void (*serial_flush_t)(void);
-
-extern errno_t serial_init(serial_putuchar_t, serial_control_puts_t,
-    serial_flush_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/output/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/output/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup output output
- * @ingroup srvs
- * @brief Output server
- */
Index: pace/srv/hid/output/meson.build
===================================================================
--- uspace/srv/hid/output/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'codepage', 'console', 'drv', 'fbfont', 'pixconv', 'ddev', 'output',
-    'vt' ]
-src = files(
-	'ctl/serial.c',
-	'port/ega.c',
-	'port/chardev.c',
-	'port/ddev.c',
-	'output.c',
-)
Index: pace/srv/hid/output/output.c
===================================================================
--- uspace/srv/hid/output/output.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,521 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <as.h>
-#include <task.h>
-#include <ipc/output.h>
-#include <config.h>
-#include <vt/vt100.h>
-#include "port/ega.h"
-#include "port/chardev.h"
-#include "port/ddev.h"
-#include "output.h"
-
-typedef struct {
-	link_t link;
-
-	size_t size;
-	unsigned int flags;
-	void *data;
-} frontbuf_t;
-
-static LIST_INITIALIZE(outdevs);
-static LIST_INITIALIZE(frontbufs);
-
-outdev_t *outdev_register(outdev_ops_t *ops, void *data)
-{
-	assert(ops->get_dimensions);
-
-	outdev_t *dev = (outdev_t *) malloc(sizeof(outdev_t));
-	if (dev == NULL)
-		return NULL;
-
-	link_initialize(&dev->link);
-
-	dev->ops = *ops;
-	dev->data = data;
-
-	ops->get_dimensions(dev, &dev->cols, &dev->rows);
-	dev->backbuf = chargrid_create(dev->cols, dev->rows,
-	    CHARGRID_FLAG_NONE);
-	if (dev->backbuf == NULL) {
-		free(dev);
-		return NULL;
-	}
-
-	list_append(&dev->link, &outdevs);
-	return dev;
-}
-
-static void srv_yield(ipc_call_t *icall)
-{
-	errno_t ret = EOK;
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.yield);
-
-		errno_t rc = dev->ops.yield(dev);
-		if (rc != EOK)
-			ret = rc;
-	}
-
-	async_answer_0(icall, ret);
-}
-
-static void srv_claim(ipc_call_t *icall)
-{
-	errno_t ret = EOK;
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.claim);
-
-		errno_t rc = dev->ops.claim(dev);
-		if (rc != EOK)
-			ret = rc;
-	}
-
-	async_answer_0(icall, ret);
-}
-
-static void srv_get_dimensions(ipc_call_t *icall)
-{
-	sysarg_t cols = 0;
-	sysarg_t rows = 0;
-	bool first;
-
-	first = true;
-	list_foreach(outdevs, link, outdev_t, dev) {
-		if (first) {
-			cols = dev->cols;
-			rows = dev->rows;
-			first = false;
-		} else {
-			cols = min(cols, dev->cols);
-			rows = min(rows, dev->rows);
-		}
-	}
-
-	async_answer_2(icall, EOK, cols, rows);
-}
-
-static void srv_get_caps(ipc_call_t *icall)
-{
-	console_caps_t caps = 0;
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.get_caps);
-
-		caps |= dev->ops.get_caps(dev);
-	}
-
-	async_answer_1(icall, EOK, caps);
-}
-
-static frontbuf_t *resolve_frontbuf(sysarg_t handle, ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = NULL;
-	list_foreach(frontbufs, link, frontbuf_t, cur) {
-		if (cur == (frontbuf_t *) handle) {
-			frontbuf = cur;
-			break;
-		}
-	}
-
-	if (frontbuf == NULL) {
-		async_answer_0(icall, ENOENT);
-		return NULL;
-	}
-
-	return frontbuf;
-}
-
-static void srv_frontbuf_create(ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = (frontbuf_t *) malloc(sizeof(frontbuf_t));
-	if (frontbuf == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	link_initialize(&frontbuf->link);
-
-	ipc_call_t call;
-	if (!async_share_out_receive(&call, &frontbuf->size,
-	    &frontbuf->flags)) {
-		free(frontbuf);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_share_out_finalize(&call, &frontbuf->data);
-	if ((rc != EOK) || (frontbuf->data == AS_MAP_FAILED)) {
-		free(frontbuf);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	list_append(&frontbuf->link, &frontbufs);
-	async_answer_1(icall, EOK, (sysarg_t) frontbuf);
-}
-
-static void srv_frontbuf_destroy(ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = resolve_frontbuf(ipc_get_arg1(icall), icall);
-	if (frontbuf == NULL)
-		return;
-
-	list_remove(&frontbuf->link);
-	as_area_destroy(frontbuf->data);
-	free(frontbuf);
-
-	async_answer_0(icall, EOK);
-}
-
-static void srv_cursor_update(ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = resolve_frontbuf(ipc_get_arg1(icall), icall);
-	if (frontbuf == NULL)
-		return;
-
-	chargrid_t *buf = (chargrid_t *) frontbuf->data;
-	bool visible = chargrid_get_cursor_visibility(buf);
-
-	sysarg_t col;
-	sysarg_t row;
-	chargrid_get_cursor(buf, &col, &row);
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.cursor_update);
-
-		sysarg_t prev_col;
-		sysarg_t prev_row;
-		chargrid_get_cursor(dev->backbuf, &prev_col, &prev_row);
-
-		chargrid_set_cursor(dev->backbuf, col, row);
-		chargrid_set_cursor_visibility(dev->backbuf, visible);
-
-		dev->ops.cursor_update(dev, prev_col, prev_row, col, row,
-		    visible);
-		dev->ops.flush(dev);
-
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void srv_set_style(ipc_call_t *icall)
-{
-	list_foreach(outdevs, link, outdev_t, dev) {
-		dev->attrs.type = CHAR_ATTR_STYLE;
-		dev->attrs.val.style =
-		    (console_style_t) ipc_get_arg1(icall);
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void srv_set_color(ipc_call_t *icall)
-{
-	list_foreach(outdevs, link, outdev_t, dev) {
-		dev->attrs.type = CHAR_ATTR_INDEX;
-		dev->attrs.val.index.bgcolor =
-		    (console_color_t) ipc_get_arg1(icall);
-		dev->attrs.val.index.fgcolor =
-		    (console_color_t) ipc_get_arg2(icall);
-		dev->attrs.val.index.attr =
-		    (console_color_attr_t) ipc_get_arg3(icall);
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void srv_set_rgb_color(ipc_call_t *icall)
-{
-	list_foreach(outdevs, link, outdev_t, dev) {
-		dev->attrs.type = CHAR_ATTR_RGB;
-		dev->attrs.val.rgb.bgcolor = ipc_get_arg1(icall);
-		dev->attrs.val.rgb.fgcolor = ipc_get_arg2(icall);
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static bool srv_update_scroll(outdev_t *dev, chargrid_t *buf)
-{
-	assert(dev->ops.char_update);
-
-	sysarg_t top_row = chargrid_get_top_row(buf);
-
-	if (dev->top_row == top_row)
-		return false;
-
-	dev->top_row = top_row;
-
-	for (sysarg_t y = 0; y < dev->rows; y++) {
-		for (sysarg_t x = 0; x < dev->cols; x++) {
-			charfield_t *front_field =
-			    chargrid_charfield_at(buf, x, y);
-			charfield_t *back_field =
-			    chargrid_charfield_at(dev->backbuf, x, y);
-			bool update = false;
-
-			if (front_field->ch != back_field->ch) {
-				back_field->ch = front_field->ch;
-				update = true;
-			}
-
-			if (!attrs_same(front_field->attrs, back_field->attrs)) {
-				back_field->attrs = front_field->attrs;
-				update = true;
-			}
-
-			front_field->flags &= ~CHAR_FLAG_DIRTY;
-
-			if (update)
-				dev->ops.char_update(dev, x, y);
-		}
-	}
-
-	return true;
-}
-
-static void srv_update(ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = resolve_frontbuf(ipc_get_arg1(icall), icall);
-	if (frontbuf == NULL)
-		return;
-
-	chargrid_t *buf = (chargrid_t *) frontbuf->data;
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.char_update);
-
-		if (srv_update_scroll(dev, buf))
-			continue;
-
-		for (sysarg_t y = 0; y < dev->rows; y++) {
-			for (sysarg_t x = 0; x < dev->cols; x++) {
-				charfield_t *front_field =
-				    chargrid_charfield_at(buf, x, y);
-				charfield_t *back_field =
-				    chargrid_charfield_at(dev->backbuf, x, y);
-				bool update = false;
-
-				if ((front_field->flags & CHAR_FLAG_DIRTY) ==
-				    CHAR_FLAG_DIRTY) {
-					if (front_field->ch != back_field->ch) {
-						back_field->ch = front_field->ch;
-						update = true;
-					}
-
-					if (!attrs_same(front_field->attrs,
-					    back_field->attrs)) {
-						back_field->attrs = front_field->attrs;
-						update = true;
-					}
-
-					front_field->flags &= ~CHAR_FLAG_DIRTY;
-				}
-
-				if (update)
-					dev->ops.char_update(dev, x, y);
-			}
-		}
-
-		dev->ops.flush(dev);
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void srv_damage(ipc_call_t *icall)
-{
-	frontbuf_t *frontbuf = resolve_frontbuf(ipc_get_arg1(icall), icall);
-	if (frontbuf == NULL)
-		return;
-
-	chargrid_t *buf = (chargrid_t *) frontbuf->data;
-
-	list_foreach(outdevs, link, outdev_t, dev) {
-		assert(dev->ops.char_update);
-
-		if (srv_update_scroll(dev, buf))
-			continue;
-
-		sysarg_t col = ipc_get_arg2(icall);
-		sysarg_t row = ipc_get_arg3(icall);
-
-		sysarg_t cols = ipc_get_arg4(icall);
-		sysarg_t rows = ipc_get_arg5(icall);
-
-		for (sysarg_t y = 0; y < rows; y++) {
-			for (sysarg_t x = 0; x < cols; x++) {
-				charfield_t *front_field =
-				    chargrid_charfield_at(buf, col + x, row + y);
-				charfield_t *back_field =
-				    chargrid_charfield_at(dev->backbuf, col + x, row + y);
-
-				back_field->ch = front_field->ch;
-				back_field->attrs = front_field->attrs;
-				front_field->flags &= ~CHAR_FLAG_DIRTY;
-				dev->ops.char_update(dev, col + x, row + y);
-			}
-		}
-		dev->ops.flush(dev);
-
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void client_connection(ipc_call_t *icall, void *arg)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case OUTPUT_YIELD:
-			srv_yield(&call);
-			break;
-		case OUTPUT_CLAIM:
-			srv_claim(&call);
-			break;
-		case OUTPUT_GET_DIMENSIONS:
-			srv_get_dimensions(&call);
-			break;
-		case OUTPUT_GET_CAPS:
-			srv_get_caps(&call);
-			break;
-
-		case OUTPUT_FRONTBUF_CREATE:
-			srv_frontbuf_create(&call);
-			break;
-		case OUTPUT_FRONTBUF_DESTROY:
-			srv_frontbuf_destroy(&call);
-			break;
-
-		case OUTPUT_CURSOR_UPDATE:
-			srv_cursor_update(&call);
-			break;
-		case OUTPUT_SET_STYLE:
-			srv_set_style(&call);
-			break;
-		case OUTPUT_SET_COLOR:
-			srv_set_color(&call);
-			break;
-		case OUTPUT_SET_RGB_COLOR:
-			srv_set_rgb_color(&call);
-			break;
-		case OUTPUT_UPDATE:
-			srv_update(&call);
-			break;
-		case OUTPUT_DAMAGE:
-			srv_damage(&call);
-			break;
-
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-static void usage(char *name)
-{
-	printf("Usage: %s <service_name>\n", name);
-}
-
-int main(int argc, char *argv[])
-{
-	loc_srv_t *srv;
-
-	if (argc < 2) {
-		usage(argv[0]);
-		return 1;
-	}
-
-	printf("%s: HelenOS output service\n", NAME);
-
-	/* Register server */
-	async_set_fallback_port_handler(client_connection, NULL);
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register driver\n", NAME);
-		return rc;
-	}
-
-	service_id_t service_id;
-	rc = loc_service_register(srv, argv[1], &service_id);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-
-		printf("%s: Unable to register service %s\n", NAME, argv[1]);
-		return rc;
-	}
-
-	if (!config_key_exists("console")) {
-		ega_init();
-#if defined(CONFIG_FB) && !defined(CONFIG_WINSYS)
-		/*
-		 * NOTE: We don't have a good way of detecting the absence
-		 * of a KFB display device at run time because of the
-		 * asunchronous nature of device discovery
-		 */
-		output_ddev_init();
-#endif
-	}
-
-	chardev_init();
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/hid/output/output.h
===================================================================
--- uspace/srv/hid/output/output.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#ifndef OUTPUT_OUTPUT_H_
-#define OUTPUT_OUTPUT_H_
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <loc.h>
-#include <io/console.h>
-#include <io/style.h>
-#include <io/color.h>
-#include <io/chargrid.h>
-
-#define NAME  "output"
-
-struct outdev;
-
-typedef struct {
-	errno_t (*yield)(struct outdev *dev);
-	errno_t (*claim)(struct outdev *dev);
-
-	void (*get_dimensions)(struct outdev *dev, sysarg_t *cols,
-	    sysarg_t *rows);
-	console_caps_t (*get_caps)(struct outdev *dev);
-
-	void (*cursor_update)(struct outdev *dev, sysarg_t prev_col,
-	    sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible);
-	void (*char_update)(struct outdev *dev, sysarg_t col, sysarg_t row);
-	void (*flush)(struct outdev *dev);
-} outdev_ops_t;
-
-typedef struct outdev {
-	link_t link;
-
-	sysarg_t cols;
-	sysarg_t rows;
-	char_attrs_t attrs;
-
-	chargrid_t *backbuf;
-	sysarg_t top_row;
-
-	outdev_ops_t ops;
-	void *data;
-} outdev_t;
-
-extern outdev_t *outdev_register(outdev_ops_t *, void *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/output/port/chardev.c
===================================================================
--- uspace/srv/hid/output/port/chardev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,275 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogropu output
- * @{
- */
-
-#include <async.h>
-#include <config.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/chardev.h>
-#include <loc.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "../ctl/serial.h"
-#include "../output.h"
-#include "chardev.h"
-
-enum {
-	chardev_buf_size = 4096
-};
-
-static char *console;
-
-static async_sess_t *sess;
-static chardev_t *chardev;
-static service_id_t serial_cat_id;
-static service_id_t console_cat_id;
-
-static uint8_t chardev_buf[chardev_buf_size];
-static size_t chardev_bused;
-
-static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
-static bool discovery_finished;
-static FIBRIL_CONDVAR_INITIALIZE(discovery_cv);
-
-static void chardev_flush(void)
-{
-	size_t nwr;
-
-	if (chardev_bused == 0)
-		return;
-
-	chardev_write(chardev, chardev_buf, chardev_bused, &nwr);
-	/* XXX Handle error */
-
-	chardev_bused = 0;
-}
-
-static void chardev_putchar(char ch)
-{
-	if (chardev_bused == chardev_buf_size)
-		chardev_flush();
-	chardev_buf[chardev_bused++] = (uint8_t) ch;
-}
-
-static void chardev_putuchar(char32_t ch)
-{
-	char buf[STR_BOUNDS(1)];
-	size_t off;
-	size_t i;
-	errno_t rc;
-
-	off = 0;
-	rc = chr_encode(ch, buf, &off, sizeof(buf));
-	if (rc != EOK)
-		return;
-
-	for (i = 0; i < off; i++)
-		chardev_putchar(buf[i]);
-}
-
-static void chardev_control_puts(const char *str)
-{
-	const char *p;
-
-	p = str;
-	while (*p != '\0')
-		chardev_putuchar(*p++);
-}
-
-static bool find_output_dev(service_id_t *svcid)
-{
-	service_id_t *svc;
-	size_t svcs;
-	errno_t rc;
-
-	rc = loc_category_get_svcs(serial_cat_id, &svc, &svcs);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&discovery_lock);
-		printf("%s: Failed to get services\n", NAME);
-		return false;
-	}
-
-	for (size_t i = 0; i < svcs; i++) {
-		char *name;
-
-		rc = loc_service_get_name(svc[i], &name);
-		if (rc != EOK)
-			continue;
-
-		if (!str_cmp(console, name)) {
-			/*
-			 * This is the serial console service that the user
-			 * wanted to use.
-			 */
-			*svcid = svc[i];
-			free(svc);
-			return true;
-		}
-
-		free(name);
-	}
-
-	free(svc);
-
-	/* Look for any service in the 'console' category */
-
-	rc = loc_category_get_svcs(console_cat_id, &svc, &svcs);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&discovery_lock);
-		printf("%s: Failed to get services\n", NAME);
-		return false;
-	}
-
-	if (svcs > 0) {
-		*svcid = svc[0];
-		free(svc);
-		return true;
-	}
-
-	free(svc);
-	return false;
-}
-
-/*
- * This callback scans all the services in the 'serial' category, hoping to see
- * the single one the user wishes to use as a serial console. If it spots it, it
- * connects to it and registers it as an output device. Then it unblocks the
- * fibril blocked in chardev_init().
- */
-static void check_for_dev(void *arg)
-{
-	errno_t rc;
-	bool found;
-	service_id_t sid;
-
-	fibril_mutex_lock(&discovery_lock);
-	if (discovery_finished) {
-		// TODO: no need to receive these callbacks anymore
-		fibril_mutex_unlock(&discovery_lock);
-		return;
-	}
-
-	found = find_output_dev(&sid);
-	if (!found) {
-		fibril_mutex_unlock(&discovery_lock);
-		return;
-	}
-
-	printf("%s: Connecting service %zu\n", NAME, sid);
-	char *name;
-	rc = loc_service_get_name(sid, &name);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&discovery_lock);
-		return;
-	}
-	printf("%s: Service name is %s\n", NAME, name);
-	free(name);
-
-	sess = loc_service_connect(sid, INTERFACE_DDF, IPC_FLAG_BLOCKING);
-	if (!sess) {
-		fibril_mutex_unlock(&discovery_lock);
-		printf("%s: Failed connecting to device\n", NAME);
-		return;
-	}
-
-	rc = chardev_open(sess, &chardev);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&discovery_lock);
-		printf("%s: Failed opening character device\n", NAME);
-		return;
-	}
-
-	serial_init(chardev_putuchar, chardev_control_puts, chardev_flush);
-
-	discovery_finished = true;
-	fibril_condvar_signal(&discovery_cv);
-	fibril_mutex_unlock(&discovery_lock);
-}
-
-errno_t chardev_init(void)
-{
-	if (!config_key_exists("console")) {
-		console = NULL;
-#ifdef MACHINE_ski
-		/* OK */
-#elif defined(UARCH_sparc64) && defined(PROCESSOR_sun4v)
-		/* OK */
-#elif defined(MACHINE_msim)
-		/* OK */
-#elif defined(UARCH_arm64) && defined(MACHINE_virt)
-		/* OK */
-#elif defined(UARCH_arm64) && defined(MACHINE_hikey960)
-		/* OK */
-#else
-		return EOK;
-#endif
-	} else {
-		console = config_get_value("console");
-		if (!console)
-			return EOK;
-	}
-
-	errno_t rc = loc_category_get_id("serial", &serial_cat_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed to get \"serial\" category ID.\n", NAME);
-		return rc;
-	}
-
-	rc = loc_category_get_id("console", &console_cat_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Failed to get \"console\" category ID.\n", NAME);
-		return rc;
-	}
-
-	rc = loc_register_cat_change_cb(check_for_dev, NULL);
-	if (rc != EOK) {
-		printf("%s: Failed to register callback for device discovery.\n",
-		    NAME);
-		return rc;
-	}
-
-	check_for_dev(NULL);
-
-	fibril_mutex_lock(&discovery_lock);
-	while (!discovery_finished)
-		fibril_condvar_wait(&discovery_cv, &discovery_lock);
-	fibril_mutex_unlock(&discovery_lock);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/output/port/chardev.h
===================================================================
--- uspace/srv/hid/output/port/chardev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#ifndef OUTPUT_PORT_CHARDEV_H_
-#define OUTPUT_PORT_CHARDEV_H_
-
-extern errno_t chardev_init(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/output/port/ddev.c
===================================================================
--- uspace/srv/hid/output/port/ddev.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,326 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2008 Martin Decky
- * Copyright (c) 2006 Jakub Vana
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#include <ddev.h>
-#include <errno.h>
-#include <fbfont/font-8x16.h>
-#include <gfx/bitmap.h>
-#include <gfx/color.h>
-#include <gfx/coord.h>
-#include <gfx/context.h>
-#include <gfx/render.h>
-#include <io/chargrid.h>
-#include <io/pixelmap.h>
-#include <stdlib.h>
-#include "../output.h"
-#include "ddev.h"
-
-#define KFB_DDEV_NAME "devices/\\virt\\kfb\\kfb"
-
-typedef struct {
-	gfx_context_t *gc;
-
-	sysarg_t cols;
-	sysarg_t rows;
-
-	uint8_t style_normal;
-	uint8_t style_inverted;
-
-	gfx_bitmap_t *bitmap;
-	pixelmap_t pixelmap;
-	gfx_rect_t dirty;
-
-	sysarg_t curs_col;
-	sysarg_t curs_row;
-	bool curs_visible;
-} output_ddev_t;
-
-static pixel_t color_table[16] = {
-	[COLOR_BLACK]       = 0x000000,
-	[COLOR_BLUE]        = 0x0000f0,
-	[COLOR_GREEN]       = 0x00f000,
-	[COLOR_CYAN]        = 0x00f0f0,
-	[COLOR_RED]         = 0xf00000,
-	[COLOR_MAGENTA]     = 0xf000f0,
-	[COLOR_YELLOW]      = 0xf0f000,
-	[COLOR_WHITE]       = 0xf0f0f0,
-
-	[COLOR_BLACK + 8]   = 0x000000,
-	[COLOR_BLUE + 8]    = 0x0000ff,
-	[COLOR_GREEN + 8]   = 0x00ff00,
-	[COLOR_CYAN + 8]    = 0x00ffff,
-	[COLOR_RED + 8]     = 0xff0000,
-	[COLOR_MAGENTA + 8] = 0xff00ff,
-	[COLOR_YELLOW + 8]  = 0xffff00,
-	[COLOR_WHITE + 8]   = 0xffffff,
-};
-
-static void attrs_rgb(char_attrs_t attrs, pixel_t *bgcolor, pixel_t *fgcolor)
-{
-	switch (attrs.type) {
-	case CHAR_ATTR_STYLE:
-		switch (attrs.val.style) {
-		case STYLE_NORMAL:
-			*bgcolor = color_table[COLOR_WHITE];
-			*fgcolor = color_table[COLOR_BLACK];
-			break;
-		case STYLE_EMPHASIS:
-			*bgcolor = color_table[COLOR_WHITE];
-			*fgcolor = color_table[COLOR_RED];
-			break;
-		case STYLE_INVERTED:
-			*bgcolor = color_table[COLOR_BLACK];
-			*fgcolor = color_table[COLOR_WHITE];
-			break;
-		case STYLE_SELECTED:
-			*bgcolor = color_table[COLOR_RED];
-			*fgcolor = color_table[COLOR_WHITE];
-			break;
-		}
-		break;
-	case CHAR_ATTR_INDEX:
-		*bgcolor = color_table[(attrs.val.index.bgcolor & 7) |
-		    ((attrs.val.index.attr & CATTR_BRIGHT) ? 8 : 0)];
-		*fgcolor = color_table[(attrs.val.index.fgcolor & 7) |
-		    ((attrs.val.index.attr & CATTR_BRIGHT) ? 8 : 0)];
-		break;
-	case CHAR_ATTR_RGB:
-		*bgcolor = attrs.val.rgb.bgcolor;
-		*fgcolor = attrs.val.rgb.fgcolor;
-		break;
-	}
-}
-
-/** Draw the character at the specified position.
- *
- * @param field Character field.
- * @param col   Horizontal screen position.
- * @param row   Vertical screen position.
- *
- */
-static void draw_char(output_ddev_t *ddev, charfield_t *field,
-    sysarg_t col, sysarg_t row)
-{
-	pixel_t fgcolor;
-	pixel_t bgcolor;
-	pixel_t pcolor;
-	pixel_t tmp;
-	gfx_rect_t rect;
-	gfx_rect_t ndrect;
-	gfx_coord_t x, y;
-	bool inverted;
-	uint32_t glyph;
-
-	fgcolor = bgcolor = 0;
-	attrs_rgb(field->attrs, &bgcolor, &fgcolor);
-
-	inverted = (col == ddev->curs_col) && (row == ddev->curs_row) &&
-	    ddev->curs_visible;
-
-	if (inverted) {
-		/* Swap foreground and background colors */
-		tmp = bgcolor;
-		bgcolor = fgcolor;
-		fgcolor = tmp;
-	}
-
-	rect.p0.x = FONT_WIDTH * col;
-	rect.p0.y = FONT_SCANLINES * row;
-	rect.p1.x = FONT_WIDTH * (col + 1);
-	rect.p1.y = FONT_SCANLINES * (row + 1);
-
-	glyph = fb_font_glyph(field->ch, NULL);
-
-	for (y = 0; y < FONT_SCANLINES; y++) {
-		for (x = 0; x < FONT_WIDTH; x++) {
-			pcolor = fb_font[glyph][y] & (1 << (7 - x)) ?
-			    fgcolor : bgcolor;
-			pixelmap_put_pixel(&ddev->pixelmap,
-			    rect.p0.x + x, rect.p0.y + y, pcolor);
-		}
-	}
-
-	/* Compute new dirty rectangle */
-	gfx_rect_envelope(&ddev->dirty, &rect, &ndrect);
-	ddev->dirty = ndrect;
-}
-
-static errno_t output_ddev_yield(outdev_t *dev)
-{
-	return EOK;
-}
-
-static errno_t output_ddev_claim(outdev_t *dev)
-{
-	return EOK;
-}
-
-static void output_ddev_get_dimensions(outdev_t *dev, sysarg_t *cols, sysarg_t *rows)
-{
-	output_ddev_t *ddev = (output_ddev_t *) dev->data;
-
-	*cols = ddev->cols;
-	*rows = ddev->rows;
-}
-
-static console_caps_t output_ddev_get_caps(outdev_t *dev)
-{
-	return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
-	    CONSOLE_CAP_INDEXED | CONSOLE_CAP_RGB);
-}
-
-static void output_ddev_char_update(outdev_t *dev, sysarg_t col, sysarg_t row)
-{
-	output_ddev_t *ddev = (output_ddev_t *) dev->data;
-
-	charfield_t *field =
-	    chargrid_charfield_at(dev->backbuf, col, row);
-
-	draw_char(ddev, field, col, row);
-}
-
-static void output_ddev_cursor_update(outdev_t *dev, sysarg_t prev_col,
-    sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible)
-{
-	output_ddev_t *ddev = (output_ddev_t *) dev->data;
-
-	ddev->curs_col = col;
-	ddev->curs_row = row;
-	ddev->curs_visible = visible;
-
-	output_ddev_char_update(dev, prev_col, prev_row);
-	output_ddev_char_update(dev, col, row);
-}
-
-static void output_ddev_flush(outdev_t *dev)
-{
-	output_ddev_t *ddev = (output_ddev_t *) dev->data;
-
-	(void) gfx_bitmap_render(ddev->bitmap, &ddev->dirty, NULL);
-
-	ddev->dirty.p0.x = 0;
-	ddev->dirty.p0.y = 0;
-	ddev->dirty.p1.x = 0;
-	ddev->dirty.p1.y = 0;
-}
-
-static outdev_ops_t output_ddev_ops = {
-	.yield = output_ddev_yield,
-	.claim = output_ddev_claim,
-	.get_dimensions = output_ddev_get_dimensions,
-	.get_caps = output_ddev_get_caps,
-	.cursor_update = output_ddev_cursor_update,
-	.char_update = output_ddev_char_update,
-	.flush = output_ddev_flush
-};
-
-errno_t output_ddev_init(void)
-{
-	ddev_t *dd = NULL;
-	output_ddev_t *ddev = NULL;
-	ddev_info_t info;
-	gfx_coord2_t dims;
-	gfx_context_t *gc;
-	gfx_bitmap_params_t params;
-	gfx_bitmap_alloc_t alloc;
-	gfx_bitmap_t *bitmap = NULL;
-	errno_t rc;
-
-	ddev = calloc(1, sizeof(output_ddev_t));
-	if (ddev == NULL)
-		return ENOMEM;
-
-	rc = ddev_open(KFB_DDEV_NAME, &dd);
-	if (rc != EOK) {
-		printf("Error opening display device '%s'.", KFB_DDEV_NAME);
-		goto error;
-	}
-
-	rc = ddev_get_info(dd, &info);
-	if (rc != EOK) {
-		printf("Error getting information for display device '%s'.",
-		    KFB_DDEV_NAME);
-		goto error;
-	}
-
-	rc = ddev_get_gc(dd, &gc);
-	if (rc != EOK) {
-		printf("Error getting device context for '%s'.", KFB_DDEV_NAME);
-		goto error;
-	}
-
-	gfx_bitmap_params_init(&params);
-	params.rect = info.rect;
-
-	rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
-	if (rc != EOK) {
-		printf("Error creating screen bitmap.\n");
-		goto error;
-	}
-
-	rc = gfx_bitmap_get_alloc(bitmap, &alloc);
-	if (rc != EOK) {
-		printf("Error getting bitmap allocation info.\n");
-		goto error;
-	}
-
-	gfx_rect_dims(&info.rect, &dims);
-
-	ddev->gc = gc;
-	ddev->cols = dims.x / FONT_WIDTH;
-	ddev->rows = dims.y / FONT_SCANLINES;
-	ddev->bitmap = bitmap;
-	ddev->pixelmap.width = dims.x;
-	ddev->pixelmap.height = dims.y;
-	ddev->pixelmap.data = alloc.pixels;
-
-	outdev_t *dev = outdev_register(&output_ddev_ops, (void *) ddev);
-	if (dev == NULL) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (dd != NULL)
-		ddev_close(dd);
-	if (bitmap != NULL)
-		gfx_bitmap_destroy(bitmap);
-	free(ddev);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/hid/output/port/ddev.h
===================================================================
--- uspace/srv/hid/output/port/ddev.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2020 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#ifndef OUTPUT_PORT_DDEV_H_
-#define OUTPUT_PORT_DDEV_H_
-
-extern errno_t output_ddev_init(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/output/port/ega.c
===================================================================
--- uspace/srv/hid/output/port/ega.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2011 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#include <codepage/cp437.h>
-#include <errno.h>
-#include <sysinfo.h>
-#include <align.h>
-#include <as.h>
-#include <ddi.h>
-#include <io/chargrid.h>
-#include "../output.h"
-#include "ega.h"
-
-#define EGA_IO_BASE  ((ioport8_t *) 0x3d4)
-#define EGA_IO_SIZE  2
-
-#define FB_POS(x, y)  (((y) * ega.cols + (x)) << 1)
-
-typedef struct {
-	sysarg_t cols;
-	sysarg_t rows;
-
-	uint8_t style_normal;
-	uint8_t style_inverted;
-
-	size_t size;
-	uint8_t *addr;
-} ega_t;
-
-static ega_t ega;
-
-static uint8_t attrs_attr(char_attrs_t attrs)
-{
-	uint8_t attr = 0;
-
-	switch (attrs.type) {
-	case CHAR_ATTR_STYLE:
-		switch (attrs.val.style) {
-		case STYLE_NORMAL:
-			attr = ega.style_normal;
-			break;
-		case STYLE_EMPHASIS:
-			attr = (ega.style_normal | 0x04);
-			break;
-		case STYLE_INVERTED:
-			attr = ega.style_inverted;
-			break;
-		case STYLE_SELECTED:
-			attr = (ega.style_inverted | 0x40);
-			break;
-		}
-		break;
-	case CHAR_ATTR_INDEX:
-		attr = ((attrs.val.index.bgcolor & 7) << 4) |
-		    (attrs.val.index.fgcolor & 7);
-
-		if (attrs.val.index.attr & CATTR_BRIGHT)
-			attr |= 0x08;
-
-		break;
-	case CHAR_ATTR_RGB:
-		attr =
-		    ((RED(attrs.val.rgb.fgcolor) >= 0x80) ? 0x40 : 0) |
-		    ((GREEN(attrs.val.rgb.fgcolor) >= 0x80) ? 0x20 : 0) |
-		    ((BLUE(attrs.val.rgb.fgcolor) >= 0x80) ? 0x10 : 0) |
-		    ((RED(attrs.val.rgb.bgcolor) >= 0x80) ? 0x04 : 0) |
-		    ((GREEN(attrs.val.rgb.bgcolor) >= 0x80) ? 0x02 : 0) |
-		    ((BLUE(attrs.val.rgb.bgcolor) >= 0x80) ? 0x01 : 0);
-		break;
-	}
-
-	return attr;
-}
-
-/** Draw the character at the specified position.
- *
- * @param field Character field.
- * @param col   Horizontal screen position.
- * @param row   Vertical screen position.
- *
- */
-static void draw_char(charfield_t *field, sysarg_t col, sysarg_t row)
-{
-	uint8_t glyph;
-	errno_t rc;
-
-	rc = cp437_encode(field->ch, &glyph);
-	if (rc != EOK)
-		glyph = '?';
-
-	uint8_t attr = attrs_attr(field->attrs);
-
-	ega.addr[FB_POS(col, row)] = glyph;
-	ega.addr[FB_POS(col, row) + 1] = attr;
-}
-
-static errno_t ega_yield(outdev_t *dev)
-{
-	return EOK;
-}
-
-static errno_t ega_claim(outdev_t *dev)
-{
-	return EOK;
-}
-
-static void ega_get_dimensions(outdev_t *dev, sysarg_t *cols, sysarg_t *rows)
-{
-	*cols = ega.cols;
-	*rows = ega.rows;
-}
-
-static console_caps_t ega_get_caps(outdev_t *dev)
-{
-	return (CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
-	    CONSOLE_CAP_INDEXED);
-}
-
-static void ega_cursor_update(outdev_t *dev, sysarg_t prev_col,
-    sysarg_t prev_row, sysarg_t col, sysarg_t row, bool visible)
-{
-	/* Cursor position */
-	uint16_t cursor = row * ega.cols + col;
-
-	pio_write_8(EGA_IO_BASE, 0x0e);
-	pio_write_8(EGA_IO_BASE + 1, (cursor >> 8) & 0xff);
-	pio_write_8(EGA_IO_BASE, 0x0f);
-	pio_write_8(EGA_IO_BASE + 1, cursor & 0xff);
-
-	/* Cursor visibility */
-	pio_write_8(EGA_IO_BASE, 0x0a);
-	uint8_t stat = pio_read_8(EGA_IO_BASE + 1);
-
-	pio_write_8(EGA_IO_BASE, 0x0a);
-
-	if (visible)
-		pio_write_8(EGA_IO_BASE + 1, stat & (~(1 << 5)));
-	else
-		pio_write_8(EGA_IO_BASE + 1, stat | (1 << 5));
-}
-
-static void ega_char_update(outdev_t *dev, sysarg_t col, sysarg_t row)
-{
-	charfield_t *field =
-	    chargrid_charfield_at(dev->backbuf, col, row);
-
-	draw_char(field, col, row);
-}
-
-static void ega_flush(outdev_t *dev)
-{
-}
-
-static outdev_ops_t ega_ops = {
-	.yield = ega_yield,
-	.claim = ega_claim,
-	.get_dimensions = ega_get_dimensions,
-	.get_caps = ega_get_caps,
-	.cursor_update = ega_cursor_update,
-	.char_update = ega_char_update,
-	.flush = ega_flush
-};
-
-errno_t ega_init(void)
-{
-	sysarg_t present;
-	errno_t rc = sysinfo_get_value("fb", &present);
-	if (rc != EOK)
-		present = false;
-
-	if (!present)
-		return ENOENT;
-
-	sysarg_t kind;
-	rc = sysinfo_get_value("fb.kind", &kind);
-	if (rc != EOK)
-		kind = (sysarg_t) -1;
-
-	if (kind != 2)
-		return EINVAL;
-
-	sysarg_t paddr;
-	rc = sysinfo_get_value("fb.address.physical", &paddr);
-	if (rc != EOK)
-		return rc;
-
-	rc = sysinfo_get_value("fb.width", &ega.cols);
-	if (rc != EOK)
-		return rc;
-
-	rc = sysinfo_get_value("fb.height", &ega.rows);
-	if (rc != EOK)
-		return rc;
-
-	rc = pio_enable((void *)EGA_IO_BASE, EGA_IO_SIZE, NULL);
-	if (rc != EOK)
-		return rc;
-
-	ega.size = (ega.cols * ega.rows) << 1;
-	ega.addr = AS_AREA_ANY;
-
-	rc = physmem_map(paddr,
-	    ALIGN_UP(ega.size, PAGE_SIZE) >> PAGE_WIDTH,
-	    AS_AREA_READ | AS_AREA_WRITE, (void *) &ega.addr);
-	if (rc != EOK)
-		return rc;
-
-	sysarg_t blinking;
-	rc = sysinfo_get_value("fb.blinking", &blinking);
-	if (rc != EOK)
-		blinking = false;
-
-	ega.style_normal = 0xf0;
-	ega.style_inverted = 0x0f;
-
-	if (blinking) {
-		ega.style_normal &= 0x77;
-		ega.style_inverted &= 0x77;
-	}
-
-	outdev_t *dev = outdev_register(&ega_ops, (void *) &ega);
-	if (dev == NULL) {
-		as_area_destroy(ega.addr);
-		return EINVAL;
-	}
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hid/output/port/ega.h
===================================================================
--- uspace/srv/hid/output/port/ega.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup output
- * @{
- */
-
-#ifndef OUTPUT_PORT_EGA_H_
-#define OUTPUT_PORT_EGA_H_
-
-extern errno_t ega_init(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/hid/remcons/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/remcons/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup remcons remcons
- * @ingroup srvs
- * @brief Remote console service
- */
Index: pace/srv/hid/remcons/meson.build
===================================================================
--- uspace/srv/hid/remcons/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2012 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'console', 'vt' ]
-src = files('remcons.c', 'user.c')
Index: pace/srv/hid/remcons/remcons.c
===================================================================
--- uspace/srv/hid/remcons/remcons.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,920 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup remcons
- * @{
- */
-/** @file
- */
-
-#include <adt/list.h>
-#include <as.h>
-#include <async.h>
-#include <errno.h>
-#include <io/con_srv.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include <loc.h>
-#include <io/keycode.h>
-#include <align.h>
-#include <fibril_synch.h>
-#include <task.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/tcp.h>
-#include <io/console.h>
-#include <inttypes.h>
-#include <str.h>
-#include <vt/vt100.h>
-#include "telnet.h"
-#include "user.h"
-#include "remcons.h"
-
-#define APP_GETTERM  "/app/getterm"
-#define APP_SHELL "/app/bdsh"
-
-#define DEF_PORT 2223
-
-/** Telnet commands to force character mode
- * (redundant to be on the safe side).
- * See
- * http://stackoverflow.com/questions/273261/force-telnet-user-into-character-mode
- * for discussion.
- */
-static const telnet_cmd_t telnet_force_character_mode_command[] = {
-	TELNET_IAC, TELNET_WILL, TELNET_ECHO,
-	TELNET_IAC, TELNET_WILL, TELNET_SUPPRESS_GO_AHEAD,
-	TELNET_IAC, TELNET_WONT, TELNET_LINEMODE
-};
-
-static const size_t telnet_force_character_mode_command_count =
-    sizeof(telnet_force_character_mode_command) / sizeof(telnet_cmd_t);
-
-static errno_t remcons_open(con_srvs_t *, con_srv_t *);
-static errno_t remcons_close(con_srv_t *);
-static errno_t remcons_read(con_srv_t *, void *, size_t, size_t *);
-static errno_t remcons_write(con_srv_t *, void *, size_t, size_t *);
-static void remcons_sync(con_srv_t *);
-static void remcons_clear(con_srv_t *);
-static void remcons_set_pos(con_srv_t *, sysarg_t col, sysarg_t row);
-static errno_t remcons_get_pos(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t remcons_get_size(con_srv_t *, sysarg_t *, sysarg_t *);
-static errno_t remcons_get_color_cap(con_srv_t *, console_caps_t *);
-static void remcons_set_style(con_srv_t *, console_style_t);
-static void remcons_set_color(con_srv_t *, console_color_t,
-    console_color_t, console_color_attr_t);
-static void remcons_set_color(con_srv_t *, console_color_t,
-    console_color_t, console_color_attr_t);
-static void remcons_set_rgb_color(con_srv_t *, pixel_t, pixel_t);
-static void remcons_cursor_visibility(con_srv_t *, bool);
-static errno_t remcons_set_caption(con_srv_t *, const char *);
-static errno_t remcons_get_event(con_srv_t *, cons_event_t *);
-static errno_t remcons_map(con_srv_t *, sysarg_t, sysarg_t, charfield_t **);
-static void remcons_unmap(con_srv_t *);
-static void remcons_update(con_srv_t *, sysarg_t, sysarg_t, sysarg_t,
-    sysarg_t);
-
-static con_ops_t con_ops = {
-	.open = remcons_open,
-	.close = remcons_close,
-	.read = remcons_read,
-	.write = remcons_write,
-	.sync = remcons_sync,
-	.clear = remcons_clear,
-	.set_pos = remcons_set_pos,
-	.get_pos = remcons_get_pos,
-	.get_size = remcons_get_size,
-	.get_color_cap = remcons_get_color_cap,
-	.set_style = remcons_set_style,
-	.set_color = remcons_set_color,
-	.set_rgb_color = remcons_set_rgb_color,
-	.set_cursor_visibility = remcons_cursor_visibility,
-	.set_caption = remcons_set_caption,
-	.get_event = remcons_get_event,
-	.map = remcons_map,
-	.unmap = remcons_unmap,
-	.update = remcons_update
-};
-
-static void remcons_vt_putchar(void *, char32_t);
-static void remcons_vt_cputs(void *, const char *);
-static void remcons_vt_flush(void *);
-static void remcons_vt_key(void *, keymod_t, keycode_t, char);
-static void remcons_vt_pos_event(void *, pos_event_t *);
-
-static vt100_cb_t remcons_vt_cb = {
-	.putuchar = remcons_vt_putchar,
-	.control_puts = remcons_vt_cputs,
-	.flush = remcons_vt_flush,
-	.key = remcons_vt_key,
-	.pos_event = remcons_vt_pos_event
-};
-
-static void remcons_new_conn(tcp_listener_t *lst, tcp_conn_t *conn);
-
-static tcp_listen_cb_t listen_cb = {
-	.new_conn = remcons_new_conn
-};
-
-static tcp_cb_t conn_cb = {
-	.connected = NULL
-};
-
-static void remcons_telnet_ws_update(void *, unsigned, unsigned);
-
-static telnet_cb_t remcons_telnet_cb = {
-	.ws_update = remcons_telnet_ws_update
-};
-
-static loc_srv_t *remcons_srv;
-static bool no_ctl;
-static bool no_rgb;
-
-static telnet_user_t *srv_to_user(con_srv_t *srv)
-{
-	remcons_t *remcons = (remcons_t *)srv->srvs->sarg;
-	return remcons->user;
-}
-
-static remcons_t *srv_to_remcons(con_srv_t *srv)
-{
-	remcons_t *remcons = (remcons_t *)srv->srvs->sarg;
-	return remcons;
-}
-
-static errno_t remcons_open(con_srvs_t *srvs, con_srv_t *srv)
-{
-	telnet_user_t *user = srv_to_user(srv);
-
-	telnet_user_log(user, "New client connected (%p).", srv);
-
-	/* Force character mode. */
-	(void) tcp_conn_send(user->conn, (void *)telnet_force_character_mode_command,
-	    telnet_force_character_mode_command_count);
-
-	return EOK;
-}
-
-static errno_t remcons_close(con_srv_t *srv)
-{
-	telnet_user_t *user = srv_to_user(srv);
-
-	telnet_user_notify_client_disconnected(user);
-	telnet_user_log(user, "Client disconnected (%p).", srv);
-
-	return EOK;
-}
-
-static errno_t remcons_read(con_srv_t *srv, void *data, size_t size,
-    size_t *nread)
-{
-	telnet_user_t *user = srv_to_user(srv);
-	errno_t rc;
-
-	rc = telnet_user_recv(user, data, size, nread);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-static errno_t remcons_write(con_srv_t *srv, void *data, size_t size, size_t *nwritten)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	errno_t rc;
-
-	rc = telnet_user_send_data(remcons->user, data, size);
-	if (rc != EOK)
-		return rc;
-
-	rc = telnet_user_flush(remcons->user);
-	if (rc != EOK)
-		return rc;
-
-	*nwritten = size;
-	return EOK;
-}
-
-static void remcons_sync(con_srv_t *srv)
-{
-	(void) srv;
-}
-
-static void remcons_clear(con_srv_t *srv)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-
-	if (remcons->enable_ctl) {
-		vt100_cls(remcons->vt);
-		vt100_set_pos(remcons->vt, 0, 0);
-		remcons->user->cursor_x = 0;
-		remcons->user->cursor_y = 0;
-	}
-}
-
-static void remcons_set_pos(con_srv_t *srv, sysarg_t col, sysarg_t row)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	telnet_user_t *user = srv_to_user(srv);
-
-	if (remcons->enable_ctl) {
-		vt100_set_pos(remcons->vt, col, row);
-		remcons->user->cursor_x = col;
-		remcons->user->cursor_y = row;
-		(void)telnet_user_flush(remcons->user);
-	} else {
-		telnet_user_update_cursor_x(user, col);
-	}
-}
-
-static errno_t remcons_get_pos(con_srv_t *srv, sysarg_t *col, sysarg_t *row)
-{
-	telnet_user_t *user = srv_to_user(srv);
-
-	*col = user->cursor_x;
-	*row = user->cursor_y;
-
-	return EOK;
-}
-
-static errno_t remcons_get_size(con_srv_t *srv, sysarg_t *cols, sysarg_t *rows)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-
-	if (remcons->enable_ctl) {
-		*cols = remcons->vt->cols;
-		*rows = remcons->vt->rows;
-	} else {
-		*cols = 100;
-		*rows = 1;
-	}
-
-	return EOK;
-}
-
-static errno_t remcons_get_color_cap(con_srv_t *srv, console_caps_t *ccaps)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-
-	*ccaps = 0;
-
-	if (remcons->enable_ctl) {
-		*ccaps |= CONSOLE_CAP_CURSORCTL | CONSOLE_CAP_STYLE |
-		    CONSOLE_CAP_INDEXED;
-	}
-
-	if (remcons->enable_rgb)
-		*ccaps |= CONSOLE_CAP_RGB;
-
-	return EOK;
-}
-
-static void remcons_set_style(con_srv_t *srv, console_style_t style)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	char_attrs_t attrs;
-
-	if (remcons->enable_ctl) {
-		attrs.type = CHAR_ATTR_STYLE;
-		attrs.val.style = style;
-		vt100_set_attr(remcons->vt, attrs);
-	}
-}
-
-static void remcons_set_color(con_srv_t *srv, console_color_t bgcolor,
-    console_color_t fgcolor, console_color_attr_t flags)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	char_attrs_t attrs;
-
-	if (remcons->enable_ctl) {
-		attrs.type = CHAR_ATTR_INDEX;
-		attrs.val.index.bgcolor = bgcolor;
-		attrs.val.index.fgcolor = fgcolor;
-		attrs.val.index.attr = flags;
-		vt100_set_attr(remcons->vt, attrs);
-	}
-}
-
-static void remcons_set_rgb_color(con_srv_t *srv, pixel_t bgcolor,
-    pixel_t fgcolor)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	char_attrs_t attrs;
-
-	if (remcons->enable_ctl) {
-		attrs.type = CHAR_ATTR_RGB;
-		attrs.val.rgb.bgcolor = bgcolor;
-		attrs.val.rgb.fgcolor = fgcolor;
-		vt100_set_attr(remcons->vt, attrs);
-	}
-}
-
-static void remcons_cursor_visibility(con_srv_t *srv, bool visible)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-
-	if (remcons->enable_ctl) {
-		if (!remcons->curs_visible && visible) {
-			vt100_set_pos(remcons->vt, remcons->user->cursor_x,
-			    remcons->user->cursor_y);
-		}
-		vt100_cursor_visibility(remcons->vt, visible);
-	}
-
-	remcons->curs_visible = visible;
-}
-
-static errno_t remcons_set_caption(con_srv_t *srv, const char *caption)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-
-	if (remcons->enable_ctl) {
-		vt100_set_title(remcons->vt, caption);
-	}
-
-	return EOK;
-}
-
-/** Creates new keyboard event from given char.
- *
- * @param type Event type (press / release).
- * @param c Pressed character.
- */
-static remcons_event_t *new_kbd_event(kbd_event_type_t type, keymod_t mods,
-    keycode_t key, char c)
-{
-	remcons_event_t *event = malloc(sizeof(remcons_event_t));
-	if (event == NULL) {
-		fprintf(stderr, "Out of memory.\n");
-		return NULL;
-	}
-
-	link_initialize(&event->link);
-	event->cev.type = CEV_KEY;
-	event->cev.ev.key.type = type;
-	event->cev.ev.key.mods = mods;
-	event->cev.ev.key.key = key;
-	event->cev.ev.key.c = c;
-
-	return event;
-}
-
-/** Creates new position event.
- *
- * @param ev Position event.
- * @param c Pressed character.
- */
-static remcons_event_t *new_pos_event(pos_event_t *ev)
-{
-	remcons_event_t *event = malloc(sizeof(remcons_event_t));
-	if (event == NULL) {
-		fprintf(stderr, "Out of memory.\n");
-		return NULL;
-	}
-
-	link_initialize(&event->link);
-	event->cev.type = CEV_POS;
-	event->cev.ev.pos = *ev;
-
-	return event;
-}
-
-/** Creates new console resize event.
- */
-static remcons_event_t *new_resize_event(void)
-{
-	remcons_event_t *event = malloc(sizeof(remcons_event_t));
-	if (event == NULL) {
-		fprintf(stderr, "Out of memory.\n");
-		return NULL;
-	}
-
-	link_initialize(&event->link);
-	event->cev.type = CEV_RESIZE;
-
-	return event;
-}
-
-static errno_t remcons_get_event(con_srv_t *srv, cons_event_t *event)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	telnet_user_t *user = srv_to_user(srv);
-	size_t nread;
-
-	while (list_empty(&remcons->in_events)) {
-		char next_byte = 0;
-
-		errno_t rc = telnet_user_recv(user, &next_byte, 1,
-		    &nread);
-		if (rc != EOK)
-			return rc;
-
-		vt100_rcvd_char(remcons->vt, next_byte);
-	}
-
-	link_t *link = list_first(&remcons->in_events);
-	list_remove(link);
-
-	remcons_event_t *tmp = list_get_instance(link, remcons_event_t, link);
-
-	*event = tmp->cev;
-	free(tmp);
-
-	return EOK;
-}
-
-static errno_t remcons_map(con_srv_t *srv, sysarg_t cols, sysarg_t rows,
-    charfield_t **rbuf)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	void *buf;
-
-	if (!remcons->enable_ctl)
-		return ENOTSUP;
-
-	if (remcons->ubuf != NULL)
-		return EBUSY;
-
-	buf = as_area_create(AS_AREA_ANY, cols * rows * sizeof(charfield_t),
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (buf == AS_MAP_FAILED)
-		return ENOMEM;
-
-	remcons->ucols = cols;
-	remcons->urows = rows;
-	remcons->ubuf = buf;
-
-	*rbuf = buf;
-	return EOK;
-
-}
-
-static void remcons_unmap(con_srv_t *srv)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	void *buf;
-
-	buf = remcons->ubuf;
-	remcons->ubuf = NULL;
-
-	if (buf != NULL)
-		as_area_destroy(buf);
-}
-
-static void remcons_update(con_srv_t *srv, sysarg_t c0, sysarg_t r0,
-    sysarg_t c1, sysarg_t r1)
-{
-	remcons_t *remcons = srv_to_remcons(srv);
-	charfield_t *ch;
-	sysarg_t col, row;
-	sysarg_t old_x, old_y;
-
-	if (remcons->ubuf == NULL)
-		return;
-
-	/* Make sure we have meaningful coordinates, within bounds */
-
-	if (c1 > remcons->ucols)
-		c1 = remcons->ucols;
-	if (c1 > remcons->user->cols)
-		c1 = remcons->user->cols;
-	if (c0 >= c1)
-		return;
-
-	if (r1 > remcons->urows)
-		r1 = remcons->urows;
-	if (r1 > remcons->user->rows)
-		r1 = remcons->user->rows;
-	if (r0 >= r1)
-		return;
-
-	/* Update screen from user buffer */
-
-	old_x = remcons->user->cursor_x;
-	old_y = remcons->user->cursor_y;
-
-	if (remcons->curs_visible)
-		vt100_cursor_visibility(remcons->vt, false);
-
-	for (row = r0; row < r1; row++) {
-		for (col = c0; col < c1; col++) {
-			vt100_set_pos(remcons->vt, col, row);
-			ch = &remcons->ubuf[row * remcons->ucols + col];
-			vt100_set_attr(remcons->vt, ch->attrs);
-			vt100_putuchar(remcons->vt, ch->ch);
-		}
-	}
-
-	if (remcons->curs_visible) {
-		old_x = remcons->user->cursor_x = old_x;
-		remcons->user->cursor_y = old_y;
-		vt100_set_pos(remcons->vt, old_x, old_y);
-		vt100_cursor_visibility(remcons->vt, true);
-	}
-
-	/* Flush data */
-	(void)telnet_user_flush(remcons->user);
-}
-
-/** Callback when client connects to a telnet terminal. */
-static void client_connection(ipc_call_t *icall, void *arg)
-{
-	/* Find the user. */
-	telnet_user_t *user = telnet_user_get_for_client_connection(ipc_get_arg2(icall));
-	if (user == NULL) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	/* Handle messages. */
-	con_conn(icall, &user->srvs);
-}
-
-/** Fibril for spawning the task running after user connects.
- *
- * @param arg Corresponding @c telnet_user_t structure.
- */
-static errno_t spawn_task_fibril(void *arg)
-{
-	telnet_user_t *user = arg;
-
-	task_id_t task;
-	task_wait_t wait;
-	errno_t rc = task_spawnl(&task, &wait, APP_GETTERM, APP_GETTERM, user->service_name,
-	    "/loc", "--msg", "--", APP_SHELL, NULL);
-	if (rc != EOK) {
-		telnet_user_error(user, "Spawning `%s %s /loc --msg -- %s' "
-		    "failed: %s.", APP_GETTERM, user->service_name, APP_SHELL,
-		    str_error(rc));
-		fibril_mutex_lock(&user->recv_lock);
-		user->task_finished = true;
-		user->srvs.aborted = true;
-		fibril_condvar_signal(&user->refcount_cv);
-		fibril_mutex_unlock(&user->recv_lock);
-		return EOK;
-	}
-
-	fibril_mutex_lock(&user->recv_lock);
-	user->task_id = task;
-	fibril_mutex_unlock(&user->recv_lock);
-
-	task_exit_t task_exit;
-	int task_retval;
-	task_wait(&wait, &task_exit, &task_retval);
-	telnet_user_log(user, "%s terminated %s, exit code %d.", APP_GETTERM,
-	    task_exit == TASK_EXIT_NORMAL ? "normally" : "unexpectedly",
-	    task_retval);
-
-	/* Announce destruction. */
-	fibril_mutex_lock(&user->recv_lock);
-	user->task_finished = true;
-	user->srvs.aborted = true;
-	fibril_condvar_signal(&user->refcount_cv);
-	fibril_mutex_unlock(&user->recv_lock);
-
-	return EOK;
-}
-
-/** Tell whether given user can be destroyed (has no active clients).
- *
- * @param user The telnet user in question.
- */
-static bool user_can_be_destroyed_no_lock(telnet_user_t *user)
-{
-	return user->task_finished && user->socket_closed &&
-	    (user->locsrv_connection_count == 0);
-}
-
-static void remcons_vt_putchar(void *arg, char32_t c)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-	char buf[STR_BOUNDS(1)];
-	size_t off;
-	errno_t rc;
-
-	(void)arg;
-
-	off = 0;
-	rc = chr_encode(c, buf, &off, sizeof(buf));
-	if (rc != EOK)
-		return;
-
-	(void)telnet_user_send_data(remcons->user, buf, off);
-}
-
-static void remcons_vt_cputs(void *arg, const char *str)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-
-	(void)telnet_user_send_raw(remcons->user, str, str_size(str));
-}
-
-static void remcons_vt_flush(void *arg)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-	(void)telnet_user_flush(remcons->user);
-}
-
-static void remcons_vt_key(void *arg, keymod_t mods, keycode_t key, char c)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-
-	remcons_event_t *down = new_kbd_event(KEY_PRESS, mods, key, c);
-	if (down == NULL)
-		return;
-
-	remcons_event_t *up = new_kbd_event(KEY_RELEASE, mods, key, c);
-	if (up == NULL) {
-		free(down);
-		return;
-	}
-
-	list_append(&down->link, &remcons->in_events);
-	list_append(&up->link, &remcons->in_events);
-}
-
-static void remcons_vt_pos_event(void *arg, pos_event_t *ev)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-
-	remcons_event_t *cev = new_pos_event(ev);
-	if (cev == NULL)
-		return;
-
-	list_append(&cev->link, &remcons->in_events);
-}
-
-/** Window size update callback.
- *
- * @param arg Argument (remcons_t *)
- * @param cols New number of columns
- * @param rows New number of rows
- */
-static void remcons_telnet_ws_update(void *arg, unsigned cols, unsigned rows)
-{
-	remcons_t *remcons = (remcons_t *)arg;
-
-	vt100_resize(remcons->vt, cols, rows);
-	telnet_user_resize(remcons->user, cols, rows);
-
-	remcons_event_t *resize = new_resize_event();
-	if (resize == NULL)
-		return;
-
-	list_append(&resize->link, &remcons->in_events);
-}
-
-/** Handle network connection.
- *
- * @param lst  Listener
- * @param conn Connection
- */
-static void remcons_new_conn(tcp_listener_t *lst, tcp_conn_t *conn)
-{
-	char_attrs_t attrs;
-	remcons_t *remcons = NULL;
-	telnet_user_t *user = NULL;
-
-	remcons = calloc(1, sizeof(remcons_t));
-	if (remcons == NULL) {
-		fprintf(stderr, "Out of memory.\n");
-		goto error;
-	}
-
-	user = telnet_user_create(conn, &remcons_telnet_cb,
-	    (void *)remcons);
-	if (user == NULL) {
-		fprintf(stderr, "Out of memory.\n");
-		goto error;
-	}
-
-	remcons->enable_ctl = !no_ctl;
-	remcons->enable_rgb = !no_ctl && !no_rgb;
-	remcons->user = user;
-	list_initialize(&remcons->in_events);
-
-	if (remcons->enable_ctl) {
-		user->cols = 80;
-		user->rows = 25;
-	} else {
-		user->cols = 100;
-		user->rows = 1;
-	}
-
-	remcons->curs_visible = true;
-
-	remcons->vt = vt100_create((void *)remcons, 80, 25, &remcons_vt_cb);
-	if (remcons->vt == NULL) {
-		fprintf(stderr, "Error creating VT100 driver instance.\n");
-		goto error;
-	}
-
-	remcons->vt->enable_rgb = remcons->enable_rgb;
-
-	if (remcons->enable_ctl) {
-		attrs.type = CHAR_ATTR_STYLE;
-		attrs.val.style = STYLE_NORMAL;
-		vt100_set_sgr(remcons->vt, attrs);
-		vt100_cls(remcons->vt);
-		vt100_set_pos(remcons->vt, 0, 0);
-		vt100_set_button_reporting(remcons->vt, true);
-	}
-
-	con_srvs_init(&user->srvs);
-	user->srvs.ops = &con_ops;
-	user->srvs.sarg = remcons;
-	user->srvs.abort_timeout = 1000000;
-
-	telnet_user_add(user);
-
-	errno_t rc = loc_service_register(remcons_srv, user->service_name,
-	    &user->service_id);
-	if (rc != EOK) {
-		telnet_user_error(user, "Unable to register %s with loc: %s.",
-		    user->service_name, str_error(rc));
-		goto error;
-	}
-
-	telnet_user_log(user, "Service %s registerd with id %" PRIun ".",
-	    user->service_name, user->service_id);
-
-	fid_t spawn_fibril = fibril_create(spawn_task_fibril, user);
-	if (spawn_fibril == 0) {
-		fprintf(stderr, "Failed creating fibril.\n");
-		goto error;
-	}
-	fibril_add_ready(spawn_fibril);
-
-	/* Wait for all clients to exit. */
-	fibril_mutex_lock(&user->recv_lock);
-	while (!user_can_be_destroyed_no_lock(user)) {
-		if (user->task_finished) {
-			user->socket_closed = true;
-			user->srvs.aborted = true;
-		} else if (user->socket_closed) {
-			if (user->task_id != 0) {
-				task_kill(user->task_id);
-			}
-		}
-		fibril_condvar_wait_timeout(&user->refcount_cv,
-		    &user->recv_lock, 1000000);
-	}
-	fibril_mutex_unlock(&user->recv_lock);
-
-	rc = loc_service_unregister(remcons_srv, user->service_id);
-	if (rc != EOK) {
-		telnet_user_error(user,
-		    "Unable to unregister %s from loc: %s (ignored).",
-		    user->service_name, str_error(rc));
-	}
-
-	telnet_user_log(user, "Destroying...");
-
-	if (remcons->enable_ctl) {
-		/* Disable mouse tracking */
-		vt100_set_button_reporting(remcons->vt, false);
-
-		/* Reset all character attributes and clear screen */
-		vt100_sgr(remcons->vt, 0);
-		vt100_cls(remcons->vt);
-		vt100_set_pos(remcons->vt, 0, 0);
-
-		telnet_user_flush(user);
-	}
-
-	tcp_conn_send_fin(user->conn);
-	user->conn = NULL;
-
-	telnet_user_destroy(user);
-	vt100_destroy(remcons->vt);
-	free(remcons);
-	return;
-error:
-	if (user != NULL && user->service_id != 0)
-		loc_service_unregister(remcons_srv, user->service_id);
-	if (user != NULL)
-		free(user);
-	if (remcons != NULL && remcons->vt != NULL)
-		vt100_destroy(remcons->vt);
-	if (remcons != NULL)
-		free(remcons);
-}
-
-static void print_syntax(void)
-{
-	fprintf(stderr, "syntax: remcons [<options>]\n");
-	fprintf(stderr, "\t--no-ctl      Disable all terminal control sequences\n");
-	fprintf(stderr, "\t--no-rgb      Disable RGB colors\n");
-	fprintf(stderr, "\t--port <port> Listening port (default: %u)\n",
-	    DEF_PORT);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	tcp_listener_t *lst;
-	tcp_t *tcp;
-	inet_ep_t ep;
-	uint16_t port;
-	int i;
-
-	port = DEF_PORT;
-
-	i = 1;
-	while (i < argc) {
-		if (argv[i][0] == '-') {
-			if (str_cmp(argv[i], "--no-ctl") == 0) {
-				no_ctl = true;
-			} else if (str_cmp(argv[i], "--no-rgb") == 0) {
-				no_rgb = true;
-			} else if (str_cmp(argv[i], "--port") == 0) {
-				++i;
-				if (i >= argc) {
-					fprintf(stderr, "Option argument "
-					    "missing.\n");
-					print_syntax();
-					return EINVAL;
-				}
-				rc = str_uint16_t(argv[i], NULL, 10, true, &port);
-				if (rc != EOK) {
-					fprintf(stderr, "Invalid port number "
-					    "'%s'.\n", argv[i]);
-					print_syntax();
-					return EINVAL;
-				}
-			} else {
-				fprintf(stderr, "Unknown option '%s'.\n",
-				    argv[i]);
-				print_syntax();
-				return EINVAL;
-			}
-		} else {
-			fprintf(stderr, "Unexpected argument.\n");
-			print_syntax();
-			return EINVAL;
-		}
-
-		++i;
-	}
-
-	async_set_fallback_port_handler(client_connection, NULL);
-	rc = loc_server_register(NAME, &remcons_srv);
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Unable to register server\n", NAME);
-		return rc;
-	}
-
-	rc = tcp_create(&tcp);
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Error initializing TCP.\n", NAME);
-		return rc;
-	}
-
-	inet_ep_init(&ep);
-	ep.port = port;
-
-	rc = tcp_listener_create(tcp, &ep, &listen_cb, NULL, &conn_cb, NULL,
-	    &lst);
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Error creating listener.\n", NAME);
-		return rc;
-	}
-
-	printf("%s: HelenOS Remote console service\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/hid/remcons/remcons.h
===================================================================
--- uspace/srv/hid/remcons/remcons.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup remcons
- * @{
- */
-/** @file
- */
-
-#ifndef REMCONS_H_
-#define REMCONS_H_
-
-#include <adt/list.h>
-#include <io/cons_event.h>
-#include <stdbool.h>
-#include <vt/vt100.h>
-#include "user.h"
-
-#define NAME       "remcons"
-#define NAMESPACE  "term"
-
-/** Remote console */
-typedef struct {
-	telnet_user_t *user;	/**< telnet user */
-	vt100_t *vt;		/**< virtual terminal driver */
-	bool enable_ctl;	/**< enable escape control sequences */
-	bool enable_rgb;	/**< enable RGB color setting */
-	sysarg_t ucols;		/**< number of columns in user buffer */
-	sysarg_t urows;		/**< number of rows in user buffer */
-	charfield_t *ubuf;	/**< user buffer */
-	bool curs_visible;	/**< cursor is visible */
-
-	/** List of remcons_event_t. */
-	list_t in_events;
-} remcons_t;
-
-/** Remote console event */
-typedef struct {
-	link_t link;		/**< link to list of events */
-	cons_event_t cev;	/**< console event */
-} remcons_event_t;
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/remcons/telnet.h
===================================================================
--- uspace/srv/hid/remcons/telnet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,67 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup remcons
- * @{
- */
-/** @file
- */
-
-#ifndef TELNET_H_
-#define TELNET_H_
-
-#include <inttypes.h>
-
-typedef uint8_t telnet_cmd_t;
-
-/*
- * Telnet commands.
- */
-
-#define TELNET_SE 240
-#define TELNET_SB 250
-#define TELNET_IAC 255
-
-#define TELNET_WILL 251
-#define TELNET_WONT 252
-#define TELNET_DO 253
-#define TELNET_DONT 254
-
-#define TELNET_IS_OPTION_CODE(code) (((code) >= 251) && ((code) <= 254))
-
-#define TELNET_ECHO 1
-#define TELNET_SUPPRESS_GO_AHEAD 3
-#define TELNET_NAWS 31
-#define TELNET_LINEMODE 34
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/remcons/user.c
===================================================================
--- uspace/srv/hid/remcons/user.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,624 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup remcons
- * @{
- */
-/** @file
- */
-#include <async.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <adt/prodcons.h>
-#include <errno.h>
-#include <macros.h>
-#include <mem.h>
-#include <str_error.h>
-#include <loc.h>
-#include <io/keycode.h>
-#include <align.h>
-#include <as.h>
-#include <fibril_synch.h>
-#include <task.h>
-#include <inet/tcp.h>
-#include <io/console.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "remcons.h"
-#include "user.h"
-#include "telnet.h"
-
-static FIBRIL_MUTEX_INITIALIZE(users_guard);
-static LIST_INITIALIZE(users);
-
-static errno_t telnet_user_send_raw_locked(telnet_user_t *, const void *,
-    size_t);
-static errno_t telnet_user_flush_locked(telnet_user_t *);
-
-/** Create new telnet user.
- *
- * @param conn Incoming connection.
- * @param cb Callback functions
- * @param arg Argument to callback functions
- * @return New telnet user or NULL when out of memory.
- */
-telnet_user_t *telnet_user_create(tcp_conn_t *conn, telnet_cb_t *cb, void *arg)
-{
-	static int telnet_user_id_counter = 0;
-
-	telnet_user_t *user = malloc(sizeof(telnet_user_t));
-	if (user == NULL) {
-		return NULL;
-	}
-
-	user->cb = cb;
-	user->arg = arg;
-	user->id = ++telnet_user_id_counter;
-
-	int rc = asprintf(&user->service_name, "%s/telnet%u.%d", NAMESPACE,
-	    (unsigned)task_get_id(), user->id);
-	if (rc < 0) {
-		free(user);
-		return NULL;
-	}
-
-	user->conn = conn;
-	user->service_id = (service_id_t) -1;
-	link_initialize(&user->link);
-	user->socket_buffer_len = 0;
-	user->socket_buffer_pos = 0;
-	user->send_buf_used = 0;
-
-	fibril_condvar_initialize(&user->refcount_cv);
-	fibril_mutex_initialize(&user->send_lock);
-	fibril_mutex_initialize(&user->recv_lock);
-	user->task_finished = false;
-	user->socket_closed = false;
-	user->locsrv_connection_count = 0;
-
-	user->cursor_x = 0;
-	user->cursor_y = 0;
-
-	return user;
-}
-
-void telnet_user_add(telnet_user_t *user)
-{
-	fibril_mutex_lock(&users_guard);
-	list_append(&user->link, &users);
-	fibril_mutex_unlock(&users_guard);
-}
-
-/** Destroy telnet user structure.
- *
- * @param user User to be destroyed.
- */
-void telnet_user_destroy(telnet_user_t *user)
-{
-	assert(user);
-
-	fibril_mutex_lock(&users_guard);
-	list_remove(&user->link);
-	fibril_mutex_unlock(&users_guard);
-
-	free(user);
-}
-
-/** Find user by service id and increments reference counter.
- *
- * @param id Location service id of the telnet user's terminal.
- */
-telnet_user_t *telnet_user_get_for_client_connection(service_id_t id)
-{
-	telnet_user_t *user = NULL;
-
-	fibril_mutex_lock(&users_guard);
-	list_foreach(users, link, telnet_user_t, tmp) {
-		if (tmp->service_id == id) {
-			user = tmp;
-			break;
-		}
-	}
-	if (user == NULL) {
-		fibril_mutex_unlock(&users_guard);
-		return NULL;
-	}
-
-	telnet_user_t *tmp = user;
-	fibril_mutex_lock(&tmp->recv_lock);
-	user->locsrv_connection_count++;
-
-	/*
-	 * Refuse to return user whose task already finished or when
-	 * the socket is already closed().
-	 */
-	if (user->task_finished || user->socket_closed) {
-		user = NULL;
-		user->locsrv_connection_count--;
-	}
-
-	fibril_mutex_unlock(&tmp->recv_lock);
-
-	fibril_mutex_unlock(&users_guard);
-
-	return user;
-}
-
-/** Notify that client disconnected from the remote terminal.
- *
- * @param user To which user the client was connected.
- */
-void telnet_user_notify_client_disconnected(telnet_user_t *user)
-{
-	fibril_mutex_lock(&user->recv_lock);
-	assert(user->locsrv_connection_count > 0);
-	user->locsrv_connection_count--;
-	fibril_condvar_signal(&user->refcount_cv);
-	fibril_mutex_unlock(&user->recv_lock);
-}
-
-/** Tell whether the launched task already exited and socket is already closed.
- *
- * @param user Telnet user in question.
- */
-bool telnet_user_is_zombie(telnet_user_t *user)
-{
-	fibril_mutex_lock(&user->recv_lock);
-	bool zombie = user->socket_closed || user->task_finished;
-	fibril_mutex_unlock(&user->recv_lock);
-
-	return zombie;
-}
-
-static errno_t telnet_user_fill_recv_buf(telnet_user_t *user)
-{
-	errno_t rc;
-	size_t recv_length;
-
-	rc = tcp_conn_recv_wait(user->conn, user->socket_buffer,
-	    BUFFER_SIZE, &recv_length);
-	if (rc != EOK)
-		return rc;
-
-	if (recv_length == 0) {
-		user->socket_closed = true;
-		user->srvs.aborted = true;
-		return ENOENT;
-	}
-
-	user->socket_buffer_len = recv_length;
-	user->socket_buffer_pos = 0;
-
-	return EOK;
-}
-
-/** Receive next byte from a socket (use buffering).
- *
- * @param user Telnet user
- * @param byte Place to store the received byte
- * @return EOK on success or an error code
- */
-static errno_t telnet_user_recv_next_byte_locked(telnet_user_t *user,
-    uint8_t *byte)
-{
-	errno_t rc;
-
-	/* No more buffered data? */
-	if (user->socket_buffer_len <= user->socket_buffer_pos) {
-		rc = telnet_user_fill_recv_buf(user);
-		if (rc != EOK)
-			return rc;
-	}
-
-	*byte = (uint8_t)user->socket_buffer[user->socket_buffer_pos++];
-	return EOK;
-}
-
-/** Determine if a received byte is available without waiting.
- *
- * @param user Telnet user
- * @return @c true iff a byte is currently available
- */
-static bool telnet_user_byte_avail(telnet_user_t *user)
-{
-	return user->socket_buffer_len > user->socket_buffer_pos;
-}
-
-static errno_t telnet_user_send_opt(telnet_user_t *user, telnet_cmd_t cmd,
-    telnet_cmd_t opt)
-{
-	uint8_t cmdb[3];
-
-	cmdb[0] = TELNET_IAC;
-	cmdb[1] = cmd;
-	cmdb[2] = opt;
-
-	return telnet_user_send_raw_locked(user, (char *)cmdb, sizeof(cmdb));
-}
-
-/** Process telnet WILL NAWS command.
- *
- * @param user Telnet user structure.
- * @param cmd Telnet command.
- */
-static void process_telnet_will_naws(telnet_user_t *user)
-{
-	telnet_user_log(user, "WILL NAWS");
-	/* Send DO NAWS */
-	(void) telnet_user_send_opt(user, TELNET_DO, TELNET_NAWS);
-	(void) telnet_user_flush_locked(user);
-}
-
-/** Process telnet SB NAWS command.
- *
- * @param user Telnet user structure.
- * @param cmd Telnet command.
- */
-static void process_telnet_sb_naws(telnet_user_t *user)
-{
-	uint8_t chi, clo;
-	uint8_t rhi, rlo;
-	uint16_t cols;
-	uint16_t rows;
-	uint8_t iac;
-	uint8_t se;
-	errno_t rc;
-
-	telnet_user_log(user, "SB NAWS...");
-
-	rc = telnet_user_recv_next_byte_locked(user, &chi);
-	if (rc != EOK)
-		return;
-	rc = telnet_user_recv_next_byte_locked(user, &clo);
-	if (rc != EOK)
-		return;
-
-	rc = telnet_user_recv_next_byte_locked(user, &rhi);
-	if (rc != EOK)
-		return;
-	rc = telnet_user_recv_next_byte_locked(user, &rlo);
-	if (rc != EOK)
-		return;
-
-	rc = telnet_user_recv_next_byte_locked(user, &iac);
-	if (rc != EOK)
-		return;
-	rc = telnet_user_recv_next_byte_locked(user, &se);
-	if (rc != EOK)
-		return;
-
-	cols = (chi << 8) | clo;
-	rows = (rhi << 8) | rlo;
-
-	telnet_user_log(user, "cols=%u rows=%u\n", cols, rows);
-
-	if (cols < 1 || rows < 1) {
-		telnet_user_log(user, "Ignoring invalid window size update.");
-		return;
-	}
-
-	user->cb->ws_update(user->arg, cols, rows);
-}
-
-/** Process telnet WILL command.
- *
- * @param user Telnet user structure.
- * @param opt Option code.
- */
-static void process_telnet_will(telnet_user_t *user, telnet_cmd_t opt)
-{
-	telnet_user_log(user, "WILL");
-	switch (opt) {
-	case TELNET_NAWS:
-		process_telnet_will_naws(user);
-		return;
-	}
-
-	telnet_user_log(user, "Ignoring telnet command %u %u %u.",
-	    TELNET_IAC, TELNET_WILL, opt);
-}
-
-/** Process telnet SB command.
- *
- * @param user Telnet user structure.
- * @param opt Option code.
- */
-static void process_telnet_sb(telnet_user_t *user, telnet_cmd_t opt)
-{
-	telnet_user_log(user, "SB");
-	switch (opt) {
-	case TELNET_NAWS:
-		process_telnet_sb_naws(user);
-		return;
-	}
-
-	telnet_user_log(user, "Ignoring telnet command %u %u %u.",
-	    TELNET_IAC, TELNET_SB, opt);
-}
-
-/** Process telnet command.
- *
- * @param user Telnet user structure.
- * @param option_code Command option code.
- * @param cmd Telnet command.
- */
-static void process_telnet_command(telnet_user_t *user,
-    telnet_cmd_t option_code, telnet_cmd_t cmd)
-{
-	switch (option_code) {
-	case TELNET_SB:
-		process_telnet_sb(user, cmd);
-		return;
-	case TELNET_WILL:
-		process_telnet_will(user, cmd);
-		return;
-	}
-
-	if (option_code != 0) {
-		telnet_user_log(user, "Ignoring telnet command %u %u %u.",
-		    TELNET_IAC, option_code, cmd);
-	} else {
-		telnet_user_log(user, "Ignoring telnet command %u %u.",
-		    TELNET_IAC, cmd);
-	}
-}
-
-/** Receive data from telnet connection.
- *
- * @param user Telnet user.
- * @param buf Destination buffer
- * @param size Buffer size
- * @param nread Place to store number of bytes read (>0 on success)
- * @return EOK on success or an error code
- */
-errno_t telnet_user_recv(telnet_user_t *user, void *buf, size_t size,
-    size_t *nread)
-{
-	uint8_t *bp = (uint8_t *)buf;
-	fibril_mutex_lock(&user->recv_lock);
-
-	assert(size > 0);
-	*nread = 0;
-
-	do {
-		uint8_t next_byte = 0;
-		bool inside_telnet_command = false;
-
-		telnet_cmd_t telnet_option_code = 0;
-
-		/* Skip zeros, bail-out on error. */
-		do {
-			errno_t rc = telnet_user_recv_next_byte_locked(user,
-			    &next_byte);
-			if (rc != EOK) {
-				fibril_mutex_unlock(&user->recv_lock);
-				return rc;
-			}
-			uint8_t byte = next_byte;
-
-			/* Skip telnet commands. */
-			if (inside_telnet_command) {
-				inside_telnet_command = false;
-				next_byte = 0;
-				if (TELNET_IS_OPTION_CODE(byte) ||
-				    byte == TELNET_SB) {
-					telnet_option_code = byte;
-					inside_telnet_command = true;
-				} else {
-					process_telnet_command(user,
-					    telnet_option_code, byte);
-				}
-			}
-			if (byte == TELNET_IAC) {
-				inside_telnet_command = true;
-				next_byte = 0;
-			}
-		} while (next_byte == 0 && telnet_user_byte_avail(user));
-
-		/* CR-LF conversions. */
-		if (next_byte == 13) {
-			next_byte = 10;
-		}
-
-		if (next_byte != 0) {
-			*bp++ = next_byte;
-			++*nread;
-			--size;
-		}
-	} while (size > 0 && (telnet_user_byte_avail(user) || *nread == 0));
-
-	fibril_mutex_unlock(&user->recv_lock);
-	return EOK;
-}
-
-static errno_t telnet_user_send_raw_locked(telnet_user_t *user,
-    const void *data, size_t size)
-{
-	size_t remain;
-	size_t now;
-	errno_t rc;
-
-	remain = sizeof(user->send_buf) - user->send_buf_used;
-	while (size > 0) {
-		if (remain == 0) {
-			rc = tcp_conn_send(user->conn, user->send_buf,
-			    sizeof(user->send_buf));
-			if (rc != EOK)
-				return rc;
-
-			user->send_buf_used = 0;
-			remain = sizeof(user->send_buf);
-		}
-
-		now = min(remain, size);
-		memcpy(user->send_buf + user->send_buf_used, data, now);
-		user->send_buf_used += now;
-		remain -= now;
-		data += now;
-		size -= now;
-	}
-
-	return EOK;
-}
-
-/** Send data (convert them first) to the socket, no locking.
- *
- * @param user Telnet user.
- * @param data Data buffer (not zero terminated).
- * @param size Size of @p data buffer in bytes.
- */
-static errno_t telnet_user_send_data_locked(telnet_user_t *user,
-    const char *data, size_t size)
-{
-	uint8_t *converted = malloc(3 * size + 1);
-	assert(converted);
-	int converted_size = 0;
-
-	/* Convert new-lines. */
-	for (size_t i = 0; i < size; i++) {
-		if (data[i] == 10) {
-			converted[converted_size++] = 13;
-			converted[converted_size++] = 10;
-			user->cursor_x = 0;
-			if (user->cursor_y < (int)user->rows - 1)
-				++user->cursor_y;
-		} else {
-			converted[converted_size++] = data[i];
-			if (data[i] == '\b') {
-				user->cursor_x--;
-			} else {
-				user->cursor_x++;
-			}
-		}
-	}
-
-	errno_t rc = telnet_user_send_raw_locked(user, converted,
-	    converted_size);
-	free(converted);
-
-	return rc;
-}
-
-/** Send data (convert them first) to the socket.
- *
- * @param user Telnet user.
- * @param data Data buffer (not zero terminated).
- * @param size Size of @p data buffer in bytes.
- */
-errno_t telnet_user_send_data(telnet_user_t *user, const char *data,
-    size_t size)
-{
-	fibril_mutex_lock(&user->send_lock);
-
-	errno_t rc = telnet_user_send_data_locked(user, data, size);
-
-	fibril_mutex_unlock(&user->send_lock);
-
-	return rc;
-}
-
-/** Send raw non-printable data to the socket.
- *
- * @param user Telnet user.
- * @param data Data buffer (not zero terminated).
- * @param size Size of @p data buffer in bytes.
- */
-errno_t telnet_user_send_raw(telnet_user_t *user, const char *data,
-    size_t size)
-{
-	fibril_mutex_lock(&user->send_lock);
-
-	errno_t rc = telnet_user_send_raw_locked(user, data, size);
-
-	fibril_mutex_unlock(&user->send_lock);
-
-	return rc;
-}
-
-static errno_t telnet_user_flush_locked(telnet_user_t *user)
-{
-	errno_t rc;
-
-	rc = tcp_conn_send(user->conn, user->send_buf, user->send_buf_used);
-	if (rc != EOK)
-		return rc;
-
-	user->send_buf_used = 0;
-	return EOK;
-}
-
-errno_t telnet_user_flush(telnet_user_t *user)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&user->send_lock);
-	rc = telnet_user_flush_locked(user);
-	fibril_mutex_unlock(&user->send_lock);
-	return rc;
-}
-
-/** Update cursor X position.
- *
- * This call may result in sending control commands over socket.
- *
- * @param user Telnet user.
- * @param new_x New cursor location.
- */
-void telnet_user_update_cursor_x(telnet_user_t *user, int new_x)
-{
-	fibril_mutex_lock(&user->send_lock);
-	if (user->cursor_x - 1 == new_x) {
-		char data = '\b';
-		/* Ignore errors. */
-		telnet_user_send_data_locked(user, &data, 1);
-	}
-	user->cursor_x = new_x;
-	fibril_mutex_unlock(&user->send_lock);
-
-}
-
-/** Resize telnet session.
- *
- * @param user Telnet user
- * @param cols New number of columns
- * @param rows New number of rows
- */
-void telnet_user_resize(telnet_user_t *user, unsigned cols, unsigned rows)
-{
-	user->cols = cols;
-	user->rows = rows;
-	if ((unsigned)user->cursor_x > cols - 1)
-		user->cursor_x = cols - 1;
-	if ((unsigned)user->cursor_y > rows - 1)
-		user->cursor_y = rows - 1;
-}
-
-/**
- * @}
- */
Index: pace/srv/hid/remcons/user.h
===================================================================
--- uspace/srv/hid/remcons/user.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup remcons
- * @{
- */
-/** @file
- */
-
-#ifndef TELNET_USER_H_
-#define TELNET_USER_H_
-
-#include <fibril_synch.h>
-#include <inet/tcp.h>
-#include <inttypes.h>
-#include <io/con_srv.h>
-
-#define BUFFER_SIZE 32
-#define SEND_BUF_SIZE 512
-
-/** Telnet callbacks */
-typedef struct {
-	void (*ws_update)(void *, unsigned, unsigned);
-} telnet_cb_t;
-
-/** Representation of a connected (human) user. */
-typedef struct {
-	/** Synchronize send operations */
-	fibril_mutex_t send_lock;
-	/** Synchronize receive operations */
-	fibril_mutex_t recv_lock;
-	/** Callback functions */
-	telnet_cb_t *cb;
-	/** Argument to callback functions */
-	void *arg;
-
-	/** Internal id, used for creating locfs entries. */
-	int id;
-	/** Associated connection. */
-	tcp_conn_t *conn;
-	/** Location service id assigned to the virtual terminal. */
-	service_id_t service_id;
-	/** Path name of the service. */
-	char *service_name;
-	/** Console service setup */
-	con_srvs_t srvs;
-
-	link_t link;
-	char socket_buffer[BUFFER_SIZE];
-	size_t socket_buffer_len;
-	size_t socket_buffer_pos;
-	char send_buf[SEND_BUF_SIZE];
-	size_t send_buf_used;
-
-	/** Task id of the launched application. */
-	task_id_t task_id;
-
-	/* Reference counting. */
-	fibril_condvar_t refcount_cv;
-	bool task_finished;
-	int locsrv_connection_count;
-	bool socket_closed;
-
-	/** X position of the cursor. */
-	int cursor_x;
-	/** Y position of the cursor. */
-	int cursor_y;
-	/** Total number of columns */
-	unsigned cols;
-	/** Total number of rows */
-	unsigned rows;
-} telnet_user_t;
-
-extern telnet_user_t *telnet_user_create(tcp_conn_t *, telnet_cb_t *, void *);
-extern void telnet_user_add(telnet_user_t *);
-extern void telnet_user_destroy(telnet_user_t *);
-extern telnet_user_t *telnet_user_get_for_client_connection(service_id_t);
-extern bool telnet_user_is_zombie(telnet_user_t *);
-extern void telnet_user_notify_client_disconnected(telnet_user_t *);
-extern errno_t telnet_user_get_next_keyboard_event(telnet_user_t *, kbd_event_t *);
-extern errno_t telnet_user_send_data(telnet_user_t *, const char *, size_t);
-extern errno_t telnet_user_send_raw(telnet_user_t *, const char *, size_t);
-extern errno_t telnet_user_flush(telnet_user_t *);
-extern errno_t telnet_user_recv(telnet_user_t *, void *, size_t, size_t *);
-extern void telnet_user_update_cursor_x(telnet_user_t *, int);
-extern void telnet_user_resize(telnet_user_t *, unsigned, unsigned);
-
-/** Print informational message about connected user. */
-#ifdef CONFIG_DEBUG
-#define telnet_user_log(user, fmt, ...) \
-	printf(NAME " [console %d (%d)]: " fmt "\n", \
-	    user->id, (int) user->service_id, ##__VA_ARGS__)
-#else
-#define telnet_user_log(user, fmt, ...) ((void) 0)
-#endif
-
-/** Print error message associated with connected user. */
-#define telnet_user_error(user, fmt, ...) \
-	fprintf(stderr, NAME " [console %d (%d)]: ERROR: " fmt "\n", \
-	    user->id, (int) user->service_id, ##__VA_ARGS__)
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/hid/rfb/main.c
===================================================================
--- uspace/srv/hid/rfb/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,533 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <ddev/info.h>
-#include <ddev_srv.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <gfx/color.h>
-#include <gfx/context.h>
-#include <gfx/coord.h>
-#include <inttypes.h>
-#include <io/log.h>
-#include <io/pixelmap.h>
-#include <ipcgfx/server.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-
-#include "rfb.h"
-
-#define NAME "rfb"
-
-static errno_t rfb_ddev_get_gc(void *, sysarg_t *, sysarg_t *);
-static errno_t rfb_ddev_get_info(void *, ddev_info_t *);
-
-static errno_t rfb_gc_set_clip_rect(void *, gfx_rect_t *);
-static errno_t rfb_gc_set_color(void *, gfx_color_t *);
-static errno_t rfb_gc_fill_rect(void *, gfx_rect_t *);
-static errno_t rfb_gc_bitmap_create(void *, gfx_bitmap_params_t *,
-    gfx_bitmap_alloc_t *, void **);
-static errno_t rfb_gc_bitmap_destroy(void *);
-static errno_t rfb_gc_bitmap_render(void *, gfx_rect_t *, gfx_coord2_t *);
-static errno_t rfb_gc_bitmap_get_alloc(void *, gfx_bitmap_alloc_t *);
-
-static ddev_ops_t rfb_ddev_ops = {
-	.get_gc = rfb_ddev_get_gc,
-	.get_info = rfb_ddev_get_info
-};
-
-typedef struct {
-	rfb_t rfb;
-	pixel_t color;
-	gfx_rect_t rect;
-	gfx_rect_t clip_rect;
-} rfb_gc_t;
-
-typedef struct {
-	rfb_gc_t *rfb;
-	gfx_bitmap_alloc_t alloc;
-	gfx_rect_t rect;
-	gfx_bitmap_flags_t flags;
-	pixel_t key_color;
-	bool myalloc;
-} rfb_bitmap_t;
-
-static gfx_context_ops_t rfb_gc_ops = {
-	.set_clip_rect = rfb_gc_set_clip_rect,
-	.set_color = rfb_gc_set_color,
-	.fill_rect = rfb_gc_fill_rect,
-	.bitmap_create = rfb_gc_bitmap_create,
-	.bitmap_destroy = rfb_gc_bitmap_destroy,
-	.bitmap_render = rfb_gc_bitmap_render,
-	.bitmap_get_alloc = rfb_gc_bitmap_get_alloc
-};
-
-static void rfb_gc_invalidate_rect(rfb_gc_t *rfbgc, gfx_rect_t *rect)
-{
-	rfb_t *rfb = &rfbgc->rfb;
-	gfx_rect_t old_rect;
-	gfx_rect_t new_rect;
-
-	if (gfx_rect_is_empty(rect))
-		return;
-
-	if (!rfb->damage_valid) {
-		old_rect.p0.x = old_rect.p0.y = 0;
-		old_rect.p1.x = old_rect.p1.y = 0;
-	} else {
-		old_rect.p0.x = rfb->damage_rect.x;
-		old_rect.p0.y = rfb->damage_rect.y;
-		old_rect.p1.x = rfb->damage_rect.x + rfb->damage_rect.width;
-		old_rect.p1.y = rfb->damage_rect.y + rfb->damage_rect.height;
-	}
-
-	gfx_rect_envelope(&old_rect, rect, &new_rect);
-
-	rfb->damage_rect.x = new_rect.p0.x;
-	rfb->damage_rect.y = new_rect.p0.y;
-	rfb->damage_rect.width = new_rect.p1.x - new_rect.p0.x;
-	rfb->damage_rect.height = new_rect.p1.y - new_rect.p0.y;
-}
-
-static errno_t rfb_ddev_get_gc(void *arg, sysarg_t *arg2, sysarg_t *arg3)
-{
-	*arg2 = 0;
-	*arg3 = 42;
-	return EOK;
-}
-
-static errno_t rfb_ddev_get_info(void *arg, ddev_info_t *info)
-{
-	rfb_t *rfb = (rfb_t *) arg;
-
-	ddev_info_init(info);
-
-	info->rect.p0.x = 0;
-	info->rect.p0.y = 0;
-	info->rect.p1.x = rfb->width;
-	info->rect.p1.y = rfb->height;
-
-	return EOK;
-}
-
-/** Create RFB GC.
- *
- * @param rrgb Place to store pointer to new RFB GC
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t rgb_gc_create(rfb_gc_t **rrfb)
-{
-	rfb_gc_t *rfb;
-
-	rfb = calloc(1, sizeof(rfb_gc_t));
-	if (rfb == NULL)
-		return ENOMEM;
-
-	*rrfb = rfb;
-	return EOK;
-}
-
-/** Destroy RFB GC.
- *
- * @param rfb RFB GC
- */
-static void rfb_gc_destroy(rfb_gc_t *rfb)
-{
-	free(rfb);
-}
-
-/** Set clipping rectangle on RFB.
- *
- * @param arg RFB
- * @param rect Rectangle or @c NULL
- *
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_set_clip_rect(void *arg, gfx_rect_t *rect)
-{
-	rfb_gc_t *rfb = (rfb_gc_t *) arg;
-
-	if (rect != NULL)
-		gfx_rect_clip(rect, &rfb->rect, &rfb->clip_rect);
-	else
-		rfb->clip_rect = rfb->rect;
-
-	return EOK;
-}
-
-/** Set color on RFB.
- *
- * Set drawing color on RFB GC.
- *
- * @param arg RFB
- * @param color Color
- *
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_set_color(void *arg, gfx_color_t *color)
-{
-	rfb_gc_t *rfb = (rfb_gc_t *) arg;
-	uint16_t r, g, b;
-
-	gfx_color_get_rgb_i16(color, &r, &g, &b);
-	rfb->color = PIXEL(0, r >> 8, g >> 8, b >> 8);
-	return EOK;
-}
-
-/** Fill rectangle on RFB.
- *
- * @param arg RFB
- * @param rect Rectangle
- *
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_fill_rect(void *arg, gfx_rect_t *rect)
-{
-	rfb_gc_t *rfb = (rfb_gc_t *) arg;
-	gfx_rect_t crect;
-	gfx_coord_t x, y;
-
-	gfx_rect_clip(rect, &rfb->clip_rect, &crect);
-
-	for (y = crect.p0.y; y < crect.p1.y; y++) {
-		for (x = crect.p0.x; x < crect.p1.x; x++) {
-			pixelmap_put_pixel(&rfb->rfb.framebuffer, x, y,
-			    rfb->color);
-		}
-	}
-
-	rfb_gc_invalidate_rect(rfb, &crect);
-
-	return EOK;
-}
-
-/** Create bitmap in RFB GC.
- *
- * @param arg RFB
- * @param params Bitmap params
- * @param alloc Bitmap allocation info or @c NULL
- * @param rbm Place to store pointer to new bitmap
- * @return EOK on success or an error code
- */
-errno_t rfb_gc_bitmap_create(void *arg, gfx_bitmap_params_t *params,
-    gfx_bitmap_alloc_t *alloc, void **rbm)
-{
-	rfb_gc_t *rfb = (rfb_gc_t *) arg;
-	rfb_bitmap_t *rfbbm = NULL;
-	gfx_coord2_t dim;
-	errno_t rc;
-
-	/* Check that we support all required flags */
-	if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0)
-		return ENOTSUP;
-
-	rfbbm = calloc(1, sizeof(rfb_bitmap_t));
-	if (rfbbm == NULL)
-		return ENOMEM;
-
-	gfx_coord2_subtract(&params->rect.p1, &params->rect.p0, &dim);
-	rfbbm->rect = params->rect;
-	rfbbm->flags = params->flags;
-	rfbbm->key_color = params->key_color;
-
-	if (alloc == NULL) {
-		rfbbm->alloc.pitch = dim.x * sizeof(uint32_t);
-		rfbbm->alloc.off0 = 0;
-		rfbbm->alloc.pixels = malloc(rfbbm->alloc.pitch * dim.y);
-		rfbbm->myalloc = true;
-
-		if (rfbbm->alloc.pixels == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-	} else {
-		rfbbm->alloc = *alloc;
-	}
-
-	rfbbm->rfb = rfb;
-	*rbm = (void *)rfbbm;
-	return EOK;
-error:
-	if (rbm != NULL)
-		free(rfbbm);
-	return rc;
-}
-
-/** Destroy bitmap in RFB GC.
- *
- * @param bm Bitmap
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_bitmap_destroy(void *bm)
-{
-	rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm;
-	if (rfbbm->myalloc)
-		free(rfbbm->alloc.pixels);
-	free(rfbbm);
-	return EOK;
-}
-
-/** Render bitmap in RFB GC.
- *
- * @param bm Bitmap
- * @param srect0 Source rectangle or @c NULL
- * @param offs0 Offset or @c NULL
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_bitmap_render(void *bm, gfx_rect_t *srect0,
-    gfx_coord2_t *offs0)
-{
-	rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm;
-	gfx_rect_t srect;
-	gfx_rect_t drect;
-	gfx_rect_t crect;
-	gfx_coord2_t offs;
-	gfx_coord2_t bmdim;
-	gfx_coord2_t dim;
-	gfx_coord_t x, y;
-	pixelmap_t pbm;
-	pixel_t color;
-
-	if (srect0 != NULL)
-		srect = *srect0;
-	else
-		srect = rfbbm->rect;
-
-	if (offs0 != NULL) {
-		offs = *offs0;
-	} else {
-		offs.x = 0;
-		offs.y = 0;
-	}
-
-	/* Destination rectangle */
-	gfx_rect_translate(&offs, &srect, &drect);
-	gfx_rect_clip(&drect, &rfbbm->rfb->clip_rect, &crect);
-	gfx_coord2_subtract(&crect.p1, &crect.p0, &dim);
-	gfx_coord2_subtract(&rfbbm->rect.p1, &rfbbm->rect.p0, &bmdim);
-
-	pbm.width = bmdim.x;
-	pbm.height = bmdim.y;
-	pbm.data = rfbbm->alloc.pixels;
-
-	if ((rfbbm->flags & bmpf_color_key) == 0) {
-		/* Simple copy */
-		for (y = srect.p0.y; y < srect.p1.y; y++) {
-			for (x = srect.p0.x; x < srect.p1.x; x++) {
-				color = pixelmap_get_pixel(&pbm, x, y);
-				pixelmap_put_pixel(&rfbbm->rfb->rfb.framebuffer,
-				    x + offs.x, y + offs.y, color);
-			}
-		}
-	} else if ((rfbbm->flags & bmpf_colorize) == 0) {
-		/* Color key */
-		for (y = srect.p0.y; y < srect.p1.y; y++) {
-			for (x = srect.p0.x; x < srect.p1.x; x++) {
-				color = pixelmap_get_pixel(&pbm, x, y);
-				if (color != rfbbm->key_color) {
-					pixelmap_put_pixel(&rfbbm->rfb->rfb.framebuffer,
-					    x + offs.x, y + offs.y, color);
-				}
-			}
-		}
-	} else {
-		/* Color key & colorization */
-		for (y = srect.p0.y; y < srect.p1.y; y++) {
-			for (x = srect.p0.x; x < srect.p1.x; x++) {
-				color = pixelmap_get_pixel(&pbm, x, y);
-				if (color != rfbbm->key_color) {
-					pixelmap_put_pixel(&rfbbm->rfb->rfb.framebuffer,
-					    x + offs.x, y + offs.y,
-					    rfbbm->rfb->color);
-				}
-			}
-		}
-	}
-
-	rfb_gc_invalidate_rect(rfbbm->rfb, &crect);
-
-	return EOK;
-}
-
-/** Get allocation info for bitmap in RFB GC.
- *
- * @param bm Bitmap
- * @param alloc Place to store allocation info
- * @return EOK on success or an error code
- */
-static errno_t rfb_gc_bitmap_get_alloc(void *bm, gfx_bitmap_alloc_t *alloc)
-{
-	rfb_bitmap_t *rfbbm = (rfb_bitmap_t *)bm;
-	*alloc = rfbbm->alloc;
-	return EOK;
-}
-
-static void syntax_print(void)
-{
-	fprintf(stderr, "Usage: %s <name> <width> <height> [port]\n", NAME);
-}
-
-static void client_connection(ipc_call_t *icall, void *arg)
-{
-	rfb_t *rfb = (rfb_t *) arg;
-	rfb_gc_t *rfbgc;
-	ddev_srv_t srv;
-	sysarg_t svc_id;
-	gfx_context_t *gc;
-	errno_t rc;
-
-	svc_id = ipc_get_arg2(icall);
-
-	if (svc_id != 0) {
-		/* Set up protocol structure */
-		ddev_srv_initialize(&srv);
-		srv.ops = &rfb_ddev_ops;
-		srv.arg = (void *) rfb;
-
-		/* Handle connection */
-		ddev_conn(icall, &srv);
-	} else {
-		rc = rgb_gc_create(&rfbgc);
-		if (rc != EOK) {
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		rfbgc->rect.p0.x = 0;
-		rfbgc->rect.p0.y = 0;
-		rfbgc->rect.p1.x = rfb->width;
-		rfbgc->rect.p1.y = rfb->height;
-		rfbgc->clip_rect = rfbgc->rect;
-
-		rc = gfx_context_new(&rfb_gc_ops, (void *) rfbgc, &gc);
-		if (rc != EOK) {
-			rfb_gc_destroy(rfbgc);
-			async_answer_0(icall, ENOMEM);
-			return;
-		}
-
-		/* GC connection */
-		gc_conn(icall, gc);
-	}
-}
-
-int main(int argc, char **argv)
-{
-	rfb_t rfb;
-	loc_srv_t *srv;
-
-	log_init(NAME);
-
-	if (argc <= 3) {
-		syntax_print();
-		return 1;
-	}
-
-	const char *rfb_name = argv[1];
-
-	char *endptr;
-	unsigned long width = strtoul(argv[2], &endptr, 0);
-	if (*endptr != 0) {
-		fprintf(stderr, "Invalid width\n");
-		syntax_print();
-		return 1;
-	}
-
-	unsigned long height = strtoul(argv[3], &endptr, 0);
-	if (*endptr != 0) {
-		fprintf(stderr, "Invalid height\n");
-		syntax_print();
-		return 1;
-	}
-
-	unsigned long port = 5900;
-	if (argc > 4) {
-		port = strtoul(argv[4], &endptr, 0);
-		if (*endptr != 0) {
-			fprintf(stderr, "Invalid port number\n");
-			syntax_print();
-			return 1;
-		}
-	}
-
-	rfb_init(&rfb, width, height, rfb_name);
-
-	async_set_fallback_port_handler(client_connection, &rfb);
-
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register server.\n", NAME);
-		return rc;
-	}
-
-	char *service_name;
-	rc = asprintf(&service_name, "rfb/%s", rfb_name);
-	if (rc < 0) {
-		printf(NAME ": Unable to create service name\n");
-		return rc;
-	}
-
-	service_id_t service_id;
-
-	rc = loc_service_register(srv, service_name, &service_id);
-	if (rc != EOK) {
-		printf(NAME ": Unable to register service %s.\n", service_name);
-		return rc;
-	}
-
-	free(service_name);
-
-	category_id_t ddev_cid;
-	rc = loc_category_get_id("display-device", &ddev_cid, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		fprintf(stderr, NAME ": Unable to get display device category id.\n");
-		return 1;
-	}
-
-	rc = loc_service_add_to_cat(srv, service_id, ddev_cid);
-	if (rc != EOK) {
-		fprintf(stderr, NAME ": Unable to add service to display device category.\n");
-		return 1;
-	}
-
-	rc = rfb_listen(&rfb, port);
-	if (rc != EOK) {
-		fprintf(stderr, NAME ": Unable to listen at rfb port\n");
-		return 2;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
Index: pace/srv/hid/rfb/meson.build
===================================================================
--- uspace/srv/hid/rfb/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# Copyright (c) 2013 Martin Sucha
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'ipcgfx', 'ddev' ]
-src = files('main.c', 'rfb.c')
Index: pace/srv/hid/rfb/rfb.c
===================================================================
--- uspace/srv/hid/rfb/rfb.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,832 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/tcp.h>
-#include <inttypes.h>
-#include <str.h>
-#include <str_error.h>
-#include <byteorder.h>
-#include <macros.h>
-#include <io/log.h>
-
-#include "rfb.h"
-
-static void rfb_new_conn(tcp_listener_t *, tcp_conn_t *);
-
-static tcp_listen_cb_t listen_cb = {
-	.new_conn = rfb_new_conn
-};
-
-static tcp_cb_t conn_cb = {
-	.connected = NULL
-};
-
-/** Buffer for receiving the request. */
-#define BUFFER_SIZE  1024
-
-static char rbuf[BUFFER_SIZE];
-static size_t rbuf_out;
-static size_t rbuf_in;
-
-/** Receive one character (with buffering) */
-static errno_t recv_char(tcp_conn_t *conn, char *c)
-{
-	size_t nrecv;
-	errno_t rc;
-
-	if (rbuf_out == rbuf_in) {
-		rbuf_out = 0;
-		rbuf_in = 0;
-
-		rc = tcp_conn_recv_wait(conn, rbuf, BUFFER_SIZE, &nrecv);
-		if (rc != EOK)
-			return rc;
-
-		rbuf_in = nrecv;
-	}
-
-	*c = rbuf[rbuf_out++];
-	return EOK;
-}
-
-/** Receive count characters (with buffering) */
-static errno_t __attribute__((warn_unused_result))
-recv_chars(tcp_conn_t *conn, char *c, size_t count)
-{
-	for (size_t i = 0; i < count; i++) {
-		errno_t rc = recv_char(conn, c);
-		if (rc != EOK)
-			return rc;
-		c++;
-	}
-	return EOK;
-}
-
-static errno_t recv_skip_chars(tcp_conn_t *conn, size_t count)
-{
-	for (size_t i = 0; i < count; i++) {
-		char c;
-		errno_t rc = recv_char(conn, &c);
-		if (rc != EOK)
-			return rc;
-	}
-	return EOK;
-}
-
-static void rfb_pixel_format_to_be(rfb_pixel_format_t *src, rfb_pixel_format_t *dst)
-{
-	dst->r_max = host2uint16_t_be(src->r_max);
-	dst->g_max = host2uint16_t_be(src->g_max);
-	dst->b_max = host2uint16_t_be(src->b_max);
-}
-
-static void rfb_pixel_format_to_host(rfb_pixel_format_t *src, rfb_pixel_format_t *dst)
-{
-	dst->r_max = uint16_t_be2host(src->r_max);
-	dst->g_max = uint16_t_be2host(src->g_max);
-	dst->b_max = uint16_t_be2host(src->b_max);
-}
-
-static void rfb_server_init_to_be(rfb_server_init_t *src, rfb_server_init_t *dst)
-{
-	dst->width = host2uint16_t_be(src->width);
-	dst->height = host2uint16_t_be(src->height);
-	rfb_pixel_format_to_be(&src->pixel_format, &dst->pixel_format);
-	dst->name_length = host2uint32_t_be(src->name_length);
-}
-
-static void rfb_set_encodings_to_host(rfb_set_encodings_t *src, rfb_set_encodings_t *dst)
-{
-	dst->count = uint16_t_be2host(src->count);
-}
-
-static void rfb_framebuffer_update_request_to_host(rfb_framebuffer_update_request_t *src,
-    rfb_framebuffer_update_request_t *dst)
-{
-	dst->x = uint16_t_be2host(src->x);
-	dst->y = uint16_t_be2host(src->x);
-	dst->width = uint16_t_be2host(src->width);
-	dst->height = uint16_t_be2host(src->height);
-}
-
-static void rfb_framebuffer_update_to_be(rfb_framebuffer_update_t *src,
-    rfb_framebuffer_update_t *dst)
-{
-	dst->rect_count = host2uint16_t_be(src->rect_count);
-}
-
-static void rfb_rectangle_to_be(rfb_rectangle_t *src, rfb_rectangle_t *dst)
-{
-	dst->x = host2uint16_t_be(src->x);
-	dst->y = host2uint16_t_be(src->y);
-	dst->width = host2uint16_t_be(src->width);
-	dst->height = host2uint16_t_be(src->height);
-	dst->enctype = host2uint32_t_be(src->enctype);
-}
-
-static void rfb_key_event_to_host(rfb_key_event_t *src, rfb_key_event_t *dst)
-{
-	dst->key = uint32_t_be2host(src->key);
-}
-
-static void rfb_pointer_event_to_host(rfb_pointer_event_t *src, rfb_pointer_event_t *dst)
-{
-	dst->x = uint16_t_be2host(src->x);
-	dst->y = uint16_t_be2host(src->y);
-}
-
-static void rfb_client_cut_text_to_host(rfb_client_cut_text_t *src,
-    rfb_client_cut_text_t *dst)
-{
-	dst->length = uint32_t_be2host(src->length);
-}
-
-errno_t rfb_init(rfb_t *rfb, uint16_t width, uint16_t height, const char *name)
-{
-	memset(rfb, 0, sizeof(rfb_t));
-	fibril_mutex_initialize(&rfb->lock);
-
-	rfb_pixel_format_t *pf = &rfb->pixel_format;
-	pf->bpp = 32;
-	pf->depth = 24;
-	pf->big_endian = 1;
-	pf->true_color = 1;
-	pf->r_max = 255;
-	pf->g_max = 255;
-	pf->b_max = 255;
-	pf->r_shift = 0;
-	pf->g_shift = 8;
-	pf->b_shift = 16;
-
-	rfb->name = str_dup(name);
-	rfb->supports_trle = false;
-
-	return rfb_set_size(rfb, width, height);
-}
-
-errno_t rfb_set_size(rfb_t *rfb, uint16_t width, uint16_t height)
-{
-	size_t new_size = width * height * sizeof(pixel_t);
-	void *pixbuf = malloc(new_size);
-	if (pixbuf == NULL)
-		return ENOMEM;
-
-	free(rfb->framebuffer.data);
-	rfb->framebuffer.data = pixbuf;
-	rfb->framebuffer.width = width;
-	rfb->framebuffer.height = height;
-	rfb->width = width;
-	rfb->height = height;
-
-	/* Fill with white */
-	memset(rfb->framebuffer.data, 255, new_size);
-
-	return EOK;
-}
-
-static errno_t __attribute__((warn_unused_result))
-recv_message(tcp_conn_t *conn, char type, void *buf, size_t size)
-{
-	memcpy(buf, &type, 1);
-	return recv_chars(conn, ((char *) buf) + 1, size - 1);
-}
-
-static uint32_t rfb_scale_channel(uint8_t val, uint32_t max)
-{
-	return val * max / 255;
-}
-
-static void rfb_encode_index(rfb_t *rfb, uint8_t *buf, pixel_t pixel)
-{
-	int first_free_index = -1;
-	for (size_t i = 0; i < 256; i++) {
-		bool free = ALPHA(rfb->palette[i]) == 0;
-		if (free && first_free_index == -1) {
-			first_free_index = i;
-		} else if (!free && RED(rfb->palette[i]) == RED(pixel) &&
-		    GREEN(rfb->palette[i]) == GREEN(pixel) &&
-		    BLUE(rfb->palette[i]) == BLUE(pixel)) {
-			*buf = i;
-			return;
-		}
-	}
-
-	if (first_free_index != -1) {
-		rfb->palette[first_free_index] = PIXEL(255, RED(pixel), GREEN(pixel),
-		    BLUE(pixel));
-		rfb->palette_used = max(rfb->palette_used, (unsigned) first_free_index + 1);
-		*buf = first_free_index;
-		return;
-	}
-
-	/* TODO find nearest color index. We are lazy so return index 0 for now */
-	*buf = 0;
-}
-
-static void rfb_encode_true_color(rfb_pixel_format_t *pf, void *buf,
-    pixel_t pixel)
-{
-	uint32_t pix = 0;
-	pix |= rfb_scale_channel(RED(pixel), pf->r_max) << pf->r_shift;
-	pix |= rfb_scale_channel(GREEN(pixel), pf->g_max) << pf->g_shift;
-	pix |= rfb_scale_channel(BLUE(pixel), pf->b_max) << pf->b_shift;
-
-	if (pf->bpp == 8) {
-		uint8_t pix8 = pix;
-		memcpy(buf, &pix8, 1);
-	} else if (pf->bpp == 16) {
-		uint16_t pix16 = pix;
-		if (pf->big_endian) {
-			pix16 = host2uint16_t_be(pix16);
-		} else {
-			pix16 = host2uint16_t_le(pix16);
-		}
-		memcpy(buf, &pix16, 2);
-	} else if (pf->bpp == 32) {
-		if (pf->big_endian) {
-			pix = host2uint32_t_be(pix);
-		} else {
-			pix = host2uint32_t_le(pix);
-		}
-		memcpy(buf, &pix, 4);
-	}
-}
-
-static void rfb_encode_pixel(rfb_t *rfb, void *buf, pixel_t pixel)
-{
-	if (rfb->pixel_format.true_color) {
-		rfb_encode_true_color(&rfb->pixel_format, buf, pixel);
-	} else {
-		rfb_encode_index(rfb, buf, pixel);
-	}
-}
-
-static void rfb_set_color_map_entries_to_be(rfb_set_color_map_entries_t *src,
-    rfb_set_color_map_entries_t *dst)
-{
-	dst->first_color = host2uint16_t_be(src->first_color);
-	dst->color_count = host2uint16_t_be(src->color_count);
-}
-
-static void rfb_color_map_entry_to_be(rfb_color_map_entry_t *src,
-    rfb_color_map_entry_t *dst)
-{
-	dst->red = host2uint16_t_be(src->red);
-	dst->green = host2uint16_t_be(src->green);
-	dst->blue = host2uint16_t_be(src->blue);
-}
-
-static void *rfb_send_palette_message(rfb_t *rfb, size_t *psize)
-{
-	size_t size = sizeof(rfb_set_color_map_entries_t) +
-	    rfb->palette_used * sizeof(rfb_color_map_entry_t);
-
-	void *buf = malloc(size);
-	if (buf == NULL)
-		return NULL;
-
-	void *pos = buf;
-
-	rfb_set_color_map_entries_t *scme = pos;
-	scme->message_type = RFB_SMSG_SET_COLOR_MAP_ENTRIES;
-	scme->first_color = 0;
-	scme->color_count = rfb->palette_used;
-	rfb_set_color_map_entries_to_be(scme, scme);
-	pos += sizeof(rfb_set_color_map_entries_t);
-
-	rfb_color_map_entry_t *entries = pos;
-	for (unsigned i = 0; i < rfb->palette_used; i++) {
-		entries[i].red = 65535 * RED(rfb->palette[i]) / 255;
-		entries[i].green = 65535 * GREEN(rfb->palette[i]) / 255;
-		entries[i].blue = 65535 * BLUE(rfb->palette[i]) / 255;
-		rfb_color_map_entry_to_be(&entries[i], &entries[i]);
-	}
-
-	*psize = size;
-	return buf;
-}
-
-static size_t rfb_rect_encode_raw(rfb_t *rfb, rfb_rectangle_t *rect, void *buf)
-{
-	size_t pixel_size = rfb->pixel_format.bpp / 8;
-	size_t size = (rect->width * rect->height * pixel_size);
-
-	if (buf == NULL)
-		return size;
-
-	for (uint16_t y = 0; y < rect->height; y++) {
-		for (uint16_t x = 0; x < rect->width; x++) {
-			pixel_t pixel = pixelmap_get_pixel(&rfb->framebuffer,
-			    x + rect->x, y + rect->y);
-			rfb_encode_pixel(rfb, buf, pixel);
-			buf += pixel_size;
-		}
-	}
-
-	return size;
-}
-
-typedef enum {
-	COMP_NONE,
-	COMP_SKIP_START,
-	COMP_SKIP_END
-} cpixel_compress_type_t;
-
-typedef struct {
-	size_t size;
-	cpixel_compress_type_t compress_type;
-} cpixel_ctx_t;
-
-static void cpixel_context_init(cpixel_ctx_t *ctx, rfb_pixel_format_t *pixel_format)
-{
-	ctx->size = pixel_format->bpp / 8;
-	ctx->compress_type = COMP_NONE;
-
-	if (pixel_format->bpp == 32 && pixel_format->depth <= 24) {
-		uint32_t mask = 0;
-		mask |= pixel_format->r_max << pixel_format->r_shift;
-		mask |= pixel_format->g_max << pixel_format->g_shift;
-		mask |= pixel_format->b_max << pixel_format->b_shift;
-
-		if (pixel_format->big_endian) {
-			mask = host2uint32_t_be(mask);
-		} else {
-			mask = host2uint32_t_le(mask);
-		}
-
-		uint8_t *mask_data = (uint8_t *) &mask;
-		if (mask_data[0] == 0) {
-			ctx->compress_type = COMP_SKIP_START;
-			ctx->size = 3;
-		} else if (mask_data[3] == 0) {
-			ctx->compress_type = COMP_SKIP_END;
-			ctx->size = 3;
-		}
-	}
-}
-
-static void cpixel_encode(rfb_t *rfb, cpixel_ctx_t *cpixel, void *buf,
-    pixel_t pixel)
-{
-	uint8_t data[4];
-	rfb_encode_pixel(rfb, data, pixel);
-
-	switch (cpixel->compress_type) {
-	case COMP_NONE:
-	case COMP_SKIP_END:
-		memcpy(buf, data, cpixel->size);
-		break;
-	case COMP_SKIP_START:
-		memcpy(buf, data + 1, cpixel->size);
-	}
-}
-
-static size_t rfb_tile_encode_raw(rfb_t *rfb, cpixel_ctx_t *cpixel,
-    rfb_rectangle_t *tile, void *buf)
-{
-	size_t size = tile->width * tile->height * cpixel->size;
-	if (buf == NULL)
-		return size;
-
-	for (uint16_t y = tile->y; y < tile->y + tile->height; y++) {
-		for (uint16_t x = tile->x; x < tile->x + tile->width; x++) {
-			pixel_t pixel = pixelmap_get_pixel(&rfb->framebuffer, x, y);
-			cpixel_encode(rfb, cpixel, buf, pixel);
-		}
-	}
-
-	return size;
-}
-
-static errno_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
-    rfb_rectangle_t *tile, void *buf, size_t *size)
-{
-	/* Check if it is single color */
-	pixel_t the_color = pixelmap_get_pixel(&rfb->framebuffer, tile->x, tile->y);
-	for (uint16_t y = tile->y; y < tile->y + tile->height; y++) {
-		for (uint16_t x = tile->x; x < tile->x + tile->width; x++) {
-			if (pixelmap_get_pixel(&rfb->framebuffer, x, y) != the_color)
-				return EINVAL;
-		}
-	}
-
-	/* OK, encode it */
-	if (buf)
-		cpixel_encode(rfb, cpixel, buf, the_color);
-	*size = cpixel->size;
-	return EOK;
-}
-
-static size_t rfb_rect_encode_trle(rfb_t *rfb, rfb_rectangle_t *rect, void *buf)
-{
-	cpixel_ctx_t cpixel;
-	cpixel_context_init(&cpixel, &rfb->pixel_format);
-
-	size_t size = 0;
-	for (uint16_t y = 0; y < rect->height; y += 16) {
-		for (uint16_t x = 0; x < rect->width; x += 16) {
-			rfb_rectangle_t tile = {
-				.x = x,
-				.y = y,
-				.width = (x + 16 <= rect->width ? 16 : rect->width - x),
-				.height = (y + 16 <= rect->height ? 16 : rect->height - y)
-			};
-
-			size += 1;
-			uint8_t *tile_enctype_ptr = buf;
-			if (buf)
-				buf +=  1;
-
-			uint8_t tile_enctype = RFB_TILE_ENCODING_SOLID;
-			size_t tile_size;
-			errno_t rc = rfb_tile_encode_solid(rfb, &cpixel, &tile, buf,
-			    &tile_size);
-			if (rc != EOK) {
-				tile_size = rfb_tile_encode_raw(rfb, &cpixel, &tile, buf);
-				tile_enctype = RFB_TILE_ENCODING_RAW;
-			}
-
-			if (buf) {
-				*tile_enctype_ptr = tile_enctype;
-				buf += tile_size;
-			}
-		}
-	}
-	return size;
-}
-
-static errno_t rfb_send_framebuffer_update(rfb_t *rfb, tcp_conn_t *conn,
-    bool incremental)
-{
-	fibril_mutex_lock(&rfb->lock);
-	if (!incremental || !rfb->damage_valid) {
-		rfb->damage_rect.x = 0;
-		rfb->damage_rect.y = 0;
-		rfb->damage_rect.width = rfb->width;
-		rfb->damage_rect.height = rfb->height;
-	}
-
-	/* We send only single raw rectangle right now */
-	size_t buf_size = sizeof(rfb_framebuffer_update_t) +
-	    sizeof(rfb_rectangle_t) * 1 +
-	    rfb_rect_encode_raw(rfb, &rfb->damage_rect, NULL);
-
-	void *buf = malloc(buf_size);
-	if (buf == NULL) {
-		fibril_mutex_unlock(&rfb->lock);
-		return ENOMEM;
-	}
-	memset(buf, 0, buf_size);
-
-	void *pos = buf;
-	rfb_framebuffer_update_t *fbu = buf;
-	fbu->message_type = RFB_SMSG_FRAMEBUFFER_UPDATE;
-	fbu->rect_count = 1;
-	rfb_framebuffer_update_to_be(fbu, fbu);
-	pos += sizeof(rfb_framebuffer_update_t);
-
-	rfb_rectangle_t *rect = pos;
-	pos += sizeof(rfb_rectangle_t);
-
-	*rect = rfb->damage_rect;
-
-	if (rfb->supports_trle) {
-		rect->enctype = RFB_ENCODING_TRLE;
-		pos += rfb_rect_encode_trle(rfb, rect, pos);
-	} else {
-		rect->enctype = RFB_ENCODING_RAW;
-		pos += rfb_rect_encode_raw(rfb, rect, pos);
-	}
-	rfb_rectangle_to_be(rect, rect);
-
-	rfb->damage_valid = false;
-
-	size_t send_palette_size = 0;
-	void *send_palette = NULL;
-
-	if (!rfb->pixel_format.true_color) {
-		send_palette = rfb_send_palette_message(rfb, &send_palette_size);
-		if (send_palette == NULL) {
-			free(buf);
-			fibril_mutex_unlock(&rfb->lock);
-			return ENOMEM;
-		}
-	}
-
-	fibril_mutex_unlock(&rfb->lock);
-
-	if (!rfb->pixel_format.true_color) {
-		errno_t rc = tcp_conn_send(conn, send_palette, send_palette_size);
-		if (rc != EOK) {
-			free(buf);
-			return rc;
-		}
-	}
-
-	errno_t rc = tcp_conn_send(conn, buf, buf_size);
-	free(buf);
-
-	return rc;
-}
-
-static errno_t rfb_set_pixel_format(rfb_t *rfb, rfb_pixel_format_t *pixel_format)
-{
-	rfb->pixel_format = *pixel_format;
-	if (rfb->pixel_format.true_color) {
-		free(rfb->palette);
-		rfb->palette = NULL;
-		rfb->palette_used = 0;
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "changed pixel format to %d-bit true color (%x<<%d, %x<<%d, %x<<%d)",
-		    pixel_format->depth, pixel_format->r_max, pixel_format->r_shift,
-		    pixel_format->g_max, pixel_format->g_shift, pixel_format->b_max,
-		    pixel_format->b_shift);
-	} else {
-		if (rfb->palette == NULL) {
-			rfb->palette = malloc(sizeof(pixel_t) * 256);
-			if (rfb->palette == NULL)
-				return ENOMEM;
-			memset(rfb->palette, 0, sizeof(pixel_t) * 256);
-			rfb->palette_used = 0;
-		}
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "changed pixel format to %d-bit palette",
-		    pixel_format->depth);
-	}
-	return EOK;
-}
-
-static void rfb_socket_connection(rfb_t *rfb, tcp_conn_t *conn)
-{
-	/* Version handshake */
-	errno_t rc = tcp_conn_send(conn, "RFB 003.008\n", 12);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server version: %s",
-		    str_error(rc));
-		return;
-	}
-
-	char client_version[12];
-	rc = recv_chars(conn, client_version, 12);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client version: %s",
-		    str_error(rc));
-		return;
-	}
-
-	if (memcmp(client_version, "RFB 003.008\n", 12) != 0) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Client version is not RFB 3.8");
-		return;
-	}
-
-	/*
-	 * Security handshake
-	 * 1 security type supported, which is 1 - None
-	 */
-	char sec_types[2];
-	sec_types[0] = 1; /* length */
-	sec_types[1] = RFB_SECURITY_NONE;
-	rc = tcp_conn_send(conn, sec_types, 2);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN,
-		    "Failed sending security handshake: %s", str_error(rc));
-		return;
-	}
-
-	char selected_sec_type = 0;
-	rc = recv_char(conn, &selected_sec_type);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving security type: %s",
-		    str_error(rc));
-		return;
-	}
-	if (selected_sec_type != RFB_SECURITY_NONE) {
-		log_msg(LOG_DEFAULT, LVL_WARN,
-		    "Client selected security type other than none");
-		return;
-	}
-	uint32_t security_result = RFB_SECURITY_HANDSHAKE_OK;
-	rc = tcp_conn_send(conn, &security_result, sizeof(uint32_t));
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending security result: %s",
-		    str_error(rc));
-		return;
-	}
-
-	/* Client init */
-	char shared_flag;
-	rc = recv_char(conn, &shared_flag);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed receiving client init: %s",
-		    str_error(rc));
-		return;
-	}
-
-	/* Server init */
-	fibril_mutex_lock(&rfb->lock);
-	size_t name_length = str_length(rfb->name);
-	size_t msg_length = sizeof(rfb_server_init_t) + name_length;
-	rfb_server_init_t *server_init = malloc(msg_length);
-	if (server_init == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Cannot allocate memory for server init");
-		fibril_mutex_unlock(&rfb->lock);
-		return;
-	}
-	server_init->width = rfb->width;
-	server_init->height = rfb->height;
-	server_init->pixel_format = rfb->pixel_format;
-	server_init->name_length = name_length;
-	rfb_server_init_to_be(server_init, server_init);
-	memcpy(server_init->name, rfb->name, name_length);
-	fibril_mutex_unlock(&rfb->lock);
-	rc = tcp_conn_send(conn, server_init, msg_length);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed sending server init: %s",
-		    str_error(rc));
-		return;
-	}
-
-	while (true) {
-		char message_type = 0;
-		rc = recv_char(conn, &message_type);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_WARN,
-			    "Failed receiving client message type: %s",
-			    str_error(rc));
-			return;
-		}
-
-		rfb_set_pixel_format_t spf;
-		rfb_set_encodings_t se;
-		rfb_framebuffer_update_request_t fbur;
-		rfb_key_event_t ke;
-		rfb_pointer_event_t pe;
-		rfb_client_cut_text_t cct;
-		switch (message_type) {
-		case RFB_CMSG_SET_PIXEL_FORMAT:
-			rc = recv_message(conn, message_type, &spf, sizeof(spf));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_pixel_format_to_host(&spf.pixel_format, &spf.pixel_format);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Received SetPixelFormat message");
-			fibril_mutex_lock(&rfb->lock);
-			rc = rfb_set_pixel_format(rfb, &spf.pixel_format);
-			fibril_mutex_unlock(&rfb->lock);
-			if (rc != EOK)
-				return;
-			break;
-		case RFB_CMSG_SET_ENCODINGS:
-			rc = recv_message(conn, message_type, &se, sizeof(se));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_set_encodings_to_host(&se, &se);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Received SetEncodings message");
-			for (uint16_t i = 0; i < se.count; i++) {
-				int32_t encoding = 0;
-				rc = recv_chars(conn, (char *) &encoding, sizeof(int32_t));
-				if (rc != EOK)
-					return;
-				encoding = uint32_t_be2host(encoding);
-				if (encoding == RFB_ENCODING_TRLE) {
-					log_msg(LOG_DEFAULT, LVL_DEBUG,
-					    "Client supports TRLE encoding");
-					rfb->supports_trle = true;
-				}
-			}
-			break;
-		case RFB_CMSG_FRAMEBUFFER_UPDATE_REQUEST:
-			rc = recv_message(conn, message_type, &fbur, sizeof(fbur));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_framebuffer_update_request_to_host(&fbur, &fbur);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2,
-			    "Received FramebufferUpdateRequest message");
-			rfb_send_framebuffer_update(rfb, conn, fbur.incremental);
-			break;
-		case RFB_CMSG_KEY_EVENT:
-			rc = recv_message(conn, message_type, &ke, sizeof(ke));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_key_event_to_host(&ke, &ke);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Received KeyEvent message");
-			break;
-		case RFB_CMSG_POINTER_EVENT:
-			rc = recv_message(conn, message_type, &pe, sizeof(pe));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_pointer_event_to_host(&pe, &pe);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Received PointerEvent message");
-			break;
-		case RFB_CMSG_CLIENT_CUT_TEXT:
-			rc = recv_message(conn, message_type, &cct, sizeof(cct));
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_WARN,
-				    "Failed receiving client message: %s",
-				    str_error(rc));
-				return;
-			}
-			rfb_client_cut_text_to_host(&cct, &cct);
-			log_msg(LOG_DEFAULT, LVL_DEBUG2, "Received ClientCutText message");
-			recv_skip_chars(conn, cct.length);
-			break;
-		default:
-			log_msg(LOG_DEFAULT, LVL_WARN,
-			    "Invalid client message type encountered");
-			return;
-		}
-	}
-}
-
-errno_t rfb_listen(rfb_t *rfb, uint16_t port)
-{
-	tcp_t *tcp = NULL;
-	tcp_listener_t *lst = NULL;
-	inet_ep_t ep;
-	errno_t rc;
-
-	rc = tcp_create(&tcp);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error initializing TCP.");
-		goto error;
-	}
-
-	inet_ep_init(&ep);
-	ep.port = port;
-
-	rc = tcp_listener_create(tcp, &ep, &listen_cb, rfb, &conn_cb, rfb,
-	    &lst);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating listener.");
-		goto error;
-	}
-
-	rfb->tcp = tcp;
-	rfb->lst = lst;
-
-	return EOK;
-error:
-	tcp_listener_destroy(lst);
-	tcp_destroy(tcp);
-	return rc;
-}
-
-static void rfb_new_conn(tcp_listener_t *lst, tcp_conn_t *conn)
-{
-	rfb_t *rfb = (rfb_t *)tcp_listener_userptr(lst);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection accepted");
-
-	rbuf_out = 0;
-	rbuf_in = 0;
-
-	rfb_socket_connection(rfb, conn);
-}
Index: pace/srv/hid/rfb/rfb.h
===================================================================
--- uspace/srv/hid/rfb/rfb.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,169 +1,0 @@
-/*
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RFB_H__
-#define RFB_H__
-
-#include <inet/tcp.h>
-#include <io/pixelmap.h>
-#include <fibril_synch.h>
-
-#define RFB_SECURITY_NONE 1
-#define RFB_SECURITY_HANDSHAKE_OK 0
-
-#define RFB_CMSG_SET_PIXEL_FORMAT 0
-#define RFB_CMSG_SET_ENCODINGS 2
-#define RFB_CMSG_FRAMEBUFFER_UPDATE_REQUEST 3
-#define RFB_CMSG_KEY_EVENT 4
-#define RFB_CMSG_POINTER_EVENT 5
-#define RFB_CMSG_CLIENT_CUT_TEXT 6
-
-#define RFB_SMSG_FRAMEBUFFER_UPDATE 0
-#define RFB_SMSG_SET_COLOR_MAP_ENTRIES 1
-#define RFB_SMSG_BELL 2
-#define RFB_SMSG_SERVER_CUT_TEXT 3
-
-#define RFB_ENCODING_RAW 0
-#define RFB_ENCODING_TRLE 15
-
-#define RFB_TILE_ENCODING_RAW 0
-#define RFB_TILE_ENCODING_SOLID 1
-
-typedef struct {
-	uint8_t bpp;
-	uint8_t depth;
-	uint8_t big_endian;
-	uint8_t true_color;
-	uint16_t r_max;
-	uint16_t g_max;
-	uint16_t b_max;
-	uint8_t r_shift;
-	uint8_t g_shift;
-	uint8_t b_shift;
-	uint8_t pad[3];
-} __attribute__((packed)) rfb_pixel_format_t;
-
-typedef struct {
-	uint16_t width;
-	uint16_t height;
-	rfb_pixel_format_t pixel_format;
-	uint32_t name_length;
-	char name[0];
-} __attribute__((packed)) rfb_server_init_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t pad[3];
-	rfb_pixel_format_t pixel_format;
-} __attribute__((packed)) rfb_set_pixel_format_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t pad;
-	uint16_t count;
-} __attribute__((packed)) rfb_set_encodings_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t incremental;
-	uint16_t x;
-	uint16_t y;
-	uint16_t width;
-	uint16_t height;
-} __attribute__((packed)) rfb_framebuffer_update_request_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t down_flag;
-	uint8_t pad[2];
-	uint32_t key;
-} __attribute__((packed)) rfb_key_event_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t button_mask;
-	uint16_t x;
-	uint16_t y;
-} __attribute__((packed)) rfb_pointer_event_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t pad;
-	uint32_t length;
-	char text[0];
-} __attribute__((packed)) rfb_client_cut_text_t;
-
-typedef struct {
-	uint16_t x;
-	uint16_t y;
-	uint16_t width;
-	uint16_t height;
-	int32_t enctype;
-	uint8_t data[0];
-} __attribute__((packed)) rfb_rectangle_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t pad;
-	uint16_t rect_count;
-} __attribute__((packed)) rfb_framebuffer_update_t;
-
-typedef struct {
-	uint8_t message_type;
-	uint8_t pad;
-	uint16_t first_color;
-	uint16_t color_count;
-} __attribute__((packed)) rfb_set_color_map_entries_t;
-
-typedef struct {
-	uint16_t red;
-	uint16_t green;
-	uint16_t blue;
-} __attribute__((packed)) rfb_color_map_entry_t;
-
-typedef struct {
-	uint16_t width;
-	uint16_t height;
-	rfb_pixel_format_t pixel_format;
-	const char *name;
-	tcp_t *tcp;
-	tcp_listener_t *lst;
-	pixelmap_t framebuffer;
-	rfb_rectangle_t damage_rect;
-	bool damage_valid;
-	fibril_mutex_t lock;
-	pixel_t *palette;
-	size_t palette_used;
-	bool supports_trle;
-} rfb_t;
-
-extern errno_t rfb_init(rfb_t *, uint16_t, uint16_t, const char *);
-extern errno_t rfb_set_size(rfb_t *, uint16_t, uint16_t);
-extern errno_t rfb_listen(rfb_t *, uint16_t);
-
-#endif
Index: pace/srv/hid/s3c24xx_ts/doc/doxygroups.h
===================================================================
--- uspace/srv/hid/s3c24xx_ts/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_srv_s3c24xx_ts s3c24xx_ts
- * @ingroup srvs
- * @brief Samsung S3C24xx on-chip ADC and touch-screen interface driver
- */
Index: pace/srv/hid/s3c24xx_ts/meson.build
===================================================================
--- uspace/srv/hid/s3c24xx_ts/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2010 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'input' ]
-src = files('s3c24xx_ts.c')
Index: pace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
===================================================================
--- uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,413 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_srv_s3c24xx_ts
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip ADC and touch-screen interface driver.
- *
- * This interface is present on the Samsung S3C24xx CPU (on the gta02 platform).
- */
-
-#include <ddi.h>
-#include <loc.h>
-#include <vfs/vfs.h>
-#include <ipc/mouseev.h>
-#include <async.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sysinfo.h>
-#include <errno.h>
-#include <inttypes.h>
-#include "s3c24xx_ts.h"
-
-#define NAME       "s3c24xx_ts"
-#define NAMESPACE  "hid"
-
-static irq_cmd_t ts_irq_cmds[] = {
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static irq_code_t ts_irq_code = {
-	0,
-	NULL,
-	sizeof(ts_irq_cmds) / sizeof(irq_cmd_t),
-	ts_irq_cmds
-};
-
-/** S3C24xx touchscreen instance structure */
-static s3c24xx_ts_t *ts;
-
-static void s3c24xx_ts_connection(ipc_call_t *, void *);
-static void s3c24xx_ts_irq_handler(ipc_call_t *, void *);
-static void s3c24xx_ts_pen_down(s3c24xx_ts_t *);
-static void s3c24xx_ts_pen_up(s3c24xx_ts_t *);
-static void s3c24xx_ts_eoc(s3c24xx_ts_t *);
-static int s3c24xx_ts_init(s3c24xx_ts_t *);
-static void s3c24xx_ts_wait_for_int_mode(s3c24xx_ts_t *, ts_updn_t);
-static void s3c24xx_ts_convert_samples(int, int, int *, int *);
-static int lin_map_range(int, int, int, int, int);
-
-int main(int argc, char *argv[])
-{
-	loc_srv_t *srv;
-
-	printf("%s: S3C24xx touchscreen driver\n", NAME);
-
-	async_set_fallback_port_handler(s3c24xx_ts_connection, NULL);
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register driver.\n", NAME);
-		return rc;
-	}
-
-	ts = malloc(sizeof(s3c24xx_ts_t));
-	if (ts == NULL) {
-		loc_server_unregister(srv);
-		return -1;
-	}
-
-	if (s3c24xx_ts_init(ts) != EOK) {
-		free(ts);
-		loc_server_unregister(srv);
-		return -1;
-	}
-
-	rc = loc_service_register(srv, NAMESPACE "/mouse", &ts->service_id);
-	if (rc != EOK) {
-		// XXX s3c24xx_ts_fini();
-		free(ts);
-		loc_server_unregister(srv);
-		printf(NAME ": Unable to register device %s.\n",
-		    NAMESPACE "/mouse");
-		return -1;
-	}
-
-	printf(NAME ": Registered device %s.\n", NAMESPACE "/mouse");
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** Initialize S3C24xx touchscreen interface. */
-static int s3c24xx_ts_init(s3c24xx_ts_t *ts)
-{
-	void *vaddr;
-	sysarg_t inr;
-
-	inr = S3C24XX_TS_INR;
-	ts->paddr = S3C24XX_TS_ADDR;
-
-	if (pio_enable((void *) ts->paddr, sizeof(s3c24xx_adc_io_t),
-	    &vaddr) != 0)
-		return -1;
-
-	ts->io = vaddr;
-	ts->client_sess = NULL;
-	ts->state = ts_wait_pendown;
-	ts->last_x = 0;
-	ts->last_y = 0;
-
-	printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
-	    (void *) ts->paddr, inr);
-
-	async_irq_subscribe(inr, s3c24xx_ts_irq_handler, NULL, &ts_irq_code, NULL);
-
-	s3c24xx_ts_wait_for_int_mode(ts, updn_down);
-
-	return EOK;
-}
-
-/** Switch interface to wait for interrupt mode.
- *
- * In this mode we receive an interrupt when pen goes up/down, depending
- * on @a updn.
- *
- * @param ts	Touchscreen instance
- * @param updn	@c updn_up to wait for pen up, @c updn_down to wait for pen
- *		down.
- */
-static void s3c24xx_ts_wait_for_int_mode(s3c24xx_ts_t *ts, ts_updn_t updn)
-{
-	uint32_t con, tsc;
-
-	/*
-	 * Configure ADCCON register
-	 */
-
-	con = pio_read_32(&ts->io->con);
-
-	/* Disable standby, disable start-by-read, clear manual start bit */
-	con = con & ~(ADCCON_STDBM | ADCCON_READ_START | ADCCON_ENABLE_START);
-
-	/* Set prescaler value 0xff, XP for input. */
-	con = con | (ADCCON_PRSCVL(0xff) << 6) | ADCCON_SEL_MUX(SMUX_XP);
-
-	/* Enable prescaler. */
-	con = con | ADCCON_PRSCEN;
-
-	pio_write_32(&ts->io->con, con);
-
-	/*
-	 * Configure ADCTSC register
-	 */
-
-	tsc = pio_read_32(&ts->io->tsc);
-
-	/* Select whether waiting for pen up or pen down. */
-	if (updn == updn_up)
-		tsc |= ADCTSC_DSUD_UP;
-	else
-		tsc &= ~ADCTSC_DSUD_UP;
-
-	/*
-	 * Enable XP pull-up and disable all drivers except YM. This is
-	 * according to the manual. This gives us L on XP input when touching
-	 * and (pulled up to) H when not touching.
-	 */
-	tsc = tsc & ~(ADCTSC_XM_ENABLE | ADCTSC_AUTO_PST |
-	    ADCTSC_PULLUP_DISABLE);
-	tsc = tsc | ADCTSC_YP_DISABLE | ADCTSC_XP_DISABLE | ADCTSC_YM_ENABLE;
-
-	/* Select wait-for-interrupt mode. */
-	tsc = (tsc & ~ADCTSC_XY_PST_MASK) | ADCTSC_XY_PST_WAITINT;
-
-	pio_write_32(&ts->io->tsc, tsc);
-}
-
-/** Handle touchscreen interrupt */
-static void s3c24xx_ts_irq_handler(ipc_call_t *call, void *arg)
-{
-	ts_updn_t updn;
-
-	(void) call;
-
-	/* Read up/down interrupt flags. */
-	updn = pio_read_32(&ts->io->updn);
-
-	if (updn & (ADCUPDN_TSC_DN | ADCUPDN_TSC_UP)) {
-		/* Clear up/down interrupt flags. */
-		pio_write_32(&ts->io->updn, updn &
-		    ~(ADCUPDN_TSC_DN | ADCUPDN_TSC_UP));
-	}
-
-	if (updn & ADCUPDN_TSC_DN) {
-		/* Pen-down interrupt */
-		s3c24xx_ts_pen_down(ts);
-	} else if (updn & ADCUPDN_TSC_UP) {
-		/* Pen-up interrupt */
-		s3c24xx_ts_pen_up(ts);
-	} else {
-		/* Presumably end-of-conversion interrupt */
-
-		/* Check end-of-conversion flag. */
-		if ((pio_read_32(&ts->io->con) & ADCCON_ECFLG) == 0) {
-			printf(NAME ": Unrecognized ts int.\n");
-			return;
-		}
-
-		if (ts->state != ts_sample_pos) {
-			/*
-			 * We got an extra interrupt ater switching to
-			 * wait for interrupt mode.
-			 */
-			return;
-		}
-
-		/* End-of-conversion interrupt */
-		s3c24xx_ts_eoc(ts);
-	}
-}
-
-/** Handle pen-down interrupt.
- *
- * @param ts	Touchscreen instance
- */
-static void s3c24xx_ts_pen_down(s3c24xx_ts_t *ts)
-{
-	/* Pen-down interrupt */
-
-	ts->state = ts_sample_pos;
-
-	/* Enable auto xy-conversion mode */
-	pio_write_32(&ts->io->tsc, (pio_read_32(&ts->io->tsc) & ~3) | 4);
-
-	/* Start the conversion. */
-	pio_write_32(&ts->io->con, pio_read_32(&ts->io->con) | ADCCON_ENABLE_START);
-}
-
-/** Handle pen-up interrupt.
- *
- * @param ts	Touchscreen instance
- */
-static void s3c24xx_ts_pen_up(s3c24xx_ts_t *ts)
-{
-	int button, press;
-
-	/* Pen-up interrupt */
-
-	ts->state = ts_wait_pendown;
-
-	button = 1;
-	press = 0;
-
-	async_exch_t *exch = async_exchange_begin(ts->client_sess);
-	async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press);
-	async_exchange_end(exch);
-
-	s3c24xx_ts_wait_for_int_mode(ts, updn_down);
-}
-
-/** Handle end-of-conversion interrupt.
- *
- * @param ts	Touchscreen instance
- */
-static void s3c24xx_ts_eoc(s3c24xx_ts_t *ts)
-{
-	uint32_t data;
-	int button, press;
-	int smp0, smp1;
-	int x_pos, y_pos;
-	int dx, dy;
-
-	ts->state = ts_wait_penup;
-
-	/* Read in sampled data. */
-
-	data = pio_read_32(&ts->io->dat0);
-	smp0 = data & 0x3ff;
-
-	data = pio_read_32(&ts->io->dat1);
-	smp1 = data & 0x3ff;
-
-	/* Convert to screen coordinates. */
-	s3c24xx_ts_convert_samples(smp0, smp1, &x_pos, &y_pos);
-
-	printf("s0: 0x%03x, s1:0x%03x -> x:%d,y:%d\n", smp0, smp1,
-	    x_pos, y_pos);
-
-	/* Get differences. */
-	dx = x_pos - ts->last_x;
-	dy = y_pos - ts->last_y;
-
-	button = 1;
-	press = 1;
-
-	/* Send notifications to client. */
-	async_exch_t *exch = async_exchange_begin(ts->client_sess);
-	async_msg_2(exch, MOUSEEV_MOVE_EVENT, dx, dy);
-	async_msg_2(exch, MOUSEEV_BUTTON_EVENT, button, press);
-	async_exchange_end(exch);
-
-	ts->last_x = x_pos;
-	ts->last_y = y_pos;
-
-	s3c24xx_ts_wait_for_int_mode(ts, updn_up);
-}
-
-/** Convert sampled data to screen coordinates. */
-static void s3c24xx_ts_convert_samples(int smp0, int smp1, int *x, int *y)
-{
-	/*
-	 * The orientation and display dimensions are GTA02-specific and the
-	 * calibration values might even specific to the individual piece
-	 * of hardware.
-	 *
-	 * The calibration values can be obtained by touching corners
-	 * of the screen with the stylus and noting the sampled values.
-	 */
-	*x = lin_map_range(smp1, 0xa1, 0x396, 0, 479);
-	*y = lin_map_range(smp0, 0x69, 0x38a, 639, 0);
-}
-
-/** Map integer from one range to another range in a linear fashion.
- *
- * i0 < i1 is required. i0 is mapped to o0, i1 to o1. If o1 < o0, then the
- * mapping will be descending. If v is outside of [i0, i1], it is clamped.
- *
- * @param v	Value to map.
- * @param i0	Lower bound of input range.
- * @param i1	Upper bound of input range.
- * @param o0	First bound of output range.
- * @param o1	Second bound of output range.
- *
- * @return	Mapped value ov, o0 <= ov <= o1.
- */
-static int lin_map_range(int v, int i0, int i1, int o0, int o1)
-{
-	if (v < i0)
-		v = i0;
-
-	if (v > i1)
-		v = i1;
-
-	return o0 + (o1 - o0) * (v - i0) / (i1 - i0);
-}
-
-/** Handle mouse client connection. */
-static void s3c24xx_ts_connection(ipc_call_t *icall, void *arg)
-{
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			if (ts->client_sess != NULL) {
-				async_hangup(ts->client_sess);
-				ts->client_sess = NULL;
-			}
-
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		async_sess_t *sess =
-		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
-		if (sess != NULL) {
-			if (ts->client_sess == NULL) {
-				ts->client_sess = sess;
-				async_answer_0(&call, EOK);
-			} else
-				async_answer_0(&call, ELIMIT);
-		} else
-			async_answer_0(&call, EINVAL);
-	}
-}
-
-/** @}
- */
Index: pace/srv/hid/s3c24xx_ts/s3c24xx_ts.h
===================================================================
--- uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_srv_s3c24xx_ts
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip ADC and touch-screen interface driver.
- */
-
-#ifndef S3C24XX_TS_H_
-#define S3C24XX_TS_H_
-
-#include <stdint.h>
-#include <async.h>
-
-/** S3C24xx ADC and touch-screen I/O */
-typedef struct {
-	uint32_t con;
-	uint32_t tsc;
-	uint32_t dly;
-	uint32_t dat0;
-	uint32_t dat1;
-	uint32_t updn;
-} s3c24xx_adc_io_t;
-
-/* Fields in ADCCON register */
-#define ADCCON_ECFLG		0x8000
-#define ADCCON_PRSCEN		0x4000
-
-#define ADCCON_PRSCVL(val)	(((val) & 0xff) << 6)
-
-#define ADCCON_SEL_MUX(smux)	(((smux) & 7) << 3)
-
-#define ADCCON_STDBM		0x0004
-#define ADCCON_READ_START	0x0002
-#define ADCCON_ENABLE_START	0x0001
-
-/* Values for ADCCON_SEL_MUX */
-#define SMUX_AIN0		0
-#define SMUX_AIN1		1
-#define SMUX_AIN2		2
-#define SMUX_AIN3		3
-#define SMUX_YM			4
-#define SMUX_YP			5
-#define SMUX_XM			6
-#define SMUX_XP			7
-
-/* Fields in ADCTSC register */
-#define ADCTSC_DSUD_UP		0x0100
-#define ADCTSC_YM_ENABLE	0x0080
-#define ADCTSC_YP_DISABLE	0x0040
-#define ADCTSC_XM_ENABLE	0x0020
-#define ADCTSC_XP_DISABLE	0x0010
-#define ADCTSC_PULLUP_DISABLE	0x0008
-#define ADCTSC_AUTO_PST		0x0004
-
-#define ADCTSC_XY_PST_NOOP	0x0000
-#define ADCTSC_XY_PST_X		0x0001
-#define ADCTSC_XY_PST_Y		0x0002
-#define ADCTSC_XY_PST_WAITINT	0x0003
-#define ADCTSC_XY_PST_MASK	0x0003
-
-/* Fields in ADCDAT0, ADCDAT1 registers */
-#define ADCDAT_UPDOWN		0x8000
-#define ADCDAT_AUTO_PST		0x4000
-
-/* Fields in ADCUPDN register */
-#define ADCUPDN_TSC_UP		0x0002
-#define ADCUPDN_TSC_DN		0x0001
-
-/** Touchscreen interrupt number */
-#define S3C24XX_TS_INR		31
-
-/** Touchscreen I/O address */
-#define S3C24XX_TS_ADDR		0x58000000
-
-typedef enum {
-	ts_wait_pendown,
-	ts_sample_pos,
-	ts_wait_penup
-} ts_state_t;
-
-typedef enum {
-	updn_up,
-	updn_down
-} ts_updn_t;
-
-/** S3C24xx touchscreen driver instance */
-typedef struct {
-	/** Physical device address */
-	uintptr_t paddr;
-
-	/** Device I/O structure */
-	s3c24xx_adc_io_t *io;
-
-	/** Callback session to the client */
-	async_sess_t *client_sess;
-
-	/** Service ID */
-	service_id_t service_id;
-
-	/** Device/driver state */
-	ts_state_t state;
-
-	/** Previous position reported to client. */
-	int last_x;
-	int last_y;
-} s3c24xx_ts_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/hw/char/s3c24xx_uart/doc/doxygroups.h
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup uspace_srv_s3c24xx_uart s3c24xx_uart
- * @ingroup srvs
- * @brief Samsung S3C24xx on-chip UART driver
- */
Index: pace/srv/hw/char/s3c24xx_uart/meson.build
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,31 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('s3c24xx_uart.c')
Index: pace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,254 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- * @brief Samsung S3C24xx on-chip UART driver.
- *
- * This UART is present on the Samsung S3C24xx CPU (on the gta02 platform).
- */
-
-#include <async.h>
-#include <ddi.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <io/chardev_srv.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sysinfo.h>
-#include "s3c24xx_uart.h"
-
-#define NAME       "s3c24ser"
-#define NAMESPACE  "char"
-
-static irq_cmd_t uart_irq_cmds[] = {
-	{
-		.cmd = CMD_ACCEPT
-	}
-};
-
-static irq_code_t uart_irq_code = {
-	0,
-	NULL,
-	sizeof(uart_irq_cmds) / sizeof(irq_cmd_t),
-	uart_irq_cmds
-};
-
-/** S3C24xx UART instance structure */
-static s3c24xx_uart_t *uart;
-
-static void s3c24xx_uart_connection(ipc_call_t *, void *);
-static void s3c24xx_uart_irq_handler(ipc_call_t *, void *);
-static int s3c24xx_uart_init(s3c24xx_uart_t *);
-static void s3c24xx_uart_sendb(s3c24xx_uart_t *, uint8_t);
-
-static errno_t s3c24xx_uart_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-static errno_t s3c24xx_uart_write(chardev_srv_t *, const void *, size_t, size_t *);
-
-static chardev_ops_t s3c24xx_uart_chardev_ops = {
-	.read = s3c24xx_uart_read,
-	.write = s3c24xx_uart_write
-};
-
-int main(int argc, char *argv[])
-{
-	loc_srv_t *srv;
-
-	printf("%s: S3C24xx on-chip UART driver\n", NAME);
-
-	async_set_fallback_port_handler(s3c24xx_uart_connection, uart);
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Unable to register server.\n", NAME);
-		return rc;
-	}
-
-	uart = malloc(sizeof(s3c24xx_uart_t));
-	if (uart == NULL) {
-		loc_server_unregister(srv);
-		return -1;
-	}
-
-	if (s3c24xx_uart_init(uart) != EOK) {
-		free(uart);
-		loc_server_unregister(srv);
-		return -1;
-	}
-
-	rc = loc_service_register(srv, NAMESPACE "/" NAME, &uart->service_id);
-	if (rc != EOK) {
-		// XXX s3c24xx_uart_fini(uart);
-		free(uart);
-		loc_server_unregister(srv);
-		printf(NAME ": Unable to register device %s.\n",
-		    NAMESPACE "/" NAME);
-		return -1;
-	}
-
-	printf(NAME ": Registered device %s.\n", NAMESPACE "/" NAME);
-
-	printf(NAME ": Accepting connections\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** Character device connection handler. */
-static void s3c24xx_uart_connection(ipc_call_t *icall, void *arg)
-{
-	s3c24xx_uart_t *uart = (s3c24xx_uart_t *) arg;
-
-	chardev_conn(icall, &uart->cds);
-}
-
-static void s3c24xx_uart_irq_handler(ipc_call_t *call, void *arg)
-{
-	errno_t rc;
-
-	(void) call;
-	(void) arg;
-
-	while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_RX_COUNT) != 0) {
-		uint32_t data = pio_read_32(&uart->io->urxh) & 0xff;
-		uint32_t status = pio_read_32(&uart->io->uerstat);
-
-		fibril_mutex_lock(&uart->buf_lock);
-
-		rc = circ_buf_push(&uart->cbuf, &data);
-		if (rc != EOK)
-			printf(NAME ": Buffer overrun\n");
-
-		fibril_mutex_unlock(&uart->buf_lock);
-		fibril_condvar_broadcast(&uart->buf_cv);
-
-		if (status != 0)
-			printf(NAME ": Error status 0x%x\n", status);
-	}
-}
-
-/** Initialize S3C24xx on-chip UART. */
-static int s3c24xx_uart_init(s3c24xx_uart_t *uart)
-{
-	void *vaddr;
-	sysarg_t inr;
-
-	circ_buf_init(&uart->cbuf, uart->buf, s3c24xx_uart_buf_size, 1);
-	fibril_mutex_initialize(&uart->buf_lock);
-	fibril_condvar_initialize(&uart->buf_cv);
-
-	if (sysinfo_get_value("s3c24xx_uart.address.physical",
-	    &uart->paddr) != EOK)
-		return -1;
-
-	if (pio_enable((void *) uart->paddr, sizeof(s3c24xx_uart_io_t),
-	    &vaddr) != 0)
-		return -1;
-
-	if (sysinfo_get_value("s3c24xx_uart.inr", &inr) != EOK)
-		return -1;
-
-	uart->io = vaddr;
-
-	printf(NAME ": device at physical address %p, inr %" PRIun ".\n",
-	    (void *) uart->paddr, inr);
-
-	async_irq_subscribe(inr, s3c24xx_uart_irq_handler, NULL, &uart_irq_code, NULL);
-
-	/* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
-	pio_write_32(&uart->io->ufcon, UFCON_FIFO_ENABLE |
-	    UFCON_TX_FIFO_TLEVEL_EMPTY | UFCON_RX_FIFO_TLEVEL_1B);
-
-	/* Set RX interrupt to pulse mode */
-	pio_write_32(&uart->io->ucon,
-	    pio_read_32(&uart->io->ucon) & ~UCON_RX_INT_LEVEL);
-
-	chardev_srvs_init(&uart->cds);
-	uart->cds.ops = &s3c24xx_uart_chardev_ops;
-	uart->cds.sarg = uart;
-
-	return EOK;
-}
-
-/** Send a byte to the UART. */
-static void s3c24xx_uart_sendb(s3c24xx_uart_t *uart, uint8_t byte)
-{
-	/* Wait for space becoming available in Tx FIFO. */
-	while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_TX_FULL) != 0)
-		;
-
-	pio_write_32(&uart->io->utxh, byte);
-}
-
-static errno_t s3c24xx_uart_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	s3c24xx_uart_t *uart = (s3c24xx_uart_t *) srv->srvs->sarg;
-	size_t p;
-	uint8_t *bp = (uint8_t *) buf;
-	errno_t rc;
-
-	fibril_mutex_lock(&uart->buf_lock);
-
-	while ((flags & chardev_f_nonblock) == 0 &&
-	    circ_buf_nused(&uart->cbuf) == 0)
-		fibril_condvar_wait(&uart->buf_cv, &uart->buf_lock);
-
-	p = 0;
-	while (p < size) {
-		rc = circ_buf_pop(&uart->cbuf, &bp[p]);
-		if (rc != EOK)
-			break;
-		++p;
-	}
-
-	fibril_mutex_unlock(&uart->buf_lock);
-
-	*nread = p;
-	return EOK;
-}
-
-static errno_t s3c24xx_uart_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwr)
-{
-	s3c24xx_uart_t *uart = (s3c24xx_uart_t *) srv->srvs->sarg;
-	size_t i;
-	uint8_t *dp = (uint8_t *) data;
-
-	for (i = 0; i < size; i++)
-		s3c24xx_uart_sendb(uart, dp[i]);
-
-	*nwr = size;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h
===================================================================
--- uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup uspace_srv_s3c24xx_uart
- * @{
- */
-/**
- * @file
- * @brief Samsung S3C24xx on-chip UART driver.
- */
-
-#ifndef S3C24XX_UART_H_
-#define S3C24XX_UART_H_
-
-#include <adt/circ_buf.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <io/chardev_srv.h>
-#include <stdint.h>
-
-/** S3C24xx UART I/O */
-typedef struct {
-	uint32_t ulcon;
-	uint32_t ucon;
-	uint32_t ufcon;
-	uint32_t umcon;
-
-	uint32_t utrstat;
-	uint32_t uerstat;
-	uint32_t ufstat;
-	uint32_t umstat;
-
-	uint32_t utxh;
-	uint32_t urxh;
-
-	uint32_t ubrdiv;
-} s3c24xx_uart_io_t;
-
-/* Bits in UTRSTAT register */
-#define S3C24XX_UTRSTAT_TX_EMPTY	0x4
-#define S3C24XX_UTRSTAT_RDATA		0x1
-
-/* Bits in UFSTAT register */
-#define S3C24XX_UFSTAT_TX_FULL		0x4000
-#define S3C24XX_UFSTAT_RX_FULL		0x0040
-#define S3C24XX_UFSTAT_RX_COUNT		0x002f
-
-/* Bits in UCON register */
-#define UCON_RX_INT_LEVEL		0x100
-
-/* Bits in UFCON register */
-#define UFCON_TX_FIFO_TLEVEL_EMPTY	0x00
-#define UFCON_RX_FIFO_TLEVEL_1B		0x00
-#define UFCON_FIFO_ENABLE		0x01
-
-enum {
-	s3c24xx_uart_buf_size = 64
-};
-
-/** S3C24xx UART instance */
-typedef struct {
-	/** Physical device address */
-	uintptr_t paddr;
-
-	/** Device I/O structure */
-	s3c24xx_uart_io_t *io;
-
-	/** Character device service */
-	chardev_srvs_t cds;
-
-	/** Service ID */
-	service_id_t service_id;
-
-	/** Circular buffer */
-	circ_buf_t cbuf;
-	/** Buffer */
-	uint8_t buf[s3c24xx_uart_buf_size];
-	/** Buffer lock */
-	fibril_mutex_t buf_lock;
-	/** Signal newly added data in buffer */
-	fibril_condvar_t buf_cv;
-} s3c24xx_uart_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/klog/doc/doxygroups.h
===================================================================
--- uspace/srv/klog/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/** @addtogroup klog klog
- * @ingroup srvs
- */
Index: pace/srv/klog/klog.c
===================================================================
--- uspace/srv/klog/klog.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,257 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * Copyright (c) 2013 Martin Sucha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup klog
- * @{
- */
-/**
- * @file
- */
-
-#include <stdio.h>
-#include <async.h>
-#include <as.h>
-#include <ddi.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/klog.h>
-#include <sysinfo.h>
-#include <stdlib.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <adt/prodcons.h>
-#include <io/log.h>
-#include <io/logctl.h>
-
-#define NAME  "klog"
-
-typedef size_t __attribute__((aligned(1))) unaligned_size_t;
-
-typedef struct {
-	size_t entry_len;
-	uint32_t serial;
-	uint32_t facility;
-	uint32_t level;
-	char message[0];
-
-} __attribute__((__packed__)) log_entry_t;
-
-/* Producer/consumer buffers */
-typedef struct {
-	link_t link;
-	size_t size;
-	log_entry_t *data;
-} item_t;
-
-static prodcons_t pc;
-
-/* Pointer to buffer where kernel stores new entries */
-#define BUFFER_SIZE PAGE_SIZE
-static void *buffer;
-
-/* Notification mutex */
-static FIBRIL_MUTEX_INITIALIZE(mtx);
-
-static log_t kernel_ctx;
-static const char *facility_name[] = {
-	"other",
-	"uspace",
-	"arch"
-};
-
-#define facility_len (sizeof(facility_name) / sizeof(const char *))
-static log_t facility_ctx[facility_len];
-
-/** Klog producer
- *
- * Copies the log entries to a producer/consumer queue.
- *
- * @param length Number of characters to copy.
- * @param data   Pointer to the kernel klog buffer.
- *
- */
-static void producer(void)
-{
-	size_t len = 0;
-	errno_t rc = klog_read(buffer, BUFFER_SIZE, &len);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "klog_read failed, rc = %s",
-		    str_error_name(rc));
-		return;
-	}
-
-	size_t offset = 0;
-	while (offset < len) {
-		size_t entry_len = *((unaligned_size_t *) (buffer + offset));
-
-		if (offset + entry_len > len || entry_len < sizeof(log_entry_t))
-			break;
-
-		log_entry_t *buf = malloc(entry_len + 1);
-		if (buf == NULL)
-			break;
-
-		item_t *item = malloc(sizeof(item_t));
-		if (item == NULL) {
-			free(buf);
-			break;
-		}
-
-		memcpy(buf, buffer + offset, entry_len);
-		*((uint8_t *) buf + entry_len) = 0;
-		link_initialize(&item->link);
-		item->size = entry_len;
-		item->data = buf;
-		prodcons_produce(&pc, &item->link);
-
-		offset += entry_len;
-	}
-}
-
-/** Klog consumer
- *
- * Waits in an infinite loop for the log data created by
- * the producer and logs them to the logger.
- *
- * @param data Unused.
- *
- * @return Always EOK (unreachable).
- *
- */
-static errno_t consumer(void *data)
-{
-
-	while (true) {
-		link_t *link = prodcons_consume(&pc);
-		item_t *item = list_get_instance(link, item_t, link);
-
-		if (item->size < sizeof(log_entry_t)) {
-			free(item->data);
-			free(item);
-			continue;
-		}
-
-		if (item->data->facility == LF_USPACE) {
-			/* Avoid reposting messages */
-			free(item->data);
-			free(item);
-			continue;
-		}
-
-		log_t ctx = kernel_ctx;
-		if (item->data->facility < facility_len) {
-			ctx = facility_ctx[item->data->facility];
-		}
-
-		log_level_t lvl = item->data->level;
-		if (lvl > LVL_LIMIT)
-			lvl = LVL_NOTE;
-
-		log_msg(ctx, lvl, "%s", item->data->message);
-
-		free(item->data);
-		free(item);
-	}
-
-	return EOK;
-}
-
-/** Kernel notification handler
- *
- * Receives kernel klog notifications.
- *
- * @param call   IPC call structure
- * @param arg    Local argument
- *
- */
-static void klog_notification_received(ipc_call_t *call, void *arg)
-{
-	/*
-	 * Make sure we process only a single notification
-	 * at any time to limit the chance of the consumer
-	 * starving.
-	 */
-
-	fibril_mutex_lock(&mtx);
-
-	producer();
-
-	async_event_unmask(EVENT_KLOG);
-	fibril_mutex_unlock(&mtx);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc = log_init(NAME);
-	if (rc != EOK) {
-		fprintf(stderr, "%s: Unable to initialize log\n", NAME);
-		return rc;
-	}
-
-	kernel_ctx = log_create("kernel", LOG_NO_PARENT);
-	for (unsigned int i = 0; i < facility_len; i++) {
-		facility_ctx[i] = log_create(facility_name[i], kernel_ctx);
-	}
-
-	buffer = malloc(BUFFER_SIZE);
-	if (buffer == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to allocate buffer");
-		return 1;
-	}
-
-	prodcons_initialize(&pc);
-	rc = async_event_subscribe(EVENT_KLOG, klog_notification_received, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Unable to register klog notifications");
-		return rc;
-	}
-
-	fid_t fid = fibril_create(consumer, NULL);
-	if (!fid) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Unable to create consumer fibril");
-		return ENOMEM;
-	}
-
-	fibril_add_ready(fid);
-	async_event_unmask(EVENT_KLOG);
-
-	fibril_mutex_lock(&mtx);
-	producer();
-	fibril_mutex_unlock(&mtx);
-
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/klog/meson.build
===================================================================
--- uspace/srv/klog/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('klog.c')
Index: pace/srv/loader/doc/doxygroups.h
===================================================================
--- uspace/srv/loader/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup loader loader
- * @ingroup srvs
- * @brief Loads and runs programs from VFS
- */
Index: pace/srv/loader/elf64_ia64_loader.x
===================================================================
--- uspace/srv/loader/elf64_ia64_loader.x	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,263 +1,0 @@
-/* Default linker script, for normal executables */
-/* Copyright (C) 2014-2018 Free Software Foundation, Inc.
-   Copying and distribution of this script, with or without modification,
-   are permitted in any medium without royalty provided the copyright
-   notice and this notice are preserved.  */
-OUTPUT_FORMAT("elf64-ia64-little", "elf64-ia64-little",
-	      "elf64-ia64-little")
-OUTPUT_ARCH(ia64)
-ENTRY(_start)
-SEARCH_DIR("=/lib");
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x7FFF000000000000)); . = SEGMENT_START("text-segment", 0x7FFF000000000000) + SIZEOF_HEADERS;
-  .interp         : { *(.interp) }
-  .note.gnu.build-id : { *(.note.gnu.build-id) }
-  .hash           : { *(.hash) }
-  .gnu.hash       : { *(.gnu.hash) }
-  .dynsym         : { *(.dynsym) }
-  .dynstr         : { *(.dynstr) }
-  .gnu.version    : { *(.gnu.version) }
-  .gnu.version_d  : { *(.gnu.version_d) }
-  .gnu.version_r  : { *(.gnu.version_r) }
-  .rel.init       : { *(.rel.init) }
-  .rela.init      : { *(.rela.init) }
-  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
-  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
-  .rel.fini       : { *(.rel.fini) }
-  .rela.fini      : { *(.rela.fini) }
-  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
-  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
-  .rel.data.rel.ro   : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
-  .rela.data.rel.ro   : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
-  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
-  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
-  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
-  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
-  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
-  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
-  .rel.ctors      : { *(.rel.ctors) }
-  .rela.ctors     : { *(.rela.ctors) }
-  .rel.dtors      : { *(.rel.dtors) }
-  .rela.dtors     : { *(.rela.dtors) }
-  .rel.got        : { *(.rel.got) }
-  .rela.got       : { *(.rela.got) }
-  .rel.sdata      : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
-  .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
-  .rel.sbss       : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
-  .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
-  .rel.sdata2     : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
-  .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
-  .rel.sbss2      : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
-  .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
-  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
-  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
-  .rel.iplt       :
-    {
-      PROVIDE_HIDDEN (__rel_iplt_start = .);
-      *(.rel.iplt)
-      PROVIDE_HIDDEN (__rel_iplt_end = .);
-    }
-  .rela.iplt      :
-    {
-      PROVIDE_HIDDEN (__rela_iplt_start = .);
-      *(.rela.iplt)
-      PROVIDE_HIDDEN (__rela_iplt_end = .);
-    }
-  .rel.plt        :
-    {
-      *(.rel.plt)
-    }
-  .rela.plt       :
-    {
-      *(.rela.plt)
-    }
-  .rela.IA_64.pltoff   : { *(.rela.IA_64.pltoff) }
-  .init           :
-  {
-    KEEP (*(SORT_NONE(.init)))
-  } =0x00300000010070000002000001000400
-  .plt            : { *(.plt) }
-  .iplt           : { *(.iplt) }
-  .text           :
-  {
-    *(.text.unlikely .text.*_unlikely .text.unlikely.*)
-    *(.text.exit .text.exit.*)
-    *(.text.startup .text.startup.*)
-    *(.text.hot .text.hot.*)
-    *(.text .stub .text.* .gnu.linkonce.t.*)
-    /* .gnu.warning sections are handled specially by elf32.em.  */
-    *(.gnu.warning)
-  } =0x00300000010070000002000001000400
-  .fini           :
-  {
-    KEEP (*(SORT_NONE(.fini)))
-  } =0x00300000010070000002000001000400
-  PROVIDE (__etext = .);
-  PROVIDE (_etext = .);
-  PROVIDE (etext = .);
-  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
-  .rodata1        : { *(.rodata1) }
-  .sdata2         :
-  {
-    *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
-  }
-  .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
-  .opd            : { *(.opd) }
-  .IA_64.unwind_info   : { *(.IA_64.unwind_info* .gnu.linkonce.ia64unwi.*) }
-  .IA_64.unwind   : { *(.IA_64.unwind* .gnu.linkonce.ia64unw.*) }
-  .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
-  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
-  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table
-  .gcc_except_table.*) }
-  .gnu_extab   : ONLY_IF_RO { *(.gnu_extab*) }
-  /* These sections are generated by the Sun/Oracle C++ compiler.  */
-  .exception_ranges   : ONLY_IF_RO { *(.exception_ranges
-  .exception_ranges*) }
-  /* Adjust the address for the data segment.  We want to adjust up to
-     the same address within the page on the next page up.  */
-  . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
-  /* Exception handling  */
-  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
-  .gnu_extab      : ONLY_IF_RW { *(.gnu_extab) }
-  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
-  .exception_ranges   : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
-  /* Thread Local Storage sections  */
-  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
-  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
-  .preinit_array     :
-  {
-    PROVIDE_HIDDEN (__preinit_array_start = .);
-    KEEP (*(.preinit_array))
-    PROVIDE_HIDDEN (__preinit_array_end = .);
-  }
-  .init_array     :
-  {
-    PROVIDE_HIDDEN (__init_array_start = .);
-    KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
-    KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
-    PROVIDE_HIDDEN (__init_array_end = .);
-  }
-  .fini_array     :
-  {
-    PROVIDE_HIDDEN (__fini_array_start = .);
-    KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
-    KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
-    PROVIDE_HIDDEN (__fini_array_end = .);
-  }
-  .jcr            : { KEEP (*(.jcr)) }
-  .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
-  .dynamic        : { *(.dynamic) }
-  .data           :
-  {
-    *(.data .data.* .gnu.linkonce.d.*)
-    SORT(CONSTRUCTORS)
-  }
-  .data1          : { *(.data1) }
-  .ctors          :
-  {
-    /* gcc uses crtbegin.o to find the start of
-       the constructors, so we make sure it is
-       first.  Because this is a wildcard, it
-       doesn't matter if the user does not
-       actually link against crtbegin.o; the
-       linker won't look for a file to match a
-       wildcard.  The wildcard also means that it
-       doesn't matter which directory crtbegin.o
-       is in.  */
-    KEEP (*crtbegin.o(.ctors))
-    KEEP (*crtbegin?.o(.ctors))
-    /* We don't want to include the .ctor section from
-       the crtend.o file until after the sorted ctors.
-       The .ctor section from the crtend file contains the
-       end of ctors marker and it must be last */
-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
-    KEEP (*(SORT(.ctors.*)))
-    KEEP (*(.ctors))
-  }
-  .dtors          :
-  {
-    KEEP (*crtbegin.o(.dtors))
-    KEEP (*crtbegin?.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
-    KEEP (*(SORT(.dtors.*)))
-    KEEP (*(.dtors))
-  }
-  .got            : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
-  .IA_64.pltoff   : { *(.IA_64.pltoff) }
-  /* We want the small data sections together, so single-instruction offsets
-     can access them all, and initialized data all before uninitialized, so
-     we can shorten the on-disk segment size.  */
-  .sdata          :
-  {
-    *(.sdata .sdata.* .gnu.linkonce.s.*)
-  }
-  _edata = .; PROVIDE (edata = .);
-  . = .;
-  __bss_start = .;
-  .sbss           :
-  {
-    *(.dynsbss)
-    *(.sbss .sbss.* .gnu.linkonce.sb.*)
-    *(.scommon)
-  }
-  .bss            :
-  {
-   *(.dynbss)
-   *(.bss .bss.* .gnu.linkonce.b.*)
-   *(COMMON)
-   /* Align here to ensure that the .bss section occupies space up to
-      _end.  Align after .bss to ensure correct alignment even if the
-      .bss section disappears because there are no input sections.
-      FIXME: Why do we need it? When there is no .bss section, we don't
-      pad the .data section.  */
-   . = ALIGN(. != 0 ? 64 / 8 : 1);
-  }
-  . = ALIGN(64 / 8);
-  . = SEGMENT_START("ldata-segment", .);
-  . = ALIGN(64 / 8);
-  _end = .; PROVIDE (end = .);
-  /* Stabs debugging sections.  */
-  .stab          0 : { *(.stab) }
-  .stabstr       0 : { *(.stabstr) }
-  .stab.excl     0 : { *(.stab.excl) }
-  .stab.exclstr  0 : { *(.stab.exclstr) }
-  .stab.index    0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment       0 : { *(.comment) }
-  /* DWARF debug sections.
-     Symbols in the DWARF debugging sections are relative to the beginning
-     of the section so we begin them at 0.  */
-  /* DWARF 1 */
-  .debug          0 : { *(.debug) }
-  .line           0 : { *(.line) }
-  /* GNU DWARF 1 extensions */
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  /* DWARF 1.1 and DWARF 2 */
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-  /* DWARF 2 */
-  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
-  .debug_abbrev   0 : { *(.debug_abbrev) }
-  .debug_line     0 : { *(.debug_line .debug_line.* .debug_line_end ) }
-  .debug_frame    0 : { *(.debug_frame) }
-  .debug_str      0 : { *(.debug_str) }
-  .debug_loc      0 : { *(.debug_loc) }
-  .debug_macinfo  0 : { *(.debug_macinfo) }
-  /* SGI/MIPS DWARF 2 extensions */
-  .debug_weaknames 0 : { *(.debug_weaknames) }
-  .debug_funcnames 0 : { *(.debug_funcnames) }
-  .debug_typenames 0 : { *(.debug_typenames) }
-  .debug_varnames  0 : { *(.debug_varnames) }
-  /* DWARF 3 */
-  .debug_pubtypes 0 : { *(.debug_pubtypes) }
-  .debug_ranges   0 : { *(.debug_ranges) }
-  /* DWARF Extension.  */
-  .debug_macro    0 : { *(.debug_macro) }
-  .debug_addr     0 : { *(.debug_addr) }
-  .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
-  /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
-}
-
Index: pace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,450 +1,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup loader
- * @{
- */
-/**
- * @file
- *
- * The program loader is a special init binary. Its image is used
- * to create a new task upon a @c task_spawn syscall. The syscall
- * returns the id of a phone connected to the newly created task.
- *
- * The caller uses this phone to send the pathname and various other
- * information to the loader. This is normally done by the C library
- * and completely hidden from applications.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <ipc/services.h>
-#include <ipc/loader.h>
-#include <ns.h>
-#include <loader/pcb.h>
-#include <entry_point.h>
-#include <errno.h>
-#include <async.h>
-#include <str.h>
-#include <as.h>
-#include <elf/elf.h>
-#include <elf/elf_load.h>
-#include <vfs/vfs.h>
-#include <vfs/inbox.h>
-#include <libc.h>
-
-#ifdef CONFIG_RTLD
-#include <rtld/rtld.h>
-#endif
-
-#define DPRINTF(...) ((void) 0)
-
-/** File that will be loaded */
-static char *progname = NULL;
-static int program_fd = -1;
-
-/** The Program control block */
-static pcb_t pcb;
-
-/** Current working directory */
-static char *cwd = NULL;
-
-/** Number of arguments */
-static int argc = 0;
-/** Argument vector */
-static char **argv = NULL;
-/** Buffer holding all arguments */
-static char *arg_buf = NULL;
-
-/** Inbox entries. */
-static struct pcb_inbox_entry inbox[INBOX_MAX_ENTRIES];
-static int inbox_entries = 0;
-
-static elf_info_t prog_info;
-
-/** Used to limit number of connections to one. */
-static bool connected = false;
-
-static void ldr_get_taskid(ipc_call_t *req)
-{
-	ipc_call_t call;
-	task_id_t task_id;
-	size_t len;
-
-	task_id = task_get_id();
-
-	if (!async_data_read_receive(&call, &len)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	if (len > sizeof(task_id))
-		len = sizeof(task_id);
-
-	DPRINTF("LOADER_GET_TASKID() = %lu\n", (unsigned long) task_id);
-	async_data_read_finalize(&call, &task_id, len);
-	async_answer_0(req, EOK);
-}
-
-/** Receive a call setting the current working directory.
- *
- */
-static void ldr_set_cwd(ipc_call_t *req)
-{
-	char *buf;
-	errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, NULL);
-
-	if (rc == EOK) {
-		if (cwd != NULL)
-			free(cwd);
-
-		cwd = buf;
-	}
-
-	DPRINTF("LOADER_SET_CWD('%s')\n", cwd);
-	async_answer_0(req, rc);
-}
-
-/** Receive a call setting the program to execute.
- *
- */
-static void ldr_set_program(ipc_call_t *req)
-{
-	ipc_call_t call;
-	size_t namesize;
-	if (!async_data_write_receive(&call, &namesize)) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	char *name = malloc(namesize);
-	// FIXME: check return value
-
-	errno_t rc = async_data_write_finalize(&call, name, namesize);
-	if (rc != EOK) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	int file;
-	rc = vfs_receive_handle(true, &file);
-	if (rc != EOK) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	DPRINTF("LOADER_SET_PROGRAM('%s')\n", name);
-
-	progname = name;
-	program_fd = file;
-	async_answer_0(req, EOK);
-}
-
-/** Receive a call setting arguments of the program to execute.
- *
- */
-static void ldr_set_args(ipc_call_t *req)
-{
-	char *buf;
-	size_t buf_size;
-	errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, &buf_size);
-
-	if (rc == EOK) {
-		/*
-		 * Count number of arguments
-		 */
-		char *cur = buf;
-		int count = 0;
-
-		while (cur < buf + buf_size) {
-			size_t arg_size = str_size(cur);
-			cur += arg_size + 1;
-			count++;
-		}
-
-		/*
-		 * Allocate new argv
-		 */
-		char **_argv = (char **) malloc((count + 1) * sizeof(char *));
-		if (_argv == NULL) {
-			free(buf);
-			async_answer_0(req, ENOMEM);
-			return;
-		}
-
-		/*
-		 * Fill the new argv with argument pointers
-		 */
-		cur = buf;
-		count = 0;
-		while (cur < buf + buf_size) {
-			_argv[count] = cur;
-
-			size_t arg_size = str_size(cur);
-			cur += arg_size + 1;
-			count++;
-		}
-		_argv[count] = NULL;
-
-		/*
-		 * Copy temporary data to global variables
-		 */
-		if (arg_buf != NULL)
-			free(arg_buf);
-
-		if (argv != NULL)
-			free(argv);
-
-		for (int i = 0; i < count; i++)
-			DPRINTF("LOADER_SET_ARGS('%s')\n", _argv[i]);
-
-		argc = count;
-		arg_buf = buf;
-		argv = _argv;
-	}
-
-	async_answer_0(req, rc);
-}
-
-/** Receive a call setting inbox files of the program to execute.
- *
- */
-static void ldr_add_inbox(ipc_call_t *req)
-{
-	if (inbox_entries == INBOX_MAX_ENTRIES) {
-		async_answer_0(req, ERANGE);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t namesize;
-	if (!async_data_write_receive(&call, &namesize)) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	char *name = malloc(namesize);
-	errno_t rc = async_data_write_finalize(&call, name, namesize);
-	if (rc != EOK) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	int file;
-	rc = vfs_receive_handle(true, &file);
-	if (rc != EOK) {
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	DPRINTF("LOADER_ADD_INBOX('%s')\n", name);
-
-	/*
-	 * We need to set the root early for dynamically linked binaries so
-	 * that the loader can use it too.
-	 */
-	if (str_cmp(name, "root") == 0)
-		vfs_root_set(file);
-
-	inbox[inbox_entries].name = name;
-	inbox[inbox_entries].file = file;
-	inbox_entries++;
-	async_answer_0(req, EOK);
-}
-
-/** Load the previously selected program.
- *
- * @return 0 on success, !0 on error.
- *
- */
-static int ldr_load(ipc_call_t *req)
-{
-	DPRINTF("LOADER_LOAD()\n");
-
-	errno_t rc = elf_load(program_fd, &prog_info);
-	if (rc != EOK) {
-		DPRINTF("Failed to load executable for '%s'.\n", progname);
-		async_answer_0(req, EINVAL);
-		return 1;
-	}
-
-	DPRINTF("Loaded.\n");
-
-#ifdef CONFIG_RTLD
-	assert(prog_info.env != NULL);
-	pcb.tcb = rtld_tls_make(prog_info.env);
-#else
-	pcb.tcb = tls_make(prog_info.finfo.base);
-#endif
-
-	if (!pcb.tcb) {
-		DPRINTF("Failed to make TLS for '%s'.\n", progname);
-		async_answer_0(req, ENOMEM);
-		return 1;
-	}
-
-	elf_set_pcb(&prog_info, &pcb);
-
-	DPRINTF("PCB set.\n");
-
-	pcb.cwd = cwd;
-
-	pcb.argc = argc;
-	pcb.argv = argv;
-
-	pcb.inbox = inbox;
-	pcb.inbox_entries = inbox_entries;
-
-	DPRINTF("Answering.\n");
-	async_answer_0(req, EOK);
-	return 0;
-}
-
-/** Run the previously loaded program.
- *
- * @return 0 on success, !0 on error.
- *
- */
-static __attribute__((noreturn)) void ldr_run(ipc_call_t *req)
-{
-	DPRINTF("Set task name\n");
-
-	/* Set the task name. */
-	task_set_name(progname);
-
-	/* Run program */
-	DPRINTF("Reply OK\n");
-	async_answer_0(req, EOK);
-
-	/*
-	 * Wait for the hangup from the other side in order not to leave any
-	 * unanswered IPC_M_PHONE_HUNGUP messages behind.
-	 */
-	async_get_call(req);
-	assert(!ipc_get_imethod(req));
-	async_answer_0(req, EOK);
-
-	DPRINTF("Jump to entry point at %p\n", pcb.entry);
-
-	__libc_fini();
-	__tcb_reset();
-	entry_point_jmp(prog_info.finfo.entry, &pcb);
-
-	/* Not reached */
-}
-
-/** Handle loader connection.
- *
- * Receive and carry out commands (of which the last one should be
- * to execute the loaded program).
- *
- */
-static void ldr_connection(ipc_call_t *icall, void *arg)
-{
-	/* Already have a connection? */
-	if (connected) {
-		async_answer_0(icall, ELIMIT);
-		return;
-	}
-
-	connected = true;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	/* Ignore parameters, the connection is already open */
-	(void) icall;
-
-	while (true) {
-		errno_t retval;
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			exit(0);
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOADER_GET_TASKID:
-			ldr_get_taskid(&call);
-			continue;
-		case LOADER_SET_CWD:
-			ldr_set_cwd(&call);
-			continue;
-		case LOADER_SET_PROGRAM:
-			ldr_set_program(&call);
-			continue;
-		case LOADER_SET_ARGS:
-			ldr_set_args(&call);
-			continue;
-		case LOADER_ADD_INBOX:
-			ldr_add_inbox(&call);
-			continue;
-		case LOADER_LOAD:
-			ldr_load(&call);
-			continue;
-		case LOADER_RUN:
-			ldr_run(&call);
-			/* Not reached */
-		default:
-			retval = EINVAL;
-			break;
-		}
-
-		async_answer_0(&call, retval);
-	}
-}
-
-/** Program loader main function.
- */
-int main(int argc, char *argv[])
-{
-	/* Introduce this task to the NS (give it our task ID). */
-	task_id_t id = task_get_id();
-	errno_t rc = ns_intro(id);
-	if (rc != EOK)
-		return rc;
-
-	/* Register at naming service. */
-	rc = service_register(SERVICE_LOADER, INTERFACE_LOADER,
-	    ldr_connection, NULL);
-	if (rc != EOK)
-		return rc;
-
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/loader/meson.build
===================================================================
--- uspace/srv/loader/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-if UARCH == 'ia64'
-	link_args += [ '-T', meson.current_source_dir() / 'elf64_ia64_loader.x' ]
-else
-	link_args += '-Wl,--Ttext-segment=0x70000000'
-endif
-
-src = files('main.c')
Index: pace/srv/locsrv/category.c
===================================================================
--- uspace/srv/locsrv/category.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,200 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locsrv
- * @{
- */
-/** @file Categories for location service.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include "category.h"
-#include "locsrv.h"
-
-/** Initialize category directory. */
-void categ_dir_init(categ_dir_t *cdir)
-{
-	fibril_mutex_initialize(&cdir->mutex);
-	list_initialize(&cdir->categories);
-}
-
-/** Add new category to directory. */
-void categ_dir_add_cat(categ_dir_t *cdir, category_t *cat)
-{
-	list_append(&cat->cat_list, &cdir->categories);
-}
-
-/** Get list of categories. */
-errno_t categ_dir_get_categories(categ_dir_t *cdir, category_id_t *id_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	assert(fibril_mutex_is_locked(&cdir->mutex));
-
-	buf_cnt = buf_size / sizeof(category_id_t);
-
-	act_cnt = list_count(&cdir->categories);
-	*act_size = act_cnt * sizeof(category_id_t);
-
-	if (buf_size % sizeof(category_id_t) != 0)
-		return EINVAL;
-
-	size_t pos = 0;
-	list_foreach(cdir->categories, cat_list, category_t, cat) {
-		if (pos < buf_cnt)
-			id_buf[pos] = cat->id;
-		pos++;
-	}
-
-	return EOK;
-}
-
-/** Initialize category structure. */
-static void category_init(category_t *cat, const char *name)
-{
-	fibril_mutex_initialize(&cat->mutex);
-	cat->name = str_dup(name);
-	cat->id = loc_create_id();
-	link_initialize(&cat->cat_list);
-	list_initialize(&cat->svc_memb);
-}
-
-/** Allocate new category. */
-category_t *category_new(const char *name)
-{
-	category_t *cat;
-
-	cat = malloc(sizeof(category_t));
-	if (cat == NULL)
-		return NULL;
-
-	category_init(cat, name);
-	return cat;
-}
-
-/** Add service to category. */
-errno_t category_add_service(category_t *cat, loc_service_t *svc)
-{
-	assert(fibril_mutex_is_locked(&cat->mutex));
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	/* Verify that category does not contain this service yet. */
-	list_foreach(cat->svc_memb, cat_link, svc_categ_t, memb) {
-		if (memb->svc == svc) {
-			return EEXIST;
-		}
-	}
-
-	svc_categ_t *nmemb = malloc(sizeof(svc_categ_t));
-	if (nmemb == NULL)
-		return ENOMEM;
-
-	nmemb->svc = svc;
-	nmemb->cat = cat;
-
-	list_append(&nmemb->cat_link, &cat->svc_memb);
-	list_append(&nmemb->svc_link, &svc->cat_memb);
-
-	return EOK;
-}
-
-/** Remove service from category. */
-void category_remove_service(svc_categ_t *memb)
-{
-	assert(fibril_mutex_is_locked(&memb->cat->mutex));
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	list_remove(&memb->cat_link);
-	list_remove(&memb->svc_link);
-
-	free(memb);
-}
-
-/** Get category by ID. */
-category_t *category_get(categ_dir_t *cdir, catid_t catid)
-{
-	assert(fibril_mutex_is_locked(&cdir->mutex));
-
-	list_foreach(cdir->categories, cat_list, category_t, cat) {
-		if (cat->id == catid)
-			return cat;
-	}
-
-	return NULL;
-}
-
-/** Find category by name. */
-category_t *category_find_by_name(categ_dir_t *cdir, const char *name)
-{
-	assert(fibril_mutex_is_locked(&cdir->mutex));
-
-	list_foreach(cdir->categories, cat_list, category_t, cat) {
-		if (str_cmp(cat->name, name) == 0)
-			return cat;
-	}
-
-	return NULL;
-}
-
-/** Get list of services in category. */
-errno_t category_get_services(category_t *cat, service_id_t *id_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	assert(fibril_mutex_is_locked(&cat->mutex));
-
-	buf_cnt = buf_size / sizeof(service_id_t);
-
-	act_cnt = list_count(&cat->svc_memb);
-	*act_size = act_cnt * sizeof(service_id_t);
-
-	if (buf_size % sizeof(service_id_t) != 0)
-		return EINVAL;
-
-	size_t pos = 0;
-	list_foreach(cat->svc_memb, cat_link, svc_categ_t, memb) {
-		if (pos < buf_cnt)
-			id_buf[pos] = memb->svc->id;
-		pos++;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/locsrv/category.h
===================================================================
--- uspace/srv/locsrv/category.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locsrv
- * @{
- */
-/** @file Categories for location service.
- */
-
-#ifndef CATEGORY_H_
-#define CATEGORY_H_
-
-#include <adt/list.h>
-#include "locsrv.h"
-
-typedef sysarg_t catid_t;
-
-/** Service category */
-typedef struct {
-	/** Protects this structure, list of services */
-	fibril_mutex_t mutex;
-
-	/** Identifier */
-	catid_t id;
-
-	/** Category name */
-	const char *name;
-
-	/** Link to list of categories (categ_dir_t.categories) */
-	link_t cat_list;
-
-	/** List of service memberships in this category (svc_categ_t) */
-	list_t svc_memb;
-} category_t;
-
-/** Service directory ogranized by categories (yellow pages) */
-typedef struct {
-	/** Protects this structure, list of categories */
-	fibril_mutex_t mutex;
-	/** List of all categories (category_t) */
-	list_t categories;
-} categ_dir_t;
-
-/** Service in category membership. */
-typedef struct {
-	/** Link to category_t.svc_memb list */
-	link_t cat_link;
-	/** Link to loc_service_t.cat_memb list */
-	link_t svc_link;
-
-	/** Category */
-	category_t *cat;
-	/** Service */
-	loc_service_t *svc;
-} svc_categ_t;
-
-extern void categ_dir_init(categ_dir_t *);
-extern void categ_dir_add_cat(categ_dir_t *, category_t *);
-extern errno_t categ_dir_get_categories(categ_dir_t *, service_id_t *, size_t,
-    size_t *);
-extern category_t *category_new(const char *);
-extern errno_t category_add_service(category_t *, loc_service_t *);
-extern void category_remove_service(svc_categ_t *);
-extern category_t *category_get(categ_dir_t *, catid_t);
-extern category_t *category_find_by_name(categ_dir_t *, const char *);
-extern errno_t category_get_services(category_t *, service_id_t *, size_t,
-    size_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/locsrv/doc/doxygroups.h
===================================================================
--- uspace/srv/locsrv/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup locsrv locsrv
- * @ingroup srvs
- * @brief Location service
- */
Index: pace/srv/locsrv/locsrv.c
===================================================================
--- uspace/srv/locsrv/locsrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1579 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2007 Josef Cejka
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup locsrv
- * @{
- */
-
-/** @file
- */
-
-#include <ipc/services.h>
-#include <ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <macros.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <ipc/loc.h>
-#include <assert.h>
-
-#include "category.h"
-#include "locsrv.h"
-
-#define NAME          "loc"
-#define NULL_SERVICES  256
-
-/** Callback session */
-typedef struct {
-	link_t cb_sess_list;
-	async_sess_t *sess;
-} cb_sess_t;
-
-LIST_INITIALIZE(services_list);
-LIST_INITIALIZE(namespaces_list);
-LIST_INITIALIZE(servers_list);
-
-/*
- * Locking order:
- *  servers_list_mutex
- *  services_list_mutex
- *  (loc_server_t *)->services_mutex
- *  create_id_mutex
- */
-
-FIBRIL_MUTEX_INITIALIZE(services_list_mutex);
-static FIBRIL_CONDVAR_INITIALIZE(services_list_cv);
-static FIBRIL_MUTEX_INITIALIZE(servers_list_mutex);
-static FIBRIL_MUTEX_INITIALIZE(create_id_mutex);
-static FIBRIL_MUTEX_INITIALIZE(null_services_mutex);
-
-static service_id_t last_id = 0;
-static loc_service_t *null_services[NULL_SERVICES];
-
-/*
- * Dummy list for null services. This is necessary so that null services can
- * be used just as any other services, e.g. in loc_service_unregister_core().
- */
-static LIST_INITIALIZE(dummy_null_services);
-
-/** Service directory ogranized by categories (yellow pages) */
-static categ_dir_t cdir;
-
-static FIBRIL_MUTEX_INITIALIZE(callback_sess_mutex);
-static LIST_INITIALIZE(callback_sess_list);
-
-service_id_t loc_create_id(void)
-{
-	/*
-	 * TODO: allow reusing old ids after their unregistration
-	 * and implement some version of LRU algorithm, avoid overflow
-	 */
-
-	fibril_mutex_lock(&create_id_mutex);
-	last_id++;
-	fibril_mutex_unlock(&create_id_mutex);
-
-	return last_id;
-}
-
-/** Convert fully qualified service name to namespace and service name.
- *
- * A fully qualified service name can be either a plain service name
- * (then the namespace is considered to be an empty string) or consist
- * of two components separated by a slash. No more than one slash
- * is allowed.
- *
- */
-static bool loc_fqsn_split(const char *fqsn, char **ns_name, char **name)
-{
-	size_t cnt = 0;
-	size_t slash_offset = 0;
-	size_t slash_after = 0;
-
-	size_t offset = 0;
-	size_t offset_prev = 0;
-	char32_t c;
-
-	while ((c = str_decode(fqsn, &offset, STR_NO_LIMIT)) != 0) {
-		if (c == '/') {
-			cnt++;
-			slash_offset = offset_prev;
-			slash_after = offset;
-		}
-		offset_prev = offset;
-	}
-
-	/* More than one slash */
-	if (cnt > 1)
-		return false;
-
-	/* No slash -> namespace is empty */
-	if (cnt == 0) {
-		*ns_name = str_dup("");
-		if (*ns_name == NULL)
-			return false;
-
-		*name = str_dup(fqsn);
-		if (*name == NULL) {
-			free(*ns_name);
-			return false;
-		}
-
-		if (str_cmp(*name, "") == 0) {
-			free(*name);
-			free(*ns_name);
-			return false;
-		}
-
-		return true;
-	}
-
-	/* Exactly one slash */
-	*ns_name = str_ndup(fqsn, slash_offset);
-	if (*ns_name == NULL)
-		return false;
-
-	*name = str_dup(fqsn + slash_after);
-	if (*name == NULL) {
-		free(*ns_name);
-		return false;
-	}
-
-	if (str_cmp(*name, "") == 0) {
-		free(*name);
-		free(*ns_name);
-		return false;
-	}
-
-	return true;
-}
-
-/** Find namespace with given name. */
-static loc_namespace_t *loc_namespace_find_name(const char *name)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
-		if (str_cmp(namespace->name, name) == 0)
-			return namespace;
-	}
-
-	return NULL;
-}
-
-/** Find namespace with given ID.
- *
- * @todo: use hash table
- *
- */
-static loc_namespace_t *loc_namespace_find_id(service_id_t id)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
-		if (namespace->id == id)
-			return namespace;
-	}
-
-	return NULL;
-}
-
-/** Find service with given name. */
-static loc_service_t *loc_service_find_name(const char *ns_name,
-    const char *name)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	list_foreach(services_list, services, loc_service_t, service) {
-		if ((str_cmp(service->namespace->name, ns_name) == 0) &&
-		    (str_cmp(service->name, name) == 0))
-			return service;
-	}
-
-	return NULL;
-}
-
-/** Find service with given ID.
- *
- * @todo: use hash table
- *
- */
-static loc_service_t *loc_service_find_id(service_id_t id)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	list_foreach(services_list, services, loc_service_t, service) {
-		if (service->id == id)
-			return service;
-	}
-
-	return NULL;
-}
-
-/** Create a namespace (if not already present). */
-static loc_namespace_t *loc_namespace_create(const char *ns_name)
-{
-	loc_namespace_t *namespace;
-
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	namespace = loc_namespace_find_name(ns_name);
-	if (namespace != NULL)
-		return namespace;
-
-	namespace = (loc_namespace_t *) malloc(sizeof(loc_namespace_t));
-	if (namespace == NULL)
-		return NULL;
-
-	namespace->name = str_dup(ns_name);
-	if (namespace->name == NULL) {
-		free(namespace);
-		return NULL;
-	}
-
-	namespace->id = loc_create_id();
-	namespace->refcnt = 0;
-
-	/*
-	 * Insert new namespace into list of registered namespaces
-	 */
-	list_append(&(namespace->namespaces), &namespaces_list);
-
-	return namespace;
-}
-
-/** Destroy a namespace (if it is no longer needed). */
-static void loc_namespace_destroy(loc_namespace_t *namespace)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	if (namespace->refcnt == 0) {
-		list_remove(&(namespace->namespaces));
-
-		free(namespace->name);
-		free(namespace);
-	}
-}
-
-/** Increase namespace reference count by including service. */
-static void loc_namespace_addref(loc_namespace_t *namespace,
-    loc_service_t *service)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	service->namespace = namespace;
-	namespace->refcnt++;
-}
-
-/** Decrease namespace reference count. */
-static void loc_namespace_delref(loc_namespace_t *namespace)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-
-	namespace->refcnt--;
-	loc_namespace_destroy(namespace);
-}
-
-/** Unregister service and free it. */
-static void loc_service_unregister_core(loc_service_t *service)
-{
-	assert(fibril_mutex_is_locked(&services_list_mutex));
-	assert(fibril_mutex_is_locked(&cdir.mutex));
-
-	loc_namespace_delref(service->namespace);
-	list_remove(&(service->services));
-	list_remove(&(service->server_services));
-
-	/* Remove service from all categories. */
-	while (!list_empty(&service->cat_memb)) {
-		link_t *link = list_first(&service->cat_memb);
-		svc_categ_t *memb = list_get_instance(link, svc_categ_t,
-		    svc_link);
-		category_t *cat = memb->cat;
-
-		fibril_mutex_lock(&cat->mutex);
-		category_remove_service(memb);
-		fibril_mutex_unlock(&cat->mutex);
-	}
-
-	free(service->name);
-	free(service);
-}
-
-/**
- * Read info about new server and add it into linked list of registered
- * servers.
- */
-static loc_server_t *loc_server_register(void)
-{
-	ipc_call_t icall;
-	async_get_call(&icall);
-
-	if (ipc_get_imethod(&icall) != LOC_SERVER_REGISTER) {
-		async_answer_0(&icall, EREFUSED);
-		return NULL;
-	}
-
-	loc_server_t *server =
-	    (loc_server_t *) malloc(sizeof(loc_server_t));
-	if (server == NULL) {
-		async_answer_0(&icall, ENOMEM);
-		return NULL;
-	}
-
-	/*
-	 * Get server name
-	 */
-	errno_t rc = async_data_write_accept((void **) &server->name, true, 0,
-	    LOC_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		free(server);
-		async_answer_0(&icall, rc);
-		return NULL;
-	}
-
-	/*
-	 * Create connection to the server
-	 */
-	server->sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (!server->sess) {
-		free(server->name);
-		free(server);
-		async_answer_0(&icall, ENOTSUP);
-		return NULL;
-	}
-
-	/*
-	 * Initialize mutex for list of services
-	 * supplied by this server
-	 */
-	fibril_mutex_initialize(&server->services_mutex);
-
-	/*
-	 * Initialize list of supplied services
-	 */
-	list_initialize(&server->services);
-	link_initialize(&server->servers);
-
-	fibril_mutex_lock(&servers_list_mutex);
-
-	/*
-	 * TODO:
-	 * Check that no server with name equal to
-	 * server->name is registered
-	 */
-
-	/*
-	 * Insert new server into list of registered servers
-	 */
-	list_append(&(server->servers), &servers_list);
-	fibril_mutex_unlock(&servers_list_mutex);
-
-	async_answer_0(&icall, EOK);
-
-	return server;
-}
-
-/**
- * Unregister server, unregister all its services and free server
- * structure.
- *
- */
-static errno_t loc_server_unregister(loc_server_t *server)
-{
-	if (server == NULL)
-		return EEXIST;
-
-	fibril_mutex_lock(&servers_list_mutex);
-
-	if (server->sess)
-		async_hangup(server->sess);
-
-	/* Remove it from list of servers */
-	list_remove(&(server->servers));
-
-	/* Unregister all its services */
-	fibril_mutex_lock(&services_list_mutex);
-	fibril_mutex_lock(&server->services_mutex);
-	fibril_mutex_lock(&cdir.mutex);
-
-	while (!list_empty(&server->services)) {
-		loc_service_t *service = list_get_instance(
-		    list_first(&server->services), loc_service_t,
-		    server_services);
-		loc_service_unregister_core(service);
-	}
-
-	fibril_mutex_unlock(&cdir.mutex);
-	fibril_mutex_unlock(&server->services_mutex);
-	fibril_mutex_unlock(&services_list_mutex);
-	fibril_mutex_unlock(&servers_list_mutex);
-
-	/* Free name and server */
-	if (server->name != NULL)
-		free(server->name);
-
-	free(server);
-
-	loc_category_change_event();
-	return EOK;
-}
-
-/** Register service
- *
- */
-static void loc_service_register(ipc_call_t *icall, loc_server_t *server)
-{
-	if (server == NULL) {
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	/* Create new service entry */
-	loc_service_t *service =
-	    (loc_service_t *) malloc(sizeof(loc_service_t));
-	if (service == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	/* Get fqsn */
-	char *fqsn;
-	errno_t rc = async_data_write_accept((void **) &fqsn, true, 0,
-	    LOC_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		free(service);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	char *ns_name;
-	if (!loc_fqsn_split(fqsn, &ns_name, &service->name)) {
-		free(fqsn);
-		free(service);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	free(fqsn);
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	loc_namespace_t *namespace = loc_namespace_create(ns_name);
-	free(ns_name);
-	if (namespace == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		free(service->name);
-		free(service);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	link_initialize(&service->services);
-	link_initialize(&service->server_services);
-	list_initialize(&service->cat_memb);
-
-	/* Check that service is not already registered */
-	if (loc_service_find_name(namespace->name, service->name) != NULL) {
-		printf("%s: Service '%s/%s' already registered\n", NAME,
-		    namespace->name, service->name);
-		loc_namespace_destroy(namespace);
-		fibril_mutex_unlock(&services_list_mutex);
-		free(service->name);
-		free(service);
-		async_answer_0(icall, EEXIST);
-		return;
-	}
-
-	/* Get unique service ID */
-	service->id = loc_create_id();
-
-	loc_namespace_addref(namespace, service);
-	service->server = server;
-
-	/* Insert service into list of all services  */
-	list_append(&service->services, &services_list);
-
-	/* Insert service into list of services supplied by one server */
-	fibril_mutex_lock(&service->server->services_mutex);
-
-	list_append(&service->server_services, &service->server->services);
-
-	fibril_mutex_unlock(&service->server->services_mutex);
-	fibril_condvar_broadcast(&services_list_cv);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	async_answer_1(icall, EOK, service->id);
-}
-
-/**
- *
- */
-static void loc_service_unregister(ipc_call_t *icall, loc_server_t *server)
-{
-	loc_service_t *svc;
-
-	fibril_mutex_lock(&services_list_mutex);
-	svc = loc_service_find_id(ipc_get_arg1(icall));
-	if (svc == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&cdir.mutex);
-	loc_service_unregister_core(svc);
-	fibril_mutex_unlock(&cdir.mutex);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	/*
-	 * First send out all notifications and only then answer the request.
-	 * Otherwise the current fibril might block and transitively wait for
-	 * the completion of requests that are routed to it via an IPC loop.
-	 */
-	loc_category_change_event();
-	async_answer_0(icall, EOK);
-}
-
-static void loc_category_get_name(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	category_t *cat;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	fibril_mutex_lock(&cdir.mutex);
-
-	cat = category_get(&cdir, ipc_get_arg1(icall));
-	if (cat == NULL) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	act_size = str_size(cat->name);
-	if (act_size > size) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, EOVERFLOW);
-		async_answer_0(icall, EOVERFLOW);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, cat->name,
-	    min(size, act_size));
-
-	fibril_mutex_unlock(&cdir.mutex);
-
-	async_answer_0(icall, retval);
-}
-
-static void loc_service_get_name(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	loc_service_t *svc;
-	char *fqn;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	svc = loc_service_find_id(ipc_get_arg1(icall));
-	if (svc == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (asprintf(&fqn, "%s/%s", svc->namespace->name, svc->name) < 0) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	act_size = str_size(fqn);
-	if (act_size > size) {
-		free(fqn);
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, EOVERFLOW);
-		async_answer_0(icall, EOVERFLOW);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, fqn,
-	    min(size, act_size));
-	free(fqn);
-
-	fibril_mutex_unlock(&services_list_mutex);
-
-	async_answer_0(icall, retval);
-}
-
-static void loc_service_get_server_name(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	loc_service_t *svc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	svc = loc_service_find_id(ipc_get_arg1(icall));
-	if (svc == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	if (svc->server == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	act_size = str_size(svc->server->name);
-	if (act_size > size) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, EOVERFLOW);
-		async_answer_0(icall, EOVERFLOW);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, svc->server->name,
-	    min(size, act_size));
-
-	fibril_mutex_unlock(&services_list_mutex);
-
-	async_answer_0(icall, retval);
-}
-
-/** Connect client to the service.
- *
- * Find server supplying requested service and forward
- * the message to it.
- *
- */
-static void loc_forward(ipc_call_t *call, void *arg)
-{
-	fibril_mutex_lock(&services_list_mutex);
-
-	/*
-	 * Get ID from request
-	 */
-	iface_t iface = ipc_get_arg1(call);
-	service_id_t id = ipc_get_arg2(call);
-	loc_service_t *svc = loc_service_find_id(id);
-
-	if ((svc == NULL) || (svc->server == NULL) || (!svc->server->sess)) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	async_exch_t *exch = async_exchange_begin(svc->server->sess);
-	async_forward_1(call, exch, iface, svc->id, IPC_FF_NONE);
-	async_exchange_end(exch);
-
-	fibril_mutex_unlock(&services_list_mutex);
-}
-
-/** Find ID for service identified by name.
- *
- * In answer will be send EOK and service ID in arg1 or a error
- * code from errno.h.
- *
- */
-static void loc_service_get_id(ipc_call_t *icall)
-{
-	char *fqsn;
-
-	/* Get fqsn */
-	errno_t rc = async_data_write_accept((void **) &fqsn, true, 0,
-	    LOC_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	char *ns_name;
-	char *name;
-	if (!loc_fqsn_split(fqsn, &ns_name, &name)) {
-		free(fqsn);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	free(fqsn);
-
-	fibril_mutex_lock(&services_list_mutex);
-	const loc_service_t *svc;
-
-recheck:
-
-	/*
-	 * Find service name in the list of known services.
-	 */
-	svc = loc_service_find_name(ns_name, name);
-
-	/*
-	 * Device was not found.
-	 */
-	if (svc == NULL) {
-		if (ipc_get_arg1(icall) & IPC_FLAG_BLOCKING) {
-			/* Blocking lookup */
-			fibril_condvar_wait(&services_list_cv,
-			    &services_list_mutex);
-			goto recheck;
-		}
-
-		async_answer_0(icall, ENOENT);
-		free(ns_name);
-		free(name);
-		fibril_mutex_unlock(&services_list_mutex);
-		return;
-	}
-
-	async_answer_1(icall, EOK, svc->id);
-
-	fibril_mutex_unlock(&services_list_mutex);
-	free(ns_name);
-	free(name);
-}
-
-/** Find ID for namespace identified by name.
- *
- * In answer will be send EOK and service ID in arg1 or a error
- * code from errno.h.
- *
- */
-static void loc_namespace_get_id(ipc_call_t *icall)
-{
-	char *name;
-
-	/* Get service name */
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
-	    LOC_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-	const loc_namespace_t *namespace;
-
-recheck:
-
-	/*
-	 * Find namespace name in the list of known namespaces.
-	 */
-	namespace = loc_namespace_find_name(name);
-
-	/*
-	 * Namespace was not found.
-	 */
-	if (namespace == NULL) {
-		if (ipc_get_arg1(icall) & IPC_FLAG_BLOCKING) {
-			/* Blocking lookup */
-			fibril_condvar_wait(&services_list_cv,
-			    &services_list_mutex);
-			goto recheck;
-		}
-
-		async_answer_0(icall, ENOENT);
-		free(name);
-		fibril_mutex_unlock(&services_list_mutex);
-		return;
-	}
-
-	async_answer_1(icall, EOK, namespace->id);
-
-	fibril_mutex_unlock(&services_list_mutex);
-	free(name);
-}
-
-/** Create callback connection.
- *
- * Create callback connection which will be used to send category change
- * events.
- *
- * On success, answer will contain EOK errno_t retval.
- * On failure, error code will be sent in retval.
- *
- */
-static void loc_callback_create(ipc_call_t *icall)
-{
-	cb_sess_t *cb_sess = calloc(1, sizeof(cb_sess_t));
-	if (cb_sess == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		free(cb_sess);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	cb_sess->sess = sess;
-	link_initialize(&cb_sess->cb_sess_list);
-
-	fibril_mutex_lock(&callback_sess_mutex);
-	list_append(&cb_sess->cb_sess_list, &callback_sess_list);
-	fibril_mutex_unlock(&callback_sess_mutex);
-
-	async_answer_0(icall, EOK);
-}
-
-void loc_category_change_event(void)
-{
-	fibril_mutex_lock(&callback_sess_mutex);
-
-	list_foreach(callback_sess_list, cb_sess_list, cb_sess_t, cb_sess) {
-		async_exch_t *exch = async_exchange_begin(cb_sess->sess);
-		async_msg_0(exch, LOC_EVENT_CAT_CHANGE);
-		async_exchange_end(exch);
-	}
-
-	fibril_mutex_unlock(&callback_sess_mutex);
-}
-
-/** Find ID for category specified by name.
- *
- * On success, answer will contain EOK errno_t retval and service ID in arg1.
- * On failure, error code will be sent in retval.
- *
- */
-static void loc_category_get_id(ipc_call_t *icall)
-{
-	char *name;
-	category_t *cat;
-
-	/* Get service name */
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
-	    LOC_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_mutex_lock(&cdir.mutex);
-
-	cat = category_find_by_name(&cdir, name);
-	if (cat == NULL) {
-		/* Category not found */
-		async_answer_0(icall, ENOENT);
-		goto cleanup;
-	}
-
-	async_answer_1(icall, EOK, cat->id);
-cleanup:
-	fibril_mutex_unlock(&cdir.mutex);
-	free(name);
-}
-
-static void loc_id_probe(ipc_call_t *icall)
-{
-	fibril_mutex_lock(&services_list_mutex);
-
-	loc_namespace_t *namespace =
-	    loc_namespace_find_id(ipc_get_arg1(icall));
-	if (namespace == NULL) {
-		loc_service_t *svc =
-		    loc_service_find_id(ipc_get_arg1(icall));
-		if (svc == NULL)
-			async_answer_1(icall, EOK, LOC_OBJECT_NONE);
-		else
-			async_answer_1(icall, EOK, LOC_OBJECT_SERVICE);
-	} else
-		async_answer_1(icall, EOK, LOC_OBJECT_NAMESPACE);
-
-	fibril_mutex_unlock(&services_list_mutex);
-}
-
-static void loc_get_namespace_count(ipc_call_t *icall)
-{
-	fibril_mutex_lock(&services_list_mutex);
-	async_answer_1(icall, EOK, list_count(&namespaces_list));
-	fibril_mutex_unlock(&services_list_mutex);
-}
-
-static void loc_get_service_count(ipc_call_t *icall)
-{
-	fibril_mutex_lock(&services_list_mutex);
-
-	loc_namespace_t *namespace =
-	    loc_namespace_find_id(ipc_get_arg1(icall));
-	if (namespace == NULL)
-		async_answer_0(icall, EEXIST);
-	else
-		async_answer_1(icall, EOK, namespace->refcnt);
-
-	fibril_mutex_unlock(&services_list_mutex);
-}
-
-static void loc_get_categories(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	category_id_t *id_buf = (category_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	fibril_mutex_lock(&cdir.mutex);
-
-	rc = categ_dir_get_categories(&cdir, id_buf, size, &act_size);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_mutex_unlock(&cdir.mutex);
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void loc_get_namespaces(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if ((size % sizeof(loc_sdesc_t)) != 0) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	size_t count = size / sizeof(loc_sdesc_t);
-	if (count != list_count(&namespaces_list)) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, EOVERFLOW);
-		async_answer_0(icall, EOVERFLOW);
-		return;
-	}
-
-	loc_sdesc_t *desc = (loc_sdesc_t *) malloc(size);
-	if (desc == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	size_t pos = 0;
-	list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
-		desc[pos].id = namespace->id;
-		str_cpy(desc[pos].name, LOC_NAME_MAXLEN, namespace->name);
-		pos++;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, desc, size);
-
-	free(desc);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	async_answer_0(icall, retval);
-}
-
-static void loc_get_services(ipc_call_t *icall)
-{
-	/*
-	 * FIXME: Use faster algorithm which can make better use
-	 * of namespaces
-	 */
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if ((size % sizeof(loc_sdesc_t)) != 0) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	loc_namespace_t *namespace =
-	    loc_namespace_find_id(ipc_get_arg1(icall));
-	if (namespace == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	size_t count = size / sizeof(loc_sdesc_t);
-	if (count != namespace->refcnt) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, EOVERFLOW);
-		async_answer_0(icall, EOVERFLOW);
-		return;
-	}
-
-	loc_sdesc_t *desc = (loc_sdesc_t *) malloc(size);
-	if (desc == NULL) {
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	size_t pos = 0;
-	list_foreach(services_list, services, loc_service_t, service) {
-		if (service->namespace == namespace) {
-			desc[pos].id = service->id;
-			str_cpy(desc[pos].name, LOC_NAME_MAXLEN, service->name);
-			pos++;
-		}
-	}
-
-	errno_t retval = async_data_read_finalize(&call, desc, size);
-
-	free(desc);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	async_answer_0(icall, retval);
-}
-
-static void loc_category_get_svcs(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	fibril_mutex_lock(&cdir.mutex);
-
-	category_t *cat = category_get(&cdir, ipc_get_arg1(icall));
-	if (cat == NULL) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	category_id_t *id_buf = (category_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	fibril_mutex_lock(&cat->mutex);
-
-	rc = category_get_services(cat, id_buf, size, &act_size);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&cat->mutex);
-		fibril_mutex_unlock(&cdir.mutex);
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	fibril_mutex_unlock(&cat->mutex);
-	fibril_mutex_unlock(&cdir.mutex);
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void loc_null_create(ipc_call_t *icall)
-{
-	fibril_mutex_lock(&null_services_mutex);
-
-	unsigned int i;
-	bool fnd = false;
-
-	for (i = 0; i < NULL_SERVICES; i++) {
-		if (null_services[i] == NULL) {
-			fnd = true;
-			break;
-		}
-	}
-
-	if (!fnd) {
-		fibril_mutex_unlock(&null_services_mutex);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	char null[LOC_NAME_MAXLEN];
-	snprintf(null, LOC_NAME_MAXLEN, "%u", i);
-
-	char *dev_name = str_dup(null);
-	if (dev_name == NULL) {
-		fibril_mutex_unlock(&null_services_mutex);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	loc_service_t *service =
-	    (loc_service_t *) malloc(sizeof(loc_service_t));
-	if (service == NULL) {
-		fibril_mutex_unlock(&null_services_mutex);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-
-	loc_namespace_t *namespace = loc_namespace_create("null");
-	if (namespace == NULL) {
-		fibril_mutex_lock(&services_list_mutex);
-		fibril_mutex_unlock(&null_services_mutex);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	link_initialize(&service->services);
-	link_initialize(&service->server_services);
-	list_initialize(&service->cat_memb);
-
-	/* Get unique service ID */
-	service->id = loc_create_id();
-	service->server = NULL;
-
-	loc_namespace_addref(namespace, service);
-	service->name = dev_name;
-
-	/*
-	 * Insert service into list of all services and into null services array.
-	 * Insert service into a dummy list of null server's services so that it
-	 * can be safely removed later.
-	 */
-	list_append(&service->services, &services_list);
-	list_append(&service->server_services, &dummy_null_services);
-	null_services[i] = service;
-
-	fibril_mutex_unlock(&services_list_mutex);
-	fibril_mutex_unlock(&null_services_mutex);
-
-	async_answer_1(icall, EOK, (sysarg_t) i);
-}
-
-static void loc_null_destroy(ipc_call_t *icall)
-{
-	sysarg_t i = ipc_get_arg1(icall);
-	if (i >= NULL_SERVICES) {
-		async_answer_0(icall, ELIMIT);
-		return;
-	}
-
-	fibril_mutex_lock(&null_services_mutex);
-
-	if (null_services[i] == NULL) {
-		fibril_mutex_unlock(&null_services_mutex);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&services_list_mutex);
-	fibril_mutex_lock(&cdir.mutex);
-	loc_service_unregister_core(null_services[i]);
-	fibril_mutex_unlock(&cdir.mutex);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	null_services[i] = NULL;
-
-	fibril_mutex_unlock(&null_services_mutex);
-	async_answer_0(icall, EOK);
-}
-
-static void loc_service_add_to_cat(ipc_call_t *icall)
-{
-	category_t *cat;
-	loc_service_t *svc;
-	catid_t cat_id;
-	service_id_t svc_id;
-	errno_t retval;
-
-	svc_id = ipc_get_arg1(icall);
-	cat_id = ipc_get_arg2(icall);
-
-	fibril_mutex_lock(&services_list_mutex);
-	fibril_mutex_lock(&cdir.mutex);
-
-	cat = category_get(&cdir, cat_id);
-	svc = loc_service_find_id(svc_id);
-
-	if (cat == NULL || svc == NULL) {
-		fibril_mutex_unlock(&cdir.mutex);
-		fibril_mutex_unlock(&services_list_mutex);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	fibril_mutex_lock(&cat->mutex);
-	retval = category_add_service(cat, svc);
-
-	fibril_mutex_unlock(&cat->mutex);
-	fibril_mutex_unlock(&cdir.mutex);
-	fibril_mutex_unlock(&services_list_mutex);
-
-	/*
-	 * First send out all notifications and only then answer the request.
-	 * Otherwise the current fibril might block and transitively wait for
-	 * the completion of requests that are routed to it via an IPC loop.
-	 */
-	loc_category_change_event();
-	async_answer_0(icall, retval);
-}
-
-/** Initialize location service.
- *
- *
- */
-static bool loc_init(void)
-{
-	unsigned int i;
-	category_t *cat;
-
-	for (i = 0; i < NULL_SERVICES; i++)
-		null_services[i] = NULL;
-
-	categ_dir_init(&cdir);
-
-	cat = category_new("disk");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("partition");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("iplink");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("keyboard");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("mouse");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("led");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("serial");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("console");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("clock");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("tbarcfg-notif");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("test3");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("usbdiag");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("usbhc");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("virt-null");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("virtual");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("nic");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("ieee80211");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("irc");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("display-device");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("audio-pcm");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("printer-port");
-	categ_dir_add_cat(&cdir, cat);
-
-	cat = category_new("pci");
-	categ_dir_add_cat(&cdir, cat);
-
-	return true;
-}
-
-/** Handle connection on supplier port.
- *
- */
-static void loc_connection_supplier(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection */
-	async_accept_0(icall);
-
-	/*
-	 * Each connection begins by a LOC_SERVER_REGISTER, which precludes us
-	 * from using parallel exchanges.
-	 */
-	static_assert((INTERFACE_LOC_SUPPLIER & IFACE_EXCHANGE_MASK) ==
-	    IFACE_EXCHANGE_SERIALIZE, "");
-
-	loc_server_t *server = loc_server_register();
-	if (server == NULL)
-		return;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOC_SERVER_UNREGISTER:
-			if (server == NULL)
-				async_answer_0(&call, ENOENT);
-			else
-				async_answer_0(&call, EOK);
-			break;
-		case LOC_SERVICE_ADD_TO_CAT:
-			/* Add service to category */
-			loc_service_add_to_cat(&call);
-			break;
-		case LOC_SERVICE_REGISTER:
-			/* Register one service */
-			loc_service_register(&call, server);
-			break;
-		case LOC_SERVICE_UNREGISTER:
-			/* Remove one service */
-			loc_service_unregister(&call, server);
-			break;
-		case LOC_SERVICE_GET_ID:
-			loc_service_get_id(&call);
-			break;
-		case LOC_NAMESPACE_GET_ID:
-			loc_namespace_get_id(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOENT);
-		}
-	}
-
-	if (server != NULL) {
-		/*
-		 * Unregister the server and all its services.
-		 */
-		loc_server_unregister(server);
-		server = NULL;
-	}
-}
-
-/** Handle connection on consumer port.
- *
- */
-static void loc_connection_consumer(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOC_SERVICE_GET_ID:
-			loc_service_get_id(&call);
-			break;
-		case LOC_SERVICE_GET_NAME:
-			loc_service_get_name(&call);
-			break;
-		case LOC_SERVICE_GET_SERVER_NAME:
-			loc_service_get_server_name(&call);
-			break;
-		case LOC_NAMESPACE_GET_ID:
-			loc_namespace_get_id(&call);
-			break;
-		case LOC_CALLBACK_CREATE:
-			loc_callback_create(&call);
-			break;
-		case LOC_CATEGORY_GET_ID:
-			loc_category_get_id(&call);
-			break;
-		case LOC_CATEGORY_GET_NAME:
-			loc_category_get_name(&call);
-			break;
-		case LOC_CATEGORY_GET_SVCS:
-			loc_category_get_svcs(&call);
-			break;
-		case LOC_ID_PROBE:
-			loc_id_probe(&call);
-			break;
-		case LOC_NULL_CREATE:
-			loc_null_create(&call);
-			break;
-		case LOC_NULL_DESTROY:
-			loc_null_destroy(&call);
-			break;
-		case LOC_GET_NAMESPACE_COUNT:
-			loc_get_namespace_count(&call);
-			break;
-		case LOC_GET_SERVICE_COUNT:
-			loc_get_service_count(&call);
-			break;
-		case LOC_GET_CATEGORIES:
-			loc_get_categories(&call);
-			break;
-		case LOC_GET_NAMESPACES:
-			loc_get_namespaces(&call);
-			break;
-		case LOC_GET_SERVICES:
-			loc_get_services(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOENT);
-		}
-	}
-}
-
-/**
- *
- */
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS Location Service\n", NAME);
-
-	if (!loc_init()) {
-		printf("%s: Error while initializing service\n", NAME);
-		return -1;
-	}
-
-	/* Register location service at naming service */
-	errno_t rc = service_register(SERVICE_LOC, INTERFACE_LOC_SUPPLIER,
-	    loc_connection_supplier, NULL);
-	if (rc != EOK) {
-		printf("%s: Error while registering supplier service: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_LOC, INTERFACE_LOC_CONSUMER,
-	    loc_connection_consumer, NULL);
-	if (rc != EOK) {
-		printf("%s: Error while registering consumer service: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = service_register_broker(SERVICE_LOC, loc_forward, NULL);
-	if (rc != EOK) {
-		printf("%s: Error while registering broker service: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/locsrv/locsrv.h
===================================================================
--- uspace/srv/locsrv/locsrv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,119 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup locsrv
- * @{
- */
-/** @file HelenOS location service.
- */
-
-#ifndef LOCSRV_H_
-#define LOCSRV_H_
-
-#include <ipc/loc.h>
-#include <async.h>
-#include <fibril_synch.h>
-#include <stddef.h>
-
-/** Representation of server (supplier).
- *
- * Each server supplies a set of services.
- *
- */
-typedef struct {
-	/** Link to servers_list */
-	link_t servers;
-
-	/** List of services supplied by this server */
-	list_t services;
-
-	/** Session asociated with this server */
-	async_sess_t *sess;
-
-	/** Server name */
-	char *name;
-
-	/** Fibril mutex for list of services owned by this server */
-	fibril_mutex_t services_mutex;
-} loc_server_t;
-
-/** Info about registered namespaces
- *
- */
-typedef struct {
-	/** Link to namespaces_list */
-	link_t namespaces;
-
-	/** Unique namespace identifier */
-	service_id_t id;
-
-	/** Namespace name */
-	char *name;
-
-	/** Reference count */
-	size_t refcnt;
-} loc_namespace_t;
-
-/** Info about registered service
- *
- */
-typedef struct {
-	/** Link to global list of services (services_list) */
-	link_t services;
-
-	/** Link to server list of services (loc_server_t.services) */
-	link_t server_services;
-
-	/** Link to list of services in category (category_t.services) */
-	link_t cat_services;
-
-	/** List of category memberships (svc_categ_t) */
-	list_t cat_memb;
-
-	/** Unique service identifier */
-	service_id_t id;
-
-	/** Service namespace */
-	loc_namespace_t *namespace;
-
-	/** Service name */
-	char *name;
-
-	/** Supplier of this service */
-	loc_server_t *server;
-} loc_service_t;
-
-extern fibril_mutex_t services_list_mutex;
-
-extern service_id_t loc_create_id(void);
-extern void loc_category_change_event(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/locsrv/meson.build
===================================================================
--- uspace/srv/locsrv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files('category.c', 'locsrv.c')
Index: pace/srv/logger/ctl.c
===================================================================
--- uspace/srv/logger/ctl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup logger
- * @{
- */
-
-/** @file
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <io/logctl.h>
-#include <ipc/logger.h>
-#include <vfs/vfs.h>
-#include "logger.h"
-
-static errno_t handle_log_level_change(sysarg_t new_level)
-{
-	void *full_name;
-	errno_t rc = async_data_write_accept(&full_name, true, 0, 0, 0, NULL);
-	if (rc != EOK) {
-		return rc;
-	}
-
-	logger_log_t *log = find_log_by_name_and_lock(full_name);
-	free(full_name);
-	if (log == NULL)
-		return ENOENT;
-
-	log->logged_level = new_level;
-
-	log_unlock(log);
-
-	return EOK;
-}
-
-void logger_connection_handler_control(ipc_call_t *icall)
-{
-	errno_t rc;
-	int fd;
-
-	async_accept_0(icall);
-	logger_log("control: new client.\n");
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOGGER_CONTROL_SET_DEFAULT_LEVEL:
-			rc = set_default_logging_level(ipc_get_arg1(&call));
-			async_answer_0(&call, rc);
-			break;
-		case LOGGER_CONTROL_SET_LOG_LEVEL:
-			rc = handle_log_level_change(ipc_get_arg1(&call));
-			async_answer_0(&call, rc);
-			break;
-		case LOGGER_CONTROL_SET_ROOT:
-			rc = vfs_receive_handle(true, &fd);
-			if (rc == EOK) {
-				rc = vfs_root_set(fd);
-				vfs_put(fd);
-			}
-			async_answer_0(&call, rc);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-
-	logger_log("control: client terminated.\n");
-}
-
-/**
- * @}
- */
Index: pace/srv/logger/doc/doxygroups.h
===================================================================
--- uspace/srv/logger/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup logger logger
- * @ingroup srvs
- * @brief Logging service
- */
Index: pace/srv/logger/initlvl.c
===================================================================
--- uspace/srv/logger/initlvl.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,100 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup logger
- * @{
- */
-
-/** @file
- */
-#include <errno.h>
-#include <str_error.h>
-#include <sysinfo.h>
-#include <str.h>
-#include <stdlib.h>
-#include "logger.h"
-
-static void parse_single_level_setting(char *setting)
-{
-	char *tmp;
-	char *key = str_tok(setting, "=", &tmp);
-	char *value = str_tok(tmp, "=", &tmp);
-	if (key == NULL)
-		return;
-	if (value == NULL) {
-		log_level_t level;
-		errno_t rc = log_level_from_str(key, &level);
-		if (rc != EOK)
-			return;
-		set_default_logging_level(level);
-		return;
-	}
-
-	log_level_t level;
-	errno_t rc = log_level_from_str(value, &level);
-	if (rc != EOK)
-		return;
-
-	logger_log_t *log = find_or_create_log_and_lock(key, 0);
-	if (log == NULL)
-		return;
-
-	log->logged_level = level;
-	log->ref_counter++;
-
-	log_unlock(log);
-}
-
-void parse_level_settings(char *settings)
-{
-	char *tmp;
-	char *single_setting = str_tok(settings, " ", &tmp);
-	while (single_setting != NULL) {
-		parse_single_level_setting(single_setting);
-		single_setting = str_tok(tmp, " ", &tmp);
-	}
-}
-
-void parse_initial_settings(void)
-{
-	size_t argument_size;
-	void *argument = sysinfo_get_data("init_args.logger", &argument_size);
-	if (argument == NULL)
-		return;
-
-	char level_str[200];
-	str_cpy(level_str, 200, (const char *) argument);
-	free(argument);
-
-	parse_level_settings(level_str);
-}
-
-/**
- * @}
- */
Index: pace/srv/logger/level.c
===================================================================
--- uspace/srv/logger/level.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup logger
- * @{
- */
-
-/** @file
- */
-
-#include <errno.h>
-#include "logger.h"
-
-log_level_t default_logging_level = LVL_NOTE;
-static FIBRIL_MUTEX_INITIALIZE(default_logging_level_guard);
-
-log_level_t get_default_logging_level(void)
-{
-	fibril_mutex_lock(&default_logging_level_guard);
-	log_level_t result = default_logging_level;
-	fibril_mutex_unlock(&default_logging_level_guard);
-	return result;
-}
-
-errno_t set_default_logging_level(log_level_t new_level)
-{
-	if (new_level >= LVL_LIMIT)
-		return ERANGE;
-	fibril_mutex_lock(&default_logging_level_guard);
-	default_logging_level = new_level;
-	fibril_mutex_unlock(&default_logging_level_guard);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/logger/logger.h
===================================================================
--- uspace/srv/logger/logger.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup logger
- * @{
- */
-/** @file Common logger service definitions.
- */
-
-#ifndef LOGGER_H_
-#define LOGGER_H_
-
-#include <adt/list.h>
-#include <adt/prodcons.h>
-#include <io/log.h>
-#include <async.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <stdio.h>
-
-#define NAME "logger"
-#define LOG_LEVEL_USE_DEFAULT (LVL_LIMIT + 1)
-
-#ifdef LOGGER_LOG
-#define logger_log(fmt, ...) printf(NAME ": " fmt, ##__VA_ARGS__)
-#else
-#define logger_log(fmt, ...) (void)0
-#endif
-
-typedef struct logger_log logger_log_t;
-
-typedef struct {
-	fibril_mutex_t guard;
-	char *filename;
-	FILE *logfile;
-} logger_dest_t;
-
-struct logger_log {
-	link_t link;
-
-	size_t ref_counter;
-
-	fibril_mutex_t guard;
-
-	char *name;
-	char *full_name;
-	logger_log_t *parent;
-	log_level_t logged_level;
-	logger_dest_t *dest;
-};
-
-#define MAX_REFERENCED_LOGS_PER_CLIENT 100
-
-typedef struct {
-	size_t logs_count;
-	logger_log_t *logs[MAX_REFERENCED_LOGS_PER_CLIENT];
-} logger_registered_logs_t;
-
-logger_log_t *find_log_by_name_and_lock(const char *name);
-logger_log_t *find_or_create_log_and_lock(const char *, sysarg_t);
-logger_log_t *find_log_by_id_and_lock(sysarg_t);
-bool shall_log_message(logger_log_t *, log_level_t);
-void log_unlock(logger_log_t *);
-void write_to_log(logger_log_t *, log_level_t, const char *);
-void log_release(logger_log_t *);
-
-void registered_logs_init(logger_registered_logs_t *);
-bool register_log(logger_registered_logs_t *, logger_log_t *);
-void unregister_logs(logger_registered_logs_t *);
-
-log_level_t get_default_logging_level(void);
-errno_t set_default_logging_level(log_level_t);
-
-void logger_connection_handler_control(ipc_call_t *);
-void logger_connection_handler_writer(ipc_call_t *);
-
-void parse_initial_settings(void);
-void parse_level_settings(char *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/logger/logs.c
===================================================================
--- uspace/srv/logger/logs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,335 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup logger
- * @{
- */
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "logger.h"
-
-static FIBRIL_MUTEX_INITIALIZE(log_list_guard);
-static LIST_INITIALIZE(log_list);
-
-static logger_log_t *find_log_by_name_and_parent_no_list_lock(const char *name, logger_log_t *parent)
-{
-	list_foreach(log_list, link, logger_log_t, log) {
-		if ((parent == log->parent) && (str_cmp(log->name, name) == 0))
-			return log;
-	}
-
-	return NULL;
-}
-
-static errno_t create_dest(const char *name, logger_dest_t **dest)
-{
-	logger_dest_t *result = malloc(sizeof(logger_dest_t));
-	if (result == NULL)
-		return ENOMEM;
-	if (asprintf(&result->filename, "/log/%s.txt", name) < 0) {
-		free(result);
-		return ENOMEM;
-	}
-	result->logfile = NULL;
-	fibril_mutex_initialize(&result->guard);
-	*dest = result;
-	return EOK;
-}
-
-static logger_log_t *create_log_no_locking(const char *name, logger_log_t *parent)
-{
-	logger_log_t *result = calloc(1, sizeof(logger_log_t));
-	if (result == NULL)
-		return NULL;
-
-	result->name = str_dup(name);
-	if (result->name == NULL)
-		goto error;
-
-	/*
-	 * Notice that we create new dest as the last
-	 * operation that can fail and thus there is no code
-	 * to deallocate dest.
-	 */
-	if (parent == NULL) {
-		result->full_name = str_dup(name);
-		if (result->full_name == NULL)
-			goto error;
-		errno_t rc = create_dest(name, &result->dest);
-		if (rc != EOK)
-			goto error;
-	} else {
-		if (asprintf(&result->full_name, "%s/%s",
-		    parent->full_name, name) < 0)
-			goto error;
-		result->dest = parent->dest;
-	}
-
-	/* Following initializations cannot fail. */
-	result->logged_level = LOG_LEVEL_USE_DEFAULT;
-	fibril_mutex_initialize(&result->guard);
-	link_initialize(&result->link);
-	result->parent = parent;
-
-	return result;
-
-error:
-	free(result->name);
-	free(result->full_name);
-	free(result);
-	return NULL;
-
-}
-
-logger_log_t *find_or_create_log_and_lock(const char *name, sysarg_t parent_id)
-{
-	logger_log_t *result = NULL;
-	logger_log_t *parent = (logger_log_t *) parent_id;
-
-	fibril_mutex_lock(&log_list_guard);
-
-	result = find_log_by_name_and_parent_no_list_lock(name, parent);
-	if (result == NULL) {
-		result = create_log_no_locking(name, parent);
-		if (result == NULL)
-			goto leave;
-		list_append(&result->link, &log_list);
-		if (result->parent != NULL) {
-			fibril_mutex_lock(&result->parent->guard);
-			result->parent->ref_counter++;
-			fibril_mutex_unlock(&result->parent->guard);
-		}
-	}
-
-	fibril_mutex_lock(&result->guard);
-
-leave:
-	fibril_mutex_unlock(&log_list_guard);
-
-	return result;
-}
-
-logger_log_t *find_log_by_name_and_lock(const char *name)
-{
-	logger_log_t *result = NULL;
-
-	fibril_mutex_lock(&log_list_guard);
-	list_foreach(log_list, link, logger_log_t, log) {
-		if (str_cmp(log->full_name, name) == 0) {
-			fibril_mutex_lock(&log->guard);
-			result = log;
-			break;
-		}
-	}
-	fibril_mutex_unlock(&log_list_guard);
-
-	return result;
-}
-
-logger_log_t *find_log_by_id_and_lock(sysarg_t id)
-{
-	logger_log_t *result = NULL;
-
-	fibril_mutex_lock(&log_list_guard);
-	list_foreach(log_list, link, logger_log_t, log) {
-		if ((sysarg_t) log == id) {
-			fibril_mutex_lock(&log->guard);
-			result = log;
-			break;
-		}
-	}
-	fibril_mutex_unlock(&log_list_guard);
-
-	return result;
-}
-
-static log_level_t get_actual_log_level(logger_log_t *log)
-{
-	/* Find recursively proper log level. */
-	if (log->logged_level == LOG_LEVEL_USE_DEFAULT) {
-		if (log->parent == NULL)
-			return get_default_logging_level();
-		else
-			return get_actual_log_level(log->parent);
-	}
-	return log->logged_level;
-}
-
-bool shall_log_message(logger_log_t *log, log_level_t level)
-{
-	fibril_mutex_lock(&log_list_guard);
-	bool result = level <= get_actual_log_level(log);
-	fibril_mutex_unlock(&log_list_guard);
-	return result;
-}
-
-void log_unlock(logger_log_t *log)
-{
-	assert(fibril_mutex_is_locked(&log->guard));
-	fibril_mutex_unlock(&log->guard);
-}
-
-/** Decreases reference counter on the log and destroy the log if
- * necessary.
- *
- * Precondition: log is locked.
- *
- * @param log Log to release from using by the caller.
- */
-void log_release(logger_log_t *log)
-{
-	assert(fibril_mutex_is_locked(&log->guard));
-	assert(log->ref_counter > 0);
-
-	/* We are definitely not the last ones. */
-	if (log->ref_counter > 1) {
-		log->ref_counter--;
-		fibril_mutex_unlock(&log->guard);
-		return;
-	}
-
-	/*
-	 * To prevent deadlock, we need to get the list lock first.
-	 * Deadlock scenario:
-	 * Us: LOCKED(log), want to LOCK(list)
-	 * Someone else calls find_log_by_name_and_lock(log->fullname) ->
-	 *   LOCKED(list), wants to LOCK(log)
-	 */
-	fibril_mutex_unlock(&log->guard);
-
-	/* Ensuring correct locking order. */
-	fibril_mutex_lock(&log_list_guard);
-	/*
-	 * The reference must be still valid because we have not decreased
-	 * the reference counter.
-	 */
-	fibril_mutex_lock(&log->guard);
-	assert(log->ref_counter > 0);
-	log->ref_counter--;
-
-	if (log->ref_counter > 0) {
-		/*
-		 * Meanwhile, someone else increased the ref counter.
-		 * No big deal, we just return immediatelly.
-		 */
-		fibril_mutex_unlock(&log->guard);
-		fibril_mutex_unlock(&log_list_guard);
-		return;
-	}
-
-	/*
-	 * Here we are on a destroy path. We need to
-	 * - remove ourselves from the list
-	 * - decrease reference of the parent (if not top-level log)
-	 *   - we must do that after we relaase list lock to prevent
-	 *     deadlock with ourselves
-	 * - destroy dest (if top-level log)
-	 */
-	assert(log->ref_counter == 0);
-
-	list_remove(&log->link);
-	fibril_mutex_unlock(&log_list_guard);
-	fibril_mutex_unlock(&log->guard);
-
-	if (log->parent == NULL) {
-		/*
-		 * Due to lazy file opening in write_to_log(),
-		 * it is possible that no file was actually opened.
-		 */
-		if (log->dest->logfile != NULL) {
-			fclose(log->dest->logfile);
-		}
-		free(log->dest->filename);
-		free(log->dest);
-	} else {
-		fibril_mutex_lock(&log->parent->guard);
-		log_release(log->parent);
-	}
-
-	logger_log("Destroyed log %s.\n", log->full_name);
-
-	free(log->name);
-	free(log->full_name);
-
-	free(log);
-}
-
-void write_to_log(logger_log_t *log, log_level_t level, const char *message)
-{
-	assert(fibril_mutex_is_locked(&log->guard));
-	assert(log->dest != NULL);
-	fibril_mutex_lock(&log->dest->guard);
-	if (log->dest->logfile == NULL)
-		log->dest->logfile = fopen(log->dest->filename, "a");
-
-	if (log->dest->logfile != NULL) {
-		fprintf(log->dest->logfile, "[%s] %s: %s\n",
-		    log->full_name, log_level_str(level),
-		    (const char *) message);
-		fflush(log->dest->logfile);
-	}
-
-	fibril_mutex_unlock(&log->dest->guard);
-}
-
-void registered_logs_init(logger_registered_logs_t *logs)
-{
-	logs->logs_count = 0;
-}
-
-bool register_log(logger_registered_logs_t *logs, logger_log_t *new_log)
-{
-	if (logs->logs_count >= MAX_REFERENCED_LOGS_PER_CLIENT) {
-		return false;
-	}
-
-	assert(fibril_mutex_is_locked(&new_log->guard));
-	new_log->ref_counter++;
-
-	logs->logs[logs->logs_count] = new_log;
-	logs->logs_count++;
-
-	return true;
-}
-
-void unregister_logs(logger_registered_logs_t *logs)
-{
-	for (size_t i = 0; i < logs->logs_count; i++) {
-		logger_log_t *log = logs->logs[i];
-		fibril_mutex_lock(&log->guard);
-		log_release(log);
-	}
-}
-
-/**
- * @}
- */
Index: pace/srv/logger/main.c
===================================================================
--- uspace/srv/logger/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup logger
- * @{
- */
-
-/** @file
- */
-
-#include <ipc/services.h>
-#include <ipc/logger.h>
-#include <io/log.h>
-#include <io/logctl.h>
-#include <ns.h>
-#include <async.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <str_error.h>
-#include "logger.h"
-
-static void connection_handler_control(ipc_call_t *icall, void *arg)
-{
-	logger_connection_handler_control(icall);
-}
-
-static void connection_handler_writer(ipc_call_t *icall, void *arg)
-{
-	logger_connection_handler_writer(icall);
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS Logging Service\n");
-
-	parse_initial_settings();
-	for (int i = 1; i < argc; i++) {
-		parse_level_settings(argv[i]);
-	}
-
-	errno_t rc = service_register(SERVICE_LOGGER, INTERFACE_LOGGER_CONTROL,
-	    connection_handler_control, NULL);
-	if (rc != EOK) {
-		printf("%s: Failed to register control port: %s.\n", NAME,
-		    str_error(rc));
-		return -1;
-	}
-
-	rc = service_register(SERVICE_LOGGER, INTERFACE_LOGGER_WRITER,
-	    connection_handler_writer, NULL);
-	if (rc != EOK) {
-		printf("%s: Failed to register writer port: %s.\n", NAME,
-		    str_error(rc));
-		return -1;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	async_manager();
-
-	/* Never reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/logger/meson.build
===================================================================
--- uspace/srv/logger/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2012 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'ctl.c',
-	'initlvl.c',
-	'level.c',
-	'logs.c',
-	'main.c',
-	'writer.c',
-)
Index: pace/srv/logger/writer.c
===================================================================
--- uspace/srv/logger/writer.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/*
- * Copyright (c) 2012 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @addtogroup logger
- * @{
- */
-
-/** @file
- */
-
-#include <ipc/services.h>
-#include <ipc/logger.h>
-#include <io/log.h>
-#include <io/logctl.h>
-#include <io/klog.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include "logger.h"
-
-static logger_log_t *handle_create_log(sysarg_t parent)
-{
-	void *name;
-	errno_t rc = async_data_write_accept(&name, true, 1, 0, 0, NULL);
-	if (rc != EOK)
-		return NULL;
-
-	logger_log_t *log = find_or_create_log_and_lock(name, parent);
-
-	free(name);
-
-	return log;
-}
-
-static errno_t handle_receive_message(sysarg_t log_id, sysarg_t level)
-{
-	logger_log_t *log = find_log_by_id_and_lock(log_id);
-	if (log == NULL)
-		return ENOENT;
-
-	void *message = NULL;
-	errno_t rc = async_data_write_accept(&message, true, 1, 0, 0, NULL);
-	if (rc != EOK)
-		goto leave;
-
-	if (!shall_log_message(log, level)) {
-		rc = EOK;
-		goto leave;
-	}
-
-	KLOG_PRINTF(level, "[%s] %s: %s",
-	    log->full_name, log_level_str(level),
-	    (const char *) message);
-	write_to_log(log, level, message);
-
-	rc = EOK;
-
-leave:
-	log_unlock(log);
-	free(message);
-
-	return rc;
-}
-
-void logger_connection_handler_writer(ipc_call_t *icall)
-{
-	logger_log_t *log;
-	errno_t rc;
-
-	/* Acknowledge the connection. */
-	async_accept_0(icall);
-
-	logger_log("writer: new client.\n");
-
-	logger_registered_logs_t registered_logs;
-	registered_logs_init(&registered_logs);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case LOGGER_WRITER_CREATE_LOG:
-			log = handle_create_log(ipc_get_arg1(&call));
-			if (log == NULL) {
-				async_answer_0(&call, ENOMEM);
-				break;
-			}
-			if (!register_log(&registered_logs, log)) {
-				log_unlock(log);
-				async_answer_0(&call, ELIMIT);
-				break;
-			}
-			log_unlock(log);
-			async_answer_1(&call, EOK, (sysarg_t) log);
-			break;
-		case LOGGER_WRITER_MESSAGE:
-			rc = handle_receive_message(ipc_get_arg1(&call),
-			    ipc_get_arg2(&call));
-			async_answer_0(&call, rc);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-			break;
-		}
-	}
-
-	unregister_logs(&registered_logs);
-	logger_log("writer: client terminated.\n");
-}
-
-/**
- * @}
- */
Index: pace/srv/meson.build
===================================================================
--- uspace/srv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# Copyright (c) 2019 Jiří Zárevúcky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-srvs = [
-	'audio/hound',
-	'bd/file_bd',
-	'bd/rd',
-	'bd/sata_bd',
-	'bd/vbd',
-	'clipboard',
-	'devman',
-	'fs/cdfs',
-	'fs/exfat',
-	'fs/ext4fs',
-	'fs/fat',
-	'fs/locfs',
-	'fs/mfs',
-	'fs/tmpfs',
-	'fs/udf',
-	'hid/console',
-	'hid/display',
-	'hid/input',
-	'hid/isdv4_tablet',
-	'hid/output',
-	'hid/remcons',
-	'hid/rfb',
-	'hid/s3c24xx_ts',
-	'hw/char/s3c24xx_uart',
-	'klog',
-	'loader',
-	'locsrv',
-	'logger',
-	'net/dhcp',
-	'net/dnsrsrv',
-	'net/ethip',
-	'net/inetsrv',
-	'net/loopip',
-	'net/slip',
-	'net/tcp',
-	'net/udp',
-	'ns',
-	'system',
-	'taskmon',
-	'test/chardev-test',
-	'test/ipc-test',
-	'vfs',
-	'volsrv',
-]
Index: pace/srv/net/dhcp/dhcp.c
===================================================================
--- uspace/srv/net/dhcp/dhcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,698 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- * @brief DHCP client
- */
-
-#include <adt/list.h>
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <str_error.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/dnsr.h>
-#include <inet/inetcfg.h>
-#include <io/log.h>
-#include <loc.h>
-#include <rndgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include "dhcp.h"
-#include "dhcp_std.h"
-#include "transport.h"
-
-enum {
-	/** In microseconds */
-	dhcp_discover_timeout_val = 5 * 1000 * 1000,
-	/** In microseconds */
-	dhcp_request_timeout_val = 1 * 1000 * 1000,
-	dhcp_discover_retries = 5,
-	dhcp_request_retries = 3
-};
-
-#define MAX_MSG_SIZE 1024
-static uint8_t msgbuf[MAX_MSG_SIZE];
-
-/** List of registered links (of dhcp_link_t) */
-static list_t dhcp_links;
-
-bool inetcfg_inited = false;
-
-static void dhcpsrv_discover_timeout(void *);
-static void dhcpsrv_request_timeout(void *);
-
-typedef enum {
-	ds_bound,
-	ds_fail,
-	ds_init,
-	ds_init_reboot,
-	ds_rebinding,
-	ds_renewing,
-	ds_requesting,
-	ds_selecting
-} dhcp_state_t;
-
-typedef struct {
-	/** Message type */
-	enum dhcp_msg_type msg_type;
-	/** Offered address */
-	inet_naddr_t oaddr;
-	/** Server address */
-	inet_addr_t srv_addr;
-	/** Router address */
-	inet_addr_t router;
-	/** DNS server */
-	inet_addr_t dns_server;
-	/** Transaction ID */
-	uint32_t xid;
-} dhcp_offer_t;
-
-typedef struct {
-	/** Link to dhcp_links list */
-	link_t links;
-	/** Link service ID */
-	service_id_t link_id;
-	/** Link info */
-	inet_link_info_t link_info;
-	/** Transport */
-	dhcp_transport_t dt;
-	/** Transport timeout */
-	fibril_timer_t *timeout;
-	/** Number of retries */
-	int retries_left;
-	/** Link state */
-	dhcp_state_t state;
-	/** Last received offer */
-	dhcp_offer_t offer;
-	/** Random number generator */
-	rndgen_t *rndgen;
-} dhcp_link_t;
-
-static void dhcpsrv_recv(void *, void *, size_t);
-
-/** Decode subnet mask into subnet prefix length. */
-static errno_t subnet_mask_decode(uint32_t mask, int *bits)
-{
-	int zbits;
-	uint32_t nmask;
-
-	if (mask == 0xffffffff) {
-		*bits = 32;
-		return EOK;
-	}
-
-	zbits = 1 + fnzb32(mask ^ 0xffffffff);
-	nmask = BIT_RRANGE(uint32_t, zbits);
-
-	if ((mask ^ nmask) != 0xffffffff) {
-		/* The mask is not in the form 1**n,0**m */
-		return EINVAL;
-	}
-
-	*bits = 32 - zbits;
-	return EOK;
-}
-
-static uint32_t dhcp_uint32_decode(uint8_t *data)
-{
-	return
-	    ((uint32_t)data[0] << 24) |
-	    ((uint32_t)data[1] << 16) |
-	    ((uint32_t)data[2] << 8) |
-	    ((uint32_t)data[3]);
-}
-
-static errno_t dhcp_send_discover(dhcp_link_t *dlink)
-{
-	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
-	uint8_t *opt = msgbuf + sizeof(dhcp_hdr_t);
-	uint32_t xid;
-	errno_t rc;
-	size_t i;
-
-	rc = rndgen_uint32(dlink->rndgen, &xid);
-	if (rc != EOK)
-		return rc;
-
-	memset(msgbuf, 0, MAX_MSG_SIZE);
-	hdr->op = op_bootrequest;
-	hdr->htype = 1; /* AHRD_ETHERNET */
-	hdr->hlen = ETH_ADDR_SIZE;
-	hdr->xid = host2uint32_t_be(xid);
-	hdr->flags = host2uint16_t_be(flag_broadcast);
-
-	eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr);
-	hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic);
-
-	i = 0;
-
-	opt[i++] = opt_msg_type;
-	opt[i++] = 1;
-	opt[i++] = msg_dhcpdiscover;
-
-	opt[i++] = opt_param_req_list;
-	opt[i++] = 3;
-	opt[i++] = 1; /* subnet mask */
-	opt[i++] = 6; /* DNS server */
-	opt[i++] = 3; /* router */
-
-	opt[i++] = opt_end;
-
-	return dhcp_send(&dlink->dt, msgbuf, sizeof(dhcp_hdr_t) + i);
-}
-
-static errno_t dhcp_send_request(dhcp_link_t *dlink, dhcp_offer_t *offer)
-{
-	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msgbuf;
-	uint8_t *opt = msgbuf + sizeof(dhcp_hdr_t);
-	size_t i;
-
-	memset(msgbuf, 0, MAX_MSG_SIZE);
-	hdr->op = op_bootrequest;
-	hdr->htype = 1; /* AHRD_ETHERNET */
-	hdr->hlen = 6;
-	hdr->xid = host2uint32_t_be(offer->xid);
-	hdr->flags = host2uint16_t_be(flag_broadcast);
-	eth_addr_encode(&dlink->link_info.mac_addr, hdr->chaddr);
-	hdr->opt_magic = host2uint32_t_be(dhcp_opt_magic);
-
-	i = 0;
-
-	opt[i++] = opt_msg_type;
-	opt[i++] = 1;
-	opt[i++] = msg_dhcprequest;
-
-	opt[i++] = opt_req_ip_addr;
-	opt[i++] = 4;
-	opt[i++] = offer->oaddr.addr >> 24;
-	opt[i++] = (offer->oaddr.addr >> 16) & 0xff;
-	opt[i++] = (offer->oaddr.addr >> 8) & 0xff;
-	opt[i++] = offer->oaddr.addr & 0xff;
-
-	opt[i++] = opt_server_id;
-	opt[i++] = 4;
-	opt[i++] = offer->srv_addr.addr >> 24;
-	opt[i++] = (offer->srv_addr.addr >> 16) & 0xff;
-	opt[i++] = (offer->srv_addr.addr >> 8) & 0xff;
-	opt[i++] = offer->srv_addr.addr & 0xff;
-
-	opt[i++] = opt_end;
-
-	return dhcp_send(&dlink->dt, msgbuf, sizeof(dhcp_hdr_t) + i);
-}
-
-static errno_t dhcp_parse_reply(void *msg, size_t size, dhcp_offer_t *offer)
-{
-	dhcp_hdr_t *hdr = (dhcp_hdr_t *)msg;
-	inet_addr_t yiaddr;
-	inet_addr_t siaddr;
-	inet_addr_t giaddr;
-	uint32_t subnet_mask;
-	bool have_subnet_mask = false;
-	bool have_server_id = false;
-	int subnet_bits;
-	char *saddr;
-	uint8_t opt_type, opt_len;
-	uint8_t *msgb;
-	errno_t rc;
-	size_t i;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Receive reply");
-	memset(offer, 0, sizeof(*offer));
-
-	inet_addr_set(uint32_t_be2host(hdr->yiaddr), &yiaddr);
-	rc = inet_addr_format(&yiaddr, &saddr);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Your IP address: %s", saddr);
-	free(saddr);
-
-	inet_addr_set(uint32_t_be2host(hdr->siaddr), &siaddr);
-	rc = inet_addr_format(&siaddr, &saddr);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Next server IP address: %s", saddr);
-	free(saddr);
-
-	inet_addr_set(uint32_t_be2host(hdr->giaddr), &giaddr);
-	rc = inet_addr_format(&giaddr, &saddr);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Relay agent IP address: %s", saddr);
-	free(saddr);
-
-	inet_naddr_set(yiaddr.addr, 0, &offer->oaddr);
-	offer->xid = uint32_t_be2host(hdr->xid);
-
-	msgb = (uint8_t *)msg;
-
-	i = sizeof(dhcp_hdr_t);
-	while (i < size) {
-		opt_type = msgb[i++];
-
-		if (opt_type == opt_pad)
-			continue;
-		if (opt_type == opt_end)
-			break;
-
-		if (i >= size)
-			return EINVAL;
-
-		opt_len = msgb[i++];
-
-		if (i + opt_len > size)
-			return EINVAL;
-
-		switch (opt_type) {
-		case opt_subnet_mask:
-			if (opt_len != 4)
-				return EINVAL;
-			subnet_mask = dhcp_uint32_decode(&msgb[i]);
-			rc = subnet_mask_decode(subnet_mask, &subnet_bits);
-			if (rc != EOK)
-				return EINVAL;
-			offer->oaddr.prefix = subnet_bits;
-			have_subnet_mask = true;
-			break;
-		case opt_msg_type:
-			if (opt_len != 1)
-				return EINVAL;
-			offer->msg_type = msgb[i];
-			break;
-		case opt_server_id:
-			if (opt_len != 4)
-				return EINVAL;
-			inet_addr_set(dhcp_uint32_decode(&msgb[i]),
-			    &offer->srv_addr);
-			have_server_id = true;
-			break;
-		case opt_router:
-			if (opt_len != 4)
-				return EINVAL;
-			inet_addr_set(dhcp_uint32_decode(&msgb[i]),
-			    &offer->router);
-			break;
-		case opt_dns_server:
-			if (opt_len < 4 || opt_len % 4 != 0)
-				return EINVAL;
-			/* XXX Handle multiple DNS servers properly */
-			inet_addr_set(dhcp_uint32_decode(&msgb[i]),
-			    &offer->dns_server);
-			break;
-		case opt_end:
-			break;
-		default:
-			break;
-		}
-
-		/* Advance to the next option */
-		i = i + opt_len;
-	}
-
-	if (!have_server_id) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Missing server ID option.");
-		return rc;
-	}
-
-	if (!have_subnet_mask) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Missing subnet mask option.");
-		return rc;
-	}
-
-	rc = inet_naddr_format(&offer->oaddr, &saddr);
-	if (rc != EOK)
-		return rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Offered network address: %s", saddr);
-	free(saddr);
-
-	if (offer->router.addr != 0) {
-		rc = inet_addr_format(&offer->router, &saddr);
-		if (rc != EOK)
-			return rc;
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Router address: %s", saddr);
-		free(saddr);
-	}
-
-	if (offer->dns_server.addr != 0) {
-		rc = inet_addr_format(&offer->dns_server, &saddr);
-		if (rc != EOK)
-			return rc;
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "DNS server: %s", saddr);
-		free(saddr);
-	}
-
-	return EOK;
-}
-
-static errno_t dhcp_cfg_create(service_id_t iplink, dhcp_offer_t *offer)
-{
-	errno_t rc;
-	service_id_t addr_id;
-	service_id_t sroute_id;
-	inet_naddr_t defr;
-
-	rc = inetcfg_addr_create_static("dhcp4a", &offer->oaddr, iplink,
-	    &addr_id);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Error creating IP address %s: %s", "dhcp4a", str_error(rc));
-		return rc;
-	}
-
-	if (offer->router.addr != 0) {
-		inet_naddr_set(0, 0, &defr);
-
-		rc = inetcfg_sroute_create("dhcpdef", &defr, &offer->router, &sroute_id);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating "
-			    "default route %s: %s.", "dhcpdef", str_error(rc));
-			return rc;
-		}
-	}
-
-	if (offer->dns_server.addr != 0) {
-		rc = dnsr_set_srvaddr(&offer->dns_server);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error setting "
-			    "nameserver address: %s)", str_error(rc));
-			return rc;
-		}
-	}
-
-	return EOK;
-}
-
-void dhcpsrv_links_init(void)
-{
-	list_initialize(&dhcp_links);
-}
-
-static dhcp_link_t *dhcpsrv_link_find(service_id_t link_id)
-{
-	list_foreach(dhcp_links, links, dhcp_link_t, dlink) {
-		if (dlink->link_id == link_id)
-			return dlink;
-	}
-
-	return NULL;
-}
-
-static void dhcp_link_set_failed(dhcp_link_t *dlink)
-{
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Giving up on link %s",
-	    dlink->link_info.name);
-	dlink->state = ds_fail;
-}
-
-static errno_t dhcp_discover_proc(dhcp_link_t *dlink)
-{
-	dlink->state = ds_selecting;
-
-	errno_t rc = dhcp_send_discover(dlink);
-	if (rc != EOK)
-		return EIO;
-
-	dlink->retries_left = dhcp_discover_retries;
-
-	if ((dlink->timeout->state == fts_not_set) ||
-	    (dlink->timeout->state == fts_fired))
-		fibril_timer_set(dlink->timeout, dhcp_discover_timeout_val,
-		    dhcpsrv_discover_timeout, dlink);
-
-	return rc;
-}
-
-errno_t dhcpsrv_link_add(service_id_t link_id)
-{
-	dhcp_link_t *dlink;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
-
-	if (!inetcfg_inited) {
-		rc = inetcfg_init();
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error contacting "
-			    "inet configuration service.\n");
-			return EIO;
-		}
-
-		inetcfg_inited = true;
-	}
-
-	if (dhcpsrv_link_find(link_id) != NULL) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Link %zu already added",
-		    link_id);
-		return EEXIST;
-	}
-
-	dlink = calloc(1, sizeof(dhcp_link_t));
-	if (dlink == NULL)
-		return ENOMEM;
-
-	rc = rndgen_create(&dlink->rndgen);
-	if (rc != EOK)
-		goto error;
-
-	dlink->link_id = link_id;
-	dlink->timeout = fibril_timer_create(NULL);
-	if (dlink->timeout == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	/* Get link hardware address */
-	rc = inetcfg_link_get(link_id, &dlink->link_info);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting properties "
-		    "for link %zu.", link_id);
-		rc = EIO;
-		goto error;
-	}
-
-	rc = dhcp_transport_init(&dlink->dt, link_id, dhcpsrv_recv, dlink);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error initializing DHCP "
-		    "transport for link %s.", dlink->link_info.name);
-		rc = EIO;
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Send DHCPDISCOVER");
-	rc = dhcp_discover_proc(dlink);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error sending DHCPDISCOVER.");
-		dhcp_link_set_failed(dlink);
-		rc = EIO;
-		goto error;
-	}
-
-	list_append(&dlink->links, &dhcp_links);
-
-	return EOK;
-error:
-	if (dlink != NULL && dlink->rndgen != NULL)
-		rndgen_destroy(dlink->rndgen);
-	if (dlink != NULL && dlink->timeout != NULL)
-		fibril_timer_destroy(dlink->timeout);
-	free(dlink);
-	return rc;
-}
-
-errno_t dhcpsrv_link_remove(service_id_t link_id)
-{
-	return ENOTSUP;
-}
-
-errno_t dhcpsrv_discover(service_id_t link_id)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcpsrv_link_add(%zu)", link_id);
-
-	dhcp_link_t *dlink = dhcpsrv_link_find(link_id);
-
-	if (dlink == NULL) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Link %zu doesn't exist",
-		    link_id);
-		return EINVAL;
-	}
-
-	return dhcp_discover_proc(dlink);
-}
-
-static void dhcpsrv_recv_offer(dhcp_link_t *dlink, dhcp_offer_t *offer)
-{
-	errno_t rc;
-
-	if (dlink->state != ds_selecting) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Received offer in state "
-		    " %d, ignoring.", (int)dlink->state);
-		return;
-	}
-
-	fibril_timer_clear(dlink->timeout);
-	dlink->offer = *offer;
-	dlink->state = ds_requesting;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Send DHCPREQUEST");
-	rc = dhcp_send_request(dlink, offer);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Error sending request.");
-		return;
-	}
-
-	dlink->retries_left = dhcp_request_retries;
-	fibril_timer_set(dlink->timeout, dhcp_request_timeout_val,
-	    dhcpsrv_request_timeout, dlink);
-}
-
-static void dhcpsrv_recv_ack(dhcp_link_t *dlink, dhcp_offer_t *offer)
-{
-	errno_t rc;
-
-	if (dlink->state != ds_requesting) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Received ack in state "
-		    " %d, ignoring.", (int)dlink->state);
-		return;
-	}
-
-	fibril_timer_clear(dlink->timeout);
-	dlink->offer = *offer;
-	dlink->state = ds_bound;
-
-	rc = dhcp_cfg_create(dlink->link_id, offer);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Error creating configuration.");
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "%s: Successfully configured.",
-	    dlink->link_info.name);
-}
-
-static void dhcpsrv_recv(void *arg, void *msg, size_t size)
-{
-	dhcp_link_t *dlink = (dhcp_link_t *)arg;
-	dhcp_offer_t offer;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: dhcpsrv_recv() %zu bytes",
-	    dlink->link_info.name, size);
-
-	rc = dhcp_parse_reply(msg, size, &offer);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Error parsing reply");
-		return;
-	}
-
-	switch (offer.msg_type) {
-	case msg_dhcpoffer:
-		dhcpsrv_recv_offer(dlink, &offer);
-		break;
-	case msg_dhcpack:
-		dhcpsrv_recv_ack(dlink, &offer);
-		break;
-	default:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Received unexpected "
-		    "message type. %d", (int)offer.msg_type);
-		break;
-	}
-}
-
-static void dhcpsrv_discover_timeout(void *arg)
-{
-	dhcp_link_t *dlink = (dhcp_link_t *)arg;
-	errno_t rc;
-
-	assert(dlink->state == ds_selecting);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "%s: dhcpsrv_discover_timeout",
-	    dlink->link_info.name);
-
-	if (dlink->retries_left == 0) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Retries exhausted");
-		dhcp_link_set_failed(dlink);
-		return;
-	}
-	--dlink->retries_left;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Send DHCPDISCOVER");
-	rc = dhcp_send_discover(dlink);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error sending DHCPDISCOVER");
-		dhcp_link_set_failed(dlink);
-		return;
-	}
-
-	fibril_timer_set(dlink->timeout, dhcp_discover_timeout_val,
-	    dhcpsrv_discover_timeout, dlink);
-}
-
-static void dhcpsrv_request_timeout(void *arg)
-{
-	dhcp_link_t *dlink = (dhcp_link_t *)arg;
-	errno_t rc;
-
-	assert(dlink->state == ds_requesting);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "%s: dhcpsrv_request_timeout",
-	    dlink->link_info.name);
-
-	if (dlink->retries_left == 0) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Retries exhausted");
-		dhcp_link_set_failed(dlink);
-		return;
-	}
-	--dlink->retries_left;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Send DHCPREQUEST");
-	rc = dhcp_send_request(dlink, &dlink->offer);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Error sending request.");
-		dhcp_link_set_failed(dlink);
-		return;
-	}
-
-	fibril_timer_set(dlink->timeout, dhcp_request_timeout_val,
-	    dhcpsrv_request_timeout, dlink);
-}
-
-/** @}
- */
Index: pace/srv/net/dhcp/dhcp.h
===================================================================
--- uspace/srv/net/dhcp/dhcp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef DHCP_H
-#define DHCP_H
-
-#include <ipc/loc.h>
-
-extern void dhcpsrv_links_init(void);
-extern errno_t dhcpsrv_link_add(service_id_t);
-extern errno_t dhcpsrv_link_remove(service_id_t);
-extern errno_t dhcpsrv_discover(service_id_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dhcp/dhcp_std.h
===================================================================
--- uspace/srv/net/dhcp/dhcp_std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-/*
- * Copyright (c) 2022 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- * @brief DHCP standard definitions
- */
-
-#ifndef DHCP_STD_H
-#define DHCP_STD_H
-
-#include <stdint.h>
-
-enum {
-	dhcp_server_port = 67,
-	dhcp_client_port = 68
-};
-
-/** Fixed part of DHCP message */
-typedef struct {
-	/** Message op code */
-	uint8_t op;
-	/** Hardware address type */
-	uint8_t htype;
-	/** Hardware address length */
-	uint8_t hlen;
-	/** Hops */
-	uint8_t hops;
-	/** Transaction ID */
-	uint32_t xid;
-	/** Seconds elapsed since client began address acqusition or renewal */
-	uint16_t secs;
-	/** Flags */
-	uint16_t flags;
-	/** Client IP address */
-	uint32_t ciaddr;
-	/** Your (client) IP address */
-	uint32_t yiaddr;
-	/** IP address of next server */
-	uint32_t siaddr;
-	/** Relay agent IP address */
-	uint32_t giaddr;
-	/** Client hardware address */
-	uint8_t chaddr[16];
-	/** Server host name */
-	uint8_t sname[64];
-	/** Boot file name */
-	uint8_t file[128];
-	/** Magic cookie signalling the start of DHCP options */
-	uint32_t opt_magic;
-} dhcp_hdr_t;
-
-/** Values for dhcp_hdr_t.op */
-enum dhcp_op {
-	op_bootrequest = 1,
-	op_bootreply = 2
-};
-
-/** Values for dhcp_hdr_t.flags */
-enum dhcp_flags {
-	flag_broadcast = 0x8000
-};
-
-/** Magic cookie signalling the start of DHCP options field */
-enum {
-	dhcp_opt_magic = (99 << 24) | (130 << 16) | (83 << 8) | 99
-};
-
-enum dhcp_option_code {
-	/** Padding */
-	opt_pad = 0,
-	/** Subnet mask */
-	opt_subnet_mask = 1,
-	/** Router IP address */
-	opt_router = 3,
-	/** Domain name server */
-	opt_dns_server = 6,
-	/** Requested IP address */
-	opt_req_ip_addr = 50,
-	/** DHCP message type */
-	opt_msg_type = 53,
-	/** Server identifier */
-	opt_server_id = 54,
-	/** Parameter request list */
-	opt_param_req_list = 55,
-	/** End */
-	opt_end = 255
-};
-
-/** DHCP message type */
-enum dhcp_msg_type {
-	msg_dhcpdiscover = 1,
-	msg_dhcpoffer = 2,
-	msg_dhcprequest = 3,
-	msg_dhcpdecline = 4,
-	msg_dhcpack = 5,
-	msg_dhcpnak = 6,
-	msg_dhcprelease = 7
-};
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dhcp/main.c
===================================================================
--- uspace/srv/net/dhcp/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <ipc/dhcp.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-
-#include "dhcp.h"
-
-#define NAME  "dhcp"
-
-static void dhcp_client_conn(ipc_call_t *, void *);
-
-static errno_t dhcp_init(void)
-{
-	loc_srv_t *srv;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_init()");
-
-	dhcpsrv_links_init();
-
-	async_set_fallback_port_handler(dhcp_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	service_id_t sid;
-	rc = loc_service_register(srv, SERVICE_NAME_DHCP, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	return EOK;
-}
-
-static void dhcp_link_add_srv(ipc_call_t *call)
-{
-	sysarg_t link_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_link_add_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = dhcpsrv_link_add(link_id);
-	async_answer_0(call, rc);
-}
-
-static void dhcp_link_remove_srv(ipc_call_t *call)
-{
-	sysarg_t link_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_link_remove_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = dhcpsrv_link_remove(link_id);
-	async_answer_0(call, rc);
-}
-
-static void dhcp_discover_srv(ipc_call_t *call)
-{
-	sysarg_t link_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_discover_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = dhcpsrv_discover(link_id);
-	async_answer_0(call, rc);
-}
-
-static void dhcp_client_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_client_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case DHCP_LINK_ADD:
-			dhcp_link_add_srv(&call);
-			break;
-		case DHCP_LINK_REMOVE:
-			dhcp_link_remove_srv(&call);
-			break;
-		case DHCP_DISCOVER:
-			dhcp_discover_srv(&call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("%s: DHCP Service\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = dhcp_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/dhcp/meson.build
===================================================================
--- uspace/srv/net/dhcp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,34 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files(
-	'dhcp.c',
-	'main.c',
-	'transport.c',
-)
Index: pace/srv/net/dhcp/transport.c
===================================================================
--- uspace/srv/net/dhcp/transport.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- * @brief DHCP client
- */
-
-#include <bitops.h>
-#include <errno.h>
-#include <inet/addr.h>
-#include <inet/dnsr.h>
-#include <inet/inetcfg.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "dhcp.h"
-#include "dhcp_std.h"
-#include "transport.h"
-
-#define MAX_MSG_SIZE 1024
-static uint8_t msgbuf[MAX_MSG_SIZE];
-
-typedef struct {
-	/** Message type */
-	enum dhcp_msg_type msg_type;
-	/** Offered address */
-	inet_naddr_t oaddr;
-	/** Server address */
-	inet_addr_t srv_addr;
-	/** Router address */
-	inet_addr_t router;
-	/** DNS server */
-	inet_addr_t dns_server;
-} dhcp_offer_t;
-
-static void dhcp_recv_msg(udp_assoc_t *, udp_rmsg_t *);
-static void dhcp_recv_err(udp_assoc_t *, udp_rerr_t *);
-static void dhcp_link_state(udp_assoc_t *, udp_link_state_t);
-
-static udp_cb_t dhcp_transport_cb = {
-	.recv_msg = dhcp_recv_msg,
-	.recv_err = dhcp_recv_err,
-	.link_state = dhcp_link_state
-};
-
-errno_t dhcp_send(dhcp_transport_t *dt, void *msg, size_t size)
-{
-	inet_ep_t ep;
-	errno_t rc;
-
-	inet_ep_init(&ep);
-	ep.port = dhcp_server_port;
-	inet_addr_set(addr32_broadcast_all_hosts, &ep.addr);
-
-	rc = udp_assoc_send_msg(dt->assoc, &ep, msg, size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed sending message");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static void dhcp_recv_msg(udp_assoc_t *assoc, udp_rmsg_t *rmsg)
-{
-	dhcp_transport_t *dt;
-	size_t s;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "dhcp_recv_msg()");
-
-	dt = (dhcp_transport_t *)udp_assoc_userptr(assoc);
-	s = udp_rmsg_size(rmsg);
-	if (s > MAX_MSG_SIZE)
-		s = MAX_MSG_SIZE; /* XXX */
-
-	rc = udp_rmsg_read(rmsg, 0, msgbuf, s);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error receiving message.");
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "dhcp_recv_msg() - call recv_cb");
-	dt->recv_cb(dt->cb_arg, msgbuf, s);
-}
-
-static void dhcp_recv_err(udp_assoc_t *assoc, udp_rerr_t *rerr)
-{
-	log_msg(LOG_DEFAULT, LVL_WARN, "Ignoring ICMP error");
-}
-
-static void dhcp_link_state(udp_assoc_t *assoc, udp_link_state_t ls)
-{
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Link state change");
-}
-
-errno_t dhcp_transport_init(dhcp_transport_t *dt, service_id_t link_id,
-    dhcp_recv_cb_t recv_cb, void *arg)
-{
-	udp_t *udp = NULL;
-	udp_assoc_t *assoc = NULL;
-	inet_ep2_t epp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dhcp_transport_init()");
-
-	inet_ep2_init(&epp);
-	epp.local.addr.version = ip_v4;
-	epp.local.port = dhcp_client_port;
-	epp.local_link = link_id;
-
-	rc = udp_create(&udp);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = udp_assoc_create(udp, &epp, &dhcp_transport_cb, dt, &assoc);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = udp_assoc_set_nolocal(assoc);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	dt->udp = udp;
-	dt->assoc = assoc;
-	dt->recv_cb = recv_cb;
-	dt->cb_arg = arg;
-
-	return EOK;
-error:
-	udp_assoc_destroy(assoc);
-	udp_destroy(udp);
-	return rc;
-}
-
-void dhcp_transport_fini(dhcp_transport_t *dt)
-{
-	udp_assoc_destroy(dt->assoc);
-	udp_destroy(dt->udp);
-}
-
-/** @}
- */
Index: pace/srv/net/dhcp/transport.h
===================================================================
--- uspace/srv/net/dhcp/transport.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dhcp
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef TRANSPORT_H
-#define TRANSPORT_H
-
-#include <inet/udp.h>
-#include <ipc/loc.h>
-#include <stddef.h>
-
-struct dhcp_transport;
-typedef struct dhcp_transport dhcp_transport_t;
-
-typedef void (*dhcp_recv_cb_t)(void *, void *, size_t);
-
-struct dhcp_transport {
-	/** UDP */
-	udp_t *udp;
-	/** UDP association */
-	udp_assoc_t *assoc;
-	/** Receive callback */
-	dhcp_recv_cb_t recv_cb;
-	/** Callback argument */
-	void *cb_arg;
-};
-
-extern errno_t dhcp_transport_init(dhcp_transport_t *, service_id_t,
-    dhcp_recv_cb_t, void *);
-extern void dhcp_transport_fini(dhcp_transport_t *);
-extern errno_t dhcp_send(dhcp_transport_t *dt, void *msg, size_t size);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/dns_msg.c
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,722 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <io/log.h>
-#include <macros.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include "dns_msg.h"
-#include "dns_std.h"
-
-#define NAME  "dnsres"
-
-static uint16_t dns_uint16_t_decode(uint8_t *, size_t);
-
-/** Extend dynamically allocated string with suffix.
- *
- * @a *dstr points to a dynamically allocated buffer containing a string.
- * Reallocate this buffer so that concatenation of @a *dstr and @a suff can
- * fit in and append @a suff.
- */
-static errno_t dns_dstr_ext(char **dstr, const char *suff)
-{
-	size_t s1, s2;
-	size_t nsize;
-	char *nstr;
-
-	if (*dstr == NULL) {
-		*dstr = str_dup(suff);
-		if (*dstr == NULL)
-			return ENOMEM;
-		return EOK;
-	}
-
-	s1 = str_size(*dstr);
-	s2 = str_size(suff);
-	nsize = s1 + s2 + 1;
-
-	nstr = realloc(*dstr, nsize);
-	if (nstr == NULL)
-		return ENOMEM;
-
-	str_cpy(nstr + s1, nsize - s1, suff);
-
-	*dstr = nstr;
-	return EOK;
-}
-
-/** Encode DNS name.
- *
- * Encode DNS name or measure the size of encoded name (with @a buf NULL,
- * and @a buf_size 0).
- *
- * @param name		String to encode
- * @param buf		Buffer or NULL
- * @param buf_size      Buffer size or 0 if @a buf is NULL
- * @param act_size	Place to store actual encoded size
- */
-static errno_t dns_name_encode(char *name, uint8_t *buf, size_t buf_size,
-    size_t *act_size)
-{
-	size_t off;
-	char32_t c;
-	size_t lsize;
-	size_t pi, di;
-
-	pi = 0;
-	di = 1;
-	off = 0;
-
-	lsize = 0;
-	while (true) {
-		c = str_decode(name, &off, STR_NO_LIMIT);
-		if (c >= 127) {
-			/* Non-ASCII character */
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Non-ascii character");
-			return EINVAL;
-		}
-
-		if (c == '.' || c == '\0') {
-			/* Empty string, starting with period or two consecutive periods. */
-			if (lsize == 0) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Empty token");
-				return EINVAL;
-			}
-
-			if (lsize > DNS_LABEL_MAX_SIZE) {
-				/* Label too long */
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Label too long");
-				return EINVAL;
-			}
-
-			if (buf != NULL && pi < buf_size)
-				buf[pi] = (uint8_t)lsize;
-
-			lsize = 0;
-			pi = di;
-			++di;
-
-			if (c == '\0')
-				break;
-		} else {
-			if (buf != NULL && di < buf_size)
-				buf[di] = c;
-			++di;
-			++lsize;
-		}
-	}
-
-	if (buf != NULL && pi < buf_size)
-		buf[pi] = 0;
-
-	*act_size = di;
-	return EOK;
-}
-
-/** Decode DNS name.
- *
- * @param pdu	PDU from which we are decoding
- * @param boff	Starting offset within PDU
- * @param rname	Place to return dynamically allocated string
- * @param eoff	Place to store end offset (offset after last decoded byte)
- */
-errno_t dns_name_decode(dns_pdu_t *pdu, size_t boff, char **rname,
-    size_t *eoff)
-{
-	uint8_t *bp;
-	size_t bsize;
-	size_t lsize;
-	size_t i;
-	size_t ptr;
-	size_t eptr;
-	char *name;
-	char dbuf[2];
-	errno_t rc;
-	bool first;
-
-	name = NULL;
-
-	if (boff > pdu->size)
-		return EINVAL;
-
-	bp = pdu->data + boff;
-	bsize = min(pdu->size - boff, DNS_NAME_MAX_SIZE);
-	first = true;
-	*eoff = 0;
-
-	while (true) {
-		if (bsize == 0) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		lsize = *bp;
-		++bp;
-		--bsize;
-
-		if (lsize == 0)
-			break;
-
-		if ((lsize & 0xc0) == 0xc0) {
-			/* Pointer */
-			if (bsize < 1) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Pointer- bsize < 1");
-				rc = EINVAL;
-				goto error;
-			}
-
-			ptr = dns_uint16_t_decode(bp - 1, bsize) & 0x3fff;
-			++bp;
-			--bsize;
-
-			if (ptr >= (size_t)(bp - pdu->data)) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG,
-				    "Pointer- forward ref %zu, pos=%zu",
-				    ptr, (size_t)(bp - pdu->data));
-				/* Forward reference */
-				rc = EINVAL;
-				goto error;
-			}
-
-			/*
-			 * Make sure we will not decode any byte twice.
-			 * XXX Is assumption correct?
-			 */
-			eptr = bp - pdu->data;
-			/*
-			 * This is where encoded name ends in terms where
-			 * the message continues
-			 */
-			if (*eoff == 0)
-				*eoff = eptr;
-
-			bp = pdu->data + ptr;
-			bsize = eptr - ptr;
-			continue;
-		}
-
-		if (lsize > bsize) {
-			rc = EINVAL;
-			goto error;
-		}
-
-		if (!first) {
-			rc = dns_dstr_ext(&name, ".");
-			if (rc != EOK) {
-				rc = ENOMEM;
-				goto error;
-			}
-		}
-
-		for (i = 0; i < lsize; i++) {
-			if (*bp < 32 || *bp >= 127) {
-				rc = EINVAL;
-				goto error;
-			}
-
-			dbuf[0] = *bp;
-			dbuf[1] = '\0';
-
-			rc = dns_dstr_ext(&name, dbuf);
-			if (rc != EOK) {
-				rc = ENOMEM;
-				goto error;
-			}
-			++bp;
-			--bsize;
-		}
-
-		first = false;
-	}
-
-	*rname = name;
-	if (*eoff == 0)
-		*eoff = bp - pdu->data;
-	return EOK;
-error:
-	free(name);
-	return rc;
-}
-
-/** Decode unaligned big-endian 16-bit integer */
-static uint16_t dns_uint16_t_decode(uint8_t *buf, size_t buf_size)
-{
-	assert(buf_size >= 2);
-
-	return ((uint16_t)buf[0] << 8) + buf[1];
-}
-
-/** Encode unaligned big-endian 16-bit integer */
-static void dns_uint16_t_encode(uint16_t w, uint8_t *buf, size_t buf_size)
-{
-	if (buf != NULL && buf_size >= 1)
-		buf[0] = w >> 8;
-
-	if (buf != NULL && buf_size >= 2)
-		buf[1] = w & 0xff;
-}
-
-/** Decode unaligned big-endian 32-bit integer */
-uint32_t dns_uint32_t_decode(uint8_t *buf, size_t buf_size)
-{
-	assert(buf_size >= 4);
-
-	uint32_t w = ((uint32_t) buf[0] << 24) +
-	    ((uint32_t) buf[1] << 16) +
-	    ((uint32_t) buf[2] << 8) +
-	    buf[3];
-
-	return w;
-}
-
-/** Decode unaligned big-endian 128-bit integer */
-void dns_addr128_t_decode(uint8_t *buf, size_t buf_size, addr128_t addr)
-{
-	assert(buf_size >= 16);
-
-	addr128_t_be2host(buf, addr);
-}
-
-/** Encode DNS question.
- *
- * Encode DNS question or measure the size of encoded question (with @a buf NULL,
- * and @a buf_size 0).
- *
- * @param question	Question to encode
- * @param buf		Buffer or NULL
- * @param buf_size      Buffer size or 0 if @a buf is NULL
- * @param act_size	Place to store actual encoded size
- */
-static errno_t dns_question_encode(dns_question_t *question, uint8_t *buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t name_size;
-	size_t di;
-	errno_t rc;
-
-	rc = dns_name_encode(question->qname, buf, buf_size, &name_size);
-	if (rc != EOK)
-		return rc;
-
-	*act_size = name_size + sizeof(uint16_t) + sizeof(uint16_t);
-	if (buf == NULL)
-		return EOK;
-
-	di = name_size;
-
-	dns_uint16_t_encode(question->qtype, buf + di, buf_size - di);
-	di += sizeof(uint16_t);
-
-	dns_uint16_t_encode(question->qclass, buf + di, buf_size - di);
-	di += sizeof(uint16_t);
-
-	return EOK;
-}
-
-/** Decode DNS question.
- *
- * @param pdu		PDU from which we are decoding
- * @param boff		Starting offset within PDU
- * @param rquestion	Place to return dynamically allocated question
- * @param eoff		Place to store end offset (offset after last decoded byte)
- */
-static errno_t dns_question_decode(dns_pdu_t *pdu, size_t boff,
-    dns_question_t **rquestion, size_t *eoff)
-{
-	dns_question_t *question;
-	size_t name_eoff;
-	errno_t rc;
-
-	question = calloc(1, sizeof (dns_question_t));
-	if (question == NULL)
-		return ENOMEM;
-
-	rc = dns_name_decode(pdu, boff, &question->qname, &name_eoff);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Error decoding name");
-		free(question);
-		return ENOMEM;
-	}
-
-	if (name_eoff + 2 * sizeof(uint16_t) > pdu->size) {
-		free(question);
-		return EINVAL;
-	}
-
-	question->qtype = dns_uint16_t_decode(pdu->data + name_eoff,
-	    pdu->size - name_eoff);
-	question->qclass = dns_uint16_t_decode(pdu->data + sizeof(uint16_t) +
-	    name_eoff, pdu->size - sizeof(uint16_t) - name_eoff);
-	*eoff = name_eoff + 2 * sizeof(uint16_t);
-
-	*rquestion = question;
-	return EOK;
-}
-
-/** Decode DNS resource record.
- *
- * @param pdu		PDU from which we are decoding
- * @param boff		Starting offset within PDU
- * @param retrr		Place to return dynamically allocated resource record
- * @param eoff		Place to store end offset (offset after last decoded byte)
- */
-static errno_t dns_rr_decode(dns_pdu_t *pdu, size_t boff, dns_rr_t **retrr,
-    size_t *eoff)
-{
-	dns_rr_t *rr;
-	size_t name_eoff;
-	uint8_t *bp;
-	size_t bsz;
-	size_t rdlength;
-	errno_t rc;
-
-	rr = calloc(1, sizeof(dns_rr_t));
-	if (rr == NULL)
-		return ENOMEM;
-
-	rc = dns_name_decode(pdu, boff, &rr->name, &name_eoff);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error decoding name");
-		free(rr);
-		return ENOMEM;
-	}
-
-	if (name_eoff + 2 * sizeof(uint16_t) > pdu->size) {
-		free(rr->name);
-		free(rr);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error name_off");
-		return EINVAL;
-	}
-
-	bp = pdu->data + name_eoff;
-	bsz = pdu->size - name_eoff;
-
-	if (bsz < 3 * sizeof(uint16_t) + sizeof(uint32_t)) {
-		free(rr->name);
-		free(rr);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: error bsz");
-		return EINVAL;
-	}
-
-	rr->rtype = dns_uint16_t_decode(bp, bsz);
-	bp += sizeof(uint16_t);
-	bsz -= sizeof(uint16_t);
-
-	rr->rclass = dns_uint16_t_decode(bp, bsz);
-	bp += sizeof(uint16_t);
-	bsz -= sizeof(uint16_t);
-
-	rr->ttl = dns_uint32_t_decode(bp, bsz);
-	bp += sizeof(uint32_t);
-	bsz -= sizeof(uint32_t);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: rtype=0x%x, rclass=0x%x, ttl=0x%x",
-	    rr->rtype, rr->rclass, rr->ttl);
-
-	rdlength = dns_uint16_t_decode(bp, bsz);
-	bp += sizeof(uint16_t);
-	bsz -= sizeof(uint16_t);
-
-	if (rdlength > bsz) {
-		free(rr->name);
-		free(rr);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error rdlength %zu > bsz %zu", rdlength, bsz);
-		return EINVAL;
-	}
-
-	rr->rdata_size = rdlength;
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: rdlength=%zu", rdlength);
-	rr->rdata = calloc(1, rdlength);
-	if (rr->rdata == NULL) {
-		free(rr->name);
-		free(rr);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_rr_decode: Error memory");
-		return ENOMEM;
-	}
-
-	memcpy(rr->rdata, bp, rdlength);
-	rr->roff = bp - pdu->data;
-	bp += rdlength;
-	bsz -= rdlength;
-
-	*eoff = bp - pdu->data;
-	*retrr = rr;
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_rr_decode: done");
-	return EOK;
-}
-
-/** Encode DNS message.
- *
- * @param msg	Message
- * @param rdata	Place to store encoded data pointer
- * @param rsize	Place to store encoded data size
- *
- * @return 	EOK on success, EINVAL if message contains invalid data,
- *		ENOMEM if out of memory
- */
-errno_t dns_message_encode(dns_message_t *msg, void **rdata, size_t *rsize)
-{
-	uint8_t *data;
-	size_t size;
-	dns_header_t hdr;
-	size_t q_size = 0;
-	size_t di;
-	errno_t rc;
-
-	hdr.id = host2uint16_t_be(msg->id);
-
-	hdr.opbits = host2uint16_t_be(
-	    (msg->qr << OPB_QR) |
-	    (msg->opcode << OPB_OPCODE_l) |
-	    (msg->aa ? BIT_V(uint16_t, OPB_AA) : 0) |
-	    (msg->tc ? BIT_V(uint16_t, OPB_TC) : 0) |
-	    (msg->rd ? BIT_V(uint16_t, OPB_RD) : 0) |
-	    (msg->ra ? BIT_V(uint16_t, OPB_RA) : 0) |
-	    msg->rcode);
-
-	hdr.qd_count = host2uint16_t_be(list_count(&msg->question));
-	hdr.an_count = 0;
-	hdr.ns_count = 0;
-	hdr.ar_count = 0;
-
-	size = sizeof(dns_header_t);
-
-	list_foreach(msg->question, msg, dns_question_t, q) {
-		rc = dns_question_encode(q, NULL, 0, &q_size);
-		if (rc != EOK)
-			return rc;
-
-		assert(q_size > 0);
-
-		size += q_size;
-	}
-
-	data = calloc(1, size);
-	if (data == NULL)
-		return ENOMEM;
-
-	memcpy(data, &hdr, sizeof(dns_header_t));
-	di = sizeof(dns_header_t);
-
-	list_foreach(msg->question, msg, dns_question_t, q) {
-		rc = dns_question_encode(q, data + di, size - di, &q_size);
-		if (rc != EOK) {
-			assert(rc == ENOMEM || rc == EINVAL);
-			free(data);
-			return rc;
-		}
-
-		assert(q_size > 0);
-
-		di += q_size;
-	}
-
-	*rdata = data;
-	*rsize = size;
-	return EOK;
-}
-
-/** Decode DNS message.
- *
- * @param data	Encoded PDU data
- * @param size	Encoded PDU size
- * @param rmsg	Place to store pointer to decoded message
- *
- * @return	EOK on success, EINVAL if message contains invalid data,
- * 		ENOMEM if out of memory
- */
-errno_t dns_message_decode(void *data, size_t size, dns_message_t **rmsg)
-{
-	dns_message_t *msg;
-	dns_header_t *hdr;
-	size_t doff;
-	size_t field_eoff;
-	dns_question_t *question;
-	dns_rr_t *rr;
-	size_t qd_count;
-	size_t an_count;
-	size_t i;
-	errno_t rc;
-
-	msg = dns_message_new();
-	if (msg == NULL)
-		return ENOMEM;
-
-	if (size < sizeof(dns_header_t)) {
-		rc = EINVAL;
-		goto error;
-	}
-
-	/* Store a copy of raw message data for string decompression */
-
-	msg->pdu.data = malloc(size);
-	if (msg->pdu.data == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	memcpy(msg->pdu.data, data, size);
-	msg->pdu.size = size;
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "dns_message_decode: pdu->data = %p, "
-	    "pdu->size=%zu", msg->pdu.data, msg->pdu.size);
-
-	hdr = data;
-
-	msg->id = uint16_t_be2host(hdr->id);
-	msg->qr = BIT_RANGE_EXTRACT(uint16_t, OPB_QR, OPB_QR, hdr->opbits);
-	msg->opcode = BIT_RANGE_EXTRACT(uint16_t, OPB_OPCODE_h, OPB_OPCODE_l,
-	    hdr->opbits);
-	msg->aa = BIT_RANGE_EXTRACT(uint16_t, OPB_AA, OPB_AA, hdr->opbits);
-	msg->tc = BIT_RANGE_EXTRACT(uint16_t, OPB_TC, OPB_TC, hdr->opbits);
-	msg->rd = BIT_RANGE_EXTRACT(uint16_t, OPB_RD, OPB_RD, hdr->opbits);
-	msg->ra = BIT_RANGE_EXTRACT(uint16_t, OPB_RA, OPB_RA, hdr->opbits);
-	msg->rcode = BIT_RANGE_EXTRACT(uint16_t, OPB_RCODE_h, OPB_RCODE_l,
-	    hdr->opbits);
-
-	doff = sizeof(dns_header_t);
-
-	qd_count = uint16_t_be2host(hdr->qd_count);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "qd_count=%zu", qd_count);
-
-	for (i = 0; i < qd_count; i++) {
-		rc = dns_question_decode(&msg->pdu, doff, &question, &field_eoff);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "error decoding question");
-			goto error;
-		}
-
-		list_append(&question->msg, &msg->question);
-		doff = field_eoff;
-	}
-
-	an_count = uint16_t_be2host(hdr->an_count);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "an_count=%zu", an_count);
-
-	for (i = 0; i < an_count; i++) {
-		rc = dns_rr_decode(&msg->pdu, doff, &rr, &field_eoff);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Error decoding answer");
-			goto error;
-		}
-
-		list_append(&rr->msg, &msg->answer);
-		doff = field_eoff;
-	}
-
-	*rmsg = msg;
-	return EOK;
-error:
-	dns_message_destroy(msg);
-	return rc;
-}
-
-/** Destroy question. */
-static void dns_question_destroy(dns_question_t *question)
-{
-	free(question->qname);
-	free(question);
-}
-
-/** Destroy resource record. */
-static void dns_rr_destroy(dns_rr_t *rr)
-{
-	free(rr->name);
-	free(rr->rdata);
-	free(rr);
-}
-
-/** Create new empty message. */
-dns_message_t *dns_message_new(void)
-{
-	dns_message_t *msg;
-
-	msg = calloc(1, sizeof(dns_message_t));
-	if (msg == NULL)
-		return NULL;
-
-	list_initialize(&msg->question);
-	list_initialize(&msg->answer);
-	list_initialize(&msg->authority);
-	list_initialize(&msg->additional);
-
-	return msg;
-}
-
-/** Destroy message. */
-void dns_message_destroy(dns_message_t *msg)
-{
-	link_t *link;
-	dns_question_t *question;
-	dns_rr_t *rr;
-
-	while (!list_empty(&msg->question)) {
-		link = list_first(&msg->question);
-		question = list_get_instance(link, dns_question_t, msg);
-		list_remove(&question->msg);
-		dns_question_destroy(question);
-	}
-
-	while (!list_empty(&msg->answer)) {
-		link = list_first(&msg->answer);
-		rr = list_get_instance(link, dns_rr_t, msg);
-		list_remove(&rr->msg);
-		dns_rr_destroy(rr);
-	}
-
-	while (!list_empty(&msg->authority)) {
-		link = list_first(&msg->authority);
-		rr = list_get_instance(link, dns_rr_t, msg);
-		list_remove(&rr->msg);
-		dns_rr_destroy(rr);
-	}
-
-	while (!list_empty(&msg->additional)) {
-		link = list_first(&msg->additional);
-		rr = list_get_instance(link, dns_rr_t, msg);
-		list_remove(&rr->msg);
-		dns_rr_destroy(rr);
-	}
-
-	free(msg->pdu.data);
-	free(msg);
-}
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/dns_msg.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_msg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DNS_MSG_H
-#define DNS_MSG_H
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <inet/addr.h>
-#include "dns_std.h"
-#include "dns_type.h"
-
-extern errno_t dns_message_encode(dns_message_t *, void **, size_t *);
-extern errno_t dns_message_decode(void *, size_t, dns_message_t **);
-extern dns_message_t *dns_message_new(void);
-extern void dns_message_destroy(dns_message_t *);
-extern errno_t dns_name_decode(dns_pdu_t *, size_t, char **, size_t *);
-extern uint32_t dns_uint32_t_decode(uint8_t *, size_t);
-extern void dns_addr128_t_decode(uint8_t *, size_t, addr128_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/dns_std.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file DNS Standard definitions.
- *
- * From RFC 1035 Domain Names - Implementation and Specification
- */
-
-#ifndef DNS_STD_H
-#define DNS_STD_H
-
-#include <stdint.h>
-
-/** From 2.3.4. Size Limits */
-enum dns_limits {
-	DNS_LABEL_MAX_SIZE	= 63,
-	DNS_NAME_MAX_SIZE	= 255,
-	DNS_UDP_MSG_MAX_SIZE	= 512
-};
-
-typedef enum dns_qtype {
-	DTYPE_A		= 1,
-	DTYPE_NS	= 2,
-	DTYPE_MD	= 3,
-	DTYPE_MF	= 4,
-	DTYPE_CNAME	= 5,
-	DTYPE_SOA	= 6,
-	DTYPE_MB	= 7,
-	DTYPE_MG	= 8,
-	DTYPE_MR	= 9,
-	DTYPE_NULL	= 10,
-	DTYPE_WKS	= 11,
-	DTYPE_PTR	= 12,
-	DTYPE_HINFO	= 13,
-	DTYPE_MINFO	= 14,
-	DTYPE_MX	= 15,
-	DTYPE_TXT	= 16,
-	DTYPE_AAAA	= 28,
-	DQTYPE_AXFR	= 252,
-	DQTYPE_MAILB	= 253,
-	DQTYPE_MAILA	= 254,
-	DQTYPE_ALL	= 255
-} dns_type_t, dns_qtype_t;
-
-typedef enum dns_qclass {
-	/** Internet */
-	DC_IN		= 1,
-	/** CSNET */
-	DC_CS		= 2,
-	/** CHAOS */
-	DC_CH		= 3,
-	/** Hesiod */
-	DC_HS		= 4,
-	/** Any class */
-	DQC_ANY		= 255
-} dns_class_t, dns_qclass_t;
-
-typedef struct {
-	/** Identifier assigned by the query originator */
-	uint16_t id;
-	/** QR, Opcode, AA, TC,RD, RA, Z, Rcode */
-	uint16_t opbits;
-	/** Number of entries in query section */
-	uint16_t qd_count;
-	/** Number of RRs in the answer section */
-	uint16_t an_count;
-	/** Number of name server RRs in the authority records section */
-	uint16_t ns_count;
-	/** Number of RRs in the additional records section */
-	uint16_t ar_count;
-} dns_header_t;
-
-/** Bits in dns_header_t.opbits.
- *
- * Note that bit numbers in RFC 1035 are reversed (0 is the most significant)
- * but we use the standard notation (0 is the least significant).
- */
-enum dns_opbits {
-	OPB_QR 		= 15,
-	OPB_OPCODE_h	= 14,
-	OPB_OPCODE_l	= 11,
-	OPB_AA		= 10,
-	OPB_TC		= 9,
-	OPB_RD		= 8,
-	OPB_RA		= 7,
-	OPB_Z_h		= 6,
-	OPB_Z_l		= 4,
-	OPB_RCODE_h	= 3,
-	OPB_RCODE_l	= 0
-};
-
-typedef enum dns_query_response {
-	QR_QUERY	= 0,
-	QR_RESPONSE	= 1
-} dns_query_response_t;
-
-typedef enum dns_opcode {
-	OPC_QUERY	= 0,
-	OPC_IQUERY	= 1,
-	OPC_STATUS	= 2
-} dns_opcode_t;
-
-typedef enum dns_rcode {
-	RC_OK		= 0,
-	RC_FMT_ERR	= 1,
-	RC_SRV_FAIL	= 2,
-	RC_NAME_ERR	= 3,
-	RC_NOT_IMPL	= 4,
-	RC_REFUSED	= 5
-} dns_rcode_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/dns_type.h
===================================================================
--- uspace/srv/net/dnsrsrv/dns_type.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#ifndef DNS_TYPE_H
-#define DNS_TYPE_H
-
-#include <adt/list.h>
-#include <inet/inet.h>
-#include <inet/addr.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "dns_std.h"
-
-/** Encoded DNS PDU */
-typedef struct {
-	/** Encoded PDU data */
-	uint8_t *data;
-	/** Encoded PDU size */
-	size_t size;
-} dns_pdu_t;
-
-/** DNS message */
-typedef struct {
-	/* Encoded PDU */
-	dns_pdu_t pdu;
-
-	/** Identifier */
-	uint16_t id;
-	/** Query or Response */
-	dns_query_response_t qr;
-	/** Opcode */
-	dns_opcode_t opcode;
-	/** Authoritative Answer */
-	bool aa;
-	/** TrunCation */
-	bool tc;
-	/** Recursion Desired */
-	bool rd;
-	/** Recursion Available */
-	bool ra;
-	/** Response Code */
-	dns_rcode_t rcode;
-
-	list_t question; /* of dns_question_t */
-	list_t answer; /* of dns_rr_t */
-	list_t authority; /* of dns_rr_t */
-	list_t additional; /* of dns_rr_t */
-} dns_message_t;
-
-/** Unencoded DNS message question section */
-typedef struct {
-	link_t msg;
-	/** Domain name in text format (dot notation) */
-	char *qname;
-	/** Query type */
-	dns_qtype_t qtype;
-	/** Query class */
-	dns_qclass_t qclass;
-} dns_question_t;
-
-/** Unencoded DNS resource record */
-typedef struct {
-	link_t msg;
-	/** Domain name */
-	char *name;
-	/** RR type */
-	dns_type_t rtype;
-	/** Class of data */
-	dns_class_t rclass;
-	/** Time to live */
-	uint32_t ttl;
-
-	/** Resource data */
-	void *rdata;
-	/** Number of bytes in @c *rdata */
-	size_t rdata_size;
-	/** Offset in the raw message */
-	size_t roff;
-} dns_rr_t;
-
-/** Host information */
-typedef struct {
-	/** Host name */
-	char *cname;
-	/** Host address */
-	inet_addr_t addr;
-} dns_host_info_t;
-
-typedef struct {
-} dnsr_client_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/dnsrsrv.c
===================================================================
--- uspace/srv/net/dnsrsrv/dnsrsrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,270 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <ipc/dnsr.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-
-#include "dns_msg.h"
-#include "dns_std.h"
-#include "query.h"
-#include "transport.h"
-
-#define NAME  "dnsres"
-
-static void dnsr_client_conn(ipc_call_t *, void *);
-
-static errno_t dnsr_init(void)
-{
-	loc_srv_t *srv;
-	errno_t rc;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dnsr_init()");
-
-	rc = transport_init();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing transport.");
-		return EIO;
-	}
-
-	async_set_fallback_port_handler(dnsr_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		transport_fini();
-		return EEXIST;
-	}
-
-	service_id_t sid;
-	rc = loc_service_register(srv, SERVICE_NAME_DNSR, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		transport_fini();
-		return EEXIST;
-	}
-
-	return EOK;
-}
-
-static void dnsr_name2host_srv(dnsr_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srvaddr_srv()");
-
-	ip_ver_t ver = ipc_get_arg1(icall);
-
-	char *name;
-	errno_t rc = async_data_write_accept((void **) &name, true, 0,
-	    DNS_NAME_MAX_SIZE, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	dns_host_info_t *hinfo;
-	rc = dns_name2host(name, &hinfo, ver);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &hinfo->addr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	size_t act_size = str_size(hinfo->cname);
-	if (act_size > size) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, hinfo->cname, act_size);
-	if (rc != EOK)
-		async_answer_0(&call, rc);
-
-	async_answer_0(icall, rc);
-
-	dns_hostinfo_destroy(hinfo);
-}
-
-static void dnsr_get_srvaddr_srv(dnsr_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srvaddr_srv()");
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	// FIXME locking
-
-	errno_t rc = async_data_read_finalize(&call, &dns_server_addr, size);
-	if (rc != EOK)
-		async_answer_0(&call, rc);
-
-	async_answer_0(icall, rc);
-}
-
-static void dnsr_set_srvaddr_srv(dnsr_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dnsr_set_srvaddr_srv()");
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	// FIXME locking
-
-	errno_t rc = async_data_write_finalize(&call, &dns_server_addr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, rc);
-}
-
-static void dnsr_client_conn(ipc_call_t *icall, void *arg)
-{
-	dnsr_client_t client;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dnsr_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case DNSR_NAME2HOST:
-			dnsr_name2host_srv(&client, &call);
-			break;
-		case DNSR_GET_SRVADDR:
-			dnsr_get_srvaddr_srv(&client, &call);
-			break;
-		case DNSR_SET_SRVADDR:
-			dnsr_set_srvaddr_srv(&client, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("%s: DNS Resolution Service\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = dnsr_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/meson.build
===================================================================
--- uspace/srv/net/dnsrsrv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files(
-	'dns_msg.c',
-	'dnsrsrv.c',
-	'query.c',
-	'transport.c',
-)
Index: pace/srv/net/dnsrsrv/query.c
===================================================================
--- uspace/srv/net/dnsrsrv/query.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,233 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <str.h>
-#include "dns_msg.h"
-#include "dns_std.h"
-#include "dns_type.h"
-#include "query.h"
-#include "transport.h"
-
-static uint16_t msg_id;
-
-static errno_t dns_name_query(const char *name, dns_qtype_t qtype,
-    dns_host_info_t *info)
-{
-	/* Start with the caller-provided name */
-	char *sname = str_dup(name);
-	if (sname == NULL)
-		return ENOMEM;
-
-	char *qname = str_dup(name);
-	if (qname == NULL) {
-		free(sname);
-		return ENOMEM;
-	}
-
-	dns_question_t *question = calloc(1, sizeof(dns_question_t));
-	if (question == NULL) {
-		free(qname);
-		free(sname);
-		return ENOMEM;
-	}
-
-	question->qname = qname;
-	question->qtype = qtype;
-	question->qclass = DC_IN;
-
-	dns_message_t *msg = dns_message_new();
-	if (msg == NULL) {
-		free(question);
-		free(qname);
-		free(sname);
-		return ENOMEM;
-	}
-
-	msg->id = msg_id++;
-	msg->qr = QR_QUERY;
-	msg->opcode = OPC_QUERY;
-	msg->aa = false;
-	msg->tc = false;
-	msg->rd = true;
-	msg->ra = false;
-
-	list_append(&question->msg, &msg->question);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_name_query: send DNS request");
-	dns_message_t *amsg;
-	errno_t rc = dns_request(msg, &amsg);
-	if (rc != EOK) {
-		dns_message_destroy(msg);
-		free(sname);
-		return rc;
-	}
-
-	list_foreach(amsg->answer, msg, dns_rr_t, rr) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - '%s' %u/%u, dsize %zu",
-		    rr->name, rr->rtype, rr->rclass, rr->rdata_size);
-
-		if ((rr->rtype == DTYPE_CNAME) && (rr->rclass == DC_IN) &&
-		    (str_cmp(rr->name, sname) == 0)) {
-
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "decode cname (%p, %zu, %zu)",
-			    amsg->pdu.data, amsg->pdu.size, rr->roff);
-
-			char *cname;
-			size_t eoff;
-			rc = dns_name_decode(&amsg->pdu, rr->roff, &cname, &eoff);
-			if (rc != EOK) {
-				assert((rc == EINVAL) || (rc == ENOMEM));
-
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "error decoding cname");
-
-				dns_message_destroy(msg);
-				dns_message_destroy(amsg);
-				free(sname);
-
-				return rc;
-			}
-
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "name = '%s' "
-			    "cname = '%s'", sname, cname);
-
-			/* Continue looking for the more canonical name */
-			free(sname);
-			sname = cname;
-		}
-
-		if ((qtype == DTYPE_A) && (rr->rtype == DTYPE_A) &&
-		    (rr->rclass == DC_IN) && (rr->rdata_size == sizeof(addr32_t)) &&
-		    (str_cmp(rr->name, sname) == 0)) {
-
-			info->cname = str_dup(rr->name);
-			if (info->cname == NULL) {
-				dns_message_destroy(msg);
-				dns_message_destroy(amsg);
-				free(sname);
-
-				return ENOMEM;
-			}
-
-			inet_addr_set(dns_uint32_t_decode(rr->rdata, rr->rdata_size),
-			    &info->addr);
-
-			dns_message_destroy(msg);
-			dns_message_destroy(amsg);
-			free(sname);
-
-			return EOK;
-		}
-
-		if ((qtype == DTYPE_AAAA) && (rr->rtype == DTYPE_AAAA) &&
-		    (rr->rclass == DC_IN) && (rr->rdata_size == sizeof(addr128_t)) &&
-		    (str_cmp(rr->name, sname) == 0)) {
-
-			info->cname = str_dup(rr->name);
-			if (info->cname == NULL) {
-				dns_message_destroy(msg);
-				dns_message_destroy(amsg);
-				free(sname);
-
-				return ENOMEM;
-			}
-
-			addr128_t addr;
-			dns_addr128_t_decode(rr->rdata, rr->rdata_size, addr);
-
-			inet_addr_set6(addr, &info->addr);
-
-			dns_message_destroy(msg);
-			dns_message_destroy(amsg);
-			free(sname);
-
-			return EOK;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "'%s' not resolved, fail", sname);
-
-	dns_message_destroy(msg);
-	dns_message_destroy(amsg);
-	free(sname);
-
-	return EIO;
-}
-
-errno_t dns_name2host(const char *name, dns_host_info_t **rinfo, ip_ver_t ver)
-{
-	dns_host_info_t *info = calloc(1, sizeof(dns_host_info_t));
-	if (info == NULL)
-		return ENOMEM;
-
-	errno_t rc;
-
-	switch (ver) {
-	case ip_any:
-		rc = dns_name_query(name, DTYPE_AAAA, info);
-
-		if (rc != EOK)
-			rc = dns_name_query(name, DTYPE_A, info);
-
-		break;
-	case ip_v4:
-		rc = dns_name_query(name, DTYPE_A, info);
-		break;
-	case ip_v6:
-		rc = dns_name_query(name, DTYPE_AAAA, info);
-		break;
-	default:
-		rc = EINVAL;
-	}
-
-	if (rc == EOK)
-		*rinfo = info;
-	else
-		free(info);
-
-	return rc;
-}
-
-void dns_hostinfo_destroy(dns_host_info_t *info)
-{
-	free(info->cname);
-	free(info);
-}
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/query.h
===================================================================
--- uspace/srv/net/dnsrsrv/query.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#ifndef QUERY_H
-#define QUERY_H
-
-#include <inet/addr.h>
-#include "dns_type.h"
-
-extern errno_t dns_name2host(const char *, dns_host_info_t **, ip_ver_t);
-extern void dns_hostinfo_destroy(dns_host_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/transport.c
===================================================================
--- uspace/srv/net/dnsrsrv/transport.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,304 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <str_error.h>
-#include <fibril_synch.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-#include <inet/udp.h>
-#include <io/log.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
-#include "dns_msg.h"
-#include "dns_type.h"
-#include "transport.h"
-
-#define RECV_BUF_SIZE 4096
-#define DNS_SERVER_PORT 53
-
-/** Request timeout (microseconds) */
-#define REQ_TIMEOUT (5 * 1000 * 1000)
-
-/** Maximum number of retries */
-#define REQ_RETRY_MAX 3
-
-inet_addr_t dns_server_addr;
-
-typedef struct {
-	link_t lreq;
-	dns_message_t *req;
-	dns_message_t *resp;
-
-	bool done;
-	fibril_condvar_t done_cv;
-	fibril_mutex_t done_lock;
-
-	errno_t status;
-} trans_req_t;
-
-static uint8_t recv_buf[RECV_BUF_SIZE];
-static udp_t *transport_udp;
-static udp_assoc_t *transport_assoc;
-
-/** Outstanding requests */
-static LIST_INITIALIZE(treq_list);
-static FIBRIL_MUTEX_INITIALIZE(treq_lock);
-
-static void transport_recv_msg(udp_assoc_t *, udp_rmsg_t *);
-static void transport_recv_err(udp_assoc_t *, udp_rerr_t *);
-static void transport_link_state(udp_assoc_t *, udp_link_state_t);
-
-static udp_cb_t transport_cb = {
-	.recv_msg = transport_recv_msg,
-	.recv_err = transport_recv_err,
-	.link_state = transport_link_state
-};
-
-errno_t transport_init(void)
-{
-	inet_ep2_t epp;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-
-	rc = udp_create(&transport_udp);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = udp_assoc_create(transport_udp, &epp, &transport_cb, NULL,
-	    &transport_assoc);
-	if (rc != EOK) {
-		rc = EIO;
-		goto error;
-	}
-
-	return EOK;
-error:
-	log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing network.");
-	udp_assoc_destroy(transport_assoc);
-	udp_destroy(transport_udp);
-	return rc;
-}
-
-void transport_fini(void)
-{
-	udp_assoc_destroy(transport_assoc);
-	udp_destroy(transport_udp);
-}
-
-static trans_req_t *treq_create(dns_message_t *req)
-{
-	trans_req_t *treq;
-
-	treq = calloc(1, sizeof(trans_req_t));
-	if (treq == NULL)
-		return NULL;
-
-	treq->req = req;
-	treq->resp = NULL;
-	treq->done = false;
-	fibril_condvar_initialize(&treq->done_cv);
-	fibril_mutex_initialize(&treq->done_lock);
-
-	fibril_mutex_lock(&treq_lock);
-	list_append(&treq->lreq, &treq_list);
-	fibril_mutex_unlock(&treq_lock);
-
-	return treq;
-}
-
-static void treq_destroy(trans_req_t *treq)
-{
-	if (link_in_use(&treq->lreq))
-		list_remove(&treq->lreq);
-	free(treq);
-}
-
-static trans_req_t *treq_match_resp(dns_message_t *resp)
-{
-	assert(fibril_mutex_is_locked(&treq_lock));
-
-	list_foreach(treq_list, lreq, trans_req_t, treq) {
-		if (treq->req->id == resp->id) {
-			/* Match */
-			return treq;
-		}
-	}
-
-	return NULL;
-}
-
-static void treq_complete(trans_req_t *treq, dns_message_t *resp)
-{
-	fibril_mutex_lock(&treq->done_lock);
-	treq->done = true;
-	treq->status = EOK;
-	treq->resp = resp;
-	fibril_mutex_unlock(&treq->done_lock);
-
-	fibril_condvar_broadcast(&treq->done_cv);
-}
-
-errno_t dns_request(dns_message_t *req, dns_message_t **rresp)
-{
-	trans_req_t *treq = NULL;
-	inet_ep_t ep;
-
-	void *req_data;
-	size_t req_size;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_request: Encode dns message");
-	errno_t rc = dns_message_encode(req, &req_data, &req_size);
-	if (rc != EOK)
-		goto error;
-
-	inet_ep_init(&ep);
-	ep.addr = dns_server_addr;
-	ep.port = DNS_SERVER_PORT;
-
-	size_t ntry = 0;
-
-	while (ntry < REQ_RETRY_MAX) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dns_request: Send DNS message");
-		rc = udp_assoc_send_msg(transport_assoc, &ep, req_data,
-		    req_size);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Error sending message: %s", str_error(rc));
-			goto error;
-		}
-
-		treq = treq_create(req);
-		if (treq == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		fibril_mutex_lock(&treq->done_lock);
-		while (treq->done != true) {
-			rc = fibril_condvar_wait_timeout(&treq->done_cv, &treq->done_lock,
-			    REQ_TIMEOUT);
-			if (rc == ETIMEOUT) {
-				++ntry;
-				break;
-			}
-		}
-
-		fibril_mutex_unlock(&treq->done_lock);
-
-		if (rc != ETIMEOUT)
-			break;
-	}
-
-	if (ntry >= REQ_RETRY_MAX) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (treq->status != EOK) {
-		rc = treq->status;
-		goto error;
-	}
-
-	*rresp = treq->resp;
-	treq_destroy(treq);
-	free(req_data);
-	return EOK;
-
-error:
-	if (treq != NULL)
-		treq_destroy(treq);
-
-	free(req_data);
-	return rc;
-}
-
-static void transport_recv_msg(udp_assoc_t *assoc, udp_rmsg_t *rmsg)
-{
-	dns_message_t *resp = NULL;
-	trans_req_t *treq;
-	size_t size;
-	inet_ep_t remote_ep;
-	errno_t rc;
-
-	size = udp_rmsg_size(rmsg);
-	if (size > RECV_BUF_SIZE)
-		size = RECV_BUF_SIZE; /* XXX */
-
-	rc = udp_rmsg_read(rmsg, 0, recv_buf, size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error reading message.");
-		return;
-	}
-
-	udp_rmsg_remote_ep(rmsg, &remote_ep);
-	/* XXX */
-
-	rc = dns_message_decode(recv_buf, size, &resp);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error decoding message.");
-		return;
-	}
-
-	assert(resp != NULL);
-
-	fibril_mutex_lock(&treq_lock);
-	treq = treq_match_resp(resp);
-	if (treq == NULL) {
-		fibril_mutex_unlock(&treq_lock);
-		return;
-	}
-
-	list_remove(&treq->lreq);
-	fibril_mutex_unlock(&treq_lock);
-
-	treq_complete(treq, resp);
-}
-
-static void transport_recv_err(udp_assoc_t *assoc, udp_rerr_t *rerr)
-{
-	log_msg(LOG_DEFAULT, LVL_WARN, "Ignoring ICMP error");
-}
-
-static void transport_link_state(udp_assoc_t *assoc, udp_link_state_t ls)
-{
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Link state change");
-}
-
-/** @}
- */
Index: pace/srv/net/dnsrsrv/transport.h
===================================================================
--- uspace/srv/net/dnsrsrv/transport.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup dnsrsrv
- * @{
- */
-/**
- * @file
- */
-
-#ifndef TRANSPORT_H
-#define TRANSPORT_H
-
-#include <inet/addr.h>
-#include "dns_type.h"
-
-extern inet_addr_t dns_server_addr;
-
-extern errno_t transport_init(void);
-extern void transport_fini(void);
-extern errno_t dns_request(dns_message_t *, dns_message_t **);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/doc/doxygroups.h
===================================================================
--- uspace/srv/net/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/** @addtogroup net Networking services
- * @ingroup srvs
- */
-
-/**    @addtogroup udp udp
- *     @brief UDP service
- *     @ingroup net
- */
-
-/**    @addtogroup tcp tcp
- *     @brief TCP service
- *     @ingroup net
- */
-
-/**    @addtogroup slip slip
- *     @brief SLIP service
- *     @ingroup net
- */
-
-/**    @addtogroup slip slip
- *     @brief SLIP service
- *     @ingroup net
- */
-
-/**    @addtogroup loopip loopip
- *     @brief Loopback IP link provider
- *     @ingroup net
- */
-
-/**    @addtogroup inetsrv inetsrv
- *     @brief Internet Protocol service
- *     @ingroup net
- */
-
-/**    @addtogroup ethip ethip
- *     @brief IP over Ethernet service
- *     @ingroup net
- */
-
-/**    @addtogroup dhcp dhcp
- *     @brief DHCP service
- *     @ingroup net
- */
-
-/**    @addtogroup dnsrsrv dnsrsrv
- *     @brief DNS resolution service
- *     @ingroup net
- */
Index: pace/srv/net/ethip/arp.c
===================================================================
--- uspace/srv/net/ethip/arp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <errno.h>
-#include <inet/iplink_srv.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include "arp.h"
-#include "atrans.h"
-#include "ethip.h"
-#include "ethip_nic.h"
-#include "pdu.h"
-#include "std.h"
-
-/** Time to wait for ARP reply in microseconds */
-#define ARP_REQUEST_TIMEOUT (3 * 1000 * 1000)
-
-static errno_t arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet);
-
-void arp_received(ethip_nic_t *nic, eth_frame_t *frame)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "arp_received()");
-
-	arp_eth_packet_t packet;
-	errno_t rc = arp_pdu_decode(frame->data, frame->size, &packet);
-	if (rc != EOK)
-		return;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ARP PDU decoded, opcode=%d, tpa=%x",
-	    packet.opcode, packet.target_proto_addr);
-
-	inet_addr_t addr;
-	inet_addr_set(packet.target_proto_addr, &addr);
-
-	ethip_link_addr_t *laddr = ethip_nic_addr_find(nic, &addr);
-	if (laddr == NULL)
-		return;
-
-	addr32_t laddr_v4;
-	ip_ver_t laddr_ver = inet_addr_get(&laddr->addr, &laddr_v4, NULL);
-	if (laddr_ver != ip_v4)
-		return;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Request/reply to my address");
-
-	(void) atrans_add(packet.sender_proto_addr,
-	    &packet.sender_hw_addr);
-
-	if (packet.opcode == aop_request) {
-		arp_eth_packet_t reply;
-
-		reply.opcode = aop_reply;
-		reply.sender_hw_addr = nic->mac_addr;
-		reply.sender_proto_addr = laddr_v4;
-		reply.target_hw_addr = packet.sender_hw_addr;
-		reply.target_proto_addr = packet.sender_proto_addr;
-
-		arp_send_packet(nic, &reply);
-	}
-}
-
-errno_t arp_translate(ethip_nic_t *nic, addr32_t src_addr, addr32_t ip_addr,
-    eth_addr_t *mac_addr)
-{
-	/* Broadcast address */
-	if (ip_addr == addr32_broadcast_all_hosts) {
-		*mac_addr = eth_addr_broadcast;
-		return EOK;
-	}
-
-	errno_t rc = atrans_lookup(ip_addr, mac_addr);
-	if (rc == EOK)
-		return EOK;
-
-	arp_eth_packet_t packet;
-
-	packet.opcode = aop_request;
-	packet.sender_hw_addr = nic->mac_addr;
-	packet.sender_proto_addr = src_addr;
-	packet.target_hw_addr = eth_addr_broadcast;
-	packet.target_proto_addr = ip_addr;
-
-	rc = arp_send_packet(nic, &packet);
-	if (rc != EOK)
-		return rc;
-
-	return atrans_lookup_timeout(ip_addr, ARP_REQUEST_TIMEOUT, mac_addr);
-}
-
-static errno_t arp_send_packet(ethip_nic_t *nic, arp_eth_packet_t *packet)
-{
-	errno_t rc;
-	void *pdata;
-	size_t psize;
-
-	eth_frame_t frame;
-	void *fdata;
-	size_t fsize;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "arp_send_packet()");
-
-	rc = arp_pdu_encode(packet, &pdata, &psize);
-	if (rc != EOK)
-		return rc;
-
-	frame.dest = packet->target_hw_addr;
-	frame.src = packet->sender_hw_addr;
-	frame.etype_len = ETYPE_ARP;
-	frame.data = pdata;
-	frame.size = psize;
-
-	rc = eth_pdu_encode(&frame, &fdata, &fsize);
-	if (rc != EOK) {
-		free(pdata);
-		return rc;
-	}
-
-	rc = ethip_nic_send(nic, fdata, fsize);
-	free(fdata);
-	free(pdata);
-
-	return rc;
-
-}
-
-/** @}
- */
Index: pace/srv/net/ethip/arp.h
===================================================================
--- uspace/srv/net/ethip/arp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ARP_H_
-#define ARP_H_
-
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include "ethip.h"
-
-extern void arp_received(ethip_nic_t *, eth_frame_t *);
-extern errno_t arp_translate(ethip_nic_t *, addr32_t, addr32_t, eth_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/ethip/atrans.c
===================================================================
--- uspace/srv/net/ethip/atrans.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,166 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <stdlib.h>
-
-#include "atrans.h"
-#include "ethip.h"
-
-/** Address translation list (of ethip_atrans_t) */
-static FIBRIL_MUTEX_INITIALIZE(atrans_list_lock);
-static LIST_INITIALIZE(atrans_list);
-static FIBRIL_CONDVAR_INITIALIZE(atrans_cv);
-
-static ethip_atrans_t *atrans_find(addr32_t ip_addr)
-{
-	list_foreach(atrans_list, atrans_list, ethip_atrans_t, atrans) {
-		if (atrans->ip_addr == ip_addr)
-			return atrans;
-	}
-
-	return NULL;
-}
-
-errno_t atrans_add(addr32_t ip_addr, eth_addr_t *mac_addr)
-{
-	ethip_atrans_t *atrans;
-	ethip_atrans_t *prev;
-
-	atrans = calloc(1, sizeof(ethip_atrans_t));
-	if (atrans == NULL)
-		return ENOMEM;
-
-	atrans->ip_addr = ip_addr;
-	atrans->mac_addr = *mac_addr;
-
-	fibril_mutex_lock(&atrans_list_lock);
-	prev = atrans_find(ip_addr);
-	if (prev != NULL) {
-		list_remove(&prev->atrans_list);
-		free(prev);
-	}
-
-	list_append(&atrans->atrans_list, &atrans_list);
-	fibril_mutex_unlock(&atrans_list_lock);
-	fibril_condvar_broadcast(&atrans_cv);
-
-	return EOK;
-}
-
-errno_t atrans_remove(addr32_t ip_addr)
-{
-	ethip_atrans_t *atrans;
-
-	fibril_mutex_lock(&atrans_list_lock);
-	atrans = atrans_find(ip_addr);
-	if (atrans == NULL) {
-		fibril_mutex_unlock(&atrans_list_lock);
-		return ENOENT;
-	}
-
-	list_remove(&atrans->atrans_list);
-	fibril_mutex_unlock(&atrans_list_lock);
-	free(atrans);
-
-	return EOK;
-}
-
-static errno_t atrans_lookup_locked(addr32_t ip_addr, eth_addr_t *mac_addr)
-{
-	ethip_atrans_t *atrans = atrans_find(ip_addr);
-	if (atrans == NULL)
-		return ENOENT;
-
-	*mac_addr = atrans->mac_addr;
-	return EOK;
-}
-
-errno_t atrans_lookup(addr32_t ip_addr, eth_addr_t *mac_addr)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&atrans_list_lock);
-	rc = atrans_lookup_locked(ip_addr, mac_addr);
-	fibril_mutex_unlock(&atrans_list_lock);
-
-	return rc;
-}
-
-static void atrans_lookup_timeout_handler(void *arg)
-{
-	bool *timedout = (bool *)arg;
-
-	fibril_mutex_lock(&atrans_list_lock);
-	*timedout = true;
-	fibril_mutex_unlock(&atrans_list_lock);
-	fibril_condvar_broadcast(&atrans_cv);
-}
-
-errno_t atrans_lookup_timeout(addr32_t ip_addr, usec_t timeout,
-    eth_addr_t *mac_addr)
-{
-	fibril_timer_t *t;
-	bool timedout;
-	errno_t rc;
-
-	t = fibril_timer_create(NULL);
-	if (t == NULL)
-		return ENOMEM;
-
-	timedout = false;
-	fibril_timer_set(t, timeout, atrans_lookup_timeout_handler, &timedout);
-
-	fibril_mutex_lock(&atrans_list_lock);
-
-	while ((rc = atrans_lookup_locked(ip_addr, mac_addr)) == ENOENT &&
-	    !timedout) {
-		fibril_condvar_wait(&atrans_cv, &atrans_list_lock);
-	}
-
-	fibril_mutex_unlock(&atrans_list_lock);
-	(void) fibril_timer_clear(t);
-	fibril_timer_destroy(t);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/ethip/atrans.h
===================================================================
--- uspace/srv/net/ethip/atrans.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ATRANS_H_
-#define ATRANS_H_
-
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include "ethip.h"
-
-extern errno_t atrans_add(addr32_t, eth_addr_t *);
-extern errno_t atrans_remove(addr32_t);
-extern errno_t atrans_lookup(addr32_t, eth_addr_t *);
-extern errno_t atrans_lookup_timeout(addr32_t, usec_t, eth_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/ethip/ethip.c
===================================================================
--- uspace/srv/net/ethip/ethip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,339 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief IP link provider for Ethernet
- *
- * Based on the IETF RFC 894 standard.
- */
-
-#include <async.h>
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include "arp.h"
-#include "ethip.h"
-#include "ethip_nic.h"
-#include "pdu.h"
-#include "std.h"
-
-#define NAME "ethip"
-
-static errno_t ethip_open(iplink_srv_t *srv);
-static errno_t ethip_close(iplink_srv_t *srv);
-static errno_t ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
-static errno_t ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
-static errno_t ethip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static errno_t ethip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac);
-static errno_t ethip_set_mac48(iplink_srv_t *srv, eth_addr_t *mac);
-static errno_t ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
-static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
-
-static void ethip_client_conn(ipc_call_t *icall, void *arg);
-
-static iplink_ops_t ethip_iplink_ops = {
-	.open = ethip_open,
-	.close = ethip_close,
-	.send = ethip_send,
-	.send6 = ethip_send6,
-	.get_mtu = ethip_get_mtu,
-	.get_mac48 = ethip_get_mac48,
-	.set_mac48 = ethip_set_mac48,
-	.addr_add = ethip_addr_add,
-	.addr_remove = ethip_addr_remove
-};
-
-static loc_srv_t *ethip_srv;
-
-static errno_t ethip_init(void)
-{
-	async_set_fallback_port_handler(ethip_client_conn, NULL);
-
-	errno_t rc = loc_server_register(NAME, &ethip_srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
-		return rc;
-	}
-
-	rc = ethip_nic_discovery_start();
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-errno_t ethip_iplink_init(ethip_nic_t *nic)
-{
-	errno_t rc;
-	service_id_t sid;
-	category_id_t iplink_cat;
-	static unsigned link_num = 0;
-	char *svc_name = NULL;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_iplink_init()");
-
-	iplink_srv_init(&nic->iplink);
-	nic->iplink.ops = &ethip_iplink_ops;
-	nic->iplink.arg = nic;
-
-	if (asprintf(&svc_name, "net/eth%u", ++link_num) < 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = loc_service_register(ethip_srv, svc_name, &sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service %s.", svc_name);
-		goto error;
-	}
-
-	nic->iplink_sid = sid;
-
-	rc = loc_category_get_id("iplink", &iplink_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'iplink'.");
-		goto error;
-	}
-
-	rc = loc_service_add_to_cat(ethip_srv, sid, iplink_cat);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding %s to category.", svc_name);
-		goto error;
-	}
-
-	return EOK;
-
-error:
-	if (svc_name != NULL)
-		free(svc_name);
-	return rc;
-}
-
-static void ethip_client_conn(ipc_call_t *icall, void *arg)
-{
-	ethip_nic_t *nic;
-	service_id_t sid;
-
-	sid = (service_id_t) ipc_get_arg2(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_client_conn(%u)", (unsigned)sid);
-	nic = ethip_nic_find_by_iplink_sid(sid);
-	if (nic == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Uknown service ID.");
-		return;
-	}
-
-	iplink_conn(icall, &nic->iplink);
-}
-
-static errno_t ethip_open(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_open()");
-	return EOK;
-}
-
-static errno_t ethip_close(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_close()");
-	return EOK;
-}
-
-static errno_t ethip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_send()");
-
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-	eth_frame_t frame;
-
-	errno_t rc = arp_translate(nic, sdu->src, sdu->dest, &frame.dest);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed to look up IPv4 address 0x%"
-		    PRIx32, sdu->dest);
-		return rc;
-	}
-
-	frame.src = nic->mac_addr;
-	frame.etype_len = ETYPE_IP;
-	frame.data = sdu->data;
-	frame.size = sdu->size;
-
-	void *data;
-	size_t size;
-	rc = eth_pdu_encode(&frame, &data, &size);
-	if (rc != EOK)
-		return rc;
-
-	rc = ethip_nic_send(nic, data, size);
-	free(data);
-
-	return rc;
-}
-
-static errno_t ethip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_send6()");
-
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-	eth_frame_t frame;
-
-	frame.dest = sdu->dest;
-	frame.src = nic->mac_addr;
-	frame.etype_len = ETYPE_IPV6;
-	frame.data = sdu->data;
-	frame.size = sdu->size;
-
-	void *data;
-	size_t size;
-	errno_t rc = eth_pdu_encode(&frame, &data, &size);
-	if (rc != EOK)
-		return rc;
-
-	rc = ethip_nic_send(nic, data, size);
-	free(data);
-
-	return rc;
-}
-
-errno_t ethip_received(iplink_srv_t *srv, void *data, size_t size)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_received(): srv=%p", srv);
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, " - eth_pdu_decode");
-
-	eth_frame_t frame;
-	errno_t rc = eth_pdu_decode(data, size, &frame);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - eth_pdu_decode failed");
-		return rc;
-	}
-
-	iplink_recv_sdu_t sdu;
-
-	switch (frame.etype_len) {
-	case ETYPE_ARP:
-		arp_received(nic, &frame);
-		break;
-	case ETYPE_IP:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - construct SDU");
-		sdu.data = frame.data;
-		sdu.size = frame.size;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - call iplink_ev_recv");
-		rc = iplink_ev_recv(&nic->iplink, &sdu, ip_v4);
-		break;
-	case ETYPE_IPV6:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - construct SDU IPv6");
-		sdu.data = frame.data;
-		sdu.size = frame.size;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - call iplink_ev_recv");
-		rc = iplink_ev_recv(&nic->iplink, &sdu, ip_v6);
-		break;
-	default:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Unknown ethertype 0x%" PRIx16,
-		    frame.etype_len);
-	}
-
-	free(frame.data);
-	return rc;
-}
-
-static errno_t ethip_get_mtu(iplink_srv_t *srv, size_t *mtu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_get_mtu()");
-	*mtu = 1500;
-	return EOK;
-}
-
-static errno_t ethip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_get_mac48()");
-
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-	*mac = nic->mac_addr;
-
-	return EOK;
-}
-
-static errno_t ethip_set_mac48(iplink_srv_t *srv, eth_addr_t *mac)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_set_mac48()");
-
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-	nic->mac_addr = *mac;
-
-	return EOK;
-}
-
-static errno_t ethip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-
-	return ethip_nic_addr_add(nic, addr);
-}
-
-static errno_t ethip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	ethip_nic_t *nic = (ethip_nic_t *) srv->arg;
-
-	return ethip_nic_addr_remove(nic, addr);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS IP over Ethernet service\n");
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = ethip_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/ethip/ethip.h
===================================================================
--- uspace/srv/net/ethip/ethip.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,125 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ETHIP_H_
-#define ETHIP_H_
-
-#include <adt/list.h>
-#include <async.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <loc.h>
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct {
-	link_t link;
-	inet_addr_t addr;
-} ethip_link_addr_t;
-
-typedef struct ethip_nic {
-	link_t link;
-	service_id_t svc_id;
-	char *svc_name;
-	async_sess_t *sess;
-
-	iplink_srv_t iplink;
-	service_id_t iplink_sid;
-
-	/** MAC address */
-	eth_addr_t mac_addr;
-
-	/**
-	 * List of IP addresses configured on this link
-	 * (of the type ethip_link_addr_t)
-	 */
-	list_t addr_list;
-} ethip_nic_t;
-
-/** Ethernet frame */
-typedef struct {
-	/** Destination Address */
-	eth_addr_t dest;
-	/** Source Address */
-	eth_addr_t src;
-	/** Ethertype or Length */
-	uint16_t etype_len;
-	/** Payload */
-	void *data;
-	/** Payload size */
-	size_t size;
-} eth_frame_t;
-
-/** ARP opcode */
-typedef enum {
-	/** Request */
-	aop_request,
-	/** Reply */
-	aop_reply
-} arp_opcode_t;
-
-/** ARP packet (for 48-bit MAC addresses and IPv4)
- *
- * Internal representation
- */
-typedef struct {
-	/** Opcode */
-	arp_opcode_t opcode;
-	/** Sender hardware address */
-	eth_addr_t sender_hw_addr;
-	/** Sender protocol address */
-	addr32_t sender_proto_addr;
-	/** Target hardware address */
-	eth_addr_t target_hw_addr;
-	/** Target protocol address */
-	addr32_t target_proto_addr;
-} arp_eth_packet_t;
-
-/** Address translation table element */
-typedef struct {
-	link_t atrans_list;
-	addr32_t ip_addr;
-	eth_addr_t mac_addr;
-} ethip_atrans_t;
-
-extern errno_t ethip_iplink_init(ethip_nic_t *);
-extern errno_t ethip_received(iplink_srv_t *, void *, size_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/ethip/ethip_nic.c
===================================================================
--- uspace/srv/net/ethip/ethip_nic.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,477 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <adt/list.h>
-#include <async.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <io/log.h>
-#include <loc.h>
-#include <mem.h>
-#include <nic_iface.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str_error.h>
-#include "ethip.h"
-#include "ethip_nic.h"
-#include "pdu.h"
-
-static errno_t ethip_nic_open(service_id_t sid);
-static void ethip_nic_cb_conn(ipc_call_t *icall, void *arg);
-
-static LIST_INITIALIZE(ethip_nic_list);
-static FIBRIL_MUTEX_INITIALIZE(ethip_discovery_lock);
-
-static errno_t ethip_nic_check_new(void)
-{
-	bool already_known;
-	category_id_t iplink_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	errno_t rc;
-
-	fibril_mutex_lock(&ethip_discovery_lock);
-
-	rc = loc_category_get_id("nic", &iplink_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'nic'.");
-		fibril_mutex_unlock(&ethip_discovery_lock);
-		return ENOENT;
-	}
-
-	rc = loc_category_get_svcs(iplink_cat, &svcs, &count);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of IP links.");
-		fibril_mutex_unlock(&ethip_discovery_lock);
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		list_foreach(ethip_nic_list, link, ethip_nic_t, nic) {
-			if (nic->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Found NIC '%lu'",
-			    (unsigned long) svcs[i]);
-			rc = ethip_nic_open(svcs[i]);
-			if (rc != EOK)
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Could not open NIC.");
-		}
-	}
-
-	fibril_mutex_unlock(&ethip_discovery_lock);
-	return EOK;
-}
-
-static ethip_nic_t *ethip_nic_new(void)
-{
-	ethip_nic_t *nic = calloc(1, sizeof(ethip_nic_t));
-	if (nic == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC structure. "
-		    "Out of memory.");
-		return NULL;
-	}
-
-	link_initialize(&nic->link);
-	list_initialize(&nic->addr_list);
-
-	return nic;
-}
-
-static ethip_link_addr_t *ethip_nic_addr_new(inet_addr_t *addr)
-{
-	ethip_link_addr_t *laddr = calloc(1, sizeof(ethip_link_addr_t));
-	if (laddr == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating NIC address structure. "
-		    "Out of memory.");
-		return NULL;
-	}
-
-	link_initialize(&laddr->link);
-	laddr->addr = *addr;
-
-	return laddr;
-}
-
-static void ethip_nic_delete(ethip_nic_t *nic)
-{
-	if (nic->svc_name != NULL)
-		free(nic->svc_name);
-
-	free(nic);
-}
-
-static void ethip_link_addr_delete(ethip_link_addr_t *laddr)
-{
-	free(laddr);
-}
-
-static errno_t ethip_nic_open(service_id_t sid)
-{
-	bool in_list = false;
-	nic_address_t nic_address;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_open()");
-	ethip_nic_t *nic = ethip_nic_new();
-	if (nic == NULL)
-		return ENOMEM;
-
-	errno_t rc = loc_service_get_name(sid, &nic->svc_name);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting service name.");
-		goto error;
-	}
-
-	nic->sess = loc_service_connect(sid, INTERFACE_DDF, 0);
-	if (nic->sess == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", nic->svc_name);
-		goto error;
-	}
-
-	nic->svc_id = sid;
-
-	rc = nic_callback_create(nic->sess, ethip_nic_cb_conn, nic);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating callback connection "
-		    "from '%s'", nic->svc_name);
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Opened NIC '%s'", nic->svc_name);
-	list_append(&nic->link, &ethip_nic_list);
-	in_list = true;
-
-	rc = ethip_iplink_init(nic);
-	if (rc != EOK)
-		goto error;
-
-	rc = nic_get_address(nic->sess, &nic_address);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting MAC address of NIC '%s'.",
-		    nic->svc_name);
-		goto error;
-	}
-
-	eth_addr_decode(nic_address.address, &nic->mac_addr);
-
-	rc = nic_set_state(nic->sess, NIC_STATE_ACTIVE);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error activating NIC '%s'.",
-		    nic->svc_name);
-		goto error;
-	}
-
-	rc = nic_broadcast_set_mode(nic->sess, NIC_BROADCAST_ACCEPTED);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error enabling "
-		    "reception of broadcast frames on '%s'.", nic->svc_name);
-		goto error;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Initialized IP link service,");
-
-	return EOK;
-
-error:
-	if (in_list)
-		list_remove(&nic->link);
-
-	if (nic->sess != NULL)
-		async_hangup(nic->sess);
-
-	ethip_nic_delete(nic);
-	return rc;
-}
-
-static void ethip_nic_cat_change_cb(void *arg)
-{
-	(void) ethip_nic_check_new();
-}
-
-static void ethip_nic_addr_changed(ethip_nic_t *nic, ipc_call_t *call)
-{
-	uint8_t *addr;
-	size_t size;
-	eth_addr_str_t saddr;
-	errno_t rc;
-
-	rc = async_data_write_accept((void **) &addr, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "data_write_accept() failed");
-		return;
-	}
-
-	eth_addr_decode(addr, &nic->mac_addr);
-	eth_addr_format(&nic->mac_addr, &saddr);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_changed(): "
-	    "new addr=%s", saddr.str);
-
-	rc = iplink_ev_change_addr(&nic->iplink, &nic->mac_addr);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "iplink_ev_change_addr() failed");
-		return;
-	}
-
-	free(addr);
-	async_answer_0(call, EOK);
-}
-
-static void ethip_nic_received(ethip_nic_t *nic, ipc_call_t *call)
-{
-	errno_t rc;
-	void *data;
-	size_t size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() nic=%p", nic);
-
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "data_write_accept() failed");
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Ethernet PDU contents (%zu bytes)",
-	    size);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "call ethip_received");
-	rc = ethip_received(&nic->iplink, data, size);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "free data");
-	free(data);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_received() done, rc=%s", str_error_name(rc));
-	async_answer_0(call, rc);
-}
-
-static void ethip_nic_device_state(ethip_nic_t *nic, ipc_call_t *call)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_device_state()");
-	async_answer_0(call, ENOTSUP);
-}
-
-static void ethip_nic_cb_conn(ipc_call_t *icall, void *arg)
-{
-	ethip_nic_t *nic = (ethip_nic_t *)arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethnip_nic_cb_conn()");
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case NIC_EV_ADDR_CHANGED:
-			ethip_nic_addr_changed(nic, &call);
-			break;
-		case NIC_EV_RECEIVED:
-			ethip_nic_received(nic, &call);
-			break;
-		case NIC_EV_DEVICE_STATE:
-			ethip_nic_device_state(nic, &call);
-			break;
-		default:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "unknown IPC method: %" PRIun, ipc_get_imethod(&call));
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-errno_t ethip_nic_discovery_start(void)
-{
-	errno_t rc = loc_register_cat_change_cb(ethip_nic_cat_change_cb, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback for NIC "
-		    "discovery: %s.", str_error(rc));
-		return rc;
-	}
-
-	return ethip_nic_check_new();
-}
-
-ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t iplink_sid)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid(%u)",
-	    (unsigned) iplink_sid);
-
-	list_foreach(ethip_nic_list, link, ethip_nic_t, nic) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - element");
-		if (nic->iplink_sid == iplink_sid) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - found %p", nic);
-			return nic;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_find_by_iplink_sid - not found");
-	return NULL;
-}
-
-errno_t ethip_nic_send(ethip_nic_t *nic, void *data, size_t size)
-{
-	errno_t rc;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_send(size=%zu)", size);
-	rc = nic_send_frame(nic->sess, data, size);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "nic_send_frame -> %s", str_error_name(rc));
-	return rc;
-}
-
-/** Setup accepted multicast addresses
- *
- * Currently the set of accepted multicast addresses is
- * determined only based on IPv6 addresses.
- *
- */
-static errno_t ethip_nic_setup_multicast(ethip_nic_t *nic)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_setup_multicast()");
-
-	/* Count the number of multicast addresses */
-
-	size_t count = 0;
-
-	list_foreach(nic->addr_list, link, ethip_link_addr_t, laddr) {
-		ip_ver_t ver = inet_addr_get(&laddr->addr, NULL, NULL);
-		if (ver == ip_v6)
-			count++;
-	}
-
-	if (count == 0)
-		return nic_multicast_set_mode(nic->sess, NIC_MULTICAST_BLOCKED,
-		    NULL, 0);
-
-	nic_address_t *mac_list = calloc(count, sizeof(nic_address_t));
-	if (mac_list == NULL)
-		return ENOMEM;
-
-	/* Create the multicast MAC list */
-
-	size_t i = 0;
-
-	list_foreach(nic->addr_list, link, ethip_link_addr_t, laddr) {
-		addr128_t v6;
-		ip_ver_t ver = inet_addr_get(&laddr->addr, NULL, &v6);
-		if (ver != ip_v6)
-			continue;
-
-		assert(i < count);
-
-		eth_addr_t mac;
-		eth_addr_solicited_node(v6, &mac);
-
-		/* Avoid duplicate addresses in the list */
-
-		bool found = false;
-
-		for (size_t j = 0; j < i; j++) {
-			eth_addr_t mac_entry;
-			eth_addr_decode(mac_list[j].address, &mac_entry);
-			if (eth_addr_compare(&mac_entry, &mac)) {
-				found = true;
-				break;
-			}
-		}
-
-		if (!found) {
-			eth_addr_encode(&mac, mac_list[i].address);
-			i++;
-		} else {
-			count--;
-		}
-	}
-
-	/* Setup the multicast MAC list */
-
-	errno_t rc = nic_multicast_set_mode(nic->sess, NIC_MULTICAST_LIST,
-	    mac_list, count);
-
-	free(mac_list);
-	return rc;
-}
-
-errno_t ethip_nic_addr_add(ethip_nic_t *nic, inet_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_add()");
-
-	ethip_link_addr_t *laddr = ethip_nic_addr_new(addr);
-	if (laddr == NULL)
-		return ENOMEM;
-
-	list_append(&laddr->link, &nic->addr_list);
-
-	return ethip_nic_setup_multicast(nic);
-}
-
-errno_t ethip_nic_addr_remove(ethip_nic_t *nic, inet_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_remove()");
-
-	ethip_link_addr_t *laddr = ethip_nic_addr_find(nic, addr);
-	if (laddr == NULL)
-		return ENOENT;
-
-	list_remove(&laddr->link);
-	ethip_link_addr_delete(laddr);
-
-	return ethip_nic_setup_multicast(nic);
-}
-
-ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *nic,
-    inet_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ethip_nic_addr_find()");
-
-	list_foreach(nic->addr_list, link, ethip_link_addr_t, laddr) {
-		if (inet_addr_compare(addr, &laddr->addr))
-			return laddr;
-	}
-
-	return NULL;
-}
-
-/** @}
- */
Index: pace/srv/net/ethip/ethip_nic.h
===================================================================
--- uspace/srv/net/ethip/ethip_nic.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,54 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ETHIP_NIC_H_
-#define ETHIP_NIC_H_
-
-#include <ipc/loc.h>
-#include <inet/addr.h>
-#include "ethip.h"
-
-extern errno_t ethip_nic_discovery_start(void);
-extern ethip_nic_t *ethip_nic_find_by_iplink_sid(service_id_t);
-extern errno_t ethip_nic_send(ethip_nic_t *, void *, size_t);
-extern errno_t ethip_nic_addr_add(ethip_nic_t *, inet_addr_t *);
-extern errno_t ethip_nic_addr_remove(ethip_nic_t *, inet_addr_t *);
-extern ethip_link_addr_t *ethip_nic_addr_find(ethip_nic_t *, inet_addr_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/ethip/meson.build
===================================================================
--- uspace/srv/net/ethip/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,36 +1,0 @@
-#
-# Copyright (c) 2012 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files(
-	'arp.c',
-	'atrans.c',
-	'ethip.c',
-	'ethip_nic.c',
-	'pdu.c',
-)
Index: pace/srv/net/ethip/pdu.c
===================================================================
--- uspace/srv/net/ethip/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,217 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <io/log.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "ethip.h"
-#include "std.h"
-#include "pdu.h"
-
-/** Encode Ethernet PDU. */
-errno_t eth_pdu_encode(eth_frame_t *frame, void **rdata, size_t *rsize)
-{
-	void *data;
-	size_t size;
-	eth_header_t *hdr;
-
-	size = max(sizeof(eth_header_t) + frame->size, ETH_FRAME_MIN_SIZE);
-
-	data = calloc(size, 1);
-	if (data == NULL)
-		return ENOMEM;
-
-	hdr = (eth_header_t *)data;
-	eth_addr_encode(&frame->src, hdr->src);
-	eth_addr_encode(&frame->dest, hdr->dest);
-	hdr->etype_len = host2uint16_t_be(frame->etype_len);
-
-	memcpy((uint8_t *)data + sizeof(eth_header_t), frame->data,
-	    frame->size);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Encoded Ethernet frame (%zu bytes)", size);
-
-	*rdata = data;
-	*rsize = size;
-	return EOK;
-}
-
-/** Decode Ethernet PDU. */
-errno_t eth_pdu_decode(void *data, size_t size, eth_frame_t *frame)
-{
-	eth_header_t *hdr;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "eth_pdu_decode()");
-
-	if (size < sizeof(eth_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "PDU too short (%zu)", size);
-		return EINVAL;
-	}
-
-	hdr = (eth_header_t *)data;
-
-	frame->size = size - sizeof(eth_header_t);
-	frame->data = calloc(frame->size, 1);
-	if (frame->data == NULL)
-		return ENOMEM;
-
-	eth_addr_decode(hdr->src, &frame->src);
-	eth_addr_decode(hdr->dest, &frame->dest);
-	frame->etype_len = uint16_t_be2host(hdr->etype_len);
-
-	memcpy(frame->data, (uint8_t *)data + sizeof(eth_header_t),
-	    frame->size);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Decoded Ethernet frame payload (%zu bytes)", frame->size);
-
-	return EOK;
-}
-
-/** Encode ARP PDU. */
-errno_t arp_pdu_encode(arp_eth_packet_t *packet, void **rdata, size_t *rsize)
-{
-	void *data;
-	size_t size;
-	arp_eth_packet_fmt_t *pfmt;
-	uint16_t fopcode;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "arp_pdu_encode()");
-
-	size = sizeof(arp_eth_packet_fmt_t);
-
-	data = calloc(size, 1);
-	if (data == NULL)
-		return ENOMEM;
-
-	pfmt = (arp_eth_packet_fmt_t *)data;
-
-	switch (packet->opcode) {
-	case aop_request:
-		fopcode = AOP_REQUEST;
-		break;
-	case aop_reply:
-		fopcode = AOP_REPLY;
-		break;
-	default:
-		assert(false);
-		fopcode = 0;
-	}
-
-	pfmt->hw_addr_space = host2uint16_t_be(AHRD_ETHERNET);
-	pfmt->proto_addr_space = host2uint16_t_be(ETYPE_IP);
-	pfmt->hw_addr_size = ETH_ADDR_SIZE;
-	pfmt->proto_addr_size = IPV4_ADDR_SIZE;
-	pfmt->opcode = host2uint16_t_be(fopcode);
-	eth_addr_encode(&packet->sender_hw_addr, pfmt->sender_hw_addr);
-	pfmt->sender_proto_addr =
-	    host2uint32_t_be(packet->sender_proto_addr);
-	eth_addr_encode(&packet->target_hw_addr, pfmt->target_hw_addr);
-	pfmt->target_proto_addr =
-	    host2uint32_t_be(packet->target_proto_addr);
-
-	*rdata = data;
-	*rsize = size;
-	return EOK;
-}
-
-/** Decode ARP PDU. */
-errno_t arp_pdu_decode(void *data, size_t size, arp_eth_packet_t *packet)
-{
-	arp_eth_packet_fmt_t *pfmt;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "arp_pdu_decode()");
-
-	if (size < sizeof(arp_eth_packet_fmt_t)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "ARP PDU too short (%zu)", size);
-		return EINVAL;
-	}
-
-	pfmt = (arp_eth_packet_fmt_t *)data;
-
-	if (uint16_t_be2host(pfmt->hw_addr_space) != AHRD_ETHERNET) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "HW address space != %u (%" PRIu16 ")",
-		    AHRD_ETHERNET, uint16_t_be2host(pfmt->hw_addr_space));
-		return EINVAL;
-	}
-
-	if (uint16_t_be2host(pfmt->proto_addr_space) != 0x0800) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Proto address space != %u (%" PRIu16 ")",
-		    ETYPE_IP, uint16_t_be2host(pfmt->proto_addr_space));
-		return EINVAL;
-	}
-
-	if (pfmt->hw_addr_size != ETH_ADDR_SIZE) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "HW address size != %zu (%zu)",
-		    (size_t)ETH_ADDR_SIZE, (size_t)pfmt->hw_addr_size);
-		return EINVAL;
-	}
-
-	if (pfmt->proto_addr_size != IPV4_ADDR_SIZE) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Proto address size != %zu (%zu)",
-		    (size_t)IPV4_ADDR_SIZE, (size_t)pfmt->proto_addr_size);
-		return EINVAL;
-	}
-
-	switch (uint16_t_be2host(pfmt->opcode)) {
-	case AOP_REQUEST:
-		packet->opcode = aop_request;
-		break;
-	case AOP_REPLY:
-		packet->opcode = aop_reply;
-		break;
-	default:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Invalid ARP opcode (%" PRIu16 ")",
-		    uint16_t_be2host(pfmt->opcode));
-		return EINVAL;
-	}
-
-	eth_addr_decode(pfmt->sender_hw_addr, &packet->sender_hw_addr);
-	packet->sender_proto_addr =
-	    uint32_t_be2host(pfmt->sender_proto_addr);
-	eth_addr_decode(pfmt->target_hw_addr, &packet->target_hw_addr);
-	packet->target_proto_addr =
-	    uint32_t_be2host(pfmt->target_proto_addr);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "packet->tpa = %x\n", pfmt->target_proto_addr);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/net/ethip/pdu.h
===================================================================
--- uspace/srv/net/ethip/pdu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ETH_PDU_H_
-#define ETH_PDU_H_
-
-#include "ethip.h"
-
-extern errno_t eth_pdu_encode(eth_frame_t *, void **, size_t *);
-extern errno_t eth_pdu_decode(void *, size_t, eth_frame_t *);
-extern errno_t arp_pdu_encode(arp_eth_packet_t *, void **, size_t *);
-extern errno_t arp_pdu_decode(void *, size_t, arp_eth_packet_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/ethip/std.h
===================================================================
--- uspace/srv/net/ethip/std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,97 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file Ethernet, IP/Ethernet standard definitions
- *
- */
-
-#ifndef ETHIP_STD_H_
-#define ETHIP_STD_H_
-
-#include <stdint.h>
-
-#define ETH_ADDR_SIZE       6
-#define IPV4_ADDR_SIZE      4
-#define ETH_FRAME_MIN_SIZE  60
-
-/** Ethernet frame header */
-typedef struct {
-	/** Destination Address */
-	uint8_t dest[ETH_ADDR_SIZE];
-	/** Source Address */
-	uint8_t src[ETH_ADDR_SIZE];
-	/** Ethertype or Length */
-	uint16_t etype_len;
-} eth_header_t;
-
-/** ARP packet format (for 48-bit MAC addresses and IPv4) */
-typedef struct {
-	/** Hardware address space */
-	uint16_t hw_addr_space;
-	/** Protocol address space */
-	uint16_t proto_addr_space;
-	/** Hardware address size */
-	uint8_t hw_addr_size;
-	/** Protocol address size */
-	uint8_t proto_addr_size;
-	/** Opcode */
-	uint16_t opcode;
-	/** Sender hardware address */
-	uint8_t sender_hw_addr[ETH_ADDR_SIZE];
-	/** Sender protocol address */
-	uint32_t sender_proto_addr;
-	/** Target hardware address */
-	uint8_t target_hw_addr[ETH_ADDR_SIZE];
-	/** Target protocol address */
-	uint32_t target_proto_addr;
-} __attribute__((packed)) arp_eth_packet_fmt_t;
-
-enum arp_opcode_fmt {
-	AOP_REQUEST = 1,
-	AOP_REPLY   = 2
-};
-
-enum arp_hw_addr_space {
-	AHRD_ETHERNET = 1
-};
-
-/** IP Ethertype */
-enum ether_type {
-	ETYPE_ARP  = 0x0806,
-	ETYPE_IP   = 0x0800,
-	ETYPE_IPV6 = 0x86DD
-};
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/addrobj.c
===================================================================
--- uspace/srv/net/inetsrv/addrobj.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,512 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <bitops.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/eth_addr.h>
-#include <io/log.h>
-#include <ipc/loc.h>
-#include <sif.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "addrobj.h"
-#include "inetsrv.h"
-#include "inet_link.h"
-#include "ndp.h"
-
-static inet_addrobj_t *inet_addrobj_find_by_name_locked(const char *, inet_link_t *);
-
-static FIBRIL_MUTEX_INITIALIZE(addr_list_lock);
-static LIST_INITIALIZE(addr_list);
-static sysarg_t addr_id = 0;
-
-inet_addrobj_t *inet_addrobj_new(void)
-{
-	inet_addrobj_t *addr = calloc(1, sizeof(inet_addrobj_t));
-
-	if (addr == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating address object. "
-		    "Out of memory.");
-		return NULL;
-	}
-
-	link_initialize(&addr->addr_list);
-	fibril_mutex_lock(&addr_list_lock);
-	addr->id = ++addr_id;
-	fibril_mutex_unlock(&addr_list_lock);
-
-	return addr;
-}
-
-void inet_addrobj_delete(inet_addrobj_t *addr)
-{
-	if (addr->name != NULL)
-		free(addr->name);
-	free(addr);
-}
-
-errno_t inet_addrobj_add(inet_addrobj_t *addr)
-{
-	inet_addrobj_t *aobj;
-
-	fibril_mutex_lock(&addr_list_lock);
-	aobj = inet_addrobj_find_by_name_locked(addr->name, addr->ilink);
-	if (aobj != NULL) {
-		/* Duplicate address name */
-		fibril_mutex_unlock(&addr_list_lock);
-		return EEXIST;
-	}
-
-	list_append(&addr->addr_list, &addr_list);
-	fibril_mutex_unlock(&addr_list_lock);
-
-	return EOK;
-}
-
-void inet_addrobj_remove(inet_addrobj_t *addr)
-{
-	fibril_mutex_lock(&addr_list_lock);
-	list_remove(&addr->addr_list);
-	fibril_mutex_unlock(&addr_list_lock);
-}
-
-/** Find address object matching address @a addr.
- *
- * @param addr Address
- * @oaram find iaf_net to find network (using mask),
- *             iaf_addr to find local address (exact match)
- *
- */
-inet_addrobj_t *inet_addrobj_find(inet_addr_t *addr, inet_addrobj_find_t find)
-{
-	fibril_mutex_lock(&addr_list_lock);
-
-	list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) {
-		switch (find) {
-		case iaf_net:
-			if (inet_naddr_compare_mask(&naddr->naddr, addr)) {
-				fibril_mutex_unlock(&addr_list_lock);
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p",
-				    naddr);
-				return naddr;
-			}
-			break;
-		case iaf_addr:
-			if (inet_naddr_compare(&naddr->naddr, addr)) {
-				fibril_mutex_unlock(&addr_list_lock);
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: found %p",
-				    naddr);
-				return naddr;
-			}
-			break;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find: Not found");
-	fibril_mutex_unlock(&addr_list_lock);
-
-	return NULL;
-}
-
-/** Find address object on a link, with a specific name.
- *
- * @param name	Address object name
- * @param ilink	Inet link
- * @return	Address object
- */
-static inet_addrobj_t *inet_addrobj_find_by_name_locked(const char *name, inet_link_t *ilink)
-{
-	assert(fibril_mutex_is_locked(&addr_list_lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find_by_name_locked('%s', '%s')",
-	    name, ilink->svc_name);
-
-	list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) {
-		if (naddr->ilink == ilink && str_cmp(naddr->name, name) == 0) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find_by_name_locked: found %p",
-			    naddr);
-			return naddr;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find_by_name_locked: Not found");
-
-	return NULL;
-}
-
-/** Find address object on a link, with a specific name.
- *
- * @param name	Address object name
- * @param ilink	Inet link
- * @return	Address object
- */
-inet_addrobj_t *inet_addrobj_find_by_name(const char *name, inet_link_t *ilink)
-{
-	inet_addrobj_t *aobj;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_find_by_name('%s', '%s')",
-	    name, ilink->svc_name);
-
-	fibril_mutex_lock(&addr_list_lock);
-	aobj = inet_addrobj_find_by_name_locked(name, ilink);
-	fibril_mutex_unlock(&addr_list_lock);
-
-	return aobj;
-}
-
-/** Find address object with the given ID.
- *
- * @param id	Address object ID
- * @return	Address object
- */
-inet_addrobj_t *inet_addrobj_get_by_id(sysarg_t id)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_get_by_id(%zu)", (size_t)id);
-
-	fibril_mutex_lock(&addr_list_lock);
-
-	list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) {
-		if (naddr->id == id) {
-			fibril_mutex_unlock(&addr_list_lock);
-			return naddr;
-		}
-	}
-
-	fibril_mutex_unlock(&addr_list_lock);
-
-	return NULL;
-}
-
-/** Count number of non-temporary address objects configured for link.
- *
- * @param ilink Inet link
- * @return Number of address objects configured for this link
- */
-unsigned inet_addrobj_cnt_by_link(inet_link_t *ilink)
-{
-	unsigned cnt;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_cnt_by_link()");
-
-	fibril_mutex_lock(&addr_list_lock);
-
-	cnt = 0;
-	list_foreach(addr_list, addr_list, inet_addrobj_t, naddr) {
-		if (naddr->ilink == ilink && naddr->temp == false)
-			++cnt;
-	}
-
-	fibril_mutex_unlock(&addr_list_lock);
-	return cnt;
-}
-
-/** Send datagram from address object */
-errno_t inet_addrobj_send_dgram(inet_addrobj_t *addr, inet_addr_t *ldest,
-    inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
-{
-	inet_addr_t lsrc_addr;
-	inet_naddr_addr(&addr->naddr, &lsrc_addr);
-
-	addr32_t lsrc_v4;
-	addr128_t lsrc_v6;
-	ip_ver_t lsrc_ver = inet_addr_get(&lsrc_addr, &lsrc_v4, &lsrc_v6);
-
-	addr32_t ldest_v4;
-	addr128_t ldest_v6;
-	ip_ver_t ldest_ver = inet_addr_get(ldest, &ldest_v4, &ldest_v6);
-
-	if (lsrc_ver != ldest_ver)
-		return EINVAL;
-
-	errno_t rc;
-	eth_addr_t ldest_mac;
-
-	switch (ldest_ver) {
-	case ip_v4:
-		return inet_link_send_dgram(addr->ilink, lsrc_v4, ldest_v4,
-		    dgram, proto, ttl, df);
-	case ip_v6:
-		/*
-		 * Translate local destination IPv6 address.
-		 */
-		rc = ndp_translate(lsrc_v6, ldest_v6, &ldest_mac, addr->ilink);
-		if (rc != EOK)
-			return rc;
-
-		return inet_link_send_dgram6(addr->ilink, &ldest_mac, dgram,
-		    proto, ttl, df);
-	default:
-		assert(false);
-		break;
-	}
-
-	return ENOTSUP;
-}
-
-/** Get IDs of all address objects. */
-errno_t inet_addrobj_get_id_list(sysarg_t **rid_list, size_t *rcount)
-{
-	sysarg_t *id_list;
-	size_t count, i;
-
-	fibril_mutex_lock(&addr_list_lock);
-	count = list_count(&addr_list);
-
-	id_list = calloc(count, sizeof(sysarg_t));
-	if (id_list == NULL) {
-		fibril_mutex_unlock(&addr_list_lock);
-		return ENOMEM;
-	}
-
-	i = 0;
-	list_foreach(addr_list, addr_list, inet_addrobj_t, addr) {
-		id_list[i++] = addr->id;
-	}
-
-	fibril_mutex_unlock(&addr_list_lock);
-
-	*rid_list = id_list;
-	*rcount = count;
-
-	return EOK;
-}
-
-/** Load address object from SIF node.
- *
- * @param anode SIF node to load address object from
- * @return EOK on success or an error code
- */
-static errno_t inet_addrobj_load(sif_node_t *anode)
-{
-	errno_t rc;
-	const char *sid;
-	const char *snaddr;
-	const char *slink;
-	const char *name;
-	char *endptr;
-	int id;
-	inet_naddr_t naddr;
-	inet_addrobj_t *addr;
-	inet_link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_load()");
-
-	sid = sif_node_get_attr(anode, "id");
-	if (sid == NULL)
-		return EIO;
-
-	snaddr = sif_node_get_attr(anode, "naddr");
-	if (snaddr == NULL)
-		return EIO;
-
-	slink = sif_node_get_attr(anode, "link");
-	if (slink == NULL)
-		return EIO;
-
-	name = sif_node_get_attr(anode, "name");
-	if (name == NULL)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_addrobj_load(): id='%s' "
-	    "naddr='%s' link='%s' name='%s'", sid, snaddr, slink, name);
-
-	id = strtoul(sid, &endptr, 10);
-	if (*endptr != '\0')
-		return EIO;
-
-	rc = inet_naddr_parse(snaddr, &naddr, NULL);
-	if (rc != EOK)
-		return EIO;
-
-	link = inet_link_get_by_svc_name(slink);
-	if (link == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Link '%s' not found",
-		    slink);
-		return EIO;
-	}
-
-	addr = inet_addrobj_new();
-	if (addr == NULL)
-		return ENOMEM;
-
-	addr->id = id;
-	addr->naddr = naddr;
-	addr->ilink = link;
-	addr->name = str_dup(name);
-
-	if (addr->name == NULL) {
-		inet_addrobj_delete(addr);
-		return ENOMEM;
-	}
-
-	inet_addrobj_add(addr);
-	return EOK;
-}
-
-/** Load address objects from SIF node.
- *
- * @param naddrs SIF node to load address objects from
- * @return EOK on success or an error code
- */
-errno_t inet_addrobjs_load(sif_node_t *naddrs)
-{
-	sif_node_t *naddr;
-	const char *ntype;
-	errno_t rc;
-
-	naddr = sif_node_first_child(naddrs);
-	while (naddr != NULL) {
-		ntype = sif_node_get_type(naddr);
-		if (str_cmp(ntype, "address") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = inet_addrobj_load(naddr);
-		if (rc != EOK)
-			goto error;
-
-		naddr = sif_node_next_child(naddr);
-	}
-
-	return EOK;
-error:
-	return rc;
-
-}
-
-/** Save address object to SIF node.
- *
- * @param addr Address object
- * @param naddr SIF node to save addres to
- * @return EOK on success or an error code
- */
-static errno_t inet_addrobj_save(inet_addrobj_t *addr, sif_node_t *naddr)
-{
-	char *str = NULL;
-	errno_t rc;
-	int rv;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobj_save(%p, %p)",
-	    addr, naddr);
-
-	/* id */
-
-	rv = asprintf(&str, "%zu", addr->id);
-	if (rv < 0) {
-		str = NULL;
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = sif_node_set_attr(naddr, "id", str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	str = NULL;
-
-	/* dest */
-
-	rc = inet_naddr_format(&addr->naddr, &str);
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_node_set_attr(naddr, "naddr", str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	str = NULL;
-
-	/* link */
-
-	rc = sif_node_set_attr(naddr, "link", addr->ilink->svc_name);
-	if (rc != EOK)
-		goto error;
-
-	/* name */
-
-	rc = sif_node_set_attr(naddr, "name", addr->name);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-
-	return rc;
-error:
-	if (str != NULL)
-		free(str);
-	return rc;
-}
-
-/** Save address objects to SIF node.
- *
- * @param cnode SIF node to save address objects to
- * @return EOK on success or an error code
- */
-errno_t inet_addrobjs_save(sif_node_t *cnode)
-{
-	sif_node_t *naddr;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_addrobjs_save()");
-
-	fibril_mutex_lock(&addr_list_lock);
-
-	list_foreach(addr_list, addr_list, inet_addrobj_t, addr) {
-		if (addr->temp == false) {
-			rc = sif_node_append_child(cnode, "address", &naddr);
-			if (rc != EOK)
-				goto error;
-
-			rc = inet_addrobj_save(addr, naddr);
-			if (rc != EOK)
-				goto error;
-		}
-	}
-
-	fibril_mutex_unlock(&addr_list_lock);
-	return EOK;
-error:
-	fibril_mutex_unlock(&addr_list_lock);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/addrobj.h
===================================================================
--- uspace/srv/net/inetsrv/addrobj.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INET_ADDROBJ_H_
-#define INET_ADDROBJ_H_
-
-#include <sif.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "inetsrv.h"
-
-typedef enum {
-	/* Find matching network address (using mask) */
-	iaf_net,
-	/* Find exact local address (not using mask) */
-	iaf_addr
-} inet_addrobj_find_t;
-
-extern inet_addrobj_t *inet_addrobj_new(void);
-extern void inet_addrobj_delete(inet_addrobj_t *);
-extern errno_t inet_addrobj_add(inet_addrobj_t *);
-extern void inet_addrobj_remove(inet_addrobj_t *);
-extern inet_addrobj_t *inet_addrobj_find(inet_addr_t *, inet_addrobj_find_t);
-extern inet_addrobj_t *inet_addrobj_find_by_name(const char *, inet_link_t *);
-extern inet_addrobj_t *inet_addrobj_get_by_id(sysarg_t);
-extern unsigned inet_addrobj_cnt_by_link(inet_link_t *);
-extern errno_t inet_addrobj_send_dgram(inet_addrobj_t *, inet_addr_t *,
-    inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_addrobj_get_id_list(sysarg_t **, size_t *);
-extern errno_t inet_addrobjs_load(sif_node_t *);
-extern errno_t inet_addrobjs_save(sif_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmp.c
===================================================================
--- uspace/srv/net/inetsrv/icmp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <io/log.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <types/inetping.h>
-#include "icmp.h"
-#include "icmp_std.h"
-#include "inetsrv.h"
-#include "inetping.h"
-#include "pdu.h"
-
-/* XXX */
-#define INET_TTL_MAX 255
-
-static errno_t icmp_recv_echo_request(inet_dgram_t *);
-static errno_t icmp_recv_echo_reply(inet_dgram_t *);
-
-errno_t icmp_recv(inet_dgram_t *dgram)
-{
-	uint8_t type;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv()");
-
-	if (dgram->size < 1)
-		return EINVAL;
-
-	type = *(uint8_t *)dgram->data;
-
-	switch (type) {
-	case ICMP_ECHO_REQUEST:
-		return icmp_recv_echo_request(dgram);
-	case ICMP_ECHO_REPLY:
-		return icmp_recv_echo_reply(dgram);
-	default:
-		break;
-	}
-
-	return EINVAL;
-}
-
-static errno_t icmp_recv_echo_request(inet_dgram_t *dgram)
-{
-	icmp_echo_t *request, *reply;
-	uint16_t checksum;
-	size_t size;
-	inet_dgram_t rdgram;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv_echo_request()");
-
-	if (dgram->size < sizeof(icmp_echo_t))
-		return EINVAL;
-
-	request = (icmp_echo_t *)dgram->data;
-	size = dgram->size;
-
-	reply = calloc(size, 1);
-	if (reply == NULL)
-		return ENOMEM;
-
-	memcpy(reply, request, size);
-
-	reply->type = ICMP_ECHO_REPLY;
-	reply->code = 0;
-	reply->checksum = 0;
-
-	checksum = inet_checksum_calc(INET_CHECKSUM_INIT, reply, size);
-	reply->checksum = host2uint16_t_be(checksum);
-
-	rdgram.iplink = 0;
-	rdgram.src = dgram->dest;
-	rdgram.dest = dgram->src;
-	rdgram.tos = ICMP_TOS;
-	rdgram.data = reply;
-	rdgram.size = size;
-
-	rc = inet_route_packet(&rdgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
-
-	free(reply);
-
-	return rc;
-}
-
-static errno_t icmp_recv_echo_reply(inet_dgram_t *dgram)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmp_recv_echo_reply()");
-
-	if (dgram->size < sizeof(icmp_echo_t))
-		return EINVAL;
-
-	icmp_echo_t *reply = (icmp_echo_t *) dgram->data;
-
-	inetping_sdu_t sdu;
-
-	sdu.src = dgram->src;
-	sdu.dest = dgram->dest;
-	sdu.seq_no = uint16_t_be2host(reply->seq_no);
-	sdu.data = dgram->data + sizeof(icmp_echo_t);
-	sdu.size = dgram->size - sizeof(icmp_echo_t);
-
-	uint16_t ident = uint16_t_be2host(reply->ident);
-
-	return inetping_recv(ident, &sdu);
-}
-
-errno_t icmp_ping_send(uint16_t ident, inetping_sdu_t *sdu)
-{
-	size_t rsize = sizeof(icmp_echo_t) + sdu->size;
-	void *rdata = calloc(rsize, 1);
-	if (rdata == NULL)
-		return ENOMEM;
-
-	icmp_echo_t *request = (icmp_echo_t *) rdata;
-
-	request->type = ICMP_ECHO_REQUEST;
-	request->code = 0;
-	request->checksum = 0;
-	request->ident = host2uint16_t_be(ident);
-	request->seq_no = host2uint16_t_be(sdu->seq_no);
-
-	memcpy(rdata + sizeof(icmp_echo_t), sdu->data, sdu->size);
-
-	uint16_t checksum = inet_checksum_calc(INET_CHECKSUM_INIT, rdata, rsize);
-	request->checksum = host2uint16_t_be(checksum);
-
-	inet_dgram_t dgram;
-
-	dgram.src = sdu->src;
-	dgram.dest = sdu->dest;
-	dgram.iplink = 0;
-	dgram.tos = ICMP_TOS;
-	dgram.data = rdata;
-	dgram.size = rsize;
-
-	errno_t rc = inet_route_packet(&dgram, IP_PROTO_ICMP, INET_TTL_MAX, 0);
-
-	free(rdata);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmp.h
===================================================================
--- uspace/srv/net/inetsrv/icmp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ICMP_H_
-#define ICMP_H_
-
-#include <types/inetping.h>
-#include "inetsrv.h"
-
-extern errno_t icmp_recv(inet_dgram_t *);
-extern errno_t icmp_ping_send(uint16_t, inetping_sdu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmp_std.h
===================================================================
--- uspace/srv/net/inetsrv/icmp_std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file ICMP standard definitions
- *
- */
-
-#ifndef ICMP_STD_H_
-#define ICMP_STD_H_
-
-#include <stdint.h>
-
-#define IP_PROTO_ICMP 1
-
-/** Type of service used for ICMP */
-#define ICMP_TOS  0
-
-/** ICMP message type */
-enum icmp_type {
-	ICMP_ECHO_REPLY   = 0,
-	ICMP_ECHO_REQUEST = 8
-};
-
-/** ICMP Echo Request or Reply message header */
-typedef struct {
-	/** ICMP message type */
-	uint8_t type;
-	/** Code (0) */
-	uint8_t code;
-	/** Internet checksum of the ICMP message */
-	uint16_t checksum;
-	/** Indentifier */
-	uint16_t ident;
-	/** Sequence number */
-	uint16_t seq_no;
-} icmp_echo_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmpv6.c
===================================================================
--- uspace/srv/net/inetsrv/icmpv6.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/*
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <byteorder.h>
-#include <errno.h>
-#include <io/log.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <types/inetping.h>
-#include "icmpv6.h"
-#include "icmpv6_std.h"
-#include "inetsrv.h"
-#include "inetping.h"
-#include "pdu.h"
-
-static errno_t icmpv6_recv_echo_request(inet_dgram_t *dgram)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv_echo_request()");
-
-	if (dgram->size < sizeof(icmpv6_message_t))
-		return EINVAL;
-
-	icmpv6_message_t *request = (icmpv6_message_t *) dgram->data;
-	size_t size = dgram->size;
-
-	addr128_t src_v6;
-	ip_ver_t src_ver = inet_addr_get(&dgram->src, NULL, &src_v6);
-
-	addr128_t dest_v6;
-	ip_ver_t dest_ver = inet_addr_get(&dgram->dest, NULL, &dest_v6);
-
-	if ((src_ver != dest_ver) || (src_ver != ip_v6))
-		return EINVAL;
-
-	icmpv6_message_t *reply = calloc(1, size);
-	if (reply == NULL)
-		return ENOMEM;
-
-	memcpy(reply, request, size);
-
-	reply->type = ICMPV6_ECHO_REPLY;
-	reply->code = 0;
-	reply->checksum = 0;
-
-	inet_dgram_t rdgram;
-
-	inet_get_srcaddr(&dgram->src, 0, &rdgram.src);
-	rdgram.dest = dgram->src;
-	rdgram.iplink = 0;
-	rdgram.tos = 0;
-	rdgram.data = reply;
-	rdgram.size = size;
-
-	icmpv6_phdr_t phdr;
-
-	host2addr128_t_be(dest_v6, phdr.src_addr);
-	host2addr128_t_be(src_v6, phdr.dest_addr);
-	phdr.length = host2uint32_t_be(dgram->size);
-	memset(phdr.zeroes, 0, 3);
-	phdr.next = IP_PROTO_ICMPV6;
-
-	uint16_t cs_phdr =
-	    inet_checksum_calc(INET_CHECKSUM_INIT, &phdr,
-	    sizeof(icmpv6_phdr_t));
-
-	uint16_t cs_all = inet_checksum_calc(cs_phdr, reply, size);
-
-	reply->checksum = host2uint16_t_be(cs_all);
-
-	errno_t rc = inet_route_packet(&rdgram, IP_PROTO_ICMPV6,
-	    INET6_HOP_LIMIT_MAX, 0);
-
-	free(reply);
-
-	return rc;
-}
-
-static errno_t icmpv6_recv_echo_reply(inet_dgram_t *dgram)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv_echo_reply()");
-
-	if (dgram->size < sizeof(icmpv6_message_t))
-		return EINVAL;
-
-	inetping_sdu_t sdu;
-
-	sdu.src = dgram->src;
-	sdu.dest = dgram->dest;
-
-	icmpv6_message_t *reply = (icmpv6_message_t *) dgram->data;
-
-	sdu.seq_no = uint16_t_be2host(reply->un.echo.seq_no);
-	sdu.data = dgram->data + sizeof(icmpv6_message_t);
-	sdu.size = dgram->size - sizeof(icmpv6_message_t);
-
-	uint16_t ident = uint16_t_be2host(reply->un.echo.ident);
-
-	return inetping_recv(ident, &sdu);
-}
-
-errno_t icmpv6_recv(inet_dgram_t *dgram)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "icmpv6_recv()");
-
-	if (dgram->size < 1)
-		return EINVAL;
-
-	uint8_t type = *(uint8_t *) dgram->data;
-
-	switch (type) {
-	case ICMPV6_ECHO_REQUEST:
-		return icmpv6_recv_echo_request(dgram);
-	case ICMPV6_ECHO_REPLY:
-		return icmpv6_recv_echo_reply(dgram);
-	case ICMPV6_NEIGHBOUR_SOLICITATION:
-	case ICMPV6_NEIGHBOUR_ADVERTISEMENT:
-	case ICMPV6_ROUTER_ADVERTISEMENT:
-		return ndp_received(dgram);
-	default:
-		break;
-	}
-
-	return EINVAL;
-}
-
-errno_t icmpv6_ping_send(uint16_t ident, inetping_sdu_t *sdu)
-{
-	size_t rsize = sizeof(icmpv6_message_t) + sdu->size;
-	void *rdata = calloc(1, rsize);
-	if (rdata == NULL)
-		return ENOMEM;
-
-	icmpv6_message_t *request = (icmpv6_message_t *) rdata;
-
-	request->type = ICMPV6_ECHO_REQUEST;
-	request->code = 0;
-	request->checksum = 0;
-	request->un.echo.ident = host2uint16_t_be(ident);
-	request->un.echo.seq_no = host2uint16_t_be(sdu->seq_no);
-
-	memcpy(rdata + sizeof(icmpv6_message_t), sdu->data, sdu->size);
-
-	inet_dgram_t dgram;
-
-	dgram.src = sdu->src;
-	dgram.dest = sdu->dest;
-	dgram.iplink = 0;
-	dgram.tos = 0;
-	dgram.data = rdata;
-	dgram.size = rsize;
-
-	icmpv6_phdr_t phdr;
-
-	assert(sdu->src.version == ip_v6);
-	assert(sdu->dest.version == ip_v6);
-
-	host2addr128_t_be(sdu->src.addr6, phdr.src_addr);
-	host2addr128_t_be(sdu->dest.addr6, phdr.dest_addr);
-	phdr.length = host2uint32_t_be(dgram.size);
-	memset(phdr.zeroes, 0, 3);
-	phdr.next = IP_PROTO_ICMPV6;
-
-	uint16_t cs_phdr =
-	    inet_checksum_calc(INET_CHECKSUM_INIT, &phdr,
-	    sizeof(icmpv6_phdr_t));
-
-	uint16_t cs_all = inet_checksum_calc(cs_phdr, rdata, rsize);
-
-	request->checksum = host2uint16_t_be(cs_all);
-
-	errno_t rc = inet_route_packet(&dgram, IP_PROTO_ICMPV6,
-	    INET6_HOP_LIMIT_MAX, 0);
-
-	free(rdata);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmpv6.h
===================================================================
--- uspace/srv/net/inetsrv/icmpv6.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef ICMPV6_H_
-#define ICMPV6_H_
-
-#include <types/inetping.h>
-#include "inetsrv.h"
-
-extern errno_t icmpv6_recv(inet_dgram_t *);
-extern errno_t icmpv6_ping_send(uint16_t, inetping_sdu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/icmpv6_std.h
===================================================================
--- uspace/srv/net/inetsrv/icmpv6_std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,143 +1,0 @@
-/*
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file ICMPv6 standard definitions
- *
- */
-
-#ifndef ICMPV6_STD_H_
-#define ICMPV6_STD_H_
-
-#include <stdint.h>
-
-#define IP_PROTO_ICMPV6  58
-
-/** Type of service used for ICMP */
-#define ICMPV6_TOS  0
-
-#define INET6_HOP_LIMIT_MAX  255
-
-#define NDP_FLAG_ROUTER     0x80
-#define NDP_FLAG_OVERRIDE   0x40
-#define NDP_FLAG_SOLICITED  0x20
-
-/** ICMPv6 message type */
-enum icmpv6_type {
-	ICMPV6_ECHO_REQUEST = 128,
-	ICMPV6_ECHO_REPLY = 129,
-	ICMPV6_ROUTER_SOLICITATION = 133,
-	ICMPV6_ROUTER_ADVERTISEMENT = 134,
-	ICMPV6_NEIGHBOUR_SOLICITATION = 135,
-	ICMPV6_NEIGHBOUR_ADVERTISEMENT = 136
-};
-
-/** NDP options */
-enum ndp_option {
-	SOURCE_LINK_LAYER = 1,
-	TARGET_LINK_LAYER = 2,
-	PREFIX_INFORMATION = 3
-};
-
-/** ICMPv6 message header */
-typedef struct {
-	/** ICMPv6 message type */
-	uint8_t type;
-	/** Code (0) */
-	uint8_t code;
-	/** Internet checksum of the ICMP message */
-	uint16_t checksum;
-	union {
-		struct {
-			/** Indentifier */
-			uint16_t ident;
-			/** Sequence number */
-			uint16_t seq_no;
-		} echo;
-		struct {
-			/** Flags byte */
-			uint8_t flags;
-			/** Reserved bytes */
-			uint8_t reserved[3];
-		} ndp;
-	} un;
-} icmpv6_message_t;
-
-/** ICMPv6 pseudoheader for checksum computation */
-typedef struct {
-	/** Source IPv6 address */
-	uint8_t src_addr[16];
-	/** Target IPv6 address */
-	uint8_t dest_addr[16];
-	/** ICMPv6 length */
-	uint32_t length;
-	/** Zeroes */
-	uint8_t zeroes[3];
-	/** Next header */
-	uint8_t next;
-} icmpv6_phdr_t;
-
-/** NDP neighbour body */
-typedef struct {
-	/** Target IPv6 address */
-	uint8_t target_address[16];
-	/** Option code */
-	uint8_t option;
-	/** Option length */
-	uint8_t length;
-	/** MAC address */
-	uint8_t mac[6];
-} ndp_message_t;
-
-/** NDP prefix information structure */
-typedef struct {
-	/** Option code - must be 3 = PREFIX_INFORMATION */
-	uint8_t option;
-	/** Option length - may be 4 */
-	uint8_t length;
-	/** Prefix length */
-	uint8_t prefixlen;
-	/** Flags */
-	uint8_t flags;
-	/** Valid lifetime */
-	uint32_t valid_lftm;
-	/** Preferred lifetime */
-	uint32_t pref_lftm;
-	/** Reserved */
-	uint32_t reserved;
-	/** Prefix */
-	uint8_t prefix[16];
-} ndp_prefix_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inet_link.c
===================================================================
--- uspace/srv/net/inetsrv/inet_link.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,770 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/dhcp.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include "addrobj.h"
-#include "inetsrv.h"
-#include "inet_link.h"
-#include "pdu.h"
-
-static bool first_link = true;
-static bool first_link6 = true;
-
-static FIBRIL_MUTEX_INITIALIZE(ip_ident_lock);
-static uint16_t ip_ident = 0;
-
-static errno_t inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, ip_ver_t);
-static errno_t inet_iplink_change_addr(iplink_t *, eth_addr_t *);
-static inet_link_t *inet_link_get_by_id_locked(sysarg_t);
-
-static iplink_ev_ops_t inet_iplink_ev_ops = {
-	.recv = inet_iplink_recv,
-	.change_addr = inet_iplink_change_addr,
-};
-
-static LIST_INITIALIZE(inet_links);
-static FIBRIL_MUTEX_INITIALIZE(inet_links_lock);
-
-static addr128_t link_local_node_ip =
-    { 0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0, 0, 0 };
-
-static void inet_link_local_node_ip(eth_addr_t *mac_addr,
-    addr128_t ip_addr)
-{
-	uint8_t b[ETH_ADDR_SIZE];
-
-	memcpy(ip_addr, link_local_node_ip, 16);
-	eth_addr_encode(mac_addr, b);
-
-	ip_addr[8] = b[0] ^ 0x02;
-	ip_addr[9] = b[1];
-	ip_addr[10] = b[2];
-	ip_addr[13] = b[3];
-	ip_addr[14] = b[4];
-	ip_addr[15] = b[5];
-}
-
-static errno_t inet_iplink_recv(iplink_t *iplink, iplink_recv_sdu_t *sdu, ip_ver_t ver)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_recv()");
-
-	errno_t rc;
-	inet_packet_t packet;
-	inet_link_t *ilink;
-
-	ilink = (inet_link_t *)iplink_get_userptr(iplink);
-
-	switch (ver) {
-	case ip_v4:
-		rc = inet_pdu_decode(sdu->data, sdu->size, ilink->svc_id,
-		    &packet);
-		break;
-	case ip_v6:
-		rc = inet_pdu_decode6(sdu->data, sdu->size, ilink->svc_id,
-		    &packet);
-		break;
-	default:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "invalid IP version");
-		return EINVAL;
-	}
-
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "failed decoding PDU");
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_recv: link_id=%zu", packet.link_id);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "call inet_recv_packet()");
-	rc = inet_recv_packet(&packet);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "call inet_recv_packet -> %s", str_error_name(rc));
-	free(packet.data);
-
-	return rc;
-}
-
-static errno_t inet_iplink_change_addr(iplink_t *iplink, eth_addr_t *mac)
-{
-	eth_addr_str_t saddr;
-
-	eth_addr_format(mac, &saddr);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_iplink_change_addr(): "
-	    "new addr=%s", saddr.str);
-
-	list_foreach(inet_links, link_list, inet_link_t, ilink) {
-		if (ilink->sess == iplink->sess)
-			ilink->mac = *mac;
-	}
-
-	return EOK;
-}
-
-static inet_link_t *inet_link_new(void)
-{
-	inet_link_t *ilink = calloc(1, sizeof(inet_link_t));
-
-	if (ilink == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating link structure. "
-		    "Out of memory.");
-		return NULL;
-	}
-
-	link_initialize(&ilink->link_list);
-
-	return ilink;
-}
-
-static void inet_link_delete(inet_link_t *ilink)
-{
-	if (ilink->svc_name != NULL)
-		free(ilink->svc_name);
-
-	free(ilink);
-}
-
-/** Open new IP link while inet_links_lock is held.
- *
- * @param sid IP link service ID
- * @return EOK on success or an error code
- */
-static errno_t inet_link_open_locked(service_id_t sid)
-{
-	inet_link_t *ilink;
-	inet_addr_t iaddr;
-	errno_t rc;
-
-	assert(fibril_mutex_is_locked(&inet_links_lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_link_open_locked()");
-	ilink = inet_link_new();
-	if (ilink == NULL)
-		return ENOMEM;
-
-	ilink->svc_id = sid;
-	ilink->iplink = NULL;
-
-	rc = loc_service_get_name(sid, &ilink->svc_name);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting service name.");
-		goto error;
-	}
-
-	ilink->sess = loc_service_connect(sid, INTERFACE_IPLINK, 0);
-	if (ilink->sess == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting '%s'", ilink->svc_name);
-		goto error;
-	}
-
-	rc = iplink_open(ilink->sess, &inet_iplink_ev_ops, ilink, &ilink->iplink);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed opening IP link '%s'",
-		    ilink->svc_name);
-		goto error;
-	}
-
-	rc = iplink_get_mtu(ilink->iplink, &ilink->def_mtu);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed determinning MTU of link '%s'",
-		    ilink->svc_name);
-		goto error;
-	}
-
-	/*
-	 * Get the MAC address of the link. If the link has a MAC
-	 * address, we assume that it supports NDP.
-	 */
-	rc = iplink_get_mac48(ilink->iplink, &ilink->mac);
-	ilink->mac_valid = (rc == EOK);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Opened IP link '%s'", ilink->svc_name);
-
-	if (inet_link_get_by_id_locked(sid) != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Link %zu already open",
-		    sid);
-		rc = EEXIST;
-		goto error;
-	}
-
-	list_append(&ilink->link_list, &inet_links);
-
-	inet_addrobj_t *addr = NULL;
-
-	/* XXX FIXME Cannot rely on loopback being the first IP link service!! */
-	if (first_link) {
-		addr = inet_addrobj_new();
-
-		inet_naddr(&addr->naddr, 127, 0, 0, 1, 24);
-		first_link = false;
-	}
-
-	if (addr != NULL) {
-		addr->ilink = ilink;
-		addr->name = str_dup("v4a");
-		addr->temp = true;
-
-		rc = inet_addrobj_add(addr);
-		if (rc == EOK) {
-			inet_naddr_addr(&addr->naddr, &iaddr);
-			rc = iplink_addr_add(ilink->iplink, &iaddr);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR,
-				    "Failed setting IPv4 address on internet link.");
-				inet_addrobj_remove(addr);
-				inet_addrobj_delete(addr);
-			}
-		} else {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding IPv4 address.");
-			inet_addrobj_delete(addr);
-		}
-	}
-
-	inet_addrobj_t *addr6 = NULL;
-
-	if (first_link6) {
-		addr6 = inet_addrobj_new();
-
-		inet_naddr6(&addr6->naddr, 0, 0, 0, 0, 0, 0, 0, 1, 128);
-		first_link6 = false;
-	} else if (ilink->mac_valid) {
-		addr6 = inet_addrobj_new();
-
-		addr128_t link_local;
-		inet_link_local_node_ip(&ilink->mac, link_local);
-
-		inet_naddr_set6(link_local, 64, &addr6->naddr);
-	}
-
-	if (addr6 != NULL) {
-		addr6->ilink = ilink;
-		addr6->name = str_dup("v6a");
-		addr6->temp = true;
-
-		rc = inet_addrobj_add(addr6);
-		if (rc == EOK) {
-			inet_naddr_addr(&addr6->naddr, &iaddr);
-			rc = iplink_addr_add(ilink->iplink, &iaddr);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR,
-				    "Failed setting IPv6 address on internet link.");
-				inet_addrobj_remove(addr6);
-				inet_addrobj_delete(addr6);
-			}
-		} else {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding IPv6 address.");
-			inet_addrobj_delete(addr6);
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Configured link '%s'.", ilink->svc_name);
-	return EOK;
-
-error:
-	if (ilink->iplink != NULL)
-		iplink_close(ilink->iplink);
-
-	inet_link_delete(ilink);
-	return rc;
-}
-
-/** Open new IP link..
- *
- * @param sid IP link service ID
- * @return EOK on success or an error code
- */
-errno_t inet_link_open(service_id_t sid)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&inet_links_lock);
-	rc = inet_link_open_locked(sid);
-	fibril_mutex_unlock(&inet_links_lock);
-
-	return rc;
-}
-
-/** Send IPv4 datagram over Internet link
- *
- * @param ilink Internet link
- * @param lsrc  Source IPv4 address
- * @param ldest Destination IPv4 address
- * @param dgram IPv4 datagram body
- * @param proto Protocol
- * @param ttl   Time-to-live
- * @param df    Do-not-Fragment flag
- *
- * @return EOK on success
- * @return ENOMEM when not enough memory to create the datagram
- * @return ENOTSUP if networking mode is not supported
- *
- */
-errno_t inet_link_send_dgram(inet_link_t *ilink, addr32_t lsrc, addr32_t ldest,
-    inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
-{
-	addr32_t src_v4;
-	ip_ver_t src_ver = inet_addr_get(&dgram->src, &src_v4, NULL);
-	if (src_ver != ip_v4)
-		return EINVAL;
-
-	addr32_t dest_v4;
-	ip_ver_t dest_ver = inet_addr_get(&dgram->dest, &dest_v4, NULL);
-	if (dest_ver != ip_v4)
-		return EINVAL;
-
-	/*
-	 * Fill packet structure. Fragmentation is performed by
-	 * inet_pdu_encode().
-	 */
-
-	iplink_sdu_t sdu;
-
-	sdu.src = lsrc;
-	sdu.dest = ldest;
-
-	inet_packet_t packet;
-
-	packet.src = dgram->src;
-	packet.dest = dgram->dest;
-	packet.tos = dgram->tos;
-	packet.proto = proto;
-	packet.ttl = ttl;
-
-	/* Allocate identifier */
-	fibril_mutex_lock(&ip_ident_lock);
-	packet.ident = ++ip_ident;
-	fibril_mutex_unlock(&ip_ident_lock);
-
-	packet.df = df;
-	packet.data = dgram->data;
-	packet.size = dgram->size;
-
-	errno_t rc;
-	size_t offs = 0;
-
-	do {
-		/* Encode one fragment */
-
-		size_t roffs;
-		rc = inet_pdu_encode(&packet, src_v4, dest_v4, offs, ilink->def_mtu,
-		    &sdu.data, &sdu.size, &roffs);
-		if (rc != EOK)
-			return rc;
-
-		/* Send the PDU */
-		rc = iplink_send(ilink->iplink, &sdu);
-
-		free(sdu.data);
-		offs = roffs;
-	} while (offs < packet.size);
-
-	return rc;
-}
-
-/** Send IPv6 datagram over Internet link
- *
- * @param ilink Internet link
- * @param ldest Destination MAC address
- * @param dgram IPv6 datagram body
- * @param proto Next header
- * @param ttl   Hop limit
- * @param df    Do-not-Fragment flag (unused)
- *
- * @return EOK on success
- * @return ENOMEM when not enough memory to create the datagram
- *
- */
-errno_t inet_link_send_dgram6(inet_link_t *ilink, eth_addr_t *ldest,
-    inet_dgram_t *dgram, uint8_t proto, uint8_t ttl, int df)
-{
-	addr128_t src_v6;
-	ip_ver_t src_ver = inet_addr_get(&dgram->src, NULL, &src_v6);
-	if (src_ver != ip_v6)
-		return EINVAL;
-
-	addr128_t dest_v6;
-	ip_ver_t dest_ver = inet_addr_get(&dgram->dest, NULL, &dest_v6);
-	if (dest_ver != ip_v6)
-		return EINVAL;
-
-	iplink_sdu6_t sdu6;
-	sdu6.dest = *ldest;
-
-	/*
-	 * Fill packet structure. Fragmentation is performed by
-	 * inet_pdu_encode6().
-	 */
-
-	inet_packet_t packet;
-
-	packet.src = dgram->src;
-	packet.dest = dgram->dest;
-	packet.tos = dgram->tos;
-	packet.proto = proto;
-	packet.ttl = ttl;
-
-	/* Allocate identifier */
-	fibril_mutex_lock(&ip_ident_lock);
-	packet.ident = ++ip_ident;
-	fibril_mutex_unlock(&ip_ident_lock);
-
-	packet.df = df;
-	packet.data = dgram->data;
-	packet.size = dgram->size;
-
-	errno_t rc;
-	size_t offs = 0;
-
-	do {
-		/* Encode one fragment */
-
-		size_t roffs;
-		rc = inet_pdu_encode6(&packet, src_v6, dest_v6, offs, ilink->def_mtu,
-		    &sdu6.data, &sdu6.size, &roffs);
-		if (rc != EOK)
-			return rc;
-
-		/* Send the PDU */
-		rc = iplink_send6(ilink->iplink, &sdu6);
-
-		free(sdu6.data);
-		offs = roffs;
-	} while (offs < packet.size);
-
-	return rc;
-}
-
-static inet_link_t *inet_link_get_by_id_locked(sysarg_t link_id)
-{
-	assert(fibril_mutex_is_locked(&inet_links_lock));
-
-	list_foreach(inet_links, link_list, inet_link_t, ilink) {
-		if (ilink->svc_id == link_id)
-			return ilink;
-	}
-
-	return NULL;
-}
-
-inet_link_t *inet_link_get_by_id(sysarg_t link_id)
-{
-	inet_link_t *ilink;
-
-	fibril_mutex_lock(&inet_links_lock);
-	ilink = inet_link_get_by_id_locked(link_id);
-	fibril_mutex_unlock(&inet_links_lock);
-
-	return ilink;
-}
-
-/** Find link by service name while inet_links_lock is held.
- *
- * @param svc_name Service name
- * @return Link or @c NULL if not found
- */
-static inet_link_t *inet_link_get_by_svc_name_locked(const char *svc_name)
-{
-	assert(fibril_mutex_is_locked(&inet_links_lock));
-
-	list_foreach(inet_links, link_list, inet_link_t, ilink) {
-		if (str_cmp(ilink->svc_name, svc_name) == 0)
-			return ilink;
-	}
-
-	return NULL;
-}
-
-/** Find link by service name.
- *
- * @param svc_name Service name
- * @return Link or @c NULL if not found
- */
-inet_link_t *inet_link_get_by_svc_name(const char *svc_name)
-{
-	inet_link_t *ilink;
-
-	fibril_mutex_lock(&inet_links_lock);
-	ilink = inet_link_get_by_svc_name_locked(svc_name);
-	fibril_mutex_unlock(&inet_links_lock);
-
-	return ilink;
-}
-
-/** Get IDs of all links. */
-errno_t inet_link_get_id_list(sysarg_t **rid_list, size_t *rcount)
-{
-	sysarg_t *id_list;
-	size_t count, i;
-
-	fibril_mutex_lock(&inet_links_lock);
-	count = list_count(&inet_links);
-
-	id_list = calloc(count, sizeof(sysarg_t));
-	if (id_list == NULL) {
-		fibril_mutex_unlock(&inet_links_lock);
-		return ENOMEM;
-	}
-
-	i = 0;
-	list_foreach(inet_links, link_list, inet_link_t, ilink) {
-		id_list[i++] = ilink->svc_id;
-	}
-
-	fibril_mutex_unlock(&inet_links_lock);
-
-	*rid_list = id_list;
-	*rcount = count;
-
-	return EOK;
-}
-
-/** Check for new IP links.
- *
- * @return EOK on success or an error code
- */
-static errno_t inet_link_check_new(void)
-{
-	bool already_known;
-	category_id_t iplink_cat;
-	service_id_t *svcs;
-	inet_link_cfg_info_t info;
-	size_t count, i;
-	errno_t rc;
-
-	fibril_mutex_lock(&inet_links_lock);
-
-	rc = loc_category_get_id("iplink", &iplink_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category "
-		    "'iplink'.");
-		fibril_mutex_unlock(&inet_links_lock);
-		return ENOENT;
-	}
-
-	rc = loc_category_get_svcs(iplink_cat, &svcs, &count);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of IP "
-		    "links.");
-		fibril_mutex_unlock(&inet_links_lock);
-		return EIO;
-	}
-
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		list_foreach(inet_links, link_list, inet_link_t, ilink) {
-			if (ilink->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			log_msg(LOG_DEFAULT, LVL_NOTE, "Found IP link '%lu'",
-			    (unsigned long) svcs[i]);
-			rc = inet_link_open_locked(svcs[i]);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Could not "
-				    "add IP link.");
-			}
-		} else {
-			/* Clear so it won't be autoconfigured below */
-			svcs[i] = 0;
-		}
-	}
-
-	fibril_mutex_unlock(&inet_links_lock);
-
-	/*
-	 * Auto-configure new links. Note that newly discovered links
-	 * cannot have any configured address objects, because we only
-	 * retain configuration for present links.
-	 */
-	for (i = 0; i < count; i++) {
-		if (svcs[i] != 0) {
-			info.svc_id = svcs[i];
-			rc = loc_service_get_name(info.svc_id, &info.svc_name);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Failed "
-				    "getting service name.");
-				return rc;
-			}
-
-			inet_link_autoconf_link(&info);
-			free(info.svc_name);
-			info.svc_name = NULL;
-		}
-	}
-
-	return EOK;
-}
-
-/** IP link category change callback.
- *
- * @param arg Not used
- */
-static void inet_link_cat_change_cb(void *arg)
-{
-	(void) inet_link_check_new();
-}
-
-/** Start IP link discovery.
- *
- * @return EOK on success or an error code
- */
-errno_t inet_link_discovery_start(void)
-{
-	errno_t rc;
-
-	rc = loc_register_cat_change_cb(inet_link_cat_change_cb, NULL);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
-		    "for IP link discovery: %s.", str_error(rc));
-		return rc;
-	}
-
-	return inet_link_check_new();
-}
-
-/** Start DHCP autoconfiguration on IP link.
- *
- * @param info Link information
- */
-void inet_link_autoconf_link(inet_link_cfg_info_t *info)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf_link");
-
-	if (str_lcmp(info->svc_name, "net/eth", str_length("net/eth")) == 0) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf_link : dhcp link add for link '%s' (%u)",
-		    info->svc_name, (unsigned)info->svc_id);
-		rc = dhcp_link_add(info->svc_id);
-		log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf_link : dhcp link add for link '%s' (%u) DONE",
-		    info->svc_name, (unsigned)info->svc_id);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_WARN, "Failed configuring "
-			    "DHCP on  link '%s'.\n", info->svc_name);
-		}
-	}
-}
-
-/** Start DHCP autoconfiguration on IP links. */
-errno_t inet_link_autoconf(void)
-{
-	inet_link_cfg_info_t *link_info;
-	size_t link_cnt;
-	size_t acnt;
-	size_t i;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf : initialize DHCP");
-	rc = dhcp_init();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed initializing DHCP "
-		    "service.");
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf : initialize DHCP done");
-
-	fibril_mutex_lock(&inet_links_lock);
-	link_cnt = list_count(&inet_links);
-
-	link_info = calloc(link_cnt, sizeof(inet_link_cfg_info_t));
-	if (link_info == NULL) {
-		fibril_mutex_unlock(&inet_links_lock);
-		return ENOMEM;
-	}
-
-	i = 0;
-	list_foreach(inet_links, link_list, inet_link_t, ilink) {
-		assert(i < link_cnt);
-
-		acnt = inet_addrobj_cnt_by_link(ilink);
-		if (acnt != 0) {
-			/*
-			 * No autoconfiguration if link has configured
-			 * addresses.
-			 */
-			continue;
-		}
-
-		link_info[i].svc_id = ilink->svc_id;
-		link_info[i].svc_name = str_dup(ilink->svc_name);
-		if (link_info[i].svc_name == NULL) {
-			fibril_mutex_unlock(&inet_links_lock);
-			goto error;
-		}
-
-		++i;
-	}
-
-	fibril_mutex_unlock(&inet_links_lock);
-
-	/* Update link_cnt to include only links slated for autoconfig. */
-	link_cnt = i;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf : autoconf links...");
-
-	for (i = 0; i < link_cnt; i++)
-		inet_link_autoconf_link(&link_info[i]);
-
-	for (i = 0; i < link_cnt; i++) {
-		if (link_info[i].svc_name != NULL)
-			free(link_info[i].svc_name);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_link_autoconf : autoconf links done");
-	return EOK;
-error:
-	for (i = 0; i < link_cnt; i++) {
-		if (link_info[i].svc_name != NULL)
-			free(link_info[i].svc_name);
-	}
-	free(link_info);
-	return ENOMEM;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inet_link.h
===================================================================
--- uspace/srv/net/inetsrv/inet_link.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INET_LINK_H_
-#define INET_LINK_H_
-
-#include <inet/eth_addr.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "inetsrv.h"
-
-extern errno_t inet_link_open(service_id_t);
-extern errno_t inet_link_send_dgram(inet_link_t *, addr32_t,
-    addr32_t, inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_link_send_dgram6(inet_link_t *, eth_addr_t *, inet_dgram_t *,
-    uint8_t, uint8_t, int);
-extern inet_link_t *inet_link_get_by_id(sysarg_t);
-extern inet_link_t *inet_link_get_by_svc_name(const char *);
-extern errno_t inet_link_get_id_list(sysarg_t **, size_t *);
-extern errno_t inet_link_discovery_start(void);
-extern errno_t inet_link_autoconf(void);
-extern void inet_link_autoconf_link(inet_link_cfg_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inet_std.h
===================================================================
--- uspace/srv/net/inetsrv/inet_std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,140 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file IP header definitions
- *
- */
-
-#ifndef INET_STD_H_
-#define INET_STD_H_
-
-#include <stdint.h>
-
-#define IP6_NEXT_FRAGMENT  44
-
-/** IPv4 Datagram header (fixed part) */
-typedef struct {
-	/** Version, Internet Header Length */
-	uint8_t ver_ihl;
-	/* Type of Service */
-	uint8_t tos;
-	/** Total Length */
-	uint16_t tot_len;
-	/** Identifier */
-	uint16_t id;
-	/** Flags, Fragment Offset */
-	uint16_t flags_foff;
-	/** Time to Live */
-	uint8_t ttl;
-	/** Protocol */
-	uint8_t proto;
-	/** Header Checksum */
-	uint16_t chksum;
-	/** Source Address */
-	uint32_t src_addr;
-	/** Destination Address */
-	uint32_t dest_addr;
-} ip_header_t;
-
-/** Bits in ip_header_t.ver_ihl */
-enum ver_ihl_bits {
-	/** Version, highest bit */
-	VI_VERSION_h = 7,
-	/** Version, lowest bit */
-	VI_VERSION_l = 4,
-	/** Internet Header Length, highest bit */
-	VI_IHL_h     = 3,
-	/** Internet Header Length, lowest bit */
-	VI_IHL_l     = 0
-};
-
-/** Bits in ip_header_t.flags_foff */
-enum flags_foff_bits {
-	/** Reserved, must be zero */
-	FF_FLAG_RSVD = 15,
-	/** Don't Fragment */
-	FF_FLAG_DF = 14,
-	/** More Fragments */
-	FF_FLAG_MF = 13,
-	/** Fragment Offset, highest bit */
-	FF_FRAGOFF_h = 12,
-	/** Fragment Offset, lowest bit */
-	FF_FRAGOFF_l = 0
-};
-
-/** Bits in ip6_header_fragment_t.offsmf */
-enum flags_offsmt_bits {
-	/** More fragments */
-	OF_FLAG_M = 0,
-	/** Fragment offset, highest bit */
-	OF_FRAGOFF_h = 15,
-	/** Fragment offset, lowest bit */
-	OF_FRAGOFF_l = 3
-};
-
-/** IPv6 Datagram header (fixed part) */
-typedef struct {
-	/** Version, Traffic class first 4 bits */
-	uint8_t ver_tc;
-	/** Traffic class (the rest), Flow label */
-	uint8_t tc_fl[3];
-	/* Payload length */
-	uint16_t payload_len;
-	/** Next header */
-	uint8_t next;
-	/** Hop limit */
-	uint8_t hop_limit;
-	/** Source address */
-	uint8_t src_addr[16];
-	/** Destination address */
-	uint8_t dest_addr[16];
-} ip6_header_t;
-
-/** IPv6 Datagram Fragment extension header */
-typedef struct {
-	/** Next header */
-	uint8_t next;
-	/** Reserved */
-	uint8_t reserved;
-	/** Fragmentation offset, reserved and M flag */
-	uint16_t offsmf;
-	/** Identifier */
-	uint32_t id;
-} ip6_header_fragment_t;
-
-/** Fragment offset is expressed in units of 8 bytes */
-#define FRAG_OFFS_UNIT 8
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetcfg.c
===================================================================
--- uspace/srv/net/inetsrv/inetcfg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1005 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-#include <io/log.h>
-#include <ipc/inet.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <str.h>
-#include <stddef.h>
-#include <types/inetcfg.h>
-
-#include "addrobj.h"
-#include "inetsrv.h"
-#include "inet_link.h"
-#include "inetcfg.h"
-#include "sroute.h"
-
-static errno_t inetcfg_addr_create_static(char *name, inet_naddr_t *naddr,
-    sysarg_t link_id, sysarg_t *addr_id)
-{
-	inet_link_t *ilink;
-	inet_addrobj_t *addr;
-	inet_addr_t iaddr;
-	errno_t rc;
-
-	ilink = inet_link_get_by_id(link_id);
-	if (ilink == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Link %lu not found.",
-		    (unsigned long) link_id);
-		return ENOENT;
-	}
-
-	addr = inet_addrobj_new();
-	if (addr == NULL) {
-		*addr_id = 0;
-		return ENOMEM;
-	}
-
-	addr->naddr = *naddr;
-	addr->ilink = ilink;
-	addr->name = str_dup(name);
-	rc = inet_addrobj_add(addr);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Duplicate address name '%s'.", addr->name);
-		inet_addrobj_delete(addr);
-		return rc;
-	}
-
-	inet_naddr_addr(&addr->naddr, &iaddr);
-	rc = iplink_addr_add(ilink->iplink, &iaddr);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed setting IP address on internet link.");
-		inet_addrobj_remove(addr);
-		inet_addrobj_delete(addr);
-		return rc;
-	}
-
-	rc = inet_cfg_sync(cfg);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error saving configuration.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t inetcfg_addr_delete(sysarg_t addr_id)
-{
-	inet_addrobj_t *addr;
-	inet_link_cfg_info_t info;
-	unsigned acnt;
-	inet_link_t *ilink;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete()");
-
-	addr = inet_addrobj_get_by_id(addr_id);
-	if (addr == NULL)
-		return ENOENT;
-
-	info.svc_id = addr->ilink->svc_id;
-	info.svc_name = str_dup(addr->ilink->svc_name);
-	if (info.svc_name == NULL)
-		return ENOMEM;
-
-	inet_addrobj_remove(addr);
-	inet_addrobj_delete(addr);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete(): sync");
-
-	rc = inet_cfg_sync(cfg);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error saving configuration.");
-		free(info.svc_name);
-		return rc;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete(): get link by ID");
-
-	ilink = inet_link_get_by_id(info.svc_id);
-	if (ilink == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error finding link.");
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete(): check addrobj count");
-
-	/* If there are no configured addresses left, autoconfigure link */
-	acnt = inet_addrobj_cnt_by_link(ilink);
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete(): acnt=%u", acnt);
-	if (acnt == 0)
-		inet_link_autoconf_link(&info);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inetcfg_addr_delete(): DONE");
-	return EOK;
-}
-
-static errno_t inetcfg_addr_get(sysarg_t addr_id, inet_addr_info_t *ainfo)
-{
-	inet_addrobj_t *addr;
-
-	addr = inet_addrobj_get_by_id(addr_id);
-	if (addr == NULL)
-		return ENOENT;
-
-	ainfo->naddr = addr->naddr;
-	ainfo->ilink = addr->ilink->svc_id;
-	ainfo->name = str_dup(addr->name);
-
-	return EOK;
-}
-
-static errno_t inetcfg_addr_get_id(char *name, sysarg_t link_id, sysarg_t *addr_id)
-{
-	inet_link_t *ilink;
-	inet_addrobj_t *addr;
-
-	ilink = inet_link_get_by_id(link_id);
-	if (ilink == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Link %zu not found.", (size_t) link_id);
-		return ENOENT;
-	}
-
-	addr = inet_addrobj_find_by_name(name, ilink);
-	if (addr == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Address '%s' not found.", name);
-		return ENOENT;
-	}
-
-	*addr_id = addr->id;
-	return EOK;
-}
-
-static errno_t inetcfg_get_addr_list(sysarg_t **addrs, size_t *count)
-{
-	return inet_addrobj_get_id_list(addrs, count);
-}
-
-static errno_t inetcfg_get_link_list(sysarg_t **addrs, size_t *count)
-{
-	return inet_link_get_id_list(addrs, count);
-}
-
-static errno_t inetcfg_get_sroute_list(sysarg_t **sroutes, size_t *count)
-{
-	return inet_sroute_get_id_list(sroutes, count);
-}
-
-static errno_t inetcfg_link_add(sysarg_t link_id)
-{
-	return inet_link_open(link_id);
-}
-
-static errno_t inetcfg_link_get(sysarg_t link_id, inet_link_info_t *linfo)
-{
-	inet_link_t *ilink;
-
-	ilink = inet_link_get_by_id(link_id);
-	if (ilink == NULL) {
-		return ENOENT;
-	}
-
-	linfo->name = str_dup(ilink->svc_name);
-	linfo->def_mtu = ilink->def_mtu;
-	if (ilink->mac_valid) {
-		linfo->mac_addr = ilink->mac;
-	} else {
-		memset(&linfo->mac_addr, 0, sizeof(linfo->mac_addr));
-	}
-
-	return EOK;
-}
-
-static errno_t inetcfg_link_remove(sysarg_t link_id)
-{
-	return ENOTSUP;
-}
-
-static errno_t inetcfg_sroute_create(char *name, inet_naddr_t *dest,
-    inet_addr_t *router, sysarg_t *sroute_id)
-{
-	errno_t rc;
-	inet_sroute_t *sroute;
-
-	sroute = inet_sroute_new();
-	if (sroute == NULL) {
-		*sroute_id = 0;
-		return ENOMEM;
-	}
-
-	sroute->dest = *dest;
-	sroute->router = *router;
-	sroute->name = str_dup(name);
-	inet_sroute_add(sroute);
-
-	*sroute_id = sroute->id;
-
-	rc = inet_cfg_sync(cfg);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error saving configuration.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t inetcfg_sroute_delete(sysarg_t sroute_id)
-{
-	errno_t rc;
-	inet_sroute_t *sroute;
-
-	sroute = inet_sroute_get_by_id(sroute_id);
-	if (sroute == NULL)
-		return ENOENT;
-
-	inet_sroute_remove(sroute);
-	inet_sroute_delete(sroute);
-
-	rc = inet_cfg_sync(cfg);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error saving configuration.");
-		return rc;
-	}
-
-	return EOK;
-}
-
-static errno_t inetcfg_sroute_get(sysarg_t sroute_id, inet_sroute_info_t *srinfo)
-{
-	inet_sroute_t *sroute;
-
-	sroute = inet_sroute_get_by_id(sroute_id);
-	if (sroute == NULL)
-		return ENOENT;
-
-	srinfo->dest = sroute->dest;
-	srinfo->router = sroute->router;
-	srinfo->name = str_dup(sroute->name);
-
-	return EOK;
-}
-
-static errno_t inetcfg_sroute_get_id(char *name, sysarg_t *sroute_id)
-{
-	inet_sroute_t *sroute;
-
-	sroute = inet_sroute_find_by_name(name);
-	if (sroute == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Static route '%s' not found.", name);
-		return ENOENT;
-	}
-
-	*sroute_id = sroute->id;
-	return EOK;
-}
-
-static void inetcfg_addr_create_static_srv(ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_create_static_srv()");
-
-	sysarg_t link_id = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(inet_naddr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_naddr_t naddr;
-	errno_t rc = async_data_write_finalize(&call, &naddr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	char *name;
-	rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	sysarg_t addr_id = 0;
-	rc = inetcfg_addr_create_static(name, &naddr, link_id, &addr_id);
-	free(name);
-	async_answer_1(icall, rc, addr_id);
-}
-
-static void inetcfg_addr_delete_srv(ipc_call_t *call)
-{
-	sysarg_t addr_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_delete_srv()");
-
-	addr_id = ipc_get_arg1(call);
-
-	rc = inetcfg_addr_delete(addr_id);
-	async_answer_0(call, rc);
-}
-
-static void inetcfg_addr_get_srv(ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_srv()");
-
-	sysarg_t addr_id = ipc_get_arg1(icall);
-
-	inet_addr_info_t ainfo;
-
-	inet_naddr_any(&ainfo.naddr);
-	ainfo.ilink = 0;
-	ainfo.name = NULL;
-
-	errno_t rc = inetcfg_addr_get(addr_id, &ainfo);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_naddr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &ainfo.naddr, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, ainfo.name,
-	    min(size, str_size(ainfo.name)));
-	free(ainfo.name);
-
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_1(icall, rc, ainfo.ilink);
-}
-
-static void inetcfg_addr_get_id_srv(ipc_call_t *call)
-{
-	char *name;
-	sysarg_t link_id;
-	sysarg_t addr_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_addr_get_id_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return;
-	}
-
-	addr_id = 0;
-	rc = inetcfg_addr_get_id(name, link_id, &addr_id);
-	free(name);
-	async_answer_1(call, rc, addr_id);
-}
-
-static void inetcfg_get_addr_list_srv(ipc_call_t *call)
-{
-	ipc_call_t rcall;
-	size_t count;
-	size_t max_size;
-	size_t act_size;
-	size_t size;
-	sysarg_t *id_buf;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
-
-	if (!async_data_read_receive(&rcall, &max_size)) {
-		async_answer_0(&rcall, EREFUSED);
-		async_answer_0(call, EREFUSED);
-		return;
-	}
-
-	rc = inetcfg_get_addr_list(&id_buf, &count);
-	if (rc != EOK) {
-		async_answer_0(&rcall, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	act_size = count * sizeof(sysarg_t);
-	size = min(act_size, max_size);
-
-	errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(call, retval, act_size);
-}
-
-static void inetcfg_get_link_list_srv(ipc_call_t *call)
-{
-	ipc_call_t rcall;
-	size_t count;
-	size_t max_size;
-	size_t act_size;
-	size_t size;
-	sysarg_t *id_buf;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_addr_list_srv()");
-
-	if (!async_data_read_receive(&rcall, &max_size)) {
-		async_answer_0(&rcall, EREFUSED);
-		async_answer_0(call, EREFUSED);
-		return;
-	}
-
-	rc = inetcfg_get_link_list(&id_buf, &count);
-	if (rc != EOK) {
-		async_answer_0(&rcall, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	act_size = count * sizeof(sysarg_t);
-	size = min(act_size, max_size);
-
-	errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(call, retval, act_size);
-}
-
-static void inetcfg_get_sroute_list_srv(ipc_call_t *call)
-{
-	ipc_call_t rcall;
-	size_t count;
-	size_t max_size;
-	size_t act_size;
-	size_t size;
-	sysarg_t *id_buf;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_get_sroute_list_srv()");
-
-	if (!async_data_read_receive(&rcall, &max_size)) {
-		async_answer_0(&rcall, EREFUSED);
-		async_answer_0(call, EREFUSED);
-		return;
-	}
-
-	rc = inetcfg_get_sroute_list(&id_buf, &count);
-	if (rc != EOK) {
-		async_answer_0(&rcall, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	act_size = count * sizeof(sysarg_t);
-	size = min(act_size, max_size);
-
-	errno_t retval = async_data_read_finalize(&rcall, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(call, retval, act_size);
-}
-
-static void inetcfg_link_add_srv(ipc_call_t *call)
-{
-	sysarg_t link_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_add_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = inetcfg_link_add(link_id);
-	async_answer_0(call, rc);
-}
-
-static void inetcfg_link_get_srv(ipc_call_t *call)
-{
-	ipc_call_t name;
-	ipc_call_t laddr;
-	size_t name_max_size;
-	size_t laddr_max_size;
-
-	sysarg_t link_id;
-	inet_link_info_t linfo;
-	errno_t rc;
-
-	link_id = ipc_get_arg1(call);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_get_srv()");
-
-	linfo.name = NULL;
-
-	if (!async_data_read_receive(&name, &name_max_size)) {
-		async_answer_0(&name, EREFUSED);
-		async_answer_0(call, EREFUSED);
-		return;
-	}
-
-	if (!async_data_read_receive(&laddr, &laddr_max_size)) {
-		async_answer_0(&laddr, EREFUSED);
-		async_answer_0(&name, EREFUSED);
-		async_answer_0(call, EREFUSED);
-		return;
-	}
-
-	rc = inetcfg_link_get(link_id, &linfo);
-	if (rc != EOK) {
-		async_answer_0(&laddr, rc);
-		async_answer_0(&name, rc);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&name, linfo.name,
-	    min(name_max_size, str_size(linfo.name)));
-	if (retval != EOK) {
-		free(linfo.name);
-		async_answer_0(&laddr, retval);
-		async_answer_0(call, retval);
-		return;
-	}
-
-	retval = async_data_read_finalize(&laddr, &linfo.mac_addr,
-	    min(laddr_max_size, sizeof(linfo.mac_addr)));
-
-	free(linfo.name);
-
-	async_answer_1(call, retval, linfo.def_mtu);
-}
-
-static void inetcfg_link_remove_srv(ipc_call_t *call)
-{
-	sysarg_t link_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_link_remove_srv()");
-
-	link_id = ipc_get_arg1(call);
-
-	rc = inetcfg_link_remove(link_id);
-	async_answer_0(call, rc);
-}
-
-static void inetcfg_sroute_create_srv(ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_create_srv()");
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(inet_naddr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_naddr_t dest;
-	errno_t rc = async_data_write_finalize(&call, &dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_addr_t router;
-	rc = async_data_write_finalize(&call, &router, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	char *name;
-	rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	sysarg_t sroute_id = 0;
-	rc = inetcfg_sroute_create(name, &dest, &router, &sroute_id);
-	free(name);
-	async_answer_1(icall, rc, sroute_id);
-}
-
-static void inetcfg_sroute_delete_srv(ipc_call_t *call)
-{
-	sysarg_t sroute_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_delete_srv()");
-
-	sroute_id = ipc_get_arg1(call);
-
-	rc = inetcfg_sroute_delete(sroute_id);
-	async_answer_0(call, rc);
-}
-
-static void inetcfg_sroute_get_srv(ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_srv()");
-
-	sysarg_t sroute_id = ipc_get_arg1(icall);
-
-	inet_sroute_info_t srinfo;
-
-	inet_naddr_any(&srinfo.dest);
-	inet_addr_any(&srinfo.router);
-	srinfo.name = NULL;
-
-	errno_t rc = inetcfg_sroute_get(sroute_id, &srinfo);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_naddr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &srinfo.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &srinfo.router, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, srinfo.name,
-	    min(size, str_size(srinfo.name)));
-	free(srinfo.name);
-
-	async_answer_0(icall, rc);
-}
-
-static void inetcfg_sroute_get_id_srv(ipc_call_t *call)
-{
-	char *name;
-	sysarg_t sroute_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetcfg_sroute_get_id_srv()");
-
-	rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(call, rc);
-		return;
-	}
-
-	sroute_id = 0;
-	rc = inetcfg_sroute_get_id(name, &sroute_id);
-	free(name);
-	async_answer_1(call, rc, sroute_id);
-}
-
-void inet_cfg_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_cfg_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "method %d", (int)method);
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case INETCFG_ADDR_CREATE_STATIC:
-			inetcfg_addr_create_static_srv(&call);
-			break;
-		case INETCFG_ADDR_DELETE:
-			inetcfg_addr_delete_srv(&call);
-			break;
-		case INETCFG_ADDR_GET:
-			inetcfg_addr_get_srv(&call);
-			break;
-		case INETCFG_ADDR_GET_ID:
-			inetcfg_addr_get_id_srv(&call);
-			break;
-		case INETCFG_GET_ADDR_LIST:
-			inetcfg_get_addr_list_srv(&call);
-			break;
-		case INETCFG_GET_LINK_LIST:
-			inetcfg_get_link_list_srv(&call);
-			break;
-		case INETCFG_GET_SROUTE_LIST:
-			inetcfg_get_sroute_list_srv(&call);
-			break;
-		case INETCFG_LINK_ADD:
-			inetcfg_link_add_srv(&call);
-			break;
-		case INETCFG_LINK_GET:
-			inetcfg_link_get_srv(&call);
-			break;
-		case INETCFG_LINK_REMOVE:
-			inetcfg_link_remove_srv(&call);
-			break;
-		case INETCFG_SROUTE_CREATE:
-			inetcfg_sroute_create_srv(&call);
-			break;
-		case INETCFG_SROUTE_DELETE:
-			inetcfg_sroute_delete_srv(&call);
-			break;
-		case INETCFG_SROUTE_GET:
-			inetcfg_sroute_get_srv(&call);
-			break;
-		case INETCFG_SROUTE_GET_ID:
-			inetcfg_sroute_get_id_srv(&call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-static errno_t inet_cfg_load(const char *cfg_path)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *naddrs;
-	sif_node_t *nroutes;
-	const char *ntype;
-	errno_t rc;
-
-	rc = sif_load(cfg_path, &doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	naddrs = sif_node_first_child(rnode);
-	ntype = sif_node_get_type(naddrs);
-	if (str_cmp(ntype, "addresses") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = inet_addrobjs_load(naddrs);
-	if (rc != EOK)
-		goto error;
-
-	nroutes = sif_node_next_child(naddrs);
-	ntype = sif_node_get_type(nroutes);
-	if (str_cmp(ntype, "static-routes") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	rc = inet_sroutes_load(nroutes);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	return rc;
-
-}
-
-static errno_t inet_cfg_save(const char *cfg_path)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *nsroutes;
-	sif_node_t *naddrobjs;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_cfg_save(%s)", cfg_path);
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-
-	/* Address objects */
-
-	rc = sif_node_append_child(rnode, "addresses", &naddrobjs);
-	if (rc != EOK)
-		goto error;
-
-	rc = inet_addrobjs_save(naddrobjs);
-	if (rc != EOK)
-		goto error;
-
-	/* Static routes */
-
-	rc = sif_node_append_child(rnode, "static-routes", &nsroutes);
-	if (rc != EOK)
-		goto error;
-
-	rc = inet_sroutes_save(nsroutes);
-	if (rc != EOK)
-		goto error;
-
-	/* Save */
-
-	rc = sif_save(doc, cfg_path);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	return rc;
-}
-
-/** Open internet server configuration.
- *
- * @param cfg_path Configuration file path
- * @param rcfg Place to store pointer to configuration object
- * @return EOK on success or an error code
- */
-errno_t inet_cfg_open(const char *cfg_path, inet_cfg_t **rcfg)
-{
-	inet_cfg_t *cfg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_cfg_open(%s)", cfg_path);
-
-	rc = inet_cfg_load(cfg_path);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "inet_cfg_open(%s) :"
-		    "could not load configuration.", cfg_path);
-	}
-
-	cfg = calloc(1, sizeof(inet_cfg_t));
-	if (cfg == NULL)
-		return ENOMEM;
-
-	cfg->cfg_path = str_dup(cfg_path);
-	if (cfg->cfg_path == NULL) {
-		free(cfg);
-		return ENOMEM;
-	}
-
-	*rcfg = cfg;
-	return EOK;
-}
-
-errno_t inet_cfg_sync(inet_cfg_t *cfg)
-{
-	log_msg(LOG_DEFAULT, LVL_NOTE, "inet_cfg_sync(cfg=%p)", cfg);
-	return inet_cfg_save(cfg->cfg_path);
-}
-
-void inet_cfg_close(inet_cfg_t *cfg)
-{
-	free(cfg);
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetcfg.h
===================================================================
--- uspace/srv/net/inetsrv/inetcfg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INETCFG_H_
-#define INETCFG_H_
-
-#include <errno.h>
-#include "inetsrv.h"
-
-extern void inet_cfg_conn(ipc_call_t *, void *);
-extern errno_t inet_cfg_open(const char *, inet_cfg_t **);
-extern errno_t inet_cfg_sync(inet_cfg_t *);
-extern void inet_cfg_close(inet_cfg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetping.c
===================================================================
--- uspace/srv/net/inetsrv/inetping.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,320 +1,0 @@
-/*
- * Copyright (c) 2013 Jiri Svoboda
- * Copyright (c) 2013 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <async.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <ipc/inet.h>
-#include <loc.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <types/inetping.h>
-#include "icmp.h"
-#include "icmpv6.h"
-#include "icmp_std.h"
-#include "inetsrv.h"
-#include "inetping.h"
-
-static FIBRIL_MUTEX_INITIALIZE(client_list_lock);
-static LIST_INITIALIZE(client_list);
-
-/** Last used session identifier. Protected by @c client_list_lock */
-static uint16_t inetping_ident = 0;
-
-static errno_t inetping_send(inetping_client_t *client, inetping_sdu_t *sdu)
-{
-	if (sdu->src.version != sdu->dest.version)
-		return EINVAL;
-
-	switch (sdu->src.version) {
-	case ip_v4:
-		return icmp_ping_send(client->ident, sdu);
-	case ip_v6:
-		return icmpv6_ping_send(client->ident, sdu);
-	default:
-		return EINVAL;
-	}
-}
-
-static errno_t inetping_get_srcaddr(inetping_client_t *client,
-    inet_addr_t *remote, inet_addr_t *local)
-{
-	return inet_get_srcaddr(remote, ICMP_TOS, local);
-}
-
-static inetping_client_t *inetping_client_find(uint16_t ident)
-{
-	fibril_mutex_lock(&client_list_lock);
-
-	list_foreach(client_list, client_list, inetping_client_t, client) {
-		if (client->ident == ident) {
-			fibril_mutex_unlock(&client_list_lock);
-			return client;
-		}
-	}
-
-	fibril_mutex_unlock(&client_list_lock);
-	return NULL;
-}
-
-errno_t inetping_recv(uint16_t ident, inetping_sdu_t *sdu)
-{
-	inetping_client_t *client = inetping_client_find(ident);
-	if (client == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Unknown ICMP ident. Dropping.");
-		return ENOENT;
-	}
-
-	async_exch_t *exch = async_exchange_begin(client->sess);
-
-	ipc_call_t answer;
-	aid_t req = async_send_1(exch, INETPING_EV_RECV, sdu->seq_no, &answer);
-
-	errno_t rc = async_data_write_start(exch, &sdu->src, sizeof(sdu->src));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, &sdu->dest, sizeof(sdu->dest));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, sdu->data, sdu->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-static void inetping_send_srv(inetping_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_send_srv()");
-
-	inetping_sdu_t sdu;
-	errno_t rc;
-
-	sdu.seq_no = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(sdu.src)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &sdu.src, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(sdu.dest)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &sdu.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = async_data_write_accept((void **) &sdu.data, false, 0, 0, 0,
-	    &sdu.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = inetping_send(client, &sdu);
-	free(sdu.data);
-
-	async_answer_0(icall, rc);
-}
-
-static void inetping_get_srcaddr_srv(inetping_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_get_srcaddr_srv()");
-
-	ipc_call_t call;
-	size_t size;
-
-	inet_addr_t local;
-	inet_addr_t remote;
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(remote)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, &remote, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = inetping_get_srcaddr(client, &remote, &local);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(local)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &local, size);
-	if (rc != EOK)
-		async_answer_0(&call, rc);
-
-	async_answer_0(icall, rc);
-}
-
-static errno_t inetping_client_init(inetping_client_t *client)
-{
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL)
-		return ENOMEM;
-
-	client->sess = sess;
-	link_initialize(&client->client_list);
-
-	fibril_mutex_lock(&client_list_lock);
-	client->ident = ++inetping_ident;
-	list_append(&client->client_list, &client_list);
-	fibril_mutex_unlock(&client_list_lock);
-
-	return EOK;
-}
-
-static void inetping_client_fini(inetping_client_t *client)
-{
-	async_hangup(client->sess);
-	client->sess = NULL;
-
-	fibril_mutex_lock(&client_list_lock);
-	list_remove(&client->client_list);
-	fibril_mutex_unlock(&client_list_lock);
-}
-
-void inetping_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inetping_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	inetping_client_t client;
-	errno_t rc = inetping_client_init(&client);
-	if (rc != EOK)
-		return;
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case INETPING_SEND:
-			inetping_send_srv(&client, &call);
-			break;
-		case INETPING_GET_SRCADDR:
-			inetping_get_srcaddr_srv(&client, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-
-	inetping_client_fini(&client);
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetping.h
===================================================================
--- uspace/srv/net/inetsrv/inetping.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INETPING_H_
-#define INETPING_H_
-
-#include <types/inetping.h>
-#include "inetsrv.h"
-
-extern void inetping_conn(ipc_call_t *, void *);
-extern errno_t inetping_recv(uint16_t, inetping_sdu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetsrv.c
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,581 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief Internet Protocol service
- */
-
-#include <adt/list.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <ipc/inet.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <task.h>
-#include "addrobj.h"
-#include "icmp.h"
-#include "icmp_std.h"
-#include "icmpv6.h"
-#include "icmpv6_std.h"
-#include "inetsrv.h"
-#include "inetcfg.h"
-#include "inetping.h"
-#include "inet_link.h"
-#include "reass.h"
-#include "sroute.h"
-
-#define NAME "inetsrv"
-
-static inet_naddr_t solicited_node_mask = {
-	.version = ip_v6,
-	.addr6 = { 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0xff, 0, 0, 0 },
-	.prefix = 104
-};
-
-static inet_addr_t broadcast4_all_hosts = {
-	.version = ip_v4,
-	.addr = 0xffffffff
-};
-
-static inet_addr_t multicast_all_nodes = {
-	.version = ip_v6,
-	.addr6 = { 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01 }
-};
-
-static const char *inet_cfg_path = "/w/cfg/inetsrv.sif";
-
-static FIBRIL_MUTEX_INITIALIZE(client_list_lock);
-static LIST_INITIALIZE(client_list);
-inet_cfg_t *cfg;
-
-static void inet_default_conn(ipc_call_t *, void *);
-
-static errno_t inet_init(void)
-{
-	port_id_t port;
-	errno_t rc;
-	loc_srv_t *srv;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_init()");
-
-	rc = inet_link_discovery_start();
-	if (rc != EOK)
-		return rc;
-
-	rc = inet_cfg_open(inet_cfg_path, &cfg);
-	if (rc != EOK)
-		return rc;
-
-	rc = async_create_port(INTERFACE_INET,
-	    inet_default_conn, NULL, &port);
-	if (rc != EOK)
-		return rc;
-
-	rc = async_create_port(INTERFACE_INETCFG,
-	    inet_cfg_conn, NULL, &port);
-	if (rc != EOK)
-		return rc;
-
-	rc = async_create_port(INTERFACE_INETPING,
-	    inetping_conn, NULL, &port);
-	if (rc != EOK)
-		return rc;
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	service_id_t sid;
-	rc = loc_service_register(srv, SERVICE_NAME_INET, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		return EEXIST;
-	}
-
-	return EOK;
-}
-
-static void inet_callback_create_srv(inet_client_t *client, ipc_call_t *call)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_callback_create_srv()");
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	client->sess = sess;
-	async_answer_0(call, EOK);
-}
-
-static errno_t inet_find_dir(inet_addr_t *src, inet_addr_t *dest, uint8_t tos,
-    inet_dir_t *dir)
-{
-	inet_sroute_t *sr;
-
-	/* XXX Handle case where source address is specified */
-	(void) src;
-
-	dir->aobj = inet_addrobj_find(dest, iaf_net);
-	if (dir->aobj != NULL) {
-		dir->ldest = *dest;
-		dir->dtype = dt_direct;
-	} else {
-		/* No direct path, try using a static route */
-		sr = inet_sroute_find(dest);
-		if (sr != NULL) {
-			dir->aobj = inet_addrobj_find(&sr->router, iaf_net);
-			dir->ldest = sr->router;
-			dir->dtype = dt_router;
-		}
-	}
-
-	if (dir->aobj == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_send: No route to destination.");
-		return ENOENT;
-	}
-
-	return EOK;
-}
-
-errno_t inet_route_packet(inet_dgram_t *dgram, uint8_t proto, uint8_t ttl,
-    int df)
-{
-	inet_dir_t dir;
-	inet_link_t *ilink;
-	errno_t rc;
-
-	if (dgram->iplink != 0) {
-		/* XXX TODO - IPv6 */
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram directly to iplink %zu",
-		    dgram->iplink);
-		/* Send packet directly to the specified IP link */
-		ilink = inet_link_get_by_id(dgram->iplink);
-		if (ilink == 0)
-			return ENOENT;
-
-		if (dgram->src.version != ip_v4 ||
-		    dgram->dest.version != ip_v4)
-			return EINVAL;
-
-		return inet_link_send_dgram(ilink, dgram->src.addr,
-		    dgram->dest.addr, dgram, proto, ttl, df);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "dgram to be routed");
-
-	/* Route packet using source/destination addresses */
-
-	rc = inet_find_dir(&dgram->src, &dgram->dest, dgram->tos, &dir);
-	if (rc != EOK)
-		return rc;
-
-	return inet_addrobj_send_dgram(dir.aobj, &dir.ldest, dgram,
-	    proto, ttl, df);
-}
-
-static errno_t inet_send(inet_client_t *client, inet_dgram_t *dgram,
-    uint8_t proto, uint8_t ttl, int df)
-{
-	return inet_route_packet(dgram, proto, ttl, df);
-}
-
-errno_t inet_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
-{
-	inet_dir_t dir;
-	errno_t rc;
-
-	rc = inet_find_dir(NULL, remote, tos, &dir);
-	if (rc != EOK)
-		return rc;
-
-	/* XXX dt_local? */
-
-	/* Take source address from the address object */
-	if (remote->version == ip_v4 && remote->addr == 0xffffffff) {
-		/* XXX TODO - IPv6 */
-		local->version = ip_v4;
-		local->addr = 0;
-		return EOK;
-	}
-
-	inet_naddr_addr(&dir.aobj->naddr, local);
-	return EOK;
-}
-
-static void inet_get_srcaddr_srv(inet_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_get_srcaddr_srv()");
-
-	uint8_t tos = ipc_get_arg1(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	inet_addr_t remote;
-	errno_t rc = async_data_write_finalize(&call, &remote, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-	}
-
-	inet_addr_t local;
-	rc = inet_get_srcaddr(&remote, tos, &local);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &local, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, rc);
-}
-
-static void inet_send_srv(inet_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_send_srv()");
-
-	inet_dgram_t dgram;
-
-	dgram.iplink = ipc_get_arg1(icall);
-	dgram.tos = ipc_get_arg2(icall);
-
-	uint8_t ttl = ipc_get_arg3(icall);
-	int df = ipc_get_arg4(icall);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	errno_t rc = async_data_write_finalize(&call, &dgram.src, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-	}
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_addr_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &dgram.dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-	}
-
-	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0,
-	    &dgram.size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = inet_send(client, &dgram, client->protocol, ttl, df);
-
-	free(dgram.data);
-	async_answer_0(icall, rc);
-}
-
-static void inet_set_proto_srv(inet_client_t *client, ipc_call_t *call)
-{
-	sysarg_t proto;
-
-	proto = ipc_get_arg1(call);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_set_proto_srv(%lu)", (unsigned long) proto);
-
-	if (proto > UINT8_MAX) {
-		async_answer_0(call, EINVAL);
-		return;
-	}
-
-	client->protocol = proto;
-	async_answer_0(call, EOK);
-}
-
-static void inet_client_init(inet_client_t *client)
-{
-	client->sess = NULL;
-
-	fibril_mutex_lock(&client_list_lock);
-	list_append(&client->client_list, &client_list);
-	fibril_mutex_unlock(&client_list_lock);
-}
-
-static void inet_client_fini(inet_client_t *client)
-{
-	async_hangup(client->sess);
-	client->sess = NULL;
-
-	fibril_mutex_lock(&client_list_lock);
-	list_remove(&client->client_list);
-	fibril_mutex_unlock(&client_list_lock);
-}
-
-static void inet_default_conn(ipc_call_t *icall, void *arg)
-{
-	inet_client_t client;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_default_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	inet_client_init(&client);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case INET_CALLBACK_CREATE:
-			inet_callback_create_srv(&client, &call);
-			break;
-		case INET_GET_SRCADDR:
-			inet_get_srcaddr_srv(&client, &call);
-			break;
-		case INET_SEND:
-			inet_send_srv(&client, &call);
-			break;
-		case INET_SET_PROTO:
-			inet_set_proto_srv(&client, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-
-	inet_client_fini(&client);
-}
-
-static inet_client_t *inet_client_find(uint8_t proto)
-{
-	fibril_mutex_lock(&client_list_lock);
-
-	list_foreach(client_list, client_list, inet_client_t, client) {
-		if (client->protocol == proto) {
-			fibril_mutex_unlock(&client_list_lock);
-			return client;
-		}
-	}
-
-	fibril_mutex_unlock(&client_list_lock);
-	return NULL;
-}
-
-errno_t inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
-{
-	async_exch_t *exch = async_exchange_begin(client->sess);
-
-	ipc_call_t answer;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_ev_recv: iplink=%zu",
-	    dgram->iplink);
-
-	aid_t req = async_send_2(exch, INET_EV_RECV, dgram->tos,
-	    dgram->iplink, &answer);
-
-	errno_t rc = async_data_write_start(exch, &dgram->src, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, &dgram->dest, sizeof(inet_addr_t));
-	if (rc != EOK) {
-		async_exchange_end(exch);
-		async_forget(req);
-		return rc;
-	}
-
-	rc = async_data_write_start(exch, dgram->data, dgram->size);
-
-	async_exchange_end(exch);
-
-	if (rc != EOK) {
-		async_forget(req);
-		return rc;
-	}
-
-	errno_t retval;
-	async_wait_for(req, &retval);
-
-	return retval;
-}
-
-errno_t inet_recv_dgram_local(inet_dgram_t *dgram, uint8_t proto)
-{
-	inet_client_t *client;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_recv_dgram_local()");
-
-	/* ICMP and ICMPv6 messages are handled internally */
-	if (proto == IP_PROTO_ICMP)
-		return icmp_recv(dgram);
-
-	if (proto == IP_PROTO_ICMPV6)
-		return icmpv6_recv(dgram);
-
-	client = inet_client_find(proto);
-	if (client == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "No client found for protocol 0x%" PRIx8,
-		    proto);
-		return ENOENT;
-	}
-
-	return inet_ev_recv(client, dgram);
-}
-
-errno_t inet_recv_packet(inet_packet_t *packet)
-{
-	inet_addrobj_t *addr;
-	inet_dgram_t dgram;
-
-	addr = inet_addrobj_find(&packet->dest, iaf_addr);
-	if ((addr != NULL) ||
-	    (inet_naddr_compare_mask(&solicited_node_mask, &packet->dest)) ||
-	    (inet_addr_compare(&multicast_all_nodes, &packet->dest)) ||
-	    (inet_addr_compare(&broadcast4_all_hosts, &packet->dest))) {
-		/* Destined for one of the local addresses */
-
-		/* Check if packet is a complete datagram */
-		if (packet->offs == 0 && !packet->mf) {
-			/* It is complete deliver it immediately */
-			dgram.iplink = packet->link_id;
-			dgram.src = packet->src;
-			dgram.dest = packet->dest;
-			dgram.tos = packet->tos;
-			dgram.data = packet->data;
-			dgram.size = packet->size;
-
-			return inet_recv_dgram_local(&dgram, packet->proto);
-		} else {
-			/* It is a fragment, queue it for reassembly */
-			inet_reass_queue_packet(packet);
-		}
-	}
-
-	return ENOENT;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": HelenOS Internet Protocol service\n");
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = inet_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-
-	task_retval(0);
-
-	(void)inet_link_autoconf();
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/inetsrv.h
===================================================================
--- uspace/srv/net/inetsrv/inetsrv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,190 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inetsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INETSRV_H_
-#define INETSRV_H_
-
-#include <adt/list.h>
-#include <stdbool.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink.h>
-#include <ipc/loc.h>
-#include <sif.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <types/inet.h>
-#include <async.h>
-
-/** Inet Client */
-typedef struct {
-	async_sess_t *sess;
-	uint8_t protocol;
-	link_t client_list;
-} inet_client_t;
-
-/** Inetping Client */
-typedef struct {
-	/** Callback session */
-	async_sess_t *sess;
-	/** Session identifier */
-	uint16_t ident;
-	/** Link to client list */
-	link_t client_list;
-} inetping_client_t;
-
-/** Inetping6 Client */
-typedef struct {
-	/** Callback session */
-	async_sess_t *sess;
-	/** Session identifier */
-	uint16_t ident;
-	/** Link to client list */
-	link_t client_list;
-} inetping6_client_t;
-
-typedef struct {
-	/** Local link ID */
-	service_id_t link_id;
-	/** Source address */
-	inet_addr_t src;
-	/** Destination address */
-	inet_addr_t dest;
-	/** Type of service */
-	uint8_t tos;
-	/** Protocol */
-	uint8_t proto;
-	/** Time to live */
-	uint8_t ttl;
-	/** Identifier */
-	uint32_t ident;
-	/** Do not fragment */
-	bool df;
-	/** More fragments */
-	bool mf;
-	/** Offset of fragment into datagram, in bytes */
-	size_t offs;
-	/** Packet data */
-	void *data;
-	/** Packet data size in bytes */
-	size_t size;
-} inet_packet_t;
-
-typedef struct {
-	link_t link_list;
-	service_id_t svc_id;
-	char *svc_name;
-	async_sess_t *sess;
-	iplink_t *iplink;
-	size_t def_mtu;
-	eth_addr_t mac;
-	bool mac_valid;
-} inet_link_t;
-
-/** Link information needed for autoconfiguration */
-typedef struct {
-	service_id_t svc_id;
-	char *svc_name;
-} inet_link_cfg_info_t;
-
-/** Address object */
-typedef struct {
-	/** Link to list of addresses */
-	link_t addr_list;
-	/** Address object ID */
-	sysarg_t id;
-	/** Network address */
-	inet_naddr_t naddr;
-	/** Underlying IP link */
-	inet_link_t *ilink;
-	/** Address name */
-	char *name;
-	/** Temporary object */
-	bool temp;
-} inet_addrobj_t;
-
-/** Static route configuration */
-typedef struct {
-	link_t sroute_list;
-	/** ID */
-	sysarg_t id;
-	/** Destination network */
-	inet_naddr_t dest;
-	/** Router via which to route packets */
-	inet_addr_t router;
-	/** Route name */
-	char *name;
-	/** Temporary route */
-	bool temp;
-} inet_sroute_t;
-
-typedef enum {
-	/** Destination is on this network node */
-	dt_local,
-	/** Destination is directly reachable */
-	dt_direct,
-	/** Destination is behind a router */
-	dt_router
-} inet_dir_type_t;
-
-/** Direction (next hop) to a destination */
-typedef struct {
-	/** Route type */
-	inet_dir_type_t dtype;
-	/** Address object (direction) */
-	inet_addrobj_t *aobj;
-	/** Local destination address */
-	inet_addr_t ldest;
-} inet_dir_t;
-
-/** Internet server configuration */
-typedef struct {
-	/** Configuration file path */
-	char *cfg_path;
-} inet_cfg_t;
-
-extern inet_cfg_t *cfg;
-
-extern errno_t inet_ev_recv(inet_client_t *, inet_dgram_t *);
-extern errno_t inet_recv_packet(inet_packet_t *);
-extern errno_t inet_route_packet(inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-extern errno_t inet_recv_dgram_local(inet_dgram_t *, uint8_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/meson.build
===================================================================
--- uspace/srv/net/inetsrv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet', 'sif' ]
-src = files(
-	'addrobj.c',
-	'icmp.c',
-	'icmpv6.c',
-	'inetsrv.c',
-	'inet_link.c',
-	'inetcfg.c',
-	'inetping.c',
-	'ndp.c',
-	'ntrans.c',
-	'pdu.c',
-	'reass.c',
-	'sroute.c',
-)
Index: pace/srv/net/inetsrv/ndp.c
===================================================================
--- uspace/srv/net/inetsrv/ndp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <errno.h>
-#include <inet/eth_addr.h>
-#include <io/log.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "ntrans.h"
-#include "addrobj.h"
-#include "pdu.h"
-#include "inet_link.h"
-#include "ndp.h"
-
-/** Time to wait for NDP reply in microseconds */
-#define NDP_REQUEST_TIMEOUT  (3 * 1000 * 1000)
-
-static addr128_t solicited_node_ip =
-    { 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0xff, 0, 0, 0 };
-
-/** Compute solicited node IPv6 multicast address from target IPv6 address
- *
- * @param ip_addr      Target IPv6 address
- * @param ip_solicited Solicited IPv6 address to be assigned
- *
- */
-static void ndp_solicited_node_ip(addr128_t ip_addr,
-    addr128_t ip_solicited)
-{
-	memcpy(ip_solicited, solicited_node_ip, 13);
-	memcpy(ip_solicited + 13, ip_addr + 13, 3);
-}
-
-static errno_t ndp_send_packet(inet_link_t *link, ndp_packet_t *packet)
-{
-	inet_dgram_t dgram;
-	ndp_pdu_encode(packet, &dgram);
-
-	inet_link_send_dgram6(link, &packet->target_hw_addr, &dgram,
-	    IP_PROTO_ICMPV6, INET6_HOP_LIMIT_MAX, 0);
-
-	free(dgram.data);
-
-	return EOK;
-}
-
-static errno_t ndp_router_advertisement(inet_dgram_t *dgram, inet_addr_t *router)
-{
-	// FIXME TODO
-	return ENOTSUP;
-}
-
-errno_t ndp_received(inet_dgram_t *dgram)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ndp_received()");
-
-	ndp_packet_t packet;
-	errno_t rc = ndp_pdu_decode(dgram, &packet);
-	if (rc != EOK)
-		return rc;
-
-	inet_addr_t sender;
-	inet_addr_set6(packet.sender_proto_addr, &sender);
-
-	inet_addr_t target;
-	inet_addr_set6(packet.target_proto_addr, &target);
-
-	inet_addrobj_t *laddr;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "NDP PDU decoded; opcode: %d",
-	    packet.opcode);
-
-	switch (packet.opcode) {
-	case ICMPV6_NEIGHBOUR_SOLICITATION:
-		laddr = inet_addrobj_find(&target, iaf_addr);
-		if (laddr != NULL) {
-			rc = ntrans_add(packet.sender_proto_addr,
-			    &packet.sender_hw_addr);
-			if (rc != EOK)
-				return rc;
-
-			ndp_packet_t reply;
-
-			reply.opcode = ICMPV6_NEIGHBOUR_ADVERTISEMENT;
-			reply.sender_hw_addr = laddr->ilink->mac;
-			addr128(packet.target_proto_addr, reply.sender_proto_addr);
-			reply.target_hw_addr = packet.sender_hw_addr;
-			addr128(packet.sender_proto_addr, reply.target_proto_addr);
-
-			ndp_send_packet(laddr->ilink, &reply);
-		}
-
-		break;
-	case ICMPV6_NEIGHBOUR_ADVERTISEMENT:
-		laddr = inet_addrobj_find(&dgram->dest, iaf_addr);
-		if (laddr != NULL)
-			return ntrans_add(packet.sender_proto_addr,
-			    &packet.sender_hw_addr);
-
-		break;
-	case ICMPV6_ROUTER_ADVERTISEMENT:
-		return ndp_router_advertisement(dgram, &sender);
-	default:
-		return ENOTSUP;
-	}
-
-	return EOK;
-}
-
-/** Translate IPv6 to MAC address
- *
- * @param src  Source IPv6 address
- * @param dest Destination IPv6 address
- * @param mac  Target MAC address to be assigned
- * @param link Network interface
- *
- * @return EOK on success
- * @return ENOENT when NDP translation failed
- *
- */
-errno_t ndp_translate(addr128_t src_addr, addr128_t ip_addr, eth_addr_t *mac_addr,
-    inet_link_t *ilink)
-{
-	if (!ilink->mac_valid) {
-		/* The link does not support NDP */
-		memset(mac_addr, 0, 6);
-		return EOK;
-	}
-
-	errno_t rc = ntrans_lookup(ip_addr, mac_addr);
-	if (rc == EOK)
-		return EOK;
-
-	ndp_packet_t packet;
-
-	packet.opcode = ICMPV6_NEIGHBOUR_SOLICITATION;
-	packet.sender_hw_addr = ilink->mac;
-	addr128(src_addr, packet.sender_proto_addr);
-	addr128(ip_addr, packet.solicited_ip);
-	eth_addr_solicited_node(ip_addr, &packet.target_hw_addr);
-	ndp_solicited_node_ip(ip_addr, packet.target_proto_addr);
-
-	rc = ndp_send_packet(ilink, &packet);
-	if (rc != EOK)
-		return rc;
-
-	(void) ntrans_wait_timeout(NDP_REQUEST_TIMEOUT);
-
-	return ntrans_lookup(ip_addr, mac_addr);
-}
Index: pace/srv/net/inetsrv/ndp.h
===================================================================
--- uspace/srv/net/inetsrv/ndp.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ethip
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef NDP_H_
-#define NDP_H_
-
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include "inetsrv.h"
-#include "icmpv6_std.h"
-
-typedef enum icmpv6_type ndp_opcode_t;
-
-/** NDP packet (for 48-bit MAC addresses)
- *
- * Internal representation
- */
-typedef struct {
-	/** Opcode */
-	ndp_opcode_t opcode;
-	/** Sender hardware address */
-	eth_addr_t sender_hw_addr;
-	/** Sender protocol address */
-	addr128_t sender_proto_addr;
-	/** Target hardware address */
-	eth_addr_t target_hw_addr;
-	/** Target protocol address */
-	addr128_t target_proto_addr;
-	/** Solicited IPv6 address */
-	addr128_t solicited_ip;
-} ndp_packet_t;
-
-extern errno_t ndp_received(inet_dgram_t *);
-extern errno_t ndp_translate(addr128_t, addr128_t, eth_addr_t *, inet_link_t *);
-
-#endif
Index: pace/srv/net/inetsrv/ntrans.c
===================================================================
--- uspace/srv/net/inetsrv/ntrans.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <stdlib.h>
-#include "ntrans.h"
-
-/** Address translation list (of inet_ntrans_t) */
-static FIBRIL_MUTEX_INITIALIZE(ntrans_list_lock);
-static LIST_INITIALIZE(ntrans_list);
-static FIBRIL_CONDVAR_INITIALIZE(ntrans_cv);
-
-/** Look for address in translation table
- *
- * @param ip_addr IPv6 address
- *
- * @return inet_ntrans_t with the address on success
- * @return NULL if nothing found
- */
-static inet_ntrans_t *ntrans_find(addr128_t ip_addr)
-{
-	list_foreach(ntrans_list, ntrans_list, inet_ntrans_t, ntrans) {
-		if (addr128_compare(ntrans->ip_addr, ip_addr))
-			return ntrans;
-	}
-
-	return NULL;
-}
-
-/** Add entry to translation table
- *
- * @param ip_addr  IPv6 address of the new entry
- * @param mac_addr MAC address of the new entry
- *
- * @return EOK on success
- * @return ENOMEM if not enough memory
- *
- */
-errno_t ntrans_add(addr128_t ip_addr, eth_addr_t *mac_addr)
-{
-	inet_ntrans_t *ntrans;
-	inet_ntrans_t *prev;
-
-	ntrans = calloc(1, sizeof(inet_ntrans_t));
-	if (ntrans == NULL)
-		return ENOMEM;
-
-	addr128(ip_addr, ntrans->ip_addr);
-	ntrans->mac_addr = *mac_addr;
-
-	fibril_mutex_lock(&ntrans_list_lock);
-	prev = ntrans_find(ip_addr);
-	if (prev != NULL) {
-		list_remove(&prev->ntrans_list);
-		free(prev);
-	}
-
-	list_append(&ntrans->ntrans_list, &ntrans_list);
-	fibril_mutex_unlock(&ntrans_list_lock);
-	fibril_condvar_broadcast(&ntrans_cv);
-
-	return EOK;
-}
-
-/** Remove entry from translation table
- *
- * @param ip_addr IPv6 address of the entry to be removed
- *
- * @return EOK on success
- * @return ENOENT when no such address found
- *
- */
-errno_t ntrans_remove(addr128_t ip_addr)
-{
-	inet_ntrans_t *ntrans;
-
-	fibril_mutex_lock(&ntrans_list_lock);
-	ntrans = ntrans_find(ip_addr);
-	if (ntrans == NULL) {
-		fibril_mutex_unlock(&ntrans_list_lock);
-		return ENOENT;
-	}
-
-	list_remove(&ntrans->ntrans_list);
-	fibril_mutex_unlock(&ntrans_list_lock);
-	free(ntrans);
-
-	return EOK;
-}
-
-/** Translate IPv6 address to MAC address using the translation table
- *
- * @param ip_addr  IPv6 address to be translated
- * @param mac_addr MAC address to be assigned
- *
- * @return EOK on success
- * @return ENOENT when no such address found
- *
- */
-errno_t ntrans_lookup(addr128_t ip_addr, eth_addr_t *mac_addr)
-{
-	fibril_mutex_lock(&ntrans_list_lock);
-	inet_ntrans_t *ntrans = ntrans_find(ip_addr);
-	if (ntrans == NULL) {
-		fibril_mutex_unlock(&ntrans_list_lock);
-		return ENOENT;
-	}
-
-	fibril_mutex_unlock(&ntrans_list_lock);
-	*mac_addr = ntrans->mac_addr;
-	return EOK;
-}
-
-/** Wait on translation table CV for some time
- *
- * @param timeout Timeout in microseconds
- *
- * @return EOK if woken up by another fibril
- * @return ETIMEOUT if timed out
- *
- */
-errno_t ntrans_wait_timeout(usec_t timeout)
-{
-	fibril_mutex_lock(&ntrans_list_lock);
-	errno_t rc = fibril_condvar_wait_timeout(&ntrans_cv, &ntrans_list_lock,
-	    timeout);
-	fibril_mutex_unlock(&ntrans_list_lock);
-
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/ntrans.h
===================================================================
--- uspace/srv/net/inetsrv/ntrans.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * Copyright (c) 2013 Antonin Steinhauser
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef NTRANS_H_
-#define NTRANS_H_
-
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-
-/** Address translation table element */
-typedef struct {
-	link_t ntrans_list;
-	addr128_t ip_addr;
-	eth_addr_t mac_addr;
-} inet_ntrans_t;
-
-extern errno_t ntrans_add(addr128_t, eth_addr_t *);
-extern errno_t ntrans_remove(addr128_t);
-extern errno_t ntrans_lookup(addr128_t, eth_addr_t *);
-extern errno_t ntrans_wait_timeout(usec_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/pdu.c
===================================================================
--- uspace/srv/net/inetsrv/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/*
- * Copyright (c) 2021 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <align.h>
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <inet/eth_addr.h>
-#include <io/log.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "inetsrv.h"
-#include "inet_std.h"
-#include "pdu.h"
-
-/** One's complement addition.
- *
- * Result is a + b + carry.
- */
-static uint16_t inet_ocadd16(uint16_t a, uint16_t b)
-{
-	uint32_t s;
-
-	s = (uint32_t)a + (uint32_t)b;
-	return (s & 0xffff) + (s >> 16);
-}
-
-uint16_t inet_checksum_calc(uint16_t ivalue, void *data, size_t size)
-{
-	uint16_t sum;
-	uint16_t w;
-	size_t words, i;
-	uint8_t *bdata;
-
-	sum = ~ivalue;
-	words = size / 2;
-	bdata = (uint8_t *)data;
-
-	for (i = 0; i < words; i++) {
-		w = ((uint16_t)bdata[2 * i] << 8) | bdata[2 * i + 1];
-		sum = inet_ocadd16(sum, w);
-	}
-
-	if (size % 2 != 0) {
-		w = ((uint16_t)bdata[2 * words] << 8);
-		sum = inet_ocadd16(sum, w);
-	}
-
-	return ~sum;
-}
-
-/** Encode IPv4 PDU.
- *
- * Encode internet packet into PDU (serialized form). Will encode a
- * fragment of the payload starting at offset @a offs. The resulting
- * PDU will have at most @a mtu bytes. @a *roffs will be set to the offset
- * of remaining payload. If some data is remaining, the MF flag will
- * be set in the header, otherwise the offset will equal @a packet->size.
- *
- * @param packet Packet to encode
- * @param src    Source address
- * @param dest   Destination address
- * @param offs   Offset into packet payload (in bytes)
- * @param mtu    MTU (Maximum Transmission Unit) in bytes
- * @param rdata  Place to store pointer to allocated data buffer
- * @param rsize  Place to store size of allocated data buffer
- * @param roffs  Place to store offset of remaning data
- *
- */
-errno_t inet_pdu_encode(inet_packet_t *packet, addr32_t src, addr32_t dest,
-    size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
-{
-	/* Upper bound for fragment offset field */
-	size_t fragoff_limit = 1 << (FF_FRAGOFF_h - FF_FRAGOFF_l + 1);
-
-	/* Verify that total size of datagram is within reasonable bounds */
-	if (packet->size > FRAG_OFFS_UNIT * fragoff_limit)
-		return ELIMIT;
-
-	size_t hdr_size = sizeof(ip_header_t);
-	if (hdr_size >= mtu)
-		return EINVAL;
-
-	assert(hdr_size % 4 == 0);
-	assert(offs % FRAG_OFFS_UNIT == 0);
-	assert(offs / FRAG_OFFS_UNIT < fragoff_limit);
-
-	/* Value for the fragment offset field */
-	uint16_t foff = offs / FRAG_OFFS_UNIT;
-
-	/* Amount of space in the PDU available for payload */
-	size_t spc_avail = mtu - hdr_size;
-	spc_avail -= (spc_avail % FRAG_OFFS_UNIT);
-
-	/* Amount of data (payload) to transfer */
-	size_t xfer_size = min(packet->size - offs, spc_avail);
-
-	/* Total PDU size */
-	size_t size = hdr_size + xfer_size;
-
-	/* Offset of remaining payload */
-	size_t rem_offs = offs + xfer_size;
-
-	/* Flags */
-	uint16_t flags_foff =
-	    (packet->df ? BIT_V(uint16_t, FF_FLAG_DF) : 0) +
-	    (rem_offs < packet->size ? BIT_V(uint16_t, FF_FLAG_MF) : 0) +
-	    (foff << FF_FRAGOFF_l);
-
-	void *data = calloc(size, 1);
-	if (data == NULL)
-		return ENOMEM;
-
-	/* Encode header fields */
-	ip_header_t *hdr = (ip_header_t *) data;
-
-	hdr->ver_ihl =
-	    (4 << VI_VERSION_l) | (hdr_size / sizeof(uint32_t));
-	hdr->tos = packet->tos;
-	hdr->tot_len = host2uint16_t_be(size);
-	hdr->id = host2uint16_t_be(packet->ident);
-	hdr->flags_foff = host2uint16_t_be(flags_foff);
-	hdr->ttl = packet->ttl;
-	hdr->proto = packet->proto;
-	hdr->chksum = 0;
-	hdr->src_addr = host2uint32_t_be(src);
-	hdr->dest_addr = host2uint32_t_be(dest);
-
-	/* Compute checksum */
-	uint16_t chksum = inet_checksum_calc(INET_CHECKSUM_INIT,
-	    (void *) hdr, hdr_size);
-	hdr->chksum = host2uint16_t_be(chksum);
-
-	/* Copy payload */
-	memcpy((uint8_t *) data + hdr_size, packet->data + offs, xfer_size);
-
-	*rdata = data;
-	*rsize = size;
-	*roffs = rem_offs;
-
-	return EOK;
-}
-
-/** Encode IPv6 PDU.
- *
- * Encode internet packet into PDU (serialized form). Will encode a
- * fragment of the payload starting at offset @a offs. The resulting
- * PDU will have at most @a mtu bytes. @a *roffs will be set to the offset
- * of remaining payload. If some data is remaining, the MF flag will
- * be set in the header, otherwise the offset will equal @a packet->size.
- *
- * @param packet Packet to encode
- * @param src    Source address
- * @param dest   Destination address
- * @param offs   Offset into packet payload (in bytes)
- * @param mtu    MTU (Maximum Transmission Unit) in bytes
- * @param rdata  Place to store pointer to allocated data buffer
- * @param rsize  Place to store size of allocated data buffer
- * @param roffs  Place to store offset of remaning data
- *
- */
-errno_t inet_pdu_encode6(inet_packet_t *packet, addr128_t src, addr128_t dest,
-    size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
-{
-	/* IPv6 mandates a minimal MTU of 1280 bytes */
-	if (mtu < 1280)
-		return ELIMIT;
-
-	/* Upper bound for fragment offset field */
-	size_t fragoff_limit = 1 << (OF_FRAGOFF_h - OF_FRAGOFF_l);
-
-	/* Verify that total size of datagram is within reasonable bounds */
-	if (offs + packet->size > FRAG_OFFS_UNIT * fragoff_limit)
-		return ELIMIT;
-
-	/* Determine whether we need the Fragment extension header */
-	bool fragment;
-	if (offs == 0)
-		fragment = (packet->size + sizeof(ip6_header_t) > mtu);
-	else
-		fragment = true;
-
-	size_t hdr_size;
-	if (fragment)
-		hdr_size = sizeof(ip6_header_t) + sizeof(ip6_header_fragment_t);
-	else
-		hdr_size = sizeof(ip6_header_t);
-
-	if (hdr_size >= mtu)
-		return EINVAL;
-
-	static_assert(sizeof(ip6_header_t) % 8 == 0, "");
-	assert(hdr_size % 8 == 0);
-	assert(offs % FRAG_OFFS_UNIT == 0);
-	assert(offs / FRAG_OFFS_UNIT < fragoff_limit);
-
-	/* Value for the fragment offset field */
-	uint16_t foff = offs / FRAG_OFFS_UNIT;
-
-	/* Amount of space in the PDU available for payload */
-	size_t spc_avail = mtu - hdr_size;
-	spc_avail -= (spc_avail % FRAG_OFFS_UNIT);
-
-	/* Amount of data (payload) to transfer */
-	size_t xfer_size = min(packet->size - offs, spc_avail);
-
-	/* Total PDU size */
-	size_t size = hdr_size + xfer_size;
-
-	/* Offset of remaining payload */
-	size_t rem_offs = offs + xfer_size;
-
-	/* Flags */
-	uint16_t offsmf =
-	    (rem_offs < packet->size ? BIT_V(uint16_t, OF_FLAG_M) : 0) +
-	    (foff << OF_FRAGOFF_l);
-
-	void *data = calloc(size, 1);
-	if (data == NULL)
-		return ENOMEM;
-
-	/* Encode header fields */
-	ip6_header_t *hdr6 = (ip6_header_t *) data;
-
-	hdr6->ver_tc = (6 << (VI_VERSION_l));
-	memset(hdr6->tc_fl, 0, 3);
-	hdr6->hop_limit = packet->ttl;
-
-	host2addr128_t_be(src, hdr6->src_addr);
-	host2addr128_t_be(dest, hdr6->dest_addr);
-
-	/* Optionally encode Fragment extension header fields */
-	if (fragment) {
-		assert(offsmf != 0);
-
-		hdr6->payload_len = host2uint16_t_be(packet->size +
-		    sizeof(ip6_header_fragment_t));
-		hdr6->next = IP6_NEXT_FRAGMENT;
-
-		ip6_header_fragment_t *hdr6f = (ip6_header_fragment_t *)
-		    (hdr6 + 1);
-
-		hdr6f->next = packet->proto;
-		hdr6f->reserved = 0;
-		hdr6f->offsmf = host2uint16_t_be(offsmf);
-		hdr6f->id = host2uint32_t_be(packet->ident);
-	} else {
-		assert(offsmf == 0);
-
-		hdr6->payload_len = host2uint16_t_be(packet->size);
-		hdr6->next = packet->proto;
-	}
-
-	/* Copy payload */
-	memcpy((uint8_t *) data + hdr_size, packet->data + offs, xfer_size);
-
-	*rdata = data;
-	*rsize = size;
-	*roffs = rem_offs;
-
-	return EOK;
-}
-
-/** Decode IPv4 datagram
- *
- * @param data    Serialized IPv4 datagram
- * @param size    Length of serialized IPv4 datagram
- * @param link_id Link on which PDU was received
- * @param packet  IP datagram structure to be filled
- *
- * @return EOK on success
- * @return EINVAL if the datagram is invalid or damaged
- * @return ENOMEM if not enough memory
- *
- */
-errno_t inet_pdu_decode(void *data, size_t size, service_id_t link_id,
-    inet_packet_t *packet)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_pdu_decode()");
-
-	if (size < sizeof(ip_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "PDU too short (%zu)", size);
-		return EINVAL;
-	}
-
-	ip_header_t *hdr = (ip_header_t *) data;
-
-	uint8_t version = BIT_RANGE_EXTRACT(uint8_t, VI_VERSION_h,
-	    VI_VERSION_l, hdr->ver_ihl);
-	if (version != 4) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Version (%d) != 4", version);
-		return EINVAL;
-	}
-
-	size_t tot_len = uint16_t_be2host(hdr->tot_len);
-	if (tot_len < sizeof(ip_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Total Length too small (%zu)", tot_len);
-		return EINVAL;
-	}
-
-	if (tot_len > size) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Total Length = %zu > PDU size = %zu",
-		    tot_len, size);
-		return EINVAL;
-	}
-
-	uint16_t ident = uint16_t_be2host(hdr->id);
-	uint16_t flags_foff = uint16_t_be2host(hdr->flags_foff);
-	uint16_t foff = BIT_RANGE_EXTRACT(uint16_t, FF_FRAGOFF_h, FF_FRAGOFF_l,
-	    flags_foff);
-	/* XXX Checksum */
-
-	inet_addr_set(uint32_t_be2host(hdr->src_addr), &packet->src);
-	inet_addr_set(uint32_t_be2host(hdr->dest_addr), &packet->dest);
-	packet->tos = hdr->tos;
-	packet->proto = hdr->proto;
-	packet->ttl = hdr->ttl;
-	packet->ident = ident;
-
-	packet->df = (flags_foff & BIT_V(uint16_t, FF_FLAG_DF)) != 0;
-	packet->mf = (flags_foff & BIT_V(uint16_t, FF_FLAG_MF)) != 0;
-	packet->offs = foff * FRAG_OFFS_UNIT;
-
-	/* XXX IP options */
-	size_t data_offs = sizeof(uint32_t) *
-	    BIT_RANGE_EXTRACT(uint8_t, VI_IHL_h, VI_IHL_l, hdr->ver_ihl);
-
-	packet->size = tot_len - data_offs;
-	packet->data = calloc(packet->size, 1);
-	if (packet->data == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Out of memory.");
-		return ENOMEM;
-	}
-
-	memcpy(packet->data, (uint8_t *) data + data_offs, packet->size);
-	packet->link_id = link_id;
-
-	return EOK;
-}
-
-/** Decode IPv6 datagram
- *
- * @param data    Serialized IPv6 datagram
- * @param size    Length of serialized IPv6 datagram
- * @param link_id Link on which PDU was received
- * @param packet  IP datagram structure to be filled
- *
- * @return EOK on success
- * @return EINVAL if the datagram is invalid or damaged
- * @return ENOMEM if not enough memory
- *
- */
-errno_t inet_pdu_decode6(void *data, size_t size, service_id_t link_id,
-    inet_packet_t *packet)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_pdu_decode6()");
-
-	if (size < sizeof(ip6_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "PDU too short (%zu)", size);
-		return EINVAL;
-	}
-
-	ip6_header_t *hdr6 = (ip6_header_t *) data;
-
-	uint8_t version = BIT_RANGE_EXTRACT(uint8_t, VI_VERSION_h,
-	    VI_VERSION_l, hdr6->ver_tc);
-	if (version != 6) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Version (%d) != 6", version);
-		return EINVAL;
-	}
-
-	size_t payload_len = uint16_t_be2host(hdr6->payload_len);
-	if (payload_len + sizeof(ip6_header_t) > size) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Payload Length = %zu > PDU size = %zu",
-		    payload_len + sizeof(ip6_header_t), size);
-		return EINVAL;
-	}
-
-	uint32_t ident;
-	uint16_t offsmf;
-	uint16_t foff;
-	uint16_t next;
-	size_t data_offs = sizeof(ip6_header_t);
-
-	/* Fragment extension header */
-	if (hdr6->next == IP6_NEXT_FRAGMENT) {
-		ip6_header_fragment_t *hdr6f = (ip6_header_fragment_t *)
-		    (hdr6 + 1);
-
-		ident = uint32_t_be2host(hdr6f->id);
-		offsmf = uint16_t_be2host(hdr6f->offsmf);
-		foff = BIT_RANGE_EXTRACT(uint16_t, OF_FRAGOFF_h, OF_FRAGOFF_l,
-		    offsmf);
-		next = hdr6f->next;
-		data_offs += sizeof(ip6_header_fragment_t);
-		payload_len -= sizeof(ip6_header_fragment_t);
-	} else {
-		ident = 0;
-		offsmf = 0;
-		foff = 0;
-		next = hdr6->next;
-	}
-
-	addr128_t src;
-	addr128_t dest;
-
-	addr128_t_be2host(hdr6->src_addr, src);
-	inet_addr_set6(src, &packet->src);
-
-	addr128_t_be2host(hdr6->dest_addr, dest);
-	inet_addr_set6(dest, &packet->dest);
-
-	packet->tos = 0;
-	packet->proto = next;
-	packet->ttl = hdr6->hop_limit;
-	packet->ident = ident;
-
-	packet->df = 1;
-	packet->mf = (offsmf & BIT_V(uint16_t, OF_FLAG_M)) != 0;
-	packet->offs = foff * FRAG_OFFS_UNIT;
-
-	packet->size = payload_len;
-	packet->data = calloc(packet->size, 1);
-	if (packet->data == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Out of memory.");
-		return ENOMEM;
-	}
-
-	memcpy(packet->data, (uint8_t *) data + data_offs, packet->size);
-	packet->link_id = link_id;
-	return EOK;
-}
-
-/** Encode NDP packet
- *
- * @param ndp   NDP packet structure to be serialized
- * @param dgram IPv6 datagram structure to be filled
- *
- * @return EOK on success
- *
- */
-errno_t ndp_pdu_encode(ndp_packet_t *ndp, inet_dgram_t *dgram)
-{
-	inet_addr_set6(ndp->sender_proto_addr, &dgram->src);
-	inet_addr_set6(ndp->target_proto_addr, &dgram->dest);
-	dgram->tos = 0;
-	dgram->size = sizeof(icmpv6_message_t) + sizeof(ndp_message_t);
-
-	dgram->data = calloc(1, dgram->size);
-	if (dgram->data == NULL)
-		return ENOMEM;
-
-	icmpv6_message_t *icmpv6 = (icmpv6_message_t *) dgram->data;
-
-	icmpv6->type = ndp->opcode;
-	icmpv6->code = 0;
-	memset(icmpv6->un.ndp.reserved, 0, 3);
-
-	ndp_message_t *message = (ndp_message_t *) (icmpv6 + 1);
-
-	if (ndp->opcode == ICMPV6_NEIGHBOUR_SOLICITATION) {
-		host2addr128_t_be(ndp->solicited_ip, message->target_address);
-		message->option = 1;
-		icmpv6->un.ndp.flags = 0;
-	} else {
-		host2addr128_t_be(ndp->sender_proto_addr, message->target_address);
-		message->option = 2;
-		icmpv6->un.ndp.flags = NDP_FLAG_OVERRIDE | NDP_FLAG_SOLICITED;
-	}
-
-	message->length = 1;
-	eth_addr_encode(&ndp->sender_hw_addr, message->mac);
-
-	icmpv6_phdr_t phdr;
-
-	host2addr128_t_be(ndp->sender_proto_addr, phdr.src_addr);
-	host2addr128_t_be(ndp->target_proto_addr, phdr.dest_addr);
-	phdr.length = host2uint32_t_be(dgram->size);
-	memset(phdr.zeroes, 0, 3);
-	phdr.next = IP_PROTO_ICMPV6;
-
-	uint16_t cs_phdr =
-	    inet_checksum_calc(INET_CHECKSUM_INIT, &phdr,
-	    sizeof(icmpv6_phdr_t));
-
-	uint16_t cs_all = inet_checksum_calc(cs_phdr, dgram->data,
-	    dgram->size);
-
-	icmpv6->checksum = host2uint16_t_be(cs_all);
-
-	return EOK;
-}
-
-/** Decode NDP packet
- *
- * @param dgram Incoming IPv6 datagram encapsulating NDP packet
- * @param ndp   NDP packet structure to be filled
- *
- * @return EOK on success
- * @return EINVAL if the Datagram is invalid
- *
- */
-errno_t ndp_pdu_decode(inet_dgram_t *dgram, ndp_packet_t *ndp)
-{
-	ip_ver_t src_ver = inet_addr_get(&dgram->src, NULL,
-	    &ndp->sender_proto_addr);
-	if (src_ver != ip_v6)
-		return EINVAL;
-
-	if (dgram->size < sizeof(icmpv6_message_t) + sizeof(ndp_message_t))
-		return EINVAL;
-
-	icmpv6_message_t *icmpv6 = (icmpv6_message_t *) dgram->data;
-
-	ndp->opcode = icmpv6->type;
-
-	ndp_message_t *message = (ndp_message_t *) (icmpv6 + 1);
-
-	addr128_t_be2host(message->target_address, ndp->target_proto_addr);
-	eth_addr_decode(message->mac, &ndp->sender_hw_addr);
-
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/pdu.h
===================================================================
--- uspace/srv/net/inetsrv/pdu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INET_PDU_H_
-#define INET_PDU_H_
-
-#include <loc.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "inetsrv.h"
-#include "ndp.h"
-
-#define INET_CHECKSUM_INIT 0xffff
-
-extern uint16_t inet_checksum_calc(uint16_t, void *, size_t);
-
-extern errno_t inet_pdu_encode(inet_packet_t *, addr32_t, addr32_t, size_t, size_t,
-    void **, size_t *, size_t *);
-extern errno_t inet_pdu_encode6(inet_packet_t *, addr128_t, addr128_t, size_t,
-    size_t, void **, size_t *, size_t *);
-extern errno_t inet_pdu_decode(void *, size_t, service_id_t, inet_packet_t *);
-extern errno_t inet_pdu_decode6(void *, size_t, service_id_t, inet_packet_t *);
-
-extern errno_t ndp_pdu_decode(inet_dgram_t *, ndp_packet_t *);
-extern errno_t ndp_pdu_encode(ndp_packet_t *, inet_dgram_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/reass.c
===================================================================
--- uspace/srv/net/inetsrv/reass.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,382 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief Datagram reassembly.
- */
-
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "inetsrv.h"
-#include "inet_std.h"
-#include "reass.h"
-
-/** Datagram being reassembled.
- *
- * Uniquely identified by (source address, destination address, protocol,
- * identification) per RFC 791 sec. 2.3 / Fragmentation.
- */
-typedef struct {
-	link_t map_link;
-	/** List of fragments, @c reass_frag_t */
-	list_t frags;
-} reass_dgram_t;
-
-/** One datagram fragment */
-typedef struct {
-	link_t dgram_link;
-	inet_packet_t packet;
-} reass_frag_t;
-
-/** Datagram map, list of reass_dgram_t */
-static LIST_INITIALIZE(reass_dgram_map);
-/** Protects access to @c reass_dgram_map */
-static FIBRIL_MUTEX_INITIALIZE(reass_dgram_map_lock);
-
-static reass_dgram_t *reass_dgram_new(void);
-static reass_dgram_t *reass_dgram_get(inet_packet_t *);
-static errno_t reass_dgram_insert_frag(reass_dgram_t *, inet_packet_t *);
-static bool reass_dgram_complete(reass_dgram_t *);
-static void reass_dgram_remove(reass_dgram_t *);
-static errno_t reass_dgram_deliver(reass_dgram_t *);
-static void reass_dgram_destroy(reass_dgram_t *);
-
-/** Queue packet for datagram reassembly.
- *
- * @param packet	Packet
- * @return		EOK on success or ENOMEM.
- */
-errno_t inet_reass_queue_packet(inet_packet_t *packet)
-{
-	reass_dgram_t *rdg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_reass_queue_packet()");
-
-	fibril_mutex_lock(&reass_dgram_map_lock);
-
-	/* Get existing or new datagram */
-	rdg = reass_dgram_get(packet);
-	if (rdg == NULL) {
-		/* Only happens when we are out of memory */
-		fibril_mutex_unlock(&reass_dgram_map_lock);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Allocation failed, packet dropped.");
-		return ENOMEM;
-	}
-
-	/* Insert fragment into the datagram */
-	rc = reass_dgram_insert_frag(rdg, packet);
-	if (rc != EOK)
-		return ENOMEM;
-
-	/* Check if datagram is complete */
-	if (reass_dgram_complete(rdg)) {
-		/* Remove it from the map */
-		reass_dgram_remove(rdg);
-		fibril_mutex_unlock(&reass_dgram_map_lock);
-
-		/* Deliver complete datagram */
-		rc = reass_dgram_deliver(rdg);
-		reass_dgram_destroy(rdg);
-		return rc;
-	}
-
-	fibril_mutex_unlock(&reass_dgram_map_lock);
-	return EOK;
-}
-
-/** Get datagram reassembly structure for packet.
- *
- * @param packet	Packet
- * @return		Datagram reassembly structure matching @a packet
- */
-static reass_dgram_t *reass_dgram_get(inet_packet_t *packet)
-{
-	assert(fibril_mutex_is_locked(&reass_dgram_map_lock));
-
-	list_foreach(reass_dgram_map, map_link, reass_dgram_t, rdg) {
-		link_t *f1_link = list_first(&rdg->frags);
-		assert(f1_link != NULL);
-
-		reass_frag_t *f1 = list_get_instance(f1_link, reass_frag_t,
-		    dgram_link);
-
-		if ((inet_addr_compare(&f1->packet.src, &packet->src)) &&
-		    (inet_addr_compare(&f1->packet.dest, &packet->dest)) &&
-		    (f1->packet.proto == packet->proto) &&
-		    (f1->packet.ident == packet->ident)) {
-			/* Match */
-			return rdg;
-		}
-	}
-
-	/* No existing reassembly structure. Create a new one. */
-	return reass_dgram_new();
-}
-
-/** Create new datagram reassembly structure.
- *
- * @return New datagram reassembly structure.
- */
-static reass_dgram_t *reass_dgram_new(void)
-{
-	reass_dgram_t *rdg;
-
-	rdg = calloc(1, sizeof(reass_dgram_t));
-	if (rdg == NULL)
-		return NULL;
-
-	list_append(&rdg->map_link, &reass_dgram_map);
-	list_initialize(&rdg->frags);
-
-	return rdg;
-}
-
-static reass_frag_t *reass_frag_new(void)
-{
-	reass_frag_t *frag;
-
-	frag = calloc(1, sizeof(reass_frag_t));
-	if (frag == NULL)
-		return NULL;
-
-	link_initialize(&frag->dgram_link);
-
-	return frag;
-}
-
-static errno_t reass_dgram_insert_frag(reass_dgram_t *rdg, inet_packet_t *packet)
-{
-	reass_frag_t *frag;
-	void *data_copy;
-	link_t *link;
-
-	assert(fibril_mutex_is_locked(&reass_dgram_map_lock));
-
-	frag = reass_frag_new();
-
-	/* Clone the packet */
-
-	data_copy = malloc(packet->size);
-	if (data_copy == NULL) {
-		free(frag);
-		return ENOMEM;
-	}
-
-	memcpy(data_copy, packet->data, packet->size);
-
-	frag->packet = *packet;
-	frag->packet.data = data_copy;
-
-	/*
-	 * XXX Make resource-consuming attacks harder, eliminate any duplicate
-	 * data immediately. Possibly eliminate redundant packet headers.
-	 */
-
-	/*
-	 * Insert into the list, which is sorted by offs member ascending.
-	 */
-
-	link = list_first(&rdg->frags);
-	while (link != NULL) {
-		reass_frag_t *qf = list_get_instance(link, reass_frag_t,
-		    dgram_link);
-
-		if (qf->packet.offs >= packet->offs)
-			break;
-
-		link = list_next(link, &rdg->frags);
-	}
-
-	if (link != NULL)
-		list_insert_after(&frag->dgram_link, link);
-	else
-		list_append(&frag->dgram_link, &rdg->frags);
-
-	return EOK;
-}
-
-/** Check if datagram is complete.
- *
- * @param rdg		Datagram reassembly structure
- * @return		@c true if complete, @c false if not
- */
-static bool reass_dgram_complete(reass_dgram_t *rdg)
-{
-	reass_frag_t *frag, *prev;
-	link_t *link;
-
-	assert(fibril_mutex_is_locked(&reass_dgram_map_lock));
-	assert(!list_empty(&rdg->frags));
-
-	link = list_first(&rdg->frags);
-	assert(link != NULL);
-
-	frag = list_get_instance(link, reass_frag_t,
-	    dgram_link);
-
-	/* First fragment must be at offset zero */
-	if (frag->packet.offs != 0)
-		return false;
-
-	prev = frag;
-
-	while (true) {
-		link = list_next(link, &rdg->frags);
-		if (link == NULL)
-			break;
-
-		/* Each next fragment must follow immediately or overlap */
-		frag = list_get_instance(link, reass_frag_t, dgram_link);
-		if (frag->packet.offs > prev->packet.offs + prev->packet.size)
-			return false;
-
-		/* No more fragments - datagram is complete */
-		if (!frag->packet.mf)
-			return true;
-
-		prev = frag;
-	}
-
-	return false;
-}
-
-/** Remove datagram from reassembly map.
- *
- * @param rdg		Datagram reassembly structure
- */
-static void reass_dgram_remove(reass_dgram_t *rdg)
-{
-	assert(fibril_mutex_is_locked(&reass_dgram_map_lock));
-	list_remove(&rdg->map_link);
-}
-
-/** Deliver complete datagram.
- *
- * @param rdg		Datagram reassembly structure.
- */
-static errno_t reass_dgram_deliver(reass_dgram_t *rdg)
-{
-	size_t dgram_size;
-	size_t fragoff_limit;
-	inet_dgram_t dgram;
-	uint8_t proto;
-	reass_frag_t *frag;
-	errno_t rc;
-
-	/*
-	 * Potentially there could be something beyond the first packet
-	 * that has !MF. Make sure we ignore that.
-	 */
-	frag = NULL;
-	list_foreach(rdg->frags, dgram_link, reass_frag_t, cfrag) {
-		if (!cfrag->packet.mf) {
-			frag = cfrag;
-			break;
-		}
-	}
-
-	assert(frag != NULL);
-	assert(!frag->packet.mf);
-
-	dgram_size = frag->packet.offs + frag->packet.size;
-
-	/* Upper bound for fragment offset field */
-	fragoff_limit = 1 << (FF_FRAGOFF_h - FF_FRAGOFF_l + 1);
-
-	/* Verify that total size of datagram is within reasonable bounds */
-	if (dgram_size > FRAG_OFFS_UNIT * fragoff_limit)
-		return ELIMIT;
-
-	dgram.data = calloc(dgram_size, 1);
-	if (dgram.data == NULL)
-		return ENOMEM;
-
-	/* XXX What if different fragments came from different link? */
-	dgram.iplink = frag->packet.link_id;
-	dgram.size = dgram_size;
-	dgram.src = frag->packet.src;
-	dgram.dest = frag->packet.dest;
-	dgram.tos = frag->packet.tos;
-	proto = frag->packet.proto;
-
-	/* Pull together data from individual fragments */
-
-	size_t doffs = 0;
-
-	list_foreach(rdg->frags, dgram_link, reass_frag_t, cfrag) {
-		size_t cb, ce;
-
-		cb = max(doffs, cfrag->packet.offs);
-		ce = min(dgram_size, cfrag->packet.offs + cfrag->packet.size);
-
-		if (ce > cb) {
-			memcpy(dgram.data + cb,
-			    cfrag->packet.data + cb - cfrag->packet.offs,
-			    ce - cb);
-		}
-
-		if (!cfrag->packet.mf)
-			break;
-	}
-
-	rc = inet_recv_dgram_local(&dgram, proto);
-	free(dgram.data);
-	return rc;
-}
-
-/** Destroy datagram reassembly structure.
- *
- * @param rdg		Datagram reassembly structure.
- */
-static void reass_dgram_destroy(reass_dgram_t *rdg)
-{
-	while (!list_empty(&rdg->frags)) {
-		link_t *flink = list_first(&rdg->frags);
-		reass_frag_t *frag = list_get_instance(flink, reass_frag_t,
-		    dgram_link);
-
-		list_remove(&frag->dgram_link);
-		free(frag->packet.data);
-		free(frag);
-	}
-
-	free(rdg);
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/reass.h
===================================================================
--- uspace/srv/net/inetsrv/reass.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INET_REASS_H_
-#define INET_REASS_H_
-
-#include "inetsrv.h"
-
-extern errno_t inet_reass_queue_packet(inet_packet_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/inetsrv/sroute.c
===================================================================
--- uspace/srv/net/inetsrv/sroute.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,412 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#include <bitops.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <ipc/loc.h>
-#include <sif.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include "sroute.h"
-#include "inetsrv.h"
-#include "inet_link.h"
-
-static FIBRIL_MUTEX_INITIALIZE(sroute_list_lock);
-static LIST_INITIALIZE(sroute_list);
-static sysarg_t sroute_id = 0;
-
-inet_sroute_t *inet_sroute_new(void)
-{
-	inet_sroute_t *sroute = calloc(1, sizeof(inet_sroute_t));
-
-	if (sroute == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating static route object. "
-		    "Out of memory.");
-		return NULL;
-	}
-
-	link_initialize(&sroute->sroute_list);
-	fibril_mutex_lock(&sroute_list_lock);
-	sroute->id = ++sroute_id;
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	return sroute;
-}
-
-void inet_sroute_delete(inet_sroute_t *sroute)
-{
-	if (sroute->name != NULL)
-		free(sroute->name);
-	free(sroute);
-}
-
-void inet_sroute_add(inet_sroute_t *sroute)
-{
-	fibril_mutex_lock(&sroute_list_lock);
-	list_append(&sroute->sroute_list, &sroute_list);
-	fibril_mutex_unlock(&sroute_list_lock);
-}
-
-void inet_sroute_remove(inet_sroute_t *sroute)
-{
-	fibril_mutex_lock(&sroute_list_lock);
-	list_remove(&sroute->sroute_list);
-	fibril_mutex_unlock(&sroute_list_lock);
-}
-
-/** Find static route object matching address @a addr.
- *
- * @param addr	Address
- */
-inet_sroute_t *inet_sroute_find(inet_addr_t *addr)
-{
-	ip_ver_t addr_ver = inet_addr_get(addr, NULL, NULL);
-
-	inet_sroute_t *best = NULL;
-	uint8_t best_bits = 0;
-
-	fibril_mutex_lock(&sroute_list_lock);
-
-	list_foreach(sroute_list, sroute_list, inet_sroute_t, sroute) {
-		uint8_t dest_bits;
-		ip_ver_t dest_ver = inet_naddr_get(&sroute->dest, NULL, NULL,
-		    &dest_bits);
-
-		/* Skip comparison with different address family */
-		if (addr_ver != dest_ver)
-			continue;
-
-		/* Look for the most specific route */
-		if ((best != NULL) && (best_bits >= dest_bits))
-			continue;
-
-		if (inet_naddr_compare_mask(&sroute->dest, addr)) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: found candidate %p",
-			    sroute);
-
-			best = sroute;
-			best_bits = dest_bits;
-		}
-	}
-
-	if (best == NULL)
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find: Not found");
-
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	return best;
-}
-
-/** Find static route with a specific name.
- *
- * @param name	Address object name
- * @return	Address object
- */
-inet_sroute_t *inet_sroute_find_by_name(const char *name)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find_by_name('%s')",
-	    name);
-
-	fibril_mutex_lock(&sroute_list_lock);
-
-	list_foreach(sroute_list, sroute_list, inet_sroute_t, sroute) {
-		if (str_cmp(sroute->name, name) == 0) {
-			fibril_mutex_unlock(&sroute_list_lock);
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find_by_name: found %p",
-			    sroute);
-			return sroute;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_find_by_name: Not found");
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	return NULL;
-}
-
-/** Find static route with the given ID.
- *
- * @param id	Address object ID
- * @return	Address object
- */
-inet_sroute_t *inet_sroute_get_by_id(sysarg_t id)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_get_by_id(%zu)", (size_t)id);
-
-	fibril_mutex_lock(&sroute_list_lock);
-
-	list_foreach(sroute_list, sroute_list, inet_sroute_t, sroute) {
-		if (sroute->id == id) {
-			fibril_mutex_unlock(&sroute_list_lock);
-			return sroute;
-		}
-	}
-
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	return NULL;
-}
-
-/** Get IDs of all static routes. */
-errno_t inet_sroute_get_id_list(sysarg_t **rid_list, size_t *rcount)
-{
-	sysarg_t *id_list;
-	size_t count, i;
-
-	fibril_mutex_lock(&sroute_list_lock);
-	count = list_count(&sroute_list);
-
-	id_list = calloc(count, sizeof(sysarg_t));
-	if (id_list == NULL) {
-		fibril_mutex_unlock(&sroute_list_lock);
-		return ENOMEM;
-	}
-
-	i = 0;
-	list_foreach(sroute_list, sroute_list, inet_sroute_t, sroute) {
-		id_list[i++] = sroute->id;
-	}
-
-	fibril_mutex_unlock(&sroute_list_lock);
-
-	*rid_list = id_list;
-	*rcount = count;
-
-	return EOK;
-}
-
-/** Load static route from SIF node.
- *
- * @param nroute SIF node to load static route from
- * @return EOK on success or an error code
- */
-static errno_t inet_sroute_load(sif_node_t *nroute)
-{
-	errno_t rc;
-	const char *sid;
-	const char *sdest;
-	const char *srouter;
-	const char *name;
-	char *endptr;
-	int id;
-	inet_naddr_t dest;
-	inet_addr_t router;
-	inet_sroute_t *sroute;
-
-	sid = sif_node_get_attr(nroute, "id");
-	if (sid == NULL)
-		return EIO;
-
-	sdest = sif_node_get_attr(nroute, "dest");
-	if (sdest == NULL)
-		return EIO;
-
-	srouter = sif_node_get_attr(nroute, "router");
-	if (srouter == NULL)
-		return EIO;
-
-	name = sif_node_get_attr(nroute, "name");
-	if (name == NULL)
-		return EIO;
-
-	id = strtoul(sid, &endptr, 10);
-	if (*endptr != '\0')
-		return EIO;
-
-	rc = inet_naddr_parse(sdest, &dest, NULL);
-	if (rc != EOK)
-		return EIO;
-
-	rc = inet_addr_parse(srouter, &router, NULL);
-	if (rc != EOK)
-		return EIO;
-
-	sroute = inet_sroute_new();
-	if (sroute == NULL)
-		return ENOMEM;
-
-	sroute->id = id;
-	sroute->dest = dest;
-	sroute->router = router;
-	sroute->name = str_dup(name);
-
-	if (sroute->name == NULL) {
-		inet_sroute_delete(sroute);
-		return ENOMEM;
-	}
-
-	inet_sroute_add(sroute);
-	return EOK;
-}
-
-/** Load static routes from SIF node.
- *
- * @param nroutes SIF node to load static routes from
- * @return EOK on success or an error code
- */
-errno_t inet_sroutes_load(sif_node_t *nroutes)
-{
-	sif_node_t *nroute;
-	const char *ntype;
-	errno_t rc;
-
-	nroute = sif_node_first_child(nroutes);
-	while (nroute != NULL) {
-		ntype = sif_node_get_type(nroute);
-		if (str_cmp(ntype, "route") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = inet_sroute_load(nroute);
-		if (rc != EOK)
-			goto error;
-
-		nroute = sif_node_next_child(nroute);
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Save static route to SIF node.
- *
- * @param sroute Static route
- * @param nroute SIF node to save static route to
- * @return EOK on success or an error code
- */
-static errno_t inet_sroute_save(inet_sroute_t *sroute, sif_node_t *nroute)
-{
-	char *str = NULL;
-	errno_t rc;
-	int rv;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroute_save(%p, %p)",
-	    sroute, nroute);
-
-	/* id */
-
-	rv = asprintf(&str, "%zu", sroute->id);
-	if (rv < 0) {
-		str = NULL;
-		rc = ENOMEM;
-		goto error;
-	}
-
-	rc = sif_node_set_attr(nroute, "id", str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	str = NULL;
-
-	/* dest */
-
-	rc = inet_naddr_format(&sroute->dest, &str);
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_node_set_attr(nroute, "dest", str);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-	str = NULL;
-
-	/* router */
-
-	rc = inet_addr_format(&sroute->router, &str);
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_node_set_attr(nroute, "router", str);
-	if (rc != EOK)
-		goto error;
-
-	/* name */
-
-	rc = sif_node_set_attr(nroute, "name", sroute->name);
-	if (rc != EOK)
-		goto error;
-
-	free(str);
-
-	return rc;
-error:
-	if (str != NULL)
-		free(str);
-	return rc;
-}
-
-/** Save static routes to SIF node.
- *
- * @param nroutes SIF node to save static routes to
- * @return EOK on success or an error code
- */
-errno_t inet_sroutes_save(sif_node_t *nroutes)
-{
-	sif_node_t *nroute;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "inet_sroutes_save()");
-
-	fibril_mutex_lock(&sroute_list_lock);
-
-	list_foreach(sroute_list, sroute_list, inet_sroute_t, sroute) {
-		if (sroute->temp == false) {
-			rc = sif_node_append_child(nroutes, "route", &nroute);
-			if (rc != EOK)
-				goto error;
-
-			rc = inet_sroute_save(sroute, nroute);
-			if (rc != EOK)
-				goto error;
-		}
-	}
-
-	fibril_mutex_unlock(&sroute_list_lock);
-	return EOK;
-error:
-	fibril_mutex_unlock(&sroute_list_lock);
-	return rc;
-}
-
-/** @}
- */
Index: pace/srv/net/inetsrv/sroute.h
===================================================================
--- uspace/srv/net/inetsrv/sroute.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup inet
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef INET_SROUTE_H_
-#define INET_SROUTE_H_
-
-#include <sif.h>
-#include <stddef.h>
-#include <stdint.h>
-#include "inetsrv.h"
-
-extern inet_sroute_t *inet_sroute_new(void);
-extern void inet_sroute_delete(inet_sroute_t *);
-extern void inet_sroute_add(inet_sroute_t *);
-extern void inet_sroute_remove(inet_sroute_t *);
-extern inet_sroute_t *inet_sroute_find(inet_addr_t *);
-extern inet_sroute_t *inet_sroute_find_by_name(const char *);
-extern inet_sroute_t *inet_sroute_get_by_id(sysarg_t);
-extern errno_t inet_sroute_send_dgram(inet_sroute_t *, inet_addr_t *,
-    inet_dgram_t *, uint8_t, uint8_t, int);
-extern errno_t inet_sroute_get_id_list(sysarg_t **, size_t *);
-extern errno_t inet_sroutes_load(sif_node_t *);
-extern errno_t inet_sroutes_save(sif_node_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/loopip/loopip.c
===================================================================
--- uspace/srv/net/loopip/loopip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,285 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup loopip
- * @{
- */
-/**
- * @file
- * @brief Loopback IP link provider
- */
-
-#include <adt/prodcons.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inet/iplink_srv.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <task.h>
-
-#define NAME  "loopip"
-
-static errno_t loopip_open(iplink_srv_t *srv);
-static errno_t loopip_close(iplink_srv_t *srv);
-static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu);
-static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);
-static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu);
-static errno_t loopip_get_mac48(iplink_srv_t *srv, eth_addr_t *mac);
-static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr);
-static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr);
-
-static void loopip_client_conn(ipc_call_t *icall, void *arg);
-
-static iplink_ops_t loopip_iplink_ops = {
-	.open = loopip_open,
-	.close = loopip_close,
-	.send = loopip_send,
-	.send6 = loopip_send6,
-	.get_mtu = loopip_get_mtu,
-	.get_mac48 = loopip_get_mac48,
-	.addr_add = loopip_addr_add,
-	.addr_remove = loopip_addr_remove
-};
-
-static iplink_srv_t loopip_iplink;
-static prodcons_t loopip_rcv_queue;
-
-typedef struct {
-	link_t link;
-
-	/* XXX Version should be part of SDU */
-	ip_ver_t ver;
-	iplink_recv_sdu_t sdu;
-} rqueue_entry_t;
-
-static errno_t loopip_recv_fibril(void *arg)
-{
-	while (true) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_recv_fibril(): Wait for one item");
-		link_t *link = prodcons_consume(&loopip_rcv_queue);
-		rqueue_entry_t *rqe =
-		    list_get_instance(link, rqueue_entry_t, link);
-
-		(void) iplink_ev_recv(&loopip_iplink, &rqe->sdu, rqe->ver);
-
-		free(rqe->sdu.data);
-		free(rqe);
-	}
-
-	return 0;
-}
-
-static errno_t loopip_init(void)
-{
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(loopip_client_conn, NULL);
-
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
-		return rc;
-	}
-
-	iplink_srv_init(&loopip_iplink);
-	loopip_iplink.ops = &loopip_iplink_ops;
-	loopip_iplink.arg = NULL;
-
-	prodcons_initialize(&loopip_rcv_queue);
-
-	const char *svc_name = "net/loopback";
-	service_id_t sid;
-	rc = loc_service_register(srv, svc_name, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service %s.",
-		    svc_name);
-		return rc;
-	}
-
-	category_id_t iplink_cat;
-	rc = loc_category_get_id("iplink", &iplink_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		loc_service_unregister(srv, sid);
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'iplink'.");
-		return rc;
-	}
-
-	rc = loc_service_add_to_cat(srv, sid, iplink_cat);
-	if (rc != EOK) {
-		loc_service_unregister(srv, sid);
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding %s to category.",
-		    svc_name);
-		return rc;
-	}
-
-	fid_t fid = fibril_create(loopip_recv_fibril, NULL);
-	if (fid == 0) {
-		loc_service_unregister(srv, sid);
-		loc_server_unregister(srv);
-		return ENOMEM;
-	}
-
-	fibril_add_ready(fid);
-
-	return EOK;
-}
-
-static void loopip_client_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_client_conn()");
-	iplink_conn(icall, &loopip_iplink);
-}
-
-static errno_t loopip_open(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_open()");
-	return EOK;
-}
-
-static errno_t loopip_close(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_close()");
-	return EOK;
-}
-
-static errno_t loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()");
-
-	rqueue_entry_t *rqe = calloc(1, sizeof(rqueue_entry_t));
-	if (rqe == NULL)
-		return ENOMEM;
-
-	/*
-	 * Clone SDU
-	 */
-	rqe->ver = ip_v4;
-	rqe->sdu.data = malloc(sdu->size);
-	if (rqe->sdu.data == NULL) {
-		free(rqe);
-		return ENOMEM;
-	}
-
-	memcpy(rqe->sdu.data, sdu->data, sdu->size);
-	rqe->sdu.size = sdu->size;
-
-	/*
-	 * Insert to receive queue
-	 */
-	prodcons_produce(&loopip_rcv_queue, &rqe->link);
-
-	return EOK;
-}
-
-static errno_t loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip6_send()");
-
-	rqueue_entry_t *rqe = calloc(1, sizeof(rqueue_entry_t));
-	if (rqe == NULL)
-		return ENOMEM;
-
-	/*
-	 * Clone SDU
-	 */
-	rqe->ver = ip_v6;
-	rqe->sdu.data = malloc(sdu->size);
-	if (rqe->sdu.data == NULL) {
-		free(rqe);
-		return ENOMEM;
-	}
-
-	memcpy(rqe->sdu.data, sdu->data, sdu->size);
-	rqe->sdu.size = sdu->size;
-
-	/*
-	 * Insert to receive queue
-	 */
-	prodcons_produce(&loopip_rcv_queue, &rqe->link);
-
-	return EOK;
-}
-
-static errno_t loopip_get_mtu(iplink_srv_t *srv, size_t *mtu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mtu()");
-	*mtu = 1500;
-	return EOK;
-}
-
-static errno_t loopip_get_mac48(iplink_srv_t *src, eth_addr_t *mac)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()");
-	return ENOTSUP;
-}
-
-static errno_t loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	return EOK;
-}
-
-static errno_t loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	printf("%s: HelenOS loopback IP link provider\n", NAME);
-
-	errno_t rc = log_init(NAME);
-	if (rc != EOK) {
-		printf("%s: Failed to initialize logging: %s.\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = loopip_init();
-	if (rc != EOK) {
-		printf("%s: Failed to initialize loopip: %s.\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections.\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/loopip/meson.build
===================================================================
--- uspace/srv/net/loopip/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2021 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'inet' ]
-src = files('loopip.c')
Index: pace/srv/net/slip/meson.build
===================================================================
--- uspace/srv/net/slip/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2012 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'drv' ]
-src = files('slip.c')
Index: pace/srv/net/slip/slip.c
===================================================================
--- uspace/srv/net/slip/slip.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,455 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * Copyright (c) 2013 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup slip
- * @{
- */
-/**
- * @file
- * @brief IP over serial line IP link provider.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <loc.h>
-#include <inet/addr.h>
-#include <inet/eth_addr.h>
-#include <inet/iplink_srv.h>
-#include <io/chardev.h>
-#include <io/log.h>
-#include <errno.h>
-#include <str_error.h>
-#include <task.h>
-
-#define NAME		"slip"
-#define CAT_IPLINK	"iplink"
-
-#define SLIP_MTU	1006	/* as per RFC 1055 */
-
-#define SLIP_END	0300
-#define SLIP_ESC	0333
-#define SLIP_ESC_END	0334
-#define SLIP_ESC_ESC	0335
-
-static errno_t slip_open(iplink_srv_t *);
-static errno_t slip_close(iplink_srv_t *);
-static errno_t slip_send(iplink_srv_t *, iplink_sdu_t *);
-static errno_t slip_send6(iplink_srv_t *, iplink_sdu6_t *);
-static errno_t slip_get_mtu(iplink_srv_t *, size_t *);
-static errno_t slip_get_mac48(iplink_srv_t *, eth_addr_t *);
-static errno_t slip_addr_add(iplink_srv_t *, inet_addr_t *);
-static errno_t slip_addr_remove(iplink_srv_t *, inet_addr_t *);
-
-static iplink_srv_t slip_iplink;
-
-static iplink_ops_t slip_iplink_ops = {
-	.open = slip_open,
-	.close = slip_close,
-	.send = slip_send,
-	.send6 = slip_send6,
-	.get_mtu = slip_get_mtu,
-	.get_mac48 = slip_get_mac48,
-	.addr_add = slip_addr_add,
-	.addr_remove = slip_addr_remove
-};
-
-static uint8_t slip_send_buf[SLIP_MTU + 2];
-static size_t slip_send_pending;
-
-static uint8_t slip_recv_buf[SLIP_MTU + 2];
-static size_t slip_recv_pending;
-static size_t slip_recv_read;
-
-errno_t slip_open(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_open()");
-	return EOK;
-}
-
-errno_t slip_close(iplink_srv_t *srv)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_close()");
-	return EOK;
-}
-
-static void write_flush(chardev_t *chardev)
-{
-	size_t written = 0;
-
-	while (slip_send_pending > 0) {
-		errno_t rc;
-		size_t nwr;
-
-		rc = chardev_write(chardev, &slip_send_buf[written],
-		    slip_send_pending, &nwr);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "chardev_write() -> %s", str_error_name(rc));
-			slip_send_pending = 0;
-			break;
-		}
-		written += nwr;
-		slip_send_pending -= nwr;
-	}
-}
-
-static void write_buffered(chardev_t *chardev, uint8_t ch)
-{
-	if (slip_send_pending == sizeof(slip_send_buf))
-		write_flush(chardev);
-	slip_send_buf[slip_send_pending++] = ch;
-}
-
-errno_t slip_send(iplink_srv_t *srv, iplink_sdu_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_send()");
-
-	chardev_t *chardev = (chardev_t *) srv->arg;
-	uint8_t *data = sdu->data;
-
-	/*
-	 * Strictly speaking, this is not prescribed by the RFC, but the RFC
-	 * suggests to start with sending a SLIP_END byte as a synchronization
-	 * measure for dealing with previous possible noise on the line.
-	 */
-	write_buffered(chardev, SLIP_END);
-
-	for (size_t i = 0; i < sdu->size; i++) {
-		switch (data[i]) {
-		case SLIP_END:
-			write_buffered(chardev, SLIP_ESC);
-			write_buffered(chardev, SLIP_ESC_END);
-			break;
-		case SLIP_ESC:
-			write_buffered(chardev, SLIP_ESC);
-			write_buffered(chardev, SLIP_ESC_ESC);
-			break;
-		default:
-			write_buffered(chardev, data[i]);
-			break;
-		}
-	}
-
-	write_buffered(chardev, SLIP_END);
-	write_flush(chardev);
-
-	return EOK;
-}
-
-errno_t slip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_send6()");
-
-	return ENOTSUP;
-}
-
-errno_t slip_get_mtu(iplink_srv_t *srv, size_t *mtu)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_get_mtu()");
-	*mtu = SLIP_MTU;
-	return EOK;
-}
-
-errno_t slip_get_mac48(iplink_srv_t *src, eth_addr_t *mac)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_get_mac48()");
-	return ENOTSUP;
-}
-
-errno_t slip_addr_add(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_addr_add()");
-	return EOK;
-}
-
-errno_t slip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_addr_remove()");
-	return EOK;
-}
-
-static void usage(void)
-{
-	printf("Usage: " NAME " <service-name> <link-name>\n");
-}
-
-static void slip_client_conn(ipc_call_t *icall, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "slip_client_conn()");
-	iplink_conn(icall, &slip_iplink);
-}
-
-static uint8_t read_buffered(chardev_t *chardev)
-{
-	while (slip_recv_pending == 0) {
-		errno_t rc;
-		size_t nread;
-
-		rc = chardev_read(chardev, slip_recv_buf,
-		    sizeof(slip_recv_buf), &nread, chardev_f_none);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "char_dev_read() -> %s", str_error_name(rc));
-		}
-
-		if (nread == 0)
-			return SLIP_END;
-
-		slip_recv_pending = nread;
-		slip_recv_read = 0;
-	}
-	slip_recv_pending--;
-	return slip_recv_buf[slip_recv_read++];
-}
-
-static errno_t slip_recv_fibril(void *arg)
-{
-	chardev_t *chardev = (chardev_t *) arg;
-	static uint8_t recv_final[SLIP_MTU];
-	iplink_recv_sdu_t sdu;
-	uint8_t ch;
-	errno_t rc;
-
-	sdu.data = recv_final;
-
-	while (true) {
-		sdu.size = 0;
-		while (sdu.size < sizeof(recv_final)) {
-			ch = read_buffered(chardev);
-			switch (ch) {
-			case SLIP_END:
-				if (sdu.size == 0) {
-					/*
-					 * Discard the empty SLIP datagram.
-					 */
-					break;
-				}
-				goto pass;
-
-			case SLIP_ESC:
-				ch = read_buffered(chardev);
-				if (ch == SLIP_ESC_END) {
-					recv_final[sdu.size++] = SLIP_END;
-					break;
-				} else if (ch == SLIP_ESC_ESC) {
-					recv_final[sdu.size++] = SLIP_ESC;
-					break;
-				}
-
-				/*
-				 * The RFC suggests to simply insert the wrongly
-				 * escaped character into the packet so we fall
-				 * through.
-				 */
-				/* Fallthrough */
-
-			default:
-				recv_final[sdu.size++] = ch;
-				break;
-			}
-
-		}
-
-		/*
-		 * We have reached the limit of our MTU. Regardless of whether
-		 * the datagram is properly ended with SLIP_END, pass it along.
-		 * If the next character is really SLIP_END, nothing
-		 * catastrophic happens. The algorithm will just see an
-		 * artificially empty SLIP datagram and life will go on.
-		 */
-
-	pass:
-		rc = iplink_ev_recv(&slip_iplink, &sdu, ip_v4);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR,
-			    "iplink_ev_recv() -> %s", str_error_name(rc));
-		}
-	}
-
-	return 0;
-}
-
-static errno_t slip_init(const char *svcstr, const char *linkstr)
-{
-	service_id_t svcid;
-	service_id_t linksid;
-	category_id_t iplinkcid;
-	async_sess_t *sess_in = NULL;
-	async_sess_t *sess_out = NULL;
-	chardev_t *chardev_in = NULL;
-	chardev_t *chardev_out = NULL;
-	fid_t fid;
-	loc_srv_t *srv;
-	errno_t rc;
-
-	iplink_srv_init(&slip_iplink);
-	slip_iplink.ops = &slip_iplink_ops;
-
-	async_set_fallback_port_handler(slip_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed registering server.");
-		return rc;
-	}
-
-	rc = loc_service_get_id(svcstr, &svcid, 0);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed getting ID for service %s", svcstr);
-		return rc;
-	}
-
-	rc = loc_category_get_id(CAT_IPLINK, &iplinkcid, 0);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to get category ID for %s",
-		    CAT_IPLINK);
-		return rc;
-	}
-
-	/*
-	 * Create two sessions to allow to both read and write from the
-	 * char_dev at the same time.
-	 */
-	sess_out = loc_service_connect(svcid, INTERFACE_DDF, 0);
-	if (!sess_out) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to connect to service %s (ID=%d)",
-		    svcstr, (int) svcid);
-		return ENOENT;
-	}
-
-	rc = chardev_open(sess_out, &chardev_out);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed opening character device.");
-		return ENOENT;
-	}
-
-	slip_iplink.arg = chardev_out;
-
-	sess_in = loc_service_connect(svcid, INTERFACE_DDF, 0);
-	if (!sess_in) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to connect to service %s (ID=%d)",
-		    svcstr, (int) svcid);
-		rc = ENOENT;
-		goto fail;
-	}
-
-	rc = chardev_open(sess_in, &chardev_in);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed opening character device.");
-		return ENOENT;
-	}
-
-	rc = loc_service_register(srv, linkstr, &linksid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to register service %s",
-		    linkstr);
-		goto fail;
-	}
-
-	rc = loc_service_add_to_cat(srv, linksid, iplinkcid);
-	if (rc != EOK) {
-		loc_service_unregister(srv, linksid);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to add service %d (%s) to category %d (%s).",
-		    (int) linksid, linkstr, (int) iplinkcid, CAT_IPLINK);
-		goto fail;
-	}
-
-	fid = fibril_create(slip_recv_fibril, chardev_in);
-	if (!fid) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to create receive fibril.");
-		rc = ENOENT;
-		goto fail;
-	}
-	fibril_add_ready(fid);
-
-	return EOK;
-
-fail:
-	loc_server_unregister(srv);
-	chardev_close(chardev_out);
-	if (sess_out)
-		async_hangup(sess_out);
-	chardev_close(chardev_in);
-	if (sess_in)
-		async_hangup(sess_in);
-
-	/*
-	 * We assume that our registration at the location service will be
-	 * cleaned up automatically as the service (i.e. this task) terminates.
-	 */
-
-	return rc;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf(NAME ": IP over serial line service\n");
-
-	if (argc != 3) {
-		usage();
-		return EINVAL;
-	}
-
-	rc = log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": failed to initialize log\n");
-		return rc;
-	}
-
-	rc = slip_init(argv[1], argv[2]);
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	/* not reached */
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/net/tcp/conn.c
===================================================================
--- uspace/srv/net/tcp/conn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1481 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP connection processing and state machine
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <macros.h>
-#include <nettl/amap.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include "conn.h"
-#include "inet.h"
-#include "iqueue.h"
-#include "pdu.h"
-#include "rqueue.h"
-#include "segment.h"
-#include "seq_no.h"
-#include "tcp_type.h"
-#include "tqueue.h"
-#include "ucall.h"
-
-#define RCV_BUF_SIZE 4096/*2*/
-#define SND_BUF_SIZE 4096
-
-#define MAX_SEGMENT_LIFETIME	(15*1000*1000) //(2*60*1000*1000)
-#define TIME_WAIT_TIMEOUT	(2*MAX_SEGMENT_LIFETIME)
-
-/** List of all allocated connections */
-static LIST_INITIALIZE(conn_list);
-/** Taken after tcp_conn_t lock */
-static FIBRIL_MUTEX_INITIALIZE(conn_list_lock);
-/** Connection association map */
-static amap_t *amap;
-/** Taken after tcp_conn_t lock */
-static FIBRIL_MUTEX_INITIALIZE(amap_lock);
-
-/** Internal loopback configuration */
-tcp_lb_t tcp_conn_lb = tcp_lb_none;
-
-static void tcp_conn_seg_process(tcp_conn_t *, tcp_segment_t *);
-static void tcp_conn_tw_timer_set(tcp_conn_t *);
-static void tcp_conn_tw_timer_clear(tcp_conn_t *);
-static void tcp_transmit_segment(inet_ep2_t *, tcp_segment_t *);
-static void tcp_conn_trim_seg_to_wnd(tcp_conn_t *, tcp_segment_t *);
-static void tcp_reply_rst(inet_ep2_t *, tcp_segment_t *);
-
-static tcp_tqueue_cb_t tcp_conn_tqueue_cb = {
-	.transmit_seg = tcp_transmit_segment
-};
-
-/** Initialize connections. */
-errno_t tcp_conns_init(void)
-{
-	errno_t rc;
-
-	rc = amap_create(&amap);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		return ENOMEM;
-	}
-
-	return EOK;
-}
-
-/** Finalize connections. */
-void tcp_conns_fini(void)
-{
-	assert(list_empty(&conn_list));
-
-	amap_destroy(amap);
-	amap = NULL;
-}
-
-/** Create new connection structure.
- *
- * @param epp		Endpoint pair (will be deeply copied)
- * @return		New connection or NULL
- */
-tcp_conn_t *tcp_conn_new(inet_ep2_t *epp)
-{
-	tcp_conn_t *conn = NULL;
-	bool tqueue_inited = false;
-
-	/* Allocate connection structure */
-	conn = calloc(1, sizeof(tcp_conn_t));
-	if (conn == NULL)
-		goto error;
-
-	fibril_mutex_initialize(&conn->lock);
-
-	conn->tw_timer = fibril_timer_create(&conn->lock);
-	if (conn->tw_timer == NULL)
-		goto error;
-
-	/* One for the user, one for not being in closed state */
-	refcount_init(&conn->refcnt);
-	refcount_up(&conn->refcnt);
-
-	/* Allocate receive buffer */
-	fibril_condvar_initialize(&conn->rcv_buf_cv);
-	conn->rcv_buf_size = RCV_BUF_SIZE;
-	conn->rcv_buf_used = 0;
-	conn->rcv_buf_fin = false;
-
-	conn->rcv_buf = calloc(1, conn->rcv_buf_size);
-	if (conn->rcv_buf == NULL)
-		goto error;
-
-	/** Allocate send buffer */
-	fibril_condvar_initialize(&conn->snd_buf_cv);
-	conn->snd_buf_size = SND_BUF_SIZE;
-	conn->snd_buf_used = 0;
-	conn->snd_buf_fin = false;
-	conn->snd_buf = calloc(1, conn->snd_buf_size);
-	if (conn->snd_buf == NULL)
-		goto error;
-
-	/* Set up receive window. */
-	conn->rcv_wnd = conn->rcv_buf_size;
-
-	/* Initialize incoming segment queue */
-	tcp_iqueue_init(&conn->incoming, conn);
-
-	/* Initialize retransmission queue */
-	if (tcp_tqueue_init(&conn->retransmit, conn, &tcp_conn_tqueue_cb) !=
-	    EOK) {
-		goto error;
-	}
-
-	tqueue_inited = true;
-
-	/* Connection state change signalling */
-	fibril_condvar_initialize(&conn->cstate_cv);
-
-	conn->cb = NULL;
-
-	conn->cstate = st_listen;
-	conn->reset = false;
-	conn->deleted = false;
-	conn->ap = ap_passive;
-	conn->fin_is_acked = false;
-	if (epp != NULL)
-		conn->ident = *epp;
-
-	fibril_mutex_lock(&conn_list_lock);
-	list_append(&conn->link, &conn_list);
-	fibril_mutex_unlock(&conn_list_lock);
-
-	return conn;
-
-error:
-	if (tqueue_inited)
-		tcp_tqueue_fini(&conn->retransmit);
-	if (conn != NULL && conn->rcv_buf != NULL)
-		free(conn->rcv_buf);
-	if (conn != NULL && conn->snd_buf != NULL)
-		free(conn->snd_buf);
-	if (conn != NULL && conn->tw_timer != NULL)
-		fibril_timer_destroy(conn->tw_timer);
-	if (conn != NULL)
-		free(conn);
-
-	return NULL;
-}
-
-/** Destroy connection structure.
- *
- * Connection structure should be destroyed when the folowing condtitions
- * are met:
- * (1) user has deleted the connection
- * (2) the connection has entered closed state
- * (3) nobody is holding references to the connection
- *
- * This happens when @a conn->refcnt is zero as we count (1) and (2)
- * as special references.
- *
- * @param conn		Connection
- */
-static void tcp_conn_free(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_free(%p)", conn->name, conn);
-
-	assert(conn->mapped == false);
-	tcp_tqueue_fini(&conn->retransmit);
-
-	fibril_mutex_lock(&conn_list_lock);
-	list_remove(&conn->link);
-	fibril_mutex_unlock(&conn_list_lock);
-
-	if (conn->rcv_buf != NULL)
-		free(conn->rcv_buf);
-	if (conn->snd_buf != NULL)
-		free(conn->snd_buf);
-	if (conn->tw_timer != NULL)
-		fibril_timer_destroy(conn->tw_timer);
-	free(conn);
-}
-
-/** Add reference to connection.
- *
- * Increase connection reference count by one.
- *
- * @param conn		Connection
- */
-void tcp_conn_addref(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_addref(%p)",
-	    conn->name, conn);
-
-	refcount_up(&conn->refcnt);
-}
-
-/** Remove reference from connection.
- *
- * Decrease connection reference count by one.
- *
- * @param conn		Connection
- */
-void tcp_conn_delref(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_delref(%p)",
-	    conn->name, conn);
-
-	if (refcount_down(&conn->refcnt))
-		tcp_conn_free(conn);
-}
-
-/** Lock connection.
- *
- * Must be called before any other connection-manipulating function,
- * except tcp_conn_{add|del}ref(). Locks the connection including
- * its timers. Must not be called inside any of the connection
- * timer handlers.
- *
- * @param conn		Connection
- */
-void tcp_conn_lock(tcp_conn_t *conn)
-{
-	fibril_mutex_lock(&conn->lock);
-}
-
-/** Unlock connection.
- *
- * @param conn		Connection
- */
-void tcp_conn_unlock(tcp_conn_t *conn)
-{
-	fibril_mutex_unlock(&conn->lock);
-}
-
-/** Delete connection.
- *
- * The caller promises not make no further references to @a conn.
- * TCP will free @a conn eventually.
- *
- * @param conn		Connection
- */
-void tcp_conn_delete(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_delete(%p)", conn->name, conn);
-
-	assert(conn->deleted == false);
-	conn->deleted = true;
-	conn->cb = NULL;
-	conn->cb_arg = NULL;
-	tcp_conn_delref(conn);
-}
-
-/** Enlist connection.
- *
- * Add connection to the connection map.
- */
-errno_t tcp_conn_add(tcp_conn_t *conn)
-{
-	inet_ep2_t aepp;
-	errno_t rc;
-
-	tcp_conn_addref(conn);
-	fibril_mutex_lock(&amap_lock);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_add: conn=%p", conn);
-
-	rc = amap_insert(amap, &conn->ident, conn, af_allow_system, &aepp);
-	if (rc != EOK) {
-		tcp_conn_delref(conn);
-		fibril_mutex_unlock(&amap_lock);
-		return rc;
-	}
-
-	conn->ident = aepp;
-	conn->mapped = true;
-	fibril_mutex_unlock(&amap_lock);
-
-	return EOK;
-}
-
-/** Delist connection.
- *
- * Remove connection from the connection map.
- */
-static void tcp_conn_remove(tcp_conn_t *conn)
-{
-	if (!conn->mapped)
-		return;
-
-	fibril_mutex_lock(&amap_lock);
-	amap_remove(amap, &conn->ident);
-	conn->mapped = false;
-	fibril_mutex_unlock(&amap_lock);
-	tcp_conn_delref(conn);
-}
-
-static void tcp_conn_state_set(tcp_conn_t *conn, tcp_cstate_t nstate)
-{
-	tcp_cstate_t old_state;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_state_set(%p)", conn);
-
-	old_state = conn->cstate;
-	conn->cstate = nstate;
-	fibril_condvar_broadcast(&conn->cstate_cv);
-
-	/* Run user callback function */
-	if (conn->cb != NULL && conn->cb->cstate_change != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_state_set() - run user CB");
-		conn->cb->cstate_change(conn, conn->cb_arg, old_state);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_state_set() - no user CB");
-	}
-
-	assert(old_state != st_closed);
-	if (nstate == st_closed) {
-		tcp_conn_remove(conn);
-		/* Drop one reference for now being in closed state */
-		tcp_conn_delref(conn);
-	}
-}
-
-/** Synchronize connection.
- *
- * This is the first step of an active connection attempt,
- * sends out SYN and sets up ISS and SND.xxx.
- */
-void tcp_conn_sync(tcp_conn_t *conn)
-{
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	/* XXX select ISS */
-	conn->iss = 1;
-	conn->snd_nxt = conn->iss;
-	conn->snd_una = conn->iss;
-	conn->ap = ap_active;
-
-	tcp_tqueue_ctrl_seg(conn, CTL_SYN);
-	tcp_conn_state_set(conn, st_syn_sent);
-}
-
-/** FIN has been sent.
- *
- * This function should be called when FIN is sent over the connection,
- * as a result the connection state is changed appropriately.
- */
-void tcp_conn_fin_sent(tcp_conn_t *conn)
-{
-	switch (conn->cstate) {
-	case st_syn_received:
-	case st_established:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN sent -> Fin-Wait-1", conn->name);
-		tcp_conn_state_set(conn, st_fin_wait_1);
-		break;
-	case st_close_wait:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN sent -> Last-Ack", conn->name);
-		tcp_conn_state_set(conn, st_last_ack);
-		break;
-	default:
-		log_msg(LOG_DEFAULT, LVL_ERROR, "%s: Connection state %d", conn->name,
-		    conn->cstate);
-		assert(false);
-	}
-
-	conn->fin_is_acked = false;
-}
-
-/** Find connection structure for specified endpoint pair.
- *
- * A connection is uniquely identified by a endpoint pair. Look up our
- * connection map and return connection structure based on endpoint pair.
- * The connection reference count is bumped by one.
- *
- * @param epp	Endpoint pair
- * @return	Connection structure or NULL if not found.
- */
-tcp_conn_t *tcp_conn_find_ref(inet_ep2_t *epp)
-{
-	errno_t rc;
-	void *arg;
-	tcp_conn_t *conn;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_find_ref(%p)", epp);
-
-	fibril_mutex_lock(&amap_lock);
-
-	rc = amap_find_match(amap, epp, &arg);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		fibril_mutex_unlock(&amap_lock);
-		return NULL;
-	}
-
-	conn = (tcp_conn_t *)arg;
-	tcp_conn_addref(conn);
-
-	fibril_mutex_unlock(&amap_lock);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_find_ref: got conn=%p",
-	    conn);
-	return conn;
-}
-
-/** Reset connection.
- *
- * @param conn	Connection
- */
-void tcp_conn_reset(tcp_conn_t *conn)
-{
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_reset()", conn->name);
-
-	if (conn->cstate == st_closed)
-		return;
-
-	conn->reset = true;
-	tcp_conn_state_set(conn, st_closed);
-
-	tcp_conn_tw_timer_clear(conn);
-	tcp_tqueue_clear(&conn->retransmit);
-
-	fibril_condvar_broadcast(&conn->rcv_buf_cv);
-	fibril_condvar_broadcast(&conn->snd_buf_cv);
-}
-
-/** Signal to the user that connection has been reset.
- *
- * Send an out-of-band signal to the user.
- */
-static void tcp_reset_signal(tcp_conn_t *conn)
-{
-	/* TODO */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_reset_signal()", conn->name);
-}
-
-/** Determine if SYN has been received.
- *
- * @param conn	Connection
- * @return	@c true if SYN has been received, @c false otherwise.
- */
-bool tcp_conn_got_syn(tcp_conn_t *conn)
-{
-	switch (conn->cstate) {
-	case st_listen:
-	case st_syn_sent:
-		return false;
-	case st_syn_received:
-	case st_established:
-	case st_fin_wait_1:
-	case st_fin_wait_2:
-	case st_close_wait:
-	case st_closing:
-	case st_last_ack:
-	case st_time_wait:
-		return true;
-	case st_closed:
-		log_msg(LOG_DEFAULT, LVL_WARN, "state=%d", (int) conn->cstate);
-		assert(false);
-	}
-
-	assert(false);
-}
-
-/** Segment arrived in Listen state.
- *
- * @param conn		Connection
- * @param seg		Segment
- */
-static void tcp_conn_sa_listen(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_sa_listen(%p, %p)", conn, seg);
-
-	if ((seg->ctrl & CTL_RST) != 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Ignoring incoming RST.");
-		return;
-	}
-
-	if ((seg->ctrl & CTL_ACK) != 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Incoming ACK, send acceptable RST.");
-		tcp_reply_rst(&conn->ident, seg);
-		return;
-	}
-
-	if ((seg->ctrl & CTL_SYN) == 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "SYN not present. Ignoring segment.");
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Got SYN, sending SYN, ACK.");
-
-	conn->rcv_nxt = seg->seq + 1;
-	conn->irs = seg->seq;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "rcv_nxt=%u", conn->rcv_nxt);
-
-	if (seg->len > 1)
-		log_msg(LOG_DEFAULT, LVL_WARN, "SYN combined with data, ignoring data.");
-
-	/* XXX select ISS */
-	conn->iss = 1;
-	conn->snd_nxt = conn->iss;
-	conn->snd_una = conn->iss;
-
-	/*
-	 * Surprisingly the spec does not deal with initial window setting.
-	 * Set SND.WND = SEG.WND and set SND.WL1 so that next segment
-	 * will always be accepted as new window setting.
-	 */
-	conn->snd_wnd = seg->wnd;
-	conn->snd_wl1 = seg->seq;
-	conn->snd_wl2 = seg->seq;
-
-	tcp_conn_state_set(conn, st_syn_received);
-
-	tcp_tqueue_ctrl_seg(conn, CTL_SYN | CTL_ACK /* XXX */);
-
-	tcp_segment_delete(seg);
-}
-
-/** Segment arrived in Syn-Sent state.
- *
- * @param conn		Connection
- * @param seg		Segment
- */
-static void tcp_conn_sa_syn_sent(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_sa_syn_sent(%p, %p)", conn, seg);
-
-	if ((seg->ctrl & CTL_ACK) != 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "snd_una=%u, seg.ack=%u, snd_nxt=%u",
-		    conn->snd_una, seg->ack, conn->snd_nxt);
-		if (!seq_no_ack_acceptable(conn, seg->ack)) {
-			if ((seg->ctrl & CTL_RST) == 0) {
-				log_msg(LOG_DEFAULT, LVL_WARN, "ACK not acceptable, send RST");
-				tcp_reply_rst(&conn->ident, seg);
-			} else {
-				log_msg(LOG_DEFAULT, LVL_WARN, "RST,ACK not acceptable, drop");
-			}
-			return;
-		}
-	}
-
-	if ((seg->ctrl & CTL_RST) != 0) {
-		/* If we get here, we have either an acceptable ACK or no ACK */
-		if ((seg->ctrl & CTL_ACK) != 0) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: Connection reset. -> Closed",
-			    conn->name);
-			/* Reset connection */
-			tcp_conn_reset(conn);
-			return;
-		} else {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: RST without ACK, drop",
-			    conn->name);
-			return;
-		}
-	}
-
-	/* XXX precedence */
-
-	if ((seg->ctrl & CTL_SYN) == 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "No SYN bit, ignoring segment.");
-		return;
-	}
-
-	conn->rcv_nxt = seg->seq + 1;
-	conn->irs = seg->seq;
-
-	if ((seg->ctrl & CTL_ACK) != 0) {
-		conn->snd_una = seg->ack;
-
-		/*
-		 * Prune acked segments from retransmission queue and
-		 * possibly transmit more data.
-		 */
-		tcp_tqueue_ack_received(conn);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Sent SYN, got SYN.");
-
-	/*
-	 * Surprisingly the spec does not deal with initial window setting.
-	 * Set SND.WND = SEG.WND and set SND.WL1 so that next segment
-	 * will always be accepted as new window setting.
-	 */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "SND.WND := %" PRIu32 ", SND.WL1 := %" PRIu32 ", "
-	    "SND.WL2 = %" PRIu32, seg->wnd, seg->seq, seg->seq);
-	conn->snd_wnd = seg->wnd;
-	conn->snd_wl1 = seg->seq;
-	conn->snd_wl2 = seg->seq;
-
-	if (seq_no_syn_acked(conn)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: syn acked -> Established", conn->name);
-		tcp_conn_state_set(conn, st_established);
-		tcp_tqueue_ctrl_seg(conn, CTL_ACK /* XXX */);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: syn not acked -> Syn-Received",
-		    conn->name);
-		tcp_conn_state_set(conn, st_syn_received);
-		tcp_tqueue_ctrl_seg(conn, CTL_SYN | CTL_ACK /* XXX */);
-	}
-
-	tcp_segment_delete(seg);
-}
-
-/** Segment arrived in state where segments are processed in sequence order.
- *
- * Queue segment in incoming segments queue for processing.
- *
- * @param conn		Connection
- * @param seg		Segment
- */
-static void tcp_conn_sa_queue(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	tcp_segment_t *pseg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_sa_seq(%p, %p)", conn, seg);
-
-	/* Discard unacceptable segments ("old duplicates") */
-	if (!seq_no_segment_acceptable(conn, seg)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Replying ACK to unacceptable segment.");
-		tcp_tqueue_ctrl_seg(conn, CTL_ACK);
-		tcp_segment_delete(seg);
-		return;
-	}
-
-	/* Queue for processing */
-	tcp_iqueue_insert_seg(&conn->incoming, seg);
-
-	/*
-	 * Process all segments from incoming queue that are ready.
-	 * Unacceptable segments are discarded by tcp_iqueue_get_ready_seg().
-	 *
-	 * XXX Need to return ACK for unacceptable segments
-	 */
-	while (tcp_iqueue_get_ready_seg(&conn->incoming, &pseg) == EOK)
-		tcp_conn_seg_process(conn, pseg);
-}
-
-/** Process segment RST field.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_rst(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if ((seg->ctrl & CTL_RST) == 0)
-		return cp_continue;
-
-	switch (conn->cstate) {
-	case st_syn_received:
-		/* XXX In case of passive open, revert to Listen state */
-		if (conn->ap == ap_passive) {
-			tcp_conn_state_set(conn, st_listen);
-			/* XXX Revert conn->ident */
-			tcp_conn_tw_timer_clear(conn);
-			tcp_tqueue_clear(&conn->retransmit);
-		} else {
-			tcp_conn_reset(conn);
-		}
-		break;
-	case st_established:
-	case st_fin_wait_1:
-	case st_fin_wait_2:
-	case st_close_wait:
-		/* General "connection reset" signal */
-		tcp_reset_signal(conn);
-		tcp_conn_reset(conn);
-		break;
-	case st_closing:
-	case st_last_ack:
-	case st_time_wait:
-		tcp_conn_reset(conn);
-		break;
-	case st_listen:
-	case st_syn_sent:
-	case st_closed:
-		assert(false);
-	}
-
-	return cp_done;
-}
-
-/** Process segment security and precedence fields.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_sp(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	/* TODO */
-	return cp_continue;
-}
-
-/** Process segment SYN field.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_syn(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if ((seg->ctrl & CTL_SYN) == 0)
-		return cp_continue;
-
-	/*
-	 * Assert SYN is in receive window, otherwise this step should not
-	 * be reached.
-	 */
-	assert(seq_no_in_rcv_wnd(conn, seg->seq));
-
-	log_msg(LOG_DEFAULT, LVL_WARN, "SYN is in receive window, should send reset. XXX");
-
-	/*
-	 * TODO
-	 *
-	 * Send a reset, resond "reset" to all outstanding RECEIVEs and SEND,
-	 * flush segment queues. Send unsolicited "connection reset" signal
-	 * to user, connection -> closed state, delete TCB, return.
-	 */
-	return cp_done;
-}
-
-/** Process segment ACK field in Syn-Received state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_sr(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if (!seq_no_ack_acceptable(conn, seg->ack)) {
-		/* ACK is not acceptable, send RST. */
-		log_msg(LOG_DEFAULT, LVL_WARN, "Segment ACK not acceptable, sending RST.");
-		tcp_reply_rst(&conn->ident, seg);
-		tcp_segment_delete(seg);
-		return cp_done;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: SYN ACKed -> Established", conn->name);
-
-	tcp_conn_state_set(conn, st_established);
-
-	/* XXX Not mentioned in spec?! */
-	conn->snd_una = seg->ack;
-
-	return cp_continue;
-}
-
-/** Process segment ACK field in Established state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_est(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_seg_proc_ack_est(%p, %p)", conn, seg);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.ACK=%u, SND.UNA=%u, SND.NXT=%u",
-	    (unsigned)seg->ack, (unsigned)conn->snd_una,
-	    (unsigned)conn->snd_nxt);
-
-	if (!seq_no_ack_acceptable(conn, seg->ack)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "ACK not acceptable.");
-		if (!seq_no_ack_duplicate(conn, seg->ack)) {
-			log_msg(LOG_DEFAULT, LVL_WARN, "Not acceptable, not duplicate. "
-			    "Send ACK and drop.");
-			/* Not acceptable, not duplicate. Send ACK and drop. */
-			tcp_tqueue_ctrl_seg(conn, CTL_ACK);
-			tcp_segment_delete(seg);
-			return cp_done;
-		} else {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Ignoring duplicate ACK.");
-		}
-	} else {
-		/* Update SND.UNA */
-		conn->snd_una = seg->ack;
-	}
-
-	if (seq_no_new_wnd_update(conn, seg)) {
-		conn->snd_wnd = seg->wnd;
-		conn->snd_wl1 = seg->seq;
-		conn->snd_wl2 = seg->ack;
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Updating send window, SND.WND=%" PRIu32
-		    ", SND.WL1=%" PRIu32 ", SND.WL2=%" PRIu32,
-		    conn->snd_wnd, conn->snd_wl1, conn->snd_wl2);
-	}
-
-	/*
-	 * Prune acked segments from retransmission queue and
-	 * possibly transmit more data.
-	 */
-	tcp_tqueue_ack_received(conn);
-
-	return cp_continue;
-}
-
-/** Process segment ACK field in Fin-Wait-1 state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_fw1(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if (tcp_conn_seg_proc_ack_est(conn, seg) == cp_done)
-		return cp_done;
-
-	if (conn->fin_is_acked) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN acked -> Fin-Wait-2", conn->name);
-		tcp_conn_state_set(conn, st_fin_wait_2);
-	}
-
-	return cp_continue;
-}
-
-/** Process segment ACK field in Fin-Wait-2 state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_fw2(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if (tcp_conn_seg_proc_ack_est(conn, seg) == cp_done)
-		return cp_done;
-
-	/* TODO */
-	return cp_continue;
-}
-
-/** Process segment ACK field in Close-Wait state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_cw(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	/* The same processing as in Established state */
-	return tcp_conn_seg_proc_ack_est(conn, seg);
-}
-
-/** Process segment ACK field in Closing state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_cls(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if (tcp_conn_seg_proc_ack_est(conn, seg) == cp_done)
-		return cp_done;
-
-	if (conn->fin_is_acked) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN acked -> Time-Wait",
-		    conn->name);
-		tcp_conn_state_set(conn, st_time_wait);
-	}
-
-	return cp_continue;
-}
-
-/** Process segment ACK field in Last-Ack state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_la(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	if (tcp_conn_seg_proc_ack_est(conn, seg) == cp_done)
-		return cp_done;
-
-	if (conn->fin_is_acked) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN acked -> Closed", conn->name);
-		tcp_conn_state_set(conn, st_closed);
-		return cp_done;
-	}
-
-	return cp_continue;
-}
-
-/** Process segment ACK field in Time-Wait state.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack_tw(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	/* Nothing to do */
-	return cp_continue;
-}
-
-/** Process segment ACK field.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_ack(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_seg_proc_ack(%p, %p)",
-	    conn->name, conn, seg);
-
-	if ((seg->ctrl & CTL_ACK) == 0) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Segment has no ACK. Dropping.");
-		tcp_segment_delete(seg);
-		return cp_done;
-	}
-
-	switch (conn->cstate) {
-	case st_syn_received:
-		return tcp_conn_seg_proc_ack_sr(conn, seg);
-	case st_established:
-		return tcp_conn_seg_proc_ack_est(conn, seg);
-	case st_fin_wait_1:
-		return tcp_conn_seg_proc_ack_fw1(conn, seg);
-	case st_fin_wait_2:
-		return tcp_conn_seg_proc_ack_fw2(conn, seg);
-	case st_close_wait:
-		return tcp_conn_seg_proc_ack_cw(conn, seg);
-	case st_closing:
-		return tcp_conn_seg_proc_ack_cls(conn, seg);
-	case st_last_ack:
-		return tcp_conn_seg_proc_ack_la(conn, seg);
-	case st_time_wait:
-		return tcp_conn_seg_proc_ack_tw(conn, seg);
-	case st_listen:
-	case st_syn_sent:
-	case st_closed:
-		assert(false);
-	}
-
-	assert(false);
-}
-
-/** Process segment URG field.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_urg(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	return cp_continue;
-}
-
-/** Process segment text.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_text(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	size_t text_size;
-	size_t xfer_size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_seg_proc_text(%p, %p)",
-	    conn->name, conn, seg);
-
-	switch (conn->cstate) {
-	case st_established:
-	case st_fin_wait_1:
-	case st_fin_wait_2:
-		/* OK */
-		break;
-	case st_close_wait:
-	case st_closing:
-	case st_last_ack:
-	case st_time_wait:
-		/* Invalid since FIN has been received. Ignore text. */
-		return cp_continue;
-	case st_listen:
-	case st_syn_sent:
-	case st_syn_received:
-	case st_closed:
-		assert(false);
-	}
-
-	/*
-	 * Process segment text
-	 */
-	assert(seq_no_segment_ready(conn, seg));
-
-	/* Trim anything outside our receive window */
-	tcp_conn_trim_seg_to_wnd(conn, seg);
-
-	/* Determine how many bytes to copy */
-	text_size = tcp_segment_text_size(seg);
-	xfer_size = min(text_size, conn->rcv_buf_size - conn->rcv_buf_used);
-
-	/* Copy data to receive buffer */
-	tcp_segment_text_copy(seg, conn->rcv_buf + conn->rcv_buf_used,
-	    xfer_size);
-	conn->rcv_buf_used += xfer_size;
-
-	/* Signal to the receive function that new data has arrived */
-	if (xfer_size > 0) {
-		fibril_condvar_broadcast(&conn->rcv_buf_cv);
-		if (conn->cb != NULL && conn->cb->recv_data != NULL)
-			conn->cb->recv_data(conn, conn->cb_arg);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Received %zu bytes of data.", xfer_size);
-
-	/* Advance RCV.NXT */
-	conn->rcv_nxt += xfer_size;
-
-	/* Update receive window. XXX Not an efficient strategy. */
-	conn->rcv_wnd -= xfer_size;
-
-	/* Send ACK */
-	if (xfer_size > 0)
-		tcp_tqueue_ctrl_seg(conn, CTL_ACK);
-
-	if (xfer_size < seg->len) {
-		/* Trim part of segment which we just received */
-		tcp_conn_trim_seg_to_wnd(conn, seg);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: Nothing left in segment, dropping "
-		    "(xfer_size=%zu, SEG.LEN=%" PRIu32 ", seg->ctrl=%u)",
-		    conn->name, xfer_size, seg->len, (unsigned int) seg->ctrl);
-		/* Nothing left in segment */
-		tcp_segment_delete(seg);
-		return cp_done;
-	}
-
-	return cp_continue;
-}
-
-/** Process segment FIN field.
- *
- * @param conn		Connection
- * @param seg		Segment
- * @return		cp_done if we are done with this segment, cp_continue
- *			if not
- */
-static cproc_t tcp_conn_seg_proc_fin(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_seg_proc_fin(%p, %p)",
-	    conn->name, conn, seg);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, " seg->len=%zu, seg->ctl=%u", (size_t) seg->len,
-	    (unsigned) seg->ctrl);
-
-	/* Only process FIN if no text is left in segment. */
-	if (tcp_segment_text_size(seg) == 0 && (seg->ctrl & CTL_FIN) != 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, " - FIN found in segment.");
-
-		conn->rcv_nxt++;
-		conn->rcv_wnd--;
-
-		/* Send ACK */
-		tcp_tqueue_ctrl_seg(conn, CTL_ACK);
-
-		/* Change connection state */
-		switch (conn->cstate) {
-		case st_listen:
-		case st_syn_sent:
-		case st_closed:
-			/* Connection not synchronized */
-			assert(false);
-			/* Fallthrough */
-		case st_syn_received:
-		case st_established:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN received -> Close-Wait",
-			    conn->name);
-			tcp_conn_state_set(conn, st_close_wait);
-			break;
-		case st_fin_wait_1:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN received -> Closing",
-			    conn->name);
-			tcp_conn_state_set(conn, st_closing);
-			break;
-		case st_fin_wait_2:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: FIN received -> Time-Wait",
-			    conn->name);
-			tcp_conn_state_set(conn, st_time_wait);
-			/* Start the Time-Wait timer */
-			tcp_conn_tw_timer_set(conn);
-			break;
-		case st_close_wait:
-		case st_closing:
-		case st_last_ack:
-			/* Do nothing */
-			break;
-		case st_time_wait:
-			/* Restart the Time-Wait timer */
-			tcp_conn_tw_timer_set(conn);
-			break;
-		}
-
-		/* Add FIN to the receive buffer */
-		conn->rcv_buf_fin = true;
-		fibril_condvar_broadcast(&conn->rcv_buf_cv);
-		if (conn->cb != NULL && conn->cb->recv_data != NULL)
-			conn->cb->recv_data(conn, conn->cb_arg);
-
-		tcp_segment_delete(seg);
-		return cp_done;
-	}
-
-	return cp_continue;
-}
-
-/** Process incoming segment.
- *
- * We are in connection state where segments are processed in order
- * of sequence number. This processes one segment taken from the
- * connection incoming segments queue.
- *
- * @param conn		Connection
- * @param seg		Segment
- */
-static void tcp_conn_seg_process(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_seg_process(%p, %p)", conn, seg);
-	tcp_segment_dump(seg);
-
-	if (tcp_conn_seg_proc_rst(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_sp(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_syn(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_ack(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_urg(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_text(conn, seg) == cp_done)
-		return;
-
-	if (tcp_conn_seg_proc_fin(conn, seg) == cp_done)
-		return;
-
-	/*
-	 * If anything is left from the segment, insert it back into the
-	 * incoming segments queue.
-	 */
-	if (seg->len > 0) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Re-insert segment %p. seg->len=%zu",
-		    seg, (size_t) seg->len);
-		tcp_iqueue_insert_seg(&conn->incoming, seg);
-	} else {
-		tcp_segment_delete(seg);
-	}
-}
-
-/** Segment arrived on a connection.
- *
- * @param conn		Connection
- * @param epp		Endpoint pair on which segment was received
- * @param seg		Segment
- */
-void tcp_conn_segment_arrived(tcp_conn_t *conn, inet_ep2_t *epp,
-    tcp_segment_t *seg)
-{
-	inet_ep2_t aepp;
-	inet_ep2_t oldepp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_segment_arrived(%p)",
-	    conn->name, seg);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Connection is closed.");
-		tcp_unexpected_segment(epp, seg);
-		tcp_conn_unlock(conn);
-		return;
-	}
-
-	if (inet_addr_is_any(&conn->ident.remote.addr) ||
-	    conn->ident.remote.port == inet_port_any ||
-	    inet_addr_is_any(&conn->ident.local.addr)) {
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_segment_arrived: "
-		    "Changing connection ID, updating amap.");
-		oldepp = conn->ident;
-
-		/* Need to remove and re-insert connection with new identity */
-		fibril_mutex_lock(&amap_lock);
-
-		if (inet_addr_is_any(&conn->ident.remote.addr))
-			conn->ident.remote.addr = epp->remote.addr;
-
-		if (conn->ident.remote.port == inet_port_any)
-			conn->ident.remote.port = epp->remote.port;
-
-		if (inet_addr_is_any(&conn->ident.local.addr))
-			conn->ident.local.addr = epp->local.addr;
-
-		rc = amap_insert(amap, &conn->ident, conn, af_allow_system, &aepp);
-		if (rc != EOK) {
-			assert(rc != EEXIST);
-			assert(rc == ENOMEM);
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-			fibril_mutex_unlock(&amap_lock);
-			tcp_conn_unlock(conn);
-			return;
-		}
-
-		amap_remove(amap, &oldepp);
-		fibril_mutex_unlock(&amap_lock);
-
-		conn->name = (char *) "a";
-	}
-
-	switch (conn->cstate) {
-	case st_listen:
-		tcp_conn_sa_listen(conn, seg);
-		break;
-	case st_syn_sent:
-		tcp_conn_sa_syn_sent(conn, seg);
-		break;
-	case st_syn_received:
-	case st_established:
-	case st_fin_wait_1:
-	case st_fin_wait_2:
-	case st_close_wait:
-	case st_closing:
-	case st_last_ack:
-	case st_time_wait:
-		/* Process segments in order of sequence number */
-		tcp_conn_sa_queue(conn, seg);
-		break;
-	case st_closed:
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "state=%d", (int) conn->cstate);
-		assert(false);
-	}
-
-	tcp_conn_unlock(conn);
-}
-
-/** Time-Wait timeout handler.
- *
- * @param arg	Connection
- */
-static void tw_timeout_func(void *arg)
-{
-	tcp_conn_t *conn = (tcp_conn_t *) arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p)", conn);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed.");
-		tcp_conn_unlock(conn);
-		tcp_conn_delref(conn);
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: TW Timeout -> Closed", conn->name);
-	tcp_conn_state_set(conn, st_closed);
-
-	tcp_conn_unlock(conn);
-	tcp_conn_delref(conn);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tw_timeout_func(%p) end", conn);
-}
-
-/** Start or restart the Time-Wait timeout.
- *
- * @param conn		Connection
- */
-void tcp_conn_tw_timer_set(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_set() begin");
-	tcp_conn_addref(conn);
-	fibril_timer_set_locked(conn->tw_timer, TIME_WAIT_TIMEOUT,
-	    tw_timeout_func, (void *)conn);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_set() end");
-}
-
-/** Clear the Time-Wait timeout.
- *
- * @param conn		Connection
- */
-void tcp_conn_tw_timer_clear(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() begin");
-	if (fibril_timer_clear_locked(conn->tw_timer) == fts_active)
-		tcp_conn_delref(conn);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_conn_tw_timer_clear() end");
-}
-
-/** Trim segment to the receive window.
- *
- * @param conn		Connection
- * @param seg		Segment
- */
-static void tcp_conn_trim_seg_to_wnd(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	uint32_t left, right;
-
-	seq_no_seg_trim_calc(conn, seg, &left, &right);
-	tcp_segment_trim(seg, left, right);
-}
-
-/** Handle unexpected segment received on an endpoint pair.
- *
- * We reply with an RST unless the received segment has RST.
- *
- * @param sp		Endpoint pair which received the segment
- * @param seg		Unexpected segment
- */
-void tcp_unexpected_segment(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_unexpected_segment(%p, %p)", epp,
-	    seg);
-
-	if ((seg->ctrl & CTL_RST) == 0)
-		tcp_reply_rst(epp, seg);
-}
-
-/** Transmit segment over network.
- *
- * @param epp Endpoint pair with source and destination information
- * @param seg Segment (ownership retained by caller)
- */
-static void tcp_transmit_segment(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	tcp_pdu_t *pdu;
-	tcp_segment_t *dseg;
-	inet_ep2_t rident;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "tcp_transmit_segment(l:(%u),f:(%u), %p)",
-	    epp->local.port, epp->remote.port, seg);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.SEQ=%" PRIu32 ", SEG.WND=%" PRIu32,
-	    seg->seq, seg->wnd);
-
-	tcp_segment_dump(seg);
-
-	if (tcp_conn_lb == tcp_lb_segment) {
-		/* Loop back segment */
-#if 0
-		tcp_ncsim_bounce_seg(sp, seg);
-#endif
-
-		/* Reverse the identification */
-		tcp_ep2_flipped(epp, &rident);
-
-		/* Insert segment back into rqueue */
-		dseg = tcp_segment_dup(seg);
-		tcp_rqueue_insert_seg(&rident, dseg);
-		return;
-	}
-
-	if (tcp_pdu_encode(epp, seg, &pdu) != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped.");
-		return;
-	}
-
-	if (tcp_conn_lb == tcp_lb_pdu) {
-		/* Loop back PDU */
-		if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) {
-			log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped.");
-			tcp_pdu_delete(pdu);
-			return;
-		}
-
-		tcp_pdu_delete(pdu);
-
-		/* Insert decoded segment into rqueue */
-		tcp_rqueue_insert_seg(&rident, dseg);
-		return;
-	}
-
-	tcp_transmit_pdu(pdu);
-	tcp_pdu_delete(pdu);
-}
-
-/** Compute flipped endpoint pair for response.
- *
- * Flipped endpoint pair has local and remote endpoints exchanged.
- *
- * @param epp		Endpoint pair
- * @param fepp		Place to store flipped endpoint pair
- */
-void tcp_ep2_flipped(inet_ep2_t *epp, inet_ep2_t *fepp)
-{
-	fepp->local = epp->remote;
-	fepp->remote = epp->local;
-}
-
-/** Send RST in response to an incoming segment.
- *
- * @param epp		Endpoint pair which received the segment
- * @param seg		Incoming segment
- */
-static void tcp_reply_rst(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	tcp_segment_t *rseg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_reply_rst(%p, %p)", epp, seg);
-
-	rseg = tcp_segment_make_rst(seg);
-	tcp_transmit_segment(epp, rseg);
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/conn.h
===================================================================
--- uspace/srv/net/tcp/conn.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP connection processing and state machine
- */
-
-#ifndef CONN_H
-#define CONN_H
-
-#include <inet/endpoint.h>
-#include <stdbool.h>
-#include "tcp_type.h"
-
-extern errno_t tcp_conns_init(void);
-extern void tcp_conns_fini(void);
-extern tcp_conn_t *tcp_conn_new(inet_ep2_t *);
-extern void tcp_conn_delete(tcp_conn_t *);
-extern errno_t tcp_conn_add(tcp_conn_t *);
-extern void tcp_conn_reset(tcp_conn_t *conn);
-extern void tcp_conn_sync(tcp_conn_t *);
-extern void tcp_conn_fin_sent(tcp_conn_t *);
-extern tcp_conn_t *tcp_conn_find_ref(inet_ep2_t *);
-extern void tcp_conn_addref(tcp_conn_t *);
-extern void tcp_conn_delref(tcp_conn_t *);
-extern void tcp_conn_lock(tcp_conn_t *);
-extern void tcp_conn_unlock(tcp_conn_t *);
-extern bool tcp_conn_got_syn(tcp_conn_t *);
-extern void tcp_conn_segment_arrived(tcp_conn_t *, inet_ep2_t *,
-    tcp_segment_t *);
-extern void tcp_unexpected_segment(inet_ep2_t *, tcp_segment_t *);
-extern void tcp_ep2_flipped(inet_ep2_t *, inet_ep2_t *);
-
-extern tcp_lb_t tcp_conn_lb;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/inet.c
===================================================================
--- uspace/srv/net/tcp/inet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,189 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP inet interfacing
- */
-
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <inet/inet.h>
-#include <mem.h>
-#include <io/log.h>
-#include <stdlib.h>
-
-#include "inet.h"
-#include "pdu.h"
-#include "rqueue.h"
-#include "std.h"
-
-#define NAME       "tcp"
-
-static errno_t tcp_inet_ev_recv(inet_dgram_t *dgram);
-static void tcp_received_pdu(tcp_pdu_t *pdu);
-
-static inet_ev_ops_t tcp_inet_ev_ops = {
-	.recv = tcp_inet_ev_recv
-};
-
-/** Received datagram callback */
-static errno_t tcp_inet_ev_recv(inet_dgram_t *dgram)
-{
-	uint8_t *pdu_raw;
-	size_t pdu_raw_size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv()");
-
-	pdu_raw = dgram->data;
-	pdu_raw_size = dgram->size;
-
-	/* Split into header and payload. */
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv() - split header/payload");
-
-	tcp_pdu_t *pdu;
-	size_t hdr_size;
-	tcp_header_t *hdr;
-	uint32_t data_offset;
-
-	if (pdu_raw_size < sizeof(tcp_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < sizeof(tcp_header_t) = %zu",
-		    pdu_raw_size, sizeof(tcp_header_t));
-		return EINVAL;
-	}
-
-	hdr = (tcp_header_t *)pdu_raw;
-	data_offset = BIT_RANGE_EXTRACT(uint32_t, DF_DATA_OFFSET_h, DF_DATA_OFFSET_l,
-	    uint16_t_be2host(hdr->doff_flags));
-
-	hdr_size = sizeof(uint32_t) * data_offset;
-
-	if (pdu_raw_size < hdr_size) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < hdr_size = %zu",
-		    pdu_raw_size, hdr_size);
-		return EINVAL;
-	}
-
-	if (hdr_size < sizeof(tcp_header_t)) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "hdr_size = %zu < sizeof(tcp_header_t) = %zu",
-		    hdr_size, sizeof(tcp_header_t));
-		return EINVAL;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "pdu_raw_size=%zu, hdr_size=%zu",
-	    pdu_raw_size, hdr_size);
-	pdu = tcp_pdu_create(pdu_raw, hdr_size, pdu_raw + hdr_size,
-	    pdu_raw_size - hdr_size);
-	if (pdu == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Failed creating PDU. Dropped.");
-		return ENOMEM;
-	}
-
-	pdu->src = dgram->src;
-	pdu->dest = dgram->dest;
-
-	tcp_received_pdu(pdu);
-	tcp_pdu_delete(pdu);
-
-	return EOK;
-}
-
-/** Transmit PDU over network layer. */
-void tcp_transmit_pdu(tcp_pdu_t *pdu)
-{
-	errno_t rc;
-	uint8_t *pdu_raw;
-	size_t pdu_raw_size;
-	inet_dgram_t dgram;
-
-	pdu_raw_size = pdu->header_size + pdu->text_size;
-	pdu_raw = malloc(pdu_raw_size);
-	if (pdu_raw == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to transmit PDU. Out of memory.");
-		return;
-	}
-
-	memcpy(pdu_raw, pdu->header, pdu->header_size);
-	memcpy(pdu_raw + pdu->header_size, pdu->text,
-	    pdu->text_size);
-
-	dgram.iplink = 0;
-	dgram.src = pdu->src;
-	dgram.dest = pdu->dest;
-	dgram.tos = 0;
-	dgram.data = pdu_raw;
-	dgram.size = pdu_raw_size;
-
-	rc = inet_send(&dgram, INET_TTL_MAX, 0);
-	if (rc != EOK)
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to transmit PDU.");
-
-	free(pdu_raw);
-}
-
-/** Process received PDU. */
-static void tcp_received_pdu(tcp_pdu_t *pdu)
-{
-	tcp_segment_t *dseg;
-	inet_ep2_t rident;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_received_pdu()");
-
-	if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. PDU dropped.");
-		return;
-	}
-
-	/* Insert decoded segment into rqueue */
-	tcp_rqueue_insert_seg(&rident, dseg);
-}
-
-/** Initialize TCP inet interface. */
-errno_t tcp_inet_init(void)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_inet_init()");
-
-	rc = inet_init(IP_PROTO_TCP, &tcp_inet_ev_ops);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting to internet service.");
-		return ENOENT;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/inet.h
===================================================================
--- uspace/srv/net/tcp/inet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP inet interfacing
- */
-
-#ifndef TCP_INET_H
-#define TCP_INET_H
-
-#include "tcp_type.h"
-
-extern errno_t tcp_inet_init(void);
-extern void tcp_transmit_pdu(tcp_pdu_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/iqueue.c
===================================================================
--- uspace/srv/net/tcp/iqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,191 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Connection incoming segments queue
- *
- * Segments are sorted in order of their sequence number.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include "iqueue.h"
-#include "segment.h"
-#include "seq_no.h"
-#include "tcp_type.h"
-
-/** Initialize incoming segments queue.
- *
- * @param iqueue	Incoming queue
- * @param conn		Connection the queue is associated with
- */
-void tcp_iqueue_init(tcp_iqueue_t *iqueue, tcp_conn_t *conn)
-{
-	list_initialize(&iqueue->list);
-	iqueue->conn = conn;
-}
-
-/** Insert segment into incoming queue.
- *
- * @param iqueue	Incoming queue
- * @param seg		Segment
- */
-void tcp_iqueue_insert_seg(tcp_iqueue_t *iqueue, tcp_segment_t *seg)
-{
-	tcp_iqueue_entry_t *iqe;
-	tcp_iqueue_entry_t *qe;
-	link_t *link;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_iqueue_insert_seg()");
-
-	iqe = calloc(1, sizeof(tcp_iqueue_entry_t));
-	if (iqe == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating IQE.");
-		return;
-	}
-
-	iqe->seg = seg;
-
-	/* Sort by sequence number */
-
-	link = list_first(&iqueue->list);
-	while (link != NULL) {
-		qe = list_get_instance(link,
-		    tcp_iqueue_entry_t, link);
-
-		if (seq_no_seg_cmp(iqueue->conn, iqe->seg, qe->seg) < 0)
-			break;
-
-		link = list_next(link, &iqueue->list);
-	}
-
-	if (link != NULL)
-		list_insert_before(&iqe->link, &qe->link);
-	else
-		list_append(&iqe->link, &iqueue->list);
-}
-
-/** Remove segment from incoming queue.
- *
- * @param iqueue	Incoming queue
- * @param seg		Segment
- */
-void tcp_iqueue_remove_seg(tcp_iqueue_t *iqueue, tcp_segment_t *seg)
-{
-	tcp_iqueue_entry_t *qe;
-	link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_iqueue_remove_seg()");
-
-	link = list_first(&iqueue->list);
-	while (link != NULL) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_iqueue_remove_seg() - next");
-		qe = list_get_instance(link,
-		    tcp_iqueue_entry_t, link);
-
-		if (qe->seg == seg) {
-			log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_iqueue_remove_seg() - found, DONE");
-			list_remove(&qe->link);
-			free(qe);
-			return;
-		}
-
-		link = list_next(link, &iqueue->list);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "tcp_iqueue_remove_seg() - not found");
-	assert(false);
-}
-
-/** Get next ready segment from incoming queue.
- *
- * Return the segment with the earliest sequence number if it is ready.
- * A segment is ready if its SEG.SEQ is earlier or equal to RCV.NXT.
- *
- * @param iqueue	Incoming queue
- * @param seg		Place to store pointer to segment
- * @return		EOK on success, ENOENT if no segment is ready
- */
-errno_t tcp_iqueue_get_ready_seg(tcp_iqueue_t *iqueue, tcp_segment_t **seg)
-{
-	tcp_iqueue_entry_t *iqe;
-	link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_get_ready_seg()");
-
-	link = list_first(&iqueue->list);
-	if (link == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "iqueue is empty");
-		return ENOENT;
-	}
-
-	iqe = list_get_instance(link, tcp_iqueue_entry_t, link);
-
-	while (!seq_no_segment_acceptable(iqueue->conn, iqe->seg)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Skipping unacceptable segment (RCV.NXT=%"
-		    PRIu32 ", RCV.NXT+RCV.WND=%" PRIu32 ", SEG.SEQ=%" PRIu32
-		    ", SEG.LEN=%" PRIu32 ")", iqueue->conn->rcv_nxt,
-		    iqueue->conn->rcv_nxt + iqueue->conn->rcv_wnd,
-		    iqe->seg->seq, iqe->seg->len);
-
-		list_remove(&iqe->link);
-		tcp_segment_delete(iqe->seg);
-
-		link = list_first(&iqueue->list);
-		if (link == NULL) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "iqueue is empty");
-			return ENOENT;
-		}
-
-		iqe = list_get_instance(link, tcp_iqueue_entry_t, link);
-	}
-
-	/* Do not return segments that are not ready for processing */
-	if (!seq_no_segment_ready(iqueue->conn, iqe->seg)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Next segment not ready: SEG.SEQ=%u, "
-		    "RCV.NXT=%u, SEG.LEN=%u", iqe->seg->seq,
-		    iqueue->conn->rcv_nxt, iqe->seg->len);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Returning ready segment %p", iqe->seg);
-	list_remove(&iqe->link);
-	*seg = iqe->seg;
-	free(iqe);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/iqueue.h
===================================================================
--- uspace/srv/net/tcp/iqueue.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Connection incoming segments queue
- */
-
-#ifndef IQUEUE_H
-#define IQUEUE_H
-
-#include "tcp_type.h"
-
-extern void tcp_iqueue_init(tcp_iqueue_t *, tcp_conn_t *);
-extern void tcp_iqueue_insert_seg(tcp_iqueue_t *, tcp_segment_t *);
-extern void tcp_iqueue_remove_seg(tcp_iqueue_t *, tcp_segment_t *);
-extern errno_t tcp_iqueue_get_ready_seg(tcp_iqueue_t *, tcp_segment_t **);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/meson.build
===================================================================
--- uspace/srv/net/tcp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,63 +1,0 @@
-#
-# Copyright (c) 2011 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nettl' ]
-
-_common_src = files(
-	'conn.c',
-	'inet.c',
-	'iqueue.c',
-	'ncsim.c',
-	'pdu.c',
-	'rqueue.c',
-	'segment.c',
-	'seq_no.c',
-	'test.c',
-	'tqueue.c',
-	'ucall.c',
-)
-
-src = files(
-	'service.c',
-	'tcp.c',
-)
-
-test_src = files(
-	'test/conn.c',
-	'test/iqueue.c',
-	'test/main.c',
-	'test/pdu.c',
-	'test/rqueue.c',
-	'test/segment.c',
-	'test/seq_no.c',
-	'test/tqueue.c',
-	'test/ucall.c',
-)
-
-src = [ _common_src, src ]
-test_src = [ _common_src, test_src ]
Index: pace/srv/net/tcp/ncsim.c
===================================================================
--- uspace/srv/net/tcp/ncsim.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Network condition simulator
- *
- * Simulate network conditions for testing the reliability implementation:
- *    - variable latency
- *    - frame drop
- */
-
-#include <adt/list.h>
-#include <async.h>
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <stdlib.h>
-#include <fibril.h>
-#include "conn.h"
-#include "ncsim.h"
-#include "rqueue.h"
-#include "segment.h"
-#include "tcp_type.h"
-
-static list_t sim_queue;
-static fibril_mutex_t sim_queue_lock;
-static fibril_condvar_t sim_queue_cv;
-
-/** Initialize segment receive queue. */
-void tcp_ncsim_init(void)
-{
-	list_initialize(&sim_queue);
-	fibril_mutex_initialize(&sim_queue_lock);
-	fibril_condvar_initialize(&sim_queue_cv);
-}
-
-/** Bounce segment through simulator into receive queue.
- *
- * @param epp	Endpoint pair, oriented for transmission
- * @param seg	Segment
- */
-void tcp_ncsim_bounce_seg(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	tcp_squeue_entry_t *sqe;
-	tcp_squeue_entry_t *old_qe;
-	inet_ep2_t rident;
-	link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ncsim_bounce_seg()");
-	tcp_ep2_flipped(epp, &rident);
-	tcp_rqueue_insert_seg(&rident, seg);
-	return;
-
-	if (0 /* rand() % 4 == 3 */) {
-		/* Drop segment */
-		log_msg(LOG_DEFAULT, LVL_ERROR, "NCSim dropping segment");
-		tcp_segment_delete(seg);
-		return;
-	}
-
-	sqe = calloc(1, sizeof(tcp_squeue_entry_t));
-	if (sqe == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating SQE.");
-		return;
-	}
-
-	sqe->delay = rand() % (1000 * 1000);
-	sqe->epp = *epp;
-	sqe->seg = seg;
-
-	fibril_mutex_lock(&sim_queue_lock);
-
-	link = list_first(&sim_queue);
-	while (link != NULL && sqe->delay > 0) {
-		old_qe = list_get_instance(link, tcp_squeue_entry_t, link);
-		if (sqe->delay < old_qe->delay)
-			break;
-
-		sqe->delay -= old_qe->delay;
-
-		link = link->next;
-		if (link == &sim_queue.head)
-			link = NULL;
-	}
-
-	if (link != NULL)
-		list_insert_after(&sqe->link, link);
-	else
-		list_append(&sqe->link, &sim_queue);
-
-	fibril_condvar_broadcast(&sim_queue_cv);
-	fibril_mutex_unlock(&sim_queue_lock);
-}
-
-/** Network condition simulator handler fibril. */
-static errno_t tcp_ncsim_fibril(void *arg)
-{
-	link_t *link;
-	tcp_squeue_entry_t *sqe;
-	inet_ep2_t rident;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ncsim_fibril()");
-
-	while (true) {
-		fibril_mutex_lock(&sim_queue_lock);
-
-		while (list_empty(&sim_queue))
-			fibril_condvar_wait(&sim_queue_cv, &sim_queue_lock);
-
-		do {
-			link = list_first(&sim_queue);
-			sqe = list_get_instance(link, tcp_squeue_entry_t, link);
-
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "NCSim - Sleep");
-			rc = fibril_condvar_wait_timeout(&sim_queue_cv,
-			    &sim_queue_lock, sqe->delay);
-		} while (rc != ETIMEOUT);
-
-		list_remove(link);
-		fibril_mutex_unlock(&sim_queue_lock);
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "NCSim - End Sleep");
-		tcp_ep2_flipped(&sqe->epp, &rident);
-		tcp_rqueue_insert_seg(&rident, sqe->seg);
-		free(sqe);
-	}
-
-	/* Not reached */
-	return 0;
-}
-
-/** Start simulator handler fibril. */
-void tcp_ncsim_fibril_start(void)
-{
-	fid_t fid;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ncsim_fibril_start()");
-
-	fid = fibril_create(tcp_ncsim_fibril, NULL);
-	if (fid == 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating ncsim fibril.");
-		return;
-	}
-
-	fibril_add_ready(fid);
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/ncsim.h
===================================================================
--- uspace/srv/net/tcp/ncsim.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Network condition simulator
- */
-
-#ifndef NCSIM_H
-#define NCSIM_H
-
-#include <inet/endpoint.h>
-#include "tcp_type.h"
-
-extern void tcp_ncsim_init(void);
-extern void tcp_ncsim_bounce_seg(inet_ep2_t *, tcp_segment_t *);
-extern void tcp_ncsim_fibril_start(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/pdu.c
===================================================================
--- uspace/srv/net/tcp/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,361 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP header encoding and decoding
- */
-
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "pdu.h"
-#include "segment.h"
-#include "seq_no.h"
-#include "std.h"
-#include "tcp_type.h"
-
-#define TCP_CHECKSUM_INIT 0xffff
-
-/** One's complement addition.
- *
- * Result is a + b + carry.
- */
-static uint16_t tcp_ocadd16(uint16_t a, uint16_t b)
-{
-	uint32_t s;
-
-	s = (uint32_t)a + (uint32_t)b;
-	return (s & 0xffff) + (s >> 16);
-}
-
-static uint16_t tcp_checksum_calc(uint16_t ivalue, void *data, size_t size)
-{
-	uint16_t sum;
-	uint16_t w;
-	size_t words, i;
-	uint8_t *bdata;
-
-	sum = ~ivalue;
-	words = size / 2;
-	bdata = (uint8_t *)data;
-
-	for (i = 0; i < words; i++) {
-		w = ((uint16_t)bdata[2 * i] << 8) | bdata[2 * i + 1];
-		sum = tcp_ocadd16(sum, w);
-	}
-
-	if (size % 2 != 0) {
-		w = ((uint16_t)bdata[2 * words] << 8);
-		sum = tcp_ocadd16(sum, w);
-	}
-
-	return ~sum;
-}
-
-static void tcp_header_decode_flags(uint16_t doff_flags, tcp_control_t *rctl)
-{
-	tcp_control_t ctl;
-
-	ctl = 0;
-
-	if ((doff_flags & BIT_V(uint16_t, DF_URG)) != 0)
-		ctl |= 0 /* XXX */;
-	if ((doff_flags & BIT_V(uint16_t, DF_ACK)) != 0)
-		ctl |= CTL_ACK;
-	if ((doff_flags & BIT_V(uint16_t, DF_PSH)) != 0)
-		ctl |= 0 /* XXX */;
-	if ((doff_flags & BIT_V(uint16_t, DF_RST)) != 0)
-		ctl |= CTL_RST;
-	if ((doff_flags & BIT_V(uint16_t, DF_SYN)) != 0)
-		ctl |= CTL_SYN;
-	if ((doff_flags & BIT_V(uint16_t, DF_FIN)) != 0)
-		ctl |= CTL_FIN;
-
-	*rctl = ctl;
-}
-
-static void tcp_header_encode_flags(tcp_control_t ctl, uint16_t doff_flags0,
-    uint16_t *rdoff_flags)
-{
-	uint16_t doff_flags;
-
-	doff_flags = doff_flags0;
-
-	if ((ctl & CTL_ACK) != 0)
-		doff_flags |= BIT_V(uint16_t, DF_ACK);
-	if ((ctl & CTL_RST) != 0)
-		doff_flags |= BIT_V(uint16_t, DF_RST);
-	if ((ctl & CTL_SYN) != 0)
-		doff_flags |= BIT_V(uint16_t, DF_SYN);
-	if ((ctl & CTL_FIN) != 0)
-		doff_flags |= BIT_V(uint16_t, DF_FIN);
-
-	*rdoff_flags = doff_flags;
-}
-
-static void tcp_header_setup(inet_ep2_t *epp, tcp_segment_t *seg, tcp_header_t *hdr)
-{
-	uint16_t doff_flags;
-	uint16_t doff;
-
-	hdr->src_port = host2uint16_t_be(epp->local.port);
-	hdr->dest_port = host2uint16_t_be(epp->remote.port);
-	hdr->seq = host2uint32_t_be(seg->seq);
-	hdr->ack = host2uint32_t_be(seg->ack);
-
-	doff = (sizeof(tcp_header_t) / sizeof(uint32_t)) << DF_DATA_OFFSET_l;
-	tcp_header_encode_flags(seg->ctrl, doff, &doff_flags);
-
-	hdr->doff_flags = host2uint16_t_be(doff_flags);
-	hdr->window = host2uint16_t_be(seg->wnd);
-	hdr->checksum = 0;
-	hdr->urg_ptr = host2uint16_t_be(seg->up);
-}
-
-static ip_ver_t tcp_phdr_setup(tcp_pdu_t *pdu, tcp_phdr_t *phdr,
-    tcp_phdr6_t *phdr6)
-{
-	addr32_t src_v4;
-	addr128_t src_v6;
-	uint16_t src_ver = inet_addr_get(&pdu->src, &src_v4, &src_v6);
-
-	addr32_t dest_v4;
-	addr128_t dest_v6;
-	uint16_t dest_ver = inet_addr_get(&pdu->dest, &dest_v4, &dest_v6);
-
-	assert(src_ver == dest_ver);
-
-	switch (src_ver) {
-	case ip_v4:
-		phdr->src = host2uint32_t_be(src_v4);
-		phdr->dest = host2uint32_t_be(dest_v4);
-		phdr->zero = 0;
-		phdr->protocol = IP_PROTO_TCP;
-		phdr->tcp_length =
-		    host2uint16_t_be(pdu->header_size + pdu->text_size);
-		break;
-	case ip_v6:
-		host2addr128_t_be(src_v6, phdr6->src);
-		host2addr128_t_be(dest_v6, phdr6->dest);
-		phdr6->tcp_length =
-		    host2uint32_t_be(pdu->header_size + pdu->text_size);
-		memset(phdr6->zeroes, 0, 3);
-		phdr6->next = IP_PROTO_TCP;
-		break;
-	default:
-		assert(false);
-	}
-
-	return src_ver;
-}
-
-static void tcp_header_decode(tcp_header_t *hdr, tcp_segment_t *seg)
-{
-	tcp_header_decode_flags(uint16_t_be2host(hdr->doff_flags), &seg->ctrl);
-	seg->seq = uint32_t_be2host(hdr->seq);
-	seg->ack = uint32_t_be2host(hdr->ack);
-	seg->wnd = uint16_t_be2host(hdr->window);
-	seg->up = uint16_t_be2host(hdr->urg_ptr);
-}
-
-static errno_t tcp_header_encode(inet_ep2_t *epp, tcp_segment_t *seg,
-    void **header, size_t *size)
-{
-	tcp_header_t *hdr;
-
-	hdr = calloc(1, sizeof(tcp_header_t));
-	if (hdr == NULL)
-		return ENOMEM;
-
-	tcp_header_setup(epp, seg, hdr);
-	*header = hdr;
-	*size = sizeof(tcp_header_t);
-
-	return EOK;
-}
-
-static tcp_pdu_t *tcp_pdu_new(void)
-{
-	return calloc(1, sizeof(tcp_pdu_t));
-}
-
-/** Create PDU with the specified header and text data.
- *
- * Note that you still need to set addresses in the returned PDU.
- *
- * @param hdr		Header data
- * @param hdr_size      Header size in bytes
- * @param text		Text data
- * @param text_size	Text size in bytes
- * @return		New PDU
- */
-tcp_pdu_t *tcp_pdu_create(void *hdr, size_t hdr_size, void *text,
-    size_t text_size)
-{
-	tcp_pdu_t *pdu;
-
-	pdu = tcp_pdu_new();
-	if (pdu == NULL)
-		return NULL;
-
-	pdu->header = malloc(hdr_size);
-	pdu->text = malloc(text_size);
-	if (pdu->header == NULL || pdu->text == NULL)
-		goto error;
-
-	memcpy(pdu->header, hdr, hdr_size);
-	memcpy(pdu->text, text, text_size);
-
-	pdu->header_size = hdr_size;
-	pdu->text_size = text_size;
-
-	return pdu;
-
-error:
-	if (pdu->header != NULL)
-		free(pdu->header);
-	if (pdu->text != NULL)
-		free(pdu->text);
-	free(pdu);
-
-	return NULL;
-}
-
-void tcp_pdu_delete(tcp_pdu_t *pdu)
-{
-	free(pdu->header);
-	free(pdu->text);
-	free(pdu);
-}
-
-static uint16_t tcp_pdu_checksum_calc(tcp_pdu_t *pdu)
-{
-	uint16_t cs_phdr;
-	uint16_t cs_headers;
-	tcp_phdr_t phdr;
-	tcp_phdr6_t phdr6;
-
-	ip_ver_t ver = tcp_phdr_setup(pdu, &phdr, &phdr6);
-	switch (ver) {
-	case ip_v4:
-		cs_phdr = tcp_checksum_calc(TCP_CHECKSUM_INIT, (void *) &phdr,
-		    sizeof(tcp_phdr_t));
-		break;
-	case ip_v6:
-		cs_phdr = tcp_checksum_calc(TCP_CHECKSUM_INIT, (void *) &phdr6,
-		    sizeof(tcp_phdr6_t));
-		break;
-	default:
-		assert(false);
-	}
-
-	cs_headers = tcp_checksum_calc(cs_phdr, pdu->header, pdu->header_size);
-	return tcp_checksum_calc(cs_headers, pdu->text, pdu->text_size);
-}
-
-static void tcp_pdu_set_checksum(tcp_pdu_t *pdu, uint16_t checksum)
-{
-	tcp_header_t *hdr;
-
-	hdr = (tcp_header_t *)pdu->header;
-	hdr->checksum = host2uint16_t_be(checksum);
-}
-
-/** Decode incoming PDU */
-errno_t tcp_pdu_decode(tcp_pdu_t *pdu, inet_ep2_t *epp, tcp_segment_t **seg)
-{
-	tcp_segment_t *nseg;
-	tcp_header_t *hdr;
-
-	nseg = tcp_segment_make_data(0, pdu->text, pdu->text_size);
-	if (nseg == NULL)
-		return ENOMEM;
-
-	tcp_header_decode(pdu->header, nseg);
-	nseg->len += seq_no_control_len(nseg->ctrl);
-
-	hdr = (tcp_header_t *)pdu->header;
-
-	epp->local.port = uint16_t_be2host(hdr->dest_port);
-	epp->local.addr = pdu->dest;
-	epp->remote.port = uint16_t_be2host(hdr->src_port);
-	epp->remote.addr = pdu->src;
-
-	*seg = nseg;
-	return EOK;
-}
-
-/** Encode outgoing PDU */
-errno_t tcp_pdu_encode(inet_ep2_t *epp, tcp_segment_t *seg, tcp_pdu_t **pdu)
-{
-	tcp_pdu_t *npdu;
-	size_t text_size;
-	uint16_t checksum;
-	errno_t rc;
-
-	npdu = tcp_pdu_new();
-	if (npdu == NULL)
-		return ENOMEM;
-
-	npdu->src = epp->local.addr;
-	npdu->dest = epp->remote.addr;
-	rc = tcp_header_encode(epp, seg, &npdu->header, &npdu->header_size);
-	if (rc != EOK) {
-		free(npdu);
-		return rc;
-	}
-
-	text_size = tcp_segment_text_size(seg);
-	npdu->text = calloc(1, text_size);
-	if (npdu->text == NULL) {
-		free(npdu->header);
-		free(npdu);
-		return ENOMEM;
-	}
-
-	npdu->text_size = text_size;
-	memcpy(npdu->text, seg->data, text_size);
-
-	/* Checksum calculation */
-	checksum = tcp_pdu_checksum_calc(npdu);
-	tcp_pdu_set_checksum(npdu, checksum);
-
-	*pdu = npdu;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/pdu.h
===================================================================
--- uspace/srv/net/tcp/pdu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP PDU (encoded Protocol Data Unit) handling
- */
-
-#ifndef PDU_H
-#define PDU_H
-
-#include <inet/endpoint.h>
-#include <stddef.h>
-#include "std.h"
-#include "tcp_type.h"
-
-extern tcp_pdu_t *tcp_pdu_create(void *, size_t, void *, size_t);
-extern void tcp_pdu_delete(tcp_pdu_t *);
-extern errno_t tcp_pdu_decode(tcp_pdu_t *, inet_ep2_t *, tcp_segment_t **);
-extern errno_t tcp_pdu_encode(inet_ep2_t *, tcp_segment_t *, tcp_pdu_t **);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/rqueue.c
===================================================================
--- uspace/srv/net/tcp/rqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Global segment receive queue
- */
-
-#include <adt/prodcons.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include "conn.h"
-#include "rqueue.h"
-#include "segment.h"
-#include "tcp_type.h"
-#include "ucall.h"
-
-static prodcons_t rqueue;
-static bool fibril_active;
-static fibril_mutex_t lock;
-static fibril_condvar_t cv;
-static tcp_rqueue_cb_t *rqueue_cb;
-
-/** Initialize segment receive queue. */
-void tcp_rqueue_init(tcp_rqueue_cb_t *rcb)
-{
-	prodcons_initialize(&rqueue);
-	fibril_mutex_initialize(&lock);
-	fibril_condvar_initialize(&cv);
-	fibril_active = false;
-	rqueue_cb = rcb;
-}
-
-/** Finalize segment receive queue. */
-void tcp_rqueue_fini(void)
-{
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	tcp_rqueue_insert_seg(&epp, NULL);
-
-	fibril_mutex_lock(&lock);
-	while (fibril_active)
-		fibril_condvar_wait(&cv, &lock);
-	fibril_mutex_unlock(&lock);
-}
-
-/** Insert segment into receive queue.
- *
- * @param epp	Endpoint pair, oriented for reception
- * @param seg	Segment (ownership transferred to rqueue)
- */
-void tcp_rqueue_insert_seg(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	tcp_rqueue_entry_t *rqe;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_rqueue_insert_seg()");
-
-	if (seg != NULL)
-		tcp_segment_dump(seg);
-
-	rqe = calloc(1, sizeof(tcp_rqueue_entry_t));
-	if (rqe == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating RQE.");
-		return;
-	}
-
-	rqe->epp = *epp;
-	rqe->seg = seg;
-
-	prodcons_produce(&rqueue, &rqe->link);
-}
-
-/** Receive queue handler fibril. */
-static errno_t tcp_rqueue_fibril(void *arg)
-{
-	link_t *link;
-	tcp_rqueue_entry_t *rqe;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_rqueue_fibril()");
-
-	while (true) {
-		link = prodcons_consume(&rqueue);
-		rqe = list_get_instance(link, tcp_rqueue_entry_t, link);
-
-		if (rqe->seg == NULL) {
-			free(rqe);
-			break;
-		}
-
-		rqueue_cb->seg_received(&rqe->epp, rqe->seg);
-		free(rqe);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "tcp_rqueue_fibril() exiting");
-
-	/* Finished */
-	fibril_mutex_lock(&lock);
-	fibril_active = false;
-	fibril_mutex_unlock(&lock);
-	fibril_condvar_broadcast(&cv);
-
-	return 0;
-}
-
-/** Start receive queue handler fibril. */
-void tcp_rqueue_fibril_start(void)
-{
-	fid_t fid;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_rqueue_fibril_start()");
-
-	fid = fibril_create(tcp_rqueue_fibril, NULL);
-	if (fid == 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed creating rqueue fibril.");
-		return;
-	}
-
-	fibril_add_ready(fid);
-	fibril_active = true;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/rqueue.h
===================================================================
--- uspace/srv/net/tcp/rqueue.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Global segment receive queue
- */
-
-#ifndef RQUEUE_H
-#define RQUEUE_H
-
-#include <inet/endpoint.h>
-#include "tcp_type.h"
-
-extern void tcp_rqueue_init(tcp_rqueue_cb_t *);
-extern void tcp_rqueue_fibril_start(void);
-extern void tcp_rqueue_fini(void);
-extern void tcp_rqueue_insert_seg(inet_ep2_t *, tcp_segment_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/segment.c
===================================================================
--- uspace/srv/net/tcp/segment.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,261 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Segment processing
- */
-
-#include <io/log.h>
-#include <mem.h>
-#include <stdlib.h>
-#include "segment.h"
-#include "seq_no.h"
-#include "tcp_type.h"
-
-/** Alocate new segment structure. */
-static tcp_segment_t *tcp_segment_new(void)
-{
-	return calloc(1, sizeof(tcp_segment_t));
-}
-
-/** Delete segment. */
-void tcp_segment_delete(tcp_segment_t *seg)
-{
-	free(seg->dfptr);
-	free(seg);
-}
-
-/** Create duplicate of segment.
- *
- * @param seg	Segment
- * @return 	Duplicate segment
- */
-tcp_segment_t *tcp_segment_dup(tcp_segment_t *seg)
-{
-	tcp_segment_t *scopy;
-	size_t tsize;
-
-	scopy = tcp_segment_new();
-	if (scopy == NULL)
-		return NULL;
-
-	scopy->ctrl = seg->ctrl;
-	scopy->seq = seg->seq;
-	scopy->ack = seg->ack;
-	scopy->len = seg->len;
-	scopy->wnd = seg->wnd;
-	scopy->up = seg->up;
-
-	tsize = tcp_segment_text_size(seg);
-	scopy->data = calloc(tsize, 1);
-	if (scopy->data == NULL) {
-		free(scopy);
-		return NULL;
-	}
-
-	memcpy(scopy->data, seg->data, tsize);
-	scopy->dfptr = scopy->data;
-
-	return scopy;
-}
-
-/** Create a control-only segment.
- *
- * @return	Segment
- */
-tcp_segment_t *tcp_segment_make_ctrl(tcp_control_t ctrl)
-{
-	tcp_segment_t *seg;
-
-	seg = tcp_segment_new();
-	if (seg == NULL)
-		return NULL;
-
-	seg->ctrl = ctrl;
-	seg->len = seq_no_control_len(ctrl);
-
-	return seg;
-}
-
-/** Create an RST segment.
- *
- * @param seg	Segment we are replying to
- * @return	RST segment
- */
-tcp_segment_t *tcp_segment_make_rst(tcp_segment_t *seg)
-{
-	tcp_segment_t *rseg;
-
-	rseg = tcp_segment_new();
-	if (rseg == NULL)
-		return NULL;
-
-	if ((seg->ctrl & CTL_ACK) == 0) {
-		rseg->ctrl = CTL_RST | CTL_ACK;
-		rseg->seq = 0;
-		rseg->ack = seg->seq + seg->len;
-	} else {
-		rseg->ctrl = CTL_RST;
-		rseg->seq = seg->ack;
-	}
-
-	return rseg;
-}
-
-/** Create a control segment.
- *
- * @return	Segment
- */
-tcp_segment_t *tcp_segment_make_data(tcp_control_t ctrl, void *data,
-    size_t size)
-{
-	tcp_segment_t *seg;
-
-	seg = tcp_segment_new();
-	if (seg == NULL)
-		return NULL;
-
-	seg->ctrl = ctrl;
-	seg->len = seq_no_control_len(ctrl) + size;
-
-	seg->dfptr = seg->data = malloc(size);
-	if (seg->dfptr == NULL) {
-		free(seg);
-		return NULL;
-	}
-
-	memcpy(seg->data, data, size);
-
-	return seg;
-}
-
-/** Trim segment from left and right by the specified amount.
- *
- * Trim any text or control to remove the specified amount of sequence
- * numbers from the left (lower sequence numbers) and right side
- * (higher sequence numbers) of the segment.
- *
- * @param seg		Segment, will be modified in place
- * @param left		Amount of sequence numbers to trim from the left
- * @param right		Amount of sequence numbers to trim from the right
- */
-void tcp_segment_trim(tcp_segment_t *seg, uint32_t left, uint32_t right)
-{
-	uint32_t t_size;
-
-	assert(left + right <= seg->len);
-
-	/* Special case, entire segment trimmed from left */
-	if (left == seg->len) {
-		seg->seq = seg->seq + seg->len;
-		seg->len = 0;
-		return;
-	}
-
-	/* Special case, entire segment trimmed from right */
-	if (right == seg->len) {
-		seg->len = 0;
-		return;
-	}
-
-	/* General case */
-
-	t_size = tcp_segment_text_size(seg);
-
-	if (left > 0 && (seg->ctrl & CTL_SYN) != 0) {
-		/* Trim SYN */
-		seg->ctrl &= ~CTL_SYN;
-		seg->seq++;
-		seg->len--;
-		left--;
-	}
-
-	if (right > 0 && (seg->ctrl & CTL_FIN) != 0) {
-		/* Trim FIN */
-		seg->ctrl &= ~CTL_FIN;
-		seg->len--;
-		right--;
-	}
-
-	if (left > 0 || right > 0) {
-		/* Trim segment text */
-		assert(left + right <= t_size);
-
-		seg->data += left;
-		seg->len -= left + right;
-	}
-}
-
-/** Copy out text data from segment.
- *
- * Data is copied from the beginning of the segment text up to @a size bytes.
- * @a size must not be greater than the size of the segment text, but
- * it can be less.
- *
- * @param seg	Segment
- * @param buf	Destination buffer
- * @param size	Size of destination buffer
- */
-void tcp_segment_text_copy(tcp_segment_t *seg, void *buf, size_t size)
-{
-	assert(size <= tcp_segment_text_size(seg));
-	memcpy(buf, seg->data, size);
-}
-
-/** Return number of bytes in segment text.
- *
- * @param seg	Segment
- * @return	Number of bytes in segment text
- */
-size_t tcp_segment_text_size(tcp_segment_t *seg)
-{
-	return seg->len - seq_no_control_len(seg->ctrl);
-}
-
-/** Dump segment contents to log.
- *
- * @param seg	Segment
- */
-void tcp_segment_dump(tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, "Segment dump:");
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - ctrl = %u", (unsigned)seg->ctrl);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - seq = %" PRIu32, seg->seq);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - ack = %" PRIu32, seg->ack);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - len = %" PRIu32, seg->len);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - wnd = %" PRIu32, seg->wnd);
-	log_msg(LOG_DEFAULT, LVL_DEBUG2, " - up = %" PRIu32, seg->up);
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/segment.h
===================================================================
--- uspace/srv/net/tcp/segment.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Segment processing
- */
-
-#ifndef SEGMENT_H
-#define SEGMENT_H
-
-#include <stddef.h>
-#include <stdint.h>
-#include "tcp_type.h"
-
-extern void tcp_segment_delete(tcp_segment_t *);
-extern tcp_segment_t *tcp_segment_dup(tcp_segment_t *);
-extern tcp_segment_t *tcp_segment_make_ctrl(tcp_control_t);
-extern tcp_segment_t *tcp_segment_make_rst(tcp_segment_t *);
-extern tcp_segment_t *tcp_segment_make_data(tcp_control_t, void *, size_t);
-extern void tcp_segment_trim(tcp_segment_t *, uint32_t, uint32_t);
-extern void tcp_segment_text_copy(tcp_segment_t *, void *, size_t);
-extern size_t tcp_segment_text_size(tcp_segment_t *);
-extern void tcp_segment_dump(tcp_segment_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/seq_no.c
===================================================================
--- uspace/srv/net/tcp/seq_no.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,280 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Sequence number computations
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "seq_no.h"
-#include "tcp_type.h"
-
-/** a <= b < c modulo sequence space */
-static bool seq_no_le_lt(uint32_t a, uint32_t b, uint32_t c)
-{
-	if (a <= c) {
-		return (a <= b) && (b < c);
-	} else {
-		return (b < c) || (a <= b);
-	}
-}
-
-/** a < b <= c modulo sequence space */
-static bool seq_no_lt_le(uint32_t a, uint32_t b, uint32_t c)
-{
-	if (a <= c) {
-		return (a < b) && (b <= c);
-	} else {
-		return (b <= c) || (a < b);
-	}
-}
-
-/** Determine wheter ack is acceptable (new acknowledgement) */
-bool seq_no_ack_acceptable(tcp_conn_t *conn, uint32_t seg_ack)
-{
-	/* SND.UNA < SEG.ACK <= SND.NXT */
-	return seq_no_lt_le(conn->snd_una, seg_ack, conn->snd_nxt);
-}
-
-/** Determine wheter ack is duplicate.
- *
- * ACK is duplicate if it refers to a sequence number that has
- * aleady been acked (SEG.ACK <= SND.UNA).
- */
-bool seq_no_ack_duplicate(tcp_conn_t *conn, uint32_t seg_ack)
-{
-	uint32_t diff;
-
-	/*
-	 * There does not seem to be a three-point comparison
-	 * equivalent of SEG.ACK < SND.UNA. Thus we do it
-	 * on a best-effort basis, based on the difference.
-	 * [-2^31, 0) means less-than, 0 means equal, [0, 2^31)
-	 * means greater-than. Less-than or equal means duplicate.
-	 */
-	diff = seg_ack - conn->snd_una;
-	return diff == 0 || (diff & (0x1 << 31)) != 0;
-}
-
-/** Determine if sequence number is in receive window. */
-bool seq_no_in_rcv_wnd(tcp_conn_t *conn, uint32_t sn)
-{
-	return seq_no_le_lt(conn->rcv_nxt, sn, conn->rcv_nxt + conn->rcv_wnd);
-}
-
-/** Determine segment has new window update.
- *
- * Window update is new if either SND.WL1 < SEG.SEQ or
- * (SND.WL1 = SEG.SEQ and SND.WL2 <= SEG.ACK).
- */
-bool seq_no_new_wnd_update(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	bool n_seq, n_ack;
-
-	assert(seq_no_segment_acceptable(conn, seg));
-
-	/*
-	 * We make use of the fact that the peer should not ACK anything
-	 * beyond our send window (we surely haven't sent that yet)
-	 * as we should have filtered those acks out.
-	 * We use SND.UNA+SND.WND as the third point of comparison.
-	 */
-
-	n_seq = seq_no_lt_le(conn->snd_wl1, seg->seq,
-	    conn->snd_una + conn->snd_wnd);
-
-	n_ack = conn->snd_wl1 == seg->seq &&
-	    seq_no_le_lt(conn->snd_wl2, seg->ack,
-	    conn->snd_una + conn->snd_wnd + 1);
-
-	return n_seq || n_ack;
-}
-
-/** Determine if segment is ready for processing.
- *
- * Assuming segment is acceptable, a segment is ready if it intersects
- * RCV.NXT, that is we can process it immediately.
- */
-bool seq_no_segment_ready(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	assert(seq_no_segment_acceptable(conn, seg));
-
-	return seq_no_le_lt(seg->seq, conn->rcv_nxt, seg->seq + seg->len + 1);
-}
-
-/** Determine whether segment is fully acked.
- *
- * @param conn Connection
- * @param seg  Segment
- * @param ack  Last received ACK (i.e. SND.UNA)
- *
- * @return @c true if segment is fully acked, @c false otherwise
- */
-bool seq_no_segment_acked(tcp_conn_t *conn, tcp_segment_t *seg, uint32_t ack)
-{
-	assert(seg->len > 0);
-	return seq_no_lt_le(seg->seq, seg->seq + seg->len, ack);
-}
-
-/** Determine whether initial SYN is acked.
- *
- * @param conn Connection
- * @return @c true if initial SYN is acked, @c false otherwise
- */
-bool seq_no_syn_acked(tcp_conn_t *conn)
-{
-	return seq_no_lt_le(conn->iss, conn->snd_una, conn->snd_nxt);
-}
-
-/** Determine whether segment overlaps the receive window.
- *
- * @param conn Connection
- * @param seg  Segment
- * @return @c true if segment overlaps the receive window, @c false otherwise
- */
-bool seq_no_segment_acceptable(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	bool b_in, e_in;
-	bool wb_in, we_in;
-
-	/* Beginning of segment is inside window */
-	b_in = seq_no_le_lt(conn->rcv_nxt, seg->seq, conn->rcv_nxt +
-	    conn->rcv_wnd);
-
-	/* End of segment is inside window */
-	e_in = seq_no_le_lt(conn->rcv_nxt, seg->seq + seg->len - 1,
-	    conn->rcv_nxt + conn->rcv_wnd);
-
-	/* Beginning of window is inside segment */
-	wb_in = seq_no_le_lt(seg->seq, conn->rcv_nxt,
-	    seg->seq + seg->len);
-
-	/* End of window is inside segment */
-	we_in = seq_no_le_lt(seg->seq, conn->rcv_nxt + conn->rcv_wnd - 1,
-	    seg->seq + seg->len);
-
-	if (seg->len == 0 && conn->rcv_wnd == 0) {
-		return seg->seq == conn->rcv_nxt;
-	} else if (seg->len == 0 && conn->rcv_wnd != 0) {
-		return b_in;
-	} else if (seg->len > 0 && conn->rcv_wnd == 0) {
-		return false;
-	} else {
-		return b_in || e_in || wb_in || we_in;
-	}
-}
-
-/** Determine size that control bits occupy in sequence space.
- *
- * @param ctrl Control bits combination
- * @return Number of sequence space units occupied
- */
-uint32_t seq_no_control_len(tcp_control_t ctrl)
-{
-	uint32_t len = 0;
-
-	if ((ctrl & CTL_SYN) != 0)
-		++len;
-
-	if ((ctrl & CTL_FIN) != 0)
-		++len;
-
-	return len;
-}
-
-/** Calculate the amount of trim needed to fit segment in receive window.
- *
- * @param conn  Connection
- * @param seg   Segment
- * @param left  Place to store number of units to trim at the beginning
- * @param right Place to store number of units to trim at the end
- */
-void seq_no_seg_trim_calc(tcp_conn_t *conn, tcp_segment_t *seg,
-    uint32_t *left, uint32_t *right)
-{
-	assert(seq_no_segment_acceptable(conn, seg));
-
-	/*
-	 * If RCV.NXT is between SEG.SEQ and RCV.NXT+RCV.WND, then
-	 * left trim amount is positive
-	 */
-	if (seq_no_lt_le(seg->seq, conn->rcv_nxt,
-	    conn->rcv_nxt + conn->rcv_wnd)) {
-		*left = conn->rcv_nxt - seg->seq;
-	} else {
-		*left = 0;
-	}
-
-	/*
-	 * If SEG.SEQ+SEG.LEN is between SEG.SEQ and RCV.NXT+RCV.WND,
-	 * then right trim is zero.
-	 */
-	if (seq_no_lt_le(seg->seq - 1, seg->seq + seg->len,
-	    conn->rcv_nxt + conn->rcv_wnd)) {
-		*right = 0;
-	} else {
-		*right = (seg->seq + seg->len) -
-		    (conn->rcv_nxt + conn->rcv_wnd);
-	}
-}
-
-/** Segment order comparison.
- *
- * Compare sequence order of two acceptable segments.
- *
- * @param conn		Connection
- * @param sa		Segment A
- * @param sb		Segment B
- *
- * @return		-1, 0, 1, resp. if A < B, A == B, A > B in terms
- *			of sequence order of the beginning of the segment.
- */
-int seq_no_seg_cmp(tcp_conn_t *conn, tcp_segment_t *sa, tcp_segment_t *sb)
-{
-	assert(seq_no_segment_acceptable(conn, sa));
-	assert(seq_no_segment_acceptable(conn, sb));
-
-	if (seq_no_lt_le(sa->seq, sb->seq, conn->rcv_nxt + conn->rcv_wnd))
-		return -1;
-
-	if (seq_no_lt_le(sb->seq, sa->seq, conn->rcv_nxt + conn->rcv_wnd))
-		return +1;
-
-	assert(sa->seq == sb->seq);
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/seq_no.h
===================================================================
--- uspace/srv/net/tcp/seq_no.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Sequence number computations
- */
-
-#ifndef SEQ_NO_H
-#define SEQ_NO_H
-
-#include <stdint.h>
-#include "tcp_type.h"
-
-extern bool seq_no_ack_acceptable(tcp_conn_t *, uint32_t);
-extern bool seq_no_ack_duplicate(tcp_conn_t *, uint32_t);
-extern bool seq_no_in_rcv_wnd(tcp_conn_t *, uint32_t);
-extern bool seq_no_new_wnd_update(tcp_conn_t *, tcp_segment_t *);
-extern bool seq_no_segment_acked(tcp_conn_t *, tcp_segment_t *, uint32_t);
-extern bool seq_no_syn_acked(tcp_conn_t *);
-extern bool seq_no_segment_ready(tcp_conn_t *, tcp_segment_t *);
-extern bool seq_no_segment_acceptable(tcp_conn_t *, tcp_segment_t *);
-extern void seq_no_seg_trim_calc(tcp_conn_t *, tcp_segment_t *, uint32_t *,
-    uint32_t *);
-extern int seq_no_seg_cmp(tcp_conn_t *, tcp_segment_t *, tcp_segment_t *);
-
-extern uint32_t seq_no_control_len(tcp_control_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/service.c
===================================================================
--- uspace/srv/net/tcp/service.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,1266 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file HelenOS service implementation
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <inet/endpoint.h>
-#include <inet/inet.h>
-#include <io/log.h>
-#include <ipc/services.h>
-#include <ipc/tcp.h>
-#include <loc.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "conn.h"
-#include "service.h"
-#include "tcp_type.h"
-#include "ucall.h"
-
-#define NAME "tcp"
-
-/** Maximum amount of data transferred in one send call */
-#define MAX_MSG_SIZE DATA_XFER_LIMIT
-
-static void tcp_ev_data(tcp_cconn_t *);
-static void tcp_ev_connected(tcp_cconn_t *);
-static void tcp_ev_conn_failed(tcp_cconn_t *);
-static void tcp_ev_conn_reset(tcp_cconn_t *);
-static void tcp_ev_new_conn(tcp_clst_t *, tcp_cconn_t *);
-
-static void tcp_service_cstate_change(tcp_conn_t *, void *, tcp_cstate_t);
-static void tcp_service_recv_data(tcp_conn_t *, void *);
-static void tcp_service_lst_cstate_change(tcp_conn_t *, void *, tcp_cstate_t);
-
-static errno_t tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
-
-/** Connection callbacks to tie us to lower layer */
-static tcp_cb_t tcp_service_cb = {
-	.cstate_change = tcp_service_cstate_change,
-	.recv_data = tcp_service_recv_data
-};
-
-/** Sentinel connection callbacks to tie us to lower layer */
-static tcp_cb_t tcp_service_lst_cb = {
-	.cstate_change = tcp_service_lst_cstate_change,
-	.recv_data = NULL
-};
-
-/** Connection state has changed.
- *
- * @param conn      Connection
- * @param arg       Argument (not used)
- * @param old_state Previous connection state
- */
-static void tcp_service_cstate_change(tcp_conn_t *conn, void *arg,
-    tcp_cstate_t old_state)
-{
-	tcp_cstate_t nstate;
-	tcp_cconn_t *cconn;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_service_cstate_change()");
-	nstate = conn->cstate;
-	cconn = tcp_uc_get_userptr(conn);
-
-	if ((old_state == st_syn_sent || old_state == st_syn_received) &&
-	    (nstate == st_established)) {
-		/* Connection established */
-		tcp_ev_connected(cconn);
-	}
-
-	if (old_state != st_closed && nstate == st_closed && conn->reset) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_service_cstate_change: "
-		    "Connection reset");
-		/* Connection reset */
-		tcp_ev_conn_reset(cconn);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_service_cstate_change: "
-		    "old_state=%d nstate=%d conn->reset=%d",
-		    old_state, nstate, conn->reset);
-	}
-
-	/* XXX Failed to establish connection */
-	if (0)
-		tcp_ev_conn_failed(cconn);
-}
-
-/** Sentinel connection state has changed.
- *
- * @param conn      Connection
- * @param arg       Argument (not used)
- * @param old_state Previous connection state
- */
-static void tcp_service_lst_cstate_change(tcp_conn_t *conn, void *arg,
-    tcp_cstate_t old_state)
-{
-	tcp_cstate_t nstate;
-	tcp_clst_t *clst;
-	tcp_cconn_t *cconn;
-	inet_ep2_t epp;
-	errno_t rc;
-	tcp_error_t trc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_service_lst_cstate_change()");
-	nstate = conn->cstate;
-	clst = tcp_uc_get_userptr(conn);
-
-	if ((old_state == st_syn_sent || old_state == st_syn_received) &&
-	    (nstate == st_established)) {
-		/* Connection established */
-		clst->conn = NULL;
-
-		rc = tcp_cconn_create(clst->client, conn, &cconn);
-		if (rc != EOK) {
-			/* XXX Could not create client connection */
-			return;
-		}
-
-		/* XXX Is there a race here (i.e. the connection is already active)? */
-		tcp_uc_set_cb(conn, &tcp_service_cb, cconn);
-
-		/* New incoming connection */
-		tcp_ev_new_conn(clst, cconn);
-	}
-
-	if (old_state != st_closed && nstate == st_closed && conn->reset) {
-		/* Connection reset */
-		/* XXX */
-	}
-
-	/* XXX Failed to establish connection */
-	if (0) {
-		/* XXX */
-	}
-
-	/* Replenish sentinel connection */
-
-	inet_ep2_init(&epp);
-	epp.local = clst->elocal;
-
-	trc = tcp_uc_open(&epp, ap_passive, tcp_open_nonblock,
-	    &conn);
-	if (trc != TCP_EOK) {
-		/* XXX Could not replenish connection */
-		return;
-	}
-
-	conn->name = (char *) "s";
-	clst->conn = conn;
-
-	/* XXX Is there a race here (i.e. the connection is already active)? */
-	tcp_uc_set_cb(conn, &tcp_service_lst_cb, clst);
-}
-
-/** Received data became available on connection.
- *
- * @param conn Connection
- * @param arg  Client connection
- */
-static void tcp_service_recv_data(tcp_conn_t *conn, void *arg)
-{
-	tcp_cconn_t *cconn = (tcp_cconn_t *)arg;
-
-	tcp_ev_data(cconn);
-}
-
-/** Send 'data' event to client.
- *
- * @param cconn Client connection
- */
-static void tcp_ev_data(tcp_cconn_t *cconn)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ev_data()");
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "client=%p\n", cconn->client);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "sess=%p\n", cconn->client->sess);
-
-	exch = async_exchange_begin(cconn->client->sess);
-	aid_t req = async_send_1(exch, TCP_EV_DATA, cconn->id, NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Send 'connected' event to client.
- *
- * @param cconn Client connection
- */
-static void tcp_ev_connected(tcp_cconn_t *cconn)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ev_connected()");
-
-	exch = async_exchange_begin(cconn->client->sess);
-	aid_t req = async_send_1(exch, TCP_EV_CONNECTED, cconn->id, NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Send 'conn_failed' event to client.
- *
- * @param cconn Client connection
- */
-static void tcp_ev_conn_failed(tcp_cconn_t *cconn)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ev_conn_failed()");
-
-	exch = async_exchange_begin(cconn->client->sess);
-	aid_t req = async_send_1(exch, TCP_EV_CONN_FAILED, cconn->id, NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Send 'conn_reset' event to client.
- *
- * @param cconn Client connection
- */
-static void tcp_ev_conn_reset(tcp_cconn_t *cconn)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ev_conn_reset()");
-
-	exch = async_exchange_begin(cconn->client->sess);
-	aid_t req = async_send_1(exch, TCP_EV_CONN_RESET, cconn->id, NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Send 'new_conn' event to client.
- *
- * @param clst Client listener that received the connection
- * @param cconn New client connection
- */
-static void tcp_ev_new_conn(tcp_clst_t *clst, tcp_cconn_t *cconn)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_ev_new_conn()");
-
-	exch = async_exchange_begin(clst->client->sess);
-	aid_t req = async_send_2(exch, TCP_EV_NEW_CONN, clst->id, cconn->id,
-	    NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Create client connection.
- *
- * This effectively adds a connection into a client's namespace.
- *
- * @param client TCP client
- * @param conn   Connection
- * @param rcconn Place to store pointer to new client connection
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-static errno_t tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
-    tcp_cconn_t **rcconn)
-{
-	tcp_cconn_t *cconn;
-	sysarg_t id;
-
-	cconn = calloc(1, sizeof(tcp_cconn_t));
-	if (cconn == NULL)
-		return ENOMEM;
-
-	/* Allocate new ID */
-	id = 0;
-	list_foreach (client->cconn, lclient, tcp_cconn_t, cconn) {
-		if (cconn->id >= id)
-			id = cconn->id + 1;
-	}
-
-	cconn->id = id;
-	cconn->client = client;
-	cconn->conn = conn;
-
-	list_append(&cconn->lclient, &client->cconn);
-	*rcconn = cconn;
-	return EOK;
-}
-
-/** Destroy client connection.
- *
- * @param cconn Client connection
- */
-static void tcp_cconn_destroy(tcp_cconn_t *cconn)
-{
-	list_remove(&cconn->lclient);
-	free(cconn);
-}
-
-/** Create client listener.
- *
- * Create client listener based on sentinel connection.
- * XXX Implement actual listener in protocol core
- *
- * @param client TCP client
- * @param conn   Sentinel connection
- * @param rclst  Place to store pointer to new client listener
- *
- * @return EOK on success or ENOMEM if out of memory
- */
-static errno_t tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
-    tcp_clst_t **rclst)
-{
-	tcp_clst_t *clst;
-	sysarg_t id;
-
-	clst = calloc(1, sizeof(tcp_clst_t));
-	if (clst == NULL)
-		return ENOMEM;
-
-	/* Allocate new ID */
-	id = 0;
-	list_foreach (client->clst, lclient, tcp_clst_t, clst) {
-		if (clst->id >= id)
-			id = clst->id + 1;
-	}
-
-	clst->id = id;
-	clst->client = client;
-	clst->conn = conn;
-
-	list_append(&clst->lclient, &client->clst);
-	*rclst = clst;
-	return EOK;
-}
-
-/** Destroy client listener.
- *
- * @param clst Client listener
- */
-static void tcp_clistener_destroy(tcp_clst_t *clst)
-{
-	list_remove(&clst->lclient);
-	free(clst);
-}
-
-/** Get client connection by ID.
- *
- * @param client Client
- * @param id     Client connection ID
- * @param rcconn Place to store pointer to client connection
- *
- * @return EOK on success, ENOENT if no client connection with the given ID
- *         is found.
- */
-static errno_t tcp_cconn_get(tcp_client_t *client, sysarg_t id,
-    tcp_cconn_t **rcconn)
-{
-	list_foreach (client->cconn, lclient, tcp_cconn_t, cconn) {
-		if (cconn->id == id) {
-			*rcconn = cconn;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Get client listener by ID.
- *
- * @param client Client
- * @param id     Client connection ID
- * @param rclst  Place to store pointer to client listener
- *
- * @return EOK on success, ENOENT if no client listener with the given ID
- *         is found.
- */
-static errno_t tcp_clistener_get(tcp_client_t *client, sysarg_t id,
-    tcp_clst_t **rclst)
-{
-	list_foreach (client->clst, lclient, tcp_clst_t, clst) {
-		if (clst->id == id) {
-			*rclst = clst;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/** Create connection.
- *
- * Handle client request to create connection (with parameters unmarshalled).
- *
- * @param client   TCP client
- * @param epp      Endpoint pair
- * @param rconn_id Place to store ID of new connection
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,
-    sysarg_t *rconn_id)
-{
-	tcp_conn_t *conn;
-	tcp_cconn_t *cconn;
-	errno_t rc;
-	tcp_error_t trc;
-	char *slocal;
-	char *sremote;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create_impl");
-
-	inet_addr_format(&epp->local.addr, &slocal);
-	inet_addr_format(&epp->remote.addr, &sremote);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create: local=%s remote=%s",
-	    slocal, sremote);
-	free(slocal);
-	free(sremote);
-
-	trc = tcp_uc_open(epp, ap_active, tcp_open_nonblock, &conn);
-	if (trc != TCP_EOK)
-		return EIO;
-
-	conn->name = (char *) "c";
-
-	rc = tcp_cconn_create(client, conn, &cconn);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		tcp_conn_delete(conn);
-		return ENOMEM;
-	}
-
-	/* XXX Is there a race here (i.e. the connection is already active)? */
-	tcp_uc_set_cb(conn, &tcp_service_cb, cconn);
-
-	*rconn_id = cconn->id;
-	return EOK;
-}
-
-/** Destroy connection.
- *
- * Handle client request to destroy connection (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- * @return EOK on success, ENOENT if no such connection is found
- */
-static errno_t tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
-{
-	tcp_cconn_t *cconn;
-	errno_t rc;
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	tcp_uc_close(cconn->conn);
-	tcp_uc_delete(cconn->conn);
-	tcp_cconn_destroy(cconn);
-	return EOK;
-}
-
-/** Create listener.
- *
- * Handle client request to create listener (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param ep      Endpoint
- * @param rlst_id Place to store ID of new listener
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
-    sysarg_t *rlst_id)
-{
-	tcp_conn_t *conn;
-	tcp_clst_t *clst;
-	inet_ep2_t epp;
-	errno_t rc;
-	tcp_error_t trc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_create_impl");
-
-	inet_ep2_init(&epp);
-	epp.local.addr = ep->addr;
-	epp.local.port = ep->port;
-
-	trc = tcp_uc_open(&epp, ap_passive, tcp_open_nonblock, &conn);
-	if (trc != TCP_EOK)
-		return EIO;
-
-	conn->name = (char *) "s";
-
-	rc = tcp_clistener_create(client, conn, &clst);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		tcp_conn_delete(conn);
-		return ENOMEM;
-	}
-
-	clst->elocal = epp.local;
-
-	/* XXX Is there a race here (i.e. the connection is already active)? */
-	tcp_uc_set_cb(conn, &tcp_service_lst_cb, clst);
-
-	*rlst_id = clst->id;
-	return EOK;
-}
-
-/** Destroy listener.
- *
- * Handle client request to destroy listener (with parameters unmarshalled).
- *
- * @param client TCP client
- * @param lst_id Listener ID
- *
- * @return EOK on success, ENOENT if no such listener is found
- */
-static errno_t tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
-{
-	tcp_clst_t *clst;
-	errno_t rc;
-
-	rc = tcp_clistener_get(client, lst_id, &clst);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-#if 0
-	tcp_uc_close(cconn->conn);
-#endif
-	tcp_clistener_destroy(clst);
-	return EOK;
-}
-
-/** Send FIN.
- *
- * Handle client request to send FIN (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)
-{
-	tcp_cconn_t *cconn;
-	errno_t rc;
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	(void) cconn;
-	/* XXX TODO */
-	return EOK;
-}
-
-/** Push connection.
- *
- * Handle client request to push connection (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)
-{
-	tcp_cconn_t *cconn;
-	errno_t rc;
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	(void) cconn;
-	/* XXX TODO */
-	return EOK;
-}
-
-/** Reset connection.
- *
- * Handle client request to reset connection (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)
-{
-	tcp_cconn_t *cconn;
-	errno_t rc;
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	tcp_uc_abort(cconn->conn);
-	return EOK;
-}
-
-/** Send data over connection..
- *
- * Handle client request to send data (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- * @param data    Data buffer
- * @param size    Data size in bytes
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,
-    void *data, size_t size)
-{
-	tcp_cconn_t *cconn;
-	errno_t rc;
-	tcp_error_t trc;
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK)
-		return rc;
-
-	trc = tcp_uc_send(cconn->conn, data, size, 0);
-	if (trc != TCP_EOK)
-		return EIO;
-
-	return EOK;
-}
-
-/** Receive data from connection.
- *
- * Handle client request to receive data (with parameters unmarshalled).
- *
- * @param client  TCP client
- * @param conn_id Connection ID
- * @param data    Data buffer
- * @param size    Buffer size in bytes
- * @param nrecv   Place to store actual number of bytes received
- *
- * @return EOK on success or an error code
- */
-static errno_t tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,
-    void *data, size_t size, size_t *nrecv)
-{
-	tcp_cconn_t *cconn;
-	xflags_t xflags;
-	errno_t rc;
-	tcp_error_t trc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl()");
-
-	rc = tcp_cconn_get(client, conn_id, &cconn);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - conn not found");
-		return rc;
-	}
-
-	trc = tcp_uc_receive(cconn->conn, data, size, nrecv, &xflags);
-	if (trc != TCP_EOK) {
-		switch (trc) {
-		case TCP_EAGAIN:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - EAGAIN");
-			return EAGAIN;
-		case TCP_ECLOSING:
-			*nrecv = 0;
-			return EOK;
-		default:
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_impl() - trc=%d", trc);
-			return EIO;
-		}
-	}
-
-	return EOK;
-}
-
-/** Create client callback session.
- *
- * Handle client request to create callback session.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_callback_create_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_callback_create_srv()");
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	client->sess = sess;
-	async_answer_0(icall, EOK);
-}
-
-/** Create connection.
- *
- * Handle client request to create connection.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_create_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	inet_ep2_t epp;
-	sysarg_t conn_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_create_srv()");
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_ep2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &epp, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = tcp_conn_create_impl(client, &epp, &conn_id);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_1(icall, EOK, conn_id);
-}
-
-/** Destroy connection.
- *
- * Handle client request to destroy connection.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_destroy_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t conn_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_destroy_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-	rc = tcp_conn_destroy_impl(client, conn_id);
-	async_answer_0(icall, rc);
-}
-
-/** Create listener.
- *
- * Handle client request to create listener.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_listener_create_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	inet_ep_t ep;
-	sysarg_t lst_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_create_srv()");
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_ep_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &ep, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = tcp_listener_create_impl(client, &ep, &lst_id);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_1(icall, EOK, lst_id);
-}
-
-/** Destroy listener.
- *
- * Handle client request to destroy listener.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_listener_destroy_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t lst_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_listener_destroy_srv()");
-
-	lst_id = ipc_get_arg1(icall);
-	rc = tcp_listener_destroy_impl(client, lst_id);
-	async_answer_0(icall, rc);
-}
-
-/** Send FIN.
- *
- * Handle client request to send FIN.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_send_fin_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t conn_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_fin_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-	rc = tcp_conn_send_fin_impl(client, conn_id);
-	async_answer_0(icall, rc);
-}
-
-/** Push connection.
- *
- * Handle client request to push connection.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_push_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t conn_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_push_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-	rc = tcp_conn_push_impl(client, conn_id);
-	async_answer_0(icall, rc);
-}
-
-/** Reset connection.
- *
- * Handle client request to reset connection.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_reset_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t conn_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_reset_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-	rc = tcp_conn_reset_impl(client, conn_id);
-	async_answer_0(icall, rc);
-}
-
-/** Send data via connection..
- *
- * Handle client request to send data via connection.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_send_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	sysarg_t conn_id;
-	void *data;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_send_srv())");
-
-	/* Receive message data */
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size > MAX_MSG_SIZE) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	data = malloc(size);
-	if (data == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, data, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	conn_id = ipc_get_arg1(icall);
-
-	rc = tcp_conn_send_impl(client, conn_id, data, size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	free(data);
-}
-
-/** Read received data from connection without blocking.
- *
- * Handle client request to read received data via connection without blocking.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_recv_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	sysarg_t conn_id;
-	size_t size, rsize;
-	void *data;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	size = min(size, 16384);
-	data = malloc(size);
-	if (data == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = tcp_conn_recv_impl(client, conn_id, data, size, &rsize);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, data, size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	async_answer_1(icall, EOK, rsize);
-	free(data);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_srv(): OK");
-}
-
-/** Read received data from connection with blocking.
- *
- * Handle client request to read received data via connection with blocking.
- *
- * @param client TCP client
- * @param icall  Async request data
- *
- */
-static void tcp_conn_recv_wait_srv(tcp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	sysarg_t conn_id;
-	size_t size, rsize;
-	void *data;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv()");
-
-	conn_id = ipc_get_arg1(icall);
-
-	if (!async_data_read_receive(&call, &size)) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - data_receive failed");
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	size = min(size, 16384);
-	data = malloc(size);
-	if (data == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - allocation failed");
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = tcp_conn_recv_impl(client, conn_id, data, size, &rsize);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - recv_impl failed rc=%s", str_error_name(rc));
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, data, size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv - finalize failed");
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv(): rsize=%zu", size);
-	async_answer_1(icall, EOK, rsize);
-	free(data);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_conn_recv_wait_srv(): OK");
-}
-
-/** Initialize TCP client structure.
- *
- * @param client TCP client
- */
-static void tcp_client_init(tcp_client_t *client)
-{
-	memset(client, 0, sizeof(tcp_client_t));
-	client->sess = NULL;
-	list_initialize(&client->cconn);
-	list_initialize(&client->clst);
-}
-
-/** Finalize TCP client structure.
- *
- * @param client TCP client
- */
-static void tcp_client_fini(tcp_client_t *client)
-{
-	tcp_cconn_t *cconn;
-	unsigned long n;
-
-	n = list_count(&client->cconn);
-	if (n != 0) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Client with %lu active "
-		    "connections closed session", n);
-
-		while (!list_empty(&client->cconn)) {
-			cconn = list_get_instance(list_first(&client->cconn),
-			    tcp_cconn_t, lclient);
-			tcp_uc_close(cconn->conn);
-			tcp_uc_delete(cconn->conn);
-			tcp_cconn_destroy(cconn);
-		}
-	}
-
-	n = list_count(&client->clst);
-	if (n != 0) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Client with %lu active "
-		    "listeners closed session", n);
-		/* XXX Destroy listeners */
-	}
-
-	if (client->sess != NULL)
-		async_hangup(client->sess);
-}
-
-/** Handle TCP client connection.
- *
- * @param icall Connect call data
- * @param arg   Connection argument
- *
- */
-static void tcp_client_conn(ipc_call_t *icall, void *arg)
-{
-	tcp_client_t client;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_client_conn() - client=%p",
-	    &client);
-
-	tcp_client_init(&client);
-
-	while (true) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_client_conn: wait req");
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_client_conn: method=%d",
-		    (int)method);
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case TCP_CALLBACK_CREATE:
-			tcp_callback_create_srv(&client, &call);
-			break;
-		case TCP_CONN_CREATE:
-			tcp_conn_create_srv(&client, &call);
-			break;
-		case TCP_CONN_DESTROY:
-			tcp_conn_destroy_srv(&client, &call);
-			break;
-		case TCP_LISTENER_CREATE:
-			tcp_listener_create_srv(&client, &call);
-			break;
-		case TCP_LISTENER_DESTROY:
-			tcp_listener_destroy_srv(&client, &call);
-			break;
-		case TCP_CONN_SEND_FIN:
-			tcp_conn_send_fin_srv(&client, &call);
-			break;
-		case TCP_CONN_PUSH:
-			tcp_conn_push_srv(&client, &call);
-			break;
-		case TCP_CONN_RESET:
-			tcp_conn_reset_srv(&client, &call);
-			break;
-		case TCP_CONN_SEND:
-			tcp_conn_send_srv(&client, &call);
-			break;
-		case TCP_CONN_RECV:
-			tcp_conn_recv_srv(&client, &call);
-			break;
-		case TCP_CONN_RECV_WAIT:
-			tcp_conn_recv_wait_srv(&client, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_client_conn TERMINATED");
-	tcp_client_fini(&client);
-}
-
-/** Initialize TCP service.
- *
- * @return EOK on success or an error code.
- */
-errno_t tcp_service_init(void)
-{
-	errno_t rc;
-	service_id_t sid;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(tcp_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
-		return EIO;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_TCP, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service.");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/service.h
===================================================================
--- uspace/srv/net/tcp/service.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file HelenOS service implementation
- */
-
-#ifndef SERVICE_H
-#define SERVICE_H
-
-extern errno_t tcp_service_init(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/std.h
===================================================================
--- uspace/srv/net/tcp/std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP header definitions
- *
- * Based on IETF RFC 793
- */
-
-#ifndef STD_H
-#define STD_H
-
-#include <stdint.h>
-#include <inet/addr.h>
-
-#define IP_PROTO_TCP  6
-
-/** TCP Header (fixed part) */
-typedef struct {
-	/** Source port */
-	uint16_t src_port;
-	/** Destination port */
-	uint16_t dest_port;
-	/** Sequence number */
-	uint32_t seq;
-	/** Acknowledgement number */
-	uint32_t ack;
-	/** Data Offset, Reserved, Flags */
-	uint16_t doff_flags;
-	/** Window */
-	uint16_t window;
-	/* Checksum */
-	uint16_t checksum;
-	/** Urgent pointer */
-	uint16_t urg_ptr;
-} tcp_header_t;
-
-/** Bits in tcp_header_t.doff_flags */
-enum doff_flags_bits {
-	DF_DATA_OFFSET_h	= 15,
-	DF_DATA_OFFSET_l	= 12,
-	DF_URG			= 5,
-	DF_ACK			= 4,
-	DF_PSH			= 3,
-	DF_RST			= 2,
-	DF_SYN			= 1,
-	DF_FIN			= 0
-};
-
-/** TCP over IPv4 checksum pseudo header */
-typedef struct {
-	/** Source address */
-	uint32_t src;
-	/** Destination address */
-	uint32_t dest;
-	/** Zero */
-	uint8_t zero;
-	/** Protocol */
-	uint8_t protocol;
-	/** TCP length */
-	uint16_t tcp_length;
-} tcp_phdr_t;
-
-/** TCP over IPv6 checksum pseudo header */
-typedef struct {
-	/** Source address */
-	addr128_t src;
-	/** Destination address */
-	addr128_t dest;
-	/** TCP length */
-	uint32_t tcp_length;
-	/** Zeroes */
-	uint8_t zeroes[3];
-	/** Next header */
-	uint8_t next;
-} tcp_phdr6_t;
-
-/** Option kind */
-enum opt_kind {
-	/** End of option list */
-	OPT_END_LIST		= 0,
-	/** No-operation */
-	OPT_NOP			= 1,
-	/** Maximum segment size */
-	OPT_MAX_SEG_SIZE	= 2
-};
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/tcp.c
===================================================================
--- uspace/srv/net/tcp/tcp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,118 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP (Transmission Control Protocol) network module
- */
-
-#include <async.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdio.h>
-#include <task.h>
-
-#include "conn.h"
-#include "inet.h"
-#include "ncsim.h"
-#include "rqueue.h"
-#include "service.h"
-#include "test.h"
-#include "ucall.h"
-
-#define NAME       "tcp"
-
-static tcp_rqueue_cb_t tcp_rqueue_cb = {
-	.seg_received = tcp_as_segment_arrived
-};
-
-static errno_t tcp_init(void)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_init()");
-
-	rc = tcp_conns_init();
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing connections");
-		return ENOMEM;
-	}
-
-	tcp_rqueue_init(&tcp_rqueue_cb);
-	tcp_rqueue_fibril_start();
-
-	tcp_ncsim_init();
-	tcp_ncsim_fibril_start();
-
-	if (0)
-		tcp_test();
-
-	rc = tcp_inet_init();
-	if (rc != EOK)
-		return ENOENT;
-
-	rc = tcp_service_init();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing service.");
-		return ENOENT;
-	}
-
-	return EOK;
-}
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-
-	printf(NAME ": TCP (Transmission Control Protocol) network module\n");
-
-	rc = log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed to initialize log.\n");
-		return 1;
-	}
-
-	rc = tcp_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/tcp_type.h
===================================================================
--- uspace/srv/net/tcp/tcp_type.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,395 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP type definitions
- */
-
-#ifndef TCP_TYPE_H
-#define TCP_TYPE_H
-
-#include <adt/list.h>
-#include <async.h>
-#include <stdbool.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <refcount.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <inet/addr.h>
-#include <inet/endpoint.h>
-
-struct tcp_conn;
-
-/** Connection state */
-typedef enum {
-	/** Listen */
-	st_listen,
-	/** Syn-sent */
-	st_syn_sent,
-	/** Syn-received */
-	st_syn_received,
-	/** Established */
-	st_established,
-	/** Fin-wait-1 */
-	st_fin_wait_1,
-	/** Fin-wait-2 */
-	st_fin_wait_2,
-	/** Close-wait */
-	st_close_wait,
-	/** Closing */
-	st_closing,
-	/** Last-ack */
-	st_last_ack,
-	/** Time-wait */
-	st_time_wait,
-	/** Closed */
-	st_closed
-} tcp_cstate_t;
-
-/** Error codes returned by TCP user calls (per the spec). */
-typedef enum {
-	/* OK */
-	TCP_EOK,
-	/* Connection aborted due to user timeout */
-	TCP_EABORTED,
-	/* Connection already exists */
-	TCP_EEXISTS,
-	/* Connection closing */
-	TCP_ECLOSING,
-	/* Connection does not exist */
-	TCP_ENOTEXIST,
-	/* Connection illegal for this process */
-	TCP_EILLEGAL,
-	/* Connection not open */
-	TCP_ENOTOPEN,
-	/* Connection reset */
-	TCP_ERESET,
-	/* Remote endpoint unspecified */
-	TCP_EUNSPEC,
-	/* Insufficient resources */
-	TCP_ENORES,
-	/* Precedence not allowed */
-	TCP_EINVPREC,
-	/* Security/compartment not allowed */
-	TCP_EINVCOMP,
-	TCP_EAGAIN
-} tcp_error_t;
-
-/** Transfer flags */
-typedef enum {
-	XF_PUSH		= 0x1,
-	XF_URGENT	= 0x2
-} xflags_t;
-
-/** Control message bits
- *
- * Note this is not the actual on-the-wire encoding
- */
-typedef enum {
-	CTL_SYN		= 0x1,
-	CTL_FIN		= 0x2,
-	CTL_RST		= 0x4,
-	CTL_ACK		= 0x8
-} tcp_control_t;
-
-/** Connection incoming segments queue */
-typedef struct {
-	struct tcp_conn *conn;
-	list_t list;
-} tcp_iqueue_t;
-
-/** Active or passive connection */
-typedef enum {
-	ap_active,
-	ap_passive
-} acpass_t;
-
-/** Flags for TCP open operation */
-typedef enum {
-	tcp_open_nonblock = 1
-} tcp_open_flags_t;
-
-typedef struct tcp_conn tcp_conn_t;
-
-/** Connection state change callback function */
-typedef void (*tcp_cstate_cb_t)(tcp_conn_t *, void *);
-
-/** Connection callbacks */
-typedef struct {
-	void (*cstate_change)(tcp_conn_t *, void *, tcp_cstate_t);
-	void (*recv_data)(tcp_conn_t *, void *);
-} tcp_cb_t;
-
-/** Data returned by Status user call */
-typedef struct {
-	/** Connection state */
-	tcp_cstate_t cstate;
-} tcp_conn_status_t;
-
-typedef struct {
-	/** SYN, FIN */
-	tcp_control_t ctrl;
-
-	/** Segment sequence number */
-	uint32_t seq;
-	/** Segment acknowledgement number */
-	uint32_t ack;
-	/** Segment length in sequence space */
-	uint32_t len;
-	/** Segment window */
-	uint32_t wnd;
-	/** Segment urgent pointer */
-	uint32_t up;
-
-	/** Segment data, may be moved when trimming segment */
-	void *data;
-	/** Segment data, original pointer used to free data */
-	void *dfptr;
-} tcp_segment_t;
-
-/** Receive queue entry */
-typedef struct {
-	link_t link;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-} tcp_rqueue_entry_t;
-
-/** Receive queue callbacks */
-typedef struct {
-	/** Segment received */
-	void (*seg_received)(inet_ep2_t *, tcp_segment_t *);
-} tcp_rqueue_cb_t;
-
-/** NCSim queue entry */
-typedef struct {
-	link_t link;
-	usec_t delay;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-} tcp_squeue_entry_t;
-
-/** Incoming queue entry */
-typedef struct {
-	link_t link;
-	tcp_segment_t *seg;
-} tcp_iqueue_entry_t;
-
-/** Retransmission queue entry */
-typedef struct {
-	link_t link;
-	tcp_conn_t *conn;
-	tcp_segment_t *seg;
-} tcp_tqueue_entry_t;
-
-/** Retransmission queue callbacks */
-typedef struct {
-	/** Segment received */
-	void (*transmit_seg)(inet_ep2_t *, tcp_segment_t *);
-} tcp_tqueue_cb_t;
-
-/** Retransmission queue */
-typedef struct {
-	struct tcp_conn *conn;
-	list_t list;
-
-	/** Retransmission timer */
-	fibril_timer_t *timer;
-
-	/** Callbacks */
-	tcp_tqueue_cb_t *cb;
-} tcp_tqueue_t;
-
-/** Connection */
-struct tcp_conn {
-	char *name;
-	link_t link;
-
-	/** Connection callbacks function */
-	tcp_cb_t *cb;
-	/** Argument to @c cstate_cb */
-	void *cb_arg;
-
-	/** Connection identification (local and remote endpoint) */
-	inet_ep2_t ident;
-	/** Connection is in association map */
-	bool mapped;
-
-	/** Active or passive connection */
-	acpass_t ap;
-
-	/** Protects access to connection structure */
-	fibril_mutex_t lock;
-	/** Reference count */
-	atomic_refcount_t refcnt;
-
-	/** Connection state */
-	tcp_cstate_t cstate;
-	/** True if connection was reset */
-	bool reset;
-	/** True if connection was deleted by user */
-	bool deleted;
-	/** Signalled when @c cstate changes */
-	fibril_condvar_t cstate_cv;
-
-	/** Set when FIN is removed from the retransmission queue */
-	bool fin_is_acked;
-
-	/** Queue of incoming segments */
-	tcp_iqueue_t incoming;
-
-	/** Retransmission queue */
-	tcp_tqueue_t retransmit;
-
-	/** Time-Wait timeout timer */
-	fibril_timer_t *tw_timer;
-
-	/** Receive buffer */
-	uint8_t *rcv_buf;
-	/** Receive buffer size */
-	size_t rcv_buf_size;
-	/** Receive buffer number of bytes used */
-	size_t rcv_buf_used;
-	/** Receive buffer contains FIN */
-	bool rcv_buf_fin;
-	/** Receive buffer CV. Broadcast when new data is inserted */
-	fibril_condvar_t rcv_buf_cv;
-
-	/** Send buffer */
-	uint8_t *snd_buf;
-	/** Send buffer size */
-	size_t snd_buf_size;
-	/** Send buffer number of bytes used */
-	size_t snd_buf_used;
-	/** Send buffer contains FIN */
-	bool snd_buf_fin;
-	/** Send buffer CV. Broadcast when space is made available in buffer */
-	fibril_condvar_t snd_buf_cv;
-
-	/** Send unacknowledged */
-	uint32_t snd_una;
-	/** Send next */
-	uint32_t snd_nxt;
-	/** Send window */
-	uint32_t snd_wnd;
-	/** Send urgent pointer */
-	uint32_t snd_up;
-	/** Segment sequence number used for last window update */
-	uint32_t snd_wl1;
-	/** Segment acknowledgement number used for last window update */
-	uint32_t snd_wl2;
-	/** Initial send sequence number */
-	uint32_t iss;
-
-	/** Receive next */
-	uint32_t rcv_nxt;
-	/** Receive window */
-	uint32_t rcv_wnd;
-	/** Receive urgent pointer */
-	uint32_t rcv_up;
-	/** Initial receive sequence number */
-	uint32_t irs;
-};
-
-/** Continuation of processing.
- *
- * When processing incoming segment, are we done or should we continue
- * processing it?
- */
-typedef enum {
-	cp_continue,
-	cp_done
-} cproc_t;
-
-/** Encoded PDU */
-typedef struct {
-	/** Source address */
-	inet_addr_t src;
-	/** Destination address */
-	inet_addr_t dest;
-	/** Encoded header */
-	void *header;
-	/** Encoded header size */
-	size_t header_size;
-	/** Text */
-	void *text;
-	/** Text size */
-	size_t text_size;
-} tcp_pdu_t;
-
-/** TCP client connection */
-typedef struct tcp_cconn {
-	/** Connection */
-	tcp_conn_t *conn;
-	/** Connection ID for the client */
-	sysarg_t id;
-	/** Client */
-	struct tcp_client *client;
-	link_t lclient;
-} tcp_cconn_t;
-
-/** TCP client listener */
-typedef struct tcp_clst {
-	/** Local endpoint */
-	inet_ep_t elocal;
-	/** Connection */
-	tcp_conn_t *conn;
-	/** Listener ID for the client */
-	sysarg_t id;
-	/** Client */
-	struct tcp_client *client;
-	/** Link to tcp_client_t.clst */
-	link_t lclient;
-} tcp_clst_t;
-
-/** TCP client */
-typedef struct tcp_client {
-	/** Client callback session */
-	async_sess_t *sess;
-	/** Client's connections */
-	list_t cconn; /* of tcp_cconn_t */
-	/** Client's listeners */
-	list_t clst;
-} tcp_client_t;
-
-/** Internal loopback type */
-typedef enum {
-	/** No loopback */
-	tcp_lb_none,
-	/** Segment loopback */
-	tcp_lb_segment,
-	/** PDU loopback */
-	tcp_lb_pdu
-} tcp_lb_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/test.c
===================================================================
--- uspace/srv/net/tcp/test.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,157 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file Internal TCP test
- */
-
-#include <async.h>
-#include <errno.h>
-#include <stdio.h>
-#include <fibril.h>
-#include <str.h>
-#include "tcp_type.h"
-#include "ucall.h"
-
-#include "test.h"
-
-#define RCV_BUF_SIZE 64
-
-static errno_t test_srv(void *arg)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	char rcv_buf[RCV_BUF_SIZE + 1];
-	size_t rcvd;
-	xflags_t xflags;
-
-	printf("test_srv()\n");
-
-	inet_ep2_init(&epp);
-
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = 80;
-
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = 1024;
-
-	printf("S: User open...\n");
-	tcp_uc_open(&epp, ap_passive, 0, &conn);
-	conn->name = (char *) "S";
-
-	while (true) {
-		printf("S: User receive...\n");
-		tcp_uc_receive(conn, rcv_buf, RCV_BUF_SIZE, &rcvd, &xflags);
-		if (rcvd == 0) {
-			printf("S: End of data reached.\n");
-			break;
-		}
-		rcv_buf[rcvd] = '\0';
-		printf("S: User received %zu bytes '%s'.\n", rcvd, rcv_buf);
-
-		fibril_usleep(1000 * 1000 * 2);
-	}
-
-	fibril_usleep(1000 * 1000);
-
-	printf("S: User close...\n");
-	tcp_uc_close(conn);
-
-	printf("test_srv() terminating\n");
-	return 0;
-}
-
-static errno_t test_cli(void *arg)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	const char *msg = "Hello World!";
-
-	printf("test_cli()\n");
-
-	inet_ep2_init(&epp);
-
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = 1024;
-
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = 80;
-
-	fibril_usleep(1000 * 1000 * 3);
-	printf("C: User open...\n");
-	tcp_uc_open(&epp, ap_active, 0, &conn);
-	conn->name = (char *) "C";
-
-	fibril_usleep(1000 * 1000 * 10);
-	printf("C: User send...\n");
-	tcp_uc_send(conn, (void *)msg, str_size(msg), 0);
-
-	fibril_usleep(1000 * 1000 * 20);
-	printf("C: User close...\n");
-	tcp_uc_close(conn);
-
-	return 0;
-}
-
-void tcp_test(void)
-{
-	fid_t srv_fid;
-	fid_t cli_fid;
-
-	printf("tcp_test()\n");
-
-	fibril_usleep(1000 * 1000);
-
-	if (0) {
-		srv_fid = fibril_create(test_srv, NULL);
-		if (srv_fid == 0) {
-			printf("Failed to create server fibril.\n");
-			return;
-		}
-
-		fibril_add_ready(srv_fid);
-	}
-
-	if (0) {
-		cli_fid = fibril_create(test_cli, NULL);
-		if (cli_fid == 0) {
-			printf("Failed to create client fibril.\n");
-			return;
-		}
-
-		fibril_add_ready(cli_fid);
-	}
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/test.h
===================================================================
--- uspace/srv/net/tcp/test.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file Internal TCP test
- */
-
-#ifndef TEST_H
-#define TEST_H
-
-extern void tcp_test(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/test/conn.c
===================================================================
--- uspace/srv/net/tcp/test/conn.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <pcut/pcut.h>
-
-#include "../conn.h"
-#include "../rqueue.h"
-#include "../ucall.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(conn);
-
-static tcp_rqueue_cb_t test_rqueue_cb = {
-	.seg_received = tcp_as_segment_arrived
-};
-
-PCUT_TEST_BEFORE
-{
-	errno_t rc;
-
-	/* We will be calling functions that perform logging */
-	rc = log_init("test-tcp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = tcp_conns_init();
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tcp_rqueue_init(&test_rqueue_cb);
-	tcp_rqueue_fibril_start();
-
-	/* Enable internal loopback */
-	tcp_conn_lb = tcp_lb_segment;
-}
-
-PCUT_TEST_AFTER
-{
-	tcp_rqueue_fini();
-	tcp_conns_fini();
-}
-
-/** Test creating and deleting connection */
-PCUT_TEST(new_delete)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	tcp_conn_lock(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	tcp_conn_delete(conn);
-}
-
-/** Test adding, finding and deleting a connection */
-PCUT_TEST(add_find_delete)
-{
-	tcp_conn_t *conn, *cfound;
-	inet_ep2_t epp;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	rc = tcp_conn_add(conn);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Find the connection */
-	cfound = tcp_conn_find_ref(&conn->ident);
-	PCUT_ASSERT_EQUALS(conn, cfound);
-	tcp_conn_delref(cfound);
-
-	/* We should have been assigned a port address, should not match */
-	cfound = tcp_conn_find_ref(&epp);
-	PCUT_ASSERT_EQUALS(NULL, cfound);
-
-	tcp_conn_lock(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	tcp_conn_delete(conn);
-}
-
-/** Test trying to connect to endpoint that sends RST back */
-PCUT_TEST(connect_rst)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = inet_port_user_lo;
-
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	rc = tcp_conn_add(conn);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(st_listen, conn->cstate);
-
-	tcp_conn_lock(conn);
-	tcp_conn_sync(conn);
-	PCUT_ASSERT_INT_EQUALS(st_syn_sent, conn->cstate);
-
-	while (conn->cstate == st_syn_sent)
-		fibril_condvar_wait(&conn->cstate_cv, &conn->lock);
-
-	PCUT_ASSERT_INT_EQUALS(st_closed, conn->cstate);
-
-	tcp_conn_unlock(conn);
-	tcp_conn_delete(conn);
-}
-
-/** Test establishing a connection */
-PCUT_TEST(conn_establish)
-{
-	tcp_conn_t *cconn, *sconn;
-	inet_ep2_t cepp, sepp;
-	errno_t rc;
-
-	/* Client EPP */
-	inet_ep2_init(&cepp);
-	inet_addr(&cepp.local.addr, 127, 0, 0, 1);
-	inet_addr(&cepp.remote.addr, 127, 0, 0, 1);
-	cepp.remote.port = inet_port_user_lo;
-
-	/* Server EPP */
-	inet_ep2_init(&sepp);
-	inet_addr(&sepp.local.addr, 127, 0, 0, 1);
-	sepp.local.port = inet_port_user_lo;
-
-	/* Client side of the connection */
-	cconn = tcp_conn_new(&cepp);
-	PCUT_ASSERT_NOT_NULL(cconn);
-
-	rc = tcp_conn_add(cconn);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(st_listen, cconn->cstate);
-	PCUT_ASSERT_FALSE(tcp_conn_got_syn(cconn));
-
-	/* Server side of the connection */
-	sconn = tcp_conn_new(&sepp);
-	PCUT_ASSERT_NOT_NULL(sconn);
-
-	rc = tcp_conn_add(sconn);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_INT_EQUALS(st_listen, sconn->cstate);
-	PCUT_ASSERT_FALSE(tcp_conn_got_syn(sconn));
-
-	/* Start establishing the connection */
-
-	tcp_conn_lock(cconn);
-	tcp_conn_sync(cconn);
-	PCUT_ASSERT_INT_EQUALS(st_syn_sent, cconn->cstate);
-	PCUT_ASSERT_FALSE(tcp_conn_got_syn(cconn));
-
-	/* Wait for client-side state to transition */
-	while (cconn->cstate == st_syn_sent)
-		fibril_condvar_wait(&cconn->cstate_cv, &cconn->lock);
-
-	PCUT_ASSERT_INT_EQUALS(st_established, cconn->cstate);
-	PCUT_ASSERT_TRUE(tcp_conn_got_syn(cconn));
-	tcp_conn_unlock(cconn);
-
-	/* Wait for server-side state to transition */
-	tcp_conn_lock(sconn);
-	while (sconn->cstate == st_listen || sconn->cstate == st_syn_received)
-		fibril_condvar_wait(&sconn->cstate_cv, &sconn->lock);
-
-	PCUT_ASSERT_INT_EQUALS(st_established, sconn->cstate);
-	PCUT_ASSERT_TRUE(tcp_conn_got_syn(sconn));
-
-	/* Verify counters */
-	PCUT_ASSERT_EQUALS(cconn->iss + 1, cconn->snd_nxt);
-	PCUT_ASSERT_EQUALS(cconn->iss + 1, cconn->snd_una);
-	PCUT_ASSERT_EQUALS(sconn->iss + 1, sconn->snd_nxt);
-	PCUT_ASSERT_EQUALS(sconn->iss + 1, sconn->snd_una);
-
-	tcp_conn_unlock(sconn);
-
-	tcp_conn_lock(cconn);
-	tcp_conn_reset(cconn);
-	tcp_conn_unlock(cconn);
-	tcp_conn_delete(cconn);
-
-	tcp_conn_lock(sconn);
-	tcp_conn_reset(sconn);
-	tcp_conn_unlock(sconn);
-	tcp_conn_delete(sconn);
-}
-
-PCUT_TEST(ep2_flipped)
-{
-	inet_ep2_t a, fa;
-
-	inet_addr(&a.local.addr, 1, 2, 3, 4);
-	a.local.port = 1234;
-	inet_addr(&a.remote.addr, 5, 6, 7, 8);
-	a.remote.port = 5678;
-
-	tcp_ep2_flipped(&a, &fa);
-
-	PCUT_ASSERT_INT_EQUALS(a.local.port, fa.remote.port);
-	PCUT_ASSERT_INT_EQUALS(a.remote.port, fa.local.port);
-
-	PCUT_ASSERT_TRUE(inet_addr_compare(&a.local.addr, &fa.remote.addr));
-	PCUT_ASSERT_TRUE(inet_addr_compare(&a.remote.addr, &fa.local.addr));
-}
-
-PCUT_EXPORT(conn);
Index: pace/srv/net/tcp/test/iqueue.c
===================================================================
--- uspace/srv/net/tcp/test/iqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,178 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <inet/endpoint.h>
-#include <pcut/pcut.h>
-
-#include "../conn.h"
-#include "../iqueue.h"
-#include "../segment.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(iqueue);
-
-/** Test empty queue */
-PCUT_TEST(empty_queue)
-{
-	tcp_conn_t *conn;
-	tcp_iqueue_t iqueue;
-	inet_ep2_t epp;
-	tcp_segment_t *rseg;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-
-	tcp_iqueue_init(&iqueue, conn);
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	tcp_conn_delete(conn);
-}
-
-/** Test iqeue with one segment */
-PCUT_TEST(one_segment)
-{
-	tcp_conn_t *conn;
-	tcp_iqueue_t iqueue;
-	inet_ep2_t epp;
-	tcp_segment_t *rseg;
-	tcp_segment_t *seg;
-	void *data;
-	size_t dsize;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	tcp_iqueue_init(&iqueue, conn);
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	seg->seq = 10;
-	tcp_iqueue_insert_seg(&iqueue, seg);
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	seg->seq = 15;
-	tcp_iqueue_insert_seg(&iqueue, seg);
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-	tcp_iqueue_remove_seg(&iqueue, seg);
-
-	tcp_segment_delete(seg);
-	free(data);
-	tcp_conn_delete(conn);
-}
-
-/** Test iqeue with two segments */
-PCUT_TEST(two_segments)
-{
-	tcp_conn_t *conn;
-	tcp_iqueue_t iqueue;
-	inet_ep2_t epp;
-	tcp_segment_t *rseg;
-	tcp_segment_t *seg1, *seg2;
-	void *data;
-	size_t dsize;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg1 = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg1);
-	seg2 = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg2);
-
-	tcp_iqueue_init(&iqueue, conn);
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	/* Test reception in ascending order */
-	seg1->seq = 5;
-	tcp_iqueue_insert_seg(&iqueue, seg1);
-	seg2->seq = 10;
-	tcp_iqueue_insert_seg(&iqueue, seg2);
-
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(rseg == seg1);
-
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_TRUE(rseg == seg2);
-
-	/* Test reception in descending order */
-	seg1->seq = 10;
-	tcp_iqueue_insert_seg(&iqueue, seg1);
-	seg2->seq = 5;
-	tcp_iqueue_insert_seg(&iqueue, seg2);
-
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(seg2, rseg);
-
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(seg1, rseg);
-
-	rc = tcp_iqueue_get_ready_seg(&iqueue, &rseg);
-	PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);
-
-	tcp_segment_delete(seg1);
-	tcp_segment_delete(seg2);
-	free(data);
-	tcp_conn_delete(conn);
-}
-
-PCUT_EXPORT(iqueue);
Index: pace/srv/net/tcp/test/main.c
===================================================================
--- uspace/srv/net/tcp/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <mem.h>
-#include <pcut/pcut.h>
-
-#include "main.h"
-#include "../segment.h"
-#include "../tcp_type.h"
-
-/** Verify that two segments have the same content */
-void test_seg_same(tcp_segment_t *a, tcp_segment_t *b)
-{
-	PCUT_ASSERT_INT_EQUALS(a->ctrl, b->ctrl);
-	PCUT_ASSERT_INT_EQUALS(a->seq, b->seq);
-	PCUT_ASSERT_INT_EQUALS(a->ack, b->ack);
-	PCUT_ASSERT_INT_EQUALS(a->len, b->len);
-	PCUT_ASSERT_INT_EQUALS(a->wnd, b->wnd);
-	PCUT_ASSERT_INT_EQUALS(a->up, b->up);
-	PCUT_ASSERT_INT_EQUALS(tcp_segment_text_size(a),
-	    tcp_segment_text_size(b));
-	if (tcp_segment_text_size(a) != 0)
-		PCUT_ASSERT_NOT_NULL(a->data);
-	if (tcp_segment_text_size(b) != 0)
-		PCUT_ASSERT_NOT_NULL(b->data);
-	if (tcp_segment_text_size(a) != 0) {
-		PCUT_ASSERT_INT_EQUALS(0, memcmp(a->data, b->data,
-		    tcp_segment_text_size(a)));
-	}
-}
-
-PCUT_INIT;
-
-PCUT_IMPORT(conn);
-PCUT_IMPORT(iqueue);
-PCUT_IMPORT(pdu);
-PCUT_IMPORT(rqueue);
-PCUT_IMPORT(segment);
-PCUT_IMPORT(seq_no);
-PCUT_IMPORT(tqueue);
-PCUT_IMPORT(ucall);
-
-PCUT_MAIN();
Index: pace/srv/net/tcp/test/main.h
===================================================================
--- uspace/srv/net/tcp/test/main.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file
- */
-
-#ifndef TEST_MAIN_H
-#define TEST_MAIN_H
-
-#include "../tcp_type.h"
-
-extern void test_seg_same(tcp_segment_t *, tcp_segment_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/test/pdu.c
===================================================================
--- uspace/srv/net/tcp/test/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,111 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <mem.h>
-#include <pcut/pcut.h>
-#include <stdlib.h>
-
-#include "main.h"
-#include "../pdu.h"
-#include "../segment.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(pdu);
-
-/** Test encode/decode round trip for control PDU */
-PCUT_TEST(encdec_syn)
-{
-	tcp_segment_t *seg, *dseg;
-	tcp_pdu_t *pdu;
-	inet_ep2_t epp, depp;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 1, 2, 3, 4);
-	inet_addr(&epp.remote.addr, 5, 6, 7, 8);
-
-	seg = tcp_segment_make_ctrl(CTL_SYN);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	rc = tcp_pdu_encode(&epp, seg, &pdu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = tcp_pdu_decode(pdu, &depp, &dseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	test_seg_same(seg, dseg);
-	tcp_segment_delete(seg);
-}
-
-/** Test encode/decode round trip for data PDU */
-PCUT_TEST(encdec_data)
-{
-	tcp_segment_t *seg, *dseg;
-	tcp_pdu_t *pdu;
-	inet_ep2_t epp, depp;
-	uint8_t *data;
-	size_t i, dsize;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 1, 2, 3, 4);
-	inet_addr(&epp.remote.addr, 5, 6, 7, 8);
-
-	dsize = 15;
-	data = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	for (i = 0; i < dsize; i++)
-		data[i] = (uint8_t) i;
-
-	seg = tcp_segment_make_data(CTL_SYN, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	rc = tcp_pdu_encode(&epp, seg, &pdu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = tcp_pdu_decode(pdu, &depp, &dseg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	test_seg_same(seg, dseg);
-	tcp_segment_delete(seg);
-	free(data);
-}
-
-PCUT_EXPORT(pdu);
Index: pace/srv/net/tcp/test/rqueue.c
===================================================================
--- uspace/srv/net/tcp/test/rqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <adt/prodcons.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <pcut/pcut.h>
-
-#include "../rqueue.h"
-#include "../segment.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(rqueue);
-
-enum {
-	test_seg_max = 10
-};
-
-static void test_seg_received(inet_ep2_t *, tcp_segment_t *);
-
-static tcp_rqueue_cb_t rcb = {
-	.seg_received = test_seg_received
-};
-
-static int seg_cnt;
-static tcp_segment_t *recv_seg[test_seg_max];
-
-static void test_seg_received(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	recv_seg[seg_cnt++] = seg;
-}
-
-PCUT_TEST_BEFORE
-{
-	errno_t rc;
-
-	/* We will be calling functions that perform logging */
-	rc = log_init("test-tcp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-/** Test empty queue */
-PCUT_TEST(init_fini)
-{
-	tcp_rqueue_init(&rcb);
-	tcp_rqueue_fibril_start();
-	tcp_rqueue_fini();
-}
-
-/** Test one segment */
-PCUT_TEST(one_segment)
-{
-	tcp_segment_t *seg;
-	inet_ep2_t epp;
-
-	tcp_rqueue_init(&rcb);
-	seg_cnt = 0;
-
-	seg = tcp_segment_make_ctrl(CTL_SYN);
-	PCUT_ASSERT_NOT_NULL(seg);
-	inet_ep2_init(&epp);
-
-	tcp_rqueue_insert_seg(&epp, seg);
-	tcp_rqueue_fibril_start();
-	tcp_rqueue_fini();
-
-	PCUT_ASSERT_INT_EQUALS(1, seg_cnt);
-	PCUT_ASSERT_EQUALS(seg, recv_seg[0]);
-
-	tcp_segment_delete(seg);
-}
-
-/** Test multiple segments */
-PCUT_TEST(multiple_segments)
-{
-	tcp_segment_t *seg[test_seg_max];
-	inet_ep2_t epp;
-	int i;
-
-	tcp_rqueue_init(&rcb);
-	seg_cnt = 0;
-
-	inet_ep2_init(&epp);
-
-	tcp_rqueue_fibril_start();
-
-	for (i = 0; i < test_seg_max; i++) {
-		seg[i] = tcp_segment_make_ctrl(CTL_ACK);
-		PCUT_ASSERT_NOT_NULL(seg[i]);
-		tcp_rqueue_insert_seg(&epp, seg[i]);
-	}
-
-	tcp_rqueue_fini();
-
-	PCUT_ASSERT_INT_EQUALS(test_seg_max, seg_cnt);
-	for (i = 0; i < test_seg_max; i++) {
-		PCUT_ASSERT_EQUALS(seg[i], recv_seg[i]);
-		tcp_segment_delete(seg[i]);
-	}
-
-}
-
-PCUT_EXPORT(rqueue);
Index: pace/srv/net/tcp/test/segment.c
===================================================================
--- uspace/srv/net/tcp/test/segment.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,247 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-#include "main.h"
-#include "../segment.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(segment);
-
-/** Test create/destroy control segment */
-PCUT_TEST(ctrl_seg_mkdel)
-{
-	tcp_segment_t *seg;
-
-	seg = tcp_segment_make_ctrl(CTL_SYN);
-	PCUT_ASSERT_NOT_NULL(seg);
-	tcp_segment_delete(seg);
-}
-
-/** Test create/destroy data segment */
-PCUT_TEST(data_seg_mkdel)
-{
-	tcp_segment_t *seg;
-	uint8_t *data;
-	size_t i, dsize;
-
-	dsize = 15;
-	data = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	for (i = 0; i < dsize; i++)
-		data[i] = (uint8_t) i;
-
-	seg = tcp_segment_make_data(CTL_SYN, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	tcp_segment_delete(seg);
-	free(data);
-}
-
-/** Test create/duplicate/destroy control segment */
-PCUT_TEST(ctrl_seg_dup)
-{
-	tcp_segment_t *seg, *dup;
-
-	seg = tcp_segment_make_ctrl(CTL_SYN);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	dup = tcp_segment_dup(seg);
-	test_seg_same(seg, dup);
-
-	tcp_segment_delete(seg);
-	tcp_segment_delete(dup);
-}
-
-/** Test create/duplicate/destroy data segment */
-PCUT_TEST(data_seg_dup)
-{
-	tcp_segment_t *seg, *dup;
-	uint8_t *data;
-	size_t i, dsize;
-
-	dsize = 15;
-	data = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	for (i = 0; i < dsize; i++)
-		data[i] = (uint8_t) i;
-
-	seg = tcp_segment_make_data(CTL_SYN, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	dup = tcp_segment_dup(seg);
-	test_seg_same(seg, dup);
-
-	tcp_segment_delete(seg);
-	tcp_segment_delete(dup);
-	free(data);
-}
-
-/** Test reset segment for segment with ACK not set */
-PCUT_TEST(noack_seg_rst)
-{
-	tcp_segment_t *seg, *rst;
-
-	seg = tcp_segment_make_ctrl(CTL_SYN);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	rst = tcp_segment_make_rst(seg);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	tcp_segment_delete(seg);
-	tcp_segment_delete(rst);
-}
-
-/** Test reset segment for segment with ACK set */
-PCUT_TEST(ack_seg_rst)
-{
-	tcp_segment_t *seg, *rst;
-
-	seg = tcp_segment_make_ctrl(CTL_SYN | CTL_ACK);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 20;
-	seg->ack = 19;
-	seg->wnd = 18;
-	seg->up = 17;
-
-	rst = tcp_segment_make_rst(seg);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	tcp_segment_delete(seg);
-	tcp_segment_delete(rst);
-}
-
-/** Test copying out data segment text */
-PCUT_TEST(data_seg_text)
-{
-	tcp_segment_t *seg;
-	uint8_t *data;
-	uint8_t *cdata;
-	size_t i, dsize;
-
-	dsize = 15;
-	data = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(data);
-	cdata = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(cdata);
-
-	for (i = 0; i < dsize; i++)
-		data[i] = (uint8_t) i;
-
-	seg = tcp_segment_make_data(CTL_SYN, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	PCUT_ASSERT_INT_EQUALS(dsize, tcp_segment_text_size(seg));
-	tcp_segment_text_copy(seg, cdata, dsize);
-
-	for (i = 0; i < dsize; i++)
-		PCUT_ASSERT_INT_EQUALS(data[i], cdata[i]);
-
-	tcp_segment_delete(seg);
-	free(data);
-	free(cdata);
-}
-
-/** Test trimming data segment text */
-PCUT_TEST(data_seg_trim)
-{
-	tcp_segment_t *seg;
-	uint8_t *data;
-	uint8_t *cdata;
-	size_t i, dsize;
-
-	dsize = 15;
-	data = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(data);
-	cdata = malloc(dsize);
-	PCUT_ASSERT_NOT_NULL(cdata);
-
-	for (i = 0; i < dsize; i++)
-		data[i] = (uint8_t) i;
-
-	seg = tcp_segment_make_data(CTL_SYN | CTL_FIN, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	PCUT_ASSERT_INT_EQUALS(dsize, tcp_segment_text_size(seg));
-	tcp_segment_text_copy(seg, cdata, dsize);
-
-	for (i = 0; i < dsize; i++)
-		PCUT_ASSERT_INT_EQUALS(data[i], cdata[i]);
-
-	PCUT_ASSERT_INT_EQUALS(CTL_SYN | CTL_FIN, seg->ctrl);
-
-	tcp_segment_trim(seg, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(CTL_FIN, seg->ctrl);
-	PCUT_ASSERT_INT_EQUALS(dsize, tcp_segment_text_size(seg));
-
-	tcp_segment_trim(seg, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(0, seg->ctrl);
-	PCUT_ASSERT_INT_EQUALS(dsize, tcp_segment_text_size(seg));
-
-	tcp_segment_trim(seg, 1, 0);
-	PCUT_ASSERT_INT_EQUALS(0, seg->ctrl);
-	PCUT_ASSERT_INT_EQUALS(dsize - 1, tcp_segment_text_size(seg));
-
-	tcp_segment_text_copy(seg, cdata, dsize - 1);
-	for (i = 0; i < dsize - 1; i++)
-		PCUT_ASSERT_INT_EQUALS(data[i + 1], cdata[i]);
-
-	tcp_segment_trim(seg, 0, 1);
-	PCUT_ASSERT_INT_EQUALS(0, seg->ctrl);
-	PCUT_ASSERT_INT_EQUALS(dsize - 2, tcp_segment_text_size(seg));
-
-	tcp_segment_text_copy(seg, cdata, dsize - 2);
-	for (i = 0; i < dsize - 2; i++)
-		PCUT_ASSERT_INT_EQUALS(data[i + 1], cdata[i]);
-
-	tcp_segment_delete(seg);
-	free(data);
-	free(cdata);
-}
-
-PCUT_EXPORT(segment);
Index: pace/srv/net/tcp/test/seq_no.c
===================================================================
--- uspace/srv/net/tcp/test/seq_no.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,549 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <pcut/pcut.h>
-
-#include "../conn.h"
-#include "../segment.h"
-#include "../seq_no.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(seq_no);
-
-/** Test seq_no_ack_acceptable() */
-PCUT_TEST(ack_acceptable)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	/* ACK is acceptable iff SND.UNA < SEG.ACK <= SND.NXT */
-
-	conn->snd_una = 10;
-	conn->snd_nxt = 30;
-
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 9));
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 10));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 11));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 29));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 30));
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 31));
-
-	/* We also test whether seq_no_lt_le() wraps around properly */
-
-	conn->snd_una = 30;
-	conn->snd_nxt = 10;
-
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 29));
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 30));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 31));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 9));
-	PCUT_ASSERT_TRUE(seq_no_ack_acceptable(conn, 10));
-	PCUT_ASSERT_FALSE(seq_no_ack_acceptable(conn, 11));
-
-	tcp_conn_delete(conn);
-}
-
-/** Test seq_no_ack_duplicate() */
-PCUT_TEST(ack_duplicate)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	/* ACK is duplicate iff SEG.ACK <= SND.UNA */
-
-	conn->snd_una = 10;
-
-	PCUT_ASSERT_TRUE(seq_no_ack_duplicate(conn, 9));
-	PCUT_ASSERT_TRUE(seq_no_ack_duplicate(conn, 10));
-	PCUT_ASSERT_FALSE(seq_no_ack_duplicate(conn, 11));
-
-	conn->snd_una = (uint32_t) -10;
-
-	PCUT_ASSERT_TRUE(seq_no_ack_duplicate(conn, (uint32_t) -11));
-	PCUT_ASSERT_TRUE(seq_no_ack_duplicate(conn, (uint32_t) -10));
-	PCUT_ASSERT_FALSE(seq_no_ack_duplicate(conn, (uint32_t) -9));
-
-	tcp_conn_delete(conn);
-}
-
-/** Test seq_no_in_rcv_wnd() */
-PCUT_TEST(in_rcv_wnd)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	/* In receive window iff RCV.WND <= SEG.SEQ <= SND.UNA */
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 9));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 10));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 11));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 29));
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 30));
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 31));
-
-	/* We also test whether seq_no_le_lt() wraps around properly */
-
-	conn->rcv_nxt = 20;
-	conn->rcv_wnd = (uint32_t) -10;
-
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 19));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 20));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 21));
-	PCUT_ASSERT_TRUE(seq_no_in_rcv_wnd(conn, 9));
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 10));
-	PCUT_ASSERT_FALSE(seq_no_in_rcv_wnd(conn, 11));
-
-	tcp_conn_delete(conn);
-}
-
-/** Test seq_no_new_wnd_update() */
-PCUT_TEST(new_wnd_update)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	/*
-	 * Segment must be acceptable. Segment has new window update iff
-	 * either SND.WL1 < SEG.SEQ or
-	 * (SND.WL1 = SEG.SEQ and SND.WL2 <= SEG.ACK)
-	 */
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-	conn->snd_una = 30;
-	conn->snd_wnd = 40;
-	conn->snd_wl1 = 15;
-	conn->snd_wl2 = 60;
-
-	seg = tcp_segment_make_ctrl(CTL_ACK);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	seg->seq = 14;
-	seg->ack = 80;
-	PCUT_ASSERT_FALSE(seq_no_new_wnd_update(conn, seg));
-
-	seg->seq = 15;
-	seg->ack = 59;
-	PCUT_ASSERT_FALSE(seq_no_new_wnd_update(conn, seg));
-
-	seg->seq = 15;
-	seg->ack = 60;
-	PCUT_ASSERT_TRUE(seq_no_new_wnd_update(conn, seg));
-
-	seg->seq = 16;
-	seg->ack = 50;
-	PCUT_ASSERT_TRUE(seq_no_new_wnd_update(conn, seg));
-
-	tcp_segment_delete(seg);
-	tcp_conn_delete(conn);
-}
-
-/** Test seq_no_segment_acked() */
-PCUT_TEST(segment_acked)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-	uint8_t *data;
-	size_t dsize;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	/* Segment is acked iff SEG.SEQ + SEG.LEN <= SND.UNA */
-
-	seg->seq = 10;
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	PCUT_ASSERT_FALSE(seq_no_segment_acked(conn, seg, 24));
-	PCUT_ASSERT_TRUE(seq_no_segment_acked(conn, seg, 25));
-
-	tcp_segment_delete(seg);
-	tcp_conn_delete(conn);
-	free(data);
-}
-
-/** Test seq_no_syn_acked() */
-PCUT_TEST(syn_acked)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->iss = 1;
-	conn->snd_una = 1;
-	conn->snd_nxt = 2;
-
-	PCUT_ASSERT_FALSE(seq_no_syn_acked(conn));
-
-	conn->snd_una = 2;
-	PCUT_ASSERT_TRUE(seq_no_syn_acked(conn));
-
-	tcp_conn_delete(conn);
-}
-
-/** Test seq_no_segment_ready() */
-PCUT_TEST(segment_ready)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-	uint8_t *data;
-	size_t dsize;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	/* Segment must be acceptable. Ready iff intersects RCV.NXT */
-
-	conn->rcv_nxt = 30;
-	conn->rcv_wnd = 20;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	seg->seq = 16;
-	PCUT_ASSERT_TRUE(seq_no_segment_ready(conn, seg));
-
-	seg->seq = 17;
-	PCUT_ASSERT_TRUE(seq_no_segment_ready(conn, seg));
-
-	seg->seq = 29;
-	PCUT_ASSERT_TRUE(seq_no_segment_ready(conn, seg));
-
-	seg->seq = 30;
-	PCUT_ASSERT_TRUE(seq_no_segment_ready(conn, seg));
-
-	seg->seq = 31;
-	PCUT_ASSERT_FALSE(seq_no_segment_ready(conn, seg));
-
-	tcp_segment_delete(seg);
-	tcp_conn_delete(conn);
-	free(data);
-}
-
-/** Test seq_no_segment_acceptable() */
-PCUT_TEST(segment_acceptable)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-	uint8_t *data;
-	size_t dsize;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	/* Segment acceptable iff overlaps receive window */
-
-	/* Segment shorter than receive window */
-	conn->rcv_nxt = 30;
-	conn->rcv_wnd = 20;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	seg->seq = 10;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 15;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 16;
-	PCUT_ASSERT_TRUE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 49;
-	PCUT_ASSERT_TRUE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 50;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	/* Segment longer than receive window */
-	conn->rcv_nxt = 30;
-	conn->rcv_wnd = 10;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	seg->seq = 10;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 15;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 16;
-	PCUT_ASSERT_TRUE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 39;
-	PCUT_ASSERT_TRUE(seq_no_segment_acceptable(conn, seg));
-
-	seg->seq = 40;
-	PCUT_ASSERT_FALSE(seq_no_segment_acceptable(conn, seg));
-
-	tcp_segment_delete(seg);
-	tcp_conn_delete(conn);
-	free(data);
-}
-
-/** Test seq_no_seg_trim_calc() */
-PCUT_TEST(seg_trim_calc)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg;
-	uint8_t *data;
-	size_t dsize;
-	uint32_t ltrim, rtrim;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg);
-
-	/* Segment must be acceptable, amount of trim needed */
-
-	/* Segment shorter than receive window */
-	conn->rcv_nxt = 30;
-	conn->rcv_wnd = 20;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	seg->seq = 16;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(14, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 17;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(13, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 29;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(1, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 30;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 31;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 35;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 36;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(1, rtrim);
-
-	seg->seq = 37;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(2, rtrim);
-
-	seg->seq = 48;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(13, rtrim);
-
-	seg->seq = 49;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(0, ltrim);
-	PCUT_ASSERT_INT_EQUALS(14, rtrim);
-
-	/* Segment longer than receive window */
-	conn->rcv_nxt = 30;
-	conn->rcv_wnd = 10;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg->len);
-
-	seg->seq = 16;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(14, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 17;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(13, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 24;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(6, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 25;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(5, ltrim);
-	PCUT_ASSERT_INT_EQUALS(0, rtrim);
-
-	seg->seq = 26;
-	seq_no_seg_trim_calc(conn, seg, &ltrim, &rtrim);
-	PCUT_ASSERT_INT_EQUALS(4, ltrim);
-	PCUT_ASSERT_INT_EQUALS(1, rtrim);
-
-	tcp_segment_delete(seg);
-	tcp_conn_delete(conn);
-	free(data);
-}
-
-/** Test seq_no_seg_cmp() */
-PCUT_TEST(seg_cmp)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_segment_t *seg1, *seg2;
-	uint8_t *data;
-	size_t dsize;
-
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	dsize = 15;
-	data = calloc(dsize, 1);
-	PCUT_ASSERT_NOT_NULL(data);
-
-	seg1 = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg1);
-	seg2 = tcp_segment_make_data(0, data, dsize);
-	PCUT_ASSERT_NOT_NULL(seg2);
-
-	/* Both segments must be acceptable */
-
-	conn->rcv_nxt = 10;
-	conn->rcv_wnd = 20;
-
-	PCUT_ASSERT_INT_EQUALS(dsize, seg1->len);
-	PCUT_ASSERT_INT_EQUALS(dsize, seg2->len);
-
-	seg1->seq = 5;
-	seg2->seq = 6;
-	PCUT_ASSERT_INT_EQUALS(-1, seq_no_seg_cmp(conn, seg1, seg2));
-
-	seg1->seq = 6;
-	seg2->seq = 6;
-	PCUT_ASSERT_INT_EQUALS(0, seq_no_seg_cmp(conn, seg1, seg2));
-
-	seg1->seq = 6;
-	seg2->seq = 5;
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_seg_cmp(conn, seg1, seg2));
-
-	tcp_segment_delete(seg1);
-	tcp_segment_delete(seg2);
-	tcp_conn_delete(conn);
-	free(data);
-}
-
-/** Test seq_no_control_len() */
-PCUT_TEST(control_len)
-{
-	PCUT_ASSERT_INT_EQUALS(0, seq_no_control_len(0));
-	PCUT_ASSERT_INT_EQUALS(0, seq_no_control_len(CTL_ACK));
-	PCUT_ASSERT_INT_EQUALS(0, seq_no_control_len(CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(0, seq_no_control_len(CTL_ACK | CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_SYN));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_FIN));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_SYN | CTL_ACK));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_FIN | CTL_ACK));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_SYN | CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_FIN | CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_SYN | CTL_ACK |
-	    CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(1, seq_no_control_len(CTL_FIN | CTL_ACK |
-	    CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(2, seq_no_control_len(CTL_SYN | CTL_FIN));
-	PCUT_ASSERT_INT_EQUALS(2, seq_no_control_len(CTL_SYN | CTL_FIN |
-	    CTL_ACK));
-	PCUT_ASSERT_INT_EQUALS(2, seq_no_control_len(CTL_SYN | CTL_FIN |
-	    CTL_RST));
-	PCUT_ASSERT_INT_EQUALS(2, seq_no_control_len(CTL_SYN | CTL_FIN |
-	    CTL_ACK | CTL_RST));
-}
-
-PCUT_EXPORT(seq_no);
Index: pace/srv/net/tcp/test/tqueue.c
===================================================================
--- uspace/srv/net/tcp/test/tqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,265 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-//#include <inet/endpoint.h>
-#include <io/log.h>
-#include <pcut/pcut.h>
-
-#include "../conn.h"
-#include "../segment.h"
-#include "../tqueue.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(tqueue);
-
-enum {
-	test_seg_max = 10
-};
-
-static int seg_cnt;
-static tcp_segment_t *trans_seg[test_seg_max];
-
-static void tqueue_test_transmit_seg(inet_ep2_t *, tcp_segment_t *);
-
-static tcp_tqueue_cb_t tqueue_test_cb = {
-	.transmit_seg = tqueue_test_transmit_seg
-};
-
-PCUT_TEST_BEFORE
-{
-	errno_t rc;
-
-	/* We will be calling functions that perform logging */
-	rc = log_init("test-tcp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = tcp_conns_init();
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_TEST_AFTER
-{
-	tcp_conns_fini();
-}
-
-/** Test  */
-PCUT_TEST(init_fini)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	/* XXX tqueue can only be created via tcp_conn_new */
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	/* Redirect segment transmission */
-	conn->retransmit.cb = &tqueue_test_cb;
-	seg_cnt = 0;
-
-	tcp_conn_lock(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	tcp_conn_delete(conn);
-	PCUT_ASSERT_EQUALS(0, seg_cnt);
-}
-
-/** Test sending control segment and tearing down a non-empty queue */
-PCUT_TEST(ctrl_seg_teardown)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-
-	/* XXX tqueue can only be created via tcp_conn_new */
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->snd_nxt = 10;
-
-	/* Redirect segment transmission */
-	conn->retransmit.cb = &tqueue_test_cb;
-	seg_cnt = 0;
-
-	tcp_conn_lock(conn);
-	tcp_tqueue_ctrl_seg(conn, CTL_SYN);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	PCUT_ASSERT_EQUALS(11, conn->snd_nxt);
-
-	tcp_conn_delete(conn);
-	PCUT_ASSERT_EQUALS(1, seg_cnt);
-	PCUT_ASSERT_EQUALS(CTL_SYN, trans_seg[0]->ctrl);
-	PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
-	tcp_segment_delete(trans_seg[0]);
-}
-
-/** Test sending data and FIN */
-PCUT_TEST(new_data_fin)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	int i;
-
-	/* XXX tqueue can only be created via tcp_conn_new */
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->cstate = st_established;
-	conn->snd_una = 10;
-	conn->snd_nxt = 10;
-	conn->snd_wnd = 1024;
-	conn->snd_buf_used = 20;
-	conn->snd_buf_fin = true;
-	for (i = 0; i < 20; i++)
-		conn->snd_buf[i] = i;
-
-	/* Redirect segment transmission */
-	conn->retransmit.cb = &tqueue_test_cb;
-	seg_cnt = 0;
-
-	tcp_conn_lock(conn);
-	tcp_tqueue_new_data(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	PCUT_ASSERT_EQUALS(31, conn->snd_nxt);
-	PCUT_ASSERT_EQUALS(0, conn->snd_buf_used);
-	PCUT_ASSERT_FALSE(conn->snd_buf_fin);
-
-	tcp_conn_delete(conn);
-	PCUT_ASSERT_EQUALS(1, seg_cnt);
-	PCUT_ASSERT_EQUALS(CTL_FIN | CTL_ACK, trans_seg[0]->ctrl);
-	PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
-	tcp_segment_delete(trans_seg[0]);
-}
-
-/** Test sending data when send window is smaller */
-PCUT_TEST(new_data_small_win)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	int i;
-
-	/* XXX tqueue can only be created via tcp_conn_new */
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->cstate = st_established;
-	conn->snd_una = 10;
-	conn->snd_nxt = 10;
-	conn->snd_wnd = 5;
-	conn->snd_buf_used = 30;
-	conn->snd_buf_fin = false;
-	for (i = 0; i < 30; i++)
-		conn->snd_buf[i] = i;
-
-	/* Redirect segment transmission */
-	conn->retransmit.cb = &tqueue_test_cb;
-	seg_cnt = 0;
-
-	tcp_conn_lock(conn);
-	tcp_tqueue_new_data(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-
-	PCUT_ASSERT_EQUALS(15, conn->snd_nxt);
-	PCUT_ASSERT_EQUALS(25, conn->snd_buf_used);
-	PCUT_ASSERT_FALSE(conn->snd_buf_fin);
-	for (i = 0; i < 25; i++)
-		PCUT_ASSERT_INT_EQUALS(5 + i, conn->snd_buf[i]);
-
-	tcp_conn_delete(conn);
-	PCUT_ASSERT_EQUALS(1, seg_cnt);
-	PCUT_ASSERT_EQUALS(CTL_ACK, trans_seg[0]->ctrl);
-	PCUT_ASSERT_EQUALS(10, trans_seg[0]->seq);
-	tcp_segment_delete(trans_seg[0]);
-}
-
-/** Test flushing tqueue due to receiving an ACK */
-PCUT_TEST(ack_received)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	int i;
-
-	/* XXX tqueue can only be created via tcp_conn_new */
-	inet_ep2_init(&epp);
-	conn = tcp_conn_new(&epp);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	conn->cstate = st_established;
-	conn->snd_una = 10;
-	conn->snd_nxt = 10;
-	conn->snd_wnd = 1024;
-
-	/* Redirect segment transmission */
-	conn->retransmit.cb = &tqueue_test_cb;
-	seg_cnt = 0;
-
-	tcp_conn_lock(conn);
-
-	/* Queue first data segment */
-	conn->snd_buf_used = 10;
-	conn->snd_buf_fin = false;
-	for (i = 0; i < 10; i++)
-		conn->snd_buf[i] = i;
-	tcp_tqueue_new_data(conn);
-
-	PCUT_ASSERT_EQUALS(20, conn->snd_nxt);
-
-	/* Queue second data segment */
-	conn->snd_buf_used = 20;
-	conn->snd_buf_fin = false;
-	for (i = 0; i < 20; i++)
-		conn->snd_buf[i] = i;
-	tcp_tqueue_new_data(conn);
-
-	PCUT_ASSERT_EQUALS(40, conn->snd_nxt);
-
-	PCUT_ASSERT_INT_EQUALS(2, list_count(&conn->retransmit.list));
-
-	/* One of the two segments is acked */
-	conn->snd_una = 20;
-	tcp_tqueue_ack_received(conn);
-
-	PCUT_ASSERT_INT_EQUALS(1, list_count(&conn->retransmit.list));
-
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-	tcp_conn_delete(conn);
-}
-
-static void tqueue_test_transmit_seg(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	trans_seg[seg_cnt++] = tcp_segment_dup(seg);
-}
-
-PCUT_EXPORT(tqueue);
Index: pace/srv/net/tcp/test/ucall.c
===================================================================
--- uspace/srv/net/tcp/test/ucall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,317 +1,0 @@
-/*
- * Copyright (c) 2017 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <pcut/pcut.h>
-
-#include "../conn.h"
-#include "../rqueue.h"
-#include "../ucall.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(ucall);
-
-static void test_cstate_change(tcp_conn_t *, void *, tcp_cstate_t);
-static void test_conns_establish(tcp_conn_t **, tcp_conn_t **);
-static void test_conns_tear_down(tcp_conn_t *, tcp_conn_t *);
-
-static tcp_rqueue_cb_t test_rqueue_cb = {
-	.seg_received = tcp_as_segment_arrived
-};
-
-static tcp_cb_t test_conn_cb = {
-	.cstate_change = test_cstate_change
-};
-
-static tcp_conn_status_t cconn_status;
-static tcp_conn_status_t sconn_status;
-
-static FIBRIL_MUTEX_INITIALIZE(cst_lock);
-static FIBRIL_CONDVAR_INITIALIZE(cst_cv);
-
-PCUT_TEST_BEFORE
-{
-	errno_t rc;
-
-	/* We will be calling functions that perform logging */
-	rc = log_init("test-tcp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = tcp_conns_init();
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	tcp_rqueue_init(&test_rqueue_cb);
-	tcp_rqueue_fibril_start();
-
-	/* Enable internal loopback */
-	tcp_conn_lb = tcp_lb_segment;
-}
-
-PCUT_TEST_AFTER
-{
-	tcp_rqueue_fini();
-	tcp_conns_fini();
-}
-
-/** Test creating a listening passive connection and then deleting it. */
-PCUT_TEST(listen_delete)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_error_t trc;
-	tcp_conn_status_t cstatus;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = inet_port_user_lo;
-
-	conn = NULL;
-	trc = tcp_uc_open(&epp, ap_passive, tcp_open_nonblock, &conn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-	PCUT_ASSERT_NOT_NULL(conn);
-
-	tcp_uc_status(conn, &cstatus);
-	PCUT_ASSERT_INT_EQUALS(st_listen, cstatus.cstate);
-
-	trc = tcp_uc_close(conn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-	tcp_uc_delete(conn);
-}
-
-/** Test trying to connect to endpoint that sends RST back */
-PCUT_TEST(connect_rst)
-{
-	tcp_conn_t *conn;
-	inet_ep2_t epp;
-	tcp_error_t trc;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = inet_port_user_lo;
-
-	conn = NULL;
-	trc = tcp_uc_open(&epp, ap_active, 0, &conn);
-	PCUT_ASSERT_INT_EQUALS(TCP_ERESET, trc);
-	PCUT_ASSERT_NULL(conn);
-}
-
-/** Test establishing a connection */
-PCUT_TEST(conn_establish)
-{
-	tcp_conn_t *cconn, *sconn;
-
-	test_conns_establish(&cconn, &sconn);
-	test_conns_tear_down(cconn, sconn);
-}
-
-/** Test establishing and then closing down a connection first on one side,
- * then on_the other.
- */
-PCUT_TEST(conn_est_close_seq)
-{
-	tcp_conn_t *cconn, *sconn;
-	tcp_error_t trc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: establish");
-	/* Establish */
-	test_conns_establish(&cconn, &sconn);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: close cconn");
-	/* Close client side */
-	trc = tcp_uc_close(cconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: wait cconn = fin-wait-2");
-	/* Wait for cconn to go to Fin-Wait-2 */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(cconn, &cconn_status);
-	while (cconn_status.cstate != st_fin_wait_2)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: wait sconn = close-wait");
-	/* Wait for sconn to go to Close-Wait */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(sconn, &sconn_status);
-	while (sconn_status.cstate != st_close_wait)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: close sconn");
-	/* Close server side */
-	trc = tcp_uc_close(sconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: wait cconn = time-wait");
-	/* Wait for cconn to go to Time-Wait */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(cconn, &cconn_status);
-	while (cconn_status.cstate != st_time_wait)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: wait sconn = closed");
-	/* Wait for sconn to go to Closed */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(sconn, &sconn_status);
-	while (sconn_status.cstate != st_closed) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: sconn.status == %d", sconn_status.cstate);
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	}
-	fibril_mutex_unlock(&cst_lock);
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "conn_est_close_seq: tear down");
-	/* Tear down */
-	test_conns_tear_down(cconn, sconn);
-}
-
-/** Test establishing and then simultaneously closing down a connection. */
-PCUT_TEST(conn_est_close_simult)
-{
-	tcp_conn_t *cconn, *sconn;
-	tcp_error_t trc;
-
-	/* Establish */
-	test_conns_establish(&cconn, &sconn);
-
-	/* Close both sides simultaneously */
-	trc = tcp_uc_close(cconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-	trc = tcp_uc_close(sconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-
-	/* Wait for cconn to go to Time-Wait */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(cconn, &cconn_status);
-	while (cconn_status.cstate != st_time_wait)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	/*
-	 * Wait for sconn to go to Closed or Time-Wait. The connection
-	 * goes to Closed if we managed to call tcp_uc_close() before
-	 * sconn received FIN. Otherwise it goes to Time-Wait.
-	 *
-	 * XXX We may want to add delay to the loopback here to be
-	 * absolutely sure that we go to Closing -> Time-Wait.
-	 */
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(sconn, &sconn_status);
-	while (sconn_status.cstate != st_time_wait &&
-	    sconn_status.cstate != st_closed)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	/* Tear down */
-	test_conns_tear_down(cconn, sconn);
-}
-
-static void test_cstate_change(tcp_conn_t *conn, void *arg,
-    tcp_cstate_t old_state)
-{
-	tcp_conn_status_t *status = (tcp_conn_status_t *)arg;
-
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(conn, status);
-	fibril_mutex_unlock(&cst_lock);
-	fibril_condvar_broadcast(&cst_cv);
-}
-
-/** Establish client-server connection */
-static void test_conns_establish(tcp_conn_t **rcconn, tcp_conn_t **rsconn)
-{
-	tcp_conn_t *cconn, *sconn;
-	inet_ep2_t cepp, sepp;
-	tcp_conn_status_t cstatus;
-	tcp_error_t trc;
-
-	/* Client EPP */
-	inet_ep2_init(&cepp);
-	inet_addr(&cepp.local.addr, 127, 0, 0, 1);
-	inet_addr(&cepp.remote.addr, 127, 0, 0, 1);
-	cepp.remote.port = inet_port_user_lo;
-
-	/* Server EPP */
-	inet_ep2_init(&sepp);
-	inet_addr(&sepp.local.addr, 127, 0, 0, 1);
-	sepp.local.port = inet_port_user_lo;
-
-	/* Server side of the connection */
-	sconn = NULL;
-	trc = tcp_uc_open(&sepp, ap_passive, tcp_open_nonblock, &sconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-	PCUT_ASSERT_NOT_NULL(sconn);
-
-	tcp_uc_set_cb(sconn, &test_conn_cb, &sconn_status);
-	PCUT_ASSERT_EQUALS(&sconn_status, tcp_uc_get_userptr(sconn));
-
-	tcp_uc_status(sconn, &cstatus);
-	PCUT_ASSERT_INT_EQUALS(st_listen, cstatus.cstate);
-
-	/* Client side of the connection */
-
-	cconn = NULL;
-	trc = tcp_uc_open(&cepp, ap_active, 0, &cconn);
-	PCUT_ASSERT_INT_EQUALS(TCP_EOK, trc);
-	PCUT_ASSERT_NOT_NULL(cconn);
-
-	tcp_uc_set_cb(cconn, &test_conn_cb, &cconn_status);
-	PCUT_ASSERT_EQUALS(&cconn_status, tcp_uc_get_userptr(cconn));
-
-	/* The client side of the connection should be established by now */
-
-	tcp_uc_status(cconn, &cstatus);
-	PCUT_ASSERT_INT_EQUALS(st_established, cstatus.cstate);
-
-	/* Need to wait for server side */
-
-	fibril_mutex_lock(&cst_lock);
-	tcp_uc_status(sconn, &sconn_status);
-	while (sconn_status.cstate != st_established)
-		fibril_condvar_wait(&cst_cv, &cst_lock);
-	fibril_mutex_unlock(&cst_lock);
-
-	*rcconn = cconn;
-	*rsconn = sconn;
-}
-
-/* Tear down client-server connection. */
-static void test_conns_tear_down(tcp_conn_t *cconn, tcp_conn_t *sconn)
-{
-	tcp_uc_abort(cconn);
-	tcp_uc_delete(cconn);
-
-	tcp_uc_abort(sconn);
-	tcp_uc_delete(sconn);
-}
-
-PCUT_EXPORT(ucall);
Index: pace/srv/net/tcp/tqueue.c
===================================================================
--- uspace/srv/net/tcp/tqueue.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,401 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP transmission queue
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <byteorder.h>
-#include <io/log.h>
-#include <macros.h>
-#include <mem.h>
-#include <stdlib.h>
-
-#include "conn.h"
-#include "inet.h"
-#include "ncsim.h"
-#include "rqueue.h"
-#include "segment.h"
-#include "seq_no.h"
-#include "tqueue.h"
-#include "tcp_type.h"
-
-#define RETRANSMIT_TIMEOUT	(2*1000*1000)
-
-static void retransmit_timeout_func(void *);
-static void tcp_tqueue_timer_set(tcp_conn_t *);
-static void tcp_tqueue_timer_clear(tcp_conn_t *);
-static void tcp_tqueue_seg(tcp_conn_t *, tcp_segment_t *);
-static void tcp_conn_transmit_segment(tcp_conn_t *, tcp_segment_t *);
-static void tcp_prepare_transmit_segment(tcp_conn_t *, tcp_segment_t *);
-static void tcp_tqueue_send_immed(tcp_conn_t *, tcp_segment_t *);
-
-errno_t tcp_tqueue_init(tcp_tqueue_t *tqueue, tcp_conn_t *conn,
-    tcp_tqueue_cb_t *cb)
-{
-	tqueue->conn = conn;
-	tqueue->timer = fibril_timer_create(&conn->lock);
-	tqueue->cb = cb;
-	if (tqueue->timer == NULL)
-		return ENOMEM;
-
-	list_initialize(&tqueue->list);
-
-	return EOK;
-}
-
-void tcp_tqueue_clear(tcp_tqueue_t *tqueue)
-{
-	tcp_tqueue_timer_clear(tqueue->conn);
-}
-
-void tcp_tqueue_fini(tcp_tqueue_t *tqueue)
-{
-	link_t *link;
-	tcp_tqueue_entry_t *tqe;
-
-	if (tqueue->timer != NULL) {
-		fibril_timer_destroy(tqueue->timer);
-		tqueue->timer = NULL;
-	}
-
-	while (!list_empty(&tqueue->list)) {
-		link = list_first(&tqueue->list);
-		tqe = list_get_instance(link, tcp_tqueue_entry_t, link);
-		list_remove(link);
-
-		tcp_segment_delete(tqe->seg);
-		free(tqe);
-	}
-}
-
-void tcp_tqueue_ctrl_seg(tcp_conn_t *conn, tcp_control_t ctrl)
-{
-	tcp_segment_t *seg;
-
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_tqueue_ctrl_seg(%p, %u)", conn, ctrl);
-
-	seg = tcp_segment_make_ctrl(ctrl);
-	tcp_tqueue_seg(conn, seg);
-	tcp_segment_delete(seg);
-}
-
-static void tcp_tqueue_seg(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	tcp_segment_t *rt_seg;
-	tcp_tqueue_entry_t *tqe;
-
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_tqueue_seg(%p, %p)", conn->name, conn,
-	    seg);
-
-	/*
-	 * Add segment to retransmission queue
-	 */
-
-	if (seg->len > 0) {
-		rt_seg = tcp_segment_dup(seg);
-		if (rt_seg == NULL) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed.");
-			/* XXX Handle properly */
-			return;
-		}
-
-		tqe = calloc(1, sizeof(tcp_tqueue_entry_t));
-		if (tqe == NULL) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed.");
-			/* XXX Handle properly */
-			return;
-		}
-
-		tqe->conn = conn;
-		tqe->seg = rt_seg;
-		rt_seg->seq = conn->snd_nxt;
-
-		list_append(&tqe->link, &conn->retransmit.list);
-
-		/* Set retransmission timer */
-		tcp_tqueue_timer_set(conn);
-	}
-
-	tcp_prepare_transmit_segment(conn, seg);
-}
-
-static void tcp_prepare_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	/*
-	 * Always send ACK once we have received SYN, except for RST segments.
-	 * (Spec says we should always send ACK once connection has been
-	 * established.)
-	 */
-	if (tcp_conn_got_syn(conn) && (seg->ctrl & CTL_RST) == 0)
-		seg->ctrl |= CTL_ACK;
-
-	seg->seq = conn->snd_nxt;
-	conn->snd_nxt += seg->len;
-
-	tcp_conn_transmit_segment(conn, seg);
-}
-
-/** Transmit data from the send buffer.
- *
- * @param conn	Connection
- */
-void tcp_tqueue_new_data(tcp_conn_t *conn)
-{
-	size_t avail_wnd;
-	size_t xfer_seqlen;
-	size_t snd_buf_seqlen;
-	size_t data_size;
-	tcp_control_t ctrl;
-	bool send_fin;
-
-	tcp_segment_t *seg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_tqueue_new_data()", conn->name);
-
-	/* Number of free sequence numbers in send window */
-	avail_wnd = (conn->snd_una + conn->snd_wnd) - conn->snd_nxt;
-	snd_buf_seqlen = conn->snd_buf_used + (conn->snd_buf_fin ? 1 : 0);
-
-	xfer_seqlen = min(snd_buf_seqlen, avail_wnd);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: snd_buf_seqlen = %zu, SND.WND = %" PRIu32 ", "
-	    "xfer_seqlen = %zu", conn->name, snd_buf_seqlen, conn->snd_wnd,
-	    xfer_seqlen);
-
-	if (xfer_seqlen == 0)
-		return;
-
-	/* XXX Do not always send immediately */
-
-	send_fin = conn->snd_buf_fin && xfer_seqlen == snd_buf_seqlen;
-	data_size = xfer_seqlen - (send_fin ? 1 : 0);
-
-	if (send_fin) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: Sending out FIN.", conn->name);
-		/* We are sending out FIN */
-		ctrl = CTL_FIN;
-	} else {
-		ctrl = 0;
-	}
-
-	seg = tcp_segment_make_data(ctrl, conn->snd_buf, data_size);
-	if (seg == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failure.");
-		return;
-	}
-
-	/* Remove data from send buffer */
-	memmove(conn->snd_buf, conn->snd_buf + data_size,
-	    conn->snd_buf_used - data_size);
-	conn->snd_buf_used -= data_size;
-
-	if (send_fin)
-		conn->snd_buf_fin = false;
-
-	fibril_condvar_broadcast(&conn->snd_buf_cv);
-
-	if (send_fin)
-		tcp_conn_fin_sent(conn);
-
-	tcp_tqueue_seg(conn, seg);
-	tcp_segment_delete(seg);
-}
-
-/** Remove ACKed segments from retransmission queue and possibly transmit
- * more data.
- *
- * This should be called when SND.UNA is updated due to incoming ACK.
- */
-void tcp_tqueue_ack_received(tcp_conn_t *conn)
-{
-	link_t *cur, *next;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_tqueue_ack_received(%p)", conn->name,
-	    conn);
-
-	cur = conn->retransmit.list.head.next;
-
-	while (cur != &conn->retransmit.list.head) {
-		next = cur->next;
-
-		tcp_tqueue_entry_t *tqe = list_get_instance(cur,
-		    tcp_tqueue_entry_t, link);
-
-		if (seq_no_segment_acked(conn, tqe->seg, conn->snd_una)) {
-			/* Remove acknowledged segment */
-			list_remove(cur);
-
-			if ((tqe->seg->ctrl & CTL_FIN) != 0) {
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "Fin has been acked");
-				log_msg(LOG_DEFAULT, LVL_DEBUG, "SND.UNA=%" PRIu32
-				    " SEG.SEQ=%" PRIu32 " SEG.LEN=%" PRIu32,
-				    conn->snd_una, tqe->seg->seq, tqe->seg->len);
-				/* Our FIN has been acked */
-				conn->fin_is_acked = true;
-			}
-
-			tcp_segment_delete(tqe->seg);
-			free(tqe);
-
-			/* Reset retransmission timer */
-			tcp_tqueue_timer_set(conn);
-		}
-
-		cur = next;
-	}
-
-	/* Clear retransmission timer if the queue is empty. */
-	if (list_empty(&conn->retransmit.list))
-		tcp_tqueue_timer_clear(conn);
-
-	/* Possibly transmit more data */
-	tcp_tqueue_new_data(conn);
-}
-
-static void tcp_conn_transmit_segment(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_conn_transmit_segment(%p, %p)",
-	    conn->name, conn, seg);
-
-	seg->wnd = conn->rcv_wnd;
-
-	if ((seg->ctrl & CTL_ACK) != 0)
-		seg->ack = conn->rcv_nxt;
-	else
-		seg->ack = 0;
-
-	tcp_tqueue_send_immed(conn, seg);
-}
-
-void tcp_tqueue_send_immed(tcp_conn_t *conn, tcp_segment_t *seg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "tcp_tqueue_send_immed(l:(%u),f:(%u), %p)",
-	    conn->ident.local.port, conn->ident.remote.port, seg);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "SEG.SEQ=%" PRIu32 ", SEG.WND=%" PRIu32,
-	    seg->seq, seg->wnd);
-
-	tcp_segment_dump(seg);
-
-	conn->retransmit.cb->transmit_seg(&conn->ident, seg);
-}
-
-static void retransmit_timeout_func(void *arg)
-{
-	tcp_conn_t *conn = (tcp_conn_t *) arg;
-	tcp_tqueue_entry_t *tqe;
-	tcp_segment_t *rt_seg;
-	link_t *link;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p)", conn->name, conn);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Connection already closed.");
-		tcp_conn_unlock(conn);
-		tcp_conn_delref(conn);
-		return;
-	}
-
-	link = list_first(&conn->retransmit.list);
-	if (link == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Nothing to retransmit");
-		tcp_conn_unlock(conn);
-		tcp_conn_delref(conn);
-		return;
-	}
-
-	tqe = list_get_instance(link, tcp_tqueue_entry_t, link);
-
-	rt_seg = tcp_segment_dup(tqe->seg);
-	if (rt_seg == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Memory allocation failed.");
-		tcp_conn_unlock(conn);
-		tcp_conn_delref(conn);
-		/* XXX Handle properly */
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmitting segment", conn->name);
-	tcp_conn_transmit_segment(tqe->conn, rt_seg);
-
-	/* Reset retransmission timer */
-	fibril_timer_set_locked(conn->retransmit.timer, RETRANSMIT_TIMEOUT,
-	    retransmit_timeout_func, (void *) conn);
-
-	tcp_conn_unlock(conn);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: retransmit_timeout_func(%p) end", conn->name, conn);
-}
-
-/** Set or re-set retransmission timer */
-static void tcp_tqueue_timer_set(tcp_conn_t *conn)
-{
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() begin", conn->name);
-
-	/* Clear first to make sure we update refcnt correctly */
-	tcp_tqueue_timer_clear(conn);
-
-	tcp_conn_addref(conn);
-	fibril_timer_set_locked(conn->retransmit.timer, RETRANSMIT_TIMEOUT,
-	    retransmit_timeout_func, (void *) conn);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_set() end", conn->name);
-}
-
-/** Clear retransmission timer */
-static void tcp_tqueue_timer_clear(tcp_conn_t *conn)
-{
-	assert(fibril_mutex_is_locked(&conn->lock));
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() begin", conn->name);
-
-	if (fibril_timer_clear_locked(conn->retransmit.timer) == fts_active)
-		tcp_conn_delref(conn);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "### %s: tcp_tqueue_timer_clear() end", conn->name);
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/tqueue.h
===================================================================
--- uspace/srv/net/tcp/tqueue.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP transmission queue
- */
-
-#ifndef TQUEUE_H
-#define TQUEUE_H
-
-#include <inet/endpoint.h>
-#include "std.h"
-#include "tcp_type.h"
-
-extern errno_t tcp_tqueue_init(tcp_tqueue_t *, tcp_conn_t *,
-    tcp_tqueue_cb_t *);
-extern void tcp_tqueue_clear(tcp_tqueue_t *);
-extern void tcp_tqueue_fini(tcp_tqueue_t *);
-extern void tcp_tqueue_ctrl_seg(tcp_conn_t *, tcp_control_t);
-extern void tcp_tqueue_new_data(tcp_conn_t *);
-extern void tcp_tqueue_ack_received(tcp_conn_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/tcp/ucall.c
===================================================================
--- uspace/srv/net/tcp/ucall.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,357 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-
-/**
- * @file TCP entry points (close to those defined in the RFC)
- */
-
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <macros.h>
-#include <mem.h>
-#include "conn.h"
-#include "tcp_type.h"
-#include "tqueue.h"
-#include "ucall.h"
-
-/*
- * User calls
- */
-
-/** OPEN user call
- *
- * @param epp		Endpoint pair
- * @param acpass	Active/passive
- * @param oflags	Open flags
- * @param conn		Connection
- *
- * Unlike in the spec we allow specifying the local address. This means
- * the implementation does not need to magically guess it, especially
- * considering there can be more than one local address.
- *
- * XXX We should be able to call active open on an existing listening
- * connection.
- * XXX We should be able to get connection structure immediately, before
- * establishment.
- */
-tcp_error_t tcp_uc_open(inet_ep2_t *epp, acpass_t acpass,
-    tcp_open_flags_t oflags, tcp_conn_t **conn)
-{
-	tcp_conn_t *nconn;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open(%p, %s, %s, %p)",
-	    epp, acpass == ap_active ? "active" : "passive",
-	    oflags == tcp_open_nonblock ? "nonblock" : "none", conn);
-
-	nconn = tcp_conn_new(epp);
-	rc = tcp_conn_add(nconn);
-	if (rc != EOK) {
-		tcp_conn_delete(nconn);
-		return TCP_EEXISTS;
-	}
-
-	tcp_conn_lock(nconn);
-
-	if (acpass == ap_active) {
-		/* Synchronize (initiate) connection */
-		tcp_conn_sync(nconn);
-	}
-
-	if (oflags == tcp_open_nonblock) {
-		tcp_conn_unlock(nconn);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open -> %p", nconn);
-		*conn = nconn;
-		return TCP_EOK;
-	}
-
-	/* Wait for connection to be established or reset */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Wait for connection.");
-	while (nconn->cstate == st_listen ||
-	    nconn->cstate == st_syn_sent ||
-	    nconn->cstate == st_syn_received) {
-		fibril_condvar_wait(&nconn->cstate_cv, &nconn->lock);
-	}
-
-	if (nconn->cstate != st_established) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was reset.");
-		assert(nconn->cstate == st_closed);
-		tcp_conn_unlock(nconn);
-		tcp_conn_delete(nconn);
-		return TCP_ERESET;
-	}
-
-	tcp_conn_unlock(nconn);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open: Connection was established.");
-
-	*conn = nconn;
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_open -> %p", nconn);
-	return TCP_EOK;
-}
-
-/** SEND user call */
-tcp_error_t tcp_uc_send(tcp_conn_t *conn, void *data, size_t size,
-    xflags_t flags)
-{
-	size_t buf_free;
-	size_t xfer_size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_send()", conn->name);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		tcp_conn_unlock(conn);
-		return TCP_ENOTEXIST;
-	}
-
-	if (conn->cstate == st_listen) {
-		/* Change connection to active */
-		tcp_conn_sync(conn);
-	}
-
-	if (conn->snd_buf_fin) {
-		tcp_conn_unlock(conn);
-		return TCP_ECLOSING;
-	}
-
-	while (size > 0) {
-		buf_free = conn->snd_buf_size - conn->snd_buf_used;
-		while (buf_free == 0 && !conn->reset) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: buf_free == 0, waiting.",
-			    conn->name);
-			fibril_condvar_wait(&conn->snd_buf_cv, &conn->lock);
-			buf_free = conn->snd_buf_size - conn->snd_buf_used;
-		}
-
-		if (conn->reset) {
-			tcp_conn_unlock(conn);
-			return TCP_ERESET;
-		}
-
-		xfer_size = min(size, buf_free);
-
-		/* Copy data to buffer */
-		memcpy(conn->snd_buf + conn->snd_buf_used, data, xfer_size);
-		data += xfer_size;
-		conn->snd_buf_used += xfer_size;
-		size -= xfer_size;
-
-		tcp_tqueue_new_data(conn);
-	}
-
-	tcp_tqueue_new_data(conn);
-	tcp_conn_unlock(conn);
-
-	return TCP_EOK;
-}
-
-/** RECEIVE user call */
-tcp_error_t tcp_uc_receive(tcp_conn_t *conn, void *buf, size_t size,
-    size_t *rcvd, xflags_t *xflags)
-{
-	size_t xfer_size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_receive()", conn->name);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		tcp_conn_unlock(conn);
-		return TCP_ENOTEXIST;
-	}
-
-	/* Wait for data to become available */
-	while (conn->rcv_buf_used == 0 && !conn->rcv_buf_fin && !conn->reset) {
-		tcp_conn_unlock(conn);
-		return TCP_EAGAIN;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_receive() - wait for data");
-		fibril_condvar_wait(&conn->rcv_buf_cv, &conn->lock);
-	}
-
-	if (conn->rcv_buf_used == 0) {
-		*rcvd = 0;
-		*xflags = 0;
-
-		if (conn->rcv_buf_fin) {
-			/* End of data, peer closed connection */
-			tcp_conn_unlock(conn);
-			return TCP_ECLOSING;
-		} else {
-			/* Connection was reset */
-			assert(conn->reset);
-			tcp_conn_unlock(conn);
-			return TCP_ERESET;
-		}
-	}
-
-	/* Copy data from receive buffer to user buffer */
-	xfer_size = min(size, conn->rcv_buf_used);
-	memcpy(buf, conn->rcv_buf, xfer_size);
-	*rcvd = xfer_size;
-
-	/* Remove data from receive buffer */
-	memmove(conn->rcv_buf, conn->rcv_buf + xfer_size, conn->rcv_buf_used -
-	    xfer_size);
-	conn->rcv_buf_used -= xfer_size;
-	conn->rcv_wnd += xfer_size;
-
-	/* TODO */
-	*xflags = 0;
-
-	/* Send new size of receive window */
-	tcp_tqueue_ctrl_seg(conn, CTL_ACK);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_receive() - returning %zu bytes",
-	    conn->name, xfer_size);
-
-	tcp_conn_unlock(conn);
-
-	return TCP_EOK;
-}
-
-/** CLOSE user call */
-tcp_error_t tcp_uc_close(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: tcp_uc_close(%p)", conn->name,
-	    conn);
-
-	tcp_conn_lock(conn);
-
-	if (conn->cstate == st_closed) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ENOTEXIST");
-		tcp_conn_unlock(conn);
-		return TCP_ENOTEXIST;
-	}
-
-	if (conn->cstate == st_listen || conn->cstate == st_syn_sent) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - listen/syn_sent");
-		tcp_conn_reset(conn);
-		tcp_conn_unlock(conn);
-		return TCP_EOK;
-	}
-
-	if (conn->snd_buf_fin) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - ECLOSING");
-		tcp_conn_unlock(conn);
-		return TCP_ECLOSING;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_close - set snd_buf_fin");
-	conn->snd_buf_fin = true;
-	tcp_tqueue_new_data(conn);
-
-	tcp_conn_unlock(conn);
-	return TCP_EOK;
-}
-
-/** ABORT user call */
-void tcp_uc_abort(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_abort()");
-
-	tcp_conn_lock(conn);
-	tcp_conn_reset(conn);
-	tcp_conn_unlock(conn);
-}
-
-/** STATUS user call */
-void tcp_uc_status(tcp_conn_t *conn, tcp_conn_status_t *cstatus)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_status()");
-	cstatus->cstate = conn->cstate;
-}
-
-/** Delete connection user call.
- *
- * (Not in spec.) Inform TCP that the user is done with this connection
- * and will not make any further calls/references to it. TCP can deallocate
- * the connection from now on.
- */
-void tcp_uc_delete(tcp_conn_t *conn)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_delete()");
-	tcp_conn_delete(conn);
-}
-
-void tcp_uc_set_cb(tcp_conn_t *conn, tcp_cb_t *cb, void *arg)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_uc_set_cb(%p, %p, %p)",
-	    conn, cb, arg);
-
-	conn->cb = cb;
-	conn->cb_arg = arg;
-}
-
-void *tcp_uc_get_userptr(tcp_conn_t *conn)
-{
-	return conn->cb_arg;
-}
-
-/*
- * Arriving segments
- */
-
-/** Segment arrived */
-void tcp_as_segment_arrived(inet_ep2_t *epp, tcp_segment_t *seg)
-{
-	tcp_conn_t *conn;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG,
-	    "tcp_as_segment_arrived(f:(%u), l:(%u))",
-	    epp->remote.port, epp->local.port);
-
-	conn = tcp_conn_find_ref(epp);
-	if (conn == NULL) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "No connection found.");
-		tcp_unexpected_segment(epp, seg);
-		return;
-	}
-
-	tcp_conn_segment_arrived(conn, epp, seg);
-	tcp_conn_delref(conn);
-}
-
-/*
- * Timeouts
- */
-
-/** User timeout */
-void tcp_to_user(void)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "tcp_to_user()");
-}
-
-/**
- * @}
- */
Index: pace/srv/net/tcp/ucall.h
===================================================================
--- uspace/srv/net/tcp/ucall.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup tcp
- * @{
- */
-/** @file TCP user calls (close to those defined in the RFC)
- */
-
-#ifndef UCALL_H
-#define UCALL_H
-
-#include <inet/endpoint.h>
-#include <stddef.h>
-#include "tcp_type.h"
-
-/*
- * User calls
- */
-extern tcp_error_t tcp_uc_open(inet_ep2_t *, acpass_t,
-    tcp_open_flags_t, tcp_conn_t **);
-extern tcp_error_t tcp_uc_send(tcp_conn_t *, void *, size_t, xflags_t);
-extern tcp_error_t tcp_uc_receive(tcp_conn_t *, void *, size_t, size_t *, xflags_t *);
-extern tcp_error_t tcp_uc_close(tcp_conn_t *);
-extern void tcp_uc_abort(tcp_conn_t *);
-extern void tcp_uc_status(tcp_conn_t *, tcp_conn_status_t *);
-extern void tcp_uc_delete(tcp_conn_t *);
-extern void tcp_uc_set_cb(tcp_conn_t *, tcp_cb_t *, void *);
-extern void *tcp_uc_get_userptr(tcp_conn_t *);
-
-/*
- * Arriving segments
- */
-extern void tcp_as_segment_arrived(inet_ep2_t *, tcp_segment_t *);
-
-/*
- * Timeouts
- */
-extern void tcp_to_user(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/assoc.c
===================================================================
--- uspace/srv/net/udp/assoc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,444 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file UDP associations
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <nettl/amap.h>
-#include <stdlib.h>
-
-#include "assoc.h"
-#include "msg.h"
-#include "pdu.h"
-#include "udp_type.h"
-
-static LIST_INITIALIZE(assoc_list);
-static FIBRIL_MUTEX_INITIALIZE(assoc_list_lock);
-static amap_t *amap;
-
-static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *);
-static errno_t udp_assoc_queue_msg(udp_assoc_t *, inet_ep2_t *, udp_msg_t *);
-static udp_assocs_dep_t *assocs_dep;
-
-/** Initialize associations. */
-errno_t udp_assocs_init(udp_assocs_dep_t *dep)
-{
-	errno_t rc;
-
-	rc = amap_create(&amap);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		return ENOMEM;
-	}
-
-	assocs_dep = dep;
-	return EOK;
-}
-
-/** Finalize associations. */
-void udp_assocs_fini(void)
-{
-	assert(list_empty(&assoc_list));
-
-	amap_destroy(amap);
-	amap = NULL;
-}
-
-/** Create new association structure.
- *
- * @param epp		Endpoint pair (will be copied)
- * @param cb		Callbacks
- * @param cb_arg	Callback argument
- * @return		New association or NULL
- */
-udp_assoc_t *udp_assoc_new(inet_ep2_t *epp, udp_assoc_cb_t *cb, void *cb_arg)
-{
-	udp_assoc_t *assoc = NULL;
-
-	/* Allocate association structure */
-	assoc = calloc(1, sizeof(udp_assoc_t));
-	if (assoc == NULL)
-		goto error;
-
-	fibril_mutex_initialize(&assoc->lock);
-
-	/* One for the user */
-	refcount_init(&assoc->refcnt);
-
-	/* Initialize receive queue */
-	list_initialize(&assoc->rcv_queue);
-	fibril_condvar_initialize(&assoc->rcv_queue_cv);
-
-	if (epp != NULL)
-		assoc->ident = *epp;
-
-	assoc->cb = cb;
-	assoc->cb_arg = cb_arg;
-	return assoc;
-error:
-	return NULL;
-}
-
-/** Destroy association structure.
- *
- * Association structure should be destroyed when the folowing conditions
- * are met:
- * (1) user has deleted the association
- * (2) nobody is holding references to the association
- *
- * This happens when @a assoc->refcnt is zero as we count (1)
- * as an extra reference.
- *
- * @param assoc		Association
- */
-static void udp_assoc_free(udp_assoc_t *assoc)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_free(%p)", assoc->name, assoc);
-
-	while (!list_empty(&assoc->rcv_queue)) {
-		link_t *link = list_first(&assoc->rcv_queue);
-		udp_rcv_queue_entry_t *rqe = list_get_instance(link,
-		    udp_rcv_queue_entry_t, link);
-		list_remove(link);
-
-		udp_msg_delete(rqe->msg);
-		free(rqe);
-	}
-
-	free(assoc);
-}
-
-/** Add reference to association.
- *
- * Increase association reference count by one.
- *
- * @param assoc		Association
- */
-void udp_assoc_addref(udp_assoc_t *assoc)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: upd_assoc_addref(%p)", assoc->name, assoc);
-	refcount_up(&assoc->refcnt);
-}
-
-/** Remove reference from association.
- *
- * Decrease association reference count by one.
- *
- * @param assoc		Association
- */
-void udp_assoc_delref(udp_assoc_t *assoc)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_delref(%p)", assoc->name, assoc);
-
-	if (refcount_down(&assoc->refcnt))
-		udp_assoc_free(assoc);
-}
-
-/** Delete association.
- *
- * The caller promises not make no further references to @a assoc.
- * UDP will free @a assoc eventually.
- *
- * @param assoc		Association
- */
-void udp_assoc_delete(udp_assoc_t *assoc)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_delete(%p)", assoc->name, assoc);
-
-	assert(assoc->deleted == false);
-	assoc->deleted = true;
-	udp_assoc_delref(assoc);
-}
-
-/** Enlist association.
- *
- * Add association to the association map.
- */
-errno_t udp_assoc_add(udp_assoc_t *assoc)
-{
-	inet_ep2_t aepp;
-	errno_t rc;
-
-	udp_assoc_addref(assoc);
-	fibril_mutex_lock(&assoc_list_lock);
-
-	rc = amap_insert(amap, &assoc->ident, assoc, af_allow_system, &aepp);
-	if (rc != EOK) {
-		udp_assoc_delref(assoc);
-		fibril_mutex_unlock(&assoc_list_lock);
-		return rc;
-	}
-
-	assoc->ident = aepp;
-	list_append(&assoc->link, &assoc_list);
-	fibril_mutex_unlock(&assoc_list_lock);
-
-	return EOK;
-}
-
-/** Delist association.
- *
- * Remove association from the association map.
- */
-void udp_assoc_remove(udp_assoc_t *assoc)
-{
-	fibril_mutex_lock(&assoc_list_lock);
-	amap_remove(amap, &assoc->ident);
-	list_remove(&assoc->link);
-	fibril_mutex_unlock(&assoc_list_lock);
-	udp_assoc_delref(assoc);
-}
-
-/** Set IP link in association.
- *
- * @param assoc		Association
- * @param iplink	IP link
- */
-void udp_assoc_set_iplink(udp_assoc_t *assoc, service_id_t iplink)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_set_iplink(%p, %zu)",
-	    assoc, iplink);
-	fibril_mutex_lock(&assoc->lock);
-	assoc->ident.local_link = iplink;
-	fibril_mutex_unlock(&assoc->lock);
-}
-
-/** Send message to association.
- *
- * @param assoc		Association
- * @param remote	Remote endpoint or inet_addr_any/inet_port_any
- *			not to override association's remote endpoint
- * @param msg		Message
- *
- * @return		EOK on success
- *			EINVAL if remote endpoint is not set
- *			ENOMEM if out of resources
- *			EIO if no route to destination exists
- */
-errno_t udp_assoc_send(udp_assoc_t *assoc, inet_ep_t *remote, udp_msg_t *msg)
-{
-	inet_ep2_t epp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send(%p, %p, %p)",
-	    assoc, remote, msg);
-
-	/* @a remote can be used to override the remote endpoint */
-	epp = assoc->ident;
-	if (!inet_addr_is_any(&remote->addr) &&
-	    remote->port != inet_port_any)
-		epp.remote = *remote;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - check addr any");
-
-	if ((inet_addr_is_any(&epp.remote.addr)) ||
-	    (epp.remote.port == inet_port_any))
-		return EINVAL;
-
-	/* This association has no local address set. Need to determine one. */
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - check no local addr");
-	if (inet_addr_is_any(&epp.local.addr) && !assoc->nolocal) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine local address.");
-		rc = (*assocs_dep->get_srcaddr)(&epp.remote.addr, 0,
-		    &epp.local.addr);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Cannot determine "
-			    "local address.");
-			return EINVAL;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - check version");
-
-	if (!inet_addr_is_any(&epp.local.addr) &&
-	    epp.remote.addr.version != epp.local.addr.version)
-		return EINVAL;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - transmit");
-	rc = (*assocs_dep->transmit_msg)(&epp, msg);
-
-	if (rc != EOK)
-		return EIO;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send - success");
-	return EOK;
-}
-
-/** Get a received message.
- *
- * Pull one message from the association's receive queue.
- */
-errno_t udp_assoc_recv(udp_assoc_t *assoc, udp_msg_t **msg, inet_ep_t *remote)
-{
-	link_t *link;
-	udp_rcv_queue_entry_t *rqe;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv()");
-
-	fibril_mutex_lock(&assoc->lock);
-	while (list_empty(&assoc->rcv_queue) && !assoc->reset) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - waiting");
-		fibril_condvar_wait(&assoc->rcv_queue_cv, &assoc->lock);
-	}
-
-	if (assoc->reset) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - association was reset");
-		fibril_mutex_unlock(&assoc->lock);
-		return ENXIO;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_recv() - got a message");
-	link = list_first(&assoc->rcv_queue);
-	rqe = list_get_instance(link, udp_rcv_queue_entry_t, link);
-	list_remove(link);
-	fibril_mutex_unlock(&assoc->lock);
-
-	*msg = rqe->msg;
-	*remote = rqe->epp.remote;
-	free(rqe);
-
-	return EOK;
-}
-
-/** Message received.
- *
- * Find the association to which the message belongs and queue it.
- */
-void udp_assoc_received(inet_ep2_t *repp, udp_msg_t *msg)
-{
-	udp_assoc_t *assoc;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_received(%p, %p)", repp, msg);
-
-	assoc = udp_assoc_find_ref(repp);
-	if (assoc == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "No association found. Message dropped.");
-		/* XXX Generate ICMP error. */
-		/* XXX Might propagate error directly by error return. */
-		udp_msg_delete(msg);
-		return;
-	}
-
-	if (0) {
-		rc = udp_assoc_queue_msg(assoc, repp, msg);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Out of memory. Message dropped.");
-			/* XXX Generate ICMP error? */
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "call assoc->cb->recv_msg");
-	assoc->cb->recv_msg(assoc->cb_arg, repp, msg);
-	udp_assoc_delref(assoc);
-}
-
-/** Reset association.
- *
- * This causes any pendingreceive operations to return immediately with
- * UDP_ERESET.
- */
-void udp_assoc_reset(udp_assoc_t *assoc)
-{
-	fibril_mutex_lock(&assoc->lock);
-	assoc->reset = true;
-	fibril_condvar_broadcast(&assoc->rcv_queue_cv);
-	fibril_mutex_unlock(&assoc->lock);
-}
-
-static errno_t udp_assoc_queue_msg(udp_assoc_t *assoc, inet_ep2_t *epp,
-    udp_msg_t *msg)
-{
-	udp_rcv_queue_entry_t *rqe;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_queue_msg(%p, %p, %p)",
-	    assoc, epp, msg);
-
-	rqe = calloc(1, sizeof(udp_rcv_queue_entry_t));
-	if (rqe == NULL)
-		return ENOMEM;
-
-	link_initialize(&rqe->link);
-	rqe->epp = *epp;
-	rqe->msg = msg;
-
-	fibril_mutex_lock(&assoc->lock);
-	list_append(&rqe->link, &assoc->rcv_queue);
-	fibril_mutex_unlock(&assoc->lock);
-
-	fibril_condvar_broadcast(&assoc->rcv_queue_cv);
-
-	return EOK;
-}
-
-/** Find association structure for specified endpoint pair.
- *
- * An association is uniquely identified by an endpoint pair. Look up our
- * association map and return association structure based on endpoint pair.
- * The association reference count is bumped by one.
- *
- * @param epp	Endpoint pair
- * @return	Association structure or NULL if not found.
- */
-static udp_assoc_t *udp_assoc_find_ref(inet_ep2_t *epp)
-{
-	errno_t rc;
-	void *arg;
-	udp_assoc_t *assoc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_find_ref(%p)", epp);
-	fibril_mutex_lock(&assoc_list_lock);
-
-	rc = amap_find_match(amap, epp, &arg);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		fibril_mutex_unlock(&assoc_list_lock);
-		return NULL;
-	}
-
-	assoc = (udp_assoc_t *)arg;
-	udp_assoc_addref(assoc);
-
-	fibril_mutex_unlock(&assoc_list_lock);
-	return assoc;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/assoc.h
===================================================================
--- uspace/srv/net/udp/assoc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP associations
- */
-
-#ifndef ASSOC_H
-#define ASSOC_H
-
-#include <inet/endpoint.h>
-#include <ipc/loc.h>
-#include "udp_type.h"
-
-extern errno_t udp_assocs_init(udp_assocs_dep_t *);
-extern void udp_assocs_fini(void);
-extern udp_assoc_t *udp_assoc_new(inet_ep2_t *, udp_assoc_cb_t *, void *);
-extern void udp_assoc_delete(udp_assoc_t *);
-extern errno_t udp_assoc_add(udp_assoc_t *);
-extern void udp_assoc_remove(udp_assoc_t *);
-extern void udp_assoc_addref(udp_assoc_t *);
-extern void udp_assoc_delref(udp_assoc_t *);
-extern void udp_assoc_set_iplink(udp_assoc_t *, service_id_t);
-extern errno_t udp_assoc_send(udp_assoc_t *, inet_ep_t *, udp_msg_t *);
-extern errno_t udp_assoc_recv(udp_assoc_t *, udp_msg_t **, inet_ep_t *);
-extern void udp_assoc_received(inet_ep2_t *, udp_msg_t *);
-extern void udp_assoc_reset(udp_assoc_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/cassoc.c
===================================================================
--- uspace/srv/net/udp/cassoc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file UDP client associations
- *
- * Ties UDP associations into the namespace of a client
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <stdlib.h>
-
-#include "cassoc.h"
-#include "udp_type.h"
-
-/** Add message to client receive queue.
- *
- * @param cassoc Client association
- * @param epp    Endpoint pair on which message was received
- * @param msg    Message
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t udp_cassoc_queue_msg(udp_cassoc_t *cassoc, inet_ep2_t *epp,
-    udp_msg_t *msg)
-{
-	udp_crcv_queue_entry_t *rqe;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_cassoc_queue_msg(%p, %p, %p)",
-	    cassoc, epp, msg);
-
-	rqe = calloc(1, sizeof(udp_crcv_queue_entry_t));
-	if (rqe == NULL)
-		return ENOMEM;
-
-	link_initialize(&rqe->link);
-	rqe->epp = *epp;
-	rqe->msg = msg;
-	rqe->cassoc = cassoc;
-
-	list_append(&rqe->link, &cassoc->client->crcv_queue);
-	return EOK;
-}
-
-/** Create client association.
- *
- * This effectively adds an association into a client's namespace.
- *
- * @param client  Client
- * @param assoc   Association
- * @param rcassoc Place to store pointer to new client association
- *
- * @return EOK on soccess, ENOMEM if out of memory
- */
-errno_t udp_cassoc_create(udp_client_t *client, udp_assoc_t *assoc,
-    udp_cassoc_t **rcassoc)
-{
-	udp_cassoc_t *cassoc;
-	sysarg_t id;
-
-	cassoc = calloc(1, sizeof(udp_cassoc_t));
-	if (cassoc == NULL)
-		return ENOMEM;
-
-	/* Allocate new ID */
-	id = 0;
-	list_foreach (client->cassoc, lclient, udp_cassoc_t, cassoc) {
-		if (cassoc->id >= id)
-			id = cassoc->id + 1;
-	}
-
-	cassoc->id = id;
-	cassoc->client = client;
-	cassoc->assoc = assoc;
-
-	list_append(&cassoc->lclient, &client->cassoc);
-	*rcassoc = cassoc;
-	return EOK;
-}
-
-/** Destroy client association.
- *
- * @param cassoc Client association
- */
-void udp_cassoc_destroy(udp_cassoc_t *cassoc)
-{
-	list_remove(&cassoc->lclient);
-	free(cassoc);
-}
-
-/** Get client association by ID.
- *
- * @param client  Client
- * @param id      Client association ID
- * @param rcassoc Place to store pointer to client association
- *
- * @return EOK on success, ENOENT if no client association with the given ID
- *         is found.
- */
-errno_t udp_cassoc_get(udp_client_t *client, sysarg_t id,
-    udp_cassoc_t **rcassoc)
-{
-	list_foreach (client->cassoc, lclient, udp_cassoc_t, cassoc) {
-		if (cassoc->id == id) {
-			*rcassoc = cassoc;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/cassoc.h
===================================================================
--- uspace/srv/net/udp/cassoc.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP client associations
- */
-
-#ifndef CASSOC_H
-#define CASSOC_H
-
-#include <errno.h>
-#include "udp_type.h"
-
-errno_t udp_cassoc_create(udp_client_t *, udp_assoc_t *, udp_cassoc_t **);
-void udp_cassoc_destroy(udp_cassoc_t *);
-errno_t udp_cassoc_get(udp_client_t *, sysarg_t, udp_cassoc_t **);
-errno_t udp_cassoc_queue_msg(udp_cassoc_t *, inet_ep2_t *, udp_msg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/meson.build
===================================================================
--- uspace/srv/net/udp/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-#
-# Copyright (c) 2012 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'nettl' ]
-
-_common_src = files(
-	'assoc.c',
-	'cassoc.c',
-	'msg.c',
-	'pdu.c',
-)
-
-src = files(
-	'service.c',
-	'udp.c',
-	'udp_inet.c',
-)
-
-test_src = files(
-	'test/assoc.c',
-	'test/msg.c',
-	'test/main.c',
-	'test/pdu.c',
-)
-
-src = [ _common_src, src ]
-test_src = [ _common_src, test_src ]
Index: pace/srv/net/udp/msg.c
===================================================================
--- uspace/srv/net/udp/msg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file UDP message
- */
-
-#include <io/log.h>
-#include <stdlib.h>
-
-#include "msg.h"
-#include "udp_type.h"
-
-/** Alocate new segment structure. */
-udp_msg_t *udp_msg_new(void)
-{
-	return calloc(1, sizeof(udp_msg_t));
-}
-
-/** Delete segment. */
-void udp_msg_delete(udp_msg_t *msg)
-{
-	free(msg->data);
-	free(msg);
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/msg.h
===================================================================
--- uspace/srv/net/udp/msg.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,46 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP message
- */
-
-#ifndef MSG_H
-#define MSG_H
-
-#include "udp_type.h"
-
-extern udp_msg_t *udp_msg_new(void);
-extern void udp_msg_delete(udp_msg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/pdu.c
===================================================================
--- uspace/srv/net/udp/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,251 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file UDP PDU encoding and decoding
- */
-
-#include <bitops.h>
-#include <byteorder.h>
-#include <errno.h>
-#include <mem.h>
-#include <stdlib.h>
-#include <inet/addr.h>
-#include "msg.h"
-#include "pdu.h"
-#include "std.h"
-#include "udp_type.h"
-
-#define UDP_CHECKSUM_INIT 0xffff
-
-/** One's complement addition.
- *
- * Result is a + b + carry.
- */
-static uint16_t udp_ocadd16(uint16_t a, uint16_t b)
-{
-	uint32_t s;
-
-	s = (uint32_t)a + (uint32_t)b;
-	return (s & 0xffff) + (s >> 16);
-}
-
-static uint16_t udp_checksum_calc(uint16_t ivalue, void *data, size_t size)
-{
-	uint16_t sum;
-	uint16_t w;
-	size_t words, i;
-	uint8_t *bdata;
-
-	sum = ~ivalue;
-	words = size / 2;
-	bdata = (uint8_t *)data;
-
-	for (i = 0; i < words; i++) {
-		w = ((uint16_t)bdata[2 * i] << 8) | bdata[2 * i + 1];
-		sum = udp_ocadd16(sum, w);
-	}
-
-	if (size % 2 != 0) {
-		w = ((uint16_t)bdata[2 * words] << 8);
-		sum = udp_ocadd16(sum, w);
-	}
-
-	return ~sum;
-}
-
-static ip_ver_t udp_phdr_setup(udp_pdu_t *pdu, udp_phdr_t *phdr,
-    udp_phdr6_t *phdr6)
-{
-	addr32_t src_v4;
-	addr128_t src_v6;
-	ip_ver_t src_ver = inet_addr_get(&pdu->src, &src_v4, &src_v6);
-
-	addr32_t dest_v4;
-	addr128_t dest_v6;
-	ip_ver_t dest_ver = inet_addr_get(&pdu->dest, &dest_v4, &dest_v6);
-
-	assert(src_ver == dest_ver);
-
-	switch (src_ver) {
-	case ip_v4:
-		phdr->src_addr = host2uint32_t_be(src_v4);
-		phdr->dest_addr = host2uint32_t_be(dest_v4);
-		phdr->zero = 0;
-		phdr->protocol = IP_PROTO_UDP;
-		phdr->udp_length = host2uint16_t_be(pdu->data_size);
-		break;
-	case ip_v6:
-		host2addr128_t_be(src_v6, phdr6->src_addr);
-		host2addr128_t_be(dest_v6, phdr6->dest_addr);
-		phdr6->udp_length = host2uint32_t_be(pdu->data_size);
-		memset(phdr6->zeroes, 0, 3);
-		phdr6->next = IP_PROTO_UDP;
-		break;
-	default:
-		assert(false);
-	}
-
-	return src_ver;
-}
-
-udp_pdu_t *udp_pdu_new(void)
-{
-	return calloc(1, sizeof(udp_pdu_t));
-}
-
-void udp_pdu_delete(udp_pdu_t *pdu)
-{
-	free(pdu->data);
-	free(pdu);
-}
-
-static uint16_t udp_pdu_checksum_calc(udp_pdu_t *pdu)
-{
-	uint16_t cs_phdr;
-	udp_phdr_t phdr;
-	udp_phdr6_t phdr6;
-
-	ip_ver_t ver = udp_phdr_setup(pdu, &phdr, &phdr6);
-	switch (ver) {
-	case ip_v4:
-		cs_phdr = udp_checksum_calc(UDP_CHECKSUM_INIT, (void *) &phdr,
-		    sizeof(udp_phdr_t));
-		break;
-	case ip_v6:
-		cs_phdr = udp_checksum_calc(UDP_CHECKSUM_INIT, (void *) &phdr6,
-		    sizeof(udp_phdr6_t));
-		break;
-	default:
-		assert(false);
-	}
-
-	return udp_checksum_calc(cs_phdr, pdu->data, pdu->data_size);
-}
-
-static void udp_pdu_set_checksum(udp_pdu_t *pdu, uint16_t checksum)
-{
-	udp_header_t *hdr;
-
-	hdr = (udp_header_t *)pdu->data;
-	hdr->checksum = host2uint16_t_be(checksum);
-}
-
-/** Decode incoming PDU */
-errno_t udp_pdu_decode(udp_pdu_t *pdu, inet_ep2_t *epp, udp_msg_t **msg)
-{
-	udp_msg_t *nmsg;
-	udp_header_t *hdr;
-	void *text;
-	size_t text_size;
-	uint16_t length;
-	uint16_t checksum;
-
-	if (pdu->data_size < sizeof(udp_header_t))
-		return EINVAL;
-
-	text = pdu->data + sizeof(udp_header_t);
-	text_size = pdu->data_size - sizeof(udp_header_t);
-
-	hdr = (udp_header_t *)pdu->data;
-
-	epp->local_link = pdu->iplink;
-	epp->remote.port = uint16_t_be2host(hdr->src_port);
-	epp->remote.addr = pdu->src;
-	epp->local.port = uint16_t_be2host(hdr->dest_port);
-	epp->local.addr = pdu->dest;
-
-	length = uint16_t_be2host(hdr->length);
-	checksum = uint16_t_be2host(hdr->checksum);
-	(void) checksum;
-
-	if (length < sizeof(udp_header_t) ||
-	    length > sizeof(udp_header_t) + text_size)
-		return EINVAL;
-
-	nmsg = udp_msg_new();
-	if (nmsg == NULL)
-		return ENOMEM;
-
-	nmsg->data_size = length - sizeof(udp_header_t);
-	nmsg->data = malloc(nmsg->data_size);
-	if (nmsg->data == NULL)
-		return ENOMEM;
-
-	memcpy(nmsg->data, text, nmsg->data_size);
-
-	*msg = nmsg;
-	return EOK;
-}
-
-/** Encode outgoing PDU */
-errno_t udp_pdu_encode(inet_ep2_t *epp, udp_msg_t *msg, udp_pdu_t **pdu)
-{
-	udp_pdu_t *npdu;
-	udp_header_t *hdr;
-	uint16_t checksum;
-
-	npdu = udp_pdu_new();
-	if (npdu == NULL)
-		return ENOMEM;
-
-	npdu->iplink = epp->local_link;
-	npdu->src = epp->local.addr;
-	npdu->dest = epp->remote.addr;
-
-	npdu->data_size = sizeof(udp_header_t) + msg->data_size;
-	npdu->data = calloc(1, npdu->data_size);
-	if (npdu->data == NULL) {
-		udp_pdu_delete(npdu);
-		return ENOMEM;
-	}
-
-	hdr = (udp_header_t *)npdu->data;
-	hdr->src_port = host2uint16_t_be(epp->local.port);
-	hdr->dest_port = host2uint16_t_be(epp->remote.port);
-	hdr->length = host2uint16_t_be(npdu->data_size);
-	hdr->checksum = 0;
-
-	memcpy((uint8_t *)npdu->data + sizeof(udp_header_t), msg->data,
-	    msg->data_size);
-
-	/* Checksum calculation */
-	checksum = udp_pdu_checksum_calc(npdu);
-	udp_pdu_set_checksum(npdu, checksum);
-
-	*pdu = npdu;
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/pdu.h
===================================================================
--- uspace/srv/net/udp/pdu.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP PDU (encoded Protocol Data Unit) handling
- */
-
-#ifndef PDU_H
-#define PDU_H
-
-#include <inet/endpoint.h>
-#include "std.h"
-#include "udp_type.h"
-
-extern udp_pdu_t *udp_pdu_new(void);
-extern void udp_pdu_delete(udp_pdu_t *);
-extern errno_t udp_pdu_decode(udp_pdu_t *, inet_ep2_t *, udp_msg_t **);
-extern errno_t udp_pdu_encode(inet_ep2_t *, udp_msg_t *, udp_pdu_t **);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/service.c
===================================================================
--- uspace/srv/net/udp/service.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,671 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file HelenOS service implementation
- */
-
-#include <async.h>
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <ipc/services.h>
-#include <ipc/udp.h>
-#include <loc.h>
-#include <macros.h>
-#include <stdlib.h>
-
-#include "assoc.h"
-#include "cassoc.h"
-#include "msg.h"
-#include "service.h"
-#include "udp_type.h"
-
-#define NAME "udp"
-
-/** Maximum message size */
-#define MAX_MSG_SIZE DATA_XFER_LIMIT
-
-static void udp_recv_msg_cassoc(void *, inet_ep2_t *, udp_msg_t *);
-
-/** Callbacks to tie us to association layer */
-static udp_assoc_cb_t udp_cassoc_cb = {
-	.recv_msg = udp_recv_msg_cassoc
-};
-
-/** Send 'data' event to client.
- *
- * @param client Client
- */
-static void udp_ev_data(udp_client_t *client)
-{
-	async_exch_t *exch;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_ev_data()");
-
-	exch = async_exchange_begin(client->sess);
-	aid_t req = async_send_0(exch, UDP_EV_DATA, NULL);
-	async_exchange_end(exch);
-
-	async_forget(req);
-}
-
-/** Message received on client association.
- *
- * Used as udp_assoc_cb.recv_msg callback.
- *
- * @param arg Callback argument, client association
- * @param epp Endpoint pair where message was received
- * @param msg Message
- */
-static void udp_recv_msg_cassoc(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
-{
-	udp_cassoc_t *cassoc = (udp_cassoc_t *) arg;
-
-	udp_cassoc_queue_msg(cassoc, epp, msg);
-	udp_ev_data(cassoc->client);
-}
-
-/** Create association.
- *
- * Handle client request to create association (with parameters unmarshalled).
- *
- * @param client    UDP client
- * @param epp       Endpoint pair
- * @param rassoc_id Place to store ID of new association
- *
- * @return EOK on success or an error code
- */
-static errno_t udp_assoc_create_impl(udp_client_t *client, inet_ep2_t *epp,
-    sysarg_t *rassoc_id)
-{
-	udp_assoc_t *assoc;
-	udp_cassoc_t *cassoc;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_impl");
-
-	assoc = udp_assoc_new(epp, NULL, NULL);
-	if (assoc == NULL)
-		return EIO;
-
-	if (epp->local_link != 0)
-		udp_assoc_set_iplink(assoc, epp->local_link);
-
-	rc = udp_cassoc_create(client, assoc, &cassoc);
-	if (rc != EOK) {
-		assert(rc == ENOMEM);
-		udp_assoc_delete(assoc);
-		return ENOMEM;
-	}
-
-	assoc->cb = &udp_cassoc_cb;
-	assoc->cb_arg = cassoc;
-
-	rc = udp_assoc_add(assoc);
-	if (rc != EOK) {
-		udp_cassoc_destroy(cassoc);
-		udp_assoc_delete(assoc);
-		return rc;
-	}
-
-	*rassoc_id = cassoc->id;
-	return EOK;
-}
-
-/** Destroy association.
- *
- * Handle client request to destroy association (with parameters unmarshalled).
- *
- * @param client   UDP client
- * @param assoc_id Association ID
- * @return EOK on success, ENOENT if no such association is found
- */
-static errno_t udp_assoc_destroy_impl(udp_client_t *client, sysarg_t assoc_id)
-{
-	udp_cassoc_t *cassoc;
-	errno_t rc;
-
-	rc = udp_cassoc_get(client, assoc_id, &cassoc);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	udp_assoc_remove(cassoc->assoc);
-	udp_assoc_reset(cassoc->assoc);
-	udp_assoc_delete(cassoc->assoc);
-	udp_cassoc_destroy(cassoc);
-	return EOK;
-}
-
-/** Set association sending messages with no local address.
- *
- * Handle client request to set nolocal flag (with parameters unmarshalled).
- *
- * @param client   UDP client
- * @param assoc_id Association ID
- * @return EOK on success, ENOENT if no such association is found
- */
-static errno_t udp_assoc_set_nolocal_impl(udp_client_t *client, sysarg_t assoc_id)
-{
-	udp_cassoc_t *cassoc;
-	errno_t rc;
-
-	rc = udp_cassoc_get(client, assoc_id, &cassoc);
-	if (rc != EOK) {
-		assert(rc == ENOENT);
-		return ENOENT;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Setting nolocal to true");
-	cassoc->assoc->nolocal = true;
-	return EOK;
-}
-
-/** Send message via association.
- *
- * Handle client request to send message (with parameters unmarshalled).
- *
- * @param client   UDP client
- * @param assoc_id Association ID
- * @param dest     Destination endpoint or @c NULL to use the default from
- *                 association
- * @param data     Message data
- * @param size     Message size
- *
- * @return EOK on success or an error code
- */
-static errno_t udp_assoc_send_msg_impl(udp_client_t *client, sysarg_t assoc_id,
-    inet_ep_t *dest, void *data, size_t size)
-{
-	udp_msg_t msg;
-	udp_cassoc_t *cassoc;
-	errno_t rc;
-
-	rc = udp_cassoc_get(client, assoc_id, &cassoc);
-	if (rc != EOK)
-		return rc;
-
-	msg.data = data;
-	msg.data_size = size;
-	rc = udp_assoc_send(cassoc->assoc, dest, &msg);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-/** Create callback session.
- *
- * Handle client request to create callback session.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_callback_create_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_callback_create_srv()");
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL) {
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	client->sess = sess;
-	async_answer_0(icall, EOK);
-}
-
-/** Create association.
- *
- * Handle client request to create association.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_assoc_create_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	inet_ep2_t epp;
-	sysarg_t assoc_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_create_srv()");
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_ep2_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &epp, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	rc = udp_assoc_create_impl(client, &epp, &assoc_id);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_1(icall, EOK, assoc_id);
-}
-
-/** Destroy association.
- *
- * Handle client request to destroy association.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_assoc_destroy_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t assoc_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_destroy_srv()");
-
-	assoc_id = ipc_get_arg1(icall);
-	rc = udp_assoc_destroy_impl(client, assoc_id);
-	async_answer_0(icall, rc);
-}
-
-/** Set association with no local address.
- *
- * Handle client request to set no local address flag.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_assoc_set_nolocal_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	sysarg_t assoc_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "udp_assoc_set_nolocal_srv()");
-
-	assoc_id = ipc_get_arg1(icall);
-	rc = udp_assoc_set_nolocal_impl(client, assoc_id);
-	async_answer_0(icall, rc);
-}
-
-/** Send message via association.
- *
- * Handle client request to send message.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_assoc_send_msg_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	inet_ep_t dest;
-	sysarg_t assoc_id;
-	void *data;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_assoc_send_msg_srv()");
-
-	/* Receive dest */
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(inet_ep_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, &dest, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	/* Receive message data */
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size > MAX_MSG_SIZE) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	data = malloc(size);
-	if (data == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-	}
-
-	rc = async_data_write_finalize(&call, data, size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	assoc_id = ipc_get_arg1(icall);
-
-	rc = udp_assoc_send_msg_impl(client, assoc_id, &dest, data, size);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		free(data);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	free(data);
-}
-
-/** Get next received message.
- *
- * @param client UDP Client
- * @return Pointer to queue entry for next received message
- */
-static udp_crcv_queue_entry_t *udp_rmsg_get_next(udp_client_t *client)
-{
-	link_t *link;
-
-	link = list_first(&client->crcv_queue);
-	if (link == NULL)
-		return NULL;
-
-	return list_get_instance(link, udp_crcv_queue_entry_t, link);
-}
-
-/** Get info on first received message.
- *
- * Handle client request to get information on received message.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_rmsg_info_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	udp_crcv_queue_entry_t *enext;
-	sysarg_t assoc_id;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_info_srv()");
-	enext = udp_rmsg_get_next(client);
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (enext == NULL) {
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &enext->epp.remote,
-	    max(size, (size_t)sizeof(inet_ep_t)));
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	assoc_id = enext->cassoc->id;
-	size = enext->msg->data_size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_info_srv(): assoc_id=%zu, "
-	    "size=%zu", assoc_id, size);
-	async_answer_2(icall, EOK, assoc_id, size);
-}
-
-/** Read data from first received message.
- *
- * Handle client request to read data from first received message.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_rmsg_read_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t msg_size;
-	udp_crcv_queue_entry_t *enext;
-	void *data;
-	size_t size;
-	size_t off;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_read_srv()");
-	off = ipc_get_arg1(icall);
-
-	enext = udp_rmsg_get_next(client);
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (enext == NULL) {
-		async_answer_0(&call, ENOENT);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	data = enext->msg->data + off;
-	msg_size = enext->msg->data_size;
-
-	if (off > msg_size) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, data, min(msg_size - off, size));
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_read_srv(): OK");
-}
-
-/** Discard first received message.
- *
- * Handle client request to discard first received message, advancing
- * to the next one.
- *
- * @param client UDP client
- * @param icall  Async request data
- *
- */
-static void udp_rmsg_discard_srv(udp_client_t *client, ipc_call_t *icall)
-{
-	udp_crcv_queue_entry_t *enext;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_rmsg_discard_srv()");
-
-	enext = udp_rmsg_get_next(client);
-	if (enext == NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "usg_rmsg_discard_srv: enext==NULL");
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	list_remove(&enext->link);
-	udp_msg_delete(enext->msg);
-	free(enext);
-	async_answer_0(icall, EOK);
-}
-
-/** Handle UDP client connection.
- *
- * @param icall Connect call data
- * @param arg   Connection argument
- *
- */
-static void udp_client_conn(ipc_call_t *icall, void *arg)
-{
-	udp_client_t client;
-	unsigned long n;
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_client_conn()");
-
-	client.sess = NULL;
-	list_initialize(&client.cassoc);
-	list_initialize(&client.crcv_queue);
-
-	while (true) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_client_conn: wait req");
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_client_conn: method=%d",
-		    (int)method);
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (method) {
-		case UDP_CALLBACK_CREATE:
-			udp_callback_create_srv(&client, &call);
-			break;
-		case UDP_ASSOC_CREATE:
-			udp_assoc_create_srv(&client, &call);
-			break;
-		case UDP_ASSOC_DESTROY:
-			udp_assoc_destroy_srv(&client, &call);
-			break;
-		case UDP_ASSOC_SET_NOLOCAL:
-			udp_assoc_set_nolocal_srv(&client, &call);
-			break;
-		case UDP_ASSOC_SEND_MSG:
-			udp_assoc_send_msg_srv(&client, &call);
-			break;
-		case UDP_RMSG_INFO:
-			udp_rmsg_info_srv(&client, &call);
-			break;
-		case UDP_RMSG_READ:
-			udp_rmsg_read_srv(&client, &call);
-			break;
-		case UDP_RMSG_DISCARD:
-			udp_rmsg_discard_srv(&client, &call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_client_conn: terminated");
-
-	n = list_count(&client.cassoc);
-	if (n != 0) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "udp_client_conn: "
-		    "Client with %lu active associations closed session.", n);
-		/* XXX Clean up */
-	}
-
-	/* XXX Clean up client receive queue */
-
-	if (client.sess != NULL)
-		async_hangup(client.sess);
-}
-
-/** Initialize UDP service.
- *
- * @return EOK on success or an error code.
- */
-errno_t udp_service_init(void)
-{
-	errno_t rc;
-	service_id_t sid;
-	loc_srv_t *srv;
-
-	async_set_fallback_port_handler(udp_client_conn, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
-		return EIO;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_UDP, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service.");
-		return EIO;
-	}
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/service.h
===================================================================
--- uspace/srv/net/udp/service.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file HelenOS service implementation
- */
-
-#ifndef SERVICE_H
-#define SERVICE_H
-
-extern errno_t udp_service_init(void);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/std.h
===================================================================
--- uspace/srv/net/udp/std.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,87 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP standard definitions
- *
- * Based on IETF RFC 768
- */
-
-#ifndef STD_H
-#define STD_H
-
-#include <stdint.h>
-
-#define IP_PROTO_UDP  17
-
-/** UDP Header */
-typedef struct {
-	/** Source port */
-	uint16_t src_port;
-	/** Destination port */
-	uint16_t dest_port;
-	/** Length (header + data) */
-	uint16_t length;
-	/* Checksum */
-	uint16_t checksum;
-} udp_header_t;
-
-/** UDP over IPv4 checksum pseudo header */
-typedef struct {
-	/** Source address */
-	uint32_t src_addr;
-	/** Destination address */
-	uint32_t dest_addr;
-	/** Zero */
-	uint8_t zero;
-	/** Protocol */
-	uint8_t protocol;
-	/** UDP length */
-	uint16_t udp_length;
-} udp_phdr_t;
-
-/** UDP over IPv6 checksum pseudo header */
-typedef struct {
-	/** Source address */
-	addr128_t src_addr;
-	/** Destination address */
-	addr128_t dest_addr;
-	/** UDP length */
-	uint32_t udp_length;
-	/** Zeroes */
-	uint8_t zeroes[3];
-	/** Next header */
-	uint8_t next;
-} udp_phdr6_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/test/assoc.c
===================================================================
--- uspace/srv/net/udp/test/assoc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,410 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inet/endpoint.h>
-#include <io/log.h>
-#include <pcut/pcut.h>
-#include <str.h>
-
-#include "../assoc.h"
-#include "../msg.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(assoc);
-
-static void test_recv_msg(void *, inet_ep2_t *, udp_msg_t *);
-
-static udp_assoc_cb_t test_assoc_cb = {
-	.recv_msg = test_recv_msg
-};
-
-static errno_t test_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-static errno_t test_transmit_msg(inet_ep2_t *, udp_msg_t *);
-
-static udp_assocs_dep_t test_assocs_dep = {
-	.get_srcaddr = test_get_srcaddr,
-	.transmit_msg = test_transmit_msg
-};
-
-static inet_ep2_t *sent_epp;
-static udp_msg_t *sent_msg;
-
-PCUT_TEST_BEFORE
-{
-	errno_t rc;
-
-	/* We will be calling functions that perform logging */
-	rc = log_init("test-udp");
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = udp_assocs_init(&test_assocs_dep);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-}
-
-PCUT_TEST_AFTER
-{
-	udp_assocs_fini();
-}
-
-/** Test creating and deleting association */
-PCUT_TEST(new_delete)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	udp_assoc_delete(assoc);
-}
-
-/** Test adding, removing association */
-PCUT_TEST(add_remove)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Test adding, removing a reference to association */
-PCUT_TEST(addref_delref)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	udp_assoc_addref(assoc);
-	udp_assoc_delref(assoc);
-
-	udp_assoc_delete(assoc);
-}
-
-/** Test setting IP link in association */
-PCUT_TEST(set_iplink)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	udp_assoc_set_iplink(assoc, 42);
-	PCUT_ASSERT_INT_EQUALS(42, assoc->ident.local_link);
-
-	udp_assoc_delete(assoc);
-}
-
-/** Sending message with destination not set in association and NULL
- * destination argument should fail with EINVAL.
- */
-PCUT_TEST(send_null_dest)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	inet_ep_t dest;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_ep_init(&dest);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = udp_assoc_send(assoc, &dest, msg);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	udp_msg_delete(msg);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Sending message with destination not set in association and unset
- * destination argument should fail with EINVAL.
- */
-PCUT_TEST(send_unset_dest)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	inet_ep_t dest;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_ep_init(&dest);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = udp_assoc_send(assoc, &dest, msg);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	udp_msg_delete(msg);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Sending message with explicit destination */
-PCUT_TEST(send_explicit_dest)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	inet_ep_t dest;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_addr(&dest.addr, 127, 0, 0, 1);
-	dest.port = 42;
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sent_epp = NULL;
-	sent_msg = NULL;
-
-	rc = udp_assoc_send(assoc, &dest, msg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(msg, sent_msg);
-	PCUT_ASSERT_TRUE(inet_addr_compare(&dest.addr, &sent_epp->remote.addr));
-	PCUT_ASSERT_EQUALS(dest.port, sent_epp->remote.port);
-
-	udp_msg_delete(msg);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Sending message with destination set in association and inet_addr_any /
- * inet_port_any destination argument
- */
-PCUT_TEST(send_assoc_any_dest)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	inet_ep_t ep;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = 42;
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = 1;
-
-	inet_ep_init(&ep);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	sent_epp = NULL;
-	sent_msg = NULL;
-
-	rc = udp_assoc_send(assoc, &ep, msg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	PCUT_ASSERT_EQUALS(msg, sent_msg);
-	PCUT_ASSERT_TRUE(inet_addr_compare(&epp.remote.addr, &sent_epp->remote.addr));
-	PCUT_ASSERT_EQUALS(epp.remote.port, sent_epp->remote.port);
-
-	udp_msg_delete(msg);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Sending message with destination set in association and unset destination
- * argument should return EINVAL
- */
-PCUT_TEST(send_assoc_unset_dest)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	inet_ep_t dest;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = 1;
-	inet_ep_init(&dest);
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = udp_assoc_send(assoc, &dest, msg);
-	PCUT_ASSERT_ERRNO_VAL(EINVAL, rc);
-
-	udp_msg_delete(msg);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-PCUT_TEST(recv)
-{
-	// XXX Looks like currently udp_assoc_recv() is not used at all
-}
-
-/** Test udp_assoc_received() */
-PCUT_TEST(received)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-	errno_t rc;
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-	bool received;
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.remote.addr, 127, 0, 0, 1);
-	epp.remote.port = 1;
-	inet_addr(&epp.local.addr, 127, 0, 0, 1);
-	epp.local.port = 2;
-
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, (void *) &received);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	rc = udp_assoc_add(assoc);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	received = false;
-	udp_assoc_received(&epp, msg);
-	PCUT_ASSERT_TRUE(received);
-
-	udp_assoc_remove(assoc);
-	udp_assoc_delete(assoc);
-}
-
-/** Test udp_assoc_reset() */
-PCUT_TEST(reset)
-{
-	udp_assoc_t *assoc;
-	inet_ep2_t epp;
-
-	inet_ep2_init(&epp);
-	assoc = udp_assoc_new(&epp, &test_assoc_cb, NULL);
-	PCUT_ASSERT_NOT_NULL(assoc);
-
-	udp_assoc_reset(assoc);
-	udp_assoc_delete(assoc);
-}
-
-static void test_recv_msg(void *arg, inet_ep2_t *epp, udp_msg_t *msg)
-{
-	bool *received = (bool *) arg;
-
-	*received = true;
-}
-
-static errno_t test_get_srcaddr(inet_addr_t *remote, uint8_t tos,
-    inet_addr_t *local)
-{
-	inet_addr(local, 127, 0, 0, 1);
-	return EOK;
-}
-
-static errno_t test_transmit_msg(inet_ep2_t *epp, udp_msg_t *msg)
-{
-	sent_epp = epp;
-	sent_msg = msg;
-	return EOK;
-}
-
-PCUT_EXPORT(assoc);
Index: pace/srv/net/udp/test/main.c
===================================================================
--- uspace/srv/net/udp/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(assoc);
-PCUT_IMPORT(msg);
-PCUT_IMPORT(pdu);
-
-PCUT_MAIN();
Index: pace/srv/net/udp/test/msg.c
===================================================================
--- uspace/srv/net/udp/test/msg.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../msg.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(msg);
-
-/** Test creating and deleting dummy message */
-PCUT_TEST(new_delete)
-{
-	udp_msg_t *msg;
-
-	msg = udp_msg_new();
-	udp_msg_delete(msg);
-}
-
-/** Test creating, filling in and deleting message */
-PCUT_TEST(new_fill_in_delete)
-{
-	udp_msg_t *msg;
-	const char *msgstr = "Hello";
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	udp_msg_delete(msg);
-}
-
-PCUT_EXPORT(msg);
Index: pace/srv/net/udp/test/pdu.c
===================================================================
--- uspace/srv/net/udp/test/pdu.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/*
- * Copyright (c) 2019 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <inet/endpoint.h>
-#include <pcut/pcut.h>
-#include <str.h>
-#include "../msg.h"
-#include "../pdu.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(pdu);
-
-/** Test creating and deleting dummy PDU */
-PCUT_TEST(new_delete)
-{
-	udp_pdu_t *pdu;
-
-	pdu = udp_pdu_new();
-	udp_pdu_delete(pdu);
-}
-
-/** Test encoding and decoding back IPv4 PDU */
-PCUT_TEST(encode_decode_v4)
-{
-	inet_ep2_t epp;
-	udp_msg_t *msg;
-	inet_ep2_t depp;
-	udp_msg_t *dmsg;
-	udp_pdu_t *pdu;
-	const char *msgstr = "Hello";
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	inet_addr(&epp.local.addr, 192, 168, 0, 1);
-	epp.local.port = 1;
-	inet_addr(&epp.remote.addr, 192, 168, 0, 2);
-	epp.remote.port = 2;
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	rc = udp_pdu_encode(&epp, msg, &pdu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = udp_pdu_decode(pdu, &depp, &dmsg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Compare epp and depp. Local and remote should be swapped. */
-	PCUT_ASSERT_TRUE(inet_addr_compare(&epp.local.addr, &depp.remote.addr));
-	PCUT_ASSERT_EQUALS(epp.local.port, depp.remote.port);
-	PCUT_ASSERT_TRUE(inet_addr_compare(&epp.remote.addr, &depp.local.addr));
-	PCUT_ASSERT_EQUALS(epp.remote.port, depp.local.port);
-
-	/* Compare msg and dmsg */
-	PCUT_ASSERT_EQUALS(msg->data_size, dmsg->data_size);
-	PCUT_ASSERT_TRUE(memcmp(msg->data, dmsg->data, dmsg->data_size) == 0);
-
-	udp_pdu_delete(pdu);
-	udp_msg_delete(msg);
-	udp_msg_delete(dmsg);
-}
-
-PCUT_TEST(encode_decode_v6)
-{
-	inet_ep2_t epp;
-	udp_msg_t *msg;
-	inet_ep2_t depp;
-	udp_msg_t *dmsg;
-	udp_pdu_t *pdu;
-	const char *msgstr = "Hello";
-	errno_t rc;
-
-	inet_ep2_init(&epp);
-	inet_addr6(&epp.local.addr, 0xfc00, 0, 0, 0, 0, 0, 0, 1);
-	epp.local.port = 1;
-	inet_addr6(&epp.remote.addr, 0xfc00, 0, 0, 0, 0, 0, 0, 2);
-	epp.remote.port = 2;
-
-	msg = udp_msg_new();
-	PCUT_ASSERT_NOT_NULL(msg);
-	msg->data_size = str_size(msgstr) + 1;
-	msg->data = str_dup(msgstr);
-
-	rc = udp_pdu_encode(&epp, msg, &pdu);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-	rc = udp_pdu_decode(pdu, &depp, &dmsg);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Compare epp and depp. Local and remote should be swapped. */
-	PCUT_ASSERT_TRUE(inet_addr_compare(&epp.local.addr, &depp.remote.addr));
-	PCUT_ASSERT_EQUALS(epp.local.port, depp.remote.port);
-	PCUT_ASSERT_TRUE(inet_addr_compare(&epp.remote.addr, &depp.local.addr));
-	PCUT_ASSERT_EQUALS(epp.remote.port, depp.local.port);
-
-	/* Compare msg and dmsg */
-	PCUT_ASSERT_EQUALS(msg->data_size, dmsg->data_size);
-	PCUT_ASSERT_TRUE(memcmp(msg->data, dmsg->data, dmsg->data_size) == 0);
-
-	udp_pdu_delete(pdu);
-	udp_msg_delete(msg);
-	udp_msg_delete(dmsg);
-}
-
-PCUT_EXPORT(pdu);
Index: pace/srv/net/udp/udp.c
===================================================================
--- uspace/srv/net/udp/udp.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,107 +1,0 @@
-/*
- * Copyright (c) 2012 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file UDP (User Datagram Protocol) service
- */
-
-#include <async.h>
-#include <errno.h>
-#include <io/log.h>
-#include <stdio.h>
-#include <task.h>
-
-#include "assoc.h"
-#include "service.h"
-#include "udp_inet.h"
-
-#define NAME       "udp"
-
-static udp_assocs_dep_t udp_assocs_dep = {
-	.get_srcaddr = udp_get_srcaddr,
-	.transmit_msg = udp_transmit_msg
-};
-
-static errno_t udp_init(void)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_init()");
-
-	rc = udp_assocs_init(&udp_assocs_dep);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing associations.");
-		return ENOMEM;
-	}
-
-	rc = udp_inet_init();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting to internet service.");
-		return ENOENT;
-	}
-
-	rc = udp_service_init();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed initializing UDP service.");
-		return ENOENT;
-	}
-
-	return EOK;
-}
-
-int main(int argc, char **argv)
-{
-	errno_t rc;
-
-	printf(NAME ": UDP (User Datagram Protocol) service\n");
-
-	rc = log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed to initialize log.\n");
-		return 1;
-	}
-
-	rc = udp_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/udp_inet.c
===================================================================
--- uspace/srv/net/udp/udp_inet.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,170 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-
-/**
- * @file
- */
-
-#include <errno.h>
-#include <inet/inet.h>
-#include <io/log.h>
-
-#include "assoc.h"
-#include "pdu.h"
-#include "std.h"
-#include "udp_inet.h"
-#include "udp_type.h"
-
-static errno_t udp_inet_ev_recv(inet_dgram_t *dgram);
-static void udp_received_pdu(udp_pdu_t *pdu);
-
-static inet_ev_ops_t udp_inet_ev_ops = {
-	.recv = udp_inet_ev_recv
-};
-
-/** Received datagram callback */
-static errno_t udp_inet_ev_recv(inet_dgram_t *dgram)
-{
-	udp_pdu_t *pdu;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_inet_ev_recv()");
-
-	pdu = udp_pdu_new();
-	pdu->iplink = dgram->iplink;
-	pdu->data = dgram->data;
-	pdu->data_size = dgram->size;
-
-	pdu->src = dgram->src;
-	pdu->dest = dgram->dest;
-
-	udp_received_pdu(pdu);
-
-	/* We don't want udp_pdu_delete() to free dgram->data */
-	pdu->data = NULL;
-	udp_pdu_delete(pdu);
-
-	return EOK;
-}
-
-/** Transmit PDU over network layer. */
-errno_t udp_transmit_pdu(udp_pdu_t *pdu)
-{
-	errno_t rc;
-	inet_dgram_t dgram;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_pdu()");
-
-	dgram.iplink = pdu->iplink;
-	dgram.src = pdu->src;
-	dgram.dest = pdu->dest;
-	dgram.tos = 0;
-	dgram.data = pdu->data;
-	dgram.size = pdu->data_size;
-
-	rc = inet_send(&dgram, INET_TTL_MAX, 0);
-	if (rc != EOK)
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed to transmit PDU.");
-
-	return rc;
-}
-
-/** Process received PDU. */
-static void udp_received_pdu(udp_pdu_t *pdu)
-{
-	udp_msg_t *dmsg;
-	inet_ep2_t rident;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_received_pdu()");
-
-	if (udp_pdu_decode(pdu, &rident, &dmsg) != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. PDU dropped.");
-		return;
-	}
-
-	/*
-	 * Insert decoded message into appropriate receive queue.
-	 * This transfers ownership of dmsg to the callee, we do not
-	 * free it.
-	 */
-	udp_assoc_received(&rident, dmsg);
-}
-
-errno_t udp_inet_init(void)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_inet_init()");
-
-	rc = inet_init(IP_PROTO_UDP, &udp_inet_ev_ops);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed connecting to internet service.");
-		return ENOENT;
-	}
-
-	return EOK;
-}
-
-/** Get source address.
- *
- * @param remote Remote address
- * @param tos Type of service
- * @param local Place to store local address
- * @return EOK on success or an error code
- */
-errno_t udp_get_srcaddr(inet_addr_t *remote, uint8_t tos, inet_addr_t *local)
-{
-	return inet_get_srcaddr(remote, tos, local);
-}
-
-/** Transmit message over network layer. */
-errno_t udp_transmit_msg(inet_ep2_t *epp, udp_msg_t *msg)
-{
-	udp_pdu_t *pdu;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "udp_transmit_msg()");
-
-	rc = udp_pdu_encode(epp, msg, &pdu);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed encoding PDU");
-		return rc;
-	}
-
-	rc = udp_transmit_pdu(pdu);
-	udp_pdu_delete(pdu);
-
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/net/udp/udp_inet.h
===================================================================
--- uspace/srv/net/udp/udp_inet.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * Copyright (c) 2011 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file
- */
-
-#ifndef UDP_INET_H
-#define UDP_INET_H
-
-#include <inet/addr.h>
-#include <stdint.h>
-#include "udp_type.h"
-
-extern errno_t udp_inet_init(void);
-extern errno_t udp_transmit_pdu(udp_pdu_t *);
-extern errno_t udp_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
-extern errno_t udp_transmit_msg(inet_ep2_t *, udp_msg_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/net/udp/udp_type.h
===================================================================
--- uspace/srv/net/udp/udp_type.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,198 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup udp
- * @{
- */
-/** @file UDP type definitions
- */
-
-#ifndef UDP_TYPE_H
-#define UDP_TYPE_H
-
-#include <async.h>
-#include <errno.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <inet/endpoint.h>
-#include <ipc/loc.h>
-#include <refcount.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <inet/addr.h>
-
-#define UDP_FRAGMENT_SIZE 65535
-
-/** UDP error codes */
-typedef enum {
-	UDP_EOK,
-	/* Insufficient resources */
-	UDP_ENORES,
-	/* Remote endpoint unspecified */
-	UDP_EUNSPEC,
-	/* No route to destination */
-	UDP_ENOROUTE,
-	/** Association reset by user */
-	UDP_ERESET
-} udp_error_t;
-
-typedef enum {
-	XF_DUMMY = 0x1
-} xflags_t;
-
-/** Unencoded UDP message (datagram) */
-typedef struct {
-	/** Message data */
-	void *data;
-	/** Message data size */
-	size_t data_size;
-} udp_msg_t;
-
-/** Encoded PDU */
-typedef struct {
-	/** IP link (optional) */
-	service_id_t iplink;
-	/** Source address */
-	inet_addr_t src;
-	/** Destination address */
-	inet_addr_t dest;
-	/** Encoded PDU data including header */
-	void *data;
-	/** Encoded PDU data size */
-	size_t data_size;
-} udp_pdu_t;
-
-/** Functions needed by associations module.
- *
- * Functions that need to be provided by the caller so that the associations
- * module can function.
- */
-typedef struct {
-	errno_t (*get_srcaddr)(inet_addr_t *, uint8_t, inet_addr_t *);
-	errno_t (*transmit_msg)(inet_ep2_t *, udp_msg_t *);
-} udp_assocs_dep_t;
-
-/** Association callbacks.
- *
- * Callbacks for a particular association, to notify caller of events
- * on the association.
- */
-typedef struct {
-	/** Message received */
-	void (*recv_msg)(void *, inet_ep2_t *, udp_msg_t *);
-} udp_assoc_cb_t;
-
-/** UDP association
- *
- * This is a rough equivalent of a TCP connection endpoint. It allows
- * sending and receiving UDP datagrams and it is uniquely identified
- * by an endpoint pair.
- */
-typedef struct {
-	char *name;
-	link_t link;
-
-	/** Association identification (endpoint pair) */
-	inet_ep2_t ident;
-
-	/** True if association was reset by user */
-	bool reset;
-
-	/** True if association was deleted by user */
-	bool deleted;
-
-	/** Protects access to association structure */
-	fibril_mutex_t lock;
-	/** Reference count */
-	atomic_refcount_t refcnt;
-
-	/** Receive queue */
-	list_t rcv_queue;
-	/** Receive queue CV. Broadcast when new datagram is inserted */
-	fibril_condvar_t rcv_queue_cv;
-	/** Allow sending messages with no local address */
-	bool nolocal;
-
-	udp_assoc_cb_t *cb;
-	void *cb_arg;
-} udp_assoc_t;
-
-typedef struct {
-} udp_assoc_status_t;
-
-/** UDP receive queue entry */
-typedef struct {
-	/** Link to receive queue */
-	link_t link;
-	/** Endpoint pair */
-	inet_ep2_t epp;
-	/** Message */
-	udp_msg_t *msg;
-} udp_rcv_queue_entry_t;
-
-/** UDP client association.
- *
- * Ties a UDP association into the namespace of a client
- */
-typedef struct udp_cassoc {
-	/** Association */
-	udp_assoc_t *assoc;
-	/** Association ID for the client */
-	sysarg_t id;
-	/** Client */
-	struct udp_client *client;
-	link_t lclient;
-} udp_cassoc_t;
-
-/** UDP client receive queue entry */
-typedef struct {
-	/** Link to receive queue */
-	link_t link;
-	/** Endpoint pair */
-	inet_ep2_t epp;
-	/** Message */
-	udp_msg_t *msg;
-	/** Client association */
-	udp_cassoc_t *cassoc;
-} udp_crcv_queue_entry_t;
-
-/** UDP client */
-typedef struct udp_client {
-	/** Client callback session */
-	async_sess_t *sess;
-	/** Client assocations */
-	list_t cassoc; /* of udp_cassoc_t */
-	/** Client receive queue */
-	list_t crcv_queue;
-} udp_client_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/ns/clonable.c
===================================================================
--- uspace/srv/ns/clonable.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#include <async.h>
-#include <ipc/services.h>
-#include <adt/list.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <loader/loader.h>
-#include "clonable.h"
-#include "ns.h"
-
-/** Request for connection to a clonable service. */
-typedef struct {
-	link_t link;
-	service_t service;
-	iface_t iface;
-	ipc_call_t call;
-} cs_req_t;
-
-/** List of clonable-service connection requests. */
-static list_t cs_req;
-
-errno_t ns_clonable_init(void)
-{
-	list_initialize(&cs_req);
-	return EOK;
-}
-
-/** Return true if @a service is clonable. */
-bool ns_service_is_clonable(service_t service, iface_t iface)
-{
-	return (service == SERVICE_LOADER) && (iface == INTERFACE_LOADER);
-}
-
-/** Register clonable service.
- *
- * @param call Pointer to call structure.
- *
- */
-void ns_clonable_register(ipc_call_t *call)
-{
-	link_t *req_link = list_first(&cs_req);
-	if (req_link == NULL) {
-		/* There was no pending connection request. */
-		printf("%s: Unexpected clonable server.\n", NAME);
-		async_answer_0(call, EBUSY);
-		return;
-	}
-
-	cs_req_t *csr = list_get_instance(req_link, cs_req_t, link);
-	list_remove(req_link);
-
-	/* Currently we can only handle a single type of clonable service. */
-	assert(ns_service_is_clonable(csr->service, csr->iface));
-
-	async_answer_0(call, EOK);
-
-	async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (sess == NULL)
-		async_answer_0(call, EIO);
-
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_forward_1(&csr->call, exch, csr->iface,
-	    ipc_get_arg3(&csr->call), IPC_FF_NONE);
-	async_exchange_end(exch);
-
-	free(csr);
-	async_hangup(sess);
-}
-
-/** Connect client to clonable service.
- *
- * @param service Service to be connected to.
- * @param iface   Interface to be connected to.
- * @param call    Pointer to call structure.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-void ns_clonable_forward(service_t service, iface_t iface, ipc_call_t *call)
-{
-	assert(ns_service_is_clonable(service, iface));
-
-	cs_req_t *csr = malloc(sizeof(cs_req_t));
-	if (csr == NULL) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	/* Spawn a loader. */
-	errno_t rc = loader_spawn("loader");
-
-	if (rc != EOK) {
-		free(csr);
-		async_answer_0(call, rc);
-		return;
-	}
-
-	link_initialize(&csr->link);
-	csr->service = service;
-	csr->iface = iface;
-	csr->call = *call;
-
-	/*
-	 * We can forward the call only after the server we spawned connects
-	 * to us. Meanwhile we might need to service more connection requests.
-	 * Thus we store the call in a queue.
-	 */
-	list_append(&csr->link, &cs_req);
-}
-
-/**
- * @}
- */
Index: pace/srv/ns/clonable.h
===================================================================
--- uspace/srv/ns/clonable.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#ifndef NS_CLONABLE_H__
-#define NS_CLONABLE_H__
-
-#include <ipc/common.h>
-#include <ipc/services.h>
-#include <abi/ipc/interfaces.h>
-#include <stdbool.h>
-
-extern errno_t ns_clonable_init(void);
-
-extern bool ns_service_is_clonable(service_t, iface_t);
-extern void ns_clonable_register(ipc_call_t *);
-extern void ns_clonable_forward(service_t, iface_t, ipc_call_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/ns/doc/doxygroups.h
===================================================================
--- uspace/srv/ns/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ns ns
- * @ingroup srvs
- * @brief Naming service
- */
Index: pace/srv/ns/meson.build
===================================================================
--- uspace/srv/ns/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'ns.c',
-	'service.c',
-	'clonable.c',
-	'task.c',
-)
Index: pace/srv/ns/ns.c
===================================================================
--- uspace/srv/ns/ns.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2006 Ondrej Palkovsky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-/**
- * @file  ns.c
- * @brief Naming service for HelenOS IPC.
- */
-
-#include <abi/ipc/methods.h>
-#include <async.h>
-#include <ipc/ns.h>
-#include <ipc/services.h>
-#include <abi/ipc/interfaces.h>
-#include <stdio.h>
-#include <errno.h>
-#include <macros.h>
-#include "ns.h"
-#include "service.h"
-#include "clonable.h"
-#include "task.h"
-
-static void ns_connection(ipc_call_t *icall, void *arg)
-{
-	ipc_call_t call;
-	iface_t iface;
-	service_t service;
-
-	iface = ipc_get_arg1(icall);
-	service = ipc_get_arg2(icall);
-	if (service != 0) {
-		/*
-		 * Client requests to be connected to a service.
-		 */
-		if (ns_service_is_clonable(service, iface)) {
-			ns_clonable_forward(service, iface, icall);
-		} else {
-			ns_service_forward(service, iface, icall);
-		}
-
-		return;
-	}
-
-	async_accept_0(icall);
-
-	while (true) {
-		ns_pending_conn_process();
-
-		async_get_call(&call);
-		if (!ipc_get_imethod(&call))
-			break;
-
-		task_id_t id;
-		errno_t retval;
-
-		service_t service;
-
-		switch (ipc_get_imethod(&call)) {
-		case NS_REGISTER:
-			service = ipc_get_arg1(&call);
-			iface = ipc_get_arg2(&call);
-
-			/*
-			 * Server requests service registration.
-			 */
-			if (ns_service_is_clonable(service, iface)) {
-				ns_clonable_register(&call);
-				continue;
-			} else {
-				retval = ns_service_register(service, iface);
-			}
-
-			break;
-		case NS_REGISTER_BROKER:
-			service = ipc_get_arg1(&call);
-			retval = ns_service_register_broker(service);
-			break;
-		case NS_PING:
-			retval = EOK;
-			break;
-		case NS_TASK_WAIT:
-			id = (task_id_t)
-			    MERGE_LOUP32(ipc_get_arg1(&call), ipc_get_arg2(&call));
-			wait_for_task(id, &call);
-			continue;
-		case NS_ID_INTRO:
-			retval = ns_task_id_intro(&call);
-			break;
-		case NS_RETVAL:
-			retval = ns_task_retval(&call);
-			break;
-		default:
-			printf("%s: Method not supported (%" PRIun ")\n",
-			    NAME, ipc_get_imethod(&call));
-			retval = ENOTSUP;
-			break;
-		}
-
-		async_answer_0(&call, retval);
-	}
-
-	(void) ns_task_disconnect(&call);
-	async_answer_0(&call, EOK);
-}
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS IPC Naming Service\n", NAME);
-
-	errno_t rc = ns_service_init();
-	if (rc != EOK)
-		return rc;
-
-	rc = ns_clonable_init();
-	if (rc != EOK)
-		return rc;
-
-	rc = task_init();
-	if (rc != EOK)
-		return rc;
-
-	async_set_fallback_port_handler(ns_connection, NULL);
-
-	printf("%s: Accepting connections\n", NAME);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/ns/ns.h
===================================================================
--- uspace/srv/ns/ns.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#ifndef NS_NS_H__
-#define NS_NS_H__
-
-#define NAME  "ns"
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/ns/service.c
===================================================================
--- uspace/srv/ns/service.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,428 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#include <adt/hash_table.h>
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "service.h"
-#include "ns.h"
-
-/** Service hash table item. */
-typedef struct {
-	ht_link_t link;
-
-	/** Service ID */
-	service_t service;
-
-	/** Interface hash table */
-	hash_table_t iface_hash_table;
-
-	/** Broker session to the service */
-	async_sess_t *broker_sess;
-} hashed_service_t;
-
-/** Interface hash table item. */
-typedef struct {
-	ht_link_t link;
-
-	/** Interface ID */
-	iface_t iface;
-
-	/** Session to the service */
-	async_sess_t *sess;
-} hashed_iface_t;
-
-static size_t service_key_hash(const void *key)
-{
-	const service_t *srv = key;
-	return *srv;
-}
-
-static size_t service_hash(const ht_link_t *item)
-{
-	hashed_service_t *service =
-	    hash_table_get_inst(item, hashed_service_t, link);
-
-	return service->service;
-}
-
-static bool service_key_equal(const void *key, size_t hash,
-    const ht_link_t *item)
-{
-	const service_t *srv = key;
-	hashed_service_t *service =
-	    hash_table_get_inst(item, hashed_service_t, link);
-
-	return service->service == *srv;
-}
-
-static size_t iface_key_hash(const void *key)
-{
-	const iface_t *iface = key;
-	return *iface;
-}
-
-static size_t iface_hash(const ht_link_t *item)
-{
-	hashed_iface_t *iface =
-	    hash_table_get_inst(item, hashed_iface_t, link);
-
-	return iface->iface;
-}
-
-static bool iface_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const iface_t *kiface = key;
-	hashed_iface_t *iface =
-	    hash_table_get_inst(item, hashed_iface_t, link);
-
-	return iface->iface == *kiface;
-}
-
-/** Operations for service hash table. */
-static const hash_table_ops_t service_hash_table_ops = {
-	.hash = service_hash,
-	.key_hash = service_key_hash,
-	.key_equal = service_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-/** Operations for interface hash table. */
-static const hash_table_ops_t iface_hash_table_ops = {
-	.hash = iface_hash,
-	.key_hash = iface_key_hash,
-	.key_equal = iface_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL
-};
-
-/** Service hash table structure. */
-static hash_table_t service_hash_table;
-
-/** Pending connection structure. */
-typedef struct {
-	link_t link;
-	service_t service;         /**< Service ID */
-	iface_t iface;             /**< Interface ID */
-	ipc_call_t call;           /**< Call waiting for the connection */
-} pending_conn_t;
-
-static list_t pending_conn;
-
-errno_t ns_service_init(void)
-{
-	if (!hash_table_create(&service_hash_table, 0, 0,
-	    &service_hash_table_ops)) {
-		printf("%s: No memory available for services\n", NAME);
-		return ENOMEM;
-	}
-
-	list_initialize(&pending_conn);
-
-	return EOK;
-}
-
-static void ns_forward(async_sess_t *sess, ipc_call_t *call, iface_t iface)
-{
-	async_exch_t *exch = async_exchange_begin(sess);
-	async_forward_1(call, exch, iface, ipc_get_arg3(call), IPC_FF_NONE);
-	async_exchange_end(exch);
-}
-
-/** Process pending connection requests */
-void ns_pending_conn_process(void)
-{
-loop:
-	list_foreach(pending_conn, link, pending_conn_t, pending) {
-		ht_link_t *link =
-		    hash_table_find(&service_hash_table, &pending->service);
-		if (!link)
-			continue;
-
-		hashed_service_t *hashed_service =
-		    hash_table_get_inst(link, hashed_service_t, link);
-
-		link = hash_table_find(&hashed_service->iface_hash_table,
-		    &pending->iface);
-		if (!link) {
-			if (hashed_service->broker_sess != NULL) {
-				ns_forward(hashed_service->broker_sess, &pending->call,
-				    pending->iface);
-
-				list_remove(&pending->link);
-				free(pending);
-
-				goto loop;
-			}
-
-			continue;
-		}
-
-		hashed_iface_t *hashed_iface =
-		    hash_table_get_inst(link, hashed_iface_t, link);
-
-		ns_forward(hashed_iface->sess, &pending->call, pending->iface);
-
-		list_remove(&pending->link);
-		free(pending);
-
-		goto loop;
-	}
-}
-
-/** Register interface to a service.
- *
- * @param service Service to which the interface belongs.
- * @param iface   Interface to be registered.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-static errno_t ns_iface_register(hashed_service_t *hashed_service, iface_t iface)
-{
-	ht_link_t *link = hash_table_find(&hashed_service->iface_hash_table,
-	    &iface);
-	if (link)
-		return EEXIST;
-
-	hashed_iface_t *hashed_iface =
-	    (hashed_iface_t *) malloc(sizeof(hashed_iface_t));
-	if (!hashed_iface)
-		return ENOMEM;
-
-	hashed_iface->iface = iface;
-	hashed_iface->sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (hashed_iface->sess == NULL) {
-		free(hashed_iface);
-		return EIO;
-	}
-
-	hash_table_insert(&hashed_service->iface_hash_table,
-	    &hashed_iface->link);
-	return EOK;
-}
-
-/** Register broker to a service.
- *
- * @param service Service to which the broker belongs.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-static errno_t ns_broker_register(hashed_service_t *hashed_service)
-{
-	if (hashed_service->broker_sess != NULL)
-		return EEXIST;
-
-	hashed_service->broker_sess = async_callback_receive(EXCHANGE_SERIALIZE);
-	if (hashed_service->broker_sess == NULL)
-		return EIO;
-
-	return EOK;
-}
-
-/** Register service.
- *
- * @param service Service to be registered.
- * @param iface   Interface to be registered.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-errno_t ns_service_register(service_t service, iface_t iface)
-{
-	ht_link_t *link = hash_table_find(&service_hash_table, &service);
-
-	if (link) {
-		hashed_service_t *hashed_service =
-		    hash_table_get_inst(link, hashed_service_t, link);
-
-		assert(hashed_service->service == service);
-
-		return ns_iface_register(hashed_service, iface);
-	}
-
-	hashed_service_t *hashed_service =
-	    (hashed_service_t *) malloc(sizeof(hashed_service_t));
-	if (!hashed_service)
-		return ENOMEM;
-
-	if (!hash_table_create(&hashed_service->iface_hash_table, 0, 0,
-	    &iface_hash_table_ops)) {
-		free(hashed_service);
-		return ENOMEM;
-	}
-
-	hashed_service->broker_sess = NULL;
-	hashed_service->service = service;
-	errno_t rc = ns_iface_register(hashed_service, iface);
-	if (rc != EOK) {
-		free(hashed_service);
-		return rc;
-	}
-
-	hash_table_insert(&service_hash_table, &hashed_service->link);
-	return EOK;
-}
-
-/** Register broker service.
- *
- * @param service Broker service to be registered.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-errno_t ns_service_register_broker(service_t service)
-{
-	ht_link_t *link = hash_table_find(&service_hash_table, &service);
-
-	if (link) {
-		hashed_service_t *hashed_service =
-		    hash_table_get_inst(link, hashed_service_t, link);
-
-		assert(hashed_service->service == service);
-
-		return ns_broker_register(hashed_service);
-	}
-
-	hashed_service_t *hashed_service =
-	    (hashed_service_t *) malloc(sizeof(hashed_service_t));
-	if (!hashed_service)
-		return ENOMEM;
-
-	if (!hash_table_create(&hashed_service->iface_hash_table, 0, 0,
-	    &iface_hash_table_ops)) {
-		free(hashed_service);
-		return ENOMEM;
-	}
-
-	hashed_service->broker_sess = NULL;
-	hashed_service->service = service;
-	errno_t rc = ns_broker_register(hashed_service);
-	if (rc != EOK) {
-		free(hashed_service);
-		return rc;
-	}
-
-	hash_table_insert(&service_hash_table, &hashed_service->link);
-	return EOK;
-}
-
-/** Add pending connection */
-static errno_t ns_pending_conn_add(service_t service, iface_t iface,
-    ipc_call_t *call)
-{
-	pending_conn_t *pending =
-	    (pending_conn_t *) malloc(sizeof(pending_conn_t));
-	if (!pending)
-		return ENOMEM;
-
-	link_initialize(&pending->link);
-	pending->service = service;
-	pending->iface = iface;
-	pending->call = *call;
-
-	list_append(&pending->link, &pending_conn);
-	return EOK;
-}
-
-/** Connect client to service.
- *
- * @param service  Service to be connected to.
- * @param iface    Interface to be connected to.
- * @param call     Pointer to call structure.
- *
- * @return Zero on success or a value from @ref errno.h.
- *
- */
-void ns_service_forward(service_t service, iface_t iface, ipc_call_t *call)
-{
-	sysarg_t flags = ipc_get_arg4(call);
-	errno_t retval;
-
-	ht_link_t *link = hash_table_find(&service_hash_table, &service);
-	if (!link) {
-		if (flags & IPC_FLAG_BLOCKING) {
-			/* Blocking connection, add to pending list */
-			errno_t rc = ns_pending_conn_add(service, iface, call);
-			if (rc == EOK)
-				return;
-
-			retval = rc;
-			goto out;
-		}
-
-		retval = ENOENT;
-		goto out;
-	}
-
-	hashed_service_t *hashed_service =
-	    hash_table_get_inst(link, hashed_service_t, link);
-
-	link = hash_table_find(&hashed_service->iface_hash_table, &iface);
-	if (!link) {
-		if (hashed_service->broker_sess != NULL) {
-			ns_forward(hashed_service->broker_sess, call, iface);
-			return;
-		}
-
-		if (flags & IPC_FLAG_BLOCKING) {
-			/* Blocking connection, add to pending list */
-			errno_t rc = ns_pending_conn_add(service, iface, call);
-			if (rc == EOK)
-				return;
-
-			retval = rc;
-			goto out;
-		}
-
-		retval = ENOENT;
-		goto out;
-	}
-
-	hashed_iface_t *hashed_iface =
-	    hash_table_get_inst(link, hashed_iface_t, link);
-
-	ns_forward(hashed_iface->sess, call, iface);
-	return;
-
-out:
-	async_answer_0(call, retval);
-}
-
-/**
- * @}
- */
Index: pace/srv/ns/service.h
===================================================================
--- uspace/srv/ns/service.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#ifndef NS_SERVICE_H__
-#define NS_SERVICE_H__
-
-#include <ipc/common.h>
-#include <ipc/services.h>
-#include <abi/ipc/interfaces.h>
-
-extern errno_t ns_service_init(void);
-extern void ns_pending_conn_process(void);
-
-extern errno_t ns_service_register(service_t, iface_t);
-extern errno_t ns_service_register_broker(service_t);
-extern void ns_service_forward(service_t, iface_t, ipc_call_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/ns/task.c
===================================================================
--- uspace/srv/ns/task.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,327 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2009 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#include <adt/hash_table.h>
-#include <async.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <assert.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <types/task.h>
-#include "task.h"
-#include "ns.h"
-
-/** Task hash table item. */
-typedef struct {
-	ht_link_t link;
-
-	task_id_t id;    /**< Task ID. */
-	bool finished;   /**< Task is done. */
-	bool have_rval;  /**< Task returned a value. */
-	int retval;      /**< The return value. */
-} hashed_task_t;
-
-static size_t task_key_hash(const void *key)
-{
-	const task_id_t *tid = key;
-	return *tid;
-}
-
-static size_t task_hash(const ht_link_t *item)
-{
-	hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link);
-	return ht->id;
-}
-
-static bool task_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const task_id_t *tid = key;
-	hashed_task_t *ht = hash_table_get_inst(item, hashed_task_t, link);
-	return ht->id == *tid;
-}
-
-/** Perform actions after removal of item from the hash table. */
-static void task_remove(ht_link_t *item)
-{
-	free(hash_table_get_inst(item, hashed_task_t, link));
-}
-
-/** Operations for task hash table. */
-static const hash_table_ops_t task_hash_table_ops = {
-	.hash = task_hash,
-	.key_hash = task_key_hash,
-	.key_equal = task_key_equal,
-	.equal = NULL,
-	.remove_callback = task_remove
-};
-
-/** Task hash table structure. */
-static hash_table_t task_hash_table;
-
-typedef struct {
-	ht_link_t link;
-	sysarg_t label;  /**< Incoming phone label. */
-	task_id_t id;    /**< Task ID. */
-} p2i_entry_t;
-
-/* label-to-id hash table operations */
-
-static size_t p2i_key_hash(const void *key)
-{
-	const sysarg_t *label = key;
-	return *label;
-}
-
-static size_t p2i_hash(const ht_link_t *item)
-{
-	p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link);
-	return entry->label;
-}
-
-static bool p2i_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const sysarg_t *label = key;
-	p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link);
-
-	return (*label == entry->label);
-}
-
-/** Perform actions after removal of item from the hash table.
- *
- * @param item Item that was removed from the hash table.
- *
- */
-static void p2i_remove(ht_link_t *item)
-{
-	assert(item);
-	free(hash_table_get_inst(item, p2i_entry_t, link));
-}
-
-/** Operations for task hash table. */
-static const hash_table_ops_t p2i_ops = {
-	.hash = p2i_hash,
-	.key_hash = p2i_key_hash,
-	.key_equal = p2i_key_equal,
-	.equal = NULL,
-	.remove_callback = p2i_remove
-};
-
-/** Map phone label to task ID */
-static hash_table_t phone_to_id;
-
-/** Pending task wait structure. */
-typedef struct {
-	link_t link;
-	task_id_t id;     /**< Task ID */
-	ipc_call_t call;  /**< Call waiting for the connection */
-} pending_wait_t;
-
-static list_t pending_wait;
-
-errno_t task_init(void)
-{
-	if (!hash_table_create(&task_hash_table, 0, 0, &task_hash_table_ops)) {
-		printf(NAME ": No memory available for tasks\n");
-		return ENOMEM;
-	}
-
-	if (!hash_table_create(&phone_to_id, 0, 0, &p2i_ops)) {
-		printf(NAME ": No memory available for tasks\n");
-		return ENOMEM;
-	}
-
-	list_initialize(&pending_wait);
-	return EOK;
-}
-
-/** Process pending wait requests */
-void process_pending_wait(void)
-{
-	task_exit_t texit;
-
-loop:
-	list_foreach(pending_wait, link, pending_wait_t, pr) {
-		ht_link_t *link = hash_table_find(&task_hash_table, &pr->id);
-		if (!link)
-			continue;
-
-		hashed_task_t *ht = hash_table_get_inst(link, hashed_task_t, link);
-		if (!ht->finished)
-			continue;
-
-		texit = ht->have_rval ? TASK_EXIT_NORMAL :
-		    TASK_EXIT_UNEXPECTED;
-		async_answer_2(&pr->call, EOK, texit, ht->retval);
-
-		list_remove(&pr->link);
-		free(pr);
-		goto loop;
-	}
-}
-
-void wait_for_task(task_id_t id, ipc_call_t *call)
-{
-	ht_link_t *link = hash_table_find(&task_hash_table, &id);
-	hashed_task_t *ht = (link != NULL) ?
-	    hash_table_get_inst(link, hashed_task_t, link) : NULL;
-
-	if (ht == NULL) {
-		/* No such task exists. */
-		async_answer_0(call, ENOENT);
-		return;
-	}
-
-	if (ht->finished) {
-		task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL :
-		    TASK_EXIT_UNEXPECTED;
-		async_answer_2(call, EOK, texit, ht->retval);
-		return;
-	}
-
-	/* Add to pending list */
-	pending_wait_t *pr =
-	    (pending_wait_t *) malloc(sizeof(pending_wait_t));
-	if (!pr) {
-		async_answer_0(call, ENOMEM);
-		return;
-	}
-
-	link_initialize(&pr->link);
-	pr->id = id;
-	pr->call = *call;
-	list_append(&pr->link, &pending_wait);
-}
-
-errno_t ns_task_id_intro(ipc_call_t *call)
-{
-	task_id_t id = MERGE_LOUP32(ipc_get_arg1(call), ipc_get_arg2(call));
-
-	ht_link_t *link = hash_table_find(&phone_to_id, &call->request_label);
-	if (link != NULL)
-		return EEXIST;
-
-	p2i_entry_t *entry = (p2i_entry_t *) malloc(sizeof(p2i_entry_t));
-	if (entry == NULL)
-		return ENOMEM;
-
-	hashed_task_t *ht = (hashed_task_t *) malloc(sizeof(hashed_task_t));
-	if (ht == NULL) {
-		free(entry);
-		return ENOMEM;
-	}
-
-	/*
-	 * Insert into the phone-to-id map.
-	 */
-
-	assert(call->request_label);
-	entry->label = call->request_label;
-	entry->id = id;
-	hash_table_insert(&phone_to_id, &entry->link);
-
-	/*
-	 * Insert into the main table.
-	 */
-
-	ht->id = id;
-	ht->finished = false;
-	ht->have_rval = false;
-	ht->retval = -1;
-	hash_table_insert(&task_hash_table, &ht->link);
-
-	return EOK;
-}
-
-static errno_t get_id_by_phone(sysarg_t label, task_id_t *id)
-{
-	assert(label);
-	ht_link_t *link = hash_table_find(&phone_to_id, &label);
-	if (link == NULL)
-		return ENOENT;
-
-	p2i_entry_t *entry = hash_table_get_inst(link, p2i_entry_t, link);
-	*id = entry->id;
-
-	return EOK;
-}
-
-errno_t ns_task_retval(ipc_call_t *call)
-{
-	task_id_t id = call->task_id;
-
-	ht_link_t *link = hash_table_find(&task_hash_table, &id);
-	hashed_task_t *ht = (link != NULL) ?
-	    hash_table_get_inst(link, hashed_task_t, link) : NULL;
-
-	if ((ht == NULL) || (ht->finished))
-		return EINVAL;
-
-	ht->finished = true;
-	ht->have_rval = true;
-	ht->retval = ipc_get_arg1(call);
-
-	process_pending_wait();
-
-	return EOK;
-}
-
-errno_t ns_task_disconnect(ipc_call_t *call)
-{
-	task_id_t id;
-	errno_t rc = get_id_by_phone(call->request_label, &id);
-	if (rc != EOK)
-		return rc;
-
-	/* Delete from phone-to-id map. */
-	hash_table_remove(&phone_to_id, &call->request_label);
-
-	/* Mark task as finished. */
-	ht_link_t *link = hash_table_find(&task_hash_table, &id);
-	if (link == NULL)
-		return EOK;
-
-	hashed_task_t *ht = hash_table_get_inst(link, hashed_task_t, link);
-
-	ht->finished = true;
-
-	process_pending_wait();
-	hash_table_remove(&task_hash_table, &id);
-
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/ns/task.h
===================================================================
--- uspace/srv/ns/task.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ns
- * @{
- */
-
-#ifndef NS_TASK_H__
-#define NS_TASK_H__
-
-#include <ipc/common.h>
-#include <abi/proc/task.h>
-
-extern errno_t task_init(void);
-extern void process_pending_wait(void);
-
-extern void wait_for_task(task_id_t, ipc_call_t *);
-
-extern errno_t ns_task_id_intro(ipc_call_t *);
-extern errno_t ns_task_disconnect(ipc_call_t *);
-extern errno_t ns_task_retval(ipc_call_t *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/system/doc/doxygroups.h
===================================================================
--- uspace/srv/system/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup system system
- * @brief System state control server
- * @ingroup srvs
- */
Index: pace/srv/system/meson.build
===================================================================
--- uspace/srv/system/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device', 'futil', 'system' ]
-src = files('system.c')
Index: pace/srv/system/system.c
===================================================================
--- uspace/srv/system/system.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,714 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * Copyright (c) 2005 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup init
- * @{
- */
-/**
- * @file
- */
-
-#include <devman.h>
-#include <fibril.h>
-#include <futil.h>
-#include <io/log.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <vfs/vfs.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <task.h>
-#include <stdlib.h>
-#include <macros.h>
-#include <str.h>
-#include <loc.h>
-#include <shutdown.h>
-#include <str_error.h>
-#include <config.h>
-#include <io/logctl.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-#include <system.h>
-#include <system_srv.h>
-#include "system.h"
-
-#define BANNER_LEFT   "######> "
-#define BANNER_RIGHT  " <######"
-
-#define LOCFS_FS_TYPE      "locfs"
-#define LOCFS_MOUNT_POINT  "/loc"
-
-#define TMPFS_FS_TYPE      "tmpfs"
-#define TMPFS_MOUNT_POINT  "/tmp"
-
-#define SRV_CONSOLE  "/srv/hid/console"
-#define APP_GETTERM  "/app/getterm"
-
-#define SRV_DISPLAY  "/srv/hid/display"
-
-#define HID_INPUT              "hid/input"
-#define HID_OUTPUT             "hid/output"
-
-#define srv_start(path, ...) \
-	srv_startl(path, path, ##__VA_ARGS__, NULL)
-
-static const char *sys_dirs[] = {
-	"/w/cfg",
-	"/w/data",
-	NULL,
-};
-
-static void system_srv_conn(ipc_call_t *, void *);
-static errno_t system_srv_poweroff(void *);
-static errno_t system_srv_restart(void *);
-
-system_ops_t system_srv_ops = {
-	.poweroff = system_srv_poweroff,
-	.restart = system_srv_restart
-};
-
-/** Print banner */
-static void info_print(void)
-{
-	printf("%s: HelenOS system server\n", NAME);
-}
-
-static void oom_check(errno_t rc, const char *path)
-{
-	if (rc == ENOMEM) {
-		printf("%sOut-of-memory condition detected%s\n", BANNER_LEFT,
-		    BANNER_RIGHT);
-		printf("%sBailing out of the boot process after %s%s\n",
-		    BANNER_LEFT, path, BANNER_RIGHT);
-		printf("%sMore physical memory is required%s\n", BANNER_LEFT,
-		    BANNER_RIGHT);
-		exit(ENOMEM);
-	}
-}
-
-/** Report mount operation success */
-static bool mount_report(const char *desc, const char *mntpt,
-    const char *fstype, const char *dev, errno_t rc)
-{
-	switch (rc) {
-	case EOK:
-		if ((dev != NULL) && (str_cmp(dev, "") != 0))
-			printf("%s: %s mounted on %s (%s at %s)\n", NAME, desc, mntpt,
-			    fstype, dev);
-		else
-			printf("%s: %s mounted on %s (%s)\n", NAME, desc, mntpt, fstype);
-		break;
-	case EBUSY:
-		printf("%s: %s already mounted on %s\n", NAME, desc, mntpt);
-		return false;
-	case ELIMIT:
-		printf("%s: %s limit exceeded\n", NAME, desc);
-		return false;
-	case ENOENT:
-		printf("%s: %s unknown type (%s)\n", NAME, desc, fstype);
-		return false;
-	default:
-		printf("%s: %s not mounted on %s (%s)\n", NAME, desc, mntpt,
-		    str_error(rc));
-		return false;
-	}
-
-	return true;
-}
-
-/** Mount locfs file system
- *
- * The operation blocks until the locfs file system
- * server is ready for mounting.
- *
- * @return True on success.
- * @return False on failure.
- *
- */
-static bool mount_locfs(void)
-{
-	errno_t rc = vfs_mount_path(LOCFS_MOUNT_POINT, LOCFS_FS_TYPE, "", "",
-	    IPC_FLAG_BLOCKING, 0);
-	return mount_report("Location service file system", LOCFS_MOUNT_POINT,
-	    LOCFS_FS_TYPE, NULL, rc);
-}
-
-static errno_t srv_startl(const char *path, ...)
-{
-	vfs_stat_t s;
-	if (vfs_stat_path(path, &s) != EOK) {
-		printf("%s: Unable to stat %s\n", NAME, path);
-		return ENOENT;
-	}
-
-	printf("%s: Starting %s\n", NAME, path);
-
-	va_list ap;
-	const char *arg;
-	int cnt = 0;
-
-	va_start(ap, path);
-	do {
-		arg = va_arg(ap, const char *);
-		cnt++;
-	} while (arg != NULL);
-	va_end(ap);
-
-	va_start(ap, path);
-	task_id_t id;
-	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
-	va_end(ap);
-
-	if (rc != EOK) {
-		oom_check(rc, path);
-		printf("%s: Error spawning %s (%s)\n", NAME, path,
-		    str_error(rc));
-		return rc;
-	}
-
-	if (!id) {
-		printf("%s: Error spawning %s (invalid task id)\n", NAME,
-		    path);
-		return EINVAL;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&wait, &texit, &retval);
-	if (rc != EOK) {
-		printf("%s: Error waiting for %s (%s)\n", NAME, path,
-		    str_error(rc));
-		return rc;
-	}
-
-	if (texit != TASK_EXIT_NORMAL) {
-		printf("%s: Server %s failed to start (unexpectedly "
-		    "terminated)\n", NAME, path);
-		return EINVAL;
-	}
-
-	if (retval != 0)
-		printf("%s: Server %s failed to start (exit code %d)\n", NAME,
-		    path, retval);
-
-	return retval == 0 ? EOK : EPARTY;
-}
-
-static errno_t console(const char *isvc, const char *osvc)
-{
-	/* Wait for the input service to be ready */
-	service_id_t service_id;
-	errno_t rc = loc_service_get_id(isvc, &service_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Error waiting on %s (%s)\n", NAME, isvc,
-		    str_error(rc));
-		return rc;
-	}
-
-	/* Wait for the output service to be ready */
-	rc = loc_service_get_id(osvc, &service_id, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		printf("%s: Error waiting on %s (%s)\n", NAME, osvc,
-		    str_error(rc));
-		return rc;
-	}
-
-	return srv_start(SRV_CONSOLE, isvc, osvc);
-}
-
-#ifdef CONFIG_WINSYS
-
-static errno_t display_server(void)
-{
-	return srv_start(SRV_DISPLAY);
-}
-
-static int app_start(const char *app, const char *arg)
-{
-	printf("%s: Spawning %s\n", NAME, app);
-
-	task_id_t id;
-	task_wait_t wait;
-	errno_t rc = task_spawnl(&id, &wait, app, app, arg, NULL);
-	if (rc != EOK) {
-		oom_check(rc, app);
-		printf("%s: Error spawning %s (%s)\n", NAME, app,
-		    str_error(rc));
-		return -1;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&wait, &texit, &retval);
-	if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) {
-		printf("%s: Error retrieving retval from %s (%s)\n", NAME,
-		    app, str_error(rc));
-		return rc;
-	}
-
-	return retval;
-}
-
-#endif
-
-static void getterm(const char *svc, const char *app, bool msg)
-{
-	if (msg) {
-		printf("%s: Spawning %s %s %s --msg --wait -- %s\n", NAME,
-		    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
-
-		errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
-		    LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
-		if (rc != EOK) {
-			oom_check(rc, APP_GETTERM);
-			printf("%s: Error spawning %s %s %s --msg --wait -- %s\n",
-			    NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
-		}
-	} else {
-		printf("%s: Spawning %s %s %s --wait -- %s\n", NAME,
-		    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
-
-		errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
-		    LOCFS_MOUNT_POINT, "--wait", "--", app, NULL);
-		if (rc != EOK) {
-			oom_check(rc, APP_GETTERM);
-			printf("%s: Error spawning %s %s %s --wait -- %s\n",
-			    NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
-		}
-	}
-}
-
-static bool mount_tmpfs(void)
-{
-	errno_t rc = vfs_mount_path(TMPFS_MOUNT_POINT, TMPFS_FS_TYPE, "", "", 0, 0);
-	return mount_report("Temporary file system", TMPFS_MOUNT_POINT,
-	    TMPFS_FS_TYPE, NULL, rc);
-}
-
-/** Init system volume.
- *
- * See if system volume is configured. If so, try to wait for it to become
- * available. If not, create basic directories for live image omde.
- */
-static errno_t init_sysvol(void)
-{
-	vol_t *vol = NULL;
-	vol_info_t vinfo;
-	volume_id_t *volume_ids = NULL;
-	service_id_t *part_ids = NULL;
-	vol_part_info_t pinfo;
-	size_t nvols;
-	size_t nparts;
-	bool sv_mounted;
-	futil_t *futil = NULL;
-	size_t i;
-	errno_t rc;
-	bool found_cfg;
-	const char **cp;
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		printf("Error contacting volume service.\n");
-		goto error;
-	}
-
-	rc = vol_get_volumes(vol, &volume_ids, &nvols);
-	if (rc != EOK) {
-		printf("Error getting list of volumes.\n");
-		goto error;
-	}
-
-	/* XXX This could be handled more efficiently by volsrv itself */
-	found_cfg = false;
-	for (i = 0; i < nvols; i++) {
-		rc = vol_info(vol, volume_ids[i], &vinfo);
-		if (rc != EOK) {
-			printf("Error getting volume information.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		if (str_cmp(vinfo.path, "/w") == 0) {
-			found_cfg = true;
-			break;
-		}
-	}
-
-	free(volume_ids);
-	volume_ids = NULL;
-
-	if (!found_cfg) {
-		/* Prepare directory structure for live image mode */
-		printf("%s: Creating live image directory structure.\n", NAME);
-		cp = sys_dirs;
-		while (*cp != NULL) {
-			rc = vfs_link_path(*cp, KIND_DIRECTORY, NULL);
-			if (rc != EOK) {
-				printf("%s: Error creating directory '%s'.\n",
-				    NAME, *cp);
-				goto error;
-			}
-
-			++cp;
-		}
-
-		/* Copy initial configuration files */
-		rc = futil_create(NULL, NULL, &futil);
-		if (rc != EOK)
-			goto error;
-
-		rc = futil_rcopy_contents(futil, "/cfg", "/w/cfg");
-		if (rc != EOK)
-			goto error;
-
-		futil_destroy(futil);
-		futil = NULL;
-	} else {
-		printf("%s: System volume is configured.\n", NAME);
-
-		/* Verify that system volume is mounted */
-		sv_mounted = false;
-
-		rc = vol_get_parts(vol, &part_ids, &nparts);
-		if (rc != EOK) {
-			printf("Error getting list of volumes.\n");
-			goto error;
-		}
-
-		for (i = 0; i < nparts; i++) {
-			rc = vol_part_info(vol, part_ids[i], &pinfo);
-			if (rc != EOK) {
-				printf("Error getting partition "
-				    "information.\n");
-				rc = EIO;
-				goto error;
-			}
-
-			if (str_cmp(pinfo.cur_mp, "/w") == 0) {
-				sv_mounted = true;
-				break;
-			}
-		}
-
-		if (sv_mounted == false) {
-			printf("System volume not found.\n");
-			rc = EIO;
-			goto error;
-		}
-
-		free(part_ids);
-		part_ids = NULL;
-
-	}
-
-	vol_destroy(vol);
-	return EOK;
-error:
-	vol_destroy(vol);
-	if (volume_ids != NULL)
-		free(volume_ids);
-	if (part_ids != NULL)
-		free(part_ids);
-	if (futil != NULL)
-		futil_destroy(futil);
-
-	return rc;
-}
-
-/** Perform sytem startup tasks.
- *
- * @return EOK on success or an error code
- */
-static errno_t system_startup(void)
-{
-	errno_t rc;
-
-	/* Make sure file systems are running. */
-	if (str_cmp(STRING(RDFMT), "tmpfs") != 0)
-		srv_start("/srv/fs/tmpfs");
-	if (str_cmp(STRING(RDFMT), "exfat") != 0)
-		srv_start("/srv/fs/exfat");
-	if (str_cmp(STRING(RDFMT), "fat") != 0)
-		srv_start("/srv/fs/fat");
-	srv_start("/srv/fs/cdfs");
-	srv_start("/srv/fs/mfs");
-
-	srv_start("/srv/klog");
-	srv_start("/srv/fs/locfs");
-
-	if (!mount_locfs()) {
-		printf("%s: Exiting\n", NAME);
-		return EIO;
-	}
-
-	mount_tmpfs();
-
-	srv_start("/srv/devman");
-	srv_start("/srv/hid/s3c24xx_uart");
-	srv_start("/srv/hid/s3c24xx_ts");
-
-	srv_start("/srv/bd/vbd");
-	srv_start("/srv/volsrv");
-
-	init_sysvol();
-
-	srv_start("/srv/taskmon");
-
-	srv_start("/srv/net/loopip");
-	srv_start("/srv/net/ethip");
-	srv_start("/srv/net/dhcp");
-	srv_start("/srv/net/inetsrv");
-	srv_start("/srv/net/tcp");
-	srv_start("/srv/net/udp");
-	srv_start("/srv/net/dnsrsrv");
-
-	srv_start("/srv/clipboard");
-	srv_start("/srv/hid/remcons");
-
-	srv_start("/srv/hid/input", HID_INPUT);
-	srv_start("/srv/hid/output", HID_OUTPUT);
-	srv_start("/srv/audio/hound");
-
-#ifdef CONFIG_WINSYS
-	if (!config_key_exists("console")) {
-		rc = display_server();
-		if (rc == EOK) {
-			app_start("/app/taskbar", NULL);
-			app_start("/app/terminal", "-topleft");
-		}
-	}
-#endif
-	rc = console(HID_INPUT, HID_OUTPUT);
-	if (rc == EOK) {
-		getterm("term/vc0", "/app/bdsh", true);
-		getterm("term/vc1", "/app/bdsh", false);
-		getterm("term/vc2", "/app/bdsh", false);
-		getterm("term/vc3", "/app/bdsh", false);
-		getterm("term/vc4", "/app/bdsh", false);
-		getterm("term/vc5", "/app/bdsh", false);
-	}
-
-	return EOK;
-}
-
-/** Perform sytem shutdown tasks.
- *
- * @return EOK on success or an error code
- */
-static errno_t system_sys_shutdown(void)
-{
-	vol_t *vol = NULL;
-	service_id_t *part_ids = NULL;
-	size_t nparts;
-	size_t i;
-	errno_t rc;
-
-	/* Eject all volumes. */
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Ejecting volumes.");
-
-	rc = vol_create(&vol);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error contacting volume "
-		    "service.");
-		goto error;
-	}
-
-	rc = vol_get_parts(vol, &part_ids, &nparts);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting volume list.");
-		goto error;
-	}
-
-	for (i = 0; i < nparts; i++) {
-		rc = vol_part_eject(vol, part_ids[i], vef_none);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error ejecting "
-			    "volume %zu", (size_t)part_ids[i]);
-			goto error;
-		}
-	}
-
-	free(part_ids);
-	vol_destroy(vol);
-
-	return EOK;
-error:
-	if (part_ids != NULL)
-		free(part_ids);
-	if (vol != NULL)
-		vol_destroy(vol);
-	return rc;
-}
-
-/** Initialize system control service. */
-static errno_t system_srv_init(sys_srv_t *syssrv)
-{
-	port_id_t port;
-	loc_srv_t *srv = NULL;
-	service_id_t sid = 0;
-	errno_t rc;
-
-	(void)system;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "system_srv_init()");
-
-	rc = async_create_port(INTERFACE_SYSTEM, system_srv_conn, syssrv,
-	    &port);
-	if (rc != EOK)
-		goto error;
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed registering server: %s.", str_error(rc));
-		rc = EEXIST;
-		goto error;
-	}
-
-	rc = loc_service_register(srv, SYSTEM_DEFAULT, &sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed registering service: %s.", str_error(rc));
-		rc = EEXIST;
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (sid != 0)
-		loc_service_unregister(srv, sid);
-	if (srv != NULL)
-		loc_server_unregister(srv);
-	// XXX destroy port
-	return rc;
-}
-
-/** Handle connection to system server. */
-static void system_srv_conn(ipc_call_t *icall, void *arg)
-{
-	sys_srv_t *syssrv = (sys_srv_t *)arg;
-
-	/* Set up protocol structure */
-	system_srv_initialize(&syssrv->srv);
-	syssrv->srv.ops = &system_srv_ops;
-	syssrv->srv.arg = syssrv;
-
-	/* Handle connection */
-	system_conn(icall, &syssrv->srv);
-}
-
-/** System poweroff request.
- *
- * @param arg Argument (sys_srv_t *)
- */
-static errno_t system_srv_poweroff(void *arg)
-{
-	sys_srv_t *syssrv = (sys_srv_t *)arg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff");
-
-	rc = system_sys_shutdown();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff failed");
-		system_srv_shutdown_failed(&syssrv->srv);
-	}
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_poweroff complete");
-	system_srv_shutdown_complete(&syssrv->srv);
-	return EOK;
-}
-
-/** System restart request.
- *
- * @param arg Argument (sys_srv_t *)
- */
-static errno_t system_srv_restart(void *arg)
-{
-	sys_srv_t *syssrv = (sys_srv_t *)arg;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart");
-
-	rc = system_sys_shutdown();
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart failed");
-		system_srv_shutdown_failed(&syssrv->srv);
-	}
-
-	/* Quiesce the device tree. */
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "Quiescing devices.");
-
-	rc = devman_quiesce_devices("/hw");
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Failed to quiesce device tree.");
-		return rc;
-	}
-
-	sys_reboot();
-
-	log_msg(LOG_DEFAULT, LVL_NOTE, "system_srv_restart complete");
-	system_srv_shutdown_complete(&syssrv->srv);
-	return EOK;
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	sys_srv_t srv;
-
-	info_print();
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	/* Perform startup tasks. */
-	rc = system_startup();
-	if (rc != EOK)
-		return 1;
-
-	rc = system_srv_init(&srv);
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/system/system.h
===================================================================
--- uspace/srv/system/system.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,51 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * Copyright (c) 2006 Martin Decky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup system
- * @{
- */
-/**
- * @file
- */
-
-#ifndef SYSTEM_H
-#define SYSTEM_H
-
-#include <system_srv.h>
-
-#define NAME  "system"
-
-typedef struct {
-	system_srv_t srv;
-} sys_srv_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/taskmon/doc/doxygroups.h
===================================================================
--- uspace/srv/taskmon/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup taskmon taskmon
- * @ingroup srvs
- * @brief Task monitoring service
- */
Index: pace/srv/taskmon/meson.build
===================================================================
--- uspace/srv/taskmon/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2024 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'corecfg', 'sif' ]
-src = files('taskmon.c')
Index: pace/srv/taskmon/taskmon.c
===================================================================
--- uspace/srv/taskmon/taskmon.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,275 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup taskmon
- * @brief
- * @{
- */
-/**
- * @file
- */
-
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-#include <ipc/services.h>
-#include <ipc/corecfg.h>
-#include <loc.h>
-#include <sif.h>
-#include <stdio.h>
-#include <str.h>
-#include <str_error.h>
-#include <task.h>
-
-#define NAME  "taskmon"
-
-static const char *taskmon_cfg_path = "/w/cfg/taskmon.sif";
-
-static bool write_core_files;
-
-static errno_t taskmon_load_cfg(const char *);
-static errno_t taskmon_save_cfg(const char *);
-static void corecfg_client_conn(ipc_call_t *, void *);
-
-static void fault_event(ipc_call_t *call, void *arg)
-{
-	const char *fname;
-	char *s_taskid;
-	char *dump_fname;
-	errno_t rc;
-
-	task_id_t taskid;
-	uintptr_t thread;
-
-	taskid = MERGE_LOUP32(ipc_get_arg1(call), ipc_get_arg2(call));
-	thread = ipc_get_arg3(call);
-
-	if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) {
-		printf("Memory allocation failed.\n");
-		return;
-	}
-
-	printf(NAME ": Task %" PRIu64 " fault in thread %p.\n", taskid,
-	    (void *) thread);
-
-	fname = "/app/taskdump";
-
-	if (write_core_files) {
-		if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
-			printf("Memory allocation failed.\n");
-			return;
-		}
-
-		printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid);
-		rc = task_spawnl(NULL, NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
-		    NULL);
-	} else {
-		printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
-		rc = task_spawnl(NULL, NULL, fname, fname, "-t", s_taskid, NULL);
-	}
-
-	if (rc != EOK) {
-		printf("%s: Error spawning %s (%s).\n", NAME, fname,
-		    str_error(rc));
-	}
-}
-
-static void corecfg_get_enable_srv(ipc_call_t *icall)
-{
-	async_answer_1(icall, EOK, write_core_files);
-}
-
-static void corecfg_set_enable_srv(ipc_call_t *icall)
-{
-	write_core_files = ipc_get_arg1(icall);
-	async_answer_0(icall, EOK);
-	(void) taskmon_save_cfg(taskmon_cfg_path);
-}
-
-static void corecfg_client_conn(ipc_call_t *icall, void *arg)
-{
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case CORECFG_GET_ENABLE:
-			corecfg_get_enable_srv(&call);
-			break;
-		case CORECFG_SET_ENABLE:
-			corecfg_set_enable_srv(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-		}
-	}
-}
-
-/** Load task monitor configuration from SIF file.
- *
- * @param cfgpath Configuration file path
- *
- * @return EOK on success or an error code
- */
-static errno_t taskmon_load_cfg(const char *cfgpath)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *ncorefiles;
-	const char *ntype;
-	const char *swrite;
-	errno_t rc;
-
-	rc = sif_load(cfgpath, &doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	ncorefiles = sif_node_first_child(rnode);
-	ntype = sif_node_get_type(ncorefiles);
-	if (str_cmp(ntype, "corefiles") != 0) {
-		rc = EIO;
-		goto error;
-	}
-
-	swrite = sif_node_get_attr(ncorefiles, "write");
-	if (swrite == NULL) {
-		rc = EIO;
-		goto error;
-	}
-
-	if (str_cmp(swrite, "y") == 0) {
-		write_core_files = true;
-	} else if (str_cmp(swrite, "n") == 0) {
-		write_core_files = false;
-	} else {
-		rc = EIO;
-		goto error;
-	}
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	return rc;
-}
-
-/** Save task monitor configuration to SIF file.
- *
- * @param cfgpath Configuration file path
- *
- * @return EOK on success or an error code
- */
-static errno_t taskmon_save_cfg(const char *cfgpath)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *rnode;
-	sif_node_t *ncorefiles;
-	errno_t rc;
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rnode = sif_get_root(doc);
-	rc = sif_node_append_child(rnode, "corefiles", &ncorefiles);
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_node_set_attr(ncorefiles, "write",
-	    write_core_files ? "y" : "n");
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_save(doc, cfgpath);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		sif_delete(doc);
-	return rc;
-}
-
-int main(int argc, char *argv[])
-{
-	loc_srv_t *srv;
-
-	printf("%s: Task Monitoring Service\n", NAME);
-
-#ifdef CONFIG_WRITE_CORE_FILES
-	write_core_files = true;
-#else
-	write_core_files = false;
-#endif
-	(void) taskmon_load_cfg(taskmon_cfg_path);
-
-	if (async_event_subscribe(EVENT_FAULT, fault_event, NULL) != EOK) {
-		printf("%s: Error registering fault notifications.\n", NAME);
-		return -1;
-	}
-
-	async_set_fallback_port_handler(corecfg_client_conn, NULL);
-
-	errno_t rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Failed registering server: %s.\n",
-		    NAME, str_error(rc));
-		return -1;
-	}
-
-	service_id_t sid;
-	rc = loc_service_register(srv, SERVICE_NAME_CORECFG, &sid);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		printf("%s: Failed registering service: %s.\n",
-		    NAME, str_error(rc));
-		return -1;
-	}
-
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/test/chardev-test/doc/doxygroups.h
===================================================================
--- uspace/srv/test/chardev-test/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup chardev-test chardev-test
- * @ingroup srvs
- * @brief Character device interface test service
- */
Index: pace/srv/test/chardev-test/main.c
===================================================================
--- uspace/srv/test/chardev-test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,288 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup chardev-test
- * @{
- */
-/**
- * @file
- * @brief Character device interface test service
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/chardev_srv.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <mem.h>
-#include <stdio.h>
-#include <task.h>
-
-#define NAME  "chardev-test"
-
-static errno_t smallx_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t smallx_close(chardev_srv_t *);
-static errno_t smallx_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t smallx_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-
-static errno_t largex_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t largex_close(chardev_srv_t *);
-static errno_t largex_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t largex_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-
-static errno_t partialx_open(chardev_srvs_t *, chardev_srv_t *);
-static errno_t partialx_close(chardev_srv_t *);
-static errno_t partialx_write(chardev_srv_t *, const void *, size_t, size_t *);
-static errno_t partialx_read(chardev_srv_t *, void *, size_t, size_t *,
-    chardev_flags_t);
-
-static service_id_t smallx_svc_id;
-static chardev_srvs_t smallx_srvs;
-
-static service_id_t largex_svc_id;
-static chardev_srvs_t largex_srvs;
-
-static service_id_t partialx_svc_id;
-static chardev_srvs_t partialx_srvs;
-
-static chardev_ops_t chardev_test_smallx_ops = {
-	.open = smallx_open,
-	.close = smallx_close,
-	.write = smallx_write,
-	.read = smallx_read
-};
-
-static chardev_ops_t chardev_test_largex_ops = {
-	.open = largex_open,
-	.close = largex_close,
-	.write = largex_write,
-	.read = largex_read
-};
-
-static chardev_ops_t chardev_test_partialx_ops = {
-	.open = partialx_open,
-	.close = partialx_close,
-	.write = partialx_write,
-	.read = partialx_read
-};
-
-static void chardev_test_connection(ipc_call_t *icall, void *arg)
-{
-	chardev_srvs_t *svc;
-	sysarg_t svcid;
-
-	svcid = ipc_get_arg2(icall);
-	if (svcid == smallx_svc_id) {
-		svc = &smallx_srvs;
-	} else if (svcid == largex_svc_id) {
-		svc = &largex_srvs;
-	} else if (svcid == partialx_svc_id) {
-		svc = &partialx_srvs;
-	} else {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	chardev_conn(icall, svc);
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	loc_srv_t *srv;
-
-	printf("%s: Character device test service\n", NAME);
-	async_set_fallback_port_handler(chardev_test_connection, NULL);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		printf("%s: Failed registering server.: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	chardev_srvs_init(&smallx_srvs);
-	smallx_srvs.ops = &chardev_test_smallx_ops;
-	smallx_srvs.sarg = NULL;
-
-	chardev_srvs_init(&largex_srvs);
-	largex_srvs.ops = &chardev_test_largex_ops;
-	largex_srvs.sarg = NULL;
-
-	chardev_srvs_init(&partialx_srvs);
-	partialx_srvs.ops = &chardev_test_partialx_ops;
-	partialx_srvs.sarg = NULL;
-
-	rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_SMALLX,
-	    &smallx_svc_id);
-	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
-		goto error;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_LARGEX,
-	    &largex_svc_id);
-	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
-		goto error;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_CHARDEV_TEST_PARTIALX,
-	    &partialx_svc_id);
-	if (rc != EOK) {
-		printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
-		goto error;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-error:
-	if (smallx_svc_id != 0)
-		loc_service_unregister(srv, smallx_svc_id);
-	if (largex_svc_id != 0)
-		loc_service_unregister(srv, largex_svc_id);
-	if (partialx_svc_id != 0)
-		loc_service_unregister(srv, partialx_svc_id);
-	loc_server_unregister(srv);
-	return rc;
-}
-
-static errno_t smallx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t smallx_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t smallx_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwritten)
-{
-	if (size < 1) {
-		*nwritten = 0;
-		return EOK;
-	}
-
-	*nwritten = 1;
-	return EOK;
-}
-
-static errno_t smallx_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	if (size < 1) {
-		*nread = 0;
-		return EOK;
-	}
-
-	memset(buf, 0, 1);
-	*nread = 1;
-	return EOK;
-}
-
-static errno_t largex_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t largex_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t largex_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwritten)
-{
-	if (size < 1) {
-		*nwritten = 0;
-		return EOK;
-	}
-
-	*nwritten = size;
-	return EOK;
-}
-
-static errno_t largex_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	if (size < 1) {
-		*nread = 0;
-		return EOK;
-	}
-
-	memset(buf, 0, size);
-	*nread = size;
-	return EOK;
-}
-
-static errno_t partialx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t partialx_close(chardev_srv_t *srv)
-{
-	return EOK;
-}
-
-static errno_t partialx_write(chardev_srv_t *srv, const void *data, size_t size,
-    size_t *nwritten)
-{
-	if (size < 1) {
-		*nwritten = 0;
-		return EOK;
-	}
-
-	*nwritten = 1;
-	return EIO;
-}
-
-static errno_t partialx_read(chardev_srv_t *srv, void *buf, size_t size,
-    size_t *nread, chardev_flags_t flags)
-{
-	if (size < 1) {
-		*nread = 0;
-		return EOK;
-	}
-
-	memset(buf, 0, 1);
-	*nread = 1;
-	return EIO;
-}
-
-/**
- * @}
- */
Index: pace/srv/test/chardev-test/meson.build
===================================================================
--- uspace/srv/test/chardev-test/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2017 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'device' ]
-src = files('main.c')
Index: pace/srv/test/ipc-test/doc/doxygroups.h
===================================================================
--- uspace/srv/test/ipc-test/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup ipc-test ipc-test
- * @ingroup srvs
- * @brief IPC test service
- */
Index: pace/srv/test/ipc-test/main.c
===================================================================
--- uspace/srv/test/ipc-test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-/*
- * Copyright (c) 2023 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup ipc-test
- * @{
- */
-/**
- * @file
- * @brief IPC test service
- *
- * If run as an initial task, this can be used to test sharing areas
- * backed by the ELF backend.
- */
-
-#include <as.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <ipc/ipc_test.h>
-#include <ipc/services.h>
-#include <loc.h>
-#include <mem.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-
-#define NAME  "ipc-test"
-
-static service_id_t svc_id;
-
-enum {
-	max_rw_buf_size = 16384,
-};
-
-/** Object in read-only memory area that will be shared.
- *
- * If the server is run as an initial task, the area should be backed
- * by ELF backend.
- */
-static const char *ro_data = "Hello, world!";
-
-/** Object in read-write memory area that will be shared.
- *
- * If the server is run as an initial task, the area should be backed
- * by ELF backend.
- */
-static char rw_data[] = "Hello, world!";
-
-/** Buffer for reading/writing via read/write messages.
- *
- * It is allocated / size is set by IPC_TEST_SET_RW_BUF_SIZE
- */
-static void *rw_buf;
-/** Read/write buffer size */
-size_t rw_buf_size;
-
-static void ipc_test_get_ro_area_size_srv(ipc_call_t *icall)
-{
-	errno_t rc;
-	as_area_info_t info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_get_ro_area_size_srv");
-
-	rc = as_area_get_info((void *)ro_data, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "as_area_get_info failed");
-		return;
-	}
-
-	async_answer_1(icall, EOK, info.size);
-}
-
-static void ipc_test_get_rw_area_size_srv(ipc_call_t *icall)
-{
-	errno_t rc;
-	as_area_info_t info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_get_rw_area_size_srv");
-
-	rc = as_area_get_info(rw_data, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "as_area_get_info failed");
-		return;
-	}
-
-	async_answer_1(icall, EOK, info.size);
-}
-
-static void ipc_test_share_in_ro_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	errno_t rc;
-	size_t size;
-	as_area_info_t info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_share_in_ro_srv");
-	if (!async_share_in_receive(&call, &size)) {
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "share_in_receive failed");
-		return;
-	}
-
-	rc = as_area_get_info((void *)ro_data, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "as_area_get_info failed");
-		return;
-	}
-
-	if (size != info.size) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "size(%zu) != %zu",
-		    size, info.size);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_share_in_finalize(&call, (void *) info.start_addr,
-	    AS_AREA_READ);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    " - async_share_in_finalize failed");
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void ipc_test_share_in_rw_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	errno_t rc;
-	size_t size;
-	as_area_info_t info;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_share_in_ro_srv");
-	if (!async_share_in_receive(&call, &size)) {
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "share_in_receive failed");
-		return;
-	}
-
-	rc = as_area_get_info(rw_data, &info);
-	if (rc != EOK) {
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "as_area_get_info failed");
-		return;
-	}
-
-	if (size != info.size) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, " size(%zu) != %zu",
-		    size, info.size);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_share_in_finalize(&call, (void *) info.start_addr,
-	    AS_AREA_READ | AS_AREA_WRITE);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "async_share_in_finalize failed");
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void ipc_test_set_rw_buf_size_srv(ipc_call_t *icall)
-{
-	size_t size;
-	void *nbuf;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_set_rw_buf_size_srv");
-
-	size = ipc_get_arg1(icall);
-
-	if (size == 0) {
-		async_answer_0(icall, ERANGE);
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "Requested read/write buffer size is zero.");
-		return;
-	}
-
-	if (size > max_rw_buf_size) {
-		async_answer_0(icall, ERANGE);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Requested read/write buffer "
-		    "size > %u", max_rw_buf_size);
-		return;
-	}
-
-	nbuf = realloc(rw_buf, size);
-	if (nbuf == NULL) {
-		async_answer_0(icall, ENOMEM);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory.");
-		return;
-	}
-
-	rw_buf = nbuf;
-	rw_buf_size = size;
-	async_answer_0(icall, EOK);
-}
-
-static void ipc_test_read_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	errno_t rc;
-	size_t size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_read_srv");
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(icall, EREFUSED);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "data_read_receive failed");
-		return;
-	}
-
-	if (size > rw_buf_size) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Invalid read size.");
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, rw_buf, size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "data_read_finalize failed");
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void ipc_test_write_srv(ipc_call_t *icall)
-{
-	ipc_call_t call;
-	errno_t rc;
-	size_t size;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "ipc_test_write_srv");
-
-	if (!async_data_write_receive(&call, &size)) {
-		async_answer_0(icall, EREFUSED);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "data_write_receive failed");
-		return;
-	}
-
-	if (size > rw_buf_size) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Invalid write size.");
-		return;
-	}
-
-	rc = async_data_write_finalize(&call, rw_buf, size);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR,
-		    "data_write_finalize failed");
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void ipc_test_connection(ipc_call_t *icall, void *arg)
-{
-	/* Accept connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IPC_TEST_PING:
-			async_answer_0(&call, EOK);
-			break;
-		case IPC_TEST_GET_RO_AREA_SIZE:
-			ipc_test_get_ro_area_size_srv(&call);
-			break;
-		case IPC_TEST_GET_RW_AREA_SIZE:
-			ipc_test_get_rw_area_size_srv(&call);
-			break;
-		case IPC_TEST_SHARE_IN_RO:
-			ipc_test_share_in_ro_srv(&call);
-			break;
-		case IPC_TEST_SHARE_IN_RW:
-			ipc_test_share_in_rw_srv(&call);
-			break;
-		case IPC_TEST_SET_RW_BUF_SIZE:
-			ipc_test_set_rw_buf_size_srv(&call);
-			break;
-		case IPC_TEST_READ:
-			ipc_test_read_srv(&call);
-			break;
-		case IPC_TEST_WRITE:
-			ipc_test_write_srv(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-	loc_srv_t *srv;
-
-	printf("%s: IPC test service\n", NAME);
-	async_set_fallback_port_handler(ipc_test_connection, NULL);
-
-	rc = log_init(NAME);
-	if (rc != EOK) {
-		printf(NAME ": Failed to initialize log.\n");
-		return rc;
-	}
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server. (%s)\n",
-		    str_error(rc));
-		return rc;
-	}
-
-	rc = loc_service_register(srv, SERVICE_NAME_IPC_TEST, &svc_id);
-	if (rc != EOK) {
-		loc_server_unregister(srv);
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service. (%s)\n",
-		    str_error(rc));
-		return rc;
-	}
-
-	printf("%s: Accepting connections\n", NAME);
-	task_retval(0);
-	async_manager();
-
-	/* Not reached */
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/test/ipc-test/meson.build
===================================================================
--- uspace/srv/test/ipc-test/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,30 +1,0 @@
-#
-# Copyright (c) 2023 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'ipctest' ]
-src = files('main.c')
Index: pace/srv/vfs/doc/doxygroups.h
===================================================================
--- uspace/srv/vfs/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup vfs vfs
- * @ingroup srvs
- * @brief Virtual file system service
- */
Index: pace/srv/vfs/meson.build
===================================================================
--- uspace/srv/vfs/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# Copyright (c) 2007 Jakub Jermar
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-src = files(
-	'vfs.c',
-	'vfs_node.c',
-	'vfs_file.c',
-	'vfs_ops.c',
-	'vfs_lookup.c',
-	'vfs_register.c',
-	'vfs_ipc.c',
-	'vfs_pager.c',
-)
Index: pace/srv/vfs/vfs.c
===================================================================
--- uspace/srv/vfs/vfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,156 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file vfs.c
- * @brief VFS service for HelenOS.
- */
-
-#include <vfs/vfs.h>
-#include <stdlib.h>
-#include <ipc/services.h>
-#include <abi/ipc/methods.h>
-#include <libarch/config.h>
-#include <ns.h>
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <str.h>
-#include <as.h>
-#include <macros.h>
-#include "vfs.h"
-
-#define NAME  "vfs"
-
-static void vfs_pager(ipc_call_t *icall, void *arg)
-{
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case IPC_M_PAGE_IN:
-			vfs_page_in(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-}
-
-static void notification_handler(ipc_call_t *call, void *arg)
-{
-	if (ipc_get_arg1(call) == VFS_PASS_HANDLE)
-		vfs_op_pass_handle(
-		    (task_id_t) MERGE_LOUP32(ipc_get_arg4(call),
-		    ipc_get_arg5(call)), call->task_id,
-		    (int) ipc_get_arg2(call));
-}
-
-int main(int argc, char **argv)
-{
-	printf("%s: HelenOS VFS server\n", NAME);
-
-	/*
-	 * Initialize VFS node hash table.
-	 */
-	if (!vfs_nodes_init()) {
-		printf("%s: Failed to initialize VFS node hash table\n",
-		    NAME);
-		return ENOMEM;
-	}
-
-	/*
-	 * Allocate and initialize the Path Lookup Buffer.
-	 */
-	plb = as_area_create(AS_AREA_ANY, PLB_SIZE,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE, AS_AREA_UNPAGED);
-	if (plb == AS_MAP_FAILED) {
-		printf("%s: Cannot create address space area\n", NAME);
-		return ENOMEM;
-	}
-	memset(plb, 0, PLB_SIZE);
-
-	/*
-	 * Set client data constructor and destructor.
-	 */
-	async_set_client_data_constructor(vfs_client_data_create);
-	async_set_client_data_destructor(vfs_client_data_destroy);
-
-	/*
-	 * Subscribe to notifications.
-	 */
-	async_event_task_subscribe(EVENT_TASK_STATE_CHANGE, notification_handler,
-	    NULL);
-
-	/*
-	 * Register at the naming service.
-	 */
-	errno_t rc = service_register(SERVICE_VFS, INTERFACE_PAGER, vfs_pager, NULL);
-	if (rc != EOK) {
-		printf("%s: Cannot register VFS pager port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_VFS, INTERFACE_VFS, vfs_connection, NULL);
-	if (rc != EOK) {
-		printf("%s: Cannot register VFS file system port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	rc = service_register(SERVICE_VFS, INTERFACE_VFS_DRIVER, vfs_connection, NULL);
-	if (rc != EOK) {
-		printf("%s: Cannot register VFS driver port: %s\n", NAME, str_error(rc));
-		return rc;
-	}
-
-	/*
-	 * Start accepting connections.
-	 */
-	printf("%s: Accepting connections\n", NAME);
-	async_manager();
-	return 0;
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-#ifndef VFS_VFS_H_
-#define VFS_VFS_H_
-
-#include <async.h>
-#include <adt/list.h>
-#include <adt/hash_table.h>
-#include <fibril_synch.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <loc.h>
-#include <stdbool.h>
-#include <ipc/vfs.h>
-#include <task.h>
-#include <vfs/vfs.h>
-
-#ifndef dprintf
-#define dprintf(...)
-#endif
-
-// TODO: Remove this arbitrary limit.
-/** Maximum number of open files per client. */
-#define VFS_MAX_OPEN_FILES  128
-
-/**
- * A structure like this will be allocated for each registered file system.
- */
-typedef struct {
-	link_t fs_link;
-	vfs_info_t vfs_info;
-	fs_handle_t fs_handle;
-	async_sess_t *sess;
-} fs_info_t;
-
-/** Uniquely represents a file system instance. */
-typedef struct {
-	fs_handle_t fs_handle;
-	service_id_t service_id;
-} vfs_pair_t;
-
-/** Uniquely identifies a file system node (e.g. directory, file)
- * but doesn't contain any state. For a stateful structure, see vfs_node_t.
- *
- * @note	fs_handle, service_id and index are meant to be returned in one
- *		IPC reply.
- */
-typedef struct {
-	fs_handle_t fs_handle;
-	service_id_t service_id;
-	fs_index_t index;
-} vfs_triplet_t;
-
-typedef enum vfs_node_type {
-	VFS_NODE_UNKNOWN,
-	VFS_NODE_FILE,
-	VFS_NODE_DIRECTORY,
-} vfs_node_type_t;
-
-typedef struct {
-	vfs_triplet_t triplet;
-	vfs_node_type_t type;
-	aoff64_t size;
-} vfs_lookup_res_t;
-
-/**
- * Instances of this type represent an active, in-memory VFS node and any state
- * which may be associated with it.
- */
-typedef struct _vfs_node {
-	/*
-	 * Identity of the node
-	 */
-
-	fs_handle_t fs_handle;
-	service_id_t service_id;
-	fs_index_t index;
-
-	/**
-	 * Usage counter.  This includes, but is not limited to, all vfs_file_t
-	 * structures that reference this node.
-	 */
-	unsigned refcnt;
-
-	ht_link_t nh_link;		/**< Node hash-table link. */
-
-	vfs_node_type_t type;	/**< Partial info about the node type. */
-
-	aoff64_t size;		/**< Cached size if the node is a file. */
-
-	/**
-	 * Holding this rwlock prevents modifications of the node's contents.
-	 */
-	fibril_rwlock_t contents_rwlock;
-
-	struct _vfs_node *mount;
-} vfs_node_t;
-
-/**
- * Instances of this type represent an open file. If the file is opened by more
- * than one task, there will be a separate structure allocated for each task.
- */
-typedef struct {
-	/** Serializes access to this open file. */
-	fibril_mutex_t _lock;
-
-	vfs_node_t *node;
-
-	/** Number of file handles referencing this file. */
-	unsigned refcnt;
-
-	int permissions;
-	bool open_read;
-	bool open_write;
-
-	/** Append on write. */
-	bool append;
-} vfs_file_t;
-
-extern fibril_mutex_t nodes_mutex;
-
-extern fibril_condvar_t fs_list_cv;
-extern fibril_mutex_t fs_list_lock;
-extern list_t fs_list;		/**< List of registered file systems. */
-
-extern fibril_mutex_t fs_mntlist_lock;
-extern list_t fs_mntlist;	/**< List of mounted file systems. */
-
-extern vfs_pair_t rootfs;	/**< Root file system. */
-
-/** Each instance of this type describes one path lookup in progress. */
-typedef struct {
-	link_t	plb_link;	/**< Active PLB entries list link. */
-	unsigned index;		/**< Index of the first character in PLB. */
-	size_t len;		/**< Number of characters in this PLB entry. */
-} plb_entry_t;
-
-extern fibril_mutex_t plb_mutex;/**< Mutex protecting plb and plb_entries. */
-extern uint8_t *plb;		/**< Path Lookup Buffer */
-extern list_t plb_entries;	/**< List of active PLB entries. */
-
-/** Holding this rwlock prevents changes in file system namespace. */
-extern fibril_rwlock_t namespace_rwlock;
-
-extern async_exch_t *vfs_exchange_grab(fs_handle_t);
-extern void vfs_exchange_release(async_exch_t *);
-
-extern fs_handle_t fs_name_to_handle(unsigned int instance, const char *, bool);
-extern vfs_info_t *fs_handle_to_info(fs_handle_t);
-extern errno_t vfs_get_fstypes(vfs_fstypes_t *);
-
-extern errno_t vfs_lookup_internal(vfs_node_t *, char *, int, vfs_lookup_res_t *);
-extern errno_t vfs_link_internal(vfs_node_t *, char *, vfs_triplet_t *);
-
-extern bool vfs_nodes_init(void);
-extern vfs_node_t *vfs_node_get(vfs_lookup_res_t *);
-extern vfs_node_t *vfs_node_peek(vfs_lookup_res_t *result);
-extern void vfs_node_put(vfs_node_t *);
-extern void vfs_node_forget(vfs_node_t *);
-extern unsigned vfs_nodes_refcount_sum_get(fs_handle_t, service_id_t);
-
-extern bool vfs_node_has_children(vfs_node_t *node);
-
-extern void *vfs_client_data_create(void);
-extern void vfs_client_data_destroy(void *);
-
-extern void vfs_op_pass_handle(task_id_t, task_id_t, int);
-extern errno_t vfs_wait_handle_internal(bool, int *);
-
-extern vfs_file_t *vfs_file_get(int);
-extern void vfs_file_put(vfs_file_t *);
-extern errno_t vfs_fd_assign(vfs_file_t *, int);
-extern errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *);
-extern errno_t vfs_fd_free(int);
-
-extern void vfs_node_addref(vfs_node_t *);
-extern void vfs_node_delref(vfs_node_t *);
-extern errno_t vfs_open_node_remote(vfs_node_t *);
-
-extern errno_t vfs_op_clone(int oldfd, int newfd, bool desc, int *);
-extern errno_t vfs_op_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
-extern errno_t vfs_op_mount(int mpfd, unsigned servid, unsigned flags, unsigned instance, const char *opts, const char *fsname, int *outfd);
-extern errno_t vfs_op_mtab_get(void);
-extern errno_t vfs_op_open(int fd, int flags);
-extern errno_t vfs_op_put(int fd);
-extern errno_t vfs_op_read(int fd, aoff64_t, size_t *out_bytes);
-extern errno_t vfs_op_rename(int basefd, char *old, char *new);
-extern errno_t vfs_op_resize(int fd, int64_t size);
-extern errno_t vfs_op_stat(int fd);
-extern errno_t vfs_op_statfs(int fd);
-extern errno_t vfs_op_sync(int fd);
-extern errno_t vfs_op_unlink(int parentfd, int expectfd, char *path);
-extern errno_t vfs_op_unmount(int mpfd);
-extern errno_t vfs_op_wait_handle(bool high_fd, int *out_fd);
-extern errno_t vfs_op_walk(int parentfd, int flags, char *path, int *out_fd);
-extern errno_t vfs_op_write(int fd, aoff64_t, size_t *out_bytes);
-
-extern void vfs_register(ipc_call_t *);
-
-extern void vfs_page_in(ipc_call_t *);
-
-typedef struct {
-	void *buffer;
-	size_t size;
-} rdwr_io_chunk_t;
-
-extern errno_t vfs_rdwr_internal(int, aoff64_t, bool, rdwr_io_chunk_t *);
-
-extern void vfs_connection(ipc_call_t *, void *);
-
-#endif
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_file.c
===================================================================
--- uspace/srv/vfs/vfs_file.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,460 +1,0 @@
-/*
- * Copyright (c) 2007 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file	vfs_file.c
- * @brief	Various operations on files have their home in this file.
- */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <assert.h>
-#include <stdbool.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <task.h>
-#include <vfs/vfs.h>
-#include "vfs.h"
-
-#define VFS_DATA	((vfs_client_data_t *) async_get_client_data())
-#define FILES		(VFS_DATA->files)
-
-typedef struct {
-	fibril_mutex_t lock;
-	fibril_condvar_t cv;
-	list_t passed_handles;
-	vfs_file_t **files;
-} vfs_client_data_t;
-
-typedef struct {
-	link_t link;
-	vfs_node_t *node;
-	int permissions;
-} vfs_boxed_handle_t;
-
-static errno_t _vfs_fd_free(vfs_client_data_t *, int);
-
-/** Initialize the table of open files. */
-static bool vfs_files_init(vfs_client_data_t *vfs_data)
-{
-	fibril_mutex_lock(&vfs_data->lock);
-	if (!vfs_data->files) {
-		vfs_data->files = malloc(VFS_MAX_OPEN_FILES * sizeof(vfs_file_t *));
-		if (!vfs_data->files) {
-			fibril_mutex_unlock(&vfs_data->lock);
-			return false;
-		}
-		memset(vfs_data->files, 0, VFS_MAX_OPEN_FILES * sizeof(vfs_file_t *));
-	}
-	fibril_mutex_unlock(&vfs_data->lock);
-	return true;
-}
-
-/** Cleanup the table of open files. */
-static void vfs_files_done(vfs_client_data_t *vfs_data)
-{
-	int i;
-
-	if (!vfs_data->files)
-		return;
-
-	for (i = 0; i < VFS_MAX_OPEN_FILES; i++) {
-		if (vfs_data->files[i])
-			(void) _vfs_fd_free(vfs_data, i);
-	}
-
-	free(vfs_data->files);
-
-	while (!list_empty(&vfs_data->passed_handles)) {
-		link_t *lnk;
-		vfs_boxed_handle_t *bh;
-
-		lnk = list_first(&vfs_data->passed_handles);
-		list_remove(lnk);
-
-		bh = list_get_instance(lnk, vfs_boxed_handle_t, link);
-		free(bh);
-	}
-}
-
-void *vfs_client_data_create(void)
-{
-	vfs_client_data_t *vfs_data;
-
-	vfs_data = malloc(sizeof(vfs_client_data_t));
-	if (vfs_data) {
-		fibril_mutex_initialize(&vfs_data->lock);
-		fibril_condvar_initialize(&vfs_data->cv);
-		list_initialize(&vfs_data->passed_handles);
-		vfs_data->files = NULL;
-	}
-
-	return vfs_data;
-}
-
-void vfs_client_data_destroy(void *data)
-{
-	vfs_client_data_t *vfs_data = (vfs_client_data_t *) data;
-
-	vfs_files_done(vfs_data);
-	free(vfs_data);
-}
-
-/** Close the file in the endpoint FS server. */
-static errno_t vfs_file_close_remote(vfs_file_t *file)
-{
-	assert(!file->refcnt);
-
-	async_exch_t *exch = vfs_exchange_grab(file->node->fs_handle);
-
-	ipc_call_t answer;
-	aid_t msg = async_send_2(exch, VFS_OUT_CLOSE, file->node->service_id,
-	    file->node->index, &answer);
-
-	vfs_exchange_release(exch);
-
-	errno_t rc;
-	async_wait_for(msg, &rc);
-
-	return ipc_get_retval(&answer);
-}
-
-/** Increment reference count of VFS file structure.
- *
- * @param file		File structure that will have reference count
- *			incremented.
- */
-static void vfs_file_addref(vfs_client_data_t *vfs_data, vfs_file_t *file)
-{
-	assert(fibril_mutex_is_locked(&vfs_data->lock));
-
-	file->refcnt++;
-}
-
-/** Decrement reference count of VFS file structure.
- *
- * @param file		File structure that will have reference count
- *			decremented.
- */
-static errno_t vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)
-{
-	errno_t rc = EOK;
-
-	assert(fibril_mutex_is_locked(&vfs_data->lock));
-
-	if (file->refcnt-- == 1) {
-		/*
-		 * Lost the last reference to a file, need to close it in the
-		 * endpoint FS and drop our reference to the underlying VFS node.
-		 */
-
-		if (file->node != NULL) {
-			if (file->open_read || file->open_write) {
-				rc = vfs_file_close_remote(file);
-			}
-			vfs_node_delref(file->node);
-		}
-		free(file);
-	}
-
-	return rc;
-}
-
-static errno_t _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc, int *out_fd)
-{
-	if (!vfs_files_init(vfs_data))
-		return ENOMEM;
-
-	unsigned int i;
-	if (desc)
-		i = VFS_MAX_OPEN_FILES - 1;
-	else
-		i = 0;
-
-	fibril_mutex_lock(&vfs_data->lock);
-	while (true) {
-		if (!vfs_data->files[i]) {
-			vfs_data->files[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t));
-			if (!vfs_data->files[i]) {
-				fibril_mutex_unlock(&vfs_data->lock);
-				return ENOMEM;
-			}
-
-			memset(vfs_data->files[i], 0, sizeof(vfs_file_t));
-
-			fibril_mutex_initialize(&vfs_data->files[i]->_lock);
-			fibril_mutex_lock(&vfs_data->files[i]->_lock);
-			vfs_file_addref(vfs_data, vfs_data->files[i]);
-
-			*file = vfs_data->files[i];
-			vfs_file_addref(vfs_data, *file);
-
-			fibril_mutex_unlock(&vfs_data->lock);
-			*out_fd = (int) i;
-			return EOK;
-		}
-
-		if (desc) {
-			if (i == 0)
-				break;
-
-			i--;
-		} else {
-			if (i == VFS_MAX_OPEN_FILES - 1)
-				break;
-
-			i++;
-		}
-	}
-	fibril_mutex_unlock(&vfs_data->lock);
-
-	return EMFILE;
-}
-
-/** Allocate a file descriptor.
- *
- * @param file Is set to point to the newly created file structure. Must be put afterwards.
- * @param desc If true, look for an available file descriptor
- *             in a descending order.
- *
- * @param[out] out_fd  First available file descriptor
- *
- * @return Error code.
- */
-errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *out_fd)
-{
-	return _vfs_fd_alloc(VFS_DATA, file, desc, out_fd);
-}
-
-static errno_t _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd)
-{
-	if ((fd < 0) || (fd >= VFS_MAX_OPEN_FILES) || !vfs_data->files[fd]) {
-		return EBADF;
-	}
-
-	errno_t rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);
-	vfs_data->files[fd] = NULL;
-	return rc;
-}
-
-static errno_t _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)
-{
-	errno_t rc;
-
-	if (!vfs_files_init(vfs_data))
-		return ENOMEM;
-
-	fibril_mutex_lock(&vfs_data->lock);
-	rc = _vfs_fd_free_locked(vfs_data, fd);
-	fibril_mutex_unlock(&vfs_data->lock);
-
-	return rc;
-}
-
-/** Release file descriptor.
- *
- * @param fd		File descriptor being released.
- *
- * @return		EOK on success or EBADF if fd is an invalid file
- *			descriptor.
- */
-errno_t vfs_fd_free(int fd)
-{
-	return _vfs_fd_free(VFS_DATA, fd);
-}
-
-/** Assign a file to a file descriptor.
- *
- * @param file File to assign.
- * @param fd   File descriptor to assign to.
- *
- * @return EOK on success or EINVAL if fd is an invalid or already
- *         used file descriptor.
- *
- */
-errno_t vfs_fd_assign(vfs_file_t *file, int fd)
-{
-	if (!vfs_files_init(VFS_DATA))
-		return ENOMEM;
-
-	fibril_mutex_lock(&VFS_DATA->lock);
-	if ((fd < 0) || (fd >= VFS_MAX_OPEN_FILES)) {
-		fibril_mutex_unlock(&VFS_DATA->lock);
-		return EBADF;
-	}
-
-	/* Make sure fd is closed. */
-	(void) _vfs_fd_free_locked(VFS_DATA, fd);
-	assert(FILES[fd] == NULL);
-
-	FILES[fd] = file;
-	vfs_file_addref(VFS_DATA, FILES[fd]);
-	fibril_mutex_unlock(&VFS_DATA->lock);
-
-	return EOK;
-}
-
-static void _vfs_file_put(vfs_client_data_t *vfs_data, vfs_file_t *file)
-{
-	fibril_mutex_unlock(&file->_lock);
-
-	fibril_mutex_lock(&vfs_data->lock);
-	vfs_file_delref(vfs_data, file);
-	fibril_mutex_unlock(&vfs_data->lock);
-}
-
-static vfs_file_t *_vfs_file_get(vfs_client_data_t *vfs_data, int fd)
-{
-	if (!vfs_files_init(vfs_data))
-		return NULL;
-
-	fibril_mutex_lock(&vfs_data->lock);
-	if ((fd >= 0) && (fd < VFS_MAX_OPEN_FILES)) {
-		vfs_file_t *file = vfs_data->files[fd];
-		if (file != NULL) {
-			vfs_file_addref(vfs_data, file);
-			fibril_mutex_unlock(&vfs_data->lock);
-
-			fibril_mutex_lock(&file->_lock);
-			if (file->node == NULL) {
-				_vfs_file_put(vfs_data, file);
-				return NULL;
-			}
-			assert(file != NULL);
-			assert(file->node != NULL);
-			return file;
-		}
-	}
-	fibril_mutex_unlock(&vfs_data->lock);
-
-	return NULL;
-}
-
-/** Find VFS file structure for a given file descriptor.
- *
- * @param fd		File descriptor.
- *
- * @return		VFS file structure corresponding to fd.
- */
-vfs_file_t *vfs_file_get(int fd)
-{
-	return _vfs_file_get(VFS_DATA, fd);
-}
-
-/** Stop using a file structure.
- *
- * @param file		VFS file structure.
- */
-void vfs_file_put(vfs_file_t *file)
-{
-	_vfs_file_put(VFS_DATA, file);
-}
-
-void vfs_op_pass_handle(task_id_t donor_id, task_id_t acceptor_id, int donor_fd)
-{
-	vfs_client_data_t *donor_data = NULL;
-	vfs_client_data_t *acceptor_data = NULL;
-	vfs_file_t *donor_file = NULL;
-	vfs_boxed_handle_t *bh;
-
-	acceptor_data = async_get_client_data_by_id(acceptor_id);
-	if (!acceptor_data)
-		return;
-
-	bh = malloc(sizeof(vfs_boxed_handle_t));
-	assert(bh);
-
-	link_initialize(&bh->link);
-	bh->node = NULL;
-
-	donor_data = async_get_client_data_by_id(donor_id);
-	if (!donor_data)
-		goto out;
-
-	donor_file = _vfs_file_get(donor_data, donor_fd);
-	if (!donor_file)
-		goto out;
-
-	/*
-	 * Add a new reference to the underlying VFS node.
-	 */
-	vfs_node_addref(donor_file->node);
-	bh->node = donor_file->node;
-	bh->permissions = donor_file->permissions;
-
-out:
-	fibril_mutex_lock(&acceptor_data->lock);
-	list_append(&bh->link, &acceptor_data->passed_handles);
-	fibril_condvar_broadcast(&acceptor_data->cv);
-	fibril_mutex_unlock(&acceptor_data->lock);
-
-	if (donor_data)
-		async_put_client_data_by_id(donor_id);
-	if (acceptor_data)
-		async_put_client_data_by_id(acceptor_id);
-	if (donor_file)
-		_vfs_file_put(donor_data, donor_file);
-}
-
-errno_t vfs_wait_handle_internal(bool high_fd, int *out_fd)
-{
-	vfs_client_data_t *vfs_data = VFS_DATA;
-
-	fibril_mutex_lock(&vfs_data->lock);
-	while (list_empty(&vfs_data->passed_handles))
-		fibril_condvar_wait(&vfs_data->cv, &vfs_data->lock);
-	link_t *lnk = list_first(&vfs_data->passed_handles);
-	list_remove(lnk);
-	fibril_mutex_unlock(&vfs_data->lock);
-
-	vfs_boxed_handle_t *bh = list_get_instance(lnk, vfs_boxed_handle_t, link);
-
-	vfs_file_t *file;
-	errno_t rc = _vfs_fd_alloc(vfs_data, &file, high_fd, out_fd);
-	if (rc != EOK) {
-		vfs_node_delref(bh->node);
-		free(bh);
-		return rc;
-	}
-
-	file->node = bh->node;
-	file->permissions = bh->permissions;
-	vfs_file_put(file);
-	free(bh);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_ipc.c
===================================================================
--- uspace/srv/vfs/vfs_ipc.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,403 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <vfs/vfs.h>
-#include "vfs.h"
-
-#include <errno.h>
-#include <stdlib.h>
-#include <str.h>
-#include <vfs/canonify.h>
-
-static void vfs_in_clone(ipc_call_t *req)
-{
-	int oldfd = ipc_get_arg1(req);
-	int newfd = ipc_get_arg2(req);
-	bool desc = ipc_get_arg3(req);
-
-	int outfd = -1;
-	errno_t rc = vfs_op_clone(oldfd, newfd, desc, &outfd);
-	async_answer_1(req, rc, outfd);
-}
-
-static void vfs_in_fsprobe(ipc_call_t *req)
-{
-	service_id_t service_id = (service_id_t) ipc_get_arg1(req);
-	char *fs_name = NULL;
-	vfs_fs_probe_info_t info;
-	errno_t rc;
-
-	/*
-	 * Now we expect the client to send us data with the name of the file
-	 * system.
-	 */
-	rc = async_data_write_accept((void **) &fs_name, true, 0,
-	    FS_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(req, rc);
-		return;
-	}
-
-	rc = vfs_op_fsprobe(fs_name, service_id, &info);
-	async_answer_0(req, rc);
-	if (rc != EOK)
-		goto out;
-
-	/* Now we should get a read request */
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_read_receive(&call, &len))
-		goto out;
-
-	if (len > sizeof(info))
-		len = sizeof(info);
-	(void) async_data_read_finalize(&call, &info, len);
-
-out:
-	free(fs_name);
-}
-
-static void vfs_in_fstypes(ipc_call_t *req)
-{
-	vfs_fstypes_t fstypes;
-	errno_t rc;
-
-	rc = vfs_get_fstypes(&fstypes);
-	if (rc != EOK) {
-		async_answer_0(req, ENOMEM);
-		return;
-	}
-
-	/* Send size of the data */
-	async_answer_1(req, EOK, fstypes.size);
-
-	/* Now we should get a read request */
-	ipc_call_t call;
-	size_t len;
-	if (!async_data_read_receive(&call, &len))
-		goto out;
-
-	if (len > fstypes.size)
-		len = fstypes.size;
-	(void) async_data_read_finalize(&call, fstypes.buf, len);
-
-out:
-	vfs_fstypes_free(&fstypes);
-}
-
-static void vfs_in_mount(ipc_call_t *req)
-{
-	int mpfd = ipc_get_arg1(req);
-
-	/*
-	 * We expect the library to do the device-name to device-handle
-	 * translation for us, thus the device handle will arrive as ARG1
-	 * in the request.
-	 */
-	service_id_t service_id = (service_id_t) ipc_get_arg2(req);
-
-	unsigned int flags = (unsigned int) ipc_get_arg3(req);
-	unsigned int instance = ipc_get_arg4(req);
-
-	char *opts = NULL;
-	char *fs_name = NULL;
-
-	/* Now we expect to receive the mount options. */
-	errno_t rc = async_data_write_accept((void **) &opts, true, 0,
-	    MAX_MNTOPTS_LEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(req, rc);
-		return;
-	}
-
-	/*
-	 * Now we expect the client to send us data with the name of the file
-	 * system.
-	 */
-	rc = async_data_write_accept((void **) &fs_name, true, 0,
-	    FS_NAME_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		free(opts);
-		async_answer_0(req, rc);
-		return;
-	}
-
-	int outfd = 0;
-	rc = vfs_op_mount(mpfd, service_id, flags, instance, opts, fs_name,
-	    &outfd);
-	async_answer_1(req, rc, outfd);
-
-	free(opts);
-	free(fs_name);
-}
-
-static void vfs_in_open(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	int mode = ipc_get_arg2(req);
-
-	errno_t rc = vfs_op_open(fd, mode);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_put(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	errno_t rc = vfs_op_put(fd);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_read(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	aoff64_t pos = MERGE_LOUP32(ipc_get_arg2(req),
-	    ipc_get_arg3(req));
-
-	size_t bytes = 0;
-	errno_t rc = vfs_op_read(fd, pos, &bytes);
-	async_answer_1(req, rc, bytes);
-}
-
-static void vfs_in_rename(ipc_call_t *req)
-{
-	/* The common base directory. */
-	int basefd;
-	char *old = NULL;
-	char *new = NULL;
-	errno_t rc;
-
-	basefd = ipc_get_arg1(req);
-
-	/* Retrieve the old path. */
-	rc = async_data_write_accept((void **) &old, true, 0, 0, 0, NULL);
-	if (rc != EOK)
-		goto out;
-
-	/* Retrieve the new path. */
-	rc = async_data_write_accept((void **) &new, true, 0, 0, 0, NULL);
-	if (rc != EOK)
-		goto out;
-
-	size_t olen;
-	size_t nlen;
-	char *oldc = canonify(old, &olen);
-	char *newc = canonify(new, &nlen);
-
-	if ((!oldc) || (!newc)) {
-		rc = EINVAL;
-		goto out;
-	}
-
-	assert(oldc[olen] == '\0');
-	assert(newc[nlen] == '\0');
-
-	rc = vfs_op_rename(basefd, oldc, newc);
-
-out:
-	async_answer_0(req, rc);
-
-	if (old)
-		free(old);
-	if (new)
-		free(new);
-}
-
-static void vfs_in_resize(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	int64_t size = MERGE_LOUP32(ipc_get_arg2(req), ipc_get_arg3(req));
-	errno_t rc = vfs_op_resize(fd, size);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_stat(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	errno_t rc = vfs_op_stat(fd);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_statfs(ipc_call_t *req)
-{
-	int fd = (int) ipc_get_arg1(req);
-
-	errno_t rc = vfs_op_statfs(fd);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_sync(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	errno_t rc = vfs_op_sync(fd);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_unlink(ipc_call_t *req)
-{
-	int parentfd = ipc_get_arg1(req);
-	int expectfd = ipc_get_arg2(req);
-
-	char *path;
-	errno_t rc = async_data_write_accept((void **) &path, true, 0, 0, 0, NULL);
-	if (rc == EOK)
-		rc = vfs_op_unlink(parentfd, expectfd, path);
-
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_unmount(ipc_call_t *req)
-{
-	int mpfd = ipc_get_arg1(req);
-	errno_t rc = vfs_op_unmount(mpfd);
-	async_answer_0(req, rc);
-}
-
-static void vfs_in_wait_handle(ipc_call_t *req)
-{
-	bool high_fd = ipc_get_arg1(req);
-	int fd = -1;
-	errno_t rc = vfs_op_wait_handle(high_fd, &fd);
-	async_answer_1(req, rc, fd);
-}
-
-static void vfs_in_walk(ipc_call_t *req)
-{
-	/*
-	 * Parent is our relative root for file lookup.
-	 * For defined flags, see <ipc/vfs.h>.
-	 */
-	int parentfd = ipc_get_arg1(req);
-	int flags = ipc_get_arg2(req);
-
-	int fd = 0;
-	char *path;
-	errno_t rc = async_data_write_accept((void **)&path, true, 0, 0, 0, NULL);
-	if (rc == EOK) {
-		rc = vfs_op_walk(parentfd, flags, path, &fd);
-		free(path);
-	}
-	async_answer_1(req, rc, fd);
-}
-
-static void vfs_in_write(ipc_call_t *req)
-{
-	int fd = ipc_get_arg1(req);
-	aoff64_t pos = MERGE_LOUP32(ipc_get_arg2(req),
-	    ipc_get_arg3(req));
-
-	size_t bytes = 0;
-	errno_t rc = vfs_op_write(fd, pos, &bytes);
-	async_answer_1(req, rc, bytes);
-}
-
-void vfs_connection(ipc_call_t *icall, void *arg)
-{
-	bool cont = true;
-
-	/*
-	 * The connection was opened via the IPC_CONNECT_ME_TO call.
-	 * This call needs to be answered.
-	 */
-	async_accept_0(icall);
-
-	while (cont) {
-		ipc_call_t call;
-		async_get_call(&call);
-
-		if (!ipc_get_imethod(&call)) {
-			async_answer_0(&call, EOK);
-			break;
-		}
-
-		switch (ipc_get_imethod(&call)) {
-		case VFS_IN_CLONE:
-			vfs_in_clone(&call);
-			break;
-		case VFS_IN_FSPROBE:
-			vfs_in_fsprobe(&call);
-			break;
-		case VFS_IN_FSTYPES:
-			vfs_in_fstypes(&call);
-			break;
-		case VFS_IN_MOUNT:
-			vfs_in_mount(&call);
-			break;
-		case VFS_IN_OPEN:
-			vfs_in_open(&call);
-			break;
-		case VFS_IN_PUT:
-			vfs_in_put(&call);
-			break;
-		case VFS_IN_READ:
-			vfs_in_read(&call);
-			break;
-		case VFS_IN_REGISTER:
-			vfs_register(&call);
-			cont = false;
-			break;
-		case VFS_IN_RENAME:
-			vfs_in_rename(&call);
-			break;
-		case VFS_IN_RESIZE:
-			vfs_in_resize(&call);
-			break;
-		case VFS_IN_STAT:
-			vfs_in_stat(&call);
-			break;
-		case VFS_IN_STATFS:
-			vfs_in_statfs(&call);
-			break;
-		case VFS_IN_SYNC:
-			vfs_in_sync(&call);
-			break;
-		case VFS_IN_UNLINK:
-			vfs_in_unlink(&call);
-			break;
-		case VFS_IN_UNMOUNT:
-			vfs_in_unmount(&call);
-			break;
-		case VFS_IN_WAIT_HANDLE:
-			vfs_in_wait_handle(&call);
-			break;
-		case VFS_IN_WALK:
-			vfs_in_walk(&call);
-			break;
-		case VFS_IN_WRITE:
-			vfs_in_write(&call);
-			break;
-		default:
-			async_answer_0(&call, ENOTSUP);
-			break;
-		}
-	}
-
-	/*
-	 * Open files for this client will be cleaned up when its last
-	 * connection fibril terminates.
-	 */
-}
Index: pace/srv/vfs/vfs_lookup.c
===================================================================
--- uspace/srv/vfs/vfs_lookup.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,399 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file vfs_lookup.c
- * @brief
- */
-
-#include "vfs.h"
-#include <macros.h>
-#include <async.h>
-#include <errno.h>
-#include <str.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <vfs/canonify.h>
-#include <dirent.h>
-#include <assert.h>
-
-FIBRIL_MUTEX_INITIALIZE(plb_mutex);
-LIST_INITIALIZE(plb_entries);	/**< PLB entry ring buffer. */
-uint8_t *plb = NULL;
-
-static errno_t plb_insert_entry(plb_entry_t *entry, char *path, size_t *start,
-    size_t len)
-{
-	fibril_mutex_lock(&plb_mutex);
-
-	link_initialize(&entry->plb_link);
-	entry->len = len;
-
-	size_t first;	/* the first free index */
-	size_t last;	/* the last free index */
-
-	if (list_empty(&plb_entries)) {
-		first = 0;
-		last = PLB_SIZE - 1;
-	} else {
-		plb_entry_t *oldest = list_get_instance(
-		    list_first(&plb_entries), plb_entry_t, plb_link);
-		plb_entry_t *newest = list_get_instance(
-		    list_last(&plb_entries), plb_entry_t, plb_link);
-
-		first = (newest->index + newest->len) % PLB_SIZE;
-		last = (oldest->index - 1) % PLB_SIZE;
-	}
-
-	if (first <= last) {
-		if ((last - first) + 1 < len) {
-			/*
-			 * The buffer cannot absorb the path.
-			 */
-			fibril_mutex_unlock(&plb_mutex);
-			return ELIMIT;
-		}
-	} else {
-		if (PLB_SIZE - ((first - last) + 1) < len) {
-			/*
-			 * The buffer cannot absorb the path.
-			 */
-			fibril_mutex_unlock(&plb_mutex);
-			return ELIMIT;
-		}
-	}
-
-	/*
-	 * We know the first free index in PLB and we also know that there is
-	 * enough space in the buffer to hold our path.
-	 */
-
-	entry->index = first;
-	entry->len = len;
-
-	/*
-	 * Claim PLB space by inserting the entry into the PLB entry ring
-	 * buffer.
-	 */
-	list_append(&entry->plb_link, &plb_entries);
-
-	fibril_mutex_unlock(&plb_mutex);
-
-	/*
-	 * Copy the path into PLB.
-	 */
-	size_t cnt1 = min(len, (PLB_SIZE - first) + 1);
-	size_t cnt2 = len - cnt1;
-
-	memcpy(&plb[first], path, cnt1);
-	memcpy(plb, &path[cnt1], cnt2);
-
-	*start = first;
-	return EOK;
-}
-
-static void plb_clear_entry(plb_entry_t *entry, size_t first, size_t len)
-{
-	fibril_mutex_lock(&plb_mutex);
-	list_remove(&entry->plb_link);
-	/*
-	 * Erasing the path from PLB will come handy for debugging purposes.
-	 */
-	size_t cnt1 = min(len, (PLB_SIZE - first) + 1);
-	size_t cnt2 = len - cnt1;
-	memset(&plb[first], 0, cnt1);
-	memset(plb, 0, cnt2);
-	fibril_mutex_unlock(&plb_mutex);
-}
-
-errno_t vfs_link_internal(vfs_node_t *base, char *path, vfs_triplet_t *child)
-{
-	assert(base != NULL);
-	assert(child != NULL);
-	assert(base->fs_handle);
-	assert(child->fs_handle);
-	assert(path != NULL);
-
-	vfs_lookup_res_t res;
-	char component[NAME_MAX + 1];
-	errno_t rc;
-
-	size_t len;
-	char *npath = canonify(path, &len);
-	if (!npath) {
-		rc = EINVAL;
-		goto out;
-	}
-	path = npath;
-
-	vfs_triplet_t *triplet;
-
-	char *slash = str_rchr(path, L'/');
-	if (slash && slash != path) {
-		if (slash[1] == 0) {
-			rc = EINVAL;
-			goto out;
-		}
-
-		memcpy(component, slash + 1, str_size(slash));
-		*slash = 0;
-
-		rc = vfs_lookup_internal(base, path, L_DIRECTORY, &res);
-		if (rc != EOK)
-			goto out;
-		triplet = &res.triplet;
-
-		*slash = '/';
-	} else {
-		if (base->mount != NULL) {
-			rc = EINVAL;
-			goto out;
-		}
-
-		memcpy(component, path + 1, str_size(path));
-		triplet = (vfs_triplet_t *) base;
-	}
-
-	if (triplet->fs_handle != child->fs_handle ||
-	    triplet->service_id != child->service_id) {
-		rc = EXDEV;
-		goto out;
-	}
-
-	async_exch_t *exch = vfs_exchange_grab(triplet->fs_handle);
-	aid_t req = async_send_3(exch, VFS_OUT_LINK, triplet->service_id,
-	    triplet->index, child->index, NULL);
-
-	rc = async_data_write_start(exch, component, str_size(component) + 1);
-	errno_t orig_rc;
-	async_wait_for(req, &orig_rc);
-	vfs_exchange_release(exch);
-	if (orig_rc != EOK)
-		rc = orig_rc;
-
-out:
-	return rc;
-}
-
-static errno_t out_lookup(vfs_triplet_t *base, size_t *pfirst, size_t *plen,
-    int lflag, vfs_lookup_res_t *result)
-{
-	assert(base);
-	assert(result);
-
-	errno_t rc;
-	ipc_call_t answer;
-	async_exch_t *exch = vfs_exchange_grab(base->fs_handle);
-	aid_t req = async_send_5(exch, VFS_OUT_LOOKUP, (sysarg_t) *pfirst,
-	    (sysarg_t) *plen, (sysarg_t) base->service_id,
-	    (sysarg_t) base->index, (sysarg_t) lflag, &answer);
-	async_wait_for(req, &rc);
-	vfs_exchange_release(exch);
-
-	if (rc != EOK)
-		return rc;
-
-	unsigned last = *pfirst + *plen;
-	*pfirst = ipc_get_arg3(&answer) & 0xffff;
-	*plen = last - *pfirst;
-
-	result->triplet.fs_handle = (fs_handle_t) ipc_get_arg1(&answer);
-	result->triplet.service_id = base->service_id;
-	result->triplet.index = (fs_index_t) ipc_get_arg2(&answer);
-	result->size = MERGE_LOUP32(ipc_get_arg4(&answer), ipc_get_arg5(&answer));
-	result->type = (ipc_get_arg3(&answer) >> 16) ?
-	    VFS_NODE_DIRECTORY : VFS_NODE_FILE;
-	return EOK;
-}
-
-static errno_t _vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
-    vfs_lookup_res_t *result, size_t len)
-{
-	size_t first;
-	errno_t rc;
-
-	plb_entry_t entry;
-	rc = plb_insert_entry(&entry, path, &first, len);
-	if (rc != EOK)
-		return rc;
-
-	size_t next = first;
-	size_t nlen = len;
-
-	vfs_lookup_res_t res;
-
-	/* Resolve path as long as there are mount points to cross. */
-	while (nlen > 0) {
-		while (base->mount) {
-			if (lflag & L_DISABLE_MOUNTS) {
-				rc = EXDEV;
-				goto out;
-			}
-
-			base = base->mount;
-		}
-
-		rc = out_lookup((vfs_triplet_t *) base, &next, &nlen, lflag,
-		    &res);
-		if (rc != EOK)
-			goto out;
-
-		if (nlen > 0) {
-			base = vfs_node_peek(&res);
-			if (!base) {
-				rc = ENOENT;
-				goto out;
-			}
-			if (!base->mount) {
-				vfs_node_put(base);
-				rc = ENOENT;
-				goto out;
-			}
-			vfs_node_put(base);
-			if (lflag & L_DISABLE_MOUNTS) {
-				rc = EXDEV;
-				goto out;
-			}
-		}
-	}
-
-	assert(nlen == 0);
-	rc = EOK;
-
-	if (result != NULL) {
-		/* The found file may be a mount point. Try to cross it. */
-		if (!(lflag & (L_MP | L_DISABLE_MOUNTS))) {
-			base = vfs_node_peek(&res);
-			if (base && base->mount) {
-				while (base->mount) {
-					vfs_node_addref(base->mount);
-					vfs_node_t *nbase = base->mount;
-					vfs_node_put(base);
-					base = nbase;
-				}
-
-				result->triplet = *((vfs_triplet_t *) base);
-				result->type = base->type;
-				result->size = base->size;
-				vfs_node_put(base);
-				goto out;
-			}
-			if (base)
-				vfs_node_put(base);
-		}
-
-		*result = res;
-	}
-
-out:
-	plb_clear_entry(&entry, first, len);
-	return rc;
-}
-
-/** Perform a path lookup.
- *
- * @param base    The file from which to perform the lookup.
- * @param path    Path to be resolved; it must be a NULL-terminated
- *                string.
- * @param lflag   Flags to be used during lookup.
- * @param result  Empty structure where the lookup result will be stored.
- *                Can be NULL.
- *
- * @return EOK on success or an error code from errno.h.
- *
- */
-errno_t vfs_lookup_internal(vfs_node_t *base, char *path, int lflag,
-    vfs_lookup_res_t *result)
-{
-	assert(base != NULL);
-	assert(path != NULL);
-
-	size_t len;
-	errno_t rc;
-	char *npath = canonify(path, &len);
-	if (!npath) {
-		rc = EINVAL;
-		return rc;
-	}
-	path = npath;
-
-	assert(path[0] == '/');
-
-	if (lflag & (L_CREATE | L_UNLINK)) {
-
-		/*
-		 * Creation and destruction of names must be done in two
-		 * separate steps: lookup of the parent node and the name
-		 * link/unlink operation itself.  Otherwise the parent
-		 * filesystem would not be able to tell when a mountpoint is
-		 * crossed. It would attempt to perform the link/unlink in
-		 * itself instead of letting the mounted filesystem do it,
-		 * resulting in wrong behavior. This is the wages of server-side
-		 * mountpoints.
-		 */
-
-		char *slash = str_rchr(path, L'/');
-		vfs_node_t *parent = base;
-
-		if (slash != path) {
-			int tflag = lflag;
-			vfs_lookup_res_t tres;
-
-			tflag &= ~(L_CREATE | L_EXCLUSIVE | L_UNLINK | L_FILE);
-			tflag |= L_DIRECTORY;
-			rc = _vfs_lookup_internal(base, path, tflag, &tres,
-			    slash - path);
-			if (rc != EOK)
-				return rc;
-			parent = vfs_node_get(&tres);
-			if (!parent)
-				return ENOMEM;
-		} else
-			vfs_node_addref(parent);
-
-		rc = _vfs_lookup_internal(parent, slash, lflag, result,
-		    len - (slash - path));
-
-		vfs_node_put(parent);
-
-	} else {
-		rc = _vfs_lookup_internal(base, path, lflag, result, len);
-	}
-
-	return rc;
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,326 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file	vfs_node.c
- * @brief	Various operations on VFS nodes have their home in this file.
- */
-
-#include "vfs.h"
-#include <stdlib.h>
-#include <str.h>
-#include <fibril_synch.h>
-#include <adt/hash_table.h>
-#include <adt/hash.h>
-#include <assert.h>
-#include <async.h>
-#include <errno.h>
-#include <macros.h>
-
-/** Mutex protecting the VFS node hash table. */
-FIBRIL_MUTEX_INITIALIZE(nodes_mutex);
-
-#define NODES_BUCKETS_LOG	8
-#define NODES_BUCKETS		(1 << NODES_BUCKETS_LOG)
-
-/** VFS node hash table containing all active, in-memory VFS nodes. */
-hash_table_t nodes;
-
-#define KEY_FS_HANDLE	0
-#define KEY_DEV_HANDLE	1
-#define KEY_INDEX	2
-
-static size_t nodes_key_hash(const void *);
-static size_t nodes_hash(const ht_link_t *);
-static bool nodes_key_equal(const void *, size_t, const ht_link_t *);
-static vfs_triplet_t node_triplet(vfs_node_t *node);
-
-/** VFS node hash table operations. */
-const hash_table_ops_t nodes_ops = {
-	.hash = nodes_hash,
-	.key_hash = nodes_key_hash,
-	.key_equal = nodes_key_equal,
-	.equal = NULL,
-	.remove_callback = NULL,
-};
-
-/** Initialize the VFS node hash table.
- *
- * @return		Return true on success, false on failure.
- */
-bool vfs_nodes_init(void)
-{
-	return hash_table_create(&nodes, 0, 0, &nodes_ops);
-}
-
-static inline void _vfs_node_addref(vfs_node_t *node)
-{
-	node->refcnt++;
-}
-
-/** Increment reference count of a VFS node.
- *
- * @param node		VFS node that will have its refcnt incremented.
- */
-void vfs_node_addref(vfs_node_t *node)
-{
-	fibril_mutex_lock(&nodes_mutex);
-	_vfs_node_addref(node);
-	fibril_mutex_unlock(&nodes_mutex);
-}
-
-/** Decrement reference count of a VFS node.
- *
- * This function handles the case when the reference count drops to zero.
- *
- * @param node		VFS node that will have its refcnt decremented.
- */
-void vfs_node_delref(vfs_node_t *node)
-{
-	bool free_node = false;
-
-	fibril_mutex_lock(&nodes_mutex);
-
-	node->refcnt--;
-	if (node->refcnt == 0) {
-		/*
-		 * We are dropping the last reference to this node.
-		 * Remove it from the VFS node hash table.
-		 */
-
-		hash_table_remove_item(&nodes, &node->nh_link);
-		free_node = true;
-	}
-
-	fibril_mutex_unlock(&nodes_mutex);
-
-	if (free_node) {
-		/*
-		 * VFS_OUT_DESTROY will free up the file's resources if there
-		 * are no more hard links.
-		 */
-
-		async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-		async_msg_2(exch, VFS_OUT_DESTROY, (sysarg_t) node->service_id,
-		    (sysarg_t)node->index);
-		vfs_exchange_release(exch);
-
-		free(node);
-	}
-}
-
-/** Forget node.
- *
- * This function will remove the node from the node hash table and deallocate
- * its memory, regardless of the node's reference count.
- *
- * @param node	Node to be forgotten.
- */
-void vfs_node_forget(vfs_node_t *node)
-{
-	fibril_mutex_lock(&nodes_mutex);
-	hash_table_remove_item(&nodes, &node->nh_link);
-	fibril_mutex_unlock(&nodes_mutex);
-	free(node);
-}
-
-/** Find VFS node.
- *
- * This function will try to lookup the given triplet in the VFS node hash
- * table. In case the triplet is not found there, a new VFS node is created.
- * In any case, the VFS node will have its reference count incremented. Every
- * node returned by this call should be eventually put back by calling
- * vfs_node_put() on it.
- *
- * @param result	Populated lookup result structure.
- *
- * @return		VFS node corresponding to the given triplet.
- */
-vfs_node_t *vfs_node_get(vfs_lookup_res_t *result)
-{
-	vfs_node_t *node;
-
-	fibril_mutex_lock(&nodes_mutex);
-	ht_link_t *tmp = hash_table_find(&nodes, &result->triplet);
-	if (!tmp) {
-		node = (vfs_node_t *) malloc(sizeof(vfs_node_t));
-		if (!node) {
-			fibril_mutex_unlock(&nodes_mutex);
-			return NULL;
-		}
-		memset(node, 0, sizeof(vfs_node_t));
-		node->fs_handle = result->triplet.fs_handle;
-		node->service_id = result->triplet.service_id;
-		node->index = result->triplet.index;
-		node->size = result->size;
-		node->type = result->type;
-		fibril_rwlock_initialize(&node->contents_rwlock);
-		hash_table_insert(&nodes, &node->nh_link);
-	} else {
-		node = hash_table_get_inst(tmp, vfs_node_t, nh_link);
-	}
-
-	_vfs_node_addref(node);
-	fibril_mutex_unlock(&nodes_mutex);
-
-	return node;
-}
-
-vfs_node_t *vfs_node_peek(vfs_lookup_res_t *result)
-{
-	vfs_node_t *node = NULL;
-
-	fibril_mutex_lock(&nodes_mutex);
-	ht_link_t *tmp = hash_table_find(&nodes, &result->triplet);
-	if (tmp) {
-		node = hash_table_get_inst(tmp, vfs_node_t, nh_link);
-		_vfs_node_addref(node);
-	}
-	fibril_mutex_unlock(&nodes_mutex);
-
-	return node;
-}
-
-/** Return VFS node when no longer needed by the caller.
- *
- * This function will remove the reference on the VFS node created by
- * vfs_node_get(). This function can only be called as a closing bracket to the
- * preceding vfs_node_get() call.
- *
- * @param node		VFS node being released.
- */
-void vfs_node_put(vfs_node_t *node)
-{
-	vfs_node_delref(node);
-}
-
-struct refcnt_data {
-	/** Sum of all reference counts for this file system instance. */
-	unsigned refcnt;
-	fs_handle_t fs_handle;
-	service_id_t service_id;
-};
-
-static bool refcnt_visitor(ht_link_t *item, void *arg)
-{
-	vfs_node_t *node = hash_table_get_inst(item, vfs_node_t, nh_link);
-	struct refcnt_data *rd = (void *) arg;
-
-	if ((node->fs_handle == rd->fs_handle) &&
-	    (node->service_id == rd->service_id))
-		rd->refcnt += node->refcnt;
-
-	return true;
-}
-
-unsigned
-vfs_nodes_refcount_sum_get(fs_handle_t fs_handle, service_id_t service_id)
-{
-	struct refcnt_data rd = {
-		.refcnt = 0,
-		.fs_handle = fs_handle,
-		.service_id = service_id
-	};
-
-	fibril_mutex_lock(&nodes_mutex);
-	hash_table_apply(&nodes, refcnt_visitor, &rd);
-	fibril_mutex_unlock(&nodes_mutex);
-
-	return rd.refcnt;
-}
-
-/** Perform a remote node open operation.
- *
- * @return EOK on success or an error code from errno.h.
- *
- */
-errno_t vfs_open_node_remote(vfs_node_t *node)
-{
-	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-
-	ipc_call_t answer;
-	aid_t req = async_send_2(exch, VFS_OUT_OPEN_NODE,
-	    (sysarg_t) node->service_id, (sysarg_t) node->index, &answer);
-
-	vfs_exchange_release(exch);
-
-	errno_t rc;
-	async_wait_for(req, &rc);
-
-	return rc;
-}
-
-static size_t nodes_key_hash(const void *key)
-{
-	const vfs_triplet_t *tri = key;
-	size_t hash = hash_combine(tri->fs_handle, tri->index);
-	return hash_combine(hash, tri->service_id);
-}
-
-static size_t nodes_hash(const ht_link_t *item)
-{
-	vfs_node_t *node = hash_table_get_inst(item, vfs_node_t, nh_link);
-	vfs_triplet_t tri = node_triplet(node);
-	return nodes_key_hash(&tri);
-}
-
-static bool nodes_key_equal(const void *key, size_t hash, const ht_link_t *item)
-{
-	const vfs_triplet_t *tri = key;
-	vfs_node_t *node = hash_table_get_inst(item, vfs_node_t, nh_link);
-	return node->fs_handle == tri->fs_handle &&
-	    node->service_id == tri->service_id && node->index == tri->index;
-}
-
-static inline vfs_triplet_t node_triplet(vfs_node_t *node)
-{
-	vfs_triplet_t tri = {
-		.fs_handle = node->fs_handle,
-		.service_id = node->service_id,
-		.index = node->index
-	};
-
-	return tri;
-}
-
-bool vfs_node_has_children(vfs_node_t *node)
-{
-	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_req_2_0(exch, VFS_OUT_IS_EMPTY, node->service_id,
-	    node->index);
-	vfs_exchange_release(exch);
-	return rc == ENOTEMPTY;
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,928 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file vfs_ops.c
- * @brief Operations that VFS offers to its clients.
- */
-
-#include "vfs.h"
-#include <macros.h>
-#include <stdint.h>
-#include <async.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <stdbool.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
-#include <ctype.h>
-#include <assert.h>
-#include <vfs/canonify.h>
-
-/* Forward declarations of static functions. */
-static errno_t vfs_truncate_internal(fs_handle_t, service_id_t, fs_index_t,
-    aoff64_t);
-
-/**
- * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
- * concurrent VFS operation which modifies the file system namespace.
- */
-FIBRIL_RWLOCK_INITIALIZE(namespace_rwlock);
-
-static size_t shared_path(char *a, char *b)
-{
-	size_t res = 0;
-
-	while (a[res] == b[res] && a[res] != 0)
-		res++;
-
-	if (a[res] == b[res])
-		return res;
-
-	res--;
-	while (a[res] != '/')
-		res--;
-	return res;
-}
-
-/* This call destroys the file if and only if there are no hard links left. */
-static void out_destroy(vfs_triplet_t *file)
-{
-	async_exch_t *exch = vfs_exchange_grab(file->fs_handle);
-	async_msg_2(exch, VFS_OUT_DESTROY, (sysarg_t) file->service_id,
-	    (sysarg_t) file->index);
-	vfs_exchange_release(exch);
-}
-
-errno_t vfs_op_clone(int oldfd, int newfd, bool desc, int *out_fd)
-{
-	errno_t rc;
-
-	/* Lookup the file structure corresponding to fd. */
-	vfs_file_t *oldfile = vfs_file_get(oldfd);
-	if (oldfile == NULL)
-		return EBADF;
-
-	assert(oldfile->node != NULL);
-
-	/* If the file descriptors are the same, do nothing. */
-	if (oldfd == newfd) {
-		vfs_file_put(oldfile);
-		return EOK;
-	}
-
-	if (newfd != -1) {
-		/* Assign the old file to newfd. */
-		rc = vfs_fd_assign(oldfile, newfd);
-		*out_fd = newfd;
-	} else {
-		vfs_file_t *newfile;
-		rc = vfs_fd_alloc(&newfile, desc, out_fd);
-		if (rc == EOK) {
-			newfile->node = oldfile->node;
-			newfile->permissions = oldfile->permissions;
-			vfs_node_addref(newfile->node);
-
-			vfs_file_put(newfile);
-		}
-	}
-	vfs_file_put(oldfile);
-
-	return rc;
-}
-
-errno_t vfs_op_put(int fd)
-{
-	return vfs_fd_free(fd);
-}
-
-static errno_t vfs_connect_internal(service_id_t service_id, unsigned flags,
-    unsigned instance, const char *options, const char *fsname,
-    vfs_node_t **root)
-{
-	fs_handle_t fs_handle = 0;
-
-	fibril_mutex_lock(&fs_list_lock);
-	while (true) {
-		fs_handle = fs_name_to_handle(instance, fsname, false);
-
-		if (fs_handle != 0 || !(flags & VFS_MOUNT_BLOCKING))
-			break;
-
-		fibril_condvar_wait(&fs_list_cv, &fs_list_lock);
-	}
-	fibril_mutex_unlock(&fs_list_lock);
-
-	if (fs_handle == 0)
-		return ENOFS;
-
-	/* Tell the mountee that it is being mounted. */
-	ipc_call_t answer;
-	async_exch_t *exch = vfs_exchange_grab(fs_handle);
-	aid_t msg = async_send_1(exch, VFS_OUT_MOUNTED, (sysarg_t) service_id,
-	    &answer);
-	/* Send the mount options */
-	errno_t rc = async_data_write_start(exch, options, str_size(options));
-	if (rc != EOK) {
-		async_forget(msg);
-		vfs_exchange_release(exch);
-		return rc;
-	}
-
-	async_wait_for(msg, &rc);
-	if (rc != EOK) {
-		vfs_exchange_release(exch);
-		return rc;
-	}
-
-	vfs_lookup_res_t res;
-	res.triplet.fs_handle = fs_handle;
-	res.triplet.service_id = service_id;
-	res.triplet.index = (fs_index_t) ipc_get_arg1(&answer);
-	res.size = (int64_t) MERGE_LOUP32(ipc_get_arg2(&answer),
-	    ipc_get_arg3(&answer));
-	res.type = VFS_NODE_DIRECTORY;
-
-	/* Add reference to the mounted root. */
-	*root = vfs_node_get(&res);
-	if (!*root) {
-		aid_t msg = async_send_1(exch, VFS_OUT_UNMOUNTED,
-		    (sysarg_t) service_id, NULL);
-		async_forget(msg);
-		vfs_exchange_release(exch);
-		return ENOMEM;
-	}
-
-	vfs_exchange_release(exch);
-
-	return EOK;
-}
-
-errno_t vfs_op_fsprobe(const char *fs_name, service_id_t sid,
-    vfs_fs_probe_info_t *info)
-{
-	fs_handle_t fs_handle = 0;
-	errno_t rc;
-	errno_t retval;
-
-	fibril_mutex_lock(&fs_list_lock);
-	fs_handle = fs_name_to_handle(0, fs_name, false);
-	fibril_mutex_unlock(&fs_list_lock);
-
-	if (fs_handle == 0)
-		return ENOFS;
-
-	/* Send probe request to the file system server */
-	ipc_call_t answer;
-	async_exch_t *exch = vfs_exchange_grab(fs_handle);
-	aid_t msg = async_send_1(exch, VFS_OUT_FSPROBE, (sysarg_t) sid,
-	    &answer);
-	if (msg == 0)
-		return EINVAL;
-
-	/* Read probe information */
-	retval = async_data_read_start(exch, info, sizeof(*info));
-	if (retval != EOK) {
-		async_forget(msg);
-		return retval;
-	}
-
-	async_wait_for(msg, &rc);
-	vfs_exchange_release(exch);
-	return rc;
-}
-
-errno_t vfs_op_mount(int mpfd, unsigned service_id, unsigned flags,
-    unsigned instance, const char *opts, const char *fs_name, int *out_fd)
-{
-	errno_t rc;
-	vfs_file_t *mp = NULL;
-	vfs_file_t *file = NULL;
-	*out_fd = -1;
-
-	if (!(flags & VFS_MOUNT_CONNECT_ONLY)) {
-		mp = vfs_file_get(mpfd);
-		if (mp == NULL) {
-			rc = EBADF;
-			goto out;
-		}
-
-		if (mp->node->mount != NULL) {
-			rc = EBUSY;
-			goto out;
-		}
-
-		if (mp->node->type != VFS_NODE_DIRECTORY) {
-			rc = ENOTDIR;
-			goto out;
-		}
-
-		if (vfs_node_has_children(mp->node)) {
-			rc = ENOTEMPTY;
-			goto out;
-		}
-	}
-
-	if (!(flags & VFS_MOUNT_NO_REF)) {
-		rc = vfs_fd_alloc(&file, false, out_fd);
-		if (rc != EOK) {
-			goto out;
-		}
-	}
-
-	vfs_node_t *root = NULL;
-
-	fibril_rwlock_write_lock(&namespace_rwlock);
-
-	rc = vfs_connect_internal(service_id, flags, instance, opts, fs_name,
-	    &root);
-	if (rc == EOK && !(flags & VFS_MOUNT_CONNECT_ONLY)) {
-		vfs_node_addref(mp->node);
-		vfs_node_addref(root);
-		mp->node->mount = root;
-	}
-
-	fibril_rwlock_write_unlock(&namespace_rwlock);
-
-	if (rc != EOK)
-		goto out;
-
-	if (flags & VFS_MOUNT_NO_REF) {
-		vfs_node_delref(root);
-	} else {
-		assert(file != NULL);
-
-		file->node = root;
-		file->permissions = MODE_READ | MODE_WRITE | MODE_APPEND;
-		file->open_read = false;
-		file->open_write = false;
-	}
-
-out:
-	if (mp)
-		vfs_file_put(mp);
-	if (file)
-		vfs_file_put(file);
-
-	if (rc != EOK && *out_fd >= 0) {
-		vfs_fd_free(*out_fd);
-		*out_fd = -1;
-	}
-
-	return rc;
-}
-
-errno_t vfs_op_open(int fd, int mode)
-{
-	if (mode == 0)
-		return EINVAL;
-
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	if ((mode & ~file->permissions) != 0) {
-		vfs_file_put(file);
-		return EPERM;
-	}
-
-	if (file->open_read || file->open_write) {
-		vfs_file_put(file);
-		return EBUSY;
-	}
-
-	file->open_read = (mode & MODE_READ) != 0;
-	file->open_write = (mode & (MODE_WRITE | MODE_APPEND)) != 0;
-	file->append = (mode & MODE_APPEND) != 0;
-
-	if (!file->open_read && !file->open_write) {
-		vfs_file_put(file);
-		return EINVAL;
-	}
-
-	if (file->node->type == VFS_NODE_DIRECTORY && file->open_write) {
-		file->open_read = file->open_write = false;
-		vfs_file_put(file);
-		return EINVAL;
-	}
-
-	errno_t rc = vfs_open_node_remote(file->node);
-	if (rc != EOK) {
-		file->open_read = file->open_write = false;
-		vfs_file_put(file);
-		return rc;
-	}
-
-	vfs_file_put(file);
-	return EOK;
-}
-
-typedef errno_t (*rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, aoff64_t,
-    ipc_call_t *, bool, void *);
-
-static errno_t rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
-    ipc_call_t *answer, bool read, void *data)
-{
-	size_t *bytes = (size_t *) data;
-	errno_t rc;
-
-	/*
-	 * Make a VFS_READ/VFS_WRITE request at the destination FS server
-	 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the
-	 * destination FS server. The call will be routed as if sent by
-	 * ourselves. Note that call arguments are immutable in this case so we
-	 * don't have to bother.
-	 */
-
-	if (read) {
-		rc = async_data_read_forward_4_1(exch, VFS_OUT_READ,
-		    file->node->service_id, file->node->index,
-		    LOWER32(pos), UPPER32(pos), answer);
-	} else {
-		rc = async_data_write_forward_4_1(exch, VFS_OUT_WRITE,
-		    file->node->service_id, file->node->index,
-		    LOWER32(pos), UPPER32(pos), answer);
-	}
-
-	*bytes = ipc_get_arg1(answer);
-	return rc;
-}
-
-static errno_t rdwr_ipc_internal(async_exch_t *exch, vfs_file_t *file, aoff64_t pos,
-    ipc_call_t *answer, bool read, void *data)
-{
-	rdwr_io_chunk_t *chunk = (rdwr_io_chunk_t *) data;
-
-	if (exch == NULL)
-		return ENOENT;
-
-	aid_t msg = async_send_4(exch, read ? VFS_OUT_READ : VFS_OUT_WRITE,
-	    file->node->service_id, file->node->index, LOWER32(pos),
-	    UPPER32(pos), answer);
-	if (msg == 0)
-		return EINVAL;
-
-	errno_t retval = async_data_read_start(exch, chunk->buffer, chunk->size);
-	if (retval != EOK) {
-		async_forget(msg);
-		return retval;
-	}
-
-	errno_t rc;
-	async_wait_for(msg, &rc);
-
-	chunk->size = ipc_get_arg1(answer);
-
-	return (errno_t) rc;
-}
-
-static errno_t vfs_rdwr(int fd, aoff64_t pos, bool read, rdwr_ipc_cb_t ipc_cb,
-    void *ipc_cb_data)
-{
-	/*
-	 * The following code strongly depends on the fact that the files data
-	 * structure can be only accessed by a single fibril and all file
-	 * operations are serialized (i.e. the reads and writes cannot
-	 * interleave and a file cannot be closed while it is being read).
-	 *
-	 * Additional synchronization needs to be added once the table of
-	 * open files supports parallel access!
-	 */
-
-	/* Lookup the file structure corresponding to the file descriptor. */
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	if ((read && !file->open_read) || (!read && !file->open_write)) {
-		vfs_file_put(file);
-		return EINVAL;
-	}
-
-	vfs_info_t *fs_info = fs_handle_to_info(file->node->fs_handle);
-	assert(fs_info);
-
-	bool rlock = read ||
-	    (fs_info->concurrent_read_write && fs_info->write_retains_size);
-
-	/*
-	 * Lock the file's node so that no other client can read/write to it at
-	 * the same time unless the FS supports concurrent reads/writes and its
-	 * write implementation does not modify the file size.
-	 */
-	if (rlock)
-		fibril_rwlock_read_lock(&file->node->contents_rwlock);
-	else
-		fibril_rwlock_write_lock(&file->node->contents_rwlock);
-
-	if (file->node->type == VFS_NODE_DIRECTORY) {
-		/*
-		 * Make sure that no one is modifying the namespace
-		 * while we are in readdir().
-		 */
-
-		if (!read) {
-			if (rlock) {
-				fibril_rwlock_read_unlock(
-				    &file->node->contents_rwlock);
-			} else {
-				fibril_rwlock_write_unlock(
-				    &file->node->contents_rwlock);
-			}
-			vfs_file_put(file);
-			return EINVAL;
-		}
-
-		fibril_rwlock_read_lock(&namespace_rwlock);
-	}
-
-	async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle);
-
-	if (!read && file->append)
-		pos = file->node->size;
-
-	/*
-	 * Handle communication with the endpoint FS.
-	 */
-	ipc_call_t answer;
-	errno_t rc = ipc_cb(fs_exch, file, pos, &answer, read, ipc_cb_data);
-
-	vfs_exchange_release(fs_exch);
-
-	if (file->node->type == VFS_NODE_DIRECTORY)
-		fibril_rwlock_read_unlock(&namespace_rwlock);
-
-	/* Unlock the VFS node. */
-	if (rlock) {
-		fibril_rwlock_read_unlock(&file->node->contents_rwlock);
-	} else {
-		/* Update the cached version of node's size. */
-		if (rc == EOK) {
-			file->node->size = MERGE_LOUP32(ipc_get_arg2(&answer),
-			    ipc_get_arg3(&answer));
-		}
-		fibril_rwlock_write_unlock(&file->node->contents_rwlock);
-	}
-
-	vfs_file_put(file);
-
-	return rc;
-}
-
-errno_t vfs_rdwr_internal(int fd, aoff64_t pos, bool read, rdwr_io_chunk_t *chunk)
-{
-	return vfs_rdwr(fd, pos, read, rdwr_ipc_internal, chunk);
-}
-
-errno_t vfs_op_read(int fd, aoff64_t pos, size_t *out_bytes)
-{
-	return vfs_rdwr(fd, pos, true, rdwr_ipc_client, out_bytes);
-}
-
-errno_t vfs_op_rename(int basefd, char *old, char *new)
-{
-	vfs_file_t *base_file = vfs_file_get(basefd);
-	if (!base_file)
-		return EBADF;
-
-	vfs_node_t *base = base_file->node;
-	vfs_node_addref(base);
-	vfs_file_put(base_file);
-
-	vfs_lookup_res_t base_lr;
-	vfs_lookup_res_t old_lr;
-	vfs_lookup_res_t new_lr_orig;
-	bool orig_unlinked = false;
-
-	errno_t rc;
-
-	size_t shared = shared_path(old, new);
-
-	/* Do not allow one path to be a prefix of the other. */
-	if (old[shared] == 0 || new[shared] == 0) {
-		vfs_node_put(base);
-		return EINVAL;
-	}
-	assert(old[shared] == '/');
-	assert(new[shared] == '/');
-
-	fibril_rwlock_write_lock(&namespace_rwlock);
-
-	/* Resolve the shared portion of the path first. */
-	if (shared != 0) {
-		old[shared] = 0;
-		rc = vfs_lookup_internal(base, old, L_DIRECTORY, &base_lr);
-		if (rc != EOK) {
-			vfs_node_put(base);
-			fibril_rwlock_write_unlock(&namespace_rwlock);
-			return rc;
-		}
-
-		vfs_node_put(base);
-		base = vfs_node_get(&base_lr);
-		if (!base) {
-			fibril_rwlock_write_unlock(&namespace_rwlock);
-			return ENOMEM;
-		}
-		old[shared] = '/';
-		old += shared;
-		new += shared;
-	}
-
-	rc = vfs_lookup_internal(base, old, L_DISABLE_MOUNTS, &old_lr);
-	if (rc != EOK) {
-		vfs_node_put(base);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return rc;
-	}
-
-	rc = vfs_lookup_internal(base, new, L_UNLINK | L_DISABLE_MOUNTS,
-	    &new_lr_orig);
-	if (rc == EOK) {
-		orig_unlinked = true;
-	} else if (rc != ENOENT) {
-		vfs_node_put(base);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return rc;
-	}
-
-	rc = vfs_link_internal(base, new, &old_lr.triplet);
-	if (rc != EOK) {
-		vfs_link_internal(base, old, &old_lr.triplet);
-		if (orig_unlinked)
-			vfs_link_internal(base, new, &new_lr_orig.triplet);
-		vfs_node_put(base);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return rc;
-	}
-
-	rc = vfs_lookup_internal(base, old, L_UNLINK | L_DISABLE_MOUNTS,
-	    &old_lr);
-	if (rc != EOK) {
-		if (orig_unlinked)
-			vfs_link_internal(base, new, &new_lr_orig.triplet);
-		vfs_node_put(base);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return rc;
-	}
-
-	/* If the node is not held by anyone, try to destroy it. */
-	if (orig_unlinked) {
-		vfs_node_t *node = vfs_node_peek(&new_lr_orig);
-		if (!node)
-			out_destroy(&new_lr_orig.triplet);
-		else
-			vfs_node_put(node);
-	}
-
-	vfs_node_put(base);
-	fibril_rwlock_write_unlock(&namespace_rwlock);
-	return EOK;
-}
-
-errno_t vfs_op_resize(int fd, int64_t size)
-{
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	if (!file->open_write || file->node->type != VFS_NODE_FILE) {
-		vfs_file_put(file);
-		return EINVAL;
-	}
-
-	fibril_rwlock_write_lock(&file->node->contents_rwlock);
-
-	errno_t rc = vfs_truncate_internal(file->node->fs_handle,
-	    file->node->service_id, file->node->index, size);
-	if (rc == EOK)
-		file->node->size = size;
-
-	fibril_rwlock_write_unlock(&file->node->contents_rwlock);
-	vfs_file_put(file);
-	return rc;
-}
-
-errno_t vfs_op_stat(int fd)
-{
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	vfs_node_t *node = file->node;
-
-	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_data_read_forward_3_0(exch, VFS_OUT_STAT,
-	    node->service_id, node->index, true);
-	vfs_exchange_release(exch);
-
-	vfs_file_put(file);
-	return rc;
-}
-
-errno_t vfs_op_statfs(int fd)
-{
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	vfs_node_t *node = file->node;
-
-	async_exch_t *exch = vfs_exchange_grab(node->fs_handle);
-	errno_t rc = async_data_read_forward_3_0(exch, VFS_OUT_STATFS,
-	    node->service_id, node->index, false);
-	vfs_exchange_release(exch);
-
-	vfs_file_put(file);
-	return rc;
-}
-
-errno_t vfs_op_sync(int fd)
-{
-	vfs_file_t *file = vfs_file_get(fd);
-	if (!file)
-		return EBADF;
-
-	async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle);
-
-	aid_t msg;
-	ipc_call_t answer;
-	msg = async_send_2(fs_exch, VFS_OUT_SYNC, file->node->service_id,
-	    file->node->index, &answer);
-
-	vfs_exchange_release(fs_exch);
-
-	errno_t rc;
-	async_wait_for(msg, &rc);
-
-	vfs_file_put(file);
-	return rc;
-
-}
-
-static errno_t vfs_truncate_internal(fs_handle_t fs_handle, service_id_t service_id,
-    fs_index_t index, aoff64_t size)
-{
-	async_exch_t *exch = vfs_exchange_grab(fs_handle);
-	errno_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
-	    (sysarg_t) service_id, (sysarg_t) index, LOWER32(size),
-	    UPPER32(size));
-	vfs_exchange_release(exch);
-
-	return (errno_t) rc;
-}
-
-errno_t vfs_op_unlink(int parentfd, int expectfd, char *path)
-{
-	errno_t rc = EOK;
-	vfs_file_t *parent = NULL;
-	vfs_file_t *expect = NULL;
-
-	if (parentfd == expectfd)
-		return EINVAL;
-
-	fibril_rwlock_write_lock(&namespace_rwlock);
-
-	/*
-	 * Files are retrieved in order of file descriptors, to prevent
-	 * deadlock.
-	 */
-	if (parentfd < expectfd) {
-		parent = vfs_file_get(parentfd);
-		if (!parent) {
-			rc = EBADF;
-			goto exit;
-		}
-	}
-
-	if (expectfd >= 0) {
-		expect = vfs_file_get(expectfd);
-		if (!expect) {
-			rc = EBADF;
-			goto exit;
-		}
-	}
-
-	if (parentfd > expectfd) {
-		parent = vfs_file_get(parentfd);
-		if (!parent) {
-			rc = EBADF;
-			goto exit;
-		}
-	}
-
-	assert(parent != NULL);
-
-	if (expectfd >= 0) {
-		vfs_lookup_res_t lr;
-		rc = vfs_lookup_internal(parent->node, path, 0, &lr);
-		if (rc != EOK)
-			goto exit;
-
-		vfs_node_t *found_node = vfs_node_peek(&lr);
-		vfs_node_put(found_node);
-		if (expect->node != found_node) {
-			rc = ENOENT;
-			goto exit;
-		}
-
-		vfs_file_put(expect);
-		expect = NULL;
-	}
-
-	vfs_lookup_res_t lr;
-	rc = vfs_lookup_internal(parent->node, path, L_UNLINK, &lr);
-	if (rc != EOK)
-		goto exit;
-
-	/* If the node is not held by anyone, try to destroy it. */
-	vfs_node_t *node = vfs_node_peek(&lr);
-	if (!node)
-		out_destroy(&lr.triplet);
-	else
-		vfs_node_put(node);
-
-exit:
-	if (path)
-		free(path);
-	if (parent)
-		vfs_file_put(parent);
-	if (expect)
-		vfs_file_put(expect);
-	fibril_rwlock_write_unlock(&namespace_rwlock);
-	return rc;
-}
-
-errno_t vfs_op_unmount(int mpfd)
-{
-	vfs_file_t *mp = vfs_file_get(mpfd);
-	if (mp == NULL)
-		return EBADF;
-
-	if (mp->node->mount == NULL) {
-		vfs_file_put(mp);
-		return ENOENT;
-	}
-
-	fibril_rwlock_write_lock(&namespace_rwlock);
-
-	/*
-	 * Count the total number of references for the mounted file system. We
-	 * are expecting at least one, which is held by the mount point.
-	 * If we find more, it means that
-	 * the file system cannot be gracefully unmounted at the moment because
-	 * someone is working with it.
-	 */
-	if (vfs_nodes_refcount_sum_get(mp->node->mount->fs_handle,
-	    mp->node->mount->service_id) != 1) {
-		vfs_file_put(mp);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return EBUSY;
-	}
-
-	async_exch_t *exch = vfs_exchange_grab(mp->node->mount->fs_handle);
-	errno_t rc = async_req_1_0(exch, VFS_OUT_UNMOUNTED,
-	    mp->node->mount->service_id);
-	vfs_exchange_release(exch);
-
-	if (rc != EOK) {
-		vfs_file_put(mp);
-		fibril_rwlock_write_unlock(&namespace_rwlock);
-		return rc;
-	}
-
-	vfs_node_forget(mp->node->mount);
-	vfs_node_put(mp->node);
-	mp->node->mount = NULL;
-
-	fibril_rwlock_write_unlock(&namespace_rwlock);
-
-	vfs_file_put(mp);
-	return EOK;
-}
-
-errno_t vfs_op_wait_handle(bool high_fd, int *out_fd)
-{
-	return vfs_wait_handle_internal(high_fd, out_fd);
-}
-
-static inline bool walk_flags_valid(int flags)
-{
-	if ((flags & ~WALK_ALL_FLAGS) != 0)
-		return false;
-	if ((flags & WALK_MAY_CREATE) && (flags & WALK_MUST_CREATE))
-		return false;
-	if ((flags & WALK_REGULAR) && (flags & WALK_DIRECTORY))
-		return false;
-	if ((flags & WALK_MAY_CREATE) || (flags & WALK_MUST_CREATE)) {
-		if (!(flags & WALK_DIRECTORY) && !(flags & WALK_REGULAR))
-			return false;
-	}
-	return true;
-}
-
-static inline int walk_lookup_flags(int flags)
-{
-	int lflags = 0;
-	if ((flags & WALK_MAY_CREATE) || (flags & WALK_MUST_CREATE))
-		lflags |= L_CREATE;
-	if (flags & WALK_MUST_CREATE)
-		lflags |= L_EXCLUSIVE;
-	if (flags & WALK_REGULAR)
-		lflags |= L_FILE;
-	if (flags & WALK_DIRECTORY)
-		lflags |= L_DIRECTORY;
-	if (flags & WALK_MOUNT_POINT)
-		lflags |= L_MP;
-	return lflags;
-}
-
-errno_t vfs_op_walk(int parentfd, int flags, char *path, int *out_fd)
-{
-	if (!walk_flags_valid(flags))
-		return EINVAL;
-
-	vfs_file_t *parent = vfs_file_get(parentfd);
-	if (!parent)
-		return EBADF;
-
-	fibril_rwlock_read_lock(&namespace_rwlock);
-
-	vfs_lookup_res_t lr;
-	errno_t rc = vfs_lookup_internal(parent->node, path,
-	    walk_lookup_flags(flags), &lr);
-	if (rc != EOK) {
-		fibril_rwlock_read_unlock(&namespace_rwlock);
-		vfs_file_put(parent);
-		return rc;
-	}
-
-	vfs_node_t *node = vfs_node_get(&lr);
-	if (!node) {
-		fibril_rwlock_read_unlock(&namespace_rwlock);
-		vfs_file_put(parent);
-		return ENOMEM;
-	}
-
-	vfs_file_t *file;
-	rc = vfs_fd_alloc(&file, false, out_fd);
-	if (rc != EOK) {
-		fibril_rwlock_read_unlock(&namespace_rwlock);
-		vfs_node_put(node);
-		vfs_file_put(parent);
-		return rc;
-	}
-	assert(file != NULL);
-
-	file->node = node;
-	file->permissions = parent->permissions;
-	file->open_read = false;
-	file->open_write = false;
-
-	vfs_file_put(file);
-	vfs_file_put(parent);
-
-	fibril_rwlock_read_unlock(&namespace_rwlock);
-
-	return EOK;
-}
-
-errno_t vfs_op_write(int fd, aoff64_t pos, size_t *out_bytes)
-{
-	return vfs_rdwr(fd, pos, false, rdwr_ipc_client, out_bytes);
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_pager.c
===================================================================
--- uspace/srv/vfs/vfs_pager.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,93 +1,0 @@
-/*
- * Copyright (c) 2016 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file vfs_pager.c
- * @brief VFS pager operations.
- */
-
-#include "vfs.h"
-#include <async.h>
-#include <fibril_synch.h>
-#include <errno.h>
-#include <as.h>
-
-void vfs_page_in(ipc_call_t *req)
-{
-	aoff64_t offset = ipc_get_arg1(req);
-	size_t page_size = ipc_get_arg2(req);
-	int fd = ipc_get_arg3(req);
-	void *page;
-	errno_t rc;
-
-	page = as_area_create(AS_AREA_ANY, page_size,
-	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE,
-	    AS_AREA_UNPAGED);
-
-	if (page == AS_MAP_FAILED) {
-		async_answer_0(req, ENOMEM);
-		return;
-	}
-
-	rdwr_io_chunk_t chunk = {
-		.buffer = page,
-		.size = page_size
-	};
-
-	size_t total = 0;
-	aoff64_t pos = offset;
-	do {
-		rc = vfs_rdwr_internal(fd, pos, true, &chunk);
-		if (rc != EOK)
-			break;
-		if (chunk.size == 0)
-			break;
-		total += chunk.size;
-		pos += chunk.size;
-		chunk.buffer += chunk.size;
-		chunk.size = page_size - total;
-	} while (total < page_size);
-
-	async_answer_1(req, rc, (sysarg_t) page);
-
-	/*
-	 * FIXME:
-	 * This is just for now until we implement proper page cache
-	 * management.  Not keeping the pages around in a cache results in
-	 * inherently non-coherent private mappings.
-	 */
-	as_area_destroy(page);
-}
-
-/**
- * @}
- */
Index: pace/srv/vfs/vfs_register.c
===================================================================
--- uspace/srv/vfs/vfs_register.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,397 +1,0 @@
-/*
- * Copyright (c) 2008 Jakub Jermar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup vfs
- * @{
- */
-
-/**
- * @file vfs_register.c
- * @brief
- */
-
-#include <ipc/services.h>
-#include <async.h>
-#include <fibril.h>
-#include <fibril_synch.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <stdbool.h>
-#include <adt/list.h>
-#include <as.h>
-#include <assert.h>
-#include <stdatomic.h>
-#include <vfs/vfs.h>
-#include "vfs.h"
-
-FIBRIL_CONDVAR_INITIALIZE(fs_list_cv);
-FIBRIL_MUTEX_INITIALIZE(fs_list_lock);
-LIST_INITIALIZE(fs_list);
-
-static atomic_int fs_handle_next = 1;
-
-/** Verify the VFS info structure.
- *
- * @param info Info structure to be verified.
- *
- * @return Non-zero if the info structure is sane, zero otherwise.
- *
- */
-static bool vfs_info_sane(vfs_info_t *info)
-{
-	int i;
-
-	/*
-	 * Check if the name is non-empty and is composed solely of ASCII
-	 * characters [a-z]+[a-z0-9_-]*.
-	 */
-	if (!islower(info->name[0])) {
-		dprintf("The name doesn't start with a lowercase character.\n");
-		return false;
-	}
-
-	for (i = 1; i < FS_NAME_MAXLEN; i++) {
-		if (!(islower(info->name[i]) || isdigit(info->name[i])) &&
-		    (info->name[i] != '-') && (info->name[i] != '_')) {
-			if (info->name[i] == '\0') {
-				break;
-			} else {
-				dprintf("The name contains illegal "
-				    "characters.\n");
-				return false;
-			}
-		}
-	}
-
-	/*
-	 * This check is not redundant. It ensures that the name is
-	 * NULL-terminated, even if FS_NAME_MAXLEN characters are used.
-	 */
-	if (info->name[i] != '\0') {
-		dprintf("The name is not properly NULL-terminated.\n");
-		return false;
-	}
-
-	return true;
-}
-
-/** VFS_REGISTER protocol function.
- *
- * @param req Call structure with the request.
- *
- */
-void vfs_register(ipc_call_t *req)
-{
-	vfs_info_t *vfs_info;
-	errno_t rc = async_data_write_accept((void **) &vfs_info, false,
-	    sizeof(vfs_info_t), sizeof(vfs_info_t), 0, NULL);
-
-	if (rc != EOK) {
-		dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n",
-		    rc);
-		async_answer_0(req, rc);
-		return;
-	}
-
-	/*
-	 * Allocate and initialize a buffer for the fs_info structure.
-	 */
-	fs_info_t *fs_info = (fs_info_t *) malloc(sizeof(fs_info_t));
-	if (!fs_info) {
-		dprintf("Could not allocate memory for FS info.\n");
-		async_answer_0(req, ENOMEM);
-		return;
-	}
-
-	link_initialize(&fs_info->fs_link);
-	fs_info->vfs_info = *vfs_info;
-	free(vfs_info);
-
-	dprintf("VFS info delivered.\n");
-
-	if (!vfs_info_sane(&fs_info->vfs_info)) {
-		free(fs_info);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	fibril_mutex_lock(&fs_list_lock);
-
-	/*
-	 * Check for duplicit registrations.
-	 */
-	if (fs_name_to_handle(fs_info->vfs_info.instance,
-	    fs_info->vfs_info.name, false)) {
-		/*
-		 * We already register a fs like this.
-		 */
-		dprintf("FS is already registered.\n");
-		fibril_mutex_unlock(&fs_list_lock);
-		free(fs_info);
-		async_answer_0(req, EEXIST);
-		return;
-	}
-
-	/*
-	 * Add fs_info to the list of registered FS's.
-	 */
-	dprintf("Inserting FS into the list of registered file systems.\n");
-	list_append(&fs_info->fs_link, &fs_list);
-
-	/*
-	 * Now we want the client to send us the IPC_M_CONNECT_TO_ME call so
-	 * that a callback connection is created and we have a phone through
-	 * which to forward VFS requests to it.
-	 */
-	fs_info->sess = async_callback_receive(EXCHANGE_PARALLEL);
-	if (!fs_info->sess) {
-		dprintf("Callback connection expected\n");
-		list_remove(&fs_info->fs_link);
-		fibril_mutex_unlock(&fs_list_lock);
-		free(fs_info);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	/* FIXME: Work around problem with callback sessions */
-	async_sess_args_set(fs_info->sess, INTERFACE_VFS_DRIVER_CB, 0, 0);
-
-	dprintf("Callback connection to FS created.\n");
-
-	/*
-	 * The client will want us to send him the address space area with PLB.
-	 */
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_share_in_receive(&call, &size)) {
-		dprintf("Unexpected call\n");
-		list_remove(&fs_info->fs_link);
-		fibril_mutex_unlock(&fs_list_lock);
-		async_hangup(fs_info->sess);
-		free(fs_info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	/*
-	 * We can only send the client address space area PLB_SIZE bytes long.
-	 */
-	if (size != PLB_SIZE) {
-		dprintf("Client suggests wrong size of PFB, size = %zu\n", size);
-		list_remove(&fs_info->fs_link);
-		fibril_mutex_unlock(&fs_list_lock);
-		async_hangup(fs_info->sess);
-		free(fs_info);
-		async_answer_0(&call, EINVAL);
-		async_answer_0(req, EINVAL);
-		return;
-	}
-
-	/*
-	 * Commit to read-only sharing the PLB with the client.
-	 */
-	(void) async_share_in_finalize(&call, plb,
-	    AS_AREA_READ | AS_AREA_CACHEABLE);
-
-	dprintf("Sharing PLB.\n");
-
-	/*
-	 * That was it. The FS has been registered.
-	 * In reply to the VFS_REGISTER request, we assign the client file
-	 * system a global file system handle.
-	 */
-	fs_info->fs_handle = atomic_fetch_add(&fs_handle_next, 1);
-	async_answer_1(req, EOK, (sysarg_t) fs_info->fs_handle);
-
-	fibril_condvar_broadcast(&fs_list_cv);
-	fibril_mutex_unlock(&fs_list_lock);
-
-	dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n",
-	    FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle);
-}
-
-/** Begin an exchange for a given file system handle
- *
- * @param handle File system handle.
- *
- * @return Exchange for a multi-call request.
- * @return NULL if no such file exists.
- *
- */
-async_exch_t *vfs_exchange_grab(fs_handle_t handle)
-{
-	/*
-	 * For now, we don't try to be very clever and very fast.
-	 * We simply lookup the session in fs_list and
-	 * begin an exchange.
-	 */
-	fibril_mutex_lock(&fs_list_lock);
-
-	list_foreach(fs_list, fs_link, fs_info_t, fs) {
-		if (fs->fs_handle == handle) {
-			fibril_mutex_unlock(&fs_list_lock);
-
-			assert(fs->sess);
-			async_exch_t *exch = async_exchange_begin(fs->sess);
-
-			assert(exch);
-			return exch;
-		}
-	}
-
-	fibril_mutex_unlock(&fs_list_lock);
-
-	return NULL;
-}
-
-/** End VFS server exchange.
- *
- * @param exch   VFS server exchange.
- *
- */
-void vfs_exchange_release(async_exch_t *exch)
-{
-	async_exchange_end(exch);
-}
-
-/** Convert file system name to its handle.
- *
- * @param name File system name.
- * @param lock If true, the function will lock and unlock the
- *             fs_list_lock.
- *
- * @return File system handle or zero if file system not found.
- *
- */
-fs_handle_t fs_name_to_handle(unsigned int instance, const char *name, bool lock)
-{
-	int handle = 0;
-
-	if (lock)
-		fibril_mutex_lock(&fs_list_lock);
-
-	list_foreach(fs_list, fs_link, fs_info_t, fs) {
-		if (str_cmp(fs->vfs_info.name, name) == 0 &&
-		    instance == fs->vfs_info.instance) {
-			handle = fs->fs_handle;
-			break;
-		}
-	}
-
-	if (lock)
-		fibril_mutex_unlock(&fs_list_lock);
-
-	return handle;
-}
-
-/** Find the VFS info structure.
- *
- * @param handle FS handle for which the VFS info structure is sought.
- *
- * @return VFS info structure on success or NULL otherwise.
- *
- */
-vfs_info_t *fs_handle_to_info(fs_handle_t handle)
-{
-	vfs_info_t *info = NULL;
-
-	fibril_mutex_lock(&fs_list_lock);
-	list_foreach(fs_list, fs_link, fs_info_t, fs) {
-		if (fs->fs_handle == handle) {
-			info = &fs->vfs_info;
-			break;
-		}
-	}
-	fibril_mutex_unlock(&fs_list_lock);
-
-	return info;
-}
-
-/** Get list of file system types.
- *
- * @param fstypes Place to store list of file system types. Free using
- *                vfs_fstypes_free().
- *
- * @return EOK on success or an error code
- */
-errno_t vfs_get_fstypes(vfs_fstypes_t *fstypes)
-{
-	size_t size;
-	size_t count;
-	size_t l;
-
-	fibril_mutex_lock(&fs_list_lock);
-
-	size = 0;
-	count = 0;
-	list_foreach(fs_list, fs_link, fs_info_t, fs) {
-		size += str_size(fs->vfs_info.name) + 1;
-		count++;
-	}
-
-	if (size == 0)
-		size = 1;
-
-	fstypes->buf = calloc(1, size);
-	if (fstypes->buf == NULL) {
-		fibril_mutex_unlock(&fs_list_lock);
-		return ENOMEM;
-	}
-
-	fstypes->fstypes = calloc(count, sizeof(char *));
-	if (fstypes->fstypes == NULL) {
-		free(fstypes->buf);
-		fstypes->buf = NULL;
-		fibril_mutex_unlock(&fs_list_lock);
-		return ENOMEM;
-	}
-
-	fstypes->size = size;
-
-	size = 0;
-	count = 0;
-	list_foreach(fs_list, fs_link, fs_info_t, fs) {
-		l = str_size(fs->vfs_info.name) + 1;
-		memcpy(fstypes->buf + size, fs->vfs_info.name, l);
-		fstypes->fstypes[count] = &fstypes->buf[size];
-		size += l;
-		count++;
-	}
-
-	fibril_mutex_unlock(&fs_list_lock);
-	return EOK;
-}
-
-/**
- * @}
- */
Index: pace/srv/volsrv/doc/doxygroups.h
===================================================================
--- uspace/srv/volsrv/doc/doxygroups.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,4 +1,0 @@
-/** @addtogroup volsrv volsrv
- * @ingroup srvs
- * @brief Volume service
- */
Index: pace/srv/volsrv/empty.c
===================================================================
--- uspace/srv/volsrv/empty.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,130 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Empty partition handling
- * @brief
- */
-
-#include <block.h>
-#include <errno.h>
-#include <io/log.h>
-#include <label/empty.h>
-#include <loc.h>
-#include <stdlib.h>
-
-#include "empty.h"
-
-static errno_t empty_get_bsize(void *, size_t *);
-static errno_t empty_get_nblocks(void *, aoff64_t *);
-static errno_t empty_read(void *, aoff64_t, size_t, void *);
-static errno_t empty_write(void *, aoff64_t, size_t, const void *);
-
-/** Provide disk access to liblabel */
-static label_bd_ops_t empty_bd_ops = {
-	.get_bsize = empty_get_bsize,
-	.get_nblocks = empty_get_nblocks,
-	.read = empty_read,
-	.write = empty_write
-};
-
-errno_t volsrv_part_is_empty(service_id_t sid, bool *rempty)
-{
-	errno_t rc;
-	label_bd_t lbd;
-
-	rc = block_init(sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error opening "
-		    "block device service %zu", sid);
-		return EIO;
-	}
-
-	lbd.ops = &empty_bd_ops;
-	lbd.arg = (void *)&sid;
-
-	rc = label_bd_is_empty(&lbd, rempty);
-
-	block_fini(sid);
-	return rc;
-}
-
-errno_t volsrv_part_empty(service_id_t sid)
-{
-	errno_t rc;
-	label_bd_t lbd;
-
-	rc = block_init(sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error opening "
-		    "block device service %zu", sid);
-		return EIO;
-	}
-
-	lbd.ops = &empty_bd_ops;
-	lbd.arg = (void *)&sid;
-
-	rc = label_bd_empty(&lbd);
-
-	block_fini(sid);
-	return rc;
-}
-
-/** Get block size wrapper for liblabel */
-static errno_t empty_get_bsize(void *arg, size_t *bsize)
-{
-	service_id_t svc_id = *(service_id_t *)arg;
-	return block_get_bsize(svc_id, bsize);
-}
-
-/** Get number of blocks wrapper for liblabel */
-static errno_t empty_get_nblocks(void *arg, aoff64_t *nblocks)
-{
-	service_id_t svc_id = *(service_id_t *)arg;
-	return block_get_nblocks(svc_id, nblocks);
-}
-
-/** Read blocks wrapper for liblabel */
-static errno_t empty_read(void *arg, aoff64_t ba, size_t cnt, void *buf)
-{
-	service_id_t svc_id = *(service_id_t *)arg;
-	return block_read_direct(svc_id, ba, cnt, buf);
-}
-
-/** Write blocks wrapper for liblabel */
-static errno_t empty_write(void *arg, aoff64_t ba, size_t cnt, const void *data)
-{
-	service_id_t svc_id = *(service_id_t *)arg;
-	return block_write_direct(svc_id, ba, cnt, data);
-}
-
-/** @}
- */
Index: pace/srv/volsrv/empty.h
===================================================================
--- uspace/srv/volsrv/empty.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef EMPTY_H_
-#define EMPTY_H_
-
-#include <loc.h>
-
-extern errno_t volsrv_part_is_empty(service_id_t, bool *);
-extern errno_t volsrv_part_empty(service_id_t);
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/meson.build
===================================================================
--- uspace/srv/volsrv/meson.build	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2025 Jiri Svoboda
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-deps = [ 'block', 'device', 'label', 'sif' ]
-
-src = files(
-	'empty.c',
-	'mkfs.c',
-	'part.c',
-	'volsrv.c',
-	'volume.c',
-)
-
-test_src = files(
-	'volume.c',
-	'test/main.c',
-	'test/volume.c',
-)
Index: pace/srv/volsrv/mkfs.c
===================================================================
--- uspace/srv/volsrv/mkfs.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,161 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Filesystem creation
- * @brief
- */
-
-#include <errno.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <task.h>
-#include <types/vol.h>
-
-#include "mkfs.h"
-
-static errno_t cmd_runl(const char *path, ...)
-{
-	va_list ap;
-	const char *arg;
-	int cnt = 0;
-
-	va_start(ap, path);
-	do {
-		arg = va_arg(ap, const char *);
-		cnt++;
-	} while (arg != NULL);
-	va_end(ap);
-
-	va_start(ap, path);
-	task_id_t id;
-	task_wait_t wait;
-	errno_t rc = task_spawn(&id, &wait, path, cnt, ap);
-	va_end(ap);
-
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error spawning %s (%s)",
-		    path, str_error(rc));
-		return rc;
-	}
-
-	if (!id) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error spawning %s "
-		    "(invalid task ID)", path);
-		return EINVAL;
-	}
-
-	task_exit_t texit;
-	int retval;
-	rc = task_wait(&wait, &texit, &retval);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error waiting for %s (%s)",
-		    path, str_error(rc));
-		return rc;
-	}
-
-	if (texit != TASK_EXIT_NORMAL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Command %s unexpectedly "
-		    "terminated", path);
-		return EINVAL;
-	}
-
-	if (retval != 0) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Command %s returned non-zero "
-		    "exit code %d)", path, retval);
-	}
-
-	return retval == 0 ? EOK : EPARTY;
-}
-
-errno_t volsrv_part_mkfs(service_id_t sid, vol_fstype_t fstype, const char *label)
-{
-	const char *cmd;
-	char *svc_name;
-	errno_t rc;
-
-	cmd = NULL;
-	switch (fstype) {
-	case fs_exfat:
-		cmd = "/app/mkexfat";
-		break;
-	case fs_fat:
-		cmd = "/app/mkfat";
-		break;
-	case fs_minix:
-		cmd = "/app/mkmfs";
-		break;
-	case fs_ext4:
-		cmd = "/app/mkext4";
-		break;
-	case fs_cdfs:
-		cmd = NULL;
-		break;
-	}
-
-	if (cmd == NULL)
-		return ENOTSUP;
-
-	rc = loc_service_get_name(sid, &svc_name);
-	if (rc != EOK)
-		return rc;
-
-	if (str_size(label) > 0)
-		rc = cmd_runl(cmd, cmd, "--label", label, svc_name, NULL);
-	else
-		rc = cmd_runl(cmd, cmd, svc_name, NULL);
-
-	free(svc_name);
-	return rc;
-}
-
-void volsrv_part_get_lsupp(vol_fstype_t fstype, vol_label_supp_t *vlsupp)
-{
-	vlsupp->supported = false;
-
-	switch (fstype) {
-	case fs_exfat:
-	case fs_ext4:
-	case fs_fat:
-		vlsupp->supported = true;
-		break;
-	case fs_minix:
-	case fs_cdfs:
-		break;
-	}
-}
-
-/** @}
- */
Index: pace/srv/volsrv/mkfs.h
===================================================================
--- uspace/srv/volsrv/mkfs.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef MKFS_H_
-#define MKFS_H_
-
-#include <loc.h>
-#include <types/vol.h>
-
-extern errno_t volsrv_part_mkfs(service_id_t, vol_fstype_t, const char *);
-extern void volsrv_part_get_lsupp(vol_fstype_t, vol_label_supp_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/part.c
===================================================================
--- uspace/srv/volsrv/part.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,893 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Partition handling
- * @brief
- */
-
-#include <adt/list.h>
-#include <bd.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <loc.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-#include <str_error.h>
-#include <vfs/vfs.h>
-#include <vol.h>
-
-#include "empty.h"
-#include "mkfs.h"
-#include "part.h"
-#include "types/part.h"
-#include "volume.h"
-#include "volsrv.h"
-
-static errno_t vol_part_add_locked(vol_parts_t *, service_id_t);
-static void vol_part_remove_locked(vol_part_t *);
-static errno_t vol_part_find_by_id_ref_locked(vol_parts_t *, service_id_t,
-    vol_part_t **);
-
-struct fsname_type {
-	const char *name;
-	vol_fstype_t fstype;
-};
-
-static struct fsname_type fstab[] = {
-	{ "ext4fs", fs_ext4 },
-	{ "cdfs", fs_cdfs },
-	{ "exfat", fs_exfat },
-	{ "fat", fs_fat },
-	{ "mfs", fs_minix },
-	{ NULL, 0 }
-};
-
-static const char *fstype_str(vol_fstype_t fstype)
-{
-	struct fsname_type *fst;
-
-	fst = &fstab[0];
-	while (fst->name != NULL) {
-		if (fst->fstype == fstype)
-			return fst->name;
-		++fst;
-	}
-
-	assert(false);
-	return NULL;
-}
-
-/** Check for new and removed partitions */
-static errno_t vol_part_check_new(vol_parts_t *parts)
-{
-	bool already_known;
-	bool still_exists;
-	category_id_t part_cat;
-	service_id_t *svcs;
-	size_t count, i;
-	link_t *cur, *next;
-	vol_part_t *part;
-	errno_t rc;
-
-	fibril_mutex_lock(&parts->lock);
-
-	rc = loc_category_get_id("partition", &part_cat, IPC_FLAG_BLOCKING);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed resolving category 'partition'.");
-		fibril_mutex_unlock(&parts->lock);
-		return ENOENT;
-	}
-
-	rc = loc_category_get_svcs(part_cat, &svcs, &count);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting list of partition "
-		    "devices.");
-		fibril_mutex_unlock(&parts->lock);
-		return EIO;
-	}
-
-	/* Check for new partitions */
-	for (i = 0; i < count; i++) {
-		already_known = false;
-
-		// XXX Make this faster
-		list_foreach(parts->parts, lparts, vol_part_t, part) {
-			if (part->svc_id == svcs[i]) {
-				already_known = true;
-				break;
-			}
-		}
-
-		if (!already_known) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Found partition '%lu'",
-			    (unsigned long) svcs[i]);
-			rc = vol_part_add_locked(parts, svcs[i]);
-			if (rc != EOK) {
-				log_msg(LOG_DEFAULT, LVL_ERROR, "Could not add "
-				    "partition.");
-			}
-		}
-	}
-
-	/* Check for removed partitions */
-	cur = list_first(&parts->parts);
-	while (cur != NULL) {
-		next = list_next(cur, &parts->parts);
-		part = list_get_instance(cur, vol_part_t, lparts);
-
-		still_exists = false;
-		// XXX Make this faster
-		for (i = 0; i < count; i++) {
-			if (part->svc_id == svcs[i]) {
-				still_exists = true;
-				break;
-			}
-		}
-
-		if (!still_exists) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition '%zu' is gone",
-			    part->svc_id);
-			vol_part_remove_locked(part);
-		}
-
-		cur = next;
-	}
-
-	free(svcs);
-
-	fibril_mutex_unlock(&parts->lock);
-	return EOK;
-}
-
-static vol_part_t *vol_part_new(void)
-{
-	vol_part_t *part = calloc(1, sizeof(vol_part_t));
-
-	if (part == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating partition "
-		    "structure. Out of memory.");
-		return NULL;
-	}
-
-	refcount_init(&part->refcnt);
-	link_initialize(&part->lparts);
-	part->parts = NULL;
-	part->pcnt = vpc_empty;
-
-	return part;
-}
-
-static void vol_part_delete(vol_part_t *part)
-{
-	log_msg(LOG_DEFAULT, LVL_ERROR, "Freeing partition %p", part);
-	if (part == NULL)
-		return;
-
-	if (part->volume != NULL)
-		vol_volume_del_ref(part->volume);
-
-	free(part->cur_mp);
-	free(part->svc_name);
-	free(part);
-}
-
-static errno_t vol_part_probe(vol_part_t *part)
-{
-	bool empty;
-	vfs_fs_probe_info_t info;
-	struct fsname_type *fst;
-	char *label;
-	vol_volume_t *volume;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Probe partition %s", part->svc_name);
-
-	assert(fibril_mutex_is_locked(&part->parts->lock));
-
-	fst = &fstab[0];
-	while (fst->name != NULL) {
-		rc = vfs_fsprobe(fst->name, part->svc_id, &info);
-		if (rc == EOK)
-			break;
-		++fst;
-	}
-
-	if (fst->name != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Found %s, label '%s'",
-		    fst->name, info.label);
-		label = str_dup(info.label);
-		if (label == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		part->pcnt = vpc_fs;
-		part->fstype = fst->fstype;
-		part->label = label;
-	} else {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Partition does not contain "
-		    "a recognized file system.");
-
-		rc = volsrv_part_is_empty(part->svc_id, &empty);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed determining if "
-			    "partition is empty.");
-			rc = EIO;
-			goto error;
-		}
-
-		label = str_dup("");
-		if (label == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		part->pcnt = empty ? vpc_empty : vpc_unknown;
-		part->label = label;
-	}
-
-	/* Look up new or existing volume. */
-	rc = vol_volume_lookup_ref(part->parts->volumes, part->label, &volume);
-	if (rc != EOK)
-		goto error;
-
-	part->volume = volume;
-	return EOK;
-
-error:
-	return rc;
-}
-
-/** Determine if partition is allowed to be mounted by default.
- *
- * @param part Partition
- * @return @c true iff partition is allowed to be mounted by default
- */
-static bool vol_part_allow_mount_by_def(vol_part_t *part)
-{
-	/* CDFS is safe to mount (after all, it is read-only) */
-	if (part->pcnt == vpc_fs && part->fstype == fs_cdfs)
-		return true;
-
-	/* For other file systems disallow mounting from ATA hard drive */
-	if (str_str(part->svc_name, "\\ata-c") != NULL)
-		return false;
-
-	/* Allow otherwise (e.g. USB mass storage) */
-	return true;
-}
-
-/** Determine the default mount point for a partition.
- *
- * @param part Partition
- * @return Pointer to the constant string "Auto" or "None"
- */
-static const char *vol_part_def_mountp(vol_part_t *part)
-{
-	return vol_part_allow_mount_by_def(part) ? "Auto" : "None";
-}
-
-/** Determine actual mount path to be used for a partition.
- *
- * @param part Partition
- * @param rpath Place to store pointer to newly allocated string or @c NULL
- *              if volume should not be mounted
- * @param rauto Place to store boolean flag whether mount point is automatic
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t vol_part_determine_mount_path(vol_part_t *part, char **rpath,
-    bool *rauto)
-{
-	const char *cfg_mp;
-	char *mp;
-	bool mp_auto;
-	int err;
-
-	/* Get configured mount point */
-	if (str_size(part->volume->mountp) > 0) {
-		cfg_mp = part->volume->mountp;
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Configured mount point '%s'",
-		    cfg_mp);
-	} else {
-		cfg_mp = vol_part_def_mountp(part);
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Default mount point '%s'",
-		    cfg_mp);
-	}
-
-	if (str_cmp(cfg_mp, "Auto") == 0 || str_cmp(cfg_mp, "auto") == 0) {
-
-		if (str_size(part->label) < 1) {
-			/* Don't mount nameless volumes */
-			*rpath = NULL;
-			*rauto = false;
-			return EOK;
-		}
-
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Determine MP label='%s'", part->label);
-		err = asprintf(&mp, "/vol/%s", part->label);
-		if (err < 0) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory");
-			return ENOMEM;
-		}
-
-		mp_auto = true;
-	} else if (str_cmp(cfg_mp, "None") == 0 || str_cmp(cfg_mp, "none") == 0) {
-		mp = NULL;
-		mp_auto = false;
-	} else {
-		mp = str_dup(cfg_mp);
-		mp_auto = false;
-	}
-
-	*rpath = mp;
-	*rauto = mp_auto;
-	return EOK;
-}
-
-/** Mount partition.
- *
- * @param part Partition
- */
-static errno_t vol_part_mount(vol_part_t *part)
-{
-	char *mp;
-	bool mp_auto;
-	errno_t rc;
-
-	rc = vol_part_determine_mount_path(part, &mp, &mp_auto);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Error determining mount point.\n");
-		return rc;
-	}
-
-	if (mp == NULL) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Not mounting volume.");
-		return EOK;
-	}
-
-	if (mp_auto) {
-		/* Create directory for automatic mount point */
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Create mount point '%s'", mp);
-		rc = vfs_link_path(mp, KIND_DIRECTORY, NULL);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error creating mount point '%s'",
-			    mp);
-			free(mp);
-			return EIO;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Call vfs_mount_path mp='%s' fstype='%s' svc_name='%s'",
-	    mp, fstype_str(part->fstype), part->svc_name);
-	rc = vfs_mount_path(mp, fstype_str(part->fstype),
-	    part->svc_name, "", 0, 0);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed mounting %s at %s to %s",
-		    fstype_str(part->fstype), part->svc_name, mp);
-	} else {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted %s at %s to %s\n",
-		    fstype_str(part->fstype), part->svc_name, mp);
-	}
-
-	part->cur_mp = mp;
-	part->cur_mp_auto = mp_auto;
-
-	if (str_cmp(mp, "/w") == 0) {
-		log_msg(LOG_DEFAULT, LVL_NOTE, "Mounted system volume - "
-		    "loading additional configuration.");
-		rc = vol_volumes_merge_to(part->parts->volumes,
-		    vol_cfg_file);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Error loading "
-			    "additional configuration.");
-			return rc;
-		}
-	}
-
-	return rc;
-}
-
-static errno_t vol_part_add_locked(vol_parts_t *parts, service_id_t sid)
-{
-	vol_part_t *part;
-	errno_t rc;
-
-	assert(fibril_mutex_is_locked(&parts->lock));
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_add_locked(%zu)", sid);
-
-	/* Check for duplicates */
-	rc = vol_part_find_by_id_ref_locked(parts, sid, &part);
-	if (rc == EOK) {
-		vol_part_del_ref(part);
-		return EEXIST;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "partition %zu is new", sid);
-
-	part = vol_part_new();
-	if (part == NULL)
-		return ENOMEM;
-
-	part->svc_id = sid;
-	part->parts = parts;
-
-	rc = loc_service_get_name(sid, &part->svc_name);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed getting service name.");
-		goto error;
-	}
-
-	rc = vol_part_probe(part);
-	if (rc != EOK)
-		goto error;
-
-	rc = vol_part_mount(part);
-	if (rc != EOK)
-		goto error;
-
-	list_append(&part->lparts, &parts->parts);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Added partition %zu", part->svc_id);
-
-	return EOK;
-
-error:
-	vol_part_delete(part);
-	return rc;
-}
-
-static void vol_part_remove_locked(vol_part_t *part)
-{
-	assert(fibril_mutex_is_locked(&part->parts->lock));
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_remove_locked(%zu)",
-	    part->svc_id);
-
-	list_remove(&part->lparts);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Removed partition.");
-	vol_part_del_ref(part);
-}
-
-errno_t vol_part_add_part(vol_parts_t *parts, service_id_t sid)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&parts->lock);
-	rc = vol_part_add_locked(parts, sid);
-	fibril_mutex_unlock(&parts->lock);
-
-	return rc;
-}
-
-static void vol_part_cat_change_cb(void *arg)
-{
-	vol_parts_t *parts = (vol_parts_t *) arg;
-
-	(void) vol_part_check_new(parts);
-}
-
-errno_t vol_parts_create(vol_volumes_t *volumes, vol_parts_t **rparts)
-{
-	vol_parts_t *parts;
-
-	parts = calloc(1, sizeof(vol_parts_t));
-	if (parts == NULL)
-		return ENOMEM;
-
-	fibril_mutex_initialize(&parts->lock);
-	list_initialize(&parts->parts);
-	parts->volumes = volumes;
-
-	*rparts = parts;
-	return EOK;
-}
-
-void vol_parts_destroy(vol_parts_t *parts)
-{
-	if (parts == NULL)
-		return;
-
-	assert(list_empty(&parts->parts));
-	free(parts);
-}
-
-errno_t vol_part_discovery_start(vol_parts_t *parts)
-{
-	errno_t rc;
-
-	rc = loc_register_cat_change_cb(vol_part_cat_change_cb, parts);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering callback "
-		    "for partition discovery: %s.", str_error(rc));
-		return rc;
-	}
-
-	return vol_part_check_new(parts);
-}
-
-/** Get list of partitions as array of service IDs. */
-errno_t vol_part_get_ids(vol_parts_t *parts, service_id_t *id_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	fibril_mutex_lock(&parts->lock);
-
-	buf_cnt = buf_size / sizeof(service_id_t);
-
-	act_cnt = list_count(&parts->parts);
-	*act_size = act_cnt * sizeof(service_id_t);
-
-	if (buf_size % sizeof(service_id_t) != 0) {
-		fibril_mutex_unlock(&parts->lock);
-		return EINVAL;
-	}
-
-	size_t pos = 0;
-	list_foreach(parts->parts, lparts, vol_part_t, part) {
-		if (pos < buf_cnt)
-			id_buf[pos] = part->svc_id;
-		pos++;
-	}
-
-	fibril_mutex_unlock(&parts->lock);
-	return EOK;
-}
-
-static errno_t vol_part_find_by_id_ref_locked(vol_parts_t *parts,
-    service_id_t sid, vol_part_t **rpart)
-{
-	assert(fibril_mutex_is_locked(&parts->lock));
-
-	list_foreach(parts->parts, lparts, vol_part_t, part) {
-		if (part->svc_id == sid) {
-			/* Add reference */
-			refcount_up(&part->refcnt);
-			*rpart = part;
-			return EOK;
-		}
-	}
-
-	return ENOENT;
-}
-
-errno_t vol_part_find_by_id_ref(vol_parts_t *parts, service_id_t sid,
-    vol_part_t **rpart)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&parts->lock);
-	rc = vol_part_find_by_id_ref_locked(parts, sid, rpart);
-	fibril_mutex_unlock(&parts->lock);
-
-	return rc;
-}
-
-/** Find partition by filesystem path.
- *
- * @param parts Partitions
- * @param path Filesystem path
- * @param rpart Place to store pointer to partition
- * @return EOK on success, ENOENT if not found, ENOMEM if out of memory
- */
-errno_t vol_part_find_by_path_ref(vol_parts_t *parts, const char *path,
-    vol_part_t **rpart)
-{
-	errno_t rc;
-	char *mpath;
-	bool mauto;
-
-	fibril_mutex_lock(&parts->lock);
-
-	list_foreach(parts->parts, lparts, vol_part_t, part) {
-		rc = vol_part_determine_mount_path(part, &mpath, &mauto);
-		if (rc != EOK) {
-			fibril_mutex_unlock(&parts->lock);
-			return ENOMEM;
-		}
-
-		if (mpath != NULL && str_cmp(mpath, path) == 0) {
-			/* Add reference */
-			refcount_up(&part->refcnt);
-			fibril_mutex_unlock(&parts->lock);
-			free(mpath);
-			*rpart = part;
-			return EOK;
-		}
-
-		if (mpath != NULL)
-			free(mpath);
-	}
-
-	fibril_mutex_unlock(&parts->lock);
-	return ENOENT;
-}
-
-void vol_part_del_ref(vol_part_t *part)
-{
-	if (refcount_down(&part->refcnt))
-		vol_part_delete(part);
-}
-
-static errno_t vol_part_eject_device(service_id_t svcid)
-{
-	async_sess_t *sess;
-	errno_t rc;
-	bd_t *bd;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_device(%zu)",
-	    (size_t)svcid);
-
-	sess = loc_service_connect(svcid, INTERFACE_BLOCK, 0);
-	if (sess == NULL)
-		return EIO;
-
-	rc = bd_open(sess, &bd);
-	if (rc != EOK) {
-		async_hangup(sess);
-		return EIO;
-	}
-
-	rc = bd_eject(bd);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_WARN, "vol_part_eject_device(): "
-		    "eject fail");
-		bd_close(bd);
-		async_hangup(sess);
-		return EIO;
-	}
-
-	bd_close(bd);
-	async_hangup(sess);
-	return EOK;
-}
-
-errno_t vol_part_eject_part(vol_part_t *part, vol_eject_flags_t flags)
-{
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_part()");
-
-	if (part->cur_mp == NULL) {
-		/* Partition is not mounted, nothing to do. */
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "Partition not mounted, "
-		    "nothing to do.");
-		goto done;
-	}
-
-	rc = vfs_unmount_path(part->cur_mp);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unmounting partition "
-		    "from %s", part->cur_mp);
-		return rc;
-	}
-
-	if (part->cur_mp_auto) {
-		rc = vfs_unlink_path(part->cur_mp);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed deleting "
-			    "mount directory %s.", part->cur_mp);
-		}
-	}
-
-	if ((flags & vef_physical) != 0) {
-		rc = vol_part_eject_device(part->svc_id);
-		if (rc != EOK) {
-			log_msg(LOG_DEFAULT, LVL_ERROR, "Failed physically "
-			    "ejecting device %s.", part->svc_name);
-		}
-	}
-
-	free(part->cur_mp);
-	part->cur_mp = NULL;
-	part->cur_mp_auto = false;
-done:
-	return EOK;
-}
-
-errno_t vol_part_empty_part(vol_part_t *part)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_part()");
-
-	rc = volsrv_part_empty(part->svc_id);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_part() - failed %s",
-		    str_error(rc));
-		return rc;
-	}
-
-	part->pcnt = vpc_empty;
-	return EOK;
-}
-
-/** Insert volume.
- *
- * Re-mount the volume in the partition, if applicable.
- *
- * @param part Partition
- */
-errno_t vol_part_insert_part(vol_part_t *part)
-{
-	int rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_insert_part()");
-
-	fibril_mutex_lock(&part->parts->lock);
-
-	if (part->cur_mp != NULL) {
-		fibril_mutex_unlock(&part->parts->lock);
-		return EOK;
-	}
-
-	rc = vol_part_probe(part);
-	if (rc != EOK)
-		goto error;
-
-	rc = vol_part_mount(part);
-	if (rc != EOK)
-		goto error;
-
-	fibril_mutex_unlock(&part->parts->lock);
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Set mount point.
- *
- * Verify and set a mount point. If the value of the mount point is
- * the same as the default value, we will actually unset the mount point
- * value (therefore effectively changing it to use the default).
- *
- * @return EOK on success, error code otherwise
- */
-static errno_t vol_part_mountp_set(vol_part_t *part, const char *mountp)
-{
-	errno_t rc;
-	const char *def_mp;
-	const char *mp;
-
-	rc = vol_mountp_validate(mountp);
-	if (rc != EOK)
-		return rc;
-
-	def_mp = vol_part_def_mountp(part);
-
-	/* If the value is the same as default, set to empty string. */
-	if (str_cmp(def_mp, mountp) == 0)
-		mp = "";
-	else
-		mp = mountp;
-
-	rc = vol_volume_set_mountp(part->volume, mp);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-errno_t vol_part_mkfs_part(vol_part_t *part, vol_fstype_t fstype,
-    const char *label, const char *mountp)
-{
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part()");
-
-	fibril_mutex_lock(&part->parts->lock);
-
-	rc = volsrv_part_mkfs(part->svc_id, fstype, label);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_part() - failed %s",
-		    str_error(rc));
-		fibril_mutex_unlock(&part->parts->lock);
-		return rc;
-	}
-
-	/*
-	 * Re-probe the partition to update information. This is needed since
-	 * the FS can make conversions of the volume label (e.g. make it
-	 * uppercase).
-	 */
-	rc = vol_part_probe(part);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&part->parts->lock);
-		return rc;
-	}
-
-	rc = vol_part_mountp_set(part, mountp);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&part->parts->lock);
-		return rc;
-	}
-
-	rc = vol_part_mount(part);
-	if (rc != EOK) {
-		fibril_mutex_unlock(&part->parts->lock);
-		return rc;
-	}
-
-	fibril_mutex_unlock(&part->parts->lock);
-	return EOK;
-}
-
-/** Set partition mount point.
- *
- * Set the partition mount point, (un-, re-)mounting the partition as necessary.
- *
- * @param part Partition
- * @param mountp
- *
- * @return EOK on success or error code
- */
-errno_t vol_part_set_mountp_part(vol_part_t *part, const char *mountp)
-{
-	errno_t rc;
-
-	if (part->cur_mp != NULL) {
-		rc = vol_part_eject_part(part, vef_none);
-		if (rc != EOK)
-			return rc;
-	}
-
-	rc = vol_part_mountp_set(part, mountp);
-	if (rc != EOK)
-		return rc;
-
-	rc = vol_part_mount(part);
-	if (rc != EOK)
-		return rc;
-
-	return EOK;
-}
-
-errno_t vol_part_get_info(vol_part_t *part, vol_part_info_t *pinfo)
-{
-	memset(pinfo, 0, sizeof(*pinfo));
-
-	pinfo->pcnt = part->pcnt;
-	pinfo->fstype = part->fstype;
-	str_cpy(pinfo->label, sizeof(pinfo->label), part->label);
-	if (part->cur_mp != NULL)
-		str_cpy(pinfo->cur_mp, sizeof(pinfo->cur_mp), part->cur_mp);
-	pinfo->cur_mp_auto = part->cur_mp_auto;
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/volsrv/part.h
===================================================================
--- uspace/srv/volsrv/part.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef PART_H_
-#define PART_H_
-
-#include <loc.h>
-#include <stddef.h>
-#include <types/vol.h>
-#include "types/part.h"
-#include "types/volume.h"
-
-extern errno_t vol_parts_create(vol_volumes_t *, vol_parts_t **);
-extern void vol_parts_destroy(vol_parts_t *);
-extern errno_t vol_part_discovery_start(vol_parts_t *);
-extern errno_t vol_part_add_part(vol_parts_t *, service_id_t);
-extern errno_t vol_part_get_ids(vol_parts_t *, service_id_t *, size_t,
-    size_t *);
-extern errno_t vol_part_find_by_id_ref(vol_parts_t *, service_id_t,
-    vol_part_t **);
-extern errno_t vol_part_find_by_path_ref(vol_parts_t *, const char *,
-    vol_part_t **);
-extern void vol_part_del_ref(vol_part_t *);
-extern errno_t vol_part_eject_part(vol_part_t *, vol_eject_flags_t);
-extern errno_t vol_part_empty_part(vol_part_t *);
-extern errno_t vol_part_insert_part(vol_part_t *);
-extern errno_t vol_part_mkfs_part(vol_part_t *, vol_fstype_t, const char *,
-    const char *);
-extern errno_t vol_part_set_mountp_part(vol_part_t *, const char *);
-extern errno_t vol_part_get_info(vol_part_t *, vol_part_info_t *);
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/test/main.c
===================================================================
--- uspace/srv/volsrv/test/main.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pcut/pcut.h>
-
-PCUT_INIT;
-
-PCUT_IMPORT(volume);
-
-PCUT_MAIN();
Index: pace/srv/volsrv/test/volume.c
===================================================================
--- uspace/srv/volsrv/test/volume.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,149 +1,0 @@
-/*
- * Copyright (c) 2018 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <pcut/pcut.h>
-#include <stdio.h>
-#include <str.h>
-
-#include "../volume.h"
-
-PCUT_INIT;
-
-PCUT_TEST_SUITE(volume);
-
-/** Volumes list creation and destruction. */
-PCUT_TEST(volumes_basic)
-{
-	vol_volumes_t *volumes;
-	char *namebuf;
-	char *fname;
-	errno_t rc;
-	int rv;
-
-	namebuf = malloc(L_tmpnam);
-	PCUT_ASSERT_NOT_NULL(namebuf);
-
-	fname = tmpnam(namebuf);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	rc = vol_volumes_create(fname, &volumes);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	vol_volumes_destroy(volumes);
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-	free(fname);
-}
-
-/** Two references to the same volume, reference to a different volume. */
-PCUT_TEST(two_same_different)
-{
-	vol_volumes_t *volumes;
-	vol_volume_t *va, *vb, *va1;
-	char *namebuf;
-	char *fname;
-	errno_t rc;
-	int rv;
-
-	namebuf = malloc(L_tmpnam);
-	PCUT_ASSERT_NOT_NULL(namebuf);
-
-	fname = tmpnam(namebuf);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	rc = vol_volumes_create(fname, &volumes);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = vol_volume_lookup_ref(volumes, "foo", &va);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = vol_volume_lookup_ref(volumes, "bar", &vb);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	rc = vol_volume_lookup_ref(volumes, "foo", &va1);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	PCUT_ASSERT_TRUE(va1 == va);
-
-	vol_volume_del_ref(va);
-	vol_volume_del_ref(vb);
-	vol_volume_del_ref(va1);
-
-	vol_volumes_destroy(volumes);
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-	free(fname);
-}
-
-/** Reference the same volume twice, making sure it persists. */
-PCUT_TEST(same_twice)
-{
-	vol_volumes_t *volumes;
-	vol_volume_t *va;
-	char *namebuf;
-	char *fname;
-	errno_t rc;
-	int rv;
-
-	namebuf = malloc(L_tmpnam);
-	PCUT_ASSERT_NOT_NULL(namebuf);
-
-	fname = tmpnam(namebuf);
-	PCUT_ASSERT_NOT_NULL(fname);
-
-	rc = vol_volumes_create(fname, &volumes);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Look up a volume */
-	rc = vol_volume_lookup_ref(volumes, "foo", &va);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* Setting mount point forces it to persist after dropping the ref. */
-	rc = vol_volume_set_mountp(va, "/xyz");
-
-	/* Drop the reference */
-	vol_volume_del_ref(va);
-
-	/* Look up volume again */
-	rc = vol_volume_lookup_ref(volumes, "foo", &va);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	/* The mount point should still be set */
-	PCUT_ASSERT_NOT_NULL(va->mountp);
-	PCUT_ASSERT_TRUE(str_cmp(va->mountp, "/xyz") == 0);
-
-	vol_volume_del_ref(va);
-
-	vol_volumes_destroy(volumes);
-	rv = remove(fname);
-	PCUT_ASSERT_INT_EQUALS(0, rv);
-	free(fname);
-}
-
-PCUT_EXPORT(volume);
Index: pace/srv/volsrv/types/part.h
===================================================================
--- uspace/srv/volsrv/types/part.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,85 +1,0 @@
-/*
- * Copyright (c) 2015 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef TYPES_PART_H_
-#define TYPES_PART_H_
-
-#include <adt/list.h>
-#include <refcount.h>
-#include <fibril_synch.h>
-#include <stdbool.h>
-#include <types/label.h>
-
-/** Partition */
-typedef struct {
-	/** Containing partition list */
-	struct vol_parts *parts;
-	/** Link to vol_parts */
-	link_t lparts;
-	/** Reference count */
-	atomic_refcount_t refcnt;
-	/** Service ID */
-	service_id_t svc_id;
-	/** Service name */
-	char *svc_name;
-	/** Partition contents */
-	vol_part_cnt_t pcnt;
-	/** Filesystem type */
-	vol_fstype_t fstype;
-	/** Volume label */
-	char *label;
-	/** Where volume is currently mounted */
-	char *cur_mp;
-	/** Mounted at automatic mount point */
-	bool cur_mp_auto;
-	/** Volume */
-	struct vol_volume *volume;
-} vol_part_t;
-
-/** Partitions */
-typedef struct vol_parts {
-	/** Synchronize access to list of partitions */
-	fibril_mutex_t lock;
-	/** Partitions (list of vol_part_t) */
-	list_t parts;
-	/** Underlying volumes */
-	struct vol_volumes *volumes;
-} vol_parts_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/types/volume.h
===================================================================
--- uspace/srv/volsrv/types/volume.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,75 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef TYPES_VOLUME_H_
-#define TYPES_VOLUME_H_
-
-#include <adt/list.h>
-#include <refcount.h>
-#include <fibril_synch.h>
-
-/** Volume */
-typedef struct vol_volume {
-	/** Containing volume list */
-	struct vol_volumes *volumes;
-	/** Link to vol_volumes */
-	link_t lvolumes;
-	/** ID used by clients to refer to the volume */
-	volume_id_t id;
-	/** Reference count */
-	atomic_refcount_t refcnt;
-	/** Volume label */
-	char *label;
-	/** Mount point */
-	char *mountp;
-} vol_volume_t;
-
-/** Volumes */
-typedef struct vol_volumes {
-	/** Synchronize access to list of volumes */
-	fibril_mutex_t lock;
-	/** Volumes (list of vol_volume_t) */
-	list_t volumes;
-	/** Next ID */
-	sysarg_t next_id;
-	/** Configuration file path */
-	char *cfg_path;
-} vol_volumes_t;
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/volsrv.c
===================================================================
--- uspace/srv/volsrv/volsrv.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,640 +1,0 @@
-/*
- * Copyright (c) 2025 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Volume service
- */
-
-#include <async.h>
-#include <errno.h>
-#include <str_error.h>
-#include <io/log.h>
-#include <ipc/services.h>
-#include <ipc/vol.h>
-#include <loc.h>
-#include <macros.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <task.h>
-#include <types/vol.h>
-
-#include "mkfs.h"
-#include "part.h"
-#include "volume.h"
-
-#define NAME  "volsrv"
-
-const char *vol_icfg_file = "/cfg/initvol.sif";
-const char *vol_cfg_file = "/w/cfg/volsrv.sif";
-
-static void vol_client_conn(ipc_call_t *, void *);
-
-static errno_t vol_init(void)
-{
-	errno_t rc;
-	vol_volumes_t *volumes = NULL;
-	vol_parts_t *parts = NULL;
-	loc_srv_t *srv = NULL;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_init()");
-
-	rc = vol_volumes_create(vol_icfg_file, &volumes);
-	if (rc != EOK)
-		goto error;
-
-	rc = vol_parts_create(volumes, &parts);
-	if (rc != EOK)
-		goto error;
-
-	rc = vol_part_discovery_start(parts);
-	if (rc != EOK)
-		goto error;
-
-	async_set_fallback_port_handler(vol_client_conn, parts);
-
-	rc = loc_server_register(NAME, &srv);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server: %s.", str_error(rc));
-		rc = EEXIST;
-	}
-
-	service_id_t sid;
-	rc = loc_service_register(srv, SERVICE_NAME_VOLSRV, &sid);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service: %s.", str_error(rc));
-		rc = EEXIST;
-		goto error;
-	}
-
-	return EOK;
-error:
-	if (srv != NULL)
-		loc_server_unregister(srv);
-	vol_volumes_destroy(volumes);
-	vol_parts_destroy(parts);
-	return rc;
-}
-
-static void vol_get_parts_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	service_id_t *id_buf = (service_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = vol_part_get_ids(parts, id_buf, size, &act_size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void vol_part_add_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	errno_t rc;
-
-	sid = ipc_get_arg1(icall);
-
-	rc = vol_part_add_part(parts, sid);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void vol_part_info_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_part_t *part;
-	vol_part_info_t pinfo;
-	errno_t rc;
-
-	sid = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_info_srv(%zu)",
-	    sid);
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = vol_part_get_info(part, &pinfo);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		goto error;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		goto error;
-	}
-
-	if (size != sizeof(vol_part_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		goto error;
-	}
-
-	rc = async_data_read_finalize(&call, &pinfo,
-	    min(size, sizeof(pinfo)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		goto error;
-	}
-
-	async_answer_0(icall, EOK);
-error:
-	vol_part_del_ref(part);
-}
-
-static void vol_part_eject_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_eject_flags_t flags;
-	vol_part_t *part;
-	errno_t rc;
-
-	sid = ipc_get_arg1(icall);
-	flags = ipc_get_arg2(icall);
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_srv(%zu, %x)",
-	    sid, flags);
-
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = vol_part_eject_part(part, flags);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		goto error;
-	}
-
-	async_answer_0(icall, EOK);
-error:
-	vol_part_del_ref(part);
-}
-
-static void vol_part_insert_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_part_t *part;
-	errno_t rc;
-
-	sid = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_insert_srv(%zu)", sid);
-
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = vol_part_insert_part(part);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		goto error;
-	}
-
-	async_answer_0(icall, EOK);
-error:
-	vol_part_del_ref(part);
-}
-
-static void vol_part_insert_by_path_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	vol_part_t *part;
-	char *path = NULL;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_insert_by_path_srv()");
-
-	rc = async_data_write_accept((void **)&path, true, 0, VOL_MOUNTP_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		goto error;
-	}
-
-	rc = vol_part_find_by_path_ref(parts, path, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		goto error;
-	}
-
-	rc = vol_part_insert_part(part);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		vol_part_del_ref(part);
-		goto error;
-	}
-
-	free(path);
-	vol_part_del_ref(part);
-	async_answer_0(icall, EOK);
-
-	return;
-error:
-	if (path != NULL)
-		free(path);
-}
-
-static void vol_part_empty_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_part_t *part;
-	errno_t rc;
-
-	sid = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_srv(%zu)", sid);
-
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = vol_part_empty_part(part);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		goto error;
-	}
-
-	async_answer_0(icall, EOK);
-error:
-	vol_part_del_ref(part);
-}
-
-static void vol_part_get_lsupp_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	vol_fstype_t fstype;
-	vol_label_supp_t vlsupp;
-	errno_t rc;
-
-	fstype = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_get_lsupp_srv(%u)",
-	    fstype);
-
-	volsrv_part_get_lsupp(fstype, &vlsupp);
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	if (size != sizeof(vol_label_supp_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		return;
-	}
-
-	rc = async_data_read_finalize(&call, &vlsupp,
-	    min(size, sizeof(vlsupp)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	async_answer_0(icall, EOK);
-}
-
-static void vol_part_mkfs_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_part_t *part;
-	vol_fstype_t fstype;
-	char *label = NULL;
-	char *mountp = NULL;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv()");
-
-	sid = ipc_get_arg1(icall);
-	fstype = ipc_get_arg2(icall);
-
-	rc = async_data_write_accept((void **)&label, true, 0, VOL_LABEL_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		goto error;
-	}
-
-	if (label != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv: label='%s'",
-		    label);
-	}
-
-	rc = async_data_write_accept((void **)&mountp, true, 0, VOL_MOUNTP_MAXLEN,
-	    0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		goto error;
-	}
-
-	if (mountp != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_mkfs_srv: mountp='%s'",
-		    mountp);
-	}
-
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		async_answer_0(icall, ENOENT);
-		goto error;
-	}
-
-	rc = vol_part_mkfs_part(part, fstype, label, mountp);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		vol_part_del_ref(part);
-		goto error;
-	}
-
-	free(label);
-	free(mountp);
-	async_answer_0(icall, EOK);
-
-	return;
-error:
-	if (label != NULL)
-		free(label);
-	if (mountp != NULL)
-		free(mountp);
-}
-
-static void vol_part_set_mountp_srv(vol_parts_t *parts,
-    ipc_call_t *icall)
-{
-	service_id_t sid;
-	vol_part_t *part;
-	char *mountp;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_set_mountp_srv()");
-
-	sid = ipc_get_arg1(icall);
-
-	rc = async_data_write_accept((void **)&mountp, true, 0,
-	    VOL_MOUNTP_MAXLEN, 0, NULL);
-	if (rc != EOK) {
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	if (mountp != NULL) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG,
-		    "vol_part_set_mountp_srv: mountp='%s'", mountp);
-	}
-
-	rc = vol_part_find_by_id_ref(parts, sid, &part);
-	if (rc != EOK) {
-		free(mountp);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	rc = vol_part_set_mountp_part(part, mountp);
-	if (rc != EOK) {
-		free(mountp);
-		async_answer_0(icall, rc);
-		vol_part_del_ref(part);
-		return;
-	}
-
-	free(mountp);
-	async_answer_0(icall, EOK);
-}
-
-static void vol_get_volumes_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	ipc_call_t call;
-	size_t size;
-	size_t act_size;
-	errno_t rc;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_get_volumes_srv()");
-
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		return;
-	}
-
-	volume_id_t *id_buf = (volume_id_t *) malloc(size);
-	if (id_buf == NULL) {
-		async_answer_0(&call, ENOMEM);
-		async_answer_0(icall, ENOMEM);
-		return;
-	}
-
-	rc = vol_get_ids(parts->volumes, id_buf, size, &act_size);
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		return;
-	}
-
-	errno_t retval = async_data_read_finalize(&call, id_buf, size);
-	free(id_buf);
-
-	async_answer_1(icall, retval, act_size);
-}
-
-static void vol_info_srv(vol_parts_t *parts, ipc_call_t *icall)
-{
-	volume_id_t vid;
-	vol_volume_t *volume;
-	vol_info_t vinfo;
-	errno_t rc;
-
-	vid.id = ipc_get_arg1(icall);
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv(%zu)", vid.id);
-
-	rc = vol_volume_find_by_id_ref(parts->volumes, vid, &volume);
-	if (rc != EOK) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv: volume %zu not found",
-		    vid.id);
-		async_answer_0(icall, ENOENT);
-		return;
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_info_srv: vol_volume_get_info");
-	rc = vol_volume_get_info(volume, &vinfo);
-	if (rc != EOK) {
-		async_answer_0(icall, EIO);
-		goto error;
-	}
-
-	ipc_call_t call;
-	size_t size;
-	if (!async_data_read_receive(&call, &size)) {
-		async_answer_0(&call, EREFUSED);
-		async_answer_0(icall, EREFUSED);
-		goto error;
-	}
-
-	if (size != sizeof(vol_info_t)) {
-		async_answer_0(&call, EINVAL);
-		async_answer_0(icall, EINVAL);
-		goto error;
-	}
-
-	rc = async_data_read_finalize(&call, &vinfo,
-	    min(size, sizeof(vinfo)));
-	if (rc != EOK) {
-		async_answer_0(&call, rc);
-		async_answer_0(icall, rc);
-		goto error;
-	}
-
-	async_answer_0(icall, EOK);
-error:
-	vol_volume_del_ref(volume);
-}
-
-static void vol_client_conn(ipc_call_t *icall, void *arg)
-{
-	vol_parts_t *parts = (vol_parts_t *) arg;
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_client_conn()");
-
-	/* Accept the connection */
-	async_accept_0(icall);
-
-	while (true) {
-		ipc_call_t call;
-		async_get_call(&call);
-		sysarg_t method = ipc_get_imethod(&call);
-
-		if (!method) {
-			/* The other side has hung up */
-			async_answer_0(&call, EOK);
-			return;
-		}
-
-		switch (method) {
-		case VOL_GET_PARTS:
-			vol_get_parts_srv(parts, &call);
-			break;
-		case VOL_PART_ADD:
-			vol_part_add_srv(parts, &call);
-			break;
-		case VOL_PART_INFO:
-			vol_part_info_srv(parts, &call);
-			break;
-		case VOL_PART_EJECT:
-			vol_part_eject_srv(parts, &call);
-			break;
-		case VOL_PART_EMPTY:
-			vol_part_empty_srv(parts, &call);
-			break;
-		case VOL_PART_INSERT:
-			vol_part_insert_srv(parts, &call);
-			break;
-		case VOL_PART_INSERT_BY_PATH:
-			vol_part_insert_by_path_srv(parts, &call);
-			break;
-		case VOL_PART_LSUPP:
-			vol_part_get_lsupp_srv(parts, &call);
-			break;
-		case VOL_PART_MKFS:
-			vol_part_mkfs_srv(parts, &call);
-			break;
-		case VOL_PART_SET_MOUNTP:
-			vol_part_set_mountp_srv(parts, &call);
-			break;
-		case VOL_GET_VOLUMES:
-			vol_get_volumes_srv(parts, &call);
-			break;
-		case VOL_INFO:
-			vol_info_srv(parts, &call);
-			break;
-		default:
-			async_answer_0(&call, EINVAL);
-		}
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	errno_t rc;
-
-	printf("%s: Volume service\n", NAME);
-
-	if (log_init(NAME) != EOK) {
-		printf(NAME ": Failed to initialize logging.\n");
-		return 1;
-	}
-
-	rc = vol_init();
-	if (rc != EOK)
-		return 1;
-
-	printf(NAME ": Accepting connections.\n");
-	task_retval(0);
-	async_manager();
-
-	return 0;
-}
-
-/** @}
- */
Index: pace/srv/volsrv/volsrv.h
===================================================================
--- uspace/srv/volsrv/volsrv.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Volume service
- */
-
-#ifndef VOLSRV_H
-#define VOLSRV_H
-
-extern const char *vol_cfg_file;
-
-#endif
-
-/** @}
- */
Index: pace/srv/volsrv/volume.c
===================================================================
--- uspace/srv/volsrv/volume.c	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,673 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file Volume handling
- * @brief
- *
- * Volumes are the file systems (or similar) contained in partitions.
- * Each vol_volume_t can be considered the configuration entry
- * for a volume. Each partition has an associated vol_volume_t.
- *
- * If there is any non-default configuration to be remembered for a
- * volume, the vol_volume_t structure is kept around even after the partition
- * is disassociated from it. Otherwise it is deleted once no longer
- * referenced.
- */
-
-#include <adt/list.h>
-#include <errno.h>
-#include <fibril_synch.h>
-#include <io/log.h>
-#include <sif.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <str.h>
-
-#include "volume.h"
-#include "types/volume.h"
-
-static void vol_volume_delete(vol_volume_t *);
-static void vol_volume_add_locked(vol_volumes_t *, vol_volume_t *);
-static errno_t vol_volume_lookup_ref_locked(vol_volumes_t *, const char *,
-    vol_volume_t **);
-static errno_t vol_volumes_load(sif_node_t *, vol_volumes_t *);
-static errno_t vol_volumes_save(vol_volumes_t *, sif_node_t *);
-
-/** Allocate new volume structure.
- *
- * @return Pointer to new volume structure
- */
-static vol_volume_t *vol_volume_new(void)
-{
-	vol_volume_t *volume = calloc(1, sizeof(vol_volume_t));
-
-	if (volume == NULL) {
-		log_msg(LOG_DEFAULT, LVL_ERROR, "Failed allocating volume "
-		    "structure. Out of memory.");
-		return NULL;
-	}
-
-	volume->label = str_dup("");
-	volume->mountp = str_dup("");
-
-	if (volume->label == NULL || volume->mountp == NULL) {
-		vol_volume_delete(volume);
-		return NULL;
-	}
-
-	refcount_init(&volume->refcnt);
-	link_initialize(&volume->lvolumes);
-	volume->volumes = NULL;
-
-	return volume;
-}
-
-/** Delete volume structure.
- *
- * @param volume Volume structure
- */
-static void vol_volume_delete(vol_volume_t *volume)
-{
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "Freeing volume %p", volume);
-
-	free(volume->label);
-	free(volume->mountp);
-	free(volume);
-}
-
-/** Create list of volumes.
- *
- * @param cfg_path Path to file containing configuration repository in SIF
- * @param rvolumes Place to store pointer to list of volumes.
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_volumes_create(const char *cfg_path,
-    vol_volumes_t **rvolumes)
-{
-	vol_volumes_t *volumes;
-	sif_doc_t *doc = NULL;
-	sif_node_t *node;
-	sif_node_t *nvolumes;
-	const char *ntype;
-	errno_t rc;
-
-	volumes = calloc(1, sizeof(vol_volumes_t));
-	if (volumes == NULL)
-		return ENOMEM;
-
-	volumes->cfg_path = str_dup(cfg_path);
-	if (volumes->cfg_path == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	fibril_mutex_initialize(&volumes->lock);
-	list_initialize(&volumes->volumes);
-	volumes->next_id = 1;
-
-	/* Try opening existing repository */
-	rc = sif_load(cfg_path, &doc);
-	if (rc != EOK) {
-		/* Failed to open existing, create new repository */
-		rc = sif_new(&doc);
-		if (rc != EOK)
-			goto error;
-
-		/* Create 'volumes' node. */
-		rc = sif_node_append_child(sif_get_root(doc), "volumes",
-		    &nvolumes);
-		if (rc != EOK)
-			goto error;
-
-		rc = sif_save(doc, cfg_path);
-		if (rc != EOK)
-			goto error;
-
-		sif_delete(doc);
-	} else {
-		/*
-		 * Loaded existing configuration. Find 'volumes' node, should
-		 * be the first child of the root node.
-		 */
-		node = sif_node_first_child(sif_get_root(doc));
-
-		/* Verify it's the correct node type */
-		ntype = sif_node_get_type(node);
-		if (str_cmp(ntype, "volumes") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = vol_volumes_load(node, volumes);
-		if (rc != EOK)
-			goto error;
-
-		sif_delete(doc);
-	}
-
-	*rvolumes = volumes;
-	return EOK;
-error:
-	if (doc != NULL)
-		(void) sif_delete(doc);
-	if (volumes != NULL && volumes->cfg_path != NULL)
-		free(volumes->cfg_path);
-	if (volumes != NULL)
-		free(volumes);
-
-	return rc;
-}
-
-/** Merge list of volumes into new file.
- *
- * @param volumes List of volumes
- * @param cfg_path Path to file containing configuration repository in SIF
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_volumes_merge_to(vol_volumes_t *volumes, const char *cfg_path)
-{
-	sif_doc_t *doc = NULL;
-	sif_node_t *node;
-	const char *ntype;
-	char *dcfg_path;
-	errno_t rc;
-
-	dcfg_path = str_dup(cfg_path);
-	if (dcfg_path == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	free(volumes->cfg_path);
-	volumes->cfg_path = dcfg_path;
-
-	/* Try opening existing repository */
-	rc = sif_load(cfg_path, &doc);
-	if (rc != EOK) {
-		/* Failed to open existing, create new repository */
-		rc = vol_volumes_sync(volumes);
-		if (rc != EOK)
-			goto error;
-	} else {
-		/*
-		 * Loaded existing configuration. Find 'volumes' node, should
-		 * be the first child of the root node.
-		 */
-		node = sif_node_first_child(sif_get_root(doc));
-
-		/* Verify it's the correct node type */
-		ntype = sif_node_get_type(node);
-		if (str_cmp(ntype, "volumes") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		rc = vol_volumes_load(node, volumes);
-		if (rc != EOK)
-			goto error;
-
-		sif_delete(doc);
-	}
-
-	return EOK;
-error:
-	if (doc != NULL)
-		(void) sif_delete(doc);
-	return rc;
-}
-
-/** Sync volume configuration to config file.
- *
- * @param volumes List of volumes
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_volumes_sync(vol_volumes_t *volumes)
-{
-	sif_doc_t *doc = NULL;
-	errno_t rc;
-
-	rc = sif_new(&doc);
-	if (rc != EOK)
-		goto error;
-
-	rc = vol_volumes_save(volumes, sif_get_root(doc));
-	if (rc != EOK)
-		goto error;
-
-	rc = sif_save(doc, volumes->cfg_path);
-	if (rc != EOK)
-		goto error;
-
-	sif_delete(doc);
-	return EOK;
-error:
-	if (doc != NULL)
-		(void) sif_delete(doc);
-	return rc;
-}
-
-/** Destroy list of volumes.
- *
- * @param volumes List of volumes or @c NULL
- */
-void vol_volumes_destroy(vol_volumes_t *volumes)
-{
-	link_t *link;
-	vol_volume_t *volume;
-
-	if (volumes == NULL)
-		return;
-
-	link = list_first(&volumes->volumes);
-	while (link != NULL) {
-		volume = list_get_instance(link, vol_volume_t, lvolumes);
-
-		list_remove(&volume->lvolumes);
-		vol_volume_delete(volume);
-
-		link = list_first(&volumes->volumes);
-	}
-
-	free(volumes->cfg_path);
-	free(volumes);
-}
-
-/** Add new volume structure to list of volumes.
- *
- * @param volumes List of volumes
- * @param volume Volume structure
- */
-static void vol_volume_add_locked(vol_volumes_t *volumes,
-    vol_volume_t *volume)
-{
-	assert(fibril_mutex_is_locked(&volumes->lock));
-	log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_volume_add_locked(%p)", volume);
-
-	volume->volumes = volumes;
-	list_append(&volume->lvolumes, &volumes->volumes);
-	volume->id.id = volumes->next_id;
-	++volumes->next_id;
-}
-
-/** Look up volume structure with locked volumes lock.
- *
- * If a matching existing volume is found, it is returned. Otherwise
- * a new volume structure is created.
- *
- * @param volumes List of volumes
- * @param label Volume label
- * @param rvolume Place to store pointer to volume structure (existing or new)
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-static errno_t vol_volume_lookup_ref_locked(vol_volumes_t *volumes,
-    const char *label, vol_volume_t **rvolume)
-{
-	vol_volume_t *volume;
-
-	assert(fibril_mutex_is_locked(&volumes->lock));
-
-	list_foreach(volumes->volumes, lvolumes, vol_volume_t, volume) {
-		if (str_cmp(volume->label, label) == 0 &&
-		    str_size(label) > 0) {
-			/* Add reference */
-			refcount_up(&volume->refcnt);
-			*rvolume = volume;
-			return EOK;
-		}
-	}
-
-	/* No existing volume found. Create a new one. */
-	volume = vol_volume_new();
-	if (volume == NULL)
-		return ENOMEM;
-
-	free(volume->label);
-	volume->label = str_dup(label);
-
-	if (volume->label == NULL) {
-		vol_volume_delete(volume);
-		return ENOMEM;
-	}
-
-	vol_volume_add_locked(volumes, volume);
-
-	*rvolume = volume;
-	return EOK;
-}
-
-/** Look up volume structure.
- *
- * If a matching existing volume is found, it is returned. Otherwise
- * a new volume structure is created.
- *
- * @param volumes List of volumes
- * @param label Volume label
- * @param rvolume Place to store pointer to volume structure (existing or new)
- *
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_volume_lookup_ref(vol_volumes_t *volumes, const char *label,
-    vol_volume_t **rvolume)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&volumes->lock);
-	rc = vol_volume_lookup_ref_locked(volumes, label, rvolume);
-	fibril_mutex_unlock(&volumes->lock);
-
-	return rc;
-}
-
-/** Find volume structure by ID with locked volumes lock.
- * *
- * @param volumes List of volumes
- * @param vid Volume ID
- * @param rvolume Place to store pointer to volume structure (existing or new)
- *
- * @return EOK on success, ENOENT if not found
- */
-static errno_t vol_volume_find_by_id_ref_locked(vol_volumes_t *volumes,
-    volume_id_t vid, vol_volume_t **rvolume)
-{
-	assert(fibril_mutex_is_locked(&volumes->lock));
-
-	list_foreach(volumes->volumes, lvolumes, vol_volume_t, volume) {
-		log_msg(LOG_DEFAULT, LVL_DEBUG2,
-		    "vol_volume_find_by_id_ref_locked(%zu==%zu)?",
-		    volume->id.id, vid.id);
-		if (volume->id.id == vid.id) {
-			log_msg(LOG_DEFAULT, LVL_DEBUG2,
-			    "vol_volume_find_by_id_ref_locked: found");
-			/* Add reference */
-			refcount_up(&volume->refcnt);
-			*rvolume = volume;
-			return EOK;
-		}
-	}
-
-	log_msg(LOG_DEFAULT, LVL_DEBUG2,
-	    "vol_volume_find_by_id_ref_locked: not found");
-	return ENOENT;
-}
-
-/** Find volume by ID.
- *
- * @param volumes Volumes
- * @param vid Volume ID
- * @param rvolume Place to store pointer to volume, with reference count
- *                increased.
- * @return EOK on success or an error code
- */
-errno_t vol_volume_find_by_id_ref(vol_volumes_t *volumes, volume_id_t vid,
-    vol_volume_t **rvolume)
-{
-	errno_t rc;
-
-	fibril_mutex_lock(&volumes->lock);
-	rc = vol_volume_find_by_id_ref_locked(volumes, vid, rvolume);
-	fibril_mutex_unlock(&volumes->lock);
-
-	return rc;
-}
-
-/** Determine if volume has non-default settings that need to persist.
- *
- * @param volume Volume
- * @return @c true iff volume has settings that need to persist
- */
-static bool vol_volume_is_persist(vol_volume_t *volume)
-{
-	return str_size(volume->mountp) > 0;
-}
-
-/** Delete reference to volume.
- *
- * @param volume Volume
- */
-void vol_volume_del_ref(vol_volume_t *volume)
-{
-	if (refcount_down(&volume->refcnt)) {
-		/* No more references. Check if volume is persistent. */
-		list_remove(&volume->lvolumes);
-		vol_volume_delete(volume);
-	}
-}
-
-/** Set volume mount point.
- *
- * @param volume Volume
- * @param mountp Mount point
- *
- * @return EOK on success or error code
- */
-errno_t vol_volume_set_mountp(vol_volume_t *volume, const char *mountp)
-{
-	char *mp;
-	char *old_mp;
-	bool was_persist;
-
-	mp = str_dup(mountp);
-	if (mp == NULL)
-		return ENOMEM;
-
-	was_persist = vol_volume_is_persist(volume);
-
-	old_mp = volume->mountp;
-	volume->mountp = mp;
-
-	if (vol_volume_is_persist(volume)) {
-		if (!was_persist) {
-			/*
-			 * Volume is now persistent. Prevent it from being
-			 * freed.
-			 */
-			refcount_up(&volume->refcnt);
-		}
-	} else {
-		if (was_persist) {
-			/*
-			 * Volume is now non-persistent
-			 * Allow volume to be freed.
-			 */
-			vol_volume_del_ref(volume);
-		}
-	}
-
-	vol_volumes_sync(volume->volumes);
-	free(old_mp);
-	return EOK;
-}
-
-/** Get list of volume IDs.
- *
- * Get the list of IDs of all persistent volumes (volume configuration
- * entries).
- *
- * @param volumes Volumes
- * @param id_buf Buffer to hold the IDs
- * @param buf_size Buffer size in bytes
- * @param act_size Place to store actual number bytes needed
- * @return EOK on success or an error code
- */
-errno_t vol_get_ids(vol_volumes_t *volumes, volume_id_t *id_buf,
-    size_t buf_size, size_t *act_size)
-{
-	size_t act_cnt;
-	size_t buf_cnt;
-
-	fibril_mutex_lock(&volumes->lock);
-
-	buf_cnt = buf_size / sizeof(volume_id_t);
-
-	act_cnt = 0;
-	list_foreach(volumes->volumes, lvolumes, vol_volume_t, volume) {
-		if (vol_volume_is_persist(volume))
-			++act_cnt;
-	}
-	*act_size = act_cnt * sizeof(volume_id_t);
-
-	if (buf_size % sizeof(volume_id_t) != 0) {
-		fibril_mutex_unlock(&volumes->lock);
-		return EINVAL;
-	}
-
-	size_t pos = 0;
-	list_foreach(volumes->volumes, lvolumes, vol_volume_t, volume) {
-		if (vol_volume_is_persist(volume)) {
-			if (pos < buf_cnt)
-				id_buf[pos].id = volume->id.id;
-			pos++;
-		}
-	}
-
-	fibril_mutex_unlock(&volumes->lock);
-	return EOK;
-}
-
-/** Load volumes from SIF document.
- *
- * @param nvolumes Volumes node
- * @param volumes Volumes object
- *
- * @return EOK on success or error code
- */
-static errno_t vol_volumes_load(sif_node_t *nvolumes, vol_volumes_t *volumes)
-{
-	sif_node_t *nvolume;
-	vol_volume_t *volume = NULL;
-	const char *label;
-	const char *mountp;
-	errno_t rc;
-
-	nvolume = sif_node_first_child(nvolumes);
-	while (nvolume != NULL) {
-		if (str_cmp(sif_node_get_type(nvolume), "volume") != 0) {
-			rc = EIO;
-			goto error;
-		}
-
-		volume = vol_volume_new();
-		if (volume == NULL) {
-			rc = ENOMEM;
-			goto error;
-		}
-
-		label = sif_node_get_attr(nvolume, "label");
-		mountp = sif_node_get_attr(nvolume, "mountp");
-
-		if (label == NULL || mountp == NULL) {
-			rc = EIO;
-			goto error;
-		}
-
-		free(volume->label);
-		free(volume->mountp);
-
-		volume->label = str_dup(label);
-		volume->mountp = str_dup(mountp);
-
-		fibril_mutex_lock(&volumes->lock);
-		vol_volume_add_locked(volumes, volume);
-		fibril_mutex_unlock(&volumes->lock);
-		nvolume = sif_node_next_child(nvolume);
-	}
-
-	return EOK;
-error:
-	if (volume != NULL)
-		vol_volume_delete(volume);
-	return rc;
-}
-
-/** Save volumes to SIF document.
- *
- * @param volumes List of volumes
- * @param rnode Configuration root node
- * @return EOK on success, ENOMEM if out of memory
- */
-errno_t vol_volumes_save(vol_volumes_t *volumes, sif_node_t *rnode)
-{
-	sif_node_t *nvolumes;
-	sif_node_t *node;
-	link_t *link;
-	vol_volume_t *volume;
-	errno_t rc;
-
-	/* Create 'volumes' node. */
-	rc = sif_node_append_child(rnode, "volumes", &nvolumes);
-	if (rc != EOK)
-		goto error;
-
-	link = list_first(&volumes->volumes);
-	while (link != NULL) {
-		volume = list_get_instance(link, vol_volume_t, lvolumes);
-
-		if (vol_volume_is_persist(volume)) {
-			/* Create 'volume' node. */
-			rc = sif_node_append_child(nvolumes, "volume", &node);
-			if (rc != EOK)
-				goto error;
-
-			rc = sif_node_set_attr(node, "label", volume->label);
-			if (rc != EOK)
-				goto error;
-
-			rc = sif_node_set_attr(node, "mountp", volume->mountp);
-			if (rc != EOK)
-				goto error;
-		}
-
-		link = list_next(&volume->lvolumes, &volumes->volumes);
-	}
-
-	return EOK;
-error:
-	return rc;
-}
-
-/** Get volume information.
- *
- * @param volume Volume
- * @param vinfo Volume information structure to safe info to
- * @return EOK on success or an error code
- */
-errno_t vol_volume_get_info(vol_volume_t *volume, vol_info_t *vinfo)
-{
-	vinfo->id = volume->id;
-	str_cpy(vinfo->label, sizeof(vinfo->label), volume->label);
-	str_cpy(vinfo->path, sizeof(vinfo->path), volume->mountp);
-	return EOK;
-}
-
-/** @}
- */
Index: pace/srv/volsrv/volume.h
===================================================================
--- uspace/srv/volsrv/volume.h	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,60 +1,0 @@
-/*
- * Copyright (c) 2024 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup volsrv
- * @{
- */
-/**
- * @file
- * @brief
- */
-
-#ifndef VOLUME_H_
-#define VOLUME_H_
-
-#include "types/vol.h"
-#include "types/volume.h"
-
-extern errno_t vol_volumes_create(const char *, vol_volumes_t **);
-extern errno_t vol_volumes_merge_to(vol_volumes_t *, const char *);
-extern errno_t vol_volumes_sync(vol_volumes_t *);
-extern void vol_volumes_destroy(vol_volumes_t *);
-extern errno_t vol_volume_lookup_ref(vol_volumes_t *, const char *,
-    vol_volume_t **);
-extern errno_t vol_volume_find_by_id_ref(vol_volumes_t *, volume_id_t,
-    vol_volume_t **);
-extern void vol_volume_del_ref(vol_volume_t *);
-extern errno_t vol_volume_set_mountp(vol_volume_t *, const char *);
-extern errno_t vol_get_ids(vol_volumes_t *, volume_id_t *, size_t,
-    size_t *);
-extern errno_t vol_volume_get_info(vol_volume_t *, vol_info_t *);
-
-#endif
-
-/** @}
- */
Index: rsion
===================================================================
--- version	(revision 03396700b1d0aa8cd68258367bf6a0b9f1dcd71c)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2006 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-HELENOS_RELEASE = 0.14.1
-HELENOS_CODENAME = Aladar
-HELENOS_COPYRIGHT = Copyright (c) 2001-2024 HelenOS project
